diff --git a/lean/OAI.lean b/lean/OAI.lean index df67b885116c825586e41cba73f1279908a60a73..25043044e4c10e19f79e7db62e602ef3aee93c7f 100644 --- a/lean/OAI.lean +++ b/lean/OAI.lean @@ -1,914 +1,914 @@ -import OAI.Algebra.AffineCancellation.Main -import OAI.Algebra.AlgebraicObstruction.AlgebraicInput -import OAI.Algebra.AlgebraicObstruction.Holonomy -import OAI.Algebra.AuslanderReiten.All -import OAI.Algebra.BogomolovPop.Injectivity -import OAI.Algebra.Cohomology.SemilinearCochains -import OAI.Algebra.DepthFive.Main -import OAI.Algebra.Determinantal.Main -import OAI.Algebra.Divisor.Normalization -import OAI.Algebra.Divisor.RationalRecovery -import OAI.Algebra.Drinfeld.Completion -import OAI.Algebra.FiniteTensor.Main -import OAI.Algebra.Finitistic.Main -import OAI.Algebra.FinitisticAsymmetry.Main -import OAI.Algebra.FormalGroup.Honda.Main -import OAI.Algebra.FormulaHitting.Main -import OAI.Algebra.FrobeniusObstruction.Obstruction -import OAI.Algebra.GroupRing.CylinderRetention -import OAI.Algebra.GroupRing.Main -import OAI.Algebra.MarkedTensor.Main -import OAI.Algebra.Module.CompactPadic -import OAI.Algebra.OddKaplansky.GeneralTransfer -import OAI.Algebra.PolynomialChains.Real -import OAI.Algebra.Universal.Coset -import OAI.Algebra.Universal.GraphDecidability -import OAI.AlgebraicGeometry.AbhyankarSathaye.Counterexample -import OAI.AlgebraicGeometry.CartierSections -import OAI.AlgebraicGeometry.CharacterVarieties -import OAI.AlgebraicGeometry.CommutingDerivations.OrdinaryExtraMain -import OAI.AlgebraicGeometry.LogKodaira.FiberNegative -import OAI.AlgebraicGeometry.LogKodaira.RootFactor -import OAI.AlgebraicGeometry.NumericalDimension.IndexedTransfer -import OAI.AlgebraicGeometry.NumericalDimension.RelativeNegativity -import OAI.AlgebraicGeometry.NumericalDimension.TwistedPushforward -import OAI.AlgebraicGeometry.PlaneCurves.Nagata -import OAI.AlgebraicGeometry.RelativeTriviality.RelativeTriviality -import OAI.AlgebraicGeometry.SectionFields.Main -import OAI.AlgebraicGeometry.Seshadri.Main -import OAI.AlgebraicGeometry.Stability.NumericalWalls -import OAI.AlgebraicGeometry.StableCoordinate.All -import OAI.AlgebraicGeometry.SurfaceCones -import OAI.Analysis.AffineBernstein.Main -import OAI.Analysis.AllenCahn.Main -import OAI.Analysis.AncientFlat.Main -import OAI.Analysis.BackwardIntertwiners.AlgebraCorollary -import OAI.Analysis.BernoulliCone.Main -import OAI.Analysis.BiholderTransport.Main -import OAI.Analysis.BoundedHochschild.AtomicPrimitives -import OAI.Analysis.BoundedHochschild.CenterPowers -import OAI.Analysis.BoundedHochschild.CentralLinearPatch -import OAI.Analysis.BoundedHochschild.CocycleNormalParts -import OAI.Analysis.BoundedHochschild.CommutativePrimitives -import OAI.Analysis.BoundedHochschild.FactorFinitePaths -import OAI.Analysis.BoundedHochschild.FactorPrimitive -import OAI.Analysis.BoundedHochschild.FreeWords -import OAI.Analysis.BoundedHochschild.MainResult -import OAI.Analysis.BoundedHochschild.MatrixDisplacement -import OAI.Analysis.BoundedHochschild.TypeIICorners -import OAI.Analysis.BoundedHochschild.TypeIPrimitives -import OAI.Analysis.BoundedHochschild.UnitaryLifts -import OAI.Analysis.BoxTransport.Routing -import OAI.Analysis.Brenier.Stability -import OAI.Analysis.BrownMeasure.Main -import OAI.Analysis.C0Absorption.Main -import OAI.Analysis.CStarAlgebra.PureInfiniteness.Main -import OAI.Analysis.CardinalInterpolation.ModTwelve -import OAI.Analysis.CharacterCriterion.Main -import OAI.Analysis.CircleDomains.LengthArea -import OAI.Analysis.CircleDomains.Development -import OAI.Analysis.Commutator.Main -import OAI.Analysis.Conductivity.Main -import OAI.Analysis.Cotype.Main -import OAI.Analysis.CoulombIonization.Main -import OAI.Analysis.CoulombRadii.Main -import OAI.Analysis.CoulombTransport.Main -import OAI.Analysis.Crouzeix.Main -import OAI.Analysis.Daugavet.Main -import OAI.Analysis.DiamondDistortion.Main -import OAI.Analysis.DirectCrouzeix.Main -import OAI.Analysis.DiskMaximal.Main -import OAI.Analysis.FactorGeneration.Main -import OAI.Analysis.FiniteFactor.Main -import OAI.Analysis.ForestSpace.Main -import OAI.Analysis.Fourier.HeightLayers -import OAI.Analysis.Fourier.SphereExtension -import OAI.Analysis.FourierExtension.LpEstimate -import OAI.Analysis.FourierLLogL.PaperMain -import OAI.Analysis.FreeEntropy.Main -import OAI.Analysis.FreeGroupFactor.Main -import OAI.Analysis.FreeWords.Main -import OAI.Analysis.Graph.Gradients -import OAI.Analysis.GroupDeterminants.Main -import OAI.Analysis.HardSphere.Main -import OAI.Analysis.HenonEmden.Main -import OAI.Analysis.HilbertCrouzeix.Main -import OAI.Analysis.HotSpots.Main -import OAI.Analysis.HyperbolicCones -import OAI.Analysis.Hyperinvariant -import OAI.Analysis.IncompressibleFlow.AffineExtension -import OAI.Analysis.InnerProductSpace.ComplexSolvability -import OAI.Analysis.IntegralMeans.Main -import OAI.Analysis.IntegralMeans.SharpEndpoints -import OAI.Analysis.InterpolatedFactors.Interpolation -import OAI.Analysis.IrrationalRotation.Main -import OAI.Analysis.JiangSu.Main -import OAI.Analysis.Kakeya.FixedScale -import OAI.Analysis.Kaplansky.Main -import OAI.Analysis.Kaplansky.StableFiniteness -import OAI.Analysis.Laughlin.Main -import OAI.Analysis.Laughlin.UniformGap -import OAI.Analysis.LaughlinFock.Main -import OAI.Analysis.LaughlinFock.TensorIntegrals -import OAI.Analysis.LaughlinGap.Main -import OAI.Analysis.LaughlinGap.ThreeAveraging -import OAI.Analysis.LiebThirring.CoerciveInverse -import OAI.Analysis.LiebThirring.CompactAlternative -import OAI.Analysis.LiebThirring.ContinuousRepresentative -import OAI.Analysis.LiebThirring.DiscreteSpectrum -import OAI.Analysis.LiebThirring.Eigenspace -import OAI.Analysis.LiebThirring.EigenvalueSum -import OAI.Analysis.LiebThirring.FormCongruence -import OAI.Analysis.LiebThirring.FreeForm -import OAI.Analysis.LiebThirring.LocalCompactness -import OAI.Analysis.LiebThirring.LocalWeight -import OAI.Analysis.LiebThirring.LowestEigenvalue -import OAI.Analysis.LiebThirring.Main -import OAI.Analysis.LiebThirring.Multiplication -import OAI.Analysis.LiebThirring.NegativeResolvent -import OAI.Analysis.LiebThirring.OneState -import OAI.Analysis.LiebThirring.OperatorForm -import OAI.Analysis.LiebThirring.OperatorGraph -import OAI.Analysis.LiebThirring.PotentialCompactness -import OAI.Analysis.LiebThirring.PotentialSplit -import OAI.Analysis.LiebThirring.Resolvent -import OAI.Analysis.LiebThirring.SchrodingerOperator -import OAI.Analysis.LiebThirring.SobolevBound -import OAI.Analysis.LiebThirring.SpectralMain -import OAI.Analysis.LiebThirring.SpectralMoment -import OAI.Analysis.LiebThirring.WeightedCutoff -import OAI.Analysis.LienardCycles.Main -import OAI.Analysis.Lipschitz.TriangularLattice -import OAI.Analysis.LipschitzEquivalence.Main -import OAI.Analysis.LipschitzFree.Main -import OAI.Analysis.LipschitzFree.Renorming -import OAI.Analysis.LipschitzHilbert.Main -import OAI.Analysis.Littlewood.Main -import OAI.Analysis.Littlewood.FiniteFlatness -import OAI.Analysis.LpDimension.Main -import OAI.Analysis.Mahler -import OAI.Analysis.Mahler.Classification -import OAI.Analysis.MarkovType.All -import OAI.Analysis.MassAction.Main -import OAI.Analysis.MatrixSigning.Main -import OAI.Analysis.MetricEntropy.Main -import OAI.Analysis.ModularRecovery.Main -import OAI.Analysis.MumfordShah.CompactExclusion -import OAI.Analysis.MutuallyUnbiased.Bases.ThreeMain -import OAI.Analysis.MutuallyUnbiased.Main -import OAI.Analysis.Naimark.Tracial -import OAI.Analysis.NavierStokes.VelocitySpace -import OAI.Analysis.NefAdjoint.FractionalDensity -import OAI.Analysis.NefAdjoint.SectionGauge -import OAI.Analysis.NodalLength.Main -import OAI.Analysis.Nonexpansive -import OAI.Analysis.NuclearUltrapower.Main -import OAI.Analysis.NumericalRange.Main -import OAI.Analysis.PathSelection.Main -import OAI.Analysis.PeriodicLattice.Main -import OAI.Analysis.PlanarEndpoint.Main -import OAI.Analysis.Polynomial.Exhaustion -import OAI.Analysis.ProductSpaces.Main -import OAI.Analysis.Pureness.Main -import OAI.Analysis.Quantum.DimensionTen.Main -import OAI.Analysis.RCDHeat.Main -import OAI.Analysis.RecursivePotentials.EquivalentNorms -import OAI.Analysis.RecursivePotentials.JoinedGeometry -import OAI.Analysis.RecursivePotentials.Main -import OAI.Analysis.RecursivePotentials.Model -import OAI.Analysis.RecursivePotentials.TreeGeometry -import OAI.Analysis.RecursivePotentials.VariableCompletion -import OAI.Analysis.RecursivePotentials.VariableEstimates -import OAI.Analysis.RecursivePotentials.VariableLp -import OAI.Analysis.RecursivePotentials.VariableStability -import OAI.Analysis.RecursivePotentials.ZeroRootGeometry -import OAI.Analysis.RelativeGeneration.Main -import OAI.Analysis.RieszRectifiability.Main -import OAI.Analysis.RotationWeights.Main -import OAI.Analysis.SegmentLenses.HeadRanges -import OAI.Analysis.SegmentLenses.Main -import OAI.Analysis.SeparableQuotients.Main -import OAI.Analysis.SeparableQuotients.Positive.Main -import OAI.Analysis.SignedDisk.Main -import OAI.Analysis.SphereIsometry.Main -import OAI.Analysis.Steinitz.Main -import OAI.Analysis.StrictMeans.Main -import OAI.Analysis.StructuralCrouzeix.Endpoint -import OAI.Analysis.SymmetricDomains.Main -import OAI.Analysis.TemperedDistribution.ConformalIdentities -import OAI.Analysis.TraceCone.Main -import OAI.Analysis.TracialCohomology.Vanishing -import OAI.Analysis.TracialSplitting.Main -import OAI.Analysis.TreePotential.Main -import OAI.Analysis.Triangular.Main -import OAI.Analysis.TriangularHilbert.Main -import OAI.Analysis.Unitarizability.AllDiscrete -import OAI.Analysis.Unitarizability.UniverseTransport -import OAI.Analysis.VlasovMaxwell.Main -import OAI.Analysis.WeakInfiniteness.Main -import OAI.CategoryTheory.Globular.Main -import OAI.CategoryTheory.ThickClosure.Main -import OAI.CategoryTheory.Thomason.RankedFaithfulness -import OAI.Combinatorics.Automata.Main -import OAI.Combinatorics.BalancedRyser.Main -import OAI.Combinatorics.BooleanFunctions.Main -import OAI.Combinatorics.Chromatic.Main -import OAI.Combinatorics.CliqueFree.Main -import OAI.Combinatorics.Coboundary.Main -import OAI.Combinatorics.CompleteCrossing.Main -import OAI.Combinatorics.ContingencyTables.FactorialLift -import OAI.Combinatorics.Crossing.Main -import OAI.Combinatorics.CycleDecomposition.Main -import OAI.Combinatorics.DiscreteConvexity.Main -import OAI.Combinatorics.Distances.PolynomialIsolation -import OAI.Combinatorics.EditDistance.Main -import OAI.Combinatorics.EuclideanRamsey.Circle -import OAI.Combinatorics.EuclideanRamsey.Main -import OAI.Combinatorics.EuclideanRamsey.NineStatement -import OAI.Combinatorics.EuclideanRamsey.Quadratic -import OAI.Combinatorics.EuclideanRamsey.Spherical -import OAI.Combinatorics.EuclideanRamsey.Transitive -import OAI.Combinatorics.ExpectationThreshold.Main -import OAI.Combinatorics.FiniteCircle.Main -import OAI.Combinatorics.GotsmanLinial.Main -import OAI.Combinatorics.GraphSpectrum.SampledChromatic -import OAI.Combinatorics.GraphThreshold.Main -import OAI.Combinatorics.HadwigerCounterexample.Main -import OAI.Combinatorics.HalvingLines.Main -import OAI.Combinatorics.Hamiltonian.Main -import OAI.Combinatorics.Honeycomb.FiniteCylinder -import OAI.Combinatorics.Honeycomb.PolygonMoment -import OAI.Combinatorics.HoneycombBridges.ExactLength -import OAI.Combinatorics.HoneycombBridges.Geometry -import OAI.Combinatorics.HoneycombChords -import OAI.Combinatorics.HoneycombCorridor.CorridorTransfer -import OAI.Combinatorics.IndependentSets.Main -import OAI.Combinatorics.InfiniteMatroid.Corollaries -import OAI.Combinatorics.InfiniteMatroid.Main -import OAI.Combinatorics.KMedian.Main -import OAI.Combinatorics.KMedian.Threshold -import OAI.Combinatorics.KMedianRecovery.Main -import OAI.Combinatorics.KMedianRecovery.Refined.Main -import OAI.Combinatorics.KMedianRecovery.Refined.Recovery -import OAI.Combinatorics.KServer.Main -import OAI.Combinatorics.ListHadwiger.Main -import OAI.Combinatorics.MatchingCount.Main -import OAI.Combinatorics.MatchingEntropy.Main -import OAI.Combinatorics.Permanent.Main -import OAI.Combinatorics.PolynomialVacuum.Main -import OAI.Combinatorics.PortMatching.Reduction -import OAI.Combinatorics.Progressions.Main -import OAI.Combinatorics.Ramsey.CycleClique.Main -import OAI.Combinatorics.Ramsey.Hypercube -import OAI.Combinatorics.RamseyFive.Main -import OAI.Combinatorics.StableGraphs.ExteriorBounds -import OAI.Combinatorics.StripMass.Main -import OAI.Combinatorics.SumProduct.Alignment.Main -import OAI.Combinatorics.ThinTrees.AlgorithmicMain -import OAI.Combinatorics.TriangleFace.Main -import OAI.Combinatorics.MatchingPSD.AffineLift -import OAI.Combinatorics.MatchingPSD.Main -import OAI.Combinatorics.MatrixRemoval.Main -import OAI.Combinatorics.MatroidCounting.CommonBases -import OAI.Combinatorics.ParityLifts.AsymptoticBounds -import OAI.Combinatorics.PerfectMatching.AlgorithmPartition -import OAI.Combinatorics.PerfectMatching.Ascent -import OAI.Combinatorics.PerfectMatching.CompletePairs -import OAI.Combinatorics.PerfectMatching.Completion -import OAI.Combinatorics.PerfectMatching.CountCorrect -import OAI.Combinatorics.PerfectMatching.DyadicEntropy -import OAI.Combinatorics.PerfectMatching.DyadicEnvelope -import OAI.Combinatorics.PerfectMatching.ElementaryCount -import OAI.Combinatorics.PerfectMatching.EntropyUpper -import OAI.Combinatorics.PerfectMatching.FeasibilityRepair -import OAI.Combinatorics.PerfectMatching.ForcedReduction -import OAI.Combinatorics.PerfectMatching.Main -import OAI.Combinatorics.PerfectMatching.Model -import OAI.Combinatorics.PerfectMatching.ObjectivePenalty -import OAI.Combinatorics.PerfectMatching.ParameterBounds -import OAI.Combinatorics.PerfectMatching.Partition -import OAI.Combinatorics.PerfectMatching.Separable -import OAI.Combinatorics.PerfectMatching.SeparableCount -import OAI.Combinatorics.PerfectMatching.SeparableCovariance -import OAI.Combinatorics.PerfectMatching.SeparableLower -import OAI.Combinatorics.PerfectMatching.SizeBounds -import OAI.Combinatorics.PerfectMatching.Violation -import OAI.Combinatorics.PerfectMatching.WeightedSpectrum -import OAI.Combinatorics.PlanarL1.Embedding -import OAI.Combinatorics.ProgressionColoring.Main -import OAI.Combinatorics.Ryser.Main -import OAI.Combinatorics.Ryser.OddExtensions -import OAI.Combinatorics.SecondNeighborhood.Main -import OAI.Combinatorics.Sensitivity.Main -import OAI.Combinatorics.SharpRamsey.Main -import OAI.Combinatorics.SharpThreshold.Main -import OAI.Combinatorics.Sidorenko.RandomHost -import OAI.Combinatorics.SnakyCertificate.Main -import OAI.Combinatorics.SparsestCut.Main -import OAI.Combinatorics.SphericalRamsey -import OAI.Combinatorics.SphericalRamsey.Result -import OAI.Combinatorics.SquareDifference.Main -import OAI.Combinatorics.ThinTrees.Main -import OAI.Combinatorics.TreeEdit.Main -import OAI.Combinatorics.TreewidthL1.Main -import OAI.Combinatorics.TriangleRemoval.Main -import OAI.Combinatorics.TwoWayAutomata.ExplicitFamily -import OAI.Combinatorics.TwoWayAutomata.Main -import OAI.Combinatorics.TwoWayAutomata.PolynomialBound -import OAI.Combinatorics.UniformKServer.Main -import OAI.Combinatorics.VariableWL -import OAI.Combinatorics.YoungDiagram.RealCapacity -import OAI.Combinatorics.YoungDiagram.RealLargeCapacity -import OAI.Computability.BinPacking.Main -import OAI.Computability.DegreeRigidity.Main -import OAI.Computability.DepthThree -import OAI.Computability.DeterministicSum.Main -import OAI.Computability.DirectedFeedback.Main -import OAI.Computability.FourierCircuit.Main -import OAI.Computability.FourierTransform.Main -import OAI.Computability.GeneralizedCircuits.Mesh -import OAI.Computability.Logspace.Deterministic -import OAI.Computability.Logspace.Equality -import OAI.Computability.LoopMatching.Endpoint -import OAI.Computability.MatchingCount.ArgRoutine -import OAI.Computability.MatchingCount.BinaryAlgorithm -import OAI.Computability.MatchingCount.BinaryParser -import OAI.Computability.MatchingCount.BinarySolve -import OAI.Computability.MatchingCount.CappedPower -import OAI.Computability.MatchingCount.CutAlgebra -import OAI.Computability.MatchingCount.DenseOracle -import OAI.Computability.MatchingCount.DivisionRoutine -import OAI.Computability.MatchingCount.FiniteStack -import OAI.Computability.MatchingCount.FoldRoutine -import OAI.Computability.MatchingCount.GuardRoutine -import OAI.Computability.MatchingCount.IntegerRoutine -import OAI.Computability.MatchingCount.IterateRoutine -import OAI.Computability.MatchingCount.LengthRoutine -import OAI.Computability.MatchingCount.ListNumeric -import OAI.Computability.MatchingCount.ListRoutine -import OAI.Computability.MatchingCount.MapRoutine -import OAI.Computability.MatchingCount.OddCutParity -import OAI.Computability.MatchingCount.OddCutUncross -import OAI.Computability.MatchingCount.OddMincut -import OAI.Computability.MatchingCount.OptionCases -import OAI.Computability.MatchingCount.OracleBounds -import OAI.Computability.MatchingCount.OrbitRoutine -import OAI.Computability.MatchingCount.PairRoutine -import OAI.Computability.MatchingCount.ParamRoutine -import OAI.Computability.MatchingCount.ParserSupport -import OAI.Computability.MatchingCount.PolyCoding -import OAI.Computability.MatchingCount.ProjectionRoutine -import OAI.Computability.MatchingCount.RawBitsBridge -import OAI.Computability.MatchingCount.RawContraction -import OAI.Computability.MatchingCount.RawContractionCompiler -import OAI.Computability.MatchingCount.RawData -import OAI.Computability.MatchingCount.RawFlow -import OAI.Computability.MatchingCount.RawFlowCompiler -import OAI.Computability.MatchingCount.RawFlowSize -import OAI.Computability.MatchingCount.RawInput -import OAI.Computability.MatchingCount.RawOddBounds -import OAI.Computability.MatchingCount.RawOddCompiler -import OAI.Computability.MatchingCount.RawOddCut -import OAI.Computability.MatchingCount.RawOptimizer -import OAI.Computability.MatchingCount.RawOptimizerCompiler -import OAI.Computability.MatchingCount.RawOptimizerData -import OAI.Computability.MatchingCount.RawOptimizerDataCompiler -import OAI.Computability.MatchingCount.RawOptimizerRows -import OAI.Computability.MatchingCount.RawOptimizerRowsCompiler -import OAI.Computability.MatchingCount.RawPrimitives -import OAI.Computability.MatchingCount.RawRoutine -import OAI.Computability.MatchingCount.RawSearch -import OAI.Computability.MatchingCount.RawSearchCompiler -import OAI.Computability.MatchingCount.RawSearchSize -import OAI.Computability.MatchingCount.RawSize -import OAI.Computability.MatchingCount.RecursiveBounds -import OAI.Computability.MatchingCount.RecursiveCoding -import OAI.Computability.MatchingCount.RecursiveCompiler -import OAI.Computability.MatchingCount.RecursiveEval -import OAI.Computability.MatchingCount.ResidualSearch -import OAI.Computability.MatchingCount.ScaledAlgorithm -import OAI.Computability.MatchingCount.ScaledBounds -import OAI.Computability.MatchingCount.ScaledState -import OAI.Computability.MatchingCount.SelectRoutine -import OAI.Computability.MatchingCount.SequenceRoutine -import OAI.Computability.MatchingCount.StackCopy -import OAI.Computability.MatchingCount.StackEmbed -import OAI.Computability.MatchingCount.StackFrame -import OAI.Computability.MatchingCount.StackMacros -import OAI.Computability.MatchingCount.StackPair -import OAI.Computability.MatchingCount.StackRoutine -import OAI.Computability.MatchingCount.SumRoutine -import OAI.Computability.MatchingCount.TerminalMincut -import OAI.Computability.MatchingCount.UnaryArithmetic -import OAI.Computability.MatchingCount.UnaryClog -import OAI.Computability.MatchingCount.UnaryDivision -import OAI.Computability.MatchingCount.UnitFlow -import OAI.Computability.MatchingCount.UnitMincut -import OAI.Computability.MaxCut.Main -import OAI.Computability.MeanPayoff.Main -import OAI.Computability.MinUncut.Main -import OAI.Computability.PerfectCompleteness.Main -import OAI.Computability.QuantumFactoring.Main -import OAI.Computability.RandomMean.Main -import OAI.Computability.RationalHitting.Main -import OAI.Computability.Scheduling.Main -import OAI.Computability.SpaceSimulation.Main -import OAI.Computability.StarHeight.Main -import OAI.Computability.Superstring.Main -import OAI.Computability.TypeSystem.Normalization -import OAI.Computability.UniqueGames.Main -import OAI.Computability.VertexCover.Main -import OAI.Computability.WLIdentification.Main -import OAI.Computability.WeisfeilerLeman.Main -import OAI.Computability.WitnessedChoice.Main -import OAI.Dynamics.ConditionalShuffle.TwoColors -import OAI.Dynamics.EntropyCounterexample -import OAI.Dynamics.MultipleMixing.Main -import OAI.Dynamics.SmoothObstruction.Main -import OAI.Dynamics.StandardMap.ComponentsMain -import OAI.Dynamics.StandardMap.EntropyEndpoint -import OAI.Dynamics.StandardMap.EntropyLyapunov -import OAI.Dynamics.ThreeTorus.Main -import OAI.Dynamics.TriangleBilliards.Main -import OAI.GameTheory.SnakyConditional.Main -import OAI.GameTheory.SnakyTwentyOne.Main -import OAI.Geometry.Anticanonical.BranchedQuotient -import OAI.Geometry.Anticanonical.DeckRecovery -import OAI.Geometry.Anticanonical.DeletedFaces -import OAI.Geometry.Anticanonical.HilbertEstimates -import OAI.Geometry.Arnold.Main -import OAI.Geometry.BallPacking.Main -import OAI.Geometry.BallPacking.Necessity.Main -import OAI.Geometry.Borsuk.Main -import OAI.Geometry.CAT0Fillings.Main -import OAI.Geometry.Cannon.Main -import OAI.Geometry.ConjugatePoints.ThreeManifold -import OAI.Geometry.CoveringDensity.Main -import OAI.Geometry.CubicTorus.Main -import OAI.Geometry.CylinderCovering.Main -import OAI.Geometry.DoublingHilbert.CompactBanach -import OAI.Geometry.DoublingHilbert.Main -import OAI.Geometry.HarmonicGrowth.Main -import OAI.Geometry.HeilbronnTriangle -import OAI.Geometry.HyperbolicGroups.BipartiteLink -import OAI.Geometry.HyperbolicGroups.ClosedPicture -import OAI.Geometry.HyperbolicGroups.LetterFillingArea -import OAI.Geometry.HyperbolicGroups.LocalSegmentContinuation -import OAI.Geometry.HyperbolicGroups.LocalSegmentTools -import OAI.Geometry.HyperbolicGroups.Main -import OAI.Geometry.HyperbolicGroups.Parity -import OAI.Geometry.HyperbolicGroups.PolygonContraction -import OAI.Geometry.HyperbolicGroups.TreePathDepth -import OAI.Geometry.HypersurfaceGerms.Main -import OAI.Geometry.Immersion.ClosedSurface.Main -import OAI.Geometry.IntegralFillings.Main -import OAI.Geometry.IsometricImmersion.All -import OAI.Geometry.Kahler -import OAI.Geometry.KahlerSplitting.Main -import OAI.Geometry.LatticeCovering -import OAI.Geometry.LogVolume.BrunnMinkowski -import OAI.Geometry.Manifold.ProjectiveSphere -import OAI.Geometry.NearbyLagrangian.Main -import OAI.Geometry.NearbyLagrangian.TubeKernel -import OAI.Geometry.NegativeCurvature.Tube -import OAI.Geometry.NilpotentCharts.Main -import OAI.Geometry.NodalSets.Main -import OAI.Geometry.Perimeter.Regularity.Main -import OAI.Geometry.PeriodicTiling.Main -import OAI.Geometry.PinnedDistances.Pins -import OAI.Geometry.PlaneColoring.Five -import OAI.Geometry.PlaneColoring.Main -import OAI.Geometry.PolarProducts.Main -import OAI.Geometry.PrescribedPotential.AtlasLocalization -import OAI.Geometry.PrescribedPotential.AugmentedVolume -import OAI.Geometry.PrescribedPotential.CalabiFrameCalculus -import OAI.Geometry.PrescribedPotential.CalabiFrameScalars -import OAI.Geometry.PrescribedPotential.CalabiRicciContraction -import OAI.Geometry.PrescribedPotential.ClosedRangeSmooth -import OAI.Geometry.PrescribedPotential.CommutatorSupport -import OAI.Geometry.PrescribedPotential.CompletedProduct -import OAI.Geometry.PrescribedPotential.CompletedRealification -import OAI.Geometry.PrescribedPotential.CompletedVolume -import OAI.Geometry.PrescribedPotential.CoordinateEllipticity -import OAI.Geometry.PrescribedPotential.CoordinateExtension -import OAI.Geometry.PrescribedPotential.CoordinateMinimumBound -import OAI.Geometry.PrescribedPotential.CoordinatePotential -import OAI.Geometry.PrescribedPotential.DerivativeEllipticGain -import OAI.Geometry.PrescribedPotential.DerivativeLocalization -import OAI.Geometry.PrescribedPotential.EvenRellich -import OAI.Geometry.PrescribedPotential.FixedScaleBootstrap -import OAI.Geometry.PrescribedPotential.FredholmKernel -import OAI.Geometry.PrescribedPotential.FredholmRegularity -import OAI.Geometry.PrescribedPotential.GlobalBounds -import OAI.Geometry.PrescribedPotential.GlobalError -import OAI.Geometry.PrescribedPotential.GlobalFiniteEmbedding -import OAI.Geometry.PrescribedPotential.GlobalNonlinearCommutator -import OAI.Geometry.PrescribedPotential.GlobalProduct -import OAI.Geometry.PrescribedPotential.GlobalRellich -import OAI.Geometry.PrescribedPotential.GlobalSmooth -import OAI.Geometry.PrescribedPotential.HigherMetricOperator -import OAI.Geometry.PrescribedPotential.HigherPoisson -import OAI.Geometry.PrescribedPotential.HigherResolvent -import OAI.Geometry.PrescribedPotential.LinearizedCommutator -import OAI.Geometry.PrescribedPotential.MetricQuasilinearEquation -import OAI.Geometry.PrescribedPotential.NonlinearCoreCommutator -import OAI.Geometry.PrescribedPotential.NonlinearRemainderStrong -import OAI.Geometry.PrescribedPotential.PathCalabiBound -import OAI.Geometry.PrescribedPotential.PathCoordinateDensity -import OAI.Geometry.PrescribedPotential.PathFrameBounds -import OAI.Geometry.PrescribedPotential.PointPoisson -import OAI.Geometry.PrescribedPotential.PositiveOpenness -import OAI.Geometry.PrescribedPotential.PositivePotentialLinearization -import OAI.Geometry.PrescribedPotential.PotentialDensityDifferential -import OAI.Geometry.PrescribedPotential.PrescribedPotential -import OAI.Geometry.PrescribedPotential.QuantitativeResolvent -import OAI.Geometry.PrescribedPotential.RealMapSmooth -import OAI.Geometry.PrescribedPotential.RealPoisson -import OAI.Geometry.PrescribedPotential.RealSmoothCompactness -import OAI.Geometry.PrescribedPotential.RegularityCutoffs -import OAI.Geometry.PrescribedPotential.RegularityJets -import OAI.Geometry.PrescribedPotential.SmoothChartInverse -import OAI.Geometry.PrescribedPotential.SmoothLocalPath -import OAI.Geometry.PrescribedPotential.SmoothPathLimit -import OAI.Geometry.PrescribedPotential.SmoothSequenceCompactness -import OAI.Geometry.PrescribedPotential.SobolevDetDifferential -import OAI.Geometry.PrescribedPotential.SobolevExponential -import OAI.Geometry.PrescribedPotential.SobolevFirstGain -import OAI.Geometry.PrescribedPotential.SobolevOpenness -import OAI.Geometry.PrescribedPotential.TwoScaleRegularity -import OAI.Geometry.PrescribedPotential.UniformPathSobolev -import OAI.Geometry.PrescribedPotential.WeakDerivativeLocalization -import OAI.Geometry.PrescribedPotential.WeakPositive -import OAI.Geometry.PrescribedRicci.BoundedSmoothPoisson -import OAI.Geometry.PrescribedRicci.CalabiGradient -import OAI.Geometry.PrescribedRicci.CalabiMetricC1 -import OAI.Geometry.PrescribedRicci.CalabiRough -import OAI.Geometry.PrescribedRicci.CalabiTrace -import OAI.Geometry.PrescribedRicci.CalabiTraceBound -import OAI.Geometry.PrescribedRicci.ChernBianchi -import OAI.Geometry.PrescribedRicci.ChernLuConnection -import OAI.Geometry.PrescribedRicci.ChernRough -import OAI.Geometry.PrescribedRicci.CofactorCore -import OAI.Geometry.PrescribedRicci.CofactorCoreEquation -import OAI.Geometry.PrescribedRicci.CofactorLocalization -import OAI.Geometry.PrescribedRicci.CompactPathBounds -import OAI.Geometry.PrescribedRicci.CompactPathRicci -import OAI.Geometry.PrescribedRicci.FixedCofactorBootstrap -import OAI.Geometry.PrescribedRicci.FixedCofactorStep -import OAI.Geometry.PrescribedRicci.GlobalSmoothCompact -import OAI.Geometry.PrescribedRicci.IntegratedKahlerEnergy -import OAI.Geometry.PrescribedRicci.JetProductL2 -import OAI.Geometry.PrescribedRicci.KahlerCauchySchwarz -import OAI.Geometry.PrescribedRicci.KahlerChartGradient -import OAI.Geometry.PrescribedRicci.KahlerChartLp -import OAI.Geometry.PrescribedRicci.KahlerEnergyProduct -import OAI.Geometry.PrescribedRicci.KahlerIntegralPos -import OAI.Geometry.PrescribedRicci.KahlerL2Comparison -import OAI.Geometry.PrescribedRicci.KahlerPoincare -import OAI.Geometry.PrescribedRicci.KahlerPoissonL2 -import OAI.Geometry.PrescribedRicci.KahlerSobolev -import OAI.Geometry.PrescribedRicci.KahlerVolumeMeasure -import OAI.Geometry.PrescribedRicci.KahlerVolumeVariation -import OAI.Geometry.PrescribedRicci.MongeAmpereC0 -import OAI.Geometry.PrescribedRicci.MongeAmpereEnergy -import OAI.Geometry.PrescribedRicci.MongeAmpereL2 -import OAI.Geometry.PrescribedRicci.NormalizeVolumePath -import OAI.Geometry.PrescribedRicci.PathLocalGain -import OAI.Geometry.PrescribedRicci.PathUniformHigher -import OAI.Geometry.PrescribedRicci.PathUniformSobolevBase -import OAI.Geometry.PrescribedRicci.PositiveOpenness -import OAI.Geometry.PrescribedRicci.PositivePathLimit -import OAI.Geometry.PrescribedRicci.PrescribedRicci -import OAI.Geometry.PrescribedRicci.SmoothLocalInverse -import OAI.Geometry.PrescribedRicci.SmoothPathLimit -import OAI.Geometry.PrescribedRicci.SmoothPositivePath -import OAI.Geometry.PrescribedRicci.TameCofactorGain -import OAI.Geometry.PrescribedRicci.TraceMaximum -import OAI.Geometry.PrescribedRicci.UniformCalabi -import OAI.Geometry.PrescribedRicci.UniformChernLu -import OAI.Geometry.PrescribedRicci.UniformMetricBounds -import OAI.Geometry.PrescribedRicci.UniformPathPatches -import OAI.Geometry.PrescribedRicci.WeightedMongeAmpereEnergy -import OAI.Geometry.ProjectionBodies.Main -import OAI.Geometry.ProjectionBody.Main -import OAI.Geometry.ProjectionVolume.Main -import OAI.Geometry.QuadricBundles.Main -import OAI.Geometry.Riemannian.HarmonicCore.Main -import OAI.Geometry.RuledCovering.Main -import OAI.Geometry.SmoothYau.Main -import OAI.Geometry.SplitTangent.AllCompactLeaves -import OAI.Geometry.SplitTangent.AllProjectiveLeaves -import OAI.Geometry.SplitTangent.AnalyticFiniteRelations -import OAI.Geometry.SplitTangent.ArbitraryPlaqueLeaves -import OAI.Geometry.SplitTangent.BasicDerivativeKernel -import OAI.Geometry.SplitTangent.BoxFirstTransport -import OAI.Geometry.SplitTangent.ChartSubmersion -import OAI.Geometry.SplitTangent.CompactLeafQuotient -import OAI.Geometry.SplitTangent.CompactPositiveLeaf -import OAI.Geometry.SplitTangent.ComplementaryLeafIntersections -import OAI.Geometry.SplitTangent.DenseCompactLeaves -import OAI.Geometry.SplitTangent.DenseRationalVariation -import OAI.Geometry.SplitTangent.EmbeddedLeafCharts -import OAI.Geometry.SplitTangent.EmbeddedRationalCurve -import OAI.Geometry.SplitTangent.EmbeddedTangentLift -import OAI.Geometry.SplitTangent.EverywhereSmoothLeafQuotient -import OAI.Geometry.SplitTangent.GenericLeafProductCover -import OAI.Geometry.SplitTangent.GlobalAffineRelations -import OAI.Geometry.SplitTangent.GlobalLeafRelations -import OAI.Geometry.SplitTangent.GlobalProducts -import OAI.Geometry.SplitTangent.GlobalTopologicalProduct -import OAI.Geometry.SplitTangent.HolomorphicBasicTransport -import OAI.Geometry.SplitTangent.HolomorphicLeafBasic -import OAI.Geometry.SplitTangent.HolomorphicManifoldProduct -import OAI.Geometry.SplitTangent.IntegrabilityReduction -import OAI.Geometry.SplitTangent.IntrinsicPositiveLeaf -import OAI.Geometry.SplitTangent.LeafAffineRelations -import OAI.Geometry.SplitTangent.LeafAlgebraicDependence -import OAI.Geometry.SplitTangent.LeafClosureRelations -import OAI.Geometry.SplitTangent.LeafCompactLimits -import OAI.Geometry.SplitTangent.LeafGermIdentity -import OAI.Geometry.SplitTangent.LeafHomogeneousRelations -import OAI.Geometry.SplitTangent.LeafLimitRelations -import OAI.Geometry.SplitTangent.LeafLimitsSinglePlaque -import OAI.Geometry.SplitTangent.LeafPolynomialGrowth -import OAI.Geometry.SplitTangent.LeafProducts -import OAI.Geometry.SplitTangent.LeafTopology -import OAI.Geometry.SplitTangent.ManifoldJetAnalytic -import OAI.Geometry.SplitTangent.OpenPositiveLeaves -import OAI.Geometry.SplitTangent.PlaqueConnectedSets -import OAI.Geometry.SplitTangent.PlaqueTangentImage -import OAI.Geometry.SplitTangent.PolynomialLeafGerms -import OAI.Geometry.SplitTangent.PositiveCoverLift -import OAI.Geometry.SplitTangent.ProductCriteria -import OAI.Geometry.SplitTangent.ProjectiveHypersurfaces -import OAI.Geometry.SplitTangent.ProjectivePositiveLeaf -import OAI.Geometry.SplitTangent.ProjectiveTangentBox -import OAI.Geometry.SplitTangent.QuotientSubmersions -import OAI.Geometry.SplitTangent.RCCovariantVanishing -import OAI.Geometry.SplitTangent.RationalCoverLift -import OAI.Geometry.SplitTangent.RationalReparam -import OAI.Geometry.SplitTangent.RationalVariation -import OAI.Geometry.SplitTangent.TangentCurveLeaf -import OAI.Geometry.SplitTangent.TangentRationalChains -import OAI.Geometry.SplitTangent.TransverseDiscrete -import OAI.Geometry.SplitTangent.TransverseQuotient -import OAI.Geometry.SplitTangent.ZariskiPairOpen -import OAI.Geometry.Symplectic.MorseBounds.Main -import OAI.Geometry.TamingCompatibility.Main -import OAI.Geometry.TranslativeCovering.Main -import OAI.Geometry.TriangularCovering.Main -import OAI.Geometry.UnitDistances.Main -import OAI.Geometry.Varifold.NullComparison -import OAI.Geometry.WeakHessian.Main -import OAI.Geometry.WeakMTW.Main -import OAI.GroupTheory.ArithmeticGerms.Stabilizers -import OAI.GroupTheory.ArtinCAT0.Main -import OAI.GroupTheory.BooneHigman.Main -import OAI.GroupTheory.CyclicSeries.Length -import OAI.GroupTheory.FiniteIndex.Realization -import OAI.GroupTheory.FiniteKernel.VirtualAbelian -import OAI.GroupTheory.FiniteLattice.LabelledCollection -import OAI.GroupTheory.FiniteLattice.NormalPreimage -import OAI.GroupTheory.FiniteType.Main -import OAI.GroupTheory.Heisenberg.BarDetector -import OAI.GroupTheory.Hyperbolic.Main -import OAI.GroupTheory.Kervaire.Main -import OAI.GroupTheory.PChains.Cancellation -import OAI.GroupTheory.PeriodicGroups.Main -import OAI.GroupTheory.SimpleAmenable.Main -import OAI.GroupTheory.SimpleOvergroups.Main -import OAI.GroupTheory.Thompson.Main -import OAI.GroupTheory.UniversalGroup.Main -import OAI.InformationTheory.AmplitudeDamping.Main -import OAI.InformationTheory.BooleanNoise.Main -import OAI.InformationTheory.DimensionTen.StateKey -import OAI.InformationTheory.Entanglement.Main -import OAI.InformationTheory.PhotonNumber.Inequality -import OAI.InformationTheory.QuantumCircuit.Main -import OAI.InformationTheory.QuantumCircuit.Regularity -import OAI.InformationTheory.SecretKey.DimensionTen -import OAI.InformationTheory.SecretKey.Main -import OAI.InformationTheory.SoftChannel.Main -import OAI.LinearAlgebra.Barker.Main -import OAI.LinearAlgebra.CirculantHadamard.Main -import OAI.LinearAlgebra.CliffordAlgebra.KugaSatake -import OAI.LinearAlgebra.Descent.Rational -import OAI.LinearAlgebra.Hadamard.Main -import OAI.LinearAlgebra.MatrixFields.Main -import OAI.LinearAlgebra.MatrixMultiplication.Main -import OAI.LinearAlgebra.TensorProduct.ScalarDescent -import OAI.MathematicalPhysics.AlternatingFlow.Development -import OAI.MathematicalPhysics.Anderson.Certificates -import OAI.MathematicalPhysics.BFSS.Main -import OAI.MathematicalPhysics.Coulomb.OuterRadius -import OAI.MathematicalPhysics.CriticalMixing.Main -import OAI.MathematicalPhysics.CriticalSK.LowerExponents -import OAI.MathematicalPhysics.CriticalSK.Main -import OAI.MathematicalPhysics.Elasticity.Uniqueness -import OAI.MathematicalPhysics.HardSphere.GrandCanonical -import OAI.MathematicalPhysics.Heisenberg.Main -import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.MainResult -import OAI.MathematicalPhysics.NavierStokes.Material.Main -import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Main -import OAI.MathematicalPhysics.NavierStokes.VelocityDetection.Main -import OAI.MathematicalPhysics.PEPSFilters.GeometricOptimizer -import OAI.MathematicalPhysics.PEPSMove.PhysicalMove -import OAI.MathematicalPhysics.PEPSSubvolume.Main -import OAI.MathematicalPhysics.PlanarAnderson.Spectrum -import OAI.MathematicalPhysics.PrefixFlows.Main -import OAI.MathematicalPhysics.RapidForcing.Main -import OAI.MathematicalPhysics.RecorderFlows.Main -import OAI.MathematicalPhysics.SheetFlows.SheetProgram -import OAI.MathematicalPhysics.TensorNetwork.VectorColumn -import OAI.MeasureTheory.DyadicAvoidance.Main -import OAI.MeasureTheory.Falconer.Main -import OAI.MeasureTheory.FalconerCompletion.Main -import OAI.MeasureTheory.SelfSimilar.Main -import OAI.MeasureTheory.SelfSimilar.DimensionCorollaries -import OAI.ModelTheory.AbstractElementary.ModelExistence -import OAI.ModelTheory.Categoricity.Main -import OAI.ModelTheory.Choiceless.Separation -import OAI.NumberTheory.Catalan.Main -import OAI.NumberTheory.CubicGauss.Main -import OAI.NumberTheory.CubicGram.Main -import OAI.NumberTheory.DirichletL.Hecke.Nonvanishing -import OAI.NumberTheory.DirichletL.Nonvanishing -import OAI.NumberTheory.DuffinSchaeffer.Reductions -import OAI.NumberTheory.EgyptianFractions.All -import OAI.NumberTheory.GaussianMoat.Main -import OAI.NumberTheory.Jacobsthal.Main -import OAI.NumberTheory.JointDickman.PaperMain -import OAI.NumberTheory.NumberField.UnitRadicals -import OAI.NumberTheory.OrdinaryCorrelations.AbsoluteDefect.Main -import OAI.NumberTheory.OrdinaryCorrelations.Elliott.Main -import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Main -import OAI.NumberTheory.Ostmann.Main -import OAI.NumberTheory.PiExponent.Main -import OAI.NumberTheory.PowerFree.Main -import OAI.NumberTheory.PrimeGaps.RatioCorollary -import OAI.NumberTheory.PrimePackets.Main -import OAI.NumberTheory.QuadraticForms.ComponentLengths -import OAI.NumberTheory.ShortEgyptian.Main -import OAI.NumberTheory.SiegelZeros.Main -import OAI.NumberTheory.SingleFold.Main -import OAI.NumberTheory.TotientAsymptotic.Main -import OAI.NumberTheory.TotientFibers.FiniteFiber -import OAI.Optimization.Tropical.TruffetCounterexample -import OAI.Probability.Ballisticity.Main -import OAI.Probability.Ballisticity.VelocityHemisphere -import OAI.Probability.BenjaminiSchramm -import OAI.Probability.BinarySweep.Main -import OAI.Probability.ClassicalON.Main -import OAI.Probability.Contingency.LocalRepair -import OAI.Probability.Contingency.PreparedResidual -import OAI.Probability.ContinuumTransition.Main -import OAI.Probability.CoordinateSweeps.Main -import OAI.Probability.CriticalPercolation.Main -import OAI.Probability.CriticalZ3.Main -import OAI.Probability.CubeShuffle.WeightedMoments -import OAI.Probability.DilutedSpin.Main -import OAI.Probability.DirectionalWalk.Main -import OAI.Probability.EntangledGames.Main -import OAI.Probability.FKPressure.Main -import OAI.Probability.FirstPassage.Main -import OAI.Probability.FKMaps.Convergence -import OAI.Probability.FreeIsing.Main -import OAI.Probability.GaussianInformation.Main -import OAI.Probability.GaussianPropeller.Main -import OAI.Probability.GaussianRegression.Main -import OAI.Probability.GaussianReplacement.Streaming -import OAI.Probability.Honeycomb.FreeEnergy -import OAI.Probability.Honeycomb.TriangleVisits -import OAI.Probability.Ising.Main -import OAI.Probability.IsingPerceptron.FullReplicaIBP -import OAI.Probability.IsingPerceptron.VariationalFiniteness -import OAI.Probability.JammingConcavity.DeletionUniformRowEstimates -import OAI.Probability.JammingConcavity.RowFiniteDiagonalRowGeneralInterpolation -import OAI.Probability.JammingConcavity.RowQuadraticTerminalLimit -import OAI.Probability.JammingConcavity.VarianceTensorization -import OAI.Probability.LatticeSurface.Brownian.BrownianClockFacet -import OAI.Probability.LatticeSurface.Brownian.BrownianClockSupport -import OAI.Probability.LatticeSurface.Brownian.BrownianPath -import OAI.Probability.LatticeSurface.Brownian.BrownianPathIdentities -import OAI.Probability.LatticeSurface.Coercivity.HoleWeighted -import OAI.Probability.LatticeSurface.Convexity.ClusterDynamicsDefs -import OAI.Probability.LatticeSurface.Convexity.FiniteLevelBarrier -import OAI.Probability.LatticeSurface.Convexity.Metropolis -import OAI.Probability.LatticeSurface.Convexity.MetropolisSupport -import OAI.Probability.LatticeSurface.Convexity.ProductSums -import OAI.Probability.LatticeSurface.Convexity.SupportUnit -import OAI.Probability.LatticeSurface.Convexity.TailNumerics -import OAI.Probability.LatticeSurface.Convexity.TransportResampling -import OAI.Probability.LatticeSurface.Dynamics.CompactCoupling -import OAI.Probability.LatticeSurface.Dynamics.LatticeShift -import OAI.Probability.LatticeSurface.Dynamics.ProjectionComparison -import OAI.Probability.LatticeSurface.Dynamics.ProjectionGlobal -import OAI.Probability.LatticeSurface.Dynamics.ProjectionLimit -import OAI.Probability.LatticeSurface.Dynamics.TiltApplication -import OAI.Probability.LatticeSurface.Dynamics.TiltSupport -import OAI.Probability.LatticeSurface.Dynamics.WeightedInitial -import OAI.Probability.LatticeSurface.Geometry.ContactVolume -import OAI.Probability.LatticeSurface.Moments.Averages -import OAI.Probability.Localization.Main -import OAI.Probability.LogConcave.Main -import OAI.Probability.MatroidProphet -import OAI.Probability.MatroidSecretary.Main -import OAI.Probability.MemoryPrecision.Main -import OAI.Probability.ParisiFinite.ParisiCanonicalTransport -import OAI.Probability.ParisiFinite.ParisiEntropyDecomposition -import OAI.Probability.ParisiFinite.RealShiftNormSqLe -import OAI.Probability.ParisiFinite.SpinFlip -import OAI.Probability.ParisiFinite.WeightedGradientField -import OAI.Probability.Perceptron.Main -import OAI.Probability.PosteriorReplicas.Main -import OAI.Probability.ProbabilityMeasure.ArctanCenter -import OAI.Probability.ProjectionMoments.Main -import OAI.Probability.RadialTransition.DensityInterval -import OAI.Probability.RadialTransition.Main -import OAI.Probability.RandomSAT.Main -import OAI.Probability.Renewal.Main -import OAI.Probability.SATComputability.Main -import OAI.Probability.SATVariance.Main -import OAI.Probability.SKBarriers.Main -import OAI.Probability.SKCutoff.Denominator -import OAI.Probability.SKFluctuations.ComparisonMinimumRealOverlapConclusion -import OAI.Probability.SKGap.Main -import OAI.Probability.SKSupport.Main -import OAI.Probability.SKValue.Main -import OAI.Probability.SLE.MainReduction -import OAI.Probability.SLE.MomentGauge -import OAI.Probability.SLE.SausageCharge -import OAI.Probability.SLEGauge.Main -import OAI.Probability.SLELocalization.CircleMeans -import OAI.Probability.SLELocalization.DriverStability -import OAI.Probability.SLELocalization.FilledObstacle -import OAI.Probability.SLELocalization.LoewnerCocycle -import OAI.Probability.SLELocalization.MappedExit -import OAI.Probability.SLELocalization.MeshSlab -import OAI.Probability.SLELocalization.PastObstacle -import OAI.Probability.SLELocalization.RetainedFirstMoment -import OAI.Probability.SLELocalization.SlitMaps -import OAI.Probability.SLELocalization.SpatialLimit -import OAI.Probability.SLELocalization.StrongRestart -import OAI.Probability.SLELocalization.TraceAvoidance -import OAI.Probability.SLELocalization.TruncatedEnergy -import OAI.Probability.SignedSweeps.Main -import OAI.Probability.SpanningForest.Main -import OAI.Probability.SphericalField.Main -import OAI.Probability.SphericalPerceptron.PressureComparison -import OAI.Probability.StrongRayleigh -import OAI.Probability.Subsphere.Main -import OAI.Probability.SwitchChain -import OAI.Probability.ThorpCompatibility.Main -import OAI.Probability.ThorpResults.FullDevelopment -import OAI.Probability.ThorpRouting.Main -import OAI.Probability.ThorpRouting.RegularTrace -import OAI.Probability.ThorpShuffle.FirstFourier -import OAI.Probability.ThorpShuffle.FirstMain -import OAI.Probability.ThorpShuffle.FixedLists.Main -import OAI.Probability.ThorpShuffle.Main -import OAI.Probability.ThreeState.Main -import OAI.Probability.ThreeStateClauses.Main -import OAI.Probability.TraceReconstruction -import OAI.Probability.UnimodularPercolation.CayleyMain -import OAI.Probability.UnimodularPercolation.Main -import OAI.Probability.UnimodularPercolation.UnimodularMain -import OAI.Probability.Voronoi.CardyFormula -import OAI.RepresentationTheory.AlperinWeights.Brauer -import OAI.RepresentationTheory.Block.Defect -import OAI.RepresentationTheory.FoulkesHowe -import OAI.RepresentationTheory.FoulkesSixth.Main -import OAI.RepresentationTheory.GraphModels.NormalActions -import OAI.RepresentationTheory.KazhdanLusztig.Invariance -import OAI.RepresentationTheory.PartialPermutation.Main -import OAI.RepresentationTheory.ProjectiveInduction.CosetTransport -import OAI.RepresentationTheory.RestrictedTilting.Main -import OAI.RepresentationTheory.RowColumn.Occupied -import OAI.RepresentationTheory.Saxl.Main -import OAI.RepresentationTheory.SpinAngle.TypeAngle -import OAI.RepresentationTheory.TensorSquares.Main -import OAI.RepresentationTheory.Torus.ConvexWeights -import OAI.RepresentationTheory.VertexAlgebra.Main -import OAI.RingTheory.BassTrace.Main -import OAI.RingTheory.BassTrace.TorsionFree -import OAI.RingTheory.DirectFiniteness.FinitelyPresented -import OAI.RingTheory.DirectFiniteness.Main -import OAI.RingTheory.DivisionRing.FiniteDescent -import OAI.RingTheory.FormalGroup.Main -import OAI.RingTheory.GroupAction.TraceOne -import OAI.RingTheory.Kurosh.Main -import OAI.RingTheory.Multiplicity.Main -import OAI.RingTheory.Tachikawa.Counterexample -import OAI.SetTheory.PartitionConsistency.Main -import OAI.SetTheory.PartitionPrinciple.Main -import OAI.Topology.ArtinGroups.Main -import OAI.Topology.ArtinGroups.ParabolicIntersections.Main -import OAI.Topology.EilenbergGanea.Main -import OAI.Topology.TorusCompression.Boundary -import OAI.Topology.CoarseAssembly -import OAI.RepresentationTheory.UniversalSquare.Main -import OAI.Probability.SKRatio.Main -import OAI.Geometry.Relativity.CKS.Main -import OAI.Geometry.SurfaceImmersion.All - -import OAI.GroupTheory.PolycyclicRecognition +import OAI.Algebra.AffineCancellation.Main +import OAI.Algebra.AlgebraicObstruction.AlgebraicInput +import OAI.Algebra.AlgebraicObstruction.Holonomy +import OAI.Algebra.AuslanderReiten.All +import OAI.Algebra.BogomolovPop.Injectivity +import OAI.Algebra.Cohomology.SemilinearCochains +import OAI.Algebra.DepthFive.Main +import OAI.Algebra.Determinantal.Main +import OAI.Algebra.Divisor.Normalization +import OAI.Algebra.Divisor.RationalRecovery +import OAI.Algebra.Drinfeld.Completion +import OAI.Algebra.FiniteTensor.Main +import OAI.Algebra.Finitistic.Main +import OAI.Algebra.FinitisticAsymmetry.Main +import OAI.Algebra.FormalGroup.Honda.Main +import OAI.Algebra.FormulaHitting.Main +import OAI.Algebra.FrobeniusObstruction.Obstruction +import OAI.Algebra.GroupRing.CylinderRetention +import OAI.Algebra.GroupRing.Main +import OAI.Algebra.MarkedTensor.Main +import OAI.Algebra.Module.CompactPadic +import OAI.Algebra.OddKaplansky.GeneralTransfer +import OAI.Algebra.PolynomialChains.Real +import OAI.Algebra.Universal.Coset +import OAI.Algebra.Universal.GraphDecidability +import OAI.AlgebraicGeometry.AbhyankarSathaye.Counterexample +import OAI.AlgebraicGeometry.CartierSections +import OAI.AlgebraicGeometry.CharacterVarieties +import OAI.AlgebraicGeometry.CommutingDerivations.OrdinaryExtraMain +import OAI.AlgebraicGeometry.LogKodaira.FiberNegative +import OAI.AlgebraicGeometry.LogKodaira.RootFactor +import OAI.AlgebraicGeometry.NumericalDimension.IndexedTransfer +import OAI.AlgebraicGeometry.NumericalDimension.RelativeNegativity +import OAI.AlgebraicGeometry.NumericalDimension.TwistedPushforward +import OAI.AlgebraicGeometry.PlaneCurves.Nagata +import OAI.AlgebraicGeometry.RelativeTriviality.RelativeTriviality +import OAI.AlgebraicGeometry.SectionFields.Main +import OAI.AlgebraicGeometry.Seshadri.Main +import OAI.AlgebraicGeometry.Stability.NumericalWalls +import OAI.AlgebraicGeometry.StableCoordinate.All +import OAI.AlgebraicGeometry.SurfaceCones +import OAI.Analysis.AffineBernstein.Main +import OAI.Analysis.AllenCahn.Main +import OAI.Analysis.AncientFlat.Main +import OAI.Analysis.BackwardIntertwiners.AlgebraCorollary +import OAI.Analysis.BernoulliCone.Main +import OAI.Analysis.BiholderTransport.Main +import OAI.Analysis.BoundedHochschild.AtomicPrimitives +import OAI.Analysis.BoundedHochschild.CenterPowers +import OAI.Analysis.BoundedHochschild.CentralLinearPatch +import OAI.Analysis.BoundedHochschild.CocycleNormalParts +import OAI.Analysis.BoundedHochschild.CommutativePrimitives +import OAI.Analysis.BoundedHochschild.FactorFinitePaths +import OAI.Analysis.BoundedHochschild.FactorPrimitive +import OAI.Analysis.BoundedHochschild.FreeWords +import OAI.Analysis.BoundedHochschild.MainResult +import OAI.Analysis.BoundedHochschild.MatrixDisplacement +import OAI.Analysis.BoundedHochschild.TypeIICorners +import OAI.Analysis.BoundedHochschild.TypeIPrimitives +import OAI.Analysis.BoundedHochschild.UnitaryLifts +import OAI.Analysis.BoxTransport.Routing +import OAI.Analysis.Brenier.Stability +import OAI.Analysis.BrownMeasure.Main +import OAI.Analysis.C0Absorption.Main +import OAI.Analysis.CStarAlgebra.PureInfiniteness.Main +import OAI.Analysis.CardinalInterpolation.ModTwelve +import OAI.Analysis.CharacterCriterion.Main +import OAI.Analysis.CircleDomains.LengthArea +import OAI.Analysis.CircleDomains.Development +import OAI.Analysis.Commutator.Main +import OAI.Analysis.Conductivity.Main +import OAI.Analysis.Cotype.Main +import OAI.Analysis.CoulombIonization.Main +import OAI.Analysis.CoulombRadii.Main +import OAI.Analysis.CoulombTransport.Main +import OAI.Analysis.Crouzeix.Main +import OAI.Analysis.Daugavet.Main +import OAI.Analysis.DiamondDistortion.Main +import OAI.Analysis.DirectCrouzeix.Main +import OAI.Analysis.DiskMaximal.Main +import OAI.Analysis.FactorGeneration.Main +import OAI.Analysis.FiniteFactor.Main +import OAI.Analysis.ForestSpace.Main +import OAI.Analysis.Fourier.HeightLayers +import OAI.Analysis.Fourier.SphereExtension +import OAI.Analysis.FourierExtension.LpEstimate +import OAI.Analysis.FourierLLogL.PaperMain +import OAI.Analysis.FreeEntropy.Main +import OAI.Analysis.FreeGroupFactor.Main +import OAI.Analysis.FreeWords.Main +import OAI.Analysis.Graph.Gradients +import OAI.Analysis.GroupDeterminants.Main +import OAI.Analysis.HardSphere.Main +import OAI.Analysis.HenonEmden.Main +import OAI.Analysis.HilbertCrouzeix.Main +import OAI.Analysis.HotSpots.Main +import OAI.Analysis.HyperbolicCones +import OAI.Analysis.Hyperinvariant +import OAI.Analysis.IncompressibleFlow.AffineExtension +import OAI.Analysis.InnerProductSpace.ComplexSolvability +import OAI.Analysis.IntegralMeans.Main +import OAI.Analysis.IntegralMeans.SharpEndpoints +import OAI.Analysis.InterpolatedFactors.Interpolation +import OAI.Analysis.IrrationalRotation.Main +import OAI.Analysis.JiangSu.Main +import OAI.Analysis.Kakeya.FixedScale +import OAI.Analysis.Kaplansky.Main +import OAI.Analysis.Kaplansky.StableFiniteness +import OAI.Analysis.Laughlin.Main +import OAI.Analysis.Laughlin.UniformGap +import OAI.Analysis.LaughlinFock.Main +import OAI.Analysis.LaughlinFock.TensorIntegrals +import OAI.Analysis.LaughlinGap.Main +import OAI.Analysis.LaughlinGap.ThreeAveraging +import OAI.Analysis.LiebThirring.CoerciveInverse +import OAI.Analysis.LiebThirring.CompactAlternative +import OAI.Analysis.LiebThirring.ContinuousRepresentative +import OAI.Analysis.LiebThirring.DiscreteSpectrum +import OAI.Analysis.LiebThirring.Eigenspace +import OAI.Analysis.LiebThirring.EigenvalueSum +import OAI.Analysis.LiebThirring.FormCongruence +import OAI.Analysis.LiebThirring.FreeForm +import OAI.Analysis.LiebThirring.LocalCompactness +import OAI.Analysis.LiebThirring.LocalWeight +import OAI.Analysis.LiebThirring.LowestEigenvalue +import OAI.Analysis.LiebThirring.Main +import OAI.Analysis.LiebThirring.Multiplication +import OAI.Analysis.LiebThirring.NegativeResolvent +import OAI.Analysis.LiebThirring.OneState +import OAI.Analysis.LiebThirring.OperatorForm +import OAI.Analysis.LiebThirring.OperatorGraph +import OAI.Analysis.LiebThirring.PotentialCompactness +import OAI.Analysis.LiebThirring.PotentialSplit +import OAI.Analysis.LiebThirring.Resolvent +import OAI.Analysis.LiebThirring.SchrodingerOperator +import OAI.Analysis.LiebThirring.SobolevBound +import OAI.Analysis.LiebThirring.SpectralMain +import OAI.Analysis.LiebThirring.SpectralMoment +import OAI.Analysis.LiebThirring.WeightedCutoff +import OAI.Analysis.LienardCycles.Main +import OAI.Analysis.Lipschitz.TriangularLattice +import OAI.Analysis.LipschitzEquivalence.Main +import OAI.Analysis.LipschitzFree.Main +import OAI.Analysis.LipschitzFree.Renorming +import OAI.Analysis.LipschitzHilbert.Main +import OAI.Analysis.Littlewood.Main +import OAI.Analysis.Littlewood.FiniteFlatness +import OAI.Analysis.LpDimension.Main +import OAI.Analysis.Mahler +import OAI.Analysis.Mahler.Classification +import OAI.Analysis.MarkovType.All +import OAI.Analysis.MassAction.Main +import OAI.Analysis.MatrixSigning.Main +import OAI.Analysis.MetricEntropy.Main +import OAI.Analysis.ModularRecovery.Main +import OAI.Analysis.MumfordShah.CompactExclusion +import OAI.Analysis.MutuallyUnbiased.Bases.ThreeMain +import OAI.Analysis.MutuallyUnbiased.Main +import OAI.Analysis.Naimark.Tracial +import OAI.Analysis.NavierStokes.VelocitySpace +import OAI.Analysis.NefAdjoint.FractionalDensity +import OAI.Analysis.NefAdjoint.SectionGauge +import OAI.Analysis.NodalLength.Main +import OAI.Analysis.Nonexpansive +import OAI.Analysis.NuclearUltrapower.Main +import OAI.Analysis.NumericalRange.Main +import OAI.Analysis.PathSelection.Main +import OAI.Analysis.PeriodicLattice.Main +import OAI.Analysis.PlanarEndpoint.Main +import OAI.Analysis.Polynomial.Exhaustion +import OAI.Analysis.ProductSpaces.Main +import OAI.Analysis.Pureness.Main +import OAI.Analysis.Quantum.DimensionTen.Main +import OAI.Analysis.RCDHeat.Main +import OAI.Analysis.RecursivePotentials.EquivalentNorms +import OAI.Analysis.RecursivePotentials.JoinedGeometry +import OAI.Analysis.RecursivePotentials.Main +import OAI.Analysis.RecursivePotentials.Model +import OAI.Analysis.RecursivePotentials.TreeGeometry +import OAI.Analysis.RecursivePotentials.VariableCompletion +import OAI.Analysis.RecursivePotentials.VariableEstimates +import OAI.Analysis.RecursivePotentials.VariableLp +import OAI.Analysis.RecursivePotentials.VariableStability +import OAI.Analysis.RecursivePotentials.ZeroRootGeometry +import OAI.Analysis.RelativeGeneration.Main +import OAI.Analysis.RieszRectifiability.Main +import OAI.Analysis.RotationWeights.Main +import OAI.Analysis.SegmentLenses.HeadRanges +import OAI.Analysis.SegmentLenses.Main +import OAI.Analysis.SeparableQuotients.Main +import OAI.Analysis.SeparableQuotients.Positive.Main +import OAI.Analysis.SignedDisk.Main +import OAI.Analysis.SphereIsometry.Main +import OAI.Analysis.Steinitz.Main +import OAI.Analysis.StrictMeans.Main +import OAI.Analysis.StructuralCrouzeix.Endpoint +import OAI.Analysis.SymmetricDomains.Main +import OAI.Analysis.TemperedDistribution.ConformalIdentities +import OAI.Analysis.TraceCone.Main +import OAI.Analysis.TracialCohomology.Vanishing +import OAI.Analysis.TracialSplitting.Main +import OAI.Analysis.TreePotential.Main +import OAI.Analysis.Triangular.Main +import OAI.Analysis.TriangularHilbert.Main +import OAI.Analysis.Unitarizability.AllDiscrete +import OAI.Analysis.Unitarizability.UniverseTransport +import OAI.Analysis.VlasovMaxwell.Main +import OAI.Analysis.WeakInfiniteness.Main +import OAI.CategoryTheory.Globular.Main +import OAI.CategoryTheory.ThickClosure.Main +import OAI.CategoryTheory.Thomason.RankedFaithfulness +import OAI.Combinatorics.Automata.Main +import OAI.Combinatorics.BalancedRyser.Main +import OAI.Combinatorics.BooleanFunctions.Main +import OAI.Combinatorics.Chromatic.Main +import OAI.Combinatorics.CliqueFree.Main +import OAI.Combinatorics.Coboundary.Main +import OAI.Combinatorics.CompleteCrossing.Main +import OAI.Combinatorics.ContingencyTables.FactorialLift +import OAI.Combinatorics.Crossing.Main +import OAI.Combinatorics.CycleDecomposition.Main +import OAI.Combinatorics.DiscreteConvexity.Main +import OAI.Combinatorics.Distances.PolynomialIsolation +import OAI.Combinatorics.EditDistance.Main +import OAI.Combinatorics.EuclideanRamsey.Circle +import OAI.Combinatorics.EuclideanRamsey.Main +import OAI.Combinatorics.EuclideanRamsey.NineStatement +import OAI.Combinatorics.EuclideanRamsey.Quadratic +import OAI.Combinatorics.EuclideanRamsey.Spherical +import OAI.Combinatorics.EuclideanRamsey.Transitive +import OAI.Combinatorics.ExpectationThreshold.Main +import OAI.Combinatorics.FiniteCircle.Main +import OAI.Combinatorics.GotsmanLinial.Main +import OAI.Combinatorics.GraphSpectrum.SampledChromatic +import OAI.Combinatorics.GraphThreshold.Main +import OAI.Combinatorics.HadwigerCounterexample.Main +import OAI.Combinatorics.HalvingLines.Main +import OAI.Combinatorics.Hamiltonian.Main +import OAI.Combinatorics.Honeycomb.FiniteCylinder +import OAI.Combinatorics.Honeycomb.PolygonMoment +import OAI.Combinatorics.HoneycombBridges.ExactLength +import OAI.Combinatorics.HoneycombBridges.Geometry +import OAI.Combinatorics.HoneycombChords +import OAI.Combinatorics.HoneycombCorridor.CorridorTransfer +import OAI.Combinatorics.IndependentSets.Main +import OAI.Combinatorics.InfiniteMatroid.Corollaries +import OAI.Combinatorics.InfiniteMatroid.Main +import OAI.Combinatorics.KMedian.Main +import OAI.Combinatorics.KMedian.Threshold +import OAI.Combinatorics.KMedianRecovery.Main +import OAI.Combinatorics.KMedianRecovery.Refined.Main +import OAI.Combinatorics.KMedianRecovery.Refined.Recovery +import OAI.Combinatorics.KServer.Main +import OAI.Combinatorics.ListHadwiger.Main +import OAI.Combinatorics.MatchingCount.Main +import OAI.Combinatorics.MatchingEntropy.Main +import OAI.Combinatorics.Permanent.Main +import OAI.Combinatorics.PolynomialVacuum.Main +import OAI.Combinatorics.PortMatching.Reduction +import OAI.Combinatorics.Progressions.Main +import OAI.Combinatorics.Ramsey.CycleClique.Main +import OAI.Combinatorics.Ramsey.Hypercube +import OAI.Combinatorics.RamseyFive.Main +import OAI.Combinatorics.StableGraphs.ExteriorBounds +import OAI.Combinatorics.StripMass.Main +import OAI.Combinatorics.SumProduct.Alignment.Main +import OAI.Combinatorics.ThinTrees.AlgorithmicMain +import OAI.Combinatorics.TriangleFace.Main +import OAI.Combinatorics.MatchingPSD.AffineLift +import OAI.Combinatorics.MatchingPSD.Main +import OAI.Combinatorics.MatrixRemoval.Main +import OAI.Combinatorics.MatroidCounting.CommonBases +import OAI.Combinatorics.ParityLifts.AsymptoticBounds +import OAI.Combinatorics.PerfectMatching.AlgorithmPartition +import OAI.Combinatorics.PerfectMatching.Ascent +import OAI.Combinatorics.PerfectMatching.CompletePairs +import OAI.Combinatorics.PerfectMatching.Completion +import OAI.Combinatorics.PerfectMatching.CountCorrect +import OAI.Combinatorics.PerfectMatching.DyadicEntropy +import OAI.Combinatorics.PerfectMatching.DyadicEnvelope +import OAI.Combinatorics.PerfectMatching.ElementaryCount +import OAI.Combinatorics.PerfectMatching.EntropyUpper +import OAI.Combinatorics.PerfectMatching.FeasibilityRepair +import OAI.Combinatorics.PerfectMatching.ForcedReduction +import OAI.Combinatorics.PerfectMatching.Main +import OAI.Combinatorics.PerfectMatching.Model +import OAI.Combinatorics.PerfectMatching.ObjectivePenalty +import OAI.Combinatorics.PerfectMatching.ParameterBounds +import OAI.Combinatorics.PerfectMatching.Partition +import OAI.Combinatorics.PerfectMatching.Separable +import OAI.Combinatorics.PerfectMatching.SeparableCount +import OAI.Combinatorics.PerfectMatching.SeparableCovariance +import OAI.Combinatorics.PerfectMatching.SeparableLower +import OAI.Combinatorics.PerfectMatching.SizeBounds +import OAI.Combinatorics.PerfectMatching.Violation +import OAI.Combinatorics.PerfectMatching.WeightedSpectrum +import OAI.Combinatorics.PlanarL1.Embedding +import OAI.Combinatorics.ProgressionColoring.Main +import OAI.Combinatorics.Ryser.Main +import OAI.Combinatorics.Ryser.OddExtensions +import OAI.Combinatorics.SecondNeighborhood.Main +import OAI.Combinatorics.Sensitivity.Main +import OAI.Combinatorics.SharpRamsey.Main +import OAI.Combinatorics.SharpThreshold.Main +import OAI.Combinatorics.Sidorenko.RandomHost +import OAI.Combinatorics.SnakyCertificate.Main +import OAI.Combinatorics.SparsestCut.Main +import OAI.Combinatorics.SphericalRamsey +import OAI.Combinatorics.SphericalRamsey.Result +import OAI.Combinatorics.SquareDifference.Main +import OAI.Combinatorics.ThinTrees.Main +import OAI.Combinatorics.TreeEdit.Main +import OAI.Combinatorics.TreewidthL1.Main +import OAI.Combinatorics.TriangleRemoval.Main +import OAI.Combinatorics.TwoWayAutomata.ExplicitFamily +import OAI.Combinatorics.TwoWayAutomata.Main +import OAI.Combinatorics.TwoWayAutomata.PolynomialBound +import OAI.Combinatorics.UniformKServer.Main +import OAI.Combinatorics.VariableWL +import OAI.Combinatorics.YoungDiagram.RealCapacity +import OAI.Combinatorics.YoungDiagram.RealLargeCapacity +import OAI.Computability.BinPacking.Main +import OAI.Computability.DegreeRigidity.Main +import OAI.Computability.DepthThree +import OAI.Computability.DeterministicSum.Main +import OAI.Computability.DirectedFeedback.Main +import OAI.Computability.FourierCircuit.Main +import OAI.Computability.FourierTransform.Main +import OAI.Computability.GeneralizedCircuits.Mesh +import OAI.Computability.Logspace.Deterministic +import OAI.Computability.Logspace.Equality +import OAI.Computability.LoopMatching.Endpoint +import OAI.Computability.MatchingCount.ArgRoutine +import OAI.Computability.MatchingCount.BinaryAlgorithm +import OAI.Computability.MatchingCount.BinaryParser +import OAI.Computability.MatchingCount.BinarySolve +import OAI.Computability.MatchingCount.CappedPower +import OAI.Computability.MatchingCount.CutAlgebra +import OAI.Computability.MatchingCount.DenseOracle +import OAI.Computability.MatchingCount.DivisionRoutine +import OAI.Computability.MatchingCount.FiniteStack +import OAI.Computability.MatchingCount.FoldRoutine +import OAI.Computability.MatchingCount.GuardRoutine +import OAI.Computability.MatchingCount.IntegerRoutine +import OAI.Computability.MatchingCount.IterateRoutine +import OAI.Computability.MatchingCount.LengthRoutine +import OAI.Computability.MatchingCount.ListNumeric +import OAI.Computability.MatchingCount.ListRoutine +import OAI.Computability.MatchingCount.MapRoutine +import OAI.Computability.MatchingCount.OddCutParity +import OAI.Computability.MatchingCount.OddCutUncross +import OAI.Computability.MatchingCount.OddMincut +import OAI.Computability.MatchingCount.OptionCases +import OAI.Computability.MatchingCount.OracleBounds +import OAI.Computability.MatchingCount.OrbitRoutine +import OAI.Computability.MatchingCount.PairRoutine +import OAI.Computability.MatchingCount.ParamRoutine +import OAI.Computability.MatchingCount.ParserSupport +import OAI.Computability.MatchingCount.PolyCoding +import OAI.Computability.MatchingCount.ProjectionRoutine +import OAI.Computability.MatchingCount.RawBitsBridge +import OAI.Computability.MatchingCount.RawContraction +import OAI.Computability.MatchingCount.RawContractionCompiler +import OAI.Computability.MatchingCount.RawData +import OAI.Computability.MatchingCount.RawFlow +import OAI.Computability.MatchingCount.RawFlowCompiler +import OAI.Computability.MatchingCount.RawFlowSize +import OAI.Computability.MatchingCount.RawInput +import OAI.Computability.MatchingCount.RawOddBounds +import OAI.Computability.MatchingCount.RawOddCompiler +import OAI.Computability.MatchingCount.RawOddCut +import OAI.Computability.MatchingCount.RawOptimizer +import OAI.Computability.MatchingCount.RawOptimizerCompiler +import OAI.Computability.MatchingCount.RawOptimizerData +import OAI.Computability.MatchingCount.RawOptimizerDataCompiler +import OAI.Computability.MatchingCount.RawOptimizerRows +import OAI.Computability.MatchingCount.RawOptimizerRowsCompiler +import OAI.Computability.MatchingCount.RawPrimitives +import OAI.Computability.MatchingCount.RawRoutine +import OAI.Computability.MatchingCount.RawSearch +import OAI.Computability.MatchingCount.RawSearchCompiler +import OAI.Computability.MatchingCount.RawSearchSize +import OAI.Computability.MatchingCount.RawSize +import OAI.Computability.MatchingCount.RecursiveBounds +import OAI.Computability.MatchingCount.RecursiveCoding +import OAI.Computability.MatchingCount.RecursiveCompiler +import OAI.Computability.MatchingCount.RecursiveEval +import OAI.Computability.MatchingCount.ResidualSearch +import OAI.Computability.MatchingCount.ScaledAlgorithm +import OAI.Computability.MatchingCount.ScaledBounds +import OAI.Computability.MatchingCount.ScaledState +import OAI.Computability.MatchingCount.SelectRoutine +import OAI.Computability.MatchingCount.SequenceRoutine +import OAI.Computability.MatchingCount.StackCopy +import OAI.Computability.MatchingCount.StackEmbed +import OAI.Computability.MatchingCount.StackFrame +import OAI.Computability.MatchingCount.StackMacros +import OAI.Computability.MatchingCount.StackPair +import OAI.Computability.MatchingCount.StackRoutine +import OAI.Computability.MatchingCount.SumRoutine +import OAI.Computability.MatchingCount.TerminalMincut +import OAI.Computability.MatchingCount.UnaryArithmetic +import OAI.Computability.MatchingCount.UnaryClog +import OAI.Computability.MatchingCount.UnaryDivision +import OAI.Computability.MatchingCount.UnitFlow +import OAI.Computability.MatchingCount.UnitMincut +import OAI.Computability.MaxCut.Main +import OAI.Computability.MeanPayoff.Main +import OAI.Computability.MinUncut.Main +import OAI.Computability.PerfectCompleteness.Main +import OAI.Computability.QuantumFactoring.Main +import OAI.Computability.RandomMean.Main +import OAI.Computability.RationalHitting.Main +import OAI.Computability.Scheduling.Main +import OAI.Computability.SpaceSimulation.Main +import OAI.Computability.StarHeight.Main +import OAI.Computability.Superstring.Main +import OAI.Computability.TypeSystem.Normalization +import OAI.Computability.UniqueGames.Main +import OAI.Computability.VertexCover.Main +import OAI.Computability.WLIdentification.Main +import OAI.Computability.WeisfeilerLeman.Main +import OAI.Computability.WitnessedChoice.Main +import OAI.Dynamics.ConditionalShuffle.TwoColors +import OAI.Dynamics.EntropyCounterexample +import OAI.Dynamics.MultipleMixing.Main +import OAI.Dynamics.SmoothObstruction.Main +import OAI.Dynamics.StandardMap.ComponentsMain +import OAI.Dynamics.StandardMap.EntropyEndpoint +import OAI.Dynamics.StandardMap.EntropyLyapunov +import OAI.Dynamics.ThreeTorus.Main +import OAI.Dynamics.TriangleBilliards.Main +import OAI.GameTheory.SnakyConditional.Main +import OAI.GameTheory.SnakyTwentyOne.Main +import OAI.Geometry.Anticanonical.BranchedQuotient +import OAI.Geometry.Anticanonical.DeckRecovery +import OAI.Geometry.Anticanonical.DeletedFaces +import OAI.Geometry.Anticanonical.HilbertEstimates +import OAI.Geometry.Arnold.Main +import OAI.Geometry.BallPacking.Main +import OAI.Geometry.BallPacking.Necessity.Main +import OAI.Geometry.Borsuk.Main +import OAI.Geometry.CAT0Fillings.Main +import OAI.Geometry.Cannon.Main +import OAI.Geometry.ConjugatePoints.ThreeManifold +import OAI.Geometry.CoveringDensity.Main +import OAI.Geometry.CubicTorus.Main +import OAI.Geometry.CylinderCovering.Main +import OAI.Geometry.DoublingHilbert.CompactBanach +import OAI.Geometry.DoublingHilbert.Main +import OAI.Geometry.HarmonicGrowth.Main +import OAI.Geometry.HeilbronnTriangle +import OAI.Geometry.HyperbolicGroups.BipartiteLink +import OAI.Geometry.HyperbolicGroups.ClosedPicture +import OAI.Geometry.HyperbolicGroups.LetterFillingArea +import OAI.Geometry.HyperbolicGroups.LocalSegmentContinuation +import OAI.Geometry.HyperbolicGroups.LocalSegmentTools +import OAI.Geometry.HyperbolicGroups.Main +import OAI.Geometry.HyperbolicGroups.Parity +import OAI.Geometry.HyperbolicGroups.PolygonContraction +import OAI.Geometry.HyperbolicGroups.TreePathDepth +import OAI.Geometry.HypersurfaceGerms.Main +import OAI.Geometry.Immersion.ClosedSurface.Main +import OAI.Geometry.IntegralFillings.Main +import OAI.Geometry.IsometricImmersion.All +import OAI.Geometry.Kahler +import OAI.Geometry.KahlerSplitting.Main +import OAI.Geometry.LatticeCovering +import OAI.Geometry.LogVolume.BrunnMinkowski +import OAI.Geometry.Manifold.ProjectiveSphere +import OAI.Geometry.NearbyLagrangian.Main +import OAI.Geometry.NearbyLagrangian.TubeKernel +import OAI.Geometry.NegativeCurvature.Tube +import OAI.Geometry.NilpotentCharts.Main +import OAI.Geometry.NodalSets.Main +import OAI.Geometry.Perimeter.Regularity.Main +import OAI.Geometry.PeriodicTiling.Main +import OAI.Geometry.PinnedDistances.Pins +import OAI.Geometry.PlaneColoring.Five +import OAI.Geometry.PlaneColoring.Main +import OAI.Geometry.PolarProducts.Main +import OAI.Geometry.PrescribedPotential.AtlasLocalization +import OAI.Geometry.PrescribedPotential.AugmentedVolume +import OAI.Geometry.PrescribedPotential.CalabiFrameCalculus +import OAI.Geometry.PrescribedPotential.CalabiFrameScalars +import OAI.Geometry.PrescribedPotential.CalabiRicciContraction +import OAI.Geometry.PrescribedPotential.ClosedRangeSmooth +import OAI.Geometry.PrescribedPotential.CommutatorSupport +import OAI.Geometry.PrescribedPotential.CompletedProduct +import OAI.Geometry.PrescribedPotential.CompletedRealification +import OAI.Geometry.PrescribedPotential.CompletedVolume +import OAI.Geometry.PrescribedPotential.CoordinateEllipticity +import OAI.Geometry.PrescribedPotential.CoordinateExtension +import OAI.Geometry.PrescribedPotential.CoordinateMinimumBound +import OAI.Geometry.PrescribedPotential.CoordinatePotential +import OAI.Geometry.PrescribedPotential.DerivativeEllipticGain +import OAI.Geometry.PrescribedPotential.DerivativeLocalization +import OAI.Geometry.PrescribedPotential.EvenRellich +import OAI.Geometry.PrescribedPotential.FixedScaleBootstrap +import OAI.Geometry.PrescribedPotential.FredholmKernel +import OAI.Geometry.PrescribedPotential.FredholmRegularity +import OAI.Geometry.PrescribedPotential.GlobalBounds +import OAI.Geometry.PrescribedPotential.GlobalError +import OAI.Geometry.PrescribedPotential.GlobalFiniteEmbedding +import OAI.Geometry.PrescribedPotential.GlobalNonlinearCommutator +import OAI.Geometry.PrescribedPotential.GlobalProduct +import OAI.Geometry.PrescribedPotential.GlobalRellich +import OAI.Geometry.PrescribedPotential.GlobalSmooth +import OAI.Geometry.PrescribedPotential.HigherMetricOperator +import OAI.Geometry.PrescribedPotential.HigherPoisson +import OAI.Geometry.PrescribedPotential.HigherResolvent +import OAI.Geometry.PrescribedPotential.LinearizedCommutator +import OAI.Geometry.PrescribedPotential.MetricQuasilinearEquation +import OAI.Geometry.PrescribedPotential.NonlinearCoreCommutator +import OAI.Geometry.PrescribedPotential.NonlinearRemainderStrong +import OAI.Geometry.PrescribedPotential.PathCalabiBound +import OAI.Geometry.PrescribedPotential.PathCoordinateDensity +import OAI.Geometry.PrescribedPotential.PathFrameBounds +import OAI.Geometry.PrescribedPotential.PointPoisson +import OAI.Geometry.PrescribedPotential.PositiveOpenness +import OAI.Geometry.PrescribedPotential.PositivePotentialLinearization +import OAI.Geometry.PrescribedPotential.PotentialDensityDifferential +import OAI.Geometry.PrescribedPotential.PrescribedPotential +import OAI.Geometry.PrescribedPotential.QuantitativeResolvent +import OAI.Geometry.PrescribedPotential.RealMapSmooth +import OAI.Geometry.PrescribedPotential.RealPoisson +import OAI.Geometry.PrescribedPotential.RealSmoothCompactness +import OAI.Geometry.PrescribedPotential.RegularityCutoffs +import OAI.Geometry.PrescribedPotential.RegularityJets +import OAI.Geometry.PrescribedPotential.SmoothChartInverse +import OAI.Geometry.PrescribedPotential.SmoothLocalPath +import OAI.Geometry.PrescribedPotential.SmoothPathLimit +import OAI.Geometry.PrescribedPotential.SmoothSequenceCompactness +import OAI.Geometry.PrescribedPotential.SobolevDetDifferential +import OAI.Geometry.PrescribedPotential.SobolevExponential +import OAI.Geometry.PrescribedPotential.SobolevFirstGain +import OAI.Geometry.PrescribedPotential.SobolevOpenness +import OAI.Geometry.PrescribedPotential.TwoScaleRegularity +import OAI.Geometry.PrescribedPotential.UniformPathSobolev +import OAI.Geometry.PrescribedPotential.WeakDerivativeLocalization +import OAI.Geometry.PrescribedPotential.WeakPositive +import OAI.Geometry.PrescribedRicci.BoundedSmoothPoisson +import OAI.Geometry.PrescribedRicci.CalabiGradient +import OAI.Geometry.PrescribedRicci.CalabiMetricC1 +import OAI.Geometry.PrescribedRicci.CalabiRough +import OAI.Geometry.PrescribedRicci.CalabiTrace +import OAI.Geometry.PrescribedRicci.CalabiTraceBound +import OAI.Geometry.PrescribedRicci.ChernBianchi +import OAI.Geometry.PrescribedRicci.ChernLuConnection +import OAI.Geometry.PrescribedRicci.ChernRough +import OAI.Geometry.PrescribedRicci.CofactorCore +import OAI.Geometry.PrescribedRicci.CofactorCoreEquation +import OAI.Geometry.PrescribedRicci.CofactorLocalization +import OAI.Geometry.PrescribedRicci.CompactPathBounds +import OAI.Geometry.PrescribedRicci.CompactPathRicci +import OAI.Geometry.PrescribedRicci.FixedCofactorBootstrap +import OAI.Geometry.PrescribedRicci.FixedCofactorStep +import OAI.Geometry.PrescribedRicci.GlobalSmoothCompact +import OAI.Geometry.PrescribedRicci.IntegratedKahlerEnergy +import OAI.Geometry.PrescribedRicci.JetProductL2 +import OAI.Geometry.PrescribedRicci.KahlerCauchySchwarz +import OAI.Geometry.PrescribedRicci.KahlerChartGradient +import OAI.Geometry.PrescribedRicci.KahlerChartLp +import OAI.Geometry.PrescribedRicci.KahlerEnergyProduct +import OAI.Geometry.PrescribedRicci.KahlerIntegralPos +import OAI.Geometry.PrescribedRicci.KahlerL2Comparison +import OAI.Geometry.PrescribedRicci.KahlerPoincare +import OAI.Geometry.PrescribedRicci.KahlerPoissonL2 +import OAI.Geometry.PrescribedRicci.KahlerSobolev +import OAI.Geometry.PrescribedRicci.KahlerVolumeMeasure +import OAI.Geometry.PrescribedRicci.KahlerVolumeVariation +import OAI.Geometry.PrescribedRicci.MongeAmpereC0 +import OAI.Geometry.PrescribedRicci.MongeAmpereEnergy +import OAI.Geometry.PrescribedRicci.MongeAmpereL2 +import OAI.Geometry.PrescribedRicci.NormalizeVolumePath +import OAI.Geometry.PrescribedRicci.PathLocalGain +import OAI.Geometry.PrescribedRicci.PathUniformHigher +import OAI.Geometry.PrescribedRicci.PathUniformSobolevBase +import OAI.Geometry.PrescribedRicci.PositiveOpenness +import OAI.Geometry.PrescribedRicci.PositivePathLimit +import OAI.Geometry.PrescribedRicci.PrescribedRicci +import OAI.Geometry.PrescribedRicci.SmoothLocalInverse +import OAI.Geometry.PrescribedRicci.SmoothPathLimit +import OAI.Geometry.PrescribedRicci.SmoothPositivePath +import OAI.Geometry.PrescribedRicci.TameCofactorGain +import OAI.Geometry.PrescribedRicci.TraceMaximum +import OAI.Geometry.PrescribedRicci.UniformCalabi +import OAI.Geometry.PrescribedRicci.UniformChernLu +import OAI.Geometry.PrescribedRicci.UniformMetricBounds +import OAI.Geometry.PrescribedRicci.UniformPathPatches +import OAI.Geometry.PrescribedRicci.WeightedMongeAmpereEnergy +import OAI.Geometry.ProjectionBodies.Main +import OAI.Geometry.ProjectionBody.Main +import OAI.Geometry.ProjectionVolume.Main +import OAI.Geometry.QuadricBundles.Main +import OAI.Geometry.Riemannian.HarmonicCore.Main +import OAI.Geometry.RuledCovering.Main +import OAI.Geometry.SmoothYau.Main +import OAI.Geometry.SplitTangent.AllCompactLeaves +import OAI.Geometry.SplitTangent.AllProjectiveLeaves +import OAI.Geometry.SplitTangent.AnalyticFiniteRelations +import OAI.Geometry.SplitTangent.ArbitraryPlaqueLeaves +import OAI.Geometry.SplitTangent.BasicDerivativeKernel +import OAI.Geometry.SplitTangent.BoxFirstTransport +import OAI.Geometry.SplitTangent.ChartSubmersion +import OAI.Geometry.SplitTangent.CompactLeafQuotient +import OAI.Geometry.SplitTangent.CompactPositiveLeaf +import OAI.Geometry.SplitTangent.ComplementaryLeafIntersections +import OAI.Geometry.SplitTangent.DenseCompactLeaves +import OAI.Geometry.SplitTangent.DenseRationalVariation +import OAI.Geometry.SplitTangent.EmbeddedLeafCharts +import OAI.Geometry.SplitTangent.EmbeddedRationalCurve +import OAI.Geometry.SplitTangent.EmbeddedTangentLift +import OAI.Geometry.SplitTangent.EverywhereSmoothLeafQuotient +import OAI.Geometry.SplitTangent.GenericLeafProductCover +import OAI.Geometry.SplitTangent.GlobalAffineRelations +import OAI.Geometry.SplitTangent.GlobalLeafRelations +import OAI.Geometry.SplitTangent.GlobalProducts +import OAI.Geometry.SplitTangent.GlobalTopologicalProduct +import OAI.Geometry.SplitTangent.HolomorphicBasicTransport +import OAI.Geometry.SplitTangent.HolomorphicLeafBasic +import OAI.Geometry.SplitTangent.HolomorphicManifoldProduct +import OAI.Geometry.SplitTangent.IntegrabilityReduction +import OAI.Geometry.SplitTangent.IntrinsicPositiveLeaf +import OAI.Geometry.SplitTangent.LeafAffineRelations +import OAI.Geometry.SplitTangent.LeafAlgebraicDependence +import OAI.Geometry.SplitTangent.LeafClosureRelations +import OAI.Geometry.SplitTangent.LeafCompactLimits +import OAI.Geometry.SplitTangent.LeafGermIdentity +import OAI.Geometry.SplitTangent.LeafHomogeneousRelations +import OAI.Geometry.SplitTangent.LeafLimitRelations +import OAI.Geometry.SplitTangent.LeafLimitsSinglePlaque +import OAI.Geometry.SplitTangent.LeafPolynomialGrowth +import OAI.Geometry.SplitTangent.LeafProducts +import OAI.Geometry.SplitTangent.LeafTopology +import OAI.Geometry.SplitTangent.ManifoldJetAnalytic +import OAI.Geometry.SplitTangent.OpenPositiveLeaves +import OAI.Geometry.SplitTangent.PlaqueConnectedSets +import OAI.Geometry.SplitTangent.PlaqueTangentImage +import OAI.Geometry.SplitTangent.PolynomialLeafGerms +import OAI.Geometry.SplitTangent.PositiveCoverLift +import OAI.Geometry.SplitTangent.ProductCriteria +import OAI.Geometry.SplitTangent.ProjectiveHypersurfaces +import OAI.Geometry.SplitTangent.ProjectivePositiveLeaf +import OAI.Geometry.SplitTangent.ProjectiveTangentBox +import OAI.Geometry.SplitTangent.QuotientSubmersions +import OAI.Geometry.SplitTangent.RCCovariantVanishing +import OAI.Geometry.SplitTangent.RationalCoverLift +import OAI.Geometry.SplitTangent.RationalReparam +import OAI.Geometry.SplitTangent.RationalVariation +import OAI.Geometry.SplitTangent.TangentCurveLeaf +import OAI.Geometry.SplitTangent.TangentRationalChains +import OAI.Geometry.SplitTangent.TransverseDiscrete +import OAI.Geometry.SplitTangent.TransverseQuotient +import OAI.Geometry.SplitTangent.ZariskiPairOpen +import OAI.Geometry.Symplectic.MorseBounds.Main +import OAI.Geometry.TamingCompatibility.Main +import OAI.Geometry.TranslativeCovering.Main +import OAI.Geometry.TriangularCovering.Main +import OAI.Geometry.UnitDistances.Main +import OAI.Geometry.Varifold.NullComparison +import OAI.Geometry.WeakHessian.Main +import OAI.Geometry.WeakMTW.Main +import OAI.GroupTheory.ArithmeticGerms.Stabilizers +import OAI.GroupTheory.ArtinCAT0.Main +import OAI.GroupTheory.BooneHigman.Main +import OAI.GroupTheory.CyclicSeries.Length +import OAI.GroupTheory.FiniteIndex.Realization +import OAI.GroupTheory.FiniteKernel.VirtualAbelian +import OAI.GroupTheory.FiniteLattice.LabelledCollection +import OAI.GroupTheory.FiniteLattice.NormalPreimage +import OAI.GroupTheory.FiniteType.Main +import OAI.GroupTheory.Heisenberg.BarDetector +import OAI.GroupTheory.Hyperbolic.Main +import OAI.GroupTheory.Kervaire.Main +import OAI.GroupTheory.PChains.Cancellation +import OAI.GroupTheory.PeriodicGroups.Main +import OAI.GroupTheory.SimpleAmenable.Main +import OAI.GroupTheory.SimpleOvergroups.Main +import OAI.GroupTheory.Thompson.Main +import OAI.GroupTheory.UniversalGroup.Main +import OAI.InformationTheory.AmplitudeDamping.Main +import OAI.InformationTheory.BooleanNoise.Main +import OAI.InformationTheory.DimensionTen.StateKey +import OAI.InformationTheory.Entanglement.Main +import OAI.InformationTheory.PhotonNumber.Inequality +import OAI.InformationTheory.QuantumCircuit.Main +import OAI.InformationTheory.QuantumCircuit.Regularity +import OAI.InformationTheory.SecretKey.DimensionTen +import OAI.InformationTheory.SecretKey.Main +import OAI.InformationTheory.SoftChannel.Main +import OAI.LinearAlgebra.Barker.Main +import OAI.LinearAlgebra.CirculantHadamard.Main +import OAI.LinearAlgebra.CliffordAlgebra.KugaSatake +import OAI.LinearAlgebra.Descent.Rational +import OAI.LinearAlgebra.Hadamard.Main +import OAI.LinearAlgebra.MatrixFields.Main +import OAI.LinearAlgebra.MatrixMultiplication.Main +import OAI.LinearAlgebra.TensorProduct.ScalarDescent +import OAI.MathematicalPhysics.AlternatingFlow.Development +import OAI.MathematicalPhysics.Anderson.Certificates +import OAI.MathematicalPhysics.BFSS.Main +import OAI.MathematicalPhysics.Coulomb.OuterRadius +import OAI.MathematicalPhysics.CriticalMixing.Main +import OAI.MathematicalPhysics.CriticalSK.LowerExponents +import OAI.MathematicalPhysics.CriticalSK.Main +import OAI.MathematicalPhysics.Elasticity.Uniqueness +import OAI.MathematicalPhysics.HardSphere.GrandCanonical +import OAI.MathematicalPhysics.Heisenberg.Main +import OAI.MathematicalPhysics.NavierStokes.BalancedTransport.MainResult +import OAI.MathematicalPhysics.NavierStokes.Material.Main +import OAI.MathematicalPhysics.NavierStokes.ShearFlows.Main +import OAI.MathematicalPhysics.NavierStokes.VelocityDetection.Main +import OAI.MathematicalPhysics.PEPSFilters.GeometricOptimizer +import OAI.MathematicalPhysics.PEPSMove.PhysicalMove +import OAI.MathematicalPhysics.PEPSSubvolume.Main +import OAI.MathematicalPhysics.PlanarAnderson.Spectrum +import OAI.MathematicalPhysics.PrefixFlows.Main +import OAI.MathematicalPhysics.RapidForcing.Main +import OAI.MathematicalPhysics.RecorderFlows.Main +import OAI.MathematicalPhysics.SheetFlows.SheetProgram +import OAI.MathematicalPhysics.TensorNetwork.VectorColumn +import OAI.MeasureTheory.DyadicAvoidance.Main +import OAI.MeasureTheory.Falconer.Main +import OAI.MeasureTheory.FalconerCompletion.Main +import OAI.MeasureTheory.SelfSimilar.Main +import OAI.MeasureTheory.SelfSimilar.DimensionCorollaries +import OAI.ModelTheory.AbstractElementary.ModelExistence +import OAI.ModelTheory.Categoricity.Main +import OAI.ModelTheory.Choiceless.Separation +import OAI.NumberTheory.Catalan.Main +import OAI.NumberTheory.CubicGauss.Main +import OAI.NumberTheory.CubicGram.Main +import OAI.NumberTheory.DirichletL.Hecke.Nonvanishing +import OAI.NumberTheory.DirichletL.Nonvanishing +import OAI.NumberTheory.DuffinSchaeffer.Reductions +import OAI.NumberTheory.EgyptianFractions.All +import OAI.NumberTheory.GaussianMoat.Main +import OAI.NumberTheory.Jacobsthal.Main +import OAI.NumberTheory.JointDickman.PaperMain +import OAI.NumberTheory.NumberField.UnitRadicals +import OAI.NumberTheory.OrdinaryCorrelations.AbsoluteDefect.Main +import OAI.NumberTheory.OrdinaryCorrelations.Elliott.Main +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Main +import OAI.NumberTheory.Ostmann.Main +import OAI.NumberTheory.PiExponent.Main +import OAI.NumberTheory.PowerFree.Main +import OAI.NumberTheory.PrimeGaps.RatioCorollary +import OAI.NumberTheory.PrimePackets.Main +import OAI.NumberTheory.QuadraticForms.ComponentLengths +import OAI.NumberTheory.ShortEgyptian.Main +import OAI.NumberTheory.SiegelZeros.Main +import OAI.NumberTheory.SingleFold.Main +import OAI.NumberTheory.TotientAsymptotic.Main +import OAI.NumberTheory.TotientFibers.FiniteFiber +import OAI.Optimization.Tropical.TruffetCounterexample +import OAI.Probability.Ballisticity.Main +import OAI.Probability.Ballisticity.VelocityHemisphere +import OAI.Probability.BenjaminiSchramm +import OAI.Probability.BinarySweep.Main +import OAI.Probability.ClassicalON.Main +import OAI.Probability.Contingency.LocalRepair +import OAI.Probability.Contingency.PreparedResidual +import OAI.Probability.ContinuumTransition.Main +import OAI.Probability.CoordinateSweeps.Main +import OAI.Probability.CriticalPercolation.Main +import OAI.Probability.CriticalZ3.Main +import OAI.Probability.CubeShuffle.WeightedMoments +import OAI.Probability.DilutedSpin.Main +import OAI.Probability.DirectionalWalk.Main +import OAI.Probability.EntangledGames.Main +import OAI.Probability.FKPressure.Main +import OAI.Probability.FirstPassage.Main +import OAI.Probability.FKMaps.Convergence +import OAI.Probability.FreeIsing.Main +import OAI.Probability.GaussianInformation.Main +import OAI.Probability.GaussianPropeller.Main +import OAI.Probability.GaussianRegression.Main +import OAI.Probability.GaussianReplacement.Streaming +import OAI.Probability.Honeycomb.FreeEnergy +import OAI.Probability.Honeycomb.TriangleVisits +import OAI.Probability.Ising.Main +import OAI.Probability.IsingPerceptron.FullReplicaIBP +import OAI.Probability.IsingPerceptron.VariationalFiniteness +import OAI.Probability.JammingConcavity.DeletionUniformRowEstimates +import OAI.Probability.JammingConcavity.RowFiniteDiagonalRowGeneralInterpolation +import OAI.Probability.JammingConcavity.RowQuadraticTerminalLimit +import OAI.Probability.JammingConcavity.VarianceTensorization +import OAI.Probability.LatticeSurface.Brownian.BrownianClockFacet +import OAI.Probability.LatticeSurface.Brownian.BrownianClockSupport +import OAI.Probability.LatticeSurface.Brownian.BrownianPath +import OAI.Probability.LatticeSurface.Brownian.BrownianPathIdentities +import OAI.Probability.LatticeSurface.Coercivity.HoleWeighted +import OAI.Probability.LatticeSurface.Convexity.ClusterDynamicsDefs +import OAI.Probability.LatticeSurface.Convexity.FiniteLevelBarrier +import OAI.Probability.LatticeSurface.Convexity.Metropolis +import OAI.Probability.LatticeSurface.Convexity.MetropolisSupport +import OAI.Probability.LatticeSurface.Convexity.ProductSums +import OAI.Probability.LatticeSurface.Convexity.SupportUnit +import OAI.Probability.LatticeSurface.Convexity.TailNumerics +import OAI.Probability.LatticeSurface.Convexity.TransportResampling +import OAI.Probability.LatticeSurface.Dynamics.CompactCoupling +import OAI.Probability.LatticeSurface.Dynamics.LatticeShift +import OAI.Probability.LatticeSurface.Dynamics.ProjectionComparison +import OAI.Probability.LatticeSurface.Dynamics.ProjectionGlobal +import OAI.Probability.LatticeSurface.Dynamics.ProjectionLimit +import OAI.Probability.LatticeSurface.Dynamics.TiltApplication +import OAI.Probability.LatticeSurface.Dynamics.TiltSupport +import OAI.Probability.LatticeSurface.Dynamics.WeightedInitial +import OAI.Probability.LatticeSurface.Geometry.ContactVolume +import OAI.Probability.LatticeSurface.Moments.Averages +import OAI.Probability.Localization.Main +import OAI.Probability.LogConcave.Main +import OAI.Probability.MatroidProphet +import OAI.Probability.MatroidSecretary.Main +import OAI.Probability.MemoryPrecision.Main +import OAI.Probability.ParisiFinite.ParisiCanonicalTransport +import OAI.Probability.ParisiFinite.ParisiEntropyDecomposition +import OAI.Probability.ParisiFinite.RealShiftNormSqLe +import OAI.Probability.ParisiFinite.SpinFlip +import OAI.Probability.ParisiFinite.WeightedGradientField +import OAI.Probability.Perceptron.Main +import OAI.Probability.PosteriorReplicas.Main +import OAI.Probability.ProbabilityMeasure.ArctanCenter +import OAI.Probability.ProjectionMoments.Main +import OAI.Probability.RadialTransition.DensityInterval +import OAI.Probability.RadialTransition.Main +import OAI.Probability.RandomSAT.Main +import OAI.Probability.Renewal.Main +import OAI.Probability.SATComputability.Main +import OAI.Probability.SATVariance.Main +import OAI.Probability.SKBarriers.Main +import OAI.Probability.SKCutoff.Denominator +import OAI.Probability.SKFluctuations.ComparisonMinimumRealOverlapConclusion +import OAI.Probability.SKGap.Main +import OAI.Probability.SKSupport.Main +import OAI.Probability.SKValue.Main +import OAI.Probability.SLE.MainReduction +import OAI.Probability.SLE.MomentGauge +import OAI.Probability.SLE.SausageCharge +import OAI.Probability.SLEGauge.Main +import OAI.Probability.SLELocalization.CircleMeans +import OAI.Probability.SLELocalization.DriverStability +import OAI.Probability.SLELocalization.FilledObstacle +import OAI.Probability.SLELocalization.LoewnerCocycle +import OAI.Probability.SLELocalization.MappedExit +import OAI.Probability.SLELocalization.MeshSlab +import OAI.Probability.SLELocalization.PastObstacle +import OAI.Probability.SLELocalization.RetainedFirstMoment +import OAI.Probability.SLELocalization.SlitMaps +import OAI.Probability.SLELocalization.SpatialLimit +import OAI.Probability.SLELocalization.StrongRestart +import OAI.Probability.SLELocalization.TraceAvoidance +import OAI.Probability.SLELocalization.TruncatedEnergy +import OAI.Probability.SignedSweeps.Main +import OAI.Probability.SpanningForest.Main +import OAI.Probability.SphericalField.Main +import OAI.Probability.SphericalPerceptron.PressureComparison +import OAI.Probability.StrongRayleigh +import OAI.Probability.Subsphere.Main +import OAI.Probability.SwitchChain +import OAI.Probability.ThorpCompatibility.Main +import OAI.Probability.ThorpResults.FullDevelopment +import OAI.Probability.ThorpRouting.Main +import OAI.Probability.ThorpRouting.RegularTrace +import OAI.Probability.ThorpShuffle.FirstFourier +import OAI.Probability.ThorpShuffle.FirstMain +import OAI.Probability.ThorpShuffle.FixedLists.Main +import OAI.Probability.ThorpShuffle.Main +import OAI.Probability.ThreeState.Main +import OAI.Probability.ThreeStateClauses.Main +import OAI.Probability.TraceReconstruction +import OAI.Probability.UnimodularPercolation.CayleyMain +import OAI.Probability.UnimodularPercolation.Main +import OAI.Probability.UnimodularPercolation.UnimodularMain +import OAI.Probability.Voronoi.CardyFormula +import OAI.RepresentationTheory.AlperinWeights.Brauer +import OAI.RepresentationTheory.Block.Defect +import OAI.RepresentationTheory.FoulkesHowe +import OAI.RepresentationTheory.FoulkesSixth.Main +import OAI.RepresentationTheory.GraphModels.NormalActions +import OAI.RepresentationTheory.KazhdanLusztig.Invariance +import OAI.RepresentationTheory.PartialPermutation.Main +import OAI.RepresentationTheory.ProjectiveInduction.CosetTransport +import OAI.RepresentationTheory.RestrictedTilting.Main +import OAI.RepresentationTheory.RowColumn.Occupied +import OAI.RepresentationTheory.Saxl.Main +import OAI.RepresentationTheory.SpinAngle.TypeAngle +import OAI.RepresentationTheory.TensorSquares.Main +import OAI.RepresentationTheory.Torus.ConvexWeights +import OAI.RepresentationTheory.VertexAlgebra.Main +import OAI.RingTheory.BassTrace.Main +import OAI.RingTheory.BassTrace.TorsionFree +import OAI.RingTheory.DirectFiniteness.FinitelyPresented +import OAI.RingTheory.DirectFiniteness.Main +import OAI.RingTheory.DivisionRing.FiniteDescent +import OAI.RingTheory.FormalGroup.Main +import OAI.RingTheory.GroupAction.TraceOne +import OAI.RingTheory.Kurosh.Main +import OAI.RingTheory.Multiplicity.Main +import OAI.RingTheory.Tachikawa.Counterexample +import OAI.SetTheory.PartitionConsistency.Main +import OAI.SetTheory.PartitionPrinciple.Main +import OAI.Topology.ArtinGroups.Main +import OAI.Topology.ArtinGroups.ParabolicIntersections.Main +import OAI.Topology.EilenbergGanea.Main +import OAI.Topology.TorusCompression.Boundary +import OAI.Topology.CoarseAssembly +import OAI.RepresentationTheory.UniversalSquare.Main +import OAI.Probability.SKRatio.Main +import OAI.Geometry.Relativity.CKS.Main +import OAI.Geometry.SurfaceImmersion.All + +import OAI.GroupTheory.PolycyclicRecognition diff --git a/lean/OAI/Topology/CoarseAssembly.lean b/lean/OAI/Topology/CoarseAssembly.lean index 6d74230f184346525742507308a2e387cc15e944..243560dd4aeb27c7dac15a401aad3d9545a24e25 100644 --- a/lean/OAI/Topology/CoarseAssembly.lean +++ b/lean/OAI/Topology/CoarseAssembly.lean @@ -1,190 +1,190 @@ -import OAI.Topology.CoarseAssembly.FiberedPersistence -import OAI.Topology.CoarseAssembly.HomotopyFilling -import OAI.Topology.CoarseAssembly.LatticeHat -import OAI.Topology.CoarseAssembly.FilledDisc -import OAI.Topology.CoarseAssembly.FilledEdges -import OAI.Topology.CoarseAssembly.FilledWalks -import OAI.Topology.CoarseAssembly.CompactFamilyMap -import OAI.Topology.CoarseAssembly.FamilyFilling -import OAI.Topology.CoarseAssembly.RipsProperEmbedding -import OAI.Topology.CoarseAssembly.RoeInclusion -import OAI.Topology.CoarseAssembly.BoundaryGeometry -import OAI.Topology.CoarseAssembly.BoundaryWalks -import OAI.Topology.CoarseAssembly.BoundaryComponents -import OAI.Topology.CoarseAssembly.HexagonSides -import OAI.Topology.CoarseAssembly.RipsMapCalculus -import OAI.Topology.CoarseAssembly.RipsReindex -import OAI.Topology.CoarseAssembly.ConcretePersistence -import OAI.Topology.CoarseAssembly.BoundaryLoopMaps -import OAI.Topology.CoarseAssembly.BoundaryAssemblyMaps -import OAI.Topology.CoarseAssembly.BoundaryConclusion -import OAI.Topology.CoarseAssembly.PublishedInputReduction -import OAI.Topology.CoarseAssembly.CycleCompactPerturbation -import OAI.Topology.CoarseAssembly.UnitalCycleNormalization -import OAI.Topology.CoarseAssembly.FiniteCycle -import OAI.Topology.CoarseAssembly.FredholmSquare -import OAI.Topology.CoarseAssembly.UnitalCycleInvertible -import OAI.Topology.CoarseAssembly.CompactFunctionalCalculus -import OAI.Topology.CoarseAssembly.RipsEmbedding -import OAI.Topology.CoarseAssembly.ClopenRestriction -import OAI.Topology.CoarseAssembly.ClopenNaturality -import OAI.Topology.CoarseAssembly.CountableAdditivity -import OAI.Topology.CoarseAssembly.SeparatedRips -import OAI.Topology.CoarseAssembly.RipsCompactSupport -import OAI.Topology.CoarseAssembly.RipsFamilyMap -import OAI.Topology.CoarseAssembly.RipsFamilyRestriction -import OAI.Topology.CoarseAssembly.RipsPathCoarsening -import OAI.Topology.CoarseAssembly.CocycleCircleMap -import OAI.Topology.CoarseAssembly.RipsPaths -import OAI.Topology.CoarseAssembly.CocyclePathLifting -import OAI.Topology.CoarseAssembly.FiniteRips -import OAI.Topology.CoarseAssembly.RipsWindingTest -import OAI.Topology.CoarseAssembly.LoopCircle -import OAI.Topology.CoarseAssembly.CirclePairing -import OAI.Topology.CoarseAssembly.FiniteWindingIndex -import OAI.Topology.CoarseAssembly.InclusionModule -import OAI.Topology.CoarseAssembly.BoundaryEmbedding -import OAI.Topology.CoarseAssembly.SeparatedUnion -import OAI.Topology.CoarseAssembly.GraphMetric -import OAI.Topology.CoarseAssembly.SeparatedGeometry -import OAI.Topology.CoarseAssembly.ConcreteSpaces -import OAI.Topology.CoarseAssembly.ConcreteTransferMaps -import OAI.Topology.CoarseAssembly.ConcreteTransfer -import OAI.Topology.CoarseAssembly.Averaging -import OAI.Topology.CoarseAssembly.ProjectionBlocks -import OAI.Topology.CoarseAssembly.SpatialAveraging -import OAI.Topology.CoarseAssembly.AveragingPropagation -import OAI.Topology.CoarseAssembly.KazhdanInput -import OAI.Topology.CoarseAssembly.TensorFibers -import OAI.Topology.CoarseAssembly.TransferCriterion -import OAI.Topology.CoarseAssembly.FiniteFiberMaps -import OAI.Topology.CoarseAssembly.CongruenceSurjective -import OAI.Topology.CoarseAssembly.CongruenceEdgeOperators -import OAI.Topology.CoarseAssembly.GraphFiberOperators -import OAI.Topology.CoarseAssembly.PathFiberOperators -import OAI.Topology.CoarseAssembly.DiscConnected -import OAI.Topology.CoarseAssembly.FiberConnected -import OAI.Topology.CoarseAssembly.FiberDegree -import OAI.Topology.CoarseAssembly.AnalyticKHomology -import OAI.Topology.CoarseAssembly.Assembly -import OAI.Topology.CoarseAssembly.BoundaryIndex -import OAI.Topology.CoarseAssembly.BlockOperators -import OAI.Topology.CoarseAssembly.BoundedGeometry -import OAI.Topology.CoarseAssembly.ChosenHolonomy -import OAI.Topology.CoarseAssembly.CongruenceQuotients -import OAI.Topology.CoarseAssembly.CongruenceMaps -import OAI.Topology.CoarseAssembly.CongruenceFibers -import OAI.Topology.CoarseAssembly.Conjugation -import OAI.Topology.CoarseAssembly.ControlledMatrices -import OAI.Topology.CoarseAssembly.FiniteWords -import OAI.Topology.CoarseAssembly.FiberedGraph -import OAI.Topology.CoarseAssembly.FiberConstants -import OAI.Topology.CoarseAssembly.FiberEmbedding -import OAI.Topology.CoarseAssembly.FredholmModule -import OAI.Topology.CoarseAssembly.Holonomy -import OAI.Topology.CoarseAssembly.HilbertSum -import OAI.Topology.CoarseAssembly.Lattice -import OAI.Topology.CoarseAssembly.LatticeCharge -import OAI.Topology.CoarseAssembly.LocallyFinite -import OAI.Topology.CoarseAssembly.NonUnitalK1 -import OAI.Topology.CoarseAssembly.Persistence -import OAI.Topology.CoarseAssembly.RipsRealization -import OAI.Topology.CoarseAssembly.Roe -import OAI.Topology.CoarseAssembly.RoeCalculus -import OAI.Topology.CoarseAssembly.RoeTransfer -import OAI.Topology.CoarseAssembly.RoeRows -import OAI.Topology.CoarseAssembly.Sandwich -import OAI.Topology.CoarseAssembly.ShortLoops -import OAI.Topology.CoarseAssembly.SpatialBlocks -import OAI.Topology.CoarseAssembly.TopologicalK1 -import OAI.Topology.CoarseAssembly.TraceObstruction -import OAI.Topology.CoarseAssembly.TraceSeparation -import OAI.Topology.CoarseAssembly.TransferLift -import OAI.Topology.CoarseAssembly.RealNormalization -import OAI.Topology.CoarseAssembly.InvolutiveNormalization -import OAI.Topology.CoarseAssembly.ScalarCycleNormalization -import OAI.Topology.CoarseAssembly.LocalCompactPerturbation -import OAI.Topology.CoarseAssembly.ScalarCutDown -import OAI.Topology.CoarseAssembly.SupportedNormalization -import OAI.Topology.CoarseAssembly.PointCoefficient -import OAI.Topology.CoarseAssembly.FredholmParametrix -import OAI.Topology.CoarseAssembly.ToeplitzCompression -import OAI.Topology.CoarseAssembly.CycleIndex -import OAI.Topology.CoarseAssembly.RepresentedCutDown -import OAI.Topology.CoarseAssembly.RepresentedNormalization -import OAI.Topology.CoarseAssembly.RepresentedIndex -import OAI.Topology.CoarseAssembly.CompactIndex -import OAI.Topology.CoarseAssembly.OperatorNormalization -import OAI.Topology.CoarseAssembly.EssentialToeplitz -import OAI.Topology.CoarseAssembly.ExplicitCutDown -import OAI.Topology.CoarseAssembly.RawCycleIndex -import OAI.Topology.CoarseAssembly.DegenerateCutDown -import OAI.Topology.CoarseAssembly.UnitaryIndex -import OAI.Topology.CoarseAssembly.CompactIndexPairing -import OAI.Topology.CoarseAssembly.CircleInputReduction -import OAI.Topology.CoarseAssembly.CircleCoefficient -import OAI.Topology.CoarseAssembly.ExplicitCircleFamily -import OAI.Topology.CoarseAssembly.ExplicitBoundaryConclusion -import OAI.Topology.CoarseAssembly.StructureQuotient -import OAI.Topology.CoarseAssembly.ControlledBoundaryHomotopy -import OAI.Topology.CoarseAssembly.CayleyNaturality -import OAI.Topology.CoarseAssembly.RipsPartition -import OAI.Topology.CoarseAssembly.PartitionIsometry -import OAI.Topology.CoarseAssembly.RipsBoundaryRepresentative -import OAI.Topology.CoarseAssembly.AmpleRipsFamily -import OAI.Topology.CoarseAssembly.MultiplierBoundaryHomotopy -import OAI.Topology.CoarseAssembly.RelativeNaturality -import OAI.Topology.CoarseAssembly.SeparatedFamilyHomotopy -import OAI.Topology.CoarseAssembly.SeparatedFamilyPerturbation -import OAI.Topology.CoarseAssembly.SpatialBoundaryNaturality -import OAI.Topology.CoarseAssembly.CoefficientRoeHom -import OAI.Topology.CoarseAssembly.PartitionInclusion -import OAI.Topology.CoarseAssembly.CoefficientInclusion -import OAI.Topology.CoarseAssembly.ExplicitBoundaryRepresentative -import OAI.Topology.CoarseAssembly.NormalizedRipsFamily -import OAI.Topology.CoarseAssembly.RipsBoundaryDegeneracy -import OAI.Topology.CoarseAssembly.RipsFamilyCompactPerturbation -import OAI.Topology.CoarseAssembly.RipsScaleCompatibility -import OAI.Topology.CoarseAssembly.MultiplierUnitaryHomotopy -import OAI.Topology.CoarseAssembly.RelativeTwoDiagonal -import OAI.Topology.CoarseAssembly.IsometryDilation - -import OAI.Topology.CoarseAssembly.RelativePartialIsometry -import OAI.Topology.CoarseAssembly.MultiplierIsometryInvariance - -import OAI.Topology.CoarseAssembly.RipsEmbeddingIndependence -import OAI.Topology.CoarseAssembly.PointwiseEmbeddingTransition - -import OAI.Topology.CoarseAssembly.RipsUnitaryFamily -import OAI.Topology.CoarseAssembly.OrthogonalSumBoundary - -import OAI.Topology.CoarseAssembly.RipsDirectSumBoundary - -import OAI.Topology.CoarseAssembly.SeparatedFamilyNearby - -import OAI.Topology.CoarseAssembly.ControlledCoarseAssembly -import OAI.Topology.CoarseAssembly.RipsFiniteHomotopy -import OAI.Topology.CoarseAssembly.RipsFixedRepresentationHomotopy - -import OAI.Topology.CoarseAssembly.RipsUnrestrictedHomotopy -import OAI.Topology.CoarseAssembly.RegularizedRipsFamily -import OAI.Topology.CoarseAssembly.BoundedTransformNaturality -import OAI.Topology.CoarseAssembly.SeparatedRipsIndex -import OAI.Topology.CoarseAssembly.RipsFiniteTail -import OAI.Topology.CoarseAssembly.RegularizedCoarsening -import OAI.Topology.CoarseAssembly.LateRipsCoarsening -import OAI.Topology.CoarseAssembly.SeparatedCoarseAssembly -import OAI.Topology.CoarseAssembly.SeparatedIndexNaturality -import OAI.Topology.CoarseAssembly.IndexFamilyTransport -import OAI.Topology.CoarseAssembly.ConstructedConclusion -import OAI.Topology.CoarseAssembly.AveragingEnergy -import OAI.Topology.CoarseAssembly.RegularConstants -import OAI.Topology.CoarseAssembly.UnconditionalConclusion - -/-! -# A bounded-geometry counterexample to coarse Novikov - -The concrete graph union has an infinite-order assembly-kernel class, -and its constructed analytic assembly map fails to be injective both -integrally and rationally. --/ +import OAI.Topology.CoarseAssembly.FiberedPersistence +import OAI.Topology.CoarseAssembly.HomotopyFilling +import OAI.Topology.CoarseAssembly.LatticeHat +import OAI.Topology.CoarseAssembly.FilledDisc +import OAI.Topology.CoarseAssembly.FilledEdges +import OAI.Topology.CoarseAssembly.FilledWalks +import OAI.Topology.CoarseAssembly.CompactFamilyMap +import OAI.Topology.CoarseAssembly.FamilyFilling +import OAI.Topology.CoarseAssembly.RipsProperEmbedding +import OAI.Topology.CoarseAssembly.RoeInclusion +import OAI.Topology.CoarseAssembly.BoundaryGeometry +import OAI.Topology.CoarseAssembly.BoundaryWalks +import OAI.Topology.CoarseAssembly.BoundaryComponents +import OAI.Topology.CoarseAssembly.HexagonSides +import OAI.Topology.CoarseAssembly.RipsMapCalculus +import OAI.Topology.CoarseAssembly.RipsReindex +import OAI.Topology.CoarseAssembly.ConcretePersistence +import OAI.Topology.CoarseAssembly.BoundaryLoopMaps +import OAI.Topology.CoarseAssembly.BoundaryAssemblyMaps +import OAI.Topology.CoarseAssembly.BoundaryConclusion +import OAI.Topology.CoarseAssembly.PublishedInputReduction +import OAI.Topology.CoarseAssembly.CycleCompactPerturbation +import OAI.Topology.CoarseAssembly.UnitalCycleNormalization +import OAI.Topology.CoarseAssembly.FiniteCycle +import OAI.Topology.CoarseAssembly.FredholmSquare +import OAI.Topology.CoarseAssembly.UnitalCycleInvertible +import OAI.Topology.CoarseAssembly.CompactFunctionalCalculus +import OAI.Topology.CoarseAssembly.RipsEmbedding +import OAI.Topology.CoarseAssembly.ClopenRestriction +import OAI.Topology.CoarseAssembly.ClopenNaturality +import OAI.Topology.CoarseAssembly.CountableAdditivity +import OAI.Topology.CoarseAssembly.SeparatedRips +import OAI.Topology.CoarseAssembly.RipsCompactSupport +import OAI.Topology.CoarseAssembly.RipsFamilyMap +import OAI.Topology.CoarseAssembly.RipsFamilyRestriction +import OAI.Topology.CoarseAssembly.RipsPathCoarsening +import OAI.Topology.CoarseAssembly.CocycleCircleMap +import OAI.Topology.CoarseAssembly.RipsPaths +import OAI.Topology.CoarseAssembly.CocyclePathLifting +import OAI.Topology.CoarseAssembly.FiniteRips +import OAI.Topology.CoarseAssembly.RipsWindingTest +import OAI.Topology.CoarseAssembly.LoopCircle +import OAI.Topology.CoarseAssembly.CirclePairing +import OAI.Topology.CoarseAssembly.FiniteWindingIndex +import OAI.Topology.CoarseAssembly.InclusionModule +import OAI.Topology.CoarseAssembly.BoundaryEmbedding +import OAI.Topology.CoarseAssembly.SeparatedUnion +import OAI.Topology.CoarseAssembly.GraphMetric +import OAI.Topology.CoarseAssembly.SeparatedGeometry +import OAI.Topology.CoarseAssembly.ConcreteSpaces +import OAI.Topology.CoarseAssembly.ConcreteTransferMaps +import OAI.Topology.CoarseAssembly.ConcreteTransfer +import OAI.Topology.CoarseAssembly.Averaging +import OAI.Topology.CoarseAssembly.ProjectionBlocks +import OAI.Topology.CoarseAssembly.SpatialAveraging +import OAI.Topology.CoarseAssembly.AveragingPropagation +import OAI.Topology.CoarseAssembly.KazhdanInput +import OAI.Topology.CoarseAssembly.TensorFibers +import OAI.Topology.CoarseAssembly.TransferCriterion +import OAI.Topology.CoarseAssembly.FiniteFiberMaps +import OAI.Topology.CoarseAssembly.CongruenceSurjective +import OAI.Topology.CoarseAssembly.CongruenceEdgeOperators +import OAI.Topology.CoarseAssembly.GraphFiberOperators +import OAI.Topology.CoarseAssembly.PathFiberOperators +import OAI.Topology.CoarseAssembly.DiscConnected +import OAI.Topology.CoarseAssembly.FiberConnected +import OAI.Topology.CoarseAssembly.FiberDegree +import OAI.Topology.CoarseAssembly.AnalyticKHomology +import OAI.Topology.CoarseAssembly.Assembly +import OAI.Topology.CoarseAssembly.BoundaryIndex +import OAI.Topology.CoarseAssembly.BlockOperators +import OAI.Topology.CoarseAssembly.BoundedGeometry +import OAI.Topology.CoarseAssembly.ChosenHolonomy +import OAI.Topology.CoarseAssembly.CongruenceQuotients +import OAI.Topology.CoarseAssembly.CongruenceMaps +import OAI.Topology.CoarseAssembly.CongruenceFibers +import OAI.Topology.CoarseAssembly.Conjugation +import OAI.Topology.CoarseAssembly.ControlledMatrices +import OAI.Topology.CoarseAssembly.FiniteWords +import OAI.Topology.CoarseAssembly.FiberedGraph +import OAI.Topology.CoarseAssembly.FiberConstants +import OAI.Topology.CoarseAssembly.FiberEmbedding +import OAI.Topology.CoarseAssembly.FredholmModule +import OAI.Topology.CoarseAssembly.Holonomy +import OAI.Topology.CoarseAssembly.HilbertSum +import OAI.Topology.CoarseAssembly.Lattice +import OAI.Topology.CoarseAssembly.LatticeCharge +import OAI.Topology.CoarseAssembly.LocallyFinite +import OAI.Topology.CoarseAssembly.NonUnitalK1 +import OAI.Topology.CoarseAssembly.Persistence +import OAI.Topology.CoarseAssembly.RipsRealization +import OAI.Topology.CoarseAssembly.Roe +import OAI.Topology.CoarseAssembly.RoeCalculus +import OAI.Topology.CoarseAssembly.RoeTransfer +import OAI.Topology.CoarseAssembly.RoeRows +import OAI.Topology.CoarseAssembly.Sandwich +import OAI.Topology.CoarseAssembly.ShortLoops +import OAI.Topology.CoarseAssembly.SpatialBlocks +import OAI.Topology.CoarseAssembly.TopologicalK1 +import OAI.Topology.CoarseAssembly.TraceObstruction +import OAI.Topology.CoarseAssembly.TraceSeparation +import OAI.Topology.CoarseAssembly.TransferLift +import OAI.Topology.CoarseAssembly.RealNormalization +import OAI.Topology.CoarseAssembly.InvolutiveNormalization +import OAI.Topology.CoarseAssembly.ScalarCycleNormalization +import OAI.Topology.CoarseAssembly.LocalCompactPerturbation +import OAI.Topology.CoarseAssembly.ScalarCutDown +import OAI.Topology.CoarseAssembly.SupportedNormalization +import OAI.Topology.CoarseAssembly.PointCoefficient +import OAI.Topology.CoarseAssembly.FredholmParametrix +import OAI.Topology.CoarseAssembly.ToeplitzCompression +import OAI.Topology.CoarseAssembly.CycleIndex +import OAI.Topology.CoarseAssembly.RepresentedCutDown +import OAI.Topology.CoarseAssembly.RepresentedNormalization +import OAI.Topology.CoarseAssembly.RepresentedIndex +import OAI.Topology.CoarseAssembly.CompactIndex +import OAI.Topology.CoarseAssembly.OperatorNormalization +import OAI.Topology.CoarseAssembly.EssentialToeplitz +import OAI.Topology.CoarseAssembly.ExplicitCutDown +import OAI.Topology.CoarseAssembly.RawCycleIndex +import OAI.Topology.CoarseAssembly.DegenerateCutDown +import OAI.Topology.CoarseAssembly.UnitaryIndex +import OAI.Topology.CoarseAssembly.CompactIndexPairing +import OAI.Topology.CoarseAssembly.CircleInputReduction +import OAI.Topology.CoarseAssembly.CircleCoefficient +import OAI.Topology.CoarseAssembly.ExplicitCircleFamily +import OAI.Topology.CoarseAssembly.ExplicitBoundaryConclusion +import OAI.Topology.CoarseAssembly.StructureQuotient +import OAI.Topology.CoarseAssembly.ControlledBoundaryHomotopy +import OAI.Topology.CoarseAssembly.CayleyNaturality +import OAI.Topology.CoarseAssembly.RipsPartition +import OAI.Topology.CoarseAssembly.PartitionIsometry +import OAI.Topology.CoarseAssembly.RipsBoundaryRepresentative +import OAI.Topology.CoarseAssembly.AmpleRipsFamily +import OAI.Topology.CoarseAssembly.MultiplierBoundaryHomotopy +import OAI.Topology.CoarseAssembly.RelativeNaturality +import OAI.Topology.CoarseAssembly.SeparatedFamilyHomotopy +import OAI.Topology.CoarseAssembly.SeparatedFamilyPerturbation +import OAI.Topology.CoarseAssembly.SpatialBoundaryNaturality +import OAI.Topology.CoarseAssembly.CoefficientRoeHom +import OAI.Topology.CoarseAssembly.PartitionInclusion +import OAI.Topology.CoarseAssembly.CoefficientInclusion +import OAI.Topology.CoarseAssembly.ExplicitBoundaryRepresentative +import OAI.Topology.CoarseAssembly.NormalizedRipsFamily +import OAI.Topology.CoarseAssembly.RipsBoundaryDegeneracy +import OAI.Topology.CoarseAssembly.RipsFamilyCompactPerturbation +import OAI.Topology.CoarseAssembly.RipsScaleCompatibility +import OAI.Topology.CoarseAssembly.MultiplierUnitaryHomotopy +import OAI.Topology.CoarseAssembly.RelativeTwoDiagonal +import OAI.Topology.CoarseAssembly.IsometryDilation + +import OAI.Topology.CoarseAssembly.RelativePartialIsometry +import OAI.Topology.CoarseAssembly.MultiplierIsometryInvariance + +import OAI.Topology.CoarseAssembly.RipsEmbeddingIndependence +import OAI.Topology.CoarseAssembly.PointwiseEmbeddingTransition + +import OAI.Topology.CoarseAssembly.RipsUnitaryFamily +import OAI.Topology.CoarseAssembly.OrthogonalSumBoundary + +import OAI.Topology.CoarseAssembly.RipsDirectSumBoundary + +import OAI.Topology.CoarseAssembly.SeparatedFamilyNearby + +import OAI.Topology.CoarseAssembly.ControlledCoarseAssembly +import OAI.Topology.CoarseAssembly.RipsFiniteHomotopy +import OAI.Topology.CoarseAssembly.RipsFixedRepresentationHomotopy + +import OAI.Topology.CoarseAssembly.RipsUnrestrictedHomotopy +import OAI.Topology.CoarseAssembly.RegularizedRipsFamily +import OAI.Topology.CoarseAssembly.BoundedTransformNaturality +import OAI.Topology.CoarseAssembly.SeparatedRipsIndex +import OAI.Topology.CoarseAssembly.RipsFiniteTail +import OAI.Topology.CoarseAssembly.RegularizedCoarsening +import OAI.Topology.CoarseAssembly.LateRipsCoarsening +import OAI.Topology.CoarseAssembly.SeparatedCoarseAssembly +import OAI.Topology.CoarseAssembly.SeparatedIndexNaturality +import OAI.Topology.CoarseAssembly.IndexFamilyTransport +import OAI.Topology.CoarseAssembly.ConstructedConclusion +import OAI.Topology.CoarseAssembly.AveragingEnergy +import OAI.Topology.CoarseAssembly.RegularConstants +import OAI.Topology.CoarseAssembly.UnconditionalConclusion + +/-! +# A bounded-geometry counterexample to coarse Novikov + +The concrete graph union has an infinite-order assembly-kernel class, +and its constructed analytic assembly map fails to be injective both +integrally and rationally. +-/ diff --git a/lean/OAI/Topology/CoarseAssembly/UnconditionalConclusion.lean b/lean/OAI/Topology/CoarseAssembly/UnconditionalConclusion.lean index c3f6bc377ceb85cdb366410039a7a5e0d23c6b37..a4ff18ccc4a11dc7dbf6ce764752c6288b6eade0 100644 --- a/lean/OAI/Topology/CoarseAssembly/UnconditionalConclusion.lean +++ b/lean/OAI/Topology/CoarseAssembly/UnconditionalConclusion.lean @@ -1,60 +1,60 @@ -import OAI.Topology.CoarseAssembly.Definitions -import OAI.Topology.CoarseAssembly.CongruenceElementary -import OAI.Topology.CoarseAssembly.ConstructedConclusion - -namespace OAI - -/-! # The unconditional bounded-geometry counterexample - -The geometric construction, analytic assembly, integral spectral certificate -and finite congruence generation are combined here. --/ - -noncomputable section - -namespace CoarseAssembly - -open Congruence Rips Analytic - -attribute [local instance] OAI.CoarseAssembly.unconditionalConclusionMetric - -theorem provedKazhdanInput : PublishedKazhdanInput := - publishedKazhdanInput_of_elementaryReduction elementaryReduction_surjective - -/-- The constructed ordinary coarse assembly map has an infinite-order -kernel class and fails injectivity both integrally and rationally. -/ -theorem bounded_geometry_counterexample_unconditional : - ProperSpace VertexUnion ∧ UniformFiniteBalls VertexUnion ∧ - (∀ x y : VertexUnion, x ≠ y → 1 ≤ dist x y) ∧ - ∃ α : KX1 VertexUnion, - (∀ n : ℤ, n ≠ 0 → n • α ≠ 0) ∧ constructedCoarseAssembly α = 0 ∧ - (1 : ℚ) ⊗ₜ[ℤ] α ≠ 0 ∧ - ¬ Function.Injective constructedCoarseAssembly ∧ - ¬ Function.Injective (constructedCoarseAssembly.toIntLinearMap.lTensor ℚ) := - bounded_geometry_counterexample_from_gap provedKazhdanInput - -/-- The graph-family clauses of the main theorem, together with the full -coarse-assembly conclusion for its concrete separated union. -/ -theorem bounded_geometry_graph_counterexample_unconditional : - (∀ j, Finite (FiberVertex j) ∧ - (fiberedGraph elementaryMoves chosenHolonomyUnit j).Connected) ∧ - (∃ D : ℕ, ∀ j (x : FiberVertex j), - Nat.card {y // (fiberedGraph elementaryMoves chosenHolonomyUnit j).Adj x y} ≤ D) ∧ - ProperSpace VertexUnion ∧ UniformFiniteBalls VertexUnion ∧ - (∀ x y : VertexUnion, x ≠ y → 1 ≤ dist x y) ∧ - ∃ α : KX1 VertexUnion, - (∀ n : ℤ, n ≠ 0 → n • α ≠ 0) ∧ constructedCoarseAssembly α = 0 ∧ - (1 : ℚ) ⊗ₜ[ℤ] α ≠ 0 ∧ - ¬ Function.Injective constructedCoarseAssembly ∧ - ¬ Function.Injective (constructedCoarseAssembly.toIntLinearMap.lTensor ℚ) := by - refine ⟨?_, ?_, bounded_geometry_counterexample_unconditional⟩ - · intro j - exact ⟨inferInstance, fiberedGraph_connected elementaryMoves chosenHolonomyUnit j⟩ - · exact ⟨7 * (symmetricMoves elementaryMoves).card * 2 ^ 9, - fun _ x => card_fibered_neighbors_le elementaryMoves chosenHolonomyUnit x⟩ - -end CoarseAssembly - -end - -end OAI +import OAI.Topology.CoarseAssembly.Definitions +import OAI.Topology.CoarseAssembly.CongruenceElementary +import OAI.Topology.CoarseAssembly.ConstructedConclusion + +namespace OAI + +/-! # The unconditional bounded-geometry counterexample + +The geometric construction, analytic assembly, integral spectral certificate +and finite congruence generation are combined here. +-/ + +noncomputable section + +namespace CoarseAssembly + +open Congruence Rips Analytic + +attribute [local instance] OAI.CoarseAssembly.unconditionalConclusionMetric + +theorem provedKazhdanInput : PublishedKazhdanInput := + publishedKazhdanInput_of_elementaryReduction elementaryReduction_surjective + +/-- The constructed ordinary coarse assembly map has an infinite-order +kernel class and fails injectivity both integrally and rationally. -/ +theorem bounded_geometry_counterexample_unconditional : + ProperSpace VertexUnion ∧ UniformFiniteBalls VertexUnion ∧ + (∀ x y : VertexUnion, x ≠ y → 1 ≤ dist x y) ∧ + ∃ α : KX1 VertexUnion, + (∀ n : ℤ, n ≠ 0 → n • α ≠ 0) ∧ constructedCoarseAssembly α = 0 ∧ + (1 : ℚ) ⊗ₜ[ℤ] α ≠ 0 ∧ + ¬ Function.Injective constructedCoarseAssembly ∧ + ¬ Function.Injective (constructedCoarseAssembly.toIntLinearMap.lTensor ℚ) := + bounded_geometry_counterexample_from_gap provedKazhdanInput + +/-- The graph-family clauses of the main theorem, together with the full +coarse-assembly conclusion for its concrete separated union. -/ +theorem bounded_geometry_graph_counterexample_unconditional : + (∀ j, Finite (FiberVertex j) ∧ + (fiberedGraph elementaryMoves chosenHolonomyUnit j).Connected) ∧ + (∃ D : ℕ, ∀ j (x : FiberVertex j), + Nat.card {y // (fiberedGraph elementaryMoves chosenHolonomyUnit j).Adj x y} ≤ D) ∧ + ProperSpace VertexUnion ∧ UniformFiniteBalls VertexUnion ∧ + (∀ x y : VertexUnion, x ≠ y → 1 ≤ dist x y) ∧ + ∃ α : KX1 VertexUnion, + (∀ n : ℤ, n ≠ 0 → n • α ≠ 0) ∧ constructedCoarseAssembly α = 0 ∧ + (1 : ℚ) ⊗ₜ[ℤ] α ≠ 0 ∧ + ¬ Function.Injective constructedCoarseAssembly ∧ + ¬ Function.Injective (constructedCoarseAssembly.toIntLinearMap.lTensor ℚ) := by + refine ⟨?_, ?_, bounded_geometry_counterexample_unconditional⟩ + · intro j + exact ⟨inferInstance, fiberedGraph_connected elementaryMoves chosenHolonomyUnit j⟩ + · exact ⟨7 * (symmetricMoves elementaryMoves).card * 2 ^ 9, + fun _ x => card_fibered_neighbors_le elementaryMoves chosenHolonomyUnit x⟩ + +end CoarseAssembly + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UniformCycleNormalization.lean b/lean/OAI/Topology/CoarseAssembly/UniformCycleNormalization.lean index 1d271ef49d67fea08822292dbb9c608379bdc3e5..bc573a44deddeee05f1b56ebdbb4c4d6715d1b13 100644 --- a/lean/OAI/Topology/CoarseAssembly/UniformCycleNormalization.lean +++ b/lean/OAI/Topology/CoarseAssembly/UniformCycleNormalization.lean @@ -1,53 +1,53 @@ -import OAI.Topology.CoarseAssembly.SigmaCycle -import OAI.Topology.CoarseAssembly.RepresentedNormalization - -namespace OAI - -/-! # Uniformly bounded representatives for countable families -/ - -noncomputable section - -namespace CoarseAssembly.Analytic - -open scoped ZeroAtInfty - -theorem involution_norm_le_one {H : HilbertSpace} (F : End H) - (hself : IsSelfAdjoint F) (hsq : F * F = 1) : ‖F‖ ≤ 1 := by - have he : ‖F‖ ^ 2 = ‖(1 : End H)‖ := by - rw [← hself.norm_mul_self, hsq] - have hi : ‖(1 : End H)‖ ≤ 1 := ContinuousLinearMap.norm_id_le - nlinarith [norm_nonneg F] - -variable {A : Type} [CStarAlgebra A] - -def normalizedCycle (c : OddCycle A) : OddCycle A := - (exists_represented_involutive_representative c).choose - -theorem normalizedCycle_class (c : OddCycle A) : - cycleClass A (normalizedCycle c) = cycleClass A c := - (exists_represented_involutive_representative c).choose_spec.1 - -theorem normalizedCycle_selfAdjoint (c : OddCycle A) : - IsSelfAdjoint (normalizedCycle c).operator := - (exists_represented_involutive_representative c).choose_spec.2.1 - -theorem normalizedCycle_sq (c : OddCycle A) : - (normalizedCycle c).operator * (normalizedCycle c).operator = 1 := - (exists_represented_involutive_representative c).choose_spec.2.2.1 - -theorem normalizedCycle_norm (c : OddCycle A) : ‖(normalizedCycle c).operator‖ ≤ 1 := - involution_norm_le_one _ (normalizedCycle_selfAdjoint c) (normalizedCycle_sq c) - -variable (Y : ℕ → Type) [∀ j, TopologicalSpace (Y j)] [∀ j, CompactSpace (Y j)] - -/-- Actual locally finite cycle for an arbitrary countable family of compact-source cycles. -/ -def normalizedFamilyCycle (c : ∀ j, OddCycle C(Y j, ℂ)) : OddCycle C₀(Sigma Y, ℂ) := - sigmaCycle Y (fun j => normalizedCycle (c j)) 1 (by norm_num) - (fun j => normalizedCycle_norm (c j)) (fun j => normalizedCycle_selfAdjoint (c j)) - (fun j => normalizedCycle_sq (c j)) - -end CoarseAssembly.Analytic - -end - -end OAI +import OAI.Topology.CoarseAssembly.SigmaCycle +import OAI.Topology.CoarseAssembly.RepresentedNormalization + +namespace OAI + +/-! # Uniformly bounded representatives for countable families -/ + +noncomputable section + +namespace CoarseAssembly.Analytic + +open scoped ZeroAtInfty + +theorem involution_norm_le_one {H : HilbertSpace} (F : End H) + (hself : IsSelfAdjoint F) (hsq : F * F = 1) : ‖F‖ ≤ 1 := by + have he : ‖F‖ ^ 2 = ‖(1 : End H)‖ := by + rw [← hself.norm_mul_self, hsq] + have hi : ‖(1 : End H)‖ ≤ 1 := ContinuousLinearMap.norm_id_le + nlinarith [norm_nonneg F] + +variable {A : Type} [CStarAlgebra A] + +def normalizedCycle (c : OddCycle A) : OddCycle A := + (exists_represented_involutive_representative c).choose + +theorem normalizedCycle_class (c : OddCycle A) : + cycleClass A (normalizedCycle c) = cycleClass A c := + (exists_represented_involutive_representative c).choose_spec.1 + +theorem normalizedCycle_selfAdjoint (c : OddCycle A) : + IsSelfAdjoint (normalizedCycle c).operator := + (exists_represented_involutive_representative c).choose_spec.2.1 + +theorem normalizedCycle_sq (c : OddCycle A) : + (normalizedCycle c).operator * (normalizedCycle c).operator = 1 := + (exists_represented_involutive_representative c).choose_spec.2.2.1 + +theorem normalizedCycle_norm (c : OddCycle A) : ‖(normalizedCycle c).operator‖ ≤ 1 := + involution_norm_le_one _ (normalizedCycle_selfAdjoint c) (normalizedCycle_sq c) + +variable (Y : ℕ → Type) [∀ j, TopologicalSpace (Y j)] [∀ j, CompactSpace (Y j)] + +/-- Actual locally finite cycle for an arbitrary countable family of compact-source cycles. -/ +def normalizedFamilyCycle (c : ∀ j, OddCycle C(Y j, ℂ)) : OddCycle C₀(Sigma Y, ℂ) := + sigmaCycle Y (fun j => normalizedCycle (c j)) 1 (by norm_num) + (fun j => normalizedCycle_norm (c j)) (fun j => normalizedCycle_selfAdjoint (c j)) + (fun j => normalizedCycle_sq (c j)) + +end CoarseAssembly.Analytic + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UniformSubdivision.lean b/lean/OAI/Topology/CoarseAssembly/UniformSubdivision.lean index 96ccb76bc9115521bbbfee825832c8ec8055609d..ea94f845248495e03c8537d94a23505346ae1aa7 100644 --- a/lean/OAI/Topology/CoarseAssembly/UniformSubdivision.lean +++ b/lean/OAI/Topology/CoarseAssembly/UniformSubdivision.lean @@ -1,47 +1,47 @@ -import OAI.Topology.CoarseAssembly.FredholmModule -import Mathlib.Topology.UniformSpace.HeineCantor -import Mathlib.Algebra.Order.Archimedean.Real.Basic - -namespace OAI - -/-! # Finite subdivisions of an actual norm-continuous homotopy -/ - -noncomputable section - -namespace CoarseAssembly.Analytic - -def intervalGrid (N : ℕ) (hN : 0 < N) (j : ℕ) : Interval := - ⟨((min j N : ℕ) : ℝ) / N, div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _), - (div_le_one (Nat.cast_pos.mpr hN)).mpr (by exact_mod_cast Nat.min_le_right j N)⟩ - -@[simp] theorem intervalGrid_start (N : ℕ) (hN : 0 < N) : intervalGrid N hN 0 = start := by - apply Subtype.ext - simp [intervalGrid, start] - -@[simp] theorem intervalGrid_finish (N : ℕ) (hN : 0 < N) : intervalGrid N hN N = finish := by - apply Subtype.ext - simp [intervalGrid, finish, Nat.ne_of_gt hN] - -theorem intervalGrid_dist (N : ℕ) (hN : 0 < N) (j : ℕ) (hj : j < N) : - dist (intervalGrid N hN (j + 1)) (intervalGrid N hN j) = (N : ℝ)⁻¹ := by - change |((min (j + 1) N : ℕ) : ℝ) / N - ((min j N : ℕ) : ℝ) / N| = _ - rw [Nat.min_eq_left (Nat.succ_le_of_lt hj), Nat.min_eq_left hj.le, Nat.cast_succ] - have he : ((j : ℝ) + 1) / N - (j : ℝ) / N = 1 / N := by ring - rw [he, abs_of_nonneg (by positivity), one_div] - -theorem exists_interval_subdivision {E : Type*} [PseudoMetricSpace E] - (f : Interval → E) (hf : Continuous f) (ε : ℝ) (hε : 0 < ε) : - ∃ (N : ℕ) (hN : 0 < N), ∀ j, j < N → - dist (f (intervalGrid N hN (j + 1))) (f (intervalGrid N hN j)) < ε := by - obtain ⟨δ, hδ, hclose⟩ := Metric.uniformContinuous_iff.mp - (CompactSpace.uniformContinuous_of_continuous hf) ε hε - obtain ⟨N, hN, hn⟩ := Real.exists_nat_pos_inv_lt hδ - refine ⟨N, hN, fun j hj => hclose ?_⟩ - rw [intervalGrid_dist N hN j hj] - exact hn - -end CoarseAssembly.Analytic - -end - -end OAI +import OAI.Topology.CoarseAssembly.FredholmModule +import Mathlib.Topology.UniformSpace.HeineCantor +import Mathlib.Algebra.Order.Archimedean.Real.Basic + +namespace OAI + +/-! # Finite subdivisions of an actual norm-continuous homotopy -/ + +noncomputable section + +namespace CoarseAssembly.Analytic + +def intervalGrid (N : ℕ) (hN : 0 < N) (j : ℕ) : Interval := + ⟨((min j N : ℕ) : ℝ) / N, div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _), + (div_le_one (Nat.cast_pos.mpr hN)).mpr (by exact_mod_cast Nat.min_le_right j N)⟩ + +@[simp] theorem intervalGrid_start (N : ℕ) (hN : 0 < N) : intervalGrid N hN 0 = start := by + apply Subtype.ext + simp [intervalGrid, start] + +@[simp] theorem intervalGrid_finish (N : ℕ) (hN : 0 < N) : intervalGrid N hN N = finish := by + apply Subtype.ext + simp [intervalGrid, finish, Nat.ne_of_gt hN] + +theorem intervalGrid_dist (N : ℕ) (hN : 0 < N) (j : ℕ) (hj : j < N) : + dist (intervalGrid N hN (j + 1)) (intervalGrid N hN j) = (N : ℝ)⁻¹ := by + change |((min (j + 1) N : ℕ) : ℝ) / N - ((min j N : ℕ) : ℝ) / N| = _ + rw [Nat.min_eq_left (Nat.succ_le_of_lt hj), Nat.min_eq_left hj.le, Nat.cast_succ] + have he : ((j : ℝ) + 1) / N - (j : ℝ) / N = 1 / N := by ring + rw [he, abs_of_nonneg (by positivity), one_div] + +theorem exists_interval_subdivision {E : Type*} [PseudoMetricSpace E] + (f : Interval → E) (hf : Continuous f) (ε : ℝ) (hε : 0 < ε) : + ∃ (N : ℕ) (hN : 0 < N), ∀ j, j < N → + dist (f (intervalGrid N hN (j + 1))) (f (intervalGrid N hN j)) < ε := by + obtain ⟨δ, hδ, hclose⟩ := Metric.uniformContinuous_iff.mp + (CompactSpace.uniformContinuous_of_continuous hf) ε hε + obtain ⟨N, hN, hn⟩ := Real.exists_nat_pos_inv_lt hδ + refine ⟨N, hN, fun j hj => hclose ?_⟩ + rw [intervalGrid_dist N hN j hj] + exact hn + +end CoarseAssembly.Analytic + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UnitalCycleInvertible.lean b/lean/OAI/Topology/CoarseAssembly/UnitalCycleInvertible.lean index 435c9b640d462096a12d84ebaff7fe6fe5413a51..23f920c4fe3e05b195ffdfa9c7a77b6386ec6857 100644 --- a/lean/OAI/Topology/CoarseAssembly/UnitalCycleInvertible.lean +++ b/lean/OAI/Topology/CoarseAssembly/UnitalCycleInvertible.lean @@ -1,32 +1,32 @@ -import OAI.Topology.CoarseAssembly.FredholmInvertible - -namespace OAI - -/-! # Invertible self-adjoint representatives for unital odd cycles -/ - -noncomputable section - -namespace CoarseAssembly.Analytic - -variable {A : Type} [CStarAlgebra A] - -theorem exists_invertible_selfAdjoint_representative (c : OddCycle A) - (hunital : c.representation 1 = 1) : - ∃ d : OddCycle A, cycleClass A d = cycleClass A c ∧ - d.representation 1 = 1 ∧ IsSelfAdjoint d.operator ∧ IsUnit d.operator := by - obtain ⟨d, hdc, hdunit, hdself⟩ := exists_selfAdjoint_representative c hunital - have hc : IsCompactOperator (d.operator * d.operator - 1 : End d.space) := by - simpa only [hdunit, mul_one] using d.square_compact 1 - have hp := kernelProjection_compact d.operator hc - have hps : IsCompactOperator (star (kernelProjection d.operator) : End d.space) := by - rw [(kernelProjection_selfAdjoint d.operator).star_eq] - exact hp - refine ⟨d.compactPerturb (kernelProjection d.operator) hp hps, - (compactPerturb_class d _ hp hps).trans hdc, hdunit, - kernel_corrected_selfAdjoint d.operator hdself, kernel_corrected_isUnit d.operator hdself hc⟩ - -end CoarseAssembly.Analytic - -end - -end OAI +import OAI.Topology.CoarseAssembly.FredholmInvertible + +namespace OAI + +/-! # Invertible self-adjoint representatives for unital odd cycles -/ + +noncomputable section + +namespace CoarseAssembly.Analytic + +variable {A : Type} [CStarAlgebra A] + +theorem exists_invertible_selfAdjoint_representative (c : OddCycle A) + (hunital : c.representation 1 = 1) : + ∃ d : OddCycle A, cycleClass A d = cycleClass A c ∧ + d.representation 1 = 1 ∧ IsSelfAdjoint d.operator ∧ IsUnit d.operator := by + obtain ⟨d, hdc, hdunit, hdself⟩ := exists_selfAdjoint_representative c hunital + have hc : IsCompactOperator (d.operator * d.operator - 1 : End d.space) := by + simpa only [hdunit, mul_one] using d.square_compact 1 + have hp := kernelProjection_compact d.operator hc + have hps : IsCompactOperator (star (kernelProjection d.operator) : End d.space) := by + rw [(kernelProjection_selfAdjoint d.operator).star_eq] + exact hp + refine ⟨d.compactPerturb (kernelProjection d.operator) hp hps, + (compactPerturb_class d _ hp hps).trans hdc, hdunit, + kernel_corrected_selfAdjoint d.operator hdself, kernel_corrected_isUnit d.operator hdself hc⟩ + +end CoarseAssembly.Analytic + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UnitalCycleNormalization.lean b/lean/OAI/Topology/CoarseAssembly/UnitalCycleNormalization.lean index 8daa25c9acb9c1a9d34edd5f14f02e362b4eb1eb..5851cb926f3e3f051e1f0f3cab4abc18e6a19762 100644 --- a/lean/OAI/Topology/CoarseAssembly/UnitalCycleNormalization.lean +++ b/lean/OAI/Topology/CoarseAssembly/UnitalCycleNormalization.lean @@ -1,43 +1,43 @@ -import OAI.Topology.CoarseAssembly.CycleCompactPerturbation -import Mathlib.Tactic.Module - -namespace OAI - -/-! # Self-adjoint normalization of a unital Fredholm cycle - -The compact adjoint defect allows replacement of the operator by its -self-adjoint part, with the represented algebra and K-homology class fixed. --/ - -noncomputable section - -namespace CoarseAssembly.Analytic - -variable {A : Type} [CStarAlgebra A] - -theorem exists_selfAdjoint_representative (c : OddCycle A) - (hunital : c.representation 1 = 1) : - ∃ d : OddCycle A, cycleClass A d = cycleClass A c ∧ - d.representation 1 = 1 ∧ IsSelfAdjoint d.operator := by - let K : End c.space := (1 / 2 : ℝ) • (star c.operator - c.operator) - have hdefect : IsCompactOperator (star c.operator - c.operator : End c.space) := by - simpa only [hunital, mul_one] using c.adjoint_compact 1 - have hK : IsCompactOperator K := hdefect.smul (1 / 2 : ℝ) - have hstar : star K = -K := by - dsimp only [K] - rw [star_smul, star_trivial, star_sub, star_star] - module - have hKs : IsCompactOperator (star K : End c.space) := by - rw [hstar] - exact hK.neg - refine ⟨c.compactPerturb K hK hKs, compactPerturb_class c K hK hKs, hunital, ?_⟩ - change star (c.operator + K) = c.operator + K - rw [star_add, hstar] - dsimp only [K] - module - -end CoarseAssembly.Analytic - -end - -end OAI +import OAI.Topology.CoarseAssembly.CycleCompactPerturbation +import Mathlib.Tactic.Module + +namespace OAI + +/-! # Self-adjoint normalization of a unital Fredholm cycle + +The compact adjoint defect allows replacement of the operator by its +self-adjoint part, with the represented algebra and K-homology class fixed. +-/ + +noncomputable section + +namespace CoarseAssembly.Analytic + +variable {A : Type} [CStarAlgebra A] + +theorem exists_selfAdjoint_representative (c : OddCycle A) + (hunital : c.representation 1 = 1) : + ∃ d : OddCycle A, cycleClass A d = cycleClass A c ∧ + d.representation 1 = 1 ∧ IsSelfAdjoint d.operator := by + let K : End c.space := (1 / 2 : ℝ) • (star c.operator - c.operator) + have hdefect : IsCompactOperator (star c.operator - c.operator : End c.space) := by + simpa only [hunital, mul_one] using c.adjoint_compact 1 + have hK : IsCompactOperator K := hdefect.smul (1 / 2 : ℝ) + have hstar : star K = -K := by + dsimp only [K] + rw [star_smul, star_trivial, star_sub, star_star] + module + have hKs : IsCompactOperator (star K : End c.space) := by + rw [hstar] + exact hK.neg + refine ⟨c.compactPerturb K hK hKs, compactPerturb_class c K hK hKs, hunital, ?_⟩ + change star (c.operator + K) = c.operator + K + rw [star_add, hstar] + dsimp only [K] + module + +end CoarseAssembly.Analytic + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UnitalRepresentative.lean b/lean/OAI/Topology/CoarseAssembly/UnitalRepresentative.lean index 3272402da310870948a9a0d89d03f7247025be0f..ae30089cf29d258775b36e0c604fcf704c9bde1f 100644 --- a/lean/OAI/Topology/CoarseAssembly/UnitalRepresentative.lean +++ b/lean/OAI/Topology/CoarseAssembly/UnitalRepresentative.lean @@ -1,130 +1,130 @@ -import OAI.Topology.CoarseAssembly.BinaryCycle -import OAI.Topology.CoarseAssembly.CharacterExtension -import OAI.Topology.CoarseAssembly.ProjectionSwap -import OAI.Topology.CoarseAssembly.UniformCycleNormalization - -namespace OAI - -/-! # Unital representatives for compact-source analytic classes - -Adjoin a degenerate character cycle and exchange the complementary -subspaces by the explicit projection-swap unitary. This proves that -completion of a representation by a character preserves its class. --/ - -noncomputable section - -namespace CoarseAssembly.Analytic - -variable {H : HilbertSpace} - -theorem projectionSwap_representation (P R : End H) (hP : IsStarProjection P) - (hPR : P * R = R) (hRP : R * P = R) (z : ℂ) : - binaryBlock H H (R + z • (1 - P)) (z • P) = - operatorConjugation (projectionSwapUnitary H P hP).toLinearIsometry - (binaryBlock H H R (z • 1)) := by - rw [projectionSwapUnitary_conjugation] - have hu := projectionSwap_sq H P hP.isIdempotentElem - suffices hi : binaryBlock H H (R + z • (1 - P)) (z • P) * projectionSwap H P = - projectionSwap H P * binaryBlock H H R (z • 1) by - have hi' := congrArg (fun T => T * projectionSwap H P) hi - simpa only [mul_assoc, hu, mul_one] using hi' - apply ContinuousLinearMap.ext - intro x - change binaryBlock H H (R + z • (1 - P)) (z • P) (projectionSwap H P x) = - projectionSwap H P (binaryBlock H H R (z • 1) x) - rw [projectionSwap_apply H, binaryBlock_apply H H, binaryBlock_apply H H, - projectionSwap_apply H] - apply (WithLp.ofLp_injective 2) - have hp (y : H) : P (P y) = P y := DFunLike.congr_fun hP.isIdempotentElem y - have hpr (y : H) : P (R y) = R y := DFunLike.congr_fun hPR y - have hrp (y : H) : R (P y) = R y := DFunLike.congr_fun hRP y - change - ((R + z • (1 - P)) (P x.fst + (1 - P) x.snd), - (z • P) ((1 - P) x.fst + P x.snd)) = - (P (R x.fst) + (1 - P) ((z • (1 : End H)) x.snd), - (1 - P) (R x.fst) + P ((z • (1 : End H)) x.snd)) - simp only [add_apply, smul_apply, sub_apply, one_apply_eq_self, map_add, map_sub, - map_smul, hp, hpr, hrp] - ext <;> module - -theorem projectionSwap_operator (P F : End H) (hP : IsStarProjection P) - (hF : IsSelfAdjoint F) (hQ : F * (1 - P) = 1 - P) : - binaryBlock H H F 1 = - operatorConjugation (projectionSwapUnitary H P hP).toLinearIsometry - (binaryBlock H H F 1) := by - rw [projectionSwapUnitary_conjugation] - have hu := projectionSwap_sq H P hP.isIdempotentElem - have hc := (commute_of_complement F P hF hP.isSelfAdjoint hQ).eq - have hQ' : (1 - P) * F = 1 - P := by - have h := congrArg star hQ - simpa only [star_mul, star_sub, star_one, hP.isSelfAdjoint.star_eq, hF.star_eq] using h - suffices hi : binaryBlock H H F 1 * projectionSwap H P = - projectionSwap H P * binaryBlock H H F 1 by - have hi' := congrArg (fun T => T * projectionSwap H P) hi - simpa only [mul_assoc, hu, mul_one] using hi' - apply ContinuousLinearMap.ext - intro x - change binaryBlock H H F 1 (projectionSwap H P x) = - projectionSwap H P (binaryBlock H H F 1 x) - rw [projectionSwap_apply H, binaryBlock_apply H H, binaryBlock_apply H H, - projectionSwap_apply H] - apply (WithLp.ofLp_injective 2) - have hfp (y : H) : F (P y) = P (F y) := DFunLike.congr_fun hc y - have hfq (y : H) : F ((1 - P) y) = (1 - P) y := DFunLike.congr_fun hQ y - have hqf (y : H) : (1 - P) (F y) = (1 - P) y := DFunLike.congr_fun hQ' y - change (F (P x.fst + (1 - P) x.snd), (1 - P) x.fst + P x.snd) = - (P (F x.fst) + (1 - P) x.snd, (1 - P) (F x.fst) + P x.snd) - rw [map_add, hfp, hfq, hqf] - -variable {A : Type} [CStarAlgebra A] - -theorem characterExtension_class (c : OddCycle A) (χ : A →⋆ₐ[ℂ] ℂ) - (hF : IsSelfAdjoint c.operator) - (hQ : c.operator * (1 - c.representation 1) = 1 - c.representation 1) - (hsq : IsCompactOperator (c.operator * c.operator - 1 : End c.space)) : - cycleClass A (c.characterExtension χ hF hQ hsq) = cycleClass A c := by - let d := identityOperatorCycle - (characterProjectionRepresentation χ (1 : End c.space) (IsStarProjection.one _)) - let e := identityOperatorCycle - (characterProjectionRepresentation χ (c.representation 1) (representation_unit_projection c)) - have he : (c.binarySum d).UnitaryEquivalent - ((c.characterExtension χ hF hQ hsq).binarySum e) := by - refine ⟨projectionSwapUnitary c.space (c.representation 1) (representation_unit_projection c), - ?_, ?_⟩ - · intro a - change binaryBlock c.space c.space - (c.representation a + χ a • (1 - c.representation 1)) (χ a • c.representation 1) = _ - exact projectionSwap_representation _ _ (representation_unit_projection c) - (by rw [← map_mul, one_mul]) (by rw [← map_mul, mul_one]) (χ a) - · exact projectionSwap_operator _ _ (representation_unit_projection c) hF hQ - have h := unitary_eq _ _ he - rw [binarySum_class, binarySum_class, - degenerate_zero d (identityOperatorCycle_degenerate _), - degenerate_zero e (identityOperatorCycle_degenerate _), add_zero, add_zero] at h - exact h.symm - -/-- Every analytic cycle over an algebra with a character has a unital -representative. The assertion includes equality in the actual cycle quotient. -/ -theorem exists_unital_representative (c : OddCycle A) (χ : A →⋆ₐ[ℂ] ℂ) : - ∃ d : OddCycle A, cycleClass A d = cycleClass A c ∧ d.representation 1 = 1 := by - let d := c.cutDown - let e := d.characterExtension χ (cutDown_selfAdjoint c) (cutDown_complement c) - (cutDown_square_compact c) - refine ⟨e, ?_, characterExtension_unital d χ _ _ _⟩ - exact (characterExtension_class d χ _ _ _).trans (cutDown_class c) - -/-- The representatives needed by whole-family Rips localization can be -chosen unital, self-adjoint, involutive, and uniformly bounded by one. -/ -theorem exists_unital_involutive_representative (c : OddCycle A) (χ : A →⋆ₐ[ℂ] ℂ) : - ∃ d : OddCycle A, cycleClass A d = cycleClass A c ∧ d.representation 1 = 1 ∧ - IsSelfAdjoint d.operator ∧ d.operator * d.operator = 1 ∧ ‖d.operator‖ ≤ 1 := by - obtain ⟨d, hdc, hdu⟩ := exists_unital_representative c χ - obtain ⟨e, hed, heu, hes, heq⟩ := exists_involutive_representative d hdu - exact ⟨e, hed.trans hdc, heu, hes, heq, involution_norm_le_one _ hes heq⟩ - -end CoarseAssembly.Analytic - -end - -end OAI +import OAI.Topology.CoarseAssembly.BinaryCycle +import OAI.Topology.CoarseAssembly.CharacterExtension +import OAI.Topology.CoarseAssembly.ProjectionSwap +import OAI.Topology.CoarseAssembly.UniformCycleNormalization + +namespace OAI + +/-! # Unital representatives for compact-source analytic classes + +Adjoin a degenerate character cycle and exchange the complementary +subspaces by the explicit projection-swap unitary. This proves that +completion of a representation by a character preserves its class. +-/ + +noncomputable section + +namespace CoarseAssembly.Analytic + +variable {H : HilbertSpace} + +theorem projectionSwap_representation (P R : End H) (hP : IsStarProjection P) + (hPR : P * R = R) (hRP : R * P = R) (z : ℂ) : + binaryBlock H H (R + z • (1 - P)) (z • P) = + operatorConjugation (projectionSwapUnitary H P hP).toLinearIsometry + (binaryBlock H H R (z • 1)) := by + rw [projectionSwapUnitary_conjugation] + have hu := projectionSwap_sq H P hP.isIdempotentElem + suffices hi : binaryBlock H H (R + z • (1 - P)) (z • P) * projectionSwap H P = + projectionSwap H P * binaryBlock H H R (z • 1) by + have hi' := congrArg (fun T => T * projectionSwap H P) hi + simpa only [mul_assoc, hu, mul_one] using hi' + apply ContinuousLinearMap.ext + intro x + change binaryBlock H H (R + z • (1 - P)) (z • P) (projectionSwap H P x) = + projectionSwap H P (binaryBlock H H R (z • 1) x) + rw [projectionSwap_apply H, binaryBlock_apply H H, binaryBlock_apply H H, + projectionSwap_apply H] + apply (WithLp.ofLp_injective 2) + have hp (y : H) : P (P y) = P y := DFunLike.congr_fun hP.isIdempotentElem y + have hpr (y : H) : P (R y) = R y := DFunLike.congr_fun hPR y + have hrp (y : H) : R (P y) = R y := DFunLike.congr_fun hRP y + change + ((R + z • (1 - P)) (P x.fst + (1 - P) x.snd), + (z • P) ((1 - P) x.fst + P x.snd)) = + (P (R x.fst) + (1 - P) ((z • (1 : End H)) x.snd), + (1 - P) (R x.fst) + P ((z • (1 : End H)) x.snd)) + simp only [add_apply, smul_apply, sub_apply, one_apply_eq_self, map_add, map_sub, + map_smul, hp, hpr, hrp] + ext <;> module + +theorem projectionSwap_operator (P F : End H) (hP : IsStarProjection P) + (hF : IsSelfAdjoint F) (hQ : F * (1 - P) = 1 - P) : + binaryBlock H H F 1 = + operatorConjugation (projectionSwapUnitary H P hP).toLinearIsometry + (binaryBlock H H F 1) := by + rw [projectionSwapUnitary_conjugation] + have hu := projectionSwap_sq H P hP.isIdempotentElem + have hc := (commute_of_complement F P hF hP.isSelfAdjoint hQ).eq + have hQ' : (1 - P) * F = 1 - P := by + have h := congrArg star hQ + simpa only [star_mul, star_sub, star_one, hP.isSelfAdjoint.star_eq, hF.star_eq] using h + suffices hi : binaryBlock H H F 1 * projectionSwap H P = + projectionSwap H P * binaryBlock H H F 1 by + have hi' := congrArg (fun T => T * projectionSwap H P) hi + simpa only [mul_assoc, hu, mul_one] using hi' + apply ContinuousLinearMap.ext + intro x + change binaryBlock H H F 1 (projectionSwap H P x) = + projectionSwap H P (binaryBlock H H F 1 x) + rw [projectionSwap_apply H, binaryBlock_apply H H, binaryBlock_apply H H, + projectionSwap_apply H] + apply (WithLp.ofLp_injective 2) + have hfp (y : H) : F (P y) = P (F y) := DFunLike.congr_fun hc y + have hfq (y : H) : F ((1 - P) y) = (1 - P) y := DFunLike.congr_fun hQ y + have hqf (y : H) : (1 - P) (F y) = (1 - P) y := DFunLike.congr_fun hQ' y + change (F (P x.fst + (1 - P) x.snd), (1 - P) x.fst + P x.snd) = + (P (F x.fst) + (1 - P) x.snd, (1 - P) (F x.fst) + P x.snd) + rw [map_add, hfp, hfq, hqf] + +variable {A : Type} [CStarAlgebra A] + +theorem characterExtension_class (c : OddCycle A) (χ : A →⋆ₐ[ℂ] ℂ) + (hF : IsSelfAdjoint c.operator) + (hQ : c.operator * (1 - c.representation 1) = 1 - c.representation 1) + (hsq : IsCompactOperator (c.operator * c.operator - 1 : End c.space)) : + cycleClass A (c.characterExtension χ hF hQ hsq) = cycleClass A c := by + let d := identityOperatorCycle + (characterProjectionRepresentation χ (1 : End c.space) (IsStarProjection.one _)) + let e := identityOperatorCycle + (characterProjectionRepresentation χ (c.representation 1) (representation_unit_projection c)) + have he : (c.binarySum d).UnitaryEquivalent + ((c.characterExtension χ hF hQ hsq).binarySum e) := by + refine ⟨projectionSwapUnitary c.space (c.representation 1) (representation_unit_projection c), + ?_, ?_⟩ + · intro a + change binaryBlock c.space c.space + (c.representation a + χ a • (1 - c.representation 1)) (χ a • c.representation 1) = _ + exact projectionSwap_representation _ _ (representation_unit_projection c) + (by rw [← map_mul, one_mul]) (by rw [← map_mul, mul_one]) (χ a) + · exact projectionSwap_operator _ _ (representation_unit_projection c) hF hQ + have h := unitary_eq _ _ he + rw [binarySum_class, binarySum_class, + degenerate_zero d (identityOperatorCycle_degenerate _), + degenerate_zero e (identityOperatorCycle_degenerate _), add_zero, add_zero] at h + exact h.symm + +/-- Every analytic cycle over an algebra with a character has a unital +representative. The assertion includes equality in the actual cycle quotient. -/ +theorem exists_unital_representative (c : OddCycle A) (χ : A →⋆ₐ[ℂ] ℂ) : + ∃ d : OddCycle A, cycleClass A d = cycleClass A c ∧ d.representation 1 = 1 := by + let d := c.cutDown + let e := d.characterExtension χ (cutDown_selfAdjoint c) (cutDown_complement c) + (cutDown_square_compact c) + refine ⟨e, ?_, characterExtension_unital d χ _ _ _⟩ + exact (characterExtension_class d χ _ _ _).trans (cutDown_class c) + +/-- The representatives needed by whole-family Rips localization can be +chosen unital, self-adjoint, involutive, and uniformly bounded by one. -/ +theorem exists_unital_involutive_representative (c : OddCycle A) (χ : A →⋆ₐ[ℂ] ℂ) : + ∃ d : OddCycle A, cycleClass A d = cycleClass A c ∧ d.representation 1 = 1 ∧ + IsSelfAdjoint d.operator ∧ d.operator * d.operator = 1 ∧ ‖d.operator‖ ≤ 1 := by + obtain ⟨d, hdc, hdu⟩ := exists_unital_representative c χ + obtain ⟨e, hed, heu, hes, heq⟩ := exists_involutive_representative d hdu + exact ⟨e, hed.trans hdc, heu, hes, heq, involution_norm_le_one _ hes heq⟩ + +end CoarseAssembly.Analytic + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UnitalStructureAlgebra.lean b/lean/OAI/Topology/CoarseAssembly/UnitalStructureAlgebra.lean index 530a1987058dd2713e56982ef2f4bdbbad903f86..6080722e268770ad997a029eae0e54ef5ca359c4 100644 --- a/lean/OAI/Topology/CoarseAssembly/UnitalStructureAlgebra.lean +++ b/lean/OAI/Topology/CoarseAssembly/UnitalStructureAlgebra.lean @@ -1,66 +1,66 @@ -import OAI.Topology.CoarseAssembly.StructureQuotient -import Mathlib.Analysis.CStarAlgebra.Spectrum - -namespace OAI - -/-! # The unit of the controlled pseudolocal algebra -/ - -noncomputable section - -namespace CoarseAssembly.DiscreteRoe - -variable {X H : Type*} [DecidableEq X] [PseudoMetricSpace X] - [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] - -local instance : IsScalarTower ℂ (Operator X H) (Operator X H) where - smul_assoc c T S := by ext v; simp -local instance : SMulCommClass ℂ (Operator X H) (Operator X H) where - smul_comm c T S := by ext v; simp -local instance : ContinuousStar (Operator X H) := ⟨operator_star_continuous⟩ - -omit [CompleteSpace H] in -theorem propagationLE_one : PropagationLE 0 (1 : Operator X H) := by - intro x y hxy - have hne : x ≠ y := by intro h; simp [h] at hxy - ext v - simp [entry_apply, lp.single_apply, hne] - -theorem structureGenerator_one : StructureGenerator (1 : Operator X H) := by - refine ⟨⟨0, le_rfl, propagationLE_one⟩, ?_, ?_⟩ - · intro f - simp only [one_mul, mul_one, sub_self] - exact isCompactOperator_zero - · rw [star_one (Operator X H)] - intro f - simp only [one_mul, mul_one, sub_self] - exact isCompactOperator_zero - -theorem structureAlgebra_one : (1 : Operator X H) ∈ structureAlgebra (X := X) (H := H) := - (NonUnitalStarSubalgebra.le_topologicalClosure _) - (NonUnitalStarAlgebra.subset_adjoin ℂ _ (structureGenerator_one (X := X) (H := H))) - -/-- The controlled structure algebra with its actual identity operator. -/ -def unitalStructureAlgebra : StarSubalgebra ℂ (Operator X H) where - carrier := structureAlgebra (X := X) (H := H) - add_mem' := (structureAlgebra (X := X) (H := H)).add_mem - mul_mem' := (structureAlgebra (X := X) (H := H)).mul_mem - star_mem' := fun h => star_mem h - algebraMap_mem' z := by - rw [Algebra.algebraMap_eq_smul_one] - exact (structureAlgebra (X := X) (H := H)).smul_mem z structureAlgebra_one - -theorem unitalStructureAlgebra_closed : - IsClosed (unitalStructureAlgebra (X := X) (H := H) : Set (Operator X H)) := - NonUnitalStarSubalgebra.isClosed_topologicalClosure _ - -instance : CompleteSpace (unitalStructureAlgebra (X := X) (H := H)) := - unitalStructureAlgebra_closed.completeSpace_coe - -instance : CStarAlgebra (unitalStructureAlgebra (X := X) (H := H)) := - StarSubalgebra.cstarAlgebra _ (h_closed := unitalStructureAlgebra_closed) - -end CoarseAssembly.DiscreteRoe - -end - -end OAI +import OAI.Topology.CoarseAssembly.StructureQuotient +import Mathlib.Analysis.CStarAlgebra.Spectrum + +namespace OAI + +/-! # The unit of the controlled pseudolocal algebra -/ + +noncomputable section + +namespace CoarseAssembly.DiscreteRoe + +variable {X H : Type*} [DecidableEq X] [PseudoMetricSpace X] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance : IsScalarTower ℂ (Operator X H) (Operator X H) where + smul_assoc c T S := by ext v; simp +local instance : SMulCommClass ℂ (Operator X H) (Operator X H) where + smul_comm c T S := by ext v; simp +local instance : ContinuousStar (Operator X H) := ⟨operator_star_continuous⟩ + +omit [CompleteSpace H] in +theorem propagationLE_one : PropagationLE 0 (1 : Operator X H) := by + intro x y hxy + have hne : x ≠ y := by intro h; simp [h] at hxy + ext v + simp [entry_apply, lp.single_apply, hne] + +theorem structureGenerator_one : StructureGenerator (1 : Operator X H) := by + refine ⟨⟨0, le_rfl, propagationLE_one⟩, ?_, ?_⟩ + · intro f + simp only [one_mul, mul_one, sub_self] + exact isCompactOperator_zero + · rw [star_one (Operator X H)] + intro f + simp only [one_mul, mul_one, sub_self] + exact isCompactOperator_zero + +theorem structureAlgebra_one : (1 : Operator X H) ∈ structureAlgebra (X := X) (H := H) := + (NonUnitalStarSubalgebra.le_topologicalClosure _) + (NonUnitalStarAlgebra.subset_adjoin ℂ _ (structureGenerator_one (X := X) (H := H))) + +/-- The controlled structure algebra with its actual identity operator. -/ +def unitalStructureAlgebra : StarSubalgebra ℂ (Operator X H) where + carrier := structureAlgebra (X := X) (H := H) + add_mem' := (structureAlgebra (X := X) (H := H)).add_mem + mul_mem' := (structureAlgebra (X := X) (H := H)).mul_mem + star_mem' := fun h => star_mem h + algebraMap_mem' z := by + rw [Algebra.algebraMap_eq_smul_one] + exact (structureAlgebra (X := X) (H := H)).smul_mem z structureAlgebra_one + +theorem unitalStructureAlgebra_closed : + IsClosed (unitalStructureAlgebra (X := X) (H := H) : Set (Operator X H)) := + NonUnitalStarSubalgebra.isClosed_topologicalClosure _ + +instance : CompleteSpace (unitalStructureAlgebra (X := X) (H := H)) := + unitalStructureAlgebra_closed.completeSpace_coe + +instance : CStarAlgebra (unitalStructureAlgebra (X := X) (H := H)) := + StarSubalgebra.cstarAlgebra _ (h_closed := unitalStructureAlgebra_closed) + +end CoarseAssembly.DiscreteRoe + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UnitaryHomotopyIndex.lean b/lean/OAI/Topology/CoarseAssembly/UnitaryHomotopyIndex.lean index 05bb0edb667e94e0d5f2adeff8b63ca3588a6af3..fb7aa5cbd1d33cad888d6d1e7cbacfe85ebd31dc 100644 --- a/lean/OAI/Topology/CoarseAssembly/UnitaryHomotopyIndex.lean +++ b/lean/OAI/Topology/CoarseAssembly/UnitaryHomotopyIndex.lean @@ -1,59 +1,59 @@ -import OAI.Topology.CoarseAssembly.CompactIndexPairing - -namespace OAI - -/-! # Homotopy invariance in the unitary argument of the index pairing -/ - -noncomputable section - -namespace CoarseAssembly.Analytic - -open scoped CStarAlgebra - -variable {A : Type} [CStarAlgebra A] - -theorem rawCycleIndex_unitaryHomotopy (c : OddCycle A) (u : Interval → A) - (hu : Continuous u) (hul : ∀ t, star (u t) * u t = 1) - (hur : ∀ t, u t * star (u t) = 1) : - rawCycleIndex c (u start) = rawCycleIndex c (u finish) := by - apply fredholmIndex_homotopy (fun t => rawCycleToeplitz c (u t)) - · have hrep : Continuous (fun t => c.representation (u t)) := (map_continuous c.representation).comp hu - have hext : Continuous (fun t => unitaryExtension c (u t)) := hrep.add continuous_const - exact ((continuous_const.mul hext).mul continuous_const).add continuous_const - · intro t - exact rawCycleToeplitz_fredholm c (u t) (hul t) (hur t) - -theorem indexPairing_unitaryHomotopy (u : Interval → A) (hu : Continuous u) - (hul : ∀ t, star (u t) * u t = 1) (hur : ∀ t, u t * star (u t) = 1) : - indexPairing (u start) (hul start) (hur start) = - indexPairing (u finish) (hul finish) (hur finish) := by - apply hom_ext - intro c - simp only [indexPairing_cycleClass] - exact rawCycleIndex_unitaryHomotopy c u hu hul hur - -open scoped ZeroAtInfty - -variable {X : Type} [TopologicalSpace X] [CompactSpace X] - -theorem compactIndexPairing_homotopy {f g : C(X, Circle)} (F : f.Homotopy g) : - compactIndexPairing f = compactIndexPairing g := by - let u : Interval → C(X, ℂ) := fun t => compactUnitary (homotopySlice F t) - have hu : Continuous u := by - let coeCircle : C(Circle, ℂ) := ⟨fun z => (z : ℂ), continuous_subtype_val⟩ - exact (ContinuousMap.continuous_postcomp coeCircle).comp F.toContinuousMap.curry.continuous - have hul (t : Interval) : star (u t) * u t = 1 := compactUnitary_star_mul _ - have hur (t : Interval) : u t * star (u t) = 1 := compactUnitary_mul_star _ - have hi := indexPairing_unitaryHomotopy u hu hul hur - have he : indexPairing (compactUnitary f) (compactUnitary_star_mul f) - (compactUnitary_mul_star f) = indexPairing (compactUnitary g) - (compactUnitary_star_mul g) (compactUnitary_mul_star g) := by - simpa only [u, homotopySlice_start, homotopySlice_finish] using hi - unfold compactIndexPairing - rw [he] - -end CoarseAssembly.Analytic - -end - -end OAI +import OAI.Topology.CoarseAssembly.CompactIndexPairing + +namespace OAI + +/-! # Homotopy invariance in the unitary argument of the index pairing -/ + +noncomputable section + +namespace CoarseAssembly.Analytic + +open scoped CStarAlgebra + +variable {A : Type} [CStarAlgebra A] + +theorem rawCycleIndex_unitaryHomotopy (c : OddCycle A) (u : Interval → A) + (hu : Continuous u) (hul : ∀ t, star (u t) * u t = 1) + (hur : ∀ t, u t * star (u t) = 1) : + rawCycleIndex c (u start) = rawCycleIndex c (u finish) := by + apply fredholmIndex_homotopy (fun t => rawCycleToeplitz c (u t)) + · have hrep : Continuous (fun t => c.representation (u t)) := (map_continuous c.representation).comp hu + have hext : Continuous (fun t => unitaryExtension c (u t)) := hrep.add continuous_const + exact ((continuous_const.mul hext).mul continuous_const).add continuous_const + · intro t + exact rawCycleToeplitz_fredholm c (u t) (hul t) (hur t) + +theorem indexPairing_unitaryHomotopy (u : Interval → A) (hu : Continuous u) + (hul : ∀ t, star (u t) * u t = 1) (hur : ∀ t, u t * star (u t) = 1) : + indexPairing (u start) (hul start) (hur start) = + indexPairing (u finish) (hul finish) (hur finish) := by + apply hom_ext + intro c + simp only [indexPairing_cycleClass] + exact rawCycleIndex_unitaryHomotopy c u hu hul hur + +open scoped ZeroAtInfty + +variable {X : Type} [TopologicalSpace X] [CompactSpace X] + +theorem compactIndexPairing_homotopy {f g : C(X, Circle)} (F : f.Homotopy g) : + compactIndexPairing f = compactIndexPairing g := by + let u : Interval → C(X, ℂ) := fun t => compactUnitary (homotopySlice F t) + have hu : Continuous u := by + let coeCircle : C(Circle, ℂ) := ⟨fun z => (z : ℂ), continuous_subtype_val⟩ + exact (ContinuousMap.continuous_postcomp coeCircle).comp F.toContinuousMap.curry.continuous + have hul (t : Interval) : star (u t) * u t = 1 := compactUnitary_star_mul _ + have hur (t : Interval) : u t * star (u t) = 1 := compactUnitary_mul_star _ + have hi := indexPairing_unitaryHomotopy u hu hul hur + have he : indexPairing (compactUnitary f) (compactUnitary_star_mul f) + (compactUnitary_mul_star f) = indexPairing (compactUnitary g) + (compactUnitary_star_mul g) (compactUnitary_mul_star g) := by + simpa only [u, homotopySlice_start, homotopySlice_finish] using hi + unfold compactIndexPairing + rw [he] + +end CoarseAssembly.Analytic + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UnitaryIndex.lean b/lean/OAI/Topology/CoarseAssembly/UnitaryIndex.lean index 7ab4cc8fca4c7aded5160bd60af5fe74bfb9e69b..4c37b9528eb8a5633d3a8bc9366ab9fcd71332a3 100644 --- a/lean/OAI/Topology/CoarseAssembly/UnitaryIndex.lean +++ b/lean/OAI/Topology/CoarseAssembly/UnitaryIndex.lean @@ -1,76 +1,76 @@ -import OAI.Topology.CoarseAssembly.DegenerateCutDown - -namespace OAI - -/-! # Unitary invariance of the explicit cycle index -/ - -noncomputable section - -namespace CoarseAssembly.Analytic - -variable {H K : HilbertSpace} - -theorem operatorConjugation_equiv (e : H ≃ₗᵢ[ℂ] K) (T : End H) : - operatorConjugation e.toLinearIsometry T = e.conjStarAlgEquiv T := by - have he : e.toLinearIsometry.toContinuousLinearMap.adjoint = - (e.symm : K →L[ℂ] H) := e.adjoint_eq_symm - ext x - change e (T (e.toLinearIsometry.toContinuousLinearMap.adjoint x)) = e (T (e.symm x)) - rw [he] - rfl - -theorem symmetricCutDown_map (φ : End H →⋆ₐ[ℂ] End K) (P F : End H) : - φ (symmetricCutDown P F) = symmetricCutDown (φ P) (φ F) := by - have hs (r : ℝ) (T : End H) : φ (r • T) = r • φ T := φ.toAlgHom.map_smul_of_tower r T - unfold symmetricCutDown - rw [map_add, hs, map_add, map_star, - map_mul, map_mul, map_sub, map_one] - -theorem positiveProjection_map (φ : End H →⋆ₐ[ℂ] End K) (F : End H) : - φ (positiveProjection F) = positiveProjection (φ F) := by - have hs (r : ℝ) (T : End H) : φ (r • T) = r • φ T := φ.toAlgHom.map_smul_of_tower r T - unfold positiveProjection - rw [hs, map_add, map_one] - -theorem toeplitzCompression_map (φ : End H →⋆ₐ[ℂ] End K) (P U : End H) : - φ (toeplitzCompression P U) = toeplitzCompression (φ P) (φ U) := by - simp only [toeplitzCompression, map_add, map_mul, map_sub, map_one] - -theorem fredholmIndex_conjugation (e : H ≃ₗᵢ[ℂ] K) (T : End H) (hT : T.IsFredholm) : - (e.conjStarAlgEquiv T).toLinearMap.index = T.toLinearMap.index := by - have he := e.toContinuousLinearEquiv.isFredholm - have hei := e.symm.toContinuousLinearEquiv.isFredholm - have hz : (e.toContinuousLinearEquiv : H →L[ℂ] K).toLinearMap.index = 0 := - LinearMap.index_of_bijective e.bijective - have hzi : (e.symm.toContinuousLinearEquiv : K →L[ℂ] H).toLinearMap.index = 0 := - LinearMap.index_of_bijective e.symm.bijective - change ((e.toContinuousLinearEquiv : H →L[ℂ] K) ∘L T ∘L - (e.symm.toContinuousLinearEquiv : K →L[ℂ] H)).toLinearMap.index = _ - rw [he.index_comp (hT.comp hei), hT.index_comp hei, hz, hzi, zero_add, add_zero] - -variable {A : Type} [CStarAlgebra A] - -theorem rawCycleToeplitz_unitary (c d : OddCycle A) (h : c.UnitaryEquivalent d) (u : A) : - rawCycleToeplitz d u = h.unitary.conjStarAlgEquiv (rawCycleToeplitz c u) := by - let φ : End c.space →⋆ₐ[ℂ] End d.space := h.unitary.conjStarAlgEquiv.toStarAlgHom - have hrep (a : A) : d.representation a = φ (c.representation a) := - (h.representation_eq a).trans (operatorConjugation_equiv h.unitary _) - have hop : d.operator = φ c.operator := - h.operator_eq.trans (operatorConjugation_equiv h.unitary _) - change rawCycleToeplitz d u = φ (rawCycleToeplitz c u) - unfold rawCycleToeplitz - rw [toeplitzCompression_map φ, positiveProjection_map φ, symmetricCutDown_map φ] - simp only [unitaryExtension, map_add, map_sub, map_one] - rw [hop, hrep 1, hrep u] - -theorem rawCycleIndex_unitary (c d : OddCycle A) (h : c.UnitaryEquivalent d) (u : A) - (hul : star u * u = 1) (hur : u * star u = 1) : rawCycleIndex d u = rawCycleIndex c u := by - unfold rawCycleIndex - rw [rawCycleToeplitz_unitary c d h u] - exact fredholmIndex_conjugation h.unitary _ (rawCycleToeplitz_fredholm c u hul hur) - -end CoarseAssembly.Analytic - -end - -end OAI +import OAI.Topology.CoarseAssembly.DegenerateCutDown + +namespace OAI + +/-! # Unitary invariance of the explicit cycle index -/ + +noncomputable section + +namespace CoarseAssembly.Analytic + +variable {H K : HilbertSpace} + +theorem operatorConjugation_equiv (e : H ≃ₗᵢ[ℂ] K) (T : End H) : + operatorConjugation e.toLinearIsometry T = e.conjStarAlgEquiv T := by + have he : e.toLinearIsometry.toContinuousLinearMap.adjoint = + (e.symm : K →L[ℂ] H) := e.adjoint_eq_symm + ext x + change e (T (e.toLinearIsometry.toContinuousLinearMap.adjoint x)) = e (T (e.symm x)) + rw [he] + rfl + +theorem symmetricCutDown_map (φ : End H →⋆ₐ[ℂ] End K) (P F : End H) : + φ (symmetricCutDown P F) = symmetricCutDown (φ P) (φ F) := by + have hs (r : ℝ) (T : End H) : φ (r • T) = r • φ T := φ.toAlgHom.map_smul_of_tower r T + unfold symmetricCutDown + rw [map_add, hs, map_add, map_star, + map_mul, map_mul, map_sub, map_one] + +theorem positiveProjection_map (φ : End H →⋆ₐ[ℂ] End K) (F : End H) : + φ (positiveProjection F) = positiveProjection (φ F) := by + have hs (r : ℝ) (T : End H) : φ (r • T) = r • φ T := φ.toAlgHom.map_smul_of_tower r T + unfold positiveProjection + rw [hs, map_add, map_one] + +theorem toeplitzCompression_map (φ : End H →⋆ₐ[ℂ] End K) (P U : End H) : + φ (toeplitzCompression P U) = toeplitzCompression (φ P) (φ U) := by + simp only [toeplitzCompression, map_add, map_mul, map_sub, map_one] + +theorem fredholmIndex_conjugation (e : H ≃ₗᵢ[ℂ] K) (T : End H) (hT : T.IsFredholm) : + (e.conjStarAlgEquiv T).toLinearMap.index = T.toLinearMap.index := by + have he := e.toContinuousLinearEquiv.isFredholm + have hei := e.symm.toContinuousLinearEquiv.isFredholm + have hz : (e.toContinuousLinearEquiv : H →L[ℂ] K).toLinearMap.index = 0 := + LinearMap.index_of_bijective e.bijective + have hzi : (e.symm.toContinuousLinearEquiv : K →L[ℂ] H).toLinearMap.index = 0 := + LinearMap.index_of_bijective e.symm.bijective + change ((e.toContinuousLinearEquiv : H →L[ℂ] K) ∘L T ∘L + (e.symm.toContinuousLinearEquiv : K →L[ℂ] H)).toLinearMap.index = _ + rw [he.index_comp (hT.comp hei), hT.index_comp hei, hz, hzi, zero_add, add_zero] + +variable {A : Type} [CStarAlgebra A] + +theorem rawCycleToeplitz_unitary (c d : OddCycle A) (h : c.UnitaryEquivalent d) (u : A) : + rawCycleToeplitz d u = h.unitary.conjStarAlgEquiv (rawCycleToeplitz c u) := by + let φ : End c.space →⋆ₐ[ℂ] End d.space := h.unitary.conjStarAlgEquiv.toStarAlgHom + have hrep (a : A) : d.representation a = φ (c.representation a) := + (h.representation_eq a).trans (operatorConjugation_equiv h.unitary _) + have hop : d.operator = φ c.operator := + h.operator_eq.trans (operatorConjugation_equiv h.unitary _) + change rawCycleToeplitz d u = φ (rawCycleToeplitz c u) + unfold rawCycleToeplitz + rw [toeplitzCompression_map φ, positiveProjection_map φ, symmetricCutDown_map φ] + simp only [unitaryExtension, map_add, map_sub, map_one] + rw [hop, hrep 1, hrep u] + +theorem rawCycleIndex_unitary (c d : OddCycle A) (h : c.UnitaryEquivalent d) (u : A) + (hul : star u * u = 1) (hur : u * star u = 1) : rawCycleIndex d u = rawCycleIndex c u := by + unfold rawCycleIndex + rw [rawCycleToeplitz_unitary c d h u] + exact fredholmIndex_conjugation h.unitary _ (rawCycleToeplitz_fredholm c u hul hur) + +end CoarseAssembly.Analytic + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/UnrestrictedBoundedHomotopy.lean b/lean/OAI/Topology/CoarseAssembly/UnrestrictedBoundedHomotopy.lean index d046a058d901f8737078a5ccc78ffec80fe5a46f..ae8261731c4454ffe979a0cb933a547bfba263d2 100644 --- a/lean/OAI/Topology/CoarseAssembly/UnrestrictedBoundedHomotopy.lean +++ b/lean/OAI/Topology/CoarseAssembly/UnrestrictedBoundedHomotopy.lean @@ -1,80 +1,80 @@ -import OAI.Topology.CoarseAssembly.BoundedFamilySubdivision - -namespace OAI - -/-! # Whole-union boundary invariance without uniform homotopy speeds - -Finite subdivisions are chosen separately on each component. The two sums -of consecutive samples have uniformly close localized operators. Rotation -and direct-sum additivity cancel the common interior samples in actual Roe K₁. --/ - -noncomputable section - -namespace CoarseAssembly.Rips - -open Analytic DiscreteRoe - -variable {Q : ℕ → Type} [∀ i, MetricSpace (Q i)] [∀ i, Fintype (Q i)] - [∀ i, DecidableEq (Q i)] {r : ℝ} - -namespace BoundedFamilyHomotopy - -theorem sampled_telescope (h : BoundedFamilyHomotopy Q r) - (χ : ∀ i, C(Point (Q i) r, ℂ) →⋆ₐ[ℂ] ℂ) - (o : ∀ i, Q i) (hr : 0 ≤ r) (N : ℕ → ℕ) (τ : ℕ → ℕ → Interval) - (hnear : (h.sample χ (fun i => N i + 1) τ).boundary o hr = - (h.sample χ (fun i => N i + 1) (fun i j => τ i (j + 1))).boundary o hr) : - (h.eval (fun i => τ i 0)).boundary o hr = - (h.eval (fun i => τ i (N i + 1))).boundary o hr := by - let := separatedMetric o - have hleft := h.sample_head_tail_boundary χ o hr N τ - have hright := h.sample_head_tail_boundary χ o hr N - (fun i => lastEndpointFirst (N i) (τ i)) - have hh : (fun i => lastEndpointFirst (N i) (τ i) 0) = - (fun i => τ i (N i + 1)) := funext (fun i => lastEndpointFirst_zero (N i) (τ i)) - have ht : (fun i j => lastEndpointFirst (N i) (τ i) (j + 1)) = - (fun i j => τ i (j + 1)) := funext (fun i => funext (fun j => lastEndpointFirst_succ (N i) (τ i) j)) - have hh' := congrArg (fun t : ℕ → Interval => (h.eval t).boundary o hr) hh - have ht' := congrArg (fun t : ℕ → ℕ → Interval => (h.sample χ N t).boundary o hr) ht - have hright' := hright.trans (congrArg₂ (fun a b => a + b) hh' ht') - have hrotate := h.sample_rotate_boundary χ o hr N τ - exact add_right_cancel (hleft.symm.trans (hnear.trans (hrotate.symm.trans hright'))) - -theorem endpoint_boundary_eq (h : BoundedFamilyHomotopy Q r) - (χ : ∀ i, C(Point (Q i) r, ℂ) →⋆ₐ[ℂ] ℂ) - (o : ∀ i, Q i) (hr : 0 ≤ r) : - (h.eval (fun _ => start)).boundary o hr = (h.eval (fun _ => finish)).boundary o hr := by - let s := h.smallSubdivision - have he := h.sampled_telescope χ o hr s.count s.time - (h.sampled_boundary_eq χ o hr s.count s.time s.step) - have h0 : (fun i => s.time i 0) = (fun _ => start) := funext s.at_start - have h1 : (fun i => s.time i (s.count i + 1)) = (fun _ => finish) := funext s.at_finish - have he0 := congrArg (fun t : ℕ → Interval => (h.eval t).boundary o hr) h0 - have he1 := congrArg (fun t : ℕ → Interval => (h.eval t).boundary o hr) h1 - exact he0.symm.trans (he.trans he1) - -end BoundedFamilyHomotopy - -/-- Arbitrary componentwise continuous unital self-adjoint homotopies with -a common operator bound preserve the whole-union Roe boundary. -/ -theorem ampleRipsFamilyBoundary_boundedHomotopy - (o : ∀ i, Q i) (hr : 0 ≤ r) - (χ : ∀ i, C(Point (Q i) r, ℂ) →⋆ₐ[ℂ] ℂ) - (h : ∀ i, OddHomotopy C(Point (Q i) r, ℂ)) - (hπ : ∀ t i, (h i).representation t 1 = 1) - (hs : ∀ t i, IsSelfAdjoint ((h i).operator t)) - (C : ℝ) (hC : 1 ≤ C) (hn : ∀ t i, ‖(h i).operator t‖ ≤ C) : - letI := separatedMetric o - ampleRipsFamilyBoundary o r hr (fun i => (h i).eval start) (hπ start) (hs start) - C (zero_le_one.trans hC) (hn start) = - ampleRipsFamilyBoundary o r hr (fun i => (h i).eval finish) (hπ finish) (hs finish) - C (zero_le_one.trans hC) (hn finish) := by - let H : BoundedFamilyHomotopy Q r := ⟨h, hπ, hs, C, hC, hn⟩ - exact H.endpoint_boundary_eq χ o hr - -end CoarseAssembly.Rips - -end - -end OAI +import OAI.Topology.CoarseAssembly.BoundedFamilySubdivision + +namespace OAI + +/-! # Whole-union boundary invariance without uniform homotopy speeds + +Finite subdivisions are chosen separately on each component. The two sums +of consecutive samples have uniformly close localized operators. Rotation +and direct-sum additivity cancel the common interior samples in actual Roe K₁. +-/ + +noncomputable section + +namespace CoarseAssembly.Rips + +open Analytic DiscreteRoe + +variable {Q : ℕ → Type} [∀ i, MetricSpace (Q i)] [∀ i, Fintype (Q i)] + [∀ i, DecidableEq (Q i)] {r : ℝ} + +namespace BoundedFamilyHomotopy + +theorem sampled_telescope (h : BoundedFamilyHomotopy Q r) + (χ : ∀ i, C(Point (Q i) r, ℂ) →⋆ₐ[ℂ] ℂ) + (o : ∀ i, Q i) (hr : 0 ≤ r) (N : ℕ → ℕ) (τ : ℕ → ℕ → Interval) + (hnear : (h.sample χ (fun i => N i + 1) τ).boundary o hr = + (h.sample χ (fun i => N i + 1) (fun i j => τ i (j + 1))).boundary o hr) : + (h.eval (fun i => τ i 0)).boundary o hr = + (h.eval (fun i => τ i (N i + 1))).boundary o hr := by + let := separatedMetric o + have hleft := h.sample_head_tail_boundary χ o hr N τ + have hright := h.sample_head_tail_boundary χ o hr N + (fun i => lastEndpointFirst (N i) (τ i)) + have hh : (fun i => lastEndpointFirst (N i) (τ i) 0) = + (fun i => τ i (N i + 1)) := funext (fun i => lastEndpointFirst_zero (N i) (τ i)) + have ht : (fun i j => lastEndpointFirst (N i) (τ i) (j + 1)) = + (fun i j => τ i (j + 1)) := funext (fun i => funext (fun j => lastEndpointFirst_succ (N i) (τ i) j)) + have hh' := congrArg (fun t : ℕ → Interval => (h.eval t).boundary o hr) hh + have ht' := congrArg (fun t : ℕ → ℕ → Interval => (h.sample χ N t).boundary o hr) ht + have hright' := hright.trans (congrArg₂ (fun a b => a + b) hh' ht') + have hrotate := h.sample_rotate_boundary χ o hr N τ + exact add_right_cancel (hleft.symm.trans (hnear.trans (hrotate.symm.trans hright'))) + +theorem endpoint_boundary_eq (h : BoundedFamilyHomotopy Q r) + (χ : ∀ i, C(Point (Q i) r, ℂ) →⋆ₐ[ℂ] ℂ) + (o : ∀ i, Q i) (hr : 0 ≤ r) : + (h.eval (fun _ => start)).boundary o hr = (h.eval (fun _ => finish)).boundary o hr := by + let s := h.smallSubdivision + have he := h.sampled_telescope χ o hr s.count s.time + (h.sampled_boundary_eq χ o hr s.count s.time s.step) + have h0 : (fun i => s.time i 0) = (fun _ => start) := funext s.at_start + have h1 : (fun i => s.time i (s.count i + 1)) = (fun _ => finish) := funext s.at_finish + have he0 := congrArg (fun t : ℕ → Interval => (h.eval t).boundary o hr) h0 + have he1 := congrArg (fun t : ℕ → Interval => (h.eval t).boundary o hr) h1 + exact he0.symm.trans (he.trans he1) + +end BoundedFamilyHomotopy + +/-- Arbitrary componentwise continuous unital self-adjoint homotopies with +a common operator bound preserve the whole-union Roe boundary. -/ +theorem ampleRipsFamilyBoundary_boundedHomotopy + (o : ∀ i, Q i) (hr : 0 ≤ r) + (χ : ∀ i, C(Point (Q i) r, ℂ) →⋆ₐ[ℂ] ℂ) + (h : ∀ i, OddHomotopy C(Point (Q i) r, ℂ)) + (hπ : ∀ t i, (h i).representation t 1 = 1) + (hs : ∀ t i, IsSelfAdjoint ((h i).operator t)) + (C : ℝ) (hC : 1 ≤ C) (hn : ∀ t i, ‖(h i).operator t‖ ≤ C) : + letI := separatedMetric o + ampleRipsFamilyBoundary o r hr (fun i => (h i).eval start) (hπ start) (hs start) + C (zero_le_one.trans hC) (hn start) = + ampleRipsFamilyBoundary o r hr (fun i => (h i).eval finish) (hπ finish) (hs finish) + C (zero_le_one.trans hC) (hn finish) := by + let H : BoundedFamilyHomotopy Q r := ⟨h, hπ, hs, C, hC, hn⟩ + exact H.endpoint_boundary_eq χ o hr + +end CoarseAssembly.Rips + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/WindingHomotopy.lean b/lean/OAI/Topology/CoarseAssembly/WindingHomotopy.lean index 8e68c17674c62fc1afd094009998d75407fc9a73..d3aa0a5c8a703c4195f83084249cf2850b016e96 100644 --- a/lean/OAI/Topology/CoarseAssembly/WindingHomotopy.lean +++ b/lean/OAI/Topology/CoarseAssembly/WindingHomotopy.lean @@ -1,83 +1,83 @@ -import OAI.Topology.CoarseAssembly.MultiplicativeIndexPairing - -namespace OAI - -/-! # The explicit homotopy from a lifted loop to its winding power -/ - -noncomputable section - -namespace CoarseAssembly - -open unitInterval - -/-- The degree-`n` self-map of the additive circle. -/ -def circleDegree (n : ℤ) : C(WindingCircle, WindingCircle) := - ⟨fun z => n • z, continuous_id.zsmul n⟩ - -theorem windingCircle_intCast (n : ℤ) : ((n : ℝ) : WindingCircle) = 0 := by - have h : ((n • (1 : ℝ) : ℝ) : WindingCircle) = 0 := by - rw [AddCircle.coe_zsmul, AddCircle.coe_period, smul_zero] - simpa only [zsmul_eq_mul, mul_one] using h - -/-- Straight-line interpolation of the real lift with `t ↦ n*t`. -/ -def windingInterpolation (n : ℤ) (L : Path (0 : ℝ) (n : ℝ)) (s : unitInterval) : - Path (0 : WindingCircle) 0 where - toFun t := (((1 - (s : ℝ)) * L t + (s : ℝ) * n * (t : ℝ) : ℝ) : WindingCircle) - continuous_toFun := (AddCircle.continuous_mk' 1).comp - ((L.continuous.const_mul _).add (continuous_subtype_val.const_mul _)) - source' := by simp - target' := by - have he : (1 - (s : ℝ)) * (n : ℝ) + (s : ℝ) * n * 1 = n := by ring - simp only [Path.target, Set.Icc.coe_one, he] - exact windingCircle_intCast n - -def windingInterpolationMap (n : ℤ) (L : Path (0 : ℝ) (n : ℝ)) : - unitInterval × WindingCircle → WindingCircle := - fun p => loopCircle (windingInterpolation n L p.1) p.2 - -theorem windingInterpolationMap_continuous (n : ℤ) (L : Path (0 : ℝ) (n : ℝ)) : - Continuous (windingInterpolationMap n L) := by - let q : unitInterval × unitInterval → unitInterval × WindingCircle := - fun p => (p.1, ((p.2 : ℝ) : WindingCircle)) - have hq : Continuous q := continuous_fst.prodMk - ((AddCircle.continuous_mk' 1).comp (continuous_subtype_val.comp continuous_snd)) - have hqs : Function.Surjective q := by - rintro ⟨s, z⟩ - obtain ⟨t, ht⟩ := circle_parameter_surjective z - exact ⟨(s, t), Prod.ext rfl ht⟩ - apply ((hq.isClosedMap.isQuotientMap hq hqs).continuous_iff).2 - have he : windingInterpolationMap n L ∘ q = fun p : unitInterval × unitInterval => - (((1 - (p.1 : ℝ)) * L p.2 + (p.1 : ℝ) * n * (p.2 : ℝ) : ℝ) : WindingCircle) := by - funext p - exact loopCircle_apply (windingInterpolation n L p.1) p.2 - rw [he] - apply (AddCircle.continuous_mk' 1).comp - exact ((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).mul - (L.continuous.comp continuous_snd)).add - (((continuous_subtype_val.comp continuous_fst).mul continuous_const).mul - (continuous_subtype_val.comp continuous_snd)) - -def windingHomotopy (g : C(WindingCircle, WindingCircle)) (n : ℤ) - (L : Path (0 : ℝ) (n : ℝ)) - (hL : ∀ t : unitInterval, g (t : ℝ) = (L t : WindingCircle)) : - g.Homotopy (circleDegree n) where - toFun := windingInterpolationMap n L - continuous_toFun := windingInterpolationMap_continuous n L - map_zero_left z := by - obtain ⟨t, rfl⟩ := circle_parameter_surjective z - rw [windingInterpolationMap, loopCircle_apply, hL t] - change ((((1 - (0 : ℝ)) * L t + (0 : ℝ) * n * (t : ℝ)) : ℝ) : WindingCircle) = _ - simp - map_one_left z := by - obtain ⟨t, rfl⟩ := circle_parameter_surjective z - rw [windingInterpolationMap, loopCircle_apply] - change ((((1 - (1 : ℝ)) * L t + (1 : ℝ) * n * (t : ℝ)) : ℝ) : WindingCircle) = - n • ((t : ℝ) : WindingCircle) - simpa only [sub_self, zero_mul, zero_add, one_mul, zsmul_eq_mul] using - (AddCircle.coe_zsmul (p := (1 : ℝ)) (n := n) (x := (t : ℝ))) - -end CoarseAssembly - -end - -end OAI +import OAI.Topology.CoarseAssembly.MultiplicativeIndexPairing + +namespace OAI + +/-! # The explicit homotopy from a lifted loop to its winding power -/ + +noncomputable section + +namespace CoarseAssembly + +open unitInterval + +/-- The degree-`n` self-map of the additive circle. -/ +def circleDegree (n : ℤ) : C(WindingCircle, WindingCircle) := + ⟨fun z => n • z, continuous_id.zsmul n⟩ + +theorem windingCircle_intCast (n : ℤ) : ((n : ℝ) : WindingCircle) = 0 := by + have h : ((n • (1 : ℝ) : ℝ) : WindingCircle) = 0 := by + rw [AddCircle.coe_zsmul, AddCircle.coe_period, smul_zero] + simpa only [zsmul_eq_mul, mul_one] using h + +/-- Straight-line interpolation of the real lift with `t ↦ n*t`. -/ +def windingInterpolation (n : ℤ) (L : Path (0 : ℝ) (n : ℝ)) (s : unitInterval) : + Path (0 : WindingCircle) 0 where + toFun t := (((1 - (s : ℝ)) * L t + (s : ℝ) * n * (t : ℝ) : ℝ) : WindingCircle) + continuous_toFun := (AddCircle.continuous_mk' 1).comp + ((L.continuous.const_mul _).add (continuous_subtype_val.const_mul _)) + source' := by simp + target' := by + have he : (1 - (s : ℝ)) * (n : ℝ) + (s : ℝ) * n * 1 = n := by ring + simp only [Path.target, Set.Icc.coe_one, he] + exact windingCircle_intCast n + +def windingInterpolationMap (n : ℤ) (L : Path (0 : ℝ) (n : ℝ)) : + unitInterval × WindingCircle → WindingCircle := + fun p => loopCircle (windingInterpolation n L p.1) p.2 + +theorem windingInterpolationMap_continuous (n : ℤ) (L : Path (0 : ℝ) (n : ℝ)) : + Continuous (windingInterpolationMap n L) := by + let q : unitInterval × unitInterval → unitInterval × WindingCircle := + fun p => (p.1, ((p.2 : ℝ) : WindingCircle)) + have hq : Continuous q := continuous_fst.prodMk + ((AddCircle.continuous_mk' 1).comp (continuous_subtype_val.comp continuous_snd)) + have hqs : Function.Surjective q := by + rintro ⟨s, z⟩ + obtain ⟨t, ht⟩ := circle_parameter_surjective z + exact ⟨(s, t), Prod.ext rfl ht⟩ + apply ((hq.isClosedMap.isQuotientMap hq hqs).continuous_iff).2 + have he : windingInterpolationMap n L ∘ q = fun p : unitInterval × unitInterval => + (((1 - (p.1 : ℝ)) * L p.2 + (p.1 : ℝ) * n * (p.2 : ℝ) : ℝ) : WindingCircle) := by + funext p + exact loopCircle_apply (windingInterpolation n L p.1) p.2 + rw [he] + apply (AddCircle.continuous_mk' 1).comp + exact ((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).mul + (L.continuous.comp continuous_snd)).add + (((continuous_subtype_val.comp continuous_fst).mul continuous_const).mul + (continuous_subtype_val.comp continuous_snd)) + +def windingHomotopy (g : C(WindingCircle, WindingCircle)) (n : ℤ) + (L : Path (0 : ℝ) (n : ℝ)) + (hL : ∀ t : unitInterval, g (t : ℝ) = (L t : WindingCircle)) : + g.Homotopy (circleDegree n) where + toFun := windingInterpolationMap n L + continuous_toFun := windingInterpolationMap_continuous n L + map_zero_left z := by + obtain ⟨t, rfl⟩ := circle_parameter_surjective z + rw [windingInterpolationMap, loopCircle_apply, hL t] + change ((((1 - (0 : ℝ)) * L t + (0 : ℝ) * n * (t : ℝ)) : ℝ) : WindingCircle) = _ + simp + map_one_left z := by + obtain ⟨t, rfl⟩ := circle_parameter_surjective z + rw [windingInterpolationMap, loopCircle_apply] + change ((((1 - (1 : ℝ)) * L t + (1 : ℝ) * n * (t : ℝ)) : ℝ) : WindingCircle) = + n • ((t : ℝ) : WindingCircle) + simpa only [sub_self, zero_mul, zero_add, one_mul, zsmul_eq_mul] using + (AddCircle.coe_zsmul (p := (1 : ℝ)) (n := n) (x := (t : ℝ))) + +end CoarseAssembly + +end + +end OAI diff --git a/lean/OAI/Topology/CoarseAssembly/WindingIndexEvaluation.lean b/lean/OAI/Topology/CoarseAssembly/WindingIndexEvaluation.lean index 1f5c423792f9a7e17c97eb888bda94dee40786c5..4047a90a5201d1aec091822c7ebee360e10bc0c4 100644 --- a/lean/OAI/Topology/CoarseAssembly/WindingIndexEvaluation.lean +++ b/lean/OAI/Topology/CoarseAssembly/WindingIndexEvaluation.lean @@ -1,60 +1,60 @@ -import OAI.Topology.CoarseAssembly.WindingHomotopy - -namespace OAI - -/-! # Reducing the winding index formula to one generator evaluation - -The pairing, its naturality, homotopy invariance and power law are proved. -Only an actual circle class with coordinate index one remains to construct. --/ - -noncomputable section - -namespace CoarseAssembly - -open Analytic unitInterval - -theorem circleUnitary_degree (n : ℤ) : circleUnitary (circleDegree n) = - circleUnitary (ContinuousMap.id WindingCircle) ^ n := by - apply ContinuousMap.ext - intro z - exact AddCircle.toCircle_zsmul z n - -theorem winding_index_hom (g : C(WindingCircle, WindingCircle)) (n : ℤ) - (L : Path (0 : ℝ) (n : ℝ)) - (hL : ∀ t : unitInterval, g (t : ℝ) = (L t : WindingCircle)) : - compactIndexPairing (circleUnitary g) = - n • compactIndexPairing (circleUnitary (ContinuousMap.id WindingCircle)) := by - let toCircleMap : C(WindingCircle, Circle) := ⟨AddCircle.toCircle, AddCircle.continuous_toCircle⟩ - have h := compactIndexPairing_homotopy - ((ContinuousMap.Homotopy.refl toCircleMap).comp (windingHomotopy g n L hL)) - change compactIndexPairing (circleUnitary g) = compactIndexPairing (circleUnitary (circleDegree n)) at h - rw [circleUnitary_degree, compactIndexPairing_zpow] at h - exact h - -theorem winding_index (g : C(WindingCircle, WindingCircle)) (n : ℤ) - (L : Path (0 : ℝ) (n : ℝ)) - (hL : ∀ t : unitInterval, g (t : ℝ) = (L t : WindingCircle)) - (α : LocallyFiniteK1 WindingCircle) : - compactIndexPairing (circleUnitary g) α = - n * compactIndexPairing (circleUnitary (ContinuousMap.id WindingCircle)) α := by - simpa only [AddMonoidHom.smul_apply, zsmul_eq_mul, Int.cast_id] using - DFunLike.congr_fun (winding_index_hom g n L hL) α - -/-- All the published circle fields follow from a single coordinate-index-one class. -/ -def circleInputOfIndexOne (α : LocallyFiniteK1 WindingCircle) - (hα : compactIndexPairing (circleUnitary (ContinuousMap.id WindingCircle)) α = 1) : - PublishedCircleInput where - fundamental := α - pairing f := compactIndexPairing (circleUnitary f) - loop_naturality f γ := by - have h := DFunLike.congr_fun (compactIndexPairing_natural (circleUnitary f) γ) α - exact h - winding g n L hL := by - rw [winding_index g n L hL α, hα, mul_one] - -end CoarseAssembly - -end - -end OAI +import OAI.Topology.CoarseAssembly.WindingHomotopy + +namespace OAI + +/-! # Reducing the winding index formula to one generator evaluation + +The pairing, its naturality, homotopy invariance and power law are proved. +Only an actual circle class with coordinate index one remains to construct. +-/ + +noncomputable section + +namespace CoarseAssembly + +open Analytic unitInterval + +theorem circleUnitary_degree (n : ℤ) : circleUnitary (circleDegree n) = + circleUnitary (ContinuousMap.id WindingCircle) ^ n := by + apply ContinuousMap.ext + intro z + exact AddCircle.toCircle_zsmul z n + +theorem winding_index_hom (g : C(WindingCircle, WindingCircle)) (n : ℤ) + (L : Path (0 : ℝ) (n : ℝ)) + (hL : ∀ t : unitInterval, g (t : ℝ) = (L t : WindingCircle)) : + compactIndexPairing (circleUnitary g) = + n • compactIndexPairing (circleUnitary (ContinuousMap.id WindingCircle)) := by + let toCircleMap : C(WindingCircle, Circle) := ⟨AddCircle.toCircle, AddCircle.continuous_toCircle⟩ + have h := compactIndexPairing_homotopy + ((ContinuousMap.Homotopy.refl toCircleMap).comp (windingHomotopy g n L hL)) + change compactIndexPairing (circleUnitary g) = compactIndexPairing (circleUnitary (circleDegree n)) at h + rw [circleUnitary_degree, compactIndexPairing_zpow] at h + exact h + +theorem winding_index (g : C(WindingCircle, WindingCircle)) (n : ℤ) + (L : Path (0 : ℝ) (n : ℝ)) + (hL : ∀ t : unitInterval, g (t : ℝ) = (L t : WindingCircle)) + (α : LocallyFiniteK1 WindingCircle) : + compactIndexPairing (circleUnitary g) α = + n * compactIndexPairing (circleUnitary (ContinuousMap.id WindingCircle)) α := by + simpa only [AddMonoidHom.smul_apply, zsmul_eq_mul, Int.cast_id] using + DFunLike.congr_fun (winding_index_hom g n L hL) α + +/-- All the published circle fields follow from a single coordinate-index-one class. -/ +def circleInputOfIndexOne (α : LocallyFiniteK1 WindingCircle) + (hα : compactIndexPairing (circleUnitary (ContinuousMap.id WindingCircle)) α = 1) : + PublishedCircleInput where + fundamental := α + pairing f := compactIndexPairing (circleUnitary f) + loop_naturality f γ := by + have h := DFunLike.congr_fun (compactIndexPairing_natural (circleUnitary f) γ) α + exact h + winding g n L hL := by + rw [winding_index g n L hL α, hα, mul_one] + +end CoarseAssembly + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/AffineTransport.lean b/lean/OAI/Topology/EilenbergGanea/AffineTransport.lean index 7d40d3a4baba2c792eff6678a0bf19d9479f7944..d293fc2936747a7dff89489f8b9fc518651f1a70 100644 --- a/lean/OAI/Topology/EilenbergGanea/AffineTransport.lean +++ b/lean/OAI/Topology/EilenbergGanea/AffineTransport.lean @@ -1,449 +1,449 @@ -import OAI.Topology.EilenbergGanea.SmallHolonomy -import OAI.GroupTheory.RightAngledArtin.TraceWords - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -namespace EilenbergGanea -namespace AffineTransport - -/-- A finite family of proper quaternion subspaces cannot cover ℍ. -/ -theorem exists_avoid_subspaces {I : Type*} [Finite I] - (p : I → Submodule ℝ ℍ) (hp : ∀ i, p i ≠ ⊤) : - ∃ q : ℍ, ∀ i, q ∉ p i := by - have ho (i) : IsOpen ((p i : Set ℍ)ᶜ) := - (p i).closed_of_finiteDimensional.isOpen_compl - have hd (i) : Dense ((p i : Set ℍ)ᶜ) := by - apply interior_eq_empty_iff_dense_compl.mp - apply Set.not_nonempty_iff_eq_empty.mp - intro h - exact hp i ((p i).eq_top_of_nonempty_interior' h) - obtain ⟨q,hq⟩ := (dense_iInter_of_isOpen ho hd).nonempty - exact ⟨q,Set.mem_iInter.mp hq⟩ - -/-- Simultaneous general position for finitely many local quaternion gauges. -Different vertices may use different invertible linear transformations in each -chart. No flatness or topology is assumed in this finite-dimensional lemma. -/ -theorem exists_triangle_general_position {A V : Type*} [Finite A] [Fintype V] - (T : A → V → ℍ ≃ₗ[ℝ] ℍ) : - ∃ q : V → ℍ, ∀ a (s : Finset V), s.card ≤ 3 → - LinearIndepOn ℝ (fun v => T a v (q v)) (s : Set V) := by - classical - suffices ∀ U : Finset V, ∃ q : V → ℍ, ∀ a (s : Finset V), s ⊆ U → s.card ≤ 3 → - LinearIndepOn ℝ (fun v => T a v (q v)) (s : Set V) by - obtain ⟨q,hq⟩ := this Finset.univ - exact ⟨q,fun a s h => hq a s (Finset.subset_univ _) h⟩ - intro U - induction U using Finset.induction with - | empty => - refine ⟨0,?_⟩ - intro a s hs _ - have : s = ∅ := Finset.subset_empty.mp hs - subst s - simpa only [Finset.coe_empty,Pi.zero_apply] using - linearIndepOn_empty ℝ (fun v => T a v (0 : ℍ)) - | @insert v U hv ih => - obtain ⟨q,hq⟩ := ih - let I := A × {s : Finset V // s ⊆ U ∧ s.card ≤ 2} - let p : I → Submodule ℝ ℍ := fun i => - (Submodule.span ℝ ((fun w => T i.1 w (q w)) '' (i.2.val : Set V))).comap - (T i.1 v).toLinearMap - have hp (i : I) : p i ≠ ⊤ := by - have hf : Module.finrank ℝ (Submodule.span ℝ - ((fun w => T i.1 w (q w)) '' (i.2.val : Set V))) ≤ 2 := by - have hh := finrank_span_finset_le_card (R := ℝ) (i.2.val.image (fun w => T i.1 w (q w))) - rw [Finset.coe_image] at hh - exact hh.trans ((Finset.card_image_le).trans i.2.property.2) - have hproper : Submodule.span ℝ ((fun w => T i.1 w (q w)) '' - (i.2.val : Set V)) ≠ ⊤ := by - apply ne_of_lt (Submodule.lt_top_of_finrank_lt_finrank _) - rw [Quaternion.finrank_eq_four] - omega - intro hh - apply hproper - apply top_unique - intro x _ - have hm : (T i.1 v).symm x ∈ p i := by rw [hh]; trivial - simpa only [p,Submodule.mem_comap,LinearEquiv.coe_coe, - LinearEquiv.apply_symm_apply] using hm - obtain ⟨z,hz⟩ := exists_avoid_subspaces p hp - refine ⟨Function.update q v z,?_⟩ - intro a s hs hc - by_cases hvs : v ∈ s - · have hsub : s.erase v ⊆ U := by - intro w hw - have hh := hs (Finset.mem_of_mem_erase hw) - exact (Finset.mem_insert.mp hh).resolve_left (Finset.ne_of_mem_erase hw) - have hcard : (s.erase v).card ≤ 2 := by - have he := Finset.card_erase_add_one hvs - omega - have heq : ∀ w ∈ (s.erase v : Finset V), Function.update q v z w = q w := by - intro w hw - exact Function.update_of_ne (Finset.ne_of_mem_erase hw) _ _ - have hi : LinearIndepOn ℝ (fun w => T a w (Function.update q v z w)) - ((s.erase v : Finset V) : Set V) := by - apply (hq a (s.erase v) hsub (by omega)).congr - intro w hw - dsimp only - rw [heq w hw] - have hn : T a v (Function.update q v z v) ∉ Submodule.span ℝ - ((fun w => T a w (Function.update q v z w)) '' - ((s.erase v : Finset V) : Set V)) := by - rw [Function.update_self] - have him : ((fun w => T a w (Function.update q v z w)) '' - ((s.erase v : Finset V) : Set V)) = - ((fun w => T a w (q w)) '' ((s.erase v : Finset V) : Set V)) := by - apply Set.image_congr - intro w hw - rw [heq w hw] - rw [him] - exact hz ⟨a,⟨s.erase v,hsub,hcard⟩⟩ - have ht := (linearIndepOn_insert (by simp : v ∉ ((s.erase v : Finset V) : Set V))).mpr - ⟨hi,hn⟩ - simpa only [← Finset.coe_insert,Finset.insert_erase hvs] using ht - · have hsub : s ⊆ U := by - intro w hw - have hh := hs hw - rcases Finset.mem_insert.mp hh with rfl | hh - · exact False.elim (hvs hw) - · exact hh - apply (hq a s hsub hc).congr - intro w hw - dsimp only - rw [Function.update_of_ne (by intro h; subst w; exact hvs hw)] - - -@[simp] theorem unit_norm (h : SU2) : ‖(h : ℍ)‖ = 1 := - (quaternion_mem_unitary_iff _).mp h.property - -def leftLinearEquiv (h : SU2) : ℍ ≃ₗ[ℝ] ℍ where - toFun q := (h : ℍ) * q - invFun q := (h⁻¹ : SU2) * q - left_inv q := by simp [← mul_assoc,← Submonoid.coe_mul] - right_inv q := by simp [← mul_assoc,← Submonoid.coe_mul] - map_add' _ _ := mul_add _ _ _ - map_smul' r q := mul_smul_comm r (h : ℍ) q - -@[simp] theorem leftLinearEquiv_apply (h : SU2) (q : ℍ) : - leftLinearEquiv h q = (h : ℍ) * q := rfl - -theorem normalize_left (h : SU2) {q : ℍ} (hq : q ≠ 0) : - normalizeQuaternion ((h : ℍ) * q) = h * normalizeQuaternion q := by - have hh : (h : ℍ) * q ≠ 0 := by - exact (leftLinearEquiv h).map_ne_zero_iff.mpr hq - apply Subtype.ext - rw [normalizeQuaternion_coe_of_ne_zero hh] - change ‖(h : ℍ) * q‖⁻¹ • ((h : ℍ) * q) = (h : ℍ) * (normalizeQuaternion q : ℍ) - rw [normalizeQuaternion_coe_of_ne_zero hq,norm_mul,unit_norm,one_mul,mul_smul_comm] - -section FiniteSimplex -variable {V : Type*} [Fintype V] - -def coordinateSimplex : Set (V → ℝ) := - {weights | (∀ vertex, 0 ≤ weights vertex) ∧ ∑ vertex, weights vertex = 1} - -/-- Closed coordinate face of the standard simplex. -/ -def face (s : Finset V) : Set (V → ℝ) := - {b | b ∈ coordinateSimplex ∧ ∀ v ∉ s, b v = 0} - -/-- The whole two-skeleton of a finite standard simplex. -/ -def triangleSet : Set (V → ℝ) := - ⋃ s : {s : Finset V // s.card ≤ 3}, face s.val - -abbrev TrianglePoint (V : Type*) [Fintype V] := (triangleSet : Set (V → ℝ)) - -theorem mem_triangleSet {b : V → ℝ} : b ∈ triangleSet ↔ - ∃ s : Finset V, s.card ≤ 3 ∧ b ∈ coordinateSimplex ∧ ∀ v ∉ s, b v = 0 := by - simp only [triangleSet,Set.mem_iUnion,face,Set.mem_ofPred_eq,Subtype.exists,exists_prop] - -omit [Fintype V] in -private theorem isClosed_face_support (s : Finset V) : - IsClosed {b : V → ℝ | ∀ v ∉ s, b v = 0} := by - have he : {b : V → ℝ | ∀ v ∉ s, b v = 0} = - ⋂ v, ⋂ (_ : v ∉ s), {b : V → ℝ | b v = 0} := by ext b; simp - rw [he] - exact isClosed_iInter fun v => isClosed_iInter fun _ => - isClosed_eq (continuous_apply v) continuous_const - -theorem isCompact_face (s : Finset V) : IsCompact (face s) := by - have compact_simplex : IsCompact (coordinateSimplex : Set (V → ℝ)) := by - convert isCompact_range - (Convexity.StdSimplex.isEmbedding_toFun_comp_weights ℝ V).continuous using 1 - rw [Convexity.StdSimplex.range_toFun_comp_weights] - ext weights - simp [coordinateSimplex] - exact compact_simplex.inter_right (isClosed_face_support s) - -theorem isCompact_triangleSet : IsCompact (triangleSet : Set (V → ℝ)) := - isCompact_iUnion fun _ => isCompact_face _ - -instance : CompactSpace (TrianglePoint V) := - isCompact_iff_compactSpace.mp isCompact_triangleSet - -theorem point_simplex (b : TrianglePoint V) : (b : V → ℝ) ∈ coordinateSimplex := by - obtain ⟨_,_,h,_⟩ := mem_triangleSet.mp b.property - exact h - -theorem point_exists_nonzero (b : TrianglePoint V) : ∃ v, (b : V → ℝ) v ≠ 0 := by - by_contra! h - have he := (point_simplex b).2 - simp only [h,Finset.sum_const_zero] at he - norm_num at he - -variable (h : V → V → SU2) (q : V → ℍ) - -def rawGauge (a : V) (b : V → ℝ) : ℍ := ∑ v, b v • ((h a v : ℍ) * q v) - -def GeneralPosition : Prop := ∀ a (s : Finset V), s.card ≤ 3 → - LinearIndepOn ℝ (fun v => (h a v : ℍ) * q v) (s : Set V) - -theorem exists_generalPosition : ∃ q : V → ℍ, GeneralPosition h q := by - obtain ⟨q,hq⟩ := exists_triangle_general_position (fun a v => leftLinearEquiv (h a v)) - exact ⟨q,hq⟩ - -theorem rawGauge_ne_zero (hq : GeneralPosition h q) (a : V) (b : TrianglePoint V) : - rawGauge h q a b ≠ 0 := by - classical - obtain ⟨s,hs,hb,hout⟩ := mem_triangleSet.mp b.property - intro he - have he' : ∑ v ∈ s, (b : V → ℝ) v • ((h a v : ℍ) * q v) = 0 := by - rw [← he] - apply Finset.sum_subset (Finset.subset_univ _) - intro v _ hv - rw [hout v hv,zero_smul] - have hz := (linearIndepOn_iff'.mp (hq a s hs)) s b (Set.Subset.refl _) he' - have hall : ∀ v, (b : V → ℝ) v = 0 := by - intro v - by_cases hv : v ∈ s - · exact hz v hv - · exact hout v hv - have heq := hb.2 - simp only [hall,Finset.sum_const_zero] at heq - norm_num at heq - -def gauge (a : V) (b : TrianglePoint V) : SU2 := normalizeQuaternion (rawGauge h q a b) - -theorem continuous_rawGauge (a : V) : Continuous (rawGauge h q a) := - continuous_finsetSum _ fun v _ => (continuous_apply v).smul continuous_const - -theorem continuous_gauge (hq : GeneralPosition h q) (a : V) : Continuous (gauge h q a) := by - apply continuous_iff_continuousAt.mpr - intro b - exact ContinuousAt.comp (f := fun c : TrianglePoint V => rawGauge h q a c) - (normalizeQuaternion_continuousAt (rawGauge_ne_zero h q hq a b)) - ((continuous_rawGauge h q a).comp continuous_subtype_val).continuousAt - -/-- Uniform modulus over all charts, including across the edges of all simplices. -/ -theorem gauges_uniform (hq : GeneralPosition h q) {ε : ℝ} (hε : 0 < ε) : - ∃ δ > 0, ∀ b c : TrianglePoint V, dist b c < δ → - ∀ a, dist (gauge h q a b) (gauge h q a c) < ε := by - have hc : Continuous (fun b : TrianglePoint V => fun a => gauge h q a b) := - continuous_pi fun a => continuous_gauge h q hq a - have hu := CompactSpace.uniformContinuous_of_continuous hc - obtain ⟨δ,hδ,H⟩ := Metric.uniformContinuous_iff.mp hu ε hε - refine ⟨δ,hδ,?_⟩ - intro b c hbc a - exact lt_of_le_of_lt (dist_le_pi_dist (fun a => gauge h q a b) (fun a => gauge h q a c) a) (H hbc) - -end FiniteSimplex - -theorem unitary_dist_left (a b c : SU2) : dist (a * b) (a * c) = dist b c := by - change dist ((a : ℍ) * (b : ℍ)) ((a : ℍ) * (c : ℍ)) = dist (b : ℍ) (c : ℍ) - rw [dist_eq_norm,dist_eq_norm,← mul_sub,norm_mul,unit_norm,one_mul] - -theorem unitary_dist_inv_mul_one (a b : SU2) : dist (a⁻¹ * b) 1 = dist a b := by - rw [← unitary_dist_left a (a⁻¹ * b) 1] - simp [dist_comm] - -theorem unitary_dist_mul_one_le (a b : SU2) : - dist (a * b) 1 ≤ dist a 1 + dist b 1 := by - calc - dist (a * b) 1 ≤ dist (a * b) a + dist a 1 := dist_triangle _ _ _ - _ = dist b 1 + dist a 1 := by - exact congrArg (fun t => t + dist a 1) (by simpa only [mul_one] using unitary_dist_left a b 1) - _ = dist a 1 + dist b 1 := add_comm _ _ - -section Connection -variable {V : Type*} [Fintype V] -variable (L : SimpleGraph V) - -def Related (a b : V) : Prop := a = b ∨ L.Adj a b - -omit [Fintype V] in -theorem Related.refl (a : V) : Related L a a := Or.inl rfl - -omit [Fintype V] in -theorem Related.symm {a b : V} : Related L a b → Related L b a := by - rintro (rfl | h) - · exact Related.refl L _ - · exact Or.inr h.symm - -def Star (a : V) (b : TrianglePoint V) : Prop := - ∀ v, (b : V → ℝ) v ≠ 0 → Related L a v - -def CliquePoint (b : TrianglePoint V) : Prop := - ∀ a, (b : V → ℝ) a ≠ 0 → Star L a b - -def Compatible (b c : TrianglePoint V) : Prop := - ∀ v w, ((b : V → ℝ) v ≠ 0 ∨ (c : V → ℝ) v ≠ 0) → - ((b : V → ℝ) w ≠ 0 ∨ (c : V → ℝ) w ≠ 0) → Related L v w - -def root (b : TrianglePoint V) : V := Classical.choose (point_exists_nonzero b) - -theorem root_mem (b : TrianglePoint V) : (b : V → ℝ) (root b) ≠ 0 := - Classical.choose_spec (point_exists_nonzero b) - -variable (h : V → V → SU2) (q : V → ℍ) - -def FlatConnection : Prop := ∀ a b c, Related L a b → Related L b c → - Related L a c → h a b * h b c = h a c - -theorem rawGauge_transition (hf : FlatConnection L h) {a c : V} - {b : TrianglePoint V} (hac : Related L a c) (ha : Star L a b) (hc : Star L c b) : - rawGauge h q a b = (h a c : ℍ) * rawGauge h q c b := by - classical - simp only [rawGauge,Finset.mul_sum] - apply Finset.sum_congr rfl - intro v _ - by_cases hv : (b : V → ℝ) v = 0 - · simp [hv] - · rw [mul_smul_comm,← mul_assoc,← Submonoid.coe_mul,hf a c v hac (hc v hv) (ha v hv)] - -theorem gauge_transition (hf : FlatConnection L h) (hq : GeneralPosition h q) - {a c : V} {b : TrianglePoint V} (hac : Related L a c) - (ha : Star L a b) (hc : Star L c b) : - gauge h q a b = h a c * gauge h q c b := by - unfold gauge - rw [rawGauge_transition L h q hf hac ha hc] - exact normalize_left _ (rawGauge_ne_zero h q hq c b) - -def chartTransport (a : V) (b c : TrianglePoint V) : SU2 := - (gauge h q a b)⁻¹ * gauge h q a c - -def transport (b c : TrianglePoint V) : SU2 := chartTransport h q (root b) b c - -theorem transport_chart (hf : FlatConnection L h) (hq : GeneralPosition h q) - {b c : TrianglePoint V} (hb : Compatible L b c) {a : V} - (hab : Star L a b) (hac : Star L a c) : - transport h q b c = chartTransport h q a b c := by - have hrb : Star L (root b) b := fun v hv => hb _ _ (Or.inl (root_mem b)) (Or.inl hv) - have hrc : Star L (root b) c := fun v hv => hb _ _ (Or.inl (root_mem b)) (Or.inr hv) - have har : Related L a (root b) := hab _ (root_mem b) - unfold transport chartTransport - rw [gauge_transition L h q hf hq har hab hrb, - gauge_transition L h q hf hq har hac hrc] - group - -theorem compatible_symm {b c : TrianglePoint V} (hb : Compatible L b c) : - Compatible L c b := fun v w hv hw => hb v w hv.symm hw.symm - -theorem transport_reverse (hf : FlatConnection L h) (hq : GeneralPosition h q) - {b c : TrianglePoint V} (hb : Compatible L b c) : - transport h q c b = (transport h q b c)⁻¹ := by - have hrc : Star L (root b) c := fun v hv => hb _ _ (Or.inl (root_mem b)) (Or.inr hv) - have hrb : Star L (root b) b := fun v hv => hb _ _ (Or.inl (root_mem b)) (Or.inl hv) - rw [transport_chart L h q hf hq (compatible_symm L hb) hrc hrb] - unfold transport chartTransport - group - -theorem chartTransport_trans (a : V) (b c d : TrianglePoint V) : - chartTransport h q a b c * chartTransport h q a c d = chartTransport h q a b d := by - unfold chartTransport - group - -theorem exists_large_coordinate (b : TrianglePoint V) : - ∃ a, 1 / (Fintype.card V + 1 : ℝ) < (b : V → ℝ) a := by - by_contra! H - have hs := Finset.sum_le_sum (s := Finset.univ) (fun a _ => H a) - have hb := (point_simplex b).2 - rw [hb,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] at hs - have hn : 0 ≤ (Fintype.card V : ℝ) := Nat.cast_nonneg _ - have hd : 0 < (Fintype.card V : ℝ) + 1 := by positivity - have he := (le_div_iff₀ hd).mp (by simpa only [mul_one_div] using hs) - linarith - -theorem nearby_star {b c : TrianglePoint V} {a : V} - (ha : 1 / (Fintype.card V + 1 : ℝ) < (b : V → ℝ) a) - (hc : CliquePoint L c) (hbc : dist b c < 1 / (Fintype.card V + 1 : ℝ)) : - Star L a c := by - apply hc a - intro he - have hd := lt_of_le_of_lt (dist_le_pi_dist (b : V → ℝ) (c : V → ℝ) a) hbc - rw [he, Real.dist_eq,sub_zero,abs_of_nonneg ((point_simplex b).1 a)] at hd - exact (not_lt_of_ge ha.le) hd - -theorem chartTransport_dist (a : V) (b c : TrianglePoint V) : - dist (chartTransport h q a b c) 1 = dist (gauge h q a b) (gauge h q a c) := - unitary_dist_inv_mul_one _ _ - -theorem transport_uniform (hq : GeneralPosition h q) {ε : ℝ} (hε : 0 < ε) : - ∃ δ > 0, ∀ b c : TrianglePoint V, dist b c < δ → dist (transport h q b c) 1 < ε := by - obtain ⟨δ,hδ,H⟩ := gauges_uniform h q hq hε - exact ⟨δ,hδ,fun b c hbc => (chartTransport_dist h q _ b c).symm ▸ H b c hbc (root b)⟩ - -/-- Two compatible pieces, rather than a chosen homotopy class of paths, suffice. -/ -def edgeTransport (b c d : TrianglePoint V) : SU2 := transport h q b c * transport h q c d - -theorem edgeTransport_chart (hf : FlatConnection L h) (hq : GeneralPosition h q) - {b c d : TrianglePoint V} (hbc : Compatible L b c) (hcd : Compatible L c d) - {a : V} (hab : Star L a b) (hac : Star L a c) (had : Star L a d) : - edgeTransport h q b c d = chartTransport h q a b d := by - rw [edgeTransport,transport_chart L h q hf hq hbc hab hac, - transport_chart L h q hf hq hcd hac had,chartTransport_trans] - -theorem edgeTransport_reverse (hf : FlatConnection L h) (hq : GeneralPosition h q) - {b c d : TrianglePoint V} (hbc : Compatible L b c) (hcd : Compatible L c d) : - edgeTransport h q d c b = (edgeTransport h q b c d)⁻¹ := by - rw [edgeTransport,edgeTransport,transport_reverse L h q hf hq hbc, - transport_reverse L h q hf hq hcd,mul_inv_rev] - -theorem edgeTransport_uniform (hq : GeneralPosition h q) {ε : ℝ} (hε : 0 < ε) : - ∃ δ > 0, ∀ b c d : TrianglePoint V, dist b c < δ → dist c d < δ → - dist (edgeTransport h q b c d) 1 < ε := by - obtain ⟨δ,hδ,H⟩ := transport_uniform h q hq (show 0 < ε/2 by positivity) - refine ⟨δ,hδ,?_⟩ - intro b c d hbc hcd - apply lt_of_le_of_lt (unitary_dist_mul_one_le _ _) - have h₁ := H b c hbc - have h₂ := H c d hcd - linarith - -/-- All three edge images in one chart have exactly trivial triangle holonomy. -/ -theorem edgeTransport_triangle (hf : FlatConnection L h) (hq : GeneralPosition h q) - (b c d u v w : TrianglePoint V) {a : V} - (hbu : Compatible L b u) (huc : Compatible L u c) - (hcv : Compatible L c v) (hvd : Compatible L v d) - (hdw : Compatible L d w) (hwb : Compatible L w b) - (hab : Star L a b) (hac : Star L a c) (had : Star L a d) - (hau : Star L a u) (hav : Star L a v) (haw : Star L a w) : - edgeTransport h q b u c * edgeTransport h q c v d * edgeTransport h q d w b = 1 := by - rw [edgeTransport_chart L h q hf hq hbu huc hab hau hac, - edgeTransport_chart L h q hf hq hcv hvd hac hav had, - edgeTransport_chart L h q hf hq hdw hwb had haw hab] - unfold chartTransport - group - -/-- A uniform local chart for any finite or infinite family of nearby clique points. -/ -theorem nearby_family_chart {I : Type*} (b : TrianglePoint V) (c : I → TrianglePoint V) - (hc : ∀ i, CliquePoint L (c i)) - (hbc : ∀ i, dist b (c i) < 1 / (Fintype.card V + 1 : ℝ)) : - ∃ a, ∀ i, Star L a (c i) := by - obtain ⟨a,ha⟩ := exists_large_coordinate b - exact ⟨a,fun i => nearby_star L ha (hc i) (hbc i)⟩ - -end Connection - -end AffineTransport - - - - -end EilenbergGanea - -end - -end OAI +import OAI.Topology.EilenbergGanea.SmallHolonomy +import OAI.GroupTheory.RightAngledArtin.TraceWords + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +namespace EilenbergGanea +namespace AffineTransport + +/-- A finite family of proper quaternion subspaces cannot cover ℍ. -/ +theorem exists_avoid_subspaces {I : Type*} [Finite I] + (p : I → Submodule ℝ ℍ) (hp : ∀ i, p i ≠ ⊤) : + ∃ q : ℍ, ∀ i, q ∉ p i := by + have ho (i) : IsOpen ((p i : Set ℍ)ᶜ) := + (p i).closed_of_finiteDimensional.isOpen_compl + have hd (i) : Dense ((p i : Set ℍ)ᶜ) := by + apply interior_eq_empty_iff_dense_compl.mp + apply Set.not_nonempty_iff_eq_empty.mp + intro h + exact hp i ((p i).eq_top_of_nonempty_interior' h) + obtain ⟨q,hq⟩ := (dense_iInter_of_isOpen ho hd).nonempty + exact ⟨q,Set.mem_iInter.mp hq⟩ + +/-- Simultaneous general position for finitely many local quaternion gauges. +Different vertices may use different invertible linear transformations in each +chart. No flatness or topology is assumed in this finite-dimensional lemma. -/ +theorem exists_triangle_general_position {A V : Type*} [Finite A] [Fintype V] + (T : A → V → ℍ ≃ₗ[ℝ] ℍ) : + ∃ q : V → ℍ, ∀ a (s : Finset V), s.card ≤ 3 → + LinearIndepOn ℝ (fun v => T a v (q v)) (s : Set V) := by + classical + suffices ∀ U : Finset V, ∃ q : V → ℍ, ∀ a (s : Finset V), s ⊆ U → s.card ≤ 3 → + LinearIndepOn ℝ (fun v => T a v (q v)) (s : Set V) by + obtain ⟨q,hq⟩ := this Finset.univ + exact ⟨q,fun a s h => hq a s (Finset.subset_univ _) h⟩ + intro U + induction U using Finset.induction with + | empty => + refine ⟨0,?_⟩ + intro a s hs _ + have : s = ∅ := Finset.subset_empty.mp hs + subst s + simpa only [Finset.coe_empty,Pi.zero_apply] using + linearIndepOn_empty ℝ (fun v => T a v (0 : ℍ)) + | @insert v U hv ih => + obtain ⟨q,hq⟩ := ih + let I := A × {s : Finset V // s ⊆ U ∧ s.card ≤ 2} + let p : I → Submodule ℝ ℍ := fun i => + (Submodule.span ℝ ((fun w => T i.1 w (q w)) '' (i.2.val : Set V))).comap + (T i.1 v).toLinearMap + have hp (i : I) : p i ≠ ⊤ := by + have hf : Module.finrank ℝ (Submodule.span ℝ + ((fun w => T i.1 w (q w)) '' (i.2.val : Set V))) ≤ 2 := by + have hh := finrank_span_finset_le_card (R := ℝ) (i.2.val.image (fun w => T i.1 w (q w))) + rw [Finset.coe_image] at hh + exact hh.trans ((Finset.card_image_le).trans i.2.property.2) + have hproper : Submodule.span ℝ ((fun w => T i.1 w (q w)) '' + (i.2.val : Set V)) ≠ ⊤ := by + apply ne_of_lt (Submodule.lt_top_of_finrank_lt_finrank _) + rw [Quaternion.finrank_eq_four] + omega + intro hh + apply hproper + apply top_unique + intro x _ + have hm : (T i.1 v).symm x ∈ p i := by rw [hh]; trivial + simpa only [p,Submodule.mem_comap,LinearEquiv.coe_coe, + LinearEquiv.apply_symm_apply] using hm + obtain ⟨z,hz⟩ := exists_avoid_subspaces p hp + refine ⟨Function.update q v z,?_⟩ + intro a s hs hc + by_cases hvs : v ∈ s + · have hsub : s.erase v ⊆ U := by + intro w hw + have hh := hs (Finset.mem_of_mem_erase hw) + exact (Finset.mem_insert.mp hh).resolve_left (Finset.ne_of_mem_erase hw) + have hcard : (s.erase v).card ≤ 2 := by + have he := Finset.card_erase_add_one hvs + omega + have heq : ∀ w ∈ (s.erase v : Finset V), Function.update q v z w = q w := by + intro w hw + exact Function.update_of_ne (Finset.ne_of_mem_erase hw) _ _ + have hi : LinearIndepOn ℝ (fun w => T a w (Function.update q v z w)) + ((s.erase v : Finset V) : Set V) := by + apply (hq a (s.erase v) hsub (by omega)).congr + intro w hw + dsimp only + rw [heq w hw] + have hn : T a v (Function.update q v z v) ∉ Submodule.span ℝ + ((fun w => T a w (Function.update q v z w)) '' + ((s.erase v : Finset V) : Set V)) := by + rw [Function.update_self] + have him : ((fun w => T a w (Function.update q v z w)) '' + ((s.erase v : Finset V) : Set V)) = + ((fun w => T a w (q w)) '' ((s.erase v : Finset V) : Set V)) := by + apply Set.image_congr + intro w hw + rw [heq w hw] + rw [him] + exact hz ⟨a,⟨s.erase v,hsub,hcard⟩⟩ + have ht := (linearIndepOn_insert (by simp : v ∉ ((s.erase v : Finset V) : Set V))).mpr + ⟨hi,hn⟩ + simpa only [← Finset.coe_insert,Finset.insert_erase hvs] using ht + · have hsub : s ⊆ U := by + intro w hw + have hh := hs hw + rcases Finset.mem_insert.mp hh with rfl | hh + · exact False.elim (hvs hw) + · exact hh + apply (hq a s hsub hc).congr + intro w hw + dsimp only + rw [Function.update_of_ne (by intro h; subst w; exact hvs hw)] + + +@[simp] theorem unit_norm (h : SU2) : ‖(h : ℍ)‖ = 1 := + (quaternion_mem_unitary_iff _).mp h.property + +def leftLinearEquiv (h : SU2) : ℍ ≃ₗ[ℝ] ℍ where + toFun q := (h : ℍ) * q + invFun q := (h⁻¹ : SU2) * q + left_inv q := by simp [← mul_assoc,← Submonoid.coe_mul] + right_inv q := by simp [← mul_assoc,← Submonoid.coe_mul] + map_add' _ _ := mul_add _ _ _ + map_smul' r q := mul_smul_comm r (h : ℍ) q + +@[simp] theorem leftLinearEquiv_apply (h : SU2) (q : ℍ) : + leftLinearEquiv h q = (h : ℍ) * q := rfl + +theorem normalize_left (h : SU2) {q : ℍ} (hq : q ≠ 0) : + normalizeQuaternion ((h : ℍ) * q) = h * normalizeQuaternion q := by + have hh : (h : ℍ) * q ≠ 0 := by + exact (leftLinearEquiv h).map_ne_zero_iff.mpr hq + apply Subtype.ext + rw [normalizeQuaternion_coe_of_ne_zero hh] + change ‖(h : ℍ) * q‖⁻¹ • ((h : ℍ) * q) = (h : ℍ) * (normalizeQuaternion q : ℍ) + rw [normalizeQuaternion_coe_of_ne_zero hq,norm_mul,unit_norm,one_mul,mul_smul_comm] + +section FiniteSimplex +variable {V : Type*} [Fintype V] + +def coordinateSimplex : Set (V → ℝ) := + {weights | (∀ vertex, 0 ≤ weights vertex) ∧ ∑ vertex, weights vertex = 1} + +/-- Closed coordinate face of the standard simplex. -/ +def face (s : Finset V) : Set (V → ℝ) := + {b | b ∈ coordinateSimplex ∧ ∀ v ∉ s, b v = 0} + +/-- The whole two-skeleton of a finite standard simplex. -/ +def triangleSet : Set (V → ℝ) := + ⋃ s : {s : Finset V // s.card ≤ 3}, face s.val + +abbrev TrianglePoint (V : Type*) [Fintype V] := (triangleSet : Set (V → ℝ)) + +theorem mem_triangleSet {b : V → ℝ} : b ∈ triangleSet ↔ + ∃ s : Finset V, s.card ≤ 3 ∧ b ∈ coordinateSimplex ∧ ∀ v ∉ s, b v = 0 := by + simp only [triangleSet,Set.mem_iUnion,face,Set.mem_ofPred_eq,Subtype.exists,exists_prop] + +omit [Fintype V] in +private theorem isClosed_face_support (s : Finset V) : + IsClosed {b : V → ℝ | ∀ v ∉ s, b v = 0} := by + have he : {b : V → ℝ | ∀ v ∉ s, b v = 0} = + ⋂ v, ⋂ (_ : v ∉ s), {b : V → ℝ | b v = 0} := by ext b; simp + rw [he] + exact isClosed_iInter fun v => isClosed_iInter fun _ => + isClosed_eq (continuous_apply v) continuous_const + +theorem isCompact_face (s : Finset V) : IsCompact (face s) := by + have compact_simplex : IsCompact (coordinateSimplex : Set (V → ℝ)) := by + convert isCompact_range + (Convexity.StdSimplex.isEmbedding_toFun_comp_weights ℝ V).continuous using 1 + rw [Convexity.StdSimplex.range_toFun_comp_weights] + ext weights + simp [coordinateSimplex] + exact compact_simplex.inter_right (isClosed_face_support s) + +theorem isCompact_triangleSet : IsCompact (triangleSet : Set (V → ℝ)) := + isCompact_iUnion fun _ => isCompact_face _ + +instance : CompactSpace (TrianglePoint V) := + isCompact_iff_compactSpace.mp isCompact_triangleSet + +theorem point_simplex (b : TrianglePoint V) : (b : V → ℝ) ∈ coordinateSimplex := by + obtain ⟨_,_,h,_⟩ := mem_triangleSet.mp b.property + exact h + +theorem point_exists_nonzero (b : TrianglePoint V) : ∃ v, (b : V → ℝ) v ≠ 0 := by + by_contra! h + have he := (point_simplex b).2 + simp only [h,Finset.sum_const_zero] at he + norm_num at he + +variable (h : V → V → SU2) (q : V → ℍ) + +def rawGauge (a : V) (b : V → ℝ) : ℍ := ∑ v, b v • ((h a v : ℍ) * q v) + +def GeneralPosition : Prop := ∀ a (s : Finset V), s.card ≤ 3 → + LinearIndepOn ℝ (fun v => (h a v : ℍ) * q v) (s : Set V) + +theorem exists_generalPosition : ∃ q : V → ℍ, GeneralPosition h q := by + obtain ⟨q,hq⟩ := exists_triangle_general_position (fun a v => leftLinearEquiv (h a v)) + exact ⟨q,hq⟩ + +theorem rawGauge_ne_zero (hq : GeneralPosition h q) (a : V) (b : TrianglePoint V) : + rawGauge h q a b ≠ 0 := by + classical + obtain ⟨s,hs,hb,hout⟩ := mem_triangleSet.mp b.property + intro he + have he' : ∑ v ∈ s, (b : V → ℝ) v • ((h a v : ℍ) * q v) = 0 := by + rw [← he] + apply Finset.sum_subset (Finset.subset_univ _) + intro v _ hv + rw [hout v hv,zero_smul] + have hz := (linearIndepOn_iff'.mp (hq a s hs)) s b (Set.Subset.refl _) he' + have hall : ∀ v, (b : V → ℝ) v = 0 := by + intro v + by_cases hv : v ∈ s + · exact hz v hv + · exact hout v hv + have heq := hb.2 + simp only [hall,Finset.sum_const_zero] at heq + norm_num at heq + +def gauge (a : V) (b : TrianglePoint V) : SU2 := normalizeQuaternion (rawGauge h q a b) + +theorem continuous_rawGauge (a : V) : Continuous (rawGauge h q a) := + continuous_finsetSum _ fun v _ => (continuous_apply v).smul continuous_const + +theorem continuous_gauge (hq : GeneralPosition h q) (a : V) : Continuous (gauge h q a) := by + apply continuous_iff_continuousAt.mpr + intro b + exact ContinuousAt.comp (f := fun c : TrianglePoint V => rawGauge h q a c) + (normalizeQuaternion_continuousAt (rawGauge_ne_zero h q hq a b)) + ((continuous_rawGauge h q a).comp continuous_subtype_val).continuousAt + +/-- Uniform modulus over all charts, including across the edges of all simplices. -/ +theorem gauges_uniform (hq : GeneralPosition h q) {ε : ℝ} (hε : 0 < ε) : + ∃ δ > 0, ∀ b c : TrianglePoint V, dist b c < δ → + ∀ a, dist (gauge h q a b) (gauge h q a c) < ε := by + have hc : Continuous (fun b : TrianglePoint V => fun a => gauge h q a b) := + continuous_pi fun a => continuous_gauge h q hq a + have hu := CompactSpace.uniformContinuous_of_continuous hc + obtain ⟨δ,hδ,H⟩ := Metric.uniformContinuous_iff.mp hu ε hε + refine ⟨δ,hδ,?_⟩ + intro b c hbc a + exact lt_of_le_of_lt (dist_le_pi_dist (fun a => gauge h q a b) (fun a => gauge h q a c) a) (H hbc) + +end FiniteSimplex + +theorem unitary_dist_left (a b c : SU2) : dist (a * b) (a * c) = dist b c := by + change dist ((a : ℍ) * (b : ℍ)) ((a : ℍ) * (c : ℍ)) = dist (b : ℍ) (c : ℍ) + rw [dist_eq_norm,dist_eq_norm,← mul_sub,norm_mul,unit_norm,one_mul] + +theorem unitary_dist_inv_mul_one (a b : SU2) : dist (a⁻¹ * b) 1 = dist a b := by + rw [← unitary_dist_left a (a⁻¹ * b) 1] + simp [dist_comm] + +theorem unitary_dist_mul_one_le (a b : SU2) : + dist (a * b) 1 ≤ dist a 1 + dist b 1 := by + calc + dist (a * b) 1 ≤ dist (a * b) a + dist a 1 := dist_triangle _ _ _ + _ = dist b 1 + dist a 1 := by + exact congrArg (fun t => t + dist a 1) (by simpa only [mul_one] using unitary_dist_left a b 1) + _ = dist a 1 + dist b 1 := add_comm _ _ + +section Connection +variable {V : Type*} [Fintype V] +variable (L : SimpleGraph V) + +def Related (a b : V) : Prop := a = b ∨ L.Adj a b + +omit [Fintype V] in +theorem Related.refl (a : V) : Related L a a := Or.inl rfl + +omit [Fintype V] in +theorem Related.symm {a b : V} : Related L a b → Related L b a := by + rintro (rfl | h) + · exact Related.refl L _ + · exact Or.inr h.symm + +def Star (a : V) (b : TrianglePoint V) : Prop := + ∀ v, (b : V → ℝ) v ≠ 0 → Related L a v + +def CliquePoint (b : TrianglePoint V) : Prop := + ∀ a, (b : V → ℝ) a ≠ 0 → Star L a b + +def Compatible (b c : TrianglePoint V) : Prop := + ∀ v w, ((b : V → ℝ) v ≠ 0 ∨ (c : V → ℝ) v ≠ 0) → + ((b : V → ℝ) w ≠ 0 ∨ (c : V → ℝ) w ≠ 0) → Related L v w + +def root (b : TrianglePoint V) : V := Classical.choose (point_exists_nonzero b) + +theorem root_mem (b : TrianglePoint V) : (b : V → ℝ) (root b) ≠ 0 := + Classical.choose_spec (point_exists_nonzero b) + +variable (h : V → V → SU2) (q : V → ℍ) + +def FlatConnection : Prop := ∀ a b c, Related L a b → Related L b c → + Related L a c → h a b * h b c = h a c + +theorem rawGauge_transition (hf : FlatConnection L h) {a c : V} + {b : TrianglePoint V} (hac : Related L a c) (ha : Star L a b) (hc : Star L c b) : + rawGauge h q a b = (h a c : ℍ) * rawGauge h q c b := by + classical + simp only [rawGauge,Finset.mul_sum] + apply Finset.sum_congr rfl + intro v _ + by_cases hv : (b : V → ℝ) v = 0 + · simp [hv] + · rw [mul_smul_comm,← mul_assoc,← Submonoid.coe_mul,hf a c v hac (hc v hv) (ha v hv)] + +theorem gauge_transition (hf : FlatConnection L h) (hq : GeneralPosition h q) + {a c : V} {b : TrianglePoint V} (hac : Related L a c) + (ha : Star L a b) (hc : Star L c b) : + gauge h q a b = h a c * gauge h q c b := by + unfold gauge + rw [rawGauge_transition L h q hf hac ha hc] + exact normalize_left _ (rawGauge_ne_zero h q hq c b) + +def chartTransport (a : V) (b c : TrianglePoint V) : SU2 := + (gauge h q a b)⁻¹ * gauge h q a c + +def transport (b c : TrianglePoint V) : SU2 := chartTransport h q (root b) b c + +theorem transport_chart (hf : FlatConnection L h) (hq : GeneralPosition h q) + {b c : TrianglePoint V} (hb : Compatible L b c) {a : V} + (hab : Star L a b) (hac : Star L a c) : + transport h q b c = chartTransport h q a b c := by + have hrb : Star L (root b) b := fun v hv => hb _ _ (Or.inl (root_mem b)) (Or.inl hv) + have hrc : Star L (root b) c := fun v hv => hb _ _ (Or.inl (root_mem b)) (Or.inr hv) + have har : Related L a (root b) := hab _ (root_mem b) + unfold transport chartTransport + rw [gauge_transition L h q hf hq har hab hrb, + gauge_transition L h q hf hq har hac hrc] + group + +theorem compatible_symm {b c : TrianglePoint V} (hb : Compatible L b c) : + Compatible L c b := fun v w hv hw => hb v w hv.symm hw.symm + +theorem transport_reverse (hf : FlatConnection L h) (hq : GeneralPosition h q) + {b c : TrianglePoint V} (hb : Compatible L b c) : + transport h q c b = (transport h q b c)⁻¹ := by + have hrc : Star L (root b) c := fun v hv => hb _ _ (Or.inl (root_mem b)) (Or.inr hv) + have hrb : Star L (root b) b := fun v hv => hb _ _ (Or.inl (root_mem b)) (Or.inl hv) + rw [transport_chart L h q hf hq (compatible_symm L hb) hrc hrb] + unfold transport chartTransport + group + +theorem chartTransport_trans (a : V) (b c d : TrianglePoint V) : + chartTransport h q a b c * chartTransport h q a c d = chartTransport h q a b d := by + unfold chartTransport + group + +theorem exists_large_coordinate (b : TrianglePoint V) : + ∃ a, 1 / (Fintype.card V + 1 : ℝ) < (b : V → ℝ) a := by + by_contra! H + have hs := Finset.sum_le_sum (s := Finset.univ) (fun a _ => H a) + have hb := (point_simplex b).2 + rw [hb,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] at hs + have hn : 0 ≤ (Fintype.card V : ℝ) := Nat.cast_nonneg _ + have hd : 0 < (Fintype.card V : ℝ) + 1 := by positivity + have he := (le_div_iff₀ hd).mp (by simpa only [mul_one_div] using hs) + linarith + +theorem nearby_star {b c : TrianglePoint V} {a : V} + (ha : 1 / (Fintype.card V + 1 : ℝ) < (b : V → ℝ) a) + (hc : CliquePoint L c) (hbc : dist b c < 1 / (Fintype.card V + 1 : ℝ)) : + Star L a c := by + apply hc a + intro he + have hd := lt_of_le_of_lt (dist_le_pi_dist (b : V → ℝ) (c : V → ℝ) a) hbc + rw [he, Real.dist_eq,sub_zero,abs_of_nonneg ((point_simplex b).1 a)] at hd + exact (not_lt_of_ge ha.le) hd + +theorem chartTransport_dist (a : V) (b c : TrianglePoint V) : + dist (chartTransport h q a b c) 1 = dist (gauge h q a b) (gauge h q a c) := + unitary_dist_inv_mul_one _ _ + +theorem transport_uniform (hq : GeneralPosition h q) {ε : ℝ} (hε : 0 < ε) : + ∃ δ > 0, ∀ b c : TrianglePoint V, dist b c < δ → dist (transport h q b c) 1 < ε := by + obtain ⟨δ,hδ,H⟩ := gauges_uniform h q hq hε + exact ⟨δ,hδ,fun b c hbc => (chartTransport_dist h q _ b c).symm ▸ H b c hbc (root b)⟩ + +/-- Two compatible pieces, rather than a chosen homotopy class of paths, suffice. -/ +def edgeTransport (b c d : TrianglePoint V) : SU2 := transport h q b c * transport h q c d + +theorem edgeTransport_chart (hf : FlatConnection L h) (hq : GeneralPosition h q) + {b c d : TrianglePoint V} (hbc : Compatible L b c) (hcd : Compatible L c d) + {a : V} (hab : Star L a b) (hac : Star L a c) (had : Star L a d) : + edgeTransport h q b c d = chartTransport h q a b d := by + rw [edgeTransport,transport_chart L h q hf hq hbc hab hac, + transport_chart L h q hf hq hcd hac had,chartTransport_trans] + +theorem edgeTransport_reverse (hf : FlatConnection L h) (hq : GeneralPosition h q) + {b c d : TrianglePoint V} (hbc : Compatible L b c) (hcd : Compatible L c d) : + edgeTransport h q d c b = (edgeTransport h q b c d)⁻¹ := by + rw [edgeTransport,edgeTransport,transport_reverse L h q hf hq hbc, + transport_reverse L h q hf hq hcd,mul_inv_rev] + +theorem edgeTransport_uniform (hq : GeneralPosition h q) {ε : ℝ} (hε : 0 < ε) : + ∃ δ > 0, ∀ b c d : TrianglePoint V, dist b c < δ → dist c d < δ → + dist (edgeTransport h q b c d) 1 < ε := by + obtain ⟨δ,hδ,H⟩ := transport_uniform h q hq (show 0 < ε/2 by positivity) + refine ⟨δ,hδ,?_⟩ + intro b c d hbc hcd + apply lt_of_le_of_lt (unitary_dist_mul_one_le _ _) + have h₁ := H b c hbc + have h₂ := H c d hcd + linarith + +/-- All three edge images in one chart have exactly trivial triangle holonomy. -/ +theorem edgeTransport_triangle (hf : FlatConnection L h) (hq : GeneralPosition h q) + (b c d u v w : TrianglePoint V) {a : V} + (hbu : Compatible L b u) (huc : Compatible L u c) + (hcv : Compatible L c v) (hvd : Compatible L v d) + (hdw : Compatible L d w) (hwb : Compatible L w b) + (hab : Star L a b) (hac : Star L a c) (had : Star L a d) + (hau : Star L a u) (hav : Star L a v) (haw : Star L a w) : + edgeTransport h q b u c * edgeTransport h q c v d * edgeTransport h q d w b = 1 := by + rw [edgeTransport_chart L h q hf hq hbu huc hab hau hac, + edgeTransport_chart L h q hf hq hcv hvd hac hav had, + edgeTransport_chart L h q hf hq hdw hwb had haw hab] + unfold chartTransport + group + +/-- A uniform local chart for any finite or infinite family of nearby clique points. -/ +theorem nearby_family_chart {I : Type*} (b : TrianglePoint V) (c : I → TrianglePoint V) + (hc : ∀ i, CliquePoint L (c i)) + (hbc : ∀ i, dist b (c i) < 1 / (Fintype.card V + 1 : ℝ)) : + ∃ a, ∀ i, Star L a (c i) := by + obtain ⟨a,ha⟩ := exists_large_coordinate b + exact ⟨a,fun i => nearby_star L ha (hc i) (hbc i)⟩ + +end Connection + +end AffineTransport + + + + +end EilenbergGanea + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/CliqueCohomology.lean b/lean/OAI/Topology/EilenbergGanea/CliqueCohomology.lean index df0aca37eff9b1c53c157dab9a0aa574b429ec2f..1f170ab7d1bf2d0c5a26d7b3d2bf846f0caf0e09 100644 --- a/lean/OAI/Topology/EilenbergGanea/CliqueCohomology.lean +++ b/lean/OAI/Topology/EilenbergGanea/CliqueCohomology.lean @@ -1,232 +1,232 @@ -import OAI.Topology.EilenbergGanea.Model -import Mathlib.CategoryTheory.Abelian.Projective.Ext -import Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic -import Mathlib.RepresentationTheory.Homological.GroupCohomology.LowDegree -import Mathlib.RepresentationTheory.Homological.GroupCohomology.LongExactSequence - -namespace OAI - -noncomputable section - -open Classical Set - -namespace EilenbergGanea -section CliqueSquare -variable {V : Type*} (L : SimpleGraph V) - - def generatorExponent (v : V) : ArtinGroup L →* Multiplicative ℤ := by - classical - exact artinLift L (fun w => Multiplicative.ofAdd (if w = v then 1 else 0)) - (fun _ _ _ => Commute.all _ _) - -@[simp] theorem generatorExponent_of [DecidableEq V] (v w : V) : - generatorExponent L v (artinGenerator L w) = Multiplicative.ofAdd (if w = v then 1 else 0) := by - classical - simp [generatorExponent] - - def heightDifference (v b : V) : (height L).ker := - ⟨artinGenerator L v * (artinGenerator L b)⁻¹, by simp⟩ - - theorem heightDifference_commute (v w b : V) - (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : - Commute (heightDifference L v b) (heightDifference L w b) := by - apply Subtype.ext - exact (((adjacent_generators_commute L hvw).mul_right - (adjacent_generators_commute L hvb).inv_right).mul_left - (((adjacent_generators_commute L hwb).symm.inv_left).mul_right (Commute.refl _))) - - def cliqueSquare (v w b : V) (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : - Multiplicative (ℤ × ℤ) →* (height L).ker where - toFun n := heightDifference L v b ^ n.toAdd.1 * heightDifference L w b ^ n.toAdd.2 - map_one' := by simp - map_mul' n m := by - change _ ^ (n.toAdd.1 + m.toAdd.1) * _ ^ (n.toAdd.2 + m.toAdd.2) = _ - rw [zpow_add, zpow_add] - simp only [mul_assoc] - congr 1 - rw [← mul_assoc, ((heightDifference_commute L v w b hvw hvb hwb).zpow_zpow m.toAdd.1 n.toAdd.2).eq, mul_assoc] - - theorem cliqueSquare_injective (v w b : V) (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : - Function.Injective (cliqueSquare L v w b hvw hvb hwb) := by - classical - have hvw' : v ≠ w := L.ne_of_adj hvw - have hvb' : v ≠ b := L.ne_of_adj hvb - have hwb' : w ≠ b := L.ne_of_adj hwb - intro n m he - have h₁ := congrArg (fun x : (height L).ker => generatorExponent L v x.val) he - have h₂ := congrArg (fun x : (height L).ker => generatorExponent L w x.val) he - have hn₁ : n.toAdd.1 = m.toAdd.1 := by - simpa [cliqueSquare, heightDifference, generatorExponent_of, hvw', hvw'.symm, hvb', hvb'.symm] using congrArg Multiplicative.toAdd h₁ - have hn₂ : n.toAdd.2 = m.toAdd.2 := by - simpa [cliqueSquare, heightDifference, generatorExponent_of, hvw', hwb', hwb'.symm] using congrArg Multiplicative.toAdd h₂ - exact congrArg Multiplicative.ofAdd (Prod.ext hn₁ hn₂) -end CliqueSquare - - def seedCliqueVertex : SeedCell := .inl (.inl none) - def seedCliqueEdge : SeedCell := .inr (.inl (.inl (false, 0))) - def seedCliqueFace : SeedCell := .inr (.inr ⟨false, ⟨0, by decide⟩⟩) - - theorem source_contains_int_square : - ∃ f : Multiplicative (ℤ × ℤ) →* SourceGroup, Function.Injective f := by - have hve : seedGraph.Adj seedCliqueVertex seedCliqueEdge := by - change properFace _ _ ∨ _ - left - simp [properFace, seedCliqueVertex, seedCliqueEdge, edgeVertices, circleStart] - have hvf : seedGraph.Adj seedCliqueVertex seedCliqueFace := by - change properFace _ _ ∨ _ - left - simp [properFace, seedCliqueVertex, seedCliqueFace, sectorVertices, sectorEdges, edgeVertices, sectorCircleEdge, sectorLetter, seedWord, circleStart, circleEnd] - have hef : seedGraph.Adj seedCliqueEdge seedCliqueFace := by - change properFace _ _ ∨ _ - left - simp [properFace, seedCliqueEdge, seedCliqueFace, sectorEdges, sectorCircleEdge, sectorLetter, seedWord] - exact ⟨cliqueSquare seedGraph _ _ _ hve hvf hef, - cliqueSquare_injective seedGraph _ _ _ hve hvf hef⟩ - -section CupCocycle -open groupCohomology -variable {G : Type} [Group G] - -/-- The cup product of two integral exponent homomorphisms. -/ -def exponentCup (a b : G →* Multiplicative ℤ) : cocycles₂ (Rep.trivial ℤ G ℤ) := - ⟨fun p => (a p.1).toAdd * (b p.2).toAdd, by - rw [mem_cocycles₂_iff] - intro g h j - simp only [map_mul, toAdd_mul] - change ((a g).toAdd + (a h).toAdd) * (b j).toAdd + (a g).toAdd * (b h).toAdd = - (a h).toAdd * (b j).toAdd + (a g).toAdd * ((b h).toAdd + (b j).toAdd) - ring⟩ - -/-- Antisymmetrizing on a commuting pair detects a nonzero integral class. -/ -theorem exponentCup_not_coboundary (a b : G →* Multiplicative ℤ) (g h : G) - (hc : Commute g h) - (hag : (a g).toAdd = 1) (hah : (a h).toAdd = 0) - (hbg : (b g).toAdd = 0) (hbh : (b h).toAdd = 1) : - ⇑(exponentCup a b) ∉ coboundaries₂ (Rep.trivial ℤ G ℤ) := by - rintro ⟨f, hf⟩ - have h₁ := congrFun hf (g, h) - have h₂ := congrFun hf (h, g) - change f h - f (g*h) + f g = (a g).toAdd * (b h).toAdd at h₁ - change f g - f (h*g) + f h = (a h).toAdd * (b g).toAdd at h₂ - rw [hag, hbh] at h₁ - rw [hah, hbg, ← hc.eq] at h₂ - change (f h : ℤ) - f (g*h) + f g = 1 * 1 at h₁ - change (f g : ℤ) - f (g*h) + f h = 0 * 0 at h₂ - linarith - -theorem exponentCup_class_ne_zero (a b : G →* Multiplicative ℤ) (g h : G) - (hc : Commute g h) - (hag : (a g).toAdd = 1) (hah : (a h).toAdd = 0) - (hbg : (b g).toAdd = 0) (hbh : (b h).toAdd = 1) : - H2π _ (exponentCup a b) ≠ 0 := by - intro he - exact exponentCup_not_coboundary a b g h hc hag hah hbg hbh - ((H2π_eq_zero_iff (A := Rep.trivial ℤ G ℤ) (exponentCup a b)).mp he) - -end CupCocycle - -section CliqueCohomology -open groupCohomology -variable {V : Type} (L : SimpleGraph V) - -theorem clique_exponent_class_nonzero (v w b : V) - (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : - ∃ x : H2 (Rep.trivial ℤ (height L).ker ℤ), x ≠ 0 := by - classical - let a := (generatorExponent L v).comp (height L).ker.subtype - let d := (generatorExponent L w).comp (height L).ker.subtype - have hvw' := L.ne_of_adj hvw - have hvb' := L.ne_of_adj hvb - have hwb' := L.ne_of_adj hwb - refine ⟨H2π _ (exponentCup a d), exponentCup_class_ne_zero a d - (heightDifference L v b) (heightDifference L w b) - (heightDifference_commute L v w b hvw hvb hwb) ?_ ?_ ?_ ?_⟩ - all_goals simp [a, d, heightDifference, hvw', hvw'.symm, hvb'.symm, hwb'.symm] - -end CliqueCohomology - - -open CategoryTheory CategoryTheory.Limits - -section -variable {C D : Type*} [Category* C] [Category* D] [Abelian C] [Abelian D] - {X Y : C} (P : ProjectiveResolution X) (F : C ⥤ D) - [F.Additive] [F.Full] [F.Faithful] - [F.PreservesProjectiveObjects] [F.PreservesHomology] - -/-- Vanishing in the literal projective-dimension sense forces every -2-cocycle in a projective resolution to be a coboundary; the fully faithful -exact functor permits us to use this for the representation/group-ring equivalence. -/ -theorem cocycle_boundary_of_projectiveDimension_lt_two - [HasProjectiveDimensionLT (F.obj X) 2] - (f : P.complex.X 2 ⟶ Y) (hf : P.complex.d 3 2 ≫ f = 0) : - ∃ g : P.complex.X 1 ⟶ Y, P.complex.d 2 1 ≫ g = f := by - let := HasExt.standard D - let Q := F.mapProjectiveResolution P - have hmf : Q.complex.d 3 2 ≫ F.map f = 0 := by - change F.map (P.complex.d 3 2) ≫ F.map f = 0 - rw [← F.map_comp, hf, F.map_zero] - have hc := Abelian.Ext.eq_zero_of_hasProjectiveDimensionLT (Q.extMk (F.map f) 3 rfl hmf) 2 (by rfl) - obtain ⟨g, hg⟩ := (Q.extMk_eq_zero_iff (F.map f) 3 rfl hmf 1 rfl).mp hc - change F.obj (P.complex.X 1) ⟶ F.obj Y at g - change F.map (P.complex.d 2 1) ≫ g = F.map f at hg - refine ⟨F.preimage g, F.map_injective ?_⟩ - rw [F.map_comp, F.map_preimage] - exact hg - -/-- The same vanishing expressed in the library's older linear-Yoneda model -of Ext. This theorem proves rather than assumes the bridge between the two APIs. -/ -theorem isZero_homology_two_of_projectiveDimension_lt_two - (R : Type*) [Ring R] [Linear R C] - [HasProjectiveDimensionLT (F.obj X) 2] : - IsZero ((P.complex.linearYonedaObj R Y).homology 2) := by - rw [← HomologicalComplex.exactAt_iff_isZero_homology] - rw [HomologicalComplex.exactAt_iff' _ 1 2 3 (by simp) (by simp)] - rw [ShortComplex.moduleCat_exact_iff] - intro f hf - change P.complex.d 3 2 ≫ f = 0 at hf - exact cocycle_boundary_of_projectiveDimension_lt_two P F f hf -end - -open CategoryTheory CategoryTheory.Limits - -theorem two_le_cohomologicalDimension_of_H2_nonzero (G : Type) [Group G] - (hx : ∃ x : groupCohomology.H2 (Rep.trivial ℤ G ℤ), x ≠ 0) : - 2 ≤ cohomologicalDimension G := by - change (2 : ℕ) ≤ CategoryTheory.projectiveDimension - (ModuleCat.of (MonoidAlgebra ℤ G) (Representation.trivial ℤ G ℤ).asModule) - rw [CategoryTheory.projectiveDimension_ge_iff] - intro hd - let F := Rep.toModuleMonoidAlgebra (k := ℤ) (G := G) - let P := Rep.barResolution ℤ G - let : F.Additive := Functor.additive_of_preserves_binary_products F - have : HasProjectiveDimensionLT (F.obj (Rep.trivial ℤ G ℤ)) 2 := hd - have hz := isZero_homology_two_of_projectiveDimension_lt_two - (Y := Rep.trivial ℤ G ℤ) P F ℤ - have hz' : IsZero (groupCohomology.H2 (Rep.trivial ℤ G ℤ)) := - hz.of_iso (groupCohomologyIso (Rep.trivial ℤ G ℤ) 2 P) - obtain ⟨x, hx⟩ := hx - exact hx ((ModuleCat.isZero_iff_subsingleton.mp hz').elim x 0) - -theorem height_kernel_two_le_cohomologicalDimension {V : Type} (L : SimpleGraph V) - (v w b : V) (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : - 2 ≤ cohomologicalDimension (height L).ker := - two_le_cohomologicalDimension_of_H2_nonzero _ (clique_exponent_class_nonzero L v w b hvw hvb hwb) - -theorem source_two_le_cohomologicalDimension : 2 ≤ cohomologicalDimension SourceGroup := by - apply height_kernel_two_le_cohomologicalDimension seedGraph seedCliqueVertex seedCliqueEdge seedCliqueFace - · change properFace _ _ ∨ _ - left - simp [properFace, seedCliqueVertex, seedCliqueEdge, edgeVertices, circleStart] - · change properFace _ _ ∨ _ - left - simp [properFace, seedCliqueVertex, seedCliqueFace, sectorVertices, sectorEdges, edgeVertices, sectorCircleEdge, sectorLetter, seedWord, circleStart, circleEnd] - · change properFace _ _ ∨ _ - left - simp [properFace, seedCliqueEdge, seedCliqueFace, sectorEdges, sectorCircleEdge, sectorLetter, seedWord] -end EilenbergGanea - - -end - -end OAI +import OAI.Topology.EilenbergGanea.Model +import Mathlib.CategoryTheory.Abelian.Projective.Ext +import Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic +import Mathlib.RepresentationTheory.Homological.GroupCohomology.LowDegree +import Mathlib.RepresentationTheory.Homological.GroupCohomology.LongExactSequence + +namespace OAI + +noncomputable section + +open Classical Set + +namespace EilenbergGanea +section CliqueSquare +variable {V : Type*} (L : SimpleGraph V) + + def generatorExponent (v : V) : ArtinGroup L →* Multiplicative ℤ := by + classical + exact artinLift L (fun w => Multiplicative.ofAdd (if w = v then 1 else 0)) + (fun _ _ _ => Commute.all _ _) + +@[simp] theorem generatorExponent_of [DecidableEq V] (v w : V) : + generatorExponent L v (artinGenerator L w) = Multiplicative.ofAdd (if w = v then 1 else 0) := by + classical + simp [generatorExponent] + + def heightDifference (v b : V) : (height L).ker := + ⟨artinGenerator L v * (artinGenerator L b)⁻¹, by simp⟩ + + theorem heightDifference_commute (v w b : V) + (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : + Commute (heightDifference L v b) (heightDifference L w b) := by + apply Subtype.ext + exact (((adjacent_generators_commute L hvw).mul_right + (adjacent_generators_commute L hvb).inv_right).mul_left + (((adjacent_generators_commute L hwb).symm.inv_left).mul_right (Commute.refl _))) + + def cliqueSquare (v w b : V) (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : + Multiplicative (ℤ × ℤ) →* (height L).ker where + toFun n := heightDifference L v b ^ n.toAdd.1 * heightDifference L w b ^ n.toAdd.2 + map_one' := by simp + map_mul' n m := by + change _ ^ (n.toAdd.1 + m.toAdd.1) * _ ^ (n.toAdd.2 + m.toAdd.2) = _ + rw [zpow_add, zpow_add] + simp only [mul_assoc] + congr 1 + rw [← mul_assoc, ((heightDifference_commute L v w b hvw hvb hwb).zpow_zpow m.toAdd.1 n.toAdd.2).eq, mul_assoc] + + theorem cliqueSquare_injective (v w b : V) (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : + Function.Injective (cliqueSquare L v w b hvw hvb hwb) := by + classical + have hvw' : v ≠ w := L.ne_of_adj hvw + have hvb' : v ≠ b := L.ne_of_adj hvb + have hwb' : w ≠ b := L.ne_of_adj hwb + intro n m he + have h₁ := congrArg (fun x : (height L).ker => generatorExponent L v x.val) he + have h₂ := congrArg (fun x : (height L).ker => generatorExponent L w x.val) he + have hn₁ : n.toAdd.1 = m.toAdd.1 := by + simpa [cliqueSquare, heightDifference, generatorExponent_of, hvw', hvw'.symm, hvb', hvb'.symm] using congrArg Multiplicative.toAdd h₁ + have hn₂ : n.toAdd.2 = m.toAdd.2 := by + simpa [cliqueSquare, heightDifference, generatorExponent_of, hvw', hwb', hwb'.symm] using congrArg Multiplicative.toAdd h₂ + exact congrArg Multiplicative.ofAdd (Prod.ext hn₁ hn₂) +end CliqueSquare + + def seedCliqueVertex : SeedCell := .inl (.inl none) + def seedCliqueEdge : SeedCell := .inr (.inl (.inl (false, 0))) + def seedCliqueFace : SeedCell := .inr (.inr ⟨false, ⟨0, by decide⟩⟩) + + theorem source_contains_int_square : + ∃ f : Multiplicative (ℤ × ℤ) →* SourceGroup, Function.Injective f := by + have hve : seedGraph.Adj seedCliqueVertex seedCliqueEdge := by + change properFace _ _ ∨ _ + left + simp [properFace, seedCliqueVertex, seedCliqueEdge, edgeVertices, circleStart] + have hvf : seedGraph.Adj seedCliqueVertex seedCliqueFace := by + change properFace _ _ ∨ _ + left + simp [properFace, seedCliqueVertex, seedCliqueFace, sectorVertices, sectorEdges, edgeVertices, sectorCircleEdge, sectorLetter, seedWord, circleStart, circleEnd] + have hef : seedGraph.Adj seedCliqueEdge seedCliqueFace := by + change properFace _ _ ∨ _ + left + simp [properFace, seedCliqueEdge, seedCliqueFace, sectorEdges, sectorCircleEdge, sectorLetter, seedWord] + exact ⟨cliqueSquare seedGraph _ _ _ hve hvf hef, + cliqueSquare_injective seedGraph _ _ _ hve hvf hef⟩ + +section CupCocycle +open groupCohomology +variable {G : Type} [Group G] + +/-- The cup product of two integral exponent homomorphisms. -/ +def exponentCup (a b : G →* Multiplicative ℤ) : cocycles₂ (Rep.trivial ℤ G ℤ) := + ⟨fun p => (a p.1).toAdd * (b p.2).toAdd, by + rw [mem_cocycles₂_iff] + intro g h j + simp only [map_mul, toAdd_mul] + change ((a g).toAdd + (a h).toAdd) * (b j).toAdd + (a g).toAdd * (b h).toAdd = + (a h).toAdd * (b j).toAdd + (a g).toAdd * ((b h).toAdd + (b j).toAdd) + ring⟩ + +/-- Antisymmetrizing on a commuting pair detects a nonzero integral class. -/ +theorem exponentCup_not_coboundary (a b : G →* Multiplicative ℤ) (g h : G) + (hc : Commute g h) + (hag : (a g).toAdd = 1) (hah : (a h).toAdd = 0) + (hbg : (b g).toAdd = 0) (hbh : (b h).toAdd = 1) : + ⇑(exponentCup a b) ∉ coboundaries₂ (Rep.trivial ℤ G ℤ) := by + rintro ⟨f, hf⟩ + have h₁ := congrFun hf (g, h) + have h₂ := congrFun hf (h, g) + change f h - f (g*h) + f g = (a g).toAdd * (b h).toAdd at h₁ + change f g - f (h*g) + f h = (a h).toAdd * (b g).toAdd at h₂ + rw [hag, hbh] at h₁ + rw [hah, hbg, ← hc.eq] at h₂ + change (f h : ℤ) - f (g*h) + f g = 1 * 1 at h₁ + change (f g : ℤ) - f (g*h) + f h = 0 * 0 at h₂ + linarith + +theorem exponentCup_class_ne_zero (a b : G →* Multiplicative ℤ) (g h : G) + (hc : Commute g h) + (hag : (a g).toAdd = 1) (hah : (a h).toAdd = 0) + (hbg : (b g).toAdd = 0) (hbh : (b h).toAdd = 1) : + H2π _ (exponentCup a b) ≠ 0 := by + intro he + exact exponentCup_not_coboundary a b g h hc hag hah hbg hbh + ((H2π_eq_zero_iff (A := Rep.trivial ℤ G ℤ) (exponentCup a b)).mp he) + +end CupCocycle + +section CliqueCohomology +open groupCohomology +variable {V : Type} (L : SimpleGraph V) + +theorem clique_exponent_class_nonzero (v w b : V) + (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : + ∃ x : H2 (Rep.trivial ℤ (height L).ker ℤ), x ≠ 0 := by + classical + let a := (generatorExponent L v).comp (height L).ker.subtype + let d := (generatorExponent L w).comp (height L).ker.subtype + have hvw' := L.ne_of_adj hvw + have hvb' := L.ne_of_adj hvb + have hwb' := L.ne_of_adj hwb + refine ⟨H2π _ (exponentCup a d), exponentCup_class_ne_zero a d + (heightDifference L v b) (heightDifference L w b) + (heightDifference_commute L v w b hvw hvb hwb) ?_ ?_ ?_ ?_⟩ + all_goals simp [a, d, heightDifference, hvw', hvw'.symm, hvb'.symm, hwb'.symm] + +end CliqueCohomology + + +open CategoryTheory CategoryTheory.Limits + +section +variable {C D : Type*} [Category* C] [Category* D] [Abelian C] [Abelian D] + {X Y : C} (P : ProjectiveResolution X) (F : C ⥤ D) + [F.Additive] [F.Full] [F.Faithful] + [F.PreservesProjectiveObjects] [F.PreservesHomology] + +/-- Vanishing in the literal projective-dimension sense forces every +2-cocycle in a projective resolution to be a coboundary; the fully faithful +exact functor permits us to use this for the representation/group-ring equivalence. -/ +theorem cocycle_boundary_of_projectiveDimension_lt_two + [HasProjectiveDimensionLT (F.obj X) 2] + (f : P.complex.X 2 ⟶ Y) (hf : P.complex.d 3 2 ≫ f = 0) : + ∃ g : P.complex.X 1 ⟶ Y, P.complex.d 2 1 ≫ g = f := by + let := HasExt.standard D + let Q := F.mapProjectiveResolution P + have hmf : Q.complex.d 3 2 ≫ F.map f = 0 := by + change F.map (P.complex.d 3 2) ≫ F.map f = 0 + rw [← F.map_comp, hf, F.map_zero] + have hc := Abelian.Ext.eq_zero_of_hasProjectiveDimensionLT (Q.extMk (F.map f) 3 rfl hmf) 2 (by rfl) + obtain ⟨g, hg⟩ := (Q.extMk_eq_zero_iff (F.map f) 3 rfl hmf 1 rfl).mp hc + change F.obj (P.complex.X 1) ⟶ F.obj Y at g + change F.map (P.complex.d 2 1) ≫ g = F.map f at hg + refine ⟨F.preimage g, F.map_injective ?_⟩ + rw [F.map_comp, F.map_preimage] + exact hg + +/-- The same vanishing expressed in the library's older linear-Yoneda model +of Ext. This theorem proves rather than assumes the bridge between the two APIs. -/ +theorem isZero_homology_two_of_projectiveDimension_lt_two + (R : Type*) [Ring R] [Linear R C] + [HasProjectiveDimensionLT (F.obj X) 2] : + IsZero ((P.complex.linearYonedaObj R Y).homology 2) := by + rw [← HomologicalComplex.exactAt_iff_isZero_homology] + rw [HomologicalComplex.exactAt_iff' _ 1 2 3 (by simp) (by simp)] + rw [ShortComplex.moduleCat_exact_iff] + intro f hf + change P.complex.d 3 2 ≫ f = 0 at hf + exact cocycle_boundary_of_projectiveDimension_lt_two P F f hf +end + +open CategoryTheory CategoryTheory.Limits + +theorem two_le_cohomologicalDimension_of_H2_nonzero (G : Type) [Group G] + (hx : ∃ x : groupCohomology.H2 (Rep.trivial ℤ G ℤ), x ≠ 0) : + 2 ≤ cohomologicalDimension G := by + change (2 : ℕ) ≤ CategoryTheory.projectiveDimension + (ModuleCat.of (MonoidAlgebra ℤ G) (Representation.trivial ℤ G ℤ).asModule) + rw [CategoryTheory.projectiveDimension_ge_iff] + intro hd + let F := Rep.toModuleMonoidAlgebra (k := ℤ) (G := G) + let P := Rep.barResolution ℤ G + let : F.Additive := Functor.additive_of_preserves_binary_products F + have : HasProjectiveDimensionLT (F.obj (Rep.trivial ℤ G ℤ)) 2 := hd + have hz := isZero_homology_two_of_projectiveDimension_lt_two + (Y := Rep.trivial ℤ G ℤ) P F ℤ + have hz' : IsZero (groupCohomology.H2 (Rep.trivial ℤ G ℤ)) := + hz.of_iso (groupCohomologyIso (Rep.trivial ℤ G ℤ) 2 P) + obtain ⟨x, hx⟩ := hx + exact hx ((ModuleCat.isZero_iff_subsingleton.mp hz').elim x 0) + +theorem height_kernel_two_le_cohomologicalDimension {V : Type} (L : SimpleGraph V) + (v w b : V) (hvw : L.Adj v w) (hvb : L.Adj v b) (hwb : L.Adj w b) : + 2 ≤ cohomologicalDimension (height L).ker := + two_le_cohomologicalDimension_of_H2_nonzero _ (clique_exponent_class_nonzero L v w b hvw hvb hwb) + +theorem source_two_le_cohomologicalDimension : 2 ≤ cohomologicalDimension SourceGroup := by + apply height_kernel_two_le_cohomologicalDimension seedGraph seedCliqueVertex seedCliqueEdge seedCliqueFace + · change properFace _ _ ∨ _ + left + simp [properFace, seedCliqueVertex, seedCliqueEdge, edgeVertices, circleStart] + · change properFace _ _ ∨ _ + left + simp [properFace, seedCliqueVertex, seedCliqueFace, sectorVertices, sectorEdges, edgeVertices, sectorCircleEdge, sectorLetter, seedWord, circleStart, circleEnd] + · change properFace _ _ ∨ _ + left + simp [properFace, seedCliqueEdge, seedCliqueFace, sectorEdges, sectorCircleEdge, sectorLetter, seedWord] +end EilenbergGanea + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/CubicalCover.lean b/lean/OAI/Topology/EilenbergGanea/CubicalCover.lean index 7fd4678c7c568c0ce4ab8fcf132ef1bf3b333eb5..dd721127b63e4c5287247c081967ccefad9138a1 100644 --- a/lean/OAI/Topology/EilenbergGanea/CubicalCover.lean +++ b/lean/OAI/Topology/EilenbergGanea/CubicalCover.lean @@ -1,822 +1,822 @@ -import OAI.AlgebraicTopology.Cubical.Realization -import OAI.AlgebraicTopology.Cubical.ArtinChains -import OAI.Topology.EilenbergGanea.Model -import OAI.Topology.EilenbergGanea.SeedConnection -import Mathlib.Topology.Covering.Quotient -import Mathlib.Topology.Covering.Deck -import Mathlib.Topology.Homotopy.Lifting - -namespace OAI - -noncomputable section - -open Classical Set Topology -open scoped Quaternion - -namespace EilenbergGanea.DescendingCube.Data -open CubeInterpolation -variable {G A : Type*} [Group G] {f : A → G} (D : Data f) -variable [Fintype A] - -omit [Fintype A] in -theorem cellComm (c : D.Cell) : (c.directions : Set A).Pairwise - (fun a b => Commute (f a) (f b)) := - fun _ ha _ hb he => D.commute c.top _ _ (c.subset ha) (c.subset hb) he - -omit [Fintype A] in -theorem ones_eq_filter (c : D.Cell) (x : D.Coordinates c) : - D.ones c x = c.directions.filter (fun a => D.fullCoord c x a = 1) := by - ext a - simp only [mem_ones,Finset.mem_filter] - constructor - · rintro ⟨ha,hx⟩ - exact ⟨ha,by simpa only [fullCoord,dite_eq_left ha] using hx⟩ - · rintro ⟨ha,hx⟩ - exact ⟨ha,by simpa only [fullCoord,dite_eq_left ha] using hx⟩ - -omit [Fintype A] in -theorem normalize_fullCoord (c : D.Cell) (x : D.Coordinates c) : - CubeInterpolation.normalize (D.fullCoord c x) = D.normalizedCoord c x := by - funext a - by_cases ha : a ∈ c.directions - · simp only [CubeInterpolation.normalize,fullCoord,normalizedCoord,dite_eq_left ha] - · simp [CubeInterpolation.normalize,fullCoord,normalizedCoord,ha] - -def interpolation (p : D.Point) (φ : G → ℝ) : ℝ := - operator f (D.active p) (D.cellComm (D.pointCell p)) p.coord φ p.top - -theorem active_characteristic_subset (c : D.Cell) (x : D.Coordinates c) : - D.active (D.characteristic c x) ⊆ c.directions := by - intro a ha - by_contra h - apply ((D.mem_active _ _).mp ha) - change D.normalizedCoord c x a = 0 - simp [normalizedCoord,h] - -theorem interpolation_characteristic (c : D.Cell) (x : D.Coordinates c) (φ : G → ℝ) : - D.interpolation (D.characteristic c x) φ = - operator f c.directions (D.cellComm c) (D.fullCoord c x) φ c.top := by - have hsub := D.active_characteristic_subset c x - have he := operator_subset f (D.active (D.characteristic c x)) c.directions - (D.cellComm c) hsub (D.normalizedCoord c x) (by - intro a _ hn - exact not_not.mp (by simpa only [mem_active,characteristic] using hn)) - have hn := operator_normalize f c.directions (D.cellComm c) (D.fullCoord c x) - simp only [normalize_fullCoord,← ones_eq_filter] at hn - have hh := congrArg (fun T : Module.End ℝ (G → ℝ) => T φ c.top) hn - rw [Module.End.mul_apply,translation_apply,he] at hh - exact hh.symm - -theorem interpolation_continuous (φ : G → ℝ) : - Continuous (fun p : D.Point => D.interpolation p φ) := by - apply D.evaluation_quotient.continuous_iff.mpr - apply continuous_sigma - intro c - change Continuous (fun x : D.Coordinates c => D.interpolation (D.characteristic c x) φ) - simp only [interpolation_characteristic] - exact operator_continuous f c.directions _ (D.fullCoord c) - (fun a _ => D.fullCoord_continuous c a) φ c.top - -theorem interpolation_vertex_pos (p : D.Point) : - 0 < D.interpolation p (fun a => if a = p.top then 1 else 0) := by - apply operator_pos - · intro a _; exact ⟨p.nonneg a,p.lt_one a⟩ - · intro a; split_ifs <;> norm_num - · simp - -omit [Fintype A] in -theorem descending_operator_delta_zero (s : Finset A) (g : G) (hs : s ⊆ D.desc g) - (x : A → ℝ) (b : G) (hb : D.length g ≤ D.length b) (hne : b ≠ g) : - operator f s (fun a ha d hd hne => D.commute g a d (hs ha) (hs hd) hne) - x (fun a => if a = b then 1 else 0) g = 0 := by - induction s using Finset.induction_on generalizing g with - | empty => simp [operator_empty,hne.symm] - | @insert a s ha ih => - have hga := hs (Finset.mem_insert_self a s) - have hs0 : s ⊆ D.desc g := fun d hd => hs (Finset.mem_insert_of_mem hd) - have hs1 : s ⊆ D.desc (g * f a) := by - intro d hd - exact D.preserve g a d hga (hs0 hd) (by intro he; exact ha (he ▸ hd)) - have hd := D.decrease g a hga - have hb1 : D.length (g*f a) ≤ D.length b := by omega - have hne1 : b ≠ g*f a := by intro he; rw [he] at hb; omega - have hc : (↑(insert a s) : Set A).Pairwise (fun a d => Commute (f a) (f d)) := - fun _ ha _ hd hne => D.commute g _ _ (hs ha) (hs hd) hne - change operator f (insert a s) hc x (fun a => if a = b then 1 else 0) g = 0 - rw [operator_insert f s a ha,Module.End.mul_apply,blend_apply] - rw [ih g hs0 hb hne,ih (g*f a) hs1 hb1 hne1] - ring - -theorem interpolation_vertex_zero (p : D.Point) (b : G) - (hb : D.length p.top ≤ D.length b) (hne : b ≠ p.top) : - D.interpolation p (fun a => if a = b then 1 else 0) = 0 := - D.descending_operator_delta_zero (D.active p) p.top (D.pointCell p).subset p.coord b hb hne - -theorem interpolation_top_eq (p q : D.Point) - (he : ∀ φ, D.interpolation p φ = D.interpolation q φ) : p.top = q.top := by - have length_le (p q : D.Point) (he : ∀ φ, D.interpolation p φ = D.interpolation q φ) : - D.length q.top ≤ D.length p.top := by - by_contra hn - have hlt : D.length p.top < D.length q.top := lt_of_not_ge hn - have hne : q.top ≠ p.top := by intro eq; rw [eq] at hlt; exact lt_irrefl _ hlt - have hz := D.interpolation_vertex_zero p q.top hlt.le hne - have hp := D.interpolation_vertex_pos q - rw [← he,hz] at hp - exact lt_irrefl _ hp - have h₁ := length_le p q he - by_contra hne - have hz := D.interpolation_vertex_zero q p.top h₁ hne - have hp := D.interpolation_vertex_pos p - rw [he,hz] at hp - exact lt_irrefl _ hp - -variable (exponent : A → G →* Multiplicative ℝ) -variable (hexponent : ∀ g a, a ∈ D.desc g → ∀ b, b ∈ D.desc g → - (exponent a (f b)).toAdd = if a = b then 1 else 0) - -include hexponent in -theorem interpolation_exponent (p : D.Point) (a : A) (ha : a ∈ D.desc p.top) : - D.interpolation p (fun g => (exponent a g).toAdd) = - (exponent a p.top).toAdd + p.coord a := by - refine (operator_linear f (exponent a) (D.active p) - (D.cellComm (D.pointCell p)) p.coord p.top).trans ?_ - congr 1 - have he : ∀ b ∈ D.active p, (exponent a (f b)).toAdd = if a = b then 1 else 0 := - fun b hb => hexponent p.top a ha b ((D.pointCell p).subset hb) - simp only [Finset.sum_congr rfl (fun b hb => congrArg (fun t : ℝ => p.coord b * t) (he b hb)), - mul_ite,mul_one,mul_zero,Finset.sum_ite_eq] - by_cases h : p.coord a = 0 - · simp [h] - · simp [mem_active,h] - -include exponent hexponent in -theorem interpolation_injective : Function.Injective - (fun p : D.Point => fun φ : G → ℝ => D.interpolation p φ) := by - intro p q he - have he' : ∀ φ, D.interpolation p φ = D.interpolation q φ := fun φ => congrFun he φ - have hb := D.interpolation_top_eq p q he' - apply Point.ext hb - funext a - by_cases ha : a ∈ D.desc p.top - · have hq : a ∈ D.desc q.top := by simpa only [hb] using ha - have hh := he' (fun g => (exponent a g).toAdd) - rw [D.interpolation_exponent exponent hexponent p a ha, - D.interpolation_exponent exponent hexponent q a hq,hb] at hh - exact add_left_cancel hh - · have hp : p.coord a = 0 := by_contra (fun hn => ha (p.support a hn)) - have hq : q.coord a = 0 := by - by_contra hn - exact ha (by simpa only [hb] using q.support a hn) - rw [hp,hq] - -include exponent hexponent in -theorem point_t2 : T2Space D.Point := - T2Space.of_injective_continuous - (D.interpolation_injective exponent hexponent) - (continuous_pi (fun φ => D.interpolation_continuous φ)) - -end EilenbergGanea.DescendingCube.Data - -open Classical Topology -namespace WeakRealization - -/-- A homeomorphism is induced by point-separating coordinates and actual -continuous lifts on each characteristic disk, in both directions. -/ -def homeomorph {ι κ X Y Z : Type*} {E : ι → Type*} {F : κ → Type*} - [TopologicalSpace X] [TopologicalSpace Y] - [∀ i, TopologicalSpace (E i)] [∀ j, TopologicalSpace (F j)] - (e : ((i : ι) × E i) → X) (f : ((j : κ) × F j) → Y) - (he : IsQuotientMap e) (hf : IsQuotientMap f) - (J : X → Z) (K : Y → Z) (hJ : Function.Injective J) (hK : Function.Injective K) - (hxy : ∀ i, ∃ φ : C(E i,Y), ∀ t, K (φ t) = J (e ⟨i,t⟩)) - (hyx : ∀ j, ∃ φ : C(F j,X), ∀ t, J (φ t) = K (f ⟨j,t⟩)) : X ≃ₜ Y := by - have hx : ∀ x, ∃ y, K y = J x := by - intro x - obtain ⟨⟨i,t⟩,rfl⟩ := he.surjective x - obtain ⟨φ,hφ⟩ := hxy i - exact ⟨φ t,hφ t⟩ - have hy : ∀ y, ∃ x, J x = K y := by - intro y - obtain ⟨⟨j,t⟩,rfl⟩ := hf.surjective y - obtain ⟨φ,hφ⟩ := hyx j - exact ⟨φ t,hφ t⟩ - let A : X → Y := fun x => (hx x).choose - let B : Y → X := fun y => (hy y).choose - have hA : ∀ x, K (A x) = J x := fun x => (hx x).choose_spec - have hB : ∀ y, J (B y) = K y := fun y => (hy y).choose_spec - refine { - toEquiv := { - toFun := A - invFun := B - left_inv := fun x => hJ ((hB (A x)).trans (hA x)) - right_inv := fun y => hK ((hA (B y)).trans (hB y)) } - continuous_toFun := ?_ - continuous_invFun := ?_ } - · apply he.continuous_iff.mpr - apply continuous_sigma - intro i - obtain ⟨φ,hφ⟩ := hxy i - have hh : (fun t => A (e ⟨i,t⟩)) = φ := by - funext t - exact hK ((hA _).trans (hφ t).symm) - change Continuous (fun t => A (e ⟨i,t⟩)) - rw [hh] - exact φ.continuous - · apply hf.continuous_iff.mpr - apply continuous_sigma - intro j - obtain ⟨φ,hφ⟩ := hyx j - have hh : (fun t => B (f ⟨j,t⟩)) = φ := by - funext t - exact hJ ((hB _).trans (hφ t).symm) - change Continuous (fun t => B (f ⟨j,t⟩)) - rw [hh] - exact φ.continuous - -end WeakRealization - -namespace EilenbergGanea.CubeInterpolation -open CubicalChains.Reorientation -variable {G V : Type*} [Group G] - -/-- Interpolation in a listed cube, independent of any topological model. -/ -def listed (f : V → G) (w : List V) (x : V → ℝ) : Module.End ℝ (G → ℝ) := - (w.map (fun v => blend (f v) (x v))).prod - -@[simp] theorem listed_nil (f : V → G) (x : V → ℝ) : listed f [] x = 1 := rfl -@[simp] theorem listed_cons (f : V → G) (v : V) (w : List V) (x : V → ℝ) : - listed f (v::w) x = blend (f v) (x v) * listed f w x := rfl - -theorem operator_listed [DecidableEq V] (f : V → G) (w : List V) (hw : w.Nodup) - (hc : (w.toFinset : Set V).Pairwise (fun v u => Commute (f v) (f u))) (x : V → ℝ) : - operator f w.toFinset hc x = listed f w x := - Finset.noncommProd_toFinset w _ _ hw - -/-- Literal multilinear invariance under reversing selected cube directions. -/ -theorem listed_reorientation (f : V → G) (w : List (Signed V)) - (hw : w.Pairwise (fun a b => Commute (f a.1) (f b.1))) - (x : Signed V → ℝ) (z : V → ℝ) - (hx : ∀ a ∈ w, x a = if a.2 then 1-z a.1 else z a.1) (φ : G → ℝ) (g : G) : - listed (step f) w x φ g = listed f (w.map Prod.fst) z φ (origin f g w) := by - induction w generalizing g with - | nil => rfl - | cons a w ih => - obtain ⟨ha,hw⟩ := List.pairwise_cons.mp hw - have hxw : ∀ b ∈ w, x b = if b.2 then 1-z b.1 else z b.1 := - fun b hb => hx b (by simp [hb]) - simp only [listed_cons,List.map_cons,Module.End.mul_apply,blend_apply, - ih hw hxw,hx a (by simp),step,origin] - cases hb : a.2 - · simp only [Bool.false_eq_true,↓reduceIte] - rw [origin_shift f g (f a.1) w ha] - · simp only [↓reduceIte] - rw [origin_shift f g (f a.1)⁻¹ w (fun b hb => (ha b hb).inv_left), - inv_mul_cancel_right] - ring - -end EilenbergGanea.CubeInterpolation - -namespace EilenbergGanea.ArtinCubicalTopology -open TraceWords CubeInterpolation CubicalChains.Reorientation -variable {V : Type*} [Fintype V] (L : SimpleGraph V) - -local instance : Std.Symm L.Adj := ⟨fun _ _ h => h.symm⟩ -local instance : Std.Irrefl L.Adj := ⟨fun _ => L.irrefl⟩ - -abbrev f := artinGenerator L -abbrev comm := fun v w h => adjacent_generators_commute L (v := v) (w := w) h -abbrev D := artinDescendingData L -abbrev Positive := CubeRealization.Point L (f L) (comm L) -abbrev Descending := (D L).Point - -omit [Fintype V] in -@[simp] theorem step_eq (a : Letter V) : step (f L) a = letterValue (f L) (invLetter a) := by - cases a with | mk v b => cases b <;> rfl - -def exponent (v : V) : ArtinGroup L →* Multiplicative ℝ := - artinLift L (fun w => Multiplicative.ofAdd (if v = w then (1 : ℝ) else 0)) - (fun _ _ _ => Commute.all _ _) - -omit [Fintype V] in -@[simp] theorem exponent_generator (v w : V) : - (exponent L v (f L w)).toAdd = if v = w then 1 else 0 := by - simp [exponent,f] - -omit [Fintype V] in -@[simp] theorem height_generator (v : V) : (height L (f L v)).toAdd = 1 := by - exact congrArg Multiplicative.toAdd (PresentedGroup.toGroup.of _) - -def signedExponent (a : Letter V) : ArtinGroup L →* Multiplicative ℝ := - artinLift L (fun v => Multiplicative.ofAdd - (if a.1 = v then (if a.2 then (-1 : ℝ) else 1) else 0)) - (fun _ _ _ => Commute.all _ _) - -theorem signedExponent_step (g : ArtinGroup L) (a : Letter V) (ha : a ∈ (D L).desc g) - (b : Letter V) (hb : b ∈ (D L).desc g) : - (signedExponent L a (letterValue (f L) (invLetter b))).toAdd = if a = b then 1 else 0 := by - by_cases he : a = b - · subst b - rcases a with ⟨v,b⟩ - cases b <;> simp [signedExponent,letterValue,invLetter,f] - · have hi : Independent L a b := rightDescents_pairwise L g - (by simpa [D,artinDescendingData] using ha) (by simpa [D,artinDescendingData] using hb) he - have hv : a.1 ≠ b.1 := hi.ne - rcases b with ⟨v,b⟩ - cases b <;> simp [signedExponent,letterValue,invLetter,f,hv,he] - -theorem positive_interp_inj : Function.Injective - (fun p : Positive L => fun φ => CubeRealization.interpolation L (f L) (comm L) p φ) := - CubeRealization.interpolation_injective L (f L) (comm L) (height L) (height_generator L) - (exponent L) (exponent_generator L) - -theorem descending_interp_inj : Function.Injective - (fun p : Descending L => fun φ => (D L).interpolation p φ) := - (D L).interpolation_injective (signedExponent L) (by - intro g a ha b hb - by_cases he : a = b <;> simpa [he] using signedExponent_step L g a ha b hb) - -def flip (b : Bool) (t : unitInterval) : unitInterval := - if b then unitInterval.symm t else t - -@[simp] theorem flip_flip (b : Bool) (t : unitInterval) : flip b (flip b t) = t := by - cases b <;> simp [flip] - -theorem flip_continuous (b : Bool) : Continuous (flip b) := by - cases b - · exact continuous_id - · exact unitInterval.continuous_symm - -def vertexEquiv (w : Word V) (hw : (w.map Prod.fst).Nodup) : - w.toFinset ≃ (w.map Prod.fst).toFinset := - Equiv.ofBijective (fun a => ⟨a.val.1,by - exact List.mem_toFinset.mpr (List.mem_map.mpr ⟨a.val,List.mem_toFinset.mp a.property,rfl⟩)⟩) (by - constructor - · intro a b he - apply Subtype.ext - exact (List.nodup_map_iff_inj_on (hw.of_map Prod.fst)).mp hw - a.val (List.mem_toFinset.mp a.property) b.val (List.mem_toFinset.mp b.property) (congrArg Subtype.val he) - · intro v - obtain ⟨a,ha,he⟩ := List.mem_map.mp (List.mem_toFinset.mp v.property) - exact ⟨⟨a,by simpa using ha⟩,Subtype.ext he⟩) - -omit [Fintype V] in -@[simp] theorem vertexEquiv_val (w : Word V) (hw : (w.map Prod.fst).Nodup) - (a : w.toFinset) : (vertexEquiv w hw a).val = a.val.1 := rfl - -def toPositiveCoords (w : Word V) (hw : (w.map Prod.fst).Nodup) - (x : w.toFinset → unitInterval) : (w.map Prod.fst).toFinset → unitInterval := - fun v => flip ((vertexEquiv w hw).symm v).val.2 (x ((vertexEquiv w hw).symm v)) - -omit [Fintype V] in -@[simp] theorem toPositiveCoords_apply (w : Word V) (hw : (w.map Prod.fst).Nodup) - (x : w.toFinset → unitInterval) (a : w.toFinset) : - toPositiveCoords w hw x (vertexEquiv w hw a) = flip a.val.2 (x a) := by - simp [toPositiveCoords] - -omit [Fintype V] in -theorem toPositiveCoords_continuous (w : Word V) (hw : (w.map Prod.fst).Nodup) : - Continuous (toPositiveCoords w hw) := - continuous_pi (fun _ => (flip_continuous _).comp (continuous_apply _)) - -def toDescendingCoords (w : Word V) (hw : (w.map Prod.fst).Nodup) - (z : (w.map Prod.fst).toFinset → unitInterval) : w.toFinset → unitInterval := - fun a => flip a.val.2 (z (vertexEquiv w hw a)) - -omit [Fintype V] in -theorem toDescendingCoords_continuous (w : Word V) (hw : (w.map Prod.fst).Nodup) : - Continuous (toDescendingCoords w hw) := - continuous_pi (fun _ => (flip_continuous _).comp (continuous_apply _)) - -omit [Fintype V] in -@[simp] theorem toPositive_toDescending (w : Word V) (hw : (w.map Prod.fst).Nodup) - (z : (w.map Prod.fst).toFinset → unitInterval) : - toPositiveCoords w hw (toDescendingCoords w hw z) = z := by - funext v - obtain ⟨a,rfl⟩ := (vertexEquiv w hw).surjective v - simp [toDescendingCoords] - -def positiveCell (g : ArtinGroup L) (w : Word V) (hw : (w.map Prod.fst).Pairwise L.Adj) : - CubeRealization.Cell (G := ArtinGroup L) L where - base := origin (f L) g w - directions := (w.map Prod.fst).toFinset - clique := fun _ ha _ hb he => hw.forall (List.mem_toFinset.mp ha) (List.mem_toFinset.mp hb) he - -def descendingCell (g : ArtinGroup L) (w : Word V) - (hd : ∀ a ∈ w, a ∈ rightDescents L g) : (D L).Cell where - top := g - directions := w.toFinset - subset a ha := by simpa [D,artinDescendingData] using hd a (List.mem_toFinset.mp ha) - -theorem interpolation_reorientation (g : ArtinGroup L) (w : Word V) - (hw : (w.map Prod.fst).Pairwise L.Adj) (hd : ∀ a ∈ w, a ∈ rightDescents L g) - (x : (D L).Coordinates (descendingCell L g w hd)) (φ : ArtinGroup L → ℝ) : - (D L).interpolation ((D L).characteristic (descendingCell L g w hd) x) φ = - CubeRealization.interpolation L (f L) (comm L) - (CubeRealization.characteristic (f L) (comm L) (positiveCell L g w hw) - (toPositiveCoords w hw.nodup x)) φ := by - refine ((D L).interpolation_characteristic (descendingCell L g w hd) x φ).trans ?_ - refine Eq.trans ?_ (CubeRealization.interpolation_characteristic L (f L) (comm L) - (positiveCell L g w hw) (toPositiveCoords w hw.nodup x) φ).symm - have hf : (fun a : Letter V => letterValue (artinGenerator L) (invLetter a)) = step (f L) := - funext (fun a => (step_eq L a).symm) - erw [operator_listed _ w (hw.nodup.of_map Prod.fst),operator_listed _ _ hw.nodup] - have hop := congrArg (fun k : Letter V → ArtinGroup L => listed k w) hf - rw [hop] - apply listed_reorientation - · exact (List.pairwise_map.mp hw).imp (fun hh => adjacent_generators_commute L hh) - · intro a ha - let aa : w.toFinset := ⟨a,by simpa using ha⟩ - have h₁ : (D L).fullCoord (descendingCell L g w hd) x a = (x aa : ℝ) := by - exact (D L).fullCoord_mem (descendingCell L g w hd) x aa - have h₂ : CubeRealization.fullCoord (positiveCell L g w hw) - (toPositiveCoords w hw.nodup x) a.1 = (flip a.2 (x aa) : ℝ) := by - have hh := CubeRealization.fullCoord_mem (positiveCell L g w hw) - (toPositiveCoords w hw.nodup x) (vertexEquiv w hw.nodup aa) - exact hh.trans (congrArg (fun z : unitInterval => (z : ℝ)) - (toPositiveCoords_apply w hw.nodup x aa)) - rw [h₁,h₂] - cases h : a.2 <;> simp [flip] - -theorem descendingCell_rep (c : (D L).Cell) : - ∃ (g : ArtinGroup L) (w : Word V) (_hw : (w.map Prod.fst).Pairwise L.Adj) - (hd : ∀ a ∈ w, a ∈ rightDescents L g), descendingCell L g w hd = c := by - let w := c.directions.toList - have hd : ∀ a ∈ w, a ∈ rightDescents L c.top := by - intro a ha - have hh := c.subset (Finset.mem_toList.mp ha) - simpa [D,artinDescendingData] using hh - have hw : (w.map Prod.fst).Pairwise L.Adj := by - apply List.pairwise_map.mpr - apply c.directions.nodup_toList.pairwise_of_forall_ne - intro a ha b hb he - exact rightDescents_pairwise L c.top (hd a ha) (hd b hb) he - refine ⟨c.top,w,hw,hd,?_⟩ - cases c with - | mk g s hs => - dsimp only [descendingCell,w] - congr - exact s.toList_toFinset - -omit [Fintype V] in -theorem positiveCell_rep (c : CubeRealization.Cell (G := ArtinGroup L) L) : - ∃ (g : ArtinGroup L) (w : Word V) (hw : (w.map Prod.fst).Pairwise L.Adj) - (_hd : ∀ a ∈ w, a ∈ rightDescents L g), positiveCell L g w hw = c := by - let v := c.directions.toList - have hv : v.Pairwise L.Adj := c.directions.nodup_toList.pairwise_of_forall_ne - (fun a ha b hb he => c.clique (Finset.mem_toList.mp ha) (Finset.mem_toList.mp hb) he) - let o := CubeDescents.orient L c.base v - have hw : (o.2.map Prod.fst).Pairwise L.Adj := by - simpa only [o,CubeDescents.orient_map] using hv - have hd : ∀ a ∈ o.2, a ∈ rightDescents L o.1 := CubeDescents.orient_descents L c.base v hv - refine ⟨o.1,o.2,hw,hd,?_⟩ - have hb : origin (f L) o.1 o.2 = c.base := CubeDescents.origin_orient L c.base v hv - have hs : (o.2.map Prod.fst).toFinset = c.directions := by - simp only [o,CubeDescents.orient_map,v,Finset.toList_toFinset] - cases c with - | mk g s hc => - change CubeRealization.Cell.mk (origin (f L) o.1 o.2) (o.2.map Prod.fst).toFinset _ = _ - congr - -theorem descending_local_lift (c : (D L).Cell) : - ∃ φ : C((D L).Coordinates c,Positive L), ∀ x, - (fun ψ => CubeRealization.interpolation L (f L) (comm L) (φ x) ψ) = - (fun ψ => (D L).interpolation ((D L).characteristic c x) ψ) := by - obtain ⟨g,w,hw,hd,rfl⟩ := descendingCell_rep L c - refine ⟨⟨fun x => CubeRealization.characteristic (f L) (comm L) (positiveCell L g w hw) - (toPositiveCoords w hw.nodup x), - (CubeRealization.characteristic_continuous (f L) (comm L) (positiveCell L g w hw)).comp - (toPositiveCoords_continuous w hw.nodup)⟩,?_⟩ - intro x - funext ψ - exact (interpolation_reorientation L g w hw hd x ψ).symm - -theorem positive_local_lift (c : CubeRealization.Cell (G := ArtinGroup L) L) : - ∃ φ : C(CubeRealization.Coordinates c,Descending L), ∀ x, - (fun ψ => (D L).interpolation (φ x) ψ) = - (fun ψ => CubeRealization.interpolation L (f L) (comm L) - (CubeRealization.characteristic (f L) (comm L) c x) ψ) := by - obtain ⟨g,w,hw,hd,rfl⟩ := positiveCell_rep L c - refine ⟨⟨fun x => (D L).characteristic (descendingCell L g w hd) (toDescendingCoords w hw.nodup x), - ((D L).characteristic_continuous (descendingCell L g w hd)).comp - (toDescendingCoords_continuous w hw.nodup)⟩,?_⟩ - intro x - funext ψ - change (D L).interpolation ((D L).characteristic (descendingCell L g w hd) - (toDescendingCoords w hw.nodup x)) ψ = _ - change (w.map Prod.fst).toFinset → unitInterval at x - simpa only [toPositive_toDescending] using interpolation_reorientation L g w hw hd - (toDescendingCoords w hw.nodup x) ψ - -/-- Reorientation preserves the actual weak topologies, not only cellular chains. -/ -def reorient : Descending L ≃ₜ Positive L := - WeakRealization.homeomorph (D L).evaluation (CubeRealization.evaluation (f L) (comm L)) - (D L).evaluation_quotient (CubeRealization.evaluation_quotient (f L) (comm L)) - (fun p ψ => (D L).interpolation p ψ) - (fun p ψ => CubeRealization.interpolation L (f L) (comm L) p ψ) - (descending_interp_inj L) (positive_interp_inj L) - (descending_local_lift L) (positive_local_lift L) - -variable [Nonempty V] - -/-- The ordinary positive-cube CW realization is genuinely contractible. -/ -theorem positive_contractible : ContractibleSpace (Positive L) := by - let : ContractibleSpace (Descending L) := artinDescending_contractible L - exact (reorient L).symm.contractibleSpace - -end EilenbergGanea.ArtinCubicalTopology - -open Classical Set Topology -namespace CompactChart - -/-- A characteristic map which has singleton fibers over its open cell has a -continuous inverse there. Compactness is used only on the closed disk; no -regularity of the attaching sphere is required. -/ -theorem continuousOn_symm {A X : Type*} [TopologicalSpace A] [TopologicalSpace X] - [T2Space X] (e : PartialEquiv A X) (K : Set A) (hK : IsCompact K) - (hsub : e.source ⊆ K) (hc : ContinuousOn e K) - (hboundary : ∀ a ∈ K, e a ∈ e.target → a ∈ e.source) : - ContinuousOn e.symm e.target := by - let : CompactSpace K := isCompact_iff_compactSpace.mp hK - let f : K → X := fun a => e a - have hf : Continuous f := continuousOn_iff_continuous_domRestrict.mp hc - let r := e.target.restrictPreimage f - have hr : Function.Surjective r := by - intro x - refine ⟨⟨⟨e.symm x,hsub (e.map_target x.property)⟩,?_⟩,?_⟩ - · change e (e.symm x) ∈ e.target - rw [e.right_inv x.property] - exact x.property - · exact Subtype.ext (e.right_inv x.property) - have hq : IsQuotientMap r := - (hf.isClosedMap.restrictPreimage e.target).isQuotientMap hf.restrictPreimage hr - apply continuousOn_iff_continuous_domRestrict.mpr - apply hq.continuous_iff.mpr - have he : (fun x : e.target => e.symm x) ∘ r = - (fun a : f ⁻¹' e.target => (a.val.val : A)) := by - funext a - exact e.left_inv (hboundary a.val a.val.property a.property) - change Continuous ((fun x : e.target => e.symm x) ∘ r) - rw [he] - exact continuous_subtype_val.comp continuous_subtype_val - -end CompactChart - -namespace EilenbergGanea.CubeRealization - -section -open Metric -variable {G V : Type*} [Group G] [Fintype V] -variable {L : SimpleGraph V} (f : V → G) -variable (comm : ∀ v w, L.Adj v w → Commute (f v) (f w)) - -theorem chartInverse_continuousOn_of_t2 [T2Space (Point (G := G) L f comm)] - {n : ℕ} (c : DimCell (G := G) (L := L) n) : - ContinuousOn (chart f comm c).symm (chart f comm c).target := by - apply CompactChart.continuousOn_symm (chart f comm c) (closedBall 0 1) - (isCompact_closedBall _ _) ball_subset_closedBall (chart_continuous f comm c).continuousOn - intro t ht he - change pointCell (chart f comm c t) = c.val at he - change t ∈ ball 0 1 - by_contra hn - have hs : t ∈ sphere 0 1 := mem_sphere.mpr - (le_antisymm (mem_closedBall.mp ht) (le_of_not_gt hn)) - have hd := boundary_dimension_lt f comm c hs - rw [he,c.property] at hd - exact (lt_irrefl _) hd - -/-- The ordinary CW structure follows from the genuine normalized-cube gluing; -only Hausdorffness and compact characteristic disks are used. -/ -@[instance_reducible] def cwComplexOfT2 [T2Space (Point (G := G) L f comm)] : CWComplex (univ : Set (Point (G := G) L f comm)) where - cell := DimCell (G := G) (L := L) - map := fun _ c => chart f comm c - source_eq := fun _ _ => rfl - continuousOn := fun _ c => (chart_continuous f comm c).continuousOn - continuousOn_symm := fun _ c => chartInverse_continuousOn_of_t2 f comm c - pairwiseDisjoint' := by - intro a _ b _ hab - change Disjoint (chart f comm a.2 '' ball 0 1) (chart f comm b.2 '' ball 0 1) - rw [chart_image_ball,chart_image_ball] - apply Set.disjoint_left.mpr - intro p ha hb - apply hab - have he : a.2.val = b.2.val := ha.symm.trans hb - have hn : a.1 = b.1 := a.2.property.symm.trans ((congrArg (fun c => c.directions.card) he).trans b.2.property) - cases a with | mk n a => - cases b with | mk m b => - dsimp at hn - subst m - exact congrArg (Sigma.mk n) (Subtype.ext he) - mapsTo' := chart_mapsTo f comm - closed' := by - intro A _ hA - apply (evaluation_quotient f comm).isClosed_preimage.mp - rw [isClosed_sigma_iff] - intro c - let d : DimCell (G := G) (L := L) c.directions.card := ⟨c,rfl⟩ - have hh := (hA _ d).preimage (characteristic_continuous f comm c) - rw [chart_image_disk] at hh - change IsClosed (characteristic f comm c ⁻¹' (A ∩ Set.range (characteristic f comm c))) at hh - change IsClosed (characteristic f comm c ⁻¹' A) - simpa only [Set.preimage_inter,Set.preimage_range,Set.inter_univ] using hh - union' := by - apply Set.eq_univ_of_forall - intro p - let d : DimCell (G := G) (L := L) (pointCell p).directions.card := ⟨pointCell p,rfl⟩ - apply Set.mem_iUnion.mpr - refine ⟨_,Set.mem_iUnion.mpr ⟨d,?_⟩⟩ - rw [chart_image_disk] - exact ⟨pointCoordinates p,characteristic_point f comm p⟩ - -end - -variable {G Q V : Type*} [Group G] [Group Q] [Fintype V] -variable {L : SimpleGraph V} (f : V → G) -variable (comm : ∀ v w, L.Adj v w → Commute (f v) (f w)) -variable (q : G →* Q) - -include comm in -omit [Fintype V] in -theorem mappedComm : ∀ v w, L.Adj v w → Commute ((q ∘ f) v) ((q ∘ f) w) := - fun v w hvw => (comm v w hvw).map q - -/-- Applying a group homomorphism only to the initial vertices of cubes. -/ -def mapPoint (p : Point (G := G) L f comm) : Point (G := Q) L (q ∘ f) (mappedComm f comm q) where - base := q p.base - coord := p.coord - nonneg := p.nonneg - lt_one := p.lt_one - clique := p.clique - -def mapCell (c : Cell (G := G) L) : Cell (G := Q) L where - base := q c.base - directions := c.directions - clique := c.clique - -omit [Fintype V] in -@[simp] theorem mapPoint_base (p : Point (G := G) L f comm) : - (mapPoint f comm q p).base = q p.base := rfl - -omit [Fintype V] in -@[simp] theorem mapPoint_coord (p : Point (G := G) L f comm) : - (mapPoint f comm q p).coord = p.coord := rfl - -omit [Fintype V] in -@[simp] theorem mapPoint_characteristic (c : Cell (G := G) L) (x : Coordinates c) : - mapPoint f comm q (characteristic f comm c x) = - characteristic (q ∘ f) (mappedComm f comm q) (mapCell q c) x := by - apply Point.ext - · change q (c.base * product f comm (ones c x) _) = - q c.base * product (q ∘ f) (mappedComm f comm q) (ones c x) _ - rw [map_mul] - congr 1 - exact Finset.map_noncommProd _ _ _ q - · rfl - -theorem mapPoint_continuous : Continuous (mapPoint f comm q) := by - apply (evaluation_quotient f comm).continuous_iff.mpr - apply continuous_sigma - intro c - change Continuous (fun x => mapPoint f comm q (characteristic f comm c x)) - simp only [mapPoint_characteristic] - exact characteristic_continuous (q ∘ f) (mappedComm f comm q) (mapCell q c) - -omit [Fintype V] in -theorem mapCell_surjective (hq : Function.Surjective q) : Function.Surjective (mapCell (L := L) q) := by - rintro ⟨a,s,hs⟩ - obtain ⟨g,rfl⟩ := hq a - exact ⟨⟨g,s,hs⟩,rfl⟩ - -omit [Fintype V] in -theorem mapPoint_surjective (hq : Function.Surjective q) : Function.Surjective (mapPoint f comm q) := by - rintro ⟨a,x,hx,ht,hc⟩ - obtain ⟨g,rfl⟩ := hq a - exact ⟨⟨g,x,hx,ht,hc⟩,rfl⟩ - -/-- The base-label quotient is a genuine topological quotient for the weak -cubical topologies, proved by lifting each actual characteristic disk. -/ -theorem mapPoint_quotient (hq : Function.Surjective q) : IsQuotientMap (mapPoint f comm q) := by - apply isQuotientMap_iff_isClosed.mpr - refine ⟨mapPoint_surjective f comm q hq,?_⟩ - intro A - constructor - · exact fun hA => hA.preimage (mapPoint_continuous f comm q) - · intro hA - apply (evaluation_quotient (q ∘ f) (mappedComm f comm q)).isClosed_preimage.mp - rw [isClosed_sigma_iff] - intro c - obtain ⟨d,rfl⟩ := mapCell_surjective q hq c - have hh := hA.preimage (characteristic_continuous f comm d) - change IsClosed ((fun x => mapPoint f comm q (characteristic f comm d x)) ⁻¹' A) at hh - change IsClosed ((fun x : Coordinates d => - characteristic (q ∘ f) (mappedComm f comm q) (mapCell q d) x) ⁻¹' A) - simpa only [mapPoint_characteristic] using hh - -omit [Fintype V] in -/-- The literal group-kernel orbits are exactly the fibers of the cube map. -/ -theorem mapPoint_eq_iff_orbit (p r : Point (G := G) L f comm) : - mapPoint f comm q p = mapPoint f comm q r ↔ p ∈ MulAction.orbit q.ker r := by - constructor - · intro he - have hb : q p.base = q r.base := congrArg Point.base he - have hx : p.coord = r.coord := congrArg (fun z : Point (G := Q) L (q ∘ f) - (mappedComm f comm q) => z.coord) he - let g : q.ker := ⟨p.base * r.base⁻¹,by simp only [MonoidHom.mem_ker,map_mul,map_inv,hb,mul_inv_cancel]⟩ - refine ⟨g,?_⟩ - apply Point.ext - · change (p.base * r.base⁻¹) * r.base = p.base - simp [mul_assoc] - · exact hx.symm - · rintro ⟨g,rfl⟩ - apply Point.ext - · change q ((g : G) * r.base) = q r.base - rw [map_mul,g.property,one_mul] - · rfl - -/-- The quotient homeomorphism respects the actual weak topologies. -/ -def kernelQuotientHomeomorph (hq : Function.Surjective q) : - Quotient (MulAction.orbitRel q.ker (Point (G := G) L f comm)) ≃ₜ - Point (G := Q) L (q ∘ f) (mappedComm f comm q) := - (Homeomorph.Quotient.congrRight (fun p r => (mapPoint_eq_iff_orbit f comm q p r).symm)).trans - (Topology.IsQuotientMap.homeomorph (f := ⟨mapPoint f comm q,mapPoint_continuous f comm q⟩) - (mapPoint_quotient f comm q hq)) - -variable (h : G →* Multiplicative ℤ) (hf : ∀ v, (h (f v)).toAdd = 1) -variable (exponent : V → G →* Multiplicative ℝ) -variable (hexponent : ∀ v w, (exponent v (f w)).toAdd = if v = w then 1 else 0) - -include h hf exponent hexponent in -theorem quotientPoint_t2 (hq : Function.Surjective q) : - T2Space (Point (G := Q) L (q ∘ f) (mappedComm f comm q)) := by - let := point_t2 L f comm h hf exponent hexponent - let := point_weaklyLocallyCompact L f comm - exact (kernelQuotientHomeomorph f comm q hq).t2Space - -include h hf exponent hexponent in -theorem mapPoint_covering (hq : Function.Surjective q) : - IsQuotientCoveringMap (mapPoint f comm q) q.ker where - toIsQuotientMap := mapPoint_quotient f comm q hq - continuous_const_smul := continuous_const_smul - apply_eq_iff_mem_orbit := mapPoint_eq_iff_orbit f comm q _ _ - disjoint := (subgroup_quotient_covering f comm h hf exponent hexponent q.ker).disjoint - -end EilenbergGanea.CubeRealization - -namespace EilenbergGanea -universe u -namespace ArtinCubicalTopology -open CubeRealization -variable {V : Type u} [Fintype V] [Nonempty V] (L : SimpleGraph V) - -omit [Fintype V] in -theorem height_surjective : Function.Surjective (height L) := by - intro n - let v : V := Classical.choice inferInstance - refine ⟨f L v ^ n.toAdd,?_⟩ - rw [map_zpow] - apply Multiplicative.toAdd.injective - change n.toAdd • (height L (f L v)).toAdd = n.toAdd - simp only [height_generator,zsmul_eq_mul,mul_one,Int.cast_id] - -def HeightQuotient := Point L ((height L) ∘ f L) (mappedComm (f L) (comm L) (height L)) - -instance : TopologicalSpace (HeightQuotient L) := inferInstanceAs (TopologicalSpace - (Point L ((height L) ∘ f L) (mappedComm (f L) (comm L) (height L)))) - -/-- An ordinary cubical classifying space for the height kernel, with one cube -for every integral level and clique. Contractibility above is the explicit -word-length contraction, and the fundamental-group identification reuses -Mathlib's checked covering-monodromy equivalence. -/ -theorem height_hasClassifyingSpace (d : ℕ) - (hd : ∀ s : Finset V, (s : Set V).Pairwise L.Adj → s.card ≤ d) : - HasClassifyingSpace.{u} (height L).ker d := by - let X := Point L ((height L) ∘ f L) (mappedComm (f L) (comm L) (height L)) - let E := Positive L - let : ContractibleSpace E := positive_contractible L - let : T2Space X := quotientPoint_t2 (f L) (comm L) (height L) - (height L) (height_generator L) (exponent L) (exponent_generator L) (height_surjective L) - let : Topology.CWComplex (Set.univ : Set X) := - cwComplexOfT2 ((height L) ∘ f L) (mappedComm (f L) (comm L) (height L)) - let p : E → X := mapPoint (f L) (comm L) (height L) - have hp : IsQuotientCoveringMap p (height L).ker := - mapPoint_covering (f L) (comm L) (height L) (height L) (height_generator L) - (exponent L) (exponent_generator L) (height_surjective L) - have hs : Function.Surjective p := mapPoint_surjective (f L) (comm L) (height L) (height_surjective L) - let : PathConnectedSpace X := hs.pathConnectedSpace hp.continuous - let e : E := Classical.choice (inferInstance : Nonempty E) - refine ⟨X,inferInstance,inferInstance,inferInstance,?_,inferInstance,p e,?_, - E,inferInstance,inferInstance,p,hp.isCoveringMap,hs⟩ - · intro k hk - exact ⟨fun c => Nat.not_lt_of_ge ((c.property.symm ▸ hd c.val.directions c.val.clique)) hk⟩ - · exact ⟨(hp.fundamentalGroupEquiv ⟨e,rfl⟩).trans (MulEquiv.inv' ((height L).ker)).symm⟩ - -end ArtinCubicalTopology - -/-- The fixed source group has an ordinary three-dimensional classifying CW -space, with an actually contractible surjective covering. -/ -theorem source_hasClassifyingSpace_three : HasClassifyingSpace.{0} SourceGroup 3 := - ArtinCubicalTopology.height_hasClassifyingSpace seedGraph 3 SeedConnection.clique_card_le_three -end EilenbergGanea - -end - -end OAI +import OAI.AlgebraicTopology.Cubical.Realization +import OAI.AlgebraicTopology.Cubical.ArtinChains +import OAI.Topology.EilenbergGanea.Model +import OAI.Topology.EilenbergGanea.SeedConnection +import Mathlib.Topology.Covering.Quotient +import Mathlib.Topology.Covering.Deck +import Mathlib.Topology.Homotopy.Lifting + +namespace OAI + +noncomputable section + +open Classical Set Topology +open scoped Quaternion + +namespace EilenbergGanea.DescendingCube.Data +open CubeInterpolation +variable {G A : Type*} [Group G] {f : A → G} (D : Data f) +variable [Fintype A] + +omit [Fintype A] in +theorem cellComm (c : D.Cell) : (c.directions : Set A).Pairwise + (fun a b => Commute (f a) (f b)) := + fun _ ha _ hb he => D.commute c.top _ _ (c.subset ha) (c.subset hb) he + +omit [Fintype A] in +theorem ones_eq_filter (c : D.Cell) (x : D.Coordinates c) : + D.ones c x = c.directions.filter (fun a => D.fullCoord c x a = 1) := by + ext a + simp only [mem_ones,Finset.mem_filter] + constructor + · rintro ⟨ha,hx⟩ + exact ⟨ha,by simpa only [fullCoord,dite_eq_left ha] using hx⟩ + · rintro ⟨ha,hx⟩ + exact ⟨ha,by simpa only [fullCoord,dite_eq_left ha] using hx⟩ + +omit [Fintype A] in +theorem normalize_fullCoord (c : D.Cell) (x : D.Coordinates c) : + CubeInterpolation.normalize (D.fullCoord c x) = D.normalizedCoord c x := by + funext a + by_cases ha : a ∈ c.directions + · simp only [CubeInterpolation.normalize,fullCoord,normalizedCoord,dite_eq_left ha] + · simp [CubeInterpolation.normalize,fullCoord,normalizedCoord,ha] + +def interpolation (p : D.Point) (φ : G → ℝ) : ℝ := + operator f (D.active p) (D.cellComm (D.pointCell p)) p.coord φ p.top + +theorem active_characteristic_subset (c : D.Cell) (x : D.Coordinates c) : + D.active (D.characteristic c x) ⊆ c.directions := by + intro a ha + by_contra h + apply ((D.mem_active _ _).mp ha) + change D.normalizedCoord c x a = 0 + simp [normalizedCoord,h] + +theorem interpolation_characteristic (c : D.Cell) (x : D.Coordinates c) (φ : G → ℝ) : + D.interpolation (D.characteristic c x) φ = + operator f c.directions (D.cellComm c) (D.fullCoord c x) φ c.top := by + have hsub := D.active_characteristic_subset c x + have he := operator_subset f (D.active (D.characteristic c x)) c.directions + (D.cellComm c) hsub (D.normalizedCoord c x) (by + intro a _ hn + exact not_not.mp (by simpa only [mem_active,characteristic] using hn)) + have hn := operator_normalize f c.directions (D.cellComm c) (D.fullCoord c x) + simp only [normalize_fullCoord,← ones_eq_filter] at hn + have hh := congrArg (fun T : Module.End ℝ (G → ℝ) => T φ c.top) hn + rw [Module.End.mul_apply,translation_apply,he] at hh + exact hh.symm + +theorem interpolation_continuous (φ : G → ℝ) : + Continuous (fun p : D.Point => D.interpolation p φ) := by + apply D.evaluation_quotient.continuous_iff.mpr + apply continuous_sigma + intro c + change Continuous (fun x : D.Coordinates c => D.interpolation (D.characteristic c x) φ) + simp only [interpolation_characteristic] + exact operator_continuous f c.directions _ (D.fullCoord c) + (fun a _ => D.fullCoord_continuous c a) φ c.top + +theorem interpolation_vertex_pos (p : D.Point) : + 0 < D.interpolation p (fun a => if a = p.top then 1 else 0) := by + apply operator_pos + · intro a _; exact ⟨p.nonneg a,p.lt_one a⟩ + · intro a; split_ifs <;> norm_num + · simp + +omit [Fintype A] in +theorem descending_operator_delta_zero (s : Finset A) (g : G) (hs : s ⊆ D.desc g) + (x : A → ℝ) (b : G) (hb : D.length g ≤ D.length b) (hne : b ≠ g) : + operator f s (fun a ha d hd hne => D.commute g a d (hs ha) (hs hd) hne) + x (fun a => if a = b then 1 else 0) g = 0 := by + induction s using Finset.induction_on generalizing g with + | empty => simp [operator_empty,hne.symm] + | @insert a s ha ih => + have hga := hs (Finset.mem_insert_self a s) + have hs0 : s ⊆ D.desc g := fun d hd => hs (Finset.mem_insert_of_mem hd) + have hs1 : s ⊆ D.desc (g * f a) := by + intro d hd + exact D.preserve g a d hga (hs0 hd) (by intro he; exact ha (he ▸ hd)) + have hd := D.decrease g a hga + have hb1 : D.length (g*f a) ≤ D.length b := by omega + have hne1 : b ≠ g*f a := by intro he; rw [he] at hb; omega + have hc : (↑(insert a s) : Set A).Pairwise (fun a d => Commute (f a) (f d)) := + fun _ ha _ hd hne => D.commute g _ _ (hs ha) (hs hd) hne + change operator f (insert a s) hc x (fun a => if a = b then 1 else 0) g = 0 + rw [operator_insert f s a ha,Module.End.mul_apply,blend_apply] + rw [ih g hs0 hb hne,ih (g*f a) hs1 hb1 hne1] + ring + +theorem interpolation_vertex_zero (p : D.Point) (b : G) + (hb : D.length p.top ≤ D.length b) (hne : b ≠ p.top) : + D.interpolation p (fun a => if a = b then 1 else 0) = 0 := + D.descending_operator_delta_zero (D.active p) p.top (D.pointCell p).subset p.coord b hb hne + +theorem interpolation_top_eq (p q : D.Point) + (he : ∀ φ, D.interpolation p φ = D.interpolation q φ) : p.top = q.top := by + have length_le (p q : D.Point) (he : ∀ φ, D.interpolation p φ = D.interpolation q φ) : + D.length q.top ≤ D.length p.top := by + by_contra hn + have hlt : D.length p.top < D.length q.top := lt_of_not_ge hn + have hne : q.top ≠ p.top := by intro eq; rw [eq] at hlt; exact lt_irrefl _ hlt + have hz := D.interpolation_vertex_zero p q.top hlt.le hne + have hp := D.interpolation_vertex_pos q + rw [← he,hz] at hp + exact lt_irrefl _ hp + have h₁ := length_le p q he + by_contra hne + have hz := D.interpolation_vertex_zero q p.top h₁ hne + have hp := D.interpolation_vertex_pos p + rw [he,hz] at hp + exact lt_irrefl _ hp + +variable (exponent : A → G →* Multiplicative ℝ) +variable (hexponent : ∀ g a, a ∈ D.desc g → ∀ b, b ∈ D.desc g → + (exponent a (f b)).toAdd = if a = b then 1 else 0) + +include hexponent in +theorem interpolation_exponent (p : D.Point) (a : A) (ha : a ∈ D.desc p.top) : + D.interpolation p (fun g => (exponent a g).toAdd) = + (exponent a p.top).toAdd + p.coord a := by + refine (operator_linear f (exponent a) (D.active p) + (D.cellComm (D.pointCell p)) p.coord p.top).trans ?_ + congr 1 + have he : ∀ b ∈ D.active p, (exponent a (f b)).toAdd = if a = b then 1 else 0 := + fun b hb => hexponent p.top a ha b ((D.pointCell p).subset hb) + simp only [Finset.sum_congr rfl (fun b hb => congrArg (fun t : ℝ => p.coord b * t) (he b hb)), + mul_ite,mul_one,mul_zero,Finset.sum_ite_eq] + by_cases h : p.coord a = 0 + · simp [h] + · simp [mem_active,h] + +include exponent hexponent in +theorem interpolation_injective : Function.Injective + (fun p : D.Point => fun φ : G → ℝ => D.interpolation p φ) := by + intro p q he + have he' : ∀ φ, D.interpolation p φ = D.interpolation q φ := fun φ => congrFun he φ + have hb := D.interpolation_top_eq p q he' + apply Point.ext hb + funext a + by_cases ha : a ∈ D.desc p.top + · have hq : a ∈ D.desc q.top := by simpa only [hb] using ha + have hh := he' (fun g => (exponent a g).toAdd) + rw [D.interpolation_exponent exponent hexponent p a ha, + D.interpolation_exponent exponent hexponent q a hq,hb] at hh + exact add_left_cancel hh + · have hp : p.coord a = 0 := by_contra (fun hn => ha (p.support a hn)) + have hq : q.coord a = 0 := by + by_contra hn + exact ha (by simpa only [hb] using q.support a hn) + rw [hp,hq] + +include exponent hexponent in +theorem point_t2 : T2Space D.Point := + T2Space.of_injective_continuous + (D.interpolation_injective exponent hexponent) + (continuous_pi (fun φ => D.interpolation_continuous φ)) + +end EilenbergGanea.DescendingCube.Data + +open Classical Topology +namespace WeakRealization + +/-- A homeomorphism is induced by point-separating coordinates and actual +continuous lifts on each characteristic disk, in both directions. -/ +def homeomorph {ι κ X Y Z : Type*} {E : ι → Type*} {F : κ → Type*} + [TopologicalSpace X] [TopologicalSpace Y] + [∀ i, TopologicalSpace (E i)] [∀ j, TopologicalSpace (F j)] + (e : ((i : ι) × E i) → X) (f : ((j : κ) × F j) → Y) + (he : IsQuotientMap e) (hf : IsQuotientMap f) + (J : X → Z) (K : Y → Z) (hJ : Function.Injective J) (hK : Function.Injective K) + (hxy : ∀ i, ∃ φ : C(E i,Y), ∀ t, K (φ t) = J (e ⟨i,t⟩)) + (hyx : ∀ j, ∃ φ : C(F j,X), ∀ t, J (φ t) = K (f ⟨j,t⟩)) : X ≃ₜ Y := by + have hx : ∀ x, ∃ y, K y = J x := by + intro x + obtain ⟨⟨i,t⟩,rfl⟩ := he.surjective x + obtain ⟨φ,hφ⟩ := hxy i + exact ⟨φ t,hφ t⟩ + have hy : ∀ y, ∃ x, J x = K y := by + intro y + obtain ⟨⟨j,t⟩,rfl⟩ := hf.surjective y + obtain ⟨φ,hφ⟩ := hyx j + exact ⟨φ t,hφ t⟩ + let A : X → Y := fun x => (hx x).choose + let B : Y → X := fun y => (hy y).choose + have hA : ∀ x, K (A x) = J x := fun x => (hx x).choose_spec + have hB : ∀ y, J (B y) = K y := fun y => (hy y).choose_spec + refine { + toEquiv := { + toFun := A + invFun := B + left_inv := fun x => hJ ((hB (A x)).trans (hA x)) + right_inv := fun y => hK ((hA (B y)).trans (hB y)) } + continuous_toFun := ?_ + continuous_invFun := ?_ } + · apply he.continuous_iff.mpr + apply continuous_sigma + intro i + obtain ⟨φ,hφ⟩ := hxy i + have hh : (fun t => A (e ⟨i,t⟩)) = φ := by + funext t + exact hK ((hA _).trans (hφ t).symm) + change Continuous (fun t => A (e ⟨i,t⟩)) + rw [hh] + exact φ.continuous + · apply hf.continuous_iff.mpr + apply continuous_sigma + intro j + obtain ⟨φ,hφ⟩ := hyx j + have hh : (fun t => B (f ⟨j,t⟩)) = φ := by + funext t + exact hJ ((hB _).trans (hφ t).symm) + change Continuous (fun t => B (f ⟨j,t⟩)) + rw [hh] + exact φ.continuous + +end WeakRealization + +namespace EilenbergGanea.CubeInterpolation +open CubicalChains.Reorientation +variable {G V : Type*} [Group G] + +/-- Interpolation in a listed cube, independent of any topological model. -/ +def listed (f : V → G) (w : List V) (x : V → ℝ) : Module.End ℝ (G → ℝ) := + (w.map (fun v => blend (f v) (x v))).prod + +@[simp] theorem listed_nil (f : V → G) (x : V → ℝ) : listed f [] x = 1 := rfl +@[simp] theorem listed_cons (f : V → G) (v : V) (w : List V) (x : V → ℝ) : + listed f (v::w) x = blend (f v) (x v) * listed f w x := rfl + +theorem operator_listed [DecidableEq V] (f : V → G) (w : List V) (hw : w.Nodup) + (hc : (w.toFinset : Set V).Pairwise (fun v u => Commute (f v) (f u))) (x : V → ℝ) : + operator f w.toFinset hc x = listed f w x := + Finset.noncommProd_toFinset w _ _ hw + +/-- Literal multilinear invariance under reversing selected cube directions. -/ +theorem listed_reorientation (f : V → G) (w : List (Signed V)) + (hw : w.Pairwise (fun a b => Commute (f a.1) (f b.1))) + (x : Signed V → ℝ) (z : V → ℝ) + (hx : ∀ a ∈ w, x a = if a.2 then 1-z a.1 else z a.1) (φ : G → ℝ) (g : G) : + listed (step f) w x φ g = listed f (w.map Prod.fst) z φ (origin f g w) := by + induction w generalizing g with + | nil => rfl + | cons a w ih => + obtain ⟨ha,hw⟩ := List.pairwise_cons.mp hw + have hxw : ∀ b ∈ w, x b = if b.2 then 1-z b.1 else z b.1 := + fun b hb => hx b (by simp [hb]) + simp only [listed_cons,List.map_cons,Module.End.mul_apply,blend_apply, + ih hw hxw,hx a (by simp),step,origin] + cases hb : a.2 + · simp only [Bool.false_eq_true,↓reduceIte] + rw [origin_shift f g (f a.1) w ha] + · simp only [↓reduceIte] + rw [origin_shift f g (f a.1)⁻¹ w (fun b hb => (ha b hb).inv_left), + inv_mul_cancel_right] + ring + +end EilenbergGanea.CubeInterpolation + +namespace EilenbergGanea.ArtinCubicalTopology +open TraceWords CubeInterpolation CubicalChains.Reorientation +variable {V : Type*} [Fintype V] (L : SimpleGraph V) + +local instance : Std.Symm L.Adj := ⟨fun _ _ h => h.symm⟩ +local instance : Std.Irrefl L.Adj := ⟨fun _ => L.irrefl⟩ + +abbrev f := artinGenerator L +abbrev comm := fun v w h => adjacent_generators_commute L (v := v) (w := w) h +abbrev D := artinDescendingData L +abbrev Positive := CubeRealization.Point L (f L) (comm L) +abbrev Descending := (D L).Point + +omit [Fintype V] in +@[simp] theorem step_eq (a : Letter V) : step (f L) a = letterValue (f L) (invLetter a) := by + cases a with | mk v b => cases b <;> rfl + +def exponent (v : V) : ArtinGroup L →* Multiplicative ℝ := + artinLift L (fun w => Multiplicative.ofAdd (if v = w then (1 : ℝ) else 0)) + (fun _ _ _ => Commute.all _ _) + +omit [Fintype V] in +@[simp] theorem exponent_generator (v w : V) : + (exponent L v (f L w)).toAdd = if v = w then 1 else 0 := by + simp [exponent,f] + +omit [Fintype V] in +@[simp] theorem height_generator (v : V) : (height L (f L v)).toAdd = 1 := by + exact congrArg Multiplicative.toAdd (PresentedGroup.toGroup.of _) + +def signedExponent (a : Letter V) : ArtinGroup L →* Multiplicative ℝ := + artinLift L (fun v => Multiplicative.ofAdd + (if a.1 = v then (if a.2 then (-1 : ℝ) else 1) else 0)) + (fun _ _ _ => Commute.all _ _) + +theorem signedExponent_step (g : ArtinGroup L) (a : Letter V) (ha : a ∈ (D L).desc g) + (b : Letter V) (hb : b ∈ (D L).desc g) : + (signedExponent L a (letterValue (f L) (invLetter b))).toAdd = if a = b then 1 else 0 := by + by_cases he : a = b + · subst b + rcases a with ⟨v,b⟩ + cases b <;> simp [signedExponent,letterValue,invLetter,f] + · have hi : Independent L a b := rightDescents_pairwise L g + (by simpa [D,artinDescendingData] using ha) (by simpa [D,artinDescendingData] using hb) he + have hv : a.1 ≠ b.1 := hi.ne + rcases b with ⟨v,b⟩ + cases b <;> simp [signedExponent,letterValue,invLetter,f,hv,he] + +theorem positive_interp_inj : Function.Injective + (fun p : Positive L => fun φ => CubeRealization.interpolation L (f L) (comm L) p φ) := + CubeRealization.interpolation_injective L (f L) (comm L) (height L) (height_generator L) + (exponent L) (exponent_generator L) + +theorem descending_interp_inj : Function.Injective + (fun p : Descending L => fun φ => (D L).interpolation p φ) := + (D L).interpolation_injective (signedExponent L) (by + intro g a ha b hb + by_cases he : a = b <;> simpa [he] using signedExponent_step L g a ha b hb) + +def flip (b : Bool) (t : unitInterval) : unitInterval := + if b then unitInterval.symm t else t + +@[simp] theorem flip_flip (b : Bool) (t : unitInterval) : flip b (flip b t) = t := by + cases b <;> simp [flip] + +theorem flip_continuous (b : Bool) : Continuous (flip b) := by + cases b + · exact continuous_id + · exact unitInterval.continuous_symm + +def vertexEquiv (w : Word V) (hw : (w.map Prod.fst).Nodup) : + w.toFinset ≃ (w.map Prod.fst).toFinset := + Equiv.ofBijective (fun a => ⟨a.val.1,by + exact List.mem_toFinset.mpr (List.mem_map.mpr ⟨a.val,List.mem_toFinset.mp a.property,rfl⟩)⟩) (by + constructor + · intro a b he + apply Subtype.ext + exact (List.nodup_map_iff_inj_on (hw.of_map Prod.fst)).mp hw + a.val (List.mem_toFinset.mp a.property) b.val (List.mem_toFinset.mp b.property) (congrArg Subtype.val he) + · intro v + obtain ⟨a,ha,he⟩ := List.mem_map.mp (List.mem_toFinset.mp v.property) + exact ⟨⟨a,by simpa using ha⟩,Subtype.ext he⟩) + +omit [Fintype V] in +@[simp] theorem vertexEquiv_val (w : Word V) (hw : (w.map Prod.fst).Nodup) + (a : w.toFinset) : (vertexEquiv w hw a).val = a.val.1 := rfl + +def toPositiveCoords (w : Word V) (hw : (w.map Prod.fst).Nodup) + (x : w.toFinset → unitInterval) : (w.map Prod.fst).toFinset → unitInterval := + fun v => flip ((vertexEquiv w hw).symm v).val.2 (x ((vertexEquiv w hw).symm v)) + +omit [Fintype V] in +@[simp] theorem toPositiveCoords_apply (w : Word V) (hw : (w.map Prod.fst).Nodup) + (x : w.toFinset → unitInterval) (a : w.toFinset) : + toPositiveCoords w hw x (vertexEquiv w hw a) = flip a.val.2 (x a) := by + simp [toPositiveCoords] + +omit [Fintype V] in +theorem toPositiveCoords_continuous (w : Word V) (hw : (w.map Prod.fst).Nodup) : + Continuous (toPositiveCoords w hw) := + continuous_pi (fun _ => (flip_continuous _).comp (continuous_apply _)) + +def toDescendingCoords (w : Word V) (hw : (w.map Prod.fst).Nodup) + (z : (w.map Prod.fst).toFinset → unitInterval) : w.toFinset → unitInterval := + fun a => flip a.val.2 (z (vertexEquiv w hw a)) + +omit [Fintype V] in +theorem toDescendingCoords_continuous (w : Word V) (hw : (w.map Prod.fst).Nodup) : + Continuous (toDescendingCoords w hw) := + continuous_pi (fun _ => (flip_continuous _).comp (continuous_apply _)) + +omit [Fintype V] in +@[simp] theorem toPositive_toDescending (w : Word V) (hw : (w.map Prod.fst).Nodup) + (z : (w.map Prod.fst).toFinset → unitInterval) : + toPositiveCoords w hw (toDescendingCoords w hw z) = z := by + funext v + obtain ⟨a,rfl⟩ := (vertexEquiv w hw).surjective v + simp [toDescendingCoords] + +def positiveCell (g : ArtinGroup L) (w : Word V) (hw : (w.map Prod.fst).Pairwise L.Adj) : + CubeRealization.Cell (G := ArtinGroup L) L where + base := origin (f L) g w + directions := (w.map Prod.fst).toFinset + clique := fun _ ha _ hb he => hw.forall (List.mem_toFinset.mp ha) (List.mem_toFinset.mp hb) he + +def descendingCell (g : ArtinGroup L) (w : Word V) + (hd : ∀ a ∈ w, a ∈ rightDescents L g) : (D L).Cell where + top := g + directions := w.toFinset + subset a ha := by simpa [D,artinDescendingData] using hd a (List.mem_toFinset.mp ha) + +theorem interpolation_reorientation (g : ArtinGroup L) (w : Word V) + (hw : (w.map Prod.fst).Pairwise L.Adj) (hd : ∀ a ∈ w, a ∈ rightDescents L g) + (x : (D L).Coordinates (descendingCell L g w hd)) (φ : ArtinGroup L → ℝ) : + (D L).interpolation ((D L).characteristic (descendingCell L g w hd) x) φ = + CubeRealization.interpolation L (f L) (comm L) + (CubeRealization.characteristic (f L) (comm L) (positiveCell L g w hw) + (toPositiveCoords w hw.nodup x)) φ := by + refine ((D L).interpolation_characteristic (descendingCell L g w hd) x φ).trans ?_ + refine Eq.trans ?_ (CubeRealization.interpolation_characteristic L (f L) (comm L) + (positiveCell L g w hw) (toPositiveCoords w hw.nodup x) φ).symm + have hf : (fun a : Letter V => letterValue (artinGenerator L) (invLetter a)) = step (f L) := + funext (fun a => (step_eq L a).symm) + erw [operator_listed _ w (hw.nodup.of_map Prod.fst),operator_listed _ _ hw.nodup] + have hop := congrArg (fun k : Letter V → ArtinGroup L => listed k w) hf + rw [hop] + apply listed_reorientation + · exact (List.pairwise_map.mp hw).imp (fun hh => adjacent_generators_commute L hh) + · intro a ha + let aa : w.toFinset := ⟨a,by simpa using ha⟩ + have h₁ : (D L).fullCoord (descendingCell L g w hd) x a = (x aa : ℝ) := by + exact (D L).fullCoord_mem (descendingCell L g w hd) x aa + have h₂ : CubeRealization.fullCoord (positiveCell L g w hw) + (toPositiveCoords w hw.nodup x) a.1 = (flip a.2 (x aa) : ℝ) := by + have hh := CubeRealization.fullCoord_mem (positiveCell L g w hw) + (toPositiveCoords w hw.nodup x) (vertexEquiv w hw.nodup aa) + exact hh.trans (congrArg (fun z : unitInterval => (z : ℝ)) + (toPositiveCoords_apply w hw.nodup x aa)) + rw [h₁,h₂] + cases h : a.2 <;> simp [flip] + +theorem descendingCell_rep (c : (D L).Cell) : + ∃ (g : ArtinGroup L) (w : Word V) (_hw : (w.map Prod.fst).Pairwise L.Adj) + (hd : ∀ a ∈ w, a ∈ rightDescents L g), descendingCell L g w hd = c := by + let w := c.directions.toList + have hd : ∀ a ∈ w, a ∈ rightDescents L c.top := by + intro a ha + have hh := c.subset (Finset.mem_toList.mp ha) + simpa [D,artinDescendingData] using hh + have hw : (w.map Prod.fst).Pairwise L.Adj := by + apply List.pairwise_map.mpr + apply c.directions.nodup_toList.pairwise_of_forall_ne + intro a ha b hb he + exact rightDescents_pairwise L c.top (hd a ha) (hd b hb) he + refine ⟨c.top,w,hw,hd,?_⟩ + cases c with + | mk g s hs => + dsimp only [descendingCell,w] + congr + exact s.toList_toFinset + +omit [Fintype V] in +theorem positiveCell_rep (c : CubeRealization.Cell (G := ArtinGroup L) L) : + ∃ (g : ArtinGroup L) (w : Word V) (hw : (w.map Prod.fst).Pairwise L.Adj) + (_hd : ∀ a ∈ w, a ∈ rightDescents L g), positiveCell L g w hw = c := by + let v := c.directions.toList + have hv : v.Pairwise L.Adj := c.directions.nodup_toList.pairwise_of_forall_ne + (fun a ha b hb he => c.clique (Finset.mem_toList.mp ha) (Finset.mem_toList.mp hb) he) + let o := CubeDescents.orient L c.base v + have hw : (o.2.map Prod.fst).Pairwise L.Adj := by + simpa only [o,CubeDescents.orient_map] using hv + have hd : ∀ a ∈ o.2, a ∈ rightDescents L o.1 := CubeDescents.orient_descents L c.base v hv + refine ⟨o.1,o.2,hw,hd,?_⟩ + have hb : origin (f L) o.1 o.2 = c.base := CubeDescents.origin_orient L c.base v hv + have hs : (o.2.map Prod.fst).toFinset = c.directions := by + simp only [o,CubeDescents.orient_map,v,Finset.toList_toFinset] + cases c with + | mk g s hc => + change CubeRealization.Cell.mk (origin (f L) o.1 o.2) (o.2.map Prod.fst).toFinset _ = _ + congr + +theorem descending_local_lift (c : (D L).Cell) : + ∃ φ : C((D L).Coordinates c,Positive L), ∀ x, + (fun ψ => CubeRealization.interpolation L (f L) (comm L) (φ x) ψ) = + (fun ψ => (D L).interpolation ((D L).characteristic c x) ψ) := by + obtain ⟨g,w,hw,hd,rfl⟩ := descendingCell_rep L c + refine ⟨⟨fun x => CubeRealization.characteristic (f L) (comm L) (positiveCell L g w hw) + (toPositiveCoords w hw.nodup x), + (CubeRealization.characteristic_continuous (f L) (comm L) (positiveCell L g w hw)).comp + (toPositiveCoords_continuous w hw.nodup)⟩,?_⟩ + intro x + funext ψ + exact (interpolation_reorientation L g w hw hd x ψ).symm + +theorem positive_local_lift (c : CubeRealization.Cell (G := ArtinGroup L) L) : + ∃ φ : C(CubeRealization.Coordinates c,Descending L), ∀ x, + (fun ψ => (D L).interpolation (φ x) ψ) = + (fun ψ => CubeRealization.interpolation L (f L) (comm L) + (CubeRealization.characteristic (f L) (comm L) c x) ψ) := by + obtain ⟨g,w,hw,hd,rfl⟩ := positiveCell_rep L c + refine ⟨⟨fun x => (D L).characteristic (descendingCell L g w hd) (toDescendingCoords w hw.nodup x), + ((D L).characteristic_continuous (descendingCell L g w hd)).comp + (toDescendingCoords_continuous w hw.nodup)⟩,?_⟩ + intro x + funext ψ + change (D L).interpolation ((D L).characteristic (descendingCell L g w hd) + (toDescendingCoords w hw.nodup x)) ψ = _ + change (w.map Prod.fst).toFinset → unitInterval at x + simpa only [toPositive_toDescending] using interpolation_reorientation L g w hw hd + (toDescendingCoords w hw.nodup x) ψ + +/-- Reorientation preserves the actual weak topologies, not only cellular chains. -/ +def reorient : Descending L ≃ₜ Positive L := + WeakRealization.homeomorph (D L).evaluation (CubeRealization.evaluation (f L) (comm L)) + (D L).evaluation_quotient (CubeRealization.evaluation_quotient (f L) (comm L)) + (fun p ψ => (D L).interpolation p ψ) + (fun p ψ => CubeRealization.interpolation L (f L) (comm L) p ψ) + (descending_interp_inj L) (positive_interp_inj L) + (descending_local_lift L) (positive_local_lift L) + +variable [Nonempty V] + +/-- The ordinary positive-cube CW realization is genuinely contractible. -/ +theorem positive_contractible : ContractibleSpace (Positive L) := by + let : ContractibleSpace (Descending L) := artinDescending_contractible L + exact (reorient L).symm.contractibleSpace + +end EilenbergGanea.ArtinCubicalTopology + +open Classical Set Topology +namespace CompactChart + +/-- A characteristic map which has singleton fibers over its open cell has a +continuous inverse there. Compactness is used only on the closed disk; no +regularity of the attaching sphere is required. -/ +theorem continuousOn_symm {A X : Type*} [TopologicalSpace A] [TopologicalSpace X] + [T2Space X] (e : PartialEquiv A X) (K : Set A) (hK : IsCompact K) + (hsub : e.source ⊆ K) (hc : ContinuousOn e K) + (hboundary : ∀ a ∈ K, e a ∈ e.target → a ∈ e.source) : + ContinuousOn e.symm e.target := by + let : CompactSpace K := isCompact_iff_compactSpace.mp hK + let f : K → X := fun a => e a + have hf : Continuous f := continuousOn_iff_continuous_domRestrict.mp hc + let r := e.target.restrictPreimage f + have hr : Function.Surjective r := by + intro x + refine ⟨⟨⟨e.symm x,hsub (e.map_target x.property)⟩,?_⟩,?_⟩ + · change e (e.symm x) ∈ e.target + rw [e.right_inv x.property] + exact x.property + · exact Subtype.ext (e.right_inv x.property) + have hq : IsQuotientMap r := + (hf.isClosedMap.restrictPreimage e.target).isQuotientMap hf.restrictPreimage hr + apply continuousOn_iff_continuous_domRestrict.mpr + apply hq.continuous_iff.mpr + have he : (fun x : e.target => e.symm x) ∘ r = + (fun a : f ⁻¹' e.target => (a.val.val : A)) := by + funext a + exact e.left_inv (hboundary a.val a.val.property a.property) + change Continuous ((fun x : e.target => e.symm x) ∘ r) + rw [he] + exact continuous_subtype_val.comp continuous_subtype_val + +end CompactChart + +namespace EilenbergGanea.CubeRealization + +section +open Metric +variable {G V : Type*} [Group G] [Fintype V] +variable {L : SimpleGraph V} (f : V → G) +variable (comm : ∀ v w, L.Adj v w → Commute (f v) (f w)) + +theorem chartInverse_continuousOn_of_t2 [T2Space (Point (G := G) L f comm)] + {n : ℕ} (c : DimCell (G := G) (L := L) n) : + ContinuousOn (chart f comm c).symm (chart f comm c).target := by + apply CompactChart.continuousOn_symm (chart f comm c) (closedBall 0 1) + (isCompact_closedBall _ _) ball_subset_closedBall (chart_continuous f comm c).continuousOn + intro t ht he + change pointCell (chart f comm c t) = c.val at he + change t ∈ ball 0 1 + by_contra hn + have hs : t ∈ sphere 0 1 := mem_sphere.mpr + (le_antisymm (mem_closedBall.mp ht) (le_of_not_gt hn)) + have hd := boundary_dimension_lt f comm c hs + rw [he,c.property] at hd + exact (lt_irrefl _) hd + +/-- The ordinary CW structure follows from the genuine normalized-cube gluing; +only Hausdorffness and compact characteristic disks are used. -/ +@[instance_reducible] def cwComplexOfT2 [T2Space (Point (G := G) L f comm)] : CWComplex (univ : Set (Point (G := G) L f comm)) where + cell := DimCell (G := G) (L := L) + map := fun _ c => chart f comm c + source_eq := fun _ _ => rfl + continuousOn := fun _ c => (chart_continuous f comm c).continuousOn + continuousOn_symm := fun _ c => chartInverse_continuousOn_of_t2 f comm c + pairwiseDisjoint' := by + intro a _ b _ hab + change Disjoint (chart f comm a.2 '' ball 0 1) (chart f comm b.2 '' ball 0 1) + rw [chart_image_ball,chart_image_ball] + apply Set.disjoint_left.mpr + intro p ha hb + apply hab + have he : a.2.val = b.2.val := ha.symm.trans hb + have hn : a.1 = b.1 := a.2.property.symm.trans ((congrArg (fun c => c.directions.card) he).trans b.2.property) + cases a with | mk n a => + cases b with | mk m b => + dsimp at hn + subst m + exact congrArg (Sigma.mk n) (Subtype.ext he) + mapsTo' := chart_mapsTo f comm + closed' := by + intro A _ hA + apply (evaluation_quotient f comm).isClosed_preimage.mp + rw [isClosed_sigma_iff] + intro c + let d : DimCell (G := G) (L := L) c.directions.card := ⟨c,rfl⟩ + have hh := (hA _ d).preimage (characteristic_continuous f comm c) + rw [chart_image_disk] at hh + change IsClosed (characteristic f comm c ⁻¹' (A ∩ Set.range (characteristic f comm c))) at hh + change IsClosed (characteristic f comm c ⁻¹' A) + simpa only [Set.preimage_inter,Set.preimage_range,Set.inter_univ] using hh + union' := by + apply Set.eq_univ_of_forall + intro p + let d : DimCell (G := G) (L := L) (pointCell p).directions.card := ⟨pointCell p,rfl⟩ + apply Set.mem_iUnion.mpr + refine ⟨_,Set.mem_iUnion.mpr ⟨d,?_⟩⟩ + rw [chart_image_disk] + exact ⟨pointCoordinates p,characteristic_point f comm p⟩ + +end + +variable {G Q V : Type*} [Group G] [Group Q] [Fintype V] +variable {L : SimpleGraph V} (f : V → G) +variable (comm : ∀ v w, L.Adj v w → Commute (f v) (f w)) +variable (q : G →* Q) + +include comm in +omit [Fintype V] in +theorem mappedComm : ∀ v w, L.Adj v w → Commute ((q ∘ f) v) ((q ∘ f) w) := + fun v w hvw => (comm v w hvw).map q + +/-- Applying a group homomorphism only to the initial vertices of cubes. -/ +def mapPoint (p : Point (G := G) L f comm) : Point (G := Q) L (q ∘ f) (mappedComm f comm q) where + base := q p.base + coord := p.coord + nonneg := p.nonneg + lt_one := p.lt_one + clique := p.clique + +def mapCell (c : Cell (G := G) L) : Cell (G := Q) L where + base := q c.base + directions := c.directions + clique := c.clique + +omit [Fintype V] in +@[simp] theorem mapPoint_base (p : Point (G := G) L f comm) : + (mapPoint f comm q p).base = q p.base := rfl + +omit [Fintype V] in +@[simp] theorem mapPoint_coord (p : Point (G := G) L f comm) : + (mapPoint f comm q p).coord = p.coord := rfl + +omit [Fintype V] in +@[simp] theorem mapPoint_characteristic (c : Cell (G := G) L) (x : Coordinates c) : + mapPoint f comm q (characteristic f comm c x) = + characteristic (q ∘ f) (mappedComm f comm q) (mapCell q c) x := by + apply Point.ext + · change q (c.base * product f comm (ones c x) _) = + q c.base * product (q ∘ f) (mappedComm f comm q) (ones c x) _ + rw [map_mul] + congr 1 + exact Finset.map_noncommProd _ _ _ q + · rfl + +theorem mapPoint_continuous : Continuous (mapPoint f comm q) := by + apply (evaluation_quotient f comm).continuous_iff.mpr + apply continuous_sigma + intro c + change Continuous (fun x => mapPoint f comm q (characteristic f comm c x)) + simp only [mapPoint_characteristic] + exact characteristic_continuous (q ∘ f) (mappedComm f comm q) (mapCell q c) + +omit [Fintype V] in +theorem mapCell_surjective (hq : Function.Surjective q) : Function.Surjective (mapCell (L := L) q) := by + rintro ⟨a,s,hs⟩ + obtain ⟨g,rfl⟩ := hq a + exact ⟨⟨g,s,hs⟩,rfl⟩ + +omit [Fintype V] in +theorem mapPoint_surjective (hq : Function.Surjective q) : Function.Surjective (mapPoint f comm q) := by + rintro ⟨a,x,hx,ht,hc⟩ + obtain ⟨g,rfl⟩ := hq a + exact ⟨⟨g,x,hx,ht,hc⟩,rfl⟩ + +/-- The base-label quotient is a genuine topological quotient for the weak +cubical topologies, proved by lifting each actual characteristic disk. -/ +theorem mapPoint_quotient (hq : Function.Surjective q) : IsQuotientMap (mapPoint f comm q) := by + apply isQuotientMap_iff_isClosed.mpr + refine ⟨mapPoint_surjective f comm q hq,?_⟩ + intro A + constructor + · exact fun hA => hA.preimage (mapPoint_continuous f comm q) + · intro hA + apply (evaluation_quotient (q ∘ f) (mappedComm f comm q)).isClosed_preimage.mp + rw [isClosed_sigma_iff] + intro c + obtain ⟨d,rfl⟩ := mapCell_surjective q hq c + have hh := hA.preimage (characteristic_continuous f comm d) + change IsClosed ((fun x => mapPoint f comm q (characteristic f comm d x)) ⁻¹' A) at hh + change IsClosed ((fun x : Coordinates d => + characteristic (q ∘ f) (mappedComm f comm q) (mapCell q d) x) ⁻¹' A) + simpa only [mapPoint_characteristic] using hh + +omit [Fintype V] in +/-- The literal group-kernel orbits are exactly the fibers of the cube map. -/ +theorem mapPoint_eq_iff_orbit (p r : Point (G := G) L f comm) : + mapPoint f comm q p = mapPoint f comm q r ↔ p ∈ MulAction.orbit q.ker r := by + constructor + · intro he + have hb : q p.base = q r.base := congrArg Point.base he + have hx : p.coord = r.coord := congrArg (fun z : Point (G := Q) L (q ∘ f) + (mappedComm f comm q) => z.coord) he + let g : q.ker := ⟨p.base * r.base⁻¹,by simp only [MonoidHom.mem_ker,map_mul,map_inv,hb,mul_inv_cancel]⟩ + refine ⟨g,?_⟩ + apply Point.ext + · change (p.base * r.base⁻¹) * r.base = p.base + simp [mul_assoc] + · exact hx.symm + · rintro ⟨g,rfl⟩ + apply Point.ext + · change q ((g : G) * r.base) = q r.base + rw [map_mul,g.property,one_mul] + · rfl + +/-- The quotient homeomorphism respects the actual weak topologies. -/ +def kernelQuotientHomeomorph (hq : Function.Surjective q) : + Quotient (MulAction.orbitRel q.ker (Point (G := G) L f comm)) ≃ₜ + Point (G := Q) L (q ∘ f) (mappedComm f comm q) := + (Homeomorph.Quotient.congrRight (fun p r => (mapPoint_eq_iff_orbit f comm q p r).symm)).trans + (Topology.IsQuotientMap.homeomorph (f := ⟨mapPoint f comm q,mapPoint_continuous f comm q⟩) + (mapPoint_quotient f comm q hq)) + +variable (h : G →* Multiplicative ℤ) (hf : ∀ v, (h (f v)).toAdd = 1) +variable (exponent : V → G →* Multiplicative ℝ) +variable (hexponent : ∀ v w, (exponent v (f w)).toAdd = if v = w then 1 else 0) + +include h hf exponent hexponent in +theorem quotientPoint_t2 (hq : Function.Surjective q) : + T2Space (Point (G := Q) L (q ∘ f) (mappedComm f comm q)) := by + let := point_t2 L f comm h hf exponent hexponent + let := point_weaklyLocallyCompact L f comm + exact (kernelQuotientHomeomorph f comm q hq).t2Space + +include h hf exponent hexponent in +theorem mapPoint_covering (hq : Function.Surjective q) : + IsQuotientCoveringMap (mapPoint f comm q) q.ker where + toIsQuotientMap := mapPoint_quotient f comm q hq + continuous_const_smul := continuous_const_smul + apply_eq_iff_mem_orbit := mapPoint_eq_iff_orbit f comm q _ _ + disjoint := (subgroup_quotient_covering f comm h hf exponent hexponent q.ker).disjoint + +end EilenbergGanea.CubeRealization + +namespace EilenbergGanea +universe u +namespace ArtinCubicalTopology +open CubeRealization +variable {V : Type u} [Fintype V] [Nonempty V] (L : SimpleGraph V) + +omit [Fintype V] in +theorem height_surjective : Function.Surjective (height L) := by + intro n + let v : V := Classical.choice inferInstance + refine ⟨f L v ^ n.toAdd,?_⟩ + rw [map_zpow] + apply Multiplicative.toAdd.injective + change n.toAdd • (height L (f L v)).toAdd = n.toAdd + simp only [height_generator,zsmul_eq_mul,mul_one,Int.cast_id] + +def HeightQuotient := Point L ((height L) ∘ f L) (mappedComm (f L) (comm L) (height L)) + +instance : TopologicalSpace (HeightQuotient L) := inferInstanceAs (TopologicalSpace + (Point L ((height L) ∘ f L) (mappedComm (f L) (comm L) (height L)))) + +/-- An ordinary cubical classifying space for the height kernel, with one cube +for every integral level and clique. Contractibility above is the explicit +word-length contraction, and the fundamental-group identification reuses +Mathlib's checked covering-monodromy equivalence. -/ +theorem height_hasClassifyingSpace (d : ℕ) + (hd : ∀ s : Finset V, (s : Set V).Pairwise L.Adj → s.card ≤ d) : + HasClassifyingSpace.{u} (height L).ker d := by + let X := Point L ((height L) ∘ f L) (mappedComm (f L) (comm L) (height L)) + let E := Positive L + let : ContractibleSpace E := positive_contractible L + let : T2Space X := quotientPoint_t2 (f L) (comm L) (height L) + (height L) (height_generator L) (exponent L) (exponent_generator L) (height_surjective L) + let : Topology.CWComplex (Set.univ : Set X) := + cwComplexOfT2 ((height L) ∘ f L) (mappedComm (f L) (comm L) (height L)) + let p : E → X := mapPoint (f L) (comm L) (height L) + have hp : IsQuotientCoveringMap p (height L).ker := + mapPoint_covering (f L) (comm L) (height L) (height L) (height_generator L) + (exponent L) (exponent_generator L) (height_surjective L) + have hs : Function.Surjective p := mapPoint_surjective (f L) (comm L) (height L) (height_surjective L) + let : PathConnectedSpace X := hs.pathConnectedSpace hp.continuous + let e : E := Classical.choice (inferInstance : Nonempty E) + refine ⟨X,inferInstance,inferInstance,inferInstance,?_,inferInstance,p e,?_, + E,inferInstance,inferInstance,p,hp.isCoveringMap,hs⟩ + · intro k hk + exact ⟨fun c => Nat.not_lt_of_ge ((c.property.symm ▸ hd c.val.directions c.val.clique)) hk⟩ + · exact ⟨(hp.fundamentalGroupEquiv ⟨e,rfl⟩).trans (MulEquiv.inv' ((height L).ker)).symm⟩ + +end ArtinCubicalTopology + +/-- The fixed source group has an ordinary three-dimensional classifying CW +space, with an actually contractible surjective covering. -/ +theorem source_hasClassifyingSpace_three : HasClassifyingSpace.{0} SourceGroup 3 := + ArtinCubicalTopology.height_hasClassifyingSpace seedGraph 3 SeedConnection.clique_card_le_three +end EilenbergGanea + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/Dimension.lean b/lean/OAI/Topology/EilenbergGanea/Dimension.lean index 8b4e20093b3d29a23b2a5d8028963e09e2101ccf..e1153e09b1c062acaad661bf0d0c642387319114 100644 --- a/lean/OAI/Topology/EilenbergGanea/Dimension.lean +++ b/lean/OAI/Topology/EilenbergGanea/Dimension.lean @@ -1,115 +1,115 @@ -import OAI.Topology.EilenbergGanea.SeedContraction -import OAI.Topology.EilenbergGanea.LevelBasis -import OAI.Topology.EilenbergGanea.CliqueCohomology - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -namespace EilenbergGanea.SeedEncoding -@[simp] theorem cellEquiv_symm_apply (i : Fin 103) : cellEquiv.symm i = cellAt i := rfl -end EilenbergGanea.SeedEncoding -namespace EilenbergGanea -noncomputable abbrev sourceVertexOrder : LinearOrder SeedCell := - LinearOrder.lift' SeedEncoding.cellEquiv SeedEncoding.cellEquiv.injective -local instance : LinearOrder SeedCell := sourceVertexOrder -local instance : Preorder SeedCell := sourceVertexOrder.toPartialOrder.toPreorder -local instance : LT SeedCell := sourceVertexOrder.toLT -local instance : LE SeedCell := sourceVertexOrder.toLE - -@[simp] theorem sourceVertexOrder_lt (a b : SeedCell) : - a < b ↔ SeedEncoding.cellEquiv a < SeedEncoding.cellEquiv b := Iff.rfl - -theorem source_valid_to_index (w : List SeedCell) (hw : SimplicialChains.Valid seedGraph w) : - SimplicialChains.Valid SeedChainCertificate.graph (w.map SeedEncoding.cellEquiv) := by - constructor - · rw [List.pairwise_map] - exact hw.1 - · rw [List.pairwise_map] - simpa only [SeedChainCertificate.graph,SimpleGraph.comap_adj, - ← SeedEncoding.cellEquiv_symm_apply,Equiv.symm_apply_apply] using hw.2 - -theorem index_valid_to_source (w : List (Fin 103)) - (hw : SimplicialChains.Valid SeedChainCertificate.graph w) : - SimplicialChains.Valid seedGraph (w.map SeedEncoding.cellEquiv.symm) := by - constructor - · rw [List.pairwise_map] - simpa only [sourceVertexOrder_lt,Equiv.apply_symm_apply] using hw.1 - · rw [List.pairwise_map] - exact hw.2 - -/-- Relabeling uses the original seed graph and merely chooses an order on its -vertices for the signed integral chain convention. -/ -noncomputable def sourceLinkContraction (K : SimplicialChains.Contraction SeedChainCertificate.graph) : - SimplicialChains.Contraction seedGraph := - K.reindex SeedEncoding.cellEquiv.symm (index_valid_to_source) (source_valid_to_index) - -end EilenbergGanea - -namespace EilenbergGanea -local instance : LinearOrder SeedCell := sourceVertexOrder -local instance : Preorder SeedCell := sourceVertexOrder.toPartialOrder.toPreorder -local instance : LT SeedCell := sourceVertexOrder.toLT -local instance : LE SeedCell := sourceVertexOrder.toLE - -theorem source_valid_length_le (w : List SeedCell) (hw : SimplicialChains.Valid seedGraph w) : - w.length ≤ 3 := by - simpa only [List.length_map] using - SeedChainCertificate.valid_length_le (w.map SeedEncoding.cellEquiv) (source_valid_to_index w hw) - -theorem source_cd_eq_two_of_contraction - (K : SimplicialChains.Contraction SeedChainCertificate.graph) : - cohomologicalDimension SourceGroup = 2 := by - apply le_antisymm - · exact LevelBasis.artin_height_kernel_cd_le_two seedGraph seedBase seed_connected.preconnected - (sourceLinkContraction K) source_valid_length_le - · exact source_two_le_cohomologicalDimension - -/-- The exact remaining geometric interface is not limited to finite or -countable presentations. This endpoint excludes any ordinary presentation -whose actual integral equivariant cellular boundaries freely span cycles. -/ -theorem source_no_boundary_basis_of_contraction - (K : SimplicialChains.Contraction SeedChainCertificate.graph) - {A R : Type*} (a₀ : A → SourceGroup) - (ha₀ : Function.Surjective (wordValue a₀)) - (r₀ : R → FreeGroup A) (hr₀ : ∀ i, wordValue a₀ (r₀ i) = 1) - (hp₀ : (wordValue a₀).ker = Subgroup.normalClosure (Set.range r₀)) - (E : BasedChains SourceGroup R ≃ₗ[ℤ] cycles a₀) - (hE : ∀ c, (E c : BasedChains SourceGroup A) = relatorChainMap a₀ r₀ c) : False := by - let : Group.ResiduallyFinite SourceGroup := source_residuallyFinite - exact LevelBasis.no_boundary_basis_presentation seedGraph seedBase seed_connected.preconnected - (sourceLinkContraction K) source_valid_length_le SourceTransport.source_small_labels - a₀ ha₀ r₀ hr₀ hp₀ E hE - -end EilenbergGanea - - - -namespace EilenbergGanea - -/-- Literal integral cohomological dimension of the source's fixed group. -/ -theorem source_cohomologicalDimension : cohomologicalDimension SourceGroup = 2 := - source_cd_eq_two_of_contraction SeedChainCertificate.contraction - -/-- No arbitrary-alphabet genuine presentation has its relators as an integral -basis of Cayley cycles. -/ -theorem source_no_boundary_basis - {A R : Type*} (a₀ : A → SourceGroup) - (ha₀ : Function.Surjective (wordValue a₀)) - (r₀ : R → FreeGroup A) (hr₀ : ∀ i, wordValue a₀ (r₀ i) = 1) - (hp₀ : (wordValue a₀).ker = Subgroup.normalClosure (Set.range r₀)) - (E : BasedChains SourceGroup R ≃ₗ[ℤ] cycles a₀) - (hE : ∀ c, (E c : BasedChains SourceGroup A) = relatorChainMap a₀ r₀ c) : False := - source_no_boundary_basis_of_contraction SeedChainCertificate.contraction - a₀ ha₀ r₀ hr₀ hp₀ E hE - -end EilenbergGanea - - - -end - -end OAI +import OAI.Topology.EilenbergGanea.SeedContraction +import OAI.Topology.EilenbergGanea.LevelBasis +import OAI.Topology.EilenbergGanea.CliqueCohomology + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +namespace EilenbergGanea.SeedEncoding +@[simp] theorem cellEquiv_symm_apply (i : Fin 103) : cellEquiv.symm i = cellAt i := rfl +end EilenbergGanea.SeedEncoding +namespace EilenbergGanea +noncomputable abbrev sourceVertexOrder : LinearOrder SeedCell := + LinearOrder.lift' SeedEncoding.cellEquiv SeedEncoding.cellEquiv.injective +local instance : LinearOrder SeedCell := sourceVertexOrder +local instance : Preorder SeedCell := sourceVertexOrder.toPartialOrder.toPreorder +local instance : LT SeedCell := sourceVertexOrder.toLT +local instance : LE SeedCell := sourceVertexOrder.toLE + +@[simp] theorem sourceVertexOrder_lt (a b : SeedCell) : + a < b ↔ SeedEncoding.cellEquiv a < SeedEncoding.cellEquiv b := Iff.rfl + +theorem source_valid_to_index (w : List SeedCell) (hw : SimplicialChains.Valid seedGraph w) : + SimplicialChains.Valid SeedChainCertificate.graph (w.map SeedEncoding.cellEquiv) := by + constructor + · rw [List.pairwise_map] + exact hw.1 + · rw [List.pairwise_map] + simpa only [SeedChainCertificate.graph,SimpleGraph.comap_adj, + ← SeedEncoding.cellEquiv_symm_apply,Equiv.symm_apply_apply] using hw.2 + +theorem index_valid_to_source (w : List (Fin 103)) + (hw : SimplicialChains.Valid SeedChainCertificate.graph w) : + SimplicialChains.Valid seedGraph (w.map SeedEncoding.cellEquiv.symm) := by + constructor + · rw [List.pairwise_map] + simpa only [sourceVertexOrder_lt,Equiv.apply_symm_apply] using hw.1 + · rw [List.pairwise_map] + exact hw.2 + +/-- Relabeling uses the original seed graph and merely chooses an order on its +vertices for the signed integral chain convention. -/ +noncomputable def sourceLinkContraction (K : SimplicialChains.Contraction SeedChainCertificate.graph) : + SimplicialChains.Contraction seedGraph := + K.reindex SeedEncoding.cellEquiv.symm (index_valid_to_source) (source_valid_to_index) + +end EilenbergGanea + +namespace EilenbergGanea +local instance : LinearOrder SeedCell := sourceVertexOrder +local instance : Preorder SeedCell := sourceVertexOrder.toPartialOrder.toPreorder +local instance : LT SeedCell := sourceVertexOrder.toLT +local instance : LE SeedCell := sourceVertexOrder.toLE + +theorem source_valid_length_le (w : List SeedCell) (hw : SimplicialChains.Valid seedGraph w) : + w.length ≤ 3 := by + simpa only [List.length_map] using + SeedChainCertificate.valid_length_le (w.map SeedEncoding.cellEquiv) (source_valid_to_index w hw) + +theorem source_cd_eq_two_of_contraction + (K : SimplicialChains.Contraction SeedChainCertificate.graph) : + cohomologicalDimension SourceGroup = 2 := by + apply le_antisymm + · exact LevelBasis.artin_height_kernel_cd_le_two seedGraph seedBase seed_connected.preconnected + (sourceLinkContraction K) source_valid_length_le + · exact source_two_le_cohomologicalDimension + +/-- The exact remaining geometric interface is not limited to finite or +countable presentations. This endpoint excludes any ordinary presentation +whose actual integral equivariant cellular boundaries freely span cycles. -/ +theorem source_no_boundary_basis_of_contraction + (K : SimplicialChains.Contraction SeedChainCertificate.graph) + {A R : Type*} (a₀ : A → SourceGroup) + (ha₀ : Function.Surjective (wordValue a₀)) + (r₀ : R → FreeGroup A) (hr₀ : ∀ i, wordValue a₀ (r₀ i) = 1) + (hp₀ : (wordValue a₀).ker = Subgroup.normalClosure (Set.range r₀)) + (E : BasedChains SourceGroup R ≃ₗ[ℤ] cycles a₀) + (hE : ∀ c, (E c : BasedChains SourceGroup A) = relatorChainMap a₀ r₀ c) : False := by + let : Group.ResiduallyFinite SourceGroup := source_residuallyFinite + exact LevelBasis.no_boundary_basis_presentation seedGraph seedBase seed_connected.preconnected + (sourceLinkContraction K) source_valid_length_le SourceTransport.source_small_labels + a₀ ha₀ r₀ hr₀ hp₀ E hE + +end EilenbergGanea + + + +namespace EilenbergGanea + +/-- Literal integral cohomological dimension of the source's fixed group. -/ +theorem source_cohomologicalDimension : cohomologicalDimension SourceGroup = 2 := + source_cd_eq_two_of_contraction SeedChainCertificate.contraction + +/-- No arbitrary-alphabet genuine presentation has its relators as an integral +basis of Cayley cycles. -/ +theorem source_no_boundary_basis + {A R : Type*} (a₀ : A → SourceGroup) + (ha₀ : Function.Surjective (wordValue a₀)) + (r₀ : R → FreeGroup A) (hr₀ : ∀ i, wordValue a₀ (r₀ i) = 1) + (hp₀ : (wordValue a₀).ker = Subgroup.normalClosure (Set.range r₀)) + (E : BasedChains SourceGroup R ≃ₗ[ℤ] cycles a₀) + (hE : ∀ c, (E c : BasedChains SourceGroup A) = relatorChainMap a₀ r₀ c) : False := + source_no_boundary_basis_of_contraction SeedChainCertificate.contraction + a₀ ha₀ r₀ hr₀ hp₀ E hE + +end EilenbergGanea + + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/IntegralDegree.lean b/lean/OAI/Topology/EilenbergGanea/IntegralDegree.lean index e5fec02e7e741e4a2d1999bbaa08002f1743f2f0..891d256269c141eb55a1027a037643de6daff0ea 100644 --- a/lean/OAI/Topology/EilenbergGanea/IntegralDegree.lean +++ b/lean/OAI/Topology/EilenbergGanea/IntegralDegree.lean @@ -1,1408 +1,1408 @@ -import OAI.Topology.EilenbergGanea.UnitaryWords -import Mathlib.Analysis.Calculus.DifferentialForm.Basic -import Mathlib.MeasureTheory.Integral.DivergenceTheorem -import Mathlib.Analysis.BoxIntegral.DivergenceTheorem -import Mathlib.Analysis.Calculus.BumpFunction.InnerProduct -import Mathlib.MeasureTheory.Integral.Bochner.Basic -import Mathlib.Analysis.Calculus.FDeriv.Equiv - -namespace OAI - -noncomputable section - -open Set Filter Topology MeasureTheory -open scoped ContDiff - -open scoped ContDiff -open Set Filter Topology -namespace EilenbergGanea -variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] - [FiniteDimensional ℝ E] -/- Avoidance of an arbitrary open boundary makes the selected fiber -compact whenever the closure of the open set is compact. -/ -omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] in -theorem compact_selected_fiber (f : E → E) (y : E) (U : Set E) - (hU : IsOpen U) (hc : IsCompact (closure U)) (hf : ContinuousOn f (closure U)) - (hb : ∀ x ∈ frontier U, f x ≠ y) : IsCompact (U ∩ f ⁻¹' {y}) := by - have he : U ∩ f ⁻¹' {y} = closure U ∩ f ⁻¹' {y} := by - ext x - constructor - · exact fun ⟨hx, hy⟩ => ⟨subset_closure hx, hy⟩ - · rintro ⟨hx, hy⟩ - refine ⟨?_, hy⟩ - by_contra hn - exact hb x ⟨hx, by simpa only [hU.interior_eq] using hn⟩ hy - rw [he] - exact hc.of_isClosed_subset (hf.preimage_isClosed_of_isClosed isClosed_closure - isClosed_singleton) inter_subset_left - -/- The determinant retains its sign on a sufficiently small neighborhood -of a regular point. -/ -theorem exists_constant_jacobian_sign_patch (f : E → E) {x : E} - (hf : ContDiff ℝ 1 f) (hd : (fderiv ℝ f x).det ≠ 0) (W : Set E) - (hW : IsOpen W) (hxW : x ∈ W) : - ∃ V : Set E, IsOpen V ∧ x ∈ V ∧ V ⊆ W ∧ InjOn f V ∧ IsOpen (f '' V) ∧ - ∀ z ∈ V, (fderiv ℝ f z).det = - (if 0 < (fderiv ℝ f x).det then 1 else -1) * |(fderiv ℝ f z).det| := by - let d : E → ℝ := fun z => (fderiv ℝ f z).det - have hc : Continuous d := ContinuousLinearMap.continuous_det.comp - (hf.continuous_fderiv (by norm_num)) - let e := (fderiv ℝ f x).toContinuousLinearEquivOfDetNeZero hd - have hf' : HasFDerivAt f (e : E →L[ℝ] E) x := - (hf.differentiable (by norm_num) x).hasFDerivAt - let p := hf.contDiffAt.toOpenPartialHomeomorph f hf' (by norm_num) - have hxP : x ∈ p.source := hf.contDiffAt.mem_toOpenPartialHomeomorph_source hf' (by norm_num) - let A : Set E := if 0 < d x then {z | 0 < d z} else {z | d z < 0} - have hA : IsOpen A := by - dsimp [A] - split_ifs - · exact isOpen_lt continuous_const hc - · exact isOpen_lt hc continuous_const - have hxA : x ∈ A := by - dsimp [A] - split_ifs with hp - · exact hp - · exact lt_of_le_of_ne (le_of_not_gt hp) hd - let V := W ∩ p.source ∩ A - have hV : IsOpen V := (hW.inter p.open_source).inter hA - refine ⟨V, hV, ⟨⟨hxW, hxP⟩, hxA⟩, fun _ h => h.1.1, - p.injOn.mono (fun _ h => h.1.2), ?_, ?_⟩ - · exact p.isOpen_image_of_subset_source hV (fun _ h => h.1.2) - · intro z hz - have hzA := hz.2 - dsimp [A] at hzA - split_ifs at hzA ⊢ with hp - · change 0 < (fderiv ℝ f z).det at hzA - simp [abs_of_pos hzA] - · change (fderiv ℝ f z).det < 0 at hzA - simp [abs_of_neg hzA] - -/- Finitely many regular roots admit pairwise disjoint inverse neighborhoods, -all contained in the prescribed isolating open set. -/ -theorem disjoint_regular_inverse_patches (f : E → E) (hf : ContDiff ℝ 1 f) - (U : Set E) (hU : IsOpen U) (S : Set E) (hS : S.Finite) - (hSU : S ⊆ U) (hd : ∀ x ∈ S, (fderiv ℝ f x).det ≠ 0) : - ∃ V : S → Set E, - (∀ x, IsOpen (V x) ∧ (x : E) ∈ V x ∧ V x ⊆ U ∧ InjOn f (V x) ∧ - IsOpen (f '' V x) ∧ ∀ z ∈ V x, (fderiv ℝ f z).det = - (if 0 < (fderiv ℝ f x).det then 1 else -1) * |(fderiv ℝ f z).det|) ∧ - Pairwise (fun x y => Disjoint (V x) (V y)) := by - classical - obtain ⟨W, hW, hdisj⟩ := hS.t2_separation - have hp (x : S) := exists_constant_jacobian_sign_patch f hf (hd x x.property) - (U ∩ W x) (hU.inter (hW x).2) ⟨hSU x.property, (hW x).1⟩ - choose V hopen hmem hsub hinj himg hsign using hp - refine ⟨V, fun x => ⟨hopen x, hmem x, fun _ h => (hsub x h).1, - hinj x, himg x, hsign x⟩, ?_⟩ - intro x y hxy - exact (hdisj x.property y.property (fun he => hxy (Subtype.ext he))).mono - (fun _ h => (hsub x h).2) (fun _ h => (hsub y h).2) - -/- Compactness shrinks the target neighborhood so that all selected -preimages remain in the chosen inverse patches. It does not assert a -smooth boundary or a proper global map. -/ -omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] in -theorem exists_target_neighborhood_of_patches {ι : Type*} [Fintype ι] - (f : E → E) (y : E) (U : Set E) (hU : IsOpen U) - (hc : IsCompact (closure U)) (hf : ContinuousOn f (closure U)) - (hb : ∀ x ∈ frontier U, f x ≠ y) (V : ι → Set E) - (hV : ∀ i, IsOpen (V i)) (himg : ∀ i, IsOpen (f '' V i)) - (hy : ∀ i, y ∈ f '' V i) - (hcover : ∀ x ∈ U, f x = y → ∃ i, x ∈ V i) : - ∃ N : Set E, IsOpen N ∧ y ∈ N ∧ (∀ i, N ⊆ f '' V i) ∧ - ∀ x ∈ U, f x ∈ N → ∃ i, x ∈ V i := by - let K := closure U \ ⋃ i, V i - have hK : IsCompact K := hc.diff (isOpen_iUnion hV) - have hclosed : IsClosed (f '' K) := (hK.image_of_continuousOn - (hf.mono (fun _ h => h.1))).isClosed - have hyK : y ∉ f '' K := by - rintro ⟨x, ⟨hxcl, hxV⟩, hxy⟩ - have hxU : x ∈ U := by - by_contra hn - exact hb x ⟨hxcl, by simpa only [hU.interior_eq] using hn⟩ hxy - obtain ⟨i, hi⟩ := hcover x hxU hxy - exact hxV (mem_iUnion.mpr ⟨i, hi⟩) - refine ⟨(f '' K)ᶜ ∩ ⋂ i, f '' V i, - hclosed.isOpen_compl.inter (isOpen_iInter_of_finite himg), - ⟨hyK, mem_iInter.mpr hy⟩, ?_, ?_⟩ - · intro i z hz - exact mem_iInter.mp hz.2 i - · intro x hxU hxN - by_contra hn - apply hxN.1 - refine ⟨x, ⟨subset_closure hxU, ?_⟩, rfl⟩ - simpa only [mem_iUnion] using hn - -end EilenbergGanea - -open Set MeasureTheory -namespace EilenbergGanea -section SignedIntegralDegree -variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] - [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] - (μ : Measure E) [μ.IsAddHaarMeasure] - -/- The integral representative of local degree against a target bump. -/ -def jacobianIntegral (f : E → E) (U : Set E) (ρ : E → ℝ) : ℝ := - ∫ x in U, (fderiv ℝ f x).det * ρ (f x) ∂μ - -/- The signed change-of-variables formula on one regular inverse patch. -/ -theorem jacobianIntegral_of_injOn (f : E → E) (U : Set E) (hU : MeasurableSet U) - (hf : ∀ x ∈ U, DifferentiableAt ℝ f x) (hinj : InjOn f U) - (ρ : E → ℝ) (σ : ℝ) (hσ : ∀ x ∈ U, - (fderiv ℝ f x).det = σ * |(fderiv ℝ f x).det|) : - jacobianIntegral μ f U ρ = σ * ∫ y in f '' U, ρ y ∂μ := by - have hc := integral_image_eq_integral_abs_det_fderiv_smul μ hU - (fun x hx => (hf x hx).hasFDerivAt.hasFDerivWithinAt) hinj ρ - rw [jacobianIntegral, hc, ← integral_const_mul] - apply setIntegral_congr_fun hU - intro x hx - dsimp only - calc - _ = (σ * |(fderiv ℝ f x).det|) * ρ (f x) := congrArg (· * ρ (f x)) (hσ x hx) - _ = _ := by simp only [smul_eq_mul, mul_assoc] - -/- If the normalized target bump is supported inside an inverse patch, the -patch contributes exactly the sign of its Jacobian. -/ -theorem jacobianIntegral_inverse_patch (f : E → E) (U : Set E) (hU : MeasurableSet U) - (hf : ∀ x ∈ U, DifferentiableAt ℝ f x) (hinj : InjOn f U) - (ρ : E → ℝ) (σ : ℝ) (hσ : ∀ x ∈ U, - (fderiv ℝ f x).det = σ * |(fderiv ℝ f x).det|) - (hsupp : Function.support ρ ⊆ f '' U) (hunit : ∫ y, ρ y ∂μ = 1) : - jacobianIntegral μ f U ρ = σ := by - rw [jacobianIntegral_of_injOn μ f U hU hf hinj ρ σ hσ] - have he : (∫ y in f '' U, ρ y ∂μ) = ∫ y, ρ y ∂μ := by - apply setIntegral_eq_integral_of_forall_compl_eq_zero - intro y hy - by_contra hn - exact hy (hsupp hn) - rw [he, hunit, mul_one] - -/- Excision and finite additivity of the analytic degree representative. -/ -omit [FiniteDimensional ℝ E] [BorelSpace E] [μ.IsAddHaarMeasure] in -theorem jacobianIntegral_sum_patches {ι : Type*} [Fintype ι] - (f : E → E) (U : Set E) (hU : MeasurableSet U) (V : ι → Set E) - (hV : ∀ i, MeasurableSet (V i)) (hsub : ∀ i, V i ⊆ U) - (hdisj : Pairwise (fun i j => Disjoint (V i) (V j))) (ρ : E → ℝ) - (hsupp : ∀ x ∈ U, ρ (f x) ≠ 0 → ∃ i, x ∈ V i) - (hint : IntegrableOn (fun x => (fderiv ℝ f x).det * ρ (f x)) U μ) : - jacobianIntegral μ f U ρ = ∑ i, jacobianIntegral μ f (V i) ρ := by - unfold jacobianIntegral - rw [setIntegral_eq_of_subset_of_forall_sdiff_eq_zero hU - (iUnion_subset hsub)] - · exact integral_iUnion_fintype hV hdisj (fun i => hint.mono_set (hsub i)) - · rintro x ⟨hxU, hxV⟩ - have hz : ρ (f x) = 0 := by - by_contra hn - obtain ⟨i, hi⟩ := hsupp x hxU hn - exact hxV (mem_iUnion.mpr ⟨i, hi⟩) - rw [hz, mul_zero] - -/- The regular signed-count formula, once disjoint inverse patches and a -small normalized target bump have been chosen. -/ -theorem jacobianIntegral_eq_sum_signs {ι : Type*} [Fintype ι] - (f : E → E) (U : Set E) (hU : MeasurableSet U) (V : ι → Set E) - (hV : ∀ i, MeasurableSet (V i)) (hsub : ∀ i, V i ⊆ U) - (hdisj : Pairwise (fun i j => Disjoint (V i) (V j))) - (hf : ∀ x ∈ U, DifferentiableAt ℝ f x) (hinj : ∀ i, InjOn f (V i)) - (ρ : E → ℝ) (σ : ι → ℝ) - (hσ : ∀ i x, x ∈ V i → (fderiv ℝ f x).det = σ i * |(fderiv ℝ f x).det|) - (hcovered : ∀ x ∈ U, ρ (f x) ≠ 0 → ∃ i, x ∈ V i) - (hsupp : ∀ i, Function.support ρ ⊆ f '' V i) - (hunit : ∫ y, ρ y ∂μ = 1) - (hint : IntegrableOn (fun x => (fderiv ℝ f x).det * ρ (f x)) U μ) : - jacobianIntegral μ f U ρ = ∑ i, σ i := by - rw [jacobianIntegral_sum_patches μ f U hU V hV hsub hdisj ρ hcovered hint] - apply Finset.sum_congr rfl - intro i _ - exact jacobianIntegral_inverse_patch μ f (V i) (hV i) - (fun x hx => hf x (hsub i hx)) (hinj i) ρ (σ i) (hσ i) (hsupp i) hunit - -/- A vanishing selected preimage forces every supported degree integral to -vanish. This implication supplies existence from nonzero degree. -/ -omit [FiniteDimensional ℝ E] [BorelSpace E] [μ.IsAddHaarMeasure] in -theorem jacobianIntegral_eq_zero_of_no_preimage (f : E → E) (U : Set E) (ρ : E → ℝ) - (h : ∀ x ∈ U, ρ (f x) = 0) : jacobianIntegral μ f U ρ = 0 := by - apply setIntegral_eq_zero_of_forall_eq_zero - intro x hx - simp only [h x hx, mul_zero] - -end SignedIntegralDegree -end EilenbergGanea - -namespace EilenbergGanea -open Set MeasureTheory Filter Topology -variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] - [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] - (μ : Measure E) [μ.IsAddHaarMeasure] - -/-- A normalized smooth target bump can be supported in any prescribed -neighborhood of the target. -/ -theorem exists_normalized_smooth_bump (y : E) (N : Set E) (hN : IsOpen N) (hy : y ∈ N) : - ∃ ρ : E → ℝ, ContDiff ℝ ∞ ρ ∧ HasCompactSupport ρ ∧ tsupport ρ ⊆ N ∧ - (∫ z, ρ z ∂μ) = 1 := by - obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp hN y hy - let b : ContDiffBump y := ⟨r / 4, r / 2, by linarith, by linarith⟩ - refine ⟨b.normed μ, b.contDiff_normed, b.hasCompactSupport_normed, - ?_, b.integral_normed⟩ - rw [b.tsupport_normed_eq] - intro z hz - apply hball - exact lt_of_le_of_lt hz (by change r / 2 < r; linarith) - -/-- One target neighborhood works for every normalized continuous density. -This uniformity lets the same density be used throughout a localized homotopy. -/ -theorem regular_signed_count_neighborhood (f : E → E) (hf : ContDiff ℝ 1 f) - (y : E) (U : Set E) (hU : IsOpen U) (hc : IsCompact (closure U)) - (hb : ∀ x ∈ frontier U, f x ≠ y) (s : Finset E) - (hs : ∀ x, x ∈ s ↔ x ∈ U ∧ f x = y) - (hd : ∀ x ∈ s, (fderiv ℝ f x).det ≠ 0) : - ∃ N : Set E, IsOpen N ∧ y ∈ N ∧ ∀ ρ : E → ℝ, Continuous ρ → - Function.support ρ ⊆ N → (∫ z, ρ z ∂μ) = 1 → - jacobianIntegral μ f U ρ = ∑ x ∈ s, (if 0 < (fderiv ℝ f x).det then 1 else -1) := by - classical - obtain ⟨V, hV, hdisj⟩ := disjoint_regular_inverse_patches f hf U hU - (s : Set E) s.finite_toSet (fun x hx => ((hs x).mp hx).1) hd - obtain ⟨N, hN, hyN, hNimg, hNpre⟩ := exists_target_neighborhood_of_patches f y U hU - hc hf.continuous.continuousOn hb V (fun i => (hV i).1) - (fun i => (hV i).2.2.2.2.1) - (fun i => ⟨i, (hV i).2.1, ((hs i).mp i.property).2⟩) - (fun x hx hxy => ⟨⟨x, (hs x).mpr ⟨hx, hxy⟩⟩, (hV _).2.1⟩) - refine ⟨N, hN, hyN, fun ρ hρ hρN hρunit => ?_⟩ - have hcont : Continuous (fun x => (fderiv ℝ f x).det * ρ (f x)) := - (ContinuousLinearMap.continuous_det.comp (hf.continuous_fderiv (by norm_num))).mul - (hρ.comp hf.continuous) - have hint : IntegrableOn (fun x => (fderiv ℝ f x).det * ρ (f x)) U μ := - (hcont.continuousOn.integrableOn_compact hc).mono_set subset_closure - have hcount := jacobianIntegral_eq_sum_signs μ f U hU.measurableSet V - (fun i => (hV i).1.measurableSet) (fun i => (hV i).2.2.1) hdisj - (fun x _ => hf.differentiable (by norm_num) x) (fun i => (hV i).2.2.2.1) - ρ (fun i => if 0 < (fderiv ℝ f i).det then 1 else -1) - (fun i => (hV i).2.2.2.2.2) - (fun x hx hn => hNpre x hx (hρN hn)) - (fun i z hz => hNimg i (hρN hz)) hρunit hint - exact hcount.trans (Finset.sum_subtype (p := fun x => x ∈ (s : Set E)) s - (fun _ => Iff.rfl) (fun x => (if 0 < (fderiv ℝ f x).det then 1 else -1 : ℝ))).symm - -/-- The analytic representative has exactly the expected signed regular -count for a sufficiently concentrated normalized target bump. -/ -theorem regular_signed_count_density (f : E → E) (hf : ContDiff ℝ 1 f) - (y : E) (U : Set E) (hU : IsOpen U) (hc : IsCompact (closure U)) - (hb : ∀ x ∈ frontier U, f x ≠ y) (s : Finset E) - (hs : ∀ x, x ∈ s ↔ x ∈ U ∧ f x = y) - (hd : ∀ x ∈ s, (fderiv ℝ f x).det ≠ 0) : - ∃ ρ : E → ℝ, ContDiff ℝ ∞ ρ ∧ HasCompactSupport ρ ∧ (∫ z, ρ z ∂μ) = 1 ∧ - jacobianIntegral μ f U ρ = ∑ x ∈ s, (if 0 < (fderiv ℝ f x).det then 1 else -1) := by - classical - obtain ⟨V, hV, hdisj⟩ := disjoint_regular_inverse_patches f hf U hU - (s : Set E) s.finite_toSet (fun x hx => ((hs x).mp hx).1) hd - obtain ⟨N, hN, hyN, hNimg, hNpre⟩ := exists_target_neighborhood_of_patches f y U hU - hc hf.continuous.continuousOn hb V (fun i => (hV i).1) - (fun i => (hV i).2.2.2.2.1) - (fun i => ⟨i, (hV i).2.1, ((hs i).mp i.property).2⟩) - (fun x hx hxy => ⟨⟨x, (hs x).mpr ⟨hx, hxy⟩⟩, (hV _).2.1⟩) - obtain ⟨ρ, hρ, hρc, hρN, hρunit⟩ := exists_normalized_smooth_bump μ y N hN hyN - refine ⟨ρ, hρ, hρc, hρunit, ?_⟩ - have hcont : Continuous (fun x => (fderiv ℝ f x).det * ρ (f x)) := - (ContinuousLinearMap.continuous_det.comp (hf.continuous_fderiv (by norm_num))).mul - (hρ.continuous.comp hf.continuous) - have hint : IntegrableOn (fun x => (fderiv ℝ f x).det * ρ (f x)) U μ := - (hcont.continuousOn.integrableOn_compact hc).mono_set subset_closure - have hcount := jacobianIntegral_eq_sum_signs μ f U hU.measurableSet V - (fun i => (hV i).1.measurableSet) (fun i => (hV i).2.2.1) hdisj - (fun x _ => hf.differentiable (by norm_num) x) (fun i => (hV i).2.2.2.1) - ρ (fun i => if 0 < (fderiv ℝ f i).det then 1 else -1) - (fun i => (hV i).2.2.2.2.2) - (fun x hx hn => hNpre x hx (hρN (subset_tsupport ρ hn))) - (fun i z hz => hNimg i (hρN (subset_tsupport ρ hz))) hρunit hint - exact hcount.trans (Finset.sum_subtype (p := fun x => x ∈ (s : Set E)) s - (fun _ => Iff.rfl) (fun x => (if 0 < (fderiv ℝ f x).det then 1 else -1 : ℝ))).symm - -end EilenbergGanea - -open Set MeasureTheory Filter Topology -namespace EilenbergGanea - -/-- Standard coordinate basis as a tuple of vectors. -/ -def coordinateBasis (n : ℕ) : Fin n → (Fin n → ℝ) := fun i => Pi.single i 1 - -/-- The signed coordinate coefficient of an n-form in dimension n+1. -/ -def formFlux {n : ℕ} (form : (Fin (n + 1) → ℝ) → - (Fin (n + 1) → ℝ) [⋀^Fin n]→L[ℝ] ℝ) (i : Fin (n + 1)) - (x : Fin (n + 1) → ℝ) : ℝ := - (-1 : ℝ) ^ i.val * form x (i.removeNth (coordinateBasis (n + 1))) - -/-- Stokes on a rectangular box, as a direct consequence of Mathlib's -Bochner divergence theorem. No smoothness of an arbitrary open-set boundary -is assumed in the later application. -/ -theorem integral_extDeriv_box {n : ℕ} - (form : (Fin (n + 1) → ℝ) → (Fin (n + 1) → ℝ) [⋀^Fin n]→L[ℝ] ℝ) - (hform : Differentiable ℝ form) (a b : Fin (n + 1) → ℝ) (hab : a ≤ b) - (hint : IntegrableOn (fun x => extDeriv form x (coordinateBasis (n + 1))) (Icc a b)) : - (∫ x in Icc a b, extDeriv form x (coordinateBasis (n + 1))) = - ∑ i : Fin (n + 1), - ((∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), - formFlux form i (i.insertNth (b i) x)) - - ∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), - formFlux form i (i.insertNth (a i) x)) := by - have hd (i : Fin (n + 1)) (x : Fin (n + 1) → ℝ) : - DifferentiableAt ℝ (formFlux form i) x := by - exact ((hform x).continuousAlternatingMap_apply_const _).const_mul _ - have he (x : Fin (n + 1) → ℝ) : - (∑ i : Fin (n + 1), fderiv ℝ (formFlux form i) x (Pi.single i 1)) = - extDeriv form x (coordinateBasis (n + 1)) := by - rw [extDeriv_apply (hform x)] - apply Finset.sum_congr rfl - intro i _ - change (fderiv ℝ (fun y => (-1 : ℝ) ^ i.val * - form y (i.removeNth (coordinateBasis (n + 1)))) x) (Pi.single i 1) = _ - rw [fderiv_const_mul ((hform x).continuousAlternatingMap_apply_const _) ] - simp [coordinateBasis] - have h := integral_divergence_of_hasFDerivAt_off_countable' a b hab - (formFlux form) (fun i x => fderiv ℝ (formFlux form i) x) ∅ countable_empty - (fun i => (show Differentiable ℝ (formFlux form i) from hd i).continuous.continuousOn) - (fun x _ i => (hd i x).hasFDerivAt) (by simpa only [he] using hint) - simpa only [he] using h - -/-- Every top-degree differential form on Euclidean n-space is closed. -/ -theorem extDeriv_topForm_eq_zero {n : ℕ} - (φ : (Fin n → ℝ) → (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ) (x : Fin n → ℝ) : - extDeriv φ x = 0 := by - ext v - apply (extDeriv φ x).toAlternatingMap.map_linearDependent - intro hv - have h := hv.fintype_card_le_finrank - simp at h - -/-- The pullback of a top form by a C² map is closed (the Piola identity). -/ -theorem extDeriv_pullback_topForm_eq_zero {n : ℕ} {E : Type*} - [NormedAddCommGroup E] [NormedSpace ℝ E] - (φ : (Fin n → ℝ) → (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ) - (hφ : Differentiable ℝ φ) (F : E → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) (x : E) : - extDeriv (fun y => (φ (F y)).compContinuousLinearMap (fderiv ℝ F y)) x = 0 := by - rw [extDeriv_pullback (hφ _) hF.contDiffAt (by simp), extDeriv_topForm_eq_zero] - ext v - rfl - - -/-- A closed form has total signed flux zero across the faces of a box. -/ -theorem closedForm_boundary_box {n : ℕ} - (form : (Fin (n + 1) → ℝ) → (Fin (n + 1) → ℝ) [⋀^Fin n]→L[ℝ] ℝ) - (hform : Differentiable ℝ form) (hclosed : ∀ x, extDeriv form x = 0) - (a b : Fin (n + 1) → ℝ) (hab : a ≤ b) : - (∑ i : Fin (n + 1), - ((∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), - formFlux form i (i.insertNth (b i) x)) - - ∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), - formFlux form i (i.insertNth (a i) x))) = 0 := by - have hz (x) : extDeriv form x (coordinateBasis (n + 1)) = 0 := by rw [hclosed]; rfl - have h := integral_extDeriv_box form hform a b hab (by simpa only [hz] using integrableOn_zero) - simpa only [hz, integral_zero] using h.symm - -/-- The coefficient integrals on two opposing faces of a box agree for a -closed form whose flux on all other faces is zero. This is the analytic -homotopy-invariance step with the sides outside the support of the form. -/ -theorem closedForm_opposite_faces {n : ℕ} - (form : (Fin (n + 1) → ℝ) → (Fin (n + 1) → ℝ) [⋀^Fin n]→L[ℝ] ℝ) - (hform : Differentiable ℝ form) (hclosed : ∀ x, extDeriv form x = 0) - (a b : Fin (n + 1) → ℝ) (hab : a ≤ b) (k : Fin (n + 1)) - (hside : ∀ i, i ≠ k → ∀ x ∈ Icc (a ∘ i.succAbove) (b ∘ i.succAbove), - formFlux form i (i.insertNth (b i) x) = 0 ∧ - formFlux form i (i.insertNth (a i) x) = 0) : - (∫ x in Icc (a ∘ k.succAbove) (b ∘ k.succAbove), - formFlux form k (k.insertNth (b k) x)) = - ∫ x in Icc (a ∘ k.succAbove) (b ∘ k.succAbove), - formFlux form k (k.insertNth (a k) x) := by - have h := closedForm_boundary_box form hform hclosed a b hab - rw [Finset.sum_eq_single k] at h - · exact sub_eq_zero.mp h - · intro i _ hi - have hb0 : (∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), - formFlux form i (i.insertNth (b i) x)) = 0 := by - apply setIntegral_eq_zero_of_forall_eq_zero - intro x hx - exact (hside i hi x hx).1 - have ha0 : (∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), - formFlux form i (i.insertNth (a i) x)) = 0 := by - apply setIntegral_eq_zero_of_forall_eq_zero - intro x hx - exact (hside i hi x hx).2 - rw [hb0, ha0, sub_self] - · simp - -/-- Determinant form with the standard coordinate orientation. -/ -def coordinateVolumeForm (n : ℕ) : (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ := - { Matrix.detRowAlternating with cont := continuous_id.matrix_det } - -/-- Smooth pullbacks of a top form are differentiable. -/ -theorem differentiable_pullback_topForm {n : ℕ} {E : Type*} - [NormedAddCommGroup E] [NormedSpace ℝ E] - (φ : (Fin n → ℝ) → (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ) - (hφ : Differentiable ℝ φ) (F : E → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) : - Differentiable ℝ (fun y => (φ (F y)).compContinuousLinearMap (fderiv ℝ F y)) := by - intro x - apply ((hφ (F x)).comp x (hF.differentiable (by norm_num) x) - ).continuousAlternatingMapCompContinuousLinearMap - exact (hF.fderiv_right (m := 1) (by norm_num)).differentiable (by norm_num) x - - -/-- Restricting a field to an open set whose boundary avoids its topological -support is locally either the original field or zero. -/ -theorem indicator_eventuallyEq_or_zero {X A : Type*} [TopologicalSpace X] [Zero A] - (U : Set X) (hU : IsOpen U) (f : X → A) - (hb : Disjoint (frontier U) (tsupport f)) (x : X) : - U.indicator f =ᶠ[nhds x] f ∨ U.indicator f =ᶠ[nhds x] fun _ => 0 := by - classical - by_cases hx : x ∈ U - · left - filter_upwards [hU.mem_nhds hx] with y hy - exact Set.indicator_of_mem hy f - · right - by_cases hc : x ∈ closure U - · have hf : x ∉ tsupport f := by - apply Set.disjoint_left.mp hb - exact ⟨hc, by simpa only [hU.interior_eq] using hx⟩ - have he := notMem_tsupport_iff_eventuallyEq.mp hf - filter_upwards [he] with y hy - by_cases hyU : y ∈ U <;> simp [Set.indicator, hyU, hy] - · filter_upwards [isClosed_closure.isOpen_compl.mem_nhds hc] with y hy - exact Set.indicator_of_notMem (fun hyU => hy (subset_closure hyU)) f - -/-- Excision at the differential-form level: cutting off at an arbitrary -isolating open-set boundary preserves differentiability and closedness. -/ -theorem localized_closedForm {n : ℕ} {E : Type*} - [NormedAddCommGroup E] [NormedSpace ℝ E] - (form : E → E [⋀^Fin n]→L[ℝ] ℝ) (hform : Differentiable ℝ form) - (hclosed : ∀ x, extDeriv form x = 0) (U : Set E) (hU : IsOpen U) - (hb : Disjoint (frontier U) (tsupport form)) : - Differentiable ℝ (U.indicator form) ∧ ∀ x, extDeriv (U.indicator form) x = 0 := by - constructor - · intro x - rcases indicator_eventuallyEq_or_zero U hU form hb x with hx | hx - · exact (hform x).congr_of_eventuallyEq hx - · exact differentiableAt_const (c := (0 : E [⋀^Fin n]→L[ℝ] ℝ)) |>.congr_of_eventuallyEq hx - · intro x - rcases indicator_eventuallyEq_or_zero U hU form hb x with hx | hx - · rw [hx.extDeriv_eq, hclosed] - · rw [hx.extDeriv_eq] - ext v - simp [extDeriv, ContinuousAlternatingMap.alternatizeUncurryFin_apply] - -/-- Homotopy-invariant integrals of a pulled-back target top form, with no -unproved mapping-degree primitive. -/ -theorem pullback_topForm_opposite_faces {n : ℕ} - (φ : (Fin n → ℝ) → (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ) - (hφ : Differentiable ℝ φ) (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) - (hF : ContDiff ℝ 2 F) (a b : Fin (n + 1) → ℝ) (hab : a ≤ b) - (k : Fin (n + 1)) - (hside : ∀ i, i ≠ k → ∀ x ∈ Icc (a ∘ i.succAbove) (b ∘ i.succAbove), - φ (F (i.insertNth (b i) x)) = 0 ∧ φ (F (i.insertNth (a i) x)) = 0) : - (∫ x in Icc (a ∘ k.succAbove) (b ∘ k.succAbove), - formFlux (fun y => (φ (F y)).compContinuousLinearMap (fderiv ℝ F y)) - k (k.insertNth (b k) x)) = - ∫ x in Icc (a ∘ k.succAbove) (b ∘ k.succAbove), - formFlux (fun y => (φ (F y)).compContinuousLinearMap (fderiv ℝ F y)) - k (k.insertNth (a k) x) := by - apply closedForm_opposite_faces _ (differentiable_pullback_topForm φ hφ F hF) - (extDeriv_pullback_topForm_eq_zero φ hφ F hF) a b hab k - intro i hi x hx - obtain ⟨hb, ha⟩ := hside i hi x hx - simp [formFlux, hb, ha] - - -/-- Evaluation of the standard volume form is the ordinary linear - determinant. -/ -theorem coordinateVolumeForm_linear {n : ℕ} - (L : (Fin n → ℝ) →L[ℝ] (Fin n → ℝ)) : - coordinateVolumeForm n (fun i => L (coordinateBasis n i)) = L.det := by - change Matrix.det (fun i => L (Pi.single i 1)) = _ - calc - _ = (LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin n)) - L.toLinearMap).transpose.det := by - congr 1 - _ = _ := by rw [Matrix.det_transpose, LinearMap.det_toMatrix] - -/-- At a temporal face, the pullback coefficient is precisely the signed -Jacobian density of the corresponding slice. -/ -theorem formFlux_pullback_first_face {n : ℕ} - (ρ : (Fin n → ℝ) → ℝ) (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) - (t : ℝ) (x : Fin n → ℝ) (hF : DifferentiableAt ℝ F (Fin.cons t x)) : - formFlux (fun y => ((ρ (F y)) • coordinateVolumeForm n).compContinuousLinearMap - (fderiv ℝ F y)) 0 (Fin.cons t x) = - (fderiv ℝ (fun z => F (Fin.cons t z)) x).det * ρ (F (Fin.cons t x)) := by - let J : (Fin n → ℝ) →L[ℝ] (Fin (n + 1) → ℝ) := - (0 : (Fin n → ℝ) →L[ℝ] ℝ).finCons (ContinuousLinearMap.id ℝ (Fin n → ℝ)) - have hJ : HasFDerivAt (fun z : Fin n → ℝ => Fin.cons t z) J x := - (hasFDerivAt_const t x).finCons (hasFDerivAt_id x) - have hs := hF.hasFDerivAt.comp x hJ - have he (i : Fin n) : J (coordinateBasis n i) = coordinateBasis (n + 1) i.succ := by - funext j - refine Fin.cases ?_ (fun k => ?_) j - · simp [J, coordinateBasis, ContinuousLinearMap.finCons] - · simp [J, coordinateBasis, ContinuousLinearMap.finCons, Pi.single_apply] - have hs' : fderiv ℝ (fun z => F (Fin.cons t z)) x = - (fderiv ℝ F (Fin.cons t x)).comp J := hs.fderiv - rw [hs'] - have hd := coordinateVolumeForm_linear ((fderiv ℝ F (Fin.cons t x)).comp J) - simp only [ContinuousLinearMap.comp_apply, he] at hd - simp only [formFlux, Fin.val_zero, pow_zero, one_mul, Fin.removeNth_zero, - ContinuousAlternatingMap.compContinuousLinearMap_apply, - ContinuousAlternatingMap.smul_apply, smul_eq_mul] - rw [mul_comm] - congr 1 - -/-- Smooth homotopy invariance of the Jacobian integral against a target -bump whose pullback vanishes on the spatial sides of a containing box. -/ -theorem jacobian_integral_homotopy_box {n : ℕ} - (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) (a b : Fin n → ℝ) (hab : a ≤ b) - (hside : ∀ i : Fin (n + 1), i ≠ 0 → - ∀ x ∈ Icc ((Fin.cons t₀ a : Fin (n + 1) → ℝ) ∘ i.succAbove) - ((Fin.cons t₁ b : Fin (n + 1) → ℝ) ∘ i.succAbove), - ρ (F (i.insertNth ((Fin.cons t₁ b : Fin (n + 1) → ℝ) i) x)) = 0 ∧ - ρ (F (i.insertNth ((Fin.cons t₀ a : Fin (n + 1) → ℝ) i) x)) = 0) : - (∫ x in Icc a b, (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * - ρ (F (Fin.cons t₁ x))) = - ∫ x in Icc a b, (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * - ρ (F (Fin.cons t₀ x)) := by - have hφ : Differentiable ℝ (fun y => ρ y • coordinateVolumeForm n) := - hρ.smul_const _ - have hbox : (Fin.cons t₀ a : Fin (n + 1) → ℝ) ≤ Fin.cons t₁ b := by - intro i - exact Fin.cases ht (fun j => hab j) i - have h := pullback_topForm_opposite_faces (fun y => ρ y • coordinateVolumeForm n) - hφ F hF (Fin.cons t₀ a) (Fin.cons t₁ b) hbox 0 (by - intro i hi x hx - obtain ⟨h₁, h₀⟩ := hside i hi x hx - simp only [h₁, h₀, zero_smul, and_self]) - have hins (t : ℝ) (x : Fin n → ℝ) : - (0 : Fin (n + 1)).insertNth t x = (Fin.cons t x : Fin (n + 1) → ℝ) := by - simp only [Fin.insertNth_zero, cast_eq] - simpa only [Fin.succAbove_zero, Function.comp_def, Fin.cons_succ, Fin.cons_zero, - hins, formFlux_pullback_first_face ρ F _ _ (hF.differentiable (by norm_num) _)] using h - - -/-- The support of a pulled-back density lies above the support of the target -bump. This provides the needed collar at an arbitrary isolating boundary. -/ -theorem tsupport_pullback_density_subset {n : ℕ} {E : Type*} - [NormedAddCommGroup E] [NormedSpace ℝ E] - (ρ : (Fin n → ℝ) → ℝ) (F : E → (Fin n → ℝ)) (hF : Continuous F) : - tsupport (fun y => ((ρ (F y)) • coordinateVolumeForm n).compContinuousLinearMap - (fderiv ℝ F y)) ⊆ F ⁻¹' tsupport ρ := by - apply closure_minimal _ ((isClosed_tsupport ρ).preimage hF) - intro x hx - by_contra hn - have hz := image_eq_zero_of_notMem_tsupport hn - exact hx (by ext v; simp [hz]) - -/-- Localized homotopy invariance on an arbitrary open spatial set. The -boundary collar is expressed by avoidance of the target bump, not by a smooth -boundary assumption. The spatial box is only an integration device. -/ -theorem jacobian_integral_homotopy_localized_box {n : ℕ} - (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (U : Set (Fin n → ℝ)) (hU : IsOpen U) - (hboundary : ∀ y : Fin (n + 1) → ℝ, - (fun i => y i.succ) ∈ frontier U → F y ∉ tsupport ρ) - (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) (a b : Fin n → ℝ) (hab : a ≤ b) - (hbox : U ⊆ Icc a b) - (hside : ∀ i : Fin (n + 1), i ≠ 0 → - ∀ x ∈ Icc ((Fin.cons t₀ a : Fin (n + 1) → ℝ) ∘ i.succAbove) - ((Fin.cons t₁ b : Fin (n + 1) → ℝ) ∘ i.succAbove), - (fun j : Fin n => (i.insertNth ((Fin.cons t₁ b : Fin (n + 1) → ℝ) i) x : - Fin (n + 1) → ℝ) j.succ) ∉ U ∧ - (fun j : Fin n => (i.insertNth ((Fin.cons t₀ a : Fin (n + 1) → ℝ) i) x : - Fin (n + 1) → ℝ) j.succ) ∉ U) : - (∫ x in U, (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * - ρ (F (Fin.cons t₁ x))) = - ∫ x in U, (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * - ρ (F (Fin.cons t₀ x)) := by - classical - let π : (Fin (n + 1) → ℝ) → (Fin n → ℝ) := fun y i => y i.succ - have hπ : Continuous π := continuous_pi (fun i => continuous_apply i.succ) - let C := π ⁻¹' U - let form := fun y => ((ρ (F y)) • coordinateVolumeForm n).compContinuousLinearMap - (fderiv ℝ F y) - have hc : Disjoint (frontier C) (tsupport form) := by - apply disjoint_left.mpr - intro y hy hs - exact hboundary y ((hπ.frontier_preimage_subset U) hy) - (tsupport_pullback_density_subset ρ F hF.continuous hs) - obtain ⟨hd, hz⟩ := localized_closedForm form - (differentiable_pullback_topForm _ (hρ.smul_const _) F hF) - (extDeriv_pullback_topForm_eq_zero _ (hρ.smul_const _) F hF) C - (hU.preimage hπ) hc - have htbox : (Fin.cons t₀ a : Fin (n + 1) → ℝ) ≤ Fin.cons t₁ b := by - intro i - exact Fin.cases ht (fun j => hab j) i - have he := closedForm_opposite_faces (C.indicator form) hd hz - (Fin.cons t₀ a) (Fin.cons t₁ b) htbox 0 (by - intro i hi x hx - obtain ⟨h₁, h₀⟩ := hside i hi x hx - have hc₁ : i.insertNth ((Fin.cons t₁ b : Fin (n + 1) → ℝ) i) x ∉ C := h₁ - have hc₀ : i.insertNth ((Fin.cons t₀ a : Fin (n + 1) → ℝ) i) x ∉ C := h₀ - simp [formFlux, indicator_of_notMem hc₁, indicator_of_notMem hc₀]) - have hface (t : ℝ) (x : Fin n → ℝ) : - formFlux (C.indicator form) 0 (Fin.cons t x) = - U.indicator (fun z => (fderiv ℝ (fun w => F (Fin.cons t w)) z).det * - ρ (F (Fin.cons t z))) x := by - by_cases hx : x ∈ U - · have hc : Fin.cons t x ∈ C := by simpa only [C, mem_preimage, π, Fin.cons_succ] using hx - rw [indicator_of_mem hx] - change (-1 : ℝ) ^ (0 : Fin (n + 1)).val * - (C.indicator form) (Fin.cons t x) _ = _ - rw [indicator_of_mem hc] - exact formFlux_pullback_first_face ρ F t x (hF.differentiable (by norm_num) _) - · have hc : Fin.cons t x ∉ C := by simpa only [C, mem_preimage, π, Fin.cons_succ] using hx - simp [formFlux, hc, hx] - have hins (t : ℝ) (x : Fin n → ℝ) : - (0 : Fin (n + 1)).insertNth t x = (Fin.cons t x : Fin (n + 1) → ℝ) := by - simp only [Fin.insertNth_zero, cast_eq] - simpa only [Fin.succAbove_zero, Function.comp_def, Fin.cons_succ, Fin.cons_zero, - hins, hface, setIntegral_indicator hU.measurableSet, - inter_eq_right.mpr hbox] using he - - -/-- Homotopy invariance on a bounded open set, without selecting a box or -requiring any shape or smoothness of its boundary. -/ -theorem jacobian_integral_homotopy_localized {n : ℕ} - (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (U : Set (Fin n → ℝ)) (hU : IsOpen U) (hUb : Bornology.IsBounded U) - (hboundary : ∀ y : Fin (n + 1) → ℝ, - (fun i => y i.succ) ∈ frontier U → F y ∉ tsupport ρ) - (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) : - (∫ x in U, (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * - ρ (F (Fin.cons t₁ x))) = - ∫ x in U, (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * - ρ (F (Fin.cons t₀ x)) := by - obtain ⟨R, hR, hbound⟩ := hUb.exists_pos_norm_lt - have hcoord (x) (hx : x ∈ U) (i : Fin n) : |x i| < R := - lt_of_le_of_lt (norm_le_pi_norm x i) (hbound x hx) - have hout (x : Fin n → ℝ) (i : Fin n) (hx : x i = R ∨ x i = -R) : x ∉ U := by - intro hxu - have h := hcoord x hxu i - rcases hx with hx | hx <;> rw [hx] at h - · simp only [abs_of_pos hR, lt_self_iff_false] at h - · simp only [abs_neg, abs_of_pos hR, lt_self_iff_false] at h - apply jacobian_integral_homotopy_localized_box ρ hρ F hF U hU hboundary - t₀ t₁ ht (fun _ => -R) (fun _ => R) (fun _ => by linarith) - · intro x hx - constructor <;> intro i - · exact (abs_lt.mp (hcoord x hx i)).1.le - · exact (abs_lt.mp (hcoord x hx i)).2.le - · intro i hi x _ - obtain ⟨j, rfl⟩ := Fin.eq_succ_of_ne_zero hi - constructor - · apply hout _ j - left - simp only [Fin.insertNth_apply_same, Fin.cons_succ] - · apply hout _ j - right - simp only [Fin.insertNth_apply_same, Fin.cons_succ] - - -/-- Only boundary avoidance during the given interval is needed. Smooth -saturation of the time coordinate turns it into the global collar hypothesis -of the preceding Stokes argument, with the endpoints unchanged. -/ -theorem jacobian_integral_homotopy_localized_interval {n : ℕ} - (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (U : Set (Fin n → ℝ)) (hU : IsOpen U) (hUb : Bornology.IsBounded U) - (hboundary : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, - F (Fin.cons t x) ∉ tsupport ρ) : - (∫ x in U, (fderiv ℝ (fun z => F (Fin.cons 1 z)) x).det * - ρ (F (Fin.cons 1 x))) = - ∫ x in U, (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det * - ρ (F (Fin.cons 0 x)) := by - let H : (Fin (n + 1) → ℝ) → (Fin n → ℝ) := fun y => - F (Fin.cons (Real.smoothTransition (y 0)) (Fin.tail y)) - have hH : ContDiff ℝ 2 H := by - apply hF.comp - apply contDiff_pi.mpr - intro i - refine Fin.cases ?_ (fun j => ?_) i - · exact Real.smoothTransition.contDiff.comp (contDiff_apply ℝ ℝ 0) - · exact contDiff_apply ℝ ℝ j.succ - have hb : ∀ y : Fin (n + 1) → ℝ, - (fun i => y i.succ) ∈ frontier U → H y ∉ tsupport ρ := by - intro y hy - exact hboundary _ ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩ _ hy - have h := jacobian_integral_homotopy_localized ρ hρ H hH U hU hUb hb 0 1 zero_le_one - simpa only [H, Fin.cons_zero, Fin.tail_cons, Real.smoothTransition.zero, - Real.smoothTransition.one] using h - -end EilenbergGanea - -namespace EilenbergGanea -open Set MeasureTheory - -/-- A nonzero signed regular count cannot disappear under a smooth homotopy -whose boundary avoids the target. All analytic degree ingredients are proved -above; in particular this is not an assumed Brouwer-degree interface. -/ -theorem regular_count_persists {n : ℕ} - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (y : Fin n → ℝ) (U : Set (Fin n → ℝ)) (hU : IsOpen U) - (hc : IsCompact (closure U)) - (hb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, F (Fin.cons t x) ≠ y) - (s : Finset (Fin n → ℝ)) - (hs : ∀ x, x ∈ s ↔ x ∈ U ∧ F (Fin.cons 0 x) = y) - (hd : ∀ x ∈ s, (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det ≠ 0) - (hcount : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det - then 1 else -1 : ℝ)) ≠ 0) : - ∃ x ∈ U, F (Fin.cons 1 x) = y := by - classical - by_contra hno - have hno' : ∀ x ∈ U, F (Fin.cons 1 x) ≠ y := by simpa only [not_exists, not_and] using hno - let f₀ : (Fin n → ℝ) → (Fin n → ℝ) := fun x => F (Fin.cons 0 x) - let f₁ : (Fin n → ℝ) → (Fin n → ℝ) := fun x => F (Fin.cons 1 x) - have hcons (t : ℝ) : ContDiff ℝ 2 (fun x : Fin n → ℝ => - (Fin.cons t x : Fin (n + 1) → ℝ)) := by - apply contDiff_pi.mpr - intro i - refine Fin.cases contDiff_const (fun j => ?_) i - exact contDiff_apply ℝ ℝ j - have hf₀ : ContDiff ℝ 1 f₀ := (hF.comp (hcons 0)).of_le (by norm_num) - have hf₁ : Continuous f₁ := (hF.comp (hcons 1)).continuous - obtain ⟨N, hN, hyN, hsign⟩ := regular_signed_count_neighborhood volume f₀ hf₀ - y U hU hc (hb 0 (by simp)) s hs hd - let K : Set (Fin n → ℝ) := - (fun p : ℝ × (Fin n → ℝ) => F (Fin.cons p.1 p.2)) '' (Icc (0 : ℝ) 1 ×ˢ frontier U) - have hfront : IsCompact (frontier U) := hc.of_isClosed_subset isClosed_frontier frontier_subset_closure - have hK : IsCompact K := (isCompact_Icc.prod hfront).image - (hF.continuous.comp (by - apply continuous_pi - intro i - exact Fin.cases continuous_fst - (fun j => (continuous_apply j).comp continuous_snd) i)) - have hyK : y ∉ K := by - rintro ⟨⟨t, x⟩, ⟨ht, hx⟩, he⟩ - exact hb t ht x hx he - have hy₁ : y ∉ f₁ '' closure U := by - rintro ⟨x, hx, he⟩ - by_cases hxU : x ∈ U - · exact hno' x hxU he - · exact hb 1 (by simp) x ⟨hx, by simpa only [hU.interior_eq] using hxU⟩ he - let M := N \ (K ∪ f₁ '' closure U) - have hM : IsOpen M := hN.sdiff (hK.isClosed.union (hc.image hf₁).isClosed) - have hyM : y ∈ M := ⟨hyN, fun h => h.elim hyK hy₁⟩ - obtain ⟨ρ, hρ, _, hρM, hunit⟩ := exists_normalized_smooth_bump volume y M hM hyM - have hρN : Function.support ρ ⊆ N := fun z hz => (hρM (subset_tsupport ρ hz)).1 - have hval : jacobianIntegral volume f₀ U ρ = - ∑ x ∈ s, (if 0 < (fderiv ℝ f₀ x).det then 1 else -1) := - hsign ρ hρ.continuous hρN hunit - have hcollar : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, - F (Fin.cons t x) ∉ tsupport ρ := by - intro t ht x hx hsup - exact (hρM hsup).2 (Or.inl ⟨(t, x), ⟨ht, hx⟩, rfl⟩) - have hinv := jacobian_integral_homotopy_localized_interval ρ - (hρ.differentiable (by simp)) F hF U hU - (hc.isBounded.subset subset_closure) hcollar - have hzero : jacobianIntegral volume f₁ U ρ = 0 := by - apply jacobianIntegral_eq_zero_of_no_preimage - intro x hx - apply image_eq_zero_of_notMem_tsupport - intro hsup - exact (hρM hsup).2 (Or.inr ⟨x, subset_closure hx, rfl⟩) - apply hcount - exact hval.symm.trans (hinv.symm.trans hzero) - -end EilenbergGanea - -namespace EilenbergGanea -open Set -variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] - -/-- The analytic nonzero-count theorem is independent of a choice of linear -coordinates. This form applies directly to finite products of quaternions. -/ -theorem regular_count_persists_finiteDimensional - (F : ℝ × E → E) (hF : ContDiff ℝ 2 F) - (y : E) (U : Set E) (hU : IsOpen U) (hc : IsCompact (closure U)) - (hb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, F (t, x) ≠ y) - (s : Finset E) (hs : ∀ x, x ∈ s ↔ x ∈ U ∧ F (0, x) = y) - (hd : ∀ x ∈ s, (fderiv ℝ (fun z => F (0, z)) x).det ≠ 0) - (hcount : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => F (0, z)) x).det - then 1 else -1 : ℝ)) ≠ 0) : ∃ x ∈ U, F (1, x) = y := by - classical - let n := Module.finrank ℝ E - let e : E ≃L[ℝ] (Fin n → ℝ) := (Module.finBasis ℝ E).equivFunL - let G : (Fin (n + 1) → ℝ) → (Fin n → ℝ) := - fun z => e (F (z 0, e.symm (Fin.tail z))) - have hG : ContDiff ℝ 2 G := by - apply e.contDiff.comp - apply hF.comp - exact (contDiff_apply ℝ ℝ 0).prodMk (e.symm.contDiff.comp - (contDiff_pi.mpr (fun i => contDiff_apply ℝ ℝ i.succ))) - have hdet (x : E) : - (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e x)).det = - (fderiv ℝ (fun z => F (0, z)) x).det := by - have h₀ : DifferentiableAt ℝ (fun z => F (0, z)) x := - (hF.comp (contDiff_const.prodMk contDiff_id)).differentiable (by norm_num) x - have h₀' : HasFDerivAt (fun z => F (0, z)) - (fderiv ℝ (fun z => F (0, z)) x) (e.symm (e x)) := by - simpa only [ContinuousLinearEquiv.symm_apply_apply] using h₀.hasFDerivAt - have hcomp := e.hasFDerivAt.comp (e x) - (h₀'.comp (e x) e.symm.hasFDerivAt) - have hh : (fun z => G (Fin.cons 0 z)) = e ∘ (fun z => F (0, z)) ∘ e.symm := by - funext z - simp [G, Function.comp_def] - rw [hh, hcomp.fderiv] - exact LinearMap.det_conj _ e.toLinearEquiv - have hVc : IsCompact (closure (e '' U)) := by - rw [← show (e : E → (Fin n → ℝ)) '' closure U = closure (e '' U) from e.toHomeomorph.image_closure U] - exact hc.image e.continuous - have hb' : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier (e '' U), - G (Fin.cons t x) ≠ e y := by - intro t ht x hx he - rw [← show (e : E → (Fin n → ℝ)) '' frontier U = frontier (e '' U) from e.toHomeomorph.image_frontier U] at hx - obtain ⟨z, hz, rfl⟩ := hx - apply hb t ht z hz - apply e.injective - simpa [G] using he - let s' := s.map e.toEquiv.toEmbedding - have hs' : ∀ x, x ∈ s' ↔ x ∈ e '' U ∧ G (Fin.cons 0 x) = e y := by - intro x - constructor - · intro hx - obtain ⟨z, hz, rfl⟩ := Finset.mem_map.mp hx - refine ⟨⟨z, (hs z).mp hz |>.1, rfl⟩, ?_⟩ - simp [G, (hs z).mp hz |>.2] - · rintro ⟨⟨z, hz, rfl⟩, he⟩ - apply Finset.mem_map.mpr - refine ⟨z, (hs z).mpr ⟨hz, ?_⟩, rfl⟩ - exact e.injective (by simpa [G] using he) - have hd' : ∀ x ∈ s', (fderiv ℝ (fun z => G (Fin.cons 0 z)) x).det ≠ 0 := by - intro x hx - obtain ⟨z, hz, rfl⟩ := Finset.mem_map.mp hx - change (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e z)).det ≠ 0 - rw [hdet] - exact hd z hz - have hcount' : (∑ x ∈ s', (if 0 < (fderiv ℝ (fun z => G (Fin.cons 0 z)) x).det - then 1 else -1 : ℝ)) ≠ 0 := by - change (∑ x ∈ s.map e.toEquiv.toEmbedding, _) ≠ 0 - rw [Finset.sum_map] - change (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e x)).det then 1 else -1 : ℝ)) ≠ 0 - simpa only [hdet] using hcount - obtain ⟨x, hx, he⟩ := regular_count_persists G hG (e y) (e '' U) - (e.toHomeomorph.isOpenMap _ hU) hVc hb' s' hs' hd' hcount' - obtain ⟨z, hz, rfl⟩ := hx - exact ⟨z, hz, e.injective (by simpa [G] using he)⟩ - -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped ContDiff - -/-- A regular perturbation at time zero can be propagated along an arbitrary -boundary-root-free smooth homotopy. The perturbation need not be equivariant -away from the initial time. -/ -theorem regular_approximation_persists - {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] - (F : ℝ × E → E) (hF : ContDiff ℝ 2 F) - (U : Set E) (hU : IsOpen U) (hc : IsCompact (closure U)) - (hb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, F (t, x) ≠ 0) - (happrox : ∀ ε : ℝ, 0 < ε → ∃ g : E → E, ContDiff ℝ ∞ g ∧ - (∀ x ∈ closure U, ‖g x - F (0, x)‖ < ε) ∧ - ∃ s : Finset E, (∀ x, x ∈ s ↔ x ∈ closure U ∧ g x = 0) ∧ - (∀ x ∈ s, (fderiv ℝ g x).det ≠ 0) ∧ - (∑ x ∈ s, (if 0 < (fderiv ℝ g x).det then 1 else -1 : ℝ)) ≠ 0) : - ∃ x ∈ U, F (1, x) = 0 := by - classical - let P := Icc (0 : ℝ) 1 ×ˢ frontier U - have hP : IsCompact P := isCompact_Icc.prod - (hc.of_isClosed_subset isClosed_frontier frontier_subset_closure) - have hz : (0 : E) ∈ (F '' P)ᶜ := by - rintro ⟨⟨t, x⟩, ⟨ht, hx⟩, he⟩ - exact hb t ht x hx he - obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp (hP.image hF.continuous).isClosed.isOpen_compl 0 hz - have hbound : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, ε ≤ ‖F (t, x)‖ := by - intro t ht x hx - by_contra hn - have hmem : F (t, x) ∈ Metric.ball (0 : E) ε := by - simpa only [Metric.mem_ball, dist_zero_right] using lt_of_not_ge hn - exact hball hmem ⟨(t, x), ⟨ht, hx⟩, rfl⟩ - obtain ⟨g, hg, hclose, s, hs, hd, hcount⟩ := happrox ε hε - let G : ℝ × E → E := fun q => F q + (1 - q.1) • (g q.2 - F (0, q.2)) - have hG : ContDiff ℝ 2 G := hF.add - ((contDiff_const.sub contDiff_fst).smul (((contDiff_infty.mp hg 2).comp contDiff_snd).sub - (hF.comp (contDiff_const.prodMk contDiff_snd)))) - have hG0 : (fun x => G (0, x)) = g := by funext x; simp [G] - have hG1 : (fun x => G (1, x)) = fun x => F (1, x) := by funext x; simp [G] - have hGb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, G (t, x) ≠ 0 := by - intro t ht x hx he - have heq : F (t, x) = -((1 - t) • (g x - F (0, x))) := eq_neg_of_add_eq_zero_left he - have hn : ‖F (t, x)‖ < ε := by - rw [heq, norm_neg, norm_smul, Real.norm_eq_abs, abs_of_nonneg (by linarith [ht.2])] - calc - (1 - t) * ‖g x - F (0, x)‖ ≤ ‖g x - F (0, x)‖ := - mul_le_of_le_one_left (norm_nonneg _) (by linarith [ht.1]) - _ < ε := hclose x (frontier_subset_closure hx) - exact (not_lt_of_ge (hbound t ht x hx)) hn - have hsU : ∀ x, x ∈ s ↔ x ∈ U ∧ G (0, x) = 0 := by - intro x - rw [hs, show G (0, x) = g x from congrFun hG0 x] - constructor - · rintro ⟨hx, he⟩ - refine ⟨?_, he⟩ - by_contra hn - have hxf : x ∈ frontier U := ⟨hx, by simpa only [hU.interior_eq] using hn⟩ - exact hGb 0 (by simp) x hxf (by rw [show G (0, x) = g x from congrFun hG0 x]; exact he) - · rintro ⟨hx, he⟩; exact ⟨subset_closure hx, he⟩ - have hd' : ∀ x ∈ s, (fderiv ℝ (fun z => G (0, z)) x).det ≠ 0 := by rw [hG0]; exact hd - have hcount' : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => G (0, z)) x).det then 1 else -1 : ℝ)) ≠ 0 := by - rw [hG0]; exact hcount - obtain ⟨x, hx, he⟩ := regular_count_persists_finiteDimensional G hG 0 U hU hc hGb s hsU hd' hcount' - exact ⟨x, hx, by simpa only [show G (1, x) = F (1, x) from congrFun hG1 x] using he⟩ - -/-- Localized nonsingular-exponent word-map roots cannot disappear under a -boundary-root-free smooth homotopy, even though the initial word map can have -singular roots. -/ -theorem localized_word_root_persists {m : ℕ} - (w : Fin m → FreeGroup (Fin m)) (hB : (exponentMatrix w).det ≠ 0) - (F : ℝ × ((Fin m → ℂ) × (Fin m → ℂ)) → ((Fin m → ℂ) × (Fin m → ℂ))) - (hF : ContDiff ℝ 2 F) (hF0 : ∀ q, F (0, q) = splitWordMap w q) - (U : Set ((Fin m → ℂ) × (Fin m → ℂ))) (hU : IsOpen U) - (hc : IsCompact (closure U)) - (hUi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q ∈ closure U, (q.1, z • q.2) ∈ closure U) - (h1 : (1, 0) ∈ U) - (hb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, F (t, x) ≠ 0) : - ∃ x ∈ U, F (1, x) = 0 := by - apply regular_approximation_persists F hF U hU hc hb - intro ε hε - simpa only [hF0] using word_exists_regularization_nonzero_count w hB - (closure U) hc hUi (subset_closure h1) (closure U) hc (Subset.refl _) ε hε - -end EilenbergGanea - -namespace EilenbergGanea -open Set MeasureTheory - -/-- Stokes localization in an arbitrary open subset of time times space. -The two slices may be different; no regularity of the moving boundary is used. -/ -theorem jacobian_integral_moving_box {n : ℕ} - (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (C : Set (Fin (n + 1) → ℝ)) (hC : IsOpen C) - (hboundary : ∀ y ∈ frontier C, F y ∉ tsupport ρ) - (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) (a b : Fin n → ℝ) (hab : a ≤ b) - (hbox : ∀ t, {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C} ⊆ Icc a b) - (hside : ∀ i : Fin (n + 1), i ≠ 0 → - ∀ x ∈ Icc ((Fin.cons t₀ a : Fin (n + 1) → ℝ) ∘ i.succAbove) - ((Fin.cons t₁ b : Fin (n + 1) → ℝ) ∘ i.succAbove), - i.insertNth ((Fin.cons t₁ b : Fin (n + 1) → ℝ) i) x ∉ C ∧ - i.insertNth ((Fin.cons t₀ a : Fin (n + 1) → ℝ) i) x ∉ C) : - (∫ x in {x | (Fin.cons t₁ x : Fin (n + 1) → ℝ) ∈ C}, - (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * ρ (F (Fin.cons t₁ x))) = - ∫ x in {x | (Fin.cons t₀ x : Fin (n + 1) → ℝ) ∈ C}, - (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * ρ (F (Fin.cons t₀ x)) := by - classical - let form := fun y => ((ρ (F y)) • coordinateVolumeForm n).compContinuousLinearMap - (fderiv ℝ F y) - have hc : Disjoint (frontier C) (tsupport form) := by - apply disjoint_left.mpr - intro y hy hs - exact hboundary y hy (tsupport_pullback_density_subset ρ F hF.continuous hs) - obtain ⟨hd, hz⟩ := localized_closedForm form - (differentiable_pullback_topForm _ (hρ.smul_const _) F hF) - (extDeriv_pullback_topForm_eq_zero _ (hρ.smul_const _) F hF) C hC hc - have htbox : (Fin.cons t₀ a : Fin (n + 1) → ℝ) ≤ Fin.cons t₁ b := by - intro i - exact Fin.cases ht (fun j => hab j) i - have he := closedForm_opposite_faces (C.indicator form) hd hz - (Fin.cons t₀ a) (Fin.cons t₁ b) htbox 0 (by - intro i hi x hx - obtain ⟨h₁, h₀⟩ := hside i hi x hx - simp [formFlux, indicator_of_notMem h₁, indicator_of_notMem h₀]) - have hface (t : ℝ) (x : Fin n → ℝ) : - formFlux (C.indicator form) 0 (Fin.cons t x) = - {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C}.indicator - (fun z => (fderiv ℝ (fun w => F (Fin.cons t w)) z).det * - ρ (F (Fin.cons t z))) x := by - by_cases hx : (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C - · rw [indicator_of_mem (show x ∈ {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C} from hx)] - change (-1 : ℝ) ^ (0 : Fin (n + 1)).val * - (C.indicator form) (Fin.cons t x) _ = _ - rw [indicator_of_mem hx] - exact formFlux_pullback_first_face ρ F t x (hF.differentiable (by norm_num) _) - · simp [formFlux, hx] - have hins (t : ℝ) (x : Fin n → ℝ) : - (0 : Fin (n + 1)).insertNth t x = (Fin.cons t x : Fin (n + 1) → ℝ) := by - simp only [Fin.insertNth_zero, cast_eq] - have hm (t : ℝ) : MeasurableSet {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C} := by - apply (hC.preimage _).measurableSet - apply continuous_pi - intro i - exact Fin.cases continuous_const (fun j => continuous_apply j) i - simpa only [Fin.succAbove_zero, Function.comp_def, Fin.cons_succ, Fin.cons_zero, - hins, hface, setIntegral_indicator (hm _), - inter_eq_right.mpr (hbox _)] using he - -end EilenbergGanea - -namespace EilenbergGanea -open Set MeasureTheory Filter Topology - -/-- Box-free moving-domain Stokes, with arbitrary open moving slices contained -in one bounded spatial set. -/ -theorem jacobian_integral_moving {n : ℕ} - (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (C : Set (Fin (n + 1) → ℝ)) (hC : IsOpen C) - (hboundary : ∀ y ∈ frontier C, F y ∉ tsupport ρ) - (hCb : Bornology.IsBounded {x : Fin n → ℝ | ∃ t : ℝ, Fin.cons t x ∈ C}) - (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) : - (∫ x in {x | (Fin.cons t₁ x : Fin (n + 1) → ℝ) ∈ C}, - (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * ρ (F (Fin.cons t₁ x))) = - ∫ x in {x | (Fin.cons t₀ x : Fin (n + 1) → ℝ) ∈ C}, - (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * ρ (F (Fin.cons t₀ x)) := by - obtain ⟨R, hR, hbound⟩ := hCb.exists_pos_norm_lt - have hcoord (t : ℝ) (x : Fin n → ℝ) (hx : Fin.cons t x ∈ C) (i : Fin n) : |x i| < R := - lt_of_le_of_lt (by simpa only [Real.norm_eq_abs] using norm_le_pi_norm x i) - (hbound x ⟨t, hx⟩) - have hout (y : Fin (n + 1) → ℝ) (j : Fin n) - (hj : y j.succ = R ∨ y j.succ = -R) : y ∉ C := by - intro hy - have hh := hcoord (y 0) (Fin.tail y) (by simpa only [Fin.cons_self_tail] using hy) j - change |y j.succ| < R at hh - rcases hj with hj | hj - · rw [hj, abs_of_pos hR] at hh; exact lt_irrefl _ hh - · rw [hj, abs_neg, abs_of_pos hR] at hh; exact lt_irrefl _ hh - apply jacobian_integral_moving_box ρ hρ F hF C hC hboundary t₀ t₁ ht - (fun _ => -R) (fun _ => R) (fun _ => by linarith) - · intro t x hx - constructor <;> intro i - · exact (abs_lt.mp (hcoord t x hx i)).1.le - · exact (abs_lt.mp (hcoord t x hx i)).2.le - · intro i hi x _ - obtain ⟨j, rfl⟩ := Fin.eq_succ_of_ne_zero hi - constructor - · apply hout _ j - left - simp only [Fin.insertNth_apply_same, Fin.cons_succ] - · apply hout _ j - right - simp only [Fin.insertNth_apply_same, Fin.cons_succ] - -/-- Smooth time saturation reduces the collar hypothesis to the actual time -interval even for moving open domains. -/ -theorem jacobian_integral_moving_interval {n : ℕ} - (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (C : Set (Fin (n + 1) → ℝ)) (hC : IsOpen C) - (hboundary : ∀ y ∈ frontier C, y 0 ∈ Icc (0 : ℝ) 1 → F y ∉ tsupport ρ) - (hCb : Bornology.IsBounded {x : Fin n → ℝ | ∃ t ∈ Icc (0 : ℝ) 1, Fin.cons t x ∈ C}) : - (∫ x in {x | (Fin.cons 1 x : Fin (n + 1) → ℝ) ∈ C}, - (fderiv ℝ (fun z => F (Fin.cons 1 z)) x).det * ρ (F (Fin.cons 1 x))) = - ∫ x in {x | (Fin.cons 0 x : Fin (n + 1) → ℝ) ∈ C}, - (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det * ρ (F (Fin.cons 0 x)) := by - let T : (Fin (n + 1) → ℝ) → (Fin (n + 1) → ℝ) := - fun y => Fin.cons (Real.smoothTransition (y 0)) (Fin.tail y) - have hT : ContDiff ℝ 2 T := by - apply contDiff_pi.mpr - intro i - refine Fin.cases ?_ (fun j => ?_) i - · exact Real.smoothTransition.contDiff.comp (contDiff_apply ℝ ℝ 0) - · exact contDiff_apply ℝ ℝ j.succ - have hb : ∀ y ∈ frontier (T ⁻¹' C), (F ∘ T) y ∉ tsupport ρ := by - intro y hy - exact hboundary (T y) (hT.continuous.frontier_preimage_subset C hy) - ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩ - have hbound : Bornology.IsBounded {x : Fin n → ℝ | ∃ t : ℝ, Fin.cons t x ∈ T ⁻¹' C} := by - apply hCb.subset - rintro x ⟨t, ht⟩ - exact ⟨Real.smoothTransition t, ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩, ht⟩ - have he := jacobian_integral_moving ρ hρ (F ∘ T) (hF.comp hT) (T ⁻¹' C) - (hC.preimage hT.continuous) hb hbound 0 1 zero_le_one - simpa only [T, Function.comp_apply, mem_preimage, Fin.cons_zero, Fin.tail_cons, - Real.smoothTransition.zero, Real.smoothTransition.one] using he - -end EilenbergGanea - -namespace EilenbergGanea -open Set MeasureTheory Filter Topology - -/-- A nonzero signed count survives an arbitrary moving open set. The compact -boundary slab hypothesis is satisfied by the fixed annulus in the quaternion -application; no boundary triangulation or regular-value hypothesis is used -along the homotopy. -/ -theorem regular_count_persists_moving {n : ℕ} - (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) - (y : Fin n → ℝ) (C : Set (Fin (n + 1) → ℝ)) (hC : IsOpen C) - (hc₀ : IsCompact (closure {x | (Fin.cons 0 x : Fin (n + 1) → ℝ) ∈ C})) - (hc₁ : IsCompact (closure {x | (Fin.cons 1 x : Fin (n + 1) → ℝ) ∈ C})) - (hcB : IsCompact {q | q ∈ frontier C ∧ q 0 ∈ Icc (0 : ℝ) 1}) - (hCb : Bornology.IsBounded {x : Fin n → ℝ | ∃ t ∈ Icc (0 : ℝ) 1, Fin.cons t x ∈ C}) - (hb : ∀ q ∈ frontier C, q 0 ∈ Icc (0 : ℝ) 1 → F q ≠ y) - (s : Finset (Fin n → ℝ)) - (hs : ∀ x, x ∈ s ↔ Fin.cons 0 x ∈ C ∧ F (Fin.cons 0 x) = y) - (hd : ∀ x ∈ s, (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det ≠ 0) - (hcount : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det - then 1 else -1 : ℝ)) ≠ 0) : ∃ x, Fin.cons 1 x ∈ C ∧ F (Fin.cons 1 x) = y := by - classical - by_contra hno - have hno' : ∀ x, Fin.cons 1 x ∈ C → F (Fin.cons 1 x) ≠ y := by simpa using hno - let U : ℝ → Set (Fin n → ℝ) := fun t => {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C} - let f₀ := fun x => F (Fin.cons 0 x) - let f₁ := fun x => F (Fin.cons 1 x) - have hcons (t : ℝ) : ContDiff ℝ 2 (fun x : Fin n → ℝ => (Fin.cons t x : Fin (n + 1) → ℝ)) := by - apply contDiff_pi.mpr - intro i - exact Fin.cases contDiff_const (fun j => contDiff_apply ℝ ℝ j) i - have hU (t : ℝ) : IsOpen (U t) := hC.preimage (hcons t).continuous - have hfront (t : ℝ) : frontier (U t) ⊆ - (fun x : Fin n → ℝ => Fin.cons t x) ⁻¹' frontier C := - (hcons t).continuous.frontier_preimage_subset C - have hf₀ : ContDiff ℝ 1 f₀ := (hF.comp (hcons 0)).of_le (by norm_num) - have hf₁ : Continuous f₁ := (hF.comp (hcons 1)).continuous - obtain ⟨N, hN, hyN, hsign⟩ := regular_signed_count_neighborhood volume f₀ hf₀ y (U 0) - (hU 0) hc₀ (fun x hx => hb _ (hfront 0 hx) (by simp)) s hs hd - let K := F '' {q | q ∈ frontier C ∧ q 0 ∈ Icc (0 : ℝ) 1} - have hK : IsCompact K := hcB.image hF.continuous - have hyK : y ∉ K := by - rintro ⟨q, ⟨hq, ht⟩, he⟩ - exact hb q hq ht he - have hy₁ : y ∉ f₁ '' closure (U 1) := by - rintro ⟨x, hx, he⟩ - by_cases hxU : x ∈ U 1 - · exact hno' x hxU he - · have hxf : x ∈ frontier (U 1) := ⟨hx, by simpa only [(hU 1).interior_eq] using hxU⟩ - exact hb _ (hfront 1 hxf) (by simp) he - let M := N \ (K ∪ f₁ '' closure (U 1)) - have hM : IsOpen M := hN.sdiff (hK.isClosed.union (hc₁.image hf₁).isClosed) - have hyM : y ∈ M := ⟨hyN, fun h => h.elim hyK hy₁⟩ - obtain ⟨ρ, hρ, _, hρM, hunit⟩ := exists_normalized_smooth_bump volume y M hM hyM - have hρN : Function.support ρ ⊆ N := fun z hz => (hρM (subset_tsupport ρ hz)).1 - have hval : jacobianIntegral volume f₀ (U 0) ρ = - ∑ x ∈ s, (if 0 < (fderiv ℝ f₀ x).det then 1 else -1) := - hsign ρ hρ.continuous hρN hunit - have hcollar : ∀ q ∈ frontier C, q 0 ∈ Icc (0 : ℝ) 1 → F q ∉ tsupport ρ := by - intro q hq ht hsup - exact (hρM hsup).2 (Or.inl ⟨q, ⟨hq, ht⟩, rfl⟩) - have hinv := jacobian_integral_moving_interval ρ (hρ.differentiable (by simp)) F hF C hC hcollar hCb - have hzero : jacobianIntegral volume f₁ (U 1) ρ = 0 := by - apply jacobianIntegral_eq_zero_of_no_preimage - intro x hx - apply image_eq_zero_of_notMem_tsupport - intro hsup - exact (hρM hsup).2 (Or.inr ⟨x, subset_closure hx, rfl⟩) - apply hcount - exact hval.symm.trans (hinv.symm.trans hzero) - -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] - -/-- Coordinate-free moving-domain nonzero-count persistence. -/ -theorem regular_count_persists_moving_finiteDimensional - (F : ℝ × E → E) (hF : ContDiff ℝ 2 F) (y : E) - (C : Set (ℝ × E)) (hC : IsOpen C) - (hc₀ : IsCompact (closure {x | (0, x) ∈ C})) - (hc₁ : IsCompact (closure {x | (1, x) ∈ C})) - (hcB : IsCompact {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1}) - (hCb : Bornology.IsBounded {x : E | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C}) - (hb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → F q ≠ y) - (s : Finset E) (hs : ∀ x, x ∈ s ↔ (0, x) ∈ C ∧ F (0, x) = y) - (hd : ∀ x ∈ s, (fderiv ℝ (fun z => F (0, z)) x).det ≠ 0) - (hcount : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => F (0, z)) x).det - then 1 else -1 : ℝ)) ≠ 0) : ∃ x, (1, x) ∈ C ∧ F (1, x) = y := by - classical - let n := Module.finrank ℝ E - let e : E ≃L[ℝ] (Fin n → ℝ) := (Module.finBasis ℝ E).equivFunL - let H : (ℝ × E) ≃L[ℝ] (Fin (n + 1) → ℝ) := - ((ContinuousLinearEquiv.refl ℝ ℝ).prodCongr e).trans (Fin.consEquivL ℝ (fun _ => ℝ)) - let G : (Fin (n + 1) → ℝ) → (Fin n → ℝ) := fun q => e (F (H.symm q)) - let D := H.symm ⁻¹' C - have hH (t : ℝ) (x : E) : H (t, x) = Fin.cons t (e x) := rfl - have hHi (t : ℝ) (x : Fin n → ℝ) : H.symm (Fin.cons t x) = (t, e.symm x) := by - apply H.injective - rw [H.apply_symm_apply, hH, e.apply_symm_apply] - have hG : ContDiff ℝ 2 G := e.contDiff.comp (hF.comp H.symm.contDiff) - have hdet (x : E) : - (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e x)).det = - (fderiv ℝ (fun z => F (0, z)) x).det := by - have h₀ : DifferentiableAt ℝ (fun z => F (0, z)) x := - (hF.comp (contDiff_const.prodMk contDiff_id)).differentiable (by norm_num) x - have h₀' : HasFDerivAt (fun z => F (0, z)) - (fderiv ℝ (fun z => F (0, z)) x) (e.symm (e x)) := by - simpa only [ContinuousLinearEquiv.symm_apply_apply] using h₀.hasFDerivAt - have hcomp := e.hasFDerivAt.comp (e x) (h₀'.comp (e x) e.symm.hasFDerivAt) - have hh : (fun z => G (Fin.cons 0 z)) = e ∘ (fun z => F (0, z)) ∘ e.symm := by - funext z; simp only [G, hHi, Function.comp_def] - rw [hh, hcomp.fderiv] - exact LinearMap.det_conj _ e.toLinearEquiv - have hslice (t : ℝ) : {x : Fin n → ℝ | Fin.cons t x ∈ D} = e '' {x | (t, x) ∈ C} := by - ext x - change H.symm (Fin.cons t x) ∈ C ↔ _ - rw [hHi] - constructor - · intro hx; exact ⟨e.symm x, hx, e.apply_symm_apply x⟩ - · rintro ⟨z, hz, rfl⟩; simpa only [ContinuousLinearEquiv.symm_apply_apply, mem_ofPred_eq] using hz - have hcompact (t : ℝ) (ht : IsCompact (closure {x : E | (t, x) ∈ C})) : - IsCompact (closure {x : Fin n → ℝ | Fin.cons t x ∈ D}) := by - rw [hslice, ← show (e : E → (Fin n → ℝ)) '' closure {x | (t, x) ∈ C} = closure (e '' {x | (t, x) ∈ C}) from e.toHomeomorph.image_closure _] - exact ht.image e.continuous - have hfront : frontier D = H.symm ⁻¹' frontier C := by - exact (H.symm.toHomeomorph.preimage_frontier C).symm - have hboundary : {q : Fin (n + 1) → ℝ | q ∈ frontier D ∧ q 0 ∈ Icc (0 : ℝ) 1} = - H '' {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1} := by - ext q - rw [hfront] - constructor - · rintro ⟨hq, ht⟩ - refine ⟨H.symm q, ⟨hq, ?_⟩, H.apply_symm_apply q⟩ - exact ht - · rintro ⟨z, ⟨hz, ht⟩, rfl⟩ - refine ⟨?_, ?_⟩ - · simpa only [mem_preimage, ContinuousLinearEquiv.symm_apply_apply] using hz - · exact ht - have hbounded : {x : Fin n → ℝ | ∃ t ∈ Icc (0 : ℝ) 1, Fin.cons t x ∈ D} = - e '' {x : E | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C} := by - ext x - constructor - · rintro ⟨t, ht, hx⟩ - have hx' : x ∈ e '' {z | (t, z) ∈ C} := by rw [← hslice]; exact hx - obtain ⟨z, hz, rfl⟩ := hx' - exact ⟨z, ⟨t, ht, hz⟩, rfl⟩ - · rintro ⟨z, ⟨t, ht, hz⟩, rfl⟩ - exact ⟨t, ht, by change e z ∈ {x | Fin.cons t x ∈ D}; rw [hslice]; exact ⟨z, hz, rfl⟩⟩ - let s' := s.map e.toEquiv.toEmbedding - have hs' : ∀ x, x ∈ s' ↔ Fin.cons 0 x ∈ D ∧ G (Fin.cons 0 x) = e y := by - intro x - constructor - · intro hx - obtain ⟨z, hz, rfl⟩ := Finset.mem_map.mp hx - change H.symm (Fin.cons 0 (e z)) ∈ C ∧ e (F (H.symm (Fin.cons 0 (e z)))) = e y - rw [hHi, e.symm_apply_apply] - exact ⟨((hs z).mp hz).1, congrArg e ((hs z).mp hz).2⟩ - · rintro ⟨hx, he⟩ - refine Finset.mem_map.mpr ⟨e.symm x, (hs _).mpr ⟨?_, ?_⟩, e.apply_symm_apply x⟩ - · simpa only [D, mem_preimage, hHi] using hx - · apply e.injective; simpa only [G, hHi] using he - have hd' : ∀ x ∈ s', (fderiv ℝ (fun z => G (Fin.cons 0 z)) x).det ≠ 0 := by - intro x hx - obtain ⟨z, hz, rfl⟩ := Finset.mem_map.mp hx - change (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e z)).det ≠ 0 - rw [hdet]; exact hd z hz - have hcount' : (∑ x ∈ s', (if 0 < (fderiv ℝ (fun z => G (Fin.cons 0 z)) x).det - then 1 else -1 : ℝ)) ≠ 0 := by - change (∑ x ∈ s.map e.toEquiv.toEmbedding, _) ≠ 0 - rw [Finset.sum_map] - change (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e x)).det then 1 else -1 : ℝ)) ≠ 0 - simpa only [hdet] using hcount - obtain ⟨x, hx, he⟩ := regular_count_persists_moving G hG (e y) D - (hC.preimage H.symm.continuous) (hcompact 0 hc₀) (hcompact 1 hc₁) - (by rw [hboundary]; exact hcB.image H.continuous) - (by rw [hbounded]; exact e.lipschitzWith.isBounded_image hCb) - (by - intro q hq ht heq - apply hb (H.symm q) (by rw [hfront] at hq; exact hq) ht - exact e.injective heq) s' hs' hd' hcount' - exact ⟨e.symm x, by simpa only [D, mem_preimage, hHi] using hx, - e.injective (by simpa only [G, hHi] using he)⟩ -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] - -/-- Arbitrarily small regular approximations at the initial slice suffice for -moving-domain continuation. Uniform closeness is requested on the spatial -projection of the boundary slab, not on an assumed fixed isolating domain. -/ -theorem regular_approximation_persists_moving - (F : ℝ × E → E) (hF : ContDiff ℝ 2 F) - (C : Set (ℝ × E)) (hC : IsOpen C) - (hc₀ : IsCompact (closure {x | (0, x) ∈ C})) - (hc₁ : IsCompact (closure {x | (1, x) ∈ C})) - (hcB : IsCompact {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1}) - (hCb : Bornology.IsBounded {x : E | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C}) - (hb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → F q ≠ 0) - (L : Set E) (hLB : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → q.2 ∈ L) - (happrox : ∀ ε : ℝ, 0 < ε → ∃ g : E → E, ContDiff ℝ ∞ g ∧ - (∀ x ∈ L, ‖g x - F (0, x)‖ < ε) ∧ - ∃ s : Finset E, (∀ x, x ∈ s ↔ x ∈ closure {z | (0, z) ∈ C} ∧ g x = 0) ∧ - (∀ x ∈ s, (fderiv ℝ g x).det ≠ 0) ∧ - (∑ x ∈ s, (if 0 < (fderiv ℝ g x).det then 1 else -1 : ℝ)) ≠ 0) : - ∃ x, (1, x) ∈ C ∧ F (1, x) = 0 := by - classical - let P := {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1} - have hz : (0 : E) ∈ (F '' P)ᶜ := by - rintro ⟨q, ⟨hq, ht⟩, he⟩ - exact hb q hq ht he - obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp (hcB.image hF.continuous).isClosed.isOpen_compl 0 hz - have hbound : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → ε ≤ ‖F q‖ := by - intro q hq ht - by_contra hn - have hmem : F q ∈ Metric.ball (0 : E) ε := by - simpa only [Metric.mem_ball, dist_zero_right] using lt_of_not_ge hn - exact hball hmem ⟨q, ⟨hq, ht⟩, rfl⟩ - obtain ⟨g, hg, hclose, s, hs, hd, hcount⟩ := happrox ε hε - let G : ℝ × E → E := fun q => F q + (1 - q.1) • (g q.2 - F (0, q.2)) - have hG : ContDiff ℝ 2 G := hF.add - ((contDiff_const.sub contDiff_fst).smul (((contDiff_infty.mp hg 2).comp contDiff_snd).sub - (hF.comp (contDiff_const.prodMk contDiff_snd)))) - have hG0 : (fun x => G (0, x)) = g := by funext x; simp [G] - have hG1 : (fun x => G (1, x)) = fun x => F (1, x) := by funext x; simp [G] - have hGb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → G q ≠ 0 := by - intro q hq ht he - have heq : F q = -((1 - q.1) • (g q.2 - F (0, q.2))) := eq_neg_of_add_eq_zero_left he - have hn : ‖F q‖ < ε := by - rw [heq, norm_neg, norm_smul, Real.norm_eq_abs, abs_of_nonneg (by linarith [ht.2])] - calc - (1 - q.1) * ‖g q.2 - F (0, q.2)‖ ≤ ‖g q.2 - F (0, q.2)‖ := - mul_le_of_le_one_left (norm_nonneg _) (by linarith [ht.1]) - _ < ε := hclose q.2 (hLB q hq ht) - exact (not_lt_of_ge (hbound q hq ht)) hn - have hU : IsOpen {x : E | (0, x) ∈ C} := hC.preimage (continuous_const.prodMk continuous_id) - have hfront : frontier {x : E | (0, x) ∈ C} ⊆ (fun x : E => ((0 : ℝ), x)) ⁻¹' frontier C := - (continuous_const.prodMk continuous_id).frontier_preimage_subset C - have hsU : ∀ x, x ∈ s ↔ (0, x) ∈ C ∧ G (0, x) = 0 := by - intro x - rw [hs, show G (0, x) = g x from congrFun hG0 x] - constructor - · rintro ⟨hx, he⟩ - refine ⟨?_, he⟩ - by_contra hn - have hxf : x ∈ frontier {z : E | (0, z) ∈ C} := - ⟨hx, by simpa only [hU.interior_eq, mem_ofPred_eq] using hn⟩ - exact hGb (0, x) (hfront hxf) (by simp) - (by rw [show G (0, x) = g x from congrFun hG0 x]; exact he) - · rintro ⟨hx, he⟩; exact ⟨subset_closure hx, he⟩ - have hd' : ∀ x ∈ s, (fderiv ℝ (fun z => G (0, z)) x).det ≠ 0 := by rw [hG0]; exact hd - have hcount' : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => G (0, z)) x).det then 1 else -1 : ℝ)) ≠ 0 := by - rw [hG0]; exact hcount - obtain ⟨x, hx, he⟩ := regular_count_persists_moving_finiteDimensional G hG 0 C hC hc₀ hc₁ hcB hCb hGb s hsU hd' hcount' - exact ⟨x, hx, by simpa only [show G (1, x) = F (1, x) from congrFun hG1 x] using he⟩ - -/-- Full localized word-root persistence for moving open sets. Contains the -singular pure-word initial maps used in the manuscript's finite-quotient step. -/ -theorem localized_word_root_persists_moving {m : ℕ} - (w : Fin m → FreeGroup (Fin m)) (hB : (exponentMatrix w).det ≠ 0) - (F : ℝ × ((Fin m → ℂ) × (Fin m → ℂ)) → ((Fin m → ℂ) × (Fin m → ℂ))) - (hF : ContDiff ℝ 2 F) (hF0 : ∀ q, F (0, q) = splitWordMap w q) - (C : Set (ℝ × ((Fin m → ℂ) × (Fin m → ℂ)))) (hC : IsOpen C) - (hc₀ : IsCompact (closure {x | (0, x) ∈ C})) - (hc₁ : IsCompact (closure {x | (1, x) ∈ C})) - (hcB : IsCompact {q | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1}) - (hCb : Bornology.IsBounded {x | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C}) - (hUi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q ∈ closure {x | (0, x) ∈ C}, - (q.1, z • q.2) ∈ closure {x | (0, x) ∈ C}) - (h1 : (0, (1, 0)) ∈ C) - (hb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → F q ≠ 0) : - ∃ x, (1, x) ∈ C ∧ F (1, x) = 0 := by - let K := closure {x | (0, x) ∈ C} - let L := K ∪ Prod.snd '' {q | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1} - have hL : IsCompact L := hc₀.union (hcB.image continuous_snd) - apply regular_approximation_persists_moving F hF C hC hc₀ hc₁ hcB hCb hb L - (fun q hq ht => Or.inr ⟨q, ⟨hq, ht⟩, rfl⟩) - intro ε hε - simpa only [hF0] using word_exists_regularization_nonzero_count w hB - K hc₀ hUi (subset_closure h1) L hL subset_union_left ε hε -end EilenbergGanea - -end - -end OAI +import OAI.Topology.EilenbergGanea.UnitaryWords +import Mathlib.Analysis.Calculus.DifferentialForm.Basic +import Mathlib.MeasureTheory.Integral.DivergenceTheorem +import Mathlib.Analysis.BoxIntegral.DivergenceTheorem +import Mathlib.Analysis.Calculus.BumpFunction.InnerProduct +import Mathlib.MeasureTheory.Integral.Bochner.Basic +import Mathlib.Analysis.Calculus.FDeriv.Equiv + +namespace OAI + +noncomputable section + +open Set Filter Topology MeasureTheory +open scoped ContDiff + +open scoped ContDiff +open Set Filter Topology +namespace EilenbergGanea +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] +/- Avoidance of an arbitrary open boundary makes the selected fiber +compact whenever the closure of the open set is compact. -/ +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] in +theorem compact_selected_fiber (f : E → E) (y : E) (U : Set E) + (hU : IsOpen U) (hc : IsCompact (closure U)) (hf : ContinuousOn f (closure U)) + (hb : ∀ x ∈ frontier U, f x ≠ y) : IsCompact (U ∩ f ⁻¹' {y}) := by + have he : U ∩ f ⁻¹' {y} = closure U ∩ f ⁻¹' {y} := by + ext x + constructor + · exact fun ⟨hx, hy⟩ => ⟨subset_closure hx, hy⟩ + · rintro ⟨hx, hy⟩ + refine ⟨?_, hy⟩ + by_contra hn + exact hb x ⟨hx, by simpa only [hU.interior_eq] using hn⟩ hy + rw [he] + exact hc.of_isClosed_subset (hf.preimage_isClosed_of_isClosed isClosed_closure + isClosed_singleton) inter_subset_left + +/- The determinant retains its sign on a sufficiently small neighborhood +of a regular point. -/ +theorem exists_constant_jacobian_sign_patch (f : E → E) {x : E} + (hf : ContDiff ℝ 1 f) (hd : (fderiv ℝ f x).det ≠ 0) (W : Set E) + (hW : IsOpen W) (hxW : x ∈ W) : + ∃ V : Set E, IsOpen V ∧ x ∈ V ∧ V ⊆ W ∧ InjOn f V ∧ IsOpen (f '' V) ∧ + ∀ z ∈ V, (fderiv ℝ f z).det = + (if 0 < (fderiv ℝ f x).det then 1 else -1) * |(fderiv ℝ f z).det| := by + let d : E → ℝ := fun z => (fderiv ℝ f z).det + have hc : Continuous d := ContinuousLinearMap.continuous_det.comp + (hf.continuous_fderiv (by norm_num)) + let e := (fderiv ℝ f x).toContinuousLinearEquivOfDetNeZero hd + have hf' : HasFDerivAt f (e : E →L[ℝ] E) x := + (hf.differentiable (by norm_num) x).hasFDerivAt + let p := hf.contDiffAt.toOpenPartialHomeomorph f hf' (by norm_num) + have hxP : x ∈ p.source := hf.contDiffAt.mem_toOpenPartialHomeomorph_source hf' (by norm_num) + let A : Set E := if 0 < d x then {z | 0 < d z} else {z | d z < 0} + have hA : IsOpen A := by + dsimp [A] + split_ifs + · exact isOpen_lt continuous_const hc + · exact isOpen_lt hc continuous_const + have hxA : x ∈ A := by + dsimp [A] + split_ifs with hp + · exact hp + · exact lt_of_le_of_ne (le_of_not_gt hp) hd + let V := W ∩ p.source ∩ A + have hV : IsOpen V := (hW.inter p.open_source).inter hA + refine ⟨V, hV, ⟨⟨hxW, hxP⟩, hxA⟩, fun _ h => h.1.1, + p.injOn.mono (fun _ h => h.1.2), ?_, ?_⟩ + · exact p.isOpen_image_of_subset_source hV (fun _ h => h.1.2) + · intro z hz + have hzA := hz.2 + dsimp [A] at hzA + split_ifs at hzA ⊢ with hp + · change 0 < (fderiv ℝ f z).det at hzA + simp [abs_of_pos hzA] + · change (fderiv ℝ f z).det < 0 at hzA + simp [abs_of_neg hzA] + +/- Finitely many regular roots admit pairwise disjoint inverse neighborhoods, +all contained in the prescribed isolating open set. -/ +theorem disjoint_regular_inverse_patches (f : E → E) (hf : ContDiff ℝ 1 f) + (U : Set E) (hU : IsOpen U) (S : Set E) (hS : S.Finite) + (hSU : S ⊆ U) (hd : ∀ x ∈ S, (fderiv ℝ f x).det ≠ 0) : + ∃ V : S → Set E, + (∀ x, IsOpen (V x) ∧ (x : E) ∈ V x ∧ V x ⊆ U ∧ InjOn f (V x) ∧ + IsOpen (f '' V x) ∧ ∀ z ∈ V x, (fderiv ℝ f z).det = + (if 0 < (fderiv ℝ f x).det then 1 else -1) * |(fderiv ℝ f z).det|) ∧ + Pairwise (fun x y => Disjoint (V x) (V y)) := by + classical + obtain ⟨W, hW, hdisj⟩ := hS.t2_separation + have hp (x : S) := exists_constant_jacobian_sign_patch f hf (hd x x.property) + (U ∩ W x) (hU.inter (hW x).2) ⟨hSU x.property, (hW x).1⟩ + choose V hopen hmem hsub hinj himg hsign using hp + refine ⟨V, fun x => ⟨hopen x, hmem x, fun _ h => (hsub x h).1, + hinj x, himg x, hsign x⟩, ?_⟩ + intro x y hxy + exact (hdisj x.property y.property (fun he => hxy (Subtype.ext he))).mono + (fun _ h => (hsub x h).2) (fun _ h => (hsub y h).2) + +/- Compactness shrinks the target neighborhood so that all selected +preimages remain in the chosen inverse patches. It does not assert a +smooth boundary or a proper global map. -/ +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] in +theorem exists_target_neighborhood_of_patches {ι : Type*} [Fintype ι] + (f : E → E) (y : E) (U : Set E) (hU : IsOpen U) + (hc : IsCompact (closure U)) (hf : ContinuousOn f (closure U)) + (hb : ∀ x ∈ frontier U, f x ≠ y) (V : ι → Set E) + (hV : ∀ i, IsOpen (V i)) (himg : ∀ i, IsOpen (f '' V i)) + (hy : ∀ i, y ∈ f '' V i) + (hcover : ∀ x ∈ U, f x = y → ∃ i, x ∈ V i) : + ∃ N : Set E, IsOpen N ∧ y ∈ N ∧ (∀ i, N ⊆ f '' V i) ∧ + ∀ x ∈ U, f x ∈ N → ∃ i, x ∈ V i := by + let K := closure U \ ⋃ i, V i + have hK : IsCompact K := hc.diff (isOpen_iUnion hV) + have hclosed : IsClosed (f '' K) := (hK.image_of_continuousOn + (hf.mono (fun _ h => h.1))).isClosed + have hyK : y ∉ f '' K := by + rintro ⟨x, ⟨hxcl, hxV⟩, hxy⟩ + have hxU : x ∈ U := by + by_contra hn + exact hb x ⟨hxcl, by simpa only [hU.interior_eq] using hn⟩ hxy + obtain ⟨i, hi⟩ := hcover x hxU hxy + exact hxV (mem_iUnion.mpr ⟨i, hi⟩) + refine ⟨(f '' K)ᶜ ∩ ⋂ i, f '' V i, + hclosed.isOpen_compl.inter (isOpen_iInter_of_finite himg), + ⟨hyK, mem_iInter.mpr hy⟩, ?_, ?_⟩ + · intro i z hz + exact mem_iInter.mp hz.2 i + · intro x hxU hxN + by_contra hn + apply hxN.1 + refine ⟨x, ⟨subset_closure hxU, ?_⟩, rfl⟩ + simpa only [mem_iUnion] using hn + +end EilenbergGanea + +open Set MeasureTheory +namespace EilenbergGanea +section SignedIntegralDegree +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + (μ : Measure E) [μ.IsAddHaarMeasure] + +/- The integral representative of local degree against a target bump. -/ +def jacobianIntegral (f : E → E) (U : Set E) (ρ : E → ℝ) : ℝ := + ∫ x in U, (fderiv ℝ f x).det * ρ (f x) ∂μ + +/- The signed change-of-variables formula on one regular inverse patch. -/ +theorem jacobianIntegral_of_injOn (f : E → E) (U : Set E) (hU : MeasurableSet U) + (hf : ∀ x ∈ U, DifferentiableAt ℝ f x) (hinj : InjOn f U) + (ρ : E → ℝ) (σ : ℝ) (hσ : ∀ x ∈ U, + (fderiv ℝ f x).det = σ * |(fderiv ℝ f x).det|) : + jacobianIntegral μ f U ρ = σ * ∫ y in f '' U, ρ y ∂μ := by + have hc := integral_image_eq_integral_abs_det_fderiv_smul μ hU + (fun x hx => (hf x hx).hasFDerivAt.hasFDerivWithinAt) hinj ρ + rw [jacobianIntegral, hc, ← integral_const_mul] + apply setIntegral_congr_fun hU + intro x hx + dsimp only + calc + _ = (σ * |(fderiv ℝ f x).det|) * ρ (f x) := congrArg (· * ρ (f x)) (hσ x hx) + _ = _ := by simp only [smul_eq_mul, mul_assoc] + +/- If the normalized target bump is supported inside an inverse patch, the +patch contributes exactly the sign of its Jacobian. -/ +theorem jacobianIntegral_inverse_patch (f : E → E) (U : Set E) (hU : MeasurableSet U) + (hf : ∀ x ∈ U, DifferentiableAt ℝ f x) (hinj : InjOn f U) + (ρ : E → ℝ) (σ : ℝ) (hσ : ∀ x ∈ U, + (fderiv ℝ f x).det = σ * |(fderiv ℝ f x).det|) + (hsupp : Function.support ρ ⊆ f '' U) (hunit : ∫ y, ρ y ∂μ = 1) : + jacobianIntegral μ f U ρ = σ := by + rw [jacobianIntegral_of_injOn μ f U hU hf hinj ρ σ hσ] + have he : (∫ y in f '' U, ρ y ∂μ) = ∫ y, ρ y ∂μ := by + apply setIntegral_eq_integral_of_forall_compl_eq_zero + intro y hy + by_contra hn + exact hy (hsupp hn) + rw [he, hunit, mul_one] + +/- Excision and finite additivity of the analytic degree representative. -/ +omit [FiniteDimensional ℝ E] [BorelSpace E] [μ.IsAddHaarMeasure] in +theorem jacobianIntegral_sum_patches {ι : Type*} [Fintype ι] + (f : E → E) (U : Set E) (hU : MeasurableSet U) (V : ι → Set E) + (hV : ∀ i, MeasurableSet (V i)) (hsub : ∀ i, V i ⊆ U) + (hdisj : Pairwise (fun i j => Disjoint (V i) (V j))) (ρ : E → ℝ) + (hsupp : ∀ x ∈ U, ρ (f x) ≠ 0 → ∃ i, x ∈ V i) + (hint : IntegrableOn (fun x => (fderiv ℝ f x).det * ρ (f x)) U μ) : + jacobianIntegral μ f U ρ = ∑ i, jacobianIntegral μ f (V i) ρ := by + unfold jacobianIntegral + rw [setIntegral_eq_of_subset_of_forall_sdiff_eq_zero hU + (iUnion_subset hsub)] + · exact integral_iUnion_fintype hV hdisj (fun i => hint.mono_set (hsub i)) + · rintro x ⟨hxU, hxV⟩ + have hz : ρ (f x) = 0 := by + by_contra hn + obtain ⟨i, hi⟩ := hsupp x hxU hn + exact hxV (mem_iUnion.mpr ⟨i, hi⟩) + rw [hz, mul_zero] + +/- The regular signed-count formula, once disjoint inverse patches and a +small normalized target bump have been chosen. -/ +theorem jacobianIntegral_eq_sum_signs {ι : Type*} [Fintype ι] + (f : E → E) (U : Set E) (hU : MeasurableSet U) (V : ι → Set E) + (hV : ∀ i, MeasurableSet (V i)) (hsub : ∀ i, V i ⊆ U) + (hdisj : Pairwise (fun i j => Disjoint (V i) (V j))) + (hf : ∀ x ∈ U, DifferentiableAt ℝ f x) (hinj : ∀ i, InjOn f (V i)) + (ρ : E → ℝ) (σ : ι → ℝ) + (hσ : ∀ i x, x ∈ V i → (fderiv ℝ f x).det = σ i * |(fderiv ℝ f x).det|) + (hcovered : ∀ x ∈ U, ρ (f x) ≠ 0 → ∃ i, x ∈ V i) + (hsupp : ∀ i, Function.support ρ ⊆ f '' V i) + (hunit : ∫ y, ρ y ∂μ = 1) + (hint : IntegrableOn (fun x => (fderiv ℝ f x).det * ρ (f x)) U μ) : + jacobianIntegral μ f U ρ = ∑ i, σ i := by + rw [jacobianIntegral_sum_patches μ f U hU V hV hsub hdisj ρ hcovered hint] + apply Finset.sum_congr rfl + intro i _ + exact jacobianIntegral_inverse_patch μ f (V i) (hV i) + (fun x hx => hf x (hsub i hx)) (hinj i) ρ (σ i) (hσ i) (hsupp i) hunit + +/- A vanishing selected preimage forces every supported degree integral to +vanish. This implication supplies existence from nonzero degree. -/ +omit [FiniteDimensional ℝ E] [BorelSpace E] [μ.IsAddHaarMeasure] in +theorem jacobianIntegral_eq_zero_of_no_preimage (f : E → E) (U : Set E) (ρ : E → ℝ) + (h : ∀ x ∈ U, ρ (f x) = 0) : jacobianIntegral μ f U ρ = 0 := by + apply setIntegral_eq_zero_of_forall_eq_zero + intro x hx + simp only [h x hx, mul_zero] + +end SignedIntegralDegree +end EilenbergGanea + +namespace EilenbergGanea +open Set MeasureTheory Filter Topology +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + (μ : Measure E) [μ.IsAddHaarMeasure] + +/-- A normalized smooth target bump can be supported in any prescribed +neighborhood of the target. -/ +theorem exists_normalized_smooth_bump (y : E) (N : Set E) (hN : IsOpen N) (hy : y ∈ N) : + ∃ ρ : E → ℝ, ContDiff ℝ ∞ ρ ∧ HasCompactSupport ρ ∧ tsupport ρ ⊆ N ∧ + (∫ z, ρ z ∂μ) = 1 := by + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp hN y hy + let b : ContDiffBump y := ⟨r / 4, r / 2, by linarith, by linarith⟩ + refine ⟨b.normed μ, b.contDiff_normed, b.hasCompactSupport_normed, + ?_, b.integral_normed⟩ + rw [b.tsupport_normed_eq] + intro z hz + apply hball + exact lt_of_le_of_lt hz (by change r / 2 < r; linarith) + +/-- One target neighborhood works for every normalized continuous density. +This uniformity lets the same density be used throughout a localized homotopy. -/ +theorem regular_signed_count_neighborhood (f : E → E) (hf : ContDiff ℝ 1 f) + (y : E) (U : Set E) (hU : IsOpen U) (hc : IsCompact (closure U)) + (hb : ∀ x ∈ frontier U, f x ≠ y) (s : Finset E) + (hs : ∀ x, x ∈ s ↔ x ∈ U ∧ f x = y) + (hd : ∀ x ∈ s, (fderiv ℝ f x).det ≠ 0) : + ∃ N : Set E, IsOpen N ∧ y ∈ N ∧ ∀ ρ : E → ℝ, Continuous ρ → + Function.support ρ ⊆ N → (∫ z, ρ z ∂μ) = 1 → + jacobianIntegral μ f U ρ = ∑ x ∈ s, (if 0 < (fderiv ℝ f x).det then 1 else -1) := by + classical + obtain ⟨V, hV, hdisj⟩ := disjoint_regular_inverse_patches f hf U hU + (s : Set E) s.finite_toSet (fun x hx => ((hs x).mp hx).1) hd + obtain ⟨N, hN, hyN, hNimg, hNpre⟩ := exists_target_neighborhood_of_patches f y U hU + hc hf.continuous.continuousOn hb V (fun i => (hV i).1) + (fun i => (hV i).2.2.2.2.1) + (fun i => ⟨i, (hV i).2.1, ((hs i).mp i.property).2⟩) + (fun x hx hxy => ⟨⟨x, (hs x).mpr ⟨hx, hxy⟩⟩, (hV _).2.1⟩) + refine ⟨N, hN, hyN, fun ρ hρ hρN hρunit => ?_⟩ + have hcont : Continuous (fun x => (fderiv ℝ f x).det * ρ (f x)) := + (ContinuousLinearMap.continuous_det.comp (hf.continuous_fderiv (by norm_num))).mul + (hρ.comp hf.continuous) + have hint : IntegrableOn (fun x => (fderiv ℝ f x).det * ρ (f x)) U μ := + (hcont.continuousOn.integrableOn_compact hc).mono_set subset_closure + have hcount := jacobianIntegral_eq_sum_signs μ f U hU.measurableSet V + (fun i => (hV i).1.measurableSet) (fun i => (hV i).2.2.1) hdisj + (fun x _ => hf.differentiable (by norm_num) x) (fun i => (hV i).2.2.2.1) + ρ (fun i => if 0 < (fderiv ℝ f i).det then 1 else -1) + (fun i => (hV i).2.2.2.2.2) + (fun x hx hn => hNpre x hx (hρN hn)) + (fun i z hz => hNimg i (hρN hz)) hρunit hint + exact hcount.trans (Finset.sum_subtype (p := fun x => x ∈ (s : Set E)) s + (fun _ => Iff.rfl) (fun x => (if 0 < (fderiv ℝ f x).det then 1 else -1 : ℝ))).symm + +/-- The analytic representative has exactly the expected signed regular +count for a sufficiently concentrated normalized target bump. -/ +theorem regular_signed_count_density (f : E → E) (hf : ContDiff ℝ 1 f) + (y : E) (U : Set E) (hU : IsOpen U) (hc : IsCompact (closure U)) + (hb : ∀ x ∈ frontier U, f x ≠ y) (s : Finset E) + (hs : ∀ x, x ∈ s ↔ x ∈ U ∧ f x = y) + (hd : ∀ x ∈ s, (fderiv ℝ f x).det ≠ 0) : + ∃ ρ : E → ℝ, ContDiff ℝ ∞ ρ ∧ HasCompactSupport ρ ∧ (∫ z, ρ z ∂μ) = 1 ∧ + jacobianIntegral μ f U ρ = ∑ x ∈ s, (if 0 < (fderiv ℝ f x).det then 1 else -1) := by + classical + obtain ⟨V, hV, hdisj⟩ := disjoint_regular_inverse_patches f hf U hU + (s : Set E) s.finite_toSet (fun x hx => ((hs x).mp hx).1) hd + obtain ⟨N, hN, hyN, hNimg, hNpre⟩ := exists_target_neighborhood_of_patches f y U hU + hc hf.continuous.continuousOn hb V (fun i => (hV i).1) + (fun i => (hV i).2.2.2.2.1) + (fun i => ⟨i, (hV i).2.1, ((hs i).mp i.property).2⟩) + (fun x hx hxy => ⟨⟨x, (hs x).mpr ⟨hx, hxy⟩⟩, (hV _).2.1⟩) + obtain ⟨ρ, hρ, hρc, hρN, hρunit⟩ := exists_normalized_smooth_bump μ y N hN hyN + refine ⟨ρ, hρ, hρc, hρunit, ?_⟩ + have hcont : Continuous (fun x => (fderiv ℝ f x).det * ρ (f x)) := + (ContinuousLinearMap.continuous_det.comp (hf.continuous_fderiv (by norm_num))).mul + (hρ.continuous.comp hf.continuous) + have hint : IntegrableOn (fun x => (fderiv ℝ f x).det * ρ (f x)) U μ := + (hcont.continuousOn.integrableOn_compact hc).mono_set subset_closure + have hcount := jacobianIntegral_eq_sum_signs μ f U hU.measurableSet V + (fun i => (hV i).1.measurableSet) (fun i => (hV i).2.2.1) hdisj + (fun x _ => hf.differentiable (by norm_num) x) (fun i => (hV i).2.2.2.1) + ρ (fun i => if 0 < (fderiv ℝ f i).det then 1 else -1) + (fun i => (hV i).2.2.2.2.2) + (fun x hx hn => hNpre x hx (hρN (subset_tsupport ρ hn))) + (fun i z hz => hNimg i (hρN (subset_tsupport ρ hz))) hρunit hint + exact hcount.trans (Finset.sum_subtype (p := fun x => x ∈ (s : Set E)) s + (fun _ => Iff.rfl) (fun x => (if 0 < (fderiv ℝ f x).det then 1 else -1 : ℝ))).symm + +end EilenbergGanea + +open Set MeasureTheory Filter Topology +namespace EilenbergGanea + +/-- Standard coordinate basis as a tuple of vectors. -/ +def coordinateBasis (n : ℕ) : Fin n → (Fin n → ℝ) := fun i => Pi.single i 1 + +/-- The signed coordinate coefficient of an n-form in dimension n+1. -/ +def formFlux {n : ℕ} (form : (Fin (n + 1) → ℝ) → + (Fin (n + 1) → ℝ) [⋀^Fin n]→L[ℝ] ℝ) (i : Fin (n + 1)) + (x : Fin (n + 1) → ℝ) : ℝ := + (-1 : ℝ) ^ i.val * form x (i.removeNth (coordinateBasis (n + 1))) + +/-- Stokes on a rectangular box, as a direct consequence of Mathlib's +Bochner divergence theorem. No smoothness of an arbitrary open-set boundary +is assumed in the later application. -/ +theorem integral_extDeriv_box {n : ℕ} + (form : (Fin (n + 1) → ℝ) → (Fin (n + 1) → ℝ) [⋀^Fin n]→L[ℝ] ℝ) + (hform : Differentiable ℝ form) (a b : Fin (n + 1) → ℝ) (hab : a ≤ b) + (hint : IntegrableOn (fun x => extDeriv form x (coordinateBasis (n + 1))) (Icc a b)) : + (∫ x in Icc a b, extDeriv form x (coordinateBasis (n + 1))) = + ∑ i : Fin (n + 1), + ((∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), + formFlux form i (i.insertNth (b i) x)) - + ∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), + formFlux form i (i.insertNth (a i) x)) := by + have hd (i : Fin (n + 1)) (x : Fin (n + 1) → ℝ) : + DifferentiableAt ℝ (formFlux form i) x := by + exact ((hform x).continuousAlternatingMap_apply_const _).const_mul _ + have he (x : Fin (n + 1) → ℝ) : + (∑ i : Fin (n + 1), fderiv ℝ (formFlux form i) x (Pi.single i 1)) = + extDeriv form x (coordinateBasis (n + 1)) := by + rw [extDeriv_apply (hform x)] + apply Finset.sum_congr rfl + intro i _ + change (fderiv ℝ (fun y => (-1 : ℝ) ^ i.val * + form y (i.removeNth (coordinateBasis (n + 1)))) x) (Pi.single i 1) = _ + rw [fderiv_const_mul ((hform x).continuousAlternatingMap_apply_const _) ] + simp [coordinateBasis] + have h := integral_divergence_of_hasFDerivAt_off_countable' a b hab + (formFlux form) (fun i x => fderiv ℝ (formFlux form i) x) ∅ countable_empty + (fun i => (show Differentiable ℝ (formFlux form i) from hd i).continuous.continuousOn) + (fun x _ i => (hd i x).hasFDerivAt) (by simpa only [he] using hint) + simpa only [he] using h + +/-- Every top-degree differential form on Euclidean n-space is closed. -/ +theorem extDeriv_topForm_eq_zero {n : ℕ} + (φ : (Fin n → ℝ) → (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ) (x : Fin n → ℝ) : + extDeriv φ x = 0 := by + ext v + apply (extDeriv φ x).toAlternatingMap.map_linearDependent + intro hv + have h := hv.fintype_card_le_finrank + simp at h + +/-- The pullback of a top form by a C² map is closed (the Piola identity). -/ +theorem extDeriv_pullback_topForm_eq_zero {n : ℕ} {E : Type*} + [NormedAddCommGroup E] [NormedSpace ℝ E] + (φ : (Fin n → ℝ) → (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ) + (hφ : Differentiable ℝ φ) (F : E → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) (x : E) : + extDeriv (fun y => (φ (F y)).compContinuousLinearMap (fderiv ℝ F y)) x = 0 := by + rw [extDeriv_pullback (hφ _) hF.contDiffAt (by simp), extDeriv_topForm_eq_zero] + ext v + rfl + + +/-- A closed form has total signed flux zero across the faces of a box. -/ +theorem closedForm_boundary_box {n : ℕ} + (form : (Fin (n + 1) → ℝ) → (Fin (n + 1) → ℝ) [⋀^Fin n]→L[ℝ] ℝ) + (hform : Differentiable ℝ form) (hclosed : ∀ x, extDeriv form x = 0) + (a b : Fin (n + 1) → ℝ) (hab : a ≤ b) : + (∑ i : Fin (n + 1), + ((∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), + formFlux form i (i.insertNth (b i) x)) - + ∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), + formFlux form i (i.insertNth (a i) x))) = 0 := by + have hz (x) : extDeriv form x (coordinateBasis (n + 1)) = 0 := by rw [hclosed]; rfl + have h := integral_extDeriv_box form hform a b hab (by simpa only [hz] using integrableOn_zero) + simpa only [hz, integral_zero] using h.symm + +/-- The coefficient integrals on two opposing faces of a box agree for a +closed form whose flux on all other faces is zero. This is the analytic +homotopy-invariance step with the sides outside the support of the form. -/ +theorem closedForm_opposite_faces {n : ℕ} + (form : (Fin (n + 1) → ℝ) → (Fin (n + 1) → ℝ) [⋀^Fin n]→L[ℝ] ℝ) + (hform : Differentiable ℝ form) (hclosed : ∀ x, extDeriv form x = 0) + (a b : Fin (n + 1) → ℝ) (hab : a ≤ b) (k : Fin (n + 1)) + (hside : ∀ i, i ≠ k → ∀ x ∈ Icc (a ∘ i.succAbove) (b ∘ i.succAbove), + formFlux form i (i.insertNth (b i) x) = 0 ∧ + formFlux form i (i.insertNth (a i) x) = 0) : + (∫ x in Icc (a ∘ k.succAbove) (b ∘ k.succAbove), + formFlux form k (k.insertNth (b k) x)) = + ∫ x in Icc (a ∘ k.succAbove) (b ∘ k.succAbove), + formFlux form k (k.insertNth (a k) x) := by + have h := closedForm_boundary_box form hform hclosed a b hab + rw [Finset.sum_eq_single k] at h + · exact sub_eq_zero.mp h + · intro i _ hi + have hb0 : (∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), + formFlux form i (i.insertNth (b i) x)) = 0 := by + apply setIntegral_eq_zero_of_forall_eq_zero + intro x hx + exact (hside i hi x hx).1 + have ha0 : (∫ x in Icc (a ∘ i.succAbove) (b ∘ i.succAbove), + formFlux form i (i.insertNth (a i) x)) = 0 := by + apply setIntegral_eq_zero_of_forall_eq_zero + intro x hx + exact (hside i hi x hx).2 + rw [hb0, ha0, sub_self] + · simp + +/-- Determinant form with the standard coordinate orientation. -/ +def coordinateVolumeForm (n : ℕ) : (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ := + { Matrix.detRowAlternating with cont := continuous_id.matrix_det } + +/-- Smooth pullbacks of a top form are differentiable. -/ +theorem differentiable_pullback_topForm {n : ℕ} {E : Type*} + [NormedAddCommGroup E] [NormedSpace ℝ E] + (φ : (Fin n → ℝ) → (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ) + (hφ : Differentiable ℝ φ) (F : E → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) : + Differentiable ℝ (fun y => (φ (F y)).compContinuousLinearMap (fderiv ℝ F y)) := by + intro x + apply ((hφ (F x)).comp x (hF.differentiable (by norm_num) x) + ).continuousAlternatingMapCompContinuousLinearMap + exact (hF.fderiv_right (m := 1) (by norm_num)).differentiable (by norm_num) x + + +/-- Restricting a field to an open set whose boundary avoids its topological +support is locally either the original field or zero. -/ +theorem indicator_eventuallyEq_or_zero {X A : Type*} [TopologicalSpace X] [Zero A] + (U : Set X) (hU : IsOpen U) (f : X → A) + (hb : Disjoint (frontier U) (tsupport f)) (x : X) : + U.indicator f =ᶠ[nhds x] f ∨ U.indicator f =ᶠ[nhds x] fun _ => 0 := by + classical + by_cases hx : x ∈ U + · left + filter_upwards [hU.mem_nhds hx] with y hy + exact Set.indicator_of_mem hy f + · right + by_cases hc : x ∈ closure U + · have hf : x ∉ tsupport f := by + apply Set.disjoint_left.mp hb + exact ⟨hc, by simpa only [hU.interior_eq] using hx⟩ + have he := notMem_tsupport_iff_eventuallyEq.mp hf + filter_upwards [he] with y hy + by_cases hyU : y ∈ U <;> simp [Set.indicator, hyU, hy] + · filter_upwards [isClosed_closure.isOpen_compl.mem_nhds hc] with y hy + exact Set.indicator_of_notMem (fun hyU => hy (subset_closure hyU)) f + +/-- Excision at the differential-form level: cutting off at an arbitrary +isolating open-set boundary preserves differentiability and closedness. -/ +theorem localized_closedForm {n : ℕ} {E : Type*} + [NormedAddCommGroup E] [NormedSpace ℝ E] + (form : E → E [⋀^Fin n]→L[ℝ] ℝ) (hform : Differentiable ℝ form) + (hclosed : ∀ x, extDeriv form x = 0) (U : Set E) (hU : IsOpen U) + (hb : Disjoint (frontier U) (tsupport form)) : + Differentiable ℝ (U.indicator form) ∧ ∀ x, extDeriv (U.indicator form) x = 0 := by + constructor + · intro x + rcases indicator_eventuallyEq_or_zero U hU form hb x with hx | hx + · exact (hform x).congr_of_eventuallyEq hx + · exact differentiableAt_const (c := (0 : E [⋀^Fin n]→L[ℝ] ℝ)) |>.congr_of_eventuallyEq hx + · intro x + rcases indicator_eventuallyEq_or_zero U hU form hb x with hx | hx + · rw [hx.extDeriv_eq, hclosed] + · rw [hx.extDeriv_eq] + ext v + simp [extDeriv, ContinuousAlternatingMap.alternatizeUncurryFin_apply] + +/-- Homotopy-invariant integrals of a pulled-back target top form, with no +unproved mapping-degree primitive. -/ +theorem pullback_topForm_opposite_faces {n : ℕ} + (φ : (Fin n → ℝ) → (Fin n → ℝ) [⋀^Fin n]→L[ℝ] ℝ) + (hφ : Differentiable ℝ φ) (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) + (hF : ContDiff ℝ 2 F) (a b : Fin (n + 1) → ℝ) (hab : a ≤ b) + (k : Fin (n + 1)) + (hside : ∀ i, i ≠ k → ∀ x ∈ Icc (a ∘ i.succAbove) (b ∘ i.succAbove), + φ (F (i.insertNth (b i) x)) = 0 ∧ φ (F (i.insertNth (a i) x)) = 0) : + (∫ x in Icc (a ∘ k.succAbove) (b ∘ k.succAbove), + formFlux (fun y => (φ (F y)).compContinuousLinearMap (fderiv ℝ F y)) + k (k.insertNth (b k) x)) = + ∫ x in Icc (a ∘ k.succAbove) (b ∘ k.succAbove), + formFlux (fun y => (φ (F y)).compContinuousLinearMap (fderiv ℝ F y)) + k (k.insertNth (a k) x) := by + apply closedForm_opposite_faces _ (differentiable_pullback_topForm φ hφ F hF) + (extDeriv_pullback_topForm_eq_zero φ hφ F hF) a b hab k + intro i hi x hx + obtain ⟨hb, ha⟩ := hside i hi x hx + simp [formFlux, hb, ha] + + +/-- Evaluation of the standard volume form is the ordinary linear + determinant. -/ +theorem coordinateVolumeForm_linear {n : ℕ} + (L : (Fin n → ℝ) →L[ℝ] (Fin n → ℝ)) : + coordinateVolumeForm n (fun i => L (coordinateBasis n i)) = L.det := by + change Matrix.det (fun i => L (Pi.single i 1)) = _ + calc + _ = (LinearMap.toMatrix (Pi.basisFun ℝ (Fin n)) (Pi.basisFun ℝ (Fin n)) + L.toLinearMap).transpose.det := by + congr 1 + _ = _ := by rw [Matrix.det_transpose, LinearMap.det_toMatrix] + +/-- At a temporal face, the pullback coefficient is precisely the signed +Jacobian density of the corresponding slice. -/ +theorem formFlux_pullback_first_face {n : ℕ} + (ρ : (Fin n → ℝ) → ℝ) (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) + (t : ℝ) (x : Fin n → ℝ) (hF : DifferentiableAt ℝ F (Fin.cons t x)) : + formFlux (fun y => ((ρ (F y)) • coordinateVolumeForm n).compContinuousLinearMap + (fderiv ℝ F y)) 0 (Fin.cons t x) = + (fderiv ℝ (fun z => F (Fin.cons t z)) x).det * ρ (F (Fin.cons t x)) := by + let J : (Fin n → ℝ) →L[ℝ] (Fin (n + 1) → ℝ) := + (0 : (Fin n → ℝ) →L[ℝ] ℝ).finCons (ContinuousLinearMap.id ℝ (Fin n → ℝ)) + have hJ : HasFDerivAt (fun z : Fin n → ℝ => Fin.cons t z) J x := + (hasFDerivAt_const t x).finCons (hasFDerivAt_id x) + have hs := hF.hasFDerivAt.comp x hJ + have he (i : Fin n) : J (coordinateBasis n i) = coordinateBasis (n + 1) i.succ := by + funext j + refine Fin.cases ?_ (fun k => ?_) j + · simp [J, coordinateBasis, ContinuousLinearMap.finCons] + · simp [J, coordinateBasis, ContinuousLinearMap.finCons, Pi.single_apply] + have hs' : fderiv ℝ (fun z => F (Fin.cons t z)) x = + (fderiv ℝ F (Fin.cons t x)).comp J := hs.fderiv + rw [hs'] + have hd := coordinateVolumeForm_linear ((fderiv ℝ F (Fin.cons t x)).comp J) + simp only [ContinuousLinearMap.comp_apply, he] at hd + simp only [formFlux, Fin.val_zero, pow_zero, one_mul, Fin.removeNth_zero, + ContinuousAlternatingMap.compContinuousLinearMap_apply, + ContinuousAlternatingMap.smul_apply, smul_eq_mul] + rw [mul_comm] + congr 1 + +/-- Smooth homotopy invariance of the Jacobian integral against a target +bump whose pullback vanishes on the spatial sides of a containing box. -/ +theorem jacobian_integral_homotopy_box {n : ℕ} + (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) (a b : Fin n → ℝ) (hab : a ≤ b) + (hside : ∀ i : Fin (n + 1), i ≠ 0 → + ∀ x ∈ Icc ((Fin.cons t₀ a : Fin (n + 1) → ℝ) ∘ i.succAbove) + ((Fin.cons t₁ b : Fin (n + 1) → ℝ) ∘ i.succAbove), + ρ (F (i.insertNth ((Fin.cons t₁ b : Fin (n + 1) → ℝ) i) x)) = 0 ∧ + ρ (F (i.insertNth ((Fin.cons t₀ a : Fin (n + 1) → ℝ) i) x)) = 0) : + (∫ x in Icc a b, (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * + ρ (F (Fin.cons t₁ x))) = + ∫ x in Icc a b, (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * + ρ (F (Fin.cons t₀ x)) := by + have hφ : Differentiable ℝ (fun y => ρ y • coordinateVolumeForm n) := + hρ.smul_const _ + have hbox : (Fin.cons t₀ a : Fin (n + 1) → ℝ) ≤ Fin.cons t₁ b := by + intro i + exact Fin.cases ht (fun j => hab j) i + have h := pullback_topForm_opposite_faces (fun y => ρ y • coordinateVolumeForm n) + hφ F hF (Fin.cons t₀ a) (Fin.cons t₁ b) hbox 0 (by + intro i hi x hx + obtain ⟨h₁, h₀⟩ := hside i hi x hx + simp only [h₁, h₀, zero_smul, and_self]) + have hins (t : ℝ) (x : Fin n → ℝ) : + (0 : Fin (n + 1)).insertNth t x = (Fin.cons t x : Fin (n + 1) → ℝ) := by + simp only [Fin.insertNth_zero, cast_eq] + simpa only [Fin.succAbove_zero, Function.comp_def, Fin.cons_succ, Fin.cons_zero, + hins, formFlux_pullback_first_face ρ F _ _ (hF.differentiable (by norm_num) _)] using h + + +/-- The support of a pulled-back density lies above the support of the target +bump. This provides the needed collar at an arbitrary isolating boundary. -/ +theorem tsupport_pullback_density_subset {n : ℕ} {E : Type*} + [NormedAddCommGroup E] [NormedSpace ℝ E] + (ρ : (Fin n → ℝ) → ℝ) (F : E → (Fin n → ℝ)) (hF : Continuous F) : + tsupport (fun y => ((ρ (F y)) • coordinateVolumeForm n).compContinuousLinearMap + (fderiv ℝ F y)) ⊆ F ⁻¹' tsupport ρ := by + apply closure_minimal _ ((isClosed_tsupport ρ).preimage hF) + intro x hx + by_contra hn + have hz := image_eq_zero_of_notMem_tsupport hn + exact hx (by ext v; simp [hz]) + +/-- Localized homotopy invariance on an arbitrary open spatial set. The +boundary collar is expressed by avoidance of the target bump, not by a smooth +boundary assumption. The spatial box is only an integration device. -/ +theorem jacobian_integral_homotopy_localized_box {n : ℕ} + (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (U : Set (Fin n → ℝ)) (hU : IsOpen U) + (hboundary : ∀ y : Fin (n + 1) → ℝ, + (fun i => y i.succ) ∈ frontier U → F y ∉ tsupport ρ) + (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) (a b : Fin n → ℝ) (hab : a ≤ b) + (hbox : U ⊆ Icc a b) + (hside : ∀ i : Fin (n + 1), i ≠ 0 → + ∀ x ∈ Icc ((Fin.cons t₀ a : Fin (n + 1) → ℝ) ∘ i.succAbove) + ((Fin.cons t₁ b : Fin (n + 1) → ℝ) ∘ i.succAbove), + (fun j : Fin n => (i.insertNth ((Fin.cons t₁ b : Fin (n + 1) → ℝ) i) x : + Fin (n + 1) → ℝ) j.succ) ∉ U ∧ + (fun j : Fin n => (i.insertNth ((Fin.cons t₀ a : Fin (n + 1) → ℝ) i) x : + Fin (n + 1) → ℝ) j.succ) ∉ U) : + (∫ x in U, (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * + ρ (F (Fin.cons t₁ x))) = + ∫ x in U, (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * + ρ (F (Fin.cons t₀ x)) := by + classical + let π : (Fin (n + 1) → ℝ) → (Fin n → ℝ) := fun y i => y i.succ + have hπ : Continuous π := continuous_pi (fun i => continuous_apply i.succ) + let C := π ⁻¹' U + let form := fun y => ((ρ (F y)) • coordinateVolumeForm n).compContinuousLinearMap + (fderiv ℝ F y) + have hc : Disjoint (frontier C) (tsupport form) := by + apply disjoint_left.mpr + intro y hy hs + exact hboundary y ((hπ.frontier_preimage_subset U) hy) + (tsupport_pullback_density_subset ρ F hF.continuous hs) + obtain ⟨hd, hz⟩ := localized_closedForm form + (differentiable_pullback_topForm _ (hρ.smul_const _) F hF) + (extDeriv_pullback_topForm_eq_zero _ (hρ.smul_const _) F hF) C + (hU.preimage hπ) hc + have htbox : (Fin.cons t₀ a : Fin (n + 1) → ℝ) ≤ Fin.cons t₁ b := by + intro i + exact Fin.cases ht (fun j => hab j) i + have he := closedForm_opposite_faces (C.indicator form) hd hz + (Fin.cons t₀ a) (Fin.cons t₁ b) htbox 0 (by + intro i hi x hx + obtain ⟨h₁, h₀⟩ := hside i hi x hx + have hc₁ : i.insertNth ((Fin.cons t₁ b : Fin (n + 1) → ℝ) i) x ∉ C := h₁ + have hc₀ : i.insertNth ((Fin.cons t₀ a : Fin (n + 1) → ℝ) i) x ∉ C := h₀ + simp [formFlux, indicator_of_notMem hc₁, indicator_of_notMem hc₀]) + have hface (t : ℝ) (x : Fin n → ℝ) : + formFlux (C.indicator form) 0 (Fin.cons t x) = + U.indicator (fun z => (fderiv ℝ (fun w => F (Fin.cons t w)) z).det * + ρ (F (Fin.cons t z))) x := by + by_cases hx : x ∈ U + · have hc : Fin.cons t x ∈ C := by simpa only [C, mem_preimage, π, Fin.cons_succ] using hx + rw [indicator_of_mem hx] + change (-1 : ℝ) ^ (0 : Fin (n + 1)).val * + (C.indicator form) (Fin.cons t x) _ = _ + rw [indicator_of_mem hc] + exact formFlux_pullback_first_face ρ F t x (hF.differentiable (by norm_num) _) + · have hc : Fin.cons t x ∉ C := by simpa only [C, mem_preimage, π, Fin.cons_succ] using hx + simp [formFlux, hc, hx] + have hins (t : ℝ) (x : Fin n → ℝ) : + (0 : Fin (n + 1)).insertNth t x = (Fin.cons t x : Fin (n + 1) → ℝ) := by + simp only [Fin.insertNth_zero, cast_eq] + simpa only [Fin.succAbove_zero, Function.comp_def, Fin.cons_succ, Fin.cons_zero, + hins, hface, setIntegral_indicator hU.measurableSet, + inter_eq_right.mpr hbox] using he + + +/-- Homotopy invariance on a bounded open set, without selecting a box or +requiring any shape or smoothness of its boundary. -/ +theorem jacobian_integral_homotopy_localized {n : ℕ} + (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (U : Set (Fin n → ℝ)) (hU : IsOpen U) (hUb : Bornology.IsBounded U) + (hboundary : ∀ y : Fin (n + 1) → ℝ, + (fun i => y i.succ) ∈ frontier U → F y ∉ tsupport ρ) + (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) : + (∫ x in U, (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * + ρ (F (Fin.cons t₁ x))) = + ∫ x in U, (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * + ρ (F (Fin.cons t₀ x)) := by + obtain ⟨R, hR, hbound⟩ := hUb.exists_pos_norm_lt + have hcoord (x) (hx : x ∈ U) (i : Fin n) : |x i| < R := + lt_of_le_of_lt (norm_le_pi_norm x i) (hbound x hx) + have hout (x : Fin n → ℝ) (i : Fin n) (hx : x i = R ∨ x i = -R) : x ∉ U := by + intro hxu + have h := hcoord x hxu i + rcases hx with hx | hx <;> rw [hx] at h + · simp only [abs_of_pos hR, lt_self_iff_false] at h + · simp only [abs_neg, abs_of_pos hR, lt_self_iff_false] at h + apply jacobian_integral_homotopy_localized_box ρ hρ F hF U hU hboundary + t₀ t₁ ht (fun _ => -R) (fun _ => R) (fun _ => by linarith) + · intro x hx + constructor <;> intro i + · exact (abs_lt.mp (hcoord x hx i)).1.le + · exact (abs_lt.mp (hcoord x hx i)).2.le + · intro i hi x _ + obtain ⟨j, rfl⟩ := Fin.eq_succ_of_ne_zero hi + constructor + · apply hout _ j + left + simp only [Fin.insertNth_apply_same, Fin.cons_succ] + · apply hout _ j + right + simp only [Fin.insertNth_apply_same, Fin.cons_succ] + + +/-- Only boundary avoidance during the given interval is needed. Smooth +saturation of the time coordinate turns it into the global collar hypothesis +of the preceding Stokes argument, with the endpoints unchanged. -/ +theorem jacobian_integral_homotopy_localized_interval {n : ℕ} + (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (U : Set (Fin n → ℝ)) (hU : IsOpen U) (hUb : Bornology.IsBounded U) + (hboundary : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, + F (Fin.cons t x) ∉ tsupport ρ) : + (∫ x in U, (fderiv ℝ (fun z => F (Fin.cons 1 z)) x).det * + ρ (F (Fin.cons 1 x))) = + ∫ x in U, (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det * + ρ (F (Fin.cons 0 x)) := by + let H : (Fin (n + 1) → ℝ) → (Fin n → ℝ) := fun y => + F (Fin.cons (Real.smoothTransition (y 0)) (Fin.tail y)) + have hH : ContDiff ℝ 2 H := by + apply hF.comp + apply contDiff_pi.mpr + intro i + refine Fin.cases ?_ (fun j => ?_) i + · exact Real.smoothTransition.contDiff.comp (contDiff_apply ℝ ℝ 0) + · exact contDiff_apply ℝ ℝ j.succ + have hb : ∀ y : Fin (n + 1) → ℝ, + (fun i => y i.succ) ∈ frontier U → H y ∉ tsupport ρ := by + intro y hy + exact hboundary _ ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩ _ hy + have h := jacobian_integral_homotopy_localized ρ hρ H hH U hU hUb hb 0 1 zero_le_one + simpa only [H, Fin.cons_zero, Fin.tail_cons, Real.smoothTransition.zero, + Real.smoothTransition.one] using h + +end EilenbergGanea + +namespace EilenbergGanea +open Set MeasureTheory + +/-- A nonzero signed regular count cannot disappear under a smooth homotopy +whose boundary avoids the target. All analytic degree ingredients are proved +above; in particular this is not an assumed Brouwer-degree interface. -/ +theorem regular_count_persists {n : ℕ} + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (y : Fin n → ℝ) (U : Set (Fin n → ℝ)) (hU : IsOpen U) + (hc : IsCompact (closure U)) + (hb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, F (Fin.cons t x) ≠ y) + (s : Finset (Fin n → ℝ)) + (hs : ∀ x, x ∈ s ↔ x ∈ U ∧ F (Fin.cons 0 x) = y) + (hd : ∀ x ∈ s, (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det ≠ 0) + (hcount : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det + then 1 else -1 : ℝ)) ≠ 0) : + ∃ x ∈ U, F (Fin.cons 1 x) = y := by + classical + by_contra hno + have hno' : ∀ x ∈ U, F (Fin.cons 1 x) ≠ y := by simpa only [not_exists, not_and] using hno + let f₀ : (Fin n → ℝ) → (Fin n → ℝ) := fun x => F (Fin.cons 0 x) + let f₁ : (Fin n → ℝ) → (Fin n → ℝ) := fun x => F (Fin.cons 1 x) + have hcons (t : ℝ) : ContDiff ℝ 2 (fun x : Fin n → ℝ => + (Fin.cons t x : Fin (n + 1) → ℝ)) := by + apply contDiff_pi.mpr + intro i + refine Fin.cases contDiff_const (fun j => ?_) i + exact contDiff_apply ℝ ℝ j + have hf₀ : ContDiff ℝ 1 f₀ := (hF.comp (hcons 0)).of_le (by norm_num) + have hf₁ : Continuous f₁ := (hF.comp (hcons 1)).continuous + obtain ⟨N, hN, hyN, hsign⟩ := regular_signed_count_neighborhood volume f₀ hf₀ + y U hU hc (hb 0 (by simp)) s hs hd + let K : Set (Fin n → ℝ) := + (fun p : ℝ × (Fin n → ℝ) => F (Fin.cons p.1 p.2)) '' (Icc (0 : ℝ) 1 ×ˢ frontier U) + have hfront : IsCompact (frontier U) := hc.of_isClosed_subset isClosed_frontier frontier_subset_closure + have hK : IsCompact K := (isCompact_Icc.prod hfront).image + (hF.continuous.comp (by + apply continuous_pi + intro i + exact Fin.cases continuous_fst + (fun j => (continuous_apply j).comp continuous_snd) i)) + have hyK : y ∉ K := by + rintro ⟨⟨t, x⟩, ⟨ht, hx⟩, he⟩ + exact hb t ht x hx he + have hy₁ : y ∉ f₁ '' closure U := by + rintro ⟨x, hx, he⟩ + by_cases hxU : x ∈ U + · exact hno' x hxU he + · exact hb 1 (by simp) x ⟨hx, by simpa only [hU.interior_eq] using hxU⟩ he + let M := N \ (K ∪ f₁ '' closure U) + have hM : IsOpen M := hN.sdiff (hK.isClosed.union (hc.image hf₁).isClosed) + have hyM : y ∈ M := ⟨hyN, fun h => h.elim hyK hy₁⟩ + obtain ⟨ρ, hρ, _, hρM, hunit⟩ := exists_normalized_smooth_bump volume y M hM hyM + have hρN : Function.support ρ ⊆ N := fun z hz => (hρM (subset_tsupport ρ hz)).1 + have hval : jacobianIntegral volume f₀ U ρ = + ∑ x ∈ s, (if 0 < (fderiv ℝ f₀ x).det then 1 else -1) := + hsign ρ hρ.continuous hρN hunit + have hcollar : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, + F (Fin.cons t x) ∉ tsupport ρ := by + intro t ht x hx hsup + exact (hρM hsup).2 (Or.inl ⟨(t, x), ⟨ht, hx⟩, rfl⟩) + have hinv := jacobian_integral_homotopy_localized_interval ρ + (hρ.differentiable (by simp)) F hF U hU + (hc.isBounded.subset subset_closure) hcollar + have hzero : jacobianIntegral volume f₁ U ρ = 0 := by + apply jacobianIntegral_eq_zero_of_no_preimage + intro x hx + apply image_eq_zero_of_notMem_tsupport + intro hsup + exact (hρM hsup).2 (Or.inr ⟨x, subset_closure hx, rfl⟩) + apply hcount + exact hval.symm.trans (hinv.symm.trans hzero) + +end EilenbergGanea + +namespace EilenbergGanea +open Set +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +/-- The analytic nonzero-count theorem is independent of a choice of linear +coordinates. This form applies directly to finite products of quaternions. -/ +theorem regular_count_persists_finiteDimensional + (F : ℝ × E → E) (hF : ContDiff ℝ 2 F) + (y : E) (U : Set E) (hU : IsOpen U) (hc : IsCompact (closure U)) + (hb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, F (t, x) ≠ y) + (s : Finset E) (hs : ∀ x, x ∈ s ↔ x ∈ U ∧ F (0, x) = y) + (hd : ∀ x ∈ s, (fderiv ℝ (fun z => F (0, z)) x).det ≠ 0) + (hcount : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => F (0, z)) x).det + then 1 else -1 : ℝ)) ≠ 0) : ∃ x ∈ U, F (1, x) = y := by + classical + let n := Module.finrank ℝ E + let e : E ≃L[ℝ] (Fin n → ℝ) := (Module.finBasis ℝ E).equivFunL + let G : (Fin (n + 1) → ℝ) → (Fin n → ℝ) := + fun z => e (F (z 0, e.symm (Fin.tail z))) + have hG : ContDiff ℝ 2 G := by + apply e.contDiff.comp + apply hF.comp + exact (contDiff_apply ℝ ℝ 0).prodMk (e.symm.contDiff.comp + (contDiff_pi.mpr (fun i => contDiff_apply ℝ ℝ i.succ))) + have hdet (x : E) : + (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e x)).det = + (fderiv ℝ (fun z => F (0, z)) x).det := by + have h₀ : DifferentiableAt ℝ (fun z => F (0, z)) x := + (hF.comp (contDiff_const.prodMk contDiff_id)).differentiable (by norm_num) x + have h₀' : HasFDerivAt (fun z => F (0, z)) + (fderiv ℝ (fun z => F (0, z)) x) (e.symm (e x)) := by + simpa only [ContinuousLinearEquiv.symm_apply_apply] using h₀.hasFDerivAt + have hcomp := e.hasFDerivAt.comp (e x) + (h₀'.comp (e x) e.symm.hasFDerivAt) + have hh : (fun z => G (Fin.cons 0 z)) = e ∘ (fun z => F (0, z)) ∘ e.symm := by + funext z + simp [G, Function.comp_def] + rw [hh, hcomp.fderiv] + exact LinearMap.det_conj _ e.toLinearEquiv + have hVc : IsCompact (closure (e '' U)) := by + rw [← show (e : E → (Fin n → ℝ)) '' closure U = closure (e '' U) from e.toHomeomorph.image_closure U] + exact hc.image e.continuous + have hb' : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier (e '' U), + G (Fin.cons t x) ≠ e y := by + intro t ht x hx he + rw [← show (e : E → (Fin n → ℝ)) '' frontier U = frontier (e '' U) from e.toHomeomorph.image_frontier U] at hx + obtain ⟨z, hz, rfl⟩ := hx + apply hb t ht z hz + apply e.injective + simpa [G] using he + let s' := s.map e.toEquiv.toEmbedding + have hs' : ∀ x, x ∈ s' ↔ x ∈ e '' U ∧ G (Fin.cons 0 x) = e y := by + intro x + constructor + · intro hx + obtain ⟨z, hz, rfl⟩ := Finset.mem_map.mp hx + refine ⟨⟨z, (hs z).mp hz |>.1, rfl⟩, ?_⟩ + simp [G, (hs z).mp hz |>.2] + · rintro ⟨⟨z, hz, rfl⟩, he⟩ + apply Finset.mem_map.mpr + refine ⟨z, (hs z).mpr ⟨hz, ?_⟩, rfl⟩ + exact e.injective (by simpa [G] using he) + have hd' : ∀ x ∈ s', (fderiv ℝ (fun z => G (Fin.cons 0 z)) x).det ≠ 0 := by + intro x hx + obtain ⟨z, hz, rfl⟩ := Finset.mem_map.mp hx + change (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e z)).det ≠ 0 + rw [hdet] + exact hd z hz + have hcount' : (∑ x ∈ s', (if 0 < (fderiv ℝ (fun z => G (Fin.cons 0 z)) x).det + then 1 else -1 : ℝ)) ≠ 0 := by + change (∑ x ∈ s.map e.toEquiv.toEmbedding, _) ≠ 0 + rw [Finset.sum_map] + change (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e x)).det then 1 else -1 : ℝ)) ≠ 0 + simpa only [hdet] using hcount + obtain ⟨x, hx, he⟩ := regular_count_persists G hG (e y) (e '' U) + (e.toHomeomorph.isOpenMap _ hU) hVc hb' s' hs' hd' hcount' + obtain ⟨z, hz, rfl⟩ := hx + exact ⟨z, hz, e.injective (by simpa [G] using he)⟩ + +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped ContDiff + +/-- A regular perturbation at time zero can be propagated along an arbitrary +boundary-root-free smooth homotopy. The perturbation need not be equivariant +away from the initial time. -/ +theorem regular_approximation_persists + {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + (F : ℝ × E → E) (hF : ContDiff ℝ 2 F) + (U : Set E) (hU : IsOpen U) (hc : IsCompact (closure U)) + (hb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, F (t, x) ≠ 0) + (happrox : ∀ ε : ℝ, 0 < ε → ∃ g : E → E, ContDiff ℝ ∞ g ∧ + (∀ x ∈ closure U, ‖g x - F (0, x)‖ < ε) ∧ + ∃ s : Finset E, (∀ x, x ∈ s ↔ x ∈ closure U ∧ g x = 0) ∧ + (∀ x ∈ s, (fderiv ℝ g x).det ≠ 0) ∧ + (∑ x ∈ s, (if 0 < (fderiv ℝ g x).det then 1 else -1 : ℝ)) ≠ 0) : + ∃ x ∈ U, F (1, x) = 0 := by + classical + let P := Icc (0 : ℝ) 1 ×ˢ frontier U + have hP : IsCompact P := isCompact_Icc.prod + (hc.of_isClosed_subset isClosed_frontier frontier_subset_closure) + have hz : (0 : E) ∈ (F '' P)ᶜ := by + rintro ⟨⟨t, x⟩, ⟨ht, hx⟩, he⟩ + exact hb t ht x hx he + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp (hP.image hF.continuous).isClosed.isOpen_compl 0 hz + have hbound : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, ε ≤ ‖F (t, x)‖ := by + intro t ht x hx + by_contra hn + have hmem : F (t, x) ∈ Metric.ball (0 : E) ε := by + simpa only [Metric.mem_ball, dist_zero_right] using lt_of_not_ge hn + exact hball hmem ⟨(t, x), ⟨ht, hx⟩, rfl⟩ + obtain ⟨g, hg, hclose, s, hs, hd, hcount⟩ := happrox ε hε + let G : ℝ × E → E := fun q => F q + (1 - q.1) • (g q.2 - F (0, q.2)) + have hG : ContDiff ℝ 2 G := hF.add + ((contDiff_const.sub contDiff_fst).smul (((contDiff_infty.mp hg 2).comp contDiff_snd).sub + (hF.comp (contDiff_const.prodMk contDiff_snd)))) + have hG0 : (fun x => G (0, x)) = g := by funext x; simp [G] + have hG1 : (fun x => G (1, x)) = fun x => F (1, x) := by funext x; simp [G] + have hGb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, G (t, x) ≠ 0 := by + intro t ht x hx he + have heq : F (t, x) = -((1 - t) • (g x - F (0, x))) := eq_neg_of_add_eq_zero_left he + have hn : ‖F (t, x)‖ < ε := by + rw [heq, norm_neg, norm_smul, Real.norm_eq_abs, abs_of_nonneg (by linarith [ht.2])] + calc + (1 - t) * ‖g x - F (0, x)‖ ≤ ‖g x - F (0, x)‖ := + mul_le_of_le_one_left (norm_nonneg _) (by linarith [ht.1]) + _ < ε := hclose x (frontier_subset_closure hx) + exact (not_lt_of_ge (hbound t ht x hx)) hn + have hsU : ∀ x, x ∈ s ↔ x ∈ U ∧ G (0, x) = 0 := by + intro x + rw [hs, show G (0, x) = g x from congrFun hG0 x] + constructor + · rintro ⟨hx, he⟩ + refine ⟨?_, he⟩ + by_contra hn + have hxf : x ∈ frontier U := ⟨hx, by simpa only [hU.interior_eq] using hn⟩ + exact hGb 0 (by simp) x hxf (by rw [show G (0, x) = g x from congrFun hG0 x]; exact he) + · rintro ⟨hx, he⟩; exact ⟨subset_closure hx, he⟩ + have hd' : ∀ x ∈ s, (fderiv ℝ (fun z => G (0, z)) x).det ≠ 0 := by rw [hG0]; exact hd + have hcount' : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => G (0, z)) x).det then 1 else -1 : ℝ)) ≠ 0 := by + rw [hG0]; exact hcount + obtain ⟨x, hx, he⟩ := regular_count_persists_finiteDimensional G hG 0 U hU hc hGb s hsU hd' hcount' + exact ⟨x, hx, by simpa only [show G (1, x) = F (1, x) from congrFun hG1 x] using he⟩ + +/-- Localized nonsingular-exponent word-map roots cannot disappear under a +boundary-root-free smooth homotopy, even though the initial word map can have +singular roots. -/ +theorem localized_word_root_persists {m : ℕ} + (w : Fin m → FreeGroup (Fin m)) (hB : (exponentMatrix w).det ≠ 0) + (F : ℝ × ((Fin m → ℂ) × (Fin m → ℂ)) → ((Fin m → ℂ) × (Fin m → ℂ))) + (hF : ContDiff ℝ 2 F) (hF0 : ∀ q, F (0, q) = splitWordMap w q) + (U : Set ((Fin m → ℂ) × (Fin m → ℂ))) (hU : IsOpen U) + (hc : IsCompact (closure U)) + (hUi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q ∈ closure U, (q.1, z • q.2) ∈ closure U) + (h1 : (1, 0) ∈ U) + (hb : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ frontier U, F (t, x) ≠ 0) : + ∃ x ∈ U, F (1, x) = 0 := by + apply regular_approximation_persists F hF U hU hc hb + intro ε hε + simpa only [hF0] using word_exists_regularization_nonzero_count w hB + (closure U) hc hUi (subset_closure h1) (closure U) hc (Subset.refl _) ε hε + +end EilenbergGanea + +namespace EilenbergGanea +open Set MeasureTheory + +/-- Stokes localization in an arbitrary open subset of time times space. +The two slices may be different; no regularity of the moving boundary is used. -/ +theorem jacobian_integral_moving_box {n : ℕ} + (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (C : Set (Fin (n + 1) → ℝ)) (hC : IsOpen C) + (hboundary : ∀ y ∈ frontier C, F y ∉ tsupport ρ) + (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) (a b : Fin n → ℝ) (hab : a ≤ b) + (hbox : ∀ t, {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C} ⊆ Icc a b) + (hside : ∀ i : Fin (n + 1), i ≠ 0 → + ∀ x ∈ Icc ((Fin.cons t₀ a : Fin (n + 1) → ℝ) ∘ i.succAbove) + ((Fin.cons t₁ b : Fin (n + 1) → ℝ) ∘ i.succAbove), + i.insertNth ((Fin.cons t₁ b : Fin (n + 1) → ℝ) i) x ∉ C ∧ + i.insertNth ((Fin.cons t₀ a : Fin (n + 1) → ℝ) i) x ∉ C) : + (∫ x in {x | (Fin.cons t₁ x : Fin (n + 1) → ℝ) ∈ C}, + (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * ρ (F (Fin.cons t₁ x))) = + ∫ x in {x | (Fin.cons t₀ x : Fin (n + 1) → ℝ) ∈ C}, + (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * ρ (F (Fin.cons t₀ x)) := by + classical + let form := fun y => ((ρ (F y)) • coordinateVolumeForm n).compContinuousLinearMap + (fderiv ℝ F y) + have hc : Disjoint (frontier C) (tsupport form) := by + apply disjoint_left.mpr + intro y hy hs + exact hboundary y hy (tsupport_pullback_density_subset ρ F hF.continuous hs) + obtain ⟨hd, hz⟩ := localized_closedForm form + (differentiable_pullback_topForm _ (hρ.smul_const _) F hF) + (extDeriv_pullback_topForm_eq_zero _ (hρ.smul_const _) F hF) C hC hc + have htbox : (Fin.cons t₀ a : Fin (n + 1) → ℝ) ≤ Fin.cons t₁ b := by + intro i + exact Fin.cases ht (fun j => hab j) i + have he := closedForm_opposite_faces (C.indicator form) hd hz + (Fin.cons t₀ a) (Fin.cons t₁ b) htbox 0 (by + intro i hi x hx + obtain ⟨h₁, h₀⟩ := hside i hi x hx + simp [formFlux, indicator_of_notMem h₁, indicator_of_notMem h₀]) + have hface (t : ℝ) (x : Fin n → ℝ) : + formFlux (C.indicator form) 0 (Fin.cons t x) = + {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C}.indicator + (fun z => (fderiv ℝ (fun w => F (Fin.cons t w)) z).det * + ρ (F (Fin.cons t z))) x := by + by_cases hx : (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C + · rw [indicator_of_mem (show x ∈ {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C} from hx)] + change (-1 : ℝ) ^ (0 : Fin (n + 1)).val * + (C.indicator form) (Fin.cons t x) _ = _ + rw [indicator_of_mem hx] + exact formFlux_pullback_first_face ρ F t x (hF.differentiable (by norm_num) _) + · simp [formFlux, hx] + have hins (t : ℝ) (x : Fin n → ℝ) : + (0 : Fin (n + 1)).insertNth t x = (Fin.cons t x : Fin (n + 1) → ℝ) := by + simp only [Fin.insertNth_zero, cast_eq] + have hm (t : ℝ) : MeasurableSet {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C} := by + apply (hC.preimage _).measurableSet + apply continuous_pi + intro i + exact Fin.cases continuous_const (fun j => continuous_apply j) i + simpa only [Fin.succAbove_zero, Function.comp_def, Fin.cons_succ, Fin.cons_zero, + hins, hface, setIntegral_indicator (hm _), + inter_eq_right.mpr (hbox _)] using he + +end EilenbergGanea + +namespace EilenbergGanea +open Set MeasureTheory Filter Topology + +/-- Box-free moving-domain Stokes, with arbitrary open moving slices contained +in one bounded spatial set. -/ +theorem jacobian_integral_moving {n : ℕ} + (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (C : Set (Fin (n + 1) → ℝ)) (hC : IsOpen C) + (hboundary : ∀ y ∈ frontier C, F y ∉ tsupport ρ) + (hCb : Bornology.IsBounded {x : Fin n → ℝ | ∃ t : ℝ, Fin.cons t x ∈ C}) + (t₀ t₁ : ℝ) (ht : t₀ ≤ t₁) : + (∫ x in {x | (Fin.cons t₁ x : Fin (n + 1) → ℝ) ∈ C}, + (fderiv ℝ (fun z => F (Fin.cons t₁ z)) x).det * ρ (F (Fin.cons t₁ x))) = + ∫ x in {x | (Fin.cons t₀ x : Fin (n + 1) → ℝ) ∈ C}, + (fderiv ℝ (fun z => F (Fin.cons t₀ z)) x).det * ρ (F (Fin.cons t₀ x)) := by + obtain ⟨R, hR, hbound⟩ := hCb.exists_pos_norm_lt + have hcoord (t : ℝ) (x : Fin n → ℝ) (hx : Fin.cons t x ∈ C) (i : Fin n) : |x i| < R := + lt_of_le_of_lt (by simpa only [Real.norm_eq_abs] using norm_le_pi_norm x i) + (hbound x ⟨t, hx⟩) + have hout (y : Fin (n + 1) → ℝ) (j : Fin n) + (hj : y j.succ = R ∨ y j.succ = -R) : y ∉ C := by + intro hy + have hh := hcoord (y 0) (Fin.tail y) (by simpa only [Fin.cons_self_tail] using hy) j + change |y j.succ| < R at hh + rcases hj with hj | hj + · rw [hj, abs_of_pos hR] at hh; exact lt_irrefl _ hh + · rw [hj, abs_neg, abs_of_pos hR] at hh; exact lt_irrefl _ hh + apply jacobian_integral_moving_box ρ hρ F hF C hC hboundary t₀ t₁ ht + (fun _ => -R) (fun _ => R) (fun _ => by linarith) + · intro t x hx + constructor <;> intro i + · exact (abs_lt.mp (hcoord t x hx i)).1.le + · exact (abs_lt.mp (hcoord t x hx i)).2.le + · intro i hi x _ + obtain ⟨j, rfl⟩ := Fin.eq_succ_of_ne_zero hi + constructor + · apply hout _ j + left + simp only [Fin.insertNth_apply_same, Fin.cons_succ] + · apply hout _ j + right + simp only [Fin.insertNth_apply_same, Fin.cons_succ] + +/-- Smooth time saturation reduces the collar hypothesis to the actual time +interval even for moving open domains. -/ +theorem jacobian_integral_moving_interval {n : ℕ} + (ρ : (Fin n → ℝ) → ℝ) (hρ : Differentiable ℝ ρ) + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (C : Set (Fin (n + 1) → ℝ)) (hC : IsOpen C) + (hboundary : ∀ y ∈ frontier C, y 0 ∈ Icc (0 : ℝ) 1 → F y ∉ tsupport ρ) + (hCb : Bornology.IsBounded {x : Fin n → ℝ | ∃ t ∈ Icc (0 : ℝ) 1, Fin.cons t x ∈ C}) : + (∫ x in {x | (Fin.cons 1 x : Fin (n + 1) → ℝ) ∈ C}, + (fderiv ℝ (fun z => F (Fin.cons 1 z)) x).det * ρ (F (Fin.cons 1 x))) = + ∫ x in {x | (Fin.cons 0 x : Fin (n + 1) → ℝ) ∈ C}, + (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det * ρ (F (Fin.cons 0 x)) := by + let T : (Fin (n + 1) → ℝ) → (Fin (n + 1) → ℝ) := + fun y => Fin.cons (Real.smoothTransition (y 0)) (Fin.tail y) + have hT : ContDiff ℝ 2 T := by + apply contDiff_pi.mpr + intro i + refine Fin.cases ?_ (fun j => ?_) i + · exact Real.smoothTransition.contDiff.comp (contDiff_apply ℝ ℝ 0) + · exact contDiff_apply ℝ ℝ j.succ + have hb : ∀ y ∈ frontier (T ⁻¹' C), (F ∘ T) y ∉ tsupport ρ := by + intro y hy + exact hboundary (T y) (hT.continuous.frontier_preimage_subset C hy) + ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩ + have hbound : Bornology.IsBounded {x : Fin n → ℝ | ∃ t : ℝ, Fin.cons t x ∈ T ⁻¹' C} := by + apply hCb.subset + rintro x ⟨t, ht⟩ + exact ⟨Real.smoothTransition t, ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩, ht⟩ + have he := jacobian_integral_moving ρ hρ (F ∘ T) (hF.comp hT) (T ⁻¹' C) + (hC.preimage hT.continuous) hb hbound 0 1 zero_le_one + simpa only [T, Function.comp_apply, mem_preimage, Fin.cons_zero, Fin.tail_cons, + Real.smoothTransition.zero, Real.smoothTransition.one] using he + +end EilenbergGanea + +namespace EilenbergGanea +open Set MeasureTheory Filter Topology + +/-- A nonzero signed count survives an arbitrary moving open set. The compact +boundary slab hypothesis is satisfied by the fixed annulus in the quaternion +application; no boundary triangulation or regular-value hypothesis is used +along the homotopy. -/ +theorem regular_count_persists_moving {n : ℕ} + (F : (Fin (n + 1) → ℝ) → (Fin n → ℝ)) (hF : ContDiff ℝ 2 F) + (y : Fin n → ℝ) (C : Set (Fin (n + 1) → ℝ)) (hC : IsOpen C) + (hc₀ : IsCompact (closure {x | (Fin.cons 0 x : Fin (n + 1) → ℝ) ∈ C})) + (hc₁ : IsCompact (closure {x | (Fin.cons 1 x : Fin (n + 1) → ℝ) ∈ C})) + (hcB : IsCompact {q | q ∈ frontier C ∧ q 0 ∈ Icc (0 : ℝ) 1}) + (hCb : Bornology.IsBounded {x : Fin n → ℝ | ∃ t ∈ Icc (0 : ℝ) 1, Fin.cons t x ∈ C}) + (hb : ∀ q ∈ frontier C, q 0 ∈ Icc (0 : ℝ) 1 → F q ≠ y) + (s : Finset (Fin n → ℝ)) + (hs : ∀ x, x ∈ s ↔ Fin.cons 0 x ∈ C ∧ F (Fin.cons 0 x) = y) + (hd : ∀ x ∈ s, (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det ≠ 0) + (hcount : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => F (Fin.cons 0 z)) x).det + then 1 else -1 : ℝ)) ≠ 0) : ∃ x, Fin.cons 1 x ∈ C ∧ F (Fin.cons 1 x) = y := by + classical + by_contra hno + have hno' : ∀ x, Fin.cons 1 x ∈ C → F (Fin.cons 1 x) ≠ y := by simpa using hno + let U : ℝ → Set (Fin n → ℝ) := fun t => {x | (Fin.cons t x : Fin (n + 1) → ℝ) ∈ C} + let f₀ := fun x => F (Fin.cons 0 x) + let f₁ := fun x => F (Fin.cons 1 x) + have hcons (t : ℝ) : ContDiff ℝ 2 (fun x : Fin n → ℝ => (Fin.cons t x : Fin (n + 1) → ℝ)) := by + apply contDiff_pi.mpr + intro i + exact Fin.cases contDiff_const (fun j => contDiff_apply ℝ ℝ j) i + have hU (t : ℝ) : IsOpen (U t) := hC.preimage (hcons t).continuous + have hfront (t : ℝ) : frontier (U t) ⊆ + (fun x : Fin n → ℝ => Fin.cons t x) ⁻¹' frontier C := + (hcons t).continuous.frontier_preimage_subset C + have hf₀ : ContDiff ℝ 1 f₀ := (hF.comp (hcons 0)).of_le (by norm_num) + have hf₁ : Continuous f₁ := (hF.comp (hcons 1)).continuous + obtain ⟨N, hN, hyN, hsign⟩ := regular_signed_count_neighborhood volume f₀ hf₀ y (U 0) + (hU 0) hc₀ (fun x hx => hb _ (hfront 0 hx) (by simp)) s hs hd + let K := F '' {q | q ∈ frontier C ∧ q 0 ∈ Icc (0 : ℝ) 1} + have hK : IsCompact K := hcB.image hF.continuous + have hyK : y ∉ K := by + rintro ⟨q, ⟨hq, ht⟩, he⟩ + exact hb q hq ht he + have hy₁ : y ∉ f₁ '' closure (U 1) := by + rintro ⟨x, hx, he⟩ + by_cases hxU : x ∈ U 1 + · exact hno' x hxU he + · have hxf : x ∈ frontier (U 1) := ⟨hx, by simpa only [(hU 1).interior_eq] using hxU⟩ + exact hb _ (hfront 1 hxf) (by simp) he + let M := N \ (K ∪ f₁ '' closure (U 1)) + have hM : IsOpen M := hN.sdiff (hK.isClosed.union (hc₁.image hf₁).isClosed) + have hyM : y ∈ M := ⟨hyN, fun h => h.elim hyK hy₁⟩ + obtain ⟨ρ, hρ, _, hρM, hunit⟩ := exists_normalized_smooth_bump volume y M hM hyM + have hρN : Function.support ρ ⊆ N := fun z hz => (hρM (subset_tsupport ρ hz)).1 + have hval : jacobianIntegral volume f₀ (U 0) ρ = + ∑ x ∈ s, (if 0 < (fderiv ℝ f₀ x).det then 1 else -1) := + hsign ρ hρ.continuous hρN hunit + have hcollar : ∀ q ∈ frontier C, q 0 ∈ Icc (0 : ℝ) 1 → F q ∉ tsupport ρ := by + intro q hq ht hsup + exact (hρM hsup).2 (Or.inl ⟨q, ⟨hq, ht⟩, rfl⟩) + have hinv := jacobian_integral_moving_interval ρ (hρ.differentiable (by simp)) F hF C hC hcollar hCb + have hzero : jacobianIntegral volume f₁ (U 1) ρ = 0 := by + apply jacobianIntegral_eq_zero_of_no_preimage + intro x hx + apply image_eq_zero_of_notMem_tsupport + intro hsup + exact (hρM hsup).2 (Or.inr ⟨x, subset_closure hx, rfl⟩) + apply hcount + exact hval.symm.trans (hinv.symm.trans hzero) + +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +/-- Coordinate-free moving-domain nonzero-count persistence. -/ +theorem regular_count_persists_moving_finiteDimensional + (F : ℝ × E → E) (hF : ContDiff ℝ 2 F) (y : E) + (C : Set (ℝ × E)) (hC : IsOpen C) + (hc₀ : IsCompact (closure {x | (0, x) ∈ C})) + (hc₁ : IsCompact (closure {x | (1, x) ∈ C})) + (hcB : IsCompact {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1}) + (hCb : Bornology.IsBounded {x : E | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C}) + (hb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → F q ≠ y) + (s : Finset E) (hs : ∀ x, x ∈ s ↔ (0, x) ∈ C ∧ F (0, x) = y) + (hd : ∀ x ∈ s, (fderiv ℝ (fun z => F (0, z)) x).det ≠ 0) + (hcount : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => F (0, z)) x).det + then 1 else -1 : ℝ)) ≠ 0) : ∃ x, (1, x) ∈ C ∧ F (1, x) = y := by + classical + let n := Module.finrank ℝ E + let e : E ≃L[ℝ] (Fin n → ℝ) := (Module.finBasis ℝ E).equivFunL + let H : (ℝ × E) ≃L[ℝ] (Fin (n + 1) → ℝ) := + ((ContinuousLinearEquiv.refl ℝ ℝ).prodCongr e).trans (Fin.consEquivL ℝ (fun _ => ℝ)) + let G : (Fin (n + 1) → ℝ) → (Fin n → ℝ) := fun q => e (F (H.symm q)) + let D := H.symm ⁻¹' C + have hH (t : ℝ) (x : E) : H (t, x) = Fin.cons t (e x) := rfl + have hHi (t : ℝ) (x : Fin n → ℝ) : H.symm (Fin.cons t x) = (t, e.symm x) := by + apply H.injective + rw [H.apply_symm_apply, hH, e.apply_symm_apply] + have hG : ContDiff ℝ 2 G := e.contDiff.comp (hF.comp H.symm.contDiff) + have hdet (x : E) : + (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e x)).det = + (fderiv ℝ (fun z => F (0, z)) x).det := by + have h₀ : DifferentiableAt ℝ (fun z => F (0, z)) x := + (hF.comp (contDiff_const.prodMk contDiff_id)).differentiable (by norm_num) x + have h₀' : HasFDerivAt (fun z => F (0, z)) + (fderiv ℝ (fun z => F (0, z)) x) (e.symm (e x)) := by + simpa only [ContinuousLinearEquiv.symm_apply_apply] using h₀.hasFDerivAt + have hcomp := e.hasFDerivAt.comp (e x) (h₀'.comp (e x) e.symm.hasFDerivAt) + have hh : (fun z => G (Fin.cons 0 z)) = e ∘ (fun z => F (0, z)) ∘ e.symm := by + funext z; simp only [G, hHi, Function.comp_def] + rw [hh, hcomp.fderiv] + exact LinearMap.det_conj _ e.toLinearEquiv + have hslice (t : ℝ) : {x : Fin n → ℝ | Fin.cons t x ∈ D} = e '' {x | (t, x) ∈ C} := by + ext x + change H.symm (Fin.cons t x) ∈ C ↔ _ + rw [hHi] + constructor + · intro hx; exact ⟨e.symm x, hx, e.apply_symm_apply x⟩ + · rintro ⟨z, hz, rfl⟩; simpa only [ContinuousLinearEquiv.symm_apply_apply, mem_ofPred_eq] using hz + have hcompact (t : ℝ) (ht : IsCompact (closure {x : E | (t, x) ∈ C})) : + IsCompact (closure {x : Fin n → ℝ | Fin.cons t x ∈ D}) := by + rw [hslice, ← show (e : E → (Fin n → ℝ)) '' closure {x | (t, x) ∈ C} = closure (e '' {x | (t, x) ∈ C}) from e.toHomeomorph.image_closure _] + exact ht.image e.continuous + have hfront : frontier D = H.symm ⁻¹' frontier C := by + exact (H.symm.toHomeomorph.preimage_frontier C).symm + have hboundary : {q : Fin (n + 1) → ℝ | q ∈ frontier D ∧ q 0 ∈ Icc (0 : ℝ) 1} = + H '' {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1} := by + ext q + rw [hfront] + constructor + · rintro ⟨hq, ht⟩ + refine ⟨H.symm q, ⟨hq, ?_⟩, H.apply_symm_apply q⟩ + exact ht + · rintro ⟨z, ⟨hz, ht⟩, rfl⟩ + refine ⟨?_, ?_⟩ + · simpa only [mem_preimage, ContinuousLinearEquiv.symm_apply_apply] using hz + · exact ht + have hbounded : {x : Fin n → ℝ | ∃ t ∈ Icc (0 : ℝ) 1, Fin.cons t x ∈ D} = + e '' {x : E | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C} := by + ext x + constructor + · rintro ⟨t, ht, hx⟩ + have hx' : x ∈ e '' {z | (t, z) ∈ C} := by rw [← hslice]; exact hx + obtain ⟨z, hz, rfl⟩ := hx' + exact ⟨z, ⟨t, ht, hz⟩, rfl⟩ + · rintro ⟨z, ⟨t, ht, hz⟩, rfl⟩ + exact ⟨t, ht, by change e z ∈ {x | Fin.cons t x ∈ D}; rw [hslice]; exact ⟨z, hz, rfl⟩⟩ + let s' := s.map e.toEquiv.toEmbedding + have hs' : ∀ x, x ∈ s' ↔ Fin.cons 0 x ∈ D ∧ G (Fin.cons 0 x) = e y := by + intro x + constructor + · intro hx + obtain ⟨z, hz, rfl⟩ := Finset.mem_map.mp hx + change H.symm (Fin.cons 0 (e z)) ∈ C ∧ e (F (H.symm (Fin.cons 0 (e z)))) = e y + rw [hHi, e.symm_apply_apply] + exact ⟨((hs z).mp hz).1, congrArg e ((hs z).mp hz).2⟩ + · rintro ⟨hx, he⟩ + refine Finset.mem_map.mpr ⟨e.symm x, (hs _).mpr ⟨?_, ?_⟩, e.apply_symm_apply x⟩ + · simpa only [D, mem_preimage, hHi] using hx + · apply e.injective; simpa only [G, hHi] using he + have hd' : ∀ x ∈ s', (fderiv ℝ (fun z => G (Fin.cons 0 z)) x).det ≠ 0 := by + intro x hx + obtain ⟨z, hz, rfl⟩ := Finset.mem_map.mp hx + change (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e z)).det ≠ 0 + rw [hdet]; exact hd z hz + have hcount' : (∑ x ∈ s', (if 0 < (fderiv ℝ (fun z => G (Fin.cons 0 z)) x).det + then 1 else -1 : ℝ)) ≠ 0 := by + change (∑ x ∈ s.map e.toEquiv.toEmbedding, _) ≠ 0 + rw [Finset.sum_map] + change (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => G (Fin.cons 0 z)) (e x)).det then 1 else -1 : ℝ)) ≠ 0 + simpa only [hdet] using hcount + obtain ⟨x, hx, he⟩ := regular_count_persists_moving G hG (e y) D + (hC.preimage H.symm.continuous) (hcompact 0 hc₀) (hcompact 1 hc₁) + (by rw [hboundary]; exact hcB.image H.continuous) + (by rw [hbounded]; exact e.lipschitzWith.isBounded_image hCb) + (by + intro q hq ht heq + apply hb (H.symm q) (by rw [hfront] at hq; exact hq) ht + exact e.injective heq) s' hs' hd' hcount' + exact ⟨e.symm x, by simpa only [D, mem_preimage, hHi] using hx, + e.injective (by simpa only [G, hHi] using he)⟩ +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +/-- Arbitrarily small regular approximations at the initial slice suffice for +moving-domain continuation. Uniform closeness is requested on the spatial +projection of the boundary slab, not on an assumed fixed isolating domain. -/ +theorem regular_approximation_persists_moving + (F : ℝ × E → E) (hF : ContDiff ℝ 2 F) + (C : Set (ℝ × E)) (hC : IsOpen C) + (hc₀ : IsCompact (closure {x | (0, x) ∈ C})) + (hc₁ : IsCompact (closure {x | (1, x) ∈ C})) + (hcB : IsCompact {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1}) + (hCb : Bornology.IsBounded {x : E | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C}) + (hb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → F q ≠ 0) + (L : Set E) (hLB : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → q.2 ∈ L) + (happrox : ∀ ε : ℝ, 0 < ε → ∃ g : E → E, ContDiff ℝ ∞ g ∧ + (∀ x ∈ L, ‖g x - F (0, x)‖ < ε) ∧ + ∃ s : Finset E, (∀ x, x ∈ s ↔ x ∈ closure {z | (0, z) ∈ C} ∧ g x = 0) ∧ + (∀ x ∈ s, (fderiv ℝ g x).det ≠ 0) ∧ + (∑ x ∈ s, (if 0 < (fderiv ℝ g x).det then 1 else -1 : ℝ)) ≠ 0) : + ∃ x, (1, x) ∈ C ∧ F (1, x) = 0 := by + classical + let P := {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1} + have hz : (0 : E) ∈ (F '' P)ᶜ := by + rintro ⟨q, ⟨hq, ht⟩, he⟩ + exact hb q hq ht he + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp (hcB.image hF.continuous).isClosed.isOpen_compl 0 hz + have hbound : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → ε ≤ ‖F q‖ := by + intro q hq ht + by_contra hn + have hmem : F q ∈ Metric.ball (0 : E) ε := by + simpa only [Metric.mem_ball, dist_zero_right] using lt_of_not_ge hn + exact hball hmem ⟨q, ⟨hq, ht⟩, rfl⟩ + obtain ⟨g, hg, hclose, s, hs, hd, hcount⟩ := happrox ε hε + let G : ℝ × E → E := fun q => F q + (1 - q.1) • (g q.2 - F (0, q.2)) + have hG : ContDiff ℝ 2 G := hF.add + ((contDiff_const.sub contDiff_fst).smul (((contDiff_infty.mp hg 2).comp contDiff_snd).sub + (hF.comp (contDiff_const.prodMk contDiff_snd)))) + have hG0 : (fun x => G (0, x)) = g := by funext x; simp [G] + have hG1 : (fun x => G (1, x)) = fun x => F (1, x) := by funext x; simp [G] + have hGb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → G q ≠ 0 := by + intro q hq ht he + have heq : F q = -((1 - q.1) • (g q.2 - F (0, q.2))) := eq_neg_of_add_eq_zero_left he + have hn : ‖F q‖ < ε := by + rw [heq, norm_neg, norm_smul, Real.norm_eq_abs, abs_of_nonneg (by linarith [ht.2])] + calc + (1 - q.1) * ‖g q.2 - F (0, q.2)‖ ≤ ‖g q.2 - F (0, q.2)‖ := + mul_le_of_le_one_left (norm_nonneg _) (by linarith [ht.1]) + _ < ε := hclose q.2 (hLB q hq ht) + exact (not_lt_of_ge (hbound q hq ht)) hn + have hU : IsOpen {x : E | (0, x) ∈ C} := hC.preimage (continuous_const.prodMk continuous_id) + have hfront : frontier {x : E | (0, x) ∈ C} ⊆ (fun x : E => ((0 : ℝ), x)) ⁻¹' frontier C := + (continuous_const.prodMk continuous_id).frontier_preimage_subset C + have hsU : ∀ x, x ∈ s ↔ (0, x) ∈ C ∧ G (0, x) = 0 := by + intro x + rw [hs, show G (0, x) = g x from congrFun hG0 x] + constructor + · rintro ⟨hx, he⟩ + refine ⟨?_, he⟩ + by_contra hn + have hxf : x ∈ frontier {z : E | (0, z) ∈ C} := + ⟨hx, by simpa only [hU.interior_eq, mem_ofPred_eq] using hn⟩ + exact hGb (0, x) (hfront hxf) (by simp) + (by rw [show G (0, x) = g x from congrFun hG0 x]; exact he) + · rintro ⟨hx, he⟩; exact ⟨subset_closure hx, he⟩ + have hd' : ∀ x ∈ s, (fderiv ℝ (fun z => G (0, z)) x).det ≠ 0 := by rw [hG0]; exact hd + have hcount' : (∑ x ∈ s, (if 0 < (fderiv ℝ (fun z => G (0, z)) x).det then 1 else -1 : ℝ)) ≠ 0 := by + rw [hG0]; exact hcount + obtain ⟨x, hx, he⟩ := regular_count_persists_moving_finiteDimensional G hG 0 C hC hc₀ hc₁ hcB hCb hGb s hsU hd' hcount' + exact ⟨x, hx, by simpa only [show G (1, x) = F (1, x) from congrFun hG1 x] using he⟩ + +/-- Full localized word-root persistence for moving open sets. Contains the +singular pure-word initial maps used in the manuscript's finite-quotient step. -/ +theorem localized_word_root_persists_moving {m : ℕ} + (w : Fin m → FreeGroup (Fin m)) (hB : (exponentMatrix w).det ≠ 0) + (F : ℝ × ((Fin m → ℂ) × (Fin m → ℂ)) → ((Fin m → ℂ) × (Fin m → ℂ))) + (hF : ContDiff ℝ 2 F) (hF0 : ∀ q, F (0, q) = splitWordMap w q) + (C : Set (ℝ × ((Fin m → ℂ) × (Fin m → ℂ)))) (hC : IsOpen C) + (hc₀ : IsCompact (closure {x | (0, x) ∈ C})) + (hc₁ : IsCompact (closure {x | (1, x) ∈ C})) + (hcB : IsCompact {q | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1}) + (hCb : Bornology.IsBounded {x | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C}) + (hUi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q ∈ closure {x | (0, x) ∈ C}, + (q.1, z • q.2) ∈ closure {x | (0, x) ∈ C}) + (h1 : (0, (1, 0)) ∈ C) + (hb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → F q ≠ 0) : + ∃ x, (1, x) ∈ C ∧ F (1, x) = 0 := by + let K := closure {x | (0, x) ∈ C} + let L := K ∪ Prod.snd '' {q | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1} + have hL : IsCompact L := hc₀.union (hcB.image continuous_snd) + apply regular_approximation_persists_moving F hF C hC hc₀ hc₁ hcB hCb hb L + (fun q hq ht => Or.inr ⟨q, ⟨hq, ht⟩, rfl⟩) + intro ε hε + simpa only [hF0] using word_exists_regularization_nonzero_count w hB + K hc₀ hUi (subset_closure h1) L hL subset_union_left ε hε +end EilenbergGanea + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/IntegralModules.lean b/lean/OAI/Topology/EilenbergGanea/IntegralModules.lean index 746e9ab98cbbc638570035f4eeb531ddccede40e..75ee8e4a9d9c7436d39bdf559eeb569718aeb4af 100644 --- a/lean/OAI/Topology/EilenbergGanea/IntegralModules.lean +++ b/lean/OAI/Topology/EilenbergGanea/IntegralModules.lean @@ -1,308 +1,308 @@ -import OAI.Topology.EilenbergGanea.Model -import OAI.Topology.EilenbergGanea.PresentationAlignment -import Mathlib.Algebra.Category.ModuleCat.ProjectiveDimension -import Mathlib.RingTheory.Noetherian.Basic - -namespace OAI - -noncomputable section - -open Classical Set - -/-! Group-ring augmentation and literal two-syzygy dimension criterion. -/ -namespace EilenbergGanea -open CategoryTheory - -section ProjectiveBound -variable {R P Q M : Type} [Ring R] - [AddCommGroup P] [Module R P] [AddCommGroup Q] [Module R Q] - [AddCommGroup M] [Module R M] - -/-- Two successive projective syzygies give the literal integral upper bound. -/ -theorem projectiveDimension_le_two_of_syzygies - (ε : P →ₗ[R] M) (hε : Function.Surjective ε) - (d : Q →ₗ[R] LinearMap.ker ε) (hd : Function.Surjective d) - [Module.Projective R P] [Module.Projective R Q] - [Module.Projective R (LinearMap.ker d)] : - CategoryTheory.projectiveDimension (ModuleCat.of R M) ≤ 2 := by - have h₁ := (LinearMap.shortExact_shortComplexKer hd).hasProjectiveDimensionLT_X₃ 1 - (inferInstance : HasProjectiveDimensionLT (ModuleCat.of R (LinearMap.ker d)) 1) - (inferInstance : HasProjectiveDimensionLT (ModuleCat.of R Q) 2) - have h₂ := (LinearMap.shortExact_shortComplexKer hε).hasProjectiveDimensionLT_X₃ 2 - h₁ (inferInstance : HasProjectiveDimensionLT (ModuleCat.of R P) 3) - exact (CategoryTheory.projectiveDimension_le_iff _ 2).mpr h₂ -end ProjectiveBound - -section CayleyModules -variable {Γ S : Type} [Group Γ] - -abbrev IntegralGroupRing (Γ : Type) [Group Γ] := MonoidAlgebra ℤ Γ -abbrev IntegralTrivialModule (Γ : Type) [Group Γ] := - (Representation.trivial ℤ Γ ℤ).asModule - -def cayleyAugmentation : IntegralGroupRing Γ →ₗ[IntegralGroupRing Γ] IntegralTrivialModule Γ := - LinearMap.toSpanSingleton (IntegralGroupRing Γ) _ - ((Representation.trivial ℤ Γ ℤ).asModuleEquiv.symm 1) - -@[simp] theorem cayleyAugmentation_single (g : Γ) (n : ℤ) : - cayleyAugmentation (MonoidAlgebra.single g n) = - (Representation.trivial ℤ Γ ℤ).asModuleEquiv.symm n := by - change (MonoidAlgebra.single g n : IntegralGroupRing Γ) • - ((Representation.trivial ℤ Γ ℤ).asModuleEquiv.symm 1) = _ - rw [Representation.single_smul] - change (n : ℤ) * 1 = n - exact mul_one n - -theorem cayleyAugmentation_surjective : - Function.Surjective (cayleyAugmentation (Γ := Γ)) := by - intro n - refine ⟨MonoidAlgebra.single (1 : Γ) ((Representation.trivial ℤ Γ ℤ).asModuleEquiv n),?_⟩ - rw [cayleyAugmentation_single,LinearEquiv.symm_apply_apply] - -def cayleyDifferential (v : S → Γ) : - (S →₀ IntegralGroupRing Γ) →ₗ[IntegralGroupRing Γ] IntegralGroupRing Γ := - Finsupp.linearCombination _ (fun s => MonoidAlgebra.single (v s) 1 - 1) - -@[simp] theorem cayleyDifferential_single (v : S → Γ) (s : S) (r : IntegralGroupRing Γ) : - cayleyDifferential v (Finsupp.single s r) = r * (MonoidAlgebra.single (v s) 1 - 1) := by - simp [cayleyDifferential] - -@[simp] theorem cayleyAugmentation_one : - cayleyAugmentation (1 : IntegralGroupRing Γ) = - (Representation.trivial ℤ Γ ℤ).asModuleEquiv.symm 1 := - cayleyAugmentation_single (1 : Γ) 1 - -@[simp] theorem cayleyAugmentation_difference (g : Γ) : - cayleyAugmentation (MonoidAlgebra.single g 1 - 1) = 0 := by - rw [map_sub, cayleyAugmentation_single, cayleyAugmentation_one, sub_self] - -theorem cayleyDifferential_aug (v : S → Γ) : - (cayleyAugmentation (Γ := Γ)).comp (cayleyDifferential v) = 0 := by - change (cayleyAugmentation (Γ := Γ)).comp - (Finsupp.linearCombination _ (fun s => MonoidAlgebra.single (v s) 1 - 1)) = 0 - rw [← Finsupp.linearCombination_linear_comp] - have he : (cayleyAugmentation (Γ := Γ)) ∘ - (fun s => MonoidAlgebra.single (v s) 1 - 1) = (0 : S → IntegralTrivialModule Γ) := by - funext s - exact cayleyAugmentation_difference (v s) - rw [he, Finsupp.linearCombination_zero] - - theorem cayleyGeneratorDifference_mem (v : S → Γ) (w : FreeGroup S) : - MonoidAlgebra.single (FreeGroup.lift v w) 1 - 1 ∈ LinearMap.range (cayleyDifferential v) := by - induction w using FreeGroup.induction_on with - | one => - simp only [map_one] - have he : (MonoidAlgebra.single (1 : Γ) 1 : IntegralGroupRing Γ) = 1 := rfl - rw [he,sub_self] - exact Submodule.zero_mem _ - | of s => - exact ⟨Finsupp.single s 1,by simp⟩ - | inv_of s => - refine ⟨Finsupp.single s (-MonoidAlgebra.single (v s)⁻¹ 1),?_⟩ - simp [mul_sub,MonoidAlgebra.single_mul_single] - rfl - | mul w z hw hz => - have hh := (LinearMap.range (cayleyDifferential v)).smul_mem - (MonoidAlgebra.single (FreeGroup.lift v w) 1) hz - have hc := (LinearMap.range (cayleyDifferential v)).add_mem hw hh - rw [map_mul] - convert hc using 1 - change _ = (_ - 1) + _ * (_ - 1) - rw [mul_sub,mul_one,MonoidAlgebra.single_mul_single,one_mul] - abel - -theorem cayleyAugmentation_normalize (v : S → Γ) - (hv : Function.Surjective (FreeGroup.lift v)) (r : IntegralGroupRing Γ) : - r - MonoidAlgebra.single 1 - ((Representation.trivial ℤ Γ ℤ).asModuleEquiv (cayleyAugmentation r)) ∈ - LinearMap.range (cayleyDifferential v) := by - classical - induction r using MonoidAlgebra.induction_linear with - | zero => simp - | add r t hr ht => - rw [map_add, map_add, MonoidAlgebra.single_add] - convert (LinearMap.range (cayleyDifferential v)).add_mem hr ht using 1; abel - | single g n => - rw [cayleyAugmentation_single, LinearEquiv.apply_symm_apply] - obtain ⟨w, hw⟩ := hv g - have hm := (LinearMap.range (cayleyDifferential v)).toAddSubgroup.zsmul_mem - (cayleyGeneratorDifference_mem v w) n - rw [hw] at hm - convert hm using 1 - simp only [smul_sub, MonoidAlgebra.smul_single, zsmul_eq_mul, mul_one] - rfl - -theorem cayley_exact (v : S → Γ) (hv : Function.Surjective (FreeGroup.lift v)) : - LinearMap.range (cayleyDifferential v) = LinearMap.ker (cayleyAugmentation (Γ := Γ)) := by - apply le_antisymm - · rintro _ ⟨r,rfl⟩ - exact LinearMap.congr_fun (cayleyDifferential_aug v) r - · intro r hr - have hm := cayleyAugmentation_normalize v hv r - rw [LinearMap.mem_ker.mp hr, map_zero, MonoidAlgebra.single_zero, sub_zero] at hm - exact hm - -def cayleySyzygyDifferential (v : S → Γ) : - (S →₀ IntegralGroupRing Γ) →ₗ[IntegralGroupRing Γ] - LinearMap.ker (cayleyAugmentation (Γ := Γ)) := - (cayleyDifferential v).codRestrict _ (by - intro r - exact LinearMap.congr_fun (cayleyDifferential_aug v) r) - -theorem cayleySyzygyDifferential_surjective (v : S → Γ) - (hv : Function.Surjective (FreeGroup.lift v)) : - Function.Surjective (cayleySyzygyDifferential v) := by - intro r - have hr : (r : IntegralGroupRing Γ) ∈ LinearMap.range (cayleyDifferential v) := by - rw [cayley_exact v hv] - exact r.property - obtain ⟨s, hs⟩ := hr - exact ⟨s, Subtype.ext hs⟩ - -theorem cayley_projectiveDimension_le_two (v : S → Γ) - (hv : Function.Surjective (FreeGroup.lift v)) - [Module.Projective (IntegralGroupRing Γ) (LinearMap.ker (cayleyDifferential v))] : - CategoryTheory.projectiveDimension - (ModuleCat.of (IntegralGroupRing Γ) (IntegralTrivialModule Γ)) ≤ 2 := by - have hk : LinearMap.ker (cayleySyzygyDifferential v) = - LinearMap.ker (cayleyDifferential v) := LinearMap.ker_codRestrict _ _ _ - have : Module.Projective (IntegralGroupRing Γ) - (LinearMap.ker (cayleySyzygyDifferential v)) := hk ▸ inferInstance - exact projectiveDimension_le_two_of_syzygies cayleyAugmentation - cayleyAugmentation_surjective (cayleySyzygyDifferential v) - (cayleySyzygyDifferential_surjective v hv) - -end CayleyModules -end EilenbergGanea - -namespace EilenbergGanea -section ChainPackaging -variable {Γ S T : Type} [Group Γ] - -/-- Reindex the actual integral edge chains as a free left group-ring module. -/ -def chainPackaging : BasedChains Γ S ≃ₗ[ℤ] S →₀ IntegralGroupRing Γ := - ((Finsupp.domLCongr (Equiv.prodComm Γ S)).trans (Finsupp.curryLinearEquiv ℤ)).trans - (Finsupp.mapRange.linearEquiv (MonoidAlgebra.coeffLinearEquiv ℤ).symm) - -@[simp] theorem chainPackaging_single (g : Γ) (s : S) (n : ℤ) : - chainPackaging (Finsupp.single (g,s) n) = - Finsupp.single s (MonoidAlgebra.single g n) := by - simp [chainPackaging, Finsupp.curry_single] - -@[simp] theorem chainPackaging_symm_single (g : Γ) (s : S) (n : ℤ) : - (chainPackaging (Γ := Γ) (S := S)).symm - (Finsupp.single s (MonoidAlgebra.single g n)) = Finsupp.single (g,s) n := by - apply (chainPackaging (Γ := Γ) (S := S)).injective - simp - -theorem chainPackaging_translate (g : Γ) (c : BasedChains Γ S) : - chainPackaging (translateChains g c) = - (MonoidAlgebra.single g 1 : IntegralGroupRing Γ) • chainPackaging c := by - have he : (chainPackaging (Γ := Γ) (S := S)).toLinearMap.comp (translateChains g) = - (DistribSMul.toLinearMap ℤ (S →₀ IntegralGroupRing Γ) (MonoidAlgebra.single g 1 : IntegralGroupRing Γ)).comp - (chainPackaging (Γ := Γ) (S := S)).toLinearMap := by - apply Finsupp.lhom_ext - rintro ⟨h,s⟩ n - simp [Finsupp.smul_single, MonoidAlgebra.single_mul_single] - exact LinearMap.congr_fun he c - -theorem chainPackaging_boundary (v : S → Γ) (c : BasedChains Γ S) : - cayleyDifferential v (chainPackaging c) = MonoidAlgebra.ofCoeff (edgeBoundary v c) := by - have he : ((cayleyDifferential v).restrictScalars ℤ).comp - (chainPackaging (Γ := Γ) (S := S)).toLinearMap = - (MonoidAlgebra.coeffLinearEquiv ℤ).symm.toLinearMap.comp (edgeBoundary v) := by - apply Finsupp.lhom_ext - rintro ⟨g,s⟩ n - simp only [LinearMap.comp_apply, LinearMap.coe_restrictScalars, LinearEquiv.coe_coe, - chainPackaging_single, cayleyDifferential_single, edgeBoundary_single, map_smul, - map_sub] - simp only [mul_sub, MonoidAlgebra.single_mul_single, mul_one, - MonoidAlgebra.coeffLinearEquiv_symm_apply, MonoidAlgebra.ofCoeff_single, - MonoidAlgebra.smul_single, smul_sub, smul_eq_mul] - exact LinearMap.congr_fun he c - -theorem chainPackaging_symm_translate (g : Γ) (c : S →₀ IntegralGroupRing Γ) : - (chainPackaging (Γ := Γ) (S := S)).symm ((MonoidAlgebra.single g 1 : IntegralGroupRing Γ) • c) = - translateChains g (chainPackaging.symm c) := by - apply (chainPackaging (Γ := Γ) (S := S)).injective - rw [chainPackaging_translate, LinearEquiv.apply_symm_apply, LinearEquiv.apply_symm_apply] - -/-- Equivariance on integral chains is exactly full group-ring linearity. -/ -def chainRingMap (A : BasedChains Γ S →ₗ[ℤ] BasedChains Γ T) - (hA : ChainsEquivariant A) : - (S →₀ IntegralGroupRing Γ) →ₗ[IntegralGroupRing Γ] T →₀ IntegralGroupRing Γ where - toFun c := chainPackaging (A (chainPackaging.symm c)) - map_add' _ _ := by simp only [map_add] - map_smul' r c := by - induction r using MonoidAlgebra.induction_linear with - | zero => simp only [zero_smul, map_zero] - | add r t hr ht => simp only [add_smul, map_add, hr, ht] - | single g n => - have hn : (MonoidAlgebra.single g n : IntegralGroupRing Γ) = - n • MonoidAlgebra.single g 1 := by simp - rw [hn] - simp only [smul_assoc, map_smul, chainPackaging_symm_translate, RingHom.id_apply] - rw [hA g _, chainPackaging_translate] - -@[simp] theorem chainRingMap_apply (A : BasedChains Γ S →ₗ[ℤ] BasedChains Γ T) - (hA : ChainsEquivariant A) (c : S →₀ IntegralGroupRing Γ) : - chainRingMap A hA c = chainPackaging (A (chainPackaging.symm c)) := rfl - -theorem chainPackaging_mem_cycles (v : S → Γ) (c : BasedChains Γ S) : - c ∈ cycles v ↔ chainPackaging c ∈ LinearMap.ker (cayleyDifferential v) := by - change edgeBoundary v c = 0 ↔ cayleyDifferential v (chainPackaging c) = 0 - rw [chainPackaging_boundary] - constructor - · intro h - rw [h] - rfl - · intro h - have hh := congrArg MonoidAlgebra.coeff h - exact hh - -theorem projective_cayley_cycles_of_boundary_basis (v : S → Γ) - (A : BasedChains Γ T →ₗ[ℤ] BasedChains Γ S) (hA : ChainsEquivariant A) - (hAi : Function.Injective A) (hAr : LinearMap.range A = cycles v) : - Module.Projective (IntegralGroupRing Γ) (LinearMap.ker (cayleyDifferential v)) := by - have hm : ∀ c, chainRingMap A hA c ∈ LinearMap.ker (cayleyDifferential v) := by - intro c - apply (chainPackaging_mem_cycles v _).mp - rw [← hAr] - exact ⟨chainPackaging.symm c,rfl⟩ - let d := (chainRingMap A hA).codRestrict _ hm - have hi : Function.Injective d := by - intro c c' h - apply (chainPackaging (Γ := Γ) (S := T)).symm.injective - apply hAi - apply chainPackaging.injective - exact congrArg Subtype.val h - have hs : Function.Surjective d := by - intro c - have hc : chainPackaging.symm (c : S →₀ IntegralGroupRing Γ) ∈ cycles v := by - apply (chainPackaging_mem_cycles v _).mpr - rw [LinearEquiv.apply_symm_apply] - exact c.property - rw [← hAr] at hc - obtain ⟨b,hb⟩ := hc - refine ⟨chainPackaging b,Subtype.ext ?_⟩ - change chainPackaging (A (chainPackaging.symm (chainPackaging b))) = c.val - rw [LinearEquiv.symm_apply_apply,hb,LinearEquiv.apply_symm_apply] - exact Module.Projective.of_equiv' (LinearEquiv.ofBijective d ⟨hi,hs⟩) - -theorem projectiveDimension_le_two_of_boundary_basis (v : S → Γ) - (hv : Function.Surjective (FreeGroup.lift v)) - (A : BasedChains Γ T →ₗ[ℤ] BasedChains Γ S) (hA : ChainsEquivariant A) - (hAi : Function.Injective A) (hAr : LinearMap.range A = cycles v) : - CategoryTheory.projectiveDimension - (ModuleCat.of (IntegralGroupRing Γ) (IntegralTrivialModule Γ)) ≤ 2 := by - have := projective_cayley_cycles_of_boundary_basis v A hA hAi hAr - exact cayley_projectiveDimension_le_two v hv - -end ChainPackaging - - -end EilenbergGanea - -end - -end OAI +import OAI.Topology.EilenbergGanea.Model +import OAI.Topology.EilenbergGanea.PresentationAlignment +import Mathlib.Algebra.Category.ModuleCat.ProjectiveDimension +import Mathlib.RingTheory.Noetherian.Basic + +namespace OAI + +noncomputable section + +open Classical Set + +/-! Group-ring augmentation and literal two-syzygy dimension criterion. -/ +namespace EilenbergGanea +open CategoryTheory + +section ProjectiveBound +variable {R P Q M : Type} [Ring R] + [AddCommGroup P] [Module R P] [AddCommGroup Q] [Module R Q] + [AddCommGroup M] [Module R M] + +/-- Two successive projective syzygies give the literal integral upper bound. -/ +theorem projectiveDimension_le_two_of_syzygies + (ε : P →ₗ[R] M) (hε : Function.Surjective ε) + (d : Q →ₗ[R] LinearMap.ker ε) (hd : Function.Surjective d) + [Module.Projective R P] [Module.Projective R Q] + [Module.Projective R (LinearMap.ker d)] : + CategoryTheory.projectiveDimension (ModuleCat.of R M) ≤ 2 := by + have h₁ := (LinearMap.shortExact_shortComplexKer hd).hasProjectiveDimensionLT_X₃ 1 + (inferInstance : HasProjectiveDimensionLT (ModuleCat.of R (LinearMap.ker d)) 1) + (inferInstance : HasProjectiveDimensionLT (ModuleCat.of R Q) 2) + have h₂ := (LinearMap.shortExact_shortComplexKer hε).hasProjectiveDimensionLT_X₃ 2 + h₁ (inferInstance : HasProjectiveDimensionLT (ModuleCat.of R P) 3) + exact (CategoryTheory.projectiveDimension_le_iff _ 2).mpr h₂ +end ProjectiveBound + +section CayleyModules +variable {Γ S : Type} [Group Γ] + +abbrev IntegralGroupRing (Γ : Type) [Group Γ] := MonoidAlgebra ℤ Γ +abbrev IntegralTrivialModule (Γ : Type) [Group Γ] := + (Representation.trivial ℤ Γ ℤ).asModule + +def cayleyAugmentation : IntegralGroupRing Γ →ₗ[IntegralGroupRing Γ] IntegralTrivialModule Γ := + LinearMap.toSpanSingleton (IntegralGroupRing Γ) _ + ((Representation.trivial ℤ Γ ℤ).asModuleEquiv.symm 1) + +@[simp] theorem cayleyAugmentation_single (g : Γ) (n : ℤ) : + cayleyAugmentation (MonoidAlgebra.single g n) = + (Representation.trivial ℤ Γ ℤ).asModuleEquiv.symm n := by + change (MonoidAlgebra.single g n : IntegralGroupRing Γ) • + ((Representation.trivial ℤ Γ ℤ).asModuleEquiv.symm 1) = _ + rw [Representation.single_smul] + change (n : ℤ) * 1 = n + exact mul_one n + +theorem cayleyAugmentation_surjective : + Function.Surjective (cayleyAugmentation (Γ := Γ)) := by + intro n + refine ⟨MonoidAlgebra.single (1 : Γ) ((Representation.trivial ℤ Γ ℤ).asModuleEquiv n),?_⟩ + rw [cayleyAugmentation_single,LinearEquiv.symm_apply_apply] + +def cayleyDifferential (v : S → Γ) : + (S →₀ IntegralGroupRing Γ) →ₗ[IntegralGroupRing Γ] IntegralGroupRing Γ := + Finsupp.linearCombination _ (fun s => MonoidAlgebra.single (v s) 1 - 1) + +@[simp] theorem cayleyDifferential_single (v : S → Γ) (s : S) (r : IntegralGroupRing Γ) : + cayleyDifferential v (Finsupp.single s r) = r * (MonoidAlgebra.single (v s) 1 - 1) := by + simp [cayleyDifferential] + +@[simp] theorem cayleyAugmentation_one : + cayleyAugmentation (1 : IntegralGroupRing Γ) = + (Representation.trivial ℤ Γ ℤ).asModuleEquiv.symm 1 := + cayleyAugmentation_single (1 : Γ) 1 + +@[simp] theorem cayleyAugmentation_difference (g : Γ) : + cayleyAugmentation (MonoidAlgebra.single g 1 - 1) = 0 := by + rw [map_sub, cayleyAugmentation_single, cayleyAugmentation_one, sub_self] + +theorem cayleyDifferential_aug (v : S → Γ) : + (cayleyAugmentation (Γ := Γ)).comp (cayleyDifferential v) = 0 := by + change (cayleyAugmentation (Γ := Γ)).comp + (Finsupp.linearCombination _ (fun s => MonoidAlgebra.single (v s) 1 - 1)) = 0 + rw [← Finsupp.linearCombination_linear_comp] + have he : (cayleyAugmentation (Γ := Γ)) ∘ + (fun s => MonoidAlgebra.single (v s) 1 - 1) = (0 : S → IntegralTrivialModule Γ) := by + funext s + exact cayleyAugmentation_difference (v s) + rw [he, Finsupp.linearCombination_zero] + + theorem cayleyGeneratorDifference_mem (v : S → Γ) (w : FreeGroup S) : + MonoidAlgebra.single (FreeGroup.lift v w) 1 - 1 ∈ LinearMap.range (cayleyDifferential v) := by + induction w using FreeGroup.induction_on with + | one => + simp only [map_one] + have he : (MonoidAlgebra.single (1 : Γ) 1 : IntegralGroupRing Γ) = 1 := rfl + rw [he,sub_self] + exact Submodule.zero_mem _ + | of s => + exact ⟨Finsupp.single s 1,by simp⟩ + | inv_of s => + refine ⟨Finsupp.single s (-MonoidAlgebra.single (v s)⁻¹ 1),?_⟩ + simp [mul_sub,MonoidAlgebra.single_mul_single] + rfl + | mul w z hw hz => + have hh := (LinearMap.range (cayleyDifferential v)).smul_mem + (MonoidAlgebra.single (FreeGroup.lift v w) 1) hz + have hc := (LinearMap.range (cayleyDifferential v)).add_mem hw hh + rw [map_mul] + convert hc using 1 + change _ = (_ - 1) + _ * (_ - 1) + rw [mul_sub,mul_one,MonoidAlgebra.single_mul_single,one_mul] + abel + +theorem cayleyAugmentation_normalize (v : S → Γ) + (hv : Function.Surjective (FreeGroup.lift v)) (r : IntegralGroupRing Γ) : + r - MonoidAlgebra.single 1 + ((Representation.trivial ℤ Γ ℤ).asModuleEquiv (cayleyAugmentation r)) ∈ + LinearMap.range (cayleyDifferential v) := by + classical + induction r using MonoidAlgebra.induction_linear with + | zero => simp + | add r t hr ht => + rw [map_add, map_add, MonoidAlgebra.single_add] + convert (LinearMap.range (cayleyDifferential v)).add_mem hr ht using 1; abel + | single g n => + rw [cayleyAugmentation_single, LinearEquiv.apply_symm_apply] + obtain ⟨w, hw⟩ := hv g + have hm := (LinearMap.range (cayleyDifferential v)).toAddSubgroup.zsmul_mem + (cayleyGeneratorDifference_mem v w) n + rw [hw] at hm + convert hm using 1 + simp only [smul_sub, MonoidAlgebra.smul_single, zsmul_eq_mul, mul_one] + rfl + +theorem cayley_exact (v : S → Γ) (hv : Function.Surjective (FreeGroup.lift v)) : + LinearMap.range (cayleyDifferential v) = LinearMap.ker (cayleyAugmentation (Γ := Γ)) := by + apply le_antisymm + · rintro _ ⟨r,rfl⟩ + exact LinearMap.congr_fun (cayleyDifferential_aug v) r + · intro r hr + have hm := cayleyAugmentation_normalize v hv r + rw [LinearMap.mem_ker.mp hr, map_zero, MonoidAlgebra.single_zero, sub_zero] at hm + exact hm + +def cayleySyzygyDifferential (v : S → Γ) : + (S →₀ IntegralGroupRing Γ) →ₗ[IntegralGroupRing Γ] + LinearMap.ker (cayleyAugmentation (Γ := Γ)) := + (cayleyDifferential v).codRestrict _ (by + intro r + exact LinearMap.congr_fun (cayleyDifferential_aug v) r) + +theorem cayleySyzygyDifferential_surjective (v : S → Γ) + (hv : Function.Surjective (FreeGroup.lift v)) : + Function.Surjective (cayleySyzygyDifferential v) := by + intro r + have hr : (r : IntegralGroupRing Γ) ∈ LinearMap.range (cayleyDifferential v) := by + rw [cayley_exact v hv] + exact r.property + obtain ⟨s, hs⟩ := hr + exact ⟨s, Subtype.ext hs⟩ + +theorem cayley_projectiveDimension_le_two (v : S → Γ) + (hv : Function.Surjective (FreeGroup.lift v)) + [Module.Projective (IntegralGroupRing Γ) (LinearMap.ker (cayleyDifferential v))] : + CategoryTheory.projectiveDimension + (ModuleCat.of (IntegralGroupRing Γ) (IntegralTrivialModule Γ)) ≤ 2 := by + have hk : LinearMap.ker (cayleySyzygyDifferential v) = + LinearMap.ker (cayleyDifferential v) := LinearMap.ker_codRestrict _ _ _ + have : Module.Projective (IntegralGroupRing Γ) + (LinearMap.ker (cayleySyzygyDifferential v)) := hk ▸ inferInstance + exact projectiveDimension_le_two_of_syzygies cayleyAugmentation + cayleyAugmentation_surjective (cayleySyzygyDifferential v) + (cayleySyzygyDifferential_surjective v hv) + +end CayleyModules +end EilenbergGanea + +namespace EilenbergGanea +section ChainPackaging +variable {Γ S T : Type} [Group Γ] + +/-- Reindex the actual integral edge chains as a free left group-ring module. -/ +def chainPackaging : BasedChains Γ S ≃ₗ[ℤ] S →₀ IntegralGroupRing Γ := + ((Finsupp.domLCongr (Equiv.prodComm Γ S)).trans (Finsupp.curryLinearEquiv ℤ)).trans + (Finsupp.mapRange.linearEquiv (MonoidAlgebra.coeffLinearEquiv ℤ).symm) + +@[simp] theorem chainPackaging_single (g : Γ) (s : S) (n : ℤ) : + chainPackaging (Finsupp.single (g,s) n) = + Finsupp.single s (MonoidAlgebra.single g n) := by + simp [chainPackaging, Finsupp.curry_single] + +@[simp] theorem chainPackaging_symm_single (g : Γ) (s : S) (n : ℤ) : + (chainPackaging (Γ := Γ) (S := S)).symm + (Finsupp.single s (MonoidAlgebra.single g n)) = Finsupp.single (g,s) n := by + apply (chainPackaging (Γ := Γ) (S := S)).injective + simp + +theorem chainPackaging_translate (g : Γ) (c : BasedChains Γ S) : + chainPackaging (translateChains g c) = + (MonoidAlgebra.single g 1 : IntegralGroupRing Γ) • chainPackaging c := by + have he : (chainPackaging (Γ := Γ) (S := S)).toLinearMap.comp (translateChains g) = + (DistribSMul.toLinearMap ℤ (S →₀ IntegralGroupRing Γ) (MonoidAlgebra.single g 1 : IntegralGroupRing Γ)).comp + (chainPackaging (Γ := Γ) (S := S)).toLinearMap := by + apply Finsupp.lhom_ext + rintro ⟨h,s⟩ n + simp [Finsupp.smul_single, MonoidAlgebra.single_mul_single] + exact LinearMap.congr_fun he c + +theorem chainPackaging_boundary (v : S → Γ) (c : BasedChains Γ S) : + cayleyDifferential v (chainPackaging c) = MonoidAlgebra.ofCoeff (edgeBoundary v c) := by + have he : ((cayleyDifferential v).restrictScalars ℤ).comp + (chainPackaging (Γ := Γ) (S := S)).toLinearMap = + (MonoidAlgebra.coeffLinearEquiv ℤ).symm.toLinearMap.comp (edgeBoundary v) := by + apply Finsupp.lhom_ext + rintro ⟨g,s⟩ n + simp only [LinearMap.comp_apply, LinearMap.coe_restrictScalars, LinearEquiv.coe_coe, + chainPackaging_single, cayleyDifferential_single, edgeBoundary_single, map_smul, + map_sub] + simp only [mul_sub, MonoidAlgebra.single_mul_single, mul_one, + MonoidAlgebra.coeffLinearEquiv_symm_apply, MonoidAlgebra.ofCoeff_single, + MonoidAlgebra.smul_single, smul_sub, smul_eq_mul] + exact LinearMap.congr_fun he c + +theorem chainPackaging_symm_translate (g : Γ) (c : S →₀ IntegralGroupRing Γ) : + (chainPackaging (Γ := Γ) (S := S)).symm ((MonoidAlgebra.single g 1 : IntegralGroupRing Γ) • c) = + translateChains g (chainPackaging.symm c) := by + apply (chainPackaging (Γ := Γ) (S := S)).injective + rw [chainPackaging_translate, LinearEquiv.apply_symm_apply, LinearEquiv.apply_symm_apply] + +/-- Equivariance on integral chains is exactly full group-ring linearity. -/ +def chainRingMap (A : BasedChains Γ S →ₗ[ℤ] BasedChains Γ T) + (hA : ChainsEquivariant A) : + (S →₀ IntegralGroupRing Γ) →ₗ[IntegralGroupRing Γ] T →₀ IntegralGroupRing Γ where + toFun c := chainPackaging (A (chainPackaging.symm c)) + map_add' _ _ := by simp only [map_add] + map_smul' r c := by + induction r using MonoidAlgebra.induction_linear with + | zero => simp only [zero_smul, map_zero] + | add r t hr ht => simp only [add_smul, map_add, hr, ht] + | single g n => + have hn : (MonoidAlgebra.single g n : IntegralGroupRing Γ) = + n • MonoidAlgebra.single g 1 := by simp + rw [hn] + simp only [smul_assoc, map_smul, chainPackaging_symm_translate, RingHom.id_apply] + rw [hA g _, chainPackaging_translate] + +@[simp] theorem chainRingMap_apply (A : BasedChains Γ S →ₗ[ℤ] BasedChains Γ T) + (hA : ChainsEquivariant A) (c : S →₀ IntegralGroupRing Γ) : + chainRingMap A hA c = chainPackaging (A (chainPackaging.symm c)) := rfl + +theorem chainPackaging_mem_cycles (v : S → Γ) (c : BasedChains Γ S) : + c ∈ cycles v ↔ chainPackaging c ∈ LinearMap.ker (cayleyDifferential v) := by + change edgeBoundary v c = 0 ↔ cayleyDifferential v (chainPackaging c) = 0 + rw [chainPackaging_boundary] + constructor + · intro h + rw [h] + rfl + · intro h + have hh := congrArg MonoidAlgebra.coeff h + exact hh + +theorem projective_cayley_cycles_of_boundary_basis (v : S → Γ) + (A : BasedChains Γ T →ₗ[ℤ] BasedChains Γ S) (hA : ChainsEquivariant A) + (hAi : Function.Injective A) (hAr : LinearMap.range A = cycles v) : + Module.Projective (IntegralGroupRing Γ) (LinearMap.ker (cayleyDifferential v)) := by + have hm : ∀ c, chainRingMap A hA c ∈ LinearMap.ker (cayleyDifferential v) := by + intro c + apply (chainPackaging_mem_cycles v _).mp + rw [← hAr] + exact ⟨chainPackaging.symm c,rfl⟩ + let d := (chainRingMap A hA).codRestrict _ hm + have hi : Function.Injective d := by + intro c c' h + apply (chainPackaging (Γ := Γ) (S := T)).symm.injective + apply hAi + apply chainPackaging.injective + exact congrArg Subtype.val h + have hs : Function.Surjective d := by + intro c + have hc : chainPackaging.symm (c : S →₀ IntegralGroupRing Γ) ∈ cycles v := by + apply (chainPackaging_mem_cycles v _).mpr + rw [LinearEquiv.apply_symm_apply] + exact c.property + rw [← hAr] at hc + obtain ⟨b,hb⟩ := hc + refine ⟨chainPackaging b,Subtype.ext ?_⟩ + change chainPackaging (A (chainPackaging.symm (chainPackaging b))) = c.val + rw [LinearEquiv.symm_apply_apply,hb,LinearEquiv.apply_symm_apply] + exact Module.Projective.of_equiv' (LinearEquiv.ofBijective d ⟨hi,hs⟩) + +theorem projectiveDimension_le_two_of_boundary_basis (v : S → Γ) + (hv : Function.Surjective (FreeGroup.lift v)) + (A : BasedChains Γ T →ₗ[ℤ] BasedChains Γ S) (hA : ChainsEquivariant A) + (hAi : Function.Injective A) (hAr : LinearMap.range A = cycles v) : + CategoryTheory.projectiveDimension + (ModuleCat.of (IntegralGroupRing Γ) (IntegralTrivialModule Γ)) ≤ 2 := by + have := projective_cayley_cycles_of_boundary_basis v A hA hAi hAr + exact cayley_projectiveDimension_le_two v hv + +end ChainPackaging + + +end EilenbergGanea + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/LevelBasis.lean b/lean/OAI/Topology/EilenbergGanea/LevelBasis.lean index b79749b9d6bec52de292a044dbe0c4c5721deff8..8670f61f3ede09ace07097dc0914cdbda3a5f478 100644 --- a/lean/OAI/Topology/EilenbergGanea/LevelBasis.lean +++ b/lean/OAI/Topology/EilenbergGanea/LevelBasis.lean @@ -1,968 +1,968 @@ -import OAI.AlgebraicTopology.Cubical.HeightChains -import OAI.Topology.EilenbergGanea.IntegralModules -import OAI.Topology.EilenbergGanea.LevelTransport - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -namespace EilenbergGanea.LevelBasis -open CubicalChains CubicalChains.LevelExact CubicalChains.HeightFiltration -variable {G A : Type} [Group G] [LinearOrder A] -variable (L : SimpleGraph A) (φ : G →* Multiplicative ℤ) (v : A → G) (root : A) -def ht (g : G) : ℤ := (φ g).toAdd -@[simp] theorem ht_mul (g q : G) : ht φ (g*q) = ht φ g + ht φ q := by simp [ht] -@[simp] theorem ht_one : ht φ 1 = 0 := by simp [ht] -@[simp] theorem ht_inv (g : G) : ht φ g⁻¹ = -ht φ g := by simp [ht] -@[simp] theorem ht_zpow (g : G) (n : ℤ) : ht φ (g^n) = n * ht φ g := by simp [ht] -@[simp] theorem ht_ker (g : φ.ker) : ht φ g = 0 := by simp [ht,MonoidHom.mem_ker.mp g.property] -variable (hv : ∀ a, φ (v a) = Multiplicative.ofAdd (1 : ℤ)) -include hv in -omit [LinearOrder A] in -@[simp] theorem ht_generator (a : A) : ht φ (v a) = 1 := by simp [ht,hv] -include hv in -omit [LinearOrder A] in -theorem ht_step (g : G) (a : A) : ht φ (g * v a) = ht φ g + 1 := by simp [ht_generator φ v hv] - -def Shape (k : ℕ) := {p : List A × ℤ // SimplicialChains.Valid L p.1 ∧ p.1.length = k ∧ - p.2 < 0 ∧ 0 < p.2 + (k : ℤ)} -def basisIndex (k : ℕ) (p : φ.ker × Shape L k) : G × List A := - (p.1.val * (v (p.2.val.1.headD root)) ^ p.2.val.2,p.2.val.1) - -include hv in -theorem basisIndex_height (k : ℕ) (p : φ.ker × Shape L k) : - ht φ (basisIndex L φ v root k p).1 = p.2.val.2 := by - simp only [basisIndex,ht_mul,ht_ker,ht_zpow,ht_generator φ v hv,mul_one,zero_add] - -include hv in -theorem basisIndex_injective (k : ℕ) : Function.Injective (basisIndex L φ v root k) := by - intro p q he - have hw : p.2.val.1 = q.2.val.1 := congrArg Prod.snd he - have hh := congrArg (fun x => ht φ x.1) he - rw [basisIndex_height L φ v root hv,basisIndex_height L φ v root hv] at hh - have hs : p.2 = q.2 := Subtype.ext (Prod.ext hw hh) - have hg := congrArg Prod.fst he - simp only [basisIndex,hs] at hg - exact Prod.ext (Subtype.ext (mul_right_cancel hg)) hs - -include hv in -theorem basisIndex_mem (k : ℕ) (p : φ.ker × Shape L k) : - SimplicialChains.Valid L (basisIndex L φ v root k p).2 ∧ - (basisIndex L φ v root k p).2.length = k ∧ - ht φ (basisIndex L φ v root k p).1 < 0 ∧ - 0 < ht φ (basisIndex L φ v root k p).1 + (k : ℤ) := by - rw [basisIndex_height L φ v root hv] - exact p.2.property - -include hv in -theorem exists_basisIndex {k : ℕ} (p : G × List A) - (hp : SimplicialChains.Valid L p.2 ∧ p.2.length = k ∧ ht φ p.1 < 0 ∧ 0 < ht φ p.1 + (k : ℤ)) : - ∃ q : φ.ker × Shape L k, basisIndex L φ v root k q = p := by - let s : Shape L k := ⟨(p.2,ht φ p.1),hp⟩ - let g : φ.ker := ⟨p.1 * (v (p.2.headD root)) ^ (-ht φ p.1),by - apply (Multiplicative.toAdd.injective) - change ht φ (p.1 * (v (p.2.headD root)) ^ (-ht φ p.1)) = 0 - simp only [ht_mul,ht_zpow,ht_generator φ v hv,mul_one,add_neg_cancel]⟩ - refine ⟨(g,s),?_⟩ - apply Prod.ext - · change (p.1 * (v (p.2.headD root)) ^ (-ht φ p.1)) * (v (p.2.headD root)) ^ (ht φ p.1) = p.1 - rw [mul_assoc,← zpow_add,neg_add_cancel,zpow_zero,mul_one] - · rfl - -def includeBasis (k : ℕ) : (φ.ker × Shape L k →₀ ℤ) →ₗ[ℤ] CubicalChains.Chains G A := - Finsupp.lmapDomain ℤ ℤ (basisIndex L φ v root k) -@[simp] theorem includeBasis_single (k : ℕ) (p : φ.ker × Shape L k) (n : ℤ) : - includeBasis L φ v root k (Finsupp.single p n) = Finsupp.single (basisIndex L φ v root k p) n := by - simp [includeBasis] -include hv in -theorem includeBasis_injective (k : ℕ) : Function.Injective (includeBasis L φ v root k) := - Finsupp.mapDomain_injective (basisIndex_injective L φ v root hv k) - -include hv in -theorem includeBasis_range (k : ℕ) : LinearMap.range (includeBasis L φ v root k) = crossing L (ht φ) k := by - rw [includeBasis,Finsupp.range_lmapDomain,crossing,Finsupp.supported_eq_span_single] - congr 1 - ext c - constructor - · rintro ⟨p,rfl⟩ - exact ⟨basisIndex L φ v root k p,basisIndex_mem L φ v root hv k p,rfl⟩ - · rintro ⟨p,hp,rfl⟩ - obtain ⟨q,rfl⟩ := exists_basisIndex L φ v root hv p hp - exact ⟨q,rfl⟩ - -variable (comm : ∀ a b, L.Adj a b → Commute (v a) (v b)) -include hv in -def projectBasis (k : ℕ) : CubicalChains.Chains G A →ₗ[ℤ] (φ.ker × Shape L k →₀ ℤ) := - Finsupp.lcomapDomain (basisIndex L φ v root k) (basisIndex_injective L φ v root hv k) - -@[simp] theorem project_include (k : ℕ) (c : φ.ker × Shape L k →₀ ℤ) : - projectBasis L φ v root hv k (includeBasis L φ v root k c) = c := - Finsupp.leftInverse_lcomapDomain_mapDomain _ _ c - -include hv in -theorem include_project {k : ℕ} {c : CubicalChains.Chains G A} (hc : c ∈ crossing L (ht φ) k) : - includeBasis L φ v root k (projectBasis L φ v root hv k c) = c := by - rw [← includeBasis_range L φ v root hv k] at hc - obtain ⟨d,rfl⟩ := hc - rw [project_include] - -include hv in -theorem includeBasis_mem (k : ℕ) (c : φ.ker × Shape L k →₀ ℤ) : - includeBasis L φ v root k c ∈ crossing L (ht φ) k := by - rw [← includeBasis_range L φ v root hv k] - exact ⟨c,rfl⟩ - -/-- The level edge parameter has precisely two directions and initial height -1. -/ -theorem shape_two_form (s : Shape L 2) : ∃ a b, s.val = ([a,b],-1) := by - obtain ⟨a,b,hab⟩ := List.length_eq_two.mp s.property.2.1 - refine ⟨a,b,Prod.ext hab ?_⟩ - have hn := s.property.2.2.1 - have hm := s.property.2.2.2 - norm_num at hm - omega - -def generator (s : Shape L 2) : φ.ker := - ⟨(v (s.val.1.headD root))⁻¹ * v (s.val.1.tail.headD root),by simp [hv]⟩ - -def includeVertices : (φ.ker →₀ ℤ) →ₗ[ℤ] CubicalChains.Chains G A := - Finsupp.lmapDomain ℤ ℤ (fun g => (g.val,[])) -omit [LinearOrder A] in -@[simp] theorem includeVertices_single (g : φ.ker) (n : ℤ) : - includeVertices (A := A) φ (Finsupp.single g n) = Finsupp.single (g.val,[]) n := by simp [includeVertices] -omit [LinearOrder A] in -theorem includeVertices_injective : Function.Injective (includeVertices (A := A) φ) := by - apply Finsupp.mapDomain_injective - intro p q he - exact Subtype.ext (congrArg Prod.fst he) - -include hv in -omit [LinearOrder A] in -theorem boundary_square (g : G) (a b : A) (hab : Commute (v a) (v b)) - (hg : ht φ g = -1) : - levelBoundary v (ht φ) (Finsupp.single (g,[a,b]) 1) = - Finsupp.single (g*v b,[]) 1 - Finsupp.single (g*v a,[]) 1 := by - have hga : ht φ (g * v a) = 0 := by rw [ht_step φ v hv,hg]; omega - have hgb : ht φ (g * v b) = 0 := by rw [ht_step φ v hv,hg]; omega - simp only [levelBoundary_apply,boundary_single,one_smul,boundaryTerm_cons,boundaryTerm_nil, - map_zero,sub_zero,map_sub,front_single,plus,select_single,hga,hgb,hg] - norm_num - rw [mul_assoc,hab.eq,← mul_assoc] - abel - - -include hv comm in -theorem levelBoundary_include_single (p : φ.ker × Shape L 2) : - levelBoundary v (ht φ) (includeBasis L φ v root 2 (Finsupp.single p 1)) = - includeVertices (A := A) φ (edgeBoundary (generator L φ v root hv) (Finsupp.single p 1)) := by - rcases p with ⟨g,⟨⟨w,n⟩,hs⟩⟩ - obtain ⟨a,b,hw⟩ := List.length_eq_two.mp hs.2.1 - change w = [a,b] at hw - subst w - have hn : n = -1 := by have h₁ := hs.2.2.1; have h₂ := hs.2.2.2; norm_num at h₂; omega - subst n - have hab : L.Adj a b := (List.pairwise_cons.mp hs.1.2).1 b (by simp) - rw [includeBasis_single] - change levelBoundary v (ht φ) (Finsupp.single (g.val * (v a)^(-1 : ℤ),[a,b]) 1) = _ - rw [boundary_square φ v hv _ a b (comm a b hab) (by simp [ht_generator φ v hv])] - simp only [edgeBoundary,Finsupp.linearCombination_single] - simp only [zpow_neg_one,one_smul,map_sub,includeVertices_single, - Subgroup.coe_mul,generator,List.headD_cons,List.tail_cons,mul_assoc,inv_mul_cancel,mul_one] - -include hv comm in -theorem levelBoundary_include (c : φ.ker × Shape L 2 →₀ ℤ) : - levelBoundary v (ht φ) (includeBasis L φ v root 2 c) = - includeVertices (A := A) φ (edgeBoundary (generator L φ v root hv) c) := by - induction c using Finsupp.induction_linear with - | zero => simp - | add c d hc hd => simp only [map_add,hc,hd] - | single p n => - have he : Finsupp.single p n = n • Finsupp.single p (1 : ℤ) := by simp - rw [he,map_smul,map_smul,map_smul,map_smul,levelBoundary_include_single L φ v root hv comm] - -/-- The literal based integral boundary of the crossing three-cubes. -/ -def triangleBoundary : (φ.ker × Shape L 3 →₀ ℤ) →ₗ[ℤ] (φ.ker × Shape L 2 →₀ ℤ) := - (projectBasis L φ v root hv 2).comp ((crossPart (ht φ)).comp ((boundary v).comp (includeBasis L φ v root 3))) - -include hv in -theorem triangleBoundary_inclusion (c : φ.ker × Shape L 3 →₀ ℤ) : - includeBasis L φ v root 2 (triangleBoundary L φ v root hv c) = - crossPart (ht φ) (boundary v (includeBasis L φ v root 3 c)) := by - apply include_project L φ v root hv - exact crossPart_mem L (ht φ) (boundary_total L v (ht φ) (ht_step φ v hv) - (crossing_total L (ht φ) (includeBasis_mem L φ v root hv 3 c))) - -include hv comm in -theorem triangleBoundary_cycle (c : φ.ker × Shape L 3 →₀ ℤ) : - triangleBoundary L φ v root hv c ∈ cycles (generator L φ v root hv) := by - apply includeVertices_injective φ - rw [map_zero,← levelBoundary_include L φ v root hv comm,triangleBoundary_inclusion L φ v root hv] - exact levelBoundary_cross_boundary L v (ht φ) (ht_step φ v hv) comm (includeBasis_mem L φ v root hv 3 c) - -variable (K : SimplicialChains.Contraction L) -variable (exactTotal : ∀ {k : ℕ}, 0 < k → ∀ c, c ∈ total (G := G) L k → boundary v c = 0 → - ∃ b ∈ total (G := G) L (k+1), boundary v b = c) -variable (dim : ∀ w, SimplicialChains.Valid L w → w.length ≤ 3) -include hv comm K exactTotal in -theorem triangleBoundary_range : LinearMap.range (triangleBoundary L φ v root hv) = - cycles (generator L φ v root hv) := by - apply le_antisymm - · rintro _ ⟨c,rfl⟩ - exact triangleBoundary_cycle L φ v root hv comm c - · intro c hc - have hz : levelBoundary v (ht φ) (includeBasis L φ v root 2 c) = 0 := by - rw [levelBoundary_include L φ v root hv comm,LinearMap.mem_ker.mp hc,map_zero] - obtain ⟨t,ht,hdt⟩ := level_cycle_bounds L v (ht φ) K (ht_step φ v hv) comm exactTotal - _ (includeBasis_mem L φ v root hv 2 c) hz - rw [← includeBasis_range L φ v root hv 3] at ht - obtain ⟨b,rfl⟩ := ht - refine ⟨b,includeBasis_injective L φ v root hv 2 ?_⟩ - rwa [triangleBoundary_inclusion L φ v root hv] - -include hv comm K exactTotal dim in -theorem triangleBoundary_injective : Function.Injective (triangleBoundary L φ v root hv) := by - suffices hz : ∀ c, triangleBoundary L φ v root hv c = 0 → c = 0 by - intro c d he - exact sub_eq_zero.mp (hz (c-d) (by simp only [map_sub,he,sub_self])) - intro c hc - apply includeBasis_injective L φ v root hv 3 - rw [map_zero] - apply level_boundary_injective L v (ht φ) K (ht_step φ v hv) comm exactTotal dim - _ (includeBasis_mem L φ v root hv 3 c) - rw [← triangleBoundary_inclusion L φ v root hv,hc,map_zero] - - -/-- Left translation on the actual ambient cube chains. -/ -def leftTranslate (g : G) : CubicalChains.Chains G A →ₗ[ℤ] CubicalChains.Chains G A := - Finsupp.lmapDomain ℤ ℤ (fun p => (g*p.1,p.2)) -omit [LinearOrder A] in -@[simp] theorem leftTranslate_single (g q : G) (w : List A) (n : ℤ) : - leftTranslate g (Finsupp.single (q,w) n) = Finsupp.single (g*q,w) n := by simp [leftTranslate] -omit [LinearOrder A] in -theorem leftTranslate_front (g : G) (a : A) (c : CubicalChains.Chains G A) : - leftTranslate g (CubicalChains.front a c) = CubicalChains.front a (leftTranslate g c) := by - induction c using Finsupp.induction_linear with - | zero => simp - | add c d hc hd => simp only [map_add,hc,hd] - | single p n => rcases p with ⟨q,w⟩; simp -omit [LinearOrder A] in -theorem leftTranslate_boundaryTerm (g q : G) (w : List A) : - leftTranslate g (boundaryTerm v q w) = boundaryTerm v (g*q) w := by - induction w with - | nil => simp - | cons a w ih => simp only [boundaryTerm_cons,map_sub,leftTranslate_single,leftTranslate_front,ih,mul_assoc] -omit [LinearOrder A] in -theorem leftTranslate_boundary (g : G) (c : CubicalChains.Chains G A) : - leftTranslate g (boundary v c) = boundary v (leftTranslate g c) := by - induction c using Finsupp.induction_linear with - | zero => simp - | add c d hc hd => simp only [map_add,hc,hd] - | single p n => rcases p with ⟨q,w⟩; simp [leftTranslate_boundaryTerm] -omit [LinearOrder A] in -theorem leftTranslate_crossPart (g : φ.ker) (c : CubicalChains.Chains G A) : - leftTranslate g.val (crossPart (ht φ) c) = crossPart (ht φ) (leftTranslate g.val c) := by - induction c using Finsupp.induction_linear with - | zero => simp - | add c d hc hd => simp only [map_add,hc,hd] - | single p n => - rcases p with ⟨q,w⟩ - simp only [crossPart,select_single,leftTranslate_single,ht_mul,ht_ker,zero_add] - split <;> simp_all - -theorem includeBasis_translate (k : ℕ) (g : φ.ker) (c : φ.ker × Shape L k →₀ ℤ) : - includeBasis L φ v root k (translateChains g c) = leftTranslate g.val (includeBasis L φ v root k c) := by - induction c using Finsupp.induction_linear with - | zero => simp - | add c d hc hd => simp only [map_add,hc,hd] - | single p n => - rcases p with ⟨q,s⟩ - simp only [translateChains_single,includeBasis_single,leftTranslate_single,basisIndex, - Subgroup.coe_mul,mul_assoc] - -include hv in -theorem triangleBoundary_equivariant : ChainsEquivariant (triangleBoundary L φ v root hv) := by - intro g c - apply includeBasis_injective L φ v root hv 2 - rw [triangleBoundary_inclusion L φ v root hv,includeBasis_translate, - ← leftTranslate_boundary,← leftTranslate_crossPart,includeBasis_translate, - triangleBoundary_inclusion L φ v root hv] - -end EilenbergGanea.LevelBasis - -namespace EilenbergGanea.LevelBasis -variable {V : Type} [LinearOrder V] (L : SimpleGraph V) - -def pairShape (a b : V) (hab : a < b) (hadj : L.Adj a b) : Shape L 2 := - ⟨([a,b],-1),by simp [SimplicialChains.Valid,hab,hadj]⟩ - -@[simp] theorem generator_pair (root a b : V) (hab : a < b) (hadj : L.Adj a b) : - (generator L (height L) (artinGenerator L) root (height_generator L) - (pairShape L a b hab hadj)).val = (artinGenerator L a)⁻¹ * artinGenerator L b := rfl - -/-- The actual oriented crossing-square edges generate precisely the height kernel. -/ -theorem generator_surjective (hconn : L.Preconnected) (root : V) : - Function.Surjective (FreeGroup.lift (generator L (height L) (artinGenerator L) root (height_generator L))) := by - let f := FreeGroup.lift (generator L (height L) (artinGenerator L) root (height_generator L)) - let F := (height L).ker.subtype.comp f - have hgen : edgeGenerated L ≤ F.range := by - apply (Subgroup.closure_le _).mpr - rintro x ⟨a,b,hadj,rfl⟩ - have hab : a ≠ b := L.ne_of_adj hadj - rcases lt_or_gt_of_ne hab with hab | hab - · refine ⟨(FreeGroup.of (pairShape L a b hab hadj))⁻¹,?_⟩ - change (f ((FreeGroup.of (pairShape L a b hab hadj))⁻¹)).val = _ - simp only [f,map_inv,FreeGroup.lift_apply_of,Subgroup.coe_inv,generator_pair,mul_inv_rev,inv_inv] - exact (adjacent_generators_commute L hadj).inv_right.eq.symm - · refine ⟨FreeGroup.of (pairShape L b a hab hadj.symm),?_⟩ - change (f (FreeGroup.of (pairShape L b a hab hadj.symm))).val = _ - simp only [f,FreeGroup.lift_apply_of,generator_pair] - exact (adjacent_generators_commute L hadj).inv_right.eq.symm - intro g - have he : g.val ∈ edgeGenerated L := by rw [edgeGenerated_eq_height_kernel L hconn root]; exact g.property - obtain ⟨w,hw⟩ := hgen he - exact ⟨w,Subtype.ext hw⟩ - -end EilenbergGanea.LevelBasis - -namespace EilenbergGanea.LevelBasis -open CubicalChains CubicalChains.HeightFiltration -variable {V : Type} [LinearOrder V] [Fintype V] [Nonempty V] (L : SimpleGraph V) - -/-- The exactness input to the level slicing is the actual RAAG cube-chain -contraction, not an assumption about a classifying space. -/ -theorem artin_total_cycle_bounds {k : ℕ} (hk : 0 < k) - (c : Chains (ArtinGroup L) V) (hc : c ∈ total (G := ArtinGroup L) L k) - (hz : boundary (artinGenerator L) c = 0) : - ∃ b ∈ total (G := ArtinGroup L) L (k+1), boundary (artinGenerator L) b = c := by - have he : ∀ n, total (G := ArtinGroup L) L n = TraceWords.CubeDescents.positiveChains L n := by - intro n - simp only [total,TraceWords.CubeDescents.positiveChains,SimplicialChains.Valid,and_assoc] - rw [he] at hc ⊢ - exact TraceWords.CubeDescents.positive_cycle_bounds L hk c hc hz - -/-- Integral cd at most two for the genuine height kernel, from a genuine -finite augmented link contraction and the dimension of its flag complex. -/ -theorem artin_height_kernel_cd_le_two (root : V) (hconn : L.Preconnected) - (K : SimplicialChains.Contraction L) - (dim : ∀ w, SimplicialChains.Valid L w → w.length ≤ 3) : - cohomologicalDimension (height L).ker ≤ 2 := by - exact projectiveDimension_le_two_of_boundary_basis - (generator L (height L) (artinGenerator L) root (height_generator L)) - (generator_surjective L hconn root) - (triangleBoundary L (height L) (artinGenerator L) root (height_generator L)) - (triangleBoundary_equivariant L (height L) (artinGenerator L) root (height_generator L)) - (triangleBoundary_injective L (height L) (artinGenerator L) root (height_generator L) - (fun _ _ h => adjacent_generators_commute L h) K (artin_total_cycle_bounds L) dim) - (triangleBoundary_range L (height L) (artinGenerator L) root (height_generator L) - (fun _ _ h => adjacent_generators_commute L h) K (artin_total_cycle_bounds L)) -end EilenbergGanea.LevelBasis -namespace EilenbergGanea.LevelBasis -open CubicalChains CubicalChains.LevelExact CubicalChains.HeightFiltration -variable {G A : Type} [Group G] [LinearOrder A] -variable (L : SimpleGraph A) (φ : G →* Multiplicative ℤ) (v : A → G) (root : A) -variable (hv : ∀ a, φ (v a) = Multiplicative.ofAdd (1 : ℤ)) -variable (comm : ∀ a b, L.Adj a b → Commute (v a) (v b)) - -instance shape_finite [Fintype A] (k : ℕ) : Finite (Shape L k) := by - let f : Shape L k → List.Vector A k × Fin k := fun s => - (⟨s.val.1,s.property.2.1⟩,⟨(-s.val.2).toNat,by - have hn := s.property.2.2.1 - have hm := s.property.2.2.2 - omega⟩) - apply Finite.of_injective f - intro s t h - apply Subtype.ext - apply Prod.ext - · exact congrArg (fun p : List.Vector A k × Fin k => p.1.val) h - · have he := congrArg (fun p : List.Vector A k × Fin k => p.2.val) h - have hs := s.property.2.2.1 - have ht := t.property.2.2.1 - dsimp [f] at he - omega - -noncomputable instance shape_fintype [Fintype A] (k : ℕ) : Fintype (Shape L k) := Fintype.ofFinite _ - -def edgeShape (a b : A) (hab : SimplicialChains.Valid L [a,b]) : Shape L 2 := - ⟨([a,b],-1),hab,rfl,by norm_num,by norm_num⟩ - -def triangleShape (a b c : A) (habc : SimplicialChains.Valid L [a,b,c]) - (n : ℤ) (hn : n = -1 ∨ n = -2) : Shape L 3 := - ⟨([a,b,c],n),habc,rfl,by omega,by norm_num; omega⟩ - -@[simp] theorem generator_edgeShape (a b : A) (hab : SimplicialChains.Valid L [a,b]) : - (generator L φ v root hv (edgeShape L a b hab) : G) = (v a)⁻¹ * v b := rfl - -theorem valid_triangle_edges {a b c : A} (h : SimplicialChains.Valid L [a,b,c]) : - SimplicialChains.Valid L [a,b] ∧ SimplicialChains.Valid L [a,c] ∧ - SimplicialChains.Valid L [b,c] := by - simp [SimplicialChains.Valid] at h ⊢ - tauto - -include comm in -theorem edge_values_compose (a b c : A) (h : SimplicialChains.Valid L [a,b,c]) : - ((v a)⁻¹ * v b) * ((v b)⁻¹ * v c) = (v a)⁻¹ * v c ∧ - ((v b)⁻¹ * v c) * ((v a)⁻¹ * v b) = (v a)⁻¹ * v c := by - have he := valid_triangle_edges L h - have ha : L.Adj a b := by simpa [SimplicialChains.Valid] using he.1.2 - have hb : L.Adj a c := by simpa [SimplicialChains.Valid] using he.2.1.2 - have hc : L.Adj b c := by simpa [SimplicialChains.Valid] using he.2.2.2 - constructor - · group - · calc - ((v b)⁻¹ * v c) * ((v a)⁻¹ * v b) = (v a)⁻¹ * ((v b)⁻¹ * v c) * v b := by - rw [← mul_assoc, - ((comm a b ha).inv_left.inv_right.mul_right (comm a c hb).inv_left).symm.eq] - _ = (v a)⁻¹ * v c := by - rw [mul_assoc,mul_assoc,← (comm b c hc).eq,inv_mul_cancel_left] - -def lowerTriangleWord (ab ac bc : Shape L 2) : FreeGroup (Shape L 2) := - FreeGroup.of ac * (FreeGroup.of bc)⁻¹ * (FreeGroup.of ab)⁻¹ - -def upperTriangleWord (ab ac bc : Shape L 2) : FreeGroup (Shape L 2) := - FreeGroup.of ab * (FreeGroup.of bc * FreeGroup.of ab * (FreeGroup.of ac)⁻¹) * - (FreeGroup.of ab)⁻¹ - -include comm in -theorem triangle_words_trivial (a b c : A) (h : SimplicialChains.Valid L [a,b,c]) : - let e := valid_triangle_edges L h - let ab := edgeShape L a b e.1 - let ac := edgeShape L a c e.2.1 - let bc := edgeShape L b c e.2.2 - wordValue (generator L φ v root hv) (lowerTriangleWord L ab ac bc) = 1 ∧ - wordValue (generator L φ v root hv) (upperTriangleWord L ab ac bc) = 1 := by - dsimp only - have he := edge_values_compose L v comm a b c h - constructor <;> apply Subtype.ext - · simp only [lowerTriangleWord,map_mul,map_inv,wordValue,FreeGroup.lift_apply_of, - Subgroup.coe_mul,Subgroup.coe_inv,generator_edgeShape,OneMemClass.coe_one] - group - · simp only [upperTriangleWord,map_mul,map_inv,wordValue,FreeGroup.lift_apply_of, - Subgroup.coe_mul,Subgroup.coe_inv,generator_edgeShape,OneMemClass.coe_one] - rw [he.2,mul_inv_cancel,mul_one,mul_inv_cancel] - -include hv in -theorem triangle_boundary_low (g : φ.ker) (a b c : A) - (h : SimplicialChains.Valid L [a,b,c]) : - let e := valid_triangle_edges L h - let ab := edgeShape L a b e.1 - let ac := edgeShape L a c e.2.1 - let bc := edgeShape L b c e.2.2 - triangleBoundary L φ v root hv - (Finsupp.single (g,triangleShape L a b c h (-1) (Or.inl rfl)) 1) = - Finsupp.single (g,ac) 1 - Finsupp.single (g,ab) 1 - - Finsupp.single (g * generator L φ v root hv ab,bc) 1 := by - dsimp only - apply includeBasis_injective L φ v root hv 2 - rw [triangleBoundary_inclusion L φ v root hv] - simp only [map_sub,includeBasis_single,basisIndex,triangleShape,edgeShape, - List.headD_cons,zpow_neg_one,Subgroup.coe_mul,generator,List.tail_cons] - simp only [boundary_single,one_smul,boundaryTerm_cons,boundaryTerm_nil,map_zero, - sub_zero,map_sub,front_single,crossPart,select,Finsupp.linearCombination_single, - ht_mul,ht_ker,ht_inv,ht_generator φ v hv,List.length_cons,List.length_nil] - norm_num - simp only [mul_assoc,mul_inv_cancel,mul_one] - abel - -include hv comm in -theorem triangle_boundary_high (g : φ.ker) (a b c : A) - (h : SimplicialChains.Valid L [a,b,c]) : - let e := valid_triangle_edges L h - let ab := edgeShape L a b e.1 - let ac := edgeShape L a c e.2.1 - let bc := edgeShape L b c e.2.2 - triangleBoundary L φ v root hv - (Finsupp.single (g,triangleShape L a b c h (-2) (Or.inr rfl)) 1) = - Finsupp.single (g * generator L φ v root hv ab,bc) 1 - - Finsupp.single (g * generator L φ v root hv ab,ac) 1 + - Finsupp.single (g * generator L φ v root hv ac,ab) 1 := by - dsimp only - have eh := valid_triangle_edges L h - have hab : L.Adj a b := by simpa [SimplicialChains.Valid] using eh.1.2 - have hac : L.Adj a c := by simpa [SimplicialChains.Valid] using eh.2.1.2 - apply includeBasis_injective L φ v root hv 2 - rw [triangleBoundary_inclusion L φ v root hv] - simp only [map_sub,map_add,includeBasis_single,basisIndex,triangleShape,edgeShape, - List.headD_cons,Subgroup.coe_mul,generator,List.tail_cons] - simp only [boundary_single,one_smul,boundaryTerm_cons,boundaryTerm_nil,map_zero, - sub_zero,map_sub,front_single,crossPart,select,map_sub,Finsupp.linearCombination_single, - ht_mul,ht_ker,ht_zpow,ht_generator φ v hv,List.length_cons,List.length_nil] - norm_num - have hb : (v a)^(-2 : ℤ) * v b = (v a)⁻¹ * v b * (v a)⁻¹ := by - calc - (v a)^(-2 : ℤ) * v b = (v a)⁻¹ * ((v a)⁻¹ * v b) := by group - _ = (v a)⁻¹ * (v b * (v a)⁻¹) := congrArg ((v a)⁻¹ * ·) (comm a b hab).inv_left.eq - _ = _ := (mul_assoc _ _ _).symm - have hc : (v a)^(-2 : ℤ) * v c = (v a)⁻¹ * v c * (v a)⁻¹ := by - calc - (v a)^(-2 : ℤ) * v c = (v a)⁻¹ * ((v a)⁻¹ * v c) := by group - _ = (v a)⁻¹ * (v c * (v a)⁻¹) := congrArg ((v a)⁻¹ * ·) (comm a c hac).inv_left.eq - _ = _ := (mul_assoc _ _ _).symm - have ha : (v a)^(-2 : ℤ) * v a = (v a)⁻¹ := by group - simp only [zpow_neg,zpow_ofNat] at ha hb hc - simp only [mul_assoc] at hb hc - simp only [mul_assoc,ha,hb,hc,mul_inv_cancel,mul_one] - abel - -section WordChains -variable (w : Shape L 2 → G) (ab ac bc : Shape L 2) -theorem lowerTriangleWord_chain (habc : w ab * w bc = w ac) (g : G) : - pathChain w (lowerTriangleWord L ab ac bc) g = - Finsupp.single (g,ac) 1 - Finsupp.single (g,ab) 1 - - Finsupp.single (g * w ab,bc) 1 := by - simp only [lowerTriangleWord,pathChain_mul,pathChain_inv,pathChain_of, - map_mul,map_inv,wordValue,FreeGroup.lift_apply_of] - rw [← habc] - simp only [mul_assoc,mul_inv_cancel,mul_one] - abel - -theorem upperTriangleWord_chain (habc : w ab * w bc = w ac) - (hbac : w bc * w ab = w ac) (g : G) : - pathChain w (upperTriangleWord L ab ac bc) g = - Finsupp.single (g * w ab,bc) 1 - Finsupp.single (g * w ab,ac) 1 + - Finsupp.single (g * w ac,ab) 1 := by - have hr : wordValue w (FreeGroup.of bc * FreeGroup.of ab * (FreeGroup.of ac)⁻¹) = 1 := by - simp only [wordValue,map_mul,map_inv,FreeGroup.lift_apply_of,hbac,mul_inv_cancel] - rw [upperTriangleWord,pathChain_conjugate w _ _ hr] - simp only [pathChain_mul,pathChain_inv,pathChain_of,map_mul,wordValue, - FreeGroup.lift_apply_of] - rw [hbac] - simp only [mul_assoc,habc,mul_inv_cancel,mul_one] - abel -end WordChains - -include comm in -theorem triangle_words_chain (g : φ.ker) (a b c : A) (h : SimplicialChains.Valid L [a,b,c]) : - let e := valid_triangle_edges L h - let ab := edgeShape L a b e.1 - let ac := edgeShape L a c e.2.1 - let bc := edgeShape L b c e.2.2 - pathChain (generator L φ v root hv) (lowerTriangleWord L ab ac bc) g = - triangleBoundary L φ v root hv - (Finsupp.single (g,triangleShape L a b c h (-1) (Or.inl rfl)) 1) ∧ - pathChain (generator L φ v root hv) (upperTriangleWord L ab ac bc) g = - triangleBoundary L φ v root hv - (Finsupp.single (g,triangleShape L a b c h (-2) (Or.inr rfl)) 1) := by - dsimp only - have he := edge_values_compose L v comm a b c h - have h₁ : generator L φ v root hv (edgeShape L a b (valid_triangle_edges L h).1) * - generator L φ v root hv (edgeShape L b c (valid_triangle_edges L h).2.2) = - generator L φ v root hv (edgeShape L a c (valid_triangle_edges L h).2.1) := - Subtype.ext he.1 - have h₂ : generator L φ v root hv (edgeShape L b c (valid_triangle_edges L h).2.2) * - generator L φ v root hv (edgeShape L a b (valid_triangle_edges L h).1) = - generator L φ v root hv (edgeShape L a c (valid_triangle_edges L h).2.1) := - Subtype.ext he.2 - constructor - · rw [lowerTriangleWord_chain L _ _ _ _ h₁,triangle_boundary_low L φ v root hv] - · rw [upperTriangleWord_chain L _ _ _ _ h₁ h₂, - triangle_boundary_high L φ v root hv comm] - -def triangleWordList : (w : List A) → SimplicialChains.Valid L w → ℤ → FreeGroup (Shape L 2) - | [a,b,c],h,n => - let e := valid_triangle_edges L h - if n = -1 then - lowerTriangleWord L (edgeShape L a b e.1) (edgeShape L a c e.2.1) (edgeShape L b c e.2.2) - else upperTriangleWord L (edgeShape L a b e.1) (edgeShape L a c e.2.1) (edgeShape L b c e.2.2) - | _,_,_ => 1 - -def triangleWord (s : Shape L 3) : FreeGroup (Shape L 2) := - triangleWordList L s.val.1 s.property.1 s.val.2 - -theorem shape_three_form (s : Shape L 3) : - ∃ (a b c : A) (h : SimplicialChains.Valid L [a,b,c]) (n : ℤ) (hn : n = -1 ∨ n = -2), - s = triangleShape L a b c h n hn := by - obtain ⟨a,b,c,hw⟩ := List.length_eq_three.mp s.property.2.1 - have hn : s.val.2 = -1 ∨ s.val.2 = -2 := by - have h₁ := s.property.2.2.1 - have h₂ := s.property.2.2.2 - norm_num at h₂ - omega - refine ⟨a,b,c,hw ▸ s.property.1,s.val.2,hn,?_⟩ - exact Subtype.ext (Prod.ext hw rfl) - -include comm in -theorem triangleWord_trivial (s : Shape L 3) : - wordValue (generator L φ v root hv) (triangleWord L s) = 1 := by - obtain ⟨a,b,c,h,n,hn,rfl⟩ := shape_three_form L s - rcases hn with rfl | rfl - · simpa [triangleWord,triangleWordList,triangleShape] using - (triangle_words_trivial L φ v root hv comm a b c h).1 - · simpa [triangleWord,triangleWordList,triangleShape] using - (triangle_words_trivial L φ v root hv comm a b c h).2 - -include comm in -theorem triangleWord_chain (s : Shape L 3) (g : φ.ker) : - pathChain (generator L φ v root hv) (triangleWord L s) g = - triangleBoundary L φ v root hv (Finsupp.single (g,s) 1) := by - obtain ⟨a,b,c,h,n,hn,rfl⟩ := shape_three_form L s - rcases hn with rfl | rfl - · simpa [triangleWord,triangleWordList,triangleShape] using - (triangle_words_chain L φ v root hv comm g a b c h).1 - · simpa [triangleWord,triangleWordList,triangleShape] using - (triangle_words_chain L φ v root hv comm g a b c h).2 - -end EilenbergGanea.LevelBasis -namespace EilenbergGanea.LevelBasis -open CubicalChains CubicalChains.HeightFiltration -variable {G A : Type} [Group G] [LinearOrder A] -variable (L : SimpleGraph A) (φ : G →* Multiplicative ℤ) (v : A → G) (root : A) -variable (hv : ∀ a, φ (v a) = Multiplicative.ofAdd (1 : ℤ)) -variable (comm : ∀ a b, L.Adj a b → Commute (v a) (v b)) - -include comm in -theorem triangleBoundary_eq_relatorChainMap : - triangleBoundary L φ v root hv = - relatorChainMap (generator L φ v root hv) (triangleWord L) := by - apply Finsupp.lhom_ext' - intro p - apply LinearMap.ext - intro n - simp only [LinearMap.coe_comp,Function.comp_apply,Finsupp.lsingle_apply, - relatorChainMap,Finsupp.linearCombination_single] - have he : Finsupp.single p n = n • Finsupp.single p (1 : ℤ) := by simp - rw [he,map_smul,← triangleWord_chain L φ v root hv comm p.2 p.1] - -variable (K : SimplicialChains.Contraction L) -variable (exactTotal : ∀ {k : ℕ}, 0 < k → ∀ c, c ∈ total (G := G) L k → boundary v c = 0 → - ∃ b ∈ total (G := G) L (k+1), boundary v b = c) -variable (dim : ∀ w, SimplicialChains.Valid L w → w.length ≤ 3) - -noncomputable def triangleBasis : (φ.ker × Shape L 3 →₀ ℤ) ≃ₗ[ℤ] - cycles (generator L φ v root hv) := - LinearEquiv.ofBijective - ((triangleBoundary L φ v root hv).codRestrict (cycles (generator L φ v root hv)) - (triangleBoundary_cycle L φ v root hv comm)) - ⟨fun c d h => triangleBoundary_injective L φ v root hv comm K exactTotal dim - (congrArg Subtype.val h),fun c => by - have hc : c.val ∈ LinearMap.range (triangleBoundary L φ v root hv) := by - rw [triangleBoundary_range L φ v root hv comm K exactTotal] - exact c.property - obtain ⟨b,hb⟩ := hc - exact ⟨b,Subtype.ext hb⟩⟩ - -theorem triangleBasis_value (c : φ.ker × Shape L 3 →₀ ℤ) : - (triangleBasis L φ v root hv comm K exactTotal dim c : φ.ker × Shape L 2 →₀ ℤ) = - relatorChainMap (generator L φ v root hv) (triangleWord L) c := by - change triangleBoundary L φ v root hv c = _ - rw [triangleBoundary_eq_relatorChainMap L φ v root hv comm] - -end EilenbergGanea.LevelBasis -namespace EilenbergGanea.LevelBasis -open LevelTransport -variable {V : Type} [LinearOrder V] (L : SimpleGraph V) (root : V) (N : ℕ) - -noncomputable def levelEquiv : (height L).ker ≃ NegativeLevel L N where - toFun := fun g => ⟨(artinGenerator L root)⁻¹ ^ N * g.val,by - simp only [map_mul,map_pow,map_inv,height_generator] - rw [show height L g.val = 1 from g.property,mul_one] - change N • (-1 : ℤ) = -(N : ℤ) - simp⟩ - invFun := fun g => ⟨artinGenerator L root ^ N * g.val,by - change (height L (artinGenerator L root ^ N * g.val)).toAdd = 0 - simp only [map_mul,map_pow,height_generator] - change N • (1 : ℤ) + (height L g.val).toAdd = 0 - rw [g.property] - simp⟩ - left_inv := fun g => Subtype.ext (by dsimp; group) - right_inv := fun g => Subtype.ext (by dsimp; group) - -def basedLabel (a : NegativeLevel L N → V → V → SU2) - (g : (height L).ker) (s : Shape L 2) : SU2 := - a (levelEquiv L root N g) (s.val.1.tail.headD root) (s.val.1.headD root) - -@[simp] theorem basedLabel_edge (a : NegativeLevel L N → V → V → SU2) - (g : (height L).ker) (q r : V) (h : SimplicialChains.Valid L [q,r]) : - basedLabel L root N a g (edgeShape L q r h) = a (levelEquiv L root N g) r q := rfl - -theorem levelEquiv_edge (g : (height L).ker) (q r : V) - (h : SimplicialChains.Valid L [q,r]) : - levelEquiv L root N - (g * generator L (height L) (artinGenerator L) root (height_generator L) (edgeShape L q r h)) = - edgeVertex L N (levelEquiv L root N g) r q := by - have ha : L.Adj q r := by simpa [SimplicialChains.Valid] using h.2 - apply Subtype.ext - simp only [levelEquiv,Equiv.coe_fn_mk,Subgroup.coe_mul,generator_edgeShape,edgeVertex] - rw [mul_assoc, (adjacent_generators_commute L ha).inv_left.eq] - group - -theorem shape_two_presentation (s : Shape L 2) : - ∃ (q r : V) (h : SimplicialChains.Valid L [q,r]), s = edgeShape L q r h := by - obtain ⟨q,r,hw⟩ := List.length_eq_two.mp s.property.2.1 - have hn : s.val.2 = -1 := by - have h₁ := s.property.2.2.1 - have h₂ := s.property.2.2.2 - norm_num at h₂ - omega - refine ⟨q,r,hw ▸ s.property.1,?_⟩ - exact Subtype.ext (Prod.ext hw hn) - -theorem levelEquiv_edge_inv (g : (height L).ker) (q r : V) - (h : SimplicialChains.Valid L [q,r]) : - levelEquiv L root N - (g * (generator L (height L) (artinGenerator L) root (height_generator L) (edgeShape L q r h))⁻¹) = - edgeVertex L N (levelEquiv L root N g) q r := by - have he := levelEquiv_edge L root N - (g * (generator L (height L) (artinGenerator L) root (height_generator L) (edgeShape L q r h))⁻¹) - q r h - simp only [inv_mul_cancel_right] at he - simpa only [edgeVertex_reverse] using congrArg (fun x => edgeVertex L N x q r) he.symm - -variable (a : NegativeLevel L N → V → V → SU2) -variable (rev : ∀ g q r, a (edgeVertex L N g q r) r q = (a g q r)⁻¹) -include rev in -theorem basedLabel_inv_edge (g : (height L).ker) (q r : V) - (h : SimplicialChains.Valid L [q,r]) : - (basedLabel L root N a - (g * (generator L (height L) (artinGenerator L) root (height_generator L) (edgeShape L q r h))⁻¹) - (edgeShape L q r h))⁻¹ = a (levelEquiv L root N g) q r := by - rw [basedLabel_edge,levelEquiv_edge_inv,rev,inv_inv] - -def orientedWord (q r : V) (h : L.Adj q r) : FreeGroup (Shape L 2) := - if hlt : q < r then - (FreeGroup.of (edgeShape L q r (by simpa [SimplicialChains.Valid] using And.intro hlt h)))⁻¹ - else - FreeGroup.of (edgeShape L r q (by - have hlt' : r < q := lt_of_le_of_ne (le_of_not_gt hlt) (Ne.symm (L.ne_of_adj h)) - simpa [SimplicialChains.Valid] using And.intro hlt' h.symm)) - -theorem orientedWord_value (q r : V) (h : L.Adj q r) : - (wordValue (generator L (height L) (artinGenerator L) root (height_generator L)) - (orientedWord L q r h) : ArtinGroup L) = - artinGenerator L q * (artinGenerator L r)⁻¹ := by - unfold orientedWord - split_ifs - · simp only [map_inv,wordValue,FreeGroup.lift_apply_of,Subgroup.coe_inv,generator_edgeShape, - mul_inv_rev,inv_inv] - exact (adjacent_generators_commute L h).inv_right.symm.eq - · simp only [wordValue,FreeGroup.lift_apply_of,generator_edgeShape] - exact (adjacent_generators_commute L h).inv_right.symm.eq - -theorem levelEquiv_orientedWord (g : (height L).ker) (q r : V) (h : L.Adj q r) : - levelEquiv L root N - (g * wordValue (generator L (height L) (artinGenerator L) root (height_generator L)) - (orientedWord L q r h)) = edgeVertex L N (levelEquiv L root N g) q r := by - apply Subtype.ext - simp only [levelEquiv,Equiv.coe_fn_mk,Subgroup.coe_mul,orientedWord_value,edgeVertex,mul_assoc] - -include rev in -theorem orientedWord_product (g : (height L).ker) (q r : V) (h : L.Adj q r) : - pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) - (basedLabel L root N a) (orientedWord L q r h) g = a (levelEquiv L root N g) q r := by - unfold orientedWord - split_ifs - · simp only [pathProduct_inv,pathProduct_of,wordValue,FreeGroup.lift_apply_of] - exact basedLabel_inv_edge L root N a rev g q r _ - · exact pathProduct_of _ _ _ _ - - -include rev in -theorem inverse_edgeWord_product (g : (height L).ker) (q r : V) - (h : SimplicialChains.Valid L [q,r]) : - pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) - (basedLabel L root N a) (FreeGroup.of (edgeShape L q r h))⁻¹ g = - a (levelEquiv L root N g) q r := by - simp only [pathProduct_inv,pathProduct_of,wordValue,FreeGroup.lift_apply_of] - exact basedLabel_inv_edge L root N a rev g q r h - -variable (tri : ∀ g₀ g₁ g₂ q₀ r₀ q₁ r₁ q₂ r₂, - edgeVertex L N g₀ q₀ r₀ = g₁ → edgeVertex L N g₁ q₁ r₁ = g₂ → - edgeVertex L N g₂ q₂ r₂ = g₀ → a g₀ q₀ r₀ * a g₁ q₁ r₁ * a g₂ q₂ r₂ = 1) - -include rev tri in -theorem lowerTriangleWord_product (g : (height L).ker) (q r s : V) - (h : SimplicialChains.Valid L [q,r,s]) : - let e := valid_triangle_edges L h - pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) - (basedLabel L root N a) - (lowerTriangleWord L (edgeShape L q r e.1) (edgeShape L q s e.2.1) - (edgeShape L r s e.2.2)) g = 1 := by - let gen := generator L (height L) (artinGenerator L) root (height_generator L) - let e := valid_triangle_edges L h - let ab := edgeShape L q r e.1 - let ac := edgeShape L q s e.2.1 - let bc := edgeShape L r s e.2.2 - have he : gen ab * gen bc = gen ac := - Subtype.ext (edge_values_compose L (artinGenerator L) - (fun _ _ hh => adjacent_generators_commute L hh) q r s h).1 - have hc : gen ac * (gen bc)⁻¹ = gen ab := by rw [← he]; group - have hc' : g * gen ac * (gen bc)⁻¹ = g * gen ab := by rw [mul_assoc,hc] - have ha : g * gen ab * (gen ab)⁻¹ = g := by group - have T := tri (levelEquiv L root N g) (levelEquiv L root N (g * gen ac)) - (levelEquiv L root N (g * gen ab)) s q r s q r - (levelEquiv_edge L root N g q s e.2.1).symm - (by rw [← levelEquiv_edge_inv L root N (g * gen ac) r s e.2.2]; exact congrArg _ hc') - (by rw [← levelEquiv_edge_inv L root N (g * gen ab) q r e.1]; exact congrArg _ ha) - change pathProduct gen (basedLabel L root N a) (lowerTriangleWord L ab ac bc) g = 1 - simp only [lowerTriangleWord,pathProduct_mul,pathProduct_of,map_mul,map_inv, - wordValue,FreeGroup.lift_apply_of] - rw [hc] - rw [inverse_edgeWord_product L root N a rev _ r s e.2.2, - inverse_edgeWord_product L root N a rev _ q r e.1] - exact T - -include rev tri in -theorem upperInnerWord_product (g : (height L).ker) (q r s : V) - (h : SimplicialChains.Valid L [q,r,s]) : - let e := valid_triangle_edges L h - pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) - (basedLabel L root N a) - (FreeGroup.of (edgeShape L r s e.2.2) * FreeGroup.of (edgeShape L q r e.1) * - (FreeGroup.of (edgeShape L q s e.2.1))⁻¹) g = 1 := by - let gen := generator L (height L) (artinGenerator L) root (height_generator L) - let e := valid_triangle_edges L h - let ab := edgeShape L q r e.1 - let ac := edgeShape L q s e.2.1 - let bc := edgeShape L r s e.2.2 - have he : gen bc * gen ab = gen ac := - Subtype.ext (edge_values_compose L (artinGenerator L) - (fun _ _ hh => adjacent_generators_commute L hh) q r s h).2 - have hc : g * gen bc * gen ab = g * gen ac := by rw [mul_assoc,he] - have ha : g * gen ac * (gen ac)⁻¹ = g := by group - have T := tri (levelEquiv L root N g) (levelEquiv L root N (g * gen bc)) - (levelEquiv L root N (g * gen ac)) s r r q q s - (levelEquiv_edge L root N g r s e.2.2).symm - (by rw [← levelEquiv_edge L root N (g * gen bc) q r e.1]; exact congrArg _ hc) - (by rw [← levelEquiv_edge_inv L root N (g * gen ac) q s e.2.1]; exact congrArg _ ha) - change pathProduct gen (basedLabel L root N a) - (FreeGroup.of bc * FreeGroup.of ab * (FreeGroup.of ac)⁻¹) g = 1 - simp only [pathProduct_mul,pathProduct_of,map_mul,wordValue,FreeGroup.lift_apply_of] - rw [he,inverse_edgeWord_product L root N a rev _ q s e.2.1] - exact T - -include rev tri in -theorem upperTriangleWord_product (g : (height L).ker) (q r s : V) - (h : SimplicialChains.Valid L [q,r,s]) : - let e := valid_triangle_edges L h - pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) - (basedLabel L root N a) - (upperTriangleWord L (edgeShape L q r e.1) (edgeShape L q s e.2.1) - (edgeShape L r s e.2.2)) g = 1 := by - let gen := generator L (height L) (artinGenerator L) root (height_generator L) - let e := valid_triangle_edges L h - let ab := edgeShape L q r e.1 - let ac := edgeShape L q s e.2.1 - let bc := edgeShape L r s e.2.2 - have he : gen bc * gen ab = gen ac := - Subtype.ext (edge_values_compose L (artinGenerator L) - (fun _ _ hh => adjacent_generators_commute L hh) q r s h).2 - have hr : wordValue gen (FreeGroup.of bc * FreeGroup.of ab * (FreeGroup.of ac)⁻¹) = 1 := by - simp only [map_mul,map_inv,wordValue,FreeGroup.lift_apply_of,he,mul_inv_cancel] - change pathProduct gen (basedLabel L root N a) (upperTriangleWord L ab ac bc) g = 1 - rw [upperTriangleWord,pathProduct_conjugate_loop gen _ _ _ hr] - rw [upperInnerWord_product L root N a rev tri _ q r s h] - group - -include rev tri in -theorem triangleWord_product (s : Shape L 3) (g : (height L).ker) : - pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) - (basedLabel L root N a) (triangleWord L s) g = 1 := by - obtain ⟨q,r,t,h,n,hn,rfl⟩ := shape_three_form L s - rcases hn with rfl | rfl - · simpa [triangleWord,triangleWordList,triangleShape] using - lowerTriangleWord_product L root N a rev tri g q r t h - · simpa [triangleWord,triangleWordList,triangleShape] using - upperTriangleWord_product L root N a rev tri g q r t h - - -variable {L N} -def walkWord {g k : NegativeLevel L N} : Walk L N g k → FreeGroup (Shape L 2) - | .nil _ => 1 - | .cons q r h p => orientedWord L q r h * walkWord p - - theorem walkWord_endpoint {g k : NegativeLevel L N} (p : Walk L N g k) - (x : (height L).ker) (hx : levelEquiv L root N x = g) : - levelEquiv L root N - (x * wordValue (generator L (height L) (artinGenerator L) root (height_generator L)) - (walkWord p)) = k := by - induction p generalizing x with - | nil g => simpa [walkWord] using hx - | @cons g k q r h p ih => - simp only [walkWord,map_mul,← mul_assoc] - exact ih _ ((levelEquiv_orientedWord L root N x q r h).trans - (congrArg (fun t => edgeVertex L N t q r) hx)) - -include rev in - theorem walkWord_product {g k : NegativeLevel L N} (p : Walk L N g k) - (x : (height L).ker) (hx : levelEquiv L root N x = g) : - pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) - (basedLabel L root N a) (walkWord p) x = p.eval a := by - induction p generalizing x with - | nil g => simp [walkWord,Walk.eval] - | @cons g k q r h p ih => - rw [walkWord,pathProduct_mul,orientedWord_product L root N a rev x q r h] - rw [ih _ ((levelEquiv_orientedWord L root N x q r h).trans - (congrArg (fun t => edgeVertex L N t q r) hx)),hx] - rfl - -include rev in - theorem nontrivial_word_of_walk {g : NegativeLevel L N} (p : Walk L N g g) - (hp : p.eval a ≠ 1) : - ∃ (w : FreeGroup (Shape L 2)) (x : (height L).ker), - wordValue (generator L (height L) (artinGenerator L) root (height_generator L)) w = 1 ∧ - pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) - (basedLabel L root N a) w x ≠ 1 := by - let x := (levelEquiv L root N).symm g - have hx : levelEquiv L root N x = g := (levelEquiv L root N).apply_symm_apply g - refine ⟨walkWord p,x,?_,?_⟩ - · have he := walkWord_endpoint root p x hx - have he' := (levelEquiv L root N).injective (he.trans hx.symm) - exact mul_left_cancel (he'.trans (mul_one x).symm) - · rwa [walkWord_product root a rev p x hx] - -end EilenbergGanea.LevelBasis - -namespace EilenbergGanea.LevelBasis -open LevelTransport -variable {V : Type} [LinearOrder V] [Fintype V] [Nonempty V] (L : SimpleGraph V) -variable [Group.ResiduallyFinite (height L).ker] -variable (root : V) (hconn : L.Preconnected) -variable (K : SimplicialChains.Contraction L) -variable (dim : ∀ w, SimplicialChains.Valid L w → w.length ≤ 3) - -include root hconn K dim in -/-- The source obstruction's algebraic endpoint, with no cardinal bound on -an alleged presentation. Its geometric premise must still be derived from an -ordinary two-dimensional classifying CW space. -/ -theorem no_boundary_basis_presentation - (small : ∀ ε : ℝ, 0 < ε → - ∃ N : ℕ, 1 < N ∧ ∃ a : NegativeLevel L N → V → V → SU2, - (∀ g q r, a (edgeVertex L N g q r) r q = (a g q r)⁻¹) ∧ - (∀ g q r, dist (a g q r) 1 < ε) ∧ - (∀ g₀ g₁ g₂ q₀ r₀ q₁ r₁ q₂ r₂, - edgeVertex L N g₀ q₀ r₀ = g₁ → - edgeVertex L N g₁ q₁ r₁ = g₂ → - edgeVertex L N g₂ q₂ r₂ = g₀ → - a g₀ q₀ r₀ * a g₁ q₁ r₁ * a g₂ q₂ r₂ = 1) ∧ - ∃ (g : NegativeLevel L N) (p : Walk L N g g), p.eval a ≠ 1) - {A R : Type*} (a₀ : A → (height L).ker) - (ha₀ : Function.Surjective (wordValue a₀)) - (r₀ : R → FreeGroup A) (hr₀ : ∀ i, wordValue a₀ (r₀ i) = 1) - (hp₀ : (wordValue a₀).ker = Subgroup.normalClosure (Set.range r₀)) - (E : BasedChains (height L).ker R ≃ₗ[ℤ] cycles a₀) - (hE : ∀ c, (E c : BasedChains (height L).ker A) = relatorChainMap a₀ r₀ c) : False := by - let gen := generator L (height L) (artinGenerator L) root (height_generator L) - let comm := fun q r h => @adjacent_generators_commute V L q r h - let B := triangleBasis L (height L) (artinGenerator L) root (height_generator L) - comm K (artin_total_cycle_bounds L) dim - obtain ⟨η,hη,hηa⟩ := boundary_basis_small_transport gen - (generator_surjective L hconn root) (triangleWord L) - (triangleWord_trivial L (height L) (artinGenerator L) root (height_generator L) comm) - B (triangleBasis_value L (height L) (artinGenerator L) root (height_generator L) - comm K (artin_total_cycle_bounds L) dim) a₀ ha₀ r₀ hr₀ hp₀ E hE - obtain ⟨N,_,a,ha,hb,ht,g,p,hp⟩ := small η hη - obtain ⟨w,x,hw,hx⟩ := nontrivial_word_of_walk root a ha p hp - apply hx - exact hηa (basedLabel L root N a) - (fun x s => by - simpa only [basedLabel,Subtype.dist_eq,dist_eq_norm,OneMemClass.coe_one] using - hb (levelEquiv L root N x) (s.val.1.tail.headD root) (s.val.1.headD root)) - (triangleWord_product L root N a ha ht) w hw x - -end EilenbergGanea.LevelBasis - - -end - -end OAI +import OAI.AlgebraicTopology.Cubical.HeightChains +import OAI.Topology.EilenbergGanea.IntegralModules +import OAI.Topology.EilenbergGanea.LevelTransport + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +namespace EilenbergGanea.LevelBasis +open CubicalChains CubicalChains.LevelExact CubicalChains.HeightFiltration +variable {G A : Type} [Group G] [LinearOrder A] +variable (L : SimpleGraph A) (φ : G →* Multiplicative ℤ) (v : A → G) (root : A) +def ht (g : G) : ℤ := (φ g).toAdd +@[simp] theorem ht_mul (g q : G) : ht φ (g*q) = ht φ g + ht φ q := by simp [ht] +@[simp] theorem ht_one : ht φ 1 = 0 := by simp [ht] +@[simp] theorem ht_inv (g : G) : ht φ g⁻¹ = -ht φ g := by simp [ht] +@[simp] theorem ht_zpow (g : G) (n : ℤ) : ht φ (g^n) = n * ht φ g := by simp [ht] +@[simp] theorem ht_ker (g : φ.ker) : ht φ g = 0 := by simp [ht,MonoidHom.mem_ker.mp g.property] +variable (hv : ∀ a, φ (v a) = Multiplicative.ofAdd (1 : ℤ)) +include hv in +omit [LinearOrder A] in +@[simp] theorem ht_generator (a : A) : ht φ (v a) = 1 := by simp [ht,hv] +include hv in +omit [LinearOrder A] in +theorem ht_step (g : G) (a : A) : ht φ (g * v a) = ht φ g + 1 := by simp [ht_generator φ v hv] + +def Shape (k : ℕ) := {p : List A × ℤ // SimplicialChains.Valid L p.1 ∧ p.1.length = k ∧ + p.2 < 0 ∧ 0 < p.2 + (k : ℤ)} +def basisIndex (k : ℕ) (p : φ.ker × Shape L k) : G × List A := + (p.1.val * (v (p.2.val.1.headD root)) ^ p.2.val.2,p.2.val.1) + +include hv in +theorem basisIndex_height (k : ℕ) (p : φ.ker × Shape L k) : + ht φ (basisIndex L φ v root k p).1 = p.2.val.2 := by + simp only [basisIndex,ht_mul,ht_ker,ht_zpow,ht_generator φ v hv,mul_one,zero_add] + +include hv in +theorem basisIndex_injective (k : ℕ) : Function.Injective (basisIndex L φ v root k) := by + intro p q he + have hw : p.2.val.1 = q.2.val.1 := congrArg Prod.snd he + have hh := congrArg (fun x => ht φ x.1) he + rw [basisIndex_height L φ v root hv,basisIndex_height L φ v root hv] at hh + have hs : p.2 = q.2 := Subtype.ext (Prod.ext hw hh) + have hg := congrArg Prod.fst he + simp only [basisIndex,hs] at hg + exact Prod.ext (Subtype.ext (mul_right_cancel hg)) hs + +include hv in +theorem basisIndex_mem (k : ℕ) (p : φ.ker × Shape L k) : + SimplicialChains.Valid L (basisIndex L φ v root k p).2 ∧ + (basisIndex L φ v root k p).2.length = k ∧ + ht φ (basisIndex L φ v root k p).1 < 0 ∧ + 0 < ht φ (basisIndex L φ v root k p).1 + (k : ℤ) := by + rw [basisIndex_height L φ v root hv] + exact p.2.property + +include hv in +theorem exists_basisIndex {k : ℕ} (p : G × List A) + (hp : SimplicialChains.Valid L p.2 ∧ p.2.length = k ∧ ht φ p.1 < 0 ∧ 0 < ht φ p.1 + (k : ℤ)) : + ∃ q : φ.ker × Shape L k, basisIndex L φ v root k q = p := by + let s : Shape L k := ⟨(p.2,ht φ p.1),hp⟩ + let g : φ.ker := ⟨p.1 * (v (p.2.headD root)) ^ (-ht φ p.1),by + apply (Multiplicative.toAdd.injective) + change ht φ (p.1 * (v (p.2.headD root)) ^ (-ht φ p.1)) = 0 + simp only [ht_mul,ht_zpow,ht_generator φ v hv,mul_one,add_neg_cancel]⟩ + refine ⟨(g,s),?_⟩ + apply Prod.ext + · change (p.1 * (v (p.2.headD root)) ^ (-ht φ p.1)) * (v (p.2.headD root)) ^ (ht φ p.1) = p.1 + rw [mul_assoc,← zpow_add,neg_add_cancel,zpow_zero,mul_one] + · rfl + +def includeBasis (k : ℕ) : (φ.ker × Shape L k →₀ ℤ) →ₗ[ℤ] CubicalChains.Chains G A := + Finsupp.lmapDomain ℤ ℤ (basisIndex L φ v root k) +@[simp] theorem includeBasis_single (k : ℕ) (p : φ.ker × Shape L k) (n : ℤ) : + includeBasis L φ v root k (Finsupp.single p n) = Finsupp.single (basisIndex L φ v root k p) n := by + simp [includeBasis] +include hv in +theorem includeBasis_injective (k : ℕ) : Function.Injective (includeBasis L φ v root k) := + Finsupp.mapDomain_injective (basisIndex_injective L φ v root hv k) + +include hv in +theorem includeBasis_range (k : ℕ) : LinearMap.range (includeBasis L φ v root k) = crossing L (ht φ) k := by + rw [includeBasis,Finsupp.range_lmapDomain,crossing,Finsupp.supported_eq_span_single] + congr 1 + ext c + constructor + · rintro ⟨p,rfl⟩ + exact ⟨basisIndex L φ v root k p,basisIndex_mem L φ v root hv k p,rfl⟩ + · rintro ⟨p,hp,rfl⟩ + obtain ⟨q,rfl⟩ := exists_basisIndex L φ v root hv p hp + exact ⟨q,rfl⟩ + +variable (comm : ∀ a b, L.Adj a b → Commute (v a) (v b)) +include hv in +def projectBasis (k : ℕ) : CubicalChains.Chains G A →ₗ[ℤ] (φ.ker × Shape L k →₀ ℤ) := + Finsupp.lcomapDomain (basisIndex L φ v root k) (basisIndex_injective L φ v root hv k) + +@[simp] theorem project_include (k : ℕ) (c : φ.ker × Shape L k →₀ ℤ) : + projectBasis L φ v root hv k (includeBasis L φ v root k c) = c := + Finsupp.leftInverse_lcomapDomain_mapDomain _ _ c + +include hv in +theorem include_project {k : ℕ} {c : CubicalChains.Chains G A} (hc : c ∈ crossing L (ht φ) k) : + includeBasis L φ v root k (projectBasis L φ v root hv k c) = c := by + rw [← includeBasis_range L φ v root hv k] at hc + obtain ⟨d,rfl⟩ := hc + rw [project_include] + +include hv in +theorem includeBasis_mem (k : ℕ) (c : φ.ker × Shape L k →₀ ℤ) : + includeBasis L φ v root k c ∈ crossing L (ht φ) k := by + rw [← includeBasis_range L φ v root hv k] + exact ⟨c,rfl⟩ + +/-- The level edge parameter has precisely two directions and initial height -1. -/ +theorem shape_two_form (s : Shape L 2) : ∃ a b, s.val = ([a,b],-1) := by + obtain ⟨a,b,hab⟩ := List.length_eq_two.mp s.property.2.1 + refine ⟨a,b,Prod.ext hab ?_⟩ + have hn := s.property.2.2.1 + have hm := s.property.2.2.2 + norm_num at hm + omega + +def generator (s : Shape L 2) : φ.ker := + ⟨(v (s.val.1.headD root))⁻¹ * v (s.val.1.tail.headD root),by simp [hv]⟩ + +def includeVertices : (φ.ker →₀ ℤ) →ₗ[ℤ] CubicalChains.Chains G A := + Finsupp.lmapDomain ℤ ℤ (fun g => (g.val,[])) +omit [LinearOrder A] in +@[simp] theorem includeVertices_single (g : φ.ker) (n : ℤ) : + includeVertices (A := A) φ (Finsupp.single g n) = Finsupp.single (g.val,[]) n := by simp [includeVertices] +omit [LinearOrder A] in +theorem includeVertices_injective : Function.Injective (includeVertices (A := A) φ) := by + apply Finsupp.mapDomain_injective + intro p q he + exact Subtype.ext (congrArg Prod.fst he) + +include hv in +omit [LinearOrder A] in +theorem boundary_square (g : G) (a b : A) (hab : Commute (v a) (v b)) + (hg : ht φ g = -1) : + levelBoundary v (ht φ) (Finsupp.single (g,[a,b]) 1) = + Finsupp.single (g*v b,[]) 1 - Finsupp.single (g*v a,[]) 1 := by + have hga : ht φ (g * v a) = 0 := by rw [ht_step φ v hv,hg]; omega + have hgb : ht φ (g * v b) = 0 := by rw [ht_step φ v hv,hg]; omega + simp only [levelBoundary_apply,boundary_single,one_smul,boundaryTerm_cons,boundaryTerm_nil, + map_zero,sub_zero,map_sub,front_single,plus,select_single,hga,hgb,hg] + norm_num + rw [mul_assoc,hab.eq,← mul_assoc] + abel + + +include hv comm in +theorem levelBoundary_include_single (p : φ.ker × Shape L 2) : + levelBoundary v (ht φ) (includeBasis L φ v root 2 (Finsupp.single p 1)) = + includeVertices (A := A) φ (edgeBoundary (generator L φ v root hv) (Finsupp.single p 1)) := by + rcases p with ⟨g,⟨⟨w,n⟩,hs⟩⟩ + obtain ⟨a,b,hw⟩ := List.length_eq_two.mp hs.2.1 + change w = [a,b] at hw + subst w + have hn : n = -1 := by have h₁ := hs.2.2.1; have h₂ := hs.2.2.2; norm_num at h₂; omega + subst n + have hab : L.Adj a b := (List.pairwise_cons.mp hs.1.2).1 b (by simp) + rw [includeBasis_single] + change levelBoundary v (ht φ) (Finsupp.single (g.val * (v a)^(-1 : ℤ),[a,b]) 1) = _ + rw [boundary_square φ v hv _ a b (comm a b hab) (by simp [ht_generator φ v hv])] + simp only [edgeBoundary,Finsupp.linearCombination_single] + simp only [zpow_neg_one,one_smul,map_sub,includeVertices_single, + Subgroup.coe_mul,generator,List.headD_cons,List.tail_cons,mul_assoc,inv_mul_cancel,mul_one] + +include hv comm in +theorem levelBoundary_include (c : φ.ker × Shape L 2 →₀ ℤ) : + levelBoundary v (ht φ) (includeBasis L φ v root 2 c) = + includeVertices (A := A) φ (edgeBoundary (generator L φ v root hv) c) := by + induction c using Finsupp.induction_linear with + | zero => simp + | add c d hc hd => simp only [map_add,hc,hd] + | single p n => + have he : Finsupp.single p n = n • Finsupp.single p (1 : ℤ) := by simp + rw [he,map_smul,map_smul,map_smul,map_smul,levelBoundary_include_single L φ v root hv comm] + +/-- The literal based integral boundary of the crossing three-cubes. -/ +def triangleBoundary : (φ.ker × Shape L 3 →₀ ℤ) →ₗ[ℤ] (φ.ker × Shape L 2 →₀ ℤ) := + (projectBasis L φ v root hv 2).comp ((crossPart (ht φ)).comp ((boundary v).comp (includeBasis L φ v root 3))) + +include hv in +theorem triangleBoundary_inclusion (c : φ.ker × Shape L 3 →₀ ℤ) : + includeBasis L φ v root 2 (triangleBoundary L φ v root hv c) = + crossPart (ht φ) (boundary v (includeBasis L φ v root 3 c)) := by + apply include_project L φ v root hv + exact crossPart_mem L (ht φ) (boundary_total L v (ht φ) (ht_step φ v hv) + (crossing_total L (ht φ) (includeBasis_mem L φ v root hv 3 c))) + +include hv comm in +theorem triangleBoundary_cycle (c : φ.ker × Shape L 3 →₀ ℤ) : + triangleBoundary L φ v root hv c ∈ cycles (generator L φ v root hv) := by + apply includeVertices_injective φ + rw [map_zero,← levelBoundary_include L φ v root hv comm,triangleBoundary_inclusion L φ v root hv] + exact levelBoundary_cross_boundary L v (ht φ) (ht_step φ v hv) comm (includeBasis_mem L φ v root hv 3 c) + +variable (K : SimplicialChains.Contraction L) +variable (exactTotal : ∀ {k : ℕ}, 0 < k → ∀ c, c ∈ total (G := G) L k → boundary v c = 0 → + ∃ b ∈ total (G := G) L (k+1), boundary v b = c) +variable (dim : ∀ w, SimplicialChains.Valid L w → w.length ≤ 3) +include hv comm K exactTotal in +theorem triangleBoundary_range : LinearMap.range (triangleBoundary L φ v root hv) = + cycles (generator L φ v root hv) := by + apply le_antisymm + · rintro _ ⟨c,rfl⟩ + exact triangleBoundary_cycle L φ v root hv comm c + · intro c hc + have hz : levelBoundary v (ht φ) (includeBasis L φ v root 2 c) = 0 := by + rw [levelBoundary_include L φ v root hv comm,LinearMap.mem_ker.mp hc,map_zero] + obtain ⟨t,ht,hdt⟩ := level_cycle_bounds L v (ht φ) K (ht_step φ v hv) comm exactTotal + _ (includeBasis_mem L φ v root hv 2 c) hz + rw [← includeBasis_range L φ v root hv 3] at ht + obtain ⟨b,rfl⟩ := ht + refine ⟨b,includeBasis_injective L φ v root hv 2 ?_⟩ + rwa [triangleBoundary_inclusion L φ v root hv] + +include hv comm K exactTotal dim in +theorem triangleBoundary_injective : Function.Injective (triangleBoundary L φ v root hv) := by + suffices hz : ∀ c, triangleBoundary L φ v root hv c = 0 → c = 0 by + intro c d he + exact sub_eq_zero.mp (hz (c-d) (by simp only [map_sub,he,sub_self])) + intro c hc + apply includeBasis_injective L φ v root hv 3 + rw [map_zero] + apply level_boundary_injective L v (ht φ) K (ht_step φ v hv) comm exactTotal dim + _ (includeBasis_mem L φ v root hv 3 c) + rw [← triangleBoundary_inclusion L φ v root hv,hc,map_zero] + + +/-- Left translation on the actual ambient cube chains. -/ +def leftTranslate (g : G) : CubicalChains.Chains G A →ₗ[ℤ] CubicalChains.Chains G A := + Finsupp.lmapDomain ℤ ℤ (fun p => (g*p.1,p.2)) +omit [LinearOrder A] in +@[simp] theorem leftTranslate_single (g q : G) (w : List A) (n : ℤ) : + leftTranslate g (Finsupp.single (q,w) n) = Finsupp.single (g*q,w) n := by simp [leftTranslate] +omit [LinearOrder A] in +theorem leftTranslate_front (g : G) (a : A) (c : CubicalChains.Chains G A) : + leftTranslate g (CubicalChains.front a c) = CubicalChains.front a (leftTranslate g c) := by + induction c using Finsupp.induction_linear with + | zero => simp + | add c d hc hd => simp only [map_add,hc,hd] + | single p n => rcases p with ⟨q,w⟩; simp +omit [LinearOrder A] in +theorem leftTranslate_boundaryTerm (g q : G) (w : List A) : + leftTranslate g (boundaryTerm v q w) = boundaryTerm v (g*q) w := by + induction w with + | nil => simp + | cons a w ih => simp only [boundaryTerm_cons,map_sub,leftTranslate_single,leftTranslate_front,ih,mul_assoc] +omit [LinearOrder A] in +theorem leftTranslate_boundary (g : G) (c : CubicalChains.Chains G A) : + leftTranslate g (boundary v c) = boundary v (leftTranslate g c) := by + induction c using Finsupp.induction_linear with + | zero => simp + | add c d hc hd => simp only [map_add,hc,hd] + | single p n => rcases p with ⟨q,w⟩; simp [leftTranslate_boundaryTerm] +omit [LinearOrder A] in +theorem leftTranslate_crossPart (g : φ.ker) (c : CubicalChains.Chains G A) : + leftTranslate g.val (crossPart (ht φ) c) = crossPart (ht φ) (leftTranslate g.val c) := by + induction c using Finsupp.induction_linear with + | zero => simp + | add c d hc hd => simp only [map_add,hc,hd] + | single p n => + rcases p with ⟨q,w⟩ + simp only [crossPart,select_single,leftTranslate_single,ht_mul,ht_ker,zero_add] + split <;> simp_all + +theorem includeBasis_translate (k : ℕ) (g : φ.ker) (c : φ.ker × Shape L k →₀ ℤ) : + includeBasis L φ v root k (translateChains g c) = leftTranslate g.val (includeBasis L φ v root k c) := by + induction c using Finsupp.induction_linear with + | zero => simp + | add c d hc hd => simp only [map_add,hc,hd] + | single p n => + rcases p with ⟨q,s⟩ + simp only [translateChains_single,includeBasis_single,leftTranslate_single,basisIndex, + Subgroup.coe_mul,mul_assoc] + +include hv in +theorem triangleBoundary_equivariant : ChainsEquivariant (triangleBoundary L φ v root hv) := by + intro g c + apply includeBasis_injective L φ v root hv 2 + rw [triangleBoundary_inclusion L φ v root hv,includeBasis_translate, + ← leftTranslate_boundary,← leftTranslate_crossPart,includeBasis_translate, + triangleBoundary_inclusion L φ v root hv] + +end EilenbergGanea.LevelBasis + +namespace EilenbergGanea.LevelBasis +variable {V : Type} [LinearOrder V] (L : SimpleGraph V) + +def pairShape (a b : V) (hab : a < b) (hadj : L.Adj a b) : Shape L 2 := + ⟨([a,b],-1),by simp [SimplicialChains.Valid,hab,hadj]⟩ + +@[simp] theorem generator_pair (root a b : V) (hab : a < b) (hadj : L.Adj a b) : + (generator L (height L) (artinGenerator L) root (height_generator L) + (pairShape L a b hab hadj)).val = (artinGenerator L a)⁻¹ * artinGenerator L b := rfl + +/-- The actual oriented crossing-square edges generate precisely the height kernel. -/ +theorem generator_surjective (hconn : L.Preconnected) (root : V) : + Function.Surjective (FreeGroup.lift (generator L (height L) (artinGenerator L) root (height_generator L))) := by + let f := FreeGroup.lift (generator L (height L) (artinGenerator L) root (height_generator L)) + let F := (height L).ker.subtype.comp f + have hgen : edgeGenerated L ≤ F.range := by + apply (Subgroup.closure_le _).mpr + rintro x ⟨a,b,hadj,rfl⟩ + have hab : a ≠ b := L.ne_of_adj hadj + rcases lt_or_gt_of_ne hab with hab | hab + · refine ⟨(FreeGroup.of (pairShape L a b hab hadj))⁻¹,?_⟩ + change (f ((FreeGroup.of (pairShape L a b hab hadj))⁻¹)).val = _ + simp only [f,map_inv,FreeGroup.lift_apply_of,Subgroup.coe_inv,generator_pair,mul_inv_rev,inv_inv] + exact (adjacent_generators_commute L hadj).inv_right.eq.symm + · refine ⟨FreeGroup.of (pairShape L b a hab hadj.symm),?_⟩ + change (f (FreeGroup.of (pairShape L b a hab hadj.symm))).val = _ + simp only [f,FreeGroup.lift_apply_of,generator_pair] + exact (adjacent_generators_commute L hadj).inv_right.eq.symm + intro g + have he : g.val ∈ edgeGenerated L := by rw [edgeGenerated_eq_height_kernel L hconn root]; exact g.property + obtain ⟨w,hw⟩ := hgen he + exact ⟨w,Subtype.ext hw⟩ + +end EilenbergGanea.LevelBasis + +namespace EilenbergGanea.LevelBasis +open CubicalChains CubicalChains.HeightFiltration +variable {V : Type} [LinearOrder V] [Fintype V] [Nonempty V] (L : SimpleGraph V) + +/-- The exactness input to the level slicing is the actual RAAG cube-chain +contraction, not an assumption about a classifying space. -/ +theorem artin_total_cycle_bounds {k : ℕ} (hk : 0 < k) + (c : Chains (ArtinGroup L) V) (hc : c ∈ total (G := ArtinGroup L) L k) + (hz : boundary (artinGenerator L) c = 0) : + ∃ b ∈ total (G := ArtinGroup L) L (k+1), boundary (artinGenerator L) b = c := by + have he : ∀ n, total (G := ArtinGroup L) L n = TraceWords.CubeDescents.positiveChains L n := by + intro n + simp only [total,TraceWords.CubeDescents.positiveChains,SimplicialChains.Valid,and_assoc] + rw [he] at hc ⊢ + exact TraceWords.CubeDescents.positive_cycle_bounds L hk c hc hz + +/-- Integral cd at most two for the genuine height kernel, from a genuine +finite augmented link contraction and the dimension of its flag complex. -/ +theorem artin_height_kernel_cd_le_two (root : V) (hconn : L.Preconnected) + (K : SimplicialChains.Contraction L) + (dim : ∀ w, SimplicialChains.Valid L w → w.length ≤ 3) : + cohomologicalDimension (height L).ker ≤ 2 := by + exact projectiveDimension_le_two_of_boundary_basis + (generator L (height L) (artinGenerator L) root (height_generator L)) + (generator_surjective L hconn root) + (triangleBoundary L (height L) (artinGenerator L) root (height_generator L)) + (triangleBoundary_equivariant L (height L) (artinGenerator L) root (height_generator L)) + (triangleBoundary_injective L (height L) (artinGenerator L) root (height_generator L) + (fun _ _ h => adjacent_generators_commute L h) K (artin_total_cycle_bounds L) dim) + (triangleBoundary_range L (height L) (artinGenerator L) root (height_generator L) + (fun _ _ h => adjacent_generators_commute L h) K (artin_total_cycle_bounds L)) +end EilenbergGanea.LevelBasis +namespace EilenbergGanea.LevelBasis +open CubicalChains CubicalChains.LevelExact CubicalChains.HeightFiltration +variable {G A : Type} [Group G] [LinearOrder A] +variable (L : SimpleGraph A) (φ : G →* Multiplicative ℤ) (v : A → G) (root : A) +variable (hv : ∀ a, φ (v a) = Multiplicative.ofAdd (1 : ℤ)) +variable (comm : ∀ a b, L.Adj a b → Commute (v a) (v b)) + +instance shape_finite [Fintype A] (k : ℕ) : Finite (Shape L k) := by + let f : Shape L k → List.Vector A k × Fin k := fun s => + (⟨s.val.1,s.property.2.1⟩,⟨(-s.val.2).toNat,by + have hn := s.property.2.2.1 + have hm := s.property.2.2.2 + omega⟩) + apply Finite.of_injective f + intro s t h + apply Subtype.ext + apply Prod.ext + · exact congrArg (fun p : List.Vector A k × Fin k => p.1.val) h + · have he := congrArg (fun p : List.Vector A k × Fin k => p.2.val) h + have hs := s.property.2.2.1 + have ht := t.property.2.2.1 + dsimp [f] at he + omega + +noncomputable instance shape_fintype [Fintype A] (k : ℕ) : Fintype (Shape L k) := Fintype.ofFinite _ + +def edgeShape (a b : A) (hab : SimplicialChains.Valid L [a,b]) : Shape L 2 := + ⟨([a,b],-1),hab,rfl,by norm_num,by norm_num⟩ + +def triangleShape (a b c : A) (habc : SimplicialChains.Valid L [a,b,c]) + (n : ℤ) (hn : n = -1 ∨ n = -2) : Shape L 3 := + ⟨([a,b,c],n),habc,rfl,by omega,by norm_num; omega⟩ + +@[simp] theorem generator_edgeShape (a b : A) (hab : SimplicialChains.Valid L [a,b]) : + (generator L φ v root hv (edgeShape L a b hab) : G) = (v a)⁻¹ * v b := rfl + +theorem valid_triangle_edges {a b c : A} (h : SimplicialChains.Valid L [a,b,c]) : + SimplicialChains.Valid L [a,b] ∧ SimplicialChains.Valid L [a,c] ∧ + SimplicialChains.Valid L [b,c] := by + simp [SimplicialChains.Valid] at h ⊢ + tauto + +include comm in +theorem edge_values_compose (a b c : A) (h : SimplicialChains.Valid L [a,b,c]) : + ((v a)⁻¹ * v b) * ((v b)⁻¹ * v c) = (v a)⁻¹ * v c ∧ + ((v b)⁻¹ * v c) * ((v a)⁻¹ * v b) = (v a)⁻¹ * v c := by + have he := valid_triangle_edges L h + have ha : L.Adj a b := by simpa [SimplicialChains.Valid] using he.1.2 + have hb : L.Adj a c := by simpa [SimplicialChains.Valid] using he.2.1.2 + have hc : L.Adj b c := by simpa [SimplicialChains.Valid] using he.2.2.2 + constructor + · group + · calc + ((v b)⁻¹ * v c) * ((v a)⁻¹ * v b) = (v a)⁻¹ * ((v b)⁻¹ * v c) * v b := by + rw [← mul_assoc, + ((comm a b ha).inv_left.inv_right.mul_right (comm a c hb).inv_left).symm.eq] + _ = (v a)⁻¹ * v c := by + rw [mul_assoc,mul_assoc,← (comm b c hc).eq,inv_mul_cancel_left] + +def lowerTriangleWord (ab ac bc : Shape L 2) : FreeGroup (Shape L 2) := + FreeGroup.of ac * (FreeGroup.of bc)⁻¹ * (FreeGroup.of ab)⁻¹ + +def upperTriangleWord (ab ac bc : Shape L 2) : FreeGroup (Shape L 2) := + FreeGroup.of ab * (FreeGroup.of bc * FreeGroup.of ab * (FreeGroup.of ac)⁻¹) * + (FreeGroup.of ab)⁻¹ + +include comm in +theorem triangle_words_trivial (a b c : A) (h : SimplicialChains.Valid L [a,b,c]) : + let e := valid_triangle_edges L h + let ab := edgeShape L a b e.1 + let ac := edgeShape L a c e.2.1 + let bc := edgeShape L b c e.2.2 + wordValue (generator L φ v root hv) (lowerTriangleWord L ab ac bc) = 1 ∧ + wordValue (generator L φ v root hv) (upperTriangleWord L ab ac bc) = 1 := by + dsimp only + have he := edge_values_compose L v comm a b c h + constructor <;> apply Subtype.ext + · simp only [lowerTriangleWord,map_mul,map_inv,wordValue,FreeGroup.lift_apply_of, + Subgroup.coe_mul,Subgroup.coe_inv,generator_edgeShape,OneMemClass.coe_one] + group + · simp only [upperTriangleWord,map_mul,map_inv,wordValue,FreeGroup.lift_apply_of, + Subgroup.coe_mul,Subgroup.coe_inv,generator_edgeShape,OneMemClass.coe_one] + rw [he.2,mul_inv_cancel,mul_one,mul_inv_cancel] + +include hv in +theorem triangle_boundary_low (g : φ.ker) (a b c : A) + (h : SimplicialChains.Valid L [a,b,c]) : + let e := valid_triangle_edges L h + let ab := edgeShape L a b e.1 + let ac := edgeShape L a c e.2.1 + let bc := edgeShape L b c e.2.2 + triangleBoundary L φ v root hv + (Finsupp.single (g,triangleShape L a b c h (-1) (Or.inl rfl)) 1) = + Finsupp.single (g,ac) 1 - Finsupp.single (g,ab) 1 - + Finsupp.single (g * generator L φ v root hv ab,bc) 1 := by + dsimp only + apply includeBasis_injective L φ v root hv 2 + rw [triangleBoundary_inclusion L φ v root hv] + simp only [map_sub,includeBasis_single,basisIndex,triangleShape,edgeShape, + List.headD_cons,zpow_neg_one,Subgroup.coe_mul,generator,List.tail_cons] + simp only [boundary_single,one_smul,boundaryTerm_cons,boundaryTerm_nil,map_zero, + sub_zero,map_sub,front_single,crossPart,select,Finsupp.linearCombination_single, + ht_mul,ht_ker,ht_inv,ht_generator φ v hv,List.length_cons,List.length_nil] + norm_num + simp only [mul_assoc,mul_inv_cancel,mul_one] + abel + +include hv comm in +theorem triangle_boundary_high (g : φ.ker) (a b c : A) + (h : SimplicialChains.Valid L [a,b,c]) : + let e := valid_triangle_edges L h + let ab := edgeShape L a b e.1 + let ac := edgeShape L a c e.2.1 + let bc := edgeShape L b c e.2.2 + triangleBoundary L φ v root hv + (Finsupp.single (g,triangleShape L a b c h (-2) (Or.inr rfl)) 1) = + Finsupp.single (g * generator L φ v root hv ab,bc) 1 - + Finsupp.single (g * generator L φ v root hv ab,ac) 1 + + Finsupp.single (g * generator L φ v root hv ac,ab) 1 := by + dsimp only + have eh := valid_triangle_edges L h + have hab : L.Adj a b := by simpa [SimplicialChains.Valid] using eh.1.2 + have hac : L.Adj a c := by simpa [SimplicialChains.Valid] using eh.2.1.2 + apply includeBasis_injective L φ v root hv 2 + rw [triangleBoundary_inclusion L φ v root hv] + simp only [map_sub,map_add,includeBasis_single,basisIndex,triangleShape,edgeShape, + List.headD_cons,Subgroup.coe_mul,generator,List.tail_cons] + simp only [boundary_single,one_smul,boundaryTerm_cons,boundaryTerm_nil,map_zero, + sub_zero,map_sub,front_single,crossPart,select,map_sub,Finsupp.linearCombination_single, + ht_mul,ht_ker,ht_zpow,ht_generator φ v hv,List.length_cons,List.length_nil] + norm_num + have hb : (v a)^(-2 : ℤ) * v b = (v a)⁻¹ * v b * (v a)⁻¹ := by + calc + (v a)^(-2 : ℤ) * v b = (v a)⁻¹ * ((v a)⁻¹ * v b) := by group + _ = (v a)⁻¹ * (v b * (v a)⁻¹) := congrArg ((v a)⁻¹ * ·) (comm a b hab).inv_left.eq + _ = _ := (mul_assoc _ _ _).symm + have hc : (v a)^(-2 : ℤ) * v c = (v a)⁻¹ * v c * (v a)⁻¹ := by + calc + (v a)^(-2 : ℤ) * v c = (v a)⁻¹ * ((v a)⁻¹ * v c) := by group + _ = (v a)⁻¹ * (v c * (v a)⁻¹) := congrArg ((v a)⁻¹ * ·) (comm a c hac).inv_left.eq + _ = _ := (mul_assoc _ _ _).symm + have ha : (v a)^(-2 : ℤ) * v a = (v a)⁻¹ := by group + simp only [zpow_neg,zpow_ofNat] at ha hb hc + simp only [mul_assoc] at hb hc + simp only [mul_assoc,ha,hb,hc,mul_inv_cancel,mul_one] + abel + +section WordChains +variable (w : Shape L 2 → G) (ab ac bc : Shape L 2) +theorem lowerTriangleWord_chain (habc : w ab * w bc = w ac) (g : G) : + pathChain w (lowerTriangleWord L ab ac bc) g = + Finsupp.single (g,ac) 1 - Finsupp.single (g,ab) 1 - + Finsupp.single (g * w ab,bc) 1 := by + simp only [lowerTriangleWord,pathChain_mul,pathChain_inv,pathChain_of, + map_mul,map_inv,wordValue,FreeGroup.lift_apply_of] + rw [← habc] + simp only [mul_assoc,mul_inv_cancel,mul_one] + abel + +theorem upperTriangleWord_chain (habc : w ab * w bc = w ac) + (hbac : w bc * w ab = w ac) (g : G) : + pathChain w (upperTriangleWord L ab ac bc) g = + Finsupp.single (g * w ab,bc) 1 - Finsupp.single (g * w ab,ac) 1 + + Finsupp.single (g * w ac,ab) 1 := by + have hr : wordValue w (FreeGroup.of bc * FreeGroup.of ab * (FreeGroup.of ac)⁻¹) = 1 := by + simp only [wordValue,map_mul,map_inv,FreeGroup.lift_apply_of,hbac,mul_inv_cancel] + rw [upperTriangleWord,pathChain_conjugate w _ _ hr] + simp only [pathChain_mul,pathChain_inv,pathChain_of,map_mul,wordValue, + FreeGroup.lift_apply_of] + rw [hbac] + simp only [mul_assoc,habc,mul_inv_cancel,mul_one] + abel +end WordChains + +include comm in +theorem triangle_words_chain (g : φ.ker) (a b c : A) (h : SimplicialChains.Valid L [a,b,c]) : + let e := valid_triangle_edges L h + let ab := edgeShape L a b e.1 + let ac := edgeShape L a c e.2.1 + let bc := edgeShape L b c e.2.2 + pathChain (generator L φ v root hv) (lowerTriangleWord L ab ac bc) g = + triangleBoundary L φ v root hv + (Finsupp.single (g,triangleShape L a b c h (-1) (Or.inl rfl)) 1) ∧ + pathChain (generator L φ v root hv) (upperTriangleWord L ab ac bc) g = + triangleBoundary L φ v root hv + (Finsupp.single (g,triangleShape L a b c h (-2) (Or.inr rfl)) 1) := by + dsimp only + have he := edge_values_compose L v comm a b c h + have h₁ : generator L φ v root hv (edgeShape L a b (valid_triangle_edges L h).1) * + generator L φ v root hv (edgeShape L b c (valid_triangle_edges L h).2.2) = + generator L φ v root hv (edgeShape L a c (valid_triangle_edges L h).2.1) := + Subtype.ext he.1 + have h₂ : generator L φ v root hv (edgeShape L b c (valid_triangle_edges L h).2.2) * + generator L φ v root hv (edgeShape L a b (valid_triangle_edges L h).1) = + generator L φ v root hv (edgeShape L a c (valid_triangle_edges L h).2.1) := + Subtype.ext he.2 + constructor + · rw [lowerTriangleWord_chain L _ _ _ _ h₁,triangle_boundary_low L φ v root hv] + · rw [upperTriangleWord_chain L _ _ _ _ h₁ h₂, + triangle_boundary_high L φ v root hv comm] + +def triangleWordList : (w : List A) → SimplicialChains.Valid L w → ℤ → FreeGroup (Shape L 2) + | [a,b,c],h,n => + let e := valid_triangle_edges L h + if n = -1 then + lowerTriangleWord L (edgeShape L a b e.1) (edgeShape L a c e.2.1) (edgeShape L b c e.2.2) + else upperTriangleWord L (edgeShape L a b e.1) (edgeShape L a c e.2.1) (edgeShape L b c e.2.2) + | _,_,_ => 1 + +def triangleWord (s : Shape L 3) : FreeGroup (Shape L 2) := + triangleWordList L s.val.1 s.property.1 s.val.2 + +theorem shape_three_form (s : Shape L 3) : + ∃ (a b c : A) (h : SimplicialChains.Valid L [a,b,c]) (n : ℤ) (hn : n = -1 ∨ n = -2), + s = triangleShape L a b c h n hn := by + obtain ⟨a,b,c,hw⟩ := List.length_eq_three.mp s.property.2.1 + have hn : s.val.2 = -1 ∨ s.val.2 = -2 := by + have h₁ := s.property.2.2.1 + have h₂ := s.property.2.2.2 + norm_num at h₂ + omega + refine ⟨a,b,c,hw ▸ s.property.1,s.val.2,hn,?_⟩ + exact Subtype.ext (Prod.ext hw rfl) + +include comm in +theorem triangleWord_trivial (s : Shape L 3) : + wordValue (generator L φ v root hv) (triangleWord L s) = 1 := by + obtain ⟨a,b,c,h,n,hn,rfl⟩ := shape_three_form L s + rcases hn with rfl | rfl + · simpa [triangleWord,triangleWordList,triangleShape] using + (triangle_words_trivial L φ v root hv comm a b c h).1 + · simpa [triangleWord,triangleWordList,triangleShape] using + (triangle_words_trivial L φ v root hv comm a b c h).2 + +include comm in +theorem triangleWord_chain (s : Shape L 3) (g : φ.ker) : + pathChain (generator L φ v root hv) (triangleWord L s) g = + triangleBoundary L φ v root hv (Finsupp.single (g,s) 1) := by + obtain ⟨a,b,c,h,n,hn,rfl⟩ := shape_three_form L s + rcases hn with rfl | rfl + · simpa [triangleWord,triangleWordList,triangleShape] using + (triangle_words_chain L φ v root hv comm g a b c h).1 + · simpa [triangleWord,triangleWordList,triangleShape] using + (triangle_words_chain L φ v root hv comm g a b c h).2 + +end EilenbergGanea.LevelBasis +namespace EilenbergGanea.LevelBasis +open CubicalChains CubicalChains.HeightFiltration +variable {G A : Type} [Group G] [LinearOrder A] +variable (L : SimpleGraph A) (φ : G →* Multiplicative ℤ) (v : A → G) (root : A) +variable (hv : ∀ a, φ (v a) = Multiplicative.ofAdd (1 : ℤ)) +variable (comm : ∀ a b, L.Adj a b → Commute (v a) (v b)) + +include comm in +theorem triangleBoundary_eq_relatorChainMap : + triangleBoundary L φ v root hv = + relatorChainMap (generator L φ v root hv) (triangleWord L) := by + apply Finsupp.lhom_ext' + intro p + apply LinearMap.ext + intro n + simp only [LinearMap.coe_comp,Function.comp_apply,Finsupp.lsingle_apply, + relatorChainMap,Finsupp.linearCombination_single] + have he : Finsupp.single p n = n • Finsupp.single p (1 : ℤ) := by simp + rw [he,map_smul,← triangleWord_chain L φ v root hv comm p.2 p.1] + +variable (K : SimplicialChains.Contraction L) +variable (exactTotal : ∀ {k : ℕ}, 0 < k → ∀ c, c ∈ total (G := G) L k → boundary v c = 0 → + ∃ b ∈ total (G := G) L (k+1), boundary v b = c) +variable (dim : ∀ w, SimplicialChains.Valid L w → w.length ≤ 3) + +noncomputable def triangleBasis : (φ.ker × Shape L 3 →₀ ℤ) ≃ₗ[ℤ] + cycles (generator L φ v root hv) := + LinearEquiv.ofBijective + ((triangleBoundary L φ v root hv).codRestrict (cycles (generator L φ v root hv)) + (triangleBoundary_cycle L φ v root hv comm)) + ⟨fun c d h => triangleBoundary_injective L φ v root hv comm K exactTotal dim + (congrArg Subtype.val h),fun c => by + have hc : c.val ∈ LinearMap.range (triangleBoundary L φ v root hv) := by + rw [triangleBoundary_range L φ v root hv comm K exactTotal] + exact c.property + obtain ⟨b,hb⟩ := hc + exact ⟨b,Subtype.ext hb⟩⟩ + +theorem triangleBasis_value (c : φ.ker × Shape L 3 →₀ ℤ) : + (triangleBasis L φ v root hv comm K exactTotal dim c : φ.ker × Shape L 2 →₀ ℤ) = + relatorChainMap (generator L φ v root hv) (triangleWord L) c := by + change triangleBoundary L φ v root hv c = _ + rw [triangleBoundary_eq_relatorChainMap L φ v root hv comm] + +end EilenbergGanea.LevelBasis +namespace EilenbergGanea.LevelBasis +open LevelTransport +variable {V : Type} [LinearOrder V] (L : SimpleGraph V) (root : V) (N : ℕ) + +noncomputable def levelEquiv : (height L).ker ≃ NegativeLevel L N where + toFun := fun g => ⟨(artinGenerator L root)⁻¹ ^ N * g.val,by + simp only [map_mul,map_pow,map_inv,height_generator] + rw [show height L g.val = 1 from g.property,mul_one] + change N • (-1 : ℤ) = -(N : ℤ) + simp⟩ + invFun := fun g => ⟨artinGenerator L root ^ N * g.val,by + change (height L (artinGenerator L root ^ N * g.val)).toAdd = 0 + simp only [map_mul,map_pow,height_generator] + change N • (1 : ℤ) + (height L g.val).toAdd = 0 + rw [g.property] + simp⟩ + left_inv := fun g => Subtype.ext (by dsimp; group) + right_inv := fun g => Subtype.ext (by dsimp; group) + +def basedLabel (a : NegativeLevel L N → V → V → SU2) + (g : (height L).ker) (s : Shape L 2) : SU2 := + a (levelEquiv L root N g) (s.val.1.tail.headD root) (s.val.1.headD root) + +@[simp] theorem basedLabel_edge (a : NegativeLevel L N → V → V → SU2) + (g : (height L).ker) (q r : V) (h : SimplicialChains.Valid L [q,r]) : + basedLabel L root N a g (edgeShape L q r h) = a (levelEquiv L root N g) r q := rfl + +theorem levelEquiv_edge (g : (height L).ker) (q r : V) + (h : SimplicialChains.Valid L [q,r]) : + levelEquiv L root N + (g * generator L (height L) (artinGenerator L) root (height_generator L) (edgeShape L q r h)) = + edgeVertex L N (levelEquiv L root N g) r q := by + have ha : L.Adj q r := by simpa [SimplicialChains.Valid] using h.2 + apply Subtype.ext + simp only [levelEquiv,Equiv.coe_fn_mk,Subgroup.coe_mul,generator_edgeShape,edgeVertex] + rw [mul_assoc, (adjacent_generators_commute L ha).inv_left.eq] + group + +theorem shape_two_presentation (s : Shape L 2) : + ∃ (q r : V) (h : SimplicialChains.Valid L [q,r]), s = edgeShape L q r h := by + obtain ⟨q,r,hw⟩ := List.length_eq_two.mp s.property.2.1 + have hn : s.val.2 = -1 := by + have h₁ := s.property.2.2.1 + have h₂ := s.property.2.2.2 + norm_num at h₂ + omega + refine ⟨q,r,hw ▸ s.property.1,?_⟩ + exact Subtype.ext (Prod.ext hw hn) + +theorem levelEquiv_edge_inv (g : (height L).ker) (q r : V) + (h : SimplicialChains.Valid L [q,r]) : + levelEquiv L root N + (g * (generator L (height L) (artinGenerator L) root (height_generator L) (edgeShape L q r h))⁻¹) = + edgeVertex L N (levelEquiv L root N g) q r := by + have he := levelEquiv_edge L root N + (g * (generator L (height L) (artinGenerator L) root (height_generator L) (edgeShape L q r h))⁻¹) + q r h + simp only [inv_mul_cancel_right] at he + simpa only [edgeVertex_reverse] using congrArg (fun x => edgeVertex L N x q r) he.symm + +variable (a : NegativeLevel L N → V → V → SU2) +variable (rev : ∀ g q r, a (edgeVertex L N g q r) r q = (a g q r)⁻¹) +include rev in +theorem basedLabel_inv_edge (g : (height L).ker) (q r : V) + (h : SimplicialChains.Valid L [q,r]) : + (basedLabel L root N a + (g * (generator L (height L) (artinGenerator L) root (height_generator L) (edgeShape L q r h))⁻¹) + (edgeShape L q r h))⁻¹ = a (levelEquiv L root N g) q r := by + rw [basedLabel_edge,levelEquiv_edge_inv,rev,inv_inv] + +def orientedWord (q r : V) (h : L.Adj q r) : FreeGroup (Shape L 2) := + if hlt : q < r then + (FreeGroup.of (edgeShape L q r (by simpa [SimplicialChains.Valid] using And.intro hlt h)))⁻¹ + else + FreeGroup.of (edgeShape L r q (by + have hlt' : r < q := lt_of_le_of_ne (le_of_not_gt hlt) (Ne.symm (L.ne_of_adj h)) + simpa [SimplicialChains.Valid] using And.intro hlt' h.symm)) + +theorem orientedWord_value (q r : V) (h : L.Adj q r) : + (wordValue (generator L (height L) (artinGenerator L) root (height_generator L)) + (orientedWord L q r h) : ArtinGroup L) = + artinGenerator L q * (artinGenerator L r)⁻¹ := by + unfold orientedWord + split_ifs + · simp only [map_inv,wordValue,FreeGroup.lift_apply_of,Subgroup.coe_inv,generator_edgeShape, + mul_inv_rev,inv_inv] + exact (adjacent_generators_commute L h).inv_right.symm.eq + · simp only [wordValue,FreeGroup.lift_apply_of,generator_edgeShape] + exact (adjacent_generators_commute L h).inv_right.symm.eq + +theorem levelEquiv_orientedWord (g : (height L).ker) (q r : V) (h : L.Adj q r) : + levelEquiv L root N + (g * wordValue (generator L (height L) (artinGenerator L) root (height_generator L)) + (orientedWord L q r h)) = edgeVertex L N (levelEquiv L root N g) q r := by + apply Subtype.ext + simp only [levelEquiv,Equiv.coe_fn_mk,Subgroup.coe_mul,orientedWord_value,edgeVertex,mul_assoc] + +include rev in +theorem orientedWord_product (g : (height L).ker) (q r : V) (h : L.Adj q r) : + pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) + (basedLabel L root N a) (orientedWord L q r h) g = a (levelEquiv L root N g) q r := by + unfold orientedWord + split_ifs + · simp only [pathProduct_inv,pathProduct_of,wordValue,FreeGroup.lift_apply_of] + exact basedLabel_inv_edge L root N a rev g q r _ + · exact pathProduct_of _ _ _ _ + + +include rev in +theorem inverse_edgeWord_product (g : (height L).ker) (q r : V) + (h : SimplicialChains.Valid L [q,r]) : + pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) + (basedLabel L root N a) (FreeGroup.of (edgeShape L q r h))⁻¹ g = + a (levelEquiv L root N g) q r := by + simp only [pathProduct_inv,pathProduct_of,wordValue,FreeGroup.lift_apply_of] + exact basedLabel_inv_edge L root N a rev g q r h + +variable (tri : ∀ g₀ g₁ g₂ q₀ r₀ q₁ r₁ q₂ r₂, + edgeVertex L N g₀ q₀ r₀ = g₁ → edgeVertex L N g₁ q₁ r₁ = g₂ → + edgeVertex L N g₂ q₂ r₂ = g₀ → a g₀ q₀ r₀ * a g₁ q₁ r₁ * a g₂ q₂ r₂ = 1) + +include rev tri in +theorem lowerTriangleWord_product (g : (height L).ker) (q r s : V) + (h : SimplicialChains.Valid L [q,r,s]) : + let e := valid_triangle_edges L h + pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) + (basedLabel L root N a) + (lowerTriangleWord L (edgeShape L q r e.1) (edgeShape L q s e.2.1) + (edgeShape L r s e.2.2)) g = 1 := by + let gen := generator L (height L) (artinGenerator L) root (height_generator L) + let e := valid_triangle_edges L h + let ab := edgeShape L q r e.1 + let ac := edgeShape L q s e.2.1 + let bc := edgeShape L r s e.2.2 + have he : gen ab * gen bc = gen ac := + Subtype.ext (edge_values_compose L (artinGenerator L) + (fun _ _ hh => adjacent_generators_commute L hh) q r s h).1 + have hc : gen ac * (gen bc)⁻¹ = gen ab := by rw [← he]; group + have hc' : g * gen ac * (gen bc)⁻¹ = g * gen ab := by rw [mul_assoc,hc] + have ha : g * gen ab * (gen ab)⁻¹ = g := by group + have T := tri (levelEquiv L root N g) (levelEquiv L root N (g * gen ac)) + (levelEquiv L root N (g * gen ab)) s q r s q r + (levelEquiv_edge L root N g q s e.2.1).symm + (by rw [← levelEquiv_edge_inv L root N (g * gen ac) r s e.2.2]; exact congrArg _ hc') + (by rw [← levelEquiv_edge_inv L root N (g * gen ab) q r e.1]; exact congrArg _ ha) + change pathProduct gen (basedLabel L root N a) (lowerTriangleWord L ab ac bc) g = 1 + simp only [lowerTriangleWord,pathProduct_mul,pathProduct_of,map_mul,map_inv, + wordValue,FreeGroup.lift_apply_of] + rw [hc] + rw [inverse_edgeWord_product L root N a rev _ r s e.2.2, + inverse_edgeWord_product L root N a rev _ q r e.1] + exact T + +include rev tri in +theorem upperInnerWord_product (g : (height L).ker) (q r s : V) + (h : SimplicialChains.Valid L [q,r,s]) : + let e := valid_triangle_edges L h + pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) + (basedLabel L root N a) + (FreeGroup.of (edgeShape L r s e.2.2) * FreeGroup.of (edgeShape L q r e.1) * + (FreeGroup.of (edgeShape L q s e.2.1))⁻¹) g = 1 := by + let gen := generator L (height L) (artinGenerator L) root (height_generator L) + let e := valid_triangle_edges L h + let ab := edgeShape L q r e.1 + let ac := edgeShape L q s e.2.1 + let bc := edgeShape L r s e.2.2 + have he : gen bc * gen ab = gen ac := + Subtype.ext (edge_values_compose L (artinGenerator L) + (fun _ _ hh => adjacent_generators_commute L hh) q r s h).2 + have hc : g * gen bc * gen ab = g * gen ac := by rw [mul_assoc,he] + have ha : g * gen ac * (gen ac)⁻¹ = g := by group + have T := tri (levelEquiv L root N g) (levelEquiv L root N (g * gen bc)) + (levelEquiv L root N (g * gen ac)) s r r q q s + (levelEquiv_edge L root N g r s e.2.2).symm + (by rw [← levelEquiv_edge L root N (g * gen bc) q r e.1]; exact congrArg _ hc) + (by rw [← levelEquiv_edge_inv L root N (g * gen ac) q s e.2.1]; exact congrArg _ ha) + change pathProduct gen (basedLabel L root N a) + (FreeGroup.of bc * FreeGroup.of ab * (FreeGroup.of ac)⁻¹) g = 1 + simp only [pathProduct_mul,pathProduct_of,map_mul,wordValue,FreeGroup.lift_apply_of] + rw [he,inverse_edgeWord_product L root N a rev _ q s e.2.1] + exact T + +include rev tri in +theorem upperTriangleWord_product (g : (height L).ker) (q r s : V) + (h : SimplicialChains.Valid L [q,r,s]) : + let e := valid_triangle_edges L h + pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) + (basedLabel L root N a) + (upperTriangleWord L (edgeShape L q r e.1) (edgeShape L q s e.2.1) + (edgeShape L r s e.2.2)) g = 1 := by + let gen := generator L (height L) (artinGenerator L) root (height_generator L) + let e := valid_triangle_edges L h + let ab := edgeShape L q r e.1 + let ac := edgeShape L q s e.2.1 + let bc := edgeShape L r s e.2.2 + have he : gen bc * gen ab = gen ac := + Subtype.ext (edge_values_compose L (artinGenerator L) + (fun _ _ hh => adjacent_generators_commute L hh) q r s h).2 + have hr : wordValue gen (FreeGroup.of bc * FreeGroup.of ab * (FreeGroup.of ac)⁻¹) = 1 := by + simp only [map_mul,map_inv,wordValue,FreeGroup.lift_apply_of,he,mul_inv_cancel] + change pathProduct gen (basedLabel L root N a) (upperTriangleWord L ab ac bc) g = 1 + rw [upperTriangleWord,pathProduct_conjugate_loop gen _ _ _ hr] + rw [upperInnerWord_product L root N a rev tri _ q r s h] + group + +include rev tri in +theorem triangleWord_product (s : Shape L 3) (g : (height L).ker) : + pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) + (basedLabel L root N a) (triangleWord L s) g = 1 := by + obtain ⟨q,r,t,h,n,hn,rfl⟩ := shape_three_form L s + rcases hn with rfl | rfl + · simpa [triangleWord,triangleWordList,triangleShape] using + lowerTriangleWord_product L root N a rev tri g q r t h + · simpa [triangleWord,triangleWordList,triangleShape] using + upperTriangleWord_product L root N a rev tri g q r t h + + +variable {L N} +def walkWord {g k : NegativeLevel L N} : Walk L N g k → FreeGroup (Shape L 2) + | .nil _ => 1 + | .cons q r h p => orientedWord L q r h * walkWord p + + theorem walkWord_endpoint {g k : NegativeLevel L N} (p : Walk L N g k) + (x : (height L).ker) (hx : levelEquiv L root N x = g) : + levelEquiv L root N + (x * wordValue (generator L (height L) (artinGenerator L) root (height_generator L)) + (walkWord p)) = k := by + induction p generalizing x with + | nil g => simpa [walkWord] using hx + | @cons g k q r h p ih => + simp only [walkWord,map_mul,← mul_assoc] + exact ih _ ((levelEquiv_orientedWord L root N x q r h).trans + (congrArg (fun t => edgeVertex L N t q r) hx)) + +include rev in + theorem walkWord_product {g k : NegativeLevel L N} (p : Walk L N g k) + (x : (height L).ker) (hx : levelEquiv L root N x = g) : + pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) + (basedLabel L root N a) (walkWord p) x = p.eval a := by + induction p generalizing x with + | nil g => simp [walkWord,Walk.eval] + | @cons g k q r h p ih => + rw [walkWord,pathProduct_mul,orientedWord_product L root N a rev x q r h] + rw [ih _ ((levelEquiv_orientedWord L root N x q r h).trans + (congrArg (fun t => edgeVertex L N t q r) hx)),hx] + rfl + +include rev in + theorem nontrivial_word_of_walk {g : NegativeLevel L N} (p : Walk L N g g) + (hp : p.eval a ≠ 1) : + ∃ (w : FreeGroup (Shape L 2)) (x : (height L).ker), + wordValue (generator L (height L) (artinGenerator L) root (height_generator L)) w = 1 ∧ + pathProduct (generator L (height L) (artinGenerator L) root (height_generator L)) + (basedLabel L root N a) w x ≠ 1 := by + let x := (levelEquiv L root N).symm g + have hx : levelEquiv L root N x = g := (levelEquiv L root N).apply_symm_apply g + refine ⟨walkWord p,x,?_,?_⟩ + · have he := walkWord_endpoint root p x hx + have he' := (levelEquiv L root N).injective (he.trans hx.symm) + exact mul_left_cancel (he'.trans (mul_one x).symm) + · rwa [walkWord_product root a rev p x hx] + +end EilenbergGanea.LevelBasis + +namespace EilenbergGanea.LevelBasis +open LevelTransport +variable {V : Type} [LinearOrder V] [Fintype V] [Nonempty V] (L : SimpleGraph V) +variable [Group.ResiduallyFinite (height L).ker] +variable (root : V) (hconn : L.Preconnected) +variable (K : SimplicialChains.Contraction L) +variable (dim : ∀ w, SimplicialChains.Valid L w → w.length ≤ 3) + +include root hconn K dim in +/-- The source obstruction's algebraic endpoint, with no cardinal bound on +an alleged presentation. Its geometric premise must still be derived from an +ordinary two-dimensional classifying CW space. -/ +theorem no_boundary_basis_presentation + (small : ∀ ε : ℝ, 0 < ε → + ∃ N : ℕ, 1 < N ∧ ∃ a : NegativeLevel L N → V → V → SU2, + (∀ g q r, a (edgeVertex L N g q r) r q = (a g q r)⁻¹) ∧ + (∀ g q r, dist (a g q r) 1 < ε) ∧ + (∀ g₀ g₁ g₂ q₀ r₀ q₁ r₁ q₂ r₂, + edgeVertex L N g₀ q₀ r₀ = g₁ → + edgeVertex L N g₁ q₁ r₁ = g₂ → + edgeVertex L N g₂ q₂ r₂ = g₀ → + a g₀ q₀ r₀ * a g₁ q₁ r₁ * a g₂ q₂ r₂ = 1) ∧ + ∃ (g : NegativeLevel L N) (p : Walk L N g g), p.eval a ≠ 1) + {A R : Type*} (a₀ : A → (height L).ker) + (ha₀ : Function.Surjective (wordValue a₀)) + (r₀ : R → FreeGroup A) (hr₀ : ∀ i, wordValue a₀ (r₀ i) = 1) + (hp₀ : (wordValue a₀).ker = Subgroup.normalClosure (Set.range r₀)) + (E : BasedChains (height L).ker R ≃ₗ[ℤ] cycles a₀) + (hE : ∀ c, (E c : BasedChains (height L).ker A) = relatorChainMap a₀ r₀ c) : False := by + let gen := generator L (height L) (artinGenerator L) root (height_generator L) + let comm := fun q r h => @adjacent_generators_commute V L q r h + let B := triangleBasis L (height L) (artinGenerator L) root (height_generator L) + comm K (artin_total_cycle_bounds L) dim + obtain ⟨η,hη,hηa⟩ := boundary_basis_small_transport gen + (generator_surjective L hconn root) (triangleWord L) + (triangleWord_trivial L (height L) (artinGenerator L) root (height_generator L) comm) + B (triangleBasis_value L (height L) (artinGenerator L) root (height_generator L) + comm K (artin_total_cycle_bounds L) dim) a₀ ha₀ r₀ hr₀ hp₀ E hE + obtain ⟨N,_,a,ha,hb,ht,g,p,hp⟩ := small η hη + obtain ⟨w,x,hw,hx⟩ := nontrivial_word_of_walk root a ha p hp + apply hx + exact hηa (basedLabel L root N a) + (fun x s => by + simpa only [basedLabel,Subtype.dist_eq,dist_eq_norm,OneMemClass.coe_one] using + hb (levelEquiv L root N x) (s.val.1.tail.headD root) (s.val.1.headD root)) + (triangleWord_product L root N a ha ht) w hw x + +end EilenbergGanea.LevelBasis + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/LevelTransport.lean b/lean/OAI/Topology/EilenbergGanea/LevelTransport.lean index 6aef94404be17a91288e78f9f9f6d8a6f6caf4fb..5a878c8ad16815d21a8df5c31a124e217b18c5ff 100644 --- a/lean/OAI/Topology/EilenbergGanea/LevelTransport.lean +++ b/lean/OAI/Topology/EilenbergGanea/LevelTransport.lean @@ -1,626 +1,626 @@ -import OAI.Topology.EilenbergGanea.AffineTransport -import OAI.Topology.EilenbergGanea.SeedConnection - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -namespace EilenbergGanea -namespace LevelTransport -open TraceWords AffineTransport - -variable {V : Type*} [Fintype V] [LinearOrder V] (L : SimpleGraph V) -variable (hdim : ∀ s : Finset V, (s : Set V).Pairwise L.Adj → s.card ≤ 3) - -def point (g : ArtinGroup L) (hg : 0 < traceLength L (artinNormalTrace L g)) : TrianglePoint V := - ⟨artinDirection L g,by - apply mem_triangleSet.mpr - refine ⟨(traceCounts L (artinNormalTrace L g)).support, - hdim _ (traceCounts_support_clique L _),⟨?_,?_⟩,?_⟩ - · exact traceDirection_nonneg L _ - · exact traceDirection_sum L hg - · intro v hv - simp only [Finsupp.notMem_support_iff] at hv - simp [artinDirection,traceDirection,hv]⟩ - -@[simp] theorem point_val (g : ArtinGroup L) (hg : 0 < traceLength L (artinNormalTrace L g)) : - (point L hdim g hg : V → ℝ) = artinDirection L g := rfl - -theorem point_mem_support (g : ArtinGroup L) (hg : 0 < traceLength L (artinNormalTrace L g)) - {v : V} (hv : (point L hdim g hg : V → ℝ) v ≠ 0) : - v ∈ (traceCounts L (artinNormalTrace L g)).support := by - by_contra h - have he := Finsupp.notMem_support_iff.mp h - exact hv (by simp [point,artinDirection,traceDirection,he]) - -theorem point_clique (g : ArtinGroup L) (hg : 0 < traceLength L (artinNormalTrace L g)) : - CliquePoint L (point L hdim g hg) := by - intro a ha v hv - by_cases hav : a = v - · exact Or.inl hav - · exact Or.inr (traceCounts_support_clique L _ - (point_mem_support L hdim g hg ha) (point_mem_support L hdim g hg hv) hav) - -/-- Both hypotheses refer to actual reduced Artin lengths, not an assumed word metric. -/ -theorem point_step (g : ArtinGroup L) (x : Letter V) - (hg : 0 < traceLength L (artinNormalTrace L g)) - (hgx : 0 < traceLength L (artinNormalTrace L (g * letterValue (artinGenerator L) x))) - (N : ℕ) (hNg : N ≤ traceLength L (artinNormalTrace L g)) - (hNgx : N ≤ traceLength L (artinNormalTrace L (g * letterValue (artinGenerator L) x))) : - Compatible L (point L hdim g hg) (point L hdim (g * letterValue (artinGenerator L) x) hgx) ∧ - dist (point L hdim g hg) (point L hdim (g * letterValue (artinGenerator L) x) hgx) ≤ - 2 / (N+1 : ℝ) := by - classical - obtain ⟨hs,n,_,hn,hbd⟩ := artinDirection_right_step L g x hg hgx - have hNn : N ≤ n := by rcases hn with ⟨he,_⟩ | ⟨he,_⟩ <;> omega - constructor - · intro v w hv hw - by_cases he : v = w - · exact Or.inl he - · apply Or.inr - apply hs _ _ he - · rcases hv with hv | hv - · exact Finset.mem_union_left _ (point_mem_support L hdim g hg hv) - · exact Finset.mem_union_right _ (point_mem_support L hdim _ hgx hv) - · rcases hw with hw | hw - · exact Finset.mem_union_left _ (point_mem_support L hdim g hg hw) - · exact Finset.mem_union_right _ (point_mem_support L hdim _ hgx hw) - · have hc : (N : ℝ) + 1 ≤ (n : ℝ) + 1 := by exact_mod_cast Nat.add_le_add_right hNn 1 - have hd : 0 < (N : ℝ) + 1 := by positivity - have hfrac : 2 / (n+1 : ℝ) ≤ 2 / (N+1 : ℝ) := - div_le_div_of_nonneg_left (by norm_num) hd hc - apply le_trans ?_ hfrac - change dist (artinDirection L g) (artinDirection L (g * letterValue (artinGenerator L) x)) ≤ _ - apply (dist_pi_le_iff (by positivity)).mpr - intro v - rw [Real.dist_eq,abs_sub_comm] - exact le_trans (Finset.single_le_sum (fun w _ => abs_nonneg (artinDirection L (g * letterValue (artinGenerator L) x) w - artinDirection L g w)) (Finset.mem_univ v)) hbd - - -/-- The integral level downstairs; the action is by left multiplication by the height kernel. -/ -abbrev NegativeLevel (N : ℕ) := {g : ArtinGroup L // (height L g).toAdd = -(N : ℤ)} - -omit [Fintype V] [LinearOrder V] in -theorem negative_level_length (N : ℕ) {g : ArtinGroup L} - (hg : (height L g).toAdd = -(N : ℤ)) : - N ≤ traceLength L (artinNormalTrace L g) := by - have hh := height_abs_le_traceLength L g - rw [hg,abs_neg,abs_of_nonneg (Nat.cast_nonneg N)] at hh - exact_mod_cast hh - -def levelPoint (N : ℕ) (hN : 0 < N) (g : NegativeLevel L N) : TrianglePoint V := - point L hdim g (lt_of_lt_of_le hN (negative_level_length L N g.property)) - -@[simp] theorem levelPoint_val (N : ℕ) (hN : 0 < N) (g : NegativeLevel L N) : - (levelPoint L hdim N hN g : V → ℝ) = artinDirection L g := rfl - -def upperVertex (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (v : V) : - NegativeLevel L (N-1) := - ⟨(g : ArtinGroup L) * artinGenerator L v,by - rw [map_mul,height_generator] - change (height L (g : ArtinGroup L)).toAdd + 1 = _ - rw [g.property] - omega⟩ - -def edgeVertex (N : ℕ) (g : NegativeLevel L N) (q r : V) : NegativeLevel L N := - ⟨(g : ArtinGroup L) * artinGenerator L q * (artinGenerator L r)⁻¹,by - simp only [map_mul,map_inv,height_generator] - change (height L (g : ArtinGroup L)).toAdd + 1 + -1 = _ - rw [g.property] - omega⟩ - -omit [Fintype V] [LinearOrder V] in -theorem edgeVertex_reverse (N : ℕ) (g : NegativeLevel L N) (q r : V) : - edgeVertex L N (edgeVertex L N g q r) r q = g := by - apply Subtype.ext - change (g : ArtinGroup L) * _ * _ * _ * _ = _ - group - -omit [Fintype V] [LinearOrder V] in -theorem upperVertex_reverse (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (q r : V) : - upperVertex L N hN (edgeVertex L N g q r) r = upperVertex L N hN g q := by - apply Subtype.ext - dsimp only [edgeVertex,upperVertex] - group - -theorem upperPoint_step (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (v : V) : - Compatible L (levelPoint L hdim N (by omega) g) - (levelPoint L hdim (N-1) (by omega) (upperVertex L N hN g v)) ∧ - dist (levelPoint L hdim N (by omega) g) - (levelPoint L hdim (N-1) (by omega) (upperVertex L N hN g v)) ≤ 2 / (N : ℝ) := by - let hu := upperVertex L N hN g v - have hlen := negative_level_length L N g.property - have hlen' := negative_level_length L (N-1) hu.property - dsimp only [hu,upperVertex] at hlen' - have H := point_step L hdim (g : ArtinGroup L) (v,true) - (lt_of_lt_of_le (by omega : 0 < N) hlen) - (by simpa only [letterValue_positive] using lt_of_lt_of_le (by omega : 0 < N-1) hlen') - (N-1) (le_trans (Nat.sub_le N 1) hlen) - (by simpa only [letterValue_positive] using hlen') - have he : ((N-1 : ℕ) : ℝ) + 1 = (N : ℝ) := by exact_mod_cast (show (N-1 : ℕ) + 1 = N by omega) - simpa only [levelPoint,upperVertex,letterValue_positive,he] using H - -variable (h : V → V → SU2) (Q : V → ℍ) - -def edgeLabel (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (q r : V) : SU2 := - edgeTransport h Q (levelPoint L hdim N (by omega) g) - (levelPoint L hdim (N-1) (by omega) (upperVertex L N hN g q)) - (levelPoint L hdim N (by omega) (edgeVertex L N g q r)) - -theorem edgeLabel_reverse (hf : FlatConnection L h) (hQ : GeneralPosition h Q) - (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (q r : V) : - edgeLabel L hdim h Q N hN (edgeVertex L N g q r) r q = - (edgeLabel L hdim h Q N hN g q r)⁻¹ := by - have h₁ := (upperPoint_step L hdim N hN g q).1 - have h₂ := (upperPoint_step L hdim N hN (edgeVertex L N g q r) r).1 - rw [upperVertex_reverse] at h₂ - unfold edgeLabel - rw [edgeVertex_reverse,upperVertex_reverse] - exact edgeTransport_reverse L h Q hf hQ h₁ (compatible_symm L h₂) - -theorem edgeLabel_uniform (hQ : GeneralPosition h Q) {ε : ℝ} (hε : 0 < ε) : - ∃ M : ℕ, ∀ N : ℕ, M ≤ N → ∀ hN : 1 < N, ∀ g : NegativeLevel L N, ∀ q r : V, - dist (edgeLabel L hdim h Q N hN g q r) 1 < ε := by - obtain ⟨δ,hδ,H⟩ := edgeTransport_uniform h Q hQ hε - obtain ⟨M,hM⟩ := exists_nat_gt (2 / δ) - refine ⟨M,?_⟩ - intro N hMN hN g q r - have hN0 : (0 : ℝ) < N := by exact_mod_cast (by omega : 0 < N) - have hbound : 2 / (N : ℝ) < δ := by - apply (div_lt_iff₀ hN0).mpr - have hMN' : (M : ℝ) ≤ N := by exact_mod_cast hMN - have hh := (div_lt_iff₀ hδ).mp hM - nlinarith - apply H - · exact lt_of_le_of_lt (upperPoint_step L hdim N hN g q).2 hbound - · have hh := (upperPoint_step L hdim N hN (edgeVertex L N g q r) r).2 - rw [upperVertex_reverse,dist_comm] at hh - exact lt_of_le_of_lt hh hbound - - -omit [LinearOrder V] in -/-- Six compatible generator pieces around a level triangle lie in one flat chart -once the three edge images are uniformly short. -/ -theorem triangle_of_short (hf : FlatConnection L h) (hQ : GeneralPosition h Q) - (b c d u v w : TrianglePoint V) (δ : ℝ) (hδ : 0 < δ) - (hsmall : 4 * δ < 1 / (Fintype.card V + 1 : ℝ)) - (hb : CliquePoint L b) (hc : CliquePoint L c) (hd : CliquePoint L d) - (hu : CliquePoint L u) (hv : CliquePoint L v) (hw : CliquePoint L w) - (hbu : Compatible L b u) (huc : Compatible L u c) - (hcv : Compatible L c v) (hvd : Compatible L v d) - (hdw : Compatible L d w) (hwb : Compatible L w b) - (dbu : dist b u ≤ δ) (duc : dist u c ≤ δ) - (dcv : dist c v ≤ δ) (dvd : dist v d ≤ δ) - (_ddw : dist d w ≤ δ) (dwb : dist w b ≤ δ) : - edgeTransport h Q b u c * edgeTransport h Q c v d * edgeTransport h Q d w b = 1 := by - have dbc : dist b c ≤ 2 * δ := by linarith [dist_triangle b u c] - have dbv : dist b v ≤ 3 * δ := by linarith [dist_triangle b c v] - have dbd : dist b d ≤ 4 * δ := by linarith [dist_triangle b v d] - have dbw : dist b w ≤ δ := by simpa only [dist_comm] using dwb - obtain ⟨a,ha⟩ := exists_large_coordinate b - apply edgeTransport_triangle L h Q hf hQ b c d u v w hbu huc hcv hvd hdw hwb - · exact nearby_star L ha hb (by simpa using lt_of_lt_of_le hδ (le_of_lt (by linarith : δ < 1 / (Fintype.card V + 1 : ℝ)))) - · exact nearby_star L ha hc (by linarith) - · exact nearby_star L ha hd (lt_of_le_of_lt dbd hsmall) - · exact nearby_star L ha hu (by linarith) - · exact nearby_star L ha hv (by linarith) - · exact nearby_star L ha hw (by linarith) - -/-- Every oriented three-edge loop with these actual level endpoints is flat. -In particular both kinds of sections of a three-cube are covered. -/ -theorem edgeLabel_triangle (hf : FlatConnection L h) (hQ : GeneralPosition h Q) - (N : ℕ) (hN : 1 < N) (hsize : 8 / (N : ℝ) < 1 / (Fintype.card V + 1 : ℝ)) - (g₀ g₁ g₂ : NegativeLevel L N) (q₀ r₀ q₁ r₁ q₂ r₂ : V) - (e₀ : edgeVertex L N g₀ q₀ r₀ = g₁) - (e₁ : edgeVertex L N g₁ q₁ r₁ = g₂) - (e₂ : edgeVertex L N g₂ q₂ r₂ = g₀) : - edgeLabel L hdim h Q N hN g₀ q₀ r₀ * - edgeLabel L hdim h Q N hN g₁ q₁ r₁ * - edgeLabel L hdim h Q N hN g₂ q₂ r₂ = 1 := by - have h₀ := upperPoint_step L hdim N hN g₀ q₀ - have h₁ := upperPoint_step L hdim N hN g₁ q₁ - have h₂ := upperPoint_step L hdim N hN g₂ q₂ - have j₀ := upperPoint_step L hdim N hN g₁ r₀ - have j₁ := upperPoint_step L hdim N hN g₂ r₁ - have j₂ := upperPoint_step L hdim N hN g₀ r₂ - rw [← e₀,upperVertex_reverse,e₀] at j₀ - rw [← e₁,upperVertex_reverse,e₁] at j₁ - rw [← e₂,upperVertex_reverse,e₂] at j₂ - unfold edgeLabel - rw [e₀,e₁,e₂] - apply triangle_of_short L h Q hf hQ _ _ _ _ _ _ (2/(N : ℝ)) - · positivity - · convert hsize using 1; ring - · exact point_clique L hdim _ _ - · exact point_clique L hdim _ _ - · exact point_clique L hdim _ _ - · exact point_clique L hdim _ _ - · exact point_clique L hdim _ _ - · exact point_clique L hdim _ _ - · exact h₀.1 - · exact compatible_symm L j₀.1 - · exact h₁.1 - · exact compatible_symm L j₁.1 - · exact h₂.1 - · exact compatible_symm L j₂.1 - · exact h₀.2 - · simpa only [dist_comm] using j₀.2 - · exact h₁.2 - · simpa only [dist_comm] using j₁.2 - · exact h₂.2 - · simpa only [dist_comm] using j₂.2 - - -/-- A vertex of the simplex is also an honest point of its two-skeleton. -/ -def vertexPoint (v : V) : TrianglePoint V := - ⟨fun w => if v = w then 1 else 0,by - apply mem_triangleSet.mpr - refine ⟨{v},by simp,⟨?_,?_⟩,?_⟩ - · intro w; dsimp only; split_ifs <;> norm_num - · simp - · intro w hw - simp only [Finset.mem_singleton] at hw - simp [Ne.symm hw]⟩ - -@[simp] theorem vertexPoint_val (v w : V) : - (vertexPoint v : V → ℝ) w = if v = w then 1 else 0 := rfl - -theorem star_vertex {a v : V} (hav : Related L a v) : Star L a (vertexPoint v) := by - intro w hw - have he : v = w := by by_contra hh; exact hw (by simp [vertexPoint,hh]) - simpa only [← he] using hav - -omit [Fintype V] [LinearOrder V] in -theorem negative_powers_upper {q r : V} (hqr : L.Adj q r) (n m : ℕ) : - (artinGenerator L q)⁻¹ ^ (n+1) * (artinGenerator L r)⁻¹ ^ m * artinGenerator L q = - (artinGenerator L q)⁻¹ ^ n * (artinGenerator L r)⁻¹ ^ m := by - have hc := (adjacent_generators_commute L hqr).inv_right.pow_right m - calc - _ = (artinGenerator L q)⁻¹ ^ n * - ((artinGenerator L q)⁻¹ * ((artinGenerator L r)⁻¹ ^ m * artinGenerator L q)) := by - simp only [pow_succ]; group - _ = (artinGenerator L q)⁻¹ ^ n * - ((artinGenerator L q)⁻¹ * (artinGenerator L q * (artinGenerator L r)⁻¹ ^ m)) := by - rw [← hc.eq] - _ = _ := by group - -/-- Negative commuting powers remain exactly in their two-coordinate face. -/ -theorem powersPoint_star {q r : V} (hqr : L.Adj q r) (n m : ℕ) - (hg : 0 < traceLength L (artinNormalTrace L - ((artinGenerator L q)⁻¹ ^ n * (artinGenerator L r)⁻¹ ^ m))) : - Star L q (point L hdim ((artinGenerator L q)⁻¹ ^ n * (artinGenerator L r)⁻¹ ^ m) hg) := by - intro v hv - by_cases hqv : q = v - · exact Or.inl hqv - by_cases hrv : r = v - · exact Or.inr (hrv ▸ hqr) - exfalso - apply hv - rw [point_val,direction_negative_commuting_powers L hqr] - simp [hqv,hrv] - -/-- Constant endpoint in the q-direction, stated with a concrete positive height. -/ -theorem powersPoint_first {q r : V} (hqr : L.Adj q r) (N : ℕ) (hN : 0 < N) - (hg : 0 < traceLength L (artinNormalTrace L - ((artinGenerator L q)⁻¹ ^ N * (artinGenerator L r)⁻¹ ^ 0))) : - point L hdim ((artinGenerator L q)⁻¹ ^ N * (artinGenerator L r)⁻¹ ^ 0) hg = - vertexPoint q := by - apply Subtype.ext - funext v - rw [point_val,vertexPoint_val,direction_negative_commuting_powers L hqr] - have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN - by_cases hv : q = v <;> simp [hv,hn] - -theorem powersPoint_last {q r : V} (hqr : L.Adj q r) (N : ℕ) (hN : 0 < N) - (hg : 0 < traceLength L (artinNormalTrace L - ((artinGenerator L q)⁻¹ ^ 0 * (artinGenerator L r)⁻¹ ^ N))) : - point L hdim ((artinGenerator L q)⁻¹ ^ 0 * (artinGenerator L r)⁻¹ ^ N) hg = - vertexPoint r := by - apply Subtype.ext - funext v - rw [point_val,vertexPoint_val,direction_negative_commuting_powers L hqr] - have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN - by_cases hv : r = v <;> simp [hv,hn] - -def powerVertex (N : ℕ) (q r : V) (j : ℕ) : NegativeLevel L N := - ⟨(artinGenerator L q)⁻¹ ^ (N - min j N) * (artinGenerator L r)⁻¹ ^ min j N,by - simp only [map_mul,map_pow,map_inv,height_generator] - change (N-min j N : ℕ) • (-1 : ℤ) + (min j N : ℕ) • (-1 : ℤ) = _ - simp only [nsmul_eq_mul,mul_neg,mul_one] - have hh : min j N ≤ N := min_le_right _ _ - omega⟩ - -omit [Fintype V] [LinearOrder V] in -theorem powerVertex_step (N : ℕ) {q r : V} (hqr : L.Adj q r) {j : ℕ} (hj : j < N) : - edgeVertex L N (powerVertex L N q r j) q r = powerVertex L N q r (j+1) := by - apply Subtype.ext - dsimp only [powerVertex,edgeVertex] - rw [min_eq_left (by omega : j ≤ N),min_eq_left (by omega : j+1 ≤ N)] - have he : N-j = (N-(j+1))+1 := by omega - rw [he,negative_powers_upper L hqr,pow_succ] - group - -omit [Fintype V] [LinearOrder V] in -theorem powerVertex_upper (N : ℕ) (hN : 1 < N) {q r : V} - (hqr : L.Adj q r) {j : ℕ} (hj : j < N) : - (upperVertex L N hN (powerVertex L N q r j) q : ArtinGroup L) = - (artinGenerator L q)⁻¹ ^ (N-(j+1)) * (artinGenerator L r)⁻¹ ^ j := by - dsimp only [powerVertex,upperVertex] - rw [min_eq_left (by omega : j ≤ N)] - have he : N-j = (N-(j+1))+1 := by omega - rw [he,negative_powers_upper L hqr] - -theorem powerVertex_star (N : ℕ) (hN : 0 < N) {q r : V} (hqr : L.Adj q r) (j : ℕ) : - Star L q (levelPoint L hdim N hN (powerVertex L N q r j)) := - powersPoint_star L hdim hqr _ _ _ - -theorem powerVertex_upper_star (N : ℕ) (hN : 1 < N) {q r : V} - (hqr : L.Adj q r) {j : ℕ} (hj : j < N) : - Star L q (levelPoint L hdim (N-1) (by omega) - (upperVertex L N hN (powerVertex L N q r j) q)) := by - unfold levelPoint - generalize_proofs hpos - simp only [powerVertex_upper L N hN hqr hj] at hpos ⊢ - exact powersPoint_star L hdim hqr _ _ _ - -theorem powerLabel_chart (hf : FlatConnection L h) (hQ : GeneralPosition h Q) - (N : ℕ) (hN : 1 < N) {q r : V} (hqr : L.Adj q r) {j : ℕ} (hj : j < N) : - edgeLabel L hdim h Q N hN (powerVertex L N q r j) q r = - chartTransport h Q q (levelPoint L hdim N (by omega) (powerVertex L N q r j)) - (levelPoint L hdim N (by omega) (powerVertex L N q r (j+1))) := by - have hb := upperPoint_step L hdim N hN (powerVertex L N q r j) q - have hc := upperPoint_step L hdim N hN (edgeVertex L N (powerVertex L N q r j) q r) r - rw [upperVertex_reverse] at hc - unfold edgeLabel - rw [edgeTransport_chart L h Q hf hQ hb.1 (compatible_symm L hc.1) - (powerVertex_star L hdim N (by omega) hqr j) (powerVertex_upper_star L hdim N hN hqr hj)] - · rw [powerVertex_step L N hqr hj] - · rw [powerVertex_step L N hqr hj] - exact powerVertex_star L hdim N (by omega) hqr (j+1) - - -/-- Directed walks retain the chosen generator pair, including parallel edges. -/ -inductive Walk (N : ℕ) : NegativeLevel L N → NegativeLevel L N → Type _ - | nil (g : NegativeLevel L N) : Walk N g g - | cons {g k : NegativeLevel L N} (q r : V) (hqr : L.Adj q r) - (p : Walk N (edgeVertex L N g q r) k) : Walk N g k - -namespace Walk -variable {L} {N : ℕ} - -def append {g k l : NegativeLevel L N} : Walk L N g k → Walk L N k l → Walk L N g l - | .nil _, p => p - | .cons q r hqr p, t => .cons q r hqr (append p t) - -def cast {g k g' k' : NegativeLevel L N} (p : Walk L N g k) - (hg : g = g') (hk : k = k') : Walk L N g' k' := hg ▸ hk ▸ p - -end Walk - -def walkProduct (N : ℕ) (hN : 1 < N) {g k : NegativeLevel L N} : Walk L N g k → SU2 - | .nil _ => 1 - | .cons (g := g) q r _ p => edgeLabel L hdim h Q N hN g q r * walkProduct N hN p - -@[simp] theorem walkProduct_nil (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) : - walkProduct L hdim h Q N hN (.nil g) = 1 := rfl - -@[simp] theorem walkProduct_cons (N : ℕ) (hN : 1 < N) {g k : NegativeLevel L N} - (q r : V) (hqr : L.Adj q r) (p : Walk L N (edgeVertex L N g q r) k) : - walkProduct L hdim h Q N hN (.cons q r hqr p) = - edgeLabel L hdim h Q N hN g q r * walkProduct L hdim h Q N hN p := rfl - -@[simp] theorem walkProduct_append (N : ℕ) (hN : 1 < N) {g k l : NegativeLevel L N} - (p : Walk L N g k) (t : Walk L N k l) : - walkProduct L hdim h Q N hN (p.append t) = - walkProduct L hdim h Q N hN p * walkProduct L hdim h Q N hN t := by - induction p with - | nil => simp [Walk.append] - | cons q r hqr p ih => simp [Walk.append,ih,mul_assoc] - -@[simp] theorem walkProduct_cast (N : ℕ) (hN : 1 < N) {g k g' k' : NegativeLevel L N} - (p : Walk L N g k) (hg : g = g') (hk : k = k') : - walkProduct L hdim h Q N hN (p.cast hg hk) = walkProduct L hdim h Q N hN p := by - subst g'; subst k'; rfl - -/-- The entire subdivided edge has the exact endpoint transport, not merely a limit. -/ -theorem exists_powerWalk (hf : FlatConnection L h) (hQ : GeneralPosition h Q) - (N : ℕ) (hN : 1 < N) {q r : V} (hqr : L.Adj q r) (k : ℕ) (hk : k ≤ N) : - ∃ p : Walk L N (powerVertex L N q r 0) (powerVertex L N q r k), - walkProduct L hdim h Q N hN p = - chartTransport h Q q (levelPoint L hdim N (by omega) (powerVertex L N q r 0)) - (levelPoint L hdim N (by omega) (powerVertex L N q r k)) := by - induction k with - | zero => exact ⟨.nil _,by simp [chartTransport]⟩ - | succ k ih => - obtain ⟨p,hp⟩ := ih (by omega) - let t : Walk L N (powerVertex L N q r k) - (edgeVertex L N (powerVertex L N q r k) q r) := .cons q r hqr (.nil _) - let t' := t.cast rfl (powerVertex_step L N hqr (by omega : k < N)) - refine ⟨p.append t',?_⟩ - rw [walkProduct_append,hp] - simp only [t',walkProduct_cast,t,walkProduct_cons,walkProduct_nil,mul_one] - rw [powerLabel_chart L hdim h Q hf hQ N hN hqr (by omega),chartTransport_trans] - -def pureVertex (N : ℕ) (q : V) : NegativeLevel L N := - ⟨(artinGenerator L q)⁻¹ ^ N,by - simp only [map_pow,map_inv,height_generator] - change N • (-1 : ℤ) = -(N : ℤ) - simp⟩ - -omit [Fintype V] [LinearOrder V] in -theorem powerVertex_zero (N : ℕ) (q r : V) : - powerVertex L N q r 0 = pureVertex L N q := by apply Subtype.ext; simp [powerVertex,pureVertex] - -omit [Fintype V] [LinearOrder V] in -theorem powerVertex_last (N : ℕ) (q r : V) : - powerVertex L N q r N = pureVertex L N r := by apply Subtype.ext; simp [powerVertex,pureVertex] - -def vertexGauge (v : V) : SU2 := gauge h Q v (vertexPoint v) - -theorem levelPoint_power_zero (N : ℕ) (hN : 0 < N) {q r : V} (hqr : L.Adj q r) : - levelPoint L hdim N hN (powerVertex L N q r 0) = vertexPoint q := by - unfold levelPoint - have hh : (powerVertex L N q r 0 : ArtinGroup L) = - (artinGenerator L q)⁻¹ ^ N * (artinGenerator L r)⁻¹ ^ 0 := by simp [powerVertex] - simp only [hh] - exact powersPoint_first L hdim hqr N hN _ - -theorem levelPoint_power_last (N : ℕ) (hN : 0 < N) {q r : V} (hqr : L.Adj q r) : - levelPoint L hdim N hN (powerVertex L N q r N) = vertexPoint r := by - unfold levelPoint - have hh : (powerVertex L N q r N : ArtinGroup L) = - (artinGenerator L q)⁻¹ ^ 0 * (artinGenerator L r)⁻¹ ^ N := by simp [powerVertex] - simp only [hh] - exact powersPoint_last L hdim hqr N hN _ - -theorem exists_expanded_edge (hf : FlatConnection L h) (hQ : GeneralPosition h Q) - (N : ℕ) (hN : 1 < N) {q r : V} (hqr : L.Adj q r) : - ∃ p : Walk L N (pureVertex L N q) (pureVertex L N r), - walkProduct L hdim h Q N hN p = - (vertexGauge h Q q)⁻¹ * h q r * vertexGauge h Q r := by - obtain ⟨p,hp⟩ := exists_powerWalk L hdim h Q hf hQ N hN hqr N le_rfl - refine ⟨p.cast (powerVertex_zero L N q r) (powerVertex_last L N q r),?_⟩ - rw [walkProduct_cast,hp,levelPoint_power_zero L hdim N (by omega) hqr, - levelPoint_power_last L hdim N (by omega) hqr] - unfold chartTransport vertexGauge - rw [gauge_transition L h Q hf hQ (Or.inr hqr) - (star_vertex L (Or.inr hqr)) (star_vertex L (Or.inl rfl))] - group - -omit [Fintype V] [LinearOrder V] in -def graphWalkProduct {a b : V} : L.Walk a b → SU2 - | .nil => 1 - | .cons (u := u) (v := v) _ p => h u v * graphWalkProduct p - -theorem exists_expanded_walk (hf : FlatConnection L h) (hQ : GeneralPosition h Q) - (N : ℕ) (hN : 1 < N) {q r : V} (w : L.Walk q r) : - ∃ p : Walk L N (pureVertex L N q) (pureVertex L N r), - walkProduct L hdim h Q N hN p = - (vertexGauge h Q q)⁻¹ * graphWalkProduct L h w * vertexGauge h Q r := by - induction w with - | nil => exact ⟨.nil _,by simp [graphWalkProduct]⟩ - | @cons q t r hqt w ih => - obtain ⟨p,hp⟩ := exists_expanded_edge L hdim h Q hf hQ N hN hqt - obtain ⟨s,hs⟩ := ih - refine ⟨p.append s,?_⟩ - rw [walkProduct_append,hp,hs] - simp only [graphWalkProduct] - group - -omit [Fintype V] [LinearOrder V] in -theorem graphWalkProduct_eq_zipWith {a b : V} (w : L.Walk a b) : - graphWalkProduct L h w = (List.zipWith h w.support w.support.tail).prod := by - induction w with - | nil => simp [graphWalkProduct] - | @cons q t r hqt w ih => - cases w with - | nil => simp [graphWalkProduct] - | cons htl p => simpa only [graphWalkProduct,SimpleGraph.Walk.support_cons, - List.tail_cons,List.zipWith_cons_cons,List.prod_cons] using congrArg (h q t * ·) ih - -/-- A nontrivial seed holonomy survives every sufficiently translated level. -/ -theorem exists_nontrivial_level_walk (hf : FlatConnection L h) (hQ : GeneralPosition h Q) - (N : ℕ) (hN : 1 < N) {q : V} (w : L.Walk q q) - (hw : graphWalkProduct L h w ≠ 1) : - ∃ p : Walk L N (pureVertex L N q) (pureVertex L N q), - walkProduct L hdim h Q N hN p ≠ 1 := by - obtain ⟨p,hp⟩ := exists_expanded_walk L hdim h Q hf hQ N hN w - refine ⟨p,?_⟩ - rw [hp] - intro he - apply hw - calc - graphWalkProduct L h w = vertexGauge h Q q * - ((vertexGauge h Q q)⁻¹ * graphWalkProduct L h w * vertexGauge h Q q) * - (vertexGauge h Q q)⁻¹ := by group - _ = 1 := by rw [he]; group - - -namespace Walk -variable {L} {N : ℕ} -omit [Fintype V] [LinearOrder V] in -def eval (a : NegativeLevel L N → V → V → SU2) - {g k : NegativeLevel L N} : Walk L N g k → SU2 - | .nil _ => 1 - | .cons (g := g) q r _ p => a g q r * eval a p -end Walk - -theorem walkProduct_eq_eval (N : ℕ) (hN : 1 < N) {g k : NegativeLevel L N} - (p : Walk L N g k) : - walkProduct L hdim h Q N hN p = p.eval (edgeLabel L hdim h Q N hN) := by - induction p with - | nil => rfl - | cons q r hqr p ih => simp only [walkProduct,Walk.eval,ih] - -end LevelTransport - -namespace SourceTransport -open LevelTransport AffineTransport - -def seedWalk : seedGraph.Walk (.inl (.inl none)) (.inl (.inl none)) := - SimpleGraph.Walk.ofSupport SeedConnection.roseLoop - (by simp [SeedConnection.roseLoop]) SeedConnection.roseLoop_edges - -theorem seedWalk_support : seedWalk.support = SeedConnection.roseLoop := - SimpleGraph.Walk.support_ofSupport _ _ - -theorem seedWalk_product_ne : graphWalkProduct seedGraph SeedConnection.connection seedWalk ≠ 1 := by - rw [graphWalkProduct_eq_zipWith,seedWalk_support] - exact SeedConnection.roseLoop_nontrivial - -/-- Actual small flat transport for the fixed source level graph. There are no -representation, direction-map, local-chart, or nontriviality hypotheses here. -/ -theorem source_small_labels (ε : ℝ) (hε : 0 < ε) : - ∃ N : ℕ, 1 < N ∧ ∃ a : NegativeLevel seedGraph N → SeedCell → SeedCell → SU2, - (∀ g q r, a (edgeVertex seedGraph N g q r) r q = (a g q r)⁻¹) ∧ - (∀ g q r, dist (a g q r) 1 < ε) ∧ - (∀ g₀ g₁ g₂ q₀ r₀ q₁ r₁ q₂ r₂, - edgeVertex seedGraph N g₀ q₀ r₀ = g₁ → - edgeVertex seedGraph N g₁ q₁ r₁ = g₂ → - edgeVertex seedGraph N g₂ q₂ r₂ = g₀ → - a g₀ q₀ r₀ * a g₁ q₁ r₁ * a g₂ q₂ r₂ = 1) ∧ - ∃ (g : NegativeLevel seedGraph N) (p : Walk seedGraph N g g), p.eval a ≠ 1 := by - let : LinearOrder SeedCell := LinearOrder.lift' (Fintype.equivFin SeedCell) - (Fintype.equivFin SeedCell).injective - obtain ⟨Q,hQ⟩ := exists_generalPosition SeedConnection.connection - have hf : FlatConnection seedGraph SeedConnection.connection := - fun _ _ _ hab hbc hac => SeedConnection.connection_flat hab hbc hac - obtain ⟨M,hM⟩ := edgeLabel_uniform seedGraph SeedConnection.clique_card_le_three - SeedConnection.connection Q hQ hε - let D := Fintype.card SeedCell + 1 - let N := max M (8 * D + 2) - have hMN : M ≤ N := le_max_left _ _ - have hNbound : 8 * D + 2 ≤ N := le_max_right _ _ - have hN : 1 < N := by omega - have hD : (0 : ℝ) < D := by dsimp [D]; positivity - have hNr : (0 : ℝ) < N := by exact_mod_cast (by omega : 0 < N) - have hsize : 8 / (N : ℝ) < 1 / (Fintype.card SeedCell + 1 : ℝ) := by - have hBN : (8 : ℝ) * D + 2 ≤ N := by exact_mod_cast hNbound - have hDcast : (D : ℝ) = (Fintype.card SeedCell : ℝ) + 1 := by simp [D] - rw [← hDcast] - apply (div_lt_div_iff₀ hNr hD).mpr - nlinarith - let a := edgeLabel seedGraph SeedConnection.clique_card_le_three - SeedConnection.connection Q N hN - refine ⟨N,hN,a,?_,?_,?_,?_⟩ - · exact edgeLabel_reverse seedGraph SeedConnection.clique_card_le_three - SeedConnection.connection Q hf hQ N hN - · exact hM N hMN hN - · exact edgeLabel_triangle seedGraph SeedConnection.clique_card_le_three - SeedConnection.connection Q hf hQ N hN hsize - · obtain ⟨p,hp⟩ := exists_nontrivial_level_walk seedGraph SeedConnection.clique_card_le_three - SeedConnection.connection Q hf hQ N hN seedWalk seedWalk_product_ne - refine ⟨_,p,?_⟩ - rwa [walkProduct_eq_eval] at hp - -end SourceTransport -end EilenbergGanea - - - -end - -end OAI +import OAI.Topology.EilenbergGanea.AffineTransport +import OAI.Topology.EilenbergGanea.SeedConnection + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +namespace EilenbergGanea +namespace LevelTransport +open TraceWords AffineTransport + +variable {V : Type*} [Fintype V] [LinearOrder V] (L : SimpleGraph V) +variable (hdim : ∀ s : Finset V, (s : Set V).Pairwise L.Adj → s.card ≤ 3) + +def point (g : ArtinGroup L) (hg : 0 < traceLength L (artinNormalTrace L g)) : TrianglePoint V := + ⟨artinDirection L g,by + apply mem_triangleSet.mpr + refine ⟨(traceCounts L (artinNormalTrace L g)).support, + hdim _ (traceCounts_support_clique L _),⟨?_,?_⟩,?_⟩ + · exact traceDirection_nonneg L _ + · exact traceDirection_sum L hg + · intro v hv + simp only [Finsupp.notMem_support_iff] at hv + simp [artinDirection,traceDirection,hv]⟩ + +@[simp] theorem point_val (g : ArtinGroup L) (hg : 0 < traceLength L (artinNormalTrace L g)) : + (point L hdim g hg : V → ℝ) = artinDirection L g := rfl + +theorem point_mem_support (g : ArtinGroup L) (hg : 0 < traceLength L (artinNormalTrace L g)) + {v : V} (hv : (point L hdim g hg : V → ℝ) v ≠ 0) : + v ∈ (traceCounts L (artinNormalTrace L g)).support := by + by_contra h + have he := Finsupp.notMem_support_iff.mp h + exact hv (by simp [point,artinDirection,traceDirection,he]) + +theorem point_clique (g : ArtinGroup L) (hg : 0 < traceLength L (artinNormalTrace L g)) : + CliquePoint L (point L hdim g hg) := by + intro a ha v hv + by_cases hav : a = v + · exact Or.inl hav + · exact Or.inr (traceCounts_support_clique L _ + (point_mem_support L hdim g hg ha) (point_mem_support L hdim g hg hv) hav) + +/-- Both hypotheses refer to actual reduced Artin lengths, not an assumed word metric. -/ +theorem point_step (g : ArtinGroup L) (x : Letter V) + (hg : 0 < traceLength L (artinNormalTrace L g)) + (hgx : 0 < traceLength L (artinNormalTrace L (g * letterValue (artinGenerator L) x))) + (N : ℕ) (hNg : N ≤ traceLength L (artinNormalTrace L g)) + (hNgx : N ≤ traceLength L (artinNormalTrace L (g * letterValue (artinGenerator L) x))) : + Compatible L (point L hdim g hg) (point L hdim (g * letterValue (artinGenerator L) x) hgx) ∧ + dist (point L hdim g hg) (point L hdim (g * letterValue (artinGenerator L) x) hgx) ≤ + 2 / (N+1 : ℝ) := by + classical + obtain ⟨hs,n,_,hn,hbd⟩ := artinDirection_right_step L g x hg hgx + have hNn : N ≤ n := by rcases hn with ⟨he,_⟩ | ⟨he,_⟩ <;> omega + constructor + · intro v w hv hw + by_cases he : v = w + · exact Or.inl he + · apply Or.inr + apply hs _ _ he + · rcases hv with hv | hv + · exact Finset.mem_union_left _ (point_mem_support L hdim g hg hv) + · exact Finset.mem_union_right _ (point_mem_support L hdim _ hgx hv) + · rcases hw with hw | hw + · exact Finset.mem_union_left _ (point_mem_support L hdim g hg hw) + · exact Finset.mem_union_right _ (point_mem_support L hdim _ hgx hw) + · have hc : (N : ℝ) + 1 ≤ (n : ℝ) + 1 := by exact_mod_cast Nat.add_le_add_right hNn 1 + have hd : 0 < (N : ℝ) + 1 := by positivity + have hfrac : 2 / (n+1 : ℝ) ≤ 2 / (N+1 : ℝ) := + div_le_div_of_nonneg_left (by norm_num) hd hc + apply le_trans ?_ hfrac + change dist (artinDirection L g) (artinDirection L (g * letterValue (artinGenerator L) x)) ≤ _ + apply (dist_pi_le_iff (by positivity)).mpr + intro v + rw [Real.dist_eq,abs_sub_comm] + exact le_trans (Finset.single_le_sum (fun w _ => abs_nonneg (artinDirection L (g * letterValue (artinGenerator L) x) w - artinDirection L g w)) (Finset.mem_univ v)) hbd + + +/-- The integral level downstairs; the action is by left multiplication by the height kernel. -/ +abbrev NegativeLevel (N : ℕ) := {g : ArtinGroup L // (height L g).toAdd = -(N : ℤ)} + +omit [Fintype V] [LinearOrder V] in +theorem negative_level_length (N : ℕ) {g : ArtinGroup L} + (hg : (height L g).toAdd = -(N : ℤ)) : + N ≤ traceLength L (artinNormalTrace L g) := by + have hh := height_abs_le_traceLength L g + rw [hg,abs_neg,abs_of_nonneg (Nat.cast_nonneg N)] at hh + exact_mod_cast hh + +def levelPoint (N : ℕ) (hN : 0 < N) (g : NegativeLevel L N) : TrianglePoint V := + point L hdim g (lt_of_lt_of_le hN (negative_level_length L N g.property)) + +@[simp] theorem levelPoint_val (N : ℕ) (hN : 0 < N) (g : NegativeLevel L N) : + (levelPoint L hdim N hN g : V → ℝ) = artinDirection L g := rfl + +def upperVertex (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (v : V) : + NegativeLevel L (N-1) := + ⟨(g : ArtinGroup L) * artinGenerator L v,by + rw [map_mul,height_generator] + change (height L (g : ArtinGroup L)).toAdd + 1 = _ + rw [g.property] + omega⟩ + +def edgeVertex (N : ℕ) (g : NegativeLevel L N) (q r : V) : NegativeLevel L N := + ⟨(g : ArtinGroup L) * artinGenerator L q * (artinGenerator L r)⁻¹,by + simp only [map_mul,map_inv,height_generator] + change (height L (g : ArtinGroup L)).toAdd + 1 + -1 = _ + rw [g.property] + omega⟩ + +omit [Fintype V] [LinearOrder V] in +theorem edgeVertex_reverse (N : ℕ) (g : NegativeLevel L N) (q r : V) : + edgeVertex L N (edgeVertex L N g q r) r q = g := by + apply Subtype.ext + change (g : ArtinGroup L) * _ * _ * _ * _ = _ + group + +omit [Fintype V] [LinearOrder V] in +theorem upperVertex_reverse (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (q r : V) : + upperVertex L N hN (edgeVertex L N g q r) r = upperVertex L N hN g q := by + apply Subtype.ext + dsimp only [edgeVertex,upperVertex] + group + +theorem upperPoint_step (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (v : V) : + Compatible L (levelPoint L hdim N (by omega) g) + (levelPoint L hdim (N-1) (by omega) (upperVertex L N hN g v)) ∧ + dist (levelPoint L hdim N (by omega) g) + (levelPoint L hdim (N-1) (by omega) (upperVertex L N hN g v)) ≤ 2 / (N : ℝ) := by + let hu := upperVertex L N hN g v + have hlen := negative_level_length L N g.property + have hlen' := negative_level_length L (N-1) hu.property + dsimp only [hu,upperVertex] at hlen' + have H := point_step L hdim (g : ArtinGroup L) (v,true) + (lt_of_lt_of_le (by omega : 0 < N) hlen) + (by simpa only [letterValue_positive] using lt_of_lt_of_le (by omega : 0 < N-1) hlen') + (N-1) (le_trans (Nat.sub_le N 1) hlen) + (by simpa only [letterValue_positive] using hlen') + have he : ((N-1 : ℕ) : ℝ) + 1 = (N : ℝ) := by exact_mod_cast (show (N-1 : ℕ) + 1 = N by omega) + simpa only [levelPoint,upperVertex,letterValue_positive,he] using H + +variable (h : V → V → SU2) (Q : V → ℍ) + +def edgeLabel (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (q r : V) : SU2 := + edgeTransport h Q (levelPoint L hdim N (by omega) g) + (levelPoint L hdim (N-1) (by omega) (upperVertex L N hN g q)) + (levelPoint L hdim N (by omega) (edgeVertex L N g q r)) + +theorem edgeLabel_reverse (hf : FlatConnection L h) (hQ : GeneralPosition h Q) + (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) (q r : V) : + edgeLabel L hdim h Q N hN (edgeVertex L N g q r) r q = + (edgeLabel L hdim h Q N hN g q r)⁻¹ := by + have h₁ := (upperPoint_step L hdim N hN g q).1 + have h₂ := (upperPoint_step L hdim N hN (edgeVertex L N g q r) r).1 + rw [upperVertex_reverse] at h₂ + unfold edgeLabel + rw [edgeVertex_reverse,upperVertex_reverse] + exact edgeTransport_reverse L h Q hf hQ h₁ (compatible_symm L h₂) + +theorem edgeLabel_uniform (hQ : GeneralPosition h Q) {ε : ℝ} (hε : 0 < ε) : + ∃ M : ℕ, ∀ N : ℕ, M ≤ N → ∀ hN : 1 < N, ∀ g : NegativeLevel L N, ∀ q r : V, + dist (edgeLabel L hdim h Q N hN g q r) 1 < ε := by + obtain ⟨δ,hδ,H⟩ := edgeTransport_uniform h Q hQ hε + obtain ⟨M,hM⟩ := exists_nat_gt (2 / δ) + refine ⟨M,?_⟩ + intro N hMN hN g q r + have hN0 : (0 : ℝ) < N := by exact_mod_cast (by omega : 0 < N) + have hbound : 2 / (N : ℝ) < δ := by + apply (div_lt_iff₀ hN0).mpr + have hMN' : (M : ℝ) ≤ N := by exact_mod_cast hMN + have hh := (div_lt_iff₀ hδ).mp hM + nlinarith + apply H + · exact lt_of_le_of_lt (upperPoint_step L hdim N hN g q).2 hbound + · have hh := (upperPoint_step L hdim N hN (edgeVertex L N g q r) r).2 + rw [upperVertex_reverse,dist_comm] at hh + exact lt_of_le_of_lt hh hbound + + +omit [LinearOrder V] in +/-- Six compatible generator pieces around a level triangle lie in one flat chart +once the three edge images are uniformly short. -/ +theorem triangle_of_short (hf : FlatConnection L h) (hQ : GeneralPosition h Q) + (b c d u v w : TrianglePoint V) (δ : ℝ) (hδ : 0 < δ) + (hsmall : 4 * δ < 1 / (Fintype.card V + 1 : ℝ)) + (hb : CliquePoint L b) (hc : CliquePoint L c) (hd : CliquePoint L d) + (hu : CliquePoint L u) (hv : CliquePoint L v) (hw : CliquePoint L w) + (hbu : Compatible L b u) (huc : Compatible L u c) + (hcv : Compatible L c v) (hvd : Compatible L v d) + (hdw : Compatible L d w) (hwb : Compatible L w b) + (dbu : dist b u ≤ δ) (duc : dist u c ≤ δ) + (dcv : dist c v ≤ δ) (dvd : dist v d ≤ δ) + (_ddw : dist d w ≤ δ) (dwb : dist w b ≤ δ) : + edgeTransport h Q b u c * edgeTransport h Q c v d * edgeTransport h Q d w b = 1 := by + have dbc : dist b c ≤ 2 * δ := by linarith [dist_triangle b u c] + have dbv : dist b v ≤ 3 * δ := by linarith [dist_triangle b c v] + have dbd : dist b d ≤ 4 * δ := by linarith [dist_triangle b v d] + have dbw : dist b w ≤ δ := by simpa only [dist_comm] using dwb + obtain ⟨a,ha⟩ := exists_large_coordinate b + apply edgeTransport_triangle L h Q hf hQ b c d u v w hbu huc hcv hvd hdw hwb + · exact nearby_star L ha hb (by simpa using lt_of_lt_of_le hδ (le_of_lt (by linarith : δ < 1 / (Fintype.card V + 1 : ℝ)))) + · exact nearby_star L ha hc (by linarith) + · exact nearby_star L ha hd (lt_of_le_of_lt dbd hsmall) + · exact nearby_star L ha hu (by linarith) + · exact nearby_star L ha hv (by linarith) + · exact nearby_star L ha hw (by linarith) + +/-- Every oriented three-edge loop with these actual level endpoints is flat. +In particular both kinds of sections of a three-cube are covered. -/ +theorem edgeLabel_triangle (hf : FlatConnection L h) (hQ : GeneralPosition h Q) + (N : ℕ) (hN : 1 < N) (hsize : 8 / (N : ℝ) < 1 / (Fintype.card V + 1 : ℝ)) + (g₀ g₁ g₂ : NegativeLevel L N) (q₀ r₀ q₁ r₁ q₂ r₂ : V) + (e₀ : edgeVertex L N g₀ q₀ r₀ = g₁) + (e₁ : edgeVertex L N g₁ q₁ r₁ = g₂) + (e₂ : edgeVertex L N g₂ q₂ r₂ = g₀) : + edgeLabel L hdim h Q N hN g₀ q₀ r₀ * + edgeLabel L hdim h Q N hN g₁ q₁ r₁ * + edgeLabel L hdim h Q N hN g₂ q₂ r₂ = 1 := by + have h₀ := upperPoint_step L hdim N hN g₀ q₀ + have h₁ := upperPoint_step L hdim N hN g₁ q₁ + have h₂ := upperPoint_step L hdim N hN g₂ q₂ + have j₀ := upperPoint_step L hdim N hN g₁ r₀ + have j₁ := upperPoint_step L hdim N hN g₂ r₁ + have j₂ := upperPoint_step L hdim N hN g₀ r₂ + rw [← e₀,upperVertex_reverse,e₀] at j₀ + rw [← e₁,upperVertex_reverse,e₁] at j₁ + rw [← e₂,upperVertex_reverse,e₂] at j₂ + unfold edgeLabel + rw [e₀,e₁,e₂] + apply triangle_of_short L h Q hf hQ _ _ _ _ _ _ (2/(N : ℝ)) + · positivity + · convert hsize using 1; ring + · exact point_clique L hdim _ _ + · exact point_clique L hdim _ _ + · exact point_clique L hdim _ _ + · exact point_clique L hdim _ _ + · exact point_clique L hdim _ _ + · exact point_clique L hdim _ _ + · exact h₀.1 + · exact compatible_symm L j₀.1 + · exact h₁.1 + · exact compatible_symm L j₁.1 + · exact h₂.1 + · exact compatible_symm L j₂.1 + · exact h₀.2 + · simpa only [dist_comm] using j₀.2 + · exact h₁.2 + · simpa only [dist_comm] using j₁.2 + · exact h₂.2 + · simpa only [dist_comm] using j₂.2 + + +/-- A vertex of the simplex is also an honest point of its two-skeleton. -/ +def vertexPoint (v : V) : TrianglePoint V := + ⟨fun w => if v = w then 1 else 0,by + apply mem_triangleSet.mpr + refine ⟨{v},by simp,⟨?_,?_⟩,?_⟩ + · intro w; dsimp only; split_ifs <;> norm_num + · simp + · intro w hw + simp only [Finset.mem_singleton] at hw + simp [Ne.symm hw]⟩ + +@[simp] theorem vertexPoint_val (v w : V) : + (vertexPoint v : V → ℝ) w = if v = w then 1 else 0 := rfl + +theorem star_vertex {a v : V} (hav : Related L a v) : Star L a (vertexPoint v) := by + intro w hw + have he : v = w := by by_contra hh; exact hw (by simp [vertexPoint,hh]) + simpa only [← he] using hav + +omit [Fintype V] [LinearOrder V] in +theorem negative_powers_upper {q r : V} (hqr : L.Adj q r) (n m : ℕ) : + (artinGenerator L q)⁻¹ ^ (n+1) * (artinGenerator L r)⁻¹ ^ m * artinGenerator L q = + (artinGenerator L q)⁻¹ ^ n * (artinGenerator L r)⁻¹ ^ m := by + have hc := (adjacent_generators_commute L hqr).inv_right.pow_right m + calc + _ = (artinGenerator L q)⁻¹ ^ n * + ((artinGenerator L q)⁻¹ * ((artinGenerator L r)⁻¹ ^ m * artinGenerator L q)) := by + simp only [pow_succ]; group + _ = (artinGenerator L q)⁻¹ ^ n * + ((artinGenerator L q)⁻¹ * (artinGenerator L q * (artinGenerator L r)⁻¹ ^ m)) := by + rw [← hc.eq] + _ = _ := by group + +/-- Negative commuting powers remain exactly in their two-coordinate face. -/ +theorem powersPoint_star {q r : V} (hqr : L.Adj q r) (n m : ℕ) + (hg : 0 < traceLength L (artinNormalTrace L + ((artinGenerator L q)⁻¹ ^ n * (artinGenerator L r)⁻¹ ^ m))) : + Star L q (point L hdim ((artinGenerator L q)⁻¹ ^ n * (artinGenerator L r)⁻¹ ^ m) hg) := by + intro v hv + by_cases hqv : q = v + · exact Or.inl hqv + by_cases hrv : r = v + · exact Or.inr (hrv ▸ hqr) + exfalso + apply hv + rw [point_val,direction_negative_commuting_powers L hqr] + simp [hqv,hrv] + +/-- Constant endpoint in the q-direction, stated with a concrete positive height. -/ +theorem powersPoint_first {q r : V} (hqr : L.Adj q r) (N : ℕ) (hN : 0 < N) + (hg : 0 < traceLength L (artinNormalTrace L + ((artinGenerator L q)⁻¹ ^ N * (artinGenerator L r)⁻¹ ^ 0))) : + point L hdim ((artinGenerator L q)⁻¹ ^ N * (artinGenerator L r)⁻¹ ^ 0) hg = + vertexPoint q := by + apply Subtype.ext + funext v + rw [point_val,vertexPoint_val,direction_negative_commuting_powers L hqr] + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN + by_cases hv : q = v <;> simp [hv,hn] + +theorem powersPoint_last {q r : V} (hqr : L.Adj q r) (N : ℕ) (hN : 0 < N) + (hg : 0 < traceLength L (artinNormalTrace L + ((artinGenerator L q)⁻¹ ^ 0 * (artinGenerator L r)⁻¹ ^ N))) : + point L hdim ((artinGenerator L q)⁻¹ ^ 0 * (artinGenerator L r)⁻¹ ^ N) hg = + vertexPoint r := by + apply Subtype.ext + funext v + rw [point_val,vertexPoint_val,direction_negative_commuting_powers L hqr] + have hn : (N : ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hN + by_cases hv : r = v <;> simp [hv,hn] + +def powerVertex (N : ℕ) (q r : V) (j : ℕ) : NegativeLevel L N := + ⟨(artinGenerator L q)⁻¹ ^ (N - min j N) * (artinGenerator L r)⁻¹ ^ min j N,by + simp only [map_mul,map_pow,map_inv,height_generator] + change (N-min j N : ℕ) • (-1 : ℤ) + (min j N : ℕ) • (-1 : ℤ) = _ + simp only [nsmul_eq_mul,mul_neg,mul_one] + have hh : min j N ≤ N := min_le_right _ _ + omega⟩ + +omit [Fintype V] [LinearOrder V] in +theorem powerVertex_step (N : ℕ) {q r : V} (hqr : L.Adj q r) {j : ℕ} (hj : j < N) : + edgeVertex L N (powerVertex L N q r j) q r = powerVertex L N q r (j+1) := by + apply Subtype.ext + dsimp only [powerVertex,edgeVertex] + rw [min_eq_left (by omega : j ≤ N),min_eq_left (by omega : j+1 ≤ N)] + have he : N-j = (N-(j+1))+1 := by omega + rw [he,negative_powers_upper L hqr,pow_succ] + group + +omit [Fintype V] [LinearOrder V] in +theorem powerVertex_upper (N : ℕ) (hN : 1 < N) {q r : V} + (hqr : L.Adj q r) {j : ℕ} (hj : j < N) : + (upperVertex L N hN (powerVertex L N q r j) q : ArtinGroup L) = + (artinGenerator L q)⁻¹ ^ (N-(j+1)) * (artinGenerator L r)⁻¹ ^ j := by + dsimp only [powerVertex,upperVertex] + rw [min_eq_left (by omega : j ≤ N)] + have he : N-j = (N-(j+1))+1 := by omega + rw [he,negative_powers_upper L hqr] + +theorem powerVertex_star (N : ℕ) (hN : 0 < N) {q r : V} (hqr : L.Adj q r) (j : ℕ) : + Star L q (levelPoint L hdim N hN (powerVertex L N q r j)) := + powersPoint_star L hdim hqr _ _ _ + +theorem powerVertex_upper_star (N : ℕ) (hN : 1 < N) {q r : V} + (hqr : L.Adj q r) {j : ℕ} (hj : j < N) : + Star L q (levelPoint L hdim (N-1) (by omega) + (upperVertex L N hN (powerVertex L N q r j) q)) := by + unfold levelPoint + generalize_proofs hpos + simp only [powerVertex_upper L N hN hqr hj] at hpos ⊢ + exact powersPoint_star L hdim hqr _ _ _ + +theorem powerLabel_chart (hf : FlatConnection L h) (hQ : GeneralPosition h Q) + (N : ℕ) (hN : 1 < N) {q r : V} (hqr : L.Adj q r) {j : ℕ} (hj : j < N) : + edgeLabel L hdim h Q N hN (powerVertex L N q r j) q r = + chartTransport h Q q (levelPoint L hdim N (by omega) (powerVertex L N q r j)) + (levelPoint L hdim N (by omega) (powerVertex L N q r (j+1))) := by + have hb := upperPoint_step L hdim N hN (powerVertex L N q r j) q + have hc := upperPoint_step L hdim N hN (edgeVertex L N (powerVertex L N q r j) q r) r + rw [upperVertex_reverse] at hc + unfold edgeLabel + rw [edgeTransport_chart L h Q hf hQ hb.1 (compatible_symm L hc.1) + (powerVertex_star L hdim N (by omega) hqr j) (powerVertex_upper_star L hdim N hN hqr hj)] + · rw [powerVertex_step L N hqr hj] + · rw [powerVertex_step L N hqr hj] + exact powerVertex_star L hdim N (by omega) hqr (j+1) + + +/-- Directed walks retain the chosen generator pair, including parallel edges. -/ +inductive Walk (N : ℕ) : NegativeLevel L N → NegativeLevel L N → Type _ + | nil (g : NegativeLevel L N) : Walk N g g + | cons {g k : NegativeLevel L N} (q r : V) (hqr : L.Adj q r) + (p : Walk N (edgeVertex L N g q r) k) : Walk N g k + +namespace Walk +variable {L} {N : ℕ} + +def append {g k l : NegativeLevel L N} : Walk L N g k → Walk L N k l → Walk L N g l + | .nil _, p => p + | .cons q r hqr p, t => .cons q r hqr (append p t) + +def cast {g k g' k' : NegativeLevel L N} (p : Walk L N g k) + (hg : g = g') (hk : k = k') : Walk L N g' k' := hg ▸ hk ▸ p + +end Walk + +def walkProduct (N : ℕ) (hN : 1 < N) {g k : NegativeLevel L N} : Walk L N g k → SU2 + | .nil _ => 1 + | .cons (g := g) q r _ p => edgeLabel L hdim h Q N hN g q r * walkProduct N hN p + +@[simp] theorem walkProduct_nil (N : ℕ) (hN : 1 < N) (g : NegativeLevel L N) : + walkProduct L hdim h Q N hN (.nil g) = 1 := rfl + +@[simp] theorem walkProduct_cons (N : ℕ) (hN : 1 < N) {g k : NegativeLevel L N} + (q r : V) (hqr : L.Adj q r) (p : Walk L N (edgeVertex L N g q r) k) : + walkProduct L hdim h Q N hN (.cons q r hqr p) = + edgeLabel L hdim h Q N hN g q r * walkProduct L hdim h Q N hN p := rfl + +@[simp] theorem walkProduct_append (N : ℕ) (hN : 1 < N) {g k l : NegativeLevel L N} + (p : Walk L N g k) (t : Walk L N k l) : + walkProduct L hdim h Q N hN (p.append t) = + walkProduct L hdim h Q N hN p * walkProduct L hdim h Q N hN t := by + induction p with + | nil => simp [Walk.append] + | cons q r hqr p ih => simp [Walk.append,ih,mul_assoc] + +@[simp] theorem walkProduct_cast (N : ℕ) (hN : 1 < N) {g k g' k' : NegativeLevel L N} + (p : Walk L N g k) (hg : g = g') (hk : k = k') : + walkProduct L hdim h Q N hN (p.cast hg hk) = walkProduct L hdim h Q N hN p := by + subst g'; subst k'; rfl + +/-- The entire subdivided edge has the exact endpoint transport, not merely a limit. -/ +theorem exists_powerWalk (hf : FlatConnection L h) (hQ : GeneralPosition h Q) + (N : ℕ) (hN : 1 < N) {q r : V} (hqr : L.Adj q r) (k : ℕ) (hk : k ≤ N) : + ∃ p : Walk L N (powerVertex L N q r 0) (powerVertex L N q r k), + walkProduct L hdim h Q N hN p = + chartTransport h Q q (levelPoint L hdim N (by omega) (powerVertex L N q r 0)) + (levelPoint L hdim N (by omega) (powerVertex L N q r k)) := by + induction k with + | zero => exact ⟨.nil _,by simp [chartTransport]⟩ + | succ k ih => + obtain ⟨p,hp⟩ := ih (by omega) + let t : Walk L N (powerVertex L N q r k) + (edgeVertex L N (powerVertex L N q r k) q r) := .cons q r hqr (.nil _) + let t' := t.cast rfl (powerVertex_step L N hqr (by omega : k < N)) + refine ⟨p.append t',?_⟩ + rw [walkProduct_append,hp] + simp only [t',walkProduct_cast,t,walkProduct_cons,walkProduct_nil,mul_one] + rw [powerLabel_chart L hdim h Q hf hQ N hN hqr (by omega),chartTransport_trans] + +def pureVertex (N : ℕ) (q : V) : NegativeLevel L N := + ⟨(artinGenerator L q)⁻¹ ^ N,by + simp only [map_pow,map_inv,height_generator] + change N • (-1 : ℤ) = -(N : ℤ) + simp⟩ + +omit [Fintype V] [LinearOrder V] in +theorem powerVertex_zero (N : ℕ) (q r : V) : + powerVertex L N q r 0 = pureVertex L N q := by apply Subtype.ext; simp [powerVertex,pureVertex] + +omit [Fintype V] [LinearOrder V] in +theorem powerVertex_last (N : ℕ) (q r : V) : + powerVertex L N q r N = pureVertex L N r := by apply Subtype.ext; simp [powerVertex,pureVertex] + +def vertexGauge (v : V) : SU2 := gauge h Q v (vertexPoint v) + +theorem levelPoint_power_zero (N : ℕ) (hN : 0 < N) {q r : V} (hqr : L.Adj q r) : + levelPoint L hdim N hN (powerVertex L N q r 0) = vertexPoint q := by + unfold levelPoint + have hh : (powerVertex L N q r 0 : ArtinGroup L) = + (artinGenerator L q)⁻¹ ^ N * (artinGenerator L r)⁻¹ ^ 0 := by simp [powerVertex] + simp only [hh] + exact powersPoint_first L hdim hqr N hN _ + +theorem levelPoint_power_last (N : ℕ) (hN : 0 < N) {q r : V} (hqr : L.Adj q r) : + levelPoint L hdim N hN (powerVertex L N q r N) = vertexPoint r := by + unfold levelPoint + have hh : (powerVertex L N q r N : ArtinGroup L) = + (artinGenerator L q)⁻¹ ^ 0 * (artinGenerator L r)⁻¹ ^ N := by simp [powerVertex] + simp only [hh] + exact powersPoint_last L hdim hqr N hN _ + +theorem exists_expanded_edge (hf : FlatConnection L h) (hQ : GeneralPosition h Q) + (N : ℕ) (hN : 1 < N) {q r : V} (hqr : L.Adj q r) : + ∃ p : Walk L N (pureVertex L N q) (pureVertex L N r), + walkProduct L hdim h Q N hN p = + (vertexGauge h Q q)⁻¹ * h q r * vertexGauge h Q r := by + obtain ⟨p,hp⟩ := exists_powerWalk L hdim h Q hf hQ N hN hqr N le_rfl + refine ⟨p.cast (powerVertex_zero L N q r) (powerVertex_last L N q r),?_⟩ + rw [walkProduct_cast,hp,levelPoint_power_zero L hdim N (by omega) hqr, + levelPoint_power_last L hdim N (by omega) hqr] + unfold chartTransport vertexGauge + rw [gauge_transition L h Q hf hQ (Or.inr hqr) + (star_vertex L (Or.inr hqr)) (star_vertex L (Or.inl rfl))] + group + +omit [Fintype V] [LinearOrder V] in +def graphWalkProduct {a b : V} : L.Walk a b → SU2 + | .nil => 1 + | .cons (u := u) (v := v) _ p => h u v * graphWalkProduct p + +theorem exists_expanded_walk (hf : FlatConnection L h) (hQ : GeneralPosition h Q) + (N : ℕ) (hN : 1 < N) {q r : V} (w : L.Walk q r) : + ∃ p : Walk L N (pureVertex L N q) (pureVertex L N r), + walkProduct L hdim h Q N hN p = + (vertexGauge h Q q)⁻¹ * graphWalkProduct L h w * vertexGauge h Q r := by + induction w with + | nil => exact ⟨.nil _,by simp [graphWalkProduct]⟩ + | @cons q t r hqt w ih => + obtain ⟨p,hp⟩ := exists_expanded_edge L hdim h Q hf hQ N hN hqt + obtain ⟨s,hs⟩ := ih + refine ⟨p.append s,?_⟩ + rw [walkProduct_append,hp,hs] + simp only [graphWalkProduct] + group + +omit [Fintype V] [LinearOrder V] in +theorem graphWalkProduct_eq_zipWith {a b : V} (w : L.Walk a b) : + graphWalkProduct L h w = (List.zipWith h w.support w.support.tail).prod := by + induction w with + | nil => simp [graphWalkProduct] + | @cons q t r hqt w ih => + cases w with + | nil => simp [graphWalkProduct] + | cons htl p => simpa only [graphWalkProduct,SimpleGraph.Walk.support_cons, + List.tail_cons,List.zipWith_cons_cons,List.prod_cons] using congrArg (h q t * ·) ih + +/-- A nontrivial seed holonomy survives every sufficiently translated level. -/ +theorem exists_nontrivial_level_walk (hf : FlatConnection L h) (hQ : GeneralPosition h Q) + (N : ℕ) (hN : 1 < N) {q : V} (w : L.Walk q q) + (hw : graphWalkProduct L h w ≠ 1) : + ∃ p : Walk L N (pureVertex L N q) (pureVertex L N q), + walkProduct L hdim h Q N hN p ≠ 1 := by + obtain ⟨p,hp⟩ := exists_expanded_walk L hdim h Q hf hQ N hN w + refine ⟨p,?_⟩ + rw [hp] + intro he + apply hw + calc + graphWalkProduct L h w = vertexGauge h Q q * + ((vertexGauge h Q q)⁻¹ * graphWalkProduct L h w * vertexGauge h Q q) * + (vertexGauge h Q q)⁻¹ := by group + _ = 1 := by rw [he]; group + + +namespace Walk +variable {L} {N : ℕ} +omit [Fintype V] [LinearOrder V] in +def eval (a : NegativeLevel L N → V → V → SU2) + {g k : NegativeLevel L N} : Walk L N g k → SU2 + | .nil _ => 1 + | .cons (g := g) q r _ p => a g q r * eval a p +end Walk + +theorem walkProduct_eq_eval (N : ℕ) (hN : 1 < N) {g k : NegativeLevel L N} + (p : Walk L N g k) : + walkProduct L hdim h Q N hN p = p.eval (edgeLabel L hdim h Q N hN) := by + induction p with + | nil => rfl + | cons q r hqr p ih => simp only [walkProduct,Walk.eval,ih] + +end LevelTransport + +namespace SourceTransport +open LevelTransport AffineTransport + +def seedWalk : seedGraph.Walk (.inl (.inl none)) (.inl (.inl none)) := + SimpleGraph.Walk.ofSupport SeedConnection.roseLoop + (by simp [SeedConnection.roseLoop]) SeedConnection.roseLoop_edges + +theorem seedWalk_support : seedWalk.support = SeedConnection.roseLoop := + SimpleGraph.Walk.support_ofSupport _ _ + +theorem seedWalk_product_ne : graphWalkProduct seedGraph SeedConnection.connection seedWalk ≠ 1 := by + rw [graphWalkProduct_eq_zipWith,seedWalk_support] + exact SeedConnection.roseLoop_nontrivial + +/-- Actual small flat transport for the fixed source level graph. There are no +representation, direction-map, local-chart, or nontriviality hypotheses here. -/ +theorem source_small_labels (ε : ℝ) (hε : 0 < ε) : + ∃ N : ℕ, 1 < N ∧ ∃ a : NegativeLevel seedGraph N → SeedCell → SeedCell → SU2, + (∀ g q r, a (edgeVertex seedGraph N g q r) r q = (a g q r)⁻¹) ∧ + (∀ g q r, dist (a g q r) 1 < ε) ∧ + (∀ g₀ g₁ g₂ q₀ r₀ q₁ r₁ q₂ r₂, + edgeVertex seedGraph N g₀ q₀ r₀ = g₁ → + edgeVertex seedGraph N g₁ q₁ r₁ = g₂ → + edgeVertex seedGraph N g₂ q₂ r₂ = g₀ → + a g₀ q₀ r₀ * a g₁ q₁ r₁ * a g₂ q₂ r₂ = 1) ∧ + ∃ (g : NegativeLevel seedGraph N) (p : Walk seedGraph N g g), p.eval a ≠ 1 := by + let : LinearOrder SeedCell := LinearOrder.lift' (Fintype.equivFin SeedCell) + (Fintype.equivFin SeedCell).injective + obtain ⟨Q,hQ⟩ := exists_generalPosition SeedConnection.connection + have hf : FlatConnection seedGraph SeedConnection.connection := + fun _ _ _ hab hbc hac => SeedConnection.connection_flat hab hbc hac + obtain ⟨M,hM⟩ := edgeLabel_uniform seedGraph SeedConnection.clique_card_le_three + SeedConnection.connection Q hQ hε + let D := Fintype.card SeedCell + 1 + let N := max M (8 * D + 2) + have hMN : M ≤ N := le_max_left _ _ + have hNbound : 8 * D + 2 ≤ N := le_max_right _ _ + have hN : 1 < N := by omega + have hD : (0 : ℝ) < D := by dsimp [D]; positivity + have hNr : (0 : ℝ) < N := by exact_mod_cast (by omega : 0 < N) + have hsize : 8 / (N : ℝ) < 1 / (Fintype.card SeedCell + 1 : ℝ) := by + have hBN : (8 : ℝ) * D + 2 ≤ N := by exact_mod_cast hNbound + have hDcast : (D : ℝ) = (Fintype.card SeedCell : ℝ) + 1 := by simp [D] + rw [← hDcast] + apply (div_lt_div_iff₀ hNr hD).mpr + nlinarith + let a := edgeLabel seedGraph SeedConnection.clique_card_le_three + SeedConnection.connection Q N hN + refine ⟨N,hN,a,?_,?_,?_,?_⟩ + · exact edgeLabel_reverse seedGraph SeedConnection.clique_card_le_three + SeedConnection.connection Q hf hQ N hN + · exact hM N hMN hN + · exact edgeLabel_triangle seedGraph SeedConnection.clique_card_le_three + SeedConnection.connection Q hf hQ N hN hsize + · obtain ⟨p,hp⟩ := exists_nontrivial_level_walk seedGraph SeedConnection.clique_card_le_three + SeedConnection.connection Q hf hQ N hN seedWalk seedWalk_product_ne + refine ⟨_,p,?_⟩ + rwa [walkProduct_eq_eval] at hp + +end SourceTransport +end EilenbergGanea + + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/Main.lean b/lean/OAI/Topology/EilenbergGanea/Main.lean index 55f932a18706cdb3908f83d15b5be425304dbbb4..86f93d30dd4091b19dc26ba8a2cf266480ddbad7 100644 --- a/lean/OAI/Topology/EilenbergGanea/Main.lean +++ b/lean/OAI/Topology/EilenbergGanea/Main.lean @@ -1,43 +1,43 @@ -import OAI.Topology.EilenbergGanea.Dimension -import OAI.Topology.EilenbergGanea.CubicalCover -import OAI.AlgebraicTopology.CWComplex.Presentation - -namespace OAI - -noncomputable section - -open Classical Set Metric Topology - -namespace EilenbergGanea -universe u - -/-- Exclusion is for arbitrary ordinary2-dimensional classifying CW spaces, -not merely finite presentations or cell complexes with finitely many orbits. -/ -theorem source_no_classifyingSpace_two : ¬ HasClassifyingSpace.{u} SourceGroup 2 := by - rintro ⟨X,tX,hTX,cX,hd,hpc,x,⟨χ⟩,E,tE,hcon,p,cov,hs⟩ - let : TopologicalSpace X := tX - let : T2Space X := hTX - let : Topology.CWComplex (Set.univ : Set X) := cX - let : PathConnectedSpace X := hpc - let : TopologicalSpace E := tE - let : ContractibleSpace E := hcon - obtain ⟨A,a,ha,r,hr,hp,B,hB⟩ := CWPresentation.ordinary_boundary_basis cov hd hs x χ - exact source_no_boundary_basis a ha r hr hp B hB - -/-- Source Theorem1.1 for the exact103-cell flag triangulation and its actual -Artin height kernel. The last conjunct is polymorphic in the universe of the -hypothetical ordinary CW model, with unrestricted numbers of cells. -/ -theorem source_main : - Group.FG SourceGroup ∧ Group.ResiduallyFinite SourceGroup ∧ - cohomologicalDimension SourceGroup = 2 ∧ - HasClassifyingSpace.{0} SourceGroup 3 ∧ - ¬ HasClassifyingSpace.{u} SourceGroup 2 := - ⟨source_finitely_generated,source_residuallyFinite,source_cohomologicalDimension, - source_hasClassifyingSpace_three,source_no_classifyingSpace_two⟩ - -end EilenbergGanea - - -end - -end OAI +import OAI.Topology.EilenbergGanea.Dimension +import OAI.Topology.EilenbergGanea.CubicalCover +import OAI.AlgebraicTopology.CWComplex.Presentation + +namespace OAI + +noncomputable section + +open Classical Set Metric Topology + +namespace EilenbergGanea +universe u + +/-- Exclusion is for arbitrary ordinary2-dimensional classifying CW spaces, +not merely finite presentations or cell complexes with finitely many orbits. -/ +theorem source_no_classifyingSpace_two : ¬ HasClassifyingSpace.{u} SourceGroup 2 := by + rintro ⟨X,tX,hTX,cX,hd,hpc,x,⟨χ⟩,E,tE,hcon,p,cov,hs⟩ + let : TopologicalSpace X := tX + let : T2Space X := hTX + let : Topology.CWComplex (Set.univ : Set X) := cX + let : PathConnectedSpace X := hpc + let : TopologicalSpace E := tE + let : ContractibleSpace E := hcon + obtain ⟨A,a,ha,r,hr,hp,B,hB⟩ := CWPresentation.ordinary_boundary_basis cov hd hs x χ + exact source_no_boundary_basis a ha r hr hp B hB + +/-- Source Theorem1.1 for the exact103-cell flag triangulation and its actual +Artin height kernel. The last conjunct is polymorphic in the universe of the +hypothetical ordinary CW model, with unrestricted numbers of cells. -/ +theorem source_main : + Group.FG SourceGroup ∧ Group.ResiduallyFinite SourceGroup ∧ + cohomologicalDimension SourceGroup = 2 ∧ + HasClassifyingSpace.{0} SourceGroup 3 ∧ + ¬ HasClassifyingSpace.{u} SourceGroup 2 := + ⟨source_finitely_generated,source_residuallyFinite,source_cohomologicalDimension, + source_hasClassifyingSpace_three,source_no_classifyingSpace_two⟩ + +end EilenbergGanea + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/Model.lean b/lean/OAI/Topology/EilenbergGanea/Model.lean index 095480f10cc329e05b12cd66340bae766f913e1e..f0ba9b49c69e396c719d2176f309b1d586bc4d24 100644 --- a/lean/OAI/Topology/EilenbergGanea/Model.lean +++ b/lean/OAI/Topology/EilenbergGanea/Model.lean @@ -1,61 +1,61 @@ -import OAI.Topology.EilenbergGanea.Seed -import OAI.GroupTheory.RightAngledArtin.ResidualFiniteness -import Mathlib.Algebra.Category.ModuleCat.ProjectiveDimension -import Mathlib.RepresentationTheory.Basic -import Mathlib.Topology.CWComplex.Classical.Basic -import Mathlib.Topology.Covering.Basic -import Mathlib.Topology.Homotopy.Contractible -import Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup - -namespace OAI - -noncomputable section - -open Classical Set Topology - -namespace EilenbergGanea -abbrev SourceGroup := (height seedGraph).ker - -/-- Integral, left-module cohomological dimension; no rational replacement. -/ -def cohomologicalDimension (G : Type*) [Group G] : WithBot ℕ∞ := - CategoryTheory.projectiveDimension - (ModuleCat.of (MonoidAlgebra ℤ G) (Representation.trivial ℤ G ℤ).asModule) - -universe u -/-- Ordinary K(G,1) of dimension at most n. The cell and space types have no -finiteness or countability restriction. The contractible surjective covering -is the usual universal-cover characterization of a classifying space. -/ -def HasClassifyingSpace (G : Type*) [Group G] (n : ℕ) : Prop := - ∃ (X : Type u) (_ : TopologicalSpace X) (_ : T2Space X) - (_ : Topology.CWComplex (Set.univ : Set X)), - (∀ k : ℕ, n < k → IsEmpty (Topology.CWComplex.cell (Set.univ : Set X) k)) ∧ - PathConnectedSpace X ∧ - ∃ x : X, Nonempty (FundamentalGroup X x ≃* G) ∧ - ∃ (E : Type u) (_ : TopologicalSpace E), ContractibleSpace E ∧ - ∃ p : E → X, IsCoveringMap p ∧ Function.Surjective p - - -end EilenbergGanea - -namespace EilenbergGanea -/-- The finite-generation conjunct for the exact source height kernel. -/ -theorem source_finitely_generated : Group.FG SourceGroup := - height_kernel_fg seedGraph seed_connected.preconnected seedBase - - - -end EilenbergGanea - -namespace EilenbergGanea -/-- The second exact conjunct of the source main theorem. -/ -theorem source_residuallyFinite : Group.ResiduallyFinite SourceGroup := by - have := artin_residuallyFinite SeedCell seedGraph - infer_instance - -end EilenbergGanea - - - -end - -end OAI +import OAI.Topology.EilenbergGanea.Seed +import OAI.GroupTheory.RightAngledArtin.ResidualFiniteness +import Mathlib.Algebra.Category.ModuleCat.ProjectiveDimension +import Mathlib.RepresentationTheory.Basic +import Mathlib.Topology.CWComplex.Classical.Basic +import Mathlib.Topology.Covering.Basic +import Mathlib.Topology.Homotopy.Contractible +import Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup + +namespace OAI + +noncomputable section + +open Classical Set Topology + +namespace EilenbergGanea +abbrev SourceGroup := (height seedGraph).ker + +/-- Integral, left-module cohomological dimension; no rational replacement. -/ +def cohomologicalDimension (G : Type*) [Group G] : WithBot ℕ∞ := + CategoryTheory.projectiveDimension + (ModuleCat.of (MonoidAlgebra ℤ G) (Representation.trivial ℤ G ℤ).asModule) + +universe u +/-- Ordinary K(G,1) of dimension at most n. The cell and space types have no +finiteness or countability restriction. The contractible surjective covering +is the usual universal-cover characterization of a classifying space. -/ +def HasClassifyingSpace (G : Type*) [Group G] (n : ℕ) : Prop := + ∃ (X : Type u) (_ : TopologicalSpace X) (_ : T2Space X) + (_ : Topology.CWComplex (Set.univ : Set X)), + (∀ k : ℕ, n < k → IsEmpty (Topology.CWComplex.cell (Set.univ : Set X) k)) ∧ + PathConnectedSpace X ∧ + ∃ x : X, Nonempty (FundamentalGroup X x ≃* G) ∧ + ∃ (E : Type u) (_ : TopologicalSpace E), ContractibleSpace E ∧ + ∃ p : E → X, IsCoveringMap p ∧ Function.Surjective p + + +end EilenbergGanea + +namespace EilenbergGanea +/-- The finite-generation conjunct for the exact source height kernel. -/ +theorem source_finitely_generated : Group.FG SourceGroup := + height_kernel_fg seedGraph seed_connected.preconnected seedBase + + + +end EilenbergGanea + +namespace EilenbergGanea +/-- The second exact conjunct of the source main theorem. -/ +theorem source_residuallyFinite : Group.ResiduallyFinite SourceGroup := by + have := artin_residuallyFinite SeedCell seedGraph + infer_instance + +end EilenbergGanea + + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/PresentationAlignment.lean b/lean/OAI/Topology/EilenbergGanea/PresentationAlignment.lean index 185bc06451de98c2d6df38a43e2230185fa81056..4f55081c41dda9c883dbc7dc869b25d5b989b620 100644 --- a/lean/OAI/Topology/EilenbergGanea/PresentationAlignment.lean +++ b/lean/OAI/Topology/EilenbergGanea/PresentationAlignment.lean @@ -1,1205 +1,1205 @@ -import OAI.Topology.EilenbergGanea.PresentationComparison - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -/-! Actual word and cycle-basis alignment. -/ -namespace EilenbergGanea -section WordRealization -variable {Γ S R : Type*} [Group Γ] - -theorem pathChain_zpow_loop (v : S → Γ) (w : FreeGroup S) - (hw : wordValue v w = 1) (n : ℤ) (g : Γ) : - pathChain v (w ^ n) g = n • pathChain v w g := by - induction n using Int.induction_on with - | zero => simp - | succ n ih => - rw [zpow_add, zpow_one, pathChain_mul, map_zpow, hw, one_zpow, mul_one, ih] - simp [add_zsmul] - | pred n ih => - rw [zpow_sub, zpow_one, pathChain_mul, map_zpow, hw, one_zpow, mul_one, - pathChain_inv, hw, inv_one, mul_one, ih] - simp only [sub_eq_add_neg, add_zsmul, neg_zsmul, one_zsmul] - -/-- Every finitely supported integral relator combination is realized by a -finite word in the same normal closure. Surjectivity supplies the finitely -many conjugating words; no infinite product of presentation moves occurs. -/ -theorem realize_relator_chain (v : S → Γ) (hv : Function.Surjective (wordValue v)) - (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) - (c : (Γ × R) →₀ ℤ) : - ∃ w ∈ Subgroup.normalClosure (Set.range r), - pathChain v w 1 = relatorChainMap v r c := by - classical - induction c using Finsupp.induction with - | zero => exact ⟨1, Subgroup.one_mem _, by simp⟩ - | @single_add a n c ha hn ih => - obtain ⟨w,hw,hcw⟩ := ih - obtain ⟨u,hu⟩ := hv a.1 - let z := u * r a.2 * u⁻¹ - have hz : z ∈ Subgroup.normalClosure (Set.range r) := - (Subgroup.normalClosure_normal (s := Set.range r)).conj_mem _ - (Subgroup.subset_normalClosure (Set.mem_range_self a.2)) u - have hzw : wordValue v z = 1 := by simp [z,hr] - refine ⟨z ^ n * w, Subgroup.mul_mem _ (Subgroup.zpow_mem _ hz n) hw, ?_⟩ - rw [pathChain_mul, map_zpow, hzw, one_zpow, mul_one, pathChain_zpow_loop _ _ hzw, - hcw, map_add] - congr 1 - rw [pathChain_conjugate v u _ (hr a.2), one_mul, hu] - simp [relatorChainMap] - -end WordRealization -end EilenbergGanea -namespace EilenbergGanea -section RelatorShears -variable {Γ S R I : Type*} [Group Γ] - -theorem relatorChainMap_equivariant (v : S → Γ) (r : R → FreeGroup S) : - ChainsEquivariant (relatorChainMap v r) := by - intro g c - have he : (relatorChainMap v r).comp (translateChains g) = - (translateChains g).comp (relatorChainMap v r) := by - apply Finsupp.lhom_ext - rintro ⟨h,i⟩ n - simp only [LinearMap.comp_apply, translateChains_single, relatorChainMap, - Finsupp.linearCombination_single, map_smul, pathChain_translate] - exact LinearMap.congr_fun he c - -theorem normal_relators_trivial (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) : - Subgroup.normalClosure (Set.range r) ≤ (wordValue v).ker := by - apply Subgroup.normalClosure_le_normal - rintro _ ⟨i,rfl⟩ - exact hr i - -@[simp] theorem relatorChainMap_single (v : S → Γ) (r : R → FreeGroup S) - (g : Γ) (i : R) (n : ℤ) : - relatorChainMap v r (Finsupp.single (g,i) n) = n • pathChain v (r i) g := by - simp [relatorChainMap] - -/-- A whole column-finite shear is realized by honest finite relator words, -including when the relator alphabets have arbitrary cardinality. -/ -theorem shear_relators (v : S → Γ) (hv : Function.Surjective (wordValue v)) - (r : R → FreeGroup S) (u : I → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (hu : ∀ i, wordValue v (u i) = 1) - (C : BasedChains Γ I →ₗ[ℤ] BasedChains Γ R) (hC : ChainsEquivariant C) : - ∃ u' : I → FreeGroup S, - (∀ i, wordValue v (u' i) = 1) ∧ - Subgroup.normalClosure (Set.range r ∪ Set.range u') = - Subgroup.normalClosure (Set.range r ∪ Set.range u) ∧ - relatorChainMap v u' = relatorChainMap v u + (relatorChainMap v r).comp C := by - classical - choose p hp hc using fun i => realize_relator_chain v hv r hr (C (Finsupp.single (1,i) 1)) - let u' : I → FreeGroup S := fun i => u i * p i - have hpr (i) : wordValue v (p i) = 1 := normal_relators_trivial v r hr (hp i) - have hu' (i) : wordValue v (u' i) = 1 := by simp [u',hu,hpr] - refine ⟨u',hu',?_,?_⟩ - · apply le_antisymm - · apply Subgroup.normalClosure_le_normal - rintro _ (⟨i,rfl⟩ | ⟨i,rfl⟩) - · exact Subgroup.subset_normalClosure (Or.inl (Set.mem_range_self i)) - · exact Subgroup.mul_mem _ (Subgroup.subset_normalClosure (Or.inr (Set.mem_range_self i))) - (Subgroup.normalClosure_mono Set.subset_union_left (hp i)) - · apply Subgroup.normalClosure_le_normal - rintro _ (⟨i,rfl⟩ | ⟨i,rfl⟩) - · exact Subgroup.subset_normalClosure (Or.inl (Set.mem_range_self i)) - · have h : u' i * (p i)⁻¹ ∈ Subgroup.normalClosure (Set.range r ∪ Set.range u') := - Subgroup.mul_mem _ (Subgroup.subset_normalClosure (Or.inr (Set.mem_range_self i))) - (Subgroup.inv_mem _ (Subgroup.normalClosure_mono Set.subset_union_left (hp i))) - simpa [u'] using h - · have hb (i) : pathChain v (u' i) 1 = pathChain v (u i) 1 + - relatorChainMap v r (C (Finsupp.single (1,i) 1)) := by - simp only [u',pathChain_mul,hu,mul_one,hc] - have hbg (g : Γ) (i : I) : pathChain v (u' i) g = pathChain v (u i) g + - relatorChainMap v r (C (Finsupp.single (g,i) 1)) := by - have h := congrArg (translateChains g) (hb i) - rw [map_add,pathChain_translate,pathChain_translate,mul_one, - ← relatorChainMap_equivariant v r g, ← hC g, translateChains_single,mul_one] at h - exact h - apply Finsupp.lhom_ext - rintro ⟨g,i⟩ n - have hn : Finsupp.single (g,i) n = n • Finsupp.single (g,i) (1 : ℤ) := by simp - simpa only [hn, map_smul, LinearMap.add_apply, LinearMap.comp_apply, - relatorChainMap_single, one_smul, smul_add] using congrArg (n • ·) (hbg g i) - -/-- The source's three shears P,Q,P, at the level of relator words rather -than merely chain matrices. No infinite product or cardinality restriction. -/ -theorem block_word_alignment (v : S → Γ) (hv : Function.Surjective (wordValue v)) - (r : R → FreeGroup S) (u : I → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (hu : ∀ i, wordValue v (u i) = 1) - (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ I) - (hA : ChainsEquivariant A.toLinearMap) : - ∃ (r' : R → FreeGroup S) (u' : I → FreeGroup S), - (∀ i, wordValue v (r' i) = 1) ∧ (∀ i, wordValue v (u' i) = 1) ∧ - Subgroup.normalClosure (Set.range r' ∪ Set.range u') = - Subgroup.normalClosure (Set.range r ∪ Set.range u) ∧ - relatorChainMap v r' = -((relatorChainMap v u).comp A.toLinearMap) ∧ - relatorChainMap v u' = (relatorChainMap v r).comp A.symm.toLinearMap := by - have hAi := ChainsEquivariant.symm A hA - have hnA : ChainsEquivariant (-A.toLinearMap) := by - intro g c - simp only [LinearMap.neg_apply, map_neg] - exact congrArg Neg.neg (hA g c) - obtain ⟨u₁,hu₁,hN₁,hD₁⟩ := shear_relators v hv r u hr hu A.symm.toLinearMap hAi - obtain ⟨r₂,hr₂,hN₂,hD₂⟩ := shear_relators v hv u₁ r hu₁ hr (-A.toLinearMap) hnA - have hD₂' : relatorChainMap v r₂ = -((relatorChainMap v u).comp A.toLinearMap) := by - rw [hD₂,hD₁] - ext c - simp only [LinearMap.add_apply, LinearMap.comp_apply, LinearMap.neg_apply, - map_neg, LinearEquiv.coe_coe, LinearEquiv.symm_apply_apply] - abel_nf - obtain ⟨u₃,hu₃,hN₃,hD₃⟩ := shear_relators v hv r₂ u₁ hr₂ hu₁ A.symm.toLinearMap hAi - refine ⟨r₂,u₃,hr₂,hu₃,?_,hD₂',?_⟩ - · rw [hN₃,Set.union_comm (Set.range r₂) (Set.range u₁),hN₂, - Set.union_comm (Set.range u₁) (Set.range r),hN₁] - · rw [hD₃,hD₁,hD₂'] - ext c - simp only [LinearMap.add_apply, LinearMap.comp_apply, LinearMap.neg_apply, - LinearEquiv.coe_coe, LinearEquiv.apply_symm_apply] - abel_nf - -end RelatorShears -end EilenbergGanea - -namespace EilenbergGanea -section CycleSpaces -variable {Γ S T U R : Type*} [Group Γ] - -def edgeBoundary (v : S → Γ) : BasedChains Γ S →ₗ[ℤ] (Γ →₀ ℤ) := - Finsupp.linearCombination ℤ (fun p : Γ × S => - Finsupp.single (p.1 * v p.2) 1 - Finsupp.single p.1 1) - -@[simp] theorem edgeBoundary_single (v : S → Γ) (g : Γ) (s : S) (n : ℤ) : - edgeBoundary v (Finsupp.single (g,s) n) = - n • (Finsupp.single (g * v s) 1 - Finsupp.single g 1) := by - simp [edgeBoundary] - -theorem edgeBoundary_pathChain (v : S → Γ) (w : FreeGroup S) (g : Γ) : - edgeBoundary v (pathChain v w g) = - Finsupp.single (g * wordValue v w) 1 - Finsupp.single g 1 := by - induction w using FreeGroup.induction_on generalizing g with - | one => simp - | of s => simp [wordValue] - | inv_of s _ih => simp [pathChain_inv,wordValue] - | mul w z hw hz => - rw [pathChain_mul,map_add,hw,hz,map_mul] - simp only [mul_assoc] - abel - -abbrev cycles (v : S → Γ) := LinearMap.ker (edgeBoundary v) - -theorem relatorChainMap_boundary (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) : - (edgeBoundary v).comp (relatorChainMap v r) = 0 := by - apply Finsupp.lhom_ext - rintro ⟨g,i⟩ n - simp [edgeBoundary_pathChain,hr] - -def relatorCycles (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) : BasedChains Γ R →ₗ[ℤ] cycles v := - (relatorChainMap v r).codRestrict _ (fun c => by - rw [LinearMap.mem_ker] - exact LinearMap.congr_fun (relatorChainMap_boundary v r hr) c) - -@[simp] theorem relatorCycles_coe (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (c : BasedChains Γ R) : - (relatorCycles v r hr c : BasedChains Γ S) = relatorChainMap v r c := rfl - -theorem wordValue_substitution (v : T → Γ) (f : S → FreeGroup T) (w : FreeGroup S) : - wordValue v (FreeGroup.lift f w) = wordValue (fun s => wordValue v (f s)) w := by - have h : (wordValue v).comp (FreeGroup.lift f) = - wordValue (fun s => wordValue v (f s)) := by - apply FreeGroup.ext_hom - intro s - simp [wordValue] - exact DFunLike.congr_fun h w - -/-- Naturality of the actual path chain under arbitrary finite-word substitution. -/ -theorem pathChain_substitution (v : T → Γ) (f : S → FreeGroup T) - (w : FreeGroup S) (g : Γ) : - relatorChainMap v f (pathChain (fun s => wordValue v (f s)) w g) = - pathChain v (FreeGroup.lift f w) g := by - induction w using FreeGroup.induction_on generalizing g with - | one => simp - | of s => simp - | inv_of s _ih => - simp only [pathChain_inv,map_neg,pathChain_of,relatorChainMap_single,one_smul, - map_inv,FreeGroup.lift_apply_of,wordValue] - | mul w z hw hz => - rw [pathChain_mul,map_add,hw,hz,map_mul,pathChain_mul,wordValue_substitution] - -theorem relatorChainMap_substitution (v : U → Γ) - (f : T → FreeGroup U) (e : S → FreeGroup T) : - (relatorChainMap v f).comp (relatorChainMap (fun t => wordValue v (f t)) e) = - relatorChainMap v (fun s => FreeGroup.lift f (e s)) := by - apply Finsupp.lhom_ext - rintro ⟨g,s⟩ n - simp [pathChain_substitution] - -@[simp] theorem relatorChainMap_of (v : S → Γ) : - relatorChainMap v FreeGroup.of = LinearMap.id := by - apply Finsupp.lhom_ext - rintro ⟨g,s⟩ n - simp - -end CycleSpaces -end EilenbergGanea - -namespace EilenbergGanea -section SumChains -variable {Γ S T : Type*} - -def sumChainsEquiv : BasedChains Γ (S ⊕ T) ≃ₗ[ℤ] BasedChains Γ S × BasedChains Γ T := - (Finsupp.domLCongr (Equiv.prodSumDistrib Γ S T)).trans (Finsupp.sumFinsuppLEquivProdFinsupp ℤ) - -@[simp] theorem sumChainsEquiv_fst (c : BasedChains Γ (S ⊕ T)) (g : Γ) (s : S) : - (sumChainsEquiv c).1 (g,s) = c (g,Sum.inl s) := by - rfl - -@[simp] theorem sumChainsEquiv_snd (c : BasedChains Γ (S ⊕ T)) (g : Γ) (t : T) : - (sumChainsEquiv c).2 (g,t) = c (g,Sum.inr t) := by - rfl - -@[simp] theorem sumChainsEquiv_single_left (g : Γ) (s : S) (n : ℤ) : - sumChainsEquiv (Finsupp.single (g,Sum.inl s) n : BasedChains Γ (S ⊕ T)) = - (Finsupp.single (g,s) n,0) := by - classical - apply Prod.ext - · ext ⟨h,i⟩ - simp [Finsupp.single_apply] - · ext ⟨h,i⟩ - simp - -@[simp] theorem sumChainsEquiv_single_right (g : Γ) (t : T) (n : ℤ) : - sumChainsEquiv (Finsupp.single (g,Sum.inr t) n : BasedChains Γ (S ⊕ T)) = - (0,Finsupp.single (g,t) n) := by - classical - apply Prod.ext - · ext ⟨h,i⟩ - simp - · ext ⟨h,i⟩ - simp [Finsupp.single_apply] - -end SumChains -end EilenbergGanea - -namespace EilenbergGanea -section TrivialGenerators -variable {Γ S T : Type*} [Group Γ] - -theorem edgeBoundary_sum_trivial (v : S → Γ) (c : BasedChains Γ (S ⊕ T)) : - edgeBoundary (Sum.elim v (fun _ : T => 1)) c = - edgeBoundary v (sumChainsEquiv c).1 := by - have h : edgeBoundary (Sum.elim v (fun _ : T => 1)) = - (edgeBoundary v).comp ((LinearMap.fst ℤ _ _).comp sumChainsEquiv.toLinearMap) := by - apply Finsupp.lhom_ext - rintro ⟨g,s | t⟩ n <;> simp - exact LinearMap.congr_fun h c - -/-- A trivial extra generator contributes an -independent free summand to the cycle module, with no cardinality restriction. -/ -def cycleSumEquiv (v : S → Γ) : - cycles (Sum.elim v (fun _ : T => 1)) ≃ₗ[ℤ] cycles v × BasedChains Γ T where - toFun c := (⟨(sumChainsEquiv c.val).1, by - rw [LinearMap.mem_ker, ← edgeBoundary_sum_trivial] - exact c.property⟩, (sumChainsEquiv c.val).2) - invFun c := ⟨sumChainsEquiv.symm (c.1.val,c.2), by - rw [LinearMap.mem_ker,edgeBoundary_sum_trivial,LinearEquiv.apply_symm_apply] - exact c.1.property⟩ - left_inv c := by - apply Subtype.ext - exact sumChainsEquiv.symm_apply_apply c.val - right_inv c := by - apply Prod.ext - · apply Subtype.ext - exact congrArg Prod.fst (sumChainsEquiv.apply_symm_apply (c.1.val,c.2)) - · exact congrArg (fun p : BasedChains Γ S × BasedChains Γ T => p.2) (sumChainsEquiv.apply_symm_apply (c.1.val,c.2)) - map_add' c d := by - apply Prod.ext - · apply Subtype.ext - exact congrArg Prod.fst (sumChainsEquiv.map_add c.val d.val) - · exact congrArg (fun p : BasedChains Γ S × BasedChains Γ T => p.2) (sumChainsEquiv.map_add c.val d.val) - map_smul' n c := by - apply Prod.ext - · apply Subtype.ext - exact congrArg Prod.fst (sumChainsEquiv.map_smul n c.val) - · exact congrArg (fun p : BasedChains Γ S × BasedChains Γ T => p.2) (sumChainsEquiv.map_smul n c.val) - -end TrivialGenerators -end EilenbergGanea - -namespace EilenbergGanea -section WordEquivalence -variable {Γ S T : Type*} [Group Γ] - -theorem pathChain_hom (v : S → Γ) (w : T → Γ) (e : FreeGroup S →* FreeGroup T) - (he : (wordValue w).comp e = wordValue v) (a : FreeGroup S) (g : Γ) : - relatorChainMap w (fun s => e (FreeGroup.of s)) (pathChain v a g) = - pathChain w (e a) g := by - have hv : (fun s => wordValue w (e (FreeGroup.of s))) = v := by - funext s - simpa [wordValue] using DFunLike.congr_fun he (FreeGroup.of s) - have hl : FreeGroup.lift (fun s => e (FreeGroup.of s)) = e := by - apply FreeGroup.ext_hom - intro s - simp - rw [← hv,pathChain_substitution,hl] - -theorem edgeBoundary_hom (v : S → Γ) (w : T → Γ) (e : FreeGroup S →* FreeGroup T) - (he : (wordValue w).comp e = wordValue v) : - (edgeBoundary w).comp (relatorChainMap w (fun s => e (FreeGroup.of s))) = edgeBoundary v := by - apply Finsupp.lhom_ext - rintro ⟨g,s⟩ n - have hs : wordValue w (e (FreeGroup.of s)) = v s := by - simpa [wordValue] using DFunLike.congr_fun he (FreeGroup.of s) - simp [edgeBoundary_pathChain,hs] - -/-- An honest free-generator equivalence gives an invertible integral edge-chain -map; the path chains, not only their augmented exponent sums, are transported. -/ -def wordChainEquiv (v : S → Γ) (w : T → Γ) (e : FreeGroup S ≃* FreeGroup T) - (he : (wordValue w).comp e.toMonoidHom = wordValue v) : - BasedChains Γ S ≃ₗ[ℤ] BasedChains Γ T where - __ := relatorChainMap w (fun s => e (FreeGroup.of s)) - invFun := relatorChainMap v (fun t => e.symm (FreeGroup.of t)) - left_inv c := by - have hi : (wordValue v).comp e.symm.toMonoidHom = wordValue w := by - ext t - have h := DFunLike.congr_fun he (e.symm (FreeGroup.of t)) - simpa using h.symm - have hh : (relatorChainMap v (fun t => e.symm (FreeGroup.of t))).comp - (relatorChainMap w (fun s => e (FreeGroup.of s))) = LinearMap.id := by - apply Finsupp.lhom_ext - rintro ⟨g,s⟩ n - simp only [LinearMap.comp_apply, relatorChainMap_single, map_zsmul, - LinearMap.id_coe, id_eq] - have hh := pathChain_hom w v e.symm.toMonoidHom hi (e (FreeGroup.of s)) g - simpa using congrArg (n • ·) hh - exact LinearMap.congr_fun hh c - right_inv c := by - have hh : (relatorChainMap w (fun s => e (FreeGroup.of s))).comp - (relatorChainMap v (fun t => e.symm (FreeGroup.of t))) = LinearMap.id := by - apply Finsupp.lhom_ext - rintro ⟨g,t⟩ n - simp only [LinearMap.comp_apply, relatorChainMap_single, map_zsmul, - LinearMap.id_coe, id_eq] - have hh := pathChain_hom v w e.toMonoidHom he (e.symm (FreeGroup.of t)) g - simpa using congrArg (n • ·) hh - exact LinearMap.congr_fun hh c - -/-- Invertible change of free generators preserves the full cycle module. -/ -def wordCycleEquiv (v : S → Γ) (w : T → Γ) (e : FreeGroup S ≃* FreeGroup T) - (he : (wordValue w).comp e.toMonoidHom = wordValue v) : cycles v ≃ₗ[ℤ] cycles w := - (wordChainEquiv v w e he).ofSubmodules (cycles v) (cycles w) (by - ext c - rw [Submodule.mem_map_equiv] - change edgeBoundary v ((wordChainEquiv v w e he).symm c) = 0 ↔ edgeBoundary w c = 0 - have h := LinearMap.congr_fun (edgeBoundary_hom v w e.toMonoidHom he) - ((wordChainEquiv v w e he).symm c) - change edgeBoundary w (wordChainEquiv v w e he ((wordChainEquiv v w e he).symm c)) = - edgeBoundary v ((wordChainEquiv v w e he).symm c) at h - rw [LinearEquiv.apply_symm_apply] at h - rw [← h]) - -end WordEquivalence -end EilenbergGanea - -namespace EilenbergGanea -section TrivialPresentationExtension -variable {Γ S T R : Type*} [Group Γ] - -def eraseExtra : FreeGroup (S ⊕ T) →* FreeGroup S := - FreeGroup.lift (Sum.elim FreeGroup.of (fun _ => 1)) - -def unitExtendedRelators (r : R → FreeGroup S) : R ⊕ T → FreeGroup (S ⊕ T) := - Sum.elim (fun i => FreeGroup.map Sum.inl (r i)) (fun t => FreeGroup.of (.inr t)) - -theorem unitExtendedRelators_trivial (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (i : R ⊕ T) : - wordValue (Sum.elim v (fun _ : T => 1)) (unitExtendedRelators r i) = 1 := by - rcases i with i | t - · change wordValue _ (FreeGroup.map Sum.inl (r i)) = 1 - have he : (wordValue (Sum.elim v (fun _ : T => 1))).comp (FreeGroup.map Sum.inl) = - wordValue v := by - apply FreeGroup.ext_hom - intro s - simp [wordValue] - exact (DFunLike.congr_fun he (r i)).trans (hr i) - · simp [unitExtendedRelators,wordValue] - -/-- Adjoining arbitrarily many generators of value one and their unit relators -preserves the actual presentation, not merely its abelianization. -/ -theorem unitExtension_normalClosure (v : S → Γ) (r : R → FreeGroup S) - (hp : (wordValue v).ker = Subgroup.normalClosure (Set.range r)) : - (wordValue (Sum.elim v (fun _ : T => 1))).ker = - Subgroup.normalClosure (Set.range (unitExtendedRelators r : R ⊕ T → _)) := by - let N := Subgroup.normalClosure (Set.range (unitExtendedRelators r : R ⊕ T → _)) - have hr (i) : wordValue v (r i) = 1 := by - change r i ∈ (wordValue v).ker - rw [hp] - exact Subgroup.subset_normalClosure (Set.mem_range_self i) - apply le_antisymm - · intro w hw - have hcomp : (wordValue v).comp eraseExtra = - wordValue (Sum.elim v (fun _ : T => 1)) := by - apply FreeGroup.ext_hom - intro s - rcases s with s | t <;> simp [eraseExtra,wordValue] - have hker : eraseExtra w ∈ Subgroup.normalClosure (Set.range r) := by - rw [← hp] - exact (DFunLike.congr_fun hcomp w).trans hw - have hmap : FreeGroup.map Sum.inl (eraseExtra w) ∈ N := by - apply Subgroup.normalClosure_mono (s := (FreeGroup.map Sum.inl) '' Set.range r) - (by rintro _ ⟨a,⟨i,rfl⟩,rfl⟩; exact ⟨Sum.inl i,rfl⟩) - exact Subgroup.comap_normalClosure_image_ge _ (FreeGroup.map Sum.inl) hker - have heq : (QuotientGroup.mk' N : FreeGroup (S ⊕ T) →* _) = - ((QuotientGroup.mk' N).comp (FreeGroup.map Sum.inl)).comp eraseExtra := by - apply FreeGroup.ext_hom - intro s - rcases s with s | t - · simp [eraseExtra] - · simp only [MonoidHom.comp_apply,eraseExtra,FreeGroup.lift_apply_of,Sum.elim_inr,map_one] - apply (QuotientGroup.eq_one_iff _).mpr - exact Subgroup.subset_normalClosure ⟨Sum.inr t,rfl⟩ - apply (QuotientGroup.eq_one_iff _).mp - change (QuotientGroup.mk' N) w = 1 - rw [DFunLike.congr_fun heq w] - exact (QuotientGroup.eq_one_iff _).mpr hmap - · exact normal_relators_trivial _ _ (unitExtendedRelators_trivial v r hr) - -/-- The chain matrix of adjoining unit relators is a block diagonal matrix. -/ -theorem unitExtension_chain (v : S → Γ) (r : R → FreeGroup S) - (c : BasedChains Γ (R ⊕ T)) : - sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : T => 1)) - (unitExtendedRelators r) c) = - (relatorChainMap v r (sumChainsEquiv c).1,(sumChainsEquiv c).2) := by - have hi (w : FreeGroup S) (g : Γ) : - sumChainsEquiv (pathChain (Sum.elim v (fun _ : T => 1)) (FreeGroup.map Sum.inl w) g) = - (pathChain v w g,0) := by - induction w using FreeGroup.induction_on generalizing g with - | one => simp only [map_one,pathChain_one,map_zero]; rfl - | of s => simp - | inv_of s _ih => simp [pathChain_inv,wordValue] - | mul w z hw hz => - have hv : wordValue (Sum.elim v (fun _ : T => 1)) (FreeGroup.map Sum.inl w) = wordValue v w := by - have h : (wordValue (Sum.elim v (fun _ : T => 1))).comp (FreeGroup.map Sum.inl) = wordValue v := by - apply FreeGroup.ext_hom - intro s - simp [wordValue] - exact DFunLike.congr_fun h w - simp only [map_mul,pathChain_mul,map_add,hw,hz,hv,Prod.mk_add_mk,add_zero] - have he : sumChainsEquiv.toLinearMap.comp (relatorChainMap - (Sum.elim v (fun _ : T => 1)) (unitExtendedRelators r)) = - (((relatorChainMap v r).comp (LinearMap.fst ℤ _ _)).prod - (LinearMap.snd ℤ _ _)).comp sumChainsEquiv.toLinearMap := by - apply Finsupp.lhom_ext - rintro ⟨g,i | t⟩ n - · simp [unitExtendedRelators,hi] - · simp [unitExtendedRelators] - exact LinearMap.congr_fun he c - -end TrivialPresentationExtension -end EilenbergGanea - -namespace EilenbergGanea -section UnitExtensionBasis -variable {Γ S T R : Type*} [Group Γ] - -/-- Completely explicit stabilization of a boundary-basis presentation. -/ -def unitExtensionBasis (v : S → Γ) (B : BasedChains Γ R ≃ₗ[ℤ] cycles v) : - BasedChains Γ (R ⊕ T) ≃ₗ[ℤ] cycles (Sum.elim v (fun _ : T => 1)) := - sumChainsEquiv.trans ((B.prodCongr (LinearEquiv.refl ℤ (BasedChains Γ T))).trans - (cycleSumEquiv v).symm) - -theorem unitExtensionBasis_value (v : S → Γ) (r : R → FreeGroup S) - (B : BasedChains Γ R ≃ₗ[ℤ] cycles v) - (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v r c) - (c : BasedChains Γ (R ⊕ T)) : - (unitExtensionBasis v B c : BasedChains Γ (S ⊕ T)) = - relatorChainMap (Sum.elim v (fun _ : T => 1)) (unitExtendedRelators r) c := by - apply sumChainsEquiv.injective - rw [unitExtension_chain] - change sumChainsEquiv (sumChainsEquiv.symm - ((B (sumChainsEquiv c).1).val,(sumChainsEquiv c).2)) = _ - rw [LinearEquiv.apply_symm_apply,hB] - -/-- Equivariance is automatic for an isomorphism whose columns are actual path -chains. This derives, rather than assumes, equivariance of its inverse. -/ -theorem chainBasisCoordinate_equivariant (v : S → Γ) - (r : R → FreeGroup S) (u : T → FreeGroup S) - (E : BasedChains Γ R ≃ₗ[ℤ] cycles v) - (B : BasedChains Γ T ≃ₗ[ℤ] cycles v) - (hE : ∀ c, (E c : BasedChains Γ S) = relatorChainMap v r c) - (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v u c) : - ChainsEquivariant (E.trans B.symm).toLinearMap := by - intro g c - apply B.injective - apply Subtype.ext - change (B (B.symm (E (translateChains g c)))).val = - (B (translateChains g (B.symm (E c)))).val - rw [B.apply_symm_apply,hE,hB,relatorChainMap_equivariant v u g] - rw [← hB,B.apply_symm_apply,hE] - exact relatorChainMap_equivariant v r g c - -end UnitExtensionBasis -end EilenbergGanea - -namespace EilenbergGanea -section Nielsen -variable {Γ S T A R : Type*} [Group Γ] - -def nielsenHom (a : T → FreeGroup S) : FreeGroup (S ⊕ T) →* FreeGroup (S ⊕ T) := - FreeGroup.lift (Sum.elim (fun s => FreeGroup.of (.inl s)) - (fun t => FreeGroup.of (.inr t) * FreeGroup.map Sum.inl (a t))) - -@[simp] theorem nielsenHom_of_left (a : T → FreeGroup S) (s : S) : - nielsenHom a (FreeGroup.of (.inl s)) = FreeGroup.of (.inl s) := by - simp [nielsenHom] - -@[simp] theorem nielsenHom_of_right (a : T → FreeGroup S) (t : T) : - nielsenHom a (FreeGroup.of (.inr t)) = - FreeGroup.of (.inr t) * FreeGroup.map Sum.inl (a t) := by - simp [nielsenHom] - -@[simp] theorem nielsenHom_left (a : T → FreeGroup S) (w : FreeGroup S) : - nielsenHom a (FreeGroup.map Sum.inl w) = FreeGroup.map Sum.inl w := by - have h : (nielsenHom a).comp (FreeGroup.map Sum.inl) = FreeGroup.map Sum.inl := by - apply FreeGroup.ext_hom - intro s - simp [nielsenHom] - exact DFunLike.congr_fun h w - -def nielsenEquiv (a : T → FreeGroup S) : FreeGroup (S ⊕ T) ≃* FreeGroup (S ⊕ T) where - __ := nielsenHom a - invFun := nielsenHom (fun t => (a t)⁻¹) - left_inv w := by - have h : (nielsenHom (fun t => (a t)⁻¹)).comp (nielsenHom a) = MonoidHom.id _ := by - apply FreeGroup.ext_hom - intro s - rcases s with s | t <;> simp [mul_assoc] - exact DFunLike.congr_fun h w - right_inv w := by - have h : (nielsenHom a).comp (nielsenHom (fun t => (a t)⁻¹)) = MonoidHom.id _ := by - apply FreeGroup.ext_hom - intro s - rcases s with s | t <;> simp [mul_assoc] - exact DFunLike.congr_fun h w - -@[simp] theorem nielsenEquiv_apply (a : T → FreeGroup S) (w : FreeGroup (S ⊕ T)) : - nielsenEquiv a w = nielsenHom a w := rfl - -theorem nielsen_wordValue (v : S → Γ) (w : T → Γ) (a : T → FreeGroup S) : - (wordValue (Sum.elim v w)).comp (nielsenEquiv a).toMonoidHom = - wordValue (Sum.elim v (fun t => w t * wordValue v (a t))) := by - have hi (u : FreeGroup S) : wordValue (Sum.elim v w) (FreeGroup.map Sum.inl u) = - wordValue v u := by - have h : (wordValue (Sum.elim v w)).comp (FreeGroup.map Sum.inl) = wordValue v := by - apply FreeGroup.ext_hom - intro s - simp [wordValue] - exact DFunLike.congr_fun h u - apply FreeGroup.ext_hom - intro s - rcases s with s | t - · simp [nielsenHom,wordValue] - · change wordValue (Sum.elim v w) (nielsenHom a (FreeGroup.of (.inr t))) = _ - rw [nielsenHom_of_right,map_mul,hi] - simp [wordValue] - -theorem wordPresentation_transport (v : S → Γ) (w : T → Γ) - (e : FreeGroup S ≃* FreeGroup T) - (he : (wordValue w).comp e.toMonoidHom = wordValue v) - (r : R → FreeGroup S) - (hp : (wordValue v).ker = Subgroup.normalClosure (Set.range r)) : - (wordValue w).ker = Subgroup.normalClosure (Set.range (fun i => e (r i))) := by - have hi : (wordValue v).comp e.symm.toMonoidHom = wordValue w := by - apply FreeGroup.ext_hom - intro t - simpa using (DFunLike.congr_fun he (e.symm (FreeGroup.of t))).symm - change (wordValue w).ker = Subgroup.normalClosure (Set.range (e ∘ r)) - rw [Set.range_comp] - change (wordValue w).ker = Subgroup.normalClosure (e.toMonoidHom '' Set.range r) - rw [← Subgroup.map_normalClosure _ e.toMonoidHom e.surjective, ← hp] - ext a - constructor - · intro ha - refine ⟨e.symm a,?_,e.apply_symm_apply a⟩ - exact (DFunLike.congr_fun hi a).trans ha - · rintro ⟨b,hb,rfl⟩ - exact (DFunLike.congr_fun he b).trans hb - -def wordBasisTransport (v : S → Γ) (w : T → Γ) - (e : FreeGroup S ≃* FreeGroup T) - (he : (wordValue w).comp e.toMonoidHom = wordValue v) - (B : BasedChains Γ R ≃ₗ[ℤ] cycles v) : BasedChains Γ R ≃ₗ[ℤ] cycles w := - B.trans (wordCycleEquiv v w e he) - -theorem wordBasisTransport_value (v : S → Γ) (w : T → Γ) - (e : FreeGroup S ≃* FreeGroup T) - (he : (wordValue w).comp e.toMonoidHom = wordValue v) - (B : BasedChains Γ R ≃ₗ[ℤ] cycles v) (r : R → FreeGroup S) - (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v r c) - (c : BasedChains Γ R) : - (wordBasisTransport v w e he B c : BasedChains Γ T) = - relatorChainMap w (fun i => e (r i)) c := by - change relatorChainMap w (fun s => e (FreeGroup.of s)) (B c).val = _ - rw [hB] - have hh : (relatorChainMap w (fun s => e (FreeGroup.of s))).comp (relatorChainMap v r) = - relatorChainMap w (fun i => e (r i)) := by - apply Finsupp.lhom_ext - rintro ⟨g,i⟩ n - simp only [LinearMap.comp_apply,relatorChainMap_single,map_zsmul] - exact congrArg (n • ·) (pathChain_hom v w e.toMonoidHom he (r i) g) - exact LinearMap.congr_fun hh c - -end Nielsen -end EilenbergGanea - -namespace EilenbergGanea -section GeneratorAlignment -variable {Γ S T A R : Type*} [Group Γ] - -def freeGroupCongr (e : S ≃ T) : FreeGroup S ≃* FreeGroup T where - __ := FreeGroup.map e - invFun := FreeGroup.map e.symm - left_inv w := by simpa [Function.comp_def] using FreeGroup.map.comp e e.symm w - right_inv w := by simpa [Function.comp_def] using FreeGroup.map.comp e.symm e w - -@[simp] theorem freeGroupCongr_apply (e : S ≃ T) (w : FreeGroup S) : - freeGroupCongr e w = FreeGroup.map e w := rfl - -theorem wordValue_congr_alphabet (v : S → Γ) (w : T → Γ) (e : S ≃ T) - (h : ∀ s, w (e s) = v s) : - (wordValue w).comp (freeGroupCongr e).toMonoidHom = wordValue v := by - apply FreeGroup.ext_hom - intro s - simpa [wordValue] using h s - -theorem wordRelators_transport_trivial (v : S → Γ) (w : T → Γ) - (e : FreeGroup S ≃* FreeGroup T) - (he : (wordValue w).comp e.toMonoidHom = wordValue v) - (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) : - ∀ i, wordValue w (e (r i)) = 1 := by - intro i - exact (DFunLike.congr_fun he (r i)).trans (hr i) - -/-- Generator change starting with an actual boundary-basis presentation, -not with an assumed aligned one. -/ -theorem align_generators (v : S → Γ) (hv : Function.Surjective (wordValue v)) - (a : A → Γ) (ha : Function.Surjective (wordValue a)) - (r : R → FreeGroup A) (hr : ∀ i, wordValue a (r i) = 1) - (hp : (wordValue a).ker = Subgroup.normalClosure (Set.range r)) - (B : BasedChains Γ R ≃ₗ[ℤ] cycles a) - (hB : ∀ c, (B c : BasedChains Γ A) = relatorChainMap a r c) : - ∃ (r' : R ⊕ S → FreeGroup (S ⊕ A)) - (B' : BasedChains Γ (R ⊕ S) ≃ₗ[ℤ] cycles (Sum.elim v (fun _ : A => 1))), - (∀ i, wordValue (Sum.elim v (fun _ : A => 1)) (r' i) = 1) ∧ - (wordValue (Sum.elim v (fun _ : A => 1))).ker = - Subgroup.normalClosure (Set.range r') ∧ - ∀ c, (B' c : BasedChains Γ (S ⊕ A)) = - relatorChainMap (Sum.elim v (fun _ : A => 1)) r' c := by - classical - choose f hf using fun s => ha (v s) - choose g hg using fun t => hv (a t) - let v₀ : A ⊕ S → Γ := Sum.elim a (fun _ => 1) - let v₁ : A ⊕ S → Γ := Sum.elim a v - let v₂ : S ⊕ A → Γ := Sum.elim v a - let v₃ : S ⊕ A → Γ := Sum.elim v (fun _ => 1) - let e₁ := nielsenEquiv (fun s => (f s)⁻¹) - let e₂ := freeGroupCongr (Equiv.sumComm A S) - let e₃ := nielsenEquiv g - have he₁ : (wordValue v₁).comp e₁.toMonoidHom = wordValue v₀ := by - change (wordValue (Sum.elim a v)).comp - (nielsenEquiv (fun s => (f s)⁻¹)).toMonoidHom = _ - simpa only [map_inv,hf,mul_inv_cancel] using - nielsen_wordValue a v (fun s => (f s)⁻¹) - have he₂ : (wordValue v₂).comp e₂.toMonoidHom = wordValue v₁ := by - apply wordValue_congr_alphabet - intro s - rcases s with t | s <;> rfl - have he₃ : (wordValue v₃).comp e₃.toMonoidHom = wordValue v₂ := by - change (wordValue (Sum.elim v (fun _ : A => 1))).comp - (nielsenEquiv g).toMonoidHom = _ - simpa only [one_mul,hg] using nielsen_wordValue v (fun _ : A => 1) g - let r₀ : R ⊕ S → FreeGroup (A ⊕ S) := unitExtendedRelators r - let r₁ : R ⊕ S → FreeGroup (A ⊕ S) := fun i => e₁ (r₀ i) - let r₂ : R ⊕ S → FreeGroup (S ⊕ A) := fun i => e₂ (r₁ i) - let r₃ : R ⊕ S → FreeGroup (S ⊕ A) := fun i => e₃ (r₂ i) - let B₀ : BasedChains Γ (R ⊕ S) ≃ₗ[ℤ] cycles v₀ := unitExtensionBasis a B - let B₁ := wordBasisTransport v₀ v₁ e₁ he₁ B₀ - let B₂ := wordBasisTransport v₁ v₂ e₂ he₂ B₁ - let B₃ := wordBasisTransport v₂ v₃ e₃ he₃ B₂ - have hr₀ : ∀ i, wordValue v₀ (r₀ i) = 1 := unitExtendedRelators_trivial a r hr - have hr₁ := wordRelators_transport_trivial v₀ v₁ e₁ he₁ r₀ hr₀ - have hr₂ := wordRelators_transport_trivial v₁ v₂ e₂ he₂ r₁ hr₁ - have hr₃ := wordRelators_transport_trivial v₂ v₃ e₃ he₃ r₂ hr₂ - have hp₀ : (wordValue v₀).ker = Subgroup.normalClosure (Set.range r₀) := - unitExtension_normalClosure a r hp - have hp₁ := wordPresentation_transport v₀ v₁ e₁ he₁ r₀ hp₀ - have hp₂ := wordPresentation_transport v₁ v₂ e₂ he₂ r₁ hp₁ - have hp₃ := wordPresentation_transport v₂ v₃ e₃ he₃ r₂ hp₂ - have hB₀ : ∀ c, (B₀ c : BasedChains Γ (A ⊕ S)) = relatorChainMap v₀ r₀ c := - unitExtensionBasis_value a r B hB - have hB₁ := wordBasisTransport_value v₀ v₁ e₁ he₁ B₀ r₀ hB₀ - have hB₂ := wordBasisTransport_value v₁ v₂ e₂ he₂ B₁ r₁ hB₁ - have hB₃ := wordBasisTransport_value v₂ v₃ e₃ he₃ B₂ r₂ hB₂ - exact ⟨r₃,B₃,hr₃,hp₃,hB₃⟩ - -end GeneratorAlignment -end EilenbergGanea - -namespace EilenbergGanea -section RelatorBlocks -variable {Γ S T R I : Type*} [Group Γ] - -theorem relatorChainMap_sum (v : S → Γ) (r : R → FreeGroup S) (u : I → FreeGroup S) - (c : BasedChains Γ (R ⊕ I)) : - relatorChainMap v (Sum.elim r u) c = - relatorChainMap v r (sumChainsEquiv c).1 + relatorChainMap v u (sumChainsEquiv c).2 := by - have h : relatorChainMap v (Sum.elim r u) = - ((relatorChainMap v r).comp (LinearMap.fst ℤ _ _) + - (relatorChainMap v u).comp (LinearMap.snd ℤ _ _)).comp sumChainsEquiv.toLinearMap := by - apply Finsupp.lhom_ext - rintro ⟨g,i | j⟩ n <;> simp - exact LinearMap.congr_fun h c - -theorem sumChains_pathChain_left (v : S → Γ) (w : FreeGroup S) (g : Γ) : - sumChainsEquiv (pathChain (Sum.elim v (fun _ : T => 1)) (FreeGroup.map Sum.inl w) g) = - (pathChain v w g,0) := by - induction w using FreeGroup.induction_on generalizing g with - | one => simp only [map_one,pathChain_one,map_zero]; rfl - | of s => simp - | inv_of s _ih => simp [pathChain_inv,wordValue] - | mul w z hw hz => - have hv : wordValue (Sum.elim v (fun _ : T => 1)) (FreeGroup.map Sum.inl w) = wordValue v w := by - have h : (wordValue (Sum.elim v (fun _ : T => 1))).comp (FreeGroup.map Sum.inl) = wordValue v := by - apply FreeGroup.ext_hom - intro s - simp [wordValue] - exact DFunLike.congr_fun h w - simp only [map_mul,pathChain_mul,map_add,hw,hz,hv,Prod.mk_add_mk,add_zero] - -theorem sumChains_relatorMap_left (v : S → Γ) (r : R → FreeGroup S) (c : BasedChains Γ R) : - sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : T => 1)) - (fun i => FreeGroup.map Sum.inl (r i)) c) = (relatorChainMap v r c,0) := by - have h : sumChainsEquiv.toLinearMap.comp (relatorChainMap - (Sum.elim v (fun _ : T => 1)) (fun i => FreeGroup.map Sum.inl (r i))) = - (relatorChainMap v r).prod 0 := by - apply Finsupp.lhom_ext - rintro ⟨g,i⟩ n - simp [sumChains_pathChain_left] - exact LinearMap.congr_fun h c - -theorem sumChains_relatorMap_right (v : S → Γ) (c : BasedChains Γ T) : - sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : T => 1)) - (fun i => FreeGroup.of (.inr i)) c) = (0,c) := by - have h : sumChainsEquiv.toLinearMap.comp (relatorChainMap - (Sum.elim v (fun _ : T => 1)) (fun i => FreeGroup.of (.inr i))) = - (0 : BasedChains Γ T →ₗ[ℤ] BasedChains Γ S).prod LinearMap.id := by - apply Finsupp.lhom_ext - rintro ⟨g,i⟩ n - simp - exact LinearMap.congr_fun h c - -theorem range_sumElim {α β γ : Type*} (f : α → γ) (g : β → γ) : - Set.range (Sum.elim f g) = Set.range f ∪ Set.range g := by - ext x - constructor - · rintro ⟨a | b,rfl⟩ - · exact Or.inl ⟨a,rfl⟩ - · exact Or.inr ⟨b,rfl⟩ - · rintro (⟨a,rfl⟩ | ⟨b,rfl⟩) - · exact ⟨Sum.inl a,rfl⟩ - · exact ⟨Sum.inr b,rfl⟩ - -/-- The stabilized three-shear conclusion in exact cycle coordinates. This -includes injectivity for the entire new boundary list, even for infinite sets. -/ -theorem stabilized_alignment (v : S → Γ) (hv : Function.Surjective (wordValue v)) - (r : R → FreeGroup S) (z : I → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (_hz : ∀ i, wordValue v (z i) = 1) - (hp : (wordValue v).ker = Subgroup.normalClosure (Set.range r)) - (E : BasedChains Γ R ≃ₗ[ℤ] cycles v) (B : BasedChains Γ I ≃ₗ[ℤ] cycles v) - (hE : ∀ c, (E c : BasedChains Γ S) = relatorChainMap v r c) - (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v z c) : - ∃ (r' : R → FreeGroup (S ⊕ I)) (u' : I → FreeGroup (S ⊕ I)), - (∀ i, wordValue (Sum.elim v (fun _ : I => 1)) (r' i) = 1) ∧ - (∀ i, wordValue (Sum.elim v (fun _ : I => 1)) (u' i) = 1) ∧ - (wordValue (Sum.elim v (fun _ : I => 1))).ker = - Subgroup.normalClosure (Set.range (Sum.elim r' u')) ∧ - Function.Injective (relatorChainMap (Sum.elim v (fun _ : I => 1)) (Sum.elim r' u')) ∧ - (∀ c, sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : I => 1)) r' c) = - (0,-(E.trans B.symm) c)) ∧ - ∀ c, sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : I => 1)) u' c) = - ((B c).val,0) := by - let w : S ⊕ I → Γ := Sum.elim v (fun _ => 1) - let r₀ : R → FreeGroup (S ⊕ I) := fun i => FreeGroup.map Sum.inl (r i) - let u₀ : I → FreeGroup (S ⊕ I) := fun i => FreeGroup.of (.inr i) - let A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ I := E.trans B.symm - have hA : ChainsEquivariant A.toLinearMap := chainBasisCoordinate_equivariant v r z E B hE hB - have hw : Function.Surjective (wordValue w) := by - intro g - obtain ⟨a,ha⟩ := hv g - refine ⟨FreeGroup.map Sum.inl a,?_⟩ - have h : (wordValue w).comp (FreeGroup.map Sum.inl) = wordValue v := by - apply FreeGroup.ext_hom - intro s - simp [wordValue,w] - exact (DFunLike.congr_fun h a).trans ha - have hr₀ : ∀ i, wordValue w (r₀ i) = 1 := fun i => - unitExtendedRelators_trivial v r hr (.inl i) - have hu₀ : ∀ i, wordValue w (u₀ i) = 1 := fun i => - unitExtendedRelators_trivial v r hr (.inr i) - obtain ⟨r',u',hr',hu',hN,hDr,hDu⟩ := block_word_alignment w hw r₀ u₀ hr₀ hu₀ A hA - have hcr (c) : sumChainsEquiv (relatorChainMap w r' c) = (0,-A c) := by - rw [hDr,LinearMap.neg_apply,LinearMap.comp_apply,map_neg] - rw [sumChains_relatorMap_right] - rfl - have hcu (c) : sumChainsEquiv (relatorChainMap w u' c) = ((B c).val,0) := by - rw [hDu,LinearMap.comp_apply,sumChains_relatorMap_left,← hE] - simp [A] - have hinj : Function.Injective (relatorChainMap w (Sum.elim r' u')) := by - have hz₀ (c) (hc : relatorChainMap w (Sum.elim r' u') c = 0) : c = 0 := by - have h := congrArg sumChainsEquiv hc - rw [relatorChainMap_sum,map_add,hcr,hcu,map_zero] at h - have hi : (sumChainsEquiv c).2 = 0 := by - apply B.injective - apply Subtype.ext - simpa only [Prod.mk_add_mk,zero_add,Prod.fst_zero,map_zero,Submodule.coe_zero] using congrArg Prod.fst h - have hr0 : (sumChainsEquiv c).1 = 0 := by - apply A.injective - simpa only [Prod.mk_add_mk,add_zero,Prod.snd_zero,neg_eq_zero,map_zero] using congrArg Prod.snd h - apply sumChainsEquiv.injective - exact Prod.ext (by simpa using hr0) (by simpa using hi) - intro c d h - apply sub_eq_zero.mp - apply hz₀ - rw [map_sub,h,sub_self] - refine ⟨r',u',hr',hu',?_,hinj,hcr,hcu⟩ - rw [range_sumElim,hN] - simpa only [unitExtendedRelators,range_sumElim] using unitExtension_normalClosure (T := I) v r hp - -end RelatorBlocks -end EilenbergGanea - -namespace EilenbergGanea -section Reindexing -variable {Γ S T U R I : Type*} [Group Γ] - -def chainIndexEquiv (e : S ≃ T) : BasedChains Γ S ≃ₗ[ℤ] BasedChains Γ T := - Finsupp.domLCongr (Equiv.prodCongr (Equiv.refl Γ) e) - -omit [Group Γ] in -@[simp] theorem chainIndexEquiv_single (e : S ≃ T) (g : Γ) (s : S) (n : ℤ) : - chainIndexEquiv e (Finsupp.single (g,s) n) = Finsupp.single (g,e s) n := by - simp [chainIndexEquiv] - -theorem relatorChainMap_reindex (v : S → Γ) (r : R → FreeGroup S) (e : I ≃ R) - (c : BasedChains Γ I) : - relatorChainMap v (r ∘ e) c = relatorChainMap v r (chainIndexEquiv e c) := by - have h : relatorChainMap v (r ∘ e) = (relatorChainMap v r).comp (chainIndexEquiv e).toLinearMap := by - apply Finsupp.lhom_ext - rintro ⟨g,i⟩ n - simp - exact LinearMap.congr_fun h c - -theorem chainIndexEquiv_pathChain (v : S → Γ) (w : T → Γ) (e : S ≃ T) - (he : ∀ s, w (e s) = v s) (a : FreeGroup S) (g : Γ) : - chainIndexEquiv e (pathChain v a g) = pathChain w (freeGroupCongr e a) g := by - have hl : relatorChainMap w (fun s => freeGroupCongr e (FreeGroup.of s)) = - (chainIndexEquiv e).toLinearMap := by - apply Finsupp.lhom_ext - rintro ⟨h,s⟩ n - simp - change (chainIndexEquiv e).toLinearMap _ = _ - rw [← hl] - exact pathChain_hom v w (freeGroupCongr e).toMonoidHom (wordValue_congr_alphabet v w e he) a g - -theorem chainIndexEquiv_relatorMap (v : S → Γ) (w : T → Γ) (e : S ≃ T) - (he : ∀ s, w (e s) = v s) (r : R → FreeGroup S) (c : BasedChains Γ R) : - chainIndexEquiv e (relatorChainMap v r c) = - relatorChainMap w (fun i => freeGroupCongr e (r i)) c := by - have h : (chainIndexEquiv e).toLinearMap.comp (relatorChainMap v r) = - relatorChainMap w (fun i => freeGroupCongr e (r i)) := by - apply Finsupp.lhom_ext - rintro ⟨g,i⟩ n - simp [chainIndexEquiv_pathChain v w e he] - exact LinearMap.congr_fun h c - -/-- Permutation of the stabilized relator indices into distinguished and -ordinary blocks, in exactly the order of source (ordinary-diagonal). -/ -def alignmentIndexEquiv : I ⊕ (T ⊕ R) ≃ R ⊕ (I ⊕ T) where - toFun - | .inl i => .inr (.inl i) - | .inr (.inl t) => .inr (.inr t) - | .inr (.inr r) => .inl r - invFun - | .inl r => .inr (.inr r) - | .inr (.inl i) => .inl i - | .inr (.inr t) => .inr (.inl t) - left_inv := by rintro (i | (t | r)) <;> rfl - right_inv := by rintro (r | (i | t)) <;> rfl - -end Reindexing -end EilenbergGanea - -namespace EilenbergGanea -section ExtraProjectionAlignment -variable {Γ S T I R : Type*} [Group Γ] - -omit [Group Γ] in -theorem projectExtraChains_eq_sum_snd (c : BasedChains Γ (S ⊕ T)) : - projectExtraChains c = (sumChainsEquiv c).2 := by - have h : projectExtraChains = (LinearMap.snd ℤ _ _).comp - (sumChainsEquiv : BasedChains Γ (S ⊕ T) ≃ₗ[ℤ] _).toLinearMap := by - apply Finsupp.lhom_ext - rintro ⟨g,s | t⟩ n <;> simp - exact LinearMap.congr_fun h c - -omit [Group Γ] in -theorem chainIndexEquiv_sumAssoc (c : BasedChains Γ ((S ⊕ T) ⊕ I)) : - sumChainsEquiv (chainIndexEquiv (Equiv.sumAssoc S T I) c) = - ((sumChainsEquiv (sumChainsEquiv c).1).1, - sumChainsEquiv.symm ((sumChainsEquiv (sumChainsEquiv c).1).2,(sumChainsEquiv c).2)) := by - apply Prod.ext - · ext ⟨g,s⟩ - rfl - · apply sumChainsEquiv.injective - rw [LinearEquiv.apply_symm_apply] - apply Prod.ext - · ext ⟨g,t⟩ - rfl - · ext ⟨g,i⟩ - rfl - -omit [Group Γ] in -theorem projectExtraChains_assoc (c : BasedChains Γ ((S ⊕ T) ⊕ I)) : - sumChainsEquiv (projectExtraChains (chainIndexEquiv (Equiv.sumAssoc S T I) c)) = - ((sumChainsEquiv (sumChainsEquiv c).1).2,(sumChainsEquiv c).2) := by - rw [projectExtraChains_eq_sum_snd,chainIndexEquiv_sumAssoc,LinearEquiv.apply_symm_apply] - -/-- The ordinary diagonal block (1,-A), without finite-rank assumptions. -/ -def ordinaryBlockEquiv (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ I) : - BasedChains Γ (T ⊕ R) ≃ₗ[ℤ] BasedChains Γ (T ⊕ I) := - sumChainsEquiv.trans (((LinearEquiv.refl ℤ (BasedChains Γ T)).prodCongr - (A.trans (LinearEquiv.neg ℤ))).trans sumChainsEquiv.symm) - -omit [Group Γ] in -@[simp] theorem ordinaryBlockEquiv_value (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ I) - (c : BasedChains Γ (T ⊕ R)) : - sumChainsEquiv (ordinaryBlockEquiv A c) = ((sumChainsEquiv c).1,-A (sumChainsEquiv c).2) := by - simp [ordinaryBlockEquiv] - -end ExtraProjectionAlignment -end EilenbergGanea - -namespace EilenbergGanea -section FinishedAlignment -variable {Γ S T R Z : Type*} [Group Γ] - -/-- Reorder the two stabilization blocks into the distinguished and ordinary -lists. The projected ordinary block is exactly `(1,-A)`, not only injective. -/ -theorem finish_alignment - (v : S → Γ) (z : Z → FreeGroup S) - (B : BasedChains Γ Z ≃ₗ[ℤ] cycles v) - (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v z c) - (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ (Z ⊕ T)) - (r : R → FreeGroup ((S ⊕ T) ⊕ (Z ⊕ T))) - (u : Z ⊕ T → FreeGroup ((S ⊕ T) ⊕ (Z ⊕ T))) - (hr : ∀ i, wordValue (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) (r i) = 1) - (hu : ∀ i, wordValue (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) (u i) = 1) - (hp : (wordValue (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1))).ker = - Subgroup.normalClosure (Set.range (Sum.elim r u))) - (hinj : Function.Injective (relatorChainMap - (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) (Sum.elim r u))) - (hcr : ∀ c, sumChainsEquiv (relatorChainMap - (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) r c) = (0,-A c)) - (hcu : ∀ c, sumChainsEquiv (relatorChainMap - (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) u c) = - ((unitExtensionBasis v B c).val,0)) : - ∃ r' : Z ⊕ (T ⊕ R) → FreeGroup (S ⊕ (T ⊕ (Z ⊕ T))), - (∀ i, wordValue (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) (r' i) = 1) ∧ - (wordValue (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1))).ker = - Subgroup.normalClosure (Set.range r') ∧ - Function.Injective (relatorChainMap (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) r') ∧ - (∀ i, pathChain (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) - (FreeGroup.map Sum.inl (z i)) 1 = - pathChain (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) (r' (.inl i)) 1) ∧ - (ordinaryBlockEquiv A).toLinearMap = extraRelatorMap - (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) (fun i => r' (.inr i)) := by - let w := Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1) - let w' := Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1) - let e := Equiv.sumAssoc S T (Z ⊕ T) - let j : Z ⊕ (T ⊕ R) ≃ R ⊕ (Z ⊕ T) := alignmentIndexEquiv - have he : ∀ s, w' (e s) = w s := by rintro ((s | t) | i) <;> rfl - let f : R ⊕ (Z ⊕ T) → FreeGroup (S ⊕ (T ⊕ (Z ⊕ T))) := - fun i => freeGroupCongr e (Sum.elim r u i) - let r' := f ∘ j - have hrf : ∀ i, wordValue w' (f i) = 1 := by - intro i - have h := DFunLike.congr_fun (wordValue_congr_alphabet w w' e he) (Sum.elim r u i) - exact h.trans (by rcases i with i | i; exact hr i; exact hu i) - have hpf : (wordValue w').ker = Subgroup.normalClosure (Set.range f) := - wordPresentation_transport w w' (freeGroupCongr e) (wordValue_congr_alphabet w w' e he) _ hp - have hpr : (wordValue w').ker = Subgroup.normalClosure (Set.range r') := by - rw [hpf] - congr 1 - ext x - constructor - · rintro ⟨i,rfl⟩ - exact ⟨j.symm i,congrArg f (j.apply_symm_apply i)⟩ - · rintro ⟨i,rfl⟩ - exact ⟨j i,rfl⟩ - have hDf (c : BasedChains Γ (R ⊕ (Z ⊕ T))) : - relatorChainMap w' f c = chainIndexEquiv e (relatorChainMap w (Sum.elim r u) c) := - (chainIndexEquiv_relatorMap w w' e he _ c).symm - have hDr (c) : relatorChainMap w' r' c = - chainIndexEquiv e (relatorChainMap w (Sum.elim r u) (chainIndexEquiv j c)) := by - rw [relatorChainMap_reindex,hDf] - have hinjr : Function.Injective (relatorChainMap w' r') := by - intro a b h - rw [hDr,hDr] at h - exact (chainIndexEquiv j).injective (hinj ((chainIndexEquiv e).injective h)) - have hcU (c : BasedChains Γ (Z ⊕ T)) : - sumChainsEquiv (sumChainsEquiv (relatorChainMap w u c)).1 = - ((B (sumChainsEquiv c).1).val,(sumChainsEquiv c).2) := by - rw [hcu] - change sumChainsEquiv (sumChainsEquiv.symm _) = _ - exact LinearEquiv.apply_symm_apply _ _ - have hd (i : Z) : pathChain w' (FreeGroup.map Sum.inl (z i)) 1 = - pathChain w' (r' (.inl i)) 1 := by - have h := hcu (Finsupp.single (1,Sum.inl i) 1) - have h' := hcU (Finsupp.single (1,Sum.inl i) 1) - simp only [relatorChainMap_single,one_smul,sumChainsEquiv_single_left] at h h' - apply (sumChainsEquiv : BasedChains Γ (S ⊕ (T ⊕ (Z ⊕ T))) ≃ₗ[ℤ] _).injective - have hh : pathChain w' (r' (.inl i)) 1 = chainIndexEquiv e (pathChain w (u (.inl i)) 1) := - (chainIndexEquiv_pathChain w w' e he _ _).symm - rw [hh] - rw [sumChains_pathChain_left,chainIndexEquiv_sumAssoc] - rw [h] - rw [h] at h' - rw [h'] - simp only [hB,relatorChainMap_single,one_smul] - change (_,0) = (_,sumChainsEquiv.symm (0 : BasedChains Γ T × BasedChains Γ (Z ⊕ T))) - rw [map_zero] - have hQ : (ordinaryBlockEquiv A).toLinearMap = extraRelatorMap w' (fun i => r' (.inr i)) := by - apply Finsupp.lhom_ext - rintro ⟨g,t | i⟩ n - · apply sumChainsEquiv.injective - have hh : pathChain w' (r' (.inr (.inl t))) g = - chainIndexEquiv e (pathChain w (u (.inr t)) g) := - (chainIndexEquiv_pathChain w w' e he _ _).symm - simp only [LinearEquiv.coe_coe,ordinaryBlockEquiv_value,sumChainsEquiv_single_left, - map_zero,neg_zero,extraRelatorMap_single,hh,← map_smul] - have hsingle : n • pathChain w (u (.inr t)) g = - relatorChainMap w u (Finsupp.single (g,Sum.inr t) n) := by simp - rw [hsingle,projectExtraChains_assoc,hcu] - have hh' := hcU (Finsupp.single (g,Sum.inr t) n) - rw [hcu] at hh' - simp only [sumChainsEquiv_single_right,map_zero,Submodule.coe_zero] at hh' - rw [hh'] - · apply sumChainsEquiv.injective - have hh : pathChain w' (r' (.inr (.inr i))) g = - chainIndexEquiv e (pathChain w (r i) g) := - (chainIndexEquiv_pathChain w w' e he _ _).symm - simp only [LinearEquiv.coe_coe,ordinaryBlockEquiv_value,sumChainsEquiv_single_right, - extraRelatorMap_single,hh,← map_smul] - have hsingle : n • pathChain w (r i) g = relatorChainMap w r (Finsupp.single (g,i) n) := by simp - rw [hsingle,projectExtraChains_assoc,hcr] - simp - exact ⟨r',fun i => hrf (j i),hpr,hinjr,hd,hQ⟩ - -end FinishedAlignment -end EilenbergGanea - -namespace EilenbergGanea -section BoundaryBasisPresentation -variable {Γ S A R Z : Type*} [Group Γ] - -/-- Full algebraic alignment. The initial and final -presentations are genuine normal-closure presentations. No finiteness of the -old generators or of either relator family is required. -/ -theorem boundary_basis_presentation_alignment - (v : S → Γ) (hv : Function.Surjective (wordValue v)) - (z : Z → FreeGroup S) (hz : ∀ i, wordValue v (z i) = 1) - (B : BasedChains Γ Z ≃ₗ[ℤ] cycles v) - (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v z c) - (a : A → Γ) (ha : Function.Surjective (wordValue a)) - (r : R → FreeGroup A) (hr : ∀ i, wordValue a (r i) = 1) - (hp : (wordValue a).ker = Subgroup.normalClosure (Set.range r)) - (E : BasedChains Γ R ≃ₗ[ℤ] cycles a) - (hE : ∀ c, (E c : BasedChains Γ A) = relatorChainMap a r c) : - ∃ (r' : Z ⊕ (A ⊕ (R ⊕ S)) → FreeGroup (S ⊕ (A ⊕ (Z ⊕ A)))) - (Q : BasedChains Γ (A ⊕ (R ⊕ S)) ≃ₗ[ℤ] BasedChains Γ (A ⊕ (Z ⊕ A))), - (∀ i, wordValue (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) (r' i) = 1) ∧ - (wordValue (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1))).ker = - Subgroup.normalClosure (Set.range r') ∧ - Function.Injective (relatorChainMap (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) r') ∧ - (∀ i, pathChain (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) - (FreeGroup.map Sum.inl (z i)) 1 = - pathChain (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) (r' (.inl i)) 1) ∧ - Q.toLinearMap = extraRelatorMap (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) - (fun i => r' (.inr i)) := by - obtain ⟨r₀,E₀,hr₀,hp₀,hE₀⟩ := align_generators v hv a ha r hr hp E hE - let v₀ : S ⊕ A → Γ := Sum.elim v (fun _ => 1) - have hv₀ : Function.Surjective (wordValue v₀) := by - intro g - obtain ⟨w,hw⟩ := hv g - refine ⟨FreeGroup.map Sum.inl w,?_⟩ - have h : (wordValue v₀).comp (FreeGroup.map Sum.inl) = wordValue v := by - apply FreeGroup.ext_hom - intro s - simp [wordValue,v₀] - exact (DFunLike.congr_fun h w).trans hw - let B₀ : BasedChains Γ (Z ⊕ A) ≃ₗ[ℤ] cycles v₀ := unitExtensionBasis v B - let z₀ : Z ⊕ A → FreeGroup (S ⊕ A) := unitExtendedRelators z - have hz₀ : ∀ i, wordValue v₀ (z₀ i) = 1 := unitExtendedRelators_trivial v z hz - have hB₀ : ∀ c, (B₀ c : BasedChains Γ (S ⊕ A)) = relatorChainMap v₀ z₀ c := - unitExtensionBasis_value v z B hB - obtain ⟨r₁,u₁,hr₁,hu₁,hp₁,hi₁,hcr,hcu⟩ := - stabilized_alignment v₀ hv₀ r₀ z₀ hr₀ hz₀ hp₀ E₀ B₀ hE₀ hB₀ - obtain ⟨r',hr',hp',hi',hd,hQ⟩ := - finish_alignment v z B hB (E₀.trans B₀.symm) r₁ u₁ hr₁ hu₁ hp₁ hi₁ hcr hcu - exact ⟨r',ordinaryBlockEquiv (E₀.trans B₀.symm),hr',hp',hi',hd,hQ⟩ - -end BoundaryBasisPresentation -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion -section BoundaryBasisTransport -variable {Γ S Z A R : Type*} [Group Γ] [Group.ResiduallyFinite Γ] [Fintype Z] - -/-- Full algebraic content of source Theorem presentation: the only additional -input is a genuine arbitrary-alphabet presentation with boundary basis. The -separate CW-to-presentation bridge must supply that input; it is not asserted -here as a hypothesis of the main result. -/ -theorem boundary_basis_small_transport - (v : S → Γ) (hv : Function.Surjective (wordValue v)) - (z : Z → FreeGroup S) (hz : ∀ i, wordValue v (z i) = 1) - (B : BasedChains Γ Z ≃ₗ[ℤ] cycles v) - (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v z c) - (a₀ : A → Γ) (ha₀ : Function.Surjective (wordValue a₀)) - (r₀ : R → FreeGroup A) (hr₀ : ∀ i, wordValue a₀ (r₀ i) = 1) - (hp₀ : (wordValue a₀).ker = Subgroup.normalClosure (Set.range r₀)) - (E : BasedChains Γ R ≃ₗ[ℤ] cycles a₀) - (hE : ∀ c, (E c : BasedChains Γ A) = relatorChainMap a₀ r₀ c) : - ∃ η : ℝ, 0 < η ∧ ∀ a : Γ → S → SU2, - (∀ g s, ‖(a g s : ℍ)-1‖ < η) → - (∀ i g, pathProduct v a (z i) g = 1) → - ∀ w : FreeGroup S, wordValue v w = 1 → ∀ g, - pathProduct v a w g = 1 := by - obtain ⟨r,Q,hr,hp,hinj,hd,hQ⟩ := - boundary_basis_presentation_alignment v hv z hz B hB a₀ ha₀ r₀ hr₀ hp₀ E hE - exact aligned_presentation_small_transport - (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) r z (fun _ => rfl) - hr hz hp hinj hd Q hQ - -end BoundaryBasisTransport -end EilenbergGanea - - -end - -end OAI +import OAI.Topology.EilenbergGanea.PresentationComparison + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +/-! Actual word and cycle-basis alignment. -/ +namespace EilenbergGanea +section WordRealization +variable {Γ S R : Type*} [Group Γ] + +theorem pathChain_zpow_loop (v : S → Γ) (w : FreeGroup S) + (hw : wordValue v w = 1) (n : ℤ) (g : Γ) : + pathChain v (w ^ n) g = n • pathChain v w g := by + induction n using Int.induction_on with + | zero => simp + | succ n ih => + rw [zpow_add, zpow_one, pathChain_mul, map_zpow, hw, one_zpow, mul_one, ih] + simp [add_zsmul] + | pred n ih => + rw [zpow_sub, zpow_one, pathChain_mul, map_zpow, hw, one_zpow, mul_one, + pathChain_inv, hw, inv_one, mul_one, ih] + simp only [sub_eq_add_neg, add_zsmul, neg_zsmul, one_zsmul] + +/-- Every finitely supported integral relator combination is realized by a +finite word in the same normal closure. Surjectivity supplies the finitely +many conjugating words; no infinite product of presentation moves occurs. -/ +theorem realize_relator_chain (v : S → Γ) (hv : Function.Surjective (wordValue v)) + (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) + (c : (Γ × R) →₀ ℤ) : + ∃ w ∈ Subgroup.normalClosure (Set.range r), + pathChain v w 1 = relatorChainMap v r c := by + classical + induction c using Finsupp.induction with + | zero => exact ⟨1, Subgroup.one_mem _, by simp⟩ + | @single_add a n c ha hn ih => + obtain ⟨w,hw,hcw⟩ := ih + obtain ⟨u,hu⟩ := hv a.1 + let z := u * r a.2 * u⁻¹ + have hz : z ∈ Subgroup.normalClosure (Set.range r) := + (Subgroup.normalClosure_normal (s := Set.range r)).conj_mem _ + (Subgroup.subset_normalClosure (Set.mem_range_self a.2)) u + have hzw : wordValue v z = 1 := by simp [z,hr] + refine ⟨z ^ n * w, Subgroup.mul_mem _ (Subgroup.zpow_mem _ hz n) hw, ?_⟩ + rw [pathChain_mul, map_zpow, hzw, one_zpow, mul_one, pathChain_zpow_loop _ _ hzw, + hcw, map_add] + congr 1 + rw [pathChain_conjugate v u _ (hr a.2), one_mul, hu] + simp [relatorChainMap] + +end WordRealization +end EilenbergGanea +namespace EilenbergGanea +section RelatorShears +variable {Γ S R I : Type*} [Group Γ] + +theorem relatorChainMap_equivariant (v : S → Γ) (r : R → FreeGroup S) : + ChainsEquivariant (relatorChainMap v r) := by + intro g c + have he : (relatorChainMap v r).comp (translateChains g) = + (translateChains g).comp (relatorChainMap v r) := by + apply Finsupp.lhom_ext + rintro ⟨h,i⟩ n + simp only [LinearMap.comp_apply, translateChains_single, relatorChainMap, + Finsupp.linearCombination_single, map_smul, pathChain_translate] + exact LinearMap.congr_fun he c + +theorem normal_relators_trivial (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) : + Subgroup.normalClosure (Set.range r) ≤ (wordValue v).ker := by + apply Subgroup.normalClosure_le_normal + rintro _ ⟨i,rfl⟩ + exact hr i + +@[simp] theorem relatorChainMap_single (v : S → Γ) (r : R → FreeGroup S) + (g : Γ) (i : R) (n : ℤ) : + relatorChainMap v r (Finsupp.single (g,i) n) = n • pathChain v (r i) g := by + simp [relatorChainMap] + +/-- A whole column-finite shear is realized by honest finite relator words, +including when the relator alphabets have arbitrary cardinality. -/ +theorem shear_relators (v : S → Γ) (hv : Function.Surjective (wordValue v)) + (r : R → FreeGroup S) (u : I → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (hu : ∀ i, wordValue v (u i) = 1) + (C : BasedChains Γ I →ₗ[ℤ] BasedChains Γ R) (hC : ChainsEquivariant C) : + ∃ u' : I → FreeGroup S, + (∀ i, wordValue v (u' i) = 1) ∧ + Subgroup.normalClosure (Set.range r ∪ Set.range u') = + Subgroup.normalClosure (Set.range r ∪ Set.range u) ∧ + relatorChainMap v u' = relatorChainMap v u + (relatorChainMap v r).comp C := by + classical + choose p hp hc using fun i => realize_relator_chain v hv r hr (C (Finsupp.single (1,i) 1)) + let u' : I → FreeGroup S := fun i => u i * p i + have hpr (i) : wordValue v (p i) = 1 := normal_relators_trivial v r hr (hp i) + have hu' (i) : wordValue v (u' i) = 1 := by simp [u',hu,hpr] + refine ⟨u',hu',?_,?_⟩ + · apply le_antisymm + · apply Subgroup.normalClosure_le_normal + rintro _ (⟨i,rfl⟩ | ⟨i,rfl⟩) + · exact Subgroup.subset_normalClosure (Or.inl (Set.mem_range_self i)) + · exact Subgroup.mul_mem _ (Subgroup.subset_normalClosure (Or.inr (Set.mem_range_self i))) + (Subgroup.normalClosure_mono Set.subset_union_left (hp i)) + · apply Subgroup.normalClosure_le_normal + rintro _ (⟨i,rfl⟩ | ⟨i,rfl⟩) + · exact Subgroup.subset_normalClosure (Or.inl (Set.mem_range_self i)) + · have h : u' i * (p i)⁻¹ ∈ Subgroup.normalClosure (Set.range r ∪ Set.range u') := + Subgroup.mul_mem _ (Subgroup.subset_normalClosure (Or.inr (Set.mem_range_self i))) + (Subgroup.inv_mem _ (Subgroup.normalClosure_mono Set.subset_union_left (hp i))) + simpa [u'] using h + · have hb (i) : pathChain v (u' i) 1 = pathChain v (u i) 1 + + relatorChainMap v r (C (Finsupp.single (1,i) 1)) := by + simp only [u',pathChain_mul,hu,mul_one,hc] + have hbg (g : Γ) (i : I) : pathChain v (u' i) g = pathChain v (u i) g + + relatorChainMap v r (C (Finsupp.single (g,i) 1)) := by + have h := congrArg (translateChains g) (hb i) + rw [map_add,pathChain_translate,pathChain_translate,mul_one, + ← relatorChainMap_equivariant v r g, ← hC g, translateChains_single,mul_one] at h + exact h + apply Finsupp.lhom_ext + rintro ⟨g,i⟩ n + have hn : Finsupp.single (g,i) n = n • Finsupp.single (g,i) (1 : ℤ) := by simp + simpa only [hn, map_smul, LinearMap.add_apply, LinearMap.comp_apply, + relatorChainMap_single, one_smul, smul_add] using congrArg (n • ·) (hbg g i) + +/-- The source's three shears P,Q,P, at the level of relator words rather +than merely chain matrices. No infinite product or cardinality restriction. -/ +theorem block_word_alignment (v : S → Γ) (hv : Function.Surjective (wordValue v)) + (r : R → FreeGroup S) (u : I → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (hu : ∀ i, wordValue v (u i) = 1) + (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ I) + (hA : ChainsEquivariant A.toLinearMap) : + ∃ (r' : R → FreeGroup S) (u' : I → FreeGroup S), + (∀ i, wordValue v (r' i) = 1) ∧ (∀ i, wordValue v (u' i) = 1) ∧ + Subgroup.normalClosure (Set.range r' ∪ Set.range u') = + Subgroup.normalClosure (Set.range r ∪ Set.range u) ∧ + relatorChainMap v r' = -((relatorChainMap v u).comp A.toLinearMap) ∧ + relatorChainMap v u' = (relatorChainMap v r).comp A.symm.toLinearMap := by + have hAi := ChainsEquivariant.symm A hA + have hnA : ChainsEquivariant (-A.toLinearMap) := by + intro g c + simp only [LinearMap.neg_apply, map_neg] + exact congrArg Neg.neg (hA g c) + obtain ⟨u₁,hu₁,hN₁,hD₁⟩ := shear_relators v hv r u hr hu A.symm.toLinearMap hAi + obtain ⟨r₂,hr₂,hN₂,hD₂⟩ := shear_relators v hv u₁ r hu₁ hr (-A.toLinearMap) hnA + have hD₂' : relatorChainMap v r₂ = -((relatorChainMap v u).comp A.toLinearMap) := by + rw [hD₂,hD₁] + ext c + simp only [LinearMap.add_apply, LinearMap.comp_apply, LinearMap.neg_apply, + map_neg, LinearEquiv.coe_coe, LinearEquiv.symm_apply_apply] + abel_nf + obtain ⟨u₃,hu₃,hN₃,hD₃⟩ := shear_relators v hv r₂ u₁ hr₂ hu₁ A.symm.toLinearMap hAi + refine ⟨r₂,u₃,hr₂,hu₃,?_,hD₂',?_⟩ + · rw [hN₃,Set.union_comm (Set.range r₂) (Set.range u₁),hN₂, + Set.union_comm (Set.range u₁) (Set.range r),hN₁] + · rw [hD₃,hD₁,hD₂'] + ext c + simp only [LinearMap.add_apply, LinearMap.comp_apply, LinearMap.neg_apply, + LinearEquiv.coe_coe, LinearEquiv.apply_symm_apply] + abel_nf + +end RelatorShears +end EilenbergGanea + +namespace EilenbergGanea +section CycleSpaces +variable {Γ S T U R : Type*} [Group Γ] + +def edgeBoundary (v : S → Γ) : BasedChains Γ S →ₗ[ℤ] (Γ →₀ ℤ) := + Finsupp.linearCombination ℤ (fun p : Γ × S => + Finsupp.single (p.1 * v p.2) 1 - Finsupp.single p.1 1) + +@[simp] theorem edgeBoundary_single (v : S → Γ) (g : Γ) (s : S) (n : ℤ) : + edgeBoundary v (Finsupp.single (g,s) n) = + n • (Finsupp.single (g * v s) 1 - Finsupp.single g 1) := by + simp [edgeBoundary] + +theorem edgeBoundary_pathChain (v : S → Γ) (w : FreeGroup S) (g : Γ) : + edgeBoundary v (pathChain v w g) = + Finsupp.single (g * wordValue v w) 1 - Finsupp.single g 1 := by + induction w using FreeGroup.induction_on generalizing g with + | one => simp + | of s => simp [wordValue] + | inv_of s _ih => simp [pathChain_inv,wordValue] + | mul w z hw hz => + rw [pathChain_mul,map_add,hw,hz,map_mul] + simp only [mul_assoc] + abel + +abbrev cycles (v : S → Γ) := LinearMap.ker (edgeBoundary v) + +theorem relatorChainMap_boundary (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) : + (edgeBoundary v).comp (relatorChainMap v r) = 0 := by + apply Finsupp.lhom_ext + rintro ⟨g,i⟩ n + simp [edgeBoundary_pathChain,hr] + +def relatorCycles (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) : BasedChains Γ R →ₗ[ℤ] cycles v := + (relatorChainMap v r).codRestrict _ (fun c => by + rw [LinearMap.mem_ker] + exact LinearMap.congr_fun (relatorChainMap_boundary v r hr) c) + +@[simp] theorem relatorCycles_coe (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (c : BasedChains Γ R) : + (relatorCycles v r hr c : BasedChains Γ S) = relatorChainMap v r c := rfl + +theorem wordValue_substitution (v : T → Γ) (f : S → FreeGroup T) (w : FreeGroup S) : + wordValue v (FreeGroup.lift f w) = wordValue (fun s => wordValue v (f s)) w := by + have h : (wordValue v).comp (FreeGroup.lift f) = + wordValue (fun s => wordValue v (f s)) := by + apply FreeGroup.ext_hom + intro s + simp [wordValue] + exact DFunLike.congr_fun h w + +/-- Naturality of the actual path chain under arbitrary finite-word substitution. -/ +theorem pathChain_substitution (v : T → Γ) (f : S → FreeGroup T) + (w : FreeGroup S) (g : Γ) : + relatorChainMap v f (pathChain (fun s => wordValue v (f s)) w g) = + pathChain v (FreeGroup.lift f w) g := by + induction w using FreeGroup.induction_on generalizing g with + | one => simp + | of s => simp + | inv_of s _ih => + simp only [pathChain_inv,map_neg,pathChain_of,relatorChainMap_single,one_smul, + map_inv,FreeGroup.lift_apply_of,wordValue] + | mul w z hw hz => + rw [pathChain_mul,map_add,hw,hz,map_mul,pathChain_mul,wordValue_substitution] + +theorem relatorChainMap_substitution (v : U → Γ) + (f : T → FreeGroup U) (e : S → FreeGroup T) : + (relatorChainMap v f).comp (relatorChainMap (fun t => wordValue v (f t)) e) = + relatorChainMap v (fun s => FreeGroup.lift f (e s)) := by + apply Finsupp.lhom_ext + rintro ⟨g,s⟩ n + simp [pathChain_substitution] + +@[simp] theorem relatorChainMap_of (v : S → Γ) : + relatorChainMap v FreeGroup.of = LinearMap.id := by + apply Finsupp.lhom_ext + rintro ⟨g,s⟩ n + simp + +end CycleSpaces +end EilenbergGanea + +namespace EilenbergGanea +section SumChains +variable {Γ S T : Type*} + +def sumChainsEquiv : BasedChains Γ (S ⊕ T) ≃ₗ[ℤ] BasedChains Γ S × BasedChains Γ T := + (Finsupp.domLCongr (Equiv.prodSumDistrib Γ S T)).trans (Finsupp.sumFinsuppLEquivProdFinsupp ℤ) + +@[simp] theorem sumChainsEquiv_fst (c : BasedChains Γ (S ⊕ T)) (g : Γ) (s : S) : + (sumChainsEquiv c).1 (g,s) = c (g,Sum.inl s) := by + rfl + +@[simp] theorem sumChainsEquiv_snd (c : BasedChains Γ (S ⊕ T)) (g : Γ) (t : T) : + (sumChainsEquiv c).2 (g,t) = c (g,Sum.inr t) := by + rfl + +@[simp] theorem sumChainsEquiv_single_left (g : Γ) (s : S) (n : ℤ) : + sumChainsEquiv (Finsupp.single (g,Sum.inl s) n : BasedChains Γ (S ⊕ T)) = + (Finsupp.single (g,s) n,0) := by + classical + apply Prod.ext + · ext ⟨h,i⟩ + simp [Finsupp.single_apply] + · ext ⟨h,i⟩ + simp + +@[simp] theorem sumChainsEquiv_single_right (g : Γ) (t : T) (n : ℤ) : + sumChainsEquiv (Finsupp.single (g,Sum.inr t) n : BasedChains Γ (S ⊕ T)) = + (0,Finsupp.single (g,t) n) := by + classical + apply Prod.ext + · ext ⟨h,i⟩ + simp + · ext ⟨h,i⟩ + simp [Finsupp.single_apply] + +end SumChains +end EilenbergGanea + +namespace EilenbergGanea +section TrivialGenerators +variable {Γ S T : Type*} [Group Γ] + +theorem edgeBoundary_sum_trivial (v : S → Γ) (c : BasedChains Γ (S ⊕ T)) : + edgeBoundary (Sum.elim v (fun _ : T => 1)) c = + edgeBoundary v (sumChainsEquiv c).1 := by + have h : edgeBoundary (Sum.elim v (fun _ : T => 1)) = + (edgeBoundary v).comp ((LinearMap.fst ℤ _ _).comp sumChainsEquiv.toLinearMap) := by + apply Finsupp.lhom_ext + rintro ⟨g,s | t⟩ n <;> simp + exact LinearMap.congr_fun h c + +/-- A trivial extra generator contributes an +independent free summand to the cycle module, with no cardinality restriction. -/ +def cycleSumEquiv (v : S → Γ) : + cycles (Sum.elim v (fun _ : T => 1)) ≃ₗ[ℤ] cycles v × BasedChains Γ T where + toFun c := (⟨(sumChainsEquiv c.val).1, by + rw [LinearMap.mem_ker, ← edgeBoundary_sum_trivial] + exact c.property⟩, (sumChainsEquiv c.val).2) + invFun c := ⟨sumChainsEquiv.symm (c.1.val,c.2), by + rw [LinearMap.mem_ker,edgeBoundary_sum_trivial,LinearEquiv.apply_symm_apply] + exact c.1.property⟩ + left_inv c := by + apply Subtype.ext + exact sumChainsEquiv.symm_apply_apply c.val + right_inv c := by + apply Prod.ext + · apply Subtype.ext + exact congrArg Prod.fst (sumChainsEquiv.apply_symm_apply (c.1.val,c.2)) + · exact congrArg (fun p : BasedChains Γ S × BasedChains Γ T => p.2) (sumChainsEquiv.apply_symm_apply (c.1.val,c.2)) + map_add' c d := by + apply Prod.ext + · apply Subtype.ext + exact congrArg Prod.fst (sumChainsEquiv.map_add c.val d.val) + · exact congrArg (fun p : BasedChains Γ S × BasedChains Γ T => p.2) (sumChainsEquiv.map_add c.val d.val) + map_smul' n c := by + apply Prod.ext + · apply Subtype.ext + exact congrArg Prod.fst (sumChainsEquiv.map_smul n c.val) + · exact congrArg (fun p : BasedChains Γ S × BasedChains Γ T => p.2) (sumChainsEquiv.map_smul n c.val) + +end TrivialGenerators +end EilenbergGanea + +namespace EilenbergGanea +section WordEquivalence +variable {Γ S T : Type*} [Group Γ] + +theorem pathChain_hom (v : S → Γ) (w : T → Γ) (e : FreeGroup S →* FreeGroup T) + (he : (wordValue w).comp e = wordValue v) (a : FreeGroup S) (g : Γ) : + relatorChainMap w (fun s => e (FreeGroup.of s)) (pathChain v a g) = + pathChain w (e a) g := by + have hv : (fun s => wordValue w (e (FreeGroup.of s))) = v := by + funext s + simpa [wordValue] using DFunLike.congr_fun he (FreeGroup.of s) + have hl : FreeGroup.lift (fun s => e (FreeGroup.of s)) = e := by + apply FreeGroup.ext_hom + intro s + simp + rw [← hv,pathChain_substitution,hl] + +theorem edgeBoundary_hom (v : S → Γ) (w : T → Γ) (e : FreeGroup S →* FreeGroup T) + (he : (wordValue w).comp e = wordValue v) : + (edgeBoundary w).comp (relatorChainMap w (fun s => e (FreeGroup.of s))) = edgeBoundary v := by + apply Finsupp.lhom_ext + rintro ⟨g,s⟩ n + have hs : wordValue w (e (FreeGroup.of s)) = v s := by + simpa [wordValue] using DFunLike.congr_fun he (FreeGroup.of s) + simp [edgeBoundary_pathChain,hs] + +/-- An honest free-generator equivalence gives an invertible integral edge-chain +map; the path chains, not only their augmented exponent sums, are transported. -/ +def wordChainEquiv (v : S → Γ) (w : T → Γ) (e : FreeGroup S ≃* FreeGroup T) + (he : (wordValue w).comp e.toMonoidHom = wordValue v) : + BasedChains Γ S ≃ₗ[ℤ] BasedChains Γ T where + __ := relatorChainMap w (fun s => e (FreeGroup.of s)) + invFun := relatorChainMap v (fun t => e.symm (FreeGroup.of t)) + left_inv c := by + have hi : (wordValue v).comp e.symm.toMonoidHom = wordValue w := by + ext t + have h := DFunLike.congr_fun he (e.symm (FreeGroup.of t)) + simpa using h.symm + have hh : (relatorChainMap v (fun t => e.symm (FreeGroup.of t))).comp + (relatorChainMap w (fun s => e (FreeGroup.of s))) = LinearMap.id := by + apply Finsupp.lhom_ext + rintro ⟨g,s⟩ n + simp only [LinearMap.comp_apply, relatorChainMap_single, map_zsmul, + LinearMap.id_coe, id_eq] + have hh := pathChain_hom w v e.symm.toMonoidHom hi (e (FreeGroup.of s)) g + simpa using congrArg (n • ·) hh + exact LinearMap.congr_fun hh c + right_inv c := by + have hh : (relatorChainMap w (fun s => e (FreeGroup.of s))).comp + (relatorChainMap v (fun t => e.symm (FreeGroup.of t))) = LinearMap.id := by + apply Finsupp.lhom_ext + rintro ⟨g,t⟩ n + simp only [LinearMap.comp_apply, relatorChainMap_single, map_zsmul, + LinearMap.id_coe, id_eq] + have hh := pathChain_hom v w e.toMonoidHom he (e.symm (FreeGroup.of t)) g + simpa using congrArg (n • ·) hh + exact LinearMap.congr_fun hh c + +/-- Invertible change of free generators preserves the full cycle module. -/ +def wordCycleEquiv (v : S → Γ) (w : T → Γ) (e : FreeGroup S ≃* FreeGroup T) + (he : (wordValue w).comp e.toMonoidHom = wordValue v) : cycles v ≃ₗ[ℤ] cycles w := + (wordChainEquiv v w e he).ofSubmodules (cycles v) (cycles w) (by + ext c + rw [Submodule.mem_map_equiv] + change edgeBoundary v ((wordChainEquiv v w e he).symm c) = 0 ↔ edgeBoundary w c = 0 + have h := LinearMap.congr_fun (edgeBoundary_hom v w e.toMonoidHom he) + ((wordChainEquiv v w e he).symm c) + change edgeBoundary w (wordChainEquiv v w e he ((wordChainEquiv v w e he).symm c)) = + edgeBoundary v ((wordChainEquiv v w e he).symm c) at h + rw [LinearEquiv.apply_symm_apply] at h + rw [← h]) + +end WordEquivalence +end EilenbergGanea + +namespace EilenbergGanea +section TrivialPresentationExtension +variable {Γ S T R : Type*} [Group Γ] + +def eraseExtra : FreeGroup (S ⊕ T) →* FreeGroup S := + FreeGroup.lift (Sum.elim FreeGroup.of (fun _ => 1)) + +def unitExtendedRelators (r : R → FreeGroup S) : R ⊕ T → FreeGroup (S ⊕ T) := + Sum.elim (fun i => FreeGroup.map Sum.inl (r i)) (fun t => FreeGroup.of (.inr t)) + +theorem unitExtendedRelators_trivial (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (i : R ⊕ T) : + wordValue (Sum.elim v (fun _ : T => 1)) (unitExtendedRelators r i) = 1 := by + rcases i with i | t + · change wordValue _ (FreeGroup.map Sum.inl (r i)) = 1 + have he : (wordValue (Sum.elim v (fun _ : T => 1))).comp (FreeGroup.map Sum.inl) = + wordValue v := by + apply FreeGroup.ext_hom + intro s + simp [wordValue] + exact (DFunLike.congr_fun he (r i)).trans (hr i) + · simp [unitExtendedRelators,wordValue] + +/-- Adjoining arbitrarily many generators of value one and their unit relators +preserves the actual presentation, not merely its abelianization. -/ +theorem unitExtension_normalClosure (v : S → Γ) (r : R → FreeGroup S) + (hp : (wordValue v).ker = Subgroup.normalClosure (Set.range r)) : + (wordValue (Sum.elim v (fun _ : T => 1))).ker = + Subgroup.normalClosure (Set.range (unitExtendedRelators r : R ⊕ T → _)) := by + let N := Subgroup.normalClosure (Set.range (unitExtendedRelators r : R ⊕ T → _)) + have hr (i) : wordValue v (r i) = 1 := by + change r i ∈ (wordValue v).ker + rw [hp] + exact Subgroup.subset_normalClosure (Set.mem_range_self i) + apply le_antisymm + · intro w hw + have hcomp : (wordValue v).comp eraseExtra = + wordValue (Sum.elim v (fun _ : T => 1)) := by + apply FreeGroup.ext_hom + intro s + rcases s with s | t <;> simp [eraseExtra,wordValue] + have hker : eraseExtra w ∈ Subgroup.normalClosure (Set.range r) := by + rw [← hp] + exact (DFunLike.congr_fun hcomp w).trans hw + have hmap : FreeGroup.map Sum.inl (eraseExtra w) ∈ N := by + apply Subgroup.normalClosure_mono (s := (FreeGroup.map Sum.inl) '' Set.range r) + (by rintro _ ⟨a,⟨i,rfl⟩,rfl⟩; exact ⟨Sum.inl i,rfl⟩) + exact Subgroup.comap_normalClosure_image_ge _ (FreeGroup.map Sum.inl) hker + have heq : (QuotientGroup.mk' N : FreeGroup (S ⊕ T) →* _) = + ((QuotientGroup.mk' N).comp (FreeGroup.map Sum.inl)).comp eraseExtra := by + apply FreeGroup.ext_hom + intro s + rcases s with s | t + · simp [eraseExtra] + · simp only [MonoidHom.comp_apply,eraseExtra,FreeGroup.lift_apply_of,Sum.elim_inr,map_one] + apply (QuotientGroup.eq_one_iff _).mpr + exact Subgroup.subset_normalClosure ⟨Sum.inr t,rfl⟩ + apply (QuotientGroup.eq_one_iff _).mp + change (QuotientGroup.mk' N) w = 1 + rw [DFunLike.congr_fun heq w] + exact (QuotientGroup.eq_one_iff _).mpr hmap + · exact normal_relators_trivial _ _ (unitExtendedRelators_trivial v r hr) + +/-- The chain matrix of adjoining unit relators is a block diagonal matrix. -/ +theorem unitExtension_chain (v : S → Γ) (r : R → FreeGroup S) + (c : BasedChains Γ (R ⊕ T)) : + sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : T => 1)) + (unitExtendedRelators r) c) = + (relatorChainMap v r (sumChainsEquiv c).1,(sumChainsEquiv c).2) := by + have hi (w : FreeGroup S) (g : Γ) : + sumChainsEquiv (pathChain (Sum.elim v (fun _ : T => 1)) (FreeGroup.map Sum.inl w) g) = + (pathChain v w g,0) := by + induction w using FreeGroup.induction_on generalizing g with + | one => simp only [map_one,pathChain_one,map_zero]; rfl + | of s => simp + | inv_of s _ih => simp [pathChain_inv,wordValue] + | mul w z hw hz => + have hv : wordValue (Sum.elim v (fun _ : T => 1)) (FreeGroup.map Sum.inl w) = wordValue v w := by + have h : (wordValue (Sum.elim v (fun _ : T => 1))).comp (FreeGroup.map Sum.inl) = wordValue v := by + apply FreeGroup.ext_hom + intro s + simp [wordValue] + exact DFunLike.congr_fun h w + simp only [map_mul,pathChain_mul,map_add,hw,hz,hv,Prod.mk_add_mk,add_zero] + have he : sumChainsEquiv.toLinearMap.comp (relatorChainMap + (Sum.elim v (fun _ : T => 1)) (unitExtendedRelators r)) = + (((relatorChainMap v r).comp (LinearMap.fst ℤ _ _)).prod + (LinearMap.snd ℤ _ _)).comp sumChainsEquiv.toLinearMap := by + apply Finsupp.lhom_ext + rintro ⟨g,i | t⟩ n + · simp [unitExtendedRelators,hi] + · simp [unitExtendedRelators] + exact LinearMap.congr_fun he c + +end TrivialPresentationExtension +end EilenbergGanea + +namespace EilenbergGanea +section UnitExtensionBasis +variable {Γ S T R : Type*} [Group Γ] + +/-- Completely explicit stabilization of a boundary-basis presentation. -/ +def unitExtensionBasis (v : S → Γ) (B : BasedChains Γ R ≃ₗ[ℤ] cycles v) : + BasedChains Γ (R ⊕ T) ≃ₗ[ℤ] cycles (Sum.elim v (fun _ : T => 1)) := + sumChainsEquiv.trans ((B.prodCongr (LinearEquiv.refl ℤ (BasedChains Γ T))).trans + (cycleSumEquiv v).symm) + +theorem unitExtensionBasis_value (v : S → Γ) (r : R → FreeGroup S) + (B : BasedChains Γ R ≃ₗ[ℤ] cycles v) + (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v r c) + (c : BasedChains Γ (R ⊕ T)) : + (unitExtensionBasis v B c : BasedChains Γ (S ⊕ T)) = + relatorChainMap (Sum.elim v (fun _ : T => 1)) (unitExtendedRelators r) c := by + apply sumChainsEquiv.injective + rw [unitExtension_chain] + change sumChainsEquiv (sumChainsEquiv.symm + ((B (sumChainsEquiv c).1).val,(sumChainsEquiv c).2)) = _ + rw [LinearEquiv.apply_symm_apply,hB] + +/-- Equivariance is automatic for an isomorphism whose columns are actual path +chains. This derives, rather than assumes, equivariance of its inverse. -/ +theorem chainBasisCoordinate_equivariant (v : S → Γ) + (r : R → FreeGroup S) (u : T → FreeGroup S) + (E : BasedChains Γ R ≃ₗ[ℤ] cycles v) + (B : BasedChains Γ T ≃ₗ[ℤ] cycles v) + (hE : ∀ c, (E c : BasedChains Γ S) = relatorChainMap v r c) + (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v u c) : + ChainsEquivariant (E.trans B.symm).toLinearMap := by + intro g c + apply B.injective + apply Subtype.ext + change (B (B.symm (E (translateChains g c)))).val = + (B (translateChains g (B.symm (E c)))).val + rw [B.apply_symm_apply,hE,hB,relatorChainMap_equivariant v u g] + rw [← hB,B.apply_symm_apply,hE] + exact relatorChainMap_equivariant v r g c + +end UnitExtensionBasis +end EilenbergGanea + +namespace EilenbergGanea +section Nielsen +variable {Γ S T A R : Type*} [Group Γ] + +def nielsenHom (a : T → FreeGroup S) : FreeGroup (S ⊕ T) →* FreeGroup (S ⊕ T) := + FreeGroup.lift (Sum.elim (fun s => FreeGroup.of (.inl s)) + (fun t => FreeGroup.of (.inr t) * FreeGroup.map Sum.inl (a t))) + +@[simp] theorem nielsenHom_of_left (a : T → FreeGroup S) (s : S) : + nielsenHom a (FreeGroup.of (.inl s)) = FreeGroup.of (.inl s) := by + simp [nielsenHom] + +@[simp] theorem nielsenHom_of_right (a : T → FreeGroup S) (t : T) : + nielsenHom a (FreeGroup.of (.inr t)) = + FreeGroup.of (.inr t) * FreeGroup.map Sum.inl (a t) := by + simp [nielsenHom] + +@[simp] theorem nielsenHom_left (a : T → FreeGroup S) (w : FreeGroup S) : + nielsenHom a (FreeGroup.map Sum.inl w) = FreeGroup.map Sum.inl w := by + have h : (nielsenHom a).comp (FreeGroup.map Sum.inl) = FreeGroup.map Sum.inl := by + apply FreeGroup.ext_hom + intro s + simp [nielsenHom] + exact DFunLike.congr_fun h w + +def nielsenEquiv (a : T → FreeGroup S) : FreeGroup (S ⊕ T) ≃* FreeGroup (S ⊕ T) where + __ := nielsenHom a + invFun := nielsenHom (fun t => (a t)⁻¹) + left_inv w := by + have h : (nielsenHom (fun t => (a t)⁻¹)).comp (nielsenHom a) = MonoidHom.id _ := by + apply FreeGroup.ext_hom + intro s + rcases s with s | t <;> simp [mul_assoc] + exact DFunLike.congr_fun h w + right_inv w := by + have h : (nielsenHom a).comp (nielsenHom (fun t => (a t)⁻¹)) = MonoidHom.id _ := by + apply FreeGroup.ext_hom + intro s + rcases s with s | t <;> simp [mul_assoc] + exact DFunLike.congr_fun h w + +@[simp] theorem nielsenEquiv_apply (a : T → FreeGroup S) (w : FreeGroup (S ⊕ T)) : + nielsenEquiv a w = nielsenHom a w := rfl + +theorem nielsen_wordValue (v : S → Γ) (w : T → Γ) (a : T → FreeGroup S) : + (wordValue (Sum.elim v w)).comp (nielsenEquiv a).toMonoidHom = + wordValue (Sum.elim v (fun t => w t * wordValue v (a t))) := by + have hi (u : FreeGroup S) : wordValue (Sum.elim v w) (FreeGroup.map Sum.inl u) = + wordValue v u := by + have h : (wordValue (Sum.elim v w)).comp (FreeGroup.map Sum.inl) = wordValue v := by + apply FreeGroup.ext_hom + intro s + simp [wordValue] + exact DFunLike.congr_fun h u + apply FreeGroup.ext_hom + intro s + rcases s with s | t + · simp [nielsenHom,wordValue] + · change wordValue (Sum.elim v w) (nielsenHom a (FreeGroup.of (.inr t))) = _ + rw [nielsenHom_of_right,map_mul,hi] + simp [wordValue] + +theorem wordPresentation_transport (v : S → Γ) (w : T → Γ) + (e : FreeGroup S ≃* FreeGroup T) + (he : (wordValue w).comp e.toMonoidHom = wordValue v) + (r : R → FreeGroup S) + (hp : (wordValue v).ker = Subgroup.normalClosure (Set.range r)) : + (wordValue w).ker = Subgroup.normalClosure (Set.range (fun i => e (r i))) := by + have hi : (wordValue v).comp e.symm.toMonoidHom = wordValue w := by + apply FreeGroup.ext_hom + intro t + simpa using (DFunLike.congr_fun he (e.symm (FreeGroup.of t))).symm + change (wordValue w).ker = Subgroup.normalClosure (Set.range (e ∘ r)) + rw [Set.range_comp] + change (wordValue w).ker = Subgroup.normalClosure (e.toMonoidHom '' Set.range r) + rw [← Subgroup.map_normalClosure _ e.toMonoidHom e.surjective, ← hp] + ext a + constructor + · intro ha + refine ⟨e.symm a,?_,e.apply_symm_apply a⟩ + exact (DFunLike.congr_fun hi a).trans ha + · rintro ⟨b,hb,rfl⟩ + exact (DFunLike.congr_fun he b).trans hb + +def wordBasisTransport (v : S → Γ) (w : T → Γ) + (e : FreeGroup S ≃* FreeGroup T) + (he : (wordValue w).comp e.toMonoidHom = wordValue v) + (B : BasedChains Γ R ≃ₗ[ℤ] cycles v) : BasedChains Γ R ≃ₗ[ℤ] cycles w := + B.trans (wordCycleEquiv v w e he) + +theorem wordBasisTransport_value (v : S → Γ) (w : T → Γ) + (e : FreeGroup S ≃* FreeGroup T) + (he : (wordValue w).comp e.toMonoidHom = wordValue v) + (B : BasedChains Γ R ≃ₗ[ℤ] cycles v) (r : R → FreeGroup S) + (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v r c) + (c : BasedChains Γ R) : + (wordBasisTransport v w e he B c : BasedChains Γ T) = + relatorChainMap w (fun i => e (r i)) c := by + change relatorChainMap w (fun s => e (FreeGroup.of s)) (B c).val = _ + rw [hB] + have hh : (relatorChainMap w (fun s => e (FreeGroup.of s))).comp (relatorChainMap v r) = + relatorChainMap w (fun i => e (r i)) := by + apply Finsupp.lhom_ext + rintro ⟨g,i⟩ n + simp only [LinearMap.comp_apply,relatorChainMap_single,map_zsmul] + exact congrArg (n • ·) (pathChain_hom v w e.toMonoidHom he (r i) g) + exact LinearMap.congr_fun hh c + +end Nielsen +end EilenbergGanea + +namespace EilenbergGanea +section GeneratorAlignment +variable {Γ S T A R : Type*} [Group Γ] + +def freeGroupCongr (e : S ≃ T) : FreeGroup S ≃* FreeGroup T where + __ := FreeGroup.map e + invFun := FreeGroup.map e.symm + left_inv w := by simpa [Function.comp_def] using FreeGroup.map.comp e e.symm w + right_inv w := by simpa [Function.comp_def] using FreeGroup.map.comp e.symm e w + +@[simp] theorem freeGroupCongr_apply (e : S ≃ T) (w : FreeGroup S) : + freeGroupCongr e w = FreeGroup.map e w := rfl + +theorem wordValue_congr_alphabet (v : S → Γ) (w : T → Γ) (e : S ≃ T) + (h : ∀ s, w (e s) = v s) : + (wordValue w).comp (freeGroupCongr e).toMonoidHom = wordValue v := by + apply FreeGroup.ext_hom + intro s + simpa [wordValue] using h s + +theorem wordRelators_transport_trivial (v : S → Γ) (w : T → Γ) + (e : FreeGroup S ≃* FreeGroup T) + (he : (wordValue w).comp e.toMonoidHom = wordValue v) + (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) : + ∀ i, wordValue w (e (r i)) = 1 := by + intro i + exact (DFunLike.congr_fun he (r i)).trans (hr i) + +/-- Generator change starting with an actual boundary-basis presentation, +not with an assumed aligned one. -/ +theorem align_generators (v : S → Γ) (hv : Function.Surjective (wordValue v)) + (a : A → Γ) (ha : Function.Surjective (wordValue a)) + (r : R → FreeGroup A) (hr : ∀ i, wordValue a (r i) = 1) + (hp : (wordValue a).ker = Subgroup.normalClosure (Set.range r)) + (B : BasedChains Γ R ≃ₗ[ℤ] cycles a) + (hB : ∀ c, (B c : BasedChains Γ A) = relatorChainMap a r c) : + ∃ (r' : R ⊕ S → FreeGroup (S ⊕ A)) + (B' : BasedChains Γ (R ⊕ S) ≃ₗ[ℤ] cycles (Sum.elim v (fun _ : A => 1))), + (∀ i, wordValue (Sum.elim v (fun _ : A => 1)) (r' i) = 1) ∧ + (wordValue (Sum.elim v (fun _ : A => 1))).ker = + Subgroup.normalClosure (Set.range r') ∧ + ∀ c, (B' c : BasedChains Γ (S ⊕ A)) = + relatorChainMap (Sum.elim v (fun _ : A => 1)) r' c := by + classical + choose f hf using fun s => ha (v s) + choose g hg using fun t => hv (a t) + let v₀ : A ⊕ S → Γ := Sum.elim a (fun _ => 1) + let v₁ : A ⊕ S → Γ := Sum.elim a v + let v₂ : S ⊕ A → Γ := Sum.elim v a + let v₃ : S ⊕ A → Γ := Sum.elim v (fun _ => 1) + let e₁ := nielsenEquiv (fun s => (f s)⁻¹) + let e₂ := freeGroupCongr (Equiv.sumComm A S) + let e₃ := nielsenEquiv g + have he₁ : (wordValue v₁).comp e₁.toMonoidHom = wordValue v₀ := by + change (wordValue (Sum.elim a v)).comp + (nielsenEquiv (fun s => (f s)⁻¹)).toMonoidHom = _ + simpa only [map_inv,hf,mul_inv_cancel] using + nielsen_wordValue a v (fun s => (f s)⁻¹) + have he₂ : (wordValue v₂).comp e₂.toMonoidHom = wordValue v₁ := by + apply wordValue_congr_alphabet + intro s + rcases s with t | s <;> rfl + have he₃ : (wordValue v₃).comp e₃.toMonoidHom = wordValue v₂ := by + change (wordValue (Sum.elim v (fun _ : A => 1))).comp + (nielsenEquiv g).toMonoidHom = _ + simpa only [one_mul,hg] using nielsen_wordValue v (fun _ : A => 1) g + let r₀ : R ⊕ S → FreeGroup (A ⊕ S) := unitExtendedRelators r + let r₁ : R ⊕ S → FreeGroup (A ⊕ S) := fun i => e₁ (r₀ i) + let r₂ : R ⊕ S → FreeGroup (S ⊕ A) := fun i => e₂ (r₁ i) + let r₃ : R ⊕ S → FreeGroup (S ⊕ A) := fun i => e₃ (r₂ i) + let B₀ : BasedChains Γ (R ⊕ S) ≃ₗ[ℤ] cycles v₀ := unitExtensionBasis a B + let B₁ := wordBasisTransport v₀ v₁ e₁ he₁ B₀ + let B₂ := wordBasisTransport v₁ v₂ e₂ he₂ B₁ + let B₃ := wordBasisTransport v₂ v₃ e₃ he₃ B₂ + have hr₀ : ∀ i, wordValue v₀ (r₀ i) = 1 := unitExtendedRelators_trivial a r hr + have hr₁ := wordRelators_transport_trivial v₀ v₁ e₁ he₁ r₀ hr₀ + have hr₂ := wordRelators_transport_trivial v₁ v₂ e₂ he₂ r₁ hr₁ + have hr₃ := wordRelators_transport_trivial v₂ v₃ e₃ he₃ r₂ hr₂ + have hp₀ : (wordValue v₀).ker = Subgroup.normalClosure (Set.range r₀) := + unitExtension_normalClosure a r hp + have hp₁ := wordPresentation_transport v₀ v₁ e₁ he₁ r₀ hp₀ + have hp₂ := wordPresentation_transport v₁ v₂ e₂ he₂ r₁ hp₁ + have hp₃ := wordPresentation_transport v₂ v₃ e₃ he₃ r₂ hp₂ + have hB₀ : ∀ c, (B₀ c : BasedChains Γ (A ⊕ S)) = relatorChainMap v₀ r₀ c := + unitExtensionBasis_value a r B hB + have hB₁ := wordBasisTransport_value v₀ v₁ e₁ he₁ B₀ r₀ hB₀ + have hB₂ := wordBasisTransport_value v₁ v₂ e₂ he₂ B₁ r₁ hB₁ + have hB₃ := wordBasisTransport_value v₂ v₃ e₃ he₃ B₂ r₂ hB₂ + exact ⟨r₃,B₃,hr₃,hp₃,hB₃⟩ + +end GeneratorAlignment +end EilenbergGanea + +namespace EilenbergGanea +section RelatorBlocks +variable {Γ S T R I : Type*} [Group Γ] + +theorem relatorChainMap_sum (v : S → Γ) (r : R → FreeGroup S) (u : I → FreeGroup S) + (c : BasedChains Γ (R ⊕ I)) : + relatorChainMap v (Sum.elim r u) c = + relatorChainMap v r (sumChainsEquiv c).1 + relatorChainMap v u (sumChainsEquiv c).2 := by + have h : relatorChainMap v (Sum.elim r u) = + ((relatorChainMap v r).comp (LinearMap.fst ℤ _ _) + + (relatorChainMap v u).comp (LinearMap.snd ℤ _ _)).comp sumChainsEquiv.toLinearMap := by + apply Finsupp.lhom_ext + rintro ⟨g,i | j⟩ n <;> simp + exact LinearMap.congr_fun h c + +theorem sumChains_pathChain_left (v : S → Γ) (w : FreeGroup S) (g : Γ) : + sumChainsEquiv (pathChain (Sum.elim v (fun _ : T => 1)) (FreeGroup.map Sum.inl w) g) = + (pathChain v w g,0) := by + induction w using FreeGroup.induction_on generalizing g with + | one => simp only [map_one,pathChain_one,map_zero]; rfl + | of s => simp + | inv_of s _ih => simp [pathChain_inv,wordValue] + | mul w z hw hz => + have hv : wordValue (Sum.elim v (fun _ : T => 1)) (FreeGroup.map Sum.inl w) = wordValue v w := by + have h : (wordValue (Sum.elim v (fun _ : T => 1))).comp (FreeGroup.map Sum.inl) = wordValue v := by + apply FreeGroup.ext_hom + intro s + simp [wordValue] + exact DFunLike.congr_fun h w + simp only [map_mul,pathChain_mul,map_add,hw,hz,hv,Prod.mk_add_mk,add_zero] + +theorem sumChains_relatorMap_left (v : S → Γ) (r : R → FreeGroup S) (c : BasedChains Γ R) : + sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : T => 1)) + (fun i => FreeGroup.map Sum.inl (r i)) c) = (relatorChainMap v r c,0) := by + have h : sumChainsEquiv.toLinearMap.comp (relatorChainMap + (Sum.elim v (fun _ : T => 1)) (fun i => FreeGroup.map Sum.inl (r i))) = + (relatorChainMap v r).prod 0 := by + apply Finsupp.lhom_ext + rintro ⟨g,i⟩ n + simp [sumChains_pathChain_left] + exact LinearMap.congr_fun h c + +theorem sumChains_relatorMap_right (v : S → Γ) (c : BasedChains Γ T) : + sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : T => 1)) + (fun i => FreeGroup.of (.inr i)) c) = (0,c) := by + have h : sumChainsEquiv.toLinearMap.comp (relatorChainMap + (Sum.elim v (fun _ : T => 1)) (fun i => FreeGroup.of (.inr i))) = + (0 : BasedChains Γ T →ₗ[ℤ] BasedChains Γ S).prod LinearMap.id := by + apply Finsupp.lhom_ext + rintro ⟨g,i⟩ n + simp + exact LinearMap.congr_fun h c + +theorem range_sumElim {α β γ : Type*} (f : α → γ) (g : β → γ) : + Set.range (Sum.elim f g) = Set.range f ∪ Set.range g := by + ext x + constructor + · rintro ⟨a | b,rfl⟩ + · exact Or.inl ⟨a,rfl⟩ + · exact Or.inr ⟨b,rfl⟩ + · rintro (⟨a,rfl⟩ | ⟨b,rfl⟩) + · exact ⟨Sum.inl a,rfl⟩ + · exact ⟨Sum.inr b,rfl⟩ + +/-- The stabilized three-shear conclusion in exact cycle coordinates. This +includes injectivity for the entire new boundary list, even for infinite sets. -/ +theorem stabilized_alignment (v : S → Γ) (hv : Function.Surjective (wordValue v)) + (r : R → FreeGroup S) (z : I → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (_hz : ∀ i, wordValue v (z i) = 1) + (hp : (wordValue v).ker = Subgroup.normalClosure (Set.range r)) + (E : BasedChains Γ R ≃ₗ[ℤ] cycles v) (B : BasedChains Γ I ≃ₗ[ℤ] cycles v) + (hE : ∀ c, (E c : BasedChains Γ S) = relatorChainMap v r c) + (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v z c) : + ∃ (r' : R → FreeGroup (S ⊕ I)) (u' : I → FreeGroup (S ⊕ I)), + (∀ i, wordValue (Sum.elim v (fun _ : I => 1)) (r' i) = 1) ∧ + (∀ i, wordValue (Sum.elim v (fun _ : I => 1)) (u' i) = 1) ∧ + (wordValue (Sum.elim v (fun _ : I => 1))).ker = + Subgroup.normalClosure (Set.range (Sum.elim r' u')) ∧ + Function.Injective (relatorChainMap (Sum.elim v (fun _ : I => 1)) (Sum.elim r' u')) ∧ + (∀ c, sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : I => 1)) r' c) = + (0,-(E.trans B.symm) c)) ∧ + ∀ c, sumChainsEquiv (relatorChainMap (Sum.elim v (fun _ : I => 1)) u' c) = + ((B c).val,0) := by + let w : S ⊕ I → Γ := Sum.elim v (fun _ => 1) + let r₀ : R → FreeGroup (S ⊕ I) := fun i => FreeGroup.map Sum.inl (r i) + let u₀ : I → FreeGroup (S ⊕ I) := fun i => FreeGroup.of (.inr i) + let A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ I := E.trans B.symm + have hA : ChainsEquivariant A.toLinearMap := chainBasisCoordinate_equivariant v r z E B hE hB + have hw : Function.Surjective (wordValue w) := by + intro g + obtain ⟨a,ha⟩ := hv g + refine ⟨FreeGroup.map Sum.inl a,?_⟩ + have h : (wordValue w).comp (FreeGroup.map Sum.inl) = wordValue v := by + apply FreeGroup.ext_hom + intro s + simp [wordValue,w] + exact (DFunLike.congr_fun h a).trans ha + have hr₀ : ∀ i, wordValue w (r₀ i) = 1 := fun i => + unitExtendedRelators_trivial v r hr (.inl i) + have hu₀ : ∀ i, wordValue w (u₀ i) = 1 := fun i => + unitExtendedRelators_trivial v r hr (.inr i) + obtain ⟨r',u',hr',hu',hN,hDr,hDu⟩ := block_word_alignment w hw r₀ u₀ hr₀ hu₀ A hA + have hcr (c) : sumChainsEquiv (relatorChainMap w r' c) = (0,-A c) := by + rw [hDr,LinearMap.neg_apply,LinearMap.comp_apply,map_neg] + rw [sumChains_relatorMap_right] + rfl + have hcu (c) : sumChainsEquiv (relatorChainMap w u' c) = ((B c).val,0) := by + rw [hDu,LinearMap.comp_apply,sumChains_relatorMap_left,← hE] + simp [A] + have hinj : Function.Injective (relatorChainMap w (Sum.elim r' u')) := by + have hz₀ (c) (hc : relatorChainMap w (Sum.elim r' u') c = 0) : c = 0 := by + have h := congrArg sumChainsEquiv hc + rw [relatorChainMap_sum,map_add,hcr,hcu,map_zero] at h + have hi : (sumChainsEquiv c).2 = 0 := by + apply B.injective + apply Subtype.ext + simpa only [Prod.mk_add_mk,zero_add,Prod.fst_zero,map_zero,Submodule.coe_zero] using congrArg Prod.fst h + have hr0 : (sumChainsEquiv c).1 = 0 := by + apply A.injective + simpa only [Prod.mk_add_mk,add_zero,Prod.snd_zero,neg_eq_zero,map_zero] using congrArg Prod.snd h + apply sumChainsEquiv.injective + exact Prod.ext (by simpa using hr0) (by simpa using hi) + intro c d h + apply sub_eq_zero.mp + apply hz₀ + rw [map_sub,h,sub_self] + refine ⟨r',u',hr',hu',?_,hinj,hcr,hcu⟩ + rw [range_sumElim,hN] + simpa only [unitExtendedRelators,range_sumElim] using unitExtension_normalClosure (T := I) v r hp + +end RelatorBlocks +end EilenbergGanea + +namespace EilenbergGanea +section Reindexing +variable {Γ S T U R I : Type*} [Group Γ] + +def chainIndexEquiv (e : S ≃ T) : BasedChains Γ S ≃ₗ[ℤ] BasedChains Γ T := + Finsupp.domLCongr (Equiv.prodCongr (Equiv.refl Γ) e) + +omit [Group Γ] in +@[simp] theorem chainIndexEquiv_single (e : S ≃ T) (g : Γ) (s : S) (n : ℤ) : + chainIndexEquiv e (Finsupp.single (g,s) n) = Finsupp.single (g,e s) n := by + simp [chainIndexEquiv] + +theorem relatorChainMap_reindex (v : S → Γ) (r : R → FreeGroup S) (e : I ≃ R) + (c : BasedChains Γ I) : + relatorChainMap v (r ∘ e) c = relatorChainMap v r (chainIndexEquiv e c) := by + have h : relatorChainMap v (r ∘ e) = (relatorChainMap v r).comp (chainIndexEquiv e).toLinearMap := by + apply Finsupp.lhom_ext + rintro ⟨g,i⟩ n + simp + exact LinearMap.congr_fun h c + +theorem chainIndexEquiv_pathChain (v : S → Γ) (w : T → Γ) (e : S ≃ T) + (he : ∀ s, w (e s) = v s) (a : FreeGroup S) (g : Γ) : + chainIndexEquiv e (pathChain v a g) = pathChain w (freeGroupCongr e a) g := by + have hl : relatorChainMap w (fun s => freeGroupCongr e (FreeGroup.of s)) = + (chainIndexEquiv e).toLinearMap := by + apply Finsupp.lhom_ext + rintro ⟨h,s⟩ n + simp + change (chainIndexEquiv e).toLinearMap _ = _ + rw [← hl] + exact pathChain_hom v w (freeGroupCongr e).toMonoidHom (wordValue_congr_alphabet v w e he) a g + +theorem chainIndexEquiv_relatorMap (v : S → Γ) (w : T → Γ) (e : S ≃ T) + (he : ∀ s, w (e s) = v s) (r : R → FreeGroup S) (c : BasedChains Γ R) : + chainIndexEquiv e (relatorChainMap v r c) = + relatorChainMap w (fun i => freeGroupCongr e (r i)) c := by + have h : (chainIndexEquiv e).toLinearMap.comp (relatorChainMap v r) = + relatorChainMap w (fun i => freeGroupCongr e (r i)) := by + apply Finsupp.lhom_ext + rintro ⟨g,i⟩ n + simp [chainIndexEquiv_pathChain v w e he] + exact LinearMap.congr_fun h c + +/-- Permutation of the stabilized relator indices into distinguished and +ordinary blocks, in exactly the order of source (ordinary-diagonal). -/ +def alignmentIndexEquiv : I ⊕ (T ⊕ R) ≃ R ⊕ (I ⊕ T) where + toFun + | .inl i => .inr (.inl i) + | .inr (.inl t) => .inr (.inr t) + | .inr (.inr r) => .inl r + invFun + | .inl r => .inr (.inr r) + | .inr (.inl i) => .inl i + | .inr (.inr t) => .inr (.inl t) + left_inv := by rintro (i | (t | r)) <;> rfl + right_inv := by rintro (r | (i | t)) <;> rfl + +end Reindexing +end EilenbergGanea + +namespace EilenbergGanea +section ExtraProjectionAlignment +variable {Γ S T I R : Type*} [Group Γ] + +omit [Group Γ] in +theorem projectExtraChains_eq_sum_snd (c : BasedChains Γ (S ⊕ T)) : + projectExtraChains c = (sumChainsEquiv c).2 := by + have h : projectExtraChains = (LinearMap.snd ℤ _ _).comp + (sumChainsEquiv : BasedChains Γ (S ⊕ T) ≃ₗ[ℤ] _).toLinearMap := by + apply Finsupp.lhom_ext + rintro ⟨g,s | t⟩ n <;> simp + exact LinearMap.congr_fun h c + +omit [Group Γ] in +theorem chainIndexEquiv_sumAssoc (c : BasedChains Γ ((S ⊕ T) ⊕ I)) : + sumChainsEquiv (chainIndexEquiv (Equiv.sumAssoc S T I) c) = + ((sumChainsEquiv (sumChainsEquiv c).1).1, + sumChainsEquiv.symm ((sumChainsEquiv (sumChainsEquiv c).1).2,(sumChainsEquiv c).2)) := by + apply Prod.ext + · ext ⟨g,s⟩ + rfl + · apply sumChainsEquiv.injective + rw [LinearEquiv.apply_symm_apply] + apply Prod.ext + · ext ⟨g,t⟩ + rfl + · ext ⟨g,i⟩ + rfl + +omit [Group Γ] in +theorem projectExtraChains_assoc (c : BasedChains Γ ((S ⊕ T) ⊕ I)) : + sumChainsEquiv (projectExtraChains (chainIndexEquiv (Equiv.sumAssoc S T I) c)) = + ((sumChainsEquiv (sumChainsEquiv c).1).2,(sumChainsEquiv c).2) := by + rw [projectExtraChains_eq_sum_snd,chainIndexEquiv_sumAssoc,LinearEquiv.apply_symm_apply] + +/-- The ordinary diagonal block (1,-A), without finite-rank assumptions. -/ +def ordinaryBlockEquiv (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ I) : + BasedChains Γ (T ⊕ R) ≃ₗ[ℤ] BasedChains Γ (T ⊕ I) := + sumChainsEquiv.trans (((LinearEquiv.refl ℤ (BasedChains Γ T)).prodCongr + (A.trans (LinearEquiv.neg ℤ))).trans sumChainsEquiv.symm) + +omit [Group Γ] in +@[simp] theorem ordinaryBlockEquiv_value (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ I) + (c : BasedChains Γ (T ⊕ R)) : + sumChainsEquiv (ordinaryBlockEquiv A c) = ((sumChainsEquiv c).1,-A (sumChainsEquiv c).2) := by + simp [ordinaryBlockEquiv] + +end ExtraProjectionAlignment +end EilenbergGanea + +namespace EilenbergGanea +section FinishedAlignment +variable {Γ S T R Z : Type*} [Group Γ] + +/-- Reorder the two stabilization blocks into the distinguished and ordinary +lists. The projected ordinary block is exactly `(1,-A)`, not only injective. -/ +theorem finish_alignment + (v : S → Γ) (z : Z → FreeGroup S) + (B : BasedChains Γ Z ≃ₗ[ℤ] cycles v) + (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v z c) + (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ (Z ⊕ T)) + (r : R → FreeGroup ((S ⊕ T) ⊕ (Z ⊕ T))) + (u : Z ⊕ T → FreeGroup ((S ⊕ T) ⊕ (Z ⊕ T))) + (hr : ∀ i, wordValue (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) (r i) = 1) + (hu : ∀ i, wordValue (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) (u i) = 1) + (hp : (wordValue (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1))).ker = + Subgroup.normalClosure (Set.range (Sum.elim r u))) + (hinj : Function.Injective (relatorChainMap + (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) (Sum.elim r u))) + (hcr : ∀ c, sumChainsEquiv (relatorChainMap + (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) r c) = (0,-A c)) + (hcu : ∀ c, sumChainsEquiv (relatorChainMap + (Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1)) u c) = + ((unitExtensionBasis v B c).val,0)) : + ∃ r' : Z ⊕ (T ⊕ R) → FreeGroup (S ⊕ (T ⊕ (Z ⊕ T))), + (∀ i, wordValue (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) (r' i) = 1) ∧ + (wordValue (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1))).ker = + Subgroup.normalClosure (Set.range r') ∧ + Function.Injective (relatorChainMap (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) r') ∧ + (∀ i, pathChain (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) + (FreeGroup.map Sum.inl (z i)) 1 = + pathChain (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) (r' (.inl i)) 1) ∧ + (ordinaryBlockEquiv A).toLinearMap = extraRelatorMap + (Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1)) (fun i => r' (.inr i)) := by + let w := Sum.elim (Sum.elim v (fun _ : T => 1)) (fun _ : Z ⊕ T => 1) + let w' := Sum.elim v (fun _ : T ⊕ (Z ⊕ T) => 1) + let e := Equiv.sumAssoc S T (Z ⊕ T) + let j : Z ⊕ (T ⊕ R) ≃ R ⊕ (Z ⊕ T) := alignmentIndexEquiv + have he : ∀ s, w' (e s) = w s := by rintro ((s | t) | i) <;> rfl + let f : R ⊕ (Z ⊕ T) → FreeGroup (S ⊕ (T ⊕ (Z ⊕ T))) := + fun i => freeGroupCongr e (Sum.elim r u i) + let r' := f ∘ j + have hrf : ∀ i, wordValue w' (f i) = 1 := by + intro i + have h := DFunLike.congr_fun (wordValue_congr_alphabet w w' e he) (Sum.elim r u i) + exact h.trans (by rcases i with i | i; exact hr i; exact hu i) + have hpf : (wordValue w').ker = Subgroup.normalClosure (Set.range f) := + wordPresentation_transport w w' (freeGroupCongr e) (wordValue_congr_alphabet w w' e he) _ hp + have hpr : (wordValue w').ker = Subgroup.normalClosure (Set.range r') := by + rw [hpf] + congr 1 + ext x + constructor + · rintro ⟨i,rfl⟩ + exact ⟨j.symm i,congrArg f (j.apply_symm_apply i)⟩ + · rintro ⟨i,rfl⟩ + exact ⟨j i,rfl⟩ + have hDf (c : BasedChains Γ (R ⊕ (Z ⊕ T))) : + relatorChainMap w' f c = chainIndexEquiv e (relatorChainMap w (Sum.elim r u) c) := + (chainIndexEquiv_relatorMap w w' e he _ c).symm + have hDr (c) : relatorChainMap w' r' c = + chainIndexEquiv e (relatorChainMap w (Sum.elim r u) (chainIndexEquiv j c)) := by + rw [relatorChainMap_reindex,hDf] + have hinjr : Function.Injective (relatorChainMap w' r') := by + intro a b h + rw [hDr,hDr] at h + exact (chainIndexEquiv j).injective (hinj ((chainIndexEquiv e).injective h)) + have hcU (c : BasedChains Γ (Z ⊕ T)) : + sumChainsEquiv (sumChainsEquiv (relatorChainMap w u c)).1 = + ((B (sumChainsEquiv c).1).val,(sumChainsEquiv c).2) := by + rw [hcu] + change sumChainsEquiv (sumChainsEquiv.symm _) = _ + exact LinearEquiv.apply_symm_apply _ _ + have hd (i : Z) : pathChain w' (FreeGroup.map Sum.inl (z i)) 1 = + pathChain w' (r' (.inl i)) 1 := by + have h := hcu (Finsupp.single (1,Sum.inl i) 1) + have h' := hcU (Finsupp.single (1,Sum.inl i) 1) + simp only [relatorChainMap_single,one_smul,sumChainsEquiv_single_left] at h h' + apply (sumChainsEquiv : BasedChains Γ (S ⊕ (T ⊕ (Z ⊕ T))) ≃ₗ[ℤ] _).injective + have hh : pathChain w' (r' (.inl i)) 1 = chainIndexEquiv e (pathChain w (u (.inl i)) 1) := + (chainIndexEquiv_pathChain w w' e he _ _).symm + rw [hh] + rw [sumChains_pathChain_left,chainIndexEquiv_sumAssoc] + rw [h] + rw [h] at h' + rw [h'] + simp only [hB,relatorChainMap_single,one_smul] + change (_,0) = (_,sumChainsEquiv.symm (0 : BasedChains Γ T × BasedChains Γ (Z ⊕ T))) + rw [map_zero] + have hQ : (ordinaryBlockEquiv A).toLinearMap = extraRelatorMap w' (fun i => r' (.inr i)) := by + apply Finsupp.lhom_ext + rintro ⟨g,t | i⟩ n + · apply sumChainsEquiv.injective + have hh : pathChain w' (r' (.inr (.inl t))) g = + chainIndexEquiv e (pathChain w (u (.inr t)) g) := + (chainIndexEquiv_pathChain w w' e he _ _).symm + simp only [LinearEquiv.coe_coe,ordinaryBlockEquiv_value,sumChainsEquiv_single_left, + map_zero,neg_zero,extraRelatorMap_single,hh,← map_smul] + have hsingle : n • pathChain w (u (.inr t)) g = + relatorChainMap w u (Finsupp.single (g,Sum.inr t) n) := by simp + rw [hsingle,projectExtraChains_assoc,hcu] + have hh' := hcU (Finsupp.single (g,Sum.inr t) n) + rw [hcu] at hh' + simp only [sumChainsEquiv_single_right,map_zero,Submodule.coe_zero] at hh' + rw [hh'] + · apply sumChainsEquiv.injective + have hh : pathChain w' (r' (.inr (.inr i))) g = + chainIndexEquiv e (pathChain w (r i) g) := + (chainIndexEquiv_pathChain w w' e he _ _).symm + simp only [LinearEquiv.coe_coe,ordinaryBlockEquiv_value,sumChainsEquiv_single_right, + extraRelatorMap_single,hh,← map_smul] + have hsingle : n • pathChain w (r i) g = relatorChainMap w r (Finsupp.single (g,i) n) := by simp + rw [hsingle,projectExtraChains_assoc,hcr] + simp + exact ⟨r',fun i => hrf (j i),hpr,hinjr,hd,hQ⟩ + +end FinishedAlignment +end EilenbergGanea + +namespace EilenbergGanea +section BoundaryBasisPresentation +variable {Γ S A R Z : Type*} [Group Γ] + +/-- Full algebraic alignment. The initial and final +presentations are genuine normal-closure presentations. No finiteness of the +old generators or of either relator family is required. -/ +theorem boundary_basis_presentation_alignment + (v : S → Γ) (hv : Function.Surjective (wordValue v)) + (z : Z → FreeGroup S) (hz : ∀ i, wordValue v (z i) = 1) + (B : BasedChains Γ Z ≃ₗ[ℤ] cycles v) + (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v z c) + (a : A → Γ) (ha : Function.Surjective (wordValue a)) + (r : R → FreeGroup A) (hr : ∀ i, wordValue a (r i) = 1) + (hp : (wordValue a).ker = Subgroup.normalClosure (Set.range r)) + (E : BasedChains Γ R ≃ₗ[ℤ] cycles a) + (hE : ∀ c, (E c : BasedChains Γ A) = relatorChainMap a r c) : + ∃ (r' : Z ⊕ (A ⊕ (R ⊕ S)) → FreeGroup (S ⊕ (A ⊕ (Z ⊕ A)))) + (Q : BasedChains Γ (A ⊕ (R ⊕ S)) ≃ₗ[ℤ] BasedChains Γ (A ⊕ (Z ⊕ A))), + (∀ i, wordValue (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) (r' i) = 1) ∧ + (wordValue (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1))).ker = + Subgroup.normalClosure (Set.range r') ∧ + Function.Injective (relatorChainMap (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) r') ∧ + (∀ i, pathChain (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) + (FreeGroup.map Sum.inl (z i)) 1 = + pathChain (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) (r' (.inl i)) 1) ∧ + Q.toLinearMap = extraRelatorMap (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) + (fun i => r' (.inr i)) := by + obtain ⟨r₀,E₀,hr₀,hp₀,hE₀⟩ := align_generators v hv a ha r hr hp E hE + let v₀ : S ⊕ A → Γ := Sum.elim v (fun _ => 1) + have hv₀ : Function.Surjective (wordValue v₀) := by + intro g + obtain ⟨w,hw⟩ := hv g + refine ⟨FreeGroup.map Sum.inl w,?_⟩ + have h : (wordValue v₀).comp (FreeGroup.map Sum.inl) = wordValue v := by + apply FreeGroup.ext_hom + intro s + simp [wordValue,v₀] + exact (DFunLike.congr_fun h w).trans hw + let B₀ : BasedChains Γ (Z ⊕ A) ≃ₗ[ℤ] cycles v₀ := unitExtensionBasis v B + let z₀ : Z ⊕ A → FreeGroup (S ⊕ A) := unitExtendedRelators z + have hz₀ : ∀ i, wordValue v₀ (z₀ i) = 1 := unitExtendedRelators_trivial v z hz + have hB₀ : ∀ c, (B₀ c : BasedChains Γ (S ⊕ A)) = relatorChainMap v₀ z₀ c := + unitExtensionBasis_value v z B hB + obtain ⟨r₁,u₁,hr₁,hu₁,hp₁,hi₁,hcr,hcu⟩ := + stabilized_alignment v₀ hv₀ r₀ z₀ hr₀ hz₀ hp₀ E₀ B₀ hE₀ hB₀ + obtain ⟨r',hr',hp',hi',hd,hQ⟩ := + finish_alignment v z B hB (E₀.trans B₀.symm) r₁ u₁ hr₁ hu₁ hp₁ hi₁ hcr hcu + exact ⟨r',ordinaryBlockEquiv (E₀.trans B₀.symm),hr',hp',hi',hd,hQ⟩ + +end BoundaryBasisPresentation +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion +section BoundaryBasisTransport +variable {Γ S Z A R : Type*} [Group Γ] [Group.ResiduallyFinite Γ] [Fintype Z] + +/-- Full algebraic content of source Theorem presentation: the only additional +input is a genuine arbitrary-alphabet presentation with boundary basis. The +separate CW-to-presentation bridge must supply that input; it is not asserted +here as a hypothesis of the main result. -/ +theorem boundary_basis_small_transport + (v : S → Γ) (hv : Function.Surjective (wordValue v)) + (z : Z → FreeGroup S) (hz : ∀ i, wordValue v (z i) = 1) + (B : BasedChains Γ Z ≃ₗ[ℤ] cycles v) + (hB : ∀ c, (B c : BasedChains Γ S) = relatorChainMap v z c) + (a₀ : A → Γ) (ha₀ : Function.Surjective (wordValue a₀)) + (r₀ : R → FreeGroup A) (hr₀ : ∀ i, wordValue a₀ (r₀ i) = 1) + (hp₀ : (wordValue a₀).ker = Subgroup.normalClosure (Set.range r₀)) + (E : BasedChains Γ R ≃ₗ[ℤ] cycles a₀) + (hE : ∀ c, (E c : BasedChains Γ A) = relatorChainMap a₀ r₀ c) : + ∃ η : ℝ, 0 < η ∧ ∀ a : Γ → S → SU2, + (∀ g s, ‖(a g s : ℍ)-1‖ < η) → + (∀ i g, pathProduct v a (z i) g = 1) → + ∀ w : FreeGroup S, wordValue v w = 1 → ∀ g, + pathProduct v a w g = 1 := by + obtain ⟨r,Q,hr,hp,hinj,hd,hQ⟩ := + boundary_basis_presentation_alignment v hv z hz B hB a₀ ha₀ r₀ hr₀ hp₀ E hE + exact aligned_presentation_small_transport + (Sum.elim v (fun _ : A ⊕ (Z ⊕ A) => 1)) r z (fun _ => rfl) + hr hz hp hinj hd Q hQ + +end BoundaryBasisTransport +end EilenbergGanea + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/PresentationComparison.lean b/lean/OAI/Topology/EilenbergGanea/PresentationComparison.lean index bb28acb3a712a9df30032e03e35dbede2f7a3710..05d3f03745aed68136e5dfa7eab223cb19fa914b 100644 --- a/lean/OAI/Topology/EilenbergGanea/PresentationComparison.lean +++ b/lean/OAI/Topology/EilenbergGanea/PresentationComparison.lean @@ -1,1070 +1,1070 @@ -import OAI.Topology.EilenbergGanea.SmallHolonomy -import Mathlib.Topology.Algebra.Star.Unitary - -namespace OAI - -noncomputable section - -universe u - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -namespace EilenbergGanea -section NaturalPath -variable {Γ S H K : Type*} [Group Γ] [Group H] [Group K] - -theorem pathProduct_map (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) - (g : Γ) (f : H →* K) : - pathProduct v (fun p s => f (a p s)) w g = f (pathProduct v a w g) := by - induction w using FreeGroup.induction_on generalizing g with - | one => simp - | of s => simp - | inv_of s => simp only [pathProduct_inv, pathProduct_of, map_inv] - | mul w z hw hz => simp only [pathProduct_mul, hw, hz, map_mul] - -/-- The literal edge word traversed by a generator word. Free reduction of -this word is harmless for all nonabelian edge labelings. -/ -def pathSpelling (v : S → Γ) (w : FreeGroup S) (g : Γ) : FreeGroup (Γ × S) := - pathProduct v (fun p s => FreeGroup.of (p,s)) w g - -theorem pathSpelling_eval (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) (g : Γ) : - FreeGroup.lift (fun i : Γ × S => a i.1 i.2) (pathSpelling v w g) = - pathProduct v a w g := by - symm - simpa only [FreeGroup.lift_apply_of, pathSpelling] using - pathProduct_map v (fun p s => FreeGroup.of (p,s)) w g - (FreeGroup.lift (fun i : Γ × S => a i.1 i.2)) - -/-- Abelianizing the literal edge word gives exactly the integral edge chain. -/ -theorem pathSpelling_abelianization (v : S → Γ) (w : FreeGroup S) (g : Γ) : - FreeGroup.lift (fun i : Γ × S => Multiplicative.ofAdd (Finsupp.single i (1 : ℤ))) - (pathSpelling v w g) = Multiplicative.ofAdd (pathChain v w g) := by - exact pathSpelling_eval v (fun p s => Multiplicative.ofAdd (Finsupp.single (p,s) (1 : ℤ))) w g - -/-- Naturality in the target additive free module; used when projecting to -extra generators and when tensoring with a finite quotient. -/ -theorem pathChain_pairing {M : Type*} [AddCommGroup M] - (v : S → Γ) (b : Γ × S → M) (w : FreeGroup S) (g : Γ) : - Finsupp.linearCombination ℤ b (pathChain v w g) = - (pathProduct v (fun p s => Multiplicative.ofAdd (b (p,s))) w g).toAdd := by - induction w using FreeGroup.induction_on generalizing g with - | one => simp - | of s => simp [pathChain_of, Finsupp.linearCombination_single, pathProduct_of] - | inv_of s hs => - simpa only [pathChain_inv, map_neg, pathProduct_inv, toAdd_inv] using congrArg Neg.neg (hs _) - | mul w z hw hz => simp only [pathChain_mul, map_add, pathProduct_mul, - toAdd_mul, hw, hz] - -end NaturalPath -end EilenbergGanea - -namespace EilenbergGanea -section NormalExpressions -variable {S R : Type*} - -def inverseNormalFactor (f : NormalFactor S R) : NormalFactor S R := - (f.1, f.2.1, !f.2.2) - -theorem normalFactor_inverse (r : R → FreeGroup S) (f : NormalFactor S R) : - normalFactorWord r (inverseNormalFactor f) = (normalFactorWord r f)⁻¹ := by - rcases f with ⟨u, i, ε⟩ - cases ε <;> simp [normalFactorWord, inverseNormalFactor, mul_assoc] - -/-- Every element of a normal closure admits one finite product of conjugates, -including for arbitrary (possibly uncountable) index types. -/ -theorem exists_normalExpression (r : R → FreeGroup S) {w : FreeGroup S} - (hw : w ∈ Subgroup.normalClosure (Set.range r)) : - ∃ l : List (NormalFactor S R), w = (l.map (normalFactorWord r)).prod := by - change w ∈ Subgroup.closure (Group.conjugatesOfSet (Set.range r)) at hw - induction hw using Subgroup.closure_induction with - | mem x hx => - obtain ⟨y, ⟨i, rfl⟩, hy⟩ := Group.mem_conjugatesOfSet_iff.mp hx - obtain ⟨u, hu⟩ := isConj_iff.mp hy - refine ⟨[(u,i,true)], ?_⟩ - simpa [normalFactorWord] using hu.symm - | one => exact ⟨[], by simp⟩ - | mul x y hx hy ihx ihy => - obtain ⟨l, rfl⟩ := ihx - obtain ⟨k, rfl⟩ := ihy - exact ⟨l ++ k, by simp⟩ - | inv x hx ih => - obtain ⟨l, rfl⟩ := ih - refine ⟨(l.map inverseNormalFactor).reverse, ?_⟩ - simp only [List.map_reverse, List.prod_inv_reverse, List.map_map] - congr 2 - apply List.map_congr_left - intro f _ - exact (normalFactor_inverse r f).symm - -end NormalExpressions -end EilenbergGanea - -namespace EilenbergGanea -section WordNorm -open scoped Quaternion -variable {Γ S : Type*} [Group Γ] - -theorem su2_mul_distance (a b : SU2) : - ‖((a*b : SU2) : ℍ) - 1‖ ≤ ‖(a : ℍ) - 1‖ + ‖(b : ℍ) - 1‖ := by - have he : ((a*b : SU2) : ℍ) - 1 = ((a : ℍ) - 1) * (b : ℍ) + ((b : ℍ) - 1) := by - change (a : ℍ) * (b : ℍ) - 1 = _ - noncomm_ring - rw [he] - exact (norm_add_le _ _).trans_eq (by rw [norm_mul, su2_norm, mul_one]) - -/-- A finite control set for a word, uniform over all base vertices and all -labelings. Both the set and the coefficient are chosen before any quotient. -/ -theorem finite_word_control (v : S → Γ) (w : FreeGroup S) : - ∃ (P : Finset S) (n : ℕ), ∀ (ε : ℝ), 0 ≤ ε → ∀ (a : Γ → S → SU2), - (∀ g, ∀ s ∈ P, ‖(a g s : ℍ) - 1‖ ≤ ε) → - ∀ g, ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ ≤ n * ε := by - classical - induction w using FreeGroup.induction_on with - | one => exact ⟨∅, 0, fun ε _ a _ g => by simp⟩ - | of s => - refine ⟨{s}, 1, fun ε _ a ha g => ?_⟩ - simpa using ha g s (by simp) - | inv_of s ih => - obtain ⟨P, n, hn⟩ := ih - refine ⟨P, n, fun ε hε a ha g => ?_⟩ - rw [pathProduct_inv, su2_inverse_distance] - exact hn ε hε a ha _ - | mul w z hw hz => - obtain ⟨P, n, hn⟩ := hw - obtain ⟨Q, m, hm⟩ := hz - refine ⟨P ∪ Q, n+m, fun ε hε a ha g => ?_⟩ - rw [pathProduct_mul] - calc - _ ≤ ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ + - ‖((pathProduct v a z (g * wordValue v w) : SU2) : ℍ) - 1‖ := su2_mul_distance _ _ - _ ≤ n * ε + m * ε := add_le_add - (hn ε hε a (fun p s hs => ha p s (Finset.mem_union_left _ hs)) _) - (hm ε hε a (fun p s hs => ha p s (Finset.mem_union_right _ hs)) _) - _ = _ := by push_cast; ring - -/-- A finite control set for a word, uniform over all base vertices and all -labelings. Both the set and the coefficient are chosen before any quotient. -/ -theorem finite_word_control_universal (w : FreeGroup S) : - ∃ (P : Finset S) (n : ℕ), ∀ {D : Type u} [Group D] (v : S → D) (ε : ℝ), 0 ≤ ε → ∀ (a : D → S → SU2), - (∀ g, ∀ s ∈ P, ‖(a g s : ℍ) - 1‖ ≤ ε) → - ∀ g, ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ ≤ n * ε := by - classical - induction w using FreeGroup.induction_on with - | one => exact ⟨∅, 0, fun v ε _ a _ g => by simp⟩ - | of s => - refine ⟨{s}, 1, fun v ε _ a ha g => ?_⟩ - simpa using ha g s (by simp) - | inv_of s ih => - obtain ⟨P, n, hn⟩ := ih - refine ⟨P, n, fun v ε hε a ha g => ?_⟩ - rw [pathProduct_inv, su2_inverse_distance] - exact hn v ε hε a ha _ - | mul w z hw hz => - obtain ⟨P, n, hn⟩ := hw - obtain ⟨Q, m, hm⟩ := hz - refine ⟨P ∪ Q, n+m, fun v ε hε a ha g => ?_⟩ - rw [pathProduct_mul] - calc - _ ≤ ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ + - ‖((pathProduct v a z (g * wordValue v w) : SU2) : ℍ) - 1‖ := su2_mul_distance _ _ - _ ≤ n * ε + m * ε := add_le_add - (hn v ε hε a (fun p s hs => ha p s (Finset.mem_union_left _ hs)) _) - (hm v ε hε a (fun p s hs => ha p s (Finset.mem_union_right _ hs)) _) - _ = _ := by push_cast; ring - -end WordNorm -end EilenbergGanea - -namespace EilenbergGanea -section EvaluatedNormalExpression -open scoped Quaternion -variable {Γ D S R : Type*} [Group Γ] [Group D] - -theorem wordValue_quotient (v : S → Γ) (q : Γ →* D) (w : FreeGroup S) : - wordValue (fun s => q (v s)) w = q (wordValue v w) := by - have he : wordValue (fun s => q (v s)) = q.comp (wordValue v) := by - apply FreeGroup.ext_hom - intro s - simp [wordValue] - exact congrArg (fun f : FreeGroup S →* D => f w) he - -def evaluatedNormalFactor (v : S → Γ) (a : Γ → S → SU2) - (f : NormalFactor S R) (g : Γ) : RelatorFactor (Γ × R) := - (pathProduct v a f.1 g, (g * wordValue v f.1, f.2.1), f.2.2) - -theorem evaluatedNormalFactor_value (v : S → Γ) (a : Γ → S → SU2) - (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) - (f : NormalFactor S R) (g : Γ) : - relatorFactorValue (fun i : Γ × R => pathProduct v a (r i.2) i.1) - (evaluatedNormalFactor v a f g) = pathProduct v a (normalFactorWord r f) g := by - rcases f with ⟨u, i, σ⟩ - cases σ <;> - simp [relatorFactorValue, evaluatedNormalFactor, signedUnit, normalFactorWord, - pathProduct_conjugate_loop, hr, pathProduct_inv] - -theorem pathProduct_normalProduct (v : S → Γ) (a : Γ → S → SU2) - (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) - (l : List (NormalFactor S R)) (g : Γ) : - ((l.map (fun f => evaluatedNormalFactor v a f g)).map - (relatorFactorValue (fun i : Γ × R => pathProduct v a (r i.2) i.1))).prod = - pathProduct v a (l.map (normalFactorWord r)).prod g := by - induction l with - | nil => simp - | cons f l ih => - simp only [List.map_cons, List.prod_cons, pathProduct_mul, - normalFactor_value v r hr, mul_one, evaluatedNormalFactor_value v a r hr, ih] - -/-- Exact translated signed counts are preserved upon passage to every quotient. -No flatness, finiteness, or injectivity of the quotient is used. -/ -theorem quotient_evaluated_counts (v : S → Γ) (q : Γ →* D) - (a : D → S → SU2) (l : List (NormalFactor S R)) (ρ : R) - (hc : (l.map (fun f => normalFactorCount v f 1)).sum = Finsupp.single (1,ρ) 1) - (g : D) : - relatorSignedCounts (l.map (fun f => evaluatedNormalFactor (fun s => q (v s)) a f g)) = - Finsupp.single (g,ρ) 1 := by - let T : ((Γ × R) →₀ ℤ) →ₗ[ℤ] ((D × R) →₀ ℤ) := - Finsupp.lmapDomain ℤ ℤ (fun i => (g * q i.1, i.2)) - have hs : relatorSignedCounts - (l.map (fun f => evaluatedNormalFactor (fun s => q (v s)) a f g)) = - T (l.map (fun f => normalFactorCount v f 1)).sum := by - simp only [relatorSignedCounts, List.map_map, map_list_sum] - congr 1 - apply List.map_congr_left - intro f _ - simp [T, evaluatedNormalFactor, normalFactorCount, wordValue_quotient] - rw [hs, hc] - simp [T] - -/-- The actual relator expression, evaluated by arbitrary edge labels on a -quotient graph, has the uniform quadratic error predicted by its exact chain -counts. -/ -theorem normalExpression_quadratic (v : S → Γ) (q : Γ →* D) - (a : D → S → SU2) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (z : FreeGroup S) - (l : List (NormalFactor S R)) (he : z = (l.map (normalFactorWord r)).prod) - (ρ : R) (hc : (l.map (fun f => normalFactorCount v f 1)).sum = - Finsupp.single (1,ρ) 1) - (h ε K : ℝ) (hh : 0 ≤ h) (hε : 0 ≤ ε) (hK : 0 ≤ K) - (hb : ∀ f ∈ l, ∀ g, ‖((pathProduct (fun s => q (v s)) a (r f.2.1) g : SU2) : ℍ) - 1‖ ≤ h) - (ha : ∀ f ∈ l, ∀ g, ‖((pathProduct (fun s => q (v s)) a f.1 g : SU2) : ℍ) - 1‖ ≤ K * (ε+h)) - (g : D) : - ‖((pathProduct (fun s => q (v s)) a z g : SU2) : ℍ) - - ((pathProduct (fun s => q (v s)) a (r ρ) g : SU2) : ℍ)‖ ≤ - ((l.length : ℝ)^2 + l.length + 2*l.length*K) * (ε+h)*h := by - let v' := fun s => q (v s) - let L := l.map (fun f => evaluatedNormalFactor v' a f g) - let x := fun i : D × R => pathProduct v' a (r i.2) i.1 - have hp := relator_product_quadratic L x (g,ρ) - (quotient_evaluated_counts v q a l ρ hc g) h ε K hh hε hK - (by intro f hf; obtain ⟨b,hb',rfl⟩ := List.mem_map.mp hf; exact hb b hb' _) - (by intro f hf; obtain ⟨b,hb',rfl⟩ := List.mem_map.mp hf; exact ha b hb' _) - have hprod : (L.map (fun f => (relatorFactorValue x f : ℍ))).prod = - ((pathProduct v' a z g : SU2) : ℍ) := by - have hz := pathProduct_normalProduct v' a r - (fun i => by simp [v', wordValue_quotient, hr]) l g - rw [← he] at hz - have hco (ll : List SU2) : ((ll.prod : SU2) : ℍ) = (ll.map (fun b : SU2 => (b : ℍ))).prod := by - induction ll with - | nil => rfl - | cons b ll ih => simp only [List.prod_cons, Submonoid.coe_mul, List.map_cons, ih] - have hz' := congrArg (fun x : SU2 => (x : ℍ)) hz - rw [hco] at hz' - simpa only [L, x, List.map_map, Function.comp_def] using hz' - simpa only [hprod, L, List.length_map, x, v'] using hp - -end EvaluatedNormalExpression -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion -section NormalProductSize -variable {Γ S R : Type*} [Group Γ] - - theorem normalFactor_product_distance (v : S → Γ) (a : Γ → S → SU2) - (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) - (f : NormalFactor S R) (g : Γ) : - ‖((pathProduct v a (normalFactorWord r f) g : SU2) : ℍ) - 1‖ = - ‖((pathProduct v a (r f.2.1) (g * wordValue v f.1) : SU2) : ℍ) - 1‖ := by - rw [← evaluatedNormalFactor_value v a r hr] - exact (su2_conjugation_distance _ _).trans (signedUnit_distance _ _) - -/-- Unlike the quadratic estimate, this linear bound needs no information -whatever about the conjugating words. It controls the finitely many auxiliary -loop labels before any bound on the conjugators is obtained. -/ -theorem normalProduct_distance (v : S → Γ) (a : Γ → S → SU2) - (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) - (l : List (NormalFactor S R)) (h : ℝ) - (hb : ∀ f ∈ l, ∀ g, ‖((pathProduct v a (r f.2.1) g : SU2) : ℍ) - 1‖ ≤ h) - (g : Γ) : - ‖((pathProduct v a (l.map (normalFactorWord r)).prod g : SU2) : ℍ) - 1‖ ≤ l.length * h := by - induction l with - | nil => simp - | cons f l ih => - simp only [List.map_cons, List.prod_cons, pathProduct_mul, normalFactor_value v r hr, mul_one] - calc - _ ≤ ‖((pathProduct v a (normalFactorWord r f) g : SU2) : ℍ) - 1‖ + - ‖((pathProduct v a (l.map (normalFactorWord r)).prod g : SU2) : ℍ) - 1‖ := su2_mul_distance _ _ - _ ≤ h + l.length * h := add_le_add - (by rw [normalFactor_product_distance v a r hr]; exact hb f (by simp) _) - (ih (fun b hb' => hb b (by simp [hb']))) - _ = _ := by simp only [List.length_cons, Nat.cast_add, Nat.cast_one]; ring - -end NormalProductSize -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion -section FiniteControl -variable {S T H : Type*} [Group H] - - theorem pathProduct_map_alphabet {Γ : Type*} [Group Γ] - (f : S → T) (v : T → Γ) (a : Γ → T → H) (w : FreeGroup S) (g : Γ) : - pathProduct v a (FreeGroup.map f w) g = - pathProduct (v ∘ f) (fun p s => a p (f s)) w g := by - have he : (labelLift v a).comp (FreeGroup.map f) = - labelLift (v ∘ f) (fun p s => a p (f s)) := by - apply FreeGroup.ext_hom - intro s - simp [labelLift] - exact congrArg (fun l : FreeGroup S →* ((Γ → H) ⋊[functionShift Γ H] Γ) => (l w).left g) he - - theorem finite_word_family_control (W : Finset (FreeGroup S)) : - ∃ (P : Finset S) (n : ℕ), ∀ w ∈ W, - ∀ {D : Type u} [Group D] (v : S → D) (ε : ℝ), 0 ≤ ε → ∀ (a : D → S → SU2), - (∀ g, ∀ s ∈ P, ‖(a g s : ℍ) - 1‖ ≤ ε) → - ∀ g, ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ ≤ n * ε := by - classical - induction W using Finset.induction_on with - | empty => exact ⟨∅,0, by simp⟩ - | @insert w W _ ih => - obtain ⟨P,n,hn⟩ := finite_word_control_universal w - obtain ⟨Q,m,hm⟩ := ih - refine ⟨P ∪ Q, n+m, ?_⟩ - intro z hz D _ v ε hε a ha g - rcases Finset.mem_insert.mp hz with rfl | hz - · exact (hn v ε hε a (fun p s hs => ha p s (Finset.mem_union_left _ hs)) g).trans - (mul_le_mul_of_nonneg_right (by exact_mod_cast Nat.le_add_right n m) hε) - · exact (hm z hz v ε hε a (fun p s hs => ha p s (Finset.mem_union_right _ hs)) g).trans - (mul_le_mul_of_nonneg_right (by exact_mod_cast Nat.le_add_left m n) hε) - -end FiniteControl -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion BigOperators -section UniformComparison -variable {Γ S T Z R : Type*} [Group Γ] [Fintype Z] - -/-- All constants and all ordinary relators needed by the quadratic estimate -are chosen before the group quotient and before the edge labels. The normal -expressions are literal finite words, while the ambient alphabets may have any -cardinality. -/ -theorem finite_normal_comparison - (v : S ⊕ T → Γ) (r : Z ⊕ R → FreeGroup (S ⊕ T)) - (hr : ∀ i, wordValue v (r i) = 1) (z : Z → FreeGroup S) - (lz : Z → List (NormalFactor (S ⊕ T) (Z ⊕ R))) - (lt : T → List (NormalFactor (S ⊕ T) (Z ⊕ R))) - (hz : ∀ i, FreeGroup.map Sum.inl (z i) = ((lz i).map (normalFactorWord r)).prod) - (ht : ∀ t, FreeGroup.of (Sum.inr t) = ((lt t).map (normalFactorWord r)).prod) - (hc : ∀ i, ((lz i).map (fun f => normalFactorCount v f 1)).sum = - Finsupp.single (1,Sum.inl i) 1) : - ∃ (A : Finset R) (C : ℝ), 1 ≤ C ∧ - ∀ {F : Type u} [Group F] (q : Γ →* F) (a : F → S ⊕ T → SU2) - (ε h : ℝ), 0 ≤ ε → 0 ≤ h → - (∀ g s, ‖(a g (.inl s) : ℍ) - 1‖ ≤ ε) → - (∀ i ∈ A, ∀ g, pathProduct (fun s => q (v s)) a (r (.inr i)) g = 1) → - (∀ i g, ‖((pathProduct (fun s => q (v s)) a (r (.inl i)) g : SU2) : ℍ) - 1‖ ≤ h) → - ∀ i g, - ‖((pathProduct (fun s => q (v s)) a (FreeGroup.map Sum.inl (z i)) g : SU2) : ℍ) - - ((pathProduct (fun s => q (v s)) a (r (.inl i)) g : SU2) : ℍ)‖ ≤ C * (ε+h)*h ∧ - ‖((pathProduct (fun s => q (v s)) a (FreeGroup.map Sum.inl (z i)) g : SU2) : ℍ) - 1‖ ≤ C*ε := by - classical - let W : Finset (FreeGroup (S ⊕ T)) := Finset.univ.biUnion fun i => - (lz i).toFinset.image Prod.fst - obtain ⟨P,n,hn⟩ := finite_word_family_control W - obtain ⟨_,nz,hnz⟩ := finite_word_family_control (Finset.univ.image z) - let U : Finset (Z ⊕ R) := - (Finset.univ.biUnion fun i => (lz i).toFinset.image (fun f => f.2.1)) ∪ - (P.toRight.biUnion fun t => (lt t).toFinset.image (fun f => f.2.1)) - let M : ℕ := 1 + P.toRight.sup (fun t => (lt t).length) - let N : ℕ := Finset.univ.sup (fun i => (lz i).length) - let K : ℝ := n * M - let C : ℝ := 1 + nz + (N : ℝ)^2 + N + 2*N*K - have hM : 1 ≤ M := Nat.le_add_right 1 _ - have hMr : 1 ≤ (M : ℝ) := by exact_mod_cast hM - have hK : 0 ≤ K := by dsimp [K]; positivity - have hcoef : 0 ≤ (2 : ℝ)*N*K := by positivity - have hNr : (0 : ℝ) ≤ N := Nat.cast_nonneg _ - have hnzr : (0 : ℝ) ≤ nz := Nat.cast_nonneg _ - have hC : 1 ≤ C := by dsimp [C]; nlinarith [sq_nonneg (N : ℝ)] - have hnzC : (nz : ℝ) ≤ C := by dsimp [C]; nlinarith [sq_nonneg (N : ℝ)] - have hNC : (N : ℝ)^2 + N + 2*N*K ≤ C := by dsimp [C]; linarith - refine ⟨U.toRight,C,hC,?_⟩ - intro F _ q a ε h hε hh ha hordinary hdist i g - let v' := fun s => q (v s) - have hr' (j) : wordValue v' (r j) = 1 := by simp [v', wordValue_quotient, hr] - have hused (j : Z ⊕ R) (hj : j ∈ U) (p : F) : - ‖((pathProduct v' a (r j) p : SU2) : ℍ)-1‖ ≤ h := by - rcases j with j | j - · exact hdist j p - · rw [hordinary j (Finset.mem_toRight.mpr hj) p] - simpa using hh - have hZ (j : Z) (f : NormalFactor (S ⊕ T) (Z ⊕ R)) (hf : f ∈ lz j) (p : F) : - ‖((pathProduct v' a (r f.2.1) p : SU2) : ℍ)-1‖ ≤ h := by - apply hused _ _ p - exact Finset.mem_union_left _ (Finset.mem_biUnion.mpr ⟨j,Finset.mem_univ _, - Finset.mem_image.mpr ⟨f,List.mem_toFinset.mpr hf,rfl⟩⟩) - have hT (t : T) (htP : t ∈ P.toRight) (p : F) : ‖(a p (.inr t) : ℍ)-1‖ ≤ M*h := by - have hb := normalProduct_distance v' a r hr' (lt t) h - (fun f hf p => hused _ (Finset.mem_union_right _ - (Finset.mem_biUnion.mpr ⟨t,htP,Finset.mem_image.mpr ⟨f,List.mem_toFinset.mpr hf,rfl⟩⟩)) p) p - rw [← ht t, pathProduct_of] at hb - exact hb.trans (mul_le_mul_of_nonneg_right (by - exact_mod_cast (show (lt t).length ≤ M from - (Finset.le_sup (f := fun t => (lt t).length) htP).trans (Nat.le_add_left _ 1))) hh) - have hsize : 0 ≤ (M : ℝ)*(ε+h) := mul_nonneg (Nat.cast_nonneg _) (add_nonneg hε hh) - have hP (p : F) (s : S ⊕ T) (hs : s ∈ P) : ‖(a p s : ℍ)-1‖ ≤ M*(ε+h) := by - rcases s with s | t - · calc - _ ≤ ε := ha p s - _ ≤ (M : ℝ)*ε := by nlinarith - _ ≤ (M : ℝ)*(ε+h) := mul_le_mul_of_nonneg_left (by linarith) (Nat.cast_nonneg _) - · exact (hT t (Finset.mem_toRight.mpr hs) p).trans - (mul_le_mul_of_nonneg_left (by linarith) (Nat.cast_nonneg _)) - have hconj (j : Z) (f : NormalFactor (S ⊕ T) (Z ⊕ R)) (hf : f ∈ lz j) (p : F) : - ‖((pathProduct v' a f.1 p : SU2) : ℍ)-1‖ ≤ K*(ε+h) := by - have hW : f.1 ∈ W := Finset.mem_biUnion.mpr ⟨j,Finset.mem_univ _, - Finset.mem_image.mpr ⟨f,List.mem_toFinset.mpr hf,rfl⟩⟩ - simpa only [K, mul_assoc] using hn f.1 hW v' _ hsize a hP p - constructor - · have hb := normalExpression_quadratic v q a r hr _ (lz i) (hz i) (.inl i) (hc i) - h ε K hh hε hK (hZ i) (hconj i) g - apply hb.trans - apply mul_le_mul_of_nonneg_right _ hh - apply mul_le_mul_of_nonneg_right _ (add_nonneg hε hh) - have hl : ((lz i).length : ℝ) ≤ N := by - exact_mod_cast (show (lz i).length ≤ N from - Finset.le_sup (f := fun j => (lz j).length) (Finset.mem_univ i)) - have h0 : (0 : ℝ) ≤ (lz i).length := Nat.cast_nonneg _ - have hn0 : (0 : ℝ) ≤ N := Nat.cast_nonneg _ - have hp := mul_le_mul_of_nonneg_right hl hK - nlinarith [sq_nonneg ((N : ℝ) - (lz i).length)] - · rw [pathProduct_map_alphabet] - exact (hnz (z i) (Finset.mem_image.mpr ⟨i,Finset.mem_univ _,rfl⟩) - _ ε hε (fun p s => a p (.inl s)) (fun p s _ => ha p s) g).trans - (mul_le_mul_of_nonneg_right hnzC hε) - -end UniformComparison -end EilenbergGanea - -namespace EilenbergGanea - -section QuotientChains -variable {Γ F R S T : Type*} [Group Γ] [Group F] - -abbrev BasedChains (Γ S : Type*) := (Γ × S) →₀ ℤ - -def translateChains (g : Γ) : BasedChains Γ S →ₗ[ℤ] BasedChains Γ S := - Finsupp.lmapDomain ℤ ℤ (fun i => (g*i.1, i.2)) - -def quotientChains (q : Γ →* F) : BasedChains Γ S →ₗ[ℤ] BasedChains F S := - Finsupp.lmapDomain ℤ ℤ (fun i => (q i.1, i.2)) - -@[simp] theorem translateChains_single (g h : Γ) (s : S) (n : ℤ) : - translateChains g (Finsupp.single (h,s) n) = Finsupp.single (g*h,s) n := by - simp [translateChains] - -@[simp] theorem quotientChains_single (q : Γ →* F) (g : Γ) (s : S) (n : ℤ) : - quotientChains q (Finsupp.single (g,s) n) = Finsupp.single (q g,s) n := by - simp [quotientChains] - -theorem translateChains_mul (g h : Γ) (c : BasedChains Γ S) : - translateChains (g*h) c = translateChains g (translateChains h c) := by - have he : (translateChains (g*h) : BasedChains Γ S →ₗ[ℤ] _) = - (translateChains g).comp (translateChains h) := by - apply Finsupp.lhom_ext - rintro ⟨p,s⟩ n - simp [mul_assoc] - exact LinearMap.congr_fun he c - -@[simp] theorem translateChains_one (c : BasedChains Γ S) : translateChains (1 : Γ) c = c := by - have he : (translateChains (1 : Γ) : BasedChains Γ S →ₗ[ℤ] _) = LinearMap.id := by - apply Finsupp.lhom_ext - rintro ⟨g,s⟩ n - simp - exact LinearMap.congr_fun he c - -theorem quotientChains_translate (q : Γ →* F) (g : Γ) (c : BasedChains Γ S) : - quotientChains q (translateChains g c) = translateChains (q g) (quotientChains q c) := by - have he : (quotientChains q).comp (translateChains g) = - ((translateChains (q g)).comp (quotientChains q) : BasedChains Γ S →ₗ[ℤ] _) := by - apply Finsupp.lhom_ext - rintro ⟨p,s⟩ n - simp - exact LinearMap.congr_fun he c - -/-- The elementary equivariance expressing a left integral group-ring map. -/ -def ChainsEquivariant (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) : Prop := - ∀ g c, A (translateChains g c) = translateChains g (A c) - -/-- Base change of a translation-equivariant matrix, directly on its finitely -supported columns. Its definition needs neither finite index sets nor flatness. -/ -def quotientMatrix (q : Γ →* F) (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) : - BasedChains F R →ₗ[ℤ] BasedChains F S := - Finsupp.linearCombination ℤ (fun i => - translateChains i.1 (quotientChains q (A (Finsupp.single (1,i.2) 1)))) - -@[simp] theorem quotientMatrix_single (q : Γ →* F) - (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) (f : F) (r : R) (n : ℤ) : - quotientMatrix q A (Finsupp.single (f,r) n) = - n • translateChains f (quotientChains q (A (Finsupp.single (1,r) 1))) := by - simp [quotientMatrix] - -theorem quotientMatrix_equivariant (q : Γ →* F) - (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) : ChainsEquivariant (quotientMatrix q A) := by - intro f c - have he : (quotientMatrix q A).comp (translateChains f) = - (translateChains f).comp (quotientMatrix q A) := by - apply Finsupp.lhom_ext - rintro ⟨p,r⟩ n - simp only [LinearMap.comp_apply, translateChains_single, quotientMatrix_single, - map_smul, translateChains_mul] - exact LinearMap.congr_fun he c - -theorem quotientMatrix_natural (q : Γ →* F) - (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) (hA : ChainsEquivariant A) - (c : BasedChains Γ R) : - quotientMatrix q A (quotientChains q c) = quotientChains q (A c) := by - have he : (quotientMatrix q A).comp (quotientChains q) = (quotientChains q).comp A := by - apply Finsupp.lhom_ext - rintro ⟨g,r⟩ n - have hb : Finsupp.single (g,r) n = - n • translateChains g (Finsupp.single (1,r) (1 : ℤ)) := by simp - simp only [LinearMap.comp_apply, quotientChains_single, quotientMatrix_single] - rw [hb, map_smul, map_smul, hA, quotientChains_translate] - exact LinearMap.congr_fun he c - -theorem quotientMatrix_comp (q : Γ →* F) - (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) - (B : BasedChains Γ S →ₗ[ℤ] BasedChains Γ T) (hB : ChainsEquivariant B) : - quotientMatrix q (B.comp A) = (quotientMatrix q B).comp (quotientMatrix q A) := by - apply Finsupp.lhom_ext - rintro ⟨f,r⟩ n - simp only [LinearMap.comp_apply, quotientMatrix_single, map_smul] - rw [quotientMatrix_equivariant q B f, quotientMatrix_natural q B hB] - -theorem quotientMatrix_id (q : Γ →* F) : - quotientMatrix q (LinearMap.id : BasedChains Γ R →ₗ[ℤ] _) = LinearMap.id := by - apply Finsupp.lhom_ext - rintro ⟨f,r⟩ n - simp - -theorem ChainsEquivariant.symm (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ S) - (hA : ChainsEquivariant A.toLinearMap) : ChainsEquivariant A.symm.toLinearMap := by - intro g c - apply A.injective - simp only [LinearEquiv.coe_coe, LinearEquiv.apply_symm_apply] - simpa only [LinearEquiv.coe_coe, LinearEquiv.apply_symm_apply] using (hA g (A.symm c)).symm - -/-- Tensoring an isomorphism is an isomorphism. This finite-column proof makes -no assertion that the quotient group ring is a flat module. -/ -def quotientChainEquiv (q : Γ →* F) (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ S) - (hA : ChainsEquivariant A.toLinearMap) : BasedChains F R ≃ₗ[ℤ] BasedChains F S where - __ := quotientMatrix q A.toLinearMap - invFun := quotientMatrix q A.symm.toLinearMap - left_inv c := by - have he := quotientMatrix_comp q A.toLinearMap A.symm.toLinearMap (ChainsEquivariant.symm A hA) - have hi : A.symm.toLinearMap.comp A.toLinearMap = LinearMap.id := by ext; simp - rw [hi, quotientMatrix_id] at he - exact (LinearMap.congr_fun he c).symm - right_inv c := by - have he := quotientMatrix_comp q A.symm.toLinearMap A.toLinearMap hA - have hi : A.toLinearMap.comp A.symm.toLinearMap = LinearMap.id := by ext; simp - rw [hi, quotientMatrix_id] at he - exact (LinearMap.congr_fun he c).symm - -end QuotientChains -end EilenbergGanea - - - -namespace EilenbergGanea -open scoped BigOperators - -/-- A finite family with an integral left inverse has a nonzero square minor. -Expansion of the alternating determinant avoids a flatness or rationalization -assumption, and also covers the empty row family. -/ -theorem nonsingular_minor_of_left_inverse {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] - (v : J → I → ℤ) (b : I → J → ℤ) - (hb : ∀ i, ∑ j, b i j • v j = Pi.single i 1) : - ∃ e : I → J, Function.Injective e ∧ Matrix.det (fun i k => v (e i) k) ≠ 0 := by - classical - have hex : ∃ e : I → J, Matrix.det (fun i k => v (e i) k) ≠ 0 := by - by_contra h - push Not at h - let D := (Matrix.detRowAlternating : (I → ℤ) [⋀^I]→ₗ[ℤ] ℤ).toMultilinearMap - have hz : D (fun i => ∑ j, b i j • v j) = 0 := by - rw [D.map_sum] - apply Finset.sum_eq_zero - intro e _ - rw [D.map_smul_univ] - change (∏ i, b i (e i)) • Matrix.det (fun i k => v (e i) k) = 0 - rw [h] - exact smul_zero _ - have he : (fun i => ∑ j, b i j • v j) = (1 : Matrix I I ℤ) := by - ext i k - rw [show (∑ j, b i j • v j) = Pi.single i 1 from hb i] - simp [Matrix.one_apply, Pi.single_apply, eq_comm] - rw [he] at hz - change Matrix.det (1 : Matrix I I ℤ) = 0 at hz - simp at hz - obtain ⟨e, he⟩ := hex - refine ⟨e, ?_, he⟩ - intro i j hij - by_contra hne - exact he (Matrix.det_zero_of_row_eq hne (by simp [hij])) - -/-- The same finite-minor statement for an arbitrary direct sum. All supports -are retained, but only the finite union needed by the chosen rows is used. -/ -theorem finitely_supported_split_family_minor {I S : Type*} [Fintype I] [DecidableEq I] - (v : I → S →₀ ℤ) (B : (S →₀ ℤ) →ₗ[ℤ] (I → ℤ)) - (hB : ∀ i, B (v i) = Pi.single i 1) : - ∃ e : I → S, Function.Injective e ∧ Matrix.det (fun i j => v i (e j)) ≠ 0 := by - classical - let P : Finset S := Finset.univ.biUnion (fun i => (v i).support) - have hP (i : I) : (v i).support ⊆ P := by - intro s hs - exact Finset.mem_biUnion.mpr ⟨i, Finset.mem_univ _, hs⟩ - have hexpand (i : I) : v i = ∑ p : P, (v i) p.1 • (Finsupp.single p.1 (1 : ℤ)) := by - rw [Finset.sum_coe_sort P (fun p => (v i) p • (Finsupp.single p (1 : ℤ)))] - simp only [Finsupp.smul_single, smul_eq_mul, mul_one] - rw [← Finsupp.sum_of_support_subset (v i) (hP i) - (fun p t => Finsupp.single p t) (by intro p _; simp)] - exact (Finsupp.sum_single (v i)).symm - let w : P → I → ℤ := fun p j => v j p.1 - let b : I → P → ℤ := fun i p => B (Finsupp.single p.1 1) i - have hb (i : I) : ∑ p, b i p • w p = Pi.single i 1 := by - ext j - have hi := congrFun (hB j) i - rw [hexpand j, map_sum] at hi - simp only [map_smul, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] at hi - simpa only [b, w, Finset.sum_apply, Pi.smul_apply, smul_eq_mul, mul_comm, - Pi.single_apply, eq_comm] using hi - obtain ⟨e, he, hd⟩ := nonsingular_minor_of_left_inverse w b hb - refine ⟨fun i => (e i).1, ?_, ?_⟩ - · intro i j hij - exact he (Subtype.ext hij) - · have ht := Matrix.det_transpose (fun i j => v i (e j).1) - exact fun h => hd (ht.trans h) - -/-- Every finite subfamily of an arbitrary integral basis has a nonsingular -finite coordinate minor, including when the ambient basis is uncountable. -/ -theorem basis_subfamily_minor {I R S : Type*} [Fintype I] [DecidableEq I] - (A : (R →₀ ℤ) ≃ₗ[ℤ] (S →₀ ℤ)) (j : I ↪ R) : - ∃ e : I → S, Function.Injective e ∧ - Matrix.det (fun i k => A (Finsupp.single (j i) 1) (e k)) ≠ 0 := by - classical - let B : (S →₀ ℤ) →ₗ[ℤ] (I → ℤ) := - LinearMap.pi fun i => (Finsupp.lapply (j i)).comp A.symm.toLinearMap - apply finitely_supported_split_family_minor (fun i => A (Finsupp.single (j i) 1)) B - intro i - ext k - simp [B, Pi.single_apply, Finsupp.single_apply, j.injective.eq_iff, eq_comm] - -end EilenbergGanea - -namespace EilenbergGanea -section ChainProjection -variable {Γ D S T R : Type*} [Group Γ] [Group D] - -theorem pathChain_translate (v : S → Γ) (w : FreeGroup S) (g h : Γ) : - translateChains g (pathChain v w h) = pathChain v w (g*h) := by - induction w using FreeGroup.induction_on generalizing h with - | one => simp - | of s => simp - | inv_of s ih => simp only [pathChain_inv, map_neg, ih, mul_assoc] - | mul w z hw hz => simp only [pathChain_mul, map_add, hw, hz, mul_assoc] - -theorem pathChain_quotient (v : S → Γ) (q : Γ →* D) (w : FreeGroup S) (g : Γ) : - quotientChains q (pathChain v w g) = pathChain (fun s => q (v s)) w (q g) := by - induction w using FreeGroup.induction_on generalizing g with - | one => simp - | of s => simp - | inv_of s ih => simp only [pathChain_inv, map_neg, ih, map_mul, map_inv, wordValue_quotient] - | mul w z hw hz => simp only [pathChain_mul, map_add, hw, hz, map_mul, wordValue_quotient] - -def projectExtraChains : BasedChains Γ (S ⊕ T) →ₗ[ℤ] BasedChains Γ T := - Finsupp.linearCombination ℤ fun p => match p.2 with - | .inl _ => 0 - | .inr t => Finsupp.single (p.1,t) 1 - -omit [Group Γ] in -@[simp] theorem projectExtraChains_single_left (g : Γ) (s : S) (n : ℤ) : - projectExtraChains (Finsupp.single (g,Sum.inl s) n : BasedChains Γ (S ⊕ T)) = 0 := by - simp [projectExtraChains] - -omit [Group Γ] in -@[simp] theorem projectExtraChains_single_right (g : Γ) (t : T) (n : ℤ) : - projectExtraChains (Finsupp.single (g,Sum.inr t) n : BasedChains Γ (S ⊕ T)) = - Finsupp.single (g,t) n := by simp [projectExtraChains] - -theorem projectExtraChains_translate (g : Γ) (c : BasedChains Γ (S ⊕ T)) : - projectExtraChains (translateChains g c) = translateChains g (projectExtraChains c) := by - have he : (projectExtraChains (Γ := Γ) (S := S) (T := T)).comp (translateChains g) = - (translateChains g).comp projectExtraChains := by - apply Finsupp.lhom_ext - rintro ⟨h, s | t⟩ n <;> simp - exact LinearMap.congr_fun he c - -theorem projectExtraChains_quotient (q : Γ →* D) (c : BasedChains Γ (S ⊕ T)) : - projectExtraChains (quotientChains q c) = quotientChains q (projectExtraChains c) := by - have he : (projectExtraChains (Γ := D) (S := S) (T := T)).comp (quotientChains q) = - (quotientChains q).comp projectExtraChains := by - apply Finsupp.lhom_ext - rintro ⟨h, s | t⟩ n <;> simp - exact LinearMap.congr_fun he c - -def extraRelatorMap (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) : - BasedChains Γ R →ₗ[ℤ] BasedChains Γ T := - projectExtraChains.comp (relatorChainMap v r) - -@[simp] theorem extraRelatorMap_single (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) - (g : Γ) (i : R) (n : ℤ) : - extraRelatorMap v r (Finsupp.single (g,i) n) = - n • projectExtraChains (pathChain v (r i) g) := by - simp [extraRelatorMap, relatorChainMap] - -theorem extraRelatorMap_equivariant (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) : - ChainsEquivariant (extraRelatorMap v r) := by - intro g c - have he : (extraRelatorMap v r).comp (translateChains g) = - (translateChains g).comp (extraRelatorMap v r) := by - apply Finsupp.lhom_ext - rintro ⟨h,i⟩ n - simp only [LinearMap.comp_apply, translateChains_single, extraRelatorMap_single, map_smul] - rw [← projectExtraChains_translate, pathChain_translate] - exact LinearMap.congr_fun he c - -theorem extraRelatorMap_quotientMatrix (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) - (q : Γ →* D) : - quotientMatrix q (extraRelatorMap v r) = extraRelatorMap (fun s => q (v s)) r := by - apply Finsupp.lhom_ext - rintro ⟨g,i⟩ n - simp only [quotientMatrix_single, extraRelatorMap_single, one_smul] - rw [← projectExtraChains_quotient, pathChain_quotient, - ← projectExtraChains_translate, pathChain_translate, map_one, mul_one] - -/-- The exponent minor used on a finite quotient is a consequence of the -ordinary projected boundary isomorphism itself; no independent rank hypothesis -and no unproved flatness claim is inserted. -/ -theorem finite_extra_boundary_minor {I : Type*} [Fintype I] [DecidableEq I] - (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) - (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ T) - (hA : A.toLinearMap = extraRelatorMap v r) (q : Γ →* D) (j : I ↪ D × R) : - ∃ e : I → D × T, Function.Injective e ∧ - Matrix.det (fun i k => projectExtraChains - (pathChain (fun s => q (v s)) (r (j i).2) (j i).1) (e k)) ≠ 0 := by - let B := quotientChainEquiv q A (by rw [hA]; exact extraRelatorMap_equivariant v r) - obtain ⟨e,he,hd⟩ := basis_subfamily_minor B j - refine ⟨e,he,?_⟩ - have hB : B.toLinearMap = extraRelatorMap (fun s => q (v s)) r := by - change quotientMatrix q A.toLinearMap = _ - rw [hA, extraRelatorMap_quotientMatrix] - have hb (i : I) : B (Finsupp.single (j i) 1) = projectExtraChains - (pathChain (fun s => q (v s)) (r (j i).2) (j i).1) := by - change B.toLinearMap _ = _ - rw [hB] - rcases j i with ⟨g,k⟩ - simp - simpa only [hb] using hd - -end ChainProjection -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion -section FiniteQuotientEquations -variable {Γ F S T R Z : Type*} [Group Γ] [Group F] - -/-- The exponent of a literal edge is exactly its cellular path coefficient. -/ -theorem pathSpelling_exponent [DecidableEq F] [DecidableEq S] - (v : S → F) (w : FreeGroup S) (g : F) (e : F × S) : - wordExponents (pathSpelling v w g) e = pathChain v w g e := by - have he : (FreeGroup.lift (fun i : F × S => - Multiplicative.ofAdd (if e = i then (1 : ℤ) else 0))) = - (Finsupp.applyAddHom e).toMultiplicative.comp - (FreeGroup.lift (fun i : F × S => Multiplicative.ofAdd (Finsupp.single i (1 : ℤ)))) := by - apply FreeGroup.ext_hom - intro i - simp [Finsupp.single_apply, eq_comm] - simp only [wordExponents, he, MonoidHom.comp_apply, pathSpelling_abelianization] - rfl - -omit [Group F] in -/-- Projection to the extra alphabet really deletes only the prescribed edges. -/ -theorem projectExtraChains_apply (c : BasedChains F (S ⊕ T)) (e : F × T) : - projectExtraChains c e = c (e.1, Sum.inr e.2) := by - classical - induction c using Finsupp.induction_linear with - | zero => simp - | add c d hc hd => simp only [map_add, Finsupp.add_apply, hc, hd] - | single p n => - rcases p with ⟨g,s | t⟩ - · simp - · simp [Finsupp.single_apply, Prod.ext_iff] - -/-- Sup norm agrees with the zero-normalized supremum, including an empty index. -/ -theorem norm_eq_familySize {I : Type*} [Fintype I] (f : I → ℍ) : - ‖f‖ = familySize (fun i => ‖f i‖) := by - have hb : BddAbove (Set.range (fun i => ‖f i‖)) := Set.finite_range _ |>.bddAbove - apply le_antisymm - · exact (pi_norm_le_iff_of_nonneg (familySize_nonneg _ hb)).mpr - (fun i => le_familySize _ hb i) - · exact familySize_le _ (norm_nonneg _) (fun i => norm_le_pi_norm f i) - -/-- Reindexing does not change the actual supremum norm of a finite word family. -/ -theorem norm_comp_equiv {I J : Type*} [Fintype I] [Fintype J] (e : I ≃ J) (f : J → ℍ) : - ‖fun i => f (e i)‖ = ‖f‖ := by - apply le_antisymm - · exact (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr fun i => norm_le_pi_norm f (e i) - · exact (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr fun j => by - simpa using norm_le_pi_norm (fun i => f (e i)) (e.symm j) - -end FiniteQuotientEquations -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion ContDiff -open Set -section FiniteQuotientSolvability -variable {F S T R Z : Type*} [Group F] [Fintype F] [Fintype Z] - -/-- The full finite quotient step. All coefficients on the prescribed alphabet -are retained exactly, not merely up to a small perturbation. -/ -theorem finite_quotient_comparison_solvable - (v : S ⊕ T → F) (r : Z ⊕ R → FreeGroup (S ⊕ T)) (z : Z → FreeGroup S) - (A : Finset R) (B : Finset R) (hAB : A ⊆ B) - (Q : BasedChains F R ≃ₗ[ℤ] BasedChains F T) - (hQ : Q.toLinearMap = extraRelatorMap v (fun i => r (.inr i))) - (C δ η : ℝ) (hC : 0 ≤ C) (hδ : 0 < δ) (hη : 0 < η) (hη1 : η < 1) - (hc₁ : C*(δ+η) < 1/2) (hc₂ : C*η < δ/2) - (hcomp : ∀ (b : F → S ⊕ T → SU2) (h : ℝ), 0 ≤ h → - (∀ g s, ‖(b g (.inl s) : ℍ)-1‖ ≤ η) → - (∀ i ∈ A, ∀ g, pathProduct (H := SU2) v b (r (.inr i)) g = 1) → - (∀ i g, ‖(pathProduct (H := SU2) v b (r (.inl i)) g : ℍ)-1‖ ≤ h) → - ∀ i g, - ‖(pathProduct (H := SU2) v b (FreeGroup.map Sum.inl (z i)) g : ℍ) - - (pathProduct (H := SU2) v b (r (.inl i)) g : ℍ)‖ ≤ C*(η+h)*h ∧ - ‖(pathProduct (H := SU2) v b (FreeGroup.map Sum.inl (z i)) g : ℍ)-1‖ ≤ C*η) - (a : F → S → SU2) (ha : ∀ g s, ‖(a g s : ℍ)-1‖ < η) : - ∃ b : F → T → SU2, - (∀ i ∈ B, ∀ g, pathProduct (H := SU2) v (mergeLabels a b) (r (.inr i)) g = 1) ∧ - (∀ i g, ‖(pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ)-1‖ < δ) := by - classical - let I := F × ↥B - let J := F × Z - let eI : Fin (Fintype.card I) ≃ I := (Fintype.equivFin I).symm - let eJ : Fin (Fintype.card J) ≃ J := (Fintype.equivFin J).symm - let j : Fin (Fintype.card I) ↪ F × R := - ⟨fun k => ((eI k).1, (eI k).2.val), fun k l h => by - apply eI.injective - exact Prod.ext (congrArg (fun p : F × R => p.1) h) (Subtype.ext (congrArg (fun p : F × R => p.2) h))⟩ - obtain ⟨e,he,hd⟩ := finite_extra_boundary_minor v (fun i => r (.inr i)) Q hQ - (MonoidHom.id F) j - let σ : Fin (Fintype.card I) ↪ F × (S ⊕ T) := - ⟨fun k => ((e k).1, .inr (e k).2), fun k l h => - he (Prod.ext (congrArg (fun p : F × (S ⊕ T) => p.1) h) - (Sum.inr_injective (congrArg (fun p : F × (S ⊕ T) => p.2) h)))⟩ - let w : Fin (Fintype.card I) → FreeGroup (F × (S ⊕ T)) := - fun k => pathSpelling v (r (.inr (eI k).2.val)) (eI k).1 - let ρ : Fin (Fintype.card J) → FreeGroup (F × (S ⊕ T)) := - fun k => pathSpelling v (r (.inl (eJ k).2)) (eJ k).1 - have hdet : Matrix.det (fun i k => wordExponents (w i) (σ k)) ≠ 0 := by - simp only [projectExtraChains_apply, MonoidHom.id_apply] at hd - simp only [w, pathSpelling_exponent] - exact hd - let base : F × (S ⊕ T) → SU2 := fun p => Sum.elim (a p.1) (fun _ => 1) p.2 - have hbase (p) : ‖(base p : ℍ)-1‖ < 1 := by - rcases p with ⟨g,s | t⟩ - · exact (ha g s).trans hη1 - · simp [base] - let arc : ℝ → F × (S ⊕ T) → SU2 := fun t p => smallQuaternionArc (base p) t - let L (t : ℝ) (x : Fin (Fintype.card I) → SU2) : F → S ⊕ T → SU2 := - fun g s => selectedLabel σ (arc t) x (g,s) - have hleft (g : F) (s : S) (k : Fin (Fintype.card I)) : σ k ≠ (g,.inl s) := by - change ((e k).1, Sum.inr (e k).2) ≠ (g,Sum.inl s) - simp - have hsmall (t : ℝ) (x : Fin (Fintype.card I) → SU2) (g : F) (s : S) : - ‖(L t x g (.inl s) : ℍ)-1‖ ≤ η := by - dsimp only [L] - rw [selectedLabel_other σ _ x _ (hleft g s)] - exact (smallQuaternionArc_distance (base (g,.inl s)) (hbase _) t).trans (ha g s).le - have hword (b : F × (S ⊕ T) → SU2) (r : FreeGroup (S ⊕ T)) (g : F) : - FreeGroup.lift b (pathSpelling v r g) = pathProduct (H := SU2) v (fun g s => b (g,s)) r g := - pathSpelling_eval v (fun g s => b (g,s)) r g - obtain ⟨b,hfixed,hw,hρ⟩ := selected_word_sublevel_solvable σ w ρ arc - (fun p => smallQuaternionArc_smooth _ (hbase p)) (by intro p; simp [arc]) - hdet δ hδ (fun t _ x hx => by - let f : J → ℍ := fun p => (pathProduct (H := SU2) v (L t x) (r (.inl p.2)) p.1 : ℍ)-1 - have hordinary (i : R) (hi : i ∈ B) (g : F) : - pathProduct (H := SU2) v (L t x) (r (.inr i)) g = 1 := by - have h := hx (eI.symm (g,⟨i,hi⟩)) - simpa only [w, Equiv.apply_symm_apply, hword] using h - have hb (i : Z) (g : F) : ‖(pathProduct (H := SU2) v (L t x) (r (.inl i)) g : ℍ)-1‖ ≤ - C*η + C*(‖f‖+η)*‖f‖ := by - obtain ⟨h₁,h₂⟩ := hcomp (L t x) ‖f‖ (norm_nonneg _) (hsmall t x) - (fun i hi => hordinary i (hAB hi)) - (fun i g => norm_le_pi_norm f (g,i)) i g - have htri := norm_sub_le_norm_sub_add_norm_sub (pathProduct (H := SU2) v (L t x) (r (.inl i)) g : ℍ) - (pathProduct (H := SU2) v (L t x) (FreeGroup.map Sum.inl (z i)) g : ℍ) 1 - calc - _ ≤ C*(η+‖f‖)*‖f‖ + C*η := htri.trans (add_le_add ((norm_sub_rev _ _).trans_le h₁) h₂) - _ = _ := by ring - have hne : ‖f‖ ≠ δ := by - rw [norm_eq_familySize] - exact familySize_ne_threshold (fun p : J => ‖f p‖) (Set.finite_range _ |>.bddAbove) - C δ η η hδ hC hη.le hη.le le_rfl hc₁ hc₂ (fun p => by - simpa only [← norm_eq_familySize] using hb p.2 p.1) - have heq : ‖(fun k => (FreeGroup.lift (selectedLabel σ (arc t) x) (ρ k) : ℍ))-1‖ = ‖f‖ := by - change ‖fun k => (FreeGroup.lift (selectedLabel σ (arc t) x) (ρ k) : ℍ)-1‖ = _ - simpa only [ρ, hword, f, L] using norm_comp_equiv eJ f - intro h - exact hne (heq.symm.trans h)) - let b' : F → T → SU2 := fun g t => b (g,.inr t) - have heval : (fun g s => b (g,s)) = mergeLabels a b' := by - funext g s - rcases s with s | t - · rw [hfixed _ (hleft g s)] - simp [arc, base, mergeLabels] - · rfl - refine ⟨b',?_,?_⟩ - · intro i hi g - have h := hw (eI.symm (g,⟨i,hi⟩)) - simpa only [w, Equiv.apply_symm_apply, hword, heval] using h - · intro i g - have h := (norm_le_pi_norm - ((fun k => (FreeGroup.lift b (ρ k) : ℍ))-1) (eJ.symm (g,i))).trans_lt hρ - simpa only [ρ, Pi.sub_apply, Pi.one_apply, Equiv.apply_symm_apply, hword, heval] using h - -end FiniteQuotientSolvability -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion -section AlignedComparison -variable {Γ : Type u} {S T Z R : Type*} [Group Γ] [Group.ResiduallyFinite Γ] [Fintype Z] - -omit [Group.ResiduallyFinite Γ] in -theorem wordValue_map_alphabet {E : Type*} (v : S → Γ) (f : E → S) (w : FreeGroup E) : - wordValue v (FreeGroup.map f w) = wordValue (fun e => v (f e)) w := by - have he : (wordValue v).comp (FreeGroup.map f) = wordValue (fun e => v (f e)) := by - apply FreeGroup.ext_hom - intro e - simp [wordValue] - exact congrArg (fun h : FreeGroup E →* Γ => h w) he - -/-- The algebraic core of the manuscript's presentation comparison, for an -actual aligned presentation. The passage from arbitrary ordinary CW classifying -spaces to this presentation is a separate topological obligation. -/ -theorem aligned_presentation_small_transport - (v : S ⊕ T → Γ) (r : Z ⊕ R → FreeGroup (S ⊕ T)) (z : Z → FreeGroup S) - (hvT : ∀ t, v (.inr t) = 1) - (hr : ∀ i, wordValue v (r i) = 1) - (hz : ∀ i, wordValue (fun s => v (.inl s)) (z i) = 1) - (hp : (wordValue v).ker = Subgroup.normalClosure (Set.range r)) - (hinj : Function.Injective (relatorChainMap v r)) - (hchain : ∀ i, pathChain v (FreeGroup.map Sum.inl (z i)) 1 = pathChain v (r (.inl i)) 1) - (Q : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ T) - (hQ : Q.toLinearMap = extraRelatorMap v (fun i => r (.inr i))) : - ∃ η : ℝ, 0 < η ∧ ∀ a : Γ → S → SU2, - (∀ g s, ‖(a g s : ℍ)-1‖ < η) → - (∀ i g, pathProduct (fun s => v (.inl s)) a (z i) g = 1) → - ∀ w : FreeGroup S, wordValue (fun s => v (.inl s)) w = 1 → ∀ g, - pathProduct (fun s => v (.inl s)) a w g = 1 := by - classical - have hzn (i) : FreeGroup.map Sum.inl (z i) ∈ Subgroup.normalClosure (Set.range r) := by - rw [← hp] - change wordValue v (FreeGroup.map Sum.inl (z i)) = 1 - rw [wordValue_map_alphabet, hz] - have htn (t) : FreeGroup.of (.inr t) ∈ Subgroup.normalClosure (Set.range r) := by - rw [← hp] - change wordValue v (FreeGroup.of (.inr t)) = 1 - simpa [wordValue] using hvT t - choose lz hlz using fun i => exists_normalExpression r (hzn i) - choose lt hlt using fun t => exists_normalExpression r (htn t) - have hc (i) : ((lz i).map (fun f => normalFactorCount v f 1)).sum = - Finsupp.single (1,Sum.inl i) 1 := - exact_translated_relator_counts v r hr hinj _ (.inl i) (hchain i) (lz i) (hlz i) - obtain ⟨A,C,hC,hcomp⟩ := finite_normal_comparison v r hr z lz lt hlz hlt hc - obtain ⟨δ,η,hδ,hδ1,hη,hη1,hc₁,hc₂⟩ := small_thresholds_exist C hC - refine ⟨η,hη,?_⟩ - intro a ha haz - let W : Γ × (Z ⊕ R) → FreeGroup (S ⊕ T) := fun p => r p.2 - let K : Γ × (Z ⊕ R) → Set SU2 := fun p => match p.2 with - | .inl _ => {b | ‖(b : ℍ)-1‖ ≤ δ} - | .inr _ => {1} - have hK (p) : IsClosed (K p) := by - rcases p with ⟨g,i | i⟩ - · exact isClosed_le ((continuous_subtype_val.sub continuous_const).norm) continuous_const - · exact isClosed_singleton - obtain ⟨b,hb⟩ := compact_labeling_from_finite_quotients v a W Prod.fst K hK - (fun b : SU2 => ‖(b : ℍ)-1‖ < η) (by simpa using hη) ha (by - intro N J aF haF - let : Fintype (Γ ⧸ N.toSubgroup) := Fintype.ofFinite _ - let q := QuotientGroup.mk' N.toSubgroup - let B := A ∪ (J.image Prod.snd).toRight - let QF := quotientChainEquiv q Q (by rw [hQ]; exact extraRelatorMap_equivariant _ _) - have hQF : QF.toLinearMap = extraRelatorMap (fun s => q (v s)) (fun i => r (.inr i)) := by - change quotientMatrix q Q.toLinearMap = _ - rw [hQ, extraRelatorMap_quotientMatrix] - obtain ⟨bF,hord,hdis⟩ := finite_quotient_comparison_solvable (fun s => q (v s)) r z A B - (Finset.subset_union_left) QF hQF C δ η (by linarith) hδ hη hη1 hc₁ hc₂ - (fun b h hh hsmall hord hdist => hcomp q b η h hη.le hh hsmall hord hdist) aF haF - refine ⟨bF,?_⟩ - rintro ⟨g,i | i⟩ hi d - · exact (hdis i d).le - · exact hord i (Finset.mem_union_right _ (Finset.mem_toRight.mpr - (Finset.mem_image.mpr ⟨(g,.inr i),hi,rfl⟩))) d) - have hord (i : R) (g : Γ) : pathProduct v (mergeLabels a b) (r (.inr i)) g = 1 := - hb (g,.inr i) - have hdis (i : Z) (g : Γ) : ‖(pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ)-1‖ ≤ δ := - hb (g,.inl i) - let f : Z × Γ → ℝ := fun p => ‖(pathProduct (H := SU2) v (mergeLabels a b) (r (.inl p.1)) p.2 : ℍ)-1‖ - have hbounded : BddAbove (Set.range f) := ⟨δ, by rintro _ ⟨⟨i,g⟩,rfl⟩; exact hdis i g⟩ - have hzero : ∀ p, f p = 0 := familySize_contraction f (fun _ => norm_nonneg _) - δ C η hδ.le (by linarith) hη.le (fun p => hdis p.1 p.2) (by linarith) (by - rintro ⟨i,g⟩ - have h := (hcomp (MonoidHom.id Γ) (mergeLabels a b) η (familySize f) hη.le - (familySize_nonneg f hbounded) (fun g s => (ha g s).le) (fun i _ => hord i) - (fun i g => le_familySize f hbounded (i,g)) i g).1 - have hz' : pathProduct v (mergeLabels a b) (FreeGroup.map Sum.inl (z i)) g = 1 := by - rw [pathProduct_map_alphabet] - exact haz i g - change ‖(pathProduct (H := SU2) v (mergeLabels a b) (FreeGroup.map Sum.inl (z i)) g : ℍ)- - (pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ)‖ ≤ _ at h - rw [hz'] at h - change ‖(1 : ℍ) - (pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ)‖ ≤ - C * (η + familySize f) * familySize f at h - change ‖(pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ) - 1‖ ≤ - C * (familySize f + η) * familySize f - rw [norm_sub_rev] - rwa [add_comm η (familySize f)] at h) - have hdist (i : Z) (g : Γ) : pathProduct v (mergeLabels a b) (r (.inl i)) g = 1 := by - apply Subtype.ext - exact sub_eq_zero.mp (norm_eq_zero.mp (hzero (i,g))) - intro w hw g - have hw' : wordValue v (FreeGroup.map Sum.inl w) = 1 := by - rw [wordValue_map_alphabet, hw] - have h := pathProduct_trivial_of_relators v (mergeLabels a b) (Set.range r) - (by rintro _ ⟨i,rfl⟩; exact hr i) hp - (by rintro _ ⟨i | i,rfl⟩ g; exact hdist i g; exact hord i g) - (FreeGroup.map Sum.inl w) hw' g - simpa only [pathProduct_map_alphabet, mergeLabels, Sum.elim_inl, Function.comp_def] using h - -end AlignedComparison -end EilenbergGanea - -end - -end OAI +import OAI.Topology.EilenbergGanea.SmallHolonomy +import Mathlib.Topology.Algebra.Star.Unitary + +namespace OAI + +noncomputable section + +universe u + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +namespace EilenbergGanea +section NaturalPath +variable {Γ S H K : Type*} [Group Γ] [Group H] [Group K] + +theorem pathProduct_map (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) + (g : Γ) (f : H →* K) : + pathProduct v (fun p s => f (a p s)) w g = f (pathProduct v a w g) := by + induction w using FreeGroup.induction_on generalizing g with + | one => simp + | of s => simp + | inv_of s => simp only [pathProduct_inv, pathProduct_of, map_inv] + | mul w z hw hz => simp only [pathProduct_mul, hw, hz, map_mul] + +/-- The literal edge word traversed by a generator word. Free reduction of +this word is harmless for all nonabelian edge labelings. -/ +def pathSpelling (v : S → Γ) (w : FreeGroup S) (g : Γ) : FreeGroup (Γ × S) := + pathProduct v (fun p s => FreeGroup.of (p,s)) w g + +theorem pathSpelling_eval (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) (g : Γ) : + FreeGroup.lift (fun i : Γ × S => a i.1 i.2) (pathSpelling v w g) = + pathProduct v a w g := by + symm + simpa only [FreeGroup.lift_apply_of, pathSpelling] using + pathProduct_map v (fun p s => FreeGroup.of (p,s)) w g + (FreeGroup.lift (fun i : Γ × S => a i.1 i.2)) + +/-- Abelianizing the literal edge word gives exactly the integral edge chain. -/ +theorem pathSpelling_abelianization (v : S → Γ) (w : FreeGroup S) (g : Γ) : + FreeGroup.lift (fun i : Γ × S => Multiplicative.ofAdd (Finsupp.single i (1 : ℤ))) + (pathSpelling v w g) = Multiplicative.ofAdd (pathChain v w g) := by + exact pathSpelling_eval v (fun p s => Multiplicative.ofAdd (Finsupp.single (p,s) (1 : ℤ))) w g + +/-- Naturality in the target additive free module; used when projecting to +extra generators and when tensoring with a finite quotient. -/ +theorem pathChain_pairing {M : Type*} [AddCommGroup M] + (v : S → Γ) (b : Γ × S → M) (w : FreeGroup S) (g : Γ) : + Finsupp.linearCombination ℤ b (pathChain v w g) = + (pathProduct v (fun p s => Multiplicative.ofAdd (b (p,s))) w g).toAdd := by + induction w using FreeGroup.induction_on generalizing g with + | one => simp + | of s => simp [pathChain_of, Finsupp.linearCombination_single, pathProduct_of] + | inv_of s hs => + simpa only [pathChain_inv, map_neg, pathProduct_inv, toAdd_inv] using congrArg Neg.neg (hs _) + | mul w z hw hz => simp only [pathChain_mul, map_add, pathProduct_mul, + toAdd_mul, hw, hz] + +end NaturalPath +end EilenbergGanea + +namespace EilenbergGanea +section NormalExpressions +variable {S R : Type*} + +def inverseNormalFactor (f : NormalFactor S R) : NormalFactor S R := + (f.1, f.2.1, !f.2.2) + +theorem normalFactor_inverse (r : R → FreeGroup S) (f : NormalFactor S R) : + normalFactorWord r (inverseNormalFactor f) = (normalFactorWord r f)⁻¹ := by + rcases f with ⟨u, i, ε⟩ + cases ε <;> simp [normalFactorWord, inverseNormalFactor, mul_assoc] + +/-- Every element of a normal closure admits one finite product of conjugates, +including for arbitrary (possibly uncountable) index types. -/ +theorem exists_normalExpression (r : R → FreeGroup S) {w : FreeGroup S} + (hw : w ∈ Subgroup.normalClosure (Set.range r)) : + ∃ l : List (NormalFactor S R), w = (l.map (normalFactorWord r)).prod := by + change w ∈ Subgroup.closure (Group.conjugatesOfSet (Set.range r)) at hw + induction hw using Subgroup.closure_induction with + | mem x hx => + obtain ⟨y, ⟨i, rfl⟩, hy⟩ := Group.mem_conjugatesOfSet_iff.mp hx + obtain ⟨u, hu⟩ := isConj_iff.mp hy + refine ⟨[(u,i,true)], ?_⟩ + simpa [normalFactorWord] using hu.symm + | one => exact ⟨[], by simp⟩ + | mul x y hx hy ihx ihy => + obtain ⟨l, rfl⟩ := ihx + obtain ⟨k, rfl⟩ := ihy + exact ⟨l ++ k, by simp⟩ + | inv x hx ih => + obtain ⟨l, rfl⟩ := ih + refine ⟨(l.map inverseNormalFactor).reverse, ?_⟩ + simp only [List.map_reverse, List.prod_inv_reverse, List.map_map] + congr 2 + apply List.map_congr_left + intro f _ + exact (normalFactor_inverse r f).symm + +end NormalExpressions +end EilenbergGanea + +namespace EilenbergGanea +section WordNorm +open scoped Quaternion +variable {Γ S : Type*} [Group Γ] + +theorem su2_mul_distance (a b : SU2) : + ‖((a*b : SU2) : ℍ) - 1‖ ≤ ‖(a : ℍ) - 1‖ + ‖(b : ℍ) - 1‖ := by + have he : ((a*b : SU2) : ℍ) - 1 = ((a : ℍ) - 1) * (b : ℍ) + ((b : ℍ) - 1) := by + change (a : ℍ) * (b : ℍ) - 1 = _ + noncomm_ring + rw [he] + exact (norm_add_le _ _).trans_eq (by rw [norm_mul, su2_norm, mul_one]) + +/-- A finite control set for a word, uniform over all base vertices and all +labelings. Both the set and the coefficient are chosen before any quotient. -/ +theorem finite_word_control (v : S → Γ) (w : FreeGroup S) : + ∃ (P : Finset S) (n : ℕ), ∀ (ε : ℝ), 0 ≤ ε → ∀ (a : Γ → S → SU2), + (∀ g, ∀ s ∈ P, ‖(a g s : ℍ) - 1‖ ≤ ε) → + ∀ g, ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ ≤ n * ε := by + classical + induction w using FreeGroup.induction_on with + | one => exact ⟨∅, 0, fun ε _ a _ g => by simp⟩ + | of s => + refine ⟨{s}, 1, fun ε _ a ha g => ?_⟩ + simpa using ha g s (by simp) + | inv_of s ih => + obtain ⟨P, n, hn⟩ := ih + refine ⟨P, n, fun ε hε a ha g => ?_⟩ + rw [pathProduct_inv, su2_inverse_distance] + exact hn ε hε a ha _ + | mul w z hw hz => + obtain ⟨P, n, hn⟩ := hw + obtain ⟨Q, m, hm⟩ := hz + refine ⟨P ∪ Q, n+m, fun ε hε a ha g => ?_⟩ + rw [pathProduct_mul] + calc + _ ≤ ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ + + ‖((pathProduct v a z (g * wordValue v w) : SU2) : ℍ) - 1‖ := su2_mul_distance _ _ + _ ≤ n * ε + m * ε := add_le_add + (hn ε hε a (fun p s hs => ha p s (Finset.mem_union_left _ hs)) _) + (hm ε hε a (fun p s hs => ha p s (Finset.mem_union_right _ hs)) _) + _ = _ := by push_cast; ring + +/-- A finite control set for a word, uniform over all base vertices and all +labelings. Both the set and the coefficient are chosen before any quotient. -/ +theorem finite_word_control_universal (w : FreeGroup S) : + ∃ (P : Finset S) (n : ℕ), ∀ {D : Type u} [Group D] (v : S → D) (ε : ℝ), 0 ≤ ε → ∀ (a : D → S → SU2), + (∀ g, ∀ s ∈ P, ‖(a g s : ℍ) - 1‖ ≤ ε) → + ∀ g, ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ ≤ n * ε := by + classical + induction w using FreeGroup.induction_on with + | one => exact ⟨∅, 0, fun v ε _ a _ g => by simp⟩ + | of s => + refine ⟨{s}, 1, fun v ε _ a ha g => ?_⟩ + simpa using ha g s (by simp) + | inv_of s ih => + obtain ⟨P, n, hn⟩ := ih + refine ⟨P, n, fun v ε hε a ha g => ?_⟩ + rw [pathProduct_inv, su2_inverse_distance] + exact hn v ε hε a ha _ + | mul w z hw hz => + obtain ⟨P, n, hn⟩ := hw + obtain ⟨Q, m, hm⟩ := hz + refine ⟨P ∪ Q, n+m, fun v ε hε a ha g => ?_⟩ + rw [pathProduct_mul] + calc + _ ≤ ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ + + ‖((pathProduct v a z (g * wordValue v w) : SU2) : ℍ) - 1‖ := su2_mul_distance _ _ + _ ≤ n * ε + m * ε := add_le_add + (hn v ε hε a (fun p s hs => ha p s (Finset.mem_union_left _ hs)) _) + (hm v ε hε a (fun p s hs => ha p s (Finset.mem_union_right _ hs)) _) + _ = _ := by push_cast; ring + +end WordNorm +end EilenbergGanea + +namespace EilenbergGanea +section EvaluatedNormalExpression +open scoped Quaternion +variable {Γ D S R : Type*} [Group Γ] [Group D] + +theorem wordValue_quotient (v : S → Γ) (q : Γ →* D) (w : FreeGroup S) : + wordValue (fun s => q (v s)) w = q (wordValue v w) := by + have he : wordValue (fun s => q (v s)) = q.comp (wordValue v) := by + apply FreeGroup.ext_hom + intro s + simp [wordValue] + exact congrArg (fun f : FreeGroup S →* D => f w) he + +def evaluatedNormalFactor (v : S → Γ) (a : Γ → S → SU2) + (f : NormalFactor S R) (g : Γ) : RelatorFactor (Γ × R) := + (pathProduct v a f.1 g, (g * wordValue v f.1, f.2.1), f.2.2) + +theorem evaluatedNormalFactor_value (v : S → Γ) (a : Γ → S → SU2) + (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) + (f : NormalFactor S R) (g : Γ) : + relatorFactorValue (fun i : Γ × R => pathProduct v a (r i.2) i.1) + (evaluatedNormalFactor v a f g) = pathProduct v a (normalFactorWord r f) g := by + rcases f with ⟨u, i, σ⟩ + cases σ <;> + simp [relatorFactorValue, evaluatedNormalFactor, signedUnit, normalFactorWord, + pathProduct_conjugate_loop, hr, pathProduct_inv] + +theorem pathProduct_normalProduct (v : S → Γ) (a : Γ → S → SU2) + (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) + (l : List (NormalFactor S R)) (g : Γ) : + ((l.map (fun f => evaluatedNormalFactor v a f g)).map + (relatorFactorValue (fun i : Γ × R => pathProduct v a (r i.2) i.1))).prod = + pathProduct v a (l.map (normalFactorWord r)).prod g := by + induction l with + | nil => simp + | cons f l ih => + simp only [List.map_cons, List.prod_cons, pathProduct_mul, + normalFactor_value v r hr, mul_one, evaluatedNormalFactor_value v a r hr, ih] + +/-- Exact translated signed counts are preserved upon passage to every quotient. +No flatness, finiteness, or injectivity of the quotient is used. -/ +theorem quotient_evaluated_counts (v : S → Γ) (q : Γ →* D) + (a : D → S → SU2) (l : List (NormalFactor S R)) (ρ : R) + (hc : (l.map (fun f => normalFactorCount v f 1)).sum = Finsupp.single (1,ρ) 1) + (g : D) : + relatorSignedCounts (l.map (fun f => evaluatedNormalFactor (fun s => q (v s)) a f g)) = + Finsupp.single (g,ρ) 1 := by + let T : ((Γ × R) →₀ ℤ) →ₗ[ℤ] ((D × R) →₀ ℤ) := + Finsupp.lmapDomain ℤ ℤ (fun i => (g * q i.1, i.2)) + have hs : relatorSignedCounts + (l.map (fun f => evaluatedNormalFactor (fun s => q (v s)) a f g)) = + T (l.map (fun f => normalFactorCount v f 1)).sum := by + simp only [relatorSignedCounts, List.map_map, map_list_sum] + congr 1 + apply List.map_congr_left + intro f _ + simp [T, evaluatedNormalFactor, normalFactorCount, wordValue_quotient] + rw [hs, hc] + simp [T] + +/-- The actual relator expression, evaluated by arbitrary edge labels on a +quotient graph, has the uniform quadratic error predicted by its exact chain +counts. -/ +theorem normalExpression_quadratic (v : S → Γ) (q : Γ →* D) + (a : D → S → SU2) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (z : FreeGroup S) + (l : List (NormalFactor S R)) (he : z = (l.map (normalFactorWord r)).prod) + (ρ : R) (hc : (l.map (fun f => normalFactorCount v f 1)).sum = + Finsupp.single (1,ρ) 1) + (h ε K : ℝ) (hh : 0 ≤ h) (hε : 0 ≤ ε) (hK : 0 ≤ K) + (hb : ∀ f ∈ l, ∀ g, ‖((pathProduct (fun s => q (v s)) a (r f.2.1) g : SU2) : ℍ) - 1‖ ≤ h) + (ha : ∀ f ∈ l, ∀ g, ‖((pathProduct (fun s => q (v s)) a f.1 g : SU2) : ℍ) - 1‖ ≤ K * (ε+h)) + (g : D) : + ‖((pathProduct (fun s => q (v s)) a z g : SU2) : ℍ) - + ((pathProduct (fun s => q (v s)) a (r ρ) g : SU2) : ℍ)‖ ≤ + ((l.length : ℝ)^2 + l.length + 2*l.length*K) * (ε+h)*h := by + let v' := fun s => q (v s) + let L := l.map (fun f => evaluatedNormalFactor v' a f g) + let x := fun i : D × R => pathProduct v' a (r i.2) i.1 + have hp := relator_product_quadratic L x (g,ρ) + (quotient_evaluated_counts v q a l ρ hc g) h ε K hh hε hK + (by intro f hf; obtain ⟨b,hb',rfl⟩ := List.mem_map.mp hf; exact hb b hb' _) + (by intro f hf; obtain ⟨b,hb',rfl⟩ := List.mem_map.mp hf; exact ha b hb' _) + have hprod : (L.map (fun f => (relatorFactorValue x f : ℍ))).prod = + ((pathProduct v' a z g : SU2) : ℍ) := by + have hz := pathProduct_normalProduct v' a r + (fun i => by simp [v', wordValue_quotient, hr]) l g + rw [← he] at hz + have hco (ll : List SU2) : ((ll.prod : SU2) : ℍ) = (ll.map (fun b : SU2 => (b : ℍ))).prod := by + induction ll with + | nil => rfl + | cons b ll ih => simp only [List.prod_cons, Submonoid.coe_mul, List.map_cons, ih] + have hz' := congrArg (fun x : SU2 => (x : ℍ)) hz + rw [hco] at hz' + simpa only [L, x, List.map_map, Function.comp_def] using hz' + simpa only [hprod, L, List.length_map, x, v'] using hp + +end EvaluatedNormalExpression +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion +section NormalProductSize +variable {Γ S R : Type*} [Group Γ] + + theorem normalFactor_product_distance (v : S → Γ) (a : Γ → S → SU2) + (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) + (f : NormalFactor S R) (g : Γ) : + ‖((pathProduct v a (normalFactorWord r f) g : SU2) : ℍ) - 1‖ = + ‖((pathProduct v a (r f.2.1) (g * wordValue v f.1) : SU2) : ℍ) - 1‖ := by + rw [← evaluatedNormalFactor_value v a r hr] + exact (su2_conjugation_distance _ _).trans (signedUnit_distance _ _) + +/-- Unlike the quadratic estimate, this linear bound needs no information +whatever about the conjugating words. It controls the finitely many auxiliary +loop labels before any bound on the conjugators is obtained. -/ +theorem normalProduct_distance (v : S → Γ) (a : Γ → S → SU2) + (r : R → FreeGroup S) (hr : ∀ i, wordValue v (r i) = 1) + (l : List (NormalFactor S R)) (h : ℝ) + (hb : ∀ f ∈ l, ∀ g, ‖((pathProduct v a (r f.2.1) g : SU2) : ℍ) - 1‖ ≤ h) + (g : Γ) : + ‖((pathProduct v a (l.map (normalFactorWord r)).prod g : SU2) : ℍ) - 1‖ ≤ l.length * h := by + induction l with + | nil => simp + | cons f l ih => + simp only [List.map_cons, List.prod_cons, pathProduct_mul, normalFactor_value v r hr, mul_one] + calc + _ ≤ ‖((pathProduct v a (normalFactorWord r f) g : SU2) : ℍ) - 1‖ + + ‖((pathProduct v a (l.map (normalFactorWord r)).prod g : SU2) : ℍ) - 1‖ := su2_mul_distance _ _ + _ ≤ h + l.length * h := add_le_add + (by rw [normalFactor_product_distance v a r hr]; exact hb f (by simp) _) + (ih (fun b hb' => hb b (by simp [hb']))) + _ = _ := by simp only [List.length_cons, Nat.cast_add, Nat.cast_one]; ring + +end NormalProductSize +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion +section FiniteControl +variable {S T H : Type*} [Group H] + + theorem pathProduct_map_alphabet {Γ : Type*} [Group Γ] + (f : S → T) (v : T → Γ) (a : Γ → T → H) (w : FreeGroup S) (g : Γ) : + pathProduct v a (FreeGroup.map f w) g = + pathProduct (v ∘ f) (fun p s => a p (f s)) w g := by + have he : (labelLift v a).comp (FreeGroup.map f) = + labelLift (v ∘ f) (fun p s => a p (f s)) := by + apply FreeGroup.ext_hom + intro s + simp [labelLift] + exact congrArg (fun l : FreeGroup S →* ((Γ → H) ⋊[functionShift Γ H] Γ) => (l w).left g) he + + theorem finite_word_family_control (W : Finset (FreeGroup S)) : + ∃ (P : Finset S) (n : ℕ), ∀ w ∈ W, + ∀ {D : Type u} [Group D] (v : S → D) (ε : ℝ), 0 ≤ ε → ∀ (a : D → S → SU2), + (∀ g, ∀ s ∈ P, ‖(a g s : ℍ) - 1‖ ≤ ε) → + ∀ g, ‖((pathProduct v a w g : SU2) : ℍ) - 1‖ ≤ n * ε := by + classical + induction W using Finset.induction_on with + | empty => exact ⟨∅,0, by simp⟩ + | @insert w W _ ih => + obtain ⟨P,n,hn⟩ := finite_word_control_universal w + obtain ⟨Q,m,hm⟩ := ih + refine ⟨P ∪ Q, n+m, ?_⟩ + intro z hz D _ v ε hε a ha g + rcases Finset.mem_insert.mp hz with rfl | hz + · exact (hn v ε hε a (fun p s hs => ha p s (Finset.mem_union_left _ hs)) g).trans + (mul_le_mul_of_nonneg_right (by exact_mod_cast Nat.le_add_right n m) hε) + · exact (hm z hz v ε hε a (fun p s hs => ha p s (Finset.mem_union_right _ hs)) g).trans + (mul_le_mul_of_nonneg_right (by exact_mod_cast Nat.le_add_left m n) hε) + +end FiniteControl +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion BigOperators +section UniformComparison +variable {Γ S T Z R : Type*} [Group Γ] [Fintype Z] + +/-- All constants and all ordinary relators needed by the quadratic estimate +are chosen before the group quotient and before the edge labels. The normal +expressions are literal finite words, while the ambient alphabets may have any +cardinality. -/ +theorem finite_normal_comparison + (v : S ⊕ T → Γ) (r : Z ⊕ R → FreeGroup (S ⊕ T)) + (hr : ∀ i, wordValue v (r i) = 1) (z : Z → FreeGroup S) + (lz : Z → List (NormalFactor (S ⊕ T) (Z ⊕ R))) + (lt : T → List (NormalFactor (S ⊕ T) (Z ⊕ R))) + (hz : ∀ i, FreeGroup.map Sum.inl (z i) = ((lz i).map (normalFactorWord r)).prod) + (ht : ∀ t, FreeGroup.of (Sum.inr t) = ((lt t).map (normalFactorWord r)).prod) + (hc : ∀ i, ((lz i).map (fun f => normalFactorCount v f 1)).sum = + Finsupp.single (1,Sum.inl i) 1) : + ∃ (A : Finset R) (C : ℝ), 1 ≤ C ∧ + ∀ {F : Type u} [Group F] (q : Γ →* F) (a : F → S ⊕ T → SU2) + (ε h : ℝ), 0 ≤ ε → 0 ≤ h → + (∀ g s, ‖(a g (.inl s) : ℍ) - 1‖ ≤ ε) → + (∀ i ∈ A, ∀ g, pathProduct (fun s => q (v s)) a (r (.inr i)) g = 1) → + (∀ i g, ‖((pathProduct (fun s => q (v s)) a (r (.inl i)) g : SU2) : ℍ) - 1‖ ≤ h) → + ∀ i g, + ‖((pathProduct (fun s => q (v s)) a (FreeGroup.map Sum.inl (z i)) g : SU2) : ℍ) - + ((pathProduct (fun s => q (v s)) a (r (.inl i)) g : SU2) : ℍ)‖ ≤ C * (ε+h)*h ∧ + ‖((pathProduct (fun s => q (v s)) a (FreeGroup.map Sum.inl (z i)) g : SU2) : ℍ) - 1‖ ≤ C*ε := by + classical + let W : Finset (FreeGroup (S ⊕ T)) := Finset.univ.biUnion fun i => + (lz i).toFinset.image Prod.fst + obtain ⟨P,n,hn⟩ := finite_word_family_control W + obtain ⟨_,nz,hnz⟩ := finite_word_family_control (Finset.univ.image z) + let U : Finset (Z ⊕ R) := + (Finset.univ.biUnion fun i => (lz i).toFinset.image (fun f => f.2.1)) ∪ + (P.toRight.biUnion fun t => (lt t).toFinset.image (fun f => f.2.1)) + let M : ℕ := 1 + P.toRight.sup (fun t => (lt t).length) + let N : ℕ := Finset.univ.sup (fun i => (lz i).length) + let K : ℝ := n * M + let C : ℝ := 1 + nz + (N : ℝ)^2 + N + 2*N*K + have hM : 1 ≤ M := Nat.le_add_right 1 _ + have hMr : 1 ≤ (M : ℝ) := by exact_mod_cast hM + have hK : 0 ≤ K := by dsimp [K]; positivity + have hcoef : 0 ≤ (2 : ℝ)*N*K := by positivity + have hNr : (0 : ℝ) ≤ N := Nat.cast_nonneg _ + have hnzr : (0 : ℝ) ≤ nz := Nat.cast_nonneg _ + have hC : 1 ≤ C := by dsimp [C]; nlinarith [sq_nonneg (N : ℝ)] + have hnzC : (nz : ℝ) ≤ C := by dsimp [C]; nlinarith [sq_nonneg (N : ℝ)] + have hNC : (N : ℝ)^2 + N + 2*N*K ≤ C := by dsimp [C]; linarith + refine ⟨U.toRight,C,hC,?_⟩ + intro F _ q a ε h hε hh ha hordinary hdist i g + let v' := fun s => q (v s) + have hr' (j) : wordValue v' (r j) = 1 := by simp [v', wordValue_quotient, hr] + have hused (j : Z ⊕ R) (hj : j ∈ U) (p : F) : + ‖((pathProduct v' a (r j) p : SU2) : ℍ)-1‖ ≤ h := by + rcases j with j | j + · exact hdist j p + · rw [hordinary j (Finset.mem_toRight.mpr hj) p] + simpa using hh + have hZ (j : Z) (f : NormalFactor (S ⊕ T) (Z ⊕ R)) (hf : f ∈ lz j) (p : F) : + ‖((pathProduct v' a (r f.2.1) p : SU2) : ℍ)-1‖ ≤ h := by + apply hused _ _ p + exact Finset.mem_union_left _ (Finset.mem_biUnion.mpr ⟨j,Finset.mem_univ _, + Finset.mem_image.mpr ⟨f,List.mem_toFinset.mpr hf,rfl⟩⟩) + have hT (t : T) (htP : t ∈ P.toRight) (p : F) : ‖(a p (.inr t) : ℍ)-1‖ ≤ M*h := by + have hb := normalProduct_distance v' a r hr' (lt t) h + (fun f hf p => hused _ (Finset.mem_union_right _ + (Finset.mem_biUnion.mpr ⟨t,htP,Finset.mem_image.mpr ⟨f,List.mem_toFinset.mpr hf,rfl⟩⟩)) p) p + rw [← ht t, pathProduct_of] at hb + exact hb.trans (mul_le_mul_of_nonneg_right (by + exact_mod_cast (show (lt t).length ≤ M from + (Finset.le_sup (f := fun t => (lt t).length) htP).trans (Nat.le_add_left _ 1))) hh) + have hsize : 0 ≤ (M : ℝ)*(ε+h) := mul_nonneg (Nat.cast_nonneg _) (add_nonneg hε hh) + have hP (p : F) (s : S ⊕ T) (hs : s ∈ P) : ‖(a p s : ℍ)-1‖ ≤ M*(ε+h) := by + rcases s with s | t + · calc + _ ≤ ε := ha p s + _ ≤ (M : ℝ)*ε := by nlinarith + _ ≤ (M : ℝ)*(ε+h) := mul_le_mul_of_nonneg_left (by linarith) (Nat.cast_nonneg _) + · exact (hT t (Finset.mem_toRight.mpr hs) p).trans + (mul_le_mul_of_nonneg_left (by linarith) (Nat.cast_nonneg _)) + have hconj (j : Z) (f : NormalFactor (S ⊕ T) (Z ⊕ R)) (hf : f ∈ lz j) (p : F) : + ‖((pathProduct v' a f.1 p : SU2) : ℍ)-1‖ ≤ K*(ε+h) := by + have hW : f.1 ∈ W := Finset.mem_biUnion.mpr ⟨j,Finset.mem_univ _, + Finset.mem_image.mpr ⟨f,List.mem_toFinset.mpr hf,rfl⟩⟩ + simpa only [K, mul_assoc] using hn f.1 hW v' _ hsize a hP p + constructor + · have hb := normalExpression_quadratic v q a r hr _ (lz i) (hz i) (.inl i) (hc i) + h ε K hh hε hK (hZ i) (hconj i) g + apply hb.trans + apply mul_le_mul_of_nonneg_right _ hh + apply mul_le_mul_of_nonneg_right _ (add_nonneg hε hh) + have hl : ((lz i).length : ℝ) ≤ N := by + exact_mod_cast (show (lz i).length ≤ N from + Finset.le_sup (f := fun j => (lz j).length) (Finset.mem_univ i)) + have h0 : (0 : ℝ) ≤ (lz i).length := Nat.cast_nonneg _ + have hn0 : (0 : ℝ) ≤ N := Nat.cast_nonneg _ + have hp := mul_le_mul_of_nonneg_right hl hK + nlinarith [sq_nonneg ((N : ℝ) - (lz i).length)] + · rw [pathProduct_map_alphabet] + exact (hnz (z i) (Finset.mem_image.mpr ⟨i,Finset.mem_univ _,rfl⟩) + _ ε hε (fun p s => a p (.inl s)) (fun p s _ => ha p s) g).trans + (mul_le_mul_of_nonneg_right hnzC hε) + +end UniformComparison +end EilenbergGanea + +namespace EilenbergGanea + +section QuotientChains +variable {Γ F R S T : Type*} [Group Γ] [Group F] + +abbrev BasedChains (Γ S : Type*) := (Γ × S) →₀ ℤ + +def translateChains (g : Γ) : BasedChains Γ S →ₗ[ℤ] BasedChains Γ S := + Finsupp.lmapDomain ℤ ℤ (fun i => (g*i.1, i.2)) + +def quotientChains (q : Γ →* F) : BasedChains Γ S →ₗ[ℤ] BasedChains F S := + Finsupp.lmapDomain ℤ ℤ (fun i => (q i.1, i.2)) + +@[simp] theorem translateChains_single (g h : Γ) (s : S) (n : ℤ) : + translateChains g (Finsupp.single (h,s) n) = Finsupp.single (g*h,s) n := by + simp [translateChains] + +@[simp] theorem quotientChains_single (q : Γ →* F) (g : Γ) (s : S) (n : ℤ) : + quotientChains q (Finsupp.single (g,s) n) = Finsupp.single (q g,s) n := by + simp [quotientChains] + +theorem translateChains_mul (g h : Γ) (c : BasedChains Γ S) : + translateChains (g*h) c = translateChains g (translateChains h c) := by + have he : (translateChains (g*h) : BasedChains Γ S →ₗ[ℤ] _) = + (translateChains g).comp (translateChains h) := by + apply Finsupp.lhom_ext + rintro ⟨p,s⟩ n + simp [mul_assoc] + exact LinearMap.congr_fun he c + +@[simp] theorem translateChains_one (c : BasedChains Γ S) : translateChains (1 : Γ) c = c := by + have he : (translateChains (1 : Γ) : BasedChains Γ S →ₗ[ℤ] _) = LinearMap.id := by + apply Finsupp.lhom_ext + rintro ⟨g,s⟩ n + simp + exact LinearMap.congr_fun he c + +theorem quotientChains_translate (q : Γ →* F) (g : Γ) (c : BasedChains Γ S) : + quotientChains q (translateChains g c) = translateChains (q g) (quotientChains q c) := by + have he : (quotientChains q).comp (translateChains g) = + ((translateChains (q g)).comp (quotientChains q) : BasedChains Γ S →ₗ[ℤ] _) := by + apply Finsupp.lhom_ext + rintro ⟨p,s⟩ n + simp + exact LinearMap.congr_fun he c + +/-- The elementary equivariance expressing a left integral group-ring map. -/ +def ChainsEquivariant (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) : Prop := + ∀ g c, A (translateChains g c) = translateChains g (A c) + +/-- Base change of a translation-equivariant matrix, directly on its finitely +supported columns. Its definition needs neither finite index sets nor flatness. -/ +def quotientMatrix (q : Γ →* F) (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) : + BasedChains F R →ₗ[ℤ] BasedChains F S := + Finsupp.linearCombination ℤ (fun i => + translateChains i.1 (quotientChains q (A (Finsupp.single (1,i.2) 1)))) + +@[simp] theorem quotientMatrix_single (q : Γ →* F) + (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) (f : F) (r : R) (n : ℤ) : + quotientMatrix q A (Finsupp.single (f,r) n) = + n • translateChains f (quotientChains q (A (Finsupp.single (1,r) 1))) := by + simp [quotientMatrix] + +theorem quotientMatrix_equivariant (q : Γ →* F) + (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) : ChainsEquivariant (quotientMatrix q A) := by + intro f c + have he : (quotientMatrix q A).comp (translateChains f) = + (translateChains f).comp (quotientMatrix q A) := by + apply Finsupp.lhom_ext + rintro ⟨p,r⟩ n + simp only [LinearMap.comp_apply, translateChains_single, quotientMatrix_single, + map_smul, translateChains_mul] + exact LinearMap.congr_fun he c + +theorem quotientMatrix_natural (q : Γ →* F) + (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) (hA : ChainsEquivariant A) + (c : BasedChains Γ R) : + quotientMatrix q A (quotientChains q c) = quotientChains q (A c) := by + have he : (quotientMatrix q A).comp (quotientChains q) = (quotientChains q).comp A := by + apply Finsupp.lhom_ext + rintro ⟨g,r⟩ n + have hb : Finsupp.single (g,r) n = + n • translateChains g (Finsupp.single (1,r) (1 : ℤ)) := by simp + simp only [LinearMap.comp_apply, quotientChains_single, quotientMatrix_single] + rw [hb, map_smul, map_smul, hA, quotientChains_translate] + exact LinearMap.congr_fun he c + +theorem quotientMatrix_comp (q : Γ →* F) + (A : BasedChains Γ R →ₗ[ℤ] BasedChains Γ S) + (B : BasedChains Γ S →ₗ[ℤ] BasedChains Γ T) (hB : ChainsEquivariant B) : + quotientMatrix q (B.comp A) = (quotientMatrix q B).comp (quotientMatrix q A) := by + apply Finsupp.lhom_ext + rintro ⟨f,r⟩ n + simp only [LinearMap.comp_apply, quotientMatrix_single, map_smul] + rw [quotientMatrix_equivariant q B f, quotientMatrix_natural q B hB] + +theorem quotientMatrix_id (q : Γ →* F) : + quotientMatrix q (LinearMap.id : BasedChains Γ R →ₗ[ℤ] _) = LinearMap.id := by + apply Finsupp.lhom_ext + rintro ⟨f,r⟩ n + simp + +theorem ChainsEquivariant.symm (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ S) + (hA : ChainsEquivariant A.toLinearMap) : ChainsEquivariant A.symm.toLinearMap := by + intro g c + apply A.injective + simp only [LinearEquiv.coe_coe, LinearEquiv.apply_symm_apply] + simpa only [LinearEquiv.coe_coe, LinearEquiv.apply_symm_apply] using (hA g (A.symm c)).symm + +/-- Tensoring an isomorphism is an isomorphism. This finite-column proof makes +no assertion that the quotient group ring is a flat module. -/ +def quotientChainEquiv (q : Γ →* F) (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ S) + (hA : ChainsEquivariant A.toLinearMap) : BasedChains F R ≃ₗ[ℤ] BasedChains F S where + __ := quotientMatrix q A.toLinearMap + invFun := quotientMatrix q A.symm.toLinearMap + left_inv c := by + have he := quotientMatrix_comp q A.toLinearMap A.symm.toLinearMap (ChainsEquivariant.symm A hA) + have hi : A.symm.toLinearMap.comp A.toLinearMap = LinearMap.id := by ext; simp + rw [hi, quotientMatrix_id] at he + exact (LinearMap.congr_fun he c).symm + right_inv c := by + have he := quotientMatrix_comp q A.symm.toLinearMap A.toLinearMap hA + have hi : A.toLinearMap.comp A.symm.toLinearMap = LinearMap.id := by ext; simp + rw [hi, quotientMatrix_id] at he + exact (LinearMap.congr_fun he c).symm + +end QuotientChains +end EilenbergGanea + + + +namespace EilenbergGanea +open scoped BigOperators + +/-- A finite family with an integral left inverse has a nonzero square minor. +Expansion of the alternating determinant avoids a flatness or rationalization +assumption, and also covers the empty row family. -/ +theorem nonsingular_minor_of_left_inverse {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + (v : J → I → ℤ) (b : I → J → ℤ) + (hb : ∀ i, ∑ j, b i j • v j = Pi.single i 1) : + ∃ e : I → J, Function.Injective e ∧ Matrix.det (fun i k => v (e i) k) ≠ 0 := by + classical + have hex : ∃ e : I → J, Matrix.det (fun i k => v (e i) k) ≠ 0 := by + by_contra h + push Not at h + let D := (Matrix.detRowAlternating : (I → ℤ) [⋀^I]→ₗ[ℤ] ℤ).toMultilinearMap + have hz : D (fun i => ∑ j, b i j • v j) = 0 := by + rw [D.map_sum] + apply Finset.sum_eq_zero + intro e _ + rw [D.map_smul_univ] + change (∏ i, b i (e i)) • Matrix.det (fun i k => v (e i) k) = 0 + rw [h] + exact smul_zero _ + have he : (fun i => ∑ j, b i j • v j) = (1 : Matrix I I ℤ) := by + ext i k + rw [show (∑ j, b i j • v j) = Pi.single i 1 from hb i] + simp [Matrix.one_apply, Pi.single_apply, eq_comm] + rw [he] at hz + change Matrix.det (1 : Matrix I I ℤ) = 0 at hz + simp at hz + obtain ⟨e, he⟩ := hex + refine ⟨e, ?_, he⟩ + intro i j hij + by_contra hne + exact he (Matrix.det_zero_of_row_eq hne (by simp [hij])) + +/-- The same finite-minor statement for an arbitrary direct sum. All supports +are retained, but only the finite union needed by the chosen rows is used. -/ +theorem finitely_supported_split_family_minor {I S : Type*} [Fintype I] [DecidableEq I] + (v : I → S →₀ ℤ) (B : (S →₀ ℤ) →ₗ[ℤ] (I → ℤ)) + (hB : ∀ i, B (v i) = Pi.single i 1) : + ∃ e : I → S, Function.Injective e ∧ Matrix.det (fun i j => v i (e j)) ≠ 0 := by + classical + let P : Finset S := Finset.univ.biUnion (fun i => (v i).support) + have hP (i : I) : (v i).support ⊆ P := by + intro s hs + exact Finset.mem_biUnion.mpr ⟨i, Finset.mem_univ _, hs⟩ + have hexpand (i : I) : v i = ∑ p : P, (v i) p.1 • (Finsupp.single p.1 (1 : ℤ)) := by + rw [Finset.sum_coe_sort P (fun p => (v i) p • (Finsupp.single p (1 : ℤ)))] + simp only [Finsupp.smul_single, smul_eq_mul, mul_one] + rw [← Finsupp.sum_of_support_subset (v i) (hP i) + (fun p t => Finsupp.single p t) (by intro p _; simp)] + exact (Finsupp.sum_single (v i)).symm + let w : P → I → ℤ := fun p j => v j p.1 + let b : I → P → ℤ := fun i p => B (Finsupp.single p.1 1) i + have hb (i : I) : ∑ p, b i p • w p = Pi.single i 1 := by + ext j + have hi := congrFun (hB j) i + rw [hexpand j, map_sum] at hi + simp only [map_smul, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] at hi + simpa only [b, w, Finset.sum_apply, Pi.smul_apply, smul_eq_mul, mul_comm, + Pi.single_apply, eq_comm] using hi + obtain ⟨e, he, hd⟩ := nonsingular_minor_of_left_inverse w b hb + refine ⟨fun i => (e i).1, ?_, ?_⟩ + · intro i j hij + exact he (Subtype.ext hij) + · have ht := Matrix.det_transpose (fun i j => v i (e j).1) + exact fun h => hd (ht.trans h) + +/-- Every finite subfamily of an arbitrary integral basis has a nonsingular +finite coordinate minor, including when the ambient basis is uncountable. -/ +theorem basis_subfamily_minor {I R S : Type*} [Fintype I] [DecidableEq I] + (A : (R →₀ ℤ) ≃ₗ[ℤ] (S →₀ ℤ)) (j : I ↪ R) : + ∃ e : I → S, Function.Injective e ∧ + Matrix.det (fun i k => A (Finsupp.single (j i) 1) (e k)) ≠ 0 := by + classical + let B : (S →₀ ℤ) →ₗ[ℤ] (I → ℤ) := + LinearMap.pi fun i => (Finsupp.lapply (j i)).comp A.symm.toLinearMap + apply finitely_supported_split_family_minor (fun i => A (Finsupp.single (j i) 1)) B + intro i + ext k + simp [B, Pi.single_apply, Finsupp.single_apply, j.injective.eq_iff, eq_comm] + +end EilenbergGanea + +namespace EilenbergGanea +section ChainProjection +variable {Γ D S T R : Type*} [Group Γ] [Group D] + +theorem pathChain_translate (v : S → Γ) (w : FreeGroup S) (g h : Γ) : + translateChains g (pathChain v w h) = pathChain v w (g*h) := by + induction w using FreeGroup.induction_on generalizing h with + | one => simp + | of s => simp + | inv_of s ih => simp only [pathChain_inv, map_neg, ih, mul_assoc] + | mul w z hw hz => simp only [pathChain_mul, map_add, hw, hz, mul_assoc] + +theorem pathChain_quotient (v : S → Γ) (q : Γ →* D) (w : FreeGroup S) (g : Γ) : + quotientChains q (pathChain v w g) = pathChain (fun s => q (v s)) w (q g) := by + induction w using FreeGroup.induction_on generalizing g with + | one => simp + | of s => simp + | inv_of s ih => simp only [pathChain_inv, map_neg, ih, map_mul, map_inv, wordValue_quotient] + | mul w z hw hz => simp only [pathChain_mul, map_add, hw, hz, map_mul, wordValue_quotient] + +def projectExtraChains : BasedChains Γ (S ⊕ T) →ₗ[ℤ] BasedChains Γ T := + Finsupp.linearCombination ℤ fun p => match p.2 with + | .inl _ => 0 + | .inr t => Finsupp.single (p.1,t) 1 + +omit [Group Γ] in +@[simp] theorem projectExtraChains_single_left (g : Γ) (s : S) (n : ℤ) : + projectExtraChains (Finsupp.single (g,Sum.inl s) n : BasedChains Γ (S ⊕ T)) = 0 := by + simp [projectExtraChains] + +omit [Group Γ] in +@[simp] theorem projectExtraChains_single_right (g : Γ) (t : T) (n : ℤ) : + projectExtraChains (Finsupp.single (g,Sum.inr t) n : BasedChains Γ (S ⊕ T)) = + Finsupp.single (g,t) n := by simp [projectExtraChains] + +theorem projectExtraChains_translate (g : Γ) (c : BasedChains Γ (S ⊕ T)) : + projectExtraChains (translateChains g c) = translateChains g (projectExtraChains c) := by + have he : (projectExtraChains (Γ := Γ) (S := S) (T := T)).comp (translateChains g) = + (translateChains g).comp projectExtraChains := by + apply Finsupp.lhom_ext + rintro ⟨h, s | t⟩ n <;> simp + exact LinearMap.congr_fun he c + +theorem projectExtraChains_quotient (q : Γ →* D) (c : BasedChains Γ (S ⊕ T)) : + projectExtraChains (quotientChains q c) = quotientChains q (projectExtraChains c) := by + have he : (projectExtraChains (Γ := D) (S := S) (T := T)).comp (quotientChains q) = + (quotientChains q).comp projectExtraChains := by + apply Finsupp.lhom_ext + rintro ⟨h, s | t⟩ n <;> simp + exact LinearMap.congr_fun he c + +def extraRelatorMap (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) : + BasedChains Γ R →ₗ[ℤ] BasedChains Γ T := + projectExtraChains.comp (relatorChainMap v r) + +@[simp] theorem extraRelatorMap_single (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) + (g : Γ) (i : R) (n : ℤ) : + extraRelatorMap v r (Finsupp.single (g,i) n) = + n • projectExtraChains (pathChain v (r i) g) := by + simp [extraRelatorMap, relatorChainMap] + +theorem extraRelatorMap_equivariant (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) : + ChainsEquivariant (extraRelatorMap v r) := by + intro g c + have he : (extraRelatorMap v r).comp (translateChains g) = + (translateChains g).comp (extraRelatorMap v r) := by + apply Finsupp.lhom_ext + rintro ⟨h,i⟩ n + simp only [LinearMap.comp_apply, translateChains_single, extraRelatorMap_single, map_smul] + rw [← projectExtraChains_translate, pathChain_translate] + exact LinearMap.congr_fun he c + +theorem extraRelatorMap_quotientMatrix (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) + (q : Γ →* D) : + quotientMatrix q (extraRelatorMap v r) = extraRelatorMap (fun s => q (v s)) r := by + apply Finsupp.lhom_ext + rintro ⟨g,i⟩ n + simp only [quotientMatrix_single, extraRelatorMap_single, one_smul] + rw [← projectExtraChains_quotient, pathChain_quotient, + ← projectExtraChains_translate, pathChain_translate, map_one, mul_one] + +/-- The exponent minor used on a finite quotient is a consequence of the +ordinary projected boundary isomorphism itself; no independent rank hypothesis +and no unproved flatness claim is inserted. -/ +theorem finite_extra_boundary_minor {I : Type*} [Fintype I] [DecidableEq I] + (v : S ⊕ T → Γ) (r : R → FreeGroup (S ⊕ T)) + (A : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ T) + (hA : A.toLinearMap = extraRelatorMap v r) (q : Γ →* D) (j : I ↪ D × R) : + ∃ e : I → D × T, Function.Injective e ∧ + Matrix.det (fun i k => projectExtraChains + (pathChain (fun s => q (v s)) (r (j i).2) (j i).1) (e k)) ≠ 0 := by + let B := quotientChainEquiv q A (by rw [hA]; exact extraRelatorMap_equivariant v r) + obtain ⟨e,he,hd⟩ := basis_subfamily_minor B j + refine ⟨e,he,?_⟩ + have hB : B.toLinearMap = extraRelatorMap (fun s => q (v s)) r := by + change quotientMatrix q A.toLinearMap = _ + rw [hA, extraRelatorMap_quotientMatrix] + have hb (i : I) : B (Finsupp.single (j i) 1) = projectExtraChains + (pathChain (fun s => q (v s)) (r (j i).2) (j i).1) := by + change B.toLinearMap _ = _ + rw [hB] + rcases j i with ⟨g,k⟩ + simp + simpa only [hb] using hd + +end ChainProjection +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion +section FiniteQuotientEquations +variable {Γ F S T R Z : Type*} [Group Γ] [Group F] + +/-- The exponent of a literal edge is exactly its cellular path coefficient. -/ +theorem pathSpelling_exponent [DecidableEq F] [DecidableEq S] + (v : S → F) (w : FreeGroup S) (g : F) (e : F × S) : + wordExponents (pathSpelling v w g) e = pathChain v w g e := by + have he : (FreeGroup.lift (fun i : F × S => + Multiplicative.ofAdd (if e = i then (1 : ℤ) else 0))) = + (Finsupp.applyAddHom e).toMultiplicative.comp + (FreeGroup.lift (fun i : F × S => Multiplicative.ofAdd (Finsupp.single i (1 : ℤ)))) := by + apply FreeGroup.ext_hom + intro i + simp [Finsupp.single_apply, eq_comm] + simp only [wordExponents, he, MonoidHom.comp_apply, pathSpelling_abelianization] + rfl + +omit [Group F] in +/-- Projection to the extra alphabet really deletes only the prescribed edges. -/ +theorem projectExtraChains_apply (c : BasedChains F (S ⊕ T)) (e : F × T) : + projectExtraChains c e = c (e.1, Sum.inr e.2) := by + classical + induction c using Finsupp.induction_linear with + | zero => simp + | add c d hc hd => simp only [map_add, Finsupp.add_apply, hc, hd] + | single p n => + rcases p with ⟨g,s | t⟩ + · simp + · simp [Finsupp.single_apply, Prod.ext_iff] + +/-- Sup norm agrees with the zero-normalized supremum, including an empty index. -/ +theorem norm_eq_familySize {I : Type*} [Fintype I] (f : I → ℍ) : + ‖f‖ = familySize (fun i => ‖f i‖) := by + have hb : BddAbove (Set.range (fun i => ‖f i‖)) := Set.finite_range _ |>.bddAbove + apply le_antisymm + · exact (pi_norm_le_iff_of_nonneg (familySize_nonneg _ hb)).mpr + (fun i => le_familySize _ hb i) + · exact familySize_le _ (norm_nonneg _) (fun i => norm_le_pi_norm f i) + +/-- Reindexing does not change the actual supremum norm of a finite word family. -/ +theorem norm_comp_equiv {I J : Type*} [Fintype I] [Fintype J] (e : I ≃ J) (f : J → ℍ) : + ‖fun i => f (e i)‖ = ‖f‖ := by + apply le_antisymm + · exact (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr fun i => norm_le_pi_norm f (e i) + · exact (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr fun j => by + simpa using norm_le_pi_norm (fun i => f (e i)) (e.symm j) + +end FiniteQuotientEquations +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion ContDiff +open Set +section FiniteQuotientSolvability +variable {F S T R Z : Type*} [Group F] [Fintype F] [Fintype Z] + +/-- The full finite quotient step. All coefficients on the prescribed alphabet +are retained exactly, not merely up to a small perturbation. -/ +theorem finite_quotient_comparison_solvable + (v : S ⊕ T → F) (r : Z ⊕ R → FreeGroup (S ⊕ T)) (z : Z → FreeGroup S) + (A : Finset R) (B : Finset R) (hAB : A ⊆ B) + (Q : BasedChains F R ≃ₗ[ℤ] BasedChains F T) + (hQ : Q.toLinearMap = extraRelatorMap v (fun i => r (.inr i))) + (C δ η : ℝ) (hC : 0 ≤ C) (hδ : 0 < δ) (hη : 0 < η) (hη1 : η < 1) + (hc₁ : C*(δ+η) < 1/2) (hc₂ : C*η < δ/2) + (hcomp : ∀ (b : F → S ⊕ T → SU2) (h : ℝ), 0 ≤ h → + (∀ g s, ‖(b g (.inl s) : ℍ)-1‖ ≤ η) → + (∀ i ∈ A, ∀ g, pathProduct (H := SU2) v b (r (.inr i)) g = 1) → + (∀ i g, ‖(pathProduct (H := SU2) v b (r (.inl i)) g : ℍ)-1‖ ≤ h) → + ∀ i g, + ‖(pathProduct (H := SU2) v b (FreeGroup.map Sum.inl (z i)) g : ℍ) - + (pathProduct (H := SU2) v b (r (.inl i)) g : ℍ)‖ ≤ C*(η+h)*h ∧ + ‖(pathProduct (H := SU2) v b (FreeGroup.map Sum.inl (z i)) g : ℍ)-1‖ ≤ C*η) + (a : F → S → SU2) (ha : ∀ g s, ‖(a g s : ℍ)-1‖ < η) : + ∃ b : F → T → SU2, + (∀ i ∈ B, ∀ g, pathProduct (H := SU2) v (mergeLabels a b) (r (.inr i)) g = 1) ∧ + (∀ i g, ‖(pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ)-1‖ < δ) := by + classical + let I := F × ↥B + let J := F × Z + let eI : Fin (Fintype.card I) ≃ I := (Fintype.equivFin I).symm + let eJ : Fin (Fintype.card J) ≃ J := (Fintype.equivFin J).symm + let j : Fin (Fintype.card I) ↪ F × R := + ⟨fun k => ((eI k).1, (eI k).2.val), fun k l h => by + apply eI.injective + exact Prod.ext (congrArg (fun p : F × R => p.1) h) (Subtype.ext (congrArg (fun p : F × R => p.2) h))⟩ + obtain ⟨e,he,hd⟩ := finite_extra_boundary_minor v (fun i => r (.inr i)) Q hQ + (MonoidHom.id F) j + let σ : Fin (Fintype.card I) ↪ F × (S ⊕ T) := + ⟨fun k => ((e k).1, .inr (e k).2), fun k l h => + he (Prod.ext (congrArg (fun p : F × (S ⊕ T) => p.1) h) + (Sum.inr_injective (congrArg (fun p : F × (S ⊕ T) => p.2) h)))⟩ + let w : Fin (Fintype.card I) → FreeGroup (F × (S ⊕ T)) := + fun k => pathSpelling v (r (.inr (eI k).2.val)) (eI k).1 + let ρ : Fin (Fintype.card J) → FreeGroup (F × (S ⊕ T)) := + fun k => pathSpelling v (r (.inl (eJ k).2)) (eJ k).1 + have hdet : Matrix.det (fun i k => wordExponents (w i) (σ k)) ≠ 0 := by + simp only [projectExtraChains_apply, MonoidHom.id_apply] at hd + simp only [w, pathSpelling_exponent] + exact hd + let base : F × (S ⊕ T) → SU2 := fun p => Sum.elim (a p.1) (fun _ => 1) p.2 + have hbase (p) : ‖(base p : ℍ)-1‖ < 1 := by + rcases p with ⟨g,s | t⟩ + · exact (ha g s).trans hη1 + · simp [base] + let arc : ℝ → F × (S ⊕ T) → SU2 := fun t p => smallQuaternionArc (base p) t + let L (t : ℝ) (x : Fin (Fintype.card I) → SU2) : F → S ⊕ T → SU2 := + fun g s => selectedLabel σ (arc t) x (g,s) + have hleft (g : F) (s : S) (k : Fin (Fintype.card I)) : σ k ≠ (g,.inl s) := by + change ((e k).1, Sum.inr (e k).2) ≠ (g,Sum.inl s) + simp + have hsmall (t : ℝ) (x : Fin (Fintype.card I) → SU2) (g : F) (s : S) : + ‖(L t x g (.inl s) : ℍ)-1‖ ≤ η := by + dsimp only [L] + rw [selectedLabel_other σ _ x _ (hleft g s)] + exact (smallQuaternionArc_distance (base (g,.inl s)) (hbase _) t).trans (ha g s).le + have hword (b : F × (S ⊕ T) → SU2) (r : FreeGroup (S ⊕ T)) (g : F) : + FreeGroup.lift b (pathSpelling v r g) = pathProduct (H := SU2) v (fun g s => b (g,s)) r g := + pathSpelling_eval v (fun g s => b (g,s)) r g + obtain ⟨b,hfixed,hw,hρ⟩ := selected_word_sublevel_solvable σ w ρ arc + (fun p => smallQuaternionArc_smooth _ (hbase p)) (by intro p; simp [arc]) + hdet δ hδ (fun t _ x hx => by + let f : J → ℍ := fun p => (pathProduct (H := SU2) v (L t x) (r (.inl p.2)) p.1 : ℍ)-1 + have hordinary (i : R) (hi : i ∈ B) (g : F) : + pathProduct (H := SU2) v (L t x) (r (.inr i)) g = 1 := by + have h := hx (eI.symm (g,⟨i,hi⟩)) + simpa only [w, Equiv.apply_symm_apply, hword] using h + have hb (i : Z) (g : F) : ‖(pathProduct (H := SU2) v (L t x) (r (.inl i)) g : ℍ)-1‖ ≤ + C*η + C*(‖f‖+η)*‖f‖ := by + obtain ⟨h₁,h₂⟩ := hcomp (L t x) ‖f‖ (norm_nonneg _) (hsmall t x) + (fun i hi => hordinary i (hAB hi)) + (fun i g => norm_le_pi_norm f (g,i)) i g + have htri := norm_sub_le_norm_sub_add_norm_sub (pathProduct (H := SU2) v (L t x) (r (.inl i)) g : ℍ) + (pathProduct (H := SU2) v (L t x) (FreeGroup.map Sum.inl (z i)) g : ℍ) 1 + calc + _ ≤ C*(η+‖f‖)*‖f‖ + C*η := htri.trans (add_le_add ((norm_sub_rev _ _).trans_le h₁) h₂) + _ = _ := by ring + have hne : ‖f‖ ≠ δ := by + rw [norm_eq_familySize] + exact familySize_ne_threshold (fun p : J => ‖f p‖) (Set.finite_range _ |>.bddAbove) + C δ η η hδ hC hη.le hη.le le_rfl hc₁ hc₂ (fun p => by + simpa only [← norm_eq_familySize] using hb p.2 p.1) + have heq : ‖(fun k => (FreeGroup.lift (selectedLabel σ (arc t) x) (ρ k) : ℍ))-1‖ = ‖f‖ := by + change ‖fun k => (FreeGroup.lift (selectedLabel σ (arc t) x) (ρ k) : ℍ)-1‖ = _ + simpa only [ρ, hword, f, L] using norm_comp_equiv eJ f + intro h + exact hne (heq.symm.trans h)) + let b' : F → T → SU2 := fun g t => b (g,.inr t) + have heval : (fun g s => b (g,s)) = mergeLabels a b' := by + funext g s + rcases s with s | t + · rw [hfixed _ (hleft g s)] + simp [arc, base, mergeLabels] + · rfl + refine ⟨b',?_,?_⟩ + · intro i hi g + have h := hw (eI.symm (g,⟨i,hi⟩)) + simpa only [w, Equiv.apply_symm_apply, hword, heval] using h + · intro i g + have h := (norm_le_pi_norm + ((fun k => (FreeGroup.lift b (ρ k) : ℍ))-1) (eJ.symm (g,i))).trans_lt hρ + simpa only [ρ, Pi.sub_apply, Pi.one_apply, Equiv.apply_symm_apply, hword, heval] using h + +end FiniteQuotientSolvability +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion +section AlignedComparison +variable {Γ : Type u} {S T Z R : Type*} [Group Γ] [Group.ResiduallyFinite Γ] [Fintype Z] + +omit [Group.ResiduallyFinite Γ] in +theorem wordValue_map_alphabet {E : Type*} (v : S → Γ) (f : E → S) (w : FreeGroup E) : + wordValue v (FreeGroup.map f w) = wordValue (fun e => v (f e)) w := by + have he : (wordValue v).comp (FreeGroup.map f) = wordValue (fun e => v (f e)) := by + apply FreeGroup.ext_hom + intro e + simp [wordValue] + exact congrArg (fun h : FreeGroup E →* Γ => h w) he + +/-- The algebraic core of the manuscript's presentation comparison, for an +actual aligned presentation. The passage from arbitrary ordinary CW classifying +spaces to this presentation is a separate topological obligation. -/ +theorem aligned_presentation_small_transport + (v : S ⊕ T → Γ) (r : Z ⊕ R → FreeGroup (S ⊕ T)) (z : Z → FreeGroup S) + (hvT : ∀ t, v (.inr t) = 1) + (hr : ∀ i, wordValue v (r i) = 1) + (hz : ∀ i, wordValue (fun s => v (.inl s)) (z i) = 1) + (hp : (wordValue v).ker = Subgroup.normalClosure (Set.range r)) + (hinj : Function.Injective (relatorChainMap v r)) + (hchain : ∀ i, pathChain v (FreeGroup.map Sum.inl (z i)) 1 = pathChain v (r (.inl i)) 1) + (Q : BasedChains Γ R ≃ₗ[ℤ] BasedChains Γ T) + (hQ : Q.toLinearMap = extraRelatorMap v (fun i => r (.inr i))) : + ∃ η : ℝ, 0 < η ∧ ∀ a : Γ → S → SU2, + (∀ g s, ‖(a g s : ℍ)-1‖ < η) → + (∀ i g, pathProduct (fun s => v (.inl s)) a (z i) g = 1) → + ∀ w : FreeGroup S, wordValue (fun s => v (.inl s)) w = 1 → ∀ g, + pathProduct (fun s => v (.inl s)) a w g = 1 := by + classical + have hzn (i) : FreeGroup.map Sum.inl (z i) ∈ Subgroup.normalClosure (Set.range r) := by + rw [← hp] + change wordValue v (FreeGroup.map Sum.inl (z i)) = 1 + rw [wordValue_map_alphabet, hz] + have htn (t) : FreeGroup.of (.inr t) ∈ Subgroup.normalClosure (Set.range r) := by + rw [← hp] + change wordValue v (FreeGroup.of (.inr t)) = 1 + simpa [wordValue] using hvT t + choose lz hlz using fun i => exists_normalExpression r (hzn i) + choose lt hlt using fun t => exists_normalExpression r (htn t) + have hc (i) : ((lz i).map (fun f => normalFactorCount v f 1)).sum = + Finsupp.single (1,Sum.inl i) 1 := + exact_translated_relator_counts v r hr hinj _ (.inl i) (hchain i) (lz i) (hlz i) + obtain ⟨A,C,hC,hcomp⟩ := finite_normal_comparison v r hr z lz lt hlz hlt hc + obtain ⟨δ,η,hδ,hδ1,hη,hη1,hc₁,hc₂⟩ := small_thresholds_exist C hC + refine ⟨η,hη,?_⟩ + intro a ha haz + let W : Γ × (Z ⊕ R) → FreeGroup (S ⊕ T) := fun p => r p.2 + let K : Γ × (Z ⊕ R) → Set SU2 := fun p => match p.2 with + | .inl _ => {b | ‖(b : ℍ)-1‖ ≤ δ} + | .inr _ => {1} + have hK (p) : IsClosed (K p) := by + rcases p with ⟨g,i | i⟩ + · exact isClosed_le ((continuous_subtype_val.sub continuous_const).norm) continuous_const + · exact isClosed_singleton + obtain ⟨b,hb⟩ := compact_labeling_from_finite_quotients v a W Prod.fst K hK + (fun b : SU2 => ‖(b : ℍ)-1‖ < η) (by simpa using hη) ha (by + intro N J aF haF + let : Fintype (Γ ⧸ N.toSubgroup) := Fintype.ofFinite _ + let q := QuotientGroup.mk' N.toSubgroup + let B := A ∪ (J.image Prod.snd).toRight + let QF := quotientChainEquiv q Q (by rw [hQ]; exact extraRelatorMap_equivariant _ _) + have hQF : QF.toLinearMap = extraRelatorMap (fun s => q (v s)) (fun i => r (.inr i)) := by + change quotientMatrix q Q.toLinearMap = _ + rw [hQ, extraRelatorMap_quotientMatrix] + obtain ⟨bF,hord,hdis⟩ := finite_quotient_comparison_solvable (fun s => q (v s)) r z A B + (Finset.subset_union_left) QF hQF C δ η (by linarith) hδ hη hη1 hc₁ hc₂ + (fun b h hh hsmall hord hdist => hcomp q b η h hη.le hh hsmall hord hdist) aF haF + refine ⟨bF,?_⟩ + rintro ⟨g,i | i⟩ hi d + · exact (hdis i d).le + · exact hord i (Finset.mem_union_right _ (Finset.mem_toRight.mpr + (Finset.mem_image.mpr ⟨(g,.inr i),hi,rfl⟩))) d) + have hord (i : R) (g : Γ) : pathProduct v (mergeLabels a b) (r (.inr i)) g = 1 := + hb (g,.inr i) + have hdis (i : Z) (g : Γ) : ‖(pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ)-1‖ ≤ δ := + hb (g,.inl i) + let f : Z × Γ → ℝ := fun p => ‖(pathProduct (H := SU2) v (mergeLabels a b) (r (.inl p.1)) p.2 : ℍ)-1‖ + have hbounded : BddAbove (Set.range f) := ⟨δ, by rintro _ ⟨⟨i,g⟩,rfl⟩; exact hdis i g⟩ + have hzero : ∀ p, f p = 0 := familySize_contraction f (fun _ => norm_nonneg _) + δ C η hδ.le (by linarith) hη.le (fun p => hdis p.1 p.2) (by linarith) (by + rintro ⟨i,g⟩ + have h := (hcomp (MonoidHom.id Γ) (mergeLabels a b) η (familySize f) hη.le + (familySize_nonneg f hbounded) (fun g s => (ha g s).le) (fun i _ => hord i) + (fun i g => le_familySize f hbounded (i,g)) i g).1 + have hz' : pathProduct v (mergeLabels a b) (FreeGroup.map Sum.inl (z i)) g = 1 := by + rw [pathProduct_map_alphabet] + exact haz i g + change ‖(pathProduct (H := SU2) v (mergeLabels a b) (FreeGroup.map Sum.inl (z i)) g : ℍ)- + (pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ)‖ ≤ _ at h + rw [hz'] at h + change ‖(1 : ℍ) - (pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ)‖ ≤ + C * (η + familySize f) * familySize f at h + change ‖(pathProduct (H := SU2) v (mergeLabels a b) (r (.inl i)) g : ℍ) - 1‖ ≤ + C * (familySize f + η) * familySize f + rw [norm_sub_rev] + rwa [add_comm η (familySize f)] at h) + have hdist (i : Z) (g : Γ) : pathProduct v (mergeLabels a b) (r (.inl i)) g = 1 := by + apply Subtype.ext + exact sub_eq_zero.mp (norm_eq_zero.mp (hzero (i,g))) + intro w hw g + have hw' : wordValue v (FreeGroup.map Sum.inl w) = 1 := by + rw [wordValue_map_alphabet, hw] + have h := pathProduct_trivial_of_relators v (mergeLabels a b) (Set.range r) + (by rintro _ ⟨i,rfl⟩; exact hr i) hp + (by rintro _ ⟨i | i,rfl⟩ g; exact hdist i g; exact hord i g) + (FreeGroup.map Sum.inl w) hw' g + simpa only [pathProduct_map_alphabet, mergeLabels, Sum.elim_inl, Function.comp_def] using h + +end AlignedComparison +end EilenbergGanea + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/Regularization.lean b/lean/OAI/Topology/EilenbergGanea/Regularization.lean index 86b17239caeedfbcc429048c82126bef6e7dbf10..221035fccd6145e0f92da5a688bf99432281cb24 100644 --- a/lean/OAI/Topology/EilenbergGanea/Regularization.lean +++ b/lean/OAI/Topology/EilenbergGanea/Regularization.lean @@ -1,1199 +1,1199 @@ -import Mathlib.Tactic -import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FiniteDimensional -import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff -import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension -import Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox -import Mathlib.Analysis.Calculus.FDeriv.Equiv -import Mathlib.Analysis.Complex.Basic -import Mathlib.Analysis.InnerProductSpace.PiL2 -import Mathlib.RingTheory.Complex -import Mathlib.LinearAlgebra.Eigenspace.Minpoly -import Mathlib.MeasureTheory.Function.Jacobian - -namespace OAI - -noncomputable section - -open Set Filter Topology - -/-! Localized regularization for finite SU(2) systems. -/ -namespace EilenbergGanea -section ComplexCentralizer -variable {V : Type*} [AddCommGroup V] [Module ℂ V] [Module ℝ V] - [IsScalarTower ℝ ℂ V] - -theorem complex_smul_decompose (z : ℂ) (x : V) : - z • x = z.re • x + z.im • (Complex.I • x) := by - conv_lhs => rw [← Complex.re_add_im z] - rw [add_smul, mul_smul] - change (algebraMap ℝ ℂ z.re) • x + - (algebraMap ℝ ℂ z.im) • (Complex.I • x) = _ - simp only [IsScalarTower.algebraMap_smul] - -/-- Commuting with a non-real scalar forces a real-linear map to be complex-linear. -/ -theorem realLinear_map_complex_smul (f : V →ₗ[ℝ] V) (z : ℂ) (hz : z.im ≠ 0) - (hf : ∀ x, f (z • x) = z • f x) (w : ℂ) (x : V) : - f (w • x) = w • f x := by - have hI (y : V) : f (Complex.I • y) = Complex.I • f y := by - have he := hf y - rw [complex_smul_decompose z y, complex_smul_decompose z (f y), - map_add, map_smul, map_smul] at he - exact smul_right_injective V hz (add_left_cancel he) - rw [complex_smul_decompose w x, complex_smul_decompose w (f x), - map_add, map_smul, map_smul, hI] - -theorem complexLinear_of_commutes_nonreal (N : V →ₗ[ℝ] V) (z : ℂ) (hz : z.im ≠ 0) - (h : ∀ v, N (z • v) = z • N v) : - ∃ C : V →ₗ[ℂ] V, C.restrictScalars ℝ = N := by - let C : V →ₗ[ℂ] V := - { toFun := N - map_add' := N.map_add - map_smul' := realLinear_map_complex_smul N z hz h } - exact ⟨C, rfl⟩ - -end ComplexCentralizer - -section RotationDerivative -variable {A V : Type*} [AddCommGroup A] [Module ℝ A] - [AddCommGroup V] [Module ℂ V] [Module ℝ V] [IsScalarTower ℝ ℂ V] - -/-- A real derivative commuting with the fixed-plus-rotating representation -has no mixed blocks. Its normal block is complex-linear. -/ -theorem rotation_commutant_blocks (L : A × V →ₗ[ℝ] A × V) - (z : ℂ) (hz : z.im ≠ 0) - (h : ∀ a v, L (a, z • v) = ((L (a, v)).1, z • (L (a, v)).2)) : - ∃ (T : A →ₗ[ℝ] A) (N : V →ₗ[ℂ] V), - L = T.prodMap (N.restrictScalars ℝ) := by - have hz1 : z ≠ 1 := by intro he; simp [he] at hz - let T := (LinearMap.fst ℝ A V).comp (L.comp (LinearMap.inl ℝ A V)) - let N := (LinearMap.snd ℝ A V).comp (L.comp (LinearMap.inr ℝ A V)) - let P := (LinearMap.fst ℝ A V).comp (L.comp (LinearMap.inr ℝ A V)) - have hP (v : V) : P (z • v) = P v := by - have hv := congrArg Prod.fst (h 0 v) - exact hv - have hPzero (v : V) : P v = 0 := by - let u := (z - 1)⁻¹ • v - have huv : z • u - u = v := by - dsimp [u] - calc - z • ((z - 1)⁻¹ • v) - (z - 1)⁻¹ • v = - (z - 1) • ((z - 1)⁻¹ • v) := by rw [sub_smul, one_smul] - _ = v := by rw [smul_smul, mul_inv_cancel₀ (sub_ne_zero.mpr hz1), one_smul] - rw [← huv, map_sub, hP, sub_self] - have hQzero (a : A) : (L (a, 0)).2 = 0 := by - have hv := congrArg Prod.snd (h a 0) - simp only [smul_zero] at hv - have hh : (z - 1) • (L (a, 0)).2 = 0 := by - rw [sub_smul, one_smul, ← hv, sub_self] - exact (smul_eq_zero.mp hh).resolve_left (sub_ne_zero.mpr hz1) - obtain ⟨C, hC⟩ := complexLinear_of_commutes_nonreal N z hz - (fun v => congrArg Prod.snd (h 0 v)) - refine ⟨T, C, ?_⟩ - rw [hC] - apply LinearMap.ext - intro q - apply Prod.ext - · change (L q).1 = T q.1 - have he : q = (q.1, 0) + (0, q.2) := by simp - rw [he, map_add] - change T q.1 + P q.2 = _ - rw [hPzero, add_zero] - simp - · change (L q).2 = N q.2 - have he : q = (q.1, 0) + (0, q.2) := by simp - rw [he, map_add] - change (L (q.1, 0)).2 + N q.2 = _ - rw [hQzero, zero_add] - simp - -end RotationDerivative - -section NormalDeterminant -variable {V : Type*} [AddCommGroup V] [Module ℂ V] [Module ℝ V] - [IsScalarTower ℝ ℂ V] [FiniteDimensional ℂ V] - -theorem complex_real_det_nonneg (N : V →ₗ[ℂ] V) : - 0 ≤ (N.restrictScalars ℝ).det := by - rw [LinearMap.det_restrictScalars, Algebra.norm_complex_apply] - exact Complex.normSq_nonneg _ - -theorem complex_real_det_pos (N : V →ₗ[ℂ] V) (hN : N.det ≠ 0) : - 0 < (N.restrictScalars ℝ).det := by - rw [LinearMap.det_restrictScalars, Algebra.norm_complex_apply] - exact Complex.normSq_pos.mpr hN - -end NormalDeterminant - -section SimultaneousShift -open Set -variable {V : Type*} [AddCommGroup V] [Module ℂ V] [FiniteDimensional ℂ V] - -/-- A single real scalar regularizes any finite collection of normal blocks. -/ -theorem exists_small_simultaneous_regular_shift {ι : Type*} [Fintype ι] - (N : ι → Module.End ℂ V) {ε : ℝ} (hε : 0 < ε) : - ∃ s : ℝ, |s| < ε ∧ ∀ i, IsUnit (N i + algebraMap ℂ (Module.End ℂ V) (s : ℂ)) := by - let bad : Set ℝ := ⋃ i, {r | -(r : ℂ) ∈ spectrum ℂ (N i)} - have hbad : bad.Finite := Set.finite_iUnion (fun i => - (Module.End.finite_spectrum (N i)).preimage - (fun _ _ _ _ h => Complex.ofReal_injective (neg_injective h))) - obtain ⟨s, hs, hgood⟩ := (Set.Ioo_infinite (by linarith : -ε < ε)).exists_notMem_finite hbad - refine ⟨s, abs_lt.mpr hs, fun i => ?_⟩ - have hn : -(s : ℂ) ∉ spectrum ℂ (N i) := by - intro hh - exact hgood (Set.mem_iUnion.mpr ⟨i, hh⟩) - have hi := (spectrum.notMem_iff.mp hn).neg - simpa only [map_neg, neg_sub, sub_neg_eq_add] using hi - -end SimultaneousShift -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped ContDiff -section EquivariantDerivative -variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] - -omit [FiniteDimensional ℝ E] in -theorem equivariant_fderiv (f : E → E) (L : E ≃L[ℝ] E) - (hf : Differentiable ℝ f) (he : ∀ x, f (L x) = L (f x)) (x : E) : - (fderiv ℝ f (L x)).comp L.toContinuousLinearMap = - L.toContinuousLinearMap.comp (fderiv ℝ f x) := by - have h₁ := (hf (L x)).hasFDerivAt.comp x L.hasFDerivAt - have h₂ := L.hasFDerivAt.comp x (hf x).hasFDerivAt - have hh : f ∘ L = L ∘ f := funext he - rw [hh] at h₁ - exact h₁.unique h₂ - -omit [FiniteDimensional ℝ E] in -theorem equivariant_fderiv_det (f : E → E) (L : E ≃L[ℝ] E) - (hf : Differentiable ℝ f) (he : ∀ x, f (L x) = L (f x)) (x : E) : - (fderiv ℝ f (L x)).det = (fderiv ℝ f x).det := by - have h := congrArg (fun M : E →L[ℝ] E => M.det) (equivariant_fderiv f L hf he x) - change ((fderiv ℝ f (L x)).toLinearMap.comp L.toLinearEquiv.toLinearMap).det = - (L.toLinearEquiv.toLinearMap.comp (fderiv ℝ f x).toLinearMap).det at h - rw [LinearMap.det_comp, LinearMap.det_comp, mul_comm] at h - exact mul_left_cancel₀ L.toLinearEquiv.isUnit_det'.ne_zero h -end EquivariantDerivative - -section FixedRegularization -variable {A V : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] - [NormedAddCommGroup V] [NormedSpace ℝ V] - -/-- The complement of the fixed subspace. -/ -def normalProjection : (A × V) →L[ℝ] (A × V) := - (ContinuousLinearMap.inr ℝ A V).comp (ContinuousLinearMap.snd ℝ A V) - -@[simp] theorem normalProjection_apply (x : A × V) : normalProjection x = (0, x.2) := rfl - -def normalShift (f : A × V → A × V) (s : ℝ) (x : A × V) := f x + s • normalProjection x - -theorem normalShift_contDiff (f : A × V → A × V) (hf : ContDiff ℝ ∞ f) (s : ℝ) : - ContDiff ℝ ∞ (normalShift f s) := - hf.add ((show ContDiff ℝ ∞ (fun _ : A × V => s) from contDiff_const).smul - (normalProjection (A := A) (V := V)).contDiff) - -theorem normalShift_fderiv (f : A × V → A × V) (hf : Differentiable ℝ f) (s : ℝ) (x : A × V) : - fderiv ℝ (normalShift f s) x = fderiv ℝ f x + s • normalProjection := - ((hf x).hasFDerivAt.add ((normalProjection (A := A) (V := V)).hasFDerivAt.const_smul s)).fderiv - -@[simp] theorem normalShift_fixed (f : A × V → A × V) (s : ℝ) (a : A) : - normalShift f s (a, 0) = f (a, 0) := by simp [normalShift] - -variable [NormedSpace ℂ V] [IsScalarTower ℝ ℂ V] - -def scalarRotation (z : ℂˣ) : (A × V) ≃L[ℝ] (A × V) := - (ContinuousLinearEquiv.refl ℝ A).prodCongr - ((ContinuousLinearEquiv.smulLeft z : V ≃L[ℂ] V).restrictScalars ℝ) - -@[simp] theorem scalarRotation_apply (z : ℂˣ) (q : A × V) : - scalarRotation z q = (q.1, (z : ℂ) • q.2) := rfl - -/-- At a fixed point the derivative splits with a complex-linear normal block. -/ -theorem fixed_fderiv_blocks (f : A × V → A × V) (hf : Differentiable ℝ f) - (z : ℂˣ) (hz : (z : ℂ).im ≠ 0) - (he : ∀ q, f (scalarRotation z q) = scalarRotation z (f q)) (a : A) : - ∃ (T : A →ₗ[ℝ] A) (N : V →ₗ[ℂ] V), - (fderiv ℝ f (a, 0)).toLinearMap = T.prodMap (N.restrictScalars ℝ) := by - apply rotation_commutant_blocks _ (z : ℂ) hz - intro b v - have h := congrArg (fun L : (A × V) →L[ℝ] (A × V) => L (b, v)) (equivariant_fderiv f (scalarRotation z) hf he (a, 0)) - simpa using h - -variable [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] - -/-- Scalar shifts have the claimed fixed-block Jacobian, with no chart convention. -/ -theorem normalShift_fixed_det (f : A × V → A × V) (hf : Differentiable ℝ f) - (a : A) (T : A →ₗ[ℝ] A) (N : V →ₗ[ℂ] V) - (h : (fderiv ℝ f (a, 0)).toLinearMap = T.prodMap (N.restrictScalars ℝ)) (s : ℝ) : - (fderiv ℝ (normalShift f s) (a, 0)).det = - T.det * ((N + algebraMap ℂ (Module.End ℂ V) (s : ℂ)).restrictScalars ℝ).det := by - let : FiniteDimensional ℝ V := Module.Finite.trans ℂ V - rw [normalShift_fderiv f hf] - have he : (fderiv ℝ f (a, 0) + s • normalProjection).toLinearMap = - T.prodMap ((N + algebraMap ℂ (Module.End ℂ V) (s : ℂ)).restrictScalars ℝ) := by - apply LinearMap.ext - intro q - have hh := LinearMap.congr_fun h q - change (fderiv ℝ f (a, 0)) q + s • (0, q.2) = _ - change (fderiv ℝ f (a, 0)) q = (T q.1, N q.2) at hh - rw [hh] - simp only [Prod.smul_mk, smul_zero, Prod.mk_add_mk, add_zero, - LinearMap.prodMap_apply, LinearMap.restrictScalars_apply, LinearMap.add_apply, - Module.algebraMap_end_apply] - congr 2 - exact (IsScalarTower.algebraMap_smul ℂ s q.2).symm - change (fderiv ℝ f (a, 0) + s • normalProjection).toLinearMap.det = _ - rw [he, LinearMap.det_prodMap] - - -def fixedRestriction (f : A × V → A × V) (a : A) : A := (f (a, 0)).1 - -omit [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] in -theorem fixedRestriction_fderiv (f : A × V → A × V) (hf : Differentiable ℝ f) - (a : A) (T : A →ₗ[ℝ] A) (N : V →ₗ[ℂ] V) - (h : (fderiv ℝ f (a, 0)).toLinearMap = T.prodMap (N.restrictScalars ℝ)) : - (fderiv ℝ (fixedRestriction f) a).toLinearMap = T := by - have hd := (ContinuousLinearMap.fst ℝ A V).hasFDerivAt.comp a - ((hf (a, 0)).hasFDerivAt.comp a (ContinuousLinearMap.inl ℝ A V).hasFDerivAt) - have hfun : (ContinuousLinearMap.fst ℝ A V) ∘ (f ∘ (ContinuousLinearMap.inl ℝ A V)) = - fixedRestriction f := rfl - rw [hfun] at hd - rw [hd.fderiv] - apply LinearMap.ext - intro q - exact congrArg Prod.fst (LinearMap.congr_fun h (q, 0)) - -/-- Simultaneously regularize the finite fixed fiber, retaining its tangent sign. -/ -theorem exists_normalShift_regular_fixed (f : A × V → A × V) (hf : Differentiable ℝ f) - (z : ℂˣ) (hz : (z : ℂ).im ≠ 0) - (he : ∀ q, f (scalarRotation z q) = scalarRotation z (f q)) - (S : Finset A) (c : ℝ) (hc : c ≠ 0) - (hT : ∀ a ∈ S, (fderiv ℝ (fixedRestriction f) a).det = c) - (ε : ℝ) (hε : 0 < ε) : - ∃ s : ℝ, |s| < ε ∧ ∀ a ∈ S, - (fderiv ℝ (normalShift f s) (a, 0)).det ≠ 0 ∧ - (0 < (fderiv ℝ (normalShift f s) (a, 0)).det ↔ 0 < c) := by - classical - choose T N hblock using (fun a : S => fixed_fderiv_blocks f hf z hz he a.val) - obtain ⟨s, hs, hregular⟩ := exists_small_simultaneous_regular_shift N hε - refine ⟨s, hs, fun a ha => ?_⟩ - let i : S := ⟨a, ha⟩ - have ht : (T i).det = c := by - rw [← fixedRestriction_fderiv f hf a (T i) (N i) (hblock i)] - exact hT a ha - have hn : 0 < ((N i + algebraMap ℂ (Module.End ℂ V) (s : ℂ)).restrictScalars ℝ).det := - complex_real_det_pos _ (LinearMap.isUnit_det _ (hregular i)).ne_zero - rw [normalShift_fixed_det f hf a (T i) (N i) (hblock i), ht] - exact ⟨mul_ne_zero hc hn.ne', mul_pos_iff_of_pos_right hn⟩ - -end FixedRegularization -end EilenbergGanea - -open Set Filter Topology -namespace EilenbergGanea -section LinearParameters -variable {ι E : Type*} [Fintype ι] [DecidableEq ι] - [NormedAddCommGroup E] [NormedSpace ℝ E] - -def linearPerturbation (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (x : E) (p : ι → E) : E := f x + ∑ j, T j x (p j) - -def linearPerturbationDerivative (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (x : E) (p : ι → E) : E →L[ℝ] E := - fderiv ℝ f x + ∑ j, (fderiv ℝ (T j) x).flip (p j) - -omit [DecidableEq ι] in -theorem linearPerturbation_hasFDerivAt (f : E → E) (T : ι → E → (E →L[ℝ] E)) - {x : E} (hf : DifferentiableAt ℝ f x) (hT : ∀ j, DifferentiableAt ℝ (T j) x) - (p : ι → E) : HasFDerivAt (fun z => linearPerturbation f T z p) - (linearPerturbationDerivative f T x p) x := by - apply hf.hasFDerivAt.add - apply HasFDerivAt.fun_sum - intro j _ - simpa using (hT j).hasFDerivAt.clm_apply (hasFDerivAt_const (p j) x) - -def linearSolvedParameter (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (i : ι) (q : ι → E) : ι → E := - Function.update q i (-(Ring.inverse (T i (q i)) - (f (q i) + ∑ j ∈ Finset.univ.erase i, T j (q i) (q j)))) - -theorem linearSolvedParameter_outside (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (i j : ι) (hji : j ≠ i) : - (fun q => linearSolvedParameter f T i q j) = fun q => q j := by - funext q - exact Function.update_of_ne hji _ _ - -theorem inverse_apply_cancel (A : E →L[ℝ] E) (hA : IsUnit A) (v : E) : - Ring.inverse A (A v) = v := by - exact congrArg (fun B : E →L[ℝ] E => B v) (Ring.inverse_mul_cancel A hA) - -theorem apply_inverse_cancel (A : E →L[ℝ] E) (hA : IsUnit A) (v : E) : - A (Ring.inverse A v) = v := by - exact congrArg (fun B : E →L[ℝ] E => B v) (Ring.mul_inverse_cancel A hA) - -theorem linearSolvedParameter_root (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (i : ι) (q : ι → E) (hi : IsUnit (T i (q i))) : - linearPerturbation f T (q i) (linearSolvedParameter f T i q) = 0 := by - rw [linearPerturbation, ← Finset.sum_erase_add _ _ (Finset.mem_univ i)] - have he : (∑ j ∈ Finset.univ.erase i, T j (q i) (linearSolvedParameter f T i q j)) = - ∑ j ∈ Finset.univ.erase i, T j (q i) (q j) := by - apply Finset.sum_congr rfl - intro j hj - rw [linearSolvedParameter, Function.update_of_ne (Finset.ne_of_mem_erase hj)] - rw [he] - simp only [linearSolvedParameter, Function.update_self, map_neg, - apply_inverse_cancel _ hi] - abel - -variable [FiniteDimensional ℝ E] - -theorem linearSolvedParameter_differentiableAt (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (i : ι) (q : ι → E) (hf : DifferentiableAt ℝ f (q i)) - (hT : ∀ j, DifferentiableAt ℝ (T j) (q i)) (hi : IsUnit (T i (q i))) : - DifferentiableAt ℝ (linearSolvedParameter f T i) q := by - have hproj := differentiableAt_apply i q (𝕜 := ℝ) - apply differentiableAt_pi.mpr - intro j - by_cases hj : j = i - · subst j - simp only [linearSolvedParameter, Function.update_self] - apply DifferentiableAt.neg - apply DifferentiableAt.clm_apply - · exact ((hT i).inverse hi).comp q hproj - · exact (hf.comp q hproj).add (DifferentiableAt.fun_sum (fun k _ => - ((hT k).comp q hproj).clm_apply (differentiableAt_apply k q))) - · simpa only [linearSolvedParameter_outside f T i j hj] using differentiableAt_apply j q (𝕜 := ℝ) - -omit [FiniteDimensional ℝ E] in -theorem linearSolvedParameter_fderiv_outside (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (i j : ι) (hji : j ≠ i) (q : ι → E) - (hG : DifferentiableAt ℝ (linearSolvedParameter f T i) q) : - (ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E).comp - (fderiv ℝ (linearSolvedParameter f T i) q) = ContinuousLinearMap.proj j := by - have h := ((ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E)).hasFDerivAt.comp q hG.hasFDerivAt - have he : (ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E) ∘ - linearSolvedParameter f T i = fun q => q j := - linearSolvedParameter_outside f T i j hji - rw [he] at h - exact h.unique ((ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E)).hasFDerivAt - -theorem linearSolvedParameter_differential_relation - (f : E → E) (T : ι → E → (E →L[ℝ] E)) (i : ι) (q : ι → E) - (hf : DifferentiableAt ℝ f (q i)) (hT : ∀ j, DifferentiableAt ℝ (T j) (q i)) - (hi : IsUnit (T i (q i))) (v : E) : - linearPerturbationDerivative f T (q i) (linearSolvedParameter f T i q) v + - ∑ j, T j (q i) ((fderiv ℝ (linearSolvedParameter f T i) q (Pi.single i v)) j) = 0 := by - let G := linearSolvedParameter f T i - have hG := linearSolvedParameter_differentiableAt f T i q hf hT hi - have hfi := hf.hasFDerivAt.comp q ((ContinuousLinearMap.proj i : (ι → E) →L[ℝ] E)).hasFDerivAt - have hx := hfi.fun_add (HasFDerivAt.fun_sum (u := Finset.univ) (fun j _ => - ((hT j).hasFDerivAt.comp q ((ContinuousLinearMap.proj i : (ι → E) →L[ℝ] E)).hasFDerivAt).clm_apply - (((ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E)).hasFDerivAt.comp q hG.hasFDerivAt))) - have hz : (fun t => linearPerturbation f T (t i) (G t)) =ᶠ[𝓝 q] fun _ => 0 := by - have hcont : ContinuousAt (fun t : ι → E => T i (t i)) q := - ((hT i).comp q (differentiableAt_apply i q)).continuousAt - have he : ∀ᶠ t in 𝓝 q, IsUnit (T i (t i)) := - hcont (Units.isOpen.mem_nhds hi) - filter_upwards [he] with t ht - exact linearSolvedParameter_root f T i t ht - have hc := (hasFDerivAt_const (𝕜 := ℝ) (0 : E) q).congr_of_eventuallyEq hz - have he := congrArg (fun l : (ι → E) →L[ℝ] E => l (Pi.single i v)) (hx.unique hc) - simp only [add_apply, sum_apply, ContinuousLinearMap.comp_apply, - ContinuousLinearMap.proj_apply, ContinuousLinearMap.flip_apply, - Pi.single_eq_same, zero_apply, Finset.sum_add_distrib] at he - simp only [linearPerturbationDerivative, add_apply, sum_apply, ContinuousLinearMap.flip_apply] - dsimp [G] at he - exact (by convert he using 1; abel) - -omit [FiniteDimensional ℝ E] in -theorem linearSolvedParameter_recovers_root (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (i : ι) (x : E) (p : ι → E) (hi : IsUnit (T i x)) - (hroot : linearPerturbation f T x p = 0) : - linearSolvedParameter f T i (Function.update p i x) = p := by - have he : (∑ j ∈ Finset.univ.erase i, T j x (Function.update p i x j)) = - ∑ j ∈ Finset.univ.erase i, T j x (p j) := by - apply Finset.sum_congr rfl - intro j hj - rw [Function.update_of_ne (Finset.ne_of_mem_erase hj)] - have hs : T i x (p i) = -(f x + ∑ j ∈ Finset.univ.erase i, T j x (p j)) := by - rw [linearPerturbation, ← Finset.sum_erase_add _ _ (Finset.mem_univ i), - ← add_assoc] at hroot - exact eq_neg_of_add_eq_zero_right hroot - funext j - by_cases hj : j = i - · subst j - simp only [linearSolvedParameter, Function.update_self, he] - rw [← map_neg, ← hs, inverse_apply_cancel _ hi] - · simp [linearSolvedParameter, Function.update_of_ne hj] - -theorem linearSolvedParameter_critical (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (i : ι) (q : ι → E) (hf : DifferentiableAt ℝ f (q i)) - (hT : ∀ j, DifferentiableAt ℝ (T j) (q i)) (hi : IsUnit (T i (q i))) - (hcrit : (linearPerturbationDerivative f T (q i) (linearSolvedParameter f T i q)).det = 0) : - (fderiv ℝ (linearSolvedParameter f T i) q).det = 0 := by - have hG := linearSolvedParameter_differentiableAt f T i q hf hT hi - obtain ⟨v, hv, hv0⟩ := Submodule.exists_mem_ne_zero_of_ne_bot - (LinearMap.det_eq_zero_iff_ker_ne_bot.mp hcrit) - change linearPerturbationDerivative f T (q i) (linearSolvedParameter f T i q) v = 0 at hv - let w := fderiv ℝ (linearSolvedParameter f T i) q (Pi.single i v) - have hw (j : ι) (hji : j ≠ i) : w j = 0 := by - have he := congrArg (fun l : (ι → E) →L[ℝ] E => l (Pi.single i v)) - (linearSolvedParameter_fderiv_outside f T i j hji q hG) - simpa [w, Pi.single_eq_of_ne hji] using he - have hrel := linearSolvedParameter_differential_relation f T i q hf hT hi v - rw [hv, zero_add] at hrel - have hwi : w i = 0 := by - have hs : (∑ j, T j (q i) (w j)) = T i (q i) (w i) := by - apply Finset.sum_eq_single i - · intro j _ hji - simp [hw j hji] - · simp - rw [hs] at hrel - have he := congrArg (fun v => Ring.inverse (T i (q i)) v) hrel - simpa only [inverse_apply_cancel _ hi, map_zero] using he - apply LinearMap.det_eq_zero_iff_ker_ne_bot.mpr - apply (Submodule.ne_bot_iff _).mpr - refine ⟨Pi.single i v, ?_, ?_⟩ - · change w = 0 - funext j - by_cases hj : j = i - · subst j; exact hwi - · exact hw j hj - · intro he - apply hv0 - simpa using congrFun he i - -/-- Transversality with source-dependent linear parameter blocks, including -finite equivariant bump perturbations. Only invertibility of a single active -block is required at each root. -/ -theorem ae_regular_linear_parameters [MeasurableSpace E] [BorelSpace E] - (μ : MeasureTheory.Measure (ι → E)) [μ.IsAddHaarMeasure] - (f : E → E) (T : ι → E → (E →L[ℝ] E)) (s : Set E) - (hf : ∀ x ∈ s, DifferentiableAt ℝ f x) - (hT : ∀ i x, x ∈ s → DifferentiableAt ℝ (T i) x) : - ∀ᵐ p ∂μ, ∀ x ∈ s, linearPerturbation f T x p = 0 → - (∃ i, IsUnit (T i x)) → (linearPerturbationDerivative f T x p).det ≠ 0 := by - let C : ι → Set (ι → E) := fun i => - {q | q i ∈ s ∧ IsUnit (T i (q i)) ∧ (fderiv ℝ (linearSolvedParameter f T i) q).det = 0} - have hnull (i : ι) : μ (linearSolvedParameter f T i '' C i) = 0 := by - apply MeasureTheory.addHaar_image_eq_zero_of_det_fderivWithin_eq_zero μ - · intro q hq - exact (linearSolvedParameter_differentiableAt f T i q (hf _ hq.1) - (fun j => hT j _ hq.1) hq.2.1).hasFDerivAt.hasFDerivWithinAt - · intro q hq - exact hq.2.2 - have hae : ∀ᵐ p ∂μ, p ∉ ⋃ i, linearSolvedParameter f T i '' C i := by - rw [MeasureTheory.ae_iff] - simpa only [not_not, Set.ofPred_mem_eq] using MeasureTheory.measure_iUnion_null hnull - filter_upwards [hae] with p hp - intro x hs hx ⟨i, hi⟩ hcrit - let q := Function.update p i x - have hqi : q i = x := Function.update_self _ _ _ - have hGq : linearSolvedParameter f T i q = p := - linearSolvedParameter_recovers_root f T i x p hi hx - apply hp - apply Set.mem_iUnion.mpr - refine ⟨i, q, ⟨?_, ?_, ?_⟩, hGq⟩ - · simpa only [hqi] using hs - · simpa only [hqi] using hi - · apply linearSolvedParameter_critical f T i q - (by simpa only [hqi] using hf x hs) - (fun j => by simpa only [hqi] using hT j x hs) - · simpa only [hqi] using hi - · simpa only [hqi, hGq] using hcrit - -end LinearParameters -end EilenbergGanea -open scoped ContDiff -open Set Filter Topology -namespace EilenbergGanea -section EquivariantBumps -variable {G E : Type*} [Group G] [Fintype G] - [NormedAddCommGroup E] [NormedSpace ℝ E] - -def equivariantBumpOperator (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) (x : E) : E →L[ℝ] E := - ∑ g, b (ρ g⁻¹ x) • (ρ g : E →L[ℝ] E) - -omit [Fintype G] in -theorem representation_cancel (ρ : G →* E ≃L[ℝ] E) (g : G) (x : E) : - ρ g⁻¹ (ρ g x) = x := by - change ((ρ g⁻¹) * ρ g) x = x - rw [← map_mul, inv_mul_cancel, map_one] - rfl - -omit [Fintype G] in -theorem representation_mul_apply (ρ : G →* E ≃L[ℝ] E) (g h : G) (x : E) : - ρ (g * h) x = ρ g (ρ h x) := by rw [map_mul]; rfl - -theorem equivariantBumpOperator_equivariant (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) - (h : G) (x : E) : - equivariantBumpOperator ρ b (ρ h x) = - (ρ h : E →L[ℝ] E).comp (equivariantBumpOperator ρ b x) := by - ext v - simp only [equivariantBumpOperator, sum_apply, smul_apply, - ContinuousLinearMap.comp_apply, map_sum, map_smul] - symm - apply Fintype.sum_equiv (Equiv.mulLeft h) - intro g - change b (ρ g⁻¹ x) • ρ h (ρ g v) = - b (ρ (h * g)⁻¹ (ρ h x)) • ρ (h * g) v - simp only [mul_inv_rev, representation_mul_apply, representation_cancel] - -theorem equivariantBumpOperator_contDiff (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) - (hb : ContDiff ℝ ∞ b) : ContDiff ℝ ∞ (equivariantBumpOperator ρ b) := by - apply ContDiff.sum - intro g _ - exact (hb.comp (ρ g⁻¹).contDiff).smul contDiff_const - -theorem unit_smul_equiv (a : ℝ) (ha : a ≠ 0) (e : E ≃L[ℝ] E) : - IsUnit (a • (e : E →L[ℝ] E)) := by - refine ⟨⟨a • (e : E →L[ℝ] E), a⁻¹ • (e.symm : E →L[ℝ] E), ?_, ?_⟩, rfl⟩ - · ext v - simp [smul_smul, ha] - · ext v - simp [smul_smul, ha] - -theorem equivariantBumpOperator_isUnit (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) - (hbd : Pairwise fun g h : G => Disjoint (ρ g '' tsupport b) (ρ h '' tsupport b)) - (x : E) (g : G) (hg : b (ρ g⁻¹ x) ≠ 0) : IsUnit (equivariantBumpOperator ρ b x) := by - have hx (k : G) (hk : b (ρ k⁻¹ x) ≠ 0) : x ∈ ρ k '' tsupport b := - ⟨ρ k⁻¹ x, subset_tsupport b hk, by simpa using representation_cancel ρ k⁻¹ x⟩ - have he : equivariantBumpOperator ρ b x = b (ρ g⁻¹ x) • (ρ g : E →L[ℝ] E) := by - apply Finset.sum_eq_single g - · intro h _ hh - have hh0 : b (ρ h⁻¹ x) = 0 := by - by_contra hh0 - exact Set.disjoint_left.mp (hbd hh) (hx h hh0) (hx g hg) - simp only [hh0, zero_smul] - · simp - rw [he] - exact unit_smul_equiv _ hg _ - -/-- A free orbit for a finite linear action has a neighborhood with pairwise -disjoint translates. No isometry hypothesis or metric constants are needed. -/ -theorem free_orbit_disjoint_neighborhood (ρ : G →* E ≃L[ℝ] E) (x : E) - (hx : ∀ g : G, ρ g x = x → g = 1) (W : Set E) (hW : IsOpen W) (hxW : x ∈ W) : - ∃ V : Set E, IsOpen V ∧ x ∈ V ∧ V ⊆ W ∧ - Pairwise fun g h : G => Disjoint (ρ g '' V) (ρ h '' V) := by - classical - have hsep (g : {g : G // g ≠ 1}) : - ∃ U : Set E, IsOpen U ∧ x ∈ U ∧ Disjoint U (ρ g.val '' U) := by - have hgx : x ≠ ρ g.val x := fun he => g.property (hx _ he.symm) - obtain ⟨A, B, hA, hB, hxA, hxB, hAB⟩ := t2_separation hgx - refine ⟨A ∩ (ρ g.val ⁻¹' B), hA.inter (hB.preimage (ρ g.val).continuous), ⟨hxA, hxB⟩, ?_⟩ - apply hAB.mono inter_subset_left - rintro y ⟨z, hz, rfl⟩ - exact hz.2 - choose U hU hxU hdU using hsep - let V : Set E := W ∩ ⋂ g : {g : G // g ≠ 1}, U g - have hVo : IsOpen V := hW.inter (isOpen_iInter_of_finite hU) - have hxV : x ∈ V := ⟨hxW, mem_iInter.mpr hxU⟩ - refine ⟨V, hVo, hxV, inter_subset_left, ?_⟩ - intro g h hgh - apply Set.disjoint_left.mpr - rintro y ⟨a, ha, rfl⟩ ⟨b, hb, he⟩ - have hk : g⁻¹ * h ≠ 1 := by - intro heq - apply hgh - have := congrArg (fun k => g * k) heq - simpa only [← mul_assoc, mul_inv_cancel, one_mul, mul_one] using this.symm - have haU : a ∈ U ⟨g⁻¹ * h, hk⟩ := mem_iInter.mp ha.2 _ - have hbU : b ∈ U ⟨g⁻¹ * h, hk⟩ := mem_iInter.mp hb.2 _ - apply Set.disjoint_left.mp (hdU ⟨g⁻¹ * h, hk⟩) haU - refine ⟨b, hbU, ?_⟩ - rw [representation_mul_apply, he, representation_cancel] - -variable [FiniteDimensional ℝ E] - -/-- The bump family used in the free part of the localized-degree argument. -Its complete closed support has disjoint translates, so each active parameter -block is invertible. -/ -theorem free_orbit_smooth_bump (ρ : G →* E ≃L[ℝ] E) (x : E) - (hx : ∀ g : G, ρ g x = x → g = 1) (W : Set E) (hW : IsOpen W) (hxW : x ∈ W) : - ∃ b : E → ℝ, ContDiff ℝ ∞ b ∧ HasCompactSupport b ∧ tsupport b ⊆ W ∧ b x = 1 ∧ - Pairwise fun g h : G => Disjoint (ρ g '' tsupport b) (ρ h '' tsupport b) := by - obtain ⟨V, hV, hxV, hVW, hdisj⟩ := free_orbit_disjoint_neighborhood ρ x hx W hW hxW - obtain ⟨b, hbV, hcb, hdb, _, hbx⟩ := exists_contDiff_tsupport_subset (n := (⊤ : ℕ∞)) (hV.mem_nhds hxV) - refine ⟨b, hdb, hcb, hbV.trans hVW, hbx, ?_⟩ - intro g h hgh - exact (hdisj hgh).mono (image_mono hbV) (image_mono hbV) - -end EquivariantBumps -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped ContDiff -section CompactRootStability -variable {P X Y : Type*} [TopologicalSpace P] [TopologicalSpace X] - [TopologicalSpace Y] [CompactSpace X] [T1Space Y] - -theorem compact_root_good_stability (f : P × X → Y) (hf : Continuous f) - (y : Y) (V : Set (P × X)) (hV : IsOpen V) (p₀ : P) - (h₀ : ∀ x, f (p₀, x) = y → (p₀, x) ∈ V) : - ∀ᶠ p in 𝓝 p₀, ∀ x, f (p, x) = y → (p, x) ∈ V := by - let C : Set (P × X) := {q | f q = y} ∩ Vᶜ - have hC : IsClosed C := (isClosed_singleton.preimage hf).inter hV.isClosed_compl - have hn : p₀ ∉ Prod.fst '' C := by - rintro ⟨⟨p, x⟩, ⟨hr, hv⟩, rfl⟩ - exact hv (h₀ x hr) - filter_upwards [(isClosedMap_fst_of_compactSpace _ hC).isOpen_compl.mem_nhds hn] with p hp - intro x hr - by_contra hv - exact hp ⟨(p, x), ⟨hr, hv⟩, rfl⟩ -end CompactRootStability - -section CompactFreeBumps -universe uE uG -variable {G : Type uG} {E : Type uE} [Group G] [Fintype G] [NormedAddCommGroup E] - [NormedSpace ℝ E] [FiniteDimensional ℝ E] - -theorem compact_free_bump_family (ρ : G →* E ≃L[ℝ] E) - (K W : Set E) (hK : IsCompact K) (hW : IsOpen W) (hKW : K ⊆ W) - (hfree : ∀ x ∈ K, ∀ g : G, ρ g x = x → g = 1) : - ∃ (ι : Type uE) (_ : Fintype ι) (b : ι → E → ℝ), - (∀ i, ContDiff ℝ ∞ (b i) ∧ HasCompactSupport (b i) ∧ tsupport (b i) ⊆ W ∧ - Pairwise fun g h : G => Disjoint (ρ g '' tsupport (b i)) (ρ h '' tsupport (b i))) ∧ - (∀ x ∈ K, ∃ i, IsUnit (equivariantBumpOperator ρ (b i) x)) := by - classical - have hb (x : K) := free_orbit_smooth_bump ρ x.val (hfree x.val x.property) - W hW (hKW x.property) - choose b hbd hbc hbs hbx hdis using hb - have hcov : K ⊆ ⋃ x : K, {y | b x y ≠ 0} := by - intro x hx - exact mem_iUnion.mpr ⟨⟨x, hx⟩, by simp [hbx]⟩ - obtain ⟨t, ht⟩ := hK.elim_finite_subcover (fun x : K => {y | b x y ≠ 0}) - (fun x => isOpen_ne_fun (hbd x).continuous continuous_const) hcov - refine ⟨{x // x ∈ t}, inferInstance, fun i => b i.val, ?_, ?_⟩ - · exact fun i => ⟨hbd i.val, hbc i.val, hbs i.val, hdis i.val⟩ - · intro x hx - obtain ⟨i, hi, hbix⟩ := Set.mem_iUnion₂.mp (ht hx) - refine ⟨⟨i, hi⟩, equivariantBumpOperator_isUnit ρ (b i) (hdis i) x 1 ?_⟩ - rw [inv_one, map_one] - exact hbix - -end CompactFreeBumps - -section LinearRegularization -variable {ι E : Type*} [Fintype ι] [DecidableEq ι] - [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] - [MeasurableSpace E] [BorelSpace E] - -omit [DecidableEq ι] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in -theorem linearPerturbation_contDiff (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (hf : ContDiff ℝ ∞ f) (hT : ∀ i, ContDiff ℝ ∞ (T i)) : - ContDiff ℝ ∞ (fun q : (ι → E) × E => linearPerturbation f T q.2 q.1) := by - apply (hf.comp contDiff_snd).add - apply ContDiff.sum - intro i _ - exact ((hT i).comp contDiff_snd).clm_apply ((contDiff_apply ℝ E i).comp contDiff_fst) - -omit [DecidableEq ι] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in -theorem linearPerturbationDerivative_continuous (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (hf : ContDiff ℝ ∞ f) (hT : ∀ i, ContDiff ℝ ∞ (T i)) : - Continuous (fun q : (ι → E) × E => linearPerturbationDerivative f T q.2 q.1) := by - apply (hf.continuous_fderiv (by norm_num)).comp continuous_snd |>.add - apply continuous_finsetSum - intro i _ - exact ((ContinuousLinearMap.flipₗᵢ ℝ E E E).continuous.comp - (((hT i).continuous_fderiv (by norm_num)).comp continuous_snd)).clm_apply - ((continuous_apply i).comp continuous_fst) - -/-- A finite linear bump family regularizes all roots on a compact set, provided -it has an invertible block at every initially critical root. The parameters -can be chosen in any prescribed neighborhood of zero. -/ -theorem exists_regular_linear_perturbation - (μ : MeasureTheory.Measure (ι → E)) [μ.IsAddHaarMeasure] - (f : E → E) (T : ι → E → (E →L[ℝ] E)) - (hf : ContDiff ℝ ∞ f) (hT : ∀ i, ContDiff ℝ ∞ (T i)) - (K : Set E) (hK : IsCompact K) - (hcover : ∀ x ∈ K, f x = 0 → (fderiv ℝ f x).det = 0 → ∃ i, IsUnit (T i x)) - (U : Set (ι → E)) (hU : U ∈ 𝓝 0) : - ∃ p ∈ U, ∀ x ∈ K, linearPerturbation f T x p = 0 → - (linearPerturbationDerivative f T x p).det ≠ 0 := by - let : CompactSpace K := isCompact_iff_compactSpace.mp hK - let F : (ι → E) × K → E := fun q => linearPerturbation f T q.2.val q.1 - let V : Set ((ι → E) × K) := {q | - (linearPerturbationDerivative f T q.2.val q.1).det ≠ 0 ∨ ∃ i, IsUnit (T i q.2.val)} - have hc : Continuous (fun q : (ι → E) × K => (q.1, q.2.val)) := - continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd) - have hV : IsOpen V := by - have hd : IsOpen {q : (ι → E) × K | - (linearPerturbationDerivative f T q.2.val q.1).det ≠ 0} := - isOpen_ne_fun (ContinuousLinearMap.continuous_det.comp - ((linearPerturbationDerivative_continuous f T hf hT).comp hc)) continuous_const - have ho := isOpen_iUnion (fun i => Units.isOpen.preimage ((hT i).continuous.comp - (continuous_subtype_val.comp (continuous_snd : Continuous (Prod.snd : (ι → E) × K → K))))) - have he : {q : (ι → E) × K | ∃ i, IsUnit (T i q.2.val)} = - ⋃ i, (T i ∘ Subtype.val ∘ Prod.snd) ⁻¹' {a | IsUnit a} := by - ext q - simp - have hi : IsOpen {q : (ι → E) × K | ∃ i, IsUnit (T i q.2.val)} := he ▸ ho - exact hd.union hi - have h₀ : ∀ x : K, F (0, x) = 0 → ((0 : ι → E), x) ∈ V := by - intro x hx - by_cases hd : (fderiv ℝ f x.val).det = 0 - · exact Or.inr (hcover x.val x.property (by simpa [F, linearPerturbation] using hx) hd) - · exact Or.inl (by simpa [linearPerturbationDerivative] using hd) - have he := compact_root_good_stability F ((linearPerturbation_contDiff f T hf hT).continuous.comp hc) - 0 V hV 0 h₀ - have hdense : Dense {p : ι → E | ∀ x ∈ K, linearPerturbation f T x p = 0 → - (∃ i, IsUnit (T i x)) → (linearPerturbationDerivative f T x p).det ≠ 0} := - MeasureTheory.Measure.dense_of_ae (ae_regular_linear_parameters μ f T K - (fun x _ => hf.differentiable (by norm_num) x) - (fun i x _ => (hT i).differentiable (by norm_num) x)) - obtain ⟨p, hpreg, hpU, hpgood⟩ := hdense.inter_nhds_nonempty (inter_mem hU he) - refine ⟨p, hpU, ?_⟩ - intro x hx hr - rcases hpgood ⟨x, hx⟩ hr with hd | hi - · exact hd - · exact hpreg x hx hr hi - -end LinearRegularization -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -section EquivariantRegularization -universe uE uG -variable {G : Type uG} {E : Type uE} [Group G] [Fintype G] [NormedAddCommGroup E] - [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] - -omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in -theorem equivariantBumpOperator_eventually_zero_outside - (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) (W : Set E) - (hb : tsupport b ⊆ W) (hinv : ∀ g x, x ∈ W → ρ g x ∈ W) - (x : E) (hx : x ∉ W) : equivariantBumpOperator ρ b =ᶠ[𝓝 x] 0 := by - have hzero (a : G) : ∀ᶠ y in 𝓝 x, b (ρ a⁻¹ y) = 0 := by - have hn : ρ a⁻¹ x ∉ tsupport b := by - intro hs - have hw := hinv a (ρ a⁻¹ x) (hb hs) - have he : ρ a (ρ a⁻¹ x) = x := by - rw [← representation_mul_apply, mul_inv_cancel, map_one] - rfl - exact hx (he ▸ hw) - filter_upwards [((isClosed_tsupport b).preimage (ρ a⁻¹).continuous).isOpen_compl.mem_nhds hn] - with y hy - exact image_eq_zero_of_notMem_tsupport hy - filter_upwards [Filter.eventually_all.mpr hzero] with y hy - change (∑ a : G, b (ρ a⁻¹ y) • (ρ a : E →L[ℝ] E)) = 0 - apply Finset.sum_eq_zero - intro a _ - rw [hy a, zero_smul] - -/-- The free-action regularization step. Critical roots must lie in the free -locus, but already regular fixed roots need not. The perturbation is unchanged -outside any chosen invariant open neighborhood of the critical roots. -/ -theorem exists_equivariant_regular_perturbation - (ρ : G →* E ≃L[ℝ] E) (f : E → E) (hf : ContDiff ℝ ∞ f) - (heq : ∀ g x, f (ρ g x) = ρ g (f x)) - (K W : Set E) (hK : IsCompact K) (hW : IsOpen W) - (hinv : ∀ g x, x ∈ W → ρ g x ∈ W) - (hcritical : ∀ x ∈ K, f x = 0 → (fderiv ℝ f x).det = 0 → - x ∈ W ∧ ∀ g : G, ρ g x = x → g = 1) - (ε : ℝ) (hε : 0 < ε) : - ∃ g : E → E, ContDiff ℝ ∞ g ∧ (∀ a x, g (ρ a x) = ρ a (g x)) ∧ - (∀ x ∉ W, g =ᶠ[𝓝 x] f) ∧ (∀ x ∈ K, ‖g x - f x‖ < ε) ∧ - ∀ x ∈ K, g x = 0 → (fderiv ℝ g x).det ≠ 0 := by - classical - let A : Set E := {x ∈ K | f x = 0 ∧ (fderiv ℝ f x).det = 0} - have hA : IsCompact A := hK.inter_right - ((isClosed_singleton.preimage hf.continuous).inter - (isClosed_singleton.preimage (ContinuousLinearMap.continuous_det.comp - (hf.continuous_fderiv (by norm_num))))) - obtain ⟨ι, hι, b, hb, hcover⟩ := compact_free_bump_family ρ A W hA hW - (fun x hx => (hcritical x hx.1 hx.2.1 hx.2.2).1) - (fun x hx => (hcritical x hx.1 hx.2.1 hx.2.2).2) - let := hι - let T : ι → E → (E →L[ℝ] E) := fun i => equivariantBumpOperator ρ (b i) - have hT (i : ι) : ContDiff ℝ ∞ (T i) := equivariantBumpOperator_contDiff ρ _ (hb i).1 - let : CompactSpace K := isCompact_iff_compactSpace.mp hK - have hc : Continuous (fun q : (ι → E) × K => (q.1, q.2.val)) := - continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd) - have hopen : IsOpen {q : (ι → E) × K | - ‖linearPerturbation f T q.2.val q.1 - f q.2.val‖ < ε} := - isOpen_lt (((linearPerturbation_contDiff f T hf hT).continuous.comp hc).sub - (hf.continuous.comp (continuous_subtype_val.comp continuous_snd))).norm continuous_const - have hsmall : ∀ᶠ p : ι → E in 𝓝 0, - ∀ x : K, ‖linearPerturbation f T x.val p - f x.val‖ < ε := by - have h := compact_root_good_stability (fun _ : (ι → E) × K => (0 : ℝ)) - continuous_const (0 : ℝ) _ hopen (0 : ι → E) (by - intro x _ - simpa [linearPerturbation] using hε) - filter_upwards [h] with p hp - exact fun x => hp x rfl - obtain ⟨p, hp, hreg⟩ := exists_regular_linear_perturbation - (Module.finBasis ℝ (ι → E)).addHaar f T hf hT K hK - (fun x hx hr hd => hcover x ⟨hx, hr, hd⟩) _ hsmall - refine ⟨fun x => linearPerturbation f T x p, ?_, ?_, ?_, ?_, ?_⟩ - · exact (linearPerturbation_contDiff f T hf hT).comp (contDiff_const.prodMk contDiff_id) - · intro a x - simp only [linearPerturbation, heq, map_add, map_sum] - congr 1 - apply Finset.sum_congr rfl - intro i _ - exact congrArg (fun L : E →L[ℝ] E => L (p i)) (equivariantBumpOperator_equivariant ρ (b i) a x) - · intro x hx - have hz (i : ι) : T i =ᶠ[𝓝 x] 0 := - equivariantBumpOperator_eventually_zero_outside ρ (b i) W (hb i).2.2.1 hinv x hx - filter_upwards [Filter.eventually_all.mpr hz] with y hy - simp only [linearPerturbation, hy, Pi.zero_apply, zero_apply, - Finset.sum_const_zero, add_zero] - · intro x hx - exact hp ⟨x, hx⟩ - · intro x hx hr - rw [(linearPerturbation_hasFDerivAt f T (hf.differentiable (by norm_num) x) - (fun i => (hT i).differentiable (by norm_num) x) p).fderiv] - exact hreg x hx hr - -end EquivariantRegularization -end EilenbergGanea -namespace EilenbergGanea -open Set Filter Topology -open scoped ContDiff -section MixedRegularization -variable {G A V : Type*} [Group G] [Fintype G] - [NormedAddCommGroup A] [NormedSpace ℝ A] [FiniteDimensional ℝ A] - [NormedAddCommGroup V] [NormedSpace ℂ V] [NormedSpace ℝ V] - [IsScalarTower ℝ ℂ V] [FiniteDimensional ℂ V] - -def scalarRotationRepresentation (χ : G →* ℂˣ) : G →* (A × V) ≃L[ℝ] (A × V) where - toFun g := scalarRotation (χ g) - map_one' := by - apply ContinuousLinearEquiv.ext - funext q - change scalarRotation (χ 1) q = q - simp [scalarRotation_apply] - map_mul' g h := by - apply ContinuousLinearEquiv.ext - funext q - change scalarRotation (χ (g * h)) q = scalarRotation (χ g) (scalarRotation (χ h) q) - simp [mul_smul] - -omit [Fintype G] [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] in -@[simp] theorem scalarRotationRepresentation_apply (χ : G →* ℂˣ) (g : G) (q : A × V) : - scalarRotationRepresentation χ g q = (q.1, (χ g : ℂ) • q.2) := rfl - -omit [Fintype G] [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] in - theorem scalarRotation_free (χ : G →* ℂˣ) (hχ : Function.Injective χ) - (q : A × V) (hq : q.2 ≠ 0) : - ∀ g : G, scalarRotationRepresentation χ g q = q → g = 1 := by - intro g hg - have hh : (χ g : ℂ) • q.2 = (1 : ℂ) • q.2 := by - have hg_snd := congrArg Prod.snd hg - change (χ g : ℂ) • q.2 = q.2 at hg_snd - simpa using hg_snd - have he : (χ g : ℂ) = 1 := (smul_left_injective ℂ hq) hh - apply hχ - apply Units.ext - simpa using he - -omit [Fintype G] [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] in - theorem normalShift_equivariant (χ : G →* ℂˣ) (f : A × V → A × V) - (hf : ∀ g q, f (scalarRotationRepresentation χ g q) = - scalarRotationRepresentation χ g (f q)) (s : ℝ) : - ∀ g q, normalShift f s (scalarRotationRepresentation χ g q) = - scalarRotationRepresentation χ g (normalShift f s q) := by - intro g q - simp only [normalShift, hf, map_add, map_smul] - congr 1 - -/-- The full fixed-plus-free regularization step in fixed/normal coordinates. -Unlike an assumed transversality interface, this is assembled from the finite -normal spectrum argument and explicit free-orbit bump parameters above. -/ -theorem exists_fixed_free_regularization (χ : G →* ℂˣ) (hχ : Function.Injective χ) - (a₀ : G) (ha₀ : (χ a₀ : ℂ).im ≠ 0) - (f : A × V → A × V) (hf : ContDiff ℝ ∞ f) - (he : ∀ g q, f (scalarRotationRepresentation χ g q) = - scalarRotationRepresentation χ g (f q)) - (K : Set (A × V)) (hK : IsCompact K) (S : Finset A) - (hS : ∀ a, (a, 0) ∈ K → f (a, 0) = 0 → a ∈ S) - (c : ℝ) (hc : c ≠ 0) - (hT : ∀ a ∈ S, (fderiv ℝ (fixedRestriction f) a).det = c) - (ε : ℝ) (hε : 0 < ε) : - ∃ g : A × V → A × V, ContDiff ℝ ∞ g ∧ - (∀ a q, g (scalarRotationRepresentation χ a q) = - scalarRotationRepresentation χ a (g q)) ∧ - (∀ a, g (a, 0) = f (a, 0)) ∧ - (∀ q ∈ K, ‖g q - f q‖ < ε) ∧ - (∀ q ∈ K, g q = 0 → (fderiv ℝ g q).det ≠ 0) ∧ - (∀ a ∈ S, (0 < (fderiv ℝ g (a, 0)).det ↔ 0 < c)) := by - classical - let : FiniteDimensional ℝ V := Module.Finite.trans ℂ V - let : MeasurableSpace (A × V) := borel (A × V) - let : BorelSpace (A × V) := ⟨rfl⟩ - let ρ := scalarRotationRepresentation (A := A) (V := V) χ - obtain ⟨R, hR, hbound⟩ := hK.isBounded.exists_pos_norm_lt - have hδ : 0 < (ε / 2) / (R + 1) := div_pos (by linarith) (by linarith) - obtain ⟨s, hs, hreg⟩ := exists_normalShift_regular_fixed f - (hf.differentiable (by simp)) (χ a₀) ha₀ (he a₀) S c hc hT _ hδ - let f₁ := normalShift f s - have hf₁ : ContDiff ℝ ∞ f₁ := normalShift_contDiff f hf s - have he₁ : ∀ a q, f₁ (ρ a q) = ρ a (f₁ q) := normalShift_equivariant χ f he s - have hsmall : ∀ q ∈ K, ‖f₁ q - f q‖ < ε / 2 := by - intro q hq - have hnorm : ‖normalProjection q‖ ≤ R + 1 := by - simp only [normalProjection_apply, Prod.norm_def, norm_zero, max_eq_right (norm_nonneg _)] - exact (norm_snd_le q).trans (hbound q hq).le |>.trans (by linarith) - calc - ‖f₁ q - f q‖ = |s| * ‖normalProjection q‖ := by simp only [f₁, normalShift, add_sub_cancel_left, norm_smul, Real.norm_eq_abs] - _ ≤ |s| * (R + 1) := mul_le_mul_of_nonneg_left hnorm (abs_nonneg _) - _ < ε / 2 := (lt_div_iff₀ (by linarith : 0 < R + 1)).mp hs - let W : Set (A × V) := {q | q.2 ≠ 0} - have hW : IsOpen W := (isClosed_singleton.preimage continuous_snd).isOpen_compl - have hinv : ∀ a q, q ∈ W → ρ a q ∈ W := by - intro a q hq - exact smul_ne_zero (Units.ne_zero _) hq - have hcritical : ∀ q ∈ K, f₁ q = 0 → (fderiv ℝ f₁ q).det = 0 → - q ∈ W ∧ ∀ a : G, ρ a q = q → a = 1 := by - intro q hq hr hd - have hn : q.2 ≠ 0 := by - intro hz - have hqeq : q = (q.1, 0) := Prod.ext rfl hz - rw [hqeq] at hq hr hd - have ha : q.1 ∈ S := hS q.1 hq (by simpa [f₁] using hr) - exact (hreg q.1 ha).1 hd - exact ⟨hn, scalarRotation_free χ hχ q hn⟩ - obtain ⟨g, hg, hge, hprotected, hclose, hgood⟩ := - exists_equivariant_regular_perturbation ρ f₁ hf₁ he₁ K W hK hW hinv hcritical - (ε / 2) (by linarith) - refine ⟨g, hg, hge, ?_, ?_, hgood, ?_⟩ - · intro a - exact ((hprotected (a, 0) (by simp [W])).eq_of_nhds).trans (normalShift_fixed f s a) - · intro q hq - have hh := norm_sub_le_norm_sub_add_norm_sub (g q) (f₁ q) (f q) - linarith [hclose q hq, hsmall q hq] - · intro a ha - have hd := (hprotected (a, 0) (by simp [W])).fderiv_eq (𝕜 := ℝ) - rw [hd] - exact (hreg a ha).2 - -end MixedRegularization -end EilenbergGanea - - -namespace EilenbergGanea -section SignedAction -variable {G X : Type*} [Group G] [MulAction G X] - -@[instance_reducible] def invariantSubtypeAction (P : X → Prop) (hP : ∀ (g : G) x, P x → P (g • x)) : - MulAction G {x // P x} where - smul g x := ⟨g • x.1, hP g x.1 x.2⟩ - one_smul x := Subtype.ext (one_smul G x.1) - mul_smul g h x := Subtype.ext (mul_smul g h x.1) - -theorem signed_finite_action_nonzero {p : ℕ} [Fact p.Prime] [Fintype X] - (hG : IsPGroup p G) (σ : X → Bool) - (hσ : ∀ (g : G) x, σ (g • x) = σ x) - (b : Bool) (hb : ∀ x ∈ MulAction.fixedPoints G X, σ x = b) - (hex : (MulAction.fixedPoints G X).Nonempty) - (hsmall : Nat.card (MulAction.fixedPoints G X) < p) : - (∑ x : X, (if σ x then (1 : ℤ) else -1)) ≠ 0 := by - classical - let A := {x : X // σ x = b} - let B := {x : X // σ x ≠ b} - let : MulAction G A := invariantSubtypeAction _ (by intro g x hx; simpa [hσ] using hx) - let : MulAction G B := invariantSubtypeAction _ (by intro g x hx; simpa [hσ] using hx) - let e : MulAction.fixedPoints G A ≃ MulAction.fixedPoints G X := - { toFun := fun x => ⟨x.1.1, fun g => congrArg Subtype.val (x.2 g)⟩ - invFun := fun x => ⟨⟨x.1, hb x.1 x.2⟩, fun g => Subtype.ext (x.2 g)⟩ - left_inv := by intro x; rfl - right_inv := by intro x; rfl } - have hempty : IsEmpty (MulAction.fixedPoints G B) := ⟨by - intro x - have hx : x.1.1 ∈ MulAction.fixedPoints G X := fun g => congrArg Subtype.val (x.2 g) - exact x.1.2 (hb x.1.1 hx)⟩ - have hnon : Nonempty (MulAction.fixedPoints G X) := hex.to_subtype - have hpos : 0 < Nat.card (MulAction.fixedPoints G A) := by - rw [Nat.card_congr e] - exact Nat.card_pos - have hs : Nat.card (MulAction.fixedPoints G A) < p := by rw [Nat.card_congr e]; exact hsmall - have hn : Nat.card (MulAction.fixedPoints G B) = 0 := by simp - have hneq : Nat.card A ≠ Nat.card B := by - intro hh - have h := (hG.card_modEq_card_fixedPoints A).symm - rw [hh] at h - have h' := h.trans (hG.card_modEq_card_fixedPoints B) - rw [hn] at h' - have heq := h'.eq_of_lt_of_lt hs (Fact.out : p.Prime).pos - omega - have hcounts : (∑ x : X, (if σ x = b then (1 : ℤ) else -1)) = - (Nat.card A : ℤ) - Nat.card B := by - rw [Finset.sum_ite] - simp [A, B, Nat.card_eq_fintype_card, Fintype.card_subtype, sub_eq_add_neg] - intro hz - have hz' : (∑ x : X, (if σ x = b then (1 : ℤ) else -1)) = 0 := by - cases b - · have hh : (fun x : X => if σ x = false then (1 : ℤ) else -1) = - fun x => -(if σ x then (1 : ℤ) else -1) := by funext x; cases σ x <;> rfl - rw [hh, Finset.sum_neg_distrib, hz, neg_zero] - · simpa using hz - rw [hcounts, sub_eq_zero] at hz' - exact hneq (by exact_mod_cast hz') -end SignedAction -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped ContDiff -variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] - [FiniteDimensional ℝ E] - -/- A nonsingular derivative supplies an open inverse patch, without assuming -that the map is proper or globally injective. -/ -theorem exists_regular_inverse_patch (f : E → E) {x : E} - (hf : ContDiffAt ℝ 1 f x) (hd : (fderiv ℝ f x).det ≠ 0) : - ∃ V : Set E, IsOpen V ∧ x ∈ V ∧ InjOn f V ∧ - IsOpen (f '' V) := by - let e := (fderiv ℝ f x).toContinuousLinearEquivOfDetNeZero hd - have he : (e : E →L[ℝ] E) = fderiv ℝ f x := rfl - have hf' : HasFDerivAt f (e : E →L[ℝ] E) x := by - rw [he] - exact (hf.differentiableAt (by norm_num)).hasFDerivAt - let p := hf.toOpenPartialHomeomorph f hf' (by norm_num) - refine ⟨p.source, p.open_source, hf.mem_toOpenPartialHomeomorph_source hf' (by norm_num), - p.injOn, ?_⟩ - change IsOpen (p '' p.source) - rw [p.image_source_eq_target] - exact p.open_target - -/- A regular level set is discrete. Only smoothness at the level set is -required. -/ -theorem regular_fiber_isDiscrete (f : E → E) (y : E) (K : Set E) - (hf : ∀ x ∈ K, f x = y → ContDiffAt ℝ 1 f x) - (hd : ∀ x ∈ K, f x = y → (fderiv ℝ f x).det ≠ 0) : - IsDiscrete (K ∩ f ⁻¹' {y}) := by - rw [isDiscrete_iff_forall_mem_exists_isOpen] - rintro x ⟨hxK, hxy⟩ - obtain ⟨V, ho, hxV, hi, _⟩ := exists_regular_inverse_patch f (hf x hxK hxy) (hd x hxK hxy) - refine ⟨V, ho, ?_⟩ - ext z - constructor - · rintro ⟨hzV, hzK, hzy⟩ - exact hi hzV hxV (hzy.trans hxy.symm) - · rintro rfl - exact ⟨hxV, hxK, hxy⟩ - -/- Compact regular fibers are finite, in the form needed by the signed -count formula after regularization. -/ -theorem compact_regular_fiber_finite (f : E → E) (y : E) (K : Set E) - (hK : IsCompact K) (hf : ContinuousOn f K) - (hs : ∀ x ∈ K, f x = y → ContDiffAt ℝ 1 f x) - (hd : ∀ x ∈ K, f x = y → (fderiv ℝ f x).det ≠ 0) : - (K ∩ f ⁻¹' {y}).Finite := by - exact (hK.of_isClosed_subset (hf.preimage_isClosed_of_isClosed hK.isClosed - isClosed_singleton) inter_subset_left).finite - (regular_fiber_isDiscrete f y K hs hd) - - -end EilenbergGanea -namespace EilenbergGanea -open Set Filter Topology -open scoped ContDiff -section LocalizedRegularization -variable {G A V : Type*} [Group G] [Fintype G] - [NormedAddCommGroup A] [NormedSpace ℝ A] [FiniteDimensional ℝ A] - [NormedAddCommGroup V] [NormedSpace ℂ V] [NormedSpace ℝ V] - [IsScalarTower ℝ ℂ V] [FiniteDimensional ℂ V] - -/-- The localized noncancellation part of degree, now for actual regular -perturbations of a smooth map, not an assumed finite-orbit-count interface. -/ -theorem exists_regularization_nonzero_count {p : ℕ} [Fact p.Prime] - (hG : IsPGroup p G) (χ : G →* ℂˣ) (hχ : Function.Injective χ) - (a₀ : G) (ha₀ : (χ a₀ : ℂ).im ≠ 0) - (f : A × V → A × V) (hf : ContDiff ℝ ∞ f) - (he : ∀ a q, f (scalarRotationRepresentation χ a q) = - scalarRotationRepresentation χ a (f q)) - (K : Set (A × V)) (hK : IsCompact K) - (hKi : ∀ a q, q ∈ K → scalarRotationRepresentation χ a q ∈ K) - (L : Set (A × V)) (hL : IsCompact L) (hKL : K ⊆ L) - (S : Finset A) (hS : ∀ a, (a, 0) ∈ L → f (a, 0) = 0 → a ∈ S) - (hex : ∃ a, (a, 0) ∈ K ∧ f (a, 0) = 0) (hSp : S.card < p) - (c : ℝ) (hc : c ≠ 0) - (hT : ∀ a ∈ S, (fderiv ℝ (fixedRestriction f) a).det = c) - (ε : ℝ) (hε : 0 < ε) : - ∃ g : A × V → A × V, ContDiff ℝ ∞ g ∧ - (∀ q ∈ L, ‖g q - f q‖ < ε) ∧ - ∃ s : Finset (A × V), (∀ q, q ∈ s ↔ q ∈ K ∧ g q = 0) ∧ - (∀ q ∈ s, (fderiv ℝ g q).det ≠ 0) ∧ - (∑ q ∈ s, (if 0 < (fderiv ℝ g q).det then 1 else -1 : ℝ)) ≠ 0 := by - classical - let : FiniteDimensional ℝ V := Module.Finite.trans ℂ V - let ρ := scalarRotationRepresentation (A := A) (V := V) χ - obtain ⟨g, hg, hge, hgf, hclose, hreg, hsign⟩ := exists_fixed_free_regularization - χ hχ a₀ ha₀ f hf he L hL S hS c hc hT ε hε - have hfinite : (K ∩ g ⁻¹' {0}).Finite := compact_regular_fiber_finite g 0 K hK - hg.continuous.continuousOn (fun q _ _ => hg.of_le (by norm_num) |>.contDiffAt) (fun q hq => hreg q (hKL hq)) - let s := hfinite.toFinset - have hs : ∀ q, q ∈ s ↔ q ∈ K ∧ g q = 0 := by intro q; exact hfinite.mem_toFinset - let X := {q : A × V // q ∈ K ∧ g q = 0} - let : Fintype X := hfinite.fintype - let : MulAction G (A × V) := { - smul := fun a q => ρ a q - one_smul := by intro q; change ρ 1 q = q; rw [map_one]; rfl - mul_smul := by intro a b q; change ρ (a * b) q = ρ a (ρ b q); rw [map_mul]; rfl } - let : MulAction G X := invariantSubtypeAction _ (by - intro a q hq - refine ⟨hKi a q hq.1, ?_⟩ - change g (ρ a q) = 0 - rw [hge, hq.2, map_zero]) - have hfixed (x : MulAction.fixedPoints G X) : x.1.1.2 = 0 := by - by_contra hn - have hh := congrArg (fun q : X => q.1.2) (x.2 a₀) - change (χ a₀ : ℂ) • x.1.1.2 = x.1.1.2 at hh - have hh' : (χ a₀ : ℂ) • x.1.1.2 = (1 : ℂ) • x.1.1.2 := by simpa using hh - have heq := (smul_left_injective ℂ hn) hh' - exact ha₀ (by rw [heq]; rfl) - have hmem (x : MulAction.fixedPoints G X) : x.1.1.1 ∈ S := by - have hx := x.1.2 - have heq : x.1.1 = (x.1.1.1, 0) := Prod.ext rfl (hfixed x) - rw [heq] at hx - exact hS _ (hKL hx.1) (by rw [← hgf]; exact hx.2) - let e : MulAction.fixedPoints G X ↪ S := - ⟨fun x => ⟨x.1.1.1, hmem x⟩, by - intro x y h - apply Subtype.ext - apply Subtype.ext - apply Prod.ext - · exact congrArg Subtype.val h - · exact (hfixed x).trans (hfixed y).symm⟩ - have hsmall : Nat.card (MulAction.fixedPoints G X) < p := - (Nat.card_le_card_of_injective e e.injective).trans_lt (by simpa using hSp) - have hex' : (MulAction.fixedPoints G X).Nonempty := by - obtain ⟨a, haK, haf⟩ := hex - refine ⟨⟨(a, 0), haK, by rw [hgf]; exact haf⟩, ?_⟩ - intro b - apply Subtype.ext - change ρ b (a, 0) = (a, 0) - simp [ρ] - let σ : X → Bool := fun q => decide (0 < (fderiv ℝ g q.1).det) - have hσ : ∀ (a : G) (q : X), σ (a • q) = σ q := by - intro a q - unfold σ - congr 1 - exact congrArg (fun t : ℝ => 0 < t) - (equivariant_fderiv_det g (ρ a) (hg.differentiable (by simp)) (hge a) q.1) - have hb : ∀ q ∈ MulAction.fixedPoints G X, σ q = decide (0 < c) := by - intro q hq - let x : MulAction.fixedPoints G X := ⟨q, hq⟩ - have heq : q.1 = (q.1.1, 0) := Prod.ext rfl (hfixed x) - change decide (0 < (fderiv ℝ g q.1).det) = decide (0 < c) - rw [heq] - exact decide_eq_decide.mpr (hsign _ (hmem x)) - have hcount := signed_finite_action_nonzero hG σ hσ (decide (0 < c)) hb hex' hsmall - refine ⟨g, hg, hclose, s, hs, fun q hq => hreg q (hKL ((hs q).mp hq).1) ((hs q).mp hq).2, ?_⟩ - have hsum : (∑ q ∈ s, (if 0 < (fderiv ℝ g q).det then (1 : ℤ) else -1)) ≠ 0 := by - have hsum' : (∑ q : X, (if σ q then (1 : ℤ) else -1)) = - ∑ q ∈ s, (if 0 < (fderiv ℝ g q).det then (1 : ℤ) else -1) := by - unfold σ - simpa only [decide_eq_true_eq] using (Finset.sum_subtype s hs - (fun q => if 0 < (fderiv ℝ g q).det then (1 : ℤ) else -1)).symm - exact hsum' ▸ hcount - exact_mod_cast hsum -end LocalizedRegularization -end EilenbergGanea - - -end - -end OAI +import Mathlib.Tactic +import Mathlib.Analysis.Calculus.InverseFunctionTheorem.FiniteDimensional +import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff +import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension +import Mathlib.Analysis.Calculus.BumpFunction.SmoothApprox +import Mathlib.Analysis.Calculus.FDeriv.Equiv +import Mathlib.Analysis.Complex.Basic +import Mathlib.Analysis.InnerProductSpace.PiL2 +import Mathlib.RingTheory.Complex +import Mathlib.LinearAlgebra.Eigenspace.Minpoly +import Mathlib.MeasureTheory.Function.Jacobian + +namespace OAI + +noncomputable section + +open Set Filter Topology + +/-! Localized regularization for finite SU(2) systems. -/ +namespace EilenbergGanea +section ComplexCentralizer +variable {V : Type*} [AddCommGroup V] [Module ℂ V] [Module ℝ V] + [IsScalarTower ℝ ℂ V] + +theorem complex_smul_decompose (z : ℂ) (x : V) : + z • x = z.re • x + z.im • (Complex.I • x) := by + conv_lhs => rw [← Complex.re_add_im z] + rw [add_smul, mul_smul] + change (algebraMap ℝ ℂ z.re) • x + + (algebraMap ℝ ℂ z.im) • (Complex.I • x) = _ + simp only [IsScalarTower.algebraMap_smul] + +/-- Commuting with a non-real scalar forces a real-linear map to be complex-linear. -/ +theorem realLinear_map_complex_smul (f : V →ₗ[ℝ] V) (z : ℂ) (hz : z.im ≠ 0) + (hf : ∀ x, f (z • x) = z • f x) (w : ℂ) (x : V) : + f (w • x) = w • f x := by + have hI (y : V) : f (Complex.I • y) = Complex.I • f y := by + have he := hf y + rw [complex_smul_decompose z y, complex_smul_decompose z (f y), + map_add, map_smul, map_smul] at he + exact smul_right_injective V hz (add_left_cancel he) + rw [complex_smul_decompose w x, complex_smul_decompose w (f x), + map_add, map_smul, map_smul, hI] + +theorem complexLinear_of_commutes_nonreal (N : V →ₗ[ℝ] V) (z : ℂ) (hz : z.im ≠ 0) + (h : ∀ v, N (z • v) = z • N v) : + ∃ C : V →ₗ[ℂ] V, C.restrictScalars ℝ = N := by + let C : V →ₗ[ℂ] V := + { toFun := N + map_add' := N.map_add + map_smul' := realLinear_map_complex_smul N z hz h } + exact ⟨C, rfl⟩ + +end ComplexCentralizer + +section RotationDerivative +variable {A V : Type*} [AddCommGroup A] [Module ℝ A] + [AddCommGroup V] [Module ℂ V] [Module ℝ V] [IsScalarTower ℝ ℂ V] + +/-- A real derivative commuting with the fixed-plus-rotating representation +has no mixed blocks. Its normal block is complex-linear. -/ +theorem rotation_commutant_blocks (L : A × V →ₗ[ℝ] A × V) + (z : ℂ) (hz : z.im ≠ 0) + (h : ∀ a v, L (a, z • v) = ((L (a, v)).1, z • (L (a, v)).2)) : + ∃ (T : A →ₗ[ℝ] A) (N : V →ₗ[ℂ] V), + L = T.prodMap (N.restrictScalars ℝ) := by + have hz1 : z ≠ 1 := by intro he; simp [he] at hz + let T := (LinearMap.fst ℝ A V).comp (L.comp (LinearMap.inl ℝ A V)) + let N := (LinearMap.snd ℝ A V).comp (L.comp (LinearMap.inr ℝ A V)) + let P := (LinearMap.fst ℝ A V).comp (L.comp (LinearMap.inr ℝ A V)) + have hP (v : V) : P (z • v) = P v := by + have hv := congrArg Prod.fst (h 0 v) + exact hv + have hPzero (v : V) : P v = 0 := by + let u := (z - 1)⁻¹ • v + have huv : z • u - u = v := by + dsimp [u] + calc + z • ((z - 1)⁻¹ • v) - (z - 1)⁻¹ • v = + (z - 1) • ((z - 1)⁻¹ • v) := by rw [sub_smul, one_smul] + _ = v := by rw [smul_smul, mul_inv_cancel₀ (sub_ne_zero.mpr hz1), one_smul] + rw [← huv, map_sub, hP, sub_self] + have hQzero (a : A) : (L (a, 0)).2 = 0 := by + have hv := congrArg Prod.snd (h a 0) + simp only [smul_zero] at hv + have hh : (z - 1) • (L (a, 0)).2 = 0 := by + rw [sub_smul, one_smul, ← hv, sub_self] + exact (smul_eq_zero.mp hh).resolve_left (sub_ne_zero.mpr hz1) + obtain ⟨C, hC⟩ := complexLinear_of_commutes_nonreal N z hz + (fun v => congrArg Prod.snd (h 0 v)) + refine ⟨T, C, ?_⟩ + rw [hC] + apply LinearMap.ext + intro q + apply Prod.ext + · change (L q).1 = T q.1 + have he : q = (q.1, 0) + (0, q.2) := by simp + rw [he, map_add] + change T q.1 + P q.2 = _ + rw [hPzero, add_zero] + simp + · change (L q).2 = N q.2 + have he : q = (q.1, 0) + (0, q.2) := by simp + rw [he, map_add] + change (L (q.1, 0)).2 + N q.2 = _ + rw [hQzero, zero_add] + simp + +end RotationDerivative + +section NormalDeterminant +variable {V : Type*} [AddCommGroup V] [Module ℂ V] [Module ℝ V] + [IsScalarTower ℝ ℂ V] [FiniteDimensional ℂ V] + +theorem complex_real_det_nonneg (N : V →ₗ[ℂ] V) : + 0 ≤ (N.restrictScalars ℝ).det := by + rw [LinearMap.det_restrictScalars, Algebra.norm_complex_apply] + exact Complex.normSq_nonneg _ + +theorem complex_real_det_pos (N : V →ₗ[ℂ] V) (hN : N.det ≠ 0) : + 0 < (N.restrictScalars ℝ).det := by + rw [LinearMap.det_restrictScalars, Algebra.norm_complex_apply] + exact Complex.normSq_pos.mpr hN + +end NormalDeterminant + +section SimultaneousShift +open Set +variable {V : Type*} [AddCommGroup V] [Module ℂ V] [FiniteDimensional ℂ V] + +/-- A single real scalar regularizes any finite collection of normal blocks. -/ +theorem exists_small_simultaneous_regular_shift {ι : Type*} [Fintype ι] + (N : ι → Module.End ℂ V) {ε : ℝ} (hε : 0 < ε) : + ∃ s : ℝ, |s| < ε ∧ ∀ i, IsUnit (N i + algebraMap ℂ (Module.End ℂ V) (s : ℂ)) := by + let bad : Set ℝ := ⋃ i, {r | -(r : ℂ) ∈ spectrum ℂ (N i)} + have hbad : bad.Finite := Set.finite_iUnion (fun i => + (Module.End.finite_spectrum (N i)).preimage + (fun _ _ _ _ h => Complex.ofReal_injective (neg_injective h))) + obtain ⟨s, hs, hgood⟩ := (Set.Ioo_infinite (by linarith : -ε < ε)).exists_notMem_finite hbad + refine ⟨s, abs_lt.mpr hs, fun i => ?_⟩ + have hn : -(s : ℂ) ∉ spectrum ℂ (N i) := by + intro hh + exact hgood (Set.mem_iUnion.mpr ⟨i, hh⟩) + have hi := (spectrum.notMem_iff.mp hn).neg + simpa only [map_neg, neg_sub, sub_neg_eq_add] using hi + +end SimultaneousShift +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped ContDiff +section EquivariantDerivative +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +omit [FiniteDimensional ℝ E] in +theorem equivariant_fderiv (f : E → E) (L : E ≃L[ℝ] E) + (hf : Differentiable ℝ f) (he : ∀ x, f (L x) = L (f x)) (x : E) : + (fderiv ℝ f (L x)).comp L.toContinuousLinearMap = + L.toContinuousLinearMap.comp (fderiv ℝ f x) := by + have h₁ := (hf (L x)).hasFDerivAt.comp x L.hasFDerivAt + have h₂ := L.hasFDerivAt.comp x (hf x).hasFDerivAt + have hh : f ∘ L = L ∘ f := funext he + rw [hh] at h₁ + exact h₁.unique h₂ + +omit [FiniteDimensional ℝ E] in +theorem equivariant_fderiv_det (f : E → E) (L : E ≃L[ℝ] E) + (hf : Differentiable ℝ f) (he : ∀ x, f (L x) = L (f x)) (x : E) : + (fderiv ℝ f (L x)).det = (fderiv ℝ f x).det := by + have h := congrArg (fun M : E →L[ℝ] E => M.det) (equivariant_fderiv f L hf he x) + change ((fderiv ℝ f (L x)).toLinearMap.comp L.toLinearEquiv.toLinearMap).det = + (L.toLinearEquiv.toLinearMap.comp (fderiv ℝ f x).toLinearMap).det at h + rw [LinearMap.det_comp, LinearMap.det_comp, mul_comm] at h + exact mul_left_cancel₀ L.toLinearEquiv.isUnit_det'.ne_zero h +end EquivariantDerivative + +section FixedRegularization +variable {A V : Type*} [NormedAddCommGroup A] [NormedSpace ℝ A] + [NormedAddCommGroup V] [NormedSpace ℝ V] + +/-- The complement of the fixed subspace. -/ +def normalProjection : (A × V) →L[ℝ] (A × V) := + (ContinuousLinearMap.inr ℝ A V).comp (ContinuousLinearMap.snd ℝ A V) + +@[simp] theorem normalProjection_apply (x : A × V) : normalProjection x = (0, x.2) := rfl + +def normalShift (f : A × V → A × V) (s : ℝ) (x : A × V) := f x + s • normalProjection x + +theorem normalShift_contDiff (f : A × V → A × V) (hf : ContDiff ℝ ∞ f) (s : ℝ) : + ContDiff ℝ ∞ (normalShift f s) := + hf.add ((show ContDiff ℝ ∞ (fun _ : A × V => s) from contDiff_const).smul + (normalProjection (A := A) (V := V)).contDiff) + +theorem normalShift_fderiv (f : A × V → A × V) (hf : Differentiable ℝ f) (s : ℝ) (x : A × V) : + fderiv ℝ (normalShift f s) x = fderiv ℝ f x + s • normalProjection := + ((hf x).hasFDerivAt.add ((normalProjection (A := A) (V := V)).hasFDerivAt.const_smul s)).fderiv + +@[simp] theorem normalShift_fixed (f : A × V → A × V) (s : ℝ) (a : A) : + normalShift f s (a, 0) = f (a, 0) := by simp [normalShift] + +variable [NormedSpace ℂ V] [IsScalarTower ℝ ℂ V] + +def scalarRotation (z : ℂˣ) : (A × V) ≃L[ℝ] (A × V) := + (ContinuousLinearEquiv.refl ℝ A).prodCongr + ((ContinuousLinearEquiv.smulLeft z : V ≃L[ℂ] V).restrictScalars ℝ) + +@[simp] theorem scalarRotation_apply (z : ℂˣ) (q : A × V) : + scalarRotation z q = (q.1, (z : ℂ) • q.2) := rfl + +/-- At a fixed point the derivative splits with a complex-linear normal block. -/ +theorem fixed_fderiv_blocks (f : A × V → A × V) (hf : Differentiable ℝ f) + (z : ℂˣ) (hz : (z : ℂ).im ≠ 0) + (he : ∀ q, f (scalarRotation z q) = scalarRotation z (f q)) (a : A) : + ∃ (T : A →ₗ[ℝ] A) (N : V →ₗ[ℂ] V), + (fderiv ℝ f (a, 0)).toLinearMap = T.prodMap (N.restrictScalars ℝ) := by + apply rotation_commutant_blocks _ (z : ℂ) hz + intro b v + have h := congrArg (fun L : (A × V) →L[ℝ] (A × V) => L (b, v)) (equivariant_fderiv f (scalarRotation z) hf he (a, 0)) + simpa using h + +variable [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] + +/-- Scalar shifts have the claimed fixed-block Jacobian, with no chart convention. -/ +theorem normalShift_fixed_det (f : A × V → A × V) (hf : Differentiable ℝ f) + (a : A) (T : A →ₗ[ℝ] A) (N : V →ₗ[ℂ] V) + (h : (fderiv ℝ f (a, 0)).toLinearMap = T.prodMap (N.restrictScalars ℝ)) (s : ℝ) : + (fderiv ℝ (normalShift f s) (a, 0)).det = + T.det * ((N + algebraMap ℂ (Module.End ℂ V) (s : ℂ)).restrictScalars ℝ).det := by + let : FiniteDimensional ℝ V := Module.Finite.trans ℂ V + rw [normalShift_fderiv f hf] + have he : (fderiv ℝ f (a, 0) + s • normalProjection).toLinearMap = + T.prodMap ((N + algebraMap ℂ (Module.End ℂ V) (s : ℂ)).restrictScalars ℝ) := by + apply LinearMap.ext + intro q + have hh := LinearMap.congr_fun h q + change (fderiv ℝ f (a, 0)) q + s • (0, q.2) = _ + change (fderiv ℝ f (a, 0)) q = (T q.1, N q.2) at hh + rw [hh] + simp only [Prod.smul_mk, smul_zero, Prod.mk_add_mk, add_zero, + LinearMap.prodMap_apply, LinearMap.restrictScalars_apply, LinearMap.add_apply, + Module.algebraMap_end_apply] + congr 2 + exact (IsScalarTower.algebraMap_smul ℂ s q.2).symm + change (fderiv ℝ f (a, 0) + s • normalProjection).toLinearMap.det = _ + rw [he, LinearMap.det_prodMap] + + +def fixedRestriction (f : A × V → A × V) (a : A) : A := (f (a, 0)).1 + +omit [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] in +theorem fixedRestriction_fderiv (f : A × V → A × V) (hf : Differentiable ℝ f) + (a : A) (T : A →ₗ[ℝ] A) (N : V →ₗ[ℂ] V) + (h : (fderiv ℝ f (a, 0)).toLinearMap = T.prodMap (N.restrictScalars ℝ)) : + (fderiv ℝ (fixedRestriction f) a).toLinearMap = T := by + have hd := (ContinuousLinearMap.fst ℝ A V).hasFDerivAt.comp a + ((hf (a, 0)).hasFDerivAt.comp a (ContinuousLinearMap.inl ℝ A V).hasFDerivAt) + have hfun : (ContinuousLinearMap.fst ℝ A V) ∘ (f ∘ (ContinuousLinearMap.inl ℝ A V)) = + fixedRestriction f := rfl + rw [hfun] at hd + rw [hd.fderiv] + apply LinearMap.ext + intro q + exact congrArg Prod.fst (LinearMap.congr_fun h (q, 0)) + +/-- Simultaneously regularize the finite fixed fiber, retaining its tangent sign. -/ +theorem exists_normalShift_regular_fixed (f : A × V → A × V) (hf : Differentiable ℝ f) + (z : ℂˣ) (hz : (z : ℂ).im ≠ 0) + (he : ∀ q, f (scalarRotation z q) = scalarRotation z (f q)) + (S : Finset A) (c : ℝ) (hc : c ≠ 0) + (hT : ∀ a ∈ S, (fderiv ℝ (fixedRestriction f) a).det = c) + (ε : ℝ) (hε : 0 < ε) : + ∃ s : ℝ, |s| < ε ∧ ∀ a ∈ S, + (fderiv ℝ (normalShift f s) (a, 0)).det ≠ 0 ∧ + (0 < (fderiv ℝ (normalShift f s) (a, 0)).det ↔ 0 < c) := by + classical + choose T N hblock using (fun a : S => fixed_fderiv_blocks f hf z hz he a.val) + obtain ⟨s, hs, hregular⟩ := exists_small_simultaneous_regular_shift N hε + refine ⟨s, hs, fun a ha => ?_⟩ + let i : S := ⟨a, ha⟩ + have ht : (T i).det = c := by + rw [← fixedRestriction_fderiv f hf a (T i) (N i) (hblock i)] + exact hT a ha + have hn : 0 < ((N i + algebraMap ℂ (Module.End ℂ V) (s : ℂ)).restrictScalars ℝ).det := + complex_real_det_pos _ (LinearMap.isUnit_det _ (hregular i)).ne_zero + rw [normalShift_fixed_det f hf a (T i) (N i) (hblock i), ht] + exact ⟨mul_ne_zero hc hn.ne', mul_pos_iff_of_pos_right hn⟩ + +end FixedRegularization +end EilenbergGanea + +open Set Filter Topology +namespace EilenbergGanea +section LinearParameters +variable {ι E : Type*} [Fintype ι] [DecidableEq ι] + [NormedAddCommGroup E] [NormedSpace ℝ E] + +def linearPerturbation (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (x : E) (p : ι → E) : E := f x + ∑ j, T j x (p j) + +def linearPerturbationDerivative (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (x : E) (p : ι → E) : E →L[ℝ] E := + fderiv ℝ f x + ∑ j, (fderiv ℝ (T j) x).flip (p j) + +omit [DecidableEq ι] in +theorem linearPerturbation_hasFDerivAt (f : E → E) (T : ι → E → (E →L[ℝ] E)) + {x : E} (hf : DifferentiableAt ℝ f x) (hT : ∀ j, DifferentiableAt ℝ (T j) x) + (p : ι → E) : HasFDerivAt (fun z => linearPerturbation f T z p) + (linearPerturbationDerivative f T x p) x := by + apply hf.hasFDerivAt.add + apply HasFDerivAt.fun_sum + intro j _ + simpa using (hT j).hasFDerivAt.clm_apply (hasFDerivAt_const (p j) x) + +def linearSolvedParameter (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (i : ι) (q : ι → E) : ι → E := + Function.update q i (-(Ring.inverse (T i (q i)) + (f (q i) + ∑ j ∈ Finset.univ.erase i, T j (q i) (q j)))) + +theorem linearSolvedParameter_outside (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (i j : ι) (hji : j ≠ i) : + (fun q => linearSolvedParameter f T i q j) = fun q => q j := by + funext q + exact Function.update_of_ne hji _ _ + +theorem inverse_apply_cancel (A : E →L[ℝ] E) (hA : IsUnit A) (v : E) : + Ring.inverse A (A v) = v := by + exact congrArg (fun B : E →L[ℝ] E => B v) (Ring.inverse_mul_cancel A hA) + +theorem apply_inverse_cancel (A : E →L[ℝ] E) (hA : IsUnit A) (v : E) : + A (Ring.inverse A v) = v := by + exact congrArg (fun B : E →L[ℝ] E => B v) (Ring.mul_inverse_cancel A hA) + +theorem linearSolvedParameter_root (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (i : ι) (q : ι → E) (hi : IsUnit (T i (q i))) : + linearPerturbation f T (q i) (linearSolvedParameter f T i q) = 0 := by + rw [linearPerturbation, ← Finset.sum_erase_add _ _ (Finset.mem_univ i)] + have he : (∑ j ∈ Finset.univ.erase i, T j (q i) (linearSolvedParameter f T i q j)) = + ∑ j ∈ Finset.univ.erase i, T j (q i) (q j) := by + apply Finset.sum_congr rfl + intro j hj + rw [linearSolvedParameter, Function.update_of_ne (Finset.ne_of_mem_erase hj)] + rw [he] + simp only [linearSolvedParameter, Function.update_self, map_neg, + apply_inverse_cancel _ hi] + abel + +variable [FiniteDimensional ℝ E] + +theorem linearSolvedParameter_differentiableAt (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (i : ι) (q : ι → E) (hf : DifferentiableAt ℝ f (q i)) + (hT : ∀ j, DifferentiableAt ℝ (T j) (q i)) (hi : IsUnit (T i (q i))) : + DifferentiableAt ℝ (linearSolvedParameter f T i) q := by + have hproj := differentiableAt_apply i q (𝕜 := ℝ) + apply differentiableAt_pi.mpr + intro j + by_cases hj : j = i + · subst j + simp only [linearSolvedParameter, Function.update_self] + apply DifferentiableAt.neg + apply DifferentiableAt.clm_apply + · exact ((hT i).inverse hi).comp q hproj + · exact (hf.comp q hproj).add (DifferentiableAt.fun_sum (fun k _ => + ((hT k).comp q hproj).clm_apply (differentiableAt_apply k q))) + · simpa only [linearSolvedParameter_outside f T i j hj] using differentiableAt_apply j q (𝕜 := ℝ) + +omit [FiniteDimensional ℝ E] in +theorem linearSolvedParameter_fderiv_outside (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (i j : ι) (hji : j ≠ i) (q : ι → E) + (hG : DifferentiableAt ℝ (linearSolvedParameter f T i) q) : + (ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E).comp + (fderiv ℝ (linearSolvedParameter f T i) q) = ContinuousLinearMap.proj j := by + have h := ((ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E)).hasFDerivAt.comp q hG.hasFDerivAt + have he : (ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E) ∘ + linearSolvedParameter f T i = fun q => q j := + linearSolvedParameter_outside f T i j hji + rw [he] at h + exact h.unique ((ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E)).hasFDerivAt + +theorem linearSolvedParameter_differential_relation + (f : E → E) (T : ι → E → (E →L[ℝ] E)) (i : ι) (q : ι → E) + (hf : DifferentiableAt ℝ f (q i)) (hT : ∀ j, DifferentiableAt ℝ (T j) (q i)) + (hi : IsUnit (T i (q i))) (v : E) : + linearPerturbationDerivative f T (q i) (linearSolvedParameter f T i q) v + + ∑ j, T j (q i) ((fderiv ℝ (linearSolvedParameter f T i) q (Pi.single i v)) j) = 0 := by + let G := linearSolvedParameter f T i + have hG := linearSolvedParameter_differentiableAt f T i q hf hT hi + have hfi := hf.hasFDerivAt.comp q ((ContinuousLinearMap.proj i : (ι → E) →L[ℝ] E)).hasFDerivAt + have hx := hfi.fun_add (HasFDerivAt.fun_sum (u := Finset.univ) (fun j _ => + ((hT j).hasFDerivAt.comp q ((ContinuousLinearMap.proj i : (ι → E) →L[ℝ] E)).hasFDerivAt).clm_apply + (((ContinuousLinearMap.proj j : (ι → E) →L[ℝ] E)).hasFDerivAt.comp q hG.hasFDerivAt))) + have hz : (fun t => linearPerturbation f T (t i) (G t)) =ᶠ[𝓝 q] fun _ => 0 := by + have hcont : ContinuousAt (fun t : ι → E => T i (t i)) q := + ((hT i).comp q (differentiableAt_apply i q)).continuousAt + have he : ∀ᶠ t in 𝓝 q, IsUnit (T i (t i)) := + hcont (Units.isOpen.mem_nhds hi) + filter_upwards [he] with t ht + exact linearSolvedParameter_root f T i t ht + have hc := (hasFDerivAt_const (𝕜 := ℝ) (0 : E) q).congr_of_eventuallyEq hz + have he := congrArg (fun l : (ι → E) →L[ℝ] E => l (Pi.single i v)) (hx.unique hc) + simp only [add_apply, sum_apply, ContinuousLinearMap.comp_apply, + ContinuousLinearMap.proj_apply, ContinuousLinearMap.flip_apply, + Pi.single_eq_same, zero_apply, Finset.sum_add_distrib] at he + simp only [linearPerturbationDerivative, add_apply, sum_apply, ContinuousLinearMap.flip_apply] + dsimp [G] at he + exact (by convert he using 1; abel) + +omit [FiniteDimensional ℝ E] in +theorem linearSolvedParameter_recovers_root (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (i : ι) (x : E) (p : ι → E) (hi : IsUnit (T i x)) + (hroot : linearPerturbation f T x p = 0) : + linearSolvedParameter f T i (Function.update p i x) = p := by + have he : (∑ j ∈ Finset.univ.erase i, T j x (Function.update p i x j)) = + ∑ j ∈ Finset.univ.erase i, T j x (p j) := by + apply Finset.sum_congr rfl + intro j hj + rw [Function.update_of_ne (Finset.ne_of_mem_erase hj)] + have hs : T i x (p i) = -(f x + ∑ j ∈ Finset.univ.erase i, T j x (p j)) := by + rw [linearPerturbation, ← Finset.sum_erase_add _ _ (Finset.mem_univ i), + ← add_assoc] at hroot + exact eq_neg_of_add_eq_zero_right hroot + funext j + by_cases hj : j = i + · subst j + simp only [linearSolvedParameter, Function.update_self, he] + rw [← map_neg, ← hs, inverse_apply_cancel _ hi] + · simp [linearSolvedParameter, Function.update_of_ne hj] + +theorem linearSolvedParameter_critical (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (i : ι) (q : ι → E) (hf : DifferentiableAt ℝ f (q i)) + (hT : ∀ j, DifferentiableAt ℝ (T j) (q i)) (hi : IsUnit (T i (q i))) + (hcrit : (linearPerturbationDerivative f T (q i) (linearSolvedParameter f T i q)).det = 0) : + (fderiv ℝ (linearSolvedParameter f T i) q).det = 0 := by + have hG := linearSolvedParameter_differentiableAt f T i q hf hT hi + obtain ⟨v, hv, hv0⟩ := Submodule.exists_mem_ne_zero_of_ne_bot + (LinearMap.det_eq_zero_iff_ker_ne_bot.mp hcrit) + change linearPerturbationDerivative f T (q i) (linearSolvedParameter f T i q) v = 0 at hv + let w := fderiv ℝ (linearSolvedParameter f T i) q (Pi.single i v) + have hw (j : ι) (hji : j ≠ i) : w j = 0 := by + have he := congrArg (fun l : (ι → E) →L[ℝ] E => l (Pi.single i v)) + (linearSolvedParameter_fderiv_outside f T i j hji q hG) + simpa [w, Pi.single_eq_of_ne hji] using he + have hrel := linearSolvedParameter_differential_relation f T i q hf hT hi v + rw [hv, zero_add] at hrel + have hwi : w i = 0 := by + have hs : (∑ j, T j (q i) (w j)) = T i (q i) (w i) := by + apply Finset.sum_eq_single i + · intro j _ hji + simp [hw j hji] + · simp + rw [hs] at hrel + have he := congrArg (fun v => Ring.inverse (T i (q i)) v) hrel + simpa only [inverse_apply_cancel _ hi, map_zero] using he + apply LinearMap.det_eq_zero_iff_ker_ne_bot.mpr + apply (Submodule.ne_bot_iff _).mpr + refine ⟨Pi.single i v, ?_, ?_⟩ + · change w = 0 + funext j + by_cases hj : j = i + · subst j; exact hwi + · exact hw j hj + · intro he + apply hv0 + simpa using congrFun he i + +/-- Transversality with source-dependent linear parameter blocks, including +finite equivariant bump perturbations. Only invertibility of a single active +block is required at each root. -/ +theorem ae_regular_linear_parameters [MeasurableSpace E] [BorelSpace E] + (μ : MeasureTheory.Measure (ι → E)) [μ.IsAddHaarMeasure] + (f : E → E) (T : ι → E → (E →L[ℝ] E)) (s : Set E) + (hf : ∀ x ∈ s, DifferentiableAt ℝ f x) + (hT : ∀ i x, x ∈ s → DifferentiableAt ℝ (T i) x) : + ∀ᵐ p ∂μ, ∀ x ∈ s, linearPerturbation f T x p = 0 → + (∃ i, IsUnit (T i x)) → (linearPerturbationDerivative f T x p).det ≠ 0 := by + let C : ι → Set (ι → E) := fun i => + {q | q i ∈ s ∧ IsUnit (T i (q i)) ∧ (fderiv ℝ (linearSolvedParameter f T i) q).det = 0} + have hnull (i : ι) : μ (linearSolvedParameter f T i '' C i) = 0 := by + apply MeasureTheory.addHaar_image_eq_zero_of_det_fderivWithin_eq_zero μ + · intro q hq + exact (linearSolvedParameter_differentiableAt f T i q (hf _ hq.1) + (fun j => hT j _ hq.1) hq.2.1).hasFDerivAt.hasFDerivWithinAt + · intro q hq + exact hq.2.2 + have hae : ∀ᵐ p ∂μ, p ∉ ⋃ i, linearSolvedParameter f T i '' C i := by + rw [MeasureTheory.ae_iff] + simpa only [not_not, Set.ofPred_mem_eq] using MeasureTheory.measure_iUnion_null hnull + filter_upwards [hae] with p hp + intro x hs hx ⟨i, hi⟩ hcrit + let q := Function.update p i x + have hqi : q i = x := Function.update_self _ _ _ + have hGq : linearSolvedParameter f T i q = p := + linearSolvedParameter_recovers_root f T i x p hi hx + apply hp + apply Set.mem_iUnion.mpr + refine ⟨i, q, ⟨?_, ?_, ?_⟩, hGq⟩ + · simpa only [hqi] using hs + · simpa only [hqi] using hi + · apply linearSolvedParameter_critical f T i q + (by simpa only [hqi] using hf x hs) + (fun j => by simpa only [hqi] using hT j x hs) + · simpa only [hqi] using hi + · simpa only [hqi, hGq] using hcrit + +end LinearParameters +end EilenbergGanea +open scoped ContDiff +open Set Filter Topology +namespace EilenbergGanea +section EquivariantBumps +variable {G E : Type*} [Group G] [Fintype G] + [NormedAddCommGroup E] [NormedSpace ℝ E] + +def equivariantBumpOperator (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) (x : E) : E →L[ℝ] E := + ∑ g, b (ρ g⁻¹ x) • (ρ g : E →L[ℝ] E) + +omit [Fintype G] in +theorem representation_cancel (ρ : G →* E ≃L[ℝ] E) (g : G) (x : E) : + ρ g⁻¹ (ρ g x) = x := by + change ((ρ g⁻¹) * ρ g) x = x + rw [← map_mul, inv_mul_cancel, map_one] + rfl + +omit [Fintype G] in +theorem representation_mul_apply (ρ : G →* E ≃L[ℝ] E) (g h : G) (x : E) : + ρ (g * h) x = ρ g (ρ h x) := by rw [map_mul]; rfl + +theorem equivariantBumpOperator_equivariant (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) + (h : G) (x : E) : + equivariantBumpOperator ρ b (ρ h x) = + (ρ h : E →L[ℝ] E).comp (equivariantBumpOperator ρ b x) := by + ext v + simp only [equivariantBumpOperator, sum_apply, smul_apply, + ContinuousLinearMap.comp_apply, map_sum, map_smul] + symm + apply Fintype.sum_equiv (Equiv.mulLeft h) + intro g + change b (ρ g⁻¹ x) • ρ h (ρ g v) = + b (ρ (h * g)⁻¹ (ρ h x)) • ρ (h * g) v + simp only [mul_inv_rev, representation_mul_apply, representation_cancel] + +theorem equivariantBumpOperator_contDiff (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) + (hb : ContDiff ℝ ∞ b) : ContDiff ℝ ∞ (equivariantBumpOperator ρ b) := by + apply ContDiff.sum + intro g _ + exact (hb.comp (ρ g⁻¹).contDiff).smul contDiff_const + +theorem unit_smul_equiv (a : ℝ) (ha : a ≠ 0) (e : E ≃L[ℝ] E) : + IsUnit (a • (e : E →L[ℝ] E)) := by + refine ⟨⟨a • (e : E →L[ℝ] E), a⁻¹ • (e.symm : E →L[ℝ] E), ?_, ?_⟩, rfl⟩ + · ext v + simp [smul_smul, ha] + · ext v + simp [smul_smul, ha] + +theorem equivariantBumpOperator_isUnit (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) + (hbd : Pairwise fun g h : G => Disjoint (ρ g '' tsupport b) (ρ h '' tsupport b)) + (x : E) (g : G) (hg : b (ρ g⁻¹ x) ≠ 0) : IsUnit (equivariantBumpOperator ρ b x) := by + have hx (k : G) (hk : b (ρ k⁻¹ x) ≠ 0) : x ∈ ρ k '' tsupport b := + ⟨ρ k⁻¹ x, subset_tsupport b hk, by simpa using representation_cancel ρ k⁻¹ x⟩ + have he : equivariantBumpOperator ρ b x = b (ρ g⁻¹ x) • (ρ g : E →L[ℝ] E) := by + apply Finset.sum_eq_single g + · intro h _ hh + have hh0 : b (ρ h⁻¹ x) = 0 := by + by_contra hh0 + exact Set.disjoint_left.mp (hbd hh) (hx h hh0) (hx g hg) + simp only [hh0, zero_smul] + · simp + rw [he] + exact unit_smul_equiv _ hg _ + +/-- A free orbit for a finite linear action has a neighborhood with pairwise +disjoint translates. No isometry hypothesis or metric constants are needed. -/ +theorem free_orbit_disjoint_neighborhood (ρ : G →* E ≃L[ℝ] E) (x : E) + (hx : ∀ g : G, ρ g x = x → g = 1) (W : Set E) (hW : IsOpen W) (hxW : x ∈ W) : + ∃ V : Set E, IsOpen V ∧ x ∈ V ∧ V ⊆ W ∧ + Pairwise fun g h : G => Disjoint (ρ g '' V) (ρ h '' V) := by + classical + have hsep (g : {g : G // g ≠ 1}) : + ∃ U : Set E, IsOpen U ∧ x ∈ U ∧ Disjoint U (ρ g.val '' U) := by + have hgx : x ≠ ρ g.val x := fun he => g.property (hx _ he.symm) + obtain ⟨A, B, hA, hB, hxA, hxB, hAB⟩ := t2_separation hgx + refine ⟨A ∩ (ρ g.val ⁻¹' B), hA.inter (hB.preimage (ρ g.val).continuous), ⟨hxA, hxB⟩, ?_⟩ + apply hAB.mono inter_subset_left + rintro y ⟨z, hz, rfl⟩ + exact hz.2 + choose U hU hxU hdU using hsep + let V : Set E := W ∩ ⋂ g : {g : G // g ≠ 1}, U g + have hVo : IsOpen V := hW.inter (isOpen_iInter_of_finite hU) + have hxV : x ∈ V := ⟨hxW, mem_iInter.mpr hxU⟩ + refine ⟨V, hVo, hxV, inter_subset_left, ?_⟩ + intro g h hgh + apply Set.disjoint_left.mpr + rintro y ⟨a, ha, rfl⟩ ⟨b, hb, he⟩ + have hk : g⁻¹ * h ≠ 1 := by + intro heq + apply hgh + have := congrArg (fun k => g * k) heq + simpa only [← mul_assoc, mul_inv_cancel, one_mul, mul_one] using this.symm + have haU : a ∈ U ⟨g⁻¹ * h, hk⟩ := mem_iInter.mp ha.2 _ + have hbU : b ∈ U ⟨g⁻¹ * h, hk⟩ := mem_iInter.mp hb.2 _ + apply Set.disjoint_left.mp (hdU ⟨g⁻¹ * h, hk⟩) haU + refine ⟨b, hbU, ?_⟩ + rw [representation_mul_apply, he, representation_cancel] + +variable [FiniteDimensional ℝ E] + +/-- The bump family used in the free part of the localized-degree argument. +Its complete closed support has disjoint translates, so each active parameter +block is invertible. -/ +theorem free_orbit_smooth_bump (ρ : G →* E ≃L[ℝ] E) (x : E) + (hx : ∀ g : G, ρ g x = x → g = 1) (W : Set E) (hW : IsOpen W) (hxW : x ∈ W) : + ∃ b : E → ℝ, ContDiff ℝ ∞ b ∧ HasCompactSupport b ∧ tsupport b ⊆ W ∧ b x = 1 ∧ + Pairwise fun g h : G => Disjoint (ρ g '' tsupport b) (ρ h '' tsupport b) := by + obtain ⟨V, hV, hxV, hVW, hdisj⟩ := free_orbit_disjoint_neighborhood ρ x hx W hW hxW + obtain ⟨b, hbV, hcb, hdb, _, hbx⟩ := exists_contDiff_tsupport_subset (n := (⊤ : ℕ∞)) (hV.mem_nhds hxV) + refine ⟨b, hdb, hcb, hbV.trans hVW, hbx, ?_⟩ + intro g h hgh + exact (hdisj hgh).mono (image_mono hbV) (image_mono hbV) + +end EquivariantBumps +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped ContDiff +section CompactRootStability +variable {P X Y : Type*} [TopologicalSpace P] [TopologicalSpace X] + [TopologicalSpace Y] [CompactSpace X] [T1Space Y] + +theorem compact_root_good_stability (f : P × X → Y) (hf : Continuous f) + (y : Y) (V : Set (P × X)) (hV : IsOpen V) (p₀ : P) + (h₀ : ∀ x, f (p₀, x) = y → (p₀, x) ∈ V) : + ∀ᶠ p in 𝓝 p₀, ∀ x, f (p, x) = y → (p, x) ∈ V := by + let C : Set (P × X) := {q | f q = y} ∩ Vᶜ + have hC : IsClosed C := (isClosed_singleton.preimage hf).inter hV.isClosed_compl + have hn : p₀ ∉ Prod.fst '' C := by + rintro ⟨⟨p, x⟩, ⟨hr, hv⟩, rfl⟩ + exact hv (h₀ x hr) + filter_upwards [(isClosedMap_fst_of_compactSpace _ hC).isOpen_compl.mem_nhds hn] with p hp + intro x hr + by_contra hv + exact hp ⟨(p, x), ⟨hr, hv⟩, rfl⟩ +end CompactRootStability + +section CompactFreeBumps +universe uE uG +variable {G : Type uG} {E : Type uE} [Group G] [Fintype G] [NormedAddCommGroup E] + [NormedSpace ℝ E] [FiniteDimensional ℝ E] + +theorem compact_free_bump_family (ρ : G →* E ≃L[ℝ] E) + (K W : Set E) (hK : IsCompact K) (hW : IsOpen W) (hKW : K ⊆ W) + (hfree : ∀ x ∈ K, ∀ g : G, ρ g x = x → g = 1) : + ∃ (ι : Type uE) (_ : Fintype ι) (b : ι → E → ℝ), + (∀ i, ContDiff ℝ ∞ (b i) ∧ HasCompactSupport (b i) ∧ tsupport (b i) ⊆ W ∧ + Pairwise fun g h : G => Disjoint (ρ g '' tsupport (b i)) (ρ h '' tsupport (b i))) ∧ + (∀ x ∈ K, ∃ i, IsUnit (equivariantBumpOperator ρ (b i) x)) := by + classical + have hb (x : K) := free_orbit_smooth_bump ρ x.val (hfree x.val x.property) + W hW (hKW x.property) + choose b hbd hbc hbs hbx hdis using hb + have hcov : K ⊆ ⋃ x : K, {y | b x y ≠ 0} := by + intro x hx + exact mem_iUnion.mpr ⟨⟨x, hx⟩, by simp [hbx]⟩ + obtain ⟨t, ht⟩ := hK.elim_finite_subcover (fun x : K => {y | b x y ≠ 0}) + (fun x => isOpen_ne_fun (hbd x).continuous continuous_const) hcov + refine ⟨{x // x ∈ t}, inferInstance, fun i => b i.val, ?_, ?_⟩ + · exact fun i => ⟨hbd i.val, hbc i.val, hbs i.val, hdis i.val⟩ + · intro x hx + obtain ⟨i, hi, hbix⟩ := Set.mem_iUnion₂.mp (ht hx) + refine ⟨⟨i, hi⟩, equivariantBumpOperator_isUnit ρ (b i) (hdis i) x 1 ?_⟩ + rw [inv_one, map_one] + exact hbix + +end CompactFreeBumps + +section LinearRegularization +variable {ι E : Type*} [Fintype ι] [DecidableEq ι] + [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [MeasurableSpace E] [BorelSpace E] + +omit [DecidableEq ι] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +theorem linearPerturbation_contDiff (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (hf : ContDiff ℝ ∞ f) (hT : ∀ i, ContDiff ℝ ∞ (T i)) : + ContDiff ℝ ∞ (fun q : (ι → E) × E => linearPerturbation f T q.2 q.1) := by + apply (hf.comp contDiff_snd).add + apply ContDiff.sum + intro i _ + exact ((hT i).comp contDiff_snd).clm_apply ((contDiff_apply ℝ E i).comp contDiff_fst) + +omit [DecidableEq ι] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +theorem linearPerturbationDerivative_continuous (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (hf : ContDiff ℝ ∞ f) (hT : ∀ i, ContDiff ℝ ∞ (T i)) : + Continuous (fun q : (ι → E) × E => linearPerturbationDerivative f T q.2 q.1) := by + apply (hf.continuous_fderiv (by norm_num)).comp continuous_snd |>.add + apply continuous_finsetSum + intro i _ + exact ((ContinuousLinearMap.flipₗᵢ ℝ E E E).continuous.comp + (((hT i).continuous_fderiv (by norm_num)).comp continuous_snd)).clm_apply + ((continuous_apply i).comp continuous_fst) + +/-- A finite linear bump family regularizes all roots on a compact set, provided +it has an invertible block at every initially critical root. The parameters +can be chosen in any prescribed neighborhood of zero. -/ +theorem exists_regular_linear_perturbation + (μ : MeasureTheory.Measure (ι → E)) [μ.IsAddHaarMeasure] + (f : E → E) (T : ι → E → (E →L[ℝ] E)) + (hf : ContDiff ℝ ∞ f) (hT : ∀ i, ContDiff ℝ ∞ (T i)) + (K : Set E) (hK : IsCompact K) + (hcover : ∀ x ∈ K, f x = 0 → (fderiv ℝ f x).det = 0 → ∃ i, IsUnit (T i x)) + (U : Set (ι → E)) (hU : U ∈ 𝓝 0) : + ∃ p ∈ U, ∀ x ∈ K, linearPerturbation f T x p = 0 → + (linearPerturbationDerivative f T x p).det ≠ 0 := by + let : CompactSpace K := isCompact_iff_compactSpace.mp hK + let F : (ι → E) × K → E := fun q => linearPerturbation f T q.2.val q.1 + let V : Set ((ι → E) × K) := {q | + (linearPerturbationDerivative f T q.2.val q.1).det ≠ 0 ∨ ∃ i, IsUnit (T i q.2.val)} + have hc : Continuous (fun q : (ι → E) × K => (q.1, q.2.val)) := + continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd) + have hV : IsOpen V := by + have hd : IsOpen {q : (ι → E) × K | + (linearPerturbationDerivative f T q.2.val q.1).det ≠ 0} := + isOpen_ne_fun (ContinuousLinearMap.continuous_det.comp + ((linearPerturbationDerivative_continuous f T hf hT).comp hc)) continuous_const + have ho := isOpen_iUnion (fun i => Units.isOpen.preimage ((hT i).continuous.comp + (continuous_subtype_val.comp (continuous_snd : Continuous (Prod.snd : (ι → E) × K → K))))) + have he : {q : (ι → E) × K | ∃ i, IsUnit (T i q.2.val)} = + ⋃ i, (T i ∘ Subtype.val ∘ Prod.snd) ⁻¹' {a | IsUnit a} := by + ext q + simp + have hi : IsOpen {q : (ι → E) × K | ∃ i, IsUnit (T i q.2.val)} := he ▸ ho + exact hd.union hi + have h₀ : ∀ x : K, F (0, x) = 0 → ((0 : ι → E), x) ∈ V := by + intro x hx + by_cases hd : (fderiv ℝ f x.val).det = 0 + · exact Or.inr (hcover x.val x.property (by simpa [F, linearPerturbation] using hx) hd) + · exact Or.inl (by simpa [linearPerturbationDerivative] using hd) + have he := compact_root_good_stability F ((linearPerturbation_contDiff f T hf hT).continuous.comp hc) + 0 V hV 0 h₀ + have hdense : Dense {p : ι → E | ∀ x ∈ K, linearPerturbation f T x p = 0 → + (∃ i, IsUnit (T i x)) → (linearPerturbationDerivative f T x p).det ≠ 0} := + MeasureTheory.Measure.dense_of_ae (ae_regular_linear_parameters μ f T K + (fun x _ => hf.differentiable (by norm_num) x) + (fun i x _ => (hT i).differentiable (by norm_num) x)) + obtain ⟨p, hpreg, hpU, hpgood⟩ := hdense.inter_nhds_nonempty (inter_mem hU he) + refine ⟨p, hpU, ?_⟩ + intro x hx hr + rcases hpgood ⟨x, hx⟩ hr with hd | hi + · exact hd + · exact hpreg x hx hr hi + +end LinearRegularization +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +section EquivariantRegularization +universe uE uG +variable {G : Type uG} {E : Type uE} [Group G] [Fintype G] [NormedAddCommGroup E] + [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +theorem equivariantBumpOperator_eventually_zero_outside + (ρ : G →* E ≃L[ℝ] E) (b : E → ℝ) (W : Set E) + (hb : tsupport b ⊆ W) (hinv : ∀ g x, x ∈ W → ρ g x ∈ W) + (x : E) (hx : x ∉ W) : equivariantBumpOperator ρ b =ᶠ[𝓝 x] 0 := by + have hzero (a : G) : ∀ᶠ y in 𝓝 x, b (ρ a⁻¹ y) = 0 := by + have hn : ρ a⁻¹ x ∉ tsupport b := by + intro hs + have hw := hinv a (ρ a⁻¹ x) (hb hs) + have he : ρ a (ρ a⁻¹ x) = x := by + rw [← representation_mul_apply, mul_inv_cancel, map_one] + rfl + exact hx (he ▸ hw) + filter_upwards [((isClosed_tsupport b).preimage (ρ a⁻¹).continuous).isOpen_compl.mem_nhds hn] + with y hy + exact image_eq_zero_of_notMem_tsupport hy + filter_upwards [Filter.eventually_all.mpr hzero] with y hy + change (∑ a : G, b (ρ a⁻¹ y) • (ρ a : E →L[ℝ] E)) = 0 + apply Finset.sum_eq_zero + intro a _ + rw [hy a, zero_smul] + +/-- The free-action regularization step. Critical roots must lie in the free +locus, but already regular fixed roots need not. The perturbation is unchanged +outside any chosen invariant open neighborhood of the critical roots. -/ +theorem exists_equivariant_regular_perturbation + (ρ : G →* E ≃L[ℝ] E) (f : E → E) (hf : ContDiff ℝ ∞ f) + (heq : ∀ g x, f (ρ g x) = ρ g (f x)) + (K W : Set E) (hK : IsCompact K) (hW : IsOpen W) + (hinv : ∀ g x, x ∈ W → ρ g x ∈ W) + (hcritical : ∀ x ∈ K, f x = 0 → (fderiv ℝ f x).det = 0 → + x ∈ W ∧ ∀ g : G, ρ g x = x → g = 1) + (ε : ℝ) (hε : 0 < ε) : + ∃ g : E → E, ContDiff ℝ ∞ g ∧ (∀ a x, g (ρ a x) = ρ a (g x)) ∧ + (∀ x ∉ W, g =ᶠ[𝓝 x] f) ∧ (∀ x ∈ K, ‖g x - f x‖ < ε) ∧ + ∀ x ∈ K, g x = 0 → (fderiv ℝ g x).det ≠ 0 := by + classical + let A : Set E := {x ∈ K | f x = 0 ∧ (fderiv ℝ f x).det = 0} + have hA : IsCompact A := hK.inter_right + ((isClosed_singleton.preimage hf.continuous).inter + (isClosed_singleton.preimage (ContinuousLinearMap.continuous_det.comp + (hf.continuous_fderiv (by norm_num))))) + obtain ⟨ι, hι, b, hb, hcover⟩ := compact_free_bump_family ρ A W hA hW + (fun x hx => (hcritical x hx.1 hx.2.1 hx.2.2).1) + (fun x hx => (hcritical x hx.1 hx.2.1 hx.2.2).2) + let := hι + let T : ι → E → (E →L[ℝ] E) := fun i => equivariantBumpOperator ρ (b i) + have hT (i : ι) : ContDiff ℝ ∞ (T i) := equivariantBumpOperator_contDiff ρ _ (hb i).1 + let : CompactSpace K := isCompact_iff_compactSpace.mp hK + have hc : Continuous (fun q : (ι → E) × K => (q.1, q.2.val)) := + continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd) + have hopen : IsOpen {q : (ι → E) × K | + ‖linearPerturbation f T q.2.val q.1 - f q.2.val‖ < ε} := + isOpen_lt (((linearPerturbation_contDiff f T hf hT).continuous.comp hc).sub + (hf.continuous.comp (continuous_subtype_val.comp continuous_snd))).norm continuous_const + have hsmall : ∀ᶠ p : ι → E in 𝓝 0, + ∀ x : K, ‖linearPerturbation f T x.val p - f x.val‖ < ε := by + have h := compact_root_good_stability (fun _ : (ι → E) × K => (0 : ℝ)) + continuous_const (0 : ℝ) _ hopen (0 : ι → E) (by + intro x _ + simpa [linearPerturbation] using hε) + filter_upwards [h] with p hp + exact fun x => hp x rfl + obtain ⟨p, hp, hreg⟩ := exists_regular_linear_perturbation + (Module.finBasis ℝ (ι → E)).addHaar f T hf hT K hK + (fun x hx hr hd => hcover x ⟨hx, hr, hd⟩) _ hsmall + refine ⟨fun x => linearPerturbation f T x p, ?_, ?_, ?_, ?_, ?_⟩ + · exact (linearPerturbation_contDiff f T hf hT).comp (contDiff_const.prodMk contDiff_id) + · intro a x + simp only [linearPerturbation, heq, map_add, map_sum] + congr 1 + apply Finset.sum_congr rfl + intro i _ + exact congrArg (fun L : E →L[ℝ] E => L (p i)) (equivariantBumpOperator_equivariant ρ (b i) a x) + · intro x hx + have hz (i : ι) : T i =ᶠ[𝓝 x] 0 := + equivariantBumpOperator_eventually_zero_outside ρ (b i) W (hb i).2.2.1 hinv x hx + filter_upwards [Filter.eventually_all.mpr hz] with y hy + simp only [linearPerturbation, hy, Pi.zero_apply, zero_apply, + Finset.sum_const_zero, add_zero] + · intro x hx + exact hp ⟨x, hx⟩ + · intro x hx hr + rw [(linearPerturbation_hasFDerivAt f T (hf.differentiable (by norm_num) x) + (fun i => (hT i).differentiable (by norm_num) x) p).fderiv] + exact hreg x hx hr + +end EquivariantRegularization +end EilenbergGanea +namespace EilenbergGanea +open Set Filter Topology +open scoped ContDiff +section MixedRegularization +variable {G A V : Type*} [Group G] [Fintype G] + [NormedAddCommGroup A] [NormedSpace ℝ A] [FiniteDimensional ℝ A] + [NormedAddCommGroup V] [NormedSpace ℂ V] [NormedSpace ℝ V] + [IsScalarTower ℝ ℂ V] [FiniteDimensional ℂ V] + +def scalarRotationRepresentation (χ : G →* ℂˣ) : G →* (A × V) ≃L[ℝ] (A × V) where + toFun g := scalarRotation (χ g) + map_one' := by + apply ContinuousLinearEquiv.ext + funext q + change scalarRotation (χ 1) q = q + simp [scalarRotation_apply] + map_mul' g h := by + apply ContinuousLinearEquiv.ext + funext q + change scalarRotation (χ (g * h)) q = scalarRotation (χ g) (scalarRotation (χ h) q) + simp [mul_smul] + +omit [Fintype G] [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] in +@[simp] theorem scalarRotationRepresentation_apply (χ : G →* ℂˣ) (g : G) (q : A × V) : + scalarRotationRepresentation χ g q = (q.1, (χ g : ℂ) • q.2) := rfl + +omit [Fintype G] [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] in + theorem scalarRotation_free (χ : G →* ℂˣ) (hχ : Function.Injective χ) + (q : A × V) (hq : q.2 ≠ 0) : + ∀ g : G, scalarRotationRepresentation χ g q = q → g = 1 := by + intro g hg + have hh : (χ g : ℂ) • q.2 = (1 : ℂ) • q.2 := by + have hg_snd := congrArg Prod.snd hg + change (χ g : ℂ) • q.2 = q.2 at hg_snd + simpa using hg_snd + have he : (χ g : ℂ) = 1 := (smul_left_injective ℂ hq) hh + apply hχ + apply Units.ext + simpa using he + +omit [Fintype G] [FiniteDimensional ℝ A] [FiniteDimensional ℂ V] in + theorem normalShift_equivariant (χ : G →* ℂˣ) (f : A × V → A × V) + (hf : ∀ g q, f (scalarRotationRepresentation χ g q) = + scalarRotationRepresentation χ g (f q)) (s : ℝ) : + ∀ g q, normalShift f s (scalarRotationRepresentation χ g q) = + scalarRotationRepresentation χ g (normalShift f s q) := by + intro g q + simp only [normalShift, hf, map_add, map_smul] + congr 1 + +/-- The full fixed-plus-free regularization step in fixed/normal coordinates. +Unlike an assumed transversality interface, this is assembled from the finite +normal spectrum argument and explicit free-orbit bump parameters above. -/ +theorem exists_fixed_free_regularization (χ : G →* ℂˣ) (hχ : Function.Injective χ) + (a₀ : G) (ha₀ : (χ a₀ : ℂ).im ≠ 0) + (f : A × V → A × V) (hf : ContDiff ℝ ∞ f) + (he : ∀ g q, f (scalarRotationRepresentation χ g q) = + scalarRotationRepresentation χ g (f q)) + (K : Set (A × V)) (hK : IsCompact K) (S : Finset A) + (hS : ∀ a, (a, 0) ∈ K → f (a, 0) = 0 → a ∈ S) + (c : ℝ) (hc : c ≠ 0) + (hT : ∀ a ∈ S, (fderiv ℝ (fixedRestriction f) a).det = c) + (ε : ℝ) (hε : 0 < ε) : + ∃ g : A × V → A × V, ContDiff ℝ ∞ g ∧ + (∀ a q, g (scalarRotationRepresentation χ a q) = + scalarRotationRepresentation χ a (g q)) ∧ + (∀ a, g (a, 0) = f (a, 0)) ∧ + (∀ q ∈ K, ‖g q - f q‖ < ε) ∧ + (∀ q ∈ K, g q = 0 → (fderiv ℝ g q).det ≠ 0) ∧ + (∀ a ∈ S, (0 < (fderiv ℝ g (a, 0)).det ↔ 0 < c)) := by + classical + let : FiniteDimensional ℝ V := Module.Finite.trans ℂ V + let : MeasurableSpace (A × V) := borel (A × V) + let : BorelSpace (A × V) := ⟨rfl⟩ + let ρ := scalarRotationRepresentation (A := A) (V := V) χ + obtain ⟨R, hR, hbound⟩ := hK.isBounded.exists_pos_norm_lt + have hδ : 0 < (ε / 2) / (R + 1) := div_pos (by linarith) (by linarith) + obtain ⟨s, hs, hreg⟩ := exists_normalShift_regular_fixed f + (hf.differentiable (by simp)) (χ a₀) ha₀ (he a₀) S c hc hT _ hδ + let f₁ := normalShift f s + have hf₁ : ContDiff ℝ ∞ f₁ := normalShift_contDiff f hf s + have he₁ : ∀ a q, f₁ (ρ a q) = ρ a (f₁ q) := normalShift_equivariant χ f he s + have hsmall : ∀ q ∈ K, ‖f₁ q - f q‖ < ε / 2 := by + intro q hq + have hnorm : ‖normalProjection q‖ ≤ R + 1 := by + simp only [normalProjection_apply, Prod.norm_def, norm_zero, max_eq_right (norm_nonneg _)] + exact (norm_snd_le q).trans (hbound q hq).le |>.trans (by linarith) + calc + ‖f₁ q - f q‖ = |s| * ‖normalProjection q‖ := by simp only [f₁, normalShift, add_sub_cancel_left, norm_smul, Real.norm_eq_abs] + _ ≤ |s| * (R + 1) := mul_le_mul_of_nonneg_left hnorm (abs_nonneg _) + _ < ε / 2 := (lt_div_iff₀ (by linarith : 0 < R + 1)).mp hs + let W : Set (A × V) := {q | q.2 ≠ 0} + have hW : IsOpen W := (isClosed_singleton.preimage continuous_snd).isOpen_compl + have hinv : ∀ a q, q ∈ W → ρ a q ∈ W := by + intro a q hq + exact smul_ne_zero (Units.ne_zero _) hq + have hcritical : ∀ q ∈ K, f₁ q = 0 → (fderiv ℝ f₁ q).det = 0 → + q ∈ W ∧ ∀ a : G, ρ a q = q → a = 1 := by + intro q hq hr hd + have hn : q.2 ≠ 0 := by + intro hz + have hqeq : q = (q.1, 0) := Prod.ext rfl hz + rw [hqeq] at hq hr hd + have ha : q.1 ∈ S := hS q.1 hq (by simpa [f₁] using hr) + exact (hreg q.1 ha).1 hd + exact ⟨hn, scalarRotation_free χ hχ q hn⟩ + obtain ⟨g, hg, hge, hprotected, hclose, hgood⟩ := + exists_equivariant_regular_perturbation ρ f₁ hf₁ he₁ K W hK hW hinv hcritical + (ε / 2) (by linarith) + refine ⟨g, hg, hge, ?_, ?_, hgood, ?_⟩ + · intro a + exact ((hprotected (a, 0) (by simp [W])).eq_of_nhds).trans (normalShift_fixed f s a) + · intro q hq + have hh := norm_sub_le_norm_sub_add_norm_sub (g q) (f₁ q) (f q) + linarith [hclose q hq, hsmall q hq] + · intro a ha + have hd := (hprotected (a, 0) (by simp [W])).fderiv_eq (𝕜 := ℝ) + rw [hd] + exact (hreg a ha).2 + +end MixedRegularization +end EilenbergGanea + + +namespace EilenbergGanea +section SignedAction +variable {G X : Type*} [Group G] [MulAction G X] + +@[instance_reducible] def invariantSubtypeAction (P : X → Prop) (hP : ∀ (g : G) x, P x → P (g • x)) : + MulAction G {x // P x} where + smul g x := ⟨g • x.1, hP g x.1 x.2⟩ + one_smul x := Subtype.ext (one_smul G x.1) + mul_smul g h x := Subtype.ext (mul_smul g h x.1) + +theorem signed_finite_action_nonzero {p : ℕ} [Fact p.Prime] [Fintype X] + (hG : IsPGroup p G) (σ : X → Bool) + (hσ : ∀ (g : G) x, σ (g • x) = σ x) + (b : Bool) (hb : ∀ x ∈ MulAction.fixedPoints G X, σ x = b) + (hex : (MulAction.fixedPoints G X).Nonempty) + (hsmall : Nat.card (MulAction.fixedPoints G X) < p) : + (∑ x : X, (if σ x then (1 : ℤ) else -1)) ≠ 0 := by + classical + let A := {x : X // σ x = b} + let B := {x : X // σ x ≠ b} + let : MulAction G A := invariantSubtypeAction _ (by intro g x hx; simpa [hσ] using hx) + let : MulAction G B := invariantSubtypeAction _ (by intro g x hx; simpa [hσ] using hx) + let e : MulAction.fixedPoints G A ≃ MulAction.fixedPoints G X := + { toFun := fun x => ⟨x.1.1, fun g => congrArg Subtype.val (x.2 g)⟩ + invFun := fun x => ⟨⟨x.1, hb x.1 x.2⟩, fun g => Subtype.ext (x.2 g)⟩ + left_inv := by intro x; rfl + right_inv := by intro x; rfl } + have hempty : IsEmpty (MulAction.fixedPoints G B) := ⟨by + intro x + have hx : x.1.1 ∈ MulAction.fixedPoints G X := fun g => congrArg Subtype.val (x.2 g) + exact x.1.2 (hb x.1.1 hx)⟩ + have hnon : Nonempty (MulAction.fixedPoints G X) := hex.to_subtype + have hpos : 0 < Nat.card (MulAction.fixedPoints G A) := by + rw [Nat.card_congr e] + exact Nat.card_pos + have hs : Nat.card (MulAction.fixedPoints G A) < p := by rw [Nat.card_congr e]; exact hsmall + have hn : Nat.card (MulAction.fixedPoints G B) = 0 := by simp + have hneq : Nat.card A ≠ Nat.card B := by + intro hh + have h := (hG.card_modEq_card_fixedPoints A).symm + rw [hh] at h + have h' := h.trans (hG.card_modEq_card_fixedPoints B) + rw [hn] at h' + have heq := h'.eq_of_lt_of_lt hs (Fact.out : p.Prime).pos + omega + have hcounts : (∑ x : X, (if σ x = b then (1 : ℤ) else -1)) = + (Nat.card A : ℤ) - Nat.card B := by + rw [Finset.sum_ite] + simp [A, B, Nat.card_eq_fintype_card, Fintype.card_subtype, sub_eq_add_neg] + intro hz + have hz' : (∑ x : X, (if σ x = b then (1 : ℤ) else -1)) = 0 := by + cases b + · have hh : (fun x : X => if σ x = false then (1 : ℤ) else -1) = + fun x => -(if σ x then (1 : ℤ) else -1) := by funext x; cases σ x <;> rfl + rw [hh, Finset.sum_neg_distrib, hz, neg_zero] + · simpa using hz + rw [hcounts, sub_eq_zero] at hz' + exact hneq (by exact_mod_cast hz') +end SignedAction +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped ContDiff +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] + +/- A nonsingular derivative supplies an open inverse patch, without assuming +that the map is proper or globally injective. -/ +theorem exists_regular_inverse_patch (f : E → E) {x : E} + (hf : ContDiffAt ℝ 1 f x) (hd : (fderiv ℝ f x).det ≠ 0) : + ∃ V : Set E, IsOpen V ∧ x ∈ V ∧ InjOn f V ∧ + IsOpen (f '' V) := by + let e := (fderiv ℝ f x).toContinuousLinearEquivOfDetNeZero hd + have he : (e : E →L[ℝ] E) = fderiv ℝ f x := rfl + have hf' : HasFDerivAt f (e : E →L[ℝ] E) x := by + rw [he] + exact (hf.differentiableAt (by norm_num)).hasFDerivAt + let p := hf.toOpenPartialHomeomorph f hf' (by norm_num) + refine ⟨p.source, p.open_source, hf.mem_toOpenPartialHomeomorph_source hf' (by norm_num), + p.injOn, ?_⟩ + change IsOpen (p '' p.source) + rw [p.image_source_eq_target] + exact p.open_target + +/- A regular level set is discrete. Only smoothness at the level set is +required. -/ +theorem regular_fiber_isDiscrete (f : E → E) (y : E) (K : Set E) + (hf : ∀ x ∈ K, f x = y → ContDiffAt ℝ 1 f x) + (hd : ∀ x ∈ K, f x = y → (fderiv ℝ f x).det ≠ 0) : + IsDiscrete (K ∩ f ⁻¹' {y}) := by + rw [isDiscrete_iff_forall_mem_exists_isOpen] + rintro x ⟨hxK, hxy⟩ + obtain ⟨V, ho, hxV, hi, _⟩ := exists_regular_inverse_patch f (hf x hxK hxy) (hd x hxK hxy) + refine ⟨V, ho, ?_⟩ + ext z + constructor + · rintro ⟨hzV, hzK, hzy⟩ + exact hi hzV hxV (hzy.trans hxy.symm) + · rintro rfl + exact ⟨hxV, hxK, hxy⟩ + +/- Compact regular fibers are finite, in the form needed by the signed +count formula after regularization. -/ +theorem compact_regular_fiber_finite (f : E → E) (y : E) (K : Set E) + (hK : IsCompact K) (hf : ContinuousOn f K) + (hs : ∀ x ∈ K, f x = y → ContDiffAt ℝ 1 f x) + (hd : ∀ x ∈ K, f x = y → (fderiv ℝ f x).det ≠ 0) : + (K ∩ f ⁻¹' {y}).Finite := by + exact (hK.of_isClosed_subset (hf.preimage_isClosed_of_isClosed hK.isClosed + isClosed_singleton) inter_subset_left).finite + (regular_fiber_isDiscrete f y K hs hd) + + +end EilenbergGanea +namespace EilenbergGanea +open Set Filter Topology +open scoped ContDiff +section LocalizedRegularization +variable {G A V : Type*} [Group G] [Fintype G] + [NormedAddCommGroup A] [NormedSpace ℝ A] [FiniteDimensional ℝ A] + [NormedAddCommGroup V] [NormedSpace ℂ V] [NormedSpace ℝ V] + [IsScalarTower ℝ ℂ V] [FiniteDimensional ℂ V] + +/-- The localized noncancellation part of degree, now for actual regular +perturbations of a smooth map, not an assumed finite-orbit-count interface. -/ +theorem exists_regularization_nonzero_count {p : ℕ} [Fact p.Prime] + (hG : IsPGroup p G) (χ : G →* ℂˣ) (hχ : Function.Injective χ) + (a₀ : G) (ha₀ : (χ a₀ : ℂ).im ≠ 0) + (f : A × V → A × V) (hf : ContDiff ℝ ∞ f) + (he : ∀ a q, f (scalarRotationRepresentation χ a q) = + scalarRotationRepresentation χ a (f q)) + (K : Set (A × V)) (hK : IsCompact K) + (hKi : ∀ a q, q ∈ K → scalarRotationRepresentation χ a q ∈ K) + (L : Set (A × V)) (hL : IsCompact L) (hKL : K ⊆ L) + (S : Finset A) (hS : ∀ a, (a, 0) ∈ L → f (a, 0) = 0 → a ∈ S) + (hex : ∃ a, (a, 0) ∈ K ∧ f (a, 0) = 0) (hSp : S.card < p) + (c : ℝ) (hc : c ≠ 0) + (hT : ∀ a ∈ S, (fderiv ℝ (fixedRestriction f) a).det = c) + (ε : ℝ) (hε : 0 < ε) : + ∃ g : A × V → A × V, ContDiff ℝ ∞ g ∧ + (∀ q ∈ L, ‖g q - f q‖ < ε) ∧ + ∃ s : Finset (A × V), (∀ q, q ∈ s ↔ q ∈ K ∧ g q = 0) ∧ + (∀ q ∈ s, (fderiv ℝ g q).det ≠ 0) ∧ + (∑ q ∈ s, (if 0 < (fderiv ℝ g q).det then 1 else -1 : ℝ)) ≠ 0 := by + classical + let : FiniteDimensional ℝ V := Module.Finite.trans ℂ V + let ρ := scalarRotationRepresentation (A := A) (V := V) χ + obtain ⟨g, hg, hge, hgf, hclose, hreg, hsign⟩ := exists_fixed_free_regularization + χ hχ a₀ ha₀ f hf he L hL S hS c hc hT ε hε + have hfinite : (K ∩ g ⁻¹' {0}).Finite := compact_regular_fiber_finite g 0 K hK + hg.continuous.continuousOn (fun q _ _ => hg.of_le (by norm_num) |>.contDiffAt) (fun q hq => hreg q (hKL hq)) + let s := hfinite.toFinset + have hs : ∀ q, q ∈ s ↔ q ∈ K ∧ g q = 0 := by intro q; exact hfinite.mem_toFinset + let X := {q : A × V // q ∈ K ∧ g q = 0} + let : Fintype X := hfinite.fintype + let : MulAction G (A × V) := { + smul := fun a q => ρ a q + one_smul := by intro q; change ρ 1 q = q; rw [map_one]; rfl + mul_smul := by intro a b q; change ρ (a * b) q = ρ a (ρ b q); rw [map_mul]; rfl } + let : MulAction G X := invariantSubtypeAction _ (by + intro a q hq + refine ⟨hKi a q hq.1, ?_⟩ + change g (ρ a q) = 0 + rw [hge, hq.2, map_zero]) + have hfixed (x : MulAction.fixedPoints G X) : x.1.1.2 = 0 := by + by_contra hn + have hh := congrArg (fun q : X => q.1.2) (x.2 a₀) + change (χ a₀ : ℂ) • x.1.1.2 = x.1.1.2 at hh + have hh' : (χ a₀ : ℂ) • x.1.1.2 = (1 : ℂ) • x.1.1.2 := by simpa using hh + have heq := (smul_left_injective ℂ hn) hh' + exact ha₀ (by rw [heq]; rfl) + have hmem (x : MulAction.fixedPoints G X) : x.1.1.1 ∈ S := by + have hx := x.1.2 + have heq : x.1.1 = (x.1.1.1, 0) := Prod.ext rfl (hfixed x) + rw [heq] at hx + exact hS _ (hKL hx.1) (by rw [← hgf]; exact hx.2) + let e : MulAction.fixedPoints G X ↪ S := + ⟨fun x => ⟨x.1.1.1, hmem x⟩, by + intro x y h + apply Subtype.ext + apply Subtype.ext + apply Prod.ext + · exact congrArg Subtype.val h + · exact (hfixed x).trans (hfixed y).symm⟩ + have hsmall : Nat.card (MulAction.fixedPoints G X) < p := + (Nat.card_le_card_of_injective e e.injective).trans_lt (by simpa using hSp) + have hex' : (MulAction.fixedPoints G X).Nonempty := by + obtain ⟨a, haK, haf⟩ := hex + refine ⟨⟨(a, 0), haK, by rw [hgf]; exact haf⟩, ?_⟩ + intro b + apply Subtype.ext + change ρ b (a, 0) = (a, 0) + simp [ρ] + let σ : X → Bool := fun q => decide (0 < (fderiv ℝ g q.1).det) + have hσ : ∀ (a : G) (q : X), σ (a • q) = σ q := by + intro a q + unfold σ + congr 1 + exact congrArg (fun t : ℝ => 0 < t) + (equivariant_fderiv_det g (ρ a) (hg.differentiable (by simp)) (hge a) q.1) + have hb : ∀ q ∈ MulAction.fixedPoints G X, σ q = decide (0 < c) := by + intro q hq + let x : MulAction.fixedPoints G X := ⟨q, hq⟩ + have heq : q.1 = (q.1.1, 0) := Prod.ext rfl (hfixed x) + change decide (0 < (fderiv ℝ g q.1).det) = decide (0 < c) + rw [heq] + exact decide_eq_decide.mpr (hsign _ (hmem x)) + have hcount := signed_finite_action_nonzero hG σ hσ (decide (0 < c)) hb hex' hsmall + refine ⟨g, hg, hclose, s, hs, fun q hq => hreg q (hKL ((hs q).mp hq).1) ((hs q).mp hq).2, ?_⟩ + have hsum : (∑ q ∈ s, (if 0 < (fderiv ℝ g q).det then (1 : ℤ) else -1)) ≠ 0 := by + have hsum' : (∑ q : X, (if σ q then (1 : ℤ) else -1)) = + ∑ q ∈ s, (if 0 < (fderiv ℝ g q).det then (1 : ℤ) else -1) := by + unfold σ + simpa only [decide_eq_true_eq] using (Finset.sum_subtype s hs + (fun q => if 0 < (fderiv ℝ g q).det then (1 : ℤ) else -1)).symm + exact hsum' ▸ hcount + exact_mod_cast hsum +end LocalizedRegularization +end EilenbergGanea + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/Seed.lean b/lean/OAI/Topology/EilenbergGanea/Seed.lean index ea6a1742303d4404640718e3663683b93e385a14..324c50b1d9d66adf87b9ac91fba8eabef4b84014 100644 --- a/lean/OAI/Topology/EilenbergGanea/Seed.lean +++ b/lean/OAI/Topology/EilenbergGanea/Seed.lean @@ -1,164 +1,164 @@ -import Mathlib.Tactic -import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected -import Mathlib.Data.Fintype.Sum -import Mathlib.LinearAlgebra.Matrix.Notation - -namespace OAI - -noncomputable section - -open Classical Set - -namespace EilenbergGanea -/-- `false` names x; `true` names y. The second Boolean is the positive sign. -/ -def seedWord : Bool → List (Bool × Bool) - | false => [(false, true), (false, true), (true, false), (true, false), - (true, false), (true, false), (true, false)] - | true => [(false, true), (false, true), (true, true), (false, false), - (true, true), (false, false), (true, true), (false, false)] - -/-- Numbers of sectors in the two coned boundary polygons. -/ -def boundaryLength (r : Bool) : ℕ := 3 * (seedWord r).length - -abbrev RoseVertex := Option (Bool × Fin 2) -abbrev SeedVertex := RoseVertex ⊕ Bool -abbrev CircleEdge := Bool × Fin 3 -abbrev Sector := (r : Bool) × Fin (boundaryLength r) -abbrev SeedEdge := CircleEdge ⊕ Sector -abbrev SeedCell := SeedVertex ⊕ (SeedEdge ⊕ Sector) - -def circleStart (e : CircleEdge) : RoseVertex := - ![none, some (e.1, 0), some (e.1, 1)] e.2 - -def circleEnd (e : CircleEdge) : RoseVertex := - ![some (e.1, 0), some (e.1, 1), none] e.2 - -def sectorLetter (s : Sector) : Bool × Bool := - (seedWord s.1).get ⟨s.2.val / 3, by - have h := s.2.isLt - dsimp [boundaryLength] at h - omega⟩ - -def sectorCircleEdge (s : Sector) : CircleEdge := - ((sectorLetter s).1, if (sectorLetter s).2 then - ⟨s.2.val % 3, Nat.mod_lt _ (by decide)⟩ else - ⟨2 - s.2.val % 3, by omega⟩) - -def sectorStart (s : Sector) : RoseVertex := - if (sectorLetter s).2 then circleStart (sectorCircleEdge s) - else circleEnd (sectorCircleEdge s) - -def nextSector (s : Sector) : Sector := - ⟨s.1, ⟨(s.2.val + 1) % boundaryLength s.1, - Nat.mod_lt _ (by have := s.2.isLt; omega)⟩⟩ - -def edgeVertices : SeedEdge → Finset SeedVertex - | .inl e => {.inl (circleStart e), .inl (circleEnd e)} - | .inr s => {.inr s.1, .inl (sectorStart s)} - -def sectorEdges (s : Sector) : Finset SeedEdge := - {.inl (sectorCircleEdge s), .inr s, .inr (nextSector s)} - -def sectorVertices (s : Sector) : Finset SeedVertex := - (sectorEdges s).biUnion edgeVertices - -/-- Proper cell-face incidence, including vertices of closed triangles. -/ -def properFace : SeedCell → SeedCell → Prop - | .inl v, .inr (.inl e) => v ∈ edgeVertices e - | .inl v, .inr (.inr s) => v ∈ sectorVertices s - | .inr (.inl e), .inr (.inr s) => e ∈ sectorEdges s - | _, _ => False - -def seedGraph : SimpleGraph SeedCell where - Adj a b := properFace a b ∨ properFace b a - symm := ⟨fun _ _ h => h.elim Or.inr Or.inl⟩ - loopless := ⟨by - intro a - rcases a with a | a - · simp [properFace] - · rcases a with a | a <;> simp [properFace]⟩ - - -end EilenbergGanea - -namespace EilenbergGanea - -/-- The vertex of the rose common to its two circles. -/ -def seedBase : SeedCell := .inl (.inl none) - -theorem seed_vertex_edge_adj {v : SeedVertex} {e : SeedEdge} (h : v ∈ edgeVertices e) : - seedGraph.Adj (.inl v) (.inr (.inl e)) := Or.inl h - -theorem seed_edge_sector_adj {e : SeedEdge} {s : Sector} (h : e ∈ sectorEdges s) : - seedGraph.Adj (.inr (.inl e)) (.inr (.inr s)) := Or.inl h - -theorem rose_vertex_reachable (v : RoseVertex) : - seedGraph.Reachable seedBase (.inl (.inl v)) := by - rcases v with _ | ⟨b, i⟩ - · exact .refl _ - · fin_cases i - · have h₁ : seedGraph.Adj seedBase (.inr (.inl (.inl (b, 0)))) := by - apply seed_vertex_edge_adj - simp [edgeVertices, circleStart, circleEnd] - have h₂ : seedGraph.Adj (.inl (.inl (some (b, 0)))) - (.inr (.inl (.inl (b, 0)))) := by - apply seed_vertex_edge_adj - simp [edgeVertices, circleStart, circleEnd] - exact h₁.reachable.trans h₂.reachable.symm - · have h₁ : seedGraph.Adj seedBase (.inr (.inl (.inl (b, 2)))) := by - apply seed_vertex_edge_adj - simp [edgeVertices, circleStart, circleEnd] - have h₂ : seedGraph.Adj (.inl (.inl (some (b, 1)))) - (.inr (.inl (.inl (b, 2)))) := by - apply seed_vertex_edge_adj - simp [edgeVertices, circleStart, circleEnd] - exact h₁.reachable.trans h₂.reachable.symm - -def firstSector (r : Bool) : Sector := - ⟨r, ⟨0, by cases r <;> decide⟩⟩ - -theorem seed_vertex_reachable (v : SeedVertex) : - seedGraph.Reachable seedBase (.inl v) := by - rcases v with v | r - · exact rose_vertex_reachable v - · let s := firstSector r - have h₁ : seedGraph.Adj (.inl (.inl (sectorStart s))) (.inr (.inl (.inr s))) := by - apply seed_vertex_edge_adj - simp [edgeVertices] - have h₂ : seedGraph.Adj (.inl (.inr r)) (.inr (.inl (.inr s))) := by - apply seed_vertex_edge_adj - simp [edgeVertices, s, firstSector] - exact ((rose_vertex_reachable (sectorStart s)).trans h₁.reachable).trans h₂.reachable.symm - -theorem seed_edge_reachable (e : SeedEdge) : - seedGraph.Reachable seedBase (.inr (.inl e)) := by - rcases e with e | s - · apply (seed_vertex_reachable (.inl (circleStart e))).trans - apply SimpleGraph.Adj.reachable - apply seed_vertex_edge_adj - simp [edgeVertices] - · apply (seed_vertex_reachable (.inr s.1)).trans - apply SimpleGraph.Adj.reachable - apply seed_vertex_edge_adj - simp [edgeVertices] - -theorem seed_cell_reachable (x : SeedCell) : seedGraph.Reachable seedBase x := by - rcases x with v | e - · exact seed_vertex_reachable v - · rcases e with e | s - · exact seed_edge_reachable e - · apply (seed_edge_reachable (.inl (sectorCircleEdge s))).trans - apply SimpleGraph.Adj.reachable - apply seed_edge_sector_adj - simp [sectorEdges] - -theorem seed_connected : seedGraph.Connected := by - exact { preconnected := fun v w => - (seed_cell_reachable v).symm.trans (seed_cell_reachable w), nonempty := ⟨seedBase⟩ } - - -end EilenbergGanea - -end - -end OAI +import Mathlib.Tactic +import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected +import Mathlib.Data.Fintype.Sum +import Mathlib.LinearAlgebra.Matrix.Notation + +namespace OAI + +noncomputable section + +open Classical Set + +namespace EilenbergGanea +/-- `false` names x; `true` names y. The second Boolean is the positive sign. -/ +def seedWord : Bool → List (Bool × Bool) + | false => [(false, true), (false, true), (true, false), (true, false), + (true, false), (true, false), (true, false)] + | true => [(false, true), (false, true), (true, true), (false, false), + (true, true), (false, false), (true, true), (false, false)] + +/-- Numbers of sectors in the two coned boundary polygons. -/ +def boundaryLength (r : Bool) : ℕ := 3 * (seedWord r).length + +abbrev RoseVertex := Option (Bool × Fin 2) +abbrev SeedVertex := RoseVertex ⊕ Bool +abbrev CircleEdge := Bool × Fin 3 +abbrev Sector := (r : Bool) × Fin (boundaryLength r) +abbrev SeedEdge := CircleEdge ⊕ Sector +abbrev SeedCell := SeedVertex ⊕ (SeedEdge ⊕ Sector) + +def circleStart (e : CircleEdge) : RoseVertex := + ![none, some (e.1, 0), some (e.1, 1)] e.2 + +def circleEnd (e : CircleEdge) : RoseVertex := + ![some (e.1, 0), some (e.1, 1), none] e.2 + +def sectorLetter (s : Sector) : Bool × Bool := + (seedWord s.1).get ⟨s.2.val / 3, by + have h := s.2.isLt + dsimp [boundaryLength] at h + omega⟩ + +def sectorCircleEdge (s : Sector) : CircleEdge := + ((sectorLetter s).1, if (sectorLetter s).2 then + ⟨s.2.val % 3, Nat.mod_lt _ (by decide)⟩ else + ⟨2 - s.2.val % 3, by omega⟩) + +def sectorStart (s : Sector) : RoseVertex := + if (sectorLetter s).2 then circleStart (sectorCircleEdge s) + else circleEnd (sectorCircleEdge s) + +def nextSector (s : Sector) : Sector := + ⟨s.1, ⟨(s.2.val + 1) % boundaryLength s.1, + Nat.mod_lt _ (by have := s.2.isLt; omega)⟩⟩ + +def edgeVertices : SeedEdge → Finset SeedVertex + | .inl e => {.inl (circleStart e), .inl (circleEnd e)} + | .inr s => {.inr s.1, .inl (sectorStart s)} + +def sectorEdges (s : Sector) : Finset SeedEdge := + {.inl (sectorCircleEdge s), .inr s, .inr (nextSector s)} + +def sectorVertices (s : Sector) : Finset SeedVertex := + (sectorEdges s).biUnion edgeVertices + +/-- Proper cell-face incidence, including vertices of closed triangles. -/ +def properFace : SeedCell → SeedCell → Prop + | .inl v, .inr (.inl e) => v ∈ edgeVertices e + | .inl v, .inr (.inr s) => v ∈ sectorVertices s + | .inr (.inl e), .inr (.inr s) => e ∈ sectorEdges s + | _, _ => False + +def seedGraph : SimpleGraph SeedCell where + Adj a b := properFace a b ∨ properFace b a + symm := ⟨fun _ _ h => h.elim Or.inr Or.inl⟩ + loopless := ⟨by + intro a + rcases a with a | a + · simp [properFace] + · rcases a with a | a <;> simp [properFace]⟩ + + +end EilenbergGanea + +namespace EilenbergGanea + +/-- The vertex of the rose common to its two circles. -/ +def seedBase : SeedCell := .inl (.inl none) + +theorem seed_vertex_edge_adj {v : SeedVertex} {e : SeedEdge} (h : v ∈ edgeVertices e) : + seedGraph.Adj (.inl v) (.inr (.inl e)) := Or.inl h + +theorem seed_edge_sector_adj {e : SeedEdge} {s : Sector} (h : e ∈ sectorEdges s) : + seedGraph.Adj (.inr (.inl e)) (.inr (.inr s)) := Or.inl h + +theorem rose_vertex_reachable (v : RoseVertex) : + seedGraph.Reachable seedBase (.inl (.inl v)) := by + rcases v with _ | ⟨b, i⟩ + · exact .refl _ + · fin_cases i + · have h₁ : seedGraph.Adj seedBase (.inr (.inl (.inl (b, 0)))) := by + apply seed_vertex_edge_adj + simp [edgeVertices, circleStart, circleEnd] + have h₂ : seedGraph.Adj (.inl (.inl (some (b, 0)))) + (.inr (.inl (.inl (b, 0)))) := by + apply seed_vertex_edge_adj + simp [edgeVertices, circleStart, circleEnd] + exact h₁.reachable.trans h₂.reachable.symm + · have h₁ : seedGraph.Adj seedBase (.inr (.inl (.inl (b, 2)))) := by + apply seed_vertex_edge_adj + simp [edgeVertices, circleStart, circleEnd] + have h₂ : seedGraph.Adj (.inl (.inl (some (b, 1)))) + (.inr (.inl (.inl (b, 2)))) := by + apply seed_vertex_edge_adj + simp [edgeVertices, circleStart, circleEnd] + exact h₁.reachable.trans h₂.reachable.symm + +def firstSector (r : Bool) : Sector := + ⟨r, ⟨0, by cases r <;> decide⟩⟩ + +theorem seed_vertex_reachable (v : SeedVertex) : + seedGraph.Reachable seedBase (.inl v) := by + rcases v with v | r + · exact rose_vertex_reachable v + · let s := firstSector r + have h₁ : seedGraph.Adj (.inl (.inl (sectorStart s))) (.inr (.inl (.inr s))) := by + apply seed_vertex_edge_adj + simp [edgeVertices] + have h₂ : seedGraph.Adj (.inl (.inr r)) (.inr (.inl (.inr s))) := by + apply seed_vertex_edge_adj + simp [edgeVertices, s, firstSector] + exact ((rose_vertex_reachable (sectorStart s)).trans h₁.reachable).trans h₂.reachable.symm + +theorem seed_edge_reachable (e : SeedEdge) : + seedGraph.Reachable seedBase (.inr (.inl e)) := by + rcases e with e | s + · apply (seed_vertex_reachable (.inl (circleStart e))).trans + apply SimpleGraph.Adj.reachable + apply seed_vertex_edge_adj + simp [edgeVertices] + · apply (seed_vertex_reachable (.inr s.1)).trans + apply SimpleGraph.Adj.reachable + apply seed_vertex_edge_adj + simp [edgeVertices] + +theorem seed_cell_reachable (x : SeedCell) : seedGraph.Reachable seedBase x := by + rcases x with v | e + · exact seed_vertex_reachable v + · rcases e with e | s + · exact seed_edge_reachable e + · apply (seed_edge_reachable (.inl (sectorCircleEdge s))).trans + apply SimpleGraph.Adj.reachable + apply seed_edge_sector_adj + simp [sectorEdges] + +theorem seed_connected : seedGraph.Connected := by + exact { preconnected := fun v w => + (seed_cell_reachable v).symm.trans (seed_cell_reachable w), nonempty := ⟨seedBase⟩ } + + +end EilenbergGanea + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/SeedChains.lean b/lean/OAI/Topology/EilenbergGanea/SeedChains.lean index 6345e02bdbbef67320d862b0dc494b78662c055b..d8dd907d6700e130c037ae93cb877153732db07e 100644 --- a/lean/OAI/Topology/EilenbergGanea/SeedChains.lean +++ b/lean/OAI/Topology/EilenbergGanea/SeedChains.lean @@ -1,3688 +1,3688 @@ -import OAI.Topology.EilenbergGanea.Seed -import OAI.AlgebraicTopology.Simplicial.Chains - -namespace OAI - -noncomputable section - -open Classical Set - -namespace EilenbergGanea -namespace SeedEncoding - -def finite (n : ℕ) : Fin 103 := ⟨n % 103, Nat.mod_lt _ (by decide)⟩ -def roseAt : ℕ → RoseVertex - | 0 => none - | 1 => some (false,0) - | 2 => some (false,1) - | 3 => some (true,0) - | _ => some (true,1) - -def sectorAt (n : ℕ) : Sector := - if n < 21 then ⟨false,⟨n % 21,by change n % 21 < 21; omega⟩⟩ - else ⟨true,⟨(n-21) % 24,by change (n-21) % 24 < 24; omega⟩⟩ - -def cellAt (i : Fin 103) : SeedCell := - if i.val < 5 then .inl (.inl (roseAt i.val)) - else if i.val < 7 then .inl (.inr (decide (i.val = 6))) - else if i.val < 13 then .inr (.inl (.inl (decide (10 ≤ i.val),⟨(i.val-7)%3,by omega⟩))) - else if i.val < 58 then .inr (.inl (.inr (sectorAt (i.val-13)))) - else .inr (.inr (sectorAt (i.val-58))) - -def sectorCode (s : Sector) : ℕ := (if s.1 then 21 else 0) + s.2.val - -def cellCode : SeedCell → Fin 103 - | .inl (.inl none) => finite 0 - | .inl (.inl (some (q,j))) => finite (1 + (if q then 2 else 0) + j.val) - | .inl (.inr r) => finite (5 + if r then 1 else 0) - | .inr (.inl (.inl (q,j))) => finite (7 + (if q then 3 else 0) + j.val) - | .inr (.inl (.inr s)) => finite (13 + sectorCode s) - | .inr (.inr s) => finite (58 + sectorCode s) - -theorem cellAt_code (c : SeedCell) : cellAt (cellCode c) = c := by - rcases c with (v|e) - · rcases v with (v|r) - · rcases v with _ | ⟨q,j⟩ - · decide +kernel - · cases q <;> fin_cases j <;> decide +kernel - · cases r <;> decide +kernel - · rcases e with (e|s) - · rcases e with (⟨q,j⟩|⟨r,i⟩) - · cases q <;> fin_cases j <;> decide +kernel - · cases r <;> fin_cases i <;> decide +kernel - · rcases s with ⟨r,i⟩ - cases r <;> fin_cases i <;> decide +kernel -theorem code_cellAt : ∀ i : Fin 103, cellCode (cellAt i) = i := by decide +kernel - -def cellEquiv : SeedCell ≃ Fin 103 where - toFun := cellCode - invFun := cellAt - left_inv := cellAt_code - right_inv := code_cellAt - -instance properFaceDecidable : DecidableRel properFace := by - intro a b - unfold properFace - split <;> infer_instance - -instance seedAdjDecidable : DecidableRel seedGraph.Adj := - fun a b => inferInstanceAs (Decidable (properFace a b ∨ properFace b a)) - -def adjCodes : List ℕ := [7243717715589717591194788771456,7726619075706194405914338017664,3863334018612617729895957824256,482913190295244515963480050688,965825603447607950602534918144,604462621576955615502336,10141204197363213635018010132480,5151073943635249663071907479555,2575545132070798340360931115014,1287788886541746187830420307973,160971236130163140008121204745,321941954165072225809775722520,643883649282517424516318101521,302231743134033445388321,864691128455135266,1729382256910270500,3458764513820540961,6917529027641081890,13835058055282163748,27670116110564327457,55340232221128654896,110680464442257309736,221360928884514619425,442721857769029238832,885443715538058477608,1770887431076116955169,3541774862152233910320,7083549724304467820584,14167099448608935641121,28334198897217871282224,56668397794435742564392,113336795588871485128737,226673591177742970257456,453347182355485940514856,5070603005375827413301400174657,1813388729421943762059330,3626777458843887524118596,7253554917687775048237121,14507109835375550096474178,29014219670751100192948292,58028439341502200385896513,116056878683004400771792968,232113757366008801543585872,464227514732017603087171649,928455029464035206174343236,1856910058928070412348686402,3713820117856140824697372737,7427640235712281649394745416,14855280471424563298789490768,29710560942849126597578981441,59421121885698253195157962820,118842243771396506390315925570,237684487542793012780631851073,475368975085586025561263702088,950737950171172051122527404112,1901475900342344102245054808129,3802951800684688204490109616196,7605903601369376408980219232322,24739,49446,98853,196771,393510,786981,1577009,3147832,6292521,12587057,25167928,50332713,100667441,201328696,402654249,805310513,1610614840,3221226537,6442455089,12884903992,8589943849,51539607747,103079215430,206158430789,412316860611,824633721158,1649267442245,3298534884425,6597069768792,13194139537489,26388279067205,52776558133574,105553116266691,211106232534089,422212465068120,844424930136145,1688849860264517,3377699720528198,6755399441055939,13510798882112585,27021597764225112,54043195528450129,108086391056892485,216172782113784134,144115205255725251] - -def indexedAdj (a b : Fin 103) : Prop := ((adjCodes.getD a.val 0 >>> b.val) % 2) = 1 -instance : DecidableRel indexedAdj := fun a b => inferInstanceAs (Decidable (((adjCodes.getD a.val 0 >>> b.val) % 2) = 1)) - -theorem adjacency_certificate : ∀ a b : Fin 103, - seedGraph.Adj (cellAt a) (cellAt b) ↔ indexedAdj a b := by decide +kernel - -end SeedEncoding -end EilenbergGanea -namespace EilenbergGanea.SeedChainCertificate -def edgeData_0 : List (Fin 103 × Fin 103) := [ - (0,7), - (0,9), - (0,10), - (0,12), - (0,13), - (0,16), - (0,19), - (0,22), - (0,25), - (0,28), - (0,31), - (0,34), - (0,37), - (0,40), - (0,43), - (0,46)] - -def edgeData_1 : List (Fin 103 × Fin 103) := [ - (0,49), - (0,52), - (0,55), - (0,58), - (0,60), - (0,61), - (0,63), - (0,64), - (0,66), - (0,67), - (0,69), - (0,70), - (0,72), - (0,73), - (0,75), - (0,76)] - -def edgeData_2 : List (Fin 103 × Fin 103) := [ - (0,78), - (0,79), - (0,81), - (0,82), - (0,84), - (0,85), - (0,87), - (0,88), - (0,90), - (0,91), - (0,93), - (0,94), - (0,96), - (0,97), - (0,99), - (0,100)] - -def edgeData_3 : List (Fin 103 × Fin 103) := [ - (0,102), - (1,7), - (1,8), - (1,14), - (1,17), - (1,35), - (1,38), - (1,45), - (1,51), - (1,57), - (1,58), - (1,59), - (1,61), - (1,62), - (1,79), - (1,80)] - -def edgeData_4 : List (Fin 103 × Fin 103) := [ - (1,82), - (1,83), - (1,89), - (1,90), - (1,95), - (1,96), - (1,101), - (1,102), - (2,8), - (2,9), - (2,15), - (2,18), - (2,36), - (2,39), - (2,44), - (2,50)] - -def edgeData_5 : List (Fin 103 × Fin 103) := [ - (2,56), - (2,59), - (2,60), - (2,62), - (2,63), - (2,80), - (2,81), - (2,83), - (2,84), - (2,88), - (2,89), - (2,94), - (2,95), - (2,100), - (2,101), - (3,10)] - -def edgeData_6 : List (Fin 103 × Fin 103) := [ - (3,11), - (3,21), - (3,24), - (3,27), - (3,30), - (3,33), - (3,41), - (3,47), - (3,53), - (3,65), - (3,66), - (3,68), - (3,69), - (3,71), - (3,72), - (3,74)] - -def edgeData_7 : List (Fin 103 × Fin 103) := [ - (3,75), - (3,77), - (3,78), - (3,85), - (3,86), - (3,91), - (3,92), - (3,97), - (3,98), - (4,11), - (4,12), - (4,20), - (4,23), - (4,26), - (4,29), - (4,32)] - -def edgeData_8 : List (Fin 103 × Fin 103) := [ - (4,42), - (4,48), - (4,54), - (4,64), - (4,65), - (4,67), - (4,68), - (4,70), - (4,71), - (4,73), - (4,74), - (4,76), - (4,77), - (4,86), - (4,87), - (4,92)] - -def edgeData_9 : List (Fin 103 × Fin 103) := [ - (4,93), - (4,98), - (4,99), - (5,13), - (5,14), - (5,15), - (5,16), - (5,17), - (5,18), - (5,19), - (5,20), - (5,21), - (5,22), - (5,23), - (5,24), - (5,25)] - -def edgeData_10 : List (Fin 103 × Fin 103) := [ - (5,26), - (5,27), - (5,28), - (5,29), - (5,30), - (5,31), - (5,32), - (5,33), - (5,58), - (5,59), - (5,60), - (5,61), - (5,62), - (5,63), - (5,64), - (5,65)] - -def edgeData_11 : List (Fin 103 × Fin 103) := [ - (5,66), - (5,67), - (5,68), - (5,69), - (5,70), - (5,71), - (5,72), - (5,73), - (5,74), - (5,75), - (5,76), - (5,77), - (5,78), - (6,34), - (6,35), - (6,36)] - -def edgeData_12 : List (Fin 103 × Fin 103) := [ - (6,37), - (6,38), - (6,39), - (6,40), - (6,41), - (6,42), - (6,43), - (6,44), - (6,45), - (6,46), - (6,47), - (6,48), - (6,49), - (6,50), - (6,51), - (6,52)] - -def edgeData_13 : List (Fin 103 × Fin 103) := [ - (6,53), - (6,54), - (6,55), - (6,56), - (6,57), - (6,79), - (6,80), - (6,81), - (6,82), - (6,83), - (6,84), - (6,85), - (6,86), - (6,87), - (6,88), - (6,89)] - -def edgeData_14 : List (Fin 103 × Fin 103) := [ - (6,90), - (6,91), - (6,92), - (6,93), - (6,94), - (6,95), - (6,96), - (6,97), - (6,98), - (6,99), - (6,100), - (6,101), - (6,102), - (7,58), - (7,61), - (7,79)] - -def edgeData_15 : List (Fin 103 × Fin 103) := [ - (7,82), - (7,90), - (7,96), - (7,102), - (8,59), - (8,62), - (8,80), - (8,83), - (8,89), - (8,95), - (8,101), - (9,60), - (9,63), - (9,81), - (9,84), - (9,88)] - -def edgeData_16 : List (Fin 103 × Fin 103) := [ - (9,94), - (9,100), - (10,66), - (10,69), - (10,72), - (10,75), - (10,78), - (10,85), - (10,91), - (10,97), - (11,65), - (11,68), - (11,71), - (11,74), - (11,77), - (11,86)] - -def edgeData_17 : List (Fin 103 × Fin 103) := [ - (11,92), - (11,98), - (12,64), - (12,67), - (12,70), - (12,73), - (12,76), - (12,87), - (12,93), - (12,99), - (13,58), - (13,78), - (14,58), - (14,59), - (15,59), - (15,60)] - -def edgeData_18 : List (Fin 103 × Fin 103) := [ - (16,60), - (16,61), - (17,61), - (17,62), - (18,62), - (18,63), - (19,63), - (19,64), - (20,64), - (20,65), - (21,65), - (21,66), - (22,66), - (22,67), - (23,67), - (23,68)] - -def edgeData_19 : List (Fin 103 × Fin 103) := [ - (24,68), - (24,69), - (25,69), - (25,70), - (26,70), - (26,71), - (27,71), - (27,72), - (28,72), - (28,73), - (29,73), - (29,74), - (30,74), - (30,75), - (31,75), - (31,76)] - -def edgeData_20 : List (Fin 103 × Fin 103) := [ - (32,76), - (32,77), - (33,77), - (33,78), - (34,79), - (34,102), - (35,79), - (35,80), - (36,80), - (36,81), - (37,81), - (37,82), - (38,82), - (38,83), - (39,83), - (39,84)] - -def edgeData_21 : List (Fin 103 × Fin 103) := [ - (40,84), - (40,85), - (41,85), - (41,86), - (42,86), - (42,87), - (43,87), - (43,88), - (44,88), - (44,89), - (45,89), - (45,90), - (46,90), - (46,91), - (47,91), - (47,92)] - -def edgeData_22 : List (Fin 103 × Fin 103) := [ - (48,92), - (48,93), - (49,93), - (49,94), - (50,94), - (50,95), - (51,95), - (51,96), - (52,96), - (52,97), - (53,97), - (53,98), - (54,98), - (54,99), - (55,99), - (55,100)] - -def edgeData_23 : List (Fin 103 × Fin 103) := [ - (56,100), - (56,101), - (57,101), - (57,102)] - -def edgeData : List (Fin 103 × Fin 103) := [edgeData_0,edgeData_1,edgeData_2,edgeData_3,edgeData_4,edgeData_5,edgeData_6,edgeData_7,edgeData_8,edgeData_9,edgeData_10,edgeData_11,edgeData_12,edgeData_13,edgeData_14,edgeData_15,edgeData_16,edgeData_17,edgeData_18,edgeData_19,edgeData_20,edgeData_21,edgeData_22,edgeData_23].flatten - -def triangleEdgeData_0 : List (Fin 372 × Fin 372 × Fin 372) := [ - (237,19,0), - (238,21,0), - (239,33,0), - (240,35,0), - (241,40,0), - (242,44,0), - (243,48,0), - (251,20,1), - (252,22,1), - (253,34,1), - (254,36,1), - (255,39,1), - (256,43,1), - (257,47,1), - (258,24,2), - (259,26,2)] - -def triangleEdgeData_1 : List (Fin 372 × Fin 372 × Fin 372) := [ - (260,28,2), - (261,30,2), - (262,32,2), - (263,37,2), - (264,41,2), - (265,45,2), - (274,23,3), - (275,25,3), - (276,27,3), - (277,29,3), - (278,31,3), - (279,38,3), - (280,42,3), - (281,46,3), - (282,19,4), - (283,32,4)] - -def triangleEdgeData_2 : List (Fin 372 × Fin 372 × Fin 372) := [ - (288,20,5), - (289,21,5), - (294,22,6), - (295,23,6), - (300,24,7), - (301,25,7), - (306,26,8), - (307,27,8), - (312,28,9), - (313,29,9), - (318,30,10), - (319,31,10), - (324,33,11), - (325,48,11), - (330,34,12), - (331,35,12)] - -def triangleEdgeData_3 : List (Fin 372 × Fin 372 × Fin 372) := [ - (336,36,13), - (337,37,13), - (342,38,14), - (343,39,14), - (348,40,15), - (349,41,15), - (354,42,16), - (355,43,16), - (360,44,17), - (361,45,17), - (366,46,18), - (367,47,18), - (237,58,49), - (238,60,49), - (239,62,49), - (240,64,49)] - -def triangleEdgeData_4 : List (Fin 372 × Fin 372 × Fin 372) := [ - (241,67,49), - (242,69,49), - (243,71,49), - (244,59,50), - (245,61,50), - (246,63,50), - (247,65,50), - (248,66,50), - (249,68,50), - (250,70,50), - (284,58,51), - (285,59,51), - (290,60,52), - (291,61,52), - (326,62,53), - (327,63,53)] - -def triangleEdgeData_5 : List (Fin 372 × Fin 372 × Fin 372) := [ - (332,64,54), - (333,65,54), - (346,66,55), - (347,67,55), - (358,68,56), - (359,69,56), - (370,70,57), - (371,71,57), - (244,81,72), - (245,83,72), - (246,85,72), - (247,87,72), - (248,90,72), - (249,92,72), - (250,94,72), - (251,82,73)] - -def triangleEdgeData_6 : List (Fin 372 × Fin 372 × Fin 372) := [ - (252,84,73), - (253,86,73), - (254,88,73), - (255,89,73), - (256,91,73), - (257,93,73), - (286,81,74), - (287,82,74), - (292,83,75), - (293,84,75), - (328,85,76), - (329,86,76), - (334,87,77), - (335,88,77), - (344,89,78), - (345,90,78)] - -def triangleEdgeData_7 : List (Fin 372 × Fin 372 × Fin 372) := [ - (356,91,79), - (357,92,79), - (368,93,80), - (369,94,80), - (258,106,95), - (259,108,95), - (260,110,95), - (261,112,95), - (262,114,95), - (263,115,95), - (264,117,95), - (265,119,95), - (266,105,96), - (267,107,96), - (268,109,96), - (269,111,96)] - -def triangleEdgeData_8 : List (Fin 372 × Fin 372 × Fin 372) := [ - (270,113,96), - (271,116,96), - (272,118,96), - (273,120,96), - (298,105,97), - (299,106,97), - (304,107,98), - (305,108,98), - (310,109,99), - (311,110,99), - (316,111,100), - (317,112,100), - (322,113,101), - (323,114,101), - (338,115,102), - (339,116,102)] - -def triangleEdgeData_9 : List (Fin 372 × Fin 372 × Fin 372) := [ - (350,117,103), - (351,118,103), - (362,119,104), - (363,120,104), - (266,132,121), - (267,134,121), - (268,136,121), - (269,138,121), - (270,140,121), - (271,141,121), - (272,143,121), - (273,145,121), - (274,131,122), - (275,133,122), - (276,135,122), - (277,137,122)] - -def triangleEdgeData_10 : List (Fin 372 × Fin 372 × Fin 372) := [ - (278,139,122), - (279,142,122), - (280,144,122), - (281,146,122), - (296,131,123), - (297,132,123), - (302,133,124), - (303,134,124), - (308,135,125), - (309,136,125), - (314,137,126), - (315,138,126), - (320,139,127), - (321,140,127), - (340,141,128), - (341,142,128)] - -def triangleEdgeData_11 : List (Fin 372 × Fin 372 × Fin 372) := [ - (352,143,129), - (353,144,129), - (364,145,130), - (365,146,130), - (282,168,147), - (283,188,147), - (284,168,148), - (285,169,148), - (286,169,149), - (287,170,149), - (288,170,150), - (289,171,150), - (290,171,151), - (291,172,151), - (292,172,152), - (293,173,152)] - -def triangleEdgeData_12 : List (Fin 372 × Fin 372 × Fin 372) := [ - (294,173,153), - (295,174,153), - (296,174,154), - (297,175,154), - (298,175,155), - (299,176,155), - (300,176,156), - (301,177,156), - (302,177,157), - (303,178,157), - (304,178,158), - (305,179,158), - (306,179,159), - (307,180,159), - (308,180,160), - (309,181,160)] - -def triangleEdgeData_13 : List (Fin 372 × Fin 372 × Fin 372) := [ - (310,181,161), - (311,182,161), - (312,182,162), - (313,183,162), - (314,183,163), - (315,184,163), - (316,184,164), - (317,185,164), - (318,185,165), - (319,186,165), - (320,186,166), - (321,187,166), - (322,187,167), - (323,188,167), - (324,213,189), - (325,236,189)] - -def triangleEdgeData_14 : List (Fin 372 × Fin 372 × Fin 372) := [ - (326,213,190), - (327,214,190), - (328,214,191), - (329,215,191), - (330,215,192), - (331,216,192), - (332,216,193), - (333,217,193), - (334,217,194), - (335,218,194), - (336,218,195), - (337,219,195), - (338,219,196), - (339,220,196), - (340,220,197), - (341,221,197)] - -def triangleEdgeData_15 : List (Fin 372 × Fin 372 × Fin 372) := [ - (342,221,198), - (343,222,198), - (344,222,199), - (345,223,199), - (346,223,200), - (347,224,200), - (348,224,201), - (349,225,201), - (350,225,202), - (351,226,202), - (352,226,203), - (353,227,203), - (354,227,204), - (355,228,204), - (356,228,205), - (357,229,205)] - -def triangleEdgeData_16 : List (Fin 372 × Fin 372 × Fin 372) := [ - (358,229,206), - (359,230,206), - (360,230,207), - (361,231,207), - (362,231,208), - (363,232,208), - (364,232,209), - (365,233,209), - (366,233,210), - (367,234,210), - (368,234,211), - (369,235,211), - (370,235,212), - (371,236,212)] - -def triangleEdgeData : List (Fin 372 × Fin 372 × Fin 372) := [triangleEdgeData_0,triangleEdgeData_1,triangleEdgeData_2,triangleEdgeData_3,triangleEdgeData_4,triangleEdgeData_5,triangleEdgeData_6,triangleEdgeData_7,triangleEdgeData_8,triangleEdgeData_9,triangleEdgeData_10,triangleEdgeData_11,triangleEdgeData_12,triangleEdgeData_13,triangleEdgeData_14,triangleEdgeData_15,triangleEdgeData_16].flatten - -def edge (e : Fin 372) : Fin 103 × Fin 103 := edgeData.getD e.val (0,0) -def triangleEdges (t : Fin 270) : Fin 372 × Fin 372 × Fin 372 := - triangleEdgeData.getD t.val (0,0,0) -def triangle (t : Fin 270) : Fin 103 × Fin 103 × Fin 103 := - ((edge (triangleEdges t).2.2).1,(edge (triangleEdges t).2.2).2, - (edge (triangleEdges t).1).2) -def edgeLookupCodes_0 : List ℕ := [ -539308444549082356491752287909326183426464912366339139781129275178863916183935784697545588561881155762728260682345972670060416696876225432522252714072845974688325235239916136445621603303845709788079501054819797455545459152796807710230896398097542351676936324040692200595397156860396293377773231214769324687360, -798494385964783801143608826032965403140977342049928697190365372535310697209048811264676733180033956852196987546018861884172872086035816854132865449803533653731351945270377344793394695381665482860124458693186222147656939956350863819080464639432715829750053259145346874197799978907023390893592477163043145383936, -1032387827937896701936999347097236551693905144394577639124200286695598642925199909094821986611074343810155524683346113527032504172512929739408948259436470887823449221440818458968284597631224047201777603335447575643157087950602789437247149806822943141981229487422757983248555496472872278645363095269653086208, -1227431811162305011616494391569921538066725297217451758593339146680570242602422105775973732280028000445395431755498796189549993047440367773266567159143686638500912515102786283150425818079438313775233888034455925753784251790014568730990740621861692432328386488949034824047556274534105294242651832320, -1529218593185593780992386251337889671275517429626312788471185376766237507998661442998244821126555289608058121021326215327298212263035612554355603818593632632366190010903576641690757999226741840976037058671880300770519223722199137497194509100910088885351914645103311095294119195116094448307598350352384, -1196675864571150401516528216380653912802418752795291780028657428993776888722459038110017505120398351103732672361286816204322660269274811012807720991223823320519687240637009183021430337509433213724369886758051538385002455557923674779549696, -2654178362004863499238265706443280593203245108170597463794461375685477716122751997321391831422752866401740697670288527293272183367478580954432066527644705872269975931439293468963002848585639539314109127634550739286331541262437734163025643906154482777589271651577174328551039699158578973116449075348141558988800, -2730246448572142287222248249269631093664924786693548868506890145819922899481162462438562083519182065769767651405449718099610134106275904219948082631539477187198015464924326724976203632679714848731114036987319818608680493233279978129935271914721101293903556707078737730030991118052291050554050738171353524862976, -2743062034396844343997678270943799725959330023168550399064946236750171955952951956306506596584346365945732302040042574276952026844306435640763769988839014179323182992053281300070489984043040019597414388365987658377079736031202740593457472327253636858212589368120404321185541783954055359385686610532240457728, -2753777120468707017216679429648657555675299740560145397429702066978119760636416461324143666331518005441460015474577528586259130144708809356511564772308163510423830837839965336919061923152342734365095912881892789698777343884746556441432017621140575145058740455701929787274178999174423865065121390545338368, -2644488410133503752729766330679270302620347895575680336413021429746389909425847482609469099509330044651673384061576217262485171998179187347122896259462153577335095901894885149561835987406417023500527933980964264073640301799478418295978604495611784386708698849443245801643821282283184219507130368, -2789705751055249966351632240625415946744831959974004638270325607901435856745935371984448185915035667857372272438703593346830953680827012952405676397411148673749060041386863250371936274628239279569752293990023695194647339626275502458441822455281075557204717421727924311057958788595487336490596302848, -2940370299017003100065775368842505322092981939075596914744753502613505505136206203794894786014252715409252327535266198445782324964446989287542408831976266180196508776663973626054687402580030659107865598022230342254785256054817645714221986925655032467059235645009503873019514595494212380998792208449536, -1799629292016028174938772255682102161972014050689126977340833788769352877371219803561766504053205919065558106484553724118760589248856161840286364059636524187388342730337610728137589063974043498152669833817633751391008599231600187083325440, -1156018339198867022526243815205494651869163363597478520368892099169304143792328242644184133497833012392659682682456619013898850548509206247368951248207767036551533387314665382477824, -1192069914999997287673270577044417617615171247972350227167307128226970800922442227596667403727505187090758129976555467145451085129353694911545228044385391751638218843587730139277950976] -def edgeLookupCodes_1 : List ℕ := [ -1229186099876203258142379507014050520797510872699783628264313596830283938407977302759106820867306874359227130763545964974765821232162777728803481610860574779236011518530808757144176820224, -1267397229355427116756305861769848218784856460775301758883128007020697371311486734806247649605271999628818366905445510750811884842872188793021081297173000606509554627817248616107757405208576, -1306734481856125027507010670957884113175615270815769684401765264268476405445841624665261992593839882151719067554836432248282694393865925828349334963020567182419387863714763842457474812423962624, -1347229901672747711954497678810566297923110426416773496532180428132104911532770132878260625399686386363932802456060581363439635157637867860628564662001645305623543591469737064469100586920287666176, -1388916422579019157239620024893705486289296195090635608306640103068968943502334404709676001672479471006213406449631903851149098246099996337180068169595115332044425226747449297164028893100480107905024, -1431827892065428129216342452925840469509455169055227039912271306476198356577394885992461437886136404352777854140679958923403274332957507568718321792307758972037470019409805148479179556039255701141323776, -1475999096227779216813377536369179157564079139161746654124588182947607055368600925759707801661085522324677816398783332662507388991394425741480195869644922720318923373189347549862290970156666646310812647424, -1521465785324093470012641690564912818534887613656003399044106801217113081448396275981450333109009783390321776801290636684748620867420532462175058149341901059349992905219127938746267724727434705564579582181376, -1568264700017603606536586018701093048037537985341827301646986550370177575116129488880598914372677623726257632880872592100443827617436849116236181225643418883167650074923380722107954683918789391674252301722189824, -1616433598324055551774952392974044538772839479603104893616955121965088107344999619743941312145130730763085584708836937969361989085834314742994025376113388627518369192860031421378284766941886100326784113961626238976, -1666011283282007050707395279665325871467765823709366917475733520743541122837588626303128920035982924626414953828004189826938366660007215094745294005419946310321218262014485486917656512052154228305033083862763620532224, -1717037631365305565590773052339435658477715476792478130061009916513107992323991185396185022909800428494264595368099179697408057852026974098088658970316577450049153505833265969504204208901956700032449776669513699689496576, -1769553621657431973127345498420815487562177280109122085505913556771665791858986616276957216463620446383186204688713798668319977722067517377697932164181124995409284619636427571614441625049607649567278771674682830800891674624, -1823601365807914032219893136635954033503410085870332483409257430050722815568083208917218272734827780083963354849785894222329962704547239197647951403784268474335473714482780969427536015548018317620560867368738440314612587954176, -1879224138791544549332361710478328839928986252194738126090710403038474096919105661713236332350370020425261092964688751214899474659018076774946017557961794512252764137940848748054409018414324123734249751083624101774450791519617024, -1936466410491683972783670117418435327539692110293253928110429386449928223433209976315126941102363027501612759616713468668040261128785695346176545667531262061348867268865361698216981664673256949990446258157219881642740012005537611776] -def edgeLookupCodes_2 : List ℕ := [ -1995373878129486158900225887546431409143912753499234319466466631872981986940165893156761474947017885785864355878487711838232023251698565196603770220246678059162525757930797341108478458358011901211669269713724091462085031418867088359424, -2055993499561459639982052940652938283916473124923572855345002057749747172438758165060436953298141216163919099811287891722640198766101072239332103861187936017923902906924507446520594116700783294088316488780241944700932393517121190154469376, -3651564180189079187575151168790206490161515738476560225866548523516447087100679967024532353689508733326977191018575597845260542557491091109293241670011947979580717350417385549841912539136546118805039121169584138397650868536775549575891753164029441963244459033186921082086065178495527506780214408232072460107776, -2182563544459054957480898675882037950097848853441320509524077456836132243308874035097777848139572595552217568216058000911338216021111136788521198731917903935419822604058623355095999806056842142504400508123368804621690639436243296325004454526976, -2248614499113475977722303940274185439384343980484659813481467644314315693485813157686743452506709024141493796169959931076124405249008748769860452381391211831464393419594034045463153111888325572675200498601408223466673680816189962182451447384244224, -2316578742989700791279787659719847954297334512686497203415326692176314337099099446715763085842939607488017205746356704480295400747417286111513801995569653793852301816455206681915394480511431466420116353929714473984753814374058791862372693332853784576, -2386510068620495033724862550629304339113063208301263624013445648972563869766375649239348097350665394437268238555826626087566756372326004206275072770656979632419906325756029441307156658635998767534927254826585013390984990302555199948713067053303279386624, -2458463748525605332151523878610415997978271616626231410411107087520339822943512028202756909873316485946170223029641202470206486916399828412784652592999048990653496925657013494100940154089770714578591091946641823151700044478539977759085052040974626168242176, -2532496575266635519763239429505458537169680904142816122708424530424600825084165520982447480892980846580303636252790722382586486074918736402783877804897639257814026008309609308470632335089949379790250675149681246813216213900557753109184433581431494906451329024, -2608666902572084407708998049089383518627442353009020191903616412905854639589554918487318411341502066228970459262186345918137886256582705675137301867073794405579644072700351282157467599249380913000472649877505297120349780229212742648899352445854691959421613899776, -2687034687560841260216769456501941755077766615220015794333497453216684067115954527732337256702557947453143034881551351927303383830987392280395686770618783960225510925201062535619591871863453348962026095003378685444061345202436450420729697182027297929868356484071424, -2767661534093176921026073508594027301970977035221805990049476300408599534891217734588068311236011805785928007146110858889659977866479712204237595063658498507916765511635932526909375408225833618443845833248964553356169743820962869625842132438527376684327915862806757376, -2850610737279029648988339295979587836664136761813315386062286037732674135097034785564900630127210775940953647691277448607499561666589014746470407039184242934336110423926760465760551669415414791731790791899616596805243566238341953557357624281762611495393929918386561613824, -2935947329174165637986282822818705117296632872508929472833442144099268962780633713573498172977915353863287824450495874777075001341852471496500753134778555798083023835072845848541084590906957781173333453365548534757139778359314358904681374665188545808420939769097219762814976, -3023738125695595433378310355511615784805570253743128566107241866813726321891229498090023015122500478118952052393086609592392142374008618898038588888506825555359611490349761515666805014868511555188032651085711026570967188367940154743427627075432629704251899189008998843467956224, -3114051774788449539541675110867842590207373768742004072481831913543476455316572235244322714742390409095062909490038214054972910974935354351268256324608419812845779531350967175605800354455857502673481570227302762035838201544645023711704603129561281024697094199769543321408898072576] -def edgeLookupCodes_3 : List ℕ := [ -3206958805877359979831255467716393591576415843994669561108324511200969888784922075591128946687324496482630571345465077644632338594699144141767677570443110663171396502101789244588843390654831792982443730680665531251718146253331792861326659721092658413814009477113724750957167587098624, -3302531680636259974319959676829815163679212491568667598843139218363821964621490362667081147881923803189162724734086168675299754343490033078104740520434892224500443918438592615789923551587190275304696149451338786999027685503945811396472633177614914619738311161511359632170622513028530176, -3400844845111401809195738884831276328534195362700076612722026636552039181442273812407138564460571977707634426276266084190715897821192337976360324309745704069031298886374351918203772386451284781665658796734132295676207092986347383708617489204050889752300622457301263482225771946872903041024, -3501974783233303966400347198042953655767938185250649706730167002623513263218832889285822498293815276492355811763023802017715043527322503250679187790403664384178322637074007037786790969423141602733372146104415921628579672081053958704380930083045485500404955428060052173935438274974301370187776, -3606000071754273259708679964691128679543664966754735065121770218923764126352156052138736749137924964159584226323610761035916295870201909671490973171330793268908641499648693976404909071483051611178096316777554301424356639686746313206924852450450288531920971222879857195081406542183168026999783424, -3713001436649106696011166104152343363154904301376312146485093813412915887276264679064362250263534679235580007835530392377029004460467789838629333038375151829420728953788011260022931650843449570464992825286847179879472839846393213645377159675762687909301522521524450267190194473771675085749539045376, -3823061811017561675858579378648034261460065973038874200356346800791446844587951678196385863075670215855867666345659766224158435276645195953819555378490953063914505228222218125524210086387972394069621782726122245222814188189243599428467988932878623090601953803079605009015837335908132978535731061325824, -3936266394528192609281766058643526573106698180063646477017044517527621448299528524831605536646636462258689438379762084509940910065429888115591857895102208670210236423951885026083776678207746486254685094255117289727025344896799281238087440750362883852369048109177009095095209503410248365326268559551102976, -4052702714444187711983971157556701247977767735025137431418050468909876559606778399938674636291877502444513675695686214048095828385356897868259830868612793756643347962065119940229900521425110262765647342590653849954190296153920631461297828693461051043800776216576514724821198412646982206087115276599871668224, -4172460688272902340672935803967929635936539170473063291259542888316384006302555740620580047930981649956996471286267958843404456820442716473501285634704308055031207757827593844480014053750259838573053080232005217513376398472723250109229176891955721239322262701420310667535259948853114968146054705376679822360576, -0, -0, -0, -0, -0, -0] -def edgeLookupCodes_4 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def edgeLookupCodes_5 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def edgeLookupCodes_6 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0] -def edgeLookupCodes : List ℕ := [edgeLookupCodes_0,edgeLookupCodes_1,edgeLookupCodes_2,edgeLookupCodes_3,edgeLookupCodes_4,edgeLookupCodes_5,edgeLookupCodes_6].flatten -def triangleLookupCodes_0 : List ℕ := [ -13294967190722672327635403631087981764154919981897080582554330842249092294775263194477922715455889686138890840707770007378246892529447488991165886118815198159099258842327506663501475934384289129658747857741106779387446195516772979632326571246780444414872038835124894742903521280, -109885262476218376871924296866160913150533682044021661152220457271242472100193684741113876104254617735388509981091103653519468909707703360923130924086172159123903261819743868502552963274301024981339404767223825637569903388432703533859248614854415898347962782985284942299136, -1322529930335160584440694777204285280003964984688105905584588626029735375535456493664810237828321950055558629210387188020243086679066214921045384693822042178256362130242211882077239496894959459279870241403630496971307896543677371929269978180130149681499373389742080, -478766918841696655167265841034159787385582703552910865082659397267834541485140960344502076529873083444648328857745501682276988759444909982734466107419132637536579956649449600549638863027134356608285549561866089221405552100843293014911871113278550088088525673424792584192, -652256851791998314897882745477135954528242135550073558989674691588359370031752069886978243534587085960744212701833906547547000602882154806381427471248106524032226418708778612403085585960654645696082060682140319744, -60926090171221782694573436686486640725556986254891875812103672266538549252485557335008576587493331543867088940163393370116535622229926004108428915985348394991776432128, -8672988336031482040082543481224112597442867659693666745736500213070071835083345982765352860651479745592258970278698761130301577785045725046401022790428495970263199193667469312, -1230590710896269474258835957075909978847128585749397693154962126836384224384640572166663121703375468993593685748163890291904061990801804614745201317991922355944081728571260168117944320, -174095510475444102371473844802169853679302081138638858740172053362069890966752624119638999372893013427680049982699069428744579747497247719942174420094228014088000117216589852507320367984934912, -24565056273876482518646047030038662949159521782899638389745043721333134161083623115006043711392500551716967694067670419086951638451191862266687993056357787854672883709733143662116610562900626077908992, -3457906178127349103174261892931755724689644437154339819932373766895833428486734890168406261718602360998534867973017070481591899292902777958299915141196226709732780567936635939684859489542615130471294717394944, -99712253930420037844647187615551837095479233674217389013632735591105016888844692209184459057832238531764518024802768480194881302749147726201990851085254876409382442566858625492647682133840854662213802562446526529554513275883162541061957588221082477738957692011394273896501870592, -68086976544455123851443014185553577785401142814741534120116820553099548250008495832730620235194995226968347537163627157498552687436328005747276194963420270626046493765648285667006159267799082053419789937034700527117868728320, -9527366886735991160621276470213248102767843487852853031638479498980179869805851907913320235428920378360219628614034828151935750973845208628745997301131623319102338934877950006326042045809535768830031920833314735967393212528691511296, -1330937145942708950183693561926647540961465204074316324556632208796468675352362749138974832452404810748417147224009707920420401221275869974002579658821710019423992253076520148304069931915473011130975210206200144050941416550876306002040324096, -185640935834764777475771402737796666356502209809535908930409940363510419887908639498777291445550917690080029091035405251832652533117130032952236978535189101868272787734350876483066032575867289297235047279311344573110485051026339870294183422053056512] -def triangleLookupCodes_1 : List ℕ := [ -25856577124987281773487090236950460581671140768115929294901153980832139515104858814456571208831234079499646374179355459269729056940802184007243390871574497581220807543210415688107376985323773030175281881352014733193148948462735813891959450221506104559403008, -3596612273344502738523859370257459947515999854844108528229773773797774899461920114940023180599113966813376012631421546118920632321354589683284461435455911147594737503708086130463916244185229096652574038653656642170922911558313217303630599128070321533026664542371840, -499667571229751385815622372821352862903107286556539187147651838106291010461932331151647270834244764025631726214560008018595410351122133764700775397567479038584663480559808996170338378562335083278463482287497494632498257009638086487115091266815097687419761709045341820551168, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_2 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_3 : List ℕ := [ -0, -146244639097949396834020997173330021645114182012520063764157859879918914024466441881050805191526630873038184114795382261805449365352119822640607117984405035947940105805268599953476529675781231208360391140712836091994722840861403544223423866373504191727948262861880286117678284800, -315928582331626005259959602382665871675571801919503796860566929819839216599719783283490465704520075680373549938940402017853896412314855314218864534508541092301295121326134303675808141352654794398834610805944177042645235292598545795096847829785883096577649416454905390931378176, -528232450351730156348427302687715045282448507475427064642085174257409176876082837898726719229617605096392996568951669064240462732602196308089946328944721417732096, -72788826064673282916768264623553037691024603616430369590263744560401442585200136551465823068612070956000000397321861266377411178165053373528406568814253659044995661824000, -436576803934513939977110233074892993126590609099186060963895975685659523655769082669011865700732005528421809757932499867725466647287703214811377298217857276570184487928117956170373868445737087877399409295041077337653248, -60079835142268852957813437752978788852723434365571455644490095119977806868054282274861503060579223979076991030878564672416859766461941197135758609373598507322579168866964387963921412032623010295796513690145040591747592736473088, -567821437046316870563543859090659428973659039695133475306703730218578355023598276682479080497418077182504939466494401023410106793658188652783421947992284163405279238841095423740481894515106435089819744914067559478352857339879345537710351141830656, -10475448441702404762485195524959540357780414890148241670825700001114041173006367340586843977564696624976651182480956703745498945402030176485947095723940045587147912087444918911429962962194121489881612729609351235546669443318541697435789255166054253332208572956672, -193149214102198189627022742329951323332084991270847312138820701748104857772905516878587839531140221302696495092113945828872349053588314976481210815355297737256315270814724889857642394696899887629897494648368868052804620310163474025712497898225441488451404651441897855924106690560, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_4 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -406812147111956773965496629218182891125446297448265522975296776117052904635984454150879428905762326052495867137694870270382435144913018920815377773178499761473939466470357238363608310050866101530453732690291693847940478691711332068019001781824524197860103784427956384263307264, -853723962315235085027361272454469852100399378208581354258391855449932476097338681773409601924146123811549864809666046458677354586702550008271500752047767046246598802035709544322137990790642293257031890782775279412619130545548585221014884825744110126882496793217159219118080, -371427511056364703867098802607987358529620400526307298530902692102600428261750118893621049644308414234511751681334339150812622440375324698387237383010239887152513024, -50820178012646875849284773987588028885087261154127786808513994039107574970772676442191782481242352963713413138164265935420310692626567257590072273629792684923782757473058816, -302754152721668082827219891305882858240929328557681817050531117158307156930715206366862147506695653386196452807032829242525757353453251717021916990287204046449192182541965405973108934490477532493666096605064897210498416640, -41394520592253895195861023462710043372985858217762569288468949202663738761144375789679239801436708670177207922773733658502717051385271054035186179767228452958944465846625253352522198539436559029030516559083867104852163517321576448, -1483164366550955711229120783856444771425846985895751728395639501240108626546139083658489813992297048529234042847700295224491406811675253462523633673171180173768556495674558660109392983423400446078580960737537714414224353807617127573599427756032, -27199733470759428933185504330830037608532505007429851313384029492733014151369476477893467149456540592814311211506187891069298888284013027337361772864756376394823930640546840037690604511648373828835286699166561214557138818358892367823095696113469062344188362752] -def triangleLookupCodes_5 : List ℕ := [ -498659321117078968692958932341839690959566066434799249222670625093113603318902821757340345501383170282534740131715376788511763390804822889352932743927082518402133824573396894967202354460849623415713785538992173579428940497641370131536518186333800798304381424663698487581343744, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -7746246734820226297275874885555707565232111191494709215958558642005709247329543290683206179408140982645670193450993858636552646777673401283688629002856099662223950621791464453316373479204380328190935472067886933609236823316323933112039587307490315228007603667730432] -def triangleLookupCodes_6 : List ℕ := [ -4224034642259042424595178311245771544774277075761758829459944438626882607541207446738246446371342773718655156906754717276234978066642610236050535371083096196798179729302502905916879574013544838936519766055742677795654864977234133639360316078536129731246822274577203200, -8639927619433971788738542594113786102639074143476470483792227425846370239779049591447729874742523122457738202139765327280775645983068683035476858403989487135034494387282659661316096, -1177069777745036436884759733010709194146676536802171801896137739101783940307310758997054717820038046390824371975696485802137984174393618789058140691504039695088578906573898303706345592848384, -160324163303243939983050770224308237156748049744714395960552825078980529375712923361817776189692430988221490758416107472897601083909132891258598518775038606575175092857019710345912199115545656688640, -21832485834358278738062713795146582102503891218227173389481870578265458752535495738361328027432884677731853885183730395059366922128922673772566018162534049239877330785005171231381523883884045975151636905984, -2972469922115601191607463126628792708098337332951607903165856674068496360817316015821294749234613498860547907057070959715766574793127303914279383578053061294054384676406739489659370491681943990513024870973066706944, -14236202776874425758082354664329032806066830555455828749992322425689380723395904453432572289356481041186484868560017658532291846109521819265946253240308870751220051016367188421419545102920349839436455386856581589328499682437779796525056, -260043484994121278592466653335262351842510479319182350799557225910242454220479787962492629984020893197990414762420175192628654307928972906797595558725065880187039751284756556764528045048077680333521857418494889952178908483823677785601177736832029294592, -4749142002217831161907904527253451025198254210517874238928498872244534372306182581539846094428089682953047290616216668328585365946542920632846730275856289088089637737317678141255860775468268146492070842219377245611763335890340241280293883101465966784009469078242590720, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_7 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -4997903584352302105764969420769519358900585512911165840305663695638966770781974709399407690036875067064262773548557034514427181841857612505533648359148989001419521998378449825170848182737471570212521588949862949357272728636115481568159394607106817315152451591978614784, -2691000267972294997071308692792713538701323089217349040084136091204092300625885845920762803601342877840602791214051433133385668792322587779061290543911746312077090401453875815902152825139784200011049140676592755176842026955058027617422258801302327656537843938751884034048, -20935034502289460181017175389187016753333657913322974977685953319927192721917283364764261451427856300099505300183710098240056941963860649416492976752444645305133263621754489667584, -2843911990288277334046063853459374206457890149729676553781023707476785810829950727216503223066387056453359303567921108874046340741044214325013348536308346152564251560779258567153009295360, -386274757602904137378237317898234820998968104164473780997552416534956601461253412793473258876924639526571458662883145250202605414574575168648938208764294024672553642859704619250375840792003477504, -52458476779477953278068766224579422532702541068744546612709677603901959860109914629612723717325777001694109457503335035451242519667473930267226270110668825955118806050305626859263739807957853986917187584, -7123207717752304870920156404508142987217125805983749903606467187279416522667805920424555629906668394004704048462648078393479134725026126483838917621853837916135043187947192401127834704356656990240367637711290368] -def triangleLookupCodes_8 : List ℕ := [ -8920048589965046012420127014222893081320427859240596580377424490352044686493875109981969809547706170337733474278671677824694235320343254219361244533091007717820207425106929882935649008146631602287562271335468945001129883741086897789730816, -162525779737345404835076598823604708434845869802068453104580227060615288230377731104284488208554766030561615214817823411422202184796391412775025522785878989346410561697782028680364097158893204555190602046715154279425905891718235787017161116829241625804800, -2960887061527319147433468816512698602917460605504937432307258304875693223643421444463979427437744686011741393716481268192568997009209814583958007338643670018871430398247841849296749288461641502449646192079431188134722707886365045668370033790660515838020530378998760341504, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_9 : List ℕ := [ -0, -0, -0, -3808338392721022419242476675205213153858446017243977876748082531468781577104570802879596130481970746739925616833879874931021614972289252761026008532075601527194254038830102782454680240606241419831066499058126290944, -1288906949475482757646141766432326064901640094213706450446266881242840845942010309722323307892032061424317246241618879981617875978874798175673649255826598670630912, -667132679308324233616017728958485034897140211430195462730928291973677865243823257569934745740630715479618897035568229735582745752704110965133850194882542985168289792, -345264640248423063202411967233852991777096035646962290090684385664522863291052665119764458414356999941113530365658927575335495170162854535333269489040316134898458951680, -178666162529783868822232502907372362591670416917332225670724344749323601703561125050225831428869669661011038949942743821338943751649896579337219931289994373832065807286272, -92445096577216066193833000238598140617455443754710916513289361427666686669876882206275717196589340340312038580566075762742330355802322757930908612705969605937213763231940608, -47827516384861589273949675002174275373043524632446839543381943471964000904975599814059934055217873824863449712005870944747070213509068015227474237742828591345873834564254695424, -24741449380960538960208309187679387007974329375990625193963383753196881016306808800515430863760386762489413463430098482672674449841841550537893512079462781159369841845122969370624, -12797547710910435436623045004413719052774591559766255893358188773759075107464248574070873851519601728844155225248353813317042662587924621967011949790513829657421967561393937758289920, -6618866349449766361917151080824623082222759157260959583952448033731249732904658453646257715606469342870390147696894568194906115510695101470014679754927470264958246962219476581796020224, -3422918794707655567505051197127384068825562847191857229058817748632500741523262278332532745848270131493157283874115575793401030541502871804374651503161272189602020624898691600049971920896, -1769972745470479747946762772926751293211173379003444813380598837245236029337261787339868949148686315231577503809239619927557186530063284047924114929561435957015254428232197729392835321397248, -915154466841927600809440938457232354910033193085265267447338489441603419655482003544822339800605861446993140876765217305033239256513074038788305044226201883112588439816327864094763529879420928] -def triangleLookupCodes_10 : List ℕ := [ -473130438657520420183111340634095640420324155453832596707230911597386748052626417649475470150187176701654323099238271594064485892932478282260205181192677660791483705537418491259082432104166850560, -244583316629490641280915927438381217344876193816580800758489352499544343163722777335808973989101645999333456931621248987111400082703494480210328668027668458203812930503105083444042719697955935223808, -126425010517161383643176370417717998998807767060889247745472756869748055718144424363564291717789418254038989023453441494047633094771486760910557329041759208490181736330778572474078839889192162795978752, -65343161815052062182668178425336225135123928518496832257330670212981456761068946806371527041617302403286655026133403395427445425765777586152154306587316309186565761148911279219101597334031814019772317696, -33769839741602557921295388260762027408823439514531005270517395921229777405157349549362246002547928402178738008196426109902081385988379622767668869481088974656593138327789531817715112266136187232257799356416, -17450998084556011522593110613888976664813274945326915801744122211027481061707467946937482321811352562623850825222425436848799085560156734169822583802609663492948278757036282201728105828991019871432792090869760, -9017261169362694855415287008393111191710181815917545935351468907717281839090878937395965281442900881066080148607119721178999040765062707959090537692621707244401085793405093945746469978992799682534190546562318336, -4659000995549548447366605507827233961490415032231788021867492988614908607788817554411489082428615296035199321446583100770003430258342486027894739188893320591571278265962297038954572684053604961738133269810851610624, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_11 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -494129613921859298652362729739290214939819313541121727778668889749643772184587036321595417461360951485286013169141965833786663200918840831091533133524806472001544201255527841857045895862699255552992945931236478307626126957511606769436983328366294788666002354744161116437524512768, -1243434857063054261657157665262706628797403999029375016056278169509489336683696653950254789188207348519778881939979293903477872533596601092296017698995656079821274597409442998889829575864402053771922948686542498904932352, -642297706038226420936960399755329911498564771552961333494887021189376360440549932253982457226356510053244250854053069143598550625061598878615453334285751707214582431353832602032583993831592433209827235373652892697441075200] -def triangleLookupCodes_12 : List ℕ := [ -331753863813206558671593510346830862875063652148675921289707325230025820415512154974942444742835639124153197647276410782011612422615929854963376950623092480799064201643023558980390525348152839622876119562135565289245074522112, -171341466693038689189613207561693599264185416326264647592976637752878563474156925253553086149517693491735213494926156883200392665702564395046728598575042604802182245597637030768690199477519540962468195641835954952908963093413888, -88486377018222397613757715366814615929005180289232498424639039993847760330532673105887047982440212352974842774756757220357549962765195624628330597596703672030844733416471551661783270388113831955468194850743552244594917392131293184, -45693912621879801017565935852565559825790682838741758608217109226609508435096064246760916918439611206748803194936996923656447426913627278844280910194168591566321744428519907107838545225593681376334168848827952923289828188382553964544, -23594393707740024041926615775908882583516525245130996747785743347900909353451212730013524618173354848652537287269649485050792587720434891713974555862438350363059704498076866439600156678386217365231934430246506033841694040060869539266560, -12182274126375726060984049866395749650548849088935021101140135307150208198724219169630955404342081924838239917430556951137015855544879419729754770281196739504211290034560788705273332839049456571279756497865267287531005976406974181727535104, -6289519961286942624000856297229389526188665473209841596115952650329677213942485719805432936539855957589186940814875323355149263962570841549800738795942422334738437819446385558257349354887766963999110434531493624696353077403024977587502841856, -3246958371773190914446274080186447478423715948997095622885455883980005289030743667077026153500961776466531862479516409716810961861715671141359122026451002390180195912293195417300353175645292627713528597583856843866537520581467737154819947757568, -1676125451964143209166904184930021129952683609963905202462486533627502512395742538554199369468680858955468805766050126784402176294192676561520776084162296087026847570447278811531747062573080867768070478176045543366933639952684383121837281528250368, -865181807401171287110305812891945549287641422869144292355901263184508066205565091617260210352573075640357528546604980118424135738975707903316829025680219622544094634905826083535725209198475217995168928967248067929190435516240529828048255899968471040, -446559940299111040577104221747056783380228524767625789978116823629688241185029121789322415891036954365703694612988055205495990894246279888453130596489903948047586976636234452770404312248080912226859915831480738639109553856873807614830501712626049875968, -230475159146917059662710716054239972108894536205439847562246246660561076466078165335351093289756924929814699320378552622263718036550142633168918902697746150068529920102751206794504866501909766574178990096245998847218485621469421546342551759087740200681472, -118943553976672904473571364133881278017081378677685908815716699966833548004055767201059384137371099762887222783440497141408506232446049261286315489276242677113187997781888191370528115267994678317161320082828216069740994390128360240072645960351202746812071936, -61380519152703628492715438923771745440977282466911547227936420681451430327029511040214532357317966828395171591601753774191610281051353853127753984190074534600339802353237895609482106310149916747951614585025782133609535560736960843989967575065335045568117866496, -31673312598707573706220717778430093587050956314034129480819656181700651046903024268025169938586588456034347580457970182134817469998249208052180192189804963081588403119180307065473954612780317797128516243273481031429981180788839037472123094236597393801448909701120, -16342937288310215487575618983879195396260630530564887951839162866943062920379872708331775646835905482716348060680111325124367603762281084571110576370837383397275047645953439528393252246919105648284572579335045944551362639093941310884547988500348541067274993539219456] -def triangleLookupCodes_13 : List ℕ := [ -8432198925354062457633909998183517632486999771312282424063314825653960962429643259614548113979124570082872402004859861501802835397354790205186505902333248356749738442181919661703085942832480555232944559162403635717414355775486481706684903808798318852202570399470321664, -4350368747055766827842100775229894257709341036019375214993908870877733739327893346592372273550471952903666993634049394964443882326231892536301771111832451284016462074693467281852839288444098057494624234345095038886159892651456006267126393602774110555115696182712464310272, -2244327241897089882816327491271591673643693152832953256380109082122567406536606384262193107324739648473550498530104596910061933019657283833624602215255183057601053730298773348819813669968878628203510197452308181137921861194681822157020219625187062711246682276298815451430912, -1157768030874433100686079685440244473518184291954681038173868453046136390931113664035374904622918480414936830115622862642344242323601325408595301182081101341586267585717499622057458495618242074096523666903002983611458486964130902581899123571585935778956353590809010778113310720, -597217543115548764861542244018910213186968417105351684649533980695305354094328247976195552407331973535444892151722071893369228769862718205119900687335193066332567378699277972233816264812758164763059257707737179381914102270251372656334794083878960870274255798350350359088125181952, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_14 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_15 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_16 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_17 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_18 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_19 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_20 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_21 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_22 : List ℕ := [ -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0] -def triangleLookupCodes_23 : List ℕ := [ -0, -0, -0, -0] -def triangleLookupCodes : List ℕ := [triangleLookupCodes_0,triangleLookupCodes_1,triangleLookupCodes_2,triangleLookupCodes_3,triangleLookupCodes_4,triangleLookupCodes_5,triangleLookupCodes_6,triangleLookupCodes_7,triangleLookupCodes_8,triangleLookupCodes_9,triangleLookupCodes_10,triangleLookupCodes_11,triangleLookupCodes_12,triangleLookupCodes_13,triangleLookupCodes_14,triangleLookupCodes_15,triangleLookupCodes_16,triangleLookupCodes_17,triangleLookupCodes_18,triangleLookupCodes_19,triangleLookupCodes_20,triangleLookupCodes_21,triangleLookupCodes_22,triangleLookupCodes_23].flatten -def edgeIndex (a b : Fin 103) : Fin 372 := - ⟨((edgeLookupCodes.getD a.val 0 >>> (10*b.val)) % 1024) % 372, - Nat.mod_lt _ (by decide)⟩ -def triangleIndex (e : Fin 372) (c : Fin 103) : Fin 270 := - ⟨((triangleLookupCodes.getD e.val 0 >>> (9*c.val)) % 512) % 270, - Nat.mod_lt _ (by decide)⟩ -theorem edge_complete_0 : ∀ b : Fin 103, - 0 < b → SeedEncoding.indexedAdj 0 b → - edge (edgeIndex 0 b) = (0,b) := by decide +kernel -theorem edge_complete_1 : ∀ b : Fin 103, - 1 < b → SeedEncoding.indexedAdj 1 b → - edge (edgeIndex 1 b) = (1,b) := by decide +kernel -theorem edge_complete_2 : ∀ b : Fin 103, - 2 < b → SeedEncoding.indexedAdj 2 b → - edge (edgeIndex 2 b) = (2,b) := by decide +kernel -theorem edge_complete_3 : ∀ b : Fin 103, - 3 < b → SeedEncoding.indexedAdj 3 b → - edge (edgeIndex 3 b) = (3,b) := by decide +kernel -theorem edge_complete_4 : ∀ b : Fin 103, - 4 < b → SeedEncoding.indexedAdj 4 b → - edge (edgeIndex 4 b) = (4,b) := by decide +kernel -theorem edge_complete_5 : ∀ b : Fin 103, - 5 < b → SeedEncoding.indexedAdj 5 b → - edge (edgeIndex 5 b) = (5,b) := by decide +kernel -theorem edge_complete_6 : ∀ b : Fin 103, - 6 < b → SeedEncoding.indexedAdj 6 b → - edge (edgeIndex 6 b) = (6,b) := by decide +kernel -theorem edge_complete_7 : ∀ b : Fin 103, - 7 < b → SeedEncoding.indexedAdj 7 b → - edge (edgeIndex 7 b) = (7,b) := by decide +kernel -theorem edge_complete_8 : ∀ b : Fin 103, - 8 < b → SeedEncoding.indexedAdj 8 b → - edge (edgeIndex 8 b) = (8,b) := by decide +kernel -theorem edge_complete_9 : ∀ b : Fin 103, - 9 < b → SeedEncoding.indexedAdj 9 b → - edge (edgeIndex 9 b) = (9,b) := by decide +kernel -theorem edge_complete_10 : ∀ b : Fin 103, - 10 < b → SeedEncoding.indexedAdj 10 b → - edge (edgeIndex 10 b) = (10,b) := by decide +kernel -theorem edge_complete_11 : ∀ b : Fin 103, - 11 < b → SeedEncoding.indexedAdj 11 b → - edge (edgeIndex 11 b) = (11,b) := by decide +kernel -theorem edge_complete_12 : ∀ b : Fin 103, - 12 < b → SeedEncoding.indexedAdj 12 b → - edge (edgeIndex 12 b) = (12,b) := by decide +kernel -theorem edge_complete_13 : ∀ b : Fin 103, - 13 < b → SeedEncoding.indexedAdj 13 b → - edge (edgeIndex 13 b) = (13,b) := by decide +kernel -theorem edge_complete_14 : ∀ b : Fin 103, - 14 < b → SeedEncoding.indexedAdj 14 b → - edge (edgeIndex 14 b) = (14,b) := by decide +kernel -theorem edge_complete_15 : ∀ b : Fin 103, - 15 < b → SeedEncoding.indexedAdj 15 b → - edge (edgeIndex 15 b) = (15,b) := by decide +kernel -theorem edge_complete_16 : ∀ b : Fin 103, - 16 < b → SeedEncoding.indexedAdj 16 b → - edge (edgeIndex 16 b) = (16,b) := by decide +kernel -theorem edge_complete_17 : ∀ b : Fin 103, - 17 < b → SeedEncoding.indexedAdj 17 b → - edge (edgeIndex 17 b) = (17,b) := by decide +kernel -theorem edge_complete_18 : ∀ b : Fin 103, - 18 < b → SeedEncoding.indexedAdj 18 b → - edge (edgeIndex 18 b) = (18,b) := by decide +kernel -theorem edge_complete_19 : ∀ b : Fin 103, - 19 < b → SeedEncoding.indexedAdj 19 b → - edge (edgeIndex 19 b) = (19,b) := by decide +kernel -theorem edge_complete_20 : ∀ b : Fin 103, - 20 < b → SeedEncoding.indexedAdj 20 b → - edge (edgeIndex 20 b) = (20,b) := by decide +kernel -theorem edge_complete_21 : ∀ b : Fin 103, - 21 < b → SeedEncoding.indexedAdj 21 b → - edge (edgeIndex 21 b) = (21,b) := by decide +kernel -theorem edge_complete_22 : ∀ b : Fin 103, - 22 < b → SeedEncoding.indexedAdj 22 b → - edge (edgeIndex 22 b) = (22,b) := by decide +kernel -theorem edge_complete_23 : ∀ b : Fin 103, - 23 < b → SeedEncoding.indexedAdj 23 b → - edge (edgeIndex 23 b) = (23,b) := by decide +kernel -theorem edge_complete_24 : ∀ b : Fin 103, - 24 < b → SeedEncoding.indexedAdj 24 b → - edge (edgeIndex 24 b) = (24,b) := by decide +kernel -theorem edge_complete_25 : ∀ b : Fin 103, - 25 < b → SeedEncoding.indexedAdj 25 b → - edge (edgeIndex 25 b) = (25,b) := by decide +kernel -theorem edge_complete_26 : ∀ b : Fin 103, - 26 < b → SeedEncoding.indexedAdj 26 b → - edge (edgeIndex 26 b) = (26,b) := by decide +kernel -theorem edge_complete_27 : ∀ b : Fin 103, - 27 < b → SeedEncoding.indexedAdj 27 b → - edge (edgeIndex 27 b) = (27,b) := by decide +kernel -theorem edge_complete_28 : ∀ b : Fin 103, - 28 < b → SeedEncoding.indexedAdj 28 b → - edge (edgeIndex 28 b) = (28,b) := by decide +kernel -theorem edge_complete_29 : ∀ b : Fin 103, - 29 < b → SeedEncoding.indexedAdj 29 b → - edge (edgeIndex 29 b) = (29,b) := by decide +kernel -theorem edge_complete_30 : ∀ b : Fin 103, - 30 < b → SeedEncoding.indexedAdj 30 b → - edge (edgeIndex 30 b) = (30,b) := by decide +kernel -theorem edge_complete_31 : ∀ b : Fin 103, - 31 < b → SeedEncoding.indexedAdj 31 b → - edge (edgeIndex 31 b) = (31,b) := by decide +kernel -theorem edge_complete_32 : ∀ b : Fin 103, - 32 < b → SeedEncoding.indexedAdj 32 b → - edge (edgeIndex 32 b) = (32,b) := by decide +kernel -theorem edge_complete_33 : ∀ b : Fin 103, - 33 < b → SeedEncoding.indexedAdj 33 b → - edge (edgeIndex 33 b) = (33,b) := by decide +kernel -theorem edge_complete_34 : ∀ b : Fin 103, - 34 < b → SeedEncoding.indexedAdj 34 b → - edge (edgeIndex 34 b) = (34,b) := by decide +kernel -theorem edge_complete_35 : ∀ b : Fin 103, - 35 < b → SeedEncoding.indexedAdj 35 b → - edge (edgeIndex 35 b) = (35,b) := by decide +kernel -theorem edge_complete_36 : ∀ b : Fin 103, - 36 < b → SeedEncoding.indexedAdj 36 b → - edge (edgeIndex 36 b) = (36,b) := by decide +kernel -theorem edge_complete_37 : ∀ b : Fin 103, - 37 < b → SeedEncoding.indexedAdj 37 b → - edge (edgeIndex 37 b) = (37,b) := by decide +kernel -theorem edge_complete_38 : ∀ b : Fin 103, - 38 < b → SeedEncoding.indexedAdj 38 b → - edge (edgeIndex 38 b) = (38,b) := by decide +kernel -theorem edge_complete_39 : ∀ b : Fin 103, - 39 < b → SeedEncoding.indexedAdj 39 b → - edge (edgeIndex 39 b) = (39,b) := by decide +kernel -theorem edge_complete_40 : ∀ b : Fin 103, - 40 < b → SeedEncoding.indexedAdj 40 b → - edge (edgeIndex 40 b) = (40,b) := by decide +kernel -theorem edge_complete_41 : ∀ b : Fin 103, - 41 < b → SeedEncoding.indexedAdj 41 b → - edge (edgeIndex 41 b) = (41,b) := by decide +kernel -theorem edge_complete_42 : ∀ b : Fin 103, - 42 < b → SeedEncoding.indexedAdj 42 b → - edge (edgeIndex 42 b) = (42,b) := by decide +kernel -theorem edge_complete_43 : ∀ b : Fin 103, - 43 < b → SeedEncoding.indexedAdj 43 b → - edge (edgeIndex 43 b) = (43,b) := by decide +kernel -theorem edge_complete_44 : ∀ b : Fin 103, - 44 < b → SeedEncoding.indexedAdj 44 b → - edge (edgeIndex 44 b) = (44,b) := by decide +kernel -theorem edge_complete_45 : ∀ b : Fin 103, - 45 < b → SeedEncoding.indexedAdj 45 b → - edge (edgeIndex 45 b) = (45,b) := by decide +kernel -theorem edge_complete_46 : ∀ b : Fin 103, - 46 < b → SeedEncoding.indexedAdj 46 b → - edge (edgeIndex 46 b) = (46,b) := by decide +kernel -theorem edge_complete_47 : ∀ b : Fin 103, - 47 < b → SeedEncoding.indexedAdj 47 b → - edge (edgeIndex 47 b) = (47,b) := by decide +kernel -theorem edge_complete_48 : ∀ b : Fin 103, - 48 < b → SeedEncoding.indexedAdj 48 b → - edge (edgeIndex 48 b) = (48,b) := by decide +kernel -theorem edge_complete_49 : ∀ b : Fin 103, - 49 < b → SeedEncoding.indexedAdj 49 b → - edge (edgeIndex 49 b) = (49,b) := by decide +kernel -theorem edge_complete_50 : ∀ b : Fin 103, - 50 < b → SeedEncoding.indexedAdj 50 b → - edge (edgeIndex 50 b) = (50,b) := by decide +kernel -theorem edge_complete_51 : ∀ b : Fin 103, - 51 < b → SeedEncoding.indexedAdj 51 b → - edge (edgeIndex 51 b) = (51,b) := by decide +kernel -theorem edge_complete_52 : ∀ b : Fin 103, - 52 < b → SeedEncoding.indexedAdj 52 b → - edge (edgeIndex 52 b) = (52,b) := by decide +kernel -theorem edge_complete_53 : ∀ b : Fin 103, - 53 < b → SeedEncoding.indexedAdj 53 b → - edge (edgeIndex 53 b) = (53,b) := by decide +kernel -theorem edge_complete_54 : ∀ b : Fin 103, - 54 < b → SeedEncoding.indexedAdj 54 b → - edge (edgeIndex 54 b) = (54,b) := by decide +kernel -theorem edge_complete_55 : ∀ b : Fin 103, - 55 < b → SeedEncoding.indexedAdj 55 b → - edge (edgeIndex 55 b) = (55,b) := by decide +kernel -theorem edge_complete_56 : ∀ b : Fin 103, - 56 < b → SeedEncoding.indexedAdj 56 b → - edge (edgeIndex 56 b) = (56,b) := by decide +kernel -theorem edge_complete_57 : ∀ b : Fin 103, - 57 < b → SeedEncoding.indexedAdj 57 b → - edge (edgeIndex 57 b) = (57,b) := by decide +kernel -theorem edge_complete_58 : ∀ b : Fin 103, - 58 < b → SeedEncoding.indexedAdj 58 b → - edge (edgeIndex 58 b) = (58,b) := by decide +kernel -theorem edge_complete_59 : ∀ b : Fin 103, - 59 < b → SeedEncoding.indexedAdj 59 b → - edge (edgeIndex 59 b) = (59,b) := by decide +kernel -theorem edge_complete_60 : ∀ b : Fin 103, - 60 < b → SeedEncoding.indexedAdj 60 b → - edge (edgeIndex 60 b) = (60,b) := by decide +kernel -theorem edge_complete_61 : ∀ b : Fin 103, - 61 < b → SeedEncoding.indexedAdj 61 b → - edge (edgeIndex 61 b) = (61,b) := by decide +kernel -theorem edge_complete_62 : ∀ b : Fin 103, - 62 < b → SeedEncoding.indexedAdj 62 b → - edge (edgeIndex 62 b) = (62,b) := by decide +kernel -theorem edge_complete_63 : ∀ b : Fin 103, - 63 < b → SeedEncoding.indexedAdj 63 b → - edge (edgeIndex 63 b) = (63,b) := by decide +kernel -theorem edge_complete_64 : ∀ b : Fin 103, - 64 < b → SeedEncoding.indexedAdj 64 b → - edge (edgeIndex 64 b) = (64,b) := by decide +kernel -theorem edge_complete_65 : ∀ b : Fin 103, - 65 < b → SeedEncoding.indexedAdj 65 b → - edge (edgeIndex 65 b) = (65,b) := by decide +kernel -theorem edge_complete_66 : ∀ b : Fin 103, - 66 < b → SeedEncoding.indexedAdj 66 b → - edge (edgeIndex 66 b) = (66,b) := by decide +kernel -theorem edge_complete_67 : ∀ b : Fin 103, - 67 < b → SeedEncoding.indexedAdj 67 b → - edge (edgeIndex 67 b) = (67,b) := by decide +kernel -theorem edge_complete_68 : ∀ b : Fin 103, - 68 < b → SeedEncoding.indexedAdj 68 b → - edge (edgeIndex 68 b) = (68,b) := by decide +kernel -theorem edge_complete_69 : ∀ b : Fin 103, - 69 < b → SeedEncoding.indexedAdj 69 b → - edge (edgeIndex 69 b) = (69,b) := by decide +kernel -theorem edge_complete_70 : ∀ b : Fin 103, - 70 < b → SeedEncoding.indexedAdj 70 b → - edge (edgeIndex 70 b) = (70,b) := by decide +kernel -theorem edge_complete_71 : ∀ b : Fin 103, - 71 < b → SeedEncoding.indexedAdj 71 b → - edge (edgeIndex 71 b) = (71,b) := by decide +kernel -theorem edge_complete_72 : ∀ b : Fin 103, - 72 < b → SeedEncoding.indexedAdj 72 b → - edge (edgeIndex 72 b) = (72,b) := by decide +kernel -theorem edge_complete_73 : ∀ b : Fin 103, - 73 < b → SeedEncoding.indexedAdj 73 b → - edge (edgeIndex 73 b) = (73,b) := by decide +kernel -theorem edge_complete_74 : ∀ b : Fin 103, - 74 < b → SeedEncoding.indexedAdj 74 b → - edge (edgeIndex 74 b) = (74,b) := by decide +kernel -theorem edge_complete_75 : ∀ b : Fin 103, - 75 < b → SeedEncoding.indexedAdj 75 b → - edge (edgeIndex 75 b) = (75,b) := by decide +kernel -theorem edge_complete_76 : ∀ b : Fin 103, - 76 < b → SeedEncoding.indexedAdj 76 b → - edge (edgeIndex 76 b) = (76,b) := by decide +kernel -theorem edge_complete_77 : ∀ b : Fin 103, - 77 < b → SeedEncoding.indexedAdj 77 b → - edge (edgeIndex 77 b) = (77,b) := by decide +kernel -theorem edge_complete_78 : ∀ b : Fin 103, - 78 < b → SeedEncoding.indexedAdj 78 b → - edge (edgeIndex 78 b) = (78,b) := by decide +kernel -theorem edge_complete_79 : ∀ b : Fin 103, - 79 < b → SeedEncoding.indexedAdj 79 b → - edge (edgeIndex 79 b) = (79,b) := by decide +kernel -theorem edge_complete_80 : ∀ b : Fin 103, - 80 < b → SeedEncoding.indexedAdj 80 b → - edge (edgeIndex 80 b) = (80,b) := by decide +kernel -theorem edge_complete_81 : ∀ b : Fin 103, - 81 < b → SeedEncoding.indexedAdj 81 b → - edge (edgeIndex 81 b) = (81,b) := by decide +kernel -theorem edge_complete_82 : ∀ b : Fin 103, - 82 < b → SeedEncoding.indexedAdj 82 b → - edge (edgeIndex 82 b) = (82,b) := by decide +kernel -theorem edge_complete_83 : ∀ b : Fin 103, - 83 < b → SeedEncoding.indexedAdj 83 b → - edge (edgeIndex 83 b) = (83,b) := by decide +kernel -theorem edge_complete_84 : ∀ b : Fin 103, - 84 < b → SeedEncoding.indexedAdj 84 b → - edge (edgeIndex 84 b) = (84,b) := by decide +kernel -theorem edge_complete_85 : ∀ b : Fin 103, - 85 < b → SeedEncoding.indexedAdj 85 b → - edge (edgeIndex 85 b) = (85,b) := by decide +kernel -theorem edge_complete_86 : ∀ b : Fin 103, - 86 < b → SeedEncoding.indexedAdj 86 b → - edge (edgeIndex 86 b) = (86,b) := by decide +kernel -theorem edge_complete_87 : ∀ b : Fin 103, - 87 < b → SeedEncoding.indexedAdj 87 b → - edge (edgeIndex 87 b) = (87,b) := by decide +kernel -theorem edge_complete_88 : ∀ b : Fin 103, - 88 < b → SeedEncoding.indexedAdj 88 b → - edge (edgeIndex 88 b) = (88,b) := by decide +kernel -theorem edge_complete_89 : ∀ b : Fin 103, - 89 < b → SeedEncoding.indexedAdj 89 b → - edge (edgeIndex 89 b) = (89,b) := by decide +kernel -theorem edge_complete_90 : ∀ b : Fin 103, - 90 < b → SeedEncoding.indexedAdj 90 b → - edge (edgeIndex 90 b) = (90,b) := by decide +kernel -theorem edge_complete_91 : ∀ b : Fin 103, - 91 < b → SeedEncoding.indexedAdj 91 b → - edge (edgeIndex 91 b) = (91,b) := by decide +kernel -theorem edge_complete_92 : ∀ b : Fin 103, - 92 < b → SeedEncoding.indexedAdj 92 b → - edge (edgeIndex 92 b) = (92,b) := by decide +kernel -theorem edge_complete_93 : ∀ b : Fin 103, - 93 < b → SeedEncoding.indexedAdj 93 b → - edge (edgeIndex 93 b) = (93,b) := by decide +kernel -theorem edge_complete_94 : ∀ b : Fin 103, - 94 < b → SeedEncoding.indexedAdj 94 b → - edge (edgeIndex 94 b) = (94,b) := by decide +kernel -theorem edge_complete_95 : ∀ b : Fin 103, - 95 < b → SeedEncoding.indexedAdj 95 b → - edge (edgeIndex 95 b) = (95,b) := by decide +kernel -theorem edge_complete_96 : ∀ b : Fin 103, - 96 < b → SeedEncoding.indexedAdj 96 b → - edge (edgeIndex 96 b) = (96,b) := by decide +kernel -theorem edge_complete_97 : ∀ b : Fin 103, - 97 < b → SeedEncoding.indexedAdj 97 b → - edge (edgeIndex 97 b) = (97,b) := by decide +kernel -theorem edge_complete_98 : ∀ b : Fin 103, - 98 < b → SeedEncoding.indexedAdj 98 b → - edge (edgeIndex 98 b) = (98,b) := by decide +kernel -theorem edge_complete_99 : ∀ b : Fin 103, - 99 < b → SeedEncoding.indexedAdj 99 b → - edge (edgeIndex 99 b) = (99,b) := by decide +kernel -theorem edge_complete_100 : ∀ b : Fin 103, - 100 < b → SeedEncoding.indexedAdj 100 b → - edge (edgeIndex 100 b) = (100,b) := by decide +kernel -theorem edge_complete_101 : ∀ b : Fin 103, - 101 < b → SeedEncoding.indexedAdj 101 b → - edge (edgeIndex 101 b) = (101,b) := by decide +kernel -theorem edge_complete_102 : ∀ b : Fin 103, - 102 < b → SeedEncoding.indexedAdj 102 b → - edge (edgeIndex 102 b) = (102,b) := by decide +kernel -theorem triangle_complete_0 : ∀ c : Fin 103, - (edge 0).2 < c → SeedEncoding.indexedAdj (edge 0).1 c → - SeedEncoding.indexedAdj (edge 0).2 c → - triangle (triangleIndex 0 c) = ((edge 0).1,(edge 0).2,c) := by decide +kernel -theorem triangle_complete_1 : ∀ c : Fin 103, - (edge 1).2 < c → SeedEncoding.indexedAdj (edge 1).1 c → - SeedEncoding.indexedAdj (edge 1).2 c → - triangle (triangleIndex 1 c) = ((edge 1).1,(edge 1).2,c) := by decide +kernel -theorem triangle_complete_2 : ∀ c : Fin 103, - (edge 2).2 < c → SeedEncoding.indexedAdj (edge 2).1 c → - SeedEncoding.indexedAdj (edge 2).2 c → - triangle (triangleIndex 2 c) = ((edge 2).1,(edge 2).2,c) := by decide +kernel -theorem triangle_complete_3 : ∀ c : Fin 103, - (edge 3).2 < c → SeedEncoding.indexedAdj (edge 3).1 c → - SeedEncoding.indexedAdj (edge 3).2 c → - triangle (triangleIndex 3 c) = ((edge 3).1,(edge 3).2,c) := by decide +kernel -theorem triangle_complete_4 : ∀ c : Fin 103, - (edge 4).2 < c → SeedEncoding.indexedAdj (edge 4).1 c → - SeedEncoding.indexedAdj (edge 4).2 c → - triangle (triangleIndex 4 c) = ((edge 4).1,(edge 4).2,c) := by decide +kernel -theorem triangle_complete_5 : ∀ c : Fin 103, - (edge 5).2 < c → SeedEncoding.indexedAdj (edge 5).1 c → - SeedEncoding.indexedAdj (edge 5).2 c → - triangle (triangleIndex 5 c) = ((edge 5).1,(edge 5).2,c) := by decide +kernel -theorem triangle_complete_6 : ∀ c : Fin 103, - (edge 6).2 < c → SeedEncoding.indexedAdj (edge 6).1 c → - SeedEncoding.indexedAdj (edge 6).2 c → - triangle (triangleIndex 6 c) = ((edge 6).1,(edge 6).2,c) := by decide +kernel -theorem triangle_complete_7 : ∀ c : Fin 103, - (edge 7).2 < c → SeedEncoding.indexedAdj (edge 7).1 c → - SeedEncoding.indexedAdj (edge 7).2 c → - triangle (triangleIndex 7 c) = ((edge 7).1,(edge 7).2,c) := by decide +kernel -theorem triangle_complete_8 : ∀ c : Fin 103, - (edge 8).2 < c → SeedEncoding.indexedAdj (edge 8).1 c → - SeedEncoding.indexedAdj (edge 8).2 c → - triangle (triangleIndex 8 c) = ((edge 8).1,(edge 8).2,c) := by decide +kernel -theorem triangle_complete_9 : ∀ c : Fin 103, - (edge 9).2 < c → SeedEncoding.indexedAdj (edge 9).1 c → - SeedEncoding.indexedAdj (edge 9).2 c → - triangle (triangleIndex 9 c) = ((edge 9).1,(edge 9).2,c) := by decide +kernel -theorem triangle_complete_10 : ∀ c : Fin 103, - (edge 10).2 < c → SeedEncoding.indexedAdj (edge 10).1 c → - SeedEncoding.indexedAdj (edge 10).2 c → - triangle (triangleIndex 10 c) = ((edge 10).1,(edge 10).2,c) := by decide +kernel -theorem triangle_complete_11 : ∀ c : Fin 103, - (edge 11).2 < c → SeedEncoding.indexedAdj (edge 11).1 c → - SeedEncoding.indexedAdj (edge 11).2 c → - triangle (triangleIndex 11 c) = ((edge 11).1,(edge 11).2,c) := by decide +kernel -theorem triangle_complete_12 : ∀ c : Fin 103, - (edge 12).2 < c → SeedEncoding.indexedAdj (edge 12).1 c → - SeedEncoding.indexedAdj (edge 12).2 c → - triangle (triangleIndex 12 c) = ((edge 12).1,(edge 12).2,c) := by decide +kernel -theorem triangle_complete_13 : ∀ c : Fin 103, - (edge 13).2 < c → SeedEncoding.indexedAdj (edge 13).1 c → - SeedEncoding.indexedAdj (edge 13).2 c → - triangle (triangleIndex 13 c) = ((edge 13).1,(edge 13).2,c) := by decide +kernel -theorem triangle_complete_14 : ∀ c : Fin 103, - (edge 14).2 < c → SeedEncoding.indexedAdj (edge 14).1 c → - SeedEncoding.indexedAdj (edge 14).2 c → - triangle (triangleIndex 14 c) = ((edge 14).1,(edge 14).2,c) := by decide +kernel -theorem triangle_complete_15 : ∀ c : Fin 103, - (edge 15).2 < c → SeedEncoding.indexedAdj (edge 15).1 c → - SeedEncoding.indexedAdj (edge 15).2 c → - triangle (triangleIndex 15 c) = ((edge 15).1,(edge 15).2,c) := by decide +kernel -theorem triangle_complete_16 : ∀ c : Fin 103, - (edge 16).2 < c → SeedEncoding.indexedAdj (edge 16).1 c → - SeedEncoding.indexedAdj (edge 16).2 c → - triangle (triangleIndex 16 c) = ((edge 16).1,(edge 16).2,c) := by decide +kernel -theorem triangle_complete_17 : ∀ c : Fin 103, - (edge 17).2 < c → SeedEncoding.indexedAdj (edge 17).1 c → - SeedEncoding.indexedAdj (edge 17).2 c → - triangle (triangleIndex 17 c) = ((edge 17).1,(edge 17).2,c) := by decide +kernel -theorem triangle_complete_18 : ∀ c : Fin 103, - (edge 18).2 < c → SeedEncoding.indexedAdj (edge 18).1 c → - SeedEncoding.indexedAdj (edge 18).2 c → - triangle (triangleIndex 18 c) = ((edge 18).1,(edge 18).2,c) := by decide +kernel -theorem triangle_complete_19 : ∀ c : Fin 103, - (edge 19).2 < c → SeedEncoding.indexedAdj (edge 19).1 c → - SeedEncoding.indexedAdj (edge 19).2 c → - triangle (triangleIndex 19 c) = ((edge 19).1,(edge 19).2,c) := by decide +kernel -theorem triangle_complete_20 : ∀ c : Fin 103, - (edge 20).2 < c → SeedEncoding.indexedAdj (edge 20).1 c → - SeedEncoding.indexedAdj (edge 20).2 c → - triangle (triangleIndex 20 c) = ((edge 20).1,(edge 20).2,c) := by decide +kernel -theorem triangle_complete_21 : ∀ c : Fin 103, - (edge 21).2 < c → SeedEncoding.indexedAdj (edge 21).1 c → - SeedEncoding.indexedAdj (edge 21).2 c → - triangle (triangleIndex 21 c) = ((edge 21).1,(edge 21).2,c) := by decide +kernel -theorem triangle_complete_22 : ∀ c : Fin 103, - (edge 22).2 < c → SeedEncoding.indexedAdj (edge 22).1 c → - SeedEncoding.indexedAdj (edge 22).2 c → - triangle (triangleIndex 22 c) = ((edge 22).1,(edge 22).2,c) := by decide +kernel -theorem triangle_complete_23 : ∀ c : Fin 103, - (edge 23).2 < c → SeedEncoding.indexedAdj (edge 23).1 c → - SeedEncoding.indexedAdj (edge 23).2 c → - triangle (triangleIndex 23 c) = ((edge 23).1,(edge 23).2,c) := by decide +kernel -theorem triangle_complete_24 : ∀ c : Fin 103, - (edge 24).2 < c → SeedEncoding.indexedAdj (edge 24).1 c → - SeedEncoding.indexedAdj (edge 24).2 c → - triangle (triangleIndex 24 c) = ((edge 24).1,(edge 24).2,c) := by decide +kernel -theorem triangle_complete_25 : ∀ c : Fin 103, - (edge 25).2 < c → SeedEncoding.indexedAdj (edge 25).1 c → - SeedEncoding.indexedAdj (edge 25).2 c → - triangle (triangleIndex 25 c) = ((edge 25).1,(edge 25).2,c) := by decide +kernel -theorem triangle_complete_26 : ∀ c : Fin 103, - (edge 26).2 < c → SeedEncoding.indexedAdj (edge 26).1 c → - SeedEncoding.indexedAdj (edge 26).2 c → - triangle (triangleIndex 26 c) = ((edge 26).1,(edge 26).2,c) := by decide +kernel -theorem triangle_complete_27 : ∀ c : Fin 103, - (edge 27).2 < c → SeedEncoding.indexedAdj (edge 27).1 c → - SeedEncoding.indexedAdj (edge 27).2 c → - triangle (triangleIndex 27 c) = ((edge 27).1,(edge 27).2,c) := by decide +kernel -theorem triangle_complete_28 : ∀ c : Fin 103, - (edge 28).2 < c → SeedEncoding.indexedAdj (edge 28).1 c → - SeedEncoding.indexedAdj (edge 28).2 c → - triangle (triangleIndex 28 c) = ((edge 28).1,(edge 28).2,c) := by decide +kernel -theorem triangle_complete_29 : ∀ c : Fin 103, - (edge 29).2 < c → SeedEncoding.indexedAdj (edge 29).1 c → - SeedEncoding.indexedAdj (edge 29).2 c → - triangle (triangleIndex 29 c) = ((edge 29).1,(edge 29).2,c) := by decide +kernel -theorem triangle_complete_30 : ∀ c : Fin 103, - (edge 30).2 < c → SeedEncoding.indexedAdj (edge 30).1 c → - SeedEncoding.indexedAdj (edge 30).2 c → - triangle (triangleIndex 30 c) = ((edge 30).1,(edge 30).2,c) := by decide +kernel -theorem triangle_complete_31 : ∀ c : Fin 103, - (edge 31).2 < c → SeedEncoding.indexedAdj (edge 31).1 c → - SeedEncoding.indexedAdj (edge 31).2 c → - triangle (triangleIndex 31 c) = ((edge 31).1,(edge 31).2,c) := by decide +kernel -theorem triangle_complete_32 : ∀ c : Fin 103, - (edge 32).2 < c → SeedEncoding.indexedAdj (edge 32).1 c → - SeedEncoding.indexedAdj (edge 32).2 c → - triangle (triangleIndex 32 c) = ((edge 32).1,(edge 32).2,c) := by decide +kernel -theorem triangle_complete_33 : ∀ c : Fin 103, - (edge 33).2 < c → SeedEncoding.indexedAdj (edge 33).1 c → - SeedEncoding.indexedAdj (edge 33).2 c → - triangle (triangleIndex 33 c) = ((edge 33).1,(edge 33).2,c) := by decide +kernel -theorem triangle_complete_34 : ∀ c : Fin 103, - (edge 34).2 < c → SeedEncoding.indexedAdj (edge 34).1 c → - SeedEncoding.indexedAdj (edge 34).2 c → - triangle (triangleIndex 34 c) = ((edge 34).1,(edge 34).2,c) := by decide +kernel -theorem triangle_complete_35 : ∀ c : Fin 103, - (edge 35).2 < c → SeedEncoding.indexedAdj (edge 35).1 c → - SeedEncoding.indexedAdj (edge 35).2 c → - triangle (triangleIndex 35 c) = ((edge 35).1,(edge 35).2,c) := by decide +kernel -theorem triangle_complete_36 : ∀ c : Fin 103, - (edge 36).2 < c → SeedEncoding.indexedAdj (edge 36).1 c → - SeedEncoding.indexedAdj (edge 36).2 c → - triangle (triangleIndex 36 c) = ((edge 36).1,(edge 36).2,c) := by decide +kernel -theorem triangle_complete_37 : ∀ c : Fin 103, - (edge 37).2 < c → SeedEncoding.indexedAdj (edge 37).1 c → - SeedEncoding.indexedAdj (edge 37).2 c → - triangle (triangleIndex 37 c) = ((edge 37).1,(edge 37).2,c) := by decide +kernel -theorem triangle_complete_38 : ∀ c : Fin 103, - (edge 38).2 < c → SeedEncoding.indexedAdj (edge 38).1 c → - SeedEncoding.indexedAdj (edge 38).2 c → - triangle (triangleIndex 38 c) = ((edge 38).1,(edge 38).2,c) := by decide +kernel -theorem triangle_complete_39 : ∀ c : Fin 103, - (edge 39).2 < c → SeedEncoding.indexedAdj (edge 39).1 c → - SeedEncoding.indexedAdj (edge 39).2 c → - triangle (triangleIndex 39 c) = ((edge 39).1,(edge 39).2,c) := by decide +kernel -theorem triangle_complete_40 : ∀ c : Fin 103, - (edge 40).2 < c → SeedEncoding.indexedAdj (edge 40).1 c → - SeedEncoding.indexedAdj (edge 40).2 c → - triangle (triangleIndex 40 c) = ((edge 40).1,(edge 40).2,c) := by decide +kernel -theorem triangle_complete_41 : ∀ c : Fin 103, - (edge 41).2 < c → SeedEncoding.indexedAdj (edge 41).1 c → - SeedEncoding.indexedAdj (edge 41).2 c → - triangle (triangleIndex 41 c) = ((edge 41).1,(edge 41).2,c) := by decide +kernel -theorem triangle_complete_42 : ∀ c : Fin 103, - (edge 42).2 < c → SeedEncoding.indexedAdj (edge 42).1 c → - SeedEncoding.indexedAdj (edge 42).2 c → - triangle (triangleIndex 42 c) = ((edge 42).1,(edge 42).2,c) := by decide +kernel -theorem triangle_complete_43 : ∀ c : Fin 103, - (edge 43).2 < c → SeedEncoding.indexedAdj (edge 43).1 c → - SeedEncoding.indexedAdj (edge 43).2 c → - triangle (triangleIndex 43 c) = ((edge 43).1,(edge 43).2,c) := by decide +kernel -theorem triangle_complete_44 : ∀ c : Fin 103, - (edge 44).2 < c → SeedEncoding.indexedAdj (edge 44).1 c → - SeedEncoding.indexedAdj (edge 44).2 c → - triangle (triangleIndex 44 c) = ((edge 44).1,(edge 44).2,c) := by decide +kernel -theorem triangle_complete_45 : ∀ c : Fin 103, - (edge 45).2 < c → SeedEncoding.indexedAdj (edge 45).1 c → - SeedEncoding.indexedAdj (edge 45).2 c → - triangle (triangleIndex 45 c) = ((edge 45).1,(edge 45).2,c) := by decide +kernel -theorem triangle_complete_46 : ∀ c : Fin 103, - (edge 46).2 < c → SeedEncoding.indexedAdj (edge 46).1 c → - SeedEncoding.indexedAdj (edge 46).2 c → - triangle (triangleIndex 46 c) = ((edge 46).1,(edge 46).2,c) := by decide +kernel -theorem triangle_complete_47 : ∀ c : Fin 103, - (edge 47).2 < c → SeedEncoding.indexedAdj (edge 47).1 c → - SeedEncoding.indexedAdj (edge 47).2 c → - triangle (triangleIndex 47 c) = ((edge 47).1,(edge 47).2,c) := by decide +kernel -theorem triangle_complete_48 : ∀ c : Fin 103, - (edge 48).2 < c → SeedEncoding.indexedAdj (edge 48).1 c → - SeedEncoding.indexedAdj (edge 48).2 c → - triangle (triangleIndex 48 c) = ((edge 48).1,(edge 48).2,c) := by decide +kernel -theorem triangle_complete_49 : ∀ c : Fin 103, - (edge 49).2 < c → SeedEncoding.indexedAdj (edge 49).1 c → - SeedEncoding.indexedAdj (edge 49).2 c → - triangle (triangleIndex 49 c) = ((edge 49).1,(edge 49).2,c) := by decide +kernel -theorem triangle_complete_50 : ∀ c : Fin 103, - (edge 50).2 < c → SeedEncoding.indexedAdj (edge 50).1 c → - SeedEncoding.indexedAdj (edge 50).2 c → - triangle (triangleIndex 50 c) = ((edge 50).1,(edge 50).2,c) := by decide +kernel -theorem triangle_complete_51 : ∀ c : Fin 103, - (edge 51).2 < c → SeedEncoding.indexedAdj (edge 51).1 c → - SeedEncoding.indexedAdj (edge 51).2 c → - triangle (triangleIndex 51 c) = ((edge 51).1,(edge 51).2,c) := by decide +kernel -theorem triangle_complete_52 : ∀ c : Fin 103, - (edge 52).2 < c → SeedEncoding.indexedAdj (edge 52).1 c → - SeedEncoding.indexedAdj (edge 52).2 c → - triangle (triangleIndex 52 c) = ((edge 52).1,(edge 52).2,c) := by decide +kernel -theorem triangle_complete_53 : ∀ c : Fin 103, - (edge 53).2 < c → SeedEncoding.indexedAdj (edge 53).1 c → - SeedEncoding.indexedAdj (edge 53).2 c → - triangle (triangleIndex 53 c) = ((edge 53).1,(edge 53).2,c) := by decide +kernel -theorem triangle_complete_54 : ∀ c : Fin 103, - (edge 54).2 < c → SeedEncoding.indexedAdj (edge 54).1 c → - SeedEncoding.indexedAdj (edge 54).2 c → - triangle (triangleIndex 54 c) = ((edge 54).1,(edge 54).2,c) := by decide +kernel -theorem triangle_complete_55 : ∀ c : Fin 103, - (edge 55).2 < c → SeedEncoding.indexedAdj (edge 55).1 c → - SeedEncoding.indexedAdj (edge 55).2 c → - triangle (triangleIndex 55 c) = ((edge 55).1,(edge 55).2,c) := by decide +kernel -theorem triangle_complete_56 : ∀ c : Fin 103, - (edge 56).2 < c → SeedEncoding.indexedAdj (edge 56).1 c → - SeedEncoding.indexedAdj (edge 56).2 c → - triangle (triangleIndex 56 c) = ((edge 56).1,(edge 56).2,c) := by decide +kernel -theorem triangle_complete_57 : ∀ c : Fin 103, - (edge 57).2 < c → SeedEncoding.indexedAdj (edge 57).1 c → - SeedEncoding.indexedAdj (edge 57).2 c → - triangle (triangleIndex 57 c) = ((edge 57).1,(edge 57).2,c) := by decide +kernel -theorem triangle_complete_58 : ∀ c : Fin 103, - (edge 58).2 < c → SeedEncoding.indexedAdj (edge 58).1 c → - SeedEncoding.indexedAdj (edge 58).2 c → - triangle (triangleIndex 58 c) = ((edge 58).1,(edge 58).2,c) := by decide +kernel -theorem triangle_complete_59 : ∀ c : Fin 103, - (edge 59).2 < c → SeedEncoding.indexedAdj (edge 59).1 c → - SeedEncoding.indexedAdj (edge 59).2 c → - triangle (triangleIndex 59 c) = ((edge 59).1,(edge 59).2,c) := by decide +kernel -theorem triangle_complete_60 : ∀ c : Fin 103, - (edge 60).2 < c → SeedEncoding.indexedAdj (edge 60).1 c → - SeedEncoding.indexedAdj (edge 60).2 c → - triangle (triangleIndex 60 c) = ((edge 60).1,(edge 60).2,c) := by decide +kernel -theorem triangle_complete_61 : ∀ c : Fin 103, - (edge 61).2 < c → SeedEncoding.indexedAdj (edge 61).1 c → - SeedEncoding.indexedAdj (edge 61).2 c → - triangle (triangleIndex 61 c) = ((edge 61).1,(edge 61).2,c) := by decide +kernel -theorem triangle_complete_62 : ∀ c : Fin 103, - (edge 62).2 < c → SeedEncoding.indexedAdj (edge 62).1 c → - SeedEncoding.indexedAdj (edge 62).2 c → - triangle (triangleIndex 62 c) = ((edge 62).1,(edge 62).2,c) := by decide +kernel -theorem triangle_complete_63 : ∀ c : Fin 103, - (edge 63).2 < c → SeedEncoding.indexedAdj (edge 63).1 c → - SeedEncoding.indexedAdj (edge 63).2 c → - triangle (triangleIndex 63 c) = ((edge 63).1,(edge 63).2,c) := by decide +kernel -theorem triangle_complete_64 : ∀ c : Fin 103, - (edge 64).2 < c → SeedEncoding.indexedAdj (edge 64).1 c → - SeedEncoding.indexedAdj (edge 64).2 c → - triangle (triangleIndex 64 c) = ((edge 64).1,(edge 64).2,c) := by decide +kernel -theorem triangle_complete_65 : ∀ c : Fin 103, - (edge 65).2 < c → SeedEncoding.indexedAdj (edge 65).1 c → - SeedEncoding.indexedAdj (edge 65).2 c → - triangle (triangleIndex 65 c) = ((edge 65).1,(edge 65).2,c) := by decide +kernel -theorem triangle_complete_66 : ∀ c : Fin 103, - (edge 66).2 < c → SeedEncoding.indexedAdj (edge 66).1 c → - SeedEncoding.indexedAdj (edge 66).2 c → - triangle (triangleIndex 66 c) = ((edge 66).1,(edge 66).2,c) := by decide +kernel -theorem triangle_complete_67 : ∀ c : Fin 103, - (edge 67).2 < c → SeedEncoding.indexedAdj (edge 67).1 c → - SeedEncoding.indexedAdj (edge 67).2 c → - triangle (triangleIndex 67 c) = ((edge 67).1,(edge 67).2,c) := by decide +kernel -theorem triangle_complete_68 : ∀ c : Fin 103, - (edge 68).2 < c → SeedEncoding.indexedAdj (edge 68).1 c → - SeedEncoding.indexedAdj (edge 68).2 c → - triangle (triangleIndex 68 c) = ((edge 68).1,(edge 68).2,c) := by decide +kernel -theorem triangle_complete_69 : ∀ c : Fin 103, - (edge 69).2 < c → SeedEncoding.indexedAdj (edge 69).1 c → - SeedEncoding.indexedAdj (edge 69).2 c → - triangle (triangleIndex 69 c) = ((edge 69).1,(edge 69).2,c) := by decide +kernel -theorem triangle_complete_70 : ∀ c : Fin 103, - (edge 70).2 < c → SeedEncoding.indexedAdj (edge 70).1 c → - SeedEncoding.indexedAdj (edge 70).2 c → - triangle (triangleIndex 70 c) = ((edge 70).1,(edge 70).2,c) := by decide +kernel -theorem triangle_complete_71 : ∀ c : Fin 103, - (edge 71).2 < c → SeedEncoding.indexedAdj (edge 71).1 c → - SeedEncoding.indexedAdj (edge 71).2 c → - triangle (triangleIndex 71 c) = ((edge 71).1,(edge 71).2,c) := by decide +kernel -theorem triangle_complete_72 : ∀ c : Fin 103, - (edge 72).2 < c → SeedEncoding.indexedAdj (edge 72).1 c → - SeedEncoding.indexedAdj (edge 72).2 c → - triangle (triangleIndex 72 c) = ((edge 72).1,(edge 72).2,c) := by decide +kernel -theorem triangle_complete_73 : ∀ c : Fin 103, - (edge 73).2 < c → SeedEncoding.indexedAdj (edge 73).1 c → - SeedEncoding.indexedAdj (edge 73).2 c → - triangle (triangleIndex 73 c) = ((edge 73).1,(edge 73).2,c) := by decide +kernel -theorem triangle_complete_74 : ∀ c : Fin 103, - (edge 74).2 < c → SeedEncoding.indexedAdj (edge 74).1 c → - SeedEncoding.indexedAdj (edge 74).2 c → - triangle (triangleIndex 74 c) = ((edge 74).1,(edge 74).2,c) := by decide +kernel -theorem triangle_complete_75 : ∀ c : Fin 103, - (edge 75).2 < c → SeedEncoding.indexedAdj (edge 75).1 c → - SeedEncoding.indexedAdj (edge 75).2 c → - triangle (triangleIndex 75 c) = ((edge 75).1,(edge 75).2,c) := by decide +kernel -theorem triangle_complete_76 : ∀ c : Fin 103, - (edge 76).2 < c → SeedEncoding.indexedAdj (edge 76).1 c → - SeedEncoding.indexedAdj (edge 76).2 c → - triangle (triangleIndex 76 c) = ((edge 76).1,(edge 76).2,c) := by decide +kernel -theorem triangle_complete_77 : ∀ c : Fin 103, - (edge 77).2 < c → SeedEncoding.indexedAdj (edge 77).1 c → - SeedEncoding.indexedAdj (edge 77).2 c → - triangle (triangleIndex 77 c) = ((edge 77).1,(edge 77).2,c) := by decide +kernel -theorem triangle_complete_78 : ∀ c : Fin 103, - (edge 78).2 < c → SeedEncoding.indexedAdj (edge 78).1 c → - SeedEncoding.indexedAdj (edge 78).2 c → - triangle (triangleIndex 78 c) = ((edge 78).1,(edge 78).2,c) := by decide +kernel -theorem triangle_complete_79 : ∀ c : Fin 103, - (edge 79).2 < c → SeedEncoding.indexedAdj (edge 79).1 c → - SeedEncoding.indexedAdj (edge 79).2 c → - triangle (triangleIndex 79 c) = ((edge 79).1,(edge 79).2,c) := by decide +kernel -theorem triangle_complete_80 : ∀ c : Fin 103, - (edge 80).2 < c → SeedEncoding.indexedAdj (edge 80).1 c → - SeedEncoding.indexedAdj (edge 80).2 c → - triangle (triangleIndex 80 c) = ((edge 80).1,(edge 80).2,c) := by decide +kernel -theorem triangle_complete_81 : ∀ c : Fin 103, - (edge 81).2 < c → SeedEncoding.indexedAdj (edge 81).1 c → - SeedEncoding.indexedAdj (edge 81).2 c → - triangle (triangleIndex 81 c) = ((edge 81).1,(edge 81).2,c) := by decide +kernel -theorem triangle_complete_82 : ∀ c : Fin 103, - (edge 82).2 < c → SeedEncoding.indexedAdj (edge 82).1 c → - SeedEncoding.indexedAdj (edge 82).2 c → - triangle (triangleIndex 82 c) = ((edge 82).1,(edge 82).2,c) := by decide +kernel -theorem triangle_complete_83 : ∀ c : Fin 103, - (edge 83).2 < c → SeedEncoding.indexedAdj (edge 83).1 c → - SeedEncoding.indexedAdj (edge 83).2 c → - triangle (triangleIndex 83 c) = ((edge 83).1,(edge 83).2,c) := by decide +kernel -theorem triangle_complete_84 : ∀ c : Fin 103, - (edge 84).2 < c → SeedEncoding.indexedAdj (edge 84).1 c → - SeedEncoding.indexedAdj (edge 84).2 c → - triangle (triangleIndex 84 c) = ((edge 84).1,(edge 84).2,c) := by decide +kernel -theorem triangle_complete_85 : ∀ c : Fin 103, - (edge 85).2 < c → SeedEncoding.indexedAdj (edge 85).1 c → - SeedEncoding.indexedAdj (edge 85).2 c → - triangle (triangleIndex 85 c) = ((edge 85).1,(edge 85).2,c) := by decide +kernel -theorem triangle_complete_86 : ∀ c : Fin 103, - (edge 86).2 < c → SeedEncoding.indexedAdj (edge 86).1 c → - SeedEncoding.indexedAdj (edge 86).2 c → - triangle (triangleIndex 86 c) = ((edge 86).1,(edge 86).2,c) := by decide +kernel -theorem triangle_complete_87 : ∀ c : Fin 103, - (edge 87).2 < c → SeedEncoding.indexedAdj (edge 87).1 c → - SeedEncoding.indexedAdj (edge 87).2 c → - triangle (triangleIndex 87 c) = ((edge 87).1,(edge 87).2,c) := by decide +kernel -theorem triangle_complete_88 : ∀ c : Fin 103, - (edge 88).2 < c → SeedEncoding.indexedAdj (edge 88).1 c → - SeedEncoding.indexedAdj (edge 88).2 c → - triangle (triangleIndex 88 c) = ((edge 88).1,(edge 88).2,c) := by decide +kernel -theorem triangle_complete_89 : ∀ c : Fin 103, - (edge 89).2 < c → SeedEncoding.indexedAdj (edge 89).1 c → - SeedEncoding.indexedAdj (edge 89).2 c → - triangle (triangleIndex 89 c) = ((edge 89).1,(edge 89).2,c) := by decide +kernel -theorem triangle_complete_90 : ∀ c : Fin 103, - (edge 90).2 < c → SeedEncoding.indexedAdj (edge 90).1 c → - SeedEncoding.indexedAdj (edge 90).2 c → - triangle (triangleIndex 90 c) = ((edge 90).1,(edge 90).2,c) := by decide +kernel -theorem triangle_complete_91 : ∀ c : Fin 103, - (edge 91).2 < c → SeedEncoding.indexedAdj (edge 91).1 c → - SeedEncoding.indexedAdj (edge 91).2 c → - triangle (triangleIndex 91 c) = ((edge 91).1,(edge 91).2,c) := by decide +kernel -theorem triangle_complete_92 : ∀ c : Fin 103, - (edge 92).2 < c → SeedEncoding.indexedAdj (edge 92).1 c → - SeedEncoding.indexedAdj (edge 92).2 c → - triangle (triangleIndex 92 c) = ((edge 92).1,(edge 92).2,c) := by decide +kernel -theorem triangle_complete_93 : ∀ c : Fin 103, - (edge 93).2 < c → SeedEncoding.indexedAdj (edge 93).1 c → - SeedEncoding.indexedAdj (edge 93).2 c → - triangle (triangleIndex 93 c) = ((edge 93).1,(edge 93).2,c) := by decide +kernel -theorem triangle_complete_94 : ∀ c : Fin 103, - (edge 94).2 < c → SeedEncoding.indexedAdj (edge 94).1 c → - SeedEncoding.indexedAdj (edge 94).2 c → - triangle (triangleIndex 94 c) = ((edge 94).1,(edge 94).2,c) := by decide +kernel -theorem triangle_complete_95 : ∀ c : Fin 103, - (edge 95).2 < c → SeedEncoding.indexedAdj (edge 95).1 c → - SeedEncoding.indexedAdj (edge 95).2 c → - triangle (triangleIndex 95 c) = ((edge 95).1,(edge 95).2,c) := by decide +kernel -theorem triangle_complete_96 : ∀ c : Fin 103, - (edge 96).2 < c → SeedEncoding.indexedAdj (edge 96).1 c → - SeedEncoding.indexedAdj (edge 96).2 c → - triangle (triangleIndex 96 c) = ((edge 96).1,(edge 96).2,c) := by decide +kernel -theorem triangle_complete_97 : ∀ c : Fin 103, - (edge 97).2 < c → SeedEncoding.indexedAdj (edge 97).1 c → - SeedEncoding.indexedAdj (edge 97).2 c → - triangle (triangleIndex 97 c) = ((edge 97).1,(edge 97).2,c) := by decide +kernel -theorem triangle_complete_98 : ∀ c : Fin 103, - (edge 98).2 < c → SeedEncoding.indexedAdj (edge 98).1 c → - SeedEncoding.indexedAdj (edge 98).2 c → - triangle (triangleIndex 98 c) = ((edge 98).1,(edge 98).2,c) := by decide +kernel -theorem triangle_complete_99 : ∀ c : Fin 103, - (edge 99).2 < c → SeedEncoding.indexedAdj (edge 99).1 c → - SeedEncoding.indexedAdj (edge 99).2 c → - triangle (triangleIndex 99 c) = ((edge 99).1,(edge 99).2,c) := by decide +kernel -theorem triangle_complete_100 : ∀ c : Fin 103, - (edge 100).2 < c → SeedEncoding.indexedAdj (edge 100).1 c → - SeedEncoding.indexedAdj (edge 100).2 c → - triangle (triangleIndex 100 c) = ((edge 100).1,(edge 100).2,c) := by decide +kernel -theorem triangle_complete_101 : ∀ c : Fin 103, - (edge 101).2 < c → SeedEncoding.indexedAdj (edge 101).1 c → - SeedEncoding.indexedAdj (edge 101).2 c → - triangle (triangleIndex 101 c) = ((edge 101).1,(edge 101).2,c) := by decide +kernel -theorem triangle_complete_102 : ∀ c : Fin 103, - (edge 102).2 < c → SeedEncoding.indexedAdj (edge 102).1 c → - SeedEncoding.indexedAdj (edge 102).2 c → - triangle (triangleIndex 102 c) = ((edge 102).1,(edge 102).2,c) := by decide +kernel -theorem triangle_complete_103 : ∀ c : Fin 103, - (edge 103).2 < c → SeedEncoding.indexedAdj (edge 103).1 c → - SeedEncoding.indexedAdj (edge 103).2 c → - triangle (triangleIndex 103 c) = ((edge 103).1,(edge 103).2,c) := by decide +kernel -theorem triangle_complete_104 : ∀ c : Fin 103, - (edge 104).2 < c → SeedEncoding.indexedAdj (edge 104).1 c → - SeedEncoding.indexedAdj (edge 104).2 c → - triangle (triangleIndex 104 c) = ((edge 104).1,(edge 104).2,c) := by decide +kernel -theorem triangle_complete_105 : ∀ c : Fin 103, - (edge 105).2 < c → SeedEncoding.indexedAdj (edge 105).1 c → - SeedEncoding.indexedAdj (edge 105).2 c → - triangle (triangleIndex 105 c) = ((edge 105).1,(edge 105).2,c) := by decide +kernel -theorem triangle_complete_106 : ∀ c : Fin 103, - (edge 106).2 < c → SeedEncoding.indexedAdj (edge 106).1 c → - SeedEncoding.indexedAdj (edge 106).2 c → - triangle (triangleIndex 106 c) = ((edge 106).1,(edge 106).2,c) := by decide +kernel -theorem triangle_complete_107 : ∀ c : Fin 103, - (edge 107).2 < c → SeedEncoding.indexedAdj (edge 107).1 c → - SeedEncoding.indexedAdj (edge 107).2 c → - triangle (triangleIndex 107 c) = ((edge 107).1,(edge 107).2,c) := by decide +kernel -theorem triangle_complete_108 : ∀ c : Fin 103, - (edge 108).2 < c → SeedEncoding.indexedAdj (edge 108).1 c → - SeedEncoding.indexedAdj (edge 108).2 c → - triangle (triangleIndex 108 c) = ((edge 108).1,(edge 108).2,c) := by decide +kernel -theorem triangle_complete_109 : ∀ c : Fin 103, - (edge 109).2 < c → SeedEncoding.indexedAdj (edge 109).1 c → - SeedEncoding.indexedAdj (edge 109).2 c → - triangle (triangleIndex 109 c) = ((edge 109).1,(edge 109).2,c) := by decide +kernel -theorem triangle_complete_110 : ∀ c : Fin 103, - (edge 110).2 < c → SeedEncoding.indexedAdj (edge 110).1 c → - SeedEncoding.indexedAdj (edge 110).2 c → - triangle (triangleIndex 110 c) = ((edge 110).1,(edge 110).2,c) := by decide +kernel -theorem triangle_complete_111 : ∀ c : Fin 103, - (edge 111).2 < c → SeedEncoding.indexedAdj (edge 111).1 c → - SeedEncoding.indexedAdj (edge 111).2 c → - triangle (triangleIndex 111 c) = ((edge 111).1,(edge 111).2,c) := by decide +kernel -theorem triangle_complete_112 : ∀ c : Fin 103, - (edge 112).2 < c → SeedEncoding.indexedAdj (edge 112).1 c → - SeedEncoding.indexedAdj (edge 112).2 c → - triangle (triangleIndex 112 c) = ((edge 112).1,(edge 112).2,c) := by decide +kernel -theorem triangle_complete_113 : ∀ c : Fin 103, - (edge 113).2 < c → SeedEncoding.indexedAdj (edge 113).1 c → - SeedEncoding.indexedAdj (edge 113).2 c → - triangle (triangleIndex 113 c) = ((edge 113).1,(edge 113).2,c) := by decide +kernel -theorem triangle_complete_114 : ∀ c : Fin 103, - (edge 114).2 < c → SeedEncoding.indexedAdj (edge 114).1 c → - SeedEncoding.indexedAdj (edge 114).2 c → - triangle (triangleIndex 114 c) = ((edge 114).1,(edge 114).2,c) := by decide +kernel -theorem triangle_complete_115 : ∀ c : Fin 103, - (edge 115).2 < c → SeedEncoding.indexedAdj (edge 115).1 c → - SeedEncoding.indexedAdj (edge 115).2 c → - triangle (triangleIndex 115 c) = ((edge 115).1,(edge 115).2,c) := by decide +kernel -theorem triangle_complete_116 : ∀ c : Fin 103, - (edge 116).2 < c → SeedEncoding.indexedAdj (edge 116).1 c → - SeedEncoding.indexedAdj (edge 116).2 c → - triangle (triangleIndex 116 c) = ((edge 116).1,(edge 116).2,c) := by decide +kernel -theorem triangle_complete_117 : ∀ c : Fin 103, - (edge 117).2 < c → SeedEncoding.indexedAdj (edge 117).1 c → - SeedEncoding.indexedAdj (edge 117).2 c → - triangle (triangleIndex 117 c) = ((edge 117).1,(edge 117).2,c) := by decide +kernel -theorem triangle_complete_118 : ∀ c : Fin 103, - (edge 118).2 < c → SeedEncoding.indexedAdj (edge 118).1 c → - SeedEncoding.indexedAdj (edge 118).2 c → - triangle (triangleIndex 118 c) = ((edge 118).1,(edge 118).2,c) := by decide +kernel -theorem triangle_complete_119 : ∀ c : Fin 103, - (edge 119).2 < c → SeedEncoding.indexedAdj (edge 119).1 c → - SeedEncoding.indexedAdj (edge 119).2 c → - triangle (triangleIndex 119 c) = ((edge 119).1,(edge 119).2,c) := by decide +kernel -theorem triangle_complete_120 : ∀ c : Fin 103, - (edge 120).2 < c → SeedEncoding.indexedAdj (edge 120).1 c → - SeedEncoding.indexedAdj (edge 120).2 c → - triangle (triangleIndex 120 c) = ((edge 120).1,(edge 120).2,c) := by decide +kernel -theorem triangle_complete_121 : ∀ c : Fin 103, - (edge 121).2 < c → SeedEncoding.indexedAdj (edge 121).1 c → - SeedEncoding.indexedAdj (edge 121).2 c → - triangle (triangleIndex 121 c) = ((edge 121).1,(edge 121).2,c) := by decide +kernel -theorem triangle_complete_122 : ∀ c : Fin 103, - (edge 122).2 < c → SeedEncoding.indexedAdj (edge 122).1 c → - SeedEncoding.indexedAdj (edge 122).2 c → - triangle (triangleIndex 122 c) = ((edge 122).1,(edge 122).2,c) := by decide +kernel -theorem triangle_complete_123 : ∀ c : Fin 103, - (edge 123).2 < c → SeedEncoding.indexedAdj (edge 123).1 c → - SeedEncoding.indexedAdj (edge 123).2 c → - triangle (triangleIndex 123 c) = ((edge 123).1,(edge 123).2,c) := by decide +kernel -theorem triangle_complete_124 : ∀ c : Fin 103, - (edge 124).2 < c → SeedEncoding.indexedAdj (edge 124).1 c → - SeedEncoding.indexedAdj (edge 124).2 c → - triangle (triangleIndex 124 c) = ((edge 124).1,(edge 124).2,c) := by decide +kernel -theorem triangle_complete_125 : ∀ c : Fin 103, - (edge 125).2 < c → SeedEncoding.indexedAdj (edge 125).1 c → - SeedEncoding.indexedAdj (edge 125).2 c → - triangle (triangleIndex 125 c) = ((edge 125).1,(edge 125).2,c) := by decide +kernel -theorem triangle_complete_126 : ∀ c : Fin 103, - (edge 126).2 < c → SeedEncoding.indexedAdj (edge 126).1 c → - SeedEncoding.indexedAdj (edge 126).2 c → - triangle (triangleIndex 126 c) = ((edge 126).1,(edge 126).2,c) := by decide +kernel -theorem triangle_complete_127 : ∀ c : Fin 103, - (edge 127).2 < c → SeedEncoding.indexedAdj (edge 127).1 c → - SeedEncoding.indexedAdj (edge 127).2 c → - triangle (triangleIndex 127 c) = ((edge 127).1,(edge 127).2,c) := by decide +kernel -theorem triangle_complete_128 : ∀ c : Fin 103, - (edge 128).2 < c → SeedEncoding.indexedAdj (edge 128).1 c → - SeedEncoding.indexedAdj (edge 128).2 c → - triangle (triangleIndex 128 c) = ((edge 128).1,(edge 128).2,c) := by decide +kernel -theorem triangle_complete_129 : ∀ c : Fin 103, - (edge 129).2 < c → SeedEncoding.indexedAdj (edge 129).1 c → - SeedEncoding.indexedAdj (edge 129).2 c → - triangle (triangleIndex 129 c) = ((edge 129).1,(edge 129).2,c) := by decide +kernel -theorem triangle_complete_130 : ∀ c : Fin 103, - (edge 130).2 < c → SeedEncoding.indexedAdj (edge 130).1 c → - SeedEncoding.indexedAdj (edge 130).2 c → - triangle (triangleIndex 130 c) = ((edge 130).1,(edge 130).2,c) := by decide +kernel -theorem triangle_complete_131 : ∀ c : Fin 103, - (edge 131).2 < c → SeedEncoding.indexedAdj (edge 131).1 c → - SeedEncoding.indexedAdj (edge 131).2 c → - triangle (triangleIndex 131 c) = ((edge 131).1,(edge 131).2,c) := by decide +kernel -theorem triangle_complete_132 : ∀ c : Fin 103, - (edge 132).2 < c → SeedEncoding.indexedAdj (edge 132).1 c → - SeedEncoding.indexedAdj (edge 132).2 c → - triangle (triangleIndex 132 c) = ((edge 132).1,(edge 132).2,c) := by decide +kernel -theorem triangle_complete_133 : ∀ c : Fin 103, - (edge 133).2 < c → SeedEncoding.indexedAdj (edge 133).1 c → - SeedEncoding.indexedAdj (edge 133).2 c → - triangle (triangleIndex 133 c) = ((edge 133).1,(edge 133).2,c) := by decide +kernel -theorem triangle_complete_134 : ∀ c : Fin 103, - (edge 134).2 < c → SeedEncoding.indexedAdj (edge 134).1 c → - SeedEncoding.indexedAdj (edge 134).2 c → - triangle (triangleIndex 134 c) = ((edge 134).1,(edge 134).2,c) := by decide +kernel -theorem triangle_complete_135 : ∀ c : Fin 103, - (edge 135).2 < c → SeedEncoding.indexedAdj (edge 135).1 c → - SeedEncoding.indexedAdj (edge 135).2 c → - triangle (triangleIndex 135 c) = ((edge 135).1,(edge 135).2,c) := by decide +kernel -theorem triangle_complete_136 : ∀ c : Fin 103, - (edge 136).2 < c → SeedEncoding.indexedAdj (edge 136).1 c → - SeedEncoding.indexedAdj (edge 136).2 c → - triangle (triangleIndex 136 c) = ((edge 136).1,(edge 136).2,c) := by decide +kernel -theorem triangle_complete_137 : ∀ c : Fin 103, - (edge 137).2 < c → SeedEncoding.indexedAdj (edge 137).1 c → - SeedEncoding.indexedAdj (edge 137).2 c → - triangle (triangleIndex 137 c) = ((edge 137).1,(edge 137).2,c) := by decide +kernel -theorem triangle_complete_138 : ∀ c : Fin 103, - (edge 138).2 < c → SeedEncoding.indexedAdj (edge 138).1 c → - SeedEncoding.indexedAdj (edge 138).2 c → - triangle (triangleIndex 138 c) = ((edge 138).1,(edge 138).2,c) := by decide +kernel -theorem triangle_complete_139 : ∀ c : Fin 103, - (edge 139).2 < c → SeedEncoding.indexedAdj (edge 139).1 c → - SeedEncoding.indexedAdj (edge 139).2 c → - triangle (triangleIndex 139 c) = ((edge 139).1,(edge 139).2,c) := by decide +kernel -theorem triangle_complete_140 : ∀ c : Fin 103, - (edge 140).2 < c → SeedEncoding.indexedAdj (edge 140).1 c → - SeedEncoding.indexedAdj (edge 140).2 c → - triangle (triangleIndex 140 c) = ((edge 140).1,(edge 140).2,c) := by decide +kernel -theorem triangle_complete_141 : ∀ c : Fin 103, - (edge 141).2 < c → SeedEncoding.indexedAdj (edge 141).1 c → - SeedEncoding.indexedAdj (edge 141).2 c → - triangle (triangleIndex 141 c) = ((edge 141).1,(edge 141).2,c) := by decide +kernel -theorem triangle_complete_142 : ∀ c : Fin 103, - (edge 142).2 < c → SeedEncoding.indexedAdj (edge 142).1 c → - SeedEncoding.indexedAdj (edge 142).2 c → - triangle (triangleIndex 142 c) = ((edge 142).1,(edge 142).2,c) := by decide +kernel -theorem triangle_complete_143 : ∀ c : Fin 103, - (edge 143).2 < c → SeedEncoding.indexedAdj (edge 143).1 c → - SeedEncoding.indexedAdj (edge 143).2 c → - triangle (triangleIndex 143 c) = ((edge 143).1,(edge 143).2,c) := by decide +kernel -theorem triangle_complete_144 : ∀ c : Fin 103, - (edge 144).2 < c → SeedEncoding.indexedAdj (edge 144).1 c → - SeedEncoding.indexedAdj (edge 144).2 c → - triangle (triangleIndex 144 c) = ((edge 144).1,(edge 144).2,c) := by decide +kernel -theorem triangle_complete_145 : ∀ c : Fin 103, - (edge 145).2 < c → SeedEncoding.indexedAdj (edge 145).1 c → - SeedEncoding.indexedAdj (edge 145).2 c → - triangle (triangleIndex 145 c) = ((edge 145).1,(edge 145).2,c) := by decide +kernel -theorem triangle_complete_146 : ∀ c : Fin 103, - (edge 146).2 < c → SeedEncoding.indexedAdj (edge 146).1 c → - SeedEncoding.indexedAdj (edge 146).2 c → - triangle (triangleIndex 146 c) = ((edge 146).1,(edge 146).2,c) := by decide +kernel -theorem triangle_complete_147 : ∀ c : Fin 103, - (edge 147).2 < c → SeedEncoding.indexedAdj (edge 147).1 c → - SeedEncoding.indexedAdj (edge 147).2 c → - triangle (triangleIndex 147 c) = ((edge 147).1,(edge 147).2,c) := by decide +kernel -theorem triangle_complete_148 : ∀ c : Fin 103, - (edge 148).2 < c → SeedEncoding.indexedAdj (edge 148).1 c → - SeedEncoding.indexedAdj (edge 148).2 c → - triangle (triangleIndex 148 c) = ((edge 148).1,(edge 148).2,c) := by decide +kernel -theorem triangle_complete_149 : ∀ c : Fin 103, - (edge 149).2 < c → SeedEncoding.indexedAdj (edge 149).1 c → - SeedEncoding.indexedAdj (edge 149).2 c → - triangle (triangleIndex 149 c) = ((edge 149).1,(edge 149).2,c) := by decide +kernel -theorem triangle_complete_150 : ∀ c : Fin 103, - (edge 150).2 < c → SeedEncoding.indexedAdj (edge 150).1 c → - SeedEncoding.indexedAdj (edge 150).2 c → - triangle (triangleIndex 150 c) = ((edge 150).1,(edge 150).2,c) := by decide +kernel -theorem triangle_complete_151 : ∀ c : Fin 103, - (edge 151).2 < c → SeedEncoding.indexedAdj (edge 151).1 c → - SeedEncoding.indexedAdj (edge 151).2 c → - triangle (triangleIndex 151 c) = ((edge 151).1,(edge 151).2,c) := by decide +kernel -theorem triangle_complete_152 : ∀ c : Fin 103, - (edge 152).2 < c → SeedEncoding.indexedAdj (edge 152).1 c → - SeedEncoding.indexedAdj (edge 152).2 c → - triangle (triangleIndex 152 c) = ((edge 152).1,(edge 152).2,c) := by decide +kernel -theorem triangle_complete_153 : ∀ c : Fin 103, - (edge 153).2 < c → SeedEncoding.indexedAdj (edge 153).1 c → - SeedEncoding.indexedAdj (edge 153).2 c → - triangle (triangleIndex 153 c) = ((edge 153).1,(edge 153).2,c) := by decide +kernel -theorem triangle_complete_154 : ∀ c : Fin 103, - (edge 154).2 < c → SeedEncoding.indexedAdj (edge 154).1 c → - SeedEncoding.indexedAdj (edge 154).2 c → - triangle (triangleIndex 154 c) = ((edge 154).1,(edge 154).2,c) := by decide +kernel -theorem triangle_complete_155 : ∀ c : Fin 103, - (edge 155).2 < c → SeedEncoding.indexedAdj (edge 155).1 c → - SeedEncoding.indexedAdj (edge 155).2 c → - triangle (triangleIndex 155 c) = ((edge 155).1,(edge 155).2,c) := by decide +kernel -theorem triangle_complete_156 : ∀ c : Fin 103, - (edge 156).2 < c → SeedEncoding.indexedAdj (edge 156).1 c → - SeedEncoding.indexedAdj (edge 156).2 c → - triangle (triangleIndex 156 c) = ((edge 156).1,(edge 156).2,c) := by decide +kernel -theorem triangle_complete_157 : ∀ c : Fin 103, - (edge 157).2 < c → SeedEncoding.indexedAdj (edge 157).1 c → - SeedEncoding.indexedAdj (edge 157).2 c → - triangle (triangleIndex 157 c) = ((edge 157).1,(edge 157).2,c) := by decide +kernel -theorem triangle_complete_158 : ∀ c : Fin 103, - (edge 158).2 < c → SeedEncoding.indexedAdj (edge 158).1 c → - SeedEncoding.indexedAdj (edge 158).2 c → - triangle (triangleIndex 158 c) = ((edge 158).1,(edge 158).2,c) := by decide +kernel -theorem triangle_complete_159 : ∀ c : Fin 103, - (edge 159).2 < c → SeedEncoding.indexedAdj (edge 159).1 c → - SeedEncoding.indexedAdj (edge 159).2 c → - triangle (triangleIndex 159 c) = ((edge 159).1,(edge 159).2,c) := by decide +kernel -theorem triangle_complete_160 : ∀ c : Fin 103, - (edge 160).2 < c → SeedEncoding.indexedAdj (edge 160).1 c → - SeedEncoding.indexedAdj (edge 160).2 c → - triangle (triangleIndex 160 c) = ((edge 160).1,(edge 160).2,c) := by decide +kernel -theorem triangle_complete_161 : ∀ c : Fin 103, - (edge 161).2 < c → SeedEncoding.indexedAdj (edge 161).1 c → - SeedEncoding.indexedAdj (edge 161).2 c → - triangle (triangleIndex 161 c) = ((edge 161).1,(edge 161).2,c) := by decide +kernel -theorem triangle_complete_162 : ∀ c : Fin 103, - (edge 162).2 < c → SeedEncoding.indexedAdj (edge 162).1 c → - SeedEncoding.indexedAdj (edge 162).2 c → - triangle (triangleIndex 162 c) = ((edge 162).1,(edge 162).2,c) := by decide +kernel -theorem triangle_complete_163 : ∀ c : Fin 103, - (edge 163).2 < c → SeedEncoding.indexedAdj (edge 163).1 c → - SeedEncoding.indexedAdj (edge 163).2 c → - triangle (triangleIndex 163 c) = ((edge 163).1,(edge 163).2,c) := by decide +kernel -theorem triangle_complete_164 : ∀ c : Fin 103, - (edge 164).2 < c → SeedEncoding.indexedAdj (edge 164).1 c → - SeedEncoding.indexedAdj (edge 164).2 c → - triangle (triangleIndex 164 c) = ((edge 164).1,(edge 164).2,c) := by decide +kernel -theorem triangle_complete_165 : ∀ c : Fin 103, - (edge 165).2 < c → SeedEncoding.indexedAdj (edge 165).1 c → - SeedEncoding.indexedAdj (edge 165).2 c → - triangle (triangleIndex 165 c) = ((edge 165).1,(edge 165).2,c) := by decide +kernel -theorem triangle_complete_166 : ∀ c : Fin 103, - (edge 166).2 < c → SeedEncoding.indexedAdj (edge 166).1 c → - SeedEncoding.indexedAdj (edge 166).2 c → - triangle (triangleIndex 166 c) = ((edge 166).1,(edge 166).2,c) := by decide +kernel -theorem triangle_complete_167 : ∀ c : Fin 103, - (edge 167).2 < c → SeedEncoding.indexedAdj (edge 167).1 c → - SeedEncoding.indexedAdj (edge 167).2 c → - triangle (triangleIndex 167 c) = ((edge 167).1,(edge 167).2,c) := by decide +kernel -theorem triangle_complete_168 : ∀ c : Fin 103, - (edge 168).2 < c → SeedEncoding.indexedAdj (edge 168).1 c → - SeedEncoding.indexedAdj (edge 168).2 c → - triangle (triangleIndex 168 c) = ((edge 168).1,(edge 168).2,c) := by decide +kernel -theorem triangle_complete_169 : ∀ c : Fin 103, - (edge 169).2 < c → SeedEncoding.indexedAdj (edge 169).1 c → - SeedEncoding.indexedAdj (edge 169).2 c → - triangle (triangleIndex 169 c) = ((edge 169).1,(edge 169).2,c) := by decide +kernel -theorem triangle_complete_170 : ∀ c : Fin 103, - (edge 170).2 < c → SeedEncoding.indexedAdj (edge 170).1 c → - SeedEncoding.indexedAdj (edge 170).2 c → - triangle (triangleIndex 170 c) = ((edge 170).1,(edge 170).2,c) := by decide +kernel -theorem triangle_complete_171 : ∀ c : Fin 103, - (edge 171).2 < c → SeedEncoding.indexedAdj (edge 171).1 c → - SeedEncoding.indexedAdj (edge 171).2 c → - triangle (triangleIndex 171 c) = ((edge 171).1,(edge 171).2,c) := by decide +kernel -theorem triangle_complete_172 : ∀ c : Fin 103, - (edge 172).2 < c → SeedEncoding.indexedAdj (edge 172).1 c → - SeedEncoding.indexedAdj (edge 172).2 c → - triangle (triangleIndex 172 c) = ((edge 172).1,(edge 172).2,c) := by decide +kernel -theorem triangle_complete_173 : ∀ c : Fin 103, - (edge 173).2 < c → SeedEncoding.indexedAdj (edge 173).1 c → - SeedEncoding.indexedAdj (edge 173).2 c → - triangle (triangleIndex 173 c) = ((edge 173).1,(edge 173).2,c) := by decide +kernel -theorem triangle_complete_174 : ∀ c : Fin 103, - (edge 174).2 < c → SeedEncoding.indexedAdj (edge 174).1 c → - SeedEncoding.indexedAdj (edge 174).2 c → - triangle (triangleIndex 174 c) = ((edge 174).1,(edge 174).2,c) := by decide +kernel -theorem triangle_complete_175 : ∀ c : Fin 103, - (edge 175).2 < c → SeedEncoding.indexedAdj (edge 175).1 c → - SeedEncoding.indexedAdj (edge 175).2 c → - triangle (triangleIndex 175 c) = ((edge 175).1,(edge 175).2,c) := by decide +kernel -theorem triangle_complete_176 : ∀ c : Fin 103, - (edge 176).2 < c → SeedEncoding.indexedAdj (edge 176).1 c → - SeedEncoding.indexedAdj (edge 176).2 c → - triangle (triangleIndex 176 c) = ((edge 176).1,(edge 176).2,c) := by decide +kernel -theorem triangle_complete_177 : ∀ c : Fin 103, - (edge 177).2 < c → SeedEncoding.indexedAdj (edge 177).1 c → - SeedEncoding.indexedAdj (edge 177).2 c → - triangle (triangleIndex 177 c) = ((edge 177).1,(edge 177).2,c) := by decide +kernel -theorem triangle_complete_178 : ∀ c : Fin 103, - (edge 178).2 < c → SeedEncoding.indexedAdj (edge 178).1 c → - SeedEncoding.indexedAdj (edge 178).2 c → - triangle (triangleIndex 178 c) = ((edge 178).1,(edge 178).2,c) := by decide +kernel -theorem triangle_complete_179 : ∀ c : Fin 103, - (edge 179).2 < c → SeedEncoding.indexedAdj (edge 179).1 c → - SeedEncoding.indexedAdj (edge 179).2 c → - triangle (triangleIndex 179 c) = ((edge 179).1,(edge 179).2,c) := by decide +kernel -theorem triangle_complete_180 : ∀ c : Fin 103, - (edge 180).2 < c → SeedEncoding.indexedAdj (edge 180).1 c → - SeedEncoding.indexedAdj (edge 180).2 c → - triangle (triangleIndex 180 c) = ((edge 180).1,(edge 180).2,c) := by decide +kernel -theorem triangle_complete_181 : ∀ c : Fin 103, - (edge 181).2 < c → SeedEncoding.indexedAdj (edge 181).1 c → - SeedEncoding.indexedAdj (edge 181).2 c → - triangle (triangleIndex 181 c) = ((edge 181).1,(edge 181).2,c) := by decide +kernel -theorem triangle_complete_182 : ∀ c : Fin 103, - (edge 182).2 < c → SeedEncoding.indexedAdj (edge 182).1 c → - SeedEncoding.indexedAdj (edge 182).2 c → - triangle (triangleIndex 182 c) = ((edge 182).1,(edge 182).2,c) := by decide +kernel -theorem triangle_complete_183 : ∀ c : Fin 103, - (edge 183).2 < c → SeedEncoding.indexedAdj (edge 183).1 c → - SeedEncoding.indexedAdj (edge 183).2 c → - triangle (triangleIndex 183 c) = ((edge 183).1,(edge 183).2,c) := by decide +kernel -theorem triangle_complete_184 : ∀ c : Fin 103, - (edge 184).2 < c → SeedEncoding.indexedAdj (edge 184).1 c → - SeedEncoding.indexedAdj (edge 184).2 c → - triangle (triangleIndex 184 c) = ((edge 184).1,(edge 184).2,c) := by decide +kernel -theorem triangle_complete_185 : ∀ c : Fin 103, - (edge 185).2 < c → SeedEncoding.indexedAdj (edge 185).1 c → - SeedEncoding.indexedAdj (edge 185).2 c → - triangle (triangleIndex 185 c) = ((edge 185).1,(edge 185).2,c) := by decide +kernel -theorem triangle_complete_186 : ∀ c : Fin 103, - (edge 186).2 < c → SeedEncoding.indexedAdj (edge 186).1 c → - SeedEncoding.indexedAdj (edge 186).2 c → - triangle (triangleIndex 186 c) = ((edge 186).1,(edge 186).2,c) := by decide +kernel -theorem triangle_complete_187 : ∀ c : Fin 103, - (edge 187).2 < c → SeedEncoding.indexedAdj (edge 187).1 c → - SeedEncoding.indexedAdj (edge 187).2 c → - triangle (triangleIndex 187 c) = ((edge 187).1,(edge 187).2,c) := by decide +kernel -theorem triangle_complete_188 : ∀ c : Fin 103, - (edge 188).2 < c → SeedEncoding.indexedAdj (edge 188).1 c → - SeedEncoding.indexedAdj (edge 188).2 c → - triangle (triangleIndex 188 c) = ((edge 188).1,(edge 188).2,c) := by decide +kernel -theorem triangle_complete_189 : ∀ c : Fin 103, - (edge 189).2 < c → SeedEncoding.indexedAdj (edge 189).1 c → - SeedEncoding.indexedAdj (edge 189).2 c → - triangle (triangleIndex 189 c) = ((edge 189).1,(edge 189).2,c) := by decide +kernel -theorem triangle_complete_190 : ∀ c : Fin 103, - (edge 190).2 < c → SeedEncoding.indexedAdj (edge 190).1 c → - SeedEncoding.indexedAdj (edge 190).2 c → - triangle (triangleIndex 190 c) = ((edge 190).1,(edge 190).2,c) := by decide +kernel -theorem triangle_complete_191 : ∀ c : Fin 103, - (edge 191).2 < c → SeedEncoding.indexedAdj (edge 191).1 c → - SeedEncoding.indexedAdj (edge 191).2 c → - triangle (triangleIndex 191 c) = ((edge 191).1,(edge 191).2,c) := by decide +kernel -theorem triangle_complete_192 : ∀ c : Fin 103, - (edge 192).2 < c → SeedEncoding.indexedAdj (edge 192).1 c → - SeedEncoding.indexedAdj (edge 192).2 c → - triangle (triangleIndex 192 c) = ((edge 192).1,(edge 192).2,c) := by decide +kernel -theorem triangle_complete_193 : ∀ c : Fin 103, - (edge 193).2 < c → SeedEncoding.indexedAdj (edge 193).1 c → - SeedEncoding.indexedAdj (edge 193).2 c → - triangle (triangleIndex 193 c) = ((edge 193).1,(edge 193).2,c) := by decide +kernel -theorem triangle_complete_194 : ∀ c : Fin 103, - (edge 194).2 < c → SeedEncoding.indexedAdj (edge 194).1 c → - SeedEncoding.indexedAdj (edge 194).2 c → - triangle (triangleIndex 194 c) = ((edge 194).1,(edge 194).2,c) := by decide +kernel -theorem triangle_complete_195 : ∀ c : Fin 103, - (edge 195).2 < c → SeedEncoding.indexedAdj (edge 195).1 c → - SeedEncoding.indexedAdj (edge 195).2 c → - triangle (triangleIndex 195 c) = ((edge 195).1,(edge 195).2,c) := by decide +kernel -theorem triangle_complete_196 : ∀ c : Fin 103, - (edge 196).2 < c → SeedEncoding.indexedAdj (edge 196).1 c → - SeedEncoding.indexedAdj (edge 196).2 c → - triangle (triangleIndex 196 c) = ((edge 196).1,(edge 196).2,c) := by decide +kernel -theorem triangle_complete_197 : ∀ c : Fin 103, - (edge 197).2 < c → SeedEncoding.indexedAdj (edge 197).1 c → - SeedEncoding.indexedAdj (edge 197).2 c → - triangle (triangleIndex 197 c) = ((edge 197).1,(edge 197).2,c) := by decide +kernel -theorem triangle_complete_198 : ∀ c : Fin 103, - (edge 198).2 < c → SeedEncoding.indexedAdj (edge 198).1 c → - SeedEncoding.indexedAdj (edge 198).2 c → - triangle (triangleIndex 198 c) = ((edge 198).1,(edge 198).2,c) := by decide +kernel -theorem triangle_complete_199 : ∀ c : Fin 103, - (edge 199).2 < c → SeedEncoding.indexedAdj (edge 199).1 c → - SeedEncoding.indexedAdj (edge 199).2 c → - triangle (triangleIndex 199 c) = ((edge 199).1,(edge 199).2,c) := by decide +kernel -theorem triangle_complete_200 : ∀ c : Fin 103, - (edge 200).2 < c → SeedEncoding.indexedAdj (edge 200).1 c → - SeedEncoding.indexedAdj (edge 200).2 c → - triangle (triangleIndex 200 c) = ((edge 200).1,(edge 200).2,c) := by decide +kernel -theorem triangle_complete_201 : ∀ c : Fin 103, - (edge 201).2 < c → SeedEncoding.indexedAdj (edge 201).1 c → - SeedEncoding.indexedAdj (edge 201).2 c → - triangle (triangleIndex 201 c) = ((edge 201).1,(edge 201).2,c) := by decide +kernel -theorem triangle_complete_202 : ∀ c : Fin 103, - (edge 202).2 < c → SeedEncoding.indexedAdj (edge 202).1 c → - SeedEncoding.indexedAdj (edge 202).2 c → - triangle (triangleIndex 202 c) = ((edge 202).1,(edge 202).2,c) := by decide +kernel -theorem triangle_complete_203 : ∀ c : Fin 103, - (edge 203).2 < c → SeedEncoding.indexedAdj (edge 203).1 c → - SeedEncoding.indexedAdj (edge 203).2 c → - triangle (triangleIndex 203 c) = ((edge 203).1,(edge 203).2,c) := by decide +kernel -theorem triangle_complete_204 : ∀ c : Fin 103, - (edge 204).2 < c → SeedEncoding.indexedAdj (edge 204).1 c → - SeedEncoding.indexedAdj (edge 204).2 c → - triangle (triangleIndex 204 c) = ((edge 204).1,(edge 204).2,c) := by decide +kernel -theorem triangle_complete_205 : ∀ c : Fin 103, - (edge 205).2 < c → SeedEncoding.indexedAdj (edge 205).1 c → - SeedEncoding.indexedAdj (edge 205).2 c → - triangle (triangleIndex 205 c) = ((edge 205).1,(edge 205).2,c) := by decide +kernel -theorem triangle_complete_206 : ∀ c : Fin 103, - (edge 206).2 < c → SeedEncoding.indexedAdj (edge 206).1 c → - SeedEncoding.indexedAdj (edge 206).2 c → - triangle (triangleIndex 206 c) = ((edge 206).1,(edge 206).2,c) := by decide +kernel -theorem triangle_complete_207 : ∀ c : Fin 103, - (edge 207).2 < c → SeedEncoding.indexedAdj (edge 207).1 c → - SeedEncoding.indexedAdj (edge 207).2 c → - triangle (triangleIndex 207 c) = ((edge 207).1,(edge 207).2,c) := by decide +kernel -theorem triangle_complete_208 : ∀ c : Fin 103, - (edge 208).2 < c → SeedEncoding.indexedAdj (edge 208).1 c → - SeedEncoding.indexedAdj (edge 208).2 c → - triangle (triangleIndex 208 c) = ((edge 208).1,(edge 208).2,c) := by decide +kernel -theorem triangle_complete_209 : ∀ c : Fin 103, - (edge 209).2 < c → SeedEncoding.indexedAdj (edge 209).1 c → - SeedEncoding.indexedAdj (edge 209).2 c → - triangle (triangleIndex 209 c) = ((edge 209).1,(edge 209).2,c) := by decide +kernel -theorem triangle_complete_210 : ∀ c : Fin 103, - (edge 210).2 < c → SeedEncoding.indexedAdj (edge 210).1 c → - SeedEncoding.indexedAdj (edge 210).2 c → - triangle (triangleIndex 210 c) = ((edge 210).1,(edge 210).2,c) := by decide +kernel -theorem triangle_complete_211 : ∀ c : Fin 103, - (edge 211).2 < c → SeedEncoding.indexedAdj (edge 211).1 c → - SeedEncoding.indexedAdj (edge 211).2 c → - triangle (triangleIndex 211 c) = ((edge 211).1,(edge 211).2,c) := by decide +kernel -theorem triangle_complete_212 : ∀ c : Fin 103, - (edge 212).2 < c → SeedEncoding.indexedAdj (edge 212).1 c → - SeedEncoding.indexedAdj (edge 212).2 c → - triangle (triangleIndex 212 c) = ((edge 212).1,(edge 212).2,c) := by decide +kernel -theorem triangle_complete_213 : ∀ c : Fin 103, - (edge 213).2 < c → SeedEncoding.indexedAdj (edge 213).1 c → - SeedEncoding.indexedAdj (edge 213).2 c → - triangle (triangleIndex 213 c) = ((edge 213).1,(edge 213).2,c) := by decide +kernel -theorem triangle_complete_214 : ∀ c : Fin 103, - (edge 214).2 < c → SeedEncoding.indexedAdj (edge 214).1 c → - SeedEncoding.indexedAdj (edge 214).2 c → - triangle (triangleIndex 214 c) = ((edge 214).1,(edge 214).2,c) := by decide +kernel -theorem triangle_complete_215 : ∀ c : Fin 103, - (edge 215).2 < c → SeedEncoding.indexedAdj (edge 215).1 c → - SeedEncoding.indexedAdj (edge 215).2 c → - triangle (triangleIndex 215 c) = ((edge 215).1,(edge 215).2,c) := by decide +kernel -theorem triangle_complete_216 : ∀ c : Fin 103, - (edge 216).2 < c → SeedEncoding.indexedAdj (edge 216).1 c → - SeedEncoding.indexedAdj (edge 216).2 c → - triangle (triangleIndex 216 c) = ((edge 216).1,(edge 216).2,c) := by decide +kernel -theorem triangle_complete_217 : ∀ c : Fin 103, - (edge 217).2 < c → SeedEncoding.indexedAdj (edge 217).1 c → - SeedEncoding.indexedAdj (edge 217).2 c → - triangle (triangleIndex 217 c) = ((edge 217).1,(edge 217).2,c) := by decide +kernel -theorem triangle_complete_218 : ∀ c : Fin 103, - (edge 218).2 < c → SeedEncoding.indexedAdj (edge 218).1 c → - SeedEncoding.indexedAdj (edge 218).2 c → - triangle (triangleIndex 218 c) = ((edge 218).1,(edge 218).2,c) := by decide +kernel -theorem triangle_complete_219 : ∀ c : Fin 103, - (edge 219).2 < c → SeedEncoding.indexedAdj (edge 219).1 c → - SeedEncoding.indexedAdj (edge 219).2 c → - triangle (triangleIndex 219 c) = ((edge 219).1,(edge 219).2,c) := by decide +kernel -theorem triangle_complete_220 : ∀ c : Fin 103, - (edge 220).2 < c → SeedEncoding.indexedAdj (edge 220).1 c → - SeedEncoding.indexedAdj (edge 220).2 c → - triangle (triangleIndex 220 c) = ((edge 220).1,(edge 220).2,c) := by decide +kernel -theorem triangle_complete_221 : ∀ c : Fin 103, - (edge 221).2 < c → SeedEncoding.indexedAdj (edge 221).1 c → - SeedEncoding.indexedAdj (edge 221).2 c → - triangle (triangleIndex 221 c) = ((edge 221).1,(edge 221).2,c) := by decide +kernel -theorem triangle_complete_222 : ∀ c : Fin 103, - (edge 222).2 < c → SeedEncoding.indexedAdj (edge 222).1 c → - SeedEncoding.indexedAdj (edge 222).2 c → - triangle (triangleIndex 222 c) = ((edge 222).1,(edge 222).2,c) := by decide +kernel -theorem triangle_complete_223 : ∀ c : Fin 103, - (edge 223).2 < c → SeedEncoding.indexedAdj (edge 223).1 c → - SeedEncoding.indexedAdj (edge 223).2 c → - triangle (triangleIndex 223 c) = ((edge 223).1,(edge 223).2,c) := by decide +kernel -theorem triangle_complete_224 : ∀ c : Fin 103, - (edge 224).2 < c → SeedEncoding.indexedAdj (edge 224).1 c → - SeedEncoding.indexedAdj (edge 224).2 c → - triangle (triangleIndex 224 c) = ((edge 224).1,(edge 224).2,c) := by decide +kernel -theorem triangle_complete_225 : ∀ c : Fin 103, - (edge 225).2 < c → SeedEncoding.indexedAdj (edge 225).1 c → - SeedEncoding.indexedAdj (edge 225).2 c → - triangle (triangleIndex 225 c) = ((edge 225).1,(edge 225).2,c) := by decide +kernel -theorem triangle_complete_226 : ∀ c : Fin 103, - (edge 226).2 < c → SeedEncoding.indexedAdj (edge 226).1 c → - SeedEncoding.indexedAdj (edge 226).2 c → - triangle (triangleIndex 226 c) = ((edge 226).1,(edge 226).2,c) := by decide +kernel -theorem triangle_complete_227 : ∀ c : Fin 103, - (edge 227).2 < c → SeedEncoding.indexedAdj (edge 227).1 c → - SeedEncoding.indexedAdj (edge 227).2 c → - triangle (triangleIndex 227 c) = ((edge 227).1,(edge 227).2,c) := by decide +kernel -theorem triangle_complete_228 : ∀ c : Fin 103, - (edge 228).2 < c → SeedEncoding.indexedAdj (edge 228).1 c → - SeedEncoding.indexedAdj (edge 228).2 c → - triangle (triangleIndex 228 c) = ((edge 228).1,(edge 228).2,c) := by decide +kernel -theorem triangle_complete_229 : ∀ c : Fin 103, - (edge 229).2 < c → SeedEncoding.indexedAdj (edge 229).1 c → - SeedEncoding.indexedAdj (edge 229).2 c → - triangle (triangleIndex 229 c) = ((edge 229).1,(edge 229).2,c) := by decide +kernel -theorem triangle_complete_230 : ∀ c : Fin 103, - (edge 230).2 < c → SeedEncoding.indexedAdj (edge 230).1 c → - SeedEncoding.indexedAdj (edge 230).2 c → - triangle (triangleIndex 230 c) = ((edge 230).1,(edge 230).2,c) := by decide +kernel -theorem triangle_complete_231 : ∀ c : Fin 103, - (edge 231).2 < c → SeedEncoding.indexedAdj (edge 231).1 c → - SeedEncoding.indexedAdj (edge 231).2 c → - triangle (triangleIndex 231 c) = ((edge 231).1,(edge 231).2,c) := by decide +kernel -theorem triangle_complete_232 : ∀ c : Fin 103, - (edge 232).2 < c → SeedEncoding.indexedAdj (edge 232).1 c → - SeedEncoding.indexedAdj (edge 232).2 c → - triangle (triangleIndex 232 c) = ((edge 232).1,(edge 232).2,c) := by decide +kernel -theorem triangle_complete_233 : ∀ c : Fin 103, - (edge 233).2 < c → SeedEncoding.indexedAdj (edge 233).1 c → - SeedEncoding.indexedAdj (edge 233).2 c → - triangle (triangleIndex 233 c) = ((edge 233).1,(edge 233).2,c) := by decide +kernel -theorem triangle_complete_234 : ∀ c : Fin 103, - (edge 234).2 < c → SeedEncoding.indexedAdj (edge 234).1 c → - SeedEncoding.indexedAdj (edge 234).2 c → - triangle (triangleIndex 234 c) = ((edge 234).1,(edge 234).2,c) := by decide +kernel -theorem triangle_complete_235 : ∀ c : Fin 103, - (edge 235).2 < c → SeedEncoding.indexedAdj (edge 235).1 c → - SeedEncoding.indexedAdj (edge 235).2 c → - triangle (triangleIndex 235 c) = ((edge 235).1,(edge 235).2,c) := by decide +kernel -theorem triangle_complete_236 : ∀ c : Fin 103, - (edge 236).2 < c → SeedEncoding.indexedAdj (edge 236).1 c → - SeedEncoding.indexedAdj (edge 236).2 c → - triangle (triangleIndex 236 c) = ((edge 236).1,(edge 236).2,c) := by decide +kernel -theorem triangle_complete_237 : ∀ c : Fin 103, - (edge 237).2 < c → SeedEncoding.indexedAdj (edge 237).1 c → - SeedEncoding.indexedAdj (edge 237).2 c → - triangle (triangleIndex 237 c) = ((edge 237).1,(edge 237).2,c) := by decide +kernel -theorem triangle_complete_238 : ∀ c : Fin 103, - (edge 238).2 < c → SeedEncoding.indexedAdj (edge 238).1 c → - SeedEncoding.indexedAdj (edge 238).2 c → - triangle (triangleIndex 238 c) = ((edge 238).1,(edge 238).2,c) := by decide +kernel -theorem triangle_complete_239 : ∀ c : Fin 103, - (edge 239).2 < c → SeedEncoding.indexedAdj (edge 239).1 c → - SeedEncoding.indexedAdj (edge 239).2 c → - triangle (triangleIndex 239 c) = ((edge 239).1,(edge 239).2,c) := by decide +kernel -theorem triangle_complete_240 : ∀ c : Fin 103, - (edge 240).2 < c → SeedEncoding.indexedAdj (edge 240).1 c → - SeedEncoding.indexedAdj (edge 240).2 c → - triangle (triangleIndex 240 c) = ((edge 240).1,(edge 240).2,c) := by decide +kernel -theorem triangle_complete_241 : ∀ c : Fin 103, - (edge 241).2 < c → SeedEncoding.indexedAdj (edge 241).1 c → - SeedEncoding.indexedAdj (edge 241).2 c → - triangle (triangleIndex 241 c) = ((edge 241).1,(edge 241).2,c) := by decide +kernel -theorem triangle_complete_242 : ∀ c : Fin 103, - (edge 242).2 < c → SeedEncoding.indexedAdj (edge 242).1 c → - SeedEncoding.indexedAdj (edge 242).2 c → - triangle (triangleIndex 242 c) = ((edge 242).1,(edge 242).2,c) := by decide +kernel -theorem triangle_complete_243 : ∀ c : Fin 103, - (edge 243).2 < c → SeedEncoding.indexedAdj (edge 243).1 c → - SeedEncoding.indexedAdj (edge 243).2 c → - triangle (triangleIndex 243 c) = ((edge 243).1,(edge 243).2,c) := by decide +kernel -theorem triangle_complete_244 : ∀ c : Fin 103, - (edge 244).2 < c → SeedEncoding.indexedAdj (edge 244).1 c → - SeedEncoding.indexedAdj (edge 244).2 c → - triangle (triangleIndex 244 c) = ((edge 244).1,(edge 244).2,c) := by decide +kernel -theorem triangle_complete_245 : ∀ c : Fin 103, - (edge 245).2 < c → SeedEncoding.indexedAdj (edge 245).1 c → - SeedEncoding.indexedAdj (edge 245).2 c → - triangle (triangleIndex 245 c) = ((edge 245).1,(edge 245).2,c) := by decide +kernel -theorem triangle_complete_246 : ∀ c : Fin 103, - (edge 246).2 < c → SeedEncoding.indexedAdj (edge 246).1 c → - SeedEncoding.indexedAdj (edge 246).2 c → - triangle (triangleIndex 246 c) = ((edge 246).1,(edge 246).2,c) := by decide +kernel -theorem triangle_complete_247 : ∀ c : Fin 103, - (edge 247).2 < c → SeedEncoding.indexedAdj (edge 247).1 c → - SeedEncoding.indexedAdj (edge 247).2 c → - triangle (triangleIndex 247 c) = ((edge 247).1,(edge 247).2,c) := by decide +kernel -theorem triangle_complete_248 : ∀ c : Fin 103, - (edge 248).2 < c → SeedEncoding.indexedAdj (edge 248).1 c → - SeedEncoding.indexedAdj (edge 248).2 c → - triangle (triangleIndex 248 c) = ((edge 248).1,(edge 248).2,c) := by decide +kernel -theorem triangle_complete_249 : ∀ c : Fin 103, - (edge 249).2 < c → SeedEncoding.indexedAdj (edge 249).1 c → - SeedEncoding.indexedAdj (edge 249).2 c → - triangle (triangleIndex 249 c) = ((edge 249).1,(edge 249).2,c) := by decide +kernel -theorem triangle_complete_250 : ∀ c : Fin 103, - (edge 250).2 < c → SeedEncoding.indexedAdj (edge 250).1 c → - SeedEncoding.indexedAdj (edge 250).2 c → - triangle (triangleIndex 250 c) = ((edge 250).1,(edge 250).2,c) := by decide +kernel -theorem triangle_complete_251 : ∀ c : Fin 103, - (edge 251).2 < c → SeedEncoding.indexedAdj (edge 251).1 c → - SeedEncoding.indexedAdj (edge 251).2 c → - triangle (triangleIndex 251 c) = ((edge 251).1,(edge 251).2,c) := by decide +kernel -theorem triangle_complete_252 : ∀ c : Fin 103, - (edge 252).2 < c → SeedEncoding.indexedAdj (edge 252).1 c → - SeedEncoding.indexedAdj (edge 252).2 c → - triangle (triangleIndex 252 c) = ((edge 252).1,(edge 252).2,c) := by decide +kernel -theorem triangle_complete_253 : ∀ c : Fin 103, - (edge 253).2 < c → SeedEncoding.indexedAdj (edge 253).1 c → - SeedEncoding.indexedAdj (edge 253).2 c → - triangle (triangleIndex 253 c) = ((edge 253).1,(edge 253).2,c) := by decide +kernel -theorem triangle_complete_254 : ∀ c : Fin 103, - (edge 254).2 < c → SeedEncoding.indexedAdj (edge 254).1 c → - SeedEncoding.indexedAdj (edge 254).2 c → - triangle (triangleIndex 254 c) = ((edge 254).1,(edge 254).2,c) := by decide +kernel -theorem triangle_complete_255 : ∀ c : Fin 103, - (edge 255).2 < c → SeedEncoding.indexedAdj (edge 255).1 c → - SeedEncoding.indexedAdj (edge 255).2 c → - triangle (triangleIndex 255 c) = ((edge 255).1,(edge 255).2,c) := by decide +kernel -theorem triangle_complete_256 : ∀ c : Fin 103, - (edge 256).2 < c → SeedEncoding.indexedAdj (edge 256).1 c → - SeedEncoding.indexedAdj (edge 256).2 c → - triangle (triangleIndex 256 c) = ((edge 256).1,(edge 256).2,c) := by decide +kernel -theorem triangle_complete_257 : ∀ c : Fin 103, - (edge 257).2 < c → SeedEncoding.indexedAdj (edge 257).1 c → - SeedEncoding.indexedAdj (edge 257).2 c → - triangle (triangleIndex 257 c) = ((edge 257).1,(edge 257).2,c) := by decide +kernel -theorem triangle_complete_258 : ∀ c : Fin 103, - (edge 258).2 < c → SeedEncoding.indexedAdj (edge 258).1 c → - SeedEncoding.indexedAdj (edge 258).2 c → - triangle (triangleIndex 258 c) = ((edge 258).1,(edge 258).2,c) := by decide +kernel -theorem triangle_complete_259 : ∀ c : Fin 103, - (edge 259).2 < c → SeedEncoding.indexedAdj (edge 259).1 c → - SeedEncoding.indexedAdj (edge 259).2 c → - triangle (triangleIndex 259 c) = ((edge 259).1,(edge 259).2,c) := by decide +kernel -theorem triangle_complete_260 : ∀ c : Fin 103, - (edge 260).2 < c → SeedEncoding.indexedAdj (edge 260).1 c → - SeedEncoding.indexedAdj (edge 260).2 c → - triangle (triangleIndex 260 c) = ((edge 260).1,(edge 260).2,c) := by decide +kernel -theorem triangle_complete_261 : ∀ c : Fin 103, - (edge 261).2 < c → SeedEncoding.indexedAdj (edge 261).1 c → - SeedEncoding.indexedAdj (edge 261).2 c → - triangle (triangleIndex 261 c) = ((edge 261).1,(edge 261).2,c) := by decide +kernel -theorem triangle_complete_262 : ∀ c : Fin 103, - (edge 262).2 < c → SeedEncoding.indexedAdj (edge 262).1 c → - SeedEncoding.indexedAdj (edge 262).2 c → - triangle (triangleIndex 262 c) = ((edge 262).1,(edge 262).2,c) := by decide +kernel -theorem triangle_complete_263 : ∀ c : Fin 103, - (edge 263).2 < c → SeedEncoding.indexedAdj (edge 263).1 c → - SeedEncoding.indexedAdj (edge 263).2 c → - triangle (triangleIndex 263 c) = ((edge 263).1,(edge 263).2,c) := by decide +kernel -theorem triangle_complete_264 : ∀ c : Fin 103, - (edge 264).2 < c → SeedEncoding.indexedAdj (edge 264).1 c → - SeedEncoding.indexedAdj (edge 264).2 c → - triangle (triangleIndex 264 c) = ((edge 264).1,(edge 264).2,c) := by decide +kernel -theorem triangle_complete_265 : ∀ c : Fin 103, - (edge 265).2 < c → SeedEncoding.indexedAdj (edge 265).1 c → - SeedEncoding.indexedAdj (edge 265).2 c → - triangle (triangleIndex 265 c) = ((edge 265).1,(edge 265).2,c) := by decide +kernel -theorem triangle_complete_266 : ∀ c : Fin 103, - (edge 266).2 < c → SeedEncoding.indexedAdj (edge 266).1 c → - SeedEncoding.indexedAdj (edge 266).2 c → - triangle (triangleIndex 266 c) = ((edge 266).1,(edge 266).2,c) := by decide +kernel -theorem triangle_complete_267 : ∀ c : Fin 103, - (edge 267).2 < c → SeedEncoding.indexedAdj (edge 267).1 c → - SeedEncoding.indexedAdj (edge 267).2 c → - triangle (triangleIndex 267 c) = ((edge 267).1,(edge 267).2,c) := by decide +kernel -theorem triangle_complete_268 : ∀ c : Fin 103, - (edge 268).2 < c → SeedEncoding.indexedAdj (edge 268).1 c → - SeedEncoding.indexedAdj (edge 268).2 c → - triangle (triangleIndex 268 c) = ((edge 268).1,(edge 268).2,c) := by decide +kernel -theorem triangle_complete_269 : ∀ c : Fin 103, - (edge 269).2 < c → SeedEncoding.indexedAdj (edge 269).1 c → - SeedEncoding.indexedAdj (edge 269).2 c → - triangle (triangleIndex 269 c) = ((edge 269).1,(edge 269).2,c) := by decide +kernel -theorem triangle_complete_270 : ∀ c : Fin 103, - (edge 270).2 < c → SeedEncoding.indexedAdj (edge 270).1 c → - SeedEncoding.indexedAdj (edge 270).2 c → - triangle (triangleIndex 270 c) = ((edge 270).1,(edge 270).2,c) := by decide +kernel -theorem triangle_complete_271 : ∀ c : Fin 103, - (edge 271).2 < c → SeedEncoding.indexedAdj (edge 271).1 c → - SeedEncoding.indexedAdj (edge 271).2 c → - triangle (triangleIndex 271 c) = ((edge 271).1,(edge 271).2,c) := by decide +kernel -theorem triangle_complete_272 : ∀ c : Fin 103, - (edge 272).2 < c → SeedEncoding.indexedAdj (edge 272).1 c → - SeedEncoding.indexedAdj (edge 272).2 c → - triangle (triangleIndex 272 c) = ((edge 272).1,(edge 272).2,c) := by decide +kernel -theorem triangle_complete_273 : ∀ c : Fin 103, - (edge 273).2 < c → SeedEncoding.indexedAdj (edge 273).1 c → - SeedEncoding.indexedAdj (edge 273).2 c → - triangle (triangleIndex 273 c) = ((edge 273).1,(edge 273).2,c) := by decide +kernel -theorem triangle_complete_274 : ∀ c : Fin 103, - (edge 274).2 < c → SeedEncoding.indexedAdj (edge 274).1 c → - SeedEncoding.indexedAdj (edge 274).2 c → - triangle (triangleIndex 274 c) = ((edge 274).1,(edge 274).2,c) := by decide +kernel -theorem triangle_complete_275 : ∀ c : Fin 103, - (edge 275).2 < c → SeedEncoding.indexedAdj (edge 275).1 c → - SeedEncoding.indexedAdj (edge 275).2 c → - triangle (triangleIndex 275 c) = ((edge 275).1,(edge 275).2,c) := by decide +kernel -theorem triangle_complete_276 : ∀ c : Fin 103, - (edge 276).2 < c → SeedEncoding.indexedAdj (edge 276).1 c → - SeedEncoding.indexedAdj (edge 276).2 c → - triangle (triangleIndex 276 c) = ((edge 276).1,(edge 276).2,c) := by decide +kernel -theorem triangle_complete_277 : ∀ c : Fin 103, - (edge 277).2 < c → SeedEncoding.indexedAdj (edge 277).1 c → - SeedEncoding.indexedAdj (edge 277).2 c → - triangle (triangleIndex 277 c) = ((edge 277).1,(edge 277).2,c) := by decide +kernel -theorem triangle_complete_278 : ∀ c : Fin 103, - (edge 278).2 < c → SeedEncoding.indexedAdj (edge 278).1 c → - SeedEncoding.indexedAdj (edge 278).2 c → - triangle (triangleIndex 278 c) = ((edge 278).1,(edge 278).2,c) := by decide +kernel -theorem triangle_complete_279 : ∀ c : Fin 103, - (edge 279).2 < c → SeedEncoding.indexedAdj (edge 279).1 c → - SeedEncoding.indexedAdj (edge 279).2 c → - triangle (triangleIndex 279 c) = ((edge 279).1,(edge 279).2,c) := by decide +kernel -theorem triangle_complete_280 : ∀ c : Fin 103, - (edge 280).2 < c → SeedEncoding.indexedAdj (edge 280).1 c → - SeedEncoding.indexedAdj (edge 280).2 c → - triangle (triangleIndex 280 c) = ((edge 280).1,(edge 280).2,c) := by decide +kernel -theorem triangle_complete_281 : ∀ c : Fin 103, - (edge 281).2 < c → SeedEncoding.indexedAdj (edge 281).1 c → - SeedEncoding.indexedAdj (edge 281).2 c → - triangle (triangleIndex 281 c) = ((edge 281).1,(edge 281).2,c) := by decide +kernel -theorem triangle_complete_282 : ∀ c : Fin 103, - (edge 282).2 < c → SeedEncoding.indexedAdj (edge 282).1 c → - SeedEncoding.indexedAdj (edge 282).2 c → - triangle (triangleIndex 282 c) = ((edge 282).1,(edge 282).2,c) := by decide +kernel -theorem triangle_complete_283 : ∀ c : Fin 103, - (edge 283).2 < c → SeedEncoding.indexedAdj (edge 283).1 c → - SeedEncoding.indexedAdj (edge 283).2 c → - triangle (triangleIndex 283 c) = ((edge 283).1,(edge 283).2,c) := by decide +kernel -theorem triangle_complete_284 : ∀ c : Fin 103, - (edge 284).2 < c → SeedEncoding.indexedAdj (edge 284).1 c → - SeedEncoding.indexedAdj (edge 284).2 c → - triangle (triangleIndex 284 c) = ((edge 284).1,(edge 284).2,c) := by decide +kernel -theorem triangle_complete_285 : ∀ c : Fin 103, - (edge 285).2 < c → SeedEncoding.indexedAdj (edge 285).1 c → - SeedEncoding.indexedAdj (edge 285).2 c → - triangle (triangleIndex 285 c) = ((edge 285).1,(edge 285).2,c) := by decide +kernel -theorem triangle_complete_286 : ∀ c : Fin 103, - (edge 286).2 < c → SeedEncoding.indexedAdj (edge 286).1 c → - SeedEncoding.indexedAdj (edge 286).2 c → - triangle (triangleIndex 286 c) = ((edge 286).1,(edge 286).2,c) := by decide +kernel -theorem triangle_complete_287 : ∀ c : Fin 103, - (edge 287).2 < c → SeedEncoding.indexedAdj (edge 287).1 c → - SeedEncoding.indexedAdj (edge 287).2 c → - triangle (triangleIndex 287 c) = ((edge 287).1,(edge 287).2,c) := by decide +kernel -theorem triangle_complete_288 : ∀ c : Fin 103, - (edge 288).2 < c → SeedEncoding.indexedAdj (edge 288).1 c → - SeedEncoding.indexedAdj (edge 288).2 c → - triangle (triangleIndex 288 c) = ((edge 288).1,(edge 288).2,c) := by decide +kernel -theorem triangle_complete_289 : ∀ c : Fin 103, - (edge 289).2 < c → SeedEncoding.indexedAdj (edge 289).1 c → - SeedEncoding.indexedAdj (edge 289).2 c → - triangle (triangleIndex 289 c) = ((edge 289).1,(edge 289).2,c) := by decide +kernel -theorem triangle_complete_290 : ∀ c : Fin 103, - (edge 290).2 < c → SeedEncoding.indexedAdj (edge 290).1 c → - SeedEncoding.indexedAdj (edge 290).2 c → - triangle (triangleIndex 290 c) = ((edge 290).1,(edge 290).2,c) := by decide +kernel -theorem triangle_complete_291 : ∀ c : Fin 103, - (edge 291).2 < c → SeedEncoding.indexedAdj (edge 291).1 c → - SeedEncoding.indexedAdj (edge 291).2 c → - triangle (triangleIndex 291 c) = ((edge 291).1,(edge 291).2,c) := by decide +kernel -theorem triangle_complete_292 : ∀ c : Fin 103, - (edge 292).2 < c → SeedEncoding.indexedAdj (edge 292).1 c → - SeedEncoding.indexedAdj (edge 292).2 c → - triangle (triangleIndex 292 c) = ((edge 292).1,(edge 292).2,c) := by decide +kernel -theorem triangle_complete_293 : ∀ c : Fin 103, - (edge 293).2 < c → SeedEncoding.indexedAdj (edge 293).1 c → - SeedEncoding.indexedAdj (edge 293).2 c → - triangle (triangleIndex 293 c) = ((edge 293).1,(edge 293).2,c) := by decide +kernel -theorem triangle_complete_294 : ∀ c : Fin 103, - (edge 294).2 < c → SeedEncoding.indexedAdj (edge 294).1 c → - SeedEncoding.indexedAdj (edge 294).2 c → - triangle (triangleIndex 294 c) = ((edge 294).1,(edge 294).2,c) := by decide +kernel -theorem triangle_complete_295 : ∀ c : Fin 103, - (edge 295).2 < c → SeedEncoding.indexedAdj (edge 295).1 c → - SeedEncoding.indexedAdj (edge 295).2 c → - triangle (triangleIndex 295 c) = ((edge 295).1,(edge 295).2,c) := by decide +kernel -theorem triangle_complete_296 : ∀ c : Fin 103, - (edge 296).2 < c → SeedEncoding.indexedAdj (edge 296).1 c → - SeedEncoding.indexedAdj (edge 296).2 c → - triangle (triangleIndex 296 c) = ((edge 296).1,(edge 296).2,c) := by decide +kernel -theorem triangle_complete_297 : ∀ c : Fin 103, - (edge 297).2 < c → SeedEncoding.indexedAdj (edge 297).1 c → - SeedEncoding.indexedAdj (edge 297).2 c → - triangle (triangleIndex 297 c) = ((edge 297).1,(edge 297).2,c) := by decide +kernel -theorem triangle_complete_298 : ∀ c : Fin 103, - (edge 298).2 < c → SeedEncoding.indexedAdj (edge 298).1 c → - SeedEncoding.indexedAdj (edge 298).2 c → - triangle (triangleIndex 298 c) = ((edge 298).1,(edge 298).2,c) := by decide +kernel -theorem triangle_complete_299 : ∀ c : Fin 103, - (edge 299).2 < c → SeedEncoding.indexedAdj (edge 299).1 c → - SeedEncoding.indexedAdj (edge 299).2 c → - triangle (triangleIndex 299 c) = ((edge 299).1,(edge 299).2,c) := by decide +kernel -theorem triangle_complete_300 : ∀ c : Fin 103, - (edge 300).2 < c → SeedEncoding.indexedAdj (edge 300).1 c → - SeedEncoding.indexedAdj (edge 300).2 c → - triangle (triangleIndex 300 c) = ((edge 300).1,(edge 300).2,c) := by decide +kernel -theorem triangle_complete_301 : ∀ c : Fin 103, - (edge 301).2 < c → SeedEncoding.indexedAdj (edge 301).1 c → - SeedEncoding.indexedAdj (edge 301).2 c → - triangle (triangleIndex 301 c) = ((edge 301).1,(edge 301).2,c) := by decide +kernel -theorem triangle_complete_302 : ∀ c : Fin 103, - (edge 302).2 < c → SeedEncoding.indexedAdj (edge 302).1 c → - SeedEncoding.indexedAdj (edge 302).2 c → - triangle (triangleIndex 302 c) = ((edge 302).1,(edge 302).2,c) := by decide +kernel -theorem triangle_complete_303 : ∀ c : Fin 103, - (edge 303).2 < c → SeedEncoding.indexedAdj (edge 303).1 c → - SeedEncoding.indexedAdj (edge 303).2 c → - triangle (triangleIndex 303 c) = ((edge 303).1,(edge 303).2,c) := by decide +kernel -theorem triangle_complete_304 : ∀ c : Fin 103, - (edge 304).2 < c → SeedEncoding.indexedAdj (edge 304).1 c → - SeedEncoding.indexedAdj (edge 304).2 c → - triangle (triangleIndex 304 c) = ((edge 304).1,(edge 304).2,c) := by decide +kernel -theorem triangle_complete_305 : ∀ c : Fin 103, - (edge 305).2 < c → SeedEncoding.indexedAdj (edge 305).1 c → - SeedEncoding.indexedAdj (edge 305).2 c → - triangle (triangleIndex 305 c) = ((edge 305).1,(edge 305).2,c) := by decide +kernel -theorem triangle_complete_306 : ∀ c : Fin 103, - (edge 306).2 < c → SeedEncoding.indexedAdj (edge 306).1 c → - SeedEncoding.indexedAdj (edge 306).2 c → - triangle (triangleIndex 306 c) = ((edge 306).1,(edge 306).2,c) := by decide +kernel -theorem triangle_complete_307 : ∀ c : Fin 103, - (edge 307).2 < c → SeedEncoding.indexedAdj (edge 307).1 c → - SeedEncoding.indexedAdj (edge 307).2 c → - triangle (triangleIndex 307 c) = ((edge 307).1,(edge 307).2,c) := by decide +kernel -theorem triangle_complete_308 : ∀ c : Fin 103, - (edge 308).2 < c → SeedEncoding.indexedAdj (edge 308).1 c → - SeedEncoding.indexedAdj (edge 308).2 c → - triangle (triangleIndex 308 c) = ((edge 308).1,(edge 308).2,c) := by decide +kernel -theorem triangle_complete_309 : ∀ c : Fin 103, - (edge 309).2 < c → SeedEncoding.indexedAdj (edge 309).1 c → - SeedEncoding.indexedAdj (edge 309).2 c → - triangle (triangleIndex 309 c) = ((edge 309).1,(edge 309).2,c) := by decide +kernel -theorem triangle_complete_310 : ∀ c : Fin 103, - (edge 310).2 < c → SeedEncoding.indexedAdj (edge 310).1 c → - SeedEncoding.indexedAdj (edge 310).2 c → - triangle (triangleIndex 310 c) = ((edge 310).1,(edge 310).2,c) := by decide +kernel -theorem triangle_complete_311 : ∀ c : Fin 103, - (edge 311).2 < c → SeedEncoding.indexedAdj (edge 311).1 c → - SeedEncoding.indexedAdj (edge 311).2 c → - triangle (triangleIndex 311 c) = ((edge 311).1,(edge 311).2,c) := by decide +kernel -theorem triangle_complete_312 : ∀ c : Fin 103, - (edge 312).2 < c → SeedEncoding.indexedAdj (edge 312).1 c → - SeedEncoding.indexedAdj (edge 312).2 c → - triangle (triangleIndex 312 c) = ((edge 312).1,(edge 312).2,c) := by decide +kernel -theorem triangle_complete_313 : ∀ c : Fin 103, - (edge 313).2 < c → SeedEncoding.indexedAdj (edge 313).1 c → - SeedEncoding.indexedAdj (edge 313).2 c → - triangle (triangleIndex 313 c) = ((edge 313).1,(edge 313).2,c) := by decide +kernel -theorem triangle_complete_314 : ∀ c : Fin 103, - (edge 314).2 < c → SeedEncoding.indexedAdj (edge 314).1 c → - SeedEncoding.indexedAdj (edge 314).2 c → - triangle (triangleIndex 314 c) = ((edge 314).1,(edge 314).2,c) := by decide +kernel -theorem triangle_complete_315 : ∀ c : Fin 103, - (edge 315).2 < c → SeedEncoding.indexedAdj (edge 315).1 c → - SeedEncoding.indexedAdj (edge 315).2 c → - triangle (triangleIndex 315 c) = ((edge 315).1,(edge 315).2,c) := by decide +kernel -theorem triangle_complete_316 : ∀ c : Fin 103, - (edge 316).2 < c → SeedEncoding.indexedAdj (edge 316).1 c → - SeedEncoding.indexedAdj (edge 316).2 c → - triangle (triangleIndex 316 c) = ((edge 316).1,(edge 316).2,c) := by decide +kernel -theorem triangle_complete_317 : ∀ c : Fin 103, - (edge 317).2 < c → SeedEncoding.indexedAdj (edge 317).1 c → - SeedEncoding.indexedAdj (edge 317).2 c → - triangle (triangleIndex 317 c) = ((edge 317).1,(edge 317).2,c) := by decide +kernel -theorem triangle_complete_318 : ∀ c : Fin 103, - (edge 318).2 < c → SeedEncoding.indexedAdj (edge 318).1 c → - SeedEncoding.indexedAdj (edge 318).2 c → - triangle (triangleIndex 318 c) = ((edge 318).1,(edge 318).2,c) := by decide +kernel -theorem triangle_complete_319 : ∀ c : Fin 103, - (edge 319).2 < c → SeedEncoding.indexedAdj (edge 319).1 c → - SeedEncoding.indexedAdj (edge 319).2 c → - triangle (triangleIndex 319 c) = ((edge 319).1,(edge 319).2,c) := by decide +kernel -theorem triangle_complete_320 : ∀ c : Fin 103, - (edge 320).2 < c → SeedEncoding.indexedAdj (edge 320).1 c → - SeedEncoding.indexedAdj (edge 320).2 c → - triangle (triangleIndex 320 c) = ((edge 320).1,(edge 320).2,c) := by decide +kernel -theorem triangle_complete_321 : ∀ c : Fin 103, - (edge 321).2 < c → SeedEncoding.indexedAdj (edge 321).1 c → - SeedEncoding.indexedAdj (edge 321).2 c → - triangle (triangleIndex 321 c) = ((edge 321).1,(edge 321).2,c) := by decide +kernel -theorem triangle_complete_322 : ∀ c : Fin 103, - (edge 322).2 < c → SeedEncoding.indexedAdj (edge 322).1 c → - SeedEncoding.indexedAdj (edge 322).2 c → - triangle (triangleIndex 322 c) = ((edge 322).1,(edge 322).2,c) := by decide +kernel -theorem triangle_complete_323 : ∀ c : Fin 103, - (edge 323).2 < c → SeedEncoding.indexedAdj (edge 323).1 c → - SeedEncoding.indexedAdj (edge 323).2 c → - triangle (triangleIndex 323 c) = ((edge 323).1,(edge 323).2,c) := by decide +kernel -theorem triangle_complete_324 : ∀ c : Fin 103, - (edge 324).2 < c → SeedEncoding.indexedAdj (edge 324).1 c → - SeedEncoding.indexedAdj (edge 324).2 c → - triangle (triangleIndex 324 c) = ((edge 324).1,(edge 324).2,c) := by decide +kernel -theorem triangle_complete_325 : ∀ c : Fin 103, - (edge 325).2 < c → SeedEncoding.indexedAdj (edge 325).1 c → - SeedEncoding.indexedAdj (edge 325).2 c → - triangle (triangleIndex 325 c) = ((edge 325).1,(edge 325).2,c) := by decide +kernel -theorem triangle_complete_326 : ∀ c : Fin 103, - (edge 326).2 < c → SeedEncoding.indexedAdj (edge 326).1 c → - SeedEncoding.indexedAdj (edge 326).2 c → - triangle (triangleIndex 326 c) = ((edge 326).1,(edge 326).2,c) := by decide +kernel -theorem triangle_complete_327 : ∀ c : Fin 103, - (edge 327).2 < c → SeedEncoding.indexedAdj (edge 327).1 c → - SeedEncoding.indexedAdj (edge 327).2 c → - triangle (triangleIndex 327 c) = ((edge 327).1,(edge 327).2,c) := by decide +kernel -theorem triangle_complete_328 : ∀ c : Fin 103, - (edge 328).2 < c → SeedEncoding.indexedAdj (edge 328).1 c → - SeedEncoding.indexedAdj (edge 328).2 c → - triangle (triangleIndex 328 c) = ((edge 328).1,(edge 328).2,c) := by decide +kernel -theorem triangle_complete_329 : ∀ c : Fin 103, - (edge 329).2 < c → SeedEncoding.indexedAdj (edge 329).1 c → - SeedEncoding.indexedAdj (edge 329).2 c → - triangle (triangleIndex 329 c) = ((edge 329).1,(edge 329).2,c) := by decide +kernel -theorem triangle_complete_330 : ∀ c : Fin 103, - (edge 330).2 < c → SeedEncoding.indexedAdj (edge 330).1 c → - SeedEncoding.indexedAdj (edge 330).2 c → - triangle (triangleIndex 330 c) = ((edge 330).1,(edge 330).2,c) := by decide +kernel -theorem triangle_complete_331 : ∀ c : Fin 103, - (edge 331).2 < c → SeedEncoding.indexedAdj (edge 331).1 c → - SeedEncoding.indexedAdj (edge 331).2 c → - triangle (triangleIndex 331 c) = ((edge 331).1,(edge 331).2,c) := by decide +kernel -theorem triangle_complete_332 : ∀ c : Fin 103, - (edge 332).2 < c → SeedEncoding.indexedAdj (edge 332).1 c → - SeedEncoding.indexedAdj (edge 332).2 c → - triangle (triangleIndex 332 c) = ((edge 332).1,(edge 332).2,c) := by decide +kernel -theorem triangle_complete_333 : ∀ c : Fin 103, - (edge 333).2 < c → SeedEncoding.indexedAdj (edge 333).1 c → - SeedEncoding.indexedAdj (edge 333).2 c → - triangle (triangleIndex 333 c) = ((edge 333).1,(edge 333).2,c) := by decide +kernel -theorem triangle_complete_334 : ∀ c : Fin 103, - (edge 334).2 < c → SeedEncoding.indexedAdj (edge 334).1 c → - SeedEncoding.indexedAdj (edge 334).2 c → - triangle (triangleIndex 334 c) = ((edge 334).1,(edge 334).2,c) := by decide +kernel -theorem triangle_complete_335 : ∀ c : Fin 103, - (edge 335).2 < c → SeedEncoding.indexedAdj (edge 335).1 c → - SeedEncoding.indexedAdj (edge 335).2 c → - triangle (triangleIndex 335 c) = ((edge 335).1,(edge 335).2,c) := by decide +kernel -theorem triangle_complete_336 : ∀ c : Fin 103, - (edge 336).2 < c → SeedEncoding.indexedAdj (edge 336).1 c → - SeedEncoding.indexedAdj (edge 336).2 c → - triangle (triangleIndex 336 c) = ((edge 336).1,(edge 336).2,c) := by decide +kernel -theorem triangle_complete_337 : ∀ c : Fin 103, - (edge 337).2 < c → SeedEncoding.indexedAdj (edge 337).1 c → - SeedEncoding.indexedAdj (edge 337).2 c → - triangle (triangleIndex 337 c) = ((edge 337).1,(edge 337).2,c) := by decide +kernel -theorem triangle_complete_338 : ∀ c : Fin 103, - (edge 338).2 < c → SeedEncoding.indexedAdj (edge 338).1 c → - SeedEncoding.indexedAdj (edge 338).2 c → - triangle (triangleIndex 338 c) = ((edge 338).1,(edge 338).2,c) := by decide +kernel -theorem triangle_complete_339 : ∀ c : Fin 103, - (edge 339).2 < c → SeedEncoding.indexedAdj (edge 339).1 c → - SeedEncoding.indexedAdj (edge 339).2 c → - triangle (triangleIndex 339 c) = ((edge 339).1,(edge 339).2,c) := by decide +kernel -theorem triangle_complete_340 : ∀ c : Fin 103, - (edge 340).2 < c → SeedEncoding.indexedAdj (edge 340).1 c → - SeedEncoding.indexedAdj (edge 340).2 c → - triangle (triangleIndex 340 c) = ((edge 340).1,(edge 340).2,c) := by decide +kernel -theorem triangle_complete_341 : ∀ c : Fin 103, - (edge 341).2 < c → SeedEncoding.indexedAdj (edge 341).1 c → - SeedEncoding.indexedAdj (edge 341).2 c → - triangle (triangleIndex 341 c) = ((edge 341).1,(edge 341).2,c) := by decide +kernel -theorem triangle_complete_342 : ∀ c : Fin 103, - (edge 342).2 < c → SeedEncoding.indexedAdj (edge 342).1 c → - SeedEncoding.indexedAdj (edge 342).2 c → - triangle (triangleIndex 342 c) = ((edge 342).1,(edge 342).2,c) := by decide +kernel -theorem triangle_complete_343 : ∀ c : Fin 103, - (edge 343).2 < c → SeedEncoding.indexedAdj (edge 343).1 c → - SeedEncoding.indexedAdj (edge 343).2 c → - triangle (triangleIndex 343 c) = ((edge 343).1,(edge 343).2,c) := by decide +kernel -theorem triangle_complete_344 : ∀ c : Fin 103, - (edge 344).2 < c → SeedEncoding.indexedAdj (edge 344).1 c → - SeedEncoding.indexedAdj (edge 344).2 c → - triangle (triangleIndex 344 c) = ((edge 344).1,(edge 344).2,c) := by decide +kernel -theorem triangle_complete_345 : ∀ c : Fin 103, - (edge 345).2 < c → SeedEncoding.indexedAdj (edge 345).1 c → - SeedEncoding.indexedAdj (edge 345).2 c → - triangle (triangleIndex 345 c) = ((edge 345).1,(edge 345).2,c) := by decide +kernel -theorem triangle_complete_346 : ∀ c : Fin 103, - (edge 346).2 < c → SeedEncoding.indexedAdj (edge 346).1 c → - SeedEncoding.indexedAdj (edge 346).2 c → - triangle (triangleIndex 346 c) = ((edge 346).1,(edge 346).2,c) := by decide +kernel -theorem triangle_complete_347 : ∀ c : Fin 103, - (edge 347).2 < c → SeedEncoding.indexedAdj (edge 347).1 c → - SeedEncoding.indexedAdj (edge 347).2 c → - triangle (triangleIndex 347 c) = ((edge 347).1,(edge 347).2,c) := by decide +kernel -theorem triangle_complete_348 : ∀ c : Fin 103, - (edge 348).2 < c → SeedEncoding.indexedAdj (edge 348).1 c → - SeedEncoding.indexedAdj (edge 348).2 c → - triangle (triangleIndex 348 c) = ((edge 348).1,(edge 348).2,c) := by decide +kernel -theorem triangle_complete_349 : ∀ c : Fin 103, - (edge 349).2 < c → SeedEncoding.indexedAdj (edge 349).1 c → - SeedEncoding.indexedAdj (edge 349).2 c → - triangle (triangleIndex 349 c) = ((edge 349).1,(edge 349).2,c) := by decide +kernel -theorem triangle_complete_350 : ∀ c : Fin 103, - (edge 350).2 < c → SeedEncoding.indexedAdj (edge 350).1 c → - SeedEncoding.indexedAdj (edge 350).2 c → - triangle (triangleIndex 350 c) = ((edge 350).1,(edge 350).2,c) := by decide +kernel -theorem triangle_complete_351 : ∀ c : Fin 103, - (edge 351).2 < c → SeedEncoding.indexedAdj (edge 351).1 c → - SeedEncoding.indexedAdj (edge 351).2 c → - triangle (triangleIndex 351 c) = ((edge 351).1,(edge 351).2,c) := by decide +kernel -theorem triangle_complete_352 : ∀ c : Fin 103, - (edge 352).2 < c → SeedEncoding.indexedAdj (edge 352).1 c → - SeedEncoding.indexedAdj (edge 352).2 c → - triangle (triangleIndex 352 c) = ((edge 352).1,(edge 352).2,c) := by decide +kernel -theorem triangle_complete_353 : ∀ c : Fin 103, - (edge 353).2 < c → SeedEncoding.indexedAdj (edge 353).1 c → - SeedEncoding.indexedAdj (edge 353).2 c → - triangle (triangleIndex 353 c) = ((edge 353).1,(edge 353).2,c) := by decide +kernel -theorem triangle_complete_354 : ∀ c : Fin 103, - (edge 354).2 < c → SeedEncoding.indexedAdj (edge 354).1 c → - SeedEncoding.indexedAdj (edge 354).2 c → - triangle (triangleIndex 354 c) = ((edge 354).1,(edge 354).2,c) := by decide +kernel -theorem triangle_complete_355 : ∀ c : Fin 103, - (edge 355).2 < c → SeedEncoding.indexedAdj (edge 355).1 c → - SeedEncoding.indexedAdj (edge 355).2 c → - triangle (triangleIndex 355 c) = ((edge 355).1,(edge 355).2,c) := by decide +kernel -theorem triangle_complete_356 : ∀ c : Fin 103, - (edge 356).2 < c → SeedEncoding.indexedAdj (edge 356).1 c → - SeedEncoding.indexedAdj (edge 356).2 c → - triangle (triangleIndex 356 c) = ((edge 356).1,(edge 356).2,c) := by decide +kernel -theorem triangle_complete_357 : ∀ c : Fin 103, - (edge 357).2 < c → SeedEncoding.indexedAdj (edge 357).1 c → - SeedEncoding.indexedAdj (edge 357).2 c → - triangle (triangleIndex 357 c) = ((edge 357).1,(edge 357).2,c) := by decide +kernel -theorem triangle_complete_358 : ∀ c : Fin 103, - (edge 358).2 < c → SeedEncoding.indexedAdj (edge 358).1 c → - SeedEncoding.indexedAdj (edge 358).2 c → - triangle (triangleIndex 358 c) = ((edge 358).1,(edge 358).2,c) := by decide +kernel -theorem triangle_complete_359 : ∀ c : Fin 103, - (edge 359).2 < c → SeedEncoding.indexedAdj (edge 359).1 c → - SeedEncoding.indexedAdj (edge 359).2 c → - triangle (triangleIndex 359 c) = ((edge 359).1,(edge 359).2,c) := by decide +kernel -theorem triangle_complete_360 : ∀ c : Fin 103, - (edge 360).2 < c → SeedEncoding.indexedAdj (edge 360).1 c → - SeedEncoding.indexedAdj (edge 360).2 c → - triangle (triangleIndex 360 c) = ((edge 360).1,(edge 360).2,c) := by decide +kernel -theorem triangle_complete_361 : ∀ c : Fin 103, - (edge 361).2 < c → SeedEncoding.indexedAdj (edge 361).1 c → - SeedEncoding.indexedAdj (edge 361).2 c → - triangle (triangleIndex 361 c) = ((edge 361).1,(edge 361).2,c) := by decide +kernel -theorem triangle_complete_362 : ∀ c : Fin 103, - (edge 362).2 < c → SeedEncoding.indexedAdj (edge 362).1 c → - SeedEncoding.indexedAdj (edge 362).2 c → - triangle (triangleIndex 362 c) = ((edge 362).1,(edge 362).2,c) := by decide +kernel -theorem triangle_complete_363 : ∀ c : Fin 103, - (edge 363).2 < c → SeedEncoding.indexedAdj (edge 363).1 c → - SeedEncoding.indexedAdj (edge 363).2 c → - triangle (triangleIndex 363 c) = ((edge 363).1,(edge 363).2,c) := by decide +kernel -theorem triangle_complete_364 : ∀ c : Fin 103, - (edge 364).2 < c → SeedEncoding.indexedAdj (edge 364).1 c → - SeedEncoding.indexedAdj (edge 364).2 c → - triangle (triangleIndex 364 c) = ((edge 364).1,(edge 364).2,c) := by decide +kernel -theorem triangle_complete_365 : ∀ c : Fin 103, - (edge 365).2 < c → SeedEncoding.indexedAdj (edge 365).1 c → - SeedEncoding.indexedAdj (edge 365).2 c → - triangle (triangleIndex 365 c) = ((edge 365).1,(edge 365).2,c) := by decide +kernel -theorem triangle_complete_366 : ∀ c : Fin 103, - (edge 366).2 < c → SeedEncoding.indexedAdj (edge 366).1 c → - SeedEncoding.indexedAdj (edge 366).2 c → - triangle (triangleIndex 366 c) = ((edge 366).1,(edge 366).2,c) := by decide +kernel -theorem triangle_complete_367 : ∀ c : Fin 103, - (edge 367).2 < c → SeedEncoding.indexedAdj (edge 367).1 c → - SeedEncoding.indexedAdj (edge 367).2 c → - triangle (triangleIndex 367 c) = ((edge 367).1,(edge 367).2,c) := by decide +kernel -theorem triangle_complete_368 : ∀ c : Fin 103, - (edge 368).2 < c → SeedEncoding.indexedAdj (edge 368).1 c → - SeedEncoding.indexedAdj (edge 368).2 c → - triangle (triangleIndex 368 c) = ((edge 368).1,(edge 368).2,c) := by decide +kernel -theorem triangle_complete_369 : ∀ c : Fin 103, - (edge 369).2 < c → SeedEncoding.indexedAdj (edge 369).1 c → - SeedEncoding.indexedAdj (edge 369).2 c → - triangle (triangleIndex 369 c) = ((edge 369).1,(edge 369).2,c) := by decide +kernel -theorem triangle_complete_370 : ∀ c : Fin 103, - (edge 370).2 < c → SeedEncoding.indexedAdj (edge 370).1 c → - SeedEncoding.indexedAdj (edge 370).2 c → - triangle (triangleIndex 370 c) = ((edge 370).1,(edge 370).2,c) := by decide +kernel -theorem triangle_complete_371 : ∀ c : Fin 103, - (edge 371).2 < c → SeedEncoding.indexedAdj (edge 371).1 c → - SeedEncoding.indexedAdj (edge 371).2 c → - triangle (triangleIndex 371 c) = ((edge 371).1,(edge 371).2,c) := by decide +kernel -theorem edge_valid : ∀ e : Fin 372, - (edge e).1 < (edge e).2 ∧ SeedEncoding.indexedAdj (edge e).1 (edge e).2 := by decide +kernel - -theorem edge_index_inverse : ∀ e : Fin 372, edgeIndex (edge e).1 (edge e).2 = e := by decide +kernel - -theorem triangle_valid : ∀ t : Fin 270, - (triangle t).1 < (triangle t).2.1 ∧ (triangle t).2.1 < (triangle t).2.2 ∧ - SeedEncoding.indexedAdj (triangle t).1 (triangle t).2.1 ∧ - SeedEncoding.indexedAdj (triangle t).1 (triangle t).2.2 ∧ - SeedEncoding.indexedAdj (triangle t).2.1 (triangle t).2.2 := by decide +kernel - -theorem triangle_edges_valid : ∀ t : Fin 270, - edge (triangleEdges t).1 = ((triangle t).2.1,(triangle t).2.2) ∧ - edge (triangleEdges t).2.1 = ((triangle t).1,(triangle t).2.2) ∧ - edge (triangleEdges t).2.2 = ((triangle t).1,(triangle t).2.1) := by decide +kernel - -theorem triangle_index_inverse : ∀ t : Fin 270, - triangleIndex (edgeIndex (triangle t).1 (triangle t).2.1) (triangle t).2.2 = t := by decide +kernel -theorem edge_complete (a b : Fin 103) : a < b → SeedEncoding.indexedAdj a b → - edge (edgeIndex a b) = (a,b) := by - fin_cases a - · exact edge_complete_0 b - · exact edge_complete_1 b - · exact edge_complete_2 b - · exact edge_complete_3 b - · exact edge_complete_4 b - · exact edge_complete_5 b - · exact edge_complete_6 b - · exact edge_complete_7 b - · exact edge_complete_8 b - · exact edge_complete_9 b - · exact edge_complete_10 b - · exact edge_complete_11 b - · exact edge_complete_12 b - · exact edge_complete_13 b - · exact edge_complete_14 b - · exact edge_complete_15 b - · exact edge_complete_16 b - · exact edge_complete_17 b - · exact edge_complete_18 b - · exact edge_complete_19 b - · exact edge_complete_20 b - · exact edge_complete_21 b - · exact edge_complete_22 b - · exact edge_complete_23 b - · exact edge_complete_24 b - · exact edge_complete_25 b - · exact edge_complete_26 b - · exact edge_complete_27 b - · exact edge_complete_28 b - · exact edge_complete_29 b - · exact edge_complete_30 b - · exact edge_complete_31 b - · exact edge_complete_32 b - · exact edge_complete_33 b - · exact edge_complete_34 b - · exact edge_complete_35 b - · exact edge_complete_36 b - · exact edge_complete_37 b - · exact edge_complete_38 b - · exact edge_complete_39 b - · exact edge_complete_40 b - · exact edge_complete_41 b - · exact edge_complete_42 b - · exact edge_complete_43 b - · exact edge_complete_44 b - · exact edge_complete_45 b - · exact edge_complete_46 b - · exact edge_complete_47 b - · exact edge_complete_48 b - · exact edge_complete_49 b - · exact edge_complete_50 b - · exact edge_complete_51 b - · exact edge_complete_52 b - · exact edge_complete_53 b - · exact edge_complete_54 b - · exact edge_complete_55 b - · exact edge_complete_56 b - · exact edge_complete_57 b - · exact edge_complete_58 b - · exact edge_complete_59 b - · exact edge_complete_60 b - · exact edge_complete_61 b - · exact edge_complete_62 b - · exact edge_complete_63 b - · exact edge_complete_64 b - · exact edge_complete_65 b - · exact edge_complete_66 b - · exact edge_complete_67 b - · exact edge_complete_68 b - · exact edge_complete_69 b - · exact edge_complete_70 b - · exact edge_complete_71 b - · exact edge_complete_72 b - · exact edge_complete_73 b - · exact edge_complete_74 b - · exact edge_complete_75 b - · exact edge_complete_76 b - · exact edge_complete_77 b - · exact edge_complete_78 b - · exact edge_complete_79 b - · exact edge_complete_80 b - · exact edge_complete_81 b - · exact edge_complete_82 b - · exact edge_complete_83 b - · exact edge_complete_84 b - · exact edge_complete_85 b - · exact edge_complete_86 b - · exact edge_complete_87 b - · exact edge_complete_88 b - · exact edge_complete_89 b - · exact edge_complete_90 b - · exact edge_complete_91 b - · exact edge_complete_92 b - · exact edge_complete_93 b - · exact edge_complete_94 b - · exact edge_complete_95 b - · exact edge_complete_96 b - · exact edge_complete_97 b - · exact edge_complete_98 b - · exact edge_complete_99 b - · exact edge_complete_100 b - · exact edge_complete_101 b - · exact edge_complete_102 b -theorem triangle_complete (e : Fin 372) (c : Fin 103) : - (edge e).2 < c → SeedEncoding.indexedAdj (edge e).1 c → - SeedEncoding.indexedAdj (edge e).2 c → - triangle (triangleIndex e c) = ((edge e).1,(edge e).2,c) := by - fin_cases e - · exact triangle_complete_0 c - · exact triangle_complete_1 c - · exact triangle_complete_2 c - · exact triangle_complete_3 c - · exact triangle_complete_4 c - · exact triangle_complete_5 c - · exact triangle_complete_6 c - · exact triangle_complete_7 c - · exact triangle_complete_8 c - · exact triangle_complete_9 c - · exact triangle_complete_10 c - · exact triangle_complete_11 c - · exact triangle_complete_12 c - · exact triangle_complete_13 c - · exact triangle_complete_14 c - · exact triangle_complete_15 c - · exact triangle_complete_16 c - · exact triangle_complete_17 c - · exact triangle_complete_18 c - · exact triangle_complete_19 c - · exact triangle_complete_20 c - · exact triangle_complete_21 c - · exact triangle_complete_22 c - · exact triangle_complete_23 c - · exact triangle_complete_24 c - · exact triangle_complete_25 c - · exact triangle_complete_26 c - · exact triangle_complete_27 c - · exact triangle_complete_28 c - · exact triangle_complete_29 c - · exact triangle_complete_30 c - · exact triangle_complete_31 c - · exact triangle_complete_32 c - · exact triangle_complete_33 c - · exact triangle_complete_34 c - · exact triangle_complete_35 c - · exact triangle_complete_36 c - · exact triangle_complete_37 c - · exact triangle_complete_38 c - · exact triangle_complete_39 c - · exact triangle_complete_40 c - · exact triangle_complete_41 c - · exact triangle_complete_42 c - · exact triangle_complete_43 c - · exact triangle_complete_44 c - · exact triangle_complete_45 c - · exact triangle_complete_46 c - · exact triangle_complete_47 c - · exact triangle_complete_48 c - · exact triangle_complete_49 c - · exact triangle_complete_50 c - · exact triangle_complete_51 c - · exact triangle_complete_52 c - · exact triangle_complete_53 c - · exact triangle_complete_54 c - · exact triangle_complete_55 c - · exact triangle_complete_56 c - · exact triangle_complete_57 c - · exact triangle_complete_58 c - · exact triangle_complete_59 c - · exact triangle_complete_60 c - · exact triangle_complete_61 c - · exact triangle_complete_62 c - · exact triangle_complete_63 c - · exact triangle_complete_64 c - · exact triangle_complete_65 c - · exact triangle_complete_66 c - · exact triangle_complete_67 c - · exact triangle_complete_68 c - · exact triangle_complete_69 c - · exact triangle_complete_70 c - · exact triangle_complete_71 c - · exact triangle_complete_72 c - · exact triangle_complete_73 c - · exact triangle_complete_74 c - · exact triangle_complete_75 c - · exact triangle_complete_76 c - · exact triangle_complete_77 c - · exact triangle_complete_78 c - · exact triangle_complete_79 c - · exact triangle_complete_80 c - · exact triangle_complete_81 c - · exact triangle_complete_82 c - · exact triangle_complete_83 c - · exact triangle_complete_84 c - · exact triangle_complete_85 c - · exact triangle_complete_86 c - · exact triangle_complete_87 c - · exact triangle_complete_88 c - · exact triangle_complete_89 c - · exact triangle_complete_90 c - · exact triangle_complete_91 c - · exact triangle_complete_92 c - · exact triangle_complete_93 c - · exact triangle_complete_94 c - · exact triangle_complete_95 c - · exact triangle_complete_96 c - · exact triangle_complete_97 c - · exact triangle_complete_98 c - · exact triangle_complete_99 c - · exact triangle_complete_100 c - · exact triangle_complete_101 c - · exact triangle_complete_102 c - · exact triangle_complete_103 c - · exact triangle_complete_104 c - · exact triangle_complete_105 c - · exact triangle_complete_106 c - · exact triangle_complete_107 c - · exact triangle_complete_108 c - · exact triangle_complete_109 c - · exact triangle_complete_110 c - · exact triangle_complete_111 c - · exact triangle_complete_112 c - · exact triangle_complete_113 c - · exact triangle_complete_114 c - · exact triangle_complete_115 c - · exact triangle_complete_116 c - · exact triangle_complete_117 c - · exact triangle_complete_118 c - · exact triangle_complete_119 c - · exact triangle_complete_120 c - · exact triangle_complete_121 c - · exact triangle_complete_122 c - · exact triangle_complete_123 c - · exact triangle_complete_124 c - · exact triangle_complete_125 c - · exact triangle_complete_126 c - · exact triangle_complete_127 c - · exact triangle_complete_128 c - · exact triangle_complete_129 c - · exact triangle_complete_130 c - · exact triangle_complete_131 c - · exact triangle_complete_132 c - · exact triangle_complete_133 c - · exact triangle_complete_134 c - · exact triangle_complete_135 c - · exact triangle_complete_136 c - · exact triangle_complete_137 c - · exact triangle_complete_138 c - · exact triangle_complete_139 c - · exact triangle_complete_140 c - · exact triangle_complete_141 c - · exact triangle_complete_142 c - · exact triangle_complete_143 c - · exact triangle_complete_144 c - · exact triangle_complete_145 c - · exact triangle_complete_146 c - · exact triangle_complete_147 c - · exact triangle_complete_148 c - · exact triangle_complete_149 c - · exact triangle_complete_150 c - · exact triangle_complete_151 c - · exact triangle_complete_152 c - · exact triangle_complete_153 c - · exact triangle_complete_154 c - · exact triangle_complete_155 c - · exact triangle_complete_156 c - · exact triangle_complete_157 c - · exact triangle_complete_158 c - · exact triangle_complete_159 c - · exact triangle_complete_160 c - · exact triangle_complete_161 c - · exact triangle_complete_162 c - · exact triangle_complete_163 c - · exact triangle_complete_164 c - · exact triangle_complete_165 c - · exact triangle_complete_166 c - · exact triangle_complete_167 c - · exact triangle_complete_168 c - · exact triangle_complete_169 c - · exact triangle_complete_170 c - · exact triangle_complete_171 c - · exact triangle_complete_172 c - · exact triangle_complete_173 c - · exact triangle_complete_174 c - · exact triangle_complete_175 c - · exact triangle_complete_176 c - · exact triangle_complete_177 c - · exact triangle_complete_178 c - · exact triangle_complete_179 c - · exact triangle_complete_180 c - · exact triangle_complete_181 c - · exact triangle_complete_182 c - · exact triangle_complete_183 c - · exact triangle_complete_184 c - · exact triangle_complete_185 c - · exact triangle_complete_186 c - · exact triangle_complete_187 c - · exact triangle_complete_188 c - · exact triangle_complete_189 c - · exact triangle_complete_190 c - · exact triangle_complete_191 c - · exact triangle_complete_192 c - · exact triangle_complete_193 c - · exact triangle_complete_194 c - · exact triangle_complete_195 c - · exact triangle_complete_196 c - · exact triangle_complete_197 c - · exact triangle_complete_198 c - · exact triangle_complete_199 c - · exact triangle_complete_200 c - · exact triangle_complete_201 c - · exact triangle_complete_202 c - · exact triangle_complete_203 c - · exact triangle_complete_204 c - · exact triangle_complete_205 c - · exact triangle_complete_206 c - · exact triangle_complete_207 c - · exact triangle_complete_208 c - · exact triangle_complete_209 c - · exact triangle_complete_210 c - · exact triangle_complete_211 c - · exact triangle_complete_212 c - · exact triangle_complete_213 c - · exact triangle_complete_214 c - · exact triangle_complete_215 c - · exact triangle_complete_216 c - · exact triangle_complete_217 c - · exact triangle_complete_218 c - · exact triangle_complete_219 c - · exact triangle_complete_220 c - · exact triangle_complete_221 c - · exact triangle_complete_222 c - · exact triangle_complete_223 c - · exact triangle_complete_224 c - · exact triangle_complete_225 c - · exact triangle_complete_226 c - · exact triangle_complete_227 c - · exact triangle_complete_228 c - · exact triangle_complete_229 c - · exact triangle_complete_230 c - · exact triangle_complete_231 c - · exact triangle_complete_232 c - · exact triangle_complete_233 c - · exact triangle_complete_234 c - · exact triangle_complete_235 c - · exact triangle_complete_236 c - · exact triangle_complete_237 c - · exact triangle_complete_238 c - · exact triangle_complete_239 c - · exact triangle_complete_240 c - · exact triangle_complete_241 c - · exact triangle_complete_242 c - · exact triangle_complete_243 c - · exact triangle_complete_244 c - · exact triangle_complete_245 c - · exact triangle_complete_246 c - · exact triangle_complete_247 c - · exact triangle_complete_248 c - · exact triangle_complete_249 c - · exact triangle_complete_250 c - · exact triangle_complete_251 c - · exact triangle_complete_252 c - · exact triangle_complete_253 c - · exact triangle_complete_254 c - · exact triangle_complete_255 c - · exact triangle_complete_256 c - · exact triangle_complete_257 c - · exact triangle_complete_258 c - · exact triangle_complete_259 c - · exact triangle_complete_260 c - · exact triangle_complete_261 c - · exact triangle_complete_262 c - · exact triangle_complete_263 c - · exact triangle_complete_264 c - · exact triangle_complete_265 c - · exact triangle_complete_266 c - · exact triangle_complete_267 c - · exact triangle_complete_268 c - · exact triangle_complete_269 c - · exact triangle_complete_270 c - · exact triangle_complete_271 c - · exact triangle_complete_272 c - · exact triangle_complete_273 c - · exact triangle_complete_274 c - · exact triangle_complete_275 c - · exact triangle_complete_276 c - · exact triangle_complete_277 c - · exact triangle_complete_278 c - · exact triangle_complete_279 c - · exact triangle_complete_280 c - · exact triangle_complete_281 c - · exact triangle_complete_282 c - · exact triangle_complete_283 c - · exact triangle_complete_284 c - · exact triangle_complete_285 c - · exact triangle_complete_286 c - · exact triangle_complete_287 c - · exact triangle_complete_288 c - · exact triangle_complete_289 c - · exact triangle_complete_290 c - · exact triangle_complete_291 c - · exact triangle_complete_292 c - · exact triangle_complete_293 c - · exact triangle_complete_294 c - · exact triangle_complete_295 c - · exact triangle_complete_296 c - · exact triangle_complete_297 c - · exact triangle_complete_298 c - · exact triangle_complete_299 c - · exact triangle_complete_300 c - · exact triangle_complete_301 c - · exact triangle_complete_302 c - · exact triangle_complete_303 c - · exact triangle_complete_304 c - · exact triangle_complete_305 c - · exact triangle_complete_306 c - · exact triangle_complete_307 c - · exact triangle_complete_308 c - · exact triangle_complete_309 c - · exact triangle_complete_310 c - · exact triangle_complete_311 c - · exact triangle_complete_312 c - · exact triangle_complete_313 c - · exact triangle_complete_314 c - · exact triangle_complete_315 c - · exact triangle_complete_316 c - · exact triangle_complete_317 c - · exact triangle_complete_318 c - · exact triangle_complete_319 c - · exact triangle_complete_320 c - · exact triangle_complete_321 c - · exact triangle_complete_322 c - · exact triangle_complete_323 c - · exact triangle_complete_324 c - · exact triangle_complete_325 c - · exact triangle_complete_326 c - · exact triangle_complete_327 c - · exact triangle_complete_328 c - · exact triangle_complete_329 c - · exact triangle_complete_330 c - · exact triangle_complete_331 c - · exact triangle_complete_332 c - · exact triangle_complete_333 c - · exact triangle_complete_334 c - · exact triangle_complete_335 c - · exact triangle_complete_336 c - · exact triangle_complete_337 c - · exact triangle_complete_338 c - · exact triangle_complete_339 c - · exact triangle_complete_340 c - · exact triangle_complete_341 c - · exact triangle_complete_342 c - · exact triangle_complete_343 c - · exact triangle_complete_344 c - · exact triangle_complete_345 c - · exact triangle_complete_346 c - · exact triangle_complete_347 c - · exact triangle_complete_348 c - · exact triangle_complete_349 c - · exact triangle_complete_350 c - · exact triangle_complete_351 c - · exact triangle_complete_352 c - · exact triangle_complete_353 c - · exact triangle_complete_354 c - · exact triangle_complete_355 c - · exact triangle_complete_356 c - · exact triangle_complete_357 c - · exact triangle_complete_358 c - · exact triangle_complete_359 c - · exact triangle_complete_360 c - · exact triangle_complete_361 c - · exact triangle_complete_362 c - · exact triangle_complete_363 c - · exact triangle_complete_364 c - · exact triangle_complete_365 c - · exact triangle_complete_366 c - · exact triangle_complete_367 c - · exact triangle_complete_368 c - · exact triangle_complete_369 c - · exact triangle_complete_370 c - · exact triangle_complete_371 c -def rankIndex (a : Fin 103) : Fin 3 := if a.val < 7 then 0 else if a.val < 58 then 1 else 2 - theorem sorted_adj_rank : ∀ a b : Fin 103, a < b → SeedEncoding.indexedAdj a b → - rankIndex a < rankIndex b := by decide +kernel -end EilenbergGanea.SeedChainCertificate -namespace EilenbergGanea.SeedChainCertificate -open SimplicialChains - -def graph : SimpleGraph (Fin 103) := seedGraph.comap SeedEncoding.cellAt -@[simp] theorem graph_adj (a b : Fin 103) : graph.Adj a b ↔ SeedEncoding.indexedAdj a b := - SeedEncoding.adjacency_certificate a b - - theorem valid_pair_iff (a b : Fin 103) : - Valid graph [a,b] ↔ a < b ∧ SeedEncoding.indexedAdj a b := by simp [Valid] - theorem valid_triple_iff (a b c : Fin 103) : - Valid graph [a,b,c] ↔ a < b ∧ b < c ∧ SeedEncoding.indexedAdj a b ∧ - SeedEncoding.indexedAdj a c ∧ SeedEncoding.indexedAdj b c := by - simp [Valid] - constructor - · rintro ⟨⟨⟨hab,_⟩,hbc⟩,⟨⟨h₁,h₂⟩,h₃⟩⟩ - exact ⟨hab,hbc,h₁,h₂,h₃⟩ - · rintro ⟨hab,hbc,h₁,h₂,h₃⟩ - exact ⟨⟨⟨hab,hab.trans hbc⟩,hbc⟩,⟨⟨h₁,h₂⟩,h₃⟩⟩ - - theorem valid_length_le (w : List (Fin 103)) (hw : Valid graph w) : w.length ≤ 3 := by - have hp : w.Pairwise (fun a b => rankIndex a < rankIndex b) := by - have hh := hw.1.and hw.2 - exact hh.imp (fun {a b} h => sorted_adj_rank a b h.1 ((graph_adj a b).mp h.2)) - have hn : (w.map rankIndex).Nodup := by - apply List.nodup_iff_pairwise_ne.mpr - rw [List.pairwise_map] - exact hp.imp (fun {_ _} h => ne_of_lt h) - have he := hn.length_le_card - simpa using he - - def indices : TwoDimensionalIndices (L := graph) (Fin 372) (Fin 270) where - edge := edge - triangle := triangle - face := triangleEdges - edgeIndex := edgeIndex - triangleIndex := fun a b c => triangleIndex (edgeIndex a b) c - edge_valid := fun e => (valid_pair_iff _ _).mpr (edge_valid e) - triangle_valid := fun t => (valid_triple_iff _ _ _).mpr (triangle_valid t) - edge_inverse := edge_index_inverse - edge_complete := fun a b h => edge_complete a b ((valid_pair_iff a b).mp h).1 - ((valid_pair_iff a b).mp h).2 - triangle_complete := by - intro a b c h - obtain ⟨hab,hbc,h₁,h₂,h₃⟩ := (valid_triple_iff a b c).mp h - have he := edge_complete a b hab h₁ - have ht := triangle_complete (edgeIndex a b) c - rw [he] at ht - exact ht hbc h₂ h₃ - face_edge := triangle_edges_valid - length_le := valid_length_le - -end EilenbergGanea.SeedChainCertificate - - -end - -end OAI +import OAI.Topology.EilenbergGanea.Seed +import OAI.AlgebraicTopology.Simplicial.Chains + +namespace OAI + +noncomputable section + +open Classical Set + +namespace EilenbergGanea +namespace SeedEncoding + +def finite (n : ℕ) : Fin 103 := ⟨n % 103, Nat.mod_lt _ (by decide)⟩ +def roseAt : ℕ → RoseVertex + | 0 => none + | 1 => some (false,0) + | 2 => some (false,1) + | 3 => some (true,0) + | _ => some (true,1) + +def sectorAt (n : ℕ) : Sector := + if n < 21 then ⟨false,⟨n % 21,by change n % 21 < 21; omega⟩⟩ + else ⟨true,⟨(n-21) % 24,by change (n-21) % 24 < 24; omega⟩⟩ + +def cellAt (i : Fin 103) : SeedCell := + if i.val < 5 then .inl (.inl (roseAt i.val)) + else if i.val < 7 then .inl (.inr (decide (i.val = 6))) + else if i.val < 13 then .inr (.inl (.inl (decide (10 ≤ i.val),⟨(i.val-7)%3,by omega⟩))) + else if i.val < 58 then .inr (.inl (.inr (sectorAt (i.val-13)))) + else .inr (.inr (sectorAt (i.val-58))) + +def sectorCode (s : Sector) : ℕ := (if s.1 then 21 else 0) + s.2.val + +def cellCode : SeedCell → Fin 103 + | .inl (.inl none) => finite 0 + | .inl (.inl (some (q,j))) => finite (1 + (if q then 2 else 0) + j.val) + | .inl (.inr r) => finite (5 + if r then 1 else 0) + | .inr (.inl (.inl (q,j))) => finite (7 + (if q then 3 else 0) + j.val) + | .inr (.inl (.inr s)) => finite (13 + sectorCode s) + | .inr (.inr s) => finite (58 + sectorCode s) + +theorem cellAt_code (c : SeedCell) : cellAt (cellCode c) = c := by + rcases c with (v|e) + · rcases v with (v|r) + · rcases v with _ | ⟨q,j⟩ + · decide +kernel + · cases q <;> fin_cases j <;> decide +kernel + · cases r <;> decide +kernel + · rcases e with (e|s) + · rcases e with (⟨q,j⟩|⟨r,i⟩) + · cases q <;> fin_cases j <;> decide +kernel + · cases r <;> fin_cases i <;> decide +kernel + · rcases s with ⟨r,i⟩ + cases r <;> fin_cases i <;> decide +kernel +theorem code_cellAt : ∀ i : Fin 103, cellCode (cellAt i) = i := by decide +kernel + +def cellEquiv : SeedCell ≃ Fin 103 where + toFun := cellCode + invFun := cellAt + left_inv := cellAt_code + right_inv := code_cellAt + +instance properFaceDecidable : DecidableRel properFace := by + intro a b + unfold properFace + split <;> infer_instance + +instance seedAdjDecidable : DecidableRel seedGraph.Adj := + fun a b => inferInstanceAs (Decidable (properFace a b ∨ properFace b a)) + +def adjCodes : List ℕ := [7243717715589717591194788771456,7726619075706194405914338017664,3863334018612617729895957824256,482913190295244515963480050688,965825603447607950602534918144,604462621576955615502336,10141204197363213635018010132480,5151073943635249663071907479555,2575545132070798340360931115014,1287788886541746187830420307973,160971236130163140008121204745,321941954165072225809775722520,643883649282517424516318101521,302231743134033445388321,864691128455135266,1729382256910270500,3458764513820540961,6917529027641081890,13835058055282163748,27670116110564327457,55340232221128654896,110680464442257309736,221360928884514619425,442721857769029238832,885443715538058477608,1770887431076116955169,3541774862152233910320,7083549724304467820584,14167099448608935641121,28334198897217871282224,56668397794435742564392,113336795588871485128737,226673591177742970257456,453347182355485940514856,5070603005375827413301400174657,1813388729421943762059330,3626777458843887524118596,7253554917687775048237121,14507109835375550096474178,29014219670751100192948292,58028439341502200385896513,116056878683004400771792968,232113757366008801543585872,464227514732017603087171649,928455029464035206174343236,1856910058928070412348686402,3713820117856140824697372737,7427640235712281649394745416,14855280471424563298789490768,29710560942849126597578981441,59421121885698253195157962820,118842243771396506390315925570,237684487542793012780631851073,475368975085586025561263702088,950737950171172051122527404112,1901475900342344102245054808129,3802951800684688204490109616196,7605903601369376408980219232322,24739,49446,98853,196771,393510,786981,1577009,3147832,6292521,12587057,25167928,50332713,100667441,201328696,402654249,805310513,1610614840,3221226537,6442455089,12884903992,8589943849,51539607747,103079215430,206158430789,412316860611,824633721158,1649267442245,3298534884425,6597069768792,13194139537489,26388279067205,52776558133574,105553116266691,211106232534089,422212465068120,844424930136145,1688849860264517,3377699720528198,6755399441055939,13510798882112585,27021597764225112,54043195528450129,108086391056892485,216172782113784134,144115205255725251] + +def indexedAdj (a b : Fin 103) : Prop := ((adjCodes.getD a.val 0 >>> b.val) % 2) = 1 +instance : DecidableRel indexedAdj := fun a b => inferInstanceAs (Decidable (((adjCodes.getD a.val 0 >>> b.val) % 2) = 1)) + +theorem adjacency_certificate : ∀ a b : Fin 103, + seedGraph.Adj (cellAt a) (cellAt b) ↔ indexedAdj a b := by decide +kernel + +end SeedEncoding +end EilenbergGanea +namespace EilenbergGanea.SeedChainCertificate +def edgeData_0 : List (Fin 103 × Fin 103) := [ + (0,7), + (0,9), + (0,10), + (0,12), + (0,13), + (0,16), + (0,19), + (0,22), + (0,25), + (0,28), + (0,31), + (0,34), + (0,37), + (0,40), + (0,43), + (0,46)] + +def edgeData_1 : List (Fin 103 × Fin 103) := [ + (0,49), + (0,52), + (0,55), + (0,58), + (0,60), + (0,61), + (0,63), + (0,64), + (0,66), + (0,67), + (0,69), + (0,70), + (0,72), + (0,73), + (0,75), + (0,76)] + +def edgeData_2 : List (Fin 103 × Fin 103) := [ + (0,78), + (0,79), + (0,81), + (0,82), + (0,84), + (0,85), + (0,87), + (0,88), + (0,90), + (0,91), + (0,93), + (0,94), + (0,96), + (0,97), + (0,99), + (0,100)] + +def edgeData_3 : List (Fin 103 × Fin 103) := [ + (0,102), + (1,7), + (1,8), + (1,14), + (1,17), + (1,35), + (1,38), + (1,45), + (1,51), + (1,57), + (1,58), + (1,59), + (1,61), + (1,62), + (1,79), + (1,80)] + +def edgeData_4 : List (Fin 103 × Fin 103) := [ + (1,82), + (1,83), + (1,89), + (1,90), + (1,95), + (1,96), + (1,101), + (1,102), + (2,8), + (2,9), + (2,15), + (2,18), + (2,36), + (2,39), + (2,44), + (2,50)] + +def edgeData_5 : List (Fin 103 × Fin 103) := [ + (2,56), + (2,59), + (2,60), + (2,62), + (2,63), + (2,80), + (2,81), + (2,83), + (2,84), + (2,88), + (2,89), + (2,94), + (2,95), + (2,100), + (2,101), + (3,10)] + +def edgeData_6 : List (Fin 103 × Fin 103) := [ + (3,11), + (3,21), + (3,24), + (3,27), + (3,30), + (3,33), + (3,41), + (3,47), + (3,53), + (3,65), + (3,66), + (3,68), + (3,69), + (3,71), + (3,72), + (3,74)] + +def edgeData_7 : List (Fin 103 × Fin 103) := [ + (3,75), + (3,77), + (3,78), + (3,85), + (3,86), + (3,91), + (3,92), + (3,97), + (3,98), + (4,11), + (4,12), + (4,20), + (4,23), + (4,26), + (4,29), + (4,32)] + +def edgeData_8 : List (Fin 103 × Fin 103) := [ + (4,42), + (4,48), + (4,54), + (4,64), + (4,65), + (4,67), + (4,68), + (4,70), + (4,71), + (4,73), + (4,74), + (4,76), + (4,77), + (4,86), + (4,87), + (4,92)] + +def edgeData_9 : List (Fin 103 × Fin 103) := [ + (4,93), + (4,98), + (4,99), + (5,13), + (5,14), + (5,15), + (5,16), + (5,17), + (5,18), + (5,19), + (5,20), + (5,21), + (5,22), + (5,23), + (5,24), + (5,25)] + +def edgeData_10 : List (Fin 103 × Fin 103) := [ + (5,26), + (5,27), + (5,28), + (5,29), + (5,30), + (5,31), + (5,32), + (5,33), + (5,58), + (5,59), + (5,60), + (5,61), + (5,62), + (5,63), + (5,64), + (5,65)] + +def edgeData_11 : List (Fin 103 × Fin 103) := [ + (5,66), + (5,67), + (5,68), + (5,69), + (5,70), + (5,71), + (5,72), + (5,73), + (5,74), + (5,75), + (5,76), + (5,77), + (5,78), + (6,34), + (6,35), + (6,36)] + +def edgeData_12 : List (Fin 103 × Fin 103) := [ + (6,37), + (6,38), + (6,39), + (6,40), + (6,41), + (6,42), + (6,43), + (6,44), + (6,45), + (6,46), + (6,47), + (6,48), + (6,49), + (6,50), + (6,51), + (6,52)] + +def edgeData_13 : List (Fin 103 × Fin 103) := [ + (6,53), + (6,54), + (6,55), + (6,56), + (6,57), + (6,79), + (6,80), + (6,81), + (6,82), + (6,83), + (6,84), + (6,85), + (6,86), + (6,87), + (6,88), + (6,89)] + +def edgeData_14 : List (Fin 103 × Fin 103) := [ + (6,90), + (6,91), + (6,92), + (6,93), + (6,94), + (6,95), + (6,96), + (6,97), + (6,98), + (6,99), + (6,100), + (6,101), + (6,102), + (7,58), + (7,61), + (7,79)] + +def edgeData_15 : List (Fin 103 × Fin 103) := [ + (7,82), + (7,90), + (7,96), + (7,102), + (8,59), + (8,62), + (8,80), + (8,83), + (8,89), + (8,95), + (8,101), + (9,60), + (9,63), + (9,81), + (9,84), + (9,88)] + +def edgeData_16 : List (Fin 103 × Fin 103) := [ + (9,94), + (9,100), + (10,66), + (10,69), + (10,72), + (10,75), + (10,78), + (10,85), + (10,91), + (10,97), + (11,65), + (11,68), + (11,71), + (11,74), + (11,77), + (11,86)] + +def edgeData_17 : List (Fin 103 × Fin 103) := [ + (11,92), + (11,98), + (12,64), + (12,67), + (12,70), + (12,73), + (12,76), + (12,87), + (12,93), + (12,99), + (13,58), + (13,78), + (14,58), + (14,59), + (15,59), + (15,60)] + +def edgeData_18 : List (Fin 103 × Fin 103) := [ + (16,60), + (16,61), + (17,61), + (17,62), + (18,62), + (18,63), + (19,63), + (19,64), + (20,64), + (20,65), + (21,65), + (21,66), + (22,66), + (22,67), + (23,67), + (23,68)] + +def edgeData_19 : List (Fin 103 × Fin 103) := [ + (24,68), + (24,69), + (25,69), + (25,70), + (26,70), + (26,71), + (27,71), + (27,72), + (28,72), + (28,73), + (29,73), + (29,74), + (30,74), + (30,75), + (31,75), + (31,76)] + +def edgeData_20 : List (Fin 103 × Fin 103) := [ + (32,76), + (32,77), + (33,77), + (33,78), + (34,79), + (34,102), + (35,79), + (35,80), + (36,80), + (36,81), + (37,81), + (37,82), + (38,82), + (38,83), + (39,83), + (39,84)] + +def edgeData_21 : List (Fin 103 × Fin 103) := [ + (40,84), + (40,85), + (41,85), + (41,86), + (42,86), + (42,87), + (43,87), + (43,88), + (44,88), + (44,89), + (45,89), + (45,90), + (46,90), + (46,91), + (47,91), + (47,92)] + +def edgeData_22 : List (Fin 103 × Fin 103) := [ + (48,92), + (48,93), + (49,93), + (49,94), + (50,94), + (50,95), + (51,95), + (51,96), + (52,96), + (52,97), + (53,97), + (53,98), + (54,98), + (54,99), + (55,99), + (55,100)] + +def edgeData_23 : List (Fin 103 × Fin 103) := [ + (56,100), + (56,101), + (57,101), + (57,102)] + +def edgeData : List (Fin 103 × Fin 103) := [edgeData_0,edgeData_1,edgeData_2,edgeData_3,edgeData_4,edgeData_5,edgeData_6,edgeData_7,edgeData_8,edgeData_9,edgeData_10,edgeData_11,edgeData_12,edgeData_13,edgeData_14,edgeData_15,edgeData_16,edgeData_17,edgeData_18,edgeData_19,edgeData_20,edgeData_21,edgeData_22,edgeData_23].flatten + +def triangleEdgeData_0 : List (Fin 372 × Fin 372 × Fin 372) := [ + (237,19,0), + (238,21,0), + (239,33,0), + (240,35,0), + (241,40,0), + (242,44,0), + (243,48,0), + (251,20,1), + (252,22,1), + (253,34,1), + (254,36,1), + (255,39,1), + (256,43,1), + (257,47,1), + (258,24,2), + (259,26,2)] + +def triangleEdgeData_1 : List (Fin 372 × Fin 372 × Fin 372) := [ + (260,28,2), + (261,30,2), + (262,32,2), + (263,37,2), + (264,41,2), + (265,45,2), + (274,23,3), + (275,25,3), + (276,27,3), + (277,29,3), + (278,31,3), + (279,38,3), + (280,42,3), + (281,46,3), + (282,19,4), + (283,32,4)] + +def triangleEdgeData_2 : List (Fin 372 × Fin 372 × Fin 372) := [ + (288,20,5), + (289,21,5), + (294,22,6), + (295,23,6), + (300,24,7), + (301,25,7), + (306,26,8), + (307,27,8), + (312,28,9), + (313,29,9), + (318,30,10), + (319,31,10), + (324,33,11), + (325,48,11), + (330,34,12), + (331,35,12)] + +def triangleEdgeData_3 : List (Fin 372 × Fin 372 × Fin 372) := [ + (336,36,13), + (337,37,13), + (342,38,14), + (343,39,14), + (348,40,15), + (349,41,15), + (354,42,16), + (355,43,16), + (360,44,17), + (361,45,17), + (366,46,18), + (367,47,18), + (237,58,49), + (238,60,49), + (239,62,49), + (240,64,49)] + +def triangleEdgeData_4 : List (Fin 372 × Fin 372 × Fin 372) := [ + (241,67,49), + (242,69,49), + (243,71,49), + (244,59,50), + (245,61,50), + (246,63,50), + (247,65,50), + (248,66,50), + (249,68,50), + (250,70,50), + (284,58,51), + (285,59,51), + (290,60,52), + (291,61,52), + (326,62,53), + (327,63,53)] + +def triangleEdgeData_5 : List (Fin 372 × Fin 372 × Fin 372) := [ + (332,64,54), + (333,65,54), + (346,66,55), + (347,67,55), + (358,68,56), + (359,69,56), + (370,70,57), + (371,71,57), + (244,81,72), + (245,83,72), + (246,85,72), + (247,87,72), + (248,90,72), + (249,92,72), + (250,94,72), + (251,82,73)] + +def triangleEdgeData_6 : List (Fin 372 × Fin 372 × Fin 372) := [ + (252,84,73), + (253,86,73), + (254,88,73), + (255,89,73), + (256,91,73), + (257,93,73), + (286,81,74), + (287,82,74), + (292,83,75), + (293,84,75), + (328,85,76), + (329,86,76), + (334,87,77), + (335,88,77), + (344,89,78), + (345,90,78)] + +def triangleEdgeData_7 : List (Fin 372 × Fin 372 × Fin 372) := [ + (356,91,79), + (357,92,79), + (368,93,80), + (369,94,80), + (258,106,95), + (259,108,95), + (260,110,95), + (261,112,95), + (262,114,95), + (263,115,95), + (264,117,95), + (265,119,95), + (266,105,96), + (267,107,96), + (268,109,96), + (269,111,96)] + +def triangleEdgeData_8 : List (Fin 372 × Fin 372 × Fin 372) := [ + (270,113,96), + (271,116,96), + (272,118,96), + (273,120,96), + (298,105,97), + (299,106,97), + (304,107,98), + (305,108,98), + (310,109,99), + (311,110,99), + (316,111,100), + (317,112,100), + (322,113,101), + (323,114,101), + (338,115,102), + (339,116,102)] + +def triangleEdgeData_9 : List (Fin 372 × Fin 372 × Fin 372) := [ + (350,117,103), + (351,118,103), + (362,119,104), + (363,120,104), + (266,132,121), + (267,134,121), + (268,136,121), + (269,138,121), + (270,140,121), + (271,141,121), + (272,143,121), + (273,145,121), + (274,131,122), + (275,133,122), + (276,135,122), + (277,137,122)] + +def triangleEdgeData_10 : List (Fin 372 × Fin 372 × Fin 372) := [ + (278,139,122), + (279,142,122), + (280,144,122), + (281,146,122), + (296,131,123), + (297,132,123), + (302,133,124), + (303,134,124), + (308,135,125), + (309,136,125), + (314,137,126), + (315,138,126), + (320,139,127), + (321,140,127), + (340,141,128), + (341,142,128)] + +def triangleEdgeData_11 : List (Fin 372 × Fin 372 × Fin 372) := [ + (352,143,129), + (353,144,129), + (364,145,130), + (365,146,130), + (282,168,147), + (283,188,147), + (284,168,148), + (285,169,148), + (286,169,149), + (287,170,149), + (288,170,150), + (289,171,150), + (290,171,151), + (291,172,151), + (292,172,152), + (293,173,152)] + +def triangleEdgeData_12 : List (Fin 372 × Fin 372 × Fin 372) := [ + (294,173,153), + (295,174,153), + (296,174,154), + (297,175,154), + (298,175,155), + (299,176,155), + (300,176,156), + (301,177,156), + (302,177,157), + (303,178,157), + (304,178,158), + (305,179,158), + (306,179,159), + (307,180,159), + (308,180,160), + (309,181,160)] + +def triangleEdgeData_13 : List (Fin 372 × Fin 372 × Fin 372) := [ + (310,181,161), + (311,182,161), + (312,182,162), + (313,183,162), + (314,183,163), + (315,184,163), + (316,184,164), + (317,185,164), + (318,185,165), + (319,186,165), + (320,186,166), + (321,187,166), + (322,187,167), + (323,188,167), + (324,213,189), + (325,236,189)] + +def triangleEdgeData_14 : List (Fin 372 × Fin 372 × Fin 372) := [ + (326,213,190), + (327,214,190), + (328,214,191), + (329,215,191), + (330,215,192), + (331,216,192), + (332,216,193), + (333,217,193), + (334,217,194), + (335,218,194), + (336,218,195), + (337,219,195), + (338,219,196), + (339,220,196), + (340,220,197), + (341,221,197)] + +def triangleEdgeData_15 : List (Fin 372 × Fin 372 × Fin 372) := [ + (342,221,198), + (343,222,198), + (344,222,199), + (345,223,199), + (346,223,200), + (347,224,200), + (348,224,201), + (349,225,201), + (350,225,202), + (351,226,202), + (352,226,203), + (353,227,203), + (354,227,204), + (355,228,204), + (356,228,205), + (357,229,205)] + +def triangleEdgeData_16 : List (Fin 372 × Fin 372 × Fin 372) := [ + (358,229,206), + (359,230,206), + (360,230,207), + (361,231,207), + (362,231,208), + (363,232,208), + (364,232,209), + (365,233,209), + (366,233,210), + (367,234,210), + (368,234,211), + (369,235,211), + (370,235,212), + (371,236,212)] + +def triangleEdgeData : List (Fin 372 × Fin 372 × Fin 372) := [triangleEdgeData_0,triangleEdgeData_1,triangleEdgeData_2,triangleEdgeData_3,triangleEdgeData_4,triangleEdgeData_5,triangleEdgeData_6,triangleEdgeData_7,triangleEdgeData_8,triangleEdgeData_9,triangleEdgeData_10,triangleEdgeData_11,triangleEdgeData_12,triangleEdgeData_13,triangleEdgeData_14,triangleEdgeData_15,triangleEdgeData_16].flatten + +def edge (e : Fin 372) : Fin 103 × Fin 103 := edgeData.getD e.val (0,0) +def triangleEdges (t : Fin 270) : Fin 372 × Fin 372 × Fin 372 := + triangleEdgeData.getD t.val (0,0,0) +def triangle (t : Fin 270) : Fin 103 × Fin 103 × Fin 103 := + ((edge (triangleEdges t).2.2).1,(edge (triangleEdges t).2.2).2, + (edge (triangleEdges t).1).2) +def edgeLookupCodes_0 : List ℕ := [ +539308444549082356491752287909326183426464912366339139781129275178863916183935784697545588561881155762728260682345972670060416696876225432522252714072845974688325235239916136445621603303845709788079501054819797455545459152796807710230896398097542351676936324040692200595397156860396293377773231214769324687360, +798494385964783801143608826032965403140977342049928697190365372535310697209048811264676733180033956852196987546018861884172872086035816854132865449803533653731351945270377344793394695381665482860124458693186222147656939956350863819080464639432715829750053259145346874197799978907023390893592477163043145383936, +1032387827937896701936999347097236551693905144394577639124200286695598642925199909094821986611074343810155524683346113527032504172512929739408948259436470887823449221440818458968284597631224047201777603335447575643157087950602789437247149806822943141981229487422757983248555496472872278645363095269653086208, +1227431811162305011616494391569921538066725297217451758593339146680570242602422105775973732280028000445395431755498796189549993047440367773266567159143686638500912515102786283150425818079438313775233888034455925753784251790014568730990740621861692432328386488949034824047556274534105294242651832320, +1529218593185593780992386251337889671275517429626312788471185376766237507998661442998244821126555289608058121021326215327298212263035612554355603818593632632366190010903576641690757999226741840976037058671880300770519223722199137497194509100910088885351914645103311095294119195116094448307598350352384, +1196675864571150401516528216380653912802418752795291780028657428993776888722459038110017505120398351103732672361286816204322660269274811012807720991223823320519687240637009183021430337509433213724369886758051538385002455557923674779549696, +2654178362004863499238265706443280593203245108170597463794461375685477716122751997321391831422752866401740697670288527293272183367478580954432066527644705872269975931439293468963002848585639539314109127634550739286331541262437734163025643906154482777589271651577174328551039699158578973116449075348141558988800, +2730246448572142287222248249269631093664924786693548868506890145819922899481162462438562083519182065769767651405449718099610134106275904219948082631539477187198015464924326724976203632679714848731114036987319818608680493233279978129935271914721101293903556707078737730030991118052291050554050738171353524862976, +2743062034396844343997678270943799725959330023168550399064946236750171955952951956306506596584346365945732302040042574276952026844306435640763769988839014179323182992053281300070489984043040019597414388365987658377079736031202740593457472327253636858212589368120404321185541783954055359385686610532240457728, +2753777120468707017216679429648657555675299740560145397429702066978119760636416461324143666331518005441460015474577528586259130144708809356511564772308163510423830837839965336919061923152342734365095912881892789698777343884746556441432017621140575145058740455701929787274178999174423865065121390545338368, +2644488410133503752729766330679270302620347895575680336413021429746389909425847482609469099509330044651673384061576217262485171998179187347122896259462153577335095901894885149561835987406417023500527933980964264073640301799478418295978604495611784386708698849443245801643821282283184219507130368, +2789705751055249966351632240625415946744831959974004638270325607901435856745935371984448185915035667857372272438703593346830953680827012952405676397411148673749060041386863250371936274628239279569752293990023695194647339626275502458441822455281075557204717421727924311057958788595487336490596302848, +2940370299017003100065775368842505322092981939075596914744753502613505505136206203794894786014252715409252327535266198445782324964446989287542408831976266180196508776663973626054687402580030659107865598022230342254785256054817645714221986925655032467059235645009503873019514595494212380998792208449536, +1799629292016028174938772255682102161972014050689126977340833788769352877371219803561766504053205919065558106484553724118760589248856161840286364059636524187388342730337610728137589063974043498152669833817633751391008599231600187083325440, +1156018339198867022526243815205494651869163363597478520368892099169304143792328242644184133497833012392659682682456619013898850548509206247368951248207767036551533387314665382477824, +1192069914999997287673270577044417617615171247972350227167307128226970800922442227596667403727505187090758129976555467145451085129353694911545228044385391751638218843587730139277950976] +def edgeLookupCodes_1 : List ℕ := [ +1229186099876203258142379507014050520797510872699783628264313596830283938407977302759106820867306874359227130763545964974765821232162777728803481610860574779236011518530808757144176820224, +1267397229355427116756305861769848218784856460775301758883128007020697371311486734806247649605271999628818366905445510750811884842872188793021081297173000606509554627817248616107757405208576, +1306734481856125027507010670957884113175615270815769684401765264268476405445841624665261992593839882151719067554836432248282694393865925828349334963020567182419387863714763842457474812423962624, +1347229901672747711954497678810566297923110426416773496532180428132104911532770132878260625399686386363932802456060581363439635157637867860628564662001645305623543591469737064469100586920287666176, +1388916422579019157239620024893705486289296195090635608306640103068968943502334404709676001672479471006213406449631903851149098246099996337180068169595115332044425226747449297164028893100480107905024, +1431827892065428129216342452925840469509455169055227039912271306476198356577394885992461437886136404352777854140679958923403274332957507568718321792307758972037470019409805148479179556039255701141323776, +1475999096227779216813377536369179157564079139161746654124588182947607055368600925759707801661085522324677816398783332662507388991394425741480195869644922720318923373189347549862290970156666646310812647424, +1521465785324093470012641690564912818534887613656003399044106801217113081448396275981450333109009783390321776801290636684748620867420532462175058149341901059349992905219127938746267724727434705564579582181376, +1568264700017603606536586018701093048037537985341827301646986550370177575116129488880598914372677623726257632880872592100443827617436849116236181225643418883167650074923380722107954683918789391674252301722189824, +1616433598324055551774952392974044538772839479603104893616955121965088107344999619743941312145130730763085584708836937969361989085834314742994025376113388627518369192860031421378284766941886100326784113961626238976, +1666011283282007050707395279665325871467765823709366917475733520743541122837588626303128920035982924626414953828004189826938366660007215094745294005419946310321218262014485486917656512052154228305033083862763620532224, +1717037631365305565590773052339435658477715476792478130061009916513107992323991185396185022909800428494264595368099179697408057852026974098088658970316577450049153505833265969504204208901956700032449776669513699689496576, +1769553621657431973127345498420815487562177280109122085505913556771665791858986616276957216463620446383186204688713798668319977722067517377697932164181124995409284619636427571614441625049607649567278771674682830800891674624, +1823601365807914032219893136635954033503410085870332483409257430050722815568083208917218272734827780083963354849785894222329962704547239197647951403784268474335473714482780969427536015548018317620560867368738440314612587954176, +1879224138791544549332361710478328839928986252194738126090710403038474096919105661713236332350370020425261092964688751214899474659018076774946017557961794512252764137940848748054409018414324123734249751083624101774450791519617024, +1936466410491683972783670117418435327539692110293253928110429386449928223433209976315126941102363027501612759616713468668040261128785695346176545667531262061348867268865361698216981664673256949990446258157219881642740012005537611776] +def edgeLookupCodes_2 : List ℕ := [ +1995373878129486158900225887546431409143912753499234319466466631872981986940165893156761474947017885785864355878487711838232023251698565196603770220246678059162525757930797341108478458358011901211669269713724091462085031418867088359424, +2055993499561459639982052940652938283916473124923572855345002057749747172438758165060436953298141216163919099811287891722640198766101072239332103861187936017923902906924507446520594116700783294088316488780241944700932393517121190154469376, +3651564180189079187575151168790206490161515738476560225866548523516447087100679967024532353689508733326977191018575597845260542557491091109293241670011947979580717350417385549841912539136546118805039121169584138397650868536775549575891753164029441963244459033186921082086065178495527506780214408232072460107776, +2182563544459054957480898675882037950097848853441320509524077456836132243308874035097777848139572595552217568216058000911338216021111136788521198731917903935419822604058623355095999806056842142504400508123368804621690639436243296325004454526976, +2248614499113475977722303940274185439384343980484659813481467644314315693485813157686743452506709024141493796169959931076124405249008748769860452381391211831464393419594034045463153111888325572675200498601408223466673680816189962182451447384244224, +2316578742989700791279787659719847954297334512686497203415326692176314337099099446715763085842939607488017205746356704480295400747417286111513801995569653793852301816455206681915394480511431466420116353929714473984753814374058791862372693332853784576, +2386510068620495033724862550629304339113063208301263624013445648972563869766375649239348097350665394437268238555826626087566756372326004206275072770656979632419906325756029441307156658635998767534927254826585013390984990302555199948713067053303279386624, +2458463748525605332151523878610415997978271616626231410411107087520339822943512028202756909873316485946170223029641202470206486916399828412784652592999048990653496925657013494100940154089770714578591091946641823151700044478539977759085052040974626168242176, +2532496575266635519763239429505458537169680904142816122708424530424600825084165520982447480892980846580303636252790722382586486074918736402783877804897639257814026008309609308470632335089949379790250675149681246813216213900557753109184433581431494906451329024, +2608666902572084407708998049089383518627442353009020191903616412905854639589554918487318411341502066228970459262186345918137886256582705675137301867073794405579644072700351282157467599249380913000472649877505297120349780229212742648899352445854691959421613899776, +2687034687560841260216769456501941755077766615220015794333497453216684067115954527732337256702557947453143034881551351927303383830987392280395686770618783960225510925201062535619591871863453348962026095003378685444061345202436450420729697182027297929868356484071424, +2767661534093176921026073508594027301970977035221805990049476300408599534891217734588068311236011805785928007146110858889659977866479712204237595063658498507916765511635932526909375408225833618443845833248964553356169743820962869625842132438527376684327915862806757376, +2850610737279029648988339295979587836664136761813315386062286037732674135097034785564900630127210775940953647691277448607499561666589014746470407039184242934336110423926760465760551669415414791731790791899616596805243566238341953557357624281762611495393929918386561613824, +2935947329174165637986282822818705117296632872508929472833442144099268962780633713573498172977915353863287824450495874777075001341852471496500753134778555798083023835072845848541084590906957781173333453365548534757139778359314358904681374665188545808420939769097219762814976, +3023738125695595433378310355511615784805570253743128566107241866813726321891229498090023015122500478118952052393086609592392142374008618898038588888506825555359611490349761515666805014868511555188032651085711026570967188367940154743427627075432629704251899189008998843467956224, +3114051774788449539541675110867842590207373768742004072481831913543476455316572235244322714742390409095062909490038214054972910974935354351268256324608419812845779531350967175605800354455857502673481570227302762035838201544645023711704603129561281024697094199769543321408898072576] +def edgeLookupCodes_3 : List ℕ := [ +3206958805877359979831255467716393591576415843994669561108324511200969888784922075591128946687324496482630571345465077644632338594699144141767677570443110663171396502101789244588843390654831792982443730680665531251718146253331792861326659721092658413814009477113724750957167587098624, +3302531680636259974319959676829815163679212491568667598843139218363821964621490362667081147881923803189162724734086168675299754343490033078104740520434892224500443918438592615789923551587190275304696149451338786999027685503945811396472633177614914619738311161511359632170622513028530176, +3400844845111401809195738884831276328534195362700076612722026636552039181442273812407138564460571977707634426276266084190715897821192337976360324309745704069031298886374351918203772386451284781665658796734132295676207092986347383708617489204050889752300622457301263482225771946872903041024, +3501974783233303966400347198042953655767938185250649706730167002623513263218832889285822498293815276492355811763023802017715043527322503250679187790403664384178322637074007037786790969423141602733372146104415921628579672081053958704380930083045485500404955428060052173935438274974301370187776, +3606000071754273259708679964691128679543664966754735065121770218923764126352156052138736749137924964159584226323610761035916295870201909671490973171330793268908641499648693976404909071483051611178096316777554301424356639686746313206924852450450288531920971222879857195081406542183168026999783424, +3713001436649106696011166104152343363154904301376312146485093813412915887276264679064362250263534679235580007835530392377029004460467789838629333038375151829420728953788011260022931650843449570464992825286847179879472839846393213645377159675762687909301522521524450267190194473771675085749539045376, +3823061811017561675858579378648034261460065973038874200356346800791446844587951678196385863075670215855867666345659766224158435276645195953819555378490953063914505228222218125524210086387972394069621782726122245222814188189243599428467988932878623090601953803079605009015837335908132978535731061325824, +3936266394528192609281766058643526573106698180063646477017044517527621448299528524831605536646636462258689438379762084509940910065429888115591857895102208670210236423951885026083776678207746486254685094255117289727025344896799281238087440750362883852369048109177009095095209503410248365326268559551102976, +4052702714444187711983971157556701247977767735025137431418050468909876559606778399938674636291877502444513675695686214048095828385356897868259830868612793756643347962065119940229900521425110262765647342590653849954190296153920631461297828693461051043800776216576514724821198412646982206087115276599871668224, +4172460688272902340672935803967929635936539170473063291259542888316384006302555740620580047930981649956996471286267958843404456820442716473501285634704308055031207757827593844480014053750259838573053080232005217513376398472723250109229176891955721239322262701420310667535259948853114968146054705376679822360576, +0, +0, +0, +0, +0, +0] +def edgeLookupCodes_4 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def edgeLookupCodes_5 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def edgeLookupCodes_6 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0] +def edgeLookupCodes : List ℕ := [edgeLookupCodes_0,edgeLookupCodes_1,edgeLookupCodes_2,edgeLookupCodes_3,edgeLookupCodes_4,edgeLookupCodes_5,edgeLookupCodes_6].flatten +def triangleLookupCodes_0 : List ℕ := [ +13294967190722672327635403631087981764154919981897080582554330842249092294775263194477922715455889686138890840707770007378246892529447488991165886118815198159099258842327506663501475934384289129658747857741106779387446195516772979632326571246780444414872038835124894742903521280, +109885262476218376871924296866160913150533682044021661152220457271242472100193684741113876104254617735388509981091103653519468909707703360923130924086172159123903261819743868502552963274301024981339404767223825637569903388432703533859248614854415898347962782985284942299136, +1322529930335160584440694777204285280003964984688105905584588626029735375535456493664810237828321950055558629210387188020243086679066214921045384693822042178256362130242211882077239496894959459279870241403630496971307896543677371929269978180130149681499373389742080, +478766918841696655167265841034159787385582703552910865082659397267834541485140960344502076529873083444648328857745501682276988759444909982734466107419132637536579956649449600549638863027134356608285549561866089221405552100843293014911871113278550088088525673424792584192, +652256851791998314897882745477135954528242135550073558989674691588359370031752069886978243534587085960744212701833906547547000602882154806381427471248106524032226418708778612403085585960654645696082060682140319744, +60926090171221782694573436686486640725556986254891875812103672266538549252485557335008576587493331543867088940163393370116535622229926004108428915985348394991776432128, +8672988336031482040082543481224112597442867659693666745736500213070071835083345982765352860651479745592258970278698761130301577785045725046401022790428495970263199193667469312, +1230590710896269474258835957075909978847128585749397693154962126836384224384640572166663121703375468993593685748163890291904061990801804614745201317991922355944081728571260168117944320, +174095510475444102371473844802169853679302081138638858740172053362069890966752624119638999372893013427680049982699069428744579747497247719942174420094228014088000117216589852507320367984934912, +24565056273876482518646047030038662949159521782899638389745043721333134161083623115006043711392500551716967694067670419086951638451191862266687993056357787854672883709733143662116610562900626077908992, +3457906178127349103174261892931755724689644437154339819932373766895833428486734890168406261718602360998534867973017070481591899292902777958299915141196226709732780567936635939684859489542615130471294717394944, +99712253930420037844647187615551837095479233674217389013632735591105016888844692209184459057832238531764518024802768480194881302749147726201990851085254876409382442566858625492647682133840854662213802562446526529554513275883162541061957588221082477738957692011394273896501870592, +68086976544455123851443014185553577785401142814741534120116820553099548250008495832730620235194995226968347537163627157498552687436328005747276194963420270626046493765648285667006159267799082053419789937034700527117868728320, +9527366886735991160621276470213248102767843487852853031638479498980179869805851907913320235428920378360219628614034828151935750973845208628745997301131623319102338934877950006326042045809535768830031920833314735967393212528691511296, +1330937145942708950183693561926647540961465204074316324556632208796468675352362749138974832452404810748417147224009707920420401221275869974002579658821710019423992253076520148304069931915473011130975210206200144050941416550876306002040324096, +185640935834764777475771402737796666356502209809535908930409940363510419887908639498777291445550917690080029091035405251832652533117130032952236978535189101868272787734350876483066032575867289297235047279311344573110485051026339870294183422053056512] +def triangleLookupCodes_1 : List ℕ := [ +25856577124987281773487090236950460581671140768115929294901153980832139515104858814456571208831234079499646374179355459269729056940802184007243390871574497581220807543210415688107376985323773030175281881352014733193148948462735813891959450221506104559403008, +3596612273344502738523859370257459947515999854844108528229773773797774899461920114940023180599113966813376012631421546118920632321354589683284461435455911147594737503708086130463916244185229096652574038653656642170922911558313217303630599128070321533026664542371840, +499667571229751385815622372821352862903107286556539187147651838106291010461932331151647270834244764025631726214560008018595410351122133764700775397567479038584663480559808996170338378562335083278463482287497494632498257009638086487115091266815097687419761709045341820551168, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_2 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_3 : List ℕ := [ +0, +146244639097949396834020997173330021645114182012520063764157859879918914024466441881050805191526630873038184114795382261805449365352119822640607117984405035947940105805268599953476529675781231208360391140712836091994722840861403544223423866373504191727948262861880286117678284800, +315928582331626005259959602382665871675571801919503796860566929819839216599719783283490465704520075680373549938940402017853896412314855314218864534508541092301295121326134303675808141352654794398834610805944177042645235292598545795096847829785883096577649416454905390931378176, +528232450351730156348427302687715045282448507475427064642085174257409176876082837898726719229617605096392996568951669064240462732602196308089946328944721417732096, +72788826064673282916768264623553037691024603616430369590263744560401442585200136551465823068612070956000000397321861266377411178165053373528406568814253659044995661824000, +436576803934513939977110233074892993126590609099186060963895975685659523655769082669011865700732005528421809757932499867725466647287703214811377298217857276570184487928117956170373868445737087877399409295041077337653248, +60079835142268852957813437752978788852723434365571455644490095119977806868054282274861503060579223979076991030878564672416859766461941197135758609373598507322579168866964387963921412032623010295796513690145040591747592736473088, +567821437046316870563543859090659428973659039695133475306703730218578355023598276682479080497418077182504939466494401023410106793658188652783421947992284163405279238841095423740481894515106435089819744914067559478352857339879345537710351141830656, +10475448441702404762485195524959540357780414890148241670825700001114041173006367340586843977564696624976651182480956703745498945402030176485947095723940045587147912087444918911429962962194121489881612729609351235546669443318541697435789255166054253332208572956672, +193149214102198189627022742329951323332084991270847312138820701748104857772905516878587839531140221302696495092113945828872349053588314976481210815355297737256315270814724889857642394696899887629897494648368868052804620310163474025712497898225441488451404651441897855924106690560, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_4 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +406812147111956773965496629218182891125446297448265522975296776117052904635984454150879428905762326052495867137694870270382435144913018920815377773178499761473939466470357238363608310050866101530453732690291693847940478691711332068019001781824524197860103784427956384263307264, +853723962315235085027361272454469852100399378208581354258391855449932476097338681773409601924146123811549864809666046458677354586702550008271500752047767046246598802035709544322137990790642293257031890782775279412619130545548585221014884825744110126882496793217159219118080, +371427511056364703867098802607987358529620400526307298530902692102600428261750118893621049644308414234511751681334339150812622440375324698387237383010239887152513024, +50820178012646875849284773987588028885087261154127786808513994039107574970772676442191782481242352963713413138164265935420310692626567257590072273629792684923782757473058816, +302754152721668082827219891305882858240929328557681817050531117158307156930715206366862147506695653386196452807032829242525757353453251717021916990287204046449192182541965405973108934490477532493666096605064897210498416640, +41394520592253895195861023462710043372985858217762569288468949202663738761144375789679239801436708670177207922773733658502717051385271054035186179767228452958944465846625253352522198539436559029030516559083867104852163517321576448, +1483164366550955711229120783856444771425846985895751728395639501240108626546139083658489813992297048529234042847700295224491406811675253462523633673171180173768556495674558660109392983423400446078580960737537714414224353807617127573599427756032, +27199733470759428933185504330830037608532505007429851313384029492733014151369476477893467149456540592814311211506187891069298888284013027337361772864756376394823930640546840037690604511648373828835286699166561214557138818358892367823095696113469062344188362752] +def triangleLookupCodes_5 : List ℕ := [ +498659321117078968692958932341839690959566066434799249222670625093113603318902821757340345501383170282534740131715376788511763390804822889352932743927082518402133824573396894967202354460849623415713785538992173579428940497641370131536518186333800798304381424663698487581343744, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +7746246734820226297275874885555707565232111191494709215958558642005709247329543290683206179408140982645670193450993858636552646777673401283688629002856099662223950621791464453316373479204380328190935472067886933609236823316323933112039587307490315228007603667730432] +def triangleLookupCodes_6 : List ℕ := [ +4224034642259042424595178311245771544774277075761758829459944438626882607541207446738246446371342773718655156906754717276234978066642610236050535371083096196798179729302502905916879574013544838936519766055742677795654864977234133639360316078536129731246822274577203200, +8639927619433971788738542594113786102639074143476470483792227425846370239779049591447729874742523122457738202139765327280775645983068683035476858403989487135034494387282659661316096, +1177069777745036436884759733010709194146676536802171801896137739101783940307310758997054717820038046390824371975696485802137984174393618789058140691504039695088578906573898303706345592848384, +160324163303243939983050770224308237156748049744714395960552825078980529375712923361817776189692430988221490758416107472897601083909132891258598518775038606575175092857019710345912199115545656688640, +21832485834358278738062713795146582102503891218227173389481870578265458752535495738361328027432884677731853885183730395059366922128922673772566018162534049239877330785005171231381523883884045975151636905984, +2972469922115601191607463126628792708098337332951607903165856674068496360817316015821294749234613498860547907057070959715766574793127303914279383578053061294054384676406739489659370491681943990513024870973066706944, +14236202776874425758082354664329032806066830555455828749992322425689380723395904453432572289356481041186484868560017658532291846109521819265946253240308870751220051016367188421419545102920349839436455386856581589328499682437779796525056, +260043484994121278592466653335262351842510479319182350799557225910242454220479787962492629984020893197990414762420175192628654307928972906797595558725065880187039751284756556764528045048077680333521857418494889952178908483823677785601177736832029294592, +4749142002217831161907904527253451025198254210517874238928498872244534372306182581539846094428089682953047290616216668328585365946542920632846730275856289088089637737317678141255860775468268146492070842219377245611763335890340241280293883101465966784009469078242590720, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_7 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +4997903584352302105764969420769519358900585512911165840305663695638966770781974709399407690036875067064262773548557034514427181841857612505533648359148989001419521998378449825170848182737471570212521588949862949357272728636115481568159394607106817315152451591978614784, +2691000267972294997071308692792713538701323089217349040084136091204092300625885845920762803601342877840602791214051433133385668792322587779061290543911746312077090401453875815902152825139784200011049140676592755176842026955058027617422258801302327656537843938751884034048, +20935034502289460181017175389187016753333657913322974977685953319927192721917283364764261451427856300099505300183710098240056941963860649416492976752444645305133263621754489667584, +2843911990288277334046063853459374206457890149729676553781023707476785810829950727216503223066387056453359303567921108874046340741044214325013348536308346152564251560779258567153009295360, +386274757602904137378237317898234820998968104164473780997552416534956601461253412793473258876924639526571458662883145250202605414574575168648938208764294024672553642859704619250375840792003477504, +52458476779477953278068766224579422532702541068744546612709677603901959860109914629612723717325777001694109457503335035451242519667473930267226270110668825955118806050305626859263739807957853986917187584, +7123207717752304870920156404508142987217125805983749903606467187279416522667805920424555629906668394004704048462648078393479134725026126483838917621853837916135043187947192401127834704356656990240367637711290368] +def triangleLookupCodes_8 : List ℕ := [ +8920048589965046012420127014222893081320427859240596580377424490352044686493875109981969809547706170337733474278671677824694235320343254219361244533091007717820207425106929882935649008146631602287562271335468945001129883741086897789730816, +162525779737345404835076598823604708434845869802068453104580227060615288230377731104284488208554766030561615214817823411422202184796391412775025522785878989346410561697782028680364097158893204555190602046715154279425905891718235787017161116829241625804800, +2960887061527319147433468816512698602917460605504937432307258304875693223643421444463979427437744686011741393716481268192568997009209814583958007338643670018871430398247841849296749288461641502449646192079431188134722707886365045668370033790660515838020530378998760341504, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_9 : List ℕ := [ +0, +0, +0, +3808338392721022419242476675205213153858446017243977876748082531468781577104570802879596130481970746739925616833879874931021614972289252761026008532075601527194254038830102782454680240606241419831066499058126290944, +1288906949475482757646141766432326064901640094213706450446266881242840845942010309722323307892032061424317246241618879981617875978874798175673649255826598670630912, +667132679308324233616017728958485034897140211430195462730928291973677865243823257569934745740630715479618897035568229735582745752704110965133850194882542985168289792, +345264640248423063202411967233852991777096035646962290090684385664522863291052665119764458414356999941113530365658927575335495170162854535333269489040316134898458951680, +178666162529783868822232502907372362591670416917332225670724344749323601703561125050225831428869669661011038949942743821338943751649896579337219931289994373832065807286272, +92445096577216066193833000238598140617455443754710916513289361427666686669876882206275717196589340340312038580566075762742330355802322757930908612705969605937213763231940608, +47827516384861589273949675002174275373043524632446839543381943471964000904975599814059934055217873824863449712005870944747070213509068015227474237742828591345873834564254695424, +24741449380960538960208309187679387007974329375990625193963383753196881016306808800515430863760386762489413463430098482672674449841841550537893512079462781159369841845122969370624, +12797547710910435436623045004413719052774591559766255893358188773759075107464248574070873851519601728844155225248353813317042662587924621967011949790513829657421967561393937758289920, +6618866349449766361917151080824623082222759157260959583952448033731249732904658453646257715606469342870390147696894568194906115510695101470014679754927470264958246962219476581796020224, +3422918794707655567505051197127384068825562847191857229058817748632500741523262278332532745848270131493157283874115575793401030541502871804374651503161272189602020624898691600049971920896, +1769972745470479747946762772926751293211173379003444813380598837245236029337261787339868949148686315231577503809239619927557186530063284047924114929561435957015254428232197729392835321397248, +915154466841927600809440938457232354910033193085265267447338489441603419655482003544822339800605861446993140876765217305033239256513074038788305044226201883112588439816327864094763529879420928] +def triangleLookupCodes_10 : List ℕ := [ +473130438657520420183111340634095640420324155453832596707230911597386748052626417649475470150187176701654323099238271594064485892932478282260205181192677660791483705537418491259082432104166850560, +244583316629490641280915927438381217344876193816580800758489352499544343163722777335808973989101645999333456931621248987111400082703494480210328668027668458203812930503105083444042719697955935223808, +126425010517161383643176370417717998998807767060889247745472756869748055718144424363564291717789418254038989023453441494047633094771486760910557329041759208490181736330778572474078839889192162795978752, +65343161815052062182668178425336225135123928518496832257330670212981456761068946806371527041617302403286655026133403395427445425765777586152154306587316309186565761148911279219101597334031814019772317696, +33769839741602557921295388260762027408823439514531005270517395921229777405157349549362246002547928402178738008196426109902081385988379622767668869481088974656593138327789531817715112266136187232257799356416, +17450998084556011522593110613888976664813274945326915801744122211027481061707467946937482321811352562623850825222425436848799085560156734169822583802609663492948278757036282201728105828991019871432792090869760, +9017261169362694855415287008393111191710181815917545935351468907717281839090878937395965281442900881066080148607119721178999040765062707959090537692621707244401085793405093945746469978992799682534190546562318336, +4659000995549548447366605507827233961490415032231788021867492988614908607788817554411489082428615296035199321446583100770003430258342486027894739188893320591571278265962297038954572684053604961738133269810851610624, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_11 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +494129613921859298652362729739290214939819313541121727778668889749643772184587036321595417461360951485286013169141965833786663200918840831091533133524806472001544201255527841857045895862699255552992945931236478307626126957511606769436983328366294788666002354744161116437524512768, +1243434857063054261657157665262706628797403999029375016056278169509489336683696653950254789188207348519778881939979293903477872533596601092296017698995656079821274597409442998889829575864402053771922948686542498904932352, +642297706038226420936960399755329911498564771552961333494887021189376360440549932253982457226356510053244250854053069143598550625061598878615453334285751707214582431353832602032583993831592433209827235373652892697441075200] +def triangleLookupCodes_12 : List ℕ := [ +331753863813206558671593510346830862875063652148675921289707325230025820415512154974942444742835639124153197647276410782011612422615929854963376950623092480799064201643023558980390525348152839622876119562135565289245074522112, +171341466693038689189613207561693599264185416326264647592976637752878563474156925253553086149517693491735213494926156883200392665702564395046728598575042604802182245597637030768690199477519540962468195641835954952908963093413888, +88486377018222397613757715366814615929005180289232498424639039993847760330532673105887047982440212352974842774756757220357549962765195624628330597596703672030844733416471551661783270388113831955468194850743552244594917392131293184, +45693912621879801017565935852565559825790682838741758608217109226609508435096064246760916918439611206748803194936996923656447426913627278844280910194168591566321744428519907107838545225593681376334168848827952923289828188382553964544, +23594393707740024041926615775908882583516525245130996747785743347900909353451212730013524618173354848652537287269649485050792587720434891713974555862438350363059704498076866439600156678386217365231934430246506033841694040060869539266560, +12182274126375726060984049866395749650548849088935021101140135307150208198724219169630955404342081924838239917430556951137015855544879419729754770281196739504211290034560788705273332839049456571279756497865267287531005976406974181727535104, +6289519961286942624000856297229389526188665473209841596115952650329677213942485719805432936539855957589186940814875323355149263962570841549800738795942422334738437819446385558257349354887766963999110434531493624696353077403024977587502841856, +3246958371773190914446274080186447478423715948997095622885455883980005289030743667077026153500961776466531862479516409716810961861715671141359122026451002390180195912293195417300353175645292627713528597583856843866537520581467737154819947757568, +1676125451964143209166904184930021129952683609963905202462486533627502512395742538554199369468680858955468805766050126784402176294192676561520776084162296087026847570447278811531747062573080867768070478176045543366933639952684383121837281528250368, +865181807401171287110305812891945549287641422869144292355901263184508066205565091617260210352573075640357528546604980118424135738975707903316829025680219622544094634905826083535725209198475217995168928967248067929190435516240529828048255899968471040, +446559940299111040577104221747056783380228524767625789978116823629688241185029121789322415891036954365703694612988055205495990894246279888453130596489903948047586976636234452770404312248080912226859915831480738639109553856873807614830501712626049875968, +230475159146917059662710716054239972108894536205439847562246246660561076466078165335351093289756924929814699320378552622263718036550142633168918902697746150068529920102751206794504866501909766574178990096245998847218485621469421546342551759087740200681472, +118943553976672904473571364133881278017081378677685908815716699966833548004055767201059384137371099762887222783440497141408506232446049261286315489276242677113187997781888191370528115267994678317161320082828216069740994390128360240072645960351202746812071936, +61380519152703628492715438923771745440977282466911547227936420681451430327029511040214532357317966828395171591601753774191610281051353853127753984190074534600339802353237895609482106310149916747951614585025782133609535560736960843989967575065335045568117866496, +31673312598707573706220717778430093587050956314034129480819656181700651046903024268025169938586588456034347580457970182134817469998249208052180192189804963081588403119180307065473954612780317797128516243273481031429981180788839037472123094236597393801448909701120, +16342937288310215487575618983879195396260630530564887951839162866943062920379872708331775646835905482716348060680111325124367603762281084571110576370837383397275047645953439528393252246919105648284572579335045944551362639093941310884547988500348541067274993539219456] +def triangleLookupCodes_13 : List ℕ := [ +8432198925354062457633909998183517632486999771312282424063314825653960962429643259614548113979124570082872402004859861501802835397354790205186505902333248356749738442181919661703085942832480555232944559162403635717414355775486481706684903808798318852202570399470321664, +4350368747055766827842100775229894257709341036019375214993908870877733739327893346592372273550471952903666993634049394964443882326231892536301771111832451284016462074693467281852839288444098057494624234345095038886159892651456006267126393602774110555115696182712464310272, +2244327241897089882816327491271591673643693152832953256380109082122567406536606384262193107324739648473550498530104596910061933019657283833624602215255183057601053730298773348819813669968878628203510197452308181137921861194681822157020219625187062711246682276298815451430912, +1157768030874433100686079685440244473518184291954681038173868453046136390931113664035374904622918480414936830115622862642344242323601325408595301182081101341586267585717499622057458495618242074096523666903002983611458486964130902581899123571585935778956353590809010778113310720, +597217543115548764861542244018910213186968417105351684649533980695305354094328247976195552407331973535444892151722071893369228769862718205119900687335193066332567378699277972233816264812758164763059257707737179381914102270251372656334794083878960870274255798350350359088125181952, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_14 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_15 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_16 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_17 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_18 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_19 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_20 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_21 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_22 : List ℕ := [ +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0] +def triangleLookupCodes_23 : List ℕ := [ +0, +0, +0, +0] +def triangleLookupCodes : List ℕ := [triangleLookupCodes_0,triangleLookupCodes_1,triangleLookupCodes_2,triangleLookupCodes_3,triangleLookupCodes_4,triangleLookupCodes_5,triangleLookupCodes_6,triangleLookupCodes_7,triangleLookupCodes_8,triangleLookupCodes_9,triangleLookupCodes_10,triangleLookupCodes_11,triangleLookupCodes_12,triangleLookupCodes_13,triangleLookupCodes_14,triangleLookupCodes_15,triangleLookupCodes_16,triangleLookupCodes_17,triangleLookupCodes_18,triangleLookupCodes_19,triangleLookupCodes_20,triangleLookupCodes_21,triangleLookupCodes_22,triangleLookupCodes_23].flatten +def edgeIndex (a b : Fin 103) : Fin 372 := + ⟨((edgeLookupCodes.getD a.val 0 >>> (10*b.val)) % 1024) % 372, + Nat.mod_lt _ (by decide)⟩ +def triangleIndex (e : Fin 372) (c : Fin 103) : Fin 270 := + ⟨((triangleLookupCodes.getD e.val 0 >>> (9*c.val)) % 512) % 270, + Nat.mod_lt _ (by decide)⟩ +theorem edge_complete_0 : ∀ b : Fin 103, + 0 < b → SeedEncoding.indexedAdj 0 b → + edge (edgeIndex 0 b) = (0,b) := by decide +kernel +theorem edge_complete_1 : ∀ b : Fin 103, + 1 < b → SeedEncoding.indexedAdj 1 b → + edge (edgeIndex 1 b) = (1,b) := by decide +kernel +theorem edge_complete_2 : ∀ b : Fin 103, + 2 < b → SeedEncoding.indexedAdj 2 b → + edge (edgeIndex 2 b) = (2,b) := by decide +kernel +theorem edge_complete_3 : ∀ b : Fin 103, + 3 < b → SeedEncoding.indexedAdj 3 b → + edge (edgeIndex 3 b) = (3,b) := by decide +kernel +theorem edge_complete_4 : ∀ b : Fin 103, + 4 < b → SeedEncoding.indexedAdj 4 b → + edge (edgeIndex 4 b) = (4,b) := by decide +kernel +theorem edge_complete_5 : ∀ b : Fin 103, + 5 < b → SeedEncoding.indexedAdj 5 b → + edge (edgeIndex 5 b) = (5,b) := by decide +kernel +theorem edge_complete_6 : ∀ b : Fin 103, + 6 < b → SeedEncoding.indexedAdj 6 b → + edge (edgeIndex 6 b) = (6,b) := by decide +kernel +theorem edge_complete_7 : ∀ b : Fin 103, + 7 < b → SeedEncoding.indexedAdj 7 b → + edge (edgeIndex 7 b) = (7,b) := by decide +kernel +theorem edge_complete_8 : ∀ b : Fin 103, + 8 < b → SeedEncoding.indexedAdj 8 b → + edge (edgeIndex 8 b) = (8,b) := by decide +kernel +theorem edge_complete_9 : ∀ b : Fin 103, + 9 < b → SeedEncoding.indexedAdj 9 b → + edge (edgeIndex 9 b) = (9,b) := by decide +kernel +theorem edge_complete_10 : ∀ b : Fin 103, + 10 < b → SeedEncoding.indexedAdj 10 b → + edge (edgeIndex 10 b) = (10,b) := by decide +kernel +theorem edge_complete_11 : ∀ b : Fin 103, + 11 < b → SeedEncoding.indexedAdj 11 b → + edge (edgeIndex 11 b) = (11,b) := by decide +kernel +theorem edge_complete_12 : ∀ b : Fin 103, + 12 < b → SeedEncoding.indexedAdj 12 b → + edge (edgeIndex 12 b) = (12,b) := by decide +kernel +theorem edge_complete_13 : ∀ b : Fin 103, + 13 < b → SeedEncoding.indexedAdj 13 b → + edge (edgeIndex 13 b) = (13,b) := by decide +kernel +theorem edge_complete_14 : ∀ b : Fin 103, + 14 < b → SeedEncoding.indexedAdj 14 b → + edge (edgeIndex 14 b) = (14,b) := by decide +kernel +theorem edge_complete_15 : ∀ b : Fin 103, + 15 < b → SeedEncoding.indexedAdj 15 b → + edge (edgeIndex 15 b) = (15,b) := by decide +kernel +theorem edge_complete_16 : ∀ b : Fin 103, + 16 < b → SeedEncoding.indexedAdj 16 b → + edge (edgeIndex 16 b) = (16,b) := by decide +kernel +theorem edge_complete_17 : ∀ b : Fin 103, + 17 < b → SeedEncoding.indexedAdj 17 b → + edge (edgeIndex 17 b) = (17,b) := by decide +kernel +theorem edge_complete_18 : ∀ b : Fin 103, + 18 < b → SeedEncoding.indexedAdj 18 b → + edge (edgeIndex 18 b) = (18,b) := by decide +kernel +theorem edge_complete_19 : ∀ b : Fin 103, + 19 < b → SeedEncoding.indexedAdj 19 b → + edge (edgeIndex 19 b) = (19,b) := by decide +kernel +theorem edge_complete_20 : ∀ b : Fin 103, + 20 < b → SeedEncoding.indexedAdj 20 b → + edge (edgeIndex 20 b) = (20,b) := by decide +kernel +theorem edge_complete_21 : ∀ b : Fin 103, + 21 < b → SeedEncoding.indexedAdj 21 b → + edge (edgeIndex 21 b) = (21,b) := by decide +kernel +theorem edge_complete_22 : ∀ b : Fin 103, + 22 < b → SeedEncoding.indexedAdj 22 b → + edge (edgeIndex 22 b) = (22,b) := by decide +kernel +theorem edge_complete_23 : ∀ b : Fin 103, + 23 < b → SeedEncoding.indexedAdj 23 b → + edge (edgeIndex 23 b) = (23,b) := by decide +kernel +theorem edge_complete_24 : ∀ b : Fin 103, + 24 < b → SeedEncoding.indexedAdj 24 b → + edge (edgeIndex 24 b) = (24,b) := by decide +kernel +theorem edge_complete_25 : ∀ b : Fin 103, + 25 < b → SeedEncoding.indexedAdj 25 b → + edge (edgeIndex 25 b) = (25,b) := by decide +kernel +theorem edge_complete_26 : ∀ b : Fin 103, + 26 < b → SeedEncoding.indexedAdj 26 b → + edge (edgeIndex 26 b) = (26,b) := by decide +kernel +theorem edge_complete_27 : ∀ b : Fin 103, + 27 < b → SeedEncoding.indexedAdj 27 b → + edge (edgeIndex 27 b) = (27,b) := by decide +kernel +theorem edge_complete_28 : ∀ b : Fin 103, + 28 < b → SeedEncoding.indexedAdj 28 b → + edge (edgeIndex 28 b) = (28,b) := by decide +kernel +theorem edge_complete_29 : ∀ b : Fin 103, + 29 < b → SeedEncoding.indexedAdj 29 b → + edge (edgeIndex 29 b) = (29,b) := by decide +kernel +theorem edge_complete_30 : ∀ b : Fin 103, + 30 < b → SeedEncoding.indexedAdj 30 b → + edge (edgeIndex 30 b) = (30,b) := by decide +kernel +theorem edge_complete_31 : ∀ b : Fin 103, + 31 < b → SeedEncoding.indexedAdj 31 b → + edge (edgeIndex 31 b) = (31,b) := by decide +kernel +theorem edge_complete_32 : ∀ b : Fin 103, + 32 < b → SeedEncoding.indexedAdj 32 b → + edge (edgeIndex 32 b) = (32,b) := by decide +kernel +theorem edge_complete_33 : ∀ b : Fin 103, + 33 < b → SeedEncoding.indexedAdj 33 b → + edge (edgeIndex 33 b) = (33,b) := by decide +kernel +theorem edge_complete_34 : ∀ b : Fin 103, + 34 < b → SeedEncoding.indexedAdj 34 b → + edge (edgeIndex 34 b) = (34,b) := by decide +kernel +theorem edge_complete_35 : ∀ b : Fin 103, + 35 < b → SeedEncoding.indexedAdj 35 b → + edge (edgeIndex 35 b) = (35,b) := by decide +kernel +theorem edge_complete_36 : ∀ b : Fin 103, + 36 < b → SeedEncoding.indexedAdj 36 b → + edge (edgeIndex 36 b) = (36,b) := by decide +kernel +theorem edge_complete_37 : ∀ b : Fin 103, + 37 < b → SeedEncoding.indexedAdj 37 b → + edge (edgeIndex 37 b) = (37,b) := by decide +kernel +theorem edge_complete_38 : ∀ b : Fin 103, + 38 < b → SeedEncoding.indexedAdj 38 b → + edge (edgeIndex 38 b) = (38,b) := by decide +kernel +theorem edge_complete_39 : ∀ b : Fin 103, + 39 < b → SeedEncoding.indexedAdj 39 b → + edge (edgeIndex 39 b) = (39,b) := by decide +kernel +theorem edge_complete_40 : ∀ b : Fin 103, + 40 < b → SeedEncoding.indexedAdj 40 b → + edge (edgeIndex 40 b) = (40,b) := by decide +kernel +theorem edge_complete_41 : ∀ b : Fin 103, + 41 < b → SeedEncoding.indexedAdj 41 b → + edge (edgeIndex 41 b) = (41,b) := by decide +kernel +theorem edge_complete_42 : ∀ b : Fin 103, + 42 < b → SeedEncoding.indexedAdj 42 b → + edge (edgeIndex 42 b) = (42,b) := by decide +kernel +theorem edge_complete_43 : ∀ b : Fin 103, + 43 < b → SeedEncoding.indexedAdj 43 b → + edge (edgeIndex 43 b) = (43,b) := by decide +kernel +theorem edge_complete_44 : ∀ b : Fin 103, + 44 < b → SeedEncoding.indexedAdj 44 b → + edge (edgeIndex 44 b) = (44,b) := by decide +kernel +theorem edge_complete_45 : ∀ b : Fin 103, + 45 < b → SeedEncoding.indexedAdj 45 b → + edge (edgeIndex 45 b) = (45,b) := by decide +kernel +theorem edge_complete_46 : ∀ b : Fin 103, + 46 < b → SeedEncoding.indexedAdj 46 b → + edge (edgeIndex 46 b) = (46,b) := by decide +kernel +theorem edge_complete_47 : ∀ b : Fin 103, + 47 < b → SeedEncoding.indexedAdj 47 b → + edge (edgeIndex 47 b) = (47,b) := by decide +kernel +theorem edge_complete_48 : ∀ b : Fin 103, + 48 < b → SeedEncoding.indexedAdj 48 b → + edge (edgeIndex 48 b) = (48,b) := by decide +kernel +theorem edge_complete_49 : ∀ b : Fin 103, + 49 < b → SeedEncoding.indexedAdj 49 b → + edge (edgeIndex 49 b) = (49,b) := by decide +kernel +theorem edge_complete_50 : ∀ b : Fin 103, + 50 < b → SeedEncoding.indexedAdj 50 b → + edge (edgeIndex 50 b) = (50,b) := by decide +kernel +theorem edge_complete_51 : ∀ b : Fin 103, + 51 < b → SeedEncoding.indexedAdj 51 b → + edge (edgeIndex 51 b) = (51,b) := by decide +kernel +theorem edge_complete_52 : ∀ b : Fin 103, + 52 < b → SeedEncoding.indexedAdj 52 b → + edge (edgeIndex 52 b) = (52,b) := by decide +kernel +theorem edge_complete_53 : ∀ b : Fin 103, + 53 < b → SeedEncoding.indexedAdj 53 b → + edge (edgeIndex 53 b) = (53,b) := by decide +kernel +theorem edge_complete_54 : ∀ b : Fin 103, + 54 < b → SeedEncoding.indexedAdj 54 b → + edge (edgeIndex 54 b) = (54,b) := by decide +kernel +theorem edge_complete_55 : ∀ b : Fin 103, + 55 < b → SeedEncoding.indexedAdj 55 b → + edge (edgeIndex 55 b) = (55,b) := by decide +kernel +theorem edge_complete_56 : ∀ b : Fin 103, + 56 < b → SeedEncoding.indexedAdj 56 b → + edge (edgeIndex 56 b) = (56,b) := by decide +kernel +theorem edge_complete_57 : ∀ b : Fin 103, + 57 < b → SeedEncoding.indexedAdj 57 b → + edge (edgeIndex 57 b) = (57,b) := by decide +kernel +theorem edge_complete_58 : ∀ b : Fin 103, + 58 < b → SeedEncoding.indexedAdj 58 b → + edge (edgeIndex 58 b) = (58,b) := by decide +kernel +theorem edge_complete_59 : ∀ b : Fin 103, + 59 < b → SeedEncoding.indexedAdj 59 b → + edge (edgeIndex 59 b) = (59,b) := by decide +kernel +theorem edge_complete_60 : ∀ b : Fin 103, + 60 < b → SeedEncoding.indexedAdj 60 b → + edge (edgeIndex 60 b) = (60,b) := by decide +kernel +theorem edge_complete_61 : ∀ b : Fin 103, + 61 < b → SeedEncoding.indexedAdj 61 b → + edge (edgeIndex 61 b) = (61,b) := by decide +kernel +theorem edge_complete_62 : ∀ b : Fin 103, + 62 < b → SeedEncoding.indexedAdj 62 b → + edge (edgeIndex 62 b) = (62,b) := by decide +kernel +theorem edge_complete_63 : ∀ b : Fin 103, + 63 < b → SeedEncoding.indexedAdj 63 b → + edge (edgeIndex 63 b) = (63,b) := by decide +kernel +theorem edge_complete_64 : ∀ b : Fin 103, + 64 < b → SeedEncoding.indexedAdj 64 b → + edge (edgeIndex 64 b) = (64,b) := by decide +kernel +theorem edge_complete_65 : ∀ b : Fin 103, + 65 < b → SeedEncoding.indexedAdj 65 b → + edge (edgeIndex 65 b) = (65,b) := by decide +kernel +theorem edge_complete_66 : ∀ b : Fin 103, + 66 < b → SeedEncoding.indexedAdj 66 b → + edge (edgeIndex 66 b) = (66,b) := by decide +kernel +theorem edge_complete_67 : ∀ b : Fin 103, + 67 < b → SeedEncoding.indexedAdj 67 b → + edge (edgeIndex 67 b) = (67,b) := by decide +kernel +theorem edge_complete_68 : ∀ b : Fin 103, + 68 < b → SeedEncoding.indexedAdj 68 b → + edge (edgeIndex 68 b) = (68,b) := by decide +kernel +theorem edge_complete_69 : ∀ b : Fin 103, + 69 < b → SeedEncoding.indexedAdj 69 b → + edge (edgeIndex 69 b) = (69,b) := by decide +kernel +theorem edge_complete_70 : ∀ b : Fin 103, + 70 < b → SeedEncoding.indexedAdj 70 b → + edge (edgeIndex 70 b) = (70,b) := by decide +kernel +theorem edge_complete_71 : ∀ b : Fin 103, + 71 < b → SeedEncoding.indexedAdj 71 b → + edge (edgeIndex 71 b) = (71,b) := by decide +kernel +theorem edge_complete_72 : ∀ b : Fin 103, + 72 < b → SeedEncoding.indexedAdj 72 b → + edge (edgeIndex 72 b) = (72,b) := by decide +kernel +theorem edge_complete_73 : ∀ b : Fin 103, + 73 < b → SeedEncoding.indexedAdj 73 b → + edge (edgeIndex 73 b) = (73,b) := by decide +kernel +theorem edge_complete_74 : ∀ b : Fin 103, + 74 < b → SeedEncoding.indexedAdj 74 b → + edge (edgeIndex 74 b) = (74,b) := by decide +kernel +theorem edge_complete_75 : ∀ b : Fin 103, + 75 < b → SeedEncoding.indexedAdj 75 b → + edge (edgeIndex 75 b) = (75,b) := by decide +kernel +theorem edge_complete_76 : ∀ b : Fin 103, + 76 < b → SeedEncoding.indexedAdj 76 b → + edge (edgeIndex 76 b) = (76,b) := by decide +kernel +theorem edge_complete_77 : ∀ b : Fin 103, + 77 < b → SeedEncoding.indexedAdj 77 b → + edge (edgeIndex 77 b) = (77,b) := by decide +kernel +theorem edge_complete_78 : ∀ b : Fin 103, + 78 < b → SeedEncoding.indexedAdj 78 b → + edge (edgeIndex 78 b) = (78,b) := by decide +kernel +theorem edge_complete_79 : ∀ b : Fin 103, + 79 < b → SeedEncoding.indexedAdj 79 b → + edge (edgeIndex 79 b) = (79,b) := by decide +kernel +theorem edge_complete_80 : ∀ b : Fin 103, + 80 < b → SeedEncoding.indexedAdj 80 b → + edge (edgeIndex 80 b) = (80,b) := by decide +kernel +theorem edge_complete_81 : ∀ b : Fin 103, + 81 < b → SeedEncoding.indexedAdj 81 b → + edge (edgeIndex 81 b) = (81,b) := by decide +kernel +theorem edge_complete_82 : ∀ b : Fin 103, + 82 < b → SeedEncoding.indexedAdj 82 b → + edge (edgeIndex 82 b) = (82,b) := by decide +kernel +theorem edge_complete_83 : ∀ b : Fin 103, + 83 < b → SeedEncoding.indexedAdj 83 b → + edge (edgeIndex 83 b) = (83,b) := by decide +kernel +theorem edge_complete_84 : ∀ b : Fin 103, + 84 < b → SeedEncoding.indexedAdj 84 b → + edge (edgeIndex 84 b) = (84,b) := by decide +kernel +theorem edge_complete_85 : ∀ b : Fin 103, + 85 < b → SeedEncoding.indexedAdj 85 b → + edge (edgeIndex 85 b) = (85,b) := by decide +kernel +theorem edge_complete_86 : ∀ b : Fin 103, + 86 < b → SeedEncoding.indexedAdj 86 b → + edge (edgeIndex 86 b) = (86,b) := by decide +kernel +theorem edge_complete_87 : ∀ b : Fin 103, + 87 < b → SeedEncoding.indexedAdj 87 b → + edge (edgeIndex 87 b) = (87,b) := by decide +kernel +theorem edge_complete_88 : ∀ b : Fin 103, + 88 < b → SeedEncoding.indexedAdj 88 b → + edge (edgeIndex 88 b) = (88,b) := by decide +kernel +theorem edge_complete_89 : ∀ b : Fin 103, + 89 < b → SeedEncoding.indexedAdj 89 b → + edge (edgeIndex 89 b) = (89,b) := by decide +kernel +theorem edge_complete_90 : ∀ b : Fin 103, + 90 < b → SeedEncoding.indexedAdj 90 b → + edge (edgeIndex 90 b) = (90,b) := by decide +kernel +theorem edge_complete_91 : ∀ b : Fin 103, + 91 < b → SeedEncoding.indexedAdj 91 b → + edge (edgeIndex 91 b) = (91,b) := by decide +kernel +theorem edge_complete_92 : ∀ b : Fin 103, + 92 < b → SeedEncoding.indexedAdj 92 b → + edge (edgeIndex 92 b) = (92,b) := by decide +kernel +theorem edge_complete_93 : ∀ b : Fin 103, + 93 < b → SeedEncoding.indexedAdj 93 b → + edge (edgeIndex 93 b) = (93,b) := by decide +kernel +theorem edge_complete_94 : ∀ b : Fin 103, + 94 < b → SeedEncoding.indexedAdj 94 b → + edge (edgeIndex 94 b) = (94,b) := by decide +kernel +theorem edge_complete_95 : ∀ b : Fin 103, + 95 < b → SeedEncoding.indexedAdj 95 b → + edge (edgeIndex 95 b) = (95,b) := by decide +kernel +theorem edge_complete_96 : ∀ b : Fin 103, + 96 < b → SeedEncoding.indexedAdj 96 b → + edge (edgeIndex 96 b) = (96,b) := by decide +kernel +theorem edge_complete_97 : ∀ b : Fin 103, + 97 < b → SeedEncoding.indexedAdj 97 b → + edge (edgeIndex 97 b) = (97,b) := by decide +kernel +theorem edge_complete_98 : ∀ b : Fin 103, + 98 < b → SeedEncoding.indexedAdj 98 b → + edge (edgeIndex 98 b) = (98,b) := by decide +kernel +theorem edge_complete_99 : ∀ b : Fin 103, + 99 < b → SeedEncoding.indexedAdj 99 b → + edge (edgeIndex 99 b) = (99,b) := by decide +kernel +theorem edge_complete_100 : ∀ b : Fin 103, + 100 < b → SeedEncoding.indexedAdj 100 b → + edge (edgeIndex 100 b) = (100,b) := by decide +kernel +theorem edge_complete_101 : ∀ b : Fin 103, + 101 < b → SeedEncoding.indexedAdj 101 b → + edge (edgeIndex 101 b) = (101,b) := by decide +kernel +theorem edge_complete_102 : ∀ b : Fin 103, + 102 < b → SeedEncoding.indexedAdj 102 b → + edge (edgeIndex 102 b) = (102,b) := by decide +kernel +theorem triangle_complete_0 : ∀ c : Fin 103, + (edge 0).2 < c → SeedEncoding.indexedAdj (edge 0).1 c → + SeedEncoding.indexedAdj (edge 0).2 c → + triangle (triangleIndex 0 c) = ((edge 0).1,(edge 0).2,c) := by decide +kernel +theorem triangle_complete_1 : ∀ c : Fin 103, + (edge 1).2 < c → SeedEncoding.indexedAdj (edge 1).1 c → + SeedEncoding.indexedAdj (edge 1).2 c → + triangle (triangleIndex 1 c) = ((edge 1).1,(edge 1).2,c) := by decide +kernel +theorem triangle_complete_2 : ∀ c : Fin 103, + (edge 2).2 < c → SeedEncoding.indexedAdj (edge 2).1 c → + SeedEncoding.indexedAdj (edge 2).2 c → + triangle (triangleIndex 2 c) = ((edge 2).1,(edge 2).2,c) := by decide +kernel +theorem triangle_complete_3 : ∀ c : Fin 103, + (edge 3).2 < c → SeedEncoding.indexedAdj (edge 3).1 c → + SeedEncoding.indexedAdj (edge 3).2 c → + triangle (triangleIndex 3 c) = ((edge 3).1,(edge 3).2,c) := by decide +kernel +theorem triangle_complete_4 : ∀ c : Fin 103, + (edge 4).2 < c → SeedEncoding.indexedAdj (edge 4).1 c → + SeedEncoding.indexedAdj (edge 4).2 c → + triangle (triangleIndex 4 c) = ((edge 4).1,(edge 4).2,c) := by decide +kernel +theorem triangle_complete_5 : ∀ c : Fin 103, + (edge 5).2 < c → SeedEncoding.indexedAdj (edge 5).1 c → + SeedEncoding.indexedAdj (edge 5).2 c → + triangle (triangleIndex 5 c) = ((edge 5).1,(edge 5).2,c) := by decide +kernel +theorem triangle_complete_6 : ∀ c : Fin 103, + (edge 6).2 < c → SeedEncoding.indexedAdj (edge 6).1 c → + SeedEncoding.indexedAdj (edge 6).2 c → + triangle (triangleIndex 6 c) = ((edge 6).1,(edge 6).2,c) := by decide +kernel +theorem triangle_complete_7 : ∀ c : Fin 103, + (edge 7).2 < c → SeedEncoding.indexedAdj (edge 7).1 c → + SeedEncoding.indexedAdj (edge 7).2 c → + triangle (triangleIndex 7 c) = ((edge 7).1,(edge 7).2,c) := by decide +kernel +theorem triangle_complete_8 : ∀ c : Fin 103, + (edge 8).2 < c → SeedEncoding.indexedAdj (edge 8).1 c → + SeedEncoding.indexedAdj (edge 8).2 c → + triangle (triangleIndex 8 c) = ((edge 8).1,(edge 8).2,c) := by decide +kernel +theorem triangle_complete_9 : ∀ c : Fin 103, + (edge 9).2 < c → SeedEncoding.indexedAdj (edge 9).1 c → + SeedEncoding.indexedAdj (edge 9).2 c → + triangle (triangleIndex 9 c) = ((edge 9).1,(edge 9).2,c) := by decide +kernel +theorem triangle_complete_10 : ∀ c : Fin 103, + (edge 10).2 < c → SeedEncoding.indexedAdj (edge 10).1 c → + SeedEncoding.indexedAdj (edge 10).2 c → + triangle (triangleIndex 10 c) = ((edge 10).1,(edge 10).2,c) := by decide +kernel +theorem triangle_complete_11 : ∀ c : Fin 103, + (edge 11).2 < c → SeedEncoding.indexedAdj (edge 11).1 c → + SeedEncoding.indexedAdj (edge 11).2 c → + triangle (triangleIndex 11 c) = ((edge 11).1,(edge 11).2,c) := by decide +kernel +theorem triangle_complete_12 : ∀ c : Fin 103, + (edge 12).2 < c → SeedEncoding.indexedAdj (edge 12).1 c → + SeedEncoding.indexedAdj (edge 12).2 c → + triangle (triangleIndex 12 c) = ((edge 12).1,(edge 12).2,c) := by decide +kernel +theorem triangle_complete_13 : ∀ c : Fin 103, + (edge 13).2 < c → SeedEncoding.indexedAdj (edge 13).1 c → + SeedEncoding.indexedAdj (edge 13).2 c → + triangle (triangleIndex 13 c) = ((edge 13).1,(edge 13).2,c) := by decide +kernel +theorem triangle_complete_14 : ∀ c : Fin 103, + (edge 14).2 < c → SeedEncoding.indexedAdj (edge 14).1 c → + SeedEncoding.indexedAdj (edge 14).2 c → + triangle (triangleIndex 14 c) = ((edge 14).1,(edge 14).2,c) := by decide +kernel +theorem triangle_complete_15 : ∀ c : Fin 103, + (edge 15).2 < c → SeedEncoding.indexedAdj (edge 15).1 c → + SeedEncoding.indexedAdj (edge 15).2 c → + triangle (triangleIndex 15 c) = ((edge 15).1,(edge 15).2,c) := by decide +kernel +theorem triangle_complete_16 : ∀ c : Fin 103, + (edge 16).2 < c → SeedEncoding.indexedAdj (edge 16).1 c → + SeedEncoding.indexedAdj (edge 16).2 c → + triangle (triangleIndex 16 c) = ((edge 16).1,(edge 16).2,c) := by decide +kernel +theorem triangle_complete_17 : ∀ c : Fin 103, + (edge 17).2 < c → SeedEncoding.indexedAdj (edge 17).1 c → + SeedEncoding.indexedAdj (edge 17).2 c → + triangle (triangleIndex 17 c) = ((edge 17).1,(edge 17).2,c) := by decide +kernel +theorem triangle_complete_18 : ∀ c : Fin 103, + (edge 18).2 < c → SeedEncoding.indexedAdj (edge 18).1 c → + SeedEncoding.indexedAdj (edge 18).2 c → + triangle (triangleIndex 18 c) = ((edge 18).1,(edge 18).2,c) := by decide +kernel +theorem triangle_complete_19 : ∀ c : Fin 103, + (edge 19).2 < c → SeedEncoding.indexedAdj (edge 19).1 c → + SeedEncoding.indexedAdj (edge 19).2 c → + triangle (triangleIndex 19 c) = ((edge 19).1,(edge 19).2,c) := by decide +kernel +theorem triangle_complete_20 : ∀ c : Fin 103, + (edge 20).2 < c → SeedEncoding.indexedAdj (edge 20).1 c → + SeedEncoding.indexedAdj (edge 20).2 c → + triangle (triangleIndex 20 c) = ((edge 20).1,(edge 20).2,c) := by decide +kernel +theorem triangle_complete_21 : ∀ c : Fin 103, + (edge 21).2 < c → SeedEncoding.indexedAdj (edge 21).1 c → + SeedEncoding.indexedAdj (edge 21).2 c → + triangle (triangleIndex 21 c) = ((edge 21).1,(edge 21).2,c) := by decide +kernel +theorem triangle_complete_22 : ∀ c : Fin 103, + (edge 22).2 < c → SeedEncoding.indexedAdj (edge 22).1 c → + SeedEncoding.indexedAdj (edge 22).2 c → + triangle (triangleIndex 22 c) = ((edge 22).1,(edge 22).2,c) := by decide +kernel +theorem triangle_complete_23 : ∀ c : Fin 103, + (edge 23).2 < c → SeedEncoding.indexedAdj (edge 23).1 c → + SeedEncoding.indexedAdj (edge 23).2 c → + triangle (triangleIndex 23 c) = ((edge 23).1,(edge 23).2,c) := by decide +kernel +theorem triangle_complete_24 : ∀ c : Fin 103, + (edge 24).2 < c → SeedEncoding.indexedAdj (edge 24).1 c → + SeedEncoding.indexedAdj (edge 24).2 c → + triangle (triangleIndex 24 c) = ((edge 24).1,(edge 24).2,c) := by decide +kernel +theorem triangle_complete_25 : ∀ c : Fin 103, + (edge 25).2 < c → SeedEncoding.indexedAdj (edge 25).1 c → + SeedEncoding.indexedAdj (edge 25).2 c → + triangle (triangleIndex 25 c) = ((edge 25).1,(edge 25).2,c) := by decide +kernel +theorem triangle_complete_26 : ∀ c : Fin 103, + (edge 26).2 < c → SeedEncoding.indexedAdj (edge 26).1 c → + SeedEncoding.indexedAdj (edge 26).2 c → + triangle (triangleIndex 26 c) = ((edge 26).1,(edge 26).2,c) := by decide +kernel +theorem triangle_complete_27 : ∀ c : Fin 103, + (edge 27).2 < c → SeedEncoding.indexedAdj (edge 27).1 c → + SeedEncoding.indexedAdj (edge 27).2 c → + triangle (triangleIndex 27 c) = ((edge 27).1,(edge 27).2,c) := by decide +kernel +theorem triangle_complete_28 : ∀ c : Fin 103, + (edge 28).2 < c → SeedEncoding.indexedAdj (edge 28).1 c → + SeedEncoding.indexedAdj (edge 28).2 c → + triangle (triangleIndex 28 c) = ((edge 28).1,(edge 28).2,c) := by decide +kernel +theorem triangle_complete_29 : ∀ c : Fin 103, + (edge 29).2 < c → SeedEncoding.indexedAdj (edge 29).1 c → + SeedEncoding.indexedAdj (edge 29).2 c → + triangle (triangleIndex 29 c) = ((edge 29).1,(edge 29).2,c) := by decide +kernel +theorem triangle_complete_30 : ∀ c : Fin 103, + (edge 30).2 < c → SeedEncoding.indexedAdj (edge 30).1 c → + SeedEncoding.indexedAdj (edge 30).2 c → + triangle (triangleIndex 30 c) = ((edge 30).1,(edge 30).2,c) := by decide +kernel +theorem triangle_complete_31 : ∀ c : Fin 103, + (edge 31).2 < c → SeedEncoding.indexedAdj (edge 31).1 c → + SeedEncoding.indexedAdj (edge 31).2 c → + triangle (triangleIndex 31 c) = ((edge 31).1,(edge 31).2,c) := by decide +kernel +theorem triangle_complete_32 : ∀ c : Fin 103, + (edge 32).2 < c → SeedEncoding.indexedAdj (edge 32).1 c → + SeedEncoding.indexedAdj (edge 32).2 c → + triangle (triangleIndex 32 c) = ((edge 32).1,(edge 32).2,c) := by decide +kernel +theorem triangle_complete_33 : ∀ c : Fin 103, + (edge 33).2 < c → SeedEncoding.indexedAdj (edge 33).1 c → + SeedEncoding.indexedAdj (edge 33).2 c → + triangle (triangleIndex 33 c) = ((edge 33).1,(edge 33).2,c) := by decide +kernel +theorem triangle_complete_34 : ∀ c : Fin 103, + (edge 34).2 < c → SeedEncoding.indexedAdj (edge 34).1 c → + SeedEncoding.indexedAdj (edge 34).2 c → + triangle (triangleIndex 34 c) = ((edge 34).1,(edge 34).2,c) := by decide +kernel +theorem triangle_complete_35 : ∀ c : Fin 103, + (edge 35).2 < c → SeedEncoding.indexedAdj (edge 35).1 c → + SeedEncoding.indexedAdj (edge 35).2 c → + triangle (triangleIndex 35 c) = ((edge 35).1,(edge 35).2,c) := by decide +kernel +theorem triangle_complete_36 : ∀ c : Fin 103, + (edge 36).2 < c → SeedEncoding.indexedAdj (edge 36).1 c → + SeedEncoding.indexedAdj (edge 36).2 c → + triangle (triangleIndex 36 c) = ((edge 36).1,(edge 36).2,c) := by decide +kernel +theorem triangle_complete_37 : ∀ c : Fin 103, + (edge 37).2 < c → SeedEncoding.indexedAdj (edge 37).1 c → + SeedEncoding.indexedAdj (edge 37).2 c → + triangle (triangleIndex 37 c) = ((edge 37).1,(edge 37).2,c) := by decide +kernel +theorem triangle_complete_38 : ∀ c : Fin 103, + (edge 38).2 < c → SeedEncoding.indexedAdj (edge 38).1 c → + SeedEncoding.indexedAdj (edge 38).2 c → + triangle (triangleIndex 38 c) = ((edge 38).1,(edge 38).2,c) := by decide +kernel +theorem triangle_complete_39 : ∀ c : Fin 103, + (edge 39).2 < c → SeedEncoding.indexedAdj (edge 39).1 c → + SeedEncoding.indexedAdj (edge 39).2 c → + triangle (triangleIndex 39 c) = ((edge 39).1,(edge 39).2,c) := by decide +kernel +theorem triangle_complete_40 : ∀ c : Fin 103, + (edge 40).2 < c → SeedEncoding.indexedAdj (edge 40).1 c → + SeedEncoding.indexedAdj (edge 40).2 c → + triangle (triangleIndex 40 c) = ((edge 40).1,(edge 40).2,c) := by decide +kernel +theorem triangle_complete_41 : ∀ c : Fin 103, + (edge 41).2 < c → SeedEncoding.indexedAdj (edge 41).1 c → + SeedEncoding.indexedAdj (edge 41).2 c → + triangle (triangleIndex 41 c) = ((edge 41).1,(edge 41).2,c) := by decide +kernel +theorem triangle_complete_42 : ∀ c : Fin 103, + (edge 42).2 < c → SeedEncoding.indexedAdj (edge 42).1 c → + SeedEncoding.indexedAdj (edge 42).2 c → + triangle (triangleIndex 42 c) = ((edge 42).1,(edge 42).2,c) := by decide +kernel +theorem triangle_complete_43 : ∀ c : Fin 103, + (edge 43).2 < c → SeedEncoding.indexedAdj (edge 43).1 c → + SeedEncoding.indexedAdj (edge 43).2 c → + triangle (triangleIndex 43 c) = ((edge 43).1,(edge 43).2,c) := by decide +kernel +theorem triangle_complete_44 : ∀ c : Fin 103, + (edge 44).2 < c → SeedEncoding.indexedAdj (edge 44).1 c → + SeedEncoding.indexedAdj (edge 44).2 c → + triangle (triangleIndex 44 c) = ((edge 44).1,(edge 44).2,c) := by decide +kernel +theorem triangle_complete_45 : ∀ c : Fin 103, + (edge 45).2 < c → SeedEncoding.indexedAdj (edge 45).1 c → + SeedEncoding.indexedAdj (edge 45).2 c → + triangle (triangleIndex 45 c) = ((edge 45).1,(edge 45).2,c) := by decide +kernel +theorem triangle_complete_46 : ∀ c : Fin 103, + (edge 46).2 < c → SeedEncoding.indexedAdj (edge 46).1 c → + SeedEncoding.indexedAdj (edge 46).2 c → + triangle (triangleIndex 46 c) = ((edge 46).1,(edge 46).2,c) := by decide +kernel +theorem triangle_complete_47 : ∀ c : Fin 103, + (edge 47).2 < c → SeedEncoding.indexedAdj (edge 47).1 c → + SeedEncoding.indexedAdj (edge 47).2 c → + triangle (triangleIndex 47 c) = ((edge 47).1,(edge 47).2,c) := by decide +kernel +theorem triangle_complete_48 : ∀ c : Fin 103, + (edge 48).2 < c → SeedEncoding.indexedAdj (edge 48).1 c → + SeedEncoding.indexedAdj (edge 48).2 c → + triangle (triangleIndex 48 c) = ((edge 48).1,(edge 48).2,c) := by decide +kernel +theorem triangle_complete_49 : ∀ c : Fin 103, + (edge 49).2 < c → SeedEncoding.indexedAdj (edge 49).1 c → + SeedEncoding.indexedAdj (edge 49).2 c → + triangle (triangleIndex 49 c) = ((edge 49).1,(edge 49).2,c) := by decide +kernel +theorem triangle_complete_50 : ∀ c : Fin 103, + (edge 50).2 < c → SeedEncoding.indexedAdj (edge 50).1 c → + SeedEncoding.indexedAdj (edge 50).2 c → + triangle (triangleIndex 50 c) = ((edge 50).1,(edge 50).2,c) := by decide +kernel +theorem triangle_complete_51 : ∀ c : Fin 103, + (edge 51).2 < c → SeedEncoding.indexedAdj (edge 51).1 c → + SeedEncoding.indexedAdj (edge 51).2 c → + triangle (triangleIndex 51 c) = ((edge 51).1,(edge 51).2,c) := by decide +kernel +theorem triangle_complete_52 : ∀ c : Fin 103, + (edge 52).2 < c → SeedEncoding.indexedAdj (edge 52).1 c → + SeedEncoding.indexedAdj (edge 52).2 c → + triangle (triangleIndex 52 c) = ((edge 52).1,(edge 52).2,c) := by decide +kernel +theorem triangle_complete_53 : ∀ c : Fin 103, + (edge 53).2 < c → SeedEncoding.indexedAdj (edge 53).1 c → + SeedEncoding.indexedAdj (edge 53).2 c → + triangle (triangleIndex 53 c) = ((edge 53).1,(edge 53).2,c) := by decide +kernel +theorem triangle_complete_54 : ∀ c : Fin 103, + (edge 54).2 < c → SeedEncoding.indexedAdj (edge 54).1 c → + SeedEncoding.indexedAdj (edge 54).2 c → + triangle (triangleIndex 54 c) = ((edge 54).1,(edge 54).2,c) := by decide +kernel +theorem triangle_complete_55 : ∀ c : Fin 103, + (edge 55).2 < c → SeedEncoding.indexedAdj (edge 55).1 c → + SeedEncoding.indexedAdj (edge 55).2 c → + triangle (triangleIndex 55 c) = ((edge 55).1,(edge 55).2,c) := by decide +kernel +theorem triangle_complete_56 : ∀ c : Fin 103, + (edge 56).2 < c → SeedEncoding.indexedAdj (edge 56).1 c → + SeedEncoding.indexedAdj (edge 56).2 c → + triangle (triangleIndex 56 c) = ((edge 56).1,(edge 56).2,c) := by decide +kernel +theorem triangle_complete_57 : ∀ c : Fin 103, + (edge 57).2 < c → SeedEncoding.indexedAdj (edge 57).1 c → + SeedEncoding.indexedAdj (edge 57).2 c → + triangle (triangleIndex 57 c) = ((edge 57).1,(edge 57).2,c) := by decide +kernel +theorem triangle_complete_58 : ∀ c : Fin 103, + (edge 58).2 < c → SeedEncoding.indexedAdj (edge 58).1 c → + SeedEncoding.indexedAdj (edge 58).2 c → + triangle (triangleIndex 58 c) = ((edge 58).1,(edge 58).2,c) := by decide +kernel +theorem triangle_complete_59 : ∀ c : Fin 103, + (edge 59).2 < c → SeedEncoding.indexedAdj (edge 59).1 c → + SeedEncoding.indexedAdj (edge 59).2 c → + triangle (triangleIndex 59 c) = ((edge 59).1,(edge 59).2,c) := by decide +kernel +theorem triangle_complete_60 : ∀ c : Fin 103, + (edge 60).2 < c → SeedEncoding.indexedAdj (edge 60).1 c → + SeedEncoding.indexedAdj (edge 60).2 c → + triangle (triangleIndex 60 c) = ((edge 60).1,(edge 60).2,c) := by decide +kernel +theorem triangle_complete_61 : ∀ c : Fin 103, + (edge 61).2 < c → SeedEncoding.indexedAdj (edge 61).1 c → + SeedEncoding.indexedAdj (edge 61).2 c → + triangle (triangleIndex 61 c) = ((edge 61).1,(edge 61).2,c) := by decide +kernel +theorem triangle_complete_62 : ∀ c : Fin 103, + (edge 62).2 < c → SeedEncoding.indexedAdj (edge 62).1 c → + SeedEncoding.indexedAdj (edge 62).2 c → + triangle (triangleIndex 62 c) = ((edge 62).1,(edge 62).2,c) := by decide +kernel +theorem triangle_complete_63 : ∀ c : Fin 103, + (edge 63).2 < c → SeedEncoding.indexedAdj (edge 63).1 c → + SeedEncoding.indexedAdj (edge 63).2 c → + triangle (triangleIndex 63 c) = ((edge 63).1,(edge 63).2,c) := by decide +kernel +theorem triangle_complete_64 : ∀ c : Fin 103, + (edge 64).2 < c → SeedEncoding.indexedAdj (edge 64).1 c → + SeedEncoding.indexedAdj (edge 64).2 c → + triangle (triangleIndex 64 c) = ((edge 64).1,(edge 64).2,c) := by decide +kernel +theorem triangle_complete_65 : ∀ c : Fin 103, + (edge 65).2 < c → SeedEncoding.indexedAdj (edge 65).1 c → + SeedEncoding.indexedAdj (edge 65).2 c → + triangle (triangleIndex 65 c) = ((edge 65).1,(edge 65).2,c) := by decide +kernel +theorem triangle_complete_66 : ∀ c : Fin 103, + (edge 66).2 < c → SeedEncoding.indexedAdj (edge 66).1 c → + SeedEncoding.indexedAdj (edge 66).2 c → + triangle (triangleIndex 66 c) = ((edge 66).1,(edge 66).2,c) := by decide +kernel +theorem triangle_complete_67 : ∀ c : Fin 103, + (edge 67).2 < c → SeedEncoding.indexedAdj (edge 67).1 c → + SeedEncoding.indexedAdj (edge 67).2 c → + triangle (triangleIndex 67 c) = ((edge 67).1,(edge 67).2,c) := by decide +kernel +theorem triangle_complete_68 : ∀ c : Fin 103, + (edge 68).2 < c → SeedEncoding.indexedAdj (edge 68).1 c → + SeedEncoding.indexedAdj (edge 68).2 c → + triangle (triangleIndex 68 c) = ((edge 68).1,(edge 68).2,c) := by decide +kernel +theorem triangle_complete_69 : ∀ c : Fin 103, + (edge 69).2 < c → SeedEncoding.indexedAdj (edge 69).1 c → + SeedEncoding.indexedAdj (edge 69).2 c → + triangle (triangleIndex 69 c) = ((edge 69).1,(edge 69).2,c) := by decide +kernel +theorem triangle_complete_70 : ∀ c : Fin 103, + (edge 70).2 < c → SeedEncoding.indexedAdj (edge 70).1 c → + SeedEncoding.indexedAdj (edge 70).2 c → + triangle (triangleIndex 70 c) = ((edge 70).1,(edge 70).2,c) := by decide +kernel +theorem triangle_complete_71 : ∀ c : Fin 103, + (edge 71).2 < c → SeedEncoding.indexedAdj (edge 71).1 c → + SeedEncoding.indexedAdj (edge 71).2 c → + triangle (triangleIndex 71 c) = ((edge 71).1,(edge 71).2,c) := by decide +kernel +theorem triangle_complete_72 : ∀ c : Fin 103, + (edge 72).2 < c → SeedEncoding.indexedAdj (edge 72).1 c → + SeedEncoding.indexedAdj (edge 72).2 c → + triangle (triangleIndex 72 c) = ((edge 72).1,(edge 72).2,c) := by decide +kernel +theorem triangle_complete_73 : ∀ c : Fin 103, + (edge 73).2 < c → SeedEncoding.indexedAdj (edge 73).1 c → + SeedEncoding.indexedAdj (edge 73).2 c → + triangle (triangleIndex 73 c) = ((edge 73).1,(edge 73).2,c) := by decide +kernel +theorem triangle_complete_74 : ∀ c : Fin 103, + (edge 74).2 < c → SeedEncoding.indexedAdj (edge 74).1 c → + SeedEncoding.indexedAdj (edge 74).2 c → + triangle (triangleIndex 74 c) = ((edge 74).1,(edge 74).2,c) := by decide +kernel +theorem triangle_complete_75 : ∀ c : Fin 103, + (edge 75).2 < c → SeedEncoding.indexedAdj (edge 75).1 c → + SeedEncoding.indexedAdj (edge 75).2 c → + triangle (triangleIndex 75 c) = ((edge 75).1,(edge 75).2,c) := by decide +kernel +theorem triangle_complete_76 : ∀ c : Fin 103, + (edge 76).2 < c → SeedEncoding.indexedAdj (edge 76).1 c → + SeedEncoding.indexedAdj (edge 76).2 c → + triangle (triangleIndex 76 c) = ((edge 76).1,(edge 76).2,c) := by decide +kernel +theorem triangle_complete_77 : ∀ c : Fin 103, + (edge 77).2 < c → SeedEncoding.indexedAdj (edge 77).1 c → + SeedEncoding.indexedAdj (edge 77).2 c → + triangle (triangleIndex 77 c) = ((edge 77).1,(edge 77).2,c) := by decide +kernel +theorem triangle_complete_78 : ∀ c : Fin 103, + (edge 78).2 < c → SeedEncoding.indexedAdj (edge 78).1 c → + SeedEncoding.indexedAdj (edge 78).2 c → + triangle (triangleIndex 78 c) = ((edge 78).1,(edge 78).2,c) := by decide +kernel +theorem triangle_complete_79 : ∀ c : Fin 103, + (edge 79).2 < c → SeedEncoding.indexedAdj (edge 79).1 c → + SeedEncoding.indexedAdj (edge 79).2 c → + triangle (triangleIndex 79 c) = ((edge 79).1,(edge 79).2,c) := by decide +kernel +theorem triangle_complete_80 : ∀ c : Fin 103, + (edge 80).2 < c → SeedEncoding.indexedAdj (edge 80).1 c → + SeedEncoding.indexedAdj (edge 80).2 c → + triangle (triangleIndex 80 c) = ((edge 80).1,(edge 80).2,c) := by decide +kernel +theorem triangle_complete_81 : ∀ c : Fin 103, + (edge 81).2 < c → SeedEncoding.indexedAdj (edge 81).1 c → + SeedEncoding.indexedAdj (edge 81).2 c → + triangle (triangleIndex 81 c) = ((edge 81).1,(edge 81).2,c) := by decide +kernel +theorem triangle_complete_82 : ∀ c : Fin 103, + (edge 82).2 < c → SeedEncoding.indexedAdj (edge 82).1 c → + SeedEncoding.indexedAdj (edge 82).2 c → + triangle (triangleIndex 82 c) = ((edge 82).1,(edge 82).2,c) := by decide +kernel +theorem triangle_complete_83 : ∀ c : Fin 103, + (edge 83).2 < c → SeedEncoding.indexedAdj (edge 83).1 c → + SeedEncoding.indexedAdj (edge 83).2 c → + triangle (triangleIndex 83 c) = ((edge 83).1,(edge 83).2,c) := by decide +kernel +theorem triangle_complete_84 : ∀ c : Fin 103, + (edge 84).2 < c → SeedEncoding.indexedAdj (edge 84).1 c → + SeedEncoding.indexedAdj (edge 84).2 c → + triangle (triangleIndex 84 c) = ((edge 84).1,(edge 84).2,c) := by decide +kernel +theorem triangle_complete_85 : ∀ c : Fin 103, + (edge 85).2 < c → SeedEncoding.indexedAdj (edge 85).1 c → + SeedEncoding.indexedAdj (edge 85).2 c → + triangle (triangleIndex 85 c) = ((edge 85).1,(edge 85).2,c) := by decide +kernel +theorem triangle_complete_86 : ∀ c : Fin 103, + (edge 86).2 < c → SeedEncoding.indexedAdj (edge 86).1 c → + SeedEncoding.indexedAdj (edge 86).2 c → + triangle (triangleIndex 86 c) = ((edge 86).1,(edge 86).2,c) := by decide +kernel +theorem triangle_complete_87 : ∀ c : Fin 103, + (edge 87).2 < c → SeedEncoding.indexedAdj (edge 87).1 c → + SeedEncoding.indexedAdj (edge 87).2 c → + triangle (triangleIndex 87 c) = ((edge 87).1,(edge 87).2,c) := by decide +kernel +theorem triangle_complete_88 : ∀ c : Fin 103, + (edge 88).2 < c → SeedEncoding.indexedAdj (edge 88).1 c → + SeedEncoding.indexedAdj (edge 88).2 c → + triangle (triangleIndex 88 c) = ((edge 88).1,(edge 88).2,c) := by decide +kernel +theorem triangle_complete_89 : ∀ c : Fin 103, + (edge 89).2 < c → SeedEncoding.indexedAdj (edge 89).1 c → + SeedEncoding.indexedAdj (edge 89).2 c → + triangle (triangleIndex 89 c) = ((edge 89).1,(edge 89).2,c) := by decide +kernel +theorem triangle_complete_90 : ∀ c : Fin 103, + (edge 90).2 < c → SeedEncoding.indexedAdj (edge 90).1 c → + SeedEncoding.indexedAdj (edge 90).2 c → + triangle (triangleIndex 90 c) = ((edge 90).1,(edge 90).2,c) := by decide +kernel +theorem triangle_complete_91 : ∀ c : Fin 103, + (edge 91).2 < c → SeedEncoding.indexedAdj (edge 91).1 c → + SeedEncoding.indexedAdj (edge 91).2 c → + triangle (triangleIndex 91 c) = ((edge 91).1,(edge 91).2,c) := by decide +kernel +theorem triangle_complete_92 : ∀ c : Fin 103, + (edge 92).2 < c → SeedEncoding.indexedAdj (edge 92).1 c → + SeedEncoding.indexedAdj (edge 92).2 c → + triangle (triangleIndex 92 c) = ((edge 92).1,(edge 92).2,c) := by decide +kernel +theorem triangle_complete_93 : ∀ c : Fin 103, + (edge 93).2 < c → SeedEncoding.indexedAdj (edge 93).1 c → + SeedEncoding.indexedAdj (edge 93).2 c → + triangle (triangleIndex 93 c) = ((edge 93).1,(edge 93).2,c) := by decide +kernel +theorem triangle_complete_94 : ∀ c : Fin 103, + (edge 94).2 < c → SeedEncoding.indexedAdj (edge 94).1 c → + SeedEncoding.indexedAdj (edge 94).2 c → + triangle (triangleIndex 94 c) = ((edge 94).1,(edge 94).2,c) := by decide +kernel +theorem triangle_complete_95 : ∀ c : Fin 103, + (edge 95).2 < c → SeedEncoding.indexedAdj (edge 95).1 c → + SeedEncoding.indexedAdj (edge 95).2 c → + triangle (triangleIndex 95 c) = ((edge 95).1,(edge 95).2,c) := by decide +kernel +theorem triangle_complete_96 : ∀ c : Fin 103, + (edge 96).2 < c → SeedEncoding.indexedAdj (edge 96).1 c → + SeedEncoding.indexedAdj (edge 96).2 c → + triangle (triangleIndex 96 c) = ((edge 96).1,(edge 96).2,c) := by decide +kernel +theorem triangle_complete_97 : ∀ c : Fin 103, + (edge 97).2 < c → SeedEncoding.indexedAdj (edge 97).1 c → + SeedEncoding.indexedAdj (edge 97).2 c → + triangle (triangleIndex 97 c) = ((edge 97).1,(edge 97).2,c) := by decide +kernel +theorem triangle_complete_98 : ∀ c : Fin 103, + (edge 98).2 < c → SeedEncoding.indexedAdj (edge 98).1 c → + SeedEncoding.indexedAdj (edge 98).2 c → + triangle (triangleIndex 98 c) = ((edge 98).1,(edge 98).2,c) := by decide +kernel +theorem triangle_complete_99 : ∀ c : Fin 103, + (edge 99).2 < c → SeedEncoding.indexedAdj (edge 99).1 c → + SeedEncoding.indexedAdj (edge 99).2 c → + triangle (triangleIndex 99 c) = ((edge 99).1,(edge 99).2,c) := by decide +kernel +theorem triangle_complete_100 : ∀ c : Fin 103, + (edge 100).2 < c → SeedEncoding.indexedAdj (edge 100).1 c → + SeedEncoding.indexedAdj (edge 100).2 c → + triangle (triangleIndex 100 c) = ((edge 100).1,(edge 100).2,c) := by decide +kernel +theorem triangle_complete_101 : ∀ c : Fin 103, + (edge 101).2 < c → SeedEncoding.indexedAdj (edge 101).1 c → + SeedEncoding.indexedAdj (edge 101).2 c → + triangle (triangleIndex 101 c) = ((edge 101).1,(edge 101).2,c) := by decide +kernel +theorem triangle_complete_102 : ∀ c : Fin 103, + (edge 102).2 < c → SeedEncoding.indexedAdj (edge 102).1 c → + SeedEncoding.indexedAdj (edge 102).2 c → + triangle (triangleIndex 102 c) = ((edge 102).1,(edge 102).2,c) := by decide +kernel +theorem triangle_complete_103 : ∀ c : Fin 103, + (edge 103).2 < c → SeedEncoding.indexedAdj (edge 103).1 c → + SeedEncoding.indexedAdj (edge 103).2 c → + triangle (triangleIndex 103 c) = ((edge 103).1,(edge 103).2,c) := by decide +kernel +theorem triangle_complete_104 : ∀ c : Fin 103, + (edge 104).2 < c → SeedEncoding.indexedAdj (edge 104).1 c → + SeedEncoding.indexedAdj (edge 104).2 c → + triangle (triangleIndex 104 c) = ((edge 104).1,(edge 104).2,c) := by decide +kernel +theorem triangle_complete_105 : ∀ c : Fin 103, + (edge 105).2 < c → SeedEncoding.indexedAdj (edge 105).1 c → + SeedEncoding.indexedAdj (edge 105).2 c → + triangle (triangleIndex 105 c) = ((edge 105).1,(edge 105).2,c) := by decide +kernel +theorem triangle_complete_106 : ∀ c : Fin 103, + (edge 106).2 < c → SeedEncoding.indexedAdj (edge 106).1 c → + SeedEncoding.indexedAdj (edge 106).2 c → + triangle (triangleIndex 106 c) = ((edge 106).1,(edge 106).2,c) := by decide +kernel +theorem triangle_complete_107 : ∀ c : Fin 103, + (edge 107).2 < c → SeedEncoding.indexedAdj (edge 107).1 c → + SeedEncoding.indexedAdj (edge 107).2 c → + triangle (triangleIndex 107 c) = ((edge 107).1,(edge 107).2,c) := by decide +kernel +theorem triangle_complete_108 : ∀ c : Fin 103, + (edge 108).2 < c → SeedEncoding.indexedAdj (edge 108).1 c → + SeedEncoding.indexedAdj (edge 108).2 c → + triangle (triangleIndex 108 c) = ((edge 108).1,(edge 108).2,c) := by decide +kernel +theorem triangle_complete_109 : ∀ c : Fin 103, + (edge 109).2 < c → SeedEncoding.indexedAdj (edge 109).1 c → + SeedEncoding.indexedAdj (edge 109).2 c → + triangle (triangleIndex 109 c) = ((edge 109).1,(edge 109).2,c) := by decide +kernel +theorem triangle_complete_110 : ∀ c : Fin 103, + (edge 110).2 < c → SeedEncoding.indexedAdj (edge 110).1 c → + SeedEncoding.indexedAdj (edge 110).2 c → + triangle (triangleIndex 110 c) = ((edge 110).1,(edge 110).2,c) := by decide +kernel +theorem triangle_complete_111 : ∀ c : Fin 103, + (edge 111).2 < c → SeedEncoding.indexedAdj (edge 111).1 c → + SeedEncoding.indexedAdj (edge 111).2 c → + triangle (triangleIndex 111 c) = ((edge 111).1,(edge 111).2,c) := by decide +kernel +theorem triangle_complete_112 : ∀ c : Fin 103, + (edge 112).2 < c → SeedEncoding.indexedAdj (edge 112).1 c → + SeedEncoding.indexedAdj (edge 112).2 c → + triangle (triangleIndex 112 c) = ((edge 112).1,(edge 112).2,c) := by decide +kernel +theorem triangle_complete_113 : ∀ c : Fin 103, + (edge 113).2 < c → SeedEncoding.indexedAdj (edge 113).1 c → + SeedEncoding.indexedAdj (edge 113).2 c → + triangle (triangleIndex 113 c) = ((edge 113).1,(edge 113).2,c) := by decide +kernel +theorem triangle_complete_114 : ∀ c : Fin 103, + (edge 114).2 < c → SeedEncoding.indexedAdj (edge 114).1 c → + SeedEncoding.indexedAdj (edge 114).2 c → + triangle (triangleIndex 114 c) = ((edge 114).1,(edge 114).2,c) := by decide +kernel +theorem triangle_complete_115 : ∀ c : Fin 103, + (edge 115).2 < c → SeedEncoding.indexedAdj (edge 115).1 c → + SeedEncoding.indexedAdj (edge 115).2 c → + triangle (triangleIndex 115 c) = ((edge 115).1,(edge 115).2,c) := by decide +kernel +theorem triangle_complete_116 : ∀ c : Fin 103, + (edge 116).2 < c → SeedEncoding.indexedAdj (edge 116).1 c → + SeedEncoding.indexedAdj (edge 116).2 c → + triangle (triangleIndex 116 c) = ((edge 116).1,(edge 116).2,c) := by decide +kernel +theorem triangle_complete_117 : ∀ c : Fin 103, + (edge 117).2 < c → SeedEncoding.indexedAdj (edge 117).1 c → + SeedEncoding.indexedAdj (edge 117).2 c → + triangle (triangleIndex 117 c) = ((edge 117).1,(edge 117).2,c) := by decide +kernel +theorem triangle_complete_118 : ∀ c : Fin 103, + (edge 118).2 < c → SeedEncoding.indexedAdj (edge 118).1 c → + SeedEncoding.indexedAdj (edge 118).2 c → + triangle (triangleIndex 118 c) = ((edge 118).1,(edge 118).2,c) := by decide +kernel +theorem triangle_complete_119 : ∀ c : Fin 103, + (edge 119).2 < c → SeedEncoding.indexedAdj (edge 119).1 c → + SeedEncoding.indexedAdj (edge 119).2 c → + triangle (triangleIndex 119 c) = ((edge 119).1,(edge 119).2,c) := by decide +kernel +theorem triangle_complete_120 : ∀ c : Fin 103, + (edge 120).2 < c → SeedEncoding.indexedAdj (edge 120).1 c → + SeedEncoding.indexedAdj (edge 120).2 c → + triangle (triangleIndex 120 c) = ((edge 120).1,(edge 120).2,c) := by decide +kernel +theorem triangle_complete_121 : ∀ c : Fin 103, + (edge 121).2 < c → SeedEncoding.indexedAdj (edge 121).1 c → + SeedEncoding.indexedAdj (edge 121).2 c → + triangle (triangleIndex 121 c) = ((edge 121).1,(edge 121).2,c) := by decide +kernel +theorem triangle_complete_122 : ∀ c : Fin 103, + (edge 122).2 < c → SeedEncoding.indexedAdj (edge 122).1 c → + SeedEncoding.indexedAdj (edge 122).2 c → + triangle (triangleIndex 122 c) = ((edge 122).1,(edge 122).2,c) := by decide +kernel +theorem triangle_complete_123 : ∀ c : Fin 103, + (edge 123).2 < c → SeedEncoding.indexedAdj (edge 123).1 c → + SeedEncoding.indexedAdj (edge 123).2 c → + triangle (triangleIndex 123 c) = ((edge 123).1,(edge 123).2,c) := by decide +kernel +theorem triangle_complete_124 : ∀ c : Fin 103, + (edge 124).2 < c → SeedEncoding.indexedAdj (edge 124).1 c → + SeedEncoding.indexedAdj (edge 124).2 c → + triangle (triangleIndex 124 c) = ((edge 124).1,(edge 124).2,c) := by decide +kernel +theorem triangle_complete_125 : ∀ c : Fin 103, + (edge 125).2 < c → SeedEncoding.indexedAdj (edge 125).1 c → + SeedEncoding.indexedAdj (edge 125).2 c → + triangle (triangleIndex 125 c) = ((edge 125).1,(edge 125).2,c) := by decide +kernel +theorem triangle_complete_126 : ∀ c : Fin 103, + (edge 126).2 < c → SeedEncoding.indexedAdj (edge 126).1 c → + SeedEncoding.indexedAdj (edge 126).2 c → + triangle (triangleIndex 126 c) = ((edge 126).1,(edge 126).2,c) := by decide +kernel +theorem triangle_complete_127 : ∀ c : Fin 103, + (edge 127).2 < c → SeedEncoding.indexedAdj (edge 127).1 c → + SeedEncoding.indexedAdj (edge 127).2 c → + triangle (triangleIndex 127 c) = ((edge 127).1,(edge 127).2,c) := by decide +kernel +theorem triangle_complete_128 : ∀ c : Fin 103, + (edge 128).2 < c → SeedEncoding.indexedAdj (edge 128).1 c → + SeedEncoding.indexedAdj (edge 128).2 c → + triangle (triangleIndex 128 c) = ((edge 128).1,(edge 128).2,c) := by decide +kernel +theorem triangle_complete_129 : ∀ c : Fin 103, + (edge 129).2 < c → SeedEncoding.indexedAdj (edge 129).1 c → + SeedEncoding.indexedAdj (edge 129).2 c → + triangle (triangleIndex 129 c) = ((edge 129).1,(edge 129).2,c) := by decide +kernel +theorem triangle_complete_130 : ∀ c : Fin 103, + (edge 130).2 < c → SeedEncoding.indexedAdj (edge 130).1 c → + SeedEncoding.indexedAdj (edge 130).2 c → + triangle (triangleIndex 130 c) = ((edge 130).1,(edge 130).2,c) := by decide +kernel +theorem triangle_complete_131 : ∀ c : Fin 103, + (edge 131).2 < c → SeedEncoding.indexedAdj (edge 131).1 c → + SeedEncoding.indexedAdj (edge 131).2 c → + triangle (triangleIndex 131 c) = ((edge 131).1,(edge 131).2,c) := by decide +kernel +theorem triangle_complete_132 : ∀ c : Fin 103, + (edge 132).2 < c → SeedEncoding.indexedAdj (edge 132).1 c → + SeedEncoding.indexedAdj (edge 132).2 c → + triangle (triangleIndex 132 c) = ((edge 132).1,(edge 132).2,c) := by decide +kernel +theorem triangle_complete_133 : ∀ c : Fin 103, + (edge 133).2 < c → SeedEncoding.indexedAdj (edge 133).1 c → + SeedEncoding.indexedAdj (edge 133).2 c → + triangle (triangleIndex 133 c) = ((edge 133).1,(edge 133).2,c) := by decide +kernel +theorem triangle_complete_134 : ∀ c : Fin 103, + (edge 134).2 < c → SeedEncoding.indexedAdj (edge 134).1 c → + SeedEncoding.indexedAdj (edge 134).2 c → + triangle (triangleIndex 134 c) = ((edge 134).1,(edge 134).2,c) := by decide +kernel +theorem triangle_complete_135 : ∀ c : Fin 103, + (edge 135).2 < c → SeedEncoding.indexedAdj (edge 135).1 c → + SeedEncoding.indexedAdj (edge 135).2 c → + triangle (triangleIndex 135 c) = ((edge 135).1,(edge 135).2,c) := by decide +kernel +theorem triangle_complete_136 : ∀ c : Fin 103, + (edge 136).2 < c → SeedEncoding.indexedAdj (edge 136).1 c → + SeedEncoding.indexedAdj (edge 136).2 c → + triangle (triangleIndex 136 c) = ((edge 136).1,(edge 136).2,c) := by decide +kernel +theorem triangle_complete_137 : ∀ c : Fin 103, + (edge 137).2 < c → SeedEncoding.indexedAdj (edge 137).1 c → + SeedEncoding.indexedAdj (edge 137).2 c → + triangle (triangleIndex 137 c) = ((edge 137).1,(edge 137).2,c) := by decide +kernel +theorem triangle_complete_138 : ∀ c : Fin 103, + (edge 138).2 < c → SeedEncoding.indexedAdj (edge 138).1 c → + SeedEncoding.indexedAdj (edge 138).2 c → + triangle (triangleIndex 138 c) = ((edge 138).1,(edge 138).2,c) := by decide +kernel +theorem triangle_complete_139 : ∀ c : Fin 103, + (edge 139).2 < c → SeedEncoding.indexedAdj (edge 139).1 c → + SeedEncoding.indexedAdj (edge 139).2 c → + triangle (triangleIndex 139 c) = ((edge 139).1,(edge 139).2,c) := by decide +kernel +theorem triangle_complete_140 : ∀ c : Fin 103, + (edge 140).2 < c → SeedEncoding.indexedAdj (edge 140).1 c → + SeedEncoding.indexedAdj (edge 140).2 c → + triangle (triangleIndex 140 c) = ((edge 140).1,(edge 140).2,c) := by decide +kernel +theorem triangle_complete_141 : ∀ c : Fin 103, + (edge 141).2 < c → SeedEncoding.indexedAdj (edge 141).1 c → + SeedEncoding.indexedAdj (edge 141).2 c → + triangle (triangleIndex 141 c) = ((edge 141).1,(edge 141).2,c) := by decide +kernel +theorem triangle_complete_142 : ∀ c : Fin 103, + (edge 142).2 < c → SeedEncoding.indexedAdj (edge 142).1 c → + SeedEncoding.indexedAdj (edge 142).2 c → + triangle (triangleIndex 142 c) = ((edge 142).1,(edge 142).2,c) := by decide +kernel +theorem triangle_complete_143 : ∀ c : Fin 103, + (edge 143).2 < c → SeedEncoding.indexedAdj (edge 143).1 c → + SeedEncoding.indexedAdj (edge 143).2 c → + triangle (triangleIndex 143 c) = ((edge 143).1,(edge 143).2,c) := by decide +kernel +theorem triangle_complete_144 : ∀ c : Fin 103, + (edge 144).2 < c → SeedEncoding.indexedAdj (edge 144).1 c → + SeedEncoding.indexedAdj (edge 144).2 c → + triangle (triangleIndex 144 c) = ((edge 144).1,(edge 144).2,c) := by decide +kernel +theorem triangle_complete_145 : ∀ c : Fin 103, + (edge 145).2 < c → SeedEncoding.indexedAdj (edge 145).1 c → + SeedEncoding.indexedAdj (edge 145).2 c → + triangle (triangleIndex 145 c) = ((edge 145).1,(edge 145).2,c) := by decide +kernel +theorem triangle_complete_146 : ∀ c : Fin 103, + (edge 146).2 < c → SeedEncoding.indexedAdj (edge 146).1 c → + SeedEncoding.indexedAdj (edge 146).2 c → + triangle (triangleIndex 146 c) = ((edge 146).1,(edge 146).2,c) := by decide +kernel +theorem triangle_complete_147 : ∀ c : Fin 103, + (edge 147).2 < c → SeedEncoding.indexedAdj (edge 147).1 c → + SeedEncoding.indexedAdj (edge 147).2 c → + triangle (triangleIndex 147 c) = ((edge 147).1,(edge 147).2,c) := by decide +kernel +theorem triangle_complete_148 : ∀ c : Fin 103, + (edge 148).2 < c → SeedEncoding.indexedAdj (edge 148).1 c → + SeedEncoding.indexedAdj (edge 148).2 c → + triangle (triangleIndex 148 c) = ((edge 148).1,(edge 148).2,c) := by decide +kernel +theorem triangle_complete_149 : ∀ c : Fin 103, + (edge 149).2 < c → SeedEncoding.indexedAdj (edge 149).1 c → + SeedEncoding.indexedAdj (edge 149).2 c → + triangle (triangleIndex 149 c) = ((edge 149).1,(edge 149).2,c) := by decide +kernel +theorem triangle_complete_150 : ∀ c : Fin 103, + (edge 150).2 < c → SeedEncoding.indexedAdj (edge 150).1 c → + SeedEncoding.indexedAdj (edge 150).2 c → + triangle (triangleIndex 150 c) = ((edge 150).1,(edge 150).2,c) := by decide +kernel +theorem triangle_complete_151 : ∀ c : Fin 103, + (edge 151).2 < c → SeedEncoding.indexedAdj (edge 151).1 c → + SeedEncoding.indexedAdj (edge 151).2 c → + triangle (triangleIndex 151 c) = ((edge 151).1,(edge 151).2,c) := by decide +kernel +theorem triangle_complete_152 : ∀ c : Fin 103, + (edge 152).2 < c → SeedEncoding.indexedAdj (edge 152).1 c → + SeedEncoding.indexedAdj (edge 152).2 c → + triangle (triangleIndex 152 c) = ((edge 152).1,(edge 152).2,c) := by decide +kernel +theorem triangle_complete_153 : ∀ c : Fin 103, + (edge 153).2 < c → SeedEncoding.indexedAdj (edge 153).1 c → + SeedEncoding.indexedAdj (edge 153).2 c → + triangle (triangleIndex 153 c) = ((edge 153).1,(edge 153).2,c) := by decide +kernel +theorem triangle_complete_154 : ∀ c : Fin 103, + (edge 154).2 < c → SeedEncoding.indexedAdj (edge 154).1 c → + SeedEncoding.indexedAdj (edge 154).2 c → + triangle (triangleIndex 154 c) = ((edge 154).1,(edge 154).2,c) := by decide +kernel +theorem triangle_complete_155 : ∀ c : Fin 103, + (edge 155).2 < c → SeedEncoding.indexedAdj (edge 155).1 c → + SeedEncoding.indexedAdj (edge 155).2 c → + triangle (triangleIndex 155 c) = ((edge 155).1,(edge 155).2,c) := by decide +kernel +theorem triangle_complete_156 : ∀ c : Fin 103, + (edge 156).2 < c → SeedEncoding.indexedAdj (edge 156).1 c → + SeedEncoding.indexedAdj (edge 156).2 c → + triangle (triangleIndex 156 c) = ((edge 156).1,(edge 156).2,c) := by decide +kernel +theorem triangle_complete_157 : ∀ c : Fin 103, + (edge 157).2 < c → SeedEncoding.indexedAdj (edge 157).1 c → + SeedEncoding.indexedAdj (edge 157).2 c → + triangle (triangleIndex 157 c) = ((edge 157).1,(edge 157).2,c) := by decide +kernel +theorem triangle_complete_158 : ∀ c : Fin 103, + (edge 158).2 < c → SeedEncoding.indexedAdj (edge 158).1 c → + SeedEncoding.indexedAdj (edge 158).2 c → + triangle (triangleIndex 158 c) = ((edge 158).1,(edge 158).2,c) := by decide +kernel +theorem triangle_complete_159 : ∀ c : Fin 103, + (edge 159).2 < c → SeedEncoding.indexedAdj (edge 159).1 c → + SeedEncoding.indexedAdj (edge 159).2 c → + triangle (triangleIndex 159 c) = ((edge 159).1,(edge 159).2,c) := by decide +kernel +theorem triangle_complete_160 : ∀ c : Fin 103, + (edge 160).2 < c → SeedEncoding.indexedAdj (edge 160).1 c → + SeedEncoding.indexedAdj (edge 160).2 c → + triangle (triangleIndex 160 c) = ((edge 160).1,(edge 160).2,c) := by decide +kernel +theorem triangle_complete_161 : ∀ c : Fin 103, + (edge 161).2 < c → SeedEncoding.indexedAdj (edge 161).1 c → + SeedEncoding.indexedAdj (edge 161).2 c → + triangle (triangleIndex 161 c) = ((edge 161).1,(edge 161).2,c) := by decide +kernel +theorem triangle_complete_162 : ∀ c : Fin 103, + (edge 162).2 < c → SeedEncoding.indexedAdj (edge 162).1 c → + SeedEncoding.indexedAdj (edge 162).2 c → + triangle (triangleIndex 162 c) = ((edge 162).1,(edge 162).2,c) := by decide +kernel +theorem triangle_complete_163 : ∀ c : Fin 103, + (edge 163).2 < c → SeedEncoding.indexedAdj (edge 163).1 c → + SeedEncoding.indexedAdj (edge 163).2 c → + triangle (triangleIndex 163 c) = ((edge 163).1,(edge 163).2,c) := by decide +kernel +theorem triangle_complete_164 : ∀ c : Fin 103, + (edge 164).2 < c → SeedEncoding.indexedAdj (edge 164).1 c → + SeedEncoding.indexedAdj (edge 164).2 c → + triangle (triangleIndex 164 c) = ((edge 164).1,(edge 164).2,c) := by decide +kernel +theorem triangle_complete_165 : ∀ c : Fin 103, + (edge 165).2 < c → SeedEncoding.indexedAdj (edge 165).1 c → + SeedEncoding.indexedAdj (edge 165).2 c → + triangle (triangleIndex 165 c) = ((edge 165).1,(edge 165).2,c) := by decide +kernel +theorem triangle_complete_166 : ∀ c : Fin 103, + (edge 166).2 < c → SeedEncoding.indexedAdj (edge 166).1 c → + SeedEncoding.indexedAdj (edge 166).2 c → + triangle (triangleIndex 166 c) = ((edge 166).1,(edge 166).2,c) := by decide +kernel +theorem triangle_complete_167 : ∀ c : Fin 103, + (edge 167).2 < c → SeedEncoding.indexedAdj (edge 167).1 c → + SeedEncoding.indexedAdj (edge 167).2 c → + triangle (triangleIndex 167 c) = ((edge 167).1,(edge 167).2,c) := by decide +kernel +theorem triangle_complete_168 : ∀ c : Fin 103, + (edge 168).2 < c → SeedEncoding.indexedAdj (edge 168).1 c → + SeedEncoding.indexedAdj (edge 168).2 c → + triangle (triangleIndex 168 c) = ((edge 168).1,(edge 168).2,c) := by decide +kernel +theorem triangle_complete_169 : ∀ c : Fin 103, + (edge 169).2 < c → SeedEncoding.indexedAdj (edge 169).1 c → + SeedEncoding.indexedAdj (edge 169).2 c → + triangle (triangleIndex 169 c) = ((edge 169).1,(edge 169).2,c) := by decide +kernel +theorem triangle_complete_170 : ∀ c : Fin 103, + (edge 170).2 < c → SeedEncoding.indexedAdj (edge 170).1 c → + SeedEncoding.indexedAdj (edge 170).2 c → + triangle (triangleIndex 170 c) = ((edge 170).1,(edge 170).2,c) := by decide +kernel +theorem triangle_complete_171 : ∀ c : Fin 103, + (edge 171).2 < c → SeedEncoding.indexedAdj (edge 171).1 c → + SeedEncoding.indexedAdj (edge 171).2 c → + triangle (triangleIndex 171 c) = ((edge 171).1,(edge 171).2,c) := by decide +kernel +theorem triangle_complete_172 : ∀ c : Fin 103, + (edge 172).2 < c → SeedEncoding.indexedAdj (edge 172).1 c → + SeedEncoding.indexedAdj (edge 172).2 c → + triangle (triangleIndex 172 c) = ((edge 172).1,(edge 172).2,c) := by decide +kernel +theorem triangle_complete_173 : ∀ c : Fin 103, + (edge 173).2 < c → SeedEncoding.indexedAdj (edge 173).1 c → + SeedEncoding.indexedAdj (edge 173).2 c → + triangle (triangleIndex 173 c) = ((edge 173).1,(edge 173).2,c) := by decide +kernel +theorem triangle_complete_174 : ∀ c : Fin 103, + (edge 174).2 < c → SeedEncoding.indexedAdj (edge 174).1 c → + SeedEncoding.indexedAdj (edge 174).2 c → + triangle (triangleIndex 174 c) = ((edge 174).1,(edge 174).2,c) := by decide +kernel +theorem triangle_complete_175 : ∀ c : Fin 103, + (edge 175).2 < c → SeedEncoding.indexedAdj (edge 175).1 c → + SeedEncoding.indexedAdj (edge 175).2 c → + triangle (triangleIndex 175 c) = ((edge 175).1,(edge 175).2,c) := by decide +kernel +theorem triangle_complete_176 : ∀ c : Fin 103, + (edge 176).2 < c → SeedEncoding.indexedAdj (edge 176).1 c → + SeedEncoding.indexedAdj (edge 176).2 c → + triangle (triangleIndex 176 c) = ((edge 176).1,(edge 176).2,c) := by decide +kernel +theorem triangle_complete_177 : ∀ c : Fin 103, + (edge 177).2 < c → SeedEncoding.indexedAdj (edge 177).1 c → + SeedEncoding.indexedAdj (edge 177).2 c → + triangle (triangleIndex 177 c) = ((edge 177).1,(edge 177).2,c) := by decide +kernel +theorem triangle_complete_178 : ∀ c : Fin 103, + (edge 178).2 < c → SeedEncoding.indexedAdj (edge 178).1 c → + SeedEncoding.indexedAdj (edge 178).2 c → + triangle (triangleIndex 178 c) = ((edge 178).1,(edge 178).2,c) := by decide +kernel +theorem triangle_complete_179 : ∀ c : Fin 103, + (edge 179).2 < c → SeedEncoding.indexedAdj (edge 179).1 c → + SeedEncoding.indexedAdj (edge 179).2 c → + triangle (triangleIndex 179 c) = ((edge 179).1,(edge 179).2,c) := by decide +kernel +theorem triangle_complete_180 : ∀ c : Fin 103, + (edge 180).2 < c → SeedEncoding.indexedAdj (edge 180).1 c → + SeedEncoding.indexedAdj (edge 180).2 c → + triangle (triangleIndex 180 c) = ((edge 180).1,(edge 180).2,c) := by decide +kernel +theorem triangle_complete_181 : ∀ c : Fin 103, + (edge 181).2 < c → SeedEncoding.indexedAdj (edge 181).1 c → + SeedEncoding.indexedAdj (edge 181).2 c → + triangle (triangleIndex 181 c) = ((edge 181).1,(edge 181).2,c) := by decide +kernel +theorem triangle_complete_182 : ∀ c : Fin 103, + (edge 182).2 < c → SeedEncoding.indexedAdj (edge 182).1 c → + SeedEncoding.indexedAdj (edge 182).2 c → + triangle (triangleIndex 182 c) = ((edge 182).1,(edge 182).2,c) := by decide +kernel +theorem triangle_complete_183 : ∀ c : Fin 103, + (edge 183).2 < c → SeedEncoding.indexedAdj (edge 183).1 c → + SeedEncoding.indexedAdj (edge 183).2 c → + triangle (triangleIndex 183 c) = ((edge 183).1,(edge 183).2,c) := by decide +kernel +theorem triangle_complete_184 : ∀ c : Fin 103, + (edge 184).2 < c → SeedEncoding.indexedAdj (edge 184).1 c → + SeedEncoding.indexedAdj (edge 184).2 c → + triangle (triangleIndex 184 c) = ((edge 184).1,(edge 184).2,c) := by decide +kernel +theorem triangle_complete_185 : ∀ c : Fin 103, + (edge 185).2 < c → SeedEncoding.indexedAdj (edge 185).1 c → + SeedEncoding.indexedAdj (edge 185).2 c → + triangle (triangleIndex 185 c) = ((edge 185).1,(edge 185).2,c) := by decide +kernel +theorem triangle_complete_186 : ∀ c : Fin 103, + (edge 186).2 < c → SeedEncoding.indexedAdj (edge 186).1 c → + SeedEncoding.indexedAdj (edge 186).2 c → + triangle (triangleIndex 186 c) = ((edge 186).1,(edge 186).2,c) := by decide +kernel +theorem triangle_complete_187 : ∀ c : Fin 103, + (edge 187).2 < c → SeedEncoding.indexedAdj (edge 187).1 c → + SeedEncoding.indexedAdj (edge 187).2 c → + triangle (triangleIndex 187 c) = ((edge 187).1,(edge 187).2,c) := by decide +kernel +theorem triangle_complete_188 : ∀ c : Fin 103, + (edge 188).2 < c → SeedEncoding.indexedAdj (edge 188).1 c → + SeedEncoding.indexedAdj (edge 188).2 c → + triangle (triangleIndex 188 c) = ((edge 188).1,(edge 188).2,c) := by decide +kernel +theorem triangle_complete_189 : ∀ c : Fin 103, + (edge 189).2 < c → SeedEncoding.indexedAdj (edge 189).1 c → + SeedEncoding.indexedAdj (edge 189).2 c → + triangle (triangleIndex 189 c) = ((edge 189).1,(edge 189).2,c) := by decide +kernel +theorem triangle_complete_190 : ∀ c : Fin 103, + (edge 190).2 < c → SeedEncoding.indexedAdj (edge 190).1 c → + SeedEncoding.indexedAdj (edge 190).2 c → + triangle (triangleIndex 190 c) = ((edge 190).1,(edge 190).2,c) := by decide +kernel +theorem triangle_complete_191 : ∀ c : Fin 103, + (edge 191).2 < c → SeedEncoding.indexedAdj (edge 191).1 c → + SeedEncoding.indexedAdj (edge 191).2 c → + triangle (triangleIndex 191 c) = ((edge 191).1,(edge 191).2,c) := by decide +kernel +theorem triangle_complete_192 : ∀ c : Fin 103, + (edge 192).2 < c → SeedEncoding.indexedAdj (edge 192).1 c → + SeedEncoding.indexedAdj (edge 192).2 c → + triangle (triangleIndex 192 c) = ((edge 192).1,(edge 192).2,c) := by decide +kernel +theorem triangle_complete_193 : ∀ c : Fin 103, + (edge 193).2 < c → SeedEncoding.indexedAdj (edge 193).1 c → + SeedEncoding.indexedAdj (edge 193).2 c → + triangle (triangleIndex 193 c) = ((edge 193).1,(edge 193).2,c) := by decide +kernel +theorem triangle_complete_194 : ∀ c : Fin 103, + (edge 194).2 < c → SeedEncoding.indexedAdj (edge 194).1 c → + SeedEncoding.indexedAdj (edge 194).2 c → + triangle (triangleIndex 194 c) = ((edge 194).1,(edge 194).2,c) := by decide +kernel +theorem triangle_complete_195 : ∀ c : Fin 103, + (edge 195).2 < c → SeedEncoding.indexedAdj (edge 195).1 c → + SeedEncoding.indexedAdj (edge 195).2 c → + triangle (triangleIndex 195 c) = ((edge 195).1,(edge 195).2,c) := by decide +kernel +theorem triangle_complete_196 : ∀ c : Fin 103, + (edge 196).2 < c → SeedEncoding.indexedAdj (edge 196).1 c → + SeedEncoding.indexedAdj (edge 196).2 c → + triangle (triangleIndex 196 c) = ((edge 196).1,(edge 196).2,c) := by decide +kernel +theorem triangle_complete_197 : ∀ c : Fin 103, + (edge 197).2 < c → SeedEncoding.indexedAdj (edge 197).1 c → + SeedEncoding.indexedAdj (edge 197).2 c → + triangle (triangleIndex 197 c) = ((edge 197).1,(edge 197).2,c) := by decide +kernel +theorem triangle_complete_198 : ∀ c : Fin 103, + (edge 198).2 < c → SeedEncoding.indexedAdj (edge 198).1 c → + SeedEncoding.indexedAdj (edge 198).2 c → + triangle (triangleIndex 198 c) = ((edge 198).1,(edge 198).2,c) := by decide +kernel +theorem triangle_complete_199 : ∀ c : Fin 103, + (edge 199).2 < c → SeedEncoding.indexedAdj (edge 199).1 c → + SeedEncoding.indexedAdj (edge 199).2 c → + triangle (triangleIndex 199 c) = ((edge 199).1,(edge 199).2,c) := by decide +kernel +theorem triangle_complete_200 : ∀ c : Fin 103, + (edge 200).2 < c → SeedEncoding.indexedAdj (edge 200).1 c → + SeedEncoding.indexedAdj (edge 200).2 c → + triangle (triangleIndex 200 c) = ((edge 200).1,(edge 200).2,c) := by decide +kernel +theorem triangle_complete_201 : ∀ c : Fin 103, + (edge 201).2 < c → SeedEncoding.indexedAdj (edge 201).1 c → + SeedEncoding.indexedAdj (edge 201).2 c → + triangle (triangleIndex 201 c) = ((edge 201).1,(edge 201).2,c) := by decide +kernel +theorem triangle_complete_202 : ∀ c : Fin 103, + (edge 202).2 < c → SeedEncoding.indexedAdj (edge 202).1 c → + SeedEncoding.indexedAdj (edge 202).2 c → + triangle (triangleIndex 202 c) = ((edge 202).1,(edge 202).2,c) := by decide +kernel +theorem triangle_complete_203 : ∀ c : Fin 103, + (edge 203).2 < c → SeedEncoding.indexedAdj (edge 203).1 c → + SeedEncoding.indexedAdj (edge 203).2 c → + triangle (triangleIndex 203 c) = ((edge 203).1,(edge 203).2,c) := by decide +kernel +theorem triangle_complete_204 : ∀ c : Fin 103, + (edge 204).2 < c → SeedEncoding.indexedAdj (edge 204).1 c → + SeedEncoding.indexedAdj (edge 204).2 c → + triangle (triangleIndex 204 c) = ((edge 204).1,(edge 204).2,c) := by decide +kernel +theorem triangle_complete_205 : ∀ c : Fin 103, + (edge 205).2 < c → SeedEncoding.indexedAdj (edge 205).1 c → + SeedEncoding.indexedAdj (edge 205).2 c → + triangle (triangleIndex 205 c) = ((edge 205).1,(edge 205).2,c) := by decide +kernel +theorem triangle_complete_206 : ∀ c : Fin 103, + (edge 206).2 < c → SeedEncoding.indexedAdj (edge 206).1 c → + SeedEncoding.indexedAdj (edge 206).2 c → + triangle (triangleIndex 206 c) = ((edge 206).1,(edge 206).2,c) := by decide +kernel +theorem triangle_complete_207 : ∀ c : Fin 103, + (edge 207).2 < c → SeedEncoding.indexedAdj (edge 207).1 c → + SeedEncoding.indexedAdj (edge 207).2 c → + triangle (triangleIndex 207 c) = ((edge 207).1,(edge 207).2,c) := by decide +kernel +theorem triangle_complete_208 : ∀ c : Fin 103, + (edge 208).2 < c → SeedEncoding.indexedAdj (edge 208).1 c → + SeedEncoding.indexedAdj (edge 208).2 c → + triangle (triangleIndex 208 c) = ((edge 208).1,(edge 208).2,c) := by decide +kernel +theorem triangle_complete_209 : ∀ c : Fin 103, + (edge 209).2 < c → SeedEncoding.indexedAdj (edge 209).1 c → + SeedEncoding.indexedAdj (edge 209).2 c → + triangle (triangleIndex 209 c) = ((edge 209).1,(edge 209).2,c) := by decide +kernel +theorem triangle_complete_210 : ∀ c : Fin 103, + (edge 210).2 < c → SeedEncoding.indexedAdj (edge 210).1 c → + SeedEncoding.indexedAdj (edge 210).2 c → + triangle (triangleIndex 210 c) = ((edge 210).1,(edge 210).2,c) := by decide +kernel +theorem triangle_complete_211 : ∀ c : Fin 103, + (edge 211).2 < c → SeedEncoding.indexedAdj (edge 211).1 c → + SeedEncoding.indexedAdj (edge 211).2 c → + triangle (triangleIndex 211 c) = ((edge 211).1,(edge 211).2,c) := by decide +kernel +theorem triangle_complete_212 : ∀ c : Fin 103, + (edge 212).2 < c → SeedEncoding.indexedAdj (edge 212).1 c → + SeedEncoding.indexedAdj (edge 212).2 c → + triangle (triangleIndex 212 c) = ((edge 212).1,(edge 212).2,c) := by decide +kernel +theorem triangle_complete_213 : ∀ c : Fin 103, + (edge 213).2 < c → SeedEncoding.indexedAdj (edge 213).1 c → + SeedEncoding.indexedAdj (edge 213).2 c → + triangle (triangleIndex 213 c) = ((edge 213).1,(edge 213).2,c) := by decide +kernel +theorem triangle_complete_214 : ∀ c : Fin 103, + (edge 214).2 < c → SeedEncoding.indexedAdj (edge 214).1 c → + SeedEncoding.indexedAdj (edge 214).2 c → + triangle (triangleIndex 214 c) = ((edge 214).1,(edge 214).2,c) := by decide +kernel +theorem triangle_complete_215 : ∀ c : Fin 103, + (edge 215).2 < c → SeedEncoding.indexedAdj (edge 215).1 c → + SeedEncoding.indexedAdj (edge 215).2 c → + triangle (triangleIndex 215 c) = ((edge 215).1,(edge 215).2,c) := by decide +kernel +theorem triangle_complete_216 : ∀ c : Fin 103, + (edge 216).2 < c → SeedEncoding.indexedAdj (edge 216).1 c → + SeedEncoding.indexedAdj (edge 216).2 c → + triangle (triangleIndex 216 c) = ((edge 216).1,(edge 216).2,c) := by decide +kernel +theorem triangle_complete_217 : ∀ c : Fin 103, + (edge 217).2 < c → SeedEncoding.indexedAdj (edge 217).1 c → + SeedEncoding.indexedAdj (edge 217).2 c → + triangle (triangleIndex 217 c) = ((edge 217).1,(edge 217).2,c) := by decide +kernel +theorem triangle_complete_218 : ∀ c : Fin 103, + (edge 218).2 < c → SeedEncoding.indexedAdj (edge 218).1 c → + SeedEncoding.indexedAdj (edge 218).2 c → + triangle (triangleIndex 218 c) = ((edge 218).1,(edge 218).2,c) := by decide +kernel +theorem triangle_complete_219 : ∀ c : Fin 103, + (edge 219).2 < c → SeedEncoding.indexedAdj (edge 219).1 c → + SeedEncoding.indexedAdj (edge 219).2 c → + triangle (triangleIndex 219 c) = ((edge 219).1,(edge 219).2,c) := by decide +kernel +theorem triangle_complete_220 : ∀ c : Fin 103, + (edge 220).2 < c → SeedEncoding.indexedAdj (edge 220).1 c → + SeedEncoding.indexedAdj (edge 220).2 c → + triangle (triangleIndex 220 c) = ((edge 220).1,(edge 220).2,c) := by decide +kernel +theorem triangle_complete_221 : ∀ c : Fin 103, + (edge 221).2 < c → SeedEncoding.indexedAdj (edge 221).1 c → + SeedEncoding.indexedAdj (edge 221).2 c → + triangle (triangleIndex 221 c) = ((edge 221).1,(edge 221).2,c) := by decide +kernel +theorem triangle_complete_222 : ∀ c : Fin 103, + (edge 222).2 < c → SeedEncoding.indexedAdj (edge 222).1 c → + SeedEncoding.indexedAdj (edge 222).2 c → + triangle (triangleIndex 222 c) = ((edge 222).1,(edge 222).2,c) := by decide +kernel +theorem triangle_complete_223 : ∀ c : Fin 103, + (edge 223).2 < c → SeedEncoding.indexedAdj (edge 223).1 c → + SeedEncoding.indexedAdj (edge 223).2 c → + triangle (triangleIndex 223 c) = ((edge 223).1,(edge 223).2,c) := by decide +kernel +theorem triangle_complete_224 : ∀ c : Fin 103, + (edge 224).2 < c → SeedEncoding.indexedAdj (edge 224).1 c → + SeedEncoding.indexedAdj (edge 224).2 c → + triangle (triangleIndex 224 c) = ((edge 224).1,(edge 224).2,c) := by decide +kernel +theorem triangle_complete_225 : ∀ c : Fin 103, + (edge 225).2 < c → SeedEncoding.indexedAdj (edge 225).1 c → + SeedEncoding.indexedAdj (edge 225).2 c → + triangle (triangleIndex 225 c) = ((edge 225).1,(edge 225).2,c) := by decide +kernel +theorem triangle_complete_226 : ∀ c : Fin 103, + (edge 226).2 < c → SeedEncoding.indexedAdj (edge 226).1 c → + SeedEncoding.indexedAdj (edge 226).2 c → + triangle (triangleIndex 226 c) = ((edge 226).1,(edge 226).2,c) := by decide +kernel +theorem triangle_complete_227 : ∀ c : Fin 103, + (edge 227).2 < c → SeedEncoding.indexedAdj (edge 227).1 c → + SeedEncoding.indexedAdj (edge 227).2 c → + triangle (triangleIndex 227 c) = ((edge 227).1,(edge 227).2,c) := by decide +kernel +theorem triangle_complete_228 : ∀ c : Fin 103, + (edge 228).2 < c → SeedEncoding.indexedAdj (edge 228).1 c → + SeedEncoding.indexedAdj (edge 228).2 c → + triangle (triangleIndex 228 c) = ((edge 228).1,(edge 228).2,c) := by decide +kernel +theorem triangle_complete_229 : ∀ c : Fin 103, + (edge 229).2 < c → SeedEncoding.indexedAdj (edge 229).1 c → + SeedEncoding.indexedAdj (edge 229).2 c → + triangle (triangleIndex 229 c) = ((edge 229).1,(edge 229).2,c) := by decide +kernel +theorem triangle_complete_230 : ∀ c : Fin 103, + (edge 230).2 < c → SeedEncoding.indexedAdj (edge 230).1 c → + SeedEncoding.indexedAdj (edge 230).2 c → + triangle (triangleIndex 230 c) = ((edge 230).1,(edge 230).2,c) := by decide +kernel +theorem triangle_complete_231 : ∀ c : Fin 103, + (edge 231).2 < c → SeedEncoding.indexedAdj (edge 231).1 c → + SeedEncoding.indexedAdj (edge 231).2 c → + triangle (triangleIndex 231 c) = ((edge 231).1,(edge 231).2,c) := by decide +kernel +theorem triangle_complete_232 : ∀ c : Fin 103, + (edge 232).2 < c → SeedEncoding.indexedAdj (edge 232).1 c → + SeedEncoding.indexedAdj (edge 232).2 c → + triangle (triangleIndex 232 c) = ((edge 232).1,(edge 232).2,c) := by decide +kernel +theorem triangle_complete_233 : ∀ c : Fin 103, + (edge 233).2 < c → SeedEncoding.indexedAdj (edge 233).1 c → + SeedEncoding.indexedAdj (edge 233).2 c → + triangle (triangleIndex 233 c) = ((edge 233).1,(edge 233).2,c) := by decide +kernel +theorem triangle_complete_234 : ∀ c : Fin 103, + (edge 234).2 < c → SeedEncoding.indexedAdj (edge 234).1 c → + SeedEncoding.indexedAdj (edge 234).2 c → + triangle (triangleIndex 234 c) = ((edge 234).1,(edge 234).2,c) := by decide +kernel +theorem triangle_complete_235 : ∀ c : Fin 103, + (edge 235).2 < c → SeedEncoding.indexedAdj (edge 235).1 c → + SeedEncoding.indexedAdj (edge 235).2 c → + triangle (triangleIndex 235 c) = ((edge 235).1,(edge 235).2,c) := by decide +kernel +theorem triangle_complete_236 : ∀ c : Fin 103, + (edge 236).2 < c → SeedEncoding.indexedAdj (edge 236).1 c → + SeedEncoding.indexedAdj (edge 236).2 c → + triangle (triangleIndex 236 c) = ((edge 236).1,(edge 236).2,c) := by decide +kernel +theorem triangle_complete_237 : ∀ c : Fin 103, + (edge 237).2 < c → SeedEncoding.indexedAdj (edge 237).1 c → + SeedEncoding.indexedAdj (edge 237).2 c → + triangle (triangleIndex 237 c) = ((edge 237).1,(edge 237).2,c) := by decide +kernel +theorem triangle_complete_238 : ∀ c : Fin 103, + (edge 238).2 < c → SeedEncoding.indexedAdj (edge 238).1 c → + SeedEncoding.indexedAdj (edge 238).2 c → + triangle (triangleIndex 238 c) = ((edge 238).1,(edge 238).2,c) := by decide +kernel +theorem triangle_complete_239 : ∀ c : Fin 103, + (edge 239).2 < c → SeedEncoding.indexedAdj (edge 239).1 c → + SeedEncoding.indexedAdj (edge 239).2 c → + triangle (triangleIndex 239 c) = ((edge 239).1,(edge 239).2,c) := by decide +kernel +theorem triangle_complete_240 : ∀ c : Fin 103, + (edge 240).2 < c → SeedEncoding.indexedAdj (edge 240).1 c → + SeedEncoding.indexedAdj (edge 240).2 c → + triangle (triangleIndex 240 c) = ((edge 240).1,(edge 240).2,c) := by decide +kernel +theorem triangle_complete_241 : ∀ c : Fin 103, + (edge 241).2 < c → SeedEncoding.indexedAdj (edge 241).1 c → + SeedEncoding.indexedAdj (edge 241).2 c → + triangle (triangleIndex 241 c) = ((edge 241).1,(edge 241).2,c) := by decide +kernel +theorem triangle_complete_242 : ∀ c : Fin 103, + (edge 242).2 < c → SeedEncoding.indexedAdj (edge 242).1 c → + SeedEncoding.indexedAdj (edge 242).2 c → + triangle (triangleIndex 242 c) = ((edge 242).1,(edge 242).2,c) := by decide +kernel +theorem triangle_complete_243 : ∀ c : Fin 103, + (edge 243).2 < c → SeedEncoding.indexedAdj (edge 243).1 c → + SeedEncoding.indexedAdj (edge 243).2 c → + triangle (triangleIndex 243 c) = ((edge 243).1,(edge 243).2,c) := by decide +kernel +theorem triangle_complete_244 : ∀ c : Fin 103, + (edge 244).2 < c → SeedEncoding.indexedAdj (edge 244).1 c → + SeedEncoding.indexedAdj (edge 244).2 c → + triangle (triangleIndex 244 c) = ((edge 244).1,(edge 244).2,c) := by decide +kernel +theorem triangle_complete_245 : ∀ c : Fin 103, + (edge 245).2 < c → SeedEncoding.indexedAdj (edge 245).1 c → + SeedEncoding.indexedAdj (edge 245).2 c → + triangle (triangleIndex 245 c) = ((edge 245).1,(edge 245).2,c) := by decide +kernel +theorem triangle_complete_246 : ∀ c : Fin 103, + (edge 246).2 < c → SeedEncoding.indexedAdj (edge 246).1 c → + SeedEncoding.indexedAdj (edge 246).2 c → + triangle (triangleIndex 246 c) = ((edge 246).1,(edge 246).2,c) := by decide +kernel +theorem triangle_complete_247 : ∀ c : Fin 103, + (edge 247).2 < c → SeedEncoding.indexedAdj (edge 247).1 c → + SeedEncoding.indexedAdj (edge 247).2 c → + triangle (triangleIndex 247 c) = ((edge 247).1,(edge 247).2,c) := by decide +kernel +theorem triangle_complete_248 : ∀ c : Fin 103, + (edge 248).2 < c → SeedEncoding.indexedAdj (edge 248).1 c → + SeedEncoding.indexedAdj (edge 248).2 c → + triangle (triangleIndex 248 c) = ((edge 248).1,(edge 248).2,c) := by decide +kernel +theorem triangle_complete_249 : ∀ c : Fin 103, + (edge 249).2 < c → SeedEncoding.indexedAdj (edge 249).1 c → + SeedEncoding.indexedAdj (edge 249).2 c → + triangle (triangleIndex 249 c) = ((edge 249).1,(edge 249).2,c) := by decide +kernel +theorem triangle_complete_250 : ∀ c : Fin 103, + (edge 250).2 < c → SeedEncoding.indexedAdj (edge 250).1 c → + SeedEncoding.indexedAdj (edge 250).2 c → + triangle (triangleIndex 250 c) = ((edge 250).1,(edge 250).2,c) := by decide +kernel +theorem triangle_complete_251 : ∀ c : Fin 103, + (edge 251).2 < c → SeedEncoding.indexedAdj (edge 251).1 c → + SeedEncoding.indexedAdj (edge 251).2 c → + triangle (triangleIndex 251 c) = ((edge 251).1,(edge 251).2,c) := by decide +kernel +theorem triangle_complete_252 : ∀ c : Fin 103, + (edge 252).2 < c → SeedEncoding.indexedAdj (edge 252).1 c → + SeedEncoding.indexedAdj (edge 252).2 c → + triangle (triangleIndex 252 c) = ((edge 252).1,(edge 252).2,c) := by decide +kernel +theorem triangle_complete_253 : ∀ c : Fin 103, + (edge 253).2 < c → SeedEncoding.indexedAdj (edge 253).1 c → + SeedEncoding.indexedAdj (edge 253).2 c → + triangle (triangleIndex 253 c) = ((edge 253).1,(edge 253).2,c) := by decide +kernel +theorem triangle_complete_254 : ∀ c : Fin 103, + (edge 254).2 < c → SeedEncoding.indexedAdj (edge 254).1 c → + SeedEncoding.indexedAdj (edge 254).2 c → + triangle (triangleIndex 254 c) = ((edge 254).1,(edge 254).2,c) := by decide +kernel +theorem triangle_complete_255 : ∀ c : Fin 103, + (edge 255).2 < c → SeedEncoding.indexedAdj (edge 255).1 c → + SeedEncoding.indexedAdj (edge 255).2 c → + triangle (triangleIndex 255 c) = ((edge 255).1,(edge 255).2,c) := by decide +kernel +theorem triangle_complete_256 : ∀ c : Fin 103, + (edge 256).2 < c → SeedEncoding.indexedAdj (edge 256).1 c → + SeedEncoding.indexedAdj (edge 256).2 c → + triangle (triangleIndex 256 c) = ((edge 256).1,(edge 256).2,c) := by decide +kernel +theorem triangle_complete_257 : ∀ c : Fin 103, + (edge 257).2 < c → SeedEncoding.indexedAdj (edge 257).1 c → + SeedEncoding.indexedAdj (edge 257).2 c → + triangle (triangleIndex 257 c) = ((edge 257).1,(edge 257).2,c) := by decide +kernel +theorem triangle_complete_258 : ∀ c : Fin 103, + (edge 258).2 < c → SeedEncoding.indexedAdj (edge 258).1 c → + SeedEncoding.indexedAdj (edge 258).2 c → + triangle (triangleIndex 258 c) = ((edge 258).1,(edge 258).2,c) := by decide +kernel +theorem triangle_complete_259 : ∀ c : Fin 103, + (edge 259).2 < c → SeedEncoding.indexedAdj (edge 259).1 c → + SeedEncoding.indexedAdj (edge 259).2 c → + triangle (triangleIndex 259 c) = ((edge 259).1,(edge 259).2,c) := by decide +kernel +theorem triangle_complete_260 : ∀ c : Fin 103, + (edge 260).2 < c → SeedEncoding.indexedAdj (edge 260).1 c → + SeedEncoding.indexedAdj (edge 260).2 c → + triangle (triangleIndex 260 c) = ((edge 260).1,(edge 260).2,c) := by decide +kernel +theorem triangle_complete_261 : ∀ c : Fin 103, + (edge 261).2 < c → SeedEncoding.indexedAdj (edge 261).1 c → + SeedEncoding.indexedAdj (edge 261).2 c → + triangle (triangleIndex 261 c) = ((edge 261).1,(edge 261).2,c) := by decide +kernel +theorem triangle_complete_262 : ∀ c : Fin 103, + (edge 262).2 < c → SeedEncoding.indexedAdj (edge 262).1 c → + SeedEncoding.indexedAdj (edge 262).2 c → + triangle (triangleIndex 262 c) = ((edge 262).1,(edge 262).2,c) := by decide +kernel +theorem triangle_complete_263 : ∀ c : Fin 103, + (edge 263).2 < c → SeedEncoding.indexedAdj (edge 263).1 c → + SeedEncoding.indexedAdj (edge 263).2 c → + triangle (triangleIndex 263 c) = ((edge 263).1,(edge 263).2,c) := by decide +kernel +theorem triangle_complete_264 : ∀ c : Fin 103, + (edge 264).2 < c → SeedEncoding.indexedAdj (edge 264).1 c → + SeedEncoding.indexedAdj (edge 264).2 c → + triangle (triangleIndex 264 c) = ((edge 264).1,(edge 264).2,c) := by decide +kernel +theorem triangle_complete_265 : ∀ c : Fin 103, + (edge 265).2 < c → SeedEncoding.indexedAdj (edge 265).1 c → + SeedEncoding.indexedAdj (edge 265).2 c → + triangle (triangleIndex 265 c) = ((edge 265).1,(edge 265).2,c) := by decide +kernel +theorem triangle_complete_266 : ∀ c : Fin 103, + (edge 266).2 < c → SeedEncoding.indexedAdj (edge 266).1 c → + SeedEncoding.indexedAdj (edge 266).2 c → + triangle (triangleIndex 266 c) = ((edge 266).1,(edge 266).2,c) := by decide +kernel +theorem triangle_complete_267 : ∀ c : Fin 103, + (edge 267).2 < c → SeedEncoding.indexedAdj (edge 267).1 c → + SeedEncoding.indexedAdj (edge 267).2 c → + triangle (triangleIndex 267 c) = ((edge 267).1,(edge 267).2,c) := by decide +kernel +theorem triangle_complete_268 : ∀ c : Fin 103, + (edge 268).2 < c → SeedEncoding.indexedAdj (edge 268).1 c → + SeedEncoding.indexedAdj (edge 268).2 c → + triangle (triangleIndex 268 c) = ((edge 268).1,(edge 268).2,c) := by decide +kernel +theorem triangle_complete_269 : ∀ c : Fin 103, + (edge 269).2 < c → SeedEncoding.indexedAdj (edge 269).1 c → + SeedEncoding.indexedAdj (edge 269).2 c → + triangle (triangleIndex 269 c) = ((edge 269).1,(edge 269).2,c) := by decide +kernel +theorem triangle_complete_270 : ∀ c : Fin 103, + (edge 270).2 < c → SeedEncoding.indexedAdj (edge 270).1 c → + SeedEncoding.indexedAdj (edge 270).2 c → + triangle (triangleIndex 270 c) = ((edge 270).1,(edge 270).2,c) := by decide +kernel +theorem triangle_complete_271 : ∀ c : Fin 103, + (edge 271).2 < c → SeedEncoding.indexedAdj (edge 271).1 c → + SeedEncoding.indexedAdj (edge 271).2 c → + triangle (triangleIndex 271 c) = ((edge 271).1,(edge 271).2,c) := by decide +kernel +theorem triangle_complete_272 : ∀ c : Fin 103, + (edge 272).2 < c → SeedEncoding.indexedAdj (edge 272).1 c → + SeedEncoding.indexedAdj (edge 272).2 c → + triangle (triangleIndex 272 c) = ((edge 272).1,(edge 272).2,c) := by decide +kernel +theorem triangle_complete_273 : ∀ c : Fin 103, + (edge 273).2 < c → SeedEncoding.indexedAdj (edge 273).1 c → + SeedEncoding.indexedAdj (edge 273).2 c → + triangle (triangleIndex 273 c) = ((edge 273).1,(edge 273).2,c) := by decide +kernel +theorem triangle_complete_274 : ∀ c : Fin 103, + (edge 274).2 < c → SeedEncoding.indexedAdj (edge 274).1 c → + SeedEncoding.indexedAdj (edge 274).2 c → + triangle (triangleIndex 274 c) = ((edge 274).1,(edge 274).2,c) := by decide +kernel +theorem triangle_complete_275 : ∀ c : Fin 103, + (edge 275).2 < c → SeedEncoding.indexedAdj (edge 275).1 c → + SeedEncoding.indexedAdj (edge 275).2 c → + triangle (triangleIndex 275 c) = ((edge 275).1,(edge 275).2,c) := by decide +kernel +theorem triangle_complete_276 : ∀ c : Fin 103, + (edge 276).2 < c → SeedEncoding.indexedAdj (edge 276).1 c → + SeedEncoding.indexedAdj (edge 276).2 c → + triangle (triangleIndex 276 c) = ((edge 276).1,(edge 276).2,c) := by decide +kernel +theorem triangle_complete_277 : ∀ c : Fin 103, + (edge 277).2 < c → SeedEncoding.indexedAdj (edge 277).1 c → + SeedEncoding.indexedAdj (edge 277).2 c → + triangle (triangleIndex 277 c) = ((edge 277).1,(edge 277).2,c) := by decide +kernel +theorem triangle_complete_278 : ∀ c : Fin 103, + (edge 278).2 < c → SeedEncoding.indexedAdj (edge 278).1 c → + SeedEncoding.indexedAdj (edge 278).2 c → + triangle (triangleIndex 278 c) = ((edge 278).1,(edge 278).2,c) := by decide +kernel +theorem triangle_complete_279 : ∀ c : Fin 103, + (edge 279).2 < c → SeedEncoding.indexedAdj (edge 279).1 c → + SeedEncoding.indexedAdj (edge 279).2 c → + triangle (triangleIndex 279 c) = ((edge 279).1,(edge 279).2,c) := by decide +kernel +theorem triangle_complete_280 : ∀ c : Fin 103, + (edge 280).2 < c → SeedEncoding.indexedAdj (edge 280).1 c → + SeedEncoding.indexedAdj (edge 280).2 c → + triangle (triangleIndex 280 c) = ((edge 280).1,(edge 280).2,c) := by decide +kernel +theorem triangle_complete_281 : ∀ c : Fin 103, + (edge 281).2 < c → SeedEncoding.indexedAdj (edge 281).1 c → + SeedEncoding.indexedAdj (edge 281).2 c → + triangle (triangleIndex 281 c) = ((edge 281).1,(edge 281).2,c) := by decide +kernel +theorem triangle_complete_282 : ∀ c : Fin 103, + (edge 282).2 < c → SeedEncoding.indexedAdj (edge 282).1 c → + SeedEncoding.indexedAdj (edge 282).2 c → + triangle (triangleIndex 282 c) = ((edge 282).1,(edge 282).2,c) := by decide +kernel +theorem triangle_complete_283 : ∀ c : Fin 103, + (edge 283).2 < c → SeedEncoding.indexedAdj (edge 283).1 c → + SeedEncoding.indexedAdj (edge 283).2 c → + triangle (triangleIndex 283 c) = ((edge 283).1,(edge 283).2,c) := by decide +kernel +theorem triangle_complete_284 : ∀ c : Fin 103, + (edge 284).2 < c → SeedEncoding.indexedAdj (edge 284).1 c → + SeedEncoding.indexedAdj (edge 284).2 c → + triangle (triangleIndex 284 c) = ((edge 284).1,(edge 284).2,c) := by decide +kernel +theorem triangle_complete_285 : ∀ c : Fin 103, + (edge 285).2 < c → SeedEncoding.indexedAdj (edge 285).1 c → + SeedEncoding.indexedAdj (edge 285).2 c → + triangle (triangleIndex 285 c) = ((edge 285).1,(edge 285).2,c) := by decide +kernel +theorem triangle_complete_286 : ∀ c : Fin 103, + (edge 286).2 < c → SeedEncoding.indexedAdj (edge 286).1 c → + SeedEncoding.indexedAdj (edge 286).2 c → + triangle (triangleIndex 286 c) = ((edge 286).1,(edge 286).2,c) := by decide +kernel +theorem triangle_complete_287 : ∀ c : Fin 103, + (edge 287).2 < c → SeedEncoding.indexedAdj (edge 287).1 c → + SeedEncoding.indexedAdj (edge 287).2 c → + triangle (triangleIndex 287 c) = ((edge 287).1,(edge 287).2,c) := by decide +kernel +theorem triangle_complete_288 : ∀ c : Fin 103, + (edge 288).2 < c → SeedEncoding.indexedAdj (edge 288).1 c → + SeedEncoding.indexedAdj (edge 288).2 c → + triangle (triangleIndex 288 c) = ((edge 288).1,(edge 288).2,c) := by decide +kernel +theorem triangle_complete_289 : ∀ c : Fin 103, + (edge 289).2 < c → SeedEncoding.indexedAdj (edge 289).1 c → + SeedEncoding.indexedAdj (edge 289).2 c → + triangle (triangleIndex 289 c) = ((edge 289).1,(edge 289).2,c) := by decide +kernel +theorem triangle_complete_290 : ∀ c : Fin 103, + (edge 290).2 < c → SeedEncoding.indexedAdj (edge 290).1 c → + SeedEncoding.indexedAdj (edge 290).2 c → + triangle (triangleIndex 290 c) = ((edge 290).1,(edge 290).2,c) := by decide +kernel +theorem triangle_complete_291 : ∀ c : Fin 103, + (edge 291).2 < c → SeedEncoding.indexedAdj (edge 291).1 c → + SeedEncoding.indexedAdj (edge 291).2 c → + triangle (triangleIndex 291 c) = ((edge 291).1,(edge 291).2,c) := by decide +kernel +theorem triangle_complete_292 : ∀ c : Fin 103, + (edge 292).2 < c → SeedEncoding.indexedAdj (edge 292).1 c → + SeedEncoding.indexedAdj (edge 292).2 c → + triangle (triangleIndex 292 c) = ((edge 292).1,(edge 292).2,c) := by decide +kernel +theorem triangle_complete_293 : ∀ c : Fin 103, + (edge 293).2 < c → SeedEncoding.indexedAdj (edge 293).1 c → + SeedEncoding.indexedAdj (edge 293).2 c → + triangle (triangleIndex 293 c) = ((edge 293).1,(edge 293).2,c) := by decide +kernel +theorem triangle_complete_294 : ∀ c : Fin 103, + (edge 294).2 < c → SeedEncoding.indexedAdj (edge 294).1 c → + SeedEncoding.indexedAdj (edge 294).2 c → + triangle (triangleIndex 294 c) = ((edge 294).1,(edge 294).2,c) := by decide +kernel +theorem triangle_complete_295 : ∀ c : Fin 103, + (edge 295).2 < c → SeedEncoding.indexedAdj (edge 295).1 c → + SeedEncoding.indexedAdj (edge 295).2 c → + triangle (triangleIndex 295 c) = ((edge 295).1,(edge 295).2,c) := by decide +kernel +theorem triangle_complete_296 : ∀ c : Fin 103, + (edge 296).2 < c → SeedEncoding.indexedAdj (edge 296).1 c → + SeedEncoding.indexedAdj (edge 296).2 c → + triangle (triangleIndex 296 c) = ((edge 296).1,(edge 296).2,c) := by decide +kernel +theorem triangle_complete_297 : ∀ c : Fin 103, + (edge 297).2 < c → SeedEncoding.indexedAdj (edge 297).1 c → + SeedEncoding.indexedAdj (edge 297).2 c → + triangle (triangleIndex 297 c) = ((edge 297).1,(edge 297).2,c) := by decide +kernel +theorem triangle_complete_298 : ∀ c : Fin 103, + (edge 298).2 < c → SeedEncoding.indexedAdj (edge 298).1 c → + SeedEncoding.indexedAdj (edge 298).2 c → + triangle (triangleIndex 298 c) = ((edge 298).1,(edge 298).2,c) := by decide +kernel +theorem triangle_complete_299 : ∀ c : Fin 103, + (edge 299).2 < c → SeedEncoding.indexedAdj (edge 299).1 c → + SeedEncoding.indexedAdj (edge 299).2 c → + triangle (triangleIndex 299 c) = ((edge 299).1,(edge 299).2,c) := by decide +kernel +theorem triangle_complete_300 : ∀ c : Fin 103, + (edge 300).2 < c → SeedEncoding.indexedAdj (edge 300).1 c → + SeedEncoding.indexedAdj (edge 300).2 c → + triangle (triangleIndex 300 c) = ((edge 300).1,(edge 300).2,c) := by decide +kernel +theorem triangle_complete_301 : ∀ c : Fin 103, + (edge 301).2 < c → SeedEncoding.indexedAdj (edge 301).1 c → + SeedEncoding.indexedAdj (edge 301).2 c → + triangle (triangleIndex 301 c) = ((edge 301).1,(edge 301).2,c) := by decide +kernel +theorem triangle_complete_302 : ∀ c : Fin 103, + (edge 302).2 < c → SeedEncoding.indexedAdj (edge 302).1 c → + SeedEncoding.indexedAdj (edge 302).2 c → + triangle (triangleIndex 302 c) = ((edge 302).1,(edge 302).2,c) := by decide +kernel +theorem triangle_complete_303 : ∀ c : Fin 103, + (edge 303).2 < c → SeedEncoding.indexedAdj (edge 303).1 c → + SeedEncoding.indexedAdj (edge 303).2 c → + triangle (triangleIndex 303 c) = ((edge 303).1,(edge 303).2,c) := by decide +kernel +theorem triangle_complete_304 : ∀ c : Fin 103, + (edge 304).2 < c → SeedEncoding.indexedAdj (edge 304).1 c → + SeedEncoding.indexedAdj (edge 304).2 c → + triangle (triangleIndex 304 c) = ((edge 304).1,(edge 304).2,c) := by decide +kernel +theorem triangle_complete_305 : ∀ c : Fin 103, + (edge 305).2 < c → SeedEncoding.indexedAdj (edge 305).1 c → + SeedEncoding.indexedAdj (edge 305).2 c → + triangle (triangleIndex 305 c) = ((edge 305).1,(edge 305).2,c) := by decide +kernel +theorem triangle_complete_306 : ∀ c : Fin 103, + (edge 306).2 < c → SeedEncoding.indexedAdj (edge 306).1 c → + SeedEncoding.indexedAdj (edge 306).2 c → + triangle (triangleIndex 306 c) = ((edge 306).1,(edge 306).2,c) := by decide +kernel +theorem triangle_complete_307 : ∀ c : Fin 103, + (edge 307).2 < c → SeedEncoding.indexedAdj (edge 307).1 c → + SeedEncoding.indexedAdj (edge 307).2 c → + triangle (triangleIndex 307 c) = ((edge 307).1,(edge 307).2,c) := by decide +kernel +theorem triangle_complete_308 : ∀ c : Fin 103, + (edge 308).2 < c → SeedEncoding.indexedAdj (edge 308).1 c → + SeedEncoding.indexedAdj (edge 308).2 c → + triangle (triangleIndex 308 c) = ((edge 308).1,(edge 308).2,c) := by decide +kernel +theorem triangle_complete_309 : ∀ c : Fin 103, + (edge 309).2 < c → SeedEncoding.indexedAdj (edge 309).1 c → + SeedEncoding.indexedAdj (edge 309).2 c → + triangle (triangleIndex 309 c) = ((edge 309).1,(edge 309).2,c) := by decide +kernel +theorem triangle_complete_310 : ∀ c : Fin 103, + (edge 310).2 < c → SeedEncoding.indexedAdj (edge 310).1 c → + SeedEncoding.indexedAdj (edge 310).2 c → + triangle (triangleIndex 310 c) = ((edge 310).1,(edge 310).2,c) := by decide +kernel +theorem triangle_complete_311 : ∀ c : Fin 103, + (edge 311).2 < c → SeedEncoding.indexedAdj (edge 311).1 c → + SeedEncoding.indexedAdj (edge 311).2 c → + triangle (triangleIndex 311 c) = ((edge 311).1,(edge 311).2,c) := by decide +kernel +theorem triangle_complete_312 : ∀ c : Fin 103, + (edge 312).2 < c → SeedEncoding.indexedAdj (edge 312).1 c → + SeedEncoding.indexedAdj (edge 312).2 c → + triangle (triangleIndex 312 c) = ((edge 312).1,(edge 312).2,c) := by decide +kernel +theorem triangle_complete_313 : ∀ c : Fin 103, + (edge 313).2 < c → SeedEncoding.indexedAdj (edge 313).1 c → + SeedEncoding.indexedAdj (edge 313).2 c → + triangle (triangleIndex 313 c) = ((edge 313).1,(edge 313).2,c) := by decide +kernel +theorem triangle_complete_314 : ∀ c : Fin 103, + (edge 314).2 < c → SeedEncoding.indexedAdj (edge 314).1 c → + SeedEncoding.indexedAdj (edge 314).2 c → + triangle (triangleIndex 314 c) = ((edge 314).1,(edge 314).2,c) := by decide +kernel +theorem triangle_complete_315 : ∀ c : Fin 103, + (edge 315).2 < c → SeedEncoding.indexedAdj (edge 315).1 c → + SeedEncoding.indexedAdj (edge 315).2 c → + triangle (triangleIndex 315 c) = ((edge 315).1,(edge 315).2,c) := by decide +kernel +theorem triangle_complete_316 : ∀ c : Fin 103, + (edge 316).2 < c → SeedEncoding.indexedAdj (edge 316).1 c → + SeedEncoding.indexedAdj (edge 316).2 c → + triangle (triangleIndex 316 c) = ((edge 316).1,(edge 316).2,c) := by decide +kernel +theorem triangle_complete_317 : ∀ c : Fin 103, + (edge 317).2 < c → SeedEncoding.indexedAdj (edge 317).1 c → + SeedEncoding.indexedAdj (edge 317).2 c → + triangle (triangleIndex 317 c) = ((edge 317).1,(edge 317).2,c) := by decide +kernel +theorem triangle_complete_318 : ∀ c : Fin 103, + (edge 318).2 < c → SeedEncoding.indexedAdj (edge 318).1 c → + SeedEncoding.indexedAdj (edge 318).2 c → + triangle (triangleIndex 318 c) = ((edge 318).1,(edge 318).2,c) := by decide +kernel +theorem triangle_complete_319 : ∀ c : Fin 103, + (edge 319).2 < c → SeedEncoding.indexedAdj (edge 319).1 c → + SeedEncoding.indexedAdj (edge 319).2 c → + triangle (triangleIndex 319 c) = ((edge 319).1,(edge 319).2,c) := by decide +kernel +theorem triangle_complete_320 : ∀ c : Fin 103, + (edge 320).2 < c → SeedEncoding.indexedAdj (edge 320).1 c → + SeedEncoding.indexedAdj (edge 320).2 c → + triangle (triangleIndex 320 c) = ((edge 320).1,(edge 320).2,c) := by decide +kernel +theorem triangle_complete_321 : ∀ c : Fin 103, + (edge 321).2 < c → SeedEncoding.indexedAdj (edge 321).1 c → + SeedEncoding.indexedAdj (edge 321).2 c → + triangle (triangleIndex 321 c) = ((edge 321).1,(edge 321).2,c) := by decide +kernel +theorem triangle_complete_322 : ∀ c : Fin 103, + (edge 322).2 < c → SeedEncoding.indexedAdj (edge 322).1 c → + SeedEncoding.indexedAdj (edge 322).2 c → + triangle (triangleIndex 322 c) = ((edge 322).1,(edge 322).2,c) := by decide +kernel +theorem triangle_complete_323 : ∀ c : Fin 103, + (edge 323).2 < c → SeedEncoding.indexedAdj (edge 323).1 c → + SeedEncoding.indexedAdj (edge 323).2 c → + triangle (triangleIndex 323 c) = ((edge 323).1,(edge 323).2,c) := by decide +kernel +theorem triangle_complete_324 : ∀ c : Fin 103, + (edge 324).2 < c → SeedEncoding.indexedAdj (edge 324).1 c → + SeedEncoding.indexedAdj (edge 324).2 c → + triangle (triangleIndex 324 c) = ((edge 324).1,(edge 324).2,c) := by decide +kernel +theorem triangle_complete_325 : ∀ c : Fin 103, + (edge 325).2 < c → SeedEncoding.indexedAdj (edge 325).1 c → + SeedEncoding.indexedAdj (edge 325).2 c → + triangle (triangleIndex 325 c) = ((edge 325).1,(edge 325).2,c) := by decide +kernel +theorem triangle_complete_326 : ∀ c : Fin 103, + (edge 326).2 < c → SeedEncoding.indexedAdj (edge 326).1 c → + SeedEncoding.indexedAdj (edge 326).2 c → + triangle (triangleIndex 326 c) = ((edge 326).1,(edge 326).2,c) := by decide +kernel +theorem triangle_complete_327 : ∀ c : Fin 103, + (edge 327).2 < c → SeedEncoding.indexedAdj (edge 327).1 c → + SeedEncoding.indexedAdj (edge 327).2 c → + triangle (triangleIndex 327 c) = ((edge 327).1,(edge 327).2,c) := by decide +kernel +theorem triangle_complete_328 : ∀ c : Fin 103, + (edge 328).2 < c → SeedEncoding.indexedAdj (edge 328).1 c → + SeedEncoding.indexedAdj (edge 328).2 c → + triangle (triangleIndex 328 c) = ((edge 328).1,(edge 328).2,c) := by decide +kernel +theorem triangle_complete_329 : ∀ c : Fin 103, + (edge 329).2 < c → SeedEncoding.indexedAdj (edge 329).1 c → + SeedEncoding.indexedAdj (edge 329).2 c → + triangle (triangleIndex 329 c) = ((edge 329).1,(edge 329).2,c) := by decide +kernel +theorem triangle_complete_330 : ∀ c : Fin 103, + (edge 330).2 < c → SeedEncoding.indexedAdj (edge 330).1 c → + SeedEncoding.indexedAdj (edge 330).2 c → + triangle (triangleIndex 330 c) = ((edge 330).1,(edge 330).2,c) := by decide +kernel +theorem triangle_complete_331 : ∀ c : Fin 103, + (edge 331).2 < c → SeedEncoding.indexedAdj (edge 331).1 c → + SeedEncoding.indexedAdj (edge 331).2 c → + triangle (triangleIndex 331 c) = ((edge 331).1,(edge 331).2,c) := by decide +kernel +theorem triangle_complete_332 : ∀ c : Fin 103, + (edge 332).2 < c → SeedEncoding.indexedAdj (edge 332).1 c → + SeedEncoding.indexedAdj (edge 332).2 c → + triangle (triangleIndex 332 c) = ((edge 332).1,(edge 332).2,c) := by decide +kernel +theorem triangle_complete_333 : ∀ c : Fin 103, + (edge 333).2 < c → SeedEncoding.indexedAdj (edge 333).1 c → + SeedEncoding.indexedAdj (edge 333).2 c → + triangle (triangleIndex 333 c) = ((edge 333).1,(edge 333).2,c) := by decide +kernel +theorem triangle_complete_334 : ∀ c : Fin 103, + (edge 334).2 < c → SeedEncoding.indexedAdj (edge 334).1 c → + SeedEncoding.indexedAdj (edge 334).2 c → + triangle (triangleIndex 334 c) = ((edge 334).1,(edge 334).2,c) := by decide +kernel +theorem triangle_complete_335 : ∀ c : Fin 103, + (edge 335).2 < c → SeedEncoding.indexedAdj (edge 335).1 c → + SeedEncoding.indexedAdj (edge 335).2 c → + triangle (triangleIndex 335 c) = ((edge 335).1,(edge 335).2,c) := by decide +kernel +theorem triangle_complete_336 : ∀ c : Fin 103, + (edge 336).2 < c → SeedEncoding.indexedAdj (edge 336).1 c → + SeedEncoding.indexedAdj (edge 336).2 c → + triangle (triangleIndex 336 c) = ((edge 336).1,(edge 336).2,c) := by decide +kernel +theorem triangle_complete_337 : ∀ c : Fin 103, + (edge 337).2 < c → SeedEncoding.indexedAdj (edge 337).1 c → + SeedEncoding.indexedAdj (edge 337).2 c → + triangle (triangleIndex 337 c) = ((edge 337).1,(edge 337).2,c) := by decide +kernel +theorem triangle_complete_338 : ∀ c : Fin 103, + (edge 338).2 < c → SeedEncoding.indexedAdj (edge 338).1 c → + SeedEncoding.indexedAdj (edge 338).2 c → + triangle (triangleIndex 338 c) = ((edge 338).1,(edge 338).2,c) := by decide +kernel +theorem triangle_complete_339 : ∀ c : Fin 103, + (edge 339).2 < c → SeedEncoding.indexedAdj (edge 339).1 c → + SeedEncoding.indexedAdj (edge 339).2 c → + triangle (triangleIndex 339 c) = ((edge 339).1,(edge 339).2,c) := by decide +kernel +theorem triangle_complete_340 : ∀ c : Fin 103, + (edge 340).2 < c → SeedEncoding.indexedAdj (edge 340).1 c → + SeedEncoding.indexedAdj (edge 340).2 c → + triangle (triangleIndex 340 c) = ((edge 340).1,(edge 340).2,c) := by decide +kernel +theorem triangle_complete_341 : ∀ c : Fin 103, + (edge 341).2 < c → SeedEncoding.indexedAdj (edge 341).1 c → + SeedEncoding.indexedAdj (edge 341).2 c → + triangle (triangleIndex 341 c) = ((edge 341).1,(edge 341).2,c) := by decide +kernel +theorem triangle_complete_342 : ∀ c : Fin 103, + (edge 342).2 < c → SeedEncoding.indexedAdj (edge 342).1 c → + SeedEncoding.indexedAdj (edge 342).2 c → + triangle (triangleIndex 342 c) = ((edge 342).1,(edge 342).2,c) := by decide +kernel +theorem triangle_complete_343 : ∀ c : Fin 103, + (edge 343).2 < c → SeedEncoding.indexedAdj (edge 343).1 c → + SeedEncoding.indexedAdj (edge 343).2 c → + triangle (triangleIndex 343 c) = ((edge 343).1,(edge 343).2,c) := by decide +kernel +theorem triangle_complete_344 : ∀ c : Fin 103, + (edge 344).2 < c → SeedEncoding.indexedAdj (edge 344).1 c → + SeedEncoding.indexedAdj (edge 344).2 c → + triangle (triangleIndex 344 c) = ((edge 344).1,(edge 344).2,c) := by decide +kernel +theorem triangle_complete_345 : ∀ c : Fin 103, + (edge 345).2 < c → SeedEncoding.indexedAdj (edge 345).1 c → + SeedEncoding.indexedAdj (edge 345).2 c → + triangle (triangleIndex 345 c) = ((edge 345).1,(edge 345).2,c) := by decide +kernel +theorem triangle_complete_346 : ∀ c : Fin 103, + (edge 346).2 < c → SeedEncoding.indexedAdj (edge 346).1 c → + SeedEncoding.indexedAdj (edge 346).2 c → + triangle (triangleIndex 346 c) = ((edge 346).1,(edge 346).2,c) := by decide +kernel +theorem triangle_complete_347 : ∀ c : Fin 103, + (edge 347).2 < c → SeedEncoding.indexedAdj (edge 347).1 c → + SeedEncoding.indexedAdj (edge 347).2 c → + triangle (triangleIndex 347 c) = ((edge 347).1,(edge 347).2,c) := by decide +kernel +theorem triangle_complete_348 : ∀ c : Fin 103, + (edge 348).2 < c → SeedEncoding.indexedAdj (edge 348).1 c → + SeedEncoding.indexedAdj (edge 348).2 c → + triangle (triangleIndex 348 c) = ((edge 348).1,(edge 348).2,c) := by decide +kernel +theorem triangle_complete_349 : ∀ c : Fin 103, + (edge 349).2 < c → SeedEncoding.indexedAdj (edge 349).1 c → + SeedEncoding.indexedAdj (edge 349).2 c → + triangle (triangleIndex 349 c) = ((edge 349).1,(edge 349).2,c) := by decide +kernel +theorem triangle_complete_350 : ∀ c : Fin 103, + (edge 350).2 < c → SeedEncoding.indexedAdj (edge 350).1 c → + SeedEncoding.indexedAdj (edge 350).2 c → + triangle (triangleIndex 350 c) = ((edge 350).1,(edge 350).2,c) := by decide +kernel +theorem triangle_complete_351 : ∀ c : Fin 103, + (edge 351).2 < c → SeedEncoding.indexedAdj (edge 351).1 c → + SeedEncoding.indexedAdj (edge 351).2 c → + triangle (triangleIndex 351 c) = ((edge 351).1,(edge 351).2,c) := by decide +kernel +theorem triangle_complete_352 : ∀ c : Fin 103, + (edge 352).2 < c → SeedEncoding.indexedAdj (edge 352).1 c → + SeedEncoding.indexedAdj (edge 352).2 c → + triangle (triangleIndex 352 c) = ((edge 352).1,(edge 352).2,c) := by decide +kernel +theorem triangle_complete_353 : ∀ c : Fin 103, + (edge 353).2 < c → SeedEncoding.indexedAdj (edge 353).1 c → + SeedEncoding.indexedAdj (edge 353).2 c → + triangle (triangleIndex 353 c) = ((edge 353).1,(edge 353).2,c) := by decide +kernel +theorem triangle_complete_354 : ∀ c : Fin 103, + (edge 354).2 < c → SeedEncoding.indexedAdj (edge 354).1 c → + SeedEncoding.indexedAdj (edge 354).2 c → + triangle (triangleIndex 354 c) = ((edge 354).1,(edge 354).2,c) := by decide +kernel +theorem triangle_complete_355 : ∀ c : Fin 103, + (edge 355).2 < c → SeedEncoding.indexedAdj (edge 355).1 c → + SeedEncoding.indexedAdj (edge 355).2 c → + triangle (triangleIndex 355 c) = ((edge 355).1,(edge 355).2,c) := by decide +kernel +theorem triangle_complete_356 : ∀ c : Fin 103, + (edge 356).2 < c → SeedEncoding.indexedAdj (edge 356).1 c → + SeedEncoding.indexedAdj (edge 356).2 c → + triangle (triangleIndex 356 c) = ((edge 356).1,(edge 356).2,c) := by decide +kernel +theorem triangle_complete_357 : ∀ c : Fin 103, + (edge 357).2 < c → SeedEncoding.indexedAdj (edge 357).1 c → + SeedEncoding.indexedAdj (edge 357).2 c → + triangle (triangleIndex 357 c) = ((edge 357).1,(edge 357).2,c) := by decide +kernel +theorem triangle_complete_358 : ∀ c : Fin 103, + (edge 358).2 < c → SeedEncoding.indexedAdj (edge 358).1 c → + SeedEncoding.indexedAdj (edge 358).2 c → + triangle (triangleIndex 358 c) = ((edge 358).1,(edge 358).2,c) := by decide +kernel +theorem triangle_complete_359 : ∀ c : Fin 103, + (edge 359).2 < c → SeedEncoding.indexedAdj (edge 359).1 c → + SeedEncoding.indexedAdj (edge 359).2 c → + triangle (triangleIndex 359 c) = ((edge 359).1,(edge 359).2,c) := by decide +kernel +theorem triangle_complete_360 : ∀ c : Fin 103, + (edge 360).2 < c → SeedEncoding.indexedAdj (edge 360).1 c → + SeedEncoding.indexedAdj (edge 360).2 c → + triangle (triangleIndex 360 c) = ((edge 360).1,(edge 360).2,c) := by decide +kernel +theorem triangle_complete_361 : ∀ c : Fin 103, + (edge 361).2 < c → SeedEncoding.indexedAdj (edge 361).1 c → + SeedEncoding.indexedAdj (edge 361).2 c → + triangle (triangleIndex 361 c) = ((edge 361).1,(edge 361).2,c) := by decide +kernel +theorem triangle_complete_362 : ∀ c : Fin 103, + (edge 362).2 < c → SeedEncoding.indexedAdj (edge 362).1 c → + SeedEncoding.indexedAdj (edge 362).2 c → + triangle (triangleIndex 362 c) = ((edge 362).1,(edge 362).2,c) := by decide +kernel +theorem triangle_complete_363 : ∀ c : Fin 103, + (edge 363).2 < c → SeedEncoding.indexedAdj (edge 363).1 c → + SeedEncoding.indexedAdj (edge 363).2 c → + triangle (triangleIndex 363 c) = ((edge 363).1,(edge 363).2,c) := by decide +kernel +theorem triangle_complete_364 : ∀ c : Fin 103, + (edge 364).2 < c → SeedEncoding.indexedAdj (edge 364).1 c → + SeedEncoding.indexedAdj (edge 364).2 c → + triangle (triangleIndex 364 c) = ((edge 364).1,(edge 364).2,c) := by decide +kernel +theorem triangle_complete_365 : ∀ c : Fin 103, + (edge 365).2 < c → SeedEncoding.indexedAdj (edge 365).1 c → + SeedEncoding.indexedAdj (edge 365).2 c → + triangle (triangleIndex 365 c) = ((edge 365).1,(edge 365).2,c) := by decide +kernel +theorem triangle_complete_366 : ∀ c : Fin 103, + (edge 366).2 < c → SeedEncoding.indexedAdj (edge 366).1 c → + SeedEncoding.indexedAdj (edge 366).2 c → + triangle (triangleIndex 366 c) = ((edge 366).1,(edge 366).2,c) := by decide +kernel +theorem triangle_complete_367 : ∀ c : Fin 103, + (edge 367).2 < c → SeedEncoding.indexedAdj (edge 367).1 c → + SeedEncoding.indexedAdj (edge 367).2 c → + triangle (triangleIndex 367 c) = ((edge 367).1,(edge 367).2,c) := by decide +kernel +theorem triangle_complete_368 : ∀ c : Fin 103, + (edge 368).2 < c → SeedEncoding.indexedAdj (edge 368).1 c → + SeedEncoding.indexedAdj (edge 368).2 c → + triangle (triangleIndex 368 c) = ((edge 368).1,(edge 368).2,c) := by decide +kernel +theorem triangle_complete_369 : ∀ c : Fin 103, + (edge 369).2 < c → SeedEncoding.indexedAdj (edge 369).1 c → + SeedEncoding.indexedAdj (edge 369).2 c → + triangle (triangleIndex 369 c) = ((edge 369).1,(edge 369).2,c) := by decide +kernel +theorem triangle_complete_370 : ∀ c : Fin 103, + (edge 370).2 < c → SeedEncoding.indexedAdj (edge 370).1 c → + SeedEncoding.indexedAdj (edge 370).2 c → + triangle (triangleIndex 370 c) = ((edge 370).1,(edge 370).2,c) := by decide +kernel +theorem triangle_complete_371 : ∀ c : Fin 103, + (edge 371).2 < c → SeedEncoding.indexedAdj (edge 371).1 c → + SeedEncoding.indexedAdj (edge 371).2 c → + triangle (triangleIndex 371 c) = ((edge 371).1,(edge 371).2,c) := by decide +kernel +theorem edge_valid : ∀ e : Fin 372, + (edge e).1 < (edge e).2 ∧ SeedEncoding.indexedAdj (edge e).1 (edge e).2 := by decide +kernel + +theorem edge_index_inverse : ∀ e : Fin 372, edgeIndex (edge e).1 (edge e).2 = e := by decide +kernel + +theorem triangle_valid : ∀ t : Fin 270, + (triangle t).1 < (triangle t).2.1 ∧ (triangle t).2.1 < (triangle t).2.2 ∧ + SeedEncoding.indexedAdj (triangle t).1 (triangle t).2.1 ∧ + SeedEncoding.indexedAdj (triangle t).1 (triangle t).2.2 ∧ + SeedEncoding.indexedAdj (triangle t).2.1 (triangle t).2.2 := by decide +kernel + +theorem triangle_edges_valid : ∀ t : Fin 270, + edge (triangleEdges t).1 = ((triangle t).2.1,(triangle t).2.2) ∧ + edge (triangleEdges t).2.1 = ((triangle t).1,(triangle t).2.2) ∧ + edge (triangleEdges t).2.2 = ((triangle t).1,(triangle t).2.1) := by decide +kernel + +theorem triangle_index_inverse : ∀ t : Fin 270, + triangleIndex (edgeIndex (triangle t).1 (triangle t).2.1) (triangle t).2.2 = t := by decide +kernel +theorem edge_complete (a b : Fin 103) : a < b → SeedEncoding.indexedAdj a b → + edge (edgeIndex a b) = (a,b) := by + fin_cases a + · exact edge_complete_0 b + · exact edge_complete_1 b + · exact edge_complete_2 b + · exact edge_complete_3 b + · exact edge_complete_4 b + · exact edge_complete_5 b + · exact edge_complete_6 b + · exact edge_complete_7 b + · exact edge_complete_8 b + · exact edge_complete_9 b + · exact edge_complete_10 b + · exact edge_complete_11 b + · exact edge_complete_12 b + · exact edge_complete_13 b + · exact edge_complete_14 b + · exact edge_complete_15 b + · exact edge_complete_16 b + · exact edge_complete_17 b + · exact edge_complete_18 b + · exact edge_complete_19 b + · exact edge_complete_20 b + · exact edge_complete_21 b + · exact edge_complete_22 b + · exact edge_complete_23 b + · exact edge_complete_24 b + · exact edge_complete_25 b + · exact edge_complete_26 b + · exact edge_complete_27 b + · exact edge_complete_28 b + · exact edge_complete_29 b + · exact edge_complete_30 b + · exact edge_complete_31 b + · exact edge_complete_32 b + · exact edge_complete_33 b + · exact edge_complete_34 b + · exact edge_complete_35 b + · exact edge_complete_36 b + · exact edge_complete_37 b + · exact edge_complete_38 b + · exact edge_complete_39 b + · exact edge_complete_40 b + · exact edge_complete_41 b + · exact edge_complete_42 b + · exact edge_complete_43 b + · exact edge_complete_44 b + · exact edge_complete_45 b + · exact edge_complete_46 b + · exact edge_complete_47 b + · exact edge_complete_48 b + · exact edge_complete_49 b + · exact edge_complete_50 b + · exact edge_complete_51 b + · exact edge_complete_52 b + · exact edge_complete_53 b + · exact edge_complete_54 b + · exact edge_complete_55 b + · exact edge_complete_56 b + · exact edge_complete_57 b + · exact edge_complete_58 b + · exact edge_complete_59 b + · exact edge_complete_60 b + · exact edge_complete_61 b + · exact edge_complete_62 b + · exact edge_complete_63 b + · exact edge_complete_64 b + · exact edge_complete_65 b + · exact edge_complete_66 b + · exact edge_complete_67 b + · exact edge_complete_68 b + · exact edge_complete_69 b + · exact edge_complete_70 b + · exact edge_complete_71 b + · exact edge_complete_72 b + · exact edge_complete_73 b + · exact edge_complete_74 b + · exact edge_complete_75 b + · exact edge_complete_76 b + · exact edge_complete_77 b + · exact edge_complete_78 b + · exact edge_complete_79 b + · exact edge_complete_80 b + · exact edge_complete_81 b + · exact edge_complete_82 b + · exact edge_complete_83 b + · exact edge_complete_84 b + · exact edge_complete_85 b + · exact edge_complete_86 b + · exact edge_complete_87 b + · exact edge_complete_88 b + · exact edge_complete_89 b + · exact edge_complete_90 b + · exact edge_complete_91 b + · exact edge_complete_92 b + · exact edge_complete_93 b + · exact edge_complete_94 b + · exact edge_complete_95 b + · exact edge_complete_96 b + · exact edge_complete_97 b + · exact edge_complete_98 b + · exact edge_complete_99 b + · exact edge_complete_100 b + · exact edge_complete_101 b + · exact edge_complete_102 b +theorem triangle_complete (e : Fin 372) (c : Fin 103) : + (edge e).2 < c → SeedEncoding.indexedAdj (edge e).1 c → + SeedEncoding.indexedAdj (edge e).2 c → + triangle (triangleIndex e c) = ((edge e).1,(edge e).2,c) := by + fin_cases e + · exact triangle_complete_0 c + · exact triangle_complete_1 c + · exact triangle_complete_2 c + · exact triangle_complete_3 c + · exact triangle_complete_4 c + · exact triangle_complete_5 c + · exact triangle_complete_6 c + · exact triangle_complete_7 c + · exact triangle_complete_8 c + · exact triangle_complete_9 c + · exact triangle_complete_10 c + · exact triangle_complete_11 c + · exact triangle_complete_12 c + · exact triangle_complete_13 c + · exact triangle_complete_14 c + · exact triangle_complete_15 c + · exact triangle_complete_16 c + · exact triangle_complete_17 c + · exact triangle_complete_18 c + · exact triangle_complete_19 c + · exact triangle_complete_20 c + · exact triangle_complete_21 c + · exact triangle_complete_22 c + · exact triangle_complete_23 c + · exact triangle_complete_24 c + · exact triangle_complete_25 c + · exact triangle_complete_26 c + · exact triangle_complete_27 c + · exact triangle_complete_28 c + · exact triangle_complete_29 c + · exact triangle_complete_30 c + · exact triangle_complete_31 c + · exact triangle_complete_32 c + · exact triangle_complete_33 c + · exact triangle_complete_34 c + · exact triangle_complete_35 c + · exact triangle_complete_36 c + · exact triangle_complete_37 c + · exact triangle_complete_38 c + · exact triangle_complete_39 c + · exact triangle_complete_40 c + · exact triangle_complete_41 c + · exact triangle_complete_42 c + · exact triangle_complete_43 c + · exact triangle_complete_44 c + · exact triangle_complete_45 c + · exact triangle_complete_46 c + · exact triangle_complete_47 c + · exact triangle_complete_48 c + · exact triangle_complete_49 c + · exact triangle_complete_50 c + · exact triangle_complete_51 c + · exact triangle_complete_52 c + · exact triangle_complete_53 c + · exact triangle_complete_54 c + · exact triangle_complete_55 c + · exact triangle_complete_56 c + · exact triangle_complete_57 c + · exact triangle_complete_58 c + · exact triangle_complete_59 c + · exact triangle_complete_60 c + · exact triangle_complete_61 c + · exact triangle_complete_62 c + · exact triangle_complete_63 c + · exact triangle_complete_64 c + · exact triangle_complete_65 c + · exact triangle_complete_66 c + · exact triangle_complete_67 c + · exact triangle_complete_68 c + · exact triangle_complete_69 c + · exact triangle_complete_70 c + · exact triangle_complete_71 c + · exact triangle_complete_72 c + · exact triangle_complete_73 c + · exact triangle_complete_74 c + · exact triangle_complete_75 c + · exact triangle_complete_76 c + · exact triangle_complete_77 c + · exact triangle_complete_78 c + · exact triangle_complete_79 c + · exact triangle_complete_80 c + · exact triangle_complete_81 c + · exact triangle_complete_82 c + · exact triangle_complete_83 c + · exact triangle_complete_84 c + · exact triangle_complete_85 c + · exact triangle_complete_86 c + · exact triangle_complete_87 c + · exact triangle_complete_88 c + · exact triangle_complete_89 c + · exact triangle_complete_90 c + · exact triangle_complete_91 c + · exact triangle_complete_92 c + · exact triangle_complete_93 c + · exact triangle_complete_94 c + · exact triangle_complete_95 c + · exact triangle_complete_96 c + · exact triangle_complete_97 c + · exact triangle_complete_98 c + · exact triangle_complete_99 c + · exact triangle_complete_100 c + · exact triangle_complete_101 c + · exact triangle_complete_102 c + · exact triangle_complete_103 c + · exact triangle_complete_104 c + · exact triangle_complete_105 c + · exact triangle_complete_106 c + · exact triangle_complete_107 c + · exact triangle_complete_108 c + · exact triangle_complete_109 c + · exact triangle_complete_110 c + · exact triangle_complete_111 c + · exact triangle_complete_112 c + · exact triangle_complete_113 c + · exact triangle_complete_114 c + · exact triangle_complete_115 c + · exact triangle_complete_116 c + · exact triangle_complete_117 c + · exact triangle_complete_118 c + · exact triangle_complete_119 c + · exact triangle_complete_120 c + · exact triangle_complete_121 c + · exact triangle_complete_122 c + · exact triangle_complete_123 c + · exact triangle_complete_124 c + · exact triangle_complete_125 c + · exact triangle_complete_126 c + · exact triangle_complete_127 c + · exact triangle_complete_128 c + · exact triangle_complete_129 c + · exact triangle_complete_130 c + · exact triangle_complete_131 c + · exact triangle_complete_132 c + · exact triangle_complete_133 c + · exact triangle_complete_134 c + · exact triangle_complete_135 c + · exact triangle_complete_136 c + · exact triangle_complete_137 c + · exact triangle_complete_138 c + · exact triangle_complete_139 c + · exact triangle_complete_140 c + · exact triangle_complete_141 c + · exact triangle_complete_142 c + · exact triangle_complete_143 c + · exact triangle_complete_144 c + · exact triangle_complete_145 c + · exact triangle_complete_146 c + · exact triangle_complete_147 c + · exact triangle_complete_148 c + · exact triangle_complete_149 c + · exact triangle_complete_150 c + · exact triangle_complete_151 c + · exact triangle_complete_152 c + · exact triangle_complete_153 c + · exact triangle_complete_154 c + · exact triangle_complete_155 c + · exact triangle_complete_156 c + · exact triangle_complete_157 c + · exact triangle_complete_158 c + · exact triangle_complete_159 c + · exact triangle_complete_160 c + · exact triangle_complete_161 c + · exact triangle_complete_162 c + · exact triangle_complete_163 c + · exact triangle_complete_164 c + · exact triangle_complete_165 c + · exact triangle_complete_166 c + · exact triangle_complete_167 c + · exact triangle_complete_168 c + · exact triangle_complete_169 c + · exact triangle_complete_170 c + · exact triangle_complete_171 c + · exact triangle_complete_172 c + · exact triangle_complete_173 c + · exact triangle_complete_174 c + · exact triangle_complete_175 c + · exact triangle_complete_176 c + · exact triangle_complete_177 c + · exact triangle_complete_178 c + · exact triangle_complete_179 c + · exact triangle_complete_180 c + · exact triangle_complete_181 c + · exact triangle_complete_182 c + · exact triangle_complete_183 c + · exact triangle_complete_184 c + · exact triangle_complete_185 c + · exact triangle_complete_186 c + · exact triangle_complete_187 c + · exact triangle_complete_188 c + · exact triangle_complete_189 c + · exact triangle_complete_190 c + · exact triangle_complete_191 c + · exact triangle_complete_192 c + · exact triangle_complete_193 c + · exact triangle_complete_194 c + · exact triangle_complete_195 c + · exact triangle_complete_196 c + · exact triangle_complete_197 c + · exact triangle_complete_198 c + · exact triangle_complete_199 c + · exact triangle_complete_200 c + · exact triangle_complete_201 c + · exact triangle_complete_202 c + · exact triangle_complete_203 c + · exact triangle_complete_204 c + · exact triangle_complete_205 c + · exact triangle_complete_206 c + · exact triangle_complete_207 c + · exact triangle_complete_208 c + · exact triangle_complete_209 c + · exact triangle_complete_210 c + · exact triangle_complete_211 c + · exact triangle_complete_212 c + · exact triangle_complete_213 c + · exact triangle_complete_214 c + · exact triangle_complete_215 c + · exact triangle_complete_216 c + · exact triangle_complete_217 c + · exact triangle_complete_218 c + · exact triangle_complete_219 c + · exact triangle_complete_220 c + · exact triangle_complete_221 c + · exact triangle_complete_222 c + · exact triangle_complete_223 c + · exact triangle_complete_224 c + · exact triangle_complete_225 c + · exact triangle_complete_226 c + · exact triangle_complete_227 c + · exact triangle_complete_228 c + · exact triangle_complete_229 c + · exact triangle_complete_230 c + · exact triangle_complete_231 c + · exact triangle_complete_232 c + · exact triangle_complete_233 c + · exact triangle_complete_234 c + · exact triangle_complete_235 c + · exact triangle_complete_236 c + · exact triangle_complete_237 c + · exact triangle_complete_238 c + · exact triangle_complete_239 c + · exact triangle_complete_240 c + · exact triangle_complete_241 c + · exact triangle_complete_242 c + · exact triangle_complete_243 c + · exact triangle_complete_244 c + · exact triangle_complete_245 c + · exact triangle_complete_246 c + · exact triangle_complete_247 c + · exact triangle_complete_248 c + · exact triangle_complete_249 c + · exact triangle_complete_250 c + · exact triangle_complete_251 c + · exact triangle_complete_252 c + · exact triangle_complete_253 c + · exact triangle_complete_254 c + · exact triangle_complete_255 c + · exact triangle_complete_256 c + · exact triangle_complete_257 c + · exact triangle_complete_258 c + · exact triangle_complete_259 c + · exact triangle_complete_260 c + · exact triangle_complete_261 c + · exact triangle_complete_262 c + · exact triangle_complete_263 c + · exact triangle_complete_264 c + · exact triangle_complete_265 c + · exact triangle_complete_266 c + · exact triangle_complete_267 c + · exact triangle_complete_268 c + · exact triangle_complete_269 c + · exact triangle_complete_270 c + · exact triangle_complete_271 c + · exact triangle_complete_272 c + · exact triangle_complete_273 c + · exact triangle_complete_274 c + · exact triangle_complete_275 c + · exact triangle_complete_276 c + · exact triangle_complete_277 c + · exact triangle_complete_278 c + · exact triangle_complete_279 c + · exact triangle_complete_280 c + · exact triangle_complete_281 c + · exact triangle_complete_282 c + · exact triangle_complete_283 c + · exact triangle_complete_284 c + · exact triangle_complete_285 c + · exact triangle_complete_286 c + · exact triangle_complete_287 c + · exact triangle_complete_288 c + · exact triangle_complete_289 c + · exact triangle_complete_290 c + · exact triangle_complete_291 c + · exact triangle_complete_292 c + · exact triangle_complete_293 c + · exact triangle_complete_294 c + · exact triangle_complete_295 c + · exact triangle_complete_296 c + · exact triangle_complete_297 c + · exact triangle_complete_298 c + · exact triangle_complete_299 c + · exact triangle_complete_300 c + · exact triangle_complete_301 c + · exact triangle_complete_302 c + · exact triangle_complete_303 c + · exact triangle_complete_304 c + · exact triangle_complete_305 c + · exact triangle_complete_306 c + · exact triangle_complete_307 c + · exact triangle_complete_308 c + · exact triangle_complete_309 c + · exact triangle_complete_310 c + · exact triangle_complete_311 c + · exact triangle_complete_312 c + · exact triangle_complete_313 c + · exact triangle_complete_314 c + · exact triangle_complete_315 c + · exact triangle_complete_316 c + · exact triangle_complete_317 c + · exact triangle_complete_318 c + · exact triangle_complete_319 c + · exact triangle_complete_320 c + · exact triangle_complete_321 c + · exact triangle_complete_322 c + · exact triangle_complete_323 c + · exact triangle_complete_324 c + · exact triangle_complete_325 c + · exact triangle_complete_326 c + · exact triangle_complete_327 c + · exact triangle_complete_328 c + · exact triangle_complete_329 c + · exact triangle_complete_330 c + · exact triangle_complete_331 c + · exact triangle_complete_332 c + · exact triangle_complete_333 c + · exact triangle_complete_334 c + · exact triangle_complete_335 c + · exact triangle_complete_336 c + · exact triangle_complete_337 c + · exact triangle_complete_338 c + · exact triangle_complete_339 c + · exact triangle_complete_340 c + · exact triangle_complete_341 c + · exact triangle_complete_342 c + · exact triangle_complete_343 c + · exact triangle_complete_344 c + · exact triangle_complete_345 c + · exact triangle_complete_346 c + · exact triangle_complete_347 c + · exact triangle_complete_348 c + · exact triangle_complete_349 c + · exact triangle_complete_350 c + · exact triangle_complete_351 c + · exact triangle_complete_352 c + · exact triangle_complete_353 c + · exact triangle_complete_354 c + · exact triangle_complete_355 c + · exact triangle_complete_356 c + · exact triangle_complete_357 c + · exact triangle_complete_358 c + · exact triangle_complete_359 c + · exact triangle_complete_360 c + · exact triangle_complete_361 c + · exact triangle_complete_362 c + · exact triangle_complete_363 c + · exact triangle_complete_364 c + · exact triangle_complete_365 c + · exact triangle_complete_366 c + · exact triangle_complete_367 c + · exact triangle_complete_368 c + · exact triangle_complete_369 c + · exact triangle_complete_370 c + · exact triangle_complete_371 c +def rankIndex (a : Fin 103) : Fin 3 := if a.val < 7 then 0 else if a.val < 58 then 1 else 2 + theorem sorted_adj_rank : ∀ a b : Fin 103, a < b → SeedEncoding.indexedAdj a b → + rankIndex a < rankIndex b := by decide +kernel +end EilenbergGanea.SeedChainCertificate +namespace EilenbergGanea.SeedChainCertificate +open SimplicialChains + +def graph : SimpleGraph (Fin 103) := seedGraph.comap SeedEncoding.cellAt +@[simp] theorem graph_adj (a b : Fin 103) : graph.Adj a b ↔ SeedEncoding.indexedAdj a b := + SeedEncoding.adjacency_certificate a b + + theorem valid_pair_iff (a b : Fin 103) : + Valid graph [a,b] ↔ a < b ∧ SeedEncoding.indexedAdj a b := by simp [Valid] + theorem valid_triple_iff (a b c : Fin 103) : + Valid graph [a,b,c] ↔ a < b ∧ b < c ∧ SeedEncoding.indexedAdj a b ∧ + SeedEncoding.indexedAdj a c ∧ SeedEncoding.indexedAdj b c := by + simp [Valid] + constructor + · rintro ⟨⟨⟨hab,_⟩,hbc⟩,⟨⟨h₁,h₂⟩,h₃⟩⟩ + exact ⟨hab,hbc,h₁,h₂,h₃⟩ + · rintro ⟨hab,hbc,h₁,h₂,h₃⟩ + exact ⟨⟨⟨hab,hab.trans hbc⟩,hbc⟩,⟨⟨h₁,h₂⟩,h₃⟩⟩ + + theorem valid_length_le (w : List (Fin 103)) (hw : Valid graph w) : w.length ≤ 3 := by + have hp : w.Pairwise (fun a b => rankIndex a < rankIndex b) := by + have hh := hw.1.and hw.2 + exact hh.imp (fun {a b} h => sorted_adj_rank a b h.1 ((graph_adj a b).mp h.2)) + have hn : (w.map rankIndex).Nodup := by + apply List.nodup_iff_pairwise_ne.mpr + rw [List.pairwise_map] + exact hp.imp (fun {_ _} h => ne_of_lt h) + have he := hn.length_le_card + simpa using he + + def indices : TwoDimensionalIndices (L := graph) (Fin 372) (Fin 270) where + edge := edge + triangle := triangle + face := triangleEdges + edgeIndex := edgeIndex + triangleIndex := fun a b c => triangleIndex (edgeIndex a b) c + edge_valid := fun e => (valid_pair_iff _ _).mpr (edge_valid e) + triangle_valid := fun t => (valid_triple_iff _ _ _).mpr (triangle_valid t) + edge_inverse := edge_index_inverse + edge_complete := fun a b h => edge_complete a b ((valid_pair_iff a b).mp h).1 + ((valid_pair_iff a b).mp h).2 + triangle_complete := by + intro a b c h + obtain ⟨hab,hbc,h₁,h₂,h₃⟩ := (valid_triple_iff a b c).mp h + have he := edge_complete a b hab h₁ + have ht := triangle_complete (edgeIndex a b) c + rw [he] at ht + exact ht hbc h₂ h₃ + face_edge := triangle_edges_valid + length_le := valid_length_le + +end EilenbergGanea.SeedChainCertificate + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/SeedConnection.lean b/lean/OAI/Topology/EilenbergGanea/SeedConnection.lean index 9f4f8b3b7b19c10a717c08f88899ee8354e89805..993e846cd3be9afa83d80ca548e57636fa569664 100644 --- a/lean/OAI/Topology/EilenbergGanea/SeedConnection.lean +++ b/lean/OAI/Topology/EilenbergGanea/SeedConnection.lean @@ -1,277 +1,277 @@ -import OAI.Topology.EilenbergGanea.SeedHolonomy -import OAI.GroupTheory.RightAngledArtin.Basic - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -namespace EilenbergGanea -namespace SeedConnection - -def circleWord (e : CircleEdge) : FreeGroup Bool := if e.2 = 0 then FreeGroup.of e.1 else 1 - -def boundaryEdgeWord (s : Sector) : FreeGroup Bool := - if (sectorLetter s).2 then circleWord (sectorCircleEdge s) else - (circleWord (sectorCircleEdge s))⁻¹ - -def boundaryWords (r : Bool) : List (FreeGroup Bool) := - List.ofFn (fun i : Fin (boundaryLength r) => boundaryEdgeWord ⟨r,i⟩) - -theorem boundaryWords_prod : ∀ r, (boundaryWords r).prod = seedRelator r := by - decide - -theorem sector_end : ∀ s : Sector, sectorStart (nextSector s) = - if (sectorLetter s).2 then circleEnd (sectorCircleEdge s) - else circleStart (sectorCircleEdge s) := by decide - -theorem circle_distinct : ∀ e : CircleEdge, circleStart e ≠ circleEnd e := by decide - -theorem sector_distinct : ∀ s : Sector, sectorStart s ≠ sectorStart (nextSector s) := by decide - -def circleLabel (e : CircleEdge) : SeedSU2 := FreeGroup.lift seedLetterUnit (circleWord e) - -def radialLabel (s : Sector) : SeedSU2 := - FreeGroup.lift seedLetterUnit ((boundaryWords s.1).take s.2.val).prod - -@[simp] theorem boundaryWords_length (r : Bool) : (boundaryWords r).length = boundaryLength r := - List.length_ofFn - -@[simp] theorem boundaryWords_get (s : Sector) : - (boundaryWords s.1)[s.2.val]'(by simp) = boundaryEdgeWord s := by - simp [boundaryWords] - -theorem radial_step (s : Sector) : radialLabel (nextSector s) = radialLabel s * - (if (sectorLetter s).2 then circleLabel (sectorCircleEdge s) - else (circleLabel (sectorCircleEdge s))⁻¹) := by - have hs : s.2.val < (boundaryWords s.1).length := by simp - have he := congrArg (FreeGroup.lift seedLetterUnit) (congrArg List.prod - (List.take_succ_eq_append_getElem hs)) - rw [List.prod_append,List.prod_singleton,map_mul,boundaryWords_get] at he - have hf : FreeGroup.lift seedLetterUnit (boundaryEdgeWord s) = - if (sectorLetter s).2 then circleLabel (sectorCircleEdge s) - else (circleLabel (sectorCircleEdge s))⁻¹ := by - unfold boundaryEdgeWord circleLabel - split <;> simp - rw [hf] at he - change radialLabel (nextSector s) = - FreeGroup.lift seedLetterUnit ((boundaryWords s.1).take s.2.val).prod * _ - rw [← he] - unfold radialLabel nextSector - dsimp only - by_cases hn : s.2.val + 1 < boundaryLength s.1 - · rw [Nat.mod_eq_of_lt hn] - · have hn' : s.2.val + 1 = boundaryLength s.1 := by have hh := s.2.isLt; omega - rw [hn',Nat.mod_self,List.take_zero,List.prod_nil,map_one, - ← boundaryWords_length,List.take_length,boundaryWords_prod,seedRelator_unit] - -def edgeAnchor : SeedEdge → SeedVertex - | .inl e => .inl (circleStart e) - | .inr s => .inr s.1 - -def edgeLocal : SeedEdge → SeedVertex → SeedSU2 - | .inl e, v => if v = .inl (circleStart e) then 1 else circleLabel e - | .inr s, v => if v = .inr s.1 then 1 else radialLabel s - -def faceLocal (s : Sector) (v : SeedVertex) : SeedSU2 := - if v = .inr s.1 then 1 else - if v = .inl (sectorStart s) then radialLabel s else radialLabel (nextSector s) - -theorem edgeLocal_anchor (e : SeedEdge) : edgeLocal e (edgeAnchor e) = 1 := by - cases e <;> simp [edgeLocal,edgeAnchor] - -theorem nextSector_first (s : Sector) : (nextSector s).1 = s.1 := rfl - -theorem faceLocal_incidence (s : Sector) (e : SeedEdge) (he : e ∈ sectorEdges s) - (v : SeedVertex) (hv : v ∈ edgeVertices e) : - faceLocal s v = faceLocal s (edgeAnchor e) * edgeLocal e v := by - simp only [sectorEdges,Finset.mem_insert,Finset.mem_singleton] at he - rcases he with rfl | rfl | rfl - · simp only [edgeVertices,Finset.mem_insert,Finset.mem_singleton] at hv - rcases hv with rfl | rfl - · simp [edgeAnchor,edgeLocal] - · have hd := circle_distinct (sectorCircleEdge s) - have hr := radial_step s - cases hb : (sectorLetter s).2 - · simp only [hb,Bool.false_eq_true,↓reduceIte] at hr - simp only [sectorStart,hb,Bool.false_eq_true,↓reduceIte, - edgeAnchor,edgeLocal,faceLocal,Sum.inl_ne_inr, - Sum.inl.injEq,Ne.symm hd,hd] - rw [hr] - group - · simp only [hb,↓reduceIte] at hr - simp only [sectorStart,hb,↓reduceIte,edgeAnchor,edgeLocal,faceLocal, - Sum.inl_ne_inr,Sum.inl.injEq,Ne.symm hd] - exact hr - · simp only [edgeVertices,Finset.mem_insert,Finset.mem_singleton] at hv - rcases hv with rfl | rfl <;> simp [faceLocal,edgeLocal,edgeAnchor] - · simp only [edgeVertices,Finset.mem_insert,Finset.mem_singleton] at hv - rcases hv with rfl | rfl - · simp [faceLocal,edgeLocal,edgeAnchor,nextSector_first] - · simp [faceLocal,edgeLocal,edgeAnchor,nextSector_first,Ne.symm (sector_distinct s)] - -def cellRank : SeedCell → ℕ - | .inl _ => 0 - | .inr (.inl _) => 1 - | .inr (.inr _) => 2 - -theorem properFace_rank {a b : SeedCell} (h : properFace a b) : cellRank a < cellRank b := by - rcases a with a | (a | a) <;> rcases b with b | (b | b) <;> - simp only [properFace,cellRank] at * <;> omega - -theorem properFace_trans {a b c : SeedCell} (hab : properFace a b) (hbc : properFace b c) : - properFace a c := by - rcases a with a | (a | a) <;> rcases b with b | (b | b) <;> - rcases c with c | (c | c) <;> simp only [properFace] at * - exact Finset.mem_biUnion.mpr ⟨b,hbc,hab⟩ - -def upLabel : SeedCell → SeedCell → SeedSU2 - | .inl v, .inr (.inl e) => (edgeLocal e v)⁻¹ - | .inl v, .inr (.inr s) => (faceLocal s v)⁻¹ - | .inr (.inl e), .inr (.inr s) => (faceLocal s (edgeAnchor e))⁻¹ - | _, _ => 1 - -@[simp] theorem upLabel_diag (a : SeedCell) : upLabel a a = 1 := by - rcases a with a | (a | a) <;> rfl - -theorem upLabel_same_rank {a b : SeedCell} (hab : cellRank a = cellRank b) : - upLabel a b = 1 := by - rcases a with a | (a | a) <;> rcases b with b | (b | b) <;> - simp [upLabel,cellRank] at * - -theorem upLabel_trans {a b c : SeedCell} (hab : a = b ∨ properFace a b) - (hbc : b = c ∨ properFace b c) : upLabel a b * upLabel b c = upLabel a c := by - rcases hab with rfl | hab - · simp - rcases hbc with rfl | hbc - · simp - rcases a with a | (a | a) <;> rcases b with b | (b | b) <;> - rcases c with c | (c | c) <;> simp only [properFace] at hab hbc - simp only [upLabel,← mul_inv_rev] - exact congrArg Inv.inv (faceLocal_incidence c b hbc a hab).symm - -def Related (a b : SeedCell) : Prop := a = b ∨ seedGraph.Adj a b - -theorem related_symm {a b : SeedCell} : Related a b → Related b a := by - rintro (rfl | h) - · exact Or.inl rfl - · exact Or.inr h.symm - -theorem related_forward {a b : SeedCell} (h : Related a b) (hr : cellRank a ≤ cellRank b) : - a = b ∨ properFace a b := by - rcases h with h | h - · exact Or.inl h - rcases h with h | h - · exact Or.inr h - · have hd := properFace_rank h - omega - -def connection (a b : SeedCell) : SeedSU2 := - if cellRank a ≤ cellRank b then upLabel a b else (upLabel b a)⁻¹ - -@[simp] theorem connection_diag (a : SeedCell) : connection a a = 1 := by - simp [connection] - -theorem connection_reverse (a b : SeedCell) : connection b a = (connection a b)⁻¹ := by - by_cases hab : cellRank a ≤ cellRank b - · by_cases hba : cellRank b ≤ cellRank a - · have he := le_antisymm hab hba - simp [connection,hab,hba,upLabel_same_rank he,upLabel_same_rank he.symm] - · simp [connection,hab,hba] - · have hba : cellRank b ≤ cellRank a := (le_total _ _).resolve_left hab - simp [connection,hab,hba] - -theorem connection_flat_sorted {a b c : SeedCell} (hab : Related a b) (hbc : Related b c) - (hrab : cellRank a ≤ cellRank b) (hrbc : cellRank b ≤ cellRank c) : - connection a b * connection b c = connection a c := by - simp only [connection,hrab,hrbc,le_trans hrab hrbc,↓reduceIte] - exact upLabel_trans (related_forward hab hrab) (related_forward hbc hrbc) - -theorem connection_flat {a b c : SeedCell} (hab : Related a b) (hbc : Related b c) - (hac : Related a c) : connection a b * connection b c = connection a c := by - by_cases hrab : cellRank a ≤ cellRank b - · by_cases hrbc : cellRank b ≤ cellRank c - · exact connection_flat_sorted hab hbc hrab hrbc - · have hrcb := le_of_lt (lt_of_not_ge hrbc) - by_cases hrac : cellRank a ≤ cellRank c - · have H := connection_flat_sorted hac (related_symm hbc) hrac hrcb - rw [connection_reverse b c] at H - rw [← H] - group - · have hrca := le_of_lt (lt_of_not_ge hrac) - have H := connection_flat_sorted (related_symm hac) hab hrca hrab - rw [connection_reverse a c,connection_reverse b c] at H - calc - connection a b * connection b c = - connection a c * ((connection a c)⁻¹ * connection a b) * connection b c := by group - _ = connection a c * (connection b c)⁻¹ * connection b c := by rw [H] - _ = connection a c := by group - · have hrba := le_of_lt (lt_of_not_ge hrab) - by_cases hrac : cellRank a ≤ cellRank c - · have H := connection_flat_sorted (related_symm hab) hac hrba hrac - rw [connection_reverse a b] at H - rw [← H] - group - · have hrca := le_of_lt (lt_of_not_ge hrac) - by_cases hrbc : cellRank b ≤ cellRank c - · have H := connection_flat_sorted hbc (related_symm hac) hrbc hrca - rw [connection_reverse a c,connection_reverse a b] at H - calc - connection a b * connection b c = - connection a b * (connection b c * (connection a c)⁻¹) * connection a c := by group - _ = connection a b * (connection a b)⁻¹ * connection a c := by rw [H] - _ = connection a c := by group - · have hrcb := le_of_lt (lt_of_not_ge hrbc) - have H := connection_flat_sorted (related_symm hbc) (related_symm hab) hrcb hrba - rw [connection_reverse b c,connection_reverse a b,connection_reverse a c] at H - have H' := congrArg Inv.inv H - simpa only [mul_inv_rev,inv_inv] using H' - -def rankFin (a : SeedCell) : Fin 3 := ⟨cellRank a,by - rcases a with a | (a | a) <;> norm_num [cellRank]⟩ - -theorem adjacent_rank_ne {a b : SeedCell} (h : seedGraph.Adj a b) : rankFin a ≠ rankFin b := by - intro he - have he' := congrArg Fin.val he - change cellRank a = cellRank b at he' - rcases h with h | h <;> have hh := properFace_rank h <;> omega - -theorem clique_card_le_three (s : Finset SeedCell) (hs : (s : Set SeedCell).Pairwise seedGraph.Adj) : - s.card ≤ 3 := by - have hi : Set.InjOn rankFin (s : Set SeedCell) := by - intro a ha b hb he - by_contra hn - exact adjacent_rank_ne (hs ha hb hn) he - have hc := Finset.card_le_card (Finset.subset_univ (s.image rankFin)) - rwa [Finset.card_image_of_injOn hi,Finset.card_univ,Fintype.card_fin] at hc - -/-- The subdivided x-circle in the exact 103-cell order graph. -/ -def roseLoop : List SeedCell := - [.inl (.inl none), .inr (.inl (.inl (false,0))), - .inl (.inl (some (false,0))), .inr (.inl (.inl (false,1))), - .inl (.inl (some (false,1))), .inr (.inl (.inl (false,2))), .inl (.inl none)] - -theorem roseLoop_edges : roseLoop.IsChain seedGraph.Adj := by - simp [roseLoop,List.isChain_cons_cons,seedGraph,properFace,edgeVertices,circleStart,circleEnd] - -theorem roseLoop_holonomy : (List.zipWith connection roseLoop roseLoop.tail).prod = seedXUnit := by - simp [roseLoop,connection,cellRank,upLabel,edgeLocal,circleLabel,circleWord, - circleStart,seedLetterUnit] - -theorem roseLoop_nontrivial : (List.zipWith connection roseLoop roseLoop.tail).prod ≠ 1 := by - rw [roseLoop_holonomy] - intro h - have hh := congrArg (fun q : SeedSU2 => (q : ℍ).re) h - norm_num [seedXUnit,seedXQuaternion] at hh - -end SeedConnection - - - -end EilenbergGanea - -end - -end OAI +import OAI.Topology.EilenbergGanea.SeedHolonomy +import OAI.GroupTheory.RightAngledArtin.Basic + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +namespace EilenbergGanea +namespace SeedConnection + +def circleWord (e : CircleEdge) : FreeGroup Bool := if e.2 = 0 then FreeGroup.of e.1 else 1 + +def boundaryEdgeWord (s : Sector) : FreeGroup Bool := + if (sectorLetter s).2 then circleWord (sectorCircleEdge s) else + (circleWord (sectorCircleEdge s))⁻¹ + +def boundaryWords (r : Bool) : List (FreeGroup Bool) := + List.ofFn (fun i : Fin (boundaryLength r) => boundaryEdgeWord ⟨r,i⟩) + +theorem boundaryWords_prod : ∀ r, (boundaryWords r).prod = seedRelator r := by + decide + +theorem sector_end : ∀ s : Sector, sectorStart (nextSector s) = + if (sectorLetter s).2 then circleEnd (sectorCircleEdge s) + else circleStart (sectorCircleEdge s) := by decide + +theorem circle_distinct : ∀ e : CircleEdge, circleStart e ≠ circleEnd e := by decide + +theorem sector_distinct : ∀ s : Sector, sectorStart s ≠ sectorStart (nextSector s) := by decide + +def circleLabel (e : CircleEdge) : SeedSU2 := FreeGroup.lift seedLetterUnit (circleWord e) + +def radialLabel (s : Sector) : SeedSU2 := + FreeGroup.lift seedLetterUnit ((boundaryWords s.1).take s.2.val).prod + +@[simp] theorem boundaryWords_length (r : Bool) : (boundaryWords r).length = boundaryLength r := + List.length_ofFn + +@[simp] theorem boundaryWords_get (s : Sector) : + (boundaryWords s.1)[s.2.val]'(by simp) = boundaryEdgeWord s := by + simp [boundaryWords] + +theorem radial_step (s : Sector) : radialLabel (nextSector s) = radialLabel s * + (if (sectorLetter s).2 then circleLabel (sectorCircleEdge s) + else (circleLabel (sectorCircleEdge s))⁻¹) := by + have hs : s.2.val < (boundaryWords s.1).length := by simp + have he := congrArg (FreeGroup.lift seedLetterUnit) (congrArg List.prod + (List.take_succ_eq_append_getElem hs)) + rw [List.prod_append,List.prod_singleton,map_mul,boundaryWords_get] at he + have hf : FreeGroup.lift seedLetterUnit (boundaryEdgeWord s) = + if (sectorLetter s).2 then circleLabel (sectorCircleEdge s) + else (circleLabel (sectorCircleEdge s))⁻¹ := by + unfold boundaryEdgeWord circleLabel + split <;> simp + rw [hf] at he + change radialLabel (nextSector s) = + FreeGroup.lift seedLetterUnit ((boundaryWords s.1).take s.2.val).prod * _ + rw [← he] + unfold radialLabel nextSector + dsimp only + by_cases hn : s.2.val + 1 < boundaryLength s.1 + · rw [Nat.mod_eq_of_lt hn] + · have hn' : s.2.val + 1 = boundaryLength s.1 := by have hh := s.2.isLt; omega + rw [hn',Nat.mod_self,List.take_zero,List.prod_nil,map_one, + ← boundaryWords_length,List.take_length,boundaryWords_prod,seedRelator_unit] + +def edgeAnchor : SeedEdge → SeedVertex + | .inl e => .inl (circleStart e) + | .inr s => .inr s.1 + +def edgeLocal : SeedEdge → SeedVertex → SeedSU2 + | .inl e, v => if v = .inl (circleStart e) then 1 else circleLabel e + | .inr s, v => if v = .inr s.1 then 1 else radialLabel s + +def faceLocal (s : Sector) (v : SeedVertex) : SeedSU2 := + if v = .inr s.1 then 1 else + if v = .inl (sectorStart s) then radialLabel s else radialLabel (nextSector s) + +theorem edgeLocal_anchor (e : SeedEdge) : edgeLocal e (edgeAnchor e) = 1 := by + cases e <;> simp [edgeLocal,edgeAnchor] + +theorem nextSector_first (s : Sector) : (nextSector s).1 = s.1 := rfl + +theorem faceLocal_incidence (s : Sector) (e : SeedEdge) (he : e ∈ sectorEdges s) + (v : SeedVertex) (hv : v ∈ edgeVertices e) : + faceLocal s v = faceLocal s (edgeAnchor e) * edgeLocal e v := by + simp only [sectorEdges,Finset.mem_insert,Finset.mem_singleton] at he + rcases he with rfl | rfl | rfl + · simp only [edgeVertices,Finset.mem_insert,Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · simp [edgeAnchor,edgeLocal] + · have hd := circle_distinct (sectorCircleEdge s) + have hr := radial_step s + cases hb : (sectorLetter s).2 + · simp only [hb,Bool.false_eq_true,↓reduceIte] at hr + simp only [sectorStart,hb,Bool.false_eq_true,↓reduceIte, + edgeAnchor,edgeLocal,faceLocal,Sum.inl_ne_inr, + Sum.inl.injEq,Ne.symm hd,hd] + rw [hr] + group + · simp only [hb,↓reduceIte] at hr + simp only [sectorStart,hb,↓reduceIte,edgeAnchor,edgeLocal,faceLocal, + Sum.inl_ne_inr,Sum.inl.injEq,Ne.symm hd] + exact hr + · simp only [edgeVertices,Finset.mem_insert,Finset.mem_singleton] at hv + rcases hv with rfl | rfl <;> simp [faceLocal,edgeLocal,edgeAnchor] + · simp only [edgeVertices,Finset.mem_insert,Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · simp [faceLocal,edgeLocal,edgeAnchor,nextSector_first] + · simp [faceLocal,edgeLocal,edgeAnchor,nextSector_first,Ne.symm (sector_distinct s)] + +def cellRank : SeedCell → ℕ + | .inl _ => 0 + | .inr (.inl _) => 1 + | .inr (.inr _) => 2 + +theorem properFace_rank {a b : SeedCell} (h : properFace a b) : cellRank a < cellRank b := by + rcases a with a | (a | a) <;> rcases b with b | (b | b) <;> + simp only [properFace,cellRank] at * <;> omega + +theorem properFace_trans {a b c : SeedCell} (hab : properFace a b) (hbc : properFace b c) : + properFace a c := by + rcases a with a | (a | a) <;> rcases b with b | (b | b) <;> + rcases c with c | (c | c) <;> simp only [properFace] at * + exact Finset.mem_biUnion.mpr ⟨b,hbc,hab⟩ + +def upLabel : SeedCell → SeedCell → SeedSU2 + | .inl v, .inr (.inl e) => (edgeLocal e v)⁻¹ + | .inl v, .inr (.inr s) => (faceLocal s v)⁻¹ + | .inr (.inl e), .inr (.inr s) => (faceLocal s (edgeAnchor e))⁻¹ + | _, _ => 1 + +@[simp] theorem upLabel_diag (a : SeedCell) : upLabel a a = 1 := by + rcases a with a | (a | a) <;> rfl + +theorem upLabel_same_rank {a b : SeedCell} (hab : cellRank a = cellRank b) : + upLabel a b = 1 := by + rcases a with a | (a | a) <;> rcases b with b | (b | b) <;> + simp [upLabel,cellRank] at * + +theorem upLabel_trans {a b c : SeedCell} (hab : a = b ∨ properFace a b) + (hbc : b = c ∨ properFace b c) : upLabel a b * upLabel b c = upLabel a c := by + rcases hab with rfl | hab + · simp + rcases hbc with rfl | hbc + · simp + rcases a with a | (a | a) <;> rcases b with b | (b | b) <;> + rcases c with c | (c | c) <;> simp only [properFace] at hab hbc + simp only [upLabel,← mul_inv_rev] + exact congrArg Inv.inv (faceLocal_incidence c b hbc a hab).symm + +def Related (a b : SeedCell) : Prop := a = b ∨ seedGraph.Adj a b + +theorem related_symm {a b : SeedCell} : Related a b → Related b a := by + rintro (rfl | h) + · exact Or.inl rfl + · exact Or.inr h.symm + +theorem related_forward {a b : SeedCell} (h : Related a b) (hr : cellRank a ≤ cellRank b) : + a = b ∨ properFace a b := by + rcases h with h | h + · exact Or.inl h + rcases h with h | h + · exact Or.inr h + · have hd := properFace_rank h + omega + +def connection (a b : SeedCell) : SeedSU2 := + if cellRank a ≤ cellRank b then upLabel a b else (upLabel b a)⁻¹ + +@[simp] theorem connection_diag (a : SeedCell) : connection a a = 1 := by + simp [connection] + +theorem connection_reverse (a b : SeedCell) : connection b a = (connection a b)⁻¹ := by + by_cases hab : cellRank a ≤ cellRank b + · by_cases hba : cellRank b ≤ cellRank a + · have he := le_antisymm hab hba + simp [connection,hab,hba,upLabel_same_rank he,upLabel_same_rank he.symm] + · simp [connection,hab,hba] + · have hba : cellRank b ≤ cellRank a := (le_total _ _).resolve_left hab + simp [connection,hab,hba] + +theorem connection_flat_sorted {a b c : SeedCell} (hab : Related a b) (hbc : Related b c) + (hrab : cellRank a ≤ cellRank b) (hrbc : cellRank b ≤ cellRank c) : + connection a b * connection b c = connection a c := by + simp only [connection,hrab,hrbc,le_trans hrab hrbc,↓reduceIte] + exact upLabel_trans (related_forward hab hrab) (related_forward hbc hrbc) + +theorem connection_flat {a b c : SeedCell} (hab : Related a b) (hbc : Related b c) + (hac : Related a c) : connection a b * connection b c = connection a c := by + by_cases hrab : cellRank a ≤ cellRank b + · by_cases hrbc : cellRank b ≤ cellRank c + · exact connection_flat_sorted hab hbc hrab hrbc + · have hrcb := le_of_lt (lt_of_not_ge hrbc) + by_cases hrac : cellRank a ≤ cellRank c + · have H := connection_flat_sorted hac (related_symm hbc) hrac hrcb + rw [connection_reverse b c] at H + rw [← H] + group + · have hrca := le_of_lt (lt_of_not_ge hrac) + have H := connection_flat_sorted (related_symm hac) hab hrca hrab + rw [connection_reverse a c,connection_reverse b c] at H + calc + connection a b * connection b c = + connection a c * ((connection a c)⁻¹ * connection a b) * connection b c := by group + _ = connection a c * (connection b c)⁻¹ * connection b c := by rw [H] + _ = connection a c := by group + · have hrba := le_of_lt (lt_of_not_ge hrab) + by_cases hrac : cellRank a ≤ cellRank c + · have H := connection_flat_sorted (related_symm hab) hac hrba hrac + rw [connection_reverse a b] at H + rw [← H] + group + · have hrca := le_of_lt (lt_of_not_ge hrac) + by_cases hrbc : cellRank b ≤ cellRank c + · have H := connection_flat_sorted hbc (related_symm hac) hrbc hrca + rw [connection_reverse a c,connection_reverse a b] at H + calc + connection a b * connection b c = + connection a b * (connection b c * (connection a c)⁻¹) * connection a c := by group + _ = connection a b * (connection a b)⁻¹ * connection a c := by rw [H] + _ = connection a c := by group + · have hrcb := le_of_lt (lt_of_not_ge hrbc) + have H := connection_flat_sorted (related_symm hbc) (related_symm hab) hrcb hrba + rw [connection_reverse b c,connection_reverse a b,connection_reverse a c] at H + have H' := congrArg Inv.inv H + simpa only [mul_inv_rev,inv_inv] using H' + +def rankFin (a : SeedCell) : Fin 3 := ⟨cellRank a,by + rcases a with a | (a | a) <;> norm_num [cellRank]⟩ + +theorem adjacent_rank_ne {a b : SeedCell} (h : seedGraph.Adj a b) : rankFin a ≠ rankFin b := by + intro he + have he' := congrArg Fin.val he + change cellRank a = cellRank b at he' + rcases h with h | h <;> have hh := properFace_rank h <;> omega + +theorem clique_card_le_three (s : Finset SeedCell) (hs : (s : Set SeedCell).Pairwise seedGraph.Adj) : + s.card ≤ 3 := by + have hi : Set.InjOn rankFin (s : Set SeedCell) := by + intro a ha b hb he + by_contra hn + exact adjacent_rank_ne (hs ha hb hn) he + have hc := Finset.card_le_card (Finset.subset_univ (s.image rankFin)) + rwa [Finset.card_image_of_injOn hi,Finset.card_univ,Fintype.card_fin] at hc + +/-- The subdivided x-circle in the exact 103-cell order graph. -/ +def roseLoop : List SeedCell := + [.inl (.inl none), .inr (.inl (.inl (false,0))), + .inl (.inl (some (false,0))), .inr (.inl (.inl (false,1))), + .inl (.inl (some (false,1))), .inr (.inl (.inl (false,2))), .inl (.inl none)] + +theorem roseLoop_edges : roseLoop.IsChain seedGraph.Adj := by + simp [roseLoop,List.isChain_cons_cons,seedGraph,properFace,edgeVertices,circleStart,circleEnd] + +theorem roseLoop_holonomy : (List.zipWith connection roseLoop roseLoop.tail).prod = seedXUnit := by + simp [roseLoop,connection,cellRank,upLabel,edgeLocal,circleLabel,circleWord, + circleStart,seedLetterUnit] + +theorem roseLoop_nontrivial : (List.zipWith connection roseLoop roseLoop.tail).prod ≠ 1 := by + rw [roseLoop_holonomy] + intro h + have hh := congrArg (fun q : SeedSU2 => (q : ℍ).re) h + norm_num [seedXUnit,seedXQuaternion] at hh + +end SeedConnection + + + +end EilenbergGanea + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/SeedContraction.lean b/lean/OAI/Topology/EilenbergGanea/SeedContraction.lean index 244ebf22008a51dfdc2f0e81fdc5c0e3b3949fec..03a658db9139c525afd696295c11534852c6d541 100644 --- a/lean/OAI/Topology/EilenbergGanea/SeedContraction.lean +++ b/lean/OAI/Topology/EilenbergGanea/SeedContraction.lean @@ -1,6288 +1,6288 @@ -import OAI.Topology.EilenbergGanea.SeedChains -import OAI.AlgebraicTopology.Integral.Contraction - -namespace OAI - -noncomputable section - -open Classical Set - -namespace EilenbergGanea.SeedChainCertificate -def d1Data_0 : List (List (Fin 372 × ℤ)) := [ - [(0,-1),(1,-1),(2,-1),(3,-1),(4,-1),(5,-1),(6,-1),(7,-1),(8,-1),(9,-1),(10,-1),(11,-1),(12,-1),(13,-1),(14,-1),(15,-1),(16,-1),(17,-1),(18,-1),(19,-1),(20,-1),(21,-1),(22,-1),(23,-1),(24,-1),(25,-1),(26,-1),(27,-1),(28,-1),(29,-1),(30,-1),(31,-1),(32,-1),(33,-1),(34,-1),(35,-1),(36,-1),(37,-1),(38,-1),(39,-1),(40,-1),(41,-1),(42,-1),(43,-1),(44,-1),(45,-1),(46,-1),(47,-1),(48,-1)], - [(49,-1),(50,-1),(51,-1),(52,-1),(53,-1),(54,-1),(55,-1),(56,-1),(57,-1),(58,-1),(59,-1),(60,-1),(61,-1),(62,-1),(63,-1),(64,-1),(65,-1),(66,-1),(67,-1),(68,-1),(69,-1),(70,-1),(71,-1)], - [(72,-1),(73,-1),(74,-1),(75,-1),(76,-1),(77,-1),(78,-1),(79,-1),(80,-1),(81,-1),(82,-1),(83,-1),(84,-1),(85,-1),(86,-1),(87,-1),(88,-1),(89,-1),(90,-1),(91,-1),(92,-1),(93,-1),(94,-1)], - [(95,-1),(96,-1),(97,-1),(98,-1),(99,-1),(100,-1),(101,-1),(102,-1),(103,-1),(104,-1),(105,-1),(106,-1),(107,-1),(108,-1),(109,-1),(110,-1),(111,-1),(112,-1),(113,-1),(114,-1),(115,-1),(116,-1),(117,-1),(118,-1),(119,-1),(120,-1)], - [(121,-1),(122,-1),(123,-1),(124,-1),(125,-1),(126,-1),(127,-1),(128,-1),(129,-1),(130,-1),(131,-1),(132,-1),(133,-1),(134,-1),(135,-1),(136,-1),(137,-1),(138,-1),(139,-1),(140,-1),(141,-1),(142,-1),(143,-1),(144,-1),(145,-1),(146,-1)], - [(147,-1),(148,-1),(149,-1),(150,-1),(151,-1),(152,-1),(153,-1),(154,-1),(155,-1),(156,-1),(157,-1),(158,-1),(159,-1),(160,-1),(161,-1),(162,-1),(163,-1),(164,-1),(165,-1),(166,-1),(167,-1),(168,-1),(169,-1),(170,-1),(171,-1),(172,-1),(173,-1),(174,-1),(175,-1),(176,-1),(177,-1),(178,-1),(179,-1),(180,-1),(181,-1),(182,-1),(183,-1),(184,-1),(185,-1),(186,-1),(187,-1),(188,-1)], - [(189,-1),(190,-1),(191,-1),(192,-1),(193,-1),(194,-1),(195,-1),(196,-1),(197,-1),(198,-1),(199,-1),(200,-1),(201,-1),(202,-1),(203,-1),(204,-1),(205,-1),(206,-1),(207,-1),(208,-1),(209,-1),(210,-1),(211,-1),(212,-1),(213,-1),(214,-1),(215,-1),(216,-1),(217,-1),(218,-1),(219,-1),(220,-1),(221,-1),(222,-1),(223,-1),(224,-1),(225,-1),(226,-1),(227,-1),(228,-1),(229,-1),(230,-1),(231,-1),(232,-1),(233,-1),(234,-1),(235,-1),(236,-1)], - [(0,1),(49,1),(237,-1),(238,-1),(239,-1),(240,-1),(241,-1),(242,-1),(243,-1)], - [(50,1),(72,1),(244,-1),(245,-1),(246,-1),(247,-1),(248,-1),(249,-1),(250,-1)], - [(1,1),(73,1),(251,-1),(252,-1),(253,-1),(254,-1),(255,-1),(256,-1),(257,-1)], - [(2,1),(95,1),(258,-1),(259,-1),(260,-1),(261,-1),(262,-1),(263,-1),(264,-1),(265,-1)], - [(96,1),(121,1),(266,-1),(267,-1),(268,-1),(269,-1),(270,-1),(271,-1),(272,-1),(273,-1)], - [(3,1),(122,1),(274,-1),(275,-1),(276,-1),(277,-1),(278,-1),(279,-1),(280,-1),(281,-1)], - [(4,1),(147,1),(282,-1),(283,-1)], - [(51,1),(148,1),(284,-1),(285,-1)], - [(74,1),(149,1),(286,-1),(287,-1)]] - -def d1Data_1 : List (List (Fin 372 × ℤ)) := [ - [(5,1),(150,1),(288,-1),(289,-1)], - [(52,1),(151,1),(290,-1),(291,-1)], - [(75,1),(152,1),(292,-1),(293,-1)], - [(6,1),(153,1),(294,-1),(295,-1)], - [(123,1),(154,1),(296,-1),(297,-1)], - [(97,1),(155,1),(298,-1),(299,-1)], - [(7,1),(156,1),(300,-1),(301,-1)], - [(124,1),(157,1),(302,-1),(303,-1)], - [(98,1),(158,1),(304,-1),(305,-1)], - [(8,1),(159,1),(306,-1),(307,-1)], - [(125,1),(160,1),(308,-1),(309,-1)], - [(99,1),(161,1),(310,-1),(311,-1)], - [(9,1),(162,1),(312,-1),(313,-1)], - [(126,1),(163,1),(314,-1),(315,-1)], - [(100,1),(164,1),(316,-1),(317,-1)], - [(10,1),(165,1),(318,-1),(319,-1)]] - -def d1Data_2 : List (List (Fin 372 × ℤ)) := [ - [(127,1),(166,1),(320,-1),(321,-1)], - [(101,1),(167,1),(322,-1),(323,-1)], - [(11,1),(189,1),(324,-1),(325,-1)], - [(53,1),(190,1),(326,-1),(327,-1)], - [(76,1),(191,1),(328,-1),(329,-1)], - [(12,1),(192,1),(330,-1),(331,-1)], - [(54,1),(193,1),(332,-1),(333,-1)], - [(77,1),(194,1),(334,-1),(335,-1)], - [(13,1),(195,1),(336,-1),(337,-1)], - [(102,1),(196,1),(338,-1),(339,-1)], - [(128,1),(197,1),(340,-1),(341,-1)], - [(14,1),(198,1),(342,-1),(343,-1)], - [(78,1),(199,1),(344,-1),(345,-1)], - [(55,1),(200,1),(346,-1),(347,-1)], - [(15,1),(201,1),(348,-1),(349,-1)], - [(103,1),(202,1),(350,-1),(351,-1)]] - -def d1Data_3 : List (List (Fin 372 × ℤ)) := [ - [(129,1),(203,1),(352,-1),(353,-1)], - [(16,1),(204,1),(354,-1),(355,-1)], - [(79,1),(205,1),(356,-1),(357,-1)], - [(56,1),(206,1),(358,-1),(359,-1)], - [(17,1),(207,1),(360,-1),(361,-1)], - [(104,1),(208,1),(362,-1),(363,-1)], - [(130,1),(209,1),(364,-1),(365,-1)], - [(18,1),(210,1),(366,-1),(367,-1)], - [(80,1),(211,1),(368,-1),(369,-1)], - [(57,1),(212,1),(370,-1),(371,-1)], - [(19,1),(58,1),(168,1),(237,1),(282,1),(284,1)], - [(59,1),(81,1),(169,1),(244,1),(285,1),(286,1)], - [(20,1),(82,1),(170,1),(251,1),(287,1),(288,1)], - [(21,1),(60,1),(171,1),(238,1),(289,1),(290,1)], - [(61,1),(83,1),(172,1),(245,1),(291,1),(292,1)], - [(22,1),(84,1),(173,1),(252,1),(293,1),(294,1)]] - -def d1Data_4 : List (List (Fin 372 × ℤ)) := [ - [(23,1),(131,1),(174,1),(274,1),(295,1),(296,1)], - [(105,1),(132,1),(175,1),(266,1),(297,1),(298,1)], - [(24,1),(106,1),(176,1),(258,1),(299,1),(300,1)], - [(25,1),(133,1),(177,1),(275,1),(301,1),(302,1)], - [(107,1),(134,1),(178,1),(267,1),(303,1),(304,1)], - [(26,1),(108,1),(179,1),(259,1),(305,1),(306,1)], - [(27,1),(135,1),(180,1),(276,1),(307,1),(308,1)], - [(109,1),(136,1),(181,1),(268,1),(309,1),(310,1)], - [(28,1),(110,1),(182,1),(260,1),(311,1),(312,1)], - [(29,1),(137,1),(183,1),(277,1),(313,1),(314,1)], - [(111,1),(138,1),(184,1),(269,1),(315,1),(316,1)], - [(30,1),(112,1),(185,1),(261,1),(317,1),(318,1)], - [(31,1),(139,1),(186,1),(278,1),(319,1),(320,1)], - [(113,1),(140,1),(187,1),(270,1),(321,1),(322,1)], - [(32,1),(114,1),(188,1),(262,1),(283,1),(323,1)], - [(33,1),(62,1),(213,1),(239,1),(324,1),(326,1)]] - -def d1Data_5 : List (List (Fin 372 × ℤ)) := [ - [(63,1),(85,1),(214,1),(246,1),(327,1),(328,1)], - [(34,1),(86,1),(215,1),(253,1),(329,1),(330,1)], - [(35,1),(64,1),(216,1),(240,1),(331,1),(332,1)], - [(65,1),(87,1),(217,1),(247,1),(333,1),(334,1)], - [(36,1),(88,1),(218,1),(254,1),(335,1),(336,1)], - [(37,1),(115,1),(219,1),(263,1),(337,1),(338,1)], - [(116,1),(141,1),(220,1),(271,1),(339,1),(340,1)], - [(38,1),(142,1),(221,1),(279,1),(341,1),(342,1)], - [(39,1),(89,1),(222,1),(255,1),(343,1),(344,1)], - [(66,1),(90,1),(223,1),(248,1),(345,1),(346,1)], - [(40,1),(67,1),(224,1),(241,1),(347,1),(348,1)], - [(41,1),(117,1),(225,1),(264,1),(349,1),(350,1)], - [(118,1),(143,1),(226,1),(272,1),(351,1),(352,1)], - [(42,1),(144,1),(227,1),(280,1),(353,1),(354,1)], - [(43,1),(91,1),(228,1),(256,1),(355,1),(356,1)], - [(68,1),(92,1),(229,1),(249,1),(357,1),(358,1)]] - -def d1Data_6 : List (List (Fin 372 × ℤ)) := [ - [(44,1),(69,1),(230,1),(242,1),(359,1),(360,1)], - [(45,1),(119,1),(231,1),(265,1),(361,1),(362,1)], - [(120,1),(145,1),(232,1),(273,1),(363,1),(364,1)], - [(46,1),(146,1),(233,1),(281,1),(365,1),(366,1)], - [(47,1),(93,1),(234,1),(257,1),(367,1),(368,1)], - [(70,1),(94,1),(235,1),(250,1),(369,1),(370,1)], - [(48,1),(71,1),(236,1),(243,1),(325,1),(371,1)]] - -def d1Data : List (List (Fin 372 × ℤ)) := [d1Data_0,d1Data_1,d1Data_2,d1Data_3,d1Data_4,d1Data_5,d1Data_6].flatten - -def d2Data_0 : List (List (Fin 270 × ℤ)) := [ - [(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1)], - [(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1)], - [(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1)], - [(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1)], - [(30,1),(31,1)], - [(32,1),(33,1)], - [(34,1),(35,1)], - [(36,1),(37,1)], - [(38,1),(39,1)], - [(40,1),(41,1)], - [(42,1),(43,1)], - [(44,1),(45,1)], - [(46,1),(47,1)], - [(48,1),(49,1)], - [(50,1),(51,1)], - [(52,1),(53,1)]] - -def d2Data_1 : List (List (Fin 270 × ℤ)) := [ - [(54,1),(55,1)], - [(56,1),(57,1)], - [(58,1),(59,1)], - [(0,-1),(30,-1)], - [(7,-1),(32,-1)], - [(1,-1),(33,-1)], - [(8,-1),(34,-1)], - [(22,-1),(35,-1)], - [(14,-1),(36,-1)], - [(23,-1),(37,-1)], - [(15,-1),(38,-1)], - [(24,-1),(39,-1)], - [(16,-1),(40,-1)], - [(25,-1),(41,-1)], - [(17,-1),(42,-1)], - [(26,-1),(43,-1)]] - -def d2Data_2 : List (List (Fin 270 × ℤ)) := [ - [(18,-1),(31,-1)], - [(2,-1),(44,-1)], - [(9,-1),(46,-1)], - [(3,-1),(47,-1)], - [(10,-1),(48,-1)], - [(19,-1),(49,-1)], - [(27,-1),(50,-1)], - [(11,-1),(51,-1)], - [(4,-1),(52,-1)], - [(20,-1),(53,-1)], - [(28,-1),(54,-1)], - [(12,-1),(55,-1)], - [(5,-1),(56,-1)], - [(21,-1),(57,-1)], - [(29,-1),(58,-1)], - [(13,-1),(59,-1)]] - -def d2Data_3 : List (List (Fin 270 × ℤ)) := [ - [(6,-1),(45,-1)], - [(60,1),(61,1),(62,1),(63,1),(64,1),(65,1),(66,1)], - [(67,1),(68,1),(69,1),(70,1),(71,1),(72,1),(73,1)], - [(74,1),(75,1)], - [(76,1),(77,1)], - [(78,1),(79,1)], - [(80,1),(81,1)], - [(82,1),(83,1)], - [(84,1),(85,1)], - [(86,1),(87,1)], - [(60,-1),(74,-1)], - [(67,-1),(75,-1)], - [(61,-1),(76,-1)], - [(68,-1),(77,-1)], - [(62,-1),(78,-1)], - [(69,-1),(79,-1)]] - -def d2Data_4 : List (List (Fin 270 × ℤ)) := [ - [(63,-1),(80,-1)], - [(70,-1),(81,-1)], - [(71,-1),(82,-1)], - [(64,-1),(83,-1)], - [(72,-1),(84,-1)], - [(65,-1),(85,-1)], - [(73,-1),(86,-1)], - [(66,-1),(87,-1)], - [(88,1),(89,1),(90,1),(91,1),(92,1),(93,1),(94,1)], - [(95,1),(96,1),(97,1),(98,1),(99,1),(100,1),(101,1)], - [(102,1),(103,1)], - [(104,1),(105,1)], - [(106,1),(107,1)], - [(108,1),(109,1)], - [(110,1),(111,1)], - [(112,1),(113,1)]] - -def d2Data_5 : List (List (Fin 270 × ℤ)) := [ - [(114,1),(115,1)], - [(88,-1),(102,-1)], - [(95,-1),(103,-1)], - [(89,-1),(104,-1)], - [(96,-1),(105,-1)], - [(90,-1),(106,-1)], - [(97,-1),(107,-1)], - [(91,-1),(108,-1)], - [(98,-1),(109,-1)], - [(99,-1),(110,-1)], - [(92,-1),(111,-1)], - [(100,-1),(112,-1)], - [(93,-1),(113,-1)], - [(101,-1),(114,-1)], - [(94,-1),(115,-1)], - [(116,1),(117,1),(118,1),(119,1),(120,1),(121,1),(122,1),(123,1)]] - -def d2Data_6 : List (List (Fin 270 × ℤ)) := [ - [(124,1),(125,1),(126,1),(127,1),(128,1),(129,1),(130,1),(131,1)], - [(132,1),(133,1)], - [(134,1),(135,1)], - [(136,1),(137,1)], - [(138,1),(139,1)], - [(140,1),(141,1)], - [(142,1),(143,1)], - [(144,1),(145,1)], - [(146,1),(147,1)], - [(124,-1),(132,-1)], - [(116,-1),(133,-1)], - [(125,-1),(134,-1)], - [(117,-1),(135,-1)], - [(126,-1),(136,-1)], - [(118,-1),(137,-1)], - [(127,-1),(138,-1)]] - -def d2Data_7 : List (List (Fin 270 × ℤ)) := [ - [(119,-1),(139,-1)], - [(128,-1),(140,-1)], - [(120,-1),(141,-1)], - [(121,-1),(142,-1)], - [(129,-1),(143,-1)], - [(122,-1),(144,-1)], - [(130,-1),(145,-1)], - [(123,-1),(146,-1)], - [(131,-1),(147,-1)], - [(148,1),(149,1),(150,1),(151,1),(152,1),(153,1),(154,1),(155,1)], - [(156,1),(157,1),(158,1),(159,1),(160,1),(161,1),(162,1),(163,1)], - [(164,1),(165,1)], - [(166,1),(167,1)], - [(168,1),(169,1)], - [(170,1),(171,1)], - [(172,1),(173,1)]] - -def d2Data_8 : List (List (Fin 270 × ℤ)) := [ - [(174,1),(175,1)], - [(176,1),(177,1)], - [(178,1),(179,1)], - [(156,-1),(164,-1)], - [(148,-1),(165,-1)], - [(157,-1),(166,-1)], - [(149,-1),(167,-1)], - [(158,-1),(168,-1)], - [(150,-1),(169,-1)], - [(159,-1),(170,-1)], - [(151,-1),(171,-1)], - [(160,-1),(172,-1)], - [(152,-1),(173,-1)], - [(153,-1),(174,-1)], - [(161,-1),(175,-1)], - [(154,-1),(176,-1)]] - -def d2Data_9 : List (List (Fin 270 × ℤ)) := [ - [(162,-1),(177,-1)], - [(155,-1),(178,-1)], - [(163,-1),(179,-1)], - [(180,1),(181,1)], - [(182,1),(183,1)], - [(184,1),(185,1)], - [(186,1),(187,1)], - [(188,1),(189,1)], - [(190,1),(191,1)], - [(192,1),(193,1)], - [(194,1),(195,1)], - [(196,1),(197,1)], - [(198,1),(199,1)], - [(200,1),(201,1)], - [(202,1),(203,1)], - [(204,1),(205,1)]] - -def d2Data_10 : List (List (Fin 270 × ℤ)) := [ - [(206,1),(207,1)], - [(208,1),(209,1)], - [(210,1),(211,1)], - [(212,1),(213,1)], - [(214,1),(215,1)], - [(216,1),(217,1)], - [(218,1),(219,1)], - [(220,1),(221,1)], - [(180,-1),(182,-1)], - [(183,-1),(184,-1)], - [(185,-1),(186,-1)], - [(187,-1),(188,-1)], - [(189,-1),(190,-1)], - [(191,-1),(192,-1)], - [(193,-1),(194,-1)], - [(195,-1),(196,-1)]] - -def d2Data_11 : List (List (Fin 270 × ℤ)) := [ - [(197,-1),(198,-1)], - [(199,-1),(200,-1)], - [(201,-1),(202,-1)], - [(203,-1),(204,-1)], - [(205,-1),(206,-1)], - [(207,-1),(208,-1)], - [(209,-1),(210,-1)], - [(211,-1),(212,-1)], - [(213,-1),(214,-1)], - [(215,-1),(216,-1)], - [(217,-1),(218,-1)], - [(219,-1),(220,-1)], - [(181,-1),(221,-1)], - [(222,1),(223,1)], - [(224,1),(225,1)], - [(226,1),(227,1)]] - -def d2Data_12 : List (List (Fin 270 × ℤ)) := [ - [(228,1),(229,1)], - [(230,1),(231,1)], - [(232,1),(233,1)], - [(234,1),(235,1)], - [(236,1),(237,1)], - [(238,1),(239,1)], - [(240,1),(241,1)], - [(242,1),(243,1)], - [(244,1),(245,1)], - [(246,1),(247,1)], - [(248,1),(249,1)], - [(250,1),(251,1)], - [(252,1),(253,1)], - [(254,1),(255,1)], - [(256,1),(257,1)], - [(258,1),(259,1)]] - -def d2Data_13 : List (List (Fin 270 × ℤ)) := [ - [(260,1),(261,1)], - [(262,1),(263,1)], - [(264,1),(265,1)], - [(266,1),(267,1)], - [(268,1),(269,1)], - [(222,-1),(224,-1)], - [(225,-1),(226,-1)], - [(227,-1),(228,-1)], - [(229,-1),(230,-1)], - [(231,-1),(232,-1)], - [(233,-1),(234,-1)], - [(235,-1),(236,-1)], - [(237,-1),(238,-1)], - [(239,-1),(240,-1)], - [(241,-1),(242,-1)], - [(243,-1),(244,-1)]] - -def d2Data_14 : List (List (Fin 270 × ℤ)) := [ - [(245,-1),(246,-1)], - [(247,-1),(248,-1)], - [(249,-1),(250,-1)], - [(251,-1),(252,-1)], - [(253,-1),(254,-1)], - [(255,-1),(256,-1)], - [(257,-1),(258,-1)], - [(259,-1),(260,-1)], - [(261,-1),(262,-1)], - [(263,-1),(264,-1)], - [(265,-1),(266,-1)], - [(267,-1),(268,-1)], - [(223,-1),(269,-1)], - [(0,1),(60,1)], - [(1,1),(61,1)], - [(2,1),(62,1)]] - -def d2Data_15 : List (List (Fin 270 × ℤ)) := [ - [(3,1),(63,1)], - [(4,1),(64,1)], - [(5,1),(65,1)], - [(6,1),(66,1)], - [(67,1),(88,1)], - [(68,1),(89,1)], - [(69,1),(90,1)], - [(70,1),(91,1)], - [(71,1),(92,1)], - [(72,1),(93,1)], - [(73,1),(94,1)], - [(7,1),(95,1)], - [(8,1),(96,1)], - [(9,1),(97,1)], - [(10,1),(98,1)], - [(11,1),(99,1)]] - -def d2Data_16 : List (List (Fin 270 × ℤ)) := [ - [(12,1),(100,1)], - [(13,1),(101,1)], - [(14,1),(116,1)], - [(15,1),(117,1)], - [(16,1),(118,1)], - [(17,1),(119,1)], - [(18,1),(120,1)], - [(19,1),(121,1)], - [(20,1),(122,1)], - [(21,1),(123,1)], - [(124,1),(148,1)], - [(125,1),(149,1)], - [(126,1),(150,1)], - [(127,1),(151,1)], - [(128,1),(152,1)], - [(129,1),(153,1)]] - -def d2Data_17 : List (List (Fin 270 × ℤ)) := [ - [(130,1),(154,1)], - [(131,1),(155,1)], - [(22,1),(156,1)], - [(23,1),(157,1)], - [(24,1),(158,1)], - [(25,1),(159,1)], - [(26,1),(160,1)], - [(27,1),(161,1)], - [(28,1),(162,1)], - [(29,1),(163,1)], - [(30,1),(180,1)], - [(31,1),(181,1)], - [(74,1),(182,1)], - [(75,1),(183,1)], - [(102,1),(184,1)], - [(103,1),(185,1)]] - -def d2Data_18 : List (List (Fin 270 × ℤ)) := [ - [(32,1),(186,1)], - [(33,1),(187,1)], - [(76,1),(188,1)], - [(77,1),(189,1)], - [(104,1),(190,1)], - [(105,1),(191,1)], - [(34,1),(192,1)], - [(35,1),(193,1)], - [(164,1),(194,1)], - [(165,1),(195,1)], - [(132,1),(196,1)], - [(133,1),(197,1)], - [(36,1),(198,1)], - [(37,1),(199,1)], - [(166,1),(200,1)], - [(167,1),(201,1)]] - -def d2Data_19 : List (List (Fin 270 × ℤ)) := [ - [(134,1),(202,1)], - [(135,1),(203,1)], - [(38,1),(204,1)], - [(39,1),(205,1)], - [(168,1),(206,1)], - [(169,1),(207,1)], - [(136,1),(208,1)], - [(137,1),(209,1)], - [(40,1),(210,1)], - [(41,1),(211,1)], - [(170,1),(212,1)], - [(171,1),(213,1)], - [(138,1),(214,1)], - [(139,1),(215,1)], - [(42,1),(216,1)], - [(43,1),(217,1)]] - -def d2Data_20 : List (List (Fin 270 × ℤ)) := [ - [(172,1),(218,1)], - [(173,1),(219,1)], - [(140,1),(220,1)], - [(141,1),(221,1)], - [(44,1),(222,1)], - [(45,1),(223,1)], - [(78,1),(224,1)], - [(79,1),(225,1)], - [(106,1),(226,1)], - [(107,1),(227,1)], - [(46,1),(228,1)], - [(47,1),(229,1)], - [(80,1),(230,1)], - [(81,1),(231,1)], - [(108,1),(232,1)], - [(109,1),(233,1)]] - -def d2Data_21 : List (List (Fin 270 × ℤ)) := [ - [(48,1),(234,1)], - [(49,1),(235,1)], - [(142,1),(236,1)], - [(143,1),(237,1)], - [(174,1),(238,1)], - [(175,1),(239,1)], - [(50,1),(240,1)], - [(51,1),(241,1)], - [(110,1),(242,1)], - [(111,1),(243,1)], - [(82,1),(244,1)], - [(83,1),(245,1)], - [(52,1),(246,1)], - [(53,1),(247,1)], - [(144,1),(248,1)], - [(145,1),(249,1)]] - -def d2Data_22 : List (List (Fin 270 × ℤ)) := [ - [(176,1),(250,1)], - [(177,1),(251,1)], - [(54,1),(252,1)], - [(55,1),(253,1)], - [(112,1),(254,1)], - [(113,1),(255,1)], - [(84,1),(256,1)], - [(85,1),(257,1)], - [(56,1),(258,1)], - [(57,1),(259,1)], - [(146,1),(260,1)], - [(147,1),(261,1)], - [(178,1),(262,1)], - [(179,1),(263,1)], - [(58,1),(264,1)], - [(59,1),(265,1)]] - -def d2Data_23 : List (List (Fin 270 × ℤ)) := [ - [(114,1),(266,1)], - [(115,1),(267,1)], - [(86,1),(268,1)], - [(87,1),(269,1)]] - -def d2Data : List (List (Fin 270 × ℤ)) := [d2Data_0,d2Data_1,d2Data_2,d2Data_3,d2Data_4,d2Data_5,d2Data_6,d2Data_7,d2Data_8,d2Data_9,d2Data_10,d2Data_11,d2Data_12,d2Data_13,d2Data_14,d2Data_15,d2Data_16,d2Data_17,d2Data_18,d2Data_19,d2Data_20,d2Data_21,d2Data_22,d2Data_23].flatten - -def h0CodeData_0 : List (ℕ) := [ - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198805, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065167114401743759279967291397462, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974580047499508942991460908927726036895443277145, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775440332605179127999059521355709682110447775227769225458570597, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867818480452138321292628547852962782554227063323134017148470870931120785282453, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701006361921833641501652060710894045368114183781018220226386875789505889593007828205433083477, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127084933600319805317659541841036625864998163475823904152171255209796171635266570836387262136116819224009742737909044565, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198806, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303066434765001971988681463994602838, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198809, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198821, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775446609706914514679823357145132889776863877583213689493083493, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198869, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467199061, - 30845763132983623646676132847120415275432388327850829810140857402521664303920611415308389472992066420305377421240443803744195824843594904142167318387202259389270767566357586271705003989733389129756858685030629456371141399893, - 30845763132983623646676132847120415275432388327850768943674869880702735352128329236507716764886623543954148569785233442317704764266908459090343653106599350587318271407067042771716092562677811178945251578508837479747941651797] - -def h0CodeData_1 : List (ℕ) := [ - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467199829, - 30845763132983623646676132847120415275432388327846873489851668484291282437422269793264663446138279457475502076651770311022276887358975975773629075148013187262358517212472258772425761231120822327002396761114150926385134523733, - 30845763132983623646676132847120415275432388327597564445166779113958295896234465425709251046244257922842126516110129908114892765251297043503896085798498734464934248758406082817844556011473535802659688447854211313253385327957, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467202901, - 30845763132983623646676132847120415275432388311641785585333859412647157260214985902162857453026879706306090641445144122042308950359845378240984767429573755429781067698170821724647421954047198244726356399218075281173064799573, - 30845763132983623646676132847120415275432387290471938556026998528734284554968296395193667487114673847999794662886053813396944797306938801414660391818375097179977479843114111760030842278761594536993105286505366061439062988117, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467215189, - 30845763132983623646676132847120415275432321935601728680387901958310431419180167949165509668733498916396852035104274060093639001920917884529900352701660969192547857119484674024569743060482957242065034072891963332088995075413, - 30845763132983623646676132847120415275428139223908296639485721451183830728739947403363409292338303293808523857070369848682068097215579203905257849231956777997052002807200658955059393090650170366668476401634137988188840744277, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467264341, - 30845763132983623646676132847120415275160445675528646021746168995081386540565832472028985203045783448155520462900500318341530196073903643928137627170888541485317326821023694506396995021351810341288785441133113316595731879253, - 30845763132983623646676132847120415258028058579231006486414811804524958497422476866625843488324513326363303236028850376547104523006667805392443415262521404734298063705697969792003518586256768716988563969066723686703837828437, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467460949, - 30845763132983623646676132847120414161555284416182076225207951608913563736247718120824773746163225531661400716243254101703861446703574139108013853127024652669065224324851588070821026740174104761774389756814544781890911819093, - 30845763132983623646676132847120343987297737981050539507968899089784299021063158389556310247840806670739639449965092511736304563305579496904521876455232520494163503950683157915141548590883611628067240172662124506936820192597, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341468247381] - -def h0CodeData_2 : List (ℕ) := [ - 30845763132983623646676132847115852834814766132632189604669537865511357249251335588374646355205999571746918408162750753812664025833922395881035369460536061300453400003903627951654947036292051070809666786855345442167647982933, - 30845763132983623646676132846828419075904567833857795793510419512043083853294676312748157226578345236212771732812878246699669627647867930377898921799962672903006747410013710288512447542432175406324970095013959426111394108757, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341471393109, - 30845763132983623646676132828432658505651876712296591879326844890073586512068482672652852994408467762027384510421037791468028143740382138177166271523265815466420981401058979847392479935400132879304381816335150915194216338773, - 30845763132983623646676131651103982009479644932379541371578069084025756673592089706553382135536309414162602277343248656642973173661291437330276653814666939524931956827956231615714553085349411149986731977570992283227119768917, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341483976021, - 30845763132983623646676056302068686254456811017688308875656417496964647011102939876187247167718175150816539360364744027839455088599486583129341120464338879269634384149380344788327234682103220473657142283383184104262062134613, - 30845763132983623646671233963809757932995440477449429136670715925053628611797350732754609227357582296668512673740447784414297644643975914269466986043343022930589732720523587835538856874347017188563401802236837718214864885077, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341534307669, - 30845763132983623646362604315238345359467725902161125841585815322748451056239645553065781044279639631194804729785488205204221231491293107237522383099608217231732041273691142857082677177950006942564010796364177282060206298453, - 30845763132983623626610306806667940653693993083709714956152176775217087500546514052980777327291309040877496316668075135759330789719593457193067794700580652504839788676414664235887176608541351198602985570487942451625918289237, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341735634261, - 30845763132983622362463266258162039484175092702819418288399309733209819936186098047540539440038151260569757877153638691286342516330815854347974137162816509983735622450720032479375140166387383585097367714305045637686931838293, - 30845763132983541457052671153784364634965468325840431552215819044744695817119473699365314655836053320874497748229706245015093019449049272261980054745911388633068984006263600062604807868533456320737811318184178881013583533397, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630342540940629, - 30845763132978363510774584473613174285549508199185280436472414982976752196855515416150928466901785180377849497098029683655125219015988018758358780063983622190404123561051925389303540805882111401726147564786823795606430242133] - -def h0CodeData_3 : List (ℕ) := [ - 30845763132646974948977036942656991922928060093255609028894555029828360499962185290430212375108624188592361424670729756617185991300067794526597200420606569859853055067504746298022448796196036584979449740708567696297172489557, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630345762166101, - 30845763111438106993933994961461320715155381313756638943911518028331291898789057244304382500346320714321124789323534426189075417481173443693856103244475220704584671480485284456032560176287248313189918573110054807498887877973, - 30845761754070557871179308164938363417703939425822553504997149932518901423708862292251270515558898360961980127103033278789998693071934990398425883972068874767408121911239726568679688502124798918656442140444739792385518949717, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630358647067989, - 30845674882547414014879353187469096380811658598041085414477591800525911018576385360852103489163867745976721744990959845249088330880673979490891850538062734788108949479524021778095901355728037668500023624422618297037292393813, - 30840115105066207211682234629436006019705685620027127621225871352974525090097861751305413799881908386920185289818260098630825150639969281408713710761669776112961913849718915180733523986335317658433531297239000482380332225877, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630410186675541, - 30484289346268971807066646915318222908923415027133828853115762709685825667472350740317273685836509407301852158765476315061981615234868604149312765072520420903551633542192092949541372345201237013955193150416091894853039117653, - 7711440783245905911669033211780103818858097081962707694068809539209062619439646037076306386930974711728531771387314166655995349308425259547652240966961687501293693860475470153243667312620075766450234925464468495178910750037, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630616345105749, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480635372166060630711985231732361483606, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816631440978826581, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816634739513709909, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250485619977150254065235374508208412775766, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816647933653243221] - -def h0CodeData_4 : List (ℕ) := [ - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816700710211376469, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005176420944889926385170154028703913060187093183640861349088807179621, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816911816443909461, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800817756241374041429, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005201103513249744475802478566442273317761834221625365047039036314981, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800821133941094569301, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800834644739976680789, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005596024607006833925919671170256037438957690829377424214242702480741, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800888687935505126741, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051801104860717618910549, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750011914762107120265127794752831276263378091396553410370889501361132901, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051801969551846074045781, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051805428316359894586709, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750113014562108935164357796059407599878404230688137937517693639899567461, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051819263374415176750421, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051874603606636305405269] - -def h0CodeData_5 : List (ℕ) := [ - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250565373656897349017609602931825233450326, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027052095964535520820024661, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027052981408251058878502229, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669251841432532850868255597257709694364243286, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027056523183113211112412501, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027070690282561820048053589, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846756906921122230896392613883861336546808160791082618161782931749682369893, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027127358680356255790617941, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027354032271533998760875349, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669255924820935902129817157752998875582780758, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484028260726636244970641904981, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484031887504095088858166023509, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846860433116324089353204135221795491928594927425665173960110369613039359333, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484046394613930464408262497621, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484104423053271966608648394069, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669337592588996927361048367658782499953530198] - -def h0CodeData_6 : List (ℕ) := [ - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484336536810637975410191979861, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065485264991840102010616366323029, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867848516852239553824662188476628741978037183193578986066733349375426751190373, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065488978811957958151441063695701, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065503834092429382714739853186389, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974670644276877973331060747726151320489885521238, - 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065563255214315080967935011149141] - -def h0CodeData : List (ℕ) := [h0CodeData_0,h0CodeData_1,h0CodeData_2,h0CodeData_3,h0CodeData_4,h0CodeData_5,h0CodeData_6].flatten - -def h1CodeData_0 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData_1 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData_2 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData_3 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300865144476228943516043342214815198253176837891581657254566598836413859227936136125673519515098118422877928451228177, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635303325364955898838061585360244827795465809614575239324861042770312704164212589224709486874342433786983838546313888304, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805637822591136137870852696674465908071579317897865882500919089851016790018483368931497125460763467888715537899789513934352, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729808217550740826477213839029923238840721863572264876256292295700172361753225775353964453997876697813105863069046485115519504, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755814420799306014560234469342536876691485834951643579865823362757224918392377818603407507846731229198776416106772242757710266896, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034842375733576576327101394067437513832132662909545164174170941158490084026479832315235272725528706818646360199917126189562840236560, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934123481160017501376369248822516759602077226627120164064450119690055566073077504748652246667055395459313979361079913873848081156948496, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817983386684085972060805192651575135018994570459010245894418766627412687323772419726023749812753, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817920238568819602992130870835234444296001974938806601870649046273482701503479756288132064494128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110815899498880295792794552572712332341160238918292289993110017994947723155254114526275598134298128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData_4 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110751235828847533866472047032779465040815821105603758512769824352523417675274427165874512368026128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183108681998387799152224151869754927711429794451099570751141883627794945642315924431633039767847322128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183042466400274250939669906196863671595877110610906514515273525337952456830816724574582327943184794128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624180923567260640708137934044664343475898191227724728714967486060062992814862842329148959549553983898128, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276229865134941413878190174019190825402744316372452573608220385472085412448293820241118753521346427542802634134988137754146171167169379151277, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263580008995425388482955328859984145899741704752857253127512941029186733483647906629839037973973250865011421448145304974484635254967571794882514554197425799696, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982373309509094072578951961030827826639684716472498726706576351861193803255497465178009113595582226696970689299417696445732332233169234612558097688228201979462160, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629814094736317610111795619570653514432897990436709877088871441002507147037097447484551052627266381194691123349880356022349175449080169143286879595063325394413600391696, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629929154456613052356189224531074119125408038488555627631460383468753043401570837082886093327904280708203388922930824283851403184812103040089141595965223132670890361360, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969633499492443962532906490881909542856935629607659085757461805643650420953492718651330423483539301688647338569221962097333723635163235811479129238213649465300840562049552, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967973403776407085014095500149918352927954938487253394476577022303822826742483726842907710055235319875673755461827102015309676287812333034124391206219410620638974555407794704] - -def h1CodeData_5 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258971834167336999521817337135377424571605392540015137757461087165445546765252136913086180837547403519883667296236621470399770464108680791734786215818505703857247541345284276752, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276229862295727647098475757810894700840296596076734064804964132568782085782612902469946698326378260351568824659233917759212066035964579261869, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985847706158736659998499130721869826292513980491152537636959371407318254024622979587915637589901193279813086077805223905076222322943085005377126928, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276229774280100876927328855353714839404417266909460291904020292566378959146504451563612987282365077423320730910853097916254806968615782690221, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531982823512250618042524348208405507696433820026040445846834564563102681175152641331643424091052558435432752003738281361239146257096503775544138547728, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276226957780044231450627976723959273456278733556699559073817412489478906791034022560934233873943223719381730962666862941622516813454292397485, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531886049307190822283351518694281919540955613483617831741157930697354294651249228597419694601857590184326797368873517755929387369850445872784504013328, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276136829778231576196199860571781163115845666268356108507325250028677231415980294475214124804443905193333732620707343753389231848286603029933, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746528789274745277357989820974242327098565653004126094180359505646993405925886340021102260350947618606148936249053201082386017102977976592984476198912528, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746429692488764046500596843551779772827355969504685337336146632568467058125409245381257161354011971117016438702951683150548824002438013300558610435686928, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709273252733720226608054500143702081632221987513041365690379576051283023619414260995732170634580465712359797785678002729729924112962920543268269, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472743258595337364659064021566032978036148646097522581118321334694055623928510142216906213993452071251464776517227703109331758644785159187942930906012467728, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709180961659864067627520109203871696643618526609777672310291601691422108035359243435954778947413163541686647483511455080979040308631206630895021, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472641783486492584261093612685431322462429930194095246109847352661644643780821597305704832620589968222593099030019748747130472909832236776498844364469453328, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493706227647296466980250419599129299377008307777705339484147476422175872809345598681523078244958059494080145837814181930320950758570016361434951085, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData_6 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057796353110101155923600439580054484443885629461711639506960134456195592460583732562185742334278490591531218211689271425618104634073639825528068752769071736149872948064087213034180954762557268686598062608, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866214407528947678071954777031977187271420295877868395166529395881582535935017064875629296194025060420079518877697987391853249157896336719713864648139513091907784851247431167197909880578040864898226881839632, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905470026584251586626440087879607768335633232878960349169503259842647146320794673821219392946672340886163679395969859212382156712985610775451992456095011585120588222022041142072741497720957705818220559513799901712, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905634245304566649678744394906285693607404890217622252933836327461420874001677960234293657020602422668940055188580291396443675980326553284578227238325465318583711921525656223098257691293149055121394102480467935760, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509483073794214907191215238354790224605787041009962327197033359554044269034361752075277905493063309188440649191610719434414077753098448273900072624939869135222189203113673104714170936701894151890910882346425550853653008, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509488291849029243177734421416754041564788284311735946071617338074274117535272981579937898350401919335774029204915672224815130551015022833299370362781797157233742675357789829586719222974809137216290997410672999387382288, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463514998557732968044941991734850544881992323429542917952650173880449213712236624534804807309162120508619906168746302018200627446927780603443511494112990040207385885103016446668558664261286657625719240597322050573074711056, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023469157510822886301051541480691052369563177200921578747414646205247766165596332504122492509537688490420273785269357962476113756831818483370721891304589330729547681678899494306356219980250141853384687621760620915613044851216, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819255010683206244309718504706195671590220238832449136340367010291965253213022478600943260361303082417827057898354447286167726000086855003811309922029380411415566108975092965327376, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819132334804075584460824495455769926583962813683294935267769635016143176189369638794826783426376705867512217453327143281055407723029838855211166019136449872440877812258346960962064, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445815206706671894469296216199442146086383725208910360500944653626189836711432478764999099521508732656257437323212453415117461222857205322100006561126562672625250852317322474821272080, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData_7 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445689586606442098784028750727006183199976121856176458602604941343748029839211970803535827140144123068735040707504494113882447307150820785933459204564201800715170036479374566351192592, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972441669743399088636855469855609055370834932814568691597855734148305610209928155716036711110936476616268018349004849796474362002004546515628603943794568653899592583929665041495308648976, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972313034760763777855141585211834629375153546981369176053955868771085199972774355563498320192419116398645084214519899472009707752321208750594059450674711121063669828511606383221947253264, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113968196715316433832840297276611052997513349200318984678649160176700032072383852750682269810799863589434711191911001489089140771762454400269488635670839270070314141655133729318474382590480, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113836474493097875592365279401386040777935610107122680761695698030426331989538361394482957510238086726588826638198412356837334820086716528874115074716105156446329240107041663246552313381392, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616901348026675598931611105873467868282367323118523088495099156165919487124704665277384349373925025435890979550075601528966922766206467281650992303087620415427860630357749793444064945979697488425185688181142574606917347186544425455, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340227717887866003986708107514431018446301383985749757656516712670414354880812502076292139436155207426165993441598757668690544582652842718251306215016339292314631159427338456852773534296639059529571806179597441529821718921831414480039864325577325953552, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182347380451947582575729200217968360671258546392901965383764802970019891996602768465858915664539928384679494523834214392937725517010630876365716511282917622340337491928099362831766135544407794468806845363624590488005666596625833602262569828180098850243088, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266189671780129097547595518110993811532632002406321713427166621968630276541944219083131944407529752048491707814356678087675630589538183967546797893800884322254201329386392236523714924868839881039862015997278278847170804610383517422900281605806020940903498256, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016273689857049530667985634626414929834259825874038980063433547464825033615522681994349289216146593311409276544273934579137703557019377243284963037271954978370581795668272676183699169500881537287723893180488795641757286004296736292032350441742820988841221440016, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532023953879572916738996786489967068540775366899515978903690471053916831669673698281276433078775158441244730959861305570048239914098683615986459790235177019466427700435134387677913159856397663931441016125393591740191856981083076402681494231775508738379175902593552] - -def h1CodeData_8 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665783926729103323175872706160432309656302671776334284280275575506387135046490942044432408044860729691443842485777378537134125394533334518205009770333860437966065054690039789103212111654339629980271029168403225022825052975898369692121044728437776821633646338698134032, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150923488330297268886291197550521027525052920286611350746314028904779551827999462678494689373611231555651269226247200386423127745769860907031603127951080014259797024517652902432469719954986387722710975219796092117796023509383556799823389432760388152708214648610920874512, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670414812797584098805516390399928725405572105725992940792192710327539953888893690472986605097879115353108799291864601678926882160660684833377039602288152852487133577957277234530125712232112151961558174525833219865840907673755054088560846824542449411322724814061043880313360, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964032560632809959759711112685485123647176930801517003983126593701820214925111778863746335254023383124827248837010794356759448383947707929903363462184745151384360365443879315862331263269011980376681826392159368473600335121989482123442536976, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616901342243095011497181672121692959447289463326032714178024458079418920795730695781676641986540750087506325891382735368582870293429173857090355841889826841537931322106657332138440036289734670016012450526753273077805479305436150255, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967963835428095521984941961635865958108922720632442607594314230601430239819079343473472227585637183956909643007706917795441608021541400026407231195432363709522368028740568844092424724112784103622532551693797613987431917866665988483322231669264, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616901162952096801029869225816670785559875809758831110348708817397901364597537641414737712977628214287582062471903884396677243637333077695710625544758226050950122766322791031664067835900887299331642083240684925675337574991079619055, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967957527186902306790773978377641093637740119084957506484909558848739667152014757700943627597898322318023747291543941830156762362579874217681721818478090569393845416744567716942421295297267036171520387450772161794098078876073956521683483902480, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616895425640154066075870944055961221162638895608379787810608315589339566255359901672691984692427068690005633048580653295697190642258000531559256036547000752140248981239069416484157423457771437431790330086497808796364636931670620655, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967755663468719420577398514114445430559896869565434270983960062762641341805948012980028427990254749873675084374328710941041701275811048338465421755941350085281121832872531648142311573200720877739131131673957691607415231177128933749243555365392, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616711831657986547547925927713255160451057642793937466591392257715362019305672229927228679565990409567559891502237258064335494799855531278715431773787791190224287858559977730727024225278063856636534229152510068669230619030582671855, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725961296024486867061749383657692184212068912884940690734953576188007494930731812181910742040545660431654517871023441322489359746499208620203543819754765654593673967148967377446538800466111243807902674946815894645633564104810888205031165842178576, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452610836824228625954653685404746661217680457552731783187576478405748080516915666734072402915520017317649296162019248610660761227842976515187713055365493085208913531932829043786498761883527421271188338999264902384600942046195768310255, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452422836586489086982037988669815655049021254670742846259099235142795072440435490866717978466048878376264856818563611893746384685222848000275637010300062493806969342309439157571194366947506858536846091642861456494415707715481708739055, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725754587577067591579252908252179825220357425376948897581981292195842809776359465587693577642318642248641487043795044892035537193647930919886052555717143398862245017264002442995226445039247977573136077031357877174470328061091184886052679020200464, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044446406828978823839858335693152023457651926762447096864547827450728298813993069863111376396082972432251962797827983236952486335321378735523089203568206283568944755274360962798681453728994848851037894176237951188008488209132631802460655] - -def h1CodeData_9 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220719139917259650776139365695275784337485589825121211516686868204446572884836444374572744316899054060392224500572486359117513215502407044509726332106513231215456518620945124540553231071379623458060604943736701318097246774662060678678741100716900880, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044253894585533535931899862236582673140944903011290425449787130349464418543677369774940445759824526156274296910129411238832164755678367136253123333421205357973353905100009719314209753314509792611071432883280822596458808254481434801551855, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220507470467102312682062974880031128729973026616937615328043249396469935286759161462094367973114587440986880933490608414332798921382698679384615277731988041346473273938741031662409379114271638833659608678307691427626093065893084480044770595011314192, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710068317275551160585018477437820239511779539412779475260537699943790818464494691735506520375616814992110428000127063614945688692796839885217674650856755211200630137335983264339400784615466751468049462447535702697995343492082717684967880385242547746596147171809124692041872720400, - 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923333452586874710773555079145228746432142450202516317912116863135496915705465833440863467908092982176599987589048521135852925969227068076884361942618699551892913866152206685882237385980473593871809885049913814244660776752942318320367868422311382884565495406245871770171500758664214140530, - 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923333461379279679571481971757674089954579996754996300563107965493156758920294395599931686120262200121860391848493795011276770223547621400990974518438811401520262460678897369985489051519886798992512598630505982910145119974244390828839220565638636120664539496818546165413603454023068472946, - 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923342464801967728648620006901705856930627666494498535177996779736836210904742046485787135381541376068514353520454243445293286647794225286162252158233345419925223256010157891715194563879008842592091305156886696366112578587566639503503816876091678907519169866328310241721632258154670249586, - 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393603658718705609502750044158630187469378668241980060018968403090422344641158106550172087560402490047156185741254609841356918488662998832799673623503068872654420572753262741369685118769966439601522324906142359351977783590218982033772819740610172583840710703492701919883991295034214686197560470197, - 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393603668159478558046499153250969375723467344403324828314131944743706725066202150730147374323967085120353624365768747440534065791389069639715170981125494065957303572924188013202518366457293918357511796747916965534970588124101905023999104844301960839748594514074985644817991467295924005077303257781, - 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393613335510977866845586863806298147910271733620367562561598597706912280311303391024841020214112440074530775868245648997932903782885575921184465186488892008109495747951666370023763998280632164490730962725113696919602430820215047015715051024694715275448134498218702022605916619631873362653669583541, - 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687416112954396151147455434433355806529304003945842775481080116349304358129719166872267364032038972996610579983788477501444007833686277916865568019665273333716106265695860502475016995442946846899251968993511741299376532291918367097848739750460091970913119625931469924728121791900813099768637209977155248788, - 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687416123091348916886678746628539070951928554545070425283186387942401904358015854150410612716471878052327011244602338720971458877632049357436165966305956464076696442757982115620499189902581635624029355413695446339184904011005286631825845290442143433569941328135571406728003410616867282199744911039095661204, - 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687426503330981033851350434496201839719468368154183822640008499274289242133823626969097265575766655105952622317996227517081327878102004501728463326365481953321037754370513976594266316568605289796073049681809407102957544356010889424381918232062841195773679676289867609033195436527076589555419311491961873044, - 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964413451920690265152253376344168304830391746580640634179199856537943359996282919749947968219926961875747719946734112257235757487914272056366152471430642408063458917807318889491331505036556052488175606054118528384617818739793763022113629691130444033563097943135783305220972964483022308272943657877951759411534451, - 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964424336390842751830600956121690660253583574175630323926026958749888457091888330941075143928514842019530248703629182595505459484951055741747592468052419407473333352972741098143760343647508471685280494815000392906451478862198357975920906431963308810212221498598301064361808252341572937745412776617305913619602035] - -def h1CodeData_10 : List (ℕ) := [ - 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989975570033826989110458522648304582613602015031445072624676979623781667882991829390655303069522504109252839695764181208983680304450617549572342149008752066803184754962365082758230891081262785729520686585958029663264119444204503590674572289044816840098916399447074628508298795667905144341487641387553298327792212595, - 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315724228104523366962305681896333783144771300164349161341697125341529219503401231886722110071208585156151951812318561293893923827531369819068437789860904082654087471075439963159201448566792738637173680410991657167098369382180262914234094383360427618258182999473006093117206422824880672981150066766787144228304093924408578642, - 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315724239791634201766909826527950085512884174449212899104427077572470907866544524343318740977469892799041830247005322259295545834357604537777872699378623303327555076575065453343250016089993064314139592429769083560158563944224689687285776604432602273762607583692444841858409424156162379164670759855845015144217438963708351058, - 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315736207393129041681553929303043710460467442149680368139898162056759791725275999898268788989048919118277347366248550830556480824421956496239220045523105272958383108191567401808983159847126557527233499657853710053797795477717705292208370982339449510293381824399420479425020281119601823059372750759368279400917388440753558098, - 14173285136714178333149295538505605282647777954011053651840372062669000803185551616679776494426979717030979992549799104486918924750321994528631810716686079696735848739347439718429948232407014451817297021602768157287388313838630758591849311933721371737753459626417568066056901841446403055652115305492464382802348571828195321239353431911213587625450061312558145613977836638781066560188216272499849125784275505, - 14173285136714178333149295538505605282647777954011053651840372062669000803185551629228716199480238054885691489122672141559431210127133332656516008417367132912447356040891229207531666934005842039459635527770909875206583879593461554917636927067801676884867864223365848075836314998311999120962309556336928355133295886150603371487245925041437091390048268999908645716114024451776021591257868731944149210232343089, - 14173285136714178333149295538505605282647777954011053651840372062669000803185564479342974174016776018110263979744662103812011435981943575609934453914765625801030832821731666047691617371205291785214265843948029024462843212540196992524154824366034147530018171498404578089955387628682369998601222421068036022023345752296446825329158890390304948076265753378014330819217801739172106668351061311967771381184678449, - 12683889071500146033733606854798236591928858914775993776562231269642768364384671297694925562534784962826359198213266898155348068629585693976765780237017441532823395374103440223470489943767296238223687426403051978955569759307051457879110328320581925230640811383305263270344650895637898428981473713465519743287385580478871961909311709918458460658117761495347754588666203590771192404189778217174785140139246096, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059661697953033845622240702784167303698334618189699445519155435534125439275202355408891523296351616743961654839494090149413884414424993217832338026132074398602070328552624640101764118281140897239249698503734565884529930787169243380351256947758347470516367209015263502507983376, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812709791338792411104924338901916665928853180985985906649179944275679576641657471031572382397101361986980383504950924838821464894824559563341222720640276814833535731993172754929709404690691652922302579703561612657748683424884518463622879057509298053544336976810631484024534128411151, - 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923333452303248744038138082609343412770128335797597608794342956607830469150148783048635460868990749339656103580679318752774737444894147001913180891785792718033967137296506986395035719350169942093722700740862453965129023745803541787836534482156906920906464857575666633785746380760511338098, - 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923333170946289742504477519011092420052126846118238163962627681162715486275634793958452478079575775091323167278430554739211721306636440630501578465542213529958812112442405095090982422088947378231235866161913056669630040664137221516753265894223301728406151041046401153322177109621240157810, - 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923045061420272172036060394402075876818601414454166656286185625364973022773309965611078101718642144798396393775696204850683195730745116305020693992117124941000066661842068476081793032111345456835422636497224676975426791826657283178458303170986851411768483566827428454055548342524507248210, - 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393603658414164546646500072897586987848279033527097970719124417875800267853253459963721271858352019238343365140463831209125397607929899774512076934547506769644650153392910313246045336586504262867458148395117372055752209250416307098604229898555598720857305528091835082286982621687907542760313154229, - 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393603356309430193246528581942732963717441396364065385273891084970700094251844046204512095424284976896025329156011428035456683920695633953216161490629900583952394147923301614595381410592024942675795049458329974199982464166162771411363106580418373035227346962614167643825708407839397210933619944117, - 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687416112944177448762637668997675178238555390487577425027650573736811316248440641985898268015219988213288136888173319195461561219601210138339597464166025097799891506635801063754037165028725845117949948455821343008779023136845955473855584086775731132107811820139537008813801137784645272682572651864460649108] - -def h1CodeData_11 : List (ℕ) := [ - 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687416112627397674833286940491575701225348373281351560971334752749527017928806370508456291493831459930297146717310611010491509412913833676847161634289767426285119485790630773018711118202313466617807537173505815330350455784851047112881736345944541923730592071165503235345597922038129083910097647390570603156, - 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687415788244909171178140950245711239701362754106066767303934061770405538623312377607872333591978498147371346371267051985613076006649147578588027341787907254746233819802739152363280895494000227424931171727627254056482560774069622025614359066518895118710765105093389922491027776097244936931032474286293803668, - 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964413440948442127564876009832295802455973206431855362314535716313939383083888156230602073889575562803022132568299278951113918452614542014059194479022771149271564282401800716952638359972780078857826203259124200207883938079761643119423766769013385016719164539437675166942913156320189033447037603420212654607391347, - 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964413100808749862356177647964248228848998461819511934509947369369816098799650487130879349648682191548528928696511690633420605810590504840708686665088004440340559742479402044050930574758783393804398028997315887593590926477780711571990814312393900008509900358466817124388359214586057584679747749996396428114221683, - 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964064797763870288649055095083532855306859978779841862611480098587572991740277329014809726973870026947488008475869439808790141905413426908502606773191140459224577817185891367173207739208305979497041588649096222894913802560833673050157958605742227155737945014390814985211439044165081639644131924748202377447430771, - 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315724228092742005233672008363439008646416347670110387412500824986457705704648063245132798951343402386350651531638433355152520378937165054306853044047826525221317873358978797488065786894843311695070204754899832119621798388489589355246260992422141311901772361910548257455819174837171339352725096940377842787532820144953381458, - 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315724227727519791646028128843700999197412820348708395607415513979240777943299835355864154235522736522510342830554472230493871504730523537819746341166784107793653032188355269927457946388624986195981231636192385347967395364049797534458233666551647790661266077401411242934004898298378826266775452758669067030919993026597769810, - 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315723853739973077898695500631979323417800843233068787200057042589106750322714476744771965235160891950034232920578121337641967286291012539117829236599769046242689656200339584037903785646214564533072047035314740770041169378628140796804402592242058814519679382379369676277464596707088686432020932746214675518699168976169751122, - 14173285136714178333149295538505605282647777954011053651840372062669000803185551616667126353595272803383949033379866772796321634140063112131325475839971683473736139558599915737090127951457822085297337034745448080362178105629785046872766185979531956555826647401647860650043480363571335738257280514978753701246648311247046971786341042074106903788118681514839847476897874173342419206429049740735662888747354673, - 14173285136714178333149295538505605282647777954011053651840372062669000803185551616274971987812358480325989299111964490387805625222037757814829094661825400560745154955426672315555699242032858723183673198823150682515801360104603958710372292090686523184620736897483752581870469158966867698706625168368449415952963174591988609941034319229593474600732522207891316383516831574408411542896203745884433643597285937, - 14173285136714178333149295538505605282647777954011053651840372062669000803185551214708901426108091668975221408780027304067412493164074937722534768240031697657976921306025408664300700790870375918628841001442615709101543255950018476285168607800116758476959789795138792268929248139267793608780409141345602301362649116274931002008474539062441354131944371655354107073003852376012500043684589178033251077910514225, - 12683889071500146033733606854798236591928858914775993776562231269642768364371088312404431704042011448542766530427231959686030623132100497279487649309475023045618003290895879631171911680813448854585584487911817470259943524594970990040732911926615657662274930405160898202600550686488008285193123942468330660338905252392013585567126228315787304571996966293742116435908160046226546213757429975333925018210419216, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059399663865590555660049942250848711461501269915985529244179967022448209019534219878592212337431338778765896339577434613589158770035479885805861758798756780571923768757361133580016427448373389724487398484212093135081473365136038649973471576781315333230893450813487452325954064, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642782592833422795821573912646467311817718425532012277565855594322830297251274940931837291323108274214477622480003429852197763526672490132895004406943620711456664688134293299792818822066372694531614821522602117600896732140662290829019816004619704424386682762470965658380548333064469294463269883615875483580745479874414943084409951054836810256, - 16407379234535226782272828564066658318726156512863643464757583252222492540124187286309811919324623668403475253366019459004130503502199110280092023266559481321015973935844278154933061954943751526729845416580314447739288718506347567194148236957063919565515685612893568252391922557663967344398982466645568531467239769626716547613279830360205443441985757352223797467290429706705820318224022062946375853481316979] - -def h1CodeData_12 : List (ℕ) := [ - 16407379234535226782272828564066658318726156512863643464757583266690434986094792401307707772713429294953846240660519966786550278118521678630698620979211932514994287853318488612382253566258366845074882267779213706135661675873280719323506785284725655920302263890280326495164334550550709900550141037968903010572622369967713107260784102976543445094214458434912932473910068285264988640177381758216014716840104563, - 16407379234535226782272828564066658318726156512863643464757598081863499659994430159153061642850390882533737230229039935984399485232831669651854678735321955148787739346909997040354463552424452830392617895452054304021570019612828499786660272810343683221758419934320767094114215266575087399336518073063409614484405119148190186305159262108479198011957075948469954800061107449300443089070691764889117191321604723, - 20130869397570307530812050273335080045523454110951293152968120801647306830469365514226047537107887915433189279560215790368131210154482535836320014071128559991820649058796249550177268763059565366789434591076137654930354307993259927459310109500208969351632438519321207242923209037227012771297473756905078047932722341949873489759229932382674474793807256366980565613827338144708534126486172860116764244954638038, - 20130869397570307530812050273335080045523454110951293168502955713110805817030935964005780271741546087207467079955437394298330304867627535570737684894221812594013993268337618938235722852837705896742957267578906469157799348046706859090645771948804621041912474268362691713044895014887180195383425014261781449440727009883509524486091803148914483953833055820147429921172960634572920160762091428303436000608970454, - 20130869397570307530812050273335080045523454110951309076173905051733768056079076538452100536607513984067934684662359818822203291128107263614432607741712477239998463838699872310092710785653608569150178006414172238061520362776364849578364119310751951888669081286842789117651336138898622459397512547526064593637506973926809084792647469644474364226225547902978641427612342969527214359956325027871462355651847894, - 21620265462784339830227738957042448736242373150202658406504168594673333280189076470132266296255505766432897083000039083566955864537395446291690710862537545821598191420715061222567297467585565017600035062603588727037905154371163009012171910865135529329409063578568923694158332428453050202077378300200767420371665792708664388216979276353049700219322604295474095854733871045410440009851235857025677126747942647, - 21620265462784339830227738957042448736242373166883060379877864505926105423240067094850318393408924128111970248888256628207396933328708591739110441233709373633810979590906709535545937835546187091493479990242482715204646320228196658765975312149525497985370073365185056297766383850536481037926658429162976703119242459588412395131471237191125304223978429278289583066935693639912335933120121100292140920984170231, - 21620265462784339830227738957042448736242390247614681114542477628764779907454466806135665878509326487482892118423022340019051375633369529896914341313661053339706065867154582025673674627223190758381085892469926597947600157830654006660658227364853401689444094860104842392411040063969656947589510486465282236637749344450371475571241045950016220708767700602601131712081609364600744429765261255287196785520275191, - 17896775299749259081688517247774027009462583318706663722910963433001870645753899840900867747312511132215807790856383839367056655737950142967445830105037644337735832470794389650196369927911882080253995814737151410993689563663474017412484797517983853879759928320517211328132282245292658946718296781884854051329307994120063324010099010877877574732737321886800841946698779880992908142232234988872843926484769428, - 17896775299749259081688517247774027027373028558650135404280857118937830244145560585425404386816890855986077077347412456735550707885839900349776065517536932983723035359938597831930439433708892418500529858933942486556907397979500032444989625189938257000922985330141189443165939151155309581477134604211968753204609007724794536016377918124039698602345521469237869631324844713486676028571629958886170214542301844, - 17896775299749259081688517247774045367668954260765137127051991517360458997206162978550923239301727996741826444160716642073460107324951459855937127916808506474618793843607775927617613369847478782951391116448003863291969737590139425729933161271247053071893363185094779237630610754509559574527064667177423473512846938969555630447935361333808235519018549247461009579504082848015654610122754591929989423851854484, - 19386171364963291381104205931500194521415792265761961119971756295158534570077065237730442720671825527875313239433318980391499775653235060098771783202240892634645315388179761243858665879768970511270043746616882449877849344543045843222110863928969218866278096252113802159457968357707488136837786502373941495536159291443632860671469214364112667599422417262277674946319058648880080283306644178371059028601889461, - 19386171364963291381104205950731388662004813205808417584994716701525903844292039221786705861261530628523368866682763864077926041495855792440938161791685682145493087280270624517955926334104660937564002811039053794605668910355498996175400858381118132701207732067486122746949127143748200460303490567022743426433152198052987463281738651804084146967597189998484621699838385409898673776150278032819504719378277045, - 19386171364963291381104225643474188625162255813379837768506172821712040640425398895400161825119553692132331170114324758978422264339485710819309837383150141253611504781314617193550631573851657462578084779342510795892904302307527620344355177381605899669154807008742404337895724049437619689184452767395920664953888566032100538201019885442662124364259563286151969778611041465457291738962892531272936192270426805, - 15662681201928210632585169302832929171586188368426455996041887909750538783739833354148445941726339476618651152865953741300410816348302069751243449963612840128332445576181494736249017698213035505962486363447168998283305362101334535950099340417020687938075911396265135919849169742546275757709191443624359960097952760204660574882696298841393779654454291914892375978090423749083744793423402809081322456326196818, - 15662681201928210653234506777047096950125865177916801704654568208327681117492952257349204332118286307874934205262884924027775298433595589209348445400286594506082020281845299129890490644841248671976482129175750762421656852467951121394099595877756870010129514142990644338646149931003618841529409948320419079755742826676243475804610759466695502451962081101019658064977637622500818352628998959919552337876209234] - -def h1CodeData_13 : List (ℕ) := [ - 15662681201928231798156080372354902174754918096030807324039193951321430880686709134925796093471841514308779859720416036849004953774159514308863772554211077321646518881580998218758787992131530670308146235243477240093582987883334616050361187671607311793018726789911265186753862911322936673433158757084957609332770893577136071303368630145558538051711813331321929419106683060918584893064141701192127745262997074, - 17152077267163916497263130651254820885624025284007621449174095569947420829907803472003974256409238299812865202681392118086986665189665482402108304943842850552871514967485654561249422607645847336970805212145203345701268347791666881498481451895825963524752814144261314322783951422218842937501141996872930797892578947916628517745507455392328206104860304543882693611521791796264393244862457638309836980112512627, - 17152077289335973781217404128426041519416689595563973302497180984099111486719465224286727321913379875953833662825549751794065052347990631785794058462335663912555231427893463725008654862382529959992489284504254663320637668954959565653358280416668898363793271581187739716030002731233749242812041081626120559674857618205659082742863220971586365721990737541362730407558276733006040329849756039925388257187780211, - 17152099993522632550393444751755970523104944629268271105336645075430344061861099561825866398154353844305536850442966667842333502472943600680005661398976544228680886885490047414462483712745535934196979380172803905554822540166668140247230685759834173541221686993847342399986543162497805881172703868892436624728215994175058333385762112908406148279726298189504736329886848714921175195240025009630836960513414771, - 13451858917626131438119821332334848573080801544381571524752522616046919909648789880473657594902866085358522239511161305483082790556563687832024875440094560102813495190210123148903447107900589948559303386131916837621490361872744290969214947367395733859939171993906596022543414464360282662331732338508837102879434902562597004602859104929499741217657350791636191902368146505591490184829605761151526492569092624, - 12683889071500146033733606854798236591928858914775993776562231269642768350041038830933410994165953879352502016160371874556125623285218252137859462212829651441899232763421992406002774758723788804465814909785074972543361610944602008047946146237670282517819862907352876955559681655903197056529702632078493113547297921009469410147928580995577338211379843685762004532432849160453618693678918957407316788883505680, - 12683889071500146033733606854798236591928858914775993776562231269642326823477135919400360521270037472930793325639519381254496521119244853621979621923592815124418947780697460111982466861030572416058882993377262506135329495070658925371184386028065556512682082555232595377244167361103609448497642107191130137059857933960465257689571137112968328886019520613744900054280368635859646479440294609342791608898698768, - 16407379234535226782272828564066658318726156512863643464757583251755784719286425830987299149860468648192172963453293636172439543030704833881685358824215853863145705744958013301466958999740054258396134550412608020049083139236446497770620541849719992586329021797493995405850877009506330487748945093377073870850937105099587626334328079630646097406862679974041991219045745582998649960185428440626749095596970611, - 16407379234535226782272828564066658318726156512863643464757582788781626448227062151054631841418688598580301370029277387135006755308382646662274232019337415655839660385783278663092827437672364071354955312047831751365148503494585629631146995364544429233158516921117731637133693237130568690911870811030370539478693894187697717614191355907828319098957547687042812318251741812742150880434875595359514837059818099, - 16407379234535226782272828564066658318726156512863643464757108703243556883438653900003307997035917796023789703836638372803832127650462933985280383823816691374449212590855008967982107880357612541187415226516932619016081503829056654810235394544767555586561523511823632470737510324350488809797551908700325493635140319255394164943505916238008288344915805677394001549637501443491288541363779497957361227681911411, - 20130869397570307530812050273335080045523454110951293152466997094825903637354476144878314223087447329246922253741015093467157045808897213264242024689738455069169250858488463440885060566615109220661901601511532209310114145410890671600234765550254270910010501882255352905177348199237975112455991458280668260787302836532659424122879549454674253625265185922375721684534159402589441548061929714106819794730542806, - 20130869397570307530812050273335080045523454110951292655352279927993936067384221751926866714810385832470032641093923767700786014988257221762876558350754371798982236153164643023014529693714612262149175953422930154031872863700588859397493567195193416821049357912927849861283396914112617541705551222866159412531153462656306312863299684933227113439661219091452766348731321211101604554356916574011717412499285718, - 20130869397570307530812050273335080045523454110950783609881901092059144417843723369644618239099413132935069290472406182936850454652905924364639027231053103127479177901572535123590915843605726912095866369445994162970783234498470307518697344206382222689905037492230637199842656102776853723572646797721675229440328320925885054305410522385476043883309371747184032014617351690773677659087468124869286783399814870, - 21620265462784339830227738957042448736242373149664580923492113887858727727187431611270393647960234206378733432487515936965651313931224054503064267947338454601849391802321782244729276810554577208764762645582979243548655439343516762245920188243058433566313547133839371029525814640643907271888691844427792927379808480873833807348769858203135926079396108215599511081412890955028330128435019780903379903590559479, - 21620265462784339830227738957042448736242372615891717775533844727770019149555731620292726539050846632648392124064554508471537112609203400185632896069839964611040170356189036229412785035814670844174524961138371622212938131918439970124211347142579436575561233962123127714068169133974120524711727717637095879457355140721897586085027109575465203597344155272207279530206007723624150183196878879851788364388626167, - 17896775299749259081688517247774027009444528434392204578070872814366854557449069537730984141829139781687813567785324334712451318991833318615245900432242786183858829242075494279045428325587489932735602131224856258699775029556300604090879449909443577263710368787241380705032449929863279948928611510995754261107449448540897688856422987488150925736527479949905261751970323100473697180613361873273540753332329108] - -def h1CodeData_14 : List (ℕ) := [ - 17896775299749259081688517247774027008884827020643971088028063636681355819999330139464592371844627915319992652582479690419685879862211763697048080575602183413671729151789737773366238653531333359665397942343706537588424472233924791121113674044695002166174023255690631388937648151555154087532527819874301964172040219487652639751831889590148867606003935541052546246984208359952636589478556721409700284609550996, - 17896775299749259081688517247774026435750579342452877284191465686730648671466186314679419907704476754671375484869563934627876211129739527462480547375624946742081236699175075957876014468027002535776308528046392119565453774121092310080959188542154102288956198947723331707860627163950333775249717505406631504162407784136253855550905005039533106719414771767307521332424481400397413977593286359639132456694274708, - 17896775299749259081688517247773439546280956874772822155515164937206528573526909734662816628189688250487395746843830003814775429078169623265326550598934595033416965221761376895886448511592409858568904449202688654617889264912544680411681809212729149021606558773355353917231379702270145169478031301098989810067410061415659349795985672263505605119508106690872536165845792436878858575984970468451005789815659156, - 19386171364963291381104205930879833420106469009631430266261338217533780722521743496309272941943125363338279186941401403498389250948634391313540609699355576843972806617467152751145851026403303078163787002603264019402758390807160257642972477011157963581280366064521146656635672912996497416725989597062689820345933713811073034780754163556692162182841947592774794641938823094371033557691608471569959209027789493, - 19386171364963291381104205315481620921257798928144823385526605213777963947642576006508852443072562142600499114959165125532748743984770956364216494837122312496844106070559527980033516487661209436757096941093780988112532284808659363137692654542392720863532019972606887856918591759693703065823459528301028031642160702311725751250235027887540633855429433015770155847052391313014186785472852072834048388162675381, - 15662681201928210632564353438443600373422337887771727824964657385256005374129195129447638725606992756022626673982489092930725973120393507735660682831116193198516165762970140094723169439194257065270939996747845831182359443260239156327675953062725590980341986393496259399265705044691715193359004004353785050735919526572776693377566230991697358851305231840608453503171747794001295442039212127171579892695944786, - 15662681201928210631919061642374407630342972987475154521570511125925469676199410163722615025907244417545867828595084993470495833055228085252594901723720138374211491553418146207421873409612125403833002629068827651053035959186282388032550945079577585290590311307661087261178299413886361464682732782182551601399314370963641771564483932620392786308745592043613466664242228493420628831777660683605757453527535186, - 15662681201928209971140262467521038717073315083784091845964741571456914996099605261298346533364945817344810151893287146194832406325835462593235047750159998286225100972176405610894739117509304091385138125754211198625788267454551653824542770336019758984875023412444817859674933383251382782435740631908659772350032243872988940120552300385008585869034431264021533241444545491934753685386174117878116038718639698, - 15662681201927533333649907417671271528943621704135912025656717795656922573899385178847410170051179211461749209252291535915483435427789859408744578824576548188161145780634034767109224004395369010211796216397808661340838861826035093520062016727711122523339204789755095852512473453795171353014757736715208754954379088627585243441760717773254986733469255288730704498258583912229926499043733353351310196138954322, - 17152077266448688842942025055217039574856519983634835905518512169490914679688072447736788673651040184453479123321903162160951878507138864680053925798085017863849459597795080072095898986525309187841073467875556529003869337431560665880582199362895546271880541323715300600421175573540942734104016219945408547512505442423433919220013861691495084132404723244500743978597931334083380053220687604774236934610015859, - 17152076556942855756405273785737979293491262013831576599179778916636813661714896374688690577518509747942488398708858883534443489440734084402109813206314990353970532864745186831800466834951465251147183152385914365184051060206194772924523686695921631422585903342069688016547533685063940964155245507843336170479587993174453850011683724008665354855238280041779164680827223967480911477719566115088545934699320947, - 13427859859934694394232752129911829448669803337206397220121576011471790159936726252005617263798511409596907663784790174203709445574019019266676326154663392399410977947472886502998164246772210505567966132357027497951494882348016152517247905920952604376896712573588507380997709486129847118709109977299132243850954322138839704820647543537177896854019394977149721462531586504844475423951533869558302536687436304, - 12683889071500146033733606854798236591928858914775993776562231269642767918862753769496366999563516460986855816267285104543135751115134293740871298306297193593932943422618550479934395551792447772836511265335457968181635017081443860506269621081215590402580470543727759493080857911474681834256157481585152283837098114754885802802211638223180807594278686120104395516584422383029994474432549399359192616342667792, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210129, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210160, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933211152] - -def h1CodeData_15 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933242896, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729934258704, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729966764560, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062731006951952, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624253102841178480101642226618159224980954845818944204725369536490074521263836421734615335484394670932496, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568626422855560163227930619748827459905375385189894390271462303900931633194639042202650453060556001540325904, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568695854942567675158457900459525081677997156200308664407044203563061510742645627191957260262847421360914960, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739570917681726808056935330883201848978401893828533565436745664992751217592278856346849775090736172855619764752, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739642016138822500273795266330956213673566587343197782151581530246772212201437599375899945665882586751902958096, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862741917166765884651213313200659095883918836779812452717026329218375444039694517376305505404070567831432965145104, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862814721986831873481277887099159565331767482938828610633018255238492942519473070238052880073020495661226955129360, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062764292948496, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183063829444837904, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183097914305298960, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072184188629840052752, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072219091526952174096] - -def h1CodeData_16 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705073335984234540057104, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705109076550877352313360, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041706252774683447344513552, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041742851114925687094919696, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862042913998002677359107916304, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862080390698410730863523807760, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767863279645111468443004832334352, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767901655786329315231526705185296, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402769129692305300412464226636415504, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402808426860912375523910624435782160, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643118323528256413924042094920570341295741616012765680646448884602109943341263242841141143402329374743731919603693698222797414982722331206599632646699496725286354985907475755724313037850034704, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643253207083808217562288513224800753808589220844198695857409229839894212226097025989889239198104634251286105386695389494223264277238286786908495173117144457677555825746366945503072583271596560, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006647569480861465933986173898960173954219712575450055182608140277448990816540778086749828304662912938493020050442749510179850441701748865356792096018481871894195982700590885018423378036761575952, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006785690241746512859550506242492116367375659922837462758631533800940082154610572031067878399536778674228506292236481372119920119286087379593067323070153149862785642695615463351873152548440916496, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263011205554590068014477609141235514273588365975039234505191380126552655004972843978249245481435500482217764066029635900954202149801984919835153874588723634044857654762536401970022265936922179813904, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263152641213736356066255485461012223304660056058763939863039335094607532535156312977230928778586338995610901977626417327580833499648347558413099707089635022684693466597441570183474835036881824530960] - -def h1CodeData_17 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643267678582306417573723147527693866912298954138737954511314173894072363613501027320944644794287413171424191315148723422979633036694731951992907366347118799459159439445314406953013957046235590455476752, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643412508697272216538743692879145216960116364784472052797750479781360558204408899575901888490569871809138764536623827603845303538937407293896723898828052061426351310764257299203589387804594266645742096, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669404065936256338779090195354015515152, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669444306236909983693211306700566970896, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830670731995857826620945086869790213554704, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830711938063727159013005104888658904236560, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911832030532235545795558925681492457006055952, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911874225545733742165028384132813996264276496, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403913224465977676025988051054575103252527333904, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403956432159799829108324776508728359452945170960, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927405339078362108727743099991041632557866315956752, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927449583756835993484055906856094566907094181102096, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300937291704371755672804111132820519355629991396375497659751048917996116021060158169337623057091098044108481860485647, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886703277800036751703350360976748782465901223762232164435311196755893685482386050872578709374477737727947821313601413829266305610599090656044221152909338193325, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData_18 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621928865413468000305686065726537788466082385865753104, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621974171964225258296150379956351993239691719774585360, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635377204126574138486584608690802899556757443646887886095563648127739642087154066535318877382250746188663900169533145584, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225780402824579472380442560627886570663656882401367799354156945748263235231718316249130218104481872026267567957947768283950676461503480385385135588817289293966765, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155623423981588457513991008435310406545995190404857217552, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155669817889563889696226466206640152234171148327501447696, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665949173410349817165020065231600757420723810031139712161788823481232683428840166309915161978500230750925330711016814357450744798698518839953735488450667222715638729876965144764130204817507586446721411670159160515480609602004007433135482119206982312737263, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057494956968918135832264780823039073604418626307209070222989523072779924359285458055184092215232686580867897713919979455835748672428524289970294497324768107698415373798285984679082753481697865948069380624, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397157154422944777719527761114889192014255801801852116812304, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397204661784711620274136869872730851598947982714639808479760, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142666170908166201037197278513870687453642951162859567274150519295146522327792369662444202874324933529652711887075897776033971191995667703249833146465737676410485140307115629291397649840449547623696831934646204568273104141892654123025037100562754473956948463] - -def h1CodeData_19 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469865905777880376265498427062456942150307443854318441172192495809424489682253418763134227588819509227599378531096527708579508017433021949929555247483376176444724458784790040924214734828086389846622229232108048, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544398724897361250582021628350123663958309097771923845941838352, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544447372435810497357941355718153523373033891026618442209313296, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142893227298157850154674452930802301847947539062317518671959046556613065275213238977317697380329431825992457703420773911259221594306500831771086310289207441223161261624618485791134143798804233256886797010248506471579786313904726919924209281925654958127397359, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469710547491449499964795499882681217581661411432960762232977524342268031919249356439518173755953059610840568559014302115585976524294610147454113515823900562459727057655679750802004723386093543830042103534600720, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263546004093666186394187372631495109024644227275176845522768511504, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263595819173038215092729173456357685065322415567984112100662854160, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764375398970649606540193525792204994240423646463407999843511043739137071351247516706155388137553153294347022160799190620492901632684260049807285888404132562018578117689951088192625700343430664321293868299967223394961628253858630612730017799642984360044608829935, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905310623662186232168044998067788445036181000545719406098831331892495419578668338578208147968145012639010983410341453851067906830337366629325655041958235440454924467680283774612225765977572913931875608226714632720, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097265189901712943133446066799851960118367024440937816642593281819152, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097316200542989900520752870844511237984021489252772457618357088698896] - -def h1CodeData_20 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008669002461280162533064939728488771736540903788974283010383470194657800365342036912932336423104987299751942093597719943247411646282560753827812566493227335257742323640962670769496826562173127308578459977559825196476872899448568597564619396775182021453866071732206063, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482742405653109643684282172427603165980142476316735254105026889729698006260923823670986132062838359749527514509497787985775930768424100896825021110140162518485958085405374237935000295305330076821979290993160748548624, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461098948541063852536914570600273608129684964363231480968842798908850704, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461151183437731456901516737942004708664115136330550153328024937153708560, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805713474443033215270940272435630033489618098501942952928383957048186349074512481017173856492250619828661200199794500845072, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920116928738726718556209037107586511575298061504274171199770687919988440585645208928565095854522712271175756585211211436159415977422443096946683669276966821534477741, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891462822700131094796568786092877399925765880639284747668821853360989159952, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891516311234318721665921405450810046873022376733819068164624362923723604496, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729885685047083433734903516605216828386696811626199441818312812488031250214533571387925033458963990680910230198582102670688784, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172808652824702517044396678436669793473066363270974175336366828875733823154835232334797718480213294917726169886167429264712512405803876743919995069308336470476729986477, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData_21 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546893227944328322781485205224904654749185230251758917324030304668931225829904, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546948000203336452695702287447427685223175882252562061511732074461171297042960, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509649883223924809211876864625956119382962987158862223317375228539850702651849546766309191786118435953197502052145055389244525640588391314198710392374802090686742968655320515109535660268744940353918692692725338563166736, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008424725881711246718862436896302788827972545015889746427403435931942745298560247694367062976938769303000584866565455334545457287255023889948569043698965812003381886157768887197482841802869337241072246369403867609827944337961591942590446445072194092405494174808750575, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306548700712491596609950648918568164660390876746278262675518188707812853575860752, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306604787505715921642108941114431747865757304395100682323724800975066686498030096, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359287171041481990569194537353280394213660506518339063450489772004078425425441387114396906334452415228349856857627075529327263819796916526736503078041704102476173958032813, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755647834695170871913298586684916890363520918791701371041975970365044973542030981449799454248916065386446384402441982795589370384, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062308399564888894322671174291382066410437482989157418111066336393527189340007449104, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062365832441150603155601265499946375612732704901551575830829907355195114252308857360, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463680468125626027663903853581073472304358774707883744902270503267175197716132840893041177880411540977461376673326477979951726895097184236115328259237962588451354833963945077896800786582049672068846904382011502044939567632] - -def h1CodeData_22 : List (ℕ) := [ - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004216758773584925050857450891700630423587171974119454625937488901091893875043699029626646191080997886989504755514146457388121589767503037542111965605298279039314755593553564056137258467703745907850128585925577898226261388753632950446818479953864895501228100543860508670447, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720064203684481525285809364184174004270086179806098164622863264178128568711445953921552, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720123014949773515130729777581743856893236487044389782127901160842876523821642595975696, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489476165755395354589111073076327713439148301815157257361635750733997275940433417578093057663968334204384028033154234362296456938349341876126130076799319338126116161806773677, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034671791562942190256639050226030410034017321676160870615486170957502448733952315470845050910816059790884458943831694431572640416272, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423722004975439117190168183006303979140834046318669721542289113854114811087347935141708304, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423782227711098114791366686325415508226939960930680337867447920038816717120189296605151760, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023638598348345379350868488011223330041636201087954858153424719482854391732610756090393085289475517688997134279848011350553252355803568581090050821186856756015790978065266643380168252133728196708113716259390390619790228603408, - 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013003961116005245304812247042296011415249578392765033373047973306764987318675041668007347080567350518607886103353216801211395703121789719353292811603242602505076783110831651569288255743042776962481484075538912953792584816075624216677493424811457778461786100772523447381604847, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985425709355252186038029718792536984438982329228515020060272529717949277710171112863435342352, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985487377436566999581656986191307190223154785791213891177235147251084029487800667002001441296] - -def h1CodeData_23 : List (ℕ) := [ - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, - 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855609159836133760895492848968612050511860403636271448387730374524717478779261945177968548559467700422311938235421454074670485205306464560377414507051407898557463841132158234029, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800933948802969287890040215808728915749703262180657395336365218833711719575637024612120825601131012047485799842113541191895849207683629584, - 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] - -def h1CodeData : List (ℕ) := [h1CodeData_0,h1CodeData_1,h1CodeData_2,h1CodeData_3,h1CodeData_4,h1CodeData_5,h1CodeData_6,h1CodeData_7,h1CodeData_8,h1CodeData_9,h1CodeData_10,h1CodeData_11,h1CodeData_12,h1CodeData_13,h1CodeData_14,h1CodeData_15,h1CodeData_16,h1CodeData_17,h1CodeData_18,h1CodeData_19,h1CodeData_20,h1CodeData_21,h1CodeData_22,h1CodeData_23].flatten - -def d1Row (v : Fin 103) : List (Fin 372 × ℤ) := d1Data.getD v.val [] -def d2Row (e : Fin 372) : List (Fin 270 × ℤ) := d2Data.getD e.val [] -def h0Coeff (v : Fin 103) (e : Fin 372) : ℤ := - (((h0CodeData.getD v.val 0 >>> (2*e.val)) % 4 : ℕ) : ℤ) - 1 -def h1Coeff (e : Fin 372) (t : Fin 270) : ℤ := - (((h1CodeData.getD e.val 0 >>> (5*t.val)) % 32 : ℕ) : ℤ) - 16 - -def rowEval {I : Type*} (r : List (I × ℤ)) (c : I → ℤ) : ℤ := - (r.map (fun p => p.2 * c p.1)).sum - -theorem h1_boundary_cert_0 : ∀ j : Fin 270, - h1Coeff (triangleEdges 0).1 j - h1Coeff (triangleEdges 0).2.1 j + - h1Coeff (triangleEdges 0).2.2 j = if j = 0 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_1 : ∀ j : Fin 270, - h1Coeff (triangleEdges 1).1 j - h1Coeff (triangleEdges 1).2.1 j + - h1Coeff (triangleEdges 1).2.2 j = if j = 1 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_2 : ∀ j : Fin 270, - h1Coeff (triangleEdges 2).1 j - h1Coeff (triangleEdges 2).2.1 j + - h1Coeff (triangleEdges 2).2.2 j = if j = 2 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_3 : ∀ j : Fin 270, - h1Coeff (triangleEdges 3).1 j - h1Coeff (triangleEdges 3).2.1 j + - h1Coeff (triangleEdges 3).2.2 j = if j = 3 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_4 : ∀ j : Fin 270, - h1Coeff (triangleEdges 4).1 j - h1Coeff (triangleEdges 4).2.1 j + - h1Coeff (triangleEdges 4).2.2 j = if j = 4 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_5 : ∀ j : Fin 270, - h1Coeff (triangleEdges 5).1 j - h1Coeff (triangleEdges 5).2.1 j + - h1Coeff (triangleEdges 5).2.2 j = if j = 5 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_6 : ∀ j : Fin 270, - h1Coeff (triangleEdges 6).1 j - h1Coeff (triangleEdges 6).2.1 j + - h1Coeff (triangleEdges 6).2.2 j = if j = 6 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_7 : ∀ j : Fin 270, - h1Coeff (triangleEdges 7).1 j - h1Coeff (triangleEdges 7).2.1 j + - h1Coeff (triangleEdges 7).2.2 j = if j = 7 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_8 : ∀ j : Fin 270, - h1Coeff (triangleEdges 8).1 j - h1Coeff (triangleEdges 8).2.1 j + - h1Coeff (triangleEdges 8).2.2 j = if j = 8 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_9 : ∀ j : Fin 270, - h1Coeff (triangleEdges 9).1 j - h1Coeff (triangleEdges 9).2.1 j + - h1Coeff (triangleEdges 9).2.2 j = if j = 9 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_10 : ∀ j : Fin 270, - h1Coeff (triangleEdges 10).1 j - h1Coeff (triangleEdges 10).2.1 j + - h1Coeff (triangleEdges 10).2.2 j = if j = 10 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_11 : ∀ j : Fin 270, - h1Coeff (triangleEdges 11).1 j - h1Coeff (triangleEdges 11).2.1 j + - h1Coeff (triangleEdges 11).2.2 j = if j = 11 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_12 : ∀ j : Fin 270, - h1Coeff (triangleEdges 12).1 j - h1Coeff (triangleEdges 12).2.1 j + - h1Coeff (triangleEdges 12).2.2 j = if j = 12 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_13 : ∀ j : Fin 270, - h1Coeff (triangleEdges 13).1 j - h1Coeff (triangleEdges 13).2.1 j + - h1Coeff (triangleEdges 13).2.2 j = if j = 13 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_14 : ∀ j : Fin 270, - h1Coeff (triangleEdges 14).1 j - h1Coeff (triangleEdges 14).2.1 j + - h1Coeff (triangleEdges 14).2.2 j = if j = 14 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_15 : ∀ j : Fin 270, - h1Coeff (triangleEdges 15).1 j - h1Coeff (triangleEdges 15).2.1 j + - h1Coeff (triangleEdges 15).2.2 j = if j = 15 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_16 : ∀ j : Fin 270, - h1Coeff (triangleEdges 16).1 j - h1Coeff (triangleEdges 16).2.1 j + - h1Coeff (triangleEdges 16).2.2 j = if j = 16 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_17 : ∀ j : Fin 270, - h1Coeff (triangleEdges 17).1 j - h1Coeff (triangleEdges 17).2.1 j + - h1Coeff (triangleEdges 17).2.2 j = if j = 17 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_18 : ∀ j : Fin 270, - h1Coeff (triangleEdges 18).1 j - h1Coeff (triangleEdges 18).2.1 j + - h1Coeff (triangleEdges 18).2.2 j = if j = 18 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_19 : ∀ j : Fin 270, - h1Coeff (triangleEdges 19).1 j - h1Coeff (triangleEdges 19).2.1 j + - h1Coeff (triangleEdges 19).2.2 j = if j = 19 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_20 : ∀ j : Fin 270, - h1Coeff (triangleEdges 20).1 j - h1Coeff (triangleEdges 20).2.1 j + - h1Coeff (triangleEdges 20).2.2 j = if j = 20 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_21 : ∀ j : Fin 270, - h1Coeff (triangleEdges 21).1 j - h1Coeff (triangleEdges 21).2.1 j + - h1Coeff (triangleEdges 21).2.2 j = if j = 21 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_22 : ∀ j : Fin 270, - h1Coeff (triangleEdges 22).1 j - h1Coeff (triangleEdges 22).2.1 j + - h1Coeff (triangleEdges 22).2.2 j = if j = 22 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_23 : ∀ j : Fin 270, - h1Coeff (triangleEdges 23).1 j - h1Coeff (triangleEdges 23).2.1 j + - h1Coeff (triangleEdges 23).2.2 j = if j = 23 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_24 : ∀ j : Fin 270, - h1Coeff (triangleEdges 24).1 j - h1Coeff (triangleEdges 24).2.1 j + - h1Coeff (triangleEdges 24).2.2 j = if j = 24 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_25 : ∀ j : Fin 270, - h1Coeff (triangleEdges 25).1 j - h1Coeff (triangleEdges 25).2.1 j + - h1Coeff (triangleEdges 25).2.2 j = if j = 25 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_26 : ∀ j : Fin 270, - h1Coeff (triangleEdges 26).1 j - h1Coeff (triangleEdges 26).2.1 j + - h1Coeff (triangleEdges 26).2.2 j = if j = 26 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_27 : ∀ j : Fin 270, - h1Coeff (triangleEdges 27).1 j - h1Coeff (triangleEdges 27).2.1 j + - h1Coeff (triangleEdges 27).2.2 j = if j = 27 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_28 : ∀ j : Fin 270, - h1Coeff (triangleEdges 28).1 j - h1Coeff (triangleEdges 28).2.1 j + - h1Coeff (triangleEdges 28).2.2 j = if j = 28 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_29 : ∀ j : Fin 270, - h1Coeff (triangleEdges 29).1 j - h1Coeff (triangleEdges 29).2.1 j + - h1Coeff (triangleEdges 29).2.2 j = if j = 29 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_30 : ∀ j : Fin 270, - h1Coeff (triangleEdges 30).1 j - h1Coeff (triangleEdges 30).2.1 j + - h1Coeff (triangleEdges 30).2.2 j = if j = 30 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_31 : ∀ j : Fin 270, - h1Coeff (triangleEdges 31).1 j - h1Coeff (triangleEdges 31).2.1 j + - h1Coeff (triangleEdges 31).2.2 j = if j = 31 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_32 : ∀ j : Fin 270, - h1Coeff (triangleEdges 32).1 j - h1Coeff (triangleEdges 32).2.1 j + - h1Coeff (triangleEdges 32).2.2 j = if j = 32 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_33 : ∀ j : Fin 270, - h1Coeff (triangleEdges 33).1 j - h1Coeff (triangleEdges 33).2.1 j + - h1Coeff (triangleEdges 33).2.2 j = if j = 33 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_34 : ∀ j : Fin 270, - h1Coeff (triangleEdges 34).1 j - h1Coeff (triangleEdges 34).2.1 j + - h1Coeff (triangleEdges 34).2.2 j = if j = 34 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_35 : ∀ j : Fin 270, - h1Coeff (triangleEdges 35).1 j - h1Coeff (triangleEdges 35).2.1 j + - h1Coeff (triangleEdges 35).2.2 j = if j = 35 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_36 : ∀ j : Fin 270, - h1Coeff (triangleEdges 36).1 j - h1Coeff (triangleEdges 36).2.1 j + - h1Coeff (triangleEdges 36).2.2 j = if j = 36 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_37 : ∀ j : Fin 270, - h1Coeff (triangleEdges 37).1 j - h1Coeff (triangleEdges 37).2.1 j + - h1Coeff (triangleEdges 37).2.2 j = if j = 37 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_38 : ∀ j : Fin 270, - h1Coeff (triangleEdges 38).1 j - h1Coeff (triangleEdges 38).2.1 j + - h1Coeff (triangleEdges 38).2.2 j = if j = 38 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_39 : ∀ j : Fin 270, - h1Coeff (triangleEdges 39).1 j - h1Coeff (triangleEdges 39).2.1 j + - h1Coeff (triangleEdges 39).2.2 j = if j = 39 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_40 : ∀ j : Fin 270, - h1Coeff (triangleEdges 40).1 j - h1Coeff (triangleEdges 40).2.1 j + - h1Coeff (triangleEdges 40).2.2 j = if j = 40 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_41 : ∀ j : Fin 270, - h1Coeff (triangleEdges 41).1 j - h1Coeff (triangleEdges 41).2.1 j + - h1Coeff (triangleEdges 41).2.2 j = if j = 41 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_42 : ∀ j : Fin 270, - h1Coeff (triangleEdges 42).1 j - h1Coeff (triangleEdges 42).2.1 j + - h1Coeff (triangleEdges 42).2.2 j = if j = 42 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_43 : ∀ j : Fin 270, - h1Coeff (triangleEdges 43).1 j - h1Coeff (triangleEdges 43).2.1 j + - h1Coeff (triangleEdges 43).2.2 j = if j = 43 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_44 : ∀ j : Fin 270, - h1Coeff (triangleEdges 44).1 j - h1Coeff (triangleEdges 44).2.1 j + - h1Coeff (triangleEdges 44).2.2 j = if j = 44 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_45 : ∀ j : Fin 270, - h1Coeff (triangleEdges 45).1 j - h1Coeff (triangleEdges 45).2.1 j + - h1Coeff (triangleEdges 45).2.2 j = if j = 45 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_46 : ∀ j : Fin 270, - h1Coeff (triangleEdges 46).1 j - h1Coeff (triangleEdges 46).2.1 j + - h1Coeff (triangleEdges 46).2.2 j = if j = 46 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_47 : ∀ j : Fin 270, - h1Coeff (triangleEdges 47).1 j - h1Coeff (triangleEdges 47).2.1 j + - h1Coeff (triangleEdges 47).2.2 j = if j = 47 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_48 : ∀ j : Fin 270, - h1Coeff (triangleEdges 48).1 j - h1Coeff (triangleEdges 48).2.1 j + - h1Coeff (triangleEdges 48).2.2 j = if j = 48 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_49 : ∀ j : Fin 270, - h1Coeff (triangleEdges 49).1 j - h1Coeff (triangleEdges 49).2.1 j + - h1Coeff (triangleEdges 49).2.2 j = if j = 49 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_50 : ∀ j : Fin 270, - h1Coeff (triangleEdges 50).1 j - h1Coeff (triangleEdges 50).2.1 j + - h1Coeff (triangleEdges 50).2.2 j = if j = 50 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_51 : ∀ j : Fin 270, - h1Coeff (triangleEdges 51).1 j - h1Coeff (triangleEdges 51).2.1 j + - h1Coeff (triangleEdges 51).2.2 j = if j = 51 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_52 : ∀ j : Fin 270, - h1Coeff (triangleEdges 52).1 j - h1Coeff (triangleEdges 52).2.1 j + - h1Coeff (triangleEdges 52).2.2 j = if j = 52 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_53 : ∀ j : Fin 270, - h1Coeff (triangleEdges 53).1 j - h1Coeff (triangleEdges 53).2.1 j + - h1Coeff (triangleEdges 53).2.2 j = if j = 53 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_54 : ∀ j : Fin 270, - h1Coeff (triangleEdges 54).1 j - h1Coeff (triangleEdges 54).2.1 j + - h1Coeff (triangleEdges 54).2.2 j = if j = 54 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_55 : ∀ j : Fin 270, - h1Coeff (triangleEdges 55).1 j - h1Coeff (triangleEdges 55).2.1 j + - h1Coeff (triangleEdges 55).2.2 j = if j = 55 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_56 : ∀ j : Fin 270, - h1Coeff (triangleEdges 56).1 j - h1Coeff (triangleEdges 56).2.1 j + - h1Coeff (triangleEdges 56).2.2 j = if j = 56 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_57 : ∀ j : Fin 270, - h1Coeff (triangleEdges 57).1 j - h1Coeff (triangleEdges 57).2.1 j + - h1Coeff (triangleEdges 57).2.2 j = if j = 57 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_58 : ∀ j : Fin 270, - h1Coeff (triangleEdges 58).1 j - h1Coeff (triangleEdges 58).2.1 j + - h1Coeff (triangleEdges 58).2.2 j = if j = 58 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_59 : ∀ j : Fin 270, - h1Coeff (triangleEdges 59).1 j - h1Coeff (triangleEdges 59).2.1 j + - h1Coeff (triangleEdges 59).2.2 j = if j = 59 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_60 : ∀ j : Fin 270, - h1Coeff (triangleEdges 60).1 j - h1Coeff (triangleEdges 60).2.1 j + - h1Coeff (triangleEdges 60).2.2 j = if j = 60 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_61 : ∀ j : Fin 270, - h1Coeff (triangleEdges 61).1 j - h1Coeff (triangleEdges 61).2.1 j + - h1Coeff (triangleEdges 61).2.2 j = if j = 61 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_62 : ∀ j : Fin 270, - h1Coeff (triangleEdges 62).1 j - h1Coeff (triangleEdges 62).2.1 j + - h1Coeff (triangleEdges 62).2.2 j = if j = 62 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_63 : ∀ j : Fin 270, - h1Coeff (triangleEdges 63).1 j - h1Coeff (triangleEdges 63).2.1 j + - h1Coeff (triangleEdges 63).2.2 j = if j = 63 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_64 : ∀ j : Fin 270, - h1Coeff (triangleEdges 64).1 j - h1Coeff (triangleEdges 64).2.1 j + - h1Coeff (triangleEdges 64).2.2 j = if j = 64 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_65 : ∀ j : Fin 270, - h1Coeff (triangleEdges 65).1 j - h1Coeff (triangleEdges 65).2.1 j + - h1Coeff (triangleEdges 65).2.2 j = if j = 65 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_66 : ∀ j : Fin 270, - h1Coeff (triangleEdges 66).1 j - h1Coeff (triangleEdges 66).2.1 j + - h1Coeff (triangleEdges 66).2.2 j = if j = 66 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_67 : ∀ j : Fin 270, - h1Coeff (triangleEdges 67).1 j - h1Coeff (triangleEdges 67).2.1 j + - h1Coeff (triangleEdges 67).2.2 j = if j = 67 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_68 : ∀ j : Fin 270, - h1Coeff (triangleEdges 68).1 j - h1Coeff (triangleEdges 68).2.1 j + - h1Coeff (triangleEdges 68).2.2 j = if j = 68 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_69 : ∀ j : Fin 270, - h1Coeff (triangleEdges 69).1 j - h1Coeff (triangleEdges 69).2.1 j + - h1Coeff (triangleEdges 69).2.2 j = if j = 69 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_70 : ∀ j : Fin 270, - h1Coeff (triangleEdges 70).1 j - h1Coeff (triangleEdges 70).2.1 j + - h1Coeff (triangleEdges 70).2.2 j = if j = 70 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_71 : ∀ j : Fin 270, - h1Coeff (triangleEdges 71).1 j - h1Coeff (triangleEdges 71).2.1 j + - h1Coeff (triangleEdges 71).2.2 j = if j = 71 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_72 : ∀ j : Fin 270, - h1Coeff (triangleEdges 72).1 j - h1Coeff (triangleEdges 72).2.1 j + - h1Coeff (triangleEdges 72).2.2 j = if j = 72 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_73 : ∀ j : Fin 270, - h1Coeff (triangleEdges 73).1 j - h1Coeff (triangleEdges 73).2.1 j + - h1Coeff (triangleEdges 73).2.2 j = if j = 73 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_74 : ∀ j : Fin 270, - h1Coeff (triangleEdges 74).1 j - h1Coeff (triangleEdges 74).2.1 j + - h1Coeff (triangleEdges 74).2.2 j = if j = 74 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_75 : ∀ j : Fin 270, - h1Coeff (triangleEdges 75).1 j - h1Coeff (triangleEdges 75).2.1 j + - h1Coeff (triangleEdges 75).2.2 j = if j = 75 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_76 : ∀ j : Fin 270, - h1Coeff (triangleEdges 76).1 j - h1Coeff (triangleEdges 76).2.1 j + - h1Coeff (triangleEdges 76).2.2 j = if j = 76 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_77 : ∀ j : Fin 270, - h1Coeff (triangleEdges 77).1 j - h1Coeff (triangleEdges 77).2.1 j + - h1Coeff (triangleEdges 77).2.2 j = if j = 77 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_78 : ∀ j : Fin 270, - h1Coeff (triangleEdges 78).1 j - h1Coeff (triangleEdges 78).2.1 j + - h1Coeff (triangleEdges 78).2.2 j = if j = 78 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_79 : ∀ j : Fin 270, - h1Coeff (triangleEdges 79).1 j - h1Coeff (triangleEdges 79).2.1 j + - h1Coeff (triangleEdges 79).2.2 j = if j = 79 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_80 : ∀ j : Fin 270, - h1Coeff (triangleEdges 80).1 j - h1Coeff (triangleEdges 80).2.1 j + - h1Coeff (triangleEdges 80).2.2 j = if j = 80 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_81 : ∀ j : Fin 270, - h1Coeff (triangleEdges 81).1 j - h1Coeff (triangleEdges 81).2.1 j + - h1Coeff (triangleEdges 81).2.2 j = if j = 81 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_82 : ∀ j : Fin 270, - h1Coeff (triangleEdges 82).1 j - h1Coeff (triangleEdges 82).2.1 j + - h1Coeff (triangleEdges 82).2.2 j = if j = 82 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_83 : ∀ j : Fin 270, - h1Coeff (triangleEdges 83).1 j - h1Coeff (triangleEdges 83).2.1 j + - h1Coeff (triangleEdges 83).2.2 j = if j = 83 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_84 : ∀ j : Fin 270, - h1Coeff (triangleEdges 84).1 j - h1Coeff (triangleEdges 84).2.1 j + - h1Coeff (triangleEdges 84).2.2 j = if j = 84 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_85 : ∀ j : Fin 270, - h1Coeff (triangleEdges 85).1 j - h1Coeff (triangleEdges 85).2.1 j + - h1Coeff (triangleEdges 85).2.2 j = if j = 85 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_86 : ∀ j : Fin 270, - h1Coeff (triangleEdges 86).1 j - h1Coeff (triangleEdges 86).2.1 j + - h1Coeff (triangleEdges 86).2.2 j = if j = 86 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_87 : ∀ j : Fin 270, - h1Coeff (triangleEdges 87).1 j - h1Coeff (triangleEdges 87).2.1 j + - h1Coeff (triangleEdges 87).2.2 j = if j = 87 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_88 : ∀ j : Fin 270, - h1Coeff (triangleEdges 88).1 j - h1Coeff (triangleEdges 88).2.1 j + - h1Coeff (triangleEdges 88).2.2 j = if j = 88 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_89 : ∀ j : Fin 270, - h1Coeff (triangleEdges 89).1 j - h1Coeff (triangleEdges 89).2.1 j + - h1Coeff (triangleEdges 89).2.2 j = if j = 89 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_90 : ∀ j : Fin 270, - h1Coeff (triangleEdges 90).1 j - h1Coeff (triangleEdges 90).2.1 j + - h1Coeff (triangleEdges 90).2.2 j = if j = 90 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_91 : ∀ j : Fin 270, - h1Coeff (triangleEdges 91).1 j - h1Coeff (triangleEdges 91).2.1 j + - h1Coeff (triangleEdges 91).2.2 j = if j = 91 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_92 : ∀ j : Fin 270, - h1Coeff (triangleEdges 92).1 j - h1Coeff (triangleEdges 92).2.1 j + - h1Coeff (triangleEdges 92).2.2 j = if j = 92 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_93 : ∀ j : Fin 270, - h1Coeff (triangleEdges 93).1 j - h1Coeff (triangleEdges 93).2.1 j + - h1Coeff (triangleEdges 93).2.2 j = if j = 93 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_94 : ∀ j : Fin 270, - h1Coeff (triangleEdges 94).1 j - h1Coeff (triangleEdges 94).2.1 j + - h1Coeff (triangleEdges 94).2.2 j = if j = 94 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_95 : ∀ j : Fin 270, - h1Coeff (triangleEdges 95).1 j - h1Coeff (triangleEdges 95).2.1 j + - h1Coeff (triangleEdges 95).2.2 j = if j = 95 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_96 : ∀ j : Fin 270, - h1Coeff (triangleEdges 96).1 j - h1Coeff (triangleEdges 96).2.1 j + - h1Coeff (triangleEdges 96).2.2 j = if j = 96 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_97 : ∀ j : Fin 270, - h1Coeff (triangleEdges 97).1 j - h1Coeff (triangleEdges 97).2.1 j + - h1Coeff (triangleEdges 97).2.2 j = if j = 97 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_98 : ∀ j : Fin 270, - h1Coeff (triangleEdges 98).1 j - h1Coeff (triangleEdges 98).2.1 j + - h1Coeff (triangleEdges 98).2.2 j = if j = 98 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_99 : ∀ j : Fin 270, - h1Coeff (triangleEdges 99).1 j - h1Coeff (triangleEdges 99).2.1 j + - h1Coeff (triangleEdges 99).2.2 j = if j = 99 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_100 : ∀ j : Fin 270, - h1Coeff (triangleEdges 100).1 j - h1Coeff (triangleEdges 100).2.1 j + - h1Coeff (triangleEdges 100).2.2 j = if j = 100 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_101 : ∀ j : Fin 270, - h1Coeff (triangleEdges 101).1 j - h1Coeff (triangleEdges 101).2.1 j + - h1Coeff (triangleEdges 101).2.2 j = if j = 101 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_102 : ∀ j : Fin 270, - h1Coeff (triangleEdges 102).1 j - h1Coeff (triangleEdges 102).2.1 j + - h1Coeff (triangleEdges 102).2.2 j = if j = 102 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_103 : ∀ j : Fin 270, - h1Coeff (triangleEdges 103).1 j - h1Coeff (triangleEdges 103).2.1 j + - h1Coeff (triangleEdges 103).2.2 j = if j = 103 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_104 : ∀ j : Fin 270, - h1Coeff (triangleEdges 104).1 j - h1Coeff (triangleEdges 104).2.1 j + - h1Coeff (triangleEdges 104).2.2 j = if j = 104 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_105 : ∀ j : Fin 270, - h1Coeff (triangleEdges 105).1 j - h1Coeff (triangleEdges 105).2.1 j + - h1Coeff (triangleEdges 105).2.2 j = if j = 105 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_106 : ∀ j : Fin 270, - h1Coeff (triangleEdges 106).1 j - h1Coeff (triangleEdges 106).2.1 j + - h1Coeff (triangleEdges 106).2.2 j = if j = 106 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_107 : ∀ j : Fin 270, - h1Coeff (triangleEdges 107).1 j - h1Coeff (triangleEdges 107).2.1 j + - h1Coeff (triangleEdges 107).2.2 j = if j = 107 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_108 : ∀ j : Fin 270, - h1Coeff (triangleEdges 108).1 j - h1Coeff (triangleEdges 108).2.1 j + - h1Coeff (triangleEdges 108).2.2 j = if j = 108 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_109 : ∀ j : Fin 270, - h1Coeff (triangleEdges 109).1 j - h1Coeff (triangleEdges 109).2.1 j + - h1Coeff (triangleEdges 109).2.2 j = if j = 109 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_110 : ∀ j : Fin 270, - h1Coeff (triangleEdges 110).1 j - h1Coeff (triangleEdges 110).2.1 j + - h1Coeff (triangleEdges 110).2.2 j = if j = 110 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_111 : ∀ j : Fin 270, - h1Coeff (triangleEdges 111).1 j - h1Coeff (triangleEdges 111).2.1 j + - h1Coeff (triangleEdges 111).2.2 j = if j = 111 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_112 : ∀ j : Fin 270, - h1Coeff (triangleEdges 112).1 j - h1Coeff (triangleEdges 112).2.1 j + - h1Coeff (triangleEdges 112).2.2 j = if j = 112 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_113 : ∀ j : Fin 270, - h1Coeff (triangleEdges 113).1 j - h1Coeff (triangleEdges 113).2.1 j + - h1Coeff (triangleEdges 113).2.2 j = if j = 113 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_114 : ∀ j : Fin 270, - h1Coeff (triangleEdges 114).1 j - h1Coeff (triangleEdges 114).2.1 j + - h1Coeff (triangleEdges 114).2.2 j = if j = 114 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_115 : ∀ j : Fin 270, - h1Coeff (triangleEdges 115).1 j - h1Coeff (triangleEdges 115).2.1 j + - h1Coeff (triangleEdges 115).2.2 j = if j = 115 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_116 : ∀ j : Fin 270, - h1Coeff (triangleEdges 116).1 j - h1Coeff (triangleEdges 116).2.1 j + - h1Coeff (triangleEdges 116).2.2 j = if j = 116 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_117 : ∀ j : Fin 270, - h1Coeff (triangleEdges 117).1 j - h1Coeff (triangleEdges 117).2.1 j + - h1Coeff (triangleEdges 117).2.2 j = if j = 117 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_118 : ∀ j : Fin 270, - h1Coeff (triangleEdges 118).1 j - h1Coeff (triangleEdges 118).2.1 j + - h1Coeff (triangleEdges 118).2.2 j = if j = 118 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_119 : ∀ j : Fin 270, - h1Coeff (triangleEdges 119).1 j - h1Coeff (triangleEdges 119).2.1 j + - h1Coeff (triangleEdges 119).2.2 j = if j = 119 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_120 : ∀ j : Fin 270, - h1Coeff (triangleEdges 120).1 j - h1Coeff (triangleEdges 120).2.1 j + - h1Coeff (triangleEdges 120).2.2 j = if j = 120 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_121 : ∀ j : Fin 270, - h1Coeff (triangleEdges 121).1 j - h1Coeff (triangleEdges 121).2.1 j + - h1Coeff (triangleEdges 121).2.2 j = if j = 121 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_122 : ∀ j : Fin 270, - h1Coeff (triangleEdges 122).1 j - h1Coeff (triangleEdges 122).2.1 j + - h1Coeff (triangleEdges 122).2.2 j = if j = 122 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_123 : ∀ j : Fin 270, - h1Coeff (triangleEdges 123).1 j - h1Coeff (triangleEdges 123).2.1 j + - h1Coeff (triangleEdges 123).2.2 j = if j = 123 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_124 : ∀ j : Fin 270, - h1Coeff (triangleEdges 124).1 j - h1Coeff (triangleEdges 124).2.1 j + - h1Coeff (triangleEdges 124).2.2 j = if j = 124 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_125 : ∀ j : Fin 270, - h1Coeff (triangleEdges 125).1 j - h1Coeff (triangleEdges 125).2.1 j + - h1Coeff (triangleEdges 125).2.2 j = if j = 125 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_126 : ∀ j : Fin 270, - h1Coeff (triangleEdges 126).1 j - h1Coeff (triangleEdges 126).2.1 j + - h1Coeff (triangleEdges 126).2.2 j = if j = 126 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_127 : ∀ j : Fin 270, - h1Coeff (triangleEdges 127).1 j - h1Coeff (triangleEdges 127).2.1 j + - h1Coeff (triangleEdges 127).2.2 j = if j = 127 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_128 : ∀ j : Fin 270, - h1Coeff (triangleEdges 128).1 j - h1Coeff (triangleEdges 128).2.1 j + - h1Coeff (triangleEdges 128).2.2 j = if j = 128 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_129 : ∀ j : Fin 270, - h1Coeff (triangleEdges 129).1 j - h1Coeff (triangleEdges 129).2.1 j + - h1Coeff (triangleEdges 129).2.2 j = if j = 129 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_130 : ∀ j : Fin 270, - h1Coeff (triangleEdges 130).1 j - h1Coeff (triangleEdges 130).2.1 j + - h1Coeff (triangleEdges 130).2.2 j = if j = 130 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_131 : ∀ j : Fin 270, - h1Coeff (triangleEdges 131).1 j - h1Coeff (triangleEdges 131).2.1 j + - h1Coeff (triangleEdges 131).2.2 j = if j = 131 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_132 : ∀ j : Fin 270, - h1Coeff (triangleEdges 132).1 j - h1Coeff (triangleEdges 132).2.1 j + - h1Coeff (triangleEdges 132).2.2 j = if j = 132 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_133 : ∀ j : Fin 270, - h1Coeff (triangleEdges 133).1 j - h1Coeff (triangleEdges 133).2.1 j + - h1Coeff (triangleEdges 133).2.2 j = if j = 133 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_134 : ∀ j : Fin 270, - h1Coeff (triangleEdges 134).1 j - h1Coeff (triangleEdges 134).2.1 j + - h1Coeff (triangleEdges 134).2.2 j = if j = 134 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_135 : ∀ j : Fin 270, - h1Coeff (triangleEdges 135).1 j - h1Coeff (triangleEdges 135).2.1 j + - h1Coeff (triangleEdges 135).2.2 j = if j = 135 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_136 : ∀ j : Fin 270, - h1Coeff (triangleEdges 136).1 j - h1Coeff (triangleEdges 136).2.1 j + - h1Coeff (triangleEdges 136).2.2 j = if j = 136 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_137 : ∀ j : Fin 270, - h1Coeff (triangleEdges 137).1 j - h1Coeff (triangleEdges 137).2.1 j + - h1Coeff (triangleEdges 137).2.2 j = if j = 137 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_138 : ∀ j : Fin 270, - h1Coeff (triangleEdges 138).1 j - h1Coeff (triangleEdges 138).2.1 j + - h1Coeff (triangleEdges 138).2.2 j = if j = 138 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_139 : ∀ j : Fin 270, - h1Coeff (triangleEdges 139).1 j - h1Coeff (triangleEdges 139).2.1 j + - h1Coeff (triangleEdges 139).2.2 j = if j = 139 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_140 : ∀ j : Fin 270, - h1Coeff (triangleEdges 140).1 j - h1Coeff (triangleEdges 140).2.1 j + - h1Coeff (triangleEdges 140).2.2 j = if j = 140 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_141 : ∀ j : Fin 270, - h1Coeff (triangleEdges 141).1 j - h1Coeff (triangleEdges 141).2.1 j + - h1Coeff (triangleEdges 141).2.2 j = if j = 141 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_142 : ∀ j : Fin 270, - h1Coeff (triangleEdges 142).1 j - h1Coeff (triangleEdges 142).2.1 j + - h1Coeff (triangleEdges 142).2.2 j = if j = 142 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_143 : ∀ j : Fin 270, - h1Coeff (triangleEdges 143).1 j - h1Coeff (triangleEdges 143).2.1 j + - h1Coeff (triangleEdges 143).2.2 j = if j = 143 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_144 : ∀ j : Fin 270, - h1Coeff (triangleEdges 144).1 j - h1Coeff (triangleEdges 144).2.1 j + - h1Coeff (triangleEdges 144).2.2 j = if j = 144 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_145 : ∀ j : Fin 270, - h1Coeff (triangleEdges 145).1 j - h1Coeff (triangleEdges 145).2.1 j + - h1Coeff (triangleEdges 145).2.2 j = if j = 145 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_146 : ∀ j : Fin 270, - h1Coeff (triangleEdges 146).1 j - h1Coeff (triangleEdges 146).2.1 j + - h1Coeff (triangleEdges 146).2.2 j = if j = 146 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_147 : ∀ j : Fin 270, - h1Coeff (triangleEdges 147).1 j - h1Coeff (triangleEdges 147).2.1 j + - h1Coeff (triangleEdges 147).2.2 j = if j = 147 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_148 : ∀ j : Fin 270, - h1Coeff (triangleEdges 148).1 j - h1Coeff (triangleEdges 148).2.1 j + - h1Coeff (triangleEdges 148).2.2 j = if j = 148 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_149 : ∀ j : Fin 270, - h1Coeff (triangleEdges 149).1 j - h1Coeff (triangleEdges 149).2.1 j + - h1Coeff (triangleEdges 149).2.2 j = if j = 149 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_150 : ∀ j : Fin 270, - h1Coeff (triangleEdges 150).1 j - h1Coeff (triangleEdges 150).2.1 j + - h1Coeff (triangleEdges 150).2.2 j = if j = 150 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_151 : ∀ j : Fin 270, - h1Coeff (triangleEdges 151).1 j - h1Coeff (triangleEdges 151).2.1 j + - h1Coeff (triangleEdges 151).2.2 j = if j = 151 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_152 : ∀ j : Fin 270, - h1Coeff (triangleEdges 152).1 j - h1Coeff (triangleEdges 152).2.1 j + - h1Coeff (triangleEdges 152).2.2 j = if j = 152 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_153 : ∀ j : Fin 270, - h1Coeff (triangleEdges 153).1 j - h1Coeff (triangleEdges 153).2.1 j + - h1Coeff (triangleEdges 153).2.2 j = if j = 153 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_154 : ∀ j : Fin 270, - h1Coeff (triangleEdges 154).1 j - h1Coeff (triangleEdges 154).2.1 j + - h1Coeff (triangleEdges 154).2.2 j = if j = 154 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_155 : ∀ j : Fin 270, - h1Coeff (triangleEdges 155).1 j - h1Coeff (triangleEdges 155).2.1 j + - h1Coeff (triangleEdges 155).2.2 j = if j = 155 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_156 : ∀ j : Fin 270, - h1Coeff (triangleEdges 156).1 j - h1Coeff (triangleEdges 156).2.1 j + - h1Coeff (triangleEdges 156).2.2 j = if j = 156 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_157 : ∀ j : Fin 270, - h1Coeff (triangleEdges 157).1 j - h1Coeff (triangleEdges 157).2.1 j + - h1Coeff (triangleEdges 157).2.2 j = if j = 157 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_158 : ∀ j : Fin 270, - h1Coeff (triangleEdges 158).1 j - h1Coeff (triangleEdges 158).2.1 j + - h1Coeff (triangleEdges 158).2.2 j = if j = 158 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_159 : ∀ j : Fin 270, - h1Coeff (triangleEdges 159).1 j - h1Coeff (triangleEdges 159).2.1 j + - h1Coeff (triangleEdges 159).2.2 j = if j = 159 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_160 : ∀ j : Fin 270, - h1Coeff (triangleEdges 160).1 j - h1Coeff (triangleEdges 160).2.1 j + - h1Coeff (triangleEdges 160).2.2 j = if j = 160 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_161 : ∀ j : Fin 270, - h1Coeff (triangleEdges 161).1 j - h1Coeff (triangleEdges 161).2.1 j + - h1Coeff (triangleEdges 161).2.2 j = if j = 161 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_162 : ∀ j : Fin 270, - h1Coeff (triangleEdges 162).1 j - h1Coeff (triangleEdges 162).2.1 j + - h1Coeff (triangleEdges 162).2.2 j = if j = 162 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_163 : ∀ j : Fin 270, - h1Coeff (triangleEdges 163).1 j - h1Coeff (triangleEdges 163).2.1 j + - h1Coeff (triangleEdges 163).2.2 j = if j = 163 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_164 : ∀ j : Fin 270, - h1Coeff (triangleEdges 164).1 j - h1Coeff (triangleEdges 164).2.1 j + - h1Coeff (triangleEdges 164).2.2 j = if j = 164 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_165 : ∀ j : Fin 270, - h1Coeff (triangleEdges 165).1 j - h1Coeff (triangleEdges 165).2.1 j + - h1Coeff (triangleEdges 165).2.2 j = if j = 165 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_166 : ∀ j : Fin 270, - h1Coeff (triangleEdges 166).1 j - h1Coeff (triangleEdges 166).2.1 j + - h1Coeff (triangleEdges 166).2.2 j = if j = 166 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_167 : ∀ j : Fin 270, - h1Coeff (triangleEdges 167).1 j - h1Coeff (triangleEdges 167).2.1 j + - h1Coeff (triangleEdges 167).2.2 j = if j = 167 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_168 : ∀ j : Fin 270, - h1Coeff (triangleEdges 168).1 j - h1Coeff (triangleEdges 168).2.1 j + - h1Coeff (triangleEdges 168).2.2 j = if j = 168 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_169 : ∀ j : Fin 270, - h1Coeff (triangleEdges 169).1 j - h1Coeff (triangleEdges 169).2.1 j + - h1Coeff (triangleEdges 169).2.2 j = if j = 169 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_170 : ∀ j : Fin 270, - h1Coeff (triangleEdges 170).1 j - h1Coeff (triangleEdges 170).2.1 j + - h1Coeff (triangleEdges 170).2.2 j = if j = 170 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_171 : ∀ j : Fin 270, - h1Coeff (triangleEdges 171).1 j - h1Coeff (triangleEdges 171).2.1 j + - h1Coeff (triangleEdges 171).2.2 j = if j = 171 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_172 : ∀ j : Fin 270, - h1Coeff (triangleEdges 172).1 j - h1Coeff (triangleEdges 172).2.1 j + - h1Coeff (triangleEdges 172).2.2 j = if j = 172 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_173 : ∀ j : Fin 270, - h1Coeff (triangleEdges 173).1 j - h1Coeff (triangleEdges 173).2.1 j + - h1Coeff (triangleEdges 173).2.2 j = if j = 173 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_174 : ∀ j : Fin 270, - h1Coeff (triangleEdges 174).1 j - h1Coeff (triangleEdges 174).2.1 j + - h1Coeff (triangleEdges 174).2.2 j = if j = 174 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_175 : ∀ j : Fin 270, - h1Coeff (triangleEdges 175).1 j - h1Coeff (triangleEdges 175).2.1 j + - h1Coeff (triangleEdges 175).2.2 j = if j = 175 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_176 : ∀ j : Fin 270, - h1Coeff (triangleEdges 176).1 j - h1Coeff (triangleEdges 176).2.1 j + - h1Coeff (triangleEdges 176).2.2 j = if j = 176 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_177 : ∀ j : Fin 270, - h1Coeff (triangleEdges 177).1 j - h1Coeff (triangleEdges 177).2.1 j + - h1Coeff (triangleEdges 177).2.2 j = if j = 177 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_178 : ∀ j : Fin 270, - h1Coeff (triangleEdges 178).1 j - h1Coeff (triangleEdges 178).2.1 j + - h1Coeff (triangleEdges 178).2.2 j = if j = 178 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_179 : ∀ j : Fin 270, - h1Coeff (triangleEdges 179).1 j - h1Coeff (triangleEdges 179).2.1 j + - h1Coeff (triangleEdges 179).2.2 j = if j = 179 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_180 : ∀ j : Fin 270, - h1Coeff (triangleEdges 180).1 j - h1Coeff (triangleEdges 180).2.1 j + - h1Coeff (triangleEdges 180).2.2 j = if j = 180 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_181 : ∀ j : Fin 270, - h1Coeff (triangleEdges 181).1 j - h1Coeff (triangleEdges 181).2.1 j + - h1Coeff (triangleEdges 181).2.2 j = if j = 181 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_182 : ∀ j : Fin 270, - h1Coeff (triangleEdges 182).1 j - h1Coeff (triangleEdges 182).2.1 j + - h1Coeff (triangleEdges 182).2.2 j = if j = 182 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_183 : ∀ j : Fin 270, - h1Coeff (triangleEdges 183).1 j - h1Coeff (triangleEdges 183).2.1 j + - h1Coeff (triangleEdges 183).2.2 j = if j = 183 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_184 : ∀ j : Fin 270, - h1Coeff (triangleEdges 184).1 j - h1Coeff (triangleEdges 184).2.1 j + - h1Coeff (triangleEdges 184).2.2 j = if j = 184 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_185 : ∀ j : Fin 270, - h1Coeff (triangleEdges 185).1 j - h1Coeff (triangleEdges 185).2.1 j + - h1Coeff (triangleEdges 185).2.2 j = if j = 185 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_186 : ∀ j : Fin 270, - h1Coeff (triangleEdges 186).1 j - h1Coeff (triangleEdges 186).2.1 j + - h1Coeff (triangleEdges 186).2.2 j = if j = 186 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_187 : ∀ j : Fin 270, - h1Coeff (triangleEdges 187).1 j - h1Coeff (triangleEdges 187).2.1 j + - h1Coeff (triangleEdges 187).2.2 j = if j = 187 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_188 : ∀ j : Fin 270, - h1Coeff (triangleEdges 188).1 j - h1Coeff (triangleEdges 188).2.1 j + - h1Coeff (triangleEdges 188).2.2 j = if j = 188 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_189 : ∀ j : Fin 270, - h1Coeff (triangleEdges 189).1 j - h1Coeff (triangleEdges 189).2.1 j + - h1Coeff (triangleEdges 189).2.2 j = if j = 189 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_190 : ∀ j : Fin 270, - h1Coeff (triangleEdges 190).1 j - h1Coeff (triangleEdges 190).2.1 j + - h1Coeff (triangleEdges 190).2.2 j = if j = 190 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_191 : ∀ j : Fin 270, - h1Coeff (triangleEdges 191).1 j - h1Coeff (triangleEdges 191).2.1 j + - h1Coeff (triangleEdges 191).2.2 j = if j = 191 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_192 : ∀ j : Fin 270, - h1Coeff (triangleEdges 192).1 j - h1Coeff (triangleEdges 192).2.1 j + - h1Coeff (triangleEdges 192).2.2 j = if j = 192 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_193 : ∀ j : Fin 270, - h1Coeff (triangleEdges 193).1 j - h1Coeff (triangleEdges 193).2.1 j + - h1Coeff (triangleEdges 193).2.2 j = if j = 193 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_194 : ∀ j : Fin 270, - h1Coeff (triangleEdges 194).1 j - h1Coeff (triangleEdges 194).2.1 j + - h1Coeff (triangleEdges 194).2.2 j = if j = 194 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_195 : ∀ j : Fin 270, - h1Coeff (triangleEdges 195).1 j - h1Coeff (triangleEdges 195).2.1 j + - h1Coeff (triangleEdges 195).2.2 j = if j = 195 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_196 : ∀ j : Fin 270, - h1Coeff (triangleEdges 196).1 j - h1Coeff (triangleEdges 196).2.1 j + - h1Coeff (triangleEdges 196).2.2 j = if j = 196 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_197 : ∀ j : Fin 270, - h1Coeff (triangleEdges 197).1 j - h1Coeff (triangleEdges 197).2.1 j + - h1Coeff (triangleEdges 197).2.2 j = if j = 197 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_198 : ∀ j : Fin 270, - h1Coeff (triangleEdges 198).1 j - h1Coeff (triangleEdges 198).2.1 j + - h1Coeff (triangleEdges 198).2.2 j = if j = 198 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_199 : ∀ j : Fin 270, - h1Coeff (triangleEdges 199).1 j - h1Coeff (triangleEdges 199).2.1 j + - h1Coeff (triangleEdges 199).2.2 j = if j = 199 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_200 : ∀ j : Fin 270, - h1Coeff (triangleEdges 200).1 j - h1Coeff (triangleEdges 200).2.1 j + - h1Coeff (triangleEdges 200).2.2 j = if j = 200 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_201 : ∀ j : Fin 270, - h1Coeff (triangleEdges 201).1 j - h1Coeff (triangleEdges 201).2.1 j + - h1Coeff (triangleEdges 201).2.2 j = if j = 201 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_202 : ∀ j : Fin 270, - h1Coeff (triangleEdges 202).1 j - h1Coeff (triangleEdges 202).2.1 j + - h1Coeff (triangleEdges 202).2.2 j = if j = 202 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_203 : ∀ j : Fin 270, - h1Coeff (triangleEdges 203).1 j - h1Coeff (triangleEdges 203).2.1 j + - h1Coeff (triangleEdges 203).2.2 j = if j = 203 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_204 : ∀ j : Fin 270, - h1Coeff (triangleEdges 204).1 j - h1Coeff (triangleEdges 204).2.1 j + - h1Coeff (triangleEdges 204).2.2 j = if j = 204 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_205 : ∀ j : Fin 270, - h1Coeff (triangleEdges 205).1 j - h1Coeff (triangleEdges 205).2.1 j + - h1Coeff (triangleEdges 205).2.2 j = if j = 205 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_206 : ∀ j : Fin 270, - h1Coeff (triangleEdges 206).1 j - h1Coeff (triangleEdges 206).2.1 j + - h1Coeff (triangleEdges 206).2.2 j = if j = 206 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_207 : ∀ j : Fin 270, - h1Coeff (triangleEdges 207).1 j - h1Coeff (triangleEdges 207).2.1 j + - h1Coeff (triangleEdges 207).2.2 j = if j = 207 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_208 : ∀ j : Fin 270, - h1Coeff (triangleEdges 208).1 j - h1Coeff (triangleEdges 208).2.1 j + - h1Coeff (triangleEdges 208).2.2 j = if j = 208 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_209 : ∀ j : Fin 270, - h1Coeff (triangleEdges 209).1 j - h1Coeff (triangleEdges 209).2.1 j + - h1Coeff (triangleEdges 209).2.2 j = if j = 209 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_210 : ∀ j : Fin 270, - h1Coeff (triangleEdges 210).1 j - h1Coeff (triangleEdges 210).2.1 j + - h1Coeff (triangleEdges 210).2.2 j = if j = 210 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_211 : ∀ j : Fin 270, - h1Coeff (triangleEdges 211).1 j - h1Coeff (triangleEdges 211).2.1 j + - h1Coeff (triangleEdges 211).2.2 j = if j = 211 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_212 : ∀ j : Fin 270, - h1Coeff (triangleEdges 212).1 j - h1Coeff (triangleEdges 212).2.1 j + - h1Coeff (triangleEdges 212).2.2 j = if j = 212 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_213 : ∀ j : Fin 270, - h1Coeff (triangleEdges 213).1 j - h1Coeff (triangleEdges 213).2.1 j + - h1Coeff (triangleEdges 213).2.2 j = if j = 213 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_214 : ∀ j : Fin 270, - h1Coeff (triangleEdges 214).1 j - h1Coeff (triangleEdges 214).2.1 j + - h1Coeff (triangleEdges 214).2.2 j = if j = 214 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_215 : ∀ j : Fin 270, - h1Coeff (triangleEdges 215).1 j - h1Coeff (triangleEdges 215).2.1 j + - h1Coeff (triangleEdges 215).2.2 j = if j = 215 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_216 : ∀ j : Fin 270, - h1Coeff (triangleEdges 216).1 j - h1Coeff (triangleEdges 216).2.1 j + - h1Coeff (triangleEdges 216).2.2 j = if j = 216 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_217 : ∀ j : Fin 270, - h1Coeff (triangleEdges 217).1 j - h1Coeff (triangleEdges 217).2.1 j + - h1Coeff (triangleEdges 217).2.2 j = if j = 217 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_218 : ∀ j : Fin 270, - h1Coeff (triangleEdges 218).1 j - h1Coeff (triangleEdges 218).2.1 j + - h1Coeff (triangleEdges 218).2.2 j = if j = 218 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_219 : ∀ j : Fin 270, - h1Coeff (triangleEdges 219).1 j - h1Coeff (triangleEdges 219).2.1 j + - h1Coeff (triangleEdges 219).2.2 j = if j = 219 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_220 : ∀ j : Fin 270, - h1Coeff (triangleEdges 220).1 j - h1Coeff (triangleEdges 220).2.1 j + - h1Coeff (triangleEdges 220).2.2 j = if j = 220 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_221 : ∀ j : Fin 270, - h1Coeff (triangleEdges 221).1 j - h1Coeff (triangleEdges 221).2.1 j + - h1Coeff (triangleEdges 221).2.2 j = if j = 221 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_222 : ∀ j : Fin 270, - h1Coeff (triangleEdges 222).1 j - h1Coeff (triangleEdges 222).2.1 j + - h1Coeff (triangleEdges 222).2.2 j = if j = 222 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_223 : ∀ j : Fin 270, - h1Coeff (triangleEdges 223).1 j - h1Coeff (triangleEdges 223).2.1 j + - h1Coeff (triangleEdges 223).2.2 j = if j = 223 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_224 : ∀ j : Fin 270, - h1Coeff (triangleEdges 224).1 j - h1Coeff (triangleEdges 224).2.1 j + - h1Coeff (triangleEdges 224).2.2 j = if j = 224 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_225 : ∀ j : Fin 270, - h1Coeff (triangleEdges 225).1 j - h1Coeff (triangleEdges 225).2.1 j + - h1Coeff (triangleEdges 225).2.2 j = if j = 225 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_226 : ∀ j : Fin 270, - h1Coeff (triangleEdges 226).1 j - h1Coeff (triangleEdges 226).2.1 j + - h1Coeff (triangleEdges 226).2.2 j = if j = 226 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_227 : ∀ j : Fin 270, - h1Coeff (triangleEdges 227).1 j - h1Coeff (triangleEdges 227).2.1 j + - h1Coeff (triangleEdges 227).2.2 j = if j = 227 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_228 : ∀ j : Fin 270, - h1Coeff (triangleEdges 228).1 j - h1Coeff (triangleEdges 228).2.1 j + - h1Coeff (triangleEdges 228).2.2 j = if j = 228 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_229 : ∀ j : Fin 270, - h1Coeff (triangleEdges 229).1 j - h1Coeff (triangleEdges 229).2.1 j + - h1Coeff (triangleEdges 229).2.2 j = if j = 229 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_230 : ∀ j : Fin 270, - h1Coeff (triangleEdges 230).1 j - h1Coeff (triangleEdges 230).2.1 j + - h1Coeff (triangleEdges 230).2.2 j = if j = 230 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_231 : ∀ j : Fin 270, - h1Coeff (triangleEdges 231).1 j - h1Coeff (triangleEdges 231).2.1 j + - h1Coeff (triangleEdges 231).2.2 j = if j = 231 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_232 : ∀ j : Fin 270, - h1Coeff (triangleEdges 232).1 j - h1Coeff (triangleEdges 232).2.1 j + - h1Coeff (triangleEdges 232).2.2 j = if j = 232 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_233 : ∀ j : Fin 270, - h1Coeff (triangleEdges 233).1 j - h1Coeff (triangleEdges 233).2.1 j + - h1Coeff (triangleEdges 233).2.2 j = if j = 233 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_234 : ∀ j : Fin 270, - h1Coeff (triangleEdges 234).1 j - h1Coeff (triangleEdges 234).2.1 j + - h1Coeff (triangleEdges 234).2.2 j = if j = 234 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_235 : ∀ j : Fin 270, - h1Coeff (triangleEdges 235).1 j - h1Coeff (triangleEdges 235).2.1 j + - h1Coeff (triangleEdges 235).2.2 j = if j = 235 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_236 : ∀ j : Fin 270, - h1Coeff (triangleEdges 236).1 j - h1Coeff (triangleEdges 236).2.1 j + - h1Coeff (triangleEdges 236).2.2 j = if j = 236 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_237 : ∀ j : Fin 270, - h1Coeff (triangleEdges 237).1 j - h1Coeff (triangleEdges 237).2.1 j + - h1Coeff (triangleEdges 237).2.2 j = if j = 237 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_238 : ∀ j : Fin 270, - h1Coeff (triangleEdges 238).1 j - h1Coeff (triangleEdges 238).2.1 j + - h1Coeff (triangleEdges 238).2.2 j = if j = 238 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_239 : ∀ j : Fin 270, - h1Coeff (triangleEdges 239).1 j - h1Coeff (triangleEdges 239).2.1 j + - h1Coeff (triangleEdges 239).2.2 j = if j = 239 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_240 : ∀ j : Fin 270, - h1Coeff (triangleEdges 240).1 j - h1Coeff (triangleEdges 240).2.1 j + - h1Coeff (triangleEdges 240).2.2 j = if j = 240 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_241 : ∀ j : Fin 270, - h1Coeff (triangleEdges 241).1 j - h1Coeff (triangleEdges 241).2.1 j + - h1Coeff (triangleEdges 241).2.2 j = if j = 241 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_242 : ∀ j : Fin 270, - h1Coeff (triangleEdges 242).1 j - h1Coeff (triangleEdges 242).2.1 j + - h1Coeff (triangleEdges 242).2.2 j = if j = 242 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_243 : ∀ j : Fin 270, - h1Coeff (triangleEdges 243).1 j - h1Coeff (triangleEdges 243).2.1 j + - h1Coeff (triangleEdges 243).2.2 j = if j = 243 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_244 : ∀ j : Fin 270, - h1Coeff (triangleEdges 244).1 j - h1Coeff (triangleEdges 244).2.1 j + - h1Coeff (triangleEdges 244).2.2 j = if j = 244 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_245 : ∀ j : Fin 270, - h1Coeff (triangleEdges 245).1 j - h1Coeff (triangleEdges 245).2.1 j + - h1Coeff (triangleEdges 245).2.2 j = if j = 245 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_246 : ∀ j : Fin 270, - h1Coeff (triangleEdges 246).1 j - h1Coeff (triangleEdges 246).2.1 j + - h1Coeff (triangleEdges 246).2.2 j = if j = 246 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_247 : ∀ j : Fin 270, - h1Coeff (triangleEdges 247).1 j - h1Coeff (triangleEdges 247).2.1 j + - h1Coeff (triangleEdges 247).2.2 j = if j = 247 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_248 : ∀ j : Fin 270, - h1Coeff (triangleEdges 248).1 j - h1Coeff (triangleEdges 248).2.1 j + - h1Coeff (triangleEdges 248).2.2 j = if j = 248 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_249 : ∀ j : Fin 270, - h1Coeff (triangleEdges 249).1 j - h1Coeff (triangleEdges 249).2.1 j + - h1Coeff (triangleEdges 249).2.2 j = if j = 249 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_250 : ∀ j : Fin 270, - h1Coeff (triangleEdges 250).1 j - h1Coeff (triangleEdges 250).2.1 j + - h1Coeff (triangleEdges 250).2.2 j = if j = 250 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_251 : ∀ j : Fin 270, - h1Coeff (triangleEdges 251).1 j - h1Coeff (triangleEdges 251).2.1 j + - h1Coeff (triangleEdges 251).2.2 j = if j = 251 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_252 : ∀ j : Fin 270, - h1Coeff (triangleEdges 252).1 j - h1Coeff (triangleEdges 252).2.1 j + - h1Coeff (triangleEdges 252).2.2 j = if j = 252 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_253 : ∀ j : Fin 270, - h1Coeff (triangleEdges 253).1 j - h1Coeff (triangleEdges 253).2.1 j + - h1Coeff (triangleEdges 253).2.2 j = if j = 253 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_254 : ∀ j : Fin 270, - h1Coeff (triangleEdges 254).1 j - h1Coeff (triangleEdges 254).2.1 j + - h1Coeff (triangleEdges 254).2.2 j = if j = 254 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_255 : ∀ j : Fin 270, - h1Coeff (triangleEdges 255).1 j - h1Coeff (triangleEdges 255).2.1 j + - h1Coeff (triangleEdges 255).2.2 j = if j = 255 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_256 : ∀ j : Fin 270, - h1Coeff (triangleEdges 256).1 j - h1Coeff (triangleEdges 256).2.1 j + - h1Coeff (triangleEdges 256).2.2 j = if j = 256 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_257 : ∀ j : Fin 270, - h1Coeff (triangleEdges 257).1 j - h1Coeff (triangleEdges 257).2.1 j + - h1Coeff (triangleEdges 257).2.2 j = if j = 257 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_258 : ∀ j : Fin 270, - h1Coeff (triangleEdges 258).1 j - h1Coeff (triangleEdges 258).2.1 j + - h1Coeff (triangleEdges 258).2.2 j = if j = 258 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_259 : ∀ j : Fin 270, - h1Coeff (triangleEdges 259).1 j - h1Coeff (triangleEdges 259).2.1 j + - h1Coeff (triangleEdges 259).2.2 j = if j = 259 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_260 : ∀ j : Fin 270, - h1Coeff (triangleEdges 260).1 j - h1Coeff (triangleEdges 260).2.1 j + - h1Coeff (triangleEdges 260).2.2 j = if j = 260 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_261 : ∀ j : Fin 270, - h1Coeff (triangleEdges 261).1 j - h1Coeff (triangleEdges 261).2.1 j + - h1Coeff (triangleEdges 261).2.2 j = if j = 261 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_262 : ∀ j : Fin 270, - h1Coeff (triangleEdges 262).1 j - h1Coeff (triangleEdges 262).2.1 j + - h1Coeff (triangleEdges 262).2.2 j = if j = 262 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_263 : ∀ j : Fin 270, - h1Coeff (triangleEdges 263).1 j - h1Coeff (triangleEdges 263).2.1 j + - h1Coeff (triangleEdges 263).2.2 j = if j = 263 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_264 : ∀ j : Fin 270, - h1Coeff (triangleEdges 264).1 j - h1Coeff (triangleEdges 264).2.1 j + - h1Coeff (triangleEdges 264).2.2 j = if j = 264 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_265 : ∀ j : Fin 270, - h1Coeff (triangleEdges 265).1 j - h1Coeff (triangleEdges 265).2.1 j + - h1Coeff (triangleEdges 265).2.2 j = if j = 265 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_266 : ∀ j : Fin 270, - h1Coeff (triangleEdges 266).1 j - h1Coeff (triangleEdges 266).2.1 j + - h1Coeff (triangleEdges 266).2.2 j = if j = 266 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_267 : ∀ j : Fin 270, - h1Coeff (triangleEdges 267).1 j - h1Coeff (triangleEdges 267).2.1 j + - h1Coeff (triangleEdges 267).2.2 j = if j = 267 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_268 : ∀ j : Fin 270, - h1Coeff (triangleEdges 268).1 j - h1Coeff (triangleEdges 268).2.1 j + - h1Coeff (triangleEdges 268).2.2 j = if j = 268 then 1 else 0 := by decide +kernel - -theorem h1_boundary_cert_269 : ∀ j : Fin 270, - h1Coeff (triangleEdges 269).1 j - h1Coeff (triangleEdges 269).2.1 j + - h1Coeff (triangleEdges 269).2.2 j = if j = 269 then 1 else 0 := by decide +kernel - -theorem d1_basis_cert_0 : ∀ e : Fin 372, - rowEval (d1Row 0) (fun j => if j = e then 1 else 0) = - (if 0 = (edge e).2 then 1 else 0) - - (if 0 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_1 : ∀ e : Fin 372, - rowEval (d1Row 1) (fun j => if j = e then 1 else 0) = - (if 1 = (edge e).2 then 1 else 0) - - (if 1 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_2 : ∀ e : Fin 372, - rowEval (d1Row 2) (fun j => if j = e then 1 else 0) = - (if 2 = (edge e).2 then 1 else 0) - - (if 2 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_3 : ∀ e : Fin 372, - rowEval (d1Row 3) (fun j => if j = e then 1 else 0) = - (if 3 = (edge e).2 then 1 else 0) - - (if 3 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_4 : ∀ e : Fin 372, - rowEval (d1Row 4) (fun j => if j = e then 1 else 0) = - (if 4 = (edge e).2 then 1 else 0) - - (if 4 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_5 : ∀ e : Fin 372, - rowEval (d1Row 5) (fun j => if j = e then 1 else 0) = - (if 5 = (edge e).2 then 1 else 0) - - (if 5 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_6 : ∀ e : Fin 372, - rowEval (d1Row 6) (fun j => if j = e then 1 else 0) = - (if 6 = (edge e).2 then 1 else 0) - - (if 6 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_7 : ∀ e : Fin 372, - rowEval (d1Row 7) (fun j => if j = e then 1 else 0) = - (if 7 = (edge e).2 then 1 else 0) - - (if 7 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_8 : ∀ e : Fin 372, - rowEval (d1Row 8) (fun j => if j = e then 1 else 0) = - (if 8 = (edge e).2 then 1 else 0) - - (if 8 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_9 : ∀ e : Fin 372, - rowEval (d1Row 9) (fun j => if j = e then 1 else 0) = - (if 9 = (edge e).2 then 1 else 0) - - (if 9 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_10 : ∀ e : Fin 372, - rowEval (d1Row 10) (fun j => if j = e then 1 else 0) = - (if 10 = (edge e).2 then 1 else 0) - - (if 10 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_11 : ∀ e : Fin 372, - rowEval (d1Row 11) (fun j => if j = e then 1 else 0) = - (if 11 = (edge e).2 then 1 else 0) - - (if 11 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_12 : ∀ e : Fin 372, - rowEval (d1Row 12) (fun j => if j = e then 1 else 0) = - (if 12 = (edge e).2 then 1 else 0) - - (if 12 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_13 : ∀ e : Fin 372, - rowEval (d1Row 13) (fun j => if j = e then 1 else 0) = - (if 13 = (edge e).2 then 1 else 0) - - (if 13 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_14 : ∀ e : Fin 372, - rowEval (d1Row 14) (fun j => if j = e then 1 else 0) = - (if 14 = (edge e).2 then 1 else 0) - - (if 14 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_15 : ∀ e : Fin 372, - rowEval (d1Row 15) (fun j => if j = e then 1 else 0) = - (if 15 = (edge e).2 then 1 else 0) - - (if 15 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_16 : ∀ e : Fin 372, - rowEval (d1Row 16) (fun j => if j = e then 1 else 0) = - (if 16 = (edge e).2 then 1 else 0) - - (if 16 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_17 : ∀ e : Fin 372, - rowEval (d1Row 17) (fun j => if j = e then 1 else 0) = - (if 17 = (edge e).2 then 1 else 0) - - (if 17 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_18 : ∀ e : Fin 372, - rowEval (d1Row 18) (fun j => if j = e then 1 else 0) = - (if 18 = (edge e).2 then 1 else 0) - - (if 18 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_19 : ∀ e : Fin 372, - rowEval (d1Row 19) (fun j => if j = e then 1 else 0) = - (if 19 = (edge e).2 then 1 else 0) - - (if 19 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_20 : ∀ e : Fin 372, - rowEval (d1Row 20) (fun j => if j = e then 1 else 0) = - (if 20 = (edge e).2 then 1 else 0) - - (if 20 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_21 : ∀ e : Fin 372, - rowEval (d1Row 21) (fun j => if j = e then 1 else 0) = - (if 21 = (edge e).2 then 1 else 0) - - (if 21 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_22 : ∀ e : Fin 372, - rowEval (d1Row 22) (fun j => if j = e then 1 else 0) = - (if 22 = (edge e).2 then 1 else 0) - - (if 22 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_23 : ∀ e : Fin 372, - rowEval (d1Row 23) (fun j => if j = e then 1 else 0) = - (if 23 = (edge e).2 then 1 else 0) - - (if 23 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_24 : ∀ e : Fin 372, - rowEval (d1Row 24) (fun j => if j = e then 1 else 0) = - (if 24 = (edge e).2 then 1 else 0) - - (if 24 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_25 : ∀ e : Fin 372, - rowEval (d1Row 25) (fun j => if j = e then 1 else 0) = - (if 25 = (edge e).2 then 1 else 0) - - (if 25 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_26 : ∀ e : Fin 372, - rowEval (d1Row 26) (fun j => if j = e then 1 else 0) = - (if 26 = (edge e).2 then 1 else 0) - - (if 26 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_27 : ∀ e : Fin 372, - rowEval (d1Row 27) (fun j => if j = e then 1 else 0) = - (if 27 = (edge e).2 then 1 else 0) - - (if 27 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_28 : ∀ e : Fin 372, - rowEval (d1Row 28) (fun j => if j = e then 1 else 0) = - (if 28 = (edge e).2 then 1 else 0) - - (if 28 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_29 : ∀ e : Fin 372, - rowEval (d1Row 29) (fun j => if j = e then 1 else 0) = - (if 29 = (edge e).2 then 1 else 0) - - (if 29 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_30 : ∀ e : Fin 372, - rowEval (d1Row 30) (fun j => if j = e then 1 else 0) = - (if 30 = (edge e).2 then 1 else 0) - - (if 30 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_31 : ∀ e : Fin 372, - rowEval (d1Row 31) (fun j => if j = e then 1 else 0) = - (if 31 = (edge e).2 then 1 else 0) - - (if 31 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_32 : ∀ e : Fin 372, - rowEval (d1Row 32) (fun j => if j = e then 1 else 0) = - (if 32 = (edge e).2 then 1 else 0) - - (if 32 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_33 : ∀ e : Fin 372, - rowEval (d1Row 33) (fun j => if j = e then 1 else 0) = - (if 33 = (edge e).2 then 1 else 0) - - (if 33 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_34 : ∀ e : Fin 372, - rowEval (d1Row 34) (fun j => if j = e then 1 else 0) = - (if 34 = (edge e).2 then 1 else 0) - - (if 34 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_35 : ∀ e : Fin 372, - rowEval (d1Row 35) (fun j => if j = e then 1 else 0) = - (if 35 = (edge e).2 then 1 else 0) - - (if 35 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_36 : ∀ e : Fin 372, - rowEval (d1Row 36) (fun j => if j = e then 1 else 0) = - (if 36 = (edge e).2 then 1 else 0) - - (if 36 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_37 : ∀ e : Fin 372, - rowEval (d1Row 37) (fun j => if j = e then 1 else 0) = - (if 37 = (edge e).2 then 1 else 0) - - (if 37 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_38 : ∀ e : Fin 372, - rowEval (d1Row 38) (fun j => if j = e then 1 else 0) = - (if 38 = (edge e).2 then 1 else 0) - - (if 38 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_39 : ∀ e : Fin 372, - rowEval (d1Row 39) (fun j => if j = e then 1 else 0) = - (if 39 = (edge e).2 then 1 else 0) - - (if 39 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_40 : ∀ e : Fin 372, - rowEval (d1Row 40) (fun j => if j = e then 1 else 0) = - (if 40 = (edge e).2 then 1 else 0) - - (if 40 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_41 : ∀ e : Fin 372, - rowEval (d1Row 41) (fun j => if j = e then 1 else 0) = - (if 41 = (edge e).2 then 1 else 0) - - (if 41 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_42 : ∀ e : Fin 372, - rowEval (d1Row 42) (fun j => if j = e then 1 else 0) = - (if 42 = (edge e).2 then 1 else 0) - - (if 42 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_43 : ∀ e : Fin 372, - rowEval (d1Row 43) (fun j => if j = e then 1 else 0) = - (if 43 = (edge e).2 then 1 else 0) - - (if 43 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_44 : ∀ e : Fin 372, - rowEval (d1Row 44) (fun j => if j = e then 1 else 0) = - (if 44 = (edge e).2 then 1 else 0) - - (if 44 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_45 : ∀ e : Fin 372, - rowEval (d1Row 45) (fun j => if j = e then 1 else 0) = - (if 45 = (edge e).2 then 1 else 0) - - (if 45 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_46 : ∀ e : Fin 372, - rowEval (d1Row 46) (fun j => if j = e then 1 else 0) = - (if 46 = (edge e).2 then 1 else 0) - - (if 46 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_47 : ∀ e : Fin 372, - rowEval (d1Row 47) (fun j => if j = e then 1 else 0) = - (if 47 = (edge e).2 then 1 else 0) - - (if 47 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_48 : ∀ e : Fin 372, - rowEval (d1Row 48) (fun j => if j = e then 1 else 0) = - (if 48 = (edge e).2 then 1 else 0) - - (if 48 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_49 : ∀ e : Fin 372, - rowEval (d1Row 49) (fun j => if j = e then 1 else 0) = - (if 49 = (edge e).2 then 1 else 0) - - (if 49 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_50 : ∀ e : Fin 372, - rowEval (d1Row 50) (fun j => if j = e then 1 else 0) = - (if 50 = (edge e).2 then 1 else 0) - - (if 50 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_51 : ∀ e : Fin 372, - rowEval (d1Row 51) (fun j => if j = e then 1 else 0) = - (if 51 = (edge e).2 then 1 else 0) - - (if 51 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_52 : ∀ e : Fin 372, - rowEval (d1Row 52) (fun j => if j = e then 1 else 0) = - (if 52 = (edge e).2 then 1 else 0) - - (if 52 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_53 : ∀ e : Fin 372, - rowEval (d1Row 53) (fun j => if j = e then 1 else 0) = - (if 53 = (edge e).2 then 1 else 0) - - (if 53 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_54 : ∀ e : Fin 372, - rowEval (d1Row 54) (fun j => if j = e then 1 else 0) = - (if 54 = (edge e).2 then 1 else 0) - - (if 54 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_55 : ∀ e : Fin 372, - rowEval (d1Row 55) (fun j => if j = e then 1 else 0) = - (if 55 = (edge e).2 then 1 else 0) - - (if 55 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_56 : ∀ e : Fin 372, - rowEval (d1Row 56) (fun j => if j = e then 1 else 0) = - (if 56 = (edge e).2 then 1 else 0) - - (if 56 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_57 : ∀ e : Fin 372, - rowEval (d1Row 57) (fun j => if j = e then 1 else 0) = - (if 57 = (edge e).2 then 1 else 0) - - (if 57 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_58 : ∀ e : Fin 372, - rowEval (d1Row 58) (fun j => if j = e then 1 else 0) = - (if 58 = (edge e).2 then 1 else 0) - - (if 58 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_59 : ∀ e : Fin 372, - rowEval (d1Row 59) (fun j => if j = e then 1 else 0) = - (if 59 = (edge e).2 then 1 else 0) - - (if 59 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_60 : ∀ e : Fin 372, - rowEval (d1Row 60) (fun j => if j = e then 1 else 0) = - (if 60 = (edge e).2 then 1 else 0) - - (if 60 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_61 : ∀ e : Fin 372, - rowEval (d1Row 61) (fun j => if j = e then 1 else 0) = - (if 61 = (edge e).2 then 1 else 0) - - (if 61 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_62 : ∀ e : Fin 372, - rowEval (d1Row 62) (fun j => if j = e then 1 else 0) = - (if 62 = (edge e).2 then 1 else 0) - - (if 62 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_63 : ∀ e : Fin 372, - rowEval (d1Row 63) (fun j => if j = e then 1 else 0) = - (if 63 = (edge e).2 then 1 else 0) - - (if 63 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_64 : ∀ e : Fin 372, - rowEval (d1Row 64) (fun j => if j = e then 1 else 0) = - (if 64 = (edge e).2 then 1 else 0) - - (if 64 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_65 : ∀ e : Fin 372, - rowEval (d1Row 65) (fun j => if j = e then 1 else 0) = - (if 65 = (edge e).2 then 1 else 0) - - (if 65 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_66 : ∀ e : Fin 372, - rowEval (d1Row 66) (fun j => if j = e then 1 else 0) = - (if 66 = (edge e).2 then 1 else 0) - - (if 66 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_67 : ∀ e : Fin 372, - rowEval (d1Row 67) (fun j => if j = e then 1 else 0) = - (if 67 = (edge e).2 then 1 else 0) - - (if 67 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_68 : ∀ e : Fin 372, - rowEval (d1Row 68) (fun j => if j = e then 1 else 0) = - (if 68 = (edge e).2 then 1 else 0) - - (if 68 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_69 : ∀ e : Fin 372, - rowEval (d1Row 69) (fun j => if j = e then 1 else 0) = - (if 69 = (edge e).2 then 1 else 0) - - (if 69 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_70 : ∀ e : Fin 372, - rowEval (d1Row 70) (fun j => if j = e then 1 else 0) = - (if 70 = (edge e).2 then 1 else 0) - - (if 70 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_71 : ∀ e : Fin 372, - rowEval (d1Row 71) (fun j => if j = e then 1 else 0) = - (if 71 = (edge e).2 then 1 else 0) - - (if 71 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_72 : ∀ e : Fin 372, - rowEval (d1Row 72) (fun j => if j = e then 1 else 0) = - (if 72 = (edge e).2 then 1 else 0) - - (if 72 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_73 : ∀ e : Fin 372, - rowEval (d1Row 73) (fun j => if j = e then 1 else 0) = - (if 73 = (edge e).2 then 1 else 0) - - (if 73 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_74 : ∀ e : Fin 372, - rowEval (d1Row 74) (fun j => if j = e then 1 else 0) = - (if 74 = (edge e).2 then 1 else 0) - - (if 74 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_75 : ∀ e : Fin 372, - rowEval (d1Row 75) (fun j => if j = e then 1 else 0) = - (if 75 = (edge e).2 then 1 else 0) - - (if 75 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_76 : ∀ e : Fin 372, - rowEval (d1Row 76) (fun j => if j = e then 1 else 0) = - (if 76 = (edge e).2 then 1 else 0) - - (if 76 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_77 : ∀ e : Fin 372, - rowEval (d1Row 77) (fun j => if j = e then 1 else 0) = - (if 77 = (edge e).2 then 1 else 0) - - (if 77 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_78 : ∀ e : Fin 372, - rowEval (d1Row 78) (fun j => if j = e then 1 else 0) = - (if 78 = (edge e).2 then 1 else 0) - - (if 78 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_79 : ∀ e : Fin 372, - rowEval (d1Row 79) (fun j => if j = e then 1 else 0) = - (if 79 = (edge e).2 then 1 else 0) - - (if 79 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_80 : ∀ e : Fin 372, - rowEval (d1Row 80) (fun j => if j = e then 1 else 0) = - (if 80 = (edge e).2 then 1 else 0) - - (if 80 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_81 : ∀ e : Fin 372, - rowEval (d1Row 81) (fun j => if j = e then 1 else 0) = - (if 81 = (edge e).2 then 1 else 0) - - (if 81 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_82 : ∀ e : Fin 372, - rowEval (d1Row 82) (fun j => if j = e then 1 else 0) = - (if 82 = (edge e).2 then 1 else 0) - - (if 82 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_83 : ∀ e : Fin 372, - rowEval (d1Row 83) (fun j => if j = e then 1 else 0) = - (if 83 = (edge e).2 then 1 else 0) - - (if 83 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_84 : ∀ e : Fin 372, - rowEval (d1Row 84) (fun j => if j = e then 1 else 0) = - (if 84 = (edge e).2 then 1 else 0) - - (if 84 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_85 : ∀ e : Fin 372, - rowEval (d1Row 85) (fun j => if j = e then 1 else 0) = - (if 85 = (edge e).2 then 1 else 0) - - (if 85 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_86 : ∀ e : Fin 372, - rowEval (d1Row 86) (fun j => if j = e then 1 else 0) = - (if 86 = (edge e).2 then 1 else 0) - - (if 86 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_87 : ∀ e : Fin 372, - rowEval (d1Row 87) (fun j => if j = e then 1 else 0) = - (if 87 = (edge e).2 then 1 else 0) - - (if 87 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_88 : ∀ e : Fin 372, - rowEval (d1Row 88) (fun j => if j = e then 1 else 0) = - (if 88 = (edge e).2 then 1 else 0) - - (if 88 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_89 : ∀ e : Fin 372, - rowEval (d1Row 89) (fun j => if j = e then 1 else 0) = - (if 89 = (edge e).2 then 1 else 0) - - (if 89 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_90 : ∀ e : Fin 372, - rowEval (d1Row 90) (fun j => if j = e then 1 else 0) = - (if 90 = (edge e).2 then 1 else 0) - - (if 90 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_91 : ∀ e : Fin 372, - rowEval (d1Row 91) (fun j => if j = e then 1 else 0) = - (if 91 = (edge e).2 then 1 else 0) - - (if 91 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_92 : ∀ e : Fin 372, - rowEval (d1Row 92) (fun j => if j = e then 1 else 0) = - (if 92 = (edge e).2 then 1 else 0) - - (if 92 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_93 : ∀ e : Fin 372, - rowEval (d1Row 93) (fun j => if j = e then 1 else 0) = - (if 93 = (edge e).2 then 1 else 0) - - (if 93 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_94 : ∀ e : Fin 372, - rowEval (d1Row 94) (fun j => if j = e then 1 else 0) = - (if 94 = (edge e).2 then 1 else 0) - - (if 94 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_95 : ∀ e : Fin 372, - rowEval (d1Row 95) (fun j => if j = e then 1 else 0) = - (if 95 = (edge e).2 then 1 else 0) - - (if 95 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_96 : ∀ e : Fin 372, - rowEval (d1Row 96) (fun j => if j = e then 1 else 0) = - (if 96 = (edge e).2 then 1 else 0) - - (if 96 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_97 : ∀ e : Fin 372, - rowEval (d1Row 97) (fun j => if j = e then 1 else 0) = - (if 97 = (edge e).2 then 1 else 0) - - (if 97 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_98 : ∀ e : Fin 372, - rowEval (d1Row 98) (fun j => if j = e then 1 else 0) = - (if 98 = (edge e).2 then 1 else 0) - - (if 98 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_99 : ∀ e : Fin 372, - rowEval (d1Row 99) (fun j => if j = e then 1 else 0) = - (if 99 = (edge e).2 then 1 else 0) - - (if 99 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_100 : ∀ e : Fin 372, - rowEval (d1Row 100) (fun j => if j = e then 1 else 0) = - (if 100 = (edge e).2 then 1 else 0) - - (if 100 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_101 : ∀ e : Fin 372, - rowEval (d1Row 101) (fun j => if j = e then 1 else 0) = - (if 101 = (edge e).2 then 1 else 0) - - (if 101 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d1_basis_cert_102 : ∀ e : Fin 372, - rowEval (d1Row 102) (fun j => if j = e then 1 else 0) = - (if 102 = (edge e).2 then 1 else 0) - - (if 102 = (edge e).1 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_0 : ∀ t : Fin 270, - rowEval (d2Row 0) (fun j => if j = t then 1 else 0) = - (if 0 = (triangleEdges t).1 then 1 else 0) - - (if 0 = (triangleEdges t).2.1 then 1 else 0) + - (if 0 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_1 : ∀ t : Fin 270, - rowEval (d2Row 1) (fun j => if j = t then 1 else 0) = - (if 1 = (triangleEdges t).1 then 1 else 0) - - (if 1 = (triangleEdges t).2.1 then 1 else 0) + - (if 1 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_2 : ∀ t : Fin 270, - rowEval (d2Row 2) (fun j => if j = t then 1 else 0) = - (if 2 = (triangleEdges t).1 then 1 else 0) - - (if 2 = (triangleEdges t).2.1 then 1 else 0) + - (if 2 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_3 : ∀ t : Fin 270, - rowEval (d2Row 3) (fun j => if j = t then 1 else 0) = - (if 3 = (triangleEdges t).1 then 1 else 0) - - (if 3 = (triangleEdges t).2.1 then 1 else 0) + - (if 3 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_4 : ∀ t : Fin 270, - rowEval (d2Row 4) (fun j => if j = t then 1 else 0) = - (if 4 = (triangleEdges t).1 then 1 else 0) - - (if 4 = (triangleEdges t).2.1 then 1 else 0) + - (if 4 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_5 : ∀ t : Fin 270, - rowEval (d2Row 5) (fun j => if j = t then 1 else 0) = - (if 5 = (triangleEdges t).1 then 1 else 0) - - (if 5 = (triangleEdges t).2.1 then 1 else 0) + - (if 5 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_6 : ∀ t : Fin 270, - rowEval (d2Row 6) (fun j => if j = t then 1 else 0) = - (if 6 = (triangleEdges t).1 then 1 else 0) - - (if 6 = (triangleEdges t).2.1 then 1 else 0) + - (if 6 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_7 : ∀ t : Fin 270, - rowEval (d2Row 7) (fun j => if j = t then 1 else 0) = - (if 7 = (triangleEdges t).1 then 1 else 0) - - (if 7 = (triangleEdges t).2.1 then 1 else 0) + - (if 7 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_8 : ∀ t : Fin 270, - rowEval (d2Row 8) (fun j => if j = t then 1 else 0) = - (if 8 = (triangleEdges t).1 then 1 else 0) - - (if 8 = (triangleEdges t).2.1 then 1 else 0) + - (if 8 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_9 : ∀ t : Fin 270, - rowEval (d2Row 9) (fun j => if j = t then 1 else 0) = - (if 9 = (triangleEdges t).1 then 1 else 0) - - (if 9 = (triangleEdges t).2.1 then 1 else 0) + - (if 9 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_10 : ∀ t : Fin 270, - rowEval (d2Row 10) (fun j => if j = t then 1 else 0) = - (if 10 = (triangleEdges t).1 then 1 else 0) - - (if 10 = (triangleEdges t).2.1 then 1 else 0) + - (if 10 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_11 : ∀ t : Fin 270, - rowEval (d2Row 11) (fun j => if j = t then 1 else 0) = - (if 11 = (triangleEdges t).1 then 1 else 0) - - (if 11 = (triangleEdges t).2.1 then 1 else 0) + - (if 11 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_12 : ∀ t : Fin 270, - rowEval (d2Row 12) (fun j => if j = t then 1 else 0) = - (if 12 = (triangleEdges t).1 then 1 else 0) - - (if 12 = (triangleEdges t).2.1 then 1 else 0) + - (if 12 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_13 : ∀ t : Fin 270, - rowEval (d2Row 13) (fun j => if j = t then 1 else 0) = - (if 13 = (triangleEdges t).1 then 1 else 0) - - (if 13 = (triangleEdges t).2.1 then 1 else 0) + - (if 13 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_14 : ∀ t : Fin 270, - rowEval (d2Row 14) (fun j => if j = t then 1 else 0) = - (if 14 = (triangleEdges t).1 then 1 else 0) - - (if 14 = (triangleEdges t).2.1 then 1 else 0) + - (if 14 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_15 : ∀ t : Fin 270, - rowEval (d2Row 15) (fun j => if j = t then 1 else 0) = - (if 15 = (triangleEdges t).1 then 1 else 0) - - (if 15 = (triangleEdges t).2.1 then 1 else 0) + - (if 15 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_16 : ∀ t : Fin 270, - rowEval (d2Row 16) (fun j => if j = t then 1 else 0) = - (if 16 = (triangleEdges t).1 then 1 else 0) - - (if 16 = (triangleEdges t).2.1 then 1 else 0) + - (if 16 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_17 : ∀ t : Fin 270, - rowEval (d2Row 17) (fun j => if j = t then 1 else 0) = - (if 17 = (triangleEdges t).1 then 1 else 0) - - (if 17 = (triangleEdges t).2.1 then 1 else 0) + - (if 17 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_18 : ∀ t : Fin 270, - rowEval (d2Row 18) (fun j => if j = t then 1 else 0) = - (if 18 = (triangleEdges t).1 then 1 else 0) - - (if 18 = (triangleEdges t).2.1 then 1 else 0) + - (if 18 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_19 : ∀ t : Fin 270, - rowEval (d2Row 19) (fun j => if j = t then 1 else 0) = - (if 19 = (triangleEdges t).1 then 1 else 0) - - (if 19 = (triangleEdges t).2.1 then 1 else 0) + - (if 19 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_20 : ∀ t : Fin 270, - rowEval (d2Row 20) (fun j => if j = t then 1 else 0) = - (if 20 = (triangleEdges t).1 then 1 else 0) - - (if 20 = (triangleEdges t).2.1 then 1 else 0) + - (if 20 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_21 : ∀ t : Fin 270, - rowEval (d2Row 21) (fun j => if j = t then 1 else 0) = - (if 21 = (triangleEdges t).1 then 1 else 0) - - (if 21 = (triangleEdges t).2.1 then 1 else 0) + - (if 21 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_22 : ∀ t : Fin 270, - rowEval (d2Row 22) (fun j => if j = t then 1 else 0) = - (if 22 = (triangleEdges t).1 then 1 else 0) - - (if 22 = (triangleEdges t).2.1 then 1 else 0) + - (if 22 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_23 : ∀ t : Fin 270, - rowEval (d2Row 23) (fun j => if j = t then 1 else 0) = - (if 23 = (triangleEdges t).1 then 1 else 0) - - (if 23 = (triangleEdges t).2.1 then 1 else 0) + - (if 23 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_24 : ∀ t : Fin 270, - rowEval (d2Row 24) (fun j => if j = t then 1 else 0) = - (if 24 = (triangleEdges t).1 then 1 else 0) - - (if 24 = (triangleEdges t).2.1 then 1 else 0) + - (if 24 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_25 : ∀ t : Fin 270, - rowEval (d2Row 25) (fun j => if j = t then 1 else 0) = - (if 25 = (triangleEdges t).1 then 1 else 0) - - (if 25 = (triangleEdges t).2.1 then 1 else 0) + - (if 25 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_26 : ∀ t : Fin 270, - rowEval (d2Row 26) (fun j => if j = t then 1 else 0) = - (if 26 = (triangleEdges t).1 then 1 else 0) - - (if 26 = (triangleEdges t).2.1 then 1 else 0) + - (if 26 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_27 : ∀ t : Fin 270, - rowEval (d2Row 27) (fun j => if j = t then 1 else 0) = - (if 27 = (triangleEdges t).1 then 1 else 0) - - (if 27 = (triangleEdges t).2.1 then 1 else 0) + - (if 27 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_28 : ∀ t : Fin 270, - rowEval (d2Row 28) (fun j => if j = t then 1 else 0) = - (if 28 = (triangleEdges t).1 then 1 else 0) - - (if 28 = (triangleEdges t).2.1 then 1 else 0) + - (if 28 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_29 : ∀ t : Fin 270, - rowEval (d2Row 29) (fun j => if j = t then 1 else 0) = - (if 29 = (triangleEdges t).1 then 1 else 0) - - (if 29 = (triangleEdges t).2.1 then 1 else 0) + - (if 29 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_30 : ∀ t : Fin 270, - rowEval (d2Row 30) (fun j => if j = t then 1 else 0) = - (if 30 = (triangleEdges t).1 then 1 else 0) - - (if 30 = (triangleEdges t).2.1 then 1 else 0) + - (if 30 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_31 : ∀ t : Fin 270, - rowEval (d2Row 31) (fun j => if j = t then 1 else 0) = - (if 31 = (triangleEdges t).1 then 1 else 0) - - (if 31 = (triangleEdges t).2.1 then 1 else 0) + - (if 31 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_32 : ∀ t : Fin 270, - rowEval (d2Row 32) (fun j => if j = t then 1 else 0) = - (if 32 = (triangleEdges t).1 then 1 else 0) - - (if 32 = (triangleEdges t).2.1 then 1 else 0) + - (if 32 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_33 : ∀ t : Fin 270, - rowEval (d2Row 33) (fun j => if j = t then 1 else 0) = - (if 33 = (triangleEdges t).1 then 1 else 0) - - (if 33 = (triangleEdges t).2.1 then 1 else 0) + - (if 33 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_34 : ∀ t : Fin 270, - rowEval (d2Row 34) (fun j => if j = t then 1 else 0) = - (if 34 = (triangleEdges t).1 then 1 else 0) - - (if 34 = (triangleEdges t).2.1 then 1 else 0) + - (if 34 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_35 : ∀ t : Fin 270, - rowEval (d2Row 35) (fun j => if j = t then 1 else 0) = - (if 35 = (triangleEdges t).1 then 1 else 0) - - (if 35 = (triangleEdges t).2.1 then 1 else 0) + - (if 35 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_36 : ∀ t : Fin 270, - rowEval (d2Row 36) (fun j => if j = t then 1 else 0) = - (if 36 = (triangleEdges t).1 then 1 else 0) - - (if 36 = (triangleEdges t).2.1 then 1 else 0) + - (if 36 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_37 : ∀ t : Fin 270, - rowEval (d2Row 37) (fun j => if j = t then 1 else 0) = - (if 37 = (triangleEdges t).1 then 1 else 0) - - (if 37 = (triangleEdges t).2.1 then 1 else 0) + - (if 37 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_38 : ∀ t : Fin 270, - rowEval (d2Row 38) (fun j => if j = t then 1 else 0) = - (if 38 = (triangleEdges t).1 then 1 else 0) - - (if 38 = (triangleEdges t).2.1 then 1 else 0) + - (if 38 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_39 : ∀ t : Fin 270, - rowEval (d2Row 39) (fun j => if j = t then 1 else 0) = - (if 39 = (triangleEdges t).1 then 1 else 0) - - (if 39 = (triangleEdges t).2.1 then 1 else 0) + - (if 39 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_40 : ∀ t : Fin 270, - rowEval (d2Row 40) (fun j => if j = t then 1 else 0) = - (if 40 = (triangleEdges t).1 then 1 else 0) - - (if 40 = (triangleEdges t).2.1 then 1 else 0) + - (if 40 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_41 : ∀ t : Fin 270, - rowEval (d2Row 41) (fun j => if j = t then 1 else 0) = - (if 41 = (triangleEdges t).1 then 1 else 0) - - (if 41 = (triangleEdges t).2.1 then 1 else 0) + - (if 41 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_42 : ∀ t : Fin 270, - rowEval (d2Row 42) (fun j => if j = t then 1 else 0) = - (if 42 = (triangleEdges t).1 then 1 else 0) - - (if 42 = (triangleEdges t).2.1 then 1 else 0) + - (if 42 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_43 : ∀ t : Fin 270, - rowEval (d2Row 43) (fun j => if j = t then 1 else 0) = - (if 43 = (triangleEdges t).1 then 1 else 0) - - (if 43 = (triangleEdges t).2.1 then 1 else 0) + - (if 43 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_44 : ∀ t : Fin 270, - rowEval (d2Row 44) (fun j => if j = t then 1 else 0) = - (if 44 = (triangleEdges t).1 then 1 else 0) - - (if 44 = (triangleEdges t).2.1 then 1 else 0) + - (if 44 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_45 : ∀ t : Fin 270, - rowEval (d2Row 45) (fun j => if j = t then 1 else 0) = - (if 45 = (triangleEdges t).1 then 1 else 0) - - (if 45 = (triangleEdges t).2.1 then 1 else 0) + - (if 45 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_46 : ∀ t : Fin 270, - rowEval (d2Row 46) (fun j => if j = t then 1 else 0) = - (if 46 = (triangleEdges t).1 then 1 else 0) - - (if 46 = (triangleEdges t).2.1 then 1 else 0) + - (if 46 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_47 : ∀ t : Fin 270, - rowEval (d2Row 47) (fun j => if j = t then 1 else 0) = - (if 47 = (triangleEdges t).1 then 1 else 0) - - (if 47 = (triangleEdges t).2.1 then 1 else 0) + - (if 47 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_48 : ∀ t : Fin 270, - rowEval (d2Row 48) (fun j => if j = t then 1 else 0) = - (if 48 = (triangleEdges t).1 then 1 else 0) - - (if 48 = (triangleEdges t).2.1 then 1 else 0) + - (if 48 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_49 : ∀ t : Fin 270, - rowEval (d2Row 49) (fun j => if j = t then 1 else 0) = - (if 49 = (triangleEdges t).1 then 1 else 0) - - (if 49 = (triangleEdges t).2.1 then 1 else 0) + - (if 49 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_50 : ∀ t : Fin 270, - rowEval (d2Row 50) (fun j => if j = t then 1 else 0) = - (if 50 = (triangleEdges t).1 then 1 else 0) - - (if 50 = (triangleEdges t).2.1 then 1 else 0) + - (if 50 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_51 : ∀ t : Fin 270, - rowEval (d2Row 51) (fun j => if j = t then 1 else 0) = - (if 51 = (triangleEdges t).1 then 1 else 0) - - (if 51 = (triangleEdges t).2.1 then 1 else 0) + - (if 51 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_52 : ∀ t : Fin 270, - rowEval (d2Row 52) (fun j => if j = t then 1 else 0) = - (if 52 = (triangleEdges t).1 then 1 else 0) - - (if 52 = (triangleEdges t).2.1 then 1 else 0) + - (if 52 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_53 : ∀ t : Fin 270, - rowEval (d2Row 53) (fun j => if j = t then 1 else 0) = - (if 53 = (triangleEdges t).1 then 1 else 0) - - (if 53 = (triangleEdges t).2.1 then 1 else 0) + - (if 53 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_54 : ∀ t : Fin 270, - rowEval (d2Row 54) (fun j => if j = t then 1 else 0) = - (if 54 = (triangleEdges t).1 then 1 else 0) - - (if 54 = (triangleEdges t).2.1 then 1 else 0) + - (if 54 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_55 : ∀ t : Fin 270, - rowEval (d2Row 55) (fun j => if j = t then 1 else 0) = - (if 55 = (triangleEdges t).1 then 1 else 0) - - (if 55 = (triangleEdges t).2.1 then 1 else 0) + - (if 55 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_56 : ∀ t : Fin 270, - rowEval (d2Row 56) (fun j => if j = t then 1 else 0) = - (if 56 = (triangleEdges t).1 then 1 else 0) - - (if 56 = (triangleEdges t).2.1 then 1 else 0) + - (if 56 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_57 : ∀ t : Fin 270, - rowEval (d2Row 57) (fun j => if j = t then 1 else 0) = - (if 57 = (triangleEdges t).1 then 1 else 0) - - (if 57 = (triangleEdges t).2.1 then 1 else 0) + - (if 57 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_58 : ∀ t : Fin 270, - rowEval (d2Row 58) (fun j => if j = t then 1 else 0) = - (if 58 = (triangleEdges t).1 then 1 else 0) - - (if 58 = (triangleEdges t).2.1 then 1 else 0) + - (if 58 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_59 : ∀ t : Fin 270, - rowEval (d2Row 59) (fun j => if j = t then 1 else 0) = - (if 59 = (triangleEdges t).1 then 1 else 0) - - (if 59 = (triangleEdges t).2.1 then 1 else 0) + - (if 59 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_60 : ∀ t : Fin 270, - rowEval (d2Row 60) (fun j => if j = t then 1 else 0) = - (if 60 = (triangleEdges t).1 then 1 else 0) - - (if 60 = (triangleEdges t).2.1 then 1 else 0) + - (if 60 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_61 : ∀ t : Fin 270, - rowEval (d2Row 61) (fun j => if j = t then 1 else 0) = - (if 61 = (triangleEdges t).1 then 1 else 0) - - (if 61 = (triangleEdges t).2.1 then 1 else 0) + - (if 61 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_62 : ∀ t : Fin 270, - rowEval (d2Row 62) (fun j => if j = t then 1 else 0) = - (if 62 = (triangleEdges t).1 then 1 else 0) - - (if 62 = (triangleEdges t).2.1 then 1 else 0) + - (if 62 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_63 : ∀ t : Fin 270, - rowEval (d2Row 63) (fun j => if j = t then 1 else 0) = - (if 63 = (triangleEdges t).1 then 1 else 0) - - (if 63 = (triangleEdges t).2.1 then 1 else 0) + - (if 63 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_64 : ∀ t : Fin 270, - rowEval (d2Row 64) (fun j => if j = t then 1 else 0) = - (if 64 = (triangleEdges t).1 then 1 else 0) - - (if 64 = (triangleEdges t).2.1 then 1 else 0) + - (if 64 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_65 : ∀ t : Fin 270, - rowEval (d2Row 65) (fun j => if j = t then 1 else 0) = - (if 65 = (triangleEdges t).1 then 1 else 0) - - (if 65 = (triangleEdges t).2.1 then 1 else 0) + - (if 65 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_66 : ∀ t : Fin 270, - rowEval (d2Row 66) (fun j => if j = t then 1 else 0) = - (if 66 = (triangleEdges t).1 then 1 else 0) - - (if 66 = (triangleEdges t).2.1 then 1 else 0) + - (if 66 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_67 : ∀ t : Fin 270, - rowEval (d2Row 67) (fun j => if j = t then 1 else 0) = - (if 67 = (triangleEdges t).1 then 1 else 0) - - (if 67 = (triangleEdges t).2.1 then 1 else 0) + - (if 67 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_68 : ∀ t : Fin 270, - rowEval (d2Row 68) (fun j => if j = t then 1 else 0) = - (if 68 = (triangleEdges t).1 then 1 else 0) - - (if 68 = (triangleEdges t).2.1 then 1 else 0) + - (if 68 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_69 : ∀ t : Fin 270, - rowEval (d2Row 69) (fun j => if j = t then 1 else 0) = - (if 69 = (triangleEdges t).1 then 1 else 0) - - (if 69 = (triangleEdges t).2.1 then 1 else 0) + - (if 69 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_70 : ∀ t : Fin 270, - rowEval (d2Row 70) (fun j => if j = t then 1 else 0) = - (if 70 = (triangleEdges t).1 then 1 else 0) - - (if 70 = (triangleEdges t).2.1 then 1 else 0) + - (if 70 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_71 : ∀ t : Fin 270, - rowEval (d2Row 71) (fun j => if j = t then 1 else 0) = - (if 71 = (triangleEdges t).1 then 1 else 0) - - (if 71 = (triangleEdges t).2.1 then 1 else 0) + - (if 71 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_72 : ∀ t : Fin 270, - rowEval (d2Row 72) (fun j => if j = t then 1 else 0) = - (if 72 = (triangleEdges t).1 then 1 else 0) - - (if 72 = (triangleEdges t).2.1 then 1 else 0) + - (if 72 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_73 : ∀ t : Fin 270, - rowEval (d2Row 73) (fun j => if j = t then 1 else 0) = - (if 73 = (triangleEdges t).1 then 1 else 0) - - (if 73 = (triangleEdges t).2.1 then 1 else 0) + - (if 73 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_74 : ∀ t : Fin 270, - rowEval (d2Row 74) (fun j => if j = t then 1 else 0) = - (if 74 = (triangleEdges t).1 then 1 else 0) - - (if 74 = (triangleEdges t).2.1 then 1 else 0) + - (if 74 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_75 : ∀ t : Fin 270, - rowEval (d2Row 75) (fun j => if j = t then 1 else 0) = - (if 75 = (triangleEdges t).1 then 1 else 0) - - (if 75 = (triangleEdges t).2.1 then 1 else 0) + - (if 75 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_76 : ∀ t : Fin 270, - rowEval (d2Row 76) (fun j => if j = t then 1 else 0) = - (if 76 = (triangleEdges t).1 then 1 else 0) - - (if 76 = (triangleEdges t).2.1 then 1 else 0) + - (if 76 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_77 : ∀ t : Fin 270, - rowEval (d2Row 77) (fun j => if j = t then 1 else 0) = - (if 77 = (triangleEdges t).1 then 1 else 0) - - (if 77 = (triangleEdges t).2.1 then 1 else 0) + - (if 77 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_78 : ∀ t : Fin 270, - rowEval (d2Row 78) (fun j => if j = t then 1 else 0) = - (if 78 = (triangleEdges t).1 then 1 else 0) - - (if 78 = (triangleEdges t).2.1 then 1 else 0) + - (if 78 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_79 : ∀ t : Fin 270, - rowEval (d2Row 79) (fun j => if j = t then 1 else 0) = - (if 79 = (triangleEdges t).1 then 1 else 0) - - (if 79 = (triangleEdges t).2.1 then 1 else 0) + - (if 79 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_80 : ∀ t : Fin 270, - rowEval (d2Row 80) (fun j => if j = t then 1 else 0) = - (if 80 = (triangleEdges t).1 then 1 else 0) - - (if 80 = (triangleEdges t).2.1 then 1 else 0) + - (if 80 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_81 : ∀ t : Fin 270, - rowEval (d2Row 81) (fun j => if j = t then 1 else 0) = - (if 81 = (triangleEdges t).1 then 1 else 0) - - (if 81 = (triangleEdges t).2.1 then 1 else 0) + - (if 81 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_82 : ∀ t : Fin 270, - rowEval (d2Row 82) (fun j => if j = t then 1 else 0) = - (if 82 = (triangleEdges t).1 then 1 else 0) - - (if 82 = (triangleEdges t).2.1 then 1 else 0) + - (if 82 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_83 : ∀ t : Fin 270, - rowEval (d2Row 83) (fun j => if j = t then 1 else 0) = - (if 83 = (triangleEdges t).1 then 1 else 0) - - (if 83 = (triangleEdges t).2.1 then 1 else 0) + - (if 83 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_84 : ∀ t : Fin 270, - rowEval (d2Row 84) (fun j => if j = t then 1 else 0) = - (if 84 = (triangleEdges t).1 then 1 else 0) - - (if 84 = (triangleEdges t).2.1 then 1 else 0) + - (if 84 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_85 : ∀ t : Fin 270, - rowEval (d2Row 85) (fun j => if j = t then 1 else 0) = - (if 85 = (triangleEdges t).1 then 1 else 0) - - (if 85 = (triangleEdges t).2.1 then 1 else 0) + - (if 85 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_86 : ∀ t : Fin 270, - rowEval (d2Row 86) (fun j => if j = t then 1 else 0) = - (if 86 = (triangleEdges t).1 then 1 else 0) - - (if 86 = (triangleEdges t).2.1 then 1 else 0) + - (if 86 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_87 : ∀ t : Fin 270, - rowEval (d2Row 87) (fun j => if j = t then 1 else 0) = - (if 87 = (triangleEdges t).1 then 1 else 0) - - (if 87 = (triangleEdges t).2.1 then 1 else 0) + - (if 87 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_88 : ∀ t : Fin 270, - rowEval (d2Row 88) (fun j => if j = t then 1 else 0) = - (if 88 = (triangleEdges t).1 then 1 else 0) - - (if 88 = (triangleEdges t).2.1 then 1 else 0) + - (if 88 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_89 : ∀ t : Fin 270, - rowEval (d2Row 89) (fun j => if j = t then 1 else 0) = - (if 89 = (triangleEdges t).1 then 1 else 0) - - (if 89 = (triangleEdges t).2.1 then 1 else 0) + - (if 89 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_90 : ∀ t : Fin 270, - rowEval (d2Row 90) (fun j => if j = t then 1 else 0) = - (if 90 = (triangleEdges t).1 then 1 else 0) - - (if 90 = (triangleEdges t).2.1 then 1 else 0) + - (if 90 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_91 : ∀ t : Fin 270, - rowEval (d2Row 91) (fun j => if j = t then 1 else 0) = - (if 91 = (triangleEdges t).1 then 1 else 0) - - (if 91 = (triangleEdges t).2.1 then 1 else 0) + - (if 91 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_92 : ∀ t : Fin 270, - rowEval (d2Row 92) (fun j => if j = t then 1 else 0) = - (if 92 = (triangleEdges t).1 then 1 else 0) - - (if 92 = (triangleEdges t).2.1 then 1 else 0) + - (if 92 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_93 : ∀ t : Fin 270, - rowEval (d2Row 93) (fun j => if j = t then 1 else 0) = - (if 93 = (triangleEdges t).1 then 1 else 0) - - (if 93 = (triangleEdges t).2.1 then 1 else 0) + - (if 93 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_94 : ∀ t : Fin 270, - rowEval (d2Row 94) (fun j => if j = t then 1 else 0) = - (if 94 = (triangleEdges t).1 then 1 else 0) - - (if 94 = (triangleEdges t).2.1 then 1 else 0) + - (if 94 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_95 : ∀ t : Fin 270, - rowEval (d2Row 95) (fun j => if j = t then 1 else 0) = - (if 95 = (triangleEdges t).1 then 1 else 0) - - (if 95 = (triangleEdges t).2.1 then 1 else 0) + - (if 95 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_96 : ∀ t : Fin 270, - rowEval (d2Row 96) (fun j => if j = t then 1 else 0) = - (if 96 = (triangleEdges t).1 then 1 else 0) - - (if 96 = (triangleEdges t).2.1 then 1 else 0) + - (if 96 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_97 : ∀ t : Fin 270, - rowEval (d2Row 97) (fun j => if j = t then 1 else 0) = - (if 97 = (triangleEdges t).1 then 1 else 0) - - (if 97 = (triangleEdges t).2.1 then 1 else 0) + - (if 97 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_98 : ∀ t : Fin 270, - rowEval (d2Row 98) (fun j => if j = t then 1 else 0) = - (if 98 = (triangleEdges t).1 then 1 else 0) - - (if 98 = (triangleEdges t).2.1 then 1 else 0) + - (if 98 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_99 : ∀ t : Fin 270, - rowEval (d2Row 99) (fun j => if j = t then 1 else 0) = - (if 99 = (triangleEdges t).1 then 1 else 0) - - (if 99 = (triangleEdges t).2.1 then 1 else 0) + - (if 99 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_100 : ∀ t : Fin 270, - rowEval (d2Row 100) (fun j => if j = t then 1 else 0) = - (if 100 = (triangleEdges t).1 then 1 else 0) - - (if 100 = (triangleEdges t).2.1 then 1 else 0) + - (if 100 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_101 : ∀ t : Fin 270, - rowEval (d2Row 101) (fun j => if j = t then 1 else 0) = - (if 101 = (triangleEdges t).1 then 1 else 0) - - (if 101 = (triangleEdges t).2.1 then 1 else 0) + - (if 101 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_102 : ∀ t : Fin 270, - rowEval (d2Row 102) (fun j => if j = t then 1 else 0) = - (if 102 = (triangleEdges t).1 then 1 else 0) - - (if 102 = (triangleEdges t).2.1 then 1 else 0) + - (if 102 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_103 : ∀ t : Fin 270, - rowEval (d2Row 103) (fun j => if j = t then 1 else 0) = - (if 103 = (triangleEdges t).1 then 1 else 0) - - (if 103 = (triangleEdges t).2.1 then 1 else 0) + - (if 103 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_104 : ∀ t : Fin 270, - rowEval (d2Row 104) (fun j => if j = t then 1 else 0) = - (if 104 = (triangleEdges t).1 then 1 else 0) - - (if 104 = (triangleEdges t).2.1 then 1 else 0) + - (if 104 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_105 : ∀ t : Fin 270, - rowEval (d2Row 105) (fun j => if j = t then 1 else 0) = - (if 105 = (triangleEdges t).1 then 1 else 0) - - (if 105 = (triangleEdges t).2.1 then 1 else 0) + - (if 105 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_106 : ∀ t : Fin 270, - rowEval (d2Row 106) (fun j => if j = t then 1 else 0) = - (if 106 = (triangleEdges t).1 then 1 else 0) - - (if 106 = (triangleEdges t).2.1 then 1 else 0) + - (if 106 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_107 : ∀ t : Fin 270, - rowEval (d2Row 107) (fun j => if j = t then 1 else 0) = - (if 107 = (triangleEdges t).1 then 1 else 0) - - (if 107 = (triangleEdges t).2.1 then 1 else 0) + - (if 107 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_108 : ∀ t : Fin 270, - rowEval (d2Row 108) (fun j => if j = t then 1 else 0) = - (if 108 = (triangleEdges t).1 then 1 else 0) - - (if 108 = (triangleEdges t).2.1 then 1 else 0) + - (if 108 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_109 : ∀ t : Fin 270, - rowEval (d2Row 109) (fun j => if j = t then 1 else 0) = - (if 109 = (triangleEdges t).1 then 1 else 0) - - (if 109 = (triangleEdges t).2.1 then 1 else 0) + - (if 109 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_110 : ∀ t : Fin 270, - rowEval (d2Row 110) (fun j => if j = t then 1 else 0) = - (if 110 = (triangleEdges t).1 then 1 else 0) - - (if 110 = (triangleEdges t).2.1 then 1 else 0) + - (if 110 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_111 : ∀ t : Fin 270, - rowEval (d2Row 111) (fun j => if j = t then 1 else 0) = - (if 111 = (triangleEdges t).1 then 1 else 0) - - (if 111 = (triangleEdges t).2.1 then 1 else 0) + - (if 111 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_112 : ∀ t : Fin 270, - rowEval (d2Row 112) (fun j => if j = t then 1 else 0) = - (if 112 = (triangleEdges t).1 then 1 else 0) - - (if 112 = (triangleEdges t).2.1 then 1 else 0) + - (if 112 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_113 : ∀ t : Fin 270, - rowEval (d2Row 113) (fun j => if j = t then 1 else 0) = - (if 113 = (triangleEdges t).1 then 1 else 0) - - (if 113 = (triangleEdges t).2.1 then 1 else 0) + - (if 113 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_114 : ∀ t : Fin 270, - rowEval (d2Row 114) (fun j => if j = t then 1 else 0) = - (if 114 = (triangleEdges t).1 then 1 else 0) - - (if 114 = (triangleEdges t).2.1 then 1 else 0) + - (if 114 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_115 : ∀ t : Fin 270, - rowEval (d2Row 115) (fun j => if j = t then 1 else 0) = - (if 115 = (triangleEdges t).1 then 1 else 0) - - (if 115 = (triangleEdges t).2.1 then 1 else 0) + - (if 115 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_116 : ∀ t : Fin 270, - rowEval (d2Row 116) (fun j => if j = t then 1 else 0) = - (if 116 = (triangleEdges t).1 then 1 else 0) - - (if 116 = (triangleEdges t).2.1 then 1 else 0) + - (if 116 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_117 : ∀ t : Fin 270, - rowEval (d2Row 117) (fun j => if j = t then 1 else 0) = - (if 117 = (triangleEdges t).1 then 1 else 0) - - (if 117 = (triangleEdges t).2.1 then 1 else 0) + - (if 117 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_118 : ∀ t : Fin 270, - rowEval (d2Row 118) (fun j => if j = t then 1 else 0) = - (if 118 = (triangleEdges t).1 then 1 else 0) - - (if 118 = (triangleEdges t).2.1 then 1 else 0) + - (if 118 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_119 : ∀ t : Fin 270, - rowEval (d2Row 119) (fun j => if j = t then 1 else 0) = - (if 119 = (triangleEdges t).1 then 1 else 0) - - (if 119 = (triangleEdges t).2.1 then 1 else 0) + - (if 119 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_120 : ∀ t : Fin 270, - rowEval (d2Row 120) (fun j => if j = t then 1 else 0) = - (if 120 = (triangleEdges t).1 then 1 else 0) - - (if 120 = (triangleEdges t).2.1 then 1 else 0) + - (if 120 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_121 : ∀ t : Fin 270, - rowEval (d2Row 121) (fun j => if j = t then 1 else 0) = - (if 121 = (triangleEdges t).1 then 1 else 0) - - (if 121 = (triangleEdges t).2.1 then 1 else 0) + - (if 121 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_122 : ∀ t : Fin 270, - rowEval (d2Row 122) (fun j => if j = t then 1 else 0) = - (if 122 = (triangleEdges t).1 then 1 else 0) - - (if 122 = (triangleEdges t).2.1 then 1 else 0) + - (if 122 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_123 : ∀ t : Fin 270, - rowEval (d2Row 123) (fun j => if j = t then 1 else 0) = - (if 123 = (triangleEdges t).1 then 1 else 0) - - (if 123 = (triangleEdges t).2.1 then 1 else 0) + - (if 123 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_124 : ∀ t : Fin 270, - rowEval (d2Row 124) (fun j => if j = t then 1 else 0) = - (if 124 = (triangleEdges t).1 then 1 else 0) - - (if 124 = (triangleEdges t).2.1 then 1 else 0) + - (if 124 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_125 : ∀ t : Fin 270, - rowEval (d2Row 125) (fun j => if j = t then 1 else 0) = - (if 125 = (triangleEdges t).1 then 1 else 0) - - (if 125 = (triangleEdges t).2.1 then 1 else 0) + - (if 125 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_126 : ∀ t : Fin 270, - rowEval (d2Row 126) (fun j => if j = t then 1 else 0) = - (if 126 = (triangleEdges t).1 then 1 else 0) - - (if 126 = (triangleEdges t).2.1 then 1 else 0) + - (if 126 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_127 : ∀ t : Fin 270, - rowEval (d2Row 127) (fun j => if j = t then 1 else 0) = - (if 127 = (triangleEdges t).1 then 1 else 0) - - (if 127 = (triangleEdges t).2.1 then 1 else 0) + - (if 127 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_128 : ∀ t : Fin 270, - rowEval (d2Row 128) (fun j => if j = t then 1 else 0) = - (if 128 = (triangleEdges t).1 then 1 else 0) - - (if 128 = (triangleEdges t).2.1 then 1 else 0) + - (if 128 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_129 : ∀ t : Fin 270, - rowEval (d2Row 129) (fun j => if j = t then 1 else 0) = - (if 129 = (triangleEdges t).1 then 1 else 0) - - (if 129 = (triangleEdges t).2.1 then 1 else 0) + - (if 129 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_130 : ∀ t : Fin 270, - rowEval (d2Row 130) (fun j => if j = t then 1 else 0) = - (if 130 = (triangleEdges t).1 then 1 else 0) - - (if 130 = (triangleEdges t).2.1 then 1 else 0) + - (if 130 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_131 : ∀ t : Fin 270, - rowEval (d2Row 131) (fun j => if j = t then 1 else 0) = - (if 131 = (triangleEdges t).1 then 1 else 0) - - (if 131 = (triangleEdges t).2.1 then 1 else 0) + - (if 131 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_132 : ∀ t : Fin 270, - rowEval (d2Row 132) (fun j => if j = t then 1 else 0) = - (if 132 = (triangleEdges t).1 then 1 else 0) - - (if 132 = (triangleEdges t).2.1 then 1 else 0) + - (if 132 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_133 : ∀ t : Fin 270, - rowEval (d2Row 133) (fun j => if j = t then 1 else 0) = - (if 133 = (triangleEdges t).1 then 1 else 0) - - (if 133 = (triangleEdges t).2.1 then 1 else 0) + - (if 133 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_134 : ∀ t : Fin 270, - rowEval (d2Row 134) (fun j => if j = t then 1 else 0) = - (if 134 = (triangleEdges t).1 then 1 else 0) - - (if 134 = (triangleEdges t).2.1 then 1 else 0) + - (if 134 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_135 : ∀ t : Fin 270, - rowEval (d2Row 135) (fun j => if j = t then 1 else 0) = - (if 135 = (triangleEdges t).1 then 1 else 0) - - (if 135 = (triangleEdges t).2.1 then 1 else 0) + - (if 135 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_136 : ∀ t : Fin 270, - rowEval (d2Row 136) (fun j => if j = t then 1 else 0) = - (if 136 = (triangleEdges t).1 then 1 else 0) - - (if 136 = (triangleEdges t).2.1 then 1 else 0) + - (if 136 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_137 : ∀ t : Fin 270, - rowEval (d2Row 137) (fun j => if j = t then 1 else 0) = - (if 137 = (triangleEdges t).1 then 1 else 0) - - (if 137 = (triangleEdges t).2.1 then 1 else 0) + - (if 137 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_138 : ∀ t : Fin 270, - rowEval (d2Row 138) (fun j => if j = t then 1 else 0) = - (if 138 = (triangleEdges t).1 then 1 else 0) - - (if 138 = (triangleEdges t).2.1 then 1 else 0) + - (if 138 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_139 : ∀ t : Fin 270, - rowEval (d2Row 139) (fun j => if j = t then 1 else 0) = - (if 139 = (triangleEdges t).1 then 1 else 0) - - (if 139 = (triangleEdges t).2.1 then 1 else 0) + - (if 139 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_140 : ∀ t : Fin 270, - rowEval (d2Row 140) (fun j => if j = t then 1 else 0) = - (if 140 = (triangleEdges t).1 then 1 else 0) - - (if 140 = (triangleEdges t).2.1 then 1 else 0) + - (if 140 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_141 : ∀ t : Fin 270, - rowEval (d2Row 141) (fun j => if j = t then 1 else 0) = - (if 141 = (triangleEdges t).1 then 1 else 0) - - (if 141 = (triangleEdges t).2.1 then 1 else 0) + - (if 141 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_142 : ∀ t : Fin 270, - rowEval (d2Row 142) (fun j => if j = t then 1 else 0) = - (if 142 = (triangleEdges t).1 then 1 else 0) - - (if 142 = (triangleEdges t).2.1 then 1 else 0) + - (if 142 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_143 : ∀ t : Fin 270, - rowEval (d2Row 143) (fun j => if j = t then 1 else 0) = - (if 143 = (triangleEdges t).1 then 1 else 0) - - (if 143 = (triangleEdges t).2.1 then 1 else 0) + - (if 143 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_144 : ∀ t : Fin 270, - rowEval (d2Row 144) (fun j => if j = t then 1 else 0) = - (if 144 = (triangleEdges t).1 then 1 else 0) - - (if 144 = (triangleEdges t).2.1 then 1 else 0) + - (if 144 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_145 : ∀ t : Fin 270, - rowEval (d2Row 145) (fun j => if j = t then 1 else 0) = - (if 145 = (triangleEdges t).1 then 1 else 0) - - (if 145 = (triangleEdges t).2.1 then 1 else 0) + - (if 145 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_146 : ∀ t : Fin 270, - rowEval (d2Row 146) (fun j => if j = t then 1 else 0) = - (if 146 = (triangleEdges t).1 then 1 else 0) - - (if 146 = (triangleEdges t).2.1 then 1 else 0) + - (if 146 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_147 : ∀ t : Fin 270, - rowEval (d2Row 147) (fun j => if j = t then 1 else 0) = - (if 147 = (triangleEdges t).1 then 1 else 0) - - (if 147 = (triangleEdges t).2.1 then 1 else 0) + - (if 147 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_148 : ∀ t : Fin 270, - rowEval (d2Row 148) (fun j => if j = t then 1 else 0) = - (if 148 = (triangleEdges t).1 then 1 else 0) - - (if 148 = (triangleEdges t).2.1 then 1 else 0) + - (if 148 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_149 : ∀ t : Fin 270, - rowEval (d2Row 149) (fun j => if j = t then 1 else 0) = - (if 149 = (triangleEdges t).1 then 1 else 0) - - (if 149 = (triangleEdges t).2.1 then 1 else 0) + - (if 149 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_150 : ∀ t : Fin 270, - rowEval (d2Row 150) (fun j => if j = t then 1 else 0) = - (if 150 = (triangleEdges t).1 then 1 else 0) - - (if 150 = (triangleEdges t).2.1 then 1 else 0) + - (if 150 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_151 : ∀ t : Fin 270, - rowEval (d2Row 151) (fun j => if j = t then 1 else 0) = - (if 151 = (triangleEdges t).1 then 1 else 0) - - (if 151 = (triangleEdges t).2.1 then 1 else 0) + - (if 151 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_152 : ∀ t : Fin 270, - rowEval (d2Row 152) (fun j => if j = t then 1 else 0) = - (if 152 = (triangleEdges t).1 then 1 else 0) - - (if 152 = (triangleEdges t).2.1 then 1 else 0) + - (if 152 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_153 : ∀ t : Fin 270, - rowEval (d2Row 153) (fun j => if j = t then 1 else 0) = - (if 153 = (triangleEdges t).1 then 1 else 0) - - (if 153 = (triangleEdges t).2.1 then 1 else 0) + - (if 153 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_154 : ∀ t : Fin 270, - rowEval (d2Row 154) (fun j => if j = t then 1 else 0) = - (if 154 = (triangleEdges t).1 then 1 else 0) - - (if 154 = (triangleEdges t).2.1 then 1 else 0) + - (if 154 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_155 : ∀ t : Fin 270, - rowEval (d2Row 155) (fun j => if j = t then 1 else 0) = - (if 155 = (triangleEdges t).1 then 1 else 0) - - (if 155 = (triangleEdges t).2.1 then 1 else 0) + - (if 155 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_156 : ∀ t : Fin 270, - rowEval (d2Row 156) (fun j => if j = t then 1 else 0) = - (if 156 = (triangleEdges t).1 then 1 else 0) - - (if 156 = (triangleEdges t).2.1 then 1 else 0) + - (if 156 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_157 : ∀ t : Fin 270, - rowEval (d2Row 157) (fun j => if j = t then 1 else 0) = - (if 157 = (triangleEdges t).1 then 1 else 0) - - (if 157 = (triangleEdges t).2.1 then 1 else 0) + - (if 157 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_158 : ∀ t : Fin 270, - rowEval (d2Row 158) (fun j => if j = t then 1 else 0) = - (if 158 = (triangleEdges t).1 then 1 else 0) - - (if 158 = (triangleEdges t).2.1 then 1 else 0) + - (if 158 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_159 : ∀ t : Fin 270, - rowEval (d2Row 159) (fun j => if j = t then 1 else 0) = - (if 159 = (triangleEdges t).1 then 1 else 0) - - (if 159 = (triangleEdges t).2.1 then 1 else 0) + - (if 159 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_160 : ∀ t : Fin 270, - rowEval (d2Row 160) (fun j => if j = t then 1 else 0) = - (if 160 = (triangleEdges t).1 then 1 else 0) - - (if 160 = (triangleEdges t).2.1 then 1 else 0) + - (if 160 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_161 : ∀ t : Fin 270, - rowEval (d2Row 161) (fun j => if j = t then 1 else 0) = - (if 161 = (triangleEdges t).1 then 1 else 0) - - (if 161 = (triangleEdges t).2.1 then 1 else 0) + - (if 161 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_162 : ∀ t : Fin 270, - rowEval (d2Row 162) (fun j => if j = t then 1 else 0) = - (if 162 = (triangleEdges t).1 then 1 else 0) - - (if 162 = (triangleEdges t).2.1 then 1 else 0) + - (if 162 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_163 : ∀ t : Fin 270, - rowEval (d2Row 163) (fun j => if j = t then 1 else 0) = - (if 163 = (triangleEdges t).1 then 1 else 0) - - (if 163 = (triangleEdges t).2.1 then 1 else 0) + - (if 163 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_164 : ∀ t : Fin 270, - rowEval (d2Row 164) (fun j => if j = t then 1 else 0) = - (if 164 = (triangleEdges t).1 then 1 else 0) - - (if 164 = (triangleEdges t).2.1 then 1 else 0) + - (if 164 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_165 : ∀ t : Fin 270, - rowEval (d2Row 165) (fun j => if j = t then 1 else 0) = - (if 165 = (triangleEdges t).1 then 1 else 0) - - (if 165 = (triangleEdges t).2.1 then 1 else 0) + - (if 165 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_166 : ∀ t : Fin 270, - rowEval (d2Row 166) (fun j => if j = t then 1 else 0) = - (if 166 = (triangleEdges t).1 then 1 else 0) - - (if 166 = (triangleEdges t).2.1 then 1 else 0) + - (if 166 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_167 : ∀ t : Fin 270, - rowEval (d2Row 167) (fun j => if j = t then 1 else 0) = - (if 167 = (triangleEdges t).1 then 1 else 0) - - (if 167 = (triangleEdges t).2.1 then 1 else 0) + - (if 167 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_168 : ∀ t : Fin 270, - rowEval (d2Row 168) (fun j => if j = t then 1 else 0) = - (if 168 = (triangleEdges t).1 then 1 else 0) - - (if 168 = (triangleEdges t).2.1 then 1 else 0) + - (if 168 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_169 : ∀ t : Fin 270, - rowEval (d2Row 169) (fun j => if j = t then 1 else 0) = - (if 169 = (triangleEdges t).1 then 1 else 0) - - (if 169 = (triangleEdges t).2.1 then 1 else 0) + - (if 169 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_170 : ∀ t : Fin 270, - rowEval (d2Row 170) (fun j => if j = t then 1 else 0) = - (if 170 = (triangleEdges t).1 then 1 else 0) - - (if 170 = (triangleEdges t).2.1 then 1 else 0) + - (if 170 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_171 : ∀ t : Fin 270, - rowEval (d2Row 171) (fun j => if j = t then 1 else 0) = - (if 171 = (triangleEdges t).1 then 1 else 0) - - (if 171 = (triangleEdges t).2.1 then 1 else 0) + - (if 171 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_172 : ∀ t : Fin 270, - rowEval (d2Row 172) (fun j => if j = t then 1 else 0) = - (if 172 = (triangleEdges t).1 then 1 else 0) - - (if 172 = (triangleEdges t).2.1 then 1 else 0) + - (if 172 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_173 : ∀ t : Fin 270, - rowEval (d2Row 173) (fun j => if j = t then 1 else 0) = - (if 173 = (triangleEdges t).1 then 1 else 0) - - (if 173 = (triangleEdges t).2.1 then 1 else 0) + - (if 173 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_174 : ∀ t : Fin 270, - rowEval (d2Row 174) (fun j => if j = t then 1 else 0) = - (if 174 = (triangleEdges t).1 then 1 else 0) - - (if 174 = (triangleEdges t).2.1 then 1 else 0) + - (if 174 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_175 : ∀ t : Fin 270, - rowEval (d2Row 175) (fun j => if j = t then 1 else 0) = - (if 175 = (triangleEdges t).1 then 1 else 0) - - (if 175 = (triangleEdges t).2.1 then 1 else 0) + - (if 175 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_176 : ∀ t : Fin 270, - rowEval (d2Row 176) (fun j => if j = t then 1 else 0) = - (if 176 = (triangleEdges t).1 then 1 else 0) - - (if 176 = (triangleEdges t).2.1 then 1 else 0) + - (if 176 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_177 : ∀ t : Fin 270, - rowEval (d2Row 177) (fun j => if j = t then 1 else 0) = - (if 177 = (triangleEdges t).1 then 1 else 0) - - (if 177 = (triangleEdges t).2.1 then 1 else 0) + - (if 177 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_178 : ∀ t : Fin 270, - rowEval (d2Row 178) (fun j => if j = t then 1 else 0) = - (if 178 = (triangleEdges t).1 then 1 else 0) - - (if 178 = (triangleEdges t).2.1 then 1 else 0) + - (if 178 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_179 : ∀ t : Fin 270, - rowEval (d2Row 179) (fun j => if j = t then 1 else 0) = - (if 179 = (triangleEdges t).1 then 1 else 0) - - (if 179 = (triangleEdges t).2.1 then 1 else 0) + - (if 179 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_180 : ∀ t : Fin 270, - rowEval (d2Row 180) (fun j => if j = t then 1 else 0) = - (if 180 = (triangleEdges t).1 then 1 else 0) - - (if 180 = (triangleEdges t).2.1 then 1 else 0) + - (if 180 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_181 : ∀ t : Fin 270, - rowEval (d2Row 181) (fun j => if j = t then 1 else 0) = - (if 181 = (triangleEdges t).1 then 1 else 0) - - (if 181 = (triangleEdges t).2.1 then 1 else 0) + - (if 181 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_182 : ∀ t : Fin 270, - rowEval (d2Row 182) (fun j => if j = t then 1 else 0) = - (if 182 = (triangleEdges t).1 then 1 else 0) - - (if 182 = (triangleEdges t).2.1 then 1 else 0) + - (if 182 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_183 : ∀ t : Fin 270, - rowEval (d2Row 183) (fun j => if j = t then 1 else 0) = - (if 183 = (triangleEdges t).1 then 1 else 0) - - (if 183 = (triangleEdges t).2.1 then 1 else 0) + - (if 183 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_184 : ∀ t : Fin 270, - rowEval (d2Row 184) (fun j => if j = t then 1 else 0) = - (if 184 = (triangleEdges t).1 then 1 else 0) - - (if 184 = (triangleEdges t).2.1 then 1 else 0) + - (if 184 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_185 : ∀ t : Fin 270, - rowEval (d2Row 185) (fun j => if j = t then 1 else 0) = - (if 185 = (triangleEdges t).1 then 1 else 0) - - (if 185 = (triangleEdges t).2.1 then 1 else 0) + - (if 185 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_186 : ∀ t : Fin 270, - rowEval (d2Row 186) (fun j => if j = t then 1 else 0) = - (if 186 = (triangleEdges t).1 then 1 else 0) - - (if 186 = (triangleEdges t).2.1 then 1 else 0) + - (if 186 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_187 : ∀ t : Fin 270, - rowEval (d2Row 187) (fun j => if j = t then 1 else 0) = - (if 187 = (triangleEdges t).1 then 1 else 0) - - (if 187 = (triangleEdges t).2.1 then 1 else 0) + - (if 187 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_188 : ∀ t : Fin 270, - rowEval (d2Row 188) (fun j => if j = t then 1 else 0) = - (if 188 = (triangleEdges t).1 then 1 else 0) - - (if 188 = (triangleEdges t).2.1 then 1 else 0) + - (if 188 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_189 : ∀ t : Fin 270, - rowEval (d2Row 189) (fun j => if j = t then 1 else 0) = - (if 189 = (triangleEdges t).1 then 1 else 0) - - (if 189 = (triangleEdges t).2.1 then 1 else 0) + - (if 189 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_190 : ∀ t : Fin 270, - rowEval (d2Row 190) (fun j => if j = t then 1 else 0) = - (if 190 = (triangleEdges t).1 then 1 else 0) - - (if 190 = (triangleEdges t).2.1 then 1 else 0) + - (if 190 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_191 : ∀ t : Fin 270, - rowEval (d2Row 191) (fun j => if j = t then 1 else 0) = - (if 191 = (triangleEdges t).1 then 1 else 0) - - (if 191 = (triangleEdges t).2.1 then 1 else 0) + - (if 191 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_192 : ∀ t : Fin 270, - rowEval (d2Row 192) (fun j => if j = t then 1 else 0) = - (if 192 = (triangleEdges t).1 then 1 else 0) - - (if 192 = (triangleEdges t).2.1 then 1 else 0) + - (if 192 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_193 : ∀ t : Fin 270, - rowEval (d2Row 193) (fun j => if j = t then 1 else 0) = - (if 193 = (triangleEdges t).1 then 1 else 0) - - (if 193 = (triangleEdges t).2.1 then 1 else 0) + - (if 193 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_194 : ∀ t : Fin 270, - rowEval (d2Row 194) (fun j => if j = t then 1 else 0) = - (if 194 = (triangleEdges t).1 then 1 else 0) - - (if 194 = (triangleEdges t).2.1 then 1 else 0) + - (if 194 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_195 : ∀ t : Fin 270, - rowEval (d2Row 195) (fun j => if j = t then 1 else 0) = - (if 195 = (triangleEdges t).1 then 1 else 0) - - (if 195 = (triangleEdges t).2.1 then 1 else 0) + - (if 195 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_196 : ∀ t : Fin 270, - rowEval (d2Row 196) (fun j => if j = t then 1 else 0) = - (if 196 = (triangleEdges t).1 then 1 else 0) - - (if 196 = (triangleEdges t).2.1 then 1 else 0) + - (if 196 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_197 : ∀ t : Fin 270, - rowEval (d2Row 197) (fun j => if j = t then 1 else 0) = - (if 197 = (triangleEdges t).1 then 1 else 0) - - (if 197 = (triangleEdges t).2.1 then 1 else 0) + - (if 197 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_198 : ∀ t : Fin 270, - rowEval (d2Row 198) (fun j => if j = t then 1 else 0) = - (if 198 = (triangleEdges t).1 then 1 else 0) - - (if 198 = (triangleEdges t).2.1 then 1 else 0) + - (if 198 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_199 : ∀ t : Fin 270, - rowEval (d2Row 199) (fun j => if j = t then 1 else 0) = - (if 199 = (triangleEdges t).1 then 1 else 0) - - (if 199 = (triangleEdges t).2.1 then 1 else 0) + - (if 199 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_200 : ∀ t : Fin 270, - rowEval (d2Row 200) (fun j => if j = t then 1 else 0) = - (if 200 = (triangleEdges t).1 then 1 else 0) - - (if 200 = (triangleEdges t).2.1 then 1 else 0) + - (if 200 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_201 : ∀ t : Fin 270, - rowEval (d2Row 201) (fun j => if j = t then 1 else 0) = - (if 201 = (triangleEdges t).1 then 1 else 0) - - (if 201 = (triangleEdges t).2.1 then 1 else 0) + - (if 201 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_202 : ∀ t : Fin 270, - rowEval (d2Row 202) (fun j => if j = t then 1 else 0) = - (if 202 = (triangleEdges t).1 then 1 else 0) - - (if 202 = (triangleEdges t).2.1 then 1 else 0) + - (if 202 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_203 : ∀ t : Fin 270, - rowEval (d2Row 203) (fun j => if j = t then 1 else 0) = - (if 203 = (triangleEdges t).1 then 1 else 0) - - (if 203 = (triangleEdges t).2.1 then 1 else 0) + - (if 203 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_204 : ∀ t : Fin 270, - rowEval (d2Row 204) (fun j => if j = t then 1 else 0) = - (if 204 = (triangleEdges t).1 then 1 else 0) - - (if 204 = (triangleEdges t).2.1 then 1 else 0) + - (if 204 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_205 : ∀ t : Fin 270, - rowEval (d2Row 205) (fun j => if j = t then 1 else 0) = - (if 205 = (triangleEdges t).1 then 1 else 0) - - (if 205 = (triangleEdges t).2.1 then 1 else 0) + - (if 205 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_206 : ∀ t : Fin 270, - rowEval (d2Row 206) (fun j => if j = t then 1 else 0) = - (if 206 = (triangleEdges t).1 then 1 else 0) - - (if 206 = (triangleEdges t).2.1 then 1 else 0) + - (if 206 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_207 : ∀ t : Fin 270, - rowEval (d2Row 207) (fun j => if j = t then 1 else 0) = - (if 207 = (triangleEdges t).1 then 1 else 0) - - (if 207 = (triangleEdges t).2.1 then 1 else 0) + - (if 207 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_208 : ∀ t : Fin 270, - rowEval (d2Row 208) (fun j => if j = t then 1 else 0) = - (if 208 = (triangleEdges t).1 then 1 else 0) - - (if 208 = (triangleEdges t).2.1 then 1 else 0) + - (if 208 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_209 : ∀ t : Fin 270, - rowEval (d2Row 209) (fun j => if j = t then 1 else 0) = - (if 209 = (triangleEdges t).1 then 1 else 0) - - (if 209 = (triangleEdges t).2.1 then 1 else 0) + - (if 209 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_210 : ∀ t : Fin 270, - rowEval (d2Row 210) (fun j => if j = t then 1 else 0) = - (if 210 = (triangleEdges t).1 then 1 else 0) - - (if 210 = (triangleEdges t).2.1 then 1 else 0) + - (if 210 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_211 : ∀ t : Fin 270, - rowEval (d2Row 211) (fun j => if j = t then 1 else 0) = - (if 211 = (triangleEdges t).1 then 1 else 0) - - (if 211 = (triangleEdges t).2.1 then 1 else 0) + - (if 211 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_212 : ∀ t : Fin 270, - rowEval (d2Row 212) (fun j => if j = t then 1 else 0) = - (if 212 = (triangleEdges t).1 then 1 else 0) - - (if 212 = (triangleEdges t).2.1 then 1 else 0) + - (if 212 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_213 : ∀ t : Fin 270, - rowEval (d2Row 213) (fun j => if j = t then 1 else 0) = - (if 213 = (triangleEdges t).1 then 1 else 0) - - (if 213 = (triangleEdges t).2.1 then 1 else 0) + - (if 213 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_214 : ∀ t : Fin 270, - rowEval (d2Row 214) (fun j => if j = t then 1 else 0) = - (if 214 = (triangleEdges t).1 then 1 else 0) - - (if 214 = (triangleEdges t).2.1 then 1 else 0) + - (if 214 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_215 : ∀ t : Fin 270, - rowEval (d2Row 215) (fun j => if j = t then 1 else 0) = - (if 215 = (triangleEdges t).1 then 1 else 0) - - (if 215 = (triangleEdges t).2.1 then 1 else 0) + - (if 215 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_216 : ∀ t : Fin 270, - rowEval (d2Row 216) (fun j => if j = t then 1 else 0) = - (if 216 = (triangleEdges t).1 then 1 else 0) - - (if 216 = (triangleEdges t).2.1 then 1 else 0) + - (if 216 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_217 : ∀ t : Fin 270, - rowEval (d2Row 217) (fun j => if j = t then 1 else 0) = - (if 217 = (triangleEdges t).1 then 1 else 0) - - (if 217 = (triangleEdges t).2.1 then 1 else 0) + - (if 217 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_218 : ∀ t : Fin 270, - rowEval (d2Row 218) (fun j => if j = t then 1 else 0) = - (if 218 = (triangleEdges t).1 then 1 else 0) - - (if 218 = (triangleEdges t).2.1 then 1 else 0) + - (if 218 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_219 : ∀ t : Fin 270, - rowEval (d2Row 219) (fun j => if j = t then 1 else 0) = - (if 219 = (triangleEdges t).1 then 1 else 0) - - (if 219 = (triangleEdges t).2.1 then 1 else 0) + - (if 219 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_220 : ∀ t : Fin 270, - rowEval (d2Row 220) (fun j => if j = t then 1 else 0) = - (if 220 = (triangleEdges t).1 then 1 else 0) - - (if 220 = (triangleEdges t).2.1 then 1 else 0) + - (if 220 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_221 : ∀ t : Fin 270, - rowEval (d2Row 221) (fun j => if j = t then 1 else 0) = - (if 221 = (triangleEdges t).1 then 1 else 0) - - (if 221 = (triangleEdges t).2.1 then 1 else 0) + - (if 221 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_222 : ∀ t : Fin 270, - rowEval (d2Row 222) (fun j => if j = t then 1 else 0) = - (if 222 = (triangleEdges t).1 then 1 else 0) - - (if 222 = (triangleEdges t).2.1 then 1 else 0) + - (if 222 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_223 : ∀ t : Fin 270, - rowEval (d2Row 223) (fun j => if j = t then 1 else 0) = - (if 223 = (triangleEdges t).1 then 1 else 0) - - (if 223 = (triangleEdges t).2.1 then 1 else 0) + - (if 223 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_224 : ∀ t : Fin 270, - rowEval (d2Row 224) (fun j => if j = t then 1 else 0) = - (if 224 = (triangleEdges t).1 then 1 else 0) - - (if 224 = (triangleEdges t).2.1 then 1 else 0) + - (if 224 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_225 : ∀ t : Fin 270, - rowEval (d2Row 225) (fun j => if j = t then 1 else 0) = - (if 225 = (triangleEdges t).1 then 1 else 0) - - (if 225 = (triangleEdges t).2.1 then 1 else 0) + - (if 225 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_226 : ∀ t : Fin 270, - rowEval (d2Row 226) (fun j => if j = t then 1 else 0) = - (if 226 = (triangleEdges t).1 then 1 else 0) - - (if 226 = (triangleEdges t).2.1 then 1 else 0) + - (if 226 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_227 : ∀ t : Fin 270, - rowEval (d2Row 227) (fun j => if j = t then 1 else 0) = - (if 227 = (triangleEdges t).1 then 1 else 0) - - (if 227 = (triangleEdges t).2.1 then 1 else 0) + - (if 227 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_228 : ∀ t : Fin 270, - rowEval (d2Row 228) (fun j => if j = t then 1 else 0) = - (if 228 = (triangleEdges t).1 then 1 else 0) - - (if 228 = (triangleEdges t).2.1 then 1 else 0) + - (if 228 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_229 : ∀ t : Fin 270, - rowEval (d2Row 229) (fun j => if j = t then 1 else 0) = - (if 229 = (triangleEdges t).1 then 1 else 0) - - (if 229 = (triangleEdges t).2.1 then 1 else 0) + - (if 229 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_230 : ∀ t : Fin 270, - rowEval (d2Row 230) (fun j => if j = t then 1 else 0) = - (if 230 = (triangleEdges t).1 then 1 else 0) - - (if 230 = (triangleEdges t).2.1 then 1 else 0) + - (if 230 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_231 : ∀ t : Fin 270, - rowEval (d2Row 231) (fun j => if j = t then 1 else 0) = - (if 231 = (triangleEdges t).1 then 1 else 0) - - (if 231 = (triangleEdges t).2.1 then 1 else 0) + - (if 231 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_232 : ∀ t : Fin 270, - rowEval (d2Row 232) (fun j => if j = t then 1 else 0) = - (if 232 = (triangleEdges t).1 then 1 else 0) - - (if 232 = (triangleEdges t).2.1 then 1 else 0) + - (if 232 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_233 : ∀ t : Fin 270, - rowEval (d2Row 233) (fun j => if j = t then 1 else 0) = - (if 233 = (triangleEdges t).1 then 1 else 0) - - (if 233 = (triangleEdges t).2.1 then 1 else 0) + - (if 233 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_234 : ∀ t : Fin 270, - rowEval (d2Row 234) (fun j => if j = t then 1 else 0) = - (if 234 = (triangleEdges t).1 then 1 else 0) - - (if 234 = (triangleEdges t).2.1 then 1 else 0) + - (if 234 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_235 : ∀ t : Fin 270, - rowEval (d2Row 235) (fun j => if j = t then 1 else 0) = - (if 235 = (triangleEdges t).1 then 1 else 0) - - (if 235 = (triangleEdges t).2.1 then 1 else 0) + - (if 235 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_236 : ∀ t : Fin 270, - rowEval (d2Row 236) (fun j => if j = t then 1 else 0) = - (if 236 = (triangleEdges t).1 then 1 else 0) - - (if 236 = (triangleEdges t).2.1 then 1 else 0) + - (if 236 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_237 : ∀ t : Fin 270, - rowEval (d2Row 237) (fun j => if j = t then 1 else 0) = - (if 237 = (triangleEdges t).1 then 1 else 0) - - (if 237 = (triangleEdges t).2.1 then 1 else 0) + - (if 237 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_238 : ∀ t : Fin 270, - rowEval (d2Row 238) (fun j => if j = t then 1 else 0) = - (if 238 = (triangleEdges t).1 then 1 else 0) - - (if 238 = (triangleEdges t).2.1 then 1 else 0) + - (if 238 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_239 : ∀ t : Fin 270, - rowEval (d2Row 239) (fun j => if j = t then 1 else 0) = - (if 239 = (triangleEdges t).1 then 1 else 0) - - (if 239 = (triangleEdges t).2.1 then 1 else 0) + - (if 239 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_240 : ∀ t : Fin 270, - rowEval (d2Row 240) (fun j => if j = t then 1 else 0) = - (if 240 = (triangleEdges t).1 then 1 else 0) - - (if 240 = (triangleEdges t).2.1 then 1 else 0) + - (if 240 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_241 : ∀ t : Fin 270, - rowEval (d2Row 241) (fun j => if j = t then 1 else 0) = - (if 241 = (triangleEdges t).1 then 1 else 0) - - (if 241 = (triangleEdges t).2.1 then 1 else 0) + - (if 241 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_242 : ∀ t : Fin 270, - rowEval (d2Row 242) (fun j => if j = t then 1 else 0) = - (if 242 = (triangleEdges t).1 then 1 else 0) - - (if 242 = (triangleEdges t).2.1 then 1 else 0) + - (if 242 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_243 : ∀ t : Fin 270, - rowEval (d2Row 243) (fun j => if j = t then 1 else 0) = - (if 243 = (triangleEdges t).1 then 1 else 0) - - (if 243 = (triangleEdges t).2.1 then 1 else 0) + - (if 243 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_244 : ∀ t : Fin 270, - rowEval (d2Row 244) (fun j => if j = t then 1 else 0) = - (if 244 = (triangleEdges t).1 then 1 else 0) - - (if 244 = (triangleEdges t).2.1 then 1 else 0) + - (if 244 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_245 : ∀ t : Fin 270, - rowEval (d2Row 245) (fun j => if j = t then 1 else 0) = - (if 245 = (triangleEdges t).1 then 1 else 0) - - (if 245 = (triangleEdges t).2.1 then 1 else 0) + - (if 245 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_246 : ∀ t : Fin 270, - rowEval (d2Row 246) (fun j => if j = t then 1 else 0) = - (if 246 = (triangleEdges t).1 then 1 else 0) - - (if 246 = (triangleEdges t).2.1 then 1 else 0) + - (if 246 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_247 : ∀ t : Fin 270, - rowEval (d2Row 247) (fun j => if j = t then 1 else 0) = - (if 247 = (triangleEdges t).1 then 1 else 0) - - (if 247 = (triangleEdges t).2.1 then 1 else 0) + - (if 247 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_248 : ∀ t : Fin 270, - rowEval (d2Row 248) (fun j => if j = t then 1 else 0) = - (if 248 = (triangleEdges t).1 then 1 else 0) - - (if 248 = (triangleEdges t).2.1 then 1 else 0) + - (if 248 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_249 : ∀ t : Fin 270, - rowEval (d2Row 249) (fun j => if j = t then 1 else 0) = - (if 249 = (triangleEdges t).1 then 1 else 0) - - (if 249 = (triangleEdges t).2.1 then 1 else 0) + - (if 249 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_250 : ∀ t : Fin 270, - rowEval (d2Row 250) (fun j => if j = t then 1 else 0) = - (if 250 = (triangleEdges t).1 then 1 else 0) - - (if 250 = (triangleEdges t).2.1 then 1 else 0) + - (if 250 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_251 : ∀ t : Fin 270, - rowEval (d2Row 251) (fun j => if j = t then 1 else 0) = - (if 251 = (triangleEdges t).1 then 1 else 0) - - (if 251 = (triangleEdges t).2.1 then 1 else 0) + - (if 251 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_252 : ∀ t : Fin 270, - rowEval (d2Row 252) (fun j => if j = t then 1 else 0) = - (if 252 = (triangleEdges t).1 then 1 else 0) - - (if 252 = (triangleEdges t).2.1 then 1 else 0) + - (if 252 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_253 : ∀ t : Fin 270, - rowEval (d2Row 253) (fun j => if j = t then 1 else 0) = - (if 253 = (triangleEdges t).1 then 1 else 0) - - (if 253 = (triangleEdges t).2.1 then 1 else 0) + - (if 253 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_254 : ∀ t : Fin 270, - rowEval (d2Row 254) (fun j => if j = t then 1 else 0) = - (if 254 = (triangleEdges t).1 then 1 else 0) - - (if 254 = (triangleEdges t).2.1 then 1 else 0) + - (if 254 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_255 : ∀ t : Fin 270, - rowEval (d2Row 255) (fun j => if j = t then 1 else 0) = - (if 255 = (triangleEdges t).1 then 1 else 0) - - (if 255 = (triangleEdges t).2.1 then 1 else 0) + - (if 255 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_256 : ∀ t : Fin 270, - rowEval (d2Row 256) (fun j => if j = t then 1 else 0) = - (if 256 = (triangleEdges t).1 then 1 else 0) - - (if 256 = (triangleEdges t).2.1 then 1 else 0) + - (if 256 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_257 : ∀ t : Fin 270, - rowEval (d2Row 257) (fun j => if j = t then 1 else 0) = - (if 257 = (triangleEdges t).1 then 1 else 0) - - (if 257 = (triangleEdges t).2.1 then 1 else 0) + - (if 257 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_258 : ∀ t : Fin 270, - rowEval (d2Row 258) (fun j => if j = t then 1 else 0) = - (if 258 = (triangleEdges t).1 then 1 else 0) - - (if 258 = (triangleEdges t).2.1 then 1 else 0) + - (if 258 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_259 : ∀ t : Fin 270, - rowEval (d2Row 259) (fun j => if j = t then 1 else 0) = - (if 259 = (triangleEdges t).1 then 1 else 0) - - (if 259 = (triangleEdges t).2.1 then 1 else 0) + - (if 259 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_260 : ∀ t : Fin 270, - rowEval (d2Row 260) (fun j => if j = t then 1 else 0) = - (if 260 = (triangleEdges t).1 then 1 else 0) - - (if 260 = (triangleEdges t).2.1 then 1 else 0) + - (if 260 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_261 : ∀ t : Fin 270, - rowEval (d2Row 261) (fun j => if j = t then 1 else 0) = - (if 261 = (triangleEdges t).1 then 1 else 0) - - (if 261 = (triangleEdges t).2.1 then 1 else 0) + - (if 261 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_262 : ∀ t : Fin 270, - rowEval (d2Row 262) (fun j => if j = t then 1 else 0) = - (if 262 = (triangleEdges t).1 then 1 else 0) - - (if 262 = (triangleEdges t).2.1 then 1 else 0) + - (if 262 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_263 : ∀ t : Fin 270, - rowEval (d2Row 263) (fun j => if j = t then 1 else 0) = - (if 263 = (triangleEdges t).1 then 1 else 0) - - (if 263 = (triangleEdges t).2.1 then 1 else 0) + - (if 263 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_264 : ∀ t : Fin 270, - rowEval (d2Row 264) (fun j => if j = t then 1 else 0) = - (if 264 = (triangleEdges t).1 then 1 else 0) - - (if 264 = (triangleEdges t).2.1 then 1 else 0) + - (if 264 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_265 : ∀ t : Fin 270, - rowEval (d2Row 265) (fun j => if j = t then 1 else 0) = - (if 265 = (triangleEdges t).1 then 1 else 0) - - (if 265 = (triangleEdges t).2.1 then 1 else 0) + - (if 265 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_266 : ∀ t : Fin 270, - rowEval (d2Row 266) (fun j => if j = t then 1 else 0) = - (if 266 = (triangleEdges t).1 then 1 else 0) - - (if 266 = (triangleEdges t).2.1 then 1 else 0) + - (if 266 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_267 : ∀ t : Fin 270, - rowEval (d2Row 267) (fun j => if j = t then 1 else 0) = - (if 267 = (triangleEdges t).1 then 1 else 0) - - (if 267 = (triangleEdges t).2.1 then 1 else 0) + - (if 267 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_268 : ∀ t : Fin 270, - rowEval (d2Row 268) (fun j => if j = t then 1 else 0) = - (if 268 = (triangleEdges t).1 then 1 else 0) - - (if 268 = (triangleEdges t).2.1 then 1 else 0) + - (if 268 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_269 : ∀ t : Fin 270, - rowEval (d2Row 269) (fun j => if j = t then 1 else 0) = - (if 269 = (triangleEdges t).1 then 1 else 0) - - (if 269 = (triangleEdges t).2.1 then 1 else 0) + - (if 269 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_270 : ∀ t : Fin 270, - rowEval (d2Row 270) (fun j => if j = t then 1 else 0) = - (if 270 = (triangleEdges t).1 then 1 else 0) - - (if 270 = (triangleEdges t).2.1 then 1 else 0) + - (if 270 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_271 : ∀ t : Fin 270, - rowEval (d2Row 271) (fun j => if j = t then 1 else 0) = - (if 271 = (triangleEdges t).1 then 1 else 0) - - (if 271 = (triangleEdges t).2.1 then 1 else 0) + - (if 271 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_272 : ∀ t : Fin 270, - rowEval (d2Row 272) (fun j => if j = t then 1 else 0) = - (if 272 = (triangleEdges t).1 then 1 else 0) - - (if 272 = (triangleEdges t).2.1 then 1 else 0) + - (if 272 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_273 : ∀ t : Fin 270, - rowEval (d2Row 273) (fun j => if j = t then 1 else 0) = - (if 273 = (triangleEdges t).1 then 1 else 0) - - (if 273 = (triangleEdges t).2.1 then 1 else 0) + - (if 273 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_274 : ∀ t : Fin 270, - rowEval (d2Row 274) (fun j => if j = t then 1 else 0) = - (if 274 = (triangleEdges t).1 then 1 else 0) - - (if 274 = (triangleEdges t).2.1 then 1 else 0) + - (if 274 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_275 : ∀ t : Fin 270, - rowEval (d2Row 275) (fun j => if j = t then 1 else 0) = - (if 275 = (triangleEdges t).1 then 1 else 0) - - (if 275 = (triangleEdges t).2.1 then 1 else 0) + - (if 275 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_276 : ∀ t : Fin 270, - rowEval (d2Row 276) (fun j => if j = t then 1 else 0) = - (if 276 = (triangleEdges t).1 then 1 else 0) - - (if 276 = (triangleEdges t).2.1 then 1 else 0) + - (if 276 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_277 : ∀ t : Fin 270, - rowEval (d2Row 277) (fun j => if j = t then 1 else 0) = - (if 277 = (triangleEdges t).1 then 1 else 0) - - (if 277 = (triangleEdges t).2.1 then 1 else 0) + - (if 277 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_278 : ∀ t : Fin 270, - rowEval (d2Row 278) (fun j => if j = t then 1 else 0) = - (if 278 = (triangleEdges t).1 then 1 else 0) - - (if 278 = (triangleEdges t).2.1 then 1 else 0) + - (if 278 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_279 : ∀ t : Fin 270, - rowEval (d2Row 279) (fun j => if j = t then 1 else 0) = - (if 279 = (triangleEdges t).1 then 1 else 0) - - (if 279 = (triangleEdges t).2.1 then 1 else 0) + - (if 279 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_280 : ∀ t : Fin 270, - rowEval (d2Row 280) (fun j => if j = t then 1 else 0) = - (if 280 = (triangleEdges t).1 then 1 else 0) - - (if 280 = (triangleEdges t).2.1 then 1 else 0) + - (if 280 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_281 : ∀ t : Fin 270, - rowEval (d2Row 281) (fun j => if j = t then 1 else 0) = - (if 281 = (triangleEdges t).1 then 1 else 0) - - (if 281 = (triangleEdges t).2.1 then 1 else 0) + - (if 281 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_282 : ∀ t : Fin 270, - rowEval (d2Row 282) (fun j => if j = t then 1 else 0) = - (if 282 = (triangleEdges t).1 then 1 else 0) - - (if 282 = (triangleEdges t).2.1 then 1 else 0) + - (if 282 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_283 : ∀ t : Fin 270, - rowEval (d2Row 283) (fun j => if j = t then 1 else 0) = - (if 283 = (triangleEdges t).1 then 1 else 0) - - (if 283 = (triangleEdges t).2.1 then 1 else 0) + - (if 283 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_284 : ∀ t : Fin 270, - rowEval (d2Row 284) (fun j => if j = t then 1 else 0) = - (if 284 = (triangleEdges t).1 then 1 else 0) - - (if 284 = (triangleEdges t).2.1 then 1 else 0) + - (if 284 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_285 : ∀ t : Fin 270, - rowEval (d2Row 285) (fun j => if j = t then 1 else 0) = - (if 285 = (triangleEdges t).1 then 1 else 0) - - (if 285 = (triangleEdges t).2.1 then 1 else 0) + - (if 285 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_286 : ∀ t : Fin 270, - rowEval (d2Row 286) (fun j => if j = t then 1 else 0) = - (if 286 = (triangleEdges t).1 then 1 else 0) - - (if 286 = (triangleEdges t).2.1 then 1 else 0) + - (if 286 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_287 : ∀ t : Fin 270, - rowEval (d2Row 287) (fun j => if j = t then 1 else 0) = - (if 287 = (triangleEdges t).1 then 1 else 0) - - (if 287 = (triangleEdges t).2.1 then 1 else 0) + - (if 287 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_288 : ∀ t : Fin 270, - rowEval (d2Row 288) (fun j => if j = t then 1 else 0) = - (if 288 = (triangleEdges t).1 then 1 else 0) - - (if 288 = (triangleEdges t).2.1 then 1 else 0) + - (if 288 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_289 : ∀ t : Fin 270, - rowEval (d2Row 289) (fun j => if j = t then 1 else 0) = - (if 289 = (triangleEdges t).1 then 1 else 0) - - (if 289 = (triangleEdges t).2.1 then 1 else 0) + - (if 289 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_290 : ∀ t : Fin 270, - rowEval (d2Row 290) (fun j => if j = t then 1 else 0) = - (if 290 = (triangleEdges t).1 then 1 else 0) - - (if 290 = (triangleEdges t).2.1 then 1 else 0) + - (if 290 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_291 : ∀ t : Fin 270, - rowEval (d2Row 291) (fun j => if j = t then 1 else 0) = - (if 291 = (triangleEdges t).1 then 1 else 0) - - (if 291 = (triangleEdges t).2.1 then 1 else 0) + - (if 291 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_292 : ∀ t : Fin 270, - rowEval (d2Row 292) (fun j => if j = t then 1 else 0) = - (if 292 = (triangleEdges t).1 then 1 else 0) - - (if 292 = (triangleEdges t).2.1 then 1 else 0) + - (if 292 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_293 : ∀ t : Fin 270, - rowEval (d2Row 293) (fun j => if j = t then 1 else 0) = - (if 293 = (triangleEdges t).1 then 1 else 0) - - (if 293 = (triangleEdges t).2.1 then 1 else 0) + - (if 293 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_294 : ∀ t : Fin 270, - rowEval (d2Row 294) (fun j => if j = t then 1 else 0) = - (if 294 = (triangleEdges t).1 then 1 else 0) - - (if 294 = (triangleEdges t).2.1 then 1 else 0) + - (if 294 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_295 : ∀ t : Fin 270, - rowEval (d2Row 295) (fun j => if j = t then 1 else 0) = - (if 295 = (triangleEdges t).1 then 1 else 0) - - (if 295 = (triangleEdges t).2.1 then 1 else 0) + - (if 295 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_296 : ∀ t : Fin 270, - rowEval (d2Row 296) (fun j => if j = t then 1 else 0) = - (if 296 = (triangleEdges t).1 then 1 else 0) - - (if 296 = (triangleEdges t).2.1 then 1 else 0) + - (if 296 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_297 : ∀ t : Fin 270, - rowEval (d2Row 297) (fun j => if j = t then 1 else 0) = - (if 297 = (triangleEdges t).1 then 1 else 0) - - (if 297 = (triangleEdges t).2.1 then 1 else 0) + - (if 297 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_298 : ∀ t : Fin 270, - rowEval (d2Row 298) (fun j => if j = t then 1 else 0) = - (if 298 = (triangleEdges t).1 then 1 else 0) - - (if 298 = (triangleEdges t).2.1 then 1 else 0) + - (if 298 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_299 : ∀ t : Fin 270, - rowEval (d2Row 299) (fun j => if j = t then 1 else 0) = - (if 299 = (triangleEdges t).1 then 1 else 0) - - (if 299 = (triangleEdges t).2.1 then 1 else 0) + - (if 299 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_300 : ∀ t : Fin 270, - rowEval (d2Row 300) (fun j => if j = t then 1 else 0) = - (if 300 = (triangleEdges t).1 then 1 else 0) - - (if 300 = (triangleEdges t).2.1 then 1 else 0) + - (if 300 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_301 : ∀ t : Fin 270, - rowEval (d2Row 301) (fun j => if j = t then 1 else 0) = - (if 301 = (triangleEdges t).1 then 1 else 0) - - (if 301 = (triangleEdges t).2.1 then 1 else 0) + - (if 301 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_302 : ∀ t : Fin 270, - rowEval (d2Row 302) (fun j => if j = t then 1 else 0) = - (if 302 = (triangleEdges t).1 then 1 else 0) - - (if 302 = (triangleEdges t).2.1 then 1 else 0) + - (if 302 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_303 : ∀ t : Fin 270, - rowEval (d2Row 303) (fun j => if j = t then 1 else 0) = - (if 303 = (triangleEdges t).1 then 1 else 0) - - (if 303 = (triangleEdges t).2.1 then 1 else 0) + - (if 303 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_304 : ∀ t : Fin 270, - rowEval (d2Row 304) (fun j => if j = t then 1 else 0) = - (if 304 = (triangleEdges t).1 then 1 else 0) - - (if 304 = (triangleEdges t).2.1 then 1 else 0) + - (if 304 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_305 : ∀ t : Fin 270, - rowEval (d2Row 305) (fun j => if j = t then 1 else 0) = - (if 305 = (triangleEdges t).1 then 1 else 0) - - (if 305 = (triangleEdges t).2.1 then 1 else 0) + - (if 305 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_306 : ∀ t : Fin 270, - rowEval (d2Row 306) (fun j => if j = t then 1 else 0) = - (if 306 = (triangleEdges t).1 then 1 else 0) - - (if 306 = (triangleEdges t).2.1 then 1 else 0) + - (if 306 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_307 : ∀ t : Fin 270, - rowEval (d2Row 307) (fun j => if j = t then 1 else 0) = - (if 307 = (triangleEdges t).1 then 1 else 0) - - (if 307 = (triangleEdges t).2.1 then 1 else 0) + - (if 307 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_308 : ∀ t : Fin 270, - rowEval (d2Row 308) (fun j => if j = t then 1 else 0) = - (if 308 = (triangleEdges t).1 then 1 else 0) - - (if 308 = (triangleEdges t).2.1 then 1 else 0) + - (if 308 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_309 : ∀ t : Fin 270, - rowEval (d2Row 309) (fun j => if j = t then 1 else 0) = - (if 309 = (triangleEdges t).1 then 1 else 0) - - (if 309 = (triangleEdges t).2.1 then 1 else 0) + - (if 309 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_310 : ∀ t : Fin 270, - rowEval (d2Row 310) (fun j => if j = t then 1 else 0) = - (if 310 = (triangleEdges t).1 then 1 else 0) - - (if 310 = (triangleEdges t).2.1 then 1 else 0) + - (if 310 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_311 : ∀ t : Fin 270, - rowEval (d2Row 311) (fun j => if j = t then 1 else 0) = - (if 311 = (triangleEdges t).1 then 1 else 0) - - (if 311 = (triangleEdges t).2.1 then 1 else 0) + - (if 311 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_312 : ∀ t : Fin 270, - rowEval (d2Row 312) (fun j => if j = t then 1 else 0) = - (if 312 = (triangleEdges t).1 then 1 else 0) - - (if 312 = (triangleEdges t).2.1 then 1 else 0) + - (if 312 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_313 : ∀ t : Fin 270, - rowEval (d2Row 313) (fun j => if j = t then 1 else 0) = - (if 313 = (triangleEdges t).1 then 1 else 0) - - (if 313 = (triangleEdges t).2.1 then 1 else 0) + - (if 313 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_314 : ∀ t : Fin 270, - rowEval (d2Row 314) (fun j => if j = t then 1 else 0) = - (if 314 = (triangleEdges t).1 then 1 else 0) - - (if 314 = (triangleEdges t).2.1 then 1 else 0) + - (if 314 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_315 : ∀ t : Fin 270, - rowEval (d2Row 315) (fun j => if j = t then 1 else 0) = - (if 315 = (triangleEdges t).1 then 1 else 0) - - (if 315 = (triangleEdges t).2.1 then 1 else 0) + - (if 315 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_316 : ∀ t : Fin 270, - rowEval (d2Row 316) (fun j => if j = t then 1 else 0) = - (if 316 = (triangleEdges t).1 then 1 else 0) - - (if 316 = (triangleEdges t).2.1 then 1 else 0) + - (if 316 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_317 : ∀ t : Fin 270, - rowEval (d2Row 317) (fun j => if j = t then 1 else 0) = - (if 317 = (triangleEdges t).1 then 1 else 0) - - (if 317 = (triangleEdges t).2.1 then 1 else 0) + - (if 317 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_318 : ∀ t : Fin 270, - rowEval (d2Row 318) (fun j => if j = t then 1 else 0) = - (if 318 = (triangleEdges t).1 then 1 else 0) - - (if 318 = (triangleEdges t).2.1 then 1 else 0) + - (if 318 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_319 : ∀ t : Fin 270, - rowEval (d2Row 319) (fun j => if j = t then 1 else 0) = - (if 319 = (triangleEdges t).1 then 1 else 0) - - (if 319 = (triangleEdges t).2.1 then 1 else 0) + - (if 319 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_320 : ∀ t : Fin 270, - rowEval (d2Row 320) (fun j => if j = t then 1 else 0) = - (if 320 = (triangleEdges t).1 then 1 else 0) - - (if 320 = (triangleEdges t).2.1 then 1 else 0) + - (if 320 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_321 : ∀ t : Fin 270, - rowEval (d2Row 321) (fun j => if j = t then 1 else 0) = - (if 321 = (triangleEdges t).1 then 1 else 0) - - (if 321 = (triangleEdges t).2.1 then 1 else 0) + - (if 321 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_322 : ∀ t : Fin 270, - rowEval (d2Row 322) (fun j => if j = t then 1 else 0) = - (if 322 = (triangleEdges t).1 then 1 else 0) - - (if 322 = (triangleEdges t).2.1 then 1 else 0) + - (if 322 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_323 : ∀ t : Fin 270, - rowEval (d2Row 323) (fun j => if j = t then 1 else 0) = - (if 323 = (triangleEdges t).1 then 1 else 0) - - (if 323 = (triangleEdges t).2.1 then 1 else 0) + - (if 323 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_324 : ∀ t : Fin 270, - rowEval (d2Row 324) (fun j => if j = t then 1 else 0) = - (if 324 = (triangleEdges t).1 then 1 else 0) - - (if 324 = (triangleEdges t).2.1 then 1 else 0) + - (if 324 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_325 : ∀ t : Fin 270, - rowEval (d2Row 325) (fun j => if j = t then 1 else 0) = - (if 325 = (triangleEdges t).1 then 1 else 0) - - (if 325 = (triangleEdges t).2.1 then 1 else 0) + - (if 325 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_326 : ∀ t : Fin 270, - rowEval (d2Row 326) (fun j => if j = t then 1 else 0) = - (if 326 = (triangleEdges t).1 then 1 else 0) - - (if 326 = (triangleEdges t).2.1 then 1 else 0) + - (if 326 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_327 : ∀ t : Fin 270, - rowEval (d2Row 327) (fun j => if j = t then 1 else 0) = - (if 327 = (triangleEdges t).1 then 1 else 0) - - (if 327 = (triangleEdges t).2.1 then 1 else 0) + - (if 327 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_328 : ∀ t : Fin 270, - rowEval (d2Row 328) (fun j => if j = t then 1 else 0) = - (if 328 = (triangleEdges t).1 then 1 else 0) - - (if 328 = (triangleEdges t).2.1 then 1 else 0) + - (if 328 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_329 : ∀ t : Fin 270, - rowEval (d2Row 329) (fun j => if j = t then 1 else 0) = - (if 329 = (triangleEdges t).1 then 1 else 0) - - (if 329 = (triangleEdges t).2.1 then 1 else 0) + - (if 329 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_330 : ∀ t : Fin 270, - rowEval (d2Row 330) (fun j => if j = t then 1 else 0) = - (if 330 = (triangleEdges t).1 then 1 else 0) - - (if 330 = (triangleEdges t).2.1 then 1 else 0) + - (if 330 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_331 : ∀ t : Fin 270, - rowEval (d2Row 331) (fun j => if j = t then 1 else 0) = - (if 331 = (triangleEdges t).1 then 1 else 0) - - (if 331 = (triangleEdges t).2.1 then 1 else 0) + - (if 331 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_332 : ∀ t : Fin 270, - rowEval (d2Row 332) (fun j => if j = t then 1 else 0) = - (if 332 = (triangleEdges t).1 then 1 else 0) - - (if 332 = (triangleEdges t).2.1 then 1 else 0) + - (if 332 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_333 : ∀ t : Fin 270, - rowEval (d2Row 333) (fun j => if j = t then 1 else 0) = - (if 333 = (triangleEdges t).1 then 1 else 0) - - (if 333 = (triangleEdges t).2.1 then 1 else 0) + - (if 333 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_334 : ∀ t : Fin 270, - rowEval (d2Row 334) (fun j => if j = t then 1 else 0) = - (if 334 = (triangleEdges t).1 then 1 else 0) - - (if 334 = (triangleEdges t).2.1 then 1 else 0) + - (if 334 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_335 : ∀ t : Fin 270, - rowEval (d2Row 335) (fun j => if j = t then 1 else 0) = - (if 335 = (triangleEdges t).1 then 1 else 0) - - (if 335 = (triangleEdges t).2.1 then 1 else 0) + - (if 335 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_336 : ∀ t : Fin 270, - rowEval (d2Row 336) (fun j => if j = t then 1 else 0) = - (if 336 = (triangleEdges t).1 then 1 else 0) - - (if 336 = (triangleEdges t).2.1 then 1 else 0) + - (if 336 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_337 : ∀ t : Fin 270, - rowEval (d2Row 337) (fun j => if j = t then 1 else 0) = - (if 337 = (triangleEdges t).1 then 1 else 0) - - (if 337 = (triangleEdges t).2.1 then 1 else 0) + - (if 337 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_338 : ∀ t : Fin 270, - rowEval (d2Row 338) (fun j => if j = t then 1 else 0) = - (if 338 = (triangleEdges t).1 then 1 else 0) - - (if 338 = (triangleEdges t).2.1 then 1 else 0) + - (if 338 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_339 : ∀ t : Fin 270, - rowEval (d2Row 339) (fun j => if j = t then 1 else 0) = - (if 339 = (triangleEdges t).1 then 1 else 0) - - (if 339 = (triangleEdges t).2.1 then 1 else 0) + - (if 339 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_340 : ∀ t : Fin 270, - rowEval (d2Row 340) (fun j => if j = t then 1 else 0) = - (if 340 = (triangleEdges t).1 then 1 else 0) - - (if 340 = (triangleEdges t).2.1 then 1 else 0) + - (if 340 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_341 : ∀ t : Fin 270, - rowEval (d2Row 341) (fun j => if j = t then 1 else 0) = - (if 341 = (triangleEdges t).1 then 1 else 0) - - (if 341 = (triangleEdges t).2.1 then 1 else 0) + - (if 341 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_342 : ∀ t : Fin 270, - rowEval (d2Row 342) (fun j => if j = t then 1 else 0) = - (if 342 = (triangleEdges t).1 then 1 else 0) - - (if 342 = (triangleEdges t).2.1 then 1 else 0) + - (if 342 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_343 : ∀ t : Fin 270, - rowEval (d2Row 343) (fun j => if j = t then 1 else 0) = - (if 343 = (triangleEdges t).1 then 1 else 0) - - (if 343 = (triangleEdges t).2.1 then 1 else 0) + - (if 343 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_344 : ∀ t : Fin 270, - rowEval (d2Row 344) (fun j => if j = t then 1 else 0) = - (if 344 = (triangleEdges t).1 then 1 else 0) - - (if 344 = (triangleEdges t).2.1 then 1 else 0) + - (if 344 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_345 : ∀ t : Fin 270, - rowEval (d2Row 345) (fun j => if j = t then 1 else 0) = - (if 345 = (triangleEdges t).1 then 1 else 0) - - (if 345 = (triangleEdges t).2.1 then 1 else 0) + - (if 345 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_346 : ∀ t : Fin 270, - rowEval (d2Row 346) (fun j => if j = t then 1 else 0) = - (if 346 = (triangleEdges t).1 then 1 else 0) - - (if 346 = (triangleEdges t).2.1 then 1 else 0) + - (if 346 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_347 : ∀ t : Fin 270, - rowEval (d2Row 347) (fun j => if j = t then 1 else 0) = - (if 347 = (triangleEdges t).1 then 1 else 0) - - (if 347 = (triangleEdges t).2.1 then 1 else 0) + - (if 347 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_348 : ∀ t : Fin 270, - rowEval (d2Row 348) (fun j => if j = t then 1 else 0) = - (if 348 = (triangleEdges t).1 then 1 else 0) - - (if 348 = (triangleEdges t).2.1 then 1 else 0) + - (if 348 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_349 : ∀ t : Fin 270, - rowEval (d2Row 349) (fun j => if j = t then 1 else 0) = - (if 349 = (triangleEdges t).1 then 1 else 0) - - (if 349 = (triangleEdges t).2.1 then 1 else 0) + - (if 349 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_350 : ∀ t : Fin 270, - rowEval (d2Row 350) (fun j => if j = t then 1 else 0) = - (if 350 = (triangleEdges t).1 then 1 else 0) - - (if 350 = (triangleEdges t).2.1 then 1 else 0) + - (if 350 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_351 : ∀ t : Fin 270, - rowEval (d2Row 351) (fun j => if j = t then 1 else 0) = - (if 351 = (triangleEdges t).1 then 1 else 0) - - (if 351 = (triangleEdges t).2.1 then 1 else 0) + - (if 351 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_352 : ∀ t : Fin 270, - rowEval (d2Row 352) (fun j => if j = t then 1 else 0) = - (if 352 = (triangleEdges t).1 then 1 else 0) - - (if 352 = (triangleEdges t).2.1 then 1 else 0) + - (if 352 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_353 : ∀ t : Fin 270, - rowEval (d2Row 353) (fun j => if j = t then 1 else 0) = - (if 353 = (triangleEdges t).1 then 1 else 0) - - (if 353 = (triangleEdges t).2.1 then 1 else 0) + - (if 353 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_354 : ∀ t : Fin 270, - rowEval (d2Row 354) (fun j => if j = t then 1 else 0) = - (if 354 = (triangleEdges t).1 then 1 else 0) - - (if 354 = (triangleEdges t).2.1 then 1 else 0) + - (if 354 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_355 : ∀ t : Fin 270, - rowEval (d2Row 355) (fun j => if j = t then 1 else 0) = - (if 355 = (triangleEdges t).1 then 1 else 0) - - (if 355 = (triangleEdges t).2.1 then 1 else 0) + - (if 355 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_356 : ∀ t : Fin 270, - rowEval (d2Row 356) (fun j => if j = t then 1 else 0) = - (if 356 = (triangleEdges t).1 then 1 else 0) - - (if 356 = (triangleEdges t).2.1 then 1 else 0) + - (if 356 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_357 : ∀ t : Fin 270, - rowEval (d2Row 357) (fun j => if j = t then 1 else 0) = - (if 357 = (triangleEdges t).1 then 1 else 0) - - (if 357 = (triangleEdges t).2.1 then 1 else 0) + - (if 357 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_358 : ∀ t : Fin 270, - rowEval (d2Row 358) (fun j => if j = t then 1 else 0) = - (if 358 = (triangleEdges t).1 then 1 else 0) - - (if 358 = (triangleEdges t).2.1 then 1 else 0) + - (if 358 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_359 : ∀ t : Fin 270, - rowEval (d2Row 359) (fun j => if j = t then 1 else 0) = - (if 359 = (triangleEdges t).1 then 1 else 0) - - (if 359 = (triangleEdges t).2.1 then 1 else 0) + - (if 359 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_360 : ∀ t : Fin 270, - rowEval (d2Row 360) (fun j => if j = t then 1 else 0) = - (if 360 = (triangleEdges t).1 then 1 else 0) - - (if 360 = (triangleEdges t).2.1 then 1 else 0) + - (if 360 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_361 : ∀ t : Fin 270, - rowEval (d2Row 361) (fun j => if j = t then 1 else 0) = - (if 361 = (triangleEdges t).1 then 1 else 0) - - (if 361 = (triangleEdges t).2.1 then 1 else 0) + - (if 361 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_362 : ∀ t : Fin 270, - rowEval (d2Row 362) (fun j => if j = t then 1 else 0) = - (if 362 = (triangleEdges t).1 then 1 else 0) - - (if 362 = (triangleEdges t).2.1 then 1 else 0) + - (if 362 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_363 : ∀ t : Fin 270, - rowEval (d2Row 363) (fun j => if j = t then 1 else 0) = - (if 363 = (triangleEdges t).1 then 1 else 0) - - (if 363 = (triangleEdges t).2.1 then 1 else 0) + - (if 363 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_364 : ∀ t : Fin 270, - rowEval (d2Row 364) (fun j => if j = t then 1 else 0) = - (if 364 = (triangleEdges t).1 then 1 else 0) - - (if 364 = (triangleEdges t).2.1 then 1 else 0) + - (if 364 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_365 : ∀ t : Fin 270, - rowEval (d2Row 365) (fun j => if j = t then 1 else 0) = - (if 365 = (triangleEdges t).1 then 1 else 0) - - (if 365 = (triangleEdges t).2.1 then 1 else 0) + - (if 365 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_366 : ∀ t : Fin 270, - rowEval (d2Row 366) (fun j => if j = t then 1 else 0) = - (if 366 = (triangleEdges t).1 then 1 else 0) - - (if 366 = (triangleEdges t).2.1 then 1 else 0) + - (if 366 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_367 : ∀ t : Fin 270, - rowEval (d2Row 367) (fun j => if j = t then 1 else 0) = - (if 367 = (triangleEdges t).1 then 1 else 0) - - (if 367 = (triangleEdges t).2.1 then 1 else 0) + - (if 367 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_368 : ∀ t : Fin 270, - rowEval (d2Row 368) (fun j => if j = t then 1 else 0) = - (if 368 = (triangleEdges t).1 then 1 else 0) - - (if 368 = (triangleEdges t).2.1 then 1 else 0) + - (if 368 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_369 : ∀ t : Fin 270, - rowEval (d2Row 369) (fun j => if j = t then 1 else 0) = - (if 369 = (triangleEdges t).1 then 1 else 0) - - (if 369 = (triangleEdges t).2.1 then 1 else 0) + - (if 369 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_370 : ∀ t : Fin 270, - rowEval (d2Row 370) (fun j => if j = t then 1 else 0) = - (if 370 = (triangleEdges t).1 then 1 else 0) - - (if 370 = (triangleEdges t).2.1 then 1 else 0) + - (if 370 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d2_basis_cert_371 : ∀ t : Fin 270, - rowEval (d2Row 371) (fun j => if j = t then 1 else 0) = - (if 371 = (triangleEdges t).1 then 1 else 0) - - (if 371 = (triangleEdges t).2.1 then 1 else 0) + - (if 371 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_0 : ∀ v : Fin 103, - rowEval (d1Row 0) (h0Coeff v) = - (if 0 = v then 1 else 0) - (if 0 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_1 : ∀ v : Fin 103, - rowEval (d1Row 1) (h0Coeff v) = - (if 1 = v then 1 else 0) - (if 1 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_2 : ∀ v : Fin 103, - rowEval (d1Row 2) (h0Coeff v) = - (if 2 = v then 1 else 0) - (if 2 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_3 : ∀ v : Fin 103, - rowEval (d1Row 3) (h0Coeff v) = - (if 3 = v then 1 else 0) - (if 3 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_4 : ∀ v : Fin 103, - rowEval (d1Row 4) (h0Coeff v) = - (if 4 = v then 1 else 0) - (if 4 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_5 : ∀ v : Fin 103, - rowEval (d1Row 5) (h0Coeff v) = - (if 5 = v then 1 else 0) - (if 5 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_6 : ∀ v : Fin 103, - rowEval (d1Row 6) (h0Coeff v) = - (if 6 = v then 1 else 0) - (if 6 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_7 : ∀ v : Fin 103, - rowEval (d1Row 7) (h0Coeff v) = - (if 7 = v then 1 else 0) - (if 7 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_8 : ∀ v : Fin 103, - rowEval (d1Row 8) (h0Coeff v) = - (if 8 = v then 1 else 0) - (if 8 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_9 : ∀ v : Fin 103, - rowEval (d1Row 9) (h0Coeff v) = - (if 9 = v then 1 else 0) - (if 9 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_10 : ∀ v : Fin 103, - rowEval (d1Row 10) (h0Coeff v) = - (if 10 = v then 1 else 0) - (if 10 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_11 : ∀ v : Fin 103, - rowEval (d1Row 11) (h0Coeff v) = - (if 11 = v then 1 else 0) - (if 11 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_12 : ∀ v : Fin 103, - rowEval (d1Row 12) (h0Coeff v) = - (if 12 = v then 1 else 0) - (if 12 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_13 : ∀ v : Fin 103, - rowEval (d1Row 13) (h0Coeff v) = - (if 13 = v then 1 else 0) - (if 13 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_14 : ∀ v : Fin 103, - rowEval (d1Row 14) (h0Coeff v) = - (if 14 = v then 1 else 0) - (if 14 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_15 : ∀ v : Fin 103, - rowEval (d1Row 15) (h0Coeff v) = - (if 15 = v then 1 else 0) - (if 15 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_16 : ∀ v : Fin 103, - rowEval (d1Row 16) (h0Coeff v) = - (if 16 = v then 1 else 0) - (if 16 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_17 : ∀ v : Fin 103, - rowEval (d1Row 17) (h0Coeff v) = - (if 17 = v then 1 else 0) - (if 17 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_18 : ∀ v : Fin 103, - rowEval (d1Row 18) (h0Coeff v) = - (if 18 = v then 1 else 0) - (if 18 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_19 : ∀ v : Fin 103, - rowEval (d1Row 19) (h0Coeff v) = - (if 19 = v then 1 else 0) - (if 19 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_20 : ∀ v : Fin 103, - rowEval (d1Row 20) (h0Coeff v) = - (if 20 = v then 1 else 0) - (if 20 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_21 : ∀ v : Fin 103, - rowEval (d1Row 21) (h0Coeff v) = - (if 21 = v then 1 else 0) - (if 21 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_22 : ∀ v : Fin 103, - rowEval (d1Row 22) (h0Coeff v) = - (if 22 = v then 1 else 0) - (if 22 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_23 : ∀ v : Fin 103, - rowEval (d1Row 23) (h0Coeff v) = - (if 23 = v then 1 else 0) - (if 23 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_24 : ∀ v : Fin 103, - rowEval (d1Row 24) (h0Coeff v) = - (if 24 = v then 1 else 0) - (if 24 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_25 : ∀ v : Fin 103, - rowEval (d1Row 25) (h0Coeff v) = - (if 25 = v then 1 else 0) - (if 25 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_26 : ∀ v : Fin 103, - rowEval (d1Row 26) (h0Coeff v) = - (if 26 = v then 1 else 0) - (if 26 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_27 : ∀ v : Fin 103, - rowEval (d1Row 27) (h0Coeff v) = - (if 27 = v then 1 else 0) - (if 27 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_28 : ∀ v : Fin 103, - rowEval (d1Row 28) (h0Coeff v) = - (if 28 = v then 1 else 0) - (if 28 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_29 : ∀ v : Fin 103, - rowEval (d1Row 29) (h0Coeff v) = - (if 29 = v then 1 else 0) - (if 29 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_30 : ∀ v : Fin 103, - rowEval (d1Row 30) (h0Coeff v) = - (if 30 = v then 1 else 0) - (if 30 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_31 : ∀ v : Fin 103, - rowEval (d1Row 31) (h0Coeff v) = - (if 31 = v then 1 else 0) - (if 31 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_32 : ∀ v : Fin 103, - rowEval (d1Row 32) (h0Coeff v) = - (if 32 = v then 1 else 0) - (if 32 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_33 : ∀ v : Fin 103, - rowEval (d1Row 33) (h0Coeff v) = - (if 33 = v then 1 else 0) - (if 33 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_34 : ∀ v : Fin 103, - rowEval (d1Row 34) (h0Coeff v) = - (if 34 = v then 1 else 0) - (if 34 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_35 : ∀ v : Fin 103, - rowEval (d1Row 35) (h0Coeff v) = - (if 35 = v then 1 else 0) - (if 35 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_36 : ∀ v : Fin 103, - rowEval (d1Row 36) (h0Coeff v) = - (if 36 = v then 1 else 0) - (if 36 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_37 : ∀ v : Fin 103, - rowEval (d1Row 37) (h0Coeff v) = - (if 37 = v then 1 else 0) - (if 37 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_38 : ∀ v : Fin 103, - rowEval (d1Row 38) (h0Coeff v) = - (if 38 = v then 1 else 0) - (if 38 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_39 : ∀ v : Fin 103, - rowEval (d1Row 39) (h0Coeff v) = - (if 39 = v then 1 else 0) - (if 39 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_40 : ∀ v : Fin 103, - rowEval (d1Row 40) (h0Coeff v) = - (if 40 = v then 1 else 0) - (if 40 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_41 : ∀ v : Fin 103, - rowEval (d1Row 41) (h0Coeff v) = - (if 41 = v then 1 else 0) - (if 41 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_42 : ∀ v : Fin 103, - rowEval (d1Row 42) (h0Coeff v) = - (if 42 = v then 1 else 0) - (if 42 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_43 : ∀ v : Fin 103, - rowEval (d1Row 43) (h0Coeff v) = - (if 43 = v then 1 else 0) - (if 43 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_44 : ∀ v : Fin 103, - rowEval (d1Row 44) (h0Coeff v) = - (if 44 = v then 1 else 0) - (if 44 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_45 : ∀ v : Fin 103, - rowEval (d1Row 45) (h0Coeff v) = - (if 45 = v then 1 else 0) - (if 45 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_46 : ∀ v : Fin 103, - rowEval (d1Row 46) (h0Coeff v) = - (if 46 = v then 1 else 0) - (if 46 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_47 : ∀ v : Fin 103, - rowEval (d1Row 47) (h0Coeff v) = - (if 47 = v then 1 else 0) - (if 47 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_48 : ∀ v : Fin 103, - rowEval (d1Row 48) (h0Coeff v) = - (if 48 = v then 1 else 0) - (if 48 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_49 : ∀ v : Fin 103, - rowEval (d1Row 49) (h0Coeff v) = - (if 49 = v then 1 else 0) - (if 49 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_50 : ∀ v : Fin 103, - rowEval (d1Row 50) (h0Coeff v) = - (if 50 = v then 1 else 0) - (if 50 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_51 : ∀ v : Fin 103, - rowEval (d1Row 51) (h0Coeff v) = - (if 51 = v then 1 else 0) - (if 51 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_52 : ∀ v : Fin 103, - rowEval (d1Row 52) (h0Coeff v) = - (if 52 = v then 1 else 0) - (if 52 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_53 : ∀ v : Fin 103, - rowEval (d1Row 53) (h0Coeff v) = - (if 53 = v then 1 else 0) - (if 53 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_54 : ∀ v : Fin 103, - rowEval (d1Row 54) (h0Coeff v) = - (if 54 = v then 1 else 0) - (if 54 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_55 : ∀ v : Fin 103, - rowEval (d1Row 55) (h0Coeff v) = - (if 55 = v then 1 else 0) - (if 55 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_56 : ∀ v : Fin 103, - rowEval (d1Row 56) (h0Coeff v) = - (if 56 = v then 1 else 0) - (if 56 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_57 : ∀ v : Fin 103, - rowEval (d1Row 57) (h0Coeff v) = - (if 57 = v then 1 else 0) - (if 57 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_58 : ∀ v : Fin 103, - rowEval (d1Row 58) (h0Coeff v) = - (if 58 = v then 1 else 0) - (if 58 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_59 : ∀ v : Fin 103, - rowEval (d1Row 59) (h0Coeff v) = - (if 59 = v then 1 else 0) - (if 59 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_60 : ∀ v : Fin 103, - rowEval (d1Row 60) (h0Coeff v) = - (if 60 = v then 1 else 0) - (if 60 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_61 : ∀ v : Fin 103, - rowEval (d1Row 61) (h0Coeff v) = - (if 61 = v then 1 else 0) - (if 61 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_62 : ∀ v : Fin 103, - rowEval (d1Row 62) (h0Coeff v) = - (if 62 = v then 1 else 0) - (if 62 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_63 : ∀ v : Fin 103, - rowEval (d1Row 63) (h0Coeff v) = - (if 63 = v then 1 else 0) - (if 63 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_64 : ∀ v : Fin 103, - rowEval (d1Row 64) (h0Coeff v) = - (if 64 = v then 1 else 0) - (if 64 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_65 : ∀ v : Fin 103, - rowEval (d1Row 65) (h0Coeff v) = - (if 65 = v then 1 else 0) - (if 65 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_66 : ∀ v : Fin 103, - rowEval (d1Row 66) (h0Coeff v) = - (if 66 = v then 1 else 0) - (if 66 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_67 : ∀ v : Fin 103, - rowEval (d1Row 67) (h0Coeff v) = - (if 67 = v then 1 else 0) - (if 67 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_68 : ∀ v : Fin 103, - rowEval (d1Row 68) (h0Coeff v) = - (if 68 = v then 1 else 0) - (if 68 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_69 : ∀ v : Fin 103, - rowEval (d1Row 69) (h0Coeff v) = - (if 69 = v then 1 else 0) - (if 69 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_70 : ∀ v : Fin 103, - rowEval (d1Row 70) (h0Coeff v) = - (if 70 = v then 1 else 0) - (if 70 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_71 : ∀ v : Fin 103, - rowEval (d1Row 71) (h0Coeff v) = - (if 71 = v then 1 else 0) - (if 71 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_72 : ∀ v : Fin 103, - rowEval (d1Row 72) (h0Coeff v) = - (if 72 = v then 1 else 0) - (if 72 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_73 : ∀ v : Fin 103, - rowEval (d1Row 73) (h0Coeff v) = - (if 73 = v then 1 else 0) - (if 73 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_74 : ∀ v : Fin 103, - rowEval (d1Row 74) (h0Coeff v) = - (if 74 = v then 1 else 0) - (if 74 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_75 : ∀ v : Fin 103, - rowEval (d1Row 75) (h0Coeff v) = - (if 75 = v then 1 else 0) - (if 75 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_76 : ∀ v : Fin 103, - rowEval (d1Row 76) (h0Coeff v) = - (if 76 = v then 1 else 0) - (if 76 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_77 : ∀ v : Fin 103, - rowEval (d1Row 77) (h0Coeff v) = - (if 77 = v then 1 else 0) - (if 77 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_78 : ∀ v : Fin 103, - rowEval (d1Row 78) (h0Coeff v) = - (if 78 = v then 1 else 0) - (if 78 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_79 : ∀ v : Fin 103, - rowEval (d1Row 79) (h0Coeff v) = - (if 79 = v then 1 else 0) - (if 79 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_80 : ∀ v : Fin 103, - rowEval (d1Row 80) (h0Coeff v) = - (if 80 = v then 1 else 0) - (if 80 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_81 : ∀ v : Fin 103, - rowEval (d1Row 81) (h0Coeff v) = - (if 81 = v then 1 else 0) - (if 81 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_82 : ∀ v : Fin 103, - rowEval (d1Row 82) (h0Coeff v) = - (if 82 = v then 1 else 0) - (if 82 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_83 : ∀ v : Fin 103, - rowEval (d1Row 83) (h0Coeff v) = - (if 83 = v then 1 else 0) - (if 83 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_84 : ∀ v : Fin 103, - rowEval (d1Row 84) (h0Coeff v) = - (if 84 = v then 1 else 0) - (if 84 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_85 : ∀ v : Fin 103, - rowEval (d1Row 85) (h0Coeff v) = - (if 85 = v then 1 else 0) - (if 85 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_86 : ∀ v : Fin 103, - rowEval (d1Row 86) (h0Coeff v) = - (if 86 = v then 1 else 0) - (if 86 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_87 : ∀ v : Fin 103, - rowEval (d1Row 87) (h0Coeff v) = - (if 87 = v then 1 else 0) - (if 87 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_88 : ∀ v : Fin 103, - rowEval (d1Row 88) (h0Coeff v) = - (if 88 = v then 1 else 0) - (if 88 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_89 : ∀ v : Fin 103, - rowEval (d1Row 89) (h0Coeff v) = - (if 89 = v then 1 else 0) - (if 89 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_90 : ∀ v : Fin 103, - rowEval (d1Row 90) (h0Coeff v) = - (if 90 = v then 1 else 0) - (if 90 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_91 : ∀ v : Fin 103, - rowEval (d1Row 91) (h0Coeff v) = - (if 91 = v then 1 else 0) - (if 91 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_92 : ∀ v : Fin 103, - rowEval (d1Row 92) (h0Coeff v) = - (if 92 = v then 1 else 0) - (if 92 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_93 : ∀ v : Fin 103, - rowEval (d1Row 93) (h0Coeff v) = - (if 93 = v then 1 else 0) - (if 93 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_94 : ∀ v : Fin 103, - rowEval (d1Row 94) (h0Coeff v) = - (if 94 = v then 1 else 0) - (if 94 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_95 : ∀ v : Fin 103, - rowEval (d1Row 95) (h0Coeff v) = - (if 95 = v then 1 else 0) - (if 95 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_96 : ∀ v : Fin 103, - rowEval (d1Row 96) (h0Coeff v) = - (if 96 = v then 1 else 0) - (if 96 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_97 : ∀ v : Fin 103, - rowEval (d1Row 97) (h0Coeff v) = - (if 97 = v then 1 else 0) - (if 97 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_98 : ∀ v : Fin 103, - rowEval (d1Row 98) (h0Coeff v) = - (if 98 = v then 1 else 0) - (if 98 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_99 : ∀ v : Fin 103, - rowEval (d1Row 99) (h0Coeff v) = - (if 99 = v then 1 else 0) - (if 99 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_100 : ∀ v : Fin 103, - rowEval (d1Row 100) (h0Coeff v) = - (if 100 = v then 1 else 0) - (if 100 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_101 : ∀ v : Fin 103, - rowEval (d1Row 101) (h0Coeff v) = - (if 101 = v then 1 else 0) - (if 101 = 0 then 1 else 0) := by decide +kernel - -theorem d1_h0_cert_102 : ∀ v : Fin 103, - rowEval (d1Row 102) (h0Coeff v) = - (if 102 = v then 1 else 0) - (if 102 = 0 then 1 else 0) := by decide +kernel - -theorem h1_boundary_cert (t : Fin 270) (j : Fin 270) : - h1Coeff (triangleEdges t).1 j - h1Coeff (triangleEdges t).2.1 j + - h1Coeff (triangleEdges t).2.2 j = if j = t then 1 else 0 := by - fin_cases t - · exact h1_boundary_cert_0 j - · exact h1_boundary_cert_1 j - · exact h1_boundary_cert_2 j - · exact h1_boundary_cert_3 j - · exact h1_boundary_cert_4 j - · exact h1_boundary_cert_5 j - · exact h1_boundary_cert_6 j - · exact h1_boundary_cert_7 j - · exact h1_boundary_cert_8 j - · exact h1_boundary_cert_9 j - · exact h1_boundary_cert_10 j - · exact h1_boundary_cert_11 j - · exact h1_boundary_cert_12 j - · exact h1_boundary_cert_13 j - · exact h1_boundary_cert_14 j - · exact h1_boundary_cert_15 j - · exact h1_boundary_cert_16 j - · exact h1_boundary_cert_17 j - · exact h1_boundary_cert_18 j - · exact h1_boundary_cert_19 j - · exact h1_boundary_cert_20 j - · exact h1_boundary_cert_21 j - · exact h1_boundary_cert_22 j - · exact h1_boundary_cert_23 j - · exact h1_boundary_cert_24 j - · exact h1_boundary_cert_25 j - · exact h1_boundary_cert_26 j - · exact h1_boundary_cert_27 j - · exact h1_boundary_cert_28 j - · exact h1_boundary_cert_29 j - · exact h1_boundary_cert_30 j - · exact h1_boundary_cert_31 j - · exact h1_boundary_cert_32 j - · exact h1_boundary_cert_33 j - · exact h1_boundary_cert_34 j - · exact h1_boundary_cert_35 j - · exact h1_boundary_cert_36 j - · exact h1_boundary_cert_37 j - · exact h1_boundary_cert_38 j - · exact h1_boundary_cert_39 j - · exact h1_boundary_cert_40 j - · exact h1_boundary_cert_41 j - · exact h1_boundary_cert_42 j - · exact h1_boundary_cert_43 j - · exact h1_boundary_cert_44 j - · exact h1_boundary_cert_45 j - · exact h1_boundary_cert_46 j - · exact h1_boundary_cert_47 j - · exact h1_boundary_cert_48 j - · exact h1_boundary_cert_49 j - · exact h1_boundary_cert_50 j - · exact h1_boundary_cert_51 j - · exact h1_boundary_cert_52 j - · exact h1_boundary_cert_53 j - · exact h1_boundary_cert_54 j - · exact h1_boundary_cert_55 j - · exact h1_boundary_cert_56 j - · exact h1_boundary_cert_57 j - · exact h1_boundary_cert_58 j - · exact h1_boundary_cert_59 j - · exact h1_boundary_cert_60 j - · exact h1_boundary_cert_61 j - · exact h1_boundary_cert_62 j - · exact h1_boundary_cert_63 j - · exact h1_boundary_cert_64 j - · exact h1_boundary_cert_65 j - · exact h1_boundary_cert_66 j - · exact h1_boundary_cert_67 j - · exact h1_boundary_cert_68 j - · exact h1_boundary_cert_69 j - · exact h1_boundary_cert_70 j - · exact h1_boundary_cert_71 j - · exact h1_boundary_cert_72 j - · exact h1_boundary_cert_73 j - · exact h1_boundary_cert_74 j - · exact h1_boundary_cert_75 j - · exact h1_boundary_cert_76 j - · exact h1_boundary_cert_77 j - · exact h1_boundary_cert_78 j - · exact h1_boundary_cert_79 j - · exact h1_boundary_cert_80 j - · exact h1_boundary_cert_81 j - · exact h1_boundary_cert_82 j - · exact h1_boundary_cert_83 j - · exact h1_boundary_cert_84 j - · exact h1_boundary_cert_85 j - · exact h1_boundary_cert_86 j - · exact h1_boundary_cert_87 j - · exact h1_boundary_cert_88 j - · exact h1_boundary_cert_89 j - · exact h1_boundary_cert_90 j - · exact h1_boundary_cert_91 j - · exact h1_boundary_cert_92 j - · exact h1_boundary_cert_93 j - · exact h1_boundary_cert_94 j - · exact h1_boundary_cert_95 j - · exact h1_boundary_cert_96 j - · exact h1_boundary_cert_97 j - · exact h1_boundary_cert_98 j - · exact h1_boundary_cert_99 j - · exact h1_boundary_cert_100 j - · exact h1_boundary_cert_101 j - · exact h1_boundary_cert_102 j - · exact h1_boundary_cert_103 j - · exact h1_boundary_cert_104 j - · exact h1_boundary_cert_105 j - · exact h1_boundary_cert_106 j - · exact h1_boundary_cert_107 j - · exact h1_boundary_cert_108 j - · exact h1_boundary_cert_109 j - · exact h1_boundary_cert_110 j - · exact h1_boundary_cert_111 j - · exact h1_boundary_cert_112 j - · exact h1_boundary_cert_113 j - · exact h1_boundary_cert_114 j - · exact h1_boundary_cert_115 j - · exact h1_boundary_cert_116 j - · exact h1_boundary_cert_117 j - · exact h1_boundary_cert_118 j - · exact h1_boundary_cert_119 j - · exact h1_boundary_cert_120 j - · exact h1_boundary_cert_121 j - · exact h1_boundary_cert_122 j - · exact h1_boundary_cert_123 j - · exact h1_boundary_cert_124 j - · exact h1_boundary_cert_125 j - · exact h1_boundary_cert_126 j - · exact h1_boundary_cert_127 j - · exact h1_boundary_cert_128 j - · exact h1_boundary_cert_129 j - · exact h1_boundary_cert_130 j - · exact h1_boundary_cert_131 j - · exact h1_boundary_cert_132 j - · exact h1_boundary_cert_133 j - · exact h1_boundary_cert_134 j - · exact h1_boundary_cert_135 j - · exact h1_boundary_cert_136 j - · exact h1_boundary_cert_137 j - · exact h1_boundary_cert_138 j - · exact h1_boundary_cert_139 j - · exact h1_boundary_cert_140 j - · exact h1_boundary_cert_141 j - · exact h1_boundary_cert_142 j - · exact h1_boundary_cert_143 j - · exact h1_boundary_cert_144 j - · exact h1_boundary_cert_145 j - · exact h1_boundary_cert_146 j - · exact h1_boundary_cert_147 j - · exact h1_boundary_cert_148 j - · exact h1_boundary_cert_149 j - · exact h1_boundary_cert_150 j - · exact h1_boundary_cert_151 j - · exact h1_boundary_cert_152 j - · exact h1_boundary_cert_153 j - · exact h1_boundary_cert_154 j - · exact h1_boundary_cert_155 j - · exact h1_boundary_cert_156 j - · exact h1_boundary_cert_157 j - · exact h1_boundary_cert_158 j - · exact h1_boundary_cert_159 j - · exact h1_boundary_cert_160 j - · exact h1_boundary_cert_161 j - · exact h1_boundary_cert_162 j - · exact h1_boundary_cert_163 j - · exact h1_boundary_cert_164 j - · exact h1_boundary_cert_165 j - · exact h1_boundary_cert_166 j - · exact h1_boundary_cert_167 j - · exact h1_boundary_cert_168 j - · exact h1_boundary_cert_169 j - · exact h1_boundary_cert_170 j - · exact h1_boundary_cert_171 j - · exact h1_boundary_cert_172 j - · exact h1_boundary_cert_173 j - · exact h1_boundary_cert_174 j - · exact h1_boundary_cert_175 j - · exact h1_boundary_cert_176 j - · exact h1_boundary_cert_177 j - · exact h1_boundary_cert_178 j - · exact h1_boundary_cert_179 j - · exact h1_boundary_cert_180 j - · exact h1_boundary_cert_181 j - · exact h1_boundary_cert_182 j - · exact h1_boundary_cert_183 j - · exact h1_boundary_cert_184 j - · exact h1_boundary_cert_185 j - · exact h1_boundary_cert_186 j - · exact h1_boundary_cert_187 j - · exact h1_boundary_cert_188 j - · exact h1_boundary_cert_189 j - · exact h1_boundary_cert_190 j - · exact h1_boundary_cert_191 j - · exact h1_boundary_cert_192 j - · exact h1_boundary_cert_193 j - · exact h1_boundary_cert_194 j - · exact h1_boundary_cert_195 j - · exact h1_boundary_cert_196 j - · exact h1_boundary_cert_197 j - · exact h1_boundary_cert_198 j - · exact h1_boundary_cert_199 j - · exact h1_boundary_cert_200 j - · exact h1_boundary_cert_201 j - · exact h1_boundary_cert_202 j - · exact h1_boundary_cert_203 j - · exact h1_boundary_cert_204 j - · exact h1_boundary_cert_205 j - · exact h1_boundary_cert_206 j - · exact h1_boundary_cert_207 j - · exact h1_boundary_cert_208 j - · exact h1_boundary_cert_209 j - · exact h1_boundary_cert_210 j - · exact h1_boundary_cert_211 j - · exact h1_boundary_cert_212 j - · exact h1_boundary_cert_213 j - · exact h1_boundary_cert_214 j - · exact h1_boundary_cert_215 j - · exact h1_boundary_cert_216 j - · exact h1_boundary_cert_217 j - · exact h1_boundary_cert_218 j - · exact h1_boundary_cert_219 j - · exact h1_boundary_cert_220 j - · exact h1_boundary_cert_221 j - · exact h1_boundary_cert_222 j - · exact h1_boundary_cert_223 j - · exact h1_boundary_cert_224 j - · exact h1_boundary_cert_225 j - · exact h1_boundary_cert_226 j - · exact h1_boundary_cert_227 j - · exact h1_boundary_cert_228 j - · exact h1_boundary_cert_229 j - · exact h1_boundary_cert_230 j - · exact h1_boundary_cert_231 j - · exact h1_boundary_cert_232 j - · exact h1_boundary_cert_233 j - · exact h1_boundary_cert_234 j - · exact h1_boundary_cert_235 j - · exact h1_boundary_cert_236 j - · exact h1_boundary_cert_237 j - · exact h1_boundary_cert_238 j - · exact h1_boundary_cert_239 j - · exact h1_boundary_cert_240 j - · exact h1_boundary_cert_241 j - · exact h1_boundary_cert_242 j - · exact h1_boundary_cert_243 j - · exact h1_boundary_cert_244 j - · exact h1_boundary_cert_245 j - · exact h1_boundary_cert_246 j - · exact h1_boundary_cert_247 j - · exact h1_boundary_cert_248 j - · exact h1_boundary_cert_249 j - · exact h1_boundary_cert_250 j - · exact h1_boundary_cert_251 j - · exact h1_boundary_cert_252 j - · exact h1_boundary_cert_253 j - · exact h1_boundary_cert_254 j - · exact h1_boundary_cert_255 j - · exact h1_boundary_cert_256 j - · exact h1_boundary_cert_257 j - · exact h1_boundary_cert_258 j - · exact h1_boundary_cert_259 j - · exact h1_boundary_cert_260 j - · exact h1_boundary_cert_261 j - · exact h1_boundary_cert_262 j - · exact h1_boundary_cert_263 j - · exact h1_boundary_cert_264 j - · exact h1_boundary_cert_265 j - · exact h1_boundary_cert_266 j - · exact h1_boundary_cert_267 j - · exact h1_boundary_cert_268 j - · exact h1_boundary_cert_269 j - -theorem d1_basis_cert (i : Fin 103) (e : Fin 372) : - rowEval (d1Row i) (fun j => if j = e then 1 else 0) = - (if i = (edge e).2 then 1 else 0) - (if i = (edge e).1 then 1 else 0) := by - fin_cases i - · exact d1_basis_cert_0 e - · exact d1_basis_cert_1 e - · exact d1_basis_cert_2 e - · exact d1_basis_cert_3 e - · exact d1_basis_cert_4 e - · exact d1_basis_cert_5 e - · exact d1_basis_cert_6 e - · exact d1_basis_cert_7 e - · exact d1_basis_cert_8 e - · exact d1_basis_cert_9 e - · exact d1_basis_cert_10 e - · exact d1_basis_cert_11 e - · exact d1_basis_cert_12 e - · exact d1_basis_cert_13 e - · exact d1_basis_cert_14 e - · exact d1_basis_cert_15 e - · exact d1_basis_cert_16 e - · exact d1_basis_cert_17 e - · exact d1_basis_cert_18 e - · exact d1_basis_cert_19 e - · exact d1_basis_cert_20 e - · exact d1_basis_cert_21 e - · exact d1_basis_cert_22 e - · exact d1_basis_cert_23 e - · exact d1_basis_cert_24 e - · exact d1_basis_cert_25 e - · exact d1_basis_cert_26 e - · exact d1_basis_cert_27 e - · exact d1_basis_cert_28 e - · exact d1_basis_cert_29 e - · exact d1_basis_cert_30 e - · exact d1_basis_cert_31 e - · exact d1_basis_cert_32 e - · exact d1_basis_cert_33 e - · exact d1_basis_cert_34 e - · exact d1_basis_cert_35 e - · exact d1_basis_cert_36 e - · exact d1_basis_cert_37 e - · exact d1_basis_cert_38 e - · exact d1_basis_cert_39 e - · exact d1_basis_cert_40 e - · exact d1_basis_cert_41 e - · exact d1_basis_cert_42 e - · exact d1_basis_cert_43 e - · exact d1_basis_cert_44 e - · exact d1_basis_cert_45 e - · exact d1_basis_cert_46 e - · exact d1_basis_cert_47 e - · exact d1_basis_cert_48 e - · exact d1_basis_cert_49 e - · exact d1_basis_cert_50 e - · exact d1_basis_cert_51 e - · exact d1_basis_cert_52 e - · exact d1_basis_cert_53 e - · exact d1_basis_cert_54 e - · exact d1_basis_cert_55 e - · exact d1_basis_cert_56 e - · exact d1_basis_cert_57 e - · exact d1_basis_cert_58 e - · exact d1_basis_cert_59 e - · exact d1_basis_cert_60 e - · exact d1_basis_cert_61 e - · exact d1_basis_cert_62 e - · exact d1_basis_cert_63 e - · exact d1_basis_cert_64 e - · exact d1_basis_cert_65 e - · exact d1_basis_cert_66 e - · exact d1_basis_cert_67 e - · exact d1_basis_cert_68 e - · exact d1_basis_cert_69 e - · exact d1_basis_cert_70 e - · exact d1_basis_cert_71 e - · exact d1_basis_cert_72 e - · exact d1_basis_cert_73 e - · exact d1_basis_cert_74 e - · exact d1_basis_cert_75 e - · exact d1_basis_cert_76 e - · exact d1_basis_cert_77 e - · exact d1_basis_cert_78 e - · exact d1_basis_cert_79 e - · exact d1_basis_cert_80 e - · exact d1_basis_cert_81 e - · exact d1_basis_cert_82 e - · exact d1_basis_cert_83 e - · exact d1_basis_cert_84 e - · exact d1_basis_cert_85 e - · exact d1_basis_cert_86 e - · exact d1_basis_cert_87 e - · exact d1_basis_cert_88 e - · exact d1_basis_cert_89 e - · exact d1_basis_cert_90 e - · exact d1_basis_cert_91 e - · exact d1_basis_cert_92 e - · exact d1_basis_cert_93 e - · exact d1_basis_cert_94 e - · exact d1_basis_cert_95 e - · exact d1_basis_cert_96 e - · exact d1_basis_cert_97 e - · exact d1_basis_cert_98 e - · exact d1_basis_cert_99 e - · exact d1_basis_cert_100 e - · exact d1_basis_cert_101 e - · exact d1_basis_cert_102 e - -theorem d2_basis_cert (e : Fin 372) (t : Fin 270) : - rowEval (d2Row e) (fun i => if i = t then 1 else 0) = - (if e = (triangleEdges t).1 then 1 else 0) - - (if e = (triangleEdges t).2.1 then 1 else 0) + (if e = (triangleEdges t).2.2 then 1 else 0) := by - fin_cases e - · exact d2_basis_cert_0 t - · exact d2_basis_cert_1 t - · exact d2_basis_cert_2 t - · exact d2_basis_cert_3 t - · exact d2_basis_cert_4 t - · exact d2_basis_cert_5 t - · exact d2_basis_cert_6 t - · exact d2_basis_cert_7 t - · exact d2_basis_cert_8 t - · exact d2_basis_cert_9 t - · exact d2_basis_cert_10 t - · exact d2_basis_cert_11 t - · exact d2_basis_cert_12 t - · exact d2_basis_cert_13 t - · exact d2_basis_cert_14 t - · exact d2_basis_cert_15 t - · exact d2_basis_cert_16 t - · exact d2_basis_cert_17 t - · exact d2_basis_cert_18 t - · exact d2_basis_cert_19 t - · exact d2_basis_cert_20 t - · exact d2_basis_cert_21 t - · exact d2_basis_cert_22 t - · exact d2_basis_cert_23 t - · exact d2_basis_cert_24 t - · exact d2_basis_cert_25 t - · exact d2_basis_cert_26 t - · exact d2_basis_cert_27 t - · exact d2_basis_cert_28 t - · exact d2_basis_cert_29 t - · exact d2_basis_cert_30 t - · exact d2_basis_cert_31 t - · exact d2_basis_cert_32 t - · exact d2_basis_cert_33 t - · exact d2_basis_cert_34 t - · exact d2_basis_cert_35 t - · exact d2_basis_cert_36 t - · exact d2_basis_cert_37 t - · exact d2_basis_cert_38 t - · exact d2_basis_cert_39 t - · exact d2_basis_cert_40 t - · exact d2_basis_cert_41 t - · exact d2_basis_cert_42 t - · exact d2_basis_cert_43 t - · exact d2_basis_cert_44 t - · exact d2_basis_cert_45 t - · exact d2_basis_cert_46 t - · exact d2_basis_cert_47 t - · exact d2_basis_cert_48 t - · exact d2_basis_cert_49 t - · exact d2_basis_cert_50 t - · exact d2_basis_cert_51 t - · exact d2_basis_cert_52 t - · exact d2_basis_cert_53 t - · exact d2_basis_cert_54 t - · exact d2_basis_cert_55 t - · exact d2_basis_cert_56 t - · exact d2_basis_cert_57 t - · exact d2_basis_cert_58 t - · exact d2_basis_cert_59 t - · exact d2_basis_cert_60 t - · exact d2_basis_cert_61 t - · exact d2_basis_cert_62 t - · exact d2_basis_cert_63 t - · exact d2_basis_cert_64 t - · exact d2_basis_cert_65 t - · exact d2_basis_cert_66 t - · exact d2_basis_cert_67 t - · exact d2_basis_cert_68 t - · exact d2_basis_cert_69 t - · exact d2_basis_cert_70 t - · exact d2_basis_cert_71 t - · exact d2_basis_cert_72 t - · exact d2_basis_cert_73 t - · exact d2_basis_cert_74 t - · exact d2_basis_cert_75 t - · exact d2_basis_cert_76 t - · exact d2_basis_cert_77 t - · exact d2_basis_cert_78 t - · exact d2_basis_cert_79 t - · exact d2_basis_cert_80 t - · exact d2_basis_cert_81 t - · exact d2_basis_cert_82 t - · exact d2_basis_cert_83 t - · exact d2_basis_cert_84 t - · exact d2_basis_cert_85 t - · exact d2_basis_cert_86 t - · exact d2_basis_cert_87 t - · exact d2_basis_cert_88 t - · exact d2_basis_cert_89 t - · exact d2_basis_cert_90 t - · exact d2_basis_cert_91 t - · exact d2_basis_cert_92 t - · exact d2_basis_cert_93 t - · exact d2_basis_cert_94 t - · exact d2_basis_cert_95 t - · exact d2_basis_cert_96 t - · exact d2_basis_cert_97 t - · exact d2_basis_cert_98 t - · exact d2_basis_cert_99 t - · exact d2_basis_cert_100 t - · exact d2_basis_cert_101 t - · exact d2_basis_cert_102 t - · exact d2_basis_cert_103 t - · exact d2_basis_cert_104 t - · exact d2_basis_cert_105 t - · exact d2_basis_cert_106 t - · exact d2_basis_cert_107 t - · exact d2_basis_cert_108 t - · exact d2_basis_cert_109 t - · exact d2_basis_cert_110 t - · exact d2_basis_cert_111 t - · exact d2_basis_cert_112 t - · exact d2_basis_cert_113 t - · exact d2_basis_cert_114 t - · exact d2_basis_cert_115 t - · exact d2_basis_cert_116 t - · exact d2_basis_cert_117 t - · exact d2_basis_cert_118 t - · exact d2_basis_cert_119 t - · exact d2_basis_cert_120 t - · exact d2_basis_cert_121 t - · exact d2_basis_cert_122 t - · exact d2_basis_cert_123 t - · exact d2_basis_cert_124 t - · exact d2_basis_cert_125 t - · exact d2_basis_cert_126 t - · exact d2_basis_cert_127 t - · exact d2_basis_cert_128 t - · exact d2_basis_cert_129 t - · exact d2_basis_cert_130 t - · exact d2_basis_cert_131 t - · exact d2_basis_cert_132 t - · exact d2_basis_cert_133 t - · exact d2_basis_cert_134 t - · exact d2_basis_cert_135 t - · exact d2_basis_cert_136 t - · exact d2_basis_cert_137 t - · exact d2_basis_cert_138 t - · exact d2_basis_cert_139 t - · exact d2_basis_cert_140 t - · exact d2_basis_cert_141 t - · exact d2_basis_cert_142 t - · exact d2_basis_cert_143 t - · exact d2_basis_cert_144 t - · exact d2_basis_cert_145 t - · exact d2_basis_cert_146 t - · exact d2_basis_cert_147 t - · exact d2_basis_cert_148 t - · exact d2_basis_cert_149 t - · exact d2_basis_cert_150 t - · exact d2_basis_cert_151 t - · exact d2_basis_cert_152 t - · exact d2_basis_cert_153 t - · exact d2_basis_cert_154 t - · exact d2_basis_cert_155 t - · exact d2_basis_cert_156 t - · exact d2_basis_cert_157 t - · exact d2_basis_cert_158 t - · exact d2_basis_cert_159 t - · exact d2_basis_cert_160 t - · exact d2_basis_cert_161 t - · exact d2_basis_cert_162 t - · exact d2_basis_cert_163 t - · exact d2_basis_cert_164 t - · exact d2_basis_cert_165 t - · exact d2_basis_cert_166 t - · exact d2_basis_cert_167 t - · exact d2_basis_cert_168 t - · exact d2_basis_cert_169 t - · exact d2_basis_cert_170 t - · exact d2_basis_cert_171 t - · exact d2_basis_cert_172 t - · exact d2_basis_cert_173 t - · exact d2_basis_cert_174 t - · exact d2_basis_cert_175 t - · exact d2_basis_cert_176 t - · exact d2_basis_cert_177 t - · exact d2_basis_cert_178 t - · exact d2_basis_cert_179 t - · exact d2_basis_cert_180 t - · exact d2_basis_cert_181 t - · exact d2_basis_cert_182 t - · exact d2_basis_cert_183 t - · exact d2_basis_cert_184 t - · exact d2_basis_cert_185 t - · exact d2_basis_cert_186 t - · exact d2_basis_cert_187 t - · exact d2_basis_cert_188 t - · exact d2_basis_cert_189 t - · exact d2_basis_cert_190 t - · exact d2_basis_cert_191 t - · exact d2_basis_cert_192 t - · exact d2_basis_cert_193 t - · exact d2_basis_cert_194 t - · exact d2_basis_cert_195 t - · exact d2_basis_cert_196 t - · exact d2_basis_cert_197 t - · exact d2_basis_cert_198 t - · exact d2_basis_cert_199 t - · exact d2_basis_cert_200 t - · exact d2_basis_cert_201 t - · exact d2_basis_cert_202 t - · exact d2_basis_cert_203 t - · exact d2_basis_cert_204 t - · exact d2_basis_cert_205 t - · exact d2_basis_cert_206 t - · exact d2_basis_cert_207 t - · exact d2_basis_cert_208 t - · exact d2_basis_cert_209 t - · exact d2_basis_cert_210 t - · exact d2_basis_cert_211 t - · exact d2_basis_cert_212 t - · exact d2_basis_cert_213 t - · exact d2_basis_cert_214 t - · exact d2_basis_cert_215 t - · exact d2_basis_cert_216 t - · exact d2_basis_cert_217 t - · exact d2_basis_cert_218 t - · exact d2_basis_cert_219 t - · exact d2_basis_cert_220 t - · exact d2_basis_cert_221 t - · exact d2_basis_cert_222 t - · exact d2_basis_cert_223 t - · exact d2_basis_cert_224 t - · exact d2_basis_cert_225 t - · exact d2_basis_cert_226 t - · exact d2_basis_cert_227 t - · exact d2_basis_cert_228 t - · exact d2_basis_cert_229 t - · exact d2_basis_cert_230 t - · exact d2_basis_cert_231 t - · exact d2_basis_cert_232 t - · exact d2_basis_cert_233 t - · exact d2_basis_cert_234 t - · exact d2_basis_cert_235 t - · exact d2_basis_cert_236 t - · exact d2_basis_cert_237 t - · exact d2_basis_cert_238 t - · exact d2_basis_cert_239 t - · exact d2_basis_cert_240 t - · exact d2_basis_cert_241 t - · exact d2_basis_cert_242 t - · exact d2_basis_cert_243 t - · exact d2_basis_cert_244 t - · exact d2_basis_cert_245 t - · exact d2_basis_cert_246 t - · exact d2_basis_cert_247 t - · exact d2_basis_cert_248 t - · exact d2_basis_cert_249 t - · exact d2_basis_cert_250 t - · exact d2_basis_cert_251 t - · exact d2_basis_cert_252 t - · exact d2_basis_cert_253 t - · exact d2_basis_cert_254 t - · exact d2_basis_cert_255 t - · exact d2_basis_cert_256 t - · exact d2_basis_cert_257 t - · exact d2_basis_cert_258 t - · exact d2_basis_cert_259 t - · exact d2_basis_cert_260 t - · exact d2_basis_cert_261 t - · exact d2_basis_cert_262 t - · exact d2_basis_cert_263 t - · exact d2_basis_cert_264 t - · exact d2_basis_cert_265 t - · exact d2_basis_cert_266 t - · exact d2_basis_cert_267 t - · exact d2_basis_cert_268 t - · exact d2_basis_cert_269 t - · exact d2_basis_cert_270 t - · exact d2_basis_cert_271 t - · exact d2_basis_cert_272 t - · exact d2_basis_cert_273 t - · exact d2_basis_cert_274 t - · exact d2_basis_cert_275 t - · exact d2_basis_cert_276 t - · exact d2_basis_cert_277 t - · exact d2_basis_cert_278 t - · exact d2_basis_cert_279 t - · exact d2_basis_cert_280 t - · exact d2_basis_cert_281 t - · exact d2_basis_cert_282 t - · exact d2_basis_cert_283 t - · exact d2_basis_cert_284 t - · exact d2_basis_cert_285 t - · exact d2_basis_cert_286 t - · exact d2_basis_cert_287 t - · exact d2_basis_cert_288 t - · exact d2_basis_cert_289 t - · exact d2_basis_cert_290 t - · exact d2_basis_cert_291 t - · exact d2_basis_cert_292 t - · exact d2_basis_cert_293 t - · exact d2_basis_cert_294 t - · exact d2_basis_cert_295 t - · exact d2_basis_cert_296 t - · exact d2_basis_cert_297 t - · exact d2_basis_cert_298 t - · exact d2_basis_cert_299 t - · exact d2_basis_cert_300 t - · exact d2_basis_cert_301 t - · exact d2_basis_cert_302 t - · exact d2_basis_cert_303 t - · exact d2_basis_cert_304 t - · exact d2_basis_cert_305 t - · exact d2_basis_cert_306 t - · exact d2_basis_cert_307 t - · exact d2_basis_cert_308 t - · exact d2_basis_cert_309 t - · exact d2_basis_cert_310 t - · exact d2_basis_cert_311 t - · exact d2_basis_cert_312 t - · exact d2_basis_cert_313 t - · exact d2_basis_cert_314 t - · exact d2_basis_cert_315 t - · exact d2_basis_cert_316 t - · exact d2_basis_cert_317 t - · exact d2_basis_cert_318 t - · exact d2_basis_cert_319 t - · exact d2_basis_cert_320 t - · exact d2_basis_cert_321 t - · exact d2_basis_cert_322 t - · exact d2_basis_cert_323 t - · exact d2_basis_cert_324 t - · exact d2_basis_cert_325 t - · exact d2_basis_cert_326 t - · exact d2_basis_cert_327 t - · exact d2_basis_cert_328 t - · exact d2_basis_cert_329 t - · exact d2_basis_cert_330 t - · exact d2_basis_cert_331 t - · exact d2_basis_cert_332 t - · exact d2_basis_cert_333 t - · exact d2_basis_cert_334 t - · exact d2_basis_cert_335 t - · exact d2_basis_cert_336 t - · exact d2_basis_cert_337 t - · exact d2_basis_cert_338 t - · exact d2_basis_cert_339 t - · exact d2_basis_cert_340 t - · exact d2_basis_cert_341 t - · exact d2_basis_cert_342 t - · exact d2_basis_cert_343 t - · exact d2_basis_cert_344 t - · exact d2_basis_cert_345 t - · exact d2_basis_cert_346 t - · exact d2_basis_cert_347 t - · exact d2_basis_cert_348 t - · exact d2_basis_cert_349 t - · exact d2_basis_cert_350 t - · exact d2_basis_cert_351 t - · exact d2_basis_cert_352 t - · exact d2_basis_cert_353 t - · exact d2_basis_cert_354 t - · exact d2_basis_cert_355 t - · exact d2_basis_cert_356 t - · exact d2_basis_cert_357 t - · exact d2_basis_cert_358 t - · exact d2_basis_cert_359 t - · exact d2_basis_cert_360 t - · exact d2_basis_cert_361 t - · exact d2_basis_cert_362 t - · exact d2_basis_cert_363 t - · exact d2_basis_cert_364 t - · exact d2_basis_cert_365 t - · exact d2_basis_cert_366 t - · exact d2_basis_cert_367 t - · exact d2_basis_cert_368 t - · exact d2_basis_cert_369 t - · exact d2_basis_cert_370 t - · exact d2_basis_cert_371 t - -theorem d1_h0_cert (i v : Fin 103) : - rowEval (d1Row i) (h0Coeff v) = - (if i = v then 1 else 0) - (if i = 0 then 1 else 0) := by - fin_cases i - · exact d1_h0_cert_0 v - · exact d1_h0_cert_1 v - · exact d1_h0_cert_2 v - · exact d1_h0_cert_3 v - · exact d1_h0_cert_4 v - · exact d1_h0_cert_5 v - · exact d1_h0_cert_6 v - · exact d1_h0_cert_7 v - · exact d1_h0_cert_8 v - · exact d1_h0_cert_9 v - · exact d1_h0_cert_10 v - · exact d1_h0_cert_11 v - · exact d1_h0_cert_12 v - · exact d1_h0_cert_13 v - · exact d1_h0_cert_14 v - · exact d1_h0_cert_15 v - · exact d1_h0_cert_16 v - · exact d1_h0_cert_17 v - · exact d1_h0_cert_18 v - · exact d1_h0_cert_19 v - · exact d1_h0_cert_20 v - · exact d1_h0_cert_21 v - · exact d1_h0_cert_22 v - · exact d1_h0_cert_23 v - · exact d1_h0_cert_24 v - · exact d1_h0_cert_25 v - · exact d1_h0_cert_26 v - · exact d1_h0_cert_27 v - · exact d1_h0_cert_28 v - · exact d1_h0_cert_29 v - · exact d1_h0_cert_30 v - · exact d1_h0_cert_31 v - · exact d1_h0_cert_32 v - · exact d1_h0_cert_33 v - · exact d1_h0_cert_34 v - · exact d1_h0_cert_35 v - · exact d1_h0_cert_36 v - · exact d1_h0_cert_37 v - · exact d1_h0_cert_38 v - · exact d1_h0_cert_39 v - · exact d1_h0_cert_40 v - · exact d1_h0_cert_41 v - · exact d1_h0_cert_42 v - · exact d1_h0_cert_43 v - · exact d1_h0_cert_44 v - · exact d1_h0_cert_45 v - · exact d1_h0_cert_46 v - · exact d1_h0_cert_47 v - · exact d1_h0_cert_48 v - · exact d1_h0_cert_49 v - · exact d1_h0_cert_50 v - · exact d1_h0_cert_51 v - · exact d1_h0_cert_52 v - · exact d1_h0_cert_53 v - · exact d1_h0_cert_54 v - · exact d1_h0_cert_55 v - · exact d1_h0_cert_56 v - · exact d1_h0_cert_57 v - · exact d1_h0_cert_58 v - · exact d1_h0_cert_59 v - · exact d1_h0_cert_60 v - · exact d1_h0_cert_61 v - · exact d1_h0_cert_62 v - · exact d1_h0_cert_63 v - · exact d1_h0_cert_64 v - · exact d1_h0_cert_65 v - · exact d1_h0_cert_66 v - · exact d1_h0_cert_67 v - · exact d1_h0_cert_68 v - · exact d1_h0_cert_69 v - · exact d1_h0_cert_70 v - · exact d1_h0_cert_71 v - · exact d1_h0_cert_72 v - · exact d1_h0_cert_73 v - · exact d1_h0_cert_74 v - · exact d1_h0_cert_75 v - · exact d1_h0_cert_76 v - · exact d1_h0_cert_77 v - · exact d1_h0_cert_78 v - · exact d1_h0_cert_79 v - · exact d1_h0_cert_80 v - · exact d1_h0_cert_81 v - · exact d1_h0_cert_82 v - · exact d1_h0_cert_83 v - · exact d1_h0_cert_84 v - · exact d1_h0_cert_85 v - · exact d1_h0_cert_86 v - · exact d1_h0_cert_87 v - · exact d1_h0_cert_88 v - · exact d1_h0_cert_89 v - · exact d1_h0_cert_90 v - · exact d1_h0_cert_91 v - · exact d1_h0_cert_92 v - · exact d1_h0_cert_93 v - · exact d1_h0_cert_94 v - · exact d1_h0_cert_95 v - · exact d1_h0_cert_96 v - · exact d1_h0_cert_97 v - · exact d1_h0_cert_98 v - · exact d1_h0_cert_99 v - · exact d1_h0_cert_100 v - · exact d1_h0_cert_101 v - · exact d1_h0_cert_102 v - -theorem fin_ite {n : ℕ} (i j : Fin n) (a b : ℤ) : - @ite ℤ (i = j) (Classical.propDecidable _) a b = - @ite ℤ (i = j) (instDecidableEqFin n i j) a b := by - by_cases h : i = j <;> simp [h] - -local instance : DecidableEq (Fin 103) := Classical.decEq _ -local instance : DecidableEq (Fin 372) := Classical.decEq _ -local instance : DecidableEq (Fin 270) := Classical.decEq _ - -noncomputable def d₁ := FiniteIntegralContraction.rowsMap d1Row -noncomputable def d₂ := FiniteIntegralContraction.rowsMap d2Row -noncomputable def h₀ := FiniteIntegralContraction.matrixMap h0Coeff -noncomputable def h₁ := FiniteIntegralContraction.matrixMap h1Coeff -noncomputable def h₁' := FiniteIntegralContraction.corrected d₁ h₀ h₁ - -theorem d₁_single (e : Fin 372) : - d₁ (Pi.single e 1) = Pi.single (edge e).2 1 - Pi.single (edge e).1 1 := -by - apply FiniteIntegralContraction.rows_single_one edge d1Row - intro i e - simpa only [rowEval,FiniteIntegralContraction.rowEval,fin_ite] using d1_basis_cert i e - -theorem d₂_single (t : Fin 270) : - d₂ (Pi.single t 1) = Pi.single (triangleEdges t).1 1 - - Pi.single (triangleEdges t).2.1 1 + Pi.single (triangleEdges t).2.2 1 := -by - apply FiniteIntegralContraction.rows_single_two triangleEdges d2Row - intro e t - simpa only [rowEval,FiniteIntegralContraction.rowEval,fin_ite] using d2_basis_cert e t - -theorem bottom_identity (v : Fin 103) : d₁ (h₀ (Pi.single v 1)) = Pi.single v 1 - Pi.single 0 1 := -by - apply FiniteIntegralContraction.certificate_bottom d1Row h0Coeff 0 - intro i v - simpa only [rowEval,FiniteIntegralContraction.rowEval,fin_ite] using d1_h0_cert i v - -theorem left_identity (t : Fin 270) : h₁ (d₂ (Pi.single t 1)) = Pi.single t 1 := -by - apply FiniteIntegralContraction.certificate_left triangleEdges d2Row h1Coeff d₂_single - intro t j - simpa only [fin_ite] using h1_boundary_cert t j - -theorem d₁_d₂_single (t : Fin 270) : d₁ (d₂ (Pi.single t 1)) = 0 := by - rw [d₂_single,map_add,map_sub,d₁_single,d₁_single,d₁_single] - obtain ⟨h₁,h₂,h₃⟩ := triangle_edges_valid t - rw [h₁,h₂,h₃] - dsimp - abel - -theorem corrected_identities : - (∀ t, h₁' (d₂ (Pi.single t 1)) = Pi.single t 1) ∧ - (∀ e, d₂ (h₁' (Pi.single e 1)) + h₀ (d₁ (Pi.single e 1)) = Pi.single e 1) := - FiniteIntegralContraction.middle_of_rank (by simp only [Fintype.card_fin]) 0 d₁ d₂ h₀ h₁ - d₁_d₂_single bottom_identity left_identity - -theorem fin_single {n : ℕ} (d : DecidableEq (Fin n)) (i : Fin n) (a : ℤ) : - @Pi.single (Fin n) (fun _ => ℤ) (fun _ => inferInstance) d i a = - @Pi.single (Fin n) (fun _ => ℤ) (fun _ => inferInstance) (instDecidableEqFin n) i a := by - ext j - simp only [Pi.single_apply] - split_ifs <;> rfl - -/-- An augmented integral chain contraction of the actual103-vertex source -cell-order complex, not an assumed homology property of the seed. -/ -noncomputable def contraction : SimplicialChains.Contraction graph := - indices.contraction 0 h₀ h₁' d₁ d₂ - (by simpa only [indices,fin_single] using d₁_single) - (by simpa only [indices,fin_single] using d₂_single) - (by simpa only [fin_single] using bottom_identity) - (by simpa only [fin_single] using corrected_identities.1) - (by simpa only [fin_single] using corrected_identities.2) - -end EilenbergGanea.SeedChainCertificate - - -end - -end OAI +import OAI.Topology.EilenbergGanea.SeedChains +import OAI.AlgebraicTopology.Integral.Contraction + +namespace OAI + +noncomputable section + +open Classical Set + +namespace EilenbergGanea.SeedChainCertificate +def d1Data_0 : List (List (Fin 372 × ℤ)) := [ + [(0,-1),(1,-1),(2,-1),(3,-1),(4,-1),(5,-1),(6,-1),(7,-1),(8,-1),(9,-1),(10,-1),(11,-1),(12,-1),(13,-1),(14,-1),(15,-1),(16,-1),(17,-1),(18,-1),(19,-1),(20,-1),(21,-1),(22,-1),(23,-1),(24,-1),(25,-1),(26,-1),(27,-1),(28,-1),(29,-1),(30,-1),(31,-1),(32,-1),(33,-1),(34,-1),(35,-1),(36,-1),(37,-1),(38,-1),(39,-1),(40,-1),(41,-1),(42,-1),(43,-1),(44,-1),(45,-1),(46,-1),(47,-1),(48,-1)], + [(49,-1),(50,-1),(51,-1),(52,-1),(53,-1),(54,-1),(55,-1),(56,-1),(57,-1),(58,-1),(59,-1),(60,-1),(61,-1),(62,-1),(63,-1),(64,-1),(65,-1),(66,-1),(67,-1),(68,-1),(69,-1),(70,-1),(71,-1)], + [(72,-1),(73,-1),(74,-1),(75,-1),(76,-1),(77,-1),(78,-1),(79,-1),(80,-1),(81,-1),(82,-1),(83,-1),(84,-1),(85,-1),(86,-1),(87,-1),(88,-1),(89,-1),(90,-1),(91,-1),(92,-1),(93,-1),(94,-1)], + [(95,-1),(96,-1),(97,-1),(98,-1),(99,-1),(100,-1),(101,-1),(102,-1),(103,-1),(104,-1),(105,-1),(106,-1),(107,-1),(108,-1),(109,-1),(110,-1),(111,-1),(112,-1),(113,-1),(114,-1),(115,-1),(116,-1),(117,-1),(118,-1),(119,-1),(120,-1)], + [(121,-1),(122,-1),(123,-1),(124,-1),(125,-1),(126,-1),(127,-1),(128,-1),(129,-1),(130,-1),(131,-1),(132,-1),(133,-1),(134,-1),(135,-1),(136,-1),(137,-1),(138,-1),(139,-1),(140,-1),(141,-1),(142,-1),(143,-1),(144,-1),(145,-1),(146,-1)], + [(147,-1),(148,-1),(149,-1),(150,-1),(151,-1),(152,-1),(153,-1),(154,-1),(155,-1),(156,-1),(157,-1),(158,-1),(159,-1),(160,-1),(161,-1),(162,-1),(163,-1),(164,-1),(165,-1),(166,-1),(167,-1),(168,-1),(169,-1),(170,-1),(171,-1),(172,-1),(173,-1),(174,-1),(175,-1),(176,-1),(177,-1),(178,-1),(179,-1),(180,-1),(181,-1),(182,-1),(183,-1),(184,-1),(185,-1),(186,-1),(187,-1),(188,-1)], + [(189,-1),(190,-1),(191,-1),(192,-1),(193,-1),(194,-1),(195,-1),(196,-1),(197,-1),(198,-1),(199,-1),(200,-1),(201,-1),(202,-1),(203,-1),(204,-1),(205,-1),(206,-1),(207,-1),(208,-1),(209,-1),(210,-1),(211,-1),(212,-1),(213,-1),(214,-1),(215,-1),(216,-1),(217,-1),(218,-1),(219,-1),(220,-1),(221,-1),(222,-1),(223,-1),(224,-1),(225,-1),(226,-1),(227,-1),(228,-1),(229,-1),(230,-1),(231,-1),(232,-1),(233,-1),(234,-1),(235,-1),(236,-1)], + [(0,1),(49,1),(237,-1),(238,-1),(239,-1),(240,-1),(241,-1),(242,-1),(243,-1)], + [(50,1),(72,1),(244,-1),(245,-1),(246,-1),(247,-1),(248,-1),(249,-1),(250,-1)], + [(1,1),(73,1),(251,-1),(252,-1),(253,-1),(254,-1),(255,-1),(256,-1),(257,-1)], + [(2,1),(95,1),(258,-1),(259,-1),(260,-1),(261,-1),(262,-1),(263,-1),(264,-1),(265,-1)], + [(96,1),(121,1),(266,-1),(267,-1),(268,-1),(269,-1),(270,-1),(271,-1),(272,-1),(273,-1)], + [(3,1),(122,1),(274,-1),(275,-1),(276,-1),(277,-1),(278,-1),(279,-1),(280,-1),(281,-1)], + [(4,1),(147,1),(282,-1),(283,-1)], + [(51,1),(148,1),(284,-1),(285,-1)], + [(74,1),(149,1),(286,-1),(287,-1)]] + +def d1Data_1 : List (List (Fin 372 × ℤ)) := [ + [(5,1),(150,1),(288,-1),(289,-1)], + [(52,1),(151,1),(290,-1),(291,-1)], + [(75,1),(152,1),(292,-1),(293,-1)], + [(6,1),(153,1),(294,-1),(295,-1)], + [(123,1),(154,1),(296,-1),(297,-1)], + [(97,1),(155,1),(298,-1),(299,-1)], + [(7,1),(156,1),(300,-1),(301,-1)], + [(124,1),(157,1),(302,-1),(303,-1)], + [(98,1),(158,1),(304,-1),(305,-1)], + [(8,1),(159,1),(306,-1),(307,-1)], + [(125,1),(160,1),(308,-1),(309,-1)], + [(99,1),(161,1),(310,-1),(311,-1)], + [(9,1),(162,1),(312,-1),(313,-1)], + [(126,1),(163,1),(314,-1),(315,-1)], + [(100,1),(164,1),(316,-1),(317,-1)], + [(10,1),(165,1),(318,-1),(319,-1)]] + +def d1Data_2 : List (List (Fin 372 × ℤ)) := [ + [(127,1),(166,1),(320,-1),(321,-1)], + [(101,1),(167,1),(322,-1),(323,-1)], + [(11,1),(189,1),(324,-1),(325,-1)], + [(53,1),(190,1),(326,-1),(327,-1)], + [(76,1),(191,1),(328,-1),(329,-1)], + [(12,1),(192,1),(330,-1),(331,-1)], + [(54,1),(193,1),(332,-1),(333,-1)], + [(77,1),(194,1),(334,-1),(335,-1)], + [(13,1),(195,1),(336,-1),(337,-1)], + [(102,1),(196,1),(338,-1),(339,-1)], + [(128,1),(197,1),(340,-1),(341,-1)], + [(14,1),(198,1),(342,-1),(343,-1)], + [(78,1),(199,1),(344,-1),(345,-1)], + [(55,1),(200,1),(346,-1),(347,-1)], + [(15,1),(201,1),(348,-1),(349,-1)], + [(103,1),(202,1),(350,-1),(351,-1)]] + +def d1Data_3 : List (List (Fin 372 × ℤ)) := [ + [(129,1),(203,1),(352,-1),(353,-1)], + [(16,1),(204,1),(354,-1),(355,-1)], + [(79,1),(205,1),(356,-1),(357,-1)], + [(56,1),(206,1),(358,-1),(359,-1)], + [(17,1),(207,1),(360,-1),(361,-1)], + [(104,1),(208,1),(362,-1),(363,-1)], + [(130,1),(209,1),(364,-1),(365,-1)], + [(18,1),(210,1),(366,-1),(367,-1)], + [(80,1),(211,1),(368,-1),(369,-1)], + [(57,1),(212,1),(370,-1),(371,-1)], + [(19,1),(58,1),(168,1),(237,1),(282,1),(284,1)], + [(59,1),(81,1),(169,1),(244,1),(285,1),(286,1)], + [(20,1),(82,1),(170,1),(251,1),(287,1),(288,1)], + [(21,1),(60,1),(171,1),(238,1),(289,1),(290,1)], + [(61,1),(83,1),(172,1),(245,1),(291,1),(292,1)], + [(22,1),(84,1),(173,1),(252,1),(293,1),(294,1)]] + +def d1Data_4 : List (List (Fin 372 × ℤ)) := [ + [(23,1),(131,1),(174,1),(274,1),(295,1),(296,1)], + [(105,1),(132,1),(175,1),(266,1),(297,1),(298,1)], + [(24,1),(106,1),(176,1),(258,1),(299,1),(300,1)], + [(25,1),(133,1),(177,1),(275,1),(301,1),(302,1)], + [(107,1),(134,1),(178,1),(267,1),(303,1),(304,1)], + [(26,1),(108,1),(179,1),(259,1),(305,1),(306,1)], + [(27,1),(135,1),(180,1),(276,1),(307,1),(308,1)], + [(109,1),(136,1),(181,1),(268,1),(309,1),(310,1)], + [(28,1),(110,1),(182,1),(260,1),(311,1),(312,1)], + [(29,1),(137,1),(183,1),(277,1),(313,1),(314,1)], + [(111,1),(138,1),(184,1),(269,1),(315,1),(316,1)], + [(30,1),(112,1),(185,1),(261,1),(317,1),(318,1)], + [(31,1),(139,1),(186,1),(278,1),(319,1),(320,1)], + [(113,1),(140,1),(187,1),(270,1),(321,1),(322,1)], + [(32,1),(114,1),(188,1),(262,1),(283,1),(323,1)], + [(33,1),(62,1),(213,1),(239,1),(324,1),(326,1)]] + +def d1Data_5 : List (List (Fin 372 × ℤ)) := [ + [(63,1),(85,1),(214,1),(246,1),(327,1),(328,1)], + [(34,1),(86,1),(215,1),(253,1),(329,1),(330,1)], + [(35,1),(64,1),(216,1),(240,1),(331,1),(332,1)], + [(65,1),(87,1),(217,1),(247,1),(333,1),(334,1)], + [(36,1),(88,1),(218,1),(254,1),(335,1),(336,1)], + [(37,1),(115,1),(219,1),(263,1),(337,1),(338,1)], + [(116,1),(141,1),(220,1),(271,1),(339,1),(340,1)], + [(38,1),(142,1),(221,1),(279,1),(341,1),(342,1)], + [(39,1),(89,1),(222,1),(255,1),(343,1),(344,1)], + [(66,1),(90,1),(223,1),(248,1),(345,1),(346,1)], + [(40,1),(67,1),(224,1),(241,1),(347,1),(348,1)], + [(41,1),(117,1),(225,1),(264,1),(349,1),(350,1)], + [(118,1),(143,1),(226,1),(272,1),(351,1),(352,1)], + [(42,1),(144,1),(227,1),(280,1),(353,1),(354,1)], + [(43,1),(91,1),(228,1),(256,1),(355,1),(356,1)], + [(68,1),(92,1),(229,1),(249,1),(357,1),(358,1)]] + +def d1Data_6 : List (List (Fin 372 × ℤ)) := [ + [(44,1),(69,1),(230,1),(242,1),(359,1),(360,1)], + [(45,1),(119,1),(231,1),(265,1),(361,1),(362,1)], + [(120,1),(145,1),(232,1),(273,1),(363,1),(364,1)], + [(46,1),(146,1),(233,1),(281,1),(365,1),(366,1)], + [(47,1),(93,1),(234,1),(257,1),(367,1),(368,1)], + [(70,1),(94,1),(235,1),(250,1),(369,1),(370,1)], + [(48,1),(71,1),(236,1),(243,1),(325,1),(371,1)]] + +def d1Data : List (List (Fin 372 × ℤ)) := [d1Data_0,d1Data_1,d1Data_2,d1Data_3,d1Data_4,d1Data_5,d1Data_6].flatten + +def d2Data_0 : List (List (Fin 270 × ℤ)) := [ + [(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1)], + [(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1)], + [(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1)], + [(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1)], + [(30,1),(31,1)], + [(32,1),(33,1)], + [(34,1),(35,1)], + [(36,1),(37,1)], + [(38,1),(39,1)], + [(40,1),(41,1)], + [(42,1),(43,1)], + [(44,1),(45,1)], + [(46,1),(47,1)], + [(48,1),(49,1)], + [(50,1),(51,1)], + [(52,1),(53,1)]] + +def d2Data_1 : List (List (Fin 270 × ℤ)) := [ + [(54,1),(55,1)], + [(56,1),(57,1)], + [(58,1),(59,1)], + [(0,-1),(30,-1)], + [(7,-1),(32,-1)], + [(1,-1),(33,-1)], + [(8,-1),(34,-1)], + [(22,-1),(35,-1)], + [(14,-1),(36,-1)], + [(23,-1),(37,-1)], + [(15,-1),(38,-1)], + [(24,-1),(39,-1)], + [(16,-1),(40,-1)], + [(25,-1),(41,-1)], + [(17,-1),(42,-1)], + [(26,-1),(43,-1)]] + +def d2Data_2 : List (List (Fin 270 × ℤ)) := [ + [(18,-1),(31,-1)], + [(2,-1),(44,-1)], + [(9,-1),(46,-1)], + [(3,-1),(47,-1)], + [(10,-1),(48,-1)], + [(19,-1),(49,-1)], + [(27,-1),(50,-1)], + [(11,-1),(51,-1)], + [(4,-1),(52,-1)], + [(20,-1),(53,-1)], + [(28,-1),(54,-1)], + [(12,-1),(55,-1)], + [(5,-1),(56,-1)], + [(21,-1),(57,-1)], + [(29,-1),(58,-1)], + [(13,-1),(59,-1)]] + +def d2Data_3 : List (List (Fin 270 × ℤ)) := [ + [(6,-1),(45,-1)], + [(60,1),(61,1),(62,1),(63,1),(64,1),(65,1),(66,1)], + [(67,1),(68,1),(69,1),(70,1),(71,1),(72,1),(73,1)], + [(74,1),(75,1)], + [(76,1),(77,1)], + [(78,1),(79,1)], + [(80,1),(81,1)], + [(82,1),(83,1)], + [(84,1),(85,1)], + [(86,1),(87,1)], + [(60,-1),(74,-1)], + [(67,-1),(75,-1)], + [(61,-1),(76,-1)], + [(68,-1),(77,-1)], + [(62,-1),(78,-1)], + [(69,-1),(79,-1)]] + +def d2Data_4 : List (List (Fin 270 × ℤ)) := [ + [(63,-1),(80,-1)], + [(70,-1),(81,-1)], + [(71,-1),(82,-1)], + [(64,-1),(83,-1)], + [(72,-1),(84,-1)], + [(65,-1),(85,-1)], + [(73,-1),(86,-1)], + [(66,-1),(87,-1)], + [(88,1),(89,1),(90,1),(91,1),(92,1),(93,1),(94,1)], + [(95,1),(96,1),(97,1),(98,1),(99,1),(100,1),(101,1)], + [(102,1),(103,1)], + [(104,1),(105,1)], + [(106,1),(107,1)], + [(108,1),(109,1)], + [(110,1),(111,1)], + [(112,1),(113,1)]] + +def d2Data_5 : List (List (Fin 270 × ℤ)) := [ + [(114,1),(115,1)], + [(88,-1),(102,-1)], + [(95,-1),(103,-1)], + [(89,-1),(104,-1)], + [(96,-1),(105,-1)], + [(90,-1),(106,-1)], + [(97,-1),(107,-1)], + [(91,-1),(108,-1)], + [(98,-1),(109,-1)], + [(99,-1),(110,-1)], + [(92,-1),(111,-1)], + [(100,-1),(112,-1)], + [(93,-1),(113,-1)], + [(101,-1),(114,-1)], + [(94,-1),(115,-1)], + [(116,1),(117,1),(118,1),(119,1),(120,1),(121,1),(122,1),(123,1)]] + +def d2Data_6 : List (List (Fin 270 × ℤ)) := [ + [(124,1),(125,1),(126,1),(127,1),(128,1),(129,1),(130,1),(131,1)], + [(132,1),(133,1)], + [(134,1),(135,1)], + [(136,1),(137,1)], + [(138,1),(139,1)], + [(140,1),(141,1)], + [(142,1),(143,1)], + [(144,1),(145,1)], + [(146,1),(147,1)], + [(124,-1),(132,-1)], + [(116,-1),(133,-1)], + [(125,-1),(134,-1)], + [(117,-1),(135,-1)], + [(126,-1),(136,-1)], + [(118,-1),(137,-1)], + [(127,-1),(138,-1)]] + +def d2Data_7 : List (List (Fin 270 × ℤ)) := [ + [(119,-1),(139,-1)], + [(128,-1),(140,-1)], + [(120,-1),(141,-1)], + [(121,-1),(142,-1)], + [(129,-1),(143,-1)], + [(122,-1),(144,-1)], + [(130,-1),(145,-1)], + [(123,-1),(146,-1)], + [(131,-1),(147,-1)], + [(148,1),(149,1),(150,1),(151,1),(152,1),(153,1),(154,1),(155,1)], + [(156,1),(157,1),(158,1),(159,1),(160,1),(161,1),(162,1),(163,1)], + [(164,1),(165,1)], + [(166,1),(167,1)], + [(168,1),(169,1)], + [(170,1),(171,1)], + [(172,1),(173,1)]] + +def d2Data_8 : List (List (Fin 270 × ℤ)) := [ + [(174,1),(175,1)], + [(176,1),(177,1)], + [(178,1),(179,1)], + [(156,-1),(164,-1)], + [(148,-1),(165,-1)], + [(157,-1),(166,-1)], + [(149,-1),(167,-1)], + [(158,-1),(168,-1)], + [(150,-1),(169,-1)], + [(159,-1),(170,-1)], + [(151,-1),(171,-1)], + [(160,-1),(172,-1)], + [(152,-1),(173,-1)], + [(153,-1),(174,-1)], + [(161,-1),(175,-1)], + [(154,-1),(176,-1)]] + +def d2Data_9 : List (List (Fin 270 × ℤ)) := [ + [(162,-1),(177,-1)], + [(155,-1),(178,-1)], + [(163,-1),(179,-1)], + [(180,1),(181,1)], + [(182,1),(183,1)], + [(184,1),(185,1)], + [(186,1),(187,1)], + [(188,1),(189,1)], + [(190,1),(191,1)], + [(192,1),(193,1)], + [(194,1),(195,1)], + [(196,1),(197,1)], + [(198,1),(199,1)], + [(200,1),(201,1)], + [(202,1),(203,1)], + [(204,1),(205,1)]] + +def d2Data_10 : List (List (Fin 270 × ℤ)) := [ + [(206,1),(207,1)], + [(208,1),(209,1)], + [(210,1),(211,1)], + [(212,1),(213,1)], + [(214,1),(215,1)], + [(216,1),(217,1)], + [(218,1),(219,1)], + [(220,1),(221,1)], + [(180,-1),(182,-1)], + [(183,-1),(184,-1)], + [(185,-1),(186,-1)], + [(187,-1),(188,-1)], + [(189,-1),(190,-1)], + [(191,-1),(192,-1)], + [(193,-1),(194,-1)], + [(195,-1),(196,-1)]] + +def d2Data_11 : List (List (Fin 270 × ℤ)) := [ + [(197,-1),(198,-1)], + [(199,-1),(200,-1)], + [(201,-1),(202,-1)], + [(203,-1),(204,-1)], + [(205,-1),(206,-1)], + [(207,-1),(208,-1)], + [(209,-1),(210,-1)], + [(211,-1),(212,-1)], + [(213,-1),(214,-1)], + [(215,-1),(216,-1)], + [(217,-1),(218,-1)], + [(219,-1),(220,-1)], + [(181,-1),(221,-1)], + [(222,1),(223,1)], + [(224,1),(225,1)], + [(226,1),(227,1)]] + +def d2Data_12 : List (List (Fin 270 × ℤ)) := [ + [(228,1),(229,1)], + [(230,1),(231,1)], + [(232,1),(233,1)], + [(234,1),(235,1)], + [(236,1),(237,1)], + [(238,1),(239,1)], + [(240,1),(241,1)], + [(242,1),(243,1)], + [(244,1),(245,1)], + [(246,1),(247,1)], + [(248,1),(249,1)], + [(250,1),(251,1)], + [(252,1),(253,1)], + [(254,1),(255,1)], + [(256,1),(257,1)], + [(258,1),(259,1)]] + +def d2Data_13 : List (List (Fin 270 × ℤ)) := [ + [(260,1),(261,1)], + [(262,1),(263,1)], + [(264,1),(265,1)], + [(266,1),(267,1)], + [(268,1),(269,1)], + [(222,-1),(224,-1)], + [(225,-1),(226,-1)], + [(227,-1),(228,-1)], + [(229,-1),(230,-1)], + [(231,-1),(232,-1)], + [(233,-1),(234,-1)], + [(235,-1),(236,-1)], + [(237,-1),(238,-1)], + [(239,-1),(240,-1)], + [(241,-1),(242,-1)], + [(243,-1),(244,-1)]] + +def d2Data_14 : List (List (Fin 270 × ℤ)) := [ + [(245,-1),(246,-1)], + [(247,-1),(248,-1)], + [(249,-1),(250,-1)], + [(251,-1),(252,-1)], + [(253,-1),(254,-1)], + [(255,-1),(256,-1)], + [(257,-1),(258,-1)], + [(259,-1),(260,-1)], + [(261,-1),(262,-1)], + [(263,-1),(264,-1)], + [(265,-1),(266,-1)], + [(267,-1),(268,-1)], + [(223,-1),(269,-1)], + [(0,1),(60,1)], + [(1,1),(61,1)], + [(2,1),(62,1)]] + +def d2Data_15 : List (List (Fin 270 × ℤ)) := [ + [(3,1),(63,1)], + [(4,1),(64,1)], + [(5,1),(65,1)], + [(6,1),(66,1)], + [(67,1),(88,1)], + [(68,1),(89,1)], + [(69,1),(90,1)], + [(70,1),(91,1)], + [(71,1),(92,1)], + [(72,1),(93,1)], + [(73,1),(94,1)], + [(7,1),(95,1)], + [(8,1),(96,1)], + [(9,1),(97,1)], + [(10,1),(98,1)], + [(11,1),(99,1)]] + +def d2Data_16 : List (List (Fin 270 × ℤ)) := [ + [(12,1),(100,1)], + [(13,1),(101,1)], + [(14,1),(116,1)], + [(15,1),(117,1)], + [(16,1),(118,1)], + [(17,1),(119,1)], + [(18,1),(120,1)], + [(19,1),(121,1)], + [(20,1),(122,1)], + [(21,1),(123,1)], + [(124,1),(148,1)], + [(125,1),(149,1)], + [(126,1),(150,1)], + [(127,1),(151,1)], + [(128,1),(152,1)], + [(129,1),(153,1)]] + +def d2Data_17 : List (List (Fin 270 × ℤ)) := [ + [(130,1),(154,1)], + [(131,1),(155,1)], + [(22,1),(156,1)], + [(23,1),(157,1)], + [(24,1),(158,1)], + [(25,1),(159,1)], + [(26,1),(160,1)], + [(27,1),(161,1)], + [(28,1),(162,1)], + [(29,1),(163,1)], + [(30,1),(180,1)], + [(31,1),(181,1)], + [(74,1),(182,1)], + [(75,1),(183,1)], + [(102,1),(184,1)], + [(103,1),(185,1)]] + +def d2Data_18 : List (List (Fin 270 × ℤ)) := [ + [(32,1),(186,1)], + [(33,1),(187,1)], + [(76,1),(188,1)], + [(77,1),(189,1)], + [(104,1),(190,1)], + [(105,1),(191,1)], + [(34,1),(192,1)], + [(35,1),(193,1)], + [(164,1),(194,1)], + [(165,1),(195,1)], + [(132,1),(196,1)], + [(133,1),(197,1)], + [(36,1),(198,1)], + [(37,1),(199,1)], + [(166,1),(200,1)], + [(167,1),(201,1)]] + +def d2Data_19 : List (List (Fin 270 × ℤ)) := [ + [(134,1),(202,1)], + [(135,1),(203,1)], + [(38,1),(204,1)], + [(39,1),(205,1)], + [(168,1),(206,1)], + [(169,1),(207,1)], + [(136,1),(208,1)], + [(137,1),(209,1)], + [(40,1),(210,1)], + [(41,1),(211,1)], + [(170,1),(212,1)], + [(171,1),(213,1)], + [(138,1),(214,1)], + [(139,1),(215,1)], + [(42,1),(216,1)], + [(43,1),(217,1)]] + +def d2Data_20 : List (List (Fin 270 × ℤ)) := [ + [(172,1),(218,1)], + [(173,1),(219,1)], + [(140,1),(220,1)], + [(141,1),(221,1)], + [(44,1),(222,1)], + [(45,1),(223,1)], + [(78,1),(224,1)], + [(79,1),(225,1)], + [(106,1),(226,1)], + [(107,1),(227,1)], + [(46,1),(228,1)], + [(47,1),(229,1)], + [(80,1),(230,1)], + [(81,1),(231,1)], + [(108,1),(232,1)], + [(109,1),(233,1)]] + +def d2Data_21 : List (List (Fin 270 × ℤ)) := [ + [(48,1),(234,1)], + [(49,1),(235,1)], + [(142,1),(236,1)], + [(143,1),(237,1)], + [(174,1),(238,1)], + [(175,1),(239,1)], + [(50,1),(240,1)], + [(51,1),(241,1)], + [(110,1),(242,1)], + [(111,1),(243,1)], + [(82,1),(244,1)], + [(83,1),(245,1)], + [(52,1),(246,1)], + [(53,1),(247,1)], + [(144,1),(248,1)], + [(145,1),(249,1)]] + +def d2Data_22 : List (List (Fin 270 × ℤ)) := [ + [(176,1),(250,1)], + [(177,1),(251,1)], + [(54,1),(252,1)], + [(55,1),(253,1)], + [(112,1),(254,1)], + [(113,1),(255,1)], + [(84,1),(256,1)], + [(85,1),(257,1)], + [(56,1),(258,1)], + [(57,1),(259,1)], + [(146,1),(260,1)], + [(147,1),(261,1)], + [(178,1),(262,1)], + [(179,1),(263,1)], + [(58,1),(264,1)], + [(59,1),(265,1)]] + +def d2Data_23 : List (List (Fin 270 × ℤ)) := [ + [(114,1),(266,1)], + [(115,1),(267,1)], + [(86,1),(268,1)], + [(87,1),(269,1)]] + +def d2Data : List (List (Fin 270 × ℤ)) := [d2Data_0,d2Data_1,d2Data_2,d2Data_3,d2Data_4,d2Data_5,d2Data_6,d2Data_7,d2Data_8,d2Data_9,d2Data_10,d2Data_11,d2Data_12,d2Data_13,d2Data_14,d2Data_15,d2Data_16,d2Data_17,d2Data_18,d2Data_19,d2Data_20,d2Data_21,d2Data_22,d2Data_23].flatten + +def h0CodeData_0 : List (ℕ) := [ + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198805, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065167114401743759279967291397462, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974580047499508942991460908927726036895443277145, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775440332605179127999059521355709682110447775227769225458570597, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867818480452138321292628547852962782554227063323134017148470870931120785282453, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701006361921833641501652060710894045368114183781018220226386875789505889593007828205433083477, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127084933600319805317659541841036625864998163475823904152171255209796171635266570836387262136116819224009742737909044565, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198806, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303066434765001971988681463994602838, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198809, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198821, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775446609706914514679823357145132889776863877583213689493083493, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467198869, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467199061, + 30845763132983623646676132847120415275432388327850829810140857402521664303920611415308389472992066420305377421240443803744195824843594904142167318387202259389270767566357586271705003989733389129756858685030629456371141399893, + 30845763132983623646676132847120415275432388327850768943674869880702735352128329236507716764886623543954148569785233442317704764266908459090343653106599350587318271407067042771716092562677811178945251578508837479747941651797] + +def h0CodeData_1 : List (ℕ) := [ + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467199829, + 30845763132983623646676132847120415275432388327846873489851668484291282437422269793264663446138279457475502076651770311022276887358975975773629075148013187262358517212472258772425761231120822327002396761114150926385134523733, + 30845763132983623646676132847120415275432388327597564445166779113958295896234465425709251046244257922842126516110129908114892765251297043503896085798498734464934248758406082817844556011473535802659688447854211313253385327957, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467202901, + 30845763132983623646676132847120415275432388311641785585333859412647157260214985902162857453026879706306090641445144122042308950359845378240984767429573755429781067698170821724647421954047198244726356399218075281173064799573, + 30845763132983623646676132847120415275432387290471938556026998528734284554968296395193667487114673847999794662886053813396944797306938801414660391818375097179977479843114111760030842278761594536993105286505366061439062988117, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467215189, + 30845763132983623646676132847120415275432321935601728680387901958310431419180167949165509668733498916396852035104274060093639001920917884529900352701660969192547857119484674024569743060482957242065034072891963332088995075413, + 30845763132983623646676132847120415275428139223908296639485721451183830728739947403363409292338303293808523857070369848682068097215579203905257849231956777997052002807200658955059393090650170366668476401634137988188840744277, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467264341, + 30845763132983623646676132847120415275160445675528646021746168995081386540565832472028985203045783448155520462900500318341530196073903643928137627170888541485317326821023694506396995021351810341288785441133113316595731879253, + 30845763132983623646676132847120415258028058579231006486414811804524958497422476866625843488324513326363303236028850376547104523006667805392443415262521404734298063705697969792003518586256768716988563969066723686703837828437, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341467460949, + 30845763132983623646676132847120414161555284416182076225207951608913563736247718120824773746163225531661400716243254101703861446703574139108013853127024652669065224324851588070821026740174104761774389756814544781890911819093, + 30845763132983623646676132847120343987297737981050539507968899089784299021063158389556310247840806670739639449965092511736304563305579496904521876455232520494163503950683157915141548590883611628067240172662124506936820192597, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341468247381] + +def h0CodeData_2 : List (ℕ) := [ + 30845763132983623646676132847115852834814766132632189604669537865511357249251335588374646355205999571746918408162750753812664025833922395881035369460536061300453400003903627951654947036292051070809666786855345442167647982933, + 30845763132983623646676132846828419075904567833857795793510419512043083853294676312748157226578345236212771732812878246699669627647867930377898921799962672903006747410013710288512447542432175406324970095013959426111394108757, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341471393109, + 30845763132983623646676132828432658505651876712296591879326844890073586512068482672652852994408467762027384510421037791468028143740382138177166271523265815466420981401058979847392479935400132879304381816335150915194216338773, + 30845763132983623646676131651103982009479644932379541371578069084025756673592089706553382135536309414162602277343248656642973173661291437330276653814666939524931956827956231615714553085349411149986731977570992283227119768917, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341483976021, + 30845763132983623646676056302068686254456811017688308875656417496964647011102939876187247167718175150816539360364744027839455088599486583129341120464338879269634384149380344788327234682103220473657142283383184104262062134613, + 30845763132983623646671233963809757932995440477449429136670715925053628611797350732754609227357582296668512673740447784414297644643975914269466986043343022930589732720523587835538856874347017188563401802236837718214864885077, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341534307669, + 30845763132983623646362604315238345359467725902161125841585815322748451056239645553065781044279639631194804729785488205204221231491293107237522383099608217231732041273691142857082677177950006942564010796364177282060206298453, + 30845763132983623626610306806667940653693993083709714956152176775217087500546514052980777327291309040877496316668075135759330789719593457193067794700580652504839788676414664235887176608541351198602985570487942451625918289237, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630341735634261, + 30845763132983622362463266258162039484175092702819418288399309733209819936186098047540539440038151260569757877153638691286342516330815854347974137162816509983735622450720032479375140166387383585097367714305045637686931838293, + 30845763132983541457052671153784364634965468325840431552215819044744695817119473699365314655836053320874497748229706245015093019449049272261980054745911388633068984006263600062604807868533456320737811318184178881013583533397, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630342540940629, + 30845763132978363510774584473613174285549508199185280436472414982976752196855515416150928466901785180377849497098029683655125219015988018758358780063983622190404123561051925389303540805882111401726147564786823795606430242133] + +def h0CodeData_3 : List (ℕ) := [ + 30845763132646974948977036942656991922928060093255609028894555029828360499962185290430212375108624188592361424670729756617185991300067794526597200420606569859853055067504746298022448796196036584979449740708567696297172489557, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630345762166101, + 30845763111438106993933994961461320715155381313756638943911518028331291898789057244304382500346320714321124789323534426189075417481173443693856103244475220704584671480485284456032560176287248313189918573110054807498887877973, + 30845761754070557871179308164938363417703939425822553504997149932518901423708862292251270515558898360961980127103033278789998693071934990398425883972068874767408121911239726568679688502124798918656442140444739792385518949717, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630358647067989, + 30845674882547414014879353187469096380811658598041085414477591800525911018576385360852103489163867745976721744990959845249088330880673979490891850538062734788108949479524021778095901355728037668500023624422618297037292393813, + 30840115105066207211682234629436006019705685620027127621225871352974525090097861751305413799881908386920185289818260098630825150639969281408713710761669776112961913849718915180733523986335317658433531297239000482380332225877, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630410186675541, + 30484289346268971807066646915318222908923415027133828853115762709685825667472350740317273685836509407301852158765476315061981615234868604149312765072520420903551633542192092949541372345201237013955193150416091894853039117653, + 7711440783245905911669033211780103818858097081962707694068809539209062619439646037076306386930974711728531771387314166655995349308425259547652240966961687501293693860475470153243667312620075766450234925464468495178910750037, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816630616345105749, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480635372166060630711985231732361483606, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816631440978826581, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816634739513709909, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250485619977150254065235374508208412775766, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816647933653243221] + +def h0CodeData_4 : List (ℕ) := [ + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816700710211376469, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005176420944889926385170154028703913060187093183640861349088807179621, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800816911816443909461, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800817756241374041429, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005201103513249744475802478566442273317761834221625365047039036314981, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800821133941094569301, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800834644739976680789, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005596024607006833925919671170256037438957690829377424214242702480741, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051800888687935505126741, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051801104860717618910549, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750011914762107120265127794752831276263378091396553410370889501361132901, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051801969551846074045781, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051805428316359894586709, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750113014562108935164357796059407599878404230688137937517693639899567461, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051819263374415176750421, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027051874603606636305405269] + +def h0CodeData_5 : List (ℕ) := [ + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250565373656897349017609602931825233450326, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027052095964535520820024661, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027052981408251058878502229, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669251841432532850868255597257709694364243286, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027056523183113211112412501, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027070690282561820048053589, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846756906921122230896392613883861336546808160791082618161782931749682369893, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027127358680356255790617941, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484027354032271533998760875349, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669255924820935902129817157752998875582780758, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484028260726636244970641904981, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484031887504095088858166023509, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846860433116324089353204135221795491928594927425665173960110369613039359333, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484046394613930464408262497621, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484104423053271966608648394069, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669337592588996927361048367658782499953530198] + +def h0CodeData_6 : List (ℕ) := [ + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065484336536810637975410191979861, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065485264991840102010616366323029, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867848516852239553824662188476628741978037183193578986066733349375426751190373, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065488978811957958151441063695701, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065503834092429382714739853186389, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974670644276877973331060747726151320489885521238, + 30845763132983623646676132847120415275432388327850830776275238156836250477758584148305225547723898846914127085549256666623981397233701038190608963867846750005174775441901880612974669250480303065563255214315080967935011149141] + +def h0CodeData : List (ℕ) := [h0CodeData_0,h0CodeData_1,h0CodeData_2,h0CodeData_3,h0CodeData_4,h0CodeData_5,h0CodeData_6].flatten + +def h1CodeData_0 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData_1 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData_2 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData_3 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300865144476228943516043342214815198253176837891581657254566598836413859227936136125673519515098118422877928451228177, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635303325364955898838061585360244827795465809614575239324861042770312704164212589224709486874342433786983838546313888304, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805637822591136137870852696674465908071579317897865882500919089851016790018483368931497125460763467888715537899789513934352, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729808217550740826477213839029923238840721863572264876256292295700172361753225775353964453997876697813105863069046485115519504, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755814420799306014560234469342536876691485834951643579865823362757224918392377818603407507846731229198776416106772242757710266896, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034842375733576576327101394067437513832132662909545164174170941158490084026479832315235272725528706818646360199917126189562840236560, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934123481160017501376369248822516759602077226627120164064450119690055566073077504748652246667055395459313979361079913873848081156948496, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817983386684085972060805192651575135018994570459010245894418766627412687323772419726023749812753, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817920238568819602992130870835234444296001974938806601870649046273482701503479756288132064494128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110815899498880295792794552572712332341160238918292289993110017994947723155254114526275598134298128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData_4 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110751235828847533866472047032779465040815821105603758512769824352523417675274427165874512368026128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183108681998387799152224151869754927711429794451099570751141883627794945642315924431633039767847322128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183042466400274250939669906196863671595877110610906514515273525337952456830816724574582327943184794128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624180923567260640708137934044664343475898191227724728714967486060062992814862842329148959549553983898128, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276229865134941413878190174019190825402744316372452573608220385472085412448293820241118753521346427542802634134988137754146171167169379151277, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263580008995425388482955328859984145899741704752857253127512941029186733483647906629839037973973250865011421448145304974484635254967571794882514554197425799696, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982373309509094072578951961030827826639684716472498726706576351861193803255497465178009113595582226696970689299417696445732332233169234612558097688228201979462160, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629814094736317610111795619570653514432897990436709877088871441002507147037097447484551052627266381194691123349880356022349175449080169143286879595063325394413600391696, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629929154456613052356189224531074119125408038488555627631460383468753043401570837082886093327904280708203388922930824283851403184812103040089141595965223132670890361360, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969633499492443962532906490881909542856935629607659085757461805643650420953492718651330423483539301688647338569221962097333723635163235811479129238213649465300840562049552, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967973403776407085014095500149918352927954938487253394476577022303822826742483726842907710055235319875673755461827102015309676287812333034124391206219410620638974555407794704] + +def h1CodeData_5 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258971834167336999521817337135377424571605392540015137757461087165445546765252136913086180837547403519883667296236621470399770464108680791734786215818505703857247541345284276752, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276229862295727647098475757810894700840296596076734064804964132568782085782612902469946698326378260351568824659233917759212066035964579261869, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985847706158736659998499130721869826292513980491152537636959371407318254024622979587915637589901193279813086077805223905076222322943085005377126928, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276229774280100876927328855353714839404417266909460291904020292566378959146504451563612987282365077423320730910853097916254806968615782690221, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531982823512250618042524348208405507696433820026040445846834564563102681175152641331643424091052558435432752003738281361239146257096503775544138547728, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276226957780044231450627976723959273456278733556699559073817412489478906791034022560934233873943223719381730962666862941622516813454292397485, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531886049307190822283351518694281919540955613483617831741157930697354294651249228597419694601857590184326797368873517755929387369850445872784504013328, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709276136829778231576196199860571781163115845666268356108507325250028677231415980294475214124804443905193333732620707343753389231848286603029933, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746528789274745277357989820974242327098565653004126094180359505646993405925886340021102260350947618606148936249053201082386017102977976592984476198912528, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746429692488764046500596843551779772827355969504685337336146632568467058125409245381257161354011971117016438702951683150548824002438013300558610435686928, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709273252733720226608054500143702081632221987513041365690379576051283023619414260995732170634580465712359797785678002729729924112962920543268269, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472743258595337364659064021566032978036148646097522581118321334694055623928510142216906213993452071251464776517227703109331758644785159187942930906012467728, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493709180961659864067627520109203871696643618526609777672310291601691422108035359243435954778947413163541686647483511455080979040308631206630895021, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472641783486492584261093612685431322462429930194095246109847352661644643780821597305704832620589968222593099030019748747130472909832236776498844364469453328, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886807188311493706227647296466980250419599129299377008307777705339484147476422175872809345598681523078244958059494080145837814181930320950758570016361434951085, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData_6 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057796353110101155923600439580054484443885629461711639506960134456195592460583732562185742334278490591531218211689271425618104634073639825528068752769071736149872948064087213034180954762557268686598062608, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866214407528947678071954777031977187271420295877868395166529395881582535935017064875629296194025060420079518877697987391853249157896336719713864648139513091907784851247431167197909880578040864898226881839632, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905470026584251586626440087879607768335633232878960349169503259842647146320794673821219392946672340886163679395969859212382156712985610775451992456095011585120588222022041142072741497720957705818220559513799901712, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905634245304566649678744394906285693607404890217622252933836327461420874001677960234293657020602422668940055188580291396443675980326553284578227238325465318583711921525656223098257691293149055121394102480467935760, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509483073794214907191215238354790224605787041009962327197033359554044269034361752075277905493063309188440649191610719434414077753098448273900072624939869135222189203113673104714170936701894151890910882346425550853653008, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509488291849029243177734421416754041564788284311735946071617338074274117535272981579937898350401919335774029204915672224815130551015022833299370362781797157233742675357789829586719222974809137216290997410672999387382288, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463514998557732968044941991734850544881992323429542917952650173880449213712236624534804807309162120508619906168746302018200627446927780603443511494112990040207385885103016446668558664261286657625719240597322050573074711056, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023469157510822886301051541480691052369563177200921578747414646205247766165596332504122492509537688490420273785269357962476113756831818483370721891304589330729547681678899494306356219980250141853384687621760620915613044851216, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819255010683206244309718504706195671590220238832449136340367010291965253213022478600943260361303082417827057898354447286167726000086855003811309922029380411415566108975092965327376, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819132334804075584460824495455769926583962813683294935267769635016143176189369638794826783426376705867512217453327143281055407723029838855211166019136449872440877812258346960962064, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445815206706671894469296216199442146086383725208910360500944653626189836711432478764999099521508732656257437323212453415117461222857205322100006561126562672625250852317322474821272080, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData_7 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445689586606442098784028750727006183199976121856176458602604941343748029839211970803535827140144123068735040707504494113882447307150820785933459204564201800715170036479374566351192592, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972441669743399088636855469855609055370834932814568691597855734148305610209928155716036711110936476616268018349004849796474362002004546515628603943794568653899592583929665041495308648976, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972313034760763777855141585211834629375153546981369176053955868771085199972774355563498320192419116398645084214519899472009707752321208750594059450674711121063669828511606383221947253264, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113968196715316433832840297276611052997513349200318984678649160176700032072383852750682269810799863589434711191911001489089140771762454400269488635670839270070314141655133729318474382590480, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113836474493097875592365279401386040777935610107122680761695698030426331989538361394482957510238086726588826638198412356837334820086716528874115074716105156446329240107041663246552313381392, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616901348026675598931611105873467868282367323118523088495099156165919487124704665277384349373925025435890979550075601528966922766206467281650992303087620415427860630357749793444064945979697488425185688181142574606917347186544425455, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340227717887866003986708107514431018446301383985749757656516712670414354880812502076292139436155207426165993441598757668690544582652842718251306215016339292314631159427338456852773534296639059529571806179597441529821718921831414480039864325577325953552, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182347380451947582575729200217968360671258546392901965383764802970019891996602768465858915664539928384679494523834214392937725517010630876365716511282917622340337491928099362831766135544407794468806845363624590488005666596625833602262569828180098850243088, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266189671780129097547595518110993811532632002406321713427166621968630276541944219083131944407529752048491707814356678087675630589538183967546797893800884322254201329386392236523714924868839881039862015997278278847170804610383517422900281605806020940903498256, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016273689857049530667985634626414929834259825874038980063433547464825033615522681994349289216146593311409276544273934579137703557019377243284963037271954978370581795668272676183699169500881537287723893180488795641757286004296736292032350441742820988841221440016, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532023953879572916738996786489967068540775366899515978903690471053916831669673698281276433078775158441244730959861305570048239914098683615986459790235177019466427700435134387677913159856397663931441016125393591740191856981083076402681494231775508738379175902593552] + +def h1CodeData_8 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665783926729103323175872706160432309656302671776334284280275575506387135046490942044432408044860729691443842485777378537134125394533334518205009770333860437966065054690039789103212111654339629980271029168403225022825052975898369692121044728437776821633646338698134032, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150923488330297268886291197550521027525052920286611350746314028904779551827999462678494689373611231555651269226247200386423127745769860907031603127951080014259797024517652902432469719954986387722710975219796092117796023509383556799823389432760388152708214648610920874512, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670414812797584098805516390399928725405572105725992940792192710327539953888893690472986605097879115353108799291864601678926882160660684833377039602288152852487133577957277234530125712232112151961558174525833219865840907673755054088560846824542449411322724814061043880313360, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964032560632809959759711112685485123647176930801517003983126593701820214925111778863746335254023383124827248837010794356759448383947707929903363462184745151384360365443879315862331263269011980376681826392159368473600335121989482123442536976, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616901342243095011497181672121692959447289463326032714178024458079418920795730695781676641986540750087506325891382735368582870293429173857090355841889826841537931322106657332138440036289734670016012450526753273077805479305436150255, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967963835428095521984941961635865958108922720632442607594314230601430239819079343473472227585637183956909643007706917795441608021541400026407231195432363709522368028740568844092424724112784103622532551693797613987431917866665988483322231669264, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616901162952096801029869225816670785559875809758831110348708817397901364597537641414737712977628214287582062471903884396677243637333077695710625544758226050950122766322791031664067835900887299331642083240684925675337574991079619055, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967957527186902306790773978377641093637740119084957506484909558848739667152014757700943627597898322318023747291543941830156762362579874217681721818478090569393845416744567716942421295297267036171520387450772161794098078876073956521683483902480, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616895425640154066075870944055961221162638895608379787810608315589339566255359901672691984692427068690005633048580653295697190642258000531559256036547000752140248981239069416484157423457771437431790330086497808796364636931670620655, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967755663468719420577398514114445430559896869565434270983960062762641341805948012980028427990254749873675084374328710941041701275811048338465421755941350085281121832872531648142311573200720877739131131673957691607415231177128933749243555365392, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452616711831657986547547925927713255160451057642793937466591392257715362019305672229927228679565990409567559891502237258064335494799855531278715431773787791190224287858559977730727024225278063856636534229152510068669230619030582671855, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725961296024486867061749383657692184212068912884940690734953576188007494930731812181910742040545660431654517871023441322489359746499208620203543819754765654593673967148967377446538800466111243807902674946815894645633564104810888205031165842178576, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452610836824228625954653685404746661217680457552731783187576478405748080516915666734072402915520017317649296162019248610660761227842976515187713055365493085208913531932829043786498761883527421271188338999264902384600942046195768310255, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044452422836586489086982037988669815655049021254670742846259099235142795072440435490866717978466048878376264856818563611893746384685222848000275637010300062493806969342309439157571194366947506858536846091642861456494415707715481708739055, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725754587577067591579252908252179825220357425376948897581981292195842809776359465587693577642318642248641487043795044892035537193647930919886052555717143398862245017264002442995226445039247977573136077031357877174470328061091184886052679020200464, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044446406828978823839858335693152023457651926762447096864547827450728298813993069863111376396082972432251962797827983236952486335321378735523089203568206283568944755274360962798681453728994848851037894176237951188008488209132631802460655] + +def h1CodeData_9 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220719139917259650776139365695275784337485589825121211516686868204446572884836444374572744316899054060392224500572486359117513215502407044509726332106513231215456518620945124540553231071379623458060604943736701318097246774662060678678741100716900880, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665948956660832856044253894585533535931899862236582673140944903011290425449787130349464418543677369774940445759824526156274296910129411238832164755678367136253123333421205357973353905100009719314209753314509792611071432883280822596458808254481434801551855, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220507470467102312682062974880031128729973026616937615328043249396469935286759161462094367973114587440986880933490608414332798921382698679384615277731988041346473273938741031662409379114271638833659608678307691427626093065893084480044770595011314192, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710068317275551160585018477437820239511779539412779475260537699943790818464494691735506520375616814992110428000127063614945688692796839885217674650856755211200630137335983264339400784615466751468049462447535702697995343492082717684967880385242547746596147171809124692041872720400, + 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923333452586874710773555079145228746432142450202516317912116863135496915705465833440863467908092982176599987589048521135852925969227068076884361942618699551892913866152206685882237385980473593871809885049913814244660776752942318320367868422311382884565495406245871770171500758664214140530, + 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923333461379279679571481971757674089954579996754996300563107965493156758920294395599931686120262200121860391848493795011276770223547621400990974518438811401520262460678897369985489051519886798992512598630505982910145119974244390828839220565638636120664539496818546165413603454023068472946, + 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923342464801967728648620006901705856930627666494498535177996779736836210904742046485787135381541376068514353520454243445293286647794225286162252158233345419925223256010157891715194563879008842592091305156886696366112578587566639503503816876091678907519169866328310241721632258154670249586, + 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393603658718705609502750044158630187469378668241980060018968403090422344641158106550172087560402490047156185741254609841356918488662998832799673623503068872654420572753262741369685118769966439601522324906142359351977783590218982033772819740610172583840710703492701919883991295034214686197560470197, + 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393603668159478558046499153250969375723467344403324828314131944743706725066202150730147374323967085120353624365768747440534065791389069639715170981125494065957303572924188013202518366457293918357511796747916965534970588124101905023999104844301960839748594514074985644817991467295924005077303257781, + 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393613335510977866845586863806298147910271733620367562561598597706912280311303391024841020214112440074530775868245648997932903782885575921184465186488892008109495747951666370023763998280632164490730962725113696919602430820215047015715051024694715275448134498218702022605916619631873362653669583541, + 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687416112954396151147455434433355806529304003945842775481080116349304358129719166872267364032038972996610579983788477501444007833686277916865568019665273333716106265695860502475016995442946846899251968993511741299376532291918367097848739750460091970913119625931469924728121791900813099768637209977155248788, + 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687416123091348916886678746628539070951928554545070425283186387942401904358015854150410612716471878052327011244602338720971458877632049357436165966305956464076696442757982115620499189902581635624029355413695446339184904011005286631825845290442143433569941328135571406728003410616867282199744911039095661204, + 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687426503330981033851350434496201839719468368154183822640008499274289242133823626969097265575766655105952622317996227517081327878102004501728463326365481953321037754370513976594266316568605289796073049681809407102957544356010889424381918232062841195773679676289867609033195436527076589555419311491961873044, + 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964413451920690265152253376344168304830391746580640634179199856537943359996282919749947968219926961875747719946734112257235757487914272056366152471430642408063458917807318889491331505036556052488175606054118528384617818739793763022113629691130444033563097943135783305220972964483022308272943657877951759411534451, + 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964424336390842751830600956121690660253583574175630323926026958749888457091888330941075143928514842019530248703629182595505459484951055741747592468052419407473333352972741098143760343647508471685280494815000392906451478862198357975920906431963308810212221498598301064361808252341572937745412776617305913619602035] + +def h1CodeData_10 : List (ℕ) := [ + 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989975570033826989110458522648304582613602015031445072624676979623781667882991829390655303069522504109252839695764181208983680304450617549572342149008752066803184754962365082758230891081262785729520686585958029663264119444204503590674572289044816840098916399447074628508298795667905144341487641387553298327792212595, + 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315724228104523366962305681896333783144771300164349161341697125341529219503401231886722110071208585156151951812318561293893923827531369819068437789860904082654087471075439963159201448566792738637173680410991657167098369382180262914234094383360427618258182999473006093117206422824880672981150066766787144228304093924408578642, + 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315724239791634201766909826527950085512884174449212899104427077572470907866544524343318740977469892799041830247005322259295545834357604537777872699378623303327555076575065453343250016089993064314139592429769083560158563944224689687285776604432602273762607583692444841858409424156162379164670759855845015144217438963708351058, + 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315736207393129041681553929303043710460467442149680368139898162056759791725275999898268788989048919118277347366248550830556480824421956496239220045523105272958383108191567401808983159847126557527233499657853710053797795477717705292208370982339449510293381824399420479425020281119601823059372750759368279400917388440753558098, + 14173285136714178333149295538505605282647777954011053651840372062669000803185551616679776494426979717030979992549799104486918924750321994528631810716686079696735848739347439718429948232407014451817297021602768157287388313838630758591849311933721371737753459626417568066056901841446403055652115305492464382802348571828195321239353431911213587625450061312558145613977836638781066560188216272499849125784275505, + 14173285136714178333149295538505605282647777954011053651840372062669000803185551629228716199480238054885691489122672141559431210127133332656516008417367132912447356040891229207531666934005842039459635527770909875206583879593461554917636927067801676884867864223365848075836314998311999120962309556336928355133295886150603371487245925041437091390048268999908645716114024451776021591257868731944149210232343089, + 14173285136714178333149295538505605282647777954011053651840372062669000803185564479342974174016776018110263979744662103812011435981943575609934453914765625801030832821731666047691617371205291785214265843948029024462843212540196992524154824366034147530018171498404578089955387628682369998601222421068036022023345752296446825329158890390304948076265753378014330819217801739172106668351061311967771381184678449, + 12683889071500146033733606854798236591928858914775993776562231269642768364384671297694925562534784962826359198213266898155348068629585693976765780237017441532823395374103440223470489943767296238223687426403051978955569759307051457879110328320581925230640811383305263270344650895637898428981473713465519743287385580478871961909311709918458460658117761495347754588666203590771192404189778217174785140139246096, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059661697953033845622240702784167303698334618189699445519155435534125439275202355408891523296351616743961654839494090149413884414424993217832338026132074398602070328552624640101764118281140897239249698503734565884529930787169243380351256947758347470516367209015263502507983376, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812709791338792411104924338901916665928853180985985906649179944275679576641657471031572382397101361986980383504950924838821464894824559563341222720640276814833535731993172754929709404690691652922302579703561612657748683424884518463622879057509298053544336976810631484024534128411151, + 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923333452303248744038138082609343412770128335797597608794342956607830469150148783048635460868990749339656103580679318752774737444894147001913180891785792718033967137296506986395035719350169942093722700740862453965129023745803541787836534482156906920906464857575666633785746380760511338098, + 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923333170946289742504477519011092420052126846118238163962627681162715486275634793958452478079575775091323167278430554739211721306636440630501578465542213529958812112442405095090982422088947378231235866161913056669630040664137221516753265894223301728406151041046401153322177109621240157810, + 16407379234535226782272828564066658318726156512863643464757583252208349461195887089829744964774863856842472560226876262923045061420272172036060394402075876818601414454166656286185625364973022773309965611078101718642144798396393775696204850683195730745116305020693992117124941000066661842068476081793032111345456835422636497224676975426791826657283178458303170986851411768483566827428454055548342524507248210, + 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393603658414164546646500072897586987848279033527097970719124417875800267853253459963721271858352019238343365140463831209125397607929899774512076934547506769644650153392910313246045336586504262867458148395117372055752209250416307098604229898555598720857305528091835082286982621687907542760313154229, + 20130869397570307530812050273335080045523454110951293152952935234773930558441758411260367838783695207933551291393603356309430193246528581942732963717441396364065385273891084970700094251844046204512095424284976896025329156011428035456683920695633953216161490629900583952394147923301614595381410592024942675795049458329974199982464166162771411363106580418373035227346962614167643825708407839397210933619944117, + 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687416112944177448762637668997675178238555390487577425027650573736811316248440641985898268015219988213288136888173319195461561219601210138339597464166025097799891506635801063754037165028725845117949948455821343008779023136845955473855584086775731132107811820139537008813801137784645272682572651864460649108] + +def h1CodeData_11 : List (ℕ) := [ + 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687416112627397674833286940491575701225348373281351560971334752749527017928806370508456291493831459930297146717310611010491509412913833676847161634289767426285119485790630773018711118202313466617807537173505815330350455784851047112881736345944541923730592071165503235345597922038129083910097647390570603156, + 18641473332356275231396361589627711354804535071716233277674794441747698119627706712612153301886829810687415788244909171178140950245711239701362754106066767303934061770405538623312377607872333591978498147371346371267051985613076006649147578588027341787907254746233819802739152363280895494000227424931171727627254056482560774069622025614359066518895118710765105093389922491027776097244936931032474286293803668, + 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964413440948442127564876009832295802455973206431855362314535716313939383083888156230602073889575562803022132568299278951113918452614542014059194479022771149271564282401800716952638359972780078857826203259124200207883938079761643119423766769013385016719164539437675166942913156320189033447037603420212654607391347, + 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964413100808749862356177647964248228848998461819511934509947369369816098799650487130879349648682191548528928696511690633420605810590504840708686665088004440340559742479402044050930574758783393804398028997315887593590926477780711571990814312393900008509900358466817124388359214586057584679747749996396428114221683, + 17152077267142242931980672905920342664085616032481173402396653648721465680813655013963938764989964064797763870288649055095083532855306859978779841862611480098587572991740277329014809726973870026947488008475869439808790141905413426908502606773191140459224577817185891367173207739208305979497041588649096222894913802560833673050157958605742227155737945014390814985211439044165081639644131924748202377447430771, + 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315724228092742005233672008363439008646416347670110387412500824986457705704648063245132798951343402386350651531638433355152520378937165054306853044047826525221317873358978797488065786894843311695070204754899832119621798388489589355246260992422141311901772361910548257455819174837171339352725096940377842787532820144953381458, + 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315724227727519791646028128843700999197412820348708395607415513979240777943299835355864154235522736522510342830554472230493871504730523537819746341166784107793653032188355269927457946388624986195981231636192385347967395364049797534458233666551647790661266077401411242934004898298378826266775452758669067030919993026597769810, + 15662681201928210632564984222212973973366696993246113527118512855695233241999603315315723853739973077898695500631979323417800843233068787200057042589106750322714476744771965235160891950034232920578121337641967286291012539117829236599769046242689656200339584037903785646214564533072047035314740770041169378628140796804402592242058814519679382379369676277464596707088686432020932746214675518699168976169751122, + 14173285136714178333149295538505605282647777954011053651840372062669000803185551616667126353595272803383949033379866772796321634140063112131325475839971683473736139558599915737090127951457822085297337034745448080362178105629785046872766185979531956555826647401647860650043480363571335738257280514978753701246648311247046971786341042074106903788118681514839847476897874173342419206429049740735662888747354673, + 14173285136714178333149295538505605282647777954011053651840372062669000803185551616274971987812358480325989299111964490387805625222037757814829094661825400560745154955426672315555699242032858723183673198823150682515801360104603958710372292090686523184620736897483752581870469158966867698706625168368449415952963174591988609941034319229593474600732522207891316383516831574408411542896203745884433643597285937, + 14173285136714178333149295538505605282647777954011053651840372062669000803185551214708901426108091668975221408780027304067412493164074937722534768240031697657976921306025408664300700790870375918628841001442615709101543255950018476285168607800116758476959789795138792268929248139267793608780409141345602301362649116274931002008474539062441354131944371655354107073003852376012500043684589178033251077910514225, + 12683889071500146033733606854798236591928858914775993776562231269642768364371088312404431704042011448542766530427231959686030623132100497279487649309475023045618003290895879631171911680813448854585584487911817470259943524594970990040732911926615657662274930405160898202600550686488008285193123942468330660338905252392013585567126228315787304571996966293742116435908160046226546213757429975333925018210419216, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059399663865590555660049942250848711461501269915985529244179967022448209019534219878592212337431338778765896339577434613589158770035479885805861758798756780571923768757361133580016427448373389724487398484212093135081473365136038649973471576781315333230893450813487452325954064, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642782592833422795821573912646467311817718425532012277565855594322830297251274940931837291323108274214477622480003429852197763526672490132895004406943620711456664688134293299792818822066372694531614821522602117600896732140662290829019816004619704424386682762470965658380548333064469294463269883615875483580745479874414943084409951054836810256, + 16407379234535226782272828564066658318726156512863643464757583252222492540124187286309811919324623668403475253366019459004130503502199110280092023266559481321015973935844278154933061954943751526729845416580314447739288718506347567194148236957063919565515685612893568252391922557663967344398982466645568531467239769626716547613279830360205443441985757352223797467290429706705820318224022062946375853481316979] + +def h1CodeData_12 : List (ℕ) := [ + 16407379234535226782272828564066658318726156512863643464757583266690434986094792401307707772713429294953846240660519966786550278118521678630698620979211932514994287853318488612382253566258366845074882267779213706135661675873280719323506785284725655920302263890280326495164334550550709900550141037968903010572622369967713107260784102976543445094214458434912932473910068285264988640177381758216014716840104563, + 16407379234535226782272828564066658318726156512863643464757598081863499659994430159153061642850390882533737230229039935984399485232831669651854678735321955148787739346909997040354463552424452830392617895452054304021570019612828499786660272810343683221758419934320767094114215266575087399336518073063409614484405119148190186305159262108479198011957075948469954800061107449300443089070691764889117191321604723, + 20130869397570307530812050273335080045523454110951293152968120801647306830469365514226047537107887915433189279560215790368131210154482535836320014071128559991820649058796249550177268763059565366789434591076137654930354307993259927459310109500208969351632438519321207242923209037227012771297473756905078047932722341949873489759229932382674474793807256366980565613827338144708534126486172860116764244954638038, + 20130869397570307530812050273335080045523454110951293168502955713110805817030935964005780271741546087207467079955437394298330304867627535570737684894221812594013993268337618938235722852837705896742957267578906469157799348046706859090645771948804621041912474268362691713044895014887180195383425014261781449440727009883509524486091803148914483953833055820147429921172960634572920160762091428303436000608970454, + 20130869397570307530812050273335080045523454110951309076173905051733768056079076538452100536607513984067934684662359818822203291128107263614432607741712477239998463838699872310092710785653608569150178006414172238061520362776364849578364119310751951888669081286842789117651336138898622459397512547526064593637506973926809084792647469644474364226225547902978641427612342969527214359956325027871462355651847894, + 21620265462784339830227738957042448736242373150202658406504168594673333280189076470132266296255505766432897083000039083566955864537395446291690710862537545821598191420715061222567297467585565017600035062603588727037905154371163009012171910865135529329409063578568923694158332428453050202077378300200767420371665792708664388216979276353049700219322604295474095854733871045410440009851235857025677126747942647, + 21620265462784339830227738957042448736242373166883060379877864505926105423240067094850318393408924128111970248888256628207396933328708591739110441233709373633810979590906709535545937835546187091493479990242482715204646320228196658765975312149525497985370073365185056297766383850536481037926658429162976703119242459588412395131471237191125304223978429278289583066935693639912335933120121100292140920984170231, + 21620265462784339830227738957042448736242390247614681114542477628764779907454466806135665878509326487482892118423022340019051375633369529896914341313661053339706065867154582025673674627223190758381085892469926597947600157830654006660658227364853401689444094860104842392411040063969656947589510486465282236637749344450371475571241045950016220708767700602601131712081609364600744429765261255287196785520275191, + 17896775299749259081688517247774027009462583318706663722910963433001870645753899840900867747312511132215807790856383839367056655737950142967445830105037644337735832470794389650196369927911882080253995814737151410993689563663474017412484797517983853879759928320517211328132282245292658946718296781884854051329307994120063324010099010877877574732737321886800841946698779880992908142232234988872843926484769428, + 17896775299749259081688517247774027027373028558650135404280857118937830244145560585425404386816890855986077077347412456735550707885839900349776065517536932983723035359938597831930439433708892418500529858933942486556907397979500032444989625189938257000922985330141189443165939151155309581477134604211968753204609007724794536016377918124039698602345521469237869631324844713486676028571629958886170214542301844, + 17896775299749259081688517247774045367668954260765137127051991517360458997206162978550923239301727996741826444160716642073460107324951459855937127916808506474618793843607775927617613369847478782951391116448003863291969737590139425729933161271247053071893363185094779237630610754509559574527064667177423473512846938969555630447935361333808235519018549247461009579504082848015654610122754591929989423851854484, + 19386171364963291381104205931500194521415792265761961119971756295158534570077065237730442720671825527875313239433318980391499775653235060098771783202240892634645315388179761243858665879768970511270043746616882449877849344543045843222110863928969218866278096252113802159457968357707488136837786502373941495536159291443632860671469214364112667599422417262277674946319058648880080283306644178371059028601889461, + 19386171364963291381104205950731388662004813205808417584994716701525903844292039221786705861261530628523368866682763864077926041495855792440938161791685682145493087280270624517955926334104660937564002811039053794605668910355498996175400858381118132701207732067486122746949127143748200460303490567022743426433152198052987463281738651804084146967597189998484621699838385409898673776150278032819504719378277045, + 19386171364963291381104225643474188625162255813379837768506172821712040640425398895400161825119553692132331170114324758978422264339485710819309837383150141253611504781314617193550631573851657462578084779342510795892904302307527620344355177381605899669154807008742404337895724049437619689184452767395920664953888566032100538201019885442662124364259563286151969778611041465457291738962892531272936192270426805, + 15662681201928210632585169302832929171586188368426455996041887909750538783739833354148445941726339476618651152865953741300410816348302069751243449963612840128332445576181494736249017698213035505962486363447168998283305362101334535950099340417020687938075911396265135919849169742546275757709191443624359960097952760204660574882696298841393779654454291914892375978090423749083744793423402809081322456326196818, + 15662681201928210653234506777047096950125865177916801704654568208327681117492952257349204332118286307874934205262884924027775298433595589209348445400286594506082020281845299129890490644841248671976482129175750762421656852467951121394099595877756870010129514142990644338646149931003618841529409948320419079755742826676243475804610759466695502451962081101019658064977637622500818352628998959919552337876209234] + +def h1CodeData_13 : List (ℕ) := [ + 15662681201928231798156080372354902174754918096030807324039193951321430880686709134925796093471841514308779859720416036849004953774159514308863772554211077321646518881580998218758787992131530670308146235243477240093582987883334616050361187671607311793018726789911265186753862911322936673433158757084957609332770893577136071303368630145558538051711813331321929419106683060918584893064141701192127745262997074, + 17152077267163916497263130651254820885624025284007621449174095569947420829907803472003974256409238299812865202681392118086986665189665482402108304943842850552871514967485654561249422607645847336970805212145203345701268347791666881498481451895825963524752814144261314322783951422218842937501141996872930797892578947916628517745507455392328206104860304543882693611521791796264393244862457638309836980112512627, + 17152077289335973781217404128426041519416689595563973302497180984099111486719465224286727321913379875953833662825549751794065052347990631785794058462335663912555231427893463725008654862382529959992489284504254663320637668954959565653358280416668898363793271581187739716030002731233749242812041081626120559674857618205659082742863220971586365721990737541362730407558276733006040329849756039925388257187780211, + 17152099993522632550393444751755970523104944629268271105336645075430344061861099561825866398154353844305536850442966667842333502472943600680005661398976544228680886885490047414462483712745535934196979380172803905554822540166668140247230685759834173541221686993847342399986543162497805881172703868892436624728215994175058333385762112908406148279726298189504736329886848714921175195240025009630836960513414771, + 13451858917626131438119821332334848573080801544381571524752522616046919909648789880473657594902866085358522239511161305483082790556563687832024875440094560102813495190210123148903447107900589948559303386131916837621490361872744290969214947367395733859939171993906596022543414464360282662331732338508837102879434902562597004602859104929499741217657350791636191902368146505591490184829605761151526492569092624, + 12683889071500146033733606854798236591928858914775993776562231269642768350041038830933410994165953879352502016160371874556125623285218252137859462212829651441899232763421992406002774758723788804465814909785074972543361610944602008047946146237670282517819862907352876955559681655903197056529702632078493113547297921009469410147928580995577338211379843685762004532432849160453618693678918957407316788883505680, + 12683889071500146033733606854798236591928858914775993776562231269642326823477135919400360521270037472930793325639519381254496521119244853621979621923592815124418947780697460111982466861030572416058882993377262506135329495070658925371184386028065556512682082555232595377244167361103609448497642107191130137059857933960465257689571137112968328886019520613744900054280368635859646479440294609342791608898698768, + 16407379234535226782272828564066658318726156512863643464757583251755784719286425830987299149860468648192172963453293636172439543030704833881685358824215853863145705744958013301466958999740054258396134550412608020049083139236446497770620541849719992586329021797493995405850877009506330487748945093377073870850937105099587626334328079630646097406862679974041991219045745582998649960185428440626749095596970611, + 16407379234535226782272828564066658318726156512863643464757582788781626448227062151054631841418688598580301370029277387135006755308382646662274232019337415655839660385783278663092827437672364071354955312047831751365148503494585629631146995364544429233158516921117731637133693237130568690911870811030370539478693894187697717614191355907828319098957547687042812318251741812742150880434875595359514837059818099, + 16407379234535226782272828564066658318726156512863643464757108703243556883438653900003307997035917796023789703836638372803832127650462933985280383823816691374449212590855008967982107880357612541187415226516932619016081503829056654810235394544767555586561523511823632470737510324350488809797551908700325493635140319255394164943505916238008288344915805677394001549637501443491288541363779497957361227681911411, + 20130869397570307530812050273335080045523454110951293152466997094825903637354476144878314223087447329246922253741015093467157045808897213264242024689738455069169250858488463440885060566615109220661901601511532209310114145410890671600234765550254270910010501882255352905177348199237975112455991458280668260787302836532659424122879549454674253625265185922375721684534159402589441548061929714106819794730542806, + 20130869397570307530812050273335080045523454110951292655352279927993936067384221751926866714810385832470032641093923767700786014988257221762876558350754371798982236153164643023014529693714612262149175953422930154031872863700588859397493567195193416821049357912927849861283396914112617541705551222866159412531153462656306312863299684933227113439661219091452766348731321211101604554356916574011717412499285718, + 20130869397570307530812050273335080045523454110950783609881901092059144417843723369644618239099413132935069290472406182936850454652905924364639027231053103127479177901572535123590915843605726912095866369445994162970783234498470307518697344206382222689905037492230637199842656102776853723572646797721675229440328320925885054305410522385476043883309371747184032014617351690773677659087468124869286783399814870, + 21620265462784339830227738957042448736242373149664580923492113887858727727187431611270393647960234206378733432487515936965651313931224054503064267947338454601849391802321782244729276810554577208764762645582979243548655439343516762245920188243058433566313547133839371029525814640643907271888691844427792927379808480873833807348769858203135926079396108215599511081412890955028330128435019780903379903590559479, + 21620265462784339830227738957042448736242372615891717775533844727770019149555731620292726539050846632648392124064554508471537112609203400185632896069839964611040170356189036229412785035814670844174524961138371622212938131918439970124211347142579436575561233962123127714068169133974120524711727717637095879457355140721897586085027109575465203597344155272207279530206007723624150183196878879851788364388626167, + 17896775299749259081688517247774027009444528434392204578070872814366854557449069537730984141829139781687813567785324334712451318991833318615245900432242786183858829242075494279045428325587489932735602131224856258699775029556300604090879449909443577263710368787241380705032449929863279948928611510995754261107449448540897688856422987488150925736527479949905261751970323100473697180613361873273540753332329108] + +def h1CodeData_14 : List (ℕ) := [ + 17896775299749259081688517247774027008884827020643971088028063636681355819999330139464592371844627915319992652582479690419685879862211763697048080575602183413671729151789737773366238653531333359665397942343706537588424472233924791121113674044695002166174023255690631388937648151555154087532527819874301964172040219487652639751831889590148867606003935541052546246984208359952636589478556721409700284609550996, + 17896775299749259081688517247774026435750579342452877284191465686730648671466186314679419907704476754671375484869563934627876211129739527462480547375624946742081236699175075957876014468027002535776308528046392119565453774121092310080959188542154102288956198947723331707860627163950333775249717505406631504162407784136253855550905005039533106719414771767307521332424481400397413977593286359639132456694274708, + 17896775299749259081688517247773439546280956874772822155515164937206528573526909734662816628189688250487395746843830003814775429078169623265326550598934595033416965221761376895886448511592409858568904449202688654617889264912544680411681809212729149021606558773355353917231379702270145169478031301098989810067410061415659349795985672263505605119508106690872536165845792436878858575984970468451005789815659156, + 19386171364963291381104205930879833420106469009631430266261338217533780722521743496309272941943125363338279186941401403498389250948634391313540609699355576843972806617467152751145851026403303078163787002603264019402758390807160257642972477011157963581280366064521146656635672912996497416725989597062689820345933713811073034780754163556692162182841947592774794641938823094371033557691608471569959209027789493, + 19386171364963291381104205315481620921257798928144823385526605213777963947642576006508852443072562142600499114959165125532748743984770956364216494837122312496844106070559527980033516487661209436757096941093780988112532284808659363137692654542392720863532019972606887856918591759693703065823459528301028031642160702311725751250235027887540633855429433015770155847052391313014186785472852072834048388162675381, + 15662681201928210632564353438443600373422337887771727824964657385256005374129195129447638725606992756022626673982489092930725973120393507735660682831116193198516165762970140094723169439194257065270939996747845831182359443260239156327675953062725590980341986393496259399265705044691715193359004004353785050735919526572776693377566230991697358851305231840608453503171747794001295442039212127171579892695944786, + 15662681201928210631919061642374407630342972987475154521570511125925469676199410163722615025907244417545867828595084993470495833055228085252594901723720138374211491553418146207421873409612125403833002629068827651053035959186282388032550945079577585290590311307661087261178299413886361464682732782182551601399314370963641771564483932620392786308745592043613466664242228493420628831777660683605757453527535186, + 15662681201928209971140262467521038717073315083784091845964741571456914996099605261298346533364945817344810151893287146194832406325835462593235047750159998286225100972176405610894739117509304091385138125754211198625788267454551653824542770336019758984875023412444817859674933383251382782435740631908659772350032243872988940120552300385008585869034431264021533241444545491934753685386174117878116038718639698, + 15662681201927533333649907417671271528943621704135912025656717795656922573899385178847410170051179211461749209252291535915483435427789859408744578824576548188161145780634034767109224004395369010211796216397808661340838861826035093520062016727711122523339204789755095852512473453795171353014757736715208754954379088627585243441760717773254986733469255288730704498258583912229926499043733353351310196138954322, + 17152077266448688842942025055217039574856519983634835905518512169490914679688072447736788673651040184453479123321903162160951878507138864680053925798085017863849459597795080072095898986525309187841073467875556529003869337431560665880582199362895546271880541323715300600421175573540942734104016219945408547512505442423433919220013861691495084132404723244500743978597931334083380053220687604774236934610015859, + 17152076556942855756405273785737979293491262013831576599179778916636813661714896374688690577518509747942488398708858883534443489440734084402109813206314990353970532864745186831800466834951465251147183152385914365184051060206194772924523686695921631422585903342069688016547533685063940964155245507843336170479587993174453850011683724008665354855238280041779164680827223967480911477719566115088545934699320947, + 13427859859934694394232752129911829448669803337206397220121576011471790159936726252005617263798511409596907663784790174203709445574019019266676326154663392399410977947472886502998164246772210505567966132357027497951494882348016152517247905920952604376896712573588507380997709486129847118709109977299132243850954322138839704820647543537177896854019394977149721462531586504844475423951533869558302536687436304, + 12683889071500146033733606854798236591928858914775993776562231269642767918862753769496366999563516460986855816267285104543135751115134293740871298306297193593932943422618550479934395551792447772836511265335457968181635017081443860506269621081215590402580470543727759493080857911474681834256157481585152283837098114754885802802211638223180807594278686120104395516584422383029994474432549399359192616342667792, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210129, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210160, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933211152] + +def h1CodeData_15 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933242896, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729934258704, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729966764560, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062731006951952, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624253102841178480101642226618159224980954845818944204725369536490074521263836421734615335484394670932496, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568626422855560163227930619748827459905375385189894390271462303900931633194639042202650453060556001540325904, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568695854942567675158457900459525081677997156200308664407044203563061510742645627191957260262847421360914960, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739570917681726808056935330883201848978401893828533565436745664992751217592278856346849775090736172855619764752, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739642016138822500273795266330956213673566587343197782151581530246772212201437599375899945665882586751902958096, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862741917166765884651213313200659095883918836779812452717026329218375444039694517376305505404070567831432965145104, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862814721986831873481277887099159565331767482938828610633018255238492942519473070238052880073020495661226955129360, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062764292948496, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183063829444837904, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183097914305298960, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072184188629840052752, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072219091526952174096] + +def h1CodeData_16 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705073335984234540057104, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705109076550877352313360, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041706252774683447344513552, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041742851114925687094919696, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862042913998002677359107916304, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862080390698410730863523807760, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767863279645111468443004832334352, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767901655786329315231526705185296, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402769129692305300412464226636415504, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402808426860912375523910624435782160, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643118323528256413924042094920570341295741616012765680646448884602109943341263242841141143402329374743731919603693698222797414982722331206599632646699496725286354985907475755724313037850034704, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643253207083808217562288513224800753808589220844198695857409229839894212226097025989889239198104634251286105386695389494223264277238286786908495173117144457677555825746366945503072583271596560, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006647569480861465933986173898960173954219712575450055182608140277448990816540778086749828304662912938493020050442749510179850441701748865356792096018481871894195982700590885018423378036761575952, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006785690241746512859550506242492116367375659922837462758631533800940082154610572031067878399536778674228506292236481372119920119286087379593067323070153149862785642695615463351873152548440916496, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263011205554590068014477609141235514273588365975039234505191380126552655004972843978249245481435500482217764066029635900954202149801984919835153874588723634044857654762536401970022265936922179813904, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263152641213736356066255485461012223304660056058763939863039335094607532535156312977230928778586338995610901977626417327580833499648347558413099707089635022684693466597441570183474835036881824530960] + +def h1CodeData_17 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643267678582306417573723147527693866912298954138737954511314173894072363613501027320944644794287413171424191315148723422979633036694731951992907366347118799459159439445314406953013957046235590455476752, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643412508697272216538743692879145216960116364784472052797750479781360558204408899575901888490569871809138764536623827603845303538937407293896723898828052061426351310764257299203589387804594266645742096, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669404065936256338779090195354015515152, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669444306236909983693211306700566970896, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830670731995857826620945086869790213554704, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830711938063727159013005104888658904236560, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911832030532235545795558925681492457006055952, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911874225545733742165028384132813996264276496, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403913224465977676025988051054575103252527333904, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403956432159799829108324776508728359452945170960, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927405339078362108727743099991041632557866315956752, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927449583756835993484055906856094566907094181102096, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300937291704371755672804111132820519355629991396375497659751048917996116021060158169337623057091098044108481860485647, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225886703277800036751703350360976748782465901223762232164435311196755893685482386050872578709374477737727947821313601413829266305610599090656044221152909338193325, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData_18 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621928865413468000305686065726537788466082385865753104, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621974171964225258296150379956351993239691719774585360, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635377204126574138486584608690802899556757443646887886095563648127739642087154066535318877382250746188663900169533145584, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920225780402824579472380442560627886570663656882401367799354156945748263235231718316249130218104481872026267567957947768283950676461503480385385135588817289293966765, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155623423981588457513991008435310406545995190404857217552, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155669817889563889696226466206640152234171148327501447696, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142665949173410349817165020065231600757420723810031139712161788823481232683428840166309915161978500230750925330711016814357450744798698518839953735488450667222715638729876965144764130204817507586446721411670159160515480609602004007433135482119206982312737263, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057494956968918135832264780823039073604418626307209070222989523072779924359285458055184092215232686580867897713919979455835748672428524289970294497324768107698415373798285984679082753481697865948069380624, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397157154422944777719527761114889192014255801801852116812304, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397204661784711620274136869872730851598947982714639808479760, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142666170908166201037197278513870687453642951162859567274150519295146522327792369662444202874324933529652711887075897776033971191995667703249833146465737676410485140307115629291397649840449547623696831934646204568273104141892654123025037100562754473956948463] + +def h1CodeData_19 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469865905777880376265498427062456942150307443854318441172192495809424489682253418763134227588819509227599378531096527708579508017433021949929555247483376176444724458784790040924214734828086389846622229232108048, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544398724897361250582021628350123663958309097771923845941838352, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544447372435810497357941355718153523373033891026618442209313296, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764142893227298157850154674452930802301847947539062317518671959046556613065275213238977317697380329431825992457703420773911259221594306500831771086310289207441223161261624618485791134143798804233256886797010248506471579786313904726919924209281925654958127397359, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469710547491449499964795499882681217581661411432960762232977524342268031919249356439518173755953059610840568559014302115585976524294610147454113515823900562459727057655679750802004723386093543830042103534600720, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263546004093666186394187372631495109024644227275176845522768511504, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263595819173038215092729173456357685065322415567984112100662854160, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008668764375398970649606540193525792204994240423646463407999843511043739137071351247516706155388137553153294347022160799190620492901632684260049807285888404132562018578117689951088192625700343430664321293868299967223394961628253858630612730017799642984360044608829935, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905310623662186232168044998067788445036181000545719406098831331892495419578668338578208147968145012639010983410341453851067906830337366629325655041958235440454924467680283774612225765977572913931875608226714632720, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097265189901712943133446066799851960118367024440937816642593281819152, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097316200542989900520752870844511237984021489252772457618357088698896] + +def h1CodeData_20 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008669002461280162533064939728488771736540903788974283010383470194657800365342036912932336423104987299751942093597719943247411646282560753827812566493227335257742323640962670769496826562173127308578459977559825196476872899448568597564619396775182021453866071732206063, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482742405653109643684282172427603165980142476316735254105026889729698006260923823670986132062838359749527514509497787985775930768424100896825021110140162518485958085405374237935000295305330076821979290993160748548624, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461098948541063852536914570600273608129684964363231480968842798908850704, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461151183437731456901516737942004708664115136330550153328024937153708560, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805713474443033215270940272435630033489618098501942952928383957048186349074512481017173856492250619828661200199794500845072, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172920116928738726718556209037107586511575298061504274171199770687919988440585645208928565095854522712271175756585211211436159415977422443096946683669276966821534477741, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891462822700131094796568786092877399925765880639284747668821853360989159952, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891516311234318721665921405450810046873022376733819068164624362923723604496, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729885685047083433734903516605216828386696811626199441818312812488031250214533571387925033458963990680910230198582102670688784, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359172808652824702517044396678436669793473066363270974175336366828875733823154835232334797718480213294917726169886167429264712512405803876743919995069308336470476729986477, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData_21 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546893227944328322781485205224904654749185230251758917324030304668931225829904, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546948000203336452695702287447427685223175882252562061511732074461171297042960, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509649883223924809211876864625956119382962987158862223317375228539850702651849546766309191786118435953197502052145055389244525640588391314198710392374802090686742968655320515109535660268744940353918692692725338563166736, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004217008424725881711246718862436896302788827972545015889746427403435931942745298560247694367062976938769303000584866565455334545457287255023889948569043698965812003381886157768887197482841802869337241072246369403867609827944337961591942590446445072194092405494174808750575, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306548700712491596609950648918568164660390876746278262675518188707812853575860752, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306604787505715921642108941114431747865757304395100682323724800975066686498030096, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489359287171041481990569194537353280394213660506518339063450489772004078425425441387114396906334452415228349856857627075529327263819796916526736503078041704102476173958032813, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755647834695170871913298586684916890363520918791701371041975970365044973542030981449799454248916065386446384402441982795589370384, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062308399564888894322671174291382066410437482989157418111066336393527189340007449104, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062365832441150603155601265499946375612732704901551575830829907355195114252308857360, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463680468125626027663903853581073472304358774707883744902270503267175197716132840893041177880411540977461376673326477979951726895097184236115328259237962588451354833963945077896800786582049672068846904382011502044939567632] + +def h1CodeData_22 : List (ℕ) := [ + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013004216758773584925050857450891700630423587171974119454625937488901091893875043699029626646191080997886989504755514146457388121589767503037542111965605298279039314755593553564056137258467703745907850128585925577898226261388753632950446818479953864895501228100543860508670447, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720064203684481525285809364184174004270086179806098164622863264178128568711445953921552, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720123014949773515130729777581743856893236487044389782127901160842876523821642595975696, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855489476165755395354589111073076327713439148301815157257361635750733997275940433417578093057663968334204384028033154234362296456938349341876126130076799319338126116161806773677, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034671791562942190256639050226030410034017321676160870615486170957502448733952315470845050910816059790884458943831694431572640416272, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423722004975439117190168183006303979140834046318669721542289113854114811087347935141708304, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423782227711098114791366686325415508226939960930680337867447920038816717120189296605151760, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023638598348345379350868488011223330041636201087954858153424719482854391732610756090393085289475517688997134279848011350553252355803568581090050821186856756015790978065266643380168252133728196708113716259390390619790228603408, + 11194493006286113734317918171090867901209939875540933901284090476616535925135964069750907553869167108505258650611032314838375170032013003961116005245304812247042296011415249578392765033373047973306764987318675041668007347080567350518607886103353216801211395703121789719353292811603242602505076783110831651569288255743042776962481484075538912953792584816075624216677493424811457778461786100772523447381604847, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985425709355252186038029718792536984438982329228515020060272529717949277710171112863435342352, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985487377436566999581656986191307190223154785791213891177235147251084029487800667002001441296] + +def h1CodeData_23 : List (ℕ) := [ + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128, + 8960398908465065285194385145529814865131561316688344088366879287077187266704144446968499216757201154660315097893421471351046172841839609630003338937122754501682145693782416653467136646900445911869935907422332147268002814888941585855609159836133760895492848968612050511860403636271448387730374524717478779261945177968548559467700422311938235421454074670485205306464560377414507051407898557463841132158234029, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800933948802969287890040215808728915749703262180657395336365218833711719575637024612120825601131012047485799842113541191895849207683629584, + 12683889071500146033733606854798236591928858914775993776562231269642768363950015768399122090766032505751393829060148867137189812710059670150665532016266182340220725967964038919746916023463509482905469866057643263006643113972445819258967969629813982263472746531985945260800934034755729805635300862739568624183110817985423720062306546891461097263544397155621927403911830669402767862041705072183062729933210128] + +def h1CodeData : List (ℕ) := [h1CodeData_0,h1CodeData_1,h1CodeData_2,h1CodeData_3,h1CodeData_4,h1CodeData_5,h1CodeData_6,h1CodeData_7,h1CodeData_8,h1CodeData_9,h1CodeData_10,h1CodeData_11,h1CodeData_12,h1CodeData_13,h1CodeData_14,h1CodeData_15,h1CodeData_16,h1CodeData_17,h1CodeData_18,h1CodeData_19,h1CodeData_20,h1CodeData_21,h1CodeData_22,h1CodeData_23].flatten + +def d1Row (v : Fin 103) : List (Fin 372 × ℤ) := d1Data.getD v.val [] +def d2Row (e : Fin 372) : List (Fin 270 × ℤ) := d2Data.getD e.val [] +def h0Coeff (v : Fin 103) (e : Fin 372) : ℤ := + (((h0CodeData.getD v.val 0 >>> (2*e.val)) % 4 : ℕ) : ℤ) - 1 +def h1Coeff (e : Fin 372) (t : Fin 270) : ℤ := + (((h1CodeData.getD e.val 0 >>> (5*t.val)) % 32 : ℕ) : ℤ) - 16 + +def rowEval {I : Type*} (r : List (I × ℤ)) (c : I → ℤ) : ℤ := + (r.map (fun p => p.2 * c p.1)).sum + +theorem h1_boundary_cert_0 : ∀ j : Fin 270, + h1Coeff (triangleEdges 0).1 j - h1Coeff (triangleEdges 0).2.1 j + + h1Coeff (triangleEdges 0).2.2 j = if j = 0 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_1 : ∀ j : Fin 270, + h1Coeff (triangleEdges 1).1 j - h1Coeff (triangleEdges 1).2.1 j + + h1Coeff (triangleEdges 1).2.2 j = if j = 1 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_2 : ∀ j : Fin 270, + h1Coeff (triangleEdges 2).1 j - h1Coeff (triangleEdges 2).2.1 j + + h1Coeff (triangleEdges 2).2.2 j = if j = 2 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_3 : ∀ j : Fin 270, + h1Coeff (triangleEdges 3).1 j - h1Coeff (triangleEdges 3).2.1 j + + h1Coeff (triangleEdges 3).2.2 j = if j = 3 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_4 : ∀ j : Fin 270, + h1Coeff (triangleEdges 4).1 j - h1Coeff (triangleEdges 4).2.1 j + + h1Coeff (triangleEdges 4).2.2 j = if j = 4 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_5 : ∀ j : Fin 270, + h1Coeff (triangleEdges 5).1 j - h1Coeff (triangleEdges 5).2.1 j + + h1Coeff (triangleEdges 5).2.2 j = if j = 5 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_6 : ∀ j : Fin 270, + h1Coeff (triangleEdges 6).1 j - h1Coeff (triangleEdges 6).2.1 j + + h1Coeff (triangleEdges 6).2.2 j = if j = 6 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_7 : ∀ j : Fin 270, + h1Coeff (triangleEdges 7).1 j - h1Coeff (triangleEdges 7).2.1 j + + h1Coeff (triangleEdges 7).2.2 j = if j = 7 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_8 : ∀ j : Fin 270, + h1Coeff (triangleEdges 8).1 j - h1Coeff (triangleEdges 8).2.1 j + + h1Coeff (triangleEdges 8).2.2 j = if j = 8 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_9 : ∀ j : Fin 270, + h1Coeff (triangleEdges 9).1 j - h1Coeff (triangleEdges 9).2.1 j + + h1Coeff (triangleEdges 9).2.2 j = if j = 9 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_10 : ∀ j : Fin 270, + h1Coeff (triangleEdges 10).1 j - h1Coeff (triangleEdges 10).2.1 j + + h1Coeff (triangleEdges 10).2.2 j = if j = 10 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_11 : ∀ j : Fin 270, + h1Coeff (triangleEdges 11).1 j - h1Coeff (triangleEdges 11).2.1 j + + h1Coeff (triangleEdges 11).2.2 j = if j = 11 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_12 : ∀ j : Fin 270, + h1Coeff (triangleEdges 12).1 j - h1Coeff (triangleEdges 12).2.1 j + + h1Coeff (triangleEdges 12).2.2 j = if j = 12 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_13 : ∀ j : Fin 270, + h1Coeff (triangleEdges 13).1 j - h1Coeff (triangleEdges 13).2.1 j + + h1Coeff (triangleEdges 13).2.2 j = if j = 13 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_14 : ∀ j : Fin 270, + h1Coeff (triangleEdges 14).1 j - h1Coeff (triangleEdges 14).2.1 j + + h1Coeff (triangleEdges 14).2.2 j = if j = 14 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_15 : ∀ j : Fin 270, + h1Coeff (triangleEdges 15).1 j - h1Coeff (triangleEdges 15).2.1 j + + h1Coeff (triangleEdges 15).2.2 j = if j = 15 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_16 : ∀ j : Fin 270, + h1Coeff (triangleEdges 16).1 j - h1Coeff (triangleEdges 16).2.1 j + + h1Coeff (triangleEdges 16).2.2 j = if j = 16 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_17 : ∀ j : Fin 270, + h1Coeff (triangleEdges 17).1 j - h1Coeff (triangleEdges 17).2.1 j + + h1Coeff (triangleEdges 17).2.2 j = if j = 17 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_18 : ∀ j : Fin 270, + h1Coeff (triangleEdges 18).1 j - h1Coeff (triangleEdges 18).2.1 j + + h1Coeff (triangleEdges 18).2.2 j = if j = 18 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_19 : ∀ j : Fin 270, + h1Coeff (triangleEdges 19).1 j - h1Coeff (triangleEdges 19).2.1 j + + h1Coeff (triangleEdges 19).2.2 j = if j = 19 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_20 : ∀ j : Fin 270, + h1Coeff (triangleEdges 20).1 j - h1Coeff (triangleEdges 20).2.1 j + + h1Coeff (triangleEdges 20).2.2 j = if j = 20 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_21 : ∀ j : Fin 270, + h1Coeff (triangleEdges 21).1 j - h1Coeff (triangleEdges 21).2.1 j + + h1Coeff (triangleEdges 21).2.2 j = if j = 21 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_22 : ∀ j : Fin 270, + h1Coeff (triangleEdges 22).1 j - h1Coeff (triangleEdges 22).2.1 j + + h1Coeff (triangleEdges 22).2.2 j = if j = 22 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_23 : ∀ j : Fin 270, + h1Coeff (triangleEdges 23).1 j - h1Coeff (triangleEdges 23).2.1 j + + h1Coeff (triangleEdges 23).2.2 j = if j = 23 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_24 : ∀ j : Fin 270, + h1Coeff (triangleEdges 24).1 j - h1Coeff (triangleEdges 24).2.1 j + + h1Coeff (triangleEdges 24).2.2 j = if j = 24 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_25 : ∀ j : Fin 270, + h1Coeff (triangleEdges 25).1 j - h1Coeff (triangleEdges 25).2.1 j + + h1Coeff (triangleEdges 25).2.2 j = if j = 25 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_26 : ∀ j : Fin 270, + h1Coeff (triangleEdges 26).1 j - h1Coeff (triangleEdges 26).2.1 j + + h1Coeff (triangleEdges 26).2.2 j = if j = 26 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_27 : ∀ j : Fin 270, + h1Coeff (triangleEdges 27).1 j - h1Coeff (triangleEdges 27).2.1 j + + h1Coeff (triangleEdges 27).2.2 j = if j = 27 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_28 : ∀ j : Fin 270, + h1Coeff (triangleEdges 28).1 j - h1Coeff (triangleEdges 28).2.1 j + + h1Coeff (triangleEdges 28).2.2 j = if j = 28 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_29 : ∀ j : Fin 270, + h1Coeff (triangleEdges 29).1 j - h1Coeff (triangleEdges 29).2.1 j + + h1Coeff (triangleEdges 29).2.2 j = if j = 29 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_30 : ∀ j : Fin 270, + h1Coeff (triangleEdges 30).1 j - h1Coeff (triangleEdges 30).2.1 j + + h1Coeff (triangleEdges 30).2.2 j = if j = 30 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_31 : ∀ j : Fin 270, + h1Coeff (triangleEdges 31).1 j - h1Coeff (triangleEdges 31).2.1 j + + h1Coeff (triangleEdges 31).2.2 j = if j = 31 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_32 : ∀ j : Fin 270, + h1Coeff (triangleEdges 32).1 j - h1Coeff (triangleEdges 32).2.1 j + + h1Coeff (triangleEdges 32).2.2 j = if j = 32 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_33 : ∀ j : Fin 270, + h1Coeff (triangleEdges 33).1 j - h1Coeff (triangleEdges 33).2.1 j + + h1Coeff (triangleEdges 33).2.2 j = if j = 33 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_34 : ∀ j : Fin 270, + h1Coeff (triangleEdges 34).1 j - h1Coeff (triangleEdges 34).2.1 j + + h1Coeff (triangleEdges 34).2.2 j = if j = 34 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_35 : ∀ j : Fin 270, + h1Coeff (triangleEdges 35).1 j - h1Coeff (triangleEdges 35).2.1 j + + h1Coeff (triangleEdges 35).2.2 j = if j = 35 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_36 : ∀ j : Fin 270, + h1Coeff (triangleEdges 36).1 j - h1Coeff (triangleEdges 36).2.1 j + + h1Coeff (triangleEdges 36).2.2 j = if j = 36 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_37 : ∀ j : Fin 270, + h1Coeff (triangleEdges 37).1 j - h1Coeff (triangleEdges 37).2.1 j + + h1Coeff (triangleEdges 37).2.2 j = if j = 37 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_38 : ∀ j : Fin 270, + h1Coeff (triangleEdges 38).1 j - h1Coeff (triangleEdges 38).2.1 j + + h1Coeff (triangleEdges 38).2.2 j = if j = 38 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_39 : ∀ j : Fin 270, + h1Coeff (triangleEdges 39).1 j - h1Coeff (triangleEdges 39).2.1 j + + h1Coeff (triangleEdges 39).2.2 j = if j = 39 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_40 : ∀ j : Fin 270, + h1Coeff (triangleEdges 40).1 j - h1Coeff (triangleEdges 40).2.1 j + + h1Coeff (triangleEdges 40).2.2 j = if j = 40 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_41 : ∀ j : Fin 270, + h1Coeff (triangleEdges 41).1 j - h1Coeff (triangleEdges 41).2.1 j + + h1Coeff (triangleEdges 41).2.2 j = if j = 41 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_42 : ∀ j : Fin 270, + h1Coeff (triangleEdges 42).1 j - h1Coeff (triangleEdges 42).2.1 j + + h1Coeff (triangleEdges 42).2.2 j = if j = 42 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_43 : ∀ j : Fin 270, + h1Coeff (triangleEdges 43).1 j - h1Coeff (triangleEdges 43).2.1 j + + h1Coeff (triangleEdges 43).2.2 j = if j = 43 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_44 : ∀ j : Fin 270, + h1Coeff (triangleEdges 44).1 j - h1Coeff (triangleEdges 44).2.1 j + + h1Coeff (triangleEdges 44).2.2 j = if j = 44 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_45 : ∀ j : Fin 270, + h1Coeff (triangleEdges 45).1 j - h1Coeff (triangleEdges 45).2.1 j + + h1Coeff (triangleEdges 45).2.2 j = if j = 45 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_46 : ∀ j : Fin 270, + h1Coeff (triangleEdges 46).1 j - h1Coeff (triangleEdges 46).2.1 j + + h1Coeff (triangleEdges 46).2.2 j = if j = 46 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_47 : ∀ j : Fin 270, + h1Coeff (triangleEdges 47).1 j - h1Coeff (triangleEdges 47).2.1 j + + h1Coeff (triangleEdges 47).2.2 j = if j = 47 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_48 : ∀ j : Fin 270, + h1Coeff (triangleEdges 48).1 j - h1Coeff (triangleEdges 48).2.1 j + + h1Coeff (triangleEdges 48).2.2 j = if j = 48 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_49 : ∀ j : Fin 270, + h1Coeff (triangleEdges 49).1 j - h1Coeff (triangleEdges 49).2.1 j + + h1Coeff (triangleEdges 49).2.2 j = if j = 49 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_50 : ∀ j : Fin 270, + h1Coeff (triangleEdges 50).1 j - h1Coeff (triangleEdges 50).2.1 j + + h1Coeff (triangleEdges 50).2.2 j = if j = 50 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_51 : ∀ j : Fin 270, + h1Coeff (triangleEdges 51).1 j - h1Coeff (triangleEdges 51).2.1 j + + h1Coeff (triangleEdges 51).2.2 j = if j = 51 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_52 : ∀ j : Fin 270, + h1Coeff (triangleEdges 52).1 j - h1Coeff (triangleEdges 52).2.1 j + + h1Coeff (triangleEdges 52).2.2 j = if j = 52 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_53 : ∀ j : Fin 270, + h1Coeff (triangleEdges 53).1 j - h1Coeff (triangleEdges 53).2.1 j + + h1Coeff (triangleEdges 53).2.2 j = if j = 53 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_54 : ∀ j : Fin 270, + h1Coeff (triangleEdges 54).1 j - h1Coeff (triangleEdges 54).2.1 j + + h1Coeff (triangleEdges 54).2.2 j = if j = 54 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_55 : ∀ j : Fin 270, + h1Coeff (triangleEdges 55).1 j - h1Coeff (triangleEdges 55).2.1 j + + h1Coeff (triangleEdges 55).2.2 j = if j = 55 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_56 : ∀ j : Fin 270, + h1Coeff (triangleEdges 56).1 j - h1Coeff (triangleEdges 56).2.1 j + + h1Coeff (triangleEdges 56).2.2 j = if j = 56 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_57 : ∀ j : Fin 270, + h1Coeff (triangleEdges 57).1 j - h1Coeff (triangleEdges 57).2.1 j + + h1Coeff (triangleEdges 57).2.2 j = if j = 57 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_58 : ∀ j : Fin 270, + h1Coeff (triangleEdges 58).1 j - h1Coeff (triangleEdges 58).2.1 j + + h1Coeff (triangleEdges 58).2.2 j = if j = 58 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_59 : ∀ j : Fin 270, + h1Coeff (triangleEdges 59).1 j - h1Coeff (triangleEdges 59).2.1 j + + h1Coeff (triangleEdges 59).2.2 j = if j = 59 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_60 : ∀ j : Fin 270, + h1Coeff (triangleEdges 60).1 j - h1Coeff (triangleEdges 60).2.1 j + + h1Coeff (triangleEdges 60).2.2 j = if j = 60 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_61 : ∀ j : Fin 270, + h1Coeff (triangleEdges 61).1 j - h1Coeff (triangleEdges 61).2.1 j + + h1Coeff (triangleEdges 61).2.2 j = if j = 61 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_62 : ∀ j : Fin 270, + h1Coeff (triangleEdges 62).1 j - h1Coeff (triangleEdges 62).2.1 j + + h1Coeff (triangleEdges 62).2.2 j = if j = 62 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_63 : ∀ j : Fin 270, + h1Coeff (triangleEdges 63).1 j - h1Coeff (triangleEdges 63).2.1 j + + h1Coeff (triangleEdges 63).2.2 j = if j = 63 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_64 : ∀ j : Fin 270, + h1Coeff (triangleEdges 64).1 j - h1Coeff (triangleEdges 64).2.1 j + + h1Coeff (triangleEdges 64).2.2 j = if j = 64 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_65 : ∀ j : Fin 270, + h1Coeff (triangleEdges 65).1 j - h1Coeff (triangleEdges 65).2.1 j + + h1Coeff (triangleEdges 65).2.2 j = if j = 65 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_66 : ∀ j : Fin 270, + h1Coeff (triangleEdges 66).1 j - h1Coeff (triangleEdges 66).2.1 j + + h1Coeff (triangleEdges 66).2.2 j = if j = 66 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_67 : ∀ j : Fin 270, + h1Coeff (triangleEdges 67).1 j - h1Coeff (triangleEdges 67).2.1 j + + h1Coeff (triangleEdges 67).2.2 j = if j = 67 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_68 : ∀ j : Fin 270, + h1Coeff (triangleEdges 68).1 j - h1Coeff (triangleEdges 68).2.1 j + + h1Coeff (triangleEdges 68).2.2 j = if j = 68 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_69 : ∀ j : Fin 270, + h1Coeff (triangleEdges 69).1 j - h1Coeff (triangleEdges 69).2.1 j + + h1Coeff (triangleEdges 69).2.2 j = if j = 69 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_70 : ∀ j : Fin 270, + h1Coeff (triangleEdges 70).1 j - h1Coeff (triangleEdges 70).2.1 j + + h1Coeff (triangleEdges 70).2.2 j = if j = 70 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_71 : ∀ j : Fin 270, + h1Coeff (triangleEdges 71).1 j - h1Coeff (triangleEdges 71).2.1 j + + h1Coeff (triangleEdges 71).2.2 j = if j = 71 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_72 : ∀ j : Fin 270, + h1Coeff (triangleEdges 72).1 j - h1Coeff (triangleEdges 72).2.1 j + + h1Coeff (triangleEdges 72).2.2 j = if j = 72 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_73 : ∀ j : Fin 270, + h1Coeff (triangleEdges 73).1 j - h1Coeff (triangleEdges 73).2.1 j + + h1Coeff (triangleEdges 73).2.2 j = if j = 73 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_74 : ∀ j : Fin 270, + h1Coeff (triangleEdges 74).1 j - h1Coeff (triangleEdges 74).2.1 j + + h1Coeff (triangleEdges 74).2.2 j = if j = 74 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_75 : ∀ j : Fin 270, + h1Coeff (triangleEdges 75).1 j - h1Coeff (triangleEdges 75).2.1 j + + h1Coeff (triangleEdges 75).2.2 j = if j = 75 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_76 : ∀ j : Fin 270, + h1Coeff (triangleEdges 76).1 j - h1Coeff (triangleEdges 76).2.1 j + + h1Coeff (triangleEdges 76).2.2 j = if j = 76 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_77 : ∀ j : Fin 270, + h1Coeff (triangleEdges 77).1 j - h1Coeff (triangleEdges 77).2.1 j + + h1Coeff (triangleEdges 77).2.2 j = if j = 77 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_78 : ∀ j : Fin 270, + h1Coeff (triangleEdges 78).1 j - h1Coeff (triangleEdges 78).2.1 j + + h1Coeff (triangleEdges 78).2.2 j = if j = 78 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_79 : ∀ j : Fin 270, + h1Coeff (triangleEdges 79).1 j - h1Coeff (triangleEdges 79).2.1 j + + h1Coeff (triangleEdges 79).2.2 j = if j = 79 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_80 : ∀ j : Fin 270, + h1Coeff (triangleEdges 80).1 j - h1Coeff (triangleEdges 80).2.1 j + + h1Coeff (triangleEdges 80).2.2 j = if j = 80 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_81 : ∀ j : Fin 270, + h1Coeff (triangleEdges 81).1 j - h1Coeff (triangleEdges 81).2.1 j + + h1Coeff (triangleEdges 81).2.2 j = if j = 81 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_82 : ∀ j : Fin 270, + h1Coeff (triangleEdges 82).1 j - h1Coeff (triangleEdges 82).2.1 j + + h1Coeff (triangleEdges 82).2.2 j = if j = 82 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_83 : ∀ j : Fin 270, + h1Coeff (triangleEdges 83).1 j - h1Coeff (triangleEdges 83).2.1 j + + h1Coeff (triangleEdges 83).2.2 j = if j = 83 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_84 : ∀ j : Fin 270, + h1Coeff (triangleEdges 84).1 j - h1Coeff (triangleEdges 84).2.1 j + + h1Coeff (triangleEdges 84).2.2 j = if j = 84 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_85 : ∀ j : Fin 270, + h1Coeff (triangleEdges 85).1 j - h1Coeff (triangleEdges 85).2.1 j + + h1Coeff (triangleEdges 85).2.2 j = if j = 85 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_86 : ∀ j : Fin 270, + h1Coeff (triangleEdges 86).1 j - h1Coeff (triangleEdges 86).2.1 j + + h1Coeff (triangleEdges 86).2.2 j = if j = 86 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_87 : ∀ j : Fin 270, + h1Coeff (triangleEdges 87).1 j - h1Coeff (triangleEdges 87).2.1 j + + h1Coeff (triangleEdges 87).2.2 j = if j = 87 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_88 : ∀ j : Fin 270, + h1Coeff (triangleEdges 88).1 j - h1Coeff (triangleEdges 88).2.1 j + + h1Coeff (triangleEdges 88).2.2 j = if j = 88 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_89 : ∀ j : Fin 270, + h1Coeff (triangleEdges 89).1 j - h1Coeff (triangleEdges 89).2.1 j + + h1Coeff (triangleEdges 89).2.2 j = if j = 89 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_90 : ∀ j : Fin 270, + h1Coeff (triangleEdges 90).1 j - h1Coeff (triangleEdges 90).2.1 j + + h1Coeff (triangleEdges 90).2.2 j = if j = 90 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_91 : ∀ j : Fin 270, + h1Coeff (triangleEdges 91).1 j - h1Coeff (triangleEdges 91).2.1 j + + h1Coeff (triangleEdges 91).2.2 j = if j = 91 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_92 : ∀ j : Fin 270, + h1Coeff (triangleEdges 92).1 j - h1Coeff (triangleEdges 92).2.1 j + + h1Coeff (triangleEdges 92).2.2 j = if j = 92 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_93 : ∀ j : Fin 270, + h1Coeff (triangleEdges 93).1 j - h1Coeff (triangleEdges 93).2.1 j + + h1Coeff (triangleEdges 93).2.2 j = if j = 93 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_94 : ∀ j : Fin 270, + h1Coeff (triangleEdges 94).1 j - h1Coeff (triangleEdges 94).2.1 j + + h1Coeff (triangleEdges 94).2.2 j = if j = 94 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_95 : ∀ j : Fin 270, + h1Coeff (triangleEdges 95).1 j - h1Coeff (triangleEdges 95).2.1 j + + h1Coeff (triangleEdges 95).2.2 j = if j = 95 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_96 : ∀ j : Fin 270, + h1Coeff (triangleEdges 96).1 j - h1Coeff (triangleEdges 96).2.1 j + + h1Coeff (triangleEdges 96).2.2 j = if j = 96 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_97 : ∀ j : Fin 270, + h1Coeff (triangleEdges 97).1 j - h1Coeff (triangleEdges 97).2.1 j + + h1Coeff (triangleEdges 97).2.2 j = if j = 97 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_98 : ∀ j : Fin 270, + h1Coeff (triangleEdges 98).1 j - h1Coeff (triangleEdges 98).2.1 j + + h1Coeff (triangleEdges 98).2.2 j = if j = 98 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_99 : ∀ j : Fin 270, + h1Coeff (triangleEdges 99).1 j - h1Coeff (triangleEdges 99).2.1 j + + h1Coeff (triangleEdges 99).2.2 j = if j = 99 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_100 : ∀ j : Fin 270, + h1Coeff (triangleEdges 100).1 j - h1Coeff (triangleEdges 100).2.1 j + + h1Coeff (triangleEdges 100).2.2 j = if j = 100 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_101 : ∀ j : Fin 270, + h1Coeff (triangleEdges 101).1 j - h1Coeff (triangleEdges 101).2.1 j + + h1Coeff (triangleEdges 101).2.2 j = if j = 101 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_102 : ∀ j : Fin 270, + h1Coeff (triangleEdges 102).1 j - h1Coeff (triangleEdges 102).2.1 j + + h1Coeff (triangleEdges 102).2.2 j = if j = 102 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_103 : ∀ j : Fin 270, + h1Coeff (triangleEdges 103).1 j - h1Coeff (triangleEdges 103).2.1 j + + h1Coeff (triangleEdges 103).2.2 j = if j = 103 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_104 : ∀ j : Fin 270, + h1Coeff (triangleEdges 104).1 j - h1Coeff (triangleEdges 104).2.1 j + + h1Coeff (triangleEdges 104).2.2 j = if j = 104 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_105 : ∀ j : Fin 270, + h1Coeff (triangleEdges 105).1 j - h1Coeff (triangleEdges 105).2.1 j + + h1Coeff (triangleEdges 105).2.2 j = if j = 105 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_106 : ∀ j : Fin 270, + h1Coeff (triangleEdges 106).1 j - h1Coeff (triangleEdges 106).2.1 j + + h1Coeff (triangleEdges 106).2.2 j = if j = 106 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_107 : ∀ j : Fin 270, + h1Coeff (triangleEdges 107).1 j - h1Coeff (triangleEdges 107).2.1 j + + h1Coeff (triangleEdges 107).2.2 j = if j = 107 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_108 : ∀ j : Fin 270, + h1Coeff (triangleEdges 108).1 j - h1Coeff (triangleEdges 108).2.1 j + + h1Coeff (triangleEdges 108).2.2 j = if j = 108 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_109 : ∀ j : Fin 270, + h1Coeff (triangleEdges 109).1 j - h1Coeff (triangleEdges 109).2.1 j + + h1Coeff (triangleEdges 109).2.2 j = if j = 109 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_110 : ∀ j : Fin 270, + h1Coeff (triangleEdges 110).1 j - h1Coeff (triangleEdges 110).2.1 j + + h1Coeff (triangleEdges 110).2.2 j = if j = 110 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_111 : ∀ j : Fin 270, + h1Coeff (triangleEdges 111).1 j - h1Coeff (triangleEdges 111).2.1 j + + h1Coeff (triangleEdges 111).2.2 j = if j = 111 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_112 : ∀ j : Fin 270, + h1Coeff (triangleEdges 112).1 j - h1Coeff (triangleEdges 112).2.1 j + + h1Coeff (triangleEdges 112).2.2 j = if j = 112 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_113 : ∀ j : Fin 270, + h1Coeff (triangleEdges 113).1 j - h1Coeff (triangleEdges 113).2.1 j + + h1Coeff (triangleEdges 113).2.2 j = if j = 113 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_114 : ∀ j : Fin 270, + h1Coeff (triangleEdges 114).1 j - h1Coeff (triangleEdges 114).2.1 j + + h1Coeff (triangleEdges 114).2.2 j = if j = 114 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_115 : ∀ j : Fin 270, + h1Coeff (triangleEdges 115).1 j - h1Coeff (triangleEdges 115).2.1 j + + h1Coeff (triangleEdges 115).2.2 j = if j = 115 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_116 : ∀ j : Fin 270, + h1Coeff (triangleEdges 116).1 j - h1Coeff (triangleEdges 116).2.1 j + + h1Coeff (triangleEdges 116).2.2 j = if j = 116 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_117 : ∀ j : Fin 270, + h1Coeff (triangleEdges 117).1 j - h1Coeff (triangleEdges 117).2.1 j + + h1Coeff (triangleEdges 117).2.2 j = if j = 117 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_118 : ∀ j : Fin 270, + h1Coeff (triangleEdges 118).1 j - h1Coeff (triangleEdges 118).2.1 j + + h1Coeff (triangleEdges 118).2.2 j = if j = 118 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_119 : ∀ j : Fin 270, + h1Coeff (triangleEdges 119).1 j - h1Coeff (triangleEdges 119).2.1 j + + h1Coeff (triangleEdges 119).2.2 j = if j = 119 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_120 : ∀ j : Fin 270, + h1Coeff (triangleEdges 120).1 j - h1Coeff (triangleEdges 120).2.1 j + + h1Coeff (triangleEdges 120).2.2 j = if j = 120 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_121 : ∀ j : Fin 270, + h1Coeff (triangleEdges 121).1 j - h1Coeff (triangleEdges 121).2.1 j + + h1Coeff (triangleEdges 121).2.2 j = if j = 121 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_122 : ∀ j : Fin 270, + h1Coeff (triangleEdges 122).1 j - h1Coeff (triangleEdges 122).2.1 j + + h1Coeff (triangleEdges 122).2.2 j = if j = 122 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_123 : ∀ j : Fin 270, + h1Coeff (triangleEdges 123).1 j - h1Coeff (triangleEdges 123).2.1 j + + h1Coeff (triangleEdges 123).2.2 j = if j = 123 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_124 : ∀ j : Fin 270, + h1Coeff (triangleEdges 124).1 j - h1Coeff (triangleEdges 124).2.1 j + + h1Coeff (triangleEdges 124).2.2 j = if j = 124 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_125 : ∀ j : Fin 270, + h1Coeff (triangleEdges 125).1 j - h1Coeff (triangleEdges 125).2.1 j + + h1Coeff (triangleEdges 125).2.2 j = if j = 125 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_126 : ∀ j : Fin 270, + h1Coeff (triangleEdges 126).1 j - h1Coeff (triangleEdges 126).2.1 j + + h1Coeff (triangleEdges 126).2.2 j = if j = 126 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_127 : ∀ j : Fin 270, + h1Coeff (triangleEdges 127).1 j - h1Coeff (triangleEdges 127).2.1 j + + h1Coeff (triangleEdges 127).2.2 j = if j = 127 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_128 : ∀ j : Fin 270, + h1Coeff (triangleEdges 128).1 j - h1Coeff (triangleEdges 128).2.1 j + + h1Coeff (triangleEdges 128).2.2 j = if j = 128 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_129 : ∀ j : Fin 270, + h1Coeff (triangleEdges 129).1 j - h1Coeff (triangleEdges 129).2.1 j + + h1Coeff (triangleEdges 129).2.2 j = if j = 129 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_130 : ∀ j : Fin 270, + h1Coeff (triangleEdges 130).1 j - h1Coeff (triangleEdges 130).2.1 j + + h1Coeff (triangleEdges 130).2.2 j = if j = 130 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_131 : ∀ j : Fin 270, + h1Coeff (triangleEdges 131).1 j - h1Coeff (triangleEdges 131).2.1 j + + h1Coeff (triangleEdges 131).2.2 j = if j = 131 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_132 : ∀ j : Fin 270, + h1Coeff (triangleEdges 132).1 j - h1Coeff (triangleEdges 132).2.1 j + + h1Coeff (triangleEdges 132).2.2 j = if j = 132 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_133 : ∀ j : Fin 270, + h1Coeff (triangleEdges 133).1 j - h1Coeff (triangleEdges 133).2.1 j + + h1Coeff (triangleEdges 133).2.2 j = if j = 133 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_134 : ∀ j : Fin 270, + h1Coeff (triangleEdges 134).1 j - h1Coeff (triangleEdges 134).2.1 j + + h1Coeff (triangleEdges 134).2.2 j = if j = 134 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_135 : ∀ j : Fin 270, + h1Coeff (triangleEdges 135).1 j - h1Coeff (triangleEdges 135).2.1 j + + h1Coeff (triangleEdges 135).2.2 j = if j = 135 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_136 : ∀ j : Fin 270, + h1Coeff (triangleEdges 136).1 j - h1Coeff (triangleEdges 136).2.1 j + + h1Coeff (triangleEdges 136).2.2 j = if j = 136 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_137 : ∀ j : Fin 270, + h1Coeff (triangleEdges 137).1 j - h1Coeff (triangleEdges 137).2.1 j + + h1Coeff (triangleEdges 137).2.2 j = if j = 137 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_138 : ∀ j : Fin 270, + h1Coeff (triangleEdges 138).1 j - h1Coeff (triangleEdges 138).2.1 j + + h1Coeff (triangleEdges 138).2.2 j = if j = 138 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_139 : ∀ j : Fin 270, + h1Coeff (triangleEdges 139).1 j - h1Coeff (triangleEdges 139).2.1 j + + h1Coeff (triangleEdges 139).2.2 j = if j = 139 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_140 : ∀ j : Fin 270, + h1Coeff (triangleEdges 140).1 j - h1Coeff (triangleEdges 140).2.1 j + + h1Coeff (triangleEdges 140).2.2 j = if j = 140 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_141 : ∀ j : Fin 270, + h1Coeff (triangleEdges 141).1 j - h1Coeff (triangleEdges 141).2.1 j + + h1Coeff (triangleEdges 141).2.2 j = if j = 141 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_142 : ∀ j : Fin 270, + h1Coeff (triangleEdges 142).1 j - h1Coeff (triangleEdges 142).2.1 j + + h1Coeff (triangleEdges 142).2.2 j = if j = 142 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_143 : ∀ j : Fin 270, + h1Coeff (triangleEdges 143).1 j - h1Coeff (triangleEdges 143).2.1 j + + h1Coeff (triangleEdges 143).2.2 j = if j = 143 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_144 : ∀ j : Fin 270, + h1Coeff (triangleEdges 144).1 j - h1Coeff (triangleEdges 144).2.1 j + + h1Coeff (triangleEdges 144).2.2 j = if j = 144 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_145 : ∀ j : Fin 270, + h1Coeff (triangleEdges 145).1 j - h1Coeff (triangleEdges 145).2.1 j + + h1Coeff (triangleEdges 145).2.2 j = if j = 145 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_146 : ∀ j : Fin 270, + h1Coeff (triangleEdges 146).1 j - h1Coeff (triangleEdges 146).2.1 j + + h1Coeff (triangleEdges 146).2.2 j = if j = 146 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_147 : ∀ j : Fin 270, + h1Coeff (triangleEdges 147).1 j - h1Coeff (triangleEdges 147).2.1 j + + h1Coeff (triangleEdges 147).2.2 j = if j = 147 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_148 : ∀ j : Fin 270, + h1Coeff (triangleEdges 148).1 j - h1Coeff (triangleEdges 148).2.1 j + + h1Coeff (triangleEdges 148).2.2 j = if j = 148 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_149 : ∀ j : Fin 270, + h1Coeff (triangleEdges 149).1 j - h1Coeff (triangleEdges 149).2.1 j + + h1Coeff (triangleEdges 149).2.2 j = if j = 149 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_150 : ∀ j : Fin 270, + h1Coeff (triangleEdges 150).1 j - h1Coeff (triangleEdges 150).2.1 j + + h1Coeff (triangleEdges 150).2.2 j = if j = 150 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_151 : ∀ j : Fin 270, + h1Coeff (triangleEdges 151).1 j - h1Coeff (triangleEdges 151).2.1 j + + h1Coeff (triangleEdges 151).2.2 j = if j = 151 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_152 : ∀ j : Fin 270, + h1Coeff (triangleEdges 152).1 j - h1Coeff (triangleEdges 152).2.1 j + + h1Coeff (triangleEdges 152).2.2 j = if j = 152 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_153 : ∀ j : Fin 270, + h1Coeff (triangleEdges 153).1 j - h1Coeff (triangleEdges 153).2.1 j + + h1Coeff (triangleEdges 153).2.2 j = if j = 153 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_154 : ∀ j : Fin 270, + h1Coeff (triangleEdges 154).1 j - h1Coeff (triangleEdges 154).2.1 j + + h1Coeff (triangleEdges 154).2.2 j = if j = 154 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_155 : ∀ j : Fin 270, + h1Coeff (triangleEdges 155).1 j - h1Coeff (triangleEdges 155).2.1 j + + h1Coeff (triangleEdges 155).2.2 j = if j = 155 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_156 : ∀ j : Fin 270, + h1Coeff (triangleEdges 156).1 j - h1Coeff (triangleEdges 156).2.1 j + + h1Coeff (triangleEdges 156).2.2 j = if j = 156 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_157 : ∀ j : Fin 270, + h1Coeff (triangleEdges 157).1 j - h1Coeff (triangleEdges 157).2.1 j + + h1Coeff (triangleEdges 157).2.2 j = if j = 157 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_158 : ∀ j : Fin 270, + h1Coeff (triangleEdges 158).1 j - h1Coeff (triangleEdges 158).2.1 j + + h1Coeff (triangleEdges 158).2.2 j = if j = 158 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_159 : ∀ j : Fin 270, + h1Coeff (triangleEdges 159).1 j - h1Coeff (triangleEdges 159).2.1 j + + h1Coeff (triangleEdges 159).2.2 j = if j = 159 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_160 : ∀ j : Fin 270, + h1Coeff (triangleEdges 160).1 j - h1Coeff (triangleEdges 160).2.1 j + + h1Coeff (triangleEdges 160).2.2 j = if j = 160 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_161 : ∀ j : Fin 270, + h1Coeff (triangleEdges 161).1 j - h1Coeff (triangleEdges 161).2.1 j + + h1Coeff (triangleEdges 161).2.2 j = if j = 161 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_162 : ∀ j : Fin 270, + h1Coeff (triangleEdges 162).1 j - h1Coeff (triangleEdges 162).2.1 j + + h1Coeff (triangleEdges 162).2.2 j = if j = 162 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_163 : ∀ j : Fin 270, + h1Coeff (triangleEdges 163).1 j - h1Coeff (triangleEdges 163).2.1 j + + h1Coeff (triangleEdges 163).2.2 j = if j = 163 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_164 : ∀ j : Fin 270, + h1Coeff (triangleEdges 164).1 j - h1Coeff (triangleEdges 164).2.1 j + + h1Coeff (triangleEdges 164).2.2 j = if j = 164 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_165 : ∀ j : Fin 270, + h1Coeff (triangleEdges 165).1 j - h1Coeff (triangleEdges 165).2.1 j + + h1Coeff (triangleEdges 165).2.2 j = if j = 165 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_166 : ∀ j : Fin 270, + h1Coeff (triangleEdges 166).1 j - h1Coeff (triangleEdges 166).2.1 j + + h1Coeff (triangleEdges 166).2.2 j = if j = 166 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_167 : ∀ j : Fin 270, + h1Coeff (triangleEdges 167).1 j - h1Coeff (triangleEdges 167).2.1 j + + h1Coeff (triangleEdges 167).2.2 j = if j = 167 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_168 : ∀ j : Fin 270, + h1Coeff (triangleEdges 168).1 j - h1Coeff (triangleEdges 168).2.1 j + + h1Coeff (triangleEdges 168).2.2 j = if j = 168 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_169 : ∀ j : Fin 270, + h1Coeff (triangleEdges 169).1 j - h1Coeff (triangleEdges 169).2.1 j + + h1Coeff (triangleEdges 169).2.2 j = if j = 169 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_170 : ∀ j : Fin 270, + h1Coeff (triangleEdges 170).1 j - h1Coeff (triangleEdges 170).2.1 j + + h1Coeff (triangleEdges 170).2.2 j = if j = 170 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_171 : ∀ j : Fin 270, + h1Coeff (triangleEdges 171).1 j - h1Coeff (triangleEdges 171).2.1 j + + h1Coeff (triangleEdges 171).2.2 j = if j = 171 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_172 : ∀ j : Fin 270, + h1Coeff (triangleEdges 172).1 j - h1Coeff (triangleEdges 172).2.1 j + + h1Coeff (triangleEdges 172).2.2 j = if j = 172 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_173 : ∀ j : Fin 270, + h1Coeff (triangleEdges 173).1 j - h1Coeff (triangleEdges 173).2.1 j + + h1Coeff (triangleEdges 173).2.2 j = if j = 173 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_174 : ∀ j : Fin 270, + h1Coeff (triangleEdges 174).1 j - h1Coeff (triangleEdges 174).2.1 j + + h1Coeff (triangleEdges 174).2.2 j = if j = 174 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_175 : ∀ j : Fin 270, + h1Coeff (triangleEdges 175).1 j - h1Coeff (triangleEdges 175).2.1 j + + h1Coeff (triangleEdges 175).2.2 j = if j = 175 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_176 : ∀ j : Fin 270, + h1Coeff (triangleEdges 176).1 j - h1Coeff (triangleEdges 176).2.1 j + + h1Coeff (triangleEdges 176).2.2 j = if j = 176 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_177 : ∀ j : Fin 270, + h1Coeff (triangleEdges 177).1 j - h1Coeff (triangleEdges 177).2.1 j + + h1Coeff (triangleEdges 177).2.2 j = if j = 177 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_178 : ∀ j : Fin 270, + h1Coeff (triangleEdges 178).1 j - h1Coeff (triangleEdges 178).2.1 j + + h1Coeff (triangleEdges 178).2.2 j = if j = 178 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_179 : ∀ j : Fin 270, + h1Coeff (triangleEdges 179).1 j - h1Coeff (triangleEdges 179).2.1 j + + h1Coeff (triangleEdges 179).2.2 j = if j = 179 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_180 : ∀ j : Fin 270, + h1Coeff (triangleEdges 180).1 j - h1Coeff (triangleEdges 180).2.1 j + + h1Coeff (triangleEdges 180).2.2 j = if j = 180 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_181 : ∀ j : Fin 270, + h1Coeff (triangleEdges 181).1 j - h1Coeff (triangleEdges 181).2.1 j + + h1Coeff (triangleEdges 181).2.2 j = if j = 181 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_182 : ∀ j : Fin 270, + h1Coeff (triangleEdges 182).1 j - h1Coeff (triangleEdges 182).2.1 j + + h1Coeff (triangleEdges 182).2.2 j = if j = 182 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_183 : ∀ j : Fin 270, + h1Coeff (triangleEdges 183).1 j - h1Coeff (triangleEdges 183).2.1 j + + h1Coeff (triangleEdges 183).2.2 j = if j = 183 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_184 : ∀ j : Fin 270, + h1Coeff (triangleEdges 184).1 j - h1Coeff (triangleEdges 184).2.1 j + + h1Coeff (triangleEdges 184).2.2 j = if j = 184 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_185 : ∀ j : Fin 270, + h1Coeff (triangleEdges 185).1 j - h1Coeff (triangleEdges 185).2.1 j + + h1Coeff (triangleEdges 185).2.2 j = if j = 185 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_186 : ∀ j : Fin 270, + h1Coeff (triangleEdges 186).1 j - h1Coeff (triangleEdges 186).2.1 j + + h1Coeff (triangleEdges 186).2.2 j = if j = 186 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_187 : ∀ j : Fin 270, + h1Coeff (triangleEdges 187).1 j - h1Coeff (triangleEdges 187).2.1 j + + h1Coeff (triangleEdges 187).2.2 j = if j = 187 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_188 : ∀ j : Fin 270, + h1Coeff (triangleEdges 188).1 j - h1Coeff (triangleEdges 188).2.1 j + + h1Coeff (triangleEdges 188).2.2 j = if j = 188 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_189 : ∀ j : Fin 270, + h1Coeff (triangleEdges 189).1 j - h1Coeff (triangleEdges 189).2.1 j + + h1Coeff (triangleEdges 189).2.2 j = if j = 189 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_190 : ∀ j : Fin 270, + h1Coeff (triangleEdges 190).1 j - h1Coeff (triangleEdges 190).2.1 j + + h1Coeff (triangleEdges 190).2.2 j = if j = 190 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_191 : ∀ j : Fin 270, + h1Coeff (triangleEdges 191).1 j - h1Coeff (triangleEdges 191).2.1 j + + h1Coeff (triangleEdges 191).2.2 j = if j = 191 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_192 : ∀ j : Fin 270, + h1Coeff (triangleEdges 192).1 j - h1Coeff (triangleEdges 192).2.1 j + + h1Coeff (triangleEdges 192).2.2 j = if j = 192 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_193 : ∀ j : Fin 270, + h1Coeff (triangleEdges 193).1 j - h1Coeff (triangleEdges 193).2.1 j + + h1Coeff (triangleEdges 193).2.2 j = if j = 193 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_194 : ∀ j : Fin 270, + h1Coeff (triangleEdges 194).1 j - h1Coeff (triangleEdges 194).2.1 j + + h1Coeff (triangleEdges 194).2.2 j = if j = 194 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_195 : ∀ j : Fin 270, + h1Coeff (triangleEdges 195).1 j - h1Coeff (triangleEdges 195).2.1 j + + h1Coeff (triangleEdges 195).2.2 j = if j = 195 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_196 : ∀ j : Fin 270, + h1Coeff (triangleEdges 196).1 j - h1Coeff (triangleEdges 196).2.1 j + + h1Coeff (triangleEdges 196).2.2 j = if j = 196 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_197 : ∀ j : Fin 270, + h1Coeff (triangleEdges 197).1 j - h1Coeff (triangleEdges 197).2.1 j + + h1Coeff (triangleEdges 197).2.2 j = if j = 197 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_198 : ∀ j : Fin 270, + h1Coeff (triangleEdges 198).1 j - h1Coeff (triangleEdges 198).2.1 j + + h1Coeff (triangleEdges 198).2.2 j = if j = 198 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_199 : ∀ j : Fin 270, + h1Coeff (triangleEdges 199).1 j - h1Coeff (triangleEdges 199).2.1 j + + h1Coeff (triangleEdges 199).2.2 j = if j = 199 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_200 : ∀ j : Fin 270, + h1Coeff (triangleEdges 200).1 j - h1Coeff (triangleEdges 200).2.1 j + + h1Coeff (triangleEdges 200).2.2 j = if j = 200 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_201 : ∀ j : Fin 270, + h1Coeff (triangleEdges 201).1 j - h1Coeff (triangleEdges 201).2.1 j + + h1Coeff (triangleEdges 201).2.2 j = if j = 201 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_202 : ∀ j : Fin 270, + h1Coeff (triangleEdges 202).1 j - h1Coeff (triangleEdges 202).2.1 j + + h1Coeff (triangleEdges 202).2.2 j = if j = 202 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_203 : ∀ j : Fin 270, + h1Coeff (triangleEdges 203).1 j - h1Coeff (triangleEdges 203).2.1 j + + h1Coeff (triangleEdges 203).2.2 j = if j = 203 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_204 : ∀ j : Fin 270, + h1Coeff (triangleEdges 204).1 j - h1Coeff (triangleEdges 204).2.1 j + + h1Coeff (triangleEdges 204).2.2 j = if j = 204 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_205 : ∀ j : Fin 270, + h1Coeff (triangleEdges 205).1 j - h1Coeff (triangleEdges 205).2.1 j + + h1Coeff (triangleEdges 205).2.2 j = if j = 205 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_206 : ∀ j : Fin 270, + h1Coeff (triangleEdges 206).1 j - h1Coeff (triangleEdges 206).2.1 j + + h1Coeff (triangleEdges 206).2.2 j = if j = 206 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_207 : ∀ j : Fin 270, + h1Coeff (triangleEdges 207).1 j - h1Coeff (triangleEdges 207).2.1 j + + h1Coeff (triangleEdges 207).2.2 j = if j = 207 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_208 : ∀ j : Fin 270, + h1Coeff (triangleEdges 208).1 j - h1Coeff (triangleEdges 208).2.1 j + + h1Coeff (triangleEdges 208).2.2 j = if j = 208 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_209 : ∀ j : Fin 270, + h1Coeff (triangleEdges 209).1 j - h1Coeff (triangleEdges 209).2.1 j + + h1Coeff (triangleEdges 209).2.2 j = if j = 209 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_210 : ∀ j : Fin 270, + h1Coeff (triangleEdges 210).1 j - h1Coeff (triangleEdges 210).2.1 j + + h1Coeff (triangleEdges 210).2.2 j = if j = 210 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_211 : ∀ j : Fin 270, + h1Coeff (triangleEdges 211).1 j - h1Coeff (triangleEdges 211).2.1 j + + h1Coeff (triangleEdges 211).2.2 j = if j = 211 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_212 : ∀ j : Fin 270, + h1Coeff (triangleEdges 212).1 j - h1Coeff (triangleEdges 212).2.1 j + + h1Coeff (triangleEdges 212).2.2 j = if j = 212 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_213 : ∀ j : Fin 270, + h1Coeff (triangleEdges 213).1 j - h1Coeff (triangleEdges 213).2.1 j + + h1Coeff (triangleEdges 213).2.2 j = if j = 213 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_214 : ∀ j : Fin 270, + h1Coeff (triangleEdges 214).1 j - h1Coeff (triangleEdges 214).2.1 j + + h1Coeff (triangleEdges 214).2.2 j = if j = 214 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_215 : ∀ j : Fin 270, + h1Coeff (triangleEdges 215).1 j - h1Coeff (triangleEdges 215).2.1 j + + h1Coeff (triangleEdges 215).2.2 j = if j = 215 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_216 : ∀ j : Fin 270, + h1Coeff (triangleEdges 216).1 j - h1Coeff (triangleEdges 216).2.1 j + + h1Coeff (triangleEdges 216).2.2 j = if j = 216 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_217 : ∀ j : Fin 270, + h1Coeff (triangleEdges 217).1 j - h1Coeff (triangleEdges 217).2.1 j + + h1Coeff (triangleEdges 217).2.2 j = if j = 217 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_218 : ∀ j : Fin 270, + h1Coeff (triangleEdges 218).1 j - h1Coeff (triangleEdges 218).2.1 j + + h1Coeff (triangleEdges 218).2.2 j = if j = 218 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_219 : ∀ j : Fin 270, + h1Coeff (triangleEdges 219).1 j - h1Coeff (triangleEdges 219).2.1 j + + h1Coeff (triangleEdges 219).2.2 j = if j = 219 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_220 : ∀ j : Fin 270, + h1Coeff (triangleEdges 220).1 j - h1Coeff (triangleEdges 220).2.1 j + + h1Coeff (triangleEdges 220).2.2 j = if j = 220 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_221 : ∀ j : Fin 270, + h1Coeff (triangleEdges 221).1 j - h1Coeff (triangleEdges 221).2.1 j + + h1Coeff (triangleEdges 221).2.2 j = if j = 221 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_222 : ∀ j : Fin 270, + h1Coeff (triangleEdges 222).1 j - h1Coeff (triangleEdges 222).2.1 j + + h1Coeff (triangleEdges 222).2.2 j = if j = 222 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_223 : ∀ j : Fin 270, + h1Coeff (triangleEdges 223).1 j - h1Coeff (triangleEdges 223).2.1 j + + h1Coeff (triangleEdges 223).2.2 j = if j = 223 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_224 : ∀ j : Fin 270, + h1Coeff (triangleEdges 224).1 j - h1Coeff (triangleEdges 224).2.1 j + + h1Coeff (triangleEdges 224).2.2 j = if j = 224 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_225 : ∀ j : Fin 270, + h1Coeff (triangleEdges 225).1 j - h1Coeff (triangleEdges 225).2.1 j + + h1Coeff (triangleEdges 225).2.2 j = if j = 225 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_226 : ∀ j : Fin 270, + h1Coeff (triangleEdges 226).1 j - h1Coeff (triangleEdges 226).2.1 j + + h1Coeff (triangleEdges 226).2.2 j = if j = 226 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_227 : ∀ j : Fin 270, + h1Coeff (triangleEdges 227).1 j - h1Coeff (triangleEdges 227).2.1 j + + h1Coeff (triangleEdges 227).2.2 j = if j = 227 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_228 : ∀ j : Fin 270, + h1Coeff (triangleEdges 228).1 j - h1Coeff (triangleEdges 228).2.1 j + + h1Coeff (triangleEdges 228).2.2 j = if j = 228 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_229 : ∀ j : Fin 270, + h1Coeff (triangleEdges 229).1 j - h1Coeff (triangleEdges 229).2.1 j + + h1Coeff (triangleEdges 229).2.2 j = if j = 229 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_230 : ∀ j : Fin 270, + h1Coeff (triangleEdges 230).1 j - h1Coeff (triangleEdges 230).2.1 j + + h1Coeff (triangleEdges 230).2.2 j = if j = 230 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_231 : ∀ j : Fin 270, + h1Coeff (triangleEdges 231).1 j - h1Coeff (triangleEdges 231).2.1 j + + h1Coeff (triangleEdges 231).2.2 j = if j = 231 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_232 : ∀ j : Fin 270, + h1Coeff (triangleEdges 232).1 j - h1Coeff (triangleEdges 232).2.1 j + + h1Coeff (triangleEdges 232).2.2 j = if j = 232 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_233 : ∀ j : Fin 270, + h1Coeff (triangleEdges 233).1 j - h1Coeff (triangleEdges 233).2.1 j + + h1Coeff (triangleEdges 233).2.2 j = if j = 233 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_234 : ∀ j : Fin 270, + h1Coeff (triangleEdges 234).1 j - h1Coeff (triangleEdges 234).2.1 j + + h1Coeff (triangleEdges 234).2.2 j = if j = 234 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_235 : ∀ j : Fin 270, + h1Coeff (triangleEdges 235).1 j - h1Coeff (triangleEdges 235).2.1 j + + h1Coeff (triangleEdges 235).2.2 j = if j = 235 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_236 : ∀ j : Fin 270, + h1Coeff (triangleEdges 236).1 j - h1Coeff (triangleEdges 236).2.1 j + + h1Coeff (triangleEdges 236).2.2 j = if j = 236 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_237 : ∀ j : Fin 270, + h1Coeff (triangleEdges 237).1 j - h1Coeff (triangleEdges 237).2.1 j + + h1Coeff (triangleEdges 237).2.2 j = if j = 237 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_238 : ∀ j : Fin 270, + h1Coeff (triangleEdges 238).1 j - h1Coeff (triangleEdges 238).2.1 j + + h1Coeff (triangleEdges 238).2.2 j = if j = 238 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_239 : ∀ j : Fin 270, + h1Coeff (triangleEdges 239).1 j - h1Coeff (triangleEdges 239).2.1 j + + h1Coeff (triangleEdges 239).2.2 j = if j = 239 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_240 : ∀ j : Fin 270, + h1Coeff (triangleEdges 240).1 j - h1Coeff (triangleEdges 240).2.1 j + + h1Coeff (triangleEdges 240).2.2 j = if j = 240 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_241 : ∀ j : Fin 270, + h1Coeff (triangleEdges 241).1 j - h1Coeff (triangleEdges 241).2.1 j + + h1Coeff (triangleEdges 241).2.2 j = if j = 241 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_242 : ∀ j : Fin 270, + h1Coeff (triangleEdges 242).1 j - h1Coeff (triangleEdges 242).2.1 j + + h1Coeff (triangleEdges 242).2.2 j = if j = 242 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_243 : ∀ j : Fin 270, + h1Coeff (triangleEdges 243).1 j - h1Coeff (triangleEdges 243).2.1 j + + h1Coeff (triangleEdges 243).2.2 j = if j = 243 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_244 : ∀ j : Fin 270, + h1Coeff (triangleEdges 244).1 j - h1Coeff (triangleEdges 244).2.1 j + + h1Coeff (triangleEdges 244).2.2 j = if j = 244 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_245 : ∀ j : Fin 270, + h1Coeff (triangleEdges 245).1 j - h1Coeff (triangleEdges 245).2.1 j + + h1Coeff (triangleEdges 245).2.2 j = if j = 245 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_246 : ∀ j : Fin 270, + h1Coeff (triangleEdges 246).1 j - h1Coeff (triangleEdges 246).2.1 j + + h1Coeff (triangleEdges 246).2.2 j = if j = 246 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_247 : ∀ j : Fin 270, + h1Coeff (triangleEdges 247).1 j - h1Coeff (triangleEdges 247).2.1 j + + h1Coeff (triangleEdges 247).2.2 j = if j = 247 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_248 : ∀ j : Fin 270, + h1Coeff (triangleEdges 248).1 j - h1Coeff (triangleEdges 248).2.1 j + + h1Coeff (triangleEdges 248).2.2 j = if j = 248 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_249 : ∀ j : Fin 270, + h1Coeff (triangleEdges 249).1 j - h1Coeff (triangleEdges 249).2.1 j + + h1Coeff (triangleEdges 249).2.2 j = if j = 249 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_250 : ∀ j : Fin 270, + h1Coeff (triangleEdges 250).1 j - h1Coeff (triangleEdges 250).2.1 j + + h1Coeff (triangleEdges 250).2.2 j = if j = 250 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_251 : ∀ j : Fin 270, + h1Coeff (triangleEdges 251).1 j - h1Coeff (triangleEdges 251).2.1 j + + h1Coeff (triangleEdges 251).2.2 j = if j = 251 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_252 : ∀ j : Fin 270, + h1Coeff (triangleEdges 252).1 j - h1Coeff (triangleEdges 252).2.1 j + + h1Coeff (triangleEdges 252).2.2 j = if j = 252 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_253 : ∀ j : Fin 270, + h1Coeff (triangleEdges 253).1 j - h1Coeff (triangleEdges 253).2.1 j + + h1Coeff (triangleEdges 253).2.2 j = if j = 253 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_254 : ∀ j : Fin 270, + h1Coeff (triangleEdges 254).1 j - h1Coeff (triangleEdges 254).2.1 j + + h1Coeff (triangleEdges 254).2.2 j = if j = 254 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_255 : ∀ j : Fin 270, + h1Coeff (triangleEdges 255).1 j - h1Coeff (triangleEdges 255).2.1 j + + h1Coeff (triangleEdges 255).2.2 j = if j = 255 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_256 : ∀ j : Fin 270, + h1Coeff (triangleEdges 256).1 j - h1Coeff (triangleEdges 256).2.1 j + + h1Coeff (triangleEdges 256).2.2 j = if j = 256 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_257 : ∀ j : Fin 270, + h1Coeff (triangleEdges 257).1 j - h1Coeff (triangleEdges 257).2.1 j + + h1Coeff (triangleEdges 257).2.2 j = if j = 257 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_258 : ∀ j : Fin 270, + h1Coeff (triangleEdges 258).1 j - h1Coeff (triangleEdges 258).2.1 j + + h1Coeff (triangleEdges 258).2.2 j = if j = 258 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_259 : ∀ j : Fin 270, + h1Coeff (triangleEdges 259).1 j - h1Coeff (triangleEdges 259).2.1 j + + h1Coeff (triangleEdges 259).2.2 j = if j = 259 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_260 : ∀ j : Fin 270, + h1Coeff (triangleEdges 260).1 j - h1Coeff (triangleEdges 260).2.1 j + + h1Coeff (triangleEdges 260).2.2 j = if j = 260 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_261 : ∀ j : Fin 270, + h1Coeff (triangleEdges 261).1 j - h1Coeff (triangleEdges 261).2.1 j + + h1Coeff (triangleEdges 261).2.2 j = if j = 261 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_262 : ∀ j : Fin 270, + h1Coeff (triangleEdges 262).1 j - h1Coeff (triangleEdges 262).2.1 j + + h1Coeff (triangleEdges 262).2.2 j = if j = 262 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_263 : ∀ j : Fin 270, + h1Coeff (triangleEdges 263).1 j - h1Coeff (triangleEdges 263).2.1 j + + h1Coeff (triangleEdges 263).2.2 j = if j = 263 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_264 : ∀ j : Fin 270, + h1Coeff (triangleEdges 264).1 j - h1Coeff (triangleEdges 264).2.1 j + + h1Coeff (triangleEdges 264).2.2 j = if j = 264 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_265 : ∀ j : Fin 270, + h1Coeff (triangleEdges 265).1 j - h1Coeff (triangleEdges 265).2.1 j + + h1Coeff (triangleEdges 265).2.2 j = if j = 265 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_266 : ∀ j : Fin 270, + h1Coeff (triangleEdges 266).1 j - h1Coeff (triangleEdges 266).2.1 j + + h1Coeff (triangleEdges 266).2.2 j = if j = 266 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_267 : ∀ j : Fin 270, + h1Coeff (triangleEdges 267).1 j - h1Coeff (triangleEdges 267).2.1 j + + h1Coeff (triangleEdges 267).2.2 j = if j = 267 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_268 : ∀ j : Fin 270, + h1Coeff (triangleEdges 268).1 j - h1Coeff (triangleEdges 268).2.1 j + + h1Coeff (triangleEdges 268).2.2 j = if j = 268 then 1 else 0 := by decide +kernel + +theorem h1_boundary_cert_269 : ∀ j : Fin 270, + h1Coeff (triangleEdges 269).1 j - h1Coeff (triangleEdges 269).2.1 j + + h1Coeff (triangleEdges 269).2.2 j = if j = 269 then 1 else 0 := by decide +kernel + +theorem d1_basis_cert_0 : ∀ e : Fin 372, + rowEval (d1Row 0) (fun j => if j = e then 1 else 0) = + (if 0 = (edge e).2 then 1 else 0) - + (if 0 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_1 : ∀ e : Fin 372, + rowEval (d1Row 1) (fun j => if j = e then 1 else 0) = + (if 1 = (edge e).2 then 1 else 0) - + (if 1 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_2 : ∀ e : Fin 372, + rowEval (d1Row 2) (fun j => if j = e then 1 else 0) = + (if 2 = (edge e).2 then 1 else 0) - + (if 2 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_3 : ∀ e : Fin 372, + rowEval (d1Row 3) (fun j => if j = e then 1 else 0) = + (if 3 = (edge e).2 then 1 else 0) - + (if 3 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_4 : ∀ e : Fin 372, + rowEval (d1Row 4) (fun j => if j = e then 1 else 0) = + (if 4 = (edge e).2 then 1 else 0) - + (if 4 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_5 : ∀ e : Fin 372, + rowEval (d1Row 5) (fun j => if j = e then 1 else 0) = + (if 5 = (edge e).2 then 1 else 0) - + (if 5 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_6 : ∀ e : Fin 372, + rowEval (d1Row 6) (fun j => if j = e then 1 else 0) = + (if 6 = (edge e).2 then 1 else 0) - + (if 6 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_7 : ∀ e : Fin 372, + rowEval (d1Row 7) (fun j => if j = e then 1 else 0) = + (if 7 = (edge e).2 then 1 else 0) - + (if 7 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_8 : ∀ e : Fin 372, + rowEval (d1Row 8) (fun j => if j = e then 1 else 0) = + (if 8 = (edge e).2 then 1 else 0) - + (if 8 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_9 : ∀ e : Fin 372, + rowEval (d1Row 9) (fun j => if j = e then 1 else 0) = + (if 9 = (edge e).2 then 1 else 0) - + (if 9 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_10 : ∀ e : Fin 372, + rowEval (d1Row 10) (fun j => if j = e then 1 else 0) = + (if 10 = (edge e).2 then 1 else 0) - + (if 10 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_11 : ∀ e : Fin 372, + rowEval (d1Row 11) (fun j => if j = e then 1 else 0) = + (if 11 = (edge e).2 then 1 else 0) - + (if 11 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_12 : ∀ e : Fin 372, + rowEval (d1Row 12) (fun j => if j = e then 1 else 0) = + (if 12 = (edge e).2 then 1 else 0) - + (if 12 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_13 : ∀ e : Fin 372, + rowEval (d1Row 13) (fun j => if j = e then 1 else 0) = + (if 13 = (edge e).2 then 1 else 0) - + (if 13 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_14 : ∀ e : Fin 372, + rowEval (d1Row 14) (fun j => if j = e then 1 else 0) = + (if 14 = (edge e).2 then 1 else 0) - + (if 14 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_15 : ∀ e : Fin 372, + rowEval (d1Row 15) (fun j => if j = e then 1 else 0) = + (if 15 = (edge e).2 then 1 else 0) - + (if 15 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_16 : ∀ e : Fin 372, + rowEval (d1Row 16) (fun j => if j = e then 1 else 0) = + (if 16 = (edge e).2 then 1 else 0) - + (if 16 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_17 : ∀ e : Fin 372, + rowEval (d1Row 17) (fun j => if j = e then 1 else 0) = + (if 17 = (edge e).2 then 1 else 0) - + (if 17 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_18 : ∀ e : Fin 372, + rowEval (d1Row 18) (fun j => if j = e then 1 else 0) = + (if 18 = (edge e).2 then 1 else 0) - + (if 18 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_19 : ∀ e : Fin 372, + rowEval (d1Row 19) (fun j => if j = e then 1 else 0) = + (if 19 = (edge e).2 then 1 else 0) - + (if 19 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_20 : ∀ e : Fin 372, + rowEval (d1Row 20) (fun j => if j = e then 1 else 0) = + (if 20 = (edge e).2 then 1 else 0) - + (if 20 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_21 : ∀ e : Fin 372, + rowEval (d1Row 21) (fun j => if j = e then 1 else 0) = + (if 21 = (edge e).2 then 1 else 0) - + (if 21 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_22 : ∀ e : Fin 372, + rowEval (d1Row 22) (fun j => if j = e then 1 else 0) = + (if 22 = (edge e).2 then 1 else 0) - + (if 22 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_23 : ∀ e : Fin 372, + rowEval (d1Row 23) (fun j => if j = e then 1 else 0) = + (if 23 = (edge e).2 then 1 else 0) - + (if 23 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_24 : ∀ e : Fin 372, + rowEval (d1Row 24) (fun j => if j = e then 1 else 0) = + (if 24 = (edge e).2 then 1 else 0) - + (if 24 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_25 : ∀ e : Fin 372, + rowEval (d1Row 25) (fun j => if j = e then 1 else 0) = + (if 25 = (edge e).2 then 1 else 0) - + (if 25 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_26 : ∀ e : Fin 372, + rowEval (d1Row 26) (fun j => if j = e then 1 else 0) = + (if 26 = (edge e).2 then 1 else 0) - + (if 26 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_27 : ∀ e : Fin 372, + rowEval (d1Row 27) (fun j => if j = e then 1 else 0) = + (if 27 = (edge e).2 then 1 else 0) - + (if 27 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_28 : ∀ e : Fin 372, + rowEval (d1Row 28) (fun j => if j = e then 1 else 0) = + (if 28 = (edge e).2 then 1 else 0) - + (if 28 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_29 : ∀ e : Fin 372, + rowEval (d1Row 29) (fun j => if j = e then 1 else 0) = + (if 29 = (edge e).2 then 1 else 0) - + (if 29 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_30 : ∀ e : Fin 372, + rowEval (d1Row 30) (fun j => if j = e then 1 else 0) = + (if 30 = (edge e).2 then 1 else 0) - + (if 30 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_31 : ∀ e : Fin 372, + rowEval (d1Row 31) (fun j => if j = e then 1 else 0) = + (if 31 = (edge e).2 then 1 else 0) - + (if 31 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_32 : ∀ e : Fin 372, + rowEval (d1Row 32) (fun j => if j = e then 1 else 0) = + (if 32 = (edge e).2 then 1 else 0) - + (if 32 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_33 : ∀ e : Fin 372, + rowEval (d1Row 33) (fun j => if j = e then 1 else 0) = + (if 33 = (edge e).2 then 1 else 0) - + (if 33 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_34 : ∀ e : Fin 372, + rowEval (d1Row 34) (fun j => if j = e then 1 else 0) = + (if 34 = (edge e).2 then 1 else 0) - + (if 34 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_35 : ∀ e : Fin 372, + rowEval (d1Row 35) (fun j => if j = e then 1 else 0) = + (if 35 = (edge e).2 then 1 else 0) - + (if 35 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_36 : ∀ e : Fin 372, + rowEval (d1Row 36) (fun j => if j = e then 1 else 0) = + (if 36 = (edge e).2 then 1 else 0) - + (if 36 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_37 : ∀ e : Fin 372, + rowEval (d1Row 37) (fun j => if j = e then 1 else 0) = + (if 37 = (edge e).2 then 1 else 0) - + (if 37 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_38 : ∀ e : Fin 372, + rowEval (d1Row 38) (fun j => if j = e then 1 else 0) = + (if 38 = (edge e).2 then 1 else 0) - + (if 38 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_39 : ∀ e : Fin 372, + rowEval (d1Row 39) (fun j => if j = e then 1 else 0) = + (if 39 = (edge e).2 then 1 else 0) - + (if 39 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_40 : ∀ e : Fin 372, + rowEval (d1Row 40) (fun j => if j = e then 1 else 0) = + (if 40 = (edge e).2 then 1 else 0) - + (if 40 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_41 : ∀ e : Fin 372, + rowEval (d1Row 41) (fun j => if j = e then 1 else 0) = + (if 41 = (edge e).2 then 1 else 0) - + (if 41 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_42 : ∀ e : Fin 372, + rowEval (d1Row 42) (fun j => if j = e then 1 else 0) = + (if 42 = (edge e).2 then 1 else 0) - + (if 42 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_43 : ∀ e : Fin 372, + rowEval (d1Row 43) (fun j => if j = e then 1 else 0) = + (if 43 = (edge e).2 then 1 else 0) - + (if 43 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_44 : ∀ e : Fin 372, + rowEval (d1Row 44) (fun j => if j = e then 1 else 0) = + (if 44 = (edge e).2 then 1 else 0) - + (if 44 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_45 : ∀ e : Fin 372, + rowEval (d1Row 45) (fun j => if j = e then 1 else 0) = + (if 45 = (edge e).2 then 1 else 0) - + (if 45 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_46 : ∀ e : Fin 372, + rowEval (d1Row 46) (fun j => if j = e then 1 else 0) = + (if 46 = (edge e).2 then 1 else 0) - + (if 46 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_47 : ∀ e : Fin 372, + rowEval (d1Row 47) (fun j => if j = e then 1 else 0) = + (if 47 = (edge e).2 then 1 else 0) - + (if 47 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_48 : ∀ e : Fin 372, + rowEval (d1Row 48) (fun j => if j = e then 1 else 0) = + (if 48 = (edge e).2 then 1 else 0) - + (if 48 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_49 : ∀ e : Fin 372, + rowEval (d1Row 49) (fun j => if j = e then 1 else 0) = + (if 49 = (edge e).2 then 1 else 0) - + (if 49 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_50 : ∀ e : Fin 372, + rowEval (d1Row 50) (fun j => if j = e then 1 else 0) = + (if 50 = (edge e).2 then 1 else 0) - + (if 50 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_51 : ∀ e : Fin 372, + rowEval (d1Row 51) (fun j => if j = e then 1 else 0) = + (if 51 = (edge e).2 then 1 else 0) - + (if 51 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_52 : ∀ e : Fin 372, + rowEval (d1Row 52) (fun j => if j = e then 1 else 0) = + (if 52 = (edge e).2 then 1 else 0) - + (if 52 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_53 : ∀ e : Fin 372, + rowEval (d1Row 53) (fun j => if j = e then 1 else 0) = + (if 53 = (edge e).2 then 1 else 0) - + (if 53 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_54 : ∀ e : Fin 372, + rowEval (d1Row 54) (fun j => if j = e then 1 else 0) = + (if 54 = (edge e).2 then 1 else 0) - + (if 54 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_55 : ∀ e : Fin 372, + rowEval (d1Row 55) (fun j => if j = e then 1 else 0) = + (if 55 = (edge e).2 then 1 else 0) - + (if 55 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_56 : ∀ e : Fin 372, + rowEval (d1Row 56) (fun j => if j = e then 1 else 0) = + (if 56 = (edge e).2 then 1 else 0) - + (if 56 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_57 : ∀ e : Fin 372, + rowEval (d1Row 57) (fun j => if j = e then 1 else 0) = + (if 57 = (edge e).2 then 1 else 0) - + (if 57 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_58 : ∀ e : Fin 372, + rowEval (d1Row 58) (fun j => if j = e then 1 else 0) = + (if 58 = (edge e).2 then 1 else 0) - + (if 58 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_59 : ∀ e : Fin 372, + rowEval (d1Row 59) (fun j => if j = e then 1 else 0) = + (if 59 = (edge e).2 then 1 else 0) - + (if 59 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_60 : ∀ e : Fin 372, + rowEval (d1Row 60) (fun j => if j = e then 1 else 0) = + (if 60 = (edge e).2 then 1 else 0) - + (if 60 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_61 : ∀ e : Fin 372, + rowEval (d1Row 61) (fun j => if j = e then 1 else 0) = + (if 61 = (edge e).2 then 1 else 0) - + (if 61 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_62 : ∀ e : Fin 372, + rowEval (d1Row 62) (fun j => if j = e then 1 else 0) = + (if 62 = (edge e).2 then 1 else 0) - + (if 62 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_63 : ∀ e : Fin 372, + rowEval (d1Row 63) (fun j => if j = e then 1 else 0) = + (if 63 = (edge e).2 then 1 else 0) - + (if 63 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_64 : ∀ e : Fin 372, + rowEval (d1Row 64) (fun j => if j = e then 1 else 0) = + (if 64 = (edge e).2 then 1 else 0) - + (if 64 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_65 : ∀ e : Fin 372, + rowEval (d1Row 65) (fun j => if j = e then 1 else 0) = + (if 65 = (edge e).2 then 1 else 0) - + (if 65 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_66 : ∀ e : Fin 372, + rowEval (d1Row 66) (fun j => if j = e then 1 else 0) = + (if 66 = (edge e).2 then 1 else 0) - + (if 66 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_67 : ∀ e : Fin 372, + rowEval (d1Row 67) (fun j => if j = e then 1 else 0) = + (if 67 = (edge e).2 then 1 else 0) - + (if 67 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_68 : ∀ e : Fin 372, + rowEval (d1Row 68) (fun j => if j = e then 1 else 0) = + (if 68 = (edge e).2 then 1 else 0) - + (if 68 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_69 : ∀ e : Fin 372, + rowEval (d1Row 69) (fun j => if j = e then 1 else 0) = + (if 69 = (edge e).2 then 1 else 0) - + (if 69 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_70 : ∀ e : Fin 372, + rowEval (d1Row 70) (fun j => if j = e then 1 else 0) = + (if 70 = (edge e).2 then 1 else 0) - + (if 70 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_71 : ∀ e : Fin 372, + rowEval (d1Row 71) (fun j => if j = e then 1 else 0) = + (if 71 = (edge e).2 then 1 else 0) - + (if 71 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_72 : ∀ e : Fin 372, + rowEval (d1Row 72) (fun j => if j = e then 1 else 0) = + (if 72 = (edge e).2 then 1 else 0) - + (if 72 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_73 : ∀ e : Fin 372, + rowEval (d1Row 73) (fun j => if j = e then 1 else 0) = + (if 73 = (edge e).2 then 1 else 0) - + (if 73 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_74 : ∀ e : Fin 372, + rowEval (d1Row 74) (fun j => if j = e then 1 else 0) = + (if 74 = (edge e).2 then 1 else 0) - + (if 74 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_75 : ∀ e : Fin 372, + rowEval (d1Row 75) (fun j => if j = e then 1 else 0) = + (if 75 = (edge e).2 then 1 else 0) - + (if 75 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_76 : ∀ e : Fin 372, + rowEval (d1Row 76) (fun j => if j = e then 1 else 0) = + (if 76 = (edge e).2 then 1 else 0) - + (if 76 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_77 : ∀ e : Fin 372, + rowEval (d1Row 77) (fun j => if j = e then 1 else 0) = + (if 77 = (edge e).2 then 1 else 0) - + (if 77 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_78 : ∀ e : Fin 372, + rowEval (d1Row 78) (fun j => if j = e then 1 else 0) = + (if 78 = (edge e).2 then 1 else 0) - + (if 78 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_79 : ∀ e : Fin 372, + rowEval (d1Row 79) (fun j => if j = e then 1 else 0) = + (if 79 = (edge e).2 then 1 else 0) - + (if 79 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_80 : ∀ e : Fin 372, + rowEval (d1Row 80) (fun j => if j = e then 1 else 0) = + (if 80 = (edge e).2 then 1 else 0) - + (if 80 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_81 : ∀ e : Fin 372, + rowEval (d1Row 81) (fun j => if j = e then 1 else 0) = + (if 81 = (edge e).2 then 1 else 0) - + (if 81 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_82 : ∀ e : Fin 372, + rowEval (d1Row 82) (fun j => if j = e then 1 else 0) = + (if 82 = (edge e).2 then 1 else 0) - + (if 82 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_83 : ∀ e : Fin 372, + rowEval (d1Row 83) (fun j => if j = e then 1 else 0) = + (if 83 = (edge e).2 then 1 else 0) - + (if 83 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_84 : ∀ e : Fin 372, + rowEval (d1Row 84) (fun j => if j = e then 1 else 0) = + (if 84 = (edge e).2 then 1 else 0) - + (if 84 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_85 : ∀ e : Fin 372, + rowEval (d1Row 85) (fun j => if j = e then 1 else 0) = + (if 85 = (edge e).2 then 1 else 0) - + (if 85 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_86 : ∀ e : Fin 372, + rowEval (d1Row 86) (fun j => if j = e then 1 else 0) = + (if 86 = (edge e).2 then 1 else 0) - + (if 86 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_87 : ∀ e : Fin 372, + rowEval (d1Row 87) (fun j => if j = e then 1 else 0) = + (if 87 = (edge e).2 then 1 else 0) - + (if 87 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_88 : ∀ e : Fin 372, + rowEval (d1Row 88) (fun j => if j = e then 1 else 0) = + (if 88 = (edge e).2 then 1 else 0) - + (if 88 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_89 : ∀ e : Fin 372, + rowEval (d1Row 89) (fun j => if j = e then 1 else 0) = + (if 89 = (edge e).2 then 1 else 0) - + (if 89 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_90 : ∀ e : Fin 372, + rowEval (d1Row 90) (fun j => if j = e then 1 else 0) = + (if 90 = (edge e).2 then 1 else 0) - + (if 90 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_91 : ∀ e : Fin 372, + rowEval (d1Row 91) (fun j => if j = e then 1 else 0) = + (if 91 = (edge e).2 then 1 else 0) - + (if 91 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_92 : ∀ e : Fin 372, + rowEval (d1Row 92) (fun j => if j = e then 1 else 0) = + (if 92 = (edge e).2 then 1 else 0) - + (if 92 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_93 : ∀ e : Fin 372, + rowEval (d1Row 93) (fun j => if j = e then 1 else 0) = + (if 93 = (edge e).2 then 1 else 0) - + (if 93 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_94 : ∀ e : Fin 372, + rowEval (d1Row 94) (fun j => if j = e then 1 else 0) = + (if 94 = (edge e).2 then 1 else 0) - + (if 94 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_95 : ∀ e : Fin 372, + rowEval (d1Row 95) (fun j => if j = e then 1 else 0) = + (if 95 = (edge e).2 then 1 else 0) - + (if 95 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_96 : ∀ e : Fin 372, + rowEval (d1Row 96) (fun j => if j = e then 1 else 0) = + (if 96 = (edge e).2 then 1 else 0) - + (if 96 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_97 : ∀ e : Fin 372, + rowEval (d1Row 97) (fun j => if j = e then 1 else 0) = + (if 97 = (edge e).2 then 1 else 0) - + (if 97 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_98 : ∀ e : Fin 372, + rowEval (d1Row 98) (fun j => if j = e then 1 else 0) = + (if 98 = (edge e).2 then 1 else 0) - + (if 98 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_99 : ∀ e : Fin 372, + rowEval (d1Row 99) (fun j => if j = e then 1 else 0) = + (if 99 = (edge e).2 then 1 else 0) - + (if 99 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_100 : ∀ e : Fin 372, + rowEval (d1Row 100) (fun j => if j = e then 1 else 0) = + (if 100 = (edge e).2 then 1 else 0) - + (if 100 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_101 : ∀ e : Fin 372, + rowEval (d1Row 101) (fun j => if j = e then 1 else 0) = + (if 101 = (edge e).2 then 1 else 0) - + (if 101 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d1_basis_cert_102 : ∀ e : Fin 372, + rowEval (d1Row 102) (fun j => if j = e then 1 else 0) = + (if 102 = (edge e).2 then 1 else 0) - + (if 102 = (edge e).1 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_0 : ∀ t : Fin 270, + rowEval (d2Row 0) (fun j => if j = t then 1 else 0) = + (if 0 = (triangleEdges t).1 then 1 else 0) - + (if 0 = (triangleEdges t).2.1 then 1 else 0) + + (if 0 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_1 : ∀ t : Fin 270, + rowEval (d2Row 1) (fun j => if j = t then 1 else 0) = + (if 1 = (triangleEdges t).1 then 1 else 0) - + (if 1 = (triangleEdges t).2.1 then 1 else 0) + + (if 1 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_2 : ∀ t : Fin 270, + rowEval (d2Row 2) (fun j => if j = t then 1 else 0) = + (if 2 = (triangleEdges t).1 then 1 else 0) - + (if 2 = (triangleEdges t).2.1 then 1 else 0) + + (if 2 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_3 : ∀ t : Fin 270, + rowEval (d2Row 3) (fun j => if j = t then 1 else 0) = + (if 3 = (triangleEdges t).1 then 1 else 0) - + (if 3 = (triangleEdges t).2.1 then 1 else 0) + + (if 3 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_4 : ∀ t : Fin 270, + rowEval (d2Row 4) (fun j => if j = t then 1 else 0) = + (if 4 = (triangleEdges t).1 then 1 else 0) - + (if 4 = (triangleEdges t).2.1 then 1 else 0) + + (if 4 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_5 : ∀ t : Fin 270, + rowEval (d2Row 5) (fun j => if j = t then 1 else 0) = + (if 5 = (triangleEdges t).1 then 1 else 0) - + (if 5 = (triangleEdges t).2.1 then 1 else 0) + + (if 5 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_6 : ∀ t : Fin 270, + rowEval (d2Row 6) (fun j => if j = t then 1 else 0) = + (if 6 = (triangleEdges t).1 then 1 else 0) - + (if 6 = (triangleEdges t).2.1 then 1 else 0) + + (if 6 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_7 : ∀ t : Fin 270, + rowEval (d2Row 7) (fun j => if j = t then 1 else 0) = + (if 7 = (triangleEdges t).1 then 1 else 0) - + (if 7 = (triangleEdges t).2.1 then 1 else 0) + + (if 7 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_8 : ∀ t : Fin 270, + rowEval (d2Row 8) (fun j => if j = t then 1 else 0) = + (if 8 = (triangleEdges t).1 then 1 else 0) - + (if 8 = (triangleEdges t).2.1 then 1 else 0) + + (if 8 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_9 : ∀ t : Fin 270, + rowEval (d2Row 9) (fun j => if j = t then 1 else 0) = + (if 9 = (triangleEdges t).1 then 1 else 0) - + (if 9 = (triangleEdges t).2.1 then 1 else 0) + + (if 9 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_10 : ∀ t : Fin 270, + rowEval (d2Row 10) (fun j => if j = t then 1 else 0) = + (if 10 = (triangleEdges t).1 then 1 else 0) - + (if 10 = (triangleEdges t).2.1 then 1 else 0) + + (if 10 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_11 : ∀ t : Fin 270, + rowEval (d2Row 11) (fun j => if j = t then 1 else 0) = + (if 11 = (triangleEdges t).1 then 1 else 0) - + (if 11 = (triangleEdges t).2.1 then 1 else 0) + + (if 11 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_12 : ∀ t : Fin 270, + rowEval (d2Row 12) (fun j => if j = t then 1 else 0) = + (if 12 = (triangleEdges t).1 then 1 else 0) - + (if 12 = (triangleEdges t).2.1 then 1 else 0) + + (if 12 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_13 : ∀ t : Fin 270, + rowEval (d2Row 13) (fun j => if j = t then 1 else 0) = + (if 13 = (triangleEdges t).1 then 1 else 0) - + (if 13 = (triangleEdges t).2.1 then 1 else 0) + + (if 13 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_14 : ∀ t : Fin 270, + rowEval (d2Row 14) (fun j => if j = t then 1 else 0) = + (if 14 = (triangleEdges t).1 then 1 else 0) - + (if 14 = (triangleEdges t).2.1 then 1 else 0) + + (if 14 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_15 : ∀ t : Fin 270, + rowEval (d2Row 15) (fun j => if j = t then 1 else 0) = + (if 15 = (triangleEdges t).1 then 1 else 0) - + (if 15 = (triangleEdges t).2.1 then 1 else 0) + + (if 15 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_16 : ∀ t : Fin 270, + rowEval (d2Row 16) (fun j => if j = t then 1 else 0) = + (if 16 = (triangleEdges t).1 then 1 else 0) - + (if 16 = (triangleEdges t).2.1 then 1 else 0) + + (if 16 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_17 : ∀ t : Fin 270, + rowEval (d2Row 17) (fun j => if j = t then 1 else 0) = + (if 17 = (triangleEdges t).1 then 1 else 0) - + (if 17 = (triangleEdges t).2.1 then 1 else 0) + + (if 17 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_18 : ∀ t : Fin 270, + rowEval (d2Row 18) (fun j => if j = t then 1 else 0) = + (if 18 = (triangleEdges t).1 then 1 else 0) - + (if 18 = (triangleEdges t).2.1 then 1 else 0) + + (if 18 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_19 : ∀ t : Fin 270, + rowEval (d2Row 19) (fun j => if j = t then 1 else 0) = + (if 19 = (triangleEdges t).1 then 1 else 0) - + (if 19 = (triangleEdges t).2.1 then 1 else 0) + + (if 19 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_20 : ∀ t : Fin 270, + rowEval (d2Row 20) (fun j => if j = t then 1 else 0) = + (if 20 = (triangleEdges t).1 then 1 else 0) - + (if 20 = (triangleEdges t).2.1 then 1 else 0) + + (if 20 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_21 : ∀ t : Fin 270, + rowEval (d2Row 21) (fun j => if j = t then 1 else 0) = + (if 21 = (triangleEdges t).1 then 1 else 0) - + (if 21 = (triangleEdges t).2.1 then 1 else 0) + + (if 21 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_22 : ∀ t : Fin 270, + rowEval (d2Row 22) (fun j => if j = t then 1 else 0) = + (if 22 = (triangleEdges t).1 then 1 else 0) - + (if 22 = (triangleEdges t).2.1 then 1 else 0) + + (if 22 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_23 : ∀ t : Fin 270, + rowEval (d2Row 23) (fun j => if j = t then 1 else 0) = + (if 23 = (triangleEdges t).1 then 1 else 0) - + (if 23 = (triangleEdges t).2.1 then 1 else 0) + + (if 23 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_24 : ∀ t : Fin 270, + rowEval (d2Row 24) (fun j => if j = t then 1 else 0) = + (if 24 = (triangleEdges t).1 then 1 else 0) - + (if 24 = (triangleEdges t).2.1 then 1 else 0) + + (if 24 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_25 : ∀ t : Fin 270, + rowEval (d2Row 25) (fun j => if j = t then 1 else 0) = + (if 25 = (triangleEdges t).1 then 1 else 0) - + (if 25 = (triangleEdges t).2.1 then 1 else 0) + + (if 25 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_26 : ∀ t : Fin 270, + rowEval (d2Row 26) (fun j => if j = t then 1 else 0) = + (if 26 = (triangleEdges t).1 then 1 else 0) - + (if 26 = (triangleEdges t).2.1 then 1 else 0) + + (if 26 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_27 : ∀ t : Fin 270, + rowEval (d2Row 27) (fun j => if j = t then 1 else 0) = + (if 27 = (triangleEdges t).1 then 1 else 0) - + (if 27 = (triangleEdges t).2.1 then 1 else 0) + + (if 27 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_28 : ∀ t : Fin 270, + rowEval (d2Row 28) (fun j => if j = t then 1 else 0) = + (if 28 = (triangleEdges t).1 then 1 else 0) - + (if 28 = (triangleEdges t).2.1 then 1 else 0) + + (if 28 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_29 : ∀ t : Fin 270, + rowEval (d2Row 29) (fun j => if j = t then 1 else 0) = + (if 29 = (triangleEdges t).1 then 1 else 0) - + (if 29 = (triangleEdges t).2.1 then 1 else 0) + + (if 29 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_30 : ∀ t : Fin 270, + rowEval (d2Row 30) (fun j => if j = t then 1 else 0) = + (if 30 = (triangleEdges t).1 then 1 else 0) - + (if 30 = (triangleEdges t).2.1 then 1 else 0) + + (if 30 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_31 : ∀ t : Fin 270, + rowEval (d2Row 31) (fun j => if j = t then 1 else 0) = + (if 31 = (triangleEdges t).1 then 1 else 0) - + (if 31 = (triangleEdges t).2.1 then 1 else 0) + + (if 31 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_32 : ∀ t : Fin 270, + rowEval (d2Row 32) (fun j => if j = t then 1 else 0) = + (if 32 = (triangleEdges t).1 then 1 else 0) - + (if 32 = (triangleEdges t).2.1 then 1 else 0) + + (if 32 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_33 : ∀ t : Fin 270, + rowEval (d2Row 33) (fun j => if j = t then 1 else 0) = + (if 33 = (triangleEdges t).1 then 1 else 0) - + (if 33 = (triangleEdges t).2.1 then 1 else 0) + + (if 33 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_34 : ∀ t : Fin 270, + rowEval (d2Row 34) (fun j => if j = t then 1 else 0) = + (if 34 = (triangleEdges t).1 then 1 else 0) - + (if 34 = (triangleEdges t).2.1 then 1 else 0) + + (if 34 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_35 : ∀ t : Fin 270, + rowEval (d2Row 35) (fun j => if j = t then 1 else 0) = + (if 35 = (triangleEdges t).1 then 1 else 0) - + (if 35 = (triangleEdges t).2.1 then 1 else 0) + + (if 35 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_36 : ∀ t : Fin 270, + rowEval (d2Row 36) (fun j => if j = t then 1 else 0) = + (if 36 = (triangleEdges t).1 then 1 else 0) - + (if 36 = (triangleEdges t).2.1 then 1 else 0) + + (if 36 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_37 : ∀ t : Fin 270, + rowEval (d2Row 37) (fun j => if j = t then 1 else 0) = + (if 37 = (triangleEdges t).1 then 1 else 0) - + (if 37 = (triangleEdges t).2.1 then 1 else 0) + + (if 37 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_38 : ∀ t : Fin 270, + rowEval (d2Row 38) (fun j => if j = t then 1 else 0) = + (if 38 = (triangleEdges t).1 then 1 else 0) - + (if 38 = (triangleEdges t).2.1 then 1 else 0) + + (if 38 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_39 : ∀ t : Fin 270, + rowEval (d2Row 39) (fun j => if j = t then 1 else 0) = + (if 39 = (triangleEdges t).1 then 1 else 0) - + (if 39 = (triangleEdges t).2.1 then 1 else 0) + + (if 39 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_40 : ∀ t : Fin 270, + rowEval (d2Row 40) (fun j => if j = t then 1 else 0) = + (if 40 = (triangleEdges t).1 then 1 else 0) - + (if 40 = (triangleEdges t).2.1 then 1 else 0) + + (if 40 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_41 : ∀ t : Fin 270, + rowEval (d2Row 41) (fun j => if j = t then 1 else 0) = + (if 41 = (triangleEdges t).1 then 1 else 0) - + (if 41 = (triangleEdges t).2.1 then 1 else 0) + + (if 41 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_42 : ∀ t : Fin 270, + rowEval (d2Row 42) (fun j => if j = t then 1 else 0) = + (if 42 = (triangleEdges t).1 then 1 else 0) - + (if 42 = (triangleEdges t).2.1 then 1 else 0) + + (if 42 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_43 : ∀ t : Fin 270, + rowEval (d2Row 43) (fun j => if j = t then 1 else 0) = + (if 43 = (triangleEdges t).1 then 1 else 0) - + (if 43 = (triangleEdges t).2.1 then 1 else 0) + + (if 43 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_44 : ∀ t : Fin 270, + rowEval (d2Row 44) (fun j => if j = t then 1 else 0) = + (if 44 = (triangleEdges t).1 then 1 else 0) - + (if 44 = (triangleEdges t).2.1 then 1 else 0) + + (if 44 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_45 : ∀ t : Fin 270, + rowEval (d2Row 45) (fun j => if j = t then 1 else 0) = + (if 45 = (triangleEdges t).1 then 1 else 0) - + (if 45 = (triangleEdges t).2.1 then 1 else 0) + + (if 45 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_46 : ∀ t : Fin 270, + rowEval (d2Row 46) (fun j => if j = t then 1 else 0) = + (if 46 = (triangleEdges t).1 then 1 else 0) - + (if 46 = (triangleEdges t).2.1 then 1 else 0) + + (if 46 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_47 : ∀ t : Fin 270, + rowEval (d2Row 47) (fun j => if j = t then 1 else 0) = + (if 47 = (triangleEdges t).1 then 1 else 0) - + (if 47 = (triangleEdges t).2.1 then 1 else 0) + + (if 47 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_48 : ∀ t : Fin 270, + rowEval (d2Row 48) (fun j => if j = t then 1 else 0) = + (if 48 = (triangleEdges t).1 then 1 else 0) - + (if 48 = (triangleEdges t).2.1 then 1 else 0) + + (if 48 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_49 : ∀ t : Fin 270, + rowEval (d2Row 49) (fun j => if j = t then 1 else 0) = + (if 49 = (triangleEdges t).1 then 1 else 0) - + (if 49 = (triangleEdges t).2.1 then 1 else 0) + + (if 49 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_50 : ∀ t : Fin 270, + rowEval (d2Row 50) (fun j => if j = t then 1 else 0) = + (if 50 = (triangleEdges t).1 then 1 else 0) - + (if 50 = (triangleEdges t).2.1 then 1 else 0) + + (if 50 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_51 : ∀ t : Fin 270, + rowEval (d2Row 51) (fun j => if j = t then 1 else 0) = + (if 51 = (triangleEdges t).1 then 1 else 0) - + (if 51 = (triangleEdges t).2.1 then 1 else 0) + + (if 51 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_52 : ∀ t : Fin 270, + rowEval (d2Row 52) (fun j => if j = t then 1 else 0) = + (if 52 = (triangleEdges t).1 then 1 else 0) - + (if 52 = (triangleEdges t).2.1 then 1 else 0) + + (if 52 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_53 : ∀ t : Fin 270, + rowEval (d2Row 53) (fun j => if j = t then 1 else 0) = + (if 53 = (triangleEdges t).1 then 1 else 0) - + (if 53 = (triangleEdges t).2.1 then 1 else 0) + + (if 53 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_54 : ∀ t : Fin 270, + rowEval (d2Row 54) (fun j => if j = t then 1 else 0) = + (if 54 = (triangleEdges t).1 then 1 else 0) - + (if 54 = (triangleEdges t).2.1 then 1 else 0) + + (if 54 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_55 : ∀ t : Fin 270, + rowEval (d2Row 55) (fun j => if j = t then 1 else 0) = + (if 55 = (triangleEdges t).1 then 1 else 0) - + (if 55 = (triangleEdges t).2.1 then 1 else 0) + + (if 55 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_56 : ∀ t : Fin 270, + rowEval (d2Row 56) (fun j => if j = t then 1 else 0) = + (if 56 = (triangleEdges t).1 then 1 else 0) - + (if 56 = (triangleEdges t).2.1 then 1 else 0) + + (if 56 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_57 : ∀ t : Fin 270, + rowEval (d2Row 57) (fun j => if j = t then 1 else 0) = + (if 57 = (triangleEdges t).1 then 1 else 0) - + (if 57 = (triangleEdges t).2.1 then 1 else 0) + + (if 57 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_58 : ∀ t : Fin 270, + rowEval (d2Row 58) (fun j => if j = t then 1 else 0) = + (if 58 = (triangleEdges t).1 then 1 else 0) - + (if 58 = (triangleEdges t).2.1 then 1 else 0) + + (if 58 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_59 : ∀ t : Fin 270, + rowEval (d2Row 59) (fun j => if j = t then 1 else 0) = + (if 59 = (triangleEdges t).1 then 1 else 0) - + (if 59 = (triangleEdges t).2.1 then 1 else 0) + + (if 59 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_60 : ∀ t : Fin 270, + rowEval (d2Row 60) (fun j => if j = t then 1 else 0) = + (if 60 = (triangleEdges t).1 then 1 else 0) - + (if 60 = (triangleEdges t).2.1 then 1 else 0) + + (if 60 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_61 : ∀ t : Fin 270, + rowEval (d2Row 61) (fun j => if j = t then 1 else 0) = + (if 61 = (triangleEdges t).1 then 1 else 0) - + (if 61 = (triangleEdges t).2.1 then 1 else 0) + + (if 61 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_62 : ∀ t : Fin 270, + rowEval (d2Row 62) (fun j => if j = t then 1 else 0) = + (if 62 = (triangleEdges t).1 then 1 else 0) - + (if 62 = (triangleEdges t).2.1 then 1 else 0) + + (if 62 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_63 : ∀ t : Fin 270, + rowEval (d2Row 63) (fun j => if j = t then 1 else 0) = + (if 63 = (triangleEdges t).1 then 1 else 0) - + (if 63 = (triangleEdges t).2.1 then 1 else 0) + + (if 63 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_64 : ∀ t : Fin 270, + rowEval (d2Row 64) (fun j => if j = t then 1 else 0) = + (if 64 = (triangleEdges t).1 then 1 else 0) - + (if 64 = (triangleEdges t).2.1 then 1 else 0) + + (if 64 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_65 : ∀ t : Fin 270, + rowEval (d2Row 65) (fun j => if j = t then 1 else 0) = + (if 65 = (triangleEdges t).1 then 1 else 0) - + (if 65 = (triangleEdges t).2.1 then 1 else 0) + + (if 65 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_66 : ∀ t : Fin 270, + rowEval (d2Row 66) (fun j => if j = t then 1 else 0) = + (if 66 = (triangleEdges t).1 then 1 else 0) - + (if 66 = (triangleEdges t).2.1 then 1 else 0) + + (if 66 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_67 : ∀ t : Fin 270, + rowEval (d2Row 67) (fun j => if j = t then 1 else 0) = + (if 67 = (triangleEdges t).1 then 1 else 0) - + (if 67 = (triangleEdges t).2.1 then 1 else 0) + + (if 67 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_68 : ∀ t : Fin 270, + rowEval (d2Row 68) (fun j => if j = t then 1 else 0) = + (if 68 = (triangleEdges t).1 then 1 else 0) - + (if 68 = (triangleEdges t).2.1 then 1 else 0) + + (if 68 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_69 : ∀ t : Fin 270, + rowEval (d2Row 69) (fun j => if j = t then 1 else 0) = + (if 69 = (triangleEdges t).1 then 1 else 0) - + (if 69 = (triangleEdges t).2.1 then 1 else 0) + + (if 69 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_70 : ∀ t : Fin 270, + rowEval (d2Row 70) (fun j => if j = t then 1 else 0) = + (if 70 = (triangleEdges t).1 then 1 else 0) - + (if 70 = (triangleEdges t).2.1 then 1 else 0) + + (if 70 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_71 : ∀ t : Fin 270, + rowEval (d2Row 71) (fun j => if j = t then 1 else 0) = + (if 71 = (triangleEdges t).1 then 1 else 0) - + (if 71 = (triangleEdges t).2.1 then 1 else 0) + + (if 71 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_72 : ∀ t : Fin 270, + rowEval (d2Row 72) (fun j => if j = t then 1 else 0) = + (if 72 = (triangleEdges t).1 then 1 else 0) - + (if 72 = (triangleEdges t).2.1 then 1 else 0) + + (if 72 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_73 : ∀ t : Fin 270, + rowEval (d2Row 73) (fun j => if j = t then 1 else 0) = + (if 73 = (triangleEdges t).1 then 1 else 0) - + (if 73 = (triangleEdges t).2.1 then 1 else 0) + + (if 73 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_74 : ∀ t : Fin 270, + rowEval (d2Row 74) (fun j => if j = t then 1 else 0) = + (if 74 = (triangleEdges t).1 then 1 else 0) - + (if 74 = (triangleEdges t).2.1 then 1 else 0) + + (if 74 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_75 : ∀ t : Fin 270, + rowEval (d2Row 75) (fun j => if j = t then 1 else 0) = + (if 75 = (triangleEdges t).1 then 1 else 0) - + (if 75 = (triangleEdges t).2.1 then 1 else 0) + + (if 75 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_76 : ∀ t : Fin 270, + rowEval (d2Row 76) (fun j => if j = t then 1 else 0) = + (if 76 = (triangleEdges t).1 then 1 else 0) - + (if 76 = (triangleEdges t).2.1 then 1 else 0) + + (if 76 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_77 : ∀ t : Fin 270, + rowEval (d2Row 77) (fun j => if j = t then 1 else 0) = + (if 77 = (triangleEdges t).1 then 1 else 0) - + (if 77 = (triangleEdges t).2.1 then 1 else 0) + + (if 77 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_78 : ∀ t : Fin 270, + rowEval (d2Row 78) (fun j => if j = t then 1 else 0) = + (if 78 = (triangleEdges t).1 then 1 else 0) - + (if 78 = (triangleEdges t).2.1 then 1 else 0) + + (if 78 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_79 : ∀ t : Fin 270, + rowEval (d2Row 79) (fun j => if j = t then 1 else 0) = + (if 79 = (triangleEdges t).1 then 1 else 0) - + (if 79 = (triangleEdges t).2.1 then 1 else 0) + + (if 79 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_80 : ∀ t : Fin 270, + rowEval (d2Row 80) (fun j => if j = t then 1 else 0) = + (if 80 = (triangleEdges t).1 then 1 else 0) - + (if 80 = (triangleEdges t).2.1 then 1 else 0) + + (if 80 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_81 : ∀ t : Fin 270, + rowEval (d2Row 81) (fun j => if j = t then 1 else 0) = + (if 81 = (triangleEdges t).1 then 1 else 0) - + (if 81 = (triangleEdges t).2.1 then 1 else 0) + + (if 81 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_82 : ∀ t : Fin 270, + rowEval (d2Row 82) (fun j => if j = t then 1 else 0) = + (if 82 = (triangleEdges t).1 then 1 else 0) - + (if 82 = (triangleEdges t).2.1 then 1 else 0) + + (if 82 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_83 : ∀ t : Fin 270, + rowEval (d2Row 83) (fun j => if j = t then 1 else 0) = + (if 83 = (triangleEdges t).1 then 1 else 0) - + (if 83 = (triangleEdges t).2.1 then 1 else 0) + + (if 83 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_84 : ∀ t : Fin 270, + rowEval (d2Row 84) (fun j => if j = t then 1 else 0) = + (if 84 = (triangleEdges t).1 then 1 else 0) - + (if 84 = (triangleEdges t).2.1 then 1 else 0) + + (if 84 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_85 : ∀ t : Fin 270, + rowEval (d2Row 85) (fun j => if j = t then 1 else 0) = + (if 85 = (triangleEdges t).1 then 1 else 0) - + (if 85 = (triangleEdges t).2.1 then 1 else 0) + + (if 85 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_86 : ∀ t : Fin 270, + rowEval (d2Row 86) (fun j => if j = t then 1 else 0) = + (if 86 = (triangleEdges t).1 then 1 else 0) - + (if 86 = (triangleEdges t).2.1 then 1 else 0) + + (if 86 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_87 : ∀ t : Fin 270, + rowEval (d2Row 87) (fun j => if j = t then 1 else 0) = + (if 87 = (triangleEdges t).1 then 1 else 0) - + (if 87 = (triangleEdges t).2.1 then 1 else 0) + + (if 87 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_88 : ∀ t : Fin 270, + rowEval (d2Row 88) (fun j => if j = t then 1 else 0) = + (if 88 = (triangleEdges t).1 then 1 else 0) - + (if 88 = (triangleEdges t).2.1 then 1 else 0) + + (if 88 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_89 : ∀ t : Fin 270, + rowEval (d2Row 89) (fun j => if j = t then 1 else 0) = + (if 89 = (triangleEdges t).1 then 1 else 0) - + (if 89 = (triangleEdges t).2.1 then 1 else 0) + + (if 89 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_90 : ∀ t : Fin 270, + rowEval (d2Row 90) (fun j => if j = t then 1 else 0) = + (if 90 = (triangleEdges t).1 then 1 else 0) - + (if 90 = (triangleEdges t).2.1 then 1 else 0) + + (if 90 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_91 : ∀ t : Fin 270, + rowEval (d2Row 91) (fun j => if j = t then 1 else 0) = + (if 91 = (triangleEdges t).1 then 1 else 0) - + (if 91 = (triangleEdges t).2.1 then 1 else 0) + + (if 91 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_92 : ∀ t : Fin 270, + rowEval (d2Row 92) (fun j => if j = t then 1 else 0) = + (if 92 = (triangleEdges t).1 then 1 else 0) - + (if 92 = (triangleEdges t).2.1 then 1 else 0) + + (if 92 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_93 : ∀ t : Fin 270, + rowEval (d2Row 93) (fun j => if j = t then 1 else 0) = + (if 93 = (triangleEdges t).1 then 1 else 0) - + (if 93 = (triangleEdges t).2.1 then 1 else 0) + + (if 93 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_94 : ∀ t : Fin 270, + rowEval (d2Row 94) (fun j => if j = t then 1 else 0) = + (if 94 = (triangleEdges t).1 then 1 else 0) - + (if 94 = (triangleEdges t).2.1 then 1 else 0) + + (if 94 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_95 : ∀ t : Fin 270, + rowEval (d2Row 95) (fun j => if j = t then 1 else 0) = + (if 95 = (triangleEdges t).1 then 1 else 0) - + (if 95 = (triangleEdges t).2.1 then 1 else 0) + + (if 95 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_96 : ∀ t : Fin 270, + rowEval (d2Row 96) (fun j => if j = t then 1 else 0) = + (if 96 = (triangleEdges t).1 then 1 else 0) - + (if 96 = (triangleEdges t).2.1 then 1 else 0) + + (if 96 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_97 : ∀ t : Fin 270, + rowEval (d2Row 97) (fun j => if j = t then 1 else 0) = + (if 97 = (triangleEdges t).1 then 1 else 0) - + (if 97 = (triangleEdges t).2.1 then 1 else 0) + + (if 97 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_98 : ∀ t : Fin 270, + rowEval (d2Row 98) (fun j => if j = t then 1 else 0) = + (if 98 = (triangleEdges t).1 then 1 else 0) - + (if 98 = (triangleEdges t).2.1 then 1 else 0) + + (if 98 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_99 : ∀ t : Fin 270, + rowEval (d2Row 99) (fun j => if j = t then 1 else 0) = + (if 99 = (triangleEdges t).1 then 1 else 0) - + (if 99 = (triangleEdges t).2.1 then 1 else 0) + + (if 99 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_100 : ∀ t : Fin 270, + rowEval (d2Row 100) (fun j => if j = t then 1 else 0) = + (if 100 = (triangleEdges t).1 then 1 else 0) - + (if 100 = (triangleEdges t).2.1 then 1 else 0) + + (if 100 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_101 : ∀ t : Fin 270, + rowEval (d2Row 101) (fun j => if j = t then 1 else 0) = + (if 101 = (triangleEdges t).1 then 1 else 0) - + (if 101 = (triangleEdges t).2.1 then 1 else 0) + + (if 101 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_102 : ∀ t : Fin 270, + rowEval (d2Row 102) (fun j => if j = t then 1 else 0) = + (if 102 = (triangleEdges t).1 then 1 else 0) - + (if 102 = (triangleEdges t).2.1 then 1 else 0) + + (if 102 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_103 : ∀ t : Fin 270, + rowEval (d2Row 103) (fun j => if j = t then 1 else 0) = + (if 103 = (triangleEdges t).1 then 1 else 0) - + (if 103 = (triangleEdges t).2.1 then 1 else 0) + + (if 103 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_104 : ∀ t : Fin 270, + rowEval (d2Row 104) (fun j => if j = t then 1 else 0) = + (if 104 = (triangleEdges t).1 then 1 else 0) - + (if 104 = (triangleEdges t).2.1 then 1 else 0) + + (if 104 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_105 : ∀ t : Fin 270, + rowEval (d2Row 105) (fun j => if j = t then 1 else 0) = + (if 105 = (triangleEdges t).1 then 1 else 0) - + (if 105 = (triangleEdges t).2.1 then 1 else 0) + + (if 105 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_106 : ∀ t : Fin 270, + rowEval (d2Row 106) (fun j => if j = t then 1 else 0) = + (if 106 = (triangleEdges t).1 then 1 else 0) - + (if 106 = (triangleEdges t).2.1 then 1 else 0) + + (if 106 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_107 : ∀ t : Fin 270, + rowEval (d2Row 107) (fun j => if j = t then 1 else 0) = + (if 107 = (triangleEdges t).1 then 1 else 0) - + (if 107 = (triangleEdges t).2.1 then 1 else 0) + + (if 107 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_108 : ∀ t : Fin 270, + rowEval (d2Row 108) (fun j => if j = t then 1 else 0) = + (if 108 = (triangleEdges t).1 then 1 else 0) - + (if 108 = (triangleEdges t).2.1 then 1 else 0) + + (if 108 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_109 : ∀ t : Fin 270, + rowEval (d2Row 109) (fun j => if j = t then 1 else 0) = + (if 109 = (triangleEdges t).1 then 1 else 0) - + (if 109 = (triangleEdges t).2.1 then 1 else 0) + + (if 109 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_110 : ∀ t : Fin 270, + rowEval (d2Row 110) (fun j => if j = t then 1 else 0) = + (if 110 = (triangleEdges t).1 then 1 else 0) - + (if 110 = (triangleEdges t).2.1 then 1 else 0) + + (if 110 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_111 : ∀ t : Fin 270, + rowEval (d2Row 111) (fun j => if j = t then 1 else 0) = + (if 111 = (triangleEdges t).1 then 1 else 0) - + (if 111 = (triangleEdges t).2.1 then 1 else 0) + + (if 111 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_112 : ∀ t : Fin 270, + rowEval (d2Row 112) (fun j => if j = t then 1 else 0) = + (if 112 = (triangleEdges t).1 then 1 else 0) - + (if 112 = (triangleEdges t).2.1 then 1 else 0) + + (if 112 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_113 : ∀ t : Fin 270, + rowEval (d2Row 113) (fun j => if j = t then 1 else 0) = + (if 113 = (triangleEdges t).1 then 1 else 0) - + (if 113 = (triangleEdges t).2.1 then 1 else 0) + + (if 113 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_114 : ∀ t : Fin 270, + rowEval (d2Row 114) (fun j => if j = t then 1 else 0) = + (if 114 = (triangleEdges t).1 then 1 else 0) - + (if 114 = (triangleEdges t).2.1 then 1 else 0) + + (if 114 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_115 : ∀ t : Fin 270, + rowEval (d2Row 115) (fun j => if j = t then 1 else 0) = + (if 115 = (triangleEdges t).1 then 1 else 0) - + (if 115 = (triangleEdges t).2.1 then 1 else 0) + + (if 115 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_116 : ∀ t : Fin 270, + rowEval (d2Row 116) (fun j => if j = t then 1 else 0) = + (if 116 = (triangleEdges t).1 then 1 else 0) - + (if 116 = (triangleEdges t).2.1 then 1 else 0) + + (if 116 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_117 : ∀ t : Fin 270, + rowEval (d2Row 117) (fun j => if j = t then 1 else 0) = + (if 117 = (triangleEdges t).1 then 1 else 0) - + (if 117 = (triangleEdges t).2.1 then 1 else 0) + + (if 117 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_118 : ∀ t : Fin 270, + rowEval (d2Row 118) (fun j => if j = t then 1 else 0) = + (if 118 = (triangleEdges t).1 then 1 else 0) - + (if 118 = (triangleEdges t).2.1 then 1 else 0) + + (if 118 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_119 : ∀ t : Fin 270, + rowEval (d2Row 119) (fun j => if j = t then 1 else 0) = + (if 119 = (triangleEdges t).1 then 1 else 0) - + (if 119 = (triangleEdges t).2.1 then 1 else 0) + + (if 119 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_120 : ∀ t : Fin 270, + rowEval (d2Row 120) (fun j => if j = t then 1 else 0) = + (if 120 = (triangleEdges t).1 then 1 else 0) - + (if 120 = (triangleEdges t).2.1 then 1 else 0) + + (if 120 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_121 : ∀ t : Fin 270, + rowEval (d2Row 121) (fun j => if j = t then 1 else 0) = + (if 121 = (triangleEdges t).1 then 1 else 0) - + (if 121 = (triangleEdges t).2.1 then 1 else 0) + + (if 121 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_122 : ∀ t : Fin 270, + rowEval (d2Row 122) (fun j => if j = t then 1 else 0) = + (if 122 = (triangleEdges t).1 then 1 else 0) - + (if 122 = (triangleEdges t).2.1 then 1 else 0) + + (if 122 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_123 : ∀ t : Fin 270, + rowEval (d2Row 123) (fun j => if j = t then 1 else 0) = + (if 123 = (triangleEdges t).1 then 1 else 0) - + (if 123 = (triangleEdges t).2.1 then 1 else 0) + + (if 123 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_124 : ∀ t : Fin 270, + rowEval (d2Row 124) (fun j => if j = t then 1 else 0) = + (if 124 = (triangleEdges t).1 then 1 else 0) - + (if 124 = (triangleEdges t).2.1 then 1 else 0) + + (if 124 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_125 : ∀ t : Fin 270, + rowEval (d2Row 125) (fun j => if j = t then 1 else 0) = + (if 125 = (triangleEdges t).1 then 1 else 0) - + (if 125 = (triangleEdges t).2.1 then 1 else 0) + + (if 125 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_126 : ∀ t : Fin 270, + rowEval (d2Row 126) (fun j => if j = t then 1 else 0) = + (if 126 = (triangleEdges t).1 then 1 else 0) - + (if 126 = (triangleEdges t).2.1 then 1 else 0) + + (if 126 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_127 : ∀ t : Fin 270, + rowEval (d2Row 127) (fun j => if j = t then 1 else 0) = + (if 127 = (triangleEdges t).1 then 1 else 0) - + (if 127 = (triangleEdges t).2.1 then 1 else 0) + + (if 127 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_128 : ∀ t : Fin 270, + rowEval (d2Row 128) (fun j => if j = t then 1 else 0) = + (if 128 = (triangleEdges t).1 then 1 else 0) - + (if 128 = (triangleEdges t).2.1 then 1 else 0) + + (if 128 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_129 : ∀ t : Fin 270, + rowEval (d2Row 129) (fun j => if j = t then 1 else 0) = + (if 129 = (triangleEdges t).1 then 1 else 0) - + (if 129 = (triangleEdges t).2.1 then 1 else 0) + + (if 129 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_130 : ∀ t : Fin 270, + rowEval (d2Row 130) (fun j => if j = t then 1 else 0) = + (if 130 = (triangleEdges t).1 then 1 else 0) - + (if 130 = (triangleEdges t).2.1 then 1 else 0) + + (if 130 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_131 : ∀ t : Fin 270, + rowEval (d2Row 131) (fun j => if j = t then 1 else 0) = + (if 131 = (triangleEdges t).1 then 1 else 0) - + (if 131 = (triangleEdges t).2.1 then 1 else 0) + + (if 131 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_132 : ∀ t : Fin 270, + rowEval (d2Row 132) (fun j => if j = t then 1 else 0) = + (if 132 = (triangleEdges t).1 then 1 else 0) - + (if 132 = (triangleEdges t).2.1 then 1 else 0) + + (if 132 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_133 : ∀ t : Fin 270, + rowEval (d2Row 133) (fun j => if j = t then 1 else 0) = + (if 133 = (triangleEdges t).1 then 1 else 0) - + (if 133 = (triangleEdges t).2.1 then 1 else 0) + + (if 133 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_134 : ∀ t : Fin 270, + rowEval (d2Row 134) (fun j => if j = t then 1 else 0) = + (if 134 = (triangleEdges t).1 then 1 else 0) - + (if 134 = (triangleEdges t).2.1 then 1 else 0) + + (if 134 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_135 : ∀ t : Fin 270, + rowEval (d2Row 135) (fun j => if j = t then 1 else 0) = + (if 135 = (triangleEdges t).1 then 1 else 0) - + (if 135 = (triangleEdges t).2.1 then 1 else 0) + + (if 135 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_136 : ∀ t : Fin 270, + rowEval (d2Row 136) (fun j => if j = t then 1 else 0) = + (if 136 = (triangleEdges t).1 then 1 else 0) - + (if 136 = (triangleEdges t).2.1 then 1 else 0) + + (if 136 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_137 : ∀ t : Fin 270, + rowEval (d2Row 137) (fun j => if j = t then 1 else 0) = + (if 137 = (triangleEdges t).1 then 1 else 0) - + (if 137 = (triangleEdges t).2.1 then 1 else 0) + + (if 137 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_138 : ∀ t : Fin 270, + rowEval (d2Row 138) (fun j => if j = t then 1 else 0) = + (if 138 = (triangleEdges t).1 then 1 else 0) - + (if 138 = (triangleEdges t).2.1 then 1 else 0) + + (if 138 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_139 : ∀ t : Fin 270, + rowEval (d2Row 139) (fun j => if j = t then 1 else 0) = + (if 139 = (triangleEdges t).1 then 1 else 0) - + (if 139 = (triangleEdges t).2.1 then 1 else 0) + + (if 139 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_140 : ∀ t : Fin 270, + rowEval (d2Row 140) (fun j => if j = t then 1 else 0) = + (if 140 = (triangleEdges t).1 then 1 else 0) - + (if 140 = (triangleEdges t).2.1 then 1 else 0) + + (if 140 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_141 : ∀ t : Fin 270, + rowEval (d2Row 141) (fun j => if j = t then 1 else 0) = + (if 141 = (triangleEdges t).1 then 1 else 0) - + (if 141 = (triangleEdges t).2.1 then 1 else 0) + + (if 141 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_142 : ∀ t : Fin 270, + rowEval (d2Row 142) (fun j => if j = t then 1 else 0) = + (if 142 = (triangleEdges t).1 then 1 else 0) - + (if 142 = (triangleEdges t).2.1 then 1 else 0) + + (if 142 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_143 : ∀ t : Fin 270, + rowEval (d2Row 143) (fun j => if j = t then 1 else 0) = + (if 143 = (triangleEdges t).1 then 1 else 0) - + (if 143 = (triangleEdges t).2.1 then 1 else 0) + + (if 143 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_144 : ∀ t : Fin 270, + rowEval (d2Row 144) (fun j => if j = t then 1 else 0) = + (if 144 = (triangleEdges t).1 then 1 else 0) - + (if 144 = (triangleEdges t).2.1 then 1 else 0) + + (if 144 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_145 : ∀ t : Fin 270, + rowEval (d2Row 145) (fun j => if j = t then 1 else 0) = + (if 145 = (triangleEdges t).1 then 1 else 0) - + (if 145 = (triangleEdges t).2.1 then 1 else 0) + + (if 145 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_146 : ∀ t : Fin 270, + rowEval (d2Row 146) (fun j => if j = t then 1 else 0) = + (if 146 = (triangleEdges t).1 then 1 else 0) - + (if 146 = (triangleEdges t).2.1 then 1 else 0) + + (if 146 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_147 : ∀ t : Fin 270, + rowEval (d2Row 147) (fun j => if j = t then 1 else 0) = + (if 147 = (triangleEdges t).1 then 1 else 0) - + (if 147 = (triangleEdges t).2.1 then 1 else 0) + + (if 147 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_148 : ∀ t : Fin 270, + rowEval (d2Row 148) (fun j => if j = t then 1 else 0) = + (if 148 = (triangleEdges t).1 then 1 else 0) - + (if 148 = (triangleEdges t).2.1 then 1 else 0) + + (if 148 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_149 : ∀ t : Fin 270, + rowEval (d2Row 149) (fun j => if j = t then 1 else 0) = + (if 149 = (triangleEdges t).1 then 1 else 0) - + (if 149 = (triangleEdges t).2.1 then 1 else 0) + + (if 149 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_150 : ∀ t : Fin 270, + rowEval (d2Row 150) (fun j => if j = t then 1 else 0) = + (if 150 = (triangleEdges t).1 then 1 else 0) - + (if 150 = (triangleEdges t).2.1 then 1 else 0) + + (if 150 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_151 : ∀ t : Fin 270, + rowEval (d2Row 151) (fun j => if j = t then 1 else 0) = + (if 151 = (triangleEdges t).1 then 1 else 0) - + (if 151 = (triangleEdges t).2.1 then 1 else 0) + + (if 151 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_152 : ∀ t : Fin 270, + rowEval (d2Row 152) (fun j => if j = t then 1 else 0) = + (if 152 = (triangleEdges t).1 then 1 else 0) - + (if 152 = (triangleEdges t).2.1 then 1 else 0) + + (if 152 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_153 : ∀ t : Fin 270, + rowEval (d2Row 153) (fun j => if j = t then 1 else 0) = + (if 153 = (triangleEdges t).1 then 1 else 0) - + (if 153 = (triangleEdges t).2.1 then 1 else 0) + + (if 153 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_154 : ∀ t : Fin 270, + rowEval (d2Row 154) (fun j => if j = t then 1 else 0) = + (if 154 = (triangleEdges t).1 then 1 else 0) - + (if 154 = (triangleEdges t).2.1 then 1 else 0) + + (if 154 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_155 : ∀ t : Fin 270, + rowEval (d2Row 155) (fun j => if j = t then 1 else 0) = + (if 155 = (triangleEdges t).1 then 1 else 0) - + (if 155 = (triangleEdges t).2.1 then 1 else 0) + + (if 155 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_156 : ∀ t : Fin 270, + rowEval (d2Row 156) (fun j => if j = t then 1 else 0) = + (if 156 = (triangleEdges t).1 then 1 else 0) - + (if 156 = (triangleEdges t).2.1 then 1 else 0) + + (if 156 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_157 : ∀ t : Fin 270, + rowEval (d2Row 157) (fun j => if j = t then 1 else 0) = + (if 157 = (triangleEdges t).1 then 1 else 0) - + (if 157 = (triangleEdges t).2.1 then 1 else 0) + + (if 157 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_158 : ∀ t : Fin 270, + rowEval (d2Row 158) (fun j => if j = t then 1 else 0) = + (if 158 = (triangleEdges t).1 then 1 else 0) - + (if 158 = (triangleEdges t).2.1 then 1 else 0) + + (if 158 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_159 : ∀ t : Fin 270, + rowEval (d2Row 159) (fun j => if j = t then 1 else 0) = + (if 159 = (triangleEdges t).1 then 1 else 0) - + (if 159 = (triangleEdges t).2.1 then 1 else 0) + + (if 159 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_160 : ∀ t : Fin 270, + rowEval (d2Row 160) (fun j => if j = t then 1 else 0) = + (if 160 = (triangleEdges t).1 then 1 else 0) - + (if 160 = (triangleEdges t).2.1 then 1 else 0) + + (if 160 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_161 : ∀ t : Fin 270, + rowEval (d2Row 161) (fun j => if j = t then 1 else 0) = + (if 161 = (triangleEdges t).1 then 1 else 0) - + (if 161 = (triangleEdges t).2.1 then 1 else 0) + + (if 161 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_162 : ∀ t : Fin 270, + rowEval (d2Row 162) (fun j => if j = t then 1 else 0) = + (if 162 = (triangleEdges t).1 then 1 else 0) - + (if 162 = (triangleEdges t).2.1 then 1 else 0) + + (if 162 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_163 : ∀ t : Fin 270, + rowEval (d2Row 163) (fun j => if j = t then 1 else 0) = + (if 163 = (triangleEdges t).1 then 1 else 0) - + (if 163 = (triangleEdges t).2.1 then 1 else 0) + + (if 163 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_164 : ∀ t : Fin 270, + rowEval (d2Row 164) (fun j => if j = t then 1 else 0) = + (if 164 = (triangleEdges t).1 then 1 else 0) - + (if 164 = (triangleEdges t).2.1 then 1 else 0) + + (if 164 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_165 : ∀ t : Fin 270, + rowEval (d2Row 165) (fun j => if j = t then 1 else 0) = + (if 165 = (triangleEdges t).1 then 1 else 0) - + (if 165 = (triangleEdges t).2.1 then 1 else 0) + + (if 165 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_166 : ∀ t : Fin 270, + rowEval (d2Row 166) (fun j => if j = t then 1 else 0) = + (if 166 = (triangleEdges t).1 then 1 else 0) - + (if 166 = (triangleEdges t).2.1 then 1 else 0) + + (if 166 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_167 : ∀ t : Fin 270, + rowEval (d2Row 167) (fun j => if j = t then 1 else 0) = + (if 167 = (triangleEdges t).1 then 1 else 0) - + (if 167 = (triangleEdges t).2.1 then 1 else 0) + + (if 167 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_168 : ∀ t : Fin 270, + rowEval (d2Row 168) (fun j => if j = t then 1 else 0) = + (if 168 = (triangleEdges t).1 then 1 else 0) - + (if 168 = (triangleEdges t).2.1 then 1 else 0) + + (if 168 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_169 : ∀ t : Fin 270, + rowEval (d2Row 169) (fun j => if j = t then 1 else 0) = + (if 169 = (triangleEdges t).1 then 1 else 0) - + (if 169 = (triangleEdges t).2.1 then 1 else 0) + + (if 169 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_170 : ∀ t : Fin 270, + rowEval (d2Row 170) (fun j => if j = t then 1 else 0) = + (if 170 = (triangleEdges t).1 then 1 else 0) - + (if 170 = (triangleEdges t).2.1 then 1 else 0) + + (if 170 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_171 : ∀ t : Fin 270, + rowEval (d2Row 171) (fun j => if j = t then 1 else 0) = + (if 171 = (triangleEdges t).1 then 1 else 0) - + (if 171 = (triangleEdges t).2.1 then 1 else 0) + + (if 171 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_172 : ∀ t : Fin 270, + rowEval (d2Row 172) (fun j => if j = t then 1 else 0) = + (if 172 = (triangleEdges t).1 then 1 else 0) - + (if 172 = (triangleEdges t).2.1 then 1 else 0) + + (if 172 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_173 : ∀ t : Fin 270, + rowEval (d2Row 173) (fun j => if j = t then 1 else 0) = + (if 173 = (triangleEdges t).1 then 1 else 0) - + (if 173 = (triangleEdges t).2.1 then 1 else 0) + + (if 173 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_174 : ∀ t : Fin 270, + rowEval (d2Row 174) (fun j => if j = t then 1 else 0) = + (if 174 = (triangleEdges t).1 then 1 else 0) - + (if 174 = (triangleEdges t).2.1 then 1 else 0) + + (if 174 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_175 : ∀ t : Fin 270, + rowEval (d2Row 175) (fun j => if j = t then 1 else 0) = + (if 175 = (triangleEdges t).1 then 1 else 0) - + (if 175 = (triangleEdges t).2.1 then 1 else 0) + + (if 175 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_176 : ∀ t : Fin 270, + rowEval (d2Row 176) (fun j => if j = t then 1 else 0) = + (if 176 = (triangleEdges t).1 then 1 else 0) - + (if 176 = (triangleEdges t).2.1 then 1 else 0) + + (if 176 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_177 : ∀ t : Fin 270, + rowEval (d2Row 177) (fun j => if j = t then 1 else 0) = + (if 177 = (triangleEdges t).1 then 1 else 0) - + (if 177 = (triangleEdges t).2.1 then 1 else 0) + + (if 177 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_178 : ∀ t : Fin 270, + rowEval (d2Row 178) (fun j => if j = t then 1 else 0) = + (if 178 = (triangleEdges t).1 then 1 else 0) - + (if 178 = (triangleEdges t).2.1 then 1 else 0) + + (if 178 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_179 : ∀ t : Fin 270, + rowEval (d2Row 179) (fun j => if j = t then 1 else 0) = + (if 179 = (triangleEdges t).1 then 1 else 0) - + (if 179 = (triangleEdges t).2.1 then 1 else 0) + + (if 179 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_180 : ∀ t : Fin 270, + rowEval (d2Row 180) (fun j => if j = t then 1 else 0) = + (if 180 = (triangleEdges t).1 then 1 else 0) - + (if 180 = (triangleEdges t).2.1 then 1 else 0) + + (if 180 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_181 : ∀ t : Fin 270, + rowEval (d2Row 181) (fun j => if j = t then 1 else 0) = + (if 181 = (triangleEdges t).1 then 1 else 0) - + (if 181 = (triangleEdges t).2.1 then 1 else 0) + + (if 181 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_182 : ∀ t : Fin 270, + rowEval (d2Row 182) (fun j => if j = t then 1 else 0) = + (if 182 = (triangleEdges t).1 then 1 else 0) - + (if 182 = (triangleEdges t).2.1 then 1 else 0) + + (if 182 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_183 : ∀ t : Fin 270, + rowEval (d2Row 183) (fun j => if j = t then 1 else 0) = + (if 183 = (triangleEdges t).1 then 1 else 0) - + (if 183 = (triangleEdges t).2.1 then 1 else 0) + + (if 183 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_184 : ∀ t : Fin 270, + rowEval (d2Row 184) (fun j => if j = t then 1 else 0) = + (if 184 = (triangleEdges t).1 then 1 else 0) - + (if 184 = (triangleEdges t).2.1 then 1 else 0) + + (if 184 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_185 : ∀ t : Fin 270, + rowEval (d2Row 185) (fun j => if j = t then 1 else 0) = + (if 185 = (triangleEdges t).1 then 1 else 0) - + (if 185 = (triangleEdges t).2.1 then 1 else 0) + + (if 185 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_186 : ∀ t : Fin 270, + rowEval (d2Row 186) (fun j => if j = t then 1 else 0) = + (if 186 = (triangleEdges t).1 then 1 else 0) - + (if 186 = (triangleEdges t).2.1 then 1 else 0) + + (if 186 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_187 : ∀ t : Fin 270, + rowEval (d2Row 187) (fun j => if j = t then 1 else 0) = + (if 187 = (triangleEdges t).1 then 1 else 0) - + (if 187 = (triangleEdges t).2.1 then 1 else 0) + + (if 187 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_188 : ∀ t : Fin 270, + rowEval (d2Row 188) (fun j => if j = t then 1 else 0) = + (if 188 = (triangleEdges t).1 then 1 else 0) - + (if 188 = (triangleEdges t).2.1 then 1 else 0) + + (if 188 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_189 : ∀ t : Fin 270, + rowEval (d2Row 189) (fun j => if j = t then 1 else 0) = + (if 189 = (triangleEdges t).1 then 1 else 0) - + (if 189 = (triangleEdges t).2.1 then 1 else 0) + + (if 189 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_190 : ∀ t : Fin 270, + rowEval (d2Row 190) (fun j => if j = t then 1 else 0) = + (if 190 = (triangleEdges t).1 then 1 else 0) - + (if 190 = (triangleEdges t).2.1 then 1 else 0) + + (if 190 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_191 : ∀ t : Fin 270, + rowEval (d2Row 191) (fun j => if j = t then 1 else 0) = + (if 191 = (triangleEdges t).1 then 1 else 0) - + (if 191 = (triangleEdges t).2.1 then 1 else 0) + + (if 191 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_192 : ∀ t : Fin 270, + rowEval (d2Row 192) (fun j => if j = t then 1 else 0) = + (if 192 = (triangleEdges t).1 then 1 else 0) - + (if 192 = (triangleEdges t).2.1 then 1 else 0) + + (if 192 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_193 : ∀ t : Fin 270, + rowEval (d2Row 193) (fun j => if j = t then 1 else 0) = + (if 193 = (triangleEdges t).1 then 1 else 0) - + (if 193 = (triangleEdges t).2.1 then 1 else 0) + + (if 193 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_194 : ∀ t : Fin 270, + rowEval (d2Row 194) (fun j => if j = t then 1 else 0) = + (if 194 = (triangleEdges t).1 then 1 else 0) - + (if 194 = (triangleEdges t).2.1 then 1 else 0) + + (if 194 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_195 : ∀ t : Fin 270, + rowEval (d2Row 195) (fun j => if j = t then 1 else 0) = + (if 195 = (triangleEdges t).1 then 1 else 0) - + (if 195 = (triangleEdges t).2.1 then 1 else 0) + + (if 195 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_196 : ∀ t : Fin 270, + rowEval (d2Row 196) (fun j => if j = t then 1 else 0) = + (if 196 = (triangleEdges t).1 then 1 else 0) - + (if 196 = (triangleEdges t).2.1 then 1 else 0) + + (if 196 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_197 : ∀ t : Fin 270, + rowEval (d2Row 197) (fun j => if j = t then 1 else 0) = + (if 197 = (triangleEdges t).1 then 1 else 0) - + (if 197 = (triangleEdges t).2.1 then 1 else 0) + + (if 197 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_198 : ∀ t : Fin 270, + rowEval (d2Row 198) (fun j => if j = t then 1 else 0) = + (if 198 = (triangleEdges t).1 then 1 else 0) - + (if 198 = (triangleEdges t).2.1 then 1 else 0) + + (if 198 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_199 : ∀ t : Fin 270, + rowEval (d2Row 199) (fun j => if j = t then 1 else 0) = + (if 199 = (triangleEdges t).1 then 1 else 0) - + (if 199 = (triangleEdges t).2.1 then 1 else 0) + + (if 199 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_200 : ∀ t : Fin 270, + rowEval (d2Row 200) (fun j => if j = t then 1 else 0) = + (if 200 = (triangleEdges t).1 then 1 else 0) - + (if 200 = (triangleEdges t).2.1 then 1 else 0) + + (if 200 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_201 : ∀ t : Fin 270, + rowEval (d2Row 201) (fun j => if j = t then 1 else 0) = + (if 201 = (triangleEdges t).1 then 1 else 0) - + (if 201 = (triangleEdges t).2.1 then 1 else 0) + + (if 201 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_202 : ∀ t : Fin 270, + rowEval (d2Row 202) (fun j => if j = t then 1 else 0) = + (if 202 = (triangleEdges t).1 then 1 else 0) - + (if 202 = (triangleEdges t).2.1 then 1 else 0) + + (if 202 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_203 : ∀ t : Fin 270, + rowEval (d2Row 203) (fun j => if j = t then 1 else 0) = + (if 203 = (triangleEdges t).1 then 1 else 0) - + (if 203 = (triangleEdges t).2.1 then 1 else 0) + + (if 203 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_204 : ∀ t : Fin 270, + rowEval (d2Row 204) (fun j => if j = t then 1 else 0) = + (if 204 = (triangleEdges t).1 then 1 else 0) - + (if 204 = (triangleEdges t).2.1 then 1 else 0) + + (if 204 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_205 : ∀ t : Fin 270, + rowEval (d2Row 205) (fun j => if j = t then 1 else 0) = + (if 205 = (triangleEdges t).1 then 1 else 0) - + (if 205 = (triangleEdges t).2.1 then 1 else 0) + + (if 205 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_206 : ∀ t : Fin 270, + rowEval (d2Row 206) (fun j => if j = t then 1 else 0) = + (if 206 = (triangleEdges t).1 then 1 else 0) - + (if 206 = (triangleEdges t).2.1 then 1 else 0) + + (if 206 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_207 : ∀ t : Fin 270, + rowEval (d2Row 207) (fun j => if j = t then 1 else 0) = + (if 207 = (triangleEdges t).1 then 1 else 0) - + (if 207 = (triangleEdges t).2.1 then 1 else 0) + + (if 207 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_208 : ∀ t : Fin 270, + rowEval (d2Row 208) (fun j => if j = t then 1 else 0) = + (if 208 = (triangleEdges t).1 then 1 else 0) - + (if 208 = (triangleEdges t).2.1 then 1 else 0) + + (if 208 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_209 : ∀ t : Fin 270, + rowEval (d2Row 209) (fun j => if j = t then 1 else 0) = + (if 209 = (triangleEdges t).1 then 1 else 0) - + (if 209 = (triangleEdges t).2.1 then 1 else 0) + + (if 209 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_210 : ∀ t : Fin 270, + rowEval (d2Row 210) (fun j => if j = t then 1 else 0) = + (if 210 = (triangleEdges t).1 then 1 else 0) - + (if 210 = (triangleEdges t).2.1 then 1 else 0) + + (if 210 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_211 : ∀ t : Fin 270, + rowEval (d2Row 211) (fun j => if j = t then 1 else 0) = + (if 211 = (triangleEdges t).1 then 1 else 0) - + (if 211 = (triangleEdges t).2.1 then 1 else 0) + + (if 211 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_212 : ∀ t : Fin 270, + rowEval (d2Row 212) (fun j => if j = t then 1 else 0) = + (if 212 = (triangleEdges t).1 then 1 else 0) - + (if 212 = (triangleEdges t).2.1 then 1 else 0) + + (if 212 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_213 : ∀ t : Fin 270, + rowEval (d2Row 213) (fun j => if j = t then 1 else 0) = + (if 213 = (triangleEdges t).1 then 1 else 0) - + (if 213 = (triangleEdges t).2.1 then 1 else 0) + + (if 213 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_214 : ∀ t : Fin 270, + rowEval (d2Row 214) (fun j => if j = t then 1 else 0) = + (if 214 = (triangleEdges t).1 then 1 else 0) - + (if 214 = (triangleEdges t).2.1 then 1 else 0) + + (if 214 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_215 : ∀ t : Fin 270, + rowEval (d2Row 215) (fun j => if j = t then 1 else 0) = + (if 215 = (triangleEdges t).1 then 1 else 0) - + (if 215 = (triangleEdges t).2.1 then 1 else 0) + + (if 215 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_216 : ∀ t : Fin 270, + rowEval (d2Row 216) (fun j => if j = t then 1 else 0) = + (if 216 = (triangleEdges t).1 then 1 else 0) - + (if 216 = (triangleEdges t).2.1 then 1 else 0) + + (if 216 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_217 : ∀ t : Fin 270, + rowEval (d2Row 217) (fun j => if j = t then 1 else 0) = + (if 217 = (triangleEdges t).1 then 1 else 0) - + (if 217 = (triangleEdges t).2.1 then 1 else 0) + + (if 217 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_218 : ∀ t : Fin 270, + rowEval (d2Row 218) (fun j => if j = t then 1 else 0) = + (if 218 = (triangleEdges t).1 then 1 else 0) - + (if 218 = (triangleEdges t).2.1 then 1 else 0) + + (if 218 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_219 : ∀ t : Fin 270, + rowEval (d2Row 219) (fun j => if j = t then 1 else 0) = + (if 219 = (triangleEdges t).1 then 1 else 0) - + (if 219 = (triangleEdges t).2.1 then 1 else 0) + + (if 219 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_220 : ∀ t : Fin 270, + rowEval (d2Row 220) (fun j => if j = t then 1 else 0) = + (if 220 = (triangleEdges t).1 then 1 else 0) - + (if 220 = (triangleEdges t).2.1 then 1 else 0) + + (if 220 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_221 : ∀ t : Fin 270, + rowEval (d2Row 221) (fun j => if j = t then 1 else 0) = + (if 221 = (triangleEdges t).1 then 1 else 0) - + (if 221 = (triangleEdges t).2.1 then 1 else 0) + + (if 221 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_222 : ∀ t : Fin 270, + rowEval (d2Row 222) (fun j => if j = t then 1 else 0) = + (if 222 = (triangleEdges t).1 then 1 else 0) - + (if 222 = (triangleEdges t).2.1 then 1 else 0) + + (if 222 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_223 : ∀ t : Fin 270, + rowEval (d2Row 223) (fun j => if j = t then 1 else 0) = + (if 223 = (triangleEdges t).1 then 1 else 0) - + (if 223 = (triangleEdges t).2.1 then 1 else 0) + + (if 223 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_224 : ∀ t : Fin 270, + rowEval (d2Row 224) (fun j => if j = t then 1 else 0) = + (if 224 = (triangleEdges t).1 then 1 else 0) - + (if 224 = (triangleEdges t).2.1 then 1 else 0) + + (if 224 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_225 : ∀ t : Fin 270, + rowEval (d2Row 225) (fun j => if j = t then 1 else 0) = + (if 225 = (triangleEdges t).1 then 1 else 0) - + (if 225 = (triangleEdges t).2.1 then 1 else 0) + + (if 225 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_226 : ∀ t : Fin 270, + rowEval (d2Row 226) (fun j => if j = t then 1 else 0) = + (if 226 = (triangleEdges t).1 then 1 else 0) - + (if 226 = (triangleEdges t).2.1 then 1 else 0) + + (if 226 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_227 : ∀ t : Fin 270, + rowEval (d2Row 227) (fun j => if j = t then 1 else 0) = + (if 227 = (triangleEdges t).1 then 1 else 0) - + (if 227 = (triangleEdges t).2.1 then 1 else 0) + + (if 227 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_228 : ∀ t : Fin 270, + rowEval (d2Row 228) (fun j => if j = t then 1 else 0) = + (if 228 = (triangleEdges t).1 then 1 else 0) - + (if 228 = (triangleEdges t).2.1 then 1 else 0) + + (if 228 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_229 : ∀ t : Fin 270, + rowEval (d2Row 229) (fun j => if j = t then 1 else 0) = + (if 229 = (triangleEdges t).1 then 1 else 0) - + (if 229 = (triangleEdges t).2.1 then 1 else 0) + + (if 229 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_230 : ∀ t : Fin 270, + rowEval (d2Row 230) (fun j => if j = t then 1 else 0) = + (if 230 = (triangleEdges t).1 then 1 else 0) - + (if 230 = (triangleEdges t).2.1 then 1 else 0) + + (if 230 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_231 : ∀ t : Fin 270, + rowEval (d2Row 231) (fun j => if j = t then 1 else 0) = + (if 231 = (triangleEdges t).1 then 1 else 0) - + (if 231 = (triangleEdges t).2.1 then 1 else 0) + + (if 231 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_232 : ∀ t : Fin 270, + rowEval (d2Row 232) (fun j => if j = t then 1 else 0) = + (if 232 = (triangleEdges t).1 then 1 else 0) - + (if 232 = (triangleEdges t).2.1 then 1 else 0) + + (if 232 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_233 : ∀ t : Fin 270, + rowEval (d2Row 233) (fun j => if j = t then 1 else 0) = + (if 233 = (triangleEdges t).1 then 1 else 0) - + (if 233 = (triangleEdges t).2.1 then 1 else 0) + + (if 233 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_234 : ∀ t : Fin 270, + rowEval (d2Row 234) (fun j => if j = t then 1 else 0) = + (if 234 = (triangleEdges t).1 then 1 else 0) - + (if 234 = (triangleEdges t).2.1 then 1 else 0) + + (if 234 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_235 : ∀ t : Fin 270, + rowEval (d2Row 235) (fun j => if j = t then 1 else 0) = + (if 235 = (triangleEdges t).1 then 1 else 0) - + (if 235 = (triangleEdges t).2.1 then 1 else 0) + + (if 235 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_236 : ∀ t : Fin 270, + rowEval (d2Row 236) (fun j => if j = t then 1 else 0) = + (if 236 = (triangleEdges t).1 then 1 else 0) - + (if 236 = (triangleEdges t).2.1 then 1 else 0) + + (if 236 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_237 : ∀ t : Fin 270, + rowEval (d2Row 237) (fun j => if j = t then 1 else 0) = + (if 237 = (triangleEdges t).1 then 1 else 0) - + (if 237 = (triangleEdges t).2.1 then 1 else 0) + + (if 237 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_238 : ∀ t : Fin 270, + rowEval (d2Row 238) (fun j => if j = t then 1 else 0) = + (if 238 = (triangleEdges t).1 then 1 else 0) - + (if 238 = (triangleEdges t).2.1 then 1 else 0) + + (if 238 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_239 : ∀ t : Fin 270, + rowEval (d2Row 239) (fun j => if j = t then 1 else 0) = + (if 239 = (triangleEdges t).1 then 1 else 0) - + (if 239 = (triangleEdges t).2.1 then 1 else 0) + + (if 239 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_240 : ∀ t : Fin 270, + rowEval (d2Row 240) (fun j => if j = t then 1 else 0) = + (if 240 = (triangleEdges t).1 then 1 else 0) - + (if 240 = (triangleEdges t).2.1 then 1 else 0) + + (if 240 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_241 : ∀ t : Fin 270, + rowEval (d2Row 241) (fun j => if j = t then 1 else 0) = + (if 241 = (triangleEdges t).1 then 1 else 0) - + (if 241 = (triangleEdges t).2.1 then 1 else 0) + + (if 241 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_242 : ∀ t : Fin 270, + rowEval (d2Row 242) (fun j => if j = t then 1 else 0) = + (if 242 = (triangleEdges t).1 then 1 else 0) - + (if 242 = (triangleEdges t).2.1 then 1 else 0) + + (if 242 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_243 : ∀ t : Fin 270, + rowEval (d2Row 243) (fun j => if j = t then 1 else 0) = + (if 243 = (triangleEdges t).1 then 1 else 0) - + (if 243 = (triangleEdges t).2.1 then 1 else 0) + + (if 243 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_244 : ∀ t : Fin 270, + rowEval (d2Row 244) (fun j => if j = t then 1 else 0) = + (if 244 = (triangleEdges t).1 then 1 else 0) - + (if 244 = (triangleEdges t).2.1 then 1 else 0) + + (if 244 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_245 : ∀ t : Fin 270, + rowEval (d2Row 245) (fun j => if j = t then 1 else 0) = + (if 245 = (triangleEdges t).1 then 1 else 0) - + (if 245 = (triangleEdges t).2.1 then 1 else 0) + + (if 245 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_246 : ∀ t : Fin 270, + rowEval (d2Row 246) (fun j => if j = t then 1 else 0) = + (if 246 = (triangleEdges t).1 then 1 else 0) - + (if 246 = (triangleEdges t).2.1 then 1 else 0) + + (if 246 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_247 : ∀ t : Fin 270, + rowEval (d2Row 247) (fun j => if j = t then 1 else 0) = + (if 247 = (triangleEdges t).1 then 1 else 0) - + (if 247 = (triangleEdges t).2.1 then 1 else 0) + + (if 247 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_248 : ∀ t : Fin 270, + rowEval (d2Row 248) (fun j => if j = t then 1 else 0) = + (if 248 = (triangleEdges t).1 then 1 else 0) - + (if 248 = (triangleEdges t).2.1 then 1 else 0) + + (if 248 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_249 : ∀ t : Fin 270, + rowEval (d2Row 249) (fun j => if j = t then 1 else 0) = + (if 249 = (triangleEdges t).1 then 1 else 0) - + (if 249 = (triangleEdges t).2.1 then 1 else 0) + + (if 249 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_250 : ∀ t : Fin 270, + rowEval (d2Row 250) (fun j => if j = t then 1 else 0) = + (if 250 = (triangleEdges t).1 then 1 else 0) - + (if 250 = (triangleEdges t).2.1 then 1 else 0) + + (if 250 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_251 : ∀ t : Fin 270, + rowEval (d2Row 251) (fun j => if j = t then 1 else 0) = + (if 251 = (triangleEdges t).1 then 1 else 0) - + (if 251 = (triangleEdges t).2.1 then 1 else 0) + + (if 251 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_252 : ∀ t : Fin 270, + rowEval (d2Row 252) (fun j => if j = t then 1 else 0) = + (if 252 = (triangleEdges t).1 then 1 else 0) - + (if 252 = (triangleEdges t).2.1 then 1 else 0) + + (if 252 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_253 : ∀ t : Fin 270, + rowEval (d2Row 253) (fun j => if j = t then 1 else 0) = + (if 253 = (triangleEdges t).1 then 1 else 0) - + (if 253 = (triangleEdges t).2.1 then 1 else 0) + + (if 253 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_254 : ∀ t : Fin 270, + rowEval (d2Row 254) (fun j => if j = t then 1 else 0) = + (if 254 = (triangleEdges t).1 then 1 else 0) - + (if 254 = (triangleEdges t).2.1 then 1 else 0) + + (if 254 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_255 : ∀ t : Fin 270, + rowEval (d2Row 255) (fun j => if j = t then 1 else 0) = + (if 255 = (triangleEdges t).1 then 1 else 0) - + (if 255 = (triangleEdges t).2.1 then 1 else 0) + + (if 255 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_256 : ∀ t : Fin 270, + rowEval (d2Row 256) (fun j => if j = t then 1 else 0) = + (if 256 = (triangleEdges t).1 then 1 else 0) - + (if 256 = (triangleEdges t).2.1 then 1 else 0) + + (if 256 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_257 : ∀ t : Fin 270, + rowEval (d2Row 257) (fun j => if j = t then 1 else 0) = + (if 257 = (triangleEdges t).1 then 1 else 0) - + (if 257 = (triangleEdges t).2.1 then 1 else 0) + + (if 257 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_258 : ∀ t : Fin 270, + rowEval (d2Row 258) (fun j => if j = t then 1 else 0) = + (if 258 = (triangleEdges t).1 then 1 else 0) - + (if 258 = (triangleEdges t).2.1 then 1 else 0) + + (if 258 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_259 : ∀ t : Fin 270, + rowEval (d2Row 259) (fun j => if j = t then 1 else 0) = + (if 259 = (triangleEdges t).1 then 1 else 0) - + (if 259 = (triangleEdges t).2.1 then 1 else 0) + + (if 259 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_260 : ∀ t : Fin 270, + rowEval (d2Row 260) (fun j => if j = t then 1 else 0) = + (if 260 = (triangleEdges t).1 then 1 else 0) - + (if 260 = (triangleEdges t).2.1 then 1 else 0) + + (if 260 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_261 : ∀ t : Fin 270, + rowEval (d2Row 261) (fun j => if j = t then 1 else 0) = + (if 261 = (triangleEdges t).1 then 1 else 0) - + (if 261 = (triangleEdges t).2.1 then 1 else 0) + + (if 261 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_262 : ∀ t : Fin 270, + rowEval (d2Row 262) (fun j => if j = t then 1 else 0) = + (if 262 = (triangleEdges t).1 then 1 else 0) - + (if 262 = (triangleEdges t).2.1 then 1 else 0) + + (if 262 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_263 : ∀ t : Fin 270, + rowEval (d2Row 263) (fun j => if j = t then 1 else 0) = + (if 263 = (triangleEdges t).1 then 1 else 0) - + (if 263 = (triangleEdges t).2.1 then 1 else 0) + + (if 263 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_264 : ∀ t : Fin 270, + rowEval (d2Row 264) (fun j => if j = t then 1 else 0) = + (if 264 = (triangleEdges t).1 then 1 else 0) - + (if 264 = (triangleEdges t).2.1 then 1 else 0) + + (if 264 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_265 : ∀ t : Fin 270, + rowEval (d2Row 265) (fun j => if j = t then 1 else 0) = + (if 265 = (triangleEdges t).1 then 1 else 0) - + (if 265 = (triangleEdges t).2.1 then 1 else 0) + + (if 265 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_266 : ∀ t : Fin 270, + rowEval (d2Row 266) (fun j => if j = t then 1 else 0) = + (if 266 = (triangleEdges t).1 then 1 else 0) - + (if 266 = (triangleEdges t).2.1 then 1 else 0) + + (if 266 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_267 : ∀ t : Fin 270, + rowEval (d2Row 267) (fun j => if j = t then 1 else 0) = + (if 267 = (triangleEdges t).1 then 1 else 0) - + (if 267 = (triangleEdges t).2.1 then 1 else 0) + + (if 267 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_268 : ∀ t : Fin 270, + rowEval (d2Row 268) (fun j => if j = t then 1 else 0) = + (if 268 = (triangleEdges t).1 then 1 else 0) - + (if 268 = (triangleEdges t).2.1 then 1 else 0) + + (if 268 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_269 : ∀ t : Fin 270, + rowEval (d2Row 269) (fun j => if j = t then 1 else 0) = + (if 269 = (triangleEdges t).1 then 1 else 0) - + (if 269 = (triangleEdges t).2.1 then 1 else 0) + + (if 269 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_270 : ∀ t : Fin 270, + rowEval (d2Row 270) (fun j => if j = t then 1 else 0) = + (if 270 = (triangleEdges t).1 then 1 else 0) - + (if 270 = (triangleEdges t).2.1 then 1 else 0) + + (if 270 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_271 : ∀ t : Fin 270, + rowEval (d2Row 271) (fun j => if j = t then 1 else 0) = + (if 271 = (triangleEdges t).1 then 1 else 0) - + (if 271 = (triangleEdges t).2.1 then 1 else 0) + + (if 271 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_272 : ∀ t : Fin 270, + rowEval (d2Row 272) (fun j => if j = t then 1 else 0) = + (if 272 = (triangleEdges t).1 then 1 else 0) - + (if 272 = (triangleEdges t).2.1 then 1 else 0) + + (if 272 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_273 : ∀ t : Fin 270, + rowEval (d2Row 273) (fun j => if j = t then 1 else 0) = + (if 273 = (triangleEdges t).1 then 1 else 0) - + (if 273 = (triangleEdges t).2.1 then 1 else 0) + + (if 273 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_274 : ∀ t : Fin 270, + rowEval (d2Row 274) (fun j => if j = t then 1 else 0) = + (if 274 = (triangleEdges t).1 then 1 else 0) - + (if 274 = (triangleEdges t).2.1 then 1 else 0) + + (if 274 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_275 : ∀ t : Fin 270, + rowEval (d2Row 275) (fun j => if j = t then 1 else 0) = + (if 275 = (triangleEdges t).1 then 1 else 0) - + (if 275 = (triangleEdges t).2.1 then 1 else 0) + + (if 275 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_276 : ∀ t : Fin 270, + rowEval (d2Row 276) (fun j => if j = t then 1 else 0) = + (if 276 = (triangleEdges t).1 then 1 else 0) - + (if 276 = (triangleEdges t).2.1 then 1 else 0) + + (if 276 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_277 : ∀ t : Fin 270, + rowEval (d2Row 277) (fun j => if j = t then 1 else 0) = + (if 277 = (triangleEdges t).1 then 1 else 0) - + (if 277 = (triangleEdges t).2.1 then 1 else 0) + + (if 277 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_278 : ∀ t : Fin 270, + rowEval (d2Row 278) (fun j => if j = t then 1 else 0) = + (if 278 = (triangleEdges t).1 then 1 else 0) - + (if 278 = (triangleEdges t).2.1 then 1 else 0) + + (if 278 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_279 : ∀ t : Fin 270, + rowEval (d2Row 279) (fun j => if j = t then 1 else 0) = + (if 279 = (triangleEdges t).1 then 1 else 0) - + (if 279 = (triangleEdges t).2.1 then 1 else 0) + + (if 279 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_280 : ∀ t : Fin 270, + rowEval (d2Row 280) (fun j => if j = t then 1 else 0) = + (if 280 = (triangleEdges t).1 then 1 else 0) - + (if 280 = (triangleEdges t).2.1 then 1 else 0) + + (if 280 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_281 : ∀ t : Fin 270, + rowEval (d2Row 281) (fun j => if j = t then 1 else 0) = + (if 281 = (triangleEdges t).1 then 1 else 0) - + (if 281 = (triangleEdges t).2.1 then 1 else 0) + + (if 281 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_282 : ∀ t : Fin 270, + rowEval (d2Row 282) (fun j => if j = t then 1 else 0) = + (if 282 = (triangleEdges t).1 then 1 else 0) - + (if 282 = (triangleEdges t).2.1 then 1 else 0) + + (if 282 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_283 : ∀ t : Fin 270, + rowEval (d2Row 283) (fun j => if j = t then 1 else 0) = + (if 283 = (triangleEdges t).1 then 1 else 0) - + (if 283 = (triangleEdges t).2.1 then 1 else 0) + + (if 283 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_284 : ∀ t : Fin 270, + rowEval (d2Row 284) (fun j => if j = t then 1 else 0) = + (if 284 = (triangleEdges t).1 then 1 else 0) - + (if 284 = (triangleEdges t).2.1 then 1 else 0) + + (if 284 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_285 : ∀ t : Fin 270, + rowEval (d2Row 285) (fun j => if j = t then 1 else 0) = + (if 285 = (triangleEdges t).1 then 1 else 0) - + (if 285 = (triangleEdges t).2.1 then 1 else 0) + + (if 285 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_286 : ∀ t : Fin 270, + rowEval (d2Row 286) (fun j => if j = t then 1 else 0) = + (if 286 = (triangleEdges t).1 then 1 else 0) - + (if 286 = (triangleEdges t).2.1 then 1 else 0) + + (if 286 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_287 : ∀ t : Fin 270, + rowEval (d2Row 287) (fun j => if j = t then 1 else 0) = + (if 287 = (triangleEdges t).1 then 1 else 0) - + (if 287 = (triangleEdges t).2.1 then 1 else 0) + + (if 287 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_288 : ∀ t : Fin 270, + rowEval (d2Row 288) (fun j => if j = t then 1 else 0) = + (if 288 = (triangleEdges t).1 then 1 else 0) - + (if 288 = (triangleEdges t).2.1 then 1 else 0) + + (if 288 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_289 : ∀ t : Fin 270, + rowEval (d2Row 289) (fun j => if j = t then 1 else 0) = + (if 289 = (triangleEdges t).1 then 1 else 0) - + (if 289 = (triangleEdges t).2.1 then 1 else 0) + + (if 289 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_290 : ∀ t : Fin 270, + rowEval (d2Row 290) (fun j => if j = t then 1 else 0) = + (if 290 = (triangleEdges t).1 then 1 else 0) - + (if 290 = (triangleEdges t).2.1 then 1 else 0) + + (if 290 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_291 : ∀ t : Fin 270, + rowEval (d2Row 291) (fun j => if j = t then 1 else 0) = + (if 291 = (triangleEdges t).1 then 1 else 0) - + (if 291 = (triangleEdges t).2.1 then 1 else 0) + + (if 291 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_292 : ∀ t : Fin 270, + rowEval (d2Row 292) (fun j => if j = t then 1 else 0) = + (if 292 = (triangleEdges t).1 then 1 else 0) - + (if 292 = (triangleEdges t).2.1 then 1 else 0) + + (if 292 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_293 : ∀ t : Fin 270, + rowEval (d2Row 293) (fun j => if j = t then 1 else 0) = + (if 293 = (triangleEdges t).1 then 1 else 0) - + (if 293 = (triangleEdges t).2.1 then 1 else 0) + + (if 293 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_294 : ∀ t : Fin 270, + rowEval (d2Row 294) (fun j => if j = t then 1 else 0) = + (if 294 = (triangleEdges t).1 then 1 else 0) - + (if 294 = (triangleEdges t).2.1 then 1 else 0) + + (if 294 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_295 : ∀ t : Fin 270, + rowEval (d2Row 295) (fun j => if j = t then 1 else 0) = + (if 295 = (triangleEdges t).1 then 1 else 0) - + (if 295 = (triangleEdges t).2.1 then 1 else 0) + + (if 295 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_296 : ∀ t : Fin 270, + rowEval (d2Row 296) (fun j => if j = t then 1 else 0) = + (if 296 = (triangleEdges t).1 then 1 else 0) - + (if 296 = (triangleEdges t).2.1 then 1 else 0) + + (if 296 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_297 : ∀ t : Fin 270, + rowEval (d2Row 297) (fun j => if j = t then 1 else 0) = + (if 297 = (triangleEdges t).1 then 1 else 0) - + (if 297 = (triangleEdges t).2.1 then 1 else 0) + + (if 297 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_298 : ∀ t : Fin 270, + rowEval (d2Row 298) (fun j => if j = t then 1 else 0) = + (if 298 = (triangleEdges t).1 then 1 else 0) - + (if 298 = (triangleEdges t).2.1 then 1 else 0) + + (if 298 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_299 : ∀ t : Fin 270, + rowEval (d2Row 299) (fun j => if j = t then 1 else 0) = + (if 299 = (triangleEdges t).1 then 1 else 0) - + (if 299 = (triangleEdges t).2.1 then 1 else 0) + + (if 299 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_300 : ∀ t : Fin 270, + rowEval (d2Row 300) (fun j => if j = t then 1 else 0) = + (if 300 = (triangleEdges t).1 then 1 else 0) - + (if 300 = (triangleEdges t).2.1 then 1 else 0) + + (if 300 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_301 : ∀ t : Fin 270, + rowEval (d2Row 301) (fun j => if j = t then 1 else 0) = + (if 301 = (triangleEdges t).1 then 1 else 0) - + (if 301 = (triangleEdges t).2.1 then 1 else 0) + + (if 301 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_302 : ∀ t : Fin 270, + rowEval (d2Row 302) (fun j => if j = t then 1 else 0) = + (if 302 = (triangleEdges t).1 then 1 else 0) - + (if 302 = (triangleEdges t).2.1 then 1 else 0) + + (if 302 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_303 : ∀ t : Fin 270, + rowEval (d2Row 303) (fun j => if j = t then 1 else 0) = + (if 303 = (triangleEdges t).1 then 1 else 0) - + (if 303 = (triangleEdges t).2.1 then 1 else 0) + + (if 303 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_304 : ∀ t : Fin 270, + rowEval (d2Row 304) (fun j => if j = t then 1 else 0) = + (if 304 = (triangleEdges t).1 then 1 else 0) - + (if 304 = (triangleEdges t).2.1 then 1 else 0) + + (if 304 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_305 : ∀ t : Fin 270, + rowEval (d2Row 305) (fun j => if j = t then 1 else 0) = + (if 305 = (triangleEdges t).1 then 1 else 0) - + (if 305 = (triangleEdges t).2.1 then 1 else 0) + + (if 305 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_306 : ∀ t : Fin 270, + rowEval (d2Row 306) (fun j => if j = t then 1 else 0) = + (if 306 = (triangleEdges t).1 then 1 else 0) - + (if 306 = (triangleEdges t).2.1 then 1 else 0) + + (if 306 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_307 : ∀ t : Fin 270, + rowEval (d2Row 307) (fun j => if j = t then 1 else 0) = + (if 307 = (triangleEdges t).1 then 1 else 0) - + (if 307 = (triangleEdges t).2.1 then 1 else 0) + + (if 307 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_308 : ∀ t : Fin 270, + rowEval (d2Row 308) (fun j => if j = t then 1 else 0) = + (if 308 = (triangleEdges t).1 then 1 else 0) - + (if 308 = (triangleEdges t).2.1 then 1 else 0) + + (if 308 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_309 : ∀ t : Fin 270, + rowEval (d2Row 309) (fun j => if j = t then 1 else 0) = + (if 309 = (triangleEdges t).1 then 1 else 0) - + (if 309 = (triangleEdges t).2.1 then 1 else 0) + + (if 309 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_310 : ∀ t : Fin 270, + rowEval (d2Row 310) (fun j => if j = t then 1 else 0) = + (if 310 = (triangleEdges t).1 then 1 else 0) - + (if 310 = (triangleEdges t).2.1 then 1 else 0) + + (if 310 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_311 : ∀ t : Fin 270, + rowEval (d2Row 311) (fun j => if j = t then 1 else 0) = + (if 311 = (triangleEdges t).1 then 1 else 0) - + (if 311 = (triangleEdges t).2.1 then 1 else 0) + + (if 311 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_312 : ∀ t : Fin 270, + rowEval (d2Row 312) (fun j => if j = t then 1 else 0) = + (if 312 = (triangleEdges t).1 then 1 else 0) - + (if 312 = (triangleEdges t).2.1 then 1 else 0) + + (if 312 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_313 : ∀ t : Fin 270, + rowEval (d2Row 313) (fun j => if j = t then 1 else 0) = + (if 313 = (triangleEdges t).1 then 1 else 0) - + (if 313 = (triangleEdges t).2.1 then 1 else 0) + + (if 313 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_314 : ∀ t : Fin 270, + rowEval (d2Row 314) (fun j => if j = t then 1 else 0) = + (if 314 = (triangleEdges t).1 then 1 else 0) - + (if 314 = (triangleEdges t).2.1 then 1 else 0) + + (if 314 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_315 : ∀ t : Fin 270, + rowEval (d2Row 315) (fun j => if j = t then 1 else 0) = + (if 315 = (triangleEdges t).1 then 1 else 0) - + (if 315 = (triangleEdges t).2.1 then 1 else 0) + + (if 315 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_316 : ∀ t : Fin 270, + rowEval (d2Row 316) (fun j => if j = t then 1 else 0) = + (if 316 = (triangleEdges t).1 then 1 else 0) - + (if 316 = (triangleEdges t).2.1 then 1 else 0) + + (if 316 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_317 : ∀ t : Fin 270, + rowEval (d2Row 317) (fun j => if j = t then 1 else 0) = + (if 317 = (triangleEdges t).1 then 1 else 0) - + (if 317 = (triangleEdges t).2.1 then 1 else 0) + + (if 317 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_318 : ∀ t : Fin 270, + rowEval (d2Row 318) (fun j => if j = t then 1 else 0) = + (if 318 = (triangleEdges t).1 then 1 else 0) - + (if 318 = (triangleEdges t).2.1 then 1 else 0) + + (if 318 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_319 : ∀ t : Fin 270, + rowEval (d2Row 319) (fun j => if j = t then 1 else 0) = + (if 319 = (triangleEdges t).1 then 1 else 0) - + (if 319 = (triangleEdges t).2.1 then 1 else 0) + + (if 319 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_320 : ∀ t : Fin 270, + rowEval (d2Row 320) (fun j => if j = t then 1 else 0) = + (if 320 = (triangleEdges t).1 then 1 else 0) - + (if 320 = (triangleEdges t).2.1 then 1 else 0) + + (if 320 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_321 : ∀ t : Fin 270, + rowEval (d2Row 321) (fun j => if j = t then 1 else 0) = + (if 321 = (triangleEdges t).1 then 1 else 0) - + (if 321 = (triangleEdges t).2.1 then 1 else 0) + + (if 321 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_322 : ∀ t : Fin 270, + rowEval (d2Row 322) (fun j => if j = t then 1 else 0) = + (if 322 = (triangleEdges t).1 then 1 else 0) - + (if 322 = (triangleEdges t).2.1 then 1 else 0) + + (if 322 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_323 : ∀ t : Fin 270, + rowEval (d2Row 323) (fun j => if j = t then 1 else 0) = + (if 323 = (triangleEdges t).1 then 1 else 0) - + (if 323 = (triangleEdges t).2.1 then 1 else 0) + + (if 323 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_324 : ∀ t : Fin 270, + rowEval (d2Row 324) (fun j => if j = t then 1 else 0) = + (if 324 = (triangleEdges t).1 then 1 else 0) - + (if 324 = (triangleEdges t).2.1 then 1 else 0) + + (if 324 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_325 : ∀ t : Fin 270, + rowEval (d2Row 325) (fun j => if j = t then 1 else 0) = + (if 325 = (triangleEdges t).1 then 1 else 0) - + (if 325 = (triangleEdges t).2.1 then 1 else 0) + + (if 325 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_326 : ∀ t : Fin 270, + rowEval (d2Row 326) (fun j => if j = t then 1 else 0) = + (if 326 = (triangleEdges t).1 then 1 else 0) - + (if 326 = (triangleEdges t).2.1 then 1 else 0) + + (if 326 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_327 : ∀ t : Fin 270, + rowEval (d2Row 327) (fun j => if j = t then 1 else 0) = + (if 327 = (triangleEdges t).1 then 1 else 0) - + (if 327 = (triangleEdges t).2.1 then 1 else 0) + + (if 327 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_328 : ∀ t : Fin 270, + rowEval (d2Row 328) (fun j => if j = t then 1 else 0) = + (if 328 = (triangleEdges t).1 then 1 else 0) - + (if 328 = (triangleEdges t).2.1 then 1 else 0) + + (if 328 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_329 : ∀ t : Fin 270, + rowEval (d2Row 329) (fun j => if j = t then 1 else 0) = + (if 329 = (triangleEdges t).1 then 1 else 0) - + (if 329 = (triangleEdges t).2.1 then 1 else 0) + + (if 329 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_330 : ∀ t : Fin 270, + rowEval (d2Row 330) (fun j => if j = t then 1 else 0) = + (if 330 = (triangleEdges t).1 then 1 else 0) - + (if 330 = (triangleEdges t).2.1 then 1 else 0) + + (if 330 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_331 : ∀ t : Fin 270, + rowEval (d2Row 331) (fun j => if j = t then 1 else 0) = + (if 331 = (triangleEdges t).1 then 1 else 0) - + (if 331 = (triangleEdges t).2.1 then 1 else 0) + + (if 331 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_332 : ∀ t : Fin 270, + rowEval (d2Row 332) (fun j => if j = t then 1 else 0) = + (if 332 = (triangleEdges t).1 then 1 else 0) - + (if 332 = (triangleEdges t).2.1 then 1 else 0) + + (if 332 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_333 : ∀ t : Fin 270, + rowEval (d2Row 333) (fun j => if j = t then 1 else 0) = + (if 333 = (triangleEdges t).1 then 1 else 0) - + (if 333 = (triangleEdges t).2.1 then 1 else 0) + + (if 333 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_334 : ∀ t : Fin 270, + rowEval (d2Row 334) (fun j => if j = t then 1 else 0) = + (if 334 = (triangleEdges t).1 then 1 else 0) - + (if 334 = (triangleEdges t).2.1 then 1 else 0) + + (if 334 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_335 : ∀ t : Fin 270, + rowEval (d2Row 335) (fun j => if j = t then 1 else 0) = + (if 335 = (triangleEdges t).1 then 1 else 0) - + (if 335 = (triangleEdges t).2.1 then 1 else 0) + + (if 335 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_336 : ∀ t : Fin 270, + rowEval (d2Row 336) (fun j => if j = t then 1 else 0) = + (if 336 = (triangleEdges t).1 then 1 else 0) - + (if 336 = (triangleEdges t).2.1 then 1 else 0) + + (if 336 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_337 : ∀ t : Fin 270, + rowEval (d2Row 337) (fun j => if j = t then 1 else 0) = + (if 337 = (triangleEdges t).1 then 1 else 0) - + (if 337 = (triangleEdges t).2.1 then 1 else 0) + + (if 337 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_338 : ∀ t : Fin 270, + rowEval (d2Row 338) (fun j => if j = t then 1 else 0) = + (if 338 = (triangleEdges t).1 then 1 else 0) - + (if 338 = (triangleEdges t).2.1 then 1 else 0) + + (if 338 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_339 : ∀ t : Fin 270, + rowEval (d2Row 339) (fun j => if j = t then 1 else 0) = + (if 339 = (triangleEdges t).1 then 1 else 0) - + (if 339 = (triangleEdges t).2.1 then 1 else 0) + + (if 339 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_340 : ∀ t : Fin 270, + rowEval (d2Row 340) (fun j => if j = t then 1 else 0) = + (if 340 = (triangleEdges t).1 then 1 else 0) - + (if 340 = (triangleEdges t).2.1 then 1 else 0) + + (if 340 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_341 : ∀ t : Fin 270, + rowEval (d2Row 341) (fun j => if j = t then 1 else 0) = + (if 341 = (triangleEdges t).1 then 1 else 0) - + (if 341 = (triangleEdges t).2.1 then 1 else 0) + + (if 341 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_342 : ∀ t : Fin 270, + rowEval (d2Row 342) (fun j => if j = t then 1 else 0) = + (if 342 = (triangleEdges t).1 then 1 else 0) - + (if 342 = (triangleEdges t).2.1 then 1 else 0) + + (if 342 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_343 : ∀ t : Fin 270, + rowEval (d2Row 343) (fun j => if j = t then 1 else 0) = + (if 343 = (triangleEdges t).1 then 1 else 0) - + (if 343 = (triangleEdges t).2.1 then 1 else 0) + + (if 343 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_344 : ∀ t : Fin 270, + rowEval (d2Row 344) (fun j => if j = t then 1 else 0) = + (if 344 = (triangleEdges t).1 then 1 else 0) - + (if 344 = (triangleEdges t).2.1 then 1 else 0) + + (if 344 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_345 : ∀ t : Fin 270, + rowEval (d2Row 345) (fun j => if j = t then 1 else 0) = + (if 345 = (triangleEdges t).1 then 1 else 0) - + (if 345 = (triangleEdges t).2.1 then 1 else 0) + + (if 345 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_346 : ∀ t : Fin 270, + rowEval (d2Row 346) (fun j => if j = t then 1 else 0) = + (if 346 = (triangleEdges t).1 then 1 else 0) - + (if 346 = (triangleEdges t).2.1 then 1 else 0) + + (if 346 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_347 : ∀ t : Fin 270, + rowEval (d2Row 347) (fun j => if j = t then 1 else 0) = + (if 347 = (triangleEdges t).1 then 1 else 0) - + (if 347 = (triangleEdges t).2.1 then 1 else 0) + + (if 347 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_348 : ∀ t : Fin 270, + rowEval (d2Row 348) (fun j => if j = t then 1 else 0) = + (if 348 = (triangleEdges t).1 then 1 else 0) - + (if 348 = (triangleEdges t).2.1 then 1 else 0) + + (if 348 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_349 : ∀ t : Fin 270, + rowEval (d2Row 349) (fun j => if j = t then 1 else 0) = + (if 349 = (triangleEdges t).1 then 1 else 0) - + (if 349 = (triangleEdges t).2.1 then 1 else 0) + + (if 349 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_350 : ∀ t : Fin 270, + rowEval (d2Row 350) (fun j => if j = t then 1 else 0) = + (if 350 = (triangleEdges t).1 then 1 else 0) - + (if 350 = (triangleEdges t).2.1 then 1 else 0) + + (if 350 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_351 : ∀ t : Fin 270, + rowEval (d2Row 351) (fun j => if j = t then 1 else 0) = + (if 351 = (triangleEdges t).1 then 1 else 0) - + (if 351 = (triangleEdges t).2.1 then 1 else 0) + + (if 351 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_352 : ∀ t : Fin 270, + rowEval (d2Row 352) (fun j => if j = t then 1 else 0) = + (if 352 = (triangleEdges t).1 then 1 else 0) - + (if 352 = (triangleEdges t).2.1 then 1 else 0) + + (if 352 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_353 : ∀ t : Fin 270, + rowEval (d2Row 353) (fun j => if j = t then 1 else 0) = + (if 353 = (triangleEdges t).1 then 1 else 0) - + (if 353 = (triangleEdges t).2.1 then 1 else 0) + + (if 353 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_354 : ∀ t : Fin 270, + rowEval (d2Row 354) (fun j => if j = t then 1 else 0) = + (if 354 = (triangleEdges t).1 then 1 else 0) - + (if 354 = (triangleEdges t).2.1 then 1 else 0) + + (if 354 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_355 : ∀ t : Fin 270, + rowEval (d2Row 355) (fun j => if j = t then 1 else 0) = + (if 355 = (triangleEdges t).1 then 1 else 0) - + (if 355 = (triangleEdges t).2.1 then 1 else 0) + + (if 355 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_356 : ∀ t : Fin 270, + rowEval (d2Row 356) (fun j => if j = t then 1 else 0) = + (if 356 = (triangleEdges t).1 then 1 else 0) - + (if 356 = (triangleEdges t).2.1 then 1 else 0) + + (if 356 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_357 : ∀ t : Fin 270, + rowEval (d2Row 357) (fun j => if j = t then 1 else 0) = + (if 357 = (triangleEdges t).1 then 1 else 0) - + (if 357 = (triangleEdges t).2.1 then 1 else 0) + + (if 357 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_358 : ∀ t : Fin 270, + rowEval (d2Row 358) (fun j => if j = t then 1 else 0) = + (if 358 = (triangleEdges t).1 then 1 else 0) - + (if 358 = (triangleEdges t).2.1 then 1 else 0) + + (if 358 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_359 : ∀ t : Fin 270, + rowEval (d2Row 359) (fun j => if j = t then 1 else 0) = + (if 359 = (triangleEdges t).1 then 1 else 0) - + (if 359 = (triangleEdges t).2.1 then 1 else 0) + + (if 359 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_360 : ∀ t : Fin 270, + rowEval (d2Row 360) (fun j => if j = t then 1 else 0) = + (if 360 = (triangleEdges t).1 then 1 else 0) - + (if 360 = (triangleEdges t).2.1 then 1 else 0) + + (if 360 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_361 : ∀ t : Fin 270, + rowEval (d2Row 361) (fun j => if j = t then 1 else 0) = + (if 361 = (triangleEdges t).1 then 1 else 0) - + (if 361 = (triangleEdges t).2.1 then 1 else 0) + + (if 361 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_362 : ∀ t : Fin 270, + rowEval (d2Row 362) (fun j => if j = t then 1 else 0) = + (if 362 = (triangleEdges t).1 then 1 else 0) - + (if 362 = (triangleEdges t).2.1 then 1 else 0) + + (if 362 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_363 : ∀ t : Fin 270, + rowEval (d2Row 363) (fun j => if j = t then 1 else 0) = + (if 363 = (triangleEdges t).1 then 1 else 0) - + (if 363 = (triangleEdges t).2.1 then 1 else 0) + + (if 363 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_364 : ∀ t : Fin 270, + rowEval (d2Row 364) (fun j => if j = t then 1 else 0) = + (if 364 = (triangleEdges t).1 then 1 else 0) - + (if 364 = (triangleEdges t).2.1 then 1 else 0) + + (if 364 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_365 : ∀ t : Fin 270, + rowEval (d2Row 365) (fun j => if j = t then 1 else 0) = + (if 365 = (triangleEdges t).1 then 1 else 0) - + (if 365 = (triangleEdges t).2.1 then 1 else 0) + + (if 365 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_366 : ∀ t : Fin 270, + rowEval (d2Row 366) (fun j => if j = t then 1 else 0) = + (if 366 = (triangleEdges t).1 then 1 else 0) - + (if 366 = (triangleEdges t).2.1 then 1 else 0) + + (if 366 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_367 : ∀ t : Fin 270, + rowEval (d2Row 367) (fun j => if j = t then 1 else 0) = + (if 367 = (triangleEdges t).1 then 1 else 0) - + (if 367 = (triangleEdges t).2.1 then 1 else 0) + + (if 367 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_368 : ∀ t : Fin 270, + rowEval (d2Row 368) (fun j => if j = t then 1 else 0) = + (if 368 = (triangleEdges t).1 then 1 else 0) - + (if 368 = (triangleEdges t).2.1 then 1 else 0) + + (if 368 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_369 : ∀ t : Fin 270, + rowEval (d2Row 369) (fun j => if j = t then 1 else 0) = + (if 369 = (triangleEdges t).1 then 1 else 0) - + (if 369 = (triangleEdges t).2.1 then 1 else 0) + + (if 369 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_370 : ∀ t : Fin 270, + rowEval (d2Row 370) (fun j => if j = t then 1 else 0) = + (if 370 = (triangleEdges t).1 then 1 else 0) - + (if 370 = (triangleEdges t).2.1 then 1 else 0) + + (if 370 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d2_basis_cert_371 : ∀ t : Fin 270, + rowEval (d2Row 371) (fun j => if j = t then 1 else 0) = + (if 371 = (triangleEdges t).1 then 1 else 0) - + (if 371 = (triangleEdges t).2.1 then 1 else 0) + + (if 371 = (triangleEdges t).2.2 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_0 : ∀ v : Fin 103, + rowEval (d1Row 0) (h0Coeff v) = + (if 0 = v then 1 else 0) - (if 0 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_1 : ∀ v : Fin 103, + rowEval (d1Row 1) (h0Coeff v) = + (if 1 = v then 1 else 0) - (if 1 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_2 : ∀ v : Fin 103, + rowEval (d1Row 2) (h0Coeff v) = + (if 2 = v then 1 else 0) - (if 2 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_3 : ∀ v : Fin 103, + rowEval (d1Row 3) (h0Coeff v) = + (if 3 = v then 1 else 0) - (if 3 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_4 : ∀ v : Fin 103, + rowEval (d1Row 4) (h0Coeff v) = + (if 4 = v then 1 else 0) - (if 4 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_5 : ∀ v : Fin 103, + rowEval (d1Row 5) (h0Coeff v) = + (if 5 = v then 1 else 0) - (if 5 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_6 : ∀ v : Fin 103, + rowEval (d1Row 6) (h0Coeff v) = + (if 6 = v then 1 else 0) - (if 6 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_7 : ∀ v : Fin 103, + rowEval (d1Row 7) (h0Coeff v) = + (if 7 = v then 1 else 0) - (if 7 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_8 : ∀ v : Fin 103, + rowEval (d1Row 8) (h0Coeff v) = + (if 8 = v then 1 else 0) - (if 8 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_9 : ∀ v : Fin 103, + rowEval (d1Row 9) (h0Coeff v) = + (if 9 = v then 1 else 0) - (if 9 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_10 : ∀ v : Fin 103, + rowEval (d1Row 10) (h0Coeff v) = + (if 10 = v then 1 else 0) - (if 10 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_11 : ∀ v : Fin 103, + rowEval (d1Row 11) (h0Coeff v) = + (if 11 = v then 1 else 0) - (if 11 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_12 : ∀ v : Fin 103, + rowEval (d1Row 12) (h0Coeff v) = + (if 12 = v then 1 else 0) - (if 12 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_13 : ∀ v : Fin 103, + rowEval (d1Row 13) (h0Coeff v) = + (if 13 = v then 1 else 0) - (if 13 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_14 : ∀ v : Fin 103, + rowEval (d1Row 14) (h0Coeff v) = + (if 14 = v then 1 else 0) - (if 14 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_15 : ∀ v : Fin 103, + rowEval (d1Row 15) (h0Coeff v) = + (if 15 = v then 1 else 0) - (if 15 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_16 : ∀ v : Fin 103, + rowEval (d1Row 16) (h0Coeff v) = + (if 16 = v then 1 else 0) - (if 16 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_17 : ∀ v : Fin 103, + rowEval (d1Row 17) (h0Coeff v) = + (if 17 = v then 1 else 0) - (if 17 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_18 : ∀ v : Fin 103, + rowEval (d1Row 18) (h0Coeff v) = + (if 18 = v then 1 else 0) - (if 18 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_19 : ∀ v : Fin 103, + rowEval (d1Row 19) (h0Coeff v) = + (if 19 = v then 1 else 0) - (if 19 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_20 : ∀ v : Fin 103, + rowEval (d1Row 20) (h0Coeff v) = + (if 20 = v then 1 else 0) - (if 20 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_21 : ∀ v : Fin 103, + rowEval (d1Row 21) (h0Coeff v) = + (if 21 = v then 1 else 0) - (if 21 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_22 : ∀ v : Fin 103, + rowEval (d1Row 22) (h0Coeff v) = + (if 22 = v then 1 else 0) - (if 22 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_23 : ∀ v : Fin 103, + rowEval (d1Row 23) (h0Coeff v) = + (if 23 = v then 1 else 0) - (if 23 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_24 : ∀ v : Fin 103, + rowEval (d1Row 24) (h0Coeff v) = + (if 24 = v then 1 else 0) - (if 24 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_25 : ∀ v : Fin 103, + rowEval (d1Row 25) (h0Coeff v) = + (if 25 = v then 1 else 0) - (if 25 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_26 : ∀ v : Fin 103, + rowEval (d1Row 26) (h0Coeff v) = + (if 26 = v then 1 else 0) - (if 26 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_27 : ∀ v : Fin 103, + rowEval (d1Row 27) (h0Coeff v) = + (if 27 = v then 1 else 0) - (if 27 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_28 : ∀ v : Fin 103, + rowEval (d1Row 28) (h0Coeff v) = + (if 28 = v then 1 else 0) - (if 28 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_29 : ∀ v : Fin 103, + rowEval (d1Row 29) (h0Coeff v) = + (if 29 = v then 1 else 0) - (if 29 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_30 : ∀ v : Fin 103, + rowEval (d1Row 30) (h0Coeff v) = + (if 30 = v then 1 else 0) - (if 30 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_31 : ∀ v : Fin 103, + rowEval (d1Row 31) (h0Coeff v) = + (if 31 = v then 1 else 0) - (if 31 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_32 : ∀ v : Fin 103, + rowEval (d1Row 32) (h0Coeff v) = + (if 32 = v then 1 else 0) - (if 32 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_33 : ∀ v : Fin 103, + rowEval (d1Row 33) (h0Coeff v) = + (if 33 = v then 1 else 0) - (if 33 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_34 : ∀ v : Fin 103, + rowEval (d1Row 34) (h0Coeff v) = + (if 34 = v then 1 else 0) - (if 34 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_35 : ∀ v : Fin 103, + rowEval (d1Row 35) (h0Coeff v) = + (if 35 = v then 1 else 0) - (if 35 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_36 : ∀ v : Fin 103, + rowEval (d1Row 36) (h0Coeff v) = + (if 36 = v then 1 else 0) - (if 36 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_37 : ∀ v : Fin 103, + rowEval (d1Row 37) (h0Coeff v) = + (if 37 = v then 1 else 0) - (if 37 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_38 : ∀ v : Fin 103, + rowEval (d1Row 38) (h0Coeff v) = + (if 38 = v then 1 else 0) - (if 38 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_39 : ∀ v : Fin 103, + rowEval (d1Row 39) (h0Coeff v) = + (if 39 = v then 1 else 0) - (if 39 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_40 : ∀ v : Fin 103, + rowEval (d1Row 40) (h0Coeff v) = + (if 40 = v then 1 else 0) - (if 40 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_41 : ∀ v : Fin 103, + rowEval (d1Row 41) (h0Coeff v) = + (if 41 = v then 1 else 0) - (if 41 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_42 : ∀ v : Fin 103, + rowEval (d1Row 42) (h0Coeff v) = + (if 42 = v then 1 else 0) - (if 42 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_43 : ∀ v : Fin 103, + rowEval (d1Row 43) (h0Coeff v) = + (if 43 = v then 1 else 0) - (if 43 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_44 : ∀ v : Fin 103, + rowEval (d1Row 44) (h0Coeff v) = + (if 44 = v then 1 else 0) - (if 44 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_45 : ∀ v : Fin 103, + rowEval (d1Row 45) (h0Coeff v) = + (if 45 = v then 1 else 0) - (if 45 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_46 : ∀ v : Fin 103, + rowEval (d1Row 46) (h0Coeff v) = + (if 46 = v then 1 else 0) - (if 46 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_47 : ∀ v : Fin 103, + rowEval (d1Row 47) (h0Coeff v) = + (if 47 = v then 1 else 0) - (if 47 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_48 : ∀ v : Fin 103, + rowEval (d1Row 48) (h0Coeff v) = + (if 48 = v then 1 else 0) - (if 48 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_49 : ∀ v : Fin 103, + rowEval (d1Row 49) (h0Coeff v) = + (if 49 = v then 1 else 0) - (if 49 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_50 : ∀ v : Fin 103, + rowEval (d1Row 50) (h0Coeff v) = + (if 50 = v then 1 else 0) - (if 50 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_51 : ∀ v : Fin 103, + rowEval (d1Row 51) (h0Coeff v) = + (if 51 = v then 1 else 0) - (if 51 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_52 : ∀ v : Fin 103, + rowEval (d1Row 52) (h0Coeff v) = + (if 52 = v then 1 else 0) - (if 52 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_53 : ∀ v : Fin 103, + rowEval (d1Row 53) (h0Coeff v) = + (if 53 = v then 1 else 0) - (if 53 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_54 : ∀ v : Fin 103, + rowEval (d1Row 54) (h0Coeff v) = + (if 54 = v then 1 else 0) - (if 54 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_55 : ∀ v : Fin 103, + rowEval (d1Row 55) (h0Coeff v) = + (if 55 = v then 1 else 0) - (if 55 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_56 : ∀ v : Fin 103, + rowEval (d1Row 56) (h0Coeff v) = + (if 56 = v then 1 else 0) - (if 56 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_57 : ∀ v : Fin 103, + rowEval (d1Row 57) (h0Coeff v) = + (if 57 = v then 1 else 0) - (if 57 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_58 : ∀ v : Fin 103, + rowEval (d1Row 58) (h0Coeff v) = + (if 58 = v then 1 else 0) - (if 58 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_59 : ∀ v : Fin 103, + rowEval (d1Row 59) (h0Coeff v) = + (if 59 = v then 1 else 0) - (if 59 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_60 : ∀ v : Fin 103, + rowEval (d1Row 60) (h0Coeff v) = + (if 60 = v then 1 else 0) - (if 60 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_61 : ∀ v : Fin 103, + rowEval (d1Row 61) (h0Coeff v) = + (if 61 = v then 1 else 0) - (if 61 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_62 : ∀ v : Fin 103, + rowEval (d1Row 62) (h0Coeff v) = + (if 62 = v then 1 else 0) - (if 62 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_63 : ∀ v : Fin 103, + rowEval (d1Row 63) (h0Coeff v) = + (if 63 = v then 1 else 0) - (if 63 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_64 : ∀ v : Fin 103, + rowEval (d1Row 64) (h0Coeff v) = + (if 64 = v then 1 else 0) - (if 64 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_65 : ∀ v : Fin 103, + rowEval (d1Row 65) (h0Coeff v) = + (if 65 = v then 1 else 0) - (if 65 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_66 : ∀ v : Fin 103, + rowEval (d1Row 66) (h0Coeff v) = + (if 66 = v then 1 else 0) - (if 66 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_67 : ∀ v : Fin 103, + rowEval (d1Row 67) (h0Coeff v) = + (if 67 = v then 1 else 0) - (if 67 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_68 : ∀ v : Fin 103, + rowEval (d1Row 68) (h0Coeff v) = + (if 68 = v then 1 else 0) - (if 68 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_69 : ∀ v : Fin 103, + rowEval (d1Row 69) (h0Coeff v) = + (if 69 = v then 1 else 0) - (if 69 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_70 : ∀ v : Fin 103, + rowEval (d1Row 70) (h0Coeff v) = + (if 70 = v then 1 else 0) - (if 70 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_71 : ∀ v : Fin 103, + rowEval (d1Row 71) (h0Coeff v) = + (if 71 = v then 1 else 0) - (if 71 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_72 : ∀ v : Fin 103, + rowEval (d1Row 72) (h0Coeff v) = + (if 72 = v then 1 else 0) - (if 72 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_73 : ∀ v : Fin 103, + rowEval (d1Row 73) (h0Coeff v) = + (if 73 = v then 1 else 0) - (if 73 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_74 : ∀ v : Fin 103, + rowEval (d1Row 74) (h0Coeff v) = + (if 74 = v then 1 else 0) - (if 74 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_75 : ∀ v : Fin 103, + rowEval (d1Row 75) (h0Coeff v) = + (if 75 = v then 1 else 0) - (if 75 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_76 : ∀ v : Fin 103, + rowEval (d1Row 76) (h0Coeff v) = + (if 76 = v then 1 else 0) - (if 76 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_77 : ∀ v : Fin 103, + rowEval (d1Row 77) (h0Coeff v) = + (if 77 = v then 1 else 0) - (if 77 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_78 : ∀ v : Fin 103, + rowEval (d1Row 78) (h0Coeff v) = + (if 78 = v then 1 else 0) - (if 78 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_79 : ∀ v : Fin 103, + rowEval (d1Row 79) (h0Coeff v) = + (if 79 = v then 1 else 0) - (if 79 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_80 : ∀ v : Fin 103, + rowEval (d1Row 80) (h0Coeff v) = + (if 80 = v then 1 else 0) - (if 80 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_81 : ∀ v : Fin 103, + rowEval (d1Row 81) (h0Coeff v) = + (if 81 = v then 1 else 0) - (if 81 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_82 : ∀ v : Fin 103, + rowEval (d1Row 82) (h0Coeff v) = + (if 82 = v then 1 else 0) - (if 82 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_83 : ∀ v : Fin 103, + rowEval (d1Row 83) (h0Coeff v) = + (if 83 = v then 1 else 0) - (if 83 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_84 : ∀ v : Fin 103, + rowEval (d1Row 84) (h0Coeff v) = + (if 84 = v then 1 else 0) - (if 84 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_85 : ∀ v : Fin 103, + rowEval (d1Row 85) (h0Coeff v) = + (if 85 = v then 1 else 0) - (if 85 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_86 : ∀ v : Fin 103, + rowEval (d1Row 86) (h0Coeff v) = + (if 86 = v then 1 else 0) - (if 86 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_87 : ∀ v : Fin 103, + rowEval (d1Row 87) (h0Coeff v) = + (if 87 = v then 1 else 0) - (if 87 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_88 : ∀ v : Fin 103, + rowEval (d1Row 88) (h0Coeff v) = + (if 88 = v then 1 else 0) - (if 88 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_89 : ∀ v : Fin 103, + rowEval (d1Row 89) (h0Coeff v) = + (if 89 = v then 1 else 0) - (if 89 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_90 : ∀ v : Fin 103, + rowEval (d1Row 90) (h0Coeff v) = + (if 90 = v then 1 else 0) - (if 90 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_91 : ∀ v : Fin 103, + rowEval (d1Row 91) (h0Coeff v) = + (if 91 = v then 1 else 0) - (if 91 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_92 : ∀ v : Fin 103, + rowEval (d1Row 92) (h0Coeff v) = + (if 92 = v then 1 else 0) - (if 92 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_93 : ∀ v : Fin 103, + rowEval (d1Row 93) (h0Coeff v) = + (if 93 = v then 1 else 0) - (if 93 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_94 : ∀ v : Fin 103, + rowEval (d1Row 94) (h0Coeff v) = + (if 94 = v then 1 else 0) - (if 94 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_95 : ∀ v : Fin 103, + rowEval (d1Row 95) (h0Coeff v) = + (if 95 = v then 1 else 0) - (if 95 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_96 : ∀ v : Fin 103, + rowEval (d1Row 96) (h0Coeff v) = + (if 96 = v then 1 else 0) - (if 96 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_97 : ∀ v : Fin 103, + rowEval (d1Row 97) (h0Coeff v) = + (if 97 = v then 1 else 0) - (if 97 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_98 : ∀ v : Fin 103, + rowEval (d1Row 98) (h0Coeff v) = + (if 98 = v then 1 else 0) - (if 98 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_99 : ∀ v : Fin 103, + rowEval (d1Row 99) (h0Coeff v) = + (if 99 = v then 1 else 0) - (if 99 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_100 : ∀ v : Fin 103, + rowEval (d1Row 100) (h0Coeff v) = + (if 100 = v then 1 else 0) - (if 100 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_101 : ∀ v : Fin 103, + rowEval (d1Row 101) (h0Coeff v) = + (if 101 = v then 1 else 0) - (if 101 = 0 then 1 else 0) := by decide +kernel + +theorem d1_h0_cert_102 : ∀ v : Fin 103, + rowEval (d1Row 102) (h0Coeff v) = + (if 102 = v then 1 else 0) - (if 102 = 0 then 1 else 0) := by decide +kernel + +theorem h1_boundary_cert (t : Fin 270) (j : Fin 270) : + h1Coeff (triangleEdges t).1 j - h1Coeff (triangleEdges t).2.1 j + + h1Coeff (triangleEdges t).2.2 j = if j = t then 1 else 0 := by + fin_cases t + · exact h1_boundary_cert_0 j + · exact h1_boundary_cert_1 j + · exact h1_boundary_cert_2 j + · exact h1_boundary_cert_3 j + · exact h1_boundary_cert_4 j + · exact h1_boundary_cert_5 j + · exact h1_boundary_cert_6 j + · exact h1_boundary_cert_7 j + · exact h1_boundary_cert_8 j + · exact h1_boundary_cert_9 j + · exact h1_boundary_cert_10 j + · exact h1_boundary_cert_11 j + · exact h1_boundary_cert_12 j + · exact h1_boundary_cert_13 j + · exact h1_boundary_cert_14 j + · exact h1_boundary_cert_15 j + · exact h1_boundary_cert_16 j + · exact h1_boundary_cert_17 j + · exact h1_boundary_cert_18 j + · exact h1_boundary_cert_19 j + · exact h1_boundary_cert_20 j + · exact h1_boundary_cert_21 j + · exact h1_boundary_cert_22 j + · exact h1_boundary_cert_23 j + · exact h1_boundary_cert_24 j + · exact h1_boundary_cert_25 j + · exact h1_boundary_cert_26 j + · exact h1_boundary_cert_27 j + · exact h1_boundary_cert_28 j + · exact h1_boundary_cert_29 j + · exact h1_boundary_cert_30 j + · exact h1_boundary_cert_31 j + · exact h1_boundary_cert_32 j + · exact h1_boundary_cert_33 j + · exact h1_boundary_cert_34 j + · exact h1_boundary_cert_35 j + · exact h1_boundary_cert_36 j + · exact h1_boundary_cert_37 j + · exact h1_boundary_cert_38 j + · exact h1_boundary_cert_39 j + · exact h1_boundary_cert_40 j + · exact h1_boundary_cert_41 j + · exact h1_boundary_cert_42 j + · exact h1_boundary_cert_43 j + · exact h1_boundary_cert_44 j + · exact h1_boundary_cert_45 j + · exact h1_boundary_cert_46 j + · exact h1_boundary_cert_47 j + · exact h1_boundary_cert_48 j + · exact h1_boundary_cert_49 j + · exact h1_boundary_cert_50 j + · exact h1_boundary_cert_51 j + · exact h1_boundary_cert_52 j + · exact h1_boundary_cert_53 j + · exact h1_boundary_cert_54 j + · exact h1_boundary_cert_55 j + · exact h1_boundary_cert_56 j + · exact h1_boundary_cert_57 j + · exact h1_boundary_cert_58 j + · exact h1_boundary_cert_59 j + · exact h1_boundary_cert_60 j + · exact h1_boundary_cert_61 j + · exact h1_boundary_cert_62 j + · exact h1_boundary_cert_63 j + · exact h1_boundary_cert_64 j + · exact h1_boundary_cert_65 j + · exact h1_boundary_cert_66 j + · exact h1_boundary_cert_67 j + · exact h1_boundary_cert_68 j + · exact h1_boundary_cert_69 j + · exact h1_boundary_cert_70 j + · exact h1_boundary_cert_71 j + · exact h1_boundary_cert_72 j + · exact h1_boundary_cert_73 j + · exact h1_boundary_cert_74 j + · exact h1_boundary_cert_75 j + · exact h1_boundary_cert_76 j + · exact h1_boundary_cert_77 j + · exact h1_boundary_cert_78 j + · exact h1_boundary_cert_79 j + · exact h1_boundary_cert_80 j + · exact h1_boundary_cert_81 j + · exact h1_boundary_cert_82 j + · exact h1_boundary_cert_83 j + · exact h1_boundary_cert_84 j + · exact h1_boundary_cert_85 j + · exact h1_boundary_cert_86 j + · exact h1_boundary_cert_87 j + · exact h1_boundary_cert_88 j + · exact h1_boundary_cert_89 j + · exact h1_boundary_cert_90 j + · exact h1_boundary_cert_91 j + · exact h1_boundary_cert_92 j + · exact h1_boundary_cert_93 j + · exact h1_boundary_cert_94 j + · exact h1_boundary_cert_95 j + · exact h1_boundary_cert_96 j + · exact h1_boundary_cert_97 j + · exact h1_boundary_cert_98 j + · exact h1_boundary_cert_99 j + · exact h1_boundary_cert_100 j + · exact h1_boundary_cert_101 j + · exact h1_boundary_cert_102 j + · exact h1_boundary_cert_103 j + · exact h1_boundary_cert_104 j + · exact h1_boundary_cert_105 j + · exact h1_boundary_cert_106 j + · exact h1_boundary_cert_107 j + · exact h1_boundary_cert_108 j + · exact h1_boundary_cert_109 j + · exact h1_boundary_cert_110 j + · exact h1_boundary_cert_111 j + · exact h1_boundary_cert_112 j + · exact h1_boundary_cert_113 j + · exact h1_boundary_cert_114 j + · exact h1_boundary_cert_115 j + · exact h1_boundary_cert_116 j + · exact h1_boundary_cert_117 j + · exact h1_boundary_cert_118 j + · exact h1_boundary_cert_119 j + · exact h1_boundary_cert_120 j + · exact h1_boundary_cert_121 j + · exact h1_boundary_cert_122 j + · exact h1_boundary_cert_123 j + · exact h1_boundary_cert_124 j + · exact h1_boundary_cert_125 j + · exact h1_boundary_cert_126 j + · exact h1_boundary_cert_127 j + · exact h1_boundary_cert_128 j + · exact h1_boundary_cert_129 j + · exact h1_boundary_cert_130 j + · exact h1_boundary_cert_131 j + · exact h1_boundary_cert_132 j + · exact h1_boundary_cert_133 j + · exact h1_boundary_cert_134 j + · exact h1_boundary_cert_135 j + · exact h1_boundary_cert_136 j + · exact h1_boundary_cert_137 j + · exact h1_boundary_cert_138 j + · exact h1_boundary_cert_139 j + · exact h1_boundary_cert_140 j + · exact h1_boundary_cert_141 j + · exact h1_boundary_cert_142 j + · exact h1_boundary_cert_143 j + · exact h1_boundary_cert_144 j + · exact h1_boundary_cert_145 j + · exact h1_boundary_cert_146 j + · exact h1_boundary_cert_147 j + · exact h1_boundary_cert_148 j + · exact h1_boundary_cert_149 j + · exact h1_boundary_cert_150 j + · exact h1_boundary_cert_151 j + · exact h1_boundary_cert_152 j + · exact h1_boundary_cert_153 j + · exact h1_boundary_cert_154 j + · exact h1_boundary_cert_155 j + · exact h1_boundary_cert_156 j + · exact h1_boundary_cert_157 j + · exact h1_boundary_cert_158 j + · exact h1_boundary_cert_159 j + · exact h1_boundary_cert_160 j + · exact h1_boundary_cert_161 j + · exact h1_boundary_cert_162 j + · exact h1_boundary_cert_163 j + · exact h1_boundary_cert_164 j + · exact h1_boundary_cert_165 j + · exact h1_boundary_cert_166 j + · exact h1_boundary_cert_167 j + · exact h1_boundary_cert_168 j + · exact h1_boundary_cert_169 j + · exact h1_boundary_cert_170 j + · exact h1_boundary_cert_171 j + · exact h1_boundary_cert_172 j + · exact h1_boundary_cert_173 j + · exact h1_boundary_cert_174 j + · exact h1_boundary_cert_175 j + · exact h1_boundary_cert_176 j + · exact h1_boundary_cert_177 j + · exact h1_boundary_cert_178 j + · exact h1_boundary_cert_179 j + · exact h1_boundary_cert_180 j + · exact h1_boundary_cert_181 j + · exact h1_boundary_cert_182 j + · exact h1_boundary_cert_183 j + · exact h1_boundary_cert_184 j + · exact h1_boundary_cert_185 j + · exact h1_boundary_cert_186 j + · exact h1_boundary_cert_187 j + · exact h1_boundary_cert_188 j + · exact h1_boundary_cert_189 j + · exact h1_boundary_cert_190 j + · exact h1_boundary_cert_191 j + · exact h1_boundary_cert_192 j + · exact h1_boundary_cert_193 j + · exact h1_boundary_cert_194 j + · exact h1_boundary_cert_195 j + · exact h1_boundary_cert_196 j + · exact h1_boundary_cert_197 j + · exact h1_boundary_cert_198 j + · exact h1_boundary_cert_199 j + · exact h1_boundary_cert_200 j + · exact h1_boundary_cert_201 j + · exact h1_boundary_cert_202 j + · exact h1_boundary_cert_203 j + · exact h1_boundary_cert_204 j + · exact h1_boundary_cert_205 j + · exact h1_boundary_cert_206 j + · exact h1_boundary_cert_207 j + · exact h1_boundary_cert_208 j + · exact h1_boundary_cert_209 j + · exact h1_boundary_cert_210 j + · exact h1_boundary_cert_211 j + · exact h1_boundary_cert_212 j + · exact h1_boundary_cert_213 j + · exact h1_boundary_cert_214 j + · exact h1_boundary_cert_215 j + · exact h1_boundary_cert_216 j + · exact h1_boundary_cert_217 j + · exact h1_boundary_cert_218 j + · exact h1_boundary_cert_219 j + · exact h1_boundary_cert_220 j + · exact h1_boundary_cert_221 j + · exact h1_boundary_cert_222 j + · exact h1_boundary_cert_223 j + · exact h1_boundary_cert_224 j + · exact h1_boundary_cert_225 j + · exact h1_boundary_cert_226 j + · exact h1_boundary_cert_227 j + · exact h1_boundary_cert_228 j + · exact h1_boundary_cert_229 j + · exact h1_boundary_cert_230 j + · exact h1_boundary_cert_231 j + · exact h1_boundary_cert_232 j + · exact h1_boundary_cert_233 j + · exact h1_boundary_cert_234 j + · exact h1_boundary_cert_235 j + · exact h1_boundary_cert_236 j + · exact h1_boundary_cert_237 j + · exact h1_boundary_cert_238 j + · exact h1_boundary_cert_239 j + · exact h1_boundary_cert_240 j + · exact h1_boundary_cert_241 j + · exact h1_boundary_cert_242 j + · exact h1_boundary_cert_243 j + · exact h1_boundary_cert_244 j + · exact h1_boundary_cert_245 j + · exact h1_boundary_cert_246 j + · exact h1_boundary_cert_247 j + · exact h1_boundary_cert_248 j + · exact h1_boundary_cert_249 j + · exact h1_boundary_cert_250 j + · exact h1_boundary_cert_251 j + · exact h1_boundary_cert_252 j + · exact h1_boundary_cert_253 j + · exact h1_boundary_cert_254 j + · exact h1_boundary_cert_255 j + · exact h1_boundary_cert_256 j + · exact h1_boundary_cert_257 j + · exact h1_boundary_cert_258 j + · exact h1_boundary_cert_259 j + · exact h1_boundary_cert_260 j + · exact h1_boundary_cert_261 j + · exact h1_boundary_cert_262 j + · exact h1_boundary_cert_263 j + · exact h1_boundary_cert_264 j + · exact h1_boundary_cert_265 j + · exact h1_boundary_cert_266 j + · exact h1_boundary_cert_267 j + · exact h1_boundary_cert_268 j + · exact h1_boundary_cert_269 j + +theorem d1_basis_cert (i : Fin 103) (e : Fin 372) : + rowEval (d1Row i) (fun j => if j = e then 1 else 0) = + (if i = (edge e).2 then 1 else 0) - (if i = (edge e).1 then 1 else 0) := by + fin_cases i + · exact d1_basis_cert_0 e + · exact d1_basis_cert_1 e + · exact d1_basis_cert_2 e + · exact d1_basis_cert_3 e + · exact d1_basis_cert_4 e + · exact d1_basis_cert_5 e + · exact d1_basis_cert_6 e + · exact d1_basis_cert_7 e + · exact d1_basis_cert_8 e + · exact d1_basis_cert_9 e + · exact d1_basis_cert_10 e + · exact d1_basis_cert_11 e + · exact d1_basis_cert_12 e + · exact d1_basis_cert_13 e + · exact d1_basis_cert_14 e + · exact d1_basis_cert_15 e + · exact d1_basis_cert_16 e + · exact d1_basis_cert_17 e + · exact d1_basis_cert_18 e + · exact d1_basis_cert_19 e + · exact d1_basis_cert_20 e + · exact d1_basis_cert_21 e + · exact d1_basis_cert_22 e + · exact d1_basis_cert_23 e + · exact d1_basis_cert_24 e + · exact d1_basis_cert_25 e + · exact d1_basis_cert_26 e + · exact d1_basis_cert_27 e + · exact d1_basis_cert_28 e + · exact d1_basis_cert_29 e + · exact d1_basis_cert_30 e + · exact d1_basis_cert_31 e + · exact d1_basis_cert_32 e + · exact d1_basis_cert_33 e + · exact d1_basis_cert_34 e + · exact d1_basis_cert_35 e + · exact d1_basis_cert_36 e + · exact d1_basis_cert_37 e + · exact d1_basis_cert_38 e + · exact d1_basis_cert_39 e + · exact d1_basis_cert_40 e + · exact d1_basis_cert_41 e + · exact d1_basis_cert_42 e + · exact d1_basis_cert_43 e + · exact d1_basis_cert_44 e + · exact d1_basis_cert_45 e + · exact d1_basis_cert_46 e + · exact d1_basis_cert_47 e + · exact d1_basis_cert_48 e + · exact d1_basis_cert_49 e + · exact d1_basis_cert_50 e + · exact d1_basis_cert_51 e + · exact d1_basis_cert_52 e + · exact d1_basis_cert_53 e + · exact d1_basis_cert_54 e + · exact d1_basis_cert_55 e + · exact d1_basis_cert_56 e + · exact d1_basis_cert_57 e + · exact d1_basis_cert_58 e + · exact d1_basis_cert_59 e + · exact d1_basis_cert_60 e + · exact d1_basis_cert_61 e + · exact d1_basis_cert_62 e + · exact d1_basis_cert_63 e + · exact d1_basis_cert_64 e + · exact d1_basis_cert_65 e + · exact d1_basis_cert_66 e + · exact d1_basis_cert_67 e + · exact d1_basis_cert_68 e + · exact d1_basis_cert_69 e + · exact d1_basis_cert_70 e + · exact d1_basis_cert_71 e + · exact d1_basis_cert_72 e + · exact d1_basis_cert_73 e + · exact d1_basis_cert_74 e + · exact d1_basis_cert_75 e + · exact d1_basis_cert_76 e + · exact d1_basis_cert_77 e + · exact d1_basis_cert_78 e + · exact d1_basis_cert_79 e + · exact d1_basis_cert_80 e + · exact d1_basis_cert_81 e + · exact d1_basis_cert_82 e + · exact d1_basis_cert_83 e + · exact d1_basis_cert_84 e + · exact d1_basis_cert_85 e + · exact d1_basis_cert_86 e + · exact d1_basis_cert_87 e + · exact d1_basis_cert_88 e + · exact d1_basis_cert_89 e + · exact d1_basis_cert_90 e + · exact d1_basis_cert_91 e + · exact d1_basis_cert_92 e + · exact d1_basis_cert_93 e + · exact d1_basis_cert_94 e + · exact d1_basis_cert_95 e + · exact d1_basis_cert_96 e + · exact d1_basis_cert_97 e + · exact d1_basis_cert_98 e + · exact d1_basis_cert_99 e + · exact d1_basis_cert_100 e + · exact d1_basis_cert_101 e + · exact d1_basis_cert_102 e + +theorem d2_basis_cert (e : Fin 372) (t : Fin 270) : + rowEval (d2Row e) (fun i => if i = t then 1 else 0) = + (if e = (triangleEdges t).1 then 1 else 0) - + (if e = (triangleEdges t).2.1 then 1 else 0) + (if e = (triangleEdges t).2.2 then 1 else 0) := by + fin_cases e + · exact d2_basis_cert_0 t + · exact d2_basis_cert_1 t + · exact d2_basis_cert_2 t + · exact d2_basis_cert_3 t + · exact d2_basis_cert_4 t + · exact d2_basis_cert_5 t + · exact d2_basis_cert_6 t + · exact d2_basis_cert_7 t + · exact d2_basis_cert_8 t + · exact d2_basis_cert_9 t + · exact d2_basis_cert_10 t + · exact d2_basis_cert_11 t + · exact d2_basis_cert_12 t + · exact d2_basis_cert_13 t + · exact d2_basis_cert_14 t + · exact d2_basis_cert_15 t + · exact d2_basis_cert_16 t + · exact d2_basis_cert_17 t + · exact d2_basis_cert_18 t + · exact d2_basis_cert_19 t + · exact d2_basis_cert_20 t + · exact d2_basis_cert_21 t + · exact d2_basis_cert_22 t + · exact d2_basis_cert_23 t + · exact d2_basis_cert_24 t + · exact d2_basis_cert_25 t + · exact d2_basis_cert_26 t + · exact d2_basis_cert_27 t + · exact d2_basis_cert_28 t + · exact d2_basis_cert_29 t + · exact d2_basis_cert_30 t + · exact d2_basis_cert_31 t + · exact d2_basis_cert_32 t + · exact d2_basis_cert_33 t + · exact d2_basis_cert_34 t + · exact d2_basis_cert_35 t + · exact d2_basis_cert_36 t + · exact d2_basis_cert_37 t + · exact d2_basis_cert_38 t + · exact d2_basis_cert_39 t + · exact d2_basis_cert_40 t + · exact d2_basis_cert_41 t + · exact d2_basis_cert_42 t + · exact d2_basis_cert_43 t + · exact d2_basis_cert_44 t + · exact d2_basis_cert_45 t + · exact d2_basis_cert_46 t + · exact d2_basis_cert_47 t + · exact d2_basis_cert_48 t + · exact d2_basis_cert_49 t + · exact d2_basis_cert_50 t + · exact d2_basis_cert_51 t + · exact d2_basis_cert_52 t + · exact d2_basis_cert_53 t + · exact d2_basis_cert_54 t + · exact d2_basis_cert_55 t + · exact d2_basis_cert_56 t + · exact d2_basis_cert_57 t + · exact d2_basis_cert_58 t + · exact d2_basis_cert_59 t + · exact d2_basis_cert_60 t + · exact d2_basis_cert_61 t + · exact d2_basis_cert_62 t + · exact d2_basis_cert_63 t + · exact d2_basis_cert_64 t + · exact d2_basis_cert_65 t + · exact d2_basis_cert_66 t + · exact d2_basis_cert_67 t + · exact d2_basis_cert_68 t + · exact d2_basis_cert_69 t + · exact d2_basis_cert_70 t + · exact d2_basis_cert_71 t + · exact d2_basis_cert_72 t + · exact d2_basis_cert_73 t + · exact d2_basis_cert_74 t + · exact d2_basis_cert_75 t + · exact d2_basis_cert_76 t + · exact d2_basis_cert_77 t + · exact d2_basis_cert_78 t + · exact d2_basis_cert_79 t + · exact d2_basis_cert_80 t + · exact d2_basis_cert_81 t + · exact d2_basis_cert_82 t + · exact d2_basis_cert_83 t + · exact d2_basis_cert_84 t + · exact d2_basis_cert_85 t + · exact d2_basis_cert_86 t + · exact d2_basis_cert_87 t + · exact d2_basis_cert_88 t + · exact d2_basis_cert_89 t + · exact d2_basis_cert_90 t + · exact d2_basis_cert_91 t + · exact d2_basis_cert_92 t + · exact d2_basis_cert_93 t + · exact d2_basis_cert_94 t + · exact d2_basis_cert_95 t + · exact d2_basis_cert_96 t + · exact d2_basis_cert_97 t + · exact d2_basis_cert_98 t + · exact d2_basis_cert_99 t + · exact d2_basis_cert_100 t + · exact d2_basis_cert_101 t + · exact d2_basis_cert_102 t + · exact d2_basis_cert_103 t + · exact d2_basis_cert_104 t + · exact d2_basis_cert_105 t + · exact d2_basis_cert_106 t + · exact d2_basis_cert_107 t + · exact d2_basis_cert_108 t + · exact d2_basis_cert_109 t + · exact d2_basis_cert_110 t + · exact d2_basis_cert_111 t + · exact d2_basis_cert_112 t + · exact d2_basis_cert_113 t + · exact d2_basis_cert_114 t + · exact d2_basis_cert_115 t + · exact d2_basis_cert_116 t + · exact d2_basis_cert_117 t + · exact d2_basis_cert_118 t + · exact d2_basis_cert_119 t + · exact d2_basis_cert_120 t + · exact d2_basis_cert_121 t + · exact d2_basis_cert_122 t + · exact d2_basis_cert_123 t + · exact d2_basis_cert_124 t + · exact d2_basis_cert_125 t + · exact d2_basis_cert_126 t + · exact d2_basis_cert_127 t + · exact d2_basis_cert_128 t + · exact d2_basis_cert_129 t + · exact d2_basis_cert_130 t + · exact d2_basis_cert_131 t + · exact d2_basis_cert_132 t + · exact d2_basis_cert_133 t + · exact d2_basis_cert_134 t + · exact d2_basis_cert_135 t + · exact d2_basis_cert_136 t + · exact d2_basis_cert_137 t + · exact d2_basis_cert_138 t + · exact d2_basis_cert_139 t + · exact d2_basis_cert_140 t + · exact d2_basis_cert_141 t + · exact d2_basis_cert_142 t + · exact d2_basis_cert_143 t + · exact d2_basis_cert_144 t + · exact d2_basis_cert_145 t + · exact d2_basis_cert_146 t + · exact d2_basis_cert_147 t + · exact d2_basis_cert_148 t + · exact d2_basis_cert_149 t + · exact d2_basis_cert_150 t + · exact d2_basis_cert_151 t + · exact d2_basis_cert_152 t + · exact d2_basis_cert_153 t + · exact d2_basis_cert_154 t + · exact d2_basis_cert_155 t + · exact d2_basis_cert_156 t + · exact d2_basis_cert_157 t + · exact d2_basis_cert_158 t + · exact d2_basis_cert_159 t + · exact d2_basis_cert_160 t + · exact d2_basis_cert_161 t + · exact d2_basis_cert_162 t + · exact d2_basis_cert_163 t + · exact d2_basis_cert_164 t + · exact d2_basis_cert_165 t + · exact d2_basis_cert_166 t + · exact d2_basis_cert_167 t + · exact d2_basis_cert_168 t + · exact d2_basis_cert_169 t + · exact d2_basis_cert_170 t + · exact d2_basis_cert_171 t + · exact d2_basis_cert_172 t + · exact d2_basis_cert_173 t + · exact d2_basis_cert_174 t + · exact d2_basis_cert_175 t + · exact d2_basis_cert_176 t + · exact d2_basis_cert_177 t + · exact d2_basis_cert_178 t + · exact d2_basis_cert_179 t + · exact d2_basis_cert_180 t + · exact d2_basis_cert_181 t + · exact d2_basis_cert_182 t + · exact d2_basis_cert_183 t + · exact d2_basis_cert_184 t + · exact d2_basis_cert_185 t + · exact d2_basis_cert_186 t + · exact d2_basis_cert_187 t + · exact d2_basis_cert_188 t + · exact d2_basis_cert_189 t + · exact d2_basis_cert_190 t + · exact d2_basis_cert_191 t + · exact d2_basis_cert_192 t + · exact d2_basis_cert_193 t + · exact d2_basis_cert_194 t + · exact d2_basis_cert_195 t + · exact d2_basis_cert_196 t + · exact d2_basis_cert_197 t + · exact d2_basis_cert_198 t + · exact d2_basis_cert_199 t + · exact d2_basis_cert_200 t + · exact d2_basis_cert_201 t + · exact d2_basis_cert_202 t + · exact d2_basis_cert_203 t + · exact d2_basis_cert_204 t + · exact d2_basis_cert_205 t + · exact d2_basis_cert_206 t + · exact d2_basis_cert_207 t + · exact d2_basis_cert_208 t + · exact d2_basis_cert_209 t + · exact d2_basis_cert_210 t + · exact d2_basis_cert_211 t + · exact d2_basis_cert_212 t + · exact d2_basis_cert_213 t + · exact d2_basis_cert_214 t + · exact d2_basis_cert_215 t + · exact d2_basis_cert_216 t + · exact d2_basis_cert_217 t + · exact d2_basis_cert_218 t + · exact d2_basis_cert_219 t + · exact d2_basis_cert_220 t + · exact d2_basis_cert_221 t + · exact d2_basis_cert_222 t + · exact d2_basis_cert_223 t + · exact d2_basis_cert_224 t + · exact d2_basis_cert_225 t + · exact d2_basis_cert_226 t + · exact d2_basis_cert_227 t + · exact d2_basis_cert_228 t + · exact d2_basis_cert_229 t + · exact d2_basis_cert_230 t + · exact d2_basis_cert_231 t + · exact d2_basis_cert_232 t + · exact d2_basis_cert_233 t + · exact d2_basis_cert_234 t + · exact d2_basis_cert_235 t + · exact d2_basis_cert_236 t + · exact d2_basis_cert_237 t + · exact d2_basis_cert_238 t + · exact d2_basis_cert_239 t + · exact d2_basis_cert_240 t + · exact d2_basis_cert_241 t + · exact d2_basis_cert_242 t + · exact d2_basis_cert_243 t + · exact d2_basis_cert_244 t + · exact d2_basis_cert_245 t + · exact d2_basis_cert_246 t + · exact d2_basis_cert_247 t + · exact d2_basis_cert_248 t + · exact d2_basis_cert_249 t + · exact d2_basis_cert_250 t + · exact d2_basis_cert_251 t + · exact d2_basis_cert_252 t + · exact d2_basis_cert_253 t + · exact d2_basis_cert_254 t + · exact d2_basis_cert_255 t + · exact d2_basis_cert_256 t + · exact d2_basis_cert_257 t + · exact d2_basis_cert_258 t + · exact d2_basis_cert_259 t + · exact d2_basis_cert_260 t + · exact d2_basis_cert_261 t + · exact d2_basis_cert_262 t + · exact d2_basis_cert_263 t + · exact d2_basis_cert_264 t + · exact d2_basis_cert_265 t + · exact d2_basis_cert_266 t + · exact d2_basis_cert_267 t + · exact d2_basis_cert_268 t + · exact d2_basis_cert_269 t + · exact d2_basis_cert_270 t + · exact d2_basis_cert_271 t + · exact d2_basis_cert_272 t + · exact d2_basis_cert_273 t + · exact d2_basis_cert_274 t + · exact d2_basis_cert_275 t + · exact d2_basis_cert_276 t + · exact d2_basis_cert_277 t + · exact d2_basis_cert_278 t + · exact d2_basis_cert_279 t + · exact d2_basis_cert_280 t + · exact d2_basis_cert_281 t + · exact d2_basis_cert_282 t + · exact d2_basis_cert_283 t + · exact d2_basis_cert_284 t + · exact d2_basis_cert_285 t + · exact d2_basis_cert_286 t + · exact d2_basis_cert_287 t + · exact d2_basis_cert_288 t + · exact d2_basis_cert_289 t + · exact d2_basis_cert_290 t + · exact d2_basis_cert_291 t + · exact d2_basis_cert_292 t + · exact d2_basis_cert_293 t + · exact d2_basis_cert_294 t + · exact d2_basis_cert_295 t + · exact d2_basis_cert_296 t + · exact d2_basis_cert_297 t + · exact d2_basis_cert_298 t + · exact d2_basis_cert_299 t + · exact d2_basis_cert_300 t + · exact d2_basis_cert_301 t + · exact d2_basis_cert_302 t + · exact d2_basis_cert_303 t + · exact d2_basis_cert_304 t + · exact d2_basis_cert_305 t + · exact d2_basis_cert_306 t + · exact d2_basis_cert_307 t + · exact d2_basis_cert_308 t + · exact d2_basis_cert_309 t + · exact d2_basis_cert_310 t + · exact d2_basis_cert_311 t + · exact d2_basis_cert_312 t + · exact d2_basis_cert_313 t + · exact d2_basis_cert_314 t + · exact d2_basis_cert_315 t + · exact d2_basis_cert_316 t + · exact d2_basis_cert_317 t + · exact d2_basis_cert_318 t + · exact d2_basis_cert_319 t + · exact d2_basis_cert_320 t + · exact d2_basis_cert_321 t + · exact d2_basis_cert_322 t + · exact d2_basis_cert_323 t + · exact d2_basis_cert_324 t + · exact d2_basis_cert_325 t + · exact d2_basis_cert_326 t + · exact d2_basis_cert_327 t + · exact d2_basis_cert_328 t + · exact d2_basis_cert_329 t + · exact d2_basis_cert_330 t + · exact d2_basis_cert_331 t + · exact d2_basis_cert_332 t + · exact d2_basis_cert_333 t + · exact d2_basis_cert_334 t + · exact d2_basis_cert_335 t + · exact d2_basis_cert_336 t + · exact d2_basis_cert_337 t + · exact d2_basis_cert_338 t + · exact d2_basis_cert_339 t + · exact d2_basis_cert_340 t + · exact d2_basis_cert_341 t + · exact d2_basis_cert_342 t + · exact d2_basis_cert_343 t + · exact d2_basis_cert_344 t + · exact d2_basis_cert_345 t + · exact d2_basis_cert_346 t + · exact d2_basis_cert_347 t + · exact d2_basis_cert_348 t + · exact d2_basis_cert_349 t + · exact d2_basis_cert_350 t + · exact d2_basis_cert_351 t + · exact d2_basis_cert_352 t + · exact d2_basis_cert_353 t + · exact d2_basis_cert_354 t + · exact d2_basis_cert_355 t + · exact d2_basis_cert_356 t + · exact d2_basis_cert_357 t + · exact d2_basis_cert_358 t + · exact d2_basis_cert_359 t + · exact d2_basis_cert_360 t + · exact d2_basis_cert_361 t + · exact d2_basis_cert_362 t + · exact d2_basis_cert_363 t + · exact d2_basis_cert_364 t + · exact d2_basis_cert_365 t + · exact d2_basis_cert_366 t + · exact d2_basis_cert_367 t + · exact d2_basis_cert_368 t + · exact d2_basis_cert_369 t + · exact d2_basis_cert_370 t + · exact d2_basis_cert_371 t + +theorem d1_h0_cert (i v : Fin 103) : + rowEval (d1Row i) (h0Coeff v) = + (if i = v then 1 else 0) - (if i = 0 then 1 else 0) := by + fin_cases i + · exact d1_h0_cert_0 v + · exact d1_h0_cert_1 v + · exact d1_h0_cert_2 v + · exact d1_h0_cert_3 v + · exact d1_h0_cert_4 v + · exact d1_h0_cert_5 v + · exact d1_h0_cert_6 v + · exact d1_h0_cert_7 v + · exact d1_h0_cert_8 v + · exact d1_h0_cert_9 v + · exact d1_h0_cert_10 v + · exact d1_h0_cert_11 v + · exact d1_h0_cert_12 v + · exact d1_h0_cert_13 v + · exact d1_h0_cert_14 v + · exact d1_h0_cert_15 v + · exact d1_h0_cert_16 v + · exact d1_h0_cert_17 v + · exact d1_h0_cert_18 v + · exact d1_h0_cert_19 v + · exact d1_h0_cert_20 v + · exact d1_h0_cert_21 v + · exact d1_h0_cert_22 v + · exact d1_h0_cert_23 v + · exact d1_h0_cert_24 v + · exact d1_h0_cert_25 v + · exact d1_h0_cert_26 v + · exact d1_h0_cert_27 v + · exact d1_h0_cert_28 v + · exact d1_h0_cert_29 v + · exact d1_h0_cert_30 v + · exact d1_h0_cert_31 v + · exact d1_h0_cert_32 v + · exact d1_h0_cert_33 v + · exact d1_h0_cert_34 v + · exact d1_h0_cert_35 v + · exact d1_h0_cert_36 v + · exact d1_h0_cert_37 v + · exact d1_h0_cert_38 v + · exact d1_h0_cert_39 v + · exact d1_h0_cert_40 v + · exact d1_h0_cert_41 v + · exact d1_h0_cert_42 v + · exact d1_h0_cert_43 v + · exact d1_h0_cert_44 v + · exact d1_h0_cert_45 v + · exact d1_h0_cert_46 v + · exact d1_h0_cert_47 v + · exact d1_h0_cert_48 v + · exact d1_h0_cert_49 v + · exact d1_h0_cert_50 v + · exact d1_h0_cert_51 v + · exact d1_h0_cert_52 v + · exact d1_h0_cert_53 v + · exact d1_h0_cert_54 v + · exact d1_h0_cert_55 v + · exact d1_h0_cert_56 v + · exact d1_h0_cert_57 v + · exact d1_h0_cert_58 v + · exact d1_h0_cert_59 v + · exact d1_h0_cert_60 v + · exact d1_h0_cert_61 v + · exact d1_h0_cert_62 v + · exact d1_h0_cert_63 v + · exact d1_h0_cert_64 v + · exact d1_h0_cert_65 v + · exact d1_h0_cert_66 v + · exact d1_h0_cert_67 v + · exact d1_h0_cert_68 v + · exact d1_h0_cert_69 v + · exact d1_h0_cert_70 v + · exact d1_h0_cert_71 v + · exact d1_h0_cert_72 v + · exact d1_h0_cert_73 v + · exact d1_h0_cert_74 v + · exact d1_h0_cert_75 v + · exact d1_h0_cert_76 v + · exact d1_h0_cert_77 v + · exact d1_h0_cert_78 v + · exact d1_h0_cert_79 v + · exact d1_h0_cert_80 v + · exact d1_h0_cert_81 v + · exact d1_h0_cert_82 v + · exact d1_h0_cert_83 v + · exact d1_h0_cert_84 v + · exact d1_h0_cert_85 v + · exact d1_h0_cert_86 v + · exact d1_h0_cert_87 v + · exact d1_h0_cert_88 v + · exact d1_h0_cert_89 v + · exact d1_h0_cert_90 v + · exact d1_h0_cert_91 v + · exact d1_h0_cert_92 v + · exact d1_h0_cert_93 v + · exact d1_h0_cert_94 v + · exact d1_h0_cert_95 v + · exact d1_h0_cert_96 v + · exact d1_h0_cert_97 v + · exact d1_h0_cert_98 v + · exact d1_h0_cert_99 v + · exact d1_h0_cert_100 v + · exact d1_h0_cert_101 v + · exact d1_h0_cert_102 v + +theorem fin_ite {n : ℕ} (i j : Fin n) (a b : ℤ) : + @ite ℤ (i = j) (Classical.propDecidable _) a b = + @ite ℤ (i = j) (instDecidableEqFin n i j) a b := by + by_cases h : i = j <;> simp [h] + +local instance : DecidableEq (Fin 103) := Classical.decEq _ +local instance : DecidableEq (Fin 372) := Classical.decEq _ +local instance : DecidableEq (Fin 270) := Classical.decEq _ + +noncomputable def d₁ := FiniteIntegralContraction.rowsMap d1Row +noncomputable def d₂ := FiniteIntegralContraction.rowsMap d2Row +noncomputable def h₀ := FiniteIntegralContraction.matrixMap h0Coeff +noncomputable def h₁ := FiniteIntegralContraction.matrixMap h1Coeff +noncomputable def h₁' := FiniteIntegralContraction.corrected d₁ h₀ h₁ + +theorem d₁_single (e : Fin 372) : + d₁ (Pi.single e 1) = Pi.single (edge e).2 1 - Pi.single (edge e).1 1 := +by + apply FiniteIntegralContraction.rows_single_one edge d1Row + intro i e + simpa only [rowEval,FiniteIntegralContraction.rowEval,fin_ite] using d1_basis_cert i e + +theorem d₂_single (t : Fin 270) : + d₂ (Pi.single t 1) = Pi.single (triangleEdges t).1 1 - + Pi.single (triangleEdges t).2.1 1 + Pi.single (triangleEdges t).2.2 1 := +by + apply FiniteIntegralContraction.rows_single_two triangleEdges d2Row + intro e t + simpa only [rowEval,FiniteIntegralContraction.rowEval,fin_ite] using d2_basis_cert e t + +theorem bottom_identity (v : Fin 103) : d₁ (h₀ (Pi.single v 1)) = Pi.single v 1 - Pi.single 0 1 := +by + apply FiniteIntegralContraction.certificate_bottom d1Row h0Coeff 0 + intro i v + simpa only [rowEval,FiniteIntegralContraction.rowEval,fin_ite] using d1_h0_cert i v + +theorem left_identity (t : Fin 270) : h₁ (d₂ (Pi.single t 1)) = Pi.single t 1 := +by + apply FiniteIntegralContraction.certificate_left triangleEdges d2Row h1Coeff d₂_single + intro t j + simpa only [fin_ite] using h1_boundary_cert t j + +theorem d₁_d₂_single (t : Fin 270) : d₁ (d₂ (Pi.single t 1)) = 0 := by + rw [d₂_single,map_add,map_sub,d₁_single,d₁_single,d₁_single] + obtain ⟨h₁,h₂,h₃⟩ := triangle_edges_valid t + rw [h₁,h₂,h₃] + dsimp + abel + +theorem corrected_identities : + (∀ t, h₁' (d₂ (Pi.single t 1)) = Pi.single t 1) ∧ + (∀ e, d₂ (h₁' (Pi.single e 1)) + h₀ (d₁ (Pi.single e 1)) = Pi.single e 1) := + FiniteIntegralContraction.middle_of_rank (by simp only [Fintype.card_fin]) 0 d₁ d₂ h₀ h₁ + d₁_d₂_single bottom_identity left_identity + +theorem fin_single {n : ℕ} (d : DecidableEq (Fin n)) (i : Fin n) (a : ℤ) : + @Pi.single (Fin n) (fun _ => ℤ) (fun _ => inferInstance) d i a = + @Pi.single (Fin n) (fun _ => ℤ) (fun _ => inferInstance) (instDecidableEqFin n) i a := by + ext j + simp only [Pi.single_apply] + split_ifs <;> rfl + +/-- An augmented integral chain contraction of the actual103-vertex source +cell-order complex, not an assumed homology property of the seed. -/ +noncomputable def contraction : SimplicialChains.Contraction graph := + indices.contraction 0 h₀ h₁' d₁ d₂ + (by simpa only [indices,fin_single] using d₁_single) + (by simpa only [indices,fin_single] using d₂_single) + (by simpa only [fin_single] using bottom_identity) + (by simpa only [fin_single] using corrected_identities.1) + (by simpa only [fin_single] using corrected_identities.2) + +end EilenbergGanea.SeedChainCertificate + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/SeedHolonomy.lean b/lean/OAI/Topology/EilenbergGanea/SeedHolonomy.lean index fcf4bd7ed212bec0a2d50bfe61814c43a65f4004..2c7cd11905d5f15a378b4cd11430cd9b84ca292f 100644 --- a/lean/OAI/Topology/EilenbergGanea/SeedHolonomy.lean +++ b/lean/OAI/Topology/EilenbergGanea/SeedHolonomy.lean @@ -1,191 +1,191 @@ -import OAI.Topology.EilenbergGanea.Seed -import OAI.Topology.EilenbergGanea.SmallHolonomy - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -/-! Exact quaternion monodromy of the fixed presentation seed. -/ -open scoped Quaternion -namespace EilenbergGanea - -abbrev SeedSU2 := unitary ℍ - -def seedGoldenReal : ℝ := (1 + Real.sqrt 5) / 4 - -def seedXQuaternion : ℍ := ⟨0,1,0,0⟩ -def seedYQuaternion : ℍ := - ⟨seedGoldenReal,1/2,Real.sqrt ((3 - Real.sqrt 5)/8),0⟩ - -theorem seedGoldenReal_quadratic : 4 * seedGoldenReal ^ 2 - 2 * seedGoldenReal - 1 = 0 := by - have h := Real.sq_sqrt (show (0 : ℝ) ≤ 5 by norm_num) - dsimp [seedGoldenReal] - nlinarith - -theorem seedGoldenReal_cubic : 8 * seedGoldenReal ^ 3 - 4 * seedGoldenReal = 1 := by - have h := seedGoldenReal_quadratic - nlinarith [sq_nonneg (2 * seedGoldenReal - 1), - mul_eq_zero_of_left h seedGoldenReal] - -theorem seedGoldenReal_quartic : 16 * seedGoldenReal ^ 4 - 12 * seedGoldenReal ^ 2 + 1 = 0 := by - have h := seedGoldenReal_quadratic - have h' := seedGoldenReal_cubic - nlinarith [mul_eq_zero_of_left h (seedGoldenReal ^ 2), - congrArg (fun t : ℝ => t * seedGoldenReal) h'] - -theorem seedX_normSq : Quaternion.normSq seedXQuaternion = 1 := by - rw [Quaternion.normSq_def'] - norm_num [seedXQuaternion] - -theorem seedY_normSq : Quaternion.normSq seedYQuaternion = 1 := by - have hs := Real.sq_sqrt (show (0 : ℝ) ≤ 5 by norm_num) - have hn := Real.sqrt_nonneg (5 : ℝ) - have hle : Real.sqrt (5 : ℝ) ≤ 3 := by nlinarith - have hc := Real.sq_sqrt (show (0 : ℝ) ≤ (3 - Real.sqrt 5)/8 by positivity) - rw [Quaternion.normSq_def'] - change seedGoldenReal ^ 2 + (1 / 2 : ℝ) ^ 2 + Real.sqrt ((3 - Real.sqrt 5)/8) ^ 2 + 0 ^ 2 = 1 - dsimp [seedGoldenReal] - nlinarith - -def seedXUnit : SeedSU2 := ⟨seedXQuaternion,by - rw [Unitary.mem_iff,Quaternion.star_mul_self,Quaternion.self_mul_star,seedX_normSq] - simp⟩ - -def seedYUnit : SeedSU2 := ⟨seedYQuaternion,by - rw [Unitary.mem_iff,Quaternion.star_mul_self,Quaternion.self_mul_star,seedY_normSq] - simp⟩ - -theorem unitQuaternion_quadratic (q : ℍ) (h : Quaternion.normSq q = 1) : - q ^ 2 = (2 * q.re : ℝ) * q - 1 := by - have hh := Quaternion.star_mul_self q - rw [h,Quaternion.star_eq_two_re_sub,sub_mul] at hh - simp only [Quaternion.coe_one] at hh - have hh' : ((2 * q.re : ℝ) : ℍ) * q = 1 + q * q := by - simpa only [add_comm] using sub_eq_iff_eq_add.mp hh - rw [pow_two] - apply eq_sub_iff_add_eq.mpr - simpa only [add_comm] using hh'.symm - -theorem unitQuaternion_half_cube (q : ℍ) (h : Quaternion.normSq q = 1) - (hr : q.re = 1/2) : q ^ 3 = -1 := by - have hh := unitQuaternion_quadratic q h - rw [hr] at hh - norm_num at hh - calc - q ^ 3 = q ^ 2 * q := by rw [pow_succ] - _ = (q - 1) * q := by rw [hh] - _ = q ^ 2 - q := by noncomm_ring - _ = -1 := by rw [hh]; noncomm_ring - -theorem seedX_square : seedXQuaternion ^ 2 = -1 := by - rw [pow_two] - apply Quaternion.ext - · rw [Quaternion.re_mul] - norm_num [seedXQuaternion] - · rw [Quaternion.imI_mul] - norm_num [seedXQuaternion] - · rw [Quaternion.imJ_mul] - norm_num [seedXQuaternion] - · rw [Quaternion.imK_mul] - norm_num [seedXQuaternion] - -theorem seedY_fifth : seedYQuaternion ^ 5 = -1 := by - let q := seedYQuaternion - let c : ℍ := (seedGoldenReal : ℝ) - have hh : q ^ 2 = 2 * c * q - 1 := by - simpa only [q,c,seedYQuaternion,Quaternion.coe_mul, show ((2 : ℝ) : ℍ) = 2 from rfl] using unitQuaternion_quadratic seedYQuaternion seedY_normSq - have h3 : q ^ 3 = (4 * c ^ 2 - 1) * q - 2 * c := by - calc - q ^ 3 = q ^ 2 * q := by rw [pow_succ] - _ = (2 * c * q - 1) * q := by rw [hh] - _ = 2 * c * q ^ 2 - q := by noncomm_ring - _ = (4 * c ^ 2 - 1) * q - 2 * c := by rw [hh]; noncomm_ring - have h4 : q ^ 4 = (8 * c ^ 3 - 4 * c) * q - (4 * c ^ 2 - 1) := by - calc - q ^ 4 = q ^ 3 * q := by rw [pow_succ] - _ = ((4 * c ^ 2 - 1) * q - 2 * c) * q := by rw [h3] - _ = (4 * c ^ 2 - 1) * q ^ 2 - 2 * c * q := by noncomm_ring - _ = (8 * c ^ 3 - 4 * c) * q - (4 * c ^ 2 - 1) := by rw [hh]; noncomm_ring - have h5 : q ^ 5 = (16 * c ^ 4 - 12 * c ^ 2 + 1) * q - (8 * c ^ 3 - 4 * c) := by - calc - q ^ 5 = q ^ 4 * q := by rw [pow_succ] - _ = ((8 * c ^ 3 - 4 * c) * q - (4 * c ^ 2 - 1)) * q := by rw [h4] - _ = (8 * c ^ 3 - 4 * c) * q ^ 2 - (4 * c ^ 2 - 1) * q := by noncomm_ring - _ = _ := by rw [hh]; noncomm_ring - have hc3 : 8 * c ^ 3 - 4 * c = 1 := by - change (8 : ℍ) * (seedGoldenReal : ℍ) ^ 3 - 4 * (seedGoldenReal : ℍ) = 1 - have h := congrArg (fun r : ℝ => (r : ℍ)) seedGoldenReal_cubic - simpa only [Quaternion.coe_sub,Quaternion.coe_mul,Quaternion.coe_pow,Quaternion.coe_one, - show ((8 : ℝ) : ℍ) = 8 from rfl, show ((4 : ℝ) : ℍ) = 4 from rfl] using h - have hc4 : 16 * c ^ 4 - 12 * c ^ 2 + 1 = 0 := by - change (16 : ℍ) * (seedGoldenReal : ℍ) ^ 4 - 12 * (seedGoldenReal : ℍ) ^ 2 + 1 = 0 - have h := congrArg (fun r : ℝ => (r : ℍ)) seedGoldenReal_quartic - simpa only [Quaternion.coe_sub,Quaternion.coe_mul,Quaternion.coe_pow,Quaternion.coe_add, - Quaternion.coe_one,Quaternion.coe_zero, show ((16 : ℝ) : ℍ) = 16 from rfl, - show ((12 : ℝ) : ℍ) = 12 from rfl] using h - simpa [hc3,hc4] using h5 - -theorem seedXYinv_cube : (seedXQuaternion * star seedYQuaternion) ^ 3 = -1 := by - apply unitQuaternion_half_cube - · rw [map_mul,Quaternion.normSq_star,seedX_normSq,seedY_normSq,mul_one] - · rw [Quaternion.re_mul] - rw [Quaternion.imI_star] - norm_num [seedXQuaternion,seedYQuaternion] - -theorem seed_unit_relations : - seedXUnit ^ 2 = seedYUnit ^ 5 ∧ - seedXUnit ^ 2 = (seedXUnit * seedYUnit⁻¹) ^ 3 := by - constructor - · apply Subtype.val_injective - change seedXQuaternion ^ 2 = seedYQuaternion ^ 5 - rw [seedX_square,seedY_fifth] - · apply Subtype.val_injective - change seedXQuaternion ^ 2 = (seedXQuaternion * star seedYQuaternion) ^ 3 - rw [seedX_square,seedXYinv_cube] - -def seedRelator : Bool → FreeGroup Bool - | false => FreeGroup.of false ^ 2 * (FreeGroup.of true ^ 5)⁻¹ - | true => FreeGroup.of false ^ 2 * ((FreeGroup.of false * (FreeGroup.of true)⁻¹) ^ 3)⁻¹ - -theorem seedWord_relator (r : Bool) : FreeGroup.mk (seedWord r) = seedRelator r := by - cases r <;> decide - -def seedLetterUnit : Bool → SeedSU2 - | false => seedXUnit - | true => seedYUnit - -theorem seedRelator_unit (r : Bool) : FreeGroup.lift seedLetterUnit (seedRelator r) = 1 := by - cases r - · simp only [seedRelator,map_mul,map_inv,map_pow,FreeGroup.lift_apply_of,seedLetterUnit] - rw [seed_unit_relations.1,mul_inv_cancel] - · simp only [seedRelator,map_mul,map_inv,map_pow,FreeGroup.lift_apply_of,seedLetterUnit] - rw [seed_unit_relations.2,mul_inv_cancel] - -abbrev SeedPresentationGroup := PresentedGroup (Set.range seedRelator) - -def seedMonodromy : SeedPresentationGroup →* SeedSU2 := - PresentedGroup.toGroup (f := seedLetterUnit) (by - rintro _ ⟨r,rfl⟩ - exact seedRelator_unit r) - -theorem seedMonodromy_nontrivial : seedMonodromy (PresentedGroup.of false) ≠ 1 := by - intro h - have hh := congrArg (fun q : SeedSU2 => (q : ℍ).re) h - simp [seedMonodromy,seedLetterUnit,seedXUnit,seedXQuaternion] at hh - -/-- The source exponent-sum boundary, with rows indexed by its two relators. -/ -def seedExponentMatrix : Matrix (Fin 2) (Fin 2) ℤ := !![2,-5;-1,3] - -theorem seedExponentMatrix_det : seedExponentMatrix.det = 1 := by - norm_num [seedExponentMatrix,Matrix.det_fin_two] - -end EilenbergGanea - - - -end - -end OAI +import OAI.Topology.EilenbergGanea.Seed +import OAI.Topology.EilenbergGanea.SmallHolonomy + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +/-! Exact quaternion monodromy of the fixed presentation seed. -/ +open scoped Quaternion +namespace EilenbergGanea + +abbrev SeedSU2 := unitary ℍ + +def seedGoldenReal : ℝ := (1 + Real.sqrt 5) / 4 + +def seedXQuaternion : ℍ := ⟨0,1,0,0⟩ +def seedYQuaternion : ℍ := + ⟨seedGoldenReal,1/2,Real.sqrt ((3 - Real.sqrt 5)/8),0⟩ + +theorem seedGoldenReal_quadratic : 4 * seedGoldenReal ^ 2 - 2 * seedGoldenReal - 1 = 0 := by + have h := Real.sq_sqrt (show (0 : ℝ) ≤ 5 by norm_num) + dsimp [seedGoldenReal] + nlinarith + +theorem seedGoldenReal_cubic : 8 * seedGoldenReal ^ 3 - 4 * seedGoldenReal = 1 := by + have h := seedGoldenReal_quadratic + nlinarith [sq_nonneg (2 * seedGoldenReal - 1), + mul_eq_zero_of_left h seedGoldenReal] + +theorem seedGoldenReal_quartic : 16 * seedGoldenReal ^ 4 - 12 * seedGoldenReal ^ 2 + 1 = 0 := by + have h := seedGoldenReal_quadratic + have h' := seedGoldenReal_cubic + nlinarith [mul_eq_zero_of_left h (seedGoldenReal ^ 2), + congrArg (fun t : ℝ => t * seedGoldenReal) h'] + +theorem seedX_normSq : Quaternion.normSq seedXQuaternion = 1 := by + rw [Quaternion.normSq_def'] + norm_num [seedXQuaternion] + +theorem seedY_normSq : Quaternion.normSq seedYQuaternion = 1 := by + have hs := Real.sq_sqrt (show (0 : ℝ) ≤ 5 by norm_num) + have hn := Real.sqrt_nonneg (5 : ℝ) + have hle : Real.sqrt (5 : ℝ) ≤ 3 := by nlinarith + have hc := Real.sq_sqrt (show (0 : ℝ) ≤ (3 - Real.sqrt 5)/8 by positivity) + rw [Quaternion.normSq_def'] + change seedGoldenReal ^ 2 + (1 / 2 : ℝ) ^ 2 + Real.sqrt ((3 - Real.sqrt 5)/8) ^ 2 + 0 ^ 2 = 1 + dsimp [seedGoldenReal] + nlinarith + +def seedXUnit : SeedSU2 := ⟨seedXQuaternion,by + rw [Unitary.mem_iff,Quaternion.star_mul_self,Quaternion.self_mul_star,seedX_normSq] + simp⟩ + +def seedYUnit : SeedSU2 := ⟨seedYQuaternion,by + rw [Unitary.mem_iff,Quaternion.star_mul_self,Quaternion.self_mul_star,seedY_normSq] + simp⟩ + +theorem unitQuaternion_quadratic (q : ℍ) (h : Quaternion.normSq q = 1) : + q ^ 2 = (2 * q.re : ℝ) * q - 1 := by + have hh := Quaternion.star_mul_self q + rw [h,Quaternion.star_eq_two_re_sub,sub_mul] at hh + simp only [Quaternion.coe_one] at hh + have hh' : ((2 * q.re : ℝ) : ℍ) * q = 1 + q * q := by + simpa only [add_comm] using sub_eq_iff_eq_add.mp hh + rw [pow_two] + apply eq_sub_iff_add_eq.mpr + simpa only [add_comm] using hh'.symm + +theorem unitQuaternion_half_cube (q : ℍ) (h : Quaternion.normSq q = 1) + (hr : q.re = 1/2) : q ^ 3 = -1 := by + have hh := unitQuaternion_quadratic q h + rw [hr] at hh + norm_num at hh + calc + q ^ 3 = q ^ 2 * q := by rw [pow_succ] + _ = (q - 1) * q := by rw [hh] + _ = q ^ 2 - q := by noncomm_ring + _ = -1 := by rw [hh]; noncomm_ring + +theorem seedX_square : seedXQuaternion ^ 2 = -1 := by + rw [pow_two] + apply Quaternion.ext + · rw [Quaternion.re_mul] + norm_num [seedXQuaternion] + · rw [Quaternion.imI_mul] + norm_num [seedXQuaternion] + · rw [Quaternion.imJ_mul] + norm_num [seedXQuaternion] + · rw [Quaternion.imK_mul] + norm_num [seedXQuaternion] + +theorem seedY_fifth : seedYQuaternion ^ 5 = -1 := by + let q := seedYQuaternion + let c : ℍ := (seedGoldenReal : ℝ) + have hh : q ^ 2 = 2 * c * q - 1 := by + simpa only [q,c,seedYQuaternion,Quaternion.coe_mul, show ((2 : ℝ) : ℍ) = 2 from rfl] using unitQuaternion_quadratic seedYQuaternion seedY_normSq + have h3 : q ^ 3 = (4 * c ^ 2 - 1) * q - 2 * c := by + calc + q ^ 3 = q ^ 2 * q := by rw [pow_succ] + _ = (2 * c * q - 1) * q := by rw [hh] + _ = 2 * c * q ^ 2 - q := by noncomm_ring + _ = (4 * c ^ 2 - 1) * q - 2 * c := by rw [hh]; noncomm_ring + have h4 : q ^ 4 = (8 * c ^ 3 - 4 * c) * q - (4 * c ^ 2 - 1) := by + calc + q ^ 4 = q ^ 3 * q := by rw [pow_succ] + _ = ((4 * c ^ 2 - 1) * q - 2 * c) * q := by rw [h3] + _ = (4 * c ^ 2 - 1) * q ^ 2 - 2 * c * q := by noncomm_ring + _ = (8 * c ^ 3 - 4 * c) * q - (4 * c ^ 2 - 1) := by rw [hh]; noncomm_ring + have h5 : q ^ 5 = (16 * c ^ 4 - 12 * c ^ 2 + 1) * q - (8 * c ^ 3 - 4 * c) := by + calc + q ^ 5 = q ^ 4 * q := by rw [pow_succ] + _ = ((8 * c ^ 3 - 4 * c) * q - (4 * c ^ 2 - 1)) * q := by rw [h4] + _ = (8 * c ^ 3 - 4 * c) * q ^ 2 - (4 * c ^ 2 - 1) * q := by noncomm_ring + _ = _ := by rw [hh]; noncomm_ring + have hc3 : 8 * c ^ 3 - 4 * c = 1 := by + change (8 : ℍ) * (seedGoldenReal : ℍ) ^ 3 - 4 * (seedGoldenReal : ℍ) = 1 + have h := congrArg (fun r : ℝ => (r : ℍ)) seedGoldenReal_cubic + simpa only [Quaternion.coe_sub,Quaternion.coe_mul,Quaternion.coe_pow,Quaternion.coe_one, + show ((8 : ℝ) : ℍ) = 8 from rfl, show ((4 : ℝ) : ℍ) = 4 from rfl] using h + have hc4 : 16 * c ^ 4 - 12 * c ^ 2 + 1 = 0 := by + change (16 : ℍ) * (seedGoldenReal : ℍ) ^ 4 - 12 * (seedGoldenReal : ℍ) ^ 2 + 1 = 0 + have h := congrArg (fun r : ℝ => (r : ℍ)) seedGoldenReal_quartic + simpa only [Quaternion.coe_sub,Quaternion.coe_mul,Quaternion.coe_pow,Quaternion.coe_add, + Quaternion.coe_one,Quaternion.coe_zero, show ((16 : ℝ) : ℍ) = 16 from rfl, + show ((12 : ℝ) : ℍ) = 12 from rfl] using h + simpa [hc3,hc4] using h5 + +theorem seedXYinv_cube : (seedXQuaternion * star seedYQuaternion) ^ 3 = -1 := by + apply unitQuaternion_half_cube + · rw [map_mul,Quaternion.normSq_star,seedX_normSq,seedY_normSq,mul_one] + · rw [Quaternion.re_mul] + rw [Quaternion.imI_star] + norm_num [seedXQuaternion,seedYQuaternion] + +theorem seed_unit_relations : + seedXUnit ^ 2 = seedYUnit ^ 5 ∧ + seedXUnit ^ 2 = (seedXUnit * seedYUnit⁻¹) ^ 3 := by + constructor + · apply Subtype.val_injective + change seedXQuaternion ^ 2 = seedYQuaternion ^ 5 + rw [seedX_square,seedY_fifth] + · apply Subtype.val_injective + change seedXQuaternion ^ 2 = (seedXQuaternion * star seedYQuaternion) ^ 3 + rw [seedX_square,seedXYinv_cube] + +def seedRelator : Bool → FreeGroup Bool + | false => FreeGroup.of false ^ 2 * (FreeGroup.of true ^ 5)⁻¹ + | true => FreeGroup.of false ^ 2 * ((FreeGroup.of false * (FreeGroup.of true)⁻¹) ^ 3)⁻¹ + +theorem seedWord_relator (r : Bool) : FreeGroup.mk (seedWord r) = seedRelator r := by + cases r <;> decide + +def seedLetterUnit : Bool → SeedSU2 + | false => seedXUnit + | true => seedYUnit + +theorem seedRelator_unit (r : Bool) : FreeGroup.lift seedLetterUnit (seedRelator r) = 1 := by + cases r + · simp only [seedRelator,map_mul,map_inv,map_pow,FreeGroup.lift_apply_of,seedLetterUnit] + rw [seed_unit_relations.1,mul_inv_cancel] + · simp only [seedRelator,map_mul,map_inv,map_pow,FreeGroup.lift_apply_of,seedLetterUnit] + rw [seed_unit_relations.2,mul_inv_cancel] + +abbrev SeedPresentationGroup := PresentedGroup (Set.range seedRelator) + +def seedMonodromy : SeedPresentationGroup →* SeedSU2 := + PresentedGroup.toGroup (f := seedLetterUnit) (by + rintro _ ⟨r,rfl⟩ + exact seedRelator_unit r) + +theorem seedMonodromy_nontrivial : seedMonodromy (PresentedGroup.of false) ≠ 1 := by + intro h + have hh := congrArg (fun q : SeedSU2 => (q : ℍ).re) h + simp [seedMonodromy,seedLetterUnit,seedXUnit,seedXQuaternion] at hh + +/-- The source exponent-sum boundary, with rows indexed by its two relators. -/ +def seedExponentMatrix : Matrix (Fin 2) (Fin 2) ℤ := !![2,-5;-1,3] + +theorem seedExponentMatrix_det : seedExponentMatrix.det = 1 := by + norm_num [seedExponentMatrix,Matrix.det_fin_two] + +end EilenbergGanea + + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/SmallHolonomy.lean b/lean/OAI/Topology/EilenbergGanea/SmallHolonomy.lean index de0cfe812b57b6dad09f747e78a06f7d86f64301..531699b2677fc8a42d71f79234e9552d8eff5ebc 100644 --- a/lean/OAI/Topology/EilenbergGanea/SmallHolonomy.lean +++ b/lean/OAI/Topology/EilenbergGanea/SmallHolonomy.lean @@ -1,744 +1,744 @@ -import OAI.Topology.EilenbergGanea.WordEquations -import OAI.GroupTheory.RightAngledArtin.ResidualFiniteness -import Mathlib.Topology.Compactness.Compact -import Mathlib.LinearAlgebra.Finsupp.LinearCombination - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -namespace EilenbergGanea -open scoped Quaternion ContDiff -/-- Squared chord length on the unit-quaternion sphere. -/ -theorem su2_distance_square (a : SU2) : - ‖(a : ℍ) - 1‖ ^ 2 = 2 - 2 * (a : ℍ).re := by - have hu := (quaternion_mem_unitary_iff _).mp a.property - have hs : Quaternion.normSq ((a : ℍ) - 1) = Quaternion.normSq (a : ℍ) + 1 - 2 * (a : ℍ).re := by - simp only [Quaternion.normSq_def', Quaternion.re_sub, Quaternion.imI_sub, - Quaternion.imJ_sub, Quaternion.imK_sub, Quaternion.re_one, - Quaternion.imI_one, Quaternion.imJ_one, Quaternion.imK_one] - ring - simpa only [Quaternion.normSq_eq_norm_mul_self, hu, one_mul, sq, one_add_one_eq_two] using hs - -def arcBlend (a : SU2) (t : ℝ) : ℍ := - (1 - Real.smoothTransition t) • (1 : ℍ) + Real.smoothTransition t • (a : ℍ) - -theorem arcBlend_norm_le (a : SU2) (t : ℝ) : ‖arcBlend a t‖ ≤ 1 := by - have h0 := Real.smoothTransition.nonneg t - have h1 := Real.smoothTransition.le_one t - have hn := (quaternion_mem_unitary_iff _).mp a.property - calc - _ ≤ ‖(1 - Real.smoothTransition t) • (1 : ℍ)‖ + - ‖Real.smoothTransition t • (a : ℍ)‖ := norm_add_le _ _ - _ = 1 := by rw [norm_smul, norm_smul, norm_one, hn, Real.norm_eq_abs, - Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr h1), abs_of_nonneg h0]; ring - -theorem small_unit_re (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) : - 0 < (a : ℍ).re ∧ (a : ℍ).re ≤ 1 := by - have h := su2_distance_square a - have hn := norm_nonneg ((a : ℍ) - 1) - constructor <;> nlinarith [sq_nonneg ‖(a : ℍ) - 1‖] - -theorem arcBlend_re_le (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) (t : ℝ) : - (a : ℍ).re ≤ (arcBlend a t).re := by - have h := (small_unit_re a ha).2 - have h0 := Real.smoothTransition.nonneg t - have h1 := Real.smoothTransition.le_one t - simp only [arcBlend, Quaternion.re_add, Quaternion.re_smul, Quaternion.re_one, smul_eq_mul] - nlinarith - -theorem arcBlend_ne_zero (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) (t : ℝ) : - arcBlend a t ≠ 0 := by - have h := (small_unit_re a ha).1.trans_le (arcBlend_re_le a ha t) - intro he - simp only [he, Quaternion.re_zero, lt_self_iff_false] at h - -/-- A globally smooth path that remains in the closed chord ball of its -endpoint, avoiding any branch choice of a quaternion logarithm. -/ -def smallQuaternionArc (a : SU2) (t : ℝ) : SU2 := normalizeQuaternion (arcBlend a t) - -@[simp] theorem smallQuaternionArc_zero (a : SU2) : smallQuaternionArc a 0 = 1 := by - simpa [smallQuaternionArc, arcBlend] using (normalizeQuaternion_unitary (1 : SU2)) - -@[simp] theorem smallQuaternionArc_one (a : SU2) : smallQuaternionArc a 1 = a := by - simp [smallQuaternionArc, arcBlend] - -theorem smallQuaternionArc_smooth (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) : - ContDiff ℝ ∞ (fun t => (smallQuaternionArc a t : ℍ)) := by - apply contDiff_iff_contDiffAt.mpr - intro t - exact (normalizeQuaternion_coe_contDiffAt (arcBlend_ne_zero a ha t)).comp t - (((contDiff_const.sub Real.smoothTransition.contDiff).smul contDiff_const).add - (Real.smoothTransition.contDiff.smul contDiff_const)).contDiffAt - -theorem smallQuaternionArc_distance (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) (t : ℝ) : - ‖(smallQuaternionArc a t : ℍ) - 1‖ ≤ ‖(a : ℍ) - 1‖ := by - have hp : 0 < ‖arcBlend a t‖ := norm_pos_iff.mpr (arcBlend_ne_zero a ha t) - have hre : (a : ℍ).re ≤ (smallQuaternionArc a t : ℍ).re := by - rw [smallQuaternionArc, normalizeQuaternion_coe_of_ne_zero (arcBlend_ne_zero a ha t)] - simp only [Quaternion.re_smul, smul_eq_mul] - rw [mul_comm, ← div_eq_mul_inv, le_div_iff₀ hp] - exact (mul_le_of_le_one_right (small_unit_re a ha).1.le (arcBlend_norm_le a t)).trans - (arcBlend_re_le a ha t) - have h0 := su2_distance_square a - have h1 := su2_distance_square (smallQuaternionArc a t) - nlinarith [norm_nonneg ((a : ℍ)-1), norm_nonneg ((smallQuaternionArc a t : ℍ)-1)] - -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion ContDiff -open Set -section SelectedEquations -variable {E : Type*} {m d : ℕ} - -/-- The selected unknowns remain separate from coefficients, even when two -letters have the same image in the group quotient. -/ -def selectedAlphabet (σ : Fin m ↪ E) (e : E) : E ⊕ Fin m := by - classical - exact if h : ∃ i, σ i = e then .inr h.choose else .inl e - -@[simp] theorem selectedAlphabet_selected (σ : Fin m ↪ E) (i : Fin m) : - selectedAlphabet σ (σ i) = .inr i := by - classical - have h : ∃ j, σ j = σ i := ⟨i,rfl⟩ - simp only [selectedAlphabet, dite_eq_left h] - exact congrArg Sum.inr (σ.injective h.choose_spec) - - theorem selectedAlphabet_other (σ : Fin m ↪ E) (e : E) (he : ∀ i, σ i ≠ e) : - selectedAlphabet σ e = .inl e := by - classical - simp [selectedAlphabet, he] - -def selectedWord (σ : Fin m ↪ E) : FreeGroup E →* FreeGroup (E ⊕ Fin m) := - FreeGroup.map (selectedAlphabet σ) - -def selectedLabel (σ : Fin m ↪ E) (a : E → SU2) (x : Fin m → SU2) (e : E) : SU2 := - Sum.elim a x (selectedAlphabet σ e) - -@[simp] theorem selectedLabel_selected (σ : Fin m ↪ E) (a : E → SU2) - (x : Fin m → SU2) (i : Fin m) : selectedLabel σ a x (σ i) = x i := by - simp [selectedLabel] - - theorem selectedLabel_other (σ : Fin m ↪ E) (a : E → SU2) (x : Fin m → SU2) - (e : E) (he : ∀ i, σ i ≠ e) : selectedLabel σ a x e = a e := by - rw [selectedLabel, selectedAlphabet_other σ e he] - rfl - - theorem selectedWord_eval (σ : Fin m ↪ E) (a : E → SU2) (x : Fin m → SU2) - (w : FreeGroup E) : - FreeGroup.lift (Sum.elim a x) (selectedWord σ w) = - FreeGroup.lift (selectedLabel σ a x) w := by - have he : (FreeGroup.lift (Sum.elim a x)).comp (selectedWord σ) = - FreeGroup.lift (selectedLabel σ a x) := by - apply FreeGroup.ext_hom - intro e - simp [selectedWord, selectedLabel] - exact congrArg (fun f : FreeGroup E →* SU2 => f w) he - - theorem selectedWord_exponents [DecidableEq E] (σ : Fin m ↪ E) (w : FreeGroup E) (j : Fin m) : - wordExponents (eraseCoefficients (selectedWord σ w)) j = wordExponents w (σ j) := by - classical - have he : (FreeGroup.lift (fun i : Fin m => Multiplicative.ofAdd (if j = i then (1 : ℤ) else 0))).comp - (eraseCoefficients.comp (selectedWord σ)) = - FreeGroup.lift (fun e : E => Multiplicative.ofAdd (if σ j = e then (1 : ℤ) else 0)) := by - apply FreeGroup.ext_hom - intro e - by_cases h : ∃ i, σ i = e - · obtain ⟨i,rfl⟩ := h - simp [selectedWord, eraseCoefficients, σ.injective.eq_iff] - · have h' : ∀ i, σ i ≠ e := by simpa only [not_exists] using h - simp [selectedWord, eraseCoefficients, selectedAlphabet_other σ e h', h' j] - exact congrArg (fun f : FreeGroup E →* Multiplicative ℤ => (f w).toAdd) he - -/-- Solve a finite, full-rank system while keeping every unselected label fixed. -The distinguished sublevel condition is the actual isolated root condition, -not a nonsingularity assumption on the roots. -/ -theorem selected_word_sublevel_solvable [DecidableEq E] - (σ : Fin m ↪ E) (w : Fin m → FreeGroup E) (ρ : Fin d → FreeGroup E) - (a : ℝ → E → SU2) (ha : ∀ e, ContDiff ℝ ∞ (fun t => (a t e : ℍ))) - (ha0 : ∀ e, a 0 e = 1) - (hB : Matrix.det (fun i j => wordExponents (w i) (σ j)) ≠ 0) - (δ : ℝ) (hδ : 0 < δ) - (hiso : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x : Fin m → SU2, - (∀ i, FreeGroup.lift (selectedLabel σ (a t) x) (w i) = 1) → - ‖(fun i => (FreeGroup.lift (selectedLabel σ (a t) x) (ρ i) : ℍ)) - 1‖ ≠ δ) : - ∃ b : E → SU2, - (∀ e, (∀ i, σ i ≠ e) → b e = a 1 e) ∧ - (∀ i, FreeGroup.lift b (w i) = 1) ∧ - ‖(fun i => (FreeGroup.lift b (ρ i) : ℍ)) - 1‖ < δ := by - have hb : (exponentMatrix (fun i => eraseCoefficients (selectedWord σ (w i)))).det ≠ 0 := by - change (Matrix.det (fun i j => wordExponents (eraseCoefficients (selectedWord σ (w i))) j)) ≠ 0 - simpa only [selectedWord_exponents] using hB - obtain ⟨x,hx,hρ⟩ := coefficient_word_sublevel_solvable - (fun i => selectedWord σ (w i)) (fun i => selectedWord σ (ρ i)) a ha ha0 hb δ hδ - (fun t ht x hx => by - simp only [coefficientWordMap, selectedWord_eval] - apply hiso t ht x - intro i - have hi := congrFun hx i - simpa only [coefficientWordMap, selectedWord_eval, Pi.one_apply] using hi) - refine ⟨selectedLabel σ (a 1) x, fun e he => selectedLabel_other σ _ x e he, ?_, ?_⟩ - · intro i - have hi := congrFun hx i - simpa only [coefficientWordMap, selectedWord_eval, Pi.one_apply] using hi - · simpa only [coefficientWordMap, selectedWord_eval] using hρ - -end SelectedEquations -end EilenbergGanea - -namespace EilenbergGanea - -variable {Γ S H : Type*} [Group Γ] [Group H] - -def labelLift (v : S → Γ) (a : Γ → S → H) : - FreeGroup S →* ((Γ → H) ⋊[functionShift Γ H] Γ) := - FreeGroup.lift (fun s => ⟨fun g => a g s, v s⟩) - -def wordValue (v : S → Γ) : FreeGroup S →* Γ := FreeGroup.lift v - -def pathProduct (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) (g : Γ) : H := - (labelLift v a w).left g - - theorem labelLift_right (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) : - (labelLift v a w).right = wordValue v w := by - have he : (SemidirectProduct.rightHom : ((Γ → H) ⋊[functionShift Γ H] Γ) →* Γ).comp - (labelLift v a) = wordValue v := by - apply FreeGroup.ext_hom - intro s - simp [labelLift, wordValue] - exact congrArg (fun f : FreeGroup S →* Γ => f w) he - -@[simp] theorem pathProduct_one (v : S → Γ) (a : Γ → S → H) (g : Γ) : - pathProduct v a 1 g = 1 := by simp [pathProduct] -@[simp] theorem pathProduct_of (v : S → Γ) (a : Γ → S → H) (s : S) (g : Γ) : - pathProduct v a (FreeGroup.of s) g = a g s := by simp [pathProduct, labelLift] - theorem pathProduct_mul (v : S → Γ) (a : Γ → S → H) (w z : FreeGroup S) (g : Γ) : - pathProduct v a (w*z) g = pathProduct v a w g * pathProduct v a z (g * wordValue v w) := by - simp only [pathProduct, map_mul, SemidirectProduct.mul_left, Pi.mul_apply, labelLift_right] - rfl - theorem pathProduct_inv (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) (g : Γ) : - pathProduct v a w⁻¹ g = (pathProduct v a w (g * (wordValue v w)⁻¹))⁻¹ := by - simp only [pathProduct, map_inv, SemidirectProduct.inv_left, labelLift_right] - rfl - - theorem pathProduct_conjugate_loop (v : S → Γ) (a : Γ → S → H) - (u r : FreeGroup S) (hr : wordValue v r = 1) (g : Γ) : - pathProduct v a (u*r*u⁻¹) g = pathProduct v a u g * - pathProduct v a r (g * wordValue v u) * (pathProduct v a u g)⁻¹ := by - rw [pathProduct_mul, pathProduct_mul, pathProduct_inv, map_mul, hr, mul_one] - simp only [mul_inv_cancel_right] - - theorem pathProduct_continuous [TopologicalSpace H] [IsTopologicalGroup H] - (v : S → Γ) (w : FreeGroup S) (g : Γ) : - Continuous (fun a : Γ → S → H => pathProduct v a w g) := by - induction w using FreeGroup.induction_on generalizing g with - | one => simpa using (continuous_const : Continuous (fun _ : Γ → S → H => (1 : H))) - | of s => - simp only [pathProduct_of] - exact continuous_apply_apply g s - | inv_of s => - simp only [pathProduct_inv, pathProduct_of] - exact (continuous_apply_apply (g * (wordValue v (FreeGroup.of s))⁻¹) s).inv - | mul w z hw hz => - simp only [pathProduct_mul] - exact (hw g).mul (hz (g * wordValue v w)) - -/-- The set of vertices inspected by a word is finite, independently of the -label values. No countability hypothesis on the alphabet is needed. -/ -theorem pathProduct_finite_locations (v : S → Γ) (w : FreeGroup S) (g : Γ) : - ∃ P : Finset Γ, ∀ a b : Γ → S → H, - (∀ p ∈ P, ∀ s, a p s = b p s) → pathProduct v a w g = pathProduct v b w g := by - classical - induction w using FreeGroup.induction_on generalizing g with - | one => exact ⟨∅, fun _ _ _ => by simp⟩ - | of s => exact ⟨{g}, fun a b hab => by simpa using hab g (by simp) s⟩ - | inv_of s => - exact ⟨{g * (wordValue v (FreeGroup.of s))⁻¹}, fun a b hab => by - rw [pathProduct_inv, pathProduct_inv, pathProduct_of, pathProduct_of, hab _ (by simp)]⟩ - | mul w z hw hz => - obtain ⟨P, hP⟩ := hw g - obtain ⟨Q, hQ⟩ := hz (g * wordValue v w) - refine ⟨P ∪ Q, fun a b hab => ?_⟩ - rw [pathProduct_mul, pathProduct_mul, hP a b (fun p hp => hab p (Finset.mem_union_left Q hp)), - hQ a b (fun p hp => hab p (Finset.mem_union_right P hp))] - -/-- Evaluation commutes with pullback of a labeling along a group quotient, -including when different alphabet letters have the same image. -/ -theorem pathProduct_pullback {D : Type*} [Group D] (q : Γ →* D) - (v : S → Γ) (a : D → S → H) (w : FreeGroup S) (g : Γ) : - pathProduct v (fun p s => a (q p) s) w g = pathProduct (fun s => q (v s)) a w (q g) := by - have hv : ∀ w : FreeGroup S, wordValue (fun s => q (v s)) w = q (wordValue v w) := by - have he : wordValue (fun s => q (v s)) = q.comp (wordValue v) := by - apply FreeGroup.ext_hom - intro s - simp [wordValue] - intro w - exact congrArg (fun f : FreeGroup S →* D => f w) he - induction w using FreeGroup.induction_on generalizing g with - | one => simp - | of s => simp - | inv_of s => simp only [pathProduct_inv, pathProduct_of, hv, map_inv, map_mul] - | mul w z hw hz => simp only [pathProduct_mul, hv, map_mul, hw, hz] - - -/-- Once every final relator has trivial transport at every vertex, normal -closure gives trivial transport on every null word, not just on a finite -collection of test loops. -/ - theorem pathProduct_trivial_of_relators (v : S → Γ) (a : Γ → S → H) - (R : Set (FreeGroup S)) (hR : R ⊆ (wordValue v).ker) - (hp : (wordValue v).ker = Subgroup.normalClosure R) - (ha : ∀ r ∈ R, ∀ g, pathProduct v a r g = 1) - (w : FreeGroup S) (hw : wordValue v w = 1) (g : Γ) : pathProduct v a w g = 1 := by - have hrel : R ⊆ (labelLift v a).ker := by - intro r hr - change labelLift v a r = 1 - apply SemidirectProduct.ext - · funext g - exact ha r hr g - · rw [labelLift_right] - exact hR hr - have hle : Subgroup.normalClosure R ≤ (labelLift v a).ker := - Subgroup.normalClosure_le_normal hrel - have he : labelLift v a w = 1 := hle (by rw [← hp]; exact hw) - change (labelLift v a w).left g = 1 - rw [he] - rfl - - def pathChain (v : S → Γ) (w : FreeGroup S) (g : Γ) : (Γ × S) →₀ ℤ := - (pathProduct v (fun p s => Multiplicative.ofAdd (Finsupp.single (p,s) 1)) w g).toAdd - -@[simp] theorem pathChain_one (v : S → Γ) (g : Γ) : pathChain v 1 g = 0 := by - simp [pathChain] -@[simp] theorem pathChain_of (v : S → Γ) (s : S) (g : Γ) : - pathChain v (FreeGroup.of s) g = Finsupp.single (g,s) 1 := by simp [pathChain] - theorem pathChain_mul (v : S → Γ) (w z : FreeGroup S) (g : Γ) : - pathChain v (w*z) g = pathChain v w g + pathChain v z (g * wordValue v w) := by - simp only [pathChain, pathProduct_mul, toAdd_mul] - theorem pathChain_inv (v : S → Γ) (w : FreeGroup S) (g : Γ) : - pathChain v w⁻¹ g = -pathChain v w (g * (wordValue v w)⁻¹) := by - simp only [pathChain, pathProduct_inv, toAdd_inv] - theorem pathChain_conjugate (v : S → Γ) (u r : FreeGroup S) - (hr : wordValue v r = 1) (g : Γ) : - pathChain v (u*r*u⁻¹) g = pathChain v r (g * wordValue v u) := by - simp only [pathChain, pathProduct_conjugate_loop v _ u r hr g, - toAdd_mul, toAdd_inv] - abel - -variable {R : Type*} -abbrev NormalFactor (S R : Type*) := FreeGroup S × R × Bool - - def normalFactorWord (r : R → FreeGroup S) (f : NormalFactor S R) : FreeGroup S := - f.1 * (if f.2.2 then r f.2.1 else (r f.2.1)⁻¹) * f.1⁻¹ - - def normalFactorCount (v : S → Γ) (f : NormalFactor S R) (g : Γ) : (Γ × R) →₀ ℤ := - Finsupp.single (g * wordValue v f.1, f.2.1) (if f.2.2 then 1 else -1) - - def relatorChainMap (v : S → Γ) (r : R → FreeGroup S) : - ((Γ × R) →₀ ℤ) →ₗ[ℤ] ((Γ × S) →₀ ℤ) := - Finsupp.linearCombination ℤ (fun i => pathChain v (r i.2) i.1) - - theorem normalFactor_value (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (f : NormalFactor S R) : - wordValue v (normalFactorWord r f) = 1 := by - dsimp only [normalFactorWord] - split_ifs <;> simp [hr] - - theorem pathChain_normalFactor (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (f : NormalFactor S R) (g : Γ) : - pathChain v (normalFactorWord r f) g = relatorChainMap v r (normalFactorCount v f g) := by - simp only [normalFactorWord, normalFactorCount, relatorChainMap, Finsupp.linearCombination_single] - split_ifs with h - · rw [pathChain_conjugate v _ _ (hr _)]; simp only [one_smul] - · rw [pathChain_conjugate v _ _ (by simp [hr]), pathChain_inv, hr] - simp only [inv_one, mul_one, neg_one_smul] - - theorem pathChain_normalProduct (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (l : List (NormalFactor S R)) (g : Γ) : - pathChain v (l.map (normalFactorWord r)).prod g = - relatorChainMap v r (l.map (fun f => normalFactorCount v f g)).sum := by - induction l with - | nil => simp - | cons f l ih => - simp only [List.map_cons, List.prod_cons, List.sum_cons, map_add, pathChain_mul, - normalFactor_value v r hr f, mul_one, pathChain_normalFactor v r hr f g, ih] - -/-- The coefficient identity is an equality in the full free abelian group of -translated indexed relators. Injectivity is sufficient; no finiteness of the -relator or generator types is assumed. -/ - theorem exact_translated_relator_counts (v : S → Γ) (r : R → FreeGroup S) - (hr : ∀ i, wordValue v (r i) = 1) (hinj : Function.Injective (relatorChainMap v r)) - (z : FreeGroup S) (ρ : R) (hchain : pathChain v z 1 = pathChain v (r ρ) 1) - (l : List (NormalFactor S R)) (he : z = (l.map (normalFactorWord r)).prod) : - (l.map (fun f => normalFactorCount v f 1)).sum = Finsupp.single (1,ρ) 1 := by - apply hinj - rw [← pathChain_normalProduct v r hr, ← he, hchain] - simp [relatorChainMap] - -end EilenbergGanea - -namespace EilenbergGanea -variable {Γ S H : Type*} [Group Γ] [Group H] - - -section CompactLabeling -variable {T I : Type*} - - def mergeLabels (a : Γ → S → H) (b : Γ → T → H) : Γ → S ⊕ T → H := - fun g => Sum.elim (a g) (b g) - - omit [Group Γ] [Group H] in - theorem mergeLabels_continuous [TopologicalSpace H] (a : Γ → S → H) : - Continuous (fun b : Γ → T → H => mergeLabels a b) := by - apply continuous_pi - intro g - apply continuous_pi - intro s - cases s with - | inl s => exact continuous_const - | inr t => exact continuous_apply_apply g t - -/-- Copy arbitrary prescribed labels to a finite quotient solely on the finite -set of vertices currently being tested. This does not assert that the original -labeling is periodic or descends to a single quotient. -/ - theorem copy_labels_on_finite_set {D : Type*} [Group D] (q : Γ →* D) - (P : Finset Γ) (hq : Set.InjOn q (P : Set Γ)) (a : Γ → S → H) - (Allowed : H → Prop) (h1 : Allowed 1) (ha : ∀ g s, Allowed (a g s)) : - ∃ aF : D → S → H, (∀ d s, Allowed (aF d s)) ∧ ∀ p ∈ P, ∀ s, aF (q p) s = a p s := by - classical - let aF : D → S → H := fun d s => if hd : ∃ p ∈ P, q p = d then a hd.choose s else 1 - refine ⟨aF, ?_, ?_⟩ - · intro d s - dsimp [aF] - split_ifs - · exact ha _ _ - · exact h1 - · intro p hp s - have he : ∃ p' ∈ P, q p' = q p := ⟨p, hp, rfl⟩ - simp only [aF, dite_eq_left he] - have heq : he.choose = p := hq he.choose_spec.1 hp he.choose_spec.2 - rw [heq] - -/-- Tychonoff compactness for all extra generators, with the original labels -fixed. The finite-quotient premise is exactly the separate finite solvability -obligation, not a periodicity assumption on the prescribed assignment. -/ - theorem compact_labeling_from_finite_quotients [Group.ResiduallyFinite Γ] - [TopologicalSpace H] [IsTopologicalGroup H] [CompactSpace H] - (v : S ⊕ T → Γ) (a : Γ → S → H) (w : I → FreeGroup (S ⊕ T)) (g : I → Γ) - (K : I → Set H) (hK : ∀ i, IsClosed (K i)) - (Allowed : H → Prop) (h1 : Allowed 1) (ha : ∀ g s, Allowed (a g s)) - (hsolve : ∀ (N : FiniteIndexNormalSubgroup Γ) (J : Finset I) - (aF : (Γ ⧸ N.toSubgroup) → S → H), (∀ d s, Allowed (aF d s)) → - ∃ bF : (Γ ⧸ N.toSubgroup) → T → H, ∀ i ∈ J, ∀ d, - pathProduct (fun s => QuotientGroup.mk' N.toSubgroup (v s)) - (mergeLabels aF bF) (w i) d ∈ K i) : - ∃ b : Γ → T → H, ∀ i, pathProduct v (mergeLabels a b) (w i) (g i) ∈ K i := by - classical - let C : I → Set (Γ → T → H) := fun i => - {b | pathProduct v (mergeLabels a b) (w i) (g i) ∈ K i} - have hc : ∀ i, IsClosed (C i) := fun i => - (hK i).preimage ((pathProduct_continuous v (w i) (g i)).comp (mergeLabels_continuous a)) - have hf : ∀ J : Finset I, (⋂ i ∈ J, C i).Nonempty := by - intro J - choose P hP using (fun i : I => pathProduct_finite_locations (H := H) v (w i) (g i)) - let V := J.biUnion P - obtain ⟨N, hN⟩ := finite_set_quotient_injective V - let q := QuotientGroup.mk' N.toSubgroup - obtain ⟨aF, haF, heF⟩ := copy_labels_on_finite_set q V hN a Allowed h1 ha - obtain ⟨bF, hbF⟩ := hsolve N J aF haF - refine ⟨fun p t => bF (q p) t, ?_⟩ - simp only [Set.mem_iInter] - intro i hi - change pathProduct v (mergeLabels a (fun p t => bF (q p) t)) (w i) (g i) ∈ K i - have he : pathProduct v (mergeLabels a (fun p t => bF (q p) t)) (w i) (g i) = - pathProduct v (fun p s => mergeLabels aF bF (q p) s) (w i) (g i) := by - apply hP i - intro p hp s - cases s with - | inl s => exact (heF p (Finset.mem_biUnion.mpr ⟨i, hi, hp⟩) s).symm - | inr t => rfl - rw [he, pathProduct_pullback] - exact hbF i hi (q (g i)) - obtain ⟨b, hb⟩ := CompactSpace.iInter_nonempty hc hf - exact ⟨b, fun i => Set.mem_iInter.mp hb i⟩ -end CompactLabeling -end EilenbergGanea - -open scoped Quaternion -namespace EilenbergGanea - -theorem su2_norm (a : SU2) : ‖(a : ℍ)‖ = 1 := by - have h : star (a : ℍ) * (a : ℍ) = 1 := a.property.1 - have hn := congrArg norm h - simp only [norm_mul, norm_star, norm_one] at hn - nlinarith [norm_nonneg (a : ℍ)] - -/-- The two elementary estimates needed for the presentation argument, with -constants independent of the Cayley graph or any finite quotient. -/ -theorem unit_product_linearization (l : List ℍ) (h : ℝ) (hh : 0 ≤ h) - (hu : ∀ a ∈ l, ‖a‖ = 1) (hb : ∀ a ∈ l, ‖a - 1‖ ≤ h) : - ‖l.prod - 1‖ ≤ l.length * h ∧ - ‖l.prod - 1 - (l.map (fun a => a - 1)).sum‖ ≤ (l.length : ℝ)^2 * h^2 := by - induction l with - | nil => simp - | cons a l ih => - obtain ⟨hp, he⟩ := ih (fun b hm => hu b (by simp [hm])) (fun b hm => hb b (by simp [hm])) - have hna := hu a (by simp) - have hba := hb a (by simp) - have hid : a * l.prod - 1 = a * (l.prod - 1) + (a - 1) := by noncomm_ring - have hie : a * l.prod - 1 - ((a - 1) + (l.map (fun b => b - 1)).sum) = - (a - 1) * (l.prod - 1) + (l.prod - 1 - (l.map (fun b => b - 1)).sum) := by noncomm_ring - constructor - · simp only [List.prod_cons, List.length_cons, Nat.cast_add, Nat.cast_one] - rw [hid] - calc - _ ≤ ‖a * (l.prod - 1)‖ + ‖a - 1‖ := norm_add_le _ _ - _ = ‖l.prod - 1‖ + ‖a - 1‖ := by rw [norm_mul, hna, one_mul] - _ ≤ (l.length + 1) * h := by nlinarith - · simp only [List.prod_cons, List.map_cons, List.sum_cons, List.length_cons, Nat.cast_add, Nat.cast_one] - rw [hie] - have hn : 0 ≤ (l.length : ℝ) := Nat.cast_nonneg _ - calc - _ ≤ ‖(a - 1) * (l.prod - 1)‖ + ‖l.prod - 1 - (l.map (fun b => b - 1)).sum‖ := norm_add_le _ _ - _ = ‖a - 1‖ * ‖l.prod - 1‖ + ‖l.prod - 1 - (l.map (fun b => b - 1)).sum‖ := by rw [norm_mul] - _ ≤ h * (l.length * h) + (l.length : ℝ)^2 * h^2 := - add_le_add (mul_le_mul hba hp (norm_nonneg _) hh) he - _ ≤ (l.length + 1)^2 * h^2 := by nlinarith [sq_nonneg h] - - theorem quaternion_commutator_bound (a b : ℍ) : - ‖a * b - b * a‖ ≤ 2 * ‖a - 1‖ * ‖b - 1‖ := by - have he : a * b - b * a = (a - 1) * (b - 1) - (b - 1) * (a - 1) := by noncomm_ring - rw [he] - calc - _ ≤ ‖(a - 1) * (b - 1)‖ + ‖(b - 1) * (a - 1)‖ := norm_sub_le _ _ - _ = _ := by rw [norm_mul, norm_mul]; ring - - theorem su2_conjugation_error (a b : SU2) : - ‖((a * b * a⁻¹ : SU2) : ℍ) - (b : ℍ)‖ ≤ 2 * ‖(a : ℍ) - 1‖ * ‖(b : ℍ) - 1‖ := by - have he : ((a * b * a⁻¹ : SU2) : ℍ) - (b : ℍ) = - ((a : ℍ) * (b : ℍ) - (b : ℍ) * (a : ℍ)) * ((a⁻¹ : SU2) : ℍ) := by - change (a : ℍ) * (b : ℍ) * star (a : ℍ) - (b : ℍ) = _ - change _ = ((a : ℍ) * (b : ℍ) - (b : ℍ) * (a : ℍ)) * star (a : ℍ) - rw [sub_mul, mul_assoc (b : ℍ), a.property.2, mul_one] - rw [he, norm_mul, su2_norm, mul_one] - exact quaternion_commutator_bound _ _ - - theorem su2_inverse_distance (b : SU2) : ‖((b⁻¹ : SU2) : ℍ) - 1‖ = ‖(b : ℍ) - 1‖ := by - change ‖star (b : ℍ) - 1‖ = _ - calc - _ = ‖star ((b : ℍ) - 1)‖ := by rw [star_sub, star_one] - _ = _ := norm_star _ - - theorem su2_inverse_linearization (b : SU2) : - ‖((b⁻¹ : SU2) : ℍ) - 1 + ((b : ℍ) - 1)‖ ≤ ‖(b : ℍ) - 1‖^2 := by - have he : ((b⁻¹ : SU2) : ℍ) - 1 + ((b : ℍ) - 1) = - -((((b⁻¹ : SU2) : ℍ) - 1) * ((b : ℍ) - 1)) := by - have hb : ((b⁻¹ : SU2) : ℍ) * (b : ℍ) = 1 := b.property.1 - noncomm_ring [hb] - rw [he, norm_neg, norm_mul, su2_inverse_distance, pow_two] - -/-- Replacing each displacement by its linear model introduces only the sum -of the errors. Combined with exact signed counts, this avoids any choice of -an ordering of the relator indices (which can be uncountable). -/ -theorem unit_product_with_linear_models {I : Type*} (l : List I) - (f : I → SU2) (v : I → ℍ) (h D : ℝ) (hh : 0 ≤ h) - (hb : ∀ i ∈ l, ‖(f i : ℍ) - 1‖ ≤ h) - (he : ∀ i ∈ l, ‖(f i : ℍ) - 1 - v i‖ ≤ D) : - ‖((l.map (fun i => (f i : ℍ))).prod - 1) - (l.map v).sum‖ ≤ - (l.length : ℝ)^2 * h^2 + l.length * D := by - have hp := (unit_product_linearization (l.map (fun i => (f i : ℍ))) h hh - (by intro a ha; obtain ⟨i, _, rfl⟩ := List.mem_map.mp ha; exact su2_norm _) - (by intro a ha; obtain ⟨i, hi, rfl⟩ := List.mem_map.mp ha; exact hb i hi)).2 - simp only [List.length_map, List.map_map, Function.comp_def] at hp - have hs : ∀ l : List I, (∀ i ∈ l, ‖(f i : ℍ) - 1 - v i‖ ≤ D) → - ‖(l.map (fun i => (f i : ℍ) - 1)).sum - (l.map v).sum‖ ≤ l.length * D := by - intro l he - induction l with - | nil => simp - | cons i l ih => - have hi := he i (by simp) - have hrest := ih (fun j hj => he j (by simp [hj])) - simp only [List.map_cons, List.sum_cons, List.length_cons, Nat.cast_add, Nat.cast_one] - have heq : (f i : ℍ) - 1 + (l.map (fun j => (f j : ℍ) - 1)).sum - - (v i + (l.map v).sum) = ((f i : ℍ) - 1 - v i) + - ((l.map (fun j => (f j : ℍ) - 1)).sum - (l.map v).sum) := by abel - rw [heq] - exact (norm_add_le _ _).trans (by linarith) - - calc - _ ≤ ‖((l.map (fun i => (f i : ℍ))).prod - 1) - (l.map (fun i => (f i : ℍ) - 1)).sum‖ + - ‖(l.map (fun i => (f i : ℍ) - 1)).sum - (l.map v).sum‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ - _ ≤ _ := add_le_add hp (hs l he) -end EilenbergGanea - -namespace EilenbergGanea -open scoped Quaternion - -theorem su2_conjugation_distance (a b : SU2) : - ‖((a * b * a⁻¹ : SU2) : ℍ) - 1‖ = ‖(b : ℍ) - 1‖ := by - have he : ((a * b * a⁻¹ : SU2) : ℍ) - 1 = - (a : ℍ) * ((b : ℍ) - 1) * star (a : ℍ) := by - change (a : ℍ) * (b : ℍ) * star (a : ℍ) - 1 = _ - rw [mul_sub, sub_mul, mul_one, a.property.2] - rw [he, norm_mul, norm_mul, norm_star, su2_norm, one_mul, mul_one] - -def signedUnit (b : SU2) (ε : Bool) : SU2 := if ε then b else b⁻¹ -def signedDisplacement (b : SU2) (ε : Bool) : ℍ := if ε then (b : ℍ) - 1 else -((b : ℍ) - 1) - - theorem signedUnit_distance (b : SU2) (ε : Bool) : - ‖(signedUnit b ε : ℍ) - 1‖ = ‖(b : ℍ) - 1‖ := by - cases ε <;> simp [signedUnit, su2_inverse_distance] - - theorem signedUnit_error (b : SU2) (ε : Bool) : - ‖(signedUnit b ε : ℍ) - 1 - signedDisplacement b ε‖ ≤ ‖(b : ℍ) - 1‖^2 := by - cases ε with - | false => - change ‖((b⁻¹ : SU2) : ℍ) - 1 - (-((b : ℍ) - 1))‖ ≤ _ - simpa only [sub_neg_eq_add] using su2_inverse_linearization b - | true => simp [signedUnit, signedDisplacement] - - theorem conjugated_signedUnit_error (a b : SU2) (ε : Bool) (A h : ℝ) - (hA : 0 ≤ A) (hh : 0 ≤ h) (ha : ‖(a : ℍ) - 1‖ ≤ A) (hb : ‖(b : ℍ) - 1‖ ≤ h) : - ‖((a * signedUnit b ε * a⁻¹ : SU2) : ℍ) - 1 - signedDisplacement b ε‖ ≤ - 2 * A * h + h^2 := by - have he : ((a * signedUnit b ε * a⁻¹ : SU2) : ℍ) - 1 - signedDisplacement b ε = - (((a * signedUnit b ε * a⁻¹ : SU2) : ℍ) - (signedUnit b ε : ℍ)) + - ((signedUnit b ε : ℍ) - 1 - signedDisplacement b ε) := by abel - rw [he] - have hsq : ‖(b : ℍ) - 1‖^2 ≤ h^2 := by nlinarith [norm_nonneg ((b : ℍ) - 1)] - calc - _ ≤ ‖((a * signedUnit b ε * a⁻¹ : SU2) : ℍ) - (signedUnit b ε : ℍ)‖ + - ‖(signedUnit b ε : ℍ) - 1 - signedDisplacement b ε‖ := norm_add_le _ _ - _ ≤ 2 * ‖(a : ℍ) - 1‖ * ‖(b : ℍ) - 1‖ + ‖(b : ℍ) - 1‖^2 := by - simpa only [signedUnit_distance] using add_le_add (su2_conjugation_error a (signedUnit b ε)) (signedUnit_error b ε) - _ ≤ _ := add_le_add (mul_le_mul (mul_le_mul_of_nonneg_left ha (by positivity)) hb - (norm_nonneg _) (mul_nonneg (by positivity) hA)) hsq - -abbrev RelatorFactor (I : Type*) := SU2 × I × Bool - -def relatorFactorValue {I : Type*} (x : I → SU2) (r : RelatorFactor I) : SU2 := - r.1 * signedUnit (x r.2.1) r.2.2 * r.1⁻¹ - -def relatorSignedCounts {I : Type*} (l : List (RelatorFactor I)) : I →₀ ℤ := - (l.map (fun r => Finsupp.single r.2.1 (if r.2.2 then 1 else -1))).sum - - theorem relator_linear_models {I : Type*} (l : List (RelatorFactor I)) (x : I → SU2) : - (l.map (fun r => signedDisplacement (x r.2.1) r.2.2)).sum = - Finsupp.linearCombination ℤ (fun i => (x i : ℍ) - 1) (relatorSignedCounts l) := by - induction l with - | nil => simp [relatorSignedCounts] - | cons r l ih => - simp only [List.map_cons, List.sum_cons, relatorSignedCounts, map_add, Finsupp.linearCombination_single] - rw [← show Finsupp.linearCombination ℤ (fun i => (x i : ℍ) - 1) - ((l.map (fun r => Finsupp.single r.2.1 (if r.2.2 then 1 else -1))).sum) = - (l.map (fun r => signedDisplacement (x r.2.1) r.2.2)).sum from ih.symm] - congr 2 - cases r.2.2 <;> simp [signedDisplacement] - -/-- Exact translated counts cancel the full linear term; the remaining bound -is quadratic. The index set is arbitrary, not necessarily countable. -/ -theorem relator_product_quadratic {I : Type*} (l : List (RelatorFactor I)) (x : I → SU2) - (i₀ : I) (hc : relatorSignedCounts l = Finsupp.single i₀ 1) - (h ε K : ℝ) (hh : 0 ≤ h) (hε : 0 ≤ ε) (hK : 0 ≤ K) - (hb : ∀ r ∈ l, ‖(x r.2.1 : ℍ) - 1‖ ≤ h) - (ha : ∀ r ∈ l, ‖(r.1 : ℍ) - 1‖ ≤ K * (ε + h)) : - ‖(l.map (fun r => (relatorFactorValue x r : ℍ))).prod - (x i₀ : ℍ)‖ ≤ - ((l.length : ℝ)^2 + l.length + 2 * l.length * K) * (ε + h) * h := by - have hp := unit_product_with_linear_models l (relatorFactorValue x) - (fun r => signedDisplacement (x r.2.1) r.2.2) h - (2 * (K * (ε + h)) * h + h^2) hh - (fun r hr => by rw [relatorFactorValue, su2_conjugation_distance, signedUnit_distance]; exact hb r hr) - (fun r hr => conjugated_signedUnit_error r.1 (x r.2.1) r.2.2 _ h - (mul_nonneg hK (add_nonneg hε hh)) hh (ha r hr) (hb r hr)) - rw [relator_linear_models, hc, Finsupp.linearCombination_single, one_smul] at hp - have he : (l.map (fun r => (relatorFactorValue x r : ℍ))).prod - 1 - ((x i₀ : ℍ) - 1) = - (l.map (fun r => (relatorFactorValue x r : ℍ))).prod - (x i₀ : ℍ) := by abel - rw [he] at hp - apply hp.trans - have hlen : 0 ≤ (l.length : ℝ) := Nat.cast_nonneg _ - have hnh : 0 ≤ ((l.length : ℝ)^2 + l.length) * ε * h := - mul_nonneg (mul_nonneg (add_nonneg (sq_nonneg _) hlen) hε) hh - nlinarith -end EilenbergGanea - -namespace EilenbergGanea - -/-- A uniform size for an arbitrary family, normalized to zero for an empty -index set. This is a real supremum, not an attained maximum. -/ -def familySize {I : Type*} (f : I → ℝ) : ℝ := sSup (Set.range f ∪ {0}) - - theorem familySize_nonneg {I : Type*} (f : I → ℝ) (hf : BddAbove (Set.range f)) : - 0 ≤ familySize f := by - apply le_csSup (hf.union bddAbove_singleton) - exact Or.inr (Set.mem_singleton _) - - theorem le_familySize {I : Type*} (f : I → ℝ) (hf : BddAbove (Set.range f)) (i : I) : - f i ≤ familySize f := le_csSup (hf.union bddAbove_singleton) (Or.inl (Set.mem_range_self i)) - - theorem familySize_le {I : Type*} (f : I → ℝ) {c : ℝ} (hc : 0 ≤ c) (hf : ∀ i, f i ≤ c) : - familySize f ≤ c := by - apply csSup_le (Set.union_nonempty.mpr (Or.inr (Set.singleton_nonempty 0))) - rintro x (⟨i, rfl⟩ | rfl) - · exact hf i - · exact hc - -/-- The source no-threshold-crossing argument does not assume attainment of -its supremum. -/ - theorem familySize_ne_threshold {I : Type*} (f : I → ℝ) - (hf : BddAbove (Set.range f)) (C δ η ε : ℝ) - (hδ : 0 < δ) (hC : 0 ≤ C) (_hη : 0 ≤ η) (hε : 0 ≤ ε) (hεη : ε ≤ η) - (hc₁ : C * (δ + η) < 1/2) (hc₂ : C * η < δ/2) - (hbound : ∀ i, f i ≤ C * ε + C * (familySize f + ε) * familySize f) : - familySize f ≠ δ := by - intro he - have hs : familySize f ≤ C * ε + C * (familySize f + ε) * familySize f := - familySize_le f (by positivity [familySize_nonneg f hf]) hbound - rw [he] at hs - have hce : C * ε ≤ C * η := mul_le_mul_of_nonneg_left hεη hC - have hfactor : C * (δ + ε) ≤ C * (δ + η) := mul_le_mul_of_nonneg_left (by linarith) hC - nlinarith [mul_lt_mul_of_pos_right hc₁ hδ, mul_le_mul_of_nonneg_right hfactor hδ.le] - -/-- Uniform contraction of all residual errors. This handles even an -uncountable family and does not replace the supremum by a maximum. -/ - theorem familySize_contraction {I : Type*} (f : I → ℝ) - (hf : ∀ i, 0 ≤ f i) (δ C η : ℝ) (hδ : 0 ≤ δ) (hC : 0 ≤ C) (hη : 0 ≤ η) - (hb : ∀ i, f i ≤ δ) (hc : C * (δ + η) < 1) - (he : ∀ i, f i ≤ C * (familySize f + η) * familySize f) : ∀ i, f i = 0 := by - have hbounded : BddAbove (Set.range f) := ⟨δ, by rintro _ ⟨i, rfl⟩; exact hb i⟩ - have h0 := familySize_nonneg f hbounded - have hmax := familySize_le f hδ hb - have hs := familySize_le f (c := C * (familySize f + η) * familySize f) (by positivity) he - have hmul : C * (familySize f + η) ≤ C * (δ + η) := - mul_le_mul_of_nonneg_left (by linarith) hC - have heq : familySize f = 0 := by - by_contra hn - have hp : 0 < familySize f := lt_of_le_of_ne h0 (Ne.symm hn) - have ht := mul_lt_mul_of_pos_right (lt_of_le_of_lt hmul hc) hp - nlinarith - intro i - exact le_antisymm (by simpa only [heq] using le_familySize f hbounded i) (hf i) - - theorem small_thresholds_exist (C : ℝ) (hC : 1 ≤ C) : - ∃ δ η : ℝ, 0 < δ ∧ δ < 1 ∧ 0 < η ∧ η < 1 ∧ - C * (δ + η) < 1/2 ∧ C * η < δ/2 := by - have hc : 0 < C := by linarith - let δ := 1 / (8*C) - let η := δ / (8*C) - have hd : 0 < δ := by dsimp [δ]; positivity - have hd1 : δ < 1 := by dsimp [δ]; apply (div_lt_iff₀ (by positivity)).mpr; linarith - have he : 0 < η := by dsimp [η]; positivity - have heδ : η < δ := by dsimp [η]; apply (div_lt_iff₀ (by positivity)).mpr; nlinarith - have hcd : C * δ = 1/8 := by dsimp [δ]; field_simp - have hce : C * η = δ/8 := by dsimp [η]; field_simp - refine ⟨δ, η, hd, hd1, he, heδ.trans hd1, ?_, ?_⟩ - · rw [mul_add, hcd, hce]; linarith - · rw [hce]; linarith -end EilenbergGanea - - -end - -end OAI +import OAI.Topology.EilenbergGanea.WordEquations +import OAI.GroupTheory.RightAngledArtin.ResidualFiniteness +import Mathlib.Topology.Compactness.Compact +import Mathlib.LinearAlgebra.Finsupp.LinearCombination + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +namespace EilenbergGanea +open scoped Quaternion ContDiff +/-- Squared chord length on the unit-quaternion sphere. -/ +theorem su2_distance_square (a : SU2) : + ‖(a : ℍ) - 1‖ ^ 2 = 2 - 2 * (a : ℍ).re := by + have hu := (quaternion_mem_unitary_iff _).mp a.property + have hs : Quaternion.normSq ((a : ℍ) - 1) = Quaternion.normSq (a : ℍ) + 1 - 2 * (a : ℍ).re := by + simp only [Quaternion.normSq_def', Quaternion.re_sub, Quaternion.imI_sub, + Quaternion.imJ_sub, Quaternion.imK_sub, Quaternion.re_one, + Quaternion.imI_one, Quaternion.imJ_one, Quaternion.imK_one] + ring + simpa only [Quaternion.normSq_eq_norm_mul_self, hu, one_mul, sq, one_add_one_eq_two] using hs + +def arcBlend (a : SU2) (t : ℝ) : ℍ := + (1 - Real.smoothTransition t) • (1 : ℍ) + Real.smoothTransition t • (a : ℍ) + +theorem arcBlend_norm_le (a : SU2) (t : ℝ) : ‖arcBlend a t‖ ≤ 1 := by + have h0 := Real.smoothTransition.nonneg t + have h1 := Real.smoothTransition.le_one t + have hn := (quaternion_mem_unitary_iff _).mp a.property + calc + _ ≤ ‖(1 - Real.smoothTransition t) • (1 : ℍ)‖ + + ‖Real.smoothTransition t • (a : ℍ)‖ := norm_add_le _ _ + _ = 1 := by rw [norm_smul, norm_smul, norm_one, hn, Real.norm_eq_abs, + Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr h1), abs_of_nonneg h0]; ring + +theorem small_unit_re (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) : + 0 < (a : ℍ).re ∧ (a : ℍ).re ≤ 1 := by + have h := su2_distance_square a + have hn := norm_nonneg ((a : ℍ) - 1) + constructor <;> nlinarith [sq_nonneg ‖(a : ℍ) - 1‖] + +theorem arcBlend_re_le (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) (t : ℝ) : + (a : ℍ).re ≤ (arcBlend a t).re := by + have h := (small_unit_re a ha).2 + have h0 := Real.smoothTransition.nonneg t + have h1 := Real.smoothTransition.le_one t + simp only [arcBlend, Quaternion.re_add, Quaternion.re_smul, Quaternion.re_one, smul_eq_mul] + nlinarith + +theorem arcBlend_ne_zero (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) (t : ℝ) : + arcBlend a t ≠ 0 := by + have h := (small_unit_re a ha).1.trans_le (arcBlend_re_le a ha t) + intro he + simp only [he, Quaternion.re_zero, lt_self_iff_false] at h + +/-- A globally smooth path that remains in the closed chord ball of its +endpoint, avoiding any branch choice of a quaternion logarithm. -/ +def smallQuaternionArc (a : SU2) (t : ℝ) : SU2 := normalizeQuaternion (arcBlend a t) + +@[simp] theorem smallQuaternionArc_zero (a : SU2) : smallQuaternionArc a 0 = 1 := by + simpa [smallQuaternionArc, arcBlend] using (normalizeQuaternion_unitary (1 : SU2)) + +@[simp] theorem smallQuaternionArc_one (a : SU2) : smallQuaternionArc a 1 = a := by + simp [smallQuaternionArc, arcBlend] + +theorem smallQuaternionArc_smooth (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) : + ContDiff ℝ ∞ (fun t => (smallQuaternionArc a t : ℍ)) := by + apply contDiff_iff_contDiffAt.mpr + intro t + exact (normalizeQuaternion_coe_contDiffAt (arcBlend_ne_zero a ha t)).comp t + (((contDiff_const.sub Real.smoothTransition.contDiff).smul contDiff_const).add + (Real.smoothTransition.contDiff.smul contDiff_const)).contDiffAt + +theorem smallQuaternionArc_distance (a : SU2) (ha : ‖(a : ℍ) - 1‖ < 1) (t : ℝ) : + ‖(smallQuaternionArc a t : ℍ) - 1‖ ≤ ‖(a : ℍ) - 1‖ := by + have hp : 0 < ‖arcBlend a t‖ := norm_pos_iff.mpr (arcBlend_ne_zero a ha t) + have hre : (a : ℍ).re ≤ (smallQuaternionArc a t : ℍ).re := by + rw [smallQuaternionArc, normalizeQuaternion_coe_of_ne_zero (arcBlend_ne_zero a ha t)] + simp only [Quaternion.re_smul, smul_eq_mul] + rw [mul_comm, ← div_eq_mul_inv, le_div_iff₀ hp] + exact (mul_le_of_le_one_right (small_unit_re a ha).1.le (arcBlend_norm_le a t)).trans + (arcBlend_re_le a ha t) + have h0 := su2_distance_square a + have h1 := su2_distance_square (smallQuaternionArc a t) + nlinarith [norm_nonneg ((a : ℍ)-1), norm_nonneg ((smallQuaternionArc a t : ℍ)-1)] + +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion ContDiff +open Set +section SelectedEquations +variable {E : Type*} {m d : ℕ} + +/-- The selected unknowns remain separate from coefficients, even when two +letters have the same image in the group quotient. -/ +def selectedAlphabet (σ : Fin m ↪ E) (e : E) : E ⊕ Fin m := by + classical + exact if h : ∃ i, σ i = e then .inr h.choose else .inl e + +@[simp] theorem selectedAlphabet_selected (σ : Fin m ↪ E) (i : Fin m) : + selectedAlphabet σ (σ i) = .inr i := by + classical + have h : ∃ j, σ j = σ i := ⟨i,rfl⟩ + simp only [selectedAlphabet, dite_eq_left h] + exact congrArg Sum.inr (σ.injective h.choose_spec) + + theorem selectedAlphabet_other (σ : Fin m ↪ E) (e : E) (he : ∀ i, σ i ≠ e) : + selectedAlphabet σ e = .inl e := by + classical + simp [selectedAlphabet, he] + +def selectedWord (σ : Fin m ↪ E) : FreeGroup E →* FreeGroup (E ⊕ Fin m) := + FreeGroup.map (selectedAlphabet σ) + +def selectedLabel (σ : Fin m ↪ E) (a : E → SU2) (x : Fin m → SU2) (e : E) : SU2 := + Sum.elim a x (selectedAlphabet σ e) + +@[simp] theorem selectedLabel_selected (σ : Fin m ↪ E) (a : E → SU2) + (x : Fin m → SU2) (i : Fin m) : selectedLabel σ a x (σ i) = x i := by + simp [selectedLabel] + + theorem selectedLabel_other (σ : Fin m ↪ E) (a : E → SU2) (x : Fin m → SU2) + (e : E) (he : ∀ i, σ i ≠ e) : selectedLabel σ a x e = a e := by + rw [selectedLabel, selectedAlphabet_other σ e he] + rfl + + theorem selectedWord_eval (σ : Fin m ↪ E) (a : E → SU2) (x : Fin m → SU2) + (w : FreeGroup E) : + FreeGroup.lift (Sum.elim a x) (selectedWord σ w) = + FreeGroup.lift (selectedLabel σ a x) w := by + have he : (FreeGroup.lift (Sum.elim a x)).comp (selectedWord σ) = + FreeGroup.lift (selectedLabel σ a x) := by + apply FreeGroup.ext_hom + intro e + simp [selectedWord, selectedLabel] + exact congrArg (fun f : FreeGroup E →* SU2 => f w) he + + theorem selectedWord_exponents [DecidableEq E] (σ : Fin m ↪ E) (w : FreeGroup E) (j : Fin m) : + wordExponents (eraseCoefficients (selectedWord σ w)) j = wordExponents w (σ j) := by + classical + have he : (FreeGroup.lift (fun i : Fin m => Multiplicative.ofAdd (if j = i then (1 : ℤ) else 0))).comp + (eraseCoefficients.comp (selectedWord σ)) = + FreeGroup.lift (fun e : E => Multiplicative.ofAdd (if σ j = e then (1 : ℤ) else 0)) := by + apply FreeGroup.ext_hom + intro e + by_cases h : ∃ i, σ i = e + · obtain ⟨i,rfl⟩ := h + simp [selectedWord, eraseCoefficients, σ.injective.eq_iff] + · have h' : ∀ i, σ i ≠ e := by simpa only [not_exists] using h + simp [selectedWord, eraseCoefficients, selectedAlphabet_other σ e h', h' j] + exact congrArg (fun f : FreeGroup E →* Multiplicative ℤ => (f w).toAdd) he + +/-- Solve a finite, full-rank system while keeping every unselected label fixed. +The distinguished sublevel condition is the actual isolated root condition, +not a nonsingularity assumption on the roots. -/ +theorem selected_word_sublevel_solvable [DecidableEq E] + (σ : Fin m ↪ E) (w : Fin m → FreeGroup E) (ρ : Fin d → FreeGroup E) + (a : ℝ → E → SU2) (ha : ∀ e, ContDiff ℝ ∞ (fun t => (a t e : ℍ))) + (ha0 : ∀ e, a 0 e = 1) + (hB : Matrix.det (fun i j => wordExponents (w i) (σ j)) ≠ 0) + (δ : ℝ) (hδ : 0 < δ) + (hiso : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x : Fin m → SU2, + (∀ i, FreeGroup.lift (selectedLabel σ (a t) x) (w i) = 1) → + ‖(fun i => (FreeGroup.lift (selectedLabel σ (a t) x) (ρ i) : ℍ)) - 1‖ ≠ δ) : + ∃ b : E → SU2, + (∀ e, (∀ i, σ i ≠ e) → b e = a 1 e) ∧ + (∀ i, FreeGroup.lift b (w i) = 1) ∧ + ‖(fun i => (FreeGroup.lift b (ρ i) : ℍ)) - 1‖ < δ := by + have hb : (exponentMatrix (fun i => eraseCoefficients (selectedWord σ (w i)))).det ≠ 0 := by + change (Matrix.det (fun i j => wordExponents (eraseCoefficients (selectedWord σ (w i))) j)) ≠ 0 + simpa only [selectedWord_exponents] using hB + obtain ⟨x,hx,hρ⟩ := coefficient_word_sublevel_solvable + (fun i => selectedWord σ (w i)) (fun i => selectedWord σ (ρ i)) a ha ha0 hb δ hδ + (fun t ht x hx => by + simp only [coefficientWordMap, selectedWord_eval] + apply hiso t ht x + intro i + have hi := congrFun hx i + simpa only [coefficientWordMap, selectedWord_eval, Pi.one_apply] using hi) + refine ⟨selectedLabel σ (a 1) x, fun e he => selectedLabel_other σ _ x e he, ?_, ?_⟩ + · intro i + have hi := congrFun hx i + simpa only [coefficientWordMap, selectedWord_eval, Pi.one_apply] using hi + · simpa only [coefficientWordMap, selectedWord_eval] using hρ + +end SelectedEquations +end EilenbergGanea + +namespace EilenbergGanea + +variable {Γ S H : Type*} [Group Γ] [Group H] + +def labelLift (v : S → Γ) (a : Γ → S → H) : + FreeGroup S →* ((Γ → H) ⋊[functionShift Γ H] Γ) := + FreeGroup.lift (fun s => ⟨fun g => a g s, v s⟩) + +def wordValue (v : S → Γ) : FreeGroup S →* Γ := FreeGroup.lift v + +def pathProduct (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) (g : Γ) : H := + (labelLift v a w).left g + + theorem labelLift_right (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) : + (labelLift v a w).right = wordValue v w := by + have he : (SemidirectProduct.rightHom : ((Γ → H) ⋊[functionShift Γ H] Γ) →* Γ).comp + (labelLift v a) = wordValue v := by + apply FreeGroup.ext_hom + intro s + simp [labelLift, wordValue] + exact congrArg (fun f : FreeGroup S →* Γ => f w) he + +@[simp] theorem pathProduct_one (v : S → Γ) (a : Γ → S → H) (g : Γ) : + pathProduct v a 1 g = 1 := by simp [pathProduct] +@[simp] theorem pathProduct_of (v : S → Γ) (a : Γ → S → H) (s : S) (g : Γ) : + pathProduct v a (FreeGroup.of s) g = a g s := by simp [pathProduct, labelLift] + theorem pathProduct_mul (v : S → Γ) (a : Γ → S → H) (w z : FreeGroup S) (g : Γ) : + pathProduct v a (w*z) g = pathProduct v a w g * pathProduct v a z (g * wordValue v w) := by + simp only [pathProduct, map_mul, SemidirectProduct.mul_left, Pi.mul_apply, labelLift_right] + rfl + theorem pathProduct_inv (v : S → Γ) (a : Γ → S → H) (w : FreeGroup S) (g : Γ) : + pathProduct v a w⁻¹ g = (pathProduct v a w (g * (wordValue v w)⁻¹))⁻¹ := by + simp only [pathProduct, map_inv, SemidirectProduct.inv_left, labelLift_right] + rfl + + theorem pathProduct_conjugate_loop (v : S → Γ) (a : Γ → S → H) + (u r : FreeGroup S) (hr : wordValue v r = 1) (g : Γ) : + pathProduct v a (u*r*u⁻¹) g = pathProduct v a u g * + pathProduct v a r (g * wordValue v u) * (pathProduct v a u g)⁻¹ := by + rw [pathProduct_mul, pathProduct_mul, pathProduct_inv, map_mul, hr, mul_one] + simp only [mul_inv_cancel_right] + + theorem pathProduct_continuous [TopologicalSpace H] [IsTopologicalGroup H] + (v : S → Γ) (w : FreeGroup S) (g : Γ) : + Continuous (fun a : Γ → S → H => pathProduct v a w g) := by + induction w using FreeGroup.induction_on generalizing g with + | one => simpa using (continuous_const : Continuous (fun _ : Γ → S → H => (1 : H))) + | of s => + simp only [pathProduct_of] + exact continuous_apply_apply g s + | inv_of s => + simp only [pathProduct_inv, pathProduct_of] + exact (continuous_apply_apply (g * (wordValue v (FreeGroup.of s))⁻¹) s).inv + | mul w z hw hz => + simp only [pathProduct_mul] + exact (hw g).mul (hz (g * wordValue v w)) + +/-- The set of vertices inspected by a word is finite, independently of the +label values. No countability hypothesis on the alphabet is needed. -/ +theorem pathProduct_finite_locations (v : S → Γ) (w : FreeGroup S) (g : Γ) : + ∃ P : Finset Γ, ∀ a b : Γ → S → H, + (∀ p ∈ P, ∀ s, a p s = b p s) → pathProduct v a w g = pathProduct v b w g := by + classical + induction w using FreeGroup.induction_on generalizing g with + | one => exact ⟨∅, fun _ _ _ => by simp⟩ + | of s => exact ⟨{g}, fun a b hab => by simpa using hab g (by simp) s⟩ + | inv_of s => + exact ⟨{g * (wordValue v (FreeGroup.of s))⁻¹}, fun a b hab => by + rw [pathProduct_inv, pathProduct_inv, pathProduct_of, pathProduct_of, hab _ (by simp)]⟩ + | mul w z hw hz => + obtain ⟨P, hP⟩ := hw g + obtain ⟨Q, hQ⟩ := hz (g * wordValue v w) + refine ⟨P ∪ Q, fun a b hab => ?_⟩ + rw [pathProduct_mul, pathProduct_mul, hP a b (fun p hp => hab p (Finset.mem_union_left Q hp)), + hQ a b (fun p hp => hab p (Finset.mem_union_right P hp))] + +/-- Evaluation commutes with pullback of a labeling along a group quotient, +including when different alphabet letters have the same image. -/ +theorem pathProduct_pullback {D : Type*} [Group D] (q : Γ →* D) + (v : S → Γ) (a : D → S → H) (w : FreeGroup S) (g : Γ) : + pathProduct v (fun p s => a (q p) s) w g = pathProduct (fun s => q (v s)) a w (q g) := by + have hv : ∀ w : FreeGroup S, wordValue (fun s => q (v s)) w = q (wordValue v w) := by + have he : wordValue (fun s => q (v s)) = q.comp (wordValue v) := by + apply FreeGroup.ext_hom + intro s + simp [wordValue] + intro w + exact congrArg (fun f : FreeGroup S →* D => f w) he + induction w using FreeGroup.induction_on generalizing g with + | one => simp + | of s => simp + | inv_of s => simp only [pathProduct_inv, pathProduct_of, hv, map_inv, map_mul] + | mul w z hw hz => simp only [pathProduct_mul, hv, map_mul, hw, hz] + + +/-- Once every final relator has trivial transport at every vertex, normal +closure gives trivial transport on every null word, not just on a finite +collection of test loops. -/ + theorem pathProduct_trivial_of_relators (v : S → Γ) (a : Γ → S → H) + (R : Set (FreeGroup S)) (hR : R ⊆ (wordValue v).ker) + (hp : (wordValue v).ker = Subgroup.normalClosure R) + (ha : ∀ r ∈ R, ∀ g, pathProduct v a r g = 1) + (w : FreeGroup S) (hw : wordValue v w = 1) (g : Γ) : pathProduct v a w g = 1 := by + have hrel : R ⊆ (labelLift v a).ker := by + intro r hr + change labelLift v a r = 1 + apply SemidirectProduct.ext + · funext g + exact ha r hr g + · rw [labelLift_right] + exact hR hr + have hle : Subgroup.normalClosure R ≤ (labelLift v a).ker := + Subgroup.normalClosure_le_normal hrel + have he : labelLift v a w = 1 := hle (by rw [← hp]; exact hw) + change (labelLift v a w).left g = 1 + rw [he] + rfl + + def pathChain (v : S → Γ) (w : FreeGroup S) (g : Γ) : (Γ × S) →₀ ℤ := + (pathProduct v (fun p s => Multiplicative.ofAdd (Finsupp.single (p,s) 1)) w g).toAdd + +@[simp] theorem pathChain_one (v : S → Γ) (g : Γ) : pathChain v 1 g = 0 := by + simp [pathChain] +@[simp] theorem pathChain_of (v : S → Γ) (s : S) (g : Γ) : + pathChain v (FreeGroup.of s) g = Finsupp.single (g,s) 1 := by simp [pathChain] + theorem pathChain_mul (v : S → Γ) (w z : FreeGroup S) (g : Γ) : + pathChain v (w*z) g = pathChain v w g + pathChain v z (g * wordValue v w) := by + simp only [pathChain, pathProduct_mul, toAdd_mul] + theorem pathChain_inv (v : S → Γ) (w : FreeGroup S) (g : Γ) : + pathChain v w⁻¹ g = -pathChain v w (g * (wordValue v w)⁻¹) := by + simp only [pathChain, pathProduct_inv, toAdd_inv] + theorem pathChain_conjugate (v : S → Γ) (u r : FreeGroup S) + (hr : wordValue v r = 1) (g : Γ) : + pathChain v (u*r*u⁻¹) g = pathChain v r (g * wordValue v u) := by + simp only [pathChain, pathProduct_conjugate_loop v _ u r hr g, + toAdd_mul, toAdd_inv] + abel + +variable {R : Type*} +abbrev NormalFactor (S R : Type*) := FreeGroup S × R × Bool + + def normalFactorWord (r : R → FreeGroup S) (f : NormalFactor S R) : FreeGroup S := + f.1 * (if f.2.2 then r f.2.1 else (r f.2.1)⁻¹) * f.1⁻¹ + + def normalFactorCount (v : S → Γ) (f : NormalFactor S R) (g : Γ) : (Γ × R) →₀ ℤ := + Finsupp.single (g * wordValue v f.1, f.2.1) (if f.2.2 then 1 else -1) + + def relatorChainMap (v : S → Γ) (r : R → FreeGroup S) : + ((Γ × R) →₀ ℤ) →ₗ[ℤ] ((Γ × S) →₀ ℤ) := + Finsupp.linearCombination ℤ (fun i => pathChain v (r i.2) i.1) + + theorem normalFactor_value (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (f : NormalFactor S R) : + wordValue v (normalFactorWord r f) = 1 := by + dsimp only [normalFactorWord] + split_ifs <;> simp [hr] + + theorem pathChain_normalFactor (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (f : NormalFactor S R) (g : Γ) : + pathChain v (normalFactorWord r f) g = relatorChainMap v r (normalFactorCount v f g) := by + simp only [normalFactorWord, normalFactorCount, relatorChainMap, Finsupp.linearCombination_single] + split_ifs with h + · rw [pathChain_conjugate v _ _ (hr _)]; simp only [one_smul] + · rw [pathChain_conjugate v _ _ (by simp [hr]), pathChain_inv, hr] + simp only [inv_one, mul_one, neg_one_smul] + + theorem pathChain_normalProduct (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (l : List (NormalFactor S R)) (g : Γ) : + pathChain v (l.map (normalFactorWord r)).prod g = + relatorChainMap v r (l.map (fun f => normalFactorCount v f g)).sum := by + induction l with + | nil => simp + | cons f l ih => + simp only [List.map_cons, List.prod_cons, List.sum_cons, map_add, pathChain_mul, + normalFactor_value v r hr f, mul_one, pathChain_normalFactor v r hr f g, ih] + +/-- The coefficient identity is an equality in the full free abelian group of +translated indexed relators. Injectivity is sufficient; no finiteness of the +relator or generator types is assumed. -/ + theorem exact_translated_relator_counts (v : S → Γ) (r : R → FreeGroup S) + (hr : ∀ i, wordValue v (r i) = 1) (hinj : Function.Injective (relatorChainMap v r)) + (z : FreeGroup S) (ρ : R) (hchain : pathChain v z 1 = pathChain v (r ρ) 1) + (l : List (NormalFactor S R)) (he : z = (l.map (normalFactorWord r)).prod) : + (l.map (fun f => normalFactorCount v f 1)).sum = Finsupp.single (1,ρ) 1 := by + apply hinj + rw [← pathChain_normalProduct v r hr, ← he, hchain] + simp [relatorChainMap] + +end EilenbergGanea + +namespace EilenbergGanea +variable {Γ S H : Type*} [Group Γ] [Group H] + + +section CompactLabeling +variable {T I : Type*} + + def mergeLabels (a : Γ → S → H) (b : Γ → T → H) : Γ → S ⊕ T → H := + fun g => Sum.elim (a g) (b g) + + omit [Group Γ] [Group H] in + theorem mergeLabels_continuous [TopologicalSpace H] (a : Γ → S → H) : + Continuous (fun b : Γ → T → H => mergeLabels a b) := by + apply continuous_pi + intro g + apply continuous_pi + intro s + cases s with + | inl s => exact continuous_const + | inr t => exact continuous_apply_apply g t + +/-- Copy arbitrary prescribed labels to a finite quotient solely on the finite +set of vertices currently being tested. This does not assert that the original +labeling is periodic or descends to a single quotient. -/ + theorem copy_labels_on_finite_set {D : Type*} [Group D] (q : Γ →* D) + (P : Finset Γ) (hq : Set.InjOn q (P : Set Γ)) (a : Γ → S → H) + (Allowed : H → Prop) (h1 : Allowed 1) (ha : ∀ g s, Allowed (a g s)) : + ∃ aF : D → S → H, (∀ d s, Allowed (aF d s)) ∧ ∀ p ∈ P, ∀ s, aF (q p) s = a p s := by + classical + let aF : D → S → H := fun d s => if hd : ∃ p ∈ P, q p = d then a hd.choose s else 1 + refine ⟨aF, ?_, ?_⟩ + · intro d s + dsimp [aF] + split_ifs + · exact ha _ _ + · exact h1 + · intro p hp s + have he : ∃ p' ∈ P, q p' = q p := ⟨p, hp, rfl⟩ + simp only [aF, dite_eq_left he] + have heq : he.choose = p := hq he.choose_spec.1 hp he.choose_spec.2 + rw [heq] + +/-- Tychonoff compactness for all extra generators, with the original labels +fixed. The finite-quotient premise is exactly the separate finite solvability +obligation, not a periodicity assumption on the prescribed assignment. -/ + theorem compact_labeling_from_finite_quotients [Group.ResiduallyFinite Γ] + [TopologicalSpace H] [IsTopologicalGroup H] [CompactSpace H] + (v : S ⊕ T → Γ) (a : Γ → S → H) (w : I → FreeGroup (S ⊕ T)) (g : I → Γ) + (K : I → Set H) (hK : ∀ i, IsClosed (K i)) + (Allowed : H → Prop) (h1 : Allowed 1) (ha : ∀ g s, Allowed (a g s)) + (hsolve : ∀ (N : FiniteIndexNormalSubgroup Γ) (J : Finset I) + (aF : (Γ ⧸ N.toSubgroup) → S → H), (∀ d s, Allowed (aF d s)) → + ∃ bF : (Γ ⧸ N.toSubgroup) → T → H, ∀ i ∈ J, ∀ d, + pathProduct (fun s => QuotientGroup.mk' N.toSubgroup (v s)) + (mergeLabels aF bF) (w i) d ∈ K i) : + ∃ b : Γ → T → H, ∀ i, pathProduct v (mergeLabels a b) (w i) (g i) ∈ K i := by + classical + let C : I → Set (Γ → T → H) := fun i => + {b | pathProduct v (mergeLabels a b) (w i) (g i) ∈ K i} + have hc : ∀ i, IsClosed (C i) := fun i => + (hK i).preimage ((pathProduct_continuous v (w i) (g i)).comp (mergeLabels_continuous a)) + have hf : ∀ J : Finset I, (⋂ i ∈ J, C i).Nonempty := by + intro J + choose P hP using (fun i : I => pathProduct_finite_locations (H := H) v (w i) (g i)) + let V := J.biUnion P + obtain ⟨N, hN⟩ := finite_set_quotient_injective V + let q := QuotientGroup.mk' N.toSubgroup + obtain ⟨aF, haF, heF⟩ := copy_labels_on_finite_set q V hN a Allowed h1 ha + obtain ⟨bF, hbF⟩ := hsolve N J aF haF + refine ⟨fun p t => bF (q p) t, ?_⟩ + simp only [Set.mem_iInter] + intro i hi + change pathProduct v (mergeLabels a (fun p t => bF (q p) t)) (w i) (g i) ∈ K i + have he : pathProduct v (mergeLabels a (fun p t => bF (q p) t)) (w i) (g i) = + pathProduct v (fun p s => mergeLabels aF bF (q p) s) (w i) (g i) := by + apply hP i + intro p hp s + cases s with + | inl s => exact (heF p (Finset.mem_biUnion.mpr ⟨i, hi, hp⟩) s).symm + | inr t => rfl + rw [he, pathProduct_pullback] + exact hbF i hi (q (g i)) + obtain ⟨b, hb⟩ := CompactSpace.iInter_nonempty hc hf + exact ⟨b, fun i => Set.mem_iInter.mp hb i⟩ +end CompactLabeling +end EilenbergGanea + +open scoped Quaternion +namespace EilenbergGanea + +theorem su2_norm (a : SU2) : ‖(a : ℍ)‖ = 1 := by + have h : star (a : ℍ) * (a : ℍ) = 1 := a.property.1 + have hn := congrArg norm h + simp only [norm_mul, norm_star, norm_one] at hn + nlinarith [norm_nonneg (a : ℍ)] + +/-- The two elementary estimates needed for the presentation argument, with +constants independent of the Cayley graph or any finite quotient. -/ +theorem unit_product_linearization (l : List ℍ) (h : ℝ) (hh : 0 ≤ h) + (hu : ∀ a ∈ l, ‖a‖ = 1) (hb : ∀ a ∈ l, ‖a - 1‖ ≤ h) : + ‖l.prod - 1‖ ≤ l.length * h ∧ + ‖l.prod - 1 - (l.map (fun a => a - 1)).sum‖ ≤ (l.length : ℝ)^2 * h^2 := by + induction l with + | nil => simp + | cons a l ih => + obtain ⟨hp, he⟩ := ih (fun b hm => hu b (by simp [hm])) (fun b hm => hb b (by simp [hm])) + have hna := hu a (by simp) + have hba := hb a (by simp) + have hid : a * l.prod - 1 = a * (l.prod - 1) + (a - 1) := by noncomm_ring + have hie : a * l.prod - 1 - ((a - 1) + (l.map (fun b => b - 1)).sum) = + (a - 1) * (l.prod - 1) + (l.prod - 1 - (l.map (fun b => b - 1)).sum) := by noncomm_ring + constructor + · simp only [List.prod_cons, List.length_cons, Nat.cast_add, Nat.cast_one] + rw [hid] + calc + _ ≤ ‖a * (l.prod - 1)‖ + ‖a - 1‖ := norm_add_le _ _ + _ = ‖l.prod - 1‖ + ‖a - 1‖ := by rw [norm_mul, hna, one_mul] + _ ≤ (l.length + 1) * h := by nlinarith + · simp only [List.prod_cons, List.map_cons, List.sum_cons, List.length_cons, Nat.cast_add, Nat.cast_one] + rw [hie] + have hn : 0 ≤ (l.length : ℝ) := Nat.cast_nonneg _ + calc + _ ≤ ‖(a - 1) * (l.prod - 1)‖ + ‖l.prod - 1 - (l.map (fun b => b - 1)).sum‖ := norm_add_le _ _ + _ = ‖a - 1‖ * ‖l.prod - 1‖ + ‖l.prod - 1 - (l.map (fun b => b - 1)).sum‖ := by rw [norm_mul] + _ ≤ h * (l.length * h) + (l.length : ℝ)^2 * h^2 := + add_le_add (mul_le_mul hba hp (norm_nonneg _) hh) he + _ ≤ (l.length + 1)^2 * h^2 := by nlinarith [sq_nonneg h] + + theorem quaternion_commutator_bound (a b : ℍ) : + ‖a * b - b * a‖ ≤ 2 * ‖a - 1‖ * ‖b - 1‖ := by + have he : a * b - b * a = (a - 1) * (b - 1) - (b - 1) * (a - 1) := by noncomm_ring + rw [he] + calc + _ ≤ ‖(a - 1) * (b - 1)‖ + ‖(b - 1) * (a - 1)‖ := norm_sub_le _ _ + _ = _ := by rw [norm_mul, norm_mul]; ring + + theorem su2_conjugation_error (a b : SU2) : + ‖((a * b * a⁻¹ : SU2) : ℍ) - (b : ℍ)‖ ≤ 2 * ‖(a : ℍ) - 1‖ * ‖(b : ℍ) - 1‖ := by + have he : ((a * b * a⁻¹ : SU2) : ℍ) - (b : ℍ) = + ((a : ℍ) * (b : ℍ) - (b : ℍ) * (a : ℍ)) * ((a⁻¹ : SU2) : ℍ) := by + change (a : ℍ) * (b : ℍ) * star (a : ℍ) - (b : ℍ) = _ + change _ = ((a : ℍ) * (b : ℍ) - (b : ℍ) * (a : ℍ)) * star (a : ℍ) + rw [sub_mul, mul_assoc (b : ℍ), a.property.2, mul_one] + rw [he, norm_mul, su2_norm, mul_one] + exact quaternion_commutator_bound _ _ + + theorem su2_inverse_distance (b : SU2) : ‖((b⁻¹ : SU2) : ℍ) - 1‖ = ‖(b : ℍ) - 1‖ := by + change ‖star (b : ℍ) - 1‖ = _ + calc + _ = ‖star ((b : ℍ) - 1)‖ := by rw [star_sub, star_one] + _ = _ := norm_star _ + + theorem su2_inverse_linearization (b : SU2) : + ‖((b⁻¹ : SU2) : ℍ) - 1 + ((b : ℍ) - 1)‖ ≤ ‖(b : ℍ) - 1‖^2 := by + have he : ((b⁻¹ : SU2) : ℍ) - 1 + ((b : ℍ) - 1) = + -((((b⁻¹ : SU2) : ℍ) - 1) * ((b : ℍ) - 1)) := by + have hb : ((b⁻¹ : SU2) : ℍ) * (b : ℍ) = 1 := b.property.1 + noncomm_ring [hb] + rw [he, norm_neg, norm_mul, su2_inverse_distance, pow_two] + +/-- Replacing each displacement by its linear model introduces only the sum +of the errors. Combined with exact signed counts, this avoids any choice of +an ordering of the relator indices (which can be uncountable). -/ +theorem unit_product_with_linear_models {I : Type*} (l : List I) + (f : I → SU2) (v : I → ℍ) (h D : ℝ) (hh : 0 ≤ h) + (hb : ∀ i ∈ l, ‖(f i : ℍ) - 1‖ ≤ h) + (he : ∀ i ∈ l, ‖(f i : ℍ) - 1 - v i‖ ≤ D) : + ‖((l.map (fun i => (f i : ℍ))).prod - 1) - (l.map v).sum‖ ≤ + (l.length : ℝ)^2 * h^2 + l.length * D := by + have hp := (unit_product_linearization (l.map (fun i => (f i : ℍ))) h hh + (by intro a ha; obtain ⟨i, _, rfl⟩ := List.mem_map.mp ha; exact su2_norm _) + (by intro a ha; obtain ⟨i, hi, rfl⟩ := List.mem_map.mp ha; exact hb i hi)).2 + simp only [List.length_map, List.map_map, Function.comp_def] at hp + have hs : ∀ l : List I, (∀ i ∈ l, ‖(f i : ℍ) - 1 - v i‖ ≤ D) → + ‖(l.map (fun i => (f i : ℍ) - 1)).sum - (l.map v).sum‖ ≤ l.length * D := by + intro l he + induction l with + | nil => simp + | cons i l ih => + have hi := he i (by simp) + have hrest := ih (fun j hj => he j (by simp [hj])) + simp only [List.map_cons, List.sum_cons, List.length_cons, Nat.cast_add, Nat.cast_one] + have heq : (f i : ℍ) - 1 + (l.map (fun j => (f j : ℍ) - 1)).sum - + (v i + (l.map v).sum) = ((f i : ℍ) - 1 - v i) + + ((l.map (fun j => (f j : ℍ) - 1)).sum - (l.map v).sum) := by abel + rw [heq] + exact (norm_add_le _ _).trans (by linarith) + + calc + _ ≤ ‖((l.map (fun i => (f i : ℍ))).prod - 1) - (l.map (fun i => (f i : ℍ) - 1)).sum‖ + + ‖(l.map (fun i => (f i : ℍ) - 1)).sum - (l.map v).sum‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ _ := add_le_add hp (hs l he) +end EilenbergGanea + +namespace EilenbergGanea +open scoped Quaternion + +theorem su2_conjugation_distance (a b : SU2) : + ‖((a * b * a⁻¹ : SU2) : ℍ) - 1‖ = ‖(b : ℍ) - 1‖ := by + have he : ((a * b * a⁻¹ : SU2) : ℍ) - 1 = + (a : ℍ) * ((b : ℍ) - 1) * star (a : ℍ) := by + change (a : ℍ) * (b : ℍ) * star (a : ℍ) - 1 = _ + rw [mul_sub, sub_mul, mul_one, a.property.2] + rw [he, norm_mul, norm_mul, norm_star, su2_norm, one_mul, mul_one] + +def signedUnit (b : SU2) (ε : Bool) : SU2 := if ε then b else b⁻¹ +def signedDisplacement (b : SU2) (ε : Bool) : ℍ := if ε then (b : ℍ) - 1 else -((b : ℍ) - 1) + + theorem signedUnit_distance (b : SU2) (ε : Bool) : + ‖(signedUnit b ε : ℍ) - 1‖ = ‖(b : ℍ) - 1‖ := by + cases ε <;> simp [signedUnit, su2_inverse_distance] + + theorem signedUnit_error (b : SU2) (ε : Bool) : + ‖(signedUnit b ε : ℍ) - 1 - signedDisplacement b ε‖ ≤ ‖(b : ℍ) - 1‖^2 := by + cases ε with + | false => + change ‖((b⁻¹ : SU2) : ℍ) - 1 - (-((b : ℍ) - 1))‖ ≤ _ + simpa only [sub_neg_eq_add] using su2_inverse_linearization b + | true => simp [signedUnit, signedDisplacement] + + theorem conjugated_signedUnit_error (a b : SU2) (ε : Bool) (A h : ℝ) + (hA : 0 ≤ A) (hh : 0 ≤ h) (ha : ‖(a : ℍ) - 1‖ ≤ A) (hb : ‖(b : ℍ) - 1‖ ≤ h) : + ‖((a * signedUnit b ε * a⁻¹ : SU2) : ℍ) - 1 - signedDisplacement b ε‖ ≤ + 2 * A * h + h^2 := by + have he : ((a * signedUnit b ε * a⁻¹ : SU2) : ℍ) - 1 - signedDisplacement b ε = + (((a * signedUnit b ε * a⁻¹ : SU2) : ℍ) - (signedUnit b ε : ℍ)) + + ((signedUnit b ε : ℍ) - 1 - signedDisplacement b ε) := by abel + rw [he] + have hsq : ‖(b : ℍ) - 1‖^2 ≤ h^2 := by nlinarith [norm_nonneg ((b : ℍ) - 1)] + calc + _ ≤ ‖((a * signedUnit b ε * a⁻¹ : SU2) : ℍ) - (signedUnit b ε : ℍ)‖ + + ‖(signedUnit b ε : ℍ) - 1 - signedDisplacement b ε‖ := norm_add_le _ _ + _ ≤ 2 * ‖(a : ℍ) - 1‖ * ‖(b : ℍ) - 1‖ + ‖(b : ℍ) - 1‖^2 := by + simpa only [signedUnit_distance] using add_le_add (su2_conjugation_error a (signedUnit b ε)) (signedUnit_error b ε) + _ ≤ _ := add_le_add (mul_le_mul (mul_le_mul_of_nonneg_left ha (by positivity)) hb + (norm_nonneg _) (mul_nonneg (by positivity) hA)) hsq + +abbrev RelatorFactor (I : Type*) := SU2 × I × Bool + +def relatorFactorValue {I : Type*} (x : I → SU2) (r : RelatorFactor I) : SU2 := + r.1 * signedUnit (x r.2.1) r.2.2 * r.1⁻¹ + +def relatorSignedCounts {I : Type*} (l : List (RelatorFactor I)) : I →₀ ℤ := + (l.map (fun r => Finsupp.single r.2.1 (if r.2.2 then 1 else -1))).sum + + theorem relator_linear_models {I : Type*} (l : List (RelatorFactor I)) (x : I → SU2) : + (l.map (fun r => signedDisplacement (x r.2.1) r.2.2)).sum = + Finsupp.linearCombination ℤ (fun i => (x i : ℍ) - 1) (relatorSignedCounts l) := by + induction l with + | nil => simp [relatorSignedCounts] + | cons r l ih => + simp only [List.map_cons, List.sum_cons, relatorSignedCounts, map_add, Finsupp.linearCombination_single] + rw [← show Finsupp.linearCombination ℤ (fun i => (x i : ℍ) - 1) + ((l.map (fun r => Finsupp.single r.2.1 (if r.2.2 then 1 else -1))).sum) = + (l.map (fun r => signedDisplacement (x r.2.1) r.2.2)).sum from ih.symm] + congr 2 + cases r.2.2 <;> simp [signedDisplacement] + +/-- Exact translated counts cancel the full linear term; the remaining bound +is quadratic. The index set is arbitrary, not necessarily countable. -/ +theorem relator_product_quadratic {I : Type*} (l : List (RelatorFactor I)) (x : I → SU2) + (i₀ : I) (hc : relatorSignedCounts l = Finsupp.single i₀ 1) + (h ε K : ℝ) (hh : 0 ≤ h) (hε : 0 ≤ ε) (hK : 0 ≤ K) + (hb : ∀ r ∈ l, ‖(x r.2.1 : ℍ) - 1‖ ≤ h) + (ha : ∀ r ∈ l, ‖(r.1 : ℍ) - 1‖ ≤ K * (ε + h)) : + ‖(l.map (fun r => (relatorFactorValue x r : ℍ))).prod - (x i₀ : ℍ)‖ ≤ + ((l.length : ℝ)^2 + l.length + 2 * l.length * K) * (ε + h) * h := by + have hp := unit_product_with_linear_models l (relatorFactorValue x) + (fun r => signedDisplacement (x r.2.1) r.2.2) h + (2 * (K * (ε + h)) * h + h^2) hh + (fun r hr => by rw [relatorFactorValue, su2_conjugation_distance, signedUnit_distance]; exact hb r hr) + (fun r hr => conjugated_signedUnit_error r.1 (x r.2.1) r.2.2 _ h + (mul_nonneg hK (add_nonneg hε hh)) hh (ha r hr) (hb r hr)) + rw [relator_linear_models, hc, Finsupp.linearCombination_single, one_smul] at hp + have he : (l.map (fun r => (relatorFactorValue x r : ℍ))).prod - 1 - ((x i₀ : ℍ) - 1) = + (l.map (fun r => (relatorFactorValue x r : ℍ))).prod - (x i₀ : ℍ) := by abel + rw [he] at hp + apply hp.trans + have hlen : 0 ≤ (l.length : ℝ) := Nat.cast_nonneg _ + have hnh : 0 ≤ ((l.length : ℝ)^2 + l.length) * ε * h := + mul_nonneg (mul_nonneg (add_nonneg (sq_nonneg _) hlen) hε) hh + nlinarith +end EilenbergGanea + +namespace EilenbergGanea + +/-- A uniform size for an arbitrary family, normalized to zero for an empty +index set. This is a real supremum, not an attained maximum. -/ +def familySize {I : Type*} (f : I → ℝ) : ℝ := sSup (Set.range f ∪ {0}) + + theorem familySize_nonneg {I : Type*} (f : I → ℝ) (hf : BddAbove (Set.range f)) : + 0 ≤ familySize f := by + apply le_csSup (hf.union bddAbove_singleton) + exact Or.inr (Set.mem_singleton _) + + theorem le_familySize {I : Type*} (f : I → ℝ) (hf : BddAbove (Set.range f)) (i : I) : + f i ≤ familySize f := le_csSup (hf.union bddAbove_singleton) (Or.inl (Set.mem_range_self i)) + + theorem familySize_le {I : Type*} (f : I → ℝ) {c : ℝ} (hc : 0 ≤ c) (hf : ∀ i, f i ≤ c) : + familySize f ≤ c := by + apply csSup_le (Set.union_nonempty.mpr (Or.inr (Set.singleton_nonempty 0))) + rintro x (⟨i, rfl⟩ | rfl) + · exact hf i + · exact hc + +/-- The source no-threshold-crossing argument does not assume attainment of +its supremum. -/ + theorem familySize_ne_threshold {I : Type*} (f : I → ℝ) + (hf : BddAbove (Set.range f)) (C δ η ε : ℝ) + (hδ : 0 < δ) (hC : 0 ≤ C) (_hη : 0 ≤ η) (hε : 0 ≤ ε) (hεη : ε ≤ η) + (hc₁ : C * (δ + η) < 1/2) (hc₂ : C * η < δ/2) + (hbound : ∀ i, f i ≤ C * ε + C * (familySize f + ε) * familySize f) : + familySize f ≠ δ := by + intro he + have hs : familySize f ≤ C * ε + C * (familySize f + ε) * familySize f := + familySize_le f (by positivity [familySize_nonneg f hf]) hbound + rw [he] at hs + have hce : C * ε ≤ C * η := mul_le_mul_of_nonneg_left hεη hC + have hfactor : C * (δ + ε) ≤ C * (δ + η) := mul_le_mul_of_nonneg_left (by linarith) hC + nlinarith [mul_lt_mul_of_pos_right hc₁ hδ, mul_le_mul_of_nonneg_right hfactor hδ.le] + +/-- Uniform contraction of all residual errors. This handles even an +uncountable family and does not replace the supremum by a maximum. -/ + theorem familySize_contraction {I : Type*} (f : I → ℝ) + (hf : ∀ i, 0 ≤ f i) (δ C η : ℝ) (hδ : 0 ≤ δ) (hC : 0 ≤ C) (hη : 0 ≤ η) + (hb : ∀ i, f i ≤ δ) (hc : C * (δ + η) < 1) + (he : ∀ i, f i ≤ C * (familySize f + η) * familySize f) : ∀ i, f i = 0 := by + have hbounded : BddAbove (Set.range f) := ⟨δ, by rintro _ ⟨i, rfl⟩; exact hb i⟩ + have h0 := familySize_nonneg f hbounded + have hmax := familySize_le f hδ hb + have hs := familySize_le f (c := C * (familySize f + η) * familySize f) (by positivity) he + have hmul : C * (familySize f + η) ≤ C * (δ + η) := + mul_le_mul_of_nonneg_left (by linarith) hC + have heq : familySize f = 0 := by + by_contra hn + have hp : 0 < familySize f := lt_of_le_of_ne h0 (Ne.symm hn) + have ht := mul_lt_mul_of_pos_right (lt_of_le_of_lt hmul hc) hp + nlinarith + intro i + exact le_antisymm (by simpa only [heq] using le_familySize f hbounded i) (hf i) + + theorem small_thresholds_exist (C : ℝ) (hC : 1 ≤ C) : + ∃ δ η : ℝ, 0 < δ ∧ δ < 1 ∧ 0 < η ∧ η < 1 ∧ + C * (δ + η) < 1/2 ∧ C * η < δ/2 := by + have hc : 0 < C := by linarith + let δ := 1 / (8*C) + let η := δ / (8*C) + have hd : 0 < δ := by dsimp [δ]; positivity + have hd1 : δ < 1 := by dsimp [δ]; apply (div_lt_iff₀ (by positivity)).mpr; linarith + have he : 0 < η := by dsimp [η]; positivity + have heδ : η < δ := by dsimp [η]; apply (div_lt_iff₀ (by positivity)).mpr; nlinarith + have hcd : C * δ = 1/8 := by dsimp [δ]; field_simp + have hce : C * η = δ/8 := by dsimp [η]; field_simp + refine ⟨δ, η, hd, hd1, he, heδ.trans hd1, ?_, ?_⟩ + · rw [mul_add, hcd, hce]; linarith + · rw [hce]; linarith +end EilenbergGanea + + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/UnitaryWords.lean b/lean/OAI/Topology/EilenbergGanea/UnitaryWords.lean index 7e8a3f310b9e1b7d6b49618c1b724ee95b0de63e..87c8c228fd49d847416f4019d85d79d29ab92e2c 100644 --- a/lean/OAI/Topology/EilenbergGanea/UnitaryWords.lean +++ b/lean/OAI/Topology/EilenbergGanea/UnitaryWords.lean @@ -1,890 +1,890 @@ -import OAI.Topology.EilenbergGanea.Regularization -import Mathlib.Analysis.Quaternion -import Mathlib.Analysis.Complex.Circle -import Mathlib.Analysis.Complex.Polynomial.Basic -import Mathlib.Analysis.Calculus.Deriv.ZPow -import Mathlib.GroupTheory.FreeGroup.Basic -import Mathlib.Analysis.SpecialFunctions.SmoothTransition - -namespace OAI - -noncomputable section - -open Set Filter Topology -open scoped Quaternion ContDiff - -open scoped Quaternion -namespace EilenbergGanea -abbrev SU2 := unitary ℍ - -theorem quaternion_mem_unitary_iff (q : ℍ) : q ∈ unitary ℍ ↔ ‖q‖ = 1 := by - rw [Unitary.mem_iff, Quaternion.star_mul_self, Quaternion.self_mul_star, and_self] - constructor - · intro h - have he : Quaternion.normSq q = 1 := Quaternion.coe_inj.mp h - rw [Quaternion.normSq_eq_norm_mul_self] at he - nlinarith [norm_nonneg q] - · intro h - simp [Quaternion.normSq_eq_norm_mul_self, h] - -instance su2_compactSpace : CompactSpace SU2 := by - apply isCompact_iff_compactSpace.mp - have hs : (unitary ℍ : Set ℍ) = Metric.sphere 0 1 := by - ext q - simp [quaternion_mem_unitary_iff] - rw [hs] - exact isCompact_sphere 0 1 - -def circleQuaternion : Circle →* SU2 where - toFun z := ⟨Quaternion.ofComplex z, by - rw [Unitary.mem_iff, Quaternion.star_mul_self, Quaternion.self_mul_star, and_self] - have hz := Circle.normSq_coe z - have he : Quaternion.normSq (Quaternion.ofComplex z) = 1 := by - simpa [Quaternion.normSq_def', Complex.normSq_apply, sq] using hz - rw [he]; rfl⟩ - map_one' := Subtype.ext (map_one Quaternion.ofComplex) - map_mul' z w := Subtype.ext (map_mul Quaternion.ofComplex (z : ℂ) (w : ℂ)) - -@[simp] theorem circleQuaternion_coe (z : Circle) : - ((circleQuaternion z : SU2) : ℍ) = (z : ℂ) := rfl - -theorem circleQuaternion_injective : Function.Injective circleQuaternion := by - intro z w h - apply Subtype.ext - apply Complex.ext - · exact congrArg (fun q : ℍ => q.re) (congrArg Subtype.val h) - · exact congrArg (fun q : ℍ => q.imI) (congrArg Subtype.val h) - -theorem circleQuaternion_continuous : Continuous circleQuaternion := by - apply Continuous.subtype_mk - exact Quaternion.ofComplex.toLinearMap.continuous_of_finiteDimensional.comp continuous_subtype_val - -def wordMap {m : ℕ} (w : Fin m → FreeGroup (Fin m)) (x : Fin m → SU2) : Fin m → SU2 := - fun i => FreeGroup.lift x (w i) - -def exponentMatrix {m : ℕ} (w : Fin m → FreeGroup (Fin m)) : Matrix (Fin m) (Fin m) ℤ := - fun i j => Multiplicative.toAdd - (FreeGroup.lift (fun k => Multiplicative.ofAdd (if j = k then (1 : ℤ) else 0)) (w i)) - -open Set Filter Topology -open scoped ContDiff - -/-- Radial normalization is only used on nonzero quaternions. The harmless -value at zero makes it a total function without changing that domain. -/ -def normalizeQuaternion (q : ℍ) : SU2 := by - classical - exact if h : q = 0 then 1 else - ⟨‖q‖⁻¹ • q, (quaternion_mem_unitary_iff _).mpr (by - simp only [norm_smul, Real.norm_eq_abs, abs_inv, abs_norm] - exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr h))⟩ - -theorem normalizeQuaternion_coe_of_ne_zero {q : ℍ} (hq : q ≠ 0) : - (normalizeQuaternion q : ℍ) = ‖q‖⁻¹ • q := by simp [normalizeQuaternion, hq] - -theorem normalizeQuaternion_coe_contDiffAt {q : ℍ} (hq : q ≠ 0) : - ContDiffAt ℝ ∞ (fun z => (normalizeQuaternion z : ℍ)) q := by - have h : ContDiffAt ℝ ∞ (fun z : ℍ => ‖z‖⁻¹ • z) q := - ((contDiffAt_norm ℝ hq).inv (norm_ne_zero_iff.mpr hq)).smul contDiffAt_id - apply h.congr_of_eventuallyEq - filter_upwards [eventually_ne_nhds hq] with z hz - exact normalizeQuaternion_coe_of_ne_zero hz - -theorem normalizeQuaternion_continuousAt {q : ℍ} (hq : q ≠ 0) : - ContinuousAt normalizeQuaternion q := by - exact tendsto_subtype_rng.mpr (normalizeQuaternion_coe_contDiffAt hq).continuousAt - -@[simp] theorem normalizeQuaternion_unitary (q : SU2) : normalizeQuaternion (q : ℍ) = q := by - have hqnorm : ‖(q : ℍ)‖ = 1 := (quaternion_mem_unitary_iff _).mp q.property - have hq : (q : ℍ) ≠ 0 := by intro he; simp [he] at hqnorm - apply Subtype.ext - simp [normalizeQuaternion_coe_of_ne_zero hq, hqnorm] - -/-- Smoothness of coefficient-free word evaluation follows directly by -induction, using quaternion conjugation for unitary inverses. -/ -theorem freeGroup_lift_coe_contDiffAt {D ι : Type*} - [NormedAddCommGroup D] [NormedSpace ℝ D] (w : FreeGroup ι) - (a : D) (x : D → ι → SU2) - (hx : ∀ i, ContDiffAt ℝ ∞ (fun z => (x z i : ℍ)) a) : - ContDiffAt ℝ ∞ (fun z => ((FreeGroup.lift (x z) w : SU2) : ℍ)) a := by - induction w using FreeGroup.induction_on with - | one => simpa using (contDiffAt_const : ContDiffAt ℝ ∞ (fun _ : D => (1 : ℍ)) a) - | of i => simpa using hx i - | inv_of i hi => - simp only [map_inv] - change ContDiffAt ℝ ∞ (fun z => star ((FreeGroup.lift (x z) (FreeGroup.of i) : SU2) : ℍ)) a - let L : ℍ →ₗ[ℝ] ℍ := - { toFun := star - map_add' := star_add - map_smul' := Quaternion.star_smul } - exact L.toContinuousLinearMap.contDiff.contDiffAt.comp a hi - | mul v w hv hw => simpa only [map_mul, Submonoid.coe_mul] using hv.mul hw - -def radialWordMap {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℍ) : Fin m → ℍ := - fun i => ‖x i‖ • ((wordMap w (fun j => normalizeQuaternion (x j)) i : SU2) : ℍ) - -@[simp] theorem radialWordMap_norm {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℍ) (i : Fin m) : ‖radialWordMap w x i‖ = ‖x i‖ := by - have h : ‖((wordMap w (fun j => normalizeQuaternion (x j)) i : SU2) : ℍ)‖ = 1 := - (quaternion_mem_unitary_iff _).mp (wordMap w (fun j => normalizeQuaternion (x j)) i).property - simp [radialWordMap, norm_smul, h] - -theorem radialWordMap_contDiffAt {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℍ) (hx : ∀ i, x i ≠ 0) : ContDiffAt ℝ ∞ (radialWordMap w) x := by - apply contDiffAt_pi.mpr - intro i - exact ((contDiffAt_apply ℝ ℍ i x).norm ℝ (hx i)).smul - (freeGroup_lift_coe_contDiffAt (w i) x (fun z j => normalizeQuaternion (z j)) - (fun j => (normalizeQuaternion_coe_contDiffAt (hx j)).comp (f := fun z : Fin m → ℍ => z j) x (contDiffAt_apply ℝ ℍ j x))) - -theorem radialWordMap_eq_one_iff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℍ) : radialWordMap w x = 1 ↔ - (∀ i, ‖x i‖ = 1) ∧ wordMap w (fun j => normalizeQuaternion (x j)) = 1 := by - constructor - · intro h - have hn (i : Fin m) : ‖x i‖ = 1 := by - have he := congrArg (fun y : Fin m → ℍ => ‖y i‖) h - simpa only [radialWordMap_norm, Pi.one_apply, norm_one] using he - refine ⟨hn, ?_⟩ - funext i - apply Subtype.ext - have he := congrFun h i - simpa [radialWordMap, hn] using he - · rintro ⟨hn, hw⟩ - funext i - simp [radialWordMap, hn, hw] - - -/-- A conjugation-invariant smooth cutoff, zero near coordinate hyperplanes -and one near the unit quaternion locus. -/ -def radialCutoff {m : ℕ} (x : Fin m → ℍ) : ℝ := - ∏ i, Real.smoothTransition (4 * ‖x i‖ ^ 2 - 1) - -def smoothRadialWordMap {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℍ) : Fin m → ℍ := radialCutoff x • radialWordMap w x - -theorem radialCutoff_contDiff {m : ℕ} : ContDiff ℝ ∞ (@radialCutoff m) := by - apply contDiff_prod - intro i _ - have hn : ContDiff ℝ ∞ (fun x : Fin m → ℍ => ‖x i‖ ^ 2) := - (contDiff_apply ℝ ℍ i).norm_sq ℝ - exact Real.smoothTransition.contDiff.comp ((contDiff_const.mul hn).sub contDiff_const) - -theorem radialCutoff_nonneg {m : ℕ} (x : Fin m → ℍ) : 0 ≤ radialCutoff x := - Finset.prod_nonneg (fun _ _ => Real.smoothTransition.nonneg _) - -theorem radialCutoff_le_one {m : ℕ} (x : Fin m → ℍ) : radialCutoff x ≤ 1 := - Finset.prod_le_one₀ (fun _ _ => Real.smoothTransition.nonneg _) - (fun _ _ => Real.smoothTransition.le_one _) - -theorem radialCutoff_eq_one {m : ℕ} (x : Fin m → ℍ) (hx : ∀ i, 1 ≤ ‖x i‖) : - radialCutoff x = 1 := by - apply Finset.prod_eq_one - intro i _ - apply Real.smoothTransition.one_of_one_le - nlinarith [hx i] - -theorem radialCutoff_eventually_zero {m : ℕ} (x : Fin m → ℍ) (i : Fin m) - (hi : x i = 0) : radialCutoff =ᶠ[𝓝 x] (fun _ => 0) := by - have h : ∀ᶠ y in 𝓝 x, ‖y i‖ < (1 / 2 : ℝ) := - ((continuous_apply i).norm.continuousAt.eventually_lt_const (by simp [hi])) - filter_upwards [h] with y hy - apply Finset.prod_eq_zero (Finset.mem_univ i) - apply Real.smoothTransition.zero_of_nonpos - nlinarith [norm_nonneg (y i)] - -theorem radialCutoff_eventually_one {m : ℕ} (x : Fin m → ℍ) - (hx : ∀ i, ‖x i‖ = 1) : radialCutoff =ᶠ[𝓝 x] (fun _ => 1) := by - have h (i : Fin m) : ∀ᶠ y in 𝓝 x, (3 / 4 : ℝ) < ‖y i‖ := - ((continuous_apply i).norm.continuousAt.eventually_const_lt (by change (3 / 4 : ℝ) < ‖x i‖; rw [hx i]; norm_num)) - filter_upwards [Filter.eventually_all.mpr h] with y hy - apply Finset.prod_eq_one - intro i _ - apply Real.smoothTransition.one_of_one_le - nlinarith [hy i] - -theorem smoothRadialWordMap_contDiff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) : - ContDiff ℝ ∞ (smoothRadialWordMap w) := by - rw [contDiff_iff_contDiffAt] - intro x - by_cases hx : ∀ i, x i ≠ 0 - · exact radialCutoff_contDiff.contDiffAt.smul (radialWordMap_contDiffAt w x hx) - · push Not at hx - obtain ⟨i, hi⟩ := hx - apply (contDiffAt_const : ContDiffAt ℝ ∞ (fun _ : Fin m → ℍ => (0 : Fin m → ℍ)) x).congr_of_eventuallyEq - filter_upwards [radialCutoff_eventually_zero x i hi] with y hy - simp [smoothRadialWordMap, hy] - -theorem smoothRadialWordMap_eq_one_iff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℍ) : smoothRadialWordMap w x = 1 ↔ radialWordMap w x = 1 := by - constructor - · intro h - have hn (i : Fin m) : radialCutoff x * ‖x i‖ = 1 := by - have he := congrArg (fun y : Fin m → ℍ => ‖y i‖) h - simpa only [smoothRadialWordMap, Pi.smul_apply, norm_smul, Real.norm_eq_abs, - abs_of_nonneg (radialCutoff_nonneg x), radialWordMap_norm, Pi.one_apply, norm_one] using he - have hlarge (i : Fin m) : 1 ≤ ‖x i‖ := by - have hle := mul_le_mul_of_nonneg_right (radialCutoff_le_one x) (norm_nonneg (x i)) - rw [hn i, one_mul] at hle - exact hle - simpa only [smoothRadialWordMap, radialCutoff_eq_one x hlarge, one_smul] using h - · intro h - have hn := (radialWordMap_eq_one_iff w x).mp h - simp only [smoothRadialWordMap, radialCutoff_eq_one x (fun i => (hn.1 i).ge), one_smul, h] - -theorem smoothRadialWordMap_eventuallyEq {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℍ) (hx : ∀ i, ‖x i‖ = 1) : - smoothRadialWordMap w =ᶠ[𝓝 x] radialWordMap w := by - filter_upwards [radialCutoff_eventually_one x hx] with y hy - simp [smoothRadialWordMap, hy] - -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -variable {n : Type*} [Fintype n] [DecidableEq n] - -def splitComplex : (n → ℂ) ≃ₗ[ℝ] ((n → ℝ) × (n → ℝ)) where - toFun z := (fun i => (z i).re, fun i => (z i).im) - invFun p i := (p.1 i : ℂ) + (p.2 i : ℂ) * Complex.I - left_inv z := by funext i; exact Complex.re_add_im (z i) - right_inv p := by ext i <;> simp - map_add' a b := by ext i <;> simp - map_smul' a b := by ext i <;> simp - -def radialAngularLinear (B : Matrix n n ℝ) : (n → ℂ) →L[ℝ] (n → ℂ) := - ((splitComplex (n := n)).symm.toLinearMap.comp - (((LinearMap.id : (n → ℝ) →ₗ[ℝ] (n → ℝ)).prodMap B.toLin').comp - (splitComplex (n := n)).toLinearMap)).toContinuousLinearMap - -@[simp] theorem radialAngularLinear_apply (B : Matrix n n ℝ) (z : n → ℂ) (i : n) : - radialAngularLinear B z i = ((z i).re : ℂ) + (∑ j, B i j * (z j).im : ℝ) * Complex.I := rfl - -theorem radialAngularLinear_det (B : Matrix n n ℝ) : - (radialAngularLinear B).toLinearMap.det = B.det := by - change LinearMap.det ((splitComplex (n := n)).symm.toLinearMap ∘ₗ - ((LinearMap.id : (n → ℝ) →ₗ[ℝ] (n → ℝ)).prodMap B.toLin') ∘ₗ - (splitComplex (n := n)).toLinearMap) = _ - have he := LinearMap.det_conj - ((LinearMap.id : (n → ℝ) →ₗ[ℝ] (n → ℝ)).prodMap B.toLin') - (splitComplex (n := n)).symm - rw [LinearEquiv.symm_symm] at he - rw [he, LinearMap.det_prodMap, LinearMap.det_id, one_mul, LinearMap.det_toLin'] - -def complexPolarChart (x z : n → ℂ) : n → ℂ := fun i => x i * Complex.exp (z i) - -def complexRadialTorus (B : Matrix n n ℤ) (z : n → ℂ) : n → ℂ := - fun i => ‖z i‖ • ∏ j, (‖z j‖⁻¹ • z j) ^ B i j - -theorem normalize_complex_mul_exp (x z : ℂ) (hx : ‖x‖ = 1) : - ‖x * Complex.exp z‖⁻¹ • (x * Complex.exp z) = - x * Complex.exp ((z.im : ℂ) * Complex.I) := by - rw [norm_mul, hx, one_mul, Complex.norm_exp, Complex.real_smul, Complex.ofReal_inv] - have he : Complex.exp z = (Real.exp z.re : ℂ) * - Complex.exp ((z.im : ℂ) * Complex.I) := by - rw [Complex.ofReal_exp, ← Complex.exp_add, Complex.re_add_im] - rw [he] - have hn : (Real.exp z.re : ℂ) ≠ 0 := by exact_mod_cast Real.exp_ne_zero z.re - field_simp - - theorem complexRadialTorus_chart (B : Matrix n n ℤ) (x : n → ℂ) - (hx : ∀ i, ‖x i‖ = 1) (hroot : ∀ i, ∏ j, x j ^ B i j = 1) : - complexRadialTorus B ∘ complexPolarChart x = - fun z => fun i => Complex.exp (radialAngularLinear (B.map (Int.castRingHom ℝ)) z i) := by - funext z i - have hn (j : n) := normalize_complex_mul_exp (x j) (z j) (hx j) - simp only [Function.comp_apply, complexRadialTorus, complexPolarChart] - simp only [hn] - simp only [mul_zpow, Finset.prod_mul_distrib, - hroot, one_mul, norm_mul, hx, one_mul, Complex.norm_exp, radialAngularLinear_apply, - ← Complex.exp_int_mul] - rw [Complex.real_smul, Complex.ofReal_exp, ← Complex.exp_sum, ← Complex.exp_add] - congr 1 - simp only [Matrix.map_apply, Int.coe_castRingHom, Complex.ofReal_sum, - Complex.ofReal_mul, Complex.ofReal_intCast] - rw [Finset.sum_mul] - congr 1 - apply Finset.sum_congr rfl - intro j _ - ring - - -/-- The real derivative of multiplication by a unit complex tuple has determinant one. -/ -def complexDiagonal (x : n → ℂ) : (n → ℂ) →L[ℝ] (n → ℂ) := - ((Matrix.diagonal x).toLin').toContinuousLinearMap.restrictScalars ℝ - -@[simp] theorem complexDiagonal_apply (x z : n → ℂ) (i : n) : - complexDiagonal x z i = x i * z i := by simp [complexDiagonal, Matrix.toLin'_apply, Matrix.mulVec, Matrix.diagonal_apply, dotProduct] - -theorem complexDiagonal_det (x : n → ℂ) (hx : ∀ i, ‖x i‖ = 1) : - (complexDiagonal x).toLinearMap.det = 1 := by - change (((Matrix.diagonal x).toLin').restrictScalars ℝ).det = _ - rw [LinearMap.det_restrictScalars, Algebra.norm_complex_apply, LinearMap.det_toLin', - Matrix.det_diagonal] - rw [Complex.normSq_eq_norm_sq, norm_prod] - simp [hx] - -theorem complexPolarChart_hasFDerivAt (x : n → ℂ) : - HasFDerivAt (complexPolarChart x) (complexDiagonal x) 0 := by - apply hasFDerivAt_pi'.mpr - intro i - have h := ((ContinuousLinearMap.proj i : (n → ℂ) →L[ℝ] ℂ).hasFDerivAt - (x := 0)).cexp.const_mul (x i) - change HasFDerivAt (fun z : n → ℂ => x i * Complex.exp (z i)) _ (0 : n → ℂ) - have he : (ContinuousLinearMap.proj i : (n → ℂ) →L[ℝ] ℂ).comp (complexDiagonal x) = - x i • (ContinuousLinearMap.proj i : (n → ℂ) →L[ℝ] ℂ) := by - ext z - simp - rw [he] - simpa using h - -theorem exp_radialAngularLinear_hasFDerivAt (B : Matrix n n ℝ) : - HasFDerivAt (fun z i => Complex.exp (radialAngularLinear B z i)) - (radialAngularLinear B) 0 := by - apply hasFDerivAt_pi'.mpr - intro i - simpa using (((ContinuousLinearMap.proj i : (n → ℂ) →L[ℝ] ℂ).comp - (radialAngularLinear B)).hasFDerivAt (x := 0)).cexp - -theorem complexRadialTorus_differentiableAt (B : Matrix n n ℤ) (x : n → ℂ) - (hx : ∀ i, x i ≠ 0) : DifferentiableAt ℝ (complexRadialTorus B) x := by - apply differentiableAt_pi.mpr - intro i - have hn (j : n) : DifferentiableAt ℝ (fun z : n → ℂ => ‖z j‖) x := - (differentiableAt_apply j x).norm ℝ (hx j) - apply (hn i).smul - have hp (j : n) : DifferentiableAt ℝ (fun z : n → ℂ => (‖z j‖⁻¹ • z j) ^ B i j) x := by - have hne : ‖x j‖⁻¹ • x j ≠ 0 := - smul_ne_zero (inv_ne_zero (norm_ne_zero_iff.mpr (hx j))) (hx j) - have hz : DifferentiableAt ℝ (fun z : ℂ => z ^ B i j) (‖x j‖⁻¹ • x j) := - ((differentiableAt_zpow (𝕜 := ℂ) (m := B i j)).mpr (Or.inl hne)).restrictScalars ℝ - exact hz.comp x (((hn j).inv (norm_ne_zero_iff.mpr (hx j))).smul - (differentiableAt_apply j x)) - exact (HasFDerivAt.finsetProd (fun j _ => (hp j).hasFDerivAt)).differentiableAt - -/-- At every torus root, the radial extension has exactly determinant det B. -The extra radial coordinates contribute the identity, not an additional sign. -/ -theorem complexRadialTorus_det (B : Matrix n n ℤ) (x : n → ℂ) - (hx : ∀ i, ‖x i‖ = 1) (hroot : ∀ i, ∏ j, x j ^ B i j = 1) : - (fderiv ℝ (complexRadialTorus B) x).det = (B.det : ℝ) := by - have hne (i : n) : x i ≠ 0 := by intro h; simpa [h] using hx i - have hd := (complexRadialTorus_differentiableAt B x hne).hasFDerivAt - have hchart : complexPolarChart x 0 = x := by ext i; simp [complexPolarChart] - have hc := (show HasFDerivAt (complexRadialTorus B) (fderiv ℝ (complexRadialTorus B) x) - (complexPolarChart x 0) by rw [hchart]; exact hd).comp 0 (complexPolarChart_hasFDerivAt x) - have he : (fderiv ℝ (complexRadialTorus B) x).comp (complexDiagonal x) = - radialAngularLinear (B.map (Int.castRingHom ℝ)) := by - apply hc.unique - rw [complexRadialTorus_chart B x hx hroot] - exact exp_radialAngularLinear_hasFDerivAt _ - have hdet := congrArg (fun L : (n → ℂ) →L[ℝ] (n → ℂ) => L.det) he - change ((fderiv ℝ (complexRadialTorus B) x).toLinearMap.comp - (complexDiagonal x).toLinearMap).det = (radialAngularLinear (B.map (Int.castRingHom ℝ))).toLinearMap.det at hdet - rw [LinearMap.det_comp, complexDiagonal_det x hx, - mul_one, radialAngularLinear_det] at hdet - exact hdet.trans ((Int.castRingHom ℝ).map_det B).symm - -end EilenbergGanea -namespace EilenbergGanea -section CommutativeWords -variable {n A : Type*} [Fintype n] [DecidableEq n] [CommGroup A] -def wordExponents {ι : Type*} [DecidableEq ι] (w : FreeGroup ι) (j : ι) : ℤ := - Multiplicative.toAdd - (FreeGroup.lift (fun k => Multiplicative.ofAdd (if j = k then (1 : ℤ) else 0)) w) - -@[simp] theorem wordExponents_one {ι : Type*} [DecidableEq ι] (j : ι) : wordExponents (1 : FreeGroup ι) j = 0 := by - simp [wordExponents] - -@[simp] theorem wordExponents_of {ι : Type*} [DecidableEq ι] (j k : ι) : - wordExponents (FreeGroup.of k) j = if j = k then 1 else 0 := by - simp [wordExponents] - -@[simp] theorem wordExponents_inv {ι : Type*} [DecidableEq ι] (w : FreeGroup ι) (j : ι) : - wordExponents w⁻¹ j = -wordExponents w j := by - simp [wordExponents] - -@[simp] theorem wordExponents_mul {ι : Type*} [DecidableEq ι] (w v : FreeGroup ι) (j : ι) : - wordExponents (w * v) j = wordExponents w j + wordExponents v j := by - simp [wordExponents] - -theorem freeGroup_lift_commutative (x : n → A) (w : FreeGroup n) : - FreeGroup.lift x w = ∏ j, x j ^ wordExponents w j := by - induction w using FreeGroup.induction_on with - | one => simp - | of i => simp - | inv_of i hi => simp [hi, Finset.prod_inv_distrib] - | mul a b ha hb => simp [ha, hb, zpow_add, Finset.prod_mul_distrib] - -end CommutativeWords -end EilenbergGanea -namespace EilenbergGanea -open Set Filter Topology -open scoped Quaternion ContDiff - -def quaternionCoordinates : ℍ ≃ₗ[ℝ] ℂ × ℂ where - toFun q := (⟨q.re, q.imI⟩, ⟨q.imJ, q.imK⟩) - invFun z := ⟨z.1.re, z.1.im, z.2.re, z.2.im⟩ - left_inv q := by cases q; rfl - right_inv z := by rcases z with ⟨⟨a,b⟩,⟨c,d⟩⟩; rfl - map_add' q r := by ext <;> rfl - map_smul' r q := by apply Prod.ext <;> apply Complex.ext <;> simp - -@[simp] theorem quaternionCoordinates_apply (q : ℍ) : - quaternionCoordinates q = (⟨q.re, q.imI⟩, ⟨q.imJ, q.imK⟩) := rfl - -@[simp] theorem quaternionCoordinates_ofComplex (z : ℂ) : - quaternionCoordinates (Quaternion.ofComplex z) = (z, 0) := by - ext <;> rfl - -@[simp] theorem norm_quaternion_ofComplex (z : ℂ) : ‖Quaternion.ofComplex z‖ = ‖z‖ := by - have h : ‖Quaternion.ofComplex z‖ ^ 2 = ‖z‖ ^ 2 := by - rw [sq, ← Quaternion.normSq_eq_norm_mul_self, ← Complex.normSq_eq_norm_sq] - simp [Quaternion.normSq_def', Complex.normSq_apply, sq] - nlinarith [norm_nonneg (Quaternion.ofComplex z), norm_nonneg z] - -def quaternionTupleCoordinates {m : ℕ} : - (Fin m → ℍ) ≃L[ℝ] ((Fin m → ℂ) × (Fin m → ℂ)) := - (show (Fin m → ℍ) ≃ₗ[ℝ] ((Fin m → ℂ) × (Fin m → ℂ)) from - { toFun := fun q => (fun i => (quaternionCoordinates (q i)).1, - fun i => (quaternionCoordinates (q i)).2) - invFun := fun z i => quaternionCoordinates.symm (z.1 i, z.2 i) - left_inv := by intro q; funext i; exact quaternionCoordinates.symm_apply_apply _ - right_inv := by intro z; ext i <;> simp - map_add' := by intro q r; ext i <;> rfl - map_smul' := by intro r q; ext i <;> simp [quaternionCoordinates] }).toContinuousLinearEquiv - -@[simp] theorem quaternionTupleCoordinates_fixed {m : ℕ} (z : Fin m → ℂ) : - quaternionTupleCoordinates (fun i => Quaternion.ofComplex (z i)) = (z, 0) := by - apply Prod.ext - · funext i; exact congrArg Prod.fst (quaternionCoordinates_ofComplex (z i)) - · funext i; exact congrArg Prod.snd (quaternionCoordinates_ofComplex (z i)) - -@[simp] theorem quaternionTupleCoordinates_symm_fixed {m : ℕ} (z : Fin m → ℂ) : - quaternionTupleCoordinates.symm (z, 0) = fun i => Quaternion.ofComplex (z i) := by - exact quaternionTupleCoordinates.injective (by rw [ContinuousLinearEquiv.apply_symm_apply, quaternionTupleCoordinates_fixed]) - -/-- Circle normalization chosen compatibly with quaternion normalization. -/ -def normalizeCircle (z : ℂ) : Circle := by - classical - exact if hz : z = 0 then 1 else ⟨‖z‖⁻¹ • z, by apply mem_sphere_zero_iff_norm.mpr; simp [hz]⟩ - -theorem normalizeCircle_coe_of_ne_zero {z : ℂ} (hz : z ≠ 0) : - (normalizeCircle z : ℂ) = ‖z‖⁻¹ • z := by simp [normalizeCircle, hz] - -theorem normalizeQuaternion_ofComplex (z : ℂ) : - normalizeQuaternion (Quaternion.ofComplex z) = circleQuaternion (normalizeCircle z) := by - by_cases hz : z = 0 - · subst z - simp [normalizeQuaternion, normalizeCircle] - · have hq : Quaternion.ofComplex z ≠ 0 := by - intro h - have hh := congrArg quaternionCoordinates h - apply hz - have hz0 := congrArg Prod.fst hh - change (quaternionCoordinates (Quaternion.ofComplex z)).1 = (quaternionCoordinates (Quaternion.ofComplex 0)).1 at hz0 - simpa only [quaternionCoordinates_ofComplex] using hz0 - apply Subtype.ext - rw [normalizeQuaternion_coe_of_ne_zero hq, circleQuaternion_coe, - normalizeCircle_coe_of_ne_zero hz, norm_quaternion_ofComplex] - exact (map_smul Quaternion.ofComplex (‖z‖⁻¹) z).symm - -theorem wordMap_circleQuaternion {m : ℕ} (w : Fin m → FreeGroup (Fin m)) (x : Fin m → Circle) : - wordMap w (fun j => circleQuaternion (x j)) = - fun i => circleQuaternion (∏ j, x j ^ exponentMatrix w i j) := by - funext i - have he : FreeGroup.lift (fun j => circleQuaternion (x j)) = - circleQuaternion.comp (FreeGroup.lift x) := by - apply FreeGroup.ext_hom - intro j - simp - change FreeGroup.lift (fun j => circleQuaternion (x j)) (w i) = _ - rw [he, MonoidHom.comp_apply, freeGroup_lift_commutative] - rfl - -theorem radialWordMap_fixed {m : ℕ} (w : Fin m → FreeGroup (Fin m)) (z : Fin m → ℂ) - (hz : ∀ i, z i ≠ 0) : - radialWordMap w (fun i => Quaternion.ofComplex (z i)) = - fun i => Quaternion.ofComplex (complexRadialTorus (exponentMatrix w) z i) := by - funext i - simp only [radialWordMap, normalizeQuaternion_ofComplex, wordMap_circleQuaternion, - circleQuaternion_coe, complexRadialTorus, norm_quaternion_ofComplex] - rw [map_smul] - congr 1 - apply congrArg Quaternion.ofComplex - change Circle.coeHom (∏ j, normalizeCircle (z j) ^ exponentMatrix w i j) = _ - rw [map_prod] - apply Finset.prod_congr rfl - intro j _ - change (normalizeCircle (z j) : ℂ) ^ exponentMatrix w i j = _ - rw [normalizeCircle_coe_of_ne_zero (hz j)] - -theorem quaternionCoordinates_conjComplex (c : ℂ) (q : ℍ) : - quaternionCoordinates (Quaternion.ofComplex c * q * star (Quaternion.ofComplex c)) = - ((Complex.normSq c : ℂ) * (quaternionCoordinates q).1, - c ^ 2 * (quaternionCoordinates q).2) := by - apply Prod.ext <;> apply Complex.ext <;> - simp [quaternionCoordinates_apply, Complex.normSq_apply, pow_two] <;> ring - -@[simp] theorem quaternionCoordinates_conjCircle (c : Circle) (q : ℍ) : - quaternionCoordinates (Quaternion.ofComplex c * q * star (Quaternion.ofComplex c)) = - ((quaternionCoordinates q).1, (c : ℂ) ^ 2 * (quaternionCoordinates q).2) := by - simpa using quaternionCoordinates_conjComplex (c : ℂ) q - -/-- Ambient conjugation, compatible with the group operation on unit quaternions. -/ -def quaternionConjugate (a : SU2) (q : ℍ) : ℍ := (a : ℍ) * q * star (a : ℍ) - -@[simp] theorem quaternionConjugate_norm (a : SU2) (q : ℍ) : - ‖quaternionConjugate a q‖ = ‖q‖ := by - have ha := (quaternion_mem_unitary_iff _).mp a.property - simp [quaternionConjugate, ha] - -@[simp] theorem quaternionConjugate_zero (a : SU2) : quaternionConjugate a 0 = 0 := by - simp [quaternionConjugate] - -@[simp] theorem quaternionConjugate_one (a : SU2) : quaternionConjugate a 1 = 1 := by - simp [quaternionConjugate] - -theorem quaternionConjugate_smul (a : SU2) (r : ℝ) (q : ℍ) : - quaternionConjugate a (r • q) = r • quaternionConjugate a q := by - simp only [quaternionConjugate, mul_smul_comm, smul_mul_assoc] - -@[simp] theorem quaternionConjugate_coe (a q : SU2) : - quaternionConjugate a (q : ℍ) = ((a * q * a⁻¹ : SU2) : ℍ) := rfl - -theorem normalizeQuaternion_conjugate (a : SU2) (q : ℍ) : - normalizeQuaternion (quaternionConjugate a q) = a * normalizeQuaternion q * a⁻¹ := by - by_cases hq : q = 0 - · subst q; simp [normalizeQuaternion] - · have hn : quaternionConjugate a q ≠ 0 := by - intro hz - have he := quaternionConjugate_norm a q - rw [hz, norm_zero, eq_comm, norm_eq_zero] at he - exact hq he - apply Subtype.ext - rw [normalizeQuaternion_coe_of_ne_zero hn, ← quaternionConjugate_coe, - normalizeQuaternion_coe_of_ne_zero hq, quaternionConjugate_smul, quaternionConjugate_norm] - -theorem wordMap_conjugation {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (a : SU2) (x : Fin m → SU2) : - wordMap w (fun i => a * x i * a⁻¹) = fun i => a * wordMap w x i * a⁻¹ := by - have he : FreeGroup.lift (fun i => a * x i * a⁻¹) = - (MulAut.conj a).toMonoidHom.comp (FreeGroup.lift x) := by - apply FreeGroup.ext_hom - intro i - simp - funext i - change FreeGroup.lift (fun i => a * x i * a⁻¹) (w i) = _ - rw [he] - rfl - -theorem radialWordMap_conjugation {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (a : SU2) (x : Fin m → ℍ) : - radialWordMap w (fun i => quaternionConjugate a (x i)) = - fun i => quaternionConjugate a (radialWordMap w x i) := by - funext i - simp only [radialWordMap, quaternionConjugate_norm, normalizeQuaternion_conjugate, - wordMap_conjugation, quaternionConjugate_smul, quaternionConjugate_coe] - -theorem smoothRadialWordMap_conjugation {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (a : SU2) (x : Fin m → ℍ) : - smoothRadialWordMap w (fun i => quaternionConjugate a (x i)) = - fun i => quaternionConjugate a (smoothRadialWordMap w x i) := by - funext i - simp only [smoothRadialWordMap, radialCutoff, quaternionConjugate_norm, - Pi.smul_apply, radialWordMap_conjugation, quaternionConjugate_smul] - -end EilenbergGanea - - -namespace EilenbergGanea - -theorem complex_root_of_unity_norm {p : ℕ} (hp : p ≠ 0) (z : rootsOfUnity p ℂ) : - ‖((z : ℂˣ) : ℂ)‖ = 1 := by - have h := congrArg norm ((mem_rootsOfUnity' p (z : ℂˣ)).mp z.property) - simpa only [norm_pow, norm_one, pow_eq_one_iff_of_nonneg (norm_nonneg _) hp] using h - -theorem rootsOfUnity_isPGroup {p : ℕ} [Fact p.Prime] : IsPGroup p (rootsOfUnity p ℂ) := by - let : NeZero p := ⟨(Fact.out : p.Prime).ne_zero⟩ - rw [isPGroup_iff_card_dvd_pow, Complex.card_rootsOfUnity] - exact ⟨1, by simp⟩ - -theorem rootsOfUnity_exists_nonreal {p : ℕ} (hp : 2 < p) : - ∃ z : rootsOfUnity p ℂ, (((z : ℂˣ) : ℂ)).im ≠ 0 := by - have hp0 : p ≠ 0 := by omega - let ζ := Complex.exp (2 * Real.pi * Complex.I / p) - have hζ : IsPrimitiveRoot ζ p := Complex.isPrimitiveRoot_exp p hp0 - let u : ℂˣ := Units.mk0 ζ (Complex.exp_ne_zero _) - let z : rootsOfUnity p ℂ := ⟨u, (mem_rootsOfUnity' p u).mpr hζ.pow_eq_one⟩ - refine ⟨z, ?_⟩ - intro him - change ζ.im = 0 at him - have hn : ‖ζ‖ = 1 := complex_root_of_unity_norm hp0 z - have hs : ζ.re ^ 2 = 1 := by - have hh := Complex.normSq_eq_norm_sq ζ - simp only [Complex.normSq_apply, him, mul_zero, add_zero, hn, one_pow] at hh - nlinarith - have hpow : ζ ^ 2 = 1 := by - apply Complex.ext <;> simp [pow_two, him] - nlinarith - have hd := hζ.dvd_of_pow_eq_one 2 hpow - have ht := Nat.le_of_dvd (by decide : 0 < 2) hd - omega - -theorem circle_exists_square_root (z : ℂ) (hz : ‖z‖ = 1) : - ∃ c : Circle, (c : ℂ) ^ 2 = z := by - obtain ⟨c, hc⟩ := IsAlgClosed.exists_pow_nat_eq z (by decide : 0 < 2) - have hn : ‖c‖ = 1 := by - have hh := congrArg norm hc - rw [norm_pow, hz] at hh - nlinarith [norm_nonneg c] - exact ⟨⟨c, mem_sphere_zero_iff_norm.mpr hn⟩, hc⟩ - -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped Quaternion ContDiff - -def splitWordMap {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (q : (Fin m → ℂ) × (Fin m → ℂ)) : (Fin m → ℂ) × (Fin m → ℂ) := - quaternionTupleCoordinates (smoothRadialWordMap w (quaternionTupleCoordinates.symm q)) - (1, 0) - -theorem splitWordMap_contDiff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) : - ContDiff ℝ ∞ (splitWordMap w) := - (quaternionTupleCoordinates.contDiff.comp ((smoothRadialWordMap_contDiff w).comp - quaternionTupleCoordinates.symm.contDiff)).sub contDiff_const - -theorem quaternionTupleCoordinates_conjCircle {m : ℕ} (c : Circle) (q : Fin m → ℍ) : - quaternionTupleCoordinates (fun i => quaternionConjugate (circleQuaternion c) (q i)) = - ((quaternionTupleCoordinates q).1, (c : ℂ) ^ 2 • (quaternionTupleCoordinates q).2) := by - apply Prod.ext - · funext i - change (quaternionCoordinates (Quaternion.ofComplex c * q i * star (Quaternion.ofComplex c))).1 = _ - have hh := congrArg Prod.fst (quaternionCoordinates_conjCircle c (q i)) - exact hh - · funext i - change (quaternionCoordinates (Quaternion.ofComplex c * q i * star (Quaternion.ofComplex c))).2 = _ - have hh := congrArg Prod.snd (quaternionCoordinates_conjCircle c (q i)) - exact hh - -theorem splitWordMap_rotation {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (z : ℂ) (hz : ‖z‖ = 1) (q : (Fin m → ℂ) × (Fin m → ℂ)) : - splitWordMap w (q.1, z • q.2) = ((splitWordMap w q).1, z • (splitWordMap w q).2) := by - obtain ⟨c, hc⟩ := circle_exists_square_root z hz - let x := quaternionTupleCoordinates.symm q - have hx : quaternionTupleCoordinates x = q := quaternionTupleCoordinates.apply_symm_apply q - have heq : (q.1, z • q.2) = quaternionTupleCoordinates - (fun i => quaternionConjugate (circleQuaternion c) (x i)) := by - rw [quaternionTupleCoordinates_conjCircle, hc, hx] - have hh := congrArg (fun v : Fin m → ℍ => quaternionTupleCoordinates v) - (smoothRadialWordMap_conjugation w (circleQuaternion c) x) - rw [quaternionTupleCoordinates_conjCircle, hc] at hh - have heq' : quaternionTupleCoordinates.symm (q.1, z • q.2) = - fun i => quaternionConjugate (circleQuaternion c) (x i) := by - rw [heq, ContinuousLinearEquiv.symm_apply_apply] - unfold splitWordMap - rw [heq', hh] - change (_, z • _) - (1, 0) = ((quaternionTupleCoordinates (smoothRadialWordMap w x) - (1, 0)).1, - z • (quaternionTupleCoordinates (smoothRadialWordMap w x) - (1, 0)).2) - simp - -theorem splitWordMap_fixed_eventually {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℂ) (hx : ∀ i, ‖x i‖ = 1) : - (fun z => (splitWordMap w (z, 0)).1) =ᶠ[𝓝 x] - (fun z => complexRadialTorus (exponentMatrix w) z - 1) := by - have hne (i : Fin m) : x i ≠ 0 := by intro h; simpa [h] using hx i - have hz : ∀ᶠ z in 𝓝 x, ∀ i, z i ≠ 0 := Filter.eventually_all.mpr - (fun i => (continuous_apply i).continuousAt.eventually_ne (hne i)) - have hcont : Continuous (fun z : Fin m → ℂ => fun i => Quaternion.ofComplex (z i)) := - continuous_pi (fun i => Quaternion.ofComplex.toLinearMap.continuous_of_finiteDimensional.comp - (continuous_apply i)) - have he := (smoothRadialWordMap_eventuallyEq w (fun i => Quaternion.ofComplex (x i)) - (fun i => (norm_quaternion_ofComplex _).trans (hx i))).comp_tendsto hcont.continuousAt - filter_upwards [hz, he] with z hz he - change smoothRadialWordMap w (fun i => Quaternion.ofComplex (z i)) = - radialWordMap w (fun i => Quaternion.ofComplex (z i)) at he - simp only [splitWordMap, quaternionTupleCoordinates_symm_fixed] - rw [he, radialWordMap_fixed w z hz, quaternionTupleCoordinates_fixed] - rfl - -theorem splitWordMap_fixed_det {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (x : Fin m → ℂ) (hx : ∀ i, ‖x i‖ = 1) - (hr : ∀ i, ∏ j, x j ^ exponentMatrix w i j = 1) : - (fderiv ℝ (fun z => (splitWordMap w (z, 0)).1) x).det = - ((exponentMatrix w).det : ℝ) := by - rw [(splitWordMap_fixed_eventually w x hx).fderiv_eq (𝕜 := ℝ)] - have hne (i : Fin m) : x i ≠ 0 := by intro h; simpa [h] using hx i - rw [((complexRadialTorus_differentiableAt (exponentMatrix w) x hne).hasFDerivAt.sub_const 1).fderiv] - exact complexRadialTorus_det (exponentMatrix w) x hx hr - -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped Quaternion - -theorem splitWordMap_zero_iff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (q : (Fin m → ℂ) × (Fin m → ℂ)) : - splitWordMap w q = 0 ↔ - smoothRadialWordMap w (quaternionTupleCoordinates.symm q) = 1 := by - unfold splitWordMap - rw [sub_eq_zero] - have he : quaternionTupleCoordinates (1 : Fin m → ℍ) = (1, 0) := by - change quaternionTupleCoordinates (fun i : Fin m => Quaternion.ofComplex (1 : ℂ)) = _ - exact quaternionTupleCoordinates_fixed 1 - rw [← he] - exact quaternionTupleCoordinates.injective.eq_iff - -theorem splitWordMap_fixed_zero_iff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (z : Fin m → ℂ) : splitWordMap w (z, 0) = 0 ↔ - (∀ i, ‖z i‖ = 1) ∧ (∀ i, ∏ j, z j ^ exponentMatrix w i j = 1) := by - rw [splitWordMap_zero_iff, quaternionTupleCoordinates_symm_fixed, - smoothRadialWordMap_eq_one_iff] - constructor - · intro h - have hn : ∀ i, ‖z i‖ = 1 := fun i => (norm_quaternion_ofComplex (z i)).symm.trans - (((radialWordMap_eq_one_iff w _).mp h).1 i) - have hz (i : Fin m) : z i ≠ 0 := by intro h; simpa [h] using hn i - rw [radialWordMap_fixed w z hz] at h - refine ⟨hn, fun i => ?_⟩ - have hh := congrArg (fun v : Fin m → ℍ => (quaternionCoordinates (v i)).1) h - change (quaternionCoordinates (Quaternion.ofComplex _)).1 = (1 : ℂ) at hh - simpa only [quaternionCoordinates_ofComplex, complexRadialTorus, hn, inv_one, one_smul] using hh - · rintro ⟨hn, hr⟩ - have hz (i : Fin m) : z i ≠ 0 := by intro h; simpa [h] using hn i - rw [radialWordMap_fixed w z hz] - funext i - simp [complexRadialTorus, hn, hr] - -@[simp] theorem splitWordMap_fixed_one {m : ℕ} (w : Fin m → FreeGroup (Fin m)) : - splitWordMap w (1, 0) = 0 := by - rw [splitWordMap_fixed_zero_iff] - simp - -end EilenbergGanea - -namespace EilenbergGanea -open Set -section Torus -variable {n : Type*} [Fintype n] [DecidableEq n] -variable {A : Type*} [CommGroup A] -theorem zpow_finite_sum {ι : Type*} (a : A) (s : Finset ι) (e : ι → ℤ) : - a ^ (∑ i ∈ s, e i) = ∏ i ∈ s, a ^ e i := by - classical - induction s using Finset.induction with - | empty => simp - | @insert i s hi ih => simp [hi, ih, zpow_add] - -def torusMap (B : Matrix n n ℤ) (x : n → A) : n → A := - fun i => ∏ j, x j ^ B i j - -omit [DecidableEq n] in -theorem torusMap_comp (B C : Matrix n n ℤ) (x : n → A) : - torusMap B (torusMap C x) = torusMap (B * C) x := by - funext i - simp only [torusMap, Matrix.mul_apply, ← Finset.prod_zpow, zpow_finite_sum, ← zpow_mul] - rw [Finset.prod_comm] - congr 1 - funext j - congr 1 - funext k - rw [Int.mul_comm] - -theorem torusMap_det_one (B : Matrix n n ℤ) (x : n → A) : - torusMap (B.det • (1 : Matrix n n ℤ)) x = fun i => x i ^ B.det := by - funext i - simp [torusMap, Matrix.one_apply] - -theorem torusMap_kernel_pow_det (B : Matrix n n ℤ) (x : n → A) - (hx : torusMap B x = 1) (i : n) : x i ^ B.det = 1 := by - have he := congrArg (fun y => torusMap B.adjugate y i) hx - rw [torusMap_comp, Matrix.adjugate_mul, torusMap_det_one] at he - simpa [torusMap] using he - -theorem circle_finite_pow_roots {d : ℤ} (hd : d ≠ 0) : - {z : Circle | z ^ d = 1}.Finite := by - have hr := Polynomial.finite_setOfPred_isRoot - (Polynomial.X_pow_sub_C_ne_zero (Nat.pos_of_ne_zero (Int.natAbs_ne_zero.mpr hd)) (1 : ℂ)) - apply Set.Finite.of_injOn (f := fun z : Circle => (z : ℂ)) _ - Subtype.val_injective.injOn hr - intro z hz - have hp : z ^ d.natAbs = 1 := pow_natAbs_eq_one.mpr hz - have he : (z : ℂ) ^ d.natAbs = 1 := by - simpa using congrArg (fun t : Circle => (t : ℂ)) hp - simpa [Polynomial.IsRoot.def] using sub_eq_zero.mpr he - -theorem torusMap_finite_kernel (B : Matrix n n ℤ) (hB : B.det ≠ 0) : - {x : n → Circle | torusMap B x = 1}.Finite := by - apply Set.Finite.subset (Set.Finite.pi (fun _ : n => circle_finite_pow_roots hB)) - intro x hx i _ - exact torusMap_kernel_pow_det B x hx i - -end Torus -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology - -theorem splitWordMap_fixed_finite {m : ℕ} (w : Fin m → FreeGroup (Fin m)) - (hB : (exponentMatrix w).det ≠ 0) : - {z : Fin m → ℂ | splitWordMap w (z, 0) = 0}.Finite := by - classical - let e : (Fin m → Circle) → (Fin m → ℂ) := fun x i => (x i : ℂ) - have hf := (torusMap_finite_kernel (exponentMatrix w) hB).image e - apply hf.subset - intro z hz - obtain ⟨hn, hr⟩ := (splitWordMap_fixed_zero_iff w z).mp hz - let x : Fin m → Circle := fun i => ⟨z i, mem_sphere_zero_iff_norm.mpr (hn i)⟩ - refine ⟨x, ?_, rfl⟩ - funext i - apply Subtype.ext - change Circle.coeHom (∏ j, x j ^ exponentMatrix w i j) = (1 : ℂ) - rw [map_prod] - simp only [map_zpow] - exact hr i - -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped ContDiff - -/-- The signed-root noncancellation for the actual ambient quaternion word -map, with no regularity assumed of the original word map. -/ -theorem word_exists_regularization_nonzero_count {m : ℕ} - (w : Fin m → FreeGroup (Fin m)) (hB : (exponentMatrix w).det ≠ 0) - (K : Set ((Fin m → ℂ) × (Fin m → ℂ))) (hK : IsCompact K) - (hKi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q ∈ K, (q.1, z • q.2) ∈ K) - (h1 : (1, 0) ∈ K) - (L : Set ((Fin m → ℂ) × (Fin m → ℂ))) (hL : IsCompact L) (hKL : K ⊆ L) - (ε : ℝ) (hε : 0 < ε) : - ∃ g : ((Fin m → ℂ) × (Fin m → ℂ)) → ((Fin m → ℂ) × (Fin m → ℂ)), - ContDiff ℝ ∞ g ∧ (∀ q ∈ L, ‖g q - splitWordMap w q‖ < ε) ∧ - ∃ s : Finset ((Fin m → ℂ) × (Fin m → ℂ)), - (∀ q, q ∈ s ↔ q ∈ K ∧ g q = 0) ∧ - (∀ q ∈ s, (fderiv ℝ g q).det ≠ 0) ∧ - (∑ q ∈ s, (if 0 < (fderiv ℝ g q).det then 1 else -1 : ℝ)) ≠ 0 := by - classical - let S := (splitWordMap_fixed_finite w hB).toFinset - have hS (z) : z ∈ S ↔ splitWordMap w (z, 0) = 0 := (splitWordMap_fixed_finite w hB).mem_toFinset - obtain ⟨p, hpbound, hp⟩ := Nat.exists_infinite_primes (S.card + 3) - let : Fact p.Prime := ⟨hp⟩ - let : NeZero p := ⟨hp.ne_zero⟩ - let : Fintype (rootsOfUnity p ℂ) := Fintype.ofFinite _ - obtain ⟨a₀, ha₀⟩ := rootsOfUnity_exists_nonreal (p := p) (by omega) - let χ : rootsOfUnity p ℂ →* ℂˣ := (rootsOfUnity p ℂ).subtype - apply exists_regularization_nonzero_count (rootsOfUnity_isPGroup (p := p)) χ - Subtype.val_injective a₀ ha₀ (splitWordMap w) (splitWordMap_contDiff w) - (fun a q => splitWordMap_rotation w (χ a : ℂ) (complex_root_of_unity_norm hp.ne_zero a) q) - K hK (fun a q hq => hKi (χ a : ℂ) (complex_root_of_unity_norm hp.ne_zero a) q hq) - L hL hKL S (fun z _ hz => (hS z).mpr hz) ⟨1, h1, splitWordMap_fixed_one w⟩ (by omega) - ((exponentMatrix w).det : ℝ) (by exact_mod_cast hB) _ ε hε - intro z hz - obtain ⟨hn, hr⟩ := (splitWordMap_fixed_zero_iff w z).mp ((hS z).mp hz) - exact splitWordMap_fixed_det w z hn hr - -end EilenbergGanea - -end - -end OAI +import OAI.Topology.EilenbergGanea.Regularization +import Mathlib.Analysis.Quaternion +import Mathlib.Analysis.Complex.Circle +import Mathlib.Analysis.Complex.Polynomial.Basic +import Mathlib.Analysis.Calculus.Deriv.ZPow +import Mathlib.GroupTheory.FreeGroup.Basic +import Mathlib.Analysis.SpecialFunctions.SmoothTransition + +namespace OAI + +noncomputable section + +open Set Filter Topology +open scoped Quaternion ContDiff + +open scoped Quaternion +namespace EilenbergGanea +abbrev SU2 := unitary ℍ + +theorem quaternion_mem_unitary_iff (q : ℍ) : q ∈ unitary ℍ ↔ ‖q‖ = 1 := by + rw [Unitary.mem_iff, Quaternion.star_mul_self, Quaternion.self_mul_star, and_self] + constructor + · intro h + have he : Quaternion.normSq q = 1 := Quaternion.coe_inj.mp h + rw [Quaternion.normSq_eq_norm_mul_self] at he + nlinarith [norm_nonneg q] + · intro h + simp [Quaternion.normSq_eq_norm_mul_self, h] + +instance su2_compactSpace : CompactSpace SU2 := by + apply isCompact_iff_compactSpace.mp + have hs : (unitary ℍ : Set ℍ) = Metric.sphere 0 1 := by + ext q + simp [quaternion_mem_unitary_iff] + rw [hs] + exact isCompact_sphere 0 1 + +def circleQuaternion : Circle →* SU2 where + toFun z := ⟨Quaternion.ofComplex z, by + rw [Unitary.mem_iff, Quaternion.star_mul_self, Quaternion.self_mul_star, and_self] + have hz := Circle.normSq_coe z + have he : Quaternion.normSq (Quaternion.ofComplex z) = 1 := by + simpa [Quaternion.normSq_def', Complex.normSq_apply, sq] using hz + rw [he]; rfl⟩ + map_one' := Subtype.ext (map_one Quaternion.ofComplex) + map_mul' z w := Subtype.ext (map_mul Quaternion.ofComplex (z : ℂ) (w : ℂ)) + +@[simp] theorem circleQuaternion_coe (z : Circle) : + ((circleQuaternion z : SU2) : ℍ) = (z : ℂ) := rfl + +theorem circleQuaternion_injective : Function.Injective circleQuaternion := by + intro z w h + apply Subtype.ext + apply Complex.ext + · exact congrArg (fun q : ℍ => q.re) (congrArg Subtype.val h) + · exact congrArg (fun q : ℍ => q.imI) (congrArg Subtype.val h) + +theorem circleQuaternion_continuous : Continuous circleQuaternion := by + apply Continuous.subtype_mk + exact Quaternion.ofComplex.toLinearMap.continuous_of_finiteDimensional.comp continuous_subtype_val + +def wordMap {m : ℕ} (w : Fin m → FreeGroup (Fin m)) (x : Fin m → SU2) : Fin m → SU2 := + fun i => FreeGroup.lift x (w i) + +def exponentMatrix {m : ℕ} (w : Fin m → FreeGroup (Fin m)) : Matrix (Fin m) (Fin m) ℤ := + fun i j => Multiplicative.toAdd + (FreeGroup.lift (fun k => Multiplicative.ofAdd (if j = k then (1 : ℤ) else 0)) (w i)) + +open Set Filter Topology +open scoped ContDiff + +/-- Radial normalization is only used on nonzero quaternions. The harmless +value at zero makes it a total function without changing that domain. -/ +def normalizeQuaternion (q : ℍ) : SU2 := by + classical + exact if h : q = 0 then 1 else + ⟨‖q‖⁻¹ • q, (quaternion_mem_unitary_iff _).mpr (by + simp only [norm_smul, Real.norm_eq_abs, abs_inv, abs_norm] + exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr h))⟩ + +theorem normalizeQuaternion_coe_of_ne_zero {q : ℍ} (hq : q ≠ 0) : + (normalizeQuaternion q : ℍ) = ‖q‖⁻¹ • q := by simp [normalizeQuaternion, hq] + +theorem normalizeQuaternion_coe_contDiffAt {q : ℍ} (hq : q ≠ 0) : + ContDiffAt ℝ ∞ (fun z => (normalizeQuaternion z : ℍ)) q := by + have h : ContDiffAt ℝ ∞ (fun z : ℍ => ‖z‖⁻¹ • z) q := + ((contDiffAt_norm ℝ hq).inv (norm_ne_zero_iff.mpr hq)).smul contDiffAt_id + apply h.congr_of_eventuallyEq + filter_upwards [eventually_ne_nhds hq] with z hz + exact normalizeQuaternion_coe_of_ne_zero hz + +theorem normalizeQuaternion_continuousAt {q : ℍ} (hq : q ≠ 0) : + ContinuousAt normalizeQuaternion q := by + exact tendsto_subtype_rng.mpr (normalizeQuaternion_coe_contDiffAt hq).continuousAt + +@[simp] theorem normalizeQuaternion_unitary (q : SU2) : normalizeQuaternion (q : ℍ) = q := by + have hqnorm : ‖(q : ℍ)‖ = 1 := (quaternion_mem_unitary_iff _).mp q.property + have hq : (q : ℍ) ≠ 0 := by intro he; simp [he] at hqnorm + apply Subtype.ext + simp [normalizeQuaternion_coe_of_ne_zero hq, hqnorm] + +/-- Smoothness of coefficient-free word evaluation follows directly by +induction, using quaternion conjugation for unitary inverses. -/ +theorem freeGroup_lift_coe_contDiffAt {D ι : Type*} + [NormedAddCommGroup D] [NormedSpace ℝ D] (w : FreeGroup ι) + (a : D) (x : D → ι → SU2) + (hx : ∀ i, ContDiffAt ℝ ∞ (fun z => (x z i : ℍ)) a) : + ContDiffAt ℝ ∞ (fun z => ((FreeGroup.lift (x z) w : SU2) : ℍ)) a := by + induction w using FreeGroup.induction_on with + | one => simpa using (contDiffAt_const : ContDiffAt ℝ ∞ (fun _ : D => (1 : ℍ)) a) + | of i => simpa using hx i + | inv_of i hi => + simp only [map_inv] + change ContDiffAt ℝ ∞ (fun z => star ((FreeGroup.lift (x z) (FreeGroup.of i) : SU2) : ℍ)) a + let L : ℍ →ₗ[ℝ] ℍ := + { toFun := star + map_add' := star_add + map_smul' := Quaternion.star_smul } + exact L.toContinuousLinearMap.contDiff.contDiffAt.comp a hi + | mul v w hv hw => simpa only [map_mul, Submonoid.coe_mul] using hv.mul hw + +def radialWordMap {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℍ) : Fin m → ℍ := + fun i => ‖x i‖ • ((wordMap w (fun j => normalizeQuaternion (x j)) i : SU2) : ℍ) + +@[simp] theorem radialWordMap_norm {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℍ) (i : Fin m) : ‖radialWordMap w x i‖ = ‖x i‖ := by + have h : ‖((wordMap w (fun j => normalizeQuaternion (x j)) i : SU2) : ℍ)‖ = 1 := + (quaternion_mem_unitary_iff _).mp (wordMap w (fun j => normalizeQuaternion (x j)) i).property + simp [radialWordMap, norm_smul, h] + +theorem radialWordMap_contDiffAt {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℍ) (hx : ∀ i, x i ≠ 0) : ContDiffAt ℝ ∞ (radialWordMap w) x := by + apply contDiffAt_pi.mpr + intro i + exact ((contDiffAt_apply ℝ ℍ i x).norm ℝ (hx i)).smul + (freeGroup_lift_coe_contDiffAt (w i) x (fun z j => normalizeQuaternion (z j)) + (fun j => (normalizeQuaternion_coe_contDiffAt (hx j)).comp (f := fun z : Fin m → ℍ => z j) x (contDiffAt_apply ℝ ℍ j x))) + +theorem radialWordMap_eq_one_iff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℍ) : radialWordMap w x = 1 ↔ + (∀ i, ‖x i‖ = 1) ∧ wordMap w (fun j => normalizeQuaternion (x j)) = 1 := by + constructor + · intro h + have hn (i : Fin m) : ‖x i‖ = 1 := by + have he := congrArg (fun y : Fin m → ℍ => ‖y i‖) h + simpa only [radialWordMap_norm, Pi.one_apply, norm_one] using he + refine ⟨hn, ?_⟩ + funext i + apply Subtype.ext + have he := congrFun h i + simpa [radialWordMap, hn] using he + · rintro ⟨hn, hw⟩ + funext i + simp [radialWordMap, hn, hw] + + +/-- A conjugation-invariant smooth cutoff, zero near coordinate hyperplanes +and one near the unit quaternion locus. -/ +def radialCutoff {m : ℕ} (x : Fin m → ℍ) : ℝ := + ∏ i, Real.smoothTransition (4 * ‖x i‖ ^ 2 - 1) + +def smoothRadialWordMap {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℍ) : Fin m → ℍ := radialCutoff x • radialWordMap w x + +theorem radialCutoff_contDiff {m : ℕ} : ContDiff ℝ ∞ (@radialCutoff m) := by + apply contDiff_prod + intro i _ + have hn : ContDiff ℝ ∞ (fun x : Fin m → ℍ => ‖x i‖ ^ 2) := + (contDiff_apply ℝ ℍ i).norm_sq ℝ + exact Real.smoothTransition.contDiff.comp ((contDiff_const.mul hn).sub contDiff_const) + +theorem radialCutoff_nonneg {m : ℕ} (x : Fin m → ℍ) : 0 ≤ radialCutoff x := + Finset.prod_nonneg (fun _ _ => Real.smoothTransition.nonneg _) + +theorem radialCutoff_le_one {m : ℕ} (x : Fin m → ℍ) : radialCutoff x ≤ 1 := + Finset.prod_le_one₀ (fun _ _ => Real.smoothTransition.nonneg _) + (fun _ _ => Real.smoothTransition.le_one _) + +theorem radialCutoff_eq_one {m : ℕ} (x : Fin m → ℍ) (hx : ∀ i, 1 ≤ ‖x i‖) : + radialCutoff x = 1 := by + apply Finset.prod_eq_one + intro i _ + apply Real.smoothTransition.one_of_one_le + nlinarith [hx i] + +theorem radialCutoff_eventually_zero {m : ℕ} (x : Fin m → ℍ) (i : Fin m) + (hi : x i = 0) : radialCutoff =ᶠ[𝓝 x] (fun _ => 0) := by + have h : ∀ᶠ y in 𝓝 x, ‖y i‖ < (1 / 2 : ℝ) := + ((continuous_apply i).norm.continuousAt.eventually_lt_const (by simp [hi])) + filter_upwards [h] with y hy + apply Finset.prod_eq_zero (Finset.mem_univ i) + apply Real.smoothTransition.zero_of_nonpos + nlinarith [norm_nonneg (y i)] + +theorem radialCutoff_eventually_one {m : ℕ} (x : Fin m → ℍ) + (hx : ∀ i, ‖x i‖ = 1) : radialCutoff =ᶠ[𝓝 x] (fun _ => 1) := by + have h (i : Fin m) : ∀ᶠ y in 𝓝 x, (3 / 4 : ℝ) < ‖y i‖ := + ((continuous_apply i).norm.continuousAt.eventually_const_lt (by change (3 / 4 : ℝ) < ‖x i‖; rw [hx i]; norm_num)) + filter_upwards [Filter.eventually_all.mpr h] with y hy + apply Finset.prod_eq_one + intro i _ + apply Real.smoothTransition.one_of_one_le + nlinarith [hy i] + +theorem smoothRadialWordMap_contDiff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) : + ContDiff ℝ ∞ (smoothRadialWordMap w) := by + rw [contDiff_iff_contDiffAt] + intro x + by_cases hx : ∀ i, x i ≠ 0 + · exact radialCutoff_contDiff.contDiffAt.smul (radialWordMap_contDiffAt w x hx) + · push Not at hx + obtain ⟨i, hi⟩ := hx + apply (contDiffAt_const : ContDiffAt ℝ ∞ (fun _ : Fin m → ℍ => (0 : Fin m → ℍ)) x).congr_of_eventuallyEq + filter_upwards [radialCutoff_eventually_zero x i hi] with y hy + simp [smoothRadialWordMap, hy] + +theorem smoothRadialWordMap_eq_one_iff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℍ) : smoothRadialWordMap w x = 1 ↔ radialWordMap w x = 1 := by + constructor + · intro h + have hn (i : Fin m) : radialCutoff x * ‖x i‖ = 1 := by + have he := congrArg (fun y : Fin m → ℍ => ‖y i‖) h + simpa only [smoothRadialWordMap, Pi.smul_apply, norm_smul, Real.norm_eq_abs, + abs_of_nonneg (radialCutoff_nonneg x), radialWordMap_norm, Pi.one_apply, norm_one] using he + have hlarge (i : Fin m) : 1 ≤ ‖x i‖ := by + have hle := mul_le_mul_of_nonneg_right (radialCutoff_le_one x) (norm_nonneg (x i)) + rw [hn i, one_mul] at hle + exact hle + simpa only [smoothRadialWordMap, radialCutoff_eq_one x hlarge, one_smul] using h + · intro h + have hn := (radialWordMap_eq_one_iff w x).mp h + simp only [smoothRadialWordMap, radialCutoff_eq_one x (fun i => (hn.1 i).ge), one_smul, h] + +theorem smoothRadialWordMap_eventuallyEq {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℍ) (hx : ∀ i, ‖x i‖ = 1) : + smoothRadialWordMap w =ᶠ[𝓝 x] radialWordMap w := by + filter_upwards [radialCutoff_eventually_one x hx] with y hy + simp [smoothRadialWordMap, hy] + +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +variable {n : Type*} [Fintype n] [DecidableEq n] + +def splitComplex : (n → ℂ) ≃ₗ[ℝ] ((n → ℝ) × (n → ℝ)) where + toFun z := (fun i => (z i).re, fun i => (z i).im) + invFun p i := (p.1 i : ℂ) + (p.2 i : ℂ) * Complex.I + left_inv z := by funext i; exact Complex.re_add_im (z i) + right_inv p := by ext i <;> simp + map_add' a b := by ext i <;> simp + map_smul' a b := by ext i <;> simp + +def radialAngularLinear (B : Matrix n n ℝ) : (n → ℂ) →L[ℝ] (n → ℂ) := + ((splitComplex (n := n)).symm.toLinearMap.comp + (((LinearMap.id : (n → ℝ) →ₗ[ℝ] (n → ℝ)).prodMap B.toLin').comp + (splitComplex (n := n)).toLinearMap)).toContinuousLinearMap + +@[simp] theorem radialAngularLinear_apply (B : Matrix n n ℝ) (z : n → ℂ) (i : n) : + radialAngularLinear B z i = ((z i).re : ℂ) + (∑ j, B i j * (z j).im : ℝ) * Complex.I := rfl + +theorem radialAngularLinear_det (B : Matrix n n ℝ) : + (radialAngularLinear B).toLinearMap.det = B.det := by + change LinearMap.det ((splitComplex (n := n)).symm.toLinearMap ∘ₗ + ((LinearMap.id : (n → ℝ) →ₗ[ℝ] (n → ℝ)).prodMap B.toLin') ∘ₗ + (splitComplex (n := n)).toLinearMap) = _ + have he := LinearMap.det_conj + ((LinearMap.id : (n → ℝ) →ₗ[ℝ] (n → ℝ)).prodMap B.toLin') + (splitComplex (n := n)).symm + rw [LinearEquiv.symm_symm] at he + rw [he, LinearMap.det_prodMap, LinearMap.det_id, one_mul, LinearMap.det_toLin'] + +def complexPolarChart (x z : n → ℂ) : n → ℂ := fun i => x i * Complex.exp (z i) + +def complexRadialTorus (B : Matrix n n ℤ) (z : n → ℂ) : n → ℂ := + fun i => ‖z i‖ • ∏ j, (‖z j‖⁻¹ • z j) ^ B i j + +theorem normalize_complex_mul_exp (x z : ℂ) (hx : ‖x‖ = 1) : + ‖x * Complex.exp z‖⁻¹ • (x * Complex.exp z) = + x * Complex.exp ((z.im : ℂ) * Complex.I) := by + rw [norm_mul, hx, one_mul, Complex.norm_exp, Complex.real_smul, Complex.ofReal_inv] + have he : Complex.exp z = (Real.exp z.re : ℂ) * + Complex.exp ((z.im : ℂ) * Complex.I) := by + rw [Complex.ofReal_exp, ← Complex.exp_add, Complex.re_add_im] + rw [he] + have hn : (Real.exp z.re : ℂ) ≠ 0 := by exact_mod_cast Real.exp_ne_zero z.re + field_simp + + theorem complexRadialTorus_chart (B : Matrix n n ℤ) (x : n → ℂ) + (hx : ∀ i, ‖x i‖ = 1) (hroot : ∀ i, ∏ j, x j ^ B i j = 1) : + complexRadialTorus B ∘ complexPolarChart x = + fun z => fun i => Complex.exp (radialAngularLinear (B.map (Int.castRingHom ℝ)) z i) := by + funext z i + have hn (j : n) := normalize_complex_mul_exp (x j) (z j) (hx j) + simp only [Function.comp_apply, complexRadialTorus, complexPolarChart] + simp only [hn] + simp only [mul_zpow, Finset.prod_mul_distrib, + hroot, one_mul, norm_mul, hx, one_mul, Complex.norm_exp, radialAngularLinear_apply, + ← Complex.exp_int_mul] + rw [Complex.real_smul, Complex.ofReal_exp, ← Complex.exp_sum, ← Complex.exp_add] + congr 1 + simp only [Matrix.map_apply, Int.coe_castRingHom, Complex.ofReal_sum, + Complex.ofReal_mul, Complex.ofReal_intCast] + rw [Finset.sum_mul] + congr 1 + apply Finset.sum_congr rfl + intro j _ + ring + + +/-- The real derivative of multiplication by a unit complex tuple has determinant one. -/ +def complexDiagonal (x : n → ℂ) : (n → ℂ) →L[ℝ] (n → ℂ) := + ((Matrix.diagonal x).toLin').toContinuousLinearMap.restrictScalars ℝ + +@[simp] theorem complexDiagonal_apply (x z : n → ℂ) (i : n) : + complexDiagonal x z i = x i * z i := by simp [complexDiagonal, Matrix.toLin'_apply, Matrix.mulVec, Matrix.diagonal_apply, dotProduct] + +theorem complexDiagonal_det (x : n → ℂ) (hx : ∀ i, ‖x i‖ = 1) : + (complexDiagonal x).toLinearMap.det = 1 := by + change (((Matrix.diagonal x).toLin').restrictScalars ℝ).det = _ + rw [LinearMap.det_restrictScalars, Algebra.norm_complex_apply, LinearMap.det_toLin', + Matrix.det_diagonal] + rw [Complex.normSq_eq_norm_sq, norm_prod] + simp [hx] + +theorem complexPolarChart_hasFDerivAt (x : n → ℂ) : + HasFDerivAt (complexPolarChart x) (complexDiagonal x) 0 := by + apply hasFDerivAt_pi'.mpr + intro i + have h := ((ContinuousLinearMap.proj i : (n → ℂ) →L[ℝ] ℂ).hasFDerivAt + (x := 0)).cexp.const_mul (x i) + change HasFDerivAt (fun z : n → ℂ => x i * Complex.exp (z i)) _ (0 : n → ℂ) + have he : (ContinuousLinearMap.proj i : (n → ℂ) →L[ℝ] ℂ).comp (complexDiagonal x) = + x i • (ContinuousLinearMap.proj i : (n → ℂ) →L[ℝ] ℂ) := by + ext z + simp + rw [he] + simpa using h + +theorem exp_radialAngularLinear_hasFDerivAt (B : Matrix n n ℝ) : + HasFDerivAt (fun z i => Complex.exp (radialAngularLinear B z i)) + (radialAngularLinear B) 0 := by + apply hasFDerivAt_pi'.mpr + intro i + simpa using (((ContinuousLinearMap.proj i : (n → ℂ) →L[ℝ] ℂ).comp + (radialAngularLinear B)).hasFDerivAt (x := 0)).cexp + +theorem complexRadialTorus_differentiableAt (B : Matrix n n ℤ) (x : n → ℂ) + (hx : ∀ i, x i ≠ 0) : DifferentiableAt ℝ (complexRadialTorus B) x := by + apply differentiableAt_pi.mpr + intro i + have hn (j : n) : DifferentiableAt ℝ (fun z : n → ℂ => ‖z j‖) x := + (differentiableAt_apply j x).norm ℝ (hx j) + apply (hn i).smul + have hp (j : n) : DifferentiableAt ℝ (fun z : n → ℂ => (‖z j‖⁻¹ • z j) ^ B i j) x := by + have hne : ‖x j‖⁻¹ • x j ≠ 0 := + smul_ne_zero (inv_ne_zero (norm_ne_zero_iff.mpr (hx j))) (hx j) + have hz : DifferentiableAt ℝ (fun z : ℂ => z ^ B i j) (‖x j‖⁻¹ • x j) := + ((differentiableAt_zpow (𝕜 := ℂ) (m := B i j)).mpr (Or.inl hne)).restrictScalars ℝ + exact hz.comp x (((hn j).inv (norm_ne_zero_iff.mpr (hx j))).smul + (differentiableAt_apply j x)) + exact (HasFDerivAt.finsetProd (fun j _ => (hp j).hasFDerivAt)).differentiableAt + +/-- At every torus root, the radial extension has exactly determinant det B. +The extra radial coordinates contribute the identity, not an additional sign. -/ +theorem complexRadialTorus_det (B : Matrix n n ℤ) (x : n → ℂ) + (hx : ∀ i, ‖x i‖ = 1) (hroot : ∀ i, ∏ j, x j ^ B i j = 1) : + (fderiv ℝ (complexRadialTorus B) x).det = (B.det : ℝ) := by + have hne (i : n) : x i ≠ 0 := by intro h; simpa [h] using hx i + have hd := (complexRadialTorus_differentiableAt B x hne).hasFDerivAt + have hchart : complexPolarChart x 0 = x := by ext i; simp [complexPolarChart] + have hc := (show HasFDerivAt (complexRadialTorus B) (fderiv ℝ (complexRadialTorus B) x) + (complexPolarChart x 0) by rw [hchart]; exact hd).comp 0 (complexPolarChart_hasFDerivAt x) + have he : (fderiv ℝ (complexRadialTorus B) x).comp (complexDiagonal x) = + radialAngularLinear (B.map (Int.castRingHom ℝ)) := by + apply hc.unique + rw [complexRadialTorus_chart B x hx hroot] + exact exp_radialAngularLinear_hasFDerivAt _ + have hdet := congrArg (fun L : (n → ℂ) →L[ℝ] (n → ℂ) => L.det) he + change ((fderiv ℝ (complexRadialTorus B) x).toLinearMap.comp + (complexDiagonal x).toLinearMap).det = (radialAngularLinear (B.map (Int.castRingHom ℝ))).toLinearMap.det at hdet + rw [LinearMap.det_comp, complexDiagonal_det x hx, + mul_one, radialAngularLinear_det] at hdet + exact hdet.trans ((Int.castRingHom ℝ).map_det B).symm + +end EilenbergGanea +namespace EilenbergGanea +section CommutativeWords +variable {n A : Type*} [Fintype n] [DecidableEq n] [CommGroup A] +def wordExponents {ι : Type*} [DecidableEq ι] (w : FreeGroup ι) (j : ι) : ℤ := + Multiplicative.toAdd + (FreeGroup.lift (fun k => Multiplicative.ofAdd (if j = k then (1 : ℤ) else 0)) w) + +@[simp] theorem wordExponents_one {ι : Type*} [DecidableEq ι] (j : ι) : wordExponents (1 : FreeGroup ι) j = 0 := by + simp [wordExponents] + +@[simp] theorem wordExponents_of {ι : Type*} [DecidableEq ι] (j k : ι) : + wordExponents (FreeGroup.of k) j = if j = k then 1 else 0 := by + simp [wordExponents] + +@[simp] theorem wordExponents_inv {ι : Type*} [DecidableEq ι] (w : FreeGroup ι) (j : ι) : + wordExponents w⁻¹ j = -wordExponents w j := by + simp [wordExponents] + +@[simp] theorem wordExponents_mul {ι : Type*} [DecidableEq ι] (w v : FreeGroup ι) (j : ι) : + wordExponents (w * v) j = wordExponents w j + wordExponents v j := by + simp [wordExponents] + +theorem freeGroup_lift_commutative (x : n → A) (w : FreeGroup n) : + FreeGroup.lift x w = ∏ j, x j ^ wordExponents w j := by + induction w using FreeGroup.induction_on with + | one => simp + | of i => simp + | inv_of i hi => simp [hi, Finset.prod_inv_distrib] + | mul a b ha hb => simp [ha, hb, zpow_add, Finset.prod_mul_distrib] + +end CommutativeWords +end EilenbergGanea +namespace EilenbergGanea +open Set Filter Topology +open scoped Quaternion ContDiff + +def quaternionCoordinates : ℍ ≃ₗ[ℝ] ℂ × ℂ where + toFun q := (⟨q.re, q.imI⟩, ⟨q.imJ, q.imK⟩) + invFun z := ⟨z.1.re, z.1.im, z.2.re, z.2.im⟩ + left_inv q := by cases q; rfl + right_inv z := by rcases z with ⟨⟨a,b⟩,⟨c,d⟩⟩; rfl + map_add' q r := by ext <;> rfl + map_smul' r q := by apply Prod.ext <;> apply Complex.ext <;> simp + +@[simp] theorem quaternionCoordinates_apply (q : ℍ) : + quaternionCoordinates q = (⟨q.re, q.imI⟩, ⟨q.imJ, q.imK⟩) := rfl + +@[simp] theorem quaternionCoordinates_ofComplex (z : ℂ) : + quaternionCoordinates (Quaternion.ofComplex z) = (z, 0) := by + ext <;> rfl + +@[simp] theorem norm_quaternion_ofComplex (z : ℂ) : ‖Quaternion.ofComplex z‖ = ‖z‖ := by + have h : ‖Quaternion.ofComplex z‖ ^ 2 = ‖z‖ ^ 2 := by + rw [sq, ← Quaternion.normSq_eq_norm_mul_self, ← Complex.normSq_eq_norm_sq] + simp [Quaternion.normSq_def', Complex.normSq_apply, sq] + nlinarith [norm_nonneg (Quaternion.ofComplex z), norm_nonneg z] + +def quaternionTupleCoordinates {m : ℕ} : + (Fin m → ℍ) ≃L[ℝ] ((Fin m → ℂ) × (Fin m → ℂ)) := + (show (Fin m → ℍ) ≃ₗ[ℝ] ((Fin m → ℂ) × (Fin m → ℂ)) from + { toFun := fun q => (fun i => (quaternionCoordinates (q i)).1, + fun i => (quaternionCoordinates (q i)).2) + invFun := fun z i => quaternionCoordinates.symm (z.1 i, z.2 i) + left_inv := by intro q; funext i; exact quaternionCoordinates.symm_apply_apply _ + right_inv := by intro z; ext i <;> simp + map_add' := by intro q r; ext i <;> rfl + map_smul' := by intro r q; ext i <;> simp [quaternionCoordinates] }).toContinuousLinearEquiv + +@[simp] theorem quaternionTupleCoordinates_fixed {m : ℕ} (z : Fin m → ℂ) : + quaternionTupleCoordinates (fun i => Quaternion.ofComplex (z i)) = (z, 0) := by + apply Prod.ext + · funext i; exact congrArg Prod.fst (quaternionCoordinates_ofComplex (z i)) + · funext i; exact congrArg Prod.snd (quaternionCoordinates_ofComplex (z i)) + +@[simp] theorem quaternionTupleCoordinates_symm_fixed {m : ℕ} (z : Fin m → ℂ) : + quaternionTupleCoordinates.symm (z, 0) = fun i => Quaternion.ofComplex (z i) := by + exact quaternionTupleCoordinates.injective (by rw [ContinuousLinearEquiv.apply_symm_apply, quaternionTupleCoordinates_fixed]) + +/-- Circle normalization chosen compatibly with quaternion normalization. -/ +def normalizeCircle (z : ℂ) : Circle := by + classical + exact if hz : z = 0 then 1 else ⟨‖z‖⁻¹ • z, by apply mem_sphere_zero_iff_norm.mpr; simp [hz]⟩ + +theorem normalizeCircle_coe_of_ne_zero {z : ℂ} (hz : z ≠ 0) : + (normalizeCircle z : ℂ) = ‖z‖⁻¹ • z := by simp [normalizeCircle, hz] + +theorem normalizeQuaternion_ofComplex (z : ℂ) : + normalizeQuaternion (Quaternion.ofComplex z) = circleQuaternion (normalizeCircle z) := by + by_cases hz : z = 0 + · subst z + simp [normalizeQuaternion, normalizeCircle] + · have hq : Quaternion.ofComplex z ≠ 0 := by + intro h + have hh := congrArg quaternionCoordinates h + apply hz + have hz0 := congrArg Prod.fst hh + change (quaternionCoordinates (Quaternion.ofComplex z)).1 = (quaternionCoordinates (Quaternion.ofComplex 0)).1 at hz0 + simpa only [quaternionCoordinates_ofComplex] using hz0 + apply Subtype.ext + rw [normalizeQuaternion_coe_of_ne_zero hq, circleQuaternion_coe, + normalizeCircle_coe_of_ne_zero hz, norm_quaternion_ofComplex] + exact (map_smul Quaternion.ofComplex (‖z‖⁻¹) z).symm + +theorem wordMap_circleQuaternion {m : ℕ} (w : Fin m → FreeGroup (Fin m)) (x : Fin m → Circle) : + wordMap w (fun j => circleQuaternion (x j)) = + fun i => circleQuaternion (∏ j, x j ^ exponentMatrix w i j) := by + funext i + have he : FreeGroup.lift (fun j => circleQuaternion (x j)) = + circleQuaternion.comp (FreeGroup.lift x) := by + apply FreeGroup.ext_hom + intro j + simp + change FreeGroup.lift (fun j => circleQuaternion (x j)) (w i) = _ + rw [he, MonoidHom.comp_apply, freeGroup_lift_commutative] + rfl + +theorem radialWordMap_fixed {m : ℕ} (w : Fin m → FreeGroup (Fin m)) (z : Fin m → ℂ) + (hz : ∀ i, z i ≠ 0) : + radialWordMap w (fun i => Quaternion.ofComplex (z i)) = + fun i => Quaternion.ofComplex (complexRadialTorus (exponentMatrix w) z i) := by + funext i + simp only [radialWordMap, normalizeQuaternion_ofComplex, wordMap_circleQuaternion, + circleQuaternion_coe, complexRadialTorus, norm_quaternion_ofComplex] + rw [map_smul] + congr 1 + apply congrArg Quaternion.ofComplex + change Circle.coeHom (∏ j, normalizeCircle (z j) ^ exponentMatrix w i j) = _ + rw [map_prod] + apply Finset.prod_congr rfl + intro j _ + change (normalizeCircle (z j) : ℂ) ^ exponentMatrix w i j = _ + rw [normalizeCircle_coe_of_ne_zero (hz j)] + +theorem quaternionCoordinates_conjComplex (c : ℂ) (q : ℍ) : + quaternionCoordinates (Quaternion.ofComplex c * q * star (Quaternion.ofComplex c)) = + ((Complex.normSq c : ℂ) * (quaternionCoordinates q).1, + c ^ 2 * (quaternionCoordinates q).2) := by + apply Prod.ext <;> apply Complex.ext <;> + simp [quaternionCoordinates_apply, Complex.normSq_apply, pow_two] <;> ring + +@[simp] theorem quaternionCoordinates_conjCircle (c : Circle) (q : ℍ) : + quaternionCoordinates (Quaternion.ofComplex c * q * star (Quaternion.ofComplex c)) = + ((quaternionCoordinates q).1, (c : ℂ) ^ 2 * (quaternionCoordinates q).2) := by + simpa using quaternionCoordinates_conjComplex (c : ℂ) q + +/-- Ambient conjugation, compatible with the group operation on unit quaternions. -/ +def quaternionConjugate (a : SU2) (q : ℍ) : ℍ := (a : ℍ) * q * star (a : ℍ) + +@[simp] theorem quaternionConjugate_norm (a : SU2) (q : ℍ) : + ‖quaternionConjugate a q‖ = ‖q‖ := by + have ha := (quaternion_mem_unitary_iff _).mp a.property + simp [quaternionConjugate, ha] + +@[simp] theorem quaternionConjugate_zero (a : SU2) : quaternionConjugate a 0 = 0 := by + simp [quaternionConjugate] + +@[simp] theorem quaternionConjugate_one (a : SU2) : quaternionConjugate a 1 = 1 := by + simp [quaternionConjugate] + +theorem quaternionConjugate_smul (a : SU2) (r : ℝ) (q : ℍ) : + quaternionConjugate a (r • q) = r • quaternionConjugate a q := by + simp only [quaternionConjugate, mul_smul_comm, smul_mul_assoc] + +@[simp] theorem quaternionConjugate_coe (a q : SU2) : + quaternionConjugate a (q : ℍ) = ((a * q * a⁻¹ : SU2) : ℍ) := rfl + +theorem normalizeQuaternion_conjugate (a : SU2) (q : ℍ) : + normalizeQuaternion (quaternionConjugate a q) = a * normalizeQuaternion q * a⁻¹ := by + by_cases hq : q = 0 + · subst q; simp [normalizeQuaternion] + · have hn : quaternionConjugate a q ≠ 0 := by + intro hz + have he := quaternionConjugate_norm a q + rw [hz, norm_zero, eq_comm, norm_eq_zero] at he + exact hq he + apply Subtype.ext + rw [normalizeQuaternion_coe_of_ne_zero hn, ← quaternionConjugate_coe, + normalizeQuaternion_coe_of_ne_zero hq, quaternionConjugate_smul, quaternionConjugate_norm] + +theorem wordMap_conjugation {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (a : SU2) (x : Fin m → SU2) : + wordMap w (fun i => a * x i * a⁻¹) = fun i => a * wordMap w x i * a⁻¹ := by + have he : FreeGroup.lift (fun i => a * x i * a⁻¹) = + (MulAut.conj a).toMonoidHom.comp (FreeGroup.lift x) := by + apply FreeGroup.ext_hom + intro i + simp + funext i + change FreeGroup.lift (fun i => a * x i * a⁻¹) (w i) = _ + rw [he] + rfl + +theorem radialWordMap_conjugation {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (a : SU2) (x : Fin m → ℍ) : + radialWordMap w (fun i => quaternionConjugate a (x i)) = + fun i => quaternionConjugate a (radialWordMap w x i) := by + funext i + simp only [radialWordMap, quaternionConjugate_norm, normalizeQuaternion_conjugate, + wordMap_conjugation, quaternionConjugate_smul, quaternionConjugate_coe] + +theorem smoothRadialWordMap_conjugation {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (a : SU2) (x : Fin m → ℍ) : + smoothRadialWordMap w (fun i => quaternionConjugate a (x i)) = + fun i => quaternionConjugate a (smoothRadialWordMap w x i) := by + funext i + simp only [smoothRadialWordMap, radialCutoff, quaternionConjugate_norm, + Pi.smul_apply, radialWordMap_conjugation, quaternionConjugate_smul] + +end EilenbergGanea + + +namespace EilenbergGanea + +theorem complex_root_of_unity_norm {p : ℕ} (hp : p ≠ 0) (z : rootsOfUnity p ℂ) : + ‖((z : ℂˣ) : ℂ)‖ = 1 := by + have h := congrArg norm ((mem_rootsOfUnity' p (z : ℂˣ)).mp z.property) + simpa only [norm_pow, norm_one, pow_eq_one_iff_of_nonneg (norm_nonneg _) hp] using h + +theorem rootsOfUnity_isPGroup {p : ℕ} [Fact p.Prime] : IsPGroup p (rootsOfUnity p ℂ) := by + let : NeZero p := ⟨(Fact.out : p.Prime).ne_zero⟩ + rw [isPGroup_iff_card_dvd_pow, Complex.card_rootsOfUnity] + exact ⟨1, by simp⟩ + +theorem rootsOfUnity_exists_nonreal {p : ℕ} (hp : 2 < p) : + ∃ z : rootsOfUnity p ℂ, (((z : ℂˣ) : ℂ)).im ≠ 0 := by + have hp0 : p ≠ 0 := by omega + let ζ := Complex.exp (2 * Real.pi * Complex.I / p) + have hζ : IsPrimitiveRoot ζ p := Complex.isPrimitiveRoot_exp p hp0 + let u : ℂˣ := Units.mk0 ζ (Complex.exp_ne_zero _) + let z : rootsOfUnity p ℂ := ⟨u, (mem_rootsOfUnity' p u).mpr hζ.pow_eq_one⟩ + refine ⟨z, ?_⟩ + intro him + change ζ.im = 0 at him + have hn : ‖ζ‖ = 1 := complex_root_of_unity_norm hp0 z + have hs : ζ.re ^ 2 = 1 := by + have hh := Complex.normSq_eq_norm_sq ζ + simp only [Complex.normSq_apply, him, mul_zero, add_zero, hn, one_pow] at hh + nlinarith + have hpow : ζ ^ 2 = 1 := by + apply Complex.ext <;> simp [pow_two, him] + nlinarith + have hd := hζ.dvd_of_pow_eq_one 2 hpow + have ht := Nat.le_of_dvd (by decide : 0 < 2) hd + omega + +theorem circle_exists_square_root (z : ℂ) (hz : ‖z‖ = 1) : + ∃ c : Circle, (c : ℂ) ^ 2 = z := by + obtain ⟨c, hc⟩ := IsAlgClosed.exists_pow_nat_eq z (by decide : 0 < 2) + have hn : ‖c‖ = 1 := by + have hh := congrArg norm hc + rw [norm_pow, hz] at hh + nlinarith [norm_nonneg c] + exact ⟨⟨c, mem_sphere_zero_iff_norm.mpr hn⟩, hc⟩ + +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped Quaternion ContDiff + +def splitWordMap {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (q : (Fin m → ℂ) × (Fin m → ℂ)) : (Fin m → ℂ) × (Fin m → ℂ) := + quaternionTupleCoordinates (smoothRadialWordMap w (quaternionTupleCoordinates.symm q)) - (1, 0) + +theorem splitWordMap_contDiff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) : + ContDiff ℝ ∞ (splitWordMap w) := + (quaternionTupleCoordinates.contDiff.comp ((smoothRadialWordMap_contDiff w).comp + quaternionTupleCoordinates.symm.contDiff)).sub contDiff_const + +theorem quaternionTupleCoordinates_conjCircle {m : ℕ} (c : Circle) (q : Fin m → ℍ) : + quaternionTupleCoordinates (fun i => quaternionConjugate (circleQuaternion c) (q i)) = + ((quaternionTupleCoordinates q).1, (c : ℂ) ^ 2 • (quaternionTupleCoordinates q).2) := by + apply Prod.ext + · funext i + change (quaternionCoordinates (Quaternion.ofComplex c * q i * star (Quaternion.ofComplex c))).1 = _ + have hh := congrArg Prod.fst (quaternionCoordinates_conjCircle c (q i)) + exact hh + · funext i + change (quaternionCoordinates (Quaternion.ofComplex c * q i * star (Quaternion.ofComplex c))).2 = _ + have hh := congrArg Prod.snd (quaternionCoordinates_conjCircle c (q i)) + exact hh + +theorem splitWordMap_rotation {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (z : ℂ) (hz : ‖z‖ = 1) (q : (Fin m → ℂ) × (Fin m → ℂ)) : + splitWordMap w (q.1, z • q.2) = ((splitWordMap w q).1, z • (splitWordMap w q).2) := by + obtain ⟨c, hc⟩ := circle_exists_square_root z hz + let x := quaternionTupleCoordinates.symm q + have hx : quaternionTupleCoordinates x = q := quaternionTupleCoordinates.apply_symm_apply q + have heq : (q.1, z • q.2) = quaternionTupleCoordinates + (fun i => quaternionConjugate (circleQuaternion c) (x i)) := by + rw [quaternionTupleCoordinates_conjCircle, hc, hx] + have hh := congrArg (fun v : Fin m → ℍ => quaternionTupleCoordinates v) + (smoothRadialWordMap_conjugation w (circleQuaternion c) x) + rw [quaternionTupleCoordinates_conjCircle, hc] at hh + have heq' : quaternionTupleCoordinates.symm (q.1, z • q.2) = + fun i => quaternionConjugate (circleQuaternion c) (x i) := by + rw [heq, ContinuousLinearEquiv.symm_apply_apply] + unfold splitWordMap + rw [heq', hh] + change (_, z • _) - (1, 0) = ((quaternionTupleCoordinates (smoothRadialWordMap w x) - (1, 0)).1, + z • (quaternionTupleCoordinates (smoothRadialWordMap w x) - (1, 0)).2) + simp + +theorem splitWordMap_fixed_eventually {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℂ) (hx : ∀ i, ‖x i‖ = 1) : + (fun z => (splitWordMap w (z, 0)).1) =ᶠ[𝓝 x] + (fun z => complexRadialTorus (exponentMatrix w) z - 1) := by + have hne (i : Fin m) : x i ≠ 0 := by intro h; simpa [h] using hx i + have hz : ∀ᶠ z in 𝓝 x, ∀ i, z i ≠ 0 := Filter.eventually_all.mpr + (fun i => (continuous_apply i).continuousAt.eventually_ne (hne i)) + have hcont : Continuous (fun z : Fin m → ℂ => fun i => Quaternion.ofComplex (z i)) := + continuous_pi (fun i => Quaternion.ofComplex.toLinearMap.continuous_of_finiteDimensional.comp + (continuous_apply i)) + have he := (smoothRadialWordMap_eventuallyEq w (fun i => Quaternion.ofComplex (x i)) + (fun i => (norm_quaternion_ofComplex _).trans (hx i))).comp_tendsto hcont.continuousAt + filter_upwards [hz, he] with z hz he + change smoothRadialWordMap w (fun i => Quaternion.ofComplex (z i)) = + radialWordMap w (fun i => Quaternion.ofComplex (z i)) at he + simp only [splitWordMap, quaternionTupleCoordinates_symm_fixed] + rw [he, radialWordMap_fixed w z hz, quaternionTupleCoordinates_fixed] + rfl + +theorem splitWordMap_fixed_det {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (x : Fin m → ℂ) (hx : ∀ i, ‖x i‖ = 1) + (hr : ∀ i, ∏ j, x j ^ exponentMatrix w i j = 1) : + (fderiv ℝ (fun z => (splitWordMap w (z, 0)).1) x).det = + ((exponentMatrix w).det : ℝ) := by + rw [(splitWordMap_fixed_eventually w x hx).fderiv_eq (𝕜 := ℝ)] + have hne (i : Fin m) : x i ≠ 0 := by intro h; simpa [h] using hx i + rw [((complexRadialTorus_differentiableAt (exponentMatrix w) x hne).hasFDerivAt.sub_const 1).fderiv] + exact complexRadialTorus_det (exponentMatrix w) x hx hr + +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped Quaternion + +theorem splitWordMap_zero_iff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (q : (Fin m → ℂ) × (Fin m → ℂ)) : + splitWordMap w q = 0 ↔ + smoothRadialWordMap w (quaternionTupleCoordinates.symm q) = 1 := by + unfold splitWordMap + rw [sub_eq_zero] + have he : quaternionTupleCoordinates (1 : Fin m → ℍ) = (1, 0) := by + change quaternionTupleCoordinates (fun i : Fin m => Quaternion.ofComplex (1 : ℂ)) = _ + exact quaternionTupleCoordinates_fixed 1 + rw [← he] + exact quaternionTupleCoordinates.injective.eq_iff + +theorem splitWordMap_fixed_zero_iff {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (z : Fin m → ℂ) : splitWordMap w (z, 0) = 0 ↔ + (∀ i, ‖z i‖ = 1) ∧ (∀ i, ∏ j, z j ^ exponentMatrix w i j = 1) := by + rw [splitWordMap_zero_iff, quaternionTupleCoordinates_symm_fixed, + smoothRadialWordMap_eq_one_iff] + constructor + · intro h + have hn : ∀ i, ‖z i‖ = 1 := fun i => (norm_quaternion_ofComplex (z i)).symm.trans + (((radialWordMap_eq_one_iff w _).mp h).1 i) + have hz (i : Fin m) : z i ≠ 0 := by intro h; simpa [h] using hn i + rw [radialWordMap_fixed w z hz] at h + refine ⟨hn, fun i => ?_⟩ + have hh := congrArg (fun v : Fin m → ℍ => (quaternionCoordinates (v i)).1) h + change (quaternionCoordinates (Quaternion.ofComplex _)).1 = (1 : ℂ) at hh + simpa only [quaternionCoordinates_ofComplex, complexRadialTorus, hn, inv_one, one_smul] using hh + · rintro ⟨hn, hr⟩ + have hz (i : Fin m) : z i ≠ 0 := by intro h; simpa [h] using hn i + rw [radialWordMap_fixed w z hz] + funext i + simp [complexRadialTorus, hn, hr] + +@[simp] theorem splitWordMap_fixed_one {m : ℕ} (w : Fin m → FreeGroup (Fin m)) : + splitWordMap w (1, 0) = 0 := by + rw [splitWordMap_fixed_zero_iff] + simp + +end EilenbergGanea + +namespace EilenbergGanea +open Set +section Torus +variable {n : Type*} [Fintype n] [DecidableEq n] +variable {A : Type*} [CommGroup A] +theorem zpow_finite_sum {ι : Type*} (a : A) (s : Finset ι) (e : ι → ℤ) : + a ^ (∑ i ∈ s, e i) = ∏ i ∈ s, a ^ e i := by + classical + induction s using Finset.induction with + | empty => simp + | @insert i s hi ih => simp [hi, ih, zpow_add] + +def torusMap (B : Matrix n n ℤ) (x : n → A) : n → A := + fun i => ∏ j, x j ^ B i j + +omit [DecidableEq n] in +theorem torusMap_comp (B C : Matrix n n ℤ) (x : n → A) : + torusMap B (torusMap C x) = torusMap (B * C) x := by + funext i + simp only [torusMap, Matrix.mul_apply, ← Finset.prod_zpow, zpow_finite_sum, ← zpow_mul] + rw [Finset.prod_comm] + congr 1 + funext j + congr 1 + funext k + rw [Int.mul_comm] + +theorem torusMap_det_one (B : Matrix n n ℤ) (x : n → A) : + torusMap (B.det • (1 : Matrix n n ℤ)) x = fun i => x i ^ B.det := by + funext i + simp [torusMap, Matrix.one_apply] + +theorem torusMap_kernel_pow_det (B : Matrix n n ℤ) (x : n → A) + (hx : torusMap B x = 1) (i : n) : x i ^ B.det = 1 := by + have he := congrArg (fun y => torusMap B.adjugate y i) hx + rw [torusMap_comp, Matrix.adjugate_mul, torusMap_det_one] at he + simpa [torusMap] using he + +theorem circle_finite_pow_roots {d : ℤ} (hd : d ≠ 0) : + {z : Circle | z ^ d = 1}.Finite := by + have hr := Polynomial.finite_setOfPred_isRoot + (Polynomial.X_pow_sub_C_ne_zero (Nat.pos_of_ne_zero (Int.natAbs_ne_zero.mpr hd)) (1 : ℂ)) + apply Set.Finite.of_injOn (f := fun z : Circle => (z : ℂ)) _ + Subtype.val_injective.injOn hr + intro z hz + have hp : z ^ d.natAbs = 1 := pow_natAbs_eq_one.mpr hz + have he : (z : ℂ) ^ d.natAbs = 1 := by + simpa using congrArg (fun t : Circle => (t : ℂ)) hp + simpa [Polynomial.IsRoot.def] using sub_eq_zero.mpr he + +theorem torusMap_finite_kernel (B : Matrix n n ℤ) (hB : B.det ≠ 0) : + {x : n → Circle | torusMap B x = 1}.Finite := by + apply Set.Finite.subset (Set.Finite.pi (fun _ : n => circle_finite_pow_roots hB)) + intro x hx i _ + exact torusMap_kernel_pow_det B x hx i + +end Torus +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology + +theorem splitWordMap_fixed_finite {m : ℕ} (w : Fin m → FreeGroup (Fin m)) + (hB : (exponentMatrix w).det ≠ 0) : + {z : Fin m → ℂ | splitWordMap w (z, 0) = 0}.Finite := by + classical + let e : (Fin m → Circle) → (Fin m → ℂ) := fun x i => (x i : ℂ) + have hf := (torusMap_finite_kernel (exponentMatrix w) hB).image e + apply hf.subset + intro z hz + obtain ⟨hn, hr⟩ := (splitWordMap_fixed_zero_iff w z).mp hz + let x : Fin m → Circle := fun i => ⟨z i, mem_sphere_zero_iff_norm.mpr (hn i)⟩ + refine ⟨x, ?_, rfl⟩ + funext i + apply Subtype.ext + change Circle.coeHom (∏ j, x j ^ exponentMatrix w i j) = (1 : ℂ) + rw [map_prod] + simp only [map_zpow] + exact hr i + +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped ContDiff + +/-- The signed-root noncancellation for the actual ambient quaternion word +map, with no regularity assumed of the original word map. -/ +theorem word_exists_regularization_nonzero_count {m : ℕ} + (w : Fin m → FreeGroup (Fin m)) (hB : (exponentMatrix w).det ≠ 0) + (K : Set ((Fin m → ℂ) × (Fin m → ℂ))) (hK : IsCompact K) + (hKi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q ∈ K, (q.1, z • q.2) ∈ K) + (h1 : (1, 0) ∈ K) + (L : Set ((Fin m → ℂ) × (Fin m → ℂ))) (hL : IsCompact L) (hKL : K ⊆ L) + (ε : ℝ) (hε : 0 < ε) : + ∃ g : ((Fin m → ℂ) × (Fin m → ℂ)) → ((Fin m → ℂ) × (Fin m → ℂ)), + ContDiff ℝ ∞ g ∧ (∀ q ∈ L, ‖g q - splitWordMap w q‖ < ε) ∧ + ∃ s : Finset ((Fin m → ℂ) × (Fin m → ℂ)), + (∀ q, q ∈ s ↔ q ∈ K ∧ g q = 0) ∧ + (∀ q ∈ s, (fderiv ℝ g q).det ≠ 0) ∧ + (∑ q ∈ s, (if 0 < (fderiv ℝ g q).det then 1 else -1 : ℝ)) ≠ 0 := by + classical + let S := (splitWordMap_fixed_finite w hB).toFinset + have hS (z) : z ∈ S ↔ splitWordMap w (z, 0) = 0 := (splitWordMap_fixed_finite w hB).mem_toFinset + obtain ⟨p, hpbound, hp⟩ := Nat.exists_infinite_primes (S.card + 3) + let : Fact p.Prime := ⟨hp⟩ + let : NeZero p := ⟨hp.ne_zero⟩ + let : Fintype (rootsOfUnity p ℂ) := Fintype.ofFinite _ + obtain ⟨a₀, ha₀⟩ := rootsOfUnity_exists_nonreal (p := p) (by omega) + let χ : rootsOfUnity p ℂ →* ℂˣ := (rootsOfUnity p ℂ).subtype + apply exists_regularization_nonzero_count (rootsOfUnity_isPGroup (p := p)) χ + Subtype.val_injective a₀ ha₀ (splitWordMap w) (splitWordMap_contDiff w) + (fun a q => splitWordMap_rotation w (χ a : ℂ) (complex_root_of_unity_norm hp.ne_zero a) q) + K hK (fun a q hq => hKi (χ a : ℂ) (complex_root_of_unity_norm hp.ne_zero a) q hq) + L hL hKL S (fun z _ hz => (hS z).mpr hz) ⟨1, h1, splitWordMap_fixed_one w⟩ (by omega) + ((exponentMatrix w).det : ℝ) (by exact_mod_cast hB) _ ε hε + intro z hz + obtain ⟨hn, hr⟩ := (splitWordMap_fixed_zero_iff w z).mp ((hS z).mp hz) + exact splitWordMap_fixed_det w z hn hr + +end EilenbergGanea + +end + +end OAI diff --git a/lean/OAI/Topology/EilenbergGanea/WordEquations.lean b/lean/OAI/Topology/EilenbergGanea/WordEquations.lean index 01e9a4f2a246d67e005b437350150d1b282e9f8e..aaaf77fa5f5888254a1417616c3b4c1668dbf6e2 100644 --- a/lean/OAI/Topology/EilenbergGanea/WordEquations.lean +++ b/lean/OAI/Topology/EilenbergGanea/WordEquations.lean @@ -1,388 +1,388 @@ -import OAI.Topology.EilenbergGanea.IntegralDegree -import OAI.Topology.EilenbergGanea.UnitaryWords - -namespace OAI - -noncomputable section - -open Classical Set Filter Topology MeasureTheory -open scoped Quaternion ContDiff - -namespace EilenbergGanea -open Set Filter Topology -open scoped ContDiff - -/-- A concrete sublevel version of localized degree. The only root isolation -conditions are a uniform radial bound and exclusion of the threshold; no -regularity of any root or of the sublevel boundary is assumed. -/ -theorem localized_word_root_sublevel {m : ℕ} - (w : Fin m → FreeGroup (Fin m)) (hB : (exponentMatrix w).det ≠ 0) - (F : ℝ × ((Fin m → ℂ) × (Fin m → ℂ)) → ((Fin m → ℂ) × (Fin m → ℂ))) - (hF : ContDiff ℝ 2 F) (hF0 : ∀ q, F (0, q) = splitWordMap w q) - (h : ℝ × ((Fin m → ℂ) × (Fin m → ℂ)) → ℝ) (hh : Continuous h) - (δ R : ℝ) (hR : ‖((1 : Fin m → ℂ), (0 : Fin m → ℂ))‖ < R) - (h1 : h (0, (1, 0)) < δ) - (hi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q, h (0, (q.1, z • q.2)) = h (0, q)) - (hbound : ∀ q, q.1 ∈ Icc (0 : ℝ) 1 → F q = 0 → ‖q.2‖ < R) - (hiso : ∀ q, q.1 ∈ Icc (0 : ℝ) 1 → F q = 0 → h q ≠ δ) : - ∃ x, F (1, x) = 0 ∧ h (1, x) < δ := by - let E := (Fin m → ℂ) × (Fin m → ℂ) - let C : Set (ℝ × E) := {q | ‖q.2‖ < R ∧ h q < δ} - have hC : IsOpen C := (isOpen_lt continuous_snd.norm continuous_const).inter - (isOpen_lt hh continuous_const) - have hcl : closure C ⊆ {q | ‖q.2‖ ≤ R ∧ h q ≤ δ} := - closure_minimal (fun _ hq => ⟨hq.1.le, hq.2.le⟩) - ((isClosed_le continuous_snd.norm continuous_const).inter (isClosed_le hh continuous_const)) - have hslice (t : ℝ) : Bornology.IsBounded {x : E | (t, x) ∈ C} := by - apply (Metric.isBounded_closedBall (x := (0 : E)) (r := R)).subset - intro x hx - exact Metric.mem_closedBall.mpr (by simpa only [dist_zero_right] using hx.1.le) - have hBcompact : IsCompact {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1} := by - apply (isCompact_Icc.prod (isCompact_closedBall (0 : E) R)).of_isClosed_subset - (isClosed_frontier.inter (isClosed_Icc.preimage continuous_fst)) - intro q hq - refine ⟨hq.2, ?_⟩ - exact Metric.mem_closedBall.mpr (by simpa only [dist_zero_right] using (hcl (frontier_subset_closure hq.1)).1) - have hCb : Bornology.IsBounded {x : E | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C} := by - apply (Metric.isBounded_closedBall (x := (0 : E)) (r := R)).subset - rintro x ⟨t, _, hx⟩ - exact Metric.mem_closedBall.mpr (by simpa only [dist_zero_right] using hx.1.le) - have hUi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q ∈ closure {x : E | (0, x) ∈ C}, - (q.1, z • q.2) ∈ closure {x : E | (0, x) ∈ C} := by - intro z hz - have hmaps : MapsTo (fun q : E => (q.1, z • q.2)) {x | (0, x) ∈ C} {x | (0, x) ∈ C} := by - intro q hq - refine ⟨?_, ?_⟩ - · have hn : ‖(q.1, z • q.2)‖ = ‖q‖ := by - change max ‖q.1‖ ‖z • q.2‖ = max ‖q.1‖ ‖q.2‖ - rw [norm_smul, hz, one_mul] - simpa only [hn] using hq.1 - · simpa only [hi z hz q] using hq.2 - have hr : Continuous (fun q : E => (q.1, z • q.2)) := by fun_prop - exact hmaps.closure_of_continuousOn hr.continuousOn - have hb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → F q ≠ 0 := by - intro q hq ht hf - have hhδ : h q < δ := lt_of_le_of_ne (hcl (frontier_subset_closure hq)).2 (hiso q ht hf) - have hqC : q ∈ C := ⟨hbound q ht hf, hhδ⟩ - exact hq.2 (by simpa only [hC.interior_eq] using hqC) - obtain ⟨x, hx, he⟩ := localized_word_root_persists_moving w hB F hF hF0 C hC - (hslice 0).isCompact_closure (hslice 1).isCompact_closure hBcompact hCb hUi ⟨hR, h1⟩ hb - exact ⟨x, he, hx.2⟩ -end EilenbergGanea -namespace EilenbergGanea -open Set Filter Topology -open scoped Quaternion ContDiff - -/-- Word evaluation with a fixed alphabet of coefficient letters and a finite -alphabet of unknowns. Coefficients may vary smoothly with a real parameter. -/ -def coefficientWordMap {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (q : ℝ × (Fin m → SU2)) : Fin d → SU2 := - fun i => FreeGroup.lift (Sum.elim (a q.1) q.2) (w i) - -def eraseCoefficients {ι : Type*} {m : ℕ} : FreeGroup (ι ⊕ Fin m) →* FreeGroup (Fin m) := - FreeGroup.lift (Sum.elim (fun _ => 1) FreeGroup.of) - -theorem coefficientWordMap_initial {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (ha : ∀ i, a 0 i = 1) (x : Fin m → SU2) : - coefficientWordMap w a (0, x) = fun i => FreeGroup.lift x (eraseCoefficients (w i)) := by - have he : FreeGroup.lift (Sum.elim (a 0) x) = (FreeGroup.lift x).comp eraseCoefficients := by - apply FreeGroup.ext_hom - intro i - cases i with - | inl i => simp [eraseCoefficients, ha] - | inr i => simp [eraseCoefficients] - funext i - exact congrArg (fun f : FreeGroup (ι ⊕ Fin m) →* SU2 => f (w i)) he - -/-- The same conjugation-invariant radial cutoff handles arbitrary coefficient -words, and does not create roots on the coordinate hyperplanes. -/ -theorem radialCutoff_family_smooth {m : ℕ} {V : Type*} - [NormedAddCommGroup V] [NormedSpace ℝ V] - (f : ℝ × (Fin m → ℍ) → V) - (hf : ∀ q, (∀ i, q.2 i ≠ 0) → ContDiffAt ℝ ∞ f q) : - ContDiff ℝ ∞ (fun q => radialCutoff q.2 • f q) := by - rw [contDiff_iff_contDiffAt] - intro q - by_cases hq : ∀ i, q.2 i ≠ 0 - · exact (radialCutoff_contDiff.comp contDiff_snd).contDiffAt.smul (hf q hq) - · push Not at hq - obtain ⟨i, hi⟩ := hq - apply (contDiffAt_const : ContDiffAt ℝ ∞ (fun _ : ℝ × (Fin m → ℍ) => (0 : V)) q).congr_of_eventuallyEq - have he : ∀ᶠ p in 𝓝 q, radialCutoff p.2 = 0 := - continuous_snd.continuousAt (radialCutoff_eventually_zero q.2 i hi) - filter_upwards [he] with p hp - simp only [hp, zero_smul] - -theorem coefficientWordMap_normalized_smoothAt {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (ha : ∀ i, ContDiff ℝ ∞ (fun t => (a t i : ℍ))) - (q : ℝ × (Fin m → ℍ)) (hq : ∀ i, q.2 i ≠ 0) : - ContDiffAt ℝ ∞ (fun p : ℝ × (Fin m → ℍ) => - fun i => (coefficientWordMap w a (p.1, fun j => normalizeQuaternion (p.2 j)) i : ℍ)) q := by - apply contDiffAt_pi.mpr - intro i - refine freeGroup_lift_coe_contDiffAt (w i) q - (fun parameter => Sum.elim (a parameter.1) - (fun index => normalizeQuaternion (parameter.2 index))) ?_ - intro j - cases j with - | inl j => exact ((ha j).comp contDiff_fst).contDiffAt - | inr j => - change ContDiffAt ℝ ∞ (fun p : ℝ × (Fin m → ℍ) => (normalizeQuaternion (p.2 j) : ℍ)) q - exact (normalizeQuaternion_coe_contDiffAt (hq j)).comp (f := fun p : ℝ × (Fin m → ℍ) => p.2 j) q - ((contDiff_apply ℝ ℍ j).comp contDiff_snd).contDiffAt - -def radialCoefficientWordMap {ι : Type*} {m : ℕ} - (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (q : ℝ × (Fin m → ℍ)) : Fin m → ℍ := - fun i => ‖q.2 i‖ • (coefficientWordMap w a (q.1, fun j => normalizeQuaternion (q.2 j)) i : ℍ) - -def smoothRadialCoefficientWordMap {ι : Type*} {m : ℕ} - (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (q : ℝ × (Fin m → ℍ)) : Fin m → ℍ := - radialCutoff q.2 • radialCoefficientWordMap w a q - -theorem smoothRadialCoefficientWordMap_smooth {ι : Type*} {m : ℕ} - (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (ha : ∀ i, ContDiff ℝ ∞ (fun t => (a t i : ℍ))) : - ContDiff ℝ ∞ (smoothRadialCoefficientWordMap w a) := by - apply radialCutoff_family_smooth - intro q hq - apply contDiffAt_pi.mpr - intro i - exact (((contDiff_apply ℝ ℍ i).comp contDiff_snd).contDiffAt.norm ℝ (hq i)).smul - ((contDiffAt_pi.mp (coefficientWordMap_normalized_smoothAt w a ha q hq)) i) - -@[simp] theorem radialCoefficientWordMap_norm {ι : Type*} {m : ℕ} - (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (q : ℝ × (Fin m → ℍ)) (i : Fin m) : - ‖radialCoefficientWordMap w a q i‖ = ‖q.2 i‖ := by - have h := (quaternion_mem_unitary_iff _).mp - (coefficientWordMap w a (q.1, fun j => normalizeQuaternion (q.2 j)) i).property - simp [radialCoefficientWordMap, norm_smul, h] - -theorem radialCoefficientWordMap_eq_one_iff {ι : Type*} {m : ℕ} - (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (q : ℝ × (Fin m → ℍ)) : radialCoefficientWordMap w a q = 1 ↔ - (∀ i, ‖q.2 i‖ = 1) ∧ coefficientWordMap w a - (q.1, fun j => normalizeQuaternion (q.2 j)) = 1 := by - constructor - · intro h - have hn (i : Fin m) : ‖q.2 i‖ = 1 := by - have he := congrArg (fun y : Fin m → ℍ => ‖y i‖) h - simpa only [radialCoefficientWordMap_norm, Pi.one_apply, norm_one] using he - refine ⟨hn, ?_⟩ - funext i - apply Subtype.ext - have he := congrFun h i - simpa [radialCoefficientWordMap, hn] using he - · rintro ⟨hn, hw⟩ - funext i - simp [radialCoefficientWordMap, hn, hw] - -theorem smoothRadialCoefficientWordMap_eq_one_iff {ι : Type*} {m : ℕ} - (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (q : ℝ × (Fin m → ℍ)) : smoothRadialCoefficientWordMap w a q = 1 ↔ - (∀ i, ‖q.2 i‖ = 1) ∧ coefficientWordMap w a - (q.1, fun j => normalizeQuaternion (q.2 j)) = 1 := by - rw [← radialCoefficientWordMap_eq_one_iff] - constructor - · intro h - have hn (i : Fin m) : radialCutoff q.2 * ‖q.2 i‖ = 1 := by - have he := congrArg (fun y : Fin m → ℍ => ‖y i‖) h - simpa only [smoothRadialCoefficientWordMap, Pi.smul_apply, norm_smul, Real.norm_eq_abs, - abs_of_nonneg (radialCutoff_nonneg q.2), radialCoefficientWordMap_norm, Pi.one_apply, norm_one] using he - have hlarge (i : Fin m) : 1 ≤ ‖q.2 i‖ := by - have hle := mul_le_mul_of_nonneg_right (radialCutoff_le_one q.2) (norm_nonneg (q.2 i)) - rw [hn i, one_mul] at hle - exact hle - simpa only [smoothRadialCoefficientWordMap, radialCutoff_eq_one q.2 hlarge, one_smul] using h - · intro h - have hn := (radialCoefficientWordMap_eq_one_iff w a q).mp h - simp only [smoothRadialCoefficientWordMap, radialCutoff_eq_one q.2 (fun i => (hn.1 i).ge), one_smul, h] - -theorem smoothRadialCoefficientWordMap_initial {ι : Type*} {m : ℕ} - (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (ha : ∀ i, a 0 i = 1) (x : Fin m → ℍ) : - smoothRadialCoefficientWordMap w a (0, x) = - smoothRadialWordMap (fun i => eraseCoefficients (w i)) x := by - unfold smoothRadialCoefficientWordMap smoothRadialWordMap - congr 1 - funext i - dsimp only [radialCoefficientWordMap, radialWordMap] - rw [coefficientWordMap_initial w a ha] - rfl -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped Quaternion ContDiff - -def cutoffCoefficientProducts {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (q : ℝ × (Fin m → ℍ)) : Fin d → ℍ := - radialCutoff q.2 • fun i => - (coefficientWordMap w a (q.1, fun j => normalizeQuaternion (q.2 j)) i : ℍ) - -theorem cutoffCoefficientProducts_smooth {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (ha : ∀ i, ContDiff ℝ ∞ (fun t => (a t i : ℍ))) : - ContDiff ℝ ∞ (cutoffCoefficientProducts w a) := - radialCutoff_family_smooth _ (coefficientWordMap_normalized_smoothAt w a ha) - -theorem cutoffCoefficientProducts_unitary {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (t : ℝ) (x : Fin m → SU2) : - cutoffCoefficientProducts w a (t, fun i => (x i : ℍ)) = - fun i => (coefficientWordMap w a (t, x) i : ℍ) := by - have hn (i : Fin m) : ‖(x i : ℍ)‖ = 1 := (quaternion_mem_unitary_iff _).mp (x i).property - simp only [cutoffCoefficientProducts, radialCutoff_eq_one _ (fun i => (hn i).ge), one_smul, - normalizeQuaternion_unitary] -end EilenbergGanea - -namespace EilenbergGanea -open Set Filter Topology -open scoped Quaternion ContDiff - - theorem quaternionConjugate_sub (a : SU2) (q r : ℍ) : - quaternionConjugate a (q - r) = quaternionConjugate a q - quaternionConjugate a r := by - simp only [quaternionConjugate, mul_sub, sub_mul] - - theorem coefficientWordMap_initial_conjugate {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (ha : ∀ i, a 0 i = 1) (b : SU2) (x : Fin m → SU2) : - coefficientWordMap w a (0, fun i => b * x i * b⁻¹) = - fun i => b * coefficientWordMap w a (0, x) i * b⁻¹ := by - rw [coefficientWordMap_initial w a ha, coefficientWordMap_initial w a ha] - have he : FreeGroup.lift (fun i => b * x i * b⁻¹) = - (MulAut.conj b).toMonoidHom.comp (FreeGroup.lift x) := by - apply FreeGroup.ext_hom - intro i - simp - funext i - rw [he] - rfl - - theorem cutoffCoefficientProducts_initial_conjugate {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (ha : ∀ i, a 0 i = 1) (b : SU2) (x : Fin m → ℍ) : - cutoffCoefficientProducts w a (0, fun i => quaternionConjugate b (x i)) = - fun i => quaternionConjugate b (cutoffCoefficientProducts w a (0, x) i) := by - funext i - simp only [cutoffCoefficientProducts, radialCutoff, quaternionConjugate_norm, - normalizeQuaternion_conjugate, coefficientWordMap_initial_conjugate w a ha, - Pi.smul_apply, quaternionConjugate_smul, quaternionConjugate_coe] - - theorem cutoffCoefficientProducts_initial_size_invariant {ι : Type*} {m d : ℕ} - (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) - (ha : ∀ i, a 0 i = 1) (b : SU2) (x : Fin m → ℍ) : - ‖cutoffCoefficientProducts w a (0, fun i => quaternionConjugate b (x i)) - 1‖ = - ‖cutoffCoefficientProducts w a (0, x) - 1‖ := by - rw [cutoffCoefficientProducts_initial_conjugate w a ha] - have hn (i : Fin d) : ‖quaternionConjugate b (cutoffCoefficientProducts w a (0, x) i) - 1‖ = - ‖cutoffCoefficientProducts w a (0, x) i - 1‖ := by - calc - _ = ‖quaternionConjugate b (cutoffCoefficientProducts w a (0, x) i - 1)‖ := by rw [quaternionConjugate_sub, quaternionConjugate_one] - _ = _ := quaternionConjugate_norm _ _ - have hnn (i : Fin d) : ‖quaternionConjugate b (cutoffCoefficientProducts w a (0, x) i) - 1‖₊ = - ‖cutoffCoefficientProducts w a (0, x) i - 1‖₊ := NNReal.eq (hn i) - simp only [Pi.norm_def, Pi.sub_apply, Pi.one_apply, hnn] - -/-- Finite-word-system solvability with an actual distinguished-word sublevel -isolator. Arbitrarily singular initial word roots are allowed. -/ -theorem coefficient_word_sublevel_solvable {ι : Type*} {m d : ℕ} - (w : Fin m → FreeGroup (ι ⊕ Fin m)) (ρ : Fin d → FreeGroup (ι ⊕ Fin m)) - (a : ℝ → ι → SU2) (ha : ∀ i, ContDiff ℝ ∞ (fun t => (a t i : ℍ))) - (ha0 : ∀ i, a 0 i = 1) - (hB : (exponentMatrix (fun i => eraseCoefficients (w i))).det ≠ 0) - (δ : ℝ) (hδ : 0 < δ) - (hiso : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x : Fin m → SU2, - coefficientWordMap w a (t, x) = 1 → - ‖(fun i => (coefficientWordMap ρ a (t, x) i : ℍ)) - 1‖ ≠ δ) : - ∃ x : Fin m → SU2, coefficientWordMap w a (1, x) = 1 ∧ - ‖(fun i => (coefficientWordMap ρ a (1, x) i : ℍ)) - 1‖ < δ := by - let E := (Fin m → ℂ) × (Fin m → ℂ) - let e : (Fin m → ℍ) ≃L[ℝ] E := quaternionTupleCoordinates - let H : ℝ × E → ℝ × (Fin m → ℍ) := fun q => (q.1, e.symm q.2) - have hH : ContDiff ℝ ∞ H := contDiff_fst.prodMk (e.symm.contDiff.comp contDiff_snd) - let F : ℝ × E → E := fun q => e (smoothRadialCoefficientWordMap w a (H q)) - (1, 0) - let h : ℝ × E → ℝ := fun q => ‖cutoffCoefficientProducts ρ a (H q) - 1‖ - have hF : ContDiff ℝ 2 F := contDiff_infty.mp - ((e.contDiff.comp ((smoothRadialCoefficientWordMap_smooth w a ha).comp hH)).sub contDiff_const) 2 - have hF0 : ∀ q, F (0, q) = splitWordMap (fun i => eraseCoefficients (w i)) q := by - intro q - dsimp only [F, H] - rw [smoothRadialCoefficientWordMap_initial w a ha0] - rfl - have hh : Continuous h := (((cutoffCoefficientProducts_smooth ρ a ha).comp hH).continuous.sub continuous_const).norm - have he1 : e (1 : Fin m → ℍ) = (1, 0) := by - change quaternionTupleCoordinates - (fun _ : Fin m => Quaternion.ofComplex (1 : ℂ)) = _ - exact quaternionTupleCoordinates_fixed 1 - have hroot (q : ℝ × E) (hq : F q = 0) : - (∀ i, ‖e.symm q.2 i‖ = 1) ∧ - coefficientWordMap w a (q.1, fun i => normalizeQuaternion (e.symm q.2 i)) = 1 := by - apply (smoothRadialCoefficientWordMap_eq_one_iff w a (H q)).mp - apply e.injective - rw [he1] - exact sub_eq_zero.mp hq - have hnorm (q : ℝ × E) (hq : F q = 0) : ‖q.2‖ ≤ ‖e.toContinuousLinearMap‖ := by - have hle : ‖e.symm q.2‖ ≤ 1 := (pi_norm_le_iff_of_nonneg (by positivity)).mpr - (fun i => (hroot q hq).1 i |>.le) - calc - ‖q.2‖ = ‖e (e.symm q.2)‖ := by rw [e.apply_symm_apply] - _ ≤ ‖e.toContinuousLinearMap‖ * ‖e.symm q.2‖ := e.toContinuousLinearMap.le_opNorm _ - _ ≤ ‖e.toContinuousLinearMap‖ := mul_le_of_le_one_right (norm_nonneg e.toContinuousLinearMap) hle - have hunit (q : ℝ × E) (hq : F q = 0) : - (fun i => ((normalizeQuaternion (e.symm q.2 i) : SU2) : ℍ)) = e.symm q.2 := by - funext i - have hn := (hroot q hq).1 i - rw [normalizeQuaternion_coe_of_ne_zero (by intro hz; simp [hz] at hn), hn, inv_one, one_smul] - have hsizeroot (q : ℝ × E) (hq : F q = 0) : - h q = ‖(fun i => (coefficientWordMap ρ a - (q.1, fun j => normalizeQuaternion (e.symm q.2 j)) i : ℍ)) - 1‖ := by - dsimp only [h, H] - conv_lhs => rw [← hunit q hq, cutoffCoefficientProducts_unitary] - have hi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q : E, h (0, (q.1, z • q.2)) = h (0, q) := by - intro z hz q - obtain ⟨c, hc⟩ := circle_exists_square_root z hz - have heq : e.symm (q.1, z • q.2) = - fun i => quaternionConjugate (circleQuaternion c) (e.symm q i) := by - apply e.injective - rw [e.apply_symm_apply, quaternionTupleCoordinates_conjCircle, hc, e.apply_symm_apply] - dsimp only [h, H] - rw [heq] - exact cutoffCoefficientProducts_initial_size_invariant ρ a ha0 _ _ - have h1 : h (0, (1, 0)) < δ := by - have he : e.symm (1, 0) = 1 := by rw [← he1, e.symm_apply_apply] - have hp : coefficientWordMap ρ a (0, (1 : Fin m → SU2)) = 1 := by - rw [coefficientWordMap_initial ρ a ha0] - have hl : FreeGroup.lift (1 : Fin m → SU2) = 1 := by - apply FreeGroup.ext_hom - intro i - simp - funext i - rw [hl] - rfl - dsimp only [h, H] - rw [he] - have hco : (1 : Fin m → ℍ) = fun i => ((1 : Fin m → SU2) i : ℍ) := rfl - rw [hco, cutoffCoefficientProducts_unitary, hp] - change ‖(1 : Fin d → ℍ) - 1‖ < δ - simpa only [sub_self, norm_zero] using hδ - let R : ℝ := ‖e.toContinuousLinearMap‖ + ‖((1 : Fin m → ℂ), (0 : Fin m → ℂ))‖ + 1 - obtain ⟨q, hq, hhq⟩ := localized_word_root_sublevel - (fun i => eraseCoefficients (w i)) hB F hF hF0 h hh δ R - (by dsimp only [R]; have hn := norm_nonneg e.toContinuousLinearMap; linarith) h1 hi - (fun q _ hq => by dsimp only [R]; have hn := hnorm q hq; have hp := norm_nonneg ((1 : Fin m → ℂ), (0 : Fin m → ℂ)); linarith) - (fun q ht hq => by rw [hsizeroot q hq]; exact hiso q.1 ht _ (hroot q hq).2) - refine ⟨fun i => normalizeQuaternion (e.symm q i), (hroot (1, q) hq).2, ?_⟩ - simpa only [hsizeroot (1, q) hq] using hhq -end EilenbergGanea - - -end - -end OAI +import OAI.Topology.EilenbergGanea.IntegralDegree +import OAI.Topology.EilenbergGanea.UnitaryWords + +namespace OAI + +noncomputable section + +open Classical Set Filter Topology MeasureTheory +open scoped Quaternion ContDiff + +namespace EilenbergGanea +open Set Filter Topology +open scoped ContDiff + +/-- A concrete sublevel version of localized degree. The only root isolation +conditions are a uniform radial bound and exclusion of the threshold; no +regularity of any root or of the sublevel boundary is assumed. -/ +theorem localized_word_root_sublevel {m : ℕ} + (w : Fin m → FreeGroup (Fin m)) (hB : (exponentMatrix w).det ≠ 0) + (F : ℝ × ((Fin m → ℂ) × (Fin m → ℂ)) → ((Fin m → ℂ) × (Fin m → ℂ))) + (hF : ContDiff ℝ 2 F) (hF0 : ∀ q, F (0, q) = splitWordMap w q) + (h : ℝ × ((Fin m → ℂ) × (Fin m → ℂ)) → ℝ) (hh : Continuous h) + (δ R : ℝ) (hR : ‖((1 : Fin m → ℂ), (0 : Fin m → ℂ))‖ < R) + (h1 : h (0, (1, 0)) < δ) + (hi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q, h (0, (q.1, z • q.2)) = h (0, q)) + (hbound : ∀ q, q.1 ∈ Icc (0 : ℝ) 1 → F q = 0 → ‖q.2‖ < R) + (hiso : ∀ q, q.1 ∈ Icc (0 : ℝ) 1 → F q = 0 → h q ≠ δ) : + ∃ x, F (1, x) = 0 ∧ h (1, x) < δ := by + let E := (Fin m → ℂ) × (Fin m → ℂ) + let C : Set (ℝ × E) := {q | ‖q.2‖ < R ∧ h q < δ} + have hC : IsOpen C := (isOpen_lt continuous_snd.norm continuous_const).inter + (isOpen_lt hh continuous_const) + have hcl : closure C ⊆ {q | ‖q.2‖ ≤ R ∧ h q ≤ δ} := + closure_minimal (fun _ hq => ⟨hq.1.le, hq.2.le⟩) + ((isClosed_le continuous_snd.norm continuous_const).inter (isClosed_le hh continuous_const)) + have hslice (t : ℝ) : Bornology.IsBounded {x : E | (t, x) ∈ C} := by + apply (Metric.isBounded_closedBall (x := (0 : E)) (r := R)).subset + intro x hx + exact Metric.mem_closedBall.mpr (by simpa only [dist_zero_right] using hx.1.le) + have hBcompact : IsCompact {q : ℝ × E | q ∈ frontier C ∧ q.1 ∈ Icc (0 : ℝ) 1} := by + apply (isCompact_Icc.prod (isCompact_closedBall (0 : E) R)).of_isClosed_subset + (isClosed_frontier.inter (isClosed_Icc.preimage continuous_fst)) + intro q hq + refine ⟨hq.2, ?_⟩ + exact Metric.mem_closedBall.mpr (by simpa only [dist_zero_right] using (hcl (frontier_subset_closure hq.1)).1) + have hCb : Bornology.IsBounded {x : E | ∃ t ∈ Icc (0 : ℝ) 1, (t, x) ∈ C} := by + apply (Metric.isBounded_closedBall (x := (0 : E)) (r := R)).subset + rintro x ⟨t, _, hx⟩ + exact Metric.mem_closedBall.mpr (by simpa only [dist_zero_right] using hx.1.le) + have hUi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q ∈ closure {x : E | (0, x) ∈ C}, + (q.1, z • q.2) ∈ closure {x : E | (0, x) ∈ C} := by + intro z hz + have hmaps : MapsTo (fun q : E => (q.1, z • q.2)) {x | (0, x) ∈ C} {x | (0, x) ∈ C} := by + intro q hq + refine ⟨?_, ?_⟩ + · have hn : ‖(q.1, z • q.2)‖ = ‖q‖ := by + change max ‖q.1‖ ‖z • q.2‖ = max ‖q.1‖ ‖q.2‖ + rw [norm_smul, hz, one_mul] + simpa only [hn] using hq.1 + · simpa only [hi z hz q] using hq.2 + have hr : Continuous (fun q : E => (q.1, z • q.2)) := by fun_prop + exact hmaps.closure_of_continuousOn hr.continuousOn + have hb : ∀ q ∈ frontier C, q.1 ∈ Icc (0 : ℝ) 1 → F q ≠ 0 := by + intro q hq ht hf + have hhδ : h q < δ := lt_of_le_of_ne (hcl (frontier_subset_closure hq)).2 (hiso q ht hf) + have hqC : q ∈ C := ⟨hbound q ht hf, hhδ⟩ + exact hq.2 (by simpa only [hC.interior_eq] using hqC) + obtain ⟨x, hx, he⟩ := localized_word_root_persists_moving w hB F hF hF0 C hC + (hslice 0).isCompact_closure (hslice 1).isCompact_closure hBcompact hCb hUi ⟨hR, h1⟩ hb + exact ⟨x, he, hx.2⟩ +end EilenbergGanea +namespace EilenbergGanea +open Set Filter Topology +open scoped Quaternion ContDiff + +/-- Word evaluation with a fixed alphabet of coefficient letters and a finite +alphabet of unknowns. Coefficients may vary smoothly with a real parameter. -/ +def coefficientWordMap {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (q : ℝ × (Fin m → SU2)) : Fin d → SU2 := + fun i => FreeGroup.lift (Sum.elim (a q.1) q.2) (w i) + +def eraseCoefficients {ι : Type*} {m : ℕ} : FreeGroup (ι ⊕ Fin m) →* FreeGroup (Fin m) := + FreeGroup.lift (Sum.elim (fun _ => 1) FreeGroup.of) + +theorem coefficientWordMap_initial {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (ha : ∀ i, a 0 i = 1) (x : Fin m → SU2) : + coefficientWordMap w a (0, x) = fun i => FreeGroup.lift x (eraseCoefficients (w i)) := by + have he : FreeGroup.lift (Sum.elim (a 0) x) = (FreeGroup.lift x).comp eraseCoefficients := by + apply FreeGroup.ext_hom + intro i + cases i with + | inl i => simp [eraseCoefficients, ha] + | inr i => simp [eraseCoefficients] + funext i + exact congrArg (fun f : FreeGroup (ι ⊕ Fin m) →* SU2 => f (w i)) he + +/-- The same conjugation-invariant radial cutoff handles arbitrary coefficient +words, and does not create roots on the coordinate hyperplanes. -/ +theorem radialCutoff_family_smooth {m : ℕ} {V : Type*} + [NormedAddCommGroup V] [NormedSpace ℝ V] + (f : ℝ × (Fin m → ℍ) → V) + (hf : ∀ q, (∀ i, q.2 i ≠ 0) → ContDiffAt ℝ ∞ f q) : + ContDiff ℝ ∞ (fun q => radialCutoff q.2 • f q) := by + rw [contDiff_iff_contDiffAt] + intro q + by_cases hq : ∀ i, q.2 i ≠ 0 + · exact (radialCutoff_contDiff.comp contDiff_snd).contDiffAt.smul (hf q hq) + · push Not at hq + obtain ⟨i, hi⟩ := hq + apply (contDiffAt_const : ContDiffAt ℝ ∞ (fun _ : ℝ × (Fin m → ℍ) => (0 : V)) q).congr_of_eventuallyEq + have he : ∀ᶠ p in 𝓝 q, radialCutoff p.2 = 0 := + continuous_snd.continuousAt (radialCutoff_eventually_zero q.2 i hi) + filter_upwards [he] with p hp + simp only [hp, zero_smul] + +theorem coefficientWordMap_normalized_smoothAt {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (ha : ∀ i, ContDiff ℝ ∞ (fun t => (a t i : ℍ))) + (q : ℝ × (Fin m → ℍ)) (hq : ∀ i, q.2 i ≠ 0) : + ContDiffAt ℝ ∞ (fun p : ℝ × (Fin m → ℍ) => + fun i => (coefficientWordMap w a (p.1, fun j => normalizeQuaternion (p.2 j)) i : ℍ)) q := by + apply contDiffAt_pi.mpr + intro i + refine freeGroup_lift_coe_contDiffAt (w i) q + (fun parameter => Sum.elim (a parameter.1) + (fun index => normalizeQuaternion (parameter.2 index))) ?_ + intro j + cases j with + | inl j => exact ((ha j).comp contDiff_fst).contDiffAt + | inr j => + change ContDiffAt ℝ ∞ (fun p : ℝ × (Fin m → ℍ) => (normalizeQuaternion (p.2 j) : ℍ)) q + exact (normalizeQuaternion_coe_contDiffAt (hq j)).comp (f := fun p : ℝ × (Fin m → ℍ) => p.2 j) q + ((contDiff_apply ℝ ℍ j).comp contDiff_snd).contDiffAt + +def radialCoefficientWordMap {ι : Type*} {m : ℕ} + (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (q : ℝ × (Fin m → ℍ)) : Fin m → ℍ := + fun i => ‖q.2 i‖ • (coefficientWordMap w a (q.1, fun j => normalizeQuaternion (q.2 j)) i : ℍ) + +def smoothRadialCoefficientWordMap {ι : Type*} {m : ℕ} + (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (q : ℝ × (Fin m → ℍ)) : Fin m → ℍ := + radialCutoff q.2 • radialCoefficientWordMap w a q + +theorem smoothRadialCoefficientWordMap_smooth {ι : Type*} {m : ℕ} + (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (ha : ∀ i, ContDiff ℝ ∞ (fun t => (a t i : ℍ))) : + ContDiff ℝ ∞ (smoothRadialCoefficientWordMap w a) := by + apply radialCutoff_family_smooth + intro q hq + apply contDiffAt_pi.mpr + intro i + exact (((contDiff_apply ℝ ℍ i).comp contDiff_snd).contDiffAt.norm ℝ (hq i)).smul + ((contDiffAt_pi.mp (coefficientWordMap_normalized_smoothAt w a ha q hq)) i) + +@[simp] theorem radialCoefficientWordMap_norm {ι : Type*} {m : ℕ} + (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (q : ℝ × (Fin m → ℍ)) (i : Fin m) : + ‖radialCoefficientWordMap w a q i‖ = ‖q.2 i‖ := by + have h := (quaternion_mem_unitary_iff _).mp + (coefficientWordMap w a (q.1, fun j => normalizeQuaternion (q.2 j)) i).property + simp [radialCoefficientWordMap, norm_smul, h] + +theorem radialCoefficientWordMap_eq_one_iff {ι : Type*} {m : ℕ} + (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (q : ℝ × (Fin m → ℍ)) : radialCoefficientWordMap w a q = 1 ↔ + (∀ i, ‖q.2 i‖ = 1) ∧ coefficientWordMap w a + (q.1, fun j => normalizeQuaternion (q.2 j)) = 1 := by + constructor + · intro h + have hn (i : Fin m) : ‖q.2 i‖ = 1 := by + have he := congrArg (fun y : Fin m → ℍ => ‖y i‖) h + simpa only [radialCoefficientWordMap_norm, Pi.one_apply, norm_one] using he + refine ⟨hn, ?_⟩ + funext i + apply Subtype.ext + have he := congrFun h i + simpa [radialCoefficientWordMap, hn] using he + · rintro ⟨hn, hw⟩ + funext i + simp [radialCoefficientWordMap, hn, hw] + +theorem smoothRadialCoefficientWordMap_eq_one_iff {ι : Type*} {m : ℕ} + (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (q : ℝ × (Fin m → ℍ)) : smoothRadialCoefficientWordMap w a q = 1 ↔ + (∀ i, ‖q.2 i‖ = 1) ∧ coefficientWordMap w a + (q.1, fun j => normalizeQuaternion (q.2 j)) = 1 := by + rw [← radialCoefficientWordMap_eq_one_iff] + constructor + · intro h + have hn (i : Fin m) : radialCutoff q.2 * ‖q.2 i‖ = 1 := by + have he := congrArg (fun y : Fin m → ℍ => ‖y i‖) h + simpa only [smoothRadialCoefficientWordMap, Pi.smul_apply, norm_smul, Real.norm_eq_abs, + abs_of_nonneg (radialCutoff_nonneg q.2), radialCoefficientWordMap_norm, Pi.one_apply, norm_one] using he + have hlarge (i : Fin m) : 1 ≤ ‖q.2 i‖ := by + have hle := mul_le_mul_of_nonneg_right (radialCutoff_le_one q.2) (norm_nonneg (q.2 i)) + rw [hn i, one_mul] at hle + exact hle + simpa only [smoothRadialCoefficientWordMap, radialCutoff_eq_one q.2 hlarge, one_smul] using h + · intro h + have hn := (radialCoefficientWordMap_eq_one_iff w a q).mp h + simp only [smoothRadialCoefficientWordMap, radialCutoff_eq_one q.2 (fun i => (hn.1 i).ge), one_smul, h] + +theorem smoothRadialCoefficientWordMap_initial {ι : Type*} {m : ℕ} + (w : Fin m → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (ha : ∀ i, a 0 i = 1) (x : Fin m → ℍ) : + smoothRadialCoefficientWordMap w a (0, x) = + smoothRadialWordMap (fun i => eraseCoefficients (w i)) x := by + unfold smoothRadialCoefficientWordMap smoothRadialWordMap + congr 1 + funext i + dsimp only [radialCoefficientWordMap, radialWordMap] + rw [coefficientWordMap_initial w a ha] + rfl +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped Quaternion ContDiff + +def cutoffCoefficientProducts {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (q : ℝ × (Fin m → ℍ)) : Fin d → ℍ := + radialCutoff q.2 • fun i => + (coefficientWordMap w a (q.1, fun j => normalizeQuaternion (q.2 j)) i : ℍ) + +theorem cutoffCoefficientProducts_smooth {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (ha : ∀ i, ContDiff ℝ ∞ (fun t => (a t i : ℍ))) : + ContDiff ℝ ∞ (cutoffCoefficientProducts w a) := + radialCutoff_family_smooth _ (coefficientWordMap_normalized_smoothAt w a ha) + +theorem cutoffCoefficientProducts_unitary {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (t : ℝ) (x : Fin m → SU2) : + cutoffCoefficientProducts w a (t, fun i => (x i : ℍ)) = + fun i => (coefficientWordMap w a (t, x) i : ℍ) := by + have hn (i : Fin m) : ‖(x i : ℍ)‖ = 1 := (quaternion_mem_unitary_iff _).mp (x i).property + simp only [cutoffCoefficientProducts, radialCutoff_eq_one _ (fun i => (hn i).ge), one_smul, + normalizeQuaternion_unitary] +end EilenbergGanea + +namespace EilenbergGanea +open Set Filter Topology +open scoped Quaternion ContDiff + + theorem quaternionConjugate_sub (a : SU2) (q r : ℍ) : + quaternionConjugate a (q - r) = quaternionConjugate a q - quaternionConjugate a r := by + simp only [quaternionConjugate, mul_sub, sub_mul] + + theorem coefficientWordMap_initial_conjugate {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (ha : ∀ i, a 0 i = 1) (b : SU2) (x : Fin m → SU2) : + coefficientWordMap w a (0, fun i => b * x i * b⁻¹) = + fun i => b * coefficientWordMap w a (0, x) i * b⁻¹ := by + rw [coefficientWordMap_initial w a ha, coefficientWordMap_initial w a ha] + have he : FreeGroup.lift (fun i => b * x i * b⁻¹) = + (MulAut.conj b).toMonoidHom.comp (FreeGroup.lift x) := by + apply FreeGroup.ext_hom + intro i + simp + funext i + rw [he] + rfl + + theorem cutoffCoefficientProducts_initial_conjugate {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (ha : ∀ i, a 0 i = 1) (b : SU2) (x : Fin m → ℍ) : + cutoffCoefficientProducts w a (0, fun i => quaternionConjugate b (x i)) = + fun i => quaternionConjugate b (cutoffCoefficientProducts w a (0, x) i) := by + funext i + simp only [cutoffCoefficientProducts, radialCutoff, quaternionConjugate_norm, + normalizeQuaternion_conjugate, coefficientWordMap_initial_conjugate w a ha, + Pi.smul_apply, quaternionConjugate_smul, quaternionConjugate_coe] + + theorem cutoffCoefficientProducts_initial_size_invariant {ι : Type*} {m d : ℕ} + (w : Fin d → FreeGroup (ι ⊕ Fin m)) (a : ℝ → ι → SU2) + (ha : ∀ i, a 0 i = 1) (b : SU2) (x : Fin m → ℍ) : + ‖cutoffCoefficientProducts w a (0, fun i => quaternionConjugate b (x i)) - 1‖ = + ‖cutoffCoefficientProducts w a (0, x) - 1‖ := by + rw [cutoffCoefficientProducts_initial_conjugate w a ha] + have hn (i : Fin d) : ‖quaternionConjugate b (cutoffCoefficientProducts w a (0, x) i) - 1‖ = + ‖cutoffCoefficientProducts w a (0, x) i - 1‖ := by + calc + _ = ‖quaternionConjugate b (cutoffCoefficientProducts w a (0, x) i - 1)‖ := by rw [quaternionConjugate_sub, quaternionConjugate_one] + _ = _ := quaternionConjugate_norm _ _ + have hnn (i : Fin d) : ‖quaternionConjugate b (cutoffCoefficientProducts w a (0, x) i) - 1‖₊ = + ‖cutoffCoefficientProducts w a (0, x) i - 1‖₊ := NNReal.eq (hn i) + simp only [Pi.norm_def, Pi.sub_apply, Pi.one_apply, hnn] + +/-- Finite-word-system solvability with an actual distinguished-word sublevel +isolator. Arbitrarily singular initial word roots are allowed. -/ +theorem coefficient_word_sublevel_solvable {ι : Type*} {m d : ℕ} + (w : Fin m → FreeGroup (ι ⊕ Fin m)) (ρ : Fin d → FreeGroup (ι ⊕ Fin m)) + (a : ℝ → ι → SU2) (ha : ∀ i, ContDiff ℝ ∞ (fun t => (a t i : ℍ))) + (ha0 : ∀ i, a 0 i = 1) + (hB : (exponentMatrix (fun i => eraseCoefficients (w i))).det ≠ 0) + (δ : ℝ) (hδ : 0 < δ) + (hiso : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x : Fin m → SU2, + coefficientWordMap w a (t, x) = 1 → + ‖(fun i => (coefficientWordMap ρ a (t, x) i : ℍ)) - 1‖ ≠ δ) : + ∃ x : Fin m → SU2, coefficientWordMap w a (1, x) = 1 ∧ + ‖(fun i => (coefficientWordMap ρ a (1, x) i : ℍ)) - 1‖ < δ := by + let E := (Fin m → ℂ) × (Fin m → ℂ) + let e : (Fin m → ℍ) ≃L[ℝ] E := quaternionTupleCoordinates + let H : ℝ × E → ℝ × (Fin m → ℍ) := fun q => (q.1, e.symm q.2) + have hH : ContDiff ℝ ∞ H := contDiff_fst.prodMk (e.symm.contDiff.comp contDiff_snd) + let F : ℝ × E → E := fun q => e (smoothRadialCoefficientWordMap w a (H q)) - (1, 0) + let h : ℝ × E → ℝ := fun q => ‖cutoffCoefficientProducts ρ a (H q) - 1‖ + have hF : ContDiff ℝ 2 F := contDiff_infty.mp + ((e.contDiff.comp ((smoothRadialCoefficientWordMap_smooth w a ha).comp hH)).sub contDiff_const) 2 + have hF0 : ∀ q, F (0, q) = splitWordMap (fun i => eraseCoefficients (w i)) q := by + intro q + dsimp only [F, H] + rw [smoothRadialCoefficientWordMap_initial w a ha0] + rfl + have hh : Continuous h := (((cutoffCoefficientProducts_smooth ρ a ha).comp hH).continuous.sub continuous_const).norm + have he1 : e (1 : Fin m → ℍ) = (1, 0) := by + change quaternionTupleCoordinates + (fun _ : Fin m => Quaternion.ofComplex (1 : ℂ)) = _ + exact quaternionTupleCoordinates_fixed 1 + have hroot (q : ℝ × E) (hq : F q = 0) : + (∀ i, ‖e.symm q.2 i‖ = 1) ∧ + coefficientWordMap w a (q.1, fun i => normalizeQuaternion (e.symm q.2 i)) = 1 := by + apply (smoothRadialCoefficientWordMap_eq_one_iff w a (H q)).mp + apply e.injective + rw [he1] + exact sub_eq_zero.mp hq + have hnorm (q : ℝ × E) (hq : F q = 0) : ‖q.2‖ ≤ ‖e.toContinuousLinearMap‖ := by + have hle : ‖e.symm q.2‖ ≤ 1 := (pi_norm_le_iff_of_nonneg (by positivity)).mpr + (fun i => (hroot q hq).1 i |>.le) + calc + ‖q.2‖ = ‖e (e.symm q.2)‖ := by rw [e.apply_symm_apply] + _ ≤ ‖e.toContinuousLinearMap‖ * ‖e.symm q.2‖ := e.toContinuousLinearMap.le_opNorm _ + _ ≤ ‖e.toContinuousLinearMap‖ := mul_le_of_le_one_right (norm_nonneg e.toContinuousLinearMap) hle + have hunit (q : ℝ × E) (hq : F q = 0) : + (fun i => ((normalizeQuaternion (e.symm q.2 i) : SU2) : ℍ)) = e.symm q.2 := by + funext i + have hn := (hroot q hq).1 i + rw [normalizeQuaternion_coe_of_ne_zero (by intro hz; simp [hz] at hn), hn, inv_one, one_smul] + have hsizeroot (q : ℝ × E) (hq : F q = 0) : + h q = ‖(fun i => (coefficientWordMap ρ a + (q.1, fun j => normalizeQuaternion (e.symm q.2 j)) i : ℍ)) - 1‖ := by + dsimp only [h, H] + conv_lhs => rw [← hunit q hq, cutoffCoefficientProducts_unitary] + have hi : ∀ z : ℂ, ‖z‖ = 1 → ∀ q : E, h (0, (q.1, z • q.2)) = h (0, q) := by + intro z hz q + obtain ⟨c, hc⟩ := circle_exists_square_root z hz + have heq : e.symm (q.1, z • q.2) = + fun i => quaternionConjugate (circleQuaternion c) (e.symm q i) := by + apply e.injective + rw [e.apply_symm_apply, quaternionTupleCoordinates_conjCircle, hc, e.apply_symm_apply] + dsimp only [h, H] + rw [heq] + exact cutoffCoefficientProducts_initial_size_invariant ρ a ha0 _ _ + have h1 : h (0, (1, 0)) < δ := by + have he : e.symm (1, 0) = 1 := by rw [← he1, e.symm_apply_apply] + have hp : coefficientWordMap ρ a (0, (1 : Fin m → SU2)) = 1 := by + rw [coefficientWordMap_initial ρ a ha0] + have hl : FreeGroup.lift (1 : Fin m → SU2) = 1 := by + apply FreeGroup.ext_hom + intro i + simp + funext i + rw [hl] + rfl + dsimp only [h, H] + rw [he] + have hco : (1 : Fin m → ℍ) = fun i => ((1 : Fin m → SU2) i : ℍ) := rfl + rw [hco, cutoffCoefficientProducts_unitary, hp] + change ‖(1 : Fin d → ℍ) - 1‖ < δ + simpa only [sub_self, norm_zero] using hδ + let R : ℝ := ‖e.toContinuousLinearMap‖ + ‖((1 : Fin m → ℂ), (0 : Fin m → ℂ))‖ + 1 + obtain ⟨q, hq, hhq⟩ := localized_word_root_sublevel + (fun i => eraseCoefficients (w i)) hB F hF hF0 h hh δ R + (by dsimp only [R]; have hn := norm_nonneg e.toContinuousLinearMap; linarith) h1 hi + (fun q _ hq => by dsimp only [R]; have hn := hnorm q hq; have hp := norm_nonneg ((1 : Fin m → ℂ), (0 : Fin m → ℂ)); linarith) + (fun q ht hq => by rw [hsizeroot q hq]; exact hiso q.1 ht _ (hroot q hq).2) + refine ⟨fun i => normalizeQuaternion (e.symm q i), (hroot (1, q) hq).2, ?_⟩ + simpa only [hsizeroot (1, q) hq] using hhq +end EilenbergGanea + + +end + +end OAI diff --git a/lean/OAI/Topology/HahnSeries/Pivots.lean b/lean/OAI/Topology/HahnSeries/Pivots.lean index ecd1001b22d2079e4e3b19a7b150337443449053..cf714778fb84b465c23c45f8ce39a12652acff32 100644 --- a/lean/OAI/Topology/HahnSeries/Pivots.lean +++ b/lean/OAI/Topology/HahnSeries/Pivots.lean @@ -1,852 +1,852 @@ -import OAI.LinearAlgebra.RankMatching.Basic - -namespace OAI - -noncomputable section -open scoped BigOperators nonZeroDivisors -open LinearMap Submodule -open CategoryTheory CategoryTheory.Limits HomologicalComplex - -namespace HahnWilson.PivotTopology -open HahnSeries -open scoped BigOperators Topology -variable {k : Type*} [Field k] - -def poleLattice (J : ℤ) : Submodule k (LaurentSeries k) where - carrier := {f | ∀ i : ℤ, J < i → f.coeff (-i) = 0} - zero_mem' := by simp - add_mem' hf hg i hi := by simp [hf i hi, hg i hi] - smul_mem' c f hf i hi := by simp [hf i hi] - -def monomial (j : ℤ) : LaurentSeries k := HahnSeries.single (-j) 1 - -def PreservesPoles (a : LaurentSeries k →ₗ[k] LaurentSeries k) : Prop := - ∀ J, ∀ f ∈ poleLattice (k := k) J, a f ∈ poleLattice (k := k) J - -def matrixOf (a : LaurentSeries k →ₗ[k] LaurentSeries k) : Matrix ℤ ℤ k := - fun l j => (a (monomial j)).coeff (-l) - -def HasLeadingTerm (f : LaurentSeries k) (j : ℤ) : Prop := - f ∈ poleLattice (k := k) j ∧ f.coeff (-j) = 1 - -def HasLeadingPosition (f : LaurentSeries k) (j : ℤ) : Prop := - f ∈ poleLattice (k := k) j ∧ f.coeff (-j) ≠ 0 - -def crossing (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : Set (ℤ × ℤ) := - {p | RankMatching.Matched (matrixOf a) p.1 p.2 ∧ p.1 ≤ J ∧ J < p.2} - -def crossingQuotient (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) := - ↥(LinearMap.range a ⊓ poleLattice (k := k) J) ⧸ - Submodule.comap (LinearMap.range a ⊓ poleLattice (k := k) J).subtype - ((poleLattice (k := k) J).map a) - -instance crossingQuotient_addCommGroup (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : - AddCommGroup (crossingQuotient a J) := by - unfold crossingQuotient - infer_instance - -instance crossingQuotient_module (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : - Module k (crossingQuotient a J) := by - unfold crossingQuotient - infer_instance - -@[simp] lemma mem_poleLattice (J : ℤ) (f : LaurentSeries k) : - f ∈ poleLattice J ↔ ∀ i : ℤ, J < i → f.coeff (-i) = 0 := Iff.rfl - -lemma poleLattice_mono {I J : ℤ} (h : I ≤ J) : - poleLattice (k := k) I ≤ poleLattice J := by - intro f hf i hi - exact hf i (lt_of_le_of_lt h hi) - -@[simp] lemma coeff_monomial (j i : ℤ) : - (monomial (k := k) j).coeff (-i) = if i = j then 1 else 0 := by - simp [monomial, HahnSeries.coeff_single] - -lemma monomial_mem {j J : ℤ} (h : j ≤ J) : monomial (k := k) j ∈ poleLattice J := by - intro i hi - simp [show i ≠ j by omega] - -lemma exists_poleLattice (f : LaurentSeries k) : ∃ J, f ∈ poleLattice J := by - refine ⟨-f.order, ?_⟩ - intro i hi - exact HahnSeries.coeff_eq_zero_of_lt_order (by omega) - -lemma matrixOf_triangular (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) : RankMatching.Triangular (matrixOf a) := by - intro l j h - exact ha j (monomial j) (monomial_mem le_rfl) l h - -def truncate (f : LaurentSeries k) (L J : ℤ) : LaurentSeries k := - ∑ c ∈ Finset.Icc L J, f.coeff (-c) • monomial c - -lemma coeff_truncate (f : LaurentSeries k) (L J i : ℤ) : - (truncate f L J).coeff (-i) = if L ≤ i ∧ i ≤ J then f.coeff (-i) else 0 := by - classical - simp [truncate, HahnSeries.coeff_sum, HahnSeries.coeff_smul, smul_eq_mul, - mul_ite] - -lemma truncate_mem (f : LaurentSeries k) (L J : ℤ) : truncate f L J ∈ poleLattice J := by - intro i hi - rw [coeff_truncate, ite_eq_right (by omega)] - -lemma sub_truncate_mem {f : LaurentSeries k} {L J : ℤ} (hf : f ∈ poleLattice J) : - f - truncate f L J ∈ poleLattice (L - 1) := by - intro i hi - rw [HahnSeries.coeff_sub, coeff_truncate] - by_cases hij : i ≤ J - · rw [ite_eq_left (by omega), sub_self] - · rw [ite_eq_right (by omega), sub_zero, hf i (by omega)] - -def poleProjection (L : ℤ) : LaurentSeries k →ₗ[k] (ℤ → k) where - toFun f i := if L ≤ i then f.coeff (-i) else 0 - map_add' f g := by ext i; by_cases hi : L ≤ i <;> simp [hi] - map_smul' c f := by ext i; by_cases hi : L ≤ i <;> simp [hi] - -lemma poleProjection_eq_zero {L : ℤ} {f : LaurentSeries k} : - poleProjection L f = 0 ↔ f ∈ poleLattice (L - 1) := by - constructor - · intro h i hi - have := congrFun h i - simpa [poleProjection, show L ≤ i by omega] using this - · intro h - ext i - by_cases hi : L ≤ i - · simp [poleProjection, hi, h i (by omega)] - · simp [poleProjection, hi] - -@[simp] lemma poleProjection_monomial_image - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (L j : ℤ) : - poleProjection L (a (monomial j)) = RankMatching.column (matrixOf a) L j := rfl - -lemma poleProjection_truncate_image (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) {f : LaurentSeries k} {L J : ℤ} - (hf : f ∈ poleLattice J) : - poleProjection L (a (truncate f L J)) = poleProjection L (a f) := by - have h := (poleProjection_eq_zero).mpr (ha (L - 1) _ (sub_truncate_mem hf)) - rw [map_sub, map_sub, sub_eq_zero] at h - exact h.symm - -lemma columnSpace_eq_projectedImage (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) (L J : ℤ) : - RankMatching.columnSpace (matrixOf a) L J = - ((poleLattice J).map a).map (poleProjection L) := by - classical - apply le_antisymm - · apply Submodule.span_le.mpr - rintro _ ⟨c, hc, rfl⟩ - exact ⟨a (monomial c), ⟨monomial c, monomial_mem hc, rfl⟩, rfl⟩ - · rintro y ⟨z, ⟨f,hf,rfl⟩,rfl⟩ - rw [← poleProjection_truncate_image a ha hf] - simp only [truncate, map_sum, map_smul] - exact Submodule.sum_mem _ fun c hc => - Submodule.smul_mem _ _ (Submodule.subset_span - ⟨c, (Finset.mem_Icc.mp hc).2, rfl⟩) - -lemma increment_zero_iff_finite_solution - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (L j : ℤ) : - RankMatching.increment (matrixOf a) L j = 0 ↔ - ∃ f, HasLeadingTerm f j ∧ a f ∈ poleLattice (L - 1) := by - rw [RankMatching.increment_eq_zero_iff, columnSpace_eq_projectedImage a ha] - constructor - · rintro ⟨z, ⟨g,hg,rfl⟩,heq⟩ - refine ⟨monomial j - g, ⟨?_, ?_⟩, ?_⟩ - · intro i hi - simp only [HahnSeries.coeff_sub, coeff_monomial, - ite_eq_right (show i ≠ j by omega), hg i (by omega), sub_self] - · simp [HahnSeries.coeff_sub, hg j (by omega)] - · apply poleProjection_eq_zero.mp - rw [map_sub, map_sub, poleProjection_monomial_image, ← heq, sub_self] - · rintro ⟨f, ⟨hf,hfj⟩,haf⟩ - have hg : monomial j - f ∈ poleLattice (j - 1) := by - intro i hi - by_cases hij : i = j - · subst i; simp [HahnSeries.coeff_sub, hfj] - · simp [HahnSeries.coeff_sub, coeff_monomial, hij, hf i (by omega)] - refine ⟨a (monomial j - f), ⟨monomial j - f, hg, rfl⟩, ?_⟩ - rw [map_sub, map_sub, poleProjection_monomial_image, - poleProjection_eq_zero.mpr haf, sub_zero] - -open WithZero - -lemma mem_poleLattice_iff_valuation (J : ℤ) (f : LaurentSeries k) : - f ∈ poleLattice J ↔ Valued.v f ≤ WithZero.exp J := by - rw [show J = -(-J) by omega, LaurentSeries.valuation_le_iff_coeff_lt_eq_zero] - constructor - · intro hf n hn - simpa using hf (-n) (by omega) - · intro hf i hi - exact hf (-i) (by omega) - -lemma poleLattice_eq_ball (J : ℤ) : - (poleLattice (k := k) J : Set (LaurentSeries k)) = - {f | (Valued.v : Valuation (LaurentSeries k) ℤᵐ⁰).restrict f ≤ - (Valued.v : Valuation (LaurentSeries k) ℤᵐ⁰).restrict (monomial J)} := by - ext f - change f ∈ poleLattice J ↔ (Valued.v : Valuation (LaurentSeries k) ℤᵐ⁰).restrict f ≤ - (Valued.v : Valuation (LaurentSeries k) ℤᵐ⁰).restrict (monomial J) - rw [Valuation.restrict_le_iff, mem_poleLattice_iff_valuation] - simp [monomial, LaurentSeries.valuation_single_zpow] - -lemma isClosed_poleLattice (J : ℤ) : IsClosed (poleLattice (k := k) J : Set (LaurentSeries k)) := by - rw [poleLattice_eq_ball] - exact Valued.isClosed_closedBall _ _ - -lemma isOpen_poleLattice (J : ℤ) : IsOpen (poleLattice (k := k) J : Set (LaurentSeries k)) := by - rw [poleLattice_eq_ball] - apply Valued.isOpen_closedBall - rw [ne_eq, Valuation.restrict_eq_zero_iff] - simp [monomial, LaurentSeries.valuation_single_zpow] - -lemma poleLattice_nhds_basis : - (𝓝 (0 : LaurentSeries k)).HasBasis (fun _ : ℤ => True) - (fun J => (poleLattice (k := k) J : Set (LaurentSeries k))) := by - let v : Valuation (LaurentSeries k) ℤᵐ⁰ := Valued.v - apply (Valued.hasBasis_nhds_zero (LaurentSeries k) ℤᵐ⁰).to_hasBasis - · intro γ _ - let r : ℤᵐ⁰ := MonoidWithZeroHom.ValueGroup₀.embedding γ.val - have hr : r ≠ 0 := (Units.map - (MonoidWithZeroHom.ValueGroup₀.embedding (f := .ofClass v)).toMonoidHom γ).ne_zero - refine ⟨WithZero.log r - 1, trivial, ?_⟩ - intro f hf - rw [Set.mem_ofPred_eq, Valuation.restrict_lt_iff_lt_embedding] - apply (mem_poleLattice_iff_valuation _ f).mp hf |>.trans_lt - change WithZero.exp (WithZero.log r - 1) < r - calc - _ < WithZero.exp (WithZero.log r) := WithZero.exp_lt_exp.mpr (by omega) - _ = r := WithZero.exp_log hr - · intro J _ - have hn : v.restrict (monomial J) ≠ 0 := by - rw [ne_eq, Valuation.restrict_eq_zero_iff] - simp [v, monomial, LaurentSeries.valuation_single_zpow] - refine ⟨Units.mk0 _ hn, trivial, ?_⟩ - intro f hf - rw [poleLattice_eq_ball] - change v.restrict f < v.restrict (monomial J) at hf - exact hf.le - -lemma continuous_of_preservesPoles (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) : Continuous a := by - apply continuous_of_continuousAt_zero a - simp only [ContinuousAt, map_zero] - rw [poleLattice_nhds_basis.tendsto_iff poleLattice_nhds_basis] - exact fun J _ => ⟨J, trivial, ha J⟩ - -lemma continuous_of_bounded_coefficients [UniformSpace k] [DiscreteTopology k] - {X : Type*} [TopologicalSpace X] (g : X → LaurentSeries k) (J : ℤ) - (hg : ∀ x, g x ∈ poleLattice J) - (hcoeff : ∀ n : ℤ, Continuous (fun x => (g x).coeff n)) : Continuous g := by - rw [continuous_iff_continuousAt] - intro x - apply tendsto_sub_nhds_zero_iff.mp - rw [poleLattice_nhds_basis.tendsto_right_iff] - intro M _ - have hev : ∀ᶠ y in 𝓝 x, ∀ i ∈ Finset.Ioc M J, - (g y).coeff (-i) = (g x).coeff (-i) := by - rw [Filter.eventually_all_finset] - intro i _ - exact (hcoeff (-i)).continuousAt.eventually - ((isOpen_discrete {(g x).coeff (-i)}).mem_nhds rfl) - filter_upwards [hev] with y hy - intro i hi - rw [HahnSeries.coeff_sub, sub_eq_zero] - by_cases hij : i ≤ J - · exact hy i (Finset.mem_Ioc.mpr ⟨hi,hij⟩) - · rw [hg y i (by omega), hg x i (by omega)] - -def stageSeries (J : ℤ) (c : ℤ → k) : LaurentSeries k := - HahnSeries.ofSuppBddBelow (fun n => if -J ≤ n then c n else 0) - ⟨-J, by - intro n hn - by_contra h - exact hn (ite_eq_right h)⟩ - -@[simp] lemma coeff_stageSeries (J : ℤ) (c : ℤ → k) (n : ℤ) : - (stageSeries J c).coeff n = if -J ≤ n then c n else 0 := rfl - -lemma stageSeries_mem (J : ℤ) (c : ℤ → k) : stageSeries J c ∈ poleLattice J := by - intro i hi - rw [coeff_stageSeries, ite_eq_right (by omega)] - -lemma range_stageSeries (J : ℤ) : - Set.range (stageSeries (k := k) J) = (poleLattice (k := k) J : Set (LaurentSeries k)) := by - ext f - constructor - · rintro ⟨c,rfl⟩ - exact stageSeries_mem J c - · intro hf - refine ⟨f.coeff, ?_⟩ - apply HahnSeries.ext - funext n - rw [coeff_stageSeries] - split_ifs with hn - · rfl - · symm - simpa using hf (-n) (by omega) - -lemma continuous_stageSeries [UniformSpace k] [DiscreteTopology k] (J : ℤ) : - Continuous (stageSeries (k := k) J) := by - apply continuous_of_bounded_coefficients _ J (stageSeries_mem J) - intro n - simp only [coeff_stageSeries] - split_ifs - · exact continuous_apply n - · exact continuous_const - -lemma isCompact_poleLattice [Finite k] (J : ℤ) : - IsCompact (poleLattice (k := k) J : Set (LaurentSeries k)) := by - let : UniformSpace k := ⊥ - rw [← range_stageSeries, ← Set.image_univ] - exact isCompact_univ.image (continuous_stageSeries J) - -lemma isCompact_leadingTerm [Finite k] (j : ℤ) : - IsCompact {f : LaurentSeries k | HasLeadingTerm f j} := by - let : UniformSpace k := ⊥ - exact (isCompact_poleLattice j).inter_right - (isClosed_eq (LaurentSeries.uniformContinuous_coeff (-j)).continuous continuous_const) - -lemma isClosed_leadingTerm (j : ℤ) : - IsClosed {f : LaurentSeries k | HasLeadingTerm f j} := by - let : UniformSpace k := ⊥ - exact (isClosed_poleLattice j).inter - (isClosed_eq (LaurentSeries.uniformContinuous_coeff (-j)).continuous continuous_const) - -lemma unmatched_iff_increments_zero (A : Matrix ℤ ℤ k) - (hA : RankMatching.Triangular A) (j : ℤ) : - (∀ l, ¬ RankMatching.Matched A l j) ↔ ∀ L, RankMatching.increment A L j = 0 := by - constructor - · intro h L - by_cases hLj : L ≤ j - · have hw : ∀ l, RankMatching.weight A l j = 0 := fun l => - (RankMatching.weight_zero_or_one A hA l j).resolve_right (h l) - have hs := RankMatching.sum_interval_difference - (fun l => (RankMatching.increment A l j : ℤ)) L j (by omega) - simp_rw [← RankMatching.weight_eq_increment_sub A hA, hw] at hs - rw [RankMatching.increment_zero A hA (show j < j + 1 by omega)] at hs - simpa using hs.symm - · exact RankMatching.increment_zero A hA (by omega) - · intro h l hm - have hi := (RankMatching.matched_iff_increments A hA l j).mp hm - rw [h l] at hi - exact Nat.zero_ne_one hi.1 - -theorem unmatched_iff_kernel [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (j : ℤ) : - (∀ l, ¬ RankMatching.Matched (matrixOf a) l j) ↔ - ∃ f, a f = 0 ∧ HasLeadingTerm f j := by - rw [unmatched_iff_increments_zero _ (matrixOf_triangular a ha)] - constructor - · intro h - let S : ℤ → Set (LaurentSeries k) := fun L => - {f | HasLeadingTerm f j ∧ a f ∈ poleLattice (L - 1)} - have hc : ∀ L, IsClosed (S L) := fun L => - (isClosed_leadingTerm j).inter - ((isClosed_poleLattice (L - 1)).preimage (continuous_of_preservesPoles a ha)) - have hk : ∀ L, IsCompact (S L) := fun L => - (isCompact_leadingTerm j).of_isClosed_subset (hc L) (fun _ h => h.1) - have hn : ∀ L, (S L).Nonempty := fun L => - (increment_zero_iff_finite_solution a ha L j).mp (h L) - have hd : Directed (fun s t : Set (LaurentSeries k) => s ⊇ t) S := by - intro L M - refine ⟨min L M, ?_, ?_⟩ - · intro f hf - exact ⟨hf.1, poleLattice_mono (by omega) hf.2⟩ - · intro f hf - exact ⟨hf.1, poleLattice_mono (by omega) hf.2⟩ - obtain ⟨f,hf⟩ := IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed S hd hn hk hc - have hf' : ∀ L, f ∈ S L := Set.mem_iInter.mp hf - refine ⟨f, ?_, (hf' j).1⟩ - apply HahnSeries.ext - funext n - simpa using (hf' (-n)).2 (-n) (by omega) - · rintro ⟨f,haf,hfj⟩ L - apply (increment_zero_iff_finite_solution a ha L j).mpr - exact ⟨f,hfj,haf ▸ (poleLattice (L - 1)).zero_mem⟩ - -lemma rowRank_step (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) (l J : ℤ) : - RankMatching.blockRank A l J = RankMatching.blockRank A (l + 1) J + - RankMatching.increment (RankMatching.reflected A) (-J) (-l) := by - have h := RankMatching.blockRank_step (RankMatching.reflected A) - (RankMatching.triangular_reflected A hA) (-J) (-l) - simpa only [RankMatching.blockRank_reflected, neg_neg, neg_sub, - Int.reduceNeg, sub_neg_eq_add, add_comm] using h - -lemma matchedRow_iff_unequal_ranks (A : Matrix ℤ ℤ k) - (hA : RankMatching.Triangular A) (l : ℤ) : - (∃ j, RankMatching.Matched A l j) ↔ - ∃ J, RankMatching.blockRank A l J ≠ RankMatching.blockRank A (l + 1) J := by - have hn : (∀ j, ¬ RankMatching.Matched A l j) ↔ - ∀ J, RankMatching.blockRank A l J = RankMatching.blockRank A (l + 1) J := by - have hh := unmatched_iff_increments_zero (RankMatching.reflected A) - (RankMatching.triangular_reflected A hA) (-l) - constructor - · intro h J - have hh' : ∀ r, ¬ RankMatching.Matched (RankMatching.reflected A) r (-l) := by - intro r hr - apply h (-r) - simpa only [RankMatching.Matched, RankMatching.weight_reflected, neg_neg] using hr - rw [rowRank_step A hA l J, hh.mp hh' (-J), add_zero] - · intro h j hm - have hh' : ∀ r, RankMatching.increment (RankMatching.reflected A) r (-l) = 0 := by - intro r - have hs := rowRank_step A hA l (-r) - rw [neg_neg, h (-r)] at hs - omega - apply hh.mpr hh' (-j) - simpa only [RankMatching.Matched, RankMatching.weight_reflected, neg_neg] using hm - simpa only [not_forall, not_not] using not_congr hn - -lemma exists_rowCut_kernel_of_unequal_ranks (A : Matrix ℤ ℤ k) - (hA : RankMatching.Triangular A) (l J : ℤ) - (hr : RankMatching.blockRank A l J ≠ RankMatching.blockRank A (l + 1) J) : - ∃ v ∈ RankMatching.columnSpace A l J, - RankMatching.rowCut (l + 1) v = 0 ∧ v l ≠ 0 := by - let F : RankMatching.columnSpace A l J →ₗ[k] RankMatching.columnSpace A (l + 1) J := - (RankMatching.rowCut (l + 1)).restrict - (fun _ hv => RankMatching.rowCut_columnSpace A (by omega) J hv) - have hs : Function.Surjective F := by - intro v - have hm : (v : ℤ → k) ∈ (RankMatching.columnSpace A l J).map - (RankMatching.rowCut (l + 1)) := by - rw [RankMatching.rowCut_map_columnSpace A (by omega)] - exact v.property - obtain ⟨w,hw,he⟩ := Submodule.mem_map.mp hm - exact ⟨⟨w,hw⟩, Subtype.ext he⟩ - have hni : ¬ Function.Injective F := by - intro hi - apply hr - have he := (LinearEquiv.ofBijective F ⟨hi,hs⟩).finrank_eq - simpa only [RankMatching.blockRank_eq_finrank A hA] using he - have hk : F.ker ≠ ⊥ := fun h => hni (LinearMap.ker_eq_bot.mp h) - obtain ⟨v,hv,hvz⟩ := F.ker.ne_bot_iff.mp hk - have hcut : RankMatching.rowCut (l + 1) (v : ℤ → k) = 0 := - congrArg Subtype.val (show F v = 0 from hv) - refine ⟨v, v.property, hcut, ?_⟩ - intro hvl - apply hvz - apply Subtype.ext - funext r - rcases lt_trichotomy r l with hlt | heq | hgt - · exact RankMatching.columnSpace_supported A l J v.property hlt - · simpa [heq] using hvl - · have he := congrFun hcut r - simpa [RankMatching.rowCut, hgt] using he - -theorem matched_row_iff_image - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (l : ℤ) : - (∃ j, RankMatching.Matched (matrixOf a) l j) ↔ - ∃ f, HasLeadingPosition (a f) l := by - rw [matchedRow_iff_unequal_ranks _ (matrixOf_triangular a ha)] - constructor - · rintro ⟨J,hJ⟩ - obtain ⟨v,hv,hcut,hvl⟩ := exists_rowCut_kernel_of_unequal_ranks - (matrixOf a) (matrixOf_triangular a ha) l J hJ - rw [columnSpace_eq_projectedImage a ha] at hv - obtain ⟨z,⟨f,hf,rfl⟩,rfl⟩ := hv - refine ⟨f, ?_, ?_⟩ - · intro i hi - have he := congrFun hcut i - simpa [RankMatching.rowCut, poleProjection, hi, - show l ≤ i by omega] using he - · simpa [poleProjection] using hvl - · rintro ⟨f,hf,hfl⟩ - obtain ⟨J,hJ⟩ := exists_poleLattice f - refine ⟨J, ?_⟩ - intro heq - have hv : poleProjection l (a f) ∈ RankMatching.columnSpace (matrixOf a) l J := by - rw [columnSpace_eq_projectedImage a ha] - exact ⟨a f,⟨f,hJ,rfl⟩,rfl⟩ - have hcut : RankMatching.rowCut (l + 1) (poleProjection l (a f)) = 0 := by - ext i - by_cases hi : l + 1 ≤ i - · simp [RankMatching.rowCut, poleProjection, show l ≤ i by omega, - hf i (by omega)] - · simp [RankMatching.rowCut, show ¬ l < i by omega] - have hi := RankMatching.rowCut_injOn_of_equal_ranks - (matrixOf a) (matrixOf_triangular a ha) l J heq - have he : poleProjection l (a f) = 0 := hi hv (Submodule.zero_mem _) (by simpa using hcut) - apply hfl - simpa [poleProjection] using congrFun he l - -def stageImage (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : - Submodule k (LaurentSeries k) := (poleLattice J).map a - -lemma stageImage_mono (a : LaurentSeries k →ₗ[k] LaurentSeries k) : Monotone (stageImage a) := by - intro I J h - exact Submodule.map_mono (poleLattice_mono h) - -lemma stageImage_le_poleLattice (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) (J : ℤ) : stageImage a J ≤ poleLattice J := by - rintro z ⟨f,hf,rfl⟩ - exact ha J f hf - -lemma stageImage_step (a : LaurentSeries k →ₗ[k] LaurentSeries k) (j : ℤ) : - stageImage a j = stageImage a (j - 1) ⊔ Submodule.span k {a (monomial j)} := by - apply le_antisymm - · rintro z ⟨f,hf,rfl⟩ - have ht : f - f.coeff (-j) • monomial j ∈ poleLattice (j - 1) := by - intro i hi - by_cases hij : i = j - · subst i; simp [HahnSeries.coeff_sub, HahnSeries.coeff_smul] - · simp [HahnSeries.coeff_sub, HahnSeries.coeff_smul, coeff_monomial, hij, - hf i (by omega)] - apply Submodule.mem_sup.mpr - refine ⟨a (f - f.coeff (-j) • monomial j), ⟨_,ht,rfl⟩, - f.coeff (-j) • a (monomial j), - Submodule.smul_mem _ _ (Submodule.subset_span (Set.mem_singleton _)), ?_⟩ - simp - · apply sup_le (stageImage_mono a (by omega)) - rw [Submodule.span_singleton_le_iff_mem] - exact ⟨monomial j, monomial_mem le_rfl, rfl⟩ - -lemma monomial_image_mem_iff_unmatched [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (j : ℤ) : - a (monomial j) ∈ stageImage a (j - 1) ↔ - ∀ l, ¬ RankMatching.Matched (matrixOf a) l j := by - rw [unmatched_iff_kernel a ha] - constructor - · rintro ⟨g,hg,he⟩ - refine ⟨monomial j - g, by simp [he], ?_, ?_⟩ - · intro i hi - simp [HahnSeries.coeff_sub, coeff_monomial, show i ≠ j by omega, hg i (by omega)] - · simp [HahnSeries.coeff_sub, hg j (by omega)] - · rintro ⟨f,haf,hf,hfj⟩ - refine ⟨monomial j - f, ?_, by simp [haf]⟩ - intro i hi - by_cases hij : i = j - · subst i; simp [HahnSeries.coeff_sub, hfj] - · simp [HahnSeries.coeff_sub, coeff_monomial, hij, hf i (by omega)] - -def imageModulo (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : - Submodule k (LaurentSeries k ⧸ stageImage a J) := - (stageImage a N).map (stageImage a J).mkQ - -lemma imageModulo_mono (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : - Monotone (imageModulo a J) := fun _ _ h => Submodule.map_mono (stageImage_mono a h) - -lemma imageModulo_zero (a : LaurentSeries k →ₗ[k] LaurentSeries k) {J N : ℤ} (h : N ≤ J) : - imageModulo a J N = ⊥ := by - apply le_antisymm _ bot_le - rw [imageModulo, Submodule.map_le_iff_le_comap, Submodule.comap_bot, Submodule.ker_mkQ] - exact stageImage_mono a h - -lemma imageModulo_step (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J n : ℤ) : - imageModulo a J n = imageModulo a J (n - 1) ⊔ - Submodule.span k {(stageImage a J).mkQ (a (monomial n))} := by - rw [imageModulo, stageImage_step a n, Submodule.map_sup, Submodule.map_span, Set.image_singleton] - rfl - -lemma imageModulo_finite (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : - FiniteDimensional k (imageModulo a J N) := by - by_cases h : J ≤ N - · induction N, h using Int.leInduction with - | base => rw [imageModulo_zero a le_rfl]; infer_instance - | succ n hn ih => - rw [imageModulo_step, add_sub_cancel_right] - let := ih - infer_instance - · rw [imageModulo_zero a (by omega)] - infer_instance - -lemma mem_imageModulo (a : LaurentSeries k →ₗ[k] LaurentSeries k) {J N : ℤ} - (h : J ≤ N) (f : LaurentSeries k) : - (stageImage a J).mkQ f ∈ imageModulo a J N ↔ f ∈ stageImage a N := by - change f ∈ ((stageImage a N).map (stageImage a J).mkQ).comap (stageImage a J).mkQ ↔ _ - rw [Submodule.comap_map_eq, Submodule.ker_mkQ, sup_eq_left.mpr (stageImage_mono a h)] - -open scoped Classical - -lemma imageModulo_finrank_step [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) {J n : ℤ} - (h : J < n) : - Module.finrank k (imageModulo a J n) = Module.finrank k (imageModulo a J (n - 1)) + - if ∃ l, RankMatching.Matched (matrixOf a) l n then 1 else 0 := by - classical - let := imageModulo_finite a J (n - 1) - rw [imageModulo_step, RankMatching.finrank_sup_singleton, - mem_imageModulo a (by omega), monomial_image_mem_iff_unmatched a ha] - by_cases hm : ∃ l, RankMatching.Matched (matrixOf a) l n - · have hn : ¬ (∀ l, ¬ RankMatching.Matched (matrixOf a) l n) := - fun hh => hh hm.choose hm.choose_spec - simp [hm, hn] - · simp [show ∀ l, ¬ RankMatching.Matched (matrixOf a) l n from fun l hl => hm ⟨l,hl⟩] - -lemma imageModulo_finrank [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (J N : ℤ) : - Module.finrank k (imageModulo a J N) = - ∑ j ∈ Finset.Ioc J N, if ∃ l, RankMatching.Matched (matrixOf a) l j then 1 else 0 := by - classical - by_cases h : J ≤ N - · induction N, h using Int.leInduction with - | base => rw [imageModulo_zero a (J := J) (N := J) le_rfl, finrank_bot]; simp - | succ n hn ih => - have he : Finset.Ioc J (n + 1) = insert (n + 1) (Finset.Ioc J n) := by - ext i - simp only [Finset.mem_Ioc, Finset.mem_insert] - omega - rw [imageModulo_finrank_step a ha (by omega), add_sub_cancel_right, ih, - he, Finset.sum_insert (by simp)] - omega - · rw [imageModulo_zero a (by omega), finrank_bot, Finset.Ioc_eq_empty_of_le (by omega), - Finset.sum_empty] - -lemma matched_le (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) {l j : ℤ} - (h : RankMatching.Matched A l j) : l ≤ j := by - by_contra hn - have hz := RankMatching.increment_zero A hA (lt_of_not_ge hn) - have ho := ((RankMatching.matched_iff_increments A hA l j).mp h).1 - omega - -def columnMatches (A : Matrix ℤ ℤ k) (J N : ℤ) : Set (ℤ × ℤ) := - {p | RankMatching.Matched A p.1 p.2 ∧ J < p.2 ∧ p.2 ≤ N} - -def crossingStageMatches (A : Matrix ℤ ℤ k) (J N : ℤ) : Set (ℤ × ℤ) := - {p | RankMatching.Matched A p.1 p.2 ∧ p.1 ≤ J ∧ J < p.2 ∧ p.2 ≤ N} - -lemma columnMatches_snd_inj (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) - (J N : ℤ) : Set.InjOn Prod.snd (columnMatches A J N) := by - rintro ⟨l,j⟩ hp ⟨l',j'⟩ hq he - change j = j' at he - subst j' - exact Prod.ext (RankMatching.column_unique A hA hp.1 hq.1) rfl - -lemma columnMatches_finite (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) - (J N : ℤ) : (columnMatches A J N).Finite := by - exact Set.Finite.of_injOn (fun _ hp => hp.2) (columnMatches_snd_inj A hA J N) - (Set.finite_Ioc J N) - -lemma columnMatches_ncard (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) - (J N : ℤ) : (columnMatches A J N).ncard = - ∑ j ∈ Finset.Ioc J N, if ∃ l, RankMatching.Matched A l j then 1 else 0 := by - classical - have he : Prod.snd '' columnMatches A J N = - ↑((Finset.Ioc J N).filter (fun j => ∃ l, RankMatching.Matched A l j)) := by - ext j - simp only [Set.mem_image, columnMatches, Set.mem_ofPred_eq, Finset.mem_coe, - Finset.mem_filter, Finset.mem_Ioc] - constructor - · rintro ⟨⟨l,j'⟩,⟨hm,hJ,hN⟩,rfl⟩ - exact ⟨⟨hJ,hN⟩,l,hm⟩ - · rintro ⟨⟨hJ,hN⟩,l,hm⟩ - exact ⟨(l,j),⟨hm,hJ,hN⟩,rfl⟩ - rw [← (columnMatches_snd_inj A hA J N).ncard_image, he, - Set.ncard_coe_finset, Finset.sum_boole] - rfl - -lemma columnMatches_partition (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) - (J N : ℤ) : - (columnMatches A J N).ncard = (crossingStageMatches A J N).ncard + - RankMatching.blockRank A (J + 1) N := by - classical - let high := ((Finset.Icc (J + 1) N ×ˢ Finset.Icc (J + 1) N).filter - (fun p : ℤ × ℤ => RankMatching.Matched A p.1 p.2)) - have he : columnMatches A J N = crossingStageMatches A J N ∪ (high : Set (ℤ × ℤ)) := by - ext p - simp only [columnMatches, crossingStageMatches, Set.mem_ofPred_eq, Set.mem_union, - high, Finset.mem_coe, Finset.mem_filter, Finset.mem_product, Finset.mem_Icc] - constructor - · rintro ⟨hm,hJ,hN⟩ - by_cases hl : p.1 ≤ J - · exact Or.inl ⟨hm,hl,hJ,hN⟩ - · have hh := matched_le A hA hm - exact Or.inr ⟨⟨⟨by omega,by omega⟩,⟨by omega,hN⟩⟩,hm⟩ - · rintro (⟨hm,hl,hJ,hN⟩ | ⟨⟨hl,hj⟩,hm⟩) - · exact ⟨hm,hJ,hN⟩ - · exact ⟨hm,by omega,hj.2⟩ - have hd : Disjoint (crossingStageMatches A J N) (high : Set (ℤ × ℤ)) := by - apply Set.disjoint_left.mpr - intro p hp hq - simp only [high, Finset.mem_coe, Finset.mem_filter, Finset.mem_product, - Finset.mem_Icc] at hq - have hh := hp.2.1 - omega - have hf : (crossingStageMatches A J N).Finite := - (columnMatches_finite A hA J N).subset (fun _ h => ⟨h.1,h.2.2⟩) - rw [he, Set.ncard_union_eq hd hf high.finite_toSet, Set.ncard_coe_finset, - RankMatching.rank_eq_count A hA] - rfl - -lemma imageModulo_finrank_partition [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (J N : ℤ) : - Module.finrank k (imageModulo a J N) = - (crossingStageMatches (matrixOf a) J N).ncard + RankMatching.blockRank (matrixOf a) (J + 1) N := by - rw [imageModulo_finrank a ha, ← columnMatches_ncard _ (matrixOf_triangular a ha), - columnMatches_partition _ (matrixOf_triangular a ha)] - -lemma stageImage_le_ker_projection (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) (J : ℤ) : stageImage a J ≤ (poleProjection (J + 1)).ker := by - intro f hf - change poleProjection (J + 1) f = 0 - apply poleProjection_eq_zero.mpr - simpa using stageImage_le_poleLattice a ha J hf - -def quotientProjection (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) (J : ℤ) : - (LaurentSeries k ⧸ stageImage a J) →ₗ[k] (ℤ → k) := - (stageImage a J).liftQ (poleProjection (J + 1)) (stageImage_le_ker_projection a ha J) - -@[simp] lemma quotientProjection_mkQ (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) (J : ℤ) (f : LaurentSeries k) : - quotientProjection a ha J ((stageImage a J).mkQ f) = poleProjection (J + 1) f := rfl - -def crossingStage (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : - Submodule k (LaurentSeries k ⧸ stageImage a J) := - (stageImage a N ⊓ poleLattice J).map (stageImage a J).mkQ - -lemma crossingStage_mono (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : - Monotone (crossingStage a J) := fun _ _ h => - Submodule.map_mono (inf_le_inf_right _ (stageImage_mono a h)) - -lemma crossingStage_finite (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : - FiniteDimensional k (crossingStage a J N) := by - let := imageModulo_finite a J N - exact Submodule.finiteDimensional_of_le (show crossingStage a J N ≤ imageModulo a J N - from Submodule.map_mono inf_le_left) - -lemma crossingStage_eq_inf (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) (J N : ℤ) : - crossingStage a J N = imageModulo a J N ⊓ (quotientProjection a ha J).ker := by - ext z - constructor - · rintro ⟨f,⟨hf,hJ⟩,rfl⟩ - exact ⟨⟨f,hf,rfl⟩, poleProjection_eq_zero.mpr (by simpa using hJ)⟩ - · rintro ⟨⟨f,hf,rfl⟩,hz⟩ - refine ⟨f,⟨hf,?_⟩,rfl⟩ - have he : poleProjection (J + 1) f = 0 := hz - simpa using poleProjection_eq_zero.mp he - -lemma quotientProjection_stage_range (a : LaurentSeries k →ₗ[k] LaurentSeries k) - (ha : PreservesPoles a) (J N : ℤ) : - ((quotientProjection a ha J).domRestrict (imageModulo a J N)).range = - RankMatching.columnSpace (matrixOf a) (J + 1) N := by - rw [LinearMap.range_domRestrict, columnSpace_eq_projectedImage a ha] - ext v - constructor - · rintro ⟨z,⟨f,hf,rfl⟩,rfl⟩ - exact ⟨f,hf,rfl⟩ - · rintro ⟨f,hf,rfl⟩ - exact ⟨(stageImage a J).mkQ f, ⟨f,hf,rfl⟩,rfl⟩ - -lemma crossingStage_finrank [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (J N : ℤ) : - Module.finrank k (crossingStage a J N) = (crossingStageMatches (matrixOf a) J N).ncard := by - let := imageModulo_finite a J N - let f := (quotientProjection a ha J).domRestrict (imageModulo a J N) - have hr := LinearMap.finrank_range_add_finrank_ker f - have hk : Module.finrank k f.ker = Module.finrank k (crossingStage a J N) := by - rw [← Submodule.finrank_map_subtype_eq (imageModulo a J N) f.ker, - show f.ker = ((quotientProjection a ha J).ker).comap (imageModulo a J N).subtype - from LinearMap.ker_domRestrict _ _, - Submodule.map_comap_subtype, ← crossingStage_eq_inf a ha] - have hi : Module.finrank k f.range = RankMatching.blockRank (matrixOf a) (J + 1) N := by - rw [quotientProjection_stage_range, ← RankMatching.blockRank_eq_finrank _ (matrixOf_triangular a ha)] - rw [hk,hi,imageModulo_finrank_partition a ha] at hr - omega - -def crossingSpace (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : - Submodule k (LaurentSeries k ⧸ stageImage a J) := - (a.range ⊓ poleLattice J).map (stageImage a J).mkQ - -lemma crossingStage_le_space (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : - crossingStage a J N ≤ crossingSpace a J := by - apply Submodule.map_mono - apply inf_le_inf_right - rintro f ⟨g,hg,rfl⟩ - exact ⟨g,rfl⟩ - -lemma crossingSpace_stabilizes [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) - (J : ℤ) (hc : (crossing a J).Finite) : - ∃ N : ℤ, J ≤ N ∧ crossingSpace a J = crossingStage a J N ∧ - crossingStageMatches (matrixOf a) J N = crossing a J := by - obtain ⟨b,hb⟩ := (hc.image Prod.snd).bddAbove - let N := max J b - have he (M : ℤ) (hM : N ≤ M) : - crossingStageMatches (matrixOf a) J M = crossing a J := by - ext p - constructor - · intro hp - exact ⟨hp.1,hp.2.1,hp.2.2.1⟩ - · intro hp - exact ⟨hp.1,hp.2.1,hp.2.2,le_trans (hb ⟨p,hp,rfl⟩) (le_trans (le_max_right J b) hM)⟩ - refine ⟨N, le_max_left _ _, ?_, he N le_rfl⟩ - apply le_antisymm _ (crossingStage_le_space a J N) - rintro z ⟨f,⟨⟨x,hx⟩,hf⟩,rfl⟩ - obtain ⟨M,hM⟩ := exists_poleLattice x - have heq : crossingStage a J N = crossingStage a J (max N M) := by - let := crossingStage_finite a J (max N M) - apply Submodule.eq_of_le_of_finrank_eq (crossingStage_mono a J (le_max_left _ _)) - rw [crossingStage_finrank a ha, crossingStage_finrank a ha, - he N le_rfl, he (max N M) (le_max_left _ _)] - rw [heq] - exact ⟨f,⟨⟨x,poleLattice_mono (le_max_right N M) hM,hx⟩,hf⟩,rfl⟩ - -def crossingQuotientEquiv (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : - crossingQuotient a J ≃ₗ[k] crossingSpace a J := by - let I := a.range ⊓ poleLattice (k := k) J - let f := (stageImage a J).mkQ.domRestrict I - have hk : f.ker = (stageImage a J).comap I.subtype := by - rw [LinearMap.ker_domRestrict, Submodule.ker_mkQ] - exact (Submodule.quotEquivOfEq _ _ hk.symm).trans - (f.quotKerEquivRange.trans (LinearEquiv.ofEq _ _ (LinearMap.range_domRestrict _ _))) - -theorem crossing_dimension [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) - (hc : ∀ J, (crossing a J).Finite) (J : ℤ) : - FiniteDimensional k (crossingQuotient a J) ∧ - Module.finrank k (crossingQuotient a J) = (crossing a J).ncard := by - obtain ⟨N,hN,he,hcN⟩ := crossingSpace_stabilizes a ha J (hc J) - have : FiniteDimensional k (crossingSpace a J) := by - rw [he] - exact crossingStage_finite a J N - refine ⟨(crossingQuotientEquiv a J).symm.finiteDimensional, ?_⟩ - rw [(crossingQuotientEquiv a J).finrank_eq, he, crossingStage_finrank a ha, hcN] - -lemma range_inf_stabilizes [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) - (J : ℤ) (hc : (crossing a J).Finite) : - ∃ N : ℤ, a.range ⊓ poleLattice J = stageImage a N ⊓ poleLattice J := by - obtain ⟨N,hN,he,_⟩ := crossingSpace_stabilizes a ha J hc - refine ⟨N,le_antisymm ?_ ?_⟩ - · intro f hf - have hq : (stageImage a J).mkQ f ∈ crossingStage a J N := by - rw [← he] - exact ⟨f,hf,rfl⟩ - have hi : (stageImage a J).mkQ f ∈ imageModulo a J N := - (Submodule.map_mono (show stageImage a N ⊓ poleLattice J ≤ stageImage a N - from inf_le_left)) hq - exact ⟨(mem_imageModulo a hN f).mp hi,hf.2⟩ - · rintro f ⟨⟨x,hx,rfl⟩,hf⟩ - exact ⟨⟨x,rfl⟩,hf⟩ - -lemma isCompact_range_inter_poleLattice [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) - (J : ℤ) (hc : (crossing a J).Finite) : - IsCompact ((Set.range a) ∩ (poleLattice (k := k) J : Set (LaurentSeries k))) := by - obtain ⟨N,he⟩ := range_inf_stabilizes a ha J hc - change IsCompact (↑(a.range ⊓ poleLattice J) : Set (LaurentSeries k)) - rw [he] - change IsCompact ((a '' (poleLattice (k := k) N : Set (LaurentSeries k))) ∩ - (poleLattice (k := k) J : Set (LaurentSeries k))) - exact ((isCompact_poleLattice N).image (continuous_of_preservesPoles a ha)).inter_right - (isClosed_poleLattice J) - -theorem closed_image [Finite k] - (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) - (hc : ∀ J, (crossing a J).Finite) : - IsClosed (Set.range a) := by - rw [← isOpen_compl_iff, isOpen_iff_forall_mem_open] - intro f hf - obtain ⟨J,hJ⟩ := exists_poleLattice f - refine ⟨(poleLattice (k := k) J : Set (LaurentSeries k)) ∩ - ((Set.range a) ∩ (poleLattice (k := k) J : Set (LaurentSeries k)))ᶜ, ?_, ?_, ?_⟩ - · intro g hg hga - exact hg.2 ⟨hga,hg.1⟩ - · exact (isOpen_poleLattice J).inter - (isCompact_range_inter_poleLattice a ha J (hc J)).isClosed.isOpen_compl - · exact ⟨hJ,fun h => hf h.1⟩ - -end HahnWilson.PivotTopology - -end - -end OAI +import OAI.LinearAlgebra.RankMatching.Basic + +namespace OAI + +noncomputable section +open scoped BigOperators nonZeroDivisors +open LinearMap Submodule +open CategoryTheory CategoryTheory.Limits HomologicalComplex + +namespace HahnWilson.PivotTopology +open HahnSeries +open scoped BigOperators Topology +variable {k : Type*} [Field k] + +def poleLattice (J : ℤ) : Submodule k (LaurentSeries k) where + carrier := {f | ∀ i : ℤ, J < i → f.coeff (-i) = 0} + zero_mem' := by simp + add_mem' hf hg i hi := by simp [hf i hi, hg i hi] + smul_mem' c f hf i hi := by simp [hf i hi] + +def monomial (j : ℤ) : LaurentSeries k := HahnSeries.single (-j) 1 + +def PreservesPoles (a : LaurentSeries k →ₗ[k] LaurentSeries k) : Prop := + ∀ J, ∀ f ∈ poleLattice (k := k) J, a f ∈ poleLattice (k := k) J + +def matrixOf (a : LaurentSeries k →ₗ[k] LaurentSeries k) : Matrix ℤ ℤ k := + fun l j => (a (monomial j)).coeff (-l) + +def HasLeadingTerm (f : LaurentSeries k) (j : ℤ) : Prop := + f ∈ poleLattice (k := k) j ∧ f.coeff (-j) = 1 + +def HasLeadingPosition (f : LaurentSeries k) (j : ℤ) : Prop := + f ∈ poleLattice (k := k) j ∧ f.coeff (-j) ≠ 0 + +def crossing (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : Set (ℤ × ℤ) := + {p | RankMatching.Matched (matrixOf a) p.1 p.2 ∧ p.1 ≤ J ∧ J < p.2} + +def crossingQuotient (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) := + ↥(LinearMap.range a ⊓ poleLattice (k := k) J) ⧸ + Submodule.comap (LinearMap.range a ⊓ poleLattice (k := k) J).subtype + ((poleLattice (k := k) J).map a) + +instance crossingQuotient_addCommGroup (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : + AddCommGroup (crossingQuotient a J) := by + unfold crossingQuotient + infer_instance + +instance crossingQuotient_module (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : + Module k (crossingQuotient a J) := by + unfold crossingQuotient + infer_instance + +@[simp] lemma mem_poleLattice (J : ℤ) (f : LaurentSeries k) : + f ∈ poleLattice J ↔ ∀ i : ℤ, J < i → f.coeff (-i) = 0 := Iff.rfl + +lemma poleLattice_mono {I J : ℤ} (h : I ≤ J) : + poleLattice (k := k) I ≤ poleLattice J := by + intro f hf i hi + exact hf i (lt_of_le_of_lt h hi) + +@[simp] lemma coeff_monomial (j i : ℤ) : + (monomial (k := k) j).coeff (-i) = if i = j then 1 else 0 := by + simp [monomial, HahnSeries.coeff_single] + +lemma monomial_mem {j J : ℤ} (h : j ≤ J) : monomial (k := k) j ∈ poleLattice J := by + intro i hi + simp [show i ≠ j by omega] + +lemma exists_poleLattice (f : LaurentSeries k) : ∃ J, f ∈ poleLattice J := by + refine ⟨-f.order, ?_⟩ + intro i hi + exact HahnSeries.coeff_eq_zero_of_lt_order (by omega) + +lemma matrixOf_triangular (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) : RankMatching.Triangular (matrixOf a) := by + intro l j h + exact ha j (monomial j) (monomial_mem le_rfl) l h + +def truncate (f : LaurentSeries k) (L J : ℤ) : LaurentSeries k := + ∑ c ∈ Finset.Icc L J, f.coeff (-c) • monomial c + +lemma coeff_truncate (f : LaurentSeries k) (L J i : ℤ) : + (truncate f L J).coeff (-i) = if L ≤ i ∧ i ≤ J then f.coeff (-i) else 0 := by + classical + simp [truncate, HahnSeries.coeff_sum, HahnSeries.coeff_smul, smul_eq_mul, + mul_ite] + +lemma truncate_mem (f : LaurentSeries k) (L J : ℤ) : truncate f L J ∈ poleLattice J := by + intro i hi + rw [coeff_truncate, ite_eq_right (by omega)] + +lemma sub_truncate_mem {f : LaurentSeries k} {L J : ℤ} (hf : f ∈ poleLattice J) : + f - truncate f L J ∈ poleLattice (L - 1) := by + intro i hi + rw [HahnSeries.coeff_sub, coeff_truncate] + by_cases hij : i ≤ J + · rw [ite_eq_left (by omega), sub_self] + · rw [ite_eq_right (by omega), sub_zero, hf i (by omega)] + +def poleProjection (L : ℤ) : LaurentSeries k →ₗ[k] (ℤ → k) where + toFun f i := if L ≤ i then f.coeff (-i) else 0 + map_add' f g := by ext i; by_cases hi : L ≤ i <;> simp [hi] + map_smul' c f := by ext i; by_cases hi : L ≤ i <;> simp [hi] + +lemma poleProjection_eq_zero {L : ℤ} {f : LaurentSeries k} : + poleProjection L f = 0 ↔ f ∈ poleLattice (L - 1) := by + constructor + · intro h i hi + have := congrFun h i + simpa [poleProjection, show L ≤ i by omega] using this + · intro h + ext i + by_cases hi : L ≤ i + · simp [poleProjection, hi, h i (by omega)] + · simp [poleProjection, hi] + +@[simp] lemma poleProjection_monomial_image + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (L j : ℤ) : + poleProjection L (a (monomial j)) = RankMatching.column (matrixOf a) L j := rfl + +lemma poleProjection_truncate_image (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) {f : LaurentSeries k} {L J : ℤ} + (hf : f ∈ poleLattice J) : + poleProjection L (a (truncate f L J)) = poleProjection L (a f) := by + have h := (poleProjection_eq_zero).mpr (ha (L - 1) _ (sub_truncate_mem hf)) + rw [map_sub, map_sub, sub_eq_zero] at h + exact h.symm + +lemma columnSpace_eq_projectedImage (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) (L J : ℤ) : + RankMatching.columnSpace (matrixOf a) L J = + ((poleLattice J).map a).map (poleProjection L) := by + classical + apply le_antisymm + · apply Submodule.span_le.mpr + rintro _ ⟨c, hc, rfl⟩ + exact ⟨a (monomial c), ⟨monomial c, monomial_mem hc, rfl⟩, rfl⟩ + · rintro y ⟨z, ⟨f,hf,rfl⟩,rfl⟩ + rw [← poleProjection_truncate_image a ha hf] + simp only [truncate, map_sum, map_smul] + exact Submodule.sum_mem _ fun c hc => + Submodule.smul_mem _ _ (Submodule.subset_span + ⟨c, (Finset.mem_Icc.mp hc).2, rfl⟩) + +lemma increment_zero_iff_finite_solution + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (L j : ℤ) : + RankMatching.increment (matrixOf a) L j = 0 ↔ + ∃ f, HasLeadingTerm f j ∧ a f ∈ poleLattice (L - 1) := by + rw [RankMatching.increment_eq_zero_iff, columnSpace_eq_projectedImage a ha] + constructor + · rintro ⟨z, ⟨g,hg,rfl⟩,heq⟩ + refine ⟨monomial j - g, ⟨?_, ?_⟩, ?_⟩ + · intro i hi + simp only [HahnSeries.coeff_sub, coeff_monomial, + ite_eq_right (show i ≠ j by omega), hg i (by omega), sub_self] + · simp [HahnSeries.coeff_sub, hg j (by omega)] + · apply poleProjection_eq_zero.mp + rw [map_sub, map_sub, poleProjection_monomial_image, ← heq, sub_self] + · rintro ⟨f, ⟨hf,hfj⟩,haf⟩ + have hg : monomial j - f ∈ poleLattice (j - 1) := by + intro i hi + by_cases hij : i = j + · subst i; simp [HahnSeries.coeff_sub, hfj] + · simp [HahnSeries.coeff_sub, coeff_monomial, hij, hf i (by omega)] + refine ⟨a (monomial j - f), ⟨monomial j - f, hg, rfl⟩, ?_⟩ + rw [map_sub, map_sub, poleProjection_monomial_image, + poleProjection_eq_zero.mpr haf, sub_zero] + +open WithZero + +lemma mem_poleLattice_iff_valuation (J : ℤ) (f : LaurentSeries k) : + f ∈ poleLattice J ↔ Valued.v f ≤ WithZero.exp J := by + rw [show J = -(-J) by omega, LaurentSeries.valuation_le_iff_coeff_lt_eq_zero] + constructor + · intro hf n hn + simpa using hf (-n) (by omega) + · intro hf i hi + exact hf (-i) (by omega) + +lemma poleLattice_eq_ball (J : ℤ) : + (poleLattice (k := k) J : Set (LaurentSeries k)) = + {f | (Valued.v : Valuation (LaurentSeries k) ℤᵐ⁰).restrict f ≤ + (Valued.v : Valuation (LaurentSeries k) ℤᵐ⁰).restrict (monomial J)} := by + ext f + change f ∈ poleLattice J ↔ (Valued.v : Valuation (LaurentSeries k) ℤᵐ⁰).restrict f ≤ + (Valued.v : Valuation (LaurentSeries k) ℤᵐ⁰).restrict (monomial J) + rw [Valuation.restrict_le_iff, mem_poleLattice_iff_valuation] + simp [monomial, LaurentSeries.valuation_single_zpow] + +lemma isClosed_poleLattice (J : ℤ) : IsClosed (poleLattice (k := k) J : Set (LaurentSeries k)) := by + rw [poleLattice_eq_ball] + exact Valued.isClosed_closedBall _ _ + +lemma isOpen_poleLattice (J : ℤ) : IsOpen (poleLattice (k := k) J : Set (LaurentSeries k)) := by + rw [poleLattice_eq_ball] + apply Valued.isOpen_closedBall + rw [ne_eq, Valuation.restrict_eq_zero_iff] + simp [monomial, LaurentSeries.valuation_single_zpow] + +lemma poleLattice_nhds_basis : + (𝓝 (0 : LaurentSeries k)).HasBasis (fun _ : ℤ => True) + (fun J => (poleLattice (k := k) J : Set (LaurentSeries k))) := by + let v : Valuation (LaurentSeries k) ℤᵐ⁰ := Valued.v + apply (Valued.hasBasis_nhds_zero (LaurentSeries k) ℤᵐ⁰).to_hasBasis + · intro γ _ + let r : ℤᵐ⁰ := MonoidWithZeroHom.ValueGroup₀.embedding γ.val + have hr : r ≠ 0 := (Units.map + (MonoidWithZeroHom.ValueGroup₀.embedding (f := .ofClass v)).toMonoidHom γ).ne_zero + refine ⟨WithZero.log r - 1, trivial, ?_⟩ + intro f hf + rw [Set.mem_ofPred_eq, Valuation.restrict_lt_iff_lt_embedding] + apply (mem_poleLattice_iff_valuation _ f).mp hf |>.trans_lt + change WithZero.exp (WithZero.log r - 1) < r + calc + _ < WithZero.exp (WithZero.log r) := WithZero.exp_lt_exp.mpr (by omega) + _ = r := WithZero.exp_log hr + · intro J _ + have hn : v.restrict (monomial J) ≠ 0 := by + rw [ne_eq, Valuation.restrict_eq_zero_iff] + simp [v, monomial, LaurentSeries.valuation_single_zpow] + refine ⟨Units.mk0 _ hn, trivial, ?_⟩ + intro f hf + rw [poleLattice_eq_ball] + change v.restrict f < v.restrict (monomial J) at hf + exact hf.le + +lemma continuous_of_preservesPoles (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) : Continuous a := by + apply continuous_of_continuousAt_zero a + simp only [ContinuousAt, map_zero] + rw [poleLattice_nhds_basis.tendsto_iff poleLattice_nhds_basis] + exact fun J _ => ⟨J, trivial, ha J⟩ + +lemma continuous_of_bounded_coefficients [UniformSpace k] [DiscreteTopology k] + {X : Type*} [TopologicalSpace X] (g : X → LaurentSeries k) (J : ℤ) + (hg : ∀ x, g x ∈ poleLattice J) + (hcoeff : ∀ n : ℤ, Continuous (fun x => (g x).coeff n)) : Continuous g := by + rw [continuous_iff_continuousAt] + intro x + apply tendsto_sub_nhds_zero_iff.mp + rw [poleLattice_nhds_basis.tendsto_right_iff] + intro M _ + have hev : ∀ᶠ y in 𝓝 x, ∀ i ∈ Finset.Ioc M J, + (g y).coeff (-i) = (g x).coeff (-i) := by + rw [Filter.eventually_all_finset] + intro i _ + exact (hcoeff (-i)).continuousAt.eventually + ((isOpen_discrete {(g x).coeff (-i)}).mem_nhds rfl) + filter_upwards [hev] with y hy + intro i hi + rw [HahnSeries.coeff_sub, sub_eq_zero] + by_cases hij : i ≤ J + · exact hy i (Finset.mem_Ioc.mpr ⟨hi,hij⟩) + · rw [hg y i (by omega), hg x i (by omega)] + +def stageSeries (J : ℤ) (c : ℤ → k) : LaurentSeries k := + HahnSeries.ofSuppBddBelow (fun n => if -J ≤ n then c n else 0) + ⟨-J, by + intro n hn + by_contra h + exact hn (ite_eq_right h)⟩ + +@[simp] lemma coeff_stageSeries (J : ℤ) (c : ℤ → k) (n : ℤ) : + (stageSeries J c).coeff n = if -J ≤ n then c n else 0 := rfl + +lemma stageSeries_mem (J : ℤ) (c : ℤ → k) : stageSeries J c ∈ poleLattice J := by + intro i hi + rw [coeff_stageSeries, ite_eq_right (by omega)] + +lemma range_stageSeries (J : ℤ) : + Set.range (stageSeries (k := k) J) = (poleLattice (k := k) J : Set (LaurentSeries k)) := by + ext f + constructor + · rintro ⟨c,rfl⟩ + exact stageSeries_mem J c + · intro hf + refine ⟨f.coeff, ?_⟩ + apply HahnSeries.ext + funext n + rw [coeff_stageSeries] + split_ifs with hn + · rfl + · symm + simpa using hf (-n) (by omega) + +lemma continuous_stageSeries [UniformSpace k] [DiscreteTopology k] (J : ℤ) : + Continuous (stageSeries (k := k) J) := by + apply continuous_of_bounded_coefficients _ J (stageSeries_mem J) + intro n + simp only [coeff_stageSeries] + split_ifs + · exact continuous_apply n + · exact continuous_const + +lemma isCompact_poleLattice [Finite k] (J : ℤ) : + IsCompact (poleLattice (k := k) J : Set (LaurentSeries k)) := by + let : UniformSpace k := ⊥ + rw [← range_stageSeries, ← Set.image_univ] + exact isCompact_univ.image (continuous_stageSeries J) + +lemma isCompact_leadingTerm [Finite k] (j : ℤ) : + IsCompact {f : LaurentSeries k | HasLeadingTerm f j} := by + let : UniformSpace k := ⊥ + exact (isCompact_poleLattice j).inter_right + (isClosed_eq (LaurentSeries.uniformContinuous_coeff (-j)).continuous continuous_const) + +lemma isClosed_leadingTerm (j : ℤ) : + IsClosed {f : LaurentSeries k | HasLeadingTerm f j} := by + let : UniformSpace k := ⊥ + exact (isClosed_poleLattice j).inter + (isClosed_eq (LaurentSeries.uniformContinuous_coeff (-j)).continuous continuous_const) + +lemma unmatched_iff_increments_zero (A : Matrix ℤ ℤ k) + (hA : RankMatching.Triangular A) (j : ℤ) : + (∀ l, ¬ RankMatching.Matched A l j) ↔ ∀ L, RankMatching.increment A L j = 0 := by + constructor + · intro h L + by_cases hLj : L ≤ j + · have hw : ∀ l, RankMatching.weight A l j = 0 := fun l => + (RankMatching.weight_zero_or_one A hA l j).resolve_right (h l) + have hs := RankMatching.sum_interval_difference + (fun l => (RankMatching.increment A l j : ℤ)) L j (by omega) + simp_rw [← RankMatching.weight_eq_increment_sub A hA, hw] at hs + rw [RankMatching.increment_zero A hA (show j < j + 1 by omega)] at hs + simpa using hs.symm + · exact RankMatching.increment_zero A hA (by omega) + · intro h l hm + have hi := (RankMatching.matched_iff_increments A hA l j).mp hm + rw [h l] at hi + exact Nat.zero_ne_one hi.1 + +theorem unmatched_iff_kernel [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (j : ℤ) : + (∀ l, ¬ RankMatching.Matched (matrixOf a) l j) ↔ + ∃ f, a f = 0 ∧ HasLeadingTerm f j := by + rw [unmatched_iff_increments_zero _ (matrixOf_triangular a ha)] + constructor + · intro h + let S : ℤ → Set (LaurentSeries k) := fun L => + {f | HasLeadingTerm f j ∧ a f ∈ poleLattice (L - 1)} + have hc : ∀ L, IsClosed (S L) := fun L => + (isClosed_leadingTerm j).inter + ((isClosed_poleLattice (L - 1)).preimage (continuous_of_preservesPoles a ha)) + have hk : ∀ L, IsCompact (S L) := fun L => + (isCompact_leadingTerm j).of_isClosed_subset (hc L) (fun _ h => h.1) + have hn : ∀ L, (S L).Nonempty := fun L => + (increment_zero_iff_finite_solution a ha L j).mp (h L) + have hd : Directed (fun s t : Set (LaurentSeries k) => s ⊇ t) S := by + intro L M + refine ⟨min L M, ?_, ?_⟩ + · intro f hf + exact ⟨hf.1, poleLattice_mono (by omega) hf.2⟩ + · intro f hf + exact ⟨hf.1, poleLattice_mono (by omega) hf.2⟩ + obtain ⟨f,hf⟩ := IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed S hd hn hk hc + have hf' : ∀ L, f ∈ S L := Set.mem_iInter.mp hf + refine ⟨f, ?_, (hf' j).1⟩ + apply HahnSeries.ext + funext n + simpa using (hf' (-n)).2 (-n) (by omega) + · rintro ⟨f,haf,hfj⟩ L + apply (increment_zero_iff_finite_solution a ha L j).mpr + exact ⟨f,hfj,haf ▸ (poleLattice (L - 1)).zero_mem⟩ + +lemma rowRank_step (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) (l J : ℤ) : + RankMatching.blockRank A l J = RankMatching.blockRank A (l + 1) J + + RankMatching.increment (RankMatching.reflected A) (-J) (-l) := by + have h := RankMatching.blockRank_step (RankMatching.reflected A) + (RankMatching.triangular_reflected A hA) (-J) (-l) + simpa only [RankMatching.blockRank_reflected, neg_neg, neg_sub, + Int.reduceNeg, sub_neg_eq_add, add_comm] using h + +lemma matchedRow_iff_unequal_ranks (A : Matrix ℤ ℤ k) + (hA : RankMatching.Triangular A) (l : ℤ) : + (∃ j, RankMatching.Matched A l j) ↔ + ∃ J, RankMatching.blockRank A l J ≠ RankMatching.blockRank A (l + 1) J := by + have hn : (∀ j, ¬ RankMatching.Matched A l j) ↔ + ∀ J, RankMatching.blockRank A l J = RankMatching.blockRank A (l + 1) J := by + have hh := unmatched_iff_increments_zero (RankMatching.reflected A) + (RankMatching.triangular_reflected A hA) (-l) + constructor + · intro h J + have hh' : ∀ r, ¬ RankMatching.Matched (RankMatching.reflected A) r (-l) := by + intro r hr + apply h (-r) + simpa only [RankMatching.Matched, RankMatching.weight_reflected, neg_neg] using hr + rw [rowRank_step A hA l J, hh.mp hh' (-J), add_zero] + · intro h j hm + have hh' : ∀ r, RankMatching.increment (RankMatching.reflected A) r (-l) = 0 := by + intro r + have hs := rowRank_step A hA l (-r) + rw [neg_neg, h (-r)] at hs + omega + apply hh.mpr hh' (-j) + simpa only [RankMatching.Matched, RankMatching.weight_reflected, neg_neg] using hm + simpa only [not_forall, not_not] using not_congr hn + +lemma exists_rowCut_kernel_of_unequal_ranks (A : Matrix ℤ ℤ k) + (hA : RankMatching.Triangular A) (l J : ℤ) + (hr : RankMatching.blockRank A l J ≠ RankMatching.blockRank A (l + 1) J) : + ∃ v ∈ RankMatching.columnSpace A l J, + RankMatching.rowCut (l + 1) v = 0 ∧ v l ≠ 0 := by + let F : RankMatching.columnSpace A l J →ₗ[k] RankMatching.columnSpace A (l + 1) J := + (RankMatching.rowCut (l + 1)).restrict + (fun _ hv => RankMatching.rowCut_columnSpace A (by omega) J hv) + have hs : Function.Surjective F := by + intro v + have hm : (v : ℤ → k) ∈ (RankMatching.columnSpace A l J).map + (RankMatching.rowCut (l + 1)) := by + rw [RankMatching.rowCut_map_columnSpace A (by omega)] + exact v.property + obtain ⟨w,hw,he⟩ := Submodule.mem_map.mp hm + exact ⟨⟨w,hw⟩, Subtype.ext he⟩ + have hni : ¬ Function.Injective F := by + intro hi + apply hr + have he := (LinearEquiv.ofBijective F ⟨hi,hs⟩).finrank_eq + simpa only [RankMatching.blockRank_eq_finrank A hA] using he + have hk : F.ker ≠ ⊥ := fun h => hni (LinearMap.ker_eq_bot.mp h) + obtain ⟨v,hv,hvz⟩ := F.ker.ne_bot_iff.mp hk + have hcut : RankMatching.rowCut (l + 1) (v : ℤ → k) = 0 := + congrArg Subtype.val (show F v = 0 from hv) + refine ⟨v, v.property, hcut, ?_⟩ + intro hvl + apply hvz + apply Subtype.ext + funext r + rcases lt_trichotomy r l with hlt | heq | hgt + · exact RankMatching.columnSpace_supported A l J v.property hlt + · simpa [heq] using hvl + · have he := congrFun hcut r + simpa [RankMatching.rowCut, hgt] using he + +theorem matched_row_iff_image + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (l : ℤ) : + (∃ j, RankMatching.Matched (matrixOf a) l j) ↔ + ∃ f, HasLeadingPosition (a f) l := by + rw [matchedRow_iff_unequal_ranks _ (matrixOf_triangular a ha)] + constructor + · rintro ⟨J,hJ⟩ + obtain ⟨v,hv,hcut,hvl⟩ := exists_rowCut_kernel_of_unequal_ranks + (matrixOf a) (matrixOf_triangular a ha) l J hJ + rw [columnSpace_eq_projectedImage a ha] at hv + obtain ⟨z,⟨f,hf,rfl⟩,rfl⟩ := hv + refine ⟨f, ?_, ?_⟩ + · intro i hi + have he := congrFun hcut i + simpa [RankMatching.rowCut, poleProjection, hi, + show l ≤ i by omega] using he + · simpa [poleProjection] using hvl + · rintro ⟨f,hf,hfl⟩ + obtain ⟨J,hJ⟩ := exists_poleLattice f + refine ⟨J, ?_⟩ + intro heq + have hv : poleProjection l (a f) ∈ RankMatching.columnSpace (matrixOf a) l J := by + rw [columnSpace_eq_projectedImage a ha] + exact ⟨a f,⟨f,hJ,rfl⟩,rfl⟩ + have hcut : RankMatching.rowCut (l + 1) (poleProjection l (a f)) = 0 := by + ext i + by_cases hi : l + 1 ≤ i + · simp [RankMatching.rowCut, poleProjection, show l ≤ i by omega, + hf i (by omega)] + · simp [RankMatching.rowCut, show ¬ l < i by omega] + have hi := RankMatching.rowCut_injOn_of_equal_ranks + (matrixOf a) (matrixOf_triangular a ha) l J heq + have he : poleProjection l (a f) = 0 := hi hv (Submodule.zero_mem _) (by simpa using hcut) + apply hfl + simpa [poleProjection] using congrFun he l + +def stageImage (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : + Submodule k (LaurentSeries k) := (poleLattice J).map a + +lemma stageImage_mono (a : LaurentSeries k →ₗ[k] LaurentSeries k) : Monotone (stageImage a) := by + intro I J h + exact Submodule.map_mono (poleLattice_mono h) + +lemma stageImage_le_poleLattice (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) (J : ℤ) : stageImage a J ≤ poleLattice J := by + rintro z ⟨f,hf,rfl⟩ + exact ha J f hf + +lemma stageImage_step (a : LaurentSeries k →ₗ[k] LaurentSeries k) (j : ℤ) : + stageImage a j = stageImage a (j - 1) ⊔ Submodule.span k {a (monomial j)} := by + apply le_antisymm + · rintro z ⟨f,hf,rfl⟩ + have ht : f - f.coeff (-j) • monomial j ∈ poleLattice (j - 1) := by + intro i hi + by_cases hij : i = j + · subst i; simp [HahnSeries.coeff_sub, HahnSeries.coeff_smul] + · simp [HahnSeries.coeff_sub, HahnSeries.coeff_smul, coeff_monomial, hij, + hf i (by omega)] + apply Submodule.mem_sup.mpr + refine ⟨a (f - f.coeff (-j) • monomial j), ⟨_,ht,rfl⟩, + f.coeff (-j) • a (monomial j), + Submodule.smul_mem _ _ (Submodule.subset_span (Set.mem_singleton _)), ?_⟩ + simp + · apply sup_le (stageImage_mono a (by omega)) + rw [Submodule.span_singleton_le_iff_mem] + exact ⟨monomial j, monomial_mem le_rfl, rfl⟩ + +lemma monomial_image_mem_iff_unmatched [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (j : ℤ) : + a (monomial j) ∈ stageImage a (j - 1) ↔ + ∀ l, ¬ RankMatching.Matched (matrixOf a) l j := by + rw [unmatched_iff_kernel a ha] + constructor + · rintro ⟨g,hg,he⟩ + refine ⟨monomial j - g, by simp [he], ?_, ?_⟩ + · intro i hi + simp [HahnSeries.coeff_sub, coeff_monomial, show i ≠ j by omega, hg i (by omega)] + · simp [HahnSeries.coeff_sub, hg j (by omega)] + · rintro ⟨f,haf,hf,hfj⟩ + refine ⟨monomial j - f, ?_, by simp [haf]⟩ + intro i hi + by_cases hij : i = j + · subst i; simp [HahnSeries.coeff_sub, hfj] + · simp [HahnSeries.coeff_sub, coeff_monomial, hij, hf i (by omega)] + +def imageModulo (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : + Submodule k (LaurentSeries k ⧸ stageImage a J) := + (stageImage a N).map (stageImage a J).mkQ + +lemma imageModulo_mono (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : + Monotone (imageModulo a J) := fun _ _ h => Submodule.map_mono (stageImage_mono a h) + +lemma imageModulo_zero (a : LaurentSeries k →ₗ[k] LaurentSeries k) {J N : ℤ} (h : N ≤ J) : + imageModulo a J N = ⊥ := by + apply le_antisymm _ bot_le + rw [imageModulo, Submodule.map_le_iff_le_comap, Submodule.comap_bot, Submodule.ker_mkQ] + exact stageImage_mono a h + +lemma imageModulo_step (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J n : ℤ) : + imageModulo a J n = imageModulo a J (n - 1) ⊔ + Submodule.span k {(stageImage a J).mkQ (a (monomial n))} := by + rw [imageModulo, stageImage_step a n, Submodule.map_sup, Submodule.map_span, Set.image_singleton] + rfl + +lemma imageModulo_finite (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : + FiniteDimensional k (imageModulo a J N) := by + by_cases h : J ≤ N + · induction N, h using Int.leInduction with + | base => rw [imageModulo_zero a le_rfl]; infer_instance + | succ n hn ih => + rw [imageModulo_step, add_sub_cancel_right] + let := ih + infer_instance + · rw [imageModulo_zero a (by omega)] + infer_instance + +lemma mem_imageModulo (a : LaurentSeries k →ₗ[k] LaurentSeries k) {J N : ℤ} + (h : J ≤ N) (f : LaurentSeries k) : + (stageImage a J).mkQ f ∈ imageModulo a J N ↔ f ∈ stageImage a N := by + change f ∈ ((stageImage a N).map (stageImage a J).mkQ).comap (stageImage a J).mkQ ↔ _ + rw [Submodule.comap_map_eq, Submodule.ker_mkQ, sup_eq_left.mpr (stageImage_mono a h)] + +open scoped Classical + +lemma imageModulo_finrank_step [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) {J n : ℤ} + (h : J < n) : + Module.finrank k (imageModulo a J n) = Module.finrank k (imageModulo a J (n - 1)) + + if ∃ l, RankMatching.Matched (matrixOf a) l n then 1 else 0 := by + classical + let := imageModulo_finite a J (n - 1) + rw [imageModulo_step, RankMatching.finrank_sup_singleton, + mem_imageModulo a (by omega), monomial_image_mem_iff_unmatched a ha] + by_cases hm : ∃ l, RankMatching.Matched (matrixOf a) l n + · have hn : ¬ (∀ l, ¬ RankMatching.Matched (matrixOf a) l n) := + fun hh => hh hm.choose hm.choose_spec + simp [hm, hn] + · simp [show ∀ l, ¬ RankMatching.Matched (matrixOf a) l n from fun l hl => hm ⟨l,hl⟩] + +lemma imageModulo_finrank [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (J N : ℤ) : + Module.finrank k (imageModulo a J N) = + ∑ j ∈ Finset.Ioc J N, if ∃ l, RankMatching.Matched (matrixOf a) l j then 1 else 0 := by + classical + by_cases h : J ≤ N + · induction N, h using Int.leInduction with + | base => rw [imageModulo_zero a (J := J) (N := J) le_rfl, finrank_bot]; simp + | succ n hn ih => + have he : Finset.Ioc J (n + 1) = insert (n + 1) (Finset.Ioc J n) := by + ext i + simp only [Finset.mem_Ioc, Finset.mem_insert] + omega + rw [imageModulo_finrank_step a ha (by omega), add_sub_cancel_right, ih, + he, Finset.sum_insert (by simp)] + omega + · rw [imageModulo_zero a (by omega), finrank_bot, Finset.Ioc_eq_empty_of_le (by omega), + Finset.sum_empty] + +lemma matched_le (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) {l j : ℤ} + (h : RankMatching.Matched A l j) : l ≤ j := by + by_contra hn + have hz := RankMatching.increment_zero A hA (lt_of_not_ge hn) + have ho := ((RankMatching.matched_iff_increments A hA l j).mp h).1 + omega + +def columnMatches (A : Matrix ℤ ℤ k) (J N : ℤ) : Set (ℤ × ℤ) := + {p | RankMatching.Matched A p.1 p.2 ∧ J < p.2 ∧ p.2 ≤ N} + +def crossingStageMatches (A : Matrix ℤ ℤ k) (J N : ℤ) : Set (ℤ × ℤ) := + {p | RankMatching.Matched A p.1 p.2 ∧ p.1 ≤ J ∧ J < p.2 ∧ p.2 ≤ N} + +lemma columnMatches_snd_inj (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) + (J N : ℤ) : Set.InjOn Prod.snd (columnMatches A J N) := by + rintro ⟨l,j⟩ hp ⟨l',j'⟩ hq he + change j = j' at he + subst j' + exact Prod.ext (RankMatching.column_unique A hA hp.1 hq.1) rfl + +lemma columnMatches_finite (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) + (J N : ℤ) : (columnMatches A J N).Finite := by + exact Set.Finite.of_injOn (fun _ hp => hp.2) (columnMatches_snd_inj A hA J N) + (Set.finite_Ioc J N) + +lemma columnMatches_ncard (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) + (J N : ℤ) : (columnMatches A J N).ncard = + ∑ j ∈ Finset.Ioc J N, if ∃ l, RankMatching.Matched A l j then 1 else 0 := by + classical + have he : Prod.snd '' columnMatches A J N = + ↑((Finset.Ioc J N).filter (fun j => ∃ l, RankMatching.Matched A l j)) := by + ext j + simp only [Set.mem_image, columnMatches, Set.mem_ofPred_eq, Finset.mem_coe, + Finset.mem_filter, Finset.mem_Ioc] + constructor + · rintro ⟨⟨l,j'⟩,⟨hm,hJ,hN⟩,rfl⟩ + exact ⟨⟨hJ,hN⟩,l,hm⟩ + · rintro ⟨⟨hJ,hN⟩,l,hm⟩ + exact ⟨(l,j),⟨hm,hJ,hN⟩,rfl⟩ + rw [← (columnMatches_snd_inj A hA J N).ncard_image, he, + Set.ncard_coe_finset, Finset.sum_boole] + rfl + +lemma columnMatches_partition (A : Matrix ℤ ℤ k) (hA : RankMatching.Triangular A) + (J N : ℤ) : + (columnMatches A J N).ncard = (crossingStageMatches A J N).ncard + + RankMatching.blockRank A (J + 1) N := by + classical + let high := ((Finset.Icc (J + 1) N ×ˢ Finset.Icc (J + 1) N).filter + (fun p : ℤ × ℤ => RankMatching.Matched A p.1 p.2)) + have he : columnMatches A J N = crossingStageMatches A J N ∪ (high : Set (ℤ × ℤ)) := by + ext p + simp only [columnMatches, crossingStageMatches, Set.mem_ofPred_eq, Set.mem_union, + high, Finset.mem_coe, Finset.mem_filter, Finset.mem_product, Finset.mem_Icc] + constructor + · rintro ⟨hm,hJ,hN⟩ + by_cases hl : p.1 ≤ J + · exact Or.inl ⟨hm,hl,hJ,hN⟩ + · have hh := matched_le A hA hm + exact Or.inr ⟨⟨⟨by omega,by omega⟩,⟨by omega,hN⟩⟩,hm⟩ + · rintro (⟨hm,hl,hJ,hN⟩ | ⟨⟨hl,hj⟩,hm⟩) + · exact ⟨hm,hJ,hN⟩ + · exact ⟨hm,by omega,hj.2⟩ + have hd : Disjoint (crossingStageMatches A J N) (high : Set (ℤ × ℤ)) := by + apply Set.disjoint_left.mpr + intro p hp hq + simp only [high, Finset.mem_coe, Finset.mem_filter, Finset.mem_product, + Finset.mem_Icc] at hq + have hh := hp.2.1 + omega + have hf : (crossingStageMatches A J N).Finite := + (columnMatches_finite A hA J N).subset (fun _ h => ⟨h.1,h.2.2⟩) + rw [he, Set.ncard_union_eq hd hf high.finite_toSet, Set.ncard_coe_finset, + RankMatching.rank_eq_count A hA] + rfl + +lemma imageModulo_finrank_partition [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (J N : ℤ) : + Module.finrank k (imageModulo a J N) = + (crossingStageMatches (matrixOf a) J N).ncard + RankMatching.blockRank (matrixOf a) (J + 1) N := by + rw [imageModulo_finrank a ha, ← columnMatches_ncard _ (matrixOf_triangular a ha), + columnMatches_partition _ (matrixOf_triangular a ha)] + +lemma stageImage_le_ker_projection (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) (J : ℤ) : stageImage a J ≤ (poleProjection (J + 1)).ker := by + intro f hf + change poleProjection (J + 1) f = 0 + apply poleProjection_eq_zero.mpr + simpa using stageImage_le_poleLattice a ha J hf + +def quotientProjection (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) (J : ℤ) : + (LaurentSeries k ⧸ stageImage a J) →ₗ[k] (ℤ → k) := + (stageImage a J).liftQ (poleProjection (J + 1)) (stageImage_le_ker_projection a ha J) + +@[simp] lemma quotientProjection_mkQ (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) (J : ℤ) (f : LaurentSeries k) : + quotientProjection a ha J ((stageImage a J).mkQ f) = poleProjection (J + 1) f := rfl + +def crossingStage (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : + Submodule k (LaurentSeries k ⧸ stageImage a J) := + (stageImage a N ⊓ poleLattice J).map (stageImage a J).mkQ + +lemma crossingStage_mono (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : + Monotone (crossingStage a J) := fun _ _ h => + Submodule.map_mono (inf_le_inf_right _ (stageImage_mono a h)) + +lemma crossingStage_finite (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : + FiniteDimensional k (crossingStage a J N) := by + let := imageModulo_finite a J N + exact Submodule.finiteDimensional_of_le (show crossingStage a J N ≤ imageModulo a J N + from Submodule.map_mono inf_le_left) + +lemma crossingStage_eq_inf (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) (J N : ℤ) : + crossingStage a J N = imageModulo a J N ⊓ (quotientProjection a ha J).ker := by + ext z + constructor + · rintro ⟨f,⟨hf,hJ⟩,rfl⟩ + exact ⟨⟨f,hf,rfl⟩, poleProjection_eq_zero.mpr (by simpa using hJ)⟩ + · rintro ⟨⟨f,hf,rfl⟩,hz⟩ + refine ⟨f,⟨hf,?_⟩,rfl⟩ + have he : poleProjection (J + 1) f = 0 := hz + simpa using poleProjection_eq_zero.mp he + +lemma quotientProjection_stage_range (a : LaurentSeries k →ₗ[k] LaurentSeries k) + (ha : PreservesPoles a) (J N : ℤ) : + ((quotientProjection a ha J).domRestrict (imageModulo a J N)).range = + RankMatching.columnSpace (matrixOf a) (J + 1) N := by + rw [LinearMap.range_domRestrict, columnSpace_eq_projectedImage a ha] + ext v + constructor + · rintro ⟨z,⟨f,hf,rfl⟩,rfl⟩ + exact ⟨f,hf,rfl⟩ + · rintro ⟨f,hf,rfl⟩ + exact ⟨(stageImage a J).mkQ f, ⟨f,hf,rfl⟩,rfl⟩ + +lemma crossingStage_finrank [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) (J N : ℤ) : + Module.finrank k (crossingStage a J N) = (crossingStageMatches (matrixOf a) J N).ncard := by + let := imageModulo_finite a J N + let f := (quotientProjection a ha J).domRestrict (imageModulo a J N) + have hr := LinearMap.finrank_range_add_finrank_ker f + have hk : Module.finrank k f.ker = Module.finrank k (crossingStage a J N) := by + rw [← Submodule.finrank_map_subtype_eq (imageModulo a J N) f.ker, + show f.ker = ((quotientProjection a ha J).ker).comap (imageModulo a J N).subtype + from LinearMap.ker_domRestrict _ _, + Submodule.map_comap_subtype, ← crossingStage_eq_inf a ha] + have hi : Module.finrank k f.range = RankMatching.blockRank (matrixOf a) (J + 1) N := by + rw [quotientProjection_stage_range, ← RankMatching.blockRank_eq_finrank _ (matrixOf_triangular a ha)] + rw [hk,hi,imageModulo_finrank_partition a ha] at hr + omega + +def crossingSpace (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : + Submodule k (LaurentSeries k ⧸ stageImage a J) := + (a.range ⊓ poleLattice J).map (stageImage a J).mkQ + +lemma crossingStage_le_space (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J N : ℤ) : + crossingStage a J N ≤ crossingSpace a J := by + apply Submodule.map_mono + apply inf_le_inf_right + rintro f ⟨g,hg,rfl⟩ + exact ⟨g,rfl⟩ + +lemma crossingSpace_stabilizes [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) + (J : ℤ) (hc : (crossing a J).Finite) : + ∃ N : ℤ, J ≤ N ∧ crossingSpace a J = crossingStage a J N ∧ + crossingStageMatches (matrixOf a) J N = crossing a J := by + obtain ⟨b,hb⟩ := (hc.image Prod.snd).bddAbove + let N := max J b + have he (M : ℤ) (hM : N ≤ M) : + crossingStageMatches (matrixOf a) J M = crossing a J := by + ext p + constructor + · intro hp + exact ⟨hp.1,hp.2.1,hp.2.2.1⟩ + · intro hp + exact ⟨hp.1,hp.2.1,hp.2.2,le_trans (hb ⟨p,hp,rfl⟩) (le_trans (le_max_right J b) hM)⟩ + refine ⟨N, le_max_left _ _, ?_, he N le_rfl⟩ + apply le_antisymm _ (crossingStage_le_space a J N) + rintro z ⟨f,⟨⟨x,hx⟩,hf⟩,rfl⟩ + obtain ⟨M,hM⟩ := exists_poleLattice x + have heq : crossingStage a J N = crossingStage a J (max N M) := by + let := crossingStage_finite a J (max N M) + apply Submodule.eq_of_le_of_finrank_eq (crossingStage_mono a J (le_max_left _ _)) + rw [crossingStage_finrank a ha, crossingStage_finrank a ha, + he N le_rfl, he (max N M) (le_max_left _ _)] + rw [heq] + exact ⟨f,⟨⟨x,poleLattice_mono (le_max_right N M) hM,hx⟩,hf⟩,rfl⟩ + +def crossingQuotientEquiv (a : LaurentSeries k →ₗ[k] LaurentSeries k) (J : ℤ) : + crossingQuotient a J ≃ₗ[k] crossingSpace a J := by + let I := a.range ⊓ poleLattice (k := k) J + let f := (stageImage a J).mkQ.domRestrict I + have hk : f.ker = (stageImage a J).comap I.subtype := by + rw [LinearMap.ker_domRestrict, Submodule.ker_mkQ] + exact (Submodule.quotEquivOfEq _ _ hk.symm).trans + (f.quotKerEquivRange.trans (LinearEquiv.ofEq _ _ (LinearMap.range_domRestrict _ _))) + +theorem crossing_dimension [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) + (hc : ∀ J, (crossing a J).Finite) (J : ℤ) : + FiniteDimensional k (crossingQuotient a J) ∧ + Module.finrank k (crossingQuotient a J) = (crossing a J).ncard := by + obtain ⟨N,hN,he,hcN⟩ := crossingSpace_stabilizes a ha J (hc J) + have : FiniteDimensional k (crossingSpace a J) := by + rw [he] + exact crossingStage_finite a J N + refine ⟨(crossingQuotientEquiv a J).symm.finiteDimensional, ?_⟩ + rw [(crossingQuotientEquiv a J).finrank_eq, he, crossingStage_finrank a ha, hcN] + +lemma range_inf_stabilizes [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) + (J : ℤ) (hc : (crossing a J).Finite) : + ∃ N : ℤ, a.range ⊓ poleLattice J = stageImage a N ⊓ poleLattice J := by + obtain ⟨N,hN,he,_⟩ := crossingSpace_stabilizes a ha J hc + refine ⟨N,le_antisymm ?_ ?_⟩ + · intro f hf + have hq : (stageImage a J).mkQ f ∈ crossingStage a J N := by + rw [← he] + exact ⟨f,hf,rfl⟩ + have hi : (stageImage a J).mkQ f ∈ imageModulo a J N := + (Submodule.map_mono (show stageImage a N ⊓ poleLattice J ≤ stageImage a N + from inf_le_left)) hq + exact ⟨(mem_imageModulo a hN f).mp hi,hf.2⟩ + · rintro f ⟨⟨x,hx,rfl⟩,hf⟩ + exact ⟨⟨x,rfl⟩,hf⟩ + +lemma isCompact_range_inter_poleLattice [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) + (J : ℤ) (hc : (crossing a J).Finite) : + IsCompact ((Set.range a) ∩ (poleLattice (k := k) J : Set (LaurentSeries k))) := by + obtain ⟨N,he⟩ := range_inf_stabilizes a ha J hc + change IsCompact (↑(a.range ⊓ poleLattice J) : Set (LaurentSeries k)) + rw [he] + change IsCompact ((a '' (poleLattice (k := k) N : Set (LaurentSeries k))) ∩ + (poleLattice (k := k) J : Set (LaurentSeries k))) + exact ((isCompact_poleLattice N).image (continuous_of_preservesPoles a ha)).inter_right + (isClosed_poleLattice J) + +theorem closed_image [Finite k] + (a : LaurentSeries k →ₗ[k] LaurentSeries k) (ha : PreservesPoles a) + (hc : ∀ J, (crossing a J).Finite) : + IsClosed (Set.range a) := by + rw [← isOpen_compl_iff, isOpen_iff_forall_mem_open] + intro f hf + obtain ⟨J,hJ⟩ := exists_poleLattice f + refine ⟨(poleLattice (k := k) J : Set (LaurentSeries k)) ∩ + ((Set.range a) ∩ (poleLattice (k := k) J : Set (LaurentSeries k)))ᶜ, ?_, ?_, ?_⟩ + · intro g hg hga + exact hg.2 ⟨hga,hg.1⟩ + · exact (isOpen_poleLattice J).inter + (isCompact_range_inter_poleLattice a ha J (hc J)).isClosed.isOpen_compl + · exact ⟨hJ,fun h => hf h.1⟩ + +end HahnWilson.PivotTopology + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/BasedMaps.lean b/lean/OAI/Topology/Homotopy/BasedMaps.lean index 4cfb83f7fe422d250956cfd6a0f89983db9c42f0..15055d2a3e08b88cfef3c48993790814d4bf6fe7 100644 --- a/lean/OAI/Topology/Homotopy/BasedMaps.lean +++ b/lean/OAI/Topology/Homotopy/BasedMaps.lean @@ -1,71 +1,71 @@ -import Mathlib - -namespace OAI - -/-! Maps of based generalized loops and homotopy groups. -/ - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.BasedHomotopy -open scoped Topology Topology.Homotopy -variable {N X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] -variable {x : X} {y : Y} {z : Z} - -def loopMap (e : C(X,Y)) (he : e x = y) (f : GenLoop N X x) : GenLoop N Y y := - ⟨e.comp f.1,fun t ht => (congrArg e (GenLoop.boundary f t ht)).trans he⟩ - -lemma loopMap_homotopic (e : C(X,Y)) (he : e x = y) {f g : GenLoop N X x} - (h : GenLoop.Homotopic f g) : GenLoop.Homotopic (loopMap e he f) (loopMap e he g) := by - obtain ⟨H⟩ := h - exact ⟨H.compContinuousMap e⟩ - -@[simp] theorem loopMap_const (e : C(X,Y)) (he : e x = y) : - loopMap (N:=N) e he GenLoop.const = GenLoop.const := by ext t; exact he - -@[simp] theorem loopMap_id (f : GenLoop N X x) : loopMap (ContinuousMap.id X) rfl f = f := by - ext t; rfl - -@[simp] theorem loopMap_comp (e : C(X,Y)) (he : e x = y) (d : C(Y,Z)) (hd : d y = z) - (f : GenLoop N X x) : loopMap d hd (loopMap e he f) = - loopMap (d.comp e) ((congrArg d he).trans hd) f := by - ext t; rfl - -lemma loopMap_transAt [DecidableEq N] (e : C(X,Y)) (he : e x = y) - (i : N) (f g : GenLoop N X x) : loopMap e he (GenLoop.transAt i f g) = - GenLoop.transAt i (loopMap e he f) (loopMap e he g) := by - ext t - simp only [loopMap,GenLoop.mk_apply,ContinuousMap.comp_apply,GenLoop.transAt,GenLoop.coe_copy,GenLoop.coe_coe] - split_ifs <;> rfl - -def groupMap [DecidableEq N] [Nonempty N] (e : C(X,Y)) (he : e x = y) : - HomotopyGroup N X x →* HomotopyGroup N Y y where - toFun := Quotient.map (loopMap e he) (fun _ _ h => loopMap_homotopic e he h) - map_one' := by - rw [HomotopyGroup.one_def,HomotopyGroup.one_def] - change Quotient.mk'' (loopMap e he GenLoop.const) = Quotient.mk'' GenLoop.const - rw [loopMap_const] - map_mul' a b := Quotient.inductionOn₂ a b fun f g => by - simp only [HomotopyGroup.mul_spec (i:=Classical.arbitrary N)] - change (⟦loopMap e he (GenLoop.transAt (Classical.arbitrary N) g f)⟧ : HomotopyGroup N Y y) = - ((· * ·) : HomotopyGroup N Y y → HomotopyGroup N Y y → HomotopyGroup N Y y) - ⟦loopMap e he f⟧ ⟦loopMap e he g⟧ - rw [HomotopyGroup.mul_spec (i:=Classical.arbitrary N),loopMap_transAt] - -@[simp] theorem groupMap_id [DecidableEq N] [Nonempty N] (a : HomotopyGroup N X x) : - groupMap (ContinuousMap.id X) rfl a = a := by - induction a using Quotient.inductionOn with - | h f => change Quotient.mk'' (loopMap _ _ f) = _; rw [loopMap_id]; rfl - -@[simp] theorem groupMap_comp [DecidableEq N] [Nonempty N] - (e : C(X,Y)) (he : e x = y) (d : C(Y,Z)) (hd : d y = z) (a : HomotopyGroup N X x) : - groupMap d hd (groupMap e he a) = groupMap (d.comp e) ((congrArg d he).trans hd) a := by - induction a using Quotient.inductionOn with - | h f => change Quotient.mk'' (loopMap _ _ (loopMap _ _ f)) = _; rw [loopMap_comp]; rfl - -end NearbyLagrangian.BasedHomotopy - -end - -end OAI +import Mathlib + +namespace OAI + +/-! Maps of based generalized loops and homotopy groups. -/ + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.BasedHomotopy +open scoped Topology Topology.Homotopy +variable {N X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] +variable {x : X} {y : Y} {z : Z} + +def loopMap (e : C(X,Y)) (he : e x = y) (f : GenLoop N X x) : GenLoop N Y y := + ⟨e.comp f.1,fun t ht => (congrArg e (GenLoop.boundary f t ht)).trans he⟩ + +lemma loopMap_homotopic (e : C(X,Y)) (he : e x = y) {f g : GenLoop N X x} + (h : GenLoop.Homotopic f g) : GenLoop.Homotopic (loopMap e he f) (loopMap e he g) := by + obtain ⟨H⟩ := h + exact ⟨H.compContinuousMap e⟩ + +@[simp] theorem loopMap_const (e : C(X,Y)) (he : e x = y) : + loopMap (N:=N) e he GenLoop.const = GenLoop.const := by ext t; exact he + +@[simp] theorem loopMap_id (f : GenLoop N X x) : loopMap (ContinuousMap.id X) rfl f = f := by + ext t; rfl + +@[simp] theorem loopMap_comp (e : C(X,Y)) (he : e x = y) (d : C(Y,Z)) (hd : d y = z) + (f : GenLoop N X x) : loopMap d hd (loopMap e he f) = + loopMap (d.comp e) ((congrArg d he).trans hd) f := by + ext t; rfl + +lemma loopMap_transAt [DecidableEq N] (e : C(X,Y)) (he : e x = y) + (i : N) (f g : GenLoop N X x) : loopMap e he (GenLoop.transAt i f g) = + GenLoop.transAt i (loopMap e he f) (loopMap e he g) := by + ext t + simp only [loopMap,GenLoop.mk_apply,ContinuousMap.comp_apply,GenLoop.transAt,GenLoop.coe_copy,GenLoop.coe_coe] + split_ifs <;> rfl + +def groupMap [DecidableEq N] [Nonempty N] (e : C(X,Y)) (he : e x = y) : + HomotopyGroup N X x →* HomotopyGroup N Y y where + toFun := Quotient.map (loopMap e he) (fun _ _ h => loopMap_homotopic e he h) + map_one' := by + rw [HomotopyGroup.one_def,HomotopyGroup.one_def] + change Quotient.mk'' (loopMap e he GenLoop.const) = Quotient.mk'' GenLoop.const + rw [loopMap_const] + map_mul' a b := Quotient.inductionOn₂ a b fun f g => by + simp only [HomotopyGroup.mul_spec (i:=Classical.arbitrary N)] + change (⟦loopMap e he (GenLoop.transAt (Classical.arbitrary N) g f)⟧ : HomotopyGroup N Y y) = + ((· * ·) : HomotopyGroup N Y y → HomotopyGroup N Y y → HomotopyGroup N Y y) + ⟦loopMap e he f⟧ ⟦loopMap e he g⟧ + rw [HomotopyGroup.mul_spec (i:=Classical.arbitrary N),loopMap_transAt] + +@[simp] theorem groupMap_id [DecidableEq N] [Nonempty N] (a : HomotopyGroup N X x) : + groupMap (ContinuousMap.id X) rfl a = a := by + induction a using Quotient.inductionOn with + | h f => change Quotient.mk'' (loopMap _ _ f) = _; rw [loopMap_id]; rfl + +@[simp] theorem groupMap_comp [DecidableEq N] [Nonempty N] + (e : C(X,Y)) (he : e x = y) (d : C(Y,Z)) (hd : d y = z) (a : HomotopyGroup N X x) : + groupMap d hd (groupMap e he a) = groupMap (d.comp e) ((congrArg d he).trans hd) a := by + induction a using Quotient.inductionOn with + | h f => change Quotient.mk'' (loopMap _ _ (loopMap _ _ f)) = _; rw [loopMap_comp]; rfl + +end NearbyLagrangian.BasedHomotopy + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/ConeHomotopy.lean b/lean/OAI/Topology/Homotopy/ConeHomotopy.lean index 24b17cb36d61f20cbdd9bf085c8d373c349bee1c..88bf912b4bc6d17744d702d1ec990c3ccd57a953 100644 --- a/lean/OAI/Topology/Homotopy/ConeHomotopy.lean +++ b/lean/OAI/Topology/Homotopy/ConeHomotopy.lean @@ -1,234 +1,234 @@ -import Mathlib -import OAI.Topology.Homotopy.FiberCone - -namespace OAI - -/-! Right suspension homotopies and suspension of maps and homotopies. -/ - -noncomputable section -universe u v w -open Set ContinuousMap -open scoped Topology unitInterval - -namespace NearbyLagrangian.FiberCone -variable {B A X : Type*} [TopologicalSpace B] [TopologicalSpace A] [TopologicalSpace X] -variable (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) (hf : ∀ a, p (f a) = q a) - -def sweepBase : C(unitInterval × X,Susp p) := meridian p - -def sweepRay : C(unitInterval × (unitInterval × A),Susp p) where - toFun z := meridian p (max z.2.1 z.1,f z.2.2) - continuous_toFun := (meridian p).continuous.comp - (((continuous_fst.comp continuous_snd).max continuous_fst).prodMk - (f.continuous.comp (continuous_snd.comp continuous_snd))) - -def sweepApex : C(unitInterval × B,Susp p) := (north p).comp ⟨Prod.snd,continuous_snd⟩ - -lemma sweepRay_bottom (s : unitInterval) (a : A) : - sweepRay f p (s,(0,a)) = sweepBase p (s,f a) := by - change meridian p (max 0 s,f a) = meridian p (s,f a) - rw [max_eq_right (show (0:unitInterval) ≤ s from bot_le)] - -include hf in -lemma sweepRay_top (s : unitInterval) (a : A) : - sweepRay f p (s,(1,a)) = sweepApex p (s,q a) := by - change meridian p (max 1 s,f a) = north p (q a) - rw [max_eq_left (show s ≤ (1:unitInterval) from le_top),ray_one,hf] - -def sweep : C(unitInterval × Space f q,Susp p) := - cylinderLift f q (sweepBase p) (sweepRay f p) (sweepApex p) - (sweepRay_bottom f p) (sweepRay_top f p q hf) - -@[simp] lemma sweep_base (s : unitInterval) (x : X) : - sweep f p q hf (s,base f q x) = meridian p (s,x) := rfl -@[simp] lemma sweep_ray (s : unitInterval) (ta : unitInterval × A) : - sweep f p q hf (s,ray f q ta) = meridian p (max ta.1 s,f ta.2) := rfl -@[simp] lemma sweep_apex (s : unitInterval) (b : B) : - sweep f p q hf (s,apex f q b) = north p b := rfl - -lemma sweep_zero (z : Space f q) : - sweep f p q hf (0,z) = suspMap f p q hf (collapse f p q hf z) := by - induction z using induction with - | hbase x => rw [sweep_base,ray_zero,collapse_base,suspMap_south] - | hray ta => - rw [sweep_ray,max_eq_left (show (0:unitInterval) ≤ ta.1 from bot_le), - collapse_ray,suspMap_meridian] - | hapex b => rw [sweep_apex,collapse_apex,suspMap_north] - -lemma sweep_one (z : Space f q) : - sweep f p q hf (1,z) = north p (projection f p q hf z) := by - induction z using induction with - | hbase x => rw [sweep_base,ray_one,projection_base] - | hray ta => - rw [sweep_ray,max_eq_right (show ta.1 ≤ (1:unitInterval) from le_top), - ray_one,hf,projection_ray] - | hapex b => rfl - -lemma sweep_over (s : unitInterval) (z : Space f q) : - suspProjection p (sweep f p q hf (s,z)) = projection f p q hf z := by - induction z using induction with - | hbase x => rfl - | hray ta => exact hf ta.2 - | hapex b => rfl - -namespace Contraction -variable {f p q hf} (H : Contraction f p q hf) - -def rightRay : C(unitInterval × (unitInterval × X),Susp p) where - toFun z := sweep f p q hf (horizontal (z.1,z.2.1), - H.hom (vertical (z.1,z.2.1),base f q z.2.2)) - continuous_toFun := (sweep f p q hf).continuous.comp - ((horizontal.continuous.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd))).prodMk - (H.hom.continuous.comp - ((vertical.continuous.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd))).prodMk - ((base f q).continuous.comp (continuous_snd.comp continuous_snd))))) - -lemma rightRay_bottom (s : unitInterval) (x : X) : H.rightRay (s,(0,x)) = south p (p x) := by - change sweep f p q hf (horizontal (s,0),H.hom (vertical (s,0),base f q x)) = _ - rw [horizontal_bottom,vertical_bottom,H.at_zero,sweep_base,ray_zero] - -lemma rightRay_top (s : unitInterval) (x : X) : H.rightRay (s,(1,x)) = north p (p x) := by - change sweep f p q hf (horizontal (s,1),H.hom (vertical (s,1),base f q x)) = _ - rcases square_top s with hx | hy - · rw [hx,sweep_one,H.staysOver,projection_base] - · rw [hy,H.at_one,projection_base,sweep_apex] - -def rightDeformation : C(unitInterval × Susp p,Susp p) := - cylinderLift p p ((south p).comp ⟨Prod.snd,continuous_snd⟩) H.rightRay - ((north p).comp ⟨Prod.snd,continuous_snd⟩) H.rightRay_bottom H.rightRay_top - -@[simp] lemma rightDeformation_south (s : unitInterval) (b : B) : - H.rightDeformation (s,south p b) = south p b := rfl -@[simp] lemma rightDeformation_meridian (s : unitInterval) (tx : unitInterval × X) : - H.rightDeformation (s,meridian p tx) = H.rightRay (s,tx) := rfl -@[simp] lemma rightDeformation_north (s : unitInterval) (b : B) : - H.rightDeformation (s,north p b) = north p b := rfl - -lemma rightDeformation_zero (z : Susp p) : H.rightDeformation (0,z) = z := by - induction z using induction with - | hbase b => rfl - | hray tx => - rw [rightDeformation_meridian] - change sweep f p q hf (horizontal (0,tx.1), - H.hom (vertical (0,tx.1),base f q tx.2)) = _ - rw [horizontal_left,vertical_left,H.at_zero,sweep_base] - | hapex b => rfl - -lemma rightDeformation_one (z : Susp p) : - H.rightDeformation (1,z) = suspMap f p q hf (H.inverse z) := by - induction z using induction with - | hbase b => rw [rightDeformation_south,inverse_south,suspMap_south] - | hray tx => - rw [rightDeformation_meridian,inverse_meridian] - change sweep f p q hf (horizontal (1,tx.1), - H.hom (vertical (1,tx.1),base f q tx.2)) = _ - rw [horizontal_right,vertical_right,sweep_zero] - | hapex b => rw [rightDeformation_north,inverse_north,suspMap_north] - -lemma rightDeformation_over (s : unitInterval) (z : Susp p) : - suspProjection p (H.rightDeformation (s,z)) = suspProjection p z := by - induction z using induction with - | hbase b => rfl - | hray tx => - rw [rightDeformation_meridian] - change suspProjection p (sweep f p q hf (horizontal (s,tx.1), - H.hom (vertical (s,tx.1),base f q tx.2))) = _ - rw [sweep_over,H.staysOver,projection_base] - rfl - | hapex b => rfl - -def rightHomotopy : ((suspMap f p q hf).comp H.inverse).Homotopy (ContinuousMap.id (Susp p)) := - ContinuousMap.Homotopy.symm - { toContinuousMap := H.rightDeformation - map_zero_left := H.rightDeformation_zero - map_one_left := H.rightDeformation_one } - -lemma rightHomotopy_over (s : unitInterval) (z : Susp p) : - suspProjection p (H.rightHomotopy (s,z)) = suspProjection p z := - H.rightDeformation_over (unitInterval.symm s) z - -end Contraction -end NearbyLagrangian.FiberCone - -end - -noncomputable section -universe u v w -open Set ContinuousMap -open scoped Topology unitInterval - -namespace NearbyLagrangian.FiberCone -variable {B A X Y : Type*} [TopologicalSpace B] [TopologicalSpace A] - [TopologicalSpace X] [TopologicalSpace Y] - -@[simp] lemma suspMap_id (q : C(A,B)) : - suspMap (ContinuousMap.id A) q q (fun _ => rfl) = ContinuousMap.id (Susp q) := by - ext z - induction z using induction with - | hbase _ => rfl - | hray _ => rfl - | hapex _ => rfl - -lemma suspMap_comp (f : C(A,X)) (g : C(X,Y)) (p : C(X,B)) (q : C(A,B)) (r : C(Y,B)) - (hf : ∀ a, p (f a) = q a) (hg : ∀ x, r (g x) = p x) : - (suspMap g r p hg).comp (suspMap f p q hf) = - suspMap (g.comp f) r q (fun a => (hg (f a)).trans (hf a)) := by - ext z - induction z using induction with - | hbase _ => rfl - | hray _ => rfl - | hapex _ => rfl - -variable {p : C(X,B)} {q : C(A,B)} {f g : C(A,X)} - (hf : ∀ a, p (f a) = q a) (hg : ∀ a, p (g a) = q a) - (H : f.Homotopy g) (hH : ∀ s a, p (H (s,a)) = q a) - -def suspHomotopyRay : C(unitInterval × (unitInterval × A),Susp p) := - (meridian p).comp ⟨fun z => (z.2.1,H (z.1,z.2.2)), - (continuous_fst.comp continuous_snd).prodMk - (H.continuous.comp (continuous_fst.prodMk (continuous_snd.comp continuous_snd)))⟩ - -include hH in -lemma suspHomotopyRay_bottom (s : unitInterval) (a : A) : - suspHomotopyRay H (s,(0,a)) = south p (q a) := by - change meridian p (0,H (s,a)) = _ - rw [ray_zero,hH] - -include hH in -lemma suspHomotopyRay_top (s : unitInterval) (a : A) : - suspHomotopyRay H (s,(1,a)) = north p (q a) := by - change meridian p (1,H (s,a)) = _ - rw [ray_one,hH] - -def suspHomotopy : (suspMap f p q hf).Homotopy (suspMap g p q hg) where - toContinuousMap := cylinderLift q q - ((south p).comp ⟨Prod.snd,continuous_snd⟩) (suspHomotopyRay H) - ((north p).comp ⟨Prod.snd,continuous_snd⟩) - (suspHomotopyRay_bottom H hH) (suspHomotopyRay_top H hH) - map_zero_left z := by - induction z using induction with - | hbase _ => rfl - | hray ta => - change meridian p (ta.1,H (0,ta.2)) = meridian p (ta.1,f ta.2) - rw [HomotopyLike.map_zero_left H] - | hapex _ => rfl - map_one_left z := by - induction z using induction with - | hbase _ => rfl - | hray ta => - change meridian p (ta.1,H (1,ta.2)) = meridian p (ta.1,g ta.2) - rw [HomotopyLike.map_one_left H] - | hapex _ => rfl - -lemma suspHomotopy_over (s : unitInterval) (z : Susp q) : - suspProjection p (suspHomotopy hf hg H hH (s,z)) = suspProjection q z := by - induction z using induction with - | hbase _ => rfl - | hray ta => exact hH s ta.2 - | hapex _ => rfl - -end NearbyLagrangian.FiberCone - -end - -end OAI +import Mathlib +import OAI.Topology.Homotopy.FiberCone + +namespace OAI + +/-! Right suspension homotopies and suspension of maps and homotopies. -/ + +noncomputable section +universe u v w +open Set ContinuousMap +open scoped Topology unitInterval + +namespace NearbyLagrangian.FiberCone +variable {B A X : Type*} [TopologicalSpace B] [TopologicalSpace A] [TopologicalSpace X] +variable (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) (hf : ∀ a, p (f a) = q a) + +def sweepBase : C(unitInterval × X,Susp p) := meridian p + +def sweepRay : C(unitInterval × (unitInterval × A),Susp p) where + toFun z := meridian p (max z.2.1 z.1,f z.2.2) + continuous_toFun := (meridian p).continuous.comp + (((continuous_fst.comp continuous_snd).max continuous_fst).prodMk + (f.continuous.comp (continuous_snd.comp continuous_snd))) + +def sweepApex : C(unitInterval × B,Susp p) := (north p).comp ⟨Prod.snd,continuous_snd⟩ + +lemma sweepRay_bottom (s : unitInterval) (a : A) : + sweepRay f p (s,(0,a)) = sweepBase p (s,f a) := by + change meridian p (max 0 s,f a) = meridian p (s,f a) + rw [max_eq_right (show (0:unitInterval) ≤ s from bot_le)] + +include hf in +lemma sweepRay_top (s : unitInterval) (a : A) : + sweepRay f p (s,(1,a)) = sweepApex p (s,q a) := by + change meridian p (max 1 s,f a) = north p (q a) + rw [max_eq_left (show s ≤ (1:unitInterval) from le_top),ray_one,hf] + +def sweep : C(unitInterval × Space f q,Susp p) := + cylinderLift f q (sweepBase p) (sweepRay f p) (sweepApex p) + (sweepRay_bottom f p) (sweepRay_top f p q hf) + +@[simp] lemma sweep_base (s : unitInterval) (x : X) : + sweep f p q hf (s,base f q x) = meridian p (s,x) := rfl +@[simp] lemma sweep_ray (s : unitInterval) (ta : unitInterval × A) : + sweep f p q hf (s,ray f q ta) = meridian p (max ta.1 s,f ta.2) := rfl +@[simp] lemma sweep_apex (s : unitInterval) (b : B) : + sweep f p q hf (s,apex f q b) = north p b := rfl + +lemma sweep_zero (z : Space f q) : + sweep f p q hf (0,z) = suspMap f p q hf (collapse f p q hf z) := by + induction z using induction with + | hbase x => rw [sweep_base,ray_zero,collapse_base,suspMap_south] + | hray ta => + rw [sweep_ray,max_eq_left (show (0:unitInterval) ≤ ta.1 from bot_le), + collapse_ray,suspMap_meridian] + | hapex b => rw [sweep_apex,collapse_apex,suspMap_north] + +lemma sweep_one (z : Space f q) : + sweep f p q hf (1,z) = north p (projection f p q hf z) := by + induction z using induction with + | hbase x => rw [sweep_base,ray_one,projection_base] + | hray ta => + rw [sweep_ray,max_eq_right (show ta.1 ≤ (1:unitInterval) from le_top), + ray_one,hf,projection_ray] + | hapex b => rfl + +lemma sweep_over (s : unitInterval) (z : Space f q) : + suspProjection p (sweep f p q hf (s,z)) = projection f p q hf z := by + induction z using induction with + | hbase x => rfl + | hray ta => exact hf ta.2 + | hapex b => rfl + +namespace Contraction +variable {f p q hf} (H : Contraction f p q hf) + +def rightRay : C(unitInterval × (unitInterval × X),Susp p) where + toFun z := sweep f p q hf (horizontal (z.1,z.2.1), + H.hom (vertical (z.1,z.2.1),base f q z.2.2)) + continuous_toFun := (sweep f p q hf).continuous.comp + ((horizontal.continuous.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd))).prodMk + (H.hom.continuous.comp + ((vertical.continuous.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd))).prodMk + ((base f q).continuous.comp (continuous_snd.comp continuous_snd))))) + +lemma rightRay_bottom (s : unitInterval) (x : X) : H.rightRay (s,(0,x)) = south p (p x) := by + change sweep f p q hf (horizontal (s,0),H.hom (vertical (s,0),base f q x)) = _ + rw [horizontal_bottom,vertical_bottom,H.at_zero,sweep_base,ray_zero] + +lemma rightRay_top (s : unitInterval) (x : X) : H.rightRay (s,(1,x)) = north p (p x) := by + change sweep f p q hf (horizontal (s,1),H.hom (vertical (s,1),base f q x)) = _ + rcases square_top s with hx | hy + · rw [hx,sweep_one,H.staysOver,projection_base] + · rw [hy,H.at_one,projection_base,sweep_apex] + +def rightDeformation : C(unitInterval × Susp p,Susp p) := + cylinderLift p p ((south p).comp ⟨Prod.snd,continuous_snd⟩) H.rightRay + ((north p).comp ⟨Prod.snd,continuous_snd⟩) H.rightRay_bottom H.rightRay_top + +@[simp] lemma rightDeformation_south (s : unitInterval) (b : B) : + H.rightDeformation (s,south p b) = south p b := rfl +@[simp] lemma rightDeformation_meridian (s : unitInterval) (tx : unitInterval × X) : + H.rightDeformation (s,meridian p tx) = H.rightRay (s,tx) := rfl +@[simp] lemma rightDeformation_north (s : unitInterval) (b : B) : + H.rightDeformation (s,north p b) = north p b := rfl + +lemma rightDeformation_zero (z : Susp p) : H.rightDeformation (0,z) = z := by + induction z using induction with + | hbase b => rfl + | hray tx => + rw [rightDeformation_meridian] + change sweep f p q hf (horizontal (0,tx.1), + H.hom (vertical (0,tx.1),base f q tx.2)) = _ + rw [horizontal_left,vertical_left,H.at_zero,sweep_base] + | hapex b => rfl + +lemma rightDeformation_one (z : Susp p) : + H.rightDeformation (1,z) = suspMap f p q hf (H.inverse z) := by + induction z using induction with + | hbase b => rw [rightDeformation_south,inverse_south,suspMap_south] + | hray tx => + rw [rightDeformation_meridian,inverse_meridian] + change sweep f p q hf (horizontal (1,tx.1), + H.hom (vertical (1,tx.1),base f q tx.2)) = _ + rw [horizontal_right,vertical_right,sweep_zero] + | hapex b => rw [rightDeformation_north,inverse_north,suspMap_north] + +lemma rightDeformation_over (s : unitInterval) (z : Susp p) : + suspProjection p (H.rightDeformation (s,z)) = suspProjection p z := by + induction z using induction with + | hbase b => rfl + | hray tx => + rw [rightDeformation_meridian] + change suspProjection p (sweep f p q hf (horizontal (s,tx.1), + H.hom (vertical (s,tx.1),base f q tx.2))) = _ + rw [sweep_over,H.staysOver,projection_base] + rfl + | hapex b => rfl + +def rightHomotopy : ((suspMap f p q hf).comp H.inverse).Homotopy (ContinuousMap.id (Susp p)) := + ContinuousMap.Homotopy.symm + { toContinuousMap := H.rightDeformation + map_zero_left := H.rightDeformation_zero + map_one_left := H.rightDeformation_one } + +lemma rightHomotopy_over (s : unitInterval) (z : Susp p) : + suspProjection p (H.rightHomotopy (s,z)) = suspProjection p z := + H.rightDeformation_over (unitInterval.symm s) z + +end Contraction +end NearbyLagrangian.FiberCone + +end + +noncomputable section +universe u v w +open Set ContinuousMap +open scoped Topology unitInterval + +namespace NearbyLagrangian.FiberCone +variable {B A X Y : Type*} [TopologicalSpace B] [TopologicalSpace A] + [TopologicalSpace X] [TopologicalSpace Y] + +@[simp] lemma suspMap_id (q : C(A,B)) : + suspMap (ContinuousMap.id A) q q (fun _ => rfl) = ContinuousMap.id (Susp q) := by + ext z + induction z using induction with + | hbase _ => rfl + | hray _ => rfl + | hapex _ => rfl + +lemma suspMap_comp (f : C(A,X)) (g : C(X,Y)) (p : C(X,B)) (q : C(A,B)) (r : C(Y,B)) + (hf : ∀ a, p (f a) = q a) (hg : ∀ x, r (g x) = p x) : + (suspMap g r p hg).comp (suspMap f p q hf) = + suspMap (g.comp f) r q (fun a => (hg (f a)).trans (hf a)) := by + ext z + induction z using induction with + | hbase _ => rfl + | hray _ => rfl + | hapex _ => rfl + +variable {p : C(X,B)} {q : C(A,B)} {f g : C(A,X)} + (hf : ∀ a, p (f a) = q a) (hg : ∀ a, p (g a) = q a) + (H : f.Homotopy g) (hH : ∀ s a, p (H (s,a)) = q a) + +def suspHomotopyRay : C(unitInterval × (unitInterval × A),Susp p) := + (meridian p).comp ⟨fun z => (z.2.1,H (z.1,z.2.2)), + (continuous_fst.comp continuous_snd).prodMk + (H.continuous.comp (continuous_fst.prodMk (continuous_snd.comp continuous_snd)))⟩ + +include hH in +lemma suspHomotopyRay_bottom (s : unitInterval) (a : A) : + suspHomotopyRay H (s,(0,a)) = south p (q a) := by + change meridian p (0,H (s,a)) = _ + rw [ray_zero,hH] + +include hH in +lemma suspHomotopyRay_top (s : unitInterval) (a : A) : + suspHomotopyRay H (s,(1,a)) = north p (q a) := by + change meridian p (1,H (s,a)) = _ + rw [ray_one,hH] + +def suspHomotopy : (suspMap f p q hf).Homotopy (suspMap g p q hg) where + toContinuousMap := cylinderLift q q + ((south p).comp ⟨Prod.snd,continuous_snd⟩) (suspHomotopyRay H) + ((north p).comp ⟨Prod.snd,continuous_snd⟩) + (suspHomotopyRay_bottom H hH) (suspHomotopyRay_top H hH) + map_zero_left z := by + induction z using induction with + | hbase _ => rfl + | hray ta => + change meridian p (ta.1,H (0,ta.2)) = meridian p (ta.1,f ta.2) + rw [HomotopyLike.map_zero_left H] + | hapex _ => rfl + map_one_left z := by + induction z using induction with + | hbase _ => rfl + | hray ta => + change meridian p (ta.1,H (1,ta.2)) = meridian p (ta.1,g ta.2) + rw [HomotopyLike.map_one_left H] + | hapex _ => rfl + +lemma suspHomotopy_over (s : unitInterval) (z : Susp q) : + suspProjection p (suspHomotopy hf hg H hH (s,z)) = suspProjection q z := by + induction z using induction with + | hbase _ => rfl + | hray ta => exact hH s ta.2 + | hapex _ => rfl + +end NearbyLagrangian.FiberCone + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/CubicalNullity.lean b/lean/OAI/Topology/Homotopy/CubicalNullity.lean index 6349552a8e28411e666c949e7d6edceecfacf19e..202417b7b1ff7aa05ac39572452d16452bae0f81 100644 --- a/lean/OAI/Topology/Homotopy/CubicalNullity.lean +++ b/lean/OAI/Topology/Homotopy/CubicalNullity.lean @@ -1,263 +1,263 @@ -import Mathlib - -namespace OAI - -/-! Cubical free nullity and change of basepoint. -/ - -noncomputable section -universe u v w -open Set ContinuousMap -open scoped Topology Topology.Homotopy - -namespace NearbyLagrangian.CubicalFreeNullity -variable {N : Type*} [Fintype N] [Nonempty N] - -def radius (t : N → unitInterval) : ℝ := ‖fun i => 2*(t i:ℝ)-1‖ -omit [Nonempty N] in -lemma radius_nonneg (t : N → unitInterval) : 0 ≤ radius t := norm_nonneg _ -omit [Nonempty N] in -lemma radius_le_one (t : N → unitInterval) : radius t ≤ 1 := by - apply (pi_norm_le_iff_of_nonneg (by norm_num : (0:ℝ) ≤ 1)).mpr - intro i - rw [Real.norm_eq_abs,abs_le] - have hi₀ := (t i).property.1 - have hi₁ := (t i).property.2 - constructor <;> linarith -omit [Nonempty N] in -lemma continuous_radius : Continuous (radius (N:=N)) := - (continuous_pi fun i => (continuous_const.mul - (continuous_subtype_val.comp (continuous_apply i))).sub continuous_const).norm -omit [Nonempty N] in -lemma radius_boundary {t : N → unitInterval} (ht : t ∈ Cube.boundary N) : radius t = 1 := by - apply le_antisymm (radius_le_one t) - obtain ⟨i,hi⟩ := ht - have hh := norm_le_pi_norm (fun i => 2*(t i:ℝ)-1) i - rcases hi with hi | hi - · simpa [radius,hi] using hh - · norm_num [hi] at hh - exact hh - -def collarTime (s : unitInterval) (t : N → unitInterval) : unitInterval := - ⟨min (s:ℝ) (2*(1-radius t)), - le_min s.property.1 (by have := radius_le_one t; linarith), - (min_le_left _ _).trans s.property.2⟩ -omit [Nonempty N] in -lemma continuous_collarTime : Continuous (fun a : unitInterval × (N → unitInterval) => collarTime a.1 a.2) := - ((continuous_subtype_val.comp continuous_fst).min - (continuous_const.mul (continuous_const.sub (continuous_radius.comp continuous_snd)))).subtype_mk _ -omit [Nonempty N] in -@[simp] lemma collarTime_zero (t : N → unitInterval) : collarTime 0 t = 0 := by - apply Subtype.ext - change min 0 (2*(1-radius t)) = 0 - apply min_eq_left - have := radius_le_one t - linarith -omit [Nonempty N] in -lemma collarTime_boundary (s : unitInterval) {t : N → unitInterval} (ht : t ∈ Cube.boundary N) : - collarTime s t = 0 := by - apply Subtype.ext - change min (s:ℝ) (2*(1-radius t)) = 0 - rw [radius_boundary ht] - simp only [sub_self,mul_zero,min_eq_right s.property.1] - -lemma denominator_pos (s : unitInterval) : 0 < 1-(s:ℝ)/2 := by - have := s.property.2 - linarith - -def expand (s : unitInterval) (t : N → unitInterval) : N → unitInterval := - fun i => projIcc 0 1 (zero_le_one' ℝ) (((t i:ℝ)-(s:ℝ)/4)/(1-(s:ℝ)/2)) -omit [Fintype N] [Nonempty N] in -lemma continuous_expand : Continuous (fun a : unitInterval × (N → unitInterval) => expand a.1 a.2) := by - apply continuous_pi - intro i - apply continuous_projIcc.comp - exact ((continuous_subtype_val.comp ((continuous_apply i).comp continuous_snd)).sub - ((continuous_subtype_val.comp continuous_fst).div_const 4)).div - (continuous_const.sub ((continuous_subtype_val.comp continuous_fst).div_const 2)) - (fun a => ne_of_gt (denominator_pos a.1)) -omit [Fintype N] [Nonempty N] in -@[simp] lemma expand_zero (t : N → unitInterval) : expand 0 t = t := by - funext i - change projIcc 0 1 _ (((t i:ℝ)-(0:ℝ)/4)/(1-(0:ℝ)/2)) = t i - simp only [zero_div,sub_zero,div_one,projIcc_val] - -lemma expand_mem_boundary {s : unitInterval} {t : N → unitInterval} - (ht : 1-(s:ℝ)/2 ≤ radius t) : expand s t ∈ Cube.boundary N := by - obtain ⟨⟨i,hi⟩,_⟩ := IsGreatest.pi_norm (fun i => 2*(t i:ℝ)-1) - have habs : 1-(s:ℝ)/2 ≤ |2*(t i:ℝ)-1| := by - change ‖2*(t i:ℝ)-1‖ = radius t at hi - rw [Real.norm_eq_abs] at hi - exact ht.trans_eq hi.symm - rcases (le_abs.mp habs) with h | h - · refine ⟨i,Or.inr ?_⟩ - apply projIcc_of_right_le - apply (le_div_iff₀ (denominator_pos s)).mpr - linarith - · refine ⟨i,Or.inl ?_⟩ - apply projIcc_of_le_left - apply div_nonpos_of_nonpos_of_nonneg _ (denominator_pos s).le - linarith - -lemma expand_boundary (s : unitInterval) {t : N → unitInterval} (ht : t ∈ Cube.boundary N) : - expand s t ∈ Cube.boundary N := by - apply expand_mem_boundary - rw [radius_boundary ht] - have := s.property.1 - linarith - -variable {X : Type*} [TopologicalSpace X] - -theorem null_of_moving_base {x y : X} (f : GenLoop N X x) - (H : f.1.Homotopy (ContinuousMap.const _ y)) - (p : C(unitInterval,X)) - (hp : ∀ s t, t ∈ Cube.boundary N → H (s,t) = p s) : - GenLoop.Homotopic f GenLoop.const := by - let z : N → unitInterval := fun _ => 0 - have hz : z ∈ Cube.boundary N := ⟨Classical.choice inferInstance,Or.inl rfl⟩ - have hp0 : p 0 = x := by - rw [← hp 0 z hz,H.apply_zero] - exact GenLoop.boundary f z hz - have hp1 : p 1 = y := by rw [← hp 1 z hz,H.apply_one]; rfl - let a : C(N → unitInterval,X) := p.comp ⟨fun t => collarTime 1 t, - continuous_collarTime.comp (continuous_const.prodMk continuous_id)⟩ - have ha (t : N → unitInterval) : H (collarTime 1 t,expand 1 t) = a t := by - change H (collarTime 1 t,expand 1 t) = p (collarTime 1 t) - by_cases ht : collarTime 1 t = 1 - · rw [ht,H.apply_one,hp1]; rfl - · apply hp - apply expand_mem_boundary - have hk : (collarTime 1 t:ℝ) < 1 := lt_of_le_of_ne (collarTime 1 t).property.2 - (fun h => ht (Subtype.ext h)) - change min 1 (2*(1-radius t)) < 1 at hk - have hr : 2*(1-radius t) < 1 := by simpa only [min_lt_iff,lt_self_iff_false,false_or] using hk - change 1-(1:ℝ)/2 ≤ radius t - linarith - let H₁ : f.1.HomotopyRel a (Cube.boundary N) := { - toFun := fun q => H (collarTime q.1 q.2,expand q.1 q.2) - continuous_toFun := H.continuous.comp (continuous_collarTime.prodMk continuous_expand) - map_zero_left := by intro t; simp only [collarTime_zero,expand_zero,H.apply_zero] - map_one_left := ha - prop' := by - intro s t ht - change H (collarTime s t,expand s t) = f t - rw [collarTime_boundary s ht,hp 0 _ (expand_boundary s ht),hp0,GenLoop.boundary f t ht] } - let H₂ : a.HomotopyRel (ContinuousMap.const _ x) (Cube.boundary N) := { - toFun := fun q => p ⟨(1-(q.1:ℝ))*(collarTime 1 q.2:ℝ), - mul_nonneg (by linarith [q.1.property.2]) (collarTime _ _).property.1, - (mul_le_of_le_one_left (collarTime _ _).property.1 - (by linarith [q.1.property.1])).trans (collarTime _ _).property.2⟩ - continuous_toFun := p.continuous.comp (Continuous.subtype_mk - ((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).mul - (continuous_subtype_val.comp (continuous_collarTime.comp (continuous_const.prodMk continuous_snd)))) _) - map_zero_left := by - intro t - change p _ = p (collarTime 1 t) - congr 1 - apply Subtype.ext - change (1-(0:ℝ))*(collarTime 1 t:ℝ) = (collarTime 1 t:ℝ) - ring - map_one_left := by - intro t - change p _ = x - convert hp0 using 1 - congr 1 - apply Subtype.ext - change (1-(1:ℝ))*(collarTime 1 t:ℝ) = 0 - ring - prop' := by - intro s t ht - change p _ = p (collarTime 1 t) - rw [collarTime_boundary 1 ht] - congr 1 - apply Subtype.ext - change (1-(s:ℝ))*(0:ℝ) = 0 - ring } - exact ⟨H₁.trans H₂⟩ - -end NearbyLagrangian.CubicalFreeNullity - -end - -noncomputable section -universe u v w -open scoped Classical Topology Topology.Homotopy - -namespace NearbyLagrangian.CubicalFreeNullity -variable {N : Type*} [Fintype N] [Nonempty N] -variable {X : Type*} [TopologicalSpace X] {x y : X} - -def outerTime (s : unitInterval) (t : N → unitInterval) : unitInterval := - ⟨max 0 ((s:ℝ)-2*(1-radius t)),le_max_left _ _,by - apply max_le zero_le_one - have := radius_le_one t - linarith [s.property.2]⟩ -omit [Nonempty N] in -lemma continuous_outerTime : Continuous (fun a : unitInterval × (N → unitInterval) => outerTime a.1 a.2) := - ((continuous_const.max ((continuous_subtype_val.comp continuous_fst).sub - (continuous_const.mul (continuous_const.sub (continuous_radius.comp continuous_snd)))))).subtype_mk _ - -omit [Nonempty N] in -lemma outerTime_eq_zero {s : unitInterval} {t : N → unitInterval} - (h : radius t ≤ 1-(s:ℝ)/2) : outerTime s t = 0 := by - apply Subtype.ext - change max 0 ((s:ℝ)-2*(1-radius t)) = 0 - apply max_eq_left - linarith - -omit [Nonempty N] in -lemma outerTime_boundary (s : unitInterval) {t : N → unitInterval} - (h : t ∈ Cube.boundary N) : outerTime s t = s := by - apply Subtype.ext - change max 0 ((s:ℝ)-2*(1-radius t)) = s - rw [radius_boundary h] - simp only [sub_self,mul_zero,sub_zero,max_eq_right s.property.1] - -def rebaseValue (f : GenLoop N X x) (p : Path x y) (s : unitInterval) - (t : N → unitInterval) : X := - if radius t ≤ 1-(s:ℝ)/2 then f (expand s t) else p (outerTime s t) - -lemma continuous_rebaseValue (f : GenLoop N X x) (p : Path x y) : - Continuous (fun q : unitInterval × (N → unitInterval) => rebaseValue f p q.1 q.2) := by - apply (f.1.continuous.comp continuous_expand).if_le - (p.continuous.comp continuous_outerTime) (continuous_radius.comp continuous_snd) - (continuous_const.sub ((continuous_subtype_val.comp continuous_fst).div_const 2)) - intro q h - change f (expand q.1 q.2) = p (outerTime q.1 q.2) - change radius q.2 = 1-(q.1:ℝ)/2 at h - rw [GenLoop.boundary f _ (expand_mem_boundary h.ge),outerTime_eq_zero h.le,p.source] - -omit [Nonempty N] in -@[simp] lemma rebaseValue_zero (f : GenLoop N X x) (p : Path x y) - (t : N → unitInterval) : rebaseValue f p 0 t = f t := by - rw [rebaseValue,ite_eq_left (by simpa using radius_le_one t),expand_zero] - -omit [Nonempty N] in -lemma rebaseValue_boundary (f : GenLoop N X x) (p : Path x y) - (s : unitInterval) {t : N → unitInterval} (ht : t ∈ Cube.boundary N) : - rebaseValue f p s t = p s := by - rw [rebaseValue] - split_ifs with h - · have hs : s = 0 := by - apply Subtype.ext - change (s:ℝ) = 0 - rw [radius_boundary ht] at h - linarith [s.property.1] - rw [hs,expand_zero,GenLoop.boundary f t ht,p.source] - · rw [outerTime_boundary s ht] - -def rebase (f : GenLoop N X x) (p : Path x y) : GenLoop N X y := - ⟨⟨fun t => rebaseValue f p 1 t, - (continuous_rebaseValue f p).comp (continuous_const.prodMk continuous_id)⟩, - fun _t ht => (rebaseValue_boundary f p 1 ht).trans p.target⟩ - -def rebaseHomotopy (f : GenLoop N X x) (p : Path x y) : f.1.Homotopy (rebase f p).1 where - toFun q := rebaseValue f p q.1 q.2 - continuous_toFun := continuous_rebaseValue f p - map_zero_left := rebaseValue_zero f p - map_one_left _ := rfl - -end NearbyLagrangian.CubicalFreeNullity - -end - -end OAI +import Mathlib + +namespace OAI + +/-! Cubical free nullity and change of basepoint. -/ + +noncomputable section +universe u v w +open Set ContinuousMap +open scoped Topology Topology.Homotopy + +namespace NearbyLagrangian.CubicalFreeNullity +variable {N : Type*} [Fintype N] [Nonempty N] + +def radius (t : N → unitInterval) : ℝ := ‖fun i => 2*(t i:ℝ)-1‖ +omit [Nonempty N] in +lemma radius_nonneg (t : N → unitInterval) : 0 ≤ radius t := norm_nonneg _ +omit [Nonempty N] in +lemma radius_le_one (t : N → unitInterval) : radius t ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0:ℝ) ≤ 1)).mpr + intro i + rw [Real.norm_eq_abs,abs_le] + have hi₀ := (t i).property.1 + have hi₁ := (t i).property.2 + constructor <;> linarith +omit [Nonempty N] in +lemma continuous_radius : Continuous (radius (N:=N)) := + (continuous_pi fun i => (continuous_const.mul + (continuous_subtype_val.comp (continuous_apply i))).sub continuous_const).norm +omit [Nonempty N] in +lemma radius_boundary {t : N → unitInterval} (ht : t ∈ Cube.boundary N) : radius t = 1 := by + apply le_antisymm (radius_le_one t) + obtain ⟨i,hi⟩ := ht + have hh := norm_le_pi_norm (fun i => 2*(t i:ℝ)-1) i + rcases hi with hi | hi + · simpa [radius,hi] using hh + · norm_num [hi] at hh + exact hh + +def collarTime (s : unitInterval) (t : N → unitInterval) : unitInterval := + ⟨min (s:ℝ) (2*(1-radius t)), + le_min s.property.1 (by have := radius_le_one t; linarith), + (min_le_left _ _).trans s.property.2⟩ +omit [Nonempty N] in +lemma continuous_collarTime : Continuous (fun a : unitInterval × (N → unitInterval) => collarTime a.1 a.2) := + ((continuous_subtype_val.comp continuous_fst).min + (continuous_const.mul (continuous_const.sub (continuous_radius.comp continuous_snd)))).subtype_mk _ +omit [Nonempty N] in +@[simp] lemma collarTime_zero (t : N → unitInterval) : collarTime 0 t = 0 := by + apply Subtype.ext + change min 0 (2*(1-radius t)) = 0 + apply min_eq_left + have := radius_le_one t + linarith +omit [Nonempty N] in +lemma collarTime_boundary (s : unitInterval) {t : N → unitInterval} (ht : t ∈ Cube.boundary N) : + collarTime s t = 0 := by + apply Subtype.ext + change min (s:ℝ) (2*(1-radius t)) = 0 + rw [radius_boundary ht] + simp only [sub_self,mul_zero,min_eq_right s.property.1] + +lemma denominator_pos (s : unitInterval) : 0 < 1-(s:ℝ)/2 := by + have := s.property.2 + linarith + +def expand (s : unitInterval) (t : N → unitInterval) : N → unitInterval := + fun i => projIcc 0 1 (zero_le_one' ℝ) (((t i:ℝ)-(s:ℝ)/4)/(1-(s:ℝ)/2)) +omit [Fintype N] [Nonempty N] in +lemma continuous_expand : Continuous (fun a : unitInterval × (N → unitInterval) => expand a.1 a.2) := by + apply continuous_pi + intro i + apply continuous_projIcc.comp + exact ((continuous_subtype_val.comp ((continuous_apply i).comp continuous_snd)).sub + ((continuous_subtype_val.comp continuous_fst).div_const 4)).div + (continuous_const.sub ((continuous_subtype_val.comp continuous_fst).div_const 2)) + (fun a => ne_of_gt (denominator_pos a.1)) +omit [Fintype N] [Nonempty N] in +@[simp] lemma expand_zero (t : N → unitInterval) : expand 0 t = t := by + funext i + change projIcc 0 1 _ (((t i:ℝ)-(0:ℝ)/4)/(1-(0:ℝ)/2)) = t i + simp only [zero_div,sub_zero,div_one,projIcc_val] + +lemma expand_mem_boundary {s : unitInterval} {t : N → unitInterval} + (ht : 1-(s:ℝ)/2 ≤ radius t) : expand s t ∈ Cube.boundary N := by + obtain ⟨⟨i,hi⟩,_⟩ := IsGreatest.pi_norm (fun i => 2*(t i:ℝ)-1) + have habs : 1-(s:ℝ)/2 ≤ |2*(t i:ℝ)-1| := by + change ‖2*(t i:ℝ)-1‖ = radius t at hi + rw [Real.norm_eq_abs] at hi + exact ht.trans_eq hi.symm + rcases (le_abs.mp habs) with h | h + · refine ⟨i,Or.inr ?_⟩ + apply projIcc_of_right_le + apply (le_div_iff₀ (denominator_pos s)).mpr + linarith + · refine ⟨i,Or.inl ?_⟩ + apply projIcc_of_le_left + apply div_nonpos_of_nonpos_of_nonneg _ (denominator_pos s).le + linarith + +lemma expand_boundary (s : unitInterval) {t : N → unitInterval} (ht : t ∈ Cube.boundary N) : + expand s t ∈ Cube.boundary N := by + apply expand_mem_boundary + rw [radius_boundary ht] + have := s.property.1 + linarith + +variable {X : Type*} [TopologicalSpace X] + +theorem null_of_moving_base {x y : X} (f : GenLoop N X x) + (H : f.1.Homotopy (ContinuousMap.const _ y)) + (p : C(unitInterval,X)) + (hp : ∀ s t, t ∈ Cube.boundary N → H (s,t) = p s) : + GenLoop.Homotopic f GenLoop.const := by + let z : N → unitInterval := fun _ => 0 + have hz : z ∈ Cube.boundary N := ⟨Classical.choice inferInstance,Or.inl rfl⟩ + have hp0 : p 0 = x := by + rw [← hp 0 z hz,H.apply_zero] + exact GenLoop.boundary f z hz + have hp1 : p 1 = y := by rw [← hp 1 z hz,H.apply_one]; rfl + let a : C(N → unitInterval,X) := p.comp ⟨fun t => collarTime 1 t, + continuous_collarTime.comp (continuous_const.prodMk continuous_id)⟩ + have ha (t : N → unitInterval) : H (collarTime 1 t,expand 1 t) = a t := by + change H (collarTime 1 t,expand 1 t) = p (collarTime 1 t) + by_cases ht : collarTime 1 t = 1 + · rw [ht,H.apply_one,hp1]; rfl + · apply hp + apply expand_mem_boundary + have hk : (collarTime 1 t:ℝ) < 1 := lt_of_le_of_ne (collarTime 1 t).property.2 + (fun h => ht (Subtype.ext h)) + change min 1 (2*(1-radius t)) < 1 at hk + have hr : 2*(1-radius t) < 1 := by simpa only [min_lt_iff,lt_self_iff_false,false_or] using hk + change 1-(1:ℝ)/2 ≤ radius t + linarith + let H₁ : f.1.HomotopyRel a (Cube.boundary N) := { + toFun := fun q => H (collarTime q.1 q.2,expand q.1 q.2) + continuous_toFun := H.continuous.comp (continuous_collarTime.prodMk continuous_expand) + map_zero_left := by intro t; simp only [collarTime_zero,expand_zero,H.apply_zero] + map_one_left := ha + prop' := by + intro s t ht + change H (collarTime s t,expand s t) = f t + rw [collarTime_boundary s ht,hp 0 _ (expand_boundary s ht),hp0,GenLoop.boundary f t ht] } + let H₂ : a.HomotopyRel (ContinuousMap.const _ x) (Cube.boundary N) := { + toFun := fun q => p ⟨(1-(q.1:ℝ))*(collarTime 1 q.2:ℝ), + mul_nonneg (by linarith [q.1.property.2]) (collarTime _ _).property.1, + (mul_le_of_le_one_left (collarTime _ _).property.1 + (by linarith [q.1.property.1])).trans (collarTime _ _).property.2⟩ + continuous_toFun := p.continuous.comp (Continuous.subtype_mk + ((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).mul + (continuous_subtype_val.comp (continuous_collarTime.comp (continuous_const.prodMk continuous_snd)))) _) + map_zero_left := by + intro t + change p _ = p (collarTime 1 t) + congr 1 + apply Subtype.ext + change (1-(0:ℝ))*(collarTime 1 t:ℝ) = (collarTime 1 t:ℝ) + ring + map_one_left := by + intro t + change p _ = x + convert hp0 using 1 + congr 1 + apply Subtype.ext + change (1-(1:ℝ))*(collarTime 1 t:ℝ) = 0 + ring + prop' := by + intro s t ht + change p _ = p (collarTime 1 t) + rw [collarTime_boundary 1 ht] + congr 1 + apply Subtype.ext + change (1-(s:ℝ))*(0:ℝ) = 0 + ring } + exact ⟨H₁.trans H₂⟩ + +end NearbyLagrangian.CubicalFreeNullity + +end + +noncomputable section +universe u v w +open scoped Classical Topology Topology.Homotopy + +namespace NearbyLagrangian.CubicalFreeNullity +variable {N : Type*} [Fintype N] [Nonempty N] +variable {X : Type*} [TopologicalSpace X] {x y : X} + +def outerTime (s : unitInterval) (t : N → unitInterval) : unitInterval := + ⟨max 0 ((s:ℝ)-2*(1-radius t)),le_max_left _ _,by + apply max_le zero_le_one + have := radius_le_one t + linarith [s.property.2]⟩ +omit [Nonempty N] in +lemma continuous_outerTime : Continuous (fun a : unitInterval × (N → unitInterval) => outerTime a.1 a.2) := + ((continuous_const.max ((continuous_subtype_val.comp continuous_fst).sub + (continuous_const.mul (continuous_const.sub (continuous_radius.comp continuous_snd)))))).subtype_mk _ + +omit [Nonempty N] in +lemma outerTime_eq_zero {s : unitInterval} {t : N → unitInterval} + (h : radius t ≤ 1-(s:ℝ)/2) : outerTime s t = 0 := by + apply Subtype.ext + change max 0 ((s:ℝ)-2*(1-radius t)) = 0 + apply max_eq_left + linarith + +omit [Nonempty N] in +lemma outerTime_boundary (s : unitInterval) {t : N → unitInterval} + (h : t ∈ Cube.boundary N) : outerTime s t = s := by + apply Subtype.ext + change max 0 ((s:ℝ)-2*(1-radius t)) = s + rw [radius_boundary h] + simp only [sub_self,mul_zero,sub_zero,max_eq_right s.property.1] + +def rebaseValue (f : GenLoop N X x) (p : Path x y) (s : unitInterval) + (t : N → unitInterval) : X := + if radius t ≤ 1-(s:ℝ)/2 then f (expand s t) else p (outerTime s t) + +lemma continuous_rebaseValue (f : GenLoop N X x) (p : Path x y) : + Continuous (fun q : unitInterval × (N → unitInterval) => rebaseValue f p q.1 q.2) := by + apply (f.1.continuous.comp continuous_expand).if_le + (p.continuous.comp continuous_outerTime) (continuous_radius.comp continuous_snd) + (continuous_const.sub ((continuous_subtype_val.comp continuous_fst).div_const 2)) + intro q h + change f (expand q.1 q.2) = p (outerTime q.1 q.2) + change radius q.2 = 1-(q.1:ℝ)/2 at h + rw [GenLoop.boundary f _ (expand_mem_boundary h.ge),outerTime_eq_zero h.le,p.source] + +omit [Nonempty N] in +@[simp] lemma rebaseValue_zero (f : GenLoop N X x) (p : Path x y) + (t : N → unitInterval) : rebaseValue f p 0 t = f t := by + rw [rebaseValue,ite_eq_left (by simpa using radius_le_one t),expand_zero] + +omit [Nonempty N] in +lemma rebaseValue_boundary (f : GenLoop N X x) (p : Path x y) + (s : unitInterval) {t : N → unitInterval} (ht : t ∈ Cube.boundary N) : + rebaseValue f p s t = p s := by + rw [rebaseValue] + split_ifs with h + · have hs : s = 0 := by + apply Subtype.ext + change (s:ℝ) = 0 + rw [radius_boundary ht] at h + linarith [s.property.1] + rw [hs,expand_zero,GenLoop.boundary f t ht,p.source] + · rw [outerTime_boundary s ht] + +def rebase (f : GenLoop N X x) (p : Path x y) : GenLoop N X y := + ⟨⟨fun t => rebaseValue f p 1 t, + (continuous_rebaseValue f p).comp (continuous_const.prodMk continuous_id)⟩, + fun _t ht => (rebaseValue_boundary f p 1 ht).trans p.target⟩ + +def rebaseHomotopy (f : GenLoop N X x) (p : Path x y) : f.1.Homotopy (rebase f p).1 where + toFun q := rebaseValue f p q.1 q.2 + continuous_toFun := continuous_rebaseValue f p + map_zero_left := rebaseValue_zero f p + map_one_left _ := rfl + +end NearbyLagrangian.CubicalFreeNullity + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/CubicalSpheres.lean b/lean/OAI/Topology/Homotopy/CubicalSpheres.lean index e858b1d49ef8ed1dcd3399d853f57304d654116a..e25ee2882a13d2a24550de58e0f69a4b04c7a781 100644 --- a/lean/OAI/Topology/Homotopy/CubicalSpheres.lean +++ b/lean/OAI/Topology/Homotopy/CubicalSpheres.lean @@ -1,341 +1,341 @@ -import Mathlib -import OAI.Topology.Homotopy.CubicalNullity -import OAI.Topology.Homotopy.OpenCollapse - -namespace OAI - -/-! Cubical and spherical representatives of homotopy classes. -/ - -noncomputable section -universe u v w -open Set ContinuousMap Topology -open scoped OnePoint Topology Topology.Homotopy - -namespace NearbyLagrangian.CubicalSphere -variable (N : Type*) [Fintype N] [Nonempty N] - -def interiorCube : Set (N → unitInterval) := {t | ∀ i, 0 < (t i:ℝ) ∧ (t i:ℝ) < 1} -omit [Fintype N] [Nonempty N] in -lemma interiorCube_eq : interiorCube N = (Cube.boundary N)ᶜ := by - ext t - simp only [interiorCube,mem_ofPred_eq,Set.mem_compl_iff,Cube.boundary,not_exists,not_or] - constructor - · intro ht i - constructor - · intro h; have := (ht i).1; simp [h] at this - · intro h; have := (ht i).2; simp [h] at this - · intro ht i - constructor - · exact lt_of_le_of_ne (t i).property.1 (fun h => (ht i).1 (Subtype.ext h.symm)) - · exact lt_of_le_of_ne (t i).property.2 (fun h => (ht i).2 (Subtype.ext h)) - -omit [Nonempty N] in -lemma isOpen_interiorCube : IsOpen (interiorCube N) := by - have he : interiorCube N = ⋂ i, {t : N → unitInterval | 0 < (t i:ℝ) ∧ (t i:ℝ) < 1} := by - ext t; simp [interiorCube] - rw [he] - apply isOpen_iInter_of_finite - intro i - exact isOpen_Ioo.preimage (continuous_subtype_val.comp (continuous_apply i)) - -omit [Fintype N] in -lemma complement_nonempty : (interiorCube N)ᶜ.Nonempty := by - refine ⟨fun _ => 0,?_⟩ - rw [interiorCube_eq,compl_compl] - exact ⟨Classical.choice inferInstance,Or.inl rfl⟩ - -def interiorHomeomorph : interiorCube N ≃ₜ (N → Ioo (0:ℝ) 1) where - toFun t i := ⟨t.1 i,(t.property i)⟩ - invFun t := ⟨fun i => ⟨(t i:ℝ),(t i).property.1.le,(t i).property.2.le⟩, - fun i => (t i).property⟩ - left_inv _ := rfl - right_inv _ := rfl - continuous_toFun := by - apply continuous_pi - intro i - exact (continuous_subtype_val.comp ((continuous_apply i).comp continuous_subtype_val)).subtype_mk _ - continuous_invFun := by - apply Continuous.subtype_mk - apply continuous_pi - intro i - exact (continuous_subtype_val.comp (continuous_apply i)).subtype_mk _ - -def intervalHomeomorph : Ioo (0:ℝ) 1 ≃ₜ Ioo (-1:ℝ) 1 where - toFun x := ⟨2*(x:ℝ)-1,by have h := x.property; constructor <;> linarith [h.1,h.2]⟩ - invFun y := ⟨((y:ℝ)+1)/2,by have h := y.property; constructor <;> linarith [h.1,h.2]⟩ - left_inv x := Subtype.ext (by dsimp; ring) - right_inv y := Subtype.ext (by dsimp; ring) - continuous_toFun := by - apply Continuous.subtype_mk - exact (continuous_const.mul continuous_subtype_val).sub continuous_const - continuous_invFun := by - apply Continuous.subtype_mk - exact (continuous_subtype_val.add continuous_const).div_const 2 - -def interiorEuclidean : interiorCube N ≃ₜ (N → ℝ) := - (interiorHomeomorph N).trans (Homeomorph.piCongrRight fun _ => - intervalHomeomorph.trans (orderIsoIooNegOneOne ℝ).toHomeomorph.symm) - -def compactificationSphere (n : ℕ) : OnePoint (interiorCube (Fin (n+1))) ≃ₜ - Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1 := - (interiorEuclidean (Fin (n+1))).onePointCongr.trans - (onePointEquivSphereOfFinrankEq (by simp)) - -def spherePoint (n : ℕ) : Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1 := - compactificationSphere n ∞ - -def sphereQuotient (n : ℕ) : C((Fin (n+1) → unitInterval), - Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1) := - ⟨fun t => compactificationSphere n (OpenCollapse.collapse (interiorCube _) t), - (compactificationSphere n).continuous.comp - (OpenCollapse.continuous_collapse (isOpen_interiorCube _))⟩ - -lemma sphereQuotient_boundary (n : ℕ) {t : Fin (n+1) → unitInterval} - (ht : t ∈ Cube.boundary _) : sphereQuotient n t = spherePoint n := by - change compactificationSphere n _ = compactificationSphere n ∞ - rw [OpenCollapse.collapse_of_notMem] - simpa only [interiorCube_eq,mem_compl_iff,not_not] using ht - -lemma sphereQuotient_surjective (n : ℕ) : Function.Surjective (sphereQuotient n) := - (compactificationSphere n).surjective.comp - (OpenCollapse.collapse_surjective (complement_nonempty _)) - -variable {X : Type*} [TopologicalSpace X] {x : X} - -def sphereMap {n : ℕ} (f : GenLoop (Fin (n+1)) X x) : - C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X) := - (OpenCollapse.descend (isOpen_interiorCube _) (complement_nonempty _) f.1 x - (fun t ht => GenLoop.boundary f t (by simpa only [interiorCube_eq,mem_compl_iff,not_not] using ht))).comp - ⟨(compactificationSphere n).symm,(compactificationSphere n).symm.continuous⟩ - -@[simp] lemma sphereMap_quotient {n : ℕ} (f : GenLoop (Fin (n+1)) X x) - (t : Fin (n+1) → unitInterval) : sphereMap f (sphereQuotient n t) = f t := by - simp only [sphereMap,ContinuousMap.comp_apply,ContinuousMap.coe_mk,sphereQuotient, - Homeomorph.symm_apply_apply,OpenCollapse.descend_collapse] - rfl - -@[simp] lemma sphereMap_point {n : ℕ} (f : GenLoop (Fin (n+1)) X x) : - sphereMap f (spherePoint n) = x := by - simp only [sphereMap,ContinuousMap.comp_apply,ContinuousMap.coe_mk,spherePoint, - Homeomorph.symm_apply_apply] - rfl - -theorem sphereMap_null_implies_cube_null {n : ℕ} (f : GenLoop (Fin (n+1)) X x) - (hf : (sphereMap f).Nullhomotopic) : GenLoop.Homotopic f GenLoop.const := by - obtain ⟨y,⟨H⟩⟩ := hf - let H' : f.1.Homotopy (ContinuousMap.const _ y) := { - toFun := fun q => H (q.1,sphereQuotient n q.2) - continuous_toFun := H.continuous.comp (continuous_fst.prodMk ((sphereQuotient n).continuous.comp continuous_snd)) - map_zero_left := fun t => (H.apply_zero _).trans (sphereMap_quotient f t) - map_one_left := fun t => H.apply_one _ } - let p : C(unitInterval,X) := - ⟨fun s => H (s,spherePoint n),H.continuous.comp (continuous_id.prodMk continuous_const)⟩ - apply CubicalFreeNullity.null_of_moving_base f H' p - intro s t ht - change H (s,sphereQuotient n t) = H (s,spherePoint n) - rw [sphereQuotient_boundary n ht] - -theorem sphereMap_null_implies_class_one {n : ℕ} (f : GenLoop (Fin (n+1)) X x) - (hf : (sphereMap f).Nullhomotopic) : - (⟦f⟧ : HomotopyGroup.Pi (n+1) X x) = (1 : HomotopyGroup.Pi (n+1) X x) := by - rw [HomotopyGroup.one_def] - exact Quotient.sound (sphereMap_null_implies_cube_null f hf) - -end NearbyLagrangian.CubicalSphere - -end - -noncomputable section -universe u v w -open Set ContinuousMap Topology -open scoped OnePoint Topology Topology.Homotopy - -namespace NearbyLagrangian.CubicalSphere -variable {X : Type*} [TopologicalSpace X] {x : X} - -def sphereHomotopy {n : ℕ} {f g : GenLoop (Fin (n+1)) X x} - (H : f.1.HomotopyRel g.1 (Cube.boundary _)) : (sphereMap f).Homotopy (sphereMap g) where - toFun := fun q => ((compactificationSphere n).symm q.2).elim x - (fun t => H (q.1,t)) - continuous_toFun := by - let F : C(unitInterval × (Fin (n+1) → unitInterval),X) := ⟨H,H.continuous⟩ - have hF : ∀ s t, t ∉ interiorCube (Fin (n+1)) → F (s,t) = x := by - intro s t ht - have ht' : t ∈ Cube.boundary _ := by - simpa only [interiorCube_eq,mem_compl_iff,not_not] using ht - exact (H.eq_fst s ht').trans (GenLoop.boundary f t ht') - exact (OpenCollapse.continuous_descend_param (isOpen_interiorCube _) (complement_nonempty _) - F (const _ x) hF).comp (continuous_fst.prodMk - ((compactificationSphere n).symm.continuous.comp continuous_snd)) - map_zero_left := by - intro u - change ((compactificationSphere n).symm u).elim x (fun t => H (0,t)) = - ((compactificationSphere n).symm u).elim x (fun t => f t) - generalize (compactificationSphere n).symm u = z - induction z using OnePoint.rec with - | infty => rfl - | coe t => exact H.apply_zero t - map_one_left := by - intro u - change ((compactificationSphere n).symm u).elim x (fun t => H (1,t)) = - ((compactificationSphere n).symm u).elim x (fun t => g t) - generalize (compactificationSphere n).symm u = z - induction z using OnePoint.rec with - | infty => rfl - | coe t => exact H.apply_one t - -@[simp] theorem sphereMap_const (n : ℕ) : sphereMap (GenLoop.const : GenLoop (Fin (n+1)) X x) = - ContinuousMap.const _ x := by - ext u - obtain ⟨t,rfl⟩ := sphereQuotient_surjective n u - exact sphereMap_quotient GenLoop.const t - -theorem sphereMap_null_iff_cube_null {n : ℕ} (f : GenLoop (Fin (n+1)) X x) : - (sphereMap f).Nullhomotopic ↔ GenLoop.Homotopic f GenLoop.const := by - constructor - · exact sphereMap_null_implies_cube_null f - · rintro ⟨H⟩ - refine ⟨x,?_⟩ - rw [← sphereMap_const] - exact ⟨sphereHomotopy H⟩ - -theorem sphereMap_null_iff_class_one {n : ℕ} (f : GenLoop (Fin (n+1)) X x) : - (sphereMap f).Nullhomotopic ↔ - (⟦f⟧ : HomotopyGroup.Pi (n+1) X x) = (1 : HomotopyGroup.Pi (n+1) X x) := by - rw [sphereMap_null_iff_cube_null,HomotopyGroup.one_def,Quotient.eq] - rfl - -end NearbyLagrangian.CubicalSphere - -end - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.SphereConnectivity -open scoped Topology Topology.Homotopy - -def genLoopMap {N A B : Type*} [TopologicalSpace A] [TopologicalSpace B] - (e : C(A,B)) {x : A} (f : GenLoop N A x) : GenLoop N B (e x) := - ⟨e.comp f.1,fun t ht => congrArg e (GenLoop.boundary f t ht)⟩ -lemma genLoopMap_homotopic {N A B : Type*} [TopologicalSpace A] [TopologicalSpace B] - (e : C(A,B)) {x : A} {f g : GenLoop N A x} (h : GenLoop.Homotopic f g) : - GenLoop.Homotopic (genLoopMap e f) (genLoopMap e g) := by - obtain ⟨H⟩ := h - exact ⟨H.compContinuousMap e⟩ -def homotopyGroupMap {n : ℕ} {A B : Type*} [TopologicalSpace A] [TopologicalSpace B] - (e : C(A,B)) (x : A) : HomotopyGroup.Pi n A x → HomotopyGroup.Pi n B (e x) := - Quotient.map (genLoopMap e) (fun _ _ h => genLoopMap_homotopic e h) -end NearbyLagrangian.SphereConnectivity - -end - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.CubicalSphere -open Set ContinuousMap SphereConnectivity -open scoped Topology Topology.Homotopy -variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {x : X} - -def sphereLoop {n : ℕ} - (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) : - GenLoop (Fin (n+1)) X (a (spherePoint n)) := - ⟨a.comp (sphereQuotient n),fun _t ht => congrArg a (sphereQuotient_boundary n ht)⟩ - -@[simp] theorem sphereMap_sphereLoop {n : ℕ} - (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) : - sphereMap (sphereLoop a) = a := by - ext u - obtain ⟨t,rfl⟩ := sphereQuotient_surjective n u - rw [sphereMap_quotient] - rfl - -@[simp] theorem sphereMap_natural {n : ℕ} (e : C(X,Y)) - (f : GenLoop (Fin (n+1)) X x) : - sphereMap (genLoopMap e f) = e.comp (sphereMap f) := by - ext u - obtain ⟨t,rfl⟩ := sphereQuotient_surjective n u - rw [sphereMap_quotient,ContinuousMap.comp_apply,sphereMap_quotient] - rfl - -theorem null_iff_class_one {n : ℕ} - (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) : - a.Nullhomotopic ↔ - (⟦sphereLoop a⟧ : HomotopyGroup.Pi (n+1) X (a (spherePoint n))) = - (1 : HomotopyGroup.Pi (n+1) X (a (spherePoint n))) := by - simpa only [sphereMap_sphereLoop] using sphereMap_null_iff_class_one (sphereLoop a) - -theorem comp_null_iff_mapped_class_one {n : ℕ} (e : C(X,Y)) - (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) : - (e.comp a).Nullhomotopic ↔ - homotopyGroupMap (n:=n+1) e (a (spherePoint n)) ⟦sphereLoop a⟧ = - (1 : HomotopyGroup.Pi (n+1) Y (e (a (spherePoint n)))) := by - change (e.comp a).Nullhomotopic ↔ - (⟦genLoopMap e (sphereLoop a)⟧ : HomotopyGroup.Pi (n+1) Y (e (a (spherePoint n)))) = _ - simpa only [sphereMap_natural,sphereMap_sphereLoop] using - sphereMap_null_iff_class_one (genLoopMap e (sphereLoop a)) - -end NearbyLagrangian.CubicalSphere - -end - -noncomputable section -universe u v w -open scoped Classical Topology Topology.Homotopy - -namespace NearbyLagrangian.CubicalSphere -open Set ContinuousMap -open scoped OnePoint -variable {X : Type*} [TopologicalSpace X] {x y : X} - -def sphereMovingHomotopy {n : ℕ} {f : GenLoop (Fin (n+1)) X x} - {g : GenLoop (Fin (n+1)) X y} (H : f.1.Homotopy g.1) - (p : Path x y) (hp : ∀ s t, t ∈ Cube.boundary (Fin (n+1)) → H (s,t) = p s) : - (sphereMap f).Homotopy (sphereMap g) where - toFun q := ((compactificationSphere n).symm q.2).elim (p q.1) (fun t => H (q.1,t)) - continuous_toFun := by - let F : C(unitInterval × (Fin (n+1) → unitInterval),X) := ⟨H,H.continuous⟩ - have hF (s : unitInterval) (t : Fin (n+1) → unitInterval) - (ht : t ∉ interiorCube (Fin (n+1))) : F (s,t) = p s := by - apply hp - simpa only [interiorCube_eq,mem_compl_iff,not_not] using ht - exact (OpenCollapse.continuous_descend_param (isOpen_interiorCube _) (complement_nonempty _) - F p.toContinuousMap hF).comp (continuous_fst.prodMk - ((compactificationSphere n).symm.continuous.comp continuous_snd)) - map_zero_left := by - intro u - change ((compactificationSphere n).symm u).elim (p 0) (fun t => H (0,t)) = - ((compactificationSphere n).symm u).elim x (fun t => f t) - rw [p.source] - generalize (compactificationSphere n).symm u = z - induction z using OnePoint.rec with - | infty => rfl - | coe t => exact H.apply_zero t - map_one_left := by - intro u - change ((compactificationSphere n).symm u).elim (p 1) (fun t => H (1,t)) = - ((compactificationSphere n).symm u).elim y (fun t => g t) - rw [p.target] - generalize (compactificationSphere n).symm u = z - induction z using OnePoint.rec with - | infty => rfl - | coe t => exact H.apply_one t - -theorem exists_based_representative [PathConnectedSpace X] {n : ℕ} - (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) (x : X) : - ∃ f : GenLoop (Fin (n+1)) X x, a.Homotopic (sphereMap f) := by - obtain ⟨p⟩ := PathConnectedSpace.joined (a (spherePoint n)) x - refine ⟨CubicalFreeNullity.rebase (sphereLoop a) p,?_⟩ - have h := sphereMovingHomotopy (CubicalFreeNullity.rebaseHomotopy (sphereLoop a) p) p - (fun s _t ht => CubicalFreeNullity.rebaseValue_boundary (sphereLoop a) p s ht) - simpa only [sphereMap_sphereLoop] using (show (sphereMap (sphereLoop a)).Homotopic - (sphereMap (CubicalFreeNullity.rebase (sphereLoop a) p)) from ⟨h⟩) - -end NearbyLagrangian.CubicalSphere - -end - -end OAI +import Mathlib +import OAI.Topology.Homotopy.CubicalNullity +import OAI.Topology.Homotopy.OpenCollapse + +namespace OAI + +/-! Cubical and spherical representatives of homotopy classes. -/ + +noncomputable section +universe u v w +open Set ContinuousMap Topology +open scoped OnePoint Topology Topology.Homotopy + +namespace NearbyLagrangian.CubicalSphere +variable (N : Type*) [Fintype N] [Nonempty N] + +def interiorCube : Set (N → unitInterval) := {t | ∀ i, 0 < (t i:ℝ) ∧ (t i:ℝ) < 1} +omit [Fintype N] [Nonempty N] in +lemma interiorCube_eq : interiorCube N = (Cube.boundary N)ᶜ := by + ext t + simp only [interiorCube,mem_ofPred_eq,Set.mem_compl_iff,Cube.boundary,not_exists,not_or] + constructor + · intro ht i + constructor + · intro h; have := (ht i).1; simp [h] at this + · intro h; have := (ht i).2; simp [h] at this + · intro ht i + constructor + · exact lt_of_le_of_ne (t i).property.1 (fun h => (ht i).1 (Subtype.ext h.symm)) + · exact lt_of_le_of_ne (t i).property.2 (fun h => (ht i).2 (Subtype.ext h)) + +omit [Nonempty N] in +lemma isOpen_interiorCube : IsOpen (interiorCube N) := by + have he : interiorCube N = ⋂ i, {t : N → unitInterval | 0 < (t i:ℝ) ∧ (t i:ℝ) < 1} := by + ext t; simp [interiorCube] + rw [he] + apply isOpen_iInter_of_finite + intro i + exact isOpen_Ioo.preimage (continuous_subtype_val.comp (continuous_apply i)) + +omit [Fintype N] in +lemma complement_nonempty : (interiorCube N)ᶜ.Nonempty := by + refine ⟨fun _ => 0,?_⟩ + rw [interiorCube_eq,compl_compl] + exact ⟨Classical.choice inferInstance,Or.inl rfl⟩ + +def interiorHomeomorph : interiorCube N ≃ₜ (N → Ioo (0:ℝ) 1) where + toFun t i := ⟨t.1 i,(t.property i)⟩ + invFun t := ⟨fun i => ⟨(t i:ℝ),(t i).property.1.le,(t i).property.2.le⟩, + fun i => (t i).property⟩ + left_inv _ := rfl + right_inv _ := rfl + continuous_toFun := by + apply continuous_pi + intro i + exact (continuous_subtype_val.comp ((continuous_apply i).comp continuous_subtype_val)).subtype_mk _ + continuous_invFun := by + apply Continuous.subtype_mk + apply continuous_pi + intro i + exact (continuous_subtype_val.comp (continuous_apply i)).subtype_mk _ + +def intervalHomeomorph : Ioo (0:ℝ) 1 ≃ₜ Ioo (-1:ℝ) 1 where + toFun x := ⟨2*(x:ℝ)-1,by have h := x.property; constructor <;> linarith [h.1,h.2]⟩ + invFun y := ⟨((y:ℝ)+1)/2,by have h := y.property; constructor <;> linarith [h.1,h.2]⟩ + left_inv x := Subtype.ext (by dsimp; ring) + right_inv y := Subtype.ext (by dsimp; ring) + continuous_toFun := by + apply Continuous.subtype_mk + exact (continuous_const.mul continuous_subtype_val).sub continuous_const + continuous_invFun := by + apply Continuous.subtype_mk + exact (continuous_subtype_val.add continuous_const).div_const 2 + +def interiorEuclidean : interiorCube N ≃ₜ (N → ℝ) := + (interiorHomeomorph N).trans (Homeomorph.piCongrRight fun _ => + intervalHomeomorph.trans (orderIsoIooNegOneOne ℝ).toHomeomorph.symm) + +def compactificationSphere (n : ℕ) : OnePoint (interiorCube (Fin (n+1))) ≃ₜ + Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1 := + (interiorEuclidean (Fin (n+1))).onePointCongr.trans + (onePointEquivSphereOfFinrankEq (by simp)) + +def spherePoint (n : ℕ) : Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1 := + compactificationSphere n ∞ + +def sphereQuotient (n : ℕ) : C((Fin (n+1) → unitInterval), + Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1) := + ⟨fun t => compactificationSphere n (OpenCollapse.collapse (interiorCube _) t), + (compactificationSphere n).continuous.comp + (OpenCollapse.continuous_collapse (isOpen_interiorCube _))⟩ + +lemma sphereQuotient_boundary (n : ℕ) {t : Fin (n+1) → unitInterval} + (ht : t ∈ Cube.boundary _) : sphereQuotient n t = spherePoint n := by + change compactificationSphere n _ = compactificationSphere n ∞ + rw [OpenCollapse.collapse_of_notMem] + simpa only [interiorCube_eq,mem_compl_iff,not_not] using ht + +lemma sphereQuotient_surjective (n : ℕ) : Function.Surjective (sphereQuotient n) := + (compactificationSphere n).surjective.comp + (OpenCollapse.collapse_surjective (complement_nonempty _)) + +variable {X : Type*} [TopologicalSpace X] {x : X} + +def sphereMap {n : ℕ} (f : GenLoop (Fin (n+1)) X x) : + C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X) := + (OpenCollapse.descend (isOpen_interiorCube _) (complement_nonempty _) f.1 x + (fun t ht => GenLoop.boundary f t (by simpa only [interiorCube_eq,mem_compl_iff,not_not] using ht))).comp + ⟨(compactificationSphere n).symm,(compactificationSphere n).symm.continuous⟩ + +@[simp] lemma sphereMap_quotient {n : ℕ} (f : GenLoop (Fin (n+1)) X x) + (t : Fin (n+1) → unitInterval) : sphereMap f (sphereQuotient n t) = f t := by + simp only [sphereMap,ContinuousMap.comp_apply,ContinuousMap.coe_mk,sphereQuotient, + Homeomorph.symm_apply_apply,OpenCollapse.descend_collapse] + rfl + +@[simp] lemma sphereMap_point {n : ℕ} (f : GenLoop (Fin (n+1)) X x) : + sphereMap f (spherePoint n) = x := by + simp only [sphereMap,ContinuousMap.comp_apply,ContinuousMap.coe_mk,spherePoint, + Homeomorph.symm_apply_apply] + rfl + +theorem sphereMap_null_implies_cube_null {n : ℕ} (f : GenLoop (Fin (n+1)) X x) + (hf : (sphereMap f).Nullhomotopic) : GenLoop.Homotopic f GenLoop.const := by + obtain ⟨y,⟨H⟩⟩ := hf + let H' : f.1.Homotopy (ContinuousMap.const _ y) := { + toFun := fun q => H (q.1,sphereQuotient n q.2) + continuous_toFun := H.continuous.comp (continuous_fst.prodMk ((sphereQuotient n).continuous.comp continuous_snd)) + map_zero_left := fun t => (H.apply_zero _).trans (sphereMap_quotient f t) + map_one_left := fun t => H.apply_one _ } + let p : C(unitInterval,X) := + ⟨fun s => H (s,spherePoint n),H.continuous.comp (continuous_id.prodMk continuous_const)⟩ + apply CubicalFreeNullity.null_of_moving_base f H' p + intro s t ht + change H (s,sphereQuotient n t) = H (s,spherePoint n) + rw [sphereQuotient_boundary n ht] + +theorem sphereMap_null_implies_class_one {n : ℕ} (f : GenLoop (Fin (n+1)) X x) + (hf : (sphereMap f).Nullhomotopic) : + (⟦f⟧ : HomotopyGroup.Pi (n+1) X x) = (1 : HomotopyGroup.Pi (n+1) X x) := by + rw [HomotopyGroup.one_def] + exact Quotient.sound (sphereMap_null_implies_cube_null f hf) + +end NearbyLagrangian.CubicalSphere + +end + +noncomputable section +universe u v w +open Set ContinuousMap Topology +open scoped OnePoint Topology Topology.Homotopy + +namespace NearbyLagrangian.CubicalSphere +variable {X : Type*} [TopologicalSpace X] {x : X} + +def sphereHomotopy {n : ℕ} {f g : GenLoop (Fin (n+1)) X x} + (H : f.1.HomotopyRel g.1 (Cube.boundary _)) : (sphereMap f).Homotopy (sphereMap g) where + toFun := fun q => ((compactificationSphere n).symm q.2).elim x + (fun t => H (q.1,t)) + continuous_toFun := by + let F : C(unitInterval × (Fin (n+1) → unitInterval),X) := ⟨H,H.continuous⟩ + have hF : ∀ s t, t ∉ interiorCube (Fin (n+1)) → F (s,t) = x := by + intro s t ht + have ht' : t ∈ Cube.boundary _ := by + simpa only [interiorCube_eq,mem_compl_iff,not_not] using ht + exact (H.eq_fst s ht').trans (GenLoop.boundary f t ht') + exact (OpenCollapse.continuous_descend_param (isOpen_interiorCube _) (complement_nonempty _) + F (const _ x) hF).comp (continuous_fst.prodMk + ((compactificationSphere n).symm.continuous.comp continuous_snd)) + map_zero_left := by + intro u + change ((compactificationSphere n).symm u).elim x (fun t => H (0,t)) = + ((compactificationSphere n).symm u).elim x (fun t => f t) + generalize (compactificationSphere n).symm u = z + induction z using OnePoint.rec with + | infty => rfl + | coe t => exact H.apply_zero t + map_one_left := by + intro u + change ((compactificationSphere n).symm u).elim x (fun t => H (1,t)) = + ((compactificationSphere n).symm u).elim x (fun t => g t) + generalize (compactificationSphere n).symm u = z + induction z using OnePoint.rec with + | infty => rfl + | coe t => exact H.apply_one t + +@[simp] theorem sphereMap_const (n : ℕ) : sphereMap (GenLoop.const : GenLoop (Fin (n+1)) X x) = + ContinuousMap.const _ x := by + ext u + obtain ⟨t,rfl⟩ := sphereQuotient_surjective n u + exact sphereMap_quotient GenLoop.const t + +theorem sphereMap_null_iff_cube_null {n : ℕ} (f : GenLoop (Fin (n+1)) X x) : + (sphereMap f).Nullhomotopic ↔ GenLoop.Homotopic f GenLoop.const := by + constructor + · exact sphereMap_null_implies_cube_null f + · rintro ⟨H⟩ + refine ⟨x,?_⟩ + rw [← sphereMap_const] + exact ⟨sphereHomotopy H⟩ + +theorem sphereMap_null_iff_class_one {n : ℕ} (f : GenLoop (Fin (n+1)) X x) : + (sphereMap f).Nullhomotopic ↔ + (⟦f⟧ : HomotopyGroup.Pi (n+1) X x) = (1 : HomotopyGroup.Pi (n+1) X x) := by + rw [sphereMap_null_iff_cube_null,HomotopyGroup.one_def,Quotient.eq] + rfl + +end NearbyLagrangian.CubicalSphere + +end + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.SphereConnectivity +open scoped Topology Topology.Homotopy + +def genLoopMap {N A B : Type*} [TopologicalSpace A] [TopologicalSpace B] + (e : C(A,B)) {x : A} (f : GenLoop N A x) : GenLoop N B (e x) := + ⟨e.comp f.1,fun t ht => congrArg e (GenLoop.boundary f t ht)⟩ +lemma genLoopMap_homotopic {N A B : Type*} [TopologicalSpace A] [TopologicalSpace B] + (e : C(A,B)) {x : A} {f g : GenLoop N A x} (h : GenLoop.Homotopic f g) : + GenLoop.Homotopic (genLoopMap e f) (genLoopMap e g) := by + obtain ⟨H⟩ := h + exact ⟨H.compContinuousMap e⟩ +def homotopyGroupMap {n : ℕ} {A B : Type*} [TopologicalSpace A] [TopologicalSpace B] + (e : C(A,B)) (x : A) : HomotopyGroup.Pi n A x → HomotopyGroup.Pi n B (e x) := + Quotient.map (genLoopMap e) (fun _ _ h => genLoopMap_homotopic e h) +end NearbyLagrangian.SphereConnectivity + +end + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.CubicalSphere +open Set ContinuousMap SphereConnectivity +open scoped Topology Topology.Homotopy +variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {x : X} + +def sphereLoop {n : ℕ} + (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) : + GenLoop (Fin (n+1)) X (a (spherePoint n)) := + ⟨a.comp (sphereQuotient n),fun _t ht => congrArg a (sphereQuotient_boundary n ht)⟩ + +@[simp] theorem sphereMap_sphereLoop {n : ℕ} + (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) : + sphereMap (sphereLoop a) = a := by + ext u + obtain ⟨t,rfl⟩ := sphereQuotient_surjective n u + rw [sphereMap_quotient] + rfl + +@[simp] theorem sphereMap_natural {n : ℕ} (e : C(X,Y)) + (f : GenLoop (Fin (n+1)) X x) : + sphereMap (genLoopMap e f) = e.comp (sphereMap f) := by + ext u + obtain ⟨t,rfl⟩ := sphereQuotient_surjective n u + rw [sphereMap_quotient,ContinuousMap.comp_apply,sphereMap_quotient] + rfl + +theorem null_iff_class_one {n : ℕ} + (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) : + a.Nullhomotopic ↔ + (⟦sphereLoop a⟧ : HomotopyGroup.Pi (n+1) X (a (spherePoint n))) = + (1 : HomotopyGroup.Pi (n+1) X (a (spherePoint n))) := by + simpa only [sphereMap_sphereLoop] using sphereMap_null_iff_class_one (sphereLoop a) + +theorem comp_null_iff_mapped_class_one {n : ℕ} (e : C(X,Y)) + (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) : + (e.comp a).Nullhomotopic ↔ + homotopyGroupMap (n:=n+1) e (a (spherePoint n)) ⟦sphereLoop a⟧ = + (1 : HomotopyGroup.Pi (n+1) Y (e (a (spherePoint n)))) := by + change (e.comp a).Nullhomotopic ↔ + (⟦genLoopMap e (sphereLoop a)⟧ : HomotopyGroup.Pi (n+1) Y (e (a (spherePoint n)))) = _ + simpa only [sphereMap_natural,sphereMap_sphereLoop] using + sphereMap_null_iff_class_one (genLoopMap e (sphereLoop a)) + +end NearbyLagrangian.CubicalSphere + +end + +noncomputable section +universe u v w +open scoped Classical Topology Topology.Homotopy + +namespace NearbyLagrangian.CubicalSphere +open Set ContinuousMap +open scoped OnePoint +variable {X : Type*} [TopologicalSpace X] {x y : X} + +def sphereMovingHomotopy {n : ℕ} {f : GenLoop (Fin (n+1)) X x} + {g : GenLoop (Fin (n+1)) X y} (H : f.1.Homotopy g.1) + (p : Path x y) (hp : ∀ s t, t ∈ Cube.boundary (Fin (n+1)) → H (s,t) = p s) : + (sphereMap f).Homotopy (sphereMap g) where + toFun q := ((compactificationSphere n).symm q.2).elim (p q.1) (fun t => H (q.1,t)) + continuous_toFun := by + let F : C(unitInterval × (Fin (n+1) → unitInterval),X) := ⟨H,H.continuous⟩ + have hF (s : unitInterval) (t : Fin (n+1) → unitInterval) + (ht : t ∉ interiorCube (Fin (n+1))) : F (s,t) = p s := by + apply hp + simpa only [interiorCube_eq,mem_compl_iff,not_not] using ht + exact (OpenCollapse.continuous_descend_param (isOpen_interiorCube _) (complement_nonempty _) + F p.toContinuousMap hF).comp (continuous_fst.prodMk + ((compactificationSphere n).symm.continuous.comp continuous_snd)) + map_zero_left := by + intro u + change ((compactificationSphere n).symm u).elim (p 0) (fun t => H (0,t)) = + ((compactificationSphere n).symm u).elim x (fun t => f t) + rw [p.source] + generalize (compactificationSphere n).symm u = z + induction z using OnePoint.rec with + | infty => rfl + | coe t => exact H.apply_zero t + map_one_left := by + intro u + change ((compactificationSphere n).symm u).elim (p 1) (fun t => H (1,t)) = + ((compactificationSphere n).symm u).elim y (fun t => g t) + rw [p.target] + generalize (compactificationSphere n).symm u = z + induction z using OnePoint.rec with + | infty => rfl + | coe t => exact H.apply_one t + +theorem exists_based_representative [PathConnectedSpace X] {n : ℕ} + (a : C(Metric.sphere (0 : EuclideanSpace ℝ (Fin (n+2))) 1,X)) (x : X) : + ∃ f : GenLoop (Fin (n+1)) X x, a.Homotopic (sphereMap f) := by + obtain ⟨p⟩ := PathConnectedSpace.joined (a (spherePoint n)) x + refine ⟨CubicalFreeNullity.rebase (sphereLoop a) p,?_⟩ + have h := sphereMovingHomotopy (CubicalFreeNullity.rebaseHomotopy (sphereLoop a) p) p + (fun s _t ht => CubicalFreeNullity.rebaseValue_boundary (sphereLoop a) p s ht) + simpa only [sphereMap_sphereLoop] using (show (sphereMap (sphereLoop a)).Homotopic + (sphereMap (CubicalFreeNullity.rebase (sphereLoop a) p)) from ⟨h⟩) + +end NearbyLagrangian.CubicalSphere + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/FiberCone.lean b/lean/OAI/Topology/Homotopy/FiberCone.lean index 1660b0a1f604e731abf5db1ae6f6d7751885f3f3..8f7e06fbabe3bb185406c8393a52ee2ee2d59f96 100644 --- a/lean/OAI/Topology/Homotopy/FiberCone.lean +++ b/lean/OAI/Topology/Homotopy/FiberCone.lean @@ -1,393 +1,393 @@ -import Mathlib - -namespace OAI - -/-! Fiberwise cones, contractions and left suspension homotopies. -/ - -noncomputable section -universe u v w -open Set ContinuousMap -open scoped Topology unitInterval - -namespace NearbyLagrangian.FiberCone - -variable {B A X Y : Type*} [TopologicalSpace B] [TopologicalSpace A] - [TopologicalSpace X] [TopologicalSpace Y] - -abbrev Raw (B A X : Type*) := X ⊕ ((unitInterval × A) ⊕ B) - -inductive Seam (f : C(A,X)) (q : C(A,B)) : Raw B A X → Raw B A X → Prop - | bottom (a : A) : Seam f q (.inr (.inl (0,a))) (.inl (f a)) - | top (a : A) : Seam f q (.inr (.inl (1,a))) (.inr (.inr (q a))) - -def Space (f : C(A,X)) (q : C(A,B)) := Quot (Seam f q) -instance (f : C(A,X)) (q : C(A,B)) : TopologicalSpace (Space f q) := - inferInstanceAs (TopologicalSpace (Quot (Seam f q))) - -def base (f : C(A,X)) (q : C(A,B)) : C(X,Space f q) := - ⟨fun x => Quot.mk _ (.inl x),continuous_quot_mk.comp continuous_inl⟩ -def ray (f : C(A,X)) (q : C(A,B)) : C(unitInterval × A,Space f q) := - ⟨fun z => Quot.mk _ (.inr (.inl z)), - continuous_quot_mk.comp (continuous_inr.comp continuous_inl)⟩ -def apex (f : C(A,X)) (q : C(A,B)) : C(B,Space f q) := - ⟨fun b => Quot.mk _ (.inr (.inr b)), - continuous_quot_mk.comp (continuous_inr.comp continuous_inr)⟩ - -@[simp] lemma ray_zero (f : C(A,X)) (q : C(A,B)) (a : A) : - ray f q (0,a) = base f q (f a) := Quot.sound (Seam.bottom a) -@[simp] lemma ray_one (f : C(A,X)) (q : C(A,B)) (a : A) : - ray f q (1,a) = apex f q (q a) := Quot.sound (Seam.top a) - -def lift (f : C(A,X)) (q : C(A,B)) (i : C(X,Y)) - (c : C(unitInterval × A,Y)) (v : C(B,Y)) - (h₀ : ∀ a, c (0,a) = i (f a)) (h₁ : ∀ a, c (1,a) = v (q a)) : - C(Space f q,Y) where - toFun := Quot.lift (Sum.elim i (Sum.elim c v)) (by - intro a b h - cases h with - | bottom a => exact h₀ a - | top a => exact h₁ a) - continuous_toFun := continuous_quot_lift _ - (i.continuous.sumElim (c.continuous.sumElim v.continuous)) - -@[simp] lemma lift_base (f : C(A,X)) (q : C(A,B)) (i : C(X,Y)) - (c : C(unitInterval × A,Y)) (v : C(B,Y)) - (h₀ : ∀ a, c (0,a) = i (f a)) (h₁ : ∀ a, c (1,a) = v (q a)) (x : X) : - lift f q i c v h₀ h₁ (base f q x) = i x := rfl -@[simp] lemma lift_ray (f : C(A,X)) (q : C(A,B)) (i : C(X,Y)) - (c : C(unitInterval × A,Y)) (v : C(B,Y)) - (h₀ : ∀ a, c (0,a) = i (f a)) (h₁ : ∀ a, c (1,a) = v (q a)) (z : unitInterval × A) : - lift f q i c v h₀ h₁ (ray f q z) = c z := rfl -@[simp] lemma lift_apex (f : C(A,X)) (q : C(A,B)) (i : C(X,Y)) - (c : C(unitInterval × A,Y)) (v : C(B,Y)) - (h₀ : ∀ a, c (0,a) = i (f a)) (h₁ : ∀ a, c (1,a) = v (q a)) (b : B) : - lift f q i c v h₀ h₁ (apex f q b) = v b := rfl - -@[elab_as_elim] theorem induction {f : C(A,X)} {q : C(A,B)} - {P : Space f q → Prop} (hbase : ∀ x, P (base f q x)) - (hray : ∀ ta, P (ray f q ta)) (hapex : ∀ b, P (apex f q b)) (z : Space f q) : P z := by - induction z using Quot.inductionOn with - | h z => - rcases z with x | (ta | b) - · exact hbase x - · exact hray ta - · exact hapex b - -def projection (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) : C(Space f q,B) := - lift f q p (q.comp ⟨Prod.snd,continuous_snd⟩) (ContinuousMap.id B) - (fun a => (hf a).symm) (fun _ => rfl) - -@[simp] lemma projection_base (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (x : X) : projection f p q hf (base f q x) = p x := rfl -@[simp] lemma projection_ray (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (ta : unitInterval × A) : - projection f p q hf (ray f q ta) = q ta.2 := rfl -@[simp] lemma projection_apex (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (b : B) : projection f p q hf (apex f q b) = b := rfl - -abbrev Susp (q : C(A,B)) := Space q q - -def suspProjection (q : C(A,B)) : C(Susp q,B) := - projection q (ContinuousMap.id B) q (fun _ => rfl) - -abbrev south (q : C(A,B)) : C(B,Susp q) := base q q -abbrev meridian (q : C(A,B)) : C(unitInterval × A,Susp q) := ray q q -abbrev north (q : C(A,B)) : C(B,Susp q) := apex q q - -def suspMap (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) : C(Susp q,Susp p) := - lift q q (south p) - ((meridian p).comp ⟨fun ta => (ta.1,f ta.2),continuous_fst.prodMk - (f.continuous.comp continuous_snd)⟩) (north p) - (fun a => by change meridian p (0,f a) = south p (q a); rw [ray_zero,hf]) - (fun a => by change meridian p (1,f a) = north p (q a); rw [ray_one,hf]) - -@[simp] lemma suspMap_south (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (b : B) : suspMap f p q hf (south q b) = south p b := rfl -@[simp] lemma suspMap_meridian (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (ta : unitInterval × A) : - suspMap f p q hf (meridian q ta) = meridian p (ta.1,f ta.2) := rfl -@[simp] lemma suspMap_north (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (b : B) : suspMap f p q hf (north q b) = north p b := rfl - -lemma suspMap_over (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (z : Susp q) : - suspProjection p (suspMap f p q hf z) = suspProjection q z := by - induction z using induction with - | hbase b => rfl - | hray ta => exact hf ta.2 - | hapex b => rfl - -def collapse (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) : C(Space f q,Susp q) := - lift f q ((south q).comp p) (meridian q) (north q) - (fun a => by change meridian q (0,a) = south q (p (f a)); rw [ray_zero,hf]) - (fun a => ray_one q q a) - -@[simp] lemma collapse_base (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (x : X) : collapse f p q hf (base f q x) = south q (p x) := rfl -@[simp] lemma collapse_ray (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (ta : unitInterval × A) : collapse f p q hf (ray f q ta) = meridian q ta := rfl -@[simp] lemma collapse_apex (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (b : B) : collapse f p q hf (apex f q b) = north q b := rfl - -lemma collapse_over (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) (z : Space f q) : - suspProjection q (collapse f p q hf z) = projection f p q hf z := by - induction z using induction with - | hbase x => rfl - | hray ta => rfl - | hapex b => rfl - -end NearbyLagrangian.FiberCone - -end - -noncomputable section -universe u v w -open Set ContinuousMap -open scoped Topology unitInterval - -namespace NearbyLagrangian.FiberCone -variable {B A X : Type*} [TopologicalSpace B] [TopologicalSpace A] [TopologicalSpace X] - -structure Contraction (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) - (hf : ∀ a, p (f a) = q a) where - hom : C(unitInterval × Space f q,Space f q) - at_zero : ∀ z, hom (0,z) = z - at_one : ∀ z, hom (1,z) = apex f q (projection f p q hf z) - staysOver : ∀ t z, projection f p q hf (hom (t,z)) = projection f p q hf z - fixed : ∀ t b, hom (t,apex f q b) = apex f q b - -namespace Contraction -variable {f : C(A,X)} {p : C(X,B)} {q : C(A,B)} {hf : ∀ a, p (f a) = q a} -variable (H : Contraction f p q hf) - -def inverseRay : C(unitInterval × X,Susp q) := - (collapse f p q hf).comp - (H.hom.comp ⟨fun tx => (tx.1,base f q tx.2), - continuous_fst.prodMk ((base f q).continuous.comp continuous_snd)⟩) - -@[simp] lemma inverseRay_zero (x : X) : H.inverseRay (0,x) = south q (p x) := by - change collapse f p q hf (H.hom (0,base f q x)) = _ - rw [H.at_zero,collapse_base] -@[simp] lemma inverseRay_one (x : X) : H.inverseRay (1,x) = north q (p x) := by - change collapse f p q hf (H.hom (1,base f q x)) = _ - rw [H.at_one,projection_base,collapse_apex] - -def inverse : C(Susp p,Susp q) := - lift p p (south q) H.inverseRay (north q) H.inverseRay_zero H.inverseRay_one - -@[simp] lemma inverse_south (b : B) : H.inverse (south p b) = south q b := rfl -@[simp] lemma inverse_meridian (tx : unitInterval × X) : - H.inverse (meridian p tx) = collapse f p q hf (H.hom (tx.1,base f q tx.2)) := rfl -@[simp] lemma inverse_north (b : B) : H.inverse (north p b) = north q b := rfl - -lemma inverse_over (z : Susp p) : suspProjection q (H.inverse z) = suspProjection p z := by - induction z using induction with - | hbase b => rfl - | hray tx => - rw [inverse_meridian,collapse_over,H.staysOver,projection_base] - rfl - | hapex b => rfl - -end Contraction - -def squareDen (s : unitInterval) : ℝ := max (s:ℝ) (1-(s:ℝ)) -lemma squareDen_pos (s : unitInterval) : 0 < squareDen s := by - have ha := le_max_left (s:ℝ) (1-(s:ℝ)) - have hb := le_max_right (s:ℝ) (1-(s:ℝ)) - dsimp [squareDen] - linarith -lemma continuous_squareDen : Continuous squareDen := - continuous_subtype_val.max (continuous_const.sub continuous_subtype_val) - -def horizontal : C(unitInterval × unitInterval,unitInterval) where - toFun st := ⟨(1-(st.1:ℝ))*(st.2:ℝ) / squareDen st.1,by - refine ⟨div_nonneg (mul_nonneg (sub_nonneg.mpr st.1.property.2) st.2.property.1) - (squareDen_pos st.1).le,?_⟩ - apply (div_le_one (squareDen_pos st.1)).mpr - have h := mul_le_mul_of_nonneg_left st.2.property.2 (sub_nonneg.mpr st.1.property.2) - have h' : (1 - (st.1:ℝ)) * (st.2:ℝ) ≤ 1 - (st.1:ℝ) := by - simpa only [mul_one] using h - exact h'.trans (le_max_right _ _)⟩ - continuous_toFun := by - apply Continuous.subtype_mk - exact (((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).mul - (continuous_subtype_val.comp continuous_snd)).div - (continuous_squareDen.comp continuous_fst) (fun _ => (squareDen_pos _).ne')) - -def vertical : C(unitInterval × unitInterval,unitInterval) where - toFun st := ⟨(st.1:ℝ)*(st.2:ℝ) / squareDen st.1,by - refine ⟨div_nonneg (mul_nonneg st.1.property.1 st.2.property.1) (squareDen_pos st.1).le,?_⟩ - apply (div_le_one (squareDen_pos st.1)).mpr - have h := mul_le_mul_of_nonneg_left st.2.property.2 st.1.property.1 - have h' : (st.1:ℝ) * (st.2:ℝ) ≤ (st.1:ℝ) := by - simpa only [mul_one] using h - exact h'.trans (le_max_left _ _)⟩ - continuous_toFun := by - apply Continuous.subtype_mk - exact (((continuous_subtype_val.comp continuous_fst).mul - (continuous_subtype_val.comp continuous_snd)).div - (continuous_squareDen.comp continuous_fst) (fun _ => (squareDen_pos _).ne')) - -@[simp] lemma horizontal_left (t : unitInterval) : horizontal (0,t) = t := by - apply Subtype.ext - simp [horizontal,squareDen] -@[simp] lemma horizontal_right (t : unitInterval) : horizontal (1,t) = 0 := by - apply Subtype.ext - simp [horizontal,squareDen] -@[simp] lemma vertical_left (t : unitInterval) : vertical (0,t) = 0 := by - apply Subtype.ext - simp [vertical,squareDen] -@[simp] lemma vertical_right (t : unitInterval) : vertical (1,t) = t := by - apply Subtype.ext - simp [vertical,squareDen] -@[simp] lemma horizontal_bottom (s : unitInterval) : horizontal (s,0) = 0 := by - apply Subtype.ext - simp [horizontal] -@[simp] lemma vertical_bottom (s : unitInterval) : vertical (s,0) = 0 := by - apply Subtype.ext - simp [vertical] - -lemma square_top (s : unitInterval) : horizontal (s,1) = 1 ∨ vertical (s,1) = 1 := by - rcases le_total (s:ℝ) (1-(s:ℝ)) with hs | hs - · left - apply Subtype.ext - have hn : 1-(s:ℝ) ≠ 0 := by - have hd := squareDen_pos s - rw [squareDen,max_eq_right hs] at hd - exact hd.ne' - simp [horizontal,squareDen,max_eq_right hs,hn] - · right - apply Subtype.ext - have hn : (s:ℝ) ≠ 0 := by - have hd := squareDen_pos s - rw [squareDen,max_eq_left hs] at hd - exact hd.ne' - simp [vertical,squareDen,max_eq_left hs,hn] - -end NearbyLagrangian.FiberCone - -end - -noncomputable section -universe u v w -open Set ContinuousMap -open scoped Topology unitInterval - -namespace NearbyLagrangian.FiberCone -variable {B A X Y : Type*} [TopologicalSpace B] [TopologicalSpace A] - [TopologicalSpace X] [TopologicalSpace Y] - -def cylinderLift (f : C(A,X)) (q : C(A,B)) (i : C(unitInterval × X,Y)) - (c : C(unitInterval × (unitInterval × A),Y)) (v : C(unitInterval × B,Y)) - (h₀ : ∀ s a, c (s,(0,a)) = i (s,f a)) - (h₁ : ∀ s a, c (s,(1,a)) = v (s,q a)) : C(unitInterval × Space f q,Y) := - (ContinuousMap.uncurry (lift f q - (ContinuousMap.curry (i.comp ContinuousMap.prodSwap)) - (ContinuousMap.curry (c.comp ContinuousMap.prodSwap)) - (ContinuousMap.curry (v.comp ContinuousMap.prodSwap)) - (fun a => by ext s; exact h₀ s a) - (fun a => by ext s; exact h₁ s a))).comp ContinuousMap.prodSwap - -@[simp] lemma cylinderLift_base (f : C(A,X)) (q : C(A,B)) (i : C(unitInterval × X,Y)) - (c : C(unitInterval × (unitInterval × A),Y)) (v : C(unitInterval × B,Y)) - (h₀ : ∀ s a, c (s,(0,a)) = i (s,f a)) - (h₁ : ∀ s a, c (s,(1,a)) = v (s,q a)) (s : unitInterval) (x : X) : - cylinderLift f q i c v h₀ h₁ (s,base f q x) = i (s,x) := rfl -@[simp] lemma cylinderLift_ray (f : C(A,X)) (q : C(A,B)) (i : C(unitInterval × X,Y)) - (c : C(unitInterval × (unitInterval × A),Y)) (v : C(unitInterval × B,Y)) - (h₀ : ∀ s a, c (s,(0,a)) = i (s,f a)) - (h₁ : ∀ s a, c (s,(1,a)) = v (s,q a)) (s : unitInterval) (ta : unitInterval × A) : - cylinderLift f q i c v h₀ h₁ (s,ray f q ta) = c (s,ta) := rfl -@[simp] lemma cylinderLift_apex (f : C(A,X)) (q : C(A,B)) (i : C(unitInterval × X,Y)) - (c : C(unitInterval × (unitInterval × A),Y)) (v : C(unitInterval × B,Y)) - (h₀ : ∀ s a, c (s,(0,a)) = i (s,f a)) - (h₁ : ∀ s a, c (s,(1,a)) = v (s,q a)) (s : unitInterval) (b : B) : - cylinderLift f q i c v h₀ h₁ (s,apex f q b) = v (s,b) := rfl - -namespace Contraction -variable {f : C(A,X)} {p : C(X,B)} {q : C(A,B)} {hf : ∀ a, p (f a) = q a} -variable (H : Contraction f p q hf) - -def leftRay : C(unitInterval × (unitInterval × A),Susp q) where - toFun z := collapse f p q hf (H.hom - (vertical (z.1,z.2.1),ray f q (horizontal (z.1,z.2.1),z.2.2))) - continuous_toFun := (collapse f p q hf).continuous.comp (H.hom.continuous.comp - ((vertical.continuous.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd))).prodMk - ((ray f q).continuous.comp - ((horizontal.continuous.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd))).prodMk - (continuous_snd.comp continuous_snd))))) - -lemma leftRay_bottom (s : unitInterval) (a : A) : H.leftRay (s,(0,a)) = south q (q a) := by - change collapse f p q hf (H.hom (vertical (s,0),ray f q (horizontal (s,0),a))) = _ - rw [horizontal_bottom,vertical_bottom,H.at_zero,ray_zero,collapse_base,hf] - -lemma leftRay_top (s : unitInterval) (a : A) : H.leftRay (s,(1,a)) = north q (q a) := by - change collapse f p q hf (H.hom (vertical (s,1),ray f q (horizontal (s,1),a))) = _ - rcases square_top s with hx | hy - · rw [hx,ray_one,H.fixed,collapse_apex] - · rw [hy,H.at_one,projection_ray,collapse_apex] - -def leftDeformation : C(unitInterval × Susp q,Susp q) := - cylinderLift q q ((south q).comp ⟨Prod.snd,continuous_snd⟩) H.leftRay - ((north q).comp ⟨Prod.snd,continuous_snd⟩) H.leftRay_bottom H.leftRay_top - -@[simp] lemma leftDeformation_south (s : unitInterval) (b : B) : - H.leftDeformation (s,south q b) = south q b := rfl -@[simp] lemma leftDeformation_meridian (s : unitInterval) (ta : unitInterval × A) : - H.leftDeformation (s,meridian q ta) = H.leftRay (s,ta) := rfl -@[simp] lemma leftDeformation_north (s : unitInterval) (b : B) : - H.leftDeformation (s,north q b) = north q b := rfl - -lemma leftDeformation_zero (z : Susp q) : H.leftDeformation (0,z) = z := by - induction z using induction with - | hbase b => rfl - | hray ta => - rw [leftDeformation_meridian] - change collapse f p q hf (H.hom - (vertical (0,ta.1),ray f q (horizontal (0,ta.1),ta.2))) = _ - rw [horizontal_left,vertical_left,H.at_zero,collapse_ray] - | hapex b => rfl - -lemma leftDeformation_one (z : Susp q) : - H.leftDeformation (1,z) = H.inverse (suspMap f p q hf z) := by - induction z using induction with - | hbase b => rw [leftDeformation_south,suspMap_south,inverse_south] - | hray ta => - rw [leftDeformation_meridian,suspMap_meridian,inverse_meridian] - change collapse f p q hf (H.hom - (vertical (1,ta.1),ray f q (horizontal (1,ta.1),ta.2))) = _ - rw [horizontal_right,vertical_right,ray_zero] - | hapex b => rw [leftDeformation_north,suspMap_north,inverse_north] - -lemma leftDeformation_over (s : unitInterval) (z : Susp q) : - suspProjection q (H.leftDeformation (s,z)) = suspProjection q z := by - induction z using induction with - | hbase b => rfl - | hray ta => - rw [leftDeformation_meridian] - change suspProjection q (collapse f p q hf (H.hom - (vertical (s,ta.1),ray f q (horizontal (s,ta.1),ta.2)))) = _ - rw [collapse_over,H.staysOver,projection_ray] - rfl - | hapex b => rfl - -def leftHomotopy : (H.inverse.comp (suspMap f p q hf)).Homotopy (ContinuousMap.id (Susp q)) := - ContinuousMap.Homotopy.symm - { toContinuousMap := H.leftDeformation - map_zero_left := H.leftDeformation_zero - map_one_left := H.leftDeformation_one } - -lemma leftHomotopy_over (s : unitInterval) (z : Susp q) : - suspProjection q (H.leftHomotopy (s,z)) = suspProjection q z := - H.leftDeformation_over (unitInterval.symm s) z - -end Contraction -end NearbyLagrangian.FiberCone - -end - -end OAI +import Mathlib + +namespace OAI + +/-! Fiberwise cones, contractions and left suspension homotopies. -/ + +noncomputable section +universe u v w +open Set ContinuousMap +open scoped Topology unitInterval + +namespace NearbyLagrangian.FiberCone + +variable {B A X Y : Type*} [TopologicalSpace B] [TopologicalSpace A] + [TopologicalSpace X] [TopologicalSpace Y] + +abbrev Raw (B A X : Type*) := X ⊕ ((unitInterval × A) ⊕ B) + +inductive Seam (f : C(A,X)) (q : C(A,B)) : Raw B A X → Raw B A X → Prop + | bottom (a : A) : Seam f q (.inr (.inl (0,a))) (.inl (f a)) + | top (a : A) : Seam f q (.inr (.inl (1,a))) (.inr (.inr (q a))) + +def Space (f : C(A,X)) (q : C(A,B)) := Quot (Seam f q) +instance (f : C(A,X)) (q : C(A,B)) : TopologicalSpace (Space f q) := + inferInstanceAs (TopologicalSpace (Quot (Seam f q))) + +def base (f : C(A,X)) (q : C(A,B)) : C(X,Space f q) := + ⟨fun x => Quot.mk _ (.inl x),continuous_quot_mk.comp continuous_inl⟩ +def ray (f : C(A,X)) (q : C(A,B)) : C(unitInterval × A,Space f q) := + ⟨fun z => Quot.mk _ (.inr (.inl z)), + continuous_quot_mk.comp (continuous_inr.comp continuous_inl)⟩ +def apex (f : C(A,X)) (q : C(A,B)) : C(B,Space f q) := + ⟨fun b => Quot.mk _ (.inr (.inr b)), + continuous_quot_mk.comp (continuous_inr.comp continuous_inr)⟩ + +@[simp] lemma ray_zero (f : C(A,X)) (q : C(A,B)) (a : A) : + ray f q (0,a) = base f q (f a) := Quot.sound (Seam.bottom a) +@[simp] lemma ray_one (f : C(A,X)) (q : C(A,B)) (a : A) : + ray f q (1,a) = apex f q (q a) := Quot.sound (Seam.top a) + +def lift (f : C(A,X)) (q : C(A,B)) (i : C(X,Y)) + (c : C(unitInterval × A,Y)) (v : C(B,Y)) + (h₀ : ∀ a, c (0,a) = i (f a)) (h₁ : ∀ a, c (1,a) = v (q a)) : + C(Space f q,Y) where + toFun := Quot.lift (Sum.elim i (Sum.elim c v)) (by + intro a b h + cases h with + | bottom a => exact h₀ a + | top a => exact h₁ a) + continuous_toFun := continuous_quot_lift _ + (i.continuous.sumElim (c.continuous.sumElim v.continuous)) + +@[simp] lemma lift_base (f : C(A,X)) (q : C(A,B)) (i : C(X,Y)) + (c : C(unitInterval × A,Y)) (v : C(B,Y)) + (h₀ : ∀ a, c (0,a) = i (f a)) (h₁ : ∀ a, c (1,a) = v (q a)) (x : X) : + lift f q i c v h₀ h₁ (base f q x) = i x := rfl +@[simp] lemma lift_ray (f : C(A,X)) (q : C(A,B)) (i : C(X,Y)) + (c : C(unitInterval × A,Y)) (v : C(B,Y)) + (h₀ : ∀ a, c (0,a) = i (f a)) (h₁ : ∀ a, c (1,a) = v (q a)) (z : unitInterval × A) : + lift f q i c v h₀ h₁ (ray f q z) = c z := rfl +@[simp] lemma lift_apex (f : C(A,X)) (q : C(A,B)) (i : C(X,Y)) + (c : C(unitInterval × A,Y)) (v : C(B,Y)) + (h₀ : ∀ a, c (0,a) = i (f a)) (h₁ : ∀ a, c (1,a) = v (q a)) (b : B) : + lift f q i c v h₀ h₁ (apex f q b) = v b := rfl + +@[elab_as_elim] theorem induction {f : C(A,X)} {q : C(A,B)} + {P : Space f q → Prop} (hbase : ∀ x, P (base f q x)) + (hray : ∀ ta, P (ray f q ta)) (hapex : ∀ b, P (apex f q b)) (z : Space f q) : P z := by + induction z using Quot.inductionOn with + | h z => + rcases z with x | (ta | b) + · exact hbase x + · exact hray ta + · exact hapex b + +def projection (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) : C(Space f q,B) := + lift f q p (q.comp ⟨Prod.snd,continuous_snd⟩) (ContinuousMap.id B) + (fun a => (hf a).symm) (fun _ => rfl) + +@[simp] lemma projection_base (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (x : X) : projection f p q hf (base f q x) = p x := rfl +@[simp] lemma projection_ray (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (ta : unitInterval × A) : + projection f p q hf (ray f q ta) = q ta.2 := rfl +@[simp] lemma projection_apex (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (b : B) : projection f p q hf (apex f q b) = b := rfl + +abbrev Susp (q : C(A,B)) := Space q q + +def suspProjection (q : C(A,B)) : C(Susp q,B) := + projection q (ContinuousMap.id B) q (fun _ => rfl) + +abbrev south (q : C(A,B)) : C(B,Susp q) := base q q +abbrev meridian (q : C(A,B)) : C(unitInterval × A,Susp q) := ray q q +abbrev north (q : C(A,B)) : C(B,Susp q) := apex q q + +def suspMap (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) : C(Susp q,Susp p) := + lift q q (south p) + ((meridian p).comp ⟨fun ta => (ta.1,f ta.2),continuous_fst.prodMk + (f.continuous.comp continuous_snd)⟩) (north p) + (fun a => by change meridian p (0,f a) = south p (q a); rw [ray_zero,hf]) + (fun a => by change meridian p (1,f a) = north p (q a); rw [ray_one,hf]) + +@[simp] lemma suspMap_south (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (b : B) : suspMap f p q hf (south q b) = south p b := rfl +@[simp] lemma suspMap_meridian (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (ta : unitInterval × A) : + suspMap f p q hf (meridian q ta) = meridian p (ta.1,f ta.2) := rfl +@[simp] lemma suspMap_north (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (b : B) : suspMap f p q hf (north q b) = north p b := rfl + +lemma suspMap_over (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (z : Susp q) : + suspProjection p (suspMap f p q hf z) = suspProjection q z := by + induction z using induction with + | hbase b => rfl + | hray ta => exact hf ta.2 + | hapex b => rfl + +def collapse (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) : C(Space f q,Susp q) := + lift f q ((south q).comp p) (meridian q) (north q) + (fun a => by change meridian q (0,a) = south q (p (f a)); rw [ray_zero,hf]) + (fun a => ray_one q q a) + +@[simp] lemma collapse_base (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (x : X) : collapse f p q hf (base f q x) = south q (p x) := rfl +@[simp] lemma collapse_ray (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (ta : unitInterval × A) : collapse f p q hf (ray f q ta) = meridian q ta := rfl +@[simp] lemma collapse_apex (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (b : B) : collapse f p q hf (apex f q b) = north q b := rfl + +lemma collapse_over (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) (z : Space f q) : + suspProjection q (collapse f p q hf z) = projection f p q hf z := by + induction z using induction with + | hbase x => rfl + | hray ta => rfl + | hapex b => rfl + +end NearbyLagrangian.FiberCone + +end + +noncomputable section +universe u v w +open Set ContinuousMap +open scoped Topology unitInterval + +namespace NearbyLagrangian.FiberCone +variable {B A X : Type*} [TopologicalSpace B] [TopologicalSpace A] [TopologicalSpace X] + +structure Contraction (f : C(A,X)) (p : C(X,B)) (q : C(A,B)) + (hf : ∀ a, p (f a) = q a) where + hom : C(unitInterval × Space f q,Space f q) + at_zero : ∀ z, hom (0,z) = z + at_one : ∀ z, hom (1,z) = apex f q (projection f p q hf z) + staysOver : ∀ t z, projection f p q hf (hom (t,z)) = projection f p q hf z + fixed : ∀ t b, hom (t,apex f q b) = apex f q b + +namespace Contraction +variable {f : C(A,X)} {p : C(X,B)} {q : C(A,B)} {hf : ∀ a, p (f a) = q a} +variable (H : Contraction f p q hf) + +def inverseRay : C(unitInterval × X,Susp q) := + (collapse f p q hf).comp + (H.hom.comp ⟨fun tx => (tx.1,base f q tx.2), + continuous_fst.prodMk ((base f q).continuous.comp continuous_snd)⟩) + +@[simp] lemma inverseRay_zero (x : X) : H.inverseRay (0,x) = south q (p x) := by + change collapse f p q hf (H.hom (0,base f q x)) = _ + rw [H.at_zero,collapse_base] +@[simp] lemma inverseRay_one (x : X) : H.inverseRay (1,x) = north q (p x) := by + change collapse f p q hf (H.hom (1,base f q x)) = _ + rw [H.at_one,projection_base,collapse_apex] + +def inverse : C(Susp p,Susp q) := + lift p p (south q) H.inverseRay (north q) H.inverseRay_zero H.inverseRay_one + +@[simp] lemma inverse_south (b : B) : H.inverse (south p b) = south q b := rfl +@[simp] lemma inverse_meridian (tx : unitInterval × X) : + H.inverse (meridian p tx) = collapse f p q hf (H.hom (tx.1,base f q tx.2)) := rfl +@[simp] lemma inverse_north (b : B) : H.inverse (north p b) = north q b := rfl + +lemma inverse_over (z : Susp p) : suspProjection q (H.inverse z) = suspProjection p z := by + induction z using induction with + | hbase b => rfl + | hray tx => + rw [inverse_meridian,collapse_over,H.staysOver,projection_base] + rfl + | hapex b => rfl + +end Contraction + +def squareDen (s : unitInterval) : ℝ := max (s:ℝ) (1-(s:ℝ)) +lemma squareDen_pos (s : unitInterval) : 0 < squareDen s := by + have ha := le_max_left (s:ℝ) (1-(s:ℝ)) + have hb := le_max_right (s:ℝ) (1-(s:ℝ)) + dsimp [squareDen] + linarith +lemma continuous_squareDen : Continuous squareDen := + continuous_subtype_val.max (continuous_const.sub continuous_subtype_val) + +def horizontal : C(unitInterval × unitInterval,unitInterval) where + toFun st := ⟨(1-(st.1:ℝ))*(st.2:ℝ) / squareDen st.1,by + refine ⟨div_nonneg (mul_nonneg (sub_nonneg.mpr st.1.property.2) st.2.property.1) + (squareDen_pos st.1).le,?_⟩ + apply (div_le_one (squareDen_pos st.1)).mpr + have h := mul_le_mul_of_nonneg_left st.2.property.2 (sub_nonneg.mpr st.1.property.2) + have h' : (1 - (st.1:ℝ)) * (st.2:ℝ) ≤ 1 - (st.1:ℝ) := by + simpa only [mul_one] using h + exact h'.trans (le_max_right _ _)⟩ + continuous_toFun := by + apply Continuous.subtype_mk + exact (((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).mul + (continuous_subtype_val.comp continuous_snd)).div + (continuous_squareDen.comp continuous_fst) (fun _ => (squareDen_pos _).ne')) + +def vertical : C(unitInterval × unitInterval,unitInterval) where + toFun st := ⟨(st.1:ℝ)*(st.2:ℝ) / squareDen st.1,by + refine ⟨div_nonneg (mul_nonneg st.1.property.1 st.2.property.1) (squareDen_pos st.1).le,?_⟩ + apply (div_le_one (squareDen_pos st.1)).mpr + have h := mul_le_mul_of_nonneg_left st.2.property.2 st.1.property.1 + have h' : (st.1:ℝ) * (st.2:ℝ) ≤ (st.1:ℝ) := by + simpa only [mul_one] using h + exact h'.trans (le_max_left _ _)⟩ + continuous_toFun := by + apply Continuous.subtype_mk + exact (((continuous_subtype_val.comp continuous_fst).mul + (continuous_subtype_val.comp continuous_snd)).div + (continuous_squareDen.comp continuous_fst) (fun _ => (squareDen_pos _).ne')) + +@[simp] lemma horizontal_left (t : unitInterval) : horizontal (0,t) = t := by + apply Subtype.ext + simp [horizontal,squareDen] +@[simp] lemma horizontal_right (t : unitInterval) : horizontal (1,t) = 0 := by + apply Subtype.ext + simp [horizontal,squareDen] +@[simp] lemma vertical_left (t : unitInterval) : vertical (0,t) = 0 := by + apply Subtype.ext + simp [vertical,squareDen] +@[simp] lemma vertical_right (t : unitInterval) : vertical (1,t) = t := by + apply Subtype.ext + simp [vertical,squareDen] +@[simp] lemma horizontal_bottom (s : unitInterval) : horizontal (s,0) = 0 := by + apply Subtype.ext + simp [horizontal] +@[simp] lemma vertical_bottom (s : unitInterval) : vertical (s,0) = 0 := by + apply Subtype.ext + simp [vertical] + +lemma square_top (s : unitInterval) : horizontal (s,1) = 1 ∨ vertical (s,1) = 1 := by + rcases le_total (s:ℝ) (1-(s:ℝ)) with hs | hs + · left + apply Subtype.ext + have hn : 1-(s:ℝ) ≠ 0 := by + have hd := squareDen_pos s + rw [squareDen,max_eq_right hs] at hd + exact hd.ne' + simp [horizontal,squareDen,max_eq_right hs,hn] + · right + apply Subtype.ext + have hn : (s:ℝ) ≠ 0 := by + have hd := squareDen_pos s + rw [squareDen,max_eq_left hs] at hd + exact hd.ne' + simp [vertical,squareDen,max_eq_left hs,hn] + +end NearbyLagrangian.FiberCone + +end + +noncomputable section +universe u v w +open Set ContinuousMap +open scoped Topology unitInterval + +namespace NearbyLagrangian.FiberCone +variable {B A X Y : Type*} [TopologicalSpace B] [TopologicalSpace A] + [TopologicalSpace X] [TopologicalSpace Y] + +def cylinderLift (f : C(A,X)) (q : C(A,B)) (i : C(unitInterval × X,Y)) + (c : C(unitInterval × (unitInterval × A),Y)) (v : C(unitInterval × B,Y)) + (h₀ : ∀ s a, c (s,(0,a)) = i (s,f a)) + (h₁ : ∀ s a, c (s,(1,a)) = v (s,q a)) : C(unitInterval × Space f q,Y) := + (ContinuousMap.uncurry (lift f q + (ContinuousMap.curry (i.comp ContinuousMap.prodSwap)) + (ContinuousMap.curry (c.comp ContinuousMap.prodSwap)) + (ContinuousMap.curry (v.comp ContinuousMap.prodSwap)) + (fun a => by ext s; exact h₀ s a) + (fun a => by ext s; exact h₁ s a))).comp ContinuousMap.prodSwap + +@[simp] lemma cylinderLift_base (f : C(A,X)) (q : C(A,B)) (i : C(unitInterval × X,Y)) + (c : C(unitInterval × (unitInterval × A),Y)) (v : C(unitInterval × B,Y)) + (h₀ : ∀ s a, c (s,(0,a)) = i (s,f a)) + (h₁ : ∀ s a, c (s,(1,a)) = v (s,q a)) (s : unitInterval) (x : X) : + cylinderLift f q i c v h₀ h₁ (s,base f q x) = i (s,x) := rfl +@[simp] lemma cylinderLift_ray (f : C(A,X)) (q : C(A,B)) (i : C(unitInterval × X,Y)) + (c : C(unitInterval × (unitInterval × A),Y)) (v : C(unitInterval × B,Y)) + (h₀ : ∀ s a, c (s,(0,a)) = i (s,f a)) + (h₁ : ∀ s a, c (s,(1,a)) = v (s,q a)) (s : unitInterval) (ta : unitInterval × A) : + cylinderLift f q i c v h₀ h₁ (s,ray f q ta) = c (s,ta) := rfl +@[simp] lemma cylinderLift_apex (f : C(A,X)) (q : C(A,B)) (i : C(unitInterval × X,Y)) + (c : C(unitInterval × (unitInterval × A),Y)) (v : C(unitInterval × B,Y)) + (h₀ : ∀ s a, c (s,(0,a)) = i (s,f a)) + (h₁ : ∀ s a, c (s,(1,a)) = v (s,q a)) (s : unitInterval) (b : B) : + cylinderLift f q i c v h₀ h₁ (s,apex f q b) = v (s,b) := rfl + +namespace Contraction +variable {f : C(A,X)} {p : C(X,B)} {q : C(A,B)} {hf : ∀ a, p (f a) = q a} +variable (H : Contraction f p q hf) + +def leftRay : C(unitInterval × (unitInterval × A),Susp q) where + toFun z := collapse f p q hf (H.hom + (vertical (z.1,z.2.1),ray f q (horizontal (z.1,z.2.1),z.2.2))) + continuous_toFun := (collapse f p q hf).continuous.comp (H.hom.continuous.comp + ((vertical.continuous.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd))).prodMk + ((ray f q).continuous.comp + ((horizontal.continuous.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd))).prodMk + (continuous_snd.comp continuous_snd))))) + +lemma leftRay_bottom (s : unitInterval) (a : A) : H.leftRay (s,(0,a)) = south q (q a) := by + change collapse f p q hf (H.hom (vertical (s,0),ray f q (horizontal (s,0),a))) = _ + rw [horizontal_bottom,vertical_bottom,H.at_zero,ray_zero,collapse_base,hf] + +lemma leftRay_top (s : unitInterval) (a : A) : H.leftRay (s,(1,a)) = north q (q a) := by + change collapse f p q hf (H.hom (vertical (s,1),ray f q (horizontal (s,1),a))) = _ + rcases square_top s with hx | hy + · rw [hx,ray_one,H.fixed,collapse_apex] + · rw [hy,H.at_one,projection_ray,collapse_apex] + +def leftDeformation : C(unitInterval × Susp q,Susp q) := + cylinderLift q q ((south q).comp ⟨Prod.snd,continuous_snd⟩) H.leftRay + ((north q).comp ⟨Prod.snd,continuous_snd⟩) H.leftRay_bottom H.leftRay_top + +@[simp] lemma leftDeformation_south (s : unitInterval) (b : B) : + H.leftDeformation (s,south q b) = south q b := rfl +@[simp] lemma leftDeformation_meridian (s : unitInterval) (ta : unitInterval × A) : + H.leftDeformation (s,meridian q ta) = H.leftRay (s,ta) := rfl +@[simp] lemma leftDeformation_north (s : unitInterval) (b : B) : + H.leftDeformation (s,north q b) = north q b := rfl + +lemma leftDeformation_zero (z : Susp q) : H.leftDeformation (0,z) = z := by + induction z using induction with + | hbase b => rfl + | hray ta => + rw [leftDeformation_meridian] + change collapse f p q hf (H.hom + (vertical (0,ta.1),ray f q (horizontal (0,ta.1),ta.2))) = _ + rw [horizontal_left,vertical_left,H.at_zero,collapse_ray] + | hapex b => rfl + +lemma leftDeformation_one (z : Susp q) : + H.leftDeformation (1,z) = H.inverse (suspMap f p q hf z) := by + induction z using induction with + | hbase b => rw [leftDeformation_south,suspMap_south,inverse_south] + | hray ta => + rw [leftDeformation_meridian,suspMap_meridian,inverse_meridian] + change collapse f p q hf (H.hom + (vertical (1,ta.1),ray f q (horizontal (1,ta.1),ta.2))) = _ + rw [horizontal_right,vertical_right,ray_zero] + | hapex b => rw [leftDeformation_north,suspMap_north,inverse_north] + +lemma leftDeformation_over (s : unitInterval) (z : Susp q) : + suspProjection q (H.leftDeformation (s,z)) = suspProjection q z := by + induction z using induction with + | hbase b => rfl + | hray ta => + rw [leftDeformation_meridian] + change suspProjection q (collapse f p q hf (H.hom + (vertical (s,ta.1),ray f q (horizontal (s,ta.1),ta.2)))) = _ + rw [collapse_over,H.staysOver,projection_ray] + rfl + | hapex b => rfl + +def leftHomotopy : (H.inverse.comp (suspMap f p q hf)).Homotopy (ContinuousMap.id (Susp q)) := + ContinuousMap.Homotopy.symm + { toContinuousMap := H.leftDeformation + map_zero_left := H.leftDeformation_zero + map_one_left := H.leftDeformation_one } + +lemma leftHomotopy_over (s : unitInterval) (z : Susp q) : + suspProjection q (H.leftHomotopy (s,z)) = suspProjection q z := + H.leftDeformation_over (unitInterval.symm s) z + +end Contraction +end NearbyLagrangian.FiberCone + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/FiberKernel.lean b/lean/OAI/Topology/Homotopy/FiberKernel.lean index e73123de7a34f9629ae10913496cfae8c1e59c01..e4158040b847f4a0dc789558778f01db8f120c0f 100644 --- a/lean/OAI/Topology/Homotopy/FiberKernel.lean +++ b/lean/OAI/Topology/Homotopy/FiberKernel.lean @@ -1,57 +1,57 @@ -import Mathlib -import OAI.Topology.Homotopy.HomotopyFiber -import OAI.Topology.Homotopy.LoopHomotopy - -namespace OAI - -/-! Nontrivial homotopy kernels from finite cardinality bounds. -/ - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.HomotopyFiber -open ContinuousMap -open scoped Topology Topology.Homotopy -open BasedHomotopy -variable {N X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] -variable [DecidableEq N] [Nonempty N] - -theorem nontrivial_kernel_of_large_fiber (e : C(X,Y)) (x : X) - {K : Type*} [Fintype K] - [Fintype (HomotopyGroup N (Path (e x) (e x)) (Path.refl (e x)))] - (ι : K ↪ HomotopyGroup N (Fiber e (e x)) (base e x)) - (hcard : Fintype.card (HomotopyGroup N (Path (e x) (e x)) (Path.refl (e x))) < Fintype.card K) : - ∃ a : HomotopyGroup N X x, a ≠ 1 ∧ groupMap e rfl a = 1 := by - classical - suffices h : ∃ k, groupMap (projection e (e x)) rfl (ι k) ≠ 1 by - obtain ⟨k,hk⟩ := h - exact ⟨groupMap (projection e (e x)) rfl (ι k),hk, - (kernel_eq_projection_range e x _).mpr ⟨ι k,rfl⟩⟩ - by_contra! h - choose q hq using fun k => (projection_kernel_eq_loop_range e x (ι k)).mp (h k) - have hi : Function.Injective q := by - intro k l hkl - apply ι.injective - have hk := hq k - rw [hkl] at hk - exact hk.symm.trans (hq l) - exact (Nat.not_le_of_lt hcard) (Fintype.card_le_of_injective q hi) - -theorem nontrivial_pi9_kernel_of_source_sizes (e : C(X,Y)) (x : X) - (sphereCalculation : π_ 10 Y (e x) ≃ (Fin 3 → ZMod 2)) - (whiteheadClasses : (ZMod 8 × (ZMod 2 × ZMod 2)) ↪ - π_ 9 (Fiber e (e x)) (base e x)) : - ∃ a : π_ 9 X x, a ≠ 1 ∧ groupMap e rfl a = 1 := by - let calculation := (pi9LoopEquivPi10 (e x)).trans sphereCalculation - let : Fintype (π_ 9 (Path (e x) (e x)) (Path.refl (e x))) := - Fintype.ofEquiv (Fin 3 → ZMod 2) calculation.symm - apply nontrivial_kernel_of_large_fiber e x whiteheadClasses - rw [Fintype.card_congr calculation] - norm_num - -end NearbyLagrangian.HomotopyFiber - -end - -end OAI +import Mathlib +import OAI.Topology.Homotopy.HomotopyFiber +import OAI.Topology.Homotopy.LoopHomotopy + +namespace OAI + +/-! Nontrivial homotopy kernels from finite cardinality bounds. -/ + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.HomotopyFiber +open ContinuousMap +open scoped Topology Topology.Homotopy +open BasedHomotopy +variable {N X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] +variable [DecidableEq N] [Nonempty N] + +theorem nontrivial_kernel_of_large_fiber (e : C(X,Y)) (x : X) + {K : Type*} [Fintype K] + [Fintype (HomotopyGroup N (Path (e x) (e x)) (Path.refl (e x)))] + (ι : K ↪ HomotopyGroup N (Fiber e (e x)) (base e x)) + (hcard : Fintype.card (HomotopyGroup N (Path (e x) (e x)) (Path.refl (e x))) < Fintype.card K) : + ∃ a : HomotopyGroup N X x, a ≠ 1 ∧ groupMap e rfl a = 1 := by + classical + suffices h : ∃ k, groupMap (projection e (e x)) rfl (ι k) ≠ 1 by + obtain ⟨k,hk⟩ := h + exact ⟨groupMap (projection e (e x)) rfl (ι k),hk, + (kernel_eq_projection_range e x _).mpr ⟨ι k,rfl⟩⟩ + by_contra! h + choose q hq using fun k => (projection_kernel_eq_loop_range e x (ι k)).mp (h k) + have hi : Function.Injective q := by + intro k l hkl + apply ι.injective + have hk := hq k + rw [hkl] at hk + exact hk.symm.trans (hq l) + exact (Nat.not_le_of_lt hcard) (Fintype.card_le_of_injective q hi) + +theorem nontrivial_pi9_kernel_of_source_sizes (e : C(X,Y)) (x : X) + (sphereCalculation : π_ 10 Y (e x) ≃ (Fin 3 → ZMod 2)) + (whiteheadClasses : (ZMod 8 × (ZMod 2 × ZMod 2)) ↪ + π_ 9 (Fiber e (e x)) (base e x)) : + ∃ a : π_ 9 X x, a ≠ 1 ∧ groupMap e rfl a = 1 := by + let calculation := (pi9LoopEquivPi10 (e x)).trans sphereCalculation + let : Fintype (π_ 9 (Path (e x) (e x)) (Path.refl (e x))) := + Fintype.ofEquiv (Fin 3 → ZMod 2) calculation.symm + apply nontrivial_kernel_of_large_fiber e x whiteheadClasses + rw [Fintype.card_congr calculation] + norm_num + +end NearbyLagrangian.HomotopyFiber + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/HomotopyFiber.lean b/lean/OAI/Topology/Homotopy/HomotopyFiber.lean index 50a0abb1361319986272216436627a785f3d2d22..653da3d3c651be21235402b00a9741633bbfa500 100644 --- a/lean/OAI/Topology/Homotopy/HomotopyFiber.lean +++ b/lean/OAI/Topology/Homotopy/HomotopyFiber.lean @@ -1,319 +1,319 @@ -import Mathlib -import OAI.Topology.Homotopy.BasedMaps - -namespace OAI - -/-! The path-space homotopy fiber and exactness at its projection. -/ - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.HomotopyFiber -open ContinuousMap -open scoped Topology Topology.Homotopy -open BasedHomotopy -variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] - -def Fiber (e : C(X,Y)) (y : Y) := - {z : X × C(unitInterval,Y) // z.2 0 = e z.1 ∧ z.2 1 = y} - -instance (e : C(X,Y)) (y : Y) : TopologicalSpace (Fiber e y) := inferInstanceAs - (TopologicalSpace {z : X × C(unitInterval,Y) // z.2 0 = e z.1 ∧ z.2 1 = y}) - -def base (e : C(X,Y)) (x : X) : Fiber e (e x) := - ⟨(x,ContinuousMap.const _ (e x)),rfl,rfl⟩ - -def projection (e : C(X,Y)) (y : Y) : C(Fiber e y,X) := - ⟨fun z => z.1.1,continuous_fst.comp continuous_subtype_val⟩ - -@[simp] theorem projection_base (e : C(X,Y)) (x : X) : - projection e (e x) (base e x) = x := rfl - -variable {N : Type*} - -def projectionNullhomotopy (e : C(X,Y)) (x : X) - (f : GenLoop N (Fiber e (e x)) (base e x)) : - (loopMap e rfl (loopMap (projection e (e x)) rfl f)).1.HomotopyRel (ContinuousMap.const _ (e x)) (Cube.boundary N) where - toFun z := (f z.2).1.2 z.1 - continuous_toFun := by - exact ((continuous_snd.comp (continuous_subtype_val.comp (f.1.continuous.comp continuous_snd))).eval continuous_fst) - map_zero_left t := (f t).2.1 - map_one_left t := (f t).2.2 - prop' s t ht := by - change (f t).1.2 s = e (f t).1.1 - rw [GenLoop.boundary f t ht] - rfl - -def liftNullhomotopy (e : C(X,Y)) (x : X) (f : GenLoop N X x) - (H : (loopMap e rfl f).1.HomotopyRel (ContinuousMap.const _ (e x)) (Cube.boundary N)) : - GenLoop N (Fiber e (e x)) (base e x) := - ⟨⟨fun t => ⟨(f t,(H.toContinuousMap.comp ContinuousMap.prodSwap).curry t), - H.map_zero_left t,H.map_one_left t⟩,by - apply Continuous.subtype_mk - exact f.1.continuous.prodMk (H.toContinuousMap.comp ContinuousMap.prodSwap).curry.continuous⟩, - by - intro t ht - apply Subtype.ext - apply Prod.ext (GenLoop.boundary f t ht) - ext s - exact (H.prop s t ht).trans (congrArg e (GenLoop.boundary f t ht))⟩ - -@[simp] theorem projection_liftNullhomotopy (e : C(X,Y)) (x : X) (f : GenLoop N X x) - (H : (loopMap e rfl f).1.HomotopyRel (ContinuousMap.const _ (e x)) (Cube.boundary N)) : - loopMap (projection e (e x)) rfl (liftNullhomotopy e x f H) = f := by ext; rfl - -theorem kernel_eq_projection_range [DecidableEq N] [Nonempty N] - (e : C(X,Y)) (x : X) (a : HomotopyGroup N X x) : - groupMap e rfl a = 1 ↔ - ∃ b : HomotopyGroup N (Fiber e (e x)) (base e x), - groupMap (projection e (e x)) rfl b = a := by - induction a using Quotient.inductionOn with - | h f => - constructor - · intro h - change (⟦loopMap e rfl f⟧ : HomotopyGroup N Y (e x)) = ⟦GenLoop.const⟧ at h - obtain ⟨H⟩ := Quotient.exact h - exact ⟨⟦liftNullhomotopy e x f H⟧,congrArg Quotient.mk'' (projection_liftNullhomotopy e x f H)⟩ - · rintro ⟨b,hb⟩ - rw [← hb] - induction b using Quotient.inductionOn with - | h g => - change (⟦loopMap e rfl (loopMap (projection e (e x)) rfl g)⟧ : HomotopyGroup N Y (e x)) = ⟦GenLoop.const⟧ - exact Quotient.sound ⟨projectionNullhomotopy e x g⟩ - -end NearbyLagrangian.HomotopyFiber - -end - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.HomotopyFiber -open ContinuousMap Set -open scoped Topology Topology.Homotopy -open BasedHomotopy - -def frontTime (s r : unitInterval) : unitInterval := projIcc 0 1 zero_le_one ((s:ℝ)-2*r) -def backTime (s r : unitInterval) : unitInterval := projIcc 0 1 zero_le_one ((2*(r:ℝ)-s)/(2-s)) - -lemma continuous_frontTime : Continuous (fun z : unitInterval × unitInterval => frontTime z.1 z.2) := by - unfold frontTime - fun_prop - -lemma continuous_backTime : Continuous (fun z : unitInterval × unitInterval => backTime z.1 z.2) := by - unfold backTime - apply continuous_projIcc.comp - apply Continuous.div - · fun_prop - · fun_prop - · intro z - have := z.1.property.2 - linarith - -@[simp] lemma frontTime_zero_right (s : unitInterval) : frontTime s 0 = s := by - change projIcc 0 1 zero_le_one ((s:ℝ)-2*0) = s - simp only [mul_zero,sub_zero] - exact projIcc_val _ s - -@[simp] lemma backTime_one_right (s : unitInterval) : backTime s 1 = 1 := by - unfold backTime - have hs : (2:ℝ)-s ≠ 0 := by linarith [s.property.2] - simp [hs] - -@[simp] lemma backTime_zero_left (r : unitInterval) : backTime 0 r = r := by - change projIcc 0 1 zero_le_one ((2*(r:ℝ)-0)/(2-0)) = r - have he : (2*(r:ℝ)-(0:ℝ))/(2-(0:ℝ)) = r := by ring - rw [he] - exact projIcc_val _ r - -lemma frontTime_seam {s r : unitInterval} (h : 2*(r:ℝ)=s) : frontTime s r = 0 := by - unfold frontTime - rw [h,sub_self] - exact projIcc_left _ - -lemma backTime_seam {s r : unitInterval} (h : 2*(r:ℝ)=s) : backTime s r = 0 := by - unfold backTime - rw [h,sub_self,zero_div] - exact projIcc_left _ - -variable {A X Y : Type*} [TopologicalSpace A] [TopologicalSpace X] [TopologicalSpace Y] -variable (e : C(X,Y)) (x : X) (f : C(A,Fiber e (e x))) -variable (H : ((projection e (e x)).comp f).Homotopy (ContinuousMap.const A x)) - -def deformValue (z : (unitInterval × A) × unitInterval) : Y := - if 2*(z.2:ℝ) ≤ z.1.1 then e (H (frontTime z.1.1 z.2,z.1.2)) - else (f z.1.2).1.2 (backTime z.1.1 z.2) - -lemma continuous_deformValue : Continuous (deformValue e x f H) := by - unfold deformValue - apply continuous_if_le - · fun_prop - · fun_prop - · apply Continuous.continuousOn - apply e.continuous.comp - apply H.continuous.comp - exact (continuous_frontTime.comp ((continuous_fst.comp continuous_fst).prodMk continuous_snd)).prodMk - (continuous_snd.comp continuous_fst) - · apply Continuous.continuousOn - exact (continuous_snd.comp (continuous_subtype_val.comp - (f.continuous.comp (continuous_snd.comp continuous_fst)))).eval - (continuous_backTime.comp ((continuous_fst.comp continuous_fst).prodMk continuous_snd)) - · intro z hz - rw [frontTime_seam hz,backTime_seam hz,H.apply_zero] - exact (f z.1.2).2.1.symm - -@[simp] lemma deformValue_start (s : unitInterval) (a : A) : - deformValue e x f H ((s,a),0) = e (H (s,a)) := by - change (if 2*(0:ℝ) ≤ s then e (H (frontTime s 0,a)) else (f a).1.2 (backTime s 0)) = e (H (s,a)) - simp only [mul_zero,ite_eq_left s.property.1,frontTime_zero_right] - -@[simp] lemma deformValue_end (s : unitInterval) (a : A) : - deformValue e x f H ((s,a),1) = e x := by - change (if 2*(1:ℝ) ≤ s then e (H (frontTime s 1,a)) else (f a).1.2 (backTime s 1)) = e x - have hs : ¬ 2*(1:ℝ) ≤ (s:ℝ) := by linarith [s.property.2] - rw [ite_eq_right hs,backTime_one_right] - exact (f a).2.2 - -@[simp] lemma deformValue_zero (a : A) (r : unitInterval) : - deformValue e x f H ((0,a),r) = (f a).1.2 r := by - unfold deformValue - split_ifs with hr - · have he : r = 0 := Subtype.ext (by dsimp at hr ⊢; linarith [r.property.1]) - rw [he,frontTime_zero_right,H.apply_zero] - exact (f a).2.1.symm - · rw [backTime_zero_left] - -def deformPath : C(unitInterval × A,C(unitInterval,Y)) := - (⟨deformValue e x f H,continuous_deformValue e x f H⟩ : C((unitInterval × A) × unitInterval,Y)).curry - -def deformFiber : C(unitInterval × A,Fiber e (e x)) where - toFun z := ⟨(H z,deformPath e x f H z),deformValue_start e x f H z.1 z.2,deformValue_end e x f H z.1 z.2⟩ - continuous_toFun := (H.continuous.prodMk (deformPath e x f H).continuous).subtype_mk _ - -@[simp] lemma deformFiber_zero (a : A) : deformFiber e x f H (0,a) = f a := by - apply Subtype.ext - apply Prod.ext - · exact H.apply_zero a - · ext r - exact deformValue_zero e x f H a r - -def loopInclusion : C(Path (e x) (e x),Fiber e (e x)) where - toFun p := ⟨(x,p.toContinuousMap),p.source,p.target⟩ - continuous_toFun := (continuous_const.prodMk continuous_induced_dom).subtype_mk _ - -@[simp] lemma loopInclusion_base : loopInclusion e x (Path.refl (e x)) = base e x := rfl - -def loopRepresentative : C(A,Path (e x) (e x)) where - toFun a := { - toContinuousMap := deformPath e x f H (1,a) - source' := by - change deformValue e x f H ((1,a),0) = e x - rw [deformValue_start,H.apply_one,ContinuousMap.const_apply] - target' := deformValue_end e x f H 1 a } - continuous_toFun := by - apply Path.continuous_uncurry_iff.mp - exact (continuous_deformValue e x f H).comp ((continuous_const.prodMk continuous_fst).prodMk continuous_snd) - -def deformHomotopy : f.Homotopy ((loopInclusion e x).comp (loopRepresentative e x f H)) where - toContinuousMap := deformFiber e x f H - map_zero_left := deformFiber_zero e x f H - map_one_left a := by - apply Subtype.ext - apply Prod.ext - · exact H.apply_one a - · rfl - -lemma deformValue_fixed (a : A) (ha : f a = base e x) (hH : ∀ s, H (s,a) = x) - (s r : unitInterval) : deformValue e x f H ((s,a),r) = e x := by - unfold deformValue - split_ifs - · rw [hH] - · rw [ha] - rfl - -lemma deformFiber_fixed (a : A) (ha : f a = base e x) (hH : ∀ s, H (s,a) = x) - (s : unitInterval) : deformFiber e x f H (s,a) = base e x := by - apply Subtype.ext - apply Prod.ext (hH s) - ext r - exact deformValue_fixed e x f H a ha hH s r - -lemma loopRepresentative_fixed (a : A) (ha : f a = base e x) (hH : ∀ s, H (s,a) = x) : - loopRepresentative e x f H a = Path.refl (e x) := by - apply Path.ext - funext r - exact deformValue_fixed e x f H a ha hH 1 r - -end NearbyLagrangian.HomotopyFiber - -end - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.HomotopyFiber -open ContinuousMap -open scoped Topology Topology.Homotopy -open BasedHomotopy -variable {N X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] -variable (e : C(X,Y)) (x : X) - -def boundaryRepresentative (f : GenLoop N (Fiber e (e x)) (base e x)) - (H : (loopMap (projection e (e x)) rfl f).1.HomotopyRel - (ContinuousMap.const _ x) (Cube.boundary N)) : - GenLoop N (Path (e x) (e x)) (Path.refl (e x)) := - ⟨loopRepresentative e x f.1 H.toHomotopy,by - intro t ht - apply loopRepresentative_fixed - · exact GenLoop.boundary f t ht - · intro s - exact (H.prop s t ht).trans (congrArg (projection e (e x)) (GenLoop.boundary f t ht))⟩ - -def boundaryRepresentativeHomotopy (f : GenLoop N (Fiber e (e x)) (base e x)) - (H : (loopMap (projection e (e x)) rfl f).1.HomotopyRel - (ContinuousMap.const _ x) (Cube.boundary N)) : - f.1.HomotopyRel (loopMap (loopInclusion e x) rfl (boundaryRepresentative e x f H)).1 - (Cube.boundary N) where - toHomotopy := deformHomotopy e x f.1 H.toHomotopy - prop' s t ht := by - change deformFiber e x f.1 H.toHomotopy (s,t) = f t - rw [GenLoop.boundary f t ht] - apply deformFiber_fixed - · exact GenLoop.boundary f t ht - · intro r - exact (H.prop r t ht).trans (congrArg (projection e (e x)) (GenLoop.boundary f t ht)) - -@[simp] theorem projection_loopInclusion (g : GenLoop N (Path (e x) (e x)) (Path.refl (e x))) : - loopMap (projection e (e x)) rfl (loopMap (loopInclusion e x) rfl g) = GenLoop.const := by - ext t - rfl - -theorem projection_kernel_eq_loop_range [DecidableEq N] [Nonempty N] - (a : HomotopyGroup N (Fiber e (e x)) (base e x)) : - groupMap (projection e (e x)) rfl a = 1 ↔ - ∃ b : HomotopyGroup N (Path (e x) (e x)) (Path.refl (e x)), - groupMap (loopInclusion e x) rfl b = a := by - induction a using Quotient.inductionOn with - | h f => - constructor - · intro h - change (⟦loopMap (projection e (e x)) rfl f⟧ : HomotopyGroup N X x) = ⟦GenLoop.const⟧ at h - obtain ⟨H⟩ := Quotient.exact h - refine ⟨⟦boundaryRepresentative e x f H⟧, ?_⟩ - exact Quotient.sound ⟨(boundaryRepresentativeHomotopy e x f H).symm⟩ - · rintro ⟨b,hb⟩ - rw [← hb] - induction b using Quotient.inductionOn with - | h g => - change (⟦loopMap (projection e (e x)) rfl (loopMap (loopInclusion e x) rfl g)⟧ : - HomotopyGroup N X x) = ⟦GenLoop.const⟧ - exact congrArg Quotient.mk'' (projection_loopInclusion e x g) - -end NearbyLagrangian.HomotopyFiber - -end - -end OAI +import Mathlib +import OAI.Topology.Homotopy.BasedMaps + +namespace OAI + +/-! The path-space homotopy fiber and exactness at its projection. -/ + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.HomotopyFiber +open ContinuousMap +open scoped Topology Topology.Homotopy +open BasedHomotopy +variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + +def Fiber (e : C(X,Y)) (y : Y) := + {z : X × C(unitInterval,Y) // z.2 0 = e z.1 ∧ z.2 1 = y} + +instance (e : C(X,Y)) (y : Y) : TopologicalSpace (Fiber e y) := inferInstanceAs + (TopologicalSpace {z : X × C(unitInterval,Y) // z.2 0 = e z.1 ∧ z.2 1 = y}) + +def base (e : C(X,Y)) (x : X) : Fiber e (e x) := + ⟨(x,ContinuousMap.const _ (e x)),rfl,rfl⟩ + +def projection (e : C(X,Y)) (y : Y) : C(Fiber e y,X) := + ⟨fun z => z.1.1,continuous_fst.comp continuous_subtype_val⟩ + +@[simp] theorem projection_base (e : C(X,Y)) (x : X) : + projection e (e x) (base e x) = x := rfl + +variable {N : Type*} + +def projectionNullhomotopy (e : C(X,Y)) (x : X) + (f : GenLoop N (Fiber e (e x)) (base e x)) : + (loopMap e rfl (loopMap (projection e (e x)) rfl f)).1.HomotopyRel (ContinuousMap.const _ (e x)) (Cube.boundary N) where + toFun z := (f z.2).1.2 z.1 + continuous_toFun := by + exact ((continuous_snd.comp (continuous_subtype_val.comp (f.1.continuous.comp continuous_snd))).eval continuous_fst) + map_zero_left t := (f t).2.1 + map_one_left t := (f t).2.2 + prop' s t ht := by + change (f t).1.2 s = e (f t).1.1 + rw [GenLoop.boundary f t ht] + rfl + +def liftNullhomotopy (e : C(X,Y)) (x : X) (f : GenLoop N X x) + (H : (loopMap e rfl f).1.HomotopyRel (ContinuousMap.const _ (e x)) (Cube.boundary N)) : + GenLoop N (Fiber e (e x)) (base e x) := + ⟨⟨fun t => ⟨(f t,(H.toContinuousMap.comp ContinuousMap.prodSwap).curry t), + H.map_zero_left t,H.map_one_left t⟩,by + apply Continuous.subtype_mk + exact f.1.continuous.prodMk (H.toContinuousMap.comp ContinuousMap.prodSwap).curry.continuous⟩, + by + intro t ht + apply Subtype.ext + apply Prod.ext (GenLoop.boundary f t ht) + ext s + exact (H.prop s t ht).trans (congrArg e (GenLoop.boundary f t ht))⟩ + +@[simp] theorem projection_liftNullhomotopy (e : C(X,Y)) (x : X) (f : GenLoop N X x) + (H : (loopMap e rfl f).1.HomotopyRel (ContinuousMap.const _ (e x)) (Cube.boundary N)) : + loopMap (projection e (e x)) rfl (liftNullhomotopy e x f H) = f := by ext; rfl + +theorem kernel_eq_projection_range [DecidableEq N] [Nonempty N] + (e : C(X,Y)) (x : X) (a : HomotopyGroup N X x) : + groupMap e rfl a = 1 ↔ + ∃ b : HomotopyGroup N (Fiber e (e x)) (base e x), + groupMap (projection e (e x)) rfl b = a := by + induction a using Quotient.inductionOn with + | h f => + constructor + · intro h + change (⟦loopMap e rfl f⟧ : HomotopyGroup N Y (e x)) = ⟦GenLoop.const⟧ at h + obtain ⟨H⟩ := Quotient.exact h + exact ⟨⟦liftNullhomotopy e x f H⟧,congrArg Quotient.mk'' (projection_liftNullhomotopy e x f H)⟩ + · rintro ⟨b,hb⟩ + rw [← hb] + induction b using Quotient.inductionOn with + | h g => + change (⟦loopMap e rfl (loopMap (projection e (e x)) rfl g)⟧ : HomotopyGroup N Y (e x)) = ⟦GenLoop.const⟧ + exact Quotient.sound ⟨projectionNullhomotopy e x g⟩ + +end NearbyLagrangian.HomotopyFiber + +end + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.HomotopyFiber +open ContinuousMap Set +open scoped Topology Topology.Homotopy +open BasedHomotopy + +def frontTime (s r : unitInterval) : unitInterval := projIcc 0 1 zero_le_one ((s:ℝ)-2*r) +def backTime (s r : unitInterval) : unitInterval := projIcc 0 1 zero_le_one ((2*(r:ℝ)-s)/(2-s)) + +lemma continuous_frontTime : Continuous (fun z : unitInterval × unitInterval => frontTime z.1 z.2) := by + unfold frontTime + fun_prop + +lemma continuous_backTime : Continuous (fun z : unitInterval × unitInterval => backTime z.1 z.2) := by + unfold backTime + apply continuous_projIcc.comp + apply Continuous.div + · fun_prop + · fun_prop + · intro z + have := z.1.property.2 + linarith + +@[simp] lemma frontTime_zero_right (s : unitInterval) : frontTime s 0 = s := by + change projIcc 0 1 zero_le_one ((s:ℝ)-2*0) = s + simp only [mul_zero,sub_zero] + exact projIcc_val _ s + +@[simp] lemma backTime_one_right (s : unitInterval) : backTime s 1 = 1 := by + unfold backTime + have hs : (2:ℝ)-s ≠ 0 := by linarith [s.property.2] + simp [hs] + +@[simp] lemma backTime_zero_left (r : unitInterval) : backTime 0 r = r := by + change projIcc 0 1 zero_le_one ((2*(r:ℝ)-0)/(2-0)) = r + have he : (2*(r:ℝ)-(0:ℝ))/(2-(0:ℝ)) = r := by ring + rw [he] + exact projIcc_val _ r + +lemma frontTime_seam {s r : unitInterval} (h : 2*(r:ℝ)=s) : frontTime s r = 0 := by + unfold frontTime + rw [h,sub_self] + exact projIcc_left _ + +lemma backTime_seam {s r : unitInterval} (h : 2*(r:ℝ)=s) : backTime s r = 0 := by + unfold backTime + rw [h,sub_self,zero_div] + exact projIcc_left _ + +variable {A X Y : Type*} [TopologicalSpace A] [TopologicalSpace X] [TopologicalSpace Y] +variable (e : C(X,Y)) (x : X) (f : C(A,Fiber e (e x))) +variable (H : ((projection e (e x)).comp f).Homotopy (ContinuousMap.const A x)) + +def deformValue (z : (unitInterval × A) × unitInterval) : Y := + if 2*(z.2:ℝ) ≤ z.1.1 then e (H (frontTime z.1.1 z.2,z.1.2)) + else (f z.1.2).1.2 (backTime z.1.1 z.2) + +lemma continuous_deformValue : Continuous (deformValue e x f H) := by + unfold deformValue + apply continuous_if_le + · fun_prop + · fun_prop + · apply Continuous.continuousOn + apply e.continuous.comp + apply H.continuous.comp + exact (continuous_frontTime.comp ((continuous_fst.comp continuous_fst).prodMk continuous_snd)).prodMk + (continuous_snd.comp continuous_fst) + · apply Continuous.continuousOn + exact (continuous_snd.comp (continuous_subtype_val.comp + (f.continuous.comp (continuous_snd.comp continuous_fst)))).eval + (continuous_backTime.comp ((continuous_fst.comp continuous_fst).prodMk continuous_snd)) + · intro z hz + rw [frontTime_seam hz,backTime_seam hz,H.apply_zero] + exact (f z.1.2).2.1.symm + +@[simp] lemma deformValue_start (s : unitInterval) (a : A) : + deformValue e x f H ((s,a),0) = e (H (s,a)) := by + change (if 2*(0:ℝ) ≤ s then e (H (frontTime s 0,a)) else (f a).1.2 (backTime s 0)) = e (H (s,a)) + simp only [mul_zero,ite_eq_left s.property.1,frontTime_zero_right] + +@[simp] lemma deformValue_end (s : unitInterval) (a : A) : + deformValue e x f H ((s,a),1) = e x := by + change (if 2*(1:ℝ) ≤ s then e (H (frontTime s 1,a)) else (f a).1.2 (backTime s 1)) = e x + have hs : ¬ 2*(1:ℝ) ≤ (s:ℝ) := by linarith [s.property.2] + rw [ite_eq_right hs,backTime_one_right] + exact (f a).2.2 + +@[simp] lemma deformValue_zero (a : A) (r : unitInterval) : + deformValue e x f H ((0,a),r) = (f a).1.2 r := by + unfold deformValue + split_ifs with hr + · have he : r = 0 := Subtype.ext (by dsimp at hr ⊢; linarith [r.property.1]) + rw [he,frontTime_zero_right,H.apply_zero] + exact (f a).2.1.symm + · rw [backTime_zero_left] + +def deformPath : C(unitInterval × A,C(unitInterval,Y)) := + (⟨deformValue e x f H,continuous_deformValue e x f H⟩ : C((unitInterval × A) × unitInterval,Y)).curry + +def deformFiber : C(unitInterval × A,Fiber e (e x)) where + toFun z := ⟨(H z,deformPath e x f H z),deformValue_start e x f H z.1 z.2,deformValue_end e x f H z.1 z.2⟩ + continuous_toFun := (H.continuous.prodMk (deformPath e x f H).continuous).subtype_mk _ + +@[simp] lemma deformFiber_zero (a : A) : deformFiber e x f H (0,a) = f a := by + apply Subtype.ext + apply Prod.ext + · exact H.apply_zero a + · ext r + exact deformValue_zero e x f H a r + +def loopInclusion : C(Path (e x) (e x),Fiber e (e x)) where + toFun p := ⟨(x,p.toContinuousMap),p.source,p.target⟩ + continuous_toFun := (continuous_const.prodMk continuous_induced_dom).subtype_mk _ + +@[simp] lemma loopInclusion_base : loopInclusion e x (Path.refl (e x)) = base e x := rfl + +def loopRepresentative : C(A,Path (e x) (e x)) where + toFun a := { + toContinuousMap := deformPath e x f H (1,a) + source' := by + change deformValue e x f H ((1,a),0) = e x + rw [deformValue_start,H.apply_one,ContinuousMap.const_apply] + target' := deformValue_end e x f H 1 a } + continuous_toFun := by + apply Path.continuous_uncurry_iff.mp + exact (continuous_deformValue e x f H).comp ((continuous_const.prodMk continuous_fst).prodMk continuous_snd) + +def deformHomotopy : f.Homotopy ((loopInclusion e x).comp (loopRepresentative e x f H)) where + toContinuousMap := deformFiber e x f H + map_zero_left := deformFiber_zero e x f H + map_one_left a := by + apply Subtype.ext + apply Prod.ext + · exact H.apply_one a + · rfl + +lemma deformValue_fixed (a : A) (ha : f a = base e x) (hH : ∀ s, H (s,a) = x) + (s r : unitInterval) : deformValue e x f H ((s,a),r) = e x := by + unfold deformValue + split_ifs + · rw [hH] + · rw [ha] + rfl + +lemma deformFiber_fixed (a : A) (ha : f a = base e x) (hH : ∀ s, H (s,a) = x) + (s : unitInterval) : deformFiber e x f H (s,a) = base e x := by + apply Subtype.ext + apply Prod.ext (hH s) + ext r + exact deformValue_fixed e x f H a ha hH s r + +lemma loopRepresentative_fixed (a : A) (ha : f a = base e x) (hH : ∀ s, H (s,a) = x) : + loopRepresentative e x f H a = Path.refl (e x) := by + apply Path.ext + funext r + exact deformValue_fixed e x f H a ha hH 1 r + +end NearbyLagrangian.HomotopyFiber + +end + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.HomotopyFiber +open ContinuousMap +open scoped Topology Topology.Homotopy +open BasedHomotopy +variable {N X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] +variable (e : C(X,Y)) (x : X) + +def boundaryRepresentative (f : GenLoop N (Fiber e (e x)) (base e x)) + (H : (loopMap (projection e (e x)) rfl f).1.HomotopyRel + (ContinuousMap.const _ x) (Cube.boundary N)) : + GenLoop N (Path (e x) (e x)) (Path.refl (e x)) := + ⟨loopRepresentative e x f.1 H.toHomotopy,by + intro t ht + apply loopRepresentative_fixed + · exact GenLoop.boundary f t ht + · intro s + exact (H.prop s t ht).trans (congrArg (projection e (e x)) (GenLoop.boundary f t ht))⟩ + +def boundaryRepresentativeHomotopy (f : GenLoop N (Fiber e (e x)) (base e x)) + (H : (loopMap (projection e (e x)) rfl f).1.HomotopyRel + (ContinuousMap.const _ x) (Cube.boundary N)) : + f.1.HomotopyRel (loopMap (loopInclusion e x) rfl (boundaryRepresentative e x f H)).1 + (Cube.boundary N) where + toHomotopy := deformHomotopy e x f.1 H.toHomotopy + prop' s t ht := by + change deformFiber e x f.1 H.toHomotopy (s,t) = f t + rw [GenLoop.boundary f t ht] + apply deformFiber_fixed + · exact GenLoop.boundary f t ht + · intro r + exact (H.prop r t ht).trans (congrArg (projection e (e x)) (GenLoop.boundary f t ht)) + +@[simp] theorem projection_loopInclusion (g : GenLoop N (Path (e x) (e x)) (Path.refl (e x))) : + loopMap (projection e (e x)) rfl (loopMap (loopInclusion e x) rfl g) = GenLoop.const := by + ext t + rfl + +theorem projection_kernel_eq_loop_range [DecidableEq N] [Nonempty N] + (a : HomotopyGroup N (Fiber e (e x)) (base e x)) : + groupMap (projection e (e x)) rfl a = 1 ↔ + ∃ b : HomotopyGroup N (Path (e x) (e x)) (Path.refl (e x)), + groupMap (loopInclusion e x) rfl b = a := by + induction a using Quotient.inductionOn with + | h f => + constructor + · intro h + change (⟦loopMap (projection e (e x)) rfl f⟧ : HomotopyGroup N X x) = ⟦GenLoop.const⟧ at h + obtain ⟨H⟩ := Quotient.exact h + refine ⟨⟦boundaryRepresentative e x f H⟧, ?_⟩ + exact Quotient.sound ⟨(boundaryRepresentativeHomotopy e x f H).symm⟩ + · rintro ⟨b,hb⟩ + rw [← hb] + induction b using Quotient.inductionOn with + | h g => + change (⟦loopMap (projection e (e x)) rfl (loopMap (loopInclusion e x) rfl g)⟧ : + HomotopyGroup N X x) = ⟦GenLoop.const⟧ + exact congrArg Quotient.mk'' (projection_loopInclusion e x g) + +end NearbyLagrangian.HomotopyFiber + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/LoopHomotopy.lean b/lean/OAI/Topology/Homotopy/LoopHomotopy.lean index 69aa93de71227f2fa4ad548f394b8bc2eb8c3ff2..f9248c0b016ded43e043969975a7b4b21fec7562 100644 --- a/lean/OAI/Topology/Homotopy/LoopHomotopy.lean +++ b/lean/OAI/Topology/Homotopy/LoopHomotopy.lean @@ -1,143 +1,143 @@ -import Mathlib - -namespace OAI - -/-! Loop-space homeomorphisms and the degree-shift equivalence. -/ - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.BasedHomotopy -open ContinuousMap -open scoped Topology Topology.Homotopy -variable {N M X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] -variable {x : X} {y : Y} - -theorem genLoop_homotopic_iff_joined (f g : GenLoop N X x) : - GenLoop.Homotopic f g ↔ Joined f g := by - constructor - · rintro ⟨H⟩ - refine ⟨{ - toFun := fun s => ⟨H.toContinuousMap.curry s,fun t ht => - (H.prop s t ht).trans (GenLoop.boundary f t ht)⟩ - continuous_toFun := H.toContinuousMap.curry.continuous.subtype_mk _ - source' := ?_ - target' := ?_ }⟩ - · ext t; exact H.apply_zero t - · ext t; exact H.apply_one t - · rintro ⟨P⟩ - refine ⟨{ - toFun := fun z => P z.1 z.2 - continuous_toFun := ?_ - map_zero_left := ?_ - map_one_left := ?_ - prop' := ?_ }⟩ - · exact (continuous_subtype_val.comp (P.continuous.comp continuous_fst)).eval continuous_snd - · intro t; exact congrArg (fun z : GenLoop N X x => z t) P.source - · intro t; exact congrArg (fun z : GenLoop N X x => z t) P.target - · intro s t ht - exact (GenLoop.boundary (P s) t ht).trans (GenLoop.boundary f t ht).symm - -def piEquivOfLoopHomeomorph (e : GenLoop N X x ≃ₜ GenLoop M Y y) : - HomotopyGroup N X x ≃ HomotopyGroup M Y y := - Quotient.congr e.toEquiv fun f g => by - change GenLoop.Homotopic f g ↔ GenLoop.Homotopic (e f) (e g) - rw [genLoop_homotopic_iff_joined,genLoop_homotopic_iff_joined] - constructor - · intro h; exact h.map e.continuous_toFun - · intro h - have hh : Joined (e.symm (e f)) (e.symm (e g)) := h.map e.symm.continuous_toFun - simpa only [Homeomorph.symm_apply_apply] using hh - -def piReindexEquiv (e : N ≃ M) (x : X) : - HomotopyGroup N X x ≃ HomotopyGroup M X x := - piEquivOfLoopHomeomorph (GenLoop.congr x e) - -def flattenPathLoop (f : GenLoop N (Path y y) (Path.refl y)) : - GenLoop (N ⊕ Unit) Y y := - ⟨⟨fun a => f (a ∘ Sum.inl) (a (Sum.inr ())),by - apply Continuous.eval - · exact f.1.continuous.comp (by fun_prop) - · fun_prop⟩,by - rintro a ⟨i | i,hi⟩ <;> change f (a ∘ Sum.inl) (a (Sum.inr ())) = y - · have h : a ∘ Sum.inl ∈ Cube.boundary N := ⟨i,hi⟩ - rw [GenLoop.boundary f _ h] - rfl - · cases i - rcases hi with hi | hi - · rw [hi]; exact (f _).source - · rw [hi]; exact (f _).target⟩ - -def curryPathLoop (g : GenLoop (N ⊕ Unit) Y y) : - GenLoop N (Path y y) (Path.refl y) := - ⟨⟨fun a => { - toFun := fun r => g (Sum.elim a (fun _ => r)) - continuous_toFun := g.1.continuous.comp (by apply continuous_pi; intro i; cases i <;> dsimp only [Sum.elim] <;> fun_prop) - source' := GenLoop.boundary g _ ⟨Sum.inr (),Or.inl rfl⟩ - target' := GenLoop.boundary g _ ⟨Sum.inr (),Or.inr rfl⟩ },by - apply Path.continuous_uncurry_iff.mp - exact g.1.continuous.comp (by apply continuous_pi; intro i; cases i <;> dsimp only [Sum.elim] <;> fun_prop)⟩,by - rintro a ⟨i,hi⟩ - apply Path.ext - funext r - exact GenLoop.boundary g _ ⟨Sum.inl i,hi⟩⟩ - -@[simp] lemma curry_flatten (f : GenLoop N (Path y y) (Path.refl y)) : - curryPathLoop (flattenPathLoop f) = f := by - apply Subtype.ext - ext a r - rfl - -@[simp] lemma flatten_curry (g : GenLoop (N ⊕ Unit) Y y) : - flattenPathLoop (curryPathLoop g) = g := by - apply Subtype.ext - ext a - change g (Sum.elim (a ∘ Sum.inl) (fun _ => a (Sum.inr ()))) = g a - congr 1 - funext i - cases i with - | inl i => rfl - | inr i => cases i; rfl - -lemma continuous_flattenPathLoop : Continuous (@flattenPathLoop N Y _ y) := by - apply Continuous.subtype_mk - apply ContinuousMap.continuous_of_continuous_uncurry - change Continuous (fun z : GenLoop N (Path y y) (Path.refl y) × ((N ⊕ Unit) → unitInterval) => - z.1 (z.2 ∘ Sum.inl) (z.2 (Sum.inr ()))) - have h : Continuous (fun z : GenLoop N (Path y y) (Path.refl y) × ((N ⊕ Unit) → unitInterval) => - z.1 (z.2 ∘ Sum.inl)) := - (continuous_subtype_val.comp continuous_fst).eval - (continuous_pi (fun i => (continuous_apply (Sum.inl i)).comp continuous_snd)) - exact h.eval ((continuous_apply (Sum.inr ())).comp continuous_snd) - -lemma continuous_curryPathLoop : Continuous (@curryPathLoop N Y _ y) := by - apply Continuous.subtype_mk - apply ContinuousMap.continuous_of_continuous_uncurry - apply Path.continuous_uncurry_iff.mp - exact (continuous_subtype_val.comp (continuous_fst.comp continuous_fst)).eval - (by apply continuous_pi; intro i; cases i <;> dsimp only [Sum.elim] <;> fun_prop) - -def loopSpaceCubeHomeomorph : - GenLoop N (Path y y) (Path.refl y) ≃ₜ GenLoop (N ⊕ Unit) Y y where - toFun := flattenPathLoop - invFun := curryPathLoop - left_inv := curry_flatten - right_inv := flatten_curry - continuous_toFun := continuous_flattenPathLoop - continuous_invFun := continuous_curryPathLoop - -def loopPiEquiv (y : Y) : - HomotopyGroup N (Path y y) (Path.refl y) ≃ HomotopyGroup (N ⊕ Unit) Y y := - piEquivOfLoopHomeomorph loopSpaceCubeHomeomorph - -def pi9LoopEquivPi10 (y : Y) : - π_ 9 (Path y y) (Path.refl y) ≃ π_ 10 Y y := - (loopPiEquiv y).trans (piReindexEquiv - ((Equiv.sumCongr (Equiv.refl (Fin 9)) (Equiv.ofUnique Unit (Fin 1))).trans finSumFinEquiv) y) - -end NearbyLagrangian.BasedHomotopy - -end - -end OAI +import Mathlib + +namespace OAI + +/-! Loop-space homeomorphisms and the degree-shift equivalence. -/ + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.BasedHomotopy +open ContinuousMap +open scoped Topology Topology.Homotopy +variable {N M X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] +variable {x : X} {y : Y} + +theorem genLoop_homotopic_iff_joined (f g : GenLoop N X x) : + GenLoop.Homotopic f g ↔ Joined f g := by + constructor + · rintro ⟨H⟩ + refine ⟨{ + toFun := fun s => ⟨H.toContinuousMap.curry s,fun t ht => + (H.prop s t ht).trans (GenLoop.boundary f t ht)⟩ + continuous_toFun := H.toContinuousMap.curry.continuous.subtype_mk _ + source' := ?_ + target' := ?_ }⟩ + · ext t; exact H.apply_zero t + · ext t; exact H.apply_one t + · rintro ⟨P⟩ + refine ⟨{ + toFun := fun z => P z.1 z.2 + continuous_toFun := ?_ + map_zero_left := ?_ + map_one_left := ?_ + prop' := ?_ }⟩ + · exact (continuous_subtype_val.comp (P.continuous.comp continuous_fst)).eval continuous_snd + · intro t; exact congrArg (fun z : GenLoop N X x => z t) P.source + · intro t; exact congrArg (fun z : GenLoop N X x => z t) P.target + · intro s t ht + exact (GenLoop.boundary (P s) t ht).trans (GenLoop.boundary f t ht).symm + +def piEquivOfLoopHomeomorph (e : GenLoop N X x ≃ₜ GenLoop M Y y) : + HomotopyGroup N X x ≃ HomotopyGroup M Y y := + Quotient.congr e.toEquiv fun f g => by + change GenLoop.Homotopic f g ↔ GenLoop.Homotopic (e f) (e g) + rw [genLoop_homotopic_iff_joined,genLoop_homotopic_iff_joined] + constructor + · intro h; exact h.map e.continuous_toFun + · intro h + have hh : Joined (e.symm (e f)) (e.symm (e g)) := h.map e.symm.continuous_toFun + simpa only [Homeomorph.symm_apply_apply] using hh + +def piReindexEquiv (e : N ≃ M) (x : X) : + HomotopyGroup N X x ≃ HomotopyGroup M X x := + piEquivOfLoopHomeomorph (GenLoop.congr x e) + +def flattenPathLoop (f : GenLoop N (Path y y) (Path.refl y)) : + GenLoop (N ⊕ Unit) Y y := + ⟨⟨fun a => f (a ∘ Sum.inl) (a (Sum.inr ())),by + apply Continuous.eval + · exact f.1.continuous.comp (by fun_prop) + · fun_prop⟩,by + rintro a ⟨i | i,hi⟩ <;> change f (a ∘ Sum.inl) (a (Sum.inr ())) = y + · have h : a ∘ Sum.inl ∈ Cube.boundary N := ⟨i,hi⟩ + rw [GenLoop.boundary f _ h] + rfl + · cases i + rcases hi with hi | hi + · rw [hi]; exact (f _).source + · rw [hi]; exact (f _).target⟩ + +def curryPathLoop (g : GenLoop (N ⊕ Unit) Y y) : + GenLoop N (Path y y) (Path.refl y) := + ⟨⟨fun a => { + toFun := fun r => g (Sum.elim a (fun _ => r)) + continuous_toFun := g.1.continuous.comp (by apply continuous_pi; intro i; cases i <;> dsimp only [Sum.elim] <;> fun_prop) + source' := GenLoop.boundary g _ ⟨Sum.inr (),Or.inl rfl⟩ + target' := GenLoop.boundary g _ ⟨Sum.inr (),Or.inr rfl⟩ },by + apply Path.continuous_uncurry_iff.mp + exact g.1.continuous.comp (by apply continuous_pi; intro i; cases i <;> dsimp only [Sum.elim] <;> fun_prop)⟩,by + rintro a ⟨i,hi⟩ + apply Path.ext + funext r + exact GenLoop.boundary g _ ⟨Sum.inl i,hi⟩⟩ + +@[simp] lemma curry_flatten (f : GenLoop N (Path y y) (Path.refl y)) : + curryPathLoop (flattenPathLoop f) = f := by + apply Subtype.ext + ext a r + rfl + +@[simp] lemma flatten_curry (g : GenLoop (N ⊕ Unit) Y y) : + flattenPathLoop (curryPathLoop g) = g := by + apply Subtype.ext + ext a + change g (Sum.elim (a ∘ Sum.inl) (fun _ => a (Sum.inr ()))) = g a + congr 1 + funext i + cases i with + | inl i => rfl + | inr i => cases i; rfl + +lemma continuous_flattenPathLoop : Continuous (@flattenPathLoop N Y _ y) := by + apply Continuous.subtype_mk + apply ContinuousMap.continuous_of_continuous_uncurry + change Continuous (fun z : GenLoop N (Path y y) (Path.refl y) × ((N ⊕ Unit) → unitInterval) => + z.1 (z.2 ∘ Sum.inl) (z.2 (Sum.inr ()))) + have h : Continuous (fun z : GenLoop N (Path y y) (Path.refl y) × ((N ⊕ Unit) → unitInterval) => + z.1 (z.2 ∘ Sum.inl)) := + (continuous_subtype_val.comp continuous_fst).eval + (continuous_pi (fun i => (continuous_apply (Sum.inl i)).comp continuous_snd)) + exact h.eval ((continuous_apply (Sum.inr ())).comp continuous_snd) + +lemma continuous_curryPathLoop : Continuous (@curryPathLoop N Y _ y) := by + apply Continuous.subtype_mk + apply ContinuousMap.continuous_of_continuous_uncurry + apply Path.continuous_uncurry_iff.mp + exact (continuous_subtype_val.comp (continuous_fst.comp continuous_fst)).eval + (by apply continuous_pi; intro i; cases i <;> dsimp only [Sum.elim] <;> fun_prop) + +def loopSpaceCubeHomeomorph : + GenLoop N (Path y y) (Path.refl y) ≃ₜ GenLoop (N ⊕ Unit) Y y where + toFun := flattenPathLoop + invFun := curryPathLoop + left_inv := curry_flatten + right_inv := flatten_curry + continuous_toFun := continuous_flattenPathLoop + continuous_invFun := continuous_curryPathLoop + +def loopPiEquiv (y : Y) : + HomotopyGroup N (Path y y) (Path.refl y) ≃ HomotopyGroup (N ⊕ Unit) Y y := + piEquivOfLoopHomeomorph loopSpaceCubeHomeomorph + +def pi9LoopEquivPi10 (y : Y) : + π_ 9 (Path y y) (Path.refl y) ≃ π_ 10 Y y := + (loopPiEquiv y).trans (piReindexEquiv + ((Equiv.sumCongr (Equiv.refl (Fin 9)) (Equiv.ofUnique Unit (Fin 1))).trans finSumFinEquiv) y) + +end NearbyLagrangian.BasedHomotopy + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/OpenCollapse.lean b/lean/OAI/Topology/Homotopy/OpenCollapse.lean index 1afd3a48b2554d8d9c38de5b72315eed29fcec66..8653c32d36fb3df4b142e2ee80198d1b8b700970 100644 --- a/lean/OAI/Topology/Homotopy/OpenCollapse.lean +++ b/lean/OAI/Topology/Homotopy/OpenCollapse.lean @@ -1,128 +1,128 @@ -import Mathlib - -namespace OAI - -/-! Continuous collapse to a one-point compactification and parameterized descent. -/ - -noncomputable section -universe u v w -open Set ContinuousMap Topology -open scoped Classical OnePoint Topology - -namespace NearbyLagrangian.OpenCollapse -variable {Y : Type*} - -def collapse (U : Set Y) (y : Y) : OnePoint U := - if h : y ∈ U then (⟨y,h⟩ : U) else ∞ - -@[simp] lemma collapse_of_mem {U : Set Y} {y : Y} (h : y ∈ U) : - collapse U y = (⟨y,h⟩ : U) := by simp [collapse,h] -@[simp] lemma collapse_of_notMem {U : Set Y} {y : Y} (h : y ∉ U) : - collapse U y = ∞ := by simp [collapse,h] -lemma collapse_eq_infty {U : Set Y} {y : Y} : collapse U y = ∞ ↔ y ∉ U := by - by_cases h : y ∈ U <;> simp [h] -lemma collapse_eq {U : Set Y} {y z : Y} : - collapse U y = collapse U z ↔ y = z ∨ y ∉ U ∧ z ∉ U := by - by_cases hy : y ∈ U - · by_cases hz : z ∈ U - · simp [collapse,hy,hz] - · have hn : y ≠ z := by rintro rfl; contradiction - simp [collapse,hy,hz,hn] - · by_cases hz : z ∈ U - · have hn : y ≠ z := by rintro rfl; contradiction - simp [collapse,hy,hz,hn] - · simp [collapse,hy,hz] - -variable [TopologicalSpace Y] [T2Space Y] - -lemma continuous_collapse {U : Set Y} (hU : IsOpen U) : Continuous (collapse U) := by - rw [continuous_def] - intro S hS - by_cases hi : ∞ ∈ S - · have hK := ((OnePoint.isOpen_iff_of_mem hi).mp hS).2 - have he : (collapse U ⁻¹' S)ᶜ = Subtype.val '' (((↑) : U → OnePoint U) ⁻¹' S)ᶜ := by - ext y - by_cases hy : y ∈ U - · simp [hy,Set.mem_image,collapse] - · simp [hy,collapse,hi] - rw [← isClosed_compl_iff,he] - exact (hK.image continuous_subtype_val).isClosed - · have hV := (OnePoint.isOpen_iff_of_notMem hi).mp hS - have he : collapse U ⁻¹' S = Subtype.val '' (((↑) : U → OnePoint U) ⁻¹' S) := by - ext y - by_cases hy : y ∈ U - · simp [hy,Set.mem_image,collapse] - · simp [hy,collapse,hi] - rw [he] - exact hU.isOpenMap_subtype_val _ hV - -omit [TopologicalSpace Y] [T2Space Y] in -lemma collapse_surjective {U : Set Y} (hU : Uᶜ.Nonempty) : Function.Surjective (collapse U) := by - intro z - induction z using OnePoint.rec with - | infty => obtain ⟨y,hy⟩ := hU; exact ⟨y,collapse_of_notMem hy⟩ - | coe y => exact ⟨y,collapse_of_mem y.property⟩ - -variable [CompactSpace Y] -lemma isQuotientMap_collapse {U : Set Y} (hU : IsOpen U) (hUc : Uᶜ.Nonempty) : - IsQuotientMap (collapse U) := by - let : LocallyCompactSpace U := hU.locallyCompactSpace - exact (continuous_collapse hU).isClosedMap.isQuotientMap (continuous_collapse hU) - (collapse_surjective hUc) - -def descend {U : Set Y} (hU : IsOpen U) (hUc : Uᶜ.Nonempty) - {X : Type*} [TopologicalSpace X] (f : C(Y,X)) (x : X) - (hf : ∀ y ∉ U, f y = x) : C(OnePoint U,X) where - toFun := fun z => z.elim x (fun y => f y) - continuous_toFun := (isQuotientMap_collapse hU hUc).continuous_iff.mpr (by - have he : (fun z : OnePoint U => z.elim x (fun y => f y)) ∘ collapse U = f := by - funext y - by_cases hy : y ∈ U - · simp [hy] - · simp [hy,hf y hy] - rw [he] - exact f.continuous) - -@[simp] lemma descend_collapse {U : Set Y} (hU : IsOpen U) (hUc : Uᶜ.Nonempty) - {X : Type*} [TopologicalSpace X] (f : C(Y,X)) (x : X) - (hf : ∀ y ∉ U, f y = x) (y : Y) : descend hU hUc f x hf (collapse U y) = f y := by - by_cases hy : y ∈ U <;> simp [descend,hy,hf y] - -end NearbyLagrangian.OpenCollapse - -end - -noncomputable section -universe u v w -open Set ContinuousMap Topology -open scoped Classical OnePoint Topology - -namespace NearbyLagrangian.OpenCollapse -variable {Y P X : Type*} [TopologicalSpace Y] [T2Space Y] [CompactSpace Y] - [TopologicalSpace P] [T2Space P] [CompactSpace P] [TopologicalSpace X] - -lemma continuous_descend_param {U : Set Y} (hU : IsOpen U) (hUc : Uᶜ.Nonempty) - (F : C(P × Y,X)) (g : C(P,X)) (hF : ∀ p y, y ∉ U → F (p,y) = g p) : - Continuous (fun q : P × OnePoint U => q.2.elim (g q.1) (fun y => F (q.1,y))) := by - let : LocallyCompactSpace U := hU.locallyCompactSpace - let c : P × Y → P × OnePoint U := fun z => (z.1,collapse U z.2) - have hc : Continuous c := continuous_fst.prodMk ((continuous_collapse hU).comp continuous_snd) - have hs : Function.Surjective c := by - rintro ⟨p,z⟩ - obtain ⟨y,hy⟩ := collapse_surjective hUc z - exact ⟨(p,y),Prod.ext rfl hy⟩ - have hq := hc.isClosedMap.isQuotientMap hc hs - apply hq.continuous_iff.mpr - have he : (fun q : P × OnePoint U => q.2.elim (g q.1) (fun y => F (q.1,y))) ∘ c = F := by - funext q - rcases q with ⟨p,y⟩ - change (collapse U y).elim (g p) (fun y => F (p,y)) = F (p,y) - by_cases hy : y ∈ U <;> simp [hy,hF p y] - rw [he] - exact F.continuous - -end NearbyLagrangian.OpenCollapse - -end - -end OAI +import Mathlib + +namespace OAI + +/-! Continuous collapse to a one-point compactification and parameterized descent. -/ + +noncomputable section +universe u v w +open Set ContinuousMap Topology +open scoped Classical OnePoint Topology + +namespace NearbyLagrangian.OpenCollapse +variable {Y : Type*} + +def collapse (U : Set Y) (y : Y) : OnePoint U := + if h : y ∈ U then (⟨y,h⟩ : U) else ∞ + +@[simp] lemma collapse_of_mem {U : Set Y} {y : Y} (h : y ∈ U) : + collapse U y = (⟨y,h⟩ : U) := by simp [collapse,h] +@[simp] lemma collapse_of_notMem {U : Set Y} {y : Y} (h : y ∉ U) : + collapse U y = ∞ := by simp [collapse,h] +lemma collapse_eq_infty {U : Set Y} {y : Y} : collapse U y = ∞ ↔ y ∉ U := by + by_cases h : y ∈ U <;> simp [h] +lemma collapse_eq {U : Set Y} {y z : Y} : + collapse U y = collapse U z ↔ y = z ∨ y ∉ U ∧ z ∉ U := by + by_cases hy : y ∈ U + · by_cases hz : z ∈ U + · simp [collapse,hy,hz] + · have hn : y ≠ z := by rintro rfl; contradiction + simp [collapse,hy,hz,hn] + · by_cases hz : z ∈ U + · have hn : y ≠ z := by rintro rfl; contradiction + simp [collapse,hy,hz,hn] + · simp [collapse,hy,hz] + +variable [TopologicalSpace Y] [T2Space Y] + +lemma continuous_collapse {U : Set Y} (hU : IsOpen U) : Continuous (collapse U) := by + rw [continuous_def] + intro S hS + by_cases hi : ∞ ∈ S + · have hK := ((OnePoint.isOpen_iff_of_mem hi).mp hS).2 + have he : (collapse U ⁻¹' S)ᶜ = Subtype.val '' (((↑) : U → OnePoint U) ⁻¹' S)ᶜ := by + ext y + by_cases hy : y ∈ U + · simp [hy,Set.mem_image,collapse] + · simp [hy,collapse,hi] + rw [← isClosed_compl_iff,he] + exact (hK.image continuous_subtype_val).isClosed + · have hV := (OnePoint.isOpen_iff_of_notMem hi).mp hS + have he : collapse U ⁻¹' S = Subtype.val '' (((↑) : U → OnePoint U) ⁻¹' S) := by + ext y + by_cases hy : y ∈ U + · simp [hy,Set.mem_image,collapse] + · simp [hy,collapse,hi] + rw [he] + exact hU.isOpenMap_subtype_val _ hV + +omit [TopologicalSpace Y] [T2Space Y] in +lemma collapse_surjective {U : Set Y} (hU : Uᶜ.Nonempty) : Function.Surjective (collapse U) := by + intro z + induction z using OnePoint.rec with + | infty => obtain ⟨y,hy⟩ := hU; exact ⟨y,collapse_of_notMem hy⟩ + | coe y => exact ⟨y,collapse_of_mem y.property⟩ + +variable [CompactSpace Y] +lemma isQuotientMap_collapse {U : Set Y} (hU : IsOpen U) (hUc : Uᶜ.Nonempty) : + IsQuotientMap (collapse U) := by + let : LocallyCompactSpace U := hU.locallyCompactSpace + exact (continuous_collapse hU).isClosedMap.isQuotientMap (continuous_collapse hU) + (collapse_surjective hUc) + +def descend {U : Set Y} (hU : IsOpen U) (hUc : Uᶜ.Nonempty) + {X : Type*} [TopologicalSpace X] (f : C(Y,X)) (x : X) + (hf : ∀ y ∉ U, f y = x) : C(OnePoint U,X) where + toFun := fun z => z.elim x (fun y => f y) + continuous_toFun := (isQuotientMap_collapse hU hUc).continuous_iff.mpr (by + have he : (fun z : OnePoint U => z.elim x (fun y => f y)) ∘ collapse U = f := by + funext y + by_cases hy : y ∈ U + · simp [hy] + · simp [hy,hf y hy] + rw [he] + exact f.continuous) + +@[simp] lemma descend_collapse {U : Set Y} (hU : IsOpen U) (hUc : Uᶜ.Nonempty) + {X : Type*} [TopologicalSpace X] (f : C(Y,X)) (x : X) + (hf : ∀ y ∉ U, f y = x) (y : Y) : descend hU hUc f x hf (collapse U y) = f y := by + by_cases hy : y ∈ U <;> simp [descend,hy,hf y] + +end NearbyLagrangian.OpenCollapse + +end + +noncomputable section +universe u v w +open Set ContinuousMap Topology +open scoped Classical OnePoint Topology + +namespace NearbyLagrangian.OpenCollapse +variable {Y P X : Type*} [TopologicalSpace Y] [T2Space Y] [CompactSpace Y] + [TopologicalSpace P] [T2Space P] [CompactSpace P] [TopologicalSpace X] + +lemma continuous_descend_param {U : Set Y} (hU : IsOpen U) (hUc : Uᶜ.Nonempty) + (F : C(P × Y,X)) (g : C(P,X)) (hF : ∀ p y, y ∉ U → F (p,y) = g p) : + Continuous (fun q : P × OnePoint U => q.2.elim (g q.1) (fun y => F (q.1,y))) := by + let : LocallyCompactSpace U := hU.locallyCompactSpace + let c : P × Y → P × OnePoint U := fun z => (z.1,collapse U z.2) + have hc : Continuous c := continuous_fst.prodMk ((continuous_collapse hU).comp continuous_snd) + have hs : Function.Surjective c := by + rintro ⟨p,z⟩ + obtain ⟨y,hy⟩ := collapse_surjective hUc z + exact ⟨(p,y),Prod.ext rfl hy⟩ + have hq := hc.isClosedMap.isQuotientMap hc hs + apply hq.continuous_iff.mpr + have he : (fun q : P × OnePoint U => q.2.elim (g q.1) (fun y => F (q.1,y))) ∘ c = F := by + funext q + rcases q with ⟨p,y⟩ + change (collapse U y).elim (g p) (fun y => F (p,y)) = F (p,y) + by_cases hy : y ∈ U <;> simp [hy,hF p y] + rw [he] + exact F.continuous + +end NearbyLagrangian.OpenCollapse + +end + +end OAI diff --git a/lean/OAI/Topology/Homotopy/RayTelescope.lean b/lean/OAI/Topology/Homotopy/RayTelescope.lean index 84c2e7f9861004767048c7014e390b54131bf093..e7c2f631b2e1dae01dc680c2988c7f7da120db11 100644 --- a/lean/OAI/Topology/Homotopy/RayTelescope.lean +++ b/lean/OAI/Topology/Homotopy/RayTelescope.lean @@ -1,383 +1,383 @@ -import Mathlib - -namespace OAI - -/-! Sequential ray telescopes, finite-stage representatives and path connectedness. -/ - -noncomputable section -universe u v w -open Set ContinuousMap -open scoped Topology - -namespace NearbyLagrangian.RayTelescope -variable (X : ℕ → Type u) [∀ n, TopologicalSpace (X n)] -variable (φ : ∀ m n, m ≤ n → C(X m,X n)) - -abbrev Raw := Σ n, X n × {t : ℝ // (n:ℝ) ≤ t} - -inductive Glue : Raw X → Raw X → Prop - | step (n m : ℕ) (h : n ≤ m) (x : X n) (t : ℝ) (ht : (m:ℝ) ≤ t) : - Glue ⟨n,(x,⟨t,(by exact le_trans (by exact_mod_cast h) ht)⟩)⟩ - ⟨m,(φ n m h x,⟨t,ht⟩)⟩ - -abbrev Space := Quot (Glue X φ) - -def rawHeight : C(Raw X,ℝ) := - ⟨fun a => a.2.2,continuous_sigma (fun _ => continuous_subtype_val.comp continuous_snd)⟩ - -def height : C(Space X φ,ℝ) := - ⟨Quot.lift (rawHeight X) (by intro a b h; cases h; rfl), - continuous_quot_lift _ (rawHeight X).continuous⟩ - -@[simp] theorem height_quot (a : Raw X) : height X φ (Quot.mk _ a) = a.2.2 := rfl - -def bottomTime (n : ℕ) : {t : ℝ // (n:ℝ) ≤ t} := ⟨(n:ℝ),by exact le_rfl⟩ - -def stage (n : ℕ) : C(X n,Space X φ) := - ⟨fun x => Quot.mk _ ⟨n,(x,bottomTime n)⟩,by - exact continuous_quot_mk.comp (continuous_sigmaMk.comp - (continuous_id.prodMk (continuous_const : - Continuous (fun _ : X n => bottomTime n))))⟩ - -@[simp] theorem height_stage (n : ℕ) (x : X n) : height X φ (stage X φ n x) = n := rfl - -variable [∀ n, Nonempty (X n)] -variable [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] - -def rawCollapse (N : ℕ) : C(Raw X,X N) where - toFun a := if h : a.1 ≤ N then φ a.1 N h a.2.1 else Classical.choice inferInstance - continuous_toFun := continuous_sigma (fun n => by - by_cases h : n ≤ N - · simpa only [dite_eq_left h,Function.comp_def] using (φ n N h).continuous.comp continuous_fst - · simpa only [dite_eq_right h] using - (continuous_const : Continuous (fun _ : X n × {t : ℝ // (n:ℝ) ≤ t} => (Classical.choice inferInstance : X N)))) - -omit [∀ n, Nonempty (X n)] in -lemma stage_le_of_height_lt {N : ℕ} (a : Raw X) (h : rawHeight X a < (N:ℝ)+1) : a.1 ≤ N := by - have h' : (a.1:ℝ) < (N:ℝ)+1 := lt_of_le_of_lt a.2.2.2 h - have : a.1 < N+1 := by exact_mod_cast h' - omega - -lemma collapse_compatible {N : ℕ} {a b : Raw X} - (h : Quot.mk (Glue X φ) a = Quot.mk (Glue X φ) b) - (ha : rawHeight X a < (N:ℝ)+1) : rawCollapse X φ N a = rawCollapse X φ N b := by - have hrel := Quot.eqvGen_exact h - have aux : ∀ a b, Relation.EqvGen (Glue X φ) a b → - rawHeight X a = rawHeight X b ∧ - (rawHeight X a < (N:ℝ)+1 → rawCollapse X φ N a = rawCollapse X φ N b) := by - intro a b h - induction h with - | rel a b hab => - cases hab with - | step n m h x t ht => - refine ⟨rfl,fun hz => ?_⟩ - have hm : m ≤ N := stage_le_of_height_lt X ⟨m,(φ n m h x,⟨t,ht⟩)⟩ hz - have hn := h.trans hm - simp only [rawCollapse,ContinuousMap.coe_mk,dite_eq_left hn,dite_eq_left hm] - exact (DirectedSystem.map_map (f:=fun {m n} h => (φ m n h : _ → _)) h hm x).symm - | refl a => exact ⟨rfl,fun _ => rfl⟩ - | symm a b hab ih => exact ⟨ih.1.symm,fun hb => (ih.2 (ih.1.symm ▸ hb)).symm⟩ - | trans a b c hab hbc ihab ihbc => - exact ⟨ihab.1.trans ihbc.1,fun ha => (ihab.2 ha).trans (ihbc.2 (ihab.1 ▸ ha))⟩ - exact (aux a b hrel).2 ha - -abbrev Trunc (N : ℕ) := {z : Space X φ // height X φ z < (N:ℝ)+1} - -def representative (z : Space X φ) : Raw X := (Quot.mk_surjective z).choose - -omit [∀ n, Nonempty (X n)] [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] in -@[simp] theorem representative_mk (z : Space X φ) : - Quot.mk (Glue X φ) (representative X φ z) = z := (Quot.mk_surjective z).choose_spec - -def retract (N : ℕ) : C(Trunc X φ N,X N) where - toFun z := rawCollapse X φ N (representative X φ z.1) - continuous_toFun := by - let s := {z : Space X φ | height X φ z < (N:ℝ)+1} - have hs : IsOpen s := isOpen_lt (height X φ).continuous continuous_const - have hq := (isQuotientMap_quot_mk (r:=Glue X φ)).restrictPreimage_isOpen hs - apply hq.continuous_iff.mpr - change Continuous (fun a : {a : Raw X // Quot.mk (Glue X φ) a ∈ s} => - rawCollapse X φ N (representative X φ (Quot.mk _ a.1))) - have hf : (fun a : {a : Raw X // Quot.mk (Glue X φ) a ∈ s} => - rawCollapse X φ N (representative X φ (Quot.mk _ a.1))) = - fun a => rawCollapse X φ N a.1 := by - funext a - apply collapse_compatible X φ - · exact representative_mk X φ _ - · change height X φ (Quot.mk _ (representative X φ (Quot.mk _ a.1))) < _ - rw [representative_mk] - exact a.2 - rw [hf] - exact (rawCollapse X φ N).continuous.comp continuous_subtype_val - -@[simp] theorem retract_quot (N : ℕ) (a : Raw X) - (ha : rawHeight X a < (N:ℝ)+1) : - retract X φ N ⟨Quot.mk _ a,ha⟩ = rawCollapse X φ N a := by - apply collapse_compatible X φ - · exact representative_mk X φ _ - · change height X φ (Quot.mk _ (representative X φ (Quot.mk _ a))) < _ - rw [representative_mk] - exact ha - -@[simp] theorem retract_stage (N n : ℕ) (h : n ≤ N) (x : X n) - (hx : height X φ (stage X φ n x) < (N:ℝ)+1) : - retract X φ N ⟨stage X φ n x,hx⟩ = φ n N h x := by - calc - retract X φ N ⟨stage X φ n x,hx⟩ = rawCollapse X φ N ⟨n,(x,bottomTime n)⟩ := - retract_quot X φ N ⟨n,(x,bottomTime n)⟩ hx - _ = φ n N h x := by simp only [rawCollapse,ContinuousMap.coe_mk,dite_eq_left h] - -end NearbyLagrangian.RayTelescope - -end - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.RayTelescope -open Set ContinuousMap -open scoped Topology -variable (X : ℕ → Type u) [∀ n, TopologicalSpace (X n)] -variable (φ : ∀ m n, m ≤ n → C(X m,X n)) - -def raiseTime (N : ℕ) (s : unitInterval) (t : ℝ) : ℝ := t + s * (max t N-t) - -lemma le_raiseTime (N : ℕ) (s : unitInterval) (t : ℝ) : t ≤ raiseTime N s t := by - unfold raiseTime - exact le_add_of_nonneg_right (mul_nonneg s.2.1 (sub_nonneg.mpr (le_max_left _ _))) - -@[simp] theorem raiseTime_zero (N : ℕ) (t : ℝ) : raiseTime N 0 t = t := by simp [raiseTime] -@[simp] theorem raiseTime_one (N : ℕ) (t : ℝ) : raiseTime N 1 t = max t N := by simp [raiseTime] - -def cylinderRaise (N n : ℕ) : C((X n × {t : ℝ // (n:ℝ) ≤ t}) × unitInterval,Space X φ) where - toFun z := Quot.mk _ ⟨n,(z.1.1,⟨raiseTime N z.2 z.1.2, - z.1.2.2.trans (le_raiseTime _ _ _)⟩)⟩ - continuous_toFun := by - have ht : Continuous (fun z : (X n × {t : ℝ // (n:ℝ) ≤ t}) × unitInterval => raiseTime N z.2 z.1.2) := by - unfold raiseTime - fun_prop - exact continuous_quot_mk.comp (continuous_sigmaMk.comp - (continuous_fst.fst.prodMk (ht.subtype_mk _))) - -def rawRaise (N : ℕ) : C(Raw X,C(unitInterval,Space X φ)) := - ⟨fun a => (cylinderRaise X φ N a.1).curry a.2, - continuous_sigma (fun _ => (cylinderRaise X φ N _).curry.continuous)⟩ - -def raiseFamily (N : ℕ) : C(Space X φ,C(unitInterval,Space X φ)) := - ⟨Quot.lift (rawRaise X φ N) (by - intro a b h - ext s - cases h with - | step n m h x t ht => - exact Quot.sound (Glue.step n m h x (raiseTime N s t) (ht.trans (le_raiseTime _ _ _)))), - continuous_quot_lift _ (rawRaise X φ N).continuous⟩ - -@[simp] theorem raiseFamily_apply (N : ℕ) (a : Raw X) (s : unitInterval) : - raiseFamily X φ N (Quot.mk _ a) s = Quot.mk _ - ⟨a.1,(a.2.1,⟨raiseTime N s a.2.2,a.2.2.2.trans (le_raiseTime _ _ _)⟩)⟩ := rfl - -def raised (N : ℕ) : C(Space X φ,Space X φ) := - ⟨fun z => raiseFamily X φ N z 1,(continuous_eval_const (1:unitInterval)).comp - (raiseFamily X φ N).continuous⟩ - -def raiseHomotopy (N : ℕ) : (ContinuousMap.id (Space X φ)).Homotopy (raised X φ N) where - toFun z := raiseFamily X φ N z.2 z.1 - continuous_toFun := (raiseFamily X φ N).uncurry.continuous.comp continuous_swap - map_zero_left z := by - induction z using Quot.inductionOn with - | h a => - change Quot.mk _ ⟨a.1,(a.2.1,⟨raiseTime N 0 a.2.2,_⟩)⟩ = Quot.mk _ a - exact congrArg (fun t : {t : ℝ // (a.1:ℝ) ≤ t} => Quot.mk (Glue X φ) ⟨a.1,(a.2.1,t)⟩) - (Subtype.ext (raiseTime_zero N a.2.2)) - map_one_left _ := rfl - -@[simp] theorem height_raised (N : ℕ) (z : Space X φ) : - height X φ (raised X φ N z) = max (height X φ z) N := by - induction z using Quot.inductionOn with - | h a => change raiseTime N 1 a.2.2 = max (a.2.2:ℝ) N; exact raiseTime_one _ _ - -variable [∀ n, Nonempty (X n)] -variable [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] - -theorem raised_eq_stage_retract (N : ℕ) (z : Space X φ) (hz : height X φ z ≤ N) : - raised X φ N z = stage X φ N - (retract X φ N ⟨z,lt_of_le_of_lt hz (by linarith)⟩) := by - induction z using Quot.inductionOn with - | h a => - have hn : a.1 ≤ N := stage_le_of_height_lt X a (lt_of_le_of_lt hz (by linarith)) - have hr : retract X φ N ⟨Quot.mk _ a,lt_of_le_of_lt hz (by linarith)⟩ = - rawCollapse X φ N a := retract_quot X φ N a _ - rw [hr] - change Quot.mk (Glue X φ) ⟨a.1,(a.2.1,⟨raiseTime N 1 a.2.2,_⟩)⟩ = - Quot.mk (Glue X φ) ⟨N,(rawCollapse X φ N a,⟨(N:ℝ),le_rfl⟩)⟩ - have hz' : (a.2.2:ℝ) ≤ N := hz - simp only [raiseTime_one,max_eq_right hz',rawCollapse,ContinuousMap.coe_mk,dite_eq_left hn] - exact Quot.sound (Glue.step a.1 N hn a.2.1 (N:ℝ) le_rfl) - -end NearbyLagrangian.RayTelescope - -end - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.RayTelescope -open Set ContinuousMap -open scoped Topology -variable (X : ℕ → Type u) [∀ n, TopologicalSpace (X n)] -variable (φ : ∀ m n, m ≤ n → C(X m,X n)) -variable {A : Type v} [TopologicalSpace A] - -theorem exists_height_bound [CompactSpace A] (f : C(A,Space X φ)) : - ∃ N : ℕ, ∀ a, height X φ (f a) ≤ N := by - obtain ⟨r,hr⟩ := (isCompact_range ((height X φ).continuous.comp f.continuous)).bddAbove - obtain ⟨N,hN⟩ := exists_nat_gt r - exact ⟨N,fun a => le_of_lt ((hr ⟨a,rfl⟩).trans_lt hN)⟩ - -variable [∀ n, Nonempty (X n)] -variable [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] - -def finiteMap (N : ℕ) (f : C(A,Space X φ)) (hf : ∀ a, height X φ (f a) < (N:ℝ)+1) : C(A,X N) := - (retract X φ N).comp ⟨fun a => ⟨f a,hf a⟩,f.continuous.subtype_mk _⟩ - -def finiteHomotopy (N : ℕ) (f : C(A,Space X φ)) (hf : ∀ a, height X φ (f a) ≤ N) : - f.Homotopy ((stage X φ N).comp - (finiteMap X φ N f (fun a => lt_of_le_of_lt (hf a) (by linarith)))) := - ((raiseHomotopy X φ N).compContinuousMap f).cast (by ext; rfl) (by - ext a - exact raised_eq_stage_retract X φ N (f a) (hf a)) - -theorem exists_finite_representative [CompactSpace A] (f : C(A,Space X φ)) : - ∃ N : ℕ, ∃ g : C(A,X N), f.Homotopic ((stage X φ N).comp g) := by - obtain ⟨N,hN⟩ := exists_height_bound X φ f - exact ⟨N,finiteMap X φ N f (fun a => lt_of_le_of_lt (hN a) (by linarith)), - ⟨finiteHomotopy X φ N f hN⟩⟩ - -@[simp] theorem finiteMap_stage (N m : ℕ) (h : m ≤ N) (f : C(A,X m)) - (hf : ∀ a, height X φ ((stage X φ m).comp f a) < (N:ℝ)+1) : - finiteMap X φ N ((stage X φ m).comp f) hf = (φ m N h).comp f := by - ext a - exact retract_stage X φ N m h (f a) (hf a) - -theorem stage_stabilize_homotopic (m N : ℕ) (h : m ≤ N) : - (stage X φ m).Homotopic ((stage X φ N).comp (φ m N h)) := by - have hh : ∀ x : X m, height X φ (stage X φ m x) ≤ N := by - intro x - change (m:ℝ) ≤ N - exact_mod_cast h - have H := finiteHomotopy X φ N (stage X φ m) hh - refine ⟨H.cast rfl ?_⟩ - apply congrArg ((stage X φ N).comp) - ext x - exact retract_stage X φ N m h x _ - -def finiteStageHomotopy {m n N : ℕ} (hm : m ≤ N) (hn : n ≤ N) - (f : C(A,X m)) (g : C(A,X n)) - (H : ((stage X φ m).comp f).Homotopy ((stage X φ n).comp g)) - (hH : ∀ z, height X φ (H z) < (N:ℝ)+1) : - ((φ m N hm).comp f).Homotopy ((φ n N hn).comp g) where - toFun z := retract X φ N ⟨H z,hH z⟩ - continuous_toFun := (retract X φ N).continuous.comp (H.continuous.subtype_mk _) - map_zero_left a := by - have ha : height X φ (stage X φ m (f a)) < (N:ℝ)+1 := by - have := hH (0,a) - simpa only [ContinuousMap.Homotopy.apply_zero,ContinuousMap.comp_apply] using this - calc - retract X φ N ⟨H (0,a),hH (0,a)⟩ = retract X φ N ⟨stage X φ m (f a),ha⟩ := - congrArg (retract X φ N) (Subtype.ext (H.map_zero_left a)) - _ = _ := retract_stage X φ N m hm (f a) ha - map_one_left a := by - have ha : height X φ (stage X φ n (g a)) < (N:ℝ)+1 := by - have := hH (1,a) - simpa only [ContinuousMap.Homotopy.apply_one,ContinuousMap.comp_apply] using this - calc - retract X φ N ⟨H (1,a),hH (1,a)⟩ = retract X φ N ⟨stage X φ n (g a),ha⟩ := - congrArg (retract X φ N) (Subtype.ext (H.map_one_left a)) - _ = _ := retract_stage X φ N n hn (g a) ha - -theorem stage_homotopic_iff [CompactSpace A] {m n : ℕ} (f : C(A,X m)) (g : C(A,X n)) : - ((stage X φ m).comp f).Homotopic ((stage X φ n).comp g) ↔ - ∃ (N : ℕ) (hm : m ≤ N) (hn : n ≤ N), ((φ m N hm).comp f).Homotopic ((φ n N hn).comp g) := by - constructor - · rintro ⟨H⟩ - obtain ⟨K,hK⟩ := exists_height_bound X φ H.toContinuousMap - let N := max K (max m n) - have hm : m ≤ N := (le_max_left m n).trans (le_max_right _ _) - have hn : n ≤ N := (le_max_right m n).trans (le_max_right _ _) - have hKN : (K:ℝ) ≤ N := by exact_mod_cast (le_max_left K (max m n)) - refine ⟨N,hm,hn,⟨finiteStageHomotopy X φ hm hn f g H ?_⟩⟩ - intro z - exact lt_of_le_of_lt ((hK z).trans hKN) (by linarith) - · rintro ⟨N,hm,hn,h⟩ - exact (((stage_stabilize_homotopic X φ m N hm).comp (ContinuousMap.Homotopic.refl f)).trans - ((ContinuousMap.Homotopic.refl (stage X φ N)).comp h)).trans - (((stage_stabilize_homotopic X φ n N hn).comp (ContinuousMap.Homotopic.refl g)).symm) - -theorem stage_nullhomotopic_iff [CompactSpace A] {m : ℕ} (f : C(A,X m)) : - ((stage X φ m).comp f).Nullhomotopic ↔ - ∃ (N : ℕ) (hm : m ≤ N), ((φ m N hm).comp f).Nullhomotopic := by - constructor - · rintro ⟨c,⟨H⟩⟩ - obtain ⟨K,hK⟩ := exists_height_bound X φ H.toContinuousMap - obtain ⟨J,hJ⟩ := exists_nat_gt (height X φ c) - let N := max K (max m J) - have hm : m ≤ N := (le_max_left m J).trans (le_max_right _ _) - have hKN : (K:ℝ) ≤ N := by exact_mod_cast (le_max_left K (max m J)) - have hJN : (J:ℝ) ≤ N := by exact_mod_cast ((le_max_right m J).trans (le_max_right K (max m J))) - have hc : height X φ c < (N:ℝ)+1 := lt_of_lt_of_le hJ (by linarith) - have hH : ∀ z, height X φ (H z) < (N:ℝ)+1 := - fun z => lt_of_le_of_lt ((hK z).trans hKN) (by linarith) - refine ⟨N,hm,retract X φ N ⟨c,hc⟩,⟨{ - toFun := fun z => retract X φ N ⟨H z,hH z⟩ - continuous_toFun := (retract X φ N).continuous.comp (H.continuous.subtype_mk _) - map_zero_left := ?_ - map_one_left := ?_ }⟩⟩ - · intro a - have ha : height X φ (stage X φ m (f a)) < (N:ℝ)+1 := by - simpa only [ContinuousMap.Homotopy.apply_zero,ContinuousMap.comp_apply] using hH (0,a) - calc - retract X φ N ⟨H (0,a),hH (0,a)⟩ = retract X φ N ⟨stage X φ m (f a),ha⟩ := - congrArg (retract X φ N) (Subtype.ext (H.map_zero_left a)) - _ = _ := retract_stage X φ N m hm (f a) ha - · intro a - exact congrArg (retract X φ N) (Subtype.ext (H.map_one_left a)) - · rintro ⟨N,hm,c,h⟩ - refine ⟨stage X φ N c,?_⟩ - exact ((stage_stabilize_homotopic X φ m N hm).comp (ContinuousMap.Homotopic.refl f)).trans - ((ContinuousMap.Homotopic.refl (stage X φ N)).comp h) - -end NearbyLagrangian.RayTelescope - -end - -noncomputable section -universe u v w - - -namespace NearbyLagrangian.RayTelescope -open ContinuousMap -variable (X : ℕ → Type u) [∀ n, TopologicalSpace (X n)] -variable (φ : ∀ m n, m ≤ n → C(X m,X n)) -variable [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] -variable [∀ n, PathConnectedSpace (X n)] - -theorem joined_base (b : X 0) (z : Space X φ) : Joined z (stage X φ 0 b) := by - obtain ⟨N,g,⟨H⟩⟩ := exists_finite_representative X φ (ContinuousMap.const Unit z) - have h₁ : Joined z (stage X φ N (g ())) := ⟨H.evalAt ()⟩ - have h₂ : Joined (stage X φ N (g ())) (stage X φ N (φ 0 N (Nat.zero_le N) b)) := - (PathConnectedSpace.joined _ _).map (stage X φ N).continuous - obtain ⟨K⟩ := stage_stabilize_homotopic X φ 0 N (Nat.zero_le N) - exact (h₁.trans h₂).trans (Joined.symm ⟨K.evalAt b⟩) - -instance pathConnected : PathConnectedSpace (Space X φ) where - nonempty := ⟨stage X φ 0 (Classical.choice inferInstance)⟩ - joined z w := (joined_base X φ (Classical.choice inferInstance) z).trans - (joined_base X φ (Classical.choice inferInstance) w).symm - -end NearbyLagrangian.RayTelescope - -end - -end OAI +import Mathlib + +namespace OAI + +/-! Sequential ray telescopes, finite-stage representatives and path connectedness. -/ + +noncomputable section +universe u v w +open Set ContinuousMap +open scoped Topology + +namespace NearbyLagrangian.RayTelescope +variable (X : ℕ → Type u) [∀ n, TopologicalSpace (X n)] +variable (φ : ∀ m n, m ≤ n → C(X m,X n)) + +abbrev Raw := Σ n, X n × {t : ℝ // (n:ℝ) ≤ t} + +inductive Glue : Raw X → Raw X → Prop + | step (n m : ℕ) (h : n ≤ m) (x : X n) (t : ℝ) (ht : (m:ℝ) ≤ t) : + Glue ⟨n,(x,⟨t,(by exact le_trans (by exact_mod_cast h) ht)⟩)⟩ + ⟨m,(φ n m h x,⟨t,ht⟩)⟩ + +abbrev Space := Quot (Glue X φ) + +def rawHeight : C(Raw X,ℝ) := + ⟨fun a => a.2.2,continuous_sigma (fun _ => continuous_subtype_val.comp continuous_snd)⟩ + +def height : C(Space X φ,ℝ) := + ⟨Quot.lift (rawHeight X) (by intro a b h; cases h; rfl), + continuous_quot_lift _ (rawHeight X).continuous⟩ + +@[simp] theorem height_quot (a : Raw X) : height X φ (Quot.mk _ a) = a.2.2 := rfl + +def bottomTime (n : ℕ) : {t : ℝ // (n:ℝ) ≤ t} := ⟨(n:ℝ),by exact le_rfl⟩ + +def stage (n : ℕ) : C(X n,Space X φ) := + ⟨fun x => Quot.mk _ ⟨n,(x,bottomTime n)⟩,by + exact continuous_quot_mk.comp (continuous_sigmaMk.comp + (continuous_id.prodMk (continuous_const : + Continuous (fun _ : X n => bottomTime n))))⟩ + +@[simp] theorem height_stage (n : ℕ) (x : X n) : height X φ (stage X φ n x) = n := rfl + +variable [∀ n, Nonempty (X n)] +variable [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] + +def rawCollapse (N : ℕ) : C(Raw X,X N) where + toFun a := if h : a.1 ≤ N then φ a.1 N h a.2.1 else Classical.choice inferInstance + continuous_toFun := continuous_sigma (fun n => by + by_cases h : n ≤ N + · simpa only [dite_eq_left h,Function.comp_def] using (φ n N h).continuous.comp continuous_fst + · simpa only [dite_eq_right h] using + (continuous_const : Continuous (fun _ : X n × {t : ℝ // (n:ℝ) ≤ t} => (Classical.choice inferInstance : X N)))) + +omit [∀ n, Nonempty (X n)] in +lemma stage_le_of_height_lt {N : ℕ} (a : Raw X) (h : rawHeight X a < (N:ℝ)+1) : a.1 ≤ N := by + have h' : (a.1:ℝ) < (N:ℝ)+1 := lt_of_le_of_lt a.2.2.2 h + have : a.1 < N+1 := by exact_mod_cast h' + omega + +lemma collapse_compatible {N : ℕ} {a b : Raw X} + (h : Quot.mk (Glue X φ) a = Quot.mk (Glue X φ) b) + (ha : rawHeight X a < (N:ℝ)+1) : rawCollapse X φ N a = rawCollapse X φ N b := by + have hrel := Quot.eqvGen_exact h + have aux : ∀ a b, Relation.EqvGen (Glue X φ) a b → + rawHeight X a = rawHeight X b ∧ + (rawHeight X a < (N:ℝ)+1 → rawCollapse X φ N a = rawCollapse X φ N b) := by + intro a b h + induction h with + | rel a b hab => + cases hab with + | step n m h x t ht => + refine ⟨rfl,fun hz => ?_⟩ + have hm : m ≤ N := stage_le_of_height_lt X ⟨m,(φ n m h x,⟨t,ht⟩)⟩ hz + have hn := h.trans hm + simp only [rawCollapse,ContinuousMap.coe_mk,dite_eq_left hn,dite_eq_left hm] + exact (DirectedSystem.map_map (f:=fun {m n} h => (φ m n h : _ → _)) h hm x).symm + | refl a => exact ⟨rfl,fun _ => rfl⟩ + | symm a b hab ih => exact ⟨ih.1.symm,fun hb => (ih.2 (ih.1.symm ▸ hb)).symm⟩ + | trans a b c hab hbc ihab ihbc => + exact ⟨ihab.1.trans ihbc.1,fun ha => (ihab.2 ha).trans (ihbc.2 (ihab.1 ▸ ha))⟩ + exact (aux a b hrel).2 ha + +abbrev Trunc (N : ℕ) := {z : Space X φ // height X φ z < (N:ℝ)+1} + +def representative (z : Space X φ) : Raw X := (Quot.mk_surjective z).choose + +omit [∀ n, Nonempty (X n)] [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] in +@[simp] theorem representative_mk (z : Space X φ) : + Quot.mk (Glue X φ) (representative X φ z) = z := (Quot.mk_surjective z).choose_spec + +def retract (N : ℕ) : C(Trunc X φ N,X N) where + toFun z := rawCollapse X φ N (representative X φ z.1) + continuous_toFun := by + let s := {z : Space X φ | height X φ z < (N:ℝ)+1} + have hs : IsOpen s := isOpen_lt (height X φ).continuous continuous_const + have hq := (isQuotientMap_quot_mk (r:=Glue X φ)).restrictPreimage_isOpen hs + apply hq.continuous_iff.mpr + change Continuous (fun a : {a : Raw X // Quot.mk (Glue X φ) a ∈ s} => + rawCollapse X φ N (representative X φ (Quot.mk _ a.1))) + have hf : (fun a : {a : Raw X // Quot.mk (Glue X φ) a ∈ s} => + rawCollapse X φ N (representative X φ (Quot.mk _ a.1))) = + fun a => rawCollapse X φ N a.1 := by + funext a + apply collapse_compatible X φ + · exact representative_mk X φ _ + · change height X φ (Quot.mk _ (representative X φ (Quot.mk _ a.1))) < _ + rw [representative_mk] + exact a.2 + rw [hf] + exact (rawCollapse X φ N).continuous.comp continuous_subtype_val + +@[simp] theorem retract_quot (N : ℕ) (a : Raw X) + (ha : rawHeight X a < (N:ℝ)+1) : + retract X φ N ⟨Quot.mk _ a,ha⟩ = rawCollapse X φ N a := by + apply collapse_compatible X φ + · exact representative_mk X φ _ + · change height X φ (Quot.mk _ (representative X φ (Quot.mk _ a))) < _ + rw [representative_mk] + exact ha + +@[simp] theorem retract_stage (N n : ℕ) (h : n ≤ N) (x : X n) + (hx : height X φ (stage X φ n x) < (N:ℝ)+1) : + retract X φ N ⟨stage X φ n x,hx⟩ = φ n N h x := by + calc + retract X φ N ⟨stage X φ n x,hx⟩ = rawCollapse X φ N ⟨n,(x,bottomTime n)⟩ := + retract_quot X φ N ⟨n,(x,bottomTime n)⟩ hx + _ = φ n N h x := by simp only [rawCollapse,ContinuousMap.coe_mk,dite_eq_left h] + +end NearbyLagrangian.RayTelescope + +end + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.RayTelescope +open Set ContinuousMap +open scoped Topology +variable (X : ℕ → Type u) [∀ n, TopologicalSpace (X n)] +variable (φ : ∀ m n, m ≤ n → C(X m,X n)) + +def raiseTime (N : ℕ) (s : unitInterval) (t : ℝ) : ℝ := t + s * (max t N-t) + +lemma le_raiseTime (N : ℕ) (s : unitInterval) (t : ℝ) : t ≤ raiseTime N s t := by + unfold raiseTime + exact le_add_of_nonneg_right (mul_nonneg s.2.1 (sub_nonneg.mpr (le_max_left _ _))) + +@[simp] theorem raiseTime_zero (N : ℕ) (t : ℝ) : raiseTime N 0 t = t := by simp [raiseTime] +@[simp] theorem raiseTime_one (N : ℕ) (t : ℝ) : raiseTime N 1 t = max t N := by simp [raiseTime] + +def cylinderRaise (N n : ℕ) : C((X n × {t : ℝ // (n:ℝ) ≤ t}) × unitInterval,Space X φ) where + toFun z := Quot.mk _ ⟨n,(z.1.1,⟨raiseTime N z.2 z.1.2, + z.1.2.2.trans (le_raiseTime _ _ _)⟩)⟩ + continuous_toFun := by + have ht : Continuous (fun z : (X n × {t : ℝ // (n:ℝ) ≤ t}) × unitInterval => raiseTime N z.2 z.1.2) := by + unfold raiseTime + fun_prop + exact continuous_quot_mk.comp (continuous_sigmaMk.comp + (continuous_fst.fst.prodMk (ht.subtype_mk _))) + +def rawRaise (N : ℕ) : C(Raw X,C(unitInterval,Space X φ)) := + ⟨fun a => (cylinderRaise X φ N a.1).curry a.2, + continuous_sigma (fun _ => (cylinderRaise X φ N _).curry.continuous)⟩ + +def raiseFamily (N : ℕ) : C(Space X φ,C(unitInterval,Space X φ)) := + ⟨Quot.lift (rawRaise X φ N) (by + intro a b h + ext s + cases h with + | step n m h x t ht => + exact Quot.sound (Glue.step n m h x (raiseTime N s t) (ht.trans (le_raiseTime _ _ _)))), + continuous_quot_lift _ (rawRaise X φ N).continuous⟩ + +@[simp] theorem raiseFamily_apply (N : ℕ) (a : Raw X) (s : unitInterval) : + raiseFamily X φ N (Quot.mk _ a) s = Quot.mk _ + ⟨a.1,(a.2.1,⟨raiseTime N s a.2.2,a.2.2.2.trans (le_raiseTime _ _ _)⟩)⟩ := rfl + +def raised (N : ℕ) : C(Space X φ,Space X φ) := + ⟨fun z => raiseFamily X φ N z 1,(continuous_eval_const (1:unitInterval)).comp + (raiseFamily X φ N).continuous⟩ + +def raiseHomotopy (N : ℕ) : (ContinuousMap.id (Space X φ)).Homotopy (raised X φ N) where + toFun z := raiseFamily X φ N z.2 z.1 + continuous_toFun := (raiseFamily X φ N).uncurry.continuous.comp continuous_swap + map_zero_left z := by + induction z using Quot.inductionOn with + | h a => + change Quot.mk _ ⟨a.1,(a.2.1,⟨raiseTime N 0 a.2.2,_⟩)⟩ = Quot.mk _ a + exact congrArg (fun t : {t : ℝ // (a.1:ℝ) ≤ t} => Quot.mk (Glue X φ) ⟨a.1,(a.2.1,t)⟩) + (Subtype.ext (raiseTime_zero N a.2.2)) + map_one_left _ := rfl + +@[simp] theorem height_raised (N : ℕ) (z : Space X φ) : + height X φ (raised X φ N z) = max (height X φ z) N := by + induction z using Quot.inductionOn with + | h a => change raiseTime N 1 a.2.2 = max (a.2.2:ℝ) N; exact raiseTime_one _ _ + +variable [∀ n, Nonempty (X n)] +variable [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] + +theorem raised_eq_stage_retract (N : ℕ) (z : Space X φ) (hz : height X φ z ≤ N) : + raised X φ N z = stage X φ N + (retract X φ N ⟨z,lt_of_le_of_lt hz (by linarith)⟩) := by + induction z using Quot.inductionOn with + | h a => + have hn : a.1 ≤ N := stage_le_of_height_lt X a (lt_of_le_of_lt hz (by linarith)) + have hr : retract X φ N ⟨Quot.mk _ a,lt_of_le_of_lt hz (by linarith)⟩ = + rawCollapse X φ N a := retract_quot X φ N a _ + rw [hr] + change Quot.mk (Glue X φ) ⟨a.1,(a.2.1,⟨raiseTime N 1 a.2.2,_⟩)⟩ = + Quot.mk (Glue X φ) ⟨N,(rawCollapse X φ N a,⟨(N:ℝ),le_rfl⟩)⟩ + have hz' : (a.2.2:ℝ) ≤ N := hz + simp only [raiseTime_one,max_eq_right hz',rawCollapse,ContinuousMap.coe_mk,dite_eq_left hn] + exact Quot.sound (Glue.step a.1 N hn a.2.1 (N:ℝ) le_rfl) + +end NearbyLagrangian.RayTelescope + +end + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.RayTelescope +open Set ContinuousMap +open scoped Topology +variable (X : ℕ → Type u) [∀ n, TopologicalSpace (X n)] +variable (φ : ∀ m n, m ≤ n → C(X m,X n)) +variable {A : Type v} [TopologicalSpace A] + +theorem exists_height_bound [CompactSpace A] (f : C(A,Space X φ)) : + ∃ N : ℕ, ∀ a, height X φ (f a) ≤ N := by + obtain ⟨r,hr⟩ := (isCompact_range ((height X φ).continuous.comp f.continuous)).bddAbove + obtain ⟨N,hN⟩ := exists_nat_gt r + exact ⟨N,fun a => le_of_lt ((hr ⟨a,rfl⟩).trans_lt hN)⟩ + +variable [∀ n, Nonempty (X n)] +variable [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] + +def finiteMap (N : ℕ) (f : C(A,Space X φ)) (hf : ∀ a, height X φ (f a) < (N:ℝ)+1) : C(A,X N) := + (retract X φ N).comp ⟨fun a => ⟨f a,hf a⟩,f.continuous.subtype_mk _⟩ + +def finiteHomotopy (N : ℕ) (f : C(A,Space X φ)) (hf : ∀ a, height X φ (f a) ≤ N) : + f.Homotopy ((stage X φ N).comp + (finiteMap X φ N f (fun a => lt_of_le_of_lt (hf a) (by linarith)))) := + ((raiseHomotopy X φ N).compContinuousMap f).cast (by ext; rfl) (by + ext a + exact raised_eq_stage_retract X φ N (f a) (hf a)) + +theorem exists_finite_representative [CompactSpace A] (f : C(A,Space X φ)) : + ∃ N : ℕ, ∃ g : C(A,X N), f.Homotopic ((stage X φ N).comp g) := by + obtain ⟨N,hN⟩ := exists_height_bound X φ f + exact ⟨N,finiteMap X φ N f (fun a => lt_of_le_of_lt (hN a) (by linarith)), + ⟨finiteHomotopy X φ N f hN⟩⟩ + +@[simp] theorem finiteMap_stage (N m : ℕ) (h : m ≤ N) (f : C(A,X m)) + (hf : ∀ a, height X φ ((stage X φ m).comp f a) < (N:ℝ)+1) : + finiteMap X φ N ((stage X φ m).comp f) hf = (φ m N h).comp f := by + ext a + exact retract_stage X φ N m h (f a) (hf a) + +theorem stage_stabilize_homotopic (m N : ℕ) (h : m ≤ N) : + (stage X φ m).Homotopic ((stage X φ N).comp (φ m N h)) := by + have hh : ∀ x : X m, height X φ (stage X φ m x) ≤ N := by + intro x + change (m:ℝ) ≤ N + exact_mod_cast h + have H := finiteHomotopy X φ N (stage X φ m) hh + refine ⟨H.cast rfl ?_⟩ + apply congrArg ((stage X φ N).comp) + ext x + exact retract_stage X φ N m h x _ + +def finiteStageHomotopy {m n N : ℕ} (hm : m ≤ N) (hn : n ≤ N) + (f : C(A,X m)) (g : C(A,X n)) + (H : ((stage X φ m).comp f).Homotopy ((stage X φ n).comp g)) + (hH : ∀ z, height X φ (H z) < (N:ℝ)+1) : + ((φ m N hm).comp f).Homotopy ((φ n N hn).comp g) where + toFun z := retract X φ N ⟨H z,hH z⟩ + continuous_toFun := (retract X φ N).continuous.comp (H.continuous.subtype_mk _) + map_zero_left a := by + have ha : height X φ (stage X φ m (f a)) < (N:ℝ)+1 := by + have := hH (0,a) + simpa only [ContinuousMap.Homotopy.apply_zero,ContinuousMap.comp_apply] using this + calc + retract X φ N ⟨H (0,a),hH (0,a)⟩ = retract X φ N ⟨stage X φ m (f a),ha⟩ := + congrArg (retract X φ N) (Subtype.ext (H.map_zero_left a)) + _ = _ := retract_stage X φ N m hm (f a) ha + map_one_left a := by + have ha : height X φ (stage X φ n (g a)) < (N:ℝ)+1 := by + have := hH (1,a) + simpa only [ContinuousMap.Homotopy.apply_one,ContinuousMap.comp_apply] using this + calc + retract X φ N ⟨H (1,a),hH (1,a)⟩ = retract X φ N ⟨stage X φ n (g a),ha⟩ := + congrArg (retract X φ N) (Subtype.ext (H.map_one_left a)) + _ = _ := retract_stage X φ N n hn (g a) ha + +theorem stage_homotopic_iff [CompactSpace A] {m n : ℕ} (f : C(A,X m)) (g : C(A,X n)) : + ((stage X φ m).comp f).Homotopic ((stage X φ n).comp g) ↔ + ∃ (N : ℕ) (hm : m ≤ N) (hn : n ≤ N), ((φ m N hm).comp f).Homotopic ((φ n N hn).comp g) := by + constructor + · rintro ⟨H⟩ + obtain ⟨K,hK⟩ := exists_height_bound X φ H.toContinuousMap + let N := max K (max m n) + have hm : m ≤ N := (le_max_left m n).trans (le_max_right _ _) + have hn : n ≤ N := (le_max_right m n).trans (le_max_right _ _) + have hKN : (K:ℝ) ≤ N := by exact_mod_cast (le_max_left K (max m n)) + refine ⟨N,hm,hn,⟨finiteStageHomotopy X φ hm hn f g H ?_⟩⟩ + intro z + exact lt_of_le_of_lt ((hK z).trans hKN) (by linarith) + · rintro ⟨N,hm,hn,h⟩ + exact (((stage_stabilize_homotopic X φ m N hm).comp (ContinuousMap.Homotopic.refl f)).trans + ((ContinuousMap.Homotopic.refl (stage X φ N)).comp h)).trans + (((stage_stabilize_homotopic X φ n N hn).comp (ContinuousMap.Homotopic.refl g)).symm) + +theorem stage_nullhomotopic_iff [CompactSpace A] {m : ℕ} (f : C(A,X m)) : + ((stage X φ m).comp f).Nullhomotopic ↔ + ∃ (N : ℕ) (hm : m ≤ N), ((φ m N hm).comp f).Nullhomotopic := by + constructor + · rintro ⟨c,⟨H⟩⟩ + obtain ⟨K,hK⟩ := exists_height_bound X φ H.toContinuousMap + obtain ⟨J,hJ⟩ := exists_nat_gt (height X φ c) + let N := max K (max m J) + have hm : m ≤ N := (le_max_left m J).trans (le_max_right _ _) + have hKN : (K:ℝ) ≤ N := by exact_mod_cast (le_max_left K (max m J)) + have hJN : (J:ℝ) ≤ N := by exact_mod_cast ((le_max_right m J).trans (le_max_right K (max m J))) + have hc : height X φ c < (N:ℝ)+1 := lt_of_lt_of_le hJ (by linarith) + have hH : ∀ z, height X φ (H z) < (N:ℝ)+1 := + fun z => lt_of_le_of_lt ((hK z).trans hKN) (by linarith) + refine ⟨N,hm,retract X φ N ⟨c,hc⟩,⟨{ + toFun := fun z => retract X φ N ⟨H z,hH z⟩ + continuous_toFun := (retract X φ N).continuous.comp (H.continuous.subtype_mk _) + map_zero_left := ?_ + map_one_left := ?_ }⟩⟩ + · intro a + have ha : height X φ (stage X φ m (f a)) < (N:ℝ)+1 := by + simpa only [ContinuousMap.Homotopy.apply_zero,ContinuousMap.comp_apply] using hH (0,a) + calc + retract X φ N ⟨H (0,a),hH (0,a)⟩ = retract X φ N ⟨stage X φ m (f a),ha⟩ := + congrArg (retract X φ N) (Subtype.ext (H.map_zero_left a)) + _ = _ := retract_stage X φ N m hm (f a) ha + · intro a + exact congrArg (retract X φ N) (Subtype.ext (H.map_one_left a)) + · rintro ⟨N,hm,c,h⟩ + refine ⟨stage X φ N c,?_⟩ + exact ((stage_stabilize_homotopic X φ m N hm).comp (ContinuousMap.Homotopic.refl f)).trans + ((ContinuousMap.Homotopic.refl (stage X φ N)).comp h) + +end NearbyLagrangian.RayTelescope + +end + +noncomputable section +universe u v w + + +namespace NearbyLagrangian.RayTelescope +open ContinuousMap +variable (X : ℕ → Type u) [∀ n, TopologicalSpace (X n)] +variable (φ : ∀ m n, m ≤ n → C(X m,X n)) +variable [DirectedSystem X (fun {m n} h => (φ m n h : _ → _))] +variable [∀ n, PathConnectedSpace (X n)] + +theorem joined_base (b : X 0) (z : Space X φ) : Joined z (stage X φ 0 b) := by + obtain ⟨N,g,⟨H⟩⟩ := exists_finite_representative X φ (ContinuousMap.const Unit z) + have h₁ : Joined z (stage X φ N (g ())) := ⟨H.evalAt ()⟩ + have h₂ : Joined (stage X φ N (g ())) (stage X φ N (φ 0 N (Nat.zero_le N) b)) := + (PathConnectedSpace.joined _ _).map (stage X φ N).continuous + obtain ⟨K⟩ := stage_stabilize_homotopic X φ 0 N (Nat.zero_le N) + exact (h₁.trans h₂).trans (Joined.symm ⟨K.evalAt b⟩) + +instance pathConnected : PathConnectedSpace (Space X φ) where + nonempty := ⟨stage X φ 0 (Classical.choice inferInstance)⟩ + joined z w := (joined_base X φ (Classical.choice inferInstance) z).trans + (joined_base X φ (Classical.choice inferInstance) w).symm + +end NearbyLagrangian.RayTelescope + +end + +end OAI diff --git a/lean/OAI/Topology/TorusCompression/Boundary.lean b/lean/OAI/Topology/TorusCompression/Boundary.lean index e1d7d0ba2532439a71480f577414a9fddfca6879..b26181a45d9e8e3cc8e2f4695a6890cb86358807 100644 --- a/lean/OAI/Topology/TorusCompression/Boundary.lean +++ b/lean/OAI/Topology/TorusCompression/Boundary.lean @@ -1,572 +1,572 @@ -import Mathlib - -namespace OAI - -/-! Boundary restoration, bundle rank bounds and elementary torus compression. -/ - -noncomputable section - -namespace TorusCompression - -open Set Metric -open scoped Classical - -abbrev Slot (t : ℕ) := Fin t → ℝ -abbrev Slots (t n : ℕ) := Fin n → Slot t - -def cubeSet (t n : ℕ) : Set (Slots t n) := {x | ∀ j, ‖x j‖ ≤ 1} -abbrev Cube (t n : ℕ) := {x : Slots t n // x ∈ cubeSet t n} - -def OnBoundary {t : ℕ} (v : Slot t) : Prop := ‖v‖ = 1 - -lemma slot_unit_ball (t : ℕ) : - {v : Slot t | ∀ i, v i ∈ Icc (-1 : ℝ) 1} = closedBall 0 1 := by - ext v - simp only [mem_ofPred_eq, mem_Icc, mem_closedBall, dist_zero_right] - rw [pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 1)] - simp only [Real.norm_eq_abs, abs_le] - -lemma onBoundary_iff_frontier {t : ℕ} (v : Slot t) : - OnBoundary v ↔ v ∈ frontier {w : Slot t | ∀ i, w i ∈ Icc (-1 : ℝ) 1} := by - rw [slot_unit_ball, frontier_closedBall _ (by norm_num : (1 : ℝ) ≠ 0)] - simp [OnBoundary] - -def support {t n : ℕ} (x : Slots t n) : Finset (Fin n) := - Finset.univ.filter (fun j => x j ≠ 0) - -def Sparse {t n : ℕ} (s : ℕ) : Set (Slots t n) := {x | (support x).card ≤ s} - -def sparseParameters (t n : ℕ) (s : ℝ) : Set (Slots t n) := - {z | (∀ j, ‖z j‖ ≤ 2) ∧ ((support z).card : ℝ) ≤ s} - -def boundarySlots {t n : ℕ} (x : Slots t n) : Finset (Fin n) := - Finset.univ.filter (fun j => OnBoundary (x j)) - -@[simp] lemma mem_support {t n : ℕ} (x : Slots t n) (j : Fin n) : - j ∈ support x ↔ x j ≠ 0 := by simp [support] - -@[simp] lemma mem_boundarySlots {t n : ℕ} (x : Slots t n) (j : Fin n) : - j ∈ boundarySlots x ↔ OnBoundary (x j) := by simp [boundarySlots] - -@[simp] lemma support_zero (t n : ℕ) : support (0 : Slots t n) = ∅ := by - ext j - simp - -lemma sparse_nonempty (t n s : ℕ) : (Sparse (t := t) (n := n) s).Nonempty := by - exact ⟨0, by simp [Sparse]⟩ - -lemma sparse_eq_union (t n s : ℕ) : - Sparse (t := t) (n := n) s = - ⋃ A : {A : Finset (Fin n) // A.card ≤ s}, - {x : Slots t n | ∀ j, j ∉ A.val → x j = 0} := by - ext x - constructor - · intro hx - refine mem_iUnion.mpr ⟨⟨support x, hx⟩, ?_⟩ - intro j hj - simpa using hj - · intro hx - obtain ⟨A, hA⟩ := mem_iUnion.mp hx - exact (Finset.card_le_card (show support x ⊆ A.val from by - intro j hj - by_contra hjA - exact (mem_support x j).mp hj (hA j hjA))).trans A.property - -lemma isClosed_sparse (t n s : ℕ) : IsClosed (Sparse (t := t) (n := n) s) := by - rw [sparse_eq_union] - apply isClosed_iUnion_of_finite - intro A - simp only [ofPred_forall] - exact isClosed_iInter fun j => isClosed_iInter fun _ => - isClosed_eq (continuous_apply j) - (continuous_const : Continuous (fun _ : Slots t n => (0 : Slot t))) - -lemma sparseParameters_eq_empty {t n : ℕ} {s : ℝ} (hs : s < 0) : - sparseParameters t n s = ∅ := by - apply Set.eq_empty_iff_forall_notMem.mpr - intro x hx - have hcard : (0 : ℝ) ≤ (support x).card := Nat.cast_nonneg _ - exact (not_le_of_gt hs) (hcard.trans hx.2) - -lemma sparseParameters_eq_inter {t n : ℕ} {s : ℝ} (hs : 0 ≤ s) : - sparseParameters t n s = closedBall (0 : Slots t n) 2 ∩ Sparse ⌊s⌋₊ := by - ext x - simp only [sparseParameters, Sparse, mem_ofPred_eq, mem_inter_iff, - mem_closedBall, dist_zero_right] - rw [pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] - exact and_congr Iff.rfl (Nat.le_floor_iff hs).symm - -lemma isCompact_sparseParameters (t n : ℕ) (s : ℝ) : - IsCompact (sparseParameters t n s) := by - by_cases hs : 0 ≤ s - · rw [sparseParameters_eq_inter hs] - exact (isCompact_closedBall (0 : Slots t n) 2).inter_right (isClosed_sparse t n ⌊s⌋₊) - · rw [sparseParameters_eq_empty (lt_of_not_ge hs)] - exact isCompact_empty - -lemma sparseParameters_eq_parameterCube {t n : ℕ} {s : ℝ} (hs : (n : ℝ) ≤ s) : - sparseParameters t n s = {z : Slots t n | ∀ j, ‖z j‖ ≤ 2} := by - ext z - refine ⟨fun hz => hz.1, fun hz => ⟨hz, ?_⟩⟩ - have hcard : (support z).card ≤ n := by - exact (Finset.card_le_card (Finset.filter_subset _ _)).trans_eq (Finset.card_fin n) - exact (Nat.cast_le.mpr hcard).trans hs - -def restorationRadius {t n : ℕ} (s : ℕ) (x : Slots t n) : ℝ := - min (1 / 2) (infDist x (Sparse s) / 2) - -lemma continuous_restorationRadius (t n s : ℕ) : - Continuous (restorationRadius (t := t) (n := n) s) := by - unfold restorationRadius - exact continuous_const.min ((continuous_infDist_pt (Sparse s)).div_const 2) - -lemma restorationRadius_pos {t n s : ℕ} {x : Slots t n} (hx : x ∉ Sparse s) : - 0 < restorationRadius s x := by - have h := (isClosed_sparse t n s).notMem_iff_infDist_pos (sparse_nonempty t n s) |>.mp hx - exact lt_min (by norm_num) (by positivity) - -lemma restorationRadius_le_half {t n s : ℕ} (x : Slots t n) : - restorationRadius s x ≤ 1 / 2 := min_le_left _ _ - -lemma restorationRadius_lt_infDist {t n s : ℕ} {x : Slots t n} - (hx : x ∉ Sparse s) : restorationRadius s x < infDist x (Sparse s) := by - have h := (isClosed_sparse t n s).notMem_iff_infDist_pos (sparse_nonempty t n s) |>.mp hx - exact (min_le_right _ _).trans_lt (by linarith) - -lemma many_large_slots {t n s : ℕ} {x : Slots t n} (hx : x ∉ Sparse s) : - s < (Finset.univ.filter (fun j => restorationRadius s x ≤ ‖x j‖)).card := by - let δ := restorationRadius s x - have hδ : 0 < δ := restorationRadius_pos hx - let A : Finset (Fin n) := Finset.univ.filter (fun j => δ ≤ ‖x j‖) - let y : Slots t n := fun j => if j ∈ A then x j else 0 - by_contra h - have hA : A.card ≤ s := Nat.le_of_not_lt h - have hy : y ∈ Sparse s := by - apply le_trans (Finset.card_le_card (show support y ⊆ A from ?_)) hA - intro j hj - by_contra hjA - have hnonzero := (mem_support y j).mp hj - exact hnonzero (by simp [y, hjA]) - have hdist : dist x y ≤ δ := by - rw [dist_eq_norm, pi_norm_le_iff_of_nonneg hδ.le] - intro j - by_cases hj : j ∈ A - · simp [y, hj, hδ.le] - · have hj' : ‖x j‖ < δ := by simpa [A] using hj - simpa [y, hj] using hj'.le - have hlt := restorationRadius_lt_infDist hx - exact not_lt_of_ge ((infDist_le_dist_of_mem hy).trans hdist) hlt - -def radial {t : ℕ} (δ : ℝ) (v : Slot t) : Slot t := - (max δ ‖v‖)⁻¹ • v - -lemma norm_radial_le_one {t : ℕ} {δ : ℝ} (hδ : 0 < δ) (v : Slot t) : - ‖radial δ v‖ ≤ 1 := by - have hden : 0 < max δ ‖v‖ := hδ.trans_le (le_max_left _ _) - rw [radial, norm_smul, Real.norm_eq_abs, abs_inv, - abs_of_pos hden, ← div_eq_inv_mul] - exact (div_le_one hden).mpr (le_max_right _ _) - -lemma radial_boundary {t : ℕ} {δ : ℝ} (hδ : 0 < δ) {v : Slot t} - (hv : δ ≤ ‖v‖) : OnBoundary (radial δ v) := by - have hn : 0 < ‖v‖ := hδ.trans_le hv - simp [OnBoundary, radial, max_eq_right hv, norm_smul, inv_mul_cancel₀ hn.ne'] - -lemma radial_fixes_boundary {t : ℕ} {δ : ℝ} (hδ : δ ≤ 1) {v : Slot t} - (hv : OnBoundary v) : radial δ v = v := by - simp [radial, show ‖v‖ = 1 from hv, max_eq_right hδ] - -def cutoff {t : ℕ} (v : Slot t) : ℝ := max 0 (4 * ‖v‖ - 3) - -def blend {t : ℕ} (v w : Slot t) : Slot t := - (1 - cutoff v) • w + cutoff v • v - -lemma cutoff_range {t : ℕ} {v : Slot t} (hv : ‖v‖ ≤ 1) : - 0 ≤ cutoff v ∧ cutoff v ≤ 1 := by - refine ⟨le_max_left _ _, max_le (by norm_num) ?_⟩ - linarith - -lemma blend_sub {t : ℕ} (v w : Slot t) : - blend v w - v = (1 - cutoff v) • (w - v) := by - simp only [blend, smul_sub, sub_smul, one_smul] - abel - -lemma norm_blend_sub_le {t : ℕ} {v w : Slot t} (hv : ‖v‖ ≤ 1) : - ‖blend v w - v‖ ≤ ‖w - v‖ := by - obtain ⟨h0, h1⟩ := cutoff_range hv - rw [blend_sub, norm_smul, Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr h1)] - exact mul_le_of_le_one_left (norm_nonneg _) (by linarith) - -lemma blend_nonzero {t : ℕ} {v w : Slot t} (hv : ‖v‖ ≤ 1) - (hvw : ‖w - v‖ < 1 / 2) (hw : w ≠ 0) : blend v w ≠ 0 := by - by_cases hχ : cutoff v = 0 - · simpa [blend, hχ] using hw - · have hχpos : 0 < cutoff v := lt_of_le_of_ne (cutoff_range hv).1 (Ne.symm hχ) - have hnorm : 3 / 4 < ‖v‖ := by - have h := (lt_max_iff.mp hχpos).resolve_left (lt_irrefl 0) - linarith - intro hzero - have h := (norm_blend_sub_le hv).trans_lt hvw - rw [hzero, zero_sub, norm_neg] at h - linarith - -lemma blend_fixes_boundary {t : ℕ} {v w : Slot t} (hv : OnBoundary v) : - blend v w = v := by - have hχ : cutoff v = 1 := by simp [cutoff, show ‖v‖ = 1 from hv]; norm_num - simp [blend, hχ] - -lemma continuous_blend {t : ℕ} : Continuous (fun p : Slot t × Slot t => blend p.1 p.2) := by - unfold blend cutoff - fun_prop - -lemma continuous_blend_of {X : Type*} [TopologicalSpace X] {t : ℕ} - {v w : X → Slot t} (hv : Continuous v) (hw : Continuous w) : - Continuous (fun x => blend (v x) (w x)) := by - have hc : Continuous (fun x => cutoff (v x)) := - continuous_const.max ((continuous_const.mul hv.norm).sub continuous_const) - exact ((continuous_const.sub hc).smul hw).add (hc.smul hv) - -theorem boundary_restoration {X : Type*} [TopologicalSpace X] - {t n s : ℕ} (f : X → Cube t n) (g : X → Slots t n) - (hf : Continuous f) (hg : Continuous g) - (havoid : ∀ x, g x ∉ Sparse s) - (hclose : ∀ x, ‖g x - (f x).val‖ < 1 / 2) : - ∃ G : X → Cube t n, Continuous G ∧ - (∀ x, s + 1 ≤ (boundarySlots (G x).val).card) ∧ - (∀ x j, OnBoundary ((f x).val j) → (G x).val j = (f x).val j) := by - let g' : X → Slots t n := fun x j => blend ((f x).val j) (g x j) - have hfj : ∀ j, Continuous (fun x => (f x).val j) := fun j => - (continuous_apply j).comp hf.subtype_val - have hgj : ∀ j, Continuous (fun x => g x j) := fun j => - (continuous_apply j).comp hg - have hg' : Continuous g' := by - apply continuous_pi - intro j - exact continuous_blend_of (hfj j) (hgj j) - have havoid' : ∀ x, g' x ∉ Sparse s := by - intro x hx - apply havoid x - apply le_trans (Finset.card_le_card (show support (g x) ⊆ support (g' x) from ?_)) hx - intro j hj - apply (mem_support _ _).mpr - apply blend_nonzero ((f x).property j) _ ((mem_support _ _).mp hj) - exact (norm_le_pi_norm (g x - (f x).val) j).trans_lt (hclose x) - let G : X → Cube t n := fun x => - ⟨fun j => radial (restorationRadius s (g' x)) (g' x j), - fun j => norm_radial_le_one (restorationRadius_pos (havoid' x)) (g' x j)⟩ - refine ⟨G, ?_, ?_, ?_⟩ - · apply Continuous.subtype_mk - apply continuous_pi - intro j - have hden : ∀ x, max (restorationRadius s (g' x)) ‖g' x j‖ ≠ 0 := by - intro x - exact ne_of_gt ((restorationRadius_pos (havoid' x)).trans_le (le_max_left _ _)) - exact (((continuous_restorationRadius t n s).comp hg').max - (((continuous_apply j).comp hg').norm)).inv₀ hden |>.smul - ((continuous_apply j).comp hg') - · intro x - apply (Nat.succ_le_of_lt (many_large_slots (havoid' x))).trans - apply Finset.card_le_card - intro j hj - exact (mem_boundarySlots _ _).mpr - (radial_boundary (restorationRadius_pos (havoid' x)) ((Finset.mem_filter.mp hj).2)) - · intro x j hj - change radial (restorationRadius s (g' x)) (blend ((f x).val j) (g x j)) = _ - rw [blend_fixes_boundary hj] - exact radial_fixes_boundary ((restorationRadius_le_half (g' x)).trans (by norm_num)) hj - -theorem boundary_restoration_of_sparseParameters {X : Type*} [TopologicalSpace X] - {t n s : ℕ} (f : X → Cube t n) (g : X → Slots t n) - (hf : Continuous f) (hg : Continuous g) - (havoid : ∀ x, g x ∉ sparseParameters t n (s : ℝ)) - (hclose : ∀ x, ‖g x - (f x).val‖ < 1 / 2) : - ∃ G : X → Cube t n, Continuous G ∧ - (∀ x, s + 1 ≤ (boundarySlots (G x).val).card) ∧ - (∀ x j, OnBoundary ((f x).val j) → (G x).val j = (f x).val j) := by - apply boundary_restoration f g hf hg ?_ hclose - intro x hx - apply havoid x - refine ⟨?_, ?_⟩ - · intro j - have hj := (norm_le_pi_norm (g x - (f x).val) j).trans_lt (hclose x) - have hfbound := (f x).property j - have hadd := norm_le_norm_sub_add (g x j) ((f x).val j) - dsimp only [Pi.sub_apply] at hj - linarith - · exact_mod_cast hx - -def torusLocus {Y : Type*} {t n : ℕ} (f : Y → Cube t n) - (L : Set (Slot t)) (Z : Set (Slots t n)) : Set (Y × Z) := - {q | ∀ j, (f q.1).val j - q.2.val j ∈ L} - -abbrev TorusLocus {Y : Type*} {t n : ℕ} (f : Y → Cube t n) - (L : Set (Slot t)) (Z : Set (Slots t n)) := ↥(torusLocus f L Z) - -def locusDifference {Y : Type*} {t n : ℕ} {f : Y → Cube t n} - {L : Set (Slot t)} {Z : Set (Slots t n)} (q : TorusLocus f L Z) : Fin n → L := - fun j => ⟨(f q.val.1).val j - q.val.2.val j, q.property j⟩ - -lemma isClosed_torusLocus {Y : Type*} [TopologicalSpace Y] {t n : ℕ} - {f : Y → Cube t n} {L : Set (Slot t)} {Z : Set (Slots t n)} - (hf : Continuous f) (hL : IsClosed L) : IsClosed (torusLocus f L Z) := by - unfold torusLocus - simp only [ofPred_forall] - apply isClosed_iInter - intro j - apply hL.preimage - have hc₁ : Continuous (fun q : Y × Z => (f q.1).val j) := - (continuous_apply j).comp (hf.subtype_val.comp continuous_fst) - have hc₂ : Continuous (fun q : Y × Z => q.2.val j) := - (continuous_apply j).comp (continuous_subtype_val.comp continuous_snd) - exact hc₁.sub hc₂ - -lemma isCompact_sparse_torusLocus {Y : Type*} [TopologicalSpace Y] [CompactSpace Y] - {t n : ℕ} {f : Y → Cube t n} {L : Set (Slot t)} - (hf : Continuous f) (hL : IsClosed L) (s : ℝ) : - IsCompact (torusLocus f L (sparseParameters t n s)) := by - let : CompactSpace (sparseParameters t n s) := - isCompact_iff_compactSpace.mp (isCompact_sparseParameters t n s) - exact (isClosed_torusLocus hf hL).isCompact - -lemma continuous_locusDifference {Y : Type*} [TopologicalSpace Y] {t n : ℕ} - {f : Y → Cube t n} {L : Set (Slot t)} {Z : Set (Slots t n)} - (hf : Continuous f) : Continuous (locusDifference (f := f) (L := L) (Z := Z)) := by - apply continuous_pi - intro j - apply Continuous.subtype_mk - have hc₁ : Continuous (fun q : TorusLocus f L Z => (f q.val.1).val j) := - (continuous_apply j).comp - (hf.subtype_val.comp (continuous_fst.comp continuous_subtype_val)) - have hc₂ : Continuous (fun q : TorusLocus f L Z => q.val.2.val j) := - (continuous_apply j).comp (continuous_subtype_val.comp - (continuous_snd.comp continuous_subtype_val)) - exact hc₁.sub hc₂ - -def slotBundleFiber {Y : Type*} {t n r : ℕ} {f : Y → Cube t n} - {L : Set (Slot t)} {Z : Set (Slots t n)} - (H : L → Submodule ℂ (Fin r → ℂ)) (q : TorusLocus f L Z) : - Submodule ℂ (Fin n → Fin r → ℂ) := - Submodule.pi univ (fun j => H (locusDifference q j)) - -@[simp] lemma mem_slotBundleFiber {Y : Type*} {t n r : ℕ} {f : Y → Cube t n} - {L : Set (Slot t)} {Z : Set (Slots t n)} (H : L → Submodule ℂ (Fin r → ℂ)) - (q : TorusLocus f L Z) (v : Fin n → Fin r → ℂ) : - v ∈ slotBundleFiber H q ↔ ∀ j, v j ∈ H (locusDifference q j) := by - simp [slotBundleFiber, Submodule.mem_pi] - -def EmbeddedTotal {B V : Type*} [AddCommGroup V] [Module ℂ V] - (E : B → Submodule ℂ V) := {q : B × V // q.2 ∈ E q.1} - -instance {B V : Type*} [TopologicalSpace B] [TopologicalSpace V] - [AddCommGroup V] [Module ℂ V] (E : B → Submodule ℂ V) : - TopologicalSpace (EmbeddedTotal E) := inferInstanceAs (TopologicalSpace {q : B × V // q.2 ∈ E q.1}) - -structure BundleMono {B V : Type*} [TopologicalSpace B] [TopologicalSpace V] - [AddCommGroup V] [Module ℂ V] (E : B → Submodule ℂ V) (K : ℕ) where - map : ∀ b, E b →ₗ[ℂ] (Fin K → ℂ) - injective : ∀ b, Function.Injective (map b) - continuous_total : Continuous (fun q : EmbeddedTotal E => map q.val.1 ⟨q.val.2, q.property⟩) - -def slotBundleFiberEquiv {Y : Type*} {t n r : ℕ} {f : Y → Cube t n} - {L : Set (Slot t)} {Z : Set (Slots t n)} - (H : L → Submodule ℂ (Fin r → ℂ)) (q : TorusLocus f L Z) : - slotBundleFiber H q ≃ₗ[ℂ] ((j : Fin n) → H (locusDifference q j)) where - toFun v j := ⟨v.val j, (mem_slotBundleFiber H q v.val).mp v.property j⟩ - invFun v := ⟨fun j => (v j).val, - (mem_slotBundleFiber H q _).mpr (fun j => (v j).property)⟩ - left_inv _ := rfl - right_inv _ := rfl - map_add' _ _ := rfl - map_smul' _ _ := rfl - -lemma finrank_slotBundleFiber {Y : Type*} {t n r p : ℕ} {f : Y → Cube t n} - {L : Set (Slot t)} {Z : Set (Slots t n)} - (H : L → Submodule ℂ (Fin r → ℂ)) (hH : ∀ l, Module.finrank ℂ (H l) = p) - (q : TorusLocus f L Z) : Module.finrank ℂ (slotBundleFiber H q) = p * n := by - rw [(slotBundleFiberEquiv H q).finrank_eq, Module.finrank_pi_fintype] - simp [hH, Nat.mul_comm] - -lemma BundleMono.finrank_le {B V : Type*} [TopologicalSpace B] [TopologicalSpace V] - [AddCommGroup V] [Module ℂ V] {E : B → Submodule ℂ V} {K : ℕ} - (M : BundleMono E K) (b : B) : Module.finrank ℂ (E b) ≤ K := by - have h := LinearMap.finrank_le_finrank_of_injective (M.injective b) - simpa using h - -theorem rank_le_target_of_nonempty_locus {Y : Type*} [TopologicalSpace Y] - {t n r p K : ℕ} {f : Y → Cube t n} - {L : Set (Slot t)} {Z : Set (Slots t n)} - (H : L → Submodule ℂ (Fin r → ℂ)) (hH : ∀ l, Module.finrank ℂ (H l) = p) - (M : BundleMono (slotBundleFiber H (f := f) (Z := Z)) K) - (hq : (torusLocus f L Z).Nonempty) : p * n ≤ K := by - obtain ⟨q, hq⟩ := hq - simpa [finrank_slotBundleFiber H hH] using M.finrank_le (⟨q, hq⟩ : TorusLocus f L Z) - -def slotIndex {u n : ℕ} (b : Fin u) (j : Fin n) : Fin (u * n) := - finProdFinEquiv (b, j) - -@[simp] lemma slotIndex_val {u n : ℕ} (b : Fin u) (j : Fin n) : - (slotIndex b j).val = b.val * n + j.val := by - simp [slotIndex, finProdFinEquiv, Nat.mul_comm, Nat.add_comm] - -def powerMap {X Y : Type*} (q : X → Y) (u : ℕ) (x : Fin u → X) : Fin u → Y := - fun b => q (x b) - -lemma continuous_powerMap {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] - {q : X → Y} (hq : Continuous q) (u : ℕ) : Continuous (powerMap q u) := by - exact continuous_pi fun b => hq.comp (continuous_apply b) - -def concatenate {X : Type*} {t n : ℕ} (f : X → Cube t n) (u : ℕ) - (x : Fin u → X) : Cube t (u * n) := - ⟨fun k => (f (x (finProdFinEquiv.symm k).1)).val (finProdFinEquiv.symm k).2, - fun k => (f (x (finProdFinEquiv.symm k).1)).property (finProdFinEquiv.symm k).2⟩ - -@[simp] lemma concatenate_slot {X : Type*} {t n : ℕ} (f : X → Cube t n) - (u : ℕ) (x : Fin u → X) (b : Fin u) (j : Fin n) : - (concatenate f u x).val (slotIndex b j) = (f (x b)).val j := by - simp only [concatenate, slotIndex, Equiv.symm_apply_apply] - -lemma boundarySlots_concatenate_sum {X : Type*} {t n : ℕ} - (f : X → Cube t n) (u : ℕ) (x : Fin u → X) : - (boundarySlots (concatenate f u x).val).card = - ∑ b : Fin u, (boundarySlots (f (x b)).val).card := by - simp only [boundarySlots, Finset.card_filter] - rw [← Equiv.sum_comp finProdFinEquiv, Fintype.sum_prod_type] - apply Finset.sum_congr rfl - intro b _ - apply Finset.sum_congr rfl - intro j _ - rw [show finProdFinEquiv (b, j) = slotIndex b j from rfl, concatenate_slot] - -lemma continuous_concatenate {X : Type*} [TopologicalSpace X] {t n : ℕ} - {f : X → Cube t n} (hf : Continuous f) (u : ℕ) : Continuous (concatenate f u) := by - apply Continuous.subtype_mk - apply continuous_pi - intro k - exact (continuous_apply (finProdFinEquiv.symm k).2).comp - (hf.subtype_val.comp (continuous_apply (finProdFinEquiv.symm k).1)) - -def IsCompression {X : Type*} [TopologicalSpace X] {t n : ℕ} - (f : X → Cube t n) (a : ℝ) (u : ℕ) (G : (Fin u → X) → Cube t (u * n)) : Prop := - Continuous G ∧ - (∀ x, (a / 8) * (u : ℝ) * (n : ℝ) ≤ ((boundarySlots (G x).val).card : ℝ)) ∧ - (∀ x b j, OnBoundary ((f (x b)).val j) → - (G x).val (slotIndex b j) = (f (x b)).val j) - -def ArbitrarilyCompresses {X : Type*} [TopologicalSpace X] {t n : ℕ} - (f : X → Cube t n) (a : ℝ) : Prop := - ∀ U : ℕ, 1 ≤ U → ∃ u : ℕ, U ≤ u ∧ - ∃ G : (Fin u → X) → Cube t (u * n), IsCompression f a u G - -theorem compression_pullback {X P : Type*} [TopologicalSpace X] [TopologicalSpace P] - {t n u : ℕ} {a : ℝ} {f : X → Cube t n} {fP : P → Cube t n} - (q : X → P) (hq : Continuous q) (hfactor : f = fP ∘ q) - {G : (Fin u → P) → Cube t (u * n)} (hG : IsCompression fP a u G) : - IsCompression f a u (G ∘ powerMap q u) := by - refine ⟨hG.1.comp (continuous_powerMap hq u), ?_, ?_⟩ - · intro x - exact hG.2.1 (powerMap q u x) - · intro x b j hx - rw [hfactor] at hx ⊢ - exact hG.2.2 (powerMap q u x) b j hx - -theorem arbitrarily_compresses_pullback {X P : Type*} - [TopologicalSpace X] [TopologicalSpace P] - {t n : ℕ} {a : ℝ} {f : X → Cube t n} {fP : P → Cube t n} - (q : X → P) (hq : Continuous q) (hfactor : f = fP ∘ q) - (hP : ArbitrarilyCompresses fP a) : ArbitrarilyCompresses f a := by - intro U hU - obtain ⟨u, hUu, G, hG⟩ := hP U hU - exact ⟨u, hUu, G ∘ powerMap q u, compression_pullback q hq hfactor hG⟩ - -theorem arbitrarily_compresses_of_isEmpty {X : Type*} [TopologicalSpace X] [IsEmpty X] - {t n : ℕ} (f : X → Cube t n) (a : ℝ) : ArbitrarilyCompresses f a := by - intro U hU - let G : (Fin U → X) → Cube t (U * n) := fun _ => ⟨0, by simp [cubeSet]⟩ - refine ⟨U, le_rfl, G, continuous_const, ?_, ?_⟩ - · intro x - exact isEmptyElim (x ⟨0, by omega⟩) - · intro x - exact isEmptyElim (x ⟨0, by omega⟩) - -lemma repeated_compression {X : Type*} [TopologicalSpace X] {t n : ℕ} - {f F : X → Cube t n} {a : ℝ} (hF : Continuous F) - (hcount : ∀ x, (a / 8) * (n : ℝ) ≤ ((boundarySlots (F x).val).card : ℝ)) - (hfix : ∀ x j, OnBoundary ((f x).val j) → (F x).val j = (f x).val j) - (u : ℕ) : IsCompression f a u (concatenate F u) := by - refine ⟨continuous_concatenate hF u, ?_, ?_⟩ - · intro x - rw [boundarySlots_concatenate_sum, Nat.cast_sum] - calc - a / 8 * (u : ℝ) * (n : ℝ) = ∑ _b : Fin u, (a / 8) * (n : ℝ) := by - simp [Finset.sum_const, mul_comm, mul_left_comm] - _ ≤ ∑ b : Fin u, ((boundarySlots (F (x b)).val).card : ℝ) := - Finset.sum_le_sum (fun b _ => hcount (x b)) - · intro x b j hj - rw [concatenate_slot] - exact hfix (x b) j hj - -theorem arbitrarily_compresses_of_empty_locus {X : Type*} [TopologicalSpace X] - {t n : ℕ} {f : X → Cube t n} {L : Set (Slot t)} {a : ℝ} - (hf : Continuous f) (ha : 0 ≤ a) (l : Slot t) (hlL : l ∈ L) (hl : ‖l‖ < 1 / 2) - (hempty : torusLocus f L (sparseParameters t n (a * (n : ℝ))) = ∅) : - ArbitrarilyCompresses f a := by - let s := ⌊a * (n : ℝ)⌋₊ - let g : X → Slots t n := fun x j => (f x).val j - l - have hg : Continuous g := hf.subtype_val.sub continuous_const - have hclose : ∀ x, ‖g x - (f x).val‖ < 1 / 2 := by - intro x - have heq : g x - (f x).val = fun _ : Fin n => -l := by - funext j - dsimp [g] - abel - rw [heq] - have hbound : ‖(fun _ : Fin n => -l)‖ ≤ ‖l‖ := by - rw [pi_norm_le_iff_of_nonneg (norm_nonneg l)] - intro j - simp - exact hbound.trans_lt hl - have havoid : ∀ x, g x ∉ sparseParameters t n (s : ℝ) := by - intro x hx - have hz : g x ∈ sparseParameters t n (a * (n : ℝ)) := - ⟨hx.1, hx.2.trans (Nat.floor_le (mul_nonneg ha (Nat.cast_nonneg n)))⟩ - have hq : (x, ⟨g x, hz⟩) ∈ torusLocus f L (sparseParameters t n (a * (n : ℝ))) := by - intro j - change (f x).val j - ((f x).val j - l) ∈ L - simpa only [sub_sub_cancel] using hlL - rw [hempty] at hq - exact hq - obtain ⟨F, hF, hcount, hfix⟩ := - boundary_restoration_of_sparseParameters f g hf hg havoid hclose - have hreal : (a / 8) * (n : ℝ) ≤ ((s + 1 : ℕ) : ℝ) := by - have h0 : 0 ≤ a * (n : ℝ) := mul_nonneg ha (Nat.cast_nonneg n) - have hfloor := Nat.lt_floor_add_one (a * (n : ℝ)) - dsimp [s] - push_cast - linarith - intro U _hU - refine ⟨U, le_rfl, concatenate F U, repeated_compression hF ?_ hfix U⟩ - intro x - exact hreal.trans (Nat.cast_le.mpr (hcount x)) - -lemma floor_batch_lower_bound {a : ℝ} {b : ℕ} (hab : 16 ≤ a * (b : ℝ)) : - 3 * a * (b : ℝ) / 16 ≤ (⌊a * (b : ℝ) / 4⌋₊ : ℝ) := by - have hfloor := Nat.lt_floor_add_one (a * (b : ℝ) / 4) - linarith - -theorem padding_boundary_fraction {a : ℝ} {b B j : ℕ} - (ha : 0 ≤ a) (hab : 16 ≤ a * (b : ℝ)) (hj : 2 * B ≤ j) : - (a / 8) * ((b * (B + j) : ℕ) : ℝ) ≤ - ((j * ⌊a * (b : ℝ) / 4⌋₊ : ℕ) : ℝ) := by - have hfloor := floor_batch_lower_bound hab - have hBj : 2 * (B : ℝ) ≤ (j : ℝ) := by exact_mod_cast hj - have hcount := mul_le_mul_of_nonneg_left hfloor (Nat.cast_nonneg j : 0 ≤ (j : ℝ)) - have hscale := mul_le_mul_of_nonneg_left hBj - (mul_nonneg ha (Nat.cast_nonneg b : 0 ≤ (b : ℝ))) - push_cast - nlinarith - -end TorusCompression - -end - -end OAI +import Mathlib + +namespace OAI + +/-! Boundary restoration, bundle rank bounds and elementary torus compression. -/ + +noncomputable section + +namespace TorusCompression + +open Set Metric +open scoped Classical + +abbrev Slot (t : ℕ) := Fin t → ℝ +abbrev Slots (t n : ℕ) := Fin n → Slot t + +def cubeSet (t n : ℕ) : Set (Slots t n) := {x | ∀ j, ‖x j‖ ≤ 1} +abbrev Cube (t n : ℕ) := {x : Slots t n // x ∈ cubeSet t n} + +def OnBoundary {t : ℕ} (v : Slot t) : Prop := ‖v‖ = 1 + +lemma slot_unit_ball (t : ℕ) : + {v : Slot t | ∀ i, v i ∈ Icc (-1 : ℝ) 1} = closedBall 0 1 := by + ext v + simp only [mem_ofPred_eq, mem_Icc, mem_closedBall, dist_zero_right] + rw [pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 1)] + simp only [Real.norm_eq_abs, abs_le] + +lemma onBoundary_iff_frontier {t : ℕ} (v : Slot t) : + OnBoundary v ↔ v ∈ frontier {w : Slot t | ∀ i, w i ∈ Icc (-1 : ℝ) 1} := by + rw [slot_unit_ball, frontier_closedBall _ (by norm_num : (1 : ℝ) ≠ 0)] + simp [OnBoundary] + +def support {t n : ℕ} (x : Slots t n) : Finset (Fin n) := + Finset.univ.filter (fun j => x j ≠ 0) + +def Sparse {t n : ℕ} (s : ℕ) : Set (Slots t n) := {x | (support x).card ≤ s} + +def sparseParameters (t n : ℕ) (s : ℝ) : Set (Slots t n) := + {z | (∀ j, ‖z j‖ ≤ 2) ∧ ((support z).card : ℝ) ≤ s} + +def boundarySlots {t n : ℕ} (x : Slots t n) : Finset (Fin n) := + Finset.univ.filter (fun j => OnBoundary (x j)) + +@[simp] lemma mem_support {t n : ℕ} (x : Slots t n) (j : Fin n) : + j ∈ support x ↔ x j ≠ 0 := by simp [support] + +@[simp] lemma mem_boundarySlots {t n : ℕ} (x : Slots t n) (j : Fin n) : + j ∈ boundarySlots x ↔ OnBoundary (x j) := by simp [boundarySlots] + +@[simp] lemma support_zero (t n : ℕ) : support (0 : Slots t n) = ∅ := by + ext j + simp + +lemma sparse_nonempty (t n s : ℕ) : (Sparse (t := t) (n := n) s).Nonempty := by + exact ⟨0, by simp [Sparse]⟩ + +lemma sparse_eq_union (t n s : ℕ) : + Sparse (t := t) (n := n) s = + ⋃ A : {A : Finset (Fin n) // A.card ≤ s}, + {x : Slots t n | ∀ j, j ∉ A.val → x j = 0} := by + ext x + constructor + · intro hx + refine mem_iUnion.mpr ⟨⟨support x, hx⟩, ?_⟩ + intro j hj + simpa using hj + · intro hx + obtain ⟨A, hA⟩ := mem_iUnion.mp hx + exact (Finset.card_le_card (show support x ⊆ A.val from by + intro j hj + by_contra hjA + exact (mem_support x j).mp hj (hA j hjA))).trans A.property + +lemma isClosed_sparse (t n s : ℕ) : IsClosed (Sparse (t := t) (n := n) s) := by + rw [sparse_eq_union] + apply isClosed_iUnion_of_finite + intro A + simp only [ofPred_forall] + exact isClosed_iInter fun j => isClosed_iInter fun _ => + isClosed_eq (continuous_apply j) + (continuous_const : Continuous (fun _ : Slots t n => (0 : Slot t))) + +lemma sparseParameters_eq_empty {t n : ℕ} {s : ℝ} (hs : s < 0) : + sparseParameters t n s = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro x hx + have hcard : (0 : ℝ) ≤ (support x).card := Nat.cast_nonneg _ + exact (not_le_of_gt hs) (hcard.trans hx.2) + +lemma sparseParameters_eq_inter {t n : ℕ} {s : ℝ} (hs : 0 ≤ s) : + sparseParameters t n s = closedBall (0 : Slots t n) 2 ∩ Sparse ⌊s⌋₊ := by + ext x + simp only [sparseParameters, Sparse, mem_ofPred_eq, mem_inter_iff, + mem_closedBall, dist_zero_right] + rw [pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] + exact and_congr Iff.rfl (Nat.le_floor_iff hs).symm + +lemma isCompact_sparseParameters (t n : ℕ) (s : ℝ) : + IsCompact (sparseParameters t n s) := by + by_cases hs : 0 ≤ s + · rw [sparseParameters_eq_inter hs] + exact (isCompact_closedBall (0 : Slots t n) 2).inter_right (isClosed_sparse t n ⌊s⌋₊) + · rw [sparseParameters_eq_empty (lt_of_not_ge hs)] + exact isCompact_empty + +lemma sparseParameters_eq_parameterCube {t n : ℕ} {s : ℝ} (hs : (n : ℝ) ≤ s) : + sparseParameters t n s = {z : Slots t n | ∀ j, ‖z j‖ ≤ 2} := by + ext z + refine ⟨fun hz => hz.1, fun hz => ⟨hz, ?_⟩⟩ + have hcard : (support z).card ≤ n := by + exact (Finset.card_le_card (Finset.filter_subset _ _)).trans_eq (Finset.card_fin n) + exact (Nat.cast_le.mpr hcard).trans hs + +def restorationRadius {t n : ℕ} (s : ℕ) (x : Slots t n) : ℝ := + min (1 / 2) (infDist x (Sparse s) / 2) + +lemma continuous_restorationRadius (t n s : ℕ) : + Continuous (restorationRadius (t := t) (n := n) s) := by + unfold restorationRadius + exact continuous_const.min ((continuous_infDist_pt (Sparse s)).div_const 2) + +lemma restorationRadius_pos {t n s : ℕ} {x : Slots t n} (hx : x ∉ Sparse s) : + 0 < restorationRadius s x := by + have h := (isClosed_sparse t n s).notMem_iff_infDist_pos (sparse_nonempty t n s) |>.mp hx + exact lt_min (by norm_num) (by positivity) + +lemma restorationRadius_le_half {t n s : ℕ} (x : Slots t n) : + restorationRadius s x ≤ 1 / 2 := min_le_left _ _ + +lemma restorationRadius_lt_infDist {t n s : ℕ} {x : Slots t n} + (hx : x ∉ Sparse s) : restorationRadius s x < infDist x (Sparse s) := by + have h := (isClosed_sparse t n s).notMem_iff_infDist_pos (sparse_nonempty t n s) |>.mp hx + exact (min_le_right _ _).trans_lt (by linarith) + +lemma many_large_slots {t n s : ℕ} {x : Slots t n} (hx : x ∉ Sparse s) : + s < (Finset.univ.filter (fun j => restorationRadius s x ≤ ‖x j‖)).card := by + let δ := restorationRadius s x + have hδ : 0 < δ := restorationRadius_pos hx + let A : Finset (Fin n) := Finset.univ.filter (fun j => δ ≤ ‖x j‖) + let y : Slots t n := fun j => if j ∈ A then x j else 0 + by_contra h + have hA : A.card ≤ s := Nat.le_of_not_lt h + have hy : y ∈ Sparse s := by + apply le_trans (Finset.card_le_card (show support y ⊆ A from ?_)) hA + intro j hj + by_contra hjA + have hnonzero := (mem_support y j).mp hj + exact hnonzero (by simp [y, hjA]) + have hdist : dist x y ≤ δ := by + rw [dist_eq_norm, pi_norm_le_iff_of_nonneg hδ.le] + intro j + by_cases hj : j ∈ A + · simp [y, hj, hδ.le] + · have hj' : ‖x j‖ < δ := by simpa [A] using hj + simpa [y, hj] using hj'.le + have hlt := restorationRadius_lt_infDist hx + exact not_lt_of_ge ((infDist_le_dist_of_mem hy).trans hdist) hlt + +def radial {t : ℕ} (δ : ℝ) (v : Slot t) : Slot t := + (max δ ‖v‖)⁻¹ • v + +lemma norm_radial_le_one {t : ℕ} {δ : ℝ} (hδ : 0 < δ) (v : Slot t) : + ‖radial δ v‖ ≤ 1 := by + have hden : 0 < max δ ‖v‖ := hδ.trans_le (le_max_left _ _) + rw [radial, norm_smul, Real.norm_eq_abs, abs_inv, + abs_of_pos hden, ← div_eq_inv_mul] + exact (div_le_one hden).mpr (le_max_right _ _) + +lemma radial_boundary {t : ℕ} {δ : ℝ} (hδ : 0 < δ) {v : Slot t} + (hv : δ ≤ ‖v‖) : OnBoundary (radial δ v) := by + have hn : 0 < ‖v‖ := hδ.trans_le hv + simp [OnBoundary, radial, max_eq_right hv, norm_smul, inv_mul_cancel₀ hn.ne'] + +lemma radial_fixes_boundary {t : ℕ} {δ : ℝ} (hδ : δ ≤ 1) {v : Slot t} + (hv : OnBoundary v) : radial δ v = v := by + simp [radial, show ‖v‖ = 1 from hv, max_eq_right hδ] + +def cutoff {t : ℕ} (v : Slot t) : ℝ := max 0 (4 * ‖v‖ - 3) + +def blend {t : ℕ} (v w : Slot t) : Slot t := + (1 - cutoff v) • w + cutoff v • v + +lemma cutoff_range {t : ℕ} {v : Slot t} (hv : ‖v‖ ≤ 1) : + 0 ≤ cutoff v ∧ cutoff v ≤ 1 := by + refine ⟨le_max_left _ _, max_le (by norm_num) ?_⟩ + linarith + +lemma blend_sub {t : ℕ} (v w : Slot t) : + blend v w - v = (1 - cutoff v) • (w - v) := by + simp only [blend, smul_sub, sub_smul, one_smul] + abel + +lemma norm_blend_sub_le {t : ℕ} {v w : Slot t} (hv : ‖v‖ ≤ 1) : + ‖blend v w - v‖ ≤ ‖w - v‖ := by + obtain ⟨h0, h1⟩ := cutoff_range hv + rw [blend_sub, norm_smul, Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr h1)] + exact mul_le_of_le_one_left (norm_nonneg _) (by linarith) + +lemma blend_nonzero {t : ℕ} {v w : Slot t} (hv : ‖v‖ ≤ 1) + (hvw : ‖w - v‖ < 1 / 2) (hw : w ≠ 0) : blend v w ≠ 0 := by + by_cases hχ : cutoff v = 0 + · simpa [blend, hχ] using hw + · have hχpos : 0 < cutoff v := lt_of_le_of_ne (cutoff_range hv).1 (Ne.symm hχ) + have hnorm : 3 / 4 < ‖v‖ := by + have h := (lt_max_iff.mp hχpos).resolve_left (lt_irrefl 0) + linarith + intro hzero + have h := (norm_blend_sub_le hv).trans_lt hvw + rw [hzero, zero_sub, norm_neg] at h + linarith + +lemma blend_fixes_boundary {t : ℕ} {v w : Slot t} (hv : OnBoundary v) : + blend v w = v := by + have hχ : cutoff v = 1 := by simp [cutoff, show ‖v‖ = 1 from hv]; norm_num + simp [blend, hχ] + +lemma continuous_blend {t : ℕ} : Continuous (fun p : Slot t × Slot t => blend p.1 p.2) := by + unfold blend cutoff + fun_prop + +lemma continuous_blend_of {X : Type*} [TopologicalSpace X] {t : ℕ} + {v w : X → Slot t} (hv : Continuous v) (hw : Continuous w) : + Continuous (fun x => blend (v x) (w x)) := by + have hc : Continuous (fun x => cutoff (v x)) := + continuous_const.max ((continuous_const.mul hv.norm).sub continuous_const) + exact ((continuous_const.sub hc).smul hw).add (hc.smul hv) + +theorem boundary_restoration {X : Type*} [TopologicalSpace X] + {t n s : ℕ} (f : X → Cube t n) (g : X → Slots t n) + (hf : Continuous f) (hg : Continuous g) + (havoid : ∀ x, g x ∉ Sparse s) + (hclose : ∀ x, ‖g x - (f x).val‖ < 1 / 2) : + ∃ G : X → Cube t n, Continuous G ∧ + (∀ x, s + 1 ≤ (boundarySlots (G x).val).card) ∧ + (∀ x j, OnBoundary ((f x).val j) → (G x).val j = (f x).val j) := by + let g' : X → Slots t n := fun x j => blend ((f x).val j) (g x j) + have hfj : ∀ j, Continuous (fun x => (f x).val j) := fun j => + (continuous_apply j).comp hf.subtype_val + have hgj : ∀ j, Continuous (fun x => g x j) := fun j => + (continuous_apply j).comp hg + have hg' : Continuous g' := by + apply continuous_pi + intro j + exact continuous_blend_of (hfj j) (hgj j) + have havoid' : ∀ x, g' x ∉ Sparse s := by + intro x hx + apply havoid x + apply le_trans (Finset.card_le_card (show support (g x) ⊆ support (g' x) from ?_)) hx + intro j hj + apply (mem_support _ _).mpr + apply blend_nonzero ((f x).property j) _ ((mem_support _ _).mp hj) + exact (norm_le_pi_norm (g x - (f x).val) j).trans_lt (hclose x) + let G : X → Cube t n := fun x => + ⟨fun j => radial (restorationRadius s (g' x)) (g' x j), + fun j => norm_radial_le_one (restorationRadius_pos (havoid' x)) (g' x j)⟩ + refine ⟨G, ?_, ?_, ?_⟩ + · apply Continuous.subtype_mk + apply continuous_pi + intro j + have hden : ∀ x, max (restorationRadius s (g' x)) ‖g' x j‖ ≠ 0 := by + intro x + exact ne_of_gt ((restorationRadius_pos (havoid' x)).trans_le (le_max_left _ _)) + exact (((continuous_restorationRadius t n s).comp hg').max + (((continuous_apply j).comp hg').norm)).inv₀ hden |>.smul + ((continuous_apply j).comp hg') + · intro x + apply (Nat.succ_le_of_lt (many_large_slots (havoid' x))).trans + apply Finset.card_le_card + intro j hj + exact (mem_boundarySlots _ _).mpr + (radial_boundary (restorationRadius_pos (havoid' x)) ((Finset.mem_filter.mp hj).2)) + · intro x j hj + change radial (restorationRadius s (g' x)) (blend ((f x).val j) (g x j)) = _ + rw [blend_fixes_boundary hj] + exact radial_fixes_boundary ((restorationRadius_le_half (g' x)).trans (by norm_num)) hj + +theorem boundary_restoration_of_sparseParameters {X : Type*} [TopologicalSpace X] + {t n s : ℕ} (f : X → Cube t n) (g : X → Slots t n) + (hf : Continuous f) (hg : Continuous g) + (havoid : ∀ x, g x ∉ sparseParameters t n (s : ℝ)) + (hclose : ∀ x, ‖g x - (f x).val‖ < 1 / 2) : + ∃ G : X → Cube t n, Continuous G ∧ + (∀ x, s + 1 ≤ (boundarySlots (G x).val).card) ∧ + (∀ x j, OnBoundary ((f x).val j) → (G x).val j = (f x).val j) := by + apply boundary_restoration f g hf hg ?_ hclose + intro x hx + apply havoid x + refine ⟨?_, ?_⟩ + · intro j + have hj := (norm_le_pi_norm (g x - (f x).val) j).trans_lt (hclose x) + have hfbound := (f x).property j + have hadd := norm_le_norm_sub_add (g x j) ((f x).val j) + dsimp only [Pi.sub_apply] at hj + linarith + · exact_mod_cast hx + +def torusLocus {Y : Type*} {t n : ℕ} (f : Y → Cube t n) + (L : Set (Slot t)) (Z : Set (Slots t n)) : Set (Y × Z) := + {q | ∀ j, (f q.1).val j - q.2.val j ∈ L} + +abbrev TorusLocus {Y : Type*} {t n : ℕ} (f : Y → Cube t n) + (L : Set (Slot t)) (Z : Set (Slots t n)) := ↥(torusLocus f L Z) + +def locusDifference {Y : Type*} {t n : ℕ} {f : Y → Cube t n} + {L : Set (Slot t)} {Z : Set (Slots t n)} (q : TorusLocus f L Z) : Fin n → L := + fun j => ⟨(f q.val.1).val j - q.val.2.val j, q.property j⟩ + +lemma isClosed_torusLocus {Y : Type*} [TopologicalSpace Y] {t n : ℕ} + {f : Y → Cube t n} {L : Set (Slot t)} {Z : Set (Slots t n)} + (hf : Continuous f) (hL : IsClosed L) : IsClosed (torusLocus f L Z) := by + unfold torusLocus + simp only [ofPred_forall] + apply isClosed_iInter + intro j + apply hL.preimage + have hc₁ : Continuous (fun q : Y × Z => (f q.1).val j) := + (continuous_apply j).comp (hf.subtype_val.comp continuous_fst) + have hc₂ : Continuous (fun q : Y × Z => q.2.val j) := + (continuous_apply j).comp (continuous_subtype_val.comp continuous_snd) + exact hc₁.sub hc₂ + +lemma isCompact_sparse_torusLocus {Y : Type*} [TopologicalSpace Y] [CompactSpace Y] + {t n : ℕ} {f : Y → Cube t n} {L : Set (Slot t)} + (hf : Continuous f) (hL : IsClosed L) (s : ℝ) : + IsCompact (torusLocus f L (sparseParameters t n s)) := by + let : CompactSpace (sparseParameters t n s) := + isCompact_iff_compactSpace.mp (isCompact_sparseParameters t n s) + exact (isClosed_torusLocus hf hL).isCompact + +lemma continuous_locusDifference {Y : Type*} [TopologicalSpace Y] {t n : ℕ} + {f : Y → Cube t n} {L : Set (Slot t)} {Z : Set (Slots t n)} + (hf : Continuous f) : Continuous (locusDifference (f := f) (L := L) (Z := Z)) := by + apply continuous_pi + intro j + apply Continuous.subtype_mk + have hc₁ : Continuous (fun q : TorusLocus f L Z => (f q.val.1).val j) := + (continuous_apply j).comp + (hf.subtype_val.comp (continuous_fst.comp continuous_subtype_val)) + have hc₂ : Continuous (fun q : TorusLocus f L Z => q.val.2.val j) := + (continuous_apply j).comp (continuous_subtype_val.comp + (continuous_snd.comp continuous_subtype_val)) + exact hc₁.sub hc₂ + +def slotBundleFiber {Y : Type*} {t n r : ℕ} {f : Y → Cube t n} + {L : Set (Slot t)} {Z : Set (Slots t n)} + (H : L → Submodule ℂ (Fin r → ℂ)) (q : TorusLocus f L Z) : + Submodule ℂ (Fin n → Fin r → ℂ) := + Submodule.pi univ (fun j => H (locusDifference q j)) + +@[simp] lemma mem_slotBundleFiber {Y : Type*} {t n r : ℕ} {f : Y → Cube t n} + {L : Set (Slot t)} {Z : Set (Slots t n)} (H : L → Submodule ℂ (Fin r → ℂ)) + (q : TorusLocus f L Z) (v : Fin n → Fin r → ℂ) : + v ∈ slotBundleFiber H q ↔ ∀ j, v j ∈ H (locusDifference q j) := by + simp [slotBundleFiber, Submodule.mem_pi] + +def EmbeddedTotal {B V : Type*} [AddCommGroup V] [Module ℂ V] + (E : B → Submodule ℂ V) := {q : B × V // q.2 ∈ E q.1} + +instance {B V : Type*} [TopologicalSpace B] [TopologicalSpace V] + [AddCommGroup V] [Module ℂ V] (E : B → Submodule ℂ V) : + TopologicalSpace (EmbeddedTotal E) := inferInstanceAs (TopologicalSpace {q : B × V // q.2 ∈ E q.1}) + +structure BundleMono {B V : Type*} [TopologicalSpace B] [TopologicalSpace V] + [AddCommGroup V] [Module ℂ V] (E : B → Submodule ℂ V) (K : ℕ) where + map : ∀ b, E b →ₗ[ℂ] (Fin K → ℂ) + injective : ∀ b, Function.Injective (map b) + continuous_total : Continuous (fun q : EmbeddedTotal E => map q.val.1 ⟨q.val.2, q.property⟩) + +def slotBundleFiberEquiv {Y : Type*} {t n r : ℕ} {f : Y → Cube t n} + {L : Set (Slot t)} {Z : Set (Slots t n)} + (H : L → Submodule ℂ (Fin r → ℂ)) (q : TorusLocus f L Z) : + slotBundleFiber H q ≃ₗ[ℂ] ((j : Fin n) → H (locusDifference q j)) where + toFun v j := ⟨v.val j, (mem_slotBundleFiber H q v.val).mp v.property j⟩ + invFun v := ⟨fun j => (v j).val, + (mem_slotBundleFiber H q _).mpr (fun j => (v j).property)⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +lemma finrank_slotBundleFiber {Y : Type*} {t n r p : ℕ} {f : Y → Cube t n} + {L : Set (Slot t)} {Z : Set (Slots t n)} + (H : L → Submodule ℂ (Fin r → ℂ)) (hH : ∀ l, Module.finrank ℂ (H l) = p) + (q : TorusLocus f L Z) : Module.finrank ℂ (slotBundleFiber H q) = p * n := by + rw [(slotBundleFiberEquiv H q).finrank_eq, Module.finrank_pi_fintype] + simp [hH, Nat.mul_comm] + +lemma BundleMono.finrank_le {B V : Type*} [TopologicalSpace B] [TopologicalSpace V] + [AddCommGroup V] [Module ℂ V] {E : B → Submodule ℂ V} {K : ℕ} + (M : BundleMono E K) (b : B) : Module.finrank ℂ (E b) ≤ K := by + have h := LinearMap.finrank_le_finrank_of_injective (M.injective b) + simpa using h + +theorem rank_le_target_of_nonempty_locus {Y : Type*} [TopologicalSpace Y] + {t n r p K : ℕ} {f : Y → Cube t n} + {L : Set (Slot t)} {Z : Set (Slots t n)} + (H : L → Submodule ℂ (Fin r → ℂ)) (hH : ∀ l, Module.finrank ℂ (H l) = p) + (M : BundleMono (slotBundleFiber H (f := f) (Z := Z)) K) + (hq : (torusLocus f L Z).Nonempty) : p * n ≤ K := by + obtain ⟨q, hq⟩ := hq + simpa [finrank_slotBundleFiber H hH] using M.finrank_le (⟨q, hq⟩ : TorusLocus f L Z) + +def slotIndex {u n : ℕ} (b : Fin u) (j : Fin n) : Fin (u * n) := + finProdFinEquiv (b, j) + +@[simp] lemma slotIndex_val {u n : ℕ} (b : Fin u) (j : Fin n) : + (slotIndex b j).val = b.val * n + j.val := by + simp [slotIndex, finProdFinEquiv, Nat.mul_comm, Nat.add_comm] + +def powerMap {X Y : Type*} (q : X → Y) (u : ℕ) (x : Fin u → X) : Fin u → Y := + fun b => q (x b) + +lemma continuous_powerMap {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + {q : X → Y} (hq : Continuous q) (u : ℕ) : Continuous (powerMap q u) := by + exact continuous_pi fun b => hq.comp (continuous_apply b) + +def concatenate {X : Type*} {t n : ℕ} (f : X → Cube t n) (u : ℕ) + (x : Fin u → X) : Cube t (u * n) := + ⟨fun k => (f (x (finProdFinEquiv.symm k).1)).val (finProdFinEquiv.symm k).2, + fun k => (f (x (finProdFinEquiv.symm k).1)).property (finProdFinEquiv.symm k).2⟩ + +@[simp] lemma concatenate_slot {X : Type*} {t n : ℕ} (f : X → Cube t n) + (u : ℕ) (x : Fin u → X) (b : Fin u) (j : Fin n) : + (concatenate f u x).val (slotIndex b j) = (f (x b)).val j := by + simp only [concatenate, slotIndex, Equiv.symm_apply_apply] + +lemma boundarySlots_concatenate_sum {X : Type*} {t n : ℕ} + (f : X → Cube t n) (u : ℕ) (x : Fin u → X) : + (boundarySlots (concatenate f u x).val).card = + ∑ b : Fin u, (boundarySlots (f (x b)).val).card := by + simp only [boundarySlots, Finset.card_filter] + rw [← Equiv.sum_comp finProdFinEquiv, Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro b _ + apply Finset.sum_congr rfl + intro j _ + rw [show finProdFinEquiv (b, j) = slotIndex b j from rfl, concatenate_slot] + +lemma continuous_concatenate {X : Type*} [TopologicalSpace X] {t n : ℕ} + {f : X → Cube t n} (hf : Continuous f) (u : ℕ) : Continuous (concatenate f u) := by + apply Continuous.subtype_mk + apply continuous_pi + intro k + exact (continuous_apply (finProdFinEquiv.symm k).2).comp + (hf.subtype_val.comp (continuous_apply (finProdFinEquiv.symm k).1)) + +def IsCompression {X : Type*} [TopologicalSpace X] {t n : ℕ} + (f : X → Cube t n) (a : ℝ) (u : ℕ) (G : (Fin u → X) → Cube t (u * n)) : Prop := + Continuous G ∧ + (∀ x, (a / 8) * (u : ℝ) * (n : ℝ) ≤ ((boundarySlots (G x).val).card : ℝ)) ∧ + (∀ x b j, OnBoundary ((f (x b)).val j) → + (G x).val (slotIndex b j) = (f (x b)).val j) + +def ArbitrarilyCompresses {X : Type*} [TopologicalSpace X] {t n : ℕ} + (f : X → Cube t n) (a : ℝ) : Prop := + ∀ U : ℕ, 1 ≤ U → ∃ u : ℕ, U ≤ u ∧ + ∃ G : (Fin u → X) → Cube t (u * n), IsCompression f a u G + +theorem compression_pullback {X P : Type*} [TopologicalSpace X] [TopologicalSpace P] + {t n u : ℕ} {a : ℝ} {f : X → Cube t n} {fP : P → Cube t n} + (q : X → P) (hq : Continuous q) (hfactor : f = fP ∘ q) + {G : (Fin u → P) → Cube t (u * n)} (hG : IsCompression fP a u G) : + IsCompression f a u (G ∘ powerMap q u) := by + refine ⟨hG.1.comp (continuous_powerMap hq u), ?_, ?_⟩ + · intro x + exact hG.2.1 (powerMap q u x) + · intro x b j hx + rw [hfactor] at hx ⊢ + exact hG.2.2 (powerMap q u x) b j hx + +theorem arbitrarily_compresses_pullback {X P : Type*} + [TopologicalSpace X] [TopologicalSpace P] + {t n : ℕ} {a : ℝ} {f : X → Cube t n} {fP : P → Cube t n} + (q : X → P) (hq : Continuous q) (hfactor : f = fP ∘ q) + (hP : ArbitrarilyCompresses fP a) : ArbitrarilyCompresses f a := by + intro U hU + obtain ⟨u, hUu, G, hG⟩ := hP U hU + exact ⟨u, hUu, G ∘ powerMap q u, compression_pullback q hq hfactor hG⟩ + +theorem arbitrarily_compresses_of_isEmpty {X : Type*} [TopologicalSpace X] [IsEmpty X] + {t n : ℕ} (f : X → Cube t n) (a : ℝ) : ArbitrarilyCompresses f a := by + intro U hU + let G : (Fin U → X) → Cube t (U * n) := fun _ => ⟨0, by simp [cubeSet]⟩ + refine ⟨U, le_rfl, G, continuous_const, ?_, ?_⟩ + · intro x + exact isEmptyElim (x ⟨0, by omega⟩) + · intro x + exact isEmptyElim (x ⟨0, by omega⟩) + +lemma repeated_compression {X : Type*} [TopologicalSpace X] {t n : ℕ} + {f F : X → Cube t n} {a : ℝ} (hF : Continuous F) + (hcount : ∀ x, (a / 8) * (n : ℝ) ≤ ((boundarySlots (F x).val).card : ℝ)) + (hfix : ∀ x j, OnBoundary ((f x).val j) → (F x).val j = (f x).val j) + (u : ℕ) : IsCompression f a u (concatenate F u) := by + refine ⟨continuous_concatenate hF u, ?_, ?_⟩ + · intro x + rw [boundarySlots_concatenate_sum, Nat.cast_sum] + calc + a / 8 * (u : ℝ) * (n : ℝ) = ∑ _b : Fin u, (a / 8) * (n : ℝ) := by + simp [Finset.sum_const, mul_comm, mul_left_comm] + _ ≤ ∑ b : Fin u, ((boundarySlots (F (x b)).val).card : ℝ) := + Finset.sum_le_sum (fun b _ => hcount (x b)) + · intro x b j hj + rw [concatenate_slot] + exact hfix (x b) j hj + +theorem arbitrarily_compresses_of_empty_locus {X : Type*} [TopologicalSpace X] + {t n : ℕ} {f : X → Cube t n} {L : Set (Slot t)} {a : ℝ} + (hf : Continuous f) (ha : 0 ≤ a) (l : Slot t) (hlL : l ∈ L) (hl : ‖l‖ < 1 / 2) + (hempty : torusLocus f L (sparseParameters t n (a * (n : ℝ))) = ∅) : + ArbitrarilyCompresses f a := by + let s := ⌊a * (n : ℝ)⌋₊ + let g : X → Slots t n := fun x j => (f x).val j - l + have hg : Continuous g := hf.subtype_val.sub continuous_const + have hclose : ∀ x, ‖g x - (f x).val‖ < 1 / 2 := by + intro x + have heq : g x - (f x).val = fun _ : Fin n => -l := by + funext j + dsimp [g] + abel + rw [heq] + have hbound : ‖(fun _ : Fin n => -l)‖ ≤ ‖l‖ := by + rw [pi_norm_le_iff_of_nonneg (norm_nonneg l)] + intro j + simp + exact hbound.trans_lt hl + have havoid : ∀ x, g x ∉ sparseParameters t n (s : ℝ) := by + intro x hx + have hz : g x ∈ sparseParameters t n (a * (n : ℝ)) := + ⟨hx.1, hx.2.trans (Nat.floor_le (mul_nonneg ha (Nat.cast_nonneg n)))⟩ + have hq : (x, ⟨g x, hz⟩) ∈ torusLocus f L (sparseParameters t n (a * (n : ℝ))) := by + intro j + change (f x).val j - ((f x).val j - l) ∈ L + simpa only [sub_sub_cancel] using hlL + rw [hempty] at hq + exact hq + obtain ⟨F, hF, hcount, hfix⟩ := + boundary_restoration_of_sparseParameters f g hf hg havoid hclose + have hreal : (a / 8) * (n : ℝ) ≤ ((s + 1 : ℕ) : ℝ) := by + have h0 : 0 ≤ a * (n : ℝ) := mul_nonneg ha (Nat.cast_nonneg n) + have hfloor := Nat.lt_floor_add_one (a * (n : ℝ)) + dsimp [s] + push_cast + linarith + intro U _hU + refine ⟨U, le_rfl, concatenate F U, repeated_compression hF ?_ hfix U⟩ + intro x + exact hreal.trans (Nat.cast_le.mpr (hcount x)) + +lemma floor_batch_lower_bound {a : ℝ} {b : ℕ} (hab : 16 ≤ a * (b : ℝ)) : + 3 * a * (b : ℝ) / 16 ≤ (⌊a * (b : ℝ) / 4⌋₊ : ℝ) := by + have hfloor := Nat.lt_floor_add_one (a * (b : ℝ) / 4) + linarith + +theorem padding_boundary_fraction {a : ℝ} {b B j : ℕ} + (ha : 0 ≤ a) (hab : 16 ≤ a * (b : ℝ)) (hj : 2 * B ≤ j) : + (a / 8) * ((b * (B + j) : ℕ) : ℝ) ≤ + ((j * ⌊a * (b : ℝ) / 4⌋₊ : ℕ) : ℝ) := by + have hfloor := floor_batch_lower_bound hab + have hBj : 2 * (B : ℝ) ≤ (j : ℝ) := by exact_mod_cast hj + have hcount := mul_le_mul_of_nonneg_left hfloor (Nat.cast_nonneg j : 0 ≤ (j : ℝ)) + have hscale := mul_le_mul_of_nonneg_left hBj + (mul_nonneg ha (Nat.cast_nonneg b : 0 ≤ (b : ℝ))) + push_cast + nlinarith + +end TorusCompression + +end + +end OAI diff --git a/lean/README.md b/lean/README.md index c1bf2cdac66483258f6ff5cb489fe34d2a3f50e2..f1ab618366051a4b3683b14ed2a0ac4bb7c620fb 100644 --- a/lean/README.md +++ b/lean/README.md @@ -1,11 +1,11 @@ -# Lean formalizations - -This directory contains Lean formalizations of some results in this repository. -They are organized in a single large library, so we recommend compiling only small portions at a time. - -See the [Comparator README](ComparatorChallenges/README.md) for more information about how to verify the results. - -## Technical note: mmap - -Compiling the entire library may fail if Linux's `vm.max_map_count` is too low. -One workaround is to build Lean with the CMake option `-DMMAP=OFF`; it may also be necessary to set the environment variable `GLIBC_TUNABLES` to `glibc.malloc.mmap_max=0:glibc.malloc.arena_max=1` when running Lean or Lake. +# Lean formalizations + +This directory contains Lean formalizations of some results in this repository. +They are organized in a single large library, so we recommend compiling only small portions at a time. + +See the [Comparator README](ComparatorChallenges/README.md) for more information about how to verify the results. + +## Technical note: mmap + +Compiling the entire library may fail if Linux's `vm.max_map_count` is too low. +One workaround is to build Lean with the CMake option `-DMMAP=OFF`; it may also be necessary to set the environment variable `GLIBC_TUNABLES` to `glibc.malloc.mmap_max=0:glibc.malloc.arena_max=1` when running Lean or Lake. diff --git a/lean/docs/027.md b/lean/docs/027.md index ba6fc87c27c81bbc2b6df01e666054d704628f3f..d5bda5f4da6a52b3727ce86e63ce5a36e40978c5 100644 --- a/lean/docs/027.md +++ b/lean/docs/027.md @@ -1,17 +1,17 @@ -# Potential integral density on curve character varieties - -The following describes the scope of the Lean formalization related to the following accompanying paper(s): - -- [Integral points on character varieties of curves](../../preprints/Integral-points-on-character-varieties-of-curves-September-25-2026/paper.pdf) - -## Scope - -The integral-density question asks whether integral points become Zariski dense in every component of a curve character variety after one finite extension of the number field. The linked formalization proves a supporting compatibility result for its marked-surface construction. Given a proper diagram with finitely many vertices, a chosen seam with maximal adjacent facet rank and a positive-genus parent, puncture data, an existing solution over a field, and a chosen boundary occurrence, the produced marked values satisfy every seam equation. - -This is conditional compatibility of the produced solution. Potential integral density, including the prescribed-boundary and all-component conclusions, remains outside the selected statement. - -## Comparator links - -| Result | Comparator statement | -| --- | --- | -| Compatibility of the produced marked solution with every seam equation | [CharacterVarietiesAllSeamsSupport.lean](../ComparatorChallenges/CharacterVarietiesAllSeamsSupport.lean) | +# Potential integral density on curve character varieties + +The following describes the scope of the Lean formalization related to the following accompanying paper(s): + +- [Integral points on character varieties of curves](../../preprints/Integral-points-on-character-varieties-of-curves-September-25-2026/paper.pdf) + +## Scope + +The integral-density question asks whether integral points become Zariski dense in every component of a curve character variety after one finite extension of the number field. The linked formalization proves a supporting compatibility result for its marked-surface construction. Given a proper diagram with finitely many vertices, a chosen seam with maximal adjacent facet rank and a positive-genus parent, puncture data, an existing solution over a field, and a chosen boundary occurrence, the produced marked values satisfy every seam equation. + +This is conditional compatibility of the produced solution. Potential integral density, including the prescribed-boundary and all-component conclusions, remains outside the selected statement. + +## Comparator links + +| Result | Comparator statement | +| --- | --- | +| Compatibility of the produced marked solution with every seam equation | [CharacterVarietiesAllSeamsSupport.lean](../ComparatorChallenges/CharacterVarietiesAllSeamsSupport.lean) | diff --git a/lean/docs/049.md b/lean/docs/049.md index 678b0faa7847d2b05d2e43f826dfb7853c496deb..2ecd18d3df9eae6b15a0d6c170e3d480e5ea891e 100644 --- a/lean/docs/049.md +++ b/lean/docs/049.md @@ -3,9 +3,12 @@ The following describes the scope of the Lean formalization related to the following accompanying paper(s): - [An explicit noncoordinate polynomial with affine three-space zero fibre](../../preprints/An-explicit-noncoordinate-polynomial-with-affine-three-space-zero-fibre-September-24-2026/paper.pdf) +- [A stable coordinate that is not a coordinate in four variables](../../preprints/A-stable-coordinate-that-is-not-a-coordinate-in-four-variables-October-5-2026/stable-coordinate-four-variables.pdf) ## Scope +The stable coordinate conjecture predicts that a polynomial that becomes a coordinate after adjoining variables was already a coordinate. The formalization gives an explicit degree-five polynomial in four complex variables that becomes a coordinate after adjoining one variable but is not a coordinate in four variables. Every fiber is isomorphic to affine three-space, yet no fiber can be carried to a coordinate hyperplane by an ambient polynomial automorphism. + The Abhyankar–Sathaye conjecture predicts that a polynomial defining an affine-space quotient must be an ambient coordinate. For every $n\ge4$, the formalized counterexample gives $F\in\mathbb C[x_1,\ldots,x_n]$ with quotient $\mathbb C[x_1,\ldots,x_n]/(F)\cong\mathbb C[y_1,\ldots,y_{n-1}]$, although $F$ is not a coordinate. A companion gives $n-1$ commuting, locally nilpotent derivations, linearly independent over the polynomial ring, whose common kernel is generated by the construction's explicit polynomial and contains no ambient coordinate. The extra $n-4$ derivations are ordinary partial derivatives in the added variables. The three-variable case is not covered. @@ -16,3 +19,4 @@ A companion gives $n-1$ commuting, locally nilpotent derivations, linearly indep | --- | --- | | Noncoordinate polynomial in every dimension at least four | [AbhyankarSathaye.lean](../ComparatorChallenges/AbhyankarSathaye.lean) | | Commuting locally nilpotent derivations | [CommutingDerivations.lean](../ComparatorChallenges/CommutingDerivations.lean) | +| Degree-five stable noncoordinate with nonrectifiable affine-space fibers | [StableCoordinateFour.lean](../ComparatorChallenges/StableCoordinateFour.lean) | diff --git a/lean/docs/066.md b/lean/docs/066.md index 3b6fba1f74d5ebc91f1e6a754482c0fcf1878ea5..bdd9af20d00812cfb60525374190704cd15bdbfa 100644 --- a/lean/docs/066.md +++ b/lean/docs/066.md @@ -1,17 +1,17 @@ -# Bounded klt complements for Fano contractions - -The following describes the scope of the Lean formalization related to the following accompanying paper(s): - -- [Uniform Cartier sections for Fano type contractions](../../preprints/Uniform-Cartier-sections-for-Fano-type-contractions-September-25-2026/Uniform-Cartier-sections-for-Fano-type-contractions-September-25-2026.pdf) - -## Scope - -The paper develops uniform Cartier sections for Fano-type contractions as a step toward bounded klt complements. The linked formalization proves a local compactness result: for positive numbers $a_i$, the chart-field retractions indexed by nonnegative weights satisfying $\sum_i a_iw_i=1$ form a compact set in the pointwise topology on the fraction field. - -The chart is built over an algebraically closed field from the localization of a polynomial ring at its origin. Its local domain is Noetherian, essentially of finite type and formally unramified over that localization, and formally étale over the polynomial ring. Uniform Cartier sections, bounded klt complements, and the paper's real-boundary and companion conclusions are outside this supporting statement. - -## Comparator links - -| Result | Comparator statement | -| --- | --- | -| Compactness of normalized chart-field retractions | [CartierChartCompactnessSupport.lean](../ComparatorChallenges/CartierChartCompactnessSupport.lean) | +# Bounded klt complements for Fano contractions + +The following describes the scope of the Lean formalization related to the following accompanying paper(s): + +- [Uniform Cartier sections for Fano type contractions](../../preprints/Uniform-Cartier-sections-for-Fano-type-contractions-September-25-2026/Uniform-Cartier-sections-for-Fano-type-contractions-September-25-2026.pdf) + +## Scope + +The paper develops uniform Cartier sections for Fano-type contractions as a step toward bounded klt complements. The linked formalization proves a local compactness result: for positive numbers $a_i$, the chart-field retractions indexed by nonnegative weights satisfying $\sum_i a_iw_i=1$ form a compact set in the pointwise topology on the fraction field. + +The chart is built over an algebraically closed field from the localization of a polynomial ring at its origin. Its local domain is Noetherian, essentially of finite type and formally unramified over that localization, and formally étale over the polynomial ring. Uniform Cartier sections, bounded klt complements, and the paper's real-boundary and companion conclusions are outside this supporting statement. + +## Comparator links + +| Result | Comparator statement | +| --- | --- | +| Compactness of normalized chart-field retractions | [CartierChartCompactnessSupport.lean](../ComparatorChallenges/CartierChartCompactnessSupport.lean) | diff --git a/lean/docs/075.md b/lean/docs/075.md index 35d1da2e624623686d8776ecc2fc4e12210e5df8..16dbe0ad7160e176b740b753caf394b6d9697b8b 100644 --- a/lean/docs/075.md +++ b/lean/docs/075.md @@ -1,16 +1,16 @@ -# The $`L\log L`$ Fourier-convergence conjecture - -The following describes the scope of the Lean formalization related to the following accompanying paper(s): - -- [Almost-everywhere Fourier convergence in L log L](../../preprints/Almost-everywhere-Fourier-convergence-in-L-log-L-September-23-2026/paper.pdf) - -## Scope - -The $L\log L$ Fourier-convergence conjecture asks whether ordinary symmetric Fourier partial sums converge almost everywhere at this integrability scale. The formalization proves this for every measurable complex-valued function on $\mathbb T=\mathbb R/(2\pi\mathbb Z)$ satisfying $\int_{\mathbb T}|f|\log(2+|f|)<\infty$. Outside one measurable null set, -$\sum_{k=-N}^{N}\widehat f(k)e^{ikx}\to f(x)$ along the full sequence $N\to\infty$. - -## Comparator links - -| Result | Comparator statement | -| --- | --- | -| Almost-everywhere convergence of full symmetric Fourier partial sums | [FourierLLogL.lean](../ComparatorChallenges/FourierLLogL.lean) | +# The $`L\log L`$ Fourier-convergence conjecture + +The following describes the scope of the Lean formalization related to the following accompanying paper(s): + +- [Almost-everywhere Fourier convergence in L log L](../../preprints/Almost-everywhere-Fourier-convergence-in-L-log-L-September-23-2026/paper.pdf) + +## Scope + +The $L\log L$ Fourier-convergence conjecture asks whether ordinary symmetric Fourier partial sums converge almost everywhere at this integrability scale. The formalization proves this for every measurable complex-valued function on $\mathbb T=\mathbb R/(2\pi\mathbb Z)$ satisfying $\int_{\mathbb T}|f|\log(2+|f|)<\infty$. Outside one measurable null set, +$\sum_{k=-N}^{N}\widehat f(k)e^{ikx}\to f(x)$ along the full sequence $N\to\infty$. + +## Comparator links + +| Result | Comparator statement | +| --- | --- | +| Almost-everywhere convergence of full symmetric Fourier partial sums | [FourierLLogL.lean](../ComparatorChallenges/FourierLLogL.lean) | diff --git a/lean/docs/103.md b/lean/docs/103.md index f4ad43ff759c31cc4c21135ef0bef6e56a6c1b20..c85d7b0179714f9221724806e0401723f4b3f042 100644 --- a/lean/docs/103.md +++ b/lean/docs/103.md @@ -1,17 +1,17 @@ -# Exact derandomization of logarithmic space: $`\mathsf L=\mathsf{RL}=\mathsf{BPL}`$ - -The following describes the scope of the Lean formalization related to the following accompanying paper(s): - -- [Exact derandomization of logarithmic space: L = RL = BPL](../../preprints/Exact-Derandomization-of-Logarithmic-Space-L-equals-RL-equals-BPL-September-23-2026/paper.pdf) - -## Scope - -The formalization proves $\mathsf L=\mathsf{RL}=\mathsf{BPL}$ for binary languages in an explicit Turing-machine model with logarithmic workspace. The randomized classes use polynomial time: $\mathsf{RL}$ never accepts a no-instance and accepts a yes-instance with probability at least $1/2$, while $\mathsf{BPL}$ has acceptance probability at least $2/3$ on yes-instances and at most $1/3$ on no-instances. Thus bounded-error randomness does not enlarge deterministic logarithmic space in this model. - -The selected theorem asserts equality of the language classes. The paper's explicit compiler and numerical running-time bounds are not separately stated in this Comparator target. - -## Comparator links - -| Result | Comparator statement | -| --- | --- | -| Exact equality of deterministic and randomized logarithmic space | [LogspaceEquality.lean](../ComparatorChallenges/LogspaceEquality.lean) | +# Exact derandomization of logarithmic space: $`\mathsf L=\mathsf{RL}=\mathsf{BPL}`$ + +The following describes the scope of the Lean formalization related to the following accompanying paper(s): + +- [Exact derandomization of logarithmic space: L = RL = BPL](../../preprints/Exact-Derandomization-of-Logarithmic-Space-L-equals-RL-equals-BPL-September-23-2026/paper.pdf) + +## Scope + +The formalization proves $\mathsf L=\mathsf{RL}=\mathsf{BPL}$ for binary languages in an explicit Turing-machine model with logarithmic workspace. The randomized classes use polynomial time: $\mathsf{RL}$ never accepts a no-instance and accepts a yes-instance with probability at least $1/2$, while $\mathsf{BPL}$ has acceptance probability at least $2/3$ on yes-instances and at most $1/3$ on no-instances. Thus bounded-error randomness does not enlarge deterministic logarithmic space in this model. + +The selected theorem asserts equality of the language classes. The paper's explicit compiler and numerical running-time bounds are not separately stated in this Comparator target. + +## Comparator links + +| Result | Comparator statement | +| --- | --- | +| Exact equality of deterministic and randomized logarithmic space | [LogspaceEquality.lean](../ComparatorChallenges/LogspaceEquality.lean) | diff --git a/lean/docs/130.md b/lean/docs/130.md index 4a105acf75c96e0e2e8b69c9b5d654b2ddfefe54..c4419a9add293ab5f0fd51c72a193238875affb3 100644 --- a/lean/docs/130.md +++ b/lean/docs/130.md @@ -3,13 +3,17 @@ The following describes the scope of the Lean formalization related to the following accompanying paper(s): - [Finite tensor savings and exact Fourier circuits](../../preprints/Finite-tensor-savings-and-exact-Fourier-circuits-September-25-2026/main.pdf) +- [An explicit power saving for the exact discrete Fourier transform](../../preprints/An-explicit-power-saving-for-the-exact-discrete-Fourier-transform-September-25-2026/main.pdf) ## Scope The formalized result gives exact discrete Fourier transforms with arbitrarily small normalized circuit cost along an unbounded sequence of lengths. For every $c>0$ and every cutoff $N_0\ge2$, some $n\ge N_0$ has a circuit computing the unnormalized DFT with fewer than $cn\log_2 n$ gates. Addition, subtraction, and multiplication by a predetermined complex scalar each cost one gate; diagonal scalings are charged. The result is subsequential, with no all-length, bounded-coefficient, conditioning, or bit-complexity claim. +A separate uniform formalization gives fixed deterministic programs for every positive length $n$, computing the canonical discrete Fourier transform and the full convolution of two length-$n$ complex vectors exactly. Their work is $O(n(\log n)^{1-10^{-13}})=o(n\log n)$, including root-order selection and scalar preparation. The chosen root of unity is supplied; the model permits exact complex arithmetic and unrestricted coefficients, while integer values and indices remain polynomially bounded in $n$. The synthesis appendix's extraction, search, and printer uniformization is outside these selected statements. + ## Comparator links | Result | Comparator statement | | --- | --- | | Subsequential savings for exact Fourier circuits | [ExactFourier.lean](../ComparatorChallenges/ExactFourier.lean) | +| Uniform exact DFT and convolution with a power saving | [UniformFourier.lean](../ComparatorChallenges/UniformFourier.lean) | diff --git a/lean/docs/137.md b/lean/docs/137.md index b07c3f163ef777c62ee6e4119fda9000567f9c94..366bdd279886f7153b40b707e9c92aa90baf05b2 100644 --- a/lean/docs/137.md +++ b/lean/docs/137.md @@ -1,17 +1,17 @@ -# One-tape time simulation in two-fifths-power space - -The following describes the scope of the Lean formalization related to the following accompanying paper(s): - -- [Simulating One-Tape Time in Two-Fifths-Power Space](../../preprints/Simulating-One-Tape-Time-in-Two-Fifths-Power-Space-September-25-2026/article.pdf) - -## Scope - -The formalization gives two-fifths-power space simulation of a fixed deterministic machine with one writable tape and finitely many read-only input heads. Heads move at most one cell per step, initial contents are independent of the time bound, and contents and input symbols must be accessible in polylogarithmic space. Given a binary time cap $T\ge2$, the simulator returns the source's finite-control outcome and halting flag using $O(T^{2/5}(\log(T+2))^C)$ space. - -A second simulator needs no time cap: on an input that halts at time $t$, it returns the halted outcome using $O((t+2)^{2/5}(\log(t+2))^C)$ space. Simulation time is unrestricted. General multitape simulation, hierarchy consequences, and bounded-space-halting results are outside these selected statements. - -## Comparator links - -| Result | Comparator statement | -| --- | --- | -| Time-capped and unknown-time one-tape simulation in two-fifths-power space | [OneTapeSpace.lean](../ComparatorChallenges/OneTapeSpace.lean) | +# One-tape time simulation in two-fifths-power space + +The following describes the scope of the Lean formalization related to the following accompanying paper(s): + +- [Simulating One-Tape Time in Two-Fifths-Power Space](../../preprints/Simulating-One-Tape-Time-in-Two-Fifths-Power-Space-September-25-2026/article.pdf) + +## Scope + +The formalization gives two-fifths-power space simulation of a fixed deterministic machine with one writable tape and finitely many read-only input heads. Heads move at most one cell per step, initial contents are independent of the time bound, and contents and input symbols must be accessible in polylogarithmic space. Given a binary time cap $T\ge2$, the simulator returns the source's finite-control outcome and halting flag using $O(T^{2/5}(\log(T+2))^C)$ space. + +A second simulator needs no time cap: on an input that halts at time $t$, it returns the halted outcome using $O((t+2)^{2/5}(\log(t+2))^C)$ space. Simulation time is unrestricted. General multitape simulation, hierarchy consequences, and bounded-space-halting results are outside these selected statements. + +## Comparator links + +| Result | Comparator statement | +| --- | --- | +| Time-capped and unknown-time one-tape simulation in two-fifths-power space | [OneTapeSpace.lean](../ComparatorChallenges/OneTapeSpace.lean) | diff --git a/lean/docs/157.md b/lean/docs/157.md index fd634db0d6debd47fae0370eb56030d1951bf679..20bff8f685912f4bbb837e4c5942e3814ba1bb7d 100644 --- a/lean/docs/157.md +++ b/lean/docs/157.md @@ -3,9 +3,14 @@ The following describes the scope of the Lean formalization related to the following accompanying paper(s): - [A linear list-coloring bound in terms of the Hadwiger number](../../preprints/A-linear-list-coloring-bound-in-terms-of-the-Hadwiger-number-September-23-2026/paper.pdf) +- [A counterexample to Hadwiger's conjecture](../../preprints/A-counterexample-to-Hadwigers-conjecture-September-23-2026/paper.pdf) ## Scope +Hadwiger's conjecture predicts $\chi(G)\le h(G)$ for every finite graph, where $h(G)$ is the largest clique-minor order. The formalization constructs arbitrarily large finite simple counterexamples with independence number at most two. For a graph on $m$ vertices it proves +$h(G)<26m/75+2/3 1`. They consequently have zero Dirichlet density, even after intersection -+with an arbitrary set of prime ideals. -+-/ -+ -+@[expose] public section -+ -+noncomputable section -+ -+open Filter NumberField Topology Set -+ -+namespace Chebotarev -+ -+variable {K : Type*} [Field K] [NumberField K] -+ -+private theorem absNorm_rpow_neg_le_intUnder_sq -+ (P : Ideal (𝓞 K)) [P.IsPrime] (hP : P ≠ ⊥) -+ (hdegree : ¬ P.absNorm.Prime) {s : ℝ} (hs : 1 < s) : -+ (P.absNorm : ℝ) ^ (-s) ≤ ((P.under ℤ).absNorm : ℝ) ^ (-(2 : ℝ)) := by -+ let : NeZero P := ⟨hP⟩ -+ have hp : (P.under ℤ).absNorm.Prime := Nat.absNorm_under_prime P -+ have : P.LiesOver (P.under ℤ) := Ideal.over_under (A := ℤ) (P := P) -+ have hpow := (Ideal.absNorm_pow_inertiaDeg (P.under ℤ) P).symm -+ have hdeg : 2 ≤ P.inertiaDeg ℤ := by -+ have hpos : 0 < P.inertiaDeg ℤ := Ideal.inertiaDeg_pos P ℤ -+ have hne : P.inertiaDeg ℤ ≠ 1 := by -+ intro h -+ apply hdegree -+ rw [hpow, h, pow_one] -+ exact hp -+ omega -+ rw [hpow, Nat.cast_pow, -+ ← Real.rpow_natCast ((P.under ℤ).absNorm : ℝ) (P.inertiaDeg ℤ), -+ ← Real.rpow_mul (by positivity)] -+ apply Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hp.one_lt.le) -+ nlinarith [mul_le_mul (show (2 : ℝ) ≤ (P.inertiaDeg ℤ : ℝ) by exact_mod_cast hdeg) -+ hs.le (by norm_num) (by positivity : (0 : ℝ) ≤ (P.inertiaDeg ℤ : ℝ))] -+ -+/-- The non-prime-norm part of any set of prime ideals has a uniform Dirichlet-series bound. -/ -+theorem primeIdealZetaSum_nonprimeNorm_le (S : Set (Ideal (𝓞 K))) {s : ℝ} (hs : 1 < s) : -+ primeIdealZetaSum {P | P ∈ S ∧ ¬ P.absNorm.Prime} s ≤ -+ (Module.finrank ℚ K : ℝ) * ∑' n : ℕ, (n : ℝ) ^ (-(2 : ℝ)) := by -+ let A := {P : Ideal (𝓞 K) // (P ∈ S ∧ ¬ P.absNorm.Prime) ∧ P.IsPrime ∧ P ≠ ⊥} -+ let B := {p : Ideal ℤ // p.IsPrime ∧ p ≠ ⊥} -+ have hunder : ∀ P : A, (P.1.under ℤ).IsPrime ∧ P.1.under ℤ ≠ ⊥ := by -+ intro P -+ let := P.2.2.1 -+ exact ⟨inferInstance, Ideal.IsIntegral.under_ne_bot ℤ P.2.2.2⟩ -+ let g : A → B := fun P => ⟨P.1.under ℤ, hunder P⟩ -+ have hfib : ∀ p : B, Finite (g ⁻¹' {p} : Set A) ∧ -+ Nat.card (g ⁻¹' {p} : Set A) ≤ Module.finrank ℚ K := by -+ intro p -+ let := p.2.1 -+ let : p.1.IsMaximal := p.2.1.isMaximal p.2.2 -+ have hmem : ∀ P : (g ⁻¹' {p} : Set A), P.1.1.IsPrime ∧ P.1.1.LiesOver p.1 := by -+ intro P -+ let := P.1.2.2.1 -+ refine ⟨P.1.2.2.1, ⟨?_⟩⟩ -+ exact (congrArg Subtype.val P.2 : P.1.1.under ℤ = p.1) ▸ -+ (Ideal.over_under (A := ℤ) (P := P.1.1)).over -+ let f : (g ⁻¹' {p} : Set A) → p.1.primesOver (𝓞 K) := fun P => ⟨P.1.1, hmem P⟩ -+ have hfinj : Function.Injective f := by -+ intro P Q h -+ apply Subtype.ext -+ apply Subtype.ext -+ exact congrArg (fun x : p.1.primesOver (𝓞 K) => x.1) h -+ let : Finite (p.1.primesOver (𝓞 K)) := -+ (IsDedekindDomain.primesOver_finite p.1 _).to_subtype -+ have hcard : Nat.card (p.1.primesOver (𝓞 K)) ≤ Module.finrank ℚ K := by -+ classical -+ let : Fintype (p.1.primesOver (𝓞 K)) := Fintype.ofFinite _ -+ calc -+ Nat.card (p.1.primesOver (𝓞 K)) = ∑ _q : p.1.primesOver (𝓞 K), (1 : ℕ) := by -+ simp [Nat.card_eq_fintype_card] -+ _ ≤ ∑ q : p.1.primesOver (𝓞 K), q.1.ramificationIdx ℤ * q.1.inertiaDeg ℤ := by -+ apply Finset.sum_le_sum -+ intro q _ -+ have : q.1.IsPrime := q.2.1 -+ exact Nat.mul_pos (Ideal.ramificationIdx_pos q.1 ℤ) (Ideal.inertiaDeg_pos q.1 ℤ) -+ _ = Module.finrank ℤ (𝓞 K) := Ideal.sum_ramification_inertia_eq_finrank p.1 (𝓞 K) -+ _ = Module.finrank ℚ K := RingOfIntegers.rank K -+ exact ⟨Finite.of_injective f hfinj, (Nat.card_le_card_of_injective f hfinj).trans hcard⟩ -+ have hnorminj : Function.Injective (fun p : B => p.1.absNorm) := by -+ intro p q h -+ change p.1.absNorm = q.1.absNorm at h -+ apply Subtype.ext -+ rw [← Int.ideal_span_absNorm_eq_self p.1, ← Int.ideal_span_absNorm_eq_self q.1, h] -+ have hnat : Summable (fun n : ℕ => (n : ℝ) ^ (-(2 : ℝ))) := -+ Real.summable_nat_rpow.mpr (by norm_num) -+ have hsum : Summable (fun p : B => (p.1.absNorm : ℝ) ^ (-(2 : ℝ))) := -+ hnat.comp_injective hnorminj -+ calc -+ primeIdealZetaSum {P | P ∈ S ∧ ¬ P.absNorm.Prime} s ≤ -+ (Module.finrank ℚ K : ℝ) * ∑' p : B, (p.1.absNorm : ℝ) ^ (-(2 : ℝ)) := by -+ apply tsum_real_comp_le_card_fibre_mul g _ _ _ -+ (summable_prime_absNorm_rpow _ hs) hsum -+ (fun _ => by positivity) (fun _ => by positivity) -+ · intro P -+ let := P.2.2.1 -+ exact absNorm_rpow_neg_le_intUnder_sq P.1 P.2.2.2 P.2.1.2 hs -+ · exact fun p => (hfib p).1 -+ · exact fun p => (hfib p).2 -+ _ ≤ (Module.finrank ℚ K : ℝ) * ∑' n : ℕ, (n : ℝ) ^ (-(2 : ℝ)) := by -+ apply mul_le_mul_of_nonneg_left _ (by positivity) -+ exact hsum.tsum_le_tsum_of_inj _ hnorminj (fun _ _ => by positivity) -+ (fun _ => le_rfl) hnat -+ -+/-- Removing prime ideals of absolute residue degree greater than one preserves density. -/ -+theorem HasDirichletDensity.primeNorm {S : Set (Ideal (𝓞 K))} {δ : ℝ} -+ (hS : HasDirichletDensity S δ) : -+ HasDirichletDensity {P | P ∈ S ∧ P.absNorm.Prime} δ := by -+ let T : Set (Ideal (𝓞 K)) := {P | P ∈ S ∧ P.absNorm.Prime} -+ let U : Set (Ideal (𝓞 K)) := {P | P ∈ S ∧ ¬ P.absNorm.Prime} -+ have hzero : HasDirichletDensity U 0 := -+ tendsto_primeIdealZetaSum_div_univ_zero_of_le_const K U _ -+ (eventually_nhdsWithin_of_forall fun s hs => primeIdealZetaSum_nonprimeNorm_le S hs) -+ have hdisjoint : Disjoint T U := by -+ rw [Set.disjoint_left] -+ exact fun _ ht hu => hu.2 ht.2 -+ have hunion : T ∪ U = S := by -+ ext P -+ simp only [T, U, Set.mem_union, Set.mem_ofPred_eq] -+ tauto -+ have h := hS.sub hzero -+ simp only [sub_zero] at h -+ apply h.congr' -+ filter_upwards [self_mem_nhdsWithin] with s hs -+ have hsum : primeIdealZetaSum S s = primeIdealZetaSum T s + primeIdealZetaSum U s := by -+ rw [← hunion, primeIdealZetaSum_union_of_disjoint hdisjoint hs] -+ rw [hsum, add_div, add_sub_cancel_right] -+ -+end Chebotarev -diff --git a/projects/Chebotarev/CebotarevDensity/Cyclotomic.lean b/projects/Chebotarev/CebotarevDensity/Cyclotomic.lean -index c0e83f4b7..7a08eb09f 100644 ---- a/projects/Chebotarev/CebotarevDensity/Cyclotomic.lean -+++ b/projects/Chebotarev/CebotarevDensity/Cyclotomic.lean -@@ -205,7 +205,7 @@ theorem character_orthogonality_cyclotomic_eq - ConjClasses.mk_eq_mk_iff_isConj.mp (hmk.trans _h) - rw [SemiconjBy, mul_comm' (c : Gal(L/K))] at hc - rw [mul_right_cancel hc, mul_inv_cancel] -- rw [sum_galoisCharacter_mul_inv_eq K L σ τ, if_pos heq] -+ rw [sum_galoisCharacter_mul_inv_eq K L σ τ, ite_eq_left heq] - - /-- Sharifi 7.2.1 character orthogonality, **non-matching case**: - when `frobeniusClass K L 𝔭 ≠ ConjClasses.mk σ`, the character sum -@@ -222,7 +222,7 @@ theorem character_orthogonality_cyclotomic_ne - have hmk : ConjClasses.mk τ = frobeniusClass K L 𝔭 := Quotient.out_eq _ - have hne : σ * τ⁻¹ ≠ 1 := fun hσ ↦ - _h <| hmk.symm.trans (congrArg ConjClasses.mk (mul_inv_eq_one.mp hσ)).symm -- rw [sum_galoisCharacter_mul_inv_eq K L σ τ, if_neg hne] -+ rw [sum_galoisCharacter_mul_inv_eq K L σ τ, ite_eq_right hne] - - /-! ### Complex-analytic core of the cyclotomic χ≠1 bound - -@@ -615,7 +615,7 @@ private theorem artinLSeries_prime_sum_bounded_of_analytic_extension - set D : Set ℂ := {s : ℂ | 1 - (Module.finrank ℚ K : ℝ)⁻¹ < s.re} with hD - have hDopen : IsOpen D := by rw [hD]; exact isOpen_lt continuous_const Complex.continuous_re - have hmemD : ∀ s : ℝ, 1 ≤ s → (s : ℂ) ∈ D := fun s hs ↦ by -- rw [hD]; simp only [Set.mem_setOf_eq, Complex.ofReal_re] -+ rw [hD]; simp only [Set.mem_ofPred_eq, Complex.ofReal_re] - have hfr : 0 < Module.finrank ℚ K := Module.finrank_pos - have : (0 : ℝ) < (Module.finrank ℚ K : ℝ)⁻¹ := by positivity - linarith -@@ -796,8 +796,8 @@ private theorem sum_charTwist_mul_twistedPrimeSum_eq - (Nat.card Gal(L/K) : ℂ) * (Ideal.absNorm 𝔭.1 : ℂ) ^ (-(s : ℂ)) else 0 := fun 𝔭 ↦ by - have := 𝔭.2.1 - by_cases h : frobeniusClass K L 𝔭.1 = ConjClasses.mk σ -- · rw [sum_charTwist_eq K L m σ 𝔭.1 𝔭.2.2 h, if_pos h] -- · rw [sum_charTwist_ne K L m σ 𝔭.1 𝔭.2.2 h, if_neg h, zero_mul] -+ · rw [sum_charTwist_eq K L m σ 𝔭.1 𝔭.2.2 h, ite_eq_left h] -+ · rw [sum_charTwist_ne K L m σ 𝔭.1 𝔭.2.2 h, ite_eq_right h, zero_mul] - have hfinj : Function.Injective - (fun 𝔭 : {𝔭 : Ideal (𝓞 K) // 𝔭 ∈ {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ - frobeniusClass K L 𝔭 = ConjClasses.mk σ} ∧ 𝔭.IsPrime ∧ 𝔭 ≠ ⊥} ↦ -@@ -812,11 +812,11 @@ private theorem sum_charTwist_mul_twistedPrimeSum_eq - (f := fun 𝔭 : {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭} ↦ - if frobeniusClass K L 𝔭.1 = ConjClasses.mk σ then (Ideal.absNorm 𝔭.1 : ℝ) ^ (-s) else 0) - ?_] -- · exact tsum_congr fun 𝔭 ↦ (if_pos 𝔭.2.1.2.2).symm -+ · exact tsum_congr fun 𝔭 ↦ (ite_eq_left 𝔭.2.1.2.2).symm - · rintro 𝔭 h𝔭 - have h : frobeniusClass K L 𝔭.1 = ConjClasses.mk σ := by - by_contra hne -- exact h𝔭 (if_neg hne) -+ exact h𝔭 (ite_eq_right hne) - exact ⟨⟨𝔭.1, ⟨𝔭.2.1, 𝔭.2.2, h⟩, 𝔭.2.1, UnramifiedIn.ne_bot K L 𝔭.2.2⟩, rfl⟩ - rw [hinterchange, tsum_congr hcollapse, hfibre, Complex.ofReal_tsum, ← tsum_mul_left] - refine tsum_congr fun 𝔭 ↦ ?_ -diff --git a/projects/Chebotarev/CebotarevDensity/CyclotomicNormResidue.lean b/projects/Chebotarev/CebotarevDensity/CyclotomicNormResidue.lean -index 4cf9574ba..1bcb85b86 100644 ---- a/projects/Chebotarev/CebotarevDensity/CyclotomicNormResidue.lean -+++ b/projects/Chebotarev/CebotarevDensity/CyclotomicNormResidue.lean -@@ -56,7 +56,7 @@ theorem cyclotomic_frobenius_acts_as_norm_power - haveI : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 hP - ∀ ζ : L, ζ ∈ primitiveRoots m L → - arithFrobAt (𝓞 K) Gal(L/K) 𝔓 ζ = ζ ^ Ideal.absNorm 𝔭 := by -- haveI : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 hP -+ have : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 hP - intro ζ hζmem - set φ := arithFrobAt (𝓞 K) Gal(L/K) 𝔓 - have hζ : IsPrimitiveRoot ζ m := (mem_primitiveRoots (NeZero.pos m)).mp hζmem -@@ -64,9 +64,8 @@ theorem cyclotomic_frobenius_acts_as_norm_power - have hzc : (algebraMap (𝓞 L) L) z = ζ := rfl - have hzpow : z ^ m = 1 := hζ.toInteger_isPrimitiveRoot.pow_eq_one - set q := Ideal.absNorm 𝔭 -- have h𝔭ne : 𝔭 ≠ ⊥ := UnramifiedIn.ne_bot K L hunr - have hcopP : (Ideal.absNorm 𝔓).Coprime m := by -- rw [Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver 𝔓 𝔭 ‹𝔭.IsPrime› h𝔭ne] -+ rw [← Ideal.absNorm_pow_inertiaDeg 𝔭 𝔓] - exact Nat.Coprime.pow_left _ hcop - have hN1 : Ideal.absNorm 𝔓 ≠ 1 := fun h ↦ ‹𝔓.IsPrime›.ne_top (Ideal.absNorm_eq_one_iff.mp h) - have hmnotmem : (m : 𝓞 L) ∉ 𝔓 := by -@@ -92,7 +91,6 @@ private theorem pow_natModEq_of_pow_eq {S : Type*} [CommRing S] [IsDomain S] {μ - [NeZero n] (hμ : IsPrimitiveRoot μ n) {a b : ℕ} (h : μ ^ a = μ ^ b) : a ≡ b [MOD n] := - hμ.eq_orderOf ▸ (hμ.isOfFinOrder (NeZero.ne n)).pow_eq_pow_iff_modEq.mp h - --set_option backward.isDefEq.respectTransparency false in - /-- **The cyclotomic Frobenius is the norm residue** (multiplicative form). For `L = K(μ_m)`, - a primitive `m`-th root `ζ` of unity in `L`, and a prime `𝔭` of `K` unramified in `L` with - `N𝔭` coprime to `m`, the cyclotomic character `IsPrimitiveRoot.autToPow` sends the Frobenius -@@ -105,15 +103,16 @@ theorem autToPow_frobeniusClass_out - hζ.autToPow K ((frobeniusClass K L 𝔭).out : L ≃ₐ[K] L) = - ZMod.unitOfCoprime (Ideal.absNorm 𝔭) hcop := by - obtain ⟨𝔓, h𝔓prime, h𝔓lo, _⟩ := exists_prime_liesOver K L 𝔭 (UnramifiedIn.ne_bot K L hunr) -- haveI := h𝔓prime -- haveI := h𝔓lo -- haveI : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 h𝔓lo -+ have := h𝔓prime -+ have := h𝔓lo -+ have : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 h𝔓lo - set φ : L ≃ₐ[K] L := arithFrobAt (𝓞 K) Gal(L/K) 𝔓 - have hclass : frobeniusClass K L 𝔭 = ConjClasses.mk φ := - frobeniusClass_eq_mk_of_isArithFrobAt K L 𝔭 hunr φ 𝔓 - (IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) 𝔓) h𝔓lo - have hconj : IsConj ((frobeniusClass K L 𝔭).out) φ := by -- rw [← ConjClasses.mk_eq_mk_iff_isConj, ← hclass, ConjClasses.mk, Quotient.out_eq] -+ apply ConjClasses.mk_eq_mk_iff_isConj.mp -+ exact (Quotient.out_eq (frobeniusClass K L 𝔭)).trans hclass - rw [isConj_iff_eq.mp ((hζ.autToPow K).map_isConj hconj)] - have hact : φ ζ = ζ ^ Ideal.absNorm 𝔭 := - cyclotomic_frobenius_acts_as_norm_power K L m 𝔭 hunr hcop 𝔓 h𝔓lo ζ -@@ -145,7 +144,7 @@ private theorem smul_algebraMap_eq - (σ : L ≃ₐ[K] L) (y : 𝓞 F) : - haveI : IsScalarTower K F L := F.isScalarTower_mid' - σ • (algebraMap (𝓞 F) (𝓞 L) y) = algebraMap (𝓞 F) (𝓞 L) ((σ.restrictNormal F) • y) := by -- haveI : IsScalarTower K F L := F.isScalarTower_mid' -+ have : IsScalarTower K F L := F.isScalarTower_mid' - have hbridgeL : ∀ (g : L ≃ₐ[K] L) (x : 𝓞 L), ((g • x : 𝓞 L) : L) = g • (x : L) := fun g x ↦ - by simpa [Algebra.smul_def] using - (smul_distrib_smul (G := L ≃ₐ[K] L) (R := 𝓞 L) (S := L) g x 1).symm -@@ -173,7 +172,7 @@ private theorem isArithFrobAt_restrictNormal - (𝔓 : Ideal (𝓞 L)) (hσ : IsArithFrobAt (𝓞 K) σ 𝔓) : - haveI : IsScalarTower K F L := F.isScalarTower_mid' - IsArithFrobAt (𝓞 K) (σ.restrictNormal F) (𝔓.under (𝓞 F)) := by -- haveI : IsScalarTower K F L := F.isScalarTower_mid' -+ have : IsScalarTower K F L := F.isScalarTower_mid' - intro y - rw [Ideal.under_under 𝔓, Ideal.under, Ideal.mem_comap, map_sub, map_pow, - show (MulSemiringAction.toAlgHom (𝓞 K) (𝓞 F) (σ.restrictNormal F)) y -@@ -188,21 +187,20 @@ private theorem unramifiedIn_intermediateField - (F : IntermediateField K L) [IsGalois K F] - (𝔭 : Ideal (𝓞 K)) (hunr : UnramifiedIn K L 𝔭) : - UnramifiedIn K (↥F) 𝔭 := by -- haveI : IsScalarTower K F L := F.isScalarTower_mid' -- haveI : IsScalarTower (𝓞 K) (𝓞 F) (𝓞 L) := inferInstance -+ have : IsScalarTower K F L := F.isScalarTower_mid' -+ have : IsScalarTower (𝓞 K) (𝓞 F) (𝓞 L) := inferInstance - refine ⟨hunr.1, fun 𝔮 h𝔮max h𝔮lo ↦ ?_⟩ -- haveI := h𝔮lo -- haveI := h𝔮max.isPrime -+ have := h𝔮lo -+ have := h𝔮max.isPrime - obtain ⟨𝔓, h𝔓prime, h𝔓lo, -⟩ := exists_prime_liesOver (↥F) L 𝔮 - (Ideal.ne_bot_of_liesOver_of_ne_bot hunr.1 𝔮) -- haveI := h𝔓prime -- haveI := h𝔓lo -- haveI : 𝔓.LiesOver 𝔭 := ⟨by rw [← Ideal.under_under (B := 𝓞 F) 𝔓, h𝔓lo.over.symm, h𝔮lo.over.symm]⟩ -- haveI : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := -+ have := h𝔓prime -+ have := h𝔓lo -+ have : 𝔓.LiesOver 𝔭 := ⟨by rw [← Ideal.under_under (B := 𝓞 F) 𝔓, h𝔓lo.over.symm, h𝔮lo.over.symm]⟩ -+ have : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := - hunr.2 𝔓 (h𝔓prime.isMaximal (Ideal.ne_bot_of_liesOver_of_ne_bot hunr.1 𝔓)) inferInstance - exact Algebra.IsUnramifiedAt.of_liesOver (𝓞 K) 𝔮 𝔓 - --set_option backward.isDefEq.respectTransparency false in - /-- **Step (A): a Frobenius-trivial prime splits completely.** For `F = fixedField H` with `H` - abelian (hence normal) and a nonzero prime `𝔭` of `𝓞 K` unramified in `L` whose Frobenius - representative lies in `H`, the `F`-Frobenius class of `𝔭` is trivial: `frobeniusClass K F 𝔭 = [1]`. -@@ -220,19 +218,20 @@ private theorem frobeniusClass_fixedField_eq_one - IsGalois.of_fixedField_normal_subgroup H - frobeniusClass K (↥(IntermediateField.fixedField H)) 𝔭 = ConjClasses.mk 1 := by - set F := IntermediateField.fixedField H with hF -- haveI : IsScalarTower K F L := F.isScalarTower_mid' -- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -- haveI : NumberField F := NumberField.of_intermediateField F -+ have : IsScalarTower K F L := F.isScalarTower_mid' -+ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -+ have : NumberField F := NumberField.of_intermediateField F - obtain ⟨𝔓, h𝔓p, h𝔓lo, -⟩ := exists_prime_liesOver K L 𝔭 (UnramifiedIn.ne_bot K L hunr) -- haveI := h𝔓p -- haveI := h𝔓lo -- haveI : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 h𝔓lo -+ have := h𝔓p -+ have := h𝔓lo -+ have : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 h𝔓lo - set σ : L ≃ₐ[K] L := arithFrobAt (𝓞 K) Gal(L/K) 𝔓 - have hclass : frobeniusClass K L 𝔭 = ConjClasses.mk σ := - frobeniusClass_eq_mk_of_isArithFrobAt K L 𝔭 hunr σ 𝔓 - (IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) 𝔓) h𝔓lo - have hconj : IsConj σ ((frobeniusClass K L 𝔭).out) := by -- rw [← ConjClasses.mk_eq_mk_iff_isConj, hclass.symm, ConjClasses.mk, Quotient.out_eq] -+ apply ConjClasses.mk_eq_mk_iff_isConj.mp -+ exact hclass.symm.trans (Quotient.out_eq (frobeniusClass K L 𝔭)).symm - have hσeq : σ = (frobeniusClass K L 𝔭).out := by - obtain ⟨c, hc⟩ := hconj - rw [SemiconjBy, mul_comm' (c : Gal(L/K)) σ] at hc -@@ -244,7 +243,7 @@ private theorem frobeniusClass_fixedField_eq_one - MonoidHom.mem_ker.mp <| (IntermediateField.restrictNormalHom_ker F).ge hσfix - have h𝔮lo : (𝔓.under (𝓞 F)).LiesOver 𝔭 := - ⟨by rw [← Ideal.under_under (B := 𝓞 F) 𝔓]; exact h𝔓lo.over⟩ -- haveI := h𝔮lo -+ have := h𝔮lo - have hfrobF : IsArithFrobAt (𝓞 K) (σ.restrictNormal F) (𝔓.under (𝓞 F)) := - isArithFrobAt_restrictNormal K L F σ 𝔓 (IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) 𝔓) - rw [frobeniusClass_eq_mk_of_isArithFrobAt K (↥F) 𝔭 (unramifiedIn_intermediateField K L F 𝔭 hunr) -@@ -267,14 +266,14 @@ private theorem finrank_residue_fixedField_eq_one - ∀ 𝔮 : Ideal (𝓞 ↥(IntermediateField.fixedField H)), 𝔮.IsPrime → 𝔮.LiesOver 𝔭 → - Module.finrank (𝓞 K ⧸ 𝔮.under (𝓞 K)) (𝓞 ↥(IntermediateField.fixedField H) ⧸ 𝔮) = 1 := by - set F := IntermediateField.fixedField H -- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -- haveI : NumberField F := NumberField.of_intermediateField F -+ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -+ have : NumberField F := NumberField.of_intermediateField F - have hunrF : UnramifiedIn K (↥F) 𝔭 := unramifiedIn_intermediateField K L F 𝔭 hunr - have hfc : frobeniusClass K (↥F) 𝔭 = ConjClasses.mk (1 : Gal(↥F/K)) := - frobeniusClass_fixedField_eq_one K L H 𝔭 hunr hmem - intro 𝔮 h𝔮p h𝔮lo -- haveI := h𝔮p -- haveI := h𝔮lo -+ have := h𝔮p -+ have := h𝔮lo - rw [finrank_residue_eq_orderOf K (↥F) (1 : Gal(↥F/K)) (ConjClasses.mk 1) rfl 𝔭 hunrF hfc 𝔮 - h𝔮lo, orderOf_one] - -@@ -291,13 +290,13 @@ private theorem card_primesOver_fixedField_eq_finrank - 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭 ∧ 𝔮 ≠ ⊥} = - Module.finrank K ↥(IntermediateField.fixedField H) := by - set F := IntermediateField.fixedField H -- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -- haveI : NumberField F := NumberField.of_intermediateField F -+ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -+ have : NumberField F := NumberField.of_intermediateField F - have hunrF : UnramifiedIn K (↥F) 𝔭 := unramifiedIn_intermediateField K L F 𝔭 hunr - have hresdeg := finrank_residue_fixedField_eq_one K L H 𝔭 hunr hmem - obtain ⟨𝔮₀, h𝔮₀p, h𝔮₀lo, -⟩ := exists_prime_liesOver K (↥F) 𝔭 (UnramifiedIn.ne_bot K L hunr) -- haveI := h𝔮₀p -- haveI := h𝔮₀lo -+ have := h𝔮₀p -+ have := h𝔮₀lo - have hcard := card_primesAbove_mul_finrank_eq K (↥F) 𝔭 hunrF 𝔮₀ h𝔮₀lo - rw [hresdeg 𝔮₀ h𝔮₀p h𝔮₀lo, mul_one] at hcard - rw [hcard, IsGalois.card_aut_eq_finrank K (↥F)] -@@ -318,18 +317,19 @@ private theorem absNorm_eq_of_liesOver_fixedField - ∀ 𝔮 : Ideal (𝓞 ↥(IntermediateField.fixedField H)), 𝔮.IsPrime → 𝔮.LiesOver 𝔭 → - Ideal.absNorm 𝔮 = Ideal.absNorm 𝔭 := by - set F := IntermediateField.fixedField H -- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -- haveI : NumberField F := NumberField.of_intermediateField F -+ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -+ have : NumberField F := NumberField.of_intermediateField F - have hresdeg := finrank_residue_fixedField_eq_one K L H 𝔭 hunr hmem - intro 𝔮 h𝔮p h𝔮lo -- haveI := h𝔮p -- haveI := h𝔮lo -- have hinert : (𝔮.under (𝓞 K)).inertiaDeg' 𝔮 = 1 := by -- rw [Ideal.inertiaDeg'_algebraMap] -+ have := h𝔮p -+ have := h𝔮lo -+ have : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal (UnramifiedIn.ne_bot K L hunr) -+ have : 𝔮.IsMaximal := Ideal.IsMaximal.of_liesOver_isMaximal 𝔮 𝔭 -+ have : (𝔮.under (𝓞 K)).IsMaximal := h𝔮lo.over ▸ ‹𝔭.IsMaximal› -+ have hinert : 𝔮.inertiaDeg (𝓞 K) = 1 := by -+ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔮.under (𝓞 K)) 𝔮] - exact hresdeg 𝔮 h𝔮p h𝔮lo -- have hunder : 𝔮.under (𝓞 K) = 𝔭 := h𝔮lo.over.symm -- rw [Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver 𝔮 (𝔮.under (𝓞 K)) inferInstance -- (hunder ▸ UnramifiedIn.ne_bot K L hunr), hinert, pow_one, hunder] -+ rw [← Ideal.absNorm_pow_inertiaDeg 𝔭 𝔮, hinert, pow_one] - - /-! ### Coprime-restricted Frobenii generation - -@@ -409,8 +409,8 @@ private theorem finite_primesLiesOver_ne_bot (F : IntermediateField K L) [IsGalo - (𝔭 : Ideal (𝓞 K)) [𝔭.IsMaximal] : - haveI : NumberField F := NumberField.of_intermediateField F - Finite {𝔮 : Ideal (𝓞 ↥F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭 ∧ 𝔮 ≠ ⊥} := by -- haveI : NumberField F := NumberField.of_intermediateField F -- haveI : Finite (𝔭.primesOver (𝓞 ↥F)) := -+ have : NumberField F := NumberField.of_intermediateField F -+ have : Finite (𝔭.primesOver (𝓞 ↥F)) := - (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 ↥F)).to_subtype - refine Finite.of_injective (β := 𝔭.primesOver (𝓞 ↥F)) (fun y ↦ ⟨y.1, y.2.1, y.2.2.1⟩) - fun a b hab ↦ Subtype.ext ?_ -@@ -436,8 +436,8 @@ private theorem primeIdealZetaSum_under_eq_finrank_mul [IsMulCommutative Gal(L/K - = (Module.finrank K ↥(IntermediateField.fixedField H) : ℝ) * primeIdealZetaSum - {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ (Ideal.absNorm 𝔭).Coprime m} s := by - set F := IntermediateField.fixedField H -- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -- haveI : NumberField F := NumberField.of_intermediateField F -+ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -+ have : NumberField F := NumberField.of_intermediateField F - set U : Set (Ideal (𝓞 K)) := - {𝔭 | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ (Ideal.absNorm 𝔭).Coprime m} - set V : Set (Ideal (𝓞 F)) := -@@ -446,9 +446,9 @@ private theorem primeIdealZetaSum_under_eq_finrank_mul [IsMulCommutative Gal(L/K - set IV := {𝔮 : Ideal (𝓞 F) // 𝔮 ∈ V ∧ 𝔮.IsPrime ∧ 𝔮 ≠ ⊥} - have hφ_mem : ∀ 𝔮 : IV, (𝔮.1.under (𝓞 K)) ∈ U ∧ (𝔮.1.under (𝓞 K)).IsPrime - ∧ (𝔮.1.under (𝓞 K)) ≠ ⊥ := fun 𝔮 ↦ by -- haveI := 𝔮.2.2.1 -+ have := 𝔮.2.2.1 - exact ⟨⟨inferInstance, 𝔮.2.1.2.1, 𝔮.2.1.2.2⟩, inferInstance, -- Ideal.IsIntegral.comap_ne_bot (𝓞 K) 𝔮.2.2.2⟩ -+ Ideal.IsIntegral.under_ne_bot (𝓞 K) 𝔮.2.2.2⟩ - set φ : IV → IU := fun 𝔮 ↦ ⟨𝔮.1.under (𝓞 K), hφ_mem 𝔮⟩ - set e := Equiv.sigmaFiberEquiv φ - have hsummSig : Summable (fun p : Σ 𝔭 : IU, {𝔮 : IV // φ 𝔮 = 𝔭} ↦ -@@ -458,13 +458,13 @@ private theorem primeIdealZetaSum_under_eq_finrank_mul [IsMulCommutative Gal(L/K - rw [primeIdealZetaSum_def, ← e.tsum_eq (fun 𝔮 : IV ↦ (Ideal.absNorm (𝔮.1) : ℝ) ^ (-s)), - hsummSig.tsum_sigma, primeIdealZetaSum_def, ← tsum_mul_left] - refine tsum_congr (fun 𝔭 ↦ ?_) -- haveI := 𝔭.2.2.1 -+ have := 𝔭.2.2.1 - have hfibeq : {𝔮 : IV // φ 𝔮 = 𝔭} ≃ - {𝔮 : Ideal (𝓞 F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭.1 ∧ 𝔮 ≠ ⊥} := - { toFun := fun x ↦ ⟨x.1.1, x.1.2.2.1, ⟨(Subtype.ext_iff.mp x.2).symm⟩, x.1.2.2.2⟩ - invFun := fun y ↦ ⟨⟨y.1, ⟨y.2.1, by -- haveI := y.2.1 -- haveI := y.2.2.1 -+ have := y.2.1 -+ have := y.2.2.1 - exact (y.2.2.1.over ▸ 𝔭.2.1.2 : UnramifiedIn K L (y.1.under (𝓞 K)) ∧ - (Ideal.absNorm (y.1.under (𝓞 K))).Coprime m)⟩, y.2.1, y.2.2.2⟩, - Subtype.ext (haveI := y.2.2.1; y.2.2.1.over.symm)⟩ -@@ -474,10 +474,10 @@ private theorem primeIdealZetaSum_under_eq_finrank_mul [IsMulCommutative Gal(L/K - = (Ideal.absNorm 𝔭.1 : ℝ) ^ (-s) := fun x ↦ by - change (Ideal.absNorm x.1.1 : ℝ) ^ (-s) = (Ideal.absNorm 𝔭.1 : ℝ) ^ (-s) - rw [(hsplit 𝔭.1 𝔭.2.2.1 𝔭.2.1.2.1 𝔭.2.1.2.2).2 x.1.1 x.1.2.2.1 ⟨(Subtype.ext_iff.mp x.2).symm⟩] -- haveI : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 -- haveI : Finite {𝔮 : Ideal (𝓞 F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭.1 ∧ 𝔮 ≠ ⊥} := -+ have : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 -+ have : Finite {𝔮 : Ideal (𝓞 F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭.1 ∧ 𝔮 ≠ ⊥} := - finite_primesLiesOver_ne_bot K L F 𝔭.1 -- haveI : Finite {𝔮 : IV // φ 𝔮 = 𝔭} := Finite.of_equiv _ hfibeq.symm -+ have : Finite {𝔮 : IV // φ 𝔮 = 𝔭} := Finite.of_equiv _ hfibeq.symm - rw [tsum_congr hconst, tsum_const, Nat.card_congr hfibeq, - (hsplit 𝔭.1 𝔭.2.2.1 𝔭.2.1.2.1 𝔭.2.1.2.2).1, nsmul_eq_mul, mul_comm] - -@@ -498,8 +498,8 @@ private theorem finrank_mul_unramified_coprime_le_univ - {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ (Ideal.absNorm 𝔭).Coprime m} s - ≤ primeIdealZetaSum (Set.univ : Set (Ideal (𝓞 ↥(IntermediateField.fixedField H)))) s := by - set F := IntermediateField.fixedField H -- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -- haveI : NumberField F := NumberField.of_intermediateField F -+ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -+ have : NumberField F := NumberField.of_intermediateField F - have hsplit : ∀ 𝔭 : Ideal (𝓞 K), 𝔭.IsPrime → UnramifiedIn K L 𝔭 → (Ideal.absNorm 𝔭).Coprime m → - Nat.card {𝔮 : Ideal (𝓞 F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭 ∧ 𝔮 ≠ ⊥} = Module.finrank K ↥F - ∧ ∀ 𝔮 : Ideal (𝓞 F), 𝔮.IsPrime → 𝔮.LiesOver 𝔭 → Ideal.absNorm 𝔮 = Ideal.absNorm 𝔭 := -@@ -522,8 +522,8 @@ private theorem finrank_fixedField_le_one_of_forall_frobenius_mem_of_coprime - (Ideal.absNorm 𝔭).Coprime m → ((frobeniusClass K L 𝔭).out : L ≃ₐ[K] L) ∈ H) : - Module.finrank K (IntermediateField.fixedField H) ≤ 1 := by - set F := IntermediateField.fixedField H -- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -- haveI : NumberField F := NumberField.of_intermediateField F -+ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H -+ have : NumberField F := NumberField.of_intermediateField F - set d : ℕ := Module.finrank K ↥F - rw [← Nat.cast_le (α := ℝ), Nat.cast_one] - set A : ℝ → ℝ := fun s ↦ primeIdealZetaSum -diff --git a/projects/Chebotarev/CebotarevDensity/FixedFieldDensity.lean b/projects/Chebotarev/CebotarevDensity/FixedFieldDensity.lean -index 7d40bad6a..33f8b2367 100644 ---- a/projects/Chebotarev/CebotarevDensity/FixedFieldDensity.lean -+++ b/projects/Chebotarev/CebotarevDensity/FixedFieldDensity.lean -@@ -1,8 +1,9 @@ - module - - public import Mathlib.RingTheory.Ideal.Over --public import Mathlib.NumberTheory.RamificationInertia.Basic -+public import Mathlib.RingTheory.RamificationInertia.Basic - public import CebotarevDensity.Cyclotomic -+public import CebotarevDensity.ForMathlib.TsumFiberBound - - /-! - # Density transfer through a fixed-field subextension (Sharifi 7.2.2 Step 1) -@@ -65,18 +66,18 @@ theorem frobeniusFibre_card_eq_of_isConj - simp only [MulAction.toPerm_apply] - constructor - · rintro ⟨hp, hP, hne, hfrob⟩ -- haveI := hp -- haveI := hP -+ have := hp -+ have := hP - refine ⟨inferInstance, inferInstance, ?_, ?_⟩ - · rw [← Ideal.smul_bot c] - exact (MulAction.injective c).ne hne - · exact hc ▸ hfrob.conj c - · rintro ⟨hp, hP, hne, hfrob⟩ -- haveI := hp -- haveI := hP -+ have := hp -+ have := hP - have hsmul : c⁻¹ • (c • 𝔓) = 𝔓 := inv_smul_smul c 𝔓 -- haveI hp' : 𝔓.IsPrime := hsmul ▸ (inferInstance : (c⁻¹ • (c • 𝔓)).IsPrime) -- haveI hP' : 𝔓.LiesOver 𝔭 := hsmul ▸ (inferInstance : (c⁻¹ • (c • 𝔓)).LiesOver 𝔭) -+ have hp' : 𝔓.IsPrime := hsmul ▸ (inferInstance : (c⁻¹ • (c • 𝔓)).IsPrime) -+ have hP' : 𝔓.LiesOver 𝔭 := hsmul ▸ (inferInstance : (c⁻¹ • (c • 𝔓)).LiesOver 𝔭) - have hne' : 𝔓 ≠ ⊥ := by - rw [← hsmul, ← Ideal.smul_bot c⁻¹] - exact (MulAction.injective c⁻¹).ne hne -@@ -84,7 +85,6 @@ theorem frobeniusFibre_card_eq_of_isConj - have hconj := hfrob.conj c⁻¹ - rwa [hsmul, ← hc, show c⁻¹ * (c * σ * c⁻¹) * c⁻¹⁻¹ = σ by group] at hconj - --set_option backward.isDefEq.respectTransparency false in - /-- **Balanced fibre count.** If every prime above `𝔭` has Frobenius in the class `C = [σ]` - and conjugate Frobenius values occur equally often (`hequi`), the total number of primes - above `𝔭` is `|C|` times the number with `Frob_𝔓 = σ`: partition by the (class-`C`-valued) -@@ -103,21 +103,21 @@ theorem card_primesAbove_eq_card_carrier_mul_frobeniusFibre - * Nat.card {𝔓 : Ideal (𝓞 L) // ∃ (_ : 𝔓.IsPrime) (_ : 𝔓.LiesOver 𝔭) (_ : 𝔓 ≠ ⊥), - IsArithFrobAt (𝓞 K) σ 𝔓} := by - have hpbot : 𝔭 ≠ ⊥ := UnramifiedIn.ne_bot K L hunr -- haveI : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal hpbot -- haveI : Finite (𝔭.primesOver (𝓞 L)) := (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 L)).to_subtype -- haveI : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := -+ have : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal hpbot -+ have : Finite (𝔭.primesOver (𝓞 L)) := (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 L)).to_subtype -+ have : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := - Finite.of_injective - (fun 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} ↦ - (⟨𝔓.1, 𝔓.2.1, 𝔓.2.2.1⟩ : 𝔭.primesOver (𝓞 L))) -- fun _ _ hab ↦ Subtype.ext (by simpa using hab) -- haveI : Fintype C.carrier := Fintype.ofFinite _ -+ fun _ _ hab ↦ Subtype.ext (congrArg (fun q : 𝔭.primesOver (𝓞 L) ↦ q.1) hab) -+ have : Fintype C.carrier := Fintype.ofFinite _ - have hfinP : ∀ (𝔓 : Ideal (𝓞 L)) [𝔓.IsPrime] (hP : 𝔓.LiesOver 𝔭), Finite (𝓞 L ⧸ 𝔓) := - fun 𝔓 _ hP ↦ UnramifiedIn.finite_quotient K L hunr 𝔓 hP - have hmem : ∀ (𝔓 : Ideal (𝓞 L)) [𝔓.IsPrime] (hP : 𝔓.LiesOver 𝔭), - haveI := hfinP 𝔓 hP - arithFrobAt (𝓞 K) Gal(L/K) 𝔓 ∈ C.carrier := by - intro 𝔓 _ hP -- haveI := hfinP 𝔓 hP -+ have := hfinP 𝔓 hP - rw [ConjClasses.mem_carrier_iff_mk_eq, ← frobeniusClass_eq_mk_of_isArithFrobAt K L 𝔭 hunr _ 𝔓 - (IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) 𝔓) hP, hCfrob] - have hconj : ∀ g : C.carrier, IsConj σ g.1 := by -@@ -138,18 +138,18 @@ theorem card_primesAbove_eq_card_carrier_mul_frobeniusFibre - refine Nat.card_congr ⟨fun x ↦ ⟨x.1.1, x.1.2.1, x.1.2.2.1, x.1.2.2.2, ?_⟩, - fun x ↦ ⟨⟨x.1, by obtain ⟨hp, hP, hne, _⟩ := x.2; exact ⟨hp, hP, hne⟩⟩, ?_⟩, - fun _ ↦ rfl, fun _ ↦ rfl⟩ -- · haveI := x.1.2.1 -- haveI := hfinP x.1.1 x.1.2.2.1 -+ · have := x.1.2.1 -+ have := hfinP x.1.1 x.1.2.2.1 - rw [← Subtype.ext_iff.mp x.2] - exact IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) x.1.1 - · obtain ⟨hp, hP, hne, hg⟩ := x.2 -- haveI := hp -- haveI := hP -- haveI := hfinP x.1 hP -- haveI : Algebra.IsUnramifiedAt (𝓞 K) x.1 := -+ have := hp -+ have := hP -+ have := hfinP x.1 hP -+ have : Algebra.IsUnramifiedAt (𝓞 K) x.1 := - Ideal.ramificationIdx_eq_one_iff.mp - ((Ideal.ramificationIdx'_eq_ramificationIdx (x.1.under (𝓞 K)) x.1 -- (Ideal.IsIntegral.comap_ne_bot (𝓞 K) hne)).symm.trans -+ (Ideal.IsIntegral.under_ne_bot (𝓞 K) hne)).symm.trans - (UnramifiedIn.ramificationIdx_eq_one K L hunr x.1 hP)) - exact Subtype.ext (eq_arithFrobAt_of_isArithFrobAt K L x.1 g.1 hg).symm - simp_rw [hfib] -@@ -239,11 +239,11 @@ theorem arithFrobAt_restrictScalars_eq (E : IntermediateField K L) - Ideal.finiteQuotientOfFreeOfNeBot 𝔓 (ne_bot_of_ramificationIdx_eq_one K L hunrK) - haveI : IsGalois (↥E) L := IsGalois.tower_top_intermediateField E - (arithFrobAt (𝓞 ↥E) Gal(L/(↥E)) 𝔓).restrictScalars K = arithFrobAt (𝓞 K) Gal(L/K) 𝔓 := by -- haveI : IsScalarTower K ↥E L := E.isScalarTower_mid' -- haveI : IsGalois (↥E) L := IsGalois.tower_top_intermediateField E -- haveI : IsGaloisGroup Gal(L/(↥E)) (↥E) L := IsGaloisGroup.of_isGalois (↥E) L -- haveI hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hunrK -- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot -+ have : IsScalarTower K ↥E L := E.isScalarTower_mid' -+ have : IsGalois (↥E) L := IsGalois.tower_top_intermediateField E -+ have : IsGaloisGroup Gal(L/(↥E)) (↥E) L := IsGaloisGroup.of_isGalois (↥E) L -+ have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hunrK -+ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot - set σE := arithFrobAt (𝓞 ↥E) Gal(L/(↥E)) 𝔓 with hσE - have hKfrob1 : IsArithFrobAt (𝓞 K) (σE.restrictScalars K) 𝔓 := by - intro x -@@ -279,28 +279,29 @@ private theorem stabilizer_intermediate_eq_top_of_frobenius - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' - MulAction.stabilizer - Gal(L/↥(IntermediateField.fixedField (Subgroup.zpowers σ))) 𝔓 = ⊤ := by -- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' - have hraK := UnramifiedIn.ramificationIdx_eq_one K L hunrK 𝔓 hPK - have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hraK - have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := UnramifiedIn.ne_bot K L hunrK -- haveI : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot -- haveI : (𝔓.under (𝓞 K)).IsMaximal := -+ have : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot -+ have : (𝔓.under (𝓞 K)).IsMaximal := - (inferInstance : (𝔓.under (𝓞 K)).IsPrime).isMaximal hpbot -- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot -- haveI : Algebra.IsSeparable (𝓞 K ⧸ 𝔓.under (𝓞 K)) (𝓞 L ⧸ 𝔓) := by -- letI : Field (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.Quotient.field _ -- letI : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ -+ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot -+ have : Algebra.IsSeparable (𝓞 K ⧸ 𝔓.under (𝓞 K)) (𝓞 L ⧸ 𝔓) := by -+ let : Field (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.Quotient.field _ -+ let : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ - exact IsGalois.to_isSeparable - have hmem : σ ∈ MulAction.stabilizer Gal(L/K) 𝔓 := hfrob.mem_stabilizer -- have hinertK : (𝔓.under (𝓞 K)).inertiaDeg' 𝔓 = orderOf σ := by -- rw [Ideal.inertiaDeg'_algebraMap, orderOf_eq_finrank_of_isArithFrobAt K L σ 𝔓 hraK hfrob] -+ have hinertK : 𝔓.inertiaDeg (𝓞 K) = orderOf σ := by -+ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔓.under (𝓞 K)) 𝔓, -+ orderOf_eq_finrank_of_isArithFrobAt K L σ 𝔓 hraK hfrob] - have hcardstab' : Nat.card (MulAction.stabilizer Gal(L/K) 𝔓) = orderOf σ := by - rw [Ideal.card_stabilizer_eq (𝔓.under (𝓞 K)) 𝔓, - Ideal.ramificationIdxIn_eq_ramificationIdx (𝔓.under (𝓞 K)) 𝔓 Gal(L/K), - ← Ideal.ramificationIdx'_eq_ramificationIdx (𝔓.under (𝓞 K)) 𝔓 hpbot, hraK, one_mul, - Ideal.inertiaDegIn_eq_inertiaDeg (𝔓.under (𝓞 K)) 𝔓 Gal(L/K), -- ← Ideal.inertiaDeg'_eq_inertiaDeg (𝔓.under (𝓞 K)) 𝔓, hinertK] -+ hinertK] - have hstab : Subgroup.zpowers σ = MulAction.stabilizer Gal(L/K) 𝔓 := - Subgroup.eq_of_le_of_card_ge (by rwa [Subgroup.zpowers_le]) - (by rw [Nat.card_zpowers, hcardstab']) -@@ -331,34 +332,33 @@ private theorem inertiaDeg_under_E_eq_one_of_frobenius - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' - Ideal.ramificationIdx' - (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 = 1 -- ∧ (𝔓.under (𝓞 K)).inertiaDeg' -- (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) = 1 -+ ∧ (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).inertiaDeg (𝓞 K) = 1 - ∧ Nat.card (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) - ⧸ 𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) - = Nat.card (𝓞 K ⧸ 𝔓.under (𝓞 K)) := by - set E := IntermediateField.fixedField (Subgroup.zpowers σ) with hE -- haveI : IsScalarTower K ↥E L := E.isScalarTower_mid' -- haveI : IsGalois (↥E) L := IsGalois.tower_top_intermediateField _ -+ have : IsScalarTower K ↥E L := E.isScalarTower_mid' -+ have : IsGalois (↥E) L := IsGalois.tower_top_intermediateField _ - have hraK := UnramifiedIn.ramificationIdx_eq_one K L hunrK 𝔓 hPK - have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hraK - have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := UnramifiedIn.ne_bot K L hunrK -- haveI : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot -- haveI : (𝔓.under (𝓞 K)).IsMaximal := -+ have : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot -+ have : (𝔓.under (𝓞 K)).IsMaximal := - (inferInstance : (𝔓.under (𝓞 K)).IsPrime).isMaximal hpbot -- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot -- haveI hPEp : (𝔓.under (𝓞 ↥E)).IsPrime := inferInstance -- haveI hPK' : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) -- haveI hPEK : (𝔓.under (𝓞 ↥E)).LiesOver (𝔓.under (𝓞 K)) := inferInstance -- haveI hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥E)) := Ideal.over_under (A := 𝓞 ↥E) (P := 𝔓) -- have hpEbot : 𝔓.under (𝓞 ↥E) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 ↥E) hPbot -- haveI : (𝔓.under (𝓞 ↥E)).IsMaximal := hPEp.isMaximal hpEbot -+ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot -+ have hPEp : (𝔓.under (𝓞 ↥E)).IsPrime := inferInstance -+ have hPK' : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) -+ have hPEK : (𝔓.under (𝓞 ↥E)).LiesOver (𝔓.under (𝓞 K)) := inferInstance -+ have hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥E)) := Ideal.over_under (A := 𝓞 ↥E) (P := 𝔓) -+ have hpEbot : 𝔓.under (𝓞 ↥E) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 ↥E) hPbot -+ have : (𝔓.under (𝓞 ↥E)).IsMaximal := hPEp.isMaximal hpEbot - have hraE : Ideal.ramificationIdx' (𝔓.under (𝓞 ↥E)) 𝔓 = 1 := by - have htower := Ideal.ramificationIdx'_algebra_tower' (𝔓.under (𝓞 K)) (𝔓.under (𝓞 ↥E)) 𝔓 - rw [hraK] at htower - exact Nat.eq_one_of_mul_eq_one_left htower.symm -- haveI : Algebra.IsSeparable (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) (𝓞 L ⧸ 𝔓) := by -- letI : Field (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) := Ideal.Quotient.field _ -- letI : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ -+ have : Algebra.IsSeparable (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) (𝓞 L ⧸ 𝔓) := by -+ let : Field (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) := Ideal.Quotient.field _ -+ let : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ - exact IsGalois.to_isSeparable - have hstabE : MulAction.stabilizer Gal(L/(↥E)) 𝔓 = ⊤ := - stabilizer_intermediate_eq_top_of_frobenius σ 𝔓 hunrK hPK hfrob horderE -@@ -369,26 +369,25 @@ private theorem inertiaDeg_under_E_eq_one_of_frobenius - Ideal.ramificationIdxIn_eq_ramificationIdx (𝔓.under (𝓞 ↥E)) 𝔓 Gal(L/(↥E)), - ← Ideal.ramificationIdx'_eq_ramificationIdx (𝔓.under (𝓞 ↥E)) 𝔓 hpEbot, hraE, one_mul, - Ideal.inertiaDegIn_eq_inertiaDeg (𝔓.under (𝓞 ↥E)) 𝔓 Gal(L/(↥E)), -- ← Ideal.inertiaDeg'_eq_inertiaDeg (𝔓.under (𝓞 ↥E)) 𝔓, -- Ideal.inertiaDeg'_algebraMap] at hcardE -- have hinertTower : (𝔓.under (𝓞 K)).inertiaDeg' 𝔓 -- = (𝔓.under (𝓞 K)).inertiaDeg' (𝔓.under (𝓞 ↥E)) -- * (𝔓.under (𝓞 ↥E)).inertiaDeg' 𝔓 := -- Ideal.inertiaDeg'_algebra_tower (𝔓.under (𝓞 K)) (𝔓.under (𝓞 ↥E)) 𝔓 -- have hinertK : (𝔓.under (𝓞 K)).inertiaDeg' 𝔓 = orderOf σ := by -- rw [Ideal.inertiaDeg'_algebraMap, orderOf_eq_finrank_of_isArithFrobAt K L σ 𝔓 hraK hfrob] -- have hfPE : (𝔓.under (𝓞 ↥E)).inertiaDeg' 𝔓 = orderOf σ := by -- rw [Ideal.inertiaDeg'_algebraMap, ← hcardE, horderE] -+ Ideal.inertiaDeg_eq_of_isMaximal (𝔓.under (𝓞 ↥E)) 𝔓] at hcardE -+ have hinertTower : 𝔓.inertiaDeg (𝓞 K) -+ = (𝔓.under (𝓞 ↥E)).inertiaDeg (𝓞 K) -+ * 𝔓.inertiaDeg (𝓞 ↥E) := -+ Ideal.inertiaDeg_tower (R := 𝓞 K) (𝔓.under (𝓞 ↥E)) 𝔓 -+ have hinertK : 𝔓.inertiaDeg (𝓞 K) = orderOf σ := by -+ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔓.under (𝓞 K)) 𝔓, -+ orderOf_eq_finrank_of_isArithFrobAt K L σ 𝔓 hraK hfrob] -+ have hfPE : 𝔓.inertiaDeg (𝓞 ↥E) = orderOf σ := by -+ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔓.under (𝓞 ↥E)) 𝔓, ← hcardE, horderE] - have hpos : 0 < orderOf σ := orderOf_pos_iff.mpr (isOfFinOrder_of_finite σ) -- have hinertPK : (𝔓.under (𝓞 K)).inertiaDeg' (𝔓.under (𝓞 ↥E)) = 1 := by -+ have hinertPK : (𝔓.under (𝓞 ↥E)).inertiaDeg (𝓞 K) = 1 := by - rw [hinertK, hfPE] at hinertTower - exact Nat.eq_of_mul_eq_mul_right hpos (by rw [one_mul]; exact hinertTower.symm) - refine ⟨hraE, hinertPK, ?_⟩ - have hnormP : Nat.card (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) -- = Nat.card (𝓞 K ⧸ 𝔓.under (𝓞 K)) ^ (𝔓.under (𝓞 K)).inertiaDeg' (𝔓.under (𝓞 ↥E)) := by -+ = Nat.card (𝓞 K ⧸ 𝔓.under (𝓞 K)) ^ (𝔓.under (𝓞 ↥E)).inertiaDeg (𝓞 K) := by - simpa [Submodule.cardQuot_apply, Ideal.absNorm_apply] using -- Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver (𝔓.under (𝓞 ↥E)) (𝔓.under (𝓞 K)) -- inferInstance hpbot -+ (Ideal.absNorm_pow_inertiaDeg (𝔓.under (𝓞 K)) (𝔓.under (𝓞 ↥E))).symm - rw [hnormP, hinertPK, pow_one] - - open scoped Pointwise in -@@ -405,15 +404,15 @@ private theorem eq_of_liesOver_under_E_of_frobenius - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' - 𝔔.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))))) : - 𝔔 = 𝔓 := by -- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := -+ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := - IsGalois.tower_top_intermediateField _ -- haveI : IsGaloisGroup Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) -+ have : IsGaloisGroup Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) - (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := IsGaloisGroup.of_isGalois _ L - set E := IntermediateField.fixedField (Subgroup.zpowers σ) with hE -- haveI := hQ -- haveI : 𝔓.LiesOver (𝔓.under (𝓞 ↥E)) := Ideal.over_under (A := 𝓞 ↥E) (P := 𝔓) -+ have := hQ -+ have : 𝔓.LiesOver (𝔓.under (𝓞 ↥E)) := Ideal.over_under (A := 𝓞 ↥E) (P := 𝔓) - have hstabE : MulAction.stabilizer Gal(L/(↥E)) 𝔓 = ⊤ := - stabilizer_intermediate_eq_top_of_frobenius σ 𝔓 hunrK hPK hfrob horderE - obtain ⟨τ, hτ⟩ := Ideal.exists_smul_eq_of_isGaloisGroup (𝔓.under (𝓞 ↥E)) 𝔓 𝔔 Gal(L/(↥E)) -@@ -446,18 +445,18 @@ private theorem arithFrobAt_E_eq_of_isArithFrobAt - IsGalois.tower_top_intermediateField _ - arithFrobAt (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) - Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 = σE := by -- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := -+ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := - IsGalois.tower_top_intermediateField _ - have hraK : Ideal.ramificationIdx' (𝔓.under (𝓞 K)) 𝔓 = 1 := - UnramifiedIn.ramificationIdx_eq_one K L hunrK 𝔓 hPK - have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hraK -- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot -- haveI : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := -+ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot -+ have : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := - Ideal.ramificationIdx_eq_one_iff.mp - ((Ideal.ramificationIdx'_eq_ramificationIdx (𝔓.under (𝓞 K)) 𝔓 -- (Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPbot)).symm.trans hraK) -+ (Ideal.IsIntegral.under_ne_bot (𝓞 K) hPbot)).symm.trans hraK) - have hbridge := arithFrobAt_restrictScalars_eq - (IntermediateField.fixedField (Subgroup.zpowers σ)) 𝔓 hraK hraE hnorm - rw [(eq_arithFrobAt_of_isArithFrobAt K L 𝔓 σ hfrob).symm] at hbridge -@@ -480,49 +479,47 @@ private theorem exists_arithFrobAt_over_fibrePrime - (hPunr : UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P) - (hPfrob : frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P - = ConjClasses.mk σE) -- (hPdeg : (P.under (𝓞 K)).inertiaDeg' P = 1) (hPbot : P ≠ ⊥) : -+ (hPdeg : P.inertiaDeg (𝓞 K) = 1) (hPbot : P ≠ ⊥) : - ∃ (𝔓 : Ideal (𝓞 L)) (_ : 𝔓.IsPrime) (_ : 𝔓.LiesOver P) (_ : 𝔓 ≠ ⊥), - 𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) = P ∧ - IsArithFrobAt (𝓞 K) σ 𝔓 := by -- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := -+ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := - IsGalois.tower_top_intermediateField _ - obtain ⟨𝔓, h𝔓p, h𝔓lo, h𝔓bot⟩ := exists_prime_liesOver - (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L P hPbot -- haveI := h𝔓p -- haveI := h𝔓lo -+ have := h𝔓p -+ have := h𝔓lo - have hPeq : 𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) = P := - h𝔓lo.over.symm -- haveI hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := -+ have hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := - Ideal.over_under (A := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) (P := 𝔓) - have hunderK : 𝔓.under (𝓞 K) = P.under (𝓞 K) := by - rw [← Ideal.under_under (B := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) 𝔓, hPeq] - have hunrK : UnramifiedIn K L (𝔓.under (𝓞 K)) := hunderK ▸ hunrP -- haveI : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) -- have hinertPK1 : (𝔓.under (𝓞 K)).inertiaDeg' -- (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) = 1 := by -- rw [hPeq, hunderK] -+ have : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) -+ have hinertPK1 : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).inertiaDeg (𝓞 K) = 1 := by -+ rw [hPeq] - exact hPdeg - have hraE : Ideal.ramificationIdx' - (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 = 1 := - (Ideal.ramificationIdx'_eq_ramificationIdx - (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 -- (Ideal.IsIntegral.comap_ne_bot _ h𝔓bot)).trans -+ (Ideal.IsIntegral.under_ne_bot _ h𝔓bot)).trans - (Ideal.ramificationIdx_eq_one_iff.mpr - (hPunr.2 𝔓 (h𝔓p.isMaximal h𝔓bot) (hPeq ▸ hPPE))) - have hnorm : Nat.card (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) - ⧸ 𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) - = Nat.card (𝓞 K ⧸ 𝔓.under (𝓞 K)) := by -- have hnP := Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver -- (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) (𝔓.under (𝓞 K)) -- inferInstance (UnramifiedIn.ne_bot K L hunrK) -+ have hnP := (Ideal.absNorm_pow_inertiaDeg (𝔓.under (𝓞 K)) -+ (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))))).symm - simp only [Submodule.cardQuot_apply, Ideal.absNorm_apply] at hnP ⊢ - rw [hnP, hinertPK1, pow_one] -- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 h𝔓bot -+ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 h𝔓bot - have hfrEeqσE : arithFrobAt (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) - Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 = σE := by -- letI : CommMonoid Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := -+ let : CommMonoid Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := - IsMulCommutative.instCommMonoid - have hcl := frobeniusClass_eq_mk_of_isArithFrobAt - (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L P hPunr _ 𝔓 -@@ -560,40 +557,40 @@ private theorem under_E_mem_fibre_of_isArithFrobAt - {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | - P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ - frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P -- = ConjClasses.mk σE ∧ (P.under (𝓞 K)).inertiaDeg' P = 1} -+ = ConjClasses.mk σE ∧ P.inertiaDeg (𝓞 K) = 1} - ∧ (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver 𝔭 - ∧ (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) ≠ ⊥ := by -- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := -+ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := - IsGalois.tower_top_intermediateField _ -- haveI := hP -+ have := hP - have hunderK : 𝔓.under (𝓞 K) = 𝔭 := hP.over.symm - have hunrK : UnramifiedIn K L (𝔓.under (𝓞 K)) := hunderK ▸ hunr -- haveI : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) -- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot -+ have : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) -+ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot - obtain ⟨hraE, hinPK, hnorm⟩ := - inertiaDeg_under_E_eq_one_of_frobenius σ 𝔓 hunrK inferInstance hfrob horderE - have hfrE := arithFrobAt_E_eq_of_isArithFrobAt σ σE hσE 𝔓 hunrK inferInstance hfrob horderE - hraE hnorm - have hunram : UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L - (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := by -- refine ⟨Ideal.IsIntegral.comap_ne_bot _ hPbot, fun 𝔔 h𝔔max h𝔔lo ↦ ?_⟩ -- haveI := h𝔔max.isPrime -+ refine ⟨Ideal.IsIntegral.under_ne_bot _ hPbot, fun 𝔔 h𝔔max h𝔔lo ↦ ?_⟩ -+ have := h𝔔max.isPrime - have h𝔔eq : 𝔔 = 𝔓 := eq_of_liesOver_under_E_of_frobenius σ 𝔓 hunrK inferInstance hfrob - horderE 𝔔 h𝔔lo - subst h𝔔eq - exact Ideal.ramificationIdx_eq_one_iff.mp - ((Ideal.ramificationIdx'_eq_ramificationIdx - (𝔔.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔔 -- (Ideal.IsIntegral.comap_ne_bot _ hPbot)).symm.trans hraE) -- haveI hPEK : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver 𝔭 := by -- haveI : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver -+ (Ideal.IsIntegral.under_ne_bot _ hPbot)).symm.trans hraE) -+ have hPEK : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver 𝔭 := by -+ have : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver - (𝔓.under (𝓞 K)) := inferInstance - rwa [hunderK] at this -- haveI hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := -+ have hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := - Ideal.over_under (A := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) (P := 𝔓) -- refine ⟨⟨inferInstance, hunram, ?_, ?_⟩, hPEK, Ideal.IsIntegral.comap_ne_bot _ hPbot⟩ -+ refine ⟨⟨inferInstance, hunram, ?_, ?_⟩, hPEK, Ideal.IsIntegral.under_ne_bot _ hPbot⟩ - · rw [frobeniusClass_eq_mk_of_isArithFrobAt - (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) - L (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) hunram _ 𝔓 -@@ -601,9 +598,7 @@ private theorem under_E_mem_fibre_of_isArithFrobAt - Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓) hPPE, - ConjClasses.mk_eq_mk_iff_isConj] - exact isConj_iff.mpr ⟨1, by simp [hfrE]⟩ -- · rw [show (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).under (𝓞 K) -- = 𝔓.under (𝓞 K) from Ideal.under_under 𝔓] -- exact hinPK -+ · exact hinPK - - /-- **Fibre bijection: degree-one `E`-primes with Frobenius `σ_E` ↔ `L`-primes with - Frobenius `σ`** (Sharifi 7.2.2 p. 143). For a prime `𝔭` of `𝓞 K` unramified in `L` with -@@ -628,12 +623,12 @@ private theorem card_fibre_E_eq_card_fibre_L - P ∈ {P | P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P - ∧ frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P - = ConjClasses.mk σE -- ∧ (P.under (𝓞 K)).inertiaDeg' P = 1} ∧ P.LiesOver 𝔭 ∧ P ≠ ⊥} -+ ∧ P.inertiaDeg (𝓞 K) = 1} ∧ P.LiesOver 𝔭 ∧ P ≠ ⊥} - = Nat.card {𝔓 : Ideal (𝓞 L) // ∃ (_ : 𝔓.IsPrime) (_ : 𝔓.LiesOver 𝔭) (_ : 𝔓 ≠ ⊥), - IsArithFrobAt (𝓞 K) σ 𝔓} := by -- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := -+ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := - IsGalois.tower_top_intermediateField _ - refine (Nat.card_congr (Equiv.ofBijective - (fun 𝔓 ↦ ⟨𝔓.1.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))), -@@ -641,37 +636,37 @@ private theorem card_fibre_E_eq_card_fibre_L - exact under_E_mem_fibre_of_isArithFrobAt σ σE hσE horderE 𝔭 hunr 𝔓.1 hP hPbot hfrob⟩) - ⟨?_, ?_⟩)).symm - · rintro ⟨𝔓₁, h𝔓₁, hP₁, hP₁bot, hfrob₁⟩ ⟨𝔓₂, h𝔓₂, hP₂, hP₂bot, hfrob₂⟩ hΦ -- haveI := h𝔓₁ -- haveI := h𝔓₂ -- haveI := hP₁ -- haveI := hP₂ -+ have := h𝔓₁ -+ have := h𝔓₂ -+ have := hP₁ -+ have := hP₂ - have hunderK₁ : 𝔓₁.under (𝓞 K) = 𝔭 := hP₁.over.symm - have hunrK₁ : UnramifiedIn K L (𝔓₁.under (𝓞 K)) := hunderK₁ ▸ hunr -- haveI : 𝔓₁.LiesOver (𝔓₁.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓₁) -+ have : 𝔓₁.LiesOver (𝔓₁.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓₁) - have hΦ' : 𝔓₂.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) - = 𝔓₁.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) := - congrArg Subtype.val hΦ |>.symm -- haveI hP₂lo : 𝔓₂.LiesOver -+ have hP₂lo : 𝔓₂.LiesOver - (𝔓₁.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := by -- haveI : 𝔓₂.LiesOver -+ have : 𝔓₂.LiesOver - (𝔓₂.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := - Ideal.over_under (A := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) (P := 𝔓₂) - rwa [hΦ'] at this - exact Subtype.ext (eq_of_liesOver_under_E_of_frobenius σ 𝔓₁ hunrK₁ inferInstance hfrob₁ - horderE 𝔓₂ hP₂lo).symm - · rintro ⟨P, ⟨hPp, hPunr, hPfrob, hPdeg⟩, hPlo, hPbot⟩ -- haveI := hPp -- haveI := hPlo -+ have := hPp -+ have := hPlo - have hunrP : UnramifiedIn K L (P.under (𝓞 K)) := hPlo.over.symm ▸ hunr - obtain ⟨𝔓, h𝔓p, h𝔓lo, h𝔓bot, hPeq, hfrobK⟩ := - exists_arithFrobAt_over_fibrePrime σ σE hσE P hunrP hPunr hPfrob hPdeg hPbot -- haveI := h𝔓p -- haveI := h𝔓lo -+ have := h𝔓p -+ have := h𝔓lo - have hunderK : 𝔓.under (𝓞 K) = 𝔭 := by - rw [← Ideal.under_under (B := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) 𝔓, - hPeq] - exact hPlo.over.symm -- haveI hPK𝔓 : 𝔓.LiesOver 𝔭 := hunderK ▸ Ideal.over_under (A := 𝓞 K) (P := 𝔓) -+ have hPK𝔓 : 𝔓.LiesOver 𝔭 := hunderK ▸ Ideal.over_under (A := 𝓞 K) (P := 𝔓) - exact ⟨⟨𝔓, h𝔓p, hPK𝔓, h𝔓bot, hfrobK⟩, Subtype.ext hPeq⟩ - - /-- **A degree-one fibre prime has `K`-Frobenius class `[σ]`** (Sharifi 7.2.2 p. 143). If `P` -@@ -690,18 +685,18 @@ private theorem frobeniusClass_under_eq_of_mem_fibre - (hPunr : UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P) - (hPfrob : frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P - = ConjClasses.mk σE) -- (hPdeg : (P.under (𝓞 K)).inertiaDeg' P = 1) (hPbot : P ≠ ⊥) : -+ (hPdeg : P.inertiaDeg (𝓞 K) = 1) (hPbot : P ≠ ⊥) : - frobeniusClass K L (P.under (𝓞 K)) = ConjClasses.mk σ := by -- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := -+ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := - IsGalois.tower_top_intermediateField _ - obtain ⟨𝔓, h𝔓p, h𝔓lo, h𝔓bot, hPeq, hfrobK⟩ := - exists_arithFrobAt_over_fibrePrime σ σE hσE P hunrP hPunr hPfrob hPdeg hPbot -- haveI := h𝔓p -- haveI := h𝔓lo -+ have := h𝔓p -+ have := h𝔓lo - have hunderK : P.under (𝓞 K) = 𝔓.under (𝓞 K) := by - rw [← hPeq, Ideal.under_under] - have hunrK : UnramifiedIn K L (𝔓.under (𝓞 K)) := hunderK ▸ hunrP -- haveI : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) -+ have : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) - rw [hunderK, - frobeniusClass_eq_mk_of_isArithFrobAt K L (𝔓.under (𝓞 K)) hunrK _ 𝔓 hfrobK inferInstance] - -@@ -715,8 +710,8 @@ private theorem tsum_comp_eq_card_fibre_smul {β γ : Type*} (g : β → γ) (h - ∑' b, h (g b) = c * ∑' y, h y := by - rw [← (hsumm.hasSum.tsum_fiberwise g).tsum_eq, ← tsum_mul_left] - refine tsum_congr fun y ↦ ?_ -- haveI := hfin y -- letI := Fintype.ofFinite (g ⁻¹' {y} : Set β) -+ have := hfin y -+ let := Fintype.ofFinite (g ⁻¹' {y} : Set β) - rw [tsum_congr fun b : (g ⁻¹' {y} : Set β) ↦ congrArg h b.2, tsum_fintype, Finset.sum_const, - Finset.card_univ, ← Nat.card_eq_fintype_card, nsmul_eq_mul, hcard, mul_comm] - -@@ -738,13 +733,12 @@ private theorem card_fibre_T1_over_prime - Nat.card {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // - P ∈ {P | P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P - ∧ frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P -- = ConjClasses.mk σE ∧ (P.under (𝓞 K)).inertiaDeg' P = 1} -+ = ConjClasses.mk σE ∧ P.inertiaDeg (𝓞 K) = 1} - ∧ P.LiesOver 𝔭 ∧ P ≠ ⊥} - = Nat.card Gal(L/K) := by - rw [card_fibre_E_eq_card_fibre_L σ σE hσE horderE 𝔭 hunr𝔭 hfrob𝔭, mul_comm, ← mul_assoc] - exact count_primes_above_with_frobenius_eq_sigma K L σ (ConjClasses.mk σ) rfl 𝔭 hunr𝔭 hfrob𝔭 - --set_option backward.isDefEq.respectTransparency false in - /-- **LEAF A: the degree-one part of `T` carries the main term** (Sharifi 7.2.2 p. 143). For - `1 < s`, the partial Dirichlet sum over the set `T₁` of degree-one (over `K`) primes `P` of - `𝓞 E` above an unramified-in-`L` prime, with `Frob^E_P = [σ_E]`, equals `|G|/(f·|C|)` times the -@@ -767,26 +761,26 @@ private theorem primeIdealZetaSum_fibre_eq_smul - {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | - P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ - frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P -- = ConjClasses.mk σE ∧ (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ -+ = ConjClasses.mk σE ∧ P.inertiaDeg (𝓞 K) = 1 ∧ - UnramifiedIn K L (P.under (𝓞 K))} s - = ((Nat.card Gal(L/K) : ℝ) / (orderOf σ * Nat.card (ConjClasses.mk σ).carrier)) - * primeIdealZetaSum {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ - frobeniusClass K L 𝔭 = ConjClasses.mk σ} s := by -- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := -+ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := - IsGalois.tower_top_intermediateField _ - set Sset := {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ - frobeniusClass K L 𝔭 = ConjClasses.mk σ} with hSset - set T₁set := {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | - P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ - frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P = ConjClasses.mk σE ∧ -- (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} with hT₁set -+ P.inertiaDeg (𝓞 K) = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} with hT₁set - set S' := {𝔭 : Ideal (𝓞 K) // 𝔭 ∈ Sset ∧ 𝔭.IsPrime ∧ 𝔭 ≠ ⊥} with hS' - have hgmem : ∀ P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥}, - P.1.under (𝓞 K) ∈ Sset ∧ (P.1.under (𝓞 K)).IsPrime ∧ P.1.under (𝓞 K) ≠ ⊥ := by - rintro ⟨P, ⟨hPp, hPunr, hPfrob, hPdeg, hunrP⟩, _, hPbot⟩ -- haveI := hPp -+ have := hPp - refine ⟨⟨inferInstance, hunrP, ?_⟩, inferInstance, UnramifiedIn.ne_bot K L hunrP⟩ - exact frobeniusClass_under_eq_of_mem_fibre σ σE hσE horderE P hunrP hPunr hPfrob hPdeg hPbot - set g : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥} → S' := -@@ -794,28 +788,28 @@ private theorem primeIdealZetaSum_fibre_eq_smul - have hnormeq : ∀ P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥}, - (Ideal.absNorm P.1 : ℝ) = (Ideal.absNorm (P.1.under (𝓞 K)) : ℝ) := by - rintro ⟨P, ⟨hPp, _, _, hPdeg, _⟩, _, hPbot⟩ -- haveI := hPp -- have hpbot : P.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPbot -- haveI : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) -- have hpow := Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver P (P.under (𝓞 K)) inferInstance hpbot -+ have := hPp -+ have hpbot : P.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) hPbot -+ have : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) -+ have hpow := (Ideal.absNorm_pow_inertiaDeg (P.under (𝓞 K)) P).symm - rw [hPdeg, pow_one] at hpow - rw [hpow] - have hcardfib : ∀ 𝔭 : S', (orderOf σ * Nat.card (ConjClasses.mk σ).carrier) * - Nat.card {P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥} // g P = 𝔭} = Nat.card Gal(L/K) := by - intro 𝔭 - obtain ⟨hp𝔭, hunr𝔭, hfrob𝔭⟩ := 𝔭.2.1 -- haveI := hp𝔭 -+ have := hp𝔭 - have hreindex : Nat.card {P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥} // g P = 𝔭} - = Nat.card {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // - P ∈ {P | P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) - L P ∧ frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P -- = ConjClasses.mk σE ∧ (P.under (𝓞 K)).inertiaDeg' P = 1} -+ = ConjClasses.mk σE ∧ P.inertiaDeg (𝓞 K) = 1} - ∧ P.LiesOver 𝔭.1 ∧ P ≠ ⊥} := by - refine Nat.card_congr ⟨fun x ↦ ⟨x.1.1, ?_, ?_, x.1.2.2.2⟩, - fun y ↦ ⟨⟨y.1, ?_, y.2.1.1, y.2.2.2⟩, ?_⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩ - · exact ⟨x.1.2.1.1, x.1.2.1.2.1, x.1.2.1.2.2.1, x.1.2.1.2.2.2.1⟩ - · exact ⟨(congrArg Subtype.val x.2).symm ▸ (Ideal.over_under (A := 𝓞 K) (P := x.1.1)).over⟩ -- · haveI := y.2.1.1 -+ · have := y.2.1.1 - have hunderK : y.1.under (𝓞 K) = 𝔭.1 := (y.2.2.1).over.symm - exact ⟨y.2.1.1, y.2.1.2.1, y.2.1.2.2.1, y.2.1.2.2.2, by rw [hunderK]; exact hunr𝔭⟩ - · exact Subtype.ext (y.2.2.1).over.symm -@@ -823,18 +817,20 @@ private theorem primeIdealZetaSum_fibre_eq_smul - exact card_fibre_T1_over_prime σ σE hσE horderE 𝔭.1 hunr𝔭 hfrob𝔭 - have hfibfin : ∀ 𝔭 : S', Finite {P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥} // g P = 𝔭} := by - intro 𝔭 -- haveI := 𝔭.2.2.1 -- haveI : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 -- haveI : Finite (𝔭.1.primesOver -+ have := 𝔭.2.2.1 -+ have : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 -+ have : Finite (𝔭.1.primesOver - (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := - (IsDedekindDomain.primesOver_finite 𝔭.1 _).to_subtype - refine Finite.of_injective (β := 𝔭.1.primesOver - (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) - (fun P ↦ ⟨P.1.1, P.1.2.2.1, ?_⟩) ?_ -- · haveI := P.1.2.2.1 -+ · have := P.1.2.2.1 - exact ⟨(congrArg Subtype.val P.2).symm ▸ (Ideal.over_under (A := 𝓞 K) (P := P.1.1)).over⟩ - · rintro ⟨⟨P, hP⟩, hgP⟩ ⟨⟨Q, hQ⟩, hgQ⟩ hPQ -- simpa using hPQ -+ exact Subtype.ext (Subtype.ext (congrArg -+ (fun q : 𝔭.1.primesOver -+ (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) ↦ q.1) hPQ)) - have hordC_pos : (0 : ℝ) < orderOf σ * Nat.card (ConjClasses.mk σ).carrier := by - have h₁ : 0 < orderOf σ := orderOf_pos_iff.mpr (isOfFinOrder_of_finite σ) - have : Nonempty (ConjClasses.mk σ).carrier := ⟨⟨σ, ConjClasses.mem_carrier_mk⟩⟩ -@@ -871,83 +867,55 @@ most `[E:K]` primes of `𝓞 E` above it, by `Ideal.card_primesOverFinset_le_fin - over `B` is bounded by the finite cardinality of `B`. Both are constants in `s`, so - `Σ_{T₂} s ≤ C` for all `s > 1`, whence `Σ_{T₂}/Σ_univ^E → 0` since `Σ_univ^E → ∞`. -/ - --/-- **Fibre-counting bound for `ℝ≥0∞`-valued sums.** If every fibre `g ⁻¹' {y}` is finite with at --most `d` elements, then `Σ_b f(g b) ≤ d · Σ_y f y`: group `b` by its image `g b`, on each fibre --the summand is the constant `f y`, and the fibre has `≤ d` terms. -/ --private theorem tsum_comp_le_card_fibre_mul {β γ : Type*} (g : β → γ) (f : γ → ℝ≥0∞) (d : ℕ) -- (hfin : ∀ y, Finite (g ⁻¹' {y} : Set β)) (hfib : ∀ y, Nat.card (g ⁻¹' {y} : Set β) ≤ d) : -- ∑' b, f (g b) ≤ (d : ℝ≥0∞) * ∑' y, f y := by -- rw [← ENNReal.tsum_fiberwise (fun b ↦ f (g b)) g, ← ENNReal.tsum_mul_left] -- refine ENNReal.tsum_le_tsum (fun y ↦ ?_) -- rw [tsum_congr (fun b : (g ⁻¹' {y} : Set β) ↦ by rw [b.2])] -- haveI := hfin y -- letI := Fintype.ofFinite (g ⁻¹' {y} : Set β) -- rw [tsum_fintype, Finset.sum_const, Finset.card_univ, ← Nat.card_eq_fintype_card, nsmul_eq_mul] -- gcongr -- exact_mod_cast hfib y -- --/-- **Fibre-counting bound for real-valued sums.** The `ℝ`-valued companion of --`tsum_comp_le_card_fibre_mul`: for nonnegative summable `FA, FK` with `FA b ≤ FK (g b)` and every --fibre `g ⁻¹' {y}` finite of size `≤ d`, the sum `Σ_b FA b` is at most `d · Σ_y FK y`. -/ --private theorem tsum_real_comp_le_card_fibre_mul {β γ : Type*} (g : β → γ) (FA : β → ℝ) -- (FK : γ → ℝ) (d : ℕ) (hsummA : Summable FA) (hsummK : Summable FK) (hnonnegA : ∀ b, 0 ≤ FA b) -- (hnonnegK : ∀ y, 0 ≤ FK y) (hterm : ∀ b, FA b ≤ FK (g b)) -- (hfin : ∀ y, Finite (g ⁻¹' {y} : Set β)) (hfib : ∀ y, Nat.card (g ⁻¹' {y} : Set β) ≤ d) : -- ∑' b, FA b ≤ (d : ℝ) * ∑' y, FK y := by -- have hchain : ∑' b, ENNReal.ofReal (FA b) -- ≤ (d : ℝ≥0∞) * ∑' y, ENNReal.ofReal (FK y) := -- calc ∑' b, ENNReal.ofReal (FA b) ≤ ∑' b, ENNReal.ofReal (FK (g b)) := -- ENNReal.tsum_le_tsum fun b ↦ ENNReal.ofReal_le_ofReal (hterm b) -- _ ≤ (d : ℝ≥0∞) * ∑' y, ENNReal.ofReal (FK y) := -- tsum_comp_le_card_fibre_mul g (ENNReal.ofReal <| FK ·) d hfin hfib -- rw [← ENNReal.ofReal_tsum_of_nonneg hnonnegA hsummA, -- ← ENNReal.ofReal_tsum_of_nonneg hnonnegK hsummK] at hchain -- rw [← ENNReal.toReal_ofReal (tsum_nonneg hnonnegA), -- ← ENNReal.toReal_ofReal (mul_nonneg (Nat.cast_nonneg d) (tsum_nonneg hnonnegK)), -- ENNReal.ofReal_mul (Nat.cast_nonneg d), ENNReal.ofReal_natCast] -- exact ENNReal.toReal_mono (ENNReal.mul_ne_top (by simp) ENNReal.ofReal_ne_top) hchain -- - omit [IsGalois K L] in - /-- For a degree-`≥ 2` prime `P` of `𝓞 E` over `𝔭 = P ∩ 𝓞 K`, the Dirichlet term is dominated by - the square term of `𝔭`: `N P^{-s} ≤ N𝔭^{-2}` for `1 < s`. Here `N P = N𝔭^{f}` with `f ≥ 2` and - `N𝔭 ≥ 2`, so the exponent `f·s ≥ 2` dominates. -/ - private theorem absNorm_rpow_neg_le_under_sq (σ : Gal(L/K)) - (P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) [P.IsPrime] -- (hPb : P ≠ ⊥) {s : ℝ} (hs : 1 < s) (hdeg : 2 ≤ (P.under (𝓞 K)).inertiaDeg' P) : -+ (hPb : P ≠ ⊥) {s : ℝ} (hs : 1 < s) (hdeg : 2 ≤ P.inertiaDeg (𝓞 K)) : - (Ideal.absNorm P : ℝ) ^ (-s) ≤ (Ideal.absNorm (P.under (𝓞 K)) : ℝ) ^ (-(2 : ℝ)) := by - have hppr : (P.under (𝓞 K)).IsPrime := inferInstance -- have hpbot : P.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPb -- haveI : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) -- have hpow := Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver P (P.under (𝓞 K)) hppr hpbot -+ have hpbot : P.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) hPb -+ have : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) -+ have hpow := (Ideal.absNorm_pow_inertiaDeg (P.under (𝓞 K)) P).symm - have hn2 : 2 ≤ Ideal.absNorm (P.under (𝓞 K)) := by - have h0 : Ideal.absNorm (P.under (𝓞 K)) ≠ 0 := Ideal.absNorm_eq_zero_iff.not.mpr hpbot - have h1 : Ideal.absNorm (P.under (𝓞 K)) ≠ 1 := Ideal.absNorm_eq_one_iff.not.mpr hppr.ne_top - omega - rw [hpow, Nat.cast_pow, -- ← Real.rpow_natCast (Ideal.absNorm (P.under (𝓞 K)) : ℝ) ((P.under (𝓞 K)).inertiaDeg' P), -+ ← Real.rpow_natCast (Ideal.absNorm (P.under (𝓞 K)) : ℝ) (P.inertiaDeg (𝓞 K)), - ← Real.rpow_mul (by positivity)] - refine Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast Nat.one_le_of_lt hn2) ?_ -- nlinarith [mul_le_mul (show (2 : ℝ) ≤ ((P.under (𝓞 K)).inertiaDeg' P : ℝ) by exact_mod_cast hdeg) -- hs.le (by norm_num) (by positivity : (0 : ℝ) ≤ ((P.under (𝓞 K)).inertiaDeg' P : ℝ))] -+ nlinarith [mul_le_mul (show (2 : ℝ) ≤ (P.inertiaDeg (𝓞 K) : ℝ) by exact_mod_cast hdeg) -+ hs.le (by norm_num) (by positivity : (0 : ℝ) ≤ (P.inertiaDeg (𝓞 K) : ℝ))] - - omit [IsGalois K L] in - /-- The number of primes of `𝓞 E` over a fixed maximal prime `𝔭` of `𝓞 K` is at most `[E : K]`, - a `Nat.card` repackaging of `Ideal.card_primesOverFinset_le_finrank`. -/ - private theorem card_primesOver_le_finrank (σ : Gal(L/K)) - [NoZeroSMulDivisors (𝓞 K) (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))] -- (𝔭 : Ideal (𝓞 K)) [𝔭.IsMaximal] (h𝔭 : 𝔭 ≠ ⊥) : -+ (𝔭 : Ideal (𝓞 K)) [𝔭.IsMaximal] (_h𝔭 : 𝔭 ≠ ⊥) : - Nat.card {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // - P.IsPrime ∧ P.LiesOver 𝔭} - ≤ Module.finrank K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) := by -- letI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -- (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- rw [show {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // -- P.IsPrime ∧ P.LiesOver 𝔭} -- = ↥(𝔭.primesOver (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) from rfl, -- Nat.card_coe_set_eq, ← IsDedekindDomain.coe_primesOverFinset h𝔭, Set.ncard_coe_finset] -- exact Ideal.card_primesOverFinset_le_finrank (R := 𝓞 K) -- (S := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) -- (K := K) (L := ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) h𝔭 -+ classical -+ let E := IntermediateField.fixedField (Subgroup.zpowers σ) -+ let : IsScalarTower K ↥E L := E.isScalarTower_mid' -+ let : Finite (𝔭.primesOver (𝓞 ↥E)) := -+ (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 ↥E)).to_subtype -+ let : Fintype (𝔭.primesOver (𝓞 ↥E)) := Fintype.ofFinite _ -+ change Nat.card (𝔭.primesOver (𝓞 ↥E)) ≤ Module.finrank K ↥E -+ calc -+ Nat.card (𝔭.primesOver (𝓞 ↥E)) = ∑ _q : 𝔭.primesOver (𝓞 ↥E), (1 : ℕ) := by -+ simp [Nat.card_eq_fintype_card] -+ _ ≤ ∑ q : 𝔭.primesOver (𝓞 ↥E), q.1.ramificationIdx (𝓞 K) * q.1.inertiaDeg (𝓞 K) := by -+ apply Finset.sum_le_sum -+ intro q _ -+ have : q.1.IsPrime := q.2.1 -+ exact Nat.mul_pos (Ideal.ramificationIdx_pos q.1 (𝓞 K)) (Ideal.inertiaDeg_pos q.1 (𝓞 K)) -+ _ = Module.finrank (𝓞 K) (𝓞 ↥E) := Ideal.sum_ramification_inertia_eq_finrank 𝔭 (𝓞 ↥E) -+ _ = Module.finrank K ↥E := (IsFractionRing.finrank_eq (𝓞 K) K (𝓞 ↥E) ↥E).symm - - /-- **The degree-`≥ 2` part of `T₂` is bounded by a constant.** For `1 < s`, the partial sum over - the set `A` of primes `P` of `𝓞 E` whose underlying `K`-prime is unramified in `L` but of inertia -@@ -958,13 +926,13 @@ degree `≥ 2` is bounded by `[E:K]·Σ_𝔭 N𝔭^{-2}`. Indeed `N P = N𝔭^{f - private theorem primeIdealZetaSum_degTwo_le (σ : Gal(L/K)) {s : ℝ} - (hs : 1 < s) (Aset : Set (Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))))) - (hA : Aset = {P | P.IsPrime ∧ P ≠ ⊥ ∧ -- UnramifiedIn K L (P.under (𝓞 K)) ∧ 2 ≤ (P.under (𝓞 K)).inertiaDeg' P}) : -+ UnramifiedIn K L (P.under (𝓞 K)) ∧ 2 ≤ P.inertiaDeg (𝓞 K)}) : - primeIdealZetaSum Aset s - ≤ (Module.finrank K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) : ℝ) - * primeIdealZetaSum (univ : Set (Ideal (𝓞 K))) 2 := by -- letI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ let : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- haveI : NoZeroSMulDivisors (𝓞 K) -+ have : NoZeroSMulDivisors (𝓞 K) - (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) := - ⟨fun {c x} h ↦ by - rw [Algebra.smul_def, mul_eq_zero] at h -@@ -974,24 +942,24 @@ private theorem primeIdealZetaSum_degTwo_le (σ : Gal(L/K)) {s : ℝ} - set KP := {𝔭 : Ideal (𝓞 K) // 𝔭 ∈ (univ : Set (Ideal (𝓞 K))) ∧ 𝔭.IsPrime ∧ 𝔭 ≠ ⊥} with hKP - have hunder : ∀ P : AP, (P.1.under (𝓞 K)).IsPrime ∧ P.1.under (𝓞 K) ≠ ⊥ := by - rintro ⟨P, hPA, hPp, hPb⟩ -- haveI := hPp -- exact ⟨inferInstance, Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPb⟩ -+ have := hPp -+ exact ⟨inferInstance, Ideal.IsIntegral.under_ne_bot (𝓞 K) hPb⟩ - set g : AP → KP := fun P ↦ ⟨P.1.under (𝓞 K), mem_univ _, (hunder P).1, (hunder P).2⟩ with hg - have hterm : ∀ P : AP, (Ideal.absNorm P.1 : ℝ) ^ (-s) - ≤ (Ideal.absNorm (g P).1 : ℝ) ^ (-(2 : ℝ)) := by - rintro ⟨P, hPA, hPp, hPb⟩ -- haveI := hPp -+ have := hPp - rw [hA] at hPA - exact absNorm_rpow_neg_le_under_sq σ P hPb hs hPA.2.2.2 - have hinj : ∀ 𝔭 : KP, Finite (g ⁻¹' {𝔭} : Set AP) ∧ - Nat.card (g ⁻¹' {𝔭} : Set AP) - ≤ Module.finrank K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) := by - intro 𝔭 -- haveI := 𝔭.2.2.1 -- haveI : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 -+ have := 𝔭.2.2.1 -+ have : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 - have hmem : ∀ P : (g ⁻¹' {𝔭} : Set AP), P.1.1.IsPrime ∧ P.1.1.LiesOver 𝔭.1 := by - rintro ⟨⟨P, hPA, hPp, hPb⟩, hgP⟩ -- haveI := hPp -+ have := hPp - exact ⟨hPp, ⟨(congrArg Subtype.val hgP : P.under (𝓞 K) = 𝔭.1) ▸ - (Ideal.over_under (A := 𝓞 K) (P := P)).over⟩⟩ - set hmap : (g ⁻¹' {𝔭} : Set AP) → {P : Ideal (𝓞 ↥(IntermediateField.fixedField -@@ -999,7 +967,7 @@ private theorem primeIdealZetaSum_degTwo_le (σ : Gal(L/K)) {s : ℝ} - have hmapinj : Function.Injective hmap := by - rintro ⟨⟨P, hP⟩, hgP⟩ ⟨⟨Q, hQ⟩, hgQ⟩ hPQ - exact Subtype.ext (Subtype.ext (by simpa only [hhmap, Subtype.mk.injEq] using hPQ)) -- haveI : Finite {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // -+ have : Finite {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // - P.IsPrime ∧ P.LiesOver 𝔭.1} := - (IsDedekindDomain.primesOver_finite 𝔭.1 _).to_subtype - exact ⟨Finite.of_injective hmap hmapinj, (Nat.card_le_card_of_injective hmap hmapinj).trans -@@ -1021,12 +989,12 @@ private theorem ramifiedBelow_finite (σ : Gal(L/K)) - (𝔭.primesOver (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))))) ?_) - · rw [hB] - rintro P ⟨hPp, hPb, hPnu⟩ -- haveI := hPp -- exact Set.mem_biUnion ⟨inferInstance, Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPb, hPnu⟩ -+ have := hPp -+ exact Set.mem_biUnion ⟨inferInstance, Ideal.IsIntegral.under_ne_bot (𝓞 K) hPb, hPnu⟩ - ⟨hPp, Ideal.over_under (A := 𝓞 K) (P := P)⟩ - · rintro 𝔭 ⟨hp, hb, -⟩ -- haveI := hp -- haveI : 𝔭.IsMaximal := hp.isMaximal hb -+ have := hp -+ have : 𝔭.IsMaximal := hp.isMaximal hb - exact IsDedekindDomain.primesOver_finite 𝔭 _ - - /-- **LEAF B: the degree-`≥ 2` part of `T` vanishes in the density ratio** (Sharifi 7.2.2 -@@ -1051,32 +1019,32 @@ private theorem primeIdealZetaSum_T2_div_univ_tendsto_zero - P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ - frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P - = ConjClasses.mk σE} | -- (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))}) : -+ P.inertiaDeg (𝓞 K) = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))}) : - Tendsto (fun s : ℝ ↦ primeIdealZetaSum T₂set s - / primeIdealZetaSum (univ : Set (Ideal (𝓞 ↥(IntermediateField.fixedField - (Subgroup.zpowers σ))))) s) (𝓝[>] 1) (𝓝 0) := by -- haveI : IsGalois ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsGalois ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - IsGalois.tower_top_intermediateField _ - set Aset := {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | - P.IsPrime ∧ P ≠ ⊥ ∧ UnramifiedIn K L (P.under (𝓞 K)) ∧ -- 2 ≤ (P.under (𝓞 K)).inertiaDeg' P} with hAdef -+ 2 ≤ P.inertiaDeg (𝓞 K)} with hAdef - set Bset := {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | - P.IsPrime ∧ P ≠ ⊥ ∧ ¬ UnramifiedIn K L (P.under (𝓞 K))} with hBdef - have hsub : T₂set ⊆ Aset ∪ Bset := by - rw [hT₂] - rintro P ⟨⟨hPp, hPunr, hPfr⟩, hPnotT1⟩ -- haveI := hPp -- simp only [Set.mem_setOf_eq, not_and] at hPnotT1 -+ have := hPp -+ simp only [Set.mem_ofPred_eq, not_and] at hPnotT1 - have hPb : P ≠ ⊥ := UnramifiedIn.ne_bot _ L hPunr - by_cases hunrK : UnramifiedIn K L (P.under (𝓞 K)) - · refine Or.inl ⟨hPp, hPb, hunrK, ?_⟩ -- have hdegne : (P.under (𝓞 K)).inertiaDeg' P ≠ 1 := fun hdeg1 ↦ -+ have hdegne : P.inertiaDeg (𝓞 K) ≠ 1 := fun hdeg1 ↦ - hPnotT1 ⟨hPp, hPunr, hPfr⟩ hdeg1 hunrK - have hppr : (P.under (𝓞 K)).IsPrime := inferInstance -- haveI : (P.under (𝓞 K)).IsMaximal := -- hppr.isMaximal (Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPb) -- haveI : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) -- have hpos : 0 < (P.under (𝓞 K)).inertiaDeg' P := Ideal.inertiaDeg_pos' _ _ -+ have : (P.under (𝓞 K)).IsMaximal := -+ hppr.isMaximal (Ideal.IsIntegral.under_ne_bot (𝓞 K) hPb) -+ have : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) -+ have hpos : 0 < P.inertiaDeg (𝓞 K) := Ideal.inertiaDeg_pos P (𝓞 K) - omega - · exact Or.inr ⟨hPp, hPb, hunrK⟩ - have hdisj : Disjoint Aset Bset := by -@@ -1149,9 +1117,9 @@ theorem density_lift_through_fixedField - frobeniusClass K L 𝔭 = ConjClasses.mk σ} - ((Nat.card (ConjClasses.mk σ).carrier : ℝ) / Nat.card Gal(L/K)) := by - subst _hEfix -- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := -+ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := - (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' -- haveI : IsMulCommutative Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := -+ have : IsMulCommutative Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := - isMulCommutative_galGroup_fixedField σ - have horderE' : - orderOf σ = Nat.card Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := -@@ -1160,7 +1128,7 @@ theorem density_lift_through_fixedField - P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ - frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P - = ConjClasses.mk σE} with hTset -- set T₁set := {P ∈ Tset | (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} -+ set T₁set := {P ∈ Tset | P.inertiaDeg (𝓞 K) = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} - with hT₁set - set T₂set := Tset \ T₁set with hT₂set - have hT₁sub : T₁set ⊆ Tset := fun x hx ↦ hx.1 -@@ -1212,10 +1180,10 @@ theorem density_lift_through_fixedField - have hT₁flat : T₁set = {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | - P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ - frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P = ConjClasses.mk σE ∧ -- (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} := by -+ P.inertiaDeg (𝓞 K) = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} := by - rw [hT₁set, hTset] - ext P -- simp only [Set.mem_setOf_eq] -+ simp only [Set.mem_ofPred_eq] - tauto - have hleafA := primeIdealZetaSum_fibre_eq_smul σ σE hσE horderE' hs - rw [← hT₁flat] at hleafA -diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/CharacterOrthogonality.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/CharacterOrthogonality.lean -index a82fed3f7..a4a9a2d72 100644 ---- a/projects/Chebotarev/CebotarevDensity/ForMathlib/CharacterOrthogonality.lean -+++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/CharacterOrthogonality.lean -@@ -78,7 +78,7 @@ theorem card_mul_eq_sum_of_sum_char_mul_eq_zero {G : Type*} [CommGroup G] [Finty - intro s - by_cases hs : s = u - · subst hs; simp -- · rw [if_neg hs] -+ · rw [ite_eq_right hs] - exact sum_char_apply_eq_zero_of_ne_one fun h ↦ hs (inv_mul_eq_one.mp h).symm - calc (Fintype.card (G →* Rˣ) : R) * f u - = ∑ s : G, (if s = u then (Fintype.card (G →* Rˣ) : R) else 0) * f s := by -diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/IdealCongruenceCount.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/IdealCongruenceCount.lean -index 96f816150..4499927f7 100644 ---- a/projects/Chebotarev/CebotarevDensity/ForMathlib/IdealCongruenceCount.lean -+++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/IdealCongruenceCount.lean -@@ -331,7 +331,7 @@ theorem exists_card_coset_inter_smul_sub_volume_mul_rpow_le - set Ts : (ι → ℝ) →L[ℝ] (ι → ℝ) := (T.symm.toContinuousLinearEquiv : (ι → ℝ) →L[ℝ] (ι → ℝ)) - with hTs - have hTslip : LipschitzWith ‖Ts‖₊ (T.symm : (ι → ℝ) → (ι → ℝ)) := by -- simpa [hTs] using Ts.lipschitz -+ simpa [hTs] using Ts.lipschitzWith - have hD'bdd : Bornology.IsBounded D' := hTslip.isBounded_image hbdd - have hD'meas : MeasurableSet D' := - (T.symm.toContinuousLinearEquiv.toHomeomorph.toMeasurableEquiv).measurableSet_image.mpr hmeas -@@ -434,10 +434,10 @@ private theorem norm_eq_prod_real_emb_mul_prod_complex {K : Type*} [Field K] [Nu - star_involutive.eq_iff] - rw [hfilter] - by_cases hw : IsReal w -- · rw [dif_pos hw, ComplexEmbedding.isReal_iff.mp (isReal_iff.mp hw), -+ · rw [dite_eq_left hw, ComplexEmbedding.isReal_iff.mp (isReal_iff.mp hw), - Finset.insert_eq_self.mpr (Finset.mem_singleton_self _), Finset.prod_singleton, - embedding_of_isReal_apply hw] -- · rw [dif_neg hw, Finset.prod_pair] -+ · rw [dite_eq_right hw, Finset.prod_pair] - · rw [ComplexEmbedding.conjugate_coe_eq, Complex.mul_conj] - norm_cast - rw [Complex.normSq_eq_norm_sq] -@@ -452,8 +452,8 @@ private theorem norm_eq_prod_real_emb_mul_prod_complex {K : Type*} [Field K] [Nu - simp_rw [hperplace] - rw [prod_eq_prod_mul_prod] - congr 1 -- · rw [Finset.prod_congr rfl (fun w _ ↦ by rw [dif_pos w.2]), Complex.ofReal_prod] -- · rw [Finset.prod_congr rfl (fun w _ ↦ by rw [dif_neg (not_isReal_iff_isComplex.mpr w.2)]), -+ · rw [Finset.prod_congr rfl (fun w _ ↦ by rw [dite_eq_left w.2]), Complex.ofReal_prod] -+ · rw [Finset.prod_congr rfl (fun w _ ↦ by rw [dite_eq_right (not_isReal_iff_isComplex.mpr w.2)]), - Complex.ofReal_prod] - exact_mod_cast hcc - -@@ -520,7 +520,7 @@ open Ideal in - /-- **Class split of the residue count.** The number of nonzero integral ideals of norm `≤ N` - with norm residue `a (mod c)` is the sum over the (finite) class group of the per-class counts. - The class group is a `Fintype`; finiteness of each fibre follows from --`Ideal.finite_setOf_absNorm_le₀`. -/ -+`Ideal.finite_setOfPred_absNorm_le₀`. -/ - private theorem card_norm_le_residue_eq_sum_class {K : Type*} [Field K] [NumberField K] - (c : ℕ) [NeZero c] (a : ZMod c) (N : ℕ) : - Nat.card {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ N ∧ -@@ -530,7 +530,7 @@ private theorem card_norm_le_residue_eq_sum_class {K : Type*} [Field K] [NumberF - ((Ideal.absNorm (I : Ideal (𝓞 K)) : ZMod c)) = a) ∧ ClassGroup.mk0 I = C} := by - classical - have hbase : Finite {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ N} := -- Ideal.finite_setOf_absNorm_le₀ N -+ Ideal.finite_setOfPred_absNorm_le₀ N - have hfin : Finite {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ N ∧ - ((Ideal.absNorm (I : Ideal (𝓞 K)) : ZMod c)) = a} := - Finite.of_injective (fun I ↦ (⟨I.1, I.2.1⟩ : -@@ -660,7 +660,7 @@ private theorem cone_normLe_eq_smul_normLeOne {K : Type*} [Field K] [NumberField - have ht0 : (0 : ℝ) < t := lt_of_lt_of_le one_pos ht - have htne : t ≠ 0 := ht0.ne' - ext x -- simp only [Set.mem_setOf_eq, Set.mem_smul_set, normLeOne, Set.mem_inter_iff, Set.mem_setOf_eq] -+ simp only [Set.mem_ofPred_eq, Set.mem_smul_set, normLeOne, Set.mem_inter_iff, Set.mem_ofPred_eq] - constructor - · rintro ⟨hcone, hnorm⟩ - refine ⟨t⁻¹ • x, ⟨(smul_mem_iff_mem (inv_ne_zero htne)).mpr hcone, ?_⟩, ?_⟩ -@@ -736,8 +736,8 @@ private theorem exists_lipschitz_cube_cover_hyperplane_slab {ι : Type*} [Fintyp - rw [dist_pi_le_iff (by positivity)] - intro i - by_cases hij : i = j -- · simp only [hφ, dif_pos hij, dist_self]; positivity -- · simp only [hφ, dif_neg hij] -+ · simp only [hφ, dite_eq_left hij, dist_self]; positivity -+ · simp only [hφ, dite_eq_right hij] - have hreorg : (2 * R) * c (σ.symm ⟨i, hij⟩) - R - ((2 * R) * c' (σ.symm ⟨i, hij⟩) - R) - = (2 * R) * (c (σ.symm ⟨i, hij⟩) - c' (σ.symm ⟨i, hij⟩)) := by ring - rw [Real.dist_eq, hreorg, abs_mul, abs_of_nonneg (by positivity : (0 : ℝ) ≤ 2 * R), -@@ -752,8 +752,8 @@ private theorem exists_lipschitz_cube_cover_hyperplane_slab {ι : Type*} [Fintyp - refine ⟨0, ⟨le_refl _, zero_le_one⟩, ?_⟩ - ext i; simp only [hφ] - by_cases hij : i = j -- · rw [dif_pos hij, hx0]; rfl -- · rw [dif_neg hij, hx0]; simp [← hR0] -+ · rw [dite_eq_left hij, hx0]; rfl -+ · rw [dite_eq_right hij, hx0]; simp [← hR0] - · refine ⟨fun k ↦ (x (σ k) + R) / (2 * R), ⟨?_, ?_⟩, ?_⟩ - · intro k; simp only [Pi.zero_apply] - rw [le_div_iff₀ (by positivity)]; have := (abs_le.mp (hxbd (σ k))).1; linarith -@@ -761,8 +761,8 @@ private theorem exists_lipschitz_cube_cover_hyperplane_slab {ι : Type*} [Fintyp - rw [div_le_one (by positivity)]; have := (abs_le.mp (hxbd (σ k))).2; linarith - · ext i - by_cases hij : i = j -- · rw [hφ]; simp only; rw [dif_pos hij, hij]; exact hxj.symm -- · rw [hφ]; simp only [dif_neg hij, Equiv.apply_symm_apply]; field_simp; ring -+ · rw [hφ]; simp only; rw [dite_eq_left hij, hij]; exact hxj.symm -+ · rw [hφ]; simp only [dite_eq_right hij, Equiv.apply_symm_apply]; field_simp; ring - - /-- **Union of two Lipschitz cube covers.** If `A` and `B` are each covered by finitely many - `Lipschitz`-images of `[0,1]^(card ι - 1)`, so is `A ∪ B` (concatenate the families, take the max -@@ -822,13 +822,13 @@ private theorem frontier_signOrthant_subset {ι κ : Type*} [Finite κ] (g : κ - set O : Set (ι → ℝ) := {y | (∀ k ∈ s, y (g k) ≤ 0) ∧ (∀ k ∉ s, 0 ≤ y (g k))} with hO - set Os : Set (ι → ℝ) := {y | (∀ k ∈ s, y (g k) < 0) ∧ (∀ k ∉ s, 0 < y (g k))} with hOs - have hOclosed : IsClosed O := by -- simp only [hO, Set.setOf_and, Set.setOf_forall] -+ simp only [hO, Set.ofPred_and, Set.ofPred_forall] - exact (isClosed_iInter fun k ↦ isClosed_iInter fun _ ↦ - isClosed_le (continuous_apply (g k)) continuous_const).inter - (isClosed_iInter fun k ↦ isClosed_iInter fun _ ↦ - isClosed_le continuous_const (continuous_apply (g k))) - have hOsopen : IsOpen Os := by -- simp only [hOs, Set.setOf_and, Set.setOf_forall] -+ simp only [hOs, Set.ofPred_and, Set.ofPred_forall] - exact (isOpen_iInter_of_finite fun k ↦ isOpen_iInter_of_finite fun _ ↦ - isOpen_lt (continuous_apply (g k)) continuous_const).inter - (isOpen_iInter_of_finite fun k ↦ isOpen_iInter_of_finite fun _ ↦ -@@ -840,7 +840,7 @@ private theorem frontier_signOrthant_subset {ι κ : Type*} [Finite κ] (g : κ - rw [frontier_eq_closure_inter_closure] at hy - rw [interior_eq_compl_closure_compl]; exact fun hh ↦ hh hy.2 - by_contra hcon -- simp only [Set.mem_iUnion, Set.mem_setOf_eq, not_exists] at hcon -+ simp only [Set.mem_iUnion, Set.mem_ofPred_eq, not_exists] at hcon - exact hyni (mem_interior.mpr ⟨Os, hsub, hOsopen, - ⟨fun k hk ↦ lt_of_le_of_ne (hyO.1 k hk) (hcon k), - fun k hk ↦ lt_of_le_of_ne (hyO.2 k hk) (Ne.symm (hcon k))⟩⟩) -@@ -985,14 +985,14 @@ private theorem exists_card_cell_sub_mul_rpow_le_explicit {ι : Type*} [Fintype - * t ^ (Fintype.card ι)| - ≤ C * t ^ (Fintype.card ι - 1 : ℕ) := by - classical -- haveI : Fintype κ := Fintype.ofFinite κ -+ have : Fintype κ := Fintype.ofFinite κ - set T' : (ι → ℝ) ≃ₗ[ℝ] (ι → ℝ) := (LinearEquiv.smulOfNeZero ℝ (ι → ℝ) (m : ℝ) hm).trans T - set Ds : Set (ι → ℝ) := - D₀ ∩ {y : ι → ℝ | (∀ k ∈ s, y (g k) ≤ 0) ∧ (∀ k ∉ s, 0 ≤ y (g k))} - have hDsbdd : Bornology.IsBounded Ds := hbdd.subset Set.inter_subset_left - have hOclosed : IsClosed {y : ι → ℝ | (∀ k ∈ s, y (g k) ≤ 0) ∧ (∀ k ∉ s, 0 ≤ y (g k))} := by - classical -- rw [setOf_and] -+ rw [ofPred_and] - refine IsClosed.inter ?_ ?_ - · have h : {y : ι → ℝ | ∀ k ∈ s, y (g k) ≤ 0} = ⋂ k ∈ s, {y : ι → ℝ | y (g k) ≤ 0} := by - ext y; simp -@@ -1514,7 +1514,7 @@ private theorem exists_card_residue_fibre_sub_mul_rpow_le_explicit {K : Type*} [ - ((Φ.toHomeomorph.toMeasurableEquiv).measurableSet_image.mpr (measurableSet_normLeOne K)) - hcov (Sum.inl : {w : InfinitePlace K // IsReal w} → index K) s - refine ⟨cellC, fun t ht ↦ ?_⟩ -- rw [if_pos ⟨a₀, horth₀, hcos₀, hres₀⟩] -+ rw [ite_eq_left ⟨a₀, horth₀, hcos₀, hres₀⟩] - have hfibre : Nat.card {a : idealSet K J // - (mixedEmbedding.norm (a : mixedSpace K) ≤ t ^ Module.finrank ℚ K ∧ - ((intNorm (idealSetEquiv K J a).val : ZMod m) = (b : ZMod m))) ∧ -@@ -1538,7 +1538,7 @@ private theorem exists_card_residue_fibre_sub_mul_rpow_le_explicit {K : Type*} [ - rw [hpow1, hpow2] - exact hcell (T (fun i ↦ ((k i).val : ℝ))) t ht - · refine ⟨0, fun t ht ↦ ?_⟩ -- rw [if_neg hQ] -+ rw [ite_eq_right hQ] - have hempty : IsEmpty {a : idealSet K J // - (mixedEmbedding.norm (a : mixedSpace K) ≤ t ^ Module.finrank ℚ K ∧ - ((intNorm (idealSetEquiv K J a).val : ZMod m) = (b : ZMod m))) ∧ -@@ -1590,14 +1590,14 @@ private theorem exists_card_residue_fibre_sub_mul_rpow_le {K : Type*} [Field K] - open Ideal NumberField.mixedEmbedding NumberField.mixedEmbedding.fundamentalCone Units in - /-- **Finiteness of bounded-norm cone points.** The cone points of `idealSet K J` of norm `≤ s` - form a finite set: they inject (via `integerSetEquiv ∘ idealSetMap`) into the product of the --finite set of integral ideals of norm `≤ ⌊s⌋` (`Ideal.finite_setOf_absNorm_le₀`) with the finite -+finite set of integral ideals of norm `≤ ⌊s⌋` (`Ideal.finite_setOfPred_absNorm_le₀`) with the finite - torsion group. -/ - private theorem finite_idealSet_norm_le {K : Type*} [Field K] [NumberField K] - (J : (Ideal (𝓞 K))⁰) (s : ℝ) : - Finite {a : idealSet K J // mixedEmbedding.norm (a : mixedSpace K) ≤ s} := by - classical - have : Finite {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ ⌊s⌋₊} := -- (Ideal.finite_setOf_absNorm_le₀ ⌊s⌋₊).to_subtype -+ (Ideal.finite_setOfPred_absNorm_le₀ ⌊s⌋₊).to_subtype - refine Finite.of_injective (β := {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ ⌊s⌋₊} × - torsion K) (fun a ↦ ⟨⟨(integerSetEquiv K (idealSetMap K J a.1)).1.1, ?_⟩, - (integerSetEquiv K (idealSetMap K J a.1)).2⟩) ?_ -@@ -1838,7 +1838,7 @@ private theorem exists_card_norm_le_residue_class_eq_sub_mul_rpow_le - classical - obtain ⟨J, hJ⟩ := ClassGroup.mk0_surjective C⁻¹ - have hNJ : 0 < Ideal.absNorm (J : Ideal (𝓞 K)) := absNorm_pos_of_nonZeroDivisors J -- haveI : NeZero (c * Ideal.absNorm (J : Ideal (𝓞 K))) := -+ have : NeZero (c * Ideal.absNorm (J : Ideal (𝓞 K))) := - ⟨Nat.mul_ne_zero (NeZero.ne c) hNJ.ne'⟩ - obtain ⟨κ, C', hκ⟩ := exists_card_dvd_principal_residue_eq_sub_mul_rpow_le - (c * Ideal.absNorm (J : Ideal (𝓞 K))) (a.val * Ideal.absNorm (J : Ideal (𝓞 K))) J -@@ -2403,7 +2403,7 @@ private theorem crt_single_coset {ι : Type*} [Finite ι] (L L' : Submodule ℤ - = {z | ∃ x ∈ M, z = m • x} := by - intro M - ext z -- simp only [Set.mem_smul_set, SetLike.mem_coe, Set.mem_setOf_eq] -+ simp only [Set.mem_smul_set, SetLike.mem_coe, Set.mem_ofPred_eq] - exact ⟨fun ⟨x, hx, h⟩ ↦ ⟨x, hx, by rw [← h, Nat.cast_smul_eq_nsmul]⟩, - fun ⟨x, hx, h⟩ ↦ ⟨x, hx, by rw [h, Nat.cast_smul_eq_nsmul]⟩⟩ - have hbij := hcop.nsmul_right_bijective -@@ -2429,7 +2429,7 @@ private theorem crt_single_coset {ι : Type*} [Finite ι] (L L' : Submodule ℤ - rw [QuotientAddGroup.eq_zero_iff, AddSubgroup.mem_addSubgroupOf] at hq0 - simpa using hq0 - ext a -- simp only [Set.mem_setOf_eq, hmsmul, Set.mem_vadd_set, Set.mem_setOf_eq, vadd_eq_add] -+ simp only [Set.mem_ofPred_eq, hmsmul, Set.mem_vadd_set, Set.mem_ofPred_eq, vadd_eq_add] - constructor - · rintro ⟨haL', w, ⟨x, hxL, rfl⟩, hweq⟩ - rw [hξeq] at hweq -@@ -2578,7 +2578,7 @@ private theorem exists_card_fibre_dvd_eq_card_cell {K : Type*} [Field K] [Number - have hrel : L'.toAddSubgroup.relIndex L.toAddSubgroup = Ideal.absNorm (𝔟 : Ideal (𝓞 K)) := - relIndex_chart_eq_absNorm J 𝔟 T T' hT hT' - have hNB : 0 < Ideal.absNorm (𝔟 : Ideal (𝓞 K)) := absNorm_pos_of_nonZeroDivisors 𝔟 -- haveI hfin : Finite (L.toAddSubgroup ⧸ L'.toAddSubgroup.addSubgroupOf L.toAddSubgroup) := by -+ have hfin : Finite (L.toAddSubgroup ⧸ L'.toAddSubgroup.addSubgroupOf L.toAddSubgroup) := by - rw [← AddSubgroup.index_ne_zero_iff_finite] - rw [show (L'.toAddSubgroup.addSubgroupOf L.toAddSubgroup).index - = L'.toAddSubgroup.relIndex L.toAddSubgroup from rfl, hrel] -@@ -2779,7 +2779,7 @@ private theorem exists_card_fibre_dvd_residue_sub_mul_rpow_le {K : Type*} [Field - ((fun i ↦ (round ((T.symm (Φ (a : mixedSpace K))) i) : ZMod m)) = k) ∧ - ((intNorm (idealSetEquiv K J a).val : ZMod m) = (b : ZMod m)) - · obtain ⟨a₀, horth₀, hcos₀, hres₀⟩ := hQ -- rw [if_pos ⟨a₀, horth₀, hcos₀, hres₀⟩] -+ rw [ite_eq_left ⟨a₀, horth₀, hcos₀, hres₀⟩] - have hdrop : Nat.card {a : idealSet K (𝔟 * J) // - (mixedEmbedding.norm (a : mixedSpace K) ≤ t ^ d ∧ - ((intNorm (idealSetEquiv K (𝔟 * J) a).val : ZMod m) = (b : ZMod m))) ∧ -@@ -2806,7 +2806,7 @@ private theorem exists_card_fibre_dvd_residue_sub_mul_rpow_le {K : Type*} [Field - have hcell'' := hcell' ξ' t ht - rw [smul_chart_lattice_eq T' m hm, ← hOs, hdetratio, hcard] at hcell'' - exact hcell''.trans (by gcongr; exact le_abs_self _) -- · rw [if_neg hQ, zero_div, zero_mul, sub_zero] -+ · rw [ite_eq_right hQ, zero_div, zero_mul, sub_zero] - have : IsEmpty {a : idealSet K (𝔟 * J) // - (mixedEmbedding.norm (a : mixedSpace K) ≤ t ^ d ∧ - ((intNorm (idealSetEquiv K (𝔟 * J) a).val : ZMod m) = (b : ZMod m))) ∧ -@@ -3011,7 +3011,7 @@ private theorem cardNormLeResidueClassDvd_div_density {K : Type*} [Field K] [Num - have hNJ : 0 < NJ := absNorm_pos_of_nonZeroDivisors J - have hNBc : NB.Coprime c := by rw [hNBdef, ZMod.isUnit_iff_coprime] at hu; exact hu - have hcop : NB.Coprime (c * NJ) := Nat.Coprime.mul_right hNBc (hNJdef ▸ hJcop.symm) -- haveI : NeZero (c * NJ) := ⟨Nat.mul_ne_zero (NeZero.ne c) hNJ.ne'⟩ -+ have : NeZero (c * NJ) := ⟨Nat.mul_ne_zero (NeZero.ne c) hNJ.ne'⟩ - have hm : ((c * NJ : ℕ) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (NeZero.ne (c * NJ)) - obtain ⟨κ, C', hJcone, h𝔟Jcone⟩ := - exists_card_idealSet_residue_real_le_dvd (c * NJ) hm (y.val * NJ) J 𝔟 hcop -diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/LatticePointCount.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/LatticePointCount.lean -index d1ed572f5..ad3fc2802 100644 ---- a/projects/Chebotarev/CebotarevDensity/ForMathlib/LatticePointCount.lean -+++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/LatticePointCount.lean -@@ -296,7 +296,7 @@ theorem abs_card_inter_sub_volume_mul_pow_le {s : Set (ι → ℝ)} - set Tag : Set (ι → ℤ) := {ν | tag n ν ∈ s} with hTag - have himg : index n '' (s ∩ (n : ℝ)⁻¹ • span ℤ (Set.range (Pi.basisFun ℝ ι))) = Tag := by - ext ν -- simp only [hTag, Set.mem_image, Set.mem_inter_iff, Set.mem_setOf_eq] -+ simp only [hTag, Set.mem_image, Set.mem_inter_iff, Set.mem_ofPred_eq] - constructor - · rintro ⟨x, ⟨hxs, hxL⟩, rfl⟩ - rwa [tag_index_eq_self_of_mem_smul_span n hxL] -diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/NormLeOneLipschitz.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/NormLeOneLipschitz.lean -index 8241f43b0..e8d648364 100644 ---- a/projects/Chebotarev/CebotarevDensity/ForMathlib/NormLeOneLipschitz.lean -+++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/NormLeOneLipschitz.lean -@@ -152,19 +152,19 @@ open scoped Classical in - theorem contDiff_faceMapZero : ContDiff ℝ 1 (faceMapZero K) := by - refine (contDiff_expMapBasis K).comp (contDiff_pi.mpr fun w ↦ ?_) - by_cases hw : w = w₀ -- · simpa only [dif_pos hw] using contDiff_const -- · simpa only [dif_neg hw] using contDiff_apply ℝ ℝ _ -+ · simpa only [dite_eq_left hw] using contDiff_const -+ · simpa only [dite_eq_right hw] using contDiff_apply ℝ ℝ _ - - open scoped Classical in - theorem contDiff_faceMapSide (i : {w : InfinitePlace K // w ≠ w₀}) (a : ℝ) : - ContDiff ℝ 1 (faceMapSide K i a) := by - refine (contDiff_apply ℝ ℝ i).smul ((contDiff_expMapBasis K).comp (contDiff_pi.mpr fun w ↦ ?_)) - by_cases hw : w = w₀ -- · simpa only [dif_pos hw] using contDiff_const -- · simp only [dif_neg hw] -+ · simpa only [dite_eq_left hw] using contDiff_const -+ · simp only [dite_eq_right hw] - by_cases hi : (⟨w, hw⟩ : {w // w ≠ w₀}) = i -- · simpa only [if_pos hi] using contDiff_const -- · simpa only [if_neg hi] using contDiff_apply ℝ ℝ _ -+ · simpa only [ite_eq_left hi] using contDiff_const -+ · simpa only [ite_eq_right hi] using contDiff_apply ℝ ℝ _ - - /-- **Abstract topological core.** For an open injective map `f` and a set `s`, if the closure of - `f '' s` is contained in `f '' closure s` together with one extra point `p`, then the frontier of -@@ -222,12 +222,12 @@ private theorem expMapBasis_mem_iUnion_faceMapSide - fun w' ↦ if w' = w₀ then 0 else y w' := by - funext w' - by_cases hw'₀ : w' = w₀ -- · simp only [dif_pos hw'₀, if_pos hw'₀] -- · simp only [dif_neg hw'₀, if_neg hw'₀] -+ · simp only [dite_eq_left hw'₀, ite_eq_left hw'₀] -+ · simp only [dite_eq_right hw'₀, ite_eq_right hw'₀] - by_cases hw'w : (⟨w', hw'₀⟩ : {w // w ≠ w₀}) = i - · obtain rfl : w' = w := by rw [hi, Subtype.mk_eq_mk] at hw'w; exact hw'w -- simp only [if_pos hw'w] -- · simp only [hc, if_neg hw'w] -+ simp only [ite_eq_left hw'w] -+ · simp only [hc, ite_eq_right hw'w] - rw [faceMapSide, expMapBasis_apply'' y, hci, hfun] - refine Set.mem_iUnion.mpr ⟨i, Set.mem_iUnion₂.mpr ⟨y w, ?_, ⟨c, hcmem, hkey⟩⟩⟩ - rcases ha with h | h <;> simp [h] -@@ -252,16 +252,16 @@ theorem image_boundary_subset_faces : - have hIcc : ∀ v : InfinitePlace K, v ≠ w₀ → y v ∈ Icc (0 : ℝ) 1 := fun v hv ↦ by - simpa [hv] using hyc v - by_cases hwe : w = w₀ -- · rw [if_pos hwe, Set.mem_Iio, not_lt, hwe] at hw -+ · rw [ite_eq_left hwe, Set.mem_Iio, not_lt, hwe] at hw - have hy0 : y w₀ = 0 := le_antisymm hw₀ hw - refine Or.inl ⟨fun i ↦ y i.1, ⟨fun i ↦ (hIcc i.1 i.2).1, fun i ↦ (hIcc i.1 i.2).2⟩, ?_⟩ - rw [faceMapZero] - congr 1 - funext v - by_cases hv : v = w₀ -- · rw [dif_pos hv, hv, hy0] -- · simp only [dif_neg hv] -- · rw [if_neg hwe] at hw -+ · rw [dite_eq_left hv, hv, hy0] -+ · simp only [dite_eq_right hv] -+ · rw [ite_eq_right hwe] at hw - have h1 := hIcc w hwe - rw [Set.mem_Ioo, not_and_or, not_lt, not_lt] at hw - refine Or.inr (expMapBasis_mem_iUnion_faceMapSide K hwe hw₀ hIcc ?_) -@@ -598,8 +598,8 @@ theorem mem_iUnion_image_liftToMixed_of_eq - refine Prod.ext (funext fun w ↦ ?_) (funext fun w ↦ ?_) - · simp only [hε, hmodreal w] - by_cases hpos : 0 ≤ x.1 w -- · rw [decide_eq_true hpos, if_pos rfl, one_mul, abs_of_nonneg hpos] -- · rw [decide_eq_false hpos, if_neg (by simp), abs_of_neg (not_le.mp hpos)] -+ · rw [decide_eq_true hpos, ite_eq_left rfl, one_mul, abs_of_nonneg hpos] -+ · rw [decide_eq_false hpos, ite_eq_right (by simp), abs_of_neg (not_le.mp hpos)] - ring - · simp only [hcph w, hmodcplx w] - exact hθeq w -@@ -675,7 +675,7 @@ theorem normLeOne_frontier_lipschitz_cover_index : - refine ⟨m, ‖(Φ : mixedSpace K →L[ℝ] (index K → ℝ))‖₊ * (M * 1), - fun j c ↦ Φ (φ j (fun a ↦ c (g.symm a))), - fun j ↦ (Φ : mixedSpace K →L[ℝ] (index K → ℝ)).lipschitzWith.comp ((hφ j).comp -- (IsometryEquiv.piCongrLeft' (Y := fun _ ↦ ℝ) g).isometry.lipschitz), ?_⟩ -+ (IsometryEquiv.piCongrLeft' (Y := fun _ ↦ ℝ) g).isometry.lipschitzWith), ?_⟩ - rw [← Φ.coe_toHomeomorph, ← Φ.toHomeomorph.image_frontier] - refine (Set.image_mono hcov).trans ?_ - rw [Set.image_iUnion] -diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/TsumFiberBound.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/TsumFiberBound.lean -new file mode 100644 -index 000000000..02e8c54a0 ---- /dev/null -+++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/TsumFiberBound.lean -@@ -0,0 +1,51 @@ -+module -+ -+public import Mathlib.Topology.Algebra.InfiniteSum.Real -+public import Mathlib.Topology.Instances.ENNReal.Lemmas -+ -+/-! Fibre-counting bounds for nonnegative sums. -/ -+ -+@[expose] public section -+ -+open Set -+open scoped ENNReal -+ -+namespace Chebotarev -+ -+/-- **Fibre-counting bound for `ℝ≥0∞`-valued sums.** If every fibre `g ⁻¹' {y}` is finite with at -+most `d` elements, then `Σ_b f(g b) ≤ d · Σ_y f y`: group `b` by its image `g b`, on each fibre -+the summand is the constant `f y`, and the fibre has `≤ d` terms. -/ -+private theorem tsum_comp_le_card_fibre_mul {β γ : Type*} (g : β → γ) (f : γ → ℝ≥0∞) (d : ℕ) -+ (hfin : ∀ y, Finite (g ⁻¹' {y} : Set β)) (hfib : ∀ y, Nat.card (g ⁻¹' {y} : Set β) ≤ d) : -+ ∑' b, f (g b) ≤ (d : ℝ≥0∞) * ∑' y, f y := by -+ rw [← ENNReal.tsum_fiberwise (fun b ↦ f (g b)) g, ← ENNReal.tsum_mul_left] -+ refine ENNReal.tsum_le_tsum (fun y ↦ ?_) -+ rw [tsum_congr (fun b : (g ⁻¹' {y} : Set β) ↦ by rw [b.2])] -+ have := hfin y -+ let := Fintype.ofFinite (g ⁻¹' {y} : Set β) -+ rw [tsum_fintype, Finset.sum_const, Finset.card_univ, ← Nat.card_eq_fintype_card, nsmul_eq_mul] -+ gcongr -+ exact_mod_cast hfib y -+ -+/-- **Fibre-counting bound for real-valued sums.** The `ℝ`-valued companion of -+`tsum_comp_le_card_fibre_mul`: for nonnegative summable `FA, FK` with `FA b ≤ FK (g b)` and every -+fibre `g ⁻¹' {y}` finite of size `≤ d`, the sum `Σ_b FA b` is at most `d · Σ_y FK y`. -/ -+theorem tsum_real_comp_le_card_fibre_mul {β γ : Type*} (g : β → γ) (FA : β → ℝ) -+ (FK : γ → ℝ) (d : ℕ) (hsummA : Summable FA) (hsummK : Summable FK) (hnonnegA : ∀ b, 0 ≤ FA b) -+ (hnonnegK : ∀ y, 0 ≤ FK y) (hterm : ∀ b, FA b ≤ FK (g b)) -+ (hfin : ∀ y, Finite (g ⁻¹' {y} : Set β)) (hfib : ∀ y, Nat.card (g ⁻¹' {y} : Set β) ≤ d) : -+ ∑' b, FA b ≤ (d : ℝ) * ∑' y, FK y := by -+ have hchain : ∑' b, ENNReal.ofReal (FA b) -+ ≤ (d : ℝ≥0∞) * ∑' y, ENNReal.ofReal (FK y) := -+ calc ∑' b, ENNReal.ofReal (FA b) ≤ ∑' b, ENNReal.ofReal (FK (g b)) := -+ ENNReal.tsum_le_tsum fun b ↦ ENNReal.ofReal_le_ofReal (hterm b) -+ _ ≤ (d : ℝ≥0∞) * ∑' y, ENNReal.ofReal (FK y) := -+ tsum_comp_le_card_fibre_mul g (ENNReal.ofReal <| FK ·) d hfin hfib -+ rw [← ENNReal.ofReal_tsum_of_nonneg hnonnegA hsummA, -+ ← ENNReal.ofReal_tsum_of_nonneg hnonnegK hsummK] at hchain -+ rw [← ENNReal.toReal_ofReal (tsum_nonneg hnonnegA), -+ ← ENNReal.toReal_ofReal (mul_nonneg (Nat.cast_nonneg d) (tsum_nonneg hnonnegK)), -+ ENNReal.ofReal_mul (Nat.cast_nonneg d), ENNReal.ofReal_natCast] -+ exact ENNReal.toReal_mono (ENNReal.mul_ne_top (by simp) ENNReal.ofReal_ne_top) hchain -+ -+end Chebotarev -diff --git a/projects/Chebotarev/CebotarevDensity/Frobenius.lean b/projects/Chebotarev/CebotarevDensity/Frobenius.lean -index a5556b12b..de813c534 100644 ---- a/projects/Chebotarev/CebotarevDensity/Frobenius.lean -+++ b/projects/Chebotarev/CebotarevDensity/Frobenius.lean -@@ -102,7 +102,7 @@ theorem UnramifiedIn.ramificationIdx_eq_one [IsGalois K L] - (hP : 𝔓.LiesOver 𝔭) : Ideal.ramificationIdx' (𝔓.under (𝓞 K)) 𝔓 = 1 := by - have := hP - have h𝔓 : 𝔓 ≠ ⊥ := Ideal.ne_bot_of_liesOver_of_ne_bot hunr.1 𝔓 -- have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) h𝔓 -+ have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) h𝔓 - have : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := hunr.2 𝔓 (‹𝔓.IsPrime›.isMaximal h𝔓) hP - rw [Ideal.ramificationIdx'_eq_ramificationIdx (𝔓.under (𝓞 K)) 𝔓 hpbot] - exact Ideal.ramificationIdx_eq_one_of_isUnramifiedAt -@@ -120,7 +120,7 @@ theorem inertiaGroup_trivial_of_unramified [IsGalois K L] - (hunr : Ideal.ramificationIdx' (𝔓.under (𝓞 K)) 𝔓 = 1) : - Ideal.inertia Gal(L/K) 𝔓 = ⊥ := by - have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hunr -- have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPbot -+ have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) hPbot - have : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot - have : (𝔓.under (𝓞 K)).IsMaximal := - (inferInstance : (𝔓.under (𝓞 K)).IsPrime).isMaximal hpbot -@@ -129,7 +129,7 @@ theorem inertiaGroup_trivial_of_unramified [IsGalois K L] - let : Field (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.Quotient.field _ - let : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ - exact IsGalois.to_isSeparable -- haveI : Finite (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.finiteQuotientOfFreeOfNeBot _ hpbot -+ have : Finite (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.finiteQuotientOfFreeOfNeBot _ hpbot - have hcard : - Nat.card (Ideal.inertia Gal(L/K) 𝔓) = - Ideal.ramificationIdx' (𝔓.under (𝓞 K)) 𝔓 := by -@@ -206,7 +206,7 @@ theorem frobeniusClass_eq_mk_of_isArithFrobAt [IsGalois K L] - (σ : Gal(L/K)) (𝔓 : Ideal (𝓞 L)) [𝔓.IsPrime] (hσ : IsArithFrobAt (𝓞 K) σ 𝔓) - (hP : 𝔓.LiesOver 𝔭) : - frobeniusClass K L 𝔭 = ConjClasses.mk σ := by -- rw [frobeniusClass, dif_pos ⟨‹𝔭.IsPrime›, hunr⟩] -+ rw [frobeniusClass, dite_eq_left ⟨‹𝔭.IsPrime›, hunr⟩] - exact (exists_frobeniusClass K L 𝔭 hunr).choose_spec σ 𝔓 hσ hP - - /-- The order of an arithmetic Frobenius at an unramified prime is its residue degree. -/ -@@ -218,7 +218,7 @@ theorem orderOf_eq_finrank_of_isArithFrobAt - (hσ : IsArithFrobAt (𝓞 K) σ 𝔓) : - orderOf σ = Module.finrank (𝓞 K ⧸ 𝔓.under (𝓞 K)) (𝓞 L ⧸ 𝔓) := by - have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L h -- have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPbot -+ have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) hPbot - have : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot - have : (𝔓.under (𝓞 K)).IsMaximal := - (inferInstance : (𝔓.under (𝓞 K)).IsPrime).isMaximal hpbot -@@ -287,14 +287,13 @@ theorem card_primesAbove_mul_finrank_eq - let : Field (𝓞 K ⧸ 𝔓₀.under (𝓞 K)) := Ideal.Quotient.field _ - let : Field (𝓞 L ⧸ 𝔓₀) := Ideal.Quotient.field _ - exact IsGalois.to_isSeparable -- haveI : Finite (𝓞 K ⧸ 𝔓₀.under (𝓞 K)) := -+ have : Finite (𝓞 K ⧸ 𝔓₀.under (𝓞 K)) := - Ideal.finiteQuotientOfFreeOfNeBot _ hp_under_bot - have H := - Ideal.ncard_primesOver_mul_card_inertia_mul_finrank - (G := Gal(L/K)) (𝔓₀.under (𝓞 K)) 𝔓₀ - rw [inertiaGroup_trivial_of_unramified K L 𝔓₀ he, Subgroup.card_bot, mul_one, -- ← Ideal.inertiaDeg'_eq_inertiaDeg (𝔓₀.under (𝓞 K)) 𝔓₀, -- Ideal.inertiaDeg'_algebraMap (𝔓₀.under (𝓞 K)) 𝔓₀] at H -+ Ideal.inertiaDeg_eq_of_isMaximal (𝔓₀.under (𝓞 K)) 𝔓₀] at H - have hset : (𝔓₀.under (𝓞 K)).primesOver (𝓞 L) - = {𝔓 : Ideal (𝓞 L) | 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := by - ext 𝔓 -@@ -427,7 +426,7 @@ theorem finite_primes_natCast_mem (p : ℕ) (hp : p ≠ 0) : - have hfin := Ideal.finite_factors (R := 𝓞 K) hspan - apply Set.Finite.ofFinset (hfin.toFinset.image (·.asIdeal)) - intro 𝔭 -- simp only [Set.Finite.mem_toFinset, Finset.mem_image, Set.mem_setOf_eq] -+ simp only [Set.Finite.mem_toFinset, Finset.mem_image, Set.mem_ofPred_eq] - constructor - · rintro ⟨v, hv, rfl⟩ - exact -diff --git a/projects/Chebotarev/CebotarevDensity/Main.lean b/projects/Chebotarev/CebotarevDensity/Main.lean -index 678f99731..5cb630f0a 100644 ---- a/projects/Chebotarev/CebotarevDensity/Main.lean -+++ b/projects/Chebotarev/CebotarevDensity/Main.lean -@@ -90,7 +90,7 @@ so `|C| = 1`. -/ - theorem ConjClasses_carrier_card_eq_one_of_comm - {G : Type*} [Monoid G] [IsMulCommutative G] [Finite G] (g : G) : - Nat.card (ConjClasses.mk g).carrier = 1 := by -- letI : CommMonoid G := IsMulCommutative.instCommMonoid -+ let : CommMonoid G := IsMulCommutative.instCommMonoid - have h : (ConjClasses.mk g).carrier = {g} := by - ext a - simp [ConjClasses.mem_carrier_iff_mk_eq, ConjClasses.mk_eq_mk_iff_isConj, isConj_iff_eq] -@@ -260,7 +260,7 @@ private theorem ratPrime_eq_span (𝔭 : Ideal (𝓞 ℚ)) (hp : 𝔭.IsPrime) ( - `p`, via the same `𝓞 ℚ ≃+* ℤ` transport (`comap` of the prime `span {(p : ℤ)}`). -/ - private theorem span_nat_isPrime {p : ℕ} (hpp : p.Prime) : - (Ideal.span {(p : 𝓞 ℚ)}).IsPrime := by -- haveI : (Ideal.span {(p : ℤ)}).IsPrime := -+ have : (Ideal.span {(p : ℤ)}).IsPrime := - (Ideal.span_singleton_prime (by exact_mod_cast hpp.ne_zero)).mpr - (Nat.prime_iff_prime_int.mp hpp) - rw [ratSpan_eq_comap_intSpan] -@@ -278,8 +278,8 @@ private theorem unramifiedIn_cyclotomic_of_coprime {K : Type*} [Field K] [Number - UnramifiedIn K L 𝔭 := by - classical - refine ⟨h𝔭, fun 𝔓 h𝔓max h𝔓lo ↦ ?_⟩ -- haveI := h𝔓lo -- haveI : 𝔓.IsPrime := h𝔓max.isPrime -+ have := h𝔓lo -+ have : 𝔓.IsPrime := h𝔓max.isPrime - rw [← not_dvd_differentIdeal_iff (A := 𝓞 K) (B := 𝓞 L)] - intro hdvd - obtain ⟨ζ, hζ⟩ := IsCyclotomicExtension.exists_isPrimitiveRoot K L -@@ -337,7 +337,7 @@ private theorem frobeniusClass_eq_iff_residue - (𝔭 : Ideal (𝓞 ℚ)) [𝔭.IsPrime] (hunr : UnramifiedIn ℚ L 𝔭) - (hcop : (Ideal.absNorm 𝔭).Coprime n) : - frobeniusClass ℚ L 𝔭 = ConjClasses.mk σ ↔ (Ideal.absNorm 𝔭 : ZMod n) = a := by -- letI : CommMonoid (L ≃ₐ[ℚ] L) := IsMulCommutative.instCommMonoid -+ let : CommMonoid (L ≃ₐ[ℚ] L) := IsMulCommutative.instCommMonoid - have hdict := autToPow_frobeniusClass_out ℚ L n hζ 𝔭 hunr hcop - rw [show frobeniusClass ℚ L 𝔭 = ConjClasses.mk (frobeniusClass ℚ L 𝔭).out from - (Quotient.out_eq _).symm, ConjClasses.mk_eq_mk_iff_isConj, isConj_iff_eq] -@@ -389,7 +389,7 @@ private theorem dirichlet_AP_fibre_diff_image_subset_bad - (fun p : ℕ ↦ Ideal.span {(p : 𝓞 ℚ)}) '' {p : ℕ | p.Prime ∧ (p : ZMod n) = a} ⊆ - (fun q : ℕ ↦ Ideal.span {(q : 𝓞 ℚ)}) '' {q : ℕ | q.Prime ∧ q ∣ n} := by - rintro 𝔭 ⟨⟨hpr, hunr, hfrob⟩, hnotI⟩ -- haveI := hpr -+ have := hpr - obtain ⟨q, hqp, hqeq⟩ := ratPrime_eq_span 𝔭 hpr (UnramifiedIn.ne_bot ℚ L hunr) - have hnorm : Ideal.absNorm 𝔭 = q := by rw [hqeq, absNorm_span_nat] - by_cases hcop : (Ideal.absNorm 𝔭).Coprime n -@@ -414,7 +414,7 @@ private theorem dirichlet_AP_image_diff_fibre_subset_bad - (fun q : ℕ ↦ Ideal.span {(q : 𝓞 ℚ)}) '' {q : ℕ | q.Prime ∧ q ∣ n} := by - rintro 𝔭 ⟨⟨p, ⟨hpp, hpa⟩, rfl⟩, hnotF⟩ - have hprime : (Ideal.span {(p : 𝓞 ℚ)}).IsPrime := span_nat_isPrime hpp -- haveI := hprime -+ have := hprime - have hp0 : (p : 𝓞 ℚ) ≠ 0 := Nat.cast_ne_zero.mpr hpp.ne_zero - by_cases hdvd : p ∣ n - · exact ⟨p, ⟨hpp, hdvd⟩, rfl⟩ -@@ -438,11 +438,11 @@ private theorem dirichlet_AP_main (n : ℕ) (hn4 : n % 4 ≠ 2) (hn : 1 ≤ n) - ((Nat.totient n : ℝ)⁻¹) := by - have : NeZero n := ⟨by lia⟩ - -- The module system does not auto-synthesise `NeZero (n : ℚ)` for `CyclotomicField n ℚ` here. -- haveI : NeZero ((n : ℕ) : ℚ) := ⟨by exact_mod_cast (show n ≠ 0 by lia)⟩ -+ have : NeZero ((n : ℕ) : ℚ) := ⟨by exact_mod_cast (show n ≠ 0 by lia)⟩ - set L := CyclotomicField n ℚ -- haveI : IsCyclotomicExtension {n} ℚ L := CyclotomicField.isCyclotomicExtension n ℚ -- haveI : IsGalois ℚ L := IsCyclotomicExtension.isGalois {n} ℚ L -- haveI : IsMulCommutative (L ≃ₐ[ℚ] L) := -+ have : IsCyclotomicExtension {n} ℚ L := CyclotomicField.isCyclotomicExtension n ℚ -+ have : IsGalois ℚ L := IsCyclotomicExtension.isGalois {n} ℚ L -+ have : IsMulCommutative (L ≃ₐ[ℚ] L) := - IsCyclotomicExtension.isMulCommutative (S := {n}) ℚ L - have hirr : Irreducible (Polynomial.cyclotomic n ℚ) := - Polynomial.cyclotomic.irreducible_rat (by lia) -diff --git a/projects/Chebotarev/CebotarevDensity/NumberFieldEulerProduct.lean b/projects/Chebotarev/CebotarevDensity/NumberFieldEulerProduct.lean -index 753a2f1ee..28b3b5b8b 100644 ---- a/projects/Chebotarev/CebotarevDensity/NumberFieldEulerProduct.lean -+++ b/projects/Chebotarev/CebotarevDensity/NumberFieldEulerProduct.lean -@@ -2,7 +2,7 @@ module - - public import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics - public import Mathlib.Analysis.Normed.Ring.InfiniteSum --public import Mathlib.Data.Finite.Vector -+public import Mathlib.Data.Fintype.Vector - public import Mathlib.Data.Finsupp.Multiset - public import Mathlib.Data.Sym.Card - public import Mathlib.NumberTheory.NumberField.Cyclotomic.Basic -@@ -249,7 +249,7 @@ lemma sum_idealNormMultiplicity_isBigO : - classical - have h_finite : ∀ (b : ℕ), {I : NonzeroIdeal L | Ideal.absNorm I.1 = b}.Finite := fun b ↦ - Set.Finite.preimage (f := fun I : NonzeroIdeal L ↦ I.1) (fun _ _ _ _ ↦ Subtype.ext) -- (Ideal.finite_setOf_absNorm_eq (S := 𝓞 L) b) -+ (Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 L) b) - have h_sum_card : ∀ n : ℕ, ∑ k ∈ Finset.Icc 1 n, idealNormMultiplicity L k = - Nat.card {I : NonzeroIdeal L // Ideal.absNorm I.1 ≤ n} := fun n ↦ by - have key := Finset.card_preimage_eq_sum_card_image_eq (f := fun I : NonzeroIdeal L ↦ -@@ -257,7 +257,7 @@ lemma sum_idealNormMultiplicity_isBigO : - rw [show ((fun I : NonzeroIdeal L ↦ Ideal.absNorm I.1) ⁻¹' ↑(Finset.Icc 1 n)) = - {I : NonzeroIdeal L | Ideal.absNorm I.1 ≤ n} by - ext ⟨I, hI⟩ -- simp only [Set.mem_preimage, Finset.coe_Icc, Set.mem_Icc, Set.mem_setOf_eq] -+ simp only [Set.mem_preimage, Finset.coe_Icc, Set.mem_Icc, Set.mem_ofPred_eq] - exact ⟨fun h ↦ h.2, fun h ↦ - ⟨Nat.one_le_iff_ne_zero.mpr (mt Ideal.absNorm_eq_zero_iff.mp hI), h⟩⟩] at key - exact key.symm -@@ -501,7 +501,7 @@ eventually captured, so the partial sums tend to `∑_𝔞 N𝔞^{-s} = ζ_K(s)` - private instance instFiniteAbsNormFiber (n : ℕ) : - Finite {I : NonzeroIdeal L // Ideal.absNorm I.1 = n} := - Set.Finite.to_subtype <| Set.Finite.of_finite_image (f := fun I : NonzeroIdeal L ↦ I.1) -- ((Ideal.finite_setOf_absNorm_eq (S := 𝓞 L) n).subset (by rintro _ ⟨⟨I, _⟩, rfl, rfl⟩; rfl)) -+ ((Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 L) n).subset (by rintro _ ⟨⟨I, _⟩, rfl, rfl⟩; rfl)) - (fun _ _ _ _ ↦ Subtype.ext) - - private lemma tsum_absNormFiber {M : Type*} [AddCommGroup M] [TopologicalSpace M] [T2Space M] -@@ -583,14 +583,14 @@ private theorem factorization_prod_primePow_eq - rw [factorization_prod_primePow_apply L S e 𝔮] - simp_rw [factorization_primePow_apply L] - by_cases h𝔮 : 𝔮 ∈ S -- · rw [if_pos h𝔮, Finset.sum_eq_single (⟨𝔮, h𝔮⟩ : {x // x ∈ S})] -- · rw [if_pos rfl] -+ · rw [ite_eq_left h𝔮, Finset.sum_eq_single (⟨𝔮, h𝔮⟩ : {x // x ∈ S})] -+ · rw [ite_eq_left rfl] - · rintro b _ hb -- rw [if_neg (fun h ↦ hb (Subtype.ext h.symm))] -+ rw [ite_eq_right (fun h ↦ hb (Subtype.ext h.symm))] - · exact fun h ↦ absurd (Finset.mem_attach S _) h -- · rw [if_neg h𝔮, Finset.sum_eq_zero] -+ · rw [ite_eq_right h𝔮, Finset.sum_eq_zero] - rintro ⟨b, hb⟩ - -- rw [if_neg (fun h : 𝔮 = b ↦ h𝔮 (h.symm ▸ hb))] -+ rw [ite_eq_right (fun h : 𝔮 = b ↦ h𝔮 (h.symm ▸ hb))] - - open UniqueFactorizationMonoid in - /-- The normalized prime factors of `𝔞` as a `Finset` of nonzero prime ideals. -/ -@@ -624,9 +624,9 @@ private theorem factorization_idealOfExp_eq - classical - have hprod : (∏ 𝔭 ∈ S.attach, 𝔭.1.1 ^ (fun q ↦ if h : q ∈ S then f ⟨q, h⟩ else 0) 𝔭.1) - = ∏ 𝔭 ∈ S.attach, 𝔭.1.1 ^ f 𝔭 := -- Finset.prod_congr rfl fun 𝔭 _ ↦ by simp only [dif_pos 𝔭.2] -+ Finset.prod_congr rfl fun 𝔭 _ ↦ by simp only [dite_eq_left 𝔭.2] - rw [← hprod, factorization_prod_primePow_eq L S -- (fun q ↦ if h : q ∈ S then f ⟨q, h⟩ else 0) 𝔮.1, if_pos 𝔮.2, dif_pos 𝔮.2] -+ (fun q ↦ if h : q ∈ S then f ⟨q, h⟩ else 0) 𝔮.1, ite_eq_left 𝔮.2, dite_eq_left 𝔮.2] - - open UniqueFactorizationMonoid in - private theorem prod_primePow_count_eq (S : Finset {𝔭 : Ideal (𝓞 L) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥}) -diff --git a/projects/Chebotarev/CebotarevDensity/ZetaProduct.lean b/projects/Chebotarev/CebotarevDensity/ZetaProduct.lean -index 356695e9a..c67aa3c90 100644 ---- a/projects/Chebotarev/CebotarevDensity/ZetaProduct.lean -+++ b/projects/Chebotarev/CebotarevDensity/ZetaProduct.lean -@@ -172,11 +172,11 @@ private theorem norm_galoisCharacterOnIdeal_le_one - (χ : galoisCharacter K L) (𝔞 : Ideal (𝓞 K)) : - ‖galoisCharacterOnIdeal K L χ 𝔞‖ ≤ 1 := by - rw [galoisCharacterOnIdeal, norm_prod] -- refine Finset.prod_le_one (fun i _ ↦ norm_nonneg _) (fun 𝔭 _ ↦ ?_) -+ refine Finset.prod_le_one₀ (fun i _ ↦ norm_nonneg _) (fun 𝔭 _ ↦ ?_) - rw [norm_pow] - by_cases h : UnramifiedIn K L 𝔭 -- · rw [if_pos h, norm_galoisCharacter_out, one_pow] -- · rw [if_neg h, norm_zero] -+ · rw [ite_eq_left h, norm_galoisCharacter_out, one_pow] -+ · rw [ite_eq_right h, norm_zero] - exact zero_pow_le_one _ - - /-- Sharifi 7.1.18 (p. 141): Euler product for an abelian Galois -@@ -212,18 +212,18 @@ theorem exists_artinLSeries_eulerProduct_abelian - have hsupp : Function.mulSupport f ⊆ Set.range g := by - intro 𝔭 hmem - simp only [Function.mem_mulSupport, hf] at hmem -- haveI := 𝔭.2.1 -+ have := 𝔭.2.1 - have hunr : UnramifiedIn K L 𝔭.1 := by - by_contra hnr - apply hmem -- rw [hw, galoisCharacterOnIdeal_apply_prime K L χ 𝔭.1 𝔭.2.2, if_neg hnr, zero_mul, sub_zero, -+ rw [hw, galoisCharacterOnIdeal_apply_prime K L χ 𝔭.1 𝔭.2.2, ite_eq_right hnr, zero_mul, sub_zero, - inv_one] - exact ⟨⟨𝔭.1, 𝔭.2.1, hunr⟩, rfl⟩ - rw [← hg_inj.tprod_eq hsupp] - refine tprod_congr fun 𝔭 ↦ ?_ - simp only [hf, hg, hw] -- haveI := 𝔭.2.1 -- rw [galoisCharacterOnIdeal_apply_prime K L χ 𝔭.1 𝔭.2.2.ne_bot, if_pos 𝔭.2.2] -+ have := 𝔭.2.1 -+ rw [galoisCharacterOnIdeal_apply_prime K L χ 𝔭.1 𝔭.2.2.ne_bot, ite_eq_left 𝔭.2.2] - - /-! ### Sub-lemmas for `dedekindZeta_local_factor_eq_product_artin_local` - -@@ -350,7 +350,6 @@ private theorem cpow_neg_absNorm_eq_pow {a b : ℕ} (f : ℕ) (s : ℂ) - (h : b = a ^ f) : ((b : ℂ)) ^ (-s) = ((a : ℂ) ^ (-s)) ^ f := by - rw [h, Nat.cast_pow, ← Complex.natCast_cpow_natCast_mul, Complex.cpow_nat_mul] - --set_option backward.isDefEq.respectTransparency false in - /-- Sharifi 7.1.16 (p. 141) local step: the local Euler factor at an - unramified prime `𝔭` of `K` factors as a product over characters. - Source quote (paraphrased identity): the local factor -@@ -365,12 +364,12 @@ theorem dedekindZeta_local_factor_eq_product_artin_local - (1 - (χ (frobeniusClass K L 𝔭).out : ℂ) * (Ideal.absNorm 𝔭 : ℂ) ^ (-s))⁻¹ := by - classical - open scoped IsMulCommutative in -- letI : CommGroup Gal(L/K) := inferInstance -+ let : CommGroup Gal(L/K) := inferInstance - set σ : Gal(L/K) := (frobeniusClass K L 𝔭).out - set Y : ℂ := (Ideal.absNorm 𝔭 : ℂ) ^ (-s) with hY - set f : ℕ := orderOf σ with hf -- haveI : Fintype Gal(L/K) := Fintype.ofFinite _ -- haveI : Fintype (Gal(L/K) →* ℂˣ) := Fintype.ofFinite _ -+ have : Fintype Gal(L/K) := Fintype.ofFinite _ -+ have : Fintype (Gal(L/K) →* ℂˣ) := Fintype.ofFinite _ - have hfpos : 0 < f := hf ▸ orderOf_pos_iff.mpr (isOfFinOrder_of_finite σ) - have hcount : Nat.card {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} - = Nat.card Gal(L/K) / f := by -@@ -383,29 +382,29 @@ theorem dedekindZeta_local_factor_eq_product_artin_local - = ((1 - Y ^ f) ^ (Nat.card Gal(L/K) / f))⁻¹ := by - rw [tprod_fintype, Finset.prod_inv_distrib, prod_galoisCharacter_one_sub σ Y, hf] - have hpbot : 𝔭 ≠ ⊥ := UnramifiedIn.ne_bot K L _hunr -- haveI : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal hpbot -- haveI : Finite (𝔭.primesOver (𝓞 L)) := (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 L)).to_subtype -- haveI : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := -+ have : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal hpbot -+ have : Finite (𝔭.primesOver (𝓞 L)) := (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 L)).to_subtype -+ have : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := - Finite.of_injective - (fun 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} ↦ - (⟨𝔓.1, 𝔓.2.1, 𝔓.2.2.1⟩ : 𝔭.primesOver (𝓞 L))) -- fun _ _ hab ↦ Subtype.ext (by simpa using hab) -- haveI : Fintype {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := Fintype.ofFinite _ -+ fun _ _ hab ↦ Subtype.ext (congrArg (fun q : 𝔭.primesOver (𝓞 L) ↦ q.1) hab) -+ have : Fintype {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := Fintype.ofFinite _ - have hterm : ∀ 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥}, - (1 - (Ideal.absNorm 𝔓.1 : ℂ) ^ (-s))⁻¹ = (1 - Y ^ f)⁻¹ := by - intro 𝔓 -- haveI := 𝔓.2.1 -- haveI hlo : 𝔓.1.LiesOver 𝔭 := 𝔓.2.2.1 -- have hdeg : (𝔓.1.under (𝓞 K)).inertiaDeg' 𝔓.1 = f := by -- rw [Ideal.inertiaDeg'_algebraMap, hf] -+ have := 𝔓.2.1 -+ have hlo : 𝔓.1.LiesOver 𝔭 := 𝔓.2.2.1 -+ have : 𝔓.1.IsMaximal := 𝔓.2.1.isMaximal 𝔓.2.2.2 -+ have : (𝔓.1.under (𝓞 K)).IsMaximal := hlo.over ▸ ‹𝔭.IsMaximal› -+ have hdeg : 𝔓.1.inertiaDeg (𝓞 K) = f := by -+ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔓.1.under (𝓞 K)) 𝔓.1, hf] - exact finrank_residue_eq_orderOf K L σ (frobeniusClass K L 𝔭) (Quotient.out_eq _) - 𝔭 _hunr rfl 𝔓.1 hlo -- haveI : 𝔓.1.LiesOver (𝔓.1.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓.1) -- have hpubot : 𝔓.1.under (𝓞 K) ≠ ⊥ := hlo.over ▸ hpbot -- haveI : (𝔓.1.under (𝓞 K)).IsPrime := hlo.over ▸ ‹𝔭.IsPrime› -+ have : 𝔓.1.LiesOver (𝔓.1.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓.1) -+ have : (𝔓.1.under (𝓞 K)).IsPrime := hlo.over ▸ ‹𝔭.IsPrime› - have hnorm : Ideal.absNorm 𝔓.1 = Ideal.absNorm 𝔭 ^ f := by -- rw [Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver 𝔓.1 (𝔓.1.under (𝓞 K)) inferInstance hpubot, -- hdeg, ← hlo.over] -+ rw [← Ideal.absNorm_pow_inertiaDeg 𝔭 𝔓.1, hdeg] - rw [cpow_neg_absNorm_eq_pow f s hnorm, hY] - rw [tprod_congr hterm, tprod_fintype, Finset.prod_const, Finset.card_univ, - ← Nat.card_eq_fintype_card, hcount, hRHS, Nat.card_eq_fintype_card, inv_pow] -@@ -460,7 +459,7 @@ open Classical in - (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] - [IsMulCommutative Gal(L/K)] (𝔭 : Ideal (𝓞 K)) [𝔭.IsPrime] (h𝔭 : 𝔭 ≠ ⊥) : - frobeniusIdeal K L 𝔭 = (frobeniusClass K L 𝔭).out := by -- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } -+ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } - rw [frobeniusIdeal, UniqueFactorizationMonoid.normalizedFactors_irreducible - (Ideal.prime_of_isPrime h𝔭 ‹_›).irreducible, normalize_eq, Multiset.map_singleton, - Multiset.prod_singleton] -@@ -470,7 +469,7 @@ theorem frobeniusIdeal_mul - (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] - [IsMulCommutative Gal(L/K)] {𝔞 𝔟 : Ideal (𝓞 K)} (h𝔞 : 𝔞 ≠ ⊥) (h𝔟 : 𝔟 ≠ ⊥) : - frobeniusIdeal K L (𝔞 * 𝔟) = frobeniusIdeal K L 𝔞 * frobeniusIdeal K L 𝔟 := by -- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } -+ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } - rw [frobeniusIdeal, frobeniusIdeal, frobeniusIdeal, - UniqueFactorizationMonoid.normalizedFactors_mul h𝔞 h𝔟, Multiset.map_add, Multiset.prod_add] - -@@ -479,7 +478,7 @@ theorem frobeniusIdeal_mul - (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] - [IsMulCommutative Gal(L/K)] : - frobeniusIdeal K L ⊤ = 1 := by -- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } -+ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } - rw [frobeniusIdeal, ← Ideal.one_eq_top, UniqueFactorizationMonoid.normalizedFactors_one, - Multiset.map_zero, Multiset.prod_zero] - -@@ -495,7 +494,7 @@ theorem galoisCharacterOnIdeal_eq_char_frobeniusIdeal - [IsCyclotomicExtension {m} K L] (χ : galoisCharacter K L) {𝔞 : Ideal (𝓞 K)} - (hU : ∀ 𝔭 ∈ UniqueFactorizationMonoid.normalizedFactors 𝔞, UnramifiedIn K L 𝔭) : - galoisCharacterOnIdeal K L χ 𝔞 = (χ (frobeniusIdeal K L 𝔞) : ℂ) := by -- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } -+ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } - have hfrob : (χ (frobeniusIdeal K L 𝔞) : ℂ) = - ((UniqueFactorizationMonoid.normalizedFactors 𝔞).map - (fun 𝔭 ↦ (χ (frobeniusClass K L 𝔭).out : ℂ))).prod := by -@@ -504,7 +503,7 @@ theorem galoisCharacterOnIdeal_eq_char_frobeniusIdeal - rfl - rw [galoisCharacterOnIdeal_eq_map_prod, hfrob] - refine congrArg Multiset.prod (Multiset.map_congr rfl fun 𝔭 h𝔭 ↦ ?_) -- rw [if_pos (hU 𝔭 h𝔭)] -+ rw [ite_eq_left (hU 𝔭 h𝔭)] - - open Classical in - /-- If the ideal character `χ(𝔞)` is nonzero then every prime factor of `𝔞` is unramified in `L` -@@ -516,7 +515,7 @@ private theorem unramifiedIn_of_mem_normalizedFactors_of_galoisCharacterOnIdeal_ - by_contra hnr - refine h ?_ - rw [galoisCharacterOnIdeal_eq_map_prod] -- exact Multiset.prod_eq_zero (Multiset.mem_map.mpr ⟨𝔭, h𝔭, if_neg hnr⟩) -+ exact Multiset.prod_eq_zero (Multiset.mem_map.mpr ⟨𝔭, h𝔭, ite_eq_right hnr⟩) - - open Classical in - /-- **Helper 1a (cardinality form) — value-fibre = unramified-supported Frobenius-value-fibre.** For -@@ -555,8 +554,8 @@ theorem charFibre_mem_range {G : Type*} [CommGroup G] [Finite G] (χ : G →* - (hζ : ζ ^ orderOf χ = 1) : - ∃ g : G, χ g = ζ := by - classical -- haveI : NeZero (orderOf χ) := ⟨(orderOf_pos_iff.mpr (isOfFinOrder_of_finite χ)).ne'⟩ -- haveI : Finite (MonoidHom.range χ) := -+ have : NeZero (orderOf χ) := ⟨(orderOf_pos_iff.mpr (isOfFinOrder_of_finite χ)).ne'⟩ -+ have : Finite (MonoidHom.range χ) := - Finite.of_surjective χ.rangeRestrict χ.rangeRestrict_surjective - have hpow : ∀ g : G, (χ g) ^ orderOf χ = 1 := fun g ↦ by - rw [← MonoidHom.pow_apply, pow_orderOf_eq_one, MonoidHom.one_apply] -@@ -620,8 +619,8 @@ private theorem unramifiedIn_of_coprime_absNorm - UnramifiedIn K L 𝔭 := by - classical - refine ⟨h𝔭, fun 𝔓 h𝔓max h𝔓lo ↦ ?_⟩ -- haveI := h𝔓lo -- haveI : 𝔓.IsPrime := h𝔓max.isPrime -+ have := h𝔓lo -+ have : 𝔓.IsPrime := h𝔓max.isPrime - rw [← not_dvd_differentIdeal_iff (A := 𝓞 K) (B := 𝓞 L)] - intro hdvd - obtain ⟨ζ, hζ⟩ := IsCyclotomicExtension.exists_isPrimitiveRoot K L -@@ -697,7 +696,7 @@ private theorem autToPow_frobeniusIdeal - intro hpa hcop - have hp' : p ≠ ⊥ := hp.ne_zero - have ha' : a ≠ ⊥ := ha -- haveI : p.IsPrime := Ideal.isPrime_of_prime hp -+ have : p.IsPrime := Ideal.isPrime_of_prime hp - have hsplit : Ideal.absNorm (p * a) = Ideal.absNorm p * Ideal.absNorm a := - map_mul Ideal.absNorm p a - have hcp : (Ideal.absNorm p).Coprime m := -@@ -885,7 +884,7 @@ private theorem card_fibre_eq_card_good_fibre - intro 𝔭 h𝔭 - rw [normalizedFactors_mul h0 h𝔟, Multiset.mem_add] at h𝔭 - rcases h𝔭 with h𝔭 | h𝔭 -- · haveI : 𝔭.IsPrime := Ideal.isPrime_of_prime (prime_of_normalized_factor _ h𝔭) -+ · have : 𝔭.IsPrime := Ideal.isPrime_of_prime (prime_of_normalized_factor _ h𝔭) - exact unramifiedIn_of_coprime_absNorm K L m 𝔭 - (prime_of_normalized_factor _ h𝔭).ne_zero - (coprime_absNorm_of_mem_factors_of_coprime K m hcop h𝔭) -@@ -921,18 +920,18 @@ omit [NumberField L] [FiniteDimensional K L] [IsMulCommutative Gal(L/K)] [NeZero - /-- The bad-supported ideals of norm `≤ N` form a finite set: they are a subset of the (finitely - many) ideals of norm `≤ N`. -/ - private theorem finite_isBadPart (N : ℕ) : {𝔟 : Ideal (𝓞 K) | IsBadPart K L m N 𝔟}.Finite := -- (Ideal.finite_setOf_absNorm_le (S := 𝓞 K) N).subset fun _ h𝔟 ↦ h𝔟.2.2 -+ (Ideal.finite_setOfPred_absNorm_le (S := 𝓞 K) N).subset fun _ h𝔟 ↦ h𝔟.2.2 - - open UniqueFactorizationMonoid in - /-- The L2 fibre subtype at `g` is finite (subset of all ideals of norm `≤ N`). -/ - private instance finite_L2 (g : Gal(L/K)) (N : ℕ) : - Finite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N ∧ - (∀ 𝔭 ∈ normalizedFactors 𝔞, UnramifiedIn K L 𝔭) ∧ frobeniusIdeal K L 𝔞 = g} := by -- haveI : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N} := -- (Ideal.finite_setOf_absNorm_le (S := 𝓞 K) N).to_subtype -+ have : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N} := -+ (Ideal.finite_setOfPred_absNorm_le (S := 𝓞 K) N).to_subtype - exact Finite.of_injective (β := {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N}) - (fun 𝔞 ↦ ⟨𝔞.1, 𝔞.2.2.1⟩) -- (fun _ _ hab ↦ Subtype.ext (by simpa using hab)) -+ (fun _ _ hab ↦ Subtype.ext (congrArg (fun q : {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N} ↦ q.1) hab)) - - omit [FiniteDimensional K L] [NeZero m] [IsCyclotomicExtension {m} K L] in - open UniqueFactorizationMonoid in -@@ -1054,7 +1053,7 @@ private theorem autToPow_range_le_realizedResidues - have hHtop : H = ⊤ := by - refine subgroup_eq_top_of_forall_frobenius_mem_of_coprime K L m H - (fun 𝔭 h𝔭p h𝔭ne h𝔭unr h𝔭cop ↦ ?_) -- haveI := h𝔭p -+ have := h𝔭p - rw [hH, Subgroup.mem_comap, autToPow_frobeniusClass_out K L m hζ 𝔭 h𝔭unr h𝔭cop] - exact ⟨⟨𝔭, mem_nonZeroDivisors_of_ne_zero h𝔭ne⟩, by rw [ZMod.coe_unitOfCoprime]⟩ - intro a ha -@@ -1203,7 +1202,7 @@ private theorem sum_rpow_le_euler_prod (K : Type*) [Field K] [NumberField K] - rw [Finset.prod_sum P (fun _ ↦ Finset.range (Kn + 1)) - (fun 𝔭 k ↦ (((Ideal.absNorm 𝔭 : ℝ)) ^ e) ^ k)] - _ ≤ ∏ 𝔭 ∈ P, (1 - ((Ideal.absNorm 𝔭 : ℝ)) ^ e)⁻¹ := by -- refine Finset.prod_le_prod -+ refine Finset.prod_le_prod₀ - (fun 𝔭 h𝔭 ↦ Finset.sum_nonneg fun k _ ↦ pow_nonneg (hx0 𝔭 h𝔭) k) (fun 𝔭 h𝔭 ↦ ?_) - have h1x : 0 < 1 - ((Ideal.absNorm 𝔭 : ℝ)) ^ e := by have := hxlt 𝔭 h𝔭; linarith - have hkey := geom_sum_mul (((Ideal.absNorm 𝔭 : ℝ)) ^ e) (Kn + 1) -@@ -1658,7 +1657,7 @@ private theorem coprime_absNorm_of_unramified_of_finrank_eq_one - by_contra hncop - obtain ⟨p, hpm, hpmem𝔭⟩ := exists_primeFactor_natCast_mem_of_not_coprime K m 𝔭 h𝔭 hncop - have hp : p.Prime := (Nat.mem_primeFactors.mp hpm).1 -- haveI : Fact p.Prime := ⟨hp⟩ -+ have : Fact p.Prime := ⟨hp⟩ - have hpdvd : p ∣ m := Nat.dvd_of_mem_primeFactors hpm - have hm0 : m ≠ 0 := (Nat.mem_primeFactors.mp hpm).2.2 - set v := m.factorization p with hv -@@ -1684,11 +1683,11 @@ private theorem coprime_absNorm_of_unramified_of_finrank_eq_one - have hφ2 : 2 ≤ p ^ k * (p - 1) := two_le_pow_mul_pred hp hbad - have hspan𝔭 : Ideal.span {(p : 𝓞 K)} = 𝔭 := - span_singleton_natCast_eq_of_finrank_eq_one K hd1 p hp 𝔭 hpmem𝔭 -- haveI : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal h𝔭 -+ have : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal h𝔭 - obtain ⟨𝔓, h𝔓max, h𝔓lo⟩ := - Ideal.exists_maximal_ideal_liesOver_of_isIntegral (R := 𝓞 K) (S := 𝓞 L) 𝔭 -- haveI : 𝔓.IsPrime := h𝔓max.isPrime -- haveI := h𝔓lo -+ have : 𝔓.IsPrime := h𝔓max.isPrime -+ have := h𝔓lo - have hnotdvd : ¬ 𝔓 ∣ differentIdeal (𝓞 K) (𝓞 L) := by - rw [not_dvd_differentIdeal_iff (A := 𝓞 K) (B := 𝓞 L)] - exact hunr.2 𝔓 h𝔓max h𝔓lo -@@ -1747,7 +1746,7 @@ private theorem card_fibre_bound_eq_one {ζ : L} (hζ : IsPrimitiveRoot ζ m) - rw [Ideal.one_eq_top] at this; exact htop this - obtain ⟨𝔭, h𝔭⟩ := Multiset.exists_mem_of_ne_zero hfac0 - have hprime := prime_of_normalized_factor 𝔭 h𝔭 -- haveI : 𝔭.IsPrime := Ideal.isPrime_of_prime hprime -+ have : 𝔭.IsPrime := Ideal.isPrime_of_prime hprime - exact (hfac 𝔭 h𝔭).2 (coprime_absNorm_of_unramified_of_finrank_eq_one K L m hd1 𝔭 - hprime.ne_zero (hfac 𝔭 h𝔭).1 hm) - rw [card_L2_eq_sum_residue K L m hζ g N, hbadtop, Finset.sum_singleton, -@@ -1819,9 +1818,9 @@ private theorem card_unramifiedSupported_frobeniusValueFibre_eq_sum - (∀ 𝔭 ∈ UniqueFactorizationMonoid.normalizedFactors 𝔞, UnramifiedIn K L 𝔭) ∧ - frobeniusIdeal K L 𝔞 = g.1} := by - classical -- haveI hfinN : Finite {𝔞 : Ideal (𝓞 K) // Ideal.absNorm 𝔞 ≤ N} := -- (Ideal.finite_setOf_absNorm_le (S := 𝓞 K) N).to_subtype -- haveI hfin : ∀ g : {g : Gal(L/K) // (χ g : ℂ) = ζ}, -+ have hfinN : Finite {𝔞 : Ideal (𝓞 K) // Ideal.absNorm 𝔞 ≤ N} := -+ (Ideal.finite_setOfPred_absNorm_le (S := 𝓞 K) N).to_subtype -+ have hfin : ∀ g : {g : Gal(L/K) // (χ g : ℂ) = ζ}, - Finite {𝔞 : Ideal (𝓞 K) // - 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N ∧ - (∀ 𝔭 ∈ UniqueFactorizationMonoid.normalizedFactors 𝔞, UnramifiedIn K L 𝔭) ∧ -@@ -1916,7 +1915,7 @@ theorem exists_card_galoisCharacterOnIdeal_eq_const_mul_add_pow - rw [← hζuval] - exact ⟨fun h ↦ Units.ext h, fun h ↦ congrArg Units.val h⟩ - rw [heq] -- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } -+ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } - exact card_charFibre_eq_card_ker χ ζu hζun - have hcardℝ : (Fintype.card {g : Gal(L/K) // (χ g : ℂ) = ζ} : ℝ) = (κ₀ : ℝ) := by - rw [← Nat.card_eq_fintype_card, hSκ₀] -@@ -1985,7 +1984,7 @@ private theorem galoisCharacterOnIdeal_mem_insert_zero_nthRootsFinset - · push Not at hU - obtain ⟨𝔭, h𝔭, hram⟩ := hU - rw [galoisCharacterOnIdeal_eq_map_prod, -- Multiset.prod_eq_zero (Multiset.mem_map.mpr ⟨𝔭, h𝔭, if_neg hram⟩)] -+ Multiset.prod_eq_zero (Multiset.mem_map.mpr ⟨𝔭, h𝔭, ite_eq_right hram⟩)] - exact Finset.mem_insert_self _ _ - - private theorem sum_galoisCharacterOnIdeal_eq_sum_card_sub_mul -@@ -2044,9 +2043,9 @@ many) ideals of norm `≤ N`. -/ - private theorem finite_nonzeroIdeal_absNorm_le (K : Type*) [Field K] [NumberField K] (N : ℕ) : - Finite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N} := - haveI : Finite {𝔞 : Ideal (𝓞 K) // Ideal.absNorm 𝔞 ≤ N} := -- (Ideal.finite_setOf_absNorm_le (S := 𝓞 K) N).to_subtype -+ (Ideal.finite_setOfPred_absNorm_le (S := 𝓞 K) N).to_subtype - Finite.of_injective (fun a ↦ (⟨a.1, a.2.2⟩ : {𝔞 : Ideal (𝓞 K) // Ideal.absNorm 𝔞 ≤ N})) -- fun _ _ hab ↦ Subtype.ext (by simpa using hab) -+ fun _ _ hab ↦ Subtype.ext (congrArg (fun q : {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N} ↦ q.1) hab) - - /-- Sharifi 7.1.19 step 1 (p. 142): geometry-of-numbers bound. The - partial-sum character sum `Σ_{N𝔞≤N} χ(𝔞)` (with `χ(𝔞) = galoisCharacterOnIdeal K L χ 𝔞` the -@@ -2067,7 +2066,7 @@ theorem character_sum_geometry_of_numbers_bound - refine ⟨(orderOf χ : ℝ) * C', fun N ↦ ?_⟩ - have hC' : 0 ≤ C' := (abs_nonneg _).trans (by simpa using hcount 1 (one_pow _) 1 le_rfl) - rcases Nat.eq_zero_or_pos N with rfl | hN1 -- · haveI : IsEmpty {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ 0} := -+ · have : IsEmpty {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ 0} := - ⟨fun 𝔞 ↦ 𝔞.2.1 (Ideal.absNorm_eq_zero_iff.mp (Nat.le_zero.mp 𝔞.2.2))⟩ - rw [tsum_empty, norm_zero] - positivity -@@ -2079,8 +2078,8 @@ theorem character_sum_geometry_of_numbers_bound - set R : Finset ℂ := Polynomial.nthRootsFinset (orderOf χ) (1 : ℂ) with hR - have hmemR : ∀ {z : ℂ}, z ∈ R ↔ z ^ orderOf χ = 1 := fun {z} ↦ - Polynomial.mem_nthRootsFinset (Nat.pos_of_ne_zero hord0) 1 -- haveI := finite_nonzeroIdeal_absNorm_le K N -- haveI := Fintype.ofFinite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N} -+ have := finite_nonzeroIdeal_absNorm_le K N -+ have := Fintype.ofFinite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N} - rw [tsum_fintype, sum_galoisCharacterOnIdeal_eq_sum_card_sub_mul K L m χ hord2 C₀ N] - calc ‖∑ v ∈ R, (((Nat.card {𝔞 : Ideal (𝓞 K) // - 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N ∧ galoisCharacterOnIdeal K L χ 𝔞 = v} : ℝ) -@@ -2111,7 +2110,7 @@ private theorem finite_nonzeroIdeal_absNorm_eq - (K : Type*) [Field K] [NumberField K] (n : ℕ) : - Finite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = n} := - Set.Finite.to_subtype <| Set.Finite.of_finite_image (f := fun I : NonzeroIdeal K ↦ I.1) -- ((Ideal.finite_setOf_absNorm_eq (S := 𝓞 K) n).subset (by rintro _ ⟨⟨I, _⟩, rfl, rfl⟩; rfl)) -+ ((Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 K) n).subset (by rintro _ ⟨⟨I, _⟩, rfl, rfl⟩; rfl)) - (fun _ _ _ _ ↦ Subtype.ext) - - /-- The `0`-th coefficient vanishes: no nonzero ideal has norm `0`, so the fibre is empty. -/ -@@ -2128,8 +2127,8 @@ private theorem norm_galoisCharacterCoeff_le - (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] - (χ : galoisCharacter K L) (n : ℕ) : - ‖galoisCharacterCoeff K L χ n‖ ≤ (idealNormMultiplicity K n : ℝ) := by -- haveI := finite_nonzeroIdeal_absNorm_eq K n -- haveI := Fintype.ofFinite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = n} -+ have := finite_nonzeroIdeal_absNorm_eq K n -+ have := Fintype.ofFinite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = n} - calc ‖galoisCharacterCoeff K L χ n‖ - ≤ ∑' 𝔞 : {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = n}, - ‖galoisCharacterOnIdeal K L χ 𝔞.1.1‖ := -@@ -2154,8 +2153,8 @@ private theorem sum_galoisCharacterCoeff_eq_tsum_absNorm_le - ∑' 𝔞 : {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ n}, - galoisCharacterOnIdeal K L χ 𝔞.1 := by - classical -- haveI := finite_nonzeroIdeal_absNorm_le K n -- haveI := Fintype.ofFinite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ n} -+ have := finite_nonzeroIdeal_absNorm_le K n -+ have := Fintype.ofFinite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ n} - rw [tsum_fintype, ← Finset.sum_fiberwise_of_maps_to (t := Finset.Icc 1 n) - (g := fun 𝔞 : {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ n} ↦ Ideal.absNorm 𝔞.1) - (fun 𝔞 _ ↦ Finset.mem_Icc.mpr -@@ -2163,8 +2162,8 @@ private theorem sum_galoisCharacterCoeff_eq_tsum_absNorm_le - (fun 𝔞 ↦ galoisCharacterOnIdeal K L χ 𝔞.1)] - refine Finset.sum_congr rfl fun k hk ↦ ?_ - rw [galoisCharacterCoeff, ← Finset.sum_subtype_eq_sum_filter, Finset.subtype_univ] -- haveI := finite_nonzeroIdeal_absNorm_eq K k -- haveI := Fintype.ofFinite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = k} -+ have := finite_nonzeroIdeal_absNorm_eq K k -+ have := Fintype.ofFinite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = k} - rw [tsum_fintype] - exact Fintype.sum_equiv - { toFun := fun ⟨⟨𝔞, h𝔞ne⟩, hnorm⟩ ↦ -@@ -2260,8 +2259,8 @@ private theorem setIntegral_Ioi_one_mul_cpow_eq_mellin (S : ℝ → ℂ) (hS : - ae_iff.mpr (by simp : volume {x : ℝ | ¬x ≠ 1} = 0)] with t ht _ - rw [indicator_apply] - by_cases h1 : t ∈ Ioi (1 : ℝ) -- · rw [if_pos h1] -- · rw [if_neg h1, hS t (lt_of_le_of_ne (not_lt.mp (by simpa using h1)) ht), smul_zero] -+ · rw [ite_eq_left h1] -+ · rw [ite_eq_right h1, hS t (lt_of_le_of_ne (not_lt.mp (by simpa using h1)) ht), smul_zero] - - open Filter Topology Set MeasureTheory Asymptotics in - /-- Sharifi 7.1.19 step 1b (p. 142) — analytic extension of `L(χ,·)`. -@@ -2467,7 +2466,7 @@ private theorem norm_one_sub_inv_sub_one_le {y : ℂ} (hy : ‖y‖ ≤ 1 / 2) : - - /-- A nonzero prime ideal `𝔭` of a number ring has `2 ≤ N𝔭`: its norm is neither `0` (only `⊥` has - norm `0`) nor `1` (only `⊤` has norm `1`). -/ --private theorem two_le_absNorm {R : Type*} [CommRing R] [IsDedekindDomain R] -+private theorem two_le_absNorm {R : Type*} [CommRing R] [IsDedekindDomain R] [Infinite R] - [Module.Free ℤ R] [Module.Finite ℤ R] {𝔭 : Ideal R} (hp : 𝔭.IsPrime) (hb : 𝔭 ≠ ⊥) : - 2 ≤ Ideal.absNorm 𝔭 := by - have hne0 : Ideal.absNorm 𝔭 ≠ 0 := fun h ↦ hb (Ideal.absNorm_eq_zero_iff.mp h) -@@ -2476,7 +2475,7 @@ private theorem two_le_absNorm {R : Type*} [CommRing R] [IsDedekindDomain R] - - /-- For a nonzero prime `𝔭` of a number ring and `Re s > 1`, `‖N𝔭^{-s}‖ ≤ 1/2` (since `N𝔭 ≥ 2`, - `Re s > 1`). The bound that lets the Euler factors enter `norm_one_sub_inv_sub_one_le`. -/ --private theorem norm_absNorm_cpow_neg_le_half {R : Type*} [CommRing R] [IsDedekindDomain R] -+private theorem norm_absNorm_cpow_neg_le_half {R : Type*} [CommRing R] [IsDedekindDomain R] [Infinite R] - [Module.Free ℤ R] [Module.Finite ℤ R] {s : ℂ} (hs : 1 < s.re) - (𝔭 : {𝔭 : Ideal R // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥}) : - ‖(Ideal.absNorm 𝔭.1 : ℂ) ^ (-s)‖ ≤ 1 / 2 := by -@@ -2581,7 +2580,7 @@ private def underUP - (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] - (𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ UnramifiedIn K L (𝔓.under (𝓞 K))}) : - {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭} := -- ⟨𝔓.1.under (𝓞 K), by haveI := 𝔓.2.1; exact inferInstance, 𝔓.2.2.2⟩ -+ ⟨𝔓.1.under (𝓞 K), by have := 𝔓.2.1; exact inferInstance, 𝔓.2.2.2⟩ - - @[simp] private theorem underUP_val - (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] -@@ -2600,8 +2599,8 @@ private def fiberUnderEquiv - toFun 𝔓 := ⟨𝔓.1.1, 𝔓.1.2.1, ⟨by - have h := congrArg Subtype.val 𝔓.2; rw [underUP_val] at h; rw [← h]⟩, 𝔓.1.2.2.1⟩ - invFun 𝔔 := ⟨⟨𝔔.1, 𝔔.2.1, 𝔔.2.2.2, by -- haveI := 𝔔.2.1; haveI := 𝔔.2.2.1; rw [← 𝔔.2.2.1.over]; exact c.2.2⟩, by -- haveI := 𝔔.2.1; haveI := 𝔔.2.2.1 -+ have := 𝔔.2.1; have := 𝔔.2.2.1; rw [← 𝔔.2.2.1.over]; exact c.2.2⟩, by -+ have := 𝔔.2.1; have := 𝔔.2.2.1 - exact Subtype.ext (by rw [underUP_val]; exact 𝔔.2.2.1.over.symm)⟩ - left_inv 𝔓 := by ext; rfl - right_inv 𝔔 := by ext; rfl -@@ -2632,7 +2631,6 @@ private def ramifiedFlattenEquiv - left_inv _ := rfl - right_inv _ := rfl - --set_option backward.isDefEq.respectTransparency false in - /-- The unramified part of the prime-ideal Euler product equals `∏_χ L_χ`. Regroup the unramified - `L`-primes fibrewise over the `K`-prime below them (`Equiv.sigmaFiberEquiv` + - `Multipliable.tprod_sigma`); each fibre product is `∏_χ (1 - χ(σ_𝔭) N𝔭^{-s})^{-1}` -@@ -2672,16 +2670,16 @@ private theorem tprod_unramified_eq_prod_artinDirichletSeries - HasProd (fun 𝔓 : {𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ - UnramifiedIn K L (𝔓.under (𝓞 K))} // underUP K L 𝔓 = c} ↦ F 𝔓.1.1) (G c) := by - intro c -- haveI : c.1.IsPrime := c.2.1 -- haveI : c.1.IsMaximal := c.2.1.isMaximal (UnramifiedIn.ne_bot K L c.2.2) -- haveI : Finite (c.1.primesOver (𝓞 L)) := -+ have : c.1.IsPrime := c.2.1 -+ have : c.1.IsMaximal := c.2.1.isMaximal (UnramifiedIn.ne_bot K L c.2.2) -+ have : Finite (c.1.primesOver (𝓞 L)) := - (IsDedekindDomain.primesOver_finite c.1 (𝓞 L)).to_subtype -- haveI : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver c.1 ∧ 𝔓 ≠ ⊥} := -+ have : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver c.1 ∧ 𝔓 ≠ ⊥} := - Finite.of_injective - (fun 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver c.1 ∧ 𝔓 ≠ ⊥} ↦ - (⟨𝔓.1, 𝔓.2.1, 𝔓.2.2.1⟩ : c.1.primesOver (𝓞 L))) -- (fun _ _ hab ↦ Subtype.ext (by simpa using hab)) -- haveI : Finite {𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ -+ (fun _ _ hab ↦ Subtype.ext (congrArg (fun q : c.1.primesOver (𝓞 L) ↦ q.1) hab)) -+ have : Finite {𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ - UnramifiedIn K L (𝔓.under (𝓞 K))} // underUP K L 𝔓 = c} := - Finite.of_equiv _ (fiberUnderEquiv K L c).symm - have hval : (∏' 𝔓 : {𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ -@@ -2786,12 +2784,12 @@ private instance finite_ramifiedAbove - (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] : - Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ ¬ UnramifiedIn K L (𝔓.under (𝓞 K))} := by - classical -- haveI : Finite {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭} := -+ have : Finite {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭} := - (finite_ramifiedIn K L).to_subtype -- haveI : ∀ 𝔭 : {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭}, -+ have : ∀ 𝔭 : {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭}, - Finite (𝔭.1.primesOver (𝓞 L)) := fun 𝔭 ↦ by -- haveI : 𝔭.1.IsPrime := 𝔭.2.1 -- haveI : 𝔭.1.IsMaximal := 𝔭.2.1.isMaximal 𝔭.2.2.1 -+ have : 𝔭.1.IsPrime := 𝔭.2.1 -+ have : 𝔭.1.IsMaximal := 𝔭.2.1.isMaximal 𝔭.2.2.1 - exact (IsDedekindDomain.primesOver_finite 𝔭.1 (𝓞 L)).to_subtype - refine Finite.of_injective - (fun 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ ¬ UnramifiedIn K L (𝔓.under (𝓞 K))} ↦ -@@ -2834,7 +2832,7 @@ private theorem log_norm_ramified_factor_bounded - ¬ UnramifiedIn K L (𝔓.under (𝓞 K))}, (1 - (Ideal.absNorm 𝔓.1 : ℂ) ^ (-(s : ℂ)))⁻¹‖| ≤ - C := by - classical -- haveI : Fintype {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ -+ have : Fintype {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ - ¬ UnramifiedIn K L (𝔓.under (𝓞 K))} := Fintype.ofFinite _ - set R : ℝ → ℂ := fun s ↦ ∏ 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ - ¬ UnramifiedIn K L (𝔓.under (𝓞 K))}, (1 - (Ideal.absNorm 𝔓.1 : ℂ) ^ (-(s : ℂ)))⁻¹ with hR -@@ -2932,7 +2930,7 @@ private theorem analyticAt_one_of_analyticOn_finrankDomain (K : Type*) [Field K] - have hdpos : (0 : ℝ) < (Module.finrank ℚ K : ℝ)⁻¹ := by - have : 0 < Module.finrank ℚ K := Module.finrank_pos - positivity -- simp only [Set.mem_setOf_eq, Complex.one_re]; linarith -+ simp only [Set.mem_ofPred_eq, Complex.one_re]; linarith - exact hLf.analyticAt ((isOpen_lt continuous_const Complex.continuous_re).mem_nhds hmem) - - open Filter Topology Set in -@@ -3034,8 +3032,8 @@ private theorem sum_ite_pole_zero_cancel - (if χ' = 1 then a else if χ' = χ then -a else 0) = - (if χ' = 1 then a else 0) + (if χ' = χ then -a else 0) := fun χ' ↦ by - by_cases h1 : χ' = 1 -- · rw [if_pos h1, if_pos h1, if_neg (h1 ▸ Ne.symm hχ), add_zero] -- · rw [if_neg h1, if_neg h1]; by_cases hc : χ' = χ <;> simp [hc] -+ · rw [ite_eq_left h1, ite_eq_left h1, ite_eq_right (h1 ▸ Ne.symm hχ), add_zero] -+ · rw [ite_eq_right h1, ite_eq_right h1]; by_cases hc : χ' = χ <;> simp [hc] - rw [Finset.sum_congr rfl fun χ' _ ↦ hsplit χ', Finset.sum_add_distrib, - Finset.sum_ite_eq' Finset.univ (1 : galoisCharacter K L), Finset.sum_ite_eq' Finset.univ χ] - simp -@@ -3061,14 +3059,14 @@ private theorem log_norm_artinDirichletSeries_le_pole_zero_ite - by_cases h1 : χ' = 1 - · subst h1 - obtain ⟨C1, hC1⟩ := log_norm_artinDirichletSeries_one_le K L -- exact ⟨C1, by filter_upwards [hC1] with s hs; rwa [if_pos rfl]⟩ -+ exact ⟨C1, by filter_upwards [hC1] with s hs; rwa [ite_eq_left rfl]⟩ - · by_cases hc : χ' = χ - · subst hc -- exact ⟨Cχ, by filter_upwards [hCχ] with s hs; rwa [if_neg h1, if_pos rfl]⟩ -+ exact ⟨Cχ, by filter_upwards [hCχ] with s hs; rwa [ite_eq_right h1, ite_eq_left rfl]⟩ - · obtain ⟨C, hC⟩ := artinDirichletSeries_norm_le_of_ne_one K L m hm χ' h1 - refine ⟨Real.log (max C 1), ?_⟩ - filter_upwards [hC] with s hs -- simp only [if_neg h1, if_neg hc, zero_add] -+ simp only [ite_eq_right h1, ite_eq_right hc, zero_add] - have hmax1 : (1 : ℝ) ≤ max C 1 := le_max_right _ _ - rcases le_total ‖artinDirichletSeries K L χ' (s : ℂ)‖ 0 with h0 | h0 - · have hz : ‖artinDirichletSeries K L χ' (s : ℂ)‖ = 0 := le_antisymm h0 (norm_nonneg _) -diff --git a/projects/DedekindResidue/DedekindResidue/AuxiliaryFunction.lean b/projects/DedekindResidue/DedekindResidue/AuxiliaryFunction.lean -index 8e22b1de6..f9545f056 100644 ---- a/projects/DedekindResidue/DedekindResidue/AuxiliaryFunction.lean -+++ b/projects/DedekindResidue/DedekindResidue/AuxiliaryFunction.lean -@@ -44,7 +44,7 @@ noncomputable def auxF (s : ℂ) (X t : ℝ) : ℂ := - - /-- On the plateau `|t| ≤ log X`, `F_{s,X}(t) = 1` — eq. (11). -/ - theorem auxF_of_le (s : ℂ) (X : ℝ) {t : ℝ} (h : |t| ≤ Real.log X) : auxF s X t = 1 := by -- unfold auxF; exact if_pos h -+ unfold auxF; exact ite_eq_left h - - /-- `F_{s,X}(0) = 1` whenever `X ≥ 1` (so `log X ≥ 0`, putting `0` on the plateau). -/ - theorem auxF_zero (s : ℂ) {X : ℝ} (hX : 1 ≤ X) : auxF s X 0 = 1 := -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/AnalyticControl.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/AnalyticControl.lean -index 5c23f3c90..8c56d23e6 100644 ---- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/AnalyticControl.lean -+++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/AnalyticControl.lean -@@ -228,7 +228,7 @@ theorem exists_re_norm_dedekindZeta_ge_half : - · simp - rcases eq_or_ne n 0 with rfl | hn0 - · simp -- rw [if_neg hn1, LSeries.norm_term_eq, LSeries.norm_term_eq, if_neg hn0, if_neg hn0, -+ rw [ite_eq_right hn1, LSeries.norm_term_eq, LSeries.norm_term_eq, ite_eq_right hn0, ite_eq_right hn0, - show ((2:ℂ)).re = (2:ℝ) by norm_num] - have hn2 : (2:ℝ) ≤ (n:ℝ) := by exact_mod_cast (by omega : 2 ≤ n) - have hnpos : (0:ℝ) < n := by linarith -@@ -259,7 +259,7 @@ theorem exists_re_norm_dedekindZeta_ge_half : - refine Summable.of_nonneg_of_le (fun n => norm_nonneg _) (fun n => ?_) hsummS.norm - rcases eq_or_ne n 1 with rfl | hn1 - · simp -- · rw [if_neg hn1] -+ · rw [ite_eq_right hn1] - have hcompar : Summable (fun n : ℕ => (1/2:ℝ)^m * ‖LSeries.term f 2 n‖) := - (hsum2.norm).mul_left _ - have hRbound : ‖∑' n : ℕ, ite (n = 1) 0 (LSeries.term f s n)‖ ≤ T * (1/2)^m := by -@@ -463,7 +463,7 @@ theorem norm_dedekindZeta_le_of_two_le_re {s : ℂ} (hs : 2 ≤ s.re) : - intro n - rcases eq_or_ne n 0 with rfl | hn0 - · simp -- rw [LSeries.norm_term_eq, LSeries.norm_term_eq, if_neg hn0, if_neg hn0, -+ rw [LSeries.norm_term_eq, LSeries.norm_term_eq, ite_eq_right hn0, ite_eq_right hn0, - show ((2:ℂ)).re = (2:ℝ) by norm_num] - have hn1 : (1:ℝ) ≤ (n:ℝ) := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hn0 - gcongr -@@ -602,11 +602,10 @@ theorem one_add_abs_im_le_two_norm_sub_four {z : ℂ} (_h1 : -1 ≤ z.re) (h2 : - simpa using h - linarith - --/-- The comparator sine-exponent: `n_K = r₁ + 2r₂`. -/ -+ - noncomputable def gammaExponent : ℕ := nrRealPlaces K + 2 * nrComplexPlaces K - --/-- Right boundary bound for the comparator --`G = H⁴·sin(πz)^{n_K}/(z-4)^{4n_K+8}` on `Re z = 2`. -/ -+ - theorem comparator_bound_right : - ∃ M : ℝ, 0 < M ∧ ∀ t : ℝ, - ‖completedDedekindZetaEntire K (((2:ℝ) : ℂ) + (t : ℂ) * Complex.I)‖^4 -@@ -715,8 +714,7 @@ theorem comparator_bound_right : - + (B * 25)^4 * Real.exp ((n:ℝ) * (π * 2)) / 2^(4*n+8) := - le_add_of_nonneg_left (by positivity) - --/-- Left boundary bound for the comparator on `Re z = -1`, by reflecting to the right --boundary through the functional equation. -/ -+ - theorem comparator_bound_left : - ∃ M : ℝ, 0 < M ∧ ∀ t : ℝ, - ‖completedDedekindZetaEntire K (((-1:ℝ) : ℂ) + (t : ℂ) * Complex.I)‖^4 -@@ -794,10 +792,7 @@ theorem comparator_bound_left : - (by positivity) (pow_le_pow_left₀ (norm_nonneg _) hden _) - _ ≤ M := hM (-t) - --/-- Sub-double-exponential growth of the AC-A3 comparator --`completedDedekindZetaEntire K ^ 4 * sin (π z) ^ n / (z - 4) ^ (4 n + 8)` on the strip --`-1 ≤ Re ≤ 2`, from the polynomial strip bound `‖H‖ ≤ B (1 + ‖z‖)²`. Supplies the --growth hypothesis of the Phragmén–Lindelöf step in `comparator_bound_strip`. -/ -+ - private theorem comparator_isBigO_growth {B : ℝ} (hB0 : 0 ≤ B) - (hB : ∀ w : ℂ, -1 ≤ w.re → w.re ≤ 2 → - ‖completedDedekindZetaEntire K w‖ ≤ B * (1 + ‖w‖) ^ 2) : -@@ -904,8 +899,7 @@ private theorem comparator_isBigO_growth {B : ℝ} (hB0 : 0 ≤ B) - nlinarith - exact mul_le_mul_of_nonneg_left hexp_le (by positivity) - --/-- **The comparator is bounded on the whole strip** `-1 ≤ Re z ≤ 2` --(Phragmén–Lindelöf between the two boundary bounds). -/ -+ - theorem comparator_bound_strip : - ∃ M : ℝ, 0 < M ∧ ∀ z : ℂ, -1 ≤ z.re → z.re ≤ 2 → - ‖completedDedekindZetaEntire K z^4 * Complex.sin (π * z)^(gammaExponent K) -@@ -925,7 +919,7 @@ theorem comparator_bound_strip : - simp [sub_eq_zero] at this - rw [this] at hw - norm_num at hw -- -- differentiability up to the boundary -+ - have hfd : DiffContOnCl ℂ f (Complex.re ⁻¹' Set.Ioo (-1 : ℝ) 2) := by - have hcl : closure (Complex.re ⁻¹' Set.Ioo (-1 : ℝ) 2) - ⊆ Complex.re ⁻¹' Set.Icc (-1 : ℝ) 2 := -@@ -946,7 +940,7 @@ theorem comparator_bound_strip : - fun z => Real.exp (Bg * Real.exp (c * |z.im|)) := by - simp only [hf, hn] - exact comparator_isBigO_growth K hB0 hB -- -- boundary bounds in PL form -+ - have hle_a : ∀ w : ℂ, w.re = -1 → ‖f w‖ ≤ M₁ + M₂ := by - intro w hw - have hweq : w = ((-1:ℝ) : ℂ) + (w.im : ℂ) * Complex.I := by -@@ -995,7 +989,7 @@ theorem exists_H_strip_decay : - set t : ℝ := z.im with hts - set C₀ : ℝ := (M * 5^(4*n+8) * 3^n) ^ ((1:ℝ)/4) + 1 with hC₀ - have hC₀0 : 0 < C₀ := by positivity -- -- the comparator bound, cleared of the normalizer -+ - have hcomp := hM z h1 h2 - rw [norm_div, norm_mul, norm_pow, norm_pow, norm_pow] at hcomp - -- sine lower bound -@@ -1041,7 +1035,7 @@ theorem exists_H_strip_decay : - rw [abs_sub_comm, abs_of_pos (by linarith : (0:ℝ) < 4 - z.re)] - linarith - nlinarith [abs_nonneg t] -- -- solve the comparator inequality for ‖H‖⁴ -+ - have hsinpos : (0:ℝ) < ‖Complex.sin (π * z)‖ := by - have h3 : (0:ℝ) < Real.exp (π * |t|) / 3 := by positivity - linarith -@@ -1656,8 +1650,7 @@ theorem exists_H_upper_right (σ₁ : ℝ) (hσ₁ : 2 ≤ σ₁) : - rw [pow_add] - ring - --/-- Sphere-sup bound for the Jensen ball: at center `A+iT` with radius `A+1`, every --point of the closed ball satisfies the decaying envelope bound (in terms of `|T|`). -/ -+ - theorem exists_H_ball_sup (A : ℝ) (hA : 2 ≤ A) : - ∃ C : ℝ, 0 < C ∧ ∃ P : ℕ, ∀ T : ℝ, A + 5 ≤ |T| → - ∀ z ∈ Metric.closedBall ((A : ℂ) + (T : ℂ) * Complex.I) (A + 1), -@@ -1743,10 +1736,7 @@ theorem exists_H_ball_sup (A : ℝ) (hA : 2 ≤ A) : - rw [mul_pow] - ring - --/-- **AC-A4: per-height zero counting.** There are an abscissa `A` and a constant `C` --such that for all heights `|T| ≥ A+5`, the number of zeros of `H` (with multiplicity) --in the closed ball of radius `√(A²+1)` around `A+iT` — a ball containing the critical --slab `0 ≤ Re ≤ 1`, `|Im - T| ≤ 1` — is at most `C·log(2+|T|)`. -/ -+ - theorem exists_ball_zero_count : - ∃ A : ℝ, 2 ≤ A ∧ ∃ C : ℝ, 0 < C ∧ ∀ T : ℝ, A + 5 ≤ |T| → - ((∑ᶠ u, (MeromorphicOn.divisor (completedDedekindZetaEntire K) -@@ -1858,7 +1848,7 @@ theorem exists_ball_zero_count : - meromorphicOrderAt (fun _ : ℂ => (completedDedekindZetaEntire K c)⁻¹) z ≠ ⊤ := by - intro z _ - classical -- rw [meromorphicOrderAt_const, if_neg (inv_ne_zero hHcne)] -+ rw [meromorphicOrderAt_const, ite_eq_right (inv_ne_zero hHcne)] - exact WithTop.zero_ne_top - have hcmem : c ∈ Metric.closedBall c |Real.sqrt (A^2+1)| := by - rw [habs_r] -@@ -2079,10 +2069,7 @@ theorem exists_H_ball_factorization (c : ℂ) {R : ℝ} - congr 1 - rw [Function.FactorizedRational.finprod_eq_fun hfinsupp] - --/-- Sphere-sup bound for the Landau ball: at center `A+iT` with the larger radius --`A+3`, every point of the closed ball satisfies the decaying envelope bound (in --terms of `|T|`). Left of the critical strip the functional equation reflects the --bound from the right half-plane. -/ -+ - theorem exists_H_ball_sup_big (A : ℝ) (hA : 2 ≤ A) : - ∃ C : ℝ, 0 < C ∧ ∃ P : ℕ, ∀ T : ℝ, A + 5 ≤ |T| → - ∀ z ∈ Metric.closedBall ((A : ℂ) + (T : ℂ) * Complex.I) (A + 3), -@@ -2186,10 +2173,7 @@ theorem exists_H_ball_sup_big (A : ℝ) (hA : 2 ≤ A) : - rw [mul_pow] - ring - --/-- **Per-height zero counting at the Landau radius.** Given the abscissa `A` with the --envelope-matched center lower bound, the number of zeros of `H` (with multiplicity) in --the closed ball of radius `A+2` around `A+iT` is at most `C·log(2+|T|)`. Parametric in --`A` and the center bound so that downstream users can share one `A`. -/ -+ - theorem exists_ball_zero_count_big (A : ℝ) (hA2 : 2 ≤ A) (cL : ℝ) (hcL : 0 < cL) - (hlow : ∀ t : ℝ, 2 ≤ |t| → - cL * Real.exp (-(((gammaExponent K : ℕ) : ℝ) * (π * |t|)) / 4) -@@ -2298,7 +2282,7 @@ theorem exists_ball_zero_count_big (A : ℝ) (hA2 : 2 ≤ A) (cL : ℝ) (hcL : 0 - meromorphicOrderAt (fun _ : ℂ => (completedDedekindZetaEntire K c)⁻¹) z ≠ ⊤ := by - intro z _ - classical -- rw [meromorphicOrderAt_const, if_neg (inv_ne_zero hHcne)] -+ rw [meromorphicOrderAt_const, ite_eq_right (inv_ne_zero hHcne)] - exact WithTop.zero_ne_top - have hcmem : c ∈ Metric.closedBall c |A + 2| := by - rw [habs_r] -@@ -2482,11 +2466,7 @@ theorem exists_H_two_radius_factorization (c : ℂ) {r₁ r₂ : ℝ} (h12 : r - rw [hfac z hz, hsplit z] - ring - --/-- **Landau's logarithmic-derivative bound** (A5-ii-c, generic form): if `h` is --holomorphic and zero-free on `ball c r` with `‖h‖ ≤ mS` there and `mL ≤ ‖h c‖` at the --center, then `‖h'/h‖ ≤ 32·r·(log(mS/mL) + 1)` on the concentric closed ball of radius --`r - 3/4`. Chain: holomorphic logarithm on the convex ball, Borel–Carathéodory from the --`Re`-bound `log(mS/mL)`, then the Schwarz derivative estimate on quarter-balls. -/ -+ - theorem norm_logDeriv_le_of_norm_le {h : ℂ → ℂ} {c : ℂ} {r : ℝ} (hr : 3/4 < r) - (hd : DifferentiableOn ℂ h (Metric.ball c r)) - (h0 : ∀ z ∈ Metric.ball c r, h z ≠ 0) -@@ -2535,7 +2515,7 @@ theorem norm_logDeriv_le_of_norm_le {h : ℂ → ℂ} {c : ℂ} {r : ℝ} (hr : - intro w hw - refine Complex.borelCaratheodory_zero hM0 hGd ?_ hr0 hw ?_ - · intro x hx -- simp only [Set.mem_setOf_eq] -+ simp only [Set.mem_ofPred_eq] - refine hreG (c + x) ?_ - rw [Metric.mem_ball] at hx ⊢ - simpa [dist_eq_norm] using hx -@@ -2630,7 +2610,7 @@ private theorem pow_sum_toNat_le_norm_prod_sub {F : Finset ℂ} {D : ℂ → ℤ - (hzu : ∀ u ∈ F, b ≤ ‖z - u‖) : - b ^ (∑ u ∈ F, (D u).toNat) ≤ ‖∏ u ∈ F, (z - u) ^ D u‖ := by - rw [norm_prod_sub_zpow hD, ← Finset.prod_pow_eq_pow_sum] -- exact Finset.prod_le_prod (fun u _ => by positivity) -+ exact Finset.prod_le_prod₀ (fun u _ => by positivity) - (fun u hu => pow_le_pow_left₀ hb (hzu u hu) _) - - /-- Upper bound for the norm of a monic-type product: if every factor distance `‖z - u‖` -@@ -2640,13 +2620,10 @@ private theorem norm_prod_sub_le_pow {F : Finset ℂ} {D : ℂ → ℤ} - (hzu : ∀ u ∈ F, ‖z - u‖ ≤ B) : - ‖∏ u ∈ F, (z - u) ^ D u‖ ≤ B ^ (∑ u ∈ F, (D u).toNat) := by - rw [norm_prod_sub_zpow hD, ← Finset.prod_pow_eq_pow_sum] -- exact Finset.prod_le_prod (fun u _ => by positivity) -+ exact Finset.prod_le_prod₀ (fun u _ => by positivity) - (fun u hu => pow_le_pow_left₀ (norm_nonneg _) (hzu u hu) _) - --/-- **Divisor monotonicity from an open ball to its closed ball.** For an everywhere-analytic --`f`, the (nonnegative) zero-count divisor over `ball c r` sums to at most the divisor over --`closedBall c r`, since the local orders agree and the open-ball support is contained in the --closed-ball support. -/ -+ - private theorem finsum_divisor_ball_le_closedBall {f : ℂ → ℂ} - (hf : ∀ z : ℂ, AnalyticAt ℂ f z) (c : ℂ) (r : ℝ) : - (∑ᶠ u, (MeromorphicOn.divisor f (Metric.ball c r)) u) -@@ -2692,9 +2669,7 @@ private theorem finsum_divisor_ball_le_closedBall {f : ℂ → ℂ} - exact hu (hfin₁.mem_toFinset.mpr (Function.mem_support.mpr h0))) - _ ≤ ∑ u ∈ hfincl.toFinset, Dcl u := Finset.sum_le_sum (fun u _ => hpt u) - --/-- **Maximum-modulus sup bound on a closed ball from a bound on its sphere.** If `f` is --analytic on the open ball `ball c R` and `‖f‖ ≤ C` on the sphere `sphere c ρ` (with --`0 < ρ < R`), then `‖f‖ ≤ C` on the whole closed ball `closedBall c ρ`. -/ -+ - private theorem norm_le_of_frontier_ball {f : ℂ → ℂ} {c : ℂ} {ρ R : ℝ} - (hρ : 0 < ρ) (hρR : ρ < R) - (hanal : AnalyticOnNhd ℂ f (Metric.ball c R)) -@@ -2891,7 +2866,7 @@ theorem exists_H_landau_cofactor : - _ ≤ ((∑ᶠ u, (MeromorphicOn.divisor (completedDedekindZetaEntire K) - (Metric.closedBall c (A+2))) u : ℤ) : ℝ) := by exact_mod_cast hDnatZ_le - _ ≤ Cc * Real.log (2 + |T|) := hclosed -- -- export the open-ball zero count -+ - have hcount_open : ((∑ᶠ u, D₁ u : ℤ) : ℝ) - ≤ (32 * (A+2) - * (|Real.log (cB/cL)| + (P+Pn) + Cc * Real.log (2*(A+2)) + 1) + Cc) -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/Existence.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/Existence.lean -index d305719d4..3dc187db1 100644 ---- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/Existence.lean -+++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/Existence.lean -@@ -48,7 +48,7 @@ theorem prod_place_gamma (σ : ℝ) : - rw [Finset.prod_const, Finset.card_univ]] - refine Finset.prod_congr rfl (fun w _ => ?_) - rw [show (mult (w : InfinitePlace K) : ℝ) = 1 by -- rw [mult, if_pos w.2] -+ rw [mult, ite_eq_left w.2] - norm_num] - norm_num - · rw [show (π ^ (-(2 * σ)) * Real.Gamma (2 * σ)) ^ (nrComplexPlaces K) -@@ -60,7 +60,7 @@ theorem prod_place_gamma (σ : ℝ) : - (fun w : InfinitePlace K => not_isReal_iff_isComplex))).trans rfl).symm] - refine Finset.prod_congr rfl (fun w _ => ?_) - rw [show (mult (w : InfinitePlace K) : ℝ) = 2 by -- rw [mult, if_neg w.2] -+ rw [mult, ite_eq_right w.2] - norm_num] - - open scoped Classical in -@@ -231,7 +231,7 @@ theorem analyticOnNhd_completedDedekindZeta : - intro h - have : z = 0 := by linear_combination (2:ℂ) * h - rw [this] at hz -- norm_num [Set.mem_setOf_eq] at hz -+ norm_num [Set.mem_ofPred_eq] at hz - have hzk : z / 2 ≠ (((heckeFEPair K).k : ℝ) : ℂ) := by - intro h - rw [show (heckeFEPair K).k = 1/2 from rfl] at h -@@ -239,7 +239,7 @@ theorem analyticOnNhd_completedDedekindZeta : - push_cast at h - linear_combination (2:ℂ) * h - rw [this] at hz -- norm_num [Set.mem_setOf_eq] at hz -+ norm_num [Set.mem_ofPred_eq] at hz - have hd := (heckeFEPair K).differentiableAt_Λ (Or.inl hz2) (Or.inl hzk) - have hhalf : DifferentiableAt ℂ (fun w : ℂ => w / 2) z := by fun_prop - exact DifferentiableAt.comp (𝕜 := ℂ) (g := (heckeFEPair K).Λ) -@@ -358,7 +358,7 @@ theorem completedDedekindZeta_eq_of_one_lt_re {s : ℂ} (hs : 1 < s.re) : - exact (LSeries_hasDerivAt hz').differentiableAt - have hF₂ := analyticOnNhd_completedZetaPrefactor_mul_dedekindZeta K hζat - have h2mem : (2:ℂ) ∈ {z : ℂ | 1 < z.re} := by -- norm_num [Set.mem_setOf_eq] -+ norm_num [Set.mem_ofPred_eq] - have hfreq := frequently_completedDedekindZeta_eq K - have hEq := hF₁.eqOn_of_preconnected_of_frequently_eq hF₂ hUconn h2mem hfreq - exact hEq hs -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/FunctionalEquation.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/FunctionalEquation.lean -index e9cae2b15..8df65b3b9 100644 ---- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/FunctionalEquation.lean -+++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/FunctionalEquation.lean -@@ -82,10 +82,10 @@ theorem IsCompletedDedekindZeta.eqOn {K : Type*} [Field K] [NumberField K] - intro s hs - have hs0' : s ≠ 0 := by - rintro rfl -- norm_num [Set.mem_setOf_eq, Complex.zero_re] at hs -+ norm_num [Set.mem_ofPred_eq, Complex.zero_re] at hs - have hs1' : s ≠ 1 := by - rintro rfl -- norm_num [Set.mem_setOf_eq, Complex.one_re] at hs -+ norm_num [Set.mem_ofPred_eq, Complex.one_re] at hs - rw [hH₁eq s hs0' hs1', hH₂eq s hs0' hs1', h₁.1 s hs, h₂.1 s hs] - have h2mem : (2 : ℂ) ∈ {s : ℂ | 1 < s.re} := by norm_num [Complex.ofReal_re] - have := AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/HeckeTheta.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/HeckeTheta.lean -index 372944eb4..ba69d2efb 100644 ---- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/HeckeTheta.lean -+++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/HeckeTheta.lean -@@ -8,23 +8,6 @@ module - public import Mathlib - public import DedekindResidue.CompletedZeta.IdealLattice - --/-! --# The multivariable Hecke theta of a fractional ideal (SP1-AGE-3) -- --Hecke's functional-equation argument for a number field of unit rank `> 0` uses the --**multivariable** theta of an ideal lattice, with one weight per infinite place, averaged --over a fundamental domain of the unit action. This file builds the per-place weight --machinery and the theta function itself: -- --* `placeWeights c` — expand per-place weights to the `index K` coordinates (equal on the -- `(re, im)` pair of a complex place — the shape preserved by the unit action, since complex -- multiplication mixes the pair but preserves `re² + im²`); --* `sum_placeWeights_embeddingCoords_sq` — `∑ᵢ c_i·ζ(x)ᵢ² = ∑_w c_w·w(x)²`: the weighted -- square-sum of embedding coordinates is the place-absolute-value form. -- --The unit equivariance `Θ(c·w(ε)², L_I) = Θ(c, L_I)` and the box-averaged `g_I` follow --(SP1-AGE-3 continuation), then the Mellin definition of `Λ_K` (AGE-4). ---/ - - namespace DedekindResidue - -@@ -36,8 +19,7 @@ open scoped nonZeroDivisors Real - - variable (K : Type*) [Field K] [NumberField K] - --/-- The `ℝ`-cast field degree `[K : ℚ]` is positive — the packaged `Module.finrank_pos` used --for the degree denominators throughout the Hecke-weight normalisation. -/ -+ - theorem finrank_pos_real : (0 : ℝ) < (Module.finrank ℚ K : ℝ) := by - have := Module.finrank_pos (R := ℚ) (M := K) - positivity -@@ -198,10 +180,10 @@ theorem placeWeights_dualPlaceWeights (c : InfinitePlace K → ℝ) (i : index K - placeWeights K (dualPlaceWeights K c) i - = (placeWeights K c i)⁻¹ * (dualityWeights K i) ^ 2 := by - rcases i with w | ⟨w, j⟩ -- · simp only [placeWeights, Sum.elim_inl, dualPlaceWeights, dualityWeights, if_pos w.2] -+ · simp only [placeWeights, Sum.elim_inl, dualPlaceWeights, dualityWeights, ite_eq_left w.2] - norm_num - · simp only [placeWeights, Sum.elim_inr, dualPlaceWeights, dualityWeights] -- rw [if_neg (by rw [not_isReal_iff_isComplex]; exact w.2)] -+ rw [ite_eq_right (by rw [not_isReal_iff_isComplex]; exact w.2)] - fin_cases j <;> norm_num <;> ring - - open scoped Classical in -@@ -237,7 +219,6 @@ theorem heckeTheta_inversion (I : (FractionalIdeal (𝓞 K)⁰ K)ˣ) - ring - - -- - open scoped Classical in - /-- Extend hyperplane coordinates `u : logSpace K` (indexed by `w ≠ w₀`) to all infinite - places by the trace-zero condition: the `w₀`-component is `-∑_{w ≠ w₀} u_w`. On the image of -@@ -268,10 +249,8 @@ theorem fullLog_add (u v : logSpace K) : - · rfl - - open scoped Classical in --/-- **The Hecke weight family**: `c(t,u)_w = t^{1/n}·exp(2·(trace-zero extension of u)_w / mult w)`. --Pinned by two requirements: `∏_w c_w^{mult w} = t` (the norm ray, giving `N(𝔞)^{-s}` under the --Mellin transform) and equivariance under `u ↦ u + logEmbedding ε` matching --`heckeTheta_unit_mul` (making the theta integrand periodic modulo the unit lattice). -/ -+ -+ - noncomputable def heckeWeights (t : ℝ) (u : logSpace K) : InfinitePlace K → ℝ := fun w => - t ^ ((1 : ℝ) / (Module.finrank ℚ K)) * Real.exp (2 * fullLog K u w / mult w) - -@@ -322,11 +301,11 @@ theorem sum_fullLog (u : logSpace K) : ∑ w : InfinitePlace K, fullLog K u w = - have h1 : fullLog K u (w₀ : InfinitePlace K) - = -∑ w' : {w : InfinitePlace K // w ≠ (w₀ : InfinitePlace K)}, u w' := by - rw [fullLog] -- exact dif_pos rfl -+ exact dite_eq_left rfl - have h2 : ∀ w : {w : InfinitePlace K // w ≠ (w₀ : InfinitePlace K)}, - fullLog K u (w : InfinitePlace K) = u w := by - intro w -- rw [fullLog, dif_neg w.2] -+ rw [fullLog, dite_eq_right w.2] - rw [h1, Finset.sum_congr rfl (fun w _ => h2 w)] - ring - -@@ -404,7 +383,7 @@ theorem prod_placeWeights (c : InfinitePlace K → ℝ) : - congr 1 - · refine Finset.prod_congr rfl (fun w _ => ?_) - simp only [placeWeights, Sum.elim_inl] -- rw [mult, if_pos w.2, pow_one] -+ rw [mult, ite_eq_left w.2, pow_one] - · have hre : (∏ i : {w : InfinitePlace K // ¬ IsReal w}, c ↑i ^ mult (i : InfinitePlace K)) - = ∏ w : {w : InfinitePlace K // IsComplex w}, c ↑w ^ mult (w : InfinitePlace K) := - Fintype.prod_equiv (Equiv.subtypeEquivRight -@@ -413,7 +392,7 @@ theorem prod_placeWeights (c : InfinitePlace K → ℝ) : - refine Finset.prod_congr rfl (fun w _ => ?_) - rw [Fin.prod_univ_two] - simp only [placeWeights, Sum.elim_inr] -- rw [mult, if_neg (by rw [not_isReal_iff_isComplex]; exact w.2)] -+ rw [mult, ite_eq_right (by rw [not_isReal_iff_isComplex]; exact w.2)] - ring - - open scoped Classical in -@@ -471,7 +450,7 @@ theorem fullLog_dualShift (w : InfinitePlace K) : - (mult (w : InfinitePlace K) : ℝ) / 2 * - (if IsReal (w : InfinitePlace K) then 0 else Real.log 4)) = 0 := by - refine Finset.sum_eq_zero (fun w _ => ?_) -- rw [if_pos w.2, mul_zero] -+ rw [ite_eq_left w.2, mul_zero] - have hc : (∑ w : {w : InfinitePlace K // ¬ IsReal w}, - (mult (w : InfinitePlace K) : ℝ) / 2 * - (if IsReal (w : InfinitePlace K) then 0 else Real.log 4)) -@@ -480,7 +459,7 @@ theorem fullLog_dualShift (w : InfinitePlace K) : - (mult (w : InfinitePlace K) : ℝ) / 2 * - (if IsReal (w : InfinitePlace K) then 0 else Real.log 4) = Real.log 4 := by - intro w -- rw [if_neg w.2, mult, if_neg w.2] -+ rw [ite_eq_right w.2, mult, ite_eq_right w.2] - norm_num - rw [Finset.sum_congr rfl (fun w _ => hterm w), Finset.sum_const, nsmul_eq_mul] - congr 1 -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/MellinAgreement.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/MellinAgreement.lean -index c1ddb8fb9..cb30568d9 100644 ---- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/MellinAgreement.lean -+++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/MellinAgreement.lean -@@ -341,7 +341,7 @@ theorem lintegral_eq_tsum_box_shift (f : logSpace K → ℝ≥0∞) : - classical - set B := (basisUnitLattice K).ofZLatticeBasis ℝ with hB - have hFD := ZSpan.isAddFundamentalDomain B volume -- haveI : VAddInvariantMeasure (Submodule.span ℤ (Set.range ⇑B)) (logSpace K) volume := -+ have : VAddInvariantMeasure (Submodule.span ℤ (Set.range ⇑B)) (logSpace K) volume := - inferInstanceAs - (VAddInvariantMeasure (Submodule.span ℤ (Set.range ⇑B)).toAddSubgroup - (logSpace K) volume) -@@ -453,11 +453,11 @@ theorem tsum_ite_eq_tsum_coneUnfold_ennreal (J : (Ideal (𝓞 K))⁰) - have hgpr : g ((euclidMixedEquiv K).symm - ((∏ i, fundSystem K i ^ (pr.2 i)) • ((pr.1 : mixedSpace K)))) ≠ 0 := by - rw [hvw] -- rwa [if_neg hvne] at hv -+ rwa [ite_eq_right hvne] at hv - refine ⟨⟨pr, hgpr⟩, ?_⟩ - exact Subtype.ext hvw - · rintro ⟨p, hp⟩ -- rw [if_neg (hne p)] -+ rw [ite_eq_right (hne p)] - - open scoped Classical in - /-- The canonical algebraic preimage of a cone point. -/ -@@ -577,9 +577,9 @@ theorem lintegral_box_theta_tail (J : (Ideal (𝓞 K))⁰) {t : ℝ} (ht : 0 < t - rw [lintegral_tsum (fun v => ?_)] - swap - · by_cases hv : v = 0 -- · simp only [if_pos hv] -+ · simp only [ite_eq_left hv] - exact aemeasurable_const -- · simp only [if_neg hv] -+ · simp only [ite_eq_right hv] - exact (ENNReal.continuous_ofReal.comp (continuous_gaussTerm K t _)).aemeasurable - -- Step 3: the per-v box integral is `ite (v = 0) 0 (G ↑v)` - have hstep3 : ∀ v : idealZLattice K (FractionalIdeal.mk0 K J), -@@ -589,12 +589,12 @@ theorem lintegral_box_theta_tail (J : (Ideal (𝓞 K))⁰) {t : ℝ} (ht : 0 < t - = if v = 0 then 0 else G (v : EuclideanSpace ℝ (index K)) := by - intro v - by_cases hv : v = 0 -- · rw [if_pos hv] -+ · rw [ite_eq_left hv] - rw [setLIntegral_congr_fun (ZSpan.fundamentalDomain_measurableSet _) -- (fun u _ => if_pos hv), lintegral_zero] -- · rw [if_neg hv, hG] -+ (fun u _ => ite_eq_left hv), lintegral_zero] -+ · rw [ite_eq_right hv, hG] - exact setLIntegral_congr_fun (ZSpan.fundamentalDomain_measurableSet _) -- (fun u _ => if_neg hv) -+ (fun u _ => ite_eq_right hv) - rw [tsum_congr hstep3] - -- Step 4: cone reindex (on the G-valued family) - rw [tsum_ite_eq_tsum_coneUnfold_ennreal K J G] -@@ -692,7 +692,7 @@ theorem heckeLogMap_injective : Function.Injective (heckeLogMap K) := by - field_simp at this - linarith - rw [fullLog] at hfl -- rw [dif_neg w'.2] at hfl -+ rw [dite_eq_right w'.2] at hfl - simpa using hfl - rw [hτ, hu] - rfl -@@ -906,7 +906,7 @@ theorem tsum_idealSet_norm_rpow (J : (Ideal (𝓞 K))⁰) (σ : ℝ) : - (∑' _ζ : torsion K, ENNReal.ofReal ((((n : ℝ)) ^ 2) ^ (-σ))) - = (torsionOrder K) * ENNReal.ofReal ((((n : ℝ)) ^ 2) ^ (-σ)) := by - intro I -- letI := Fintype.ofFinite (torsion K) -+ let := Fintype.ofFinite (torsion K) - rw [tsum_fintype, Finset.sum_const, nsmul_eq_mul, Units.torsionOrder, - Nat.card_eq_fintype_card] - norm_cast -@@ -1142,8 +1142,8 @@ theorem sum_mult_heckeLogCLE (p : ℝ × logSpace K) : - field_simp - - open scoped Classical in --/-- **The universal Mellin constant in closed form**: the change of variables along the --Hecke substitution factorises the master integral into per-place Gamma integrals. -/ -+ -+ - theorem lintegral_exp_heckeLog (σ : ℝ) (hσ : 0 < σ) : - ∫⁻ p : ℝ × logSpace K, ENNReal.ofReal (Real.exp (σ * p.1 - - π * ∑ w : InfinitePlace K, Real.exp ((heckeLogCLE K p) w))) -@@ -1367,7 +1367,7 @@ theorem setLIntegral_box_swap (f : logSpace K → ℝ≥0∞) - have h2 := ZSpan.isAddFundamentalDomain ((basisUnitLattice K).ofZLatticeBasis ℝ) volume - rw [(Module.Free.chooseBasis ℤ (unitLattice K)).ofZLatticeBasis_span ℝ] at h1 - rw [(basisUnitLattice K).ofZLatticeBasis_span ℝ] at h2 -- haveI : VAddInvariantMeasure (unitLattice K) (logSpace K) volume := -+ have : VAddInvariantMeasure (unitLattice K) (logSpace K) volume := - inferInstanceAs (VAddInvariantMeasure (unitLattice K).toAddSubgroup (logSpace K) volume) - refine h1.setLIntegral_eq h2 (f := f) (fun l x => ?_) - rw [Submodule.vadd_def, vadd_eq_add] -@@ -1774,8 +1774,8 @@ theorem sum_count_eq_card_le (n : ℕ) : - ∑ k ∈ Finset.Icc 1 n, - (Nat.card {I : Ideal (𝓞 K) // Ideal.absNorm I = k} : ℝ) - = (Nat.card {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ n} : ℝ) := by -- haveI : ∀ k : (Finset.Icc 1 n), Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = (k : ℕ)} := -- fun k => (Ideal.finite_setOf_absNorm_eq (S := 𝓞 K) (k : ℕ)).to_subtype -+ have : ∀ k : (Finset.Icc 1 n), Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = (k : ℕ)} := -+ fun k => (Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 K) (k : ℕ)).to_subtype - rw [show (Nat.card {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ n}) - = Nat.card (Σ k : (Finset.Icc 1 n), - {I : Ideal (𝓞 K) // Ideal.absNorm I = (k : ℕ)}) from -@@ -1885,18 +1885,18 @@ theorem summable_ideal_norm_rpow {s : ℝ} (hs : 1 < s) : - exact h1.congr (fun n => (h2 n)) - refine h3.congr (fun n => ?_) - by_cases hn : n = 0 -- · rw [if_pos hn, hn] -+ · rw [ite_eq_left hn, hn] - rw [Nat.cast_zero, Real.zero_rpow (by linarith), mul_zero] -- · rw [if_neg hn, Real.rpow_neg (Nat.cast_nonneg n), div_eq_mul_inv] -+ · rw [ite_eq_right hn, Real.rpow_neg (Nat.cast_nonneg n), div_eq_mul_inv] - -- transfer to the ideal-indexed sum by fibering over the norm - have hnn : ∀ p : (Σ n : ℕ, {b : (Ideal (𝓞 K))⁰ // - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n}), - 0 ≤ ((Ideal.absNorm ((p.2 : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) : ℝ)) ^ (-s) := - fun p => Real.rpow_nonneg (Nat.cast_nonneg _) _ -- haveI hfibfin : ∀ n : ℕ, Finite {b : (Ideal (𝓞 K))⁰ // -+ have hfibfin : ∀ n : ℕ, Finite {b : (Ideal (𝓞 K))⁰ // - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n} := fun n => by -- haveI : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = n} := -- (Ideal.finite_setOf_absNorm_eq (S := 𝓞 K) n).to_subtype -+ have : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = n} := -+ (Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 K) n).to_subtype - exact Finite.of_injective _ (normFiber_forget_injective K n) - rw [← Equiv.summable_iff (Equiv.sigmaFiberEquiv (fun b : (Ideal (𝓞 K))⁰ => - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K))))] -@@ -1909,7 +1909,7 @@ theorem summable_ideal_norm_rpow {s : ℝ} (hs : 1 < s) : - = ((n : ℝ)) ^ (-s) := by - intro b - rw [b.2] -- haveI : Fintype {b : (Ideal (𝓞 K))⁰ // -+ have : Fintype {b : (Ideal (𝓞 K))⁰ // - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n} := Fintype.ofFinite _ - rw [show (∑' b : {b : (Ideal (𝓞 K))⁰ // - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n}, -@@ -1961,10 +1961,10 @@ theorem dedekindZeta_real_eq {s : ℝ} (hs : 1 < s) : - rw [tsum_congr h2, ← Complex.ofReal_tsum] - congr 1 - -- fiber-glue the real n-sum into the ideal-type sum -- haveI hfibfin : ∀ n : ℕ, Finite {b : (Ideal (𝓞 K))⁰ // -+ have hfibfin : ∀ n : ℕ, Finite {b : (Ideal (𝓞 K))⁰ // - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n} := fun n => by -- haveI : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = n} := -- (Ideal.finite_setOf_absNorm_eq (S := 𝓞 K) n).to_subtype -+ have : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = n} := -+ (Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 K) n).to_subtype - exact Finite.of_injective _ (normFiber_forget_injective K n) - have hsum := summable_ideal_norm_rpow K hs - have hsigma : Summable (fun p : (Σ n : ℕ, {b : (Ideal (𝓞 K))⁰ // -@@ -1986,7 +1986,7 @@ theorem dedekindZeta_real_eq {s : ℝ} (hs : 1 < s) : - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n}, - ((Ideal.absNorm ((b.val : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) : ℝ)) ^ (-s) - = ((n : ℝ)) ^ (-s) := fun b => by rw [b.2] -- haveI : Fintype {b : (Ideal (𝓞 K))⁰ // -+ have : Fintype {b : (Ideal (𝓞 K))⁰ // - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n} := Fintype.ofFinite _ - rw [show (∑' b : {b : (Ideal (𝓞 K))⁰ // - Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n}, -@@ -1997,8 +1997,8 @@ theorem dedekindZeta_real_eq {s : ℝ} (hs : 1 < s) : - rw [tsum_fintype, Finset.sum_const, nsmul_eq_mul, Finset.card_univ] - by_cases hn : n = 0 - · subst hn -- rw [if_pos rfl, Nat.cast_zero, Real.zero_rpow (by linarith), mul_zero] -- · rw [if_neg hn] -+ rw [ite_eq_left rfl, Nat.cast_zero, Real.zero_rpow (by linarith), mul_zero] -+ · rw [ite_eq_right hn] - congr 2 - rw [← Nat.card_eq_fintype_card] - exact Nat.card_congr (normFiberEquiv K n hn).symm -@@ -2014,8 +2014,7 @@ theorem heckeF_dev_nonneg {t : ℝ} (ht : 0 < t) : - rw [hFsum] - exact Finset.sum_nonneg (fun C _ => heckeGClass_dev_nonneg K C ht) - --/-- Positivity of the Gamma-product factor `∏ w, π^(-mult w·σ)·Γ(mult w·σ)` of the closed --Hecke Λ-form (each factor is positive for `σ > 0`). -/ -+ - theorem prod_pi_rpow_mul_Gamma_nonneg {σ : ℝ} (hσ0 : 0 < σ) : - 0 ≤ ∏ w : InfinitePlace K, - π ^ (-((mult w : ℝ) * σ)) * Real.Gamma ((mult w : ℝ) * σ) := by -@@ -2026,8 +2025,7 @@ theorem prod_pi_rpow_mul_Gamma_nonneg {σ : ℝ} (hσ0 : 0 < σ) : - positivity - positivity - --/-- Nonnegativity of the closed real Λ-form (a `heckeBeta` power times the nonnegative --Gamma-product times a nonnegative ideal-norm `tsum`). -/ -+ - theorem heckeClosedLambdaForm_nonneg {σ : ℝ} (hσ0 : 0 < σ) : - (0:ℝ) ≤ (heckeBeta K) ^ (-σ) - * ((((heckeJacobian K : ℝ≥0)) : ℝ) -@@ -2044,8 +2042,8 @@ theorem heckeClosedLambdaForm_nonneg {σ : ℝ} (hσ0 : 0 < σ) : - positivity - - open scoped Classical in --/-- The `ENNReal.ofReal` of the Mellin integral of the Hecke theta deviation equals the --`ofReal` of the closed Γ–ζ form; the ENNReal core of `heckeFEPair_Λ_real`. -/ -+ -+ - theorem ennreal_ofReal_integral_heckeF_dev_eq {σ : ℝ} (hσ0 : 0 < σ) (h2σ : 1 < 2 * σ) - (hri : IntegrableOn (fun t : ℝ => t ^ (σ - 1) * (heckeF K t - heckeFConst K)) - (Set.Ioi (0:ℝ)) volume) -@@ -2066,7 +2064,7 @@ theorem ennreal_ofReal_integral_heckeF_dev_eq {σ : ℝ} (hσ0 : 0 < σ) (h2σ : - fun t ht => ENNReal.ofReal_mul (Real.rpow_nonneg (le_of_lt ht) _) - rw [setLIntegral_congr_fun measurableSet_Ioi hsplit, - lintegral_mellin_heckeF_dev K hσ0] -- -- identify the closed ENNReal form with ofReal of the real one -+ - have hzsum : (∑' b : (Ideal (𝓞 K))⁰, - ENNReal.ofReal ((((Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) : ℝ)) ^ 2) - ^ (-σ))) -@@ -2094,8 +2092,8 @@ theorem ennreal_ofReal_integral_heckeF_dev_eq {σ : ℝ} (hσ0 : 0 < σ) (h2σ : - ← ENNReal.ofReal_mul (by positivity)] - - open scoped Classical in --/-- **The Λ-value identification (e-vi)**: at real `σ > 1/2` the abstract completed --function of the Hecke theta pair is the closed Γ–ζ form. -/ -+ -+ - theorem heckeFEPair_Λ_real {σ : ℝ} (hσ : 1/2 < σ) : - (heckeFEPair K).Λ (σ : ℂ) - = (((heckeBeta K) ^ (-σ) -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonLattice.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonLattice.lean -index db7f899ca..d8a411dcb 100644 ---- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonLattice.lean -+++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonLattice.lean -@@ -9,22 +9,6 @@ public import Mathlib - public import DedekindResidue.CompletedZeta.DualLattice - public import DedekindResidue.CompletedZeta.PoissonSummation - --/-! --# Poisson summation over a general `ℤ`-lattice (SP1-AGP, leaf P.3) -- --Transport of the `ℤ^ι` Poisson formula (`tsum_eq_tsum_fourier_zpoint`) to an arbitrary --`ℤ`-lattice `L ⊂ EuclideanSpace ℝ ι`: conjugate by the linear equivalence sending the standard --lattice to `L`. The Fourier side transforms by the **`GL` change-of-variables law** --(`fourier_comp_linearEquiv`, new to this development: mathlib only has the isometry case --`Real.fourier_comp_linearIsometry`), the dual lattice appears via `dualZLattice_eq_span` --(P.1), and the covolume factor via `ZLattice.covolume_eq_det_mul_measureReal`. -- --## Main results (this file) --* `DedekindResidue.fourier_comp_linearEquiv` — -- `𝓕(g ∘ T) w = |det T|⁻¹ • 𝓕 g ((T⁻¹)^* w)` for `T ∈ GL(EuclideanSpace ℝ ι)`. --* `DedekindResidue.tsum_eq_tsum_fourier_zlattice` — **Poisson summation over a `ℤ`-lattice**: -- `∑'_{v ∈ L} g(v) = covol(L)⁻¹ • ∑'_{w ∈ L♯} 𝓕g(w)`. ---/ - - namespace DedekindResidue - -@@ -160,7 +144,7 @@ theorem adjoint_symm_latticeEquiv_zpoint [DecidableEq ι] - innerₗ_nondegenerate c i j - rw [← innerₗ_apply_apply] - exact this -- simp only [this, mul_ite, mul_one, mul_zero, Finset.sum_ite_eq, Finset.mem_univ, if_true] -+ simp only [this, mul_ite, mul_one, mul_zero, Finset.sum_ite_eq, Finset.mem_univ, ite_true] - rw [hLHS, hRHS] - - /-- **P3d.** The determinant of the lattice-basis change of variables is (up to sign) the -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonSummation.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonSummation.lean -index d37431765b6cd844993a19f34fa0da37c8e6c6ad..9e1c836c4e548e89a5aebceddd3da2d4fbff7de7 100644 -GIT binary patch -delta 148 -zcmbQ$!F2Q!m%Xs$<$LWp-SeBP72dKPNxEa`VGL -USD5*mwL>O}g0*eln;9zw0CzSwivR!s - -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaEstimates.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaEstimates.lean -index c9a2e644c..4c7e21d05 100644 ---- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaEstimates.lean -+++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaEstimates.lean -@@ -91,12 +91,12 @@ theorem tsum_ite_gaussian_tail (L : Submodule ℤ (EuclideanSpace ℝ ι)) - rw [← smul_eq_mul, ← tsum_const_smul'' (Real.exp (-π * (a - a₀) * δ ^ 2))] - refine Summable.tsum_le_tsum (fun v => ?_) ?_ (hsum₀.const_smul _) - · by_cases hv : v = 0 -- · rw [if_pos hv] -+ · rw [ite_eq_left hv] - have : (0:ℝ) < Real.exp (-π * (a - a₀) * δ ^ 2) - * Real.exp (-π * ∑ i, a₀ * ((v : EuclideanSpace ℝ ι) i) ^ 2) := by - positivity - exact le_of_lt (by simpa [smul_eq_mul] using this) -- · rw [if_neg hv, smul_eq_mul, ← Real.exp_add] -+ · rw [ite_eq_right hv, smul_eq_mul, ← Real.exp_add] - refine Real.exp_le_exp.mpr ?_ - have hnorm : δ ^ 2 ≤ ∑ i, ((v : EuclideanSpace ℝ ι) i) ^ 2 := by - have h1 : δ ^ 2 ≤ ‖(v : EuclideanSpace ℝ ι)‖ ^ 2 := -diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaLattice.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaLattice.lean -index dab1b9d9e..efc5f57f2 100644 ---- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaLattice.lean -+++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaLattice.lean -@@ -10,30 +10,6 @@ public import DedekindResidue.CompletedZeta.DualLattice - public import DedekindResidue.CompletedZeta.PoissonSummation - public import DedekindResidue.CompletedZeta.PoissonLattice - --/-! --# The lattice Gaussian theta function and its transformation law (SP1-AGΘ) -- --For a `ℤ`-lattice `L ⊂ EuclideanSpace ℝ ι` the **theta function** --`Θ_L(t) := ∑_{v ∈ L} e^{-π t ‖v‖²}` (`t > 0`) satisfies the **inversion law** -- --`Θ_L(t) = covol(L)⁻¹ · t^{-n/2} · Θ_{L♯}(1/t)`, -- --the standard lattice theta transformation (Neukirch, *Algebraic Number Theory*, VII §3; --the 1-D case is mathlib's `jacobiTheta` functional equation). It is the Gaussian --instantiation of the lattice Poisson formula `tsum_eq_tsum_fourier_zlattice` (P.3): mathlib's --`fourier_gaussian_innerProductSpace` at `b = πt` gives `𝓕 g_t(w) = t^{-n/2} e^{-π‖w‖²/t}`, --and `summable_gaussian_zlattice` discharges the convergence hypotheses. -- --This is the analytic engine of the Hecke functional-equation route (SP1-AGE → SP1-FE): --applied to the ideal lattices of a number field it produces the completed `Λ_K`. -- --## Main definitions / results (this file) --* `DedekindResidue.thetaLattice L t` — `Θ_L(t) = ∑'_{v ∈ L} exp(-π t ‖v‖²)` (real-valued). --* `thetaLattice_transform` — **the inversion law** `Θ_L(t) = covol(L)⁻¹·t^{-n/2}·Θ_{L♯}(1/t)` -- for `t > 0`, fully proven from the lattice Poisson formula + mathlib's Gaussian Fourier -- transform (`fourier_gaussianCM`), with both convergence hypotheses discharged -- (`summable_norm_restrict_gaussianCM`, `summable_fourier_gaussianCM`). ---/ - - namespace DedekindResidue - -@@ -72,12 +48,12 @@ theorem norm_gaussianCM_apply (t : ℝ) (x : EuclideanSpace ℝ ι) : - push_cast; ring - rw [this, Complex.ofReal_re] - --/-- Sub-level sets of a lattice are finite (lattice ∩ closed ball in a proper space). -/ -+ - theorem finite_norm_le_zlattice (L : Submodule ℤ (EuclideanSpace ℝ ι)) - [DiscreteTopology L] (R : ℝ) : - {v : L | ‖(v : EuclideanSpace ℝ ι)‖ ≤ R}.Finite := by - have hcl : IsClosed (L : Set (EuclideanSpace ℝ ι)) := by -- rw [← Submodule.coe_toAddSubgroup]; exact AddSubgroup.isClosed_of_discrete -+ rw [← Submodule.coe_toAddSubgroup]; exact AddSubgroup.isClosed_of_discreteTopology - have hfb : (Metric.closedBall 0 R ∩ (L : Set (EuclideanSpace ℝ ι))).Finite := - Metric.finite_isBounded_inter_isClosed DiscreteTopology.isDiscrete - Metric.isBounded_closedBall hcl -@@ -107,7 +83,7 @@ theorem summable_norm_restrict_gaussianCM (L : Submodule ℤ (EuclideanSpace ℝ - · exact (summable_gaussian_zlattice L (by positivity)).mul_left _ - · rw [Filter.eventually_cofinite] - refine (finite_norm_le_zlattice L R').subset (fun v hv => ?_) -- simp only [Set.mem_setOf_eq] at hv ⊢ -+ simp only [Set.mem_ofPred_eq] at hv ⊢ - by_contra hnotle - rw [not_le] at hnotle - refine hv ?_ -diff --git a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/FourierJordan.lean b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/FourierJordan.lean -index 5171d0c7f..e5f838c02 100644 ---- a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/FourierJordan.lean -+++ b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/FourierJordan.lean -@@ -10,7 +10,7 @@ public import Mathlib.Analysis.Fourier.RiemannLebesgueLemma - public import DedekindResidue.ExplicitFormula.PhiTransform - - /-! --# Fourier–Jordan inversion: the Dirichlet integral (SP2-FJ-c) -+# Fourier–Jordan inversion: the Dirichlet integral - - The classical Dirichlet integral `∫₀^∞ (sin x)/x dx = π/2`, phrased as convergence of the - truncated integrals `∫₀^b (sin x)/x dx → π/2` as `b → ∞`. This is the analytic engine of -@@ -18,7 +18,7 @@ Jordan's pointwise Fourier-inversion criterion for functions of bounded variatio - Poitou's proof of the explicit formula (Poitou, *Sur les petits discriminants*, Séminaire - DPP 1976/77, exposé 6, p. 6-03) to invert the transform `Φ` on the prime side. - --Not available in mathlib. We follow the Frullani/Fubini route: -+The Frullani/Fubini argument uses - `1/x = ∫₀^∞ e^{-xy} dy`, so - `∫₀^b (sin x)/x dx = ∫₀^∞ (1 - e^{-yb}(cos y + y sin b))/(1+y²) dy` - by Fubini and the closed form of the damped sine integral; dominated convergence then gives -@@ -181,7 +181,7 @@ theorem integral_sinc_eq {b : ℝ} (hb : 0 < b) : - rw [mul_comm x y]; ring)] - exact integral_exp_neg_mul_sin y b - --/-- **The Dirichlet integral** (SP2-FJ-c): `∫₀^∞ sin x/x dx = π/2`, as a limit of the -+/-- **The Dirichlet integral**: `∫₀^∞ sin x/x dx = π/2`, as a limit of the - truncated integrals. Fubini against `1/x = ∫ e^{-xy} dy` plus dominated convergence. -/ - theorem tendsto_integral_sinc_atTop : - Filter.Tendsto (fun b : ℝ => ∫ x in (0:ℝ)..b, Real.sin x / x) -@@ -490,7 +490,7 @@ theorem integral_fourier_window_collapse {H : ℝ → ℂ} (hH : Integrable H) { - refine MeasureTheory.integral_congr_ae ?_ - have h0 : ∀ᵐ (u : ℝ), u ≠ 0 := by - rw [MeasureTheory.ae_iff] -- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] -+ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] - exact MeasureTheory.measure_singleton 0 - filter_upwards [h0] with u hu - rw [MeasureTheory.integral_const_mul] -@@ -740,7 +740,7 @@ theorem abs_integral_monotone_kernel_le {g K : ℝ → ℝ} (hg : Monotone g) { - have hcount : Set.Countable {x : ℝ | g x ≠ Function.rightLim g x} := by - refine Set.Countable.mono ?_ hg.countable_not_continuousAt - intro x hx -- simp only [Set.mem_setOf_eq] at hx ⊢ -+ simp only [Set.mem_ofPred_eq] at hx ⊢ - intro hcont - exact hx (hcont.continuousWithinAt.rightLim_eq).symm - have hnull : volume {x : ℝ | g x ≠ Function.rightLim g x} = 0 := -@@ -1023,8 +1023,8 @@ theorem integral_dirichlet_split {H : ℝ → ℂ} (hH : Integrable H) {δ : ℝ - funext u - simp only [Set.indicator_apply, Set.mem_Ico, Set.mem_Ioc] - by_cases hu : -δ ≤ -u ∧ -u < 0 -- · rw [if_pos hu, if_pos ⟨by linarith [hu.2], by linarith [hu.1]⟩] -- · rw [if_neg hu, if_neg (fun h => hu ⟨by linarith [h.2], by linarith [h.1]⟩)] -+ · rw [ite_eq_left hu, ite_eq_left ⟨by linarith [hu.2], by linarith [hu.1]⟩] -+ · rw [ite_eq_right hu, ite_eq_right (fun h => hu ⟨by linarith [h.2], by linarith [h.1]⟩)] - rw [h1, h2, h3, MeasureTheory.integral_indicator measurableSet_Ioc] - have hK_even : ∀ u : ℝ, f (-u) = H (-u) * ((2 * Real.sin (T * u) / u : ℝ) : ℂ) := by - intro u -@@ -1122,8 +1122,7 @@ theorem tendsto_integral_dirichlet_plateau {δ : ℝ} (hδ : 0 < δ) : - push_cast - ring - --/-- **Jordan's Fourier inversion criterion, Dirichlet-kernel form** (SP2-FJ-a/g; Poitou --p. 6-03): for integrable `H` whose real and imaginary parts have bounded variation, with -+/-- **Jordan's Fourier inversion criterion, Dirichlet-kernel form**: for integrable `H` whose real and imaginary parts have bounded variation, with - one-sided limits `Hp` (from the right) and `Hm` (from the left) at `0`, - - `∫_ℝ H(u) · 2sin(Tu)/u du → π(Hp + Hm)` as `T → ∞`. -@@ -1394,7 +1393,7 @@ theorem tendsto_integral_dirichlet_jordan {H : ℝ → ℂ} (hH : Integrable H) - (add_lt_add_of_lt_of_lt hfarT hplat_piece) (hRright.trans hδR.le)) (hRleft.trans hδL.le) - _ = ε := by ring - --/-- **Jordan's Fourier inversion, symmetric-window form** (SP2-FJ-a; Poitou p. 6-03): for -+/-- **Jordan's Fourier inversion, symmetric-window form**: for - integrable `H` of bounded variation with one-sided limits `Hp`, `Hm` at `0`, - - `∫_{-T}^{T} (∫_ℝ H(u) e^{itu} du) dt → π(Hp + Hm)` as `T → ∞`. -diff --git a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/GammaSide.lean b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/GammaSide.lean -index 1f1506cfc..ebf01aa5c 100644 ---- a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/GammaSide.lean -+++ b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/GammaSide.lean -@@ -10,35 +10,13 @@ public import DedekindResidue.ExplicitFormula.RectangleContour - public import DedekindResidue.Lemma2 - - /-! --# The archimedean side: digamma integrals (SP2-Γψ) -+Gauss's integral representation of the digamma function supplies the -+archimedean part of Poitou's explicit formula. It follows from the -+logarithmic derivative of Euler's gamma integral, the Frullani representation -+of the logarithm and Fubini's theorem. Taking digamma differences cancels -+the counterterms and gives the kernel used on vertical lines. - --Poitou's computation of the archimedean part of the explicit formula (Poitou, *Sur les --petits discriminants*, exposé 6, pp. 6-03–6-06) rests on **Gauss's integral formula** --(his eq. (5)) -- --`ψ(z) = -∫₀^∞ (e^{-xz}/(1-e^{-x}) - e^{-x}/x) dx`, `Re z > 0`, -- --and its consequences for `Re ψ` on vertical lines. Mathlib defines `Complex.digamma` --(as `logDeriv Gamma`) but has no integral representation (explicit TODO in --`Mathlib.Analysis.SpecialFunctions.Gamma.Digamma`), so this file builds it from the --Euler integral: `Γ'(z) = ∫₀^∞ t^{z-1}e^{-t} log t dt` (mathlib's --`hasDerivAt_GammaIntegral`), the Frullani representation of `log`, and Fubini — the --classical Gauss derivation. -- --## Main results -- --- `integral_frullani_log` : `∫₀^∞ (e^{-x} - e^{-tx})/x dx = log t` for `t > 0`. --- `integrableOn_rpow_mul_exp_neg_mul_abs_log` : the log-weighted Euler integrand is -- integrable. --- `abs_frullani_kernel_le` : exponential domination of the Frullani kernel. --- `integral_gauss_inner` : the inner evaluation -- `∫₀^∞ t^{z-1}e^{-t}(e^{-x}-e^{-tx})/x dt = Γ(z)(e^{-x} - (1+x)^{-z})/x`. --- `digamma_eq_integral_gauss_one` : **Gauss's first form** -- `ψ(z) = ∫₀^∞ (e^{-x} - (1+x)^{-z})/x dx` for `Re z > 0`. --- `integrableOn_gauss_one_integrand` : integrability of that integrand. --- `digamma_sub_digamma_eq_integral` : **Poitou's difference form** -- `ψ(w) - ψ(σ) = ∫₀^∞ (e^{-σu} - e^{-wu})/(1-e^{-u}) du` (`x = e^u - 1`), the form his -- eq. (5) is used in — both counterterms cancel in the difference. -+Reference: Poitou, *Sur les petits discriminants*, exposé 6, pp. 6-03–6-06. - -/ - - @[expose] public section -@@ -1216,7 +1194,7 @@ theorem hasDerivAt_gammaFT {F : ℝ → ℂ} (hF : Integrable F) - refine h0.congr ?_ - refine (MeasureTheory.ae_restrict_iff' measurableSet_Ioc).mpr ?_ - filter_upwards [MeasureTheory.ae_iff.mpr (by -- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] -+ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] - exact MeasureTheory.measure_singleton (0:ℝ) : volume {x : ℝ | ¬ x ≠ 0} = 0)] - with x hx _ - have hxne : (x:ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hx -@@ -1364,7 +1342,7 @@ theorem hasDerivAt_gammaFT {F : ℝ → ℂ} (hF : Integrable F) - refine MeasureTheory.integral_congr_ae ?_ - refine ((MeasureTheory.ae_restrict_iff' measurableSet_Ioc).mpr ?_) - filter_upwards [MeasureTheory.ae_iff.mpr (by -- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] -+ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] - exact MeasureTheory.measure_singleton (0:ℝ) : volume {x : ℝ | ¬ x ≠ 0} = 0)] - with x hx _ - have hxne : (x:ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hx -@@ -1518,7 +1496,7 @@ theorem hasDerivAt_rhoFT {k : ℝ → ℂ} (hk : Integrable k) (t : ℝ) : - rw [h0, Real.exp_zero, mul_one] - · exact hk.norm - · filter_upwards [MeasureTheory.ae_iff.mpr (by -- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] -+ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] - exact MeasureTheory.measure_singleton (0:ℝ) : volume {x : ℝ | ¬ x ≠ 0} = 0)] - with x hx - intro τ _ -@@ -2479,7 +2457,8 @@ theorem tendsto_eLpNorm_indicator_truncation {g : ℝ → ℂ} - = (∫⁻ x, ((Set.Ioc (-(n:ℝ)) (n:ℝ))ᶜ.indicator (fun y => ‖g y‖ₑ ^ (2:ℝ)) x)) - ^ (1/(2:ℝ)) := by - intro n -- rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (by norm_num) (by norm_num)] -+ rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (by norm_num) (by norm_num) -+ ((hg.aestronglyMeasurable.indicator measurableSet_Ioc).sub hg.aestronglyMeasurable)] - rw [show ((2:ℝ≥0∞).toReal) = (2:ℝ) by norm_num] - congr 1 - refine lintegral_congr (fun x => ?_) -@@ -2507,7 +2486,8 @@ theorem tendsto_eLpNorm_indicator_truncation {g : ℝ → ℂ} - · rw [Set.indicator_of_notMem hx] - exact bot_le - · have := hg.eLpNorm_lt_top -- rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (by norm_num) (by norm_num), -+ rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (by norm_num) (by norm_num) -+ hg.aestronglyMeasurable, - show ((2:ℝ≥0∞).toReal) = (2:ℝ) by norm_num] at this - have h1 : (∫⁻ x, ‖g x‖ₑ ^ (2:ℝ)) < ⊤ := by - by_contra hcon -@@ -2615,11 +2595,7 @@ theorem gammaFT_ae_eq_fourierL2 {F : ℝ → ℂ} (hF : Integrable F) - exact tendsto_eLpNorm_indicator_truncation hFdiv2 - have hmeas : TendstoInMeasure volume (fun n : ℕ => 𝓕 (fun x : ℝ => hn n x)) atTop - ((𝓕 (hFdiv2.toLp h) : Lp ℂ 2 (volume : Measure ℝ)) : ℝ → ℂ) := by -- refine tendstoInMeasure_of_tendsto_eLpNorm (p := 2) (by norm_num) ?_ ?_ heLp -- · intro n -- refine Continuous.aestronglyMeasurable ?_ -- exact VectorFourier.fourierIntegral_continuous (by fun_prop) (by fun_prop) (hn1 n) -- · exact (MeasureTheory.Lp.memLp _).aestronglyMeasurable -+ exact MeasureTheory.tendstoInMeasure_of_tendsto_eLpNorm (p := 2) (by norm_num) heLp - obtain ⟨ns, hns_mono, hns_ae⟩ := hmeas.exists_seq_tendsto_ae - have hqmp : Measure.QuasiMeasurePreserving (fun t : ℝ => -t/(2*π)) - volume volume := by -@@ -2637,7 +2613,7 @@ theorem gammaFT_ae_eq_fourierL2 {F : ℝ → ℂ} (hF : Integrable F) - have hae_t := hqmp.ae hns_ae - have hne : ∀ᵐ t : ℝ, t ≠ 0 := by - rw [MeasureTheory.ae_iff] -- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] -+ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] - exact MeasureTheory.measure_singleton 0 - filter_upwards [hae_t, hne] with t hlim ht - have hpt : Tendsto (fun i : ℕ => 𝓕 (fun x : ℝ => hn (ns i) x) (-t/(2*π))) -@@ -4275,7 +4251,7 @@ theorem differentiableAt_logDeriv_gammaFactor (K : Type*) [Field K] [NumberField - have hU : IsOpen {w : ℂ | 0 < w.re} := isOpen_lt continuous_const Complex.continuous_re - have hdiff : DifferentiableOn ℂ (gammaFactor K) {w : ℂ | 0 < w.re} := by - intro w hw -- rw [Set.mem_setOf_eq] at hw -+ rw [Set.mem_ofPred_eq] at hw - exact (((differentiableAt_Gammaℝ_of_re_pos hw).pow _).mul - ((differentiableAt_Gammaℂ_of_re_pos hw).pow _)).differentiableWithinAt - have han : AnalyticOnNhd ℂ (gammaFactor K) {w : ℂ | 0 < w.re} := -diff --git a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/PrimeSide.lean b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/PrimeSide.lean -index 257b1ee8f..bfe4ae128 100644 ---- a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/PrimeSide.lean -+++ b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/PrimeSide.lean -@@ -557,11 +557,11 @@ instance countable_ideal_ringOfIntegers (K : Type*) [Field K] [NumberField K] : - Countable (Ideal (𝓞 K)) := by - have h0 : (Set.univ : Set (Ideal (𝓞 K))) = ⋃ n : ℕ, {I | Ideal.absNorm I = n} := by - ext I -- simp only [Set.mem_univ, Set.mem_iUnion, Set.mem_setOf_eq, true_iff] -+ simp only [Set.mem_univ, Set.mem_iUnion, Set.mem_ofPred_eq, true_iff] - exact ⟨Ideal.absNorm I, rfl⟩ - have h1 : (Set.univ : Set (Ideal (𝓞 K))).Countable := by - rw [h0] -- exact Set.countable_iUnion (fun n => (Ideal.finite_setOf_absNorm_eq n).countable) -+ exact Set.countable_iUnion (fun n => (Ideal.finite_setOfPred_absNorm_eq n).countable) - exact Set.countable_univ_iff.mp h1 - - /-- A pointwise `tsum` of integrable functions with summable `L¹` norms is -diff --git a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/ZeroCapture.lean b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/ZeroCapture.lean -index 7d31587b8f2e079d6c96c21bf6d5ff6fd91172a5..74884c4ad50c792dfd89f70ce83086df94199c96 100644 -GIT binary patch -delta 407 -zcmY+9u}T9$5Qd3~2&au$3NnRQg&>HHDI?lxV;jO`cP_WMH+$|*5|T!IhU=o0jh4Y! -zi4S69?F0A%?h#M}+bsV#|9tcM(0H3Q=B{>o$$$*5AO=rLkO!8UAQ^#jd0|ON!zpRH -zHmqSvf{+ebiE#`mDsesl#+MY{>7f$P6qGl8!vio9;)Hhr#N-qqV8$Uw*Fb?qM{npjc3?1+tVA3;Kw& -zF7N6)2T`IZ?4(*08 1/2`, `X ≥ 1`). -/ -+ - theorem integrable_auxF_kernel (s : ℂ) {X : ℝ} (hX : 1 ≤ X) (hs : 1/2 < s.re) (γ : ℝ) : - Integrable (fun t : ℝ => auxF s X t * Complex.exp (Complex.I * t * γ)) := by - refine Integrable.mono' -@@ -186,9 +174,7 @@ theorem hasDerivAt_gAux_deriv (h : ℂ) {t : ℝ} (ht : 0 < t) : - field_simp - ring - --/-- Master decay bound: a continuous multiplier `φ` bounded on `(T, ∞)` times the --kernel `e^{-ht}/t` (with `Re h > 0`, `T > 0`) is integrable on `(T, ∞)`, by comparison --with `(C/T)·e^{-Re h · t}`. -/ -+ - theorem integrableOn_bounded_mul_exp_div {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) - {φ : ℝ → ℂ} (hφc : ContinuousOn φ (Set.Ioi T)) {C : ℝ} - (hφb : ∀ t ∈ Set.Ioi T, ‖φ t‖ ≤ C) : -@@ -218,7 +204,7 @@ theorem integrableOn_bounded_mul_exp_div {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT - mul_le_mul (hφb t ht) hle (by positivity) hC0 - _ = C / T * Real.exp (-h.re * t) := by ring - --/-- The kernel `e^{-ht}/t` times an eventually-bounded multiplier tends to `0` at `∞`. -/ -+ - theorem tendsto_exp_div_mul_atTop {h : ℂ} (hh : 0 < h.re) {v : ℝ → ℂ} {C : ℝ} - (hv : ∀ᶠ t : ℝ in Filter.atTop, ‖v t‖ ≤ C) : - Filter.Tendsto (fun t : ℝ => Complex.exp (-h * t) / t * v t) Filter.atTop (nhds 0) := by -@@ -343,7 +329,7 @@ theorem integral_Ioi_gAux_ibp₁ (h : ℂ) (hh : 0 < h.re) {T γ : ℝ} (hT : 0 - gcongr - exact abs_le.mpr ⟨Real.neg_one_le_sin _, Real.sin_le_one _⟩ - --/-- Integrability of the kernel against a bounded continuous real multiplier. -/ -+ - theorem integrableOn_exp_div_mul_real {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) - {ψ : ℝ → ℝ} (hψc : Continuous ψ) {C : ℝ} (hψb : ∀ t, |ψ t| ≤ C) : - IntegrableOn (fun t : ℝ => Complex.exp (-h * t) / t * ((ψ t : ℝ) : ℂ)) -@@ -412,9 +398,7 @@ theorem integrableOn_gAux_deriv2_mul_real {h : ℂ} (hh : 0 < h.re) {T : ℝ} (h - rw [norm_pow] - linarith - --/-- Second integration by parts for the Fourier tail: with `g(t) = e^{-ht}/t`, --`∫_T^∞ (g″(t)·(-cos(tγ)/γ²) + g′(t)·sin(tγ)/γ) dt = --(h+1/T)·g(T)·cos(Tγ)/γ²`, stated with the boundary value in raw `-(u(T)·v(T))` form. -/ -+ - theorem integral_Ioi_gAux_ibp₂ (h : ℂ) (hh : 0 < h.re) {T γ : ℝ} (hT : 0 < T) - (hγ : γ ≠ 0) : - (∫ t in Set.Ioi T, -@@ -561,9 +545,7 @@ theorem tail_integral_identity (h : ℂ) (hh : 0 < h.re) {T γ : ℝ} (hT : 0 < - field_simp at h2 ⊢ - linear_combination (-1 : ℂ) * h2 - --/-- On the tail `t > log X`, the auxiliary function factors as a constant times the --exponential kernel: `F_{s,X}(t) = log X · e^{h·log X} · (e^{-h t}/t)` with `h = s - 1/2` --(the `|t| > log X` branch of `auxF`, rearranged). -/ -+ - theorem auxF_of_gt (s : ℂ) {X : ℝ} (hX : 1 < X) {t : ℝ} (ht : Real.log X < t) : - auxF s X t - = (Real.log X : ℂ) * Complex.exp ((s - 1/2) * (Real.log X : ℂ)) -@@ -574,17 +556,13 @@ theorem auxF_of_gt (s : ℂ) {X : ℝ} (hX : 1 < X) {t : ℝ} (ht : Real.log X < - rw [abs_of_pos htpos] - exact not_le.mpr ht - have htc : ((t : ℝ) : ℂ) ≠ 0 := by exact_mod_cast htpos.ne' -- rw [auxF, if_neg hnot, abs_of_pos htpos] -+ rw [auxF, ite_eq_right hnot, abs_of_pos htpos] - push_cast - rw [show -(s - 1/2) * ((t:ℂ) - (Real.log X : ℂ)) - = -(s - 1/2) * (t:ℂ) + (s - 1/2) * (Real.log X : ℂ) by ring, Complex.exp_add] - field_simp - --/-- **Belabas–Friedman Lemma 2, eq. (8)** (the `γ ≠ 0` case): the paper-convention --Fourier transform of the auxiliary function `F_{s,X}` in closed form. With `h = s - 1/2` --and `T = log X`, --`F̂(γ) = 2h²·sin(Tγ)/((h²+γ²)γ) + 2(h+1/T)·cos(Tγ)/(h²+γ²) -- - 4/(h²+γ²)·∫_T^∞ cos(tγ)·F_{s,X}(t)·(ht+1)/t² dt`. -/ -+ - theorem fourier_auxF (s : ℂ) {X : ℝ} (hX : 1 < X) (hs : 1/2 < s.re) {γ : ℝ} - (hγ : γ ≠ 0) : - paperFourierIntegral (auxF s X) γ -@@ -706,9 +684,7 @@ theorem fourier_auxF (s : ℂ) {X : ℝ} (hX : 1 < X) (hs : 1/2 < s.re) {γ : - + (4*s - 2)*(Real.log X : ℂ)*(γ:ℂ)*Complex.cos ((Real.log X : ℂ)*(γ:ℂ)) - + 4*(γ:ℂ)*Complex.cos ((Real.log X : ℂ)*(γ:ℂ)))) * hEE' - --/-- FTC on `(T,∞)` for the second-derivative kernel: with `g(t) = e^{-ht}/t` and `Re h > 0`, --`∫_T^∞ (h² + (2ht+2)/t²)·g(t) dt = (h + 1/T)·g(T)`. The integrand has antiderivative --`-(h + 1/t)·g(t)`, which vanishes at `∞`. -/ -+ - theorem integral_Ioi_gAux_deriv2 {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) : - (∫ t in Set.Ioi T, (h^2 + (2*h*t + 2)/t^2) * (Complex.exp (-h * t) / t)) - = (h + 1/(T:ℂ)) * (Complex.exp (-h * (T:ℂ)) / (T:ℂ)) := by -@@ -734,7 +710,7 @@ theorem integral_Ioi_gAux_deriv2 {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T - rw [norm_neg] - exact norm_affine_inv_le h hT htT - --/-- Integrability on `(T,∞)` of the remainder kernel `g(t)·(ht+1)/t²`, `g(t) = e^{-ht}/t`. -/ -+ - theorem integrableOn_gAux_mul_affine_div_sq {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) : - IntegrableOn (fun t : ℝ => - (Complex.exp (-h * t) / t) * ((h*t + 1)/t^2)) (Set.Ioi T) := by -@@ -749,9 +725,7 @@ theorem integrableOn_gAux_mul_affine_div_sq {h : ℂ} (hh : 0 < h.re) {T : ℝ} - · intro t ht - exact norm_affine_div_sq_le h hT (le_of_lt ht) - --/-- Linearity split of the second-derivative-kernel integral into plain and remainder parts: --with `g(t) = e^{-ht}/t`, --`∫_T^∞ (h²+(2ht+2)/t²)·g = h²·∫_T^∞ g + 2·∫_T^∞ g·(ht+1)/t²`. -/ -+ - theorem integral_Ioi_gAux_deriv2_split {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) : - (∫ t in Set.Ioi T, (h^2 + (2*h*t + 2)/t^2) * (Complex.exp (-h * t) / t)) - = h^2 * (∫ t in Set.Ioi T, Complex.exp (-h * t) / t) -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/BernoulliGeneralized.lean b/projects/FltRegularBernoulli/BernoulliRegular/BernoulliGeneralized.lean -index f626dd2f5..69ea46900 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/BernoulliGeneralized.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/BernoulliGeneralized.lean -@@ -182,7 +182,7 @@ lemma bernoulliGen_teichmuller_inverse_eq_p_sub_one_div_p_add_padicInt - ((p - 1 : ℚ_[p]) / p) + z := by - have hp : Nat.Prime p := Fact.out - have hp_gt2 : 2 < p := lt_of_le_of_ne hp.two_le (Ne.symm hp_odd) -- haveI : NeZero p := ⟨hp.ne_zero⟩ -+ have : NeZero p := ⟨hp.ne_zero⟩ - let ωZ : DirichletCharacter ℤ_[p] p := (teichmullerChar p) ^ (p - 2) - let ωQ : DirichletCharacter ℚ_[p] p := (teichmullerCharQp p) ^ (p - 2) - let S : ℤ_[p] := ∑ a : ZMod p, ωZ a * (a.val : ℤ_[p]) -@@ -206,7 +206,7 @@ lemma bernoulliGen_teichmuller_inverse_eq_p_sub_one_div_p_add_padicInt - dsimp [ωZ]; rw [MulChar.pow_apply' _ hpow_ne_zero, map_pow, teichmullerChar_apply, - toZMod_teichmuller] - have hval : PadicInt.toZMod (a.val : ℤ_[p]) = a := by simp -- rw [map_mul, hω, hval, if_neg ha] -+ rw [map_mul, hω, hval, ite_eq_right ha] - calc - a ^ (p - 2) * a = a ^ ((p - 2) + 1) := by rw [mul_comm, pow_succ'] - _ = a ^ (p - 1) := by congr; omega -@@ -215,7 +215,7 @@ lemma bernoulliGen_teichmuller_inverse_eq_p_sub_one_div_p_add_padicInt - have hsplit : - (∑ a : ZMod p, if a = 0 then 0 else 1) = - (Finset.univ.erase (0 : ZMod p)).sum (fun _ ↦ (1 : ZMod p)) := by -- rw [← Finset.sum_erase_add _ _ (Finset.mem_univ 0), if_pos rfl, add_zero] -+ rw [← Finset.sum_erase_add _ _ (Finset.mem_univ 0), ite_eq_left rfl, add_zero] - refine Finset.sum_congr rfl fun a ha ↦ ?_ - simp [(Finset.mem_erase.mp ha).1] - calc -@@ -278,7 +278,7 @@ lemma val_add_val_neg_cast [NeZero N] (a : ZMod N) : - ((a.val : R) + ((-a).val : R)) = if a = 0 then (0 : R) else (N : R) := by - rcases eq_or_ne a 0 with rfl | ha - · simp -- · rw [if_neg ha, ZMod.neg_val, if_neg ha, Nat.cast_sub (ZMod.val_lt _).le] -+ · rw [ite_eq_right ha, ZMod.neg_val, ite_eq_right ha, Nat.cast_sub (ZMod.val_lt _).le] - ring - - omit [Algebra ℚ R] in -@@ -386,7 +386,7 @@ theorem bernoulli_mem_padicInt_of_lt_sub_one {p : ℕ} [hp : Fact p.Prime] - -- `k ≥ 1`. Apply `sum_bernoulli (k + 1) = 0`. - have hkp1_lt : k + 1 < p := by omega - have h_sum := _root_.sum_bernoulli (k + 1) -- rw [if_neg (by omega : k + 1 ≠ 1), Finset.sum_range_succ] at h_sum -+ rw [ite_eq_right (by omega : k + 1 ≠ 1), Finset.sum_range_succ] at h_sum - have h_choose_k : (Nat.choose (k + 1) k : ℚ) = (k + 1 : ℚ) := by - rw [Nat.choose_succ_self_right]; push_cast; rfl - rw [h_choose_k] at h_sum -@@ -399,7 +399,7 @@ theorem bernoulli_mem_padicInt_of_lt_sub_one {p : ℕ} [hp : Fact p.Prime] - let z_of : ℕ → ℤ_[p] := fun j ↦ - if h : j < k then (hj_wit j h).choose else 0 - have hz_of : ∀ j, j < k → (bernoulli j : ℚ_[p]) = ((z_of j : ℤ_[p]) : ℚ_[p]) := by -- intro j hj; simp only [z_of, dif_pos hj]; exact (hj_wit j hj).choose_spec -+ intro j hj; simp only [z_of, dite_eq_left hj]; exact (hj_wit j hj).choose_spec - let S : ℤ_[p] := ∑ j ∈ Finset.range k, (Nat.choose (k + 1) j : ℤ_[p]) * z_of j - have hS_coe : (S : ℚ_[p]) = - ∑ j ∈ Finset.range k, (Nat.choose (k + 1) j : ℚ_[p]) * (bernoulli j : ℚ_[p]) := by -@@ -541,7 +541,7 @@ theorem bernoulli_pSubOne_add_inv_p_mem_padicInt - -- Step 1: From `sum_bernoulli p = 0` derive - -- `p * bernoulli (p - 1) + 1 = -∑ k ∈ range (p - 2), C(p, k+1) * bernoulli (k+1)`. - have h_sum := _root_.sum_bernoulli p -- rw [if_neg hp.ne_one] at h_sum -+ rw [ite_eq_right hp.ne_one] at h_sum - have hp_eq : p = (p - 1) + 1 := by omega - nth_rewrite 1 [hp_eq] at h_sum - rw [Finset.sum_range_succ] at h_sum -@@ -576,7 +576,7 @@ theorem bernoulli_pSubOne_add_inv_p_mem_padicInt - if h : k < p - 2 then (h_wit k h).choose else 0 - have hz_of : ∀ k, k < p - 2 → - ((_root_.bernoulli (k + 1) : ℚ) : ℚ_[p]) = (z_of k : ℚ_[p]) := by -- intro k hk; simp only [z_of, dif_pos hk]; exact (h_wit k hk).choose_spec -+ intro k hk; simp only [z_of, dite_eq_left hk]; exact (h_wit k hk).choose_spec - -- `c k : ℕ := C(p, k + 1) / p`, satisfying `p * c k = C(p, k + 1)` for `k < p - 2`. - let c : ℕ → ℕ := fun k ↦ Nat.choose p (k + 1) / p - have hc_eq : ∀ k, k < p - 2 → p * c k = Nat.choose p (k + 1) := fun k hk ↦ -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/Characters.lean b/projects/FltRegularBernoulli/BernoulliRegular/Characters.lean -index 356776bea..c528b5dc6 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/Characters.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/Characters.lean -@@ -221,16 +221,16 @@ Dirichlet characters mod `p` is (noncanonically) isomorphic to - `(ZMod p)ˣ`, hence cyclic of order `p - 1`. -/ - lemma dirichletCharacter_mulEquiv_zmodUnits : - Nonempty (DirichletCharacter ℤ_[p] p ≃* (ZMod p)ˣ) := by -- haveI : NeZero p := ⟨hp.1.ne_zero⟩ -- haveI : HasEnoughRootsOfUnity ℤ_[p] (Monoid.exponent (ZMod p)ˣ) := -+ have : NeZero p := ⟨hp.1.ne_zero⟩ -+ have : HasEnoughRootsOfUnity ℤ_[p] (Monoid.exponent (ZMod p)ˣ) := - exponent_zmod_units (p := p) ▸ inferInstance - exact DirichletCharacter.mulEquiv_units ℤ_[p] p - - /-- The `ℤ_[p]`-valued Dirichlet character group mod `p` has `p - 1` - elements. -/ - lemma card_dirichletCharacter : Nat.card (DirichletCharacter ℤ_[p] p) = p - 1 := by -- haveI : NeZero p := ⟨hp.1.ne_zero⟩ -- haveI : HasEnoughRootsOfUnity ℤ_[p] (Monoid.exponent (ZMod p)ˣ) := -+ have : NeZero p := ⟨hp.1.ne_zero⟩ -+ have : HasEnoughRootsOfUnity ℤ_[p] (Monoid.exponent (ZMod p)ˣ) := - exponent_zmod_units (p := p) ▸ inferInstance - rw [DirichletCharacter.card_eq_totient_of_hasEnoughRootsOfUnity, - Nat.totient_prime hp.1] -@@ -313,7 +313,7 @@ lemma teichmuller_neg_one (hp_odd : p ≠ 2) : teichmuller p (-1) = -1 := by - have h_sq : teichmuller p (-1 : ZMod p) ^ 2 = 1 := by - rw [sq, ← map_mul, neg_one_mul, neg_neg, map_one] - rcases sq_eq_one_iff.mp h_sq with h1 | h_neg -- · haveI : Fact (2 < p) := ⟨lt_of_le_of_ne hp.1.two_le (Ne.symm hp_odd)⟩ -+ · have : Fact (2 < p) := ⟨lt_of_le_of_ne hp.1.two_le (Ne.symm hp_odd)⟩ - exact absurd (by simpa using congrArg PadicInt.toZMod h1) ZMod.neg_one_ne_one - · exact h_neg - -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/Basic.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/Basic.lean -index 7733831c9..d24c5d66e 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/Basic.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/Basic.lean -@@ -54,9 +54,9 @@ prime `p`, paired with the standard additive character - `ZMod.stdAddChar : AddChar (ZMod p) ℂ`, evaluates to `-1`. -/ - theorem gaussSum_one_stdAddChar : - gaussSum (1 : DirichletCharacter ℂ p) (ZMod.stdAddChar (N := p)) = -1 := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -- haveI : Fact (1 < p) := ⟨hp.out.one_lt⟩ -- haveI : Nontrivial (ZMod p) := ZMod.nontrivial p -+ have : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : Fact (1 < p) := ⟨hp.out.one_lt⟩ -+ have : Nontrivial (ZMod p) := ZMod.nontrivial p - -- `stdAddChar` is not the trivial additive character, so its values sum to `0`. - have h_ne : (ZMod.stdAddChar (N := p)) ≠ 1 := by - intro h -@@ -83,7 +83,7 @@ theorem gaussSum_one_stdAddChar : - MulChar.map_nonunit _ (by simp) - simp [h0] - · have hu : IsUnit a := ha.isUnit -- simp [MulChar.one_apply hu, if_neg ha] -+ simp [MulChar.one_apply hu, ite_eq_right ha] - classical - calc gaussSum (1 : DirichletCharacter ℂ p) (ZMod.stdAddChar (N := p)) - = ∑ a : ZMod p, (1 : DirichletCharacter ℂ p) a * (ZMod.stdAddChar (N := p)) a := rfl -@@ -107,7 +107,7 @@ theorem gaussSum_mul_gaussSum_inv_stdAddChar - gaussSum χ (ZMod.stdAddChar (N := p)) * - gaussSum χ⁻¹ (ZMod.stdAddChar (N := p)) = - χ (-1) * p := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - have h_prim : (ZMod.stdAddChar : AddChar (ZMod p) ℂ).IsPrimitive := - ZMod.isPrimitive_stdAddChar p - have h_card : (Fintype.card (ZMod p) : ℂ) = p := by -@@ -153,7 +153,7 @@ does not vanish as soon as their product is nontrivial. -/ - theorem jacobiSum_ne_zero_stdAddChar - {χ φ : DirichletCharacter ℂ p} (hχφ : χ * φ ≠ 1) : - jacobiSum χ φ ≠ 0 := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - by_cases hχ : χ = 1 - · subst hχ - have hφ : φ ≠ 1 := by simpa using hχφ -@@ -187,7 +187,7 @@ character factoring through `1` is the trivial character. -/ - theorem DirichletCharacter.isPrimitive_of_ne_one - {χ : DirichletCharacter ℂ p} (hχ : χ ≠ 1) : - χ.IsPrimitive := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - rw [DirichletCharacter.isPrimitive_def] - rcases (Nat.dvd_prime hp.out).mp χ.conductor_dvd_level with h | h - · exact absurd ((DirichletCharacter.factorsThrough_one_iff χ).mp -@@ -340,7 +340,7 @@ theorem dft_quadraticCharComplex_eq_gaussSum (hp₂ : p ≠ 2) (k : ZMod p) : - ZMod.dft (quadraticCharComplex p) k = - quadraticCharComplex p (-k) * - gaussSum (quadraticCharComplex p) (ZMod.stdAddChar (N := p)) := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - have hprim : (quadraticCharComplex p).IsPrimitive := - DirichletCharacter.isPrimitive_of_ne_one (p := p) - (quadraticCharComplex_ne_one (p := p) hp₂) -@@ -352,12 +352,12 @@ theorem dft_quadraticCharComplex_eq_gaussSum (hp₂ : p ≠ 2) (k : ZMod p) : - `p` at `0` and `0` away from `0`. -/ - theorem dft_const_one (k : ZMod p) : - ZMod.dft (fun _ : ZMod p ↦ (1 : ℂ)) k = if k = 0 then p else 0 := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - by_cases hk : k = 0 - · subst hk - rw [ZMod.dft_apply_zero] - simp -- · rw [ZMod.dft_apply, if_neg hk] -+ · rw [ZMod.dft_apply, ite_eq_right hk] - have hne : ((ZMod.stdAddChar : AddChar (ZMod p) ℂ).mulShift (-k)) ≠ 1 := by - intro hshift - have heval : (ZMod.stdAddChar (N := p)) (-k) = 1 := by -@@ -466,7 +466,7 @@ theorem conj_gaussSum_quadraticCharComplex_eq_neg_self_of_mod_four_eq_three - theorem gaussSum_quadraticCharComplex_sq (hp₂ : p ≠ 2) : - gaussSum (quadraticCharComplex p) (ZMod.stdAddChar (N := p)) ^ 2 = - quadraticCharComplex p (-1) * p := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - simpa [ZMod.card] using - gaussSum_sq (χ := quadraticCharComplex p) - (quadraticCharComplex_ne_one (p := p) hp₂) -@@ -579,7 +579,7 @@ character `χ : DirichletCharacter ℂ p`. Uses `χ^(p-1) = 1` + membership in - `Algebra.adjoin ℤ {μ_{p-1}}`, which is contained in the integral closure. -/ - theorem DirichletCharacter.isIntegral_apply (χ : DirichletCharacter ℂ p) (a : ZMod p) : - IsIntegral ℤ (χ a) := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - have hp_sub : 0 < p - 1 := by have := hp.out.one_lt; omega - set μ : ℂ := Complex.exp (2 * Real.pi * Complex.I / (p - 1 : ℕ)) - have hμ : IsPrimitiveRoot μ (p - 1) := -@@ -597,7 +597,7 @@ theorem DirichletCharacter.isIntegral_apply (χ : DirichletCharacter ℂ p) (a : - integral over `ℤ` (each is a `p`-th root of unity). -/ - theorem ZMod.isIntegral_stdAddChar (a : ZMod p) : - IsIntegral ℤ ((ZMod.stdAddChar : AddChar (ZMod p) ℂ) a) := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - have hx_pow : ((ZMod.stdAddChar : AddChar (ZMod p) ℂ) a) ^ p = 1 := by - rw [← AddChar.map_nsmul_eq_pow, show ((p : ℕ) • a : ZMod p) = 0 from by - rw [show ((p : ℕ) • a : ZMod p) = (p : ZMod p) * a from by ring, -@@ -636,7 +636,7 @@ theorem gaussSum_mem_algebraAdjoin_stickelbergerComplexRoot - (χ : DirichletCharacter ℂ p) : - gaussSum χ (ZMod.stdAddChar : AddChar (ZMod p) ℂ) ∈ - Algebra.adjoin ℤ ({stickelbergerComplexRoot p} : Set ℂ) := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - have hp_one_lt : 1 < p := hp.out.one_lt - have hp_sub : 0 < p - 1 := by omega - have hp_pos : 0 < p := hp.out.pos -@@ -665,7 +665,7 @@ theorem gaussSum_mem_algebraAdjoin_stickelbergerComplexRoot - have h_pow : χ ^ (p - 1) = 1 := by - have h := MulChar.pow_card_eq_one χ (M := ZMod p) - rwa [ZMod.card_units_eq_totient, Nat.totient_prime hp.out] at h -- haveI : NeZero (p - 1) := ⟨hp_sub.ne'⟩ -+ have : NeZero (p - 1) := ⟨hp_sub.ne'⟩ - have h_mem : χ a ∈ Algebra.adjoin ℤ ({ζ ^ p} : Set ℂ) := - MulChar.apply_mem_algebraAdjoin_of_pow_eq_one h_pow hζ_pm1 a - have h_sub : Algebra.adjoin ℤ ({ζ ^ p} : Set ℂ) ≤ Algebra.adjoin ℤ ({ζ} : Set ℂ) := by -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BlockDeterminant.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BlockDeterminant.lean -index c3148c6ba..5764b48d9 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BlockDeterminant.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BlockDeterminant.lean -@@ -280,7 +280,7 @@ theorem toMatrix_deltaZeroConstOneDirichletCharacterBasis_normalizedDft : - simp [Module.Basis.repr_self, hij] - simpa only [Matrix.mul_diagonal, PEquiv.toMatrix_apply, Equiv.toPEquiv_apply, - Equiv.Perm.coe_inv, Option.mem_def, Option.some.injEq, ite_mul, one_mul, zero_mul, hneq', -- if_false] -+ ite_false] - using hsingle - - /-- The determinant of that monomial matrix: the sign of the permutation times the -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BranchChoice.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BranchChoice.lean -index 34468899d..419594284 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BranchChoice.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BranchChoice.lean -@@ -50,7 +50,7 @@ theorem card_even_eq_card_odd_characters (hp₂ : p ≠ 2) : - simp only [E, O, Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and, iff_true] - exact DirichletCharacter.even_or_odd χ - have hneg_ne_one : (-1 : ZMod p) ≠ 1 := by -- haveI : Fact (2 < p) := ⟨lt_of_le_of_ne hp.out.two_le (Ne.symm hp₂)⟩ -+ have : Fact (2 < p) := ⟨lt_of_le_of_ne hp.out.two_le (Ne.symm hp₂)⟩ - exact ZMod.neg_one_ne_one - have hsum_zero : - ∑ χ : DirichletCharacter ℂ p, χ (-1 : ZMod p) = 0 := -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Operator.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Operator.lean -index e01362db2..cdfae2bc9 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Operator.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Operator.lean -@@ -172,7 +172,7 @@ noncomputable def zmodEquivFin : ZMod p ≃ Fin p := - - theorem zmodEquivFin_symm_apply (i : Fin p) : - (zmodEquivFin (p := p)).symm i = (i : ZMod p) := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - change ZMod.finEquiv p i = (i : ZMod p) - cases p with - | zero => -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Trace.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Trace.lean -index a5de9475f..f41b89788 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Trace.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Trace.lean -@@ -49,12 +49,12 @@ theorem dft_deltaZero_eq_constOne : - /-- The DFT of the constant-one function is concentrated at `0`. -/ - theorem dft_constOne (k : ZMod p) : - ZMod.dft (fun _ : ZMod p ↦ (1 : ℂ)) k = if k = 0 then p else 0 := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - by_cases hk : k = 0 - · subst hk - rw [ZMod.dft_apply_zero] - simp -- · rw [ZMod.dft_apply, if_neg hk] -+ · rw [ZMod.dft_apply, ite_eq_right hk] - have hne : ((ZMod.stdAddChar : AddChar (ZMod p) ℂ).mulShift (-k)) ≠ 1 := by - intro hshift - have heval : (ZMod.stdAddChar (N := p)) (-k) = 1 := by -@@ -149,7 +149,7 @@ theorem dft_eq_scalar_smul_inv_character {χ : DirichletCharacter ℂ p} - ZMod.dft χ = - (χ⁻¹ (-1) * gaussSum χ (ZMod.stdAddChar (N := p))) • - ((χ⁻¹ : DirichletCharacter ℂ p) : ZMod p → ℂ) := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - have hprim : χ.IsPrimitive := DirichletCharacter.isPrimitive_of_ne_one (p := p) hχ - ext k - simp only [Pi.smul_apply, smul_eq_mul] -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Defs.lean b/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Defs.lean -index e65342489..e45157576 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Defs.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Defs.lean -@@ -64,7 +64,7 @@ theorem odd_LFunction_one_eq_oddLValueRhs_of_LFunction_inv_zero - (Or.inr hp.out.ne_one), hχinv_odd.gammaFactor_def] - simp - have hfe := DirichletCharacter.IsPrimitive.completedLFunction_one_sub (χ := χ) hχ_prim (0 : ℂ) -- rw [DirichletCharacter.rootNumber, if_neg hχ_odd.not_even, pow_one, -+ rw [DirichletCharacter.rootNumber, ite_eq_right hχ_odd.not_even, pow_one, - ← mul_comm_div, ← mul_comm_div, ← Complex.cpow_sub _ _ (by exact_mod_cast hp.out.ne_zero), - sub_sub, add_halves, hL0, hχ0] at hfe - have hfe' : DirichletCharacter.completedLFunction χ 1 = -diff --git a/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Even.lean b/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Even.lean -index da64fd5da..f1e07c897 100644 ---- a/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Even.lean -+++ b/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Even.lean -@@ -96,7 +96,7 @@ private lemma LFunction_dft_inv_eq_gaussSum_mul_LFunction - {χ : DirichletCharacter ℂ p} (hχ_even : χ.Even) (hχinv_prim : (χ⁻¹).IsPrimitive) : - ZMod.LFunction (ZMod.dft (fun a : ZMod p => χ⁻¹ a)) 1 = - gaussSum χ⁻¹ (ZMod.stdAddChar (N := p)) * ZMod.LFunction χ 1 := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - have hft : - ZMod.dft (fun a : ZMod p => χ⁻¹ a) = fun a : ZMod p => - gaussSum χ⁻¹ (ZMod.stdAddChar (N := p)) * χ a := by -@@ -152,7 +152,7 @@ private lemma sum_mulChar_cosZeta_eq_neg_evenLValueLogSum - {χ : DirichletCharacter ℂ p} (hχinv_zero : χ⁻¹ 0 = 0) : - ∑ a : ZMod p, χ⁻¹ a * HurwitzZeta.cosZeta (ZMod.toAddCircle a) 1 = - -evenLValueLogSum p χ := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - simp only [evenLValueLogSum] - calc - ∑ a : ZMod p, χ⁻¹ a * HurwitzZeta.cosZeta (ZMod.toAddCircle a) 1 -@@ -176,7 +176,7 @@ theorem even_LFunction_one_eq_evenLValueRhs - {χ : DirichletCharacter ℂ p} (hχ_prim : χ.IsPrimitive) (hχ_even : χ.Even) - (hχ_ne_one : χ ≠ 1) : - DirichletCharacter.LFunction χ 1 = evenLValueRhs p χ := by -- haveI : NeZero p := ⟨hp.out.ne_zero⟩ -+ have : NeZero p := ⟨hp.out.ne_zero⟩ - change ZMod.LFunction (fun a : ZMod p => χ a) 1 = evenLValueRhs p χ - have hχinv_even : (χ⁻¹).Even := by - rw [DirichletCharacter.Even] at hχ_even ⊢ -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/CharP.lean b/projects/HasseWeil/HasseWeil/FormalGroup/CharP.lean -index f9dac12ed..b5845ada0 100644 ---- a/projects/HasseWeil/HasseWeil/FormalGroup/CharP.lean -+++ b/projects/HasseWeil/HasseWeil/FormalGroup/CharP.lean -@@ -61,7 +61,7 @@ private theorem exists_expand_of_coeff_vanishing (p : ℕ) (hp : p ≠ 0) - vanishes unless `p ∣ n` (or `n = 0`). -/ - private theorem coeff_eq_zero_of_derivative_eq_zero_charP {p : ℕ} - [Fact p.Prime] [CharP R p] {f : PowerSeries R} -- (hf : PowerSeries.derivative R f = 0) -+ (hf : PowerSeries.derivative (R := R) f = 0) - (n : ℕ) (hpn : ¬ p ∣ n) : - PowerSeries.coeff n f = 0 := by - -- `n ≠ 0` since `p ∣ 0`; write `n = m + 1`. -@@ -101,7 +101,7 @@ theorem FormalGroup.mulByP_exists_expand (F : FormalGroup R) (p : ℕ) - apply exists_expand_of_coeff_vanishing p hp_prime.out.ne_zero - intro n hpn - -- `derivative [p] = 0`, from the chain rule and `[p] = 0` in characteristic `p`. -- have hder : PowerSeries.derivative R (F.mulByNatHom p).toSeries = 0 := by -+ have hder : PowerSeries.derivative (R := R) (F.mulByNatHom p).toSeries = 0 := by - have chain := FormalGroupHom.invariantDifferential_chain (F.mulByNatHom p) - have hp_zero : - PowerSeries.C (PowerSeries.coeff 1 (F.mulByNatHom p).toSeries) * -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/Differential.lean b/projects/HasseWeil/HasseWeil/FormalGroup/Differential.lean -index 655b8afa6..7d00d2a24 100644 ---- a/projects/HasseWeil/HasseWeil/FormalGroup/Differential.lean -+++ b/projects/HasseWeil/HasseWeil/FormalGroup/Differential.lean -@@ -193,7 +193,7 @@ private theorem coeff_subst_runit_eq (n : ℕ) - · simp only [hd0, pow_zero, one_mul, MvPowerSeries.coeff_X_pow] - have hne : d 1 ≠ n := - fun h ↦ hd (Finsupp.ext (fun i ↦ by fin_cases i <;> simp [*, Finsupp.single_eq_same])) -- rw [if_neg (fun h ↦ hne ((Finsupp.single_injective (1 : Fin 2)).eq_iff.mp h).symm)] -+ rw [ite_eq_right (fun h ↦ hne ((Finsupp.single_injective (1 : Fin 2)).eq_iff.mp h).symm)] - · rw [zero_pow hd0, zero_mul, map_zero] - - -- Helper: coeff at (single 1 m) of F.toSeries equals [m = 1] (from runit: F(0,Y)=Y) -@@ -234,11 +234,11 @@ private theorem coeff_one_pow {f : PowerSeries R} (hf : PowerSeries.constantCoef - PowerSeries.coeff 1 (f ^ d) = if d = 1 then PowerSeries.coeff 1 f else 0 := by - by_cases hd : d = 1 - · simp [hd] -- · rw [if_neg hd] -+ · rw [ite_eq_right hd] - rcases d with _ | _ | d - · simp only [pow_zero] - show PowerSeries.coeff 1 (1 : PowerSeries R) = 0 -- rw [PowerSeries.coeff_one, if_neg one_ne_zero] -+ rw [PowerSeries.coeff_one, ite_eq_right one_ne_zero] - · omega - · exact coeff_one_pow_eq_zero hf (by omega) - -@@ -258,12 +258,12 @@ private theorem coeff_subst_X0 (g : PowerSeries R) (a b : ℕ) : - · simp [MvPowerSeries.coeff_X_pow, smul_eq_mul] - · intro d hd - simp only [MvPowerSeries.coeff_X_pow, smul_eq_mul] -- rw [if_neg (fun h ↦ hd ((Finsupp.single_injective (0 : Fin 2)).eq_iff.mp h).symm), -+ rw [ite_eq_right (fun h ↦ hd ((Finsupp.single_injective (0 : Fin 2)).eq_iff.mp h).symm), - mul_zero] -- · rw [if_neg hb] -+ · rw [ite_eq_right hb] - apply finsum_eq_zero_of_forall_eq_zero - intro d -- rw [MvPowerSeries.coeff_X_pow, if_neg] -+ rw [MvPowerSeries.coeff_X_pow, ite_eq_right] - · exact smul_zero _ - · intro h - have := DFunLike.congr_fun h 1 -@@ -284,12 +284,12 @@ private theorem coeff_subst_X1 (g : PowerSeries R) (a b : ℕ) : - · simp [MvPowerSeries.coeff_X_pow, smul_eq_mul] - · intro d hd - simp only [MvPowerSeries.coeff_X_pow, smul_eq_mul] -- rw [if_neg (fun h ↦ hd ((Finsupp.single_injective (1 : Fin 2)).eq_iff.mp h).symm), -+ rw [ite_eq_right (fun h ↦ hd ((Finsupp.single_injective (1 : Fin 2)).eq_iff.mp h).symm), - mul_zero] -- · rw [if_neg hab] -+ · rw [ite_eq_right hab] - apply finsum_eq_zero_of_forall_eq_zero - intro d -- rw [MvPowerSeries.coeff_X_pow, if_neg] -+ rw [MvPowerSeries.coeff_X_pow, ite_eq_right] - · exact smul_zero _ - · intro h - have := DFunLike.congr_fun h 0 -@@ -333,7 +333,7 @@ private lemma coeff_subst_X0_X1_mul_eq_zero_of_ne (g : PowerSeries R) (d0 d1 n : - from finsupp_fin2_decompose e2] - rw [coeff_subst_X0, coeff_subst_X1] - by_cases h1 : e1 1 = 0 -- · rw [if_pos h1] -+ · rw [ite_eq_left h1] - by_cases h2 : e2 0 = 0 - · -- Both e1 1 = 0 and e2 0 = 0: forces (e1, e2) = (single 0 1, single 1 n) - exfalso; apply hne -@@ -348,8 +348,8 @@ private lemma coeff_subst_X0_X1_mul_eq_zero_of_ne (g : PowerSeries R) (d0 d1 n : - rw [finsupp_fin2_decompose e1, h1, he10]; simp - · show e2 = Finsupp.single 1 n - rw [finsupp_fin2_decompose e2, h2, he21]; simp -- · rw [if_neg h2, mul_zero] -- · rw [if_neg h1, zero_mul] -+ · rw [ite_eq_right h2, mul_zero] -+ · rw [ite_eq_right h1, zero_mul] - - -- Orthogonality: coeff_{(1,n)} (f(X_0)^d0 * f(X_1)^d1) = coeff_1(f^d0) * coeff_n(f^d1) - private theorem coeff_10_prod_orthogonal (g : PowerSeries R) (d0 d1 n : ℕ) : -@@ -424,15 +424,15 @@ private lemma finsum_fin2_reduce_full (p : (Fin 2 →₀ ℕ) → R) : - Set.indicator (Set.range ι) (fun d ↦ if d 0 = 1 then p d else 0) d := by - intro d; classical rw [Set.indicator_apply] - by_cases hd : d ∈ Set.range ι -- · rw [if_pos hd] -- · rw [if_neg hd, if_neg (mt (hmem d).mpr hd)] -+ · rw [ite_eq_left hd] -+ · rw [ite_eq_right hd, ite_eq_right (mt (hmem d).mpr hd)] - conv_lhs => arg 1; ext d; rw [key d] - rw [← finsum_mem_def, ← finsum_subtype_eq_finsum_cond (· ∈ Set.range ι), - ← finsum_comp_equiv (Equiv.ofInjective ι hinj)] - congr 1; ext k - show (if (ι k : Fin 2 →₀ ℕ) 0 = 1 then p (ι k) else 0) = - p (Finsupp.single 0 1 + Finsupp.single 1 k) -- rw [if_pos (hι0 k)] -+ rw [ite_eq_left (hι0 k)] - - -- Helper: c * finsum f = finsum (c * f ·) when f has finite support. - private lemma mul_finsum_of_support_subset {α : Type*} (c : R) (f : α → R) -@@ -503,11 +503,11 @@ private theorem antidiag_term_vanish (F : FormalGroup R) (d n : ℕ) - rcases Nat.eq_zero_or_pos (e1 0) with he10 | he10 - · have he1eq : e1 = Finsupp.single 1 (e1 1) := Finsupp.ext fun i ↦ by - fin_cases i <;> simp_all [Finsupp.single_eq_same] -- rw [he1eq, coeff_single1_F, if_neg (fun h ↦ hA ⟨he10, h⟩), zero_mul] -+ rw [he1eq, coeff_single1_F, ite_eq_right (fun h ↦ hA ⟨he10, h⟩), zero_mul] - · have he20 : e2 0 = 0 := by omega - have he2eq : e2 = Finsupp.single 1 (e2 1) := Finsupp.ext fun i ↦ by - fin_cases i <;> simp_all [Finsupp.single_eq_same] -- rw [he2eq, coeff_runit_pow, if_neg (fun h ↦ hB ⟨by omega, h⟩), mul_zero] -+ rw [he2eq, coeff_runit_pow, ite_eq_right (fun h ↦ hB ⟨by omega, h⟩), mul_zero] - - -- Sub-lemma: the antidiagonal sum for `coeff_{(1,n)} (F^d * F)` collapses to the two - -- surviving terms — pair A `(single 1 1, single 0 1 + single 1 (n-1))` and pair B -@@ -661,9 +661,9 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : - induction d with - | zero => - intro n -- simp only [pow_zero, Nat.zero_le, le_add_iff_nonneg_left, if_true, -+ simp only [pow_zero, Nat.zero_le, le_add_iff_nonneg_left, ite_true, - Nat.cast_zero, zero_mul, MvPowerSeries.coeff_one] -- rw [if_neg]; intro h -+ rw [ite_eq_right]; intro h - exact absurd (DFunLike.congr_fun h 0) (by - simp [Finsupp.add_apply, Finsupp.single_eq_same]) - | succ d ih => -@@ -671,7 +671,7 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : - -- For d+1 > n+1, use direct vanishing from nilpotent coefficient - by_cases hdn : d + 1 ≤ n + 1 - · -- d + 1 ≤ n + 1, i.e., d ≤ n -- rw [if_pos hdn] -+ rw [ite_eq_left hdn] - have hdn' : d ≤ n := by omega - rw [pow_succ, mul_comm, MvPowerSeries.coeff_mul] - -- The antidiag sum: Σ coeff_e1(F) * coeff_e2(F^d) -@@ -703,7 +703,7 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : - (Finsupp.single (0 : Fin 2) 1 + Finsupp.single (1 : Fin 2) (n - 1)) - (F.toSeries ^ d) = - (d : R) * PowerSeries.coeff (n - d) F.dX_at_zero := by -- rw [coeff_single1_F, if_pos rfl, one_mul, ih, if_pos (by omega : d ≤ n - 1 + 1)] -+ rw [coeff_single1_F, ite_eq_left rfl, one_mul, ih, ite_eq_left (by omega : d ≤ n - 1 + 1)] - have : n - 1 + 1 - d = n - d := by omega - rw [this] - -- Compute pair B value -@@ -713,7 +713,7 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : - F.toSeries * - MvPowerSeries.coeff (Finsupp.single (1 : Fin 2) d) (F.toSeries ^ d) = - PowerSeries.coeff (n - d) F.dX_at_zero := by -- rw [coeff_runit_pow, if_pos rfl, mul_one, FormalGroup.dX_at_zero, -+ rw [coeff_runit_pow, ite_eq_left rfl, mul_one, FormalGroup.dX_at_zero, - PowerSeries.coeff_mk] - -- The sum = A_val + B_val = (d+1) * coeff_{n-d} dxF - -- (the split into the two surviving terms is `coeff_10_FG_pow_antidiag_split`) -@@ -725,7 +725,7 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : - · -- A_val + B_val = (d+1) * coeff_{n+1-(d+1)} dxF - rw [show n + 1 - (d + 1) = n - d from by omega]; push_cast; ring - · -- d + 1 > n + 1: coeff vanishes by nilpotent degree bound -- rw [if_neg hdn] -+ rw [ite_eq_right hdn] - exact coeff_10_FG_pow_succ_vanish F hdn - - /-- The explicit `Finset` sum that both sides of `coeff_10_lhs` reduce to: -@@ -770,7 +770,7 @@ private theorem coeff_10_subst_eq_sum (F G : FormalGroup R) (f : FormalGroupHom - rw [Function.mem_support, ne_eq] at hd - rw [Finset.mem_coe, Finset.mem_range] - by_contra h; push Not at h -- exact hd (if_neg (by omega : ¬(d ≤ n + 1))))] -+ exact hd (ite_eq_right (by omega : ¬(d ≤ n + 1))))] - -- Kill the d = 0 term (it contributes 0 since d = 0 gives 0 * ... = 0) - rw [Finset.sum_range_succ' (n := n + 1)] - simp only [Nat.cast_zero, zero_mul, Nat.sub_zero, le_add_iff_nonneg_left, -@@ -784,7 +784,7 @@ private theorem coeff_10_subst_eq_sum (F G : FormalGroup R) (f : FormalGroupHom - (↑(k + 1) : R) * PowerSeries.coeff (k + 1) f.toSeries * - PowerSeries.coeff (n - k) F.dX_at_zero := by - intro k hk; rw [Finset.mem_range] at hk -- rw [if_pos (by omega : k + 1 ≤ n + 1)] -+ rw [ite_eq_left (by omega : k + 1 ≤ n + 1)] - have : n + 1 - (k + 1) = n - k := by omega - rw [this] - rw [Finset.sum_congr rfl hsimp] -@@ -795,7 +795,7 @@ unfolds (via `coeff_mul` and `coeff_derivative`) to the explicit range sum - bijection `k ↦ (k, n - k)`. -/ - private theorem coeff_derivative_mul_dX_eq_sum (F G : FormalGroup R) - (f : FormalGroupHom F G) (n : ℕ) : -- PowerSeries.coeff n (PowerSeries.derivative R f.toSeries * F.dX_at_zero) = -+ PowerSeries.coeff n (PowerSeries.derivative (R := R) f.toSeries * F.dX_at_zero) = - coeff_10_sum F G f n := by - rw [coeff_10_sum] - -- Expand the RHS via `coeff_mul` and `coeff_derivative`, then match the range sum against -@@ -824,11 +824,11 @@ private theorem coeff_derivative_mul_dX_eq_sum (F G : FormalGroup R) - private theorem coeff_10_lhs (F G : FormalGroup R) (f : FormalGroupHom F G) (n : ℕ) : - MvPowerSeries.coeff (Finsupp.single (0 : Fin 2) 1 + Finsupp.single (1 : Fin 2) n) - (PowerSeries.subst F.toSeries f.toSeries) = -- PowerSeries.coeff n (PowerSeries.derivative R f.toSeries * F.dX_at_zero) := -+ PowerSeries.coeff n (PowerSeries.derivative (R := R) f.toSeries * F.dX_at_zero) := - (coeff_10_subst_eq_sum F G f n).trans (coeff_derivative_mul_dX_eq_sum F G f n).symm - - theorem FormalGroup.dX_at_zero_chain (f : FormalGroupHom F G) : -- (PowerSeries.derivative R f.toSeries) * F.dX_at_zero = -+ (PowerSeries.derivative (R := R) f.toSeries) * F.dX_at_zero = - PowerSeries.C (PowerSeries.coeff 1 f.toSeries) * - PowerSeries.subst f.toSeries G.dX_at_zero := by - ext n -@@ -882,14 +882,14 @@ invariant differential. - Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.4, Corollary 4.3. -/ - theorem FormalGroup.invariantDiff_chain (f : FormalGroupHom F G) : - PowerSeries.subst f.toSeries G.invariantDiff * -- (PowerSeries.derivative R f.toSeries) = -+ (PowerSeries.derivative (R := R) f.toSeries) = - PowerSeries.C (PowerSeries.coeff 1 f.toSeries) * F.invariantDiff := by - -- Set up abbreviations to ensure all terms are in PowerSeries R, avoiding - -- MvPowerSeries Unit R / PowerSeries R defeq issues with rw/simp. - set c₁ : PowerSeries R := PowerSeries.C (PowerSeries.coeff 1 f.toSeries) - set ωG' : PowerSeries R := PowerSeries.subst f.toSeries G.invariantDiff - set dG' : PowerSeries R := PowerSeries.subst f.toSeries G.dX_at_zero -- set f' : PowerSeries R := PowerSeries.derivative R f.toSeries -+ set f' : PowerSeries R := PowerSeries.derivative (R := R) f.toSeries - set ωF : PowerSeries R := F.invariantDiff - set dF : PowerSeries R := F.dX_at_zero - -- Two ingredients: the `dX_at_zero` chain identity `f' * dF = c₁ * dG'` and the -@@ -1207,7 +1207,7 @@ private lemma coeff_prod_subst_vec_zero_X0 (d e : Fin 2 →₀ ℕ) : - simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_zero] - by_cases hd0 : d 0 = 0 - · simp [hd0] -- · rw [zero_pow hd0, zero_mul, map_zero, if_neg hd0] -+ · rw [zero_pow hd0, zero_mul, map_zero, ite_eq_right hd0] - - /-- Reindexing: a finsum over `d : Fin 2 →₀ ℕ` of a term that vanishes unless - `d 0 = 0` collapses to a finsum over `n : ℕ` along `n ↦ Finsupp.single 1 n`, the -@@ -1434,4 +1434,4 @@ theorem invariantDiff_translation (F : FormalGroup R) : - - end FormalGroup - --end HasseWeil.FormalGroup -\ No newline at end of file -+end HasseWeil.FormalGroup -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/EvalGroup.lean b/projects/HasseWeil/HasseWeil/FormalGroup/EvalGroup.lean -index 5d7732dc9..9c4831e16 100644 ---- a/projects/HasseWeil/HasseWeil/FormalGroup/EvalGroup.lean -+++ b/projects/HasseWeil/HasseWeil/FormalGroup/EvalGroup.lean -@@ -9,49 +9,6 @@ import Mathlib.Algebra.Group.MinimalAxioms - import Mathlib.RingTheory.AdicCompletion.Topology - import Mathlib.RingTheory.PowerSeries.Evaluation - --/-! --# The group `F(M)` associated to a formal group over a complete local ring --# (Silverman IV.3, ticket T-IV-3-001) -- --Let `R` be a commutative local ring with maximal ideal `M = IsLocalRing.maximalIdeal R`, --equipped with the `M`-adic topology (so that it is both a topological ring with --a linear topology, a uniform ring, etc.), and assume moreover that it is --`M`-adically complete (so `R` is Hausdorff and complete for this topology). -- --For a formal group law `F(X, Y) ∈ R[[X, Y]]`, the set `M` acquires a structure of --an abelian group via -- `x +_F y := F(x, y) = MvPowerSeries.eval₂ (RingHom.id R) ![x, y] F.toSeries`. -- --The convergence of the power series `F(x, y)` is guaranteed by `x, y ∈ M` (they are --topologically nilpotent, as `M^n → 0` in the adic topology) and by completeness. -- --## Main definitions -- --* `HasseWeil.FormalGroup.FormalGroup.evalAdd F x y` — the binary operation -- `x +_F y` on `M`, returning an element of `R`. --* `HasseWeil.FormalGroup.FormalGroup.evalAdd_mem F x y` — the operation is closed -- in `M`, i.e. `evalAdd F x y ∈ M`. --* `HasseWeil.FormalGroup.FormalGroup.evalNeg F x` — the formal negation -- `-_F x := i(x)` for `x ∈ M`, where `i = F.inverse` is the formal inverse -- power series. --* `HasseWeil.FormalGroup.FormalGroup.evalNeg_mem F x` — the negation is closed -- in `M`, i.e. `evalNeg F x ∈ M`. -- --The formal-group axioms induce the group laws for `evalAdd`; the resulting --operation and `evalNeg` are bundled as an `AddCommGroup` on `F.EvalGroup hAdic`. --The substitution bridge used for associativity and inverses is proved for the --`M`-adic uniformity, where `MvPowerSeries.eval₂_subst` does not apply directly. -- --## Assumptions on `R` -- --We require `R` to be a `CommRing`, `IsLocalRing`, equipped with topology and uniform --space structure coming from the `M`-adic topology, and `M`-adically complete. -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*], IV.3 (Definition of the group -- `F(M)`, p. 122). ---/ - - set_option linter.dupNamespace false - -@@ -127,10 +84,8 @@ noncomputable def FormalGroup.evalAdd (F : FormalGroup R) - /-! ### Closure under `+_F`: `evalAdd F x y ∈ M` -/ - - omit [IsUniformAddGroup R] [IsLinearTopology R R] [T2Space R] [CompleteSpace R] in --/-- The maximal ideal is closed in the `M`-adic topology. - --`M` is open (as the basis of neighborhoods of 0 at level 1, i.e. `M^1 = M`), --hence closed. -/ -+ - lemma maximalIdeal_isClosed - (hAdic : IsAdic (IsLocalRing.maximalIdeal R)) : - IsClosed (IsLocalRing.maximalIdeal R : Set R) := by -@@ -296,7 +251,7 @@ private lemma coeff_swap_diag (d : Fin 2 →₀ ℕ) : - ((MvPowerSeries.X (1 : Fin 2) : MvPowerSeries (Fin 2) R) ^ ((finsupp_swap d) 0) * - (MvPowerSeries.X 0) ^ ((finsupp_swap d) 1)) = 1 := by - rw [coeff_X_one_pow_mul_X_zero_pow, finsupp_swap_apply_zero, finsupp_swap_apply_one, -- if_pos] -+ ite_eq_left] - ext i; fin_cases i <;> simp - - omit [IsLocalRing R] [UniformSpace R] [IsUniformAddGroup R] [IsTopologicalRing R] -@@ -450,7 +405,7 @@ private lemma coeff_single_X_pow_mul_zero_pow_of_ne - rw [show ((MvPowerSeries.X (0 : Fin 2) : MvPowerSeries (Fin 2) R) ^ (d 0)) = - MvPowerSeries.monomial (R := R) (Finsupp.single 0 (d 0)) 1 from by - rw [MvPowerSeries.X_pow_eq]] -- rw [MvPowerSeries.coeff_monomial, if_neg] -+ rw [MvPowerSeries.coeff_monomial, ite_eq_right] - intro heq - apply hdj - have := DFunLike.congr_fun heq 0 -@@ -528,9 +483,9 @@ private lemma evalAdd_zero_right_term_eq (F : FormalGroup R) - rw [hd_single, HasseWeil.FG.FormalGroup.coeff_10] - rw [show (Finsupp.single (0 : Fin 2) 1) 0 = 1 from by - simp] -- rw [pow_one, one_mul, if_pos rfl] -+ rw [pow_one, one_mul, ite_eq_left rfl] - · -- rw [hdeq, F.coeff_j0_of_ne_one (d 0) hd0, zero_mul, if_neg] -+ rw [hdeq, F.coeff_j0_of_ne_one (d 0) hd0, zero_mul, ite_eq_right] - intro hcontra - apply hd0 - have := DFunLike.congr_fun hcontra 0 -@@ -538,7 +493,7 @@ private lemma evalAdd_zero_right_term_eq (F : FormalGroup R) - · - rw [Finsupp.prod_fintype _ _ (fun i ↦ pow_zero _), Fin.prod_univ_two, - Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_zero, -- zero_pow hd1, mul_zero, mul_zero, if_neg] -+ zero_pow hd1, mul_zero, mul_zero, ite_eq_right] - intro hcontra - apply hd1 - have := DFunLike.congr_fun hcontra 1 -@@ -585,7 +540,7 @@ private lemma coeff_single_zero_pow_mul_X_pow_of_ne - rw [show ((MvPowerSeries.X (1 : Fin 2) : MvPowerSeries (Fin 2) R) ^ (d 1)) = - MvPowerSeries.monomial (R := R) (Finsupp.single 1 (d 1)) 1 from by - rw [MvPowerSeries.X_pow_eq]] -- rw [MvPowerSeries.coeff_monomial, if_neg] -+ rw [MvPowerSeries.coeff_monomial, ite_eq_right] - intro heq - apply hdj - have := DFunLike.congr_fun heq 1 -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroup.lean b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroup.lean -index 2febf6bff..953c00c2d 100644 ---- a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroup.lean -+++ b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroup.lean -@@ -197,16 +197,16 @@ theorem conv₂_truncate (n : ℕ) : - (if n - i < n then formalW_coeff W (n - i) else 0) = - formalW_coeff W i * formalW_coeff W (n - i) - rcases lt_or_eq_of_le hi with h_lt | h_eq -- · rw [if_pos h_lt] -+ · rw [ite_eq_left h_lt] - by_cases h_ni : n - i < n -- · rw [if_pos h_ni] -+ · rw [ite_eq_left h_ni] - · have h_i_eq_zero : i = 0 := by omega - subst h_i_eq_zero -- rw [if_neg h_ni] -+ rw [ite_eq_right h_ni] - rw [show formalW_coeff W 0 = 0 from formalW_coeff_zero W] - ring - · subst h_eq -- rw [if_neg (by omega : ¬ (i < i))] -+ rw [ite_eq_right (by omega : ¬ (i < i))] - rw [show i - i = 0 from Nat.sub_self i] - rw [show formalW_coeff W 0 = 0 from formalW_coeff_zero W] - ring -@@ -223,9 +223,9 @@ theorem conv₂_truncate' (n : ℕ) (hn : 1 ≤ n) : - (if n - 1 - i < n then formalW_coeff W (n - 1 - i) else 0) = - formalW_coeff W i * formalW_coeff W (n - 1 - i) - have h_i_lt_n : i < n := by omega -- rw [if_pos h_i_lt_n] -+ rw [ite_eq_left h_i_lt_n] - have h_ni_lt_n : n - 1 - i < n := by omega -- rw [if_pos h_ni_lt_n] -+ rw [ite_eq_left h_ni_lt_n] - - /-- `coeff n (formalW W * formalW W) = conv₂ (formalW_coeff W) n`. -/ - theorem coeff_formalW_sq (n : ℕ) : -@@ -287,19 +287,19 @@ private theorem conv₃_truncate_term {n i j : ℕ} (hi : i ≤ n) (hj : j ≤ n - (if n - i - j < n then formalW_coeff W (n - i - j) else 0) = - formalW_coeff W i * formalW_coeff W j * formalW_coeff W (n - i - j) := by - rcases lt_or_eq_of_le hi with h_i_lt | h_i_eq -- · rw [if_pos h_i_lt] -+ · rw [ite_eq_left h_i_lt] - rcases lt_or_eq_of_le hj with h_j_lt | h_j_eq - · -- j ≤ n - i and j < n - i, so j < n - have h_j_lt_n : j < n := by omega -- rw [if_pos h_j_lt_n] -+ rw [ite_eq_left h_j_lt_n] - by_cases h_k_lt_n : n - i - j < n -- · rw [if_pos h_k_lt_n] -+ · rw [ite_eq_left h_k_lt_n] - · -- n - i - j ≥ n means i + j = 0 - have h_i_eq_zero : i = 0 := by omega - have h_j_eq_zero : j = 0 := by omega - subst h_i_eq_zero - subst h_j_eq_zero -- rw [if_neg h_k_lt_n] -+ rw [ite_eq_right h_k_lt_n] - rw [show formalW_coeff W 0 = 0 from formalW_coeff_zero W] - ring - · -- j = n - i -@@ -313,7 +313,7 @@ private theorem conv₃_truncate_term {n i j : ℕ} (hi : i ≤ n) (hj : j ≤ n - -- j ≤ n - n = 0, so j = 0 - have h_j_eq_zero : j = 0 := by omega - subst h_j_eq_zero -- rw [if_neg (by omega : ¬ (i < i))] -+ rw [ite_eq_right (by omega : ¬ (i < i))] - rw [show formalW_coeff W 0 = 0 from formalW_coeff_zero W] - ring - -@@ -389,7 +389,7 @@ private theorem formalW_step_eq_recurrence_rhs_of_lt_three (n : ℕ) (hn3 : n < - unfold formalW_step - dsimp only - simp only [dite_eq_ite] -- rw [if_pos hn3, if_neg (by omega : ¬ (n = 3))] -+ rw [ite_eq_left hn3, ite_eq_right (by omega : ¬ (n = 3))] - interval_cases n - all_goals - simp [conv₂, conv₃, formalW_coeff_zero, formalW_coeff_one, formalW_coeff_two, -@@ -408,11 +408,11 @@ private theorem formalW_step_eq_recurrence_rhs_three (n : ℕ) (hn_eq3 : n = 3) - unfold formalW_step - dsimp only - simp only [dite_eq_ite] -- rw [if_neg (by omega : ¬ (n < 3)), if_pos hn_eq3] -+ rw [ite_eq_right (by omega : ¬ (n < 3)), ite_eq_left hn_eq3] - subst hn_eq3 - simp only [] -- rw [if_pos (by norm_num : (1 : ℕ) ≤ 3), if_pos (by norm_num : (2 : ℕ) ≤ 3), -- if_pos (by norm_num : (1 : ℕ) ≤ 3)] -+ rw [ite_eq_left (by norm_num : (1 : ℕ) ≤ 3), ite_eq_left (by norm_num : (2 : ℕ) ≤ 3), -+ ite_eq_left (by norm_num : (1 : ℕ) ≤ 3)] - rw [show formalW_coeff W (3 - 1) = formalW_coeff W 2 from by norm_num, - show formalW_coeff W (3 - 2) = formalW_coeff W 1 from by norm_num, - formalW_coeff_one W, formalW_coeff_two W] -@@ -434,17 +434,17 @@ private theorem formalW_step_eq_recurrence_rhs_of_four_le (n : ℕ) (hn4 : 4 ≤ - dsimp only - simp only [dite_eq_ite] - -- Clear the step's `n < 3` / `n = 3` guards (LHS) and the `n = 3` term on the RHS. -- rw [if_neg (by omega : ¬ (n < 3)), if_neg (by omega : ¬ (n = 3)), -- if_neg (by omega : ¬ (n = 3))] -- rw [if_pos (show 1 ≤ n from by omega), if_pos (show 2 ≤ n from by omega), -- if_pos (show 1 ≤ n from by omega)] -+ rw [ite_eq_right (by omega : ¬ (n < 3)), ite_eq_right (by omega : ¬ (n = 3)), -+ ite_eq_right (by omega : ¬ (n = 3))] -+ rw [ite_eq_left (show 1 ≤ n from by omega), ite_eq_left (show 2 ≤ n from by omega), -+ ite_eq_left (show 1 ≤ n from by omega)] - -- Use conv₂_truncate, conv₃_truncate for the LHS - rw [conv₂_truncate W n, conv₂_truncate' W n (by omega), conv₃_truncate W n] - -- The truncated w(n-1) and w(n-2) become formalW_coeff (already beta-reduced) - rw [show (if n - 1 < n then formalW_coeff W (n - 1) else 0) = formalW_coeff W (n - 1) from -- if_pos (by omega)] -+ ite_eq_left (by omega)] - rw [show (if n - 2 < n then formalW_coeff W (n - 2) else 0) = formalW_coeff W (n - 2) from -- if_pos (by omega)] -+ ite_eq_left (by omega)] - ring - - /-- The `formalW_step` recursion equals the recurrence right-hand side from -@@ -491,23 +491,5 @@ theorem formalW_recurrence : - formalW_coeff_eq_step W n] - exact formalW_step_eq_recurrence_rhs W n - --/-! ### Uniqueness of `formalW` (Silverman IV.1.1(b)) -- --Uniqueness of `formalW` follows the factoring pattern: if `d := w' - formalW W`, --then `d = K · d` for some `K` with zero constant coefficient, hence `d = 0` --by `PowerSeries.eq_zero_of_self_eq_mul_self` --(see `HasseWeil/PowerSeriesHelpers.lean`). -- --**Status**: infrastructure ready (`eq_zero_of_self_eq_mul_self`), but the --factoring step `RHS(w') − RHS(formalW W) = K · d` cannot be established by --`ring`/`linear_combination`/`abel` because of a `PowerSeries R` typeclass --gap: `RightDistribClass (PowerSeries R)` and `IsRightCancelAdd (PowerSeries R)` --fail to synthesize in Lean 4.29 / mathlib v4.29.0-rc6, blocking the ring --tactic on distributivity-heavy identities. The factoring works on simple --identities in isolation but stops mid-normalisation on the multi-term --combination needed here. A coefficient-induction route (via --`PowerSeries.ext` and strong induction on `n`, using `coeff_mul`) avoids --the ring issue and is the recommended next step. ---/ - - end HasseWeil -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupAssoc.lean b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupAssoc.lean -index b2a59710e..f835d413b 100644 ---- a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupAssoc.lean -+++ b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupAssoc.lean -@@ -122,7 +122,7 @@ theorem formalGroupLaw_coeff_right_unit (n : ℕ) : - -- d 0 = n, d 1 = 0, so the definition enters the "j = 0" branch - -- and returns "if i = 1 then 1 else 0" = "if n = 1 then 1 else 0". - simp only [formalGroupLaw_coeff] -- simp only [Finsupp.single_apply, if_true, if_false, show (0 : Fin 2) ≠ 1 from by decide] -+ simp only [Finsupp.single_apply, ite_true, ite_false, show (0 : Fin 2) ≠ 1 from by decide] - split_ifs <;> simp_all - - /-- `F(0, Y) = Y`: coefficient `F_{0,n} = [n=1]`. -/ -@@ -130,7 +130,7 @@ theorem formalGroupLaw_coeff_left_unit (n : ℕ) : - formalGroupLaw_coeff W (Finsupp.single 1 n) = - if n = 1 then 1 else 0 := by - simp only [formalGroupLaw_coeff] -- simp only [Finsupp.single_apply, if_true, if_false, show (1 : Fin 2) ≠ 0 from by decide] -+ simp only [Finsupp.single_apply, ite_true, ite_false, show (1 : Fin 2) ≠ 0 from by decide] - - /-! ### The ring homomorphism property of the pullback coefficient (Silverman III.5.6) -/ - -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupCorrespondence.lean b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupCorrespondence.lean -index c3196d467..960671107 100644 ---- a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupCorrespondence.lean -+++ b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupCorrespondence.lean -@@ -5,41 +5,6 @@ import Mathlib.RingTheory.Kaehler.Basic - import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition - import Mathlib.LinearAlgebra.Basis.VectorSpace - --/-! --# Formal Group ↔ Curve Correspondence (Silverman IV.1–2, IV.4) -- --This file establishes the connection between the formal group of an elliptic curve --and the curve's group law. The key results: -- --1. **Local parameter**: z = -x/y is a local uniformizer at O (Silverman IV.1). --2. **w(z)**: The power series solving w = f(z,w) (already in FormalGroup.lean). --3. **Formal group law**: z(P+Q) = F(z(P), z(Q)) where F is the formal group law. --4. **Pullback coefficient**: For [m], the formal group series has linear coefficient m. -- --## The Key Connection (Silverman IV.4) -- --For an endomorphism φ of E, the pullback coefficient a_φ is defined by: -- φ*ω = a_φ · ω --where ω = dx/(2y+a₁x+a₃) is the invariant differential. -- --Equivalently (via the formal group): φ induces a power series φ_F(T) = a_φ T + O(T²), --and a_φ is the linear coefficient. -- --The map φ ↦ a_φ is a ring homomorphism End(E) → K̄ (Silverman Cor. III.5.6). -- --## Kähler Module is 1-Dimensional (Silverman III.1.5) -- --For an elliptic curve E/K (genus 1), the space Ω_{K(E)/K} of differentials is --1-dimensional over K(E). This means every differential η can be written as c·ω --for a unique c ∈ K(E). -- --This follows from the Riemann-Roch theorem (genus = dim Ω) applied to the --function field K(E) of transcendence degree 1 over K. -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, III.1.5, III.5, IV.1–4 ---/ - - open WeierstrassCurve - -@@ -286,13 +251,12 @@ private lemma span_invariantDifferential_eq_top : - (Set.singleton_subset_iff.mpr (D_coordXFF_mem_span_invariantDifferential E)) - (D_mem_derivSpanX E f) - ---- The Kähler differential module Ω[K(E)/F] is generated by dx/(2y+a₁x+a₃) ---- as a K(E)-module. Every element η ∈ Ω is of the form c · ω for some c ∈ K(E). -+ - -- This follows from E having genus 1: by Riemann-Roch, dim_K(E) Ω = g = 1. - -- Reference: Silverman III.1.5, Prop. II.4.2(a). - theorem kaehler_rank_one : - Module.finrank E.FunctionField (KaehlerDifferential F E.FunctionField) = 1 := by -- haveI : Module.Free E.FunctionField (KaehlerDifferential F E.FunctionField) := -+ have : Module.Free E.FunctionField (KaehlerDifferential F E.FunctionField) := - Module.Free.of_divisionRing _ _ - rw [finrank_eq_one_iff'] - refine ⟨invariantDifferential E, invariantDifferential_ne_zero E, fun w ↦ ?_⟩ -@@ -309,6 +273,7 @@ section MulByMFormal - - variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The formal group power series [m]_F(T) = m·T + O(T²) for the multiplication - by m map. The linear coefficient is m. - -@@ -321,6 +286,7 @@ theorem formalMulByInt_linear_coeff (m : ℤ) : - formalMulByInt_coeff W.toAffine m 1 = (m : F) := by - simp only [formalMulByInt_coeff, one_ne_zero, ↓reduceIte] - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The multiplication-by-m on the formal group starts with 0 (no constant term). -/ - theorem formalMulByInt_const_zero (m : ℤ) : - formalMulByInt_coeff W.toAffine m 0 = 0 := by -@@ -352,6 +318,7 @@ section Correspondence - - variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The formal group ↔ curve correspondence for the pullback coefficient. - - For the multiplication-by-m endomorphism [m]: -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupLawSpec.lean b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupLawSpec.lean -index b652da19cfba4c065baf926dcd4db03ff6447aa1..e63da5ebe93847d80c49394dc1eddf0cefbfaea9 100644 -GIT binary patch -delta 1896 -zcmZ3rm~~wz>x9pnrMNmcxJy#wQw!sZGSf3kHZK=i$;br}$Vp8rnXVwkD6%?M78D -zyZLJAV|FC5&3kLb7*X`>t(DpQrEVItG_to6lTbW1d3KYPEOIi;KvDn+{bx-xIX5Tu -zm9nB3erK`=lI4>%r({bZTVsrB%aSRT_DIr*L<HQ3;uQ@uDKK?#bUTYNPPgFFBy5my}{uPj0Tbv>cY?puvy=R{_dPoAs~# -zvEI%n!YFTmWbt+*7seY*(4-30hX`PhzU@-(jK)kl#6|%~%k&IS#%s33>cEIJun{R< -zjJ}i^vHiLiBR``b+0KBv3z2rf?uzwgltPY~>1IBRfwZs$DUzmN_hAgBg&oKq* simp [h0, h1] -- rw [if_neg this, smul_zero])] -+ rw [ite_eq_right this, smul_zero])] - -- Eval at d = Finsupp.single 1 1: d 0 = 0, d 1 = 1. - have hd01 : (Finsupp.single (1 : Fin 2) 1) 0 = 0 := by simp - have hd11 : (Finsupp.single (1 : Fin 2) 1) 1 = 1 := by simp -- rw [hd01, hd11, if_pos ⟨rfl, rfl⟩] -+ rw [hd01, hd11, ite_eq_left ⟨rfl, rfl⟩] - -- coeff (Finsupp.single 1 1) F.toSeries = 1 by the right-unit axiom. - rw [HasseWeil.FG.FormalGroup.coeff_01, one_smul] - -@@ -460,7 +423,7 @@ private theorem support_finite_coeff_smul_indicator - apply hne - ext i - fin_cases i <;> simp [h0, h1] -- rw [if_neg this, smul_zero] -+ rw [ite_eq_right this, smul_zero] - - /-- The map `d ↦ coeff d F • coeff k (X^(d 0) * g^(d 1))` has finite support; - this is the support of the `![X, g]`-substitution coefficient finsum, finite by -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/Logarithm.lean b/projects/HasseWeil/HasseWeil/FormalGroup/Logarithm.lean -index 401695b65..199e735cd 100644 ---- a/projects/HasseWeil/HasseWeil/FormalGroup/Logarithm.lean -+++ b/projects/HasseWeil/HasseWeil/FormalGroup/Logarithm.lean -@@ -6,33 +6,6 @@ Authors: Chris Birkbeck - import HasseWeil.FormalGroup.InvariantDiff - import Mathlib.Algebra.Module.Rat - --/-! --# The formal logarithm of a formal group (Silverman IV.5) -- --For a formal group `F` over a `ℚ`-algebra `R` (or more generally a ring with a --`Module ℚ R` structure), the **formal logarithm** -- --`log_F(T) := ∫₀^T ω_F(s) ds = T + (c₁/2) T² + (c₂/3) T³ + ⋯` -- --is the integral of the normalized invariant differential --`ω_F(T) = 1 + c₁T + c₂T² + ⋯`. It is a power series with --constant term `0` and linear coefficient `1`. -- --## Main definition -- --* `HasseWeil.FormalGroup.FormalGroup.log F` — the formal logarithm of `F`, -- defined over any commutative ring `R` equipped with a `ℚ`-module structure. -- --## Main results -- --* `FormalGroup.log_coeff_zero` — `constantCoeff (log F) = 0`. --* `FormalGroup.log_coeff_succ` — `coeff (n + 1) (log F) = (1/(n+1)) • coeff n ω_F`. --* `FormalGroup.log_coeff_one` — `coeff 1 (log F) = 1`. -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*], IV.5. ---/ - - set_option linter.dupNamespace false - -@@ -40,16 +13,7 @@ namespace HasseWeil.FormalGroup - - variable {R : Type*} [CommRing R] - --/-- The **formal logarithm** of a formal group `F` over a ring `R` with a --`Module ℚ R` structure. -- --Concretely, if `ω_F(T) = 1 + c₁T + c₂T² + ⋯`, then --`log_F(T) = T + (c₁/2)T² + (c₂/3)T³ + ⋯ = ∑ (c_{n-1}/n)·T^n`. - --The coefficient at `T^n` for `n ≥ 1` is the ℚ-scalar multiple --`((n : ℚ)⁻¹) • (coeff of ω_F at n - 1)`. -- --Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.5. -/ - noncomputable def FormalGroup.log (F : FormalGroup R) [Module ℚ R] : - PowerSeries R := - PowerSeries.mk fun n ↦ -@@ -91,24 +55,6 @@ theorem FormalGroup.log_coeff_one (F : FormalGroup R) [Module ℚ R] : - rw [PowerSeries.coeff_zero_eq_constantCoeff_apply] - exact F.normalizedDifferential_isNormalized - --/-! ### The formal exponential -- --We construct `exp_F` as the compositional inverse of `log_F` via an iterative --truncation argument. -- --Let `f : PowerSeries R` with `coeff 0 f = 0` and `coeff 1 f = 1` --(e.g., `f = log_F`). We build the compositional inverse `g` incrementally: -- --* `compInvTrunc f 0 = 0`. --* `compInvTrunc f (n+1) = compInvTrunc f n + c · T^(n+1)` where the correction -- `c` is chosen so that `coeff (n+1) (f ∘ compInvTrunc f (n+1)) = [n+1 = 1]` -- (Kronecker delta). Since `f = T + O(T²)`, this determines `c` uniquely: -- `c = δ_{1, n+1} - coeff (n+1) (f(compInvTrunc f n))`. -- --By induction, `compInvTrunc f n` has the correct coefficients up to degree `n`, --and adding a `T^(n+1)` correction doesn't change any lower coefficient. --The compositional inverse is recovered by taking the `n`-th coefficient of --`compInvTrunc f n`. -/ - - /-- Iterative truncation of the compositional inverse of `f`. - At each step we add a correction of the form `c · T^(n+1)` chosen to zero out -@@ -205,7 +151,7 @@ theorem compInverse_coeff_one (f : PowerSeries R) : - else -PowerSeries.coeff (0 + 1) - (PowerSeries.subst (compInvTrunc f 0) f)) * - PowerSeries.X ^ (0 + 1)) = 1 -- rw [compInvTrunc_zero, if_pos rfl, coeff_one_subst_zero, sub_zero, zero_add] -+ rw [compInvTrunc_zero, ite_eq_left rfl, coeff_one_subst_zero, sub_zero, zero_add] - -- Goal: coeff 1 (C 1 * X^1) = 1. - simp - -@@ -248,7 +194,7 @@ theorem coeff_compInvTrunc_succ_of_le (f : PowerSeries R) (n k : ℕ) (hk : k - PowerSeries.C _ * PowerSeries.X ^ (n + 1)) = _ - rw [map_add, PowerSeries.coeff_C_mul_X_pow] - -- `k ≠ n + 1` since `k ≤ n`. -- rw [if_neg (by omega : k ≠ n + 1), add_zero] -+ rw [ite_eq_right (by omega : k ≠ n + 1), add_zero] - - open PowerSeries in - /-- For `k ≤ n`, the `k`-th coefficient of `compInvTrunc f n` equals the -@@ -383,7 +329,7 @@ theorem coeff_monomial_pow_high (n : ℕ) (c : R) (i : ℕ) (hi : 2 ≤ i) : - PowerSeries.coeff (n + 1) ((PowerSeries.C c * PowerSeries.X ^ (n + 1)) ^ i) = 0 := by - rw [monomial_pow_eq] - rw [PowerSeries.coeff_C_mul_X_pow] -- rw [if_neg] -+ rw [ite_eq_right] - intro heq - -- n + 1 = i * (n + 1) with i ≥ 2 contradicts n + 1 ≥ 1. - nlinarith -@@ -460,7 +406,7 @@ private theorem coeff_add_monomial_pow_eq_zero (g : PowerSeries R) (n : ℕ) (c - PowerSeries.coeff (n + 1) (g ^ 0) + (if (0 : ℕ) = 1 then c else 0) := by - rw [coeff_add_monomial_pow_eq_sum, Finset.sum_range_one] - simp only [Nat.choose_self, Nat.cast_one, one_mul, pow_zero, Nat.sub_self, mul_one] -- rw [if_neg (by decide : (0 : ℕ) ≠ 1), add_zero] -+ rw [ite_eq_right (by decide : (0 : ℕ) ≠ 1), add_zero] - - open PowerSeries in - /-- The `d = 1` case of `coeff_add_monomial_pow_eq`: the expansion has two terms, -@@ -478,11 +424,11 @@ private theorem coeff_add_monomial_pow_eq_one (g : PowerSeries R) (n : ℕ) (c : - rw [show (h ^ 0 : PowerSeries R) = 1 from pow_zero _] - rw [show (h ^ 1 : PowerSeries R) = h from pow_one _] - rw [show (g ^ 0 : PowerSeries R) = 1 from pow_zero _] -- rw [if_pos rfl] -+ rw [ite_eq_left rfl] - simp only [Nat.cast_one, one_mul, mul_one] - -- Goal: coeff (n+1) g + coeff (n+1) h = coeff (n+1) g + c - rw [show PowerSeries.coeff (n + 1) h = c from by -- rw [hdef, PowerSeries.coeff_C_mul_X_pow, if_pos rfl]] -+ rw [hdef, PowerSeries.coeff_C_mul_X_pow, ite_eq_left rfl]] - - open PowerSeries in - /-- The `d + 2` case of `coeff_add_monomial_pow_eq`: split the binomial sum into -@@ -517,7 +463,7 @@ private theorem coeff_add_monomial_pow_eq_succ_succ (g : PowerSeries R) - rw [Finset.sum_eq_zero (fun m hm ↦ by - simp only [Finset.mem_filter, Finset.mem_range] at hm - rw [coeff_monomial_pow_mul_eq_zero g n c hm.2 (d + 2 - m), mul_zero]), add_zero] -- rw [if_neg (by omega : d + 2 ≠ 1), add_zero] -+ rw [ite_eq_right (by omega : d + 2 ≠ 1), add_zero] - -- The m = 1 term vanishes since g has zero constant coefficient. - rw [coeff_monomial_mul_pow_succ_eq_zero g hg n c d, mul_zero, add_zero] - -@@ -577,8 +523,8 @@ theorem coeff_subst_add_monomial (f g : PowerSeries R) (n : ℕ) (c : R) - congr 1 - rw [finsum_eq_single _ 1 (by - intro d hd -- rw [if_neg hd, smul_zero])] -- rw [if_pos rfl, smul_eq_mul, mul_comm] -+ rw [ite_eq_right hd, smul_zero])] -+ rw [ite_eq_left rfl, smul_eq_mul, mul_comm] - - /-! ### The core invariant and the compositional-inverse identity -/ - -@@ -881,15 +827,7 @@ theorem compInverseOfUnit_coeff_one (f : PowerSeries R) (u : R) (hu : IsUnit u) - -- Goal: v ^ 1 * coeff 1 (compInverse (v • f)) = v. - rw [pow_one, compInverse_coeff_one, mul_one] - --/-- The **formal exponential** of a formal group `F` over a ring with a --`ℚ`-module structure. -- --Defined as the compositional inverse of `log_F`, via `compInverse`. --The full inverse identity `log_F ∘ exp_F = X` (Silverman IV.5.2) is future --work — this file only establishes the definition and basic coefficient --properties. - --Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.5. -/ - noncomputable def FormalGroup.exp (F : FormalGroup R) [Module ℚ R] : - PowerSeries R := - compInverse F.log -@@ -936,14 +874,7 @@ theorem FormalGroup.commutative_of_torsion_free (F : FormalGroup R) - F.toSeries = F.toSeries := - F.commutative - --/-- **Silverman IV.5.4 (coefficient identity)**: for `n ≥ 1`, --`n • log_F.coeff n = ω_F.coeff (n - 1)`. - --This is the `ℚ`-module-level identity that, after multiplying by `(n : ℚ)⁻¹`, --recovers the explicit formula `log_F.coeff n = (n : ℚ)⁻¹ • ω_F.coeff (n-1)` --(which is the content of `log_coeff_succ`). Over a torsion-free `ℤ`-algebra --it shows `n · log_F.coeff n` lies in the image of `ω_F`, which is the --`ℤ[a_i]`-containment stated in Silverman. -/ - theorem FormalGroup.log_coeff_succ_nsmul (F : FormalGroup R) [Module ℚ R] (n : ℕ) : - (n + 1) • PowerSeries.coeff (n + 1) F.log = - PowerSeries.coeff n F.normalizedDifferential.toSeries := by -@@ -1064,23 +995,23 @@ private theorem FormalGroup.dX_at_zero_additiveFormalGroup [Module ℚ R] : - | 0 => - -- The LHS: (if pos then 1 else 0) + (if single 0 1 = single 1 1 then 1 else 0) - -- = 1 + 0 = 1. -- simp only [Finsupp.single_zero, add_zero, if_true] -- rw [if_neg (by -+ simp only [Finsupp.single_zero, add_zero, ite_true] -+ rw [ite_eq_right (by - intro h - have := DFunLike.congr_fun h 0 - simp [Finsupp.single_eq_same] at this)] - rw [add_zero, PowerSeries.coeff_zero_eq_constantCoeff_apply] - simp - | k + 1 => -- rw [if_neg (by -+ rw [ite_eq_right (by - intro h - have := DFunLike.congr_fun h 1 - simp [Finsupp.add_apply, Finsupp.single_eq_same] at this)] -- rw [if_neg (by -+ rw [ite_eq_right (by - intro h - have h0 := DFunLike.congr_fun h 0 - simp [Finsupp.add_apply, Finsupp.single_eq_same] at h0)] -- rw [zero_add, PowerSeries.coeff_one, if_neg (by omega : k + 1 ≠ 0)] -+ rw [zero_add, PowerSeries.coeff_one, ite_eq_right (by omega : k + 1 ≠ 0)] - - /-- For the additive formal group, the normalized differential `ω_{Ĝ_a}` is the - constant series `1`. This follows from `dX_at_zero = 1` (see -@@ -1121,8 +1052,8 @@ theorem FormalGroup.log_additiveFormalGroup [Module ℚ R] : - -- so its coefficient at `n + 1 ≥ 1` is `0`. - rw [FormalGroup.normalizedDifferential_toSeries_additiveFormalGroup] - -- Goal: ((n+2)⁻¹ : ℚ) • coeff (n+1) (1 : PowerSeries R) = coeff (n+2) X -- rw [PowerSeries.coeff_one, if_neg (by omega : n + 1 ≠ 0), smul_zero, -- PowerSeries.coeff_X, if_neg (by omega : n + 1 + 1 ≠ 1)] -+ rw [PowerSeries.coeff_one, ite_eq_right (by omega : n + 1 ≠ 0), smul_zero, -+ PowerSeries.coeff_X, ite_eq_right (by omega : n + 1 + 1 ≠ 1)] - - /-- **Silverman IV.5.2 for `Ĝ_a`**: the additive formal group's log is - the identity, and as a trivial consequence, it preserves addition. -/ -@@ -1146,15 +1077,6 @@ theorem FormalGroup.additiveFormalGroup_logPreservesAdd [Module ℚ R] : - -- Goal: (additiveFormalGroup R).toSeries = X 0 + X 1. This is rfl by definition. - rfl - --/-! #### The general case: `LogPreservesAdd F` via Silverman IV.4.2 -- --The proof follows Silverman IV.5: differentiate both sides of --`log_F(F(X, Y)) = log_F(X) + log_F(Y)` with respect to `X`. The LHS derivative --(chain rule + IV.4.2 translation invariance) equals `ω_F(X)`; the RHS --derivative is `ω_F(X)` directly. Hence both sides have the same partial --derivative in `X`. Combined with agreement at `X = 0` (via the right unit --`F(0, Y) = Y` and `log_F(0) = 0`), they are equal because `Module ℚ R` --makes `R` torsion-free. -/ - - /-- **Key derivative identity**: `pderiv' () F.log = F.invariantDiff` - (both viewed as `MvPowerSeries Unit R = PowerSeries R`). -@@ -1210,9 +1132,7 @@ private theorem pderiv_PowerSeries_subst {τ : Type*} - /-! #### Uniqueness: a two-variable series is determined by its derivative in - variable 0 and its value at `X 0 = 0`. -/ - --/-- Auxiliary: if `h : MvPowerSeries (Fin 2) R` has zero derivative in variable --`0` (over a `Module ℚ R`), then all coefficients with positive 0-degree vanish. ---/ -+ - private theorem coeff_zero_of_pderiv_zero_fin2 [Module ℚ R] - (h : MvPowerSeries (Fin 2) R) (hd : MvPowerSeries.pderiv' 0 h = 0) - (e : Fin 2 →₀ ℕ) (he : e 0 ≠ 0) : -@@ -1226,9 +1146,9 @@ private theorem coeff_zero_of_pderiv_zero_fin2 [Module ℚ R] - intro i - by_cases hi : i = 0 - · subst hi -- rw [Finsupp.single_apply, if_pos rfl, ha] -+ rw [Finsupp.single_apply, ite_eq_left rfl, ha] - exact Nat.succ_pos a -- · rw [Finsupp.single_apply, if_neg (Ne.symm hi)] -+ · rw [Finsupp.single_apply, ite_eq_right (Ne.symm hi)] - exact Nat.zero_le _ - have hd_sum : d + Finsupp.single (0 : Fin 2) 1 = e := by - rw [hd_def, tsub_add_cancel_of_le hle] -@@ -1520,7 +1440,7 @@ private theorem coeff_subst_zero_X1_at_single_1 (h : MvPowerSeries (Fin 2) R) (b - rw [finsum_eq_single _ (Finsupp.single (1 : Fin 2) b)] - · -- Case d = single 1 b: d.prod _ = (X 1)^b, coeff (single 1 b) ((X 1)^b) = 1. - rw [prod_eval_zero_X1_of_fst_eq_zero _ (by simp), coeff_single_1_X1_pow, -- if_pos (by simp), smul_eq_mul, mul_one] -+ ite_eq_left (by simp), smul_eq_mul, mul_one] - · -- For d ≠ single 1 b: the contribution is zero. - intro d hd - -- Two cases: d 0 ≠ 0 OR (d 0 = 0 AND d 1 ≠ b). -@@ -1535,7 +1455,7 @@ private theorem coeff_subst_zero_X1_at_single_1 (h : MvPowerSeries (Fin 2) R) (b - rw [h0]; simp - · change d 1 = (Finsupp.single (1 : Fin 2) b) 1 - rw [h1]; simp -- rw [prod_eval_zero_X1_of_fst_eq_zero _ h0, coeff_single_1_X1_pow, if_neg hd1, smul_zero] -+ rw [prod_eval_zero_X1_of_fst_eq_zero _ h0, coeff_single_1_X1_pow, ite_eq_right hd1, smul_zero] - · -- d 0 ≠ 0: d.prod = 0. - rw [prod_eval_zero_X1_of_fst_ne_zero _ h0, map_zero, smul_zero] - -@@ -1601,15 +1521,6 @@ theorem FormalGroup.logPreservesAdd (F : FormalGroup R) [Module ℚ R] : - exact eq_zero_of_pderiv_zero_and_subst_zero_X1 h - (hh ▸ pderiv_zero_LogPreservesAdd_diff F) (hh ▸ subst_zero_X1_LogPreservesAdd_diff F) - --/-! #### Packaging `log_F` as a formal group homomorphism -- --Assuming `LogPreservesAdd F` (i.e., the target identity of Silverman IV.5.2), --we package `log_F` as a `FormalGroupHom F (additiveFormalGroup R)`. -- --The construction only requires the identity of `LogPreservesAdd` plus the --fact that `log_F` has zero constant coefficient (which is `log_coeff_zero`). --The `preserves_add` axiom of the homomorphism is an unfolding of the --`LogPreservesAdd` identity. -/ - - /-- Under the hypothesis `LogPreservesAdd F`, `log_F` extends to a formal - group homomorphism `F → Ĝ_a`. This is the packaging part of the -@@ -1663,11 +1574,7 @@ noncomputable def FormalGroup.additiveFormalGroup_logHom [Module ℚ R] : - (additiveFormalGroup R).logHomOfLogPreservesAdd - (FormalGroup.additiveFormalGroup_logPreservesAdd) - --/-- **`log_F` as a `FormalGroupHom`** (Silverman IV.5.2 packaged). - --For a formal group `F` over a `ℚ`-module `R`, `log_F : F → Ĝ_a` is a formal --group homomorphism. The underlying series is `F.log`, and the `preserves_add` --axiom is `F.logPreservesAdd`. -/ - noncomputable def FormalGroup.logHom (F : FormalGroup R) [Module ℚ R] : - FormalGroupHom F (additiveFormalGroup R) := - F.logHomOfLogPreservesAdd F.logPreservesAdd -diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/PDeriv.lean b/projects/HasseWeil/HasseWeil/FormalGroup/PDeriv.lean -index 1cb34befc..a82fdd140 100644 ---- a/projects/HasseWeil/HasseWeil/FormalGroup/PDeriv.lean -+++ b/projects/HasseWeil/HasseWeil/FormalGroup/PDeriv.lean -@@ -9,43 +9,6 @@ import Mathlib.RingTheory.MvPowerSeries.Basic - import Mathlib.RingTheory.MvPowerSeries.PiTopology - import Mathlib.RingTheory.MvPowerSeries.Substitution - --/-! --# Partial derivatives of multivariate formal power series -- --This file defines the formal partial derivative `MvPowerSeries.pderiv' s` on --`MvPowerSeries σ R`. Mathlib provides a univariate version --`PowerSeries.derivative` for `PowerSeries R` and a polynomial version --`MvPolynomial.pderiv`, but there is no `pderiv'` for multivariate power series. -- --The derivative is defined by the convention -- -- `pderiv' s f := ∑_d ((d s + 1) • coeff_{d + e_s} f) · X^d`, -- --which matches the univariate `PowerSeries.derivativeFun` for `σ = Unit` and --agrees with `MvPolynomial.pderiv` under the coercion --`MvPolynomial σ R → MvPowerSeries σ R` (see `pderiv'_coe`). -- --This is used downstream in the proof of Silverman IV.4.2 (translation --invariance of the invariant differential on a formal group). -- --## Main definitions and results -- --* `MvPowerSeries.pderiv' s f` — partial derivative w.r.t. `s : σ`. --* `MvPowerSeries.coeff_pderiv'` — the coefficient of the derivative. --* `MvPowerSeries.pderiv_add`, `pderiv_zero`, `pderiv_smul`, `pderiv'_C`, -- `pderiv'_X_self`, `pderiv'_X_of_ne`, `pderiv_sub`, `pderiv_neg`, `pderiv'_one` -- — basic API. --* `MvPowerSeries.pderiv_monomial` — the derivative of a monomial. --* `MvPowerSeries.pderiv_mul` — **Leibniz rule** for the multivariate formal -- derivative. --* `MvPowerSeries.pderiv'_coe` — agreement with `MvPolynomial.pderiv`. --* `MvPowerSeries.continuous_pderiv` — continuity of `pderiv'` in the product -- topology. --* `MvPowerSeries.pderiv_subst` — **substitution chain rule** for -- `MvPowerSeries.pderiv'` over a finite index type. --* `MvPowerSeries.pderiv_subst_fin2` — specialization to `σ = Fin 2`, as used -- in Silverman IV.4.2. ---/ - - noncomputable section - -@@ -106,13 +69,13 @@ private lemma add_single_ne_zero (d : σ →₀ ℕ) (s : σ) : - theorem pderiv'_one (s : σ) : pderiv' s (1 : MvPowerSeries σ R) = 0 := by - classical - ext d -- rw [coeff_pderiv', coeff_one, if_neg (add_single_ne_zero d s), smul_zero, coeff_zero] -+ rw [coeff_pderiv', coeff_one, ite_eq_right (add_single_ne_zero d s), smul_zero, coeff_zero] - - @[simp] - theorem pderiv'_C (s : σ) (r : R) : pderiv' s (C (σ := σ) r) = 0 := by - classical - ext d -- rw [coeff_pderiv', coeff_C, if_neg (add_single_ne_zero d s), smul_zero, coeff_zero] -+ rw [coeff_pderiv', coeff_C, ite_eq_right (add_single_ne_zero d s), smul_zero, coeff_zero] - - @[simp] - theorem pderiv'_X_self (s : σ) : pderiv' s (X s : MvPowerSeries σ R) = 1 := by -@@ -122,14 +85,14 @@ theorem pderiv'_X_self (s : σ) : pderiv' s (X s : MvPowerSeries σ R) = 1 := by - by_cases hd : d = 0 - · subst hd - have h : (0 : σ →₀ ℕ) + Finsupp.single s 1 = Finsupp.single s 1 := by simp -- rw [h, if_pos rfl, if_pos rfl, Finsupp.coe_zero, Pi.zero_apply, zero_add, one_smul] -+ rw [h, ite_eq_left rfl, ite_eq_left rfl, Finsupp.coe_zero, Pi.zero_apply, zero_add, one_smul] - · have h : d + Finsupp.single s 1 ≠ Finsupp.single s 1 := by - intro heq - apply hd - have : d + Finsupp.single s 1 = 0 + Finsupp.single s 1 := by - rw [heq, zero_add] - exact add_right_cancel this -- rw [if_neg h, if_neg hd, smul_zero] -+ rw [ite_eq_right h, ite_eq_right hd, smul_zero] - - @[simp] - theorem pderiv'_X_of_ne {s t : σ} (h : s ≠ t) : -@@ -142,9 +105,9 @@ theorem pderiv'_X_of_ne {s t : σ} (h : s ≠ t) : - have hs : (d + Finsupp.single s 1 : σ →₀ ℕ) s = (Finsupp.single t (1 : ℕ)) s := by - rw [heq] - rw [Finsupp.add_apply, single_self_apply, -- Finsupp.single_apply, if_neg h.symm] at hs -+ Finsupp.single_apply, ite_eq_right h.symm] at hs - omega -- rw [if_neg h', smul_zero] -+ rw [ite_eq_right h', smul_zero] - - /-! ### Leibniz rule -/ - -@@ -161,7 +124,7 @@ private lemma smul_eq_zero_of_not_le {s : σ} {a : σ →₀ ℕ} - · subst hi - rw [single_self_apply] - exact Nat.one_le_iff_ne_zero.mpr hne -- · rw [Finsupp.single_apply, if_neg (Ne.symm hi)] -+ · rw [Finsupp.single_apply, ite_eq_right (Ne.symm hi)] - exact Nat.zero_le _ - rw [this] - simp -@@ -342,20 +305,20 @@ private lemma coeff_pderiv_monomial_single_le {s : σ} {n d : σ →₀ ℕ} {a - have hdeq : d = n - Finsupp.single s 1 := by - rw [← hd] - exact (add_tsub_cancel_right d _).symm -- rw [if_pos hd, if_pos hdeq] -+ rw [ite_eq_left hd, ite_eq_left hdeq] - -- `(d s + 1) • a = a * n s`. - have heq : d s + 1 = n s := by - have hds : (d + Finsupp.single s 1 : σ →₀ ℕ) s = n s := by rw [hd] - simp only [Finsupp.add_apply, he_s] at hds - exact hds - rw [heq, nsmul_eq_mul, mul_comm] -- · rw [if_neg hd] -+ · rw [ite_eq_right hd] - -- d + single s 1 ≠ n means d ≠ n - single s 1 (when single s 1 ≤ n). - have hd' : d ≠ n - Finsupp.single s 1 := by - intro heq - apply hd - rw [heq, tsub_add_cancel_of_le hle] -- rw [if_neg hd', smul_zero] -+ rw [ite_eq_right hd', smul_zero] - - /-- Per-coefficient identity behind `pderiv_monomial` when `¬ single s 1 ≤ n` (i.e. - `single s 1 ⊄ n`): then `n s = 0`, so the right-hand coefficient `a * n s` vanishes, and -@@ -376,7 +339,7 @@ private lemma coeff_pderiv_monomial_not_single_le {s : σ} {n d : σ →₀ ℕ} - · subst hi - rw [he_s] - exact Nat.one_le_iff_ne_zero.mpr hne -- · rw [Finsupp.single_apply, if_neg (Ne.symm hi)] -+ · rw [Finsupp.single_apply, ite_eq_right (Ne.symm hi)] - exact Nat.zero_le _ - rw [hns, Nat.cast_zero, mul_zero] - -- and `d + single s 1 = n` is impossible. -@@ -385,7 +348,7 @@ private lemma coeff_pderiv_monomial_not_single_le {s : σ} {n d : σ →₀ ℕ} - apply hle - rw [← heq] - exact le_add_self -- rw [if_neg hne, smul_zero] -+ rw [ite_eq_right hne, smul_zero] - split_ifs <;> rfl - - theorem pderiv_monomial (s : σ) (n : σ →₀ ℕ) (a : R) : -diff --git a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback.lean b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback.lean -index 0ec0adda3..569d1317f 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback.lean -@@ -26,9 +26,7 @@ addition formulas from mathlib. - ## References - - * Silverman, *The Arithmetic of Elliptic Curves*, III.2.3c (explicit addition -- formulas) + III.3.6 (`+` is a morphism). Round-13 D-R13-A-04 fix: III.3.6 is -- the morphism property; the explicit formula is III.2.3c (referenced inside -- III.3.6's proof at book p. 64). -+ formulas) and III.3.6 (`+` is a morphism). - * Mathlib: `WeierstrassCurve.Affine.equation_add` - -/ - -@@ -268,7 +266,7 @@ omit [DecidableEq F] [W.toAffine.IsElliptic] α in - private lemma minpoly_F_x_gen_natDegree_le_two - (α : KE) (hfin : Module.finrank (FractionRing (Polynomial F)) KE = 2) : - (minpoly (FractionRing (Polynomial F)) α).natDegree ≤ 2 := by -- haveI : FiniteDimensional (FractionRing (Polynomial F)) KE := -+ have : FiniteDimensional (FractionRing (Polynomial F)) KE := - Module.finite_of_finrank_pos (by rw [hfin]; exact (by decide : 0 < 2)) - have h_le := minpoly.natDegree_le (A := FractionRing (Polynomial F)) (B := KE) (x := α) - rw [hfin] at h_le -@@ -311,7 +309,7 @@ private lemma addPullback_x_quadratic_over_F_case_two - rw [Polynomial.aeval_eq_sum_range, h_eq_2_F] at h_aeval - simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add, - pow_zero, pow_one, Algebra.smul_def, mul_one] at h_aeval -- rw [h_lc_2, map_one, one_mul] at h_aeval -+ rw [h_lc_2, map_one (algebraMap F KE), one_mul] at h_aeval - rw [map_neg, neg_mul, sub_neg_eq_add] - linear_combination h_aeval - -diff --git a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/Differential.lean b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/Differential.lean -index 35e8ea489..2925f2b5b 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/Differential.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/Differential.lean -@@ -12,27 +12,17 @@ import HasseWeil.HasseBound.QuadraticFormHoleE - /-! - # Differential pullback for the addition isogeny `1 − π` - --Witness #1 of `hasse_bound_via_signed_QF_negFrobenius` needs the omega-pullback --coefficient of `isogOneSub_negFrobenius W hq` to equal `1`. This file assembles the --separability of `1 − π` from that coefficient via the cotangent (T-II-4-004) criterion, --and computes the supporting coefficients for `mulByInt (-1)` and `negFrobeniusIsog`. -+The invariant-differential coefficient of `1 − π` is one under the corresponding -+additivity hypothesis. The cotangent criterion then gives separability. The supporting -+computations identify the coefficients of negation and negative Frobenius as `-1` and zero. - --The omega-coefficient identity itself is reduced to a Silverman III.5.2 additivity --hypothesis (the `id + (-1)·π` decomposition); several witness-parametric consumers below --take that hypothesis in different shapes and produce the separability conclusion. -+The function-field extension defined by the pullback of `1 − π` is finite-dimensional: -+its x-coordinate is transcendental, hence forms a transcendence basis, and the function -+field is algebraic over the pullback range. Finite-dimensionality gives the equivalence -+between separability and a nonzero invariant-differential coefficient. - --## Main results -- --* `isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero`: the T-II-4-004 -- separability criterion for `1 − π`, unconditional. --* `omegaPullbackCoeff_mulByInt_neg_one`, `omegaPullbackCoeff_negFrobeniusIsog`: the -- supporting omega-coefficient computations. --* `isogOneSub_negFrobenius_finiteDimensional`: Witness #2 (finite-dimensionality). -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, III.5.2 (additivity), -- III.5.3 (`[m]*ω = m·ω`), III.5.5 (Frobenius is purely inseparable). -+References: Silverman, *The Arithmetic of Elliptic Curves*, III.5.2 (additivity), -+III.5.3 (`[m]*ω = m·ω`), and III.5.5 (Frobenius is purely inseparable). - -/ - - open WeierstrassCurve -@@ -44,17 +34,8 @@ variable (W : WeierstrassCurve K) [W.toAffine.IsElliptic] - - local notation "KE" => W.toAffine.FunctionField - --/-- **Witness-parametric Witness #1 omega-coefficient closer**: takes the --Silverman III.5.2 additivity witness for `isogOneSub_negFrobenius` and --produces the deliverable `omegaPullbackCoeff = 1`. -- --The additivity hypothesis is exactly the III.5.2 specialization to the --`1 − π = 1·id + (-1)·π` decomposition. Closing it via the witness-parametric --bridge chain (`omegaPullbackCoeff_add_of_leading_witness`, --`FormalIsogenySeries.lean`; the unconditional --`omegaPullbackCoeff_add_via_bridge_of_constCoeff` was deleted 2026-06-11 as --refutable) is the substantive piece — once that's in hand, this lemma fires --the closure axiom-clean. -/ -+/-- The additivity identity for `1 − π = id + (-1)·π` implies that its -+invariant-differential coefficient is one (Silverman III.5.2). -/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_additivity_witness - (hq : 2 ≤ Fintype.card K) - (h_add : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = -@@ -64,11 +45,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_additivity_witness - simpa using omegaPullbackCoeff_m_plus_n_frob_of_witness W - (isogOneSub_negFrobenius W hq) 1 (-1) h_add - --/-- **Hom decomposition for `1 − π`**: the rational-point map of --`isogOneSub_negFrobenius W hq` equals the sum of `(Isogeny.id W.toAffine).toAddMonoidHom` --and `(negFrobeniusIsog W).toAddMonoidHom`. (Historically the `h_add` input of the --deleted-2026-06-11 `omegaPullbackCoeff_add_via_bridge_of_constCoeff`; retained as the --group-law decomposition identity in its own right.) -/ -+/-- The rational-point map of `1 − π` is the sum of the identity map and negative Frobenius. -+-/ - theorem isogOneSub_negFrobenius_toAddMonoidHom_decomposition - (hq : 2 ≤ Fintype.card K) : - (isogOneSub_negFrobenius W hq).toAddMonoidHom = -@@ -81,15 +59,8 @@ theorem isogOneSub_negFrobenius_toAddMonoidHom_decomposition - rw [Isogeny.id_toAddMonoidHom, AddMonoidHom.id_apply, - negFrobeniusIsog_toAddMonoidHom_apply, sub_eq_add_neg] - --/-- **Composed Witness #1**: separability of `isogOneSub_negFrobenius W hq`, --taking only the additivity sum hypothesis (Silverman III.5.2 input for the --specific `1 − π = 1·id + (-1)·π` decomposition) and the T-II-4-004 --differential separability criterion. -- --Hypothesis count drops from two (omega-coeff + T-II-4-004) to two of a --sharper shape (additivity sum + T-II-4-004) — the additivity sum is the --direct discharge target of the T-DIFFERENTIAL-PULLBACK-ADDITION-MAP --infrastructure, removing one layer of indirection. -/ -+/-- The differential additivity identity and the nonzero-coefficient separability -+criterion imply that `1 − π` is separable. -/ - theorem isogOneSub_negFrobenius_isSeparable_of_additivity_and_T2_4_004 - (hq : 2 ≤ Fintype.card K) - (h_add : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = -@@ -103,15 +74,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_additivity_and_T2_4_004 - W hq h_add) - h_sep_iff - --/-- **Composed Witness #1 (sharper)**: separability of `isogOneSub_negFrobenius W hq`, --taking the additivity sum, Witness #2 (FiniteDim), and the algebra-Kähler bridge --(Subsingleton ↔ pullbackKaehler injective) as inputs. -- --Composes Commit 13 (T-II-4-004 full iff witness-parametric) with the existing --additivity-Witness-1 closer. Replaces the iff hypothesis with the two --witnesses underlying it; when the bridge discharges (cotangent-sequence --argument unblocked by Sub-piece A break-through), this becomes an --unconditional consumer of Witness #2 only. -/ -+/-- Differential additivity, finite-dimensionality, and the cotangent criterion imply -+separability of `1 − π`. -/ - theorem isogOneSub_negFrobenius_isSeparable_of_additivity_finiteDim_bridge - (hq : 2 ≤ Fintype.card K) - (h_add : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = -@@ -127,9 +91,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_additivity_finiteDim_bridge - (isSeparable_iff_omegaPullbackCoeff_ne_zero_of_witnesses W - (isogOneSub_negFrobenius W hq) h_fin h_bridge) - --/-- **{addPullback_x_negFrobenius} is alg-indep over K (axiom-clean)**: --the singleton family is algebraically independent over `K`, by transcendentality --(`addPullback_x_transcendental_negFrobenius`). -/ -+/-- The singleton consisting of the x-coordinate of `1 − π` is algebraically independent -+because that coordinate is transcendental over the base field. -/ - theorem addPullback_x_negFrobenius_algebraicIndependent - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) : -@@ -139,9 +102,8 @@ theorem addPullback_x_negFrobenius_algebraicIndependent - rw [algebraicIndependent_unique_type_iff] - exact addPullback_x_transcendental_negFrobenius W hq hxy - --/-- **{addPullback_x_negFrobenius} is a transcendence basis (axiom-clean)**: --combines alg-independence with `trdeg K K(E) = 1` to yield the 1-element --transcendence basis via `AlgebraicIndependent.isTranscendenceBasis_of_lift_trdeg_le_of_finite`. -/ -+/-- The x-coordinate of `1 − π` is a transcendence basis, since the function field has -+transcendence degree one. -/ - theorem addPullback_x_negFrobenius_isTranscendenceBasis - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) : -@@ -153,13 +115,8 @@ theorem addPullback_x_negFrobenius_isTranscendenceBasis - rw [weierstrass_functionField_trdeg_eq_one W] - simp - --/-- **K(E) is algebraic over `Algebra.adjoin K {addPullback_x_negFrobenius}` --(axiom-clean, Path (a) step 4)**: applying `IsTranscendenceBasis.isAlgebraic` --to the trans-basis singleton gives the relative algebraicity over the --adjoin subalgebra. -- --@-explicit `Subalgebra.toAlgebra` to bypass typeclass-synthesis flakiness --on the specific Weierstrass term `addPullback_x W (negFrobeniusIsog W)`. -/ -+/-- The function field is algebraic over the subalgebra generated by the x-coordinate -+of `1 − π`. -/ - theorem addPullback_x_negFrobenius_isAlgebraic_subalgebra - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) : -@@ -170,9 +127,8 @@ theorem addPullback_x_negFrobenius_isAlgebraic_subalgebra - (Subalgebra.toAlgebra _) := - (addPullback_x_negFrobenius_isTranscendenceBasis W hq hxy).isAlgebraic - --/-- **addPullback_x is in the negFrobenius pullback's range (axiom-clean)**: --direct identification via the `addPullbackAlgHom` construction — --`x_gen` maps to `addPullback_x`. -/ -+/-- The x-coordinate of `1 − π` belongs to its pullback range: it is the image of `x_gen`. -+-/ - theorem addPullback_x_negFrobenius_mem_range - (hq : 2 ≤ Fintype.card K) : - addPullback_x W (negFrobeniusIsog W) ∈ -@@ -195,11 +151,8 @@ theorem addPullback_x_negFrobenius_mem_range - AdjoinRoot.lift_mk] - simp [addBaseHom, Polynomial.eval₂_C] - --/-- **Algebraicity over α.pullback.range** (Path (a) step 5, witness-parametric): --given `addPullback_x ∈ (isogOneSub_negFrobenius W hq).pullback.range`, --lift the IsAlgebraic from the smaller adjoin subalgebra to α.pullback.range. -- --Uses `IsAlgebraic.tower_top_of_subalgebra_le` element-wise. -/ -+/-- If the x-coordinate belongs to the pullback range, algebraicity over the subalgebra -+it generates implies algebraicity over that range. -/ - theorem addPullback_x_negFrobenius_isAlgebraic_range_of_witness - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) -@@ -223,8 +176,7 @@ theorem addPullback_x_negFrobenius_isAlgebraic_range_of_witness - exact ((addPullback_x_negFrobenius_isAlgebraic_subalgebra W hq hxy).isAlgebraic - y).tower_top_of_subalgebra_le h_le - --/-- **Algebraicity over α.pullback.range (UNCONDITIONAL, axiom-clean)**: --discharges Commit 26 by feeding Commit 27's membership witness. -/ -+/-- The function field is algebraic over the pullback range of `1 − π`. -/ - theorem addPullback_x_negFrobenius_isAlgebraic_range - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) : -@@ -236,12 +188,8 @@ theorem addPullback_x_negFrobenius_isAlgebraic_range - (addPullback_x_negFrobenius_mem_range W hq) - - set_option backward.isDefEq.respectTransparency.types false in --/-- **Algebraicity over the type-synonym wrapper (UNCONDITIONAL, axiom-clean, --Path (a) step 8)**: `K(E)` is algebraic over `IsogenyAlgebraSource W --(isogOneSub_negFrobenius W hq)`. -- --Transfers Commit 28's algebraicity-over-`α.pullback.range` to the type-synonym --form via the bijective range iso `α.pullback : K(E) ≃ₐ[K] α.pullback.range`. -/ -+/-- Algebraicity over the pullback range transfers to the algebra-source type via the -+range isomorphism `K(E) ≃ₐ[K] α.pullback.range`. -/ - theorem isogOneSub_negFrobenius_isAlgebraic_synonym - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) : -@@ -265,41 +213,18 @@ theorem isogOneSub_negFrobenius_isAlgebraic_synonym - change α.pullback (e.symm z) = (z : W.toAffine.FunctionField) - exact congrArg Subtype.val (e.apply_symm_apply z) - --/-- **WITNESS #2 UNCONDITIONAL (axiom-clean)**: K(E) is finite-dimensional --over `(isogOneSub_negFrobenius W hq).pullback K(E)` (via `α.toAlgebra.toModule`). -- --Composes: --* Commit 18 (`isogeny_finiteDimensional_of_isAlgebraic_synonym`): the -- type-synonym Witness #2 producer. --* Commit 19 (`isogenyAlgebraSource_essFiniteType` UNCONDITIONAL): synonym -- EssFiniteType from FractionRing localization + `EssFiniteType.of_comp`. --* Commit 29 (`isogOneSub_negFrobenius_isAlgebraic_synonym` UNCONDITIONAL): -- synonym IsAlgebraic from trans-deg + IsTranscendenceBasis + range iso. -- --This closes the bound's Witness #2 fully unconditional. T-II-4-004's full --iff (Commit 17 = `isSeparable_iff_omegaPullbackCoeff_ne_zero_of_finiteDim`) --chains to fully unconditional `α.IsSeparable ↔ ω-coeff ≠ 0` for the --negFrobenius case. -/ -+/-- The pullback function-field extension for `1 − π` is finite-dimensional, since it -+is algebraic and essentially of finite type. -/ - theorem isogOneSub_negFrobenius_finiteDimensional - (hq : 2 ≤ Fintype.card K) : - @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField - _ _ (isogOneSub_negFrobenius W hq).toAlgebra.toModule := by -- haveI := isogOneSub_negFrobenius_isAlgebraic_synonym W hq -+ have := isogOneSub_negFrobenius_isAlgebraic_synonym W hq - (negFrobeniusIsog_addNonInverse W) - exact isogeny_finiteDimensional_of_isAlgebraic_synonym W (isogOneSub_negFrobenius W hq) - --/-- **T-II-4-004 FULLY UNCONDITIONAL for negFrobenius (axiom-clean)**: --the iff `α.IsSeparable ↔ omegaPullbackCoeff W α ≠ 0` for --`α = isogOneSub_negFrobenius W hq` lands axiom-clean with no remaining --hypotheses (modulo only the `hq : 2 ≤ Fintype.card K` standing on --the bound's signature). -- --One-line composition of Commit 17 (witness-parametric iff on FiniteDim) --+ Commit 30 (Witness #2 UNCONDITIONAL). -- --This closes T-II-4-004 for the bound's purpose. The bound's deferred- --witness count drops to 2 (Witness #1 unconditional + the additivity --discharge for general α through BRIDGE-001). -/ -+/-- The isogeny `1 − π` is separable exactly when its invariant-differential coefficient -+is nonzero. -/ - theorem isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero - (hq : 2 ≤ Fintype.card K) : - (isogOneSub_negFrobenius W hq).IsSeparable ↔ -@@ -308,11 +233,8 @@ theorem isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero - (isogOneSub_negFrobenius W hq) - (isogOneSub_negFrobenius_finiteDimensional W hq) - ---- `[Fintype K]` is unused in the statement but needed transitively by the proof's ---- instance resolution, so it cannot be `omit`ted. --/-- **`alpha_star_u` for `mulByInt (-1)` equals `-u_gen` (axiom-clean)**: --the negation isogeny pulls `u_gen = 2y + a₁x + a₃` to its negative --(via `mulByInt_pullback_y_neg_one`). -/ -+omit [Fintype K] in -+/-- Negation pulls `u_gen = 2y + a₁x + a₃` back to `-u_gen`. -/ - theorem alpha_star_u_mulByInt_neg_one : - alpha_star_u W (mulByInt W.toAffine (-1)) = -u_gen W := by - change 2 * (mulByInt W.toAffine (-1)).pullback (y_gen W) + -@@ -324,14 +246,9 @@ theorem alpha_star_u_mulByInt_neg_one : - rw [mulByInt_pullback_y_neg_one, mulByInt_pullback_x_neg_one] - ring - ---- `[Fintype K]` is unused in the statement but needed transitively by the proof. --/-- **omegaPullbackCoeff for `mulByInt (-1)` equals `-1` (axiom-clean)**: --direct via `omegaPullbackCoeff_unique` + the spec equation, using --`alpha_star_u_mulByInt_neg_one` and `mulByInt_pullback_x_neg_one`. -- --This is independent of the Wronskian-based `omegaPullbackCoeff_mulByInt`, --so it lands axiom-clean (`omegaPullbackCoeff_mulByInt` uses `sorryAx` via --the Wronskian derivation). -/ -+omit [Fintype K] in -+/-- The invariant-differential coefficient of negation is `-1`, by the differential -+of the x-coordinate and the negation formula for `u_gen`. -/ - theorem omegaPullbackCoeff_mulByInt_neg_one : - omegaPullbackCoeff W (mulByInt W.toAffine (-1)) = -1 := by - apply omegaPullbackCoeff_unique -@@ -342,13 +259,8 @@ theorem omegaPullbackCoeff_mulByInt_neg_one : - rw [h_pb_x, alpha_star_u_mulByInt_neg_one, inv_neg, neg_smul, neg_one_smul] - rfl - --/-- **omegaPullbackCoeff for `negFrobeniusIsog` = 0 (axiom-clean)**: --`negFrobeniusIsog = mulByInt(-1) ∘ frobeniusIsog`, so by the chain rule --`omegaPullbackCoeff_comp_of_base` (with the outer-base coefficient -1 ∈ K), --`omega-coeff(negFrob) = (-1) * omega-coeff(frobenius) = (-1) * 0 = 0`. -- --Avoids the Wronskian-tainted `omegaPullbackCoeff_mulByInt`; uses the --direct `omegaPullbackCoeff_mulByInt_neg_one` (Commit 35) instead. -/ -+/-- Negative Frobenius has invariant-differential coefficient zero, by the chain rule -+for negation composed with Frobenius. -/ - theorem omegaPullbackCoeff_negFrobeniusIsog : - omegaPullbackCoeff W (negFrobeniusIsog W) = 0 := by - simp only [negFrobeniusIsog] -@@ -358,13 +270,8 @@ theorem omegaPullbackCoeff_negFrobeniusIsog : - push_cast - rfl - --/-- **Witness #1 (witness-parametric on additivity ONLY, axiom-clean)**: --separability of `isogOneSub_negFrobenius W hq`, taking only the additivity --sum hypothesis. T-II-4-004 iff (Commit 31) + Witness #2 (Commit 30) absorbed. -- --When the additivity discharge lands (per-α BRIDGE-001 instances + --`omegaPullbackCoeff_add_of_leading_witness`, `FormalIsogenySeries.lean`), --this fires the unconditional Witness #1 of the bound. -/ -+/-- Differential additivity gives coefficient one and hence separability of `1 − π`. -+-/ - theorem isogOneSub_negFrobenius_isSeparable_of_h_add_only - (hq : 2 ≤ Fintype.card K) - (h_add : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = -@@ -374,13 +281,7 @@ theorem isogOneSub_negFrobenius_isSeparable_of_h_add_only - isogOneSub_negFrobenius_isSeparable_of_additivity_and_T2_4_004 W hq h_add - (isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero W hq) - --/-- **Witness #1 (taking ONLY `omegaPullbackCoeff = 1`, axiom-clean)**: --shorter consumer of the existing chain — takes only the omega-coefficient --identity (= 1), since T-II-4-004 iff (Commit 31) is now unconditional. -- --When the omega-coefficient computation lands axiom-clean (via either direct --algebraic computation or BRIDGE-001 + III.5.2), this fires the unconditional --Witness #1 of the bound. -/ -+/-- A differential coefficient equal to one implies separability of `1 − π`. -/ - theorem isogOneSub_negFrobenius_isSeparable_of_h_coeff_only - (hq : 2 ≤ Fintype.card K) - (h_coeff : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = 1) : -@@ -388,9 +289,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_h_coeff_only - isogOneSub_negFrobenius_isSeparable_of_witnesses W hq h_coeff - (isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero W hq) - --/-- **Witness #3 (FiniteDim absorbed)**: sepDegree = pointCount for --`isogOneSub_negFrobenius W hq`, taking only IsSeparable, the fiber witness, --and Finite kernel — Witness #2 is absorbed via Commit 30 (unconditional). -/ -+/-- Separability and a fiber-cardinality witness identify the separable degree of -+`1 − π` with the rational-point count. -/ - theorem isogOneSub_negFrobenius_sepDegree_eq_pointCount_of_sep_and_fiber - [Fintype W.toAffine.Point] - (hq : 2 ≤ Fintype.card K) -@@ -423,14 +323,8 @@ theorem isogOneSub_negFrobenius_fiber_witness_of_sepDegree_eq_pointCount - (AddMonoidHom.id _) - (frobeniusIsog W).toAddMonoidHom) - h_sepDeg - --/-- **Witness #1 via leading-coefficient bridge witness (axiom-clean)**: --takes BRIDGE-001 for the three isogenies + leading-coefficient additivity --of formal series, then chains via Commit 46 to derive omega-coeff(γ) = 1 --unconditional, which closes Witness #1 via Commit 38. -- --When the leading-coefficient additivity (`h_leading_add`) and BRIDGE-001 for --negFrobeniusIsog and isogOneSub_negFrobenius are discharged, this becomes --the unconditional Witness #1 of the bound. -/ -+/-- Leading-coefficient additivity and its equality with the differential coefficients -+for negative Frobenius and `1 − π` imply separability of `1 − π`. -/ - theorem isogOneSub_negFrobenius_isSeparable_via_leading_witnesses - (hq : 2 ≤ Fintype.card K) - (h_bridge_negFrob : omegaPullbackCoeff W (negFrobeniusIsog W) = -diff --git a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/SilvermanIV14.lean b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/SilvermanIV14.lean -index fa13c9ee6..d6729de59 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/SilvermanIV14.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/SilvermanIV14.lean -@@ -8,50 +8,20 @@ import HasseWeil.Foundation.BridgeFrobenius - import HasseWeil.Foundation.HahnSeriesAux - - /-! --# Silverman IV.1.4 scaffold for the leading-coefficient bridge -+# Local expansions and differential pullback for `1 − π` - --Substantive computation toward closing BRIDGE-001 / BRIDGE-003 for the --specific case `γ = isogOneSub_negFrobenius`. The deliverable target is --the leading-coefficient identity: -+For the addition isogeny `γ = 1 − π`, the x- and y-coordinate pullbacks have orders -+`-2` and `-3` at infinity. Thus the pullback of the parameter `t = -x/y` has order one. -+Laurent-series leading coefficients relate its linear formal-series coefficient to -+the leading coefficient of the y-coordinate. Negative Frobenius has zero linear -+coefficient, because its parameter pullback has order `q ≥ 2`. - --``` --PowerSeries.coeff 1 (formalIsogenySeries W (isogOneSub_negFrobenius W hq)) = 1 --``` -- --which equivalently says: -- --``` --(localExpand W (addPullbackAlgHom_negFrobenius W hq (localParam W))).coeff (1 : ℤ) = 1 --``` -- --where `localParam W = -x_gen / y_gen` is the local parameter at the point at --infinity `O`. -- --## Decomposition -- --The substantive piece breaks into: -- --1. **Order computation** — `ord (γ.pullback localParam) = 1` at infinity. -- Direct from `ord (addPullback_x) = -2` (`ord_addPullback_x_negFrobenius`, -- existing) and `ord (addPullback_y) = -3` (analog, this file). --2. **Leading-coefficient computation** — extract the coefficient of `t¹` in -- the Laurent expansion. The key formula (at the formal-group leading order): -- `coeff 1 (formal γ) = 1 - (coeff q (formal id) * coeff 1 (formal frobeniusIsog))`. -- Specializes via `formalIsogenySeries_id = X` (coeff 1 = 1) and -- `formalIsogenySeries_frobenius = X^q` (coeff 1 = 0 for q ≥ 2), -- giving `coeff 1 = 1 + 0 = 1`. -- --## Sub-helpers shipped here -- --* `ord_addPullback_y_negFrobenius` — `ord (addPullback_y W (negFrobeniusIsog W)) = -3`. --* `ord_localParam_pullback_negFrobenius` — `ord (γ.pullback localParam) = 1`. --* `formalIsogenySeries_isogOneSub_negFrobenius_constantCoeff` — the -- `constantCoeff = 0` fact (genuine isogeny). -- --## References -+Kähler differentiation of the curve and addition-slope equations proves that the -+invariant-differential coefficient of `γ` is one, and hence that `γ` is separable. -+The general addition formulas retain the hypotheses relating coordinate pullbacks, -+point maps, and formal series. - --* Silverman, *The Arithmetic of Elliptic Curves*, IV.1.4 (formal group law -- agreement with the addition formula's local expansion). -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.1.4 and III.5.2. - -/ - - open WeierstrassCurve PowerSeries LaurentSeries -@@ -63,21 +33,8 @@ variable (W : WeierstrassCurve K) [W.toAffine.IsElliptic] - - local notation "KE" => W.toAffine.FunctionField - --/-- **Order of `-addPullback_x / addPullback_y = 1` at infinity (axiom-clean, --witness-parametric)**: given `ord (addPullback_x) = -2` and `ord (addPullback_y) --= -3`, the local-parameter form `-addPullback_x / addPullback_y` (which equals --`γ.pullback (localParam W)` once the addition-pullback γ is realized as a ring --hom) has order `1` at infinity. -- --Substantive content of Silverman IV.1.4's leading-order claim: since --`γ.pullback (localParam) = γ.pullback (-x_gen / y_gen) = -γ.pullback(x_gen) / --γ.pullback(y_gen) = -addPullback_x / addPullback_y` for any ring-hom realization --of γ, the order-1 fact reduces to the purely arithmetic --`ord(-a / b) = ord(a) - ord(b) = -2 - (-3) = 1`. -- --Witness-parametric: plugs the existing axiom-clean --`ord_addPullback_x_negFrobenius` and the (currently sorry-bearing) --`ord_addPullback_y_negFrobenius` into a closed-form ord computation. -/ -+/-- Coordinate orders `-2` and `-3` imply that `-addPullback_x / addPullback_y` has -+order one at infinity, by `ord(-a/b) = ord(a) - ord(b)`. -/ - theorem ord_neg_addPullback_x_div_y_negFrobenius - (h_x : (W_smooth W).ordAtInfty (addPullback_x W (negFrobeniusIsog W)) = - ((-2 : ℤ) : WithTop ℤ)) -@@ -99,15 +56,8 @@ theorem ord_neg_addPullback_x_div_y_negFrobenius - ((W_smooth W).ordAtInfty_neg _).trans h_x - exact ((W_smooth W).ord_div_concrete h_y_ne (-2) (-3) h_neg_x h_y).trans rfl - --/-- **IV.1.4 step 1 unconditional**: `ord(-addPullback_x / addPullback_y) = 1` --at infinity for the negFrobenius case (q ≥ 2, any characteristic). Combines --the witness-parametric `ord_neg_addPullback_x_div_y_negFrobenius` with the --two axiom-clean witnesses `ord_addPullback_x_negFrobenius` and the new --`ord_addPullback_y_negFrobenius`. -- --This is the substantive ord-1 conclusion of Silverman IV.1.4 step 1. The --ord-1 fact for `γ.pullback (localParam W)` follows once the addition-pullback --ring hom γ is realized via `addPullbackAlgHom_negFrobenius W hq`. -/ -+/-- The local parameter of `1 − π` has order one at infinity, in every characteristic. -+-/ - theorem ord_neg_addPullback_x_div_y_negFrobenius_unconditional - (hq : 2 ≤ Fintype.card K) : - (W_smooth W).ordAtInfty -@@ -119,7 +69,7 @@ theorem ord_neg_addPullback_x_div_y_negFrobenius_unconditional - (ord_addPullback_y_negFrobenius W hq) - - /-- **`(negFrob).pullback localParam = ((mulByInt(-1)).pullback localParam)^q`** --(axiom-clean). Direct from `negFrob = mulByInt(-1) ∘ frobenius` and -+. Direct from `negFrob = mulByInt(-1) ∘ frobenius` and - `frobenius.pullback = (·)^q`. -/ - theorem negFrobeniusIsog_pullback_localParam_eq_pow : - (negFrobeniusIsog W).pullback (localParam W) = -@@ -127,7 +77,8 @@ theorem negFrobeniusIsog_pullback_localParam_eq_pow : - simp only [negFrobeniusIsog] - rw [Isogeny.comp_algebraMap_eq, frobeniusIsog_pullback_apply] - --/-- **Closed form for `(mulByInt(-1)).pullback localParam`** (axiom-clean). -+omit [Fintype K] in -+/-- **Closed form for `(mulByInt(-1)).pullback localParam`** . - The σ-action on the local parameter `t = -x/y` evaluates to - `x_gen / (y_gen + a₁·x_gen + a₃)`. From `mulByInt_pullback_x_neg_one` - (σ fixes `x_gen`) and `mulByInt_pullback_y_neg_one` (σ sends `y_gen` to -@@ -146,10 +97,10 @@ theorem mulByInt_neg_one_pullback_localParam : - rw [neg_div_neg_eq] - - /-- **`ord((negFrobeniusIsog W).pullback (localParam W)) = q`** at infinity --(axiom-clean). Direct from the chain rule on `localParam = -x_gen/y_gen`: -+. Direct from the chain rule on `localParam = -x_gen/y_gen`: - `(negFrob).pullback localParam = -(negFrob).pullback x_gen / (negFrob).pullback y_gen`, - combined with `ord((negFrob).pb x_gen) = -2q` and `ord((negFrob).pb y_gen) = -3q` --(both existing axiom-clean), gives `ord = -2q - (-3q) = q`. -+, gives `ord = -2q - (-3q) = q`. - - This computes the order of the local-parameter image under `−π` directly (i.e., - without going through the addition-pullback γ). For q ≥ 2 this gives ord ≥ 2, -@@ -185,22 +136,22 @@ theorem ord_negFrobeniusIsog_pullback_localParam (hq : 2 ≤ Fintype.card K) : - ring - - omit [Fintype K] in --/-- **`constantCoeff (formal id) = 0` (axiom-clean, scaffold extraction)**: -+/-- **`constantCoeff (formal id) = 0` **: - direct from `formalIsogenySeries_id = X`. -/ - @[simp] theorem constantCoeff_formalIsogenySeries_id : - PowerSeries.constantCoeff (formalIsogenySeries W (Isogeny.id W.toAffine)) = 0 := by - rw [formalIsogenySeries_id, PowerSeries.constantCoeff_X] - --/-- **`constantCoeff (formal frobenius) = 0` (axiom-clean, scaffold extraction)**: -+/-- **`constantCoeff (formal frobenius) = 0` **: - direct from `formalIsogenySeries_frobenius = X^q` for `q ≥ 1`. -/ - @[simp] theorem constantCoeff_formalIsogenySeries_frobenius - (h : 1 ≤ Fintype.card K) : - PowerSeries.constantCoeff (formalIsogenySeries W (frobeniusIsog W)) = 0 := by - rw [formalIsogenySeries_frobenius, ← PowerSeries.coeff_zero_eq_constantCoeff_apply, - PowerSeries.coeff_X_pow] -- exact if_neg (by omega) -+ exact ite_eq_right (by omega) - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **Orderbound for denominator's lower terms**: the orderTop of - `HahnSeries.C a₁ * formalX + HahnSeries.C a₃` is ≥ -2 in `LaurentSeries K` - (since each term has orderTop ≥ -2). -/ -@@ -225,7 +176,7 @@ private theorem orderTop_a₁_formalX_plus_a₃_ge_neg_two : - · rw [HahnSeries.C_apply, HahnSeries.orderTop_single ha₃] - exact_mod_cast (by norm_num : (-2 : ℤ) ≤ 0) - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **orderTop of the localExpand of the denominator = -3**: in - `LaurentSeries K`, `formalY + C a₁ * formalX + C a₃` has orderTop = -3, - since `formalY` (orderTop = -3) strictly dominates the other terms -@@ -244,8 +195,9 @@ theorem orderTop_localExpand_y_gen_plus_a₁_x_gen_plus_a₃ : - refine lt_of_lt_of_le ?_ (orderTop_a₁_formalX_plus_a₃_ge_neg_two W) - exact_mod_cast (by norm_num : (-3 : ℤ) < -2) - -+omit [Fintype K] in - /-- **orderTop of `localExpand((mulByInt(-1)).pullback (localParam W)) = 1`** --(axiom-clean). The σ-image of the local parameter has orderTop = 1 in -+. The σ-image of the local parameter has orderTop = 1 in - `LaurentSeries K`: from the closed form `σ(t) = formalX / denom` (with - `denom = formalY + C(a₁)·formalX + C(a₃)` in LaurentSeries K), and: - * `orderTop formalX = -2` -@@ -320,14 +272,8 @@ theorem coeff_one_formalIsogenySeries_negFrobeniusIsog_of_orderTop_witness - exact_mod_cast (by linarith : (1 : ℤ) < (Fintype.card K : ℤ)) - exact HahnSeries.coeff_eq_zero_of_lt_orderTop h_lt - --/-- **`constantCoeff (formal negFrob) = 0` (axiom-clean, unconditional)** for q ≥ 1. -- --Same orderTop argument as `coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero`, --but for `coeff 0` (= constantCoeff). Holds for any q ≥ 1 (since orderTop ≥ q ≥ 1 > 0). -- --This discharges the `h_β_const` hypothesis of --`formalIsogenySeries_add_coeff_one_via_FGL` (`FormalIsogenySeries.lean`) --for β = negFrobeniusIsog. -/ -+/-- The formal series of negative Frobenius has zero constant coefficient: its order -+is at least `q ≥ 1`. -/ - @[simp] theorem constantCoeff_formalIsogenySeries_negFrobeniusIsog - (hq : 1 ≤ Fintype.card K) : - PowerSeries.constantCoeff (formalIsogenySeries W (negFrobeniusIsog W)) = 0 := by -@@ -349,35 +295,16 @@ for β = negFrobeniusIsog. -/ - exact_mod_cast (by linarith : (0 : ℤ) < (Fintype.card K : ℤ)) - exact HahnSeries.coeff_eq_zero_of_lt_orderTop h_lt - --/-- **`coeff 1 (formal negFrob) = 0` (axiom-clean, unconditional)** for q ≥ 2. -- --Discharges the orderTop witness in --`coeff_one_formalIsogenySeries_negFrobeniusIsog_of_orderTop_witness` using --the axiom-clean `orderTop_localExpand_mulByInt_neg_one_pullback_localParam = 1`. -- --This is the cascade collapse: with this `coeff 1 (formal negFrob) = 0` --in hand, the `h_negfrob` hypothesis of --`coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_witnesses` --(helper 4 from previous batch) discharges, leaving only the BRIDGE-003 --leading-coefficient additivity to close IV.1.4 step 2 unconditionally. -/ -+/-- Negative Frobenius has zero linear formal-series coefficient, since its parameter -+pullback has order `q ≥ 2`. -/ - theorem coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero - (hq : 2 ≤ Fintype.card K) : - PowerSeries.coeff 1 (formalIsogenySeries W (negFrobeniusIsog W)) = 0 := - coeff_one_formalIsogenySeries_negFrobeniusIsog_of_orderTop_witness W hq - (orderTop_localExpand_mulByInt_neg_one_pullback_localParam W).symm.le - --/-- **BRIDGE-001 for `negFrobeniusIsog` (axiom-clean, UNCONDITIONAL)** for q ≥ 2. -- --Both sides equal 0: --* LHS: `omegaPullbackCoeff(negFrob) = 0` (axiom-clean, Differential.lean) --* RHS: `algebraMap (coeff 1 (formal negFrob)) = algebraMap 0 = 0` (axiom-clean, -- prior commit `coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero`). -- --This BRIDGE-001 instance is one of the three needed by the additivity bridge --`omegaPullbackCoeff_add_of_leading_witness` for the --`γ = id + (-π)` case. Combined with `omegaPullbackCoeff_eq_formalIsogenyLeading_id` --(axiom-clean, FormalIsogenySeries.lean), the only remaining BRIDGE-001 is for --`γ = isogOneSub_negFrobenius` itself. -/ -+/-- For negative Frobenius, the differential coefficient equals the image of the linear -+formal-series coefficient: both are zero. -/ - theorem omegaPullbackCoeff_eq_formalIsogenyLeading_negFrobeniusIsog - (hq : 2 ≤ Fintype.card K) : - omegaPullbackCoeff W (negFrobeniusIsog W) = -@@ -386,21 +313,8 @@ theorem omegaPullbackCoeff_eq_formalIsogenyLeading_negFrobeniusIsog - rw [coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero W hq, map_zero] - exact omegaPullbackCoeff_negFrobeniusIsog W - --/-- **Leading-coefficient closure for `isogOneSub_negFrobenius` (axiom-clean, --witness-parametric)**: from --* the additivity decomposition `h_add : coeff 1 (formal (id + (-π))) = -- coeff 1 (formal id) + coeff 1 (formal (-π))` (Silverman IV.1.4 / formal -- group law leading-order additivity), and --* `h_negfrob : coeff 1 (formal (-π)) = 0` (Silverman III.5.5 inseparability -- on `−π = mulByInt(-1) ∘ π`), --combine with the existing axiom-clean `coeff_one_formalIsogenySeries_id = 1` --to conclude `coeff 1 (formal (id + (-π))) = 1`. -- --This is Silverman IV.1.4's substantive arithmetic content for the --`isogOneSub_negFrobenius` case, factored as a witness consumer that --plumbs the (still-missing) BRIDGE-003 leading-order additivity and the --(also missing but Frobenius-flavored) `(-π)` linear-coeff vanishing into --the closed-form `1 + 0 = 1`. -/ -+/-- Linear-coefficient additivity and vanishing for negative Frobenius give linear -+coefficient one for `1 − π`. -/ - theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_witnesses - (hq : 2 ≤ Fintype.card K) - (h_add : PowerSeries.coeff 1 -@@ -413,17 +327,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_witnesses - (formalIsogenySeries W (isogOneSub_negFrobenius W hq)) = 1 := by - rw [h_add, coeff_one_formalIsogenySeries_id, h_negfrob, add_zero] - --/-- **IV.1.4 step 2: closer (axiom-clean, witness-parametric on h_add ONLY)**. -- --With `coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero` (axiom-clean --unconditional from the localExpand → orderTop bridge), `h_negfrob` is --discharged automatically. The remaining hypothesis `h_add` is the --BRIDGE-003 leading-coefficient additivity for the specific --`id + (-π)` decomposition. -- --Once BRIDGE-003 is closed for this case, `coeff 1 (formal γ) = 1` ships --unconditionally and feeds directly into the omega-pullback Witness #1 --chain (commits 45-48). -/ -+/-- Linear-coefficient additivity implies that the formal series of `1 − π` has linear -+coefficient one. -/ - theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_h_add - (hq : 2 ≤ Fintype.card K) - (h_add : PowerSeries.coeff 1 -@@ -435,15 +340,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_h_add - coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_witnesses W hq h_add - (coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero W hq) - --/-- **`coeff 1 (formal isogOneSub_negFrobenius) = 1` (axiom-clean, --witness-parametric on BRIDGE-003 for our case)**: given the BRIDGE-003 --identity `formal γ = subst F (formal id, formal negFrob)` for our case, --applies `coeff_one_subst_bivariate` (axiom-clean from FormalIsogenySeries.lean) --+ the formal group law's leading coefficients + the axiom-clean constantCoeff --witnesses to conclude. -- --Closes IV.1.4 step 2 unconditionally up to one named witness: BRIDGE-003 for --`id + (-π)`. -/ -+/-- If the formal series of `1 − π` is obtained by substituting those of the identity -+and negative Frobenius into the formal group law, its linear coefficient is one. -/ - theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_via_bridge_003 - (hq : 2 ≤ Fintype.card K) - (h_bridge_003 : -@@ -467,21 +365,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_via_bridge_003 - rw [coeff_one_formalIsogenySeries_id W, - coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero W hq, add_zero] - --/-- **Witness #1 omega-coefficient closer (axiom-clean, witness-parametric on --BRIDGE-001 for γ + leading-additivity)**: takes BRIDGE-001 for the addition --isogeny γ = `isogOneSub_negFrobenius` and the leading-coefficient additivity --for `id + (-π)`, and produces `omegaPullbackCoeff(γ) = 1`. -- --Composes: --* `omegaPullbackCoeff_add_of_leading_witness` (axiom-clean, FormalIsogenySeries.lean) --* `omegaPullbackCoeff_eq_formalIsogenyLeading_id` (axiom-clean) --* `omegaPullbackCoeff_eq_formalIsogenyLeading_negFrobeniusIsog` (axiom-clean, -- this file) --* `omegaPullbackCoeff_id`, `omegaPullbackCoeff_negFrobeniusIsog` -- (axiom-clean, prior commits) -- --Result: `omegaPullbackCoeff(γ) = omegaPullbackCoeff(id) + omegaPullbackCoeff(negFrob) --= 1 + 0 = 1`. -/ -+/-- Equality of the differential and linear formal-series coefficients for `1 − π`, -+together with linear-coefficient additivity, gives differential coefficient one. -/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading - (hq : 2 ≤ Fintype.card K) - (h_bridge_γ : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = -@@ -500,12 +385,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading - rw [h_omega_add, omegaPullbackCoeff_id W, omegaPullbackCoeff_negFrobeniusIsog W, - add_zero] - --/-- **Witness #1 (witness-parametric on BRIDGE-001 for γ + leading-additivity, --axiom-clean)**: separability of `isogOneSub_negFrobenius W hq`, taking only --the BRIDGE-001 for γ + leading-coefficient additivity. T-II-4-004 absorbed. -- --Once BRIDGE-001 for γ + the leading-additivity (= BRIDGE-003 specialization) --land, this fires the unconditional Witness #1 of the Hasse-Weil bound. -/ -+/-- The differential/formal-series coefficient identity and linear-coefficient -+additivity imply separability of `1 − π`. -/ - theorem isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading - (hq : 2 ≤ Fintype.card K) - (h_bridge_γ : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = -@@ -520,17 +401,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading - (omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading W hq - h_bridge_γ h_leading_add) - --/-- **Witness #1 closer (axiom-clean) taking BRIDGE-001 for γ + BRIDGE-003 --for our case**: with both substantive witnesses in hand, produces --`(isogOneSub_negFrobenius W hq).IsSeparable`. -- --Chain: --1. BRIDGE-003 for our case → `coeff 1 (formal γ) = 1` -- (via `coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_via_bridge_003`). --2. Leading-additivity follows trivially: `1 = 1 + 0`. --3. BRIDGE-001 for γ + leading-additivity → `omegaPullbackCoeff(γ) = 1` -- (via the existing `isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading`). --4. T-II-4-004 (axiom-clean) → IsSeparable. -/ -+/-- A formal group law substitution identity and equality of the differential and -+linear formal-series coefficients imply separability of `1 − π`. -/ - theorem isogOneSub_negFrobenius_isSeparable_of_bridge_001_γ_and_bridge_003 - (hq : 2 ≤ Fintype.card K) - (h_bridge_001_γ : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = -@@ -557,12 +429,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_bridge_001_γ_and_bridge_003 - exact isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading W hq - h_bridge_001_γ h_leading_add - --/-- **omegaPullbackCoeff(γ) = 1 axiom-clean given BRIDGE-001 for γ + BRIDGE-003 for our case**. --Direct consequence: derives `coeff 1 (formal γ) = 1` from BRIDGE-003 via the --just-shipped via_bridge_003 closer, then leading-additivity follows trivially --(both sides = 1), then the existing --`omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading` --fires. -/ -+/-- Formal group law substitution and the differential/formal-series coefficient -+identity give differential coefficient one for `1 − π`. -/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_bridge_001_γ_and_bridge_003 - (hq : 2 ≤ Fintype.card K) - (h_bridge_001_γ : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = -@@ -589,14 +457,15 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_bridge_001_γ_and_ - exact omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading W hq - h_bridge_001_γ h_leading_add - --/-- **Sub-helper 1**: `localExpand(x_gen - π·x_gen) = formalX - formalX^q` --(axiom-clean). Direct from `localExpand` ring hom + `frobeniusIsog_pullback_apply`. -/ -+/-- `localExpand(x_gen - π·x_gen) = formalX - formalX^q` -+. Direct from `localExpand` ring hom + `frobeniusIsog_pullback_apply`. -/ - theorem localExpand_x_gen_sub_frobenius_pullback_x_gen : - localExpand W (x_gen W - (frobeniusIsog W).pullback (x_gen W)) = - formalX W - (formalX W) ^ Fintype.card K := by - rw [frobeniusIsog_pullback_apply, map_sub, map_pow, localExpand_x_gen] - --/-- **Sub-helper 2**: `(formalX - formalX^q).orderTop = -2q` for q ≥ 2. -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX - formalX^q).orderTop = -2q` for q ≥ 2. - For q ≥ 2, `formalX^q` strictly dominates `formalX` (orderTop -2q < -2), - so by `orderTop_add_eq_right`, the sum's orderTop = orderTop(-formalX^q) = -2q. -/ - theorem orderTop_formalX_sub_formalX_pow (hq : 2 ≤ Fintype.card K) : -@@ -620,14 +489,15 @@ theorem orderTop_formalX_sub_formalX_pow (hq : 2 ≤ Fintype.card K) : - nlinarith - rw [HahnSeries.orderTop_add_eq_right h_lt, hX_neg_pow_orderTop] - --/-- **Sub-helper 3**: `localExpand((x_gen - π·x_gen)²) = (formalX - formalX^q)²`. -+/-- `localExpand((x_gen - π·x_gen)²) = (formalX - formalX^q)²`. - Direct from `localExpand` ring hom + `localExpand_x_gen_sub_frobenius_pullback_x_gen`. -/ - theorem localExpand_x_gen_sub_frob_pullback_x_gen_sq : - localExpand W ((x_gen W - (frobeniusIsog W).pullback (x_gen W)) ^ 2) = - (formalX W - (formalX W) ^ Fintype.card K) ^ 2 := by - rw [map_pow, localExpand_x_gen_sub_frobenius_pullback_x_gen] - --/-- **Sub-helper 4**: `((formalX - formalX^q)²).orderTop = -4q` for q ≥ 2. -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `((formalX - formalX^q)²).orderTop = -4q` for q ≥ 2. - By `orderTop_mul` + `orderTop_formalX_sub_formalX_pow`. -/ - theorem orderTop_formalX_sub_formalX_pow_sq (hq : 2 ≤ Fintype.card K) : - ((formalX W - (formalX W) ^ Fintype.card K) ^ 2 : LaurentSeries K).orderTop = -@@ -641,7 +511,7 @@ theorem orderTop_formalX_sub_formalX_pow_sq (hq : 2 ≤ Fintype.card K) : - congr 1 - ring - --/-- **Sub-helper 5**: `localExpand(x_gen · (π·x_gen)²) = formalX^(2q+1)`. -+/-- `localExpand(x_gen · (π·x_gen)²) = formalX^(2q+1)`. - The dominant term of `addPullbackNumerator_reduced_negFrobenius` at infinity. -/ - theorem localExpand_x_gen_mul_frob_pullback_x_gen_sq : - localExpand W (x_gen W * (frobeniusIsog W).pullback (x_gen W) ^ 2) = -@@ -649,7 +519,8 @@ theorem localExpand_x_gen_mul_frob_pullback_x_gen_sq : - rw [frobeniusIsog_pullback_apply, ← pow_mul, map_mul, map_pow, localExpand_x_gen] - ring - --/-- **Sub-helper 6**: `(formalX^(2q+1)).orderTop = -4q - 2` for q ≥ 1. -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX^(2q+1)).orderTop = -4q - 2` for q ≥ 1. - Direct from `formalX_pow_orderTop`. -/ - theorem orderTop_formalX_pow_two_q_plus_one : - ((formalX W) ^ (2 * Fintype.card K + 1) : LaurentSeries K).orderTop = -@@ -659,13 +530,14 @@ theorem orderTop_formalX_pow_two_q_plus_one : - push_cast - ring - --/-- **Sub-helper 7**: `(formalX^(2q+1)).leadingCoeff = 1`. -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX^(2q+1)).leadingCoeff = 1`. - Direct from `formalX_pow_leadingCoeff`. -/ - theorem leadingCoeff_formalX_pow_two_q_plus_one : - ((formalX W) ^ (2 * Fintype.card K + 1) : LaurentSeries K).leadingCoeff = 1 := - formalX_pow_leadingCoeff W (2 * Fintype.card K + 1) - --/-- **Sub-helper 8**: `(localExpand(x_gen · (π·x_gen)²)).orderTop = -2 - 4q`. Composes -+/-- `(localExpand(x_gen · (π·x_gen)²)).orderTop = -2 - 4q`. Composes - the dominant-term identification with the orderTop computation. -/ - theorem orderTop_localExpand_x_gen_mul_frob_pullback_x_gen_sq : - (localExpand W (x_gen W * (frobeniusIsog W).pullback (x_gen W) ^ 2)).orderTop = -@@ -673,7 +545,7 @@ theorem orderTop_localExpand_x_gen_mul_frob_pullback_x_gen_sq : - rw [localExpand_x_gen_mul_frob_pullback_x_gen_sq W] - exact orderTop_formalX_pow_two_q_plus_one W - --/-- **Sub-helper 9**: `(localExpand(x_gen · (π·x_gen)²)).leadingCoeff = 1`. The -+/-- `(localExpand(x_gen · (π·x_gen)²)).leadingCoeff = 1`. The - leading coefficient at infinity of the dominant term is 1 (rather than 0 or - some other value), which feeds into the leading-coefficient analysis for - `addPullback_x` and ultimately `coeff 1 (formal γ) = 1`. -/ -@@ -682,8 +554,8 @@ theorem leadingCoeff_localExpand_x_gen_mul_frob_pullback_x_gen_sq : - rw [localExpand_x_gen_mul_frob_pullback_x_gen_sq W] - exact leadingCoeff_formalX_pow_two_q_plus_one W - --omit [Fintype K] in --/-- **Sub-helper 10**: `(formalY^n).orderTop = -3 * n`. -+omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalY^n).orderTop = -3 * n`. - Mirror of `formalX_pow_orderTop`. -/ - theorem formalY_pow_orderTop (n : ℕ) : - ((formalY W) ^ n : LaurentSeries K).orderTop = -@@ -704,14 +576,15 @@ theorem formalY_pow_orderTop (n : ℕ) : - push_cast - ring - --/-- **Sub-helper 11**: `localExpand(y_gen · π·y_gen) = formalY · formalY^q`. -+/-- `localExpand(y_gen · π·y_gen) = formalY · formalY^q`. - Direct from `localExpand` ring hom + `frobeniusIsog_pullback_apply`. -/ - theorem localExpand_y_gen_mul_frob_pullback_y_gen : - localExpand W (y_gen W * (frobeniusIsog W).pullback (y_gen W)) = - formalY W * (formalY W) ^ Fintype.card K := by - rw [frobeniusIsog_pullback_apply, map_mul, map_pow, localExpand_y_gen] - --/-- **Sub-helper 12**: `(formalY · formalY^q).orderTop = -3 - 3q` for q ≥ 1. -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalY · formalY^q).orderTop = -3 - 3q` for q ≥ 1. - Direct from `orderTop_mul` + `formalY_orderTop` + `formalY_pow_orderTop`. -/ - theorem orderTop_formalY_mul_formalY_pow : - (formalY W * (formalY W) ^ Fintype.card K : LaurentSeries K).orderTop = -@@ -719,7 +592,7 @@ theorem orderTop_formalY_mul_formalY_pow : - rw [HahnSeries.orderTop_mul, formalY_orderTop, formalY_pow_orderTop, ← WithTop.coe_add, - show ((-3 : ℤ) + -3 * (Fintype.card K : ℤ)) = -3 - 3 * (Fintype.card K : ℤ) from by ring] - --/-- **Sub-helper 13**: `localExpand(x_gen² · π·x_gen) = formalX^(q+2)`. -+/-- `localExpand(x_gen² · π·x_gen) = formalX^(q+2)`. - The "term 6" of `addPullbackNumerator_reduced_negFrobenius`: `x² · π·x` with - orderTop -4 - 2q (sub-dominant). -/ - theorem localExpand_x_gen_sq_mul_frob_pullback_x_gen : -@@ -729,7 +602,8 @@ theorem localExpand_x_gen_sq_mul_frob_pullback_x_gen : - congr 1 - ring - --/-- **Sub-helper 14**: `(formalX^(q+2)).orderTop = -4 - 2q`. -/ -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX^(q+2)).orderTop = -4 - 2q`. -/ - theorem orderTop_formalX_pow_q_plus_two : - ((formalX W) ^ (Fintype.card K + 2) : LaurentSeries K).orderTop = - (((-4 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by -@@ -738,7 +612,7 @@ theorem orderTop_formalX_pow_q_plus_two : - push_cast - ring - --/-- **Sub-helper 15**: `localExpand(x_gen · π·x_gen) = formalX^(q+1)`. -+/-- `localExpand(x_gen · π·x_gen) = formalX^(q+1)`. - The "x · π·x" component (used in term 8 of `addPullbackNumerator_reduced`). -/ - theorem localExpand_x_gen_mul_frob_pullback_x_gen : - localExpand W (x_gen W * (frobeniusIsog W).pullback (x_gen W)) = -@@ -746,7 +620,8 @@ theorem localExpand_x_gen_mul_frob_pullback_x_gen : - rw [frobeniusIsog_pullback_apply, map_mul, map_pow, localExpand_x_gen, - show Fintype.card K + 1 = 1 + Fintype.card K from by ring, pow_add, pow_one] - --/-- **Sub-helper 16**: `(formalX^(q+1)).orderTop = -2 - 2q`. -/ -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX^(q+1)).orderTop = -2 - 2q`. -/ - theorem orderTop_formalX_pow_q_plus_one : - ((formalX W) ^ (Fintype.card K + 1) : LaurentSeries K).orderTop = - (((-2 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by -@@ -755,14 +630,15 @@ theorem orderTop_formalX_pow_q_plus_one : - push_cast - ring - --/-- **Sub-helper 17**: `localExpand(x_gen + π·x_gen) = formalX + formalX^q`. -+/-- `localExpand(x_gen + π·x_gen) = formalX + formalX^q`. - Term 1's "x + π·x" component (used in `a₄ · (x + π·x)`). -/ - theorem localExpand_x_gen_add_frob_pullback_x_gen : - localExpand W (x_gen W + (frobeniusIsog W).pullback (x_gen W)) = - formalX W + (formalX W) ^ Fintype.card K := by - rw [frobeniusIsog_pullback_apply, map_add, map_pow, localExpand_x_gen] - --/-- **Sub-helper 18**: `(formalX + formalX^q).orderTop ≥ -2q` for q ≥ 1. -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX + formalX^q).orderTop ≥ -2q` for q ≥ 1. - Via `min_orderTop_le_orderTop_add` + `formalX_orderTop` + `formalX_pow_orderTop`. -/ - theorem orderTop_formalX_add_formalX_pow_ge_neg_two_q (hq : 2 ≤ Fintype.card K) : - (((-2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -777,14 +653,15 @@ theorem orderTop_formalX_add_formalX_pow_ge_neg_two_q (hq : 2 ≤ Fintype.card K - · -- -2q ≤ orderTop formalX^q = -2q - rw [formalX_pow_orderTop] - --/-- **Sub-helper 19**: `localExpand(y_gen + π·y_gen) = formalY + formalY^q`. -+/-- `localExpand(y_gen + π·y_gen) = formalY + formalY^q`. - Term 3's "y + π·y" component (used in `a₃ · (y + π·y)`). -/ - theorem localExpand_y_gen_add_frob_pullback_y_gen : - localExpand W (y_gen W + (frobeniusIsog W).pullback (y_gen W)) = - formalY W + (formalY W) ^ Fintype.card K := by - rw [frobeniusIsog_pullback_apply, map_add, map_pow, localExpand_y_gen] - --/-- **Sub-helper 20**: `(formalY + formalY^q).orderTop ≥ -3q` for q ≥ 1. -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalY + formalY^q).orderTop ≥ -3q` for q ≥ 1. - Via `min_orderTop_le_orderTop_add` + `formalY_orderTop` + `formalY_pow_orderTop`. -/ - theorem orderTop_formalY_add_formalY_pow_ge_neg_three_q (hq : 2 ≤ Fintype.card K) : - (((-3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -797,13 +674,14 @@ theorem orderTop_formalY_add_formalY_pow_ge_neg_three_q (hq : 2 ≤ Fintype.card - nlinarith - · rw [formalY_pow_orderTop] - --/-- **Sub-helper 21**: `localExpand(x · π·y) = formalX · formalY^q`. -/ -+/-- `localExpand(x · π·y) = formalX · formalY^q`. -/ - theorem localExpand_x_gen_mul_frob_pullback_y_gen : - localExpand W (x_gen W * (frobeniusIsog W).pullback (y_gen W)) = - formalX W * (formalY W) ^ Fintype.card K := by - rw [frobeniusIsog_pullback_apply, map_mul, map_pow, localExpand_x_gen, localExpand_y_gen] - --/-- **Sub-helper 22**: `(formalX · formalY^q).orderTop = -2 - 3q`. -/ -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX · formalY^q).orderTop = -2 - 3q`. -/ - theorem orderTop_formalX_mul_formalY_pow : - (formalX W * (formalY W) ^ Fintype.card K : LaurentSeries K).orderTop = - (((-2 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by -@@ -811,13 +689,14 @@ theorem orderTop_formalX_mul_formalY_pow : - show ((-2 : ℤ) + (-3 : ℤ) * (Fintype.card K : ℤ)) = - -2 - 3 * (Fintype.card K : ℤ) from by ring] - --/-- **Sub-helper 23**: `localExpand(π·x · y) = formalX^q · formalY`. -/ -+/-- `localExpand(π·x · y) = formalX^q · formalY`. -/ - theorem localExpand_frob_pullback_x_gen_mul_y_gen : - localExpand W ((frobeniusIsog W).pullback (x_gen W) * y_gen W) = - (formalX W) ^ Fintype.card K * formalY W := by - rw [frobeniusIsog_pullback_apply, map_mul, map_pow, localExpand_x_gen, localExpand_y_gen] - --/-- **Sub-helper 24**: `(formalX^q · formalY).orderTop = -3 - 2q`. -/ -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX^q · formalY).orderTop = -3 - 2q`. -/ - theorem orderTop_formalX_pow_mul_formalY : - ((formalX W) ^ Fintype.card K * formalY W : LaurentSeries K).orderTop = - (((-3 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by -@@ -825,7 +704,8 @@ theorem orderTop_formalX_pow_mul_formalY : - show ((-2 : ℤ) * (Fintype.card K : ℤ) + (-3 : ℤ)) = - -3 - 2 * (Fintype.card K : ℤ) from by ring] - --/-- **Sub-helper 25**: `(formalX·formalY^q + formalX^q·formalY).orderTop ≥ -2 - 3q` -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX·formalY^q + formalX^q·formalY).orderTop ≥ -2 - 3q` - for q ≥ 2. Via `min_orderTop_le_orderTop_add`, since `-2-3q ≤ min(-2-3q, -3-2q)` for q ≥ 2. -/ - theorem orderTop_formalX_mul_formalY_pow_plus_formalX_pow_mul_formalY_ge - (hq : 2 ≤ Fintype.card K) : -@@ -841,7 +721,7 @@ theorem orderTop_formalX_mul_formalY_pow_plus_formalX_pow_mul_formalY_ge - nlinarith - - omit [Fintype K] in --/-- **Sub-helper 26**: `(HahnSeries.C c).orderTop ≥ 0` for any `c : K`. -+/-- `(HahnSeries.C c).orderTop ≥ 0` for any `c : K`. - Helper for term 2 (`2·a₆`) and similar constant-coefficient bounds. -/ - theorem orderTop_HahnSeries_C_ge_zero (c : K) : - (0 : WithTop ℤ) ≤ (HahnSeries.C c : LaurentSeries K).orderTop := by -@@ -851,8 +731,8 @@ theorem orderTop_HahnSeries_C_ge_zero (c : K) : - · rw [HahnSeries.C_apply, HahnSeries.orderTop_single hc] - rfl - --omit [Fintype K] in --/-- **Sub-helper 27**: `localExpand W (algebraMap K KE c) = HahnSeries.C c`. -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `localExpand W (algebraMap K KE c) = HahnSeries.C c`. - Direct from `localExpand_algebraMap` + `HahnSeries.ofPowerSeries_C`. The - constant-coefficient bridge: `algebraMap K KE` factors through `localExpand` - to give a constant Hahn series. -/ -@@ -861,8 +741,8 @@ theorem localExpand_algebraMap_eq_C (c : K) : - rw [localExpand_algebraMap] - exact HahnSeries.ofPowerSeries_C c - --omit [Fintype K] in --/-- **Sub-helper 28**: `(localExpand W (algebraMap K KE c * f)).orderTop ≥ -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(localExpand W (algebraMap K KE c * f)).orderTop ≥ - (localExpand W f).orderTop`. The constant factor `algebraMap K KE c` has - orderTop ≥ 0 in the local expansion (it's a constant Hahn series), so - multiplication by it does not decrease the orderTop. Bridge for terms 1, 3, 5 -@@ -877,8 +757,8 @@ theorem orderTop_localExpand_algebraMap_mul_ge (c : K) (f : KE) : - _ ≤ (HahnSeries.C c : LaurentSeries K).orderTop + (localExpand W f).orderTop := by - gcongr - --omit [Fintype K] in --/-- **Sub-helper 29**: `(localExpand W (2 * f)).orderTop ≥ (localExpand W f).orderTop`. -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(localExpand W (2 * f)).orderTop ≥ (localExpand W f).orderTop`. - Bridge for terms 4, 7 of `addPullbackNumerator_reduced_negFrobenius` (the `2·...` - terms). Uses `2 * f = f + f` to dodge characteristic-2 considerations. -/ - theorem orderTop_localExpand_two_mul_ge (f : KE) : -@@ -887,15 +767,14 @@ theorem orderTop_localExpand_two_mul_ge (f : KE) : - refine le_trans ?_ HahnSeries.min_orderTop_le_orderTop_add - exact le_min (le_refl _) (le_refl _) - --omit [Fintype K] in --/-- **Sub-helper 30**: `(localExpand W (-f)).orderTop = (localExpand W f).orderTop`. -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(localExpand W (-f)).orderTop = (localExpand W f).orderTop`. - Negation preserves orderTop. -/ - theorem orderTop_localExpand_neg (f : KE) : - (localExpand W (-f)).orderTop = (localExpand W f).orderTop := by - rw [map_neg, HahnSeries.orderTop_neg] - --/-- **Sub-helper 31**: --`localExpand((negFrob).pullback y_gen) = -formalY^q - C(a₁)·formalX^q - C(a₃)`. -+/-- `localExpand((negFrob).pullback y_gen) = -formalY^q - C(a₁)·formalX^q - C(a₃)`. - Direct from `negFrobeniusIsog_pullback_y_gen` + ring-hom facts. -/ - theorem localExpand_negFrobeniusIsog_pullback_y_gen : - localExpand W ((negFrobeniusIsog W).pullback (y_gen W)) = -@@ -907,7 +786,8 @@ theorem localExpand_negFrobeniusIsog_pullback_y_gen : - localExpand_y_gen, localExpand_x_gen, localExpand_algebraMap_eq_C, - localExpand_algebraMap_eq_C] - --/-- **Sub-helper 32**: `(C(a₁)·formalX^q + C(a₃)).orderTop ≥ -2q` for q ≥ 1. -/ -+omit [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(C(a₁)·formalX^q + C(a₃)).orderTop ≥ -2q` for q ≥ 1. -/ - theorem orderTop_C_a₁_mul_formalX_pow_plus_C_a₃_ge : - (((-2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ - (HahnSeries.C W.a₁ * (formalX W) ^ Fintype.card K + -@@ -929,7 +809,7 @@ theorem orderTop_C_a₁_mul_formalX_pow_plus_C_a₃_ge : - have : (Fintype.card K : ℤ) ≥ 0 := by positivity - nlinarith - --/-- **Sub-helper 33**: `(localExpand((negFrob).pullback y_gen)).orderTop = -3q` -+/-- `(localExpand((negFrob).pullback y_gen)).orderTop = -3q` - for q ≥ 2. The `formalY^q` term dominates strictly. -/ - theorem orderTop_localExpand_negFrobeniusIsog_pullback_y_gen - (hq : 2 ≤ Fintype.card K) : -@@ -962,8 +842,8 @@ theorem orderTop_localExpand_negFrobeniusIsog_pullback_y_gen - nlinarith - rw [HahnSeries.orderTop_add_eq_left h_lt, h_neg_y_pow] - --omit [Fintype K] in --/-- **Sub-helper 34**: `(C(a₃) · formalY).orderTop ≥ -3` for q ≥ 1. -/ -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(C(a₃) · formalY).orderTop ≥ -3` for q ≥ 1. -/ - theorem orderTop_C_a₃_mul_formalY_ge : - (((-3 : ℤ)) : WithTop ℤ) ≤ - (HahnSeries.C W.a₃ * formalY W : LaurentSeries K).orderTop := by -@@ -974,7 +854,8 @@ theorem orderTop_C_a₃_mul_formalY_ge : - · rw [HahnSeries.C_apply, HahnSeries.orderTop_single ha₃, - show ((0 : ℤ) : WithTop ℤ) = (0 : WithTop ℤ) from rfl, zero_add] - --/-- **Sub-helper 35**: `(C(a₁) · (formalY · formalX^q)).orderTop ≥ -2-3q` -+omit [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(C(a₁) · (formalY · formalX^q)).orderTop ≥ -2-3q` - for q ≥ 1. -/ - theorem orderTop_C_a₁_mul_formalY_mul_formalX_pow_ge (hq : 1 ≤ Fintype.card K) : - (((-2 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -995,7 +876,7 @@ theorem orderTop_C_a₁_mul_formalY_mul_formalX_pow_ge (hq : 1 ≤ Fintype.card - have h_q : (1 : ℤ) ≤ (Fintype.card K : ℤ) := by exact_mod_cast hq - omega - --/-- **Sub-helper 36**: `localExpand(y · negFrob.π·y) = -formalY · formalY^q - -+/-- `localExpand(y · negFrob.π·y) = -formalY · formalY^q - - C(a₁) · (formalY · formalX^q) - C(a₃) · formalY`. -/ - theorem localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen : - localExpand W (y_gen W * (negFrobeniusIsog W).pullback (y_gen W)) = -@@ -1005,11 +886,11 @@ theorem localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen : - rw [map_mul, localExpand_negFrobeniusIsog_pullback_y_gen, localExpand_y_gen] - ring - --/-- **Sub-helper 37**: `(localExpand(y · negFrob.π·y)).orderTop ≥ -3-3q` for q ≥ 2. -+/-- `(localExpand(y · negFrob.π·y)).orderTop ≥ -3-3q` for q ≥ 2. - Each of the three terms has orderTop ≥ -3-3q: --* `-formalY · formalY^q`: = -3-3q (sub-helper 12). --* `-C(a₁) · (formalY · formalX^q)`: ≥ -2-3q ≥ -3-3q (sub-helper 35). --* `-C(a₃) · formalY`: ≥ -3 ≥ -3-3q for q ≥ 0 (sub-helper 34). -/ -+* `-formalY · formalY^q`: = -3-3q. -+* `-C(a₁) · (formalY · formalX^q)`: ≥ -2-3q ≥ -3-3q. -+* `-C(a₃) · formalY`: ≥ -3 ≥ -3-3q for q ≥ 0. -/ - theorem orderTop_localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen_ge - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1041,7 +922,7 @@ theorem orderTop_localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen_ge - have h_q_nn : (0 : ℤ) ≤ (Fintype.card K : ℤ) := by positivity - linarith - --/-- **Sub-helper 38**: `(localExpand(y_gen + (negFrob).pullback y_gen)).orderTop = -3q` -+/-- `(localExpand(y_gen + (negFrob).pullback y_gen)).orderTop = -3q` - for q ≥ 2. The `(negFrob).pullback y_gen` part dominates strictly (orderTop -3q - < -3 for q ≥ 2). -/ - theorem orderTop_localExpand_y_gen_add_negFrobeniusIsog_pullback_y_gen -@@ -1063,7 +944,7 @@ theorem orderTop_localExpand_y_gen_add_negFrobeniusIsog_pullback_y_gen - nlinarith - rw [HahnSeries.orderTop_add_eq_right h_lt, h_negFrob_y] - --/-- **Sub-helper 39**: `(localExpand(a₃ · (y_gen + (negFrob).pullback y_gen))).orderTop ≥ -3q`. -/ -+/-- `(localExpand(a₃ · (y_gen + (negFrob).pullback y_gen))).orderTop ≥ -3q`. -/ - theorem orderTop_localExpand_a₃_mul_y_gen_add_negFrobeniusIsog_pullback_y_gen_ge - (hq : 2 ≤ Fintype.card K) : - (((-3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1072,7 +953,7 @@ theorem orderTop_localExpand_a₃_mul_y_gen_add_negFrobeniusIsog_pullback_y_gen_ - refine le_trans ?_ (orderTop_localExpand_algebraMap_mul_ge W W.a₃ _) - rw [orderTop_localExpand_y_gen_add_negFrobeniusIsog_pullback_y_gen W hq] - --/-- **Sub-helper 40**: `(localExpand(x_gen + (negFrob).pullback x_gen)).orderTop ≥ -2q` -+/-- `(localExpand(x_gen + (negFrob).pullback x_gen)).orderTop ≥ -2q` - for q ≥ 2. Uses the fact that `(negFrob).pullback x_gen = (frob).pullback x_gen`. -/ - theorem orderTop_localExpand_x_gen_add_negFrobeniusIsog_pullback_x_gen_ge - (hq : 2 ≤ Fintype.card K) : -@@ -1082,7 +963,7 @@ theorem orderTop_localExpand_x_gen_add_negFrobeniusIsog_pullback_x_gen_ge - rw [negFrobeniusIsog_pullback_x_gen, localExpand_x_gen_add_frob_pullback_x_gen] - exact orderTop_formalX_add_formalX_pow_ge_neg_two_q W hq - --/-- **Sub-helper 41**: `(localExpand(a₄ · (x_gen + (negFrob).pullback x_gen))).orderTop ≥ -2q`. -/ -+/-- `(localExpand(a₄ · (x_gen + (negFrob).pullback x_gen))).orderTop ≥ -2q`. -/ - theorem orderTop_localExpand_a₄_mul_x_gen_add_negFrobeniusIsog_pullback_x_gen_ge - (hq : 2 ≤ Fintype.card K) : - (((-2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1091,8 +972,8 @@ theorem orderTop_localExpand_a₄_mul_x_gen_add_negFrobeniusIsog_pullback_x_gen_ - refine le_trans ?_ (orderTop_localExpand_algebraMap_mul_ge W W.a₄ _) - exact orderTop_localExpand_x_gen_add_negFrobeniusIsog_pullback_x_gen_ge W hq - --omit [Fintype K] in --/-- **Sub-helper 42**: `(localExpand(2·a₆)).orderTop ≥ 0`. -/ -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(localExpand(2·a₆)).orderTop ≥ 0`. -/ - theorem orderTop_localExpand_two_mul_a₆_ge : - (0 : WithTop ℤ) ≤ - (localExpand W ((2 : W.toAffine.FunctionField) * -@@ -1101,7 +982,7 @@ theorem orderTop_localExpand_two_mul_a₆_ge : - rw [localExpand_algebraMap_eq_C] - exact orderTop_HahnSeries_C_ge_zero W.a₆ - --/-- **Sub-helper 43**: `(localExpand(2 · y_gen · (negFrob).π·y)).orderTop ≥ -3-3q`. -/ -+/-- `(localExpand(2 · y_gen · (negFrob).π·y)).orderTop ≥ -3-3q`. -/ - theorem orderTop_localExpand_two_mul_y_gen_mul_negFrob_π_y_ge - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1114,7 +995,7 @@ theorem orderTop_localExpand_two_mul_y_gen_mul_negFrob_π_y_ge - refine le_trans ?_ (orderTop_localExpand_two_mul_ge W _) - exact orderTop_localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen_ge W hq - --/-- **Sub-helper 44**: `(localExpand(x_gen² · (negFrob).π·x)).orderTop = -4 - 2q`. -/ -+/-- `(localExpand(x_gen² · (negFrob).π·x)).orderTop = -4 - 2q`. -/ - theorem orderTop_localExpand_x_gen_sq_mul_negFrobeniusIsog_pullback_x_gen : - (localExpand W (x_gen W ^ 2 * - (negFrobeniusIsog W).pullback (x_gen W))).orderTop = -@@ -1122,7 +1003,7 @@ theorem orderTop_localExpand_x_gen_sq_mul_negFrobeniusIsog_pullback_x_gen : - rw [negFrobeniusIsog_pullback_x_gen, localExpand_x_gen_sq_mul_frob_pullback_x_gen] - exact orderTop_formalX_pow_q_plus_two W - --/-- **Sub-helper 45**: `(localExpand(x_gen · ((negFrob).π·x)²)).orderTop = -2 - 4q`. -+/-- `(localExpand(x_gen · ((negFrob).π·x)²)).orderTop = -2 - 4q`. - The DOMINANT term of `addPullbackNumerator_reduced_negFrobenius`. -/ - theorem orderTop_localExpand_x_gen_mul_negFrobeniusIsog_pullback_x_gen_sq : - (localExpand W (x_gen W * -@@ -1131,7 +1012,7 @@ theorem orderTop_localExpand_x_gen_mul_negFrobeniusIsog_pullback_x_gen_sq : - rw [negFrobeniusIsog_pullback_x_gen] - exact orderTop_localExpand_x_gen_mul_frob_pullback_x_gen_sq W - --/-- **Sub-helper 46**: `(localExpand(2 · a₂ · x_gen · (negFrob).π·x)).orderTop ≥ -2 - 2q`. -/ -+/-- `(localExpand(2 · a₂ · x_gen · (negFrob).π·x)).orderTop ≥ -2 - 2q`. -/ - theorem orderTop_localExpand_two_mul_a₂_mul_x_gen_mul_negFrob_π_x_ge : - (((-2 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ - (localExpand W ((2 : W.toAffine.FunctionField) * -@@ -1149,7 +1030,7 @@ theorem orderTop_localExpand_two_mul_a₂_mul_x_gen_mul_negFrob_π_x_ge : - localExpand_x_gen_mul_frob_pullback_x_gen] - exact (orderTop_formalX_pow_q_plus_one W).symm.le - --/-- **Sub-helper 47**: `(localExpand(x · (negFrob).π·y)).orderTop = -2 - 3q` for q ≥ 2. -/ -+/-- `(localExpand(x · (negFrob).π·y)).orderTop = -2 - 3q` for q ≥ 2. -/ - theorem orderTop_localExpand_x_gen_mul_negFrob_pullback_y_gen - (hq : 2 ≤ Fintype.card K) : - (localExpand W (x_gen W * (negFrobeniusIsog W).pullback (y_gen W))).orderTop = -@@ -1159,16 +1040,16 @@ theorem orderTop_localExpand_x_gen_mul_negFrob_pullback_y_gen - show ((-2 : ℤ) + (-3 : ℤ) * (Fintype.card K : ℤ)) = - -2 - 3 * (Fintype.card K : ℤ) from by ring] - --/-- **Sub-helper 48**: `(localExpand((negFrob).π·x · y)).orderTop = -3 - 2q`. -/ -+/-- `(localExpand((negFrob).π·x · y)).orderTop = -3 - 2q`. -/ - theorem orderTop_localExpand_negFrob_pullback_x_gen_mul_y_gen : - (localExpand W ((negFrobeniusIsog W).pullback (x_gen W) * y_gen W)).orderTop = - (((-3 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by - rw [negFrobeniusIsog_pullback_x_gen, localExpand_frob_pullback_x_gen_mul_y_gen] - exact orderTop_formalX_pow_mul_formalY W - --/-- **Sub-helper 49** (Term 5 inner): `(localExpand(x · negFrob.π·y + -+/-- Term 5 inner: `(localExpand(x · negFrob.π·y + - negFrob.π·x · y)).orderTop ≥ -3-3q` for q ≥ 2. The `min_orderTop_le_orderTop_add` --extracts both summands. Sub-helper 47 = -2-3q ≥ -3-3q, sub-helper 48 = -3-2q ≥ -3-3q. -/ -+The summands have orders `-2-3q` and `-3-2q`, both at least `-3-3q`. -/ - theorem orderTop_localExpand_x_gen_mul_negFrob_π_y_plus_negFrob_π_x_mul_y_gen_ge - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1185,8 +1066,8 @@ theorem orderTop_localExpand_x_gen_mul_negFrob_π_y_plus_negFrob_π_x_mul_y_gen_ - refine WithTop.coe_le_coe.mpr ?_ - linarith - --/-- **Sub-helper 50** (Term 5 outer): `(localExpand(a₁ · (x · negFrob.π·y + --negFrob.π·x · y))).orderTop ≥ -3-3q` for q ≥ 2. Composition of sub-helpers 28 + 49. -/ -+/-- Term 5 outer: `(localExpand(a₁ · (x · negFrob.π·y + -+negFrob.π·x · y))).orderTop ≥ -3-3q` for q ≥ 2. Multiplication by a base-field constant preserves the lower order bound. -/ - theorem orderTop_localExpand_a₁_mul_x_negFrob_π_y_plus_negFrob_π_x_y_ge - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1196,8 +1077,8 @@ theorem orderTop_localExpand_a₁_mul_x_negFrob_π_y_plus_negFrob_π_x_y_ge - refine le_trans ?_ (orderTop_localExpand_algebraMap_mul_ge W W.a₁ _) - exact orderTop_localExpand_x_gen_mul_negFrob_π_y_plus_negFrob_π_x_mul_y_gen_ge W hq - --/-- **Sub-helper 51** (Term 1 promoted): `(localExpand(a₄ · (x_gen + --negFrob.π·x))).orderTop ≥ -3-3q` for q ≥ 1. From sub-helper 41 (≥ -2q). -/ -+/-- Term 1 promoted: `(localExpand(a₄ · (x_gen + -+negFrob.π·x))).orderTop ≥ -3-3q` for q ≥ 1. The sharper lower bound is `-2q`. -/ - theorem orderTop_localExpand_a₄_mul_x_gen_add_negFrob_π_x_promoted - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1208,7 +1089,8 @@ theorem orderTop_localExpand_a₄_mul_x_gen_add_negFrob_π_x_promoted - refine WithTop.coe_le_coe.mpr ?_ - linarith - --/-- **Sub-helper 52** (Term 2 promoted): `(localExpand(2·a₆)).orderTop ≥ -3-3q`. -/ -+omit [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- Term 2 promoted: `(localExpand(2·a₆)).orderTop ≥ -3-3q`. -/ - theorem orderTop_localExpand_two_mul_a₆_promoted - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1219,8 +1101,8 @@ theorem orderTop_localExpand_two_mul_a₆_promoted - refine WithTop.coe_le_coe.mpr ?_ - linarith - --/-- **Sub-helper 53** (Term 3 promoted): `(localExpand(a₃ · (y_gen + --negFrob.π·y))).orderTop ≥ -3-3q`. From sub-helper 39 (≥ -3q). -/ -+/-- Term 3 promoted: `(localExpand(a₃ · (y_gen + -+negFrob.π·y))).orderTop ≥ -3-3q`. The sharper lower bound is `-3q`. -/ - theorem orderTop_localExpand_a₃_mul_y_gen_add_negFrob_π_y_promoted - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1231,8 +1113,8 @@ theorem orderTop_localExpand_a₃_mul_y_gen_add_negFrob_π_y_promoted - refine WithTop.coe_le_coe.mpr ?_ - linarith - --/-- **Sub-helper 54** (Term 6 promoted): `(localExpand(x² · negFrob.π·x)).orderTop ≥ -3-3q`. --From sub-helper 44 (= -4-2q). -/ -+/-- Term 6 promoted: `(localExpand(x² · negFrob.π·x)).orderTop ≥ -3-3q`. -+The exact order is `-4-2q`. -/ - theorem orderTop_localExpand_x_gen_sq_mul_negFrob_π_x_promoted - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1243,8 +1125,8 @@ theorem orderTop_localExpand_x_gen_sq_mul_negFrob_π_x_promoted - refine WithTop.coe_le_coe.mpr ?_ - linarith - --/-- **Sub-helper 55** (Term 8 promoted): `(localExpand(2·a₂·x·negFrob.π·x)).orderTop ≥ -3-3q`. --From sub-helper 46 (≥ -2-2q). -/ -+/-- Term 8 promoted: `(localExpand(2·a₂·x·negFrob.π·x)).orderTop ≥ -3-3q`. -+The sharper lower bound is `-2-2q`. -/ - theorem orderTop_localExpand_two_a₂_x_negFrob_π_x_promoted - (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1257,14 +1139,14 @@ theorem orderTop_localExpand_two_a₂_x_negFrob_π_x_promoted - linarith - - omit [Fintype K] [DecidableEq K] in --/-- **Sub-helper 56**: `add_ge_of_both_ge` — addition preserves orderTop bounds. -/ -+/-- `add_ge_of_both_ge` — addition preserves orderTop bounds. -/ - theorem orderTop_add_ge_of_both_ge {a b : LaurentSeries K} {n : WithTop ℤ} - (ha : n ≤ a.orderTop) (hb : n ≤ b.orderTop) : - n ≤ (a + b).orderTop := - le_trans (le_min ha hb) HahnSeries.min_orderTop_le_orderTop_add - - omit [Fintype K] [DecidableEq K] in --/-- **Sub-helper 57**: `sub_ge_of_both_ge` — subtraction preserves orderTop bounds. -+/-- `sub_ge_of_both_ge` — subtraction preserves orderTop bounds. - Uses `HahnSeries.orderTop_neg` to convert `b` ↔ `-b`. -/ - theorem orderTop_sub_ge_of_both_ge {a b : LaurentSeries K} {n : WithTop ℤ} - (ha : n ≤ a.orderTop) (hb : n ≤ b.orderTop) : -@@ -1274,7 +1156,7 @@ theorem orderTop_sub_ge_of_both_ge {a b : LaurentSeries K} {n : WithTop ℤ} - rw [HahnSeries.orderTop_neg] - exact hb - --/-- **Sub-helper 58** (Cumulative sum): `(localExpand(rest)).orderTop ≥ -3-3q`, -+/-- Cumulative sum: `(localExpand(rest)).orderTop ≥ -3-3q`, - where `rest` is `addPullbackNumerator_reduced_negFrobenius` minus the dominant - term `x · (negFrob.π·x)²`. Sequential `add/sub_ge_of_both_ge` chain over - the 7 sub-dominant term bounds. -/ -@@ -1339,7 +1221,7 @@ private theorem addPullbackNumerator_reduced_negFrobenius_split_eq : - - /-- The dominant term `localExpand(x_gen · (negFrob.π·x)²)` has strictly smaller - `orderTop` than the `rest` (for `q ≥ 2`): `-2-4q < -3-3q`. Combines the dominant --order (sub-helper 45) with the `rest ≥ -3-3q` bound (sub-helper 58). -/ -+order with the `rest ≥ -3-3q` bound. -/ - private theorem orderTop_localExpand_dominant_lt_rest_negFrobenius - (hq : 2 ≤ Fintype.card K) : - (localExpand W (x_gen W * -@@ -1374,8 +1256,8 @@ private theorem orderTop_localExpand_dominant_lt_rest_negFrobenius - for q ≥ 2. - - Algebraic decomposition: the full expression is `rest + dominant`, where --* `dominant = x_gen · (negFrob.π·x)²` has orderTop = -2-4q (sub-helper 45) --* `rest` (the other 7 terms) has orderTop ≥ -3-3q (sub-helper 58) -+* `dominant = x_gen · (negFrob.π·x)²` has orderTop = -2-4q -+* `rest` (the other 7 terms) has orderTop ≥ -3-3q - - For q ≥ 2: -2-4q < -3-3q, so `orderTop_add_eq_right` extracts the dominant - orderTop. -/ -@@ -1442,7 +1324,7 @@ private lemma orderTop_localExpand_dominant_lt_rest (hq : 2 ≤ Fintype.card K) - /-- **Leading coefficient companion**: - `(localExpand(addPullbackNumerator_reduced_negFrobenius)).leadingCoeff = 1` - for q ≥ 2. The leading coefficient of the dominant term `x_gen · (negFrob.π·x)²` --is 1 (sub-helper 9 / `leadingCoeff_localExpand_x_gen_mul_frob_pullback_x_gen_sq`), -+is 1 by `leadingCoeff_localExpand_x_gen_mul_frob_pullback_x_gen_sq`, - which propagates through the strict-non-arch via `leadingCoeff_add_eq_right`. -/ - theorem leadingCoeff_localExpand_addPullbackNumerator_reduced_negFrobenius_eq - (hq : 2 ≤ Fintype.card K) : -@@ -1454,7 +1336,8 @@ theorem leadingCoeff_localExpand_addPullbackNumerator_reduced_negFrobenius_eq - negFrobeniusIsog_pullback_x_gen] - exact leadingCoeff_localExpand_x_gen_mul_frob_pullback_x_gen_sq W - --/-- **Sub-helper 61**: `(formalX - formalX^q).leadingCoeff = -1` for q ≥ 2. -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- `(formalX - formalX^q).leadingCoeff = -1` for q ≥ 2. - The dominant term `-formalX^q` (orderTop -2q < -2) determines the leading - coefficient via `leadingCoeff_add_eq_right`. -/ - theorem leadingCoeff_formalX_sub_formalX_pow (hq : 2 ≤ Fintype.card K) : -@@ -1469,16 +1352,16 @@ theorem leadingCoeff_formalX_sub_formalX_pow (hq : 2 ≤ Fintype.card K) : - rw [HahnSeries.leadingCoeff_add_eq_right h_lt, HahnSeries.leadingCoeff_neg, - formalX_pow_leadingCoeff] - --/-- **Sub-helper 62**: `((formalX - formalX^q)²).leadingCoeff = 1` for q ≥ 2. --Direct from `HahnSeries.leadingCoeff_mul` (squared) and sub-helper 61 --(`(-1)² = 1`). -/ -+omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- Squaring `formalX - formalX^q`, whose leading coefficient is `-1`, gives leading -+coefficient one. -/ - theorem leadingCoeff_formalX_sub_formalX_pow_sq (hq : 2 ≤ Fintype.card K) : - ((formalX W - (formalX W) ^ Fintype.card K) ^ 2 : LaurentSeries K).leadingCoeff = 1 := by - rw [sq, HahnSeries.leadingCoeff_mul, leadingCoeff_formalX_sub_formalX_pow W hq] - ring - --/-- **Sub-helper 63**: `(localExpand((x_gen - negFrob.π·x)²)).orderTop = -4q` for q ≥ 2. --Bridges via `negFrobeniusIsog_pullback_x_gen` to the frobenius-side sub-helper 4. -/ -+/-- `(localExpand((x_gen - negFrob.π·x)²)).orderTop = -4q` for q ≥ 2. -+Negative Frobenius has the same x-coordinate pullback as Frobenius. -/ - theorem orderTop_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq - (hq : 2 ≤ Fintype.card K) : - (localExpand W ((x_gen W - -@@ -1487,7 +1370,7 @@ theorem orderTop_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq - rw [negFrobeniusIsog_pullback_x_gen, localExpand_x_gen_sub_frob_pullback_x_gen_sq] - exact orderTop_formalX_sub_formalX_pow_sq W hq - --/-- **Sub-helper 64**: `(localExpand((x_gen - negFrob.π·x)²)).leadingCoeff = 1` for q ≥ 2. -/ -+/-- `(localExpand((x_gen - negFrob.π·x)²)).leadingCoeff = 1` for q ≥ 2. -/ - theorem leadingCoeff_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq - (hq : 2 ≤ Fintype.card K) : - (localExpand W ((x_gen W - -@@ -1495,7 +1378,7 @@ theorem leadingCoeff_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq - rw [negFrobeniusIsog_pullback_x_gen, localExpand_x_gen_sub_frob_pullback_x_gen_sq] - exact leadingCoeff_formalX_sub_formalX_pow_sq W hq - --/-- **Sub-helper 65**: `(localExpand((x_gen - negFrob.π·x)²)) ≠ 0` for q ≥ 2. -+/-- `(localExpand((x_gen - negFrob.π·x)²)) ≠ 0` for q ≥ 2. - Direct from orderTop being a finite value. -/ - theorem localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_ne_zero - (hq : 2 ≤ Fintype.card K) : -@@ -1508,7 +1391,7 @@ theorem localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_ne_zero - rw [orderTop_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq W hq] at h_top - exact WithTop.coe_ne_top h_top - --/-- **Sub-helper 65b**: `(x_gen - negFrob.π·x) ≠ 0` in K(E). Derived from the -+/-- `(x_gen - negFrob.π·x) ≠ 0` in K(E). Derived from the - LaurentSeries-side fact `(formalX - formalX^q).orderTop = -2q ≠ ⊤`. -/ - private theorem x_gen_sub_negFrob_pullback_x_gen_ne_zero_local - (hq : 2 ≤ Fintype.card K) : -@@ -1569,7 +1452,7 @@ theorem leadingCoeff_localExpand_addPullback_x_negFrobenius_eq - leadingCoeff_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq W hq] - ring - --/-- **Sub-helper 66**: `localExpand(addPullback_x_negFrobenius) ≠ 0` for q ≥ 2. -+/-- `localExpand(addPullback_x_negFrobenius) ≠ 0` for q ≥ 2. - Direct from orderTop being a finite value. -/ - theorem localExpand_addPullback_x_negFrobenius_ne_zero - (hq : 2 ≤ Fintype.card K) : -@@ -1580,11 +1463,11 @@ theorem localExpand_addPullback_x_negFrobenius_ne_zero - rw [orderTop_localExpand_addPullback_x_negFrobenius_eq W hq] at h_top - exact WithTop.coe_ne_top h_top - --/-- **Sub-helper 67**: `(localExpand(addPullback_x_negFrobenius)).coeff (-2) = 1` for q ≥ 2. -+/-- `(localExpand(addPullback_x_negFrobenius)).coeff (-2) = 1` for q ≥ 2. - Direct extraction of the leading coefficient at the leading exponent - via `HahnSeries.coeff_untop_eq_leadingCoeff` (when orderTop = -2 finite). - --This is the ACTUAL coefficient value at the most-negative exponent, the -+This is the coefficient value at the most-negative exponent, the - LaurentSeries-side input for the IV.1.4 step 2 leading-coefficient - computation. -/ - theorem coeff_neg_two_localExpand_addPullback_x_negFrobenius_eq -@@ -1602,7 +1485,7 @@ theorem coeff_neg_two_localExpand_addPullback_x_negFrobenius_eq - rw [← h_untop, HahnSeries.coeff_untop_eq_leadingCoeff] - exact h_leadingCoeff - --/-- **Sub-helper 68**: `((localExpand addPullback_x)^2).orderTop = -4`. -/ -+/-- `((localExpand addPullback_x)^2).orderTop = -4`. -/ - theorem orderTop_localExpand_addPullback_x_negFrobenius_sq - (hq : 2 ≤ Fintype.card K) : - ((localExpand W (addPullback_x W (negFrobeniusIsog W))) ^ 2 : -@@ -1612,7 +1495,7 @@ theorem orderTop_localExpand_addPullback_x_negFrobenius_sq - orderTop_localExpand_addPullback_x_negFrobenius_eq W hq, ← WithTop.coe_add] - congr 1 - --/-- **Sub-helper 69**: `((localExpand addPullback_x)^3).orderTop = -6`. -/ -+/-- `((localExpand addPullback_x)^3).orderTop = -6`. -/ - theorem orderTop_localExpand_addPullback_x_negFrobenius_cube - (hq : 2 ≤ Fintype.card K) : - ((localExpand W (addPullback_x W (negFrobeniusIsog W))) ^ 3 : -@@ -1623,7 +1506,7 @@ theorem orderTop_localExpand_addPullback_x_negFrobenius_cube - orderTop_localExpand_addPullback_x_negFrobenius_eq W hq, ← WithTop.coe_add] - congr 1 - --/-- **Sub-helper 70**: `localExpand(addPullback_y)` is nonzero for q ≥ 2. -+/-- `localExpand(addPullback_y)` is nonzero for q ≥ 2. - Direct from `localExpand` being a ring hom to a field + addPullback_y ≠ 0 - (via `ord_addPullback_y_negFrobenius`). -/ - theorem localExpand_addPullback_y_negFrobenius_ne_zero -@@ -1638,7 +1521,7 @@ theorem localExpand_addPullback_y_negFrobenius_ne_zero - rw [h_y_eq_zero] at h_y_ord - exact WithTop.top_ne_coe ((W_smooth W).ordAtInfty_zero.symm.trans h_y_ord) - --/-- **Sub-helper 71**: localExpand of the curve equation -+/-- localExpand of the curve equation - `Y² + a₁·X·Y + a₃·Y = X³ + a₂·X² + a₄·X + a₆` applied to the addPullback - coordinates. Direct from `addPullback_equation` + `localExpand` ring hom. - -@@ -1675,7 +1558,7 @@ theorem localExpand_addPullback_curve_equation : - rw [ha₁, ha₂, ha₃, ha₄, ha₆] at h_le - exact h_le - --/-- **Sub-helper 72**: `(localExpand(a₂·X² + a₄·X + a₆)).orderTop ≥ -4` for q ≥ 2. -+/-- `(localExpand(a₂·X² + a₄·X + a₆)).orderTop ≥ -4` for q ≥ 2. - The non-cubic RHS terms have orderTop bounded by -4 (since `a₂·X²` has - orderTop ≥ -4 = orderTop X² when a₂ ≠ 0, and `a₄·X` has orderTop ≥ -2 ≥ -4, - and `a₆` has orderTop ≥ 0 ≥ -4). -/ -@@ -1713,7 +1596,7 @@ theorem orderTop_localExpand_RHS_lower_terms_ge - refine le_trans ?_ (orderTop_HahnSeries_C_ge_zero W.a₆) - exact_mod_cast (by norm_num : (-4 : ℤ) ≤ 0) - --/-- **Sub-helper 73**: `(localExpand(X³ + a₂·X² + a₄·X + a₆)).orderTop = -6` -+/-- `(localExpand(X³ + a₂·X² + a₄·X + a₆)).orderTop = -6` - for q ≥ 2. Strict non-arch with `X³` dominating (orderTop -6) and the other - terms bounded ≥ -4. -/ - theorem orderTop_localExpand_addPullback_RHS_eq -@@ -1751,8 +1634,7 @@ theorem orderTop_localExpand_addPullback_RHS_eq - exact (HahnSeries.orderTop_add_eq_left h_lt).trans - (orderTop_localExpand_addPullback_x_negFrobenius_cube W hq) - --/-- **Sub-helper 74** (Y-side LHS orderTop = -6): direct from sub-helper 73 + --the curve equation (sub-helper 71). -/ -+/-- Y-side LHS orderTop = -6: the curve equation identifies its order with the cubic right-hand side. -/ - theorem orderTop_localExpand_addPullback_LHS_eq - (hq : 2 ≤ Fintype.card K) : - ((localExpand W (addPullback_y W (negFrobeniusIsog W)))^2 + -@@ -1766,8 +1648,8 @@ theorem orderTop_localExpand_addPullback_LHS_eq - rw [localExpand_addPullback_curve_equation W] - exact orderTop_localExpand_addPullback_RHS_eq W hq - --/-- **Sub-helper 75** (extract m): `localExpand(addPullback_y).orderTop = (m : ℤ)` --for some integer `m`. Uses sub-helper 70 (≠ 0). -/ -+/-- extract m: `localExpand(addPullback_y).orderTop = (m : ℤ)` -+for some integer `m`. The series is nonzero, so its order is finite. -/ - theorem exists_m_orderTop_localExpand_addPullback_y_negFrobenius - (hq : 2 ≤ Fintype.card K) : - ∃ m : ℤ, (localExpand W (addPullback_y W (negFrobeniusIsog W))).orderTop = -@@ -1779,7 +1661,7 @@ theorem exists_m_orderTop_localExpand_addPullback_y_negFrobenius - obtain ⟨m, hm⟩ := WithTop.ne_top_iff_exists.mp h_ne_top - exact ⟨m, hm.symm⟩ - --/-- **Sub-helper 76** (Y² orderTop = 2m): with `m = orderTop(Y)`, `Y²` has orderTop `2m`. -/ -+/-- Y² orderTop = 2m: with `m = orderTop(Y)`, `Y²` has orderTop `2m`. -/ - theorem orderTop_localExpand_addPullback_y_negFrobenius_sq_eq_two_m - (_hq : 2 ≤ Fintype.card K) (m : ℤ) - (hm : (localExpand W (addPullback_y W (negFrobeniusIsog W))).orderTop = -@@ -1790,7 +1672,7 @@ theorem orderTop_localExpand_addPullback_y_negFrobenius_sq_eq_two_m - rw [sq, HahnSeries.orderTop_mul, hm, ← WithTop.coe_add] - congr 1; ring - --/-- **Sub-helper 77** (X·Y orderTop = -2 + m): -/ -+/-- X·Y orderTop = -2 + m: -/ - theorem orderTop_localExpand_addPullback_x_mul_y_negFrobenius_eq - (hq : 2 ≤ Fintype.card K) (m : ℤ) - (hm : (localExpand W (addPullback_y W (negFrobeniusIsog W))).orderTop = -@@ -1858,7 +1740,7 @@ private theorem orderTop_a3_mul_y_negFrobenius_ge (m : ℤ) (h_m_ge : -2 ≤ m) - rw [zero_add] - refine WithTop.coe_le_coe.mpr ?_; linarith - --/-- **Sub-helper 78** (rule out m ≥ -2): if `m ≥ -2`, then LHS orderTop ≥ -4, -+/-- rule out m ≥ -2: if `m ≥ -2`, then LHS orderTop ≥ -4, - contradicting LHS orderTop = -6. -/ - theorem m_le_neg_three_orderTop_localExpand_addPullback_y_negFrobenius - (hq : 2 ≤ Fintype.card K) (m : ℤ) -@@ -1876,7 +1758,7 @@ theorem m_le_neg_three_orderTop_localExpand_addPullback_y_negFrobenius - have h46 : (-4 : ℤ) ≤ -6 := by exact_mod_cast h_lhs_ge - omega - --/-- **Sub-helper 79** (Y² strictly dominates a₁·X·Y, given m ≤ -3): for `m ≤ -3`, -+/-- Y² strictly dominates a₁·X·Y, given m ≤ -3: for `m ≤ -3`, - `Y²` has orderTop = `2m ≤ -6 < -2 + m = orderTop(a₁·X·Y)`. -/ - theorem orderTop_y_sq_lt_a1xy_negFrobenius - (hq : 2 ≤ Fintype.card K) (m : ℤ) (h_m_le : m ≤ -3) -@@ -1907,7 +1789,7 @@ theorem orderTop_y_sq_lt_a1xy_negFrobenius - refine WithTop.coe_lt_coe.mpr ?_ - linarith - --/-- **Sub-helper 80** (Y² strictly dominates a₃·Y, given m ≤ -3): for `m ≤ -3`, -+/-- Y² strictly dominates a₃·Y, given m ≤ -3: for `m ≤ -3`, - `Y²` has orderTop = `2m ≤ -6 < m = orderTop(a₃·Y)` (since `2m < m` for `m ≤ -3`). -/ - theorem orderTop_y_sq_lt_a3y_negFrobenius - (hq : 2 ≤ Fintype.card K) (m : ℤ) (h_m_le : m ≤ -3) -@@ -1976,8 +1858,8 @@ theorem orderTop_localExpand_addPullback_y_negFrobenius_eq - congr 1 - omega - --/-- **Sub-helper 84**: leadingCoeff of `(localExpand X)^3 = 1`, derived from --sub-helper main companion (`leadingCoeff(localExpand X) = 1`) + leadingCoeff_mul. -/ -+/-- leadingCoeff of `(localExpand X)^3 = 1`, derived from -+`leadingCoeff(localExpand X) = 1` and multiplicativity of leading coefficients. -/ - theorem leadingCoeff_localExpand_addPullback_x_negFrobenius_cube_eq - (hq : 2 ≤ Fintype.card K) : - ((localExpand W (addPullback_x W (negFrobeniusIsog W))) ^ 3 : -@@ -1987,7 +1869,7 @@ theorem leadingCoeff_localExpand_addPullback_x_negFrobenius_cube_eq - leadingCoeff_localExpand_addPullback_x_negFrobenius_eq W hq] - ring - --/-- **Sub-helper 85**: leadingCoeff of RHS = 1. -+/-- leadingCoeff of RHS = 1. - - Strict-dominance of `X³` on RHS (orderTop -6 < -4 of other terms) gives - `leadingCoeff(RHS) = leadingCoeff(X³) = 1` via `leadingCoeff_add_eq_left`. -/ -@@ -2025,7 +1907,7 @@ theorem leadingCoeff_localExpand_addPullback_RHS_eq - rw [HahnSeries.leadingCoeff_add_eq_left h_lt] - exact leadingCoeff_localExpand_addPullback_x_negFrobenius_cube_eq W hq - --/-- **Sub-helper 86**: leadingCoeff of LHS = 1. -+/-- leadingCoeff of LHS = 1. - - LHS = RHS (curve equation), so leadingCoeff equal. -/ - theorem leadingCoeff_localExpand_addPullback_LHS_eq -@@ -2040,7 +1922,7 @@ theorem leadingCoeff_localExpand_addPullback_LHS_eq - rw [localExpand_addPullback_curve_equation W] - exact leadingCoeff_localExpand_addPullback_RHS_eq W hq - --/-- **Sub-helper 87**: leadingCoeff of `Y²` extracted from LHS via strict-dominance. -+/-- leadingCoeff of `Y²` extracted from LHS via strict-dominance. - - For the actual y-orderTop = -3, `Y²` (orderTop = -6) strictly dominates `a₁·X·Y` - (orderTop = -5) and `a₃·Y` (orderTop = -3). So `leadingCoeff(LHS) = leadingCoeff(Y²)`. -/ -@@ -2080,7 +1962,7 @@ theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_sq_eq_one - exact h_lhs_lc - - /-- **MAIN Y-SIDE LEADING-COEFFICIENT**: `(leadingCoeff(localExpand addPullback_y))² = 1` --for q ≥ 2. From `leadingCoeff(Y²) = 1` (sub-helper 87) + `leadingCoeff_mul`. -/ -+for q ≥ 2. From `leadingCoeff(Y²) = 1` + `leadingCoeff_mul`. -/ - theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_sq - (hq : 2 ≤ Fintype.card K) : - ((localExpand W (addPullback_y W (negFrobeniusIsog W))).leadingCoeff)^2 = 1 := by -@@ -2089,7 +1971,7 @@ theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_sq - rw [sq] - exact h - --/-- **Sub-helper 89**: `leadingCoeff(localExpand addPullback_y) ≠ 0` for q ≥ 2. -+/-- `leadingCoeff(localExpand addPullback_y) ≠ 0` for q ≥ 2. - Direct from the squared identity = 1 (so leadingCoeff = ±1). -/ - theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_ne_zero - (hq : 2 ≤ Fintype.card K) : -@@ -2099,7 +1981,7 @@ theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_ne_zero - rw [h, sq, mul_zero] at h_sq - exact zero_ne_one h_sq - --/-- **Sub-helper 89b**: `addPullbackAlgHom_negFrobenius (x_gen) = addPullback_x`. -/ -+/-- `addPullbackAlgHom_negFrobenius (x_gen) = addPullback_x`. -/ - theorem addPullbackAlgHom_negFrobenius_x_gen_eq - (hq : 2 ≤ Fintype.card K) : - addPullbackAlgHom_negFrobenius W hq (x_gen W) = -@@ -2119,7 +2001,7 @@ theorem addPullbackAlgHom_negFrobenius_x_gen_eq - rw [AdjoinRoot.lift_mk] - simp [addBaseHom, Polynomial.eval₂_C] - --/-- **Sub-helper 89c**: `addPullbackAlgHom_negFrobenius (y_gen) = addPullback_y`. -/ -+/-- `addPullbackAlgHom_negFrobenius (y_gen) = addPullback_y`. -/ - theorem addPullbackAlgHom_negFrobenius_y_gen_eq - (hq : 2 ≤ Fintype.card K) : - addPullbackAlgHom_negFrobenius W hq (y_gen W) = -@@ -2141,8 +2023,7 @@ theorem addPullbackAlgHom_negFrobenius_y_gen_eq - rw [AdjoinRoot.lift_mk] - simp [addBaseHom, Polynomial.eval₂_X] - --/-- **Sub-helper 90**: --`localExpand(γ.pullback localParam) = -localExpand(addPullback_x) / localExpand(addPullback_y)` -+/-- `localExpand(γ.pullback localParam) = -localExpand(addPullback_x) / localExpand(addPullback_y)` - for γ = isogOneSub_negFrobenius. Direct ring-hom + AlgHom.commutes_div + map_div₀. -/ - theorem localExpand_isogOneSub_negFrobenius_pullback_localParam - (hq : 2 ≤ Fintype.card K) : -@@ -2155,7 +2036,7 @@ theorem localExpand_isogOneSub_negFrobenius_pullback_localParam - addPullbackAlgHom_negFrobenius_x_gen_eq W hq, - addPullbackAlgHom_negFrobenius_y_gen_eq W hq] - --/-- **Sub-helper 91**: `(localExpand(γ.pullback localParam)).orderTop = 1` for -+/-- `(localExpand(γ.pullback localParam)).orderTop = 1` for - γ = isogOneSub_negFrobenius. Via `orderTop_div`: `-2 - (-3) = 1`. -/ - theorem orderTop_localExpand_isogOneSub_negFrobenius_pullback_localParam - (hq : 2 ≤ Fintype.card K) : -@@ -2169,7 +2050,7 @@ theorem orderTop_localExpand_isogOneSub_negFrobenius_pullback_localParam - orderTop_localExpand_addPullback_y_negFrobenius_eq W hq] - rfl - --/-- **Sub-helper 92**: `(localExpand(γ.pullback localParam)).leadingCoeff = -1 / leadingCoeff(Y)` -+/-- `(localExpand(γ.pullback localParam)).leadingCoeff = -1 / leadingCoeff(Y)` - for γ = isogOneSub_negFrobenius. Via `leadingCoeff_div` + `leadingCoeff_neg`. -/ - theorem leadingCoeff_localExpand_isogOneSub_negFrobenius_pullback_localParam - (hq : 2 ≤ Fintype.card K) : -@@ -2181,7 +2062,7 @@ theorem leadingCoeff_localExpand_isogOneSub_negFrobenius_pullback_localParam - rw [HahnSeries.leadingCoeff_neg, - leadingCoeff_localExpand_addPullback_x_negFrobenius_eq W hq] - --/-- **Sub-helper 93**: `coeff 1 (formal γ) = -1 / leadingCoeff(Y)` for γ = isogOneSub_negFrobenius. -+/-- `coeff 1 (formal γ) = -1 / leadingCoeff(Y)` for γ = isogOneSub_negFrobenius. - - Via `formalIsogenySeries_coeff` + `coeff_untop_eq_leadingCoeff` at orderTop = 1. - This is the LaurentSeries-side computation of `coeff 1 (formal γ)` modulo -@@ -2209,8 +2090,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_eq_neg_one_div_lea - HahnSeries.coeff_untop_eq_leadingCoeff] - exact h_Z_lc - --/-- **Sub-helper 94** (witness-parametric coeff 1 = 1): with `leadingCoeff(Y) = -1` --witness, `coeff 1 (formalIsogenySeries γ) = 1` axiom-clean. -/ -+/-- witness-parametric coeff 1 = 1: with `leadingCoeff(Y) = -1` -+witness, `coeff 1 (formalIsogenySeries γ) = 1`. -/ - theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_eq_one_of_y_lc - (hq : 2 ≤ Fintype.card K) - (h_y_lc : (localExpand W (addPullback_y W (negFrobeniusIsog W))).leadingCoeff = -1) : -@@ -2220,9 +2101,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_eq_one_of_y_lc - -- Goal: -1 / -1 = 1 - norm_num - --/-- **Sub-helper 95** (Witness #1 closer via leadingCoeff(Y) witness + BRIDGE-001 γ): --takes `leadingCoeff(Y) = -1` as the LaurentSeries-side witness and BRIDGE-001 --for γ as the K(E)-side witness, fires Witness #1 unconditional. -/ -+/-- A y-coordinate Laurent leading coefficient of `-1`, together with equality of the -+differential and linear formal-series coefficients, implies separability of `1 − π`. -/ - theorem isogOneSub_negFrobenius_isSeparable_via_y_lc_and_bridge_001 - (hq : 2 ≤ Fintype.card K) - (h_y_lc : (localExpand W (addPullback_y W (negFrobeniusIsog W))).leadingCoeff = -1) -@@ -2241,8 +2121,8 @@ theorem isogOneSub_negFrobenius_isSeparable_via_y_lc_and_bridge_001 - exact isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading W hq - h_bridge_001_γ h_leading_add - --/-- **Sub-helper 96** (omegaPullbackCoeff = 1 via leadingCoeff(Y) + BRIDGE-001 γ): --companion to 95 producing `omegaPullbackCoeff(γ) = 1`. -/ -+/-- A y-coordinate Laurent leading coefficient of `-1` and the differential/formal-series -+coefficient identity give differential coefficient one for `1 − π`. -/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_y_lc_and_bridge_001 - (hq : 2 ≤ Fintype.card K) - (h_y_lc : (localExpand W (addPullback_y W (negFrobeniusIsog W))).leadingCoeff = -1) -@@ -2261,12 +2141,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_y_lc_and_bridge_00 - exact omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading W hq - h_bridge_001_γ h_leading_add - --/-- **Sub-helper 96b** (sign determination — char 2 case axiom-clean): --in characteristic 2, `(localExpand addPullback_y).leadingCoeff = -1` --because `c_y² = 1` (sub-helper 88) and `1 = -1` in char 2 (via `CharTwo.neg_eq`). -- --This pins the sign for characteristic 2 axiom-clean, closing the --sign-determination work for q = 2^k case. -/ -+/-- In characteristic two the y-coordinate Laurent leading coefficient is `-1`, -+since its square is one and `1 = -1`. -/ - theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_eq_neg_one_char_two - [CharP K 2] - (hq : 2 ≤ Fintype.card K) : -@@ -2294,8 +2170,8 @@ theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_eq_neg_one_char_two - pow_eq_zero_iff (n := 2) (by norm_num : 2 ≠ 0) |>.mp h_c_plus_one_sq - exact eq_neg_of_add_eq_zero_left h_c_plus_one - --/-- **Sub-helper 98** (Witness #1 char 2): in characteristic 2, the y-side --sign pin is automatic via 96b. Witness #1 fires with only BRIDGE-001 for γ. -/ -+/-- In characteristic two, equality of the differential and linear formal-series -+coefficients implies separability of `1 − π`. -/ - theorem isogOneSub_negFrobenius_isSeparable_char_two - [CharP K 2] - (hq : 2 ≤ Fintype.card K) -@@ -2307,7 +2183,7 @@ theorem isogOneSub_negFrobenius_isSeparable_char_two - (leadingCoeff_localExpand_addPullback_y_negFrobenius_eq_neg_one_char_two W hq) - h_bridge_001_γ - --/-- **Sub-helper 99** (omegaPullbackCoeff(γ) = 1 char 2). -/ -+/-- omegaPullbackCoeff(γ) = 1 char 2. -/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_char_two - [CharP K 2] - (hq : 2 ≤ Fintype.card K) -@@ -2319,10 +2195,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_char_two - (leadingCoeff_localExpand_addPullback_y_negFrobenius_eq_neg_one_char_two W hq) - h_bridge_001_γ - --/-- **Sub-helper 101** (BRIDGE-001 for γ char-2 from omega witness): takes --`omegaPullbackCoeff(γ) = 1` directly and discharges BRIDGE-001 for γ --axiom-clean. The LaurentSeries side gives `coeff 1 (formal γ) = 1` via --y-lc (sub-helper 96b) + ratio chain. -/ -+/-- In characteristic two, differential coefficient one implies its equality with the -+linear formal-series coefficient, which is also one. -/ - theorem bridge_001_γ_isogOneSub_negFrobenius_char_two - [CharP K 2] - (hq : 2 ≤ Fintype.card K) -@@ -2336,7 +2210,7 @@ theorem bridge_001_γ_isogOneSub_negFrobenius_char_two - exact (map_one _).symm - - omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in --/-- **Sub-helper 104** (Frobenius D vanishing): for finite K with characteristic -+/-- Frobenius D vanishing: for finite K with characteristic - p (and `q = #K` a power of p), the Kähler differential of `x_gen^q` vanishes. - - Proof: `D(x^q) = q · x^(q-1) · D(x)` (Leibniz pow), and `(q : K) = 0` since -@@ -2355,9 +2229,8 @@ theorem kaehler_D_x_gen_pow_card_eq_zero - rw [Nat.cast_smul_eq_nsmul, smul_assoc]] - rw [h_card_zero, zero_smul, zero_smul] - --/-- **Sub-helper 105** (Frobenius D pullback vanishing): the Kähler differential --of `(frobeniusIsog).pullback x_gen` vanishes. Direct from sub-helper 104 + --`frobeniusIsog_pullback_apply` (= `x_gen^q`). -/ -+/-- The Kähler differential of the Frobenius pullback of `x_gen` vanishes, because that -+pullback is a q-th power. -/ - theorem kaehler_D_frobeniusIsog_pullback_x_gen - (p : ℕ) [Fact p.Prime] [CharP K p] : - KaehlerDifferential.D K W.toAffine.FunctionField -@@ -2365,7 +2238,7 @@ theorem kaehler_D_frobeniusIsog_pullback_x_gen - rw [frobeniusIsog_pullback_apply] - exact kaehler_D_x_gen_pow_card_eq_zero W p - --/-- **Sub-helper 106** (Frobenius D pullback y vanishing): the Kähler differential -+/-- Frobenius D pullback y vanishing: the Kähler differential - of `(frobeniusIsog).pullback y_gen` vanishes. Same proof shape as 105. -/ - theorem kaehler_D_frobeniusIsog_pullback_y_gen - (p : ℕ) [Fact p.Prime] [CharP K p] : -@@ -2382,13 +2255,13 @@ theorem kaehler_D_frobeniusIsog_pullback_y_gen - rw [Nat.cast_smul_eq_nsmul, smul_assoc]] - rw [h_card_zero, zero_smul, zero_smul] - --/-- **Sub-helper 107** (negFrobenius D pullback x vanishing): the Kähler differential -+/-- negFrobenius D pullback x vanishing: the Kähler differential - of `(negFrobeniusIsog).pullback x_gen` vanishes. - - `negFrobeniusIsog = mulByInt(-1) ∘ frobeniusIsog`, so - `(negFrob).pullback x_gen = frobenius.pullback ((mulByInt(-1)).pullback x_gen) = - frobenius.pullback x_gen = x_gen^q` (since `[-1]` fixes `x_gen`). --Then by sub-helper 104, `D(x_gen^q) = 0`. -/ -+The differential of a q-th power vanishes. -/ - theorem kaehler_D_negFrobeniusIsog_pullback_x_gen - (p : ℕ) [Fact p.Prime] [CharP K p] : - KaehlerDifferential.D K W.toAffine.FunctionField -@@ -2396,13 +2269,13 @@ theorem kaehler_D_negFrobeniusIsog_pullback_x_gen - rw [negFrobeniusIsog_pullback_x_gen] - exact kaehler_D_frobeniusIsog_pullback_x_gen W p - --/-- **Sub-helper 108** (negFrobenius D pullback y vanishing): the Kähler differential -+/-- negFrobenius D pullback y vanishing: the Kähler differential - of `(negFrobeniusIsog).pullback y_gen` vanishes. - - `(negFrob).pullback y_gen = -π·y_gen - a₁·π·x_gen - a₃` (where π·· = - frobeniusIsog.pullback). The differential operator `D` is a K-derivation, - so `D(constant) = 0` for `a₃ ∈ K`, and `D(a₁ · f) = a₁ · D(f)` for `a₁ ∈ K`, --and `D(-f) = -D(f)`. Combined with sub-helpers 105-106, all three terms -+and `D(-f) = -D(f)`. Vanishing of both Frobenius coordinate differentials shows that all three terms - vanish. -/ - theorem kaehler_D_negFrobeniusIsog_pullback_y_gen - (p : ℕ) [Fact p.Prime] [CharP K p] : -@@ -2419,7 +2292,7 @@ theorem kaehler_D_negFrobeniusIsog_pullback_y_gen - simp - - omit [Fintype K] in --/-- **Sub-helper 109** (D(addPullback_x) formula via slope). -+/-- D(addPullback_x) formula via slope. - - For any α : Isogeny W W with `D((α).pullback x_gen) = 0` (i.e., α has its - x-pullback Kähler-flat, true for Frobenius / negFrobenius in characteristic -@@ -2452,9 +2325,9 @@ theorem kaehler_D_addPullback_x_via_slope_witness - (Nat.cast_smul_eq_nsmul (R := KE) 2 _).symm] - rw [smul_smul] - --/-- **Sub-helper 110** (D(addPullback_x) for negFrobenius — specialized). -+/-- D(addPullback_x) for negFrobenius — specialized. - --Direct from sub-helper 109 + sub-helper 107: for the addition-pullback -+Differentiating the addition formula and using the vanishing Frobenius differential gives, for the addition-pullback - under negFrobenius, `D(addPullback_x) = (2·ℓ + a₁) • D(ℓ) - D(x_gen)` - where ℓ = addSlope W (negFrobeniusIsog W). - -@@ -2473,7 +2346,7 @@ theorem kaehler_D_addPullback_x_negFrobenius - (kaehler_D_negFrobeniusIsog_pullback_x_gen W p) - - omit [Fintype K] in --/-- **Route B core (III.5.2), general slope-differential formula** (no `D(α*x)=0` -+/-- **General slope-differential formula** (no `D(α*x)=0` - hypothesis): for any `α`, the Kähler differential of the `id + α` addition-pullback - x-coordinate is the slope term minus `D(x_gen)` minus `D(α*x)`. Generalizes - `kaehler_D_addPullback_x_via_slope_witness` (which drops the last term under the -@@ -2502,19 +2375,8 @@ theorem kaehler_D_addPullback_x_general - rw [show (2 : ℕ) • (ℓ • D ℓ) = ((2 : KE)) • (ℓ • D ℓ) from - (Nat.cast_smul_eq_nsmul (R := KE) 2 _).symm, smul_smul] - --/-- **Sub-helper 111** (ω(γ) = 1 via Kähler witness). -- --Closing-arc witness consumer: given that -- `(α*(u))⁻¹ • D(addPullback_x) = invariantDifferential` --(equivalently, `α*(u) • ω = D(addPullback_x)` for ω = invariantDifferential), --conclude `omegaPullbackCoeff(γ) = 1`. Direct from --`omegaPullbackCoeff_spec` + `omegaPullbackCoeff_unique`. -- --The hypothesis is the SUBSTANTIVE Kähler identity in K(E) that III.5.2 / IV.1.4 --carries out: relating the slope's differential to the addition-pullback's --differential. Once this identity is closed (via, e.g., the curve equation --matching at orderTop -6 and the slope-of-formal-identity lemma), `ω(γ) = 1` --follows axiom-clean and the Hasse-Weil bound discharges via sub-helper 103. -/ -+/-- The Kähler identity `(α*u)⁻¹ • D(α*x) = ω` gives differential coefficient one. -+This follows from the defining identity and uniqueness of the coefficient. -/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_kaehler_witness - (hq : 2 ≤ Fintype.card K) - (h_kaehler : -@@ -2528,12 +2390,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_kaehler_witness - simp only [x_gen] at h_kaehler - exact h_kaehler - --/-- **Sub-helper 113** (Kähler ω(γ) = 1 via pullbackKaehler witness — closing-arc). -- --The cleaner reformulation of sub-helper 111 using `pullbackKaehler` directly: --given `γ.pullbackKaehler ω = ω`, conclude `omegaPullbackCoeff(γ) = 1`. -- --Direct from `pullbackKaehler_invariantDifferential` + `omegaPullbackCoeff_unique`. -/ -+/-- An isogeny fixing the invariant differential has differential coefficient one. -+-/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_pullbackKaehler_witness - (hq : 2 ≤ Fintype.card K) - (h_pK : (isogOneSub_negFrobenius W hq).pullbackKaehler -@@ -2544,7 +2402,7 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_pullbackKaehler_wi - exact h_pK - - omit [Fintype K] in --/-- **Sub-helper 114** (id.pullbackKaehler ω = ω, axiom-clean). -+/-- id.pullbackKaehler ω = ω. - - The identity isogeny acts trivially on the invariant differential. Direct - from `pullbackKaehler_invariantDifferential (Isogeny.id W.toAffine)` + -@@ -2554,28 +2412,15 @@ theorem pullbackKaehler_invariantDifferential_id : - invariantDifferential W.toAffine := by - rw [Isogeny.pullbackKaehler_invariantDifferential, omegaPullbackCoeff_id, one_smul] - --/-- **Sub-helper 115** ((-π).pullbackKaehler ω = 0, axiom-clean). -- --The negation-of-Frobenius isogeny annihilates the invariant differential --(at the cotangent level). Direct from `pullbackKaehler_invariantDifferential --(negFrobeniusIsog W)` + `omegaPullbackCoeff_negFrobeniusIsog = 0` --(Differential.lean line 430, axiom-clean). -/ -+/-- Negative Frobenius annihilates the invariant differential, because its -+invariant-differential coefficient is zero. -/ - theorem pullbackKaehler_invariantDifferential_negFrobeniusIsog : - (negFrobeniusIsog W).pullbackKaehler (invariantDifferential W.toAffine) = 0 := by - rw [Isogeny.pullbackKaehler_invariantDifferential, - omegaPullbackCoeff_negFrobeniusIsog, zero_smul] - --/-- **Sub-helper 116** (γ.pullbackKaehler ω = ω via III.5.2 additivity witness — axiom-clean). -- --Given the III.5.2 additivity at the differential level for our specific --decomposition `γ = id + (-π)`: -- `γ.pullbackKaehler ω = id.pullbackKaehler ω + (-π).pullbackKaehler ω`, --combine with sub-helpers 114-115 (axiom-clean: `id.pullbackKaehler ω = ω` and --`(-π).pullbackKaehler ω = 0`) to conclude `γ.pullbackKaehler ω = ω + 0 = ω`. -- --This is the closing-arc commit: the only remaining substantive input is the --III.5.2 differential additivity for our specific case, which is the III.5.2 --content for elliptic curve isogenies. -/ -+/-- Differential additivity for `id + (-π)` gives pullback of the invariant differential -+equal to itself, since the identity fixes it and negative Frobenius annihilates it. -/ - theorem pullbackKaehler_invariantDifferential_isogOneSub_negFrobenius_via_additivity_witness - (hq : 2 ≤ Fintype.card K) - (h_add : (isogOneSub_negFrobenius W hq).pullbackKaehler -@@ -2587,11 +2432,8 @@ theorem pullbackKaehler_invariantDifferential_isogOneSub_negFrobenius_via_additi - rw [h_add, pullbackKaehler_invariantDifferential_id W, - pullbackKaehler_invariantDifferential_negFrobeniusIsog W, add_zero] - --/-- **Sub-helper 117** (ω(γ) = 1 via III.5.2 additivity witness — closing-arc). -- --Composes sub-helper 113 (Kähler witness → ω(γ) = 1) with sub-helper 116 --(III.5.2 additivity → γ.pullbackKaehler ω = ω). The single substantive --input is the III.5.2 differential additivity for our specific decomposition. -/ -+/-- Additivity of the pullback of the invariant differential for `id + (-π)` gives -+differential coefficient one. -/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_additivity_witness - (hq : 2 ≤ Fintype.card K) - (h_add : (isogOneSub_negFrobenius W hq).pullbackKaehler -@@ -2603,20 +2445,9 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_additivity_witness - (pullbackKaehler_invariantDifferential_isogOneSub_negFrobenius_via_additivity_witness - W hq h_add) - --/-- **Sub-helper 119** (Kähler witness via slope-derivative witness — closing-arc). -- --Given `D(addSlope W (negFrobeniusIsog W)) = c • D(x_gen)` for some `c : K(E)` --(derived from differentiating the slope formula `(y_gen - π·y) / (x_gen - π·x)` --with the Frobenius differential vanishing — sub-helpers 107, 108) and the --algebraic identity in K(E): -- `(2ℓ + a₁) · c - 1 = (alpha_star_u γ) · u_gen⁻¹` --(equivalently, after clearing denominators: the K(E) identity that the III.5.2 --content carries out), conclude the Kähler witness needed by sub-helper 111. -- --This factors the III.5.2 differential additivity through an explicit K(E) --identity. The slope-derivative witness is the Kähler-differential form of --the curve-tangent calculation; the K(E) identity is the substantive arithmetic --content of III.5.2 for our `id + (-π)` decomposition. -/ -+/-- A slope derivative `D(ℓ) = c • D(x)` and the coefficient identity -+`((2ℓ + a₁)c - 1)u = α*u` imply `(α*u)⁻¹ • D(α*x) = ω` for `α = 1 − π`. -+This expresses differential additivity through an identity in the function field. -/ - theorem kaehler_witness_via_slope_deriv_witness - (p : ℕ) [Fact p.Prime] [CharP K p] - (hq : 2 ≤ Fintype.card K) -@@ -2665,14 +2496,8 @@ theorem kaehler_witness_via_slope_deriv_witness - linear_combination h_KE_identity - - omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in --/-- **Sub-helper 120** (Weierstrass equation in K(E), axiom-clean): --`y_gen² + a₁·x_gen·y_gen + a₃·y_gen = x_gen³ + a₂·x_gen² + a₄·x_gen + a₆` --in K(E). Direct from the affine equation `Affine.Equation` for the generic --point on `W_KE`, with W_KE coefficients lifted to algebraMap form. -- --This is the foundational K(E) identity that the curve-equation Kähler --differential identity (sub-helper 121) builds upon. No derivation involved --yet — purely the equation in K(E). -/ -+/-- The generic coordinates satisfy the Weierstrass equation in the function field. -+-/ - theorem weierstrass_equation_in_KE : - y_gen W ^ 2 + algebraMap K KE W.a₁ * x_gen W * y_gen W + - algebraMap K KE W.a₃ * y_gen W = -@@ -2684,14 +2509,8 @@ theorem weierstrass_equation_in_KE : - exact h_gen - - omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in --/-- **Sub-helper 121** (Kähler form of curve equation, axiom-clean foundation): --literal D-application of the Weierstrass equation in K(E): --`D(y² + a₁xy + a₃y) = D(x³ + a₂x² + a₄x + a₆)` in `Ω[K(E)/K]`. -- --Direct from `congrArg D` applied to `weierstrass_equation_in_KE` (sub-helper --120). The substantive Kähler identity `(a₃ + 2y + a₁x)·Dy = (3x² + 2a₂x + --a₄ - a₁y)·Dx` follows by Leibniz expansion; the explicit ℕ-smul ↔ KE-smul --conversion in that expansion is technical and deferred. -/ -+/-- Applying the universal derivation to the generic Weierstrass equation gives -+`D(y² + a₁xy + a₃y) = D(x³ + a₂x² + a₄x + a₆)` in `Ω[K(E)/K]`. -/ - theorem kaehler_D_weierstrass_equation_K_E : - KaehlerDifferential.D K W.toAffine.FunctionField - (y_gen W ^ 2 + -@@ -2706,9 +2525,8 @@ theorem kaehler_D_weierstrass_equation_K_E : - (weierstrass_equation_in_KE W) - - omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in --/-- **Sub-helper 122** (D(y²) via pow_two — axiom-clean KE-smul-only): --`D(y_gen²) = y_gen • D(y_gen) + y_gen • D(y_gen)`. Wall-break: avoids --`Derivation.leibniz_pow`'s ℕ-smul. -/ -+/-- D(y²) via pow_two — KE-smul-only: -+`D(y_gen²) = y_gen • D(y_gen) + y_gen • D(y_gen)`. The product rule expresses both summands using function-field scalar multiplication. -/ - theorem kaehler_D_y_gen_sq : - KaehlerDifferential.D K W.toAffine.FunctionField (y_gen W ^ 2) = - y_gen W • KaehlerDifferential.D K W.toAffine.FunctionField (y_gen W) + -@@ -2717,7 +2535,7 @@ theorem kaehler_D_y_gen_sq : - (KaehlerDifferential.D K W.toAffine.FunctionField).leibniz (y_gen W) (y_gen W)] - - omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in --/-- **Sub-helper 123** (D(x²) via pow_two — axiom-clean): -+/-- D(x²) via pow_two —: - `D(x_gen²) = x_gen • D(x_gen) + x_gen • D(x_gen)`. -/ - theorem kaehler_D_x_gen_sq : - KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W ^ 2) = -@@ -2727,7 +2545,7 @@ theorem kaehler_D_x_gen_sq : - (KaehlerDifferential.D K W.toAffine.FunctionField).leibniz (x_gen W) (x_gen W)] - - omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in --/-- **Sub-helper 124** (D(x³) via pow expansion + leibniz — axiom-clean): -+/-- D(x³) via pow expansion + leibniz —: - `D(x_gen³) = x_gen² • D(x_gen) + x_gen • D(x_gen²)`. -/ - theorem kaehler_D_x_gen_cube : - KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W ^ 3) = -@@ -2739,9 +2557,8 @@ theorem kaehler_D_x_gen_cube : - (KaehlerDifferential.D K W.toAffine.FunctionField).leibniz (x_gen W ^ 2) (x_gen W)] - - omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in --/-- **Sub-helper 125** (D-distribution of Weierstrass equation LHS, axiom-clean): --fully Leibniz-expanded LHS in KE-smul-only form. Uses sub-helper 122 (D(y²) --bypass) + Derivation.leibniz + D.map_algebraMap. -/ -+/-- Applying the product rule to the left-hand side of the Weierstrass equation gives -+its expansion using function-field scalar multiplication. -/ - theorem kaehler_D_weierstrass_LHS_expanded : - KaehlerDifferential.D K W.toAffine.FunctionField - (y_gen W ^ 2 + -@@ -2770,8 +2587,8 @@ theorem kaehler_D_weierstrass_LHS_expanded : - simp only [smul_zero, add_zero] - - omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in --/-- **Sub-helper 126** (D-distribution of Weierstrass equation RHS, axiom-clean): --fully Leibniz-expanded RHS. Uses sub-helpers 123, 124. -/ -+/-- D-distribution of Weierstrass equation RHS: -+fully Leibniz-expanded RHS. The product rule expands the square and cube. -/ - theorem kaehler_D_weierstrass_RHS_expanded : - KaehlerDifferential.D K W.toAffine.FunctionField - (x_gen W ^ 3 + -@@ -2803,17 +2620,10 @@ theorem kaehler_D_weierstrass_RHS_expanded : - (KaehlerDifferential.D K W.toAffine.FunctionField).map_algebraMap W.a₆] - simp only [smul_zero, add_zero] - --/-- **Sub-helper 127** (curve-equation Kähler identity, axiom-clean): -- -+omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in -+/-- Differentiating the Weierstrass equation gives - `(a₃ + 2y + a₁x) • D(y) = (3x² + 2a₂x + a₄ - a₁y) • D(x)` in `Ω[K(E)/K]`. -- --Combines sub-helper 121 (D(LHS) = D(RHS) via congrArg) + 125 (LHS expansion) --+ 126 (RHS expansion) + `linear_combination`. All KE-smul throughout — --ℕ-smul wall bypassed via sub-helpers 122-124. -- --This is the SUBSTANTIVE K(E) Kähler identity. NO witnesses. Foundational --for sub-helper 128 (D(slope)) and the III.5.2 invariant-differential --additivity. -/ -+-/ - theorem kaehler_curve_equation_K_E : - (algebraMap K KE W.a₃ + (2 : KE) * y_gen W + - algebraMap K KE W.a₁ * x_gen W) • -@@ -2823,10 +2633,7 @@ theorem kaehler_curve_equation_K_E : - algebraMap K KE W.a₄ - - algebraMap K KE W.a₁ * y_gen W) • - KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) := by -- -- Sixth wall-break attempt: pre-rewrite goal `(2 : KE) * y_gen` to -- -- `y_gen + y_gen` using ring identities BEFORE expansion, eliminating the -- -- (2 : KE) literal at the source. Then both sides use only +-additive -- -- composition + KE-smul, no `(2 : ℕ)` casts anywhere. -+ -- Expand the integer coefficients as sums in the function field before differentiating. - set Dx := KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) - set Dy := KaehlerDifferential.D K W.toAffine.FunctionField (y_gen W) - -- Substitute literals with explicit sums in K(E). -@@ -2851,24 +2658,9 @@ theorem kaehler_curve_equation_K_E : - -- Now both sides are sums of (KE-coefficient) • (Dx or Dy). Match via abel. - linear_combination (norm := abel) h_eq - --/-- **Sub-helper 128** (D(addSlope) for negFrobenius — substantive K(E) identity, axiom-clean): -- --The Kähler derivative of `addSlope W (negFrobeniusIsog W) = --(y_gen - π·y) / (x_gen - π·x)` satisfies the closed-form identity: -- --``` --(x_gen - π·x)² • D(addSlope) = (x_gen - π·x) • D(y_gen) - (y_gen - π·y) • D(x_gen) --``` -- --where π·x = (negFrob).pullback x_gen, π·y = (negFrob).pullback y_gen. -- --Proof: apply `Derivation.leibniz_div` to `addSlope_negFrobeniusIsog_eq`, --simplify via `D(π·x) = 0` (sub-helper 107), `D(π·y) = 0` (sub-helper 108), --cancel Den² · Den⁻² = 1. -- --This is the SUBSTANTIVE K(E) Kähler identity for the addition slope — --NO witnesses, NO hypotheses beyond Mathlib's quotient rule and the --existing Frobenius-differential vanishing (axiom-clean). -/ -+/-- The quotient rule and vanishing of Frobenius differentials give -+`Den² • D(ℓ) = Den • D(y) - N • D(x)` for the addition slope, where -+`Den = x - (-π)*x` and `N = y - (-π)*y`. -/ - theorem kaehler_D_addSlope_negFrobenius - (p : ℕ) [Fact p.Prime] [CharP K p] : - (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 • -@@ -2902,7 +2694,7 @@ theorem kaehler_D_addSlope_negFrobenius - rw [one_smul] - - omit [Fintype K] in --/-- **Route B core (III.5.2), general slope differential** (no Frobenius flatness): for any `α` -+/-- **General slope differential** (no Frobenius flatness): for any `α` - with `x_gen ≠ α*x_gen` (non-doubling), the Kähler derivative of `addSlope = (y−α*y)/(x−α*x)` - satisfies `Den²·D(addSlope) = Den·(D(y)−D(α*y)) − N·(D(x)−D(α*x))` where `N = y−α*y`, - `Den = x−α*x`. Generalizes `kaehler_D_addSlope_negFrobenius` (which used `D(π*x)=D(π*y)=0`). -/ -@@ -2931,10 +2723,9 @@ theorem kaehler_D_addSlope_general - show Den ^ 2 * Den⁻¹ ^ 2 = 1 from by rw [← mul_pow, mul_inv_cancel₀ hDen_ne, one_pow], - one_smul] - --/-- **Sub-helper 129** (D(γ.pullback x_gen) cleared form, axiom-clean): -+/-- D(γ.pullback x_gen) cleared form: - --Combines sub-helper 110 (`D(addPullback_x) = (2ℓ + a₁) • D(ℓ) - D(x_gen)`) --with sub-helper 128 (`Den² • D(addSlope) = Den • D(y_gen) - N • D(x_gen)`) -+Combines the differentiated addition formula with the denominator-cleared slope derivative - to give a single closed-form identity for D(γ.pullback x_gen) involving - D(y_gen) and D(x_gen) (with Den² as the multiplier). - -@@ -2949,7 +2740,7 @@ where ℓ = addSlope, Den = x_gen - π·x, N = y_gen - π·y. - - This is the substantive D(γ.pullback x_gen) reduction in K(E), expressed - purely in terms of the curve generators' Kähler differentials and Den, N --without any inverses. Foundational for the III.5.2 cascade closure. -/ -+without any inverses. This is a differential form of Silverman III.5.2. -/ - theorem kaehler_D_addPullback_x_negFrobenius_cleared - (p : ℕ) [Fact p.Prime] [CharP K p] : - (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 • -@@ -2963,14 +2754,14 @@ theorem kaehler_D_addPullback_x_negFrobenius_cleared - KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W)) - - (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 • - KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) := by -- -- Multiply sub-helper 110 by Den² and use sub-helper 128. -+ -- Multiply the x-coordinate differential by Den² and substitute the slope derivative. - rw [kaehler_D_addPullback_x_negFrobenius W p, smul_sub, smul_smul] - rw [mul_comm ((x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2) - (2 * addSlope W (negFrobeniusIsog W) + algebraMap K KE W.a₁)] - rw [← smul_smul, kaehler_D_addSlope_negFrobenius W p, smul_sub] - - omit [Fintype K] in --/-- **Route B core (III.5.2), general cleared form**: combines `kaehler_D_addPullback_x_general` -+/-- **General cleared form**: combines `kaehler_D_addPullback_x_general` - with `kaehler_D_addSlope_general` to clear the `Den²` denominator from `D(addPullback_x)` for - arbitrary `α` (non-doubling). Generalizes `kaehler_D_addPullback_x_negFrobenius_cleared`. -/ - theorem kaehler_D_addPullback_x_general_cleared -@@ -3004,8 +2795,9 @@ theorem kaehler_D_x_gen_eq_u_smul_omega : - (u_gen W)⁻¹ • KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) from rfl, - smul_smul, mul_inv_cancel₀ (u_gen_ne_zero W), one_smul] - -+omit [Fintype K] [DecidableEq K] in - /-- **RB-ω2 leaf**: `D(y_gen) = (3x²+2a₂x+a₄−a₁y) • ω`. From the curve-equation differential --`u_gen·D(y) = (3x²+2a₂x+a₄−a₁y)·D(x)` (Sub-helper 121 chain) and `D(x) = u_gen·ω` (RB-ω1), -+`u_gen·D(y) = (3x²+2a₂x+a₄−a₁y)·D(x)` from the differentiated curve equation and `D(x) = u_gen·ω` , - dividing through by `u_gen ≠ 0`. Silverman III.5: the relation `(2y+a₁x+a₃)dy = - (3x²+2a₂x+a₄−a₁y)dx` from differentiating the Weierstrass equation. -/ - theorem kaehler_D_y_gen_eq_num_smul_omega : -@@ -3032,7 +2824,7 @@ omit [Fintype K] in - /-- **RB-ω3 leaf** (α-image differentials): for the omega coefficient - `a_α = omegaPullbackCoeff W α`, `D(α*x) = (α*u)·a_α·ω` and `D(α*y) = (α*num)·a_α·ω`. From - `omegaPullbackCoeff_spec` (`a_α•ω = (α*u)⁻¹•D(α*x)`) and the α-image curve-equation differential --(Sub-helper 121 at the pulled-back point `(α*x, α*y)`, also on the curve by `pullback_equation`). -/ -+(the differentiated curve equation at the pulled-back point `(α*x, α*y)`, also on the curve by `pullback_equation`). -/ - theorem kaehler_D_alpha_pullback_x_eq_smul_omega - (α : Isogeny W.toAffine W.toAffine) : - KaehlerDifferential.D K W.toAffine.FunctionField (α.pullback (x_gen W)) = -@@ -3049,6 +2841,7 @@ theorem kaehler_D_alpha_pullback_x_eq_smul_omega - rw [hspec, smul_smul, mul_inv_cancel₀ h_au_ne, one_smul] - rw [← key, smul_smul] - -+omit [Fintype K] in - /-- **RB-ω3b leaf** (α-image `D(y)`): `D(α*y) = (α*num)·a_α·ω`. From the α-image curve-equation - differential (apply `Isogeny.pullbackKaehler` to `kaehler_curve_equation_K_E` — `pullbackKaehler` is - α-semilinear and sends `D g ↦ D(α*g)`) + `kaehler_D_alpha_pullback_x_eq_smul_omega` (RB-ω3a), cancel -@@ -3094,6 +2887,7 @@ theorem kaehler_D_alpha_pullback_y_eq_smul_omega - congr 1 - ring - -+omit [Fintype K] in - /-- **RB-ω4 leaf (the III.5.2 ring collapse)**: for genuine α (x≠α*x), the differential of the - addition-pullback x-coordinate equals `addPullback_u • (1 + a_α) • ω`, where - `addPullback_u = 2·addPullback_y + a₁·addPullback_x + a₃` is the u-coordinate at the sum point. -@@ -3151,23 +2945,11 @@ theorem kaehler_D_addPullback_x_eq_one_add_smul_omega - (-(2 * (Y - PY) + c1 * (X - PX)) * (1 - omegaPullbackCoeff W α)) * hP + - ((2 * (Y - PY) + c1 * (X - PX)) * (1 - omegaPullbackCoeff W α)) * hαP - --/-- **Sub-helper 130** (D(addSlope) reduced to D(x_gen) via curve equation, axiom-clean): -- --Combines sub-helper 127 (curve equation Kähler identity) with sub-helper 128 --(D(slope) identity) to express D(addSlope) entirely in terms of D(x_gen): -- --``` --(u_gen · Den²) • D(addSlope) = (Den · num - u_gen · N) • D(x_gen) --``` -- --where: --- u_gen = a₃ + 2y + a₁x --- Den = x - π·x --- N = y - π·y --- num = 3x² + 2a₂x + a₄ - a₁y -- --Substantive K(E) Kähler identity — combines axiom-clean Path A sub-helpers --127 + 128. Foundational for ω(γ) = 1 via the Kähler-witness route. -/ -+/-- The differential of the addition slope satisfies -+`(u · Den²) • D(ℓ) = (Den · num - u · N) • D(x)`, where -+`u = a₃ + 2y + a₁x`, `num = 3x² + 2a₂x + a₄ - a₁y`, -+`Den = x - (-π)*x`, and `N = y - (-π)*y`. -+This combines the quotient rule with the differentiated curve equation. -/ - theorem kaehler_D_addSlope_via_curve_equation_negFrobenius - (p : ℕ) [Fact p.Prime] [CharP K p] : - ((algebraMap K KE W.a₃ + (2 : KE) * y_gen W + -@@ -3184,7 +2966,7 @@ theorem kaehler_D_addSlope_via_curve_equation_negFrobenius - algebraMap K KE W.a₁ * x_gen W) * - (y_gen W - (negFrobeniusIsog W).pullback (y_gen W))) • - KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) := by -- -- Multiply sub-helper 128 by u_gen' on the left, then substitute via 127. -+ -- Multiply the slope derivative by u, then substitute the differentiated curve equation. - have h_slope := kaehler_D_addSlope_negFrobenius W p - have h_curve := kaehler_curve_equation_K_E W - -- Step 1: multiply h_slope by u_gen' (smul-distribute). -@@ -3203,13 +2985,8 @@ theorem kaehler_D_addSlope_via_curve_equation_negFrobenius - -- Now collect smul forms. - rw [smul_smul, smul_smul, ← sub_smul] - --/-- **Sub-helper 131** (`alpha_star_u` computed explicitly for γ, axiom-clean): --the explicit form of `alpha_star_u (isogOneSub_negFrobenius W hq)` in K(E): --`α*(u) = 2·addPullback_y + a₁·addPullback_x + a₃`. -- --Direct from `alpha_star_u_eq` + sub-helpers 89b, 89c (axiom-clean --`γ.pullback x_gen = addPullback_x` and `γ.pullback y_gen = addPullback_y`) --+ `u_gen` definition. -/ -+/-- For `γ = 1 − π`, the pulled-back differential denominator is -+`α*u = 2·addPullback_y + a₁·addPullback_x + a₃`. -/ - theorem alpha_star_u_isogOneSub_negFrobenius - (hq : 2 ≤ Fintype.card K) : - alpha_star_u W (isogOneSub_negFrobenius W hq) = -@@ -3233,13 +3010,13 @@ theorem alpha_star_u_isogOneSub_negFrobenius - rw [(isogOneSub_negFrobenius W hq).pullback.commutes W.a₁, - (isogOneSub_negFrobenius W hq).pullback.commutes W.a₃] - --/-- **Sub-helper 132** (α*(u) + u_gen identity in K(E), axiom-clean): -+/-- α*(u) + u_gen identity in K(E): - - `α*(u) + u_gen = -(2ℓ + a₁) · (addPullback_x - x_gen)` in K(E) - - where ℓ = addSlope W (negFrobeniusIsog W). - --Proof: substitute α*(u) = 2·addPullback_y + a₁·addPullback_x + a₃ (sub-helper 131) -+Proof: substitute α*(u) = 2·addPullback_y + a₁·addPullback_x + a₃ - and addPullback_y via Affine.addY/negY/negAddY definitional unfoldings, - then verify by ring algebra in K(E). - -@@ -3247,8 +3024,7 @@ This is the substantive K(E) identity that simplifies the RHS of the - target Kähler-witness identity to: - `(α*(u) + u_gen) · Den² = -(2ℓ + a₁) · (addPullback_x - x_gen) · Den²`. - --Combined with sub-helper 130 (LHS reduction), the target K(E) identity --becomes a sub-divisible polynomial identity. -/ -+Together with the slope derivative formula, this reduces differential additivity to a polynomial identity. -/ - theorem alpha_star_u_plus_u_gen_negFrobenius - (hq : 2 ≤ Fintype.card K) : - alpha_star_u W (isogOneSub_negFrobenius W hq) + u_gen W = -@@ -3266,7 +3042,7 @@ theorem alpha_star_u_plus_u_gen_negFrobenius - rw [h_a1, h_a2, h_a3] - ring - --/-- **Sub-helper 133** (curve equation for π·(x_gen, y_gen) in K(E), axiom-clean): -+/-- curve equation for π·(x_gen, y_gen) in K(E): - - The π-shifted Weierstrass equation in K(E): - `(π·y)² + a₁(π·x)(π·y) + a₃(π·y) = (π·x)³ + a₂(π·x)² + a₄(π·x) + a₆` -@@ -3274,7 +3050,7 @@ The π-shifted Weierstrass equation in K(E): - where π·x = (negFrob).pullback x_gen, π·y = (negFrob).pullback y_gen. - - Proof: apply `(negFrobeniusIsog W).pullback` (a K-algebra hom) to --`weierstrass_equation_in_KE` (sub-helper 120). The hom respects + and * -+`weierstrass_equation_in_KE`. The hom respects + and * - and fixes algebraMap-images of K, so the equation transforms term-by-term. -/ - theorem weierstrass_equation_pi_negFrobenius : - (negFrobeniusIsog W).pullback (y_gen W) ^ 2 + -@@ -3296,7 +3072,7 @@ theorem weierstrass_equation_pi_negFrobenius : - AlgHom.commutes (negFrobeniusIsog W).pullback] at h_pi - exact h_pi - --/-- **Sub-helper 134** (substantive K(E) polynomial identity for III.5.2, axiom-clean): -+/-- substantive K(E) polynomial identity for III.5.2: - - The K(E) ring identity that closes the Kähler-witness route to ω(γ) = 1: - -@@ -3316,7 +3092,7 @@ where: - - Proof: substitute the slope formula `ℓ = (y - π·y)/(x - π·x)` (squared and - multiplied by Den² gives the polynomial form), then close via --`linear_combination` with the two curve equations (sub-helpers 120 + 133) -+`linear_combination` with the two curve equations - as multipliers. The identity holds because γ = id - π is a curve isogeny, - which respects the curve equation. - -@@ -3342,7 +3118,7 @@ theorem kaehler_witness_polynomial_identity_negFrobenius : - have h_curve_pi := weierstrass_equation_pi_negFrobenius W - linear_combination -h_curve + h_curve_pi - --/-- **Sub-helper 135** ((addPullback_x - x_gen) · Den² polynomial form, axiom-clean): -+/-- (addPullback_x - x_gen) · Den² polynomial form: - - ``` - (addPullback_x - x_gen) · Den² = -@@ -3355,7 +3131,7 @@ slope formula `ℓ = (y - π·y) / (x - π·x)` giving `ℓ · (x - π·x) = (y - hence `ℓ² · (x - π·x)² = (y - π·y)²` and `ℓ · (x - π·x)² = (y - π·y) · (x - π·x)`. - - Substantive polynomial-form bridge between the slope-divisor identity --and the curve-equation polynomial identity (sub-helper 134). -/ -+and the curve-equation polynomial identity. -/ - theorem addPullback_x_sub_x_gen_mul_Den_sq_negFrobenius : - (addPullback_x W (negFrobeniusIsog W) - x_gen W) * - (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 = -@@ -3394,18 +3170,8 @@ theorem addPullback_x_sub_x_gen_mul_Den_sq_negFrobenius : - algebraMap K KE W.a₁ * - (x_gen W - (negFrobeniusIsog W).pullback (x_gen W))) * h_slope_lin - --/-- **Sub-helper 136** (curve-equation form of K(E) Kähler-witness identity, axiom-clean): -- --``` --Den · num - u_gen · N + (addPullback_x - x_gen) · Den² = 0 --``` -- --Combines sub-helper 134 (polynomial form identity) with sub-helper 135 --(`(addPullback_x - x_gen) · Den² = polynomial form`) to give the K(E) --identity in the form needed by the Kähler-witness consumer. -- --This is THE identity that closes ω(γ) = 1 / Witness #1 / III.5.2 via --the Kähler witness route. -/ -+/-- The two curve equations and the addition formula give -+`Den · num - u · N + (addPullback_x - x) · Den² = 0` in the function field. -/ - theorem kaehler_witness_curve_form_negFrobenius : - (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) * - ((3 : KE) * x_gen W ^ 2 + -@@ -3420,14 +3186,8 @@ theorem kaehler_witness_curve_form_negFrobenius : - rw [addPullback_x_sub_x_gen_mul_Den_sq_negFrobenius W] - exact kaehler_witness_polynomial_identity_negFrobenius W - --/-- **Sub-helper 137** (K(E) coefficient identity for Kähler witness, axiom-clean): --the K(E) coefficient identity that closes the Kähler-witness chain: -- --``` --(2ℓ + a₁) · (Den · num - u_gen · N) = (α*(u) + u_gen) · Den² --``` -- --Combines sub-helpers 132 + 136 axiom-clean. -/ -+/-- The addition formulas and curve equations give the coefficient identity -+`(2ℓ + a₁)(Den · num - u · N) = (α*u + u) · Den²`. -/ - theorem kaehler_witness_coefficient_identity_negFrobenius - (hq : 2 ≤ Fintype.card K) : - ((2 : KE) * addSlope W (negFrobeniusIsog W) + -@@ -3443,7 +3203,7 @@ theorem kaehler_witness_coefficient_identity_negFrobenius - (alpha_star_u W (isogOneSub_negFrobenius W hq) + u_gen W) * - (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 := by - rw [alpha_star_u_plus_u_gen_negFrobenius W hq] -- -- Use sub-helper 136 (curve-form K(E) identity, axiom-clean): -+ -- The curve-form identity gives: - -- Den·num - u_gen·N + (addPullback_x - x_gen)·Den² = 0. - -- Multiply by (2ℓ+a₁) to get: (2ℓ+a₁)·(Den·num - u_gen·N + (addPullback_x - x_gen)·Den²) = 0. - -- Rearrange to: (2ℓ+a₁)·(Den·num - u_gen·N) = -(2ℓ+a₁)·(addPullback_x - x_gen)·Den². -@@ -3451,16 +3211,9 @@ theorem kaehler_witness_coefficient_identity_negFrobenius - linear_combination - (2 * addSlope W (negFrobeniusIsog W) + algebraMap K KE W.a₁) * h_136 - --/-- **Sub-helper 138** (ω(γ) = 1 axiom-clean — Witness #1 omega-coefficient). -- --Instantiates `kaehler_witness_via_slope_deriv_witness` with the explicit --witness `c := (Den · num - u · N) / (u · Den²)`, where `u = a₃ + 2y + a₁x`, --`Den = x - π·x`, `N = y - π·y`, `num = 3x² + 2a₂x + a₄ - a₁y`. -- --The slope-deriv witness `D(addSlope) = c • D(x_gen)` follows from sub-helper --130 by smul-cancelling `u · Den²`. The K(E) coefficient identity --`((2ℓ + a₁) · c - 1) · u_gen = α*(u)` follows from sub-helper 137 by --field-simplification + linear_combination. -/ -+/-- The invariant-differential coefficient of `1 − π` is one. -+The slope derivative has coefficient `c = (Den · num - u · N)/(u · Den²)` relative -+to `D(x)`, and the two curve equations give `((2ℓ + a₁)c - 1)u = α*u`. -/ - theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one - (p : ℕ) [Fact p.Prime] [CharP K p] - (hq : 2 ≤ Fintype.card K) : -@@ -3496,11 +3249,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one - sub_eq_iff_eq_add, div_eq_iff huDen_ne] - linear_combination u * h_137 - --/-- **Sub-helper 139** (Witness #1 axiom-clean — IsSeparable γ). -- --Composes sub-helper 138 (ω(γ) = 1 axiom-clean) with --`isogOneSub_negFrobenius_isSeparable_of_h_coeff_only` (T-II-4-004 absorbed, --axiom-clean) to produce the unconditional Witness #1 of the Hasse-Weil bound. -/ -+/-- The isogeny `1 − π` is separable, because its invariant-differential coefficient -+is one. -/ - theorem isogOneSub_negFrobenius_isSeparable - (p : ℕ) [Fact p.Prime] [CharP K p] - (hq : 2 ≤ Fintype.card K) : -@@ -3607,7 +3357,7 @@ rule (`kaehler_D_addSlopePair_clearDenomSq`) with the `addX` Leibniz expansion - (`kaehler_D_addPullback_x_pair_via_slope`) into a single denominator-free expression for - `(X₁ - X₂)² • D(addPullback_x_pair)`. A leaf of - `kaehler_D_addPullback_x_pair_eq_smul_omega`. -/ --private theorem kaehler_D_addPullback_x_pair_clearDenomSq -+theorem kaehler_D_addPullback_x_pair_clearDenomSq - (α₁ α₂ : Isogeny W.toAffine W.toAffine) - (h_ne : α₁.pullback (x_gen W) ≠ α₂.pullback (x_gen W)) : - (α₁.pullback (x_gen W) - α₂.pullback (x_gen W)) ^ 2 • -@@ -3641,7 +3391,7 @@ unfolding `addPullback_x/y_pair` and `alpha_star_u`, substituting the two pullba - equations (`pullback_equation α₁/α₂`), clearing the denominator, and closing with the free-variable - algebra core `kaehler_D_addPullback_x_pair_ring_identity`. The scalar half of - `kaehler_D_addPullback_x_pair_eq_smul_omega`. -/ --private theorem kaehler_D_addPullback_x_pair_coeff_collapse -+theorem kaehler_D_addPullback_x_pair_coeff_collapse - (α₁ α₂ : Isogeny W.toAffine W.toAffine) - (h_ne : α₁.pullback (x_gen W) ≠ α₂.pullback (x_gen W)) : - (2 * addSlopePair α₁ α₂ + algebraMap K KE W.a₁) * -@@ -3691,6 +3441,7 @@ private theorem kaehler_D_addPullback_x_pair_coeff_collapse - (omegaPullbackCoeff W α₁) (omegaPullbackCoeff W α₂) (algebraMap K KE W.a₂) - (algebraMap K KE W.a₃) (algebraMap K KE W.a₄) (algebraMap K KE W.a₆) hα₁ hα₂ - -+omit [Fintype K] in - /-- **General-pair III.5.2 differential collapse**: for genuine pairs (`α₁*x ≠ α₂*x`), the - differential of the pair addition `x`-coordinate is - `u₃ • ((a_{α₁} + a_{α₂}) • ω)`, where `u₃ = 2·addPullback_y_pair + a₁·addPullback_x_pair + a₃` -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/DiffQuotientRule.lean b/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/DiffQuotientRule.lean -index 218313002..5de8144cd 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/DiffQuotientRule.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/DiffQuotientRule.lean -@@ -22,6 +22,7 @@ variable (E : Affine F) [E.IsElliptic] - local notation "KE" => E.FunctionField - - omit [DecidableEq F] in -+omit [WeierstrassCurve.IsElliptic E] in - /-- `D(f⁻¹) = -f⁻² • D(f)` for nonzero `f ∈ K(E)`. -/ - theorem D_inv_smul (f : KE) (hf : f ≠ 0) : - KaehlerDifferential.D F KE f⁻¹ = -@@ -36,7 +37,7 @@ theorem D_inv_smul (f : KE) (hf : f ≠ 0) : - _ = f⁻¹ • (-(f⁻¹ • D f)) := by rw [h3] - _ = -(f⁻¹ ^ 2 • D f) := by rw [smul_neg, smul_smul, ← sq] - --omit [DecidableEq F] in -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic E] in - /-- `D(f * g⁻¹) = g⁻¹ • D(f) + (stuff involving D(g))`. Leibniz + inverse rule. -/ - theorem D_mul_inv_smul (f g : KE) (hg : g ≠ 0) : - KaehlerDifferential.D F KE (f * g⁻¹) = -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/EllipticDivisibilitySequence.lean b/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/EllipticDivisibilitySequence.lean -index b07632812..bf6d0816a 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/EllipticDivisibilitySequence.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/EllipticDivisibilitySequence.lean -@@ -12,21 +12,6 @@ import Mathlib.NumberTheory.EllipticDivisibilitySequence - import Mathlib.Tactic.IntervalCases - import Mathlib.Tactic.LinearCombination - --/-! --# Additional lemmas for elliptic divisibility sequences -- --This file provides definitions and lemmas about normalised elliptic divisibility sequences --that are not yet in mathlib. These are needed for the division polynomial / ZSMul development. -- --The key results are: --* `IsEllipticSequence.normEDS`: a normalised EDS is an elliptic sequence. --* `IsEllipticSequence.ext`: two elliptic sequences with the same first four terms are equal. --* `normEDS_two_three_two`: when `b = 2, c = 3, d = 2`, the normalised EDS is the identity. --* `complEDSAux₂`: auxiliary complement used in the `ω` definition. --* `redInvarDenom`, `redInvarNum`: reduced invariant decomposition. -- --Ported from the LutzNagell project (`LutzNagell/EllipticDivisibilitySequence.lean`). ---/ - - open scoped nonZeroDivisors - -@@ -417,12 +402,12 @@ theorem rel₄_of_anti_oddRec_evenRec (one : W 1 ∈ R⁰) (two : W 2 ∈ R⁰) - linarith only [hba] - obtain ⟨m, rfl|rfl⟩ := b.even_or_odd' - · have ea : Even a := by rw [← ha']; exact (even_two_mul _).add even_two -- simp_rw [cMin, dMin, if_pos ea] -+ simp_rw [cMin, dMin, ite_eq_left ea] - convert (rel₃_iff₄ W (m + 1) m 1).mp ((rel₃_iff_oddRec W m).mpr <| oddRec _ ?_) using 2 - all_goals linarith only [h6, ha'] - · have nea : ¬ Even a := by - rw [← ha', not_even_iff_odd]; convert odd_two_mul_add_one (m + 1) using 1; ring -- simp_rw [cMin, dMin, if_neg nea] -+ simp_rw [cMin, dMin, ite_eq_right nea] - convert (rel₄_iff_evenRec W (m + 1)).mpr (evenRec _ ?_) using 2 - all_goals linarith only [h6, ha'] - -@@ -623,9 +608,9 @@ lemma invarDenom_normEDS_two : - simp [EllSequence.invarDenom] - - lemma normEDS_six_eq_mul : normEDS b c d 6 = (normEDS b c d 5 - d ^ 2) * b * c := by -- rw [show (6 : ℤ) = 2 * 3 by rfl, ← normEDS_mul_complEDS₂, complEDS₂, if_neg (by decide)] -+ rw [show (6 : ℤ) = 2 * 3 by rfl, ← normEDS_mul_complEDS₂, complEDS₂, ite_eq_right (by decide)] - simp_rw [Int.reduceAdd, Int.reduceSub, normEDS_three, normEDS] -- rw [preNormEDS_one, preNormEDS_two, preNormEDS_four, if_neg (by decide)] -+ rw [preNormEDS_one, preNormEDS_two, preNormEDS_four, ite_eq_right (by decide)] - ring - - end NormEDSLemmas -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Basic.lean b/projects/HasseWeil/HasseWeil/Foundation/Basic.lean -index b2c035a234ea01cc215b69064d795adea7e2c888..31b9bd23d3724605cf874fab7e45adf87d019f61 100644 -GIT binary patch -delta 149 -zcmbPop6UH6rVT$CCl|9>Y+k}C%(OXyr;2fNDc?hu$>G9oljni4;^dor0+Yo=6egRC -zv~1oZGLdKV1C51(j9inqSSoH#v0iP*%B8ETkT5y1LUD3$)xyn<)vAn>m)E3j=B;(* -z0x}dQm$b`I=B?G7yrIiz^ZWK@=FQ8yrCGR3QsYw#7%Q6xKL#el{&hlaS!J&=&}hShiD#91=AxstSRUrY%Y-qEZ!)y<=zSdS^Sk -zwv%v3kOHd20ii82Q2rziQ6*4IS7-%-OAq{r1CRq!PlbRKQ9w$l1ch>7b{xkct$o_r -zH}k&t-Z$TSv+z~D`%(SHIy7ejwt$)}P4pQsvYM8_$y27H9GfDbu_V@jOdD7?Dbr10 -zDX@e+ImNgdv9K -zJuUO48AGE_Tr0B9NNQ_rYHAnT-R^F{+xN(i|1Fq`fK#2317M -zVTNDH@B$Bv*1d7zV?LLM%4C -zJa5Mab~`ULkN6u|YEoy`ILSDlxBpxp@I;ZK(?pFJj0#C?NXEIa^E&F3+foUzk)9BP -zvv^NKO)bk%tAO7^J+|BZO%p8DtY>p(AG-?_R$UIxDm)u0DR02V5(d#ZNdoa{A=TM_(O}k;Xxa3X4I^Fl4;MS^ulF?BpIvWvzMOnR -z>8cnsY=4^A=`1|k)nFf4xy$~xq0Twa2k%?|X|V5KZGP|XSKIowCL%j?qr=Nwm<~FB -zV4raBtPwrnjIX@nt0<;Ryjusf5Clt*G6-u^k<) -zsS0>_2O30$4_i=&4|)sTZK%zCrxjf-n%o!L(bD=d-hra18dTwIC;Gh*3?NIwxrG4w -zwZ58zd!`$m^H)95_aK_Ct9oKFg5FiCo){lO{}xFtzBvDzGtduldo9@Jo_P!{*EEsS -zS*%6Gb3%B*7(+u6c-@WaIl@h{F+AN5#t=fSWx simp - | tmul x y => simp [KaehlerDifferential.mapBaseChange_tmul, h_map_zero] - | add x y hx hy => simp [map_add, hx, hy] - --/-- **T-II-4-004 forward direction (axiom-clean)**: if `α` is separable, --then `omegaPullbackCoeff W α ≠ 0`. -- --Pipeline: `IsSeparable → Subsingleton Ω[K(E)/K(E)_α]` → --`mapBaseChange surjective` (via the type synonym) → in particular, --`invariantDifferential ∈ image(mapBaseChange)` (cotangent exact sequence). --A nonzero image element forces `α.pullbackKaehler` not-identically-zero, --which (with the 1-dim Ω structure) forces `omegaPullbackCoeff ≠ 0`. -/ - theorem isogeny_omegaCoeff_ne_zero_of_isSeparable - (α : Isogeny W.toAffine W.toAffine) - (h_sep : α.IsSeparable) : -@@ -761,7 +556,7 @@ theorem isogeny_omegaCoeff_ne_zero_of_isSeparable - have h_pK_zero : ∀ ω' : Ω[W.toAffine.FunctionField⁄F], - α.pullbackKaehler ω' = 0 := - pullbackKaehler_eq_zero_of_omegaPullbackCoeff_eq_zero W α h_zero -- haveI : Subsingleton (Ω[W.toAffine.FunctionField⁄IsogenyAlgebraSource W α]) := -+ have : Subsingleton (Ω[W.toAffine.FunctionField⁄IsogenyAlgebraSource W α]) := - (isogeny_subsingleton_via_synonym_eq W α).mpr - (isogeny_subsingleton_kaehler_of_isSeparable W α h_sep) - have h_surj : Function.Surjective (KaehlerDifferential.mapBaseChange F -@@ -779,12 +574,6 @@ theorem isogeny_omegaCoeff_ne_zero_of_isSeparable - rw [h_mbc_zero, LinearMap.zero_apply] at ht - exact (invariantDifferential_ne_zero W.toAffine) ht.symm - --/-- **T-II-4-004 reverse direction (witness-parametric on FiniteDim only, --axiom-clean)**: if `omegaPullbackCoeff W α ≠ 0` and `K(E)` is finite-dimensional --over `K(E)_α` (Witness #2), then `α` is separable. -- --Combines the cotangent-sequence bridge (omega-coeff ≠ 0 → Subsingleton) with the --algebra-Kähler reverse direction (Subsingleton + FiniteDim → IsSeparable). -/ - theorem isogeny_isSeparable_of_omegaCoeff_ne_zero_finiteDim - (α : Isogeny W.toAffine W.toAffine) - (h_coeff : omegaPullbackCoeff W α ≠ 0) -@@ -796,14 +585,6 @@ theorem isogeny_isSeparable_of_omegaCoeff_ne_zero_finiteDim - (isogeny_subsingleton_kaehler_of_omegaCoeff_ne_zero W α h_coeff)) - h_fin - --/-- **T-II-4-004 full iff (witness-parametric on FiniteDim only, axiom-clean)**: --the deliverable iff `α.IsSeparable ↔ omegaPullbackCoeff W α ≠ 0` modulo only --the Witness #2 hypothesis (FiniteDimensional). -- --Combines the forward direction (no extra hypothesis) and the reverse direction --(needs FiniteDim). -- --Once Witness #2 discharges unconditionally, the full T-II-4-004 lands. -/ - theorem isSeparable_iff_omegaPullbackCoeff_ne_zero_of_finiteDim - (α : Isogeny W.toAffine W.toAffine) - (h_fin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField -@@ -812,16 +593,6 @@ theorem isSeparable_iff_omegaPullbackCoeff_ne_zero_of_finiteDim - ⟨isogeny_omegaCoeff_ne_zero_of_isSeparable W α, - fun h ↦ isogeny_isSeparable_of_omegaCoeff_ne_zero_finiteDim W α h h_fin⟩ - --/-- **T-II-4-004 reverse direction (axiom-clean, unconditional)**: if the --differential pullback `α.pullbackKaehler` is injective on `Ω[K(E)/F]`, then `α` --is separable. -- --Discharge path: --* Witness #2 (`FiniteDimensional` of `K(E)/(image)`) — gives `EssFiniteType`. --* Connection from `omegaPullbackCoeff ≠ 0` (the scalar form of injectivity) -- to `Subsingleton Ω[K(E)/(image)]` (the algebra-side condition). --* Mathlib's `Algebra.FormallyUnramified.iff_isSeparable` for the final -- conclusion. -/ - theorem isogeny_isSeparable_of_pullbackKaehler_injective - (α : Isogeny W.toAffine W.toAffine) - (h_inj : Function.Injective α.pullbackKaehler) : -@@ -830,14 +601,6 @@ theorem isogeny_isSeparable_of_pullbackKaehler_injective - ((pullbackKaehler_injective_iff_omegaPullbackCoeff_ne_zero W α).mp h_inj) - (isogeny_finiteDimensional W α) - --/-- **T-II-4-004 algebra-Kähler half (axiom-clean)**: an isogeny `α` is separable --(in the `Algebra.IsSeparable` sense) iff its differential pullback --`α.pullbackKaehler` is injective on `Ω[K(E)/F]`. -- --This is the substantive Silverman II.4.2(c) algebra-Kähler glue. --The forward direction: `Algebra.IsSeparable → FormallyUnramified --→ Ω[K(E)/(image)] = 0 → cotangent surjective → pullbackKaehler injective`. --The reverse: the converse chain via `FormallyUnramified.iff_isSeparable`. -/ - theorem isSeparable_iff_pullbackKaehler_injective - (α : Isogeny W.toAffine W.toAffine) : - α.IsSeparable ↔ Function.Injective α.pullbackKaehler := -@@ -845,12 +608,6 @@ theorem isSeparable_iff_pullbackKaehler_injective - (isogeny_omegaCoeff_ne_zero_of_isSeparable W α h), - isogeny_isSeparable_of_pullbackKaehler_injective W α⟩ - --/-- **T-II-4-004 (elliptic curve form, deliverable target)**: separability of --an isogeny `α` is equivalent to its omega-pullback coefficient being nonzero --(equivalently, to the differential pullback `α*` being injective on --`Ω[K(E)/F]`). -- --Reference: Silverman II.4.2(c). -/ - theorem isSeparable_iff_omegaPullbackCoeff_ne_zero - (α : Isogeny W.toAffine W.toAffine) : - α.IsSeparable ↔ omegaPullbackCoeff W α ≠ 0 := -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Divisors.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Divisors.lean -index 272a5d45e..77de07569 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Divisors.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Divisors.lean -@@ -16,9 +16,6 @@ The divisor group `Div C` of a smooth plane curve `C` is the free abelian group - on its smooth points: a formal sum `Σ nₚ (P)` with integer coefficients that - are zero for all but finitely many points. - --This closes tickets `T-II-3-001` (`Divisor`) and `T-II-3-002` --(`Divisor.degree`, `Divisor.degreeHom`). -- - ## References - - * [Silverman, *The Arithmetic of Elliptic Curves*], II.3 (definition) -@@ -95,7 +92,7 @@ end Divisor - noncomputable abbrev Divisor₀ (C : SmoothPlaneCurve F) : AddSubgroup (Divisor C) := - Divisor.degZero C - --/-! ### `divisorOf f`: the principal divisor (T-II-3-005) -/ -+ - - namespace SmoothPlaneCurve - -@@ -116,7 +113,7 @@ noncomputable def divisorOf (C : SmoothPlaneCurve F) (f : C.FunctionField) : - rw [this]; exact Set.finite_empty - · refine (C.finite_setOf_ord_P_nonzero hf).subset ?_ - intro P hP -- simp only [Set.mem_setOf_eq] -+ simp only [Set.mem_ofPred_eq] - intro h0 - apply hP - simp [h0] -@@ -184,7 +181,7 @@ noncomputable def divisorHom (C : SmoothPlaneCurve F) : - congr 1 - exact C.divisorOf_mul u.ne_zero v.ne_zero - --/-! ### Principal divisors and linear equivalence (T-II-3-006) -/ -+ - - /-- A divisor `D` on `C` is **principal** if `D = div(f)` for some nonzero - rational function `f ∈ F(C)`. Equivalently, `D` lies in the image of the -@@ -244,7 +241,7 @@ theorem LinearlyEquiv.trans {C : SmoothPlaneCurve F} {D₁ D₂ D₃ : Divisor C - rw [show D₁ - D₃ = (D₁ - D₂) + (D₂ - D₃) by abel] - exact h₁.add h₂ - --/-! ### T-II-3-008: constants have zero divisor -/ -+ - - /-- `ord_P` of an `F`-constant `c ≠ 0` is zero: a nonzero constant is a unit - at every smooth point (image of the F-subfield, which lives in the local -@@ -289,15 +286,11 @@ zeros or poles. -/ - refine Finsupp.ext fun P ↦ ?_ - rw [divisorOf_apply, C.ord_P_algebraMap_F_of_ne_zero hc P]; rfl - --/-! ### T-II-3-008 (⇒): `divisorOf = 0 ⇒ const` (prime-indexed via IC-006) -/ - --/-- **T-II-3-008 (⇒), prime-indexed**: if `f ∈ F(C)` has valuation at most 1 --at every nonzero prime of `C.CoordinateRing` **and** has nonnegative order at --infinity, then `f` is the image of a constant from `F`. This is the content --of Silverman II.3.1(a) `⇒` in the prime-indexed reformulation made available --by IC-006; the SmoothPoint-indexed statement follows once every nonzero --prime is in the image of `SmoothPoint.toHeightOneSpectrum` (the surjection --step under `[IsAlgClosed F]`, tracked separately). -/ -+ -+/-- If a function has valuation at most one at every nonzero prime of the -+coordinate ring and has nonnegative order at infinity, it is constant. -+This is the prime-indexed form of Silverman II.3.1(a). -/ - theorem const_of_valuation_le_one_of_ordAtInfty_nonneg - [IsIntegrallyClosed C.CoordinateRing] (f : C.FunctionField) - (h_primes : ∀ v : IsDedekindDomain.HeightOneSpectrum C.CoordinateRing, -@@ -306,7 +299,7 @@ theorem const_of_valuation_le_one_of_ordAtInfty_nonneg - ∃ c : F, f = algebraMap F C.FunctionField c := - C.const_of_no_poles_of_valuation_of_ordAtInfty f h_primes h_inf - --/-! ### Pic and Pic₀ (T-II-3-007) -/ -+ - - /-- The **Picard group** of `C`: divisors modulo principal divisors. - Silverman II.3 (definition). -/ -@@ -314,8 +307,7 @@ abbrev Pic (C : SmoothPlaneCurve F) : Type _ := - Divisor C ⧸ C.principalSubgroup - - /-- The **degree-zero Picard group** `Pic⁰(C)`: degree-zero divisors modulo --principal divisors (principal divisors automatically have degree zero by --Silverman II.3.1(b), tracked as T-II-3-009). -/ -+principal divisors (principal divisors have degree zero by Silverman II.3.1(b)). -/ - abbrev Pic₀ (C : SmoothPlaneCurve F) : Type _ := - (Divisor.degZero C) ⧸ (C.principalSubgroup.addSubgroupOf (Divisor.degZero C)) - -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/EffectiveSumReduce.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/EffectiveSumReduce.lean -index 03a560829..5a38ff39d 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/EffectiveSumReduce.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/EffectiveSumReduce.lean -@@ -92,6 +92,7 @@ omit [W.IsElliptic] in - @[simp] theorem listSum_cons (P : W.Point) (Ps : List W.Point) : - listSum W (P :: Ps) = P + listSum W Ps := rfl - -+omit [W.IsElliptic] in - /-- σ on the list-divisor equals the list sum. -/ - theorem projectiveDivisorSum_listToDivisor (Ps : List W.Point) : - projectiveDivisorSum W (listToDivisor W Ps) = listSum W Ps := by -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Miller.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Miller.lean -index 0cca33fbbad2caeffd72dbaa7a093fb8e19faddd..746ea1a153571d3a8d47b2d1a9b99a29dd929f72 100644 -GIT binary patch -delta 2890 -zcmai0+iw(A7|&@5mm#SrY$F%pD^_fEce%8PDFKAE)EdohfrOw5%<0V8og*{n3^TJ^ -zN@5nGCK^qMjyN$<6Z``Vu_XJVk!XDIi4dMmOcUdS58{LRz>D8GGuxe(Hok2;=X|%{ -zi?0$z;a|@gA9y_iaHY!xLh#&639l~$poK~mO*-S`}3w0128iLK6JjCo~77Z^B -zm9pRI{R8TLn!}_6iH6 -znpAxKiT>DIx4y+$ST>AtRu32}>91KuAy`s`>{0_GxpNROyJ6v6B$z{Y-yTm(QSX+DxO}#=EgT~Z;e~Gx988rw6ZOE562E -zmj%y;I2o5lT#7Lqc7U^;!*+@=4P$V&TvhZm7unca&c?G26TomVETeM9N`rR*)SO8< -z0!=D-=&gQ3c^M#? -zR*^ycVejUC<1}M%n!A|SqawrSVEp)oEy?B0WK&Y#LEf4F{ojjEubIFjN#A}lnC#y~ -zwzUlNA{Ir*v%WN;um>F9GIA-}Bc(D{**TUfDImo(-BGqEJ-4H!l&cDoGL-hJ6Ea|) -z`uaMu{}i*^=Xa2|2&p9f17x&i^O|N_q*Y=Z&_*(nPBaC15#l21>Jg!I(-qZKL&#E% -z3m&nOFI|+YA4ng8nL~jh5Xg?>C#QtpK-W5JB9Mf|H_bvpDTl&1v)M(CMrKQoa?w7t -zi%b%7Ci!U(89W9lDQbu%CIaTV+(*2@Y6MND@N^80QS&9Dt|+=&9Z~d?EdylF5yNt5 -zK&^-cJXDvLb`M$iWmpN?(F7*R&i0kvWFu*v(Pq}2Mm|-heV9RzN|+Fh)m~mNS``|f -zCj;NXGSF94?YdBPJM#>QywTLAZk^2pRIwXJXt^>e50DLMJ@*F5!!^2|uI*$2ifCdD -z5n=Wf+y~R3iFQ_lfjGU%tcc?*GYeF_Qrd(ERhNTDaN8mz#D(tT(otszoK -z&YvUelj|k&u&gwvMn%=G`@a}ra_?nQ*kvdSQ$Q>&qeb|YTm(TqhM;9(bLc*TN&D~pq%VbXksF~0Gc1~AXn1P4tBygfe|11p -z$jDJhuc2k^TZP}+FGTyh7f26j9T$kdL~p^;QE;}+H8+qZO%$T7`|%s0gCm<&BJ%?l -zGE`#jxnX21LGM-AE^`xYH2Hp(aH^#YtRwk3?Q=^Nj}HO0QL$%S{`oL@C5G90Hu9Bf -zt8q|!sro{1rE&C*mS1e28zbNJK0Q@KU(Q3UpISrHIna}@j*@3il#RSybCK#vy+e?M -zYB^y?h|KbpF|xSQN897a$QRW?HLax-R7&XVzf=-2y|ZOs<}~PP=__u@`oh_y>noa- -znIXhCuWoOnmJ3HH--XKr)wkj$4EQwjv9B`(Vz);{Za3G{)54jxI5qP+c8KGcbv>>=XJ28v$$=Sfk -z(+Ii;C!of*Ay!gvUVt(e|6fjgZy-wM<1FQFU!21V6rlU-5Q^CC{%D&8>C_9gi?Jt{ -zQV*3WLY5Lg#k;=47}#bp2i@O?V6Nrt*q9-3C;}x@*MX#niye+U*vB7uCEmy|dA?Pq -zq!vnd=29GTOadUKc#nKv4P3*mQF(HY^PT4FgZy<~)<5UKGRMh-uR(O=b -z#tz^>z!2+$oe>=?E&dMO>1tZ-S4mw~{$*NR4mbPYXT;BuKYj6EMsH2cZVa)o^g7zi -zQ3epmfM^q(#{M3&jNiO - -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/ProjectiveDivisor.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/ProjectiveDivisor.lean -index 42df6e4ba..40dbf3639 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/ProjectiveDivisor.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/ProjectiveDivisor.lean -@@ -233,7 +233,7 @@ theorem projectiveDivisorOf_apply_affine (f : C.FunctionField) (P : C.SmoothPoin - (ProjectiveSmoothPoint.infinity : ProjectiveSmoothPoint C) := by - intro h; nomatch h - rw [Finsupp.add_apply, Finsupp.single_eq_of_ne h_ne, add_zero, -- Finsupp.mapDomain_apply ProjectiveSmoothPoint.affine_injective -+ Finsupp.mapDomain_apply_of_injective ProjectiveSmoothPoint.affine_injective - (C.divisorOf f) P, C.divisorOf_apply] - - theorem projectiveDivisorOf_apply_infinity (f : C.FunctionField) : -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/PushforwardDivisor.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/PushforwardDivisor.lean -index 37f06f385..9d556ad1d 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/PushforwardDivisor.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/PushforwardDivisor.lean -@@ -8,40 +8,17 @@ import HasseWeil.Foundation.Curves.Map.CoordHomFinite - import HasseWeil.Foundation.Curves.Valuation.NormValuation - - /-! --# The divisor pushforward of a finite curve map preserves principal divisors -+# Divisor pushforward and principal divisors - --For a (nonconstant) curve map `φ : C₁ → C₂` between smooth plane curves, the --**divisor pushforward** `φ_∗ : Div(C₁) → Div(C₂)` sends `Σ nᵢ (Pᵢ)` to --`Σ nᵢ (φ Pᵢ)`. Silverman II.3.6 / II.3.7 says it carries *principal* divisors --to *principal* divisors, via the **norm–conorm identity** -+For a finite curve map `φ : C₁ → C₂` over an algebraically closed field, the -+divisor pushforward sends `Σ nᵢ(Pᵢ)` to `Σ nᵢ(φ(Pᵢ))`. The norm–conorm identity -+`div(N_φ f) = φ_∗(div f)` shows that principal divisors remain principal. -+Here `N_φ` is the field norm from `K(C₁)` to `φ*K(C₂)`. - -- `div(N_φ f) = φ_∗(div f)` (Silverman II.3.6) -- --where `N_φ f = Norm_{K(C₁)/φ*K(C₂)}(f) ∈ K(C₂)` is the field norm (already --defined as `CurveMap.pushforward`). This is the only deep input to Silverman --III.4.8 (every isogeny is a group homomorphism, proved at the divisor/σ level in --`HasseWeil/EC/IsogenyAG/GroupHom.lean`). -- --## The valuation-theoretic pushforward -- --We realise the divisor pushforward as `Finsupp.mapDomain` along the place-image --map `P ↦ φ(P)` (affine smooth point `↦` affine smooth point, `∞ ↦ ∞`), supplied --by a coordinate-ring witness `cd : φ.CoordHom`. This is definitionally the --point-map pushforward `pushforwardProjectiveDivisor`, so the compatibility --sub-leaf NEW-1(iii) is `rfl`; the mathematical content is concentrated in the --norm–conorm identity NEW-1(ii). -- --## Main definitions -- --* `CurveMap.pushforwardDivisorVal` — the valuation-theoretic divisor pushforward -- (= `pushforwardProjectiveDivisor`, via the place-image map). -- --## Main results -- --* `CurveMap.projectiveDivisorOf_pushforward_eq_pushforwardDivisorVal` — the -- norm–conorm identity `div(N_φ f) = φ_∗(div f)` (Silverman II.3.6). --* `EC.Isogeny.pushforward_preserves_principal` — the gap `h_pres`: the -- pushforward of a principal projective divisor is principal (Silverman II.3.7). -+The pushforward is realized by `Finsupp.mapDomain` along the projective -+place-image map. Its coefficients are sums over the fibres. The local -+norm formula, together with residue degree one, identifies these coefficients -+with the orders of the norm. - - ## References - -@@ -50,7 +27,6 @@ norm–conorm identity NEW-1(ii). - - open WeierstrassCurve - --set_option linter.unusedSectionVars false - - namespace HasseWeil.Curves.CurveMap - -@@ -58,7 +34,7 @@ variable {F : Type*} [Field F] - variable {C₁ C₂ : SmoothPlaneCurve F} - [C₁.toAffine.IsElliptic] [C₂.toAffine.IsElliptic] - --/-! ### NEW-1(i): the valuation-theoretic divisor pushforward -/ -+/-! ### the valuation-theoretic divisor pushforward -/ - - /-- The place-image map on the projective closure induced by a curve map `φ` - together with a coordinate-ring witness: an affine smooth point `P` is sent to -@@ -96,7 +72,7 @@ theorem degree_pushforwardDivisorVal (φ : CurveMap C₁ C₂) (cd : φ.CoordHom - simp only [ProjectiveDivisor.degree] - rw [Finsupp.sum_mapDomain_index (h := fun _ n ↦ n) (fun _ ↦ rfl) (fun _ _ _ ↦ rfl)] - --/-! ### NEW-1(ii): the norm–conorm identity `div(N_φ f) = φ_∗(div f)` -+/-! ### the norm–conorm identity `div(N_φ f) = φ_∗(div f)` - - The mathematical content is the per-place identity (Silverman II.3.6) - -@@ -107,7 +83,7 @@ by generalising the `F[X] → F[C]` machinery of `NormValuation.lean` to the - coordinate-ring extension `F[C₂] → F[C₁]` supplied by a `CoordHom`. The generic - ideal/localisation lemmas (`count_preservation_localization`, - `count_finset_prod_factors`, `map_eq_localRing_max_pow_count`, …) are reused --verbatim; the curve-specific inputs are `inertiaDeg' = 1`, `relNorm m_P = m_{φP}`, -+verbatim; the curve-specific inputs are `inertiaDeg = 1`, `relNorm m_P = m_{φP}`, - and the fibre bijection `maximalIdealAt_toPointMap`. -/ - - section NormConorm -@@ -129,8 +105,8 @@ theorem coordHom_injective : Function.Injective cd.toAlgHom := by - injective into a domain). -/ - theorem isTorsionFree_coordHom : - @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ cd.toAlgebra.toModule := by -- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- haveI : FaithfulSMul C₂.CoordinateRing C₁.CoordinateRing := -+ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ have : FaithfulSMul C₂.CoordinateRing C₁.CoordinateRing := - (faithfulSMul_iff_algebraMap_injective C₂.CoordinateRing C₁.CoordinateRing).mpr - (CurveMap.coordHom_injective φ cd) - infer_instance -@@ -146,8 +122,8 @@ private theorem isScalarTower_residueField_maximalIdealAt (P : C₁.SmoothPoint) - ⟨maximalIdealAt_toPointMap cd P⟩ - IsScalarTower F (C₂.CoordinateRing ⧸ C₂.maximalIdealAt (toPointMap cd P)) - (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := by -- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- haveI : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := -+ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ have : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := - ⟨maximalIdealAt_toPointMap cd P⟩ - set Q := toPointMap cd P with hQ - refine IsScalarTower.of_algebraMap_eq fun c ↦ ?_ -@@ -177,15 +153,15 @@ private theorem finrank_residueField_maximalIdealAt_le_one (P : C₁.SmoothPoint - ⟨maximalIdealAt_toPointMap cd P⟩ - Module.finrank (C₂.CoordinateRing ⧸ C₂.maximalIdealAt (toPointMap cd P)) - (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) ≤ 1 := by -- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- haveI : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := -+ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ have : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := - ⟨maximalIdealAt_toPointMap cd P⟩ - set Q := toPointMap cd P with hQ -- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -- haveI hPmax : (C₁.maximalIdealAt P).IsMaximal := C₁.maximalIdealAt_isMaximal P -- haveI : Field (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) := Ideal.Quotient.field _ -- haveI : Field (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := Ideal.Quotient.field _ -- haveI htower := isScalarTower_residueField_maximalIdealAt φ cd P -+ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hPmax : (C₁.maximalIdealAt P).IsMaximal := C₁.maximalIdealAt_isMaximal P -+ have : Field (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) := Ideal.Quotient.field _ -+ have : Field (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := Ideal.Quotient.field _ -+ have htower := isScalarTower_residueField_maximalIdealAt φ cd P - have hbijSP := C₁.algebraMap_bijective_quotient_of_maximal hPmax - refine finrank_le_one (1 : C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) fun w ↦ ?_ - obtain ⟨c, hc⟩ := hbijSP.2 w -@@ -212,16 +188,17 @@ theorem inertiaDeg_maximalIdealAt_toPointMap (P : C₁.SmoothPoint) : - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra - haveI : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := - ⟨(maximalIdealAt_toPointMap cd P)⟩ -- Ideal.inertiaDeg' (C₂.maximalIdealAt (toPointMap cd P)) (C₁.maximalIdealAt P) = 1 := by -- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- haveI hLies : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := -+ (C₁.maximalIdealAt P).inertiaDeg C₂.CoordinateRing = 1 := by -+ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ have hLies : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := - ⟨maximalIdealAt_toPointMap cd P⟩ - set Q := toPointMap cd P with hQ -- haveI hPmax : (C₁.maximalIdealAt P).IsMaximal := C₁.maximalIdealAt_isMaximal P -- rw [Ideal.inertiaDeg'_algebraMap] -+ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hPmax : (C₁.maximalIdealAt P).IsMaximal := C₁.maximalIdealAt_isMaximal P -+ rw [Ideal.inertiaDeg_eq_of_isMaximal (C₂.maximalIdealAt Q) (C₁.maximalIdealAt P)] - -- The residue field `F[C₁]/m_P` is `F` (alg-closed), hence nontrivial. -- haveI : Field (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := Ideal.Quotient.field _ -- haveI : Nontrivial (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := -+ have : Field (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := Ideal.Quotient.field _ -+ have : Nontrivial (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := - (Ideal.Quotient.nontrivial_iff).mpr hPmax.ne_top - -- Squeeze the residue rank between `1` (`finrank_pos`) and `1` (alg-closed surjectivity). - have hSP : Module.finrank F (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) = 1 := -@@ -229,9 +206,9 @@ theorem inertiaDeg_maximalIdealAt_toPointMap (P : C₁.SmoothPoint) : - have h_le : Module.finrank (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) - (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) ≤ 1 := - finrank_residueField_maximalIdealAt_le_one φ cd P -- haveI : Module.Finite F (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := -+ have : Module.Finite F (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := - Module.finite_of_finrank_pos (by rw [hSP]; norm_num) -- haveI : Module.Finite (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) -+ have : Module.Finite (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) - (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := - Module.Finite.of_restrictScalars_finite F _ _ - have h_ge : 1 ≤ Module.finrank (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) -@@ -244,22 +221,17 @@ packaged as a `LiesOver` instance for the `cd`-induced algebra. -/ - theorem maximalIdealAt_liesOver_toPointMap (P : C₁.SmoothPoint) : - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra - (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := -- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra - ⟨maximalIdealAt_toPointMap cd P⟩ - - end NormConorm - --/-! ### NEW-1(ii) — structural sub-lemmas of the norm–conorm identity -+/-! ### Coordinate-ring norms - --The norm–conorm identity is assembled below from three sub-lemmas, each carrying its --own elaboration budget so the assembling theorem stays light: --* `relNorm_maximalIdealAt_eq` — the **`s = 1` core** `relNorm(m_R) = m_{φR}`; --* `count_relNorm_eq_sum_fiber` — the **affine count identity** matching -- `count_{m_Q}(relNorm(span{w}))` to the fibre sum `Σ_{φP=Q} count_{m_P}(span{w})`; --* `projectiveDivisorOf_pushforward_algebraMap_eq` — the **`algebraMap` case** of the -- norm–conorm identity (affine coefficients via the count identity, infinity -- coefficient forced by degree). --The `f = u/v` reduction is then a short additivity argument in the main theorem. -/ -+The prime-ideal identity `relNorm(m_P) = m_{φP}` gives the corresponding -+valuation count as a sum over the fibre. Equality of affine coefficients, -+together with degree zero, determines the projective divisor. Additivity -+then extends the identity to quotients of coordinate-ring elements. -/ - - section NormConormSteps - -@@ -276,8 +248,8 @@ finiteness/degree arguments. -/ - private theorem faithfulSMul_coordinateRing_functionField : - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra - FaithfulSMul C₂.CoordinateRing C₁.FunctionField := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ - rw [RingHom.algebraMap_toAlgebra] - rfl -@@ -300,9 +272,9 @@ private theorem isScalarTower_coordinateRing_functionField : - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra - letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra - IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ - rw [RingHom.algebraMap_toAlgebra] - rfl -@@ -321,23 +293,23 @@ to `K(C₂)`). This is the algebraicity input to the localisation-finiteness st - private theorem isAlgebraic_functionField : - letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra - Algebra.IsAlgebraic C₂.FunctionField C₁.FunctionField := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ - rw [RingHom.algebraMap_toAlgebra] - rfl -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ algCR.toModule := -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ algCR.toModule := - cd.module_finite -- haveI hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := -+ have hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := - Algebra.IsIntegral.of_finite C₂.CoordinateRing C₁.CoordinateRing -- haveI faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := -+ have faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := - faithfulSMul_coordinateRing_functionField φ cd -- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -- haveI tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := -+ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ have tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := - isScalarTower_coordinateRing_functionField φ cd -- haveI hab : Algebra.IsAlgebraic C₂.CoordinateRing C₁.CoordinateRing := -+ have hab : Algebra.IsAlgebraic C₂.CoordinateRing C₁.CoordinateRing := - Algebra.IsIntegral.isAlgebraic -- haveI halgAB : Algebra.IsAlgebraic C₂.CoordinateRing C₁.FunctionField := -+ have halgAB : Algebra.IsAlgebraic C₂.CoordinateRing C₁.FunctionField := - (IsFractionRing.isAlgebraic_iff' C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField).mp hab - exact (IsFractionRing.comap_isAlgebraic_iff (A := C₂.CoordinateRing) - (K := C₂.FunctionField) (C := C₁.FunctionField)).mp halgAB -@@ -352,25 +324,25 @@ theorem finiteDimensional_functionField : - have hfin : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ - cd.toAlgebra.toModule := by - exact cd.module_finite -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ - rw [RingHom.algebraMap_toAlgebra] - rfl -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin -- haveI hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin -+ have hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := - Algebra.IsIntegral.of_finite C₂.CoordinateRing C₁.CoordinateRing -- haveI faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := -+ have faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := - faithfulSMul_coordinateRing_functionField φ cd -- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -- haveI tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := -+ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ have tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := - isScalarTower_coordinateRing_functionField φ cd -- haveI halgFF : Algebra.IsAlgebraic C₂.FunctionField C₁.FunctionField := -+ have halgFF : Algebra.IsAlgebraic C₂.FunctionField C₁.FunctionField := - isAlgebraic_functionField φ cd -- haveI hicl : IsIntegralClosure C₁.CoordinateRing C₂.CoordinateRing C₁.FunctionField := -+ have hicl : IsIntegralClosure C₁.CoordinateRing C₂.CoordinateRing C₁.FunctionField := - IsIntegralClosure.of_isIntegrallyClosed C₁.CoordinateRing C₂.CoordinateRing _ -- haveI hloc : IsLocalization -+ have hloc : IsLocalization - (Algebra.algebraMapSubmonoid C₁.CoordinateRing (nonZeroDivisors C₂.CoordinateRing)) - C₁.FunctionField := - IsIntegralClosure.isLocalization C₂.CoordinateRing C₂.FunctionField C₁.FunctionField -@@ -394,12 +366,12 @@ private theorem finrank_functionField_eq_degree : - faithfulSMul_coordinateRing_functionField φ cd - @Module.finrank C₂.FunctionField C₁.FunctionField _ _ - (FractionRing.liftAlgebra C₂.CoordinateRing C₁.FunctionField).toModule = φ.degree := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ - rw [RingHom.algebraMap_toAlgebra] - rfl -- haveI faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := -+ have faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := - faithfulSMul_coordinateRing_functionField φ cd - have halgmap : - IsFractionRing.lift (A := C₂.CoordinateRing) (K := C₂.FunctionField) -@@ -436,13 +408,13 @@ private theorem one_le_of_relNorm_eq_pow - isTorsionFree_coordHom φ cd - Ideal.relNorm C₂.CoordinateRing P' = q ^ t) : - 1 ≤ t := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI : P'.LiesOver q := hlies -+ have : P'.LiesOver q := hlies - rcases Nat.eq_zero_or_pos t with ht0 | ht0 - · exfalso - have hcomap : P'.comap (algebraMap C₂.CoordinateRing C₁.CoordinateRing) = q := -@@ -468,35 +440,26 @@ private theorem inertiaDeg_eq_one_of_liesOver_maximalIdealAt (Q : C₂.SmoothPoi - cd.module_finite - haveI : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- Ideal.inertiaDeg' (C₂.maximalIdealAt Q) P' = 1 := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ P'.inertiaDeg C₂.CoordinateRing = 1 := by -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI hP'prime' : P'.IsPrime := hP'prime -- haveI hP'lies' : P'.LiesOver (C₂.maximalIdealAt Q) := hP'lies -- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hP'prime' : P'.IsPrime := hP'prime -+ have hP'lies' : P'.LiesOver (C₂.maximalIdealAt Q) := hP'lies -+ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q - have hQ0 : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - have hP'_ne_bot : P' ≠ ⊥ := by - intro h - apply hQ0 - have hh : C₂.maximalIdealAt Q = P'.under C₂.CoordinateRing := hP'lies.over - rw [hh, h, Ideal.under_bot] -- haveI hP'max : P'.IsMaximal := Ideal.IsPrime.isMaximal hP'prime hP'_ne_bot -+ have hP'max : P'.IsMaximal := Ideal.IsPrime.isMaximal hP'prime hP'_ne_bot - obtain ⟨P'', hP''⟩ := C₁.exists_smoothPoint_of_isMaximal hP'max -- haveI hlies'' : (C₁.maximalIdealAt P'').LiesOver -- (C₂.maximalIdealAt (toPointMap cd P'')) := -- maximalIdealAt_liesOver_toPointMap φ cd P'' -- have h1 : C₂.maximalIdealAt (toPointMap cd P'') = -- (C₁.maximalIdealAt P'').under C₂.CoordinateRing := hlies''.over -- have h2 : C₂.maximalIdealAt Q = P'.under C₂.CoordinateRing := hP'lies.over -- rw [hP''] at h1 -- have hpeq : C₂.maximalIdealAt (toPointMap cd P'') = C₂.maximalIdealAt Q := h1.trans h2.symm -- have hid := inertiaDeg_maximalIdealAt_toPointMap φ cd P'' -- rw [← hP'', ← hpeq] -- exact hid -+ rw [← hP''] -+ exact inertiaDeg_maximalIdealAt_toPointMap φ cd P'' - - include φ cd in - /-- **Sum of ramification indices equals `φ.degree`**: over a smooth point `Q` of -@@ -514,12 +477,12 @@ private theorem sum_ramificationIdx_eq_degree (Q : C₂.SmoothPoint) - isTorsionFree_coordHom φ cd - ∑ P' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing, - (C₂.maximalIdealAt Q).ramificationIdx' P' = φ.degree := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q - have hQ0 : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - have hsumef := φ.sum_ramificationIdx_mul_inertiaDeg_eq_degree cd hfin hQmax hQ0 - rw [← hsumef] -@@ -557,12 +520,12 @@ private theorem degree_eq_sum_relNormExp_mul_ramificationIdx (Q : C₂.SmoothPoi - haveI : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q - φ.degree = ∑ P' ∈ ((C₂.maximalIdealAt Q).primesOver C₁.CoordinateRing).toFinset, - sfn P' * (C₂.maximalIdealAt Q).ramificationIdx' P' := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q - set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def - have hp0 : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - have hpNotUnit : ¬ IsUnit p := by rw [Ideal.isUnit_iff]; exact hQmax.ne_top -@@ -571,11 +534,11 @@ private theorem degree_eq_sum_relNormExp_mul_ramificationIdx (Q : C₂.SmoothPoi - finrank_functionField_eq_degree φ cd - -- `relNorm_algebraMap`'s exponent is the *coordinate-ring* `finrank`, so pull `hcoh` down the - -- fraction-field tower with `IsFractionRing.finrank_eq`. -- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := -+ let algFF : Algebra C₂.FunctionField C₁.FunctionField := - FractionRing.liftAlgebra C₂.CoordinateRing C₁.FunctionField -- haveI towerFF : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := -+ have towerFF : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := - FractionRing.isScalarTower_liftAlgebra C₂.CoordinateRing C₁.FunctionField -- haveI towerCR : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by -+ have towerCR : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ - rw [RingHom.algebraMap_toAlgebra] - rfl -@@ -619,14 +582,14 @@ private theorem one_le_ramificationIdx_of_liesOver_maximalIdealAt (Q : C₂.Smoo - haveI : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - 1 ≤ (C₂.maximalIdealAt Q).ramificationIdx' P' := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI : P'.IsPrime := hP'prime -- haveI : P'.LiesOver (C₂.maximalIdealAt Q) := hP'lies -+ have : P'.IsPrime := hP'prime -+ have : P'.LiesOver (C₂.maximalIdealAt Q) := hP'lies - have hp0 : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - rw [Nat.one_le_iff_ne_zero] - exact Ideal.IsDedekindDomain.ramificationIdx'_ne_zero_of_liesOver P' hp0 -@@ -664,17 +627,17 @@ theorem relNorm_maximalIdealAt_eq - have hfin : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ - cd.toAlgebra.toModule := by - exact cd.module_finite -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - set Q := toPointMap cd R with hQ -- haveI hLies : (C₁.maximalIdealAt R).LiesOver (C₂.maximalIdealAt Q) := -+ have hLies : (C₁.maximalIdealAt R).LiesOver (C₂.maximalIdealAt Q) := - maximalIdealAt_liesOver_toPointMap φ cd R -- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -- haveI hRmax : (C₁.maximalIdealAt R).IsMaximal := C₁.maximalIdealAt_isMaximal R -- haveI hRprime : (C₁.maximalIdealAt R).IsPrime := hRmax.isPrime -+ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hRmax : (C₁.maximalIdealAt R).IsMaximal := C₁.maximalIdealAt_isMaximal R -+ have hRprime : (C₁.maximalIdealAt R).IsPrime := hRmax.isPrime - have hQ0 : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - obtain ⟨s, hs⟩ := Ideal.exists_relNorm_eq_pow_of_isPrime - (C₁.maximalIdealAt R) (C₂.maximalIdealAt Q) -@@ -683,14 +646,14 @@ theorem relNorm_maximalIdealAt_eq - have hge1 : 1 ≤ s := one_le_of_relNorm_eq_pow φ cd hQmax s hLies hs - set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def - -- Every residue degree over `m_Q` is `1`. -- have hinertia : ∀ P' ∈ p.primesOver C₁.CoordinateRing, Ideal.inertiaDeg' p P' = 1 := by -+ have hinertia : ∀ P' ∈ p.primesOver C₁.CoordinateRing, P'.inertiaDeg C₂.CoordinateRing = 1 := by - intro P' hP' - obtain ⟨hP'prime, hP'lies⟩ := hP' - exact inertiaDeg_eq_one_of_liesOver_maximalIdealAt φ cd Q P' hP'prime hP'lies - have hp0 : p ≠ ⊥ := hQ0 - have hpNotUnit : ¬ IsUnit p := by - rw [Ideal.isUnit_iff]; exact hQmax.ne_top -- haveI hpMax : p.IsMaximal := hQmax -+ have hpMax : p.IsMaximal := hQmax - -- Each relative norm over `m_Q` is a positive power of `m_Q`. - have hexp : ∀ P' ∈ p.primesOver C₁.CoordinateRing, - ∃ t : ℕ, 1 ≤ t ∧ Ideal.relNorm C₂.CoordinateRing P' = p ^ t := by -@@ -753,16 +716,16 @@ private theorem primesOverFinset_ne_bot {p : Ideal C₂.CoordinateRing} - (hpMax : p.IsMaximal) (hp_ne : p ≠ ⊥) : - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra - ∀ Q' ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, Q' ≠ ⊥ := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI faithCR : FaithfulSMul C₂.CoordinateRing C₁.CoordinateRing := -+ have faithCR : FaithfulSMul C₂.CoordinateRing C₁.CoordinateRing := - (faithfulSMul_iff_algebraMap_injective C₂.CoordinateRing C₁.CoordinateRing).mpr - (CurveMap.coordHom_injective φ cd) -- haveI hpMax' : p.IsMaximal := hpMax -+ have hpMax' : p.IsMaximal := hpMax - intro Q' hQ' - rw [IsDedekindDomain.mem_primesOverFinset_iff (B := C₁.CoordinateRing) hp_ne] at hQ' - intro h_eq -@@ -790,15 +753,15 @@ private theorem exists_smoothPoint_relNorm_maximalIdealAt_eq - ∃ P' : C₁.SmoothPoint, C₁.maximalIdealAt P' = Q' ∧ - Ideal.relNorm C₂.CoordinateRing Q' = C₂.maximalIdealAt (toPointMap cd P') ∧ - Q'.LiesOver (C₂.maximalIdealAt (toPointMap cd P')) := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI hQ'max' : Q'.IsMaximal := hQ'max -+ have hQ'max' : Q'.IsMaximal := hQ'max - obtain ⟨P', hP'⟩ := C₁.exists_smoothPoint_of_isMaximal hQ'max -- haveI hlies' : (C₁.maximalIdealAt P').LiesOver -+ have hlies' : (C₁.maximalIdealAt P').LiesOver - (C₂.maximalIdealAt (toPointMap cd P')) := - maximalIdealAt_liesOver_toPointMap φ cd P' - refine ⟨P', hP', ?_, hP' ▸ hlies'⟩ -@@ -822,15 +785,15 @@ private theorem count_maximalIdealAt_relNorm_pow_self (Q : C₂.SmoothPoint) - isTorsionFree_coordHom φ cd - (Associates.mk (C₂.maximalIdealAt Q)).count - (Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q') ^ k)).factors = k := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI hQ'lies' : Q'.LiesOver (C₂.maximalIdealAt Q) := hQ'lies -+ have hQ'lies' : Q'.LiesOver (C₂.maximalIdealAt Q) := hQ'lies - set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def -- haveI hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q - have hp_ne : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - have h_vp_irr : Irreducible (Associates.mk p) := - (⟨p, hpMax.isPrime, hp_ne⟩ : -@@ -862,14 +825,14 @@ private theorem count_maximalIdealAt_relNorm_pow_of_not_liesOver (Q : C₂.Smoot - isTorsionFree_coordHom φ cd - (Associates.mk (C₂.maximalIdealAt Q)).count - (Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q') ^ k)).factors = 0 := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def -- haveI hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q - have hp_ne : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - have h_vp_irr : Irreducible (Associates.mk p) := - (⟨p, hpMax.isPrime, hp_ne⟩ : -@@ -880,7 +843,7 @@ private theorem count_maximalIdealAt_relNorm_pow_of_not_liesOver (Q : C₂.Smoot - rw [hrel] - intro hpe - exact hQ'not (hpe ▸ hlies') -- haveI hP'max2 : (Ideal.relNorm C₂.CoordinateRing Q').IsMaximal := -+ have hP'max2 : (Ideal.relNorm C₂.CoordinateRing Q').IsMaximal := - hrel ▸ C₂.maximalIdealAt_isMaximal _ - have hP'_ne_bot2 : Ideal.relNorm C₂.CoordinateRing Q' ≠ ⊥ := hrel ▸ C₂.maximalIdealAt_ne_bot _ - have h_vP'_irr : Irreducible (Associates.mk (Ideal.relNorm C₂.CoordinateRing Q')) := -@@ -915,14 +878,14 @@ private theorem count_factors_relNorm_pow_eq_ite (Q : C₂.SmoothPoint) - (Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q') ^ k)).factors = - if Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing - then k else 0 := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - have hp_ne : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q -- haveI hpMax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hpMax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q - by_cases h_over : Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing - · rw [if_pos h_over] - haveI hQ'lies : Q'.LiesOver (C₂.maximalIdealAt Q) := -@@ -979,11 +942,11 @@ private theorem associates_relNorm_pow_ne_zero - haveI : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q'.asIdeal) ^ k) ≠ 0 := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - rw [Associates.mk_ne_zero] - apply pow_ne_zero -@@ -1018,14 +981,14 @@ private theorem count_relNorm_span_eq_sum_support (Q : C₂.SmoothPoint) - (Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q'.asIdeal) ^ - ((Associates.mk Q'.asIdeal).count - (Associates.mk (Ideal.span ({w} : Set _))).factors))).factors := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def -- haveI hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q - have hp_ne : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - have h_vp_irr : Irreducible (Associates.mk p) := - (⟨p, hpMax.isPrime, hp_ne⟩ : -@@ -1070,15 +1033,15 @@ theorem count_relNorm_eq_sum_fiber : - ∑ Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing, - (Associates.mk Q').count (Associates.mk (Ideal.span ({w} : Set _))).factors := by - classical -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - intro w hw Q - set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def -- haveI hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q - have hp_ne : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - have hI_ne : Ideal.span ({w} : Set C₁.CoordinateRing) ≠ 0 := by - rw [Ne, Ideal.zero_eq_bot, Ideal.span_singleton_eq_bot]; exact hw -@@ -1185,28 +1148,28 @@ private theorem pushforward_algebraMap_eq_algebraMap_intNorm (w : C₁.Coordinat - algebraMap C₂.CoordinateRing C₂.FunctionField - (Algebra.intNorm C₂.CoordinateRing C₁.CoordinateRing w) := by - classical -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := -+ have hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := - Algebra.IsIntegral.of_finite C₂.CoordinateRing C₁.CoordinateRing -- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by -+ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ - rw [RingHom.algebraMap_toAlgebra] - rfl -- haveI faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := -+ have faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := - faithfulSMul_coordinateRing_functionField φ cd -- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -- haveI tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := by -+ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ have tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_smul fun r x ↦ ?_ - rw [Algebra.smul_def] - show φ.pullback ((algebraMap C₂.CoordinateRing C₂.FunctionField) r) * x = r • x - rw [cd.compat r, ← IsScalarTower.algebraMap_smul C₁.CoordinateRing r x, ← Algebra.smul_def] - rfl -- haveI hfd : FiniteDimensional C₂.FunctionField C₁.FunctionField := -+ have hfd : FiniteDimensional C₂.FunctionField C₁.FunctionField := - finiteDimensional_functionField φ cd - rw [Algebra.algebraMap_intNorm (A := C₂.CoordinateRing) (B := C₁.CoordinateRing) - (K := C₂.FunctionField) (L := C₁.FunctionField) w] -@@ -1226,11 +1189,11 @@ private theorem intNorm_ne_zero_of_ne_zero (w : C₁.CoordinateRing) (hw : w ≠ - isTorsionFree_coordHom φ cd - Algebra.intNorm C₂.CoordinateRing C₁.CoordinateRing w ≠ 0 := by - classical -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - have hw_FF : algebraMap C₁.CoordinateRing C₁.FunctionField w ≠ 0 := by - intro h -@@ -1283,25 +1246,25 @@ private theorem exists_smoothPoint_maximalIdealAt_eq_of_mem_primesOverFinset - (hQ' : letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra - Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing) : - ∃ P' : C₁.SmoothPoint, C₁.maximalIdealAt P' = Q' ∧ toPointMap cd P' = Q := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd -- haveI hpMax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q -+ have hpMax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q - have hp_ne : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q - rw [IsDedekindDomain.mem_primesOverFinset_iff (B := C₁.CoordinateRing) hp_ne] at hQ' - obtain ⟨hQ'prime, hQ'lies⟩ := hQ' -- haveI : Q'.IsPrime := hQ'prime -- haveI : Q'.LiesOver (C₂.maximalIdealAt Q) := hQ'lies -- haveI hQ'max : Q'.IsMaximal := Ideal.IsPrime.isMaximal hQ'prime (by -+ have : Q'.IsPrime := hQ'prime -+ have : Q'.LiesOver (C₂.maximalIdealAt Q) := hQ'lies -+ have hQ'max : Q'.IsMaximal := Ideal.IsPrime.isMaximal hQ'prime (by - intro h; apply hp_ne - have : C₂.maximalIdealAt Q = Q'.under C₂.CoordinateRing := hQ'lies.over - rw [this, h, Ideal.under_bot]) - obtain ⟨P', hP'⟩ := C₁.exists_smoothPoint_of_isMaximal hQ'max - refine ⟨P', hP', ?_⟩ -- haveI hlies' : (C₁.maximalIdealAt P').LiesOver -+ have hlies' : (C₁.maximalIdealAt P').LiesOver - (C₂.maximalIdealAt (toPointMap cd P')) := - maximalIdealAt_liesOver_toPointMap φ cd P' - have h1 : C₂.maximalIdealAt (toPointMap cd P') = -@@ -1333,11 +1296,11 @@ private theorem affine_section_injOn_attach (Q : C₂.SmoothPoint) : - (_ : b ∈ (IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing).attach), - ProjectiveSmoothPoint.affine (g a.1 a.2) = ProjectiveSmoothPoint.affine (g b.1 b.2) → - a = b := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - intro g hg a _ b _ hab - simp only [ProjectiveSmoothPoint.affine.injEq] at hab -@@ -1373,11 +1336,11 @@ private theorem sum_filter_support_eq_sum_image_section - ∑ x ∈ (IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) - C₁.CoordinateRing).attach.image - (fun Q' ↦ ProjectiveSmoothPoint.affine (g Q'.1 Q'.2)), D x := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - intro g hg_ideal hg_Q - have hp_ne : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q -@@ -1439,11 +1402,11 @@ private theorem sum_image_section_eq_sum_primesOver - (C₁.projectiveDivisorOf (algebraMap C₁.CoordinateRing C₁.FunctionField w)) x) = - ∑ Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing, - ((Associates.mk Q').count (Associates.mk (Ideal.span ({w} : Set _))).factors : ℤ) := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - intro g hg_ideal - rw [Finset.sum_image (affine_section_injOn_attach φ cd Q g hg_ideal)] -@@ -1480,11 +1443,11 @@ private theorem pushforwardDivisorVal_projectiveDivisorOf_affine_eq_sum_fiber - ∑ Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing, - ((Associates.mk Q').count (Associates.mk (Ideal.span ({w} : Set _))).factors : ℤ) := by - classical -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - -- Choose a section `pt` of the fibre `{primes over m_Q} → {smooth points P'}`, with - -- `m_{pt Q'} = Q'` and `φ (pt Q') = Q`, via the existence lemma. -@@ -1532,11 +1495,11 @@ private theorem projectiveDivisorOf_pushforward_algebraMap_apply_affine - φ.pushforwardDivisorVal cd (C₁.projectiveDivisorOf - (algebraMap C₁.CoordinateRing C₁.FunctionField w)) (ProjectiveSmoothPoint.affine Q) := by - classical -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - cd.module_finite -- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := -+ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := - isTorsionFree_coordHom φ cd - have hnw : Algebra.intNorm C₂.CoordinateRing C₁.CoordinateRing w ≠ 0 := - intNorm_ne_zero_of_ne_zero φ cd w hw -@@ -1585,10 +1548,10 @@ theorem projectiveDivisorOf_pushforward_algebraMap_eq - - end NormConormSteps - --/-! ### NEW-1(ii): the `f = u/v` reduction -+/-! ### the `f = u/v` reduction - - The deep per-place arithmetic is the `algebraMap` case --`projectiveDivisorOf_pushforward_algebraMap_eq` (in `section NormConormSteps`). -+`projectiveDivisorOf_pushforward_algebraMap_eq`. - The norm–conorm identity for a *general* `f ∈ K(C₁)` follows from it by the - multiplicativity of both sides together with `IsFractionRing.div_surjective`. - The next four `private` helpers package that reduction: -@@ -1606,8 +1569,8 @@ private theorem projectiveDivisorOf_pushforward_zero (φ : CurveMap C₁ C₂) - FiniteDimensional C₂.FunctionField C₁.FunctionField) : - C₂.projectiveDivisorOf (φ.pushforward (0 : C₁.FunctionField)) = - φ.pushforwardDivisorVal cd (C₁.projectiveDivisorOf (0 : C₁.FunctionField)) := by -- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -- haveI : FiniteDimensional C₂.FunctionField C₁.FunctionField := hfd -+ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ have : FiniteDimensional C₂.FunctionField C₁.FunctionField := hfd - rw [show φ.pushforward (0 : C₁.FunctionField) = 0 from Algebra.norm_zero, - C₂.projectiveDivisorOf_zero, C₁.projectiveDivisorOf_zero, map_zero] - -@@ -1690,44 +1653,16 @@ private theorem projectiveDivisorOf_pushforward_eq_of_algebraMap (φ : CurveMap - pushforwardDivisorVal_projectiveDivisorOf_eq_sub_of_mul_eq φ cd hf hav_ne hf_av, - hau, hav, key u hu_ne, key v hv_ne] - --/-- **NEW-1(ii) — Silverman II.3.6, norm–conorm identity** `div(N_φ f) = φ_∗(div f)`. --For a curve map `φ : C₁ → C₂` with coordinate-ring witness `cd` and a function --`f ∈ K(C₁)`, the projective divisor of the conorm `N_φ f = φ.pushforward f` --equals the valuation-theoretic pushforward of the projective divisor of `f`. -- --The content is the per-place identity `ord_Q(N_φ f) = Σ_{P ↦ Q} f_{P/Q}·ord_P(f)` --(with inertia degrees `f_{P/Q} = 1` over an algebraically closed field), proved --via `Ideal.sum_ramification_inertia`, `Ideal.relNorm`, and `Algebra.intNorm`. -- --The proof is the generalisation of the `F[X] → F[C]` machinery of --`NormValuation.lean` (`count_relNorm_singleton_eq_sum_count_fiber`, --`relNorm_maximalIdealAt`) to the *coordinate-ring extension* `F[C₂] → F[C₁]` --induced by `cd`. The instance-heavy steps are factored into the sub-lemmas of --`section NormConormSteps`, each re-establishing the `cd`-induced algebra and its --`Module.Finite`/`IsTorsionFree` structure internally (a `relNorm`/`intNorm` --statement only typechecks with those instances in scope, so the sub-lemmas state --them via `letI`/`haveI`-in-type and re-derive them in the body): --* `finiteDimensional_functionField` — the finite extension `K(C₂) → K(C₁)` -- (needed only for the `f = 0` branch below); --* the degree/`finrank` coherence `finrank_{liftAlgebra} = φ.degree` -- (`IsFractionRing.lift_unique` + `cd.compat`, so `relNorm_algebraMap` yields -- `m_Q ^ φ.degree`), computed inside `relNorm_maximalIdealAt_eq`; --* `relNorm_maximalIdealAt_eq` — the **`s = 1` core** `relNorm_{F[C₂]}(m_P) = m_{φP}` -- from the global balance `relNorm(m_Q·F[C₁]) = m_Q^{φ.degree} = -- ∏ relNorm(m_{P'})^{e_{P'}}` together with `Σ e_{P'}·f_{P'} = φ.degree` -- (`sum_ramificationIdx_mul_inertiaDeg_eq_degree`) and `f_{P'} = 1` -- (`inertiaDeg_maximalIdealAt_toPointMap`), forcing each exponent to 1; --* `count_relNorm_eq_sum_fiber` — the affine count identity -- `count_{m_Q}(relNorm (span{u})) = Σ_{Q' over m_Q} count_{Q'}(span{u})`; --* `projectiveDivisorOf_pushforward_algebraMap_eq` — the `algebraMap` case, matching -- the affine coefficients to the `mapDomain` fibre sum of `pushforwardDivisorVal` -- via the bijection `{P : φP = Q} ≃ {primes over m_Q}` (`maximalIdealAt_toPointMap` -- + `exists_smoothPoint_of_isMaximal`), the place at infinity being forced by -- `projectiveDivisorOf_degree_eq_zero` (both projective divisors have degree `0`, -- and `pushforwardDivisorVal` preserves degree). --Here the general `f = u/v` reduces to `f = algebraMap u`, `u ∈ F[C₁]` nonzero, via --`IsFractionRing.div_surjective` and the additivity of both sides --(`projectiveDivisorOf_mul`, `pushforward_mul`, `pushforwardDivisorVal` a hom). -/ -+/-- **Silverman II.3.6, norm–conorm identity** `div(N_φ f) = φ_∗(div f)`. -+ -+For a curve map with a coordinate-ring witness over an algebraically closed field, -+the local norm formula is `ord_Q(N_φ f) = Σ_{P ↦ Q} ord_P(f)`, since the residue -+degrees are one. The prime-ideal norm formula follows from the fundamental -+ramification identity and the degree of the function-field extension. The -+bijection between points over `Q` and primes over its maximal ideal then gives -+the affine coefficients; degree zero determines the coefficient at infinity. -+The quotient representation `f = u/v` and additivity extend the identity from -+nonzero coordinate-ring elements to all rational functions. -/ - theorem projectiveDivisorOf_pushforward_eq_pushforwardDivisorVal [IsAlgClosed F] - [IsDedekindDomain C₁.CoordinateRing] [IsDedekindDomain C₂.CoordinateRing] - (φ : CurveMap C₁ C₂) (cd : φ.CoordHom) -@@ -1746,7 +1681,7 @@ theorem projectiveDivisorOf_pushforward_eq_pushforwardDivisorVal [IsAlgClosed F] - - end HasseWeil.Curves.CurveMap - --/-! ### NEW-1(iii)/(iv): compatibility + the gap `h_pres` -/ -+/-! ### Compatibility of divisor pushforwards -/ - - namespace HasseWeil.EC.Isogeny - -@@ -1755,7 +1690,7 @@ open HasseWeil.Curves - variable {F : Type*} [Field F] [DecidableEq F] - variable {W₁ W₂ : Affine F} [W₁.IsElliptic] [W₂.IsElliptic] - --/-- **NEW-1(iii)**: the point-map pushforward `pushforwardProjectiveDivisor` -+/-- the point-map pushforward `pushforwardProjectiveDivisor` - agrees with the valuation-theoretic pushforward `pushforwardDivisorVal`. By - construction the two `mapDomain` place-image maps coincide, so this is `rfl` - up to the `(φP).toProjectiveSmoothPoint = affine (toPointMap cd P)` identity. -/ -@@ -1776,10 +1711,10 @@ theorem pushforwardProjectiveDivisor_eq_pushforwardDivisorVal (φ : Isogeny W₁ - -- `affine (toPointMap cd P')` after the round-trip. - rfl - --/-- **NEW-1(iv) / `h_pres` — Silverman II.3.7**: the pushforward `φ_∗` carries -+/-- **Silverman II.3.7**: the pushforward `φ_∗` carries - principal projective divisors to principal ones. This is the sole deep input to - Silverman III.4.8 (`EC.Isogeny.addHomProperty`); it falls out of the norm–conorm --identity (NEW-1 ii) since the pushforward of `div f` is `div(N_φ f)`, again -+identity since the pushforward of `div f` is `div(N_φ f)`, again - principal. -/ - theorem pushforward_preserves_principal [IsAlgClosed F] - [IsDedekindDomain (⟨W₁⟩ : SmoothPlaneCurve F).CoordinateRing] -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/AFConditional.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/AFConditional.lean -index d56788426..bb5320f8d 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/AFConditional.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/AFConditional.lean -@@ -3,27 +3,16 @@ import HasseWeil.Foundation.Curves.Ramification.PoleOrderParity - import HasseWeil.Isogeny.GroupHom.PicZero - - /-! --# AF unified package: conditional witnesses -+# Divisor witnesses for additivity of isogenies - --Wires together the shipped infrastructure into the witnesses needed by --`AddHomProperty_of_picZero_witnesses` (the universal Silverman III.4.8 --theorem). Each witness is parametrized over the remaining outstanding --hypotheses, making the dependency chain explicit: -+The reduction `D ~ (σD) − (O)` of degree-zero divisors identifies their -+Picard classes with point classes. Combined with the assertion that -+`(P) − (O)` is principal only when `P = O`, it shows that the sum of -+points vanishes on principal divisors. These two identities give the -+Picard-group witnesses for additivity of an isogeny whose pushforward -+preserves principal divisors. - --* `h_inj` (`κ ∘ σ̄ = id`): `DivZeroReduce W` (= reduction lemma). --* `h_van` (`σ` vanishes on principal): `DivZeroReduce W` AND a -- `point_minus_O_principal_eq_zero` over arbitrary functions -- (= the no-finite-poles bridge). -- --Once `DivZeroReduce W` lands (which itself decomposes into the --list-induction `effective_sum_reduce` + Finsupp-to-list bridge for --multiplicities) and the no-finite-poles bridge, the AF unified package --fully closes B-4-003 conditionally on Miller (the geometric chord/tangent --construction, the only remaining genuinely-new mathematical piece). -- --## References -- --* `T-PIC-AF-UNIFIED.md` for the full plan. -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.3–III.4. - -/ - - open WeierstrassCurve -@@ -33,19 +22,14 @@ namespace HasseWeil.Curves - variable {F : Type*} [Field F] [DecidableEq F] - (W : Affine F) [W.IsElliptic] - --/-- The full divisor reduction property: every degree-zero divisor is --linearly equivalent to `(σD) − (O)`. The proof requires Miller (via --`effective_sum_reduce`) plus a Finsupp-to-list bridge for handling --multiplicities. Both are outstanding tickets. -/ -+/-- Every degree-zero divisor is linearly equivalent to `(σD) − (O)`, -+where `σD` is its sum of points with multiplicity. -/ - def DivZeroReduce : Prop := - ∀ D : ProjectiveDivisor.degZero (⟨W⟩ : SmoothPlaneCurve F), - SmoothPlaneCurve.ProjLinearlyEquiv (⟨W⟩ : SmoothPlaneCurve F) - D.val (kappaDivisor W (projectiveDivisorSum W D.val)) - --/-- The unconditional `point_minus_O` property: if `(P) − (O)` is --principal, then `P = 0`. The proof requires the parity lemma (shipped --as `point_minus_O_principal_eq_zero_of_coord`) plus the no-finite-poles --→ CR-image bridge (outstanding ticket: `T-PIC-AF-UNIFIED.md` piece (a)). -/ -+/-- A point divisor `(P) − (O)` is principal only when `P = O`. -/ - def PointMinusOPrincipalEqZero : Prop := - ∀ P : W.Point, - SmoothPlaneCurve.ProjIsPrincipal (⟨W⟩ : SmoothPlaneCurve F) -@@ -112,11 +96,8 @@ theorem h_van_degZero_of_divZeroReduce_and_pointMinusO - - /-! ### `PointMinusOPrincipalEqZero` from the no-finite-poles bridge -/ - --/-- The no-finite-poles → CR-image bridge: any nonzero function with all --local orders nonneg lies in the coordinate-ring image. The proof composes --worker-I's `pointValuation_algebraMap_le_one`, `smoothPointEquivMaxIdeal` --(under `[IsAlgClosed F] [IsElliptic]`), and mathlib's --`mem_coordinateRing_of_valuation_le_one`. ~80-150 LOC follow-up ticket. -/ -+/-- A nonzero function with nonnegative order at every affine point -+lies in the image of the coordinate ring. -/ - def NoFinitePolesBridge : Prop := - ∀ (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField), f ≠ 0 → - (∀ P : (⟨W⟩ : SmoothPlaneCurve F).SmoothPoint, -@@ -151,9 +132,9 @@ theorem pointMinusO_of_bridge - ((ProjectiveSmoothPoint.infinity : ProjectiveSmoothPoint - (⟨W⟩ : SmoothPlaneCurve F))) ≠ ProjectiveSmoothPoint.affine Q := by - nofun -- rw [if_neg h_inf_ne, sub_zero] at h_eq -+ rw [ite_eq_right h_inf_ne, sub_zero] at h_eq - by_cases h_eq_pt : P.toProjectiveSmoothPoint = ProjectiveSmoothPoint.affine Q -- · rw [if_pos h_eq_pt] at h_eq -+ · rw [ite_eq_left h_eq_pt] at h_eq - cases h_top : (⟨W⟩ : SmoothPlaneCurve F).ord_P Q f with - | top => - rw [h_top, WithTop.untopD_top] at h_eq -@@ -163,7 +144,7 @@ theorem pointMinusO_of_bridge - have hn : n = 1 := h_eq.symm - subst hn - exact_mod_cast (by decide : (0 : ℤ) ≤ 1) -- · rw [if_neg h_eq_pt] at h_eq -+ · rw [ite_eq_right h_eq_pt] at h_eq - cases h_top : (⟨W⟩ : SmoothPlaneCurve F).ord_P Q f with - | top => - exact absurd (((⟨W⟩ : SmoothPlaneCurve F).ord_P_eq_top_iff (P := Q) f).mp h_top) hf_ne -@@ -174,17 +155,10 @@ theorem pointMinusO_of_bridge - - /-! ### Bundled AFInputs structure -/ - --/-- The three input Props needed for the AF unified package on a single --elliptic curve `W`: -- --* `miller`: chord/tangent geometric identity at the divisor level. --* `divZeroReduce`: combinatorial reduction `D ~ (σD) − (O)` for D ∈ Div⁰. --* `noFinitePolesBridge`: the algebraic bridge from "no finite poles" to -- "in coordinate-ring image". -- --Each is its own outstanding ticket; once all three are discharged for a --specific `W`, both witnesses needed by `AddHomProperty_of_picZero_witnesses` --(restricted to that curve's side of the isogeny) follow immediately. -/ -+/-- The divisor identities needed to identify an elliptic curve with -+its degree-zero Picard group: the Miller relation, reduction of -+degree-zero divisors to point divisors, and the coordinate-ring -+characterization of functions with no finite poles. -/ - structure AFInputs (W : Affine F) [W.IsElliptic] where - miller : MillerHypothesis W - divZeroReduce : DivZeroReduce W -@@ -217,12 +191,9 @@ theorem h_van_degZero {W : Affine F} [W.IsElliptic] (a : AFInputs W) - - end AFInputs - --/-! ### Final B-4-003 wrapper -/ -+/-! ### Additivity from divisor witnesses -/ - --/-- The "principal divisors lie in degZero" predicate. Proved by --worker-K's T-II-3-009 (`projectiveDivisorOf_degree_zero`) under --`[IsAlgClosed F]`. We take it as a hypothesis here to keep the wrapper --conditional. -/ -+/-- Principal projective divisors have degree zero. -/ - def PrincipalImpliesDegZero (W : Affine F) [W.IsElliptic] : Prop := - ∀ D : ProjectiveDivisor (⟨W⟩ : SmoothPlaneCurve F), - D ∈ (⟨W⟩ : SmoothPlaneCurve F).projPrincipalSubgroup → -@@ -230,8 +201,8 @@ def PrincipalImpliesDegZero (W : Affine F) [W.IsElliptic] : Prop := - - namespace AFInputs - --/-- The full h_van witness, given `AFInputs` + the principal-implies-degZero --bridge (worker-K's T-II-3-009). -/ -+/-- The sum of points vanishes on principal divisors, given the divisor -+identities in `AFInputs` and the degree-zero property of principal divisors. -/ - theorem h_van {W : Affine F} [W.IsElliptic] (a : AFInputs W) - (h_pdz : PrincipalImpliesDegZero W) - (D : ProjectiveDivisor (⟨W⟩ : SmoothPlaneCurve F)) -@@ -241,20 +212,9 @@ theorem h_van {W : Affine F} [W.IsElliptic] (a : AFInputs W) - - end AFInputs - --/-- **Final conditional B-4-003** for an isogeny: given `AFInputs` for --both curves, the principal-degZero bridge for both curves, and the --pushforward-preserves-principal hypothesis (T-PIC-C-003), the universal --hom property holds. -- --This closes B-4-003 over `[IsAlgClosed F]` modulo: --- `MillerHypothesis` for both W₁ and W₂ (geometric chord/tangent — the BIG remaining piece) --- `DivZeroReduce` for both W₁ and W₂ (Finsupp decomposition + miller corollaries) --- `NoFinitePolesBridge` for both W₁ and W₂ (valuation bridge) --- `PrincipalImpliesDegZero` for both W₁ and W₂ (worker-K's T-II-3-009) --- `h_pres` (T-PIC-C-003 = norm-divisor identity) -- --All the structural plumbing is here; the remaining work is to prove --each of these Props for elliptic curves. -/ -+/-- An isogeny is additive given the divisor identities on both curves, -+the degree-zero property of principal divisors, and preservation of -+principal divisors by its pushforward. See Silverman III.4.8. -/ - theorem AddHomProperty_of_AFInputs - {W₁ W₂ : Affine F} [W₁.IsElliptic] [W₂.IsElliptic] - (φ : HasseWeil.EC.Isogeny W₁ W₂) -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/GenericFiber.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/GenericFiber.lean -index 7a21963e5..91c992b49 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/GenericFiber.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/GenericFiber.lean -@@ -12,38 +12,13 @@ import Mathlib.RingTheory.DedekindDomain.Different - import Mathlib.RingTheory.DedekindDomain.Factorization - - /-! --# Generic fiber cardinality (T-II-2-009, Silverman II.2.6(b)) -+For a coordinate-ring morphism, if a nonzero prime is unramified and all residue -+field degrees above it are one, its number of primes above equals the -+function-field degree. For a separable morphism this is the separable degree. -+The algebraic support also identifies finite ramification loci through the -+different ideal and constructs smooth points over algebraically closed fields. - --For a nonconstant morphism `φ : C₁ → C₂` of smooth curves, for almost all --points `Q ∈ C₂`, the fiber `φ⁻¹(Q)` has cardinality equal to the --separable degree `deg_s(φ)`. -- --This file provides the **algebraic-geometric content** of T-II-2-009 at --the Dedekind-domain level, building on the `CurveMap` + `CoordHom` --infrastructure: if we can exhibit a maximal ideal `p ⊂ C₂.CoordinateRing` --that is **unramified** and has **trivial residue-field degrees**, then --the number of primes above it equals the function-field degree `deg(φ)` --(which coincides with `deg_s(φ)` for separable `φ`). -- --This is one side of Silverman's II.2.6(b): the fibre-cardinality statement --in terms of the discrete-prime count. The other direction — **exhibiting** --such an unramified prime `p` — requires the primitive-element-plus- --discriminant construction over a base that sees "almost all" `Q` (i.e. --the unramified locus is a dense open). Over arbitrary `F`, this is the --main piece still missing; see the progress note at the end. -- --## Main results -- --* `CurveMap.primesOverFinset_card_eq_degree_of_unramified` — given an -- unramified prime `p` with every residue-field degree `f_P = 1`, the -- number of primes above `p` equals `φ.degree`. --* `CurveMap.primesOverFinset_card_eq_sepDegree_of_separable_and_unramified` -- — same conclusion in terms of `sepDegree` under the separability -- hypothesis (which forces `deg = sepDeg`). -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*], II.2.6(b). -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.6(b). - -/ - - namespace HasseWeil.Curves -@@ -52,12 +27,6 @@ namespace CurveMap - - variable {F : Type*} [Field F] {C₁ C₂ : SmoothPlaneCurve F} - --/-- **T-II-2-009, algebraic direction** (unramified + trivial residue --degrees ⇒ fiber count = degree). Given a `CurveMap` with `CoordHom` --witness and a maximal ideal `p ⊂ C₂.CoordinateRing` that is --(i) non-zero, (ii) has every ramification index = 1 on the primes above it, --and (iii) has every inertia (residue) degree = 1, the number of primes --above `p` equals `φ.degree`. -/ - theorem primesOverFinset_card_eq_degree_of_unramified - [IsIntegrallyClosed C₂.CoordinateRing] - [IsIntegrallyClosed C₁.CoordinateRing] -@@ -67,10 +36,10 @@ theorem primesOverFinset_card_eq_degree_of_unramified - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - ∀ P ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, - Ideal.ramificationIdx' p P * -- Ideal.inertiaDeg' p P = 1) : -+ P.inertiaDeg C₂.CoordinateRing = 1) : - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - (IsDedekindDomain.primesOverFinset p C₁.CoordinateRing).card = φ.degree := by -- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra -+ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - have hsum := φ.sum_ramificationIdx_mul_inertiaDeg_eq_degree - coordHom coordHom.module_finite hpMax hp0 - -- Σ_{P ∈ S} (e · f) = deg. With each e·f = 1, LHS = S.card. -@@ -80,10 +49,6 @@ theorem primesOverFinset_card_eq_degree_of_unramified - rw [Finset.sum_const, Nat.smul_one_eq_cast] at hsum' - exact_mod_cast hsum' - --/-- **T-II-2-009 (separable case)**: for a separable `CurveMap` with an --unramified + trivial-residue-degree prime, the fiber count equals --`sepDegree`. Uses the fact that `sepDegree = degree` for separable --extensions (via `Field.finSepDegree_eq_finrank_iff`). -/ - theorem primesOverFinset_card_eq_sepDegree_of_separable_and_unramified - [IsIntegrallyClosed C₂.CoordinateRing] - [IsIntegrallyClosed C₁.CoordinateRing] -@@ -94,11 +59,11 @@ theorem primesOverFinset_card_eq_sepDegree_of_separable_and_unramified - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - ∀ P ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, - Ideal.ramificationIdx' p P * -- Ideal.inertiaDeg' p P = 1) : -+ P.inertiaDeg C₂.CoordinateRing = 1) : - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - (IsDedekindDomain.primesOverFinset p C₁.CoordinateRing).card = φ.separableDegree := by - -- separable + finite-dim ⇒ sepDegree = degree. -- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra - have hsep_eq : φ.degree = φ.separableDegree := by - change φ.degree = @Field.finSepDegree _ _ _ _ φ.toAlgebra - have hinsep : φ.inseparableDegree = 1 := hsep -@@ -112,17 +77,6 @@ theorem primesOverFinset_card_eq_sepDegree_of_separable_and_unramified - exact φ.primesOverFinset_card_eq_degree_of_unramified coordHom - hpMax hp0 h_ef_one - --/-! ### Piece 1 — bad locus `{p : p ∣ differentIdeal}` is finite -- --For a finite separable extension of Dedekind domains `A → B`, the set of --maximal ideals `p ⊂ A` that ramify (i.e. divide `differentIdeal A B`) --is **finite**. Direct consequence of `differentIdeal_ne_bot` + --`Ideal.finite_factors`. -/ -- --/-- **T-II-2-009 Piece 1**: the set of height-one primes of `B` that --divide `differentIdeal A B` is finite. These are the "ramified primes" --in the `A → B` extension (primes above which at least one prime of `B` --has `e_P ≥ 2`). Silverman II.2.6(b) "finitely many bad Q". -/ - theorem _root_.IsDedekindDomain.finite_ramified_primes - {A : Type*} [CommRing A] [IsDedekindDomain A] - {B : Type*} [CommRing B] [IsDedekindDomain B] -@@ -132,20 +86,13 @@ theorem _root_.IsDedekindDomain.finite_ramified_primes - (FractionRing.liftAlgebra A (FractionRing B))) : - {P : IsDedekindDomain.HeightOneSpectrum B | - P.asIdeal ∣ differentIdeal A B}.Finite := by -- letI : Algebra (FractionRing A) (FractionRing B) := -+ let : Algebra (FractionRing A) (FractionRing B) := - FractionRing.liftAlgebra A (FractionRing B) -- haveI : IsScalarTower A (FractionRing A) (FractionRing B) := -+ have : IsScalarTower A (FractionRing A) (FractionRing B) := - FractionRing.isScalarTower_liftAlgebra A (FractionRing B) -- haveI := hsep -+ have := hsep - exact Ideal.finite_factors (differentIdeal_ne_bot (A := A) (B := B)) - --/-! ### Piece 2 — `¬ P ∣ differentIdeal ⇒ IsUnramifiedAt A P` -- --Direct corollary of mathlib's `not_dvd_differentIdeal_iff`. Packages the --easier direction as a standalone lemma for use in Pieces 3–5. -/ -- --/-- **T-II-2-009 Piece 2**: a prime of `B` that does not divide the --different ideal is unramified over `A`. -/ - theorem _root_.IsDedekindDomain.isUnramifiedAt_of_not_dvd_differentIdeal - {A : Type*} [CommRing A] [IsDedekindDomain A] - {B : Type*} [CommRing B] [IsDedekindDomain B] -@@ -155,50 +102,27 @@ theorem _root_.IsDedekindDomain.isUnramifiedAt_of_not_dvd_differentIdeal - (FractionRing.liftAlgebra A (FractionRing B))) - {P : Ideal B} [P.IsPrime] (hnd : ¬ P ∣ differentIdeal A B) : - Algebra.IsUnramifiedAt A P := by -- letI : Algebra (FractionRing A) (FractionRing B) := -+ let : Algebra (FractionRing A) (FractionRing B) := - FractionRing.liftAlgebra A (FractionRing B) -- haveI : IsScalarTower A (FractionRing A) (FractionRing B) := -+ have : IsScalarTower A (FractionRing A) (FractionRing B) := - FractionRing.isScalarTower_liftAlgebra A (FractionRing B) -- haveI := hsep -+ have := hsep - exact not_dvd_differentIdeal_iff.mp hnd - --/-! ### Piece 3 — `IsUnramifiedAt P ⇒ e_{P|A} = 1` -- --Corollary of mathlib's `Ideal.ramificationIdx_eq_one_of_isUnramifiedAt`. --Packages the ramification-index side of unramifiedness; the inertia-degree --side (`f_P = 1`) requires the residue field to be trivial over the base, --which is **automatic over algebraically closed `F`** but must be supplied --externally over arbitrary base fields. -/ -- --/-- **T-II-2-009 Piece 3 (ramification half)**: a prime `P` of `B` that is --unramified over `A` has ramification index `1` (at its image in `A`). --Direct corollary of mathlib's `Ideal.ramificationIdx_eq_one_of_isUnramifiedAt`. -/ - theorem _root_.IsDedekindDomain.ramificationIdx_eq_one_of_isUnramifiedAt_of_ne_bot - {A : Type*} [CommRing A] [IsDomain A] - {B : Type*} [CommRing B] [IsDomain B] [IsNoetherianRing B] - [Algebra A B] [Algebra.EssFiniteType A B] - {P : Ideal B} [P.IsPrime] [Algebra.IsUnramifiedAt A P] (hP : P ≠ ⊥) : - Ideal.ramificationIdx' (P.under A) P = 1 := by -- haveI : P.LiesOver (P.under A) := ⟨rfl⟩ -- letI := Localization.AtPrime.algebraOfLiesOver (P.under A) P -+ have : P.LiesOver (P.under A) := ⟨rfl⟩ -+ let := Localization.AtPrime.algebraOfLiesOver (P.under A) P - have hmap : (P.under A).map (algebraMap A (Localization.AtPrime P)) = - IsLocalRing.maximalIdeal _ := - ((Algebra.isUnramifiedAt_iff_map_eq A (P.under A) P).mp ‹_›).2 - exact Ideal.ramificationIdx'_eq_one_of_map_localization Ideal.map_comap_le hP - (Ideal.primeCompl_le_nonZeroDivisors P) hmap - --/-! ### Piece 4 — existence of an unramified prime -- --Given Piece 1 (bad locus finite) and the assumption that `B` has --infinitely many height-one primes (a genuine curve-theory input, since a --Dedekind domain of infinite F-dimension has infinite spectrum), there --exists a prime `P` of `B` outside the ramified locus. Piece 2 then turns --"not in bad locus" into `IsUnramifiedAt A P`. -/ -- --/-- **T-II-2-009 Piece 4**: combining Piece 1 (bad locus finite) + Piece 2 --(not-in-bad-locus ⇒ IsUnramifiedAt), plus the hypothesis that `B` has --infinitely many height-one primes, we extract a specific prime --`P : HeightOneSpectrum B` that is unramified over `A`. -/ - theorem _root_.IsDedekindDomain.exists_unramified_prime - {A : Type*} [CommRing A] [IsDedekindDomain A] - {B : Type*} [CommRing B] [IsDedekindDomain B] -@@ -229,30 +153,9 @@ theorem _root_.IsDedekindDomain.exists_unramified_prime - exact hfin_bad.subset this - obtain ⟨P, hP⟩ := hgood_nonempty - refine ⟨P, ?_⟩ -- haveI : P.asIdeal.IsPrime := P.isPrime -+ have : P.asIdeal.IsPrime := P.isPrime - exact IsDedekindDomain.isUnramifiedAt_of_not_dvd_differentIdeal hsep hP - --/-! ### Piece 5 — composed theorem at the abstract Dedekind level -- --Combining Pieces 1–4 yields: for a finite separable extension of Dedekind --domains `A → B` with `B` having infinitely many height-one primes, there --exists a specific prime `P` of `B` for which the ramification index is --exactly `1`. -- --Specialised to `CurveMap + CoordHom` + `[IsAlgClosed F]` (where residue --field degrees are automatically `1`), this gives `(primesOverFinset).card --= φ.degree` — the full Silverman II.2.6(b) content. -/ -- --/-- **T-II-2-009 Piece 5 (composed at A → B level)**: assembles Pieces --1–4 into a single witness. For `A → B` Dedekind + finite separable + --`B` infinite in primes, there exists a `P ∈ HeightOneSpectrum B`, --nonzero, with `ramificationIdx' (P.under A → P) = 1`. -- --The inertia degree `f_P = 1` is NOT concluded here — it depends on the --residue-field extension being trivial, which is automatic over --algebraically closed base (or for F-rational smooth points), and --supplied as a separate hypothesis when needed (see --`primesOverFinset_card_eq_degree_of_unramified`). -/ - theorem _root_.IsDedekindDomain.exists_unramifiedPrime_ramificationIdx_eq_one - {A : Type*} [CommRing A] [IsDedekindDomain A] - {B : Type*} [CommRing B] [IsDedekindDomain B] -@@ -265,31 +168,17 @@ theorem _root_.IsDedekindDomain.exists_unramifiedPrime_ramificationIdx_eq_one - ∃ P : IsDedekindDomain.HeightOneSpectrum B, - Ideal.ramificationIdx' (P.asIdeal.under A) P.asIdeal = 1 := by - obtain ⟨P, hunram⟩ := IsDedekindDomain.exists_unramified_prime hsep hinf -- haveI : P.asIdeal.IsPrime := P.isPrime -- haveI := hunram -+ have : P.asIdeal.IsPrime := P.isPrime -+ have := hunram - refine ⟨P, ?_⟩ - exact IsDedekindDomain.ramificationIdx_eq_one_of_isUnramifiedAt_of_ne_bot P.ne_bot - - end CurveMap - --/-! ### Piece 6 — HeightOneSpectrum infinite over alg-closed base -- --Over an algebraically closed base `F` with `[IsElliptic]`, the coordinate --ring `C.CoordinateRing` has infinitely many height-one primes. The proof --goes via the `smoothPointEquivHeightOneSpectrum` bijection --(in `HasseWeil/Curves/SmoothPointPrime.lean`), reducing to showing --`C.SmoothPoint` is infinite. This follows because for each `x ∈ F`, the --Weierstrass equation in `y` is a quadratic over an algebraically closed --field and hence has a root — giving an injection `F → C.SmoothPoint`. -/ -- - namespace SmoothPlaneCurve - - variable {F : Type*} [Field F] - --/-- **T-II-2-009 Piece 6 (smooth points)**: for every `x ∈ F` over an --algebraically closed field, there exists `y : F` with `(x, y)` a --nonsingular point on the elliptic curve (any point on an elliptic curve --is automatically nonsingular since `Δ ≠ 0`). -/ - theorem exists_smoothPoint_of_x - [IsAlgClosed F] (C : SmoothPlaneCurve F) [C.toAffine.IsElliptic] (x : F) : - ∃ P : C.SmoothPoint, P.x = x := by -@@ -320,9 +209,6 @@ theorem exists_smoothPoint_of_x - (W := C.toAffine)).mp heq - exact ⟨⟨x, y, hns⟩, rfl⟩ - --/-- **T-II-2-009 Piece 6**: `C.SmoothPoint` is infinite over an --algebraically closed base. Via the injection `x ↦ (smooth point with --that x-coordinate)`. -/ - theorem smoothPoint_infinite - [IsAlgClosed F] (C : SmoothPlaneCurve F) [C.toAffine.IsElliptic] : - Infinite C.SmoothPoint := by -@@ -338,17 +224,13 @@ theorem smoothPoint_infinite - rw [h₁, h₂] at this - exact this - --/-- **T-II-2-009 Piece 6 (main)**: the height-one spectrum of --`C.CoordinateRing` is infinite over an algebraically closed elliptic --curve, via the bijection `SmoothPoint ≃ HeightOneSpectrum` from --`HasseWeil/Curves/SmoothPointPrime.lean`. -/ - theorem heightOneSpectrum_infinite - [IsAlgClosed F] (C : SmoothPlaneCurve F) [C.toAffine.IsElliptic] - [IsIntegrallyClosed C.CoordinateRing] : - Set.Infinite ({_P : IsDedekindDomain.HeightOneSpectrum C.CoordinateRing | - True}) := by -- haveI : Infinite C.SmoothPoint := C.smoothPoint_infinite -- haveI : Infinite (IsDedekindDomain.HeightOneSpectrum C.CoordinateRing) := -+ have : Infinite C.SmoothPoint := C.smoothPoint_infinite -+ have : Infinite (IsDedekindDomain.HeightOneSpectrum C.CoordinateRing) := - Infinite.of_injective C.smoothPointEquivHeightOneSpectrum - C.smoothPointEquivHeightOneSpectrum.injective - exact Set.infinite_univ -@@ -358,52 +240,11 @@ end SmoothPlaneCurve - namespace CurveMap - variable {F : Type*} [Field F] {C₁ C₂ : SmoothPlaneCurve F} - --/-! ### Piece 7 — residue fields at smooth points are `F` -- --The residue-field-degree-one content (f_P = 1) of T-II-2-009 Piece 7. --Rather than prove `inertiaDeg' = 1` directly — which hits a diamond --between `Module.Free` from `Ideal.Quotient` vs `DivisionRing` paths — --we package the residue-field F-rank: `finrank F (C.CoordinateRing / --maximalIdealAt P) = 1`. Any consumer wanting `inertiaDeg' = 1` over an --F-rational SmoothPoint combines this (for source + target) with the --tower `finrank_mul_finrank`; the direct --`inertiaDeg_maximalIdealAt` covers the specific `F[X] → F[C]` case. -/ -- --/-- **T-II-2-009 Piece 7 (residue field)**: the residue field of --`C.CoordinateRing` at a smooth point `P` equals `F` (as `F`-module of --rank 1). Direct re-export of `finrank_quotientMaximalIdealAt` --for use in the Piece 8 chain. -/ - theorem finrank_quotientMaximalIdealAt_eq_one - (C : SmoothPlaneCurve F) (P : C.SmoothPoint) : - Module.finrank F (C.CoordinateRing ⧸ C.maximalIdealAt P) = 1 := - C.finrank_quotientMaximalIdealAt P - --/-! ### Piece 8 — final assembly: T-II-2-009 for CurveMap -- --Combines Pieces 1–7: given a CurveMap with CoordHom, separable, --and ([IsAlgClosed F] providing infinite spectrum + residue-degree=1), --there's a maximal ideal of `C₂.CoordinateRing` whose fiber (primes above --it in `C₁.CoordinateRing`) has cardinality equal to `φ.separableDegree`. -- --The `f_P = 1` side of the inertia --computation is supplied as a **witness hypothesis** (`h_inertia_one`) --rather than proven in-line, due to the `Module.Free` diamond between --`Ideal.Quotient.semiring` and `DivisionRing.toDivisionSemiring.toSemiring` --paths. Under `[IsAlgClosed F]`, the hypothesis is always satisfied --(both residue fields are `F`); the caller supplies it via --`SmoothPlaneCurve.finrank_quotientMaximalIdealAt_eq_one` (Piece 7) for --each prime in their specific setting. -/ -- --/-- **T-II-2-009 Piece 8 (full assembly, witness form)**: given the --witness hypotheses for unramified existence + trivial residue degrees, --produce a prime of `C₂.CoordinateRing` whose fiber in `C₁.CoordinateRing` --has cardinality `φ.separableDegree`. -- --The existence of an unramified Q (via Pieces 1–6 for alg-closed base) is --bundled as `h_unramified_Q`. The trivial residue degree is bundled as --`h_inertia_one` (follows from Piece 7 over [IsAlgClosed F] via the --`maximalIdealAt` ↔ `HeightOneSpectrum` bijection from --`smoothPointEquivHeightOneSpectrum`). -/ - theorem exists_heightOneSpectrum_fiber_card_eq_sepDegree - [IsIntegrallyClosed C₂.CoordinateRing] - [IsIntegrallyClosed C₁.CoordinateRing] -@@ -414,94 +255,15 @@ theorem exists_heightOneSpectrum_fiber_card_eq_sepDegree - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - ∀ P ∈ IsDedekindDomain.primesOverFinset Q.asIdeal C₁.CoordinateRing, - Ideal.ramificationIdx' Q.asIdeal P * -- Ideal.inertiaDeg' Q.asIdeal P = 1) : -+ P.inertiaDeg C₂.CoordinateRing = 1) : - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - (IsDedekindDomain.primesOverFinset Q.asIdeal C₁.CoordinateRing).card = φ.separableDegree := by -- haveI : Q.asIdeal.IsPrime := Q.isPrime -- haveI hQmax : Q.asIdeal.IsMaximal := -+ have : Q.asIdeal.IsPrime := Q.isPrime -+ have hQmax : Q.asIdeal.IsMaximal := - Q.isPrime.isMaximal Q.ne_bot - exact φ.primesOverFinset_card_eq_sepDegree_of_separable_and_unramified - coordHom hsep hQmax Q.ne_bot h_ef_one_Q - --/-! ### Piece 9 — `inertiaDeg' = 1` at smooth points: diamond-blocked -- --**Status**: blocked by the `Module.Free (C₂.CR/Q) (C₁.CR/P)` typeclass --diamond. The attempted workaround — using `F` as outer ring in --`Module.finrank_mul_finrank F _ _` — does **not** bypass the problem, --because `finrank_mul_finrank` still requires `Module.Free` on the --intermediate extension. Specifically: -- --- `Module.Free.of_divisionRing` produces `Module.Free` via -- `DivisionRing.toDivisionSemiring.toSemiring`. --- The expected instance on `(C₂.CR/Q)`-module `(C₁.CR/P)` goes through -- `Ideal.Quotient.semiring` and `Algebra.toModule`. --- These two `Semiring` parent-paths do not unify — the same `Module.Free` -- diamond between the two `Semiring` structures. -- --The narrower witness form (`exists_heightOneSpectrum_fiber_card_eq_sepDegree`, --Piece 8 above) takes the `e_P · f_P = 1` hypothesis as input and is the --shippable deliverable. Closing `inertiaDeg' = 1` without the diamond --requires either: -- --1. A mathlib-level change to make `Ideal.Quotient.semiring` and -- `Field`-derived `Semiring` agree definitionally, OR --2. A residue-field algebra isomorphism `C.CR/(maximalIdealAt P) ≃ₐ[F] F` -- (under `[IsAlgClosed F]`), expressed without passing through -- `Module.Free` synthesis on the intermediate quotient, OR --3. A direct computation of `Ideal.inertiaDeg'` from the algebra-map -- surjectivity at smooth points on an algebraically closed base. -- --The second route is the most promising — a dedicated file --`HasseWeil/Curves/ResidueFieldAtSmoothPoint.lean` building an explicit --`AlgEquiv` at each smooth point and then transporting `inertiaDeg'` --through it would sidestep `finrank_mul_finrank` entirely. Estimated --~100 LOC. Deferred. -/ -- --/-! ### Progress note — the remaining piece (existence of unramified p) -- --The full T-II-2-009 statement **`∃ Q, #φ⁻¹(Q) = sepDeg(φ)`** reduces (via --the theorems above) to exhibiting a maximal `p ⊂ C₂.CoordinateRing` with --the ramification + inertia witnesses. Over an algebraically-closed base --field `F`, such a `p` always exists because: -- --1. **Primitive element**: the separable closure `L ⊂ C₁.FunctionField` -- of `φ*(C₂.FunctionField)` is generated by a primitive element `α` -- with minimal polynomial `m(T) ∈ (φ*C₂.FunctionField)[T]` of degree -- `sepDeg(φ)`. -- --2. **Discriminant**: `m` is separable (primitive-element condition), so -- `discriminant(m)` is a nonzero element of `φ*C₂.FunctionField`. -- Viewed in `C₂.FunctionField`, it has finitely many zeros (as an element -- of a function field with a degree structure). -- --3. **Dense open**: at any `p ⊂ C₂.CoordinateRing` outside the zero locus -- of `discriminant(m)`, the specialisation `m̄ ∈ (C₂.CoordinateRing/p)[T]` -- has `sepDeg(φ)` distinct roots in `C₁.CoordinateRing/P` for each `P` -- above `p`. This gives the ramification + inertia witnesses. -- --The formalisation gap: --- Mathlib has `Field.exists_primitive_element` (step 1) and -- `Polynomial.discriminant_ne_zero_of_separable` (step 2). --- Step 3 requires the algebraic-geometric bridge between "discriminant -- nonzero at `p`" and "unramified at `p` with trivial residue -- extensions". For Dedekind extensions this is -- `Algebra.IsUnramifiedAt ↔ ¬ p ∣ differentIdeal`, and over alg-closed -- base the residue fields all equal `F`, making `inertiaDeg' = 1` -- automatic. -- --This last step is ~200 lines of algebraic-geometric infrastructure --following Silverman + Neukirch (*Algebraic Number Theory*, III.2). The --algebraic core (steps 1–2) is immediate in mathlib; step 3 is the --substantive remaining content. Tracked under T-II-2-009's progress log. -- --The **alternative path** `#ker β_pc = sepDeg β_pc` (for the specific --β_pc = 1 − π) can be closed *without* the full T-II-2-009 once --`AdditionPullback.lean` replaces the `isogOneSub` placeholder — that --gives the real function-field pullback, from which `deg β_pc = --[K(E) : φ*K(E)] = q + 1 − t` follows via explicit computation, and --`#ker β_pc = pointCount = q + 1 − t` then furnishes `#ker β_pc = deg --β_pc` directly. -/ -- - end CurveMap - - end HasseWeil.Curves -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Frobenius/FrobeniusFixedPoint.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Frobenius/FrobeniusFixedPoint.lean -index 758285749..d4ec75e01 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Frobenius/FrobeniusFixedPoint.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Frobenius/FrobeniusFixedPoint.lean -@@ -9,60 +9,12 @@ import Mathlib.FieldTheory.Finite.Basic - import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure - - /-! --# Geometric Frobenius on points over the algebraic closure (Route B, Step 2) -+For a finite field `K` of cardinality `q`, the map `(x, y) ↦ (x ^ q, y ^ q)` -+on the algebraic-closure points of a Weierstrass curve fixes exactly the -+`K`-rational points. Consequently the kernel of the identity minus Frobenius -+has cardinality equal to the number of `K`-rational points. - --For a finite field `K` with `q = Fintype.card K` and a Weierstrass curve `W` over `K`, --base-changed to `L = AlgebraicClosure K`, this file builds the **geometric Frobenius** --endomorphism on the `L`-points, -- --``` --geomFrobeniusPoint : (W.baseChange L).toAffine.Point →+ (W.baseChange L).toAffine.Point --``` -- --acting as `(x, y) ↦ (x ^ q, y ^ q)` (and `0 ↦ 0`), via mathlib's `FiniteField.frobeniusAlgHom` --(`x ↦ x ^ q`, a `K`-algebra hom on `L`) transported to points by the project's --`HasseWeil.Affine.Point.map`. The codomain identification -- --``` --(W.baseChange L).map (frobeniusAlgHom K L) = W.baseChange L --``` -- --(`WeierstrassCurve.map_baseChange`, because the `q`-power map is a `K`-algebra hom and so --fixes the `algebraMap K L` image) makes this an *endomorphism* of the same point type. -- --It also packages the base-change inclusion of `K`-points -- --``` --includePointBC : W.toAffine.Point →+ (W.baseChange L).toAffine.Point --``` -- --via `HasseWeil.Affine.Point.map (algebraMap K L)`. -- --## Main result (Step 2 = S2) -- --* `HasseWeil.geomFrobeniusPoint_fixed_iff_mem_range_includePointBC`: -- `geomFrobeniusPoint P = P ↔ P ∈ Set.range includePointBC`, -- the *point-level* fixed-locus theorem. Proof by cases on `P`: -- - `P = 0` is fixed and `0 = includePointBC 0`; -- - `P = (x, y)` is fixed iff `x ^ q = x ∧ y ^ q = y`, iff (by Step 1 -- `frobenius_fixed_iff_mem_baseField`) both coordinates lie in `range (algebraMap K L)`, -- iff `P = includePointBC (x₀, y₀)`. -- --## Further results (S3/S4 and the `1 − π` kernel) -- --* `fixedLocus_geomFrobenius_eq_range_includePointBC` (S3): the `Set`-form of S2 — the -- geometric-Frobenius fixed locus equals `Set.range (includePointBC W)`. --* `ncard_fixedLocus_geomFrobenius_eq_pointCount` (S4): that fixed locus has cardinality -- `Fintype.card W.toAffine.Point` (`= pointCount W`), using injectivity of `includePointBC`. --* `ncard_ker_oneSubGeomFrobHom_eq_pointCount`: the same count for the kernel of the -- `AddMonoidHom` `id − geomFrobeniusPoint`. -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, V.1.1. --* Step 1: `HasseWeil.frobenius_fixed_iff_mem_baseField` (`Curves/FrobeniusFixedLocus.lean`). --* mathlib: `FiniteField.frobeniusAlgHom`, `WeierstrassCurve.map_baseChange`, -- `WeierstrassCurve.Affine.Point.map`. -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, V.1.1. - -/ - - open WeierstrassCurve -@@ -76,8 +28,6 @@ local notation "L" => AlgebraicClosure K - - noncomputable local instance : DecidableEq (AlgebraicClosure K) := Classical.decEq _ - --/-! ### The geometric Frobenius `K`-algebra hom and the codomain identification -/ -- - /-- The geometric Frobenius `K`-algebra hom `x ↦ x ^ q` on `L = AlgebraicClosure K`, - as a ring hom. This is `FiniteField.frobeniusAlgHom K L`, coerced to a `RingHom`. -/ - noncomputable def geomFrobRingHom : AlgebraicClosure K →+* AlgebraicClosure K := -@@ -106,13 +56,11 @@ fixes `algebraMap K L`). -/ - rw [AlgHom.toRingHom_eq_coe] - exact W.map_baseChange (FiniteField.frobeniusAlgHom K (AlgebraicClosure K)) - --/-! ### Geometric Frobenius on points and the base-change inclusion -/ -- - /-- The geometric Frobenius on `L`-points as a raw map: mathlib's - `WeierstrassCurve.Affine.Point.map` of the geometric Frobenius `K`-algebra hom - `frobeniusAlgHom K L : L →ₐ[K] L`. Its codomain `W⟮L⟯ = Point (W.baseChange L)` - is **definitionally** `(W.baseChange L).toAffine.Point`, so no cast is needed. --This mirrors `frobeniusW_KE` in `Hasse/IsogOneSubXyFamily.lean`. -/ -+-/ - noncomputable def geomFrobeniusPointFun : - (W.baseChange (AlgebraicClosure K)).toAffine.Point → - (W.baseChange (AlgebraicClosure K)).toAffine.Point := -@@ -184,17 +132,9 @@ theorem includePointBC_injective : Function.Injective (includePointBC W) := by - subst hx' hy' - rfl - --/-! ### S2 — the point-level fixed-locus theorem -- --We work directly with the raw functions to keep the rewriting along --`map_geomFrob_baseChange_eq_self` explicit. The `0` case is reflexivity; the affine case --reduces, via `HasseWeil.Affine.Point.map_some` and `some.injEq`, to the conjunction --`x ^ q = x ∧ y ^ q = y`, which Step 1 (`frobenius_fixed_iff_mem_baseField`) turns into --membership of both coordinates in `range (algebraMap K L)`. -/ -- - omit [DecidableEq K] in - set_option backward.isDefEq.respectTransparency false in --/-- **S2 (point fixed-locus)**: a point `P` over the algebraic closure is fixed by the -+/-- a point `P` over the algebraic closure is fixed by the - geometric Frobenius iff it is the base-change inclusion of a `K`-rational point. - - `geomFrobeniusPointFun P = P ↔ P ∈ Set.range (includePointBC W)`. -@@ -202,7 +142,7 @@ geometric Frobenius iff it is the base-change inclusion of a `K`-rational point. - Proof by cases on `P`: - * `P = 0`: fixed, and `0 = includePointBC 0`. - * `P = some x y h`: `Frob P = P ↔ x ^ q = x ∧ y ^ q = y` (coordinatewise, by -- `Affine.Point.map_some` + `some.injEq`), and by Step 1 each coordinate is fixed iff it -+ `Affine.Point.map_some` + `some.injEq`), and each coordinate is fixed iff it - lies in `range (algebraMap K L)`; assembling the two `K`-rational coordinates back into a - nonsingular `K`-point gives `P ∈ range includePointBC`. - -@@ -217,7 +157,7 @@ theorem geomFrobeniusPoint_fixed_iff_mem_range_includePointBC - · -- `P = 0`: fixed (`map_zero` is `rfl`), and `0 = includePointBC 0`. - exact iff_of_true rfl ⟨0, includePointBC_zero W⟩ - · -- `P = some x y h`. LHS reduces to `x ^ q = x ∧ y ^ q = y` (coordinatewise), -- -- each equivalent by Step 1 to membership in `range (algebraMap K L)`. -+ -- each equivalent to membership in `range (algebraMap K L)`. - rw [geomFrobeniusPointFun_some, Affine.Point.some.injEq] - show (FiniteField.frobeniusAlgHom K (AlgebraicClosure K)) x = x ∧ - (FiniteField.frobeniusAlgHom K (AlgebraicClosure K)) y = y ↔ _ -@@ -242,37 +182,18 @@ theorem geomFrobeniusPoint_fixed_iff_mem_range_includePointBC - rw [Affine.Point.some.injEq] at hQ - exact ⟨⟨x₀, hQ.1⟩, ⟨y₀, hQ.2⟩⟩ - --/-! ### S3 — kernel of `1 − π` over `L` = image of `E(K)` -- --The forward inclusion `range includePointBC ⊆ --{P | geomFrobeniusPointFun P = P}` is the "rational ⇒ fixed" direction (a rational `P` --has `(1 − π)P = P − πP = P − P = 0`); the reverse is the substantive S2 content. As an --*equality of sets* this is literally S2 (`geomFrobeniusPoint_fixed_iff_mem_range_includePointBC`) --repackaged, so we state it that way and reduce to S2. -/ -- - omit [DecidableEq K] in --/-- **S3 (set form)**: the fixed locus of the geometric Frobenius equals the image of the --`K`-rational points. This is S2 in `Set` form. -/ -+/-- the fixed locus of the geometric Frobenius equals the image of the -+`K`-rational points. -/ - theorem fixedLocus_geomFrobenius_eq_range_includePointBC : - {P : (W.baseChange (AlgebraicClosure K)).toAffine.Point | geomFrobeniusPointFun W P = P} = - Set.range (includePointBC W) := by - ext P - exact geomFrobeniusPoint_fixed_iff_mem_range_includePointBC W P - --/-! ### S4 — cardinality glue -- --The final glue: `# ker(id − geomFrobeniusPoint) = pointCount W`. S2/S3 identify the --fixed locus with `range includePointBC`, and `includePointBC` is injective (it is --`Affine.Point.map` of an injective ring hom, see `WeierstrassCurve.Affine.Point.map_injective`), --so the fixed locus is in bijection with `W.toAffine.Point`, whose cardinality is `pointCount W`. --Combined with the algebraic-closed fibre count --(`CurveMap.exists_heightOneSpectrum_fiber_card_eq_sepDegree_unconditional`) this yields --`deg(1 − π) = pointCount`. -/ -- - omit [DecidableEq K] in --/-- **S4 (cardinality)**: the number of geometric-Frobenius-fixed `L`-points equals --the `K`-rational point count `Fintype.card W.toAffine.Point` (= `pointCount`). Reduces to S3 --(`fixedLocus … = range includePointBC`) plus injectivity of `includePointBC`. -/ -+/-- the number of geometric-Frobenius-fixed `L`-points equals -+the `K`-rational point count `Fintype.card W.toAffine.Point` (= `pointCount`). -/ - theorem ncard_fixedLocus_geomFrobenius_eq_pointCount [Fintype W.toAffine.Point] : - {P : (W.baseChange (AlgebraicClosure K)).toAffine.Point | - geomFrobeniusPointFun W P = P}.ncard = Fintype.card W.toAffine.Point := by -@@ -280,15 +201,6 @@ theorem ncard_fixedLocus_geomFrobenius_eq_pointCount [Fintype W.toAffine.Point] - Set.ncard_range_of_injective (includePointBC_injective W), - Nat.card_eq_fintype_card] - --/-! ### PRIORITY 1 — kernel of `id − geomFrobenius` over `L` -- --The geometric Frobenius on `L`-points is already mathlib's --`WeierstrassCurve.Affine.Point.map (frobeniusAlgHom K L)`, an `AddMonoidHom` --`(W.baseChange L)⟮L⟯ →+ (W.baseChange L)⟮L⟯` whose `.toFun` is definitionally --`geomFrobeniusPointFun W` (mirroring `frobeniusW_KE` in --`Hasse/IsogOneSubXyFamily.lean`). We bundle it, form `1 − π` as an --`AddMonoidHom`, and identify its kernel with the fixed locus. -/ -- - /-- **Geometric Frobenius on `L`-points as an `AddMonoidHom`**: mathlib's - `Affine.Point.map (frobeniusAlgHom K L)`. Its `.toFun` is definitionally - `geomFrobeniusPointFun W`. -/ -@@ -317,19 +229,19 @@ omit [DecidableEq K] in - oneSubGeomFrobHom W P = P - geomFrobeniusPointFun W P := rfl - - omit [DecidableEq K] in --/-- **PRIORITY 1 (kernel = fixed locus)**: `P ∈ ker(id − geomFrob) ⟺ -+/-- `P ∈ ker(id − geomFrob) ⟺ - geomFrob P = P`. Direct from `sub_eq_zero`. -/ - theorem ker_oneSubGeomFrobHom_eq_fixedLocus : - ((oneSubGeomFrobHom W).ker : Set (W.baseChange (AlgebraicClosure K)).toAffine.Point) = - {P | geomFrobeniusPointFun W P = P} := by - ext P -- rw [SetLike.mem_coe, AddMonoidHom.mem_ker, Set.mem_setOf_eq, oneSubGeomFrobHom_apply, -+ rw [SetLike.mem_coe, AddMonoidHom.mem_ker, Set.mem_ofPred_eq, oneSubGeomFrobHom_apply, - sub_eq_zero, eq_comm] - - omit [DecidableEq K] in --/-- **PRIORITY 1 (cardinality)**: the geometric-Frobenius fixed locus, i.e. -+/-- the geometric-Frobenius fixed locus, i.e. - `ker(id − geomFrob)`, has cardinality `pointCount W`. Composes --`ker_oneSubGeomFrobHom_eq_fixedLocus` with S4 -+`ker_oneSubGeomFrobHom_eq_fixedLocus` with - (`ncard_fixedLocus_geomFrobenius_eq_pointCount`). -/ - theorem ncard_ker_oneSubGeomFrobHom_eq_pointCount [Fintype W.toAffine.Point] : - ((oneSubGeomFrobHom W).ker : -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/IntegralClosure.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/IntegralClosure.lean -index b3c5b8f64e3264fafd4ab131a093d258bbd32966..e257fed368990ece1c76792d0f26d887b83c989d 100644 -GIT binary patch -delta 353 -zcmYjMy-EW?5QaljTx|5TH6vK4gcKrzQN(~xU}9kv*1O5w;O%VO-HWCY?JTTTC8f0p -z5w7wfYF8~CqW>#7;BLNURz{Cib3_j7D!*ELspUs -zOcTct(*O;)+fEQcL~=^@g$1dM1;yBaQ;twi#H>3 -zt#Xz-sH}VYetuP1T$s5zn -l`4E)ESU?jPzVBaPd$SHSLviD5wL0_XU)k?k-Ws*%{sE*_f>{6n - -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CoordHomFinite.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CoordHomFinite.lean -index 5456f6e64..33637b28c 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CoordHomFinite.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CoordHomFinite.lean -@@ -6,70 +6,20 @@ Authors: Chris Birkbeck - import HasseWeil.Foundation.Curves.Map.CurveMap - - /-! --# Module-finiteness along a coordinate-ring witness (the standing `hfin`, DERIVED) -- --For a curve map `φ : C₁ → C₂` with a coordinate-ring pullback witness --`cd : φ.CoordHom`, the coordinate ring `F[C₁]` is a **finite module** over --`F[C₂]` via `cd.toAlgebra` — *unconditionally*. This derives the standing --`Module.Finite` hypothesis (`hfin`) carried throughout the isogeny theory by --`CurveMap.sum_ramificationIdx_mul_inertiaDeg_eq_degree`, --`EC.Isogeny.addHomProperty` / `toBasicIsogeny` (K̄-level), --`EC.Isogeny.addHomProperty_descend` / `toBasicIsogenyDescend` --(K-level), `Isogeny.pushforward` (`Curves/PushforwardDivisor.lean`), --`EC/KernelCount.lean`, and friends. -- --## The proof (no separability, no places classification) -- --Write `u := ψ(x₂) ∈ F[C₁]` for the image of the coordinate generator of `C₂` --under an injective `F`-algebra map `ψ : F[C₂] →ₐ[F] F[C₁]`, and decompose --`u = p•1 + q•Y` in the `{1, Y}` basis of `F[C₁]` over `F[x₁] = F[X]`. Then --`u` satisfies the quadratic relation of its conjugate pair over `F[X]`: -- --`u² − t(x₁)·u + n(x₁) = 0`, where `t := 2p − q·(a₁X + a₃)` and --`n := p² − pq·(a₁X + a₃) − q²·(X³ + a₂X² + a₄X + a₆)` -- --(`n` is mathlib's `Algebra.norm F[X] u`; the difference of the two sides is --`q²·W(X, Y)`, which vanishes mod the Weierstrass polynomial). Reading the --relation backwards as a polynomial in `x₁` with coefficients in the image of --`ψ` gives `n(T) − u·t(T) + u² = 0` at `T = x₁`. -- --**The parity trick**: `deg(p²) = 2 deg p` is even while --`deg(q²·(X³ + ⋯)) = 2 deg q + 3` is odd, so the two leading terms never --cancel: `deg n = max(2 deg p, 2 deg q + 3)` with leading coefficient a --**unit of `F`** (`WeierstrassCurve.Affine.CoordinateRing.degree_norm_smul_basis`), --and `deg t < deg n`. Hence the displayed `T`-polynomial is monic after --scaling by that unit's inverse, with coefficients in the image of `F[C₂]`: --the generator `x₁` is **integral** over `F[C₂]`. (`u ∉ F·1` because `ψ` is --injective, ruling out the degenerate `q = 0 ∧ p constant` case.) Since --`F[C₁]` is spanned by `F[x₁]·{1, Y}`, module-finiteness follows from --`IsIntegral.fg_adjoin_singleton`. -- --This argument works in **any characteristic and for inseparable maps** (for --the Frobenius comorphism `u = x₁^p` it produces the monic witness --`(T^p − u)²`-style relation), so no separability hypothesis, no AKLB --machinery, and no Nagata-style finiteness of integral closures is needed. --The classical "places of `K(C₁)` over affine places of `C₂` are point --places" wall is bypassed entirely by the explicit Weierstrass presentation. -- --## Main results -- --* `algHom_coordinateRing_isIntegralElem_X` — the keystone: the coordinate -- generator `x₁` is integral over `F[C₂]` along any injective `F`-algebra -- hom `F[C₂] →ₐ[F] F[C₁]`. --* `algHom_coordinateRing_module_finite` — `F[C₁]` is a finite module over -- `F[C₂]` along any injective `F`-algebra hom. --* `CurveMap.CoordHom.toAlgHom_injective` — a `CoordHom` is automatically -- injective (from `compat` plus injectivity of the function-field pullback). --* `CurveMap.CoordHom.module_finite` — **the deliverable**: the standing -- `hfin` hypothesis holds for every `(φ, cd)`, with no further assumptions. --* `CurveMap.sum_ramificationIdx_mul_inertiaDeg_eq_degree'` — Silverman -- II.2.6(a) `Σ e·f = deg φ` with `hfin` discharged. -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*], II.2.6, II.3 (finiteness -- of morphisms of smooth curves) — obtained here by direct -- Weierstrass-presentation algebra instead of valuation theory. -+An injective homomorphism between Weierstrass coordinate rings makes the target -+a finite module over the source. Writing the image of the source coordinate as -+`u = p + qY`, its trace and norm give a quadratic relation in `u` with -+polynomial coefficients in the target coordinate. The terms of the norm have -+opposite degree parity, so its leading coefficient is a unit and the trace -+has smaller degree. Reading this relation as a polynomial in the target -+coordinate gives a monic integral relation after scaling. -+ -+A compatible function-field pullback makes the coordinate-ring homomorphism -+injective. Thus the finite-module hypothesis in the weighted ramification -+sum follows for every coordinate-ring pullback witness, without separability -+or characteristic assumptions. -+ -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.6 and II.3. - -/ - - namespace HasseWeil.Curves -@@ -413,9 +363,9 @@ theorem algHom_coordinateRing_module_finite - (ψ : C₂.CoordinateRing →ₐ[F] C₁.CoordinateRing) (hψ : Function.Injective ψ) : - @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ - ψ.toRingHom.toAlgebra.toModule := by -- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := ψ.toRingHom.toAlgebra -- letI : Module C₂.CoordinateRing C₁.CoordinateRing := Algebra.toModule -- haveI : IsScalarTower F C₂.CoordinateRing C₁.CoordinateRing := -+ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := ψ.toRingHom.toAlgebra -+ let : Module C₂.CoordinateRing C₁.CoordinateRing := Algebra.toModule -+ have : IsScalarTower F C₂.CoordinateRing C₁.CoordinateRing := - IsScalarTower.of_algebraMap_eq fun c ↦ (ψ.commutes c).symm - have hx : IsIntegral C₂.CoordinateRing - (algebraMap (Polynomial F) C₁.CoordinateRing Polynomial.X) := -@@ -487,12 +437,7 @@ namespace CurveMap - -- Instance synthesis and unification at curve-indexed coordinate-ring types - -- (`AdjoinRoot`-quotients) need a higher budget; same settings as - -- `CurveMap.sum_ramificationIdx_mul_inertiaDeg_eq_degree`. --/-- **Silverman II.2.6(a), Σ e·f form, `hfin`-free** (T-II-2-008): for a --`CurveMap φ : C₁ → C₂` with coordinate-ring pullback witness `coordHom`, the --sum `Σ_{P over p} e_P · f_P` equals the function-field degree `φ.degree`. --The module-finiteness input of --`sum_ramificationIdx_mul_inertiaDeg_eq_degree` is supplied by --`CoordHom.module_finite`. -/ -+ - theorem sum_ramificationIdx_mul_inertiaDeg_eq_degree' - {C₁ C₂ : SmoothPlaneCurve F} - [IsIntegrallyClosed C₂.CoordinateRing] -@@ -502,7 +447,7 @@ theorem sum_ramificationIdx_mul_inertiaDeg_eq_degree' - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - ∑ P ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, - Ideal.ramificationIdx' p P * -- Ideal.inertiaDeg' p P = φ.degree := -+ P.inertiaDeg C₂.CoordinateRing = φ.degree := - φ.sum_ramificationIdx_mul_inertiaDeg_eq_degree coordHom - coordHom.module_finite hpMax hp0 - -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMap.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMap.lean -index aae9d4fe3..67470605c 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMap.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMap.lean -@@ -1,6 +1,6 @@ - import HasseWeil.Foundation.Curves.Valuation.Valuation - import HasseWeil.Foundation.Curves.IntegralClosure --import Mathlib.NumberTheory.RamificationInertia.Basic -+import Mathlib.RingTheory.RamificationInertia.Basic - - /-! - # Curve maps via function-field pullback -@@ -14,10 +14,6 @@ injective). - The **degree** of `φ` is the dimension of `K(C₁)` as a `K(C₂)`-module via - the pullback: `deg φ = [K(C₁) : φ*K(C₂)]`. - --This closes tickets T-II-INFRA-B-006/007 of the Stream-A infrastructure plan --and provides the foundational object for T-II-2-002..011 (which will add --surjectivity, ramification, and the fiber-card formula). -- - ## References - - * [Silverman, *The Arithmetic of Elliptic Curves*], II.2.4 (curves-fields -@@ -79,8 +75,6 @@ theorem comp_assoc {C₄ : SmoothPlaneCurve F} - @[simp] theorem comp_id (φ : CurveMap C₁ C₂) : φ.comp (id C₁) = φ := - CurveMap.ext (AlgHom.id_comp _) - --/-! ### Degree -/ -- - /-- The algebra structure on `K(C₁)` induced by the pullback of `φ`. -/ - @[reducible] - noncomputable def toAlgebra (φ : CurveMap C₁ C₂) : -@@ -110,12 +104,12 @@ theorem comp_algebraMap_eq (ψ : CurveMap C₂ C₃) (φ : CurveMap C₁ C₂) - theorem degree_comp (ψ : CurveMap C₂ C₃) (φ : CurveMap C₁ C₂) : - (ψ.comp φ).degree = φ.degree * ψ.degree := by - simp only [degree] -- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -- letI : Algebra C₃.FunctionField C₂.FunctionField := ψ.toAlgebra -- letI : Algebra C₃.FunctionField C₁.FunctionField := (ψ.comp φ).toAlgebra -- haveI : IsScalarTower C₃.FunctionField C₂.FunctionField C₁.FunctionField := -+ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ let : Algebra C₃.FunctionField C₂.FunctionField := ψ.toAlgebra -+ let : Algebra C₃.FunctionField C₁.FunctionField := (ψ.comp φ).toAlgebra -+ have : IsScalarTower C₃.FunctionField C₂.FunctionField C₁.FunctionField := - IsScalarTower.of_algebraMap_eq fun _ ↦ rfl -- haveI : Module.Free C₂.FunctionField C₁.FunctionField := -+ have : Module.Free C₂.FunctionField C₁.FunctionField := - Module.Free.of_divisionRing _ _ - rw [mul_comm] - exact (Module.finrank_mul_finrank -@@ -138,27 +132,11 @@ def IsSeparable (φ : CurveMap C₁ C₂) : Prop := φ.inseparableDegree = 1 - /-- A curve map is **purely inseparable** if its separable degree is 1. -/ - def IsPurelyInseparable (φ : CurveMap C₁ C₂) : Prop := φ.separableDegree = 1 - ---- **Silverman II.2.4.1** (pullback half, deferred): if `φ : C₁ → C₂` has ---- degree 1, its pullback is surjective. ---- Proof sketch: `finrank_eq_one_iff'` gives `v ≠ 0` with `K(C₁) = K(C₂) • v`. ---- From `c₀ • v = 1` in a field, `v = (algebraMap c₀)⁻¹`, so every `x ∈ K(C₁)` ---- is `c_x • v = algebraMap c_x / algebraMap c₀ = algebraMap (c_x / c₀)`. ---- The Lean proof needs `algebraMap C₂.FunctionField C₁.FunctionField` to ---- resolve to `φ.pullback.toRingHom` via `haveI : Algebra ... := φ.toAlgebra`, ---- but instance synthesis tends to pick unrelated `Algebra` instances. ---- Deferred for future cleanup. -- --/-! ### Ramification order -/ -- - /-- The order of the pullback of a function `t ∈ K(C₂)` at a smooth point - `P ∈ C₁`: `ord_P (φ* t)`. When `t` is a uniformizer at the image point - `φ(P) ∈ C₂`, this equals Silverman's ramification index `e_φ(P)` of II.2.5. - --Our formulation takes the test function `t` as an explicit argument rather --than deriving it from an intrinsic "image point" `φ(P)`, since the --point-image correspondence (Silverman II.2.4(c)) is deferred to later --infrastructure. Downstream users supply a uniformizer at the intended --image point. -+The test function `t` is an explicit uniformizer at the intended image point. - Reference: Silverman II.2.5 (definition). -/ - noncomputable def ramificationIndex (φ : CurveMap C₁ C₂) (P : C₁.SmoothPoint) - (t : C₂.FunctionField) : WithTop ℤ := -@@ -239,8 +217,6 @@ theorem one_le_ramificationIndex_of_pullback_pointValuation_lt_one - (1 : WithTop ℤ) ≤ φ.ramificationIndex P t := - (C₁.one_le_ord_P_iff_pointValuation_lt_one (φ.pullback_ne_zero ht)).mpr h - --/-! ### Pushforward / Norm map (T-II-2-005) -/ -- - /-- The **pushforward** (norm map) `φ_* : K(C₁) →* K(C₂)` for a curve map - `φ : C₁ → C₂`, defined as the `K(C₂)`-algebra norm on `K(C₁)` via `φ.toAlgebra`. - Silverman's `φ_* = (φ*)⁻¹ ∘ N_{K(C₁)/φ*K(C₂)}` simplifies to the direct -@@ -255,7 +231,7 @@ noncomputable def pushforward (φ : CurveMap C₁ C₂) : - Reference: Silverman II.2 (after definition of `φ_*`). -/ - theorem pushforward_pullback (φ : CurveMap C₁ C₂) (g : C₂.FunctionField) : - φ.pushforward (φ.pullback g) = g ^ φ.degree := by -- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra - exact Algebra.norm_algebraMap g - - /-- The pushforward is multiplicative. -/ -@@ -268,18 +244,6 @@ theorem pushforward_pullback (φ : CurveMap C₁ C₂) (g : C₂.FunctionField) - φ.pushforward (1 : C₁.FunctionField) = 1 := - φ.pushforward.map_one - --/-! ### Fiber cardinality (T-II-2-011): Silverman II.2.7 -- --The classical Silverman II.2.7 asserts that a nonconstant curve map `φ` is --unramified iff every geometric fiber has cardinality `deg(φ)`. Since our --`CurveMap` models the function-field side only (no explicit `fiber` type), --we record the combinatorial content as a **witness-parametric** statement: --given a `Finset` of points, their ramification indices, and the sum formula --II.2.6(a) (`Σ e_φ(P) = deg(φ)` witness), the fiber-count equals `deg(φ)` iff --every index is `1`. Once II.2.6(a) is formalized, this immediately gives --T-II-2-011 for every image point `Q`. ---/ -- - /-- **Combinatorial lemma**: if `e : α → ℤ` is ≥ 1 on every element of a - finset `S`, then `∑ P ∈ S, e P = #S` iff each `e P = 1`. - -@@ -298,7 +262,7 @@ theorem _root_.Finset.sum_eq_card_iff_forall_eq_one_of_one_le - linarith - · exact (Finset.sum_congr rfl h).trans hconst - --/-- **Witness-parametric Silverman II.2.7** (T-II-2-011): given a finite -+/-- **Witness-parametric Silverman II.2.7**: given a finite - fiber `S` with ramification indices ≥ 1 summing to `deg(φ)`, the fiber - count equals `deg(φ)` iff every ramification index equals `1`. - -@@ -321,15 +285,13 @@ theorem fiber_card_eq_degree_iff_all_ramificationIndexℤ_one - rw [← hsum, eq_comm] - exact Finset.sum_eq_card_iff_forall_eq_one_of_one_le hle - --/-! ### Degree-one morphisms are isomorphisms on function fields (T-II-2-006) -/ -- - /-- **Silverman II.2.4.1 (pullback-surjectivity form)**: if a curve map `φ` - has degree 1, its pullback `φ*` is surjective. Combined with the automatic - injectivity of pullbacks, `φ*` is then a bijection of function fields. -/ - theorem pullback_surjective_of_degree_one (φ : CurveMap C₁ C₂) - (h : φ.degree = 1) : Function.Surjective φ.pullback := by -- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -- haveI : Module.Free C₂.FunctionField C₁.FunctionField := -+ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ have : Module.Free C₂.FunctionField C₁.FunctionField := - Module.Free.of_divisionRing _ _ - have hfr : Module.finrank C₂.FunctionField C₁.FunctionField = 1 := h - obtain ⟨v, _hv_ne, hv⟩ := finrank_eq_one_iff'.mp hfr -@@ -345,17 +307,6 @@ theorem pullback_surjective_of_degree_one (φ : CurveMap C₁ C₂) - rw [map_div₀, div_eq_mul_inv, ← hv_eq, ← Algebra.smul_def] - exact hcv - --/-! ### Silverman II.2.6(a): `Σ e_φ(P) · f_φ(P) = deg(φ)` (T-II-2-008 via --coordinate-ring algebra witness) -- --`CurveMap` stores only the function-field pullback; a generic Dedekind-style --sum-of-ramification-indices formula requires the pullback to restrict to a --ring hom `C₂.CoordinateRing → C₁.CoordinateRing`. We expose this as an --**auxiliary data bundle** (`CurveMap.CoordHom`) together with a compatibility --condition. For the specific coordinate function `x : C → A¹` --(`algebraMap F[X] → F[C]`), see `HasseWeil/Curves/NormValuation.lean`'s --`sum_ramificationIdx_over_fiber` for the unconditional instance. -/ -- - /-- **Coordinate-ring pullback witness**: for a `CurveMap φ : C₁ → C₂`, a - ring hom `C₂.CoordinateRing → C₁.CoordinateRing` compatible with the - function-field pullback. Not every function-field pullback restricts to -@@ -378,7 +329,7 @@ noncomputable def CoordHom.toAlgebra {φ : CurveMap C₁ C₂} (coordHom : φ.Co - Algebra C₂.CoordinateRing C₁.CoordinateRing := - coordHom.toAlgHom.toRingHom.toAlgebra - --/-- **Silverman II.2.6(a), Σ e·f form** (T-II-2-008, generic `CurveMap`): -+/-- **Silverman II.2.6(a), Σ e·f form**: - for a `CurveMap φ : C₁ → C₂` with coordinate-ring pullback witness - `coordHom` and finite-module structure, the sum `Σ_{P over p} e_P · f_P` - equals the function-field degree `φ.degree`. -@@ -402,16 +353,16 @@ theorem sum_ramificationIdx_mul_inertiaDeg_eq_degree - letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra - ∑ P ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, - Ideal.ramificationIdx' p P * -- Ideal.inertiaDeg' p P = φ.degree := by -- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := -+ P.inertiaDeg C₂.CoordinateRing = φ.degree := by -+ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := - coordHom.toAlgebra -- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -- haveI : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing -+ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra -+ have : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing - C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ - rw [RingHom.algebraMap_toAlgebra] - rfl -- haveI : IsScalarTower C₂.CoordinateRing C₂.FunctionField -+ have : IsScalarTower C₂.CoordinateRing C₂.FunctionField - C₁.FunctionField := by - refine IsScalarTower.of_algebraMap_smul fun r x ↦ ?_ - rw [Algebra.smul_def] -@@ -420,12 +371,44 @@ theorem sum_ramificationIdx_mul_inertiaDeg_eq_degree - rw [coordHom.compat r, ← IsScalarTower.algebraMap_smul C₁.CoordinateRing r x, - ← Algebra.smul_def] - rfl -- haveI : p.IsMaximal := hpMax -- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -- haveI : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ -+ have : p.IsMaximal := hpMax -+ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule -+ have : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ - modCR := hfin -- exact Ideal.sum_ramification_inertia (R := C₂.CoordinateRing) -- (S := C₁.CoordinateRing) C₂.FunctionField C₁.FunctionField hp0 -+ have : Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing := by -+ apply Module.isTorsionFree_iff_algebraMap_injective.mpr -+ intro a b hab -+ apply IsFractionRing.injective C₂.CoordinateRing C₂.FunctionField -+ apply φ.pullback.injective -+ change φ.pullback (algebraMap C₂.CoordinateRing C₂.FunctionField a) = -+ φ.pullback (algebraMap C₂.CoordinateRing C₂.FunctionField b) -+ rw [coordHom.compat a, coordHom.compat b] -+ exact congrArg (algebraMap C₁.CoordinateRing C₁.FunctionField) hab -+ classical -+ let : Fintype (p.primesOver C₁.CoordinateRing) := Fintype.ofFinite _ -+ calc -+ _ = ∑ P : p.primesOver C₁.CoordinateRing, -+ P.1.ramificationIdx C₂.CoordinateRing * P.1.inertiaDeg C₂.CoordinateRing := by -+ apply Finset.sum_bij (fun P hP ↦ -+ ⟨P, (IsDedekindDomain.mem_primesOverFinset_iff hp0 C₁.CoordinateRing).mp hP⟩) -+ · intro P hP -+ exact Finset.mem_univ _ -+ · intro P hP Q hQ h -+ exact congrArg Subtype.val h -+ · intro P _ -+ exact ⟨P.1, -+ (IsDedekindDomain.mem_primesOverFinset_iff hp0 C₁.CoordinateRing).mpr P.2, rfl⟩ -+ · intro P hP -+ obtain ⟨hprime, hover⟩ := -+ (IsDedekindDomain.mem_primesOverFinset_iff hp0 C₁.CoordinateRing).mp hP -+ let := hprime -+ let := hover -+ rw [Ideal.ramificationIdx'_eq_ramificationIdx p P hp0] -+ _ = Module.finrank C₂.CoordinateRing C₁.CoordinateRing := -+ Ideal.sum_ramification_inertia_eq_finrank p C₁.CoordinateRing -+ _ = φ.degree := -+ (IsFractionRing.finrank_eq C₂.CoordinateRing C₂.FunctionField -+ C₁.CoordinateRing C₁.FunctionField).symm - - end CurveMap - -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMapBaseChange.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMapBaseChange.lean -index e1c402904..2537c2d15 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMapBaseChange.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMapBaseChange.lean -@@ -16,33 +16,14 @@ import Mathlib.RingTheory.TensorProduct.Free - /-! - # Base change of curves and curve maps - --For a smooth plane curve `C / F` and an `F`-algebra extension `L`, this file builds the --natural scalar-extension maps and identifies the scalar extension of the coordinate ring --and function field with the base-changed curve. These are foundations for the --Galois-descent route to the unconditional `AddHomProperty` (Phase G of the Pic⁰ roadmap). -+Scalar extension identifies the coordinate ring of a smooth plane curve with the -+coordinate ring of its base change. The corresponding function-field tensor product -+is a localization of the coordinate-ring tensor product. For algebraic field extensions, -+this gives the natural isomorphism between scalar extension and the fraction field -+of the extended coordinate ring. - --## Main definitions -- --* `SmoothPlaneCurve.coordRingMap` — the include of coordinate rings. --* `SmoothPlaneCurve.functionFieldMap` — the include of function fields. --* `SmoothPlaneCurve.coordRingScalarExt` — the scalar-extension iso -- `L ⊗[F] C.CoordinateRing ≃ₐ[L] (C.baseChange L).CoordinateRing`. --* `CurveMap.CoordHom.baseChangeAlgHom` — the base-changed coordinate-ring alg hom of a `CoordHom`. -- --## Main results -- --* `SmoothPlaneCurve.isDomain_tensorCoordRing` — `L ⊗[F] C.CoordinateRing` is a domain. --* `SmoothPlaneCurve.tensor_functionField_isFractionRing` — `L ⊗[F] C.FunctionField` is the -- fraction ring of `L ⊗[F] C.CoordinateRing`. --* `SmoothPlaneCurve.functionField_tensor_locBaseChange` — localization commutes with the base -- change `L/F`: `L ⊗[F] C.FunctionField ≃ₐ[L] FractionRing (L ⊗[F] C.CoordinateRing)`. -- --## Implementation notes -- --The `Algebra F` / `Algebra F[X]` instances on `AdjoinRoot W.polynomial` form a typeclass --diamond that blocks synthesis of the tensor-product algebra/module structures. Section --`PhaseGInstances` pins the F-route instances at high priority so signatures mentioning --`L ⊗[F] C.CoordinateRing` (and its function-field analogue) elaborate diamond-free. -+The algebra and module structures are chosen compatibly with the scalar tower through -+the polynomial ring. - - ## References - -@@ -179,7 +160,6 @@ theorem baseChange_inner_comp_mapRingHom_eq {φ : CurveMap C₁ C₂} - C₁.coordRingMap L (cd.toAlgHom - (algebraMap (Polynomial F) C₂.CoordinateRing (Polynomial.C a))) - rw [Polynomial.map_C] -- change (cd.baseChangeInnerAlgHom L) (Polynomial.C (algebraMap F L a)) = _ - simp only [baseChangeInnerAlgHom] - rw [Polynomial.aeval_C, show (algebraMap (Polynomial F) C₂.CoordinateRing) (Polynomial.C a) = - algebraMap F C₂.CoordinateRing a from -@@ -262,8 +242,8 @@ noncomputable instance (priority := 100000) coordRingModuleBase : - /-- `CommRing` on the scalar-extension tensor `L ⊗[F] C.CR`, pinned at high - priority. The default synthesis loses to the `Algebra F` / `Algebra F[X]` - diamond on `AdjoinRoot W.polynomial` (it tries the `F[X]`-route algebra on --`C.CR`); pinning the F-route `CommRing` here unblocks any signature that --mentions `L ⊗[F] C.CR` (e.g. `FractionRing (L ⊗[F] C.CR)`). -/ -+`C.CR`). This instance uses the algebra over `F` in the tensor product -+and its fraction field. -/ - noncomputable instance (priority := 100000) tensorCoordRingCommRing - (L : Type*) [Field L] [Algebra F L] : - CommRing (L ⊗[F] C.toAffine.CoordinateRing) := -@@ -310,8 +290,8 @@ noncomputable instance (priority := 100000) tensorFunctionFieldFLScalarTower - pinned at high priority. The same `Algebra F` / `Algebra F[X]` diamond on - `AdjoinRoot W.polynomial` that taints `L ⊗[F] C.CR` recurs at the function-field - level (since `C.FF = FractionRing C.CR` carries the `C.CR`-algebra, which routes --back through the diamond). Pinning the F-route `CommRing` unblocks any signature --mentioning `L ⊗[F] C.FF`. -/ -+back through the diamond). This instance uses the algebra over `F` -+in the function-field tensor product. -/ - noncomputable instance (priority := 100000) tensorFunctionFieldCommRing - (L : Type*) [Field L] [Algebra F L] : - CommRing (L ⊗[F] C.toAffine.FunctionField) := -@@ -693,8 +673,7 @@ theorem tensorFunctionFieldStructureHom_injective (L : Type*) [Field L] [Algebra - Module.Flat.lTensor_preserves_injective_linearMap gF hg - have hfun : ⇑(C.tensorFunctionFieldStructureHom L) = ⇑(LinearMap.lTensor L gF) := by - funext x -- induction x using TensorProduct.induction_on with -- | zero => simp -+ induction x using TensorProduct.inductionOn with - | tmul l u => - rw [LinearMap.lTensor_tmul] - change Algebra.TensorProduct.map (AlgHom.id L L) -@@ -707,12 +686,12 @@ theorem tensorFunctionFieldStructureHom_injective (L : Type*) [Field L] [Algebra - exact hlin - - /-- `C.CoordinateRing ⊗[F] L` is a domain, for any field extension `L/F`. Obtained from the --sibling `isDomain_tensorCoordRing` (which gives the `L`-on-the-left orientation -+`isDomain_tensorCoordRing` (which gives the `L`-on-the-left orientation - `L ⊗[F] C.CoordinateRing`) by transporting the domain structure across the commutativity - ring-iso `Algebra.TensorProduct.comm`. -/ - private theorem tensorCoordRing_comm_isDomain (L : Type*) [Field L] [Algebra F L] : - IsDomain (C.toAffine.CoordinateRing ⊗[F] L) := by -- letI := C.isDomain_tensorCoordRing L -+ let := C.isDomain_tensorCoordRing L - exact - (Algebra.TensorProduct.comm F L C.toAffine.CoordinateRing).symm.toRingEquiv.toMulEquiv.isDomain - (L ⊗[F] C.toAffine.CoordinateRing) -@@ -727,9 +706,9 @@ private theorem tensorCoordRing_algebraMapSubmonoid_le_nonZeroDivisors - Algebra.algebraMapSubmonoid (C.toAffine.CoordinateRing ⊗[F] L) - (nonZeroDivisors C.toAffine.CoordinateRing) ≤ - nonZeroDivisors (C.toAffine.CoordinateRing ⊗[F] L) := by -- haveI hflatCR : Module.Flat F C.toAffine.CoordinateRing := Module.Flat.of_free -- letI := C.tensorCoordRing_comm_isDomain L -- haveI hnzdCR : NoZeroDivisors (C.toAffine.CoordinateRing ⊗[F] L) := -+ have hflatCR : Module.Flat F C.toAffine.CoordinateRing := Module.Flat.of_free -+ let := C.tensorCoordRing_comm_isDomain L -+ have hnzdCR : NoZeroDivisors (C.toAffine.CoordinateRing ⊗[F] L) := - isCancelMulZero_iff_noZeroDivisors.mp ‹IsDomain _›.toIsCancelMulZero - have hinjL : Function.Injective - (Algebra.TensorProduct.includeLeft : -@@ -758,11 +737,11 @@ private theorem tensorFunctionField_isLocalization (L : Type*) [Field L] [Algebr - (Algebra.algebraMapSubmonoid (C.toAffine.CoordinateRing ⊗[F] L) - (nonZeroDivisors C.toAffine.CoordinateRing)) - (C.toAffine.FunctionField ⊗[F] L) := by -- letI algBC : Algebra (C.toAffine.CoordinateRing ⊗[F] L) (C.toAffine.FunctionField ⊗[F] L) := -+ let algBC : Algebra (C.toAffine.CoordinateRing ⊗[F] L) (C.toAffine.FunctionField ⊗[F] L) := - (Algebra.TensorProduct.map - (IsScalarTower.toAlgHom F C.toAffine.CoordinateRing C.toAffine.FunctionField) - (AlgHom.id F L)).toRingHom.toAlgebra -- haveI tower : IsScalarTower C.toAffine.CoordinateRing (C.toAffine.CoordinateRing ⊗[F] L) -+ have tower : IsScalarTower C.toAffine.CoordinateRing (C.toAffine.CoordinateRing ⊗[F] L) - (C.toAffine.FunctionField ⊗[F] L) := - IsScalarTower.of_algebraMap_eq fun _ ↦ rfl - exact @IsLocalization.tensorProduct_tensorProduct F L _ _ _ C.toAffine.CoordinateRing _ _ -@@ -786,14 +765,14 @@ the function field on the **left** (`FunctionField ⊗[F] L`) to match that cons - private theorem tensorFunctionField_isDomain (L : Type*) [Field L] [Algebra F L] : - IsDomain (C.toAffine.FunctionField ⊗[F] L) := by - -- `C.CoordinateRing ⊗[F] L` is a domain (the base ring of the localization below). -- letI := C.tensorCoordRing_comm_isDomain L -+ let := C.tensorCoordRing_comm_isDomain L - -- The natural `lTensor`-of-localization algebra structure exhibiting the function field - -- tensor as a localization of the coordinate-ring tensor. -- letI _algBC : Algebra (C.toAffine.CoordinateRing ⊗[F] L) (C.toAffine.FunctionField ⊗[F] L) := -+ let _algBC : Algebra (C.toAffine.CoordinateRing ⊗[F] L) (C.toAffine.FunctionField ⊗[F] L) := - (Algebra.TensorProduct.map - (IsScalarTower.toAlgHom F C.toAffine.CoordinateRing C.toAffine.FunctionField) - (AlgHom.id F L)).toRingHom.toAlgebra -- haveI := C.tensorFunctionField_isLocalization L -+ have := C.tensorFunctionField_isLocalization L - -- A localization of a domain at a submonoid of nonzerodivisors is again a domain. - exact IsLocalization.isDomain_of_le_nonZeroDivisors (C.toAffine.FunctionField ⊗[F] L) - (C.tensorCoordRing_algebraMapSubmonoid_le_nonZeroDivisors L) -@@ -805,7 +784,7 @@ when consumed by `tensor_functionField_isFractionRing`. -/ - theorem tensor_functionField_isField (L : Type*) [Field L] [Algebra F L] - [Algebra.IsAlgebraic F L] : - IsField (L ⊗[F] C.toAffine.FunctionField) := by -- haveI := C.tensorFunctionField_isDomain L -+ have := C.tensorFunctionField_isDomain L - have hF : IsField (C.toAffine.FunctionField ⊗[F] L) := - Algebra.TensorProduct.isField_of_isAlgebraic F C.toAffine.FunctionField L - (Or.inr (inferInstance : Algebra.IsAlgebraic F L)) -@@ -842,7 +821,7 @@ private theorem oneTmul_mem_nonZeroDivisors (L : Type*) [Field L] [Algebra F L] - (hb : b ∈ nonZeroDivisors C.toAffine.CoordinateRing) : - (1 ⊗ₜ b : L ⊗[F] C.toAffine.CoordinateRing) - ∈ nonZeroDivisors (L ⊗[F] C.toAffine.CoordinateRing) := by -- letI := C.isDomain_tensorCoordRing L -+ let := C.isDomain_tensorCoordRing L - rw [mem_nonZeroDivisors_iff_ne_zero] - have hb0 : b ≠ 0 := mem_nonZeroDivisors_iff_ne_zero.mp hb - intro hc -@@ -861,17 +840,15 @@ theorem tensor_functionField_surj (L : Type*) [Field L] [Algebra F L] : - (L ⊗[F] C.toAffine.FunctionField) x.2 - = algebraMap (L ⊗[F] C.toAffine.CoordinateRing) - (L ⊗[F] C.toAffine.FunctionField) x.1 := by -- letI alg := C.tensorFunctionFieldAlgebra L -- letI := C.isDomain_tensorCoordRing L -- haveI hflatL : Module.Flat F L := Module.Flat.of_free -+ let alg := C.tensorFunctionFieldAlgebra L -+ let := C.isDomain_tensorCoordRing L -+ have hflatL : Module.Flat F L := Module.Flat.of_free - have halg : ∀ (l : L) (u : C.toAffine.CoordinateRing), - algebraMap (L ⊗[F] C.toAffine.CoordinateRing) (L ⊗[F] C.toAffine.FunctionField) (l ⊗ₜ u) - = l ⊗ₜ algebraMap C.toAffine.CoordinateRing C.toAffine.FunctionField u := - fun l u ↦ rfl - refine fun z ↦ ?_ -- induction z using TensorProduct.induction_on with -- | zero => -- exact ⟨(0, 1), by rw [zero_mul, map_zero]⟩ -+ induction z using TensorProduct.inductionOn with - | tmul l f => - obtain ⟨a, b, hbmem, hab⟩ := IsFractionRing.div_surjective (A := C.toAffine.CoordinateRing) f - refine ⟨(l ⊗ₜ a, ⟨1 ⊗ₜ b, C.oneTmul_mem_nonZeroDivisors L b hbmem⟩), ?_⟩ -@@ -895,8 +872,8 @@ theorem tensor_functionField_isFractionRing (L : Type*) [Field L] [Algebra F L] - [Algebra.IsAlgebraic F L] : - @IsFractionRing (L ⊗[F] C.toAffine.CoordinateRing) _ - (L ⊗[F] C.toAffine.FunctionField) _ (C.tensorFunctionFieldAlgebra L) := by -- letI alg := C.tensorFunctionFieldAlgebra L -- letI := C.isDomain_tensorCoordRing L -+ let alg := C.tensorFunctionFieldAlgebra L -+ let := C.isDomain_tensorCoordRing L - have hinj : Function.Injective - (algebraMap (L ⊗[F] C.toAffine.CoordinateRing) (L ⊗[F] C.toAffine.FunctionField)) := - C.tensorFunctionFieldStructureHom_injective L -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/InseparableDegree.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/InseparableDegree.lean -index ebd777c8c..9132c544f 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/InseparableDegree.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/InseparableDegree.lean -@@ -8,29 +8,13 @@ import Mathlib.FieldTheory.PurelyInseparable.Basic - import Mathlib.FieldTheory.SeparableClosure - - /-! --# Inseparable degree API for isogenies (Silverman II.2.10-12) -+For an elliptic-curve isogeny, the separable degree times the inseparable degree -+equals the function-field degree. In positive characteristic the inseparable -+degree is a power of the characteristic. The separable closure of the pullback -+field gives the maximal intermediate field over which the extension is purely -+inseparable. - --This file builds the inseparable-degree / separable-closure API for --elliptic-curve isogenies, building on mathlib's --`Mathlib.FieldTheory.SeparableClosure` (`Field.sepDegree`, --`Field.finInsepDegree`, `separableClosure`) and --`Mathlib.FieldTheory.PurelyInseparable.Basic` (`IsPurelyInseparable`, --`isPurelyInseparable_iff_pow_mem`, `IsPurelyInseparable.pow_mem`). -- --## Main results -- --* `Isogeny.inseparableDegree_dvd_degree` — the inseparable degree -- divides the degree (consequence of `finSepDegree · finInsepDegree = -- finrank`, mathlib `PurelyInseparable/Basic.lean:595`). --* `Isogeny.inseparableDegree_eq_one_iff_separable` — direct from the -- project's definition `IsSeparable := inseparableDegree = 1`. --* `Isogeny.inseparableDegree_isPow_of_charP` — in characteristic `p`, -- the inseparable degree is a power of `p`. Uses -- `isPurelyInseparable_iff_pow_mem` (mathlib). -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*], II.2.10-12. -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.10–12. - -/ - - open WeierstrassCurve -@@ -70,7 +54,7 @@ theorem separableDegree_mul_finInsepDegree (α : Isogeny W W) : - α.separableDegree * - Field.finInsepDegree W.FunctionField W.FunctionField = - α.degree := by -- letI : Algebra W.FunctionField W.FunctionField := α.toAlgebra -+ let : Algebra W.FunctionField W.FunctionField := α.toAlgebra - rw [separableDegree_eq_finSepDegree, degree_eq_finrank] - exact Field.finSepDegree_mul_finInsepDegree W.FunctionField W.FunctionField - -@@ -83,7 +67,7 @@ theorem inseparableDegree_eq_finInsepDegree (α : Isogeny W W) - letI : Algebra W.FunctionField W.FunctionField := α.toAlgebra - α.inseparableDegree = - Field.finInsepDegree W.FunctionField W.FunctionField := by -- letI : Algebra W.FunctionField W.FunctionField := α.toAlgebra -+ let : Algebra W.FunctionField W.FunctionField := α.toAlgebra - -- inseparableDegree = degree / separableDegree - -- = (separableDegree * finInsepDegree) / separableDegree - -- = finInsepDegree (since separableDegree > 0) -@@ -102,7 +86,7 @@ theorem inseparableDegree_dvd_degree (α : Isogeny W W) : - α.inseparableDegree ∣ α.degree := by - -- inseparableDegree = degree / separableDegree; degree = separableDegree * finInsepDegree. - -- So separableDegree | degree, hence (degree / separableDegree) | degree. -- letI : Algebra W.FunctionField W.FunctionField := α.toAlgebra -+ let : Algebra W.FunctionField W.FunctionField := α.toAlgebra - have h_mul := separableDegree_mul_finInsepDegree α - show α.degree / α.separableDegree ∣ α.degree - rw [show α.degree = α.separableDegree * -@@ -130,15 +114,15 @@ theorem inseparableDegree_isPow_of_charP - (α : Isogeny W.toAffine W.toAffine) - (h_deg_pos : 0 < α.degree) : - ∃ e : ℕ, α.inseparableDegree = p ^ e := by -- letI alg : Algebra W.toAffine.FunctionField W.toAffine.FunctionField := α.toAlgebra -+ let alg : Algebra W.toAffine.FunctionField W.toAffine.FunctionField := α.toAlgebra - -- CharP transports along the algebraMap (it's a ringHom into a field of char p) -- haveI : CharP W.toAffine.FunctionField p := -+ have : CharP W.toAffine.FunctionField p := - charP_of_injective_algebraMap - (algebraMap K W.toAffine.FunctionField).injective p - -- ExpChar from CharP + Prime -- haveI : ExpChar W.toAffine.FunctionField p := ExpChar.prime Fact.out -+ have : ExpChar W.toAffine.FunctionField p := ExpChar.prime Fact.out - -- From h_deg_pos: FiniteDimensional via the matching finrank -- haveI hfin : @FiniteDimensional W.toAffine.FunctionField -+ have hfin : @FiniteDimensional W.toAffine.FunctionField - W.toAffine.FunctionField _ _ alg.toModule := - @FiniteDimensional.of_finrank_pos _ _ _ _ alg.toModule h_deg_pos - -- Pull down the mathlib lemma with explicit instances -@@ -155,7 +139,7 @@ theorem inseparableDegree_isPow_of_charP - rw [inseparableDegree_eq_finInsepDegree α h_sep_pos] - exact he - --/-! ### P0-B — `Isogeny.separableSubfield` -+/-! The separable subfield - - The maximal intermediate field over which `K(E)` is purely inseparable. - Direct specialisation of `Mathlib.FieldTheory.separableClosure` to -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/PoleOrderParity.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/PoleOrderParity.lean -index 07d5e7569..e5fe1c773 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/PoleOrderParity.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/PoleOrderParity.lean -@@ -183,7 +183,7 @@ theorem point_minus_O_principal_eq_zero_of_coord - have := congr_arg ProjectiveSmoothPoint.toAffinePoint h - rwa [P.toProjectiveSmoothPoint_toAffinePoint, - ProjectiveSmoothPoint.toAffinePoint_infinity] at this -- rw [if_neg h_ne, if_pos rfl] -+ rw [ite_eq_right h_ne, ite_eq_left rfl] - decide - -- Use projectiveDivisorOf_apply_infinity to convert: -1 = (ordAtInfty f).untopD 0 - rw [SmoothPlaneCurve.projectiveDivisorOf_apply_infinity] at h_inf -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/RamificationAtInfinity.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/RamificationAtInfinity.lean -index c09705086..7142cc012 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/RamificationAtInfinity.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/RamificationAtInfinity.lean -@@ -3,82 +3,21 @@ Copyright (c) 2026 Chris Birkbeck. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Chris Birkbeck - -/ --import Mathlib.NumberTheory.RamificationInertia.Basic -+import Mathlib.RingTheory.RamificationInertia.Basic -+import Mathlib.LinearAlgebra.Dimension.Localization -+import Mathlib.NumberTheory.RamificationInertia.Ramification - import Mathlib.RingTheory.DedekindDomain.IntegralClosure - - /-! --# Abstract ramification at infinity (Worker A Action 1) -- --For a smooth plane curve `C` over a field `k` and a nonconstant function --`f ∈ K(C)`, this file establishes the **function-field-degree-equals-pole- --divisor-degree identity**: -- --``` --[K(C) : k(f)] = Σ_{P pole of f} (- ord_P f) · [κ(P) : k]. --``` -- --This is *not* Riemann–Roch. It is the degree formula for the finite morphism --`f : C → ℙ¹`, scoped to the fibre at `∞`. The proof goes via Mathlib's --`Ideal.sum_ramification_inertia` applied at the `(u)`-prime of `k[u]`, where --`u = 1/f` is the uniformizer at infinity on `ℙ¹`: -- -- * `e_P = ord_P(u) = -ord_P(f)` (ramification index), -- * `f_P = [κ(P) : κ((u))] = [κ(P) : k]` (inertia degree). -- --## Strategy -- --The proof packages Mathlib's abstract ramification–inertia machinery: pick --the integral closure `S` of `k[u]` in `K(C)` (via the algebra structure --`u ↦ 1/f`), observe `S` is Dedekind, then `Ideal.sum_ramification_inertia` --at the `(u)` prime gives the sum directly. The curve-specific notation --(`poleSupport`, `ordAt`, `kappa`) is bookkeeping over the resulting finset. -- --This is the deliverable for "Worker A — Action 1 abstract ramification-at- --infinity setup". Worker B's closing application combines this with their --Action 2 (translation valuation transport) plus Action 3 (a small closed- --point lemma) to discharge the project's `pc_sepDeg_eq_pointCount` witness. -- --## Main definitions -- --* `polyToFieldOfInv f`, `ratFunToFieldOfInv hf` — the `k`-algebra maps -- `Polynomial k →ₐ[k] L` and `FractionRing (Polynomial k) →ₐ[k] L` sending the -- indeterminate to `f⁻¹` (the uniformizer `u = 1/f`). --* `LinfAt f` — `L` as a type synonym carrying the `X ↦ f⁻¹` polynomial-algebra -- structure, so it does not clash with the project's pre-existing `X ↦ coordX` -- instance. --* `Sinf f` — structural package of "an integral closure of `Polynomial k` in -- `LinfAt f`": the carrier plus every typeclass instance the closing theorem -- needs as an honest field. --* `xIdeal`, `Sinf.ordAt`, `Sinf.kappa` — the prime `(X)` at infinity, the order -- `-(ramificationIdx' …)`, and the residue field `carrier ⧸ P`. -- --## Main results -- --* `finrank_eq_sum_ramificationIdx_mul_inertiaDeg` — the abstract fundamental -- identity `Σ e(P) · f(P) = [LinfAt f : k(f)]` from `Ideal.sum_ramification_inertia`. --* `finrank_eq_weighted_poleDegree_of_nonconstant` — the closing corollary -- `[L : k(f)] = Σ_P (−ord_P f) · inertiaDeg' P`. --* `Sinf.inertiaDeg_eq_one_of_algebraMap_surjective` — `inertiaDeg' (X) P = 1` -- when the residue map `k → κ(P)` is surjective. -- --## Implementation notes -- --`LinfAt` and `Sinf` exist to dodge two Lean-elaboration hazards. `LinfAt f` --isolates the `X ↦ f⁻¹` algebra structure from the project's `X ↦ coordX` one; --transcendence is carried as `Fact (Transcendental k f⁻¹)` (use sites declare --`haveI : Fact (Transcendental k f⁻¹) := ⟨_⟩` once and the algebra instances --resolve). `Sinf` bundles the integral-closure instances as record fields so they --resolve by projection, sidestepping the `Meta.SynthInstance.tryResolve` --negative-cache anomaly that the `↥(integralClosure …)` Subalgebra coercion --triggers under `Ideal.sum_ramification_inertia` (commit 538ff64). -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, II.2 (degree of a -- morphism between curves; formula II.2.6.a as the sum over preimages of -- one point). --* Mathlib's `Ideal.sum_ramification_inertia` provides the abstract -- fundamental identity `Σ e · f = [Frac S : Frac R]`. -+# Ramification at infinity -+ -+For a nonconstant function on a smooth curve, the degree of the function-field -+extension equals the degree of its pole divisor. Applying the fundamental -+ramification–inertia identity to the prime `(X)` of `k[X]`, embedded by -+`X ↦ f⁻¹`, identifies its ramification indices with pole orders and its -+inertia degrees with residue-field degrees. -+ -+See Silverman, *The Arithmetic of Elliptic Curves*, II.2. - -/ - - namespace HasseWeil.Curves -@@ -144,11 +83,7 @@ theorem ratFunToFieldOfInv_injective {L : Type*} [Field L] [Algebra k L] - Function.Injective (ratFunToFieldOfInv hf) := - (ratFunToFieldOfInv hf).toRingHom.injective - --/-- The function field viewed as a type-synonym, used to install a --`Polynomial k`-algebra structure via `X ↦ f⁻¹` that does not conflict with --the project's existing `X ↦ coordX` instance. --The unused argument `_f` indexes the algebra structure intended for the --synonym. -/ -+ - @[nolint unusedArguments] - def LinfAt {L : Type*} [Field L] [Algebra k L] (_f : L) : Type _ := L - -@@ -238,12 +173,7 @@ instance isScalarTower_k_fractionRing - - end LinfAt - --/-- Structural package of "an integral closure of `Polynomial k` inside --`LinfAt f`": carrier type plus every typeclass instance the closing --`Ideal.sum_ramification_inertia` invocation requires, bundled as record --fields so `letI` can install them at the use site. Sidesteps the Lean 4 --synthesis anomaly that affects the `↥(integralClosure …)` Subalgebra --coercion (commit 538ff64). -/ -+ - structure Sinf.{u} {L : Type*} [Field L] [Algebra k L] (f : L) where - /-- Carrier type — canonically `↥(integralClosure (Polynomial k) (LinfAt f))`. -/ - carrier : Type u -@@ -262,18 +192,14 @@ structure Sinf.{u} {L : Type*} [Field L] [Algebra k L] (f : L) where - [isFractionRing : IsFractionRing carrier (LinfAt (k := k) f)] - /-- Compatible scalar tower with the ambient `Polynomial k → LinfAt f`. -/ - [isScalarTower : IsScalarTower (Polynomial k) carrier (LinfAt (k := k) f)] -- /-- Finite as a `Polynomial k`-module. -/ -+ - [moduleFinite : Module.Finite (Polynomial k) carrier] -- /-- Torsion-free as a `Polynomial k`-module (algebraMap injective). -/ -+ - [isTorsionFree : Module.IsTorsionFree (Polynomial k) carrier] - - section SinfConstruction - - --/-- Canonical construction of `Sinf` from Mathlib's `integralClosure` --Subalgebra. Given the ambient finite-separability hypotheses, all the --required instances are synthesised once here; downstream code consumes --them only by field projection. -/ - noncomputable def Sinf.ofIntegralClosure - {L : Type*} [Field L] [Algebra k L] (f : L) [Fact (Transcendental k f⁻¹)] - [Module.Finite (FractionRing (Polynomial k)) (LinfAt (k := k) f)] -@@ -288,13 +214,13 @@ noncomputable def Sinf.ofIntegralClosure - (integralClosure (Polynomial k) (LinfAt (k := k) f)) := - IsIntegralClosure.finite (Polynomial k) (FractionRing (Polynomial k)) - (LinfAt (k := k) f) (integralClosure (Polynomial k) (LinfAt (k := k) f)) -- haveI : FaithfulSMul (Polynomial k) (LinfAt (k := k) f) := by -+ have : FaithfulSMul (Polynomial k) (LinfAt (k := k) f) := by - rw [faithfulSMul_iff_algebraMap_injective] - exact polyToFieldOfInv_injective_of_transcendental - (Fact.out (p := Transcendental k f⁻¹)) -- haveI : Module.IsTorsionFree (Polynomial k) (LinfAt (k := k) f) := -+ have : Module.IsTorsionFree (Polynomial k) (LinfAt (k := k) f) := - inferInstance -- haveI : Module.IsTorsionFree (Polynomial k) -+ have : Module.IsTorsionFree (Polynomial k) - (integralClosure (Polynomial k) (LinfAt (k := k) f)) := - Subalgebra.instIsTorsionFree (integralClosure (Polynomial k) - (LinfAt (k := k) f)) -@@ -316,13 +242,7 @@ theorem xIdeal_ne_bot : (xIdeal (k := k)) ≠ ⊥ := by - rw [xIdeal, Ne, Ideal.span_singleton_eq_bot] - exact Polynomial.X_ne_zero - --/-- **Abstract fundamental ramification–inertia identity at infinity.** --For a function `f` realising `LinfAt f` as a finite separable extension of --`FractionRing (Polynomial k) = k(f)` and an integral-closure package --`data : Sinf k f`, the sum over primes of the carrier lying over `(X)` of --`e(P) · f(P)` equals `[LinfAt f : k(f)]`. This is the abstract content of --the `[K(C):k(f)] = Σ (pole degree)` identity, before specialisation to --`LinfAt f = K(C)` for a smooth curve `C`. -/ -+ - theorem finrank_eq_sum_ramificationIdx_mul_inertiaDeg - {L : Type*} [Field L] [Algebra k L] (f : L) [Fact (Transcendental k f⁻¹)] - [Module.Finite (FractionRing (Polynomial k)) (LinfAt (k := k) f)] -@@ -332,18 +252,42 @@ theorem finrank_eq_sum_ramificationIdx_mul_inertiaDeg - letI := data.algPoly - ∑ P ∈ IsDedekindDomain.primesOverFinset (xIdeal (k := k)) data.carrier, - Ideal.ramificationIdx' (xIdeal (k := k)) P * -- Ideal.inertiaDeg' (xIdeal (k := k)) P = -+ P.inertiaDeg (Polynomial k) = - Module.finrank (FractionRing (Polynomial k)) (LinfAt (k := k) f) := by -- letI := data.commRing -- letI := data.isDomain -- letI := data.isDedekindDomain -- letI := data.algPoly -- letI := data.algLinfAt -- letI := data.isFractionRing -- letI := data.isScalarTower -- letI := data.moduleFinite -- exact Ideal.sum_ramification_inertia (R := Polynomial k) data.carrier -- (FractionRing (Polynomial k)) (LinfAt (k := k) f) xIdeal_ne_bot -+ let := data.commRing -+ let := data.isDomain -+ let := data.isDedekindDomain -+ let := data.algPoly -+ let := data.algLinfAt -+ let := data.isFractionRing -+ let := data.isScalarTower -+ let := data.moduleFinite -+ classical -+ let := data.isTorsionFree -+ let : Fintype ((xIdeal (k := k)).primesOver data.carrier) := Fintype.ofFinite _ -+ calc -+ _ = ∑ P : (xIdeal (k := k)).primesOver data.carrier, -+ P.1.ramificationIdx (Polynomial k) * P.1.inertiaDeg (Polynomial k) := by -+ apply Finset.sum_bij (fun P hP ↦ -+ ⟨P, (IsDedekindDomain.mem_primesOverFinset_iff xIdeal_ne_bot data.carrier).mp hP⟩) -+ · intro P hP -+ exact Finset.mem_univ _ -+ · intro P hP Q hQ h -+ exact congrArg Subtype.val h -+ · intro P _ -+ exact ⟨P.1, -+ (IsDedekindDomain.mem_primesOverFinset_iff xIdeal_ne_bot data.carrier).mpr P.2, rfl⟩ -+ · intro P hP -+ obtain ⟨hprime, hover⟩ := -+ (IsDedekindDomain.mem_primesOverFinset_iff xIdeal_ne_bot data.carrier).mp hP -+ let := hprime -+ let := hover -+ rw [Ideal.ramificationIdx'_eq_ramificationIdx (xIdeal (k := k)) P xIdeal_ne_bot] -+ _ = Module.finrank (Polynomial k) data.carrier := -+ Ideal.sum_ramification_inertia_eq_finrank (xIdeal (k := k)) data.carrier -+ _ = Module.finrank (FractionRing (Polynomial k)) (LinfAt (k := k) f) := -+ (IsFractionRing.finrank_eq (Polynomial k) (FractionRing (Polynomial k)) -+ data.carrier (LinfAt (k := k) f)).symm - - /-- The `R[X] ⧸ (X) ≃ₐ[R] R`-style algebra equivalence specialised to - `R = k`, given by evaluation at `0`. -/ -@@ -374,8 +318,8 @@ theorem Sinf.toNat_neg_ordAt_eq_ramificationIdx - ∀ P : Ideal data.carrier, - (-(data.ordAt P)).toNat = - Ideal.ramificationIdx' (xIdeal (k := k)) P := by -- letI := data.commRing -- letI := data.algPoly -+ let := data.commRing -+ let := data.algPoly - intro P - simp [Sinf.ordAt] - -@@ -415,16 +359,34 @@ theorem Sinf.inertiaDeg_eq_finrank_kappa - letI := data.commRing - letI := data.algPoly - ∀ (P : Ideal data.carrier) [P.LiesOver (xIdeal (k := k))], -- Ideal.inertiaDeg' (xIdeal (k := k)) P = -- Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.kappa P) := by -- letI := data.commRing -- letI := data.algPoly -+ (if h : P.comap (algebraMap (Polynomial k) data.carrier) = xIdeal (k := k) then -+ letI : Algebra (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P) := -+ Ideal.Quotient.algebraQuotientOfLEComap h.ge -+ Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.kappa P) -+ else 0) = Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.kappa P) := by -+ let := data.commRing -+ let := data.algPoly - intro P _ -- exact Ideal.inertiaDeg'_algebraMap _ _ -+ simp only [dite_eq_left (Ideal.over_def P (xIdeal (k := k))).symm] -+ -+/-- For a prime above `(X)`, the inertia degree is its residue-field degree. -/ -+theorem Sinf.prime_inertiaDeg_eq_finrank_kappa -+ {L : Type*} [Field L] [Algebra k L] {f : L} -+ (data : Sinf (k := k) f) : -+ letI := data.commRing -+ letI := data.algPoly -+ ∀ (P : Ideal data.carrier) [P.IsPrime] [P.LiesOver (xIdeal (k := k))], -+ P.inertiaDeg (Polynomial k) = -+ Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.kappa P) := by -+ let := data.commRing -+ let := data.algPoly -+ let := data.moduleFinite -+ intro P _ _ -+ let : P.IsMaximal := Ideal.isMaximal_of_isIntegral_of_isMaximal_under (R := Polynomial k) P (by -+ simpa only [← Ideal.over_def P (xIdeal (k := k))] using (xIdeal_isMaximal (k := k))) -+ exact Ideal.inertiaDeg_eq_of_isMaximal (xIdeal (k := k)) P -+ - --/-- The `Polynomial k ⧸ xIdeal`-finrank of a module agrees with its --`k`-finrank, given a compatible scalar tower `k → (Polynomial k ⧸ xIdeal) --→ M`. Uses `quotientXAlgEquiv` plus the tower formula. -/ - theorem finrank_residue_eq_finrank_k - {M : Type*} [AddCommGroup M] [Module (Polynomial k ⧸ xIdeal (k := k)) M] - [Module k M] [IsScalarTower k (Polynomial k ⧸ xIdeal (k := k)) M] -@@ -439,7 +401,7 @@ theorem finrank_residue_eq_finrank_k - /-- **Abstract inertia-degree-one criterion at `(X)`.** For an *arbitrary* prime `P` of the - `Sinf` carrier lying over `xIdeal := (X)`, if the structure algebra map - `(Polynomial k ⧸ (X)) → (carrier ⧸ P)` (`≅ k → κ(P)`) is surjective, then the inertia --degree `inertiaDeg' (X) P` equals `1`. This is the field-agnostic, `CoordinateRing`-free, -+degree `P.inertiaDeg (Polynomial k)` equals `1`. This is the field-agnostic, `CoordinateRing`-free, - `IsAlgClosed`-free criterion for any prime over `(X)`. -/ - theorem Sinf.inertiaDeg_eq_one_of_algebraMap_surjective - {L : Type*} [Field L] [Algebra k L] {f : L} -@@ -455,31 +417,26 @@ theorem Sinf.inertiaDeg_eq_one_of_algebraMap_surjective - (algebraMap (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P))) : - letI := data.commRing - letI := data.algPoly -- Ideal.inertiaDeg' (xIdeal (k := k)) P = 1 := by -- letI := data.commRing -- letI := data.algPoly -- letI := data.isDomain -- letI := data.moduleFinite -- haveI hmax : (xIdeal (k := k)).IsMaximal := xIdeal_isMaximal -- letI : Algebra (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P) := -+ P.inertiaDeg (Polynomial k) = 1 := by -+ let := data.commRing -+ let := data.algPoly -+ let := data.isDomain -+ let := data.moduleFinite -+ have hmax : (xIdeal (k := k)).IsMaximal := xIdeal_isMaximal -+ let : Algebra (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P) := - Ideal.Quotient.algebraQuotientOfLEComap - (Ideal.LiesOver.over (p := xIdeal (k := k)) (P := P)).le -- rw [Ideal.inertiaDeg'_algebraMap] -+ let : P.IsMaximal := Ideal.isMaximal_of_isIntegral_of_isMaximal_under (R := Polynomial k) P (by -+ simpa only [← Ideal.over_def P (xIdeal (k := k))] using (xIdeal_isMaximal (k := k))) -+ rw [Ideal.inertiaDeg_eq_of_isMaximal (xIdeal (k := k)) P] - refine le_antisymm ?_ ?_ - · refine finrank_le_one (1 : data.carrier ⧸ P) fun w ↦ ?_ - obtain ⟨c, hc⟩ := h_surj w - exact ⟨c, by rwa [Algebra.algebraMap_eq_smul_one] at hc⟩ -- · have hpos := Ideal.inertiaDeg'_pos (xIdeal (k := k)) P -- rwa [Ideal.inertiaDeg'_algebraMap] at hpos -- --/-- **Closing corollary (abstract form).** The function-field degree --`[L : k(f)]` over the Sinf data equals the weighted pole-divisor degree --`Σ_P (−ord_P f) · f_P` (with `f_P = inertiaDeg' xIdeal P`). This is the --abstract form of the `[K(C) : k(f)] = Σ_{P pole of f} (−ord_P f) · [κ(P) : --k]` identity; Worker B's PoleDivisorFallback specialisation substitutes --`L = K(E)`, `f = γ*x_gen`, and converts `inertiaDeg'` to `[κ(P) : k]` --using `inertiaDeg_eq_finrank_kappa` plus the `quotientXAlgEquiv` --`Polynomial k ⧸ xIdeal ≃ k`. -/ -+ · exact Nat.succ_le_of_lt (Module.finrank_pos : -+ 0 < Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P)) -+ -+ - theorem finrank_eq_weighted_poleDegree_of_nonconstant - {L : Type*} [Field L] [Algebra k L] (f : L) [Fact (Transcendental k f⁻¹)] - [Module.Finite (FractionRing (Polynomial k)) (LinfAt (k := k) f)] -@@ -490,16 +447,16 @@ theorem finrank_eq_weighted_poleDegree_of_nonconstant - Module.finrank (FractionRing (Polynomial k)) (LinfAt (k := k) f) = - ∑ P ∈ IsDedekindDomain.primesOverFinset (xIdeal (k := k)) data.carrier, - (-(data.ordAt P)).toNat * -- Ideal.inertiaDeg' (xIdeal (k := k)) P := by -- letI := data.commRing -- letI := data.algPoly -- letI := data.isDomain -- letI := data.isDedekindDomain -- letI := data.algLinfAt -- letI := data.isFractionRing -- letI := data.isScalarTower -- letI := data.moduleFinite -- letI := data.isTorsionFree -+ P.inertiaDeg (Polynomial k) := by -+ let := data.commRing -+ let := data.algPoly -+ let := data.isDomain -+ let := data.isDedekindDomain -+ let := data.algLinfAt -+ let := data.isFractionRing -+ let := data.isScalarTower -+ let := data.moduleFinite -+ let := data.isTorsionFree - have h := finrank_eq_sum_ramificationIdx_mul_inertiaDeg - (k := k) (L := L) f data - rw [← h] -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Transcendence.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Transcendence.lean -index bdce413c5..a6490d166 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Transcendence.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Transcendence.lean -@@ -16,19 +16,6 @@ that a nonconstant curve map `φ : C₁ → C₂` induces a finite extension - `K(C₁) / φ*(K(C₂))`: the range of `φ.pullback` is an intermediate ring - containing the algebraic structure of `F[x]`, and transitivity does the rest. - --This closes the *first piece* of the infrastructure needed for --T-II-INFRA-B-009 (Silverman II.2.4(a), `CurveMap.pullback_image_finite_codim`). --The full finiteness still requires transcendence-degree theory, which --mathlib provides via `IsTranscendenceBasis`/`trdeg` but whose bridge to our --subalgebra setting (`Algebra.adjoin F {C.coordX}`) needs additional --typeclass-plumbing. That bridge is tracked as a follow-up. -- --## Main results -- --- `SmoothPlaneCurve.isAlgebraic_polynomialX_functionField`: `F(C)` is -- algebraic over `F[X]` (instance). Consequence of -- `IsLocalization.isAlgebraic` + `Algebra.IsAlgebraic.of_finite` + transitivity. -- - ## References - - * [Silverman, *The Arithmetic of Elliptic Curves*], II.1, II.2.4 -@@ -49,29 +36,19 @@ algebraic over the base), `F(x) → F(C)` is algebraic (finite of rank 2), and - algebraicness is transitive. -/ - instance isAlgebraic_polynomialX_functionField : - Algebra.IsAlgebraic (Polynomial F) C.FunctionField := by -- haveI : Algebra.IsAlgebraic (Polynomial F) (FractionRing (Polynomial F)) := -+ have : Algebra.IsAlgebraic (Polynomial F) (FractionRing (Polynomial F)) := - IsLocalization.isAlgebraic _ (nonZeroDivisors _) -- haveI : Algebra.IsAlgebraic (FractionRing (Polynomial F)) C.FunctionField := -+ have : Algebra.IsAlgebraic (FractionRing (Polynomial F)) C.FunctionField := - Algebra.IsAlgebraic.of_finite _ _ - exact Algebra.IsAlgebraic.trans (R := Polynomial F) - (S := FractionRing (Polynomial F)) (A := C.FunctionField) - --/-- Every element of `F(C)` is integral over `F[X]`: since `F[X]` is a field --(well, an integral domain), integrality and algebraicness coincide over it --only for the algebraic case when the ring is a field. Here, since `F[X]` --is an ID and `F(C)` is a domain, we can state integrality directly. -- --**Remark**: `F[X]` is NOT a field, so `IsAlgebraic` and `IsIntegral` over --`F[X]` are distinct notions in general; however, an element of `F(C)` that --is a root of any nonzero polynomial over `F[X]` is a root of SOME monic --polynomial (divide by the leading coefficient after clearing denominators --in the fraction field). We don't need this strengthening for the main --application. -/ -+/-- The function field is integral over the fraction field of the polynomial ring. -/ - instance isIntegral_fracPolynomialX_functionField : - Algebra.IsIntegral (FractionRing (Polynomial F)) C.FunctionField := by - exact (Algebra.IsAlgebraic.of_finite (FractionRing (Polynomial F)) C.FunctionField).isIntegral - --/-! ### T-II-1-005: Uniformizer is not a `p`-th power in char `p > 0` -/ -+ - - /-- **Silverman Exercise II.2.15 (⇐), char-`p` half**: if `t ∈ F(C)` is a - uniformizer at some smooth point `P`, then `t` is not a `p`-th power in -@@ -103,7 +80,7 @@ theorem notMem_pthPowers_of_uniformizer {p : ℕ} (hp : 1 < p) - `F(C)` is finite over `Frac(F[X]) = F(x)`, so trdeg = 1 by additivity of - transcendence degree across the tower `F → F[X] → F(x) → F(C)`. -/ - --/-- **trdeg F K(E) = 1 (axiom-clean)**: the function field of a smooth -+/-- **trdeg F K(E) = 1**: the function field of a smooth - plane curve has transcendence degree 1 over the base field. - - Tower computation: `trdeg F (Polynomial F) = 1` (mathlib's -@@ -113,11 +90,11 @@ Tower computation: `trdeg F (Polynomial F) = 1` (mathlib's - `FiniteOverKx`). Apply `trdeg_add_eq` twice. -/ - theorem functionField_trdeg_eq_one : Algebra.trdeg F C.FunctionField = 1 := by - have h_fund : Algebra.trdeg F (FractionRing (Polynomial F)) = 1 := by -- haveI : Algebra.IsAlgebraic (Polynomial F) (FractionRing (Polynomial F)) := -+ have : Algebra.IsAlgebraic (Polynomial F) (FractionRing (Polynomial F)) := - IsLocalization.isAlgebraic _ (nonZeroDivisors _) - rw [← trdeg_add_eq F (Polynomial F) (A := FractionRing (Polynomial F)), - Polynomial.trdeg_of_isDomain, trdeg_eq_zero, add_zero] -- haveI : Algebra.IsAlgebraic (FractionRing (Polynomial F)) C.FunctionField := -+ have : Algebra.IsAlgebraic (FractionRing (Polynomial F)) C.FunctionField := - Algebra.IsAlgebraic.of_finite _ _ - rw [← trdeg_add_eq F (FractionRing (Polynomial F)) (A := C.FunctionField), h_fund, - trdeg_eq_zero, add_zero] -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/AlgebraicNonNegOrd.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/AlgebraicNonNegOrd.lean -index c599cad55..ad80470ae 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/AlgebraicNonNegOrd.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/AlgebraicNonNegOrd.lean -@@ -84,7 +84,7 @@ theorem ord_P_nonneg_of_isAlgebraic - · rw [hf, ord_P_zero]; exact le_top - · have hv : C.pointValuation P f ≠ 0 := (C.pointValuation P).ne_zero_iff.mpr hf - simp only [ord_P] -- rw [dif_neg hv, show (0 : WithTop ℤ) = ((0 : ℤ) : WithTop ℤ) from rfl, -+ rw [dite_eq_right hv, show (0 : WithTop ℤ) = ((0 : ℤ) : WithTop ℤ) from rfl, - WithTop.coe_le_coe] - -- The order is `-toAdd (unzero hv)`, so `≤ 1` for the valuation becomes - -- `toAdd (unzero hv) ≤ toAdd 1 = 0`, giving `0 ≤ -toAdd (unzero hv)`. -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/Infinity.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/Infinity.lean -index bf9827ace..e8e5e12b2 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/Infinity.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/Infinity.lean -@@ -22,25 +22,21 @@ with the classical values - ordAtInfty(x) = -2, ordAtInfty(y) = -3. - ``` - --Rather than building a local ring at infinity and extracting the valuation --from its DVR structure (the approach outlined in the Phase-D ticket --`T-II-INFRA-D-001`), this file defines `ordAtInfty` algebraically via the --algebra norm `N : F(C) → F(x)`: -+The order at infinity is defined algebraically using the norm -+`N : F(C) → F(x)`: - - ``` - ordAtInfty(f) := - intDegree (N(f)) ∈ ℤ ∪ {∞}. - ``` - --The rationale is that for a degree-2 extension of `F(x)`, ramified only at --the place at infinity of `ℙ¹_F` with ramification index 2 and residue -+The rationale is that when the unique place of a degree-2 extension of `F(x)` above -+the place at infinity of `ℙ¹_F` has ramification index 2 and residue - degree 1, the valuation at the unique place of `F(C)` above infinity is - related to the ℙ¹-valuation of the norm by the classical formula - `v_K(N(f)) = f_w · w(f)` with `f_w = 1`. Concretely, - `ordAtInfty(f) = ordAtInfty(N(f))` where the right-hand side is the order at - infinity on `F(x)`, computed by `- intDegree`. - --This closes (partial form) ticket `T-II-INFRA-D-002`. -- - ## References - - * [Silverman, *The Arithmetic of Elliptic Curves*], IV.1 (for -@@ -87,7 +83,7 @@ noncomputable def ordAtInfty (f : C.FunctionField) : WithTop ℤ := - if f = 0 then ⊤ - else ((- RatFunc.intDegree (C.normAsRatFunc f) : ℤ) : WithTop ℤ) - --@[simp] theorem ordAtInfty_zero : C.ordAtInfty 0 = ⊤ := if_pos rfl -+@[simp] theorem ordAtInfty_zero : C.ordAtInfty 0 = ⊤ := ite_eq_left rfl - - theorem ordAtInfty_eq_top_iff (f : C.FunctionField) : - C.ordAtInfty f = ⊤ ↔ f = 0 := by -@@ -98,7 +94,7 @@ theorem ordAtInfty_eq_top_iff (f : C.FunctionField) : - - theorem ordAtInfty_of_ne {f : C.FunctionField} (hf : f ≠ 0) : - C.ordAtInfty f = (- RatFunc.intDegree (C.normAsRatFunc f) : ℤ) := -- if_neg hf -+ ite_eq_right hf - - /-- Multiplicativity of `ordAtInfty`: for nonzero `f, g`, - `ordAtInfty(f · g) = ordAtInfty(f) + ordAtInfty(g)`. -/ -@@ -950,7 +946,7 @@ private theorem degree_sub_C_leadingCoeff_div_mul_lt {n d : Polynomial F} - have h_deg : n.degree = (Polynomial.C lam * d).degree := by - rw [Polynomial.degree_C_mul hlam_ne, Polynomial.degree_eq_natDegree hn, - Polynomial.degree_eq_natDegree hd, h_eq] -- exact Polynomial.degree_sub_lt h_deg hn h_lc -+ exact Polynomial.degree_sub_lt_left h_deg hn h_lc - - private theorem ratFunc_exists_C_sub_intDegree_neg {r : RatFunc F} - (hr : r.intDegree ≤ 0) : -@@ -1056,13 +1052,13 @@ theorem ordAtInftyVal_eq_exp_neg_ordAtInfty {f : C.FunctionField} (hf : f ≠ 0) - have : (n : WithTop ℤ) = ((- RatFunc.intDegree (C.normAsRatFunc f) : ℤ) : WithTop ℤ) := - hn.symm.trans hN - have hni : n = - RatFunc.intDegree (C.normAsRatFunc f) := by exact_mod_cast this -- rw [ordAtInftyVal, if_neg hf, hni, neg_neg] -+ rw [ordAtInftyVal, ite_eq_right hf, hni, neg_neg] - --@[simp] theorem ordAtInftyVal_zero : C.ordAtInftyVal 0 = 0 := if_pos rfl -+@[simp] theorem ordAtInftyVal_zero : C.ordAtInftyVal 0 = 0 := ite_eq_left rfl - - theorem ordAtInftyVal_ne_zero {f : C.FunctionField} (hf : f ≠ 0) : - C.ordAtInftyVal f ≠ 0 := by -- rw [ordAtInftyVal, if_neg hf]; exact WithZero.exp_ne_zero -+ rw [ordAtInftyVal, ite_eq_right hf]; exact WithZero.exp_ne_zero - - @[simp] theorem ordAtInftyVal_one : C.ordAtInftyVal (1 : C.FunctionField) = 1 := by - rw [C.ordAtInftyVal_eq_exp_neg_ordAtInfty one_ne_zero C.ordAtInfty_one, neg_zero, -@@ -1325,7 +1321,7 @@ theorem smoothPoint_x_preimage_finite (a : F) : - (t := {y : F | (C.fiberQuadratic a).IsRoot y}) - (fun _ hP ↦ C.fiberQuadratic_isRoot_of_smoothPoint hP) - (fun _ hP₁ _ hP₂ hy ↦ SmoothPoint.ext (hP₁.trans hP₂.symm) hy) -- (Polynomial.finite_setOf_isRoot (C.fiberQuadratic_ne_zero a)) -+ (Polynomial.finite_setOfPred_isRoot (C.fiberQuadratic_ne_zero a)) - - /-- The x-projection preimage of a finite set of `x`-values is finite. In - particular, `{P : C.SmoothPoint | P.x ∈ roots f}` is finite for any nonzero -@@ -1460,7 +1456,7 @@ theorem pointValuation_algebraMap_le_one (u : C.CoordinateRing) - exact IsDedekindDomain.HeightOneSpectrum.valuation_le_one - (IsDiscreteValuationRing.maximalIdeal (C.localRingAt P)) _ - --/-- **Step (B'') foundational structural lemma (one direction)**: every -+/-- every - element of `C.localRingAt P` (after embedding into `K(C)`) has valuation - ≤ 1 at `P`. Direct from `IsDedekindDomain.HeightOneSpectrum.valuation_le_one` - applied at the localRingAt level (the localRing is a DVR, hence a Dedekind -@@ -1472,7 +1468,7 @@ theorem pointValuation_algebraMap_localRingAt_le_one - exact IsDedekindDomain.HeightOneSpectrum.valuation_le_one - (IsDiscreteValuationRing.maximalIdeal (C.localRingAt P)) x - --/-- **Step (B'') foundational structural lemma (converse direction)**: every -+/-- every - element of `K(C)` with valuation ≤ 1 at `P` lifts to an element of - `C.localRingAt P`. Together with the easy direction, this characterises - the `algebraMap (localRingAt P) → KE` image as exactly -@@ -1533,7 +1529,7 @@ theorem exists_mul_algebraMap_eq_of_pointValuation_le_one - exact h2 - - --/-- **Step (B'') foundational structural identification (biconditional)**: -+/-- - combines `pointValuation_algebraMap_localRingAt_le_one` and - `mem_localRingAt_image_of_pointValuation_le_one` into the canonical iff form. - This characterises the `algebraMap (localRingAt P) → KE` image as exactly -@@ -1552,7 +1548,7 @@ theorem ord_P_eq_zero_iff_pointValuation_eq_one (C : SmoothPlaneCurve F) - C.ord_P P f = 0 ↔ C.pointValuation P f = 1 := by - have hv : C.pointValuation P f ≠ 0 := (C.pointValuation P).ne_zero_iff.mpr hf - simp only [ord_P] -- rw [dif_neg hv] -+ rw [dite_eq_right hv] - constructor - · intro h - have h_nat : -((WithZero.unzero hv).toAdd : ℤ) = 0 := by exact_mod_cast h -@@ -1599,7 +1595,7 @@ theorem finite_setOf_mem_maximalIdealAt {u : C.CoordinateRing} (hu : u ≠ 0) : - hu ((Algebra.norm_eq_zero_iff (R := Polynomial F)).mp h) - refine (C.smoothPoint_x_preimage_finite_of_set - {a : F | (Algebra.norm (Polynomial F) u).IsRoot a} -- (Polynomial.finite_setOf_isRoot hNu_ne)).subset ?_ -+ (Polynomial.finite_setOfPred_isRoot hNu_ne)).subset ?_ - intro P (hP : u ∈ C.maximalIdealAt P) - rw [← hpq, C.mem_maximalIdealAt_iff_eval_zero P p q] at hP - change (Algebra.norm (Polynomial F) u).IsRoot P.x -@@ -1647,7 +1643,7 @@ theorem finite_setOf_ord_P_nonzero {f : C.FunctionField} (hf : f ≠ 0) : - (C.finite_setOf_ord_P_nonzero_of_coordinateRing hv_ne)).subset ?_ - intro P hP - by_contra h_both -- simp only [Set.mem_union, Set.mem_setOf_eq, not_or, not_not] at h_both -+ simp only [Set.mem_union, Set.mem_ofPred_eq, not_or, not_not] at h_both - obtain ⟨hu0, hv0⟩ := h_both - have hord : C.ord_P P - (algebraMap C.CoordinateRing C.FunctionField u) = -@@ -1658,8 +1654,7 @@ theorem finite_setOf_ord_P_nonzero {f : C.FunctionField} (hf : f ≠ 0) : - exact hP hord.symm - - /-- **Silverman II.1.2, Part 1**: a nonzero function on a smooth plane curve --has zeros and poles at only finitely many smooth points. This is an alias --for `finite_setOf_ord_P_nonzero` matching the ticket statement. -/ -+has zeros and poles at only finitely many smooth points. -/ - theorem finite_zeros_poles (f : C.FunctionField) (hf : f ≠ 0) : - {P : C.SmoothPoint | C.ord_P P f ≠ 0}.Finite := - C.finite_setOf_ord_P_nonzero hf -@@ -1668,16 +1663,6 @@ theorem finite_zeros_poles (f : C.FunctionField) (hf : f ≠ 0) : - if `f ∈ F(C)` has nonnegative order at infinity AND lies in the coordinate - ring, then `f` is the image of a constant from `F`. - --This is the best form provable with our current infrastructure. The full --"no-affine-poles ⟹ in CoordinateRing" step is the integral-closure --property of smooth curves: for a smooth Weierstrass curve `[C.toAffine.IsElliptic]`, --`C.CoordinateRing` is a Dedekind domain, hence integrally closed, and any --`f ∈ F(C)` with `ord_P f ≥ 0` at every closed point is automatically in --`C.CoordinateRing`. Without the `IsElliptic` hypothesis (or an equivalent --smoothness assumption), singular points can have local rings that don't --align with the global coordinate ring structure, and the integral-closure --step requires genuinely new algebra-of-curves infrastructure. -- - Reference: Silverman II.1.2, second part; Hartshorne I.6.12. -/ - theorem const_of_no_poles_of_coordinateRing (f : C.FunctionField) - (h_coord : ∃ u : C.CoordinateRing, -@@ -1691,9 +1676,9 @@ theorem const_of_no_poles_of_coordinateRing (f : C.FunctionField) - exact (IsScalarTower.algebraMap_apply F C.CoordinateRing - C.FunctionField c).symm - --/-- **IC-006 (Silverman II.1.2, Part 2, prime-indexed)**: if `f ∈ F(C)` has -+/-- **Silverman II.1.2, Part 2, prime-indexed**: if `f ∈ F(C)` has - nonnegative valuation at every nonzero prime of `C.CoordinateRing` **and** at --infinity, then `f` is constant. Combines IC-006's Dedekind-Liouville bridge -+infinity, then `f` is constant. Combines the Dedekind-Liouville bridge - `mem_coordinateRing_of_valuation_le_one` with the CoordinateRing-form - algebraic Liouville `const_of_no_poles_of_coordinateRing`. -/ - theorem const_of_no_poles_of_valuation_of_ordAtInfty -@@ -1705,7 +1690,7 @@ theorem const_of_no_poles_of_valuation_of_ordAtInfty - C.const_of_no_poles_of_coordinateRing f - (C.mem_coordinateRing_of_valuation_le_one f h_primes) h_inf - --/-- **IC-006 (integrality-based Liouville)**: if `f ∈ F(C)` is integral over -+/-- **Integrality-based Liouville**: if `f ∈ F(C)` is integral over - `F[X]` **and** has nonnegative order at infinity, then `f` is constant. - This is the cleanest consequence of `IsIntegrallyClosed C.CoordinateRing`: - integrality over `F[X]` lifts `f` into `C.CoordinateRing`, and then -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/NoFinitePolesBridge.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/NoFinitePolesBridge.lean -index 0b44dea28cc6d4c4dd158920e7563ca5babef0db..966395e5596ce0a1deb52980a2031a07e846aa7d 100644 -GIT binary patch -delta 3411 -zcmb7G&yN&E6wdAge5EE9}B};;=g2BWeOl^0~bYXW_Q`NJ} -zaG7{9o}G(&(UVt6CZ3IFPnvk)WQc!)Cr^H_s;B4Yq8_KG>ect&_r34EzrR}grg(U5 -z>C9F)k4mL;OZ%!!DA&|hxhf?UI+ZpEwzMIU4|dM4Ez#iDCF)<1vHVo!aS&;3VwDS= -zH7f5kNRSa6N~F}TqEaI4Y)mSQjFgpWFW66HPO79`nd-b_snk>^lE#sn9GO%mIx?i2 -znbu`LA<+gz2B`AV0){ct7CMjldLmUPDVv)AH!71hq+9rA{At<~Y1d)2BsxY)mvq2y -zPW+?WjKYp009_=y__?c5puRAYkbXCkG41voUMn&gq&h<4v9ghoC`ld96(^+YGTW8L -zCaS>gnJnEAMv+rnr>Wkz)HXVEr^a!jL>Lh@OKH>tmjeN)pb;Mw>rALT41)J$TN;^1 -z@*)j>e=2;YLEGEm`S3zGJa+icL!WH!Nzukpe6DoQeBjAte<{kp}Kz -z%XB2Zup!+*R0xGN@?6xQ$vzs6cFmJ6}M2xN6^pJf{sF?x@c -z)bt+K^d43iT}V^*E&^R`OqJV>Q}DQ5BG%c~7^1l90S0U<04o=EPy;=MrX!d4;vOG9 -zq!*X}HJM7f|3ORKj(Mpd9^a)kWDBS>?Oa>wUG~!3MwQ$)=vZNPRcQn~Va~n-xVNBt -zU0o`?L-Kwp^VmNnM|!M0dq2Uv7?;=SIUM{DY;gB1?8C8fGmwKjGVo4aCFEwos0n7w -zDkL|pYAcbc%;Zr3XXj?~7<~Kk=~KP|otf{6Tv;?gNo+j>b?SxT@iTv}EQZYUqMDNI -zS5JmNA@DLWy4y)~w{(ou3iKtSabwqvU8?4)qb%?l*R|I*AC~9ORA0d#IElgWGpmF3 -zwIf4n^bZYApMPnI2l&aU@jYww4F;D}Ylq&X8?7+d;L(^%3y*rzEUygJNVpp&N%(J?SMZk40ddm*Kd*jDLeH@zzULB?mwfxf8+63XZlD-7stf|}ZOMYI^x@f^bM*L&FX`-!b06dGO>9y(Rf=O73}qYZ#%tm0m|W{Yu-7%Q6qZBOG^-Sq(k3PS$%8!_bAN2q`w#WA1_0BT0 -zwreCX5)$gAT!sU;@^b|VWF)vzkT{3t!hs8dE241d8Qz=Ob=Igtimb?rM@h=`j%%lplD1#bX63`LxXDpWhF -z%RzQIE{lML4PH@9R9P7Ip&ClfYhGROuvUabu}Ft35i){GA6i^RJcL+^DA6ElJW2$v -z)DYk=u=#!fJ&`maX>z#8LMb#fls~N>d1-AKj^nDM^k3k^Mzf>AEX*7-*C%!j -zHgHqi3BwAjwx}d`3$$4bB7&f-B^J~VfGLh&)OgJCBTB#`)kV+}Ypya?6A=qV(kB#B -z@wTVg9i&NRoy+wTDI=C^ -zTvv%kSvU7q_8kle9|L7uj%f28H*fElJ6VLI1ZP!YquZR+BlSk%{^88Gbp~O8`rYSAV4+wUOD}Ue^ -zy{wbSwp4Lb=yu79(95m$;mU|LIxX#-u)0ZQZ3P6V{RHXD?S8Z-RH7x=T$?#u96R#?*wZ6f;$a^?nSAsW$QR(Ih(M#-Nf!|{J`*uc -z8UCdzuR$I4oM74cdcksoLt%c}b8vX);ky%$tfs=rY7b3u;Xs+lXm=9SDO!Pu&>?iz -zqEb#f9^xeoD0-4U1dCV`PByHN^vMX!=TrNKTYJ_XDr}hRvj?Z`I_x8uujUtCpx%O@ -z*}Z{BpbWgxh@s&$xRZQN#ACG*LC;W~ZEGxe?Qb_ff~6n6fn(5GMhs*`L_^TRUv83C -z=qrDCb^oh7uASc=4U}Noi(GBUCRzcRT8`^6u{v}aV$b*sj}5Q`Zh5ID+C0)|m@IS? -zMk=o}9G7|rr$1+?tV+J>@pgsRob*#P=&lm!$&P%07GP;zgxH-n`ZtZ5x&Qb-b8wnU -z_Y=A59NhzGvMx8f7MIO)i}%lL}$4$InfcRxyuqqYJ_2djUC2@SpS`;M!b!a^DlK8>v=37lGE4owFgc=C75# -z&;OsX`S6l8Nee19L~mPiMYB0MceRM~@CHYUx)d&{Ae?^_C9c{Ldej0g10%jIh -z6uBd!G{g#{7tFg)9UlI2>gP#w@lwhBdgjBydMA!Cd@XqmF40|S=XS~j4NO0}KySxv -zrb1vzy3gHbcX`wbtz}iPgrl(Nm;g;HN=GIm*wK_oFR&QV3PwUL<0RP>4Ev<@3e!9lxs%$o -ziwR`P42~Sy+48$A41906bs;GXFJ8J;xPIBadve2@iMQ@zA|2dOGK^_Bdjr`9xg7Jd -zw*tEE{BC@9pd@e_YQP!307$S)K^o0eXFig>^e$U4ir?IwoE=z6IS W.toAffine.FunctionField - - omit [DecidableEq F] in --/-- `pointValuation P f = exp (-n)` from `ord_P P f = n` (for `f ≠ 0`). Curve-side --mirror of `ordAtInftyValuation_eq_exp_neg_of_ordAtInfty_eq`, kept local to avoid an --import of `Hasse.L6Witnesses`. -/ -+/-- `pointValuation P f = exp (-n)` follows from `ord_P P f = n` for `f ≠ 0`. -/ - theorem pointValuation_eq_exp_neg_of_ord_P_eq {C : Curves.SmoothPlaneCurve F} {P : C.SmoothPoint} - {f : C.FunctionField} {n : ℤ} (hf : f ≠ 0) (hn : C.ord_P P f = (n : WithTop ℤ)) : - C.pointValuation P f = WithZero.exp (-n) := by - have hv : C.pointValuation P f ≠ 0 := (C.pointValuation P).ne_zero_iff.mpr hf - have hord : C.ord_P P f = ((-(WithZero.unzero hv).toAdd : ℤ) : WithTop ℤ) := by - simp only [Curves.SmoothPlaneCurve.ord_P] -- rw [dif_neg hv] -+ rw [dite_eq_right hv] - have hneq : n = -(WithZero.unzero hv).toAdd := by exact_mod_cast (hord.symm.trans hn).symm - rw [hneq, neg_neg, WithZero.exp, ofAdd_toAdd, WithZero.coe_unzero] - -@@ -84,8 +62,8 @@ theorem valuation_aeval_eq_exp (w : Valuation KE (WithZero (Multiplicative ℤ)) - intro i - rw [Algebra.smul_def, map_mul, map_pow, hu, ← WithZero.exp_nsmul] - by_cases hci : p.coeff i = 0 -- · rw [if_pos hci, hci, RingHom.map_zero, map_zero, zero_mul] -- · rw [if_neg hci, hc _ hci, one_mul] -+ · rw [ite_eq_left hci, hci, RingHom.map_zero, map_zero, zero_mul] -+ · rw [ite_eq_right hci, hc _ hci, one_mul] - congr 1 - rw [nsmul_eq_mul] - ring -@@ -97,13 +75,13 @@ theorem valuation_aeval_eq_exp (w : Valuation KE (WithZero (Multiplicative ℤ)) - refine (Valuation.map_sum_eq_of_lt w (Finset.self_mem_range_succ n) ?_).trans ?_ - · intro i hi - rw [Finset.mem_sdiff, Finset.mem_range, Finset.mem_singleton] at hi -- rw [h_term i, h_term n, if_neg h_lead_ne] -+ rw [h_term i, h_term n, ite_eq_right h_lead_ne] - by_cases hci : p.coeff i = 0 -- · rw [if_pos hci] -+ · rw [ite_eq_left hci] - exact lt_of_le_of_ne zero_le (Ne.symm WithZero.exp_ne_zero) -- · rw [if_neg hci, WithZero.exp_lt_exp] -+ · rw [ite_eq_right hci, WithZero.exp_lt_exp] - omega -- · rw [h_term n, if_neg h_lead_ne] -+ · rw [h_term n, ite_eq_right h_lead_ne] - - omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `algebraMap (Polynomial F) K(E)` is `aeval x_gen` (both are the F-algebra hom -@@ -277,10 +255,11 @@ theorem ordAtInftyValuation_basis_summands_distinct {r₁ r₂ : FractionRing (P - intro h_eq - omega - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - set_option backward.isDefEq.respectTransparency.types false in - /-- **Value on the coordinate function `y`.** A valuation `w` with `w y_gen = exp 3` - agrees with `ordAtInftyValuation` on `coordYInFunctionField` (which is `y_gen`): --both equal `exp (-3)`. -/ -+both equal `exp 3`. -/ - private theorem valuation_coordYInFunctionField_eq_ordAtInftyValuation - (w : Valuation KE (WithZero (Multiplicative ℤ))) (hy : w (y_gen W) = WithZero.exp 3) : - w (W_smooth W).coordYInFunctionField = -@@ -359,6 +338,7 @@ private theorem eq_ordAtInftyValuation_of_agree_fracPolyX_coordY - exact valuation_eq_add_of_eq_of_eq_of_distinct W w (W_smooth W).ordAtInftyValuation - (h_rat p) hβc_agree (ordAtInftyValuation_basis_summands_distinct W h_not_both) - -+omit [W.toAffine.IsElliptic] in - /-- **Valuation determined by `x_gen`, `y_gen`.** A `ℤᵐ⁰`-valued valuation `w` on - `K(E)` with `w x_gen = exp 2`, `w y_gen = exp 3`, and trivial on `F^×` equals - `ordAtInftyValuation`. The decomposition `f = α + β·coordY` (`α, β ∈ F(x)`) plus -@@ -372,8 +352,9 @@ theorem eq_ordAtInftyValuation_of_x_y (w : Valuation KE (WithZero (Multiplicativ - (valuation_algebraMap_fracPolyX_eq_ordAtInftyValuation W w hx hc) - (valuation_coordYInFunctionField_eq_ordAtInftyValuation W w hy) - -+omit [W.toAffine.IsElliptic] in - /-- `ord_P (-T) (τ_T x_gen) = -2`, uniformly across 2-torsion and non-2-torsion --`T = (xk, yk)`. Dispatches to the two shipped cases. -/ -+`T = (xk, yk)`. -/ - theorem ord_P_negSmoothPoint_translateX_xy_eq_neg_two - (xk yk : F) (h_ns : W.toAffine.Nonsingular xk yk) : - (W_smooth W).ord_P (negSmoothPoint W xk yk h_ns) -@@ -382,6 +363,7 @@ theorem ord_P_negSmoothPoint_translateX_xy_eq_neg_two - · exact ord_P_translateX_xy_eq_neg_two_at_2tor W xk yk h_ns h - · exact ord_P_translateX_xy_eq_neg_two_of_non_2_tor W xk yk h_ns h - -+omit [W.toAffine.IsElliptic] in - /-- `ord_P (-T) (τ_T y_gen) = -3`, uniformly across 2-torsion and non-2-torsion. -/ - theorem ord_P_negSmoothPoint_translateY_xy_eq_neg_three - (xk yk : F) (h_ns : W.toAffine.Nonsingular xk yk) : -@@ -461,11 +443,8 @@ theorem ord_P_negSmoothPoint_translateAlgEquivOfPoint_eq_ordAtInfty_some - rw [hm, hn] - exact_mod_cast neg_injective h_at_f - --/-- **Unconditional discharge of `IsTranslateOrdAtInftyCompatible`.** For a finite --smooth point `P` and a group element `k` with `P + k = O` (so `P = -k`), the --translation pullback `τ_k` carries the order at `P` to the order at infinity: --`ord_P P (τ_k f) = ordAtInfty f` for all `f`. Gates the Weil-pairing divisor --transport. -/ -+/-- For a finite smooth point `P` and a group element `k` with `P + k = O`, -+translation pullback satisfies `ord_P P (τ_k f) = ordAtInfty f` for every `f`. -/ - theorem isTranslateOrdAtInftyCompatible_translateAlgEquivOfPoint - (P : (W_smooth W).SmoothPoint) (k : (W_smooth W).toAffine.Point) - (h_zero : P.toAffinePoint + k = Affine.Point.zero) : -diff --git a/projects/HasseWeil/HasseWeil/Foundation/EC/TranslateValuation.lean b/projects/HasseWeil/HasseWeil/Foundation/EC/TranslateValuation.lean -index 0fbf76569d790458fadca970039cf32598f16d3b..8fbe28c64fdb18776583e7ad48fb72d1d909f59c 100644 -GIT binary patch -delta 113 -zcmcckfaA%1jt!d_H~(RbV>B!+PAyhQ&d)7KEXhpD%*iaNRLDr=YRz^_cI$YZ+^qJR))JIH9oa4z9=(2qojGB^7eVkjK8Xo1-H+g$GBx8 -E0DZwO_W%F@ - -diff --git a/projects/HasseWeil/HasseWeil/Foundation/EC/Translation.lean b/projects/HasseWeil/HasseWeil/Foundation/EC/Translation.lean -index c135cb1b2..798b434d7 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/EC/Translation.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/EC/Translation.lean -@@ -6,43 +6,17 @@ Authors: Chris Birkbeck - import HasseWeil.Foundation.AdditionPullback - - /-! --# Translation by a base-field point on K(E) -+# Translation by a base-field point on the function field - --For an elliptic curve `W` over `F` and a point `(xk, yk) ∈ W(F)` (= a base-field --solution of the Weierstrass equation), translation by `k = (xk, yk)` lifts --to a K-algebra automorphism `τ_k : K(E) ≃ₐ[F] K(E)` defined by: -+Translation by a point `k = (xk, yk)` of an elliptic curve acts on its -+function field through the addition formulas. The slope is -+`(y_gen − yk) / (x_gen − xk)`, and the translated coordinate functions -+are obtained from this slope by `addX` and `addY`. The coordinate-ring -+homomorphism extends to the function field when the evaluation map is -+injective. Kernel translations preserve pullbacks along isogenies, -+relating the point kernel to function-field automorphisms. - --* `τ_k(x_gen) = (W_KE).addX(x_gen, xk, slope_k)` where -- `slope_k = (y_gen - yk) / (x_gen - xk)`. --* `τ_k(y_gen) = (W_KE).addY(x_gen, xk, y_gen, slope_k)`. -- --This is the substantive Galois-correspondence content for elliptic --isogenies (Silverman III.4.10(a)): for an isogeny `α : E → E`, the kernel --of `α` (as an additive subgroup of `E.Point`) acts on `K(E₁)/α*K(E₂)` as --the Galois group, and the bijection `α.kernel ≃ Aut(K(E)/α*K(E))` sends --each kernel element `k` to the translation automorphism `τ_k`. -- --This file constructs the translation algebra hom directly via the addition --formula on coordinates, paralleling --`HasseWeil/AdditionPullback.lean`'s `addPullbackAlgHom_negFrobenius` --construction. -- --## Foundational definitions -- --The translation construction is parallel to `addPullback_x` / `addPullback_y` --but with the second point a base-field constant rather than `α.pullback`. -- --* `translateSlope_xy xk yk` — slope from `(x_gen, y_gen)` to `(xk, yk)`. --* `translateX_xy xk yk` — x-coord of `P_gen + (xk, yk)`. --* `translateY_xy xk yk` — y-coord of `P_gen + (xk, yk)`. -- --These are foundational K(E)-elements; the algebra-hom construction (analog --of `addPullbackAlgHom`) requires the `AddNonInverse` and injectivity --witnesses. -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, III.4.10(a). -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10(a). - -/ - - open WeierstrassCurve -@@ -293,6 +267,7 @@ noncomputable def translateAlgHom (xk yk : F) (h_eq : W.toAffine.Equation xk yk) - (translateCoordAlgHom_injective_of_baseHom_inj W xk yk h_eq hxy hxinj) - - omit [DecidableEq F] in -+omit [W.toAffine.IsElliptic] in - /-- A pole of `translateX_xy` at infinity forces non-constancy: if - `ordAtInfty (translateX_xy) < 0` then `translateX_xy` is not `algebraMap F KE c` - for any `c : F`. -/ -@@ -329,6 +304,7 @@ theorem translateBaseHom_injective_of_transcendental (xk yk : F) - exact transcendental_iff_injective.mp h_trans - - omit [DecidableEq F] in -+omit [W.toAffine.IsElliptic] in - private theorem ordAtInfty_sub_const_of_neg_aux {g : KE} {n : ℤ} (hn : n < 0) - (hg : (W_smooth W).ordAtInfty g = ((n : ℤ) : WithTop ℤ)) (c : F) : - (W_smooth W).ordAtInfty (g - algebraMap F KE c) = ((n : ℤ) : WithTop ℤ) := by -@@ -339,7 +315,7 @@ private theorem ordAtInfty_sub_const_of_neg_aux {g : KE} {n : ℤ} (hn : n < 0) - rw [hg, ordAtInfty_algebraMap_F_nonzero W hc] - exact_mod_cast hn - --omit [DecidableEq F] in -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- For any `xk ∈ F`, `ord(x_gen - xk) = -2`, since the constant `xk` has - nonnegative order while `x_gen` has order `-2`. -/ - theorem ord_x_gen_sub_const (xk : F) : -@@ -370,7 +346,7 @@ theorem translateSlope_xy_eq (xk yk : F) : - intro h_eq - exact x_gen_sub_const_ne_zero W xk (sub_eq_zero.mpr h_eq) - --omit [DecidableEq F] in -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ord(y_gen - yk) = -3` for any `yk : F`. -/ - theorem ord_y_gen_sub_const (yk : F) : - (W_smooth W).ordAtInfty (y_gen W - algebraMap F KE yk) = -@@ -378,9 +354,9 @@ theorem ord_y_gen_sub_const (yk : F) : - classical - exact ordAtInfty_sub_const_of_neg_aux W (by norm_num) (ordAtInfty_y_gen W) yk - --omit [DecidableEq F] in --/-- `ord(translateSlope_xy) = -1` for non-zero `xk` (so the slope is in secant --form). -/ -+omit [DecidableEq F] [W.toAffine.IsElliptic] in -+/-- The translation slope has order `−1` at infinity, as the quotient -+of coordinate differences of orders `−3` and `−2`. -/ - theorem ord_translateSlope_xy (xk yk : F) : - (W_smooth W).ordAtInfty (translateSlope_xy W xk yk) = - ((-1 : ℤ) : WithTop ℤ) := by -diff --git a/projects/HasseWeil/HasseWeil/Foundation/EC/TranslationOrd.lean b/projects/HasseWeil/HasseWeil/Foundation/EC/TranslationOrd.lean -index cea73bd37ab5ea56657974cbcf2551bdc8ca43c8..d6dda63fd0bbf1363e9aa0b34f4b582268277efa 100644 -GIT binary patch -delta 10891 -zcmbta4U8PuUDxc4-DVn_#<9c2ahzu*jh$rooJ-U;y@WJQAi*W>ozqi-DAn!U?%TVG -zXJ^hcv%b5Mu#E&X6;!3U&{4yO+Nx@men5&zhSCyb2_ZFw8X<&S2~;%#3JMS+N}xm$ -z{Qm#<-hAxtotq*>if?w_d;gE$|M&lR^P9i6=i9$>*)yNFK5&23@d6RWT^T205aNF# -zjlD1lyws0Ef&aWv$RO}nQ@_6xa;sw|ODN_fwIs$XGT-64Ad%mtmny5=5&~taynV%4O(xMyg|{#e#a3 -z-;`ak-s(g!i645Y6rCtc#`NLVgR$&zQtg4k}!OQh)e -zG8lHJUAKAw+0`4QQ9p`TSNx=p9RrB#b^8!MV1JzPf`M`XoxuhH+Y+%*4Lap} -zx4mA3!a70$PTzdx(W#~~B}W27q;4rUkO^5C(TzYObNu(SH@>yz;lqFSZMy~0RK#xW -z;Zmwi@5`6(O(qMpe^_%=?f9mqXU4B0iSd&(x4%W#_$g? -zPsU7F{FnpOV_ujRn~g8*Kl|xFf9g<8$-DmTJ&m_6jDR5f-TB59Ckg;v#NA>9G9^wc -zxXF&~vo1fo{>py{dok=~r}kK%rhnv@UT(ea{ul{Rq1`M$Xx+E-eH;{~U7 -zXysR|S^qG#dG^(V+0!3wyd}T%*R8Kw`13&a+LPAR`9FT#y3F2mF6_(x^2)}WayzSO)Litn&_$eeTt0<^i{z1}He1N~!;U&&c -z!sIgsxq8GY#MCi5#VGimqyhq-M-BviFUv0H6ZdGV#dXYt+*7>CrW=;F>4ck~{6l+}HBn8N)}!Xet7)s<**hMw4`tJTZST)-{kpxY -zVa;b>KkOVhUVRFynR~ -zkAZ4kXh_Q#n(`4Lr=&uIG1=7s(KHtgQM93Y4HVd?#ZOap$1YHwD!j7|j?|lQCDpqq -zCrg(akB%#(MRpIB2S8{F)>2d*fPmah`NMx|U&F>)MYX%+8}N*rmxwhV^_$rOhIicu -zix`BQmDNd#nw`j=&aDgBMsd{f;+Sa`s4y}PQI4a^nHM(+yuo!J{^m#Rrr|@-Q6(9p1#--`hM+!i!EWa7_zSybU9*+3b&O>n|CYUXrXKa~#X~fkdBnb+ -zV)0P^$LHuAuk80Wh7U+sjeA-0Y~4SmD^iYe -z-Fs?KT8V-#T#U^}mQfH+i+QA3ZVR{})2)UAL}dZMrO*rr#S)vL0WtZR_f~>0$I)OF -zeYWg_082d81*+(&+Ptb<>J;q}q(vPRa~xCU%E}Vcc2yo3->c+A74;})pSxi1YlI7A -zN6vfThtZamnx*6-)V2zOm6#<^q*lwaWU$1`O_9n~WF}l^YD)BO5HEh@vtow3{W4u- -zr(dx5X5ah+`;s~Hd#P@_hf#y60LwLqa$y8D1>5Ej578=2!aG(o*5STq1I{sFfOd^ -zjUsdlgwMKlr#AgENkiN^gu_MRk@%jBsYt -zf!m9MAX)gKjI$bk6O*3e~MKIsZ$h}jH8b0RP-*Dbs=`7A!&cltNHhtlykzFfBDw$km)*@c0g{Y-GnjV&K -z8)Fu)70C|xQT8FD;%r!jnFv!N;EvN4Q?SVR~Kn#^>pGZjkH0Z?xU| -zHo|uqzvEDTDLZ;fJu&yG(0;0j7)xNHnHOVBub(b>>SW>0D=93vrCri`B -zdLo563foX78(*WrQL$ICU`q-nT&s%;sG@MajQfe|^s_F;SQ}bqwjWibTaC+A52C2a -zw9%ysH8~I|N3)MkJC|m^I^#T=@4mvh!n&Uv%{s6xRTe5NTC-o-c9(^DS-Vo
  • nO -zIpus!ryoV9U72)Zx{?A5R5w(GH&q>&O3;v`94O&6Me|)BYb6qHsgf!=xo0f7PnQAI -zW}s#f>Cn`?iYssfllp32NDXBdJH~xAmju@Q7_ -zW7^Oc-FHgLIpMO~#!-tPqn<86#P(`3 -zWIu4kk@mz98X!Ar-Wrb-<|ADZm)q~0rxG$T-6vwDRgi)CR>H7*uUnU!U -z-HK;sL%xQt6#Ecq=!a*36AxoCeQ7>2aN-*cec__FuU#Z_9H}8a1DSkMIS<8+7eixQ -zQN+!1aL++`O2*+(>e-&4dv%I(W;+xQ8#r0ZhE6~U*G6&h3n&^E9&MM`$co13DqCBD -zf{d7Z5CpQ@TJk!l>Nlede=TEs!-d6hc9X{$;7EPzR`PgD=~eS_!B>KZD~7dNV$5UN -zEB|HhJyCTVGG1kZ$K+F3Zq$2qYXaq%iHYpwZ5WE}zQe(6`&bnbEn_fLkcRN+GK;K1 -zmkcFJ%)m>d6vz_|41;@u(_zf{z1?v1yJ9!@Uh#m-8#yCIP+^v_0xYR;-o%_BZSw -z&+gr4?at5L>9iWR-eaaZW>8u^hG(ROMGTg*>yJ6_+&wlOo60|R%vrZ8B@d_sUm_Ty -z<;J}hQxu$A_!98|I9I0k%=`61D(b0VNN%S>JsHr&olJ&gjDpbE;6;L|a9iOPAAMqse^>Jwi2N#uXusa;?cZOfkZ0K<6r0<{do*D(34q)COlb>-0UlhPBZ`Tob#GJ -zd%_fUx`v7I(GaK@k%{0?w&Ac-RVIanX&bZuJ>eY6{`q~*t|7<@V_up(pX7dzxWXP-&3^%M)oI2^4C9%8lz=d-B;O;-qls6mk#K5b~Rc^{eb5hRA93Vo6Y2Zx9GfTAAch|cKtKH*>JLr@^^KeXB)vA -z*;M%wMF=C5ScrUS45q(gK!<`hpo8Lxe9E)lg3bx3*{2?HuFVez&X=wHkne|wnq -z&VS~#^WAOBL6r?KHAi<=WlY{#dL3LWqI07tEl3X4HL9`l0=bBA-V5iVy-NoDvi2G3 -z>mOQ3l@K=M4_uNo_W4^IbTXLn0^}T}K)G=!VO|YCjetcVkFt|){J6<24TRH6UDS3< -z8`m)btJ4VkEidk@_Q`$KUaP W.toAffine.FunctionField - noncomputable def formalU : PowerSeries F := - PowerSeries.mk (fun n ↦ formalW_coeff W (n + 3)) - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The constant coefficient of `formalU` is 1. -/ - @[simp] theorem formalU_constantCoeff : - @PowerSeries.constantCoeff F _ (formalU W) = 1 := by - rw [← PowerSeries.coeff_zero_eq_constantCoeff_apply, formalU, PowerSeries.coeff_mk, - zero_add, formalW_coeff_three] - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `formalU W` is a unit in `F⟦X⟧`. -/ - theorem formalU_isUnit : IsUnit (formalU W) := by - rw [PowerSeries.isUnit_iff_constantCoeff] -@@ -92,16 +46,19 @@ theorem formalU_isUnit : IsUnit (formalU W) := by - noncomputable def formalU_inv : PowerSeries F := - PowerSeries.invOfUnit (formalU W) 1 - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `formalU * formalU_inv = 1` in `F⟦X⟧`. -/ - @[simp] theorem formalU_mul_inv : formalU W * formalU_inv W = 1 := - PowerSeries.mul_invOfUnit (formalU W) 1 - (by rw [formalU_constantCoeff]; rfl) - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `formalU_inv * formalU = 1` in `F⟦X⟧`. -/ - @[simp] theorem formalU_inv_mul : formalU_inv W * formalU W = 1 := - PowerSeries.invOfUnit_mul (formalU W) 1 - (by rw [formalU_constantCoeff]; rfl) - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The constant coefficient of `formalU_inv` is 1. -/ - @[simp] theorem formalU_inv_constantCoeff : - @PowerSeries.constantCoeff F _ (formalU_inv W) = 1 := by -@@ -131,6 +88,7 @@ In `LaurentSeries F`, `formalX W` has order `-2` and `formalY W` has order `-3`. - These follow because `formalU_inv W` has order `0` (constant coeff = 1) and - `single (-2) 1` resp. `single (-3) 1` have orders `-2` resp. `-3`. -/ - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `ofPowerSeries ℤ F (formalU_inv W)` is nonzero in `LaurentSeries F`. -/ - theorem ofPowerSeries_formalU_inv_ne_zero : - (HahnSeries.ofPowerSeries ℤ F (formalU_inv W) : LaurentSeries F) ≠ 0 := by -@@ -144,12 +102,14 @@ theorem ofPowerSeries_formalU_inv_ne_zero : - rw [h] at h_nonzero - exact one_ne_zero h_nonzero.symm - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `formalX W ≠ 0`. -/ - theorem formalX_ne_zero : formalX W ≠ 0 := by - rw [formalX] - exact mul_ne_zero (HahnSeries.single_ne_zero one_ne_zero) - (ofPowerSeries_formalU_inv_ne_zero W) - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `formalY W ≠ 0`. -/ - theorem formalY_ne_zero : formalY W ≠ 0 := by - rw [formalY] -@@ -157,6 +117,7 @@ theorem formalY_ne_zero : formalY W ≠ 0 := by - rw [ne_eq, neg_eq_zero] - exact HahnSeries.single_ne_zero one_ne_zero - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `ofPowerSeries ℤ F (formalU_inv W)` has `orderTop = 0`. This is because the - series has constant coefficient 1, so its order is ≤ 0; and all coefficients - at negative indices vanish (since `ofPowerSeries` embeds `ℕ ↪ ℤ`), so its order -@@ -177,10 +138,11 @@ theorem ofPowerSeries_formalU_inv_orderTop : - rw [HahnSeries.le_orderTop_iff_forall] - intro n hn - have : ((formalU_inv W : PowerSeries F) : LaurentSeries F).coeff n = 0 := by -- rw [PowerSeries.coeff_coe, if_pos]; exact_mod_cast hn -+ rw [PowerSeries.coeff_coe, ite_eq_left]; exact_mod_cast hn - exact this - exact le_antisymm h_le h_ge - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `formalX W` has `orderTop = -2` in `LaurentSeries F`. -/ - theorem formalX_orderTop : - (formalX W).orderTop = ((-2 : ℤ) : WithTop ℤ) := by -@@ -188,6 +150,7 @@ theorem formalX_orderTop : - ofPowerSeries_formalU_inv_orderTop] - rfl - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `formalY W` has `orderTop = -3` in `LaurentSeries F`. -/ - theorem formalY_orderTop : - (formalY W).orderTop = ((-3 : ℤ) : WithTop ℤ) := by -@@ -204,6 +167,7 @@ has leading coefficient `-1`. These come from expanding the definitions: - `formalX = single(-2,1) · (lifted u_inv)` with `(lifted u_inv).leadingCoeff = 1` - (since `u_inv` has constant coefficient `1`). -/ - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- The leading coefficient of the lifted `formalU_inv` is `1` (its constant - coefficient as a power series). -/ - theorem ofPowerSeries_formalU_inv_leadingCoeff : -@@ -222,12 +186,14 @@ theorem ofPowerSeries_formalU_inv_leadingCoeff : - rw [hS, this, PowerSeries.coeff_zero_eq_constantCoeff_apply] - exact formalU_inv_constantCoeff W - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `formalX W` has leading coefficient `1`. -/ - theorem formalX_leadingCoeff : - (formalX W).leadingCoeff = 1 := by - rw [formalX, HahnSeries.leadingCoeff_mul, HahnSeries.leadingCoeff_of_single, - ofPowerSeries_formalU_inv_leadingCoeff, mul_one] - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `formalY W` has leading coefficient `-1`. -/ - theorem formalY_leadingCoeff : - (formalY W).leadingCoeff = -1 := by -@@ -244,9 +210,8 @@ Weierstrass equation `y² + a₁xy + a₃y - x³ - ... - a₆ = 0` after substit - So the proof of `formalXY_weierstrass` is essentially: state the recurrence, - clear denominators in the field `LaurentSeries F`, and conclude via the recurrence. -/ - ---- The Silverman IV.1.1 recurrence `formalW_recurrence` is now proved in ---- `HasseWeil/FormalGroup.lean` and used directly here. - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `formalW W ≠ 0` because its coefficient at index 3 is 1. -/ - theorem formalW_ne_zero : formalW W ≠ 0 := by - intro h -@@ -258,6 +223,7 @@ theorem formalW_ne_zero : formalW W ≠ 0 := by - rw [this] at h3 - exact one_ne_zero h3 - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `HahnSeries.ofPowerSeries ℤ F (formalW W) ≠ 0` in `LaurentSeries F`. -/ - theorem lifted_formalW_ne_zero : - HahnSeries.ofPowerSeries ℤ F (formalW W) ≠ 0 := by -@@ -265,6 +231,7 @@ theorem lifted_formalW_ne_zero : - exact formalW_ne_zero W - (HahnSeries.ofPowerSeries_injective (h.trans (map_zero _).symm)) - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `formalW = X^3 * formalU` as `PowerSeries F`. -/ - theorem formalW_eq_X3_mul_U : - formalW W = PowerSeries.X ^ 3 * formalU W := by -@@ -282,7 +249,7 @@ theorem formalW_eq_X3_mul_U : - rw [hLHS] - -- RHS: (X^3 * formalU).coeff n = 0 for n < 3 - rw [PowerSeries.coeff_X_pow_mul'] -- rw [if_neg (by omega : ¬ 3 ≤ n)] -+ rw [ite_eq_right (by omega : ¬ 3 ≤ n)] - · push Not at hn - obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hn - rw [add_comm 3 m, PowerSeries.coeff_X_pow_mul] -@@ -290,11 +257,12 @@ theorem formalW_eq_X3_mul_U : - rw [show formalU W = PowerSeries.mk (fun n ↦ formalW_coeff W (n + 3)) from rfl, - PowerSeries.coeff_mk] - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `formalW W` has `PowerSeries.order` equal to 3 (since `formalW = X^3 * formalU` - and `formalU` is a unit). -/ - theorem formalW_ps_order : (formalW W).order = 3 := by - rw [formalW_eq_X3_mul_U, PowerSeries.order_mul, PowerSeries.order_X_pow, -- PowerSeries.order_zero_of_unit (formalU_isUnit W)] -+ PowerSeries.order_zero_of_isUnit (formalU_isUnit W)] - rfl - - omit [DecidableEq F] in -@@ -335,6 +303,7 @@ private theorem formalW_recurrence_lift : - HahnSeries.ofPowerSeries_X] at h - exact h - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Helper: `formalY W * lifted_formalW W = -1` in `LaurentSeries F`. -/ - private theorem formalY_mul_formalW : - formalY W * HahnSeries.ofPowerSeries ℤ F (formalW W) = -1 := by -@@ -355,6 +324,7 @@ private theorem formalY_mul_formalW : - _ = -(1 : LaurentSeries F) * 1 := by rw [h1, h2] - _ = -1 := by ring - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Helper: `formalX W * lifted_formalW W = single 1 1` in `LaurentSeries F`. -/ - private theorem formalX_mul_formalW : - formalX W * HahnSeries.ofPowerSeries ℤ F (formalW W) = -@@ -377,12 +347,14 @@ private theorem formalX_mul_formalW : - _ = HahnSeries.single (1 : ℤ) (1 : F) * 1 := by rw [h1, h2] - _ = HahnSeries.single (1 : ℤ) (1 : F) := mul_one _ - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `formalY W = -1 / lifted_formalW W` in `LaurentSeries F`. -/ - theorem formalY_eq_div : - formalY W = -1 / HahnSeries.ofPowerSeries ℤ F (formalW W) := by - rw [eq_div_iff (lifted_formalW_ne_zero W)] - exact formalY_mul_formalW W - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `formalX W = (single 1 1) / lifted_formalW W` in `LaurentSeries F`. -/ - theorem formalX_eq_div : - formalX W = HahnSeries.single (1 : ℤ) (1 : F) / -@@ -390,6 +362,7 @@ theorem formalX_eq_div : - rw [eq_div_iff (lifted_formalW_ne_zero W)] - exact formalX_mul_formalW W - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `(formalX W, formalY W)` satisfies the Weierstrass equation of `W` over `F`, - interpreted as an identity in `LaurentSeries F`. - -@@ -445,6 +418,7 @@ noncomputable def localParam : KE := - - /- `x_gen_ne_zero` HOISTED to `Foundation/MulByIntPullback.lean` (#7621). -/ - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The local parameter is nonzero in `K(E)`. -/ - theorem localParam_ne_zero : localParam W ≠ 0 := by - simp only [localParam] -@@ -470,16 +444,19 @@ through `AdjoinRoot.lift` and `IsLocalization.lift`. -/ - noncomputable def localExpand_inner : Polynomial F →+* LaurentSeries F := - Polynomial.eval₂RingHom (algebraMap F (LaurentSeries F)) (formalX W) - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The inner ring hom sends `Polynomial.X` to `formalX W`. -/ - @[simp] theorem localExpand_inner_X : - localExpand_inner W Polynomial.X = formalX W := by - simp [localExpand_inner] - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The inner ring hom sends constants to their algebra image. -/ - @[simp] theorem localExpand_inner_C (a : F) : - localExpand_inner W (Polynomial.C a) = algebraMap F (LaurentSeries F) a := by - simp [localExpand_inner] - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- The Weierstrass polynomial, evaluated via the inner ring hom at `formalY W`, - vanishes. This is `formalXY_weierstrass` expressed in terms of `Polynomial.eval₂`. -/ - private theorem localExpand_weierstrass_eval : -@@ -505,11 +482,13 @@ private noncomputable def localExpand_coordHom : - W.toAffine.CoordinateRing →+* LaurentSeries F := - AdjoinRoot.lift (localExpand_inner W) (formalY W) (localExpand_weierstrass_eval W) - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- The coordinate ring lift sends `AdjoinRoot.root` to `formalY W`. -/ - @[simp] private theorem localExpand_coordHom_root : - localExpand_coordHom W (AdjoinRoot.root W.toAffine.polynomial) = formalY W := by - simp [localExpand_coordHom, AdjoinRoot.lift_root] - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `(formalX W ^ n).orderTop = -2 * n` in `LaurentSeries F` (for `n : ℕ`). -/ - theorem formalX_pow_orderTop (n : ℕ) : - ((formalX W) ^ n).orderTop = ((-2 * n : ℤ) : WithTop ℤ) := by -@@ -526,6 +505,7 @@ theorem formalX_pow_orderTop (n : ℕ) : - push_cast - ring - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `(formalX W ^ n).leadingCoeff = 1` in `LaurentSeries F` (for `n : ℕ`). -/ - theorem formalX_pow_leadingCoeff (n : ℕ) : - ((formalX W) ^ n).leadingCoeff = 1 := by -@@ -536,6 +516,7 @@ theorem formalX_pow_leadingCoeff (n : ℕ) : - | succ k ih => - rw [pow_succ, HahnSeries.leadingCoeff_mul, ih, formalX_leadingCoeff, mul_one] - -+omit [W.toAffine.IsElliptic] in - /-- Auxiliary: for a polynomial `p : F[X]` with `p ≠ 0`, the image - `localExpand_inner W p` has `orderTop = -2 * p.natDegree` in `LaurentSeries F`. - -@@ -588,6 +569,7 @@ theorem localExpand_inner_orderTop_eq {p : Polynomial F} (hp : p ≠ 0) : - nlinarith - exact (HahnSeries.orderTop_add_eq_right h_lt).trans hB_ord - -+omit [W.toAffine.IsElliptic] in - /-- Auxiliary: for a nonzero polynomial `p : F[X]`, `localExpand_inner W p ≠ 0`. -/ - theorem localExpand_inner_ne_zero_of_ne_zero {p : Polynomial F} (hp : p ≠ 0) : - localExpand_inner W p ≠ 0 := by -@@ -596,6 +578,7 @@ theorem localExpand_inner_ne_zero_of_ne_zero {p : Polynomial F} (hp : p ≠ 0) : - rw [h, HahnSeries.orderTop_zero] at horder - exact absurd horder WithTop.top_ne_coe - -+omit [W.toAffine.IsElliptic] in - /-- Auxiliary: for a polynomial `p : F[X]` with `p ≠ 0`, the image - `localExpand_inner W p` has leading coefficient equal to `p.leadingCoeff`. - -@@ -653,6 +636,7 @@ theorem localExpand_inner_leadingCoeff {p : Polynomial F} (hp : p ≠ 0) : - nlinarith - rw [HahnSeries.leadingCoeff_add_eq_right h_lt, hB_lead, ← hDecomp] - -+omit [W.toAffine.IsElliptic] in - /-- Auxiliary: `(localExpand_inner W q) * formalY W` has odd `orderTop` - (`= -2 * natDegree q - 3`) when `q ≠ 0`. -/ - theorem localExpand_inner_mul_formalY_orderTop -@@ -663,6 +647,7 @@ theorem localExpand_inner_mul_formalY_orderTop - ← WithTop.coe_add] - rfl - -+omit [W.toAffine.IsElliptic] in - /-- The coordinate ring lift is injective. - - **Proof (Silverman IV.1)**: We use `exists_smul_basis_eq` to write any -@@ -738,20 +723,11 @@ private theorem localExpand_coordHom_injective : - rw [Affine.CoordinateRing.smul, Polynomial.C_0, map_zero, zero_mul, zero_add, - Affine.CoordinateRing.smul, Polynomial.C_0, map_zero, zero_mul] - --/-- The **local expansion** ring hom `K(E) → LaurentSeries F`, sending `x_gen ↦ -- formalX W` and `y_gen ↦ formalY W`. -- --The construction: --1. Build the inner ring hom `i : F[X] →+* LaurentSeries F` sending `X ↦ formalX W`. --2. Lift to `R = AdjoinRoot W.polynomial = F[X][Y]/(W) →+* LaurentSeries F` via -- `AdjoinRoot.lift` with root `formalY W`, using `formalXY_weierstrass` for -- the evaluation condition. --3. Extend to `K(E) = FractionRing R →+* LaurentSeries F` via `IsFractionRing.lift`, -- using that the coordinate ring lift is injective (source is a domain, target -- is a field, and the map is nonzero — sends `1` to `1`). -/ -+ - noncomputable def localExpand : KE →+* LaurentSeries F := - IsFractionRing.lift (localExpand_coordHom_injective W) - -+omit [W.toAffine.IsElliptic] in - /-- `localExpand` sends `x_gen` to `formalX W`. -/ - @[simp] theorem localExpand_x_gen : localExpand W (x_gen W) = formalX W := by - simp only [localExpand, x_gen] -@@ -761,11 +737,13 @@ noncomputable def localExpand : KE →+* LaurentSeries F := - ((AdjoinRoot.of W.toAffine.polynomial) Polynomial.X) = formalX W - simp [localExpand_coordHom, AdjoinRoot.lift_of, localExpand_inner] - -+omit [W.toAffine.IsElliptic] in - /-- `localExpand` sends `y_gen` to `formalY W`. -/ - @[simp] theorem localExpand_y_gen : localExpand W (y_gen W) = formalY W := by - simp only [localExpand, y_gen] - rw [IsFractionRing.lift_algebraMap, localExpand_coordHom_root] - -+omit [W.toAffine.IsElliptic] in - /-- `localExpand` is an `F`-algebra hom. -/ - theorem localExpand_algebraMap (a : F) : - localExpand W (algebraMap F KE a) = -@@ -781,6 +759,7 @@ theorem localExpand_algebraMap (a : F) : - simp [localExpand_coordHom, AdjoinRoot.lift_of, localExpand_inner, - LaurentSeries.algebraMap_apply, HahnSeries.ofPowerSeries_C] - -+omit [W.toAffine.IsElliptic] in - /-- `localExpand` agrees with the inner ring hom `localExpand_inner` on the image - of `F[X]` in `K(E)`: `localExpand (algebraMap (Polynomial F) KE p) = - localExpand_inner W p`. Both factor the algebra map through the coordinate ring -@@ -795,6 +774,7 @@ theorem localExpand_algebraMap_polynomial (p : Polynomial F) : - localExpand_inner W p - simp [localExpand_coordHom, AdjoinRoot.lift_of] - -+omit [W.toAffine.IsElliptic] in - /-- The `orderTop` of the local expansion of `algebraMap (Polynomial F) KE p` for a - nonzero polynomial `p` is `-2 · natDegree p`. This is `localExpand_inner_orderTop_eq` - transported through `localExpand_algebraMap_polynomial`. -/ -@@ -804,6 +784,7 @@ theorem orderTop_localExpand_algebraMap_polynomial {p : Polynomial F} (hp : p - rw [localExpand_algebraMap_polynomial] - exact localExpand_inner_orderTop_eq W hp - -+omit [W.toAffine.IsElliptic] in - /-- `localExpand` sends `localParam W` to the variable `t` of `LaurentSeries F`. - This is the key compatibility: the local parameter expands to the formal variable. -/ - theorem localExpand_localParam : -diff --git a/projects/HasseWeil/HasseWeil/Foundation/MulByIntPullback.lean b/projects/HasseWeil/HasseWeil/Foundation/MulByIntPullback.lean -index f41767ca5..e2383c638 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/MulByIntPullback.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/MulByIntPullback.lean -@@ -368,7 +368,7 @@ private lemma aeval_x_gen (p : Polynomial F) : - Polynomial.aeval_X_left_apply] - - -- The `Subalgebra F KE` scalar-tower instances and the `aeval` defeq steps below need the ---- relaxed transparency; this is a defeq setting, not a heartbeat budget. -+ - /- `mulByInt_x W n = Φ_n(x_gen) / ΨSq_n(x_gen)` is transcendental over `F` for `n ≠ 0`. - - The proof uses the integral closure approach: if `mulByInt_x` were algebraic over `F`, -@@ -382,7 +382,7 @@ private lemma mulByInt_x_transcendental (n : ℤ) (hn : n ≠ 0) : - intro h_alg - apply x_gen_transcendental W - set S : Subalgebra F KE := Algebra.adjoin F ({mulByInt_x W n} : Set KE) with hS_def -- haveI hS_alg : Algebra.IsAlgebraic F S := -+ have hS_alg : Algebra.IsAlgebraic F S := - (Subalgebra.isAlgebraic_iff S).mp - (Algebra.isAlgebraic_adjoin_singleton_iff.mpr h_alg) - have hmem : mulByInt_x W n ∈ S := Algebra.subset_adjoin (Set.mem_singleton _) -@@ -448,10 +448,8 @@ private lemma norm_smul_basis_ne_zero (p q : Polynomial F) (hq : q ≠ 0) : - (not_le.mpr (WithBot.bot_lt_iff_ne_bot.mpr this)) - - omit [W.toAffine.IsElliptic] in --/-- The image in `R = F[C]` of the `F[X]`-norm of the basis element `r' = p•1 + q•Y` --factors as `r' * conj_r`, where `conj_r` is the `F[X]`-conjugate class. Extracted as its --own lemma so it elaborates in a light context (the `coe_norm_smul_basis` rewrite and the --ring-hom bookkeeping are heartbeat-heavy inside the main injectivity proof). -/ -+ -+ - private lemma algebraMap_norm_smul_basis_eq (p q : Polynomial F) : - algebraMap (Polynomial F) R (Algebra.norm (Polynomial F) - (p • (1 : R) + q • Affine.CoordinateRing.mk W.toAffine Polynomial.X)) = -diff --git a/projects/HasseWeil/HasseWeil/Foundation/OmegaCoeffMulByIntFiniteField.lean b/projects/HasseWeil/HasseWeil/Foundation/OmegaCoeffMulByIntFiniteField.lean -index a61618eea..51a6ac743 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/OmegaCoeffMulByIntFiniteField.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/OmegaCoeffMulByIntFiniteField.lean -@@ -8,35 +8,35 @@ import HasseWeil.HasseBound.Primitives - import HasseWeil.Foundation.EC.MulByIntAddRecurrence - - /-! --# Silverman III.5.3: `a_{[m]} = m` via curve-side additivity (Route B assembly) -+# Pullback coefficients of integer multiplication - --Builds on **RB-ω4** (`kaehler_D_addPullback_x_eq_one_add_smul_omega`, the Silverman III.5.2 --collapse) to assemble `omegaPullbackCoeff (mulByInt m) = m` WITHOUT the EDS Wronskian and WITHOUT --the formal-group correspondence. -+The addition formula for the invariant differential gives -+`a_{id+α} = 1 + a_α` and `a_{α+β} = a_α + a_β`. The multiplication-coordinate -+recurrence then proves `a_{[m]} = m` for nonzero integers by induction and -+negation. In positive characteristic, multiplication by the characteristic -+has zero differential coefficient. Over a finite field, the same holds for -+multiplication by its cardinality and supplies the differential input to -+Verschiebung factorization. - --* **RB-ADD** (`omegaPullbackCoeff_addIsog_id`): -- `omegaPullbackCoeff (id ⊞ α) = 1 + omegaPullbackCoeff α`. --* **RB-ID/SUM/IND**: `id ⊞ [m] = [m+1]`, induction → `omegaPullbackCoeff (mulByInt m) = m`. -- --This is Silverman III.5.2 `(φ+ψ)*ω = φ*ω + ψ*ω` specialised to `φ = id`, then III.5.3's induction. -+References: Silverman, *The Arithmetic of Elliptic Curves*, III.5.2–3. - -/ - - open WeierstrassCurve - - namespace HasseWeil - --variable {K : Type*} [Field K] [Fintype K] [DecidableEq K] -+variable {K : Type*} [Field K] [DecidableEq K] - (W : WeierstrassCurve K) [W.toAffine.IsElliptic] - - local notation "KE" => W.toAffine.FunctionField - local notation "R" => W.toAffine.CoordinateRing - --/-- **RB-ADD** (Silverman III.5.2, `φ = id` case): for the genuine sum isogeny `σ = id ⊞ α` -+/-- Silverman III.5.2 for addition with the identity: for the genuine sum isogeny `σ = id ⊞ α` - (built via `addIsog` on the pair `(id, α)`), the omega-pullback coefficient is `1 + a_α`. - - Proof: by uniqueness in the 1-dimensional Kähler module. `omegaPullbackCoeff_spec` gives - `a_σ • ω = (α*u of σ)⁻¹ • D(σ*x)`. Now `σ*x = addPullback_x α` and `α*u of σ = u₃ := --2·addPullback_y + a₁·addPullback_x + a₃`, while RB-ω4 says `D(addPullback_x α) = u₃ · (1+a_α) · ω`. -+2·addPullback_y + a₁·addPullback_x + a₃`, while the addition identity says `D(addPullback_x α) = u₃ · (1+a_α) · ω`. - So `a_σ • ω = u₃⁻¹ · u₃ · (1+a_α) · ω = (1+a_α) · ω`, hence `a_σ = 1 + a_α`. -/ - theorem omegaPullbackCoeff_addIsog_id - (α : Isogeny W.toAffine W.toAffine) -@@ -115,21 +115,16 @@ theorem omegaPullbackCoeff_addIsog_pair - kaehler_D_addPullback_x_pair_eq_smul_omega W α₁ α₂ h_ne, smul_smul, - inv_mul_cancel₀ hu3_ne, one_smul] - ---- **RB-ID core** (`addPullback_xy_mulByInt_eq_succ`, the Silverman III.5.3 addition recurrence ---- `P ⊞ [m]P = [m+1]P`) lives in `HasseWeil.EC.MulByIntAddRecurrence` (minimal imports, to skirt the ---- `(W_KE W).toAffine.Point` ℤ-smul instance diamond — see `SK-ROUTEB-SMUL-DIAMOND` there). It is ---- imported above and consumed by RB-IND below. -- --/-- **RB chord step** (Silverman III.5.3 recurrence at the differential level): for `k ≥ 2`, -+/-- The Silverman III.5.3 recurrence at the differential level: for `k ≥ 2`, - `a_{[k+1]} = 1 + a_{[k]}`. - - Proof. By uniqueness in the 1-dimensional Kähler module. `omegaPullbackCoeff_spec` gives - `a_{[k+1]} • ω = (α*u of [k+1])⁻¹ • D([k+1]*x)`. Now: --* `[k+1]*x = mulByInt_x (k+1) = addPullback_x [k]` (RB-ID), so `D([k+1]*x) = D(addPullback_x [k])`. --* RB-ω4 (α = `[k]`, with `x_gen ≠ [k]*x` since `k ≥ 2`): -+* `[k+1]*x = mulByInt_x (k+1) = addPullback_x [k]` (the multiplication-coordinate recurrence), so `D([k+1]*x) = D(addPullback_x [k])`. -+* The differential addition identity (α = `[k]`, with `x_gen ≠ [k]*x` since `k ≥ 2`): - `D(addPullback_x [k]) = u₃ • ((1 + a_{[k]}) • ω)` - where `u₃ = 2·addPullback_y [k] + a₁·addPullback_x [k] + a₃`. --* RB-ID rewrites `addPullback_x/y [k] = mulByInt_x/y (k+1)`, so `u₃ = α*u of [k+1]` (definitionally, -+* The coordinate recurrence rewrites `addPullback_x/y [k] = mulByInt_x/y (k+1)`, so `u₃ = α*u of [k+1]` (definitionally, - via `alpha_star_u_mulByInt`). - - Hence `a_{[k+1]} • ω = u₃⁻¹ • (u₃ • (1 + a_{[k]}) • ω) = (1 + a_{[k]}) • ω`. -/ -@@ -142,15 +137,15 @@ theorem omegaPullbackCoeff_mulByInt_succ (k : ℤ) (hk2 : 2 ≤ k) : - have hx_ne : x_gen W ≠ mulByInt_x W k := by - rw [← mulByInt_x_one W] - exact mulByInt_x_ne_mulByInt_x W 1 k one_ne_zero hk0 (by omega) (by omega) -- -- `[k]*x = mulByInt_x k`, so RB-ω4's hypothesis `x_gen ≠ [k]*x` is `hx_ne`. -+ -- `[k]*x = mulByInt_x k`, so the differential addition hypothesis `x_gen ≠ [k]*x` is `hx_ne`. - have hkx : (mulByInt W.toAffine k).pullback (x_gen W) = mulByInt_x W k := - mulByInt_pullback_x W k hk0 - have hx_ne_pb : x_gen W ≠ (mulByInt W.toAffine k).pullback (x_gen W) := by - rw [hkx]; exact hx_ne -- -- RB-ID: `addPullback_x/y [k] = mulByInt_x/y (k+1)`. -+ -- The coordinate recurrence: `addPullback_x/y [k] = mulByInt_x/y (k+1)`. - obtain ⟨hAx, hAy⟩ := addPullback_xy_mulByInt_eq_succ W k hk0 hk1 hx_ne - -- `α*u of [k+1] = u₃ := 2·addPullback_y [k] + a₁·addPullback_x [k] + a₃` -- -- (def + RB-ID + alpha_star_u_mulByInt). -+ -- (by the coordinate recurrence and alpha_star_u_mulByInt). - have hu : alpha_star_u W (mulByInt W.toAffine (k + 1)) - = 2 * addPullback_y W (mulByInt W.toAffine k) - + algebraMap K KE W.a₁ * addPullback_x W (mulByInt W.toAffine k) -@@ -159,7 +154,7 @@ theorem omegaPullbackCoeff_mulByInt_succ (k : ℤ) (hk2 : 2 ≤ k) : - have hu3_ne : 2 * addPullback_y W (mulByInt W.toAffine k) - + algebraMap K KE W.a₁ * addPullback_x W (mulByInt W.toAffine k) + algebraMap K KE W.a₃ ≠ 0 := - hu ▸ alpha_star_u_ne_zero W (mulByInt W.toAffine (k + 1)) -- -- `[k+1]*x = addPullback_x [k]` (mulByInt_pullback_x + RB-ID). -+ -- `[k+1]*x = addPullback_x [k]` (by mulByInt_pullback_x and the coordinate recurrence). - have hpx : (mulByInt W.toAffine (k + 1)).pullback - (algebraMap R KE (algebraMap (Polynomial K) R Polynomial.X)) - = addPullback_x W (mulByInt W.toAffine k) := by -@@ -169,7 +164,7 @@ theorem omegaPullbackCoeff_mulByInt_succ (k : ℤ) (hk2 : 2 ≤ k) : - kaehler_D_addPullback_x_eq_one_add_smul_omega W (mulByInt W.toAffine k) hx_ne_pb, smul_smul, - inv_mul_cancel₀ hu3_ne, one_smul] - --/-- `a_{[n]} = n` for all `n ≥ 2`, by `Int.leInduction` from the axiom-clean base case `n = 2` -+/-- `a_{[n]} = n` for all `n ≥ 2`, by `Int.leInduction` from the base case `n = 2` - (`omegaPullbackCoeff_mulByInt_two`), with step `k ≥ 2 ⟹ k+1` via the chord step - `omegaPullbackCoeff_mulByInt_succ`. -/ - theorem omegaPullbackCoeff_mulByInt_ge_two (n : ℤ) (hn : 2 ≤ n) : -@@ -180,7 +175,7 @@ theorem omegaPullbackCoeff_mulByInt_ge_two (n : ℤ) (hn : 2 ≤ n) : - rw [omegaPullbackCoeff_mulByInt_succ W k hk2, ih, Int.cast_add, Int.cast_one, map_add, - map_one, add_comm] - --/-- **RB-IND** (Silverman III.5.3, positive case): `a_{[n]} = n` for all `n ≥ 1`. Combines the -+/-- Silverman III.5.3 for positive integers: `a_{[n]} = n` for all `n ≥ 1`. Combines the - `n = 1` case (`[1] = id`, `a_id = 1`) with `omegaPullbackCoeff_mulByInt_ge_two`. -/ - theorem omegaPullbackCoeff_mulByInt_pos (n : ℤ) (hn : 1 ≤ n) : - omegaPullbackCoeff W (mulByInt W.toAffine n) = algebraMap K KE n := by -@@ -188,8 +183,7 @@ theorem omegaPullbackCoeff_mulByInt_pos (n : ℤ) (hn : 1 ≤ n) : - · subst h1; rw [mulByInt_one_eq_id, omegaPullbackCoeff_id, Int.cast_one, map_one] - · exact omegaPullbackCoeff_mulByInt_ge_two W n (by omega) - --omit [Fintype K] in --/-- **RB negation**: `a_{[-n]} = -a_{[n]}` for `n ≠ 0`. The `[-n]`-pullback of `x_gen` -+/-- Negation of the multiplication differential coefficient: `a_{[-n]} = -a_{[n]}` for `n ≠ 0`. The `[-n]`-pullback of `x_gen` - agrees with the `[n]`-pullback (`mulByInt_x_neg`), while `α*u` flips sign - (`negY`-symmetry of `mulByInt_y`), so the spec equation flips sign and uniqueness - gives the result. -/ -@@ -219,9 +213,9 @@ theorem omegaPullbackCoeff_mulByInt_neg (n : ℤ) (hn : n ≠ 0) : - congr 1 - exact (omegaPullbackCoeff_spec W (mulByInt W.toAffine n)).symm - --/-- **RB-IND (Silverman III.5.3)**, integer form: `a_{[n]} = n` for all `n ≠ 0`, by the chord-step --induction (positive `n`) and the negation symmetry (negative `n`). Reroutes --`omegaPullbackCoeff_mulByInt` off the (still partial) EDS Wronskian. -/ -+/-- Silverman III.5.3 for all nonzero integers: `a_{[n]} = n`. -+Positive integers follow by the chord recurrence and negative integers by -+negation symmetry. -/ - theorem omegaPullbackCoeff_mulByInt_routeB (n : ℤ) (hn : n ≠ 0) : - omegaPullbackCoeff W (mulByInt W.toAffine n) = algebraMap K KE n := by - rcases lt_or_gt_of_ne hn with hneg | hpos -@@ -233,21 +227,17 @@ theorem omegaPullbackCoeff_mulByInt_routeB (n : ℤ) (hn : n ≠ 0) : - · -- n > 0: direct from the positive induction. - exact omegaPullbackCoeff_mulByInt_pos W n (by omega) - --/-- **Pillar B endpoint (wronskian-free, formal-group-free)**: in characteristic `p`, `[p]*ω = 0`, --i.e. `a_{[p]} = (p : K) = 0`. The axiom-clean Route B replacement for the formal-group --`omegaPullbackCoeff_mulByInt_p_eq_zero_via_formalGroup` and the wronskian --`omegaPullbackCoeff_mulByInt`. Direct from `omegaPullbackCoeff_mulByInt_routeB` --+ `CharP.cast_eq_zero`. -/ -+/-- In characteristic `p`, multiplication by `p` has zero differential -+coefficient, since its coefficient is the image of `p` in the base field. -/ - theorem omegaPullbackCoeff_mulByInt_p_eq_zero_routeB (p : ℕ) [CharP K p] (hp : p ≠ 0) : - omegaPullbackCoeff W (mulByInt W.toAffine (p : ℤ)) = 0 := by - rw [omegaPullbackCoeff_mulByInt_routeB W (p : ℤ) (by exact_mod_cast hp), - show ((p : ℤ) : K) = 0 from by rw [Int.cast_natCast]; exact CharP.cast_eq_zero K p, map_zero] - --/-- **Pillar B endpoint at `q = #K`** (`[q]*ω = 0`): over the finite field `K`, the ω-pullback --coefficient of `[q]` vanishes, since `a_{[q]} = (q : K) = 0` (`#K = char^n`). Axiom-clean via --`omegaPullbackCoeff_mulByInt_routeB`; this is the `q`-th-root input to the Verschiebung --factorisation `[q] = V ∘ Frob`. -/ --theorem omegaPullbackCoeff_mulByInt_card_eq_zero : -+/-- Over a finite field, multiplication by its cardinality has zero -+differential coefficient. This is the differential input to the Verschiebung -+factorization `[q] = V ∘ Frob`. -/ -+theorem omegaPullbackCoeff_mulByInt_card_eq_zero [Fintype K] : - omegaPullbackCoeff W (mulByInt W.toAffine (Fintype.card K : ℤ)) = 0 := by - rw [omegaPullbackCoeff_mulByInt_routeB W (Fintype.card K : ℤ) - (by exact_mod_cast Fintype.card_ne_zero), -diff --git a/projects/HasseWeil/HasseWeil/Foundation/OmegaPullbackCoeff.lean b/projects/HasseWeil/HasseWeil/Foundation/OmegaPullbackCoeff.lean -index 61150a90c..a51582216 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/OmegaPullbackCoeff.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/OmegaPullbackCoeff.lean -@@ -24,7 +24,7 @@ With `a_α ∈ F`: - - Additivity: `a_{α+β} = a_α + a_β` (from Silverman III.5.2) - - `a_{[n]} = n` (from Silverman III.5.3) - --## Implementation -+## Kähler differential construction - - The pullback `α*(ω)` in the Kähler differential module Ω[K(E)/F] is computed as: - `α*(ω) = D(α*(x)) · α*(u)⁻¹` -@@ -98,11 +98,9 @@ theorem omegaPullbackCoeff_spec (α : Isogeny W.toAffine W.toAffine) : - (α.pullback - (algebraMap R KE (algebraMap (Polynomial F) R Polynomial.X))))).choose_spec - ---- Chain rule for `omegaPullbackCoeff`. The chain rule `a_{α∘β} = a_α · a_β` holds when `a_α` ---- is in the base field `F` (so that `β*(a_α) = a_α`); for the Silverman convention `a_α ∈ F` ---- always holds (Silverman III.5.5). It is proved abstractly as `omegaPullbackCoeff_comp_of_base` ---- in `HasseWeil/InvariantDifferentialPullback.lean`; not restated here to avoid a naming clash. ---- For `α = [n]` we get `a_{[n]} = n ∈ F`, which is what the Hasse bound needs. -+-- The chain rule `a_{α∘β} = a_α · a_β` holds when `a_α` lies in the base -+-- field, so that the pullback by `β` fixes it. For multiplication by `n`, the -+-- differential coefficient is `n`, as in Silverman III.5.3. - - /-- Uniqueness of the omega-based pullback coefficient: in the 1-dimensional Kähler module, - if `c₁ • ω = c₂ • ω` then `c₁ = c₂` (since `ω ≠ 0` and `KE` is a field). -/ -@@ -124,7 +122,7 @@ theorem mulByInt_pullback_x (n : ℤ) (hn : n ≠ 0) : - (mulByInt W.toAffine n).pullback - (algebraMap R KE (algebraMap (Polynomial F) R Polynomial.X)) = - mulByInt_x W n := by -- have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dif_neg hn -+ have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dite_eq_right hn - rw [hpb] - change mulByInt_pullbackRingHom W n hn - (algebraMap R KE (algebraMap (Polynomial F) R Polynomial.X)) = _ -@@ -140,7 +138,7 @@ theorem mulByInt_pullback_y (n : ℤ) (hn : n ≠ 0) : - (mulByInt W.toAffine n).pullback - (algebraMap R KE (AdjoinRoot.root W.toAffine.polynomial)) = - mulByInt_y W n := by -- have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dif_neg hn -+ have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dite_eq_right hn - rw [hpb] - change mulByInt_pullbackRingHom W n hn - (algebraMap R KE (AdjoinRoot.root W.toAffine.polynomial)) = _ -@@ -331,11 +329,6 @@ private lemma wronskian_X_mul_sub (f q : Polynomial F) : - simp [Polynomial.derivative_sub, Polynomial.derivative_mul, Polynomial.derivative_X] - ring - ---- The auxiliary ring identity `wronskian_aux_three` has been moved to ---- `HasseWeil/WronskianAux.lean` (together with `wronskian_aux_four`) to isolate ---- its expensive elaboration. It is reused unchanged from there. -- ---- Case m=3: proved via `wronskian_aux_three` from `HasseWeil/WronskianAux.lean`. - -- The key insight: both LHS and RHS factor through Ψ₃, and after cancellation - -- the identity reduces to wronskian_aux_three (a tractable ring computation). - omit [DecidableEq F] [W.toAffine.IsElliptic] in -@@ -371,10 +364,7 @@ private lemma wronskian_Φ_ΨSq_three : - - -- Silverman III.3.7 auxiliary: verified ring identity for m=4. - -- Only expands to b₂, b₄, b₆, b₈ (not a₁..a₆) keeping the ring computation tractable. ---- The auxiliary ring identity `wronskian_aux_four` has been moved to ---- `HasseWeil/WronskianAux.lean` to isolate its ~57 GB ring elaboration. - ---- Case m=4: proved via `wronskian_aux_four` from `HasseWeil/WronskianAux.lean`. - -- After applying wronskian_X_mul_sub to restructure the Wronskian, - -- and expanding preΨ(8) via preΨ_even(4)/preΨ_odd(2)/preΨ_even(3), - -- the goal matches wronskian_aux_four exactly (up to 1-simplification). -@@ -420,96 +410,6 @@ private lemma wronskian_Φ_ΨSq_four : - simp only [Polynomial.C_ofNat] at haux ⊢ - linear_combination haux - --omit [DecidableEq F] [W.toAffine.IsElliptic] in --/-- The polynomial Wronskian identity for non-negative integers, by **strong induction**. -- -- Base cases `m = 0,1,2` use direct computation; `m = 3,4` use the factored ring identities -- (`wronskian_aux_three`, `wronskian_aux_four`). For `m = n+5` the proof is by strong induction: -- the induction hypothesis `ih` provides the identity at **all** smaller indices `k < m`. -- -- ## Status of the `m ≥ 5` inductive step -- -- The inductive step is the elliptic-divisibility-sequence (EDS) Wronskian recursion. Writing -- `p k := W.preΨ k` and `s := W.Ψ₂Sq`, and `W(k) := Φ_k' ΨSq_k − Φ_k ΨSq_k'`, the target is -- `W(k) = k · p(2k)`. The two halving recursions that drive the induction are (both verified by -- computer algebra against the actual division polynomials): -- -- * **Even step.** `W(2m) = 2 · complEDS₂(2m) · W(m)`, where -- `complEDS₂(2m) = p(2m-1)² p(2m+2) − p(2m-2) p(2m+1)²`. Combined with the induction hypothesis -- `W(m) = m · p(2m)` and `p(4m) = complEDS₂(2m) · p(2m)` (mathlib's `preNormEDS_mul_complEDS₂`) -- this collapses to `W(2m) = 2m · p(4m)`, i.e. the claim at `2m`. Both `m` and `m±1 < 2m`. -- * **Odd step.** The analogous reduction of `W(2m+1)` to `W(m)` and `W(m+1)`. -- -- The irreducible algebraic content of *each* halving step is the **EDS addition formula** -- (Ward's relation), verified by CAS in the exact form -- `p(i+j) p(i-j) = Aᵢ · p(i+1) p(i-1) p(j)² − Aⱼ · p(j+1) p(j-1) p(i)²`, -- with `Aᵢ = s²` iff (`i` odd and `j` even) else `1`, and `Aⱼ = s²` iff (`i` even and `j` odd) -- else `1`. Its `j = 2` specialisation is the Somos‑4 relation -- `p(m+2) p(m-2) = (Even m ? 1 : s²) · p(m+1) p(m-1) − Ψ₃ · p(m)²`. -- -- The even step `W(2m) = 2·complEDS₂(2m)·W(m)` is **not** a free-ring identity in the consecutive -- `preΨ` values alone — it is provably *false* without further relations, and is *not* closed by -- Somos‑4 together with the Weierstrass `b`-relation either: it genuinely requires the addition -- formula at general index `j`. Mathlib does not currently provide the EDS addition formula -- (only the duplication recursions `preΨ_even`/`preΨ_odd`), so closing this step needs that -- formula to be developed first. The `WronskianAux` `m = 3,4` proofs avoid it only because, at -- fixed small index, the difference factors through the single `b`-relation with an explicitly -- computed multiplier; -- that multiplier grows with the index, so the same device does not generalise. -- -- An **axiom-clean** alternative is available downstream of this file via the function field: -- the field-general Route-B chord induction `omegaCoeff_mulByInt` -- (`HasseWeil/RouteBGeneral.lean`) proves the differential statement `[n]*ω = n·ω` -- (Silverman III.5.3) over any field, with no EDS Wronskian; it cannot be imported here (it -- depends transitively on this file), but every former geometric consumer of the Wronskian -- (`Hasse/Separability.lean`, `PullbackCoeff.lean`) now routes through it, so this `sorry` is -- **consumer-free**. The polynomial identity itself also has an axiom-clean downstream proof: -- `wronskian_Φ_ΨSq_general` (`EC/WronskianGeneral.lean`). -/ --private lemma wronskian_Φ_ΨSq_nat (m : ℕ) : -- Polynomial.derivative (W.Φ (m : ℤ)) * W.ΨSq (m : ℤ) - -- W.Φ (m : ℤ) * Polynomial.derivative (W.ΨSq (m : ℤ)) = -- Polynomial.C ((m : ℤ) : F) * W.preΨ (2 * (m : ℤ)) := by -- induction m using Nat.strong_induction_on with -- | _ m ih => -- -- `ih : ∀ k < m, (the identity at k)` — the strong induction hypothesis. -- match m, ih with -- | 0, _ => exact wronskian_Φ_ΨSq_zero W -- | 1, _ => exact_mod_cast wronskian_Φ_ΨSq_one W -- | 2, _ => exact_mod_cast wronskian_Φ_ΨSq_two W -- | 3, _ => exact_mod_cast wronskian_Φ_ΨSq_three W -- | 4, _ => exact_mod_cast wronskian_Φ_ΨSq_four W -- | (n + 5), ih => -- -- General case `m = n+5 ≥ 5`. The induction hypothesis `ih k hk` gives the identity at -- -- every `k < n+5`, in particular at the halves `⌊(n+5)/2⌋`, `⌈(n+5)/2⌉` needed by the EDS -- -- Wronskian recursion (even/odd halving step). The single missing ingredient is the EDS -- -- addition formula (see the docstring above); supplying it closes this step via -- -- `linear_combination` of the induction hypothesis at the halves with the -- -- addition-formula / Somos‑4 instances. -- sorry -- --omit [DecidableEq F] [W.toAffine.IsElliptic] in --/-- The division polynomial Wronskian identity: -- `Φ_n' · ΨSq_n - Φ_n · ΨSq_n' = n · preΨ(2n)` as polynomials in `F[X]`. -- -- Reference: Silverman Exercise III.3.7. -- -- Proved by reducing to the natural number case via `wronskian_Φ_ΨSq_neg_of` -- (negation symmetry) and `wronskian_Φ_ΨSq_nat` (positive case by induction). -/ --theorem wronskian_Φ_ΨSq (n : ℤ) : -- Polynomial.derivative (W.Φ n) * W.ΨSq n - W.Φ n * Polynomial.derivative (W.ΨSq n) = -- Polynomial.C (n : F) * W.preΨ (2 * n) := by -- rcases lt_or_ge n 0 with hneg | hpos -- · -- n < 0: use negation symmetry on the positive case -- have hm : (0 : ℤ) ≤ -n := by omega -- obtain ⟨m, hm_eq⟩ := Int.eq_ofNat_of_zero_le hm -- have hn_eq : n = -(m : ℤ) := by omega -- rw [hn_eq] -- exact wronskian_Φ_ΨSq_neg_of W (wronskian_Φ_ΨSq_nat W m) -- · -- n ≥ 0: directly from wronskian_Φ_ΨSq_nat -- obtain ⟨m, hm_eq⟩ := Int.eq_ofNat_of_zero_le hpos -- subst hm_eq -- exact wronskian_Φ_ΨSq_nat W m -- - omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `Φ_ff` and `ΨSq_ff` factor through `algebraMap (Polynomial F) KE`. -/ - private lemma Φ_ff_eq_algebraMap_poly (n : ℤ) : -@@ -527,7 +427,7 @@ private lemma ΨSq_ff_eq_algebraMap_poly (n : ℤ) : - This is the polynomial shadow of the third division polynomial `ω_n` and follows from the - geometric facts `preΨ(2n)·u = ψ_n·ψc_n` (i.e. `ψ_{2n} = ψ_n·ψc_n`, `ψc_spec_ff`) and - `α*(u) = ψc_n/ψ_n³` (`ω_spec_ff`), together with `ΨSq_ff = ψ_n²` (`ψ_ff_sq_eq`). It does **not** -- use the division-polynomial Wronskian, so it is axiom-clean and can be combined with the -+ use the division-polynomial Wronskian, and can be combined with the - chord-recursion `omegaPullbackCoeff_mulByInt_routeB` downstream to recover the polynomial - Wronskian. -/ - theorem preΨ_two_mul_u_eq_ΨSq_sq_mul_alpha_star_u (n : ℤ) (hn : n ≠ 0) : -@@ -543,7 +443,7 @@ theorem preΨ_two_mul_u_eq_ΨSq_sq_mul_alpha_star_u (n : ℤ) (hn : n ≠ 0) : - have h_preΨ_u : algebraMap (Polynomial F) KE (W.preΨ (2 * n)) * u_gen W = ψn * ψcn := by - rw [hψn_def, hψcn_def, ψc_spec_ff W n, Affine.CoordinateRing.mk_ψ (W := W.toAffine) (2 * n)] - have hΨ_eq : W.Ψ (2 * n) = Polynomial.C (W.preΨ (2 * n)) * W.ψ₂ := by -- rw [WeierstrassCurve.Ψ, if_pos (even_two_mul n)] -+ rw [WeierstrassCurve.Ψ, ite_eq_left (even_two_mul n)] - rw [hΨ_eq, map_mul, map_mul, - show W.ψ₂ = W.toAffine.polynomialY from rfl, mk_polynomialY_eq_u_gen W] - rfl -@@ -578,8 +478,7 @@ theorem preΨ_two_mul_u_eq_ΨSq_sq_mul_alpha_star_u (n : ℤ) (hn : n ≠ 0) : - - mk(polynomialY) = u_gen in K(E) - - Taking `hpoly` as a hypothesis lets specific values of `n` (e.g. `n = 2`) be -- discharged from the axiom-clean per-value polynomial lemmas -- (`wronskian_Φ_ΨSq_two`, …), independently of the general `wronskian_Φ_ΨSq`. -+ discharged from the per-value polynomial identities such as `wronskian_Φ_ΨSq_two`. - Reference: Silverman Exercise III.3.7, III.5.3 -/ - theorem divPoly_wronskian_identity_of_poly (n : ℤ) (hn : n ≠ 0) - (hpoly : Polynomial.derivative (W.Φ n) * W.ΨSq n - -@@ -618,7 +517,7 @@ theorem divPoly_wronskian_identity_of_poly (n : ℤ) (hn : n ≠ 0) - have h_preΨ_u : algebraMap (Polynomial F) KE (W.preΨ (2 * n)) * u_gen W = ψn * ψcn := by - rw [hψn_def, hψcn_def, ψc_spec_ff W n, Affine.CoordinateRing.mk_ψ (W := W.toAffine) (2 * n)] - have hΨ_eq : W.Ψ (2 * n) = Polynomial.C (W.preΨ (2 * n)) * W.ψ₂ := by -- rw [WeierstrassCurve.Ψ, if_pos (even_two_mul n)] -+ rw [WeierstrassCurve.Ψ, ite_eq_left (even_two_mul n)] - rw [hΨ_eq, map_mul, map_mul, - show W.ψ₂ = W.toAffine.polynomialY from rfl, mk_polynomialY_eq_u_gen W] - rfl -@@ -646,20 +545,6 @@ theorem divPoly_wronskian_identity_of_poly (n : ℤ) (hn : n ≠ 0) - h_preΨ_u, h_alpha_u, show ΨSq_ff W n = ψn ^ 2 from (ψ_ff_sq_eq W n).symm] - field_simp - --/-- The division polynomial Wronskian identity in K(E) (general `n`), via the -- general polynomial-level identity `wronskian_Φ_ΨSq`. -- Reference: Silverman Exercise III.3.7, III.5.3 -/ --theorem divPoly_wronskian_identity (n : ℤ) (hn : n ≠ 0) : -- (algebraMap (Polynomial F) KE (Polynomial.derivative (W.Φ n)) * -- ΨSq_ff W n - -- Φ_ff W n * -- algebraMap (Polynomial F) KE (Polynomial.derivative (W.ΨSq n))) * -- u_gen W = -- algebraMap F KE n * -- ΨSq_ff W n ^ 2 * -- alpha_star_u W (mulByInt W.toAffine n) := -- divPoly_wronskian_identity_of_poly W n hn (wronskian_Φ_ΨSq (W := W) n) -- - -- Chain rule for `D` on polynomial images in K(E), using `Derivation.comp_aeval_eq`: for - -- `p : F[X]` and `a ∈ KE`, `D(aeval a p) = aeval a (derivative p) • D(a)`. - -@@ -695,8 +580,7 @@ theorem D_poly_eval (p : Polynomial F) : - via the quotient rule and chain rule for the universal derivation. - - Taking `hpoly` as a hypothesis lets specific values of `n` be discharged from -- the axiom-clean per-value polynomial lemmas (`wronskian_Φ_ΨSq_two`, …), -- independently of the general `wronskian_Φ_ΨSq`. -/ -+ the per-value polynomial identities such as `wronskian_Φ_ΨSq_two`. -/ - theorem omegaPullbackCoeff_mulByInt_of_poly (n : ℤ) (hn : n ≠ 0) - (hpoly : Polynomial.derivative (W.Φ n) * W.ΨSq n - - W.Φ n * Polynomial.derivative (W.ΨSq n) = -@@ -768,7 +652,7 @@ theorem omegaPullbackCoeff_mulByInt_of_poly (n : ℤ) (hn : n ≠ 0) - - This is the converse of `omegaPullbackCoeff_mulByInt_of_poly`'s final algebra: the spec - `a • ω = α*(u)⁻¹ • D(α*x)` together with `a = n` and the chain/quotient rule for `D` gives the -- scalar identity `(Φ' Ψ − Φ Ψ') · u = n · Ψ² · α*u` in K(E). Fed the axiom-clean -+ scalar identity `(Φ' Ψ − Φ Ψ') · u = n · Ψ² · α*u` in K(E). Given the - `omegaPullbackCoeff_mulByInt_routeB` (downstream), it recovers the K(E) Wronskian — and then, - via the bridge `preΨ_two_mul_u_eq_ΨSq_sq_mul_alpha_star_u` and injectivity of - `algebraMap (Polynomial F) KE`, the **polynomial** Wronskian — without the EDS addition -@@ -843,30 +727,10 @@ theorem divPoly_wronskian_identity_of_omega (n : ℤ) (hn : n ≠ 0) - -- Goal is already in the `set` names `Φ, Ψ, Φ', Ψ', u, αu`; `hfin` matches up to symmetry. - linear_combination -hfin - --/-- For [n], the omega-based pullback coefficient is n (general `n`, via the -- general polynomial-level Wronskian identity `wronskian_Φ_ΨSq`). -- Silverman III.5.3, IV.2.3. -- -- NOTE: this routing through `wronskian_Φ_ΨSq` inherits its `sorryAx` taint -- (the `m ≥ 5` branch of `wronskian_Φ_ΨSq_nat`). The **axiom-clean, field-general** -- proof of the same statement, via the Route-B chord recurrence (Silverman -- III.5.2/3 at the differential level), is `HasseWeil.omegaCoeff_mulByInt` in -- `HasseWeil/RouteBGeneral.lean`. That module cannot be imported here (its chord -- step lives downstream of this file), so the replacement cannot be applied in -- place — instead all former consumers (`Hasse/Separability.lean`, -- `PullbackCoeff.lean`) now route through `omegaCoeff_mulByInt`, leaving this -- theorem (and its Wronskian `sorry`) **consumer-free**. -/ --theorem omegaPullbackCoeff_mulByInt (n : ℤ) (hn : n ≠ 0) : -- omegaPullbackCoeff W (mulByInt W.toAffine n) = algebraMap F KE n := -- omegaPullbackCoeff_mulByInt_of_poly W n hn (wronskian_Φ_ΨSq (W := W) n) -- --/-- **Axiom-clean base case `[2]`**: `omegaPullbackCoeff W (mulByInt 2) = 2`. -- -- Uses the per-value polynomial Wronskian lemma `wronskian_Φ_ΨSq_two` (a direct -- `ring` computation, axiom-clean) through `omegaPullbackCoeff_mulByInt_of_poly`, -- so it does NOT depend on the general `wronskian_Φ_ΨSq` (whose `m ≥ 5` branch -- is unproved). Seeds the Route-B chord induction (`m ≥ 3` follows from the -- chord step `omegaPullbackCoeff_mulByInt_succ`). -/ -+/-- The differential coefficient of multiplication by two is two. -+ -+ The per-value polynomial identity `wronskian_Φ_ΨSq_two` gives the base case -+ for the differential chord recurrence. -/ - theorem omegaPullbackCoeff_mulByInt_two : - omegaPullbackCoeff W (mulByInt W.toAffine 2) = algebraMap F KE (2 : ℤ) := - omegaPullbackCoeff_mulByInt_of_poly W 2 (by norm_num) -diff --git a/projects/HasseWeil/HasseWeil/Foundation/OrdAtInftyBridge.lean b/projects/HasseWeil/HasseWeil/Foundation/OrdAtInftyBridge.lean -index 78be88908..b82e10035 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/OrdAtInftyBridge.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/OrdAtInftyBridge.lean -@@ -8,28 +8,13 @@ import HasseWeil.Foundation.OmegaPullbackCoeff - import HasseWeil.Foundation.Curves.Valuation.Infinity - - /-! --# Bridge from `W.toAffine` to `SmoothPlaneCurve` for `ordAtInfty` -+# Orders at infinity of generic Weierstrass coordinates - --This file provides the minimal bridge needed to apply worker-I's --`ordAtInfty` infrastructure (in `HasseWeil/Curves/Infinity.lean`) to the --generic-point framework used by `MulByIntPullback.lean` and --`AdditionPullback.lean`. -- --Concretely: given `W : WeierstrassCurve F` with `W.toAffine.IsElliptic`, --we wrap `W.toAffine` as a `SmoothPlaneCurve F` and re-export the --`ordAtInfty` results for `x_gen W` and `y_gen W` (and the --basefield-algebraMap) in a directly usable form. -- --The downstream consumer is the witness-parametric pole argument --`addPullback_x_ne_const_of_pole` (`AdditionPullback.lean`), whose pole --witnesses are supplied per-isogeny (e.g. in `AdditionPullback/Frobenius.lean`). -- --## Main results -- --* `W_smooth W : SmoothPlaneCurve F` — the bridge wrapper. --* `ordAtInfty_x_gen` — `ord_∞(x_gen) = -2`. --* `ordAtInfty_y_gen` — `ord_∞(y_gen) = -3`. --* `ordAtInfty_algebraMap_F_nonzero` — constants from `F` have `ord_∞ = 0`. -+For an elliptic Weierstrass curve `W`, the generic coordinates have orders -+`ord_∞(x_gen W) = -2` and `ord_∞(y_gen W) = -3`. Nonzero base-field constants -+have order zero. Scalar-tower identities relate the division polynomials in -+the coordinate ring and function field, giving the pole orders of the -+multiplication-by-integer pullbacks, including the inseparable case. - - ## References - -@@ -45,19 +30,21 @@ variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] - - local notation "KE" => W.toAffine.FunctionField - --/-- Wrap `W.toAffine` as a `SmoothPlaneCurve F` so that worker-I's --`ordAtInfty` infrastructure applies. -/ -+/-- The smooth plane curve associated to the affine Weierstrass equation. -/ - noncomputable def W_smooth : SmoothPlaneCurve F := - ⟨W.toAffine⟩ - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- The affine curve underlying the `SmoothPlaneCurve` wrapper is `W`. -/ - @[simp] theorem W_smooth_toAffine : (W_smooth W).toAffine = W.toAffine := rfl - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- The function field of the SmoothPlaneCurve wrapper equals `KE` - definitionally (both are `W.toAffine.FunctionField`). -/ - @[simp] theorem W_smooth_functionField : - (W_smooth W).FunctionField = KE := rfl - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- The `coordX` of the wrapper matches our `x_gen W` at the function-field - level. Both are `algebraMap (Polynomial F) KE Polynomial.X`. -/ - theorem coordX_W_smooth_eq_x_gen : (W_smooth W).coordX = x_gen W := by -@@ -67,12 +54,14 @@ theorem coordX_W_smooth_eq_x_gen : (W_smooth W).coordX = x_gen W := by - rw [← IsScalarTower.algebraMap_apply (Polynomial F) W.toAffine.CoordinateRing KE] - rfl - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ord_∞(x_gen W) = -2` — Silverman II.1 / IV.1 for the generic x. -/ - theorem ordAtInfty_x_gen : - (W_smooth W).ordAtInfty (x_gen W) = ((-2 : ℤ) : WithTop ℤ) := by - rw [← coordX_W_smooth_eq_x_gen] - exact (W_smooth W).ordAtInfty_coordX - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- The `coordY` of the wrapper matches our `y_gen W` at the function-field - level. Both are the image of `AdjoinRoot.root W.polynomial` under the - algebraMap to `KE`. The `basis_one` lemma identifies -@@ -82,12 +71,14 @@ theorem coordY_W_smooth_eq_y_gen : (W_smooth W).coordY = y_gen W := by - rw [Affine.CoordinateRing.basis_one] - rfl - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ord_∞(y_gen W) = -3` — Silverman II.1 / IV.1 for the generic y. -/ - theorem ordAtInfty_y_gen : - (W_smooth W).ordAtInfty (y_gen W) = ((-3 : ℤ) : WithTop ℤ) := by - rw [← coordY_W_smooth_eq_y_gen] - exact (W_smooth W).ordAtInfty_coordY - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ord_∞(algebraMap F KE c) = 0` for nonzero `c : F`. Direct corollary of - `SmoothPlaneCurve.ordAtInfty_algebraMap_F_nonzero` applied to `W_smooth W`. -/ - theorem ordAtInfty_algebraMap_F_nonzero {c : F} (hc : c ≠ 0) : -@@ -96,9 +87,7 @@ theorem ordAtInfty_algebraMap_F_nonzero {c : F} (hc : c ≠ 0) : - - /-! ### Powers of generators -/ - --/- `x_gen_ne_zero` / `y_gen_ne_zero` HOISTED to `Foundation/MulByIntPullback.lean` next to --the defs (#7621) — they were declared BOTH here and in `LocalExpansion.lean` (same names, --same namespace), so no module could import both files without an environment clash. -/ -+ - - omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `y_gen W` and `(W_smooth W).coordYInFunctionField` are the same element of -@@ -110,12 +99,13 @@ theorem y_gen_eq_coordYInFunctionField : - /-- `mulByInt_y W n ≠ 0` for `n ≠ 0`: it is the image of `y_gen ≠ 0` under the - field embedding `[n]^*`. -/ - theorem mulByInt_y_ne_zero (n : ℤ) (hn : n ≠ 0) : mulByInt_y W n ≠ 0 := by -- have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dif_neg hn -+ have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dite_eq_right hn - have h : mulByInt_pullbackAlgHom W n hn (y_gen W) = mulByInt_y W n := - hpb ▸ mulByInt_pullback_y W n hn - rw [← h] - exact (map_ne_zero (mulByInt_pullbackAlgHom W n hn)).mpr (y_gen_ne_zero W) - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ord_∞(x_gen^n) = n • (-2)`. -/ - theorem ordAtInfty_x_gen_pow (n : ℕ) : - (W_smooth W).ordAtInfty (x_gen W ^ n) = n • ((-2 : ℤ) : WithTop ℤ) := by -@@ -124,6 +114,7 @@ theorem ordAtInfty_x_gen_pow (n : ℕ) : - rw [ordAtInfty_x_gen] at h - exact h - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ord_∞(y_gen^n) = n • (-3)`. -/ - theorem ordAtInfty_y_gen_pow (n : ℕ) : - (W_smooth W).ordAtInfty (y_gen W ^ n) = n • ((-3 : ℤ) : WithTop ℤ) := by -@@ -140,6 +131,7 @@ Both `Φ_ff W n` and `ΨSq_ff W n` are defined as - This bridges to `ordAtInfty_algebraMap_polynomial_of_ne_zero` for the - ord computation. -/ - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `Φ_ff W n = algebraMap (Polynomial F) KE (W.Φ n)` via the scalar tower - `F[X] → CoordinateRing → FunctionField`. -/ - theorem Φ_ff_eq_algebraMap_polynomial (n : ℤ) : -@@ -147,6 +139,7 @@ theorem Φ_ff_eq_algebraMap_polynomial (n : ℤ) : - (IsScalarTower.algebraMap_apply - (Polynomial F) W.toAffine.CoordinateRing KE (W.Φ n)).symm - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ΨSq_ff W n = algebraMap (Polynomial F) KE (W.ΨSq n)` via the scalar tower - `F[X] → CoordinateRing → FunctionField`. -/ - theorem ΨSq_ff_eq_algebraMap_polynomial (n : ℤ) : -@@ -159,6 +152,7 @@ theorem ΨSq_ff_eq_algebraMap_polynomial (n : ℤ) : - Direct from the tower bridge + `ordAtInfty_algebraMap_polynomial_of_ne_zero` + - mathlib's `natDegree_Φ` / `natDegree_ΨSq`. -/ - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ord_∞(Φ_ff W n) = -2 · n.natAbs²`. -/ - theorem ordAtInfty_Φ_ff (n : ℤ) : - (W_smooth W).ordAtInfty (Φ_ff W n) = -@@ -171,6 +165,7 @@ theorem ordAtInfty_Φ_ff (n : ℤ) : - push_cast - ring_nf - -+omit [DecidableEq F] [W.toAffine.IsElliptic] in - /-- `ord_∞(ΨSq_ff W n) = -2 · (n.natAbs² - 1)` for `(n : F) ≠ 0`. -/ - theorem ordAtInfty_ΨSq_ff (n : ℤ) (hnF : (n : F) ≠ 0) : - (W_smooth W).ordAtInfty (ΨSq_ff W n) = -@@ -203,6 +198,7 @@ private theorem algebraMap_polynomial_KE_injective : - Affine.CoordinateRing.algebraMap_poly_injective - - omit [DecidableEq F] in -+omit [W.toAffine.IsElliptic] in - /-- `Φ_ff W n ≠ 0` for any n. Direct from `W.Φ_ne_zero` + algebraMap injectivity. -/ - theorem Φ_ff_ne_zero (n : ℤ) : Φ_ff W n ≠ 0 := by - classical -@@ -211,12 +207,14 @@ theorem Φ_ff_ne_zero (n : ℤ) : Φ_ff W n ≠ 0 := by - exact W.Φ_ne_zero n - (algebraMap_polynomial_KE_injective W (h.trans (map_zero _).symm)) - -+omit [DecidableEq F] in - /-- `mulByInt_x W n ≠ 0` for `n ≠ 0`. Direct from `Φ_ff_ne_zero` and - `ΨSq_ff_ne_zero`. -/ - theorem mulByInt_x_ne_zero (n : ℤ) (hn : n ≠ 0) : mulByInt_x W n ≠ 0 := by - simp only [mulByInt_x] - exact div_ne_zero (Φ_ff_ne_zero W n) (ΨSq_ff_ne_zero W hn) - -+omit [DecidableEq F] in - /-- `ord_∞(mulByInt_x W n) = -2` for `n ≠ 0` and `(n : F) ≠ 0`. - - Direct from `ordAtInfty_Φ_ff`, `ordAtInfty_ΨSq_ff`, and division: the -@@ -250,6 +248,7 @@ theorem ordAtInfty_mulByInt_x (n : ℤ) (hn : n ≠ 0) (hnF : (n : F) ≠ 0) : - congr 1 - ring] - -+omit [DecidableEq F] in - /-- **Unconditional pole of `mulByInt_x W n`**: `ord_∞(mulByInt_x W n) < 0` for - every `n ≠ 0`, with **no** `(n : F) ≠ 0` hypothesis. - -@@ -262,8 +261,7 @@ numerator therefore strictly out-degrees the denominator, so the ratio - `Φ_ff / ΨSq_ff` has a pole at `O`: - `ord = -2·natAbs² - (-2·natDegree (ΨSq n)) ≤ -2·natAbs² + 2(natAbs² - 1) = -2 < 0`. - --This is exactly the brick needed for the V-side "summand reduces to `O`" facts, --where the Frobenius factor `r·q` lands in the inseparable regime. -/ -+-/ - theorem ordAtInfty_mulByInt_x_neg (n : ℤ) (hn : n ≠ 0) : - (W_smooth W).ordAtInfty (mulByInt_x W n) < 0 := by - classical -@@ -304,6 +302,7 @@ theorem ordAtInfty_mulByInt_x_neg (n : ℤ) (hn : n ≠ 0) : - -- Transport `h_int` across the `WithTop ℤ` coercions. - exact_mod_cast h_int - -+omit [DecidableEq F] in - /-- **`ord_∞(mulByInt_x W n)` is an explicit even value `≤ -2`** for every `n ≠ 0`, with **no** - `(n : F) ≠ 0` hypothesis — so it holds in the *inseparable* case `(n : F) = 0` (e.g. `n = r` with - `p ∣ r`). -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Ramification.lean b/projects/HasseWeil/HasseWeil/Foundation/Ramification.lean -index 8a1dfaa9c..d72959809 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Ramification.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Ramification.lean -@@ -6,7 +6,9 @@ Authors: Chris Birkbeck - import Mathlib.Algebra.Polynomial.SpecificDegree - import Mathlib.FieldTheory.IntermediateField.Algebraic - import Mathlib.FieldTheory.SeparableDegree --import Mathlib.NumberTheory.RamificationInertia.Basic -+import Mathlib.RingTheory.RamificationInertia.Basic -+import Mathlib.NumberTheory.RamificationInertia.Inertia -+import Mathlib.NumberTheory.RamificationInertia.Ramification - import Mathlib.RingTheory.Algebraic.Integral - import Mathlib.RingTheory.Artinian.Ring - import Mathlib.RingTheory.DedekindDomain.Basic -@@ -25,61 +27,6 @@ import Mathlib.RingTheory.Polynomial.GaussLemma - import HasseWeil.Isogeny.FunctionField - import HasseWeil.Foundation.Valuation - --/-! --# Ramification Theory for Elliptic Curve Isogenies -- --We connect mathlib's `Ideal.ramificationIdx'` and `Ideal.inertiaDeg'` to the --theory of elliptic curve isogenies, specializing the general framework from --`Mathlib.NumberTheory.RamificationInertia` to coordinate ring extensions. -- --For an isogeny `φ : E₁ → E₂`, the pullback `φ* : K(E₂) →ₐ[F] K(E₁)` restricts to --a ring homomorphism on coordinate rings. The ramification index `e_P(φ)` at a --prime `P` of `R₁ = K[E₁]` is `Ideal.ramificationIdx' (φ*.restrict) p P` where --`p = φ*⁻¹(P)` is the prime of `R₂ = K[E₂]` below `P`. -- --## Main results -- --* `HasseWeil.coordinateRing_isDedekindDomain`: the coordinate ring of an elliptic curve -- is a Dedekind domain. Proved via `IsIntegralClosure.isDedekindDomain`: the coordinate -- ring `R = F[X][Y]/(W)` is the integral closure of the PID `F[X]` in the function field -- `K(E) = Frac(R)`, and `K(E)/F(X)` is a finite separable extension of degree 2. --* `HasseWeil.coordinateRing_isIntegrallyClosed`: the coordinate ring is integrally closed -- in its fraction field, via `IsIntegrallyClosed.of_localization_maximal` together with -- principality of the maximal ideal at every localization. --* `HasseWeil.coordinateRing_dimensionLEOne`: the coordinate ring has Krull dimension at -- most 1 (every nonzero prime is maximal), from the principal ideal theorem. -- --## Strategy -- --The `IsIntegralClosure.isDedekindDomain` route shows that `CoordinateRing` is the integral --closure of the PID `F[X]` in the function field. The key steps: -- --1. **`F[X]` is Dedekind**: it is a PID, hence Dedekind (automatic from mathlib). --2. **`CoordinateRing` is integrally closed**: via `IsIntegrallyClosed.of_localization_maximal`, -- each localization at a nonzero maximal ideal `P` is a DVR (hence integrally closed). The -- DVR property follows from the TFAE for Noetherian local domains of dimension `≤ 1` with a -- principal maximal ideal; principality (`maximalIdeal_isPrincipal_of_nonsingular`) uses -- nonsingularity at each closed point (`Δ ≠ 0`), via the Jacobian identity and a case split -- on the characteristic. --3. **`CoordinateRing` is the integral closure of `F[X]` in `FunctionField`**: elements -- integral over `F[X]` are integral over `CoordinateRing` (by `tower_top`), hence lie in -- `CoordinateRing` (by step 2 and `isIntegrallyClosed_iff`). --4. **`FunctionField / FractionRing(F[X])` is finite** of degree 2. --5. **`FunctionField / FractionRing(F[X])` is separable**: from `finSepDegree` dividing 2 and -- the existence of a separable root (the Weierstrass polynomial has nonzero Y-derivative). --6. **Apply `IsIntegralClosure.isDedekindDomain`**: combines all the above. -- --## Implementation notes -- --This file is open infrastructure for the full isogeny ramification theory (the degree-sum --formula `deg φ = Σ e_P · f_P`, unramifiedness of separable isogenies, and equal fibre sizes --from translation invariance are not yet formalised here). The Dedekind-domain results it --provides are complete and axiom-clean. -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*], II.2, III.4.10 ---/ - - open WeierstrassCurve Polynomial Ideal IntermediateField - open scoped Polynomial.Bivariate nonZeroDivisors IntermediateField -@@ -157,8 +104,8 @@ private lemma nonsingular_at_maximal (E : Affine F) [E.IsElliptic] - (P : Ideal E.CoordinateRing) (hPmax : P.IsMaximal) : - AdjoinRoot.mk E.polynomial E.polynomialX ∉ P ∨ - AdjoinRoot.mk E.polynomial E.polynomialY ∉ P := by -- letI : P.IsPrime := hPmax.isPrime -- haveI : Field (E.CoordinateRing ⧸ P) := Ideal.Quotient.field P -+ let : P.IsPrime := hPmax.isPrime -+ have : Field (E.CoordinateRing ⧸ P) := Ideal.Quotient.field P - let φ : F →+* (E.CoordinateRing ⧸ P) := - (Ideal.Quotient.mk P).comp ((AdjoinRoot.of E.polynomial).comp C) - let x₀ := (Ideal.Quotient.mk P) (AdjoinRoot.mk E.polynomial (C X)) -@@ -178,8 +125,8 @@ private lemma nonsingular_at_maximal (E : Affine F) [E.IsElliptic] - exact Ideal.Quotient.eq_zero_iff_mem.mpr hmem) - - -- The mathlib `Algebra (Polynomial F) E.CoordinateRing` instance is `noncomputable`, so the ---- synthesizer cannot derive `Module` within `maxSynthPendingDepth = 3`. These explicit `Module`, ---- `Module.Finite`, and `Module.IsTorsionFree` instances let downstream synthesis find them. -+ -+ - noncomputable instance instModulePolynomialCoordinateRing (E : Affine F) : - Module (Polynomial F) E.CoordinateRing := - @Algebra.toModule _ _ _ _ (Affine.CoordinateRing.instAlgebraPolynomial) -@@ -190,7 +137,7 @@ noncomputable instance instModuleFinitePolynomialCoordinateRing (E : Affine F) : - - noncomputable instance instIsTorsionFreePolynomialCoordinateRing (E : Affine F) [E.IsElliptic] : - Module.IsTorsionFree (Polynomial F) E.CoordinateRing := -- @AdjoinRoot.noZeroSMulDivisors_of_prime_of_degree_ne_zero (Polynomial F) _ E.polynomial _ -+ @AdjoinRoot.isTorsionFree_of_prime_of_degree_ne_zero (Polynomial F) _ E.polynomial _ - (Irreducible.prime Affine.irreducible_polynomial) - (by rw [Affine.degree_polynomial]; exact two_ne_zero) - -@@ -455,11 +402,11 @@ private lemma isReduced_quotient_of_polyY_notMem (E : Affine F) [E.IsElliptic] - (P.comap (algebraMap (Polynomial F) E.CoordinateRing))) - rw [h_rad.radical] at h; exact h ▸ Ideal.radical_isRadical _ - rw [Ideal.isRadical_iff_quotient_reduced] -- haveI : (P.comap (algebraMap (Polynomial F) E.CoordinateRing)).IsMaximal := -+ have : (P.comap (algebraMap (Polynomial F) E.CoordinateRing)).IsMaximal := - Ideal.IsPrime.isMaximal (Ideal.IsPrime.comap _) hp_ne_bot - set p := P.comap (algebraMap (Polynomial F) E.CoordinateRing) with hp_def -- letI kfield : Field (F[X] ⧸ p) := Ideal.Quotient.field p -- haveI : IsDomain (F[X] ⧸ p) := kfield.isDomain -+ let kfield : Field (F[X] ⧸ p) := Ideal.Quotient.field p -+ have : IsDomain (F[X] ⧸ p) := kfield.isDomain - set φ : F[X] →+* (F[X] ⧸ p) := Ideal.Quotient.mk p with hφ_def - set Wbar := E.polynomial.map φ with hWbar_def - have hequiv := AdjoinRoot.quotAdjoinRootEquivQuotPolynomialQuot p E.polynomial -@@ -485,11 +432,11 @@ private theorem maximalIdeal_isPrincipal_case_polyY_notMem (E : Affine F) [E.IsE - (P : Ideal E.CoordinateRing) (hPbot : P ≠ ⊥) (hPmax : P.IsMaximal) - (hY : AdjoinRoot.mk E.polynomial E.polynomialY ∉ P) : - (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by -- letI := hPmax.isPrime -- haveI := IsLocalization.isNoetherianRing P.primeCompl (Localization.AtPrime P) inferInstance -+ let := hPmax.isPrime -+ have := IsLocalization.isNoetherianRing P.primeCompl (Localization.AtPrime P) inferInstance - set g := algebraMap (Polynomial F) E.CoordinateRing with hg_def - set p := P.comap g with hp_def -- haveI : Algebra.IsIntegral (Polynomial F) E.CoordinateRing := -+ have : Algebra.IsIntegral (Polynomial F) E.CoordinateRing := - Algebra.IsIntegral.of_finite (Polynomial F) E.CoordinateRing - suffices h : Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P = - Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) (Ideal.map g p) by -@@ -502,7 +449,7 @@ private theorem maximalIdeal_isPrincipal_case_polyY_notMem (E : Affine F) [E.IsE - have hg_inj : Function.Injective g := coordinateRing_algebraMap_injective E - have hp_ne_bot : p ≠ ⊥ := by - intro hp_bot; rw [hp_def] at hp_bot -- exact hPbot (eq_bot_of_comap_eq_bot hp_bot) -+ exact hPbot (eq_bot_of_under_eq_bot (R := Polynomial F) hp_bot) - have hJ_ne_top : J ≠ ⊤ := by - intro hJ_top - have : Ideal.map f P = ⊤ := -@@ -510,16 +457,16 @@ private theorem maximalIdeal_isPrincipal_case_polyY_notMem (E : Affine F) [E.IsE - rw [Localization.AtPrime.map_eq_maximalIdeal] at this - exact (IsLocalRing.maximalIdeal.isMaximal - (R := Localization.AtPrime P)).ne_top this -- haveI : Nontrivial (Localization.AtPrime P ⧸ J) := -+ have : Nontrivial (Localization.AtPrime P ⧸ J) := - Ideal.Quotient.nontrivial_iff.mpr hJ_ne_top -- haveI : IsLocalRing (Localization.AtPrime P ⧸ J) := -+ have : IsLocalRing (Localization.AtPrime P ⧸ J) := - IsLocalRing.of_surjective' (Ideal.Quotient.mk J) Ideal.Quotient.mk_surjective -- haveI : Ring.DimensionLEOne (Localization.AtPrime P) := -+ have : Ring.DimensionLEOne (Localization.AtPrime P) := - Ring.DimensionLEOne.localization (Localization.AtPrime P) - P.primeCompl_le_nonZeroDivisors -- haveI : Ring.KrullDimLE 0 (Localization.AtPrime P ⧸ J) := -+ have : Ring.KrullDimLE 0 (Localization.AtPrime P ⧸ J) := - krullDimLE_zero_quotient_of_polyY_notMem E P J g hg_inj p hp_ne_bot hJ_def -- haveI : IsReduced (Localization.AtPrime P ⧸ J) := -+ have : IsReduced (Localization.AtPrime P ⧸ J) := - isReduced_quotient_of_polyY_notMem E P J g hg_def p hp_def hp_ne_bot hY hJ_def - exact @Ring.KrullDimLE.isField_of_isReduced _ _ ‹_› ‹_› ‹_› - · -- `J ≤ P.map f` follows from `p.map g ≤ P` (`map_comap_le`). -@@ -584,8 +531,8 @@ private lemma YminusAlpha_sq_mem_of_char2_square (E : Affine F) [E.IsElliptic] - (h_cubic_factor : X ^ 3 + C E.a₂ * X ^ 2 + C E.a₄ * X + C E.a₆ - C δ = (X - C x₀) * w₃) - (hα : α ^ 2 = δ) : - (AdjoinRoot.mk E.polynomial (Y - C (C α))) ^ 2 ∈ P := by -- haveI hCharP_FX : CharP F[X] 2 := Polynomial.charP -- haveI hCharP_FXY : CharP F[X][Y] 2 := Polynomial.charP -+ have hCharP_FX : CharP F[X] 2 := Polynomial.charP -+ have hCharP_FXY : CharP F[X][Y] 2 := Polynomial.charP - have h_two_FX : (2 : F[X]) = 0 := by exact_mod_cast CharP.cast_eq_zero F[X] 2 - have h_two_FXY : (2 : F[X][Y]) = 0 := by exact_mod_cast CharP.cast_eq_zero F[X][Y] 2 - have h_step : (AdjoinRoot.mk E.polynomial (Y - C (C α))) ^ 2 = -@@ -649,7 +596,7 @@ private theorem maximalIdeal_isPrincipal_case_char2_ordinary_square (E : Affine - (h_cubic_factor : X ^ 3 + C E.a₂ * X ^ 2 + C E.a₄ * X + C E.a₆ - C δ = (X - C x₀) * w₃) - (hα : α ^ 2 = δ) : - (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by -- letI := hPmax.isPrime -+ let := hPmax.isPrime - -- `(x₀, α)` satisfies `E.Equation` (α² + (a₁x₀+a₃)α = δ = α²) and is smooth (`Δ ≠ 0`). - have h_eq : E.Equation x₀ α := by - rw [Affine.equation_iff] -@@ -674,7 +621,7 @@ private theorem maximalIdeal_isPrincipal_case_char2_ordinary_square (E : Affine - have h_P_eq : P = pointIdeal E x₀ α := - (Ideal.IsMaximal.eq_of_le (pointIdeal_isMaximal E h_ns) hPmax.ne_top h_pointIdeal_le).symm - subst h_P_eq -- haveI : IsDiscreteValuationRing (Localization.AtPrime (pointIdeal E x₀ α)) := -+ have : IsDiscreteValuationRing (Localization.AtPrime (pointIdeal E x₀ α)) := - HasseWeil.localRing_isDVR E h_ns - rw [Localization.AtPrime.map_eq_maximalIdeal] - exact IsDiscreteValuationRing.toIsPrincipalIdealRing.principal _ -@@ -931,10 +878,10 @@ private theorem maximalIdeal_isPrincipal_case_char2_ordinary_nonsquare - (hc_in_p : c ∈ P.comap (algebraMap (Polynomial F) E.CoordinateRing)) - (h_sq : ∀ α : F, α ^ 2 ≠ δ) : - (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by -- letI := hPmax.isPrime -- -- `f_quad = X² + C δ` is irreducible (δ not a square); build `proj = lift i_hom (root f_quad)`. -+ let := hPmax.isPrime -+ - set f_quad : Polynomial F := (Polynomial.X : Polynomial F) ^ 2 + Polynomial.C δ with hf_quad_def -- haveI hFact : Fact (Irreducible f_quad) := -+ have hFact : Fact (Irreducible f_quad) := - ⟨X_sq_add_C_irreducible_of_not_square δ h2 h_sq⟩ - set i_hom : F[X] →+* AdjoinRoot f_quad := - (AdjoinRoot.of f_quad).comp (Polynomial.evalRingHom x₀) with hi_hom_def -@@ -985,7 +932,7 @@ private lemma comap_eq_span_c_of_char2_ordinary (E : Affine F) [E.IsElliptic] - exact h_a1 h_coeff_1.symm - have hp_ne_bot : p ≠ ⊥ := fun hbot ↦ hc_ne_zero (by - rw [hbot, Ideal.mem_bot] at hc_in_p; exact hc_in_p) -- haveI : p.IsMaximal := Ring.DimensionLEOne.maximalOfPrime hp_ne_bot (Ideal.IsPrime.comap _) -+ have : p.IsMaximal := Ring.DimensionLEOne.maximalOfPrime hp_ne_bot (Ideal.IsPrime.comap _) - exact maximal_eq_span_of_mem_linear p (IsPrincipalIdealRing.principal p) c hc_ne_zero - (by rw [hc_def]; exact Polynomial.natDegree_linear h_a1) hc_in_p - -@@ -1032,9 +979,9 @@ private theorem maximalIdeal_isPrincipal_case_char2_ordinary (E : Affine F) [E.I - (h4 : (4 : F) = 0) (h_a1 : E.a₁ ≠ 0) - (hY : AdjoinRoot.mk E.polynomial E.polynomialY ∈ P) : - (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by -- letI := hPmax.isPrime -+ let := hPmax.isPrime - have h2 : (2 : F) = 0 := two_eq_zero_of_four_eq_zero h4 -- haveI hCharP : CharP F 2 := -+ have hCharP : CharP F 2 := - (CharP.charP_iff_prime_eq_zero Nat.prime_two).mpr h2 - -- `polyY = C c` with `c = a₁X + a₃`, so `c ∈ p`, and `p = span {c}`. - set c : F[X] := C E.a₁ * X + C E.a₃ with hc_def -@@ -1088,7 +1035,7 @@ private theorem polynomialY_notMem_of_char2_a1_eq_zero (E : Affine F) [E.IsEllip - have h2sq_eq : (2 : F) ^ 2 = 4 := by ring - rw [h2sq_eq]; exact h4 - exact pow_eq_zero_iff (by omega : 2 ≠ 0) |>.mp h2sq -- haveI hCharP : CharP F 2 := -+ have hCharP : CharP F 2 := - (CharP.charP_iff_prime_eq_zero Nat.prime_two).mpr h2 - have hΔ : E.Δ ≠ 0 := fun h ↦ not_isUnit_zero (h ▸ IsElliptic.isUnit (W := E)) - have ha3_ne : E.a₃ ≠ 0 := by -@@ -1256,14 +1203,14 @@ private theorem maximalIdeal_isPrincipal_case_charNe2 (E : Affine F) [E.IsEllipt - (hY : AdjoinRoot.mk E.polynomial E.polynomialY ∈ P) - (hX : AdjoinRoot.mk E.polynomial E.polynomialX ∉ P) : - (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by -- letI := hPmax.isPrime -+ let := hPmax.isPrime - set g := algebraMap (Polynomial F) E.CoordinateRing with hg_def - set p := P.comap g with hp_def - set f := algebraMap E.CoordinateRing (Localization.AtPrime P) with hf_def -- have hp_ne_bot : p ≠ ⊥ := fun hp_bot ↦ hPbot (eq_bot_of_comap_eq_bot hp_bot) -- haveI hp_maximal : p.IsMaximal := -+ have hp_ne_bot : p ≠ ⊥ := fun hp_bot ↦ hPbot (eq_bot_of_under_eq_bot (R := Polynomial F) hp_bot) -+ have hp_maximal : p.IsMaximal := - Ring.DimensionLEOne.maximalOfPrime hp_ne_bot (Ideal.IsPrime.comap _) -- haveI hp_principal : p.IsPrincipal := IsPrincipalIdealRing.principal p -+ have hp_principal : p.IsPrincipal := IsPrincipalIdealRing.principal p - have h2 : (2 : F) ≠ 0 := fun h2zero ↦ h4 (by - have : (4 : F) = 2 * 2 := by norm_num - rw [this, h2zero]; ring) -@@ -1302,15 +1249,15 @@ private theorem maximalIdeal_isPrincipal_case_charNe2 (E : Affine F) [E.IsEllipt - rw [map_eq_span_of_charNe2 E P π hY hmkCπ_in_span hP_le_span] - exact ⟨⟨_, rfl⟩⟩ - ---- Reduces to a clean case-dispatch over the closed-point geometry: each branch is a leaf lemma -+ - -- above (`..._case_polyY_notMem`, char-2 supersingular/ordinary, char-≠2 Jacobian). - private theorem maximalIdeal_isPrincipal_of_nonsingular (E : Affine F) [E.IsElliptic] - (P : Ideal E.CoordinateRing) (_ : P ≠ ⊥) (hPmax : P.IsMaximal) : - (IsLocalRing.maximalIdeal (Localization.AtPrime P)).IsPrincipal := by -- letI := hPmax.isPrime -+ let := hPmax.isPrime - -- The maximal ideal `m = P.map f` (`f = algebraMap R R_P`); reduce to principality of `P.map f`. - rw [← Localization.AtPrime.map_eq_maximalIdeal] -- -- Dispatch on the closed-point geometry. Each leaf lemma handles one configuration. -+ - by_cases hY : AdjoinRoot.mk E.polynomial E.polynomialY ∉ P - · -- `mk(polynomialY) ∉ P`: the squarefree-quotient leaf lemma. - exact maximalIdeal_isPrincipal_case_polyY_notMem E P ‹P ≠ ⊥› hPmax hY -@@ -1325,21 +1272,21 @@ private theorem maximalIdeal_isPrincipal_of_nonsingular (E : Affine F) [E.IsElli - · -- Char ≠ 2: Jacobian factorisation of the Y-discriminant. - exact maximalIdeal_isPrincipal_case_charNe2 E P ‹P ≠ ⊥› hPmax h4 hY hX - --/-- The coordinate ring of an elliptic curve is integrally closed in its fraction field. -/ -+ - instance coordinateRing_isIntegrallyClosed (E : Affine F) [E.IsElliptic] : - IsIntegrallyClosed E.CoordinateRing := by - apply IsIntegrallyClosed.of_localization_maximal - intro P hP0 hPmax -- haveI := IsLocalization.isNoetherianRing P.primeCompl (Localization.AtPrime P) inferInstance -- haveI : Ring.DimensionLEOne (Localization.AtPrime P) := -+ have := IsLocalization.isNoetherianRing P.primeCompl (Localization.AtPrime P) inferInstance -+ have : Ring.DimensionLEOne (Localization.AtPrime P) := - Ring.DimensionLEOne.localization (Localization.AtPrime P) P.primeCompl_le_nonZeroDivisors -- haveI : IsPrincipalIdealRing (Localization.AtPrime P) := -+ have : IsPrincipalIdealRing (Localization.AtPrime P) := - ((tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain - (Localization.AtPrime P)).out 5 1).mp - (maximalIdeal_isPrincipal_of_nonsingular E P hP0 hPmax) - exact UniqueFactorizationMonoid.instIsIntegrallyClosed - ---- Typeclass synthesis over the tower F[X] → CoordinateRing → FunctionField needs more budget. -+ - noncomputable instance coordinateRing_isIntegralClosure (E : Affine F) [E.IsElliptic] : - IsIntegralClosure E.CoordinateRing (Polynomial F) E.FunctionField where - algebraMap_injective _ _ h := -@@ -1385,24 +1332,24 @@ private theorem root_aeval_polynomial_map (E : Affine F) [E.IsElliptic] : - simp [IsScalarTower.algebraMap_apply (Polynomial F) E.CoordinateRing E.FunctionField] } - - -- The separability proof reasons over two cases via finSepDegree; typeclass ---- synthesis for the tower through FractionRing F[X] needs more budget. -+ - noncomputable instance functionField_isSeparable (E : Affine F) [E.IsElliptic] : - Algebra.IsSeparable (FractionRing (Polynomial F)) E.FunctionField := by - set K := FractionRing (Polynomial F) - -- `finSepDegree K L ∣ finrank K L = 2` and `≠ 1` (as `y` is separable), so it equals `finrank`. - have h_dvd := Field.finSepDegree_dvd_finrank K E.FunctionField -- haveI : FiniteDimensional K E.FunctionField := functionField_finiteDimensional E -+ have : FiniteDimensional K E.FunctionField := functionField_finiteDimensional E - have h_fr : Module.finrank K E.FunctionField = 2 := by -- haveI : Algebra.IsAlgebraic (Polynomial F) E.CoordinateRing := -+ have : Algebra.IsAlgebraic (Polynomial F) E.CoordinateRing := - (Algebra.IsIntegral.of_finite (Polynomial F) E.CoordinateRing).isAlgebraic - change Module.finrank (FractionRing (Polynomial F)) E.FunctionField = 2 -- rw [Algebra.IsAlgebraic.finrank_of_isFractionRing (Polynomial F) -+ rw [IsFractionRing.finrank_eq (Polynomial F) - (FractionRing (Polynomial F)) E.CoordinateRing E.FunctionField, - Module.finrank_eq_card_basis (Affine.CoordinateRing.basis E), Fintype.card_fin] - rw [h_fr] at h_dvd - have h_not_1 : Field.finSepDegree K E.FunctionField ≠ 1 := by - intro h1 -- haveI := isPurelyInseparable_of_finSepDegree_eq_one h1 -+ have := isPurelyInseparable_of_finSepDegree_eq_one h1 - set y : E.FunctionField := - algebraMap E.CoordinateRing E.FunctionField (AdjoinRoot.root E.polynomial) - have hy_int : IsIntegral K y := IsIntegral.of_finite _ _ -@@ -1446,8 +1393,7 @@ instance coordinateRing_isDedekindDomain (E : Affine F) [E.IsElliptic] : - IsIntegralClosure.isDedekindDomain (Polynomial F) (FractionRing (Polynomial F)) - E.FunctionField E.CoordinateRing - --/-- The coordinate ring of an elliptic curve is integrally closed (consequence of being --a Dedekind domain). -/ -+ - instance isIntegrallyClosed_coordinateRing (E : Affine F) [E.IsElliptic] : - IsIntegrallyClosed E.CoordinateRing := - inferInstance -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Valuation.lean b/projects/HasseWeil/HasseWeil/Foundation/Valuation.lean -index 7750f062d..5ec611dcc 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Valuation.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Valuation.lean -@@ -239,7 +239,7 @@ theorem localRing_isDVR {x₀ y₀ : F} (h : W.Nonsingular x₀ y₀) : - let P := pointIdeal W x₀ y₀ - haveI : P.IsPrime := (pointIdeal_isMaximal W h).isPrime - IsDiscreteValuationRing (Localization.AtPrime P) := by -- intro P; letI : P.IsPrime := (pointIdeal_isMaximal W h).isPrime -+ intro P; let : P.IsPrime := (pointIdeal_isMaximal W h).isPrime - let f := algebraMap W.CoordinateRing (Localization.AtPrime P) - -- Nonsingularity: WLOG polynomialY.evalEval x₀ y₀ ≠ 0 - -- (The other case swaps X↔Y roles; we handle the Y case.) -@@ -274,7 +274,7 @@ theorem localRing_isDVR {x₀ y₀ : F} (h : W.Nonsingular x₀ y₀) : - (M := P.primeCompl) _ P.primeCompl_le_nonZeroDivisors)] at hbot - exact (Affine.CoordinateRing.XClass_ne_zero (W' := W) (x := x₀)) - (eq_bot_iff.mp hbot (subset_span (Set.mem_insert _ _))) -- haveI : IsPrincipalIdealRing (Localization.AtPrime P) := -+ have : IsPrincipalIdealRing (Localization.AtPrime P) := - ((tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain - (Localization.AtPrime P)).out 5 1).mp hprincipal - exact ⟨hne⟩ -@@ -306,7 +306,7 @@ theorem localRing_isDVR {x₀ y₀ : F} (h : W.Nonsingular x₀ y₀) : - (M := P.primeCompl) _ P.primeCompl_le_nonZeroDivisors)] at hbot - exact (Affine.CoordinateRing.XClass_ne_zero (W' := W) (x := x₀)) - (eq_bot_iff.mp hbot (subset_span (Set.mem_insert _ _))) -- haveI : IsPrincipalIdealRing (Localization.AtPrime P) := -+ have : IsPrincipalIdealRing (Localization.AtPrime P) := - ((tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain - (Localization.AtPrime P)).out 5 1).mp hprincipal - exact ⟨hne⟩ -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/Genuine.lean b/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/Genuine.lean -index 16c9844e05e8a3a4e84977c4344686797b691a85..cdf52885c82d916e7b1c8e267acd875b4c7fe0ab 100644 -GIT binary patch -delta 6150 -zcma)Ae~c7o8P42M3e$opJt$z?uLb3f-tBRu5kp%Q3WW2l0$wRdC^I|z?e14*XZB`h -zx!d~3wp1(H)*npb5)+#y))W0Rj;;;kBRMKHuNjfQ!*4~Kd8x)C4wZh8wB6s~kI0zGs^ARVm7LO}WkZ%f=lo;rLz{1q~;{N{vwA -z+hMa-lTpwVei={wprkxIlA_*l-Jao0-;z`QI!@1q$*01_XC|So_R8)y#pE9$^%k}X)b$hlGzmh{=!%*$5*CvNre$MkMfBn)yz24L#H5Sqfpo-3J&zlr)4Tl -zys%MA0n0xoL`w~48+cqy0Qe`kfW%TRB<^`GLSMg^R5>AtF5^nc -zWKhQ6ecwItiO1K+{)b*)b2RY%a$(o5&an?)GH1}0kvM%&I;uqcKeQm`&LCcMdTL5M -z;!3n6YFLugy^sVy2s`i0zPx7BV>+=MW=iGpCiMb{q(W*MvF?7s>(o`AQ0Dh -z5F4RW6^mdQ?FYj2%N%4dt(OWkRm)1ch_7Z>z-K#tzx#f-(&*5MIhtkVlmoIA72ivPNJ7pt>w0NWK%Z)D6l_1H^8fWCuo=yZAo$gtH} -zFHAwV>i!}SVu?1brL*Xg1mULsKR)2_xt8U14Ri#{1?70<(-&?%N1FR67?P6}^ND9JZH|AqZcV)Vi_`IoFMO->o6o#xbi(KS(Y2<4z>*TgKldbuTIKJtFn9NN_HTYfp=Z1@N{I -z0k}X~PkNdlHKoaxvKmN-K4Z!BBV9zTS}0Z@I{c7}f9+|ikSArH8(*Sa6s(hGhw5ZcoS9w)*)<+ef&nH%Ao-hoUd@w!fJeuLrPBpWt3=Xx`}M9 -zMg7|hej^8goHJV11L;UAHHivV*9S#11b&&lNZ5kQP1*~^J?|?zLkU|rDsUREjqz2l -zOFgv+)?9Vc7QI(&-@aWOmoUX_H2_Qzhb7dtR>R0ZG!bu~YN#f3wCF<_l-IfISKk|n -zugz}j{QTE{+Suw_hJq#+PRAkIJa446tY{Jl8brbxKY12!PoAQ`CoB=7XkocY>Ci%t -zONC(%nGZu&V?LCa7QYR>e;IU~6k9WT@>=-(75*F%#9#W`rgu%Ji_>6kn(eO~FgEVc -zwoTV5IZ^=NG+jQigzab68=D?AUEcwgbUMWW9j(lorE3!eGOW{S3Gvqbkk2Jknn4MY -zy+bgLv{TdZo3mS6q_Z`BqD_^$nLBPwl2uMu1Ae@o7PRzJ9n(}VCcS4BjgIzT26@7; -zaYo`yLT3Nx(w -zi>PqIGQhDj6oWWZHt9-Q8g$W4tppm6j1_R>qldm0fbwF+Y^GGCPZuumSJ_2D{MOs| -zwx>@Tx3!-zjSZd4?~JV4NQKssW!D+)ua6p+2#Jr*CuApGL2qFHDdn+0MdVN~x{*MO -zF`a#3eS!?gvJ%mVlI{IRa4$sQ>05>goh$AGuy*cV#SS8vSRBSnc4SkNndfb{!BU4* -zaY=%llv5D<$%E0p)^2VH5Ja53e&JbIU}>YjVacEuJqrb;G|ldxZ#Nz=4C|{~jIsFI -ze>QYy*Bf)AvHi|_yWfAeaqH^#8=H-9uY^d~z0-&$GI9{TZypkx{43)`n&+EGJZ7?U;*Gb8(yOS!CZa49fMZjuHdQoM1-xTSmRVdM6ZZAfs1 -zN}}kxk{i4B5u-NR{q3CL81YYz-nojH(thJnV=J5-hLwv8D%|{eWDU}3WR8DQxgZY& -zIK5v23l3vA4dE7hy=5Tb^n+Z?!7DiGI2tMU_j+z<3e+cyn4nqnZ|z<@ZG6fYNpjdW -zG>3v2KQl4b23yv)AAG{NXZURc5oGW}Ne9Fz(f}eNmSB2qmG@pdE+&~ 1` — Silverman III.6.2 step -- --The substantive content is the **Frobenius factorisation** of `[p^k]`: --`[p^k] = π_{p^k} ∘ V_{p^k}` on the curve, pulled back to --`[p^k]^* = V_{p^k}^* ∘ π_{p^k}^*` on the function field, where --`π_{p^k}^* x = x^{p^k}`. This forces `[p^k]^* x = (V_{p^k}^* x)^{p^k}`, --i.e., `[p^k]^* x` is a `p^k`-th power in `K(E)`. Equivalently --`Φ_{p^k}, Ψ_{p^k}² ∈ R[X^{p^k}]`. -- --### Polynomial-side recurrence approach (Worker C's stream) -- --The polynomial-side argument avoids constructing `V_{p^k}`. The chain: --1. Base case `k = 1`: `Φ_p, Ψ_p² ∈ R[X^p]` — shipped (`Φ_two_mem_expand_two_charP`, -- `Φ_three_mem_expand_three_charP`, etc.) for `p = 2, 3`. --2. Sub-step (function-field level): `[p^k]^* x ∈ R(x^{p^k})` — derivable -- inductively from base + ring-hom properties of `[p]^*`. --3. Polynomial extraction: from `[p^k]^* x = Φ_{p^k}/Ψ_{p^k}² ∈ R(x^{p^k})`, -- conclude `Φ_{p^k}, Ψ_{p^k}² ∈ R[X^{p^k}]`. -- --Step 3 requires **coprimality of `Φ_{p^k}` and `Ψ_{p^k}²`** as polynomials --in `R[X]`. Mathlib provides this for the curve case via --`WeierstrassCurve.Φ.coprime_ΨSq` or analogous (Silverman III.6 background). --Step 2 is reasonable to formalise from the base case via induction on `k`. -- --### The missing recurrence -- --Direct propagation `Φ_{p^k} → Φ_{p^{k+1}}` via division-polynomial recurrence --needs the **multiplication-by-p formula**: --`preΨ (p · m) = F(preΨ_{m-?}, ..., preΨ_{m+?})` for prime `p` and any `m`. -- --Mathlib provides the **doubling+adding-one** recurrences: --* `WeierstrassCurve.preΨ_even (m) : preΨ (2m) = ...` --* `WeierstrassCurve.preΨ_odd (m) : preΨ (2m+1) = ...` -- --For `p = 2`, `2m` is `p · m`, so the doubling formula is the multiplication-by-2 --recurrence directly. For `p ≥ 3`, multiplication-by-`p` is **not** doubling --and requires a derived formula. The classical derivation iterates the --doubling+add-one chain `p` times, but the resulting polynomial identity is --sympy-territory complexity for each odd prime. -- --The general formula is in Silverman §III.6 / Sutherland Lecture 6 (modern --treatment) but is not in mathlib. Shipping it for arbitrary prime `p` --requires either: --* A general recurrence proof from `preΨ_even`/`preΨ_odd` via induction -- on the binary expansion of `p · m` (~200 LOC of polynomial manipulation -- + sympy-verified per-prime multipliers). --* A direct port of the bivariate recurrence `Ψ_{m+n} Ψ_{m-n} = ...` -- (Silverman Exercise 3.7) — ~50 LOC of polynomial identities, then derive -- multiplication-by-`p` as `m + (p-1)·m`. -- --### What's shipped here -- --The polynomial-side propagation building blocks are in place: --* `pow_mem_expand_charP`, `pow_pow_mem_expand_pow_charP` — `f^(p^n) ∈ expand`-range. --* `pow_pow_mem_expand_pow_succ_of_expand_charP` — `f ∈ expand p` → -- `f^(p^k) ∈ expand (p^(k+1))`. Used in the inductive step's -- Frobenius-cycle argument. --* `expand_pow_map_iterateFrobenius` — equational form -- `expand (p^n) (f.map iterateFrobenius) = f^(p^n)`. -- --The next concrete sub-piece (deferred to the multiplication-by-p recurrence --port): the full propagation theorem --`Φ_p_pow_mul_p_mem_expand_charP : Φ_{p^k} ∈ expand (p^k) → Φ_{p^{k+1}} ∈ expand (p^{k+1})`. -/ -+/-! ### Propagation to powers of the characteristic -+ -+The Frobenius factorization of multiplication by `p^k` implies that the -+pulled-back coordinates are `p^k`-th powers. On the polynomial side this -+corresponds to membership of the coprime division-polynomial numerator and -+denominator in `R[X^(p^k)]`. Powers and iterated Frobenius give the expansion -+identities used to propagate this membership. -+-/ - - - end GenericExpand -diff --git a/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/UniversalQthRootWitness.lean b/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/UniversalQthRootWitness.lean -index c7790ab47..43c07c0ea 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/UniversalQthRootWitness.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/UniversalQthRootWitness.lean -@@ -8,50 +8,26 @@ import HasseWeil.Foundation.Verschiebung.VerschiebungIsDualOfFrobenius - import HasseWeil.Foundation.Verschiebung.Route2Universal - - /-! --# The universal q-th-root witness (general characteristic) — Route B -- --This file discharges, for an arbitrary finite field `K` (`q = #K = p^k`, --`p = char K`), the **universal q-th-root witness** -- --``` --h_qth_root : ∀ z, ∃ g, g ^ q = [q]* z --``` -- --(`[q]*` the pullback of the multiplication-by-q isogeny on `K(E)`), and feeds --it through the proven reducer `verschiebungIsog_isDualOf_frobenius_of_qth_root_witness` --to obtain `verschiebung_isDualOf_frobenius_general` — the GAP-QF keystone. -- --## Strategy (uniform in `p`, no per-prime polynomial witnesses) -- --The keystone reduces (via `mulByInt_q_pullback_fieldRange_subset_frobenius_of_xy_witness` --and `functionField_eq_intermediateField_adjoin_xy`) to two generator facts: -- --* `[q]* x_gen ∈ R` and `[q]* y_gen ∈ R`, where `R = (frobeniusIsog W).pullback.range = K(E)^q`. -- --Both are obtained from the **Kähler differential** kernel theorem --`kaehlerD_eq_zero_iff_mem_pth_powers` (`ker D = K(E)^p`, char `p`) and the --**separability** of `K(E)/K(x_gen)` (`functionField_isSeparable`), with no --characteristic-specific polynomial computation: -- --* **x-side base** `[p]* x_gen ∈ adjoin K {x_gen^p}`: `[p]* x_gen` is rational in -- `x_gen` (so lies in `K(x_gen)`) and has `D([p]* x_gen) = 0` -- (`D_mulByInt_p_pullback_x_gen_eq_zero`), hence is a `p`-th power `g^p` with -- `g ∈ K(E)`; since `K(E)/K(x_gen)` is separable, the purely-inseparable element -- `g` lies in `K(x_gen)`, so `[p]* x_gen = g^p ∈ adjoin K {x_gen^p}`. The -- existing induction `mulByInt_pow_pullback_x_gen_mem_adjoin_pow_of_base`-style -- bootstrap (re-derived here taking the Kähler base) lifts this to -- `[q]* x_gen ∈ adjoin K {x_gen^q} ⊆ R`. --* **y-side** `[q]* y_gen ∈ R`: `y_gen` satisfies the separable Weierstrass -- quadratic over `K(x_gen)`; applying `[q]*` gives that `[q]* y_gen` is a root of -- a **separable** quadratic over `R` (its discriminant is `([q]*(2y+a₁x+a₃))² ≠ 0`, -- using injectivity of `[q]*` and `2y+a₁x+a₃ ≠ 0`), with coefficients in `R` -- (because `[q]* x_gen ∈ R`). So `[q]* y_gen` is separable over `R`; as `K(E)/R` -- is purely inseparable (`frobeniusIsog_intermediateField_isPurelyInseparable`), -- `[q]* y_gen ∈ R`. -+# Universal `q`-th roots of multiplication pullbacks -+ -+For a finite field `K` of cardinality `q = p^k`, every multiplication pullback -+`[q]* z` on `K(E)` is a `q`-th power. The resulting image inclusion in Frobenius -+pullback constructs the dual of Frobenius. -+ -+It suffices to show that `[q]* x` and `[q]* y` lie in the Frobenius image -+`R = K(E)^q`. The Kähler differential of `[p]* x` vanishes, so it is a `p`-th -+power `g^p`. Since `K(E)/K(x)` is separable and `[p]* x ∈ K(x)`, the purely -+inseparable element `g` lies in `K(x)`. Induction gives -+`[q]* x ∈ K(x^q) ⊆ R`. -+ -+The Weierstrass equation then makes `[q]* y` separable over `R`: the pulled-back -+quadratic has nonzero derivative at `[q]* y`, since `[q]*` is injective and -+`2y + a₁x + a₃ ≠ 0`. As `K(E)/R` is purely inseparable, `[q]* y` belongs to `R`. -+The argument applies in every characteristic. - - ## References - --* Silverman, *The Arithmetic of Elliptic Curves*, II.2.12, III.5.5, III.6.2. -+* Silverman, *The Arithmetic of Elliptic Curves*, II.2.12, III.5.5, and III.6.2. - -/ - - open WeierstrassCurve -@@ -71,10 +47,10 @@ omit [Fintype K] [DecidableEq K] in - theorem mem_fractionRing_range_of_pow_mem (p : ℕ) [Fact p.Prime] [CharP K p] - (g : KE) (hg : g ^ p ∈ (algebraMap Mff KE).range) : - g ∈ (algebraMap Mff KE).range := by -- haveI : Algebra.IsSeparable Mff KE := functionField_isSeparable W.toAffine -- haveI : CharP (Polynomial K) p := inferInstance -- haveI : CharP Mff p := inferInstance -- haveI : ExpChar Mff p := ExpChar.prime Fact.out -+ have : Algebra.IsSeparable Mff KE := functionField_isSeparable W.toAffine -+ have : CharP (Polynomial K) p := inferInstance -+ have : CharP Mff p := inferInstance -+ have : ExpChar Mff p := ExpChar.prime Fact.out - have hsep : IsSeparable Mff g := Algebra.IsSeparable.isSeparable Mff g - have hsd1 : (minpoly Mff g).natSepDegree = 1 := by - rw [minpoly.natSepDegree_eq_one_iff_pow_mem p] -@@ -93,7 +69,7 @@ the scalar-tower factoring of the structure map through `M = FractionRing K[X]`. - theorem algebraMap_polynomial_eq_fractionRing (q : Polynomial K) : - algebraMap (Polynomial K) KE q = - algebraMap Mff KE (algebraMap (Polynomial K) Mff q) := by -- haveI : IsScalarTower (Polynomial K) Mff KE := functionField_isScalarTower W.toAffine -+ have : IsScalarTower (Polynomial K) Mff KE := functionField_isScalarTower W.toAffine - rw [← IsScalarTower.algebraMap_apply] - - omit [Fintype K] [DecidableEq K] in -@@ -158,7 +134,7 @@ theorem mulByInt_p_pullback_x_gen_mem_adjoin_pow_routeB - (p : ℕ) [Fact p.Prime] [CharP K p] : - (mulByInt W.toAffine (p : ℤ)).pullback (x_gen W) ∈ - IntermediateField.adjoin K ({x_gen W ^ p} : Set KE) := by -- haveI : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p -+ have : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p - have hp_ne : (p : ℤ) ≠ 0 := by exact_mod_cast (Fact.out : p.Prime).pos.ne' - have hD := D_mulByInt_p_pullback_x_gen_eq_zero W p - obtain ⟨g, hg⟩ := (kaehlerD_eq_zero_iff_mem_pth_powers W p _).mp hD -@@ -175,8 +151,8 @@ theorem mulByInt_p_pullback_x_gen_mem_adjoin_pow_routeB - exact adjoin_simple_pow_le_adjoin_simple_pow p (x_gen W) g hg_mem - - omit [Fintype K] in --/-- `[p ^ (k+1)]` factors as `[p ^ k] ∘ [p]` (shared scaffolding for the x- and --y-side `p^k`-power inductions). -/ -+/-- `[p ^ (k+1)]` factors as `[p ^ k] ∘ [p]` (the common composition identity in the x- and -+y-coordinate `p^k`-power inductions). -/ - private theorem mulByInt_pow_succ_comp (p : ℕ) [Fact p.Prime] (k : ℕ) : - mulByInt W.toAffine ((p ^ (k + 1) : ℕ) : ℤ) = - (mulByInt W.toAffine ((p ^ k : ℕ) : ℤ)).comp -@@ -195,7 +171,7 @@ theorem mulByInt_pow_pullback_x_gen_mem_adjoin_pow_routeB - (p : ℕ) [Fact p.Prime] [CharP K p] : - ∀ k, (mulByInt W.toAffine ((p ^ k : ℕ) : ℤ)).pullback (x_gen W) ∈ - IntermediateField.adjoin K ({x_gen W ^ (p ^ k : ℕ)} : Set KE) := by -- haveI : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p -+ have : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p - intro k - induction k with - | zero => exact mulByInt_pow_zero_pullback_x_gen_mem_adjoin_pow W p -@@ -355,7 +331,7 @@ theorem mulByInt_p_pullback_y_gen_mem_adjoin_pair_pow - (p : ℕ) [Fact p.Prime] [CharP K p] : - (mulByInt W.toAffine (p : ℤ)).pullback (y_gen W) ∈ - IntermediateField.adjoin K ({x_gen W ^ p, y_gen W ^ p} : Set KE) := by -- haveI : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p -+ have : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p - obtain ⟨h, hh⟩ := (kaehlerD_eq_zero_iff_mem_pth_powers W p _).mp - (D_mulByInt_p_pullback_y_gen_eq_zero W p) - have hh_mem : h ∈ IntermediateField.adjoin K ({x_gen W, y_gen W} : Set KE) := by -@@ -369,7 +345,7 @@ theorem mulByInt_pow_pullback_y_gen_mem_adjoin_pair_pow - (p : ℕ) [Fact p.Prime] [CharP K p] : - ∀ k, (mulByInt W.toAffine ((p ^ k : ℕ) : ℤ)).pullback (y_gen W) ∈ - IntermediateField.adjoin K ({x_gen W ^ (p ^ k : ℕ), y_gen W ^ (p ^ k : ℕ)} : Set KE) := by -- haveI : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p -+ have : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p - intro k - induction k with - | zero => -@@ -450,8 +426,8 @@ theorem qth_root_witness_general : - g ^ Fintype.card K = - (mulByInt W.toAffine ((Fintype.card K : ℕ) : ℤ)).pullback z := by - obtain ⟨p, hCharP, ⟨n, _⟩, hp_prime, _⟩ := FiniteField.card' K -- haveI : Fact p.Prime := ⟨hp_prime⟩ -- haveI := hCharP -+ have : Fact p.Prime := ⟨hp_prime⟩ -+ have := hCharP - exact qth_root_witness_of_charP W p - - /-- **The GAP-QF keystone (general characteristic)**: the Verschiebung is the dual of -diff --git a/projects/HasseWeil/HasseWeil/Foundation/WallA/VSideDual.lean b/projects/HasseWeil/HasseWeil/Foundation/WallA/VSideDual.lean -index e5247f095..049bee4e1 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/WallA/VSideDual.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/WallA/VSideDual.lean -@@ -8,47 +8,16 @@ import HasseWeil.HasseBound.SumTrace - import HasseWeil.Foundation.Verschiebung.Genuine - - /-! --# Wall A — the V-side dual route to the signed III.6.3 degree identity -- --This file assembles the **V-side genuine isogeny** `β_dual = r·V − s` (built on the --Verschiebung `V`, mirroring the π-side genuine `β = r·π − s`) into the pivot-chain scaffold --shipped in `HasseWeil.GapSpines`, in order to drive -- -- `deg(r·π − s) = q·r² − t·r·s + s²` (the Wall-A keystone; its unconditional sorried form -- `genuineIsogSmulSub_degree_eq_signed` was retired 2026-06-11 — the witness-parametric -- `genuineIsogSmulSub_degree_eq_signed_via_walls` is the shipped form). -- --## What is proved here, unconditionally -- --* `isogeny_isGenuineWith_pointMap` — **any** isogeny `φ` is `IsGenuineWith` the geometric action -- `Affine.Point.map φ.pullback` on `(W_KE).Point`. This is the clean, general form of the -- "the pullback is the comorphism of a geometric map" non-vacuity check (`map_some`). --* `betaDualV` — the V-side genuine isogeny `r·V − s`, constructed via the genuine-sum combinator -- `addIsog` applied to the Verschiebung (so **`addIsog` does generalise to `V`** — the V-side -- pole/injectivity bricks already live in `Verschiebung/Genuine.lean`). --* `betaDualV_toAddMonoidHom_sub` — the point-map of `betaDualV` is `r·V − s·id` -- (`h_beta_dual_hom`), using `V.toAddMonoidHom = [q]` (`verschiebungIsog_of_witness`). --* `betaDualV_isDual_pi` — `IsDualOf V π` (`h_isDual_V_pi`), from `verschiebung_dual_exists`'s -- underlying witness. --* `genuineIsogSmulSub_degree_eq_signed_closed` — the **closing lemma**: it constructs `V` and -- `β_dual = r·V − s` internally, discharges `h_isDual_V_pi`, `h_beta_dual_hom`, `h_beta_pos`, and -- reduces the Wall-A keystone to exactly the three *standing dual residuals* (the genuine III.6.1 / -- III.6.2 content the project has not yet shipped unconditionally): -- -- 1. `h_sum_trace` : `π + V = [t]` (the trace relation, Silverman III.6.2(b); itself the -- output of `sum_trace_frobenius_witness` modulo `IsDualOf (1−V) (1−π)`); -- 2. `h_pullback_eq`: the full-isogeny **comorphism** identity `(β_dual ∘ β)* = [N]*` (the -- "double-Vieta" pullback match — the geometrically irreducible content); -- 3. `h_isDual_pair`: `IsDualOf β_dual β` (Silverman III.6.1 for the genuine pair). -- -- Everything else is internal; this is the honest reduction of Wall A to the standing dual -- residuals, composed through `genuineIsogSmulSub_degree_eq_signed_of_full_pivot_chain`. -- --The unconditional statement (the former bare-`sorry` --`GapSpines.genuineIsogSmulSub_degree_eq_signed`, deleted 2026-06-11 with the legacy skeleton --chain) would require the three residuals above unconditionally (the project has not --shipped `IsDualOf (1−V) (1−π)` nor the double-Vieta pullback identity); this --witness-parametric closing lemma is the live form. -+# Verschiebung and the signed degree identity -+ -+Let `π` be Frobenius, `V` its dual, and `t` its trace. The isogeny `r V - s` -+provides the dual candidate for `r π - s`. Their point maps, a trace relation, -+a composition pullback identity, and a duality witness imply the signed degree -+formula `deg(r π - s) = q r² - t r s + s²`, under the stated nonvanishing hypotheses. -+ -+The trace, pullback, and duality identities remain explicit mathematical inputs. -+The construction also identifies the geometric action associated with any isogeny -+pullback at the generic point. - - ## References - -@@ -64,14 +33,11 @@ namespace WallA - variable {K : Type*} [Field K] [Fintype K] [DecidableEq K] - variable (W : WeierstrassCurve K) [W.toAffine.IsElliptic] [Fintype W.toAffine.Point] - --/-! ### A general genuineness witness: any isogeny is genuine with `map pullback` -+/-! ### Geometric action of an isogeny pullback - --`IsGenuineWith φ g` (`GapSpines`) only constrains the geometric action `g` at the generic point --`P_gen = (x_gen, y_gen)`: it asks `g P_gen = some (φ.pullback x_gen) (φ.pullback y_gen)`. For the --**canonical** action `Affine.Point.map (W' := W) φ.pullback` this is exactly `Affine.Point.map_some` --applied to `genericPoint = some x_gen y_gen _`. So genuineness with the canonical action holds for --*every* isogeny, with no hypotheses — this is the clean non-vacuity form (it confirms `IsGenuine` --is satisfied by any genuine geometric isogeny, the pullback being its comorphism). -/ -+For the canonical action `Affine.Point.map φ.pullback`, evaluation at the generic -+point is `some (φ* x) (φ* y)`. This supplies `IsGenuineWith` for every isogeny. -+-/ - omit [Fintype K] [Fintype W.toAffine.Point] in - theorem isogeny_isGenuineWith_pointMap (φ : Isogeny W.toAffine W.toAffine) : - IsGenuineWith W φ (WeierstrassCurve.Affine.Point.map (W' := W) φ.pullback) := by -@@ -86,14 +52,14 @@ omit [Fintype K] [Fintype W.toAffine.Point] in - theorem isogeny_isGenuine (φ : Isogeny W.toAffine W.toAffine) : IsGenuine W φ := - ⟨_, isogeny_isGenuineWith_pointMap W φ⟩ - --/-! ### The Verschiebung as a concrete `V` with `IsDualOf V π` -+/-! ### Verschiebung duality - --We pin a single concrete Verschiebung witness, `verschiebungV`, from the connected (axiom-clean --modulo the upstream `[q] = V ∘ π` factorisation) inclusion `mulByInt_q_pullback_subset_frobenius`. --Its `IsDualOf V π` is `verschiebung_dual_exists`'s underlying witness, and its point map is the --`[q]`-point map (`verschiebungIsog_of_witness.toAddMonoidHom = (mulByInt q).toAddMonoidHom`). -/ -+The image inclusion `Im([q]*) ⊆ Im(π*)` constructs a Verschiebung `V` dual to -+Frobenius. On rational points over the finite field, Frobenius is the identity, -+so the point map of `V` is multiplication by `q`. -+-/ - --/-- The inclusion `Im([q]*) ⊆ Im(π*)` (Silverman II.2.11/III.6.2), the connected witness. -/ -+/-- The image inclusion `Im([q]*) ⊆ Im(π*)`. See Silverman II.2.11 and III.6.2. -/ - noncomputable abbrev hSubset (hq : 2 ≤ Fintype.card K) : - (mulByInt W.toAffine ((Fintype.card K : ℕ) : ℤ)).pullback.range ≤ - (frobeniusIsog W).pullback.range := -@@ -104,11 +70,13 @@ noncomputable def verschiebungV (hq : 2 ≤ Fintype.card K) : - Isogeny W.toAffine W.toAffine := - verschiebungIsog_of_witness W (hSubset W hq) - --/-- `IsDualOf V π` for the concrete Verschiebung (`h_isDual_V_pi`, Silverman III.6.1 Case 2). -/ -+omit [Fintype W.toAffine.Point] in -+/-- The concrete Verschiebung is dual to Frobenius. See Silverman III.6.1. -/ - theorem verschiebungV_isDual (hq : 2 ≤ Fintype.card K) : - IsDualOf W.toAffine (verschiebungV W hq) (frobeniusIsog W) := - verschiebungIsog_of_witness_isDualOf_frobenius W (hSubset W hq) - -+omit [Fintype W.toAffine.Point] in - /-- The point map of the concrete Verschiebung is the `[q]`-point map (`= q • ·`). Frobenius on - `F_q`-rational points is the identity, so the dual `V` (`V ∘ π = [q]`) must carry the `[q]`-point - map. -/ -@@ -117,12 +85,12 @@ map. -/ - (mulByInt W.toAffine ((Fintype.card K : ℕ) : ℤ)).toAddMonoidHom := - rfl - --/-! ### The V-side genuine isogeny `β_dual = r·V − s` -+/-! ### The isogeny `r V - s` - --This is `addIsog` of the genuine pair `(V.zsmul r, [−s])` — the **exact mirror** of the π-side --`genuineIsogSmulSub = addIsog (π.zsmul r, [−s])`. So `addIsog` *does* generalise to `V`: the V-side --non-inverse / injectivity / pole bricks are the ones shipped in `Verschiebung/Genuine.lean` --(`genuineIsogSmulSubV_universal_unconditional`). Its point map is `r·V + (−s) = r·V − s`. -/ -+The addition construction applied to `(V.zsmul r, [-s])` gives an isogeny with -+point map `r V - s id`, using the distinct-coordinate and pole identities for -+Verschiebung. -+-/ - - /-- The V-side genuine isogeny `r·V − s` on the concrete Verschiebung `V`. -/ - noncomputable def betaDualV (hq : 2 ≤ Fintype.card K) -@@ -131,6 +99,7 @@ noncomputable def betaDualV (hq : 2 ≤ Fintype.card K) - genuineIsogSmulSubV_universal_unconditional W (verschiebungV W hq) - (verschiebungV_isDual W hq) r s hr hs hrK hsK - -+omit [Fintype W.toAffine.Point] in - /-- The point map of `betaDualV` is `r·V − s·id` (`h_beta_dual_hom`). - - `betaDualV.toAddMonoidHom = (V.zsmul r) + [−s]`, and `(V.zsmul r) = [r] ∘ V`, so pointwise this is -@@ -150,28 +119,19 @@ theorem betaDualV_toAddMonoidHom_sub (hq : 2 ≤ Fintype.card K) - AddMonoidHom.id_apply, Isogeny.zsmul_apply, mulByInt_apply] - rw [neg_smul, sub_eq_add_neg] - --/-! ### The Wall-A keystone, reduced to the standing dual residuals -- --`genuineIsogSmulSub_degree_eq_signed_closed` is the live, witness-parametric form of the Wall-A --keystone (whose unconditional sorried form was deleted 2026-06-11). It constructs the concrete --Verschiebung --`V` and the V-side genuine isogeny `β_dual = r·V − s` internally, discharges the three *structural* --pivot inputs (`h_isDual_V_pi`, `h_beta_dual_hom`, `h_beta_pos`), and reduces the keystone to exactly --the three **standing dual residuals** plus the nonvanishing of `N`: -- --* `h_sum_trace` — the trace relation `π + V = [t]` (Silverman III.6.2(b); the output of -- `sum_trace_frobenius_witness` once `IsDualOf (1−V) (1−π)` ships); --* `h_pullback_eq` — the comorphism identity `(β_dual ∘ β)* = [N]*` (the double-Vieta pullback match, -- the geometrically irreducible content of Wall A — equivalently, that `β_dual ∘ β` is genuine with -- the `[N]` action; see `GapSpines.genuine_dual_comp_eq_mulByInt_of_isGenuineWith`); --* `h_isDual_pair` — `IsDualOf β_dual β` (Silverman III.6.1 for the genuine pair); --* `h_N_ne` — `N = q·r² − t·r·s + s² ≠ 0` (automatic in the Hasse assembly: `β_dual ∘ β = [N]` -- forces `deg β · deg β_dual = N²`, so `N ≠ 0`; carried here as a hypothesis). -- --The composition is `genuineIsogSmulSub_degree_eq_signed_of_full_pivot_chain` (GapSpines), with the --internally-built `V = verschiebungV`, `β_dual = betaDualV`. This is the honest reduction of Wall A: --the only inputs are the genuine III.6.1/III.6.2 facts the project has not yet shipped --unconditionally. -/ -+/-! ### The signed degree identity -+ -+For `β = r π - s` and `β_dual = r V - s`, assume: -+ -+* the trace relation `π + V = [t]` on points; -+* the pullback identity `(β_dual ∘ β)* = [N]*`, where `N = q r² - t r s + s²`; -+* the duality relation `IsDualOf β_dual β`; -+* `N ≠ 0`. -+ -+These inputs, together with the constructed point map of `β_dual` and positivity -+of the degree of `β`, give `deg β = N`. See Silverman III.6.1–III.6.3. -+-/ -+omit [Fintype W.toAffine.Point] in - theorem genuineIsogSmulSub_degree_eq_signed_closed (hq : 2 ≤ Fintype.card K) - (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) (hrK : (r : K) ≠ 0) (hsK : (s : K) ≠ 0) - (h_sum_trace : (frobeniusIsog W).toAddMonoidHom + (verschiebungV W hq).toAddMonoidHom = -diff --git a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux.lean b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux.lean -index 2c92295af..6cd2db847 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux.lean -@@ -1,120 +1,32 @@ -+import HasseWeil.Foundation.WronskianAux.Prefix - /- - Copyright (c) 2026 Chris Birkbeck. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Chris Birkbeck - -/ --import Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic --import Mathlib.Algebra.Polynomial.Derivation --import HasseWeil.Foundation.WronskianAux.CNorm -- --/-! --# Wronskian identities for Weierstrass division polynomials -- --Two auxiliary polynomial identities used in the proof of the division-polynomial --Wronskian identity (Silverman III.3 Exercise 3.7): -- --* `wronskian_aux_three` — the `m = 3` case. --* `wronskian_aux_four` — the `m = 4` case. -- --## Strategy -- --Both identities are pure polynomial identities in `R[X]` that hold because of --`b_relation : 4·b₈ = b₂·b₆ - b₄²`. Concretely, `LHS - RHS` factors as --`M(X) · (4b₈ - b₂b₆ + b₄²)` in `ℤ[b₂,b₄,b₆,b₈,X]` for an explicit polynomial --`M`. The multipliers `M` were computed by dividing the expanded difference by --`(4b₈ - b₂b₆ + b₄²)` over `ℤ[b₂,b₄,b₆,b₈]` (with `b₈` as the leading variable); --see `scripts/compute_multipliers.py`. -- --The proof uses `linear_combination M · h_P` where `h_P` is `b_relation` lifted --to `R[X]`. The `C`-normalization lemmas imported from `CNorm.lean` handle the --`C (Nat.cast n : R)` vs `C (OfNat.ofNat n : R)` atomization issue that --otherwise blocks `ring` from closing the residual. -- --Resource usage (vs original): -- --* `wronskian_aux_three`: default `maxHeartbeats 200000` (was 32M, 160× reduction). --* `wronskian_aux_four`: `maxHeartbeats 350000` (was 64M, ~180× reduction; measured -- minimum — 300000 fails). See TODO below for reducing to default. -- --TODO (cleanup): reduce `wronskian_aux_four` `maxHeartbeats` to 200K (default). -- --The 350K is required because `ring` must normalize a single degree-30 polynomial --identity against the degree-26 multiplier `M`; the `evalMulProd` step in ring's --normalization exceeds 300K heartbeats. Options to fit default: -- --* Coefficient-wise approach via `Polynomial.ext_iff_natDegree_le`: works for -- `coeff 0` at default (using `eval 0` trick, which is a ring hom), but -- `Polynomial.coeff_mul` on nested products (`Ψ₃^3`, `preΨ₄ * Ψ₂Sq^2`, etc.) -- makes simp hit `max_steps` for `coeff i > 0`. Over arbitrary `CommRing R`, -- `(derivative^i p).eval 0 = i! · coeff i p` can't be inverted (no division). --* New tactic: bounded-degree coefficient extraction avoiding simp's antidiagonal -- explosion — doesn't exist in mathlib yet. --* Formalize in the quotient ring `ℤ[b₂,b₄,b₆,b₈] / (4b₈ - b₂b₆ + b₄²)` where -- `b_relation` becomes a ring identity — would work on 3 atoms instead of 4, -- smaller ring work, likely fits default. Requires building the quotient. --* Manual algebraic split of m=4 into smaller sub-identities — research-level -- mathematical work. -- --RAM usage: ~1-2 GB (was ~57 GB, ~30× reduction). -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, III.3 Exercise 3.7. ---/ -- - open WeierstrassCurve Polynomial -- - namespace HasseWeil -- - variable {R : Type*} [CommRing R] (W : WeierstrassCurve R) - ---- `b_relation` lifted to an equality in `R[X]`. The `C`-distributed statement shape is ---- load-bearing: the `wronskian_aux_*` proofs below pass this to `linear_combination`, ---- whose `ring` normalization treats each `C _` application as an atom. --private lemma b_relation_poly : -- ((4 : R[X]) * Polynomial.C W.b₈ : R[X]) = -- Polynomial.C W.b₂ * Polynomial.C W.b₆ - Polynomial.C W.b₄ ^ 2 := by -- simpa [Polynomial.C_ofNat] using congrArg Polynomial.C W.b_relation -- --/-- Wronskian auxiliary identity, `m = 3` case (Silverman III.3.7). --`4·Ψ₃³ + 2·preΨ₄·Ψ₂Sq·Ψ₃' − (preΨ₄·Ψ₂Sq)'·Ψ₃ --= 3·preΨ₄·Ψ₂Sq² − 3·preΨ₄²`. -+lemma wronskian_derivative_three : Polynomial.derivative W.Ψ₃ = 3 * W.Ψ₂Sq := by -+ simp only [Ψ₃, Ψ₂Sq, Polynomial.derivative_add, Polynomial.derivative_mul, -+ Polynomial.derivative_pow, Polynomial.derivative_X, Polynomial.derivative_C, -+ Polynomial.derivative_ofNat, Polynomial.C_mul, -+ Polynomial.C_ofNat, Nat.cast_ofNat] -+ ring - --Multiplier: `M = b₈² + 4b₆b₈·X + 6b₄b₈·X² + 4b₂b₈·X³ + (b₂b₆ + 34b₈)·X⁴ -- + 36b₆·X⁵ + 18b₄·X⁶ + 4b₂·X⁷ + 9·X⁸`. -/ --lemma wronskian_aux_three : -- 4 * W.Ψ₃ ^ 3 + 2 * W.preΨ₄ * W.Ψ₂Sq * Polynomial.derivative W.Ψ₃ - -- Polynomial.derivative (W.preΨ₄ * W.Ψ₂Sq) * W.Ψ₃ = -- Polynomial.C 3 * W.preΨ₄ * W.Ψ₂Sq ^ 2 - Polynomial.C 3 * W.preΨ₄ ^ 2 := by -+lemma wronskian_three_derivative_two : -+ W.Ψ₃ * Polynomial.derivative W.Ψ₂Sq = 2 * W.preΨ₄ + 2 * W.Ψ₂Sq ^ 2 := by - linear_combination (norm := ( -- simp only [Ψ₃, preΨ₄, Ψ₂Sq, -- Polynomial.derivative_add, Polynomial.derivative_sub, -- Polynomial.derivative_mul, Polynomial.derivative_pow, Polynomial.derivative_X, -- Polynomial.derivative_C, Polynomial.derivative_ofNat, -- Polynomial.C_add, Polynomial.C_sub, Polynomial.C_mul, Polynomial.C_pow, -- Polynomial.C_ofNat, Nat.cast_ofNat] -- ring)) -- (Polynomial.C (W.b₈ ^ 2) -- + Polynomial.C (4 * W.b₆ * W.b₈) * Polynomial.X -- + Polynomial.C (6 * W.b₄ * W.b₈) * Polynomial.X ^ 2 -- + Polynomial.C (4 * W.b₂ * W.b₈) * Polynomial.X ^ 3 -- + Polynomial.C (W.b₂ * W.b₆ + 34 * W.b₈) * Polynomial.X ^ 4 -- + Polynomial.C (36 * W.b₆) * Polynomial.X ^ 5 -- + Polynomial.C (18 * W.b₄) * Polynomial.X ^ 6 -- + Polynomial.C (4 * W.b₂) * Polynomial.X ^ 7 -- + Polynomial.C 9 * Polynomial.X ^ 8) * b_relation_poly W -- ---- Measured minimum (2026-07-16, #7205): 300000 fails at `synthesize pending MVars` ---- (ring's normalization of the degree-30 residual), 350000 passes. Removal attempts: ---- default budget and a type-ascribed multiplier both time out — the structural fix is the ---- quotient-ring route documented above (producer/decompose work). --set_option maxHeartbeats 350000 in --/-- Wronskian auxiliary identity, `m = 4` case (Silverman III.3.7). -- --Multiplier `M(X)` is a degree-26 polynomial in `W.b₂, W.b₄, W.b₆, W.b₈` with --integer coefficients, computed offline by polynomial division of `LHS - RHS` --by `(4b₈ - b₂b₆ + b₄²)` over `ℤ[b₂, b₄, b₆, b₈]`. See --`scripts/compute_multipliers.py` for the derivation. -/ -+ simp only [Ψ₃, preΨ₄, Ψ₂Sq, Polynomial.derivative_add, Polynomial.derivative_mul, -+ Polynomial.derivative_pow, Polynomial.derivative_X, Polynomial.derivative_C, -+ Polynomial.derivative_ofNat, Polynomial.C_sub, -+ Polynomial.C_mul, Polynomial.C_pow, Polynomial.C_ofNat, Nat.cast_ofNat] -+ ring)) (-2 * Polynomial.X ^ 2) * wronskian_b_relation_poly W -+ -+/-- The fourth Wronskian identity follows from the third identity and the two -+small derivative relations above. This factorization avoids expansion of the -+original degree-26 multiplier. -/ - lemma wronskian_aux_four : - (W.preΨ₄ ^ 2 * W.Ψ₂Sq) ^ 2 - - (Polynomial.derivative (W.Ψ₃ * (W.preΨ₄ * W.Ψ₂Sq ^ 2 - W.Ψ₃ ^ 3)) * -@@ -126,315 +38,12 @@ lemma wronskian_aux_four : - (W.Ψ₃ * ((W.preΨ₄ * W.Ψ₂Sq ^ 2 - W.Ψ₃ ^ 3) - W.preΨ₄ ^ 2)) - - W.preΨ₄ * (W.preΨ₄ * W.Ψ₂Sq ^ 2 - W.Ψ₃ ^ 3) ^ 2) := by - linear_combination (norm := ( -- simp only [Ψ₃, preΨ₄, Ψ₂Sq, -- Polynomial.derivative_mul, Polynomial.derivative_pow, -- Polynomial.derivative_add, Polynomial.derivative_sub, -- Polynomial.derivative_X, Polynomial.derivative_C, Polynomial.derivative_ofNat, -- Polynomial.C_mul, Polynomial.C_sub, Polynomial.C_add, Polynomial.C_pow, -- Polynomial.C_neg, Polynomial.C_ofNat, Nat.cast_ofNat] -+ simp only [Polynomial.derivative_mul, Polynomial.derivative_sub, -+ Polynomial.derivative_pow, Polynomial.C_ofNat, Nat.cast_ofNat] - ring)) -- (Polynomial.C (-W.b₆ ^ 6 * W.b₈ ^ 2 + (-2 * W.b₆ ^ 2 * W.b₈ ^ 5) -- + 2 * W.b₄ * W.b₈ ^ 6 -- + (-W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 4) -- + 2 * W.b₄ * W.b₆ ^ 4 * W.b₈ ^ 3) -- + Polynomial.C (-26 * W.b₆ ^ 3 * W.b₈ ^ 4 + (-4 * W.b₆ ^ 7 * W.b₈) -- + 2 * W.b₂ * W.b₈ ^ 6 -- + (-4 * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 4) -- + 2 * W.b₂ * W.b₆ ^ 4 * W.b₈ ^ 3 -- + 2 * W.b₄ * W.b₆ ^ 5 * W.b₈ ^ 2 -- + 6 * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ ^ 3 -- + 24 * W.b₄ * W.b₆ * W.b₈ ^ 5 -- + (-2 * W.b₂ * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 4)) * Polynomial.X -- + Polynomial.C (-4 * W.b₆ ^ 8 + 20 * W.b₈ ^ 6 + (-108 * W.b₆ ^ 4 * W.b₈ ^ 3) -- + (-4 * W.b₄ ^ 4 * W.b₈ ^ 4) + 28 * W.b₄ ^ 2 * W.b₈ ^ 5 -- + (-W.b₂ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 4) -- + (-18 * W.b₄ * W.b₆ ^ 6 * W.b₈) -- + (-2 * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 3) -- + 6 * W.b₂ * W.b₆ ^ 5 * W.b₈ ^ 2 -- + 26 * W.b₂ * W.b₆ * W.b₈ ^ 5 -- + 27 * W.b₄ ^ 2 * W.b₆ ^ 4 * W.b₈ ^ 2 -- + 54 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 4 -- + (-10 * W.b₂ * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 4) -- + 6 * W.b₂ * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 3) * Polynomial.X ^ 2 -- + Polynomial.C (-196 * W.b₆ ^ 5 * W.b₈ ^ 2 + (-28 * W.b₄ * W.b₆ ^ 7) -- + 280 * W.b₆ * W.b₈ ^ 5 -- + (-96 * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 3) -- + (-16 * W.b₄ ^ 4 * W.b₆ * W.b₈ ^ 3) -- + (-16 * W.b₄ ^ 2 * W.b₆ ^ 5 * W.b₈) -- + (-12 * W.b₂ * W.b₄ ^ 3 * W.b₈ ^ 4) -- + 40 * W.b₂ * W.b₄ * W.b₈ ^ 5 -- + 52 * W.b₄ ^ 3 * W.b₆ ^ 3 * W.b₈ ^ 2 -- + 96 * W.b₂ * W.b₆ ^ 2 * W.b₈ ^ 4 -- + 156 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 4 -- + (-16 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 3) -- + (-8 * W.b₂ ^ 2 * W.b₄ * W.b₆ * W.b₈ ^ 4) -- + 44 * W.b₂ * W.b₄ * W.b₆ ^ 4 * W.b₈ ^ 2) * Polynomial.X ^ 3 -- + Polynomial.C (-136 * W.b₆ ^ 6 * W.b₈ + (-76 * W.b₄ ^ 2 * W.b₆ ^ 6) -- + (-9 * W.b₂ * W.b₆ ^ 7) -- + (-8 * W.b₄ ^ 5 * W.b₈ ^ 3) + 12 * W.b₂ ^ 2 * W.b₈ ^ 5 -- + 48 * W.b₄ ^ 3 * W.b₈ ^ 4 + 356 * W.b₄ * W.b₈ ^ 5 -- + 1374 * W.b₆ ^ 2 * W.b₈ ^ 4 + (-508 * W.b₄ * W.b₆ ^ 4 * W.b₈ ^ 2) -- + (-13 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₈ ^ 4) -- + (-2 * W.b₂ ^ 3 * W.b₆ * W.b₈ ^ 4) -- + 11 * W.b₂ ^ 2 * W.b₆ ^ 4 * W.b₈ ^ 2 -- + 28 * W.b₄ ^ 4 * W.b₆ ^ 2 * W.b₈ ^ 2 -- + 30 * W.b₄ ^ 3 * W.b₆ ^ 4 * W.b₈ -- + 128 * W.b₂ * W.b₆ ^ 3 * W.b₈ ^ 3 -- + 216 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 3 -- + (-52 * W.b₂ * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 3) -- + (-20 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 3) -- + 30 * W.b₂ * W.b₄ * W.b₆ ^ 5 * W.b₈ -- + 81 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ ^ 2 -- + 240 * W.b₂ * W.b₄ * W.b₆ * W.b₈ ^ 4) * Polynomial.X ^ 4 -- + Polynomial.C (-2 * W.b₆ ^ 7 + (-100 * W.b₄ ^ 3 * W.b₆ ^ 5) + 188 * W.b₂ * W.b₈ ^ 5 -- + 3056 * W.b₆ ^ 3 * W.b₈ ^ 3 + (-468 * W.b₄ * W.b₆ ^ 5 * W.b₈) -- + (-410 * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ ^ 2) -- + (-46 * W.b₂ * W.b₄ * W.b₆ ^ 6) -- + (-28 * W.b₂ * W.b₆ ^ 4 * W.b₈ ^ 2) -- + (-24 * W.b₂ * W.b₄ ^ 4 * W.b₈ ^ 3) -- + (-6 * W.b₂ ^ 3 * W.b₄ * W.b₈ ^ 4) -- + (-6 * W.b₂ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 3) -- + 14 * W.b₂ ^ 2 * W.b₆ ^ 5 * W.b₈ -- + 56 * W.b₄ ^ 4 * W.b₆ ^ 3 * W.b₈ -- + 64 * W.b₂ * W.b₄ ^ 2 * W.b₈ ^ 4 -- + 68 * W.b₂ ^ 2 * W.b₆ * W.b₈ ^ 4 -- + 248 * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 3 + 3168 * W.b₄ * W.b₆ * W.b₈ ^ 4 -- + (-58 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 3) -- + 24 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 2 -- + 24 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 2 -- + 122 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 4 * W.b₈ -- + 528 * W.b₂ * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 3) * Polynomial.X ^ 5 -- + Polynomial.C (664 * W.b₈ ^ 5 + (-W.b₂ ^ 4 * W.b₈ ^ 4) + (-64 * W.b₄ ^ 4 * W.b₆ ^ 4) -- + (-6 * W.b₂ ^ 2 * W.b₆ ^ 6) + 116 * W.b₄ * W.b₆ ^ 6 -- + 116 * W.b₄ ^ 4 * W.b₈ ^ 3 + 1500 * W.b₄ ^ 2 * W.b₈ ^ 4 -- + 2572 * W.b₆ ^ 4 * W.b₈ ^ 2 + (-W.b₂ ^ 3 * W.b₆ ^ 3 * W.b₈ ^ 2) -- + (-758 * W.b₄ ^ 2 * W.b₆ ^ 4 * W.b₈) -- + (-110 * W.b₂ * W.b₆ ^ 5 * W.b₈) -- + (-106 * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 2) -- + (-85 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 5) -- + (-26 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₈ ^ 3) -- + 12 * W.b₂ ^ 2 * W.b₄ * W.b₈ ^ 4 -- + 24 * W.b₄ ^ 5 * W.b₆ ^ 2 * W.b₈ -- + 168 * W.b₂ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 3 -- + 1610 * W.b₂ * W.b₆ * W.b₈ ^ 4 -- + 10544 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 3 -- + (-27 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 2) -- + (-26 * W.b₂ ^ 3 * W.b₄ * W.b₆ * W.b₈ ^ 3) -- + (-20 * W.b₂ * W.b₄ ^ 4 * W.b₆ * W.b₈ ^ 2) -- + 76 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 4 * W.b₈ -- + 78 * W.b₂ * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 2 -- + 156 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 3 * W.b₈ -- + 484 * W.b₂ * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 3) * Polynomial.X ^ 6 -- + Polynomial.C (-336 * W.b₆ ^ 5 * W.b₈ + (-16 * W.b₄ ^ 5 * W.b₆ ^ 3) -- + (-4 * W.b₂ ^ 3 * W.b₈ ^ 4) + 48 * W.b₂ * W.b₆ ^ 6 -- + 516 * W.b₄ ^ 2 * W.b₆ ^ 5 + 6552 * W.b₆ * W.b₈ ^ 4 -- + (-1032 * W.b₄ ^ 3 * W.b₆ ^ 3 * W.b₈) -- + (-68 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 4) -- + (-20 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 5) -- + (-12 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₈ ^ 3) -- + (-4 * W.b₂ ^ 4 * W.b₆ * W.b₈ ^ 3) -- + 12 * W.b₂ ^ 3 * W.b₆ ^ 4 * W.b₈ -- + 80 * W.b₂ ^ 2 * W.b₆ ^ 3 * W.b₈ ^ 2 -- + 212 * W.b₄ ^ 4 * W.b₆ * W.b₈ ^ 2 -- + 304 * W.b₂ * W.b₄ ^ 3 * W.b₈ ^ 3 + 1272 * W.b₂ * W.b₄ * W.b₈ ^ 4 -- + 5552 * W.b₂ * W.b₆ ^ 2 * W.b₈ ^ 3 -- + 11312 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 3 -- + 12336 * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 2 -- + (-472 * W.b₂ * W.b₄ * W.b₆ ^ 4 * W.b₈) -- + (-44 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 2) -- + (-28 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 2) -- + 64 * W.b₂ * W.b₄ ^ 4 * W.b₆ ^ 2 * W.b₈ -- + 108 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 2 -- + 116 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ -- + 240 * W.b₂ ^ 2 * W.b₄ * W.b₆ * W.b₈ ^ 3) * Polynomial.X ^ 7 -- + Polynomial.C (-883 * W.b₆ ^ 6 + (-W.b₂ ^ 3 * W.b₆ ^ 5) + 198 * W.b₄ ^ 5 * W.b₈ ^ 2 -- + 216 * W.b₂ ^ 2 * W.b₈ ^ 4 + 790 * W.b₄ ^ 3 * W.b₆ ^ 4 -- + 4720 * W.b₄ ^ 3 * W.b₈ ^ 3 + 5526 * W.b₄ * W.b₈ ^ 4 -- + 26236 * W.b₆ ^ 2 * W.b₈ ^ 3 + (-918 * W.b₄ ^ 4 * W.b₆ ^ 2 * W.b₈) -- + (-270 * W.b₄ * W.b₆ ^ 4 * W.b₈) -- + (-70 * W.b₂ ^ 2 * W.b₆ ^ 4 * W.b₈) -- + (-22 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 4) -- + (-20 * W.b₂ * W.b₄ ^ 4 * W.b₆ ^ 3) -- + (-6 * W.b₂ ^ 4 * W.b₆ ^ 2 * W.b₈ ^ 2) -- + (-2 * W.b₂ ^ 4 * W.b₄ * W.b₈ ^ 3) -- + 32 * W.b₂ ^ 3 * W.b₆ * W.b₈ ^ 3 -- + 300 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₈ ^ 3 -- + 354 * W.b₂ * W.b₄ * W.b₆ ^ 5 + 7316 * W.b₂ * W.b₆ ^ 3 * W.b₈ ^ 2 -- + 21030 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 2 -- + (-1346 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈) -- + (-33 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 2) -- + 30 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 3 * W.b₈ -- + 54 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ -- + 72 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 2 -- + 588 * W.b₂ * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 2 -- + 10848 * W.b₂ * W.b₄ * W.b₆ * W.b₈ ^ 3) * Polynomial.X ^ 8 -- + Polynomial.C (-4494 * W.b₄ * W.b₆ ^ 5 + 62 * W.b₂ ^ 2 * W.b₆ ^ 5 -- + 506 * W.b₄ ^ 4 * W.b₆ ^ 3 -- + 1870 * W.b₂ * W.b₈ ^ 4 + 47004 * W.b₆ ^ 3 * W.b₈ ^ 2 -- + (-312 * W.b₄ ^ 5 * W.b₆ * W.b₈) -- + (-8 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ ^ 3) -- + (-2 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 4) -- + (-2 * W.b₂ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 2) -- + 2 * W.b₂ ^ 4 * W.b₆ ^ 3 * W.b₈ -- + 136 * W.b₂ ^ 3 * W.b₄ * W.b₈ ^ 3 -- + 550 * W.b₂ * W.b₄ ^ 4 * W.b₈ ^ 2 -- + 706 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 4 -- + 1610 * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ -- + 2042 * W.b₂ * W.b₆ ^ 4 * W.b₈ -- + 2344 * W.b₂ ^ 2 * W.b₆ * W.b₈ ^ 3 -- + 7136 * W.b₂ * W.b₄ ^ 2 * W.b₈ ^ 3 -- + 18064 * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 2 -- + 49456 * W.b₄ * W.b₆ * W.b₈ ^ 3 -- + (-1592 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈) -- + (-600 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 3 * W.b₈) -- + (-10 * W.b₂ ^ 4 * W.b₄ * W.b₆ * W.b₈ ^ 2) -- + 18 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ -- + 546 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 2 -- + 21708 * W.b₂ * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 2) * Polynomial.X ^ 9 -- + Polynomial.C (3532 * W.b₈ ^ 4 + (-9537 * W.b₄ ^ 2 * W.b₆ ^ 4) -- + (-936 * W.b₂ * W.b₆ ^ 5) -- + 24 * W.b₂ ^ 4 * W.b₈ ^ 3 + 114 * W.b₄ ^ 5 * W.b₆ ^ 2 -- + 6304 * W.b₄ ^ 4 * W.b₈ ^ 2 + 27864 * W.b₄ ^ 2 * W.b₈ ^ 3 -- + 35644 * W.b₆ ^ 4 * W.b₈ + (-W.b₂ ^ 5 * W.b₆ * W.b₈ ^ 2) -- + (-W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ ^ 3) -- + (-98 * W.b₂ ^ 3 * W.b₆ ^ 3 * W.b₈) -- + 192 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 4 -- + 532 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 3 -- + 578 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₈ ^ 2 -- + 3608 * W.b₂ ^ 2 * W.b₄ * W.b₈ ^ 3 -- + 4818 * W.b₂ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 2 -- + 5778 * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ -- + 19028 * W.b₂ * W.b₆ * W.b₈ ^ 3 -- + 131228 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 2 -- + (-966 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈) -- + (-598 * W.b₂ * W.b₄ ^ 4 * W.b₆ * W.b₈) -- + 2 * W.b₂ ^ 4 * W.b₄ * W.b₆ ^ 2 * W.b₈ -- + 222 * W.b₂ ^ 3 * W.b₄ * W.b₆ * W.b₈ ^ 2 -- + 6986 * W.b₂ * W.b₄ * W.b₆ ^ 3 * W.b₈ -- + 26712 * W.b₂ * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 2) * Polynomial.X ^ 10 -- + Polynomial.C (8884 * W.b₆ ^ 5 + (-9916 * W.b₄ ^ 3 * W.b₆ ^ 3) -- + 12 * W.b₂ ^ 3 * W.b₆ ^ 4 -- + 640 * W.b₂ ^ 3 * W.b₈ ^ 3 + 36848 * W.b₆ * W.b₈ ^ 3 -- + (-4596 * W.b₂ * W.b₄ * W.b₆ ^ 4) -- + 36 * W.b₂ ^ 4 * W.b₆ * W.b₈ ^ 2 -- + 132 * W.b₂ * W.b₄ ^ 4 * W.b₆ ^ 2 -- + 180 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 3 -- + 288 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₈ ^ 2 -- + 1968 * W.b₂ ^ 2 * W.b₆ ^ 3 * W.b₈ -- + 6096 * W.b₄ ^ 4 * W.b₆ * W.b₈ -- + 11592 * W.b₂ * W.b₄ ^ 3 * W.b₈ ^ 2 -- + 24400 * W.b₂ * W.b₄ * W.b₈ ^ 3 -- + 49728 * W.b₂ * W.b₆ ^ 2 * W.b₈ ^ 2 -- + 124416 * W.b₄ * W.b₆ ^ 3 * W.b₈ -- + 134568 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 2 -- + (-408 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ * W.b₈) -- + (-240 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 2 * W.b₈) -- + 12480 * W.b₂ ^ 2 * W.b₄ * W.b₆ * W.b₈ ^ 2 -- + 13560 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈) * Polynomial.X ^ 11 -- + Polynomial.C (-4902 * W.b₄ ^ 4 * W.b₆ ^ 2 + (-545 * W.b₂ ^ 2 * W.b₆ ^ 4) -- + 1932 * W.b₄ ^ 5 * W.b₈ + 5736 * W.b₂ ^ 2 * W.b₈ ^ 3 -- + 35344 * W.b₄ * W.b₆ ^ 4 + 45144 * W.b₄ * W.b₈ ^ 3 -- + 46752 * W.b₄ ^ 3 * W.b₈ ^ 2 + 105356 * W.b₆ ^ 2 * W.b₈ ^ 2 -- + (-7315 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 3) -- + (-18 * W.b₂ ^ 4 * W.b₆ ^ 2 * W.b₈) -- + 18 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 3 -- + 50 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ ^ 2 -- + 68 * W.b₂ ^ 4 * W.b₄ * W.b₈ ^ 2 -- + 1960 * W.b₂ ^ 3 * W.b₆ * W.b₈ ^ 2 -- + 7602 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₈ ^ 2 -- + 45016 * W.b₂ * W.b₆ ^ 3 * W.b₈ -- + 173648 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ -- + (-118 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ * W.b₈) -- + 7284 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 2 * W.b₈ -- + 12548 * W.b₂ * W.b₄ ^ 3 * W.b₆ * W.b₈ -- + 107360 * W.b₂ * W.b₄ * W.b₆ * W.b₈ ^ 2) * Polynomial.X ^ 12 -- + Polynomial.C (-912 * W.b₄ ^ 5 * W.b₆ + 6 * W.b₂ ^ 5 * W.b₈ ^ 2 -- + 12024 * W.b₂ * W.b₆ ^ 4 -- + 20232 * W.b₂ * W.b₈ ^ 3 + 59770 * W.b₄ ^ 2 * W.b₆ ^ 3 -- + 112576 * W.b₆ ^ 3 * W.b₈ + (-4656 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 2) -- + (-1600 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 3) -- + 6 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ ^ 2 -- + 1206 * W.b₂ ^ 3 * W.b₆ ^ 2 * W.b₈ -- + 2124 * W.b₂ ^ 3 * W.b₄ * W.b₈ ^ 2 -- + 3892 * W.b₂ * W.b₄ ^ 4 * W.b₈ -- + 22208 * W.b₂ ^ 2 * W.b₆ * W.b₈ ^ 2 -- + 54192 * W.b₂ * W.b₄ ^ 2 * W.b₈ ^ 2 -- + 108840 * W.b₄ ^ 3 * W.b₆ * W.b₈ -- + 217088 * W.b₄ * W.b₆ * W.b₈ ^ 2 -- + (-12 * W.b₂ ^ 4 * W.b₄ * W.b₆ * W.b₈) -- + 8514 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ * W.b₈ -- + 128256 * W.b₂ * W.b₄ * W.b₆ ^ 2 * W.b₈) * Polynomial.X ^ 13 -- + Polynomial.C (24720 * W.b₈ ^ 3 + 39812 * W.b₆ ^ 4 + (-69 * W.b₂ ^ 3 * W.b₆ ^ 3) -- + 210 * W.b₂ ^ 4 * W.b₈ ^ 2 + 24836 * W.b₄ ^ 4 * W.b₈ -- + 51722 * W.b₄ ^ 3 * W.b₆ ^ 2 + 101464 * W.b₄ ^ 2 * W.b₈ ^ 2 -- + (-1395 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 2) -- + (-1026 * W.b₂ * W.b₄ ^ 4 * W.b₆) -- + 2946 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₈ -- + 20544 * W.b₂ ^ 2 * W.b₄ * W.b₈ ^ 2 -- + 24296 * W.b₂ ^ 2 * W.b₆ ^ 2 * W.b₈ -- + 40930 * W.b₂ * W.b₄ * W.b₆ ^ 3 -- + 85700 * W.b₂ * W.b₆ * W.b₈ ^ 2 + 308736 * W.b₄ * W.b₆ ^ 2 * W.b₈ -- + 2394 * W.b₂ ^ 3 * W.b₄ * W.b₆ * W.b₈ -- + 116300 * W.b₂ * W.b₄ ^ 2 * W.b₆ * W.b₈) * Polynomial.X ^ 14 -- + Polynomial.C (2472 * W.b₂ ^ 3 * W.b₈ ^ 2 + 7232 * W.b₂ ^ 2 * W.b₆ ^ 3 -- + 22172 * W.b₄ ^ 4 * W.b₆ + 108016 * W.b₆ * W.b₈ ^ 2 -- + 132592 * W.b₄ * W.b₆ ^ 3 + (-380 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆) -- + (-100 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 2) -- + 236 * W.b₂ ^ 4 * W.b₆ * W.b₈ -- + 1060 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₈ -- + 33232 * W.b₂ * W.b₄ ^ 3 * W.b₈ -- + 50972 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 2 -- + 72816 * W.b₂ * W.b₄ * W.b₈ ^ 2 -- + 110896 * W.b₂ * W.b₆ ^ 2 * W.b₈ -- + 263536 * W.b₄ ^ 2 * W.b₆ * W.b₈ -- + 40912 * W.b₂ ^ 2 * W.b₄ * W.b₆ * W.b₈) * Polynomial.X ^ 15 -- + Polynomial.C (3710 * W.b₄ ^ 5 + 8 * W.b₂ ^ 4 * W.b₆ ^ 2 -- + 12320 * W.b₂ ^ 2 * W.b₈ ^ 2 -- + 43908 * W.b₂ * W.b₆ ^ 3 + 70896 * W.b₄ ^ 3 * W.b₈ -- + 85422 * W.b₄ * W.b₈ ^ 2 -- + 149190 * W.b₆ ^ 2 * W.b₈ + 157539 * W.b₄ ^ 2 * W.b₆ ^ 2 -- + (-37 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆) -- + 182 * W.b₂ ^ 4 * W.b₄ * W.b₈ -- + 4632 * W.b₂ ^ 3 * W.b₆ * W.b₈ -- + 16268 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₈ -- + 16744 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 2 -- + 27268 * W.b₂ * W.b₄ ^ 3 * W.b₆ -- + 175520 * W.b₂ * W.b₄ * W.b₆ * W.b₈) * Polynomial.X ^ 16 -- + Polynomial.C (65230 * W.b₆ ^ 3 + 12 * W.b₂ ^ 5 * W.b₈ + 1794 * W.b₂ ^ 3 * W.b₆ ^ 2 -- + 5302 * W.b₂ * W.b₄ ^ 4 + 27230 * W.b₂ * W.b₈ ^ 2 -- + 79828 * W.b₄ ^ 3 * W.b₆ -- + 6 * W.b₂ ^ 4 * W.b₄ * W.b₆ + 3432 * W.b₂ ^ 3 * W.b₄ * W.b₈ -- + 12422 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ -- + 27992 * W.b₂ ^ 2 * W.b₆ * W.b₈ -- + 66496 * W.b₂ * W.b₄ ^ 2 * W.b₈ + 97734 * W.b₂ * W.b₄ * W.b₆ ^ 2 -- + 223992 * W.b₄ * W.b₆ * W.b₈) * Polynomial.X ^ 17 -- + Polynomial.C (14684 * W.b₄ ^ 4 + 21868 * W.b₈ ^ 2 + W.b₂ ^ 5 * W.b₆ -- + 264 * W.b₂ ^ 4 * W.b₈ -- + 2982 * W.b₂ ^ 2 * W.b₄ ^ 3 + 14687 * W.b₂ ^ 2 * W.b₆ ^ 2 -- + 81548 * W.b₄ ^ 2 * W.b₈ + 139902 * W.b₄ * W.b₆ ^ 2 -- + 2466 * W.b₂ ^ 3 * W.b₄ * W.b₆ + 20136 * W.b₂ ^ 2 * W.b₄ * W.b₈ -- + 67922 * W.b₂ * W.b₆ * W.b₈ -- + 70114 * W.b₂ * W.b₄ ^ 2 * W.b₆) * Polynomial.X ^ 18 -- + Polynomial.C (180 * W.b₂ ^ 4 * W.b₆ + 824 * W.b₂ ^ 3 * W.b₄ ^ 2 -- + 1984 * W.b₂ ^ 3 * W.b₈ -- + 16324 * W.b₂ * W.b₄ ^ 3 + 40320 * W.b₂ * W.b₆ ^ 2 -- + 57464 * W.b₆ * W.b₈ -- + 97500 * W.b₄ ^ 2 * W.b₆ + 20040 * W.b₂ ^ 2 * W.b₄ * W.b₆ -- + 47624 * W.b₂ * W.b₄ * W.b₈) * Polynomial.X ^ 19 -- + Polynomial.C (22160 * W.b₄ ^ 3 + 36374 * W.b₆ ^ 2 + 112 * W.b₂ ^ 4 * W.b₄ -- + 1874 * W.b₂ ^ 3 * W.b₆ + 6675 * W.b₂ ^ 2 * W.b₄ ^ 2 -- + 6828 * W.b₂ ^ 2 * W.b₈ -- + 39492 * W.b₄ * W.b₈ -- + 54192 * W.b₂ * W.b₄ * W.b₆) * Polynomial.X ^ 20 -- + Polynomial.C (6 * W.b₂ ^ 5 + 1194 * W.b₂ ^ 3 * W.b₄ + 7420 * W.b₂ ^ 2 * W.b₆ -- + 11068 * W.b₂ * W.b₈ + 17840 * W.b₂ * W.b₄ ^ 2 -- + 48224 * W.b₄ * W.b₆) * Polynomial.X ^ 21 -- + Polynomial.C (79 * W.b₂ ^ 4 + 6872 * W.b₈ + 15692 * W.b₄ ^ 2 -- + 4724 * W.b₂ ^ 2 * W.b₄ -- + 12978 * W.b₂ * W.b₆) * Polynomial.X ^ 22 -- + Polynomial.C (412 * W.b₂ ^ 3 + 8440 * W.b₆ + 8216 * W.b₂ * W.b₄) * Polynomial.X ^ 23 -- + Polynomial.C (1064 * W.b₂ ^ 2 + 5306 * W.b₄) * Polynomial.X ^ 24 -- + Polynomial.C (1362 * W.b₂) * Polynomial.X ^ 25 -- + Polynomial.C 692 * Polynomial.X ^ 26) * b_relation_poly W -+ (2 * W.Ψ₃ ^ 3 * W.preΨ₄ - W.preΨ₄ ^ 2 * W.Ψ₂Sq ^ 2) * wronskian_aux_three W + -+ (W.preΨ₄ ^ 3 * W.Ψ₂Sq ^ 3) * wronskian_derivative_three W + -+ (W.Ψ₃ ^ 3 * W.preΨ₄ ^ 2 - 2 * W.preΨ₄ ^ 3 * W.Ψ₂Sq ^ 2) * -+ wronskian_three_derivative_two W - - end HasseWeil -diff --git a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/CNorm.lean b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/CNorm.lean -index 4dee067bc..528b604a5 100644 ---- a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/CNorm.lean -+++ b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/CNorm.lean -@@ -1,25 +1,11 @@ - import Mathlib.Algebra.Polynomial.Basic - - /-! --# C-normalization simp set for polynomial ring tactics -+# Normalization of polynomial coefficients - --`Polynomial.derivative_pow` produces `C ((n : ℕ) : R) * p^(n-1) * derivative p`, --where `((n : ℕ) : R)` is `Nat.cast n`. On the other side of an identity, --`Polynomial.C` is often applied to literals `(n : R)` which use `OfNat.ofNat`. --`ring` sees `C (Nat.cast n : R)` and `C (OfNat.ofNat n : R)` as distinct atoms, --blocking cancellation. -- --The pair `Nat.cast_ofNat` (already `@[simp]` in mathlib) plus --`Polynomial.C_ofNat` (not `@[simp]`) normalizes every `C k` for numeric `k` to --the polynomial literal `(k : Polynomial R)`. `Polynomial.C_ofNat` must be --explicitly included in `simp only` at call sites; this file just documents the --intended usage. -- --Typical use: --``` --simp only [..., Polynomial.C_ofNat, Polynomial.C_mul, Polynomial.C_sub, -- Polynomial.C_pow, Polynomial.C_add, ...] --``` --(`Nat.cast_ofNat` fires automatically since it is `@[simp]` — `simp only` --actually does not pick it up, so include it too for safety.) -+`Polynomial.derivative_pow` introduces coefficients of the form -+`Polynomial.C (Nat.cast n : R)`. Numerical coefficients may instead be written -+with `OfNat.ofNat`, which polynomial ring normalization can treat as a distinct -+atom. Explicit simplification by `Nat.cast_ofNat` and `Polynomial.C_ofNat` -+identifies both forms with the corresponding polynomial numeral. - -/ -diff --git a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/Prefix.lean b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/Prefix.lean -new file mode 100644 -index 000000000..b1df73ddd ---- /dev/null -+++ b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/Prefix.lean -@@ -0,0 +1,62 @@ -+import Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic -+import Mathlib.Algebra.Polynomial.Derivation -+import Mathlib.Tactic.LinearCombination -+import HasseWeil.Foundation.WronskianAux.CNorm -+ -+ -+/- -+Copyright (c) 2026 Chris Birkbeck. All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Chris Birkbeck -+-/ -+ -+/-! -+# Third Wronskian identity -+ -+The third division-polynomial Wronskian identity follows from the Weierstrass -+coefficient relation. Its polynomial multiplier has degree eight. -+-/ -+ -+open WeierstrassCurve Polynomial -+ -+namespace HasseWeil -+ -+variable {R : Type*} [CommRing R] (W : WeierstrassCurve R) -+ -+-- The Weierstrass coefficient relation lifted to the polynomial ring, with -+-- coefficient maps distributed for polynomial normalization. -+lemma wronskian_b_relation_poly : -+ ((4 : R[X]) * Polynomial.C W.b₈ : R[X]) = -+ Polynomial.C W.b₂ * Polynomial.C W.b₆ - Polynomial.C W.b₄ ^ 2 := by -+ simpa [Polynomial.C_ofNat] using congrArg Polynomial.C W.b_relation -+ -+/-- Wronskian auxiliary identity, `m = 3` case (Silverman III.3.7). -+`4·Ψ₃³ + 2·preΨ₄·Ψ₂Sq·Ψ₃' − (preΨ₄·Ψ₂Sq)'·Ψ₃ -+= 3·preΨ₄·Ψ₂Sq² − 3·preΨ₄²`. -+ -+Multiplier: `M = b₈² + 4b₆b₈·X + 6b₄b₈·X² + 4b₂b₈·X³ + (b₂b₆ + 34b₈)·X⁴ -+ + 36b₆·X⁵ + 18b₄·X⁶ + 4b₂·X⁷ + 9·X⁸`. -/ -+lemma wronskian_aux_three : -+ 4 * W.Ψ₃ ^ 3 + 2 * W.preΨ₄ * W.Ψ₂Sq * Polynomial.derivative W.Ψ₃ - -+ Polynomial.derivative (W.preΨ₄ * W.Ψ₂Sq) * W.Ψ₃ = -+ Polynomial.C 3 * W.preΨ₄ * W.Ψ₂Sq ^ 2 - Polynomial.C 3 * W.preΨ₄ ^ 2 := by -+ linear_combination (norm := ( -+ simp only [Ψ₃, preΨ₄, Ψ₂Sq, -+ Polynomial.derivative_add, Polynomial.derivative_sub, -+ Polynomial.derivative_mul, Polynomial.derivative_pow, Polynomial.derivative_X, -+ Polynomial.derivative_C, Polynomial.derivative_ofNat, -+ Polynomial.C_add, Polynomial.C_sub, Polynomial.C_mul, Polynomial.C_pow, -+ Polynomial.C_ofNat, Nat.cast_ofNat] -+ ring)) -+ (Polynomial.C (W.b₈ ^ 2) -+ + Polynomial.C (4 * W.b₆ * W.b₈) * Polynomial.X -+ + Polynomial.C (6 * W.b₄ * W.b₈) * Polynomial.X ^ 2 -+ + Polynomial.C (4 * W.b₂ * W.b₈) * Polynomial.X ^ 3 -+ + Polynomial.C (W.b₂ * W.b₆ + 34 * W.b₈) * Polynomial.X ^ 4 -+ + Polynomial.C (36 * W.b₆) * Polynomial.X ^ 5 -+ + Polynomial.C (18 * W.b₄) * Polynomial.X ^ 6 -+ + Polynomial.C (4 * W.b₂) * Polynomial.X ^ 7 -+ + Polynomial.C 9 * Polynomial.X ^ 8) * wronskian_b_relation_poly W -+ -+ -+end HasseWeil -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/Infrastructure.lean b/projects/HasseWeil/HasseWeil/HasseBound/Infrastructure.lean -index 9facfb997176c5ac380d29e70848729672edc3fd..8c198b73959a7180a7e5398bfbe82ea2777afe6b 100644 -GIT binary patch -delta 2643 -zcmaJ@ZHN_B7-sHj!hk6$mLKUG;^Nw!yRH*r>&*IHM1?##LO9-Dj4?3|gq -zd#$*d1x3);5sJcemo&-BWd8J{K&U_Vp(|}vWGF&lko}ShEa*KmcV_QOiXxZs%=^CQ -zd7qCt_HoPEliDZR9rbmNLtUR*Pz;#mQ_hScC61j1n^vjd9+=Dq{81vT2Gl0Zr#>Y@ -z*LRf3P49ppuIZTt>QKK1rdJ9ocsvVRsN)b1T#qt~x~7wq7FfG(>q&8oS6nWzI%iPi -zUL|l$0U~f+rv^SYqs*q3=@T0^m_iU3qCO)+G!2#0yEqcF7)ecO@kQdI*nn^@X*SC`*@d&esSS9O=9^9CP?(Xi~iYxo&%B-%SP?NYG -z=S9H3y}6EDhiVZ$UhnY&VKflna>{(e;sNuM@oI7iURy+c0iGETXhf%=%q#fEbIVjz -z!fW?EqitL_>=P!UODG_*PYe;lj(t2Hl*)~3xPjvoOzWv=NpaJP=|Y4gL+ryRmQ2rt -z*Ve#P9C>tnwj6E0OU_u9t3w`KC=cp-yAikZ`4HAjm%3h505x^abrfoZG3EU<~fhm~;UPK{xC -z#I=mPWt{CJ9>@RpXcbRZ$tu;-Dx*LwA0GRXP}qkuyfB$ZJG`^ca_Nf1J~2vpP47*se;&T -zz~h0pm!LgV8-!FSdt@-69yT4hQK0W0ZBaNu)D -z)e`=@o>WOc(qKX$Tz!v4an@};fXmg+I1X}d!zz# -zY;d8xNaxFyrB->-8xMc=AI^jy4fSa9>b^blcr8B_AqS8jj)Q!1-#ksn=by`~Pv4MR -zpIyC75f%E@qm9&D0-O4q`HH$k@*q?WMVZRWFScnA(wE=Q$OEsu8G5hI(L(L@F)e$$ -z8dezv0?N3Q0+}zLm#s6D@>7@2L3sVpzoE=ab-&qla5F -zSmn=mLA&Qx@5#rG&dWBpH599=rlU*=Su(Kn{K2Jb+uG2YmTqesz;dTY7HeI%D%XuR -zwzMZXJ?TDKWep4ldf*Y*hK1zldxz!GV=twi@BsAXb3X4xPh=$5Es|tRvF}V(O&p@4 -z4S6Sz9AD57yppTyU^;O8$3)t&$U18{^T>&RwZ*rZSur1-D)3B4!pS+ylzk}vS|*x^ -z+A~)2NePYABd&)6V18sMc!fjZh`C;6bZpN`2bLKbU&P}9ceghX-5WLPMqZrC2{A`J -zz%z>6!3;)ALbFr_)Kj-{8p8yqH$Lsv>YWV7h&=#r7i&~yvgHISs??ito|Q15TueDq -zbkH$S{;8f(8*zA@b$iJ=&S(-3?u -zJK;Hz6({+r3tW$AxYKPM1Buae(Pa4W%()gVO4vAE@0=3ZvNJwc&cATHBl%cLnkkAm -z?uM-UpU9S@-<@p=>oq+wekl*|QWLe99pINw8v2G!k>>H2$j#q+B>6~@zkUC=oc6=Q -F{{V?d-7EkA - -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/PointCount.lean b/projects/HasseWeil/HasseWeil/HasseBound/PointCount.lean -index e004de056..c8fa5b0d3 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/PointCount.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/PointCount.lean -@@ -149,7 +149,7 @@ theorem card_kernel_eq_pointCount_of_kernel_eq_top - - /-- **Sub-helper III-4-015-S3** (fiber witness via degree = pointCount): - under separability + `β.degree = pointCount`, the fiber witness for the --Hasse bound consumer ships axiom-clean. -+Hasse bound consumer exists. - - Proof chain: - 1. `β.degree = pointCount` (input). -@@ -215,7 +215,7 @@ omit [Fintype K] in - given `Aut(K(E₁)/α*K(E₂)) ≃ α.kernel` (the substantive Galois-correspondence - content for elliptic isogenies) and a witness for `Nat.card Aut = α.degree` - (the IsGalois card_aut_eq_finrank applied to our specific algebra), derive --`Nat.card α.kernel = α.degree` axiom-clean. -+`Nat.card α.kernel = α.degree` . - - Reduces the III.4.10(a) wall to two named witnesses: - 1. `Nat.card Aut = α.degree` (IsGalois + finrank). -@@ -263,9 +263,9 @@ theorem card_aut_eq_degree_of_isGalois - W.toAffine.FunctionField _ _ β.toAlgebra.toModule) : - Nat.card (@AlgEquiv W.toAffine.FunctionField W.toAffine.FunctionField - W.toAffine.FunctionField _ _ _ β.toAlgebra β.toAlgebra) = β.degree := by -- letI := β.toAlgebra -- haveI := hgal -- haveI := hfin -+ let := β.toAlgebra -+ have := hgal -+ have := hfin - exact IsGalois.card_aut_eq_finrank W.toAffine.FunctionField W.toAffine.FunctionField - - /-- **Sub-helper III-4-015-S9** (full chain: IsGalois + bijection → fiber witness): -@@ -275,7 +275,7 @@ final closing-arc consumer. Takes: - - Aut ≃ β.kernel bijection (the substantive Galois-correspondence content). - - Produces the fiber witness used by the historical witness-parametric --Hasse-bound route, axiom-clean. -+Hasse-bound route, . - - The cascade reduces T-III-4-015 to two named witnesses via this consumer: - 1. `IsGalois (α*K(E₂)) K(E₁)` (Mathlib has the structure; needs Normal). -@@ -346,7 +346,7 @@ theorem fiber_witness_via_inverse_witnesses - (aut_kernel_equiv_of_inverse_witnesses W β _ forward inverse - h_left_inv h_right_inv) - --/-- **Forward map at k = 0** (axiom-clean): the translation by 0 is the identity -+/-- **Forward map at k = 0** (): the translation by 0 is the identity - algebra automorphism. -/ - noncomputable def aut_of_kernel_zero - {F : Type*} [Field F] [DecidableEq F] -@@ -354,7 +354,7 @@ noncomputable def aut_of_kernel_zero - W.toAffine.FunctionField ≃ₐ[F] W.toAffine.FunctionField := - AlgEquiv.refl - --/-- **Forward map at k = 0 is the identity** (axiom-clean). -/ -+/-- **Forward map at k = 0 is the identity** (). -/ - @[simp] theorem aut_of_kernel_zero_apply - {F : Type*} [Field F] [DecidableEq F] - (W : WeierstrassCurve F) [W.toAffine.IsElliptic] -@@ -362,21 +362,9 @@ noncomputable def aut_of_kernel_zero - aut_of_kernel_zero W f = f := - rfl - --/-- **Substantive partial forward-map construction** (Sub-helper III-4-015-S12): --the forward map for the substantive cases requires the curve-translation --algebra automorphism `τ_k : K(E) ≃ₐ[F] K(E)` defined by --`τ_k(x_gen) = x-coord(P_gen + k)` and `τ_k(y_gen) = y-coord(P_gen + k)`. -- --Construction parallels Worker A's `addPullbackAlgHom_negFrobenius`: --1. Define `τ_k` via the addition formula (`addX`, `addY`). --2. Show it's a K-algebra hom (well-defined modulo Weierstrass). --3. Show it has inverse `τ_(-k)` (since τ is a group action). --4. For k ∈ β.kernel, show `τ_k` fixes `β.pullback`'s image. -- --This sub-helper takes the substantive `τ_k` AS A WITNESS — a precise --statement of what's needed beyond what's currently in mathlib. The --construction itself is ~200-300 LOC of `addCoordAlgHom`-style infrastructure --applied to the translation map. -/ -+/-- A kernel-indexed family of translation algebra automorphisms. -+For a kernel point `k`, translation by `k` fixes the image of the pullback; -+the family is supplied as an explicit witness. -/ - noncomputable def aut_of_kernel_construction_witness - (β : Isogeny W.toAffine W.toAffine) - (translation_at : β.kernel → -@@ -400,7 +388,7 @@ noncomputable def kernelTranslateForward - kernelTranslateForward W β ⟨0, h_zero_mem⟩ = AlgEquiv.refl := rfl - - /-- **Layer 2 forward map under `β.toAlgebra`** (witness-parametric). --Takes Worker A's `translateAlgEquivOfPoint W k.val` (an F-AlgEquiv) and -+Takes `translateAlgEquivOfPoint W k.val` (an F-AlgEquiv) and - the covariance identity `τ_k ∘ β.pullback = β.pullback` (provided as - hypothesis), and produces the `K(E)`-AlgEquiv (under `β.toAlgebra`) - consumed by the S10 bijection. -/ -@@ -425,7 +413,7 @@ noncomputable def kernelTranslateForwardAsAut - W.toAffine.FunctionField _ _ _ β.toAlgebra β.toAlgebra) := - fun k ↦ kernelTranslateAsAut W β k (h_invariance_family k) - --/-- **`kernelTranslateAsAut` at `k = 0`** is the identity AlgEquiv (axiom-clean). -+/-- **`kernelTranslateAsAut` at `k = 0`** is the identity AlgEquiv (). - The `h_invariance` hypothesis at k = 0 is automatic since `τ_0 = refl`. -/ - @[simp] theorem kernelTranslateAsAut_zero - (β : Isogeny W.toAffine W.toAffine) -@@ -436,7 +424,7 @@ The `h_invariance` hypothesis at k = 0 is automatic since `τ_0 = refl`. -/ - kernelTranslateAsAut W β ⟨0, h_zero_mem⟩ h_invariance = - @AlgEquiv.refl W.toAffine.FunctionField W.toAffine.FunctionField - _ _ β.toAlgebra := by -- letI := β.toAlgebra -+ let := β.toAlgebra - apply AlgEquiv.ext - intro f - change translateAlgEquivOfPoint W (0 : W.toAffine.Point) f = f -@@ -474,6 +462,7 @@ omit [DecidableEq F] [W.toAffine.IsElliptic] in - (x : W.toAffine.FunctionField) : - x ∈ algHomFieldEqualizer W f g ↔ f x = g x := Iff.rfl - -+omit [DecidableEq F] in - /-- **Two `F`-AlgHoms `K(E) → K(E)` agreeing on `x_gen`, `y_gen` are equal**: - `K(E)` is generated over `F` by `x_gen` and `y_gen`. -/ - theorem algHom_ext_of_eq_on_xy [Fintype F] -@@ -553,7 +542,7 @@ theorem kernel_pullback_invariance_id - rw [translateAlgEquivOfPoint_zero] - rfl - --/-- **`SMulCommClass` for Worker A's master action**: the translation -+/-- **Commuting scalar multiplication for the translation action**: the translation - action commutes with `F`-scalar multiplication because every - `translateAlgEquivOfPoint W k` is an F-AlgEquiv (hence F-linear). -/ - instance translateMulSemiringAction_smulCommClass : -@@ -564,7 +553,7 @@ instance translateMulSemiringAction_smulCommClass : - rw [Algebra.smul_def, Algebra.smul_def, map_mul, AlgEquiv.commutes] - - /-- **Restricted action**: `Multiplicative β.kernel` acts on `K(E)` via --the inclusion `β.kernel → E.Point` composed with Worker A's master action -+the inclusion `β.kernel → E.Point` composed with the translation action - `translateMulSemiringAction`. -/ - noncomputable instance kernelMulSemiringAction - (β : Isogeny W.toAffine W.toAffine) : -@@ -632,12 +621,12 @@ theorem xy_family_zero - (β.pullback (y_gen W)) = β.pullback (y_gen W)) := - ⟨rfl, rfl⟩ - --/-- **Layer 2 closure (witness-parametric on finrank match)**: under the -+/-- **Fixed-field equality from a rank equality**: under the - xy-covariance family + finrank equality, `β.pullback.fieldRange = - FixedPoints.intermediateField (Multiplicative β.kernel)`. - - Direct application of `IntermediateField.eq_of_le_of_finrank_eq'` to the --forward inclusion (just shipped) plus the finrank-match witness. -/ -+forward inclusion plus the finrank-match witness. -/ - theorem pullback_fieldRange_eq_fixedField_of_finrank_match [Fintype F] - (β : Isogeny W.toAffine W.toAffine) - [hfindim : FiniteDimensional ↥β.pullback.fieldRange W.toAffine.FunctionField] -@@ -659,11 +648,11 @@ theorem pullback_fieldRange_eq_fixedField_of_finrank_match [Fintype F] - (pullback_fieldRange_le_fixedField_of_xy_family W β h_xy_family) - h_finrank_match - --/-- **Layer 2 closure (Artin-machinery sourced)**: the finrank match -+/-- **Fixed-field equality from Artin's theorem**: the finrank match - witness can be sourced from Mathlib's `FixedPoints.finrank_eq_card` (which --gives `[K(E) : FixedPoints] = |G|` axiom-clean from Faithful + Fintype) and -+gives `[K(E) : FixedPoints] = |G|` from Faithful + Fintype) and - the cardinality match `|β.kernel| = β.degree` (Silverman III.4.10(b), --T-V-1-003 / V.1.3) plus the intrinsic relation -+V.1.3) plus the intrinsic relation - `[K(E) : β.pullback.fieldRange] = β.degree` (witness-parametric below). - - This is the **packaged Artin-route closure**: takes the Hasse-content card -@@ -707,11 +696,10 @@ theorem faithfulSMul_kernel_of_translate_inj - - /-- **`FaithfulSMul` (UNCONDITIONAL)**: discharges the witness in - `faithfulSMul_kernel_of_translate_inj` using --`translateAlgEquivOfPoint_injective` (just shipped in `EC/TranslationOrd`). -+`translateAlgEquivOfPoint_injective` . - - Direct corollary: for any isogeny β over a finite field, the restricted --action `kernelMulSemiringAction β` is faithful axiom-clean. This collapses --the FaithfulSMul witness in the Layer-2 cascade — combined with finiteness -+action `kernelMulSemiringAction β` is faithful . Combined with finiteness - of β.kernel (over finite F), Mathlib's Artin machinery - (`FixedPoints.finrank_eq_card`) applies unconditionally. -/ - instance faithfulSMul_kernel -@@ -730,10 +718,10 @@ closure given the cardinality match `Fintype.card β.kernel = β.degree` - theorem finrank_pullback_fieldRange_eq_degree - (β : Isogeny W.toAffine W.toAffine) : - Module.finrank ↥β.pullback.fieldRange W.toAffine.FunctionField = β.degree := by -- letI inst1 : Algebra W.toAffine.FunctionField W.toAffine.FunctionField := β.toAlgebra -- letI inst_im : Algebra ↥β.pullback.fieldRange W.toAffine.FunctionField := -+ let inst1 : Algebra W.toAffine.FunctionField W.toAffine.FunctionField := β.toAlgebra -+ let inst_im : Algebra ↥β.pullback.fieldRange W.toAffine.FunctionField := - IntermediateField.toAlgebra _ -- letI mod_im : Module ↥β.pullback.fieldRange W.toAffine.FunctionField := -+ let mod_im : Module ↥β.pullback.fieldRange W.toAffine.FunctionField := - inst_im.toModule - change @Module.finrank ↥β.pullback.fieldRange W.toAffine.FunctionField _ _ mod_im = - β.degree -@@ -758,7 +746,7 @@ theorem finrank_pullback_fieldRange_eq_degree - exact (Algebra.finrank_eq_of_equiv_equiv i j h_compat).symm - - /-- **Layer 2 closure (UNCONDITIONAL on the intrinsic part)**: combines --`pullback_fieldRange_eq_fixedField_of_finrank_match` with the just-shipped -+`pullback_fieldRange_eq_fixedField_of_finrank_match` with the - intrinsic finrank relation, leaving only the Hasse-content cardinality - match `Nat.card β.kernel = β.degree` as a witness. - -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorFallback.lean b/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorFallback.lean -index 6c96651f4795880dc78a3532568e069e75c9f7d2..cc60cff7787880be5b3c3d19acf7c586481df8fa 100644 -GIT binary patch -delta 1398 -zcmaize{54#6vuP!>)P%i;@HNvI?EjcWp-m@#vX|aO7X*9>aTvBwdElvf41^%Bu^{&2kRwp!B?Qr$%Y#4-*{HxlMOve -zVJ^zVwn`cbl=4GQY;)1>!}au+mSr3_Kj&CN?d9)m|J{|_QR8eGO-oyaT`O${KoENeo4kz6A6TaT6=^v$1*)~t#uBT3~p_kQ%kd>S(Hjo -z9W6S(*Ga=xF~!ZBcwJ=5A^Y>wJ3R&RV34M!r)_g?dMy6uk|lbrEBD_ewN9?(J9|yw -z-G|SwqEoLF(i8I@mRbf*erWa}(Ef9)S?WcQm$3o7^vxev(($*vnRxX_z6Ys2oojt- -zdEc3sl4bJN$u&wAg=ycJ;q2JHXVF1$@bPn-opu@@y;zbb7n^wM;%h+1zI~KU6oHS8 -zRY4Vlic^h`NuV!Da8+$T)ae@-!?L@ev5Q@19j3ze3XkeP|S-?7Dz2 -zn9T8rYoCMPA^N|B&z$113-GCveKQSJqWm)a4MHw^5qo|HNY>xH8ps5C&57y -zG6})Peqv%v?mNOH62u{*6H~KD5Vv<>4O^zB#{)zU65Y}wxFewltgxYD5=&^2xN7J9 -zmm{;KLW|V=E6$KLnW=|x(&{vgM5q&ot+@POvU;3sP`9TSHaTjNI5GE=c-quGJ84KY -z*7RUH5HL(Bj2e2-hH8-zX*V@BZkdUIm5>pvWxCVT>ZlRv(&g)yE#zmBhADbgC0t}2~@5`h{X~C^j$8k=nJBuyqpoqcYxTp4;{%}zs^7iiS`&8{-6AJ5gYm$z83Gl -Hfdc3sx_cCT - -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorTwoTorsion.lean b/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorTwoTorsion.lean -index 25f0c6948..31fbb612c 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorTwoTorsion.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorTwoTorsion.lean -@@ -6,49 +6,20 @@ Authors: Chris Birkbeck - import HasseWeil.HasseBound.PoleDivisorFallback - - /-! --# Bridge at `addPullbackNumerator_negFrobenius` for 2-torsion (T-T21-2TORSION-BRIDGE) -- --The non-2-torsion bridge `bridge_at_addPullbackNumerator_negFrobenius_of_non_2_tor` --(`PoleDivisorFallback.lean:2353`) goes through `bridge_at_x_gen_of_non_2_tor` --(`PoleDivisorFallback.lean:606`), which uses --`ord_P_translateX_xy_eq_neg_two_of_non_2_tor` (`EC/TranslationOrd.lean:1379`) --as the substantive `= -2` identity at `−T` (with `T` non-2-torsion). -- --This file ships the **2-torsion analogue**: --`ord_P (translateX_xy W xT yT) = -2` at the smooth point `−T = T` (where --`−T = T` modulo `Nonsingular`-prop-irrelevance for 2-torsion), and --propagates it to the base bridges and the full --`bridge_at_addPullbackNumerator_negFrobenius` at 2-torsion. -- --The chain is: -- --* `ord_P_x_gen_sub_const_ge_two_at_2tor` — `ord_P (x_gen − xk) ≥ 2` from the -- curve identity `(y − yk)·A = (x − xk)·(B − a₁·yk)` at 2-torsion T with -- `ord_P (y − yk) = 1`, `ord_P A ≥ 1`, `ord_P (B − a₁·yk) = 0`. --* `ord_P_A_eq_one_at_2tor` — `ord_P A = 1` exactly via strict comparison -- `ord_P (y − yk) = 1 < 2 ≤ ord_P (a₁·(x − xk))` in `A = (y − yk) + a₁·(x − xk)`. --* `ord_P_translateSlope_xy_eq_neg_one_at_2tor` — `ord_P slope = −1` exactly -- via `slope = (B − a₁·yk) / A` with `ord = 0 − 1 = −1`. --* `ord_P_translateX_xy_eq_neg_two_at_2tor` — `ord_P translateX_xy = −2` -- exactly via `translateX_xy = slope² + rest` with strict comparison. --* `bridge_at_x_gen_of_2_tor` — bridge `ord_P (τ_{−T} x_gen) = ord_∞ x_gen`. --* `bridge_at_x_gen_pow_card_of_2_tor` — bridge for `x_gen^q`. --* `bridge_at_y_gen_of_2_tor` and `bridge_at_y_gen_pow_card_of_2_tor` — -- y-side analogues, derived via `translateY_xy` analysis. --* `bridge_at_addPullbackNumerator_negFrobenius_of_2_tor` — the full Num -- bridge at 2-torsion via the dominant-T7 strict comparison. -- --After this lands, the chain `T21 → T22 → T23 → T24` (L6 closer) is --unblocked: `support_card_eq_pointCount_of_two_torsion_ord_witness` --(`L6Witnesses.lean:497`) consumes the 2-torsion ord witness, and the --T22 composer becomes unconditional. -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, II.1, III.2. --* `tickets/hasse/T-T21-2TORSION-BRIDGE.md` — the spawned sub-ticket. --* `EC/TranslationOrd.lean:2566+` — the 2-torsion `A`-factorisation and -- per-piece order bounds. -+# Orders of translated coordinates at smooth two-torsion points -+ -+At a smooth two-torsion point `T`, the curve identity -+`(y − y_T)A = (x − x_T)(B − a₁y_T)` gives `ord_T(x − x_T) ≥ 2`. -+The factorization `A = (y − y_T) + a₁(x − x_T)` then gives `ord_T A = 1`, -+so the translation slope has order `-1`. Strict comparison in the addition -+formulas yields orders `-2` and `-3` for the translated x- and y-coordinates. -+ -+These coordinate orders identify local orders after translation with orders at -+infinity, including powers, products, and the reduced addition numerator for -+negative Frobenius. In that numerator the term `x · (π*x)²`, of order `-2-4q`, -+strictly dominates the other terms. -+ -+References: Silverman, *The Arithmetic of Elliptic Curves*, II.1 and III.2. - -/ - - open WeierstrassCurve HasseWeil.Curves -@@ -76,7 +47,7 @@ private lemma pi_y_gen_ne_zero_aux (hq : 2 ≤ Fintype.card K) : - rw [ordAtInfty_negFrobeniusIsog_pullback_y_gen W hq] at h_top - exact WithTop.coe_ne_top h_top - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **`ord_P (x_gen − xk) ≥ 2` at smooth 2-torsion `T`** via the curve - identity `(y − yk)·A = (x − xk)·(B − a₁·yk)` and the ord facts at - 2-torsion. -/ -@@ -117,7 +88,9 @@ theorem ord_P_x_gen_sub_const_ge_two_at_2tor (xk yk : K) - (y_gen W + algebraMap K KE yk + - algebraMap K KE W.a₁ * x_gen W + algebraMap K KE W.a₃)) := by - rw [h_LHS_mul, h_yd_ord] -- exact add_le_add (le_refl _) h_A_ge -+ calc -+ ((2 : ℤ) : WithTop ℤ) = ((1 : ℤ) : WithTop ℤ) + ((1 : ℤ) : WithTop ℤ) := by norm_num -+ _ ≤ _ := add_le_add le_rfl h_A_ge - have h_RHS_ord : ((2 : ℤ) : WithTop ℤ) ≤ (W_smooth W).ord_P P - ((x_gen W - algebraMap K KE xk) * - (x_gen W ^ 2 + x_gen W * algebraMap K KE xk + -@@ -143,7 +116,7 @@ theorem ord_P_x_gen_sub_const_ge_two_at_2tor (xk yk : K) - rw [h_mul_eq, h_Bma_ord, add_zero] at h_RHS_ord - exact h_RHS_ord - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **`ord_P A = 1` exactly at smooth 2-torsion `T`** via strict comparison - `ord_P (y − yk) = 1 < 2 ≤ ord_P (a₁·(x − xk))` in the factorisation - `A = (y − yk) + a₁·(x − xk)`. -/ -@@ -185,7 +158,7 @@ theorem ord_P_A_eq_one_at_2tor (xk yk : K) - have h_add := SmoothPlaneCurve.ord_P_add_eq_of_lt h_strict - exact h_add.trans h_yd_ord - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **`ord_P slope = -1` exactly at smooth 2-torsion `T`** via - `slope = (B − a₁·yk) / A` with `ord = 0 − 1 = −1` (using the - sharpened `ord_P A = 1`). -/ -@@ -233,7 +206,7 @@ theorem ord_P_translateSlope_xy_eq_neg_one_at_2tor (xk yk : K) - rw [h_mul, h_inv, h_Bma_ord, h_A_ord, zero_add] - rfl - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **`ord_P (translateX_xy) = -2` exactly at smooth 2-torsion `T`**: - `translateX_xy = slope² + (a₁·slope − a₂ − x_gen − xk)`. With - `ord_P slope = −1` exactly, `ord_P (slope²) = −2`, and the rest has -@@ -383,7 +356,7 @@ theorem ord_T_translateAlgEquivOfPoint_neg_x_gen_eq_neg_two_at_2tor (xT yT : K) - omit [Fintype K] in - /-- **Bridge at `f = x_gen` for 2-torsion `T`** (clean version): the analog of - `bridge_at_x_gen_of_non_2_tor` for 2-torsion. Composes the 2-torsion `ord_T` --value with the shipped `ordAtInfty_x_gen = -2`. -/ -+value with the `ordAtInfty_x_gen = -2`. -/ - theorem bridge_at_x_gen_of_2_tor (xT yT : K) - (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) : - (W_smooth W).ord_P (⟨xT, yT, h_ns⟩ : (W_smooth W).SmoothPoint) -@@ -474,7 +447,7 @@ theorem bridge_at_x_gen_sub_negFrobeniusIsog_pullback_x_gen_of_2_tor (xT yT : K) - exact bridge_at_x_gen_sub_x_gen_pow_card_of_2_tor W xT yT h_ns h_2_tor hq - - /-- **Bridge at `(x_gen - (negFrob).pullback x_gen)^2` (slope-denominator squared)** --for 2-torsion `T`. Pow on the just-shipped bridge for `x_gen - negFrob.pullback x_gen`. -+for 2-torsion `T`. Pow on the bridge for `x_gen - negFrob.pullback x_gen`. - Mirrors `bridge_at_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_of_non_2_tor`. -/ - theorem bridge_at_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor (xT yT : K) - (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) -@@ -492,7 +465,7 @@ theorem bridge_at_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor (xT yT : - W xT yT h_ns h_2_tor hq) 2 - - /-- **Bridge at `((negFrob).pullback x_gen)^2` for 2-torsion `T`**: pow on --the just-shipped bridge for `(negFrob).pullback x_gen`. Mirrors the non-2-tor -+the bridge for `(negFrob).pullback x_gen`. Mirrors the non-2-tor - version (`bridge_at_negFrobeniusIsog_pullback_x_gen_sq_of_non_2_tor`). -/ - theorem bridge_at_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor (xT yT : K) - (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) : -@@ -525,7 +498,7 @@ theorem bridge_at_x_gen_mul_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor (xT yT : - (bridge_at_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor W xT yT h_ns h_2_tor) - - /-- **Bridge at T6 = `x_gen² · (negFrob).pullback x_gen`** for 2-torsion `T`: --mul on bridges for `x_gen²` (pow) and `(negFrob).pullback x_gen` (shipped). -/ -+mul on bridges for `x_gen²` (pow) and `(negFrob).pullback x_gen` . -/ - theorem bridge_at_x_gen_sq_mul_negFrobeniusIsog_pullback_x_gen_of_2_tor (xT yT : K) - (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) : - (W_smooth W).ord_P (⟨xT, yT, h_ns⟩ : (W_smooth W).SmoothPoint) -@@ -563,11 +536,10 @@ theorem bridge_at_x_gen_mul_negFrobeniusIsog_pullback_x_gen_of_2_tor (xT yT : K) - (bridge_at_x_gen_of_2_tor W xT yT h_ns h_2_tor) - (bridge_at_negFrobeniusIsog_pullback_x_gen_of_2_tor W xT yT h_ns h_2_tor) - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **`ord_P (x_gen − xk) = 2` EXACTLY at smooth 2-torsion `T`** via the curve - identity `(y − yk)·A = (x − xk)·(B − a₁·yk)` with the EXACT `ord_P A = 1` --(shipped at `ord_P_A_eq_one_at_2tor`) and `ord_P (B − a₁·yk) = 0` (shipped at --`ord_P_B_minus_a1_yk_eq_zero_at_2tor`). Tightens the shipped `≥ 2` to equality. -/ -+(given by `ord_P_A_eq_one_at_2tor`) and `ord_P (B − a₁·yk) = 0` (given by `ord_P_B_minus_a1_yk_eq_zero_at_2tor`). Tightens the `≥ 2` to equality. -/ - theorem ord_P_x_gen_sub_const_eq_two_at_2tor (xk yk : K) - (h_ns : W.toAffine.Nonsingular xk yk) (h_2_tor : yk = W.toAffine.negY xk yk) : - (W_smooth W).ord_P (negSmoothPoint W xk yk h_ns) -@@ -631,10 +603,9 @@ theorem ord_P_x_gen_sub_const_eq_two_at_2tor (xk yk : K) - rw [h_mul_eq, h_Bma_ord, add_zero] at h_RHS_ord - exact h_RHS_ord - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Nonnegativity of `ord_P` of the `T3` coefficient `yd·(a₂ + 2x + xk') − a₁²·yd`, given the basic --order data. Extracted from `ord_P_translateY_xy_eq_neg_three_at_2tor` to keep its per-term `ord_P` --bound bookkeeping under the default heartbeat budget. -/ -+order data. -/ - theorem ord_P_translateY_T3_coef_nonneg - {P : (W_smooth W).SmoothPoint} {yd a1 a2 xk' : KE} - (h_yd_ord : (W_smooth W).ord_P P yd = ((1 : ℤ) : WithTop ℤ)) -@@ -717,8 +688,7 @@ theorem ord_P_translateY_T3_coef_nonneg - - omit [Fintype K] [DecidableEq K] [W.toAffine.IsElliptic] in - /-- Nonnegativity of `ord_P` of the `T4` coefficient `−y + a₁·(a₂ + x + xk') − a₃`, given the basic --order data. Extracted from `ord_P_translateY_xy_eq_neg_three_at_2tor` to keep its per-term `ord_P` --bound bookkeeping under the default heartbeat budget. -/ -+order data. -/ - theorem ord_P_translateY_T4_coef_nonneg - {P : (W_smooth W).SmoothPoint} {a1 a2 a3 xk' : KE} - (h_xg_nn : (0 : WithTop ℤ) ≤ (W_smooth W).ord_P P (x_gen W)) -@@ -779,9 +749,9 @@ theorem ord_P_translateY_T4_coef_nonneg - SmoothPlaneCurve.ord_P_add_le (P := P) _ _ - exact (le_min h12' h_neg_a3_nn).trans h123 - --omit [Fintype K] in -+omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Nonnegativity of `ord_P (y_gen)`: the generic `y`-coordinate has no pole at any smooth point, --since its `pointValuation` is `≤ 1`. Extracted from `ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ -+since its `pointValuation` is `≤ 1`. -/ - private theorem ord_P_y_gen_nonneg {P : (W_smooth W).SmoothPoint} : - (0 : WithTop ℤ) ≤ (W_smooth W).ord_P P (y_gen W) := by - by_cases hf : y_gen W = 0 -@@ -794,7 +764,7 @@ private theorem ord_P_y_gen_nonneg {P : (W_smooth W).SmoothPoint} : - have hv : (W_smooth W).pointValuation P (y_gen W) ≠ 0 := - ((W_smooth W).pointValuation P).ne_zero_iff.mpr hf - simp only [SmoothPlaneCurve.ord_P] -- rw [dif_neg hv] -+ rw [dite_eq_right hv] - rw [show (0 : WithTop ℤ) = ((0 : ℤ) : WithTop ℤ) from rfl, - WithTop.coe_le_coe] - have h_unz_le : WithZero.unzero hv ≤ 1 := by -@@ -807,9 +777,9 @@ private theorem ord_P_y_gen_nonneg {P : (W_smooth W).SmoothPoint} : - rw [h1] at h2; exact h2 - omega - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The `T2` term `-(2·a₁·yd²·xd)` has `ord_P ≥ 4` at 2-torsion, given `ord_P yd = 1`, --`ord_P xd = 2` and `ord_P a₁ ≥ 0`. Extracted from `ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ -+`ord_P xd = 2` and `ord_P a₁ ≥ 0`. -/ - private theorem ord_P_translateY_T2_term_ge_four - {P : (W_smooth W).SmoothPoint} {a1 yd xd : KE} - (h_yd_sq : (W_smooth W).ord_P P (yd ^ 2) = ((2 : ℤ) : WithTop ℤ)) -@@ -857,10 +827,9 @@ private theorem ord_P_translateY_T2_term_ge_four - (((2 : ℤ) : WithTop ℤ) + ((2 : ℤ) : WithTop ℤ)) := - add_le_add h_2a1_nn (le_refl _) - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The `T3` term `(yd·(a₂ + 2x + xk') - a₁²·yd)·xd²` has `ord_P ≥ 4` at 2-torsion: the --coefficient is nonnegative (`ord_P_translateY_T3_coef_nonneg`) and `ord_P xd² = 4`. Extracted from --`ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ -+coefficient is nonnegative (`ord_P_translateY_T3_coef_nonneg`) and `ord_P xd² = 4`. -/ - private theorem ord_P_translateY_T3_term_ge_four - {P : (W_smooth W).SmoothPoint} {a1 a2 yd xd xk' : KE} - (h_yd_ord : (W_smooth W).ord_P P yd = ((1 : ℤ) : WithTop ℤ)) -@@ -889,8 +858,7 @@ private theorem ord_P_translateY_T3_term_ge_four - - omit [Fintype K] [DecidableEq K] [W.toAffine.IsElliptic] in - /-- The `T4` term `(-y + a₁·(a₂ + x + xk') - a₃)·xd³` has `ord_P ≥ 6` at 2-torsion: the --coefficient is nonnegative (`ord_P_translateY_T4_coef_nonneg`) and `ord_P xd³ = 6`. Extracted from --`ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ -+coefficient is nonnegative (`ord_P_translateY_T4_coef_nonneg`) and `ord_P xd³ = 6`. -/ - private theorem ord_P_translateY_T4_term_ge_six - {P : (W_smooth W).SmoothPoint} {a1 a2 a3 xd xk' : KE} - (h_xd_cube_eq : (W_smooth W).ord_P P (xd ^ 3) = ((6 : ℤ) : WithTop ℤ)) -@@ -920,8 +888,7 @@ private theorem ord_P_translateY_T4_term_ge_six - - omit [Fintype K] [DecidableEq K] [W.toAffine.IsElliptic] in - /-- Extract `ord_P f = -3` from `ord_P (f · g) = 3` and `ord_P g = 6`: since `f · g` has finite --order, `f ≠ 0`, so `ord_P f` is a finite integer `k` with `k + 6 = 3`. Extracted from --`ord_P_translateY_xy_eq_neg_three_at_2tor` (with `g = xd³`). -/ -+order, `f ≠ 0`, so `ord_P f` is a finite integer `k` with `k + 6 = 3`. -/ - private theorem ord_P_eq_neg_three_of_mul_eq_three - {P : (W_smooth W).SmoothPoint} {f g : KE} - (h_LHS_ord : (W_smooth W).ord_P P (f * g) = ((3 : ℤ) : WithTop ℤ)) -@@ -949,8 +916,7 @@ private theorem ord_P_eq_neg_three_of_mul_eq_three - - omit [Fintype K] [DecidableEq K] [W.toAffine.IsElliptic] in - /-- A four-term sum `d + (A + (B + C))` has `ord_P` equal to that of its dominant term `d` when --`ord_P d = 3` and each of `A`, `B`, `C` has `ord_P ≥ 4`. Extracted from --`ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ -+`ord_P d = 3` and each of `A`, `B`, `C` has `ord_P ≥ 4`. -/ - private theorem ord_P_dominant_sum_eq_three - {P : (W_smooth W).SmoothPoint} {d A B C : KE} - (h_d : (W_smooth W).ord_P P d = ((3 : ℤ) : WithTop ℤ)) -@@ -969,15 +935,14 @@ private theorem ord_P_dominant_sum_eq_three - exact lt_of_lt_of_le (by exact_mod_cast (show (3 : ℤ) < 4 by norm_num)) h_ABC - exact (SmoothPlaneCurve.ord_P_add_eq_of_lt h_strict).trans h_d - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **`ord_P (translateY_xy) = -3` at smooth 2-torsion `T`** via the algebraic - identity `translateY_xy_mul_cube_eq` and the 2-tor ord values --`ord_P (yd) = 1` (shipped at `ord_P_y_gen_sub_negY_const_eq_one_of_2_tor`) --+ `ord_P (xd) = 2` exactly (shipped at `ord_P_x_gen_sub_const_eq_two_at_2tor`). -+`ord_P (yd) = 1` (given by `ord_P_y_gen_sub_negY_const_eq_one_of_2_tor`) -++ `ord_P (xd) = 2` exactly (given by `ord_P_x_gen_sub_const_eq_two_at_2tor`). - At 2-tor the RHS dominant is `-yd³` with ord = 3, all other RHS terms have - ord ≥ 4 (strict); LHS = `translateY · xd³` has ord = `ord(translateY) + 6`, --forcing `ord(translateY) = -3`. Mirrors the non-2-tor proof at --`EC/TranslationOrd.lean:1536`. -/ -+forcing `ord(translateY) = -3`. Mirrors the non-2-tor proof at -/ - theorem ord_P_translateY_xy_eq_neg_three_at_2tor (xk yk : K) - (h_ns : W.toAffine.Nonsingular xk yk) (h_2_tor : yk = W.toAffine.negY xk yk) : - (W_smooth W).ord_P (negSmoothPoint W xk yk h_ns) -@@ -1072,11 +1037,7 @@ theorem ord_P_translateY_xy_eq_neg_three_at_2tor (xk yk : K) - -- ord_P translateY + 6 = 3 ⟹ ord_P translateY = -3. - exact ord_P_eq_neg_three_of_mul_eq_three W h_LHS_ord h_xd_cube_eq - --/-- **Type abbreviation for the y-side substantive value at 2-torsion T**: --`ord_P (translateY_xy) = -3` at the negated point. This is the single --substantive witness the y-side chain reduces to. -- --⟶ Now DISCHARGEABLE via `ord_P_translateY_xy_eq_neg_three_at_2tor` (just shipped). -/ -+/-- The y-coordinate after translation has order `-3` at the negated point. -/ - abbrev TwoTorYValueWitness (xT yT : K) (h_ns : W.toAffine.Nonsingular xT yT) : Prop := - (W_smooth W).ord_P - (negSmoothPoint W xT (W.toAffine.negY xT yT) -@@ -1084,7 +1045,7 @@ abbrev TwoTorYValueWitness (xT yT : K) (h_ns : W.toAffine.Nonsingular xT yT) : P - (translateY_xy W xT (W.toAffine.negY xT yT)) = - ((-3 : ℤ) : WithTop ℤ) - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- **Discharge `TwoTorYValueWitness` from the substantive y-side lemma**: at smooth - 2-torsion `T`, the y-side ord = -3 value follows directly from - `ord_P_translateY_xy_eq_neg_three_at_2tor` applied at the negated coordinates. -/ -@@ -1222,7 +1183,7 @@ theorem bridge_at_y_gen_of_2_tor (xT yT : K) - (twoTorYValueWitness_discharge W xT yT h_ns h_2_tor) - - /-- **Bridge at `f = y_gen^q` for 2-torsion `T` (UNCONDITIONAL)**: pow on the --just-shipped unconditional y-side base bridge. -/ -+the y-coordinate order identity. -/ - theorem bridge_at_y_gen_pow_card_of_2_tor (xT yT : K) - (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) : - (W_smooth W).ord_P (⟨xT, yT, h_ns⟩ : (W_smooth W).SmoothPoint) -@@ -1246,7 +1207,7 @@ theorem bridge_at_y_gen_sub_y_gen_pow_card_of_2_tor (xT yT : K) - (twoTorYValueWitness_discharge W xT yT h_ns h_2_tor) hq - - /-- **Bridge at `(negFrob).pullback y_gen` for 2-torsion `T` (UNCONDITIONAL)**: --mirrors `bridge_at_negFrobeniusIsog_pullback_y_gen_of_non_2_tor` (`PoleDivisorFallback.lean:1034`) -+mirrors `bridge_at_negFrobeniusIsog_pullback_y_gen_of_non_2_tor` - using the now-unconditional 2-tor y-side bridges. The pullback expands as - `-y_gen^q - a₁·x_gen^q - a₃`; strict-comparison isolates `-y_gen^q` with ord `-3q` - as the dominant term. -/ -@@ -1393,7 +1354,7 @@ theorem bridge_at_negFrobeniusIsog_pullback_y_gen_of_2_tor (xT yT : K) - (Conditional.ordAtInfty_neg_y_gen_pow_card_lt_rest W hq) - - /-- **Bridge at T1 = `a₄ · (x_gen + (negFrob).pullback x_gen)` for 2-torsion `T` (UNCONDITIONAL)**: --const_mul on the strict-add bridge (already shipped). -/ -+const_mul on the strict-add bridge (proved). -/ - theorem bridge_at_T1_a4_x_add_pi_x_of_2_tor (xT yT : K) - (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) - (hq : 2 ≤ Fintype.card K) : -@@ -1719,7 +1680,7 @@ under `hq`, **UNCONDITIONAL**. - Mirror of `bridge_at_addPullbackNumerator_negFrobenius_of_non_2_tor`: apply - `ord_P_translateAlgEquivOfPoint_sum_dominant` with dom = T7 (x · π·x², - ord = -2-4q) and the same seven other terms; the per-term bridges are the --2-torsion versions just shipped, and the strict-comparison framework is -+2-torsion versions proved, and the strict-comparison framework is - identical because the `ordAtInfty_T*_ge` bounds are universal in T. -/ - theorem bridge_at_addPullbackNumerator_negFrobenius_of_2_tor (xT yT : K) - (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) -@@ -1811,7 +1772,7 @@ theorem bridge_at_addPullbackNumerator_negFrobenius_of_2_tor (xT yT : K) - /-- **Bridge at `addPullback_x W (negFrobeniusIsog W)`** for 2-torsion T - under `hq`, **UNCONDITIONAL**. Discharges the - `bridge_at_addPullback_x_negFrobenius_of_bridge_at_Num` Conditional consumer --with the just-shipped 2-tor Num bridge. -+with the 2-tor Num bridge. - - Note: `bridge_at_addPullback_x_negFrobenius_of_bridge_at_Num` requires a - non-2-torsion hypothesis only for its appeal to -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/Primitives.lean b/projects/HasseWeil/HasseWeil/HasseBound/Primitives.lean -index 7b7c9f9bdd2de81fd56ed1658ddd95a0088e6cef..bc3351f74e8f72d1c306fa97c7af59533db0a65e 100644 -GIT binary patch -delta 9240 -zcmb_iZH!!18P0ACttZiz#2Q*kIZYdxS!QN;+foo%bSVWEO1o+6R^+4i&diyeL+{)> -zz4y-UPNUocNdXOrxtOR41pFicJ#+nBf)OVl1*P$ij|hTAh_dJh3ggg4X#rbwrqL4 -z+A=Naw+q~~tGp@~r02N2Vws*NJjM>z1$TwlvV0FeEz^%haMR~Uglh|nHyvr?w(sz! -zD;t8#sxU2&OB*5s{P4xRYg&-$cr8~H81CD?thITwWm#pja>V0KP3e(QYf<`jJ_lVZ -zbt%d%dp=T7xDwl_ICfR~(y<}ecg>23g!)o=B~D65J1G>^R+2rK&8F2R)x?5u+q_aY -z@wN}49xw_&z539G?L0SK7S{6d@Mg2(lx4oaIG>rBDeVZ4ub$kmP|}d)3+nn6xSz{v -zitF^$TxqfdVLp`cL=)?jEvN-71Td^|W0Dv7nd3%2-21U_1pAa-)O!j7A+xTqD?&pFrCeW{Bo^wyF|igGOHE5wq|fW^rUQj=xx~UJKhX)MZ7qx& -z#cc+UUg9+k9|1++_CPfcK;VaD25#UjJk2CDlr|j26B@aB;WUKr%1Yw8^jxE5ncQm% -z?A?;bgcndK_;r9EFTGe7HiPMM2lFu2J{XDsbj^mW$%;vSjCHDFi40~;k{#hc29!Cx -zFSkUmU>_xR0FHA&TF|Fq+Hk$nq -zGVBXjL&+#NDu|-M9uht!-fdq>ACqBm%lAJ+rtDDywv0`}6+&cL#I8hsE}K}lCWTcE -zf4=n(yQ5W895b@Cqmm~^xpatGO5w!#mEmtc{k?#6iK4Nnb6Js)j2)d~ELt$tm|`9g -z(X$APputv}NHhY~saoPU#t~*(7HX2$s?;fksk%}(5n6auR$I{qxj2ec9PNUo8z;j- -zZo@nRTN5-<+Kq$NSbp&9TpXU|HT;|6wgIu#7K{rulY4Z%H|WmOR=KJ0)Jj4koG7ka -zP5x#=&2S{QuJgO%H6!bI?#u~}P|wXeR@-(O$P4_IPHueDkXzy5iLr6U#*3TzmMxhY -z7?oxf<*Le2X+`OzDi^NV`PG2lDe`GvLk)9Wc}%AgI3H4yFDX6hE9Evfjv7G1bz1ZF -z%nD7{S%6Fg1j7SG#Ifr*zDkukhJ>XuHEgbM?3Q~$nn7g4oEIh58NcfHBkc1wlBw%q -z*WszD3-?0XY)NU+OkG+L-5lsZ*# -zk(F&Rudg6SI97{pMpbjp(EI}SP2_U})wjSc;p5Z&1}`I8BSOLfSS(B@0mXeto-xOl -zAN*#3$_>Z4{pg(r*BQ^q&5iM6`MZwl%lM4CH%)AV+@BUG@RmoPDGgOp^>wZ6238k< -z=y6*m(gkp|6rOQnZi%*D-B~0*H+_bMNIwo`rszNVjJ3m`)i#Dd*tfp(%ylE@Uq74K -zrm2C+0v~AytLe0rc{%}wh0pEZ*qONbmGf0fh_6$*jF9KB4B51p0$y=Y(xi>*4`$hC -z!9)gJ-S%p5Amwsk3wG6Xt69-$81Py^Wqrv|mBVPm$*J}Vi9D3B%NA-Y9-2cqqe`ln -zq3BH(%qU%xOW3yoyxIr$YP!<2eGmacB?f`L?`Cxh0%raqSU!Li)neIPUpd0Fs{tihgW*8KHXk1A -z+;e+4ddEz(9+GSKg1l*gw`&`J;2xNf?g1vb1*{0h>})>#&PV{Q(6h`78%d6c@tmQ9 -zKJsj`U)H-3Tb|cKn?f0*TYEfa$ST+&v9BWK47DBQTH2=uC>mtYMumzAx9P)SRYh)> -zcrOSnMm+@qE|w95bQ^6_H8YCB>pY`^qXMr|nG>1@Om=4o+E<31nby20yC$zY4g7JN -zD2$DQX8Niy_rq6WGe}V=DU@9CH!ajaM**Bo%^%lflydX7T%~iW_MKI?QZx*JDzia? -zIwz|IUi<*RRKBz+e0^z6__@}a@ZsBK_)1`ePd>XUyylMS@R2WH+SzclJn~WanNx$C -zr8*@hAa5oOHgp=^zej>;-BD!>oFN*DgJhwOA}}LXr*jlbLP=S+>>xB$vxdI3x2uup -zYEo{`&5pD1?y6v>-{$>GYmXV=9;qSN`{>%eZne6L()YAAf0NVbTpK(yiXv=#zT2w! -zDwcYJkk?$NfoM>Pvp)zm>8|)J8-kgfO-wSihAxOvFB_B1OX!*IxQyE|1#WoT{hQGu -z4eVRpMk14l~AS0#LgP1doUSZo@UB3MM^fLjD~o -zwWGiTZK3*Bppv84C+8!v6%<+&Xc`Dn(xginR^8Wu&Xle|eBScJC7n0FR>m&%a6{>+ -zhBC^<)lfmt7YyG;9;b$Ol3zxoT>Vy5pY%)vMM`-sGw5z~t?zj)1_Z0CWm=7q%eK;X -zV7~LQwIjid9y7%pSaF%T%s?q|Hr-doHlcl+s3imamYX!biHH%QGgu&6LoZN~fi7Fc -zfics_5$t)s{FM_Nzrb!NVf;EwF4T^@ydcKjGf}4^3XU|;6Z9#uN^~ba5A~=m3bYZC -z#c19^6|D`6NB-jpjC~R^#!);4+B01fYb{$lzUm=+FxC^VZXQKQk;B9s8O{gZIR@gH -zaAet_@d1d?Ko~l2e|t)k84{HtjHK;Agi)UK98GPnKzu!u=BWKn!9fLsr9cREvlvBN -z(^-TsWKvw`;1latDn|8Tlpt(B3MD4KyME>TZt7}P2zFU7$~G{IrlT345(kKTA=U-k -zz#Par7d`!`qEB(DPO=Im))YXp0yQm!i>6j_@=mE>FB8-gu2}F;Zpw@xC3bL+Jug3x -z#GttG9!-qz!;d9&Rp51*oW+biND8@je50M`<2;u>N1>%g0D9`^=^&(l^#rCqs>4-d -zJF{R{S-RC2$01&?Xzj(%-m`LdYNA?_N1|2Iz>3QQ48|CSlF9+euF*&=e962hAauLC -zzeFJHK{Hd2)u@zeCyoYK+NtBfB_fwD3mnss*X^sI*HlTNSvw61frzS9pS6oB&bcLP -zer60pkE9}ty)=QqQ_&Ot<0l)g+^xmy{LyFhXr-=&s6;Ip;j1UNbRK@8z2ZYkXd9hZ -zPg*O2TTLIw1OQm6c}Ou_)Usa9vuc^vMH -z{o?Ua>O;`h>)|@gW2ovihlGz7Jg#JDO%CF@0T~lvkekg@X*|kj5(VHhFlSd;xXYm@q-|P^qG2jYBSaOobCck{18q1$uZS24(Lrp7jzmyGumwV -zIAB!gA8ndKYi1e6Ud+aT4#`l9W9<#J_$+Q>L-QC?Hj|+q3%8z~3@2W@IT*g1x-qYOj6x5Inqn`eW|RZR -z3be{N9zuGN&`AL%ueHeiXnCdPIEG)!vQ-(5y}owr -zYQ?{{moCqoT;jxu2IO`{HZehsOznkN{^{}X)SIiqEq|W9diMeycE(_53>_tWWpA`< -ziN$G`+Th`D{&?YS@#r!!L6;-p=n6exG%SeM?{#^~HhRO#`Sh=shfghkOKJJw8+(fx -zf9Q1woi?*}3b&ozawIhtjth$2hq+8Eo5V!w^IBD$IIDK0+wq6k30=-3Z}WAt3CyWK -z@o>%A%SKpu_1O*6yl&!fTFd1spoTeRUn>Q0kPpJse|x%f>dk+Rg#Y>bTO$XUIq+lUh~< -zJwgLRkN8*wp6&|JO`zt0CE+-ZVhx8pI5J4}ZP}6o;j_By_^A(+*cVUKjY -zPX+n(V|@9cC;3ENT{8;|!7b^R;#k(E(7jWjCfOV=ftkL?Z7673gZyW*v?H#tbilI( -zhg{TdSv;$B!>I}@YXA2L#C#Q)sEcUaz>25%QjTWDlX>;y^vQgHwoXklk#xGg#*oA@ -zXfB8&gCR9YklMFy7A&5EMcM!Jmfb}39TQ|5q(4n7flT7KVhNNJ -zMpUC_)lp=8kSPppikiaEWxE@GK65^ug5#SRTmSoFu&WD%B2B8bO;lSGL5uC)9rw3J -zPBj`+d;%Qphtzf4511#2u|3V>dz0PwFcXHKLa-0AhkY^}!y@;?2QCI9#usP$l~ACB -zzj|lu-t_Q(8fW*>JeMj>^3{j|uV?pg6=P$3pBmA)?QqAri3>`&a3EHJGzi=0Cf1>* -Rs55!BCGGRbU?={!^Zyl&|9Joa - -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/SepDegreeEqPointCount.lean b/projects/HasseWeil/HasseWeil/HasseBound/SepDegreeEqPointCount.lean -index b0f7c26f8594ff8704015e2653ececd9d147c830..fcdb5384128782484b7f84f20c3c1e14fb287923 100644 -GIT binary patch -delta 1421 -zcmaKs&x;gC6vvs-_@fCT5z&jwOJ>CxogNt!4I38^>jq&^7M0B@acX+rOqX_7HC5H~ -z10j=BPTuO6z3R!3NRvYX@#t~If5U@E&v{kdGhs!9fuXyr-uu?)eZTc$v3L8=Ms0B) -zGp5)eK^Wp#Ap#RaFfoG2(*Y`wBT&q6DOduTDCX6;y;f}`amRHuN -z9iLa$2_BGeZD?zXq!b32$SFiJ&7?-aS(fmKo3e8oGR4ztNNU_UoeU=-lxm17i07Fk -z3L14AxG3dIl|rtOEao}|Nx0}EGi49Ef8w1zeDX>0>g3-w`~0hW -zi{Nq?dM=;xUPXoQjL32aOx$*6QK;RtbIrw=Y)WG{s8SqqN4)efVM2-rts2a|%H;ve -zDV;btCcAg~S+RR|z5c(h(iqe~%@gJ=DI%V+BwQw;LSL;|*_2G33lmgxEqhZ^4n~>g -z)nBI4PuTg!<@)p|gKeL!{ZZ_;KGf~|Z;sgQ#+`Gp0b4OsJJ5p+HZ~#lPXR#8CTL$a -zp4+GEZ|%?LCwEt%S0chnc`4C(@Z%U&$Zj*j>>MbFHwbsAO$- -zLHKm~OrkQJRnF9_oJ7n=B5|g#g5q}vKIL=|(TznEROxufgR)!Zr0P(CZ^If-v!t4; -zyZ9(?gnVThqSY-PbbqTCjjKoMr=WSy5!#W-T*#EuZP_cLYsYKFzt?}Q6VBC~YRN{2)9t6}5oq#TK<0dw!* -z$w@b_e4e>OqNg$-ou2H13_AS)rb<2~Ocx3v$4Ji2K~`eCo11F>w1&WVFR#gbp8Yyu -zKv=0%mR0Jiw>E4}yE6;T6-E2O^pCpMZ?MyH$R3)h2Evh`!e&2gY@9yAY@N{IyxDQ> -zloChEH*L+0)AuA&?g`8=j{G>wY?=N2^r5`~twfHyufl&9b{Cj;s23ANN&KU7jH;q6 -zvooloz1OI6rI`((pk&p|Y+G(7m{V4^C7B0St#laoJ-@~*Sz83=Ryv8|-&phZO`b&a -z*;lp=F<4W9x&N(K2ZGbgKl(<0n3q1B2j=F^H3Q?0XnO`M -zH&1;!ILSQt`PsgL&oooMbf)pvG&p@DMlQC_89-t&ix(8Y6S2+lUfG?q8b-$!zzh7< -zBB8bwKUTmC(Fm#cJ}&l+lLoO8HY+qO;`XU-R!9{Em`kq3@C?1V -z7~Z3npTHiPvjlc0Im5MzrYn9r9f6U2rwq+~2c)fs;k-iuS0b=wF=XfWp%2qc$h~JKOl!yEx^kv(ho5c`1~?-06#njm-Tq(sFmv# -z?w^MnCBAMk&P=4vrFft9mBpu3qL{a*9>t0kf)`BnSX39(jVekFG2PaU>~m`Mip~`A -z6=4?N1rrsYXA}!*ObrV&C8T=lVyi-*Hob4yx!6?Z)7%24E}#k?`_<(FO_)_Rj*e7K -zwyYNjSAMldb;l$g@F`B6lmcr`zZiafeKNET>eu2}e09gIdVWpmh^|1ol(g -zOE?_q>uq>|#qI~w6}Re_?*`<0wn(dU+)u-=I+9_RQnLHr+;iVYc-U=3sbY%qAIJiQJM+{dRTQNYFtI{ -z?!sZTVGj<1Dmu0s|N5;ya*dY`4dLcqOEmfK;NPO%o_GlJ>{>a>i&!aLco7R`6c^ip -z)ToV$r&w^fuG_s(iCe1+2=aRs&98)YabgEGpP1X#k+^KSM|4sLc2dJ*$Y|SnOyh;e -z@oH=W_M|1rCvl;5m77n&e_|p}`3nwC;OsQ+=^!8ReA=ge_xwgUlYXXRA%@ -zN*aCyvmH#l=FfEDKIB~&u?bRH;e3mZ<(e-N5a+ZwEN9ck%lM-k(xZV_L|T hf ?_, hc⟩ - simpa [h] using hc - -+omit [DecidableEq F] in - /-- If `τ g / g` has trivial projective divisor, then `τ g` is a nonzero scalar multiple - of `g`. -/ - theorem pairing_const_of_transport [IsAlgClosed F] [W.IsElliptic] -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorPullback.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorPullback.lean -index aa75199b4..8789a8842 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorPullback.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorPullback.lean -@@ -10,55 +10,23 @@ import HasseWeil.HasseBound.WeilPairing.SigmaBridge - import HasseWeil.HasseBound.WeilPairing.TorsionGeometric - - /-! --# Divisor-pullback functoriality for the separable multiplication-by-`ℓ` isogeny -+# Divisor pullback for multiplication by `ℓ` - --For a separable isogeny `φ = [ℓ]` (`(ℓ : F) ≠ 0`, `[IsAlgClosed F]`) and a nonzero rational --function `h ∈ K(E)`, the divisor of the pulled-back function `φ.pullback h` equals the geometric --pullback of `div h`: --``` --divisorOf (φ.pullback h) = pullback-of-divisor (divisorOf h). --``` --Because `[ℓ]` is **separable** (unramified — every fibre is étale, multiplicity `1`), the pullback --of a single place `(Q)` is the multiplicity-free fibre sum `Σ_{φP=Q} (P)` (the repo's --`pullbackDiv`, `WeilPairing/Pullback.lean`). The geometric heart is the per-place --**unramified order-transport** --``` --ord_P (φ.pullback h) = ord_{φ(P)} (h) (no ramification factor `e_P > 1`), --``` --which, summed over all places, yields the divisor identity. This is Silverman III.4.10c / --III.8.1–2 in divisor language: the geometric content of the separability of `[ℓ]`. -- --## Architecture -- --* **Item 1 — the core (`OrdTransport` / `ordTransport_mulByInt`).** The per-place transport -- `ord_P P (φ.pullback h) = (ord of h at φ(P))` is the deep geometric unramifiedness statement. -- It is the exact isogeny analogue of the translation order-transport proven in -- `EC/TranslateValuation.lean` + `EC/TranslateOrdInfty.lean` (≈5000 lines): a valuation on `K(E)` -- pinned by its values on `x_gen`, `y_gen`. For an isogeny the base values -- `ord_P P (φ.pullback x_gen)`, `ord_P P (φ.pullback y_gen)` are the `ℓ`-division-polynomial orders, -- whose computation is the genuine ramification content. We **isolate** this as the named predicate -- `OrdTransport` (a per-`(P, φ)` hypothesis bundling the projective place transport) and prove the -- full divisor assembly on top of it. -- --* **Item 2 — the assembly (`projectiveDivisorOf_pullback_eq_pullbackDivisor`).** Given the core -- for every place, the projective divisor of `φ.pullback h` equals the fibre-pullback of the -- projective divisor of `h`. This is a pure `Finsupp` computation: every coefficient matches by -- the core, and the supports are related by the (finite) fibre structure. Fully proven modulo the -- core. -- --* **Item 3 — the pairing-facing corollaries.** `pullback_divisorOf_eq_of_divisorOf_eq` (the -- shape bilinearity-in-`T` and nondegeneracy consume) and the III.8.1 relation -- `weilFunction_pow_mem_pullback_range`-style statement, parametric on the core. -- --Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10c, III.8.1, III.8.2. -+For a separable multiplication-by-`ℓ` isogeny over an algebraically closed field, -+the geometric pullback of a place is the multiplicity-free fiber sum. -+The per-place hypothesis `OrdTransport` expresses the unramified order identity -+`ord_P (φ*h) = ord_{φ(P)} h`, including the projective place at infinity. -+Summing these identities over all places identifies the projective divisor of -+`φ*h` with the fiber pullback of the divisor of `h`. -+ -+References: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10c, -+III.8.1, and III.8.2. - -/ - - open WeierstrassCurve HasseWeil.Curves - - namespace HasseWeil.WeilPairing.DivisorPullback - --set_option linter.unusedSectionVars false -- - variable {F : Type*} [Field F] [DecidableEq F] {W : WeierstrassCurve.Affine F} [W.IsElliptic] - - /-- Local abbreviation for the function field `K(E)` (`= (⟨W⟩ : SmoothPlaneCurve F).FunctionField`), -@@ -70,6 +38,7 @@ local notation3 "KE" => W.toAffine.FunctionField - noncomputable def projOrdAt (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField) (Q : W.Point) : ℤ := - (⟨W⟩ : SmoothPlaneCurve F).projectiveDivisorOf f Q.toProjectiveSmoothPoint - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W] in - theorem projOrdAt_some (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField) {x y : F} - (h : W.Nonsingular x y) : - projOrdAt f (Affine.Point.some x y h) = -@@ -77,6 +46,7 @@ theorem projOrdAt_some (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField) {x y : - rw [projOrdAt, Affine.Point.toProjectiveSmoothPoint_some, - (⟨W⟩ : SmoothPlaneCurve F).projectiveDivisorOf_apply_affine f ⟨x, y, h⟩] - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W] in - theorem projOrdAt_zero (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField) : - projOrdAt f (0 : W.Point) = ((⟨W⟩ : SmoothPlaneCurve F).ordAtInfty f).untopD 0 := by - rw [projOrdAt, Affine.Point.toProjectiveSmoothPoint_zero, -@@ -107,7 +77,7 @@ theorem coeff_affine_pullback_eq {φ : Isogeny W W} - - /-- **The fibre-pullback of a projective divisor** under a point-map endomorphism with finite - kernel: `φ*(D) = Σ_v D(v) · pullbackDiv(v)`, the `ℤ`-linear extension of the multiplicity-free --fibre pullback `pullbackDiv` (`WeilPairing/Pullback.lean`) over the (projective) places of `D`. -+fibre pullback `pullbackDiv` over the (projective) places of `D`. - The place at infinity pulls back to `pullbackDiv f h 0 = Σ_{φP=O}(P)` (the kernel). -/ - noncomputable def pullbackDivisor (f : W.Point →+ W.Point) (hf : Finite f.ker) - (D : ProjectiveDivisor (⟨W⟩ : SmoothPlaneCurve F)) : -@@ -154,10 +124,10 @@ theorem pullbackDiv_apply (f : W.Point →+ W.Point) (hf : Finite f.ker) - (Q : W.Point) (w : ProjectiveSmoothPoint (⟨W⟩ : SmoothPlaneCurve F)) : - pullbackDiv f hf Q w = if f w.toAffinePoint = Q then 1 else 0 := by - classical -- letI : Fintype {R : W.Point // f R = Q} := @Fintype.ofFinite _ (fiber_finite f hf Q) -+ let : Fintype {R : W.Point // f R = Q} := @Fintype.ofFinite _ (fiber_finite f hf Q) - rw [pullbackDiv, Finsupp.finsetSum_apply] - by_cases hwQ : f w.toAffinePoint = Q -- · rw [if_pos hwQ] -+ · rw [ite_eq_left hwQ] - have hwproj : (⟨w.toAffinePoint, hwQ⟩ : {R : W.Point // f R = Q}).val.toProjectiveSmoothPoint = - w := Affine.Point.toAffinePoint_toProjectiveSmoothPoint w - rw [Finset.sum_eq_single (⟨w.toAffinePoint, hwQ⟩ : {R : W.Point // f R = Q})] -@@ -173,7 +143,7 @@ theorem pullbackDiv_apply (f : W.Point →+ W.Point) (hf : Finite f.ker) - exact Subtype.ext hRval - · intro hni - exact absurd (Finset.mem_univ _) hni -- · rw [if_neg hwQ] -+ · rw [ite_eq_right hwQ] - refine Finset.sum_eq_zero (fun R _ ↦ ?_) - rw [Finsupp.single_eq_of_ne] - intro hcontra -@@ -209,9 +179,9 @@ theorem pullbackDivisor_apply (f : W.Point →+ W.Point) (hf : Finite f.ker) - intro v _ - rw [Finsupp.coe_smul, Pi.smul_apply, pullbackDiv_apply, smul_eq_mul] - by_cases hv : f w.toAffinePoint = v.toAffinePoint -- · rw [if_pos hv, mul_one, if_pos] -+ · rw [ite_eq_left hv, mul_one, ite_eq_left] - rw [hv, Affine.Point.toAffinePoint_toProjectiveSmoothPoint] -- · rw [if_neg hv, mul_zero, if_neg] -+ · rw [ite_eq_right hv, mul_zero, ite_eq_right] - intro hcontra - apply hv - have := congrArg ProjectiveSmoothPoint.toAffinePoint hcontra -@@ -219,8 +189,8 @@ theorem pullbackDivisor_apply (f : W.Point →+ W.Point) (hf : Finite f.ker) - rw [Finset.sum_congr rfl hterm, - Finset.sum_ite_eq D.support (f w.toAffinePoint).toProjectiveSmoothPoint (fun v ↦ D v)] - by_cases hmem : (f w.toAffinePoint).toProjectiveSmoothPoint ∈ D.support -- · rw [if_pos hmem] -- · rw [if_neg hmem, Finsupp.notMem_support_iff.mp hmem] -+ · rw [ite_eq_left hmem] -+ · rw [ite_eq_right hmem, Finsupp.notMem_support_iff.mp hmem] - - /-- **The per-place core, projective form.** For the isogeny `φ`, the coefficient of - `projectiveDivisorOf (φ.pullback h)` at the projective place `w` equals the coefficient of -@@ -336,7 +306,7 @@ theorem inftyOrdTransport_mulByInt (ℓ : ℤ) (hℓ : ℓ ≠ 0) (hℓF : (ℓ - rw [hm, hn, WithTop.untopD_coe, WithTop.untopD_coe] - omega - --/-- **Comap-valuation identity, affine-image case** (proven, axiom-clean). The comap of -+/-- **Comap-valuation identity, affine-image case** . The comap of - `pointValuation P` along `[ℓ].pullback` equals `pointValuation` at the affine image smooth point - `⟨x, y, h_ns⟩`. This is the unramifiedness of `[ℓ]` at an affine image (Silverman III.4.10c). -/ - theorem comap_pointValuation_mulByInt_eq_affine [IsAlgClosed F] (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) -@@ -529,8 +499,7 @@ Hence `φ.pullback f_T` and `g_T^ℓ` have the *same* divisor, so they differ by - (`Constancy`): the relation `f_T ∘ [ℓ] = c · g_T^ℓ` that nondegeneracy consumes. - - Parametric on the per-place core `ProjOrdTransport [ℓ]` (`= projOrdTransport_mulByInt`), and on the --finiteness of `ker[ℓ]` (the caller supplies `mulByInt_ker_finite`, keeping this file decoupled from --`Pairing.lean`/`TorsionCardEll`). The conclusion's right side is exactly `ℓ • (div g_T)`. -/ -+finiteness of `ker[ℓ]`. The conclusion's right side is exactly `ℓ • (div g_T)`. -/ - theorem projectiveDivisorOf_pullback_weilFunction (ℓ : ℤ) - [hker : Finite (mulByInt W ℓ).toAddMonoidHom.ker] (hcore : ProjOrdTransport (mulByInt W ℓ)) - (T : W.Point) {fT : (⟨W⟩ : SmoothPlaneCurve F).FunctionField} -@@ -573,7 +542,7 @@ divisor the Abel–Jacobi divisor `D = (T₁+T₂) − (T₁) − (T₂) + (O)`, - they differ by a constant. - - Parametric on the per-place core `ProjOrdTransport [ℓ]` (`= projOrdTransport_mulByInt`) and the --finiteness of `ker[ℓ]` (caller-supplied, decoupling this file from `Pairing.lean`). -/ -+finiteness of `ker[ℓ]`. -/ - theorem projectiveDivisorOf_pullback_bilinFunction (ℓ : ℤ) - [hker : Finite (mulByInt W ℓ).toAddMonoidHom.ker] (hcore : ProjOrdTransport (mulByInt W ℓ)) - (T₁ T₂ : W.Point) {k : (⟨W⟩ : SmoothPlaneCurve F).FunctionField} -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorTranslate.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorTranslate.lean -index 5aa369762..ba8eced54 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorTranslate.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorTranslate.lean -@@ -11,7 +11,7 @@ import HasseWeil.HasseBound.WeilPairing.WeilFunction - /-! - # Divisor transport under translation - --This file proves the projective divisor transport facts for translation by a -+We prove the projective divisor transport facts for translation by a - point on a Weierstrass curve, as used in the Weil pairing construction. - - ## Main definitions -@@ -38,8 +38,6 @@ namespace HasseWeil - - open HasseWeil.WeilPairing - --set_option linter.unusedSectionVars false -- - variable {F : Type*} [Field F] [DecidableEq F] - variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] - -@@ -53,6 +51,7 @@ noncomputable def placeTranslate (S : W.toAffine.Point) : - ((Equiv.addRight S).trans - (WeierstrassCurve.Affine.Point.equivProjectiveSmoothPoint (W := W.toAffine))) - -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - theorem placeTranslate_apply (S : W.toAffine.Point) - (v : ProjectiveSmoothPoint (W_smooth W)) : - placeTranslate W S v = -@@ -60,6 +59,7 @@ theorem placeTranslate_apply (S : W.toAffine.Point) - (v.toAffinePoint + S) := by - rfl - -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - @[simp] theorem placeTranslate_affine (S : W.toAffine.Point) - (P : (W_smooth W).SmoothPoint) : - placeTranslate W S (ProjectiveSmoothPoint.affine P) = -@@ -68,6 +68,7 @@ theorem placeTranslate_apply (S : W.toAffine.Point) - rw [placeTranslate_apply] - rfl - -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - @[simp] theorem placeTranslate_infinity (S : W.toAffine.Point) : - placeTranslate W S ProjectiveSmoothPoint.infinity = - S.toProjectiveSmoothPoint := by -@@ -75,6 +76,7 @@ theorem placeTranslate_apply (S : W.toAffine.Point) - change (((0 : W.toAffine.Point) + S)).toProjectiveSmoothPoint = _ - rw [zero_add] - -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Translation by `O` is the identity place permutation. -/ - @[simp] theorem placeTranslate_zero : - placeTranslate W (0 : W.toAffine.Point) = Equiv.refl _ := by -@@ -89,13 +91,16 @@ noncomputable def ordProj (v : ProjectiveSmoothPoint (W_smooth W)) - | ProjectiveSmoothPoint.affine P => (W_smooth W).ord_P P f - | ProjectiveSmoothPoint.infinity => (W_smooth W).ordAtInfty f - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - @[simp] theorem ordProj_affine (P : (W_smooth W).SmoothPoint) (f : KE) : - ordProj W (ProjectiveSmoothPoint.affine P) f = (W_smooth W).ord_P P f := rfl - -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - @[simp] theorem ordProj_infinity (f : KE) : - ordProj W ProjectiveSmoothPoint.infinity f = (W_smooth W).ordAtInfty f := rfl - - set_option backward.isDefEq.respectTransparency.types false in -+omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The coefficient of `projectiveDivisorOf f` at `v` is `(ordProj v f).untopD 0`. -/ - theorem projectiveDivisorOf_apply_ordProj (f : KE) - (v : ProjectiveSmoothPoint (W_smooth W)) : -@@ -119,6 +124,7 @@ theorem ord_P_translate (P : (W_smooth W).SmoothPoint) - · exact translate_ord_eq_all_nonzero W P xk yk h_ns h f hf - - set_option backward.isDefEq.respectTransparency.types false in -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - /-- If `P + S` is finite, `placeTranslate W S (affine P)` is the translated affine place. -/ - theorem placeTranslate_affine_of_isSome (S : (W_smooth W).toAffine.Point) - (P : (W_smooth W).SmoothPoint) -@@ -132,6 +138,7 @@ theorem placeTranslate_affine_of_isSome (S : (W_smooth W).toAffine.Point) - P S h).symm - - set_option backward.isDefEq.respectTransparency.types false in -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - /-- When `P + S = O` (the translate hits infinity), the place - `placeTranslate W S (affine P)` is the place at infinity. -/ - theorem placeTranslate_affine_eq_infinity (S : (W_smooth W).toAffine.Point) -@@ -283,6 +290,7 @@ theorem projectiveDivisorOf_translate_div_eq_zero_of_invariant - _ = 0 := by rw [hself, sub_self] - - set_option backward.isDefEq.respectTransparency.types false in -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The `toAffinePoint` of a translated place is `w.toAffinePoint + S`. -/ - theorem placeTranslate_toAffinePoint (S : (W_smooth W).toAffine.Point) - (w : ProjectiveSmoothPoint (W_smooth W)) : -@@ -299,7 +307,7 @@ theorem pullbackDiv_apply (f : W.toAffine.Point →+ W.toAffine.Point) - (w : ProjectiveSmoothPoint (W_smooth W)) : - pullbackDiv (W := W.toAffine) f hker Q w = - if f w.toAffinePoint = Q then (1 : ℤ) else 0 := by -- letI : Fintype {P : W.toAffine.Point // f P = Q} := -+ let : Fintype {P : W.toAffine.Point // f P = Q} := - @Fintype.ofFinite _ (fiber_finite f hker Q) - rw [pullbackDiv, Finset.sum_apply'] - simp only [Finsupp.single_apply] -@@ -314,19 +322,19 @@ theorem pullbackDiv_apply (f : W.toAffine.Point →+ W.toAffine.Point) - rw [hPeq, - WeierstrassCurve.Affine.Point.toAffinePoint_toProjectiveSmoothPoint] - by_cases hQ : f w.toAffinePoint = Q -- · rw [if_pos hQ, Finset.sum_eq_single (⟨w.toAffinePoint, hQ⟩ : -+ · rw [ite_eq_left hQ, Finset.sum_eq_single (⟨w.toAffinePoint, hQ⟩ : - {P : W.toAffine.Point // f P = Q})] -- · rw [if_pos ((hkey w.toAffinePoint).mpr rfl)] -+ · rw [ite_eq_left ((hkey w.toAffinePoint).mpr rfl)] - · rintro ⟨P, hP⟩ _ hne -- rw [if_neg] -+ rw [ite_eq_right] - intro hPw - exact hne (Subtype.ext ((hkey P).mp hPw)) - · intro h - exact absurd (Finset.mem_univ _) h -- · rw [if_neg hQ] -+ · rw [ite_eq_right hQ] - apply Finset.sum_eq_zero - rintro ⟨P, hP⟩ _ -- rw [if_neg] -+ rw [ite_eq_right] - intro hPw - exact hQ (by - rw [← (hkey P).mp hPw] -@@ -366,6 +374,7 @@ theorem equivMapDomain_placeTranslate_pullbackDiv (S : (W_smooth W).toAffine.Poi - rw [Finsupp.equivMapDomain_symm_apply] - exact pullbackDiv_placeTranslate_apply_general W S f hker Q w - -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - /-- `equivMapDomain` fixes a divisor invariant under `placeTranslate W S`. -/ - theorem equivMapDomain_placeTranslate_symm_eq_self - (S : (W_smooth W).toAffine.Point) -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Fiber.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Fiber.lean -index 2d0e9d56e..5a54b5281 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Fiber.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Fiber.lean -@@ -6,20 +6,6 @@ Authors: Chris Birkbeck - import Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Point - import Mathlib.Tactic - --/-! --# Route 2A — fibres of point-map endomorphisms as kernel cosets (keystone foundation) -- --The multiplicity-free geometric divisor pullback `β*((Q)) = Σ_{βP=Q} (P)` (separable case, used by --both the Weil-pairing construction and the separable adjoint, Silverman III.8) is summed over the --**fibre** `{P : βP = Q}`. This file ships the group-theoretic foundation: a fibre of a point-map --endomorphism is a coset of the kernel, hence finite when the kernel is finite. -- --This is the point-map (`AddMonoidHom`) form of the project's `EC.Isogeny` fibre machinery — the --level at which the Weil pairing and the pullback divisor operate. -- --Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4 (fibres of an isogeny are cosets of --the kernel). ---/ - - namespace HasseWeil.WeilPairing - -@@ -29,8 +15,7 @@ open WeierstrassCurve - - variable {F : Type*} [Field F] [DecidableEq F] {W : WeierstrassCurve.Affine F} [W.IsElliptic] - --/-- **Fibre as a kernel coset.** Given `f P₀ = Q`, the fibre `{P : f P = Q}` is in canonical --bijection with `ker f` via `P ↦ P − P₀`. -/ -+ - def fiberEquivKer (f : W.Point →+ W.Point) {P₀ Q : W.Point} (hP₀ : f P₀ = Q) : - {P : W.Point // f P = Q} ≃ f.ker where - toFun := fun ⟨P, hP⟩ => ⟨P - P₀, by rw [AddMonoidHom.mem_ker, map_sub, hP, hP₀, sub_self]⟩ -@@ -38,16 +23,15 @@ def fiberEquivKer (f : W.Point →+ W.Point) {P₀ Q : W.Point} (hP₀ : f P₀ - left_inv := fun ⟨P, hP⟩ => by simp - right_inv := fun ⟨T, hT⟩ => by simp - --/-- **Fibres are finite when the kernel is.** -/ -+ - theorem fiber_finite (f : W.Point →+ W.Point) (h : Finite f.ker) (Q : W.Point) : - Finite {P : W.Point // f P = Q} := by - rcases Classical.em (∃ P₀, f P₀ = Q) with ⟨P₀, hP₀⟩ | hempty - · exact Finite.of_equiv _ (fiberEquivKer f hP₀).symm -- · haveI : IsEmpty {P : W.Point // f P = Q} := ⟨fun ⟨P, hP⟩ => hempty ⟨P, hP⟩⟩ -+ · have : IsEmpty {P : W.Point // f P = Q} := ⟨fun ⟨P, hP⟩ => hempty ⟨P, hP⟩⟩ - infer_instance - --/-- **Fibre cardinality = kernel cardinality** (for a nonempty fibre). The constant fibre size that --makes `deg = #ker` for a separable isogeny (Silverman III.4.10c). -/ -+ - theorem fiber_card_eq_ker_card (f : W.Point →+ W.Point) {P₀ Q : W.Point} (hP₀ : f P₀ = Q) : - Nat.card {P : W.Point // f P = Q} = Nat.card f.ker := - Nat.card_eq_of_bijective _ (fiberEquivKer f hP₀).bijective -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobMatrixData.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobMatrixData.lean -index 30cf18d00..7da5769f2 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobMatrixData.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobMatrixData.lean -@@ -9,7 +9,7 @@ import HasseWeil.Isogeny.BaseChange.Basic - /-! - # Frobenius matrix data over the algebraic closure - --This file supplies the per-`ℓ` Frobenius-matrix determinant data used by -+The per-`ℓ` Frobenius-matrix determinant data give the hypotheses of - `hasse_bound_via_weil_pairing`, after base-changing `E/K` to `AlgebraicClosure K`. - - ## Main definitions -@@ -29,10 +29,6 @@ This file supplies the per-`ℓ` Frobenius-matrix determinant data used by - * Silverman, *The Arithmetic of Elliptic Curves*, III.8.1 (the pairing + Galois equivariance), - III.8.6 (`det φ_ℓ = deg φ`), V.1.1 / V.2.3.1 (the Hasse bound assembly). - --## Name-clash note -- --`pullbackDivisor_kappaDivisor` is declared in both `HfactLemma.lean` and `PairingNondeg.lean`. --This file imports neither directly, so no clash arises and no rename is needed. - -/ - - open WeierstrassCurve Real Matrix -@@ -155,7 +151,7 @@ theorem frob_det_residual_baseChange - (1 - M).det = ((Fintype.card K + 1 - - isogTrace (frobeniusIsog W) (isogOneSub_negFrobenius W hq) : ℤ) : ZMod ℓ) ∧ - ((r' : ZMod ℓ) • M - (s' : ZMod ℓ) • 1).det = (deg r' s' : ZMod ℓ) := by -- letI : Fact ℓ.Prime := ⟨hℓp⟩ -+ let : Fact ℓ.Prime := ⟨hℓp⟩ - obtain ⟨hπ, h1, hrs⟩ := hsc - have hDd : ((deg r' s').toNat : ℤ) = deg r' s' := Int.toNat_of_nonneg (hdeg_nonneg r' s') - exact frob_det_residual_of_weil_scaling (W.baseChange L) ℓ hℓF -@@ -193,7 +189,7 @@ theorem hres_of_baseChange_scalings - (1 - M).det = ((Fintype.card K + 1 - - isogTrace (frobeniusIsog W) (isogOneSub_negFrobenius W hq) : ℤ) : ZMod ℓ) ∧ - ((r' : ZMod ℓ) • M - (s' : ZMod ℓ) • 1).det = (deg r' s' : ZMod ℓ) := by -- haveI : CharP L p := charP_of_injective_algebraMap (FaithfulSMul.algebraMap_injective K L) p -+ have : CharP L p := charP_of_injective_algebraMap (FaithfulSMul.algebraMap_injective K L) p - obtain ⟨hFrob, hOneSub, hPencil⟩ := hscale - intro r' s' hps ℓ hℓp hℓne - have hℓF : (ℓ : L) ≠ 0 := -@@ -218,7 +214,7 @@ theorem hres_of_baseChange_scalings_coprime - (1 - M).det = ((Fintype.card K + 1 - - isogTrace (frobeniusIsog W) (isogOneSub_negFrobenius W hq) : ℤ) : ZMod ℓ) ∧ - ((r' : ZMod ℓ) • M - (s' : ZMod ℓ) • 1).det = (deg r' s' : ZMod ℓ) := by -- haveI : CharP L p := charP_of_injective_algebraMap (FaithfulSMul.algebraMap_injective K L) p -+ have : CharP L p := charP_of_injective_algebraMap (FaithfulSMul.algebraMap_injective K L) p - obtain ⟨hFrob, hOneSub, hPencil⟩ := hscale - intro r' s' hpr hps ℓ hℓp hℓne - have hℓF : (ℓ : L) ≠ 0 := -@@ -238,16 +234,16 @@ theorem hasse_bound_unconditional_of_baseChange_scalings - |(↑(pointCount W.toAffine) - ↑(Fintype.card K) - 1 : ℝ)| ≤ - 2 * Real.sqrt (Fintype.card K : ℝ) := by - obtain ⟨p, hCharP, ⟨n, _hn⟩, hp_prime, hcard⟩ := FiniteField.card' K -- haveI : Fact p.Prime := ⟨hp_prime⟩ -- haveI : CharP K p := hCharP -- haveI : Fact (Fintype.card K = p ^ (n : ℕ)) := ⟨hcard⟩ -+ have : Fact p.Prime := ⟨hp_prime⟩ -+ have : CharP K p := hCharP -+ have : Fact (Fintype.card K = p ^ (n : ℕ)) := ⟨hcard⟩ - have hpchar : ringChar K = p := by rw [ringChar.eq_iff]; exact hCharP -- haveI : ExpChar (AlgebraicClosure K) p := -+ have : ExpChar (AlgebraicClosure K) p := - haveI : CharP (AlgebraicClosure K) p := - charP_of_injective_algebraMap - (FaithfulSMul.algebraMap_injective K (AlgebraicClosure K)) p - ExpChar.prime hp_prime -- haveI : (W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic := inferInstance -+ have : (W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic := inferInstance - exact hasse_bound_via_weil_pairing W hq deg hdeg_nonneg - (hres_of_baseChange_scalings W p (n : ℕ) (AlgebraicClosure K) hq deg hdeg_nonneg hpchar - (hscale p (n : ℕ) ⟨hp_prime⟩ hCharP ⟨hcard⟩)) -@@ -261,16 +257,16 @@ theorem hasse_bound_unconditional_of_baseChange_scalings_coprime - |(↑(pointCount W.toAffine) - ↑(Fintype.card K) - 1 : ℝ)| ≤ - 2 * Real.sqrt (Fintype.card K : ℝ) := by - obtain ⟨p, hCharP, ⟨n, _hn⟩, hp_prime, hcard⟩ := FiniteField.card' K -- haveI : Fact p.Prime := ⟨hp_prime⟩ -- haveI : CharP K p := hCharP -- haveI : Fact (Fintype.card K = p ^ (n : ℕ)) := ⟨hcard⟩ -+ have : Fact p.Prime := ⟨hp_prime⟩ -+ have : CharP K p := hCharP -+ have : Fact (Fintype.card K = p ^ (n : ℕ)) := ⟨hcard⟩ - have hpchar : ringChar K = p := by rw [ringChar.eq_iff]; exact hCharP -- haveI : ExpChar (AlgebraicClosure K) p := -+ have : ExpChar (AlgebraicClosure K) p := - haveI : CharP (AlgebraicClosure K) p := - charP_of_injective_algebraMap - (FaithfulSMul.algebraMap_injective K (AlgebraicClosure K)) p - ExpChar.prime hp_prime -- haveI : (W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic := inferInstance -+ have : (W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic := inferInstance - exact hasse_bound_via_weil_pairing_both W hq deg hdeg_nonneg - (hres_of_baseChange_scalings_coprime W p (n : ℕ) (AlgebraicClosure K) hq deg - hdeg_nonneg hpchar -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusDivisorGalois.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusDivisorGalois.lean -index a5cecf0c5..2cc3630be 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusDivisorGalois.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusDivisorGalois.lean -@@ -14,7 +14,7 @@ import HasseWeil.Foundation.Curves.Valuation.NoFinitePolesBridge - /-! - # Divisor Galois descent for the arithmetic Frobenius `σ` of `K̄(E)` - --This file applies the abstract divisor-Galois-descent engine (`DivisorGalois.lean`) to the concrete -+Divisor Galois descent for the concrete - arithmetic Frobenius `σ = frobeniusFunctionFieldEquiv W` of the function field `K̄(E)`, proving the - affine order transport - -@@ -112,19 +112,19 @@ theorem pointValuation_frobeniusFunctionFieldEquiv - (frobeniusFunctionFieldEquiv W g) = - (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : - SmoothPlaneCurve (AlgebraicClosure K)).pointValuation Q g := by -- haveI hMell : ((W.baseChange (AlgebraicClosure K)).map -+ have hMell : ((W.baseChange (AlgebraicClosure K)).map - (coeffFrobEquiv (K := K) : - AlgebraicClosure K →+* AlgebraicClosure K)).toAffine.IsElliptic := by - rw [map_coeffFrobEquiv_eq W]; infer_instance -- haveI hMic : IsIntegrallyClosed (⟨((W.baseChange (AlgebraicClosure K)).map -+ have hMic : IsIntegrallyClosed (⟨((W.baseChange (AlgebraicClosure K)).map - (coeffFrobEquiv (K := K) : AlgebraicClosure K →+* AlgebraicClosure K)).toAffine⟩ : - SmoothPlaneCurve (AlgebraicClosure K)).CoordinateRing := by - rw [map_coeffFrobEquiv_eq W]; infer_instance -- haveI hMdd : IsDedekindDomain (⟨((W.baseChange (AlgebraicClosure K)).map -+ have hMdd : IsDedekindDomain (⟨((W.baseChange (AlgebraicClosure K)).map - (coeffFrobEquiv (K := K) : AlgebraicClosure K →+* AlgebraicClosure K)).toAffine⟩ : - SmoothPlaneCurve (AlgebraicClosure K)).CoordinateRing := - SmoothPlaneCurve.isDedekindDomain_coordinateRing _ -- haveI hEdd : IsDedekindDomain (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : -+ have hEdd : IsDedekindDomain (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : - SmoothPlaneCurve (AlgebraicClosure K)).CoordinateRing := - SmoothPlaneCurve.isDedekindDomain_coordinateRing _ - rw [frobeniusFunctionFieldEquiv, RingEquiv.trans_apply, ffFrobCast, -@@ -144,9 +144,8 @@ theorem pointValuation_frobeniusFunctionFieldEquiv - (by rw [pointOnMapped_x, hPx]) (by rw [pointOnMapped_y, hPy])).symm) g - - /- The order-at-infinity transport `ordAtInfty (σ g) = ordAtInfty g`: the arithmetic Frobenius `σ` --fixes the place at infinity. Mirrors `OrdAtInftyBaseChange.lean` (the base-change `ord_∞` --transport), replacing the injective `algebraMap K L` by the coefficient Frobenius `coeffFrobEquiv` --(also injective). -/ -+fixes the place at infinity. Injectivity of the coefficient Frobenius identifies the -+orders of the corresponding norm polynomials. -/ - - /-- `crFrobEquiv` (= `CoordinateRing.map e`) on the `K̄[X]`-basis decomposition `p • 1 + q • y`: - it sends the coefficients `p, q` through `Polynomial.map e` and fixes the basis `{1, y}`. -@@ -305,7 +304,7 @@ omit [DecidableEq K] [W.toAffine.IsElliptic] - ((FiniteField.frobeniusAlgEquivOfAlgebraic K (AlgebraicClosure K)).symm P.y) = P.y - rw [AlgEquiv.coe_ringEquiv, AlgEquiv.apply_symm_apply] - --omit [W.toAffine.IsElliptic] [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] in -+omit [W.toAffine.IsElliptic] [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] [DecidableEq K] in - /-- **`π̄` recovers `P` from its inverse-Frobenius point** (at the affine-point level): - `geomFrobeniusPointFun (geomFrobSmoothPointInv P).toAffinePoint = P.toAffinePoint`. -/ - theorem geomFrobeniusPointFun_geomFrobSmoothPointInv -@@ -341,6 +340,7 @@ open HasseWeil - - omit [W.toAffine.IsElliptic] in - set_option backward.isDefEq.respectTransparency false in -+omit [DecidableEq K] in - /-- **The fibre-divisor place comparison** (the combinatorial heart of σ-naturality). The - coefficient of the fibre divisor `[ℓ]^*(π̄T)` at an affine place `P` equals the coefficient of - `[ℓ]^*(T)` at the inverse-Frobenius place `geomFrobSmoothPointInv P`, because -@@ -382,6 +382,7 @@ theorem pullbackDiv_geomFrobInv_eq (ℓ : ℤ) (hℓ : (ℓ : AlgebraicClosure K - - omit [W.toAffine.IsElliptic] in - set_option backward.isDefEq.respectTransparency false in -+omit [DecidableEq K] in - /-- **The fibre-divisor place comparison at infinity**: - `pullbackDiv [ℓ] (π̄T) ∞ = pullbackDiv [ℓ] T ∞` (both equal `if 0 = Q`, and `0 = π̄T ⟺ 0 = T` since - π̄ is injective with `π̄ 0 = 0`). -/ -@@ -500,7 +501,7 @@ theorem frobeniusFunctionFieldEquiv_weilFunction_eq_smul - (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField c * - weilFunction (W.baseChange (AlgebraicClosure K)) ℓ hℓ - (HasseWeil.geomFrobeniusPoint W T) hπT := by -- haveI hEdd : IsDedekindDomain (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : -+ have hEdd : IsDedekindDomain (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : - SmoothPlaneCurve (AlgebraicClosure K)).CoordinateRing := - SmoothPlaneCurve.isDedekindDomain_coordinateRing _ - set gT := weilFunction (W.baseChange (AlgebraicClosure K)) ℓ hℓ T hT with hgT -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusGenericCovariance.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusGenericCovariance.lean -index 2e94ad5e465c6dada76ce68439b6c5d25480b4c3..86c212da5910eadae69fd7f1828430aaa2ee4c24 100644 -GIT binary patch -delta 1209 -zcmb7E&1(}u6eq1;EL8eQOKs)RT1+t6QYk70LHr~Zv6$RS+nwxAvIDy_o0-|Py%>dF -zyeWJ0YPT-f7?!fp8C)21U82(&hoHYY=sCDh_CIqQtbq*&?JGr&}397Lo?F;Xzx3VXPT% -zAZ8&w#t9CK#4eQzcA54;OTtw^G!xu3mb5M;(qS#CEa&iGrvmvp@`jBaq*#EvkbS`o -zWP`}^hp(VgaBRzZLF?E7Wm$s?3y^o1ER2;#R#Qsla@oFP-|V~`d!Ng71$sI$+dfvu -zw#wQlBxximlGoJhYImkgP@^u1Q8crfaVw?VAS97>EOx&OTGdxL(7uQpKFT}~oZ=uZ -zGl5CTd?hAAz -zjgVoWfJ9NS4+TR}k&s%_80m`;9~t>fg(eOed6kSVLA5xcjq!!ReO<3Q8 -z&1B{JVsbP-m3$~(8m{^@*|;*>J{>VKkftt>GXi%iW>v&utUKuiFb`d1df#&LBxul@ -zB+p0$dxh;L<_Ig7`=$KecC+B5=vS_OI@e3bg~d7Bs>j?l;Vh-rb;VIOJm-VFac~MC -z`F?G-GrIKd;>_Rt8Ml^8C3up&9-2<SBl89v}V#6%nlU - -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/HfactLemma.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/HfactLemma.lean -index 66737344a..5d4f80a0a 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/HfactLemma.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/HfactLemma.lean -@@ -9,57 +9,21 @@ import HasseWeil.HasseBound.WeilPairing.Constancy - import HasseWeil.Pic0.PicDual - - /-! --# The separable divisor factorisation `hfact` (Silverman III.8.2 / III.6.1b) -+# Divisor factorization for the separable Weil-pairing adjoint - --This file discharges the **divisor factorisation hypothesis** `hfact` of --`HasseWeil.WeilPairing.weilPairing_adjoint_core` (the separable adjoint, Silverman III.8.2): for a --separable isogeny `φ : E → E`, the Weil functions `g_T = weilFunction W ℓ T`, `g_U = weilFunction --W ℓ U` (with `U = picDual φ T = φ̂ T`), and an appropriate `k ∈ K(E)`, --``` --φ^* g_T = c · (g_U · ([ℓ]^* k)) for some c ∈ Fˣ. --``` -+Let `g_T` and `g_U` be Weil functions, and suppose the projective-divisor class -+identity `φ*((T) − (O)) ∼ (U) − (O)` holds. Divisor pullback functoriality and -+commutation with multiplication by `ℓ` then give -+`div(φ*g_T) = div(g_U · ([ℓ]*k))` for a suitable function `k`. -+Functions with the same projective divisor differ by a nonzero base-field -+constant, so `φ*g_T = c · g_U · ([ℓ]*k)`. - --## The mathematics (Silverman III.8.2 proof, divisor language) -- --Write `div g_T = [ℓ]^*((T) − (O))` (`weilFunction_divisor`, the fibre-difference divisor). Then -- --* `div(φ^* g_T) = φ^*(div g_T) = φ^*([ℓ]^*((T) − (O)))` — the divisor-pullback functoriality -- `div(φ^* h) = φ^*(div h)` for the separable `φ` (`DivisorPullback.ProjOrdTransport φ`, the -- analogue of `projOrdTransport_mulByInt` for `[ℓ]`); --* `φ^* ∘ [ℓ]^* = [ℓ]^* ∘ φ^*` on divisors (the function-field shadow of `[ℓ] ∘ φ = φ ∘ [ℓ]`, which -- holds for *any* additive point maps: `[ℓ]` commutes with every homomorphism) — proven here as -- `pullbackDivisor_comm`; --* the **`picDual` divisor-class identity** (Silverman III.6.1b, the genuine separability content) -- `φ^*((T) − (O)) ∼ (U) − (O)` with `U = φ̂ T`, i.e. `φ^*(kappaDivisor T) − kappaDivisor U` is -- principal `= div k₀` — isolated below as the single minimal hypothesis `PicDualDivisorClass φ` -- (a projective-divisor avatar of `PicDual.Naturality`, see the residual note). -- --Combining: `div(φ^* g_T) = [ℓ]^*(φ^*(kappaDivisor T)) = [ℓ]^*(kappaDivisor U + div k₀) = div(g_U) + --div([ℓ]^* k₀) = div(g_U · [ℓ]^* k₀)`. Two functions with the same projective divisor differ by a --nonzero constant `c ∈ Fˣ` (`Constancy.const_unit_of_projectiveDivisorOf_eq_zero`), which is exactly --`hfact`. -- --## The isolated minimal residual `PicDualDivisorClass` -- --The decisive ingredient is the divisor-class identity `φ^*((T) − (O)) ∼ (φ̂ T) − (O)` *expressed in --the projective-divisor model* `ProjectiveDivisor` (where `weilFunction_divisor`/`hfact` speak), --namely `(⟨W⟩).ProjIsPrincipal (pullbackDivisor φ (kappaDivisor T) − kappaDivisor (φ̂ T))`. -- --This is the **honest frontier**: `picDual = κ⁻¹ ∘ classMap ∘ κ` is defined in the *affine ideal --class group* model `ClassGroup R` (`PicDual.lean`), where `classMap = ClassGroup.map` is the ideal --extension `𝔪 ↦ 𝔪·𝒪` — Silverman's divisor pullback `φ^*`. But `hfact` lives in the *projective --divisor* model `PicProj₀`/`projectiveDivisorOf`. The two `Pic⁰(E)` models are connected by `κ` --(the canonical `E ≅ Pic⁰(E)` of III.3.4), but the repo carries no bridge `ClassGroup.map ↔ --pullbackDivisor`; building it is exactly the `comap`-vs-`relNorm` (residue-degree) bookkeeping that --`PicDual.Naturality` documents as carried per-isogeny data. We therefore isolate the divisor-class --identity as the one minimal hypothesis `PicDualDivisorClass φ ch hinj hfin`, dischargeable per --isogeny just as `ProjOrdTransport`/`Naturality` are throughout the project, and prove the *entire* --`hfact` factorisation on top of it. -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, III.6.1 (the dual isogeny, `φ̂ = κ⁻¹ ∘ φ^* ∘ κ`), -- III.8.2 (Prop 8.2, the separable adjoint via the multiplicity-free pullback). -+The projective-divisor class identity is an explicit hypothesis. The ideal-class -+definition of `picDual` uses extension of ideals in the affine coordinate ring; -+identifying it with projective divisor pullback requires compatibility of those -+two models of `Pic⁰`. The factorization proofs retain this compatibility input. -+ -+References: Silverman, *The Arithmetic of Elliptic Curves*, III.6.1 and III.8.2. - -/ - - open WeierstrassCurve HasseWeil.Curves -@@ -68,8 +32,6 @@ namespace HasseWeil.WeilPairing - - open HasseWeil HasseWeil.WeilPairing.DivisorPullback - --set_option linter.unusedSectionVars false -- - variable {F : Type*} [Field F] [DecidableEq F] - variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] - [IsIntegrallyClosed (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing] -@@ -78,13 +40,14 @@ local notation "KE" => W.toAffine.FunctionField - - /-! ### Commutation of fibre-pullback divisors `φ^* ∘ ψ^* = (ψ ∘ φ)^*` - --The fibre-pullback `pullbackDivisor f` (`DivisorPullback.lean`) transports a coefficient along the -+The fibre-pullback `pullbackDivisor f` transports a coefficient along the - point map `f`: `(pullbackDivisor f D) w = D (f w)` (`pullbackDivisor_apply`). Hence two such - pullbacks compose by composing the point maps in the *opposite* order: - `pullbackDivisor f (pullbackDivisor g D) w = D (g (f w))`. We only need the special case where the - two maps **commute** as point endomorphisms (`g ∘ f = f ∘ g`), which is automatic when one of them - is `[ℓ]` (multiplication-by-`ℓ` commutes with every additive hom). -/ - -+omit [IsIntegrallyClosed (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing] in - /-- **Fibre-pullback divisors of commuting point maps commute.** If `f g : E.Point →+ E.Point` - commute (`g.comp f = f.comp g` — automatic when one is `[ℓ]`), then their fibre-pullback divisor - operators commute: `pullbackDivisor f (pullbackDivisor g D) = pullbackDivisor g (pullbackDivisor f -@@ -110,11 +73,10 @@ theorem pullbackDivisor_comm {f g : W.toAffine.Point →+ W.toAffine.Point} - `pullbackDivisor [ℓ] (kappaDivisor T)` of the Abel–Jacobi divisor `(T) − (O) = kappaDivisor T` - (`pullbackDivisor` distributes over the difference of the two `single`s; `∞.toAffinePoint = O`). -/ - -+omit [IsIntegrallyClosed (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing] in - /-- **The fibre-pullback of `(T) − (O)` is `[ℓ]^*(T) − [ℓ]^*(O)`** (= `div g_T`). The fibre-pullback - `pullbackDivisor [ℓ]` of `kappaDivisor T = (T) − (O)` equals `pullbackDiv [ℓ] T − pullbackDiv [ℓ] --O`. (Local copy of `PairingNondeg.pullbackDivisor_kappaDivisor`, kept here to avoid the import; --named `…_local` to avoid the cross-file name clash with the `PairingNondeg` copy, so that downstream --files importing both `HfactLemma` and `DetDeg`/`PairingNondeg` — e.g. `SeparableScaling` — compile.) -+O`. - -/ - theorem pullbackDivisor_kappaDivisor_local (ℓ : ℤ) - [hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker] (T : W.toAffine.Point) : -@@ -135,7 +97,7 @@ theorem weilFunction_divisor_eq_pullbackDivisor_kappaDivisor [IsAlgClosed F] - (⟨W.toAffine⟩ : SmoothPlaneCurve F).projectiveDivisorOf (weilFunction W ℓ hℓ T hT) = - pullbackDivisor (W := W.toAffine) (mulByInt W.toAffine ℓ).toAddMonoidHom - (mulByInt_ker_finite W ℓ hℓ) (Curves.kappaDivisor W.toAffine T) := by -- haveI : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ -+ have : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ - rw [show (⟨W.toAffine⟩ : SmoothPlaneCurve F).projectiveDivisorOf (weilFunction W ℓ hℓ T hT) = - (W_smooth W).projectiveDivisorOf (weilFunction W ℓ hℓ T hT) from rfl, - weilFunction_divisor W ℓ hℓ T hT, pullbackDivisor_kappaDivisor_local W ℓ T] -@@ -146,7 +108,7 @@ theorem weilFunction_divisor_eq_pullbackDivisor_kappaDivisor [IsAlgClosed F] - fibre-pullback `φ^*((T) − (O))` is *linearly equivalent* to `(φ̂ T) − (O)` (with `φ̂ = picDual φ`), - i.e. their difference `pullbackDivisor φ (kappaDivisor T) − kappaDivisor (φ̂ T)` is principal. This - is the one ingredient that cannot be assembled from the project's *projective*-model API: `picDual` --is built from the *affine* ideal-class-group divisor pullback `classMap` (`PicDual.lean`), and the -+is built from the *affine* ideal-class-group divisor pullback `classMap`, and the - ClassGroup↔ProjectiveDivisor bridge is the carried `PicDual.Naturality` data (the `comap`-vs- - `relNorm`/residue-degree bookkeeping). Everything else in `hfact` is proven on top of this. -/ - -@@ -209,7 +171,7 @@ theorem hfact_projectiveDivisorOf_eq (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) - (φ.pullback (weilFunction W ℓ hℓ T hT)) = - (⟨W.toAffine⟩ : SmoothPlaneCurve F).projectiveDivisorOf - (weilFunction W ℓ hℓ U hU * (mulByInt W.toAffine ℓ).pullback k₀) := by -- haveI hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ -+ have hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ - have hcoreℓ : ProjOrdTransport (mulByInt W.toAffine ℓ) := projOrdTransport_mulByInt ℓ hℓ - set κT := Curves.kappaDivisor W.toAffine T - set κU := Curves.kappaDivisor W.toAffine U with hκU -@@ -274,7 +236,7 @@ theorem hfact_of_picDualDivisorClass (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) - (weilFunction W ℓ hℓ ((φ.picDual ch hinj hfin) T) - (by rw [← map_zsmul, hT, map_zero]) * - (mulByInt W.toAffine ℓ).pullback k) := by -- haveI : IsDedekindDomain (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing := inferInstance -+ have : IsDedekindDomain (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing := inferInstance - have hU : ℓ • (φ.picDual ch hinj hfin) T = 0 := by rw [← map_zsmul, hT, map_zero] - -- The Abel–Jacobi function `k₀` of the `picDual` divisor-class identity, and its divisor. - obtain ⟨k₀, hk₀_ne, hk₀_div⟩ := hpd T -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/OneSubDualDivisor.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/OneSubDualDivisor.lean -index d3000b32d30e10c2b46fc50f6a717384d41259f1..4a6db4566facbd1bd32e68b7dfa22044d93fa66b 100644 -GIT binary patch -delta 1573 -zcmah}&5ImG6lXU0vBl!9n;17SA1|6U)7smxCJt^e=w(9&1Xr^dNKEXS?waW`-BoQ> -z^@KUdBqRm}5wvpfAd89@5g}wedGL@wAREDpm!Ny|;vXOcebv3QnZywRe)+a`{kxid?Ab^BxS%P>Hc-$kr;4^x23*Sy6FowXOEvnzc7w*#K2Q-uuH?Hc -zGQ7(`s+cKa6csv`%J^U}9ouQQ2anr3hxWW(?#_zT@I2*AlbCfBV;WjL2%kC66s%tj -z185pB2~(^s6<#mmBEl_H028syq{{=R-d$ZEo%&0C5s=pq9iGhw*tK?eb82-h#y*RP&? -zu8zO3;=#s;pF#a~&-36IxSsJfzP$J~tb{&jNy1w{;GWMB3T`;FiRvtN==eii(4v|_ -zlu*$@y4r6*xLDR)zZim%4kt}JtfeTAAWEe!6!Y;M*HEgXSV|3-!Y8g)Mc`J;r5yIt -z<+(o3^0Zf87fGcUiXmbyI&g~dbRnl)xd$E56#s*gfJh2$RDm)|0fk27BeKT4i#||J -z29#TJVIZTqh6~&zvM}h2NTT#yP{S6mwtabWcIr*mMim9BM~I!BJ_3h>BR({n&7cu1 -z)?40i{X(7M8Y|nI(?8W#2OrOTGGVX1c+h^Z{hFN)o)|3c_wo`{=2+UkI=^FoUZg3~8l86p=6HR?b2Rd>>A`RQjY+J#*0?e;$d~?@oU3pH8f=7p -zbh!Qd#BTfO>HYo9qZQ>2GdCI`X1Ub7BxooDL6W-Yn3C#JpqLt3Rvt?=IIktWT%vl8 -zV~Q3Z;kg_iFbB5ghoJt|Y&l1wG9~%iN0Fc0T}|H@9}xTJnSC=SdD>+vLr1+8ECz?Y -z!R+yq6T8N>1+Hm(_rzSktz=eVsT406AoY8t#>?m70NxKw7x~bE|1#-=fbZqSUL2wE -zfJ=WM=xuJ)*BVc~f~t`JQpHJyBR$08{88Ei`P&SQaPZA*zfK)+O^+pH7y^!zoe#i& -z$@$kiYL`wo`_4k>xXcB`#ubY>^CjeAHBtAOs0tIO)i@jZa3SFswqb%~y~EzaC simp only [hax, hay] - --/-- **The base-changed `(1 − π)_{K̄}` point map is `id − geomFrobenius`** (= `oneSubGeomFrobHom`), --over `L = AlgebraicClosure K`. Combines the constructional `toAddMonoidHom = id − π̄` --(`oneSubFrobeniusIsogBaseChange_toAddMonoidHom`) with the linchpin `π̄ = geomFrobeniusPoint`. -/ -+omit [DecidableEq K] in -+/-- The base-changed `1 − π` point map is the difference of the identity and geometric -+Frobenius over the algebraic closure. -/ - theorem oneSubFrobeniusIsogBaseChange_toAddMonoidHom_eq_oneSubGeomFrobHom - [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] - (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] -@@ -260,13 +205,9 @@ variable (p r : ℕ) [Fact p.Prime] [CharP K p] [Fact (Fintype.card K = p ^ r)] - - noncomputable local instance instDecEqAC' : DecidableEq (AlgebraicClosure K) := Classical.decEq _ - --/-- **Witness 1 — `finiteKer`** (PROVED, axiom-clean): the kernel of `(1 − π)_{K̄}` is finite. -- --Via the linchpin, `ker(id − π̄) = ker(oneSubGeomFrobHom)`, whose underlying set is the --geometric-Frobenius fixed locus `= range(includePointBC)` (Step S2/S3 of --`FrobeniusFixedPoint.lean`), --i.e. the image of the **finite** point set `E(𝔽_q) = W.toAffine.Point` under the base-change --inclusion — hence finite. -/ -+omit [DecidableEq K] in -+/-- The kernel of base-changed `1 − π` is finite: it is the geometric-Frobenius fixed locus, -+which is the image of the finite rational point set under base change. -/ - theorem oneSubFrobeniusIsogBaseChange_finiteKer - [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] - (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] -@@ -281,9 +222,9 @@ theorem oneSubFrobeniusIsogBaseChange_finiteKer - rw [← hset] at hfin - exact hfin.to_subtype - --/-- **`#ker(1 − π)_{K̄} = pointCount W`** (PROVED, axiom-clean). Via the linchpin the kernel is the --geometric-Frobenius fixed locus, whose cardinality is the `𝔽_q`-rational point count --(`ncard_ker_oneSubGeomFrobHom_eq_pointCount`). This is the *clean half* of `hkerdeg`. -/ -+omit [DecidableEq K] in -+/-- The cardinality of the kernel of base-changed `1 − π` equals the rational point count, -+by its identification with the geometric-Frobenius fixed locus. -/ - theorem oneSubFrobeniusIsogBaseChange_nat_card_ker_eq_pointCount - [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] - (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] -@@ -299,16 +240,9 @@ theorem oneSubFrobeniusIsogBaseChange_nat_card_ker_eq_pointCount - rw [hcard, ncard_ker_oneSubGeomFrobHom_eq_pointCount] - rfl - --/-- **Witness 3 — `hkerdeg`, reduced to V.1.3** (axiom-clean reduction). Given the degree identity --`φ_L.degree = pointCount W` (Silverman V.1.3, `isogOneSub_negFrobenius_degree_eq_pointCount` --base-changed through `hdeg_bc` — the project's known sharp residual), the separable degree match --`#ker(1 − π)_{K̄} = φ_L.degree` follows from the *proved* clean count --`#ker = pointCount`. -- --The V.1.3 degree identity is taken as a hypothesis so this reduction is itself axiom-clean and the --V.1.3 dependence is explicit (the caller supplies `hdeg_eq` from --`(oneSubFrobeniusIsogBaseChange_degree_eq_of_finrankBaseChange W p r L hq).trans -- (isogOneSub_negFrobenius_degree_eq_pointCount W hq)` once `hq` is available). -/ -+omit [DecidableEq K] in -+/-- The degree identity of Silverman V.1.3, supplied as a hypothesis, identifies the -+kernel cardinality with the degree of the base-changed `1 − π` isogeny. -/ - theorem oneSubFrobeniusIsogBaseChange_hkerdeg_of_degree_eq_pointCount - [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] - (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] -@@ -321,11 +255,9 @@ theorem oneSubFrobeniusIsogBaseChange_hkerdeg_of_degree_eq_pointCount - (oneSubFrobeniusIsogBaseChange W p r (AlgebraicClosure K) pullback_L).degree := by - rw [oneSubFrobeniusIsogBaseChange_nat_card_ker_eq_pointCount, hdeg_eq] - --omit [Fintype W.toAffine.Point] in --/-- **Witness 2 — `hsurj` from the dual composition `φ ∘ δ = [N]`** (axiom-clean reduction). For --any `N` with `(N : K̄) ≠ 0`, surjectivity of `[N]` on `E(K̄)`-points (`mulByInt_point_surjective`) --turns the dual composition `φ ∘ δ = [N]` into surjectivity of `φ`. This is the second consequence --(alongside `hdc`) of bundling the divisor-pushforward dual as an `IsDualOf`. -/ -+omit [Fintype W.toAffine.Point] [DecidableEq K] in -+/-- A dual composition `φ ∘ δ = [N]`, with `N` nonzero in the algebraic closure, implies -+surjectivity of `φ` by surjectivity of multiplication by `N` (Silverman III.4.10). -/ - theorem oneSubFrobeniusIsogBaseChange_hsurj_of_self_comp_dual - [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] - (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] -@@ -363,14 +295,10 @@ variable [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] - (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : SmoothPlaneCurve - (AlgebraicClosure K)).CoordinateRing] - --/-- **Assemble `OneSubScalingData` over `K̄` from only the still-open witnesses.** -- --Discharges `pullback_L` (concrete `oneSubFrobeniusPullback_L`), `hdeg_bc` (proved, no hypothesis), --`finiteKer` (proved), `hkerdeg` (from the V.1.3 identity `hdeg_eq`), and `hsurj` (from the --dual composition --`hself` + `mulByInt_point_surjective`). The caller supplies only the genuinely-deep divisor-level --residuals: the dual `δ` with *both* composition identities `hdc`/`hself` (an `IsDualOf`), the --divisor-pullback functoriality `hproj`, and the translation covariance `hcomm'`. -/ -+/-- Scaling data over the algebraic closure constructed from the degree identity, both dual -+composition identities, divisor-pullback functoriality, and translation covariance. The -+geometric-Frobenius fixed locus supplies the finite kernel and its cardinality; the second -+dual composition supplies surjectivity. -/ - noncomputable def mkOneSubScalingDataConcrete_of_witnesses (hq : 2 ≤ Fintype.card K) - (hdeg_eq : - (oneSubFrobeniusIsogBaseChange W p r (AlgebraicClosure K) -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingNondeg.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingNondeg.lean -index 18c4b2749..327e9d223 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingNondeg.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingNondeg.lean -@@ -13,7 +13,7 @@ import HasseWeil.HasseBound.WeilPairing.TorsionCardEll - /-! - # Nondegeneracy of the Weil pairing - --This file proves that the finite-level Weil pairing over an algebraically closed field is -+We prove that the finite-level Weil pairing over an algebraically closed field is - nondegenerate in its second argument. The proof uses surjectivity of multiplication on curve - points, injectivity of divisor pullback, the Galois fixed-field description, and Abel--Jacobi. - -@@ -154,7 +154,7 @@ theorem aut_eq_translate (ℓ : ℤ) (hℓ0 : ℓ ≠ 0) - (mulByInt W.toAffine ℓ).toAlgebra (mulByInt W.toAffine ℓ).toAlgebra) : - ∃ k : W.toAffine.Point, ℓ • k = 0 ∧ - ∀ z : KE, σ z = translateAlgEquivOfPoint W k z := by -- letI := (mulByInt W.toAffine ℓ).toAlgebra -+ let := (mulByInt W.toAffine ℓ).toAlgebra - have hcov := hcov_mulByInt_of_xy W ℓ hℓ0 (hxy_mulByInt W ℓ hℓ0) - set forward := kernelTranslateForwardAut W (mulByInt W.toAffine ℓ) hcov with hfwd_def - obtain ⟨k, hk_mem, hk_lift⟩ := hdesc_mulByInt W ℓ hℓ0 σ -@@ -183,10 +183,10 @@ theorem mem_pullback_range_of_translate_fixed (ℓ : ℤ) (hℓ : (ℓ : F) ≠ - translateAlgEquivOfPoint W S g = g) : - ∃ h : KE, (mulByInt W.toAffine ℓ).pullback h = g := by - have hℓ0 : ℓ ≠ 0 := by rintro rfl; norm_num at hℓ -- letI := (mulByInt W.toAffine ℓ).toAlgebra -- haveI hfin : @FiniteDimensional KE KE _ _ (mulByInt W.toAffine ℓ).toAlgebra.toModule := -+ let := (mulByInt W.toAffine ℓ).toAlgebra -+ have hfin : @FiniteDimensional KE KE _ _ (mulByInt W.toAffine ℓ).toAlgebra.toModule := - isogeny_finiteDimensional W (mulByInt W.toAffine ℓ) -- haveI hgal : @IsGalois KE _ KE _ (mulByInt W.toAffine ℓ).toAlgebra := -+ have hgal : @IsGalois KE _ KE _ (mulByInt W.toAffine ℓ).toAlgebra := - Isogeny.isGalois_of_isSeparable_and_normal (mulByInt W.toAffine ℓ) - (mulByInt_isSeparable W ℓ hℓ) (h_normal_mulByInt W ℓ hℓ0) - have hfix : ∀ σ : @AlgEquiv KE KE KE _ _ _ -@@ -217,7 +217,7 @@ theorem weilPairing_nondegenerate (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) - (h_deg : ∀ S : W.toAffine.Point, (hS : ℓ • S = 0) → - weilPairing W ℓ hℓ S T hS hT = 1) : - T = 0 := by -- haveI hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ -+ have hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ - obtain ⟨h, hh⟩ := mem_pullback_range_of_translate_fixed W ℓ hℓ (fun S hS ↦ by - rw [weilPairing_translate W ℓ hℓ S T hS hT, h_deg S hS, map_one, one_mul]) - apply eq_zero_of_kappaDivisor_principal W -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingProps.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingProps.lean -index 403c142bc..70880d716 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingProps.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingProps.lean -@@ -9,9 +9,9 @@ import HasseWeil.HasseBound.WeilPairing.Pairing - /-! - # Weil-pairing properties: bilinearity in the second slot and alternating (Silverman III.8.1) - --This file proves the two remaining structural properties of the finite-level Weil pairing --`e_ℓ : E[ℓ] × E[ℓ] → F` (ticket `T-R2-PAIRING-PROPS`), over an algebraically closed field `F`, --extending the slot-1 bilinearity `weilPairing_mul_left` from `Pairing.lean`: -+We prove bilinearity and alternation of the finite-level Weil pairing -+`e_ℓ : E[ℓ] × E[ℓ] → F`, over an algebraically closed field `F`, -+extending the slot-1 bilinearity `weilPairing_mul_left`: - - * `weilPairing_mul_right` — **bilinearity in the second slot** (Silverman III.8.1b): - `e_ℓ(S, T₁ + T₂) = e_ℓ(S, T₁) · e_ℓ(S, T₂)`. -@@ -112,7 +112,7 @@ theorem weilPairing_mul_right (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) - weilPairing W ℓ hℓ S (T₁ + T₂) hS h₁₂ = - weilPairing W ℓ hℓ S T₁ hS hT₁ * weilPairing W ℓ hℓ S T₂ hS hT₂ := by - have hℓ0 : ℓ ≠ 0 := by rintro rfl; simp at hℓ -- haveI hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ -+ have hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ - obtain ⟨k, hk_ne, hk_div⟩ := bilinDivisor_isPrincipal W T₁ T₂ - set u : KE := (mulByInt W.toAffine ℓ).pullback k - have hu_ne : u ≠ 0 := -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PencilDualDivisor.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PencilDualDivisor.lean -index 5f516ab8e619e3cdfcf79eb728f53efdfb81a2c5..4401ef64fd20246d7f73d595ce01960cce1b673b 100644 -GIT binary patch -delta 2332 -zcmbVOzi%8x7}b$LF@+rj*nx1)hb%>V(%u>$k!`>fHjX7L6oIoq5sI_p-MPCVyR(~_ -zT^lQ)3z7u_M1iKEp`f5dLb?VzXebcE4ODdb188U|_-1zRhtFpdMOWNuc6R1{?|bik -z_sbWRuiyT@Uh(Uod_p!82^17dsieCRgOrJYN5ECmX5s*Rd2}DlP8WElV3#TeL5GSq -zgAP@YCR}6?)0FrUj_&_6PdZ7a#=j%*#Y1&ZI;9=lRPNORW7i* -zIl?zjTX2U-!6FE#47n&)sR#+8lZ?55zX8wI-!47XMN&Ep2^=2Sq5-lhSxmVA_I?`i -zfM>u3@o(5ZGz*$GXhsdCSRign1Vhq!!K%tre2ax3XqHPl>|6l=X_=pgw^)lwrazxr -z?^-}xTU*|e*KlZ!05~Dv!*)wZbJb}javv)xVB>Wm7K->HY6z{lVBWmyExzbbH>iPg -zj4D$$j7X_KP`jg*Mz0RJhGK3O{>pdws!_eoFivD}R^i_d(UK%o&x8VFFv5!A12~uU_sJ7C6njuV5ggc@*u^ -z;11BJ&2}Y)P7>osrX8+g7mC)Ri%`yT&x*r+XivG$B-2<=p-aoNtwi)UOS20eX)*>) -z9_=w1Q(yCbzyROoVmtn6@!2a%CAcfknWyXVJFD -zWM5e`vKZ$P_249`!Wg}2=aa{~rwErU)a%yA1K$o?HE5C%Pd|r^1RfzJmoZe!nDh|% -zbrX?3YX?snSJ`OoE@xJr|IejGGX%ioh_A<2)6uHDn6oi}y<2T;RP;wL{RAhGfq(Sz8-5=ew&uB>zWV87-5bXziZuv@7L9pi^SK~W -z5wbS2I3&H~*>XS7#PRgS*=G$ih+ZpIf>K45%=eXaS^}dl^&cyr>BA@A)W5#``y4q- -z85??SdA4gNOEEXcX)qRM=!1iSK7^I(Ku!I+agQCkrG0UB1yO=&%}!1cqwQnEV^tgs -z#+PJm90%wL9QNqFGHcFgp~R - -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Pullback.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Pullback.lean -index 6a6379829..9fe8fdd6a 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Pullback.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Pullback.lean -@@ -7,22 +7,16 @@ import HasseWeil.HasseBound.WeilPairing.Fiber - import HasseWeil.Foundation.Curves.Divisor.PicZero - - /-! --# Route 2A — the multiplicity-free geometric divisor pullback (keystone) -+# Multiplicity-free geometric divisor pullback - --For a **separable** point-map endomorphism `f` (étale fibres, `e = 1`), the pullback divisor is --the mult-1 fibre sum `f*((Q)) = Σ_{fP=Q} (P)`. This is the central new object of the Weil-pairing --route — the same divisor pullback Route 1 lacked, now in the multiplicity-free regime — used by --both the pairing construction (`div g = [ℓ]*((T)) − [ℓ]*((O))`) and the separable adjoint --(Silverman III.8.2's function `h`). -- --This file ships the definition and its **degree**: `deg(f*((Q))) = #fibre = #ker f` (Silverman --III.4.10c, the separable case). The `σ`-bridge and the addition-formula linkage are downstream. -+For a separable point-map endomorphism `f`, the pullback of `(Q)` is the sum -+of the points in its finite fibre, each with multiplicity one. Its degree -+is the cardinality of the kernel, as in Silverman III.4.10(c). This divisor -+also gives the geometric group sum used in the dual isogeny formula. - -/ - - namespace HasseWeil.WeilPairing - --set_option linter.unusedSectionVars false -- - open WeierstrassCurve - - variable {F : Type*} [Field F] [DecidableEq F] {W : WeierstrassCurve.Affine F} [W.IsElliptic] -@@ -44,7 +38,7 @@ noncomputable def pullbackDiv (f : W.Point →+ W.Point) (h : Finite f.ker) (Q : - /-- **Degree of the mult-1 pullback** (Silverman III.4.10c, separable): `deg(f*((Q))) = #ker f`. -/ - theorem degree_pullbackDiv (f : W.Point →+ W.Point) (h : Finite f.ker) {P₀ Q : W.Point} - (hP₀ : f P₀ = Q) : (pullbackDiv f h Q).degree = Nat.card f.ker := by -- letI : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) -+ let : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) - rw [pullbackDiv, ← Curves.ProjectiveDivisor.degreeHom_apply, map_sum] - simp only [Curves.ProjectiveDivisor.degreeHom_apply, degree_single, Finset.sum_const, - Finset.card_univ, nsmul_eq_mul, mul_one] -@@ -55,7 +49,7 @@ fibre). The start of the III.6.1(b) `σ`-bridge `σ(f*((Q))−f*((O))) = f̂(Q)` - theorem projectiveDivisorSum_pullbackDiv (f : W.Point →+ W.Point) (h : Finite f.ker) (Q : W.Point) : - letI : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) - Curves.projectiveDivisorSum W (pullbackDiv f h Q) = ∑ P : {P : W.Point // f P = Q}, P.val := by -- letI : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) -+ let : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) - rw [pullbackDiv, ← Curves.projectiveDivisorSumHom_apply, map_sum] - refine Finset.sum_congr rfl (fun P _ => ?_) - rw [Curves.projectiveDivisorSumHom_apply, Curves.projectiveDivisorSum_single, one_zsmul, -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Scaling/FrobeniusGalois.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Scaling/FrobeniusGalois.lean -index ef66a86e649eed9ded1a96df6f25baa29b62948a..8e90832e3d316d0e2eae1846034a1632be1da6fb 100644 -GIT binary patch -delta 2327 -zcmai0%WoS+7?(qM4Si7ML87McMJahG_NEaRNK>JZ5EKGPRV@ld(4EZA+Cz7DoY}EM -zs8FcNg(I3P0>qg^B};HbJyhxesr(Jxd*c97k@#lD-r7l;+~SRQzVG)O|MqL?Ve8J) -zz#t*jx>;Etordti?GR)Py3Th8bXGHRvL|D*TQm4YUws>P@(YIOl}rWjh%O=Fq$!*B%T1O5wSmo*vUDV -zf6J4D)w$2M&GRST8<>sS%@Z4^=L>|;IT3P3-5IfxDZE1yiCjcfQ(}HterY&w;x+=0 -zqtJy|F}I!?+S?JxwzfPZ)bdK0Y*8ibPUU@+prlQOL-Z~*8-Rc)WHS4bD_QJZ_Pn5m -zUO=xEL9M!|P{b-as{7F_ojN`3INqn+ep~@*e+>6aXL^u9EYVcv_p{^gF1f!sW#}Aa -z*!dR4vp(_8D3c!G-gs6ApiM1PsTy^Wr%B5E)shRC?71k)jKoiDER-&8f|=FxAM4 -z!d)vERGUlB6u}Jm2a$+lt}t=n%w*SOb*c~pS0dMf9kr;Lyf$Gzc=@E63I1&V6U+~q -z_t(jpKBBuNL;Afq??^g?mwo=RC17RRL(!8&?&N+=zTNcZ>~$M)^@0FuJmU%-j+*xr -z6q>QO0xZ%)YXI^(&LO&v!V23nDXsC7;ED3{t?uO>-L1d}1LA~qBDorR)8(aqWKYbT -z!Eq-Hq^@Jt2}X+GFWFwPrL_0NQo?e&>0OATyP$^*{`&SOxPbL!Q)tcC8&vCzZZch& -zc4{NSJT%Y%nxmIG0u{-b#^?m(IOl?a)v-3a^!H%NA)h%Cc^OSv<0ywRcV8JX-!GAK -zzDoKwETfHOOGF&ZkIN$i0YUE#w;!$kTq>;?`r7d4Or~km-b4Fa4rq*Cc2@}+0#RF0 -zT~lCD;DzMlPn{VGlOC7)aa12yek_r<33|-lIFH>L3B{R4CW~|x*sy(l`D0Pz8vRZ^ -zU`|AyXL##D|;ro*VE#1s3|U -z3&l-h!*ZaF5x%)I0TahG#ISj^`ht1!ji=39AKt%Fc-mcJD3?9jhN8Fx&~xF`=98Ms -aLUGMSj%_Y;>+00`ZV?{k+VPiq@T6vr6iG88ur20KlN->H_wY89K*NgZ4$Y7ZuaKy5HIX`|83(`uaEna#|s -zTLoP8;6pEk(k(gWBZPnsfk3~3X+J{2&|44jDdg5SE6bK3%1Nu8x9|7o{ocI&b>AJ;#vrE?lW^=QL1hg+*FMvmA6ee{mpI~Fy7w|ECTOM*H -zia$3N`ynIlM-+j`GJ`F;gsV!|2(vXIv7eZ5$e5ts@Gsi6Ra!Gwct+)f;=}3jA -zQirBkP)LJR+5wsCjEtNgIEfooN9TR}K2IULnPrF!22fAmPw`QfjWC3{Pg)&xJDr%GXCI}FB`01{P)75 -zP6_e;R~Sj*H|6WcaOXRasyJ9`6c6X-2fK?aGt-I&2TNbfO+9?I{NTd!l=iGquS2cY -zDxNbKY<~LF>}I5u<5JmjAd_J@i~Uf5&pBmvESju1sV)@9!9sDl_HlE#b|ZVGposbM -zSni``-snghnnR`)g(!x1-5`TEwWAMbwu`?Sm#<8}4xl(`T=}*dGN475v>-$BG3pe3 -zzF>Us&gfDVja-n&L_|>#bJ|Se;h9aY@ZjF(uRrMT(EIm?hwiNL?3Bf~C&3BSr=MW8 -oq9vY+?Kdridc*sq4W^)rXIJNo-)bKf(0p3FY_1IcX?`;MKVysjBLDyZ - -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Scaling/Separable.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Scaling/Separable.lean -index af497faf2bb3780fc6a0ffbb0e47d99a5a4bc929..887cec98266c9fc13bfc5a472077ef8e615afbe0 100644 -GIT binary patch -delta 850 -zcmY+C!E4k&6vk-}1p{h9gx1rez3g_=1*;UX6j|`#LQ&|Z2QQjw<|UanI}>LnyIn!H -z2U)x+2Jz%UFZEc7c&mEzBJTgtf55v4`jWM!-ZGQ-zVCa#H%DKme;rI8-k!=grxx!B -zqau_7jpKMR0^>VMNDG3aw89R+$A`yH^V)dSalJaM!{pd;x9UEGDoIq|K&VwWfBSlF -zfk_UQRJiDou7;2WR%!8=S)nBO^`Xc*YV)E9Wjt!BB$< -z2SP^q&kOTIlci}w5y9W01V27{Ww!+;L3CM!{~Af&^WDlH_ozM)7E+Cq65sP75CCQ^FXrm_`!%0i&comMHy@c_; -zzeY%dn8=>ZB#c868c7QQ_ktwj$gB5NNymd!(SJj0BrO{Y112EKG6JTftb|0^HZdd# -z8KAid9g*}<=U*;fUvQmvyWL!EuGCoFh4TAGbH%LyP7bTZr`cCmijBs1C*Nqi&p+Rt -nDZZ^ P.val) - (fun T => P₀ + (T : W.Point)) (fun P => ?_) - simp only [fiberEquivKer, Equiv.coe_fn_mk] -@@ -41,7 +39,7 @@ theorem sigma_pullbackDiv_sub (f : W.Point →+ W.Point) (h : Finite f.ker) {P - (hP₀ : f P₀ = Q) : - Curves.projectiveDivisorSum W (pullbackDiv f h Q) - - Curves.projectiveDivisorSum W (pullbackDiv f h 0) = Nat.card f.ker • P₀ := by -- letI : Fintype f.ker := @Fintype.ofFinite _ h -+ let : Fintype f.ker := @Fintype.ofFinite _ h - have hQ := projectiveDivisorSum_pullbackDiv f h Q - have hO := projectiveDivisorSum_pullbackDiv f h 0 - rw [hQ, hO, fiber_sum_eq_ker_sum f h hP₀, -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionKernelRational.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionKernelRational.lean -index 378e2e72b..f1d4ef6ca 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionKernelRational.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionKernelRational.lean -@@ -11,26 +11,19 @@ import HasseWeil.Foundation.EC.GenericPointZsmul - import HasseWeil.Foundation.EC.SeparableKernelTorsor - - /-! --# Kernel-rationality of `[ℓ]` over `K̄` (Silverman III.4.10c) -+# Rationality of torsion kernels over an algebraically closed field - --For the multiplication-by-`ℓ` isogeny `[ℓ] = mulByInt W.toAffine ℓ` over an algebraically closed --field `F = K̄`, we discharge the two genuine-isogeny coherence inputs of the capstone --`HasseWeil.card_kernel_eq_degree_of_separable_concrete` (`SeparableKernelTorsor.lean`): -+For a nonzero integer `ℓ`, every point in the kernel of multiplication -+by `ℓ` over an extension of an algebraically closed base field already -+comes from a torsion point over that base field. The division-polynomial -+identity makes its x-coordinate algebraic, and the Weierstrass equation -+then makes its y-coordinate algebraic. - --* `hdesc_mulByInt` — the inverse-witness descent: every fibre `σ(P_gen) − P_gen` (`σ` an -- automorphism of `K(E)/[ℓ]*K(E)`) is an `F`-rational kernel point of `[ℓ]`. --* `h_normal_mulByInt` — the function-field extension `K(E)/[ℓ]*K(E)` is normal. -+Consequently, automorphisms of `K(E)/[ℓ]*K(E)` differ from the generic -+point by rational kernel points. The minimal polynomials of the generic -+coordinates split in `K(E)`, proving normality of this extension. - --Both rest on **kernel-rationality** (`kernelDescends_general`, specialised to --`kernelOverKE_descends` at `L = K(E)`): over `K̄`, every point `Q` of `E` with coordinates in a --field extension `L` that is killed by `[ℓ]` already descends to a `K̄`-rational `ℓ`-torsion point. --The reason is the division-polynomial connection `[ℓ]Q = O ⟹ ψ_ℓ(x(Q), y(Q)) = 0 ⟹ Ψ²_ℓ(x(Q)) = 0`: --the `x`-coordinate of `Q` is a root of the `ℓ`-division polynomial `Ψ²_ℓ`, whose coefficients lie --in `K̄` (not just `L`); since `K̄` is algebraically closed, `Ψ²_ℓ` splits over `K̄`, so `x(Q)` is --the image of a `K̄`-element. The `y`-coordinate then descends via the Weierstrass --equation over `K̄`. -- --Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10c. -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10(c). - -/ - - open WeierstrassCurve Polynomial -@@ -228,7 +221,7 @@ of `[ℓ]`. - - The geometric action `g` of `[ℓ]` on `(W_KE).Point` is multiplication-by-`ℓ` (`zsmulAddGroupHom ℓ`), - whose value at the generic point is `(mulByInt_x ℓ, mulByInt_y ℓ) = ([ℓ]*x_gen, [ℓ]*y_gen)` --(`zsmul_genericPoint_eq` + `mulByInt_pullback_x/y`); this is the genuine data. The shipped -+(`zsmul_genericPoint_eq` + `mulByInt_pullback_x/y`); the generic-point identity. The lemma - `genericPointAct_mem_ker_g` then yields `g(σ P_gen) = g(P_gen)` — using `σ.commutes` (it fixes the - pullback range) and the equivariance `g ∘ (Point.map σ) = (Point.map σ) ∘ g`, which here is just - `map_zsmul`. Thus `ℓ • (σ P_gen − P_gen) = 0`, and `kernelOverKE_descends` produces the descended -@@ -241,7 +234,7 @@ theorem hdesc_mulByInt [IsAlgClosed F] (ℓ : ℤ) (hℓ : ℓ ≠ 0) : - liftPointToKE W k = - genericPointAct W (mulByInt W.toAffine ℓ) σ - genericPoint W := by - intro σ -- letI := (mulByInt W.toAffine ℓ).toAlgebra -+ let := (mulByInt W.toAffine ℓ).toAlgebra - set g : (W_KE W).toAffine.Point →+ (W_KE W).toAffine.Point := zsmulAddGroupHom ℓ - obtain ⟨hns, hsmul⟩ := zsmul_genericPoint_eq W ℓ hℓ - have hsmul' : ℓ • genericPoint W = -@@ -449,16 +442,15 @@ theorem minpoly_gen_splits_of_mem_range [IsAlgClosed F] (ℓ : ℤ) (_hℓ : ℓ - letI := (mulByInt W.toAffine ℓ).toAlgebra - Polynomial.Splits ((minpoly W.toAffine.FunctionField a).map - (algebraMap W.toAffine.FunctionField W.toAffine.FunctionField)) := by -- letI algB := (mulByInt W.toAffine ℓ).toAlgebra -- -- Re-pin the canonical `Algebra K(E) Ω` to use `Algebra.id` for the `[Algebra K(E) K(E)]` slot -- -- of `AlgebraicClosure.instAlgebra` (otherwise the ambient `letI := pullback` poisons it, making -- -- the proof's `algebraMap K(E) Ω` disagree with the one baked into `hmem`). -- letI stdΩ : Algebra W.toAffine.FunctionField (AlgebraicClosure W.toAffine.FunctionField) := -+ let algB := (mulByInt W.toAffine ℓ).toAlgebra -+ -- Use the standard embedding into the algebraic closure for the coordinate field, -+ -- while the base-field action on that coordinate field is the isogeny pullback. -+ let stdΩ : Algebra W.toAffine.FunctionField (AlgebraicClosure W.toAffine.FunctionField) := - @AlgebraicClosure.instAlgebra W.toAffine.FunctionField _ W.toAffine.FunctionField _ - (Algebra.id W.toAffine.FunctionField) -- haveI hfin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField -+ have hfin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField - _ _ algB.toModule := isogeny_finiteDimensional W (mulByInt W.toAffine ℓ) -- haveI halg : Algebra.IsAlgebraic W.toAffine.FunctionField W.toAffine.FunctionField := -+ have halg : Algebra.IsAlgebraic W.toAffine.FunctionField W.toAffine.FunctionField := - Algebra.IsAlgebraic.of_finite _ _ - -- `Ω = AlgebraicClosure K(E)` is made a *base*-algebra via the ring hom `algebraMap ∘ pullback`, - -- supplied *inline* to the abstract criterion (never a scope instance, so the standard -@@ -486,7 +478,7 @@ theorem minpoly_gen_splits_of_mem_range [IsAlgClosed F] (ℓ : ℤ) (_hℓ : ℓ - rfl - -- Build the `F`-algHom `g` by restricting scalars along `F → B`, using the inline scalar tower - -- `F → B → Ω` (`of_algHom` for `(algebraMap) ∘ pullback`); supplied `@`-explicitly. -- haveI htower : @IsScalarTower F W.toAffine.FunctionField -+ have htower : @IsScalarTower F W.toAffine.FunctionField - (AlgebraicClosure W.toAffine.FunctionField) _ - (((algebraMap W.toAffine.FunctionField (AlgebraicClosure W.toAffine.FunctionField)).comp - (mulByInt W.toAffine ℓ).pullback.toRingHom).toAlgebra).toSMul _ := -@@ -537,11 +529,11 @@ once the two generator minimal polynomials do (`mulByInt_genCoords_minpoly_split - theorem h_normal_mulByInt [IsAlgClosed F] (ℓ : ℤ) (hℓ : ℓ ≠ 0) : - letI := (mulByInt W.toAffine ℓ).toAlgebra - Normal W.toAffine.FunctionField W.toAffine.FunctionField := by -- letI := (mulByInt W.toAffine ℓ).toAlgebra -- haveI hfin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField -+ let := (mulByInt W.toAffine ℓ).toAlgebra -+ have hfin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField - _ _ (mulByInt W.toAffine ℓ).toAlgebra.toModule := - isogeny_finiteDimensional W (mulByInt W.toAffine ℓ) -- haveI halg : Algebra.IsAlgebraic W.toAffine.FunctionField W.toAffine.FunctionField := -+ have halg : Algebra.IsAlgebraic W.toAffine.FunctionField W.toAffine.FunctionField := - Algebra.IsAlgebraic.of_finite _ _ - obtain ⟨hsx, hsy⟩ := mulByInt_genCoords_minpoly_splits W ℓ hℓ - refine normal_iff.mpr fun z ↦ ⟨(halg.isAlgebraic z).isIntegral, ?_⟩ -diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionModule.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionModule.lean -index e011591e1..dcc33eba4 100644 ---- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionModule.lean -+++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionModule.lean -@@ -10,27 +10,16 @@ import Mathlib.FieldTheory.Finiteness - import Mathlib.LinearAlgebra.Dimension.Free - - /-! --# `E[ℓ] ≅ (ZMod ℓ)²` — the geometric `ℓ`-torsion as a 2-dimensional `ZMod ℓ`-vector space -+# The two-dimensional module of prime torsion points - --For `ℓ` prime and `F` algebraically closed with `(ℓ : F) ≠ 0` (i.e. `ℓ ≠ char F`), the geometric --`ℓ`-torsion `E[ℓ] = W.toAffine[(ℓ : ℤ)]` is a 2-dimensional vector space over the field `ZMod ℓ`. -+For a prime `ℓ` different from the characteristic of an algebraically -+closed field, the geometric torsion subgroup `E[ℓ]` has cardinality -+`ℓ²`. Since every element is killed by `ℓ`, it is a vector space over -+`ZMod ℓ`. The finite-vector-space cardinality formula gives dimension -+two, hence a basis indexed by `Fin 2` and an identification with -+`Fin 2 → ZMod ℓ`. - --This builds on the axiom-clean cardinality theorem --`HasseWeil.WeilPairing.TorsionGeometric.card_torsion_ell` (`#E[ℓ] = ℓ²`, Silverman III.6.4(a)) --and packages the structure-theoretic consequences: -- --* `card_torsion_ell_nat` — `Nat.card E[ℓ] = ℓ²` (no `ℤ`-coercion); --* `torsion_ell_finite` — `E[ℓ]` is finite; --* the `Module (ZMod ℓ)` structure on `E[ℓ]` (every element is killed by `ℓ`), via -- `AddCommGroup.zmodModule`; --* `finrank_torsion_ell` — `finrank (ZMod ℓ) E[ℓ] = 2`, via `Module.natCard_eq_pow_finrank`; --* `torsion_ell_basis` — a `Basis (Fin 2) (ZMod ℓ) E[ℓ]`, via `Module.finBasisOfFinrankEq`; --* `torsion_ell_linearEquiv` — `E[ℓ] ≃ₗ[ZMod ℓ] (Fin 2 → ZMod ℓ)`, via `Basis.equivFun`. -- --These are the structures the downstream mod-`ℓ` Galois representation --`ρ_ℓ : End(E) → GL₂(ZMod ℓ)` consumes. -- --Reference: Silverman III.6.4(a), III.7. -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.6.4(a), III.7. - -/ - - open WeierstrassCurve -@@ -97,13 +86,13 @@ theorem torsion_ell_finite : Finite W.toAffine[(ℓ : ℤ)] := by - forces `ℓ^finrank = ℓ²`, hence `finrank = 2` since `ℓ ≥ 2`. -/ - theorem finrank_torsion_ell : - Module.finrank (ZMod ℓ) W.toAffine[(ℓ : ℤ)] = 2 := by -- haveI := torsion_ell_finite W ℓ hℓF -+ have := torsion_ell_finite W ℓ hℓF - have hcard : Nat.card W.toAffine[(ℓ : ℤ)] - = Nat.card (ZMod ℓ) ^ Module.finrank (ZMod ℓ) W.toAffine[(ℓ : ℤ)] := - Module.natCard_eq_pow_finrank - rw [card_torsion_ell_nat W ℓ hℓF] at hcard - have hZcard : Nat.card (ZMod ℓ) = ℓ := by -- haveI : NeZero ℓ := ⟨hℓ.out.pos.ne'⟩ -+ have : NeZero ℓ := ⟨hℓ.out.pos.ne'⟩ - rw [Nat.card_eq_fintype_card, ZMod.card] - rw [hZcard] at hcard - -- `ℓ ^ 2 = ℓ ^ finrank`, and `ℓ ≥ 2`, so the exponents agree. -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Basic.lean b/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Basic.lean -index 5e7b88094453689a80fefbc79c4a6dcb9032a838..e2365c39fcec4a07f8b7e2aac47dfbd1ec0b90ad 100644 -GIT binary patch -delta 481 -zcmX^2mhsOf#tjvWlTF!QZ@$9$o-sB*H?u?`+9fqPGbJ%8C)Kr3!7WxHIy^NqwWzqH -zD6zQMxwNP(RnN27H76&tpd>R{A^cHOBVi>?u?m@alN)&DHb3BANMma@H}GC(+$=39 -z!8Ey1v}W^jNllK;b}DHCo1d8f;1b95VK&HZn{PWkXT&La&?Sa>bGz4C7Mv=K{jam( -zl;jLkV!|n@6)}ZRo(qSwxb$^(6|}S_CuGZP*2>v~+mxqy0!+*bRtl2^!=)#S6mHu5 -Iw)i0v0F`R9Hvj+t - -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Concrete.lean b/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Concrete.lean -index a56daff33..930b5c5e6 100644 ---- a/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Concrete.lean -+++ b/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Concrete.lean -@@ -6,72 +6,23 @@ Authors: Chris Birkbeck - import HasseWeil.HasseBound.WeilPairing.Scaling.OneSub - - /-! --# Concrete base-change of a function-field pullback (CoordHom-free) -+# Base change of function-field pullbacks - --For a smooth plane curve `C / F` and an `F`-algebra extension `L` with `L/F` algebraic, the --function-field scalar-extension iso `K(C_L) ≅ L ⊗_F K(C)` is **already** available, axiom-clean, in --`HasseWeil/Curves/CurveMapBaseChange.lean`: -+For an algebraic field extension `L/F`, the canonical scalar-extension -+isomorphism `Φ : L ⊗[F] K(C) ≃ₐ[L] K(C_L)` transports a function-field -+endomorphism `f` to `Φ ∘ (id_L ⊗ f) ∘ Φ⁻¹`. - --* `functionField_tensor_locBaseChange L : (L ⊗ K(C)) ≃ₐ[L] FractionRing (L ⊗ C.CR)`, --* `functionField_baseChange_fracEquiv L : FractionRing (L ⊗ C.CR) ≃ₐ[L] K(C_L)`. -+The type synonym `Twist f` carries the scalar action through `f`. An -+explicit tensor-product linear equivalence identifies its base change -+with `Twist (id_L ⊗ f)`, proving preservation of the twisted module rank -+and hence of the degree of the pullback. - --Composing them gives the iso `Φ : (L ⊗ K(C)) ≃ₐ[L] K(C_L)` (`tensorFunctionFieldEquiv`). -+For `1 - π`, this constructs the base-changed pullback and its degree -+identity. The scaling data retain explicit hypotheses for the geometric -+kernel, divisor transport, duality, surjectivity and translation covariance. - --This file uses `Φ` to **construct** the base-change of an arbitrary function-field `F`-algebra hom --`f : K(C) →ₐ[F] K(C)` — *no `CoordHom` required* — as the conjugate -- -- `baseChangePullback f := Φ ∘ (id_L ⊗ f) ∘ Φ⁻¹ : K(C_L) →ₐ[L] K(C_L)`, -- --an honest `L`-algebra hom (`Algebra.TensorProduct.map (AlgHom.id L) f` is the `L`-linear scalar --extension of the `F`-linear `f`, conjugated by the `L`-algebra equiv `Φ`). -- --The payoff (`oneSubFrobeniusPullback_L`) is the concrete `pullback_L` field of `OneSubScalingData` --for the separable genuine isogeny `1 − π`, whose pullback has poles at the affine kernel so admits --**no** `CoordHom` — hence the whole CoordHom-free route. -- --## Degree preservation -- --`finrank_baseChangePullback_eq_finrank_lTensorMap` reduces the degree of the conjugate --`baseChangePullback f` (as an `Isogeny`, via `Isogeny.degree_eq_of_finrank_eq`) to the `finrank` of --the *scalar extension* `id_L ⊗ f` over `L ⊗ K(C)`, by transporting the finrank along the `L`-algebra --equiv `Φ` (`Algebra.finrank_eq_of_equiv_equiv`). This **conjugation step is proved here in full**. -- --The remaining equality `finrank_{L ⊗ K(C), via id_L ⊗ f}(L ⊗ K(C)) = finrank_{K(C), via f} K(C)` --is the curve-free **base-change-of-finrank** content; it is **proved here in full** as --`finrankBaseChange`, by realizing the `f`-twisted self-module `K(C)` as the type synonym `Twist f` --and exhibiting `(L ⊗ K(C)) ⊗_{K(C)} Twist f ≃ₗ[L ⊗ K(C)] Twist (id_L ⊗ f)` (so --`Module.finrank_baseChange` applies). Hence `baseChangePullback_finrank_eq` (and the degree --preservation it feeds) carries **no** finrank hypothesis. -- --## What this file discharges for `OneSubScalingData` -- --`mkOneSubScalingDataConcrete` assembles a full `OneSubScalingData` for the genuine `1 − π` base --change in which: -- --* `pullback_L` is **constructed** as the concrete `oneSubFrobeniusPullback_L` (the conjugate -- `Φ ∘ (id_L ⊗ (1−π).pullback) ∘ Φ⁻¹`) — *no longer a raw input* (axiom-clean); --* `hdeg_bc` is **fully discharged** by the proved conjugation step -- `finrank_baseChangePullback_eq_finrank_lTensorMap` chained with the proved curve-free -- `finrankBaseChange` — no carried hypothesis. -- --The remaining inputs are exactly the genuinely-deep **K̄-level geometric** residuals, each stated --against the concrete pullback: -- --* `finiteKer` — finiteness of `ker(1 − π)_{K̄}` (a separable isogeny has finite kernel over `K̄`); --* `hproj` — `ProjOrdTransport` (multiplicity-free divisor pullback); --* `δ`/`hdc` — the divisor-pushforward dual `1 − V̄` and Silverman III.6.2(a) `δ ∘ φ = [#ker φ]`; --* `hsurj` — surjectivity over `K̄` (Silverman III.4.10a); --* `hkerdeg` — the separable degree match `#ker = deg` (Silverman III.4.10c); --* `hcomm'` — the translation covariance (Silverman III.8.2). -- --These are the genuine geometric content of the base-changed separable isogeny; the project ships no --concrete base-change of a non-Frobenius isogeny's *point map* (only the witness-parametric --`mkBaseChange`), so they remain carried (cf. `ProjOrdTransport`/`Naturality` elsewhere). -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, II.2.11 (degree under base change), -- III.4.10a/c, III.6.2(a), III.8.2, III.8.6.1. -+References: Silverman, *The Arithmetic of Elliptic Curves*, II.2.11, -+III.4.10, III.6.2(a), and III.8.2–6. - -/ - - open WeierstrassCurve HasseWeil.Curves -@@ -149,8 +100,7 @@ local notation "lTM" => Algebra.TensorProduct.map (AlgHom.id L L) f - attribute [local instance] Algebra.TensorProduct.rightAlgebra - - /-- `eFwd` is surjective, from its action on pure tensors (`heFwd`) and the section `eInv` --(`heInv`). Stated with the forward/inverse maps as opaque parameters so it elaborates within the --default heartbeat budget. -/ -+(`heInv`). The forward and inverse maps are explicit parameters. -/ - private theorem twistLTensor_surjective [Module A (Twist (lTM))] - [IsScalarTower A (L ⊗[F] A) (Twist (lTM))] - (eFwd : ((L ⊗[F] A) ⊗[A] (Twist f)) →ₗ[L ⊗[F] A] (Twist (lTM))) -@@ -164,7 +114,6 @@ private theorem twistLTensor_surjective [Module A (Twist (lTM))] - refine ⟨eInv (Twist.toB (lTM) z), ?_⟩ - apply Twist.toB_injective (lTM) - induction (Twist.toB (lTM) z) with -- | zero => simp only [map_zero]; rfl - | add x y hx hy => - rw [map_add, map_add, Twist.toB_add] - rw [show Twist.toB (lTM) (eFwd (eInv x)) = x from hx, -@@ -176,7 +125,7 @@ private theorem twistLTensor_surjective [Module A (Twist (lTM))] - Algebra.TensorProduct.tmul_mul_tmul, mul_one, one_mul] - - /-- `eInv ∘ toB ∘ eFwd = id`, from the action on pure tensors. The left inverse, giving --injectivity of `eFwd`. Forward/inverse maps are opaque parameters for heartbeat budget. -/ -+injectivity of `eFwd`. The forward and inverse maps are explicit parameters. -/ - private theorem twistLTensor_leftInverse [Module A (Twist (lTM))] - [IsScalarTower A (L ⊗[F] A) (Twist (lTM))] - (eFwd : ((L ⊗[F] A) ⊗[A] (Twist f)) →ₗ[L ⊗[F] A] (Twist (lTM))) -@@ -188,14 +137,9 @@ private theorem twistLTensor_leftInverse [Module A (Twist (lTM))] - ∀ t : (L ⊗[F] A) ⊗[A] (Twist f), eInv (Twist.toB (lTM) (eFwd t)) = t := by - intro t - induction t with -- | zero => rw [map_zero (f := eFwd), show Twist.toB (lTM) 0 = 0 from rfl, -- map_zero (f := eInv)] - | add x y hx hy => rw [map_add (f := eFwd), Twist.toB_add, map_add (f := eInv), hx, hy] - | tmul w m => - induction w with -- | zero => -- rw [TensorProduct.zero_tmul, map_zero (f := eFwd), -- show Twist.toB (lTM) 0 = 0 from rfl, map_zero (f := eInv)] - | add x y hx hy => - rw [TensorProduct.add_tmul, map_add (f := eFwd), Twist.toB_add, map_add (f := eInv), - hx, hy] -@@ -222,9 +166,9 @@ equals the `A`-module finrank of `A` via `f`. Proved by exhibiting the `L ⊗ A - private theorem finrank_lTensorMap_eq_finrank : - @Module.finrank (L ⊗[F] A) (L ⊗[F] A) _ _ (lTM).toRingHom.toAlgebra.toModule = - @Module.finrank A A _ _ f.toRingHom.toAlgebra.toModule := by -- letI iA_TwL : Module A (Twist (lTM)) := -+ let iA_TwL : Module A (Twist (lTM)) := - Module.compHom (Twist (lTM)) (algebraMap A (L ⊗[F] A)) -- haveI iA_TwL_tower : IsScalarTower A (L ⊗[F] A) (Twist (lTM)) := -+ have iA_TwL_tower : IsScalarTower A (L ⊗[F] A) (Twist (lTM)) := - SMul.comp.isScalarTower (algebraMap A (L ⊗[F] A)) - let l : (Twist f) →ₗ[A] (Twist (lTM)) := - { toFun := fun m ↦ Twist.ofB (lTM) (1 ⊗ₜ[F] Twist.toB f m) -@@ -292,8 +236,7 @@ variable (L : Type*) [Field L] [Algebra F L] [Algebra.IsAlgebraic F L] - - /-- **The function-field scalar-extension iso** `Φ : (L ⊗_F K(C)) ≃ₐ[L] K(C_L)`, the composite of - `functionField_tensor_locBaseChange` (`L ⊗ K(C) ≅ FractionRing (L ⊗ C.CR)`) and --`functionField_baseChange_fracEquiv` (`FractionRing (L ⊗ C.CR) ≅ K(C_L)`). Both are shipped --axiom-clean in `CurveMapBaseChange.lean`. -/ -+`functionField_baseChange_fracEquiv` (`FractionRing (L ⊗ C.CR) ≅ K(C_L)`). These are the canonical tensor and fraction-field identifications. -/ - noncomputable def tensorFunctionFieldEquiv : - letI := C.isDomain_tensorCoordRing L - (L ⊗[F] C.toAffine.FunctionField) ≃ₐ[L] (C.baseChange L).toAffine.FunctionField := -@@ -307,7 +250,7 @@ noncomputable def lTensorMap (f : C.toAffine.FunctionField →ₐ[F] C.toAffine. - (L ⊗[F] C.toAffine.FunctionField) →ₐ[L] (L ⊗[F] C.toAffine.FunctionField) := - Algebra.TensorProduct.map (AlgHom.id L L) f - --set_option linter.unusedSectionVars false in -+omit [Algebra.IsAlgebraic F L] in - @[simp] theorem lTensorMap_tmul - (f : C.toAffine.FunctionField →ₐ[F] C.toAffine.FunctionField) (l : L) - (u : C.toAffine.FunctionField) : -@@ -355,10 +298,10 @@ theorem finrank_baseChangePullback_eq_finrank_lTensorMap - (baseChangePullback C L f).toRingHom.toAlgebra.toModule = - @Module.finrank (L ⊗[F] C.toAffine.FunctionField) (L ⊗[F] C.toAffine.FunctionField) _ _ - (lTensorMap C L f).toRingHom.toAlgebra.toModule := by -- letI := C.isDomain_tensorCoordRing L -- letI algBcp : Algebra (C.baseChange L).toAffine.FunctionField -+ let := C.isDomain_tensorCoordRing L -+ let algBcp : Algebra (C.baseChange L).toAffine.FunctionField - (C.baseChange L).toAffine.FunctionField := (baseChangePullback C L f).toRingHom.toAlgebra -- letI algLt : Algebra (L ⊗[F] C.toAffine.FunctionField) (L ⊗[F] C.toAffine.FunctionField) := -+ let algLt : Algebra (L ⊗[F] C.toAffine.FunctionField) (L ⊗[F] C.toAffine.FunctionField) := - (lTensorMap C L f).toRingHom.toAlgebra - refine Algebra.finrank_eq_of_equiv_equiv (tensorFunctionFieldEquiv C L).symm.toRingEquiv - (tensorFunctionFieldEquiv C L).symm.toRingEquiv ?_ -@@ -380,7 +323,7 @@ def FinrankBaseChange (f : C.toAffine.FunctionField →ₐ[F] C.toAffine.Functio - @Module.finrank C.toAffine.FunctionField C.toAffine.FunctionField _ _ - f.toRingHom.toAlgebra.toModule - --set_option linter.unusedSectionVars false in -+omit [Algebra.IsAlgebraic F L] in - /-- **The base-change-of-finrank fact, proved (curve-free).** For an `F`-algebra endomorphism `f` - of the field `K(C)`, base change along `F → L` preserves the degree of the (injective) field - endomorphism: `[L ⊗ K(C) : (id_L ⊗ f)(L ⊗ K(C))] = [K(C) : f(K(C))]`. -/ -@@ -422,7 +365,7 @@ noncomputable def oneSubFrobeniusPullback_L (hq : 2 ≤ Fintype.card K) : - - /-- **Degree preservation for the concrete `1 − π` base change** (curve-free, fully discharged). - Chains the proved conjugation step (inside `baseChangePullback_finrank_eq`, which now invokes the --proved `finrankBaseChange`) into the shipped witness-parametric -+proved `finrankBaseChange`) into the corresponding - `oneSubFrobeniusIsogBaseChange_degree_eq_of_finrank`. This **discharges the `hdeg_bc` field** of - `OneSubScalingData` with no carried `FinrankBaseChange` hypothesis. -/ - theorem oneSubFrobeniusIsogBaseChange_degree_eq_of_finrankBaseChange (hq : 2 ≤ Fintype.card K) : -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/Basic.lean b/projects/HasseWeil/HasseWeil/Isogeny/Basic.lean -index 01ae90e29..fc74956a0 100644 ---- a/projects/HasseWeil/HasseWeil/Isogeny/Basic.lean -+++ b/projects/HasseWeil/HasseWeil/Isogeny/Basic.lean -@@ -45,7 +45,7 @@ image of `x` has poles at the `n`-torsion). - The current `pullback_ordAtInfty_nonneg` field captures "morphism is defined at - the basepoint" (regular functions pull back to regular functions). It does not - strictly capture `φ(O) = O` — that would require the strict-positive form --`0 < ord_∞ f → 0 < ord_∞ pullback f`. A future refinement may strengthen this. -+`0 < ord_∞ f → 0 < ord_∞ pullback f`. - - ## References - -@@ -296,6 +296,7 @@ noncomputable def Isogeny.frobenius : Isogeny W W where - · rw [(⟨W⟩ : Curves.SmoothPlaneCurve K).ordAtInfty_pow hf] - exact nsmul_nonneg h _ - -+omit [DecidableEq K] in - @[simp] theorem Isogeny.frobenius_pullback (f : W.FunctionField) : - (Isogeny.frobenius W).toCurveMap.pullback f = f ^ Fintype.card K := - congr_fun (FiniteField.coe_frobeniusAlgHom (K := K) (R := W.FunctionField)) f -@@ -313,12 +314,14 @@ noncomputable def Isogeny.frobeniusCoordHom : - (FiniteField.frobeniusAlgHom K W.CoordinateRing u) - simp only [FiniteField.coe_frobeniusAlgHom, map_pow] - -+omit [DecidableEq K] in - /-- The Frobenius isogeny has degree `q := #K`. Inherits from - `HasseWeil.frobenius_finrank_functionField`. Reference: Silverman III.4.6. -/ - @[simp] theorem Isogeny.frobenius_degree : - (Isogeny.frobenius W).degree = Fintype.card K := - HasseWeil.frobenius_finrank_functionField K W - -+omit [DecidableEq K] in - /-- **Frobenius coordinate-evaluation step.** Evaluating a pulled-back - coordinate-ring element `r` through the Frobenius coordinate hom at a smooth - point `(x, y)` equals the `q`-th power (`q := #K`) of the plain evaluation: -@@ -336,6 +339,7 @@ private theorem Isogeny.frobenius_evalAtPullback {x y : K} - ⟨x, y, h⟩ (FiniteField.frobeniusAlgHom K W.CoordinateRing r) = _ - simp only [FiniteField.coe_frobeniusAlgHom, map_pow] - -+omit [DecidableEq K] in - /-- The Frobenius isogeny acts as the **identity** on `K`-rational points: for - any `(x, y) ∈ W(K)`, Frobenius sends `(x, y) ↦ (x^q, y^q) = (x, y)` since - `x^q = x` for all `x ∈ K` by `FiniteField.pow_card`. The basepoint is -@@ -383,23 +387,17 @@ end Frobenius - - /-! ### Multiplication-by-`n` isogeny - --The endomorphism `[n] : E → E` is constructed via the function-field pullback --`mulByInt_pullbackAlgHom` from `HasseWeil/MulByIntPullback.lean` (built from --division polynomials). -+The endomorphism `[n] : E → E` is constructed from the division-polynomial -+function-field pullback `mulByInt_pullbackAlgHom`. - --The basepoint condition `pullback_ordAtInfty_nonneg` for `[n]` is genuinely --non-trivial — it requires the ramification-theoretic fact that --`ord_∞([n]*f) = e · ord_∞(f)` for some positive integer `e` (the local --ramification index of `[n]` at `O`). For now we expose this as an explicit --hypothesis (`mulByIntOfBasepoint`); a follow-up ticket will discharge it via --the existing `mulByInt_finrank` infrastructure or a dedicated valuation --extension argument. -+The construction `mulByIntOfBasepoint` takes an explicit hypothesis that the -+pullback preserves functions regular at infinity. The corresponding local -+ramification formula is `ord_∞([n]*f) = e · ord_∞(f)` with positive ramification -+index `e`. - --Note that `[n]` does *not* admit a `coordHom` witness in the affine model — --its pullback of `x` is `Φ_n / Ψ_n²`, a fraction with poles at the --`n`-torsion. Hence `Isogeny.toPointMap` cannot be invoked for `mulByInt` --directly via the affine route; this is the design reason for separating --`coordHom` from the structure. -/ -+For `n ≥ 2`, the pullback of `x` is `Φ_n / Ψ_n²`, with poles at the `n`-torsion. -+Thus this projective morphism does not generally induce a map of affine -+coordinate rings. -/ - - section MulByInt - -@@ -428,6 +426,7 @@ noncomputable def Isogeny.mulByIntOfBasepoint {n : ℤ} (hn : n ≠ 0) - toCurveMap := { pullback := HasseWeil.mulByInt_pullbackAlgHom W n hn } - pullback_ordAtInfty_nonneg := h_basepoint - -+omit [DecidableEq F] in - @[simp] theorem Isogeny.mulByIntOfBasepoint_pullback {n : ℤ} (hn : n ≠ 0) - (h_basepoint : MulByIntBasepoint W hn) (f : W.FunctionField) : - (Isogeny.mulByIntOfBasepoint W hn h_basepoint).toCurveMap.pullback f = -@@ -435,48 +434,14 @@ noncomputable def Isogeny.mulByIntOfBasepoint {n : ℤ} (hn : n ≠ 0) - - end MulByInt - --/-! ### Universal group-homomorphism property: bundled `WithHom` isogenies -+/-! ### Bundled group-homomorphism property - --This is the working framework for **Silverman III.4.8** (every isogeny is a --group homomorphism). Silverman's argument uses `Pic⁰(E) ≅ E` and the --contravariant functoriality of the Picard variety on morphisms; alternative --routes go via the formal group of `E` or direct addition-formula computation. -+The `WithHom` structure bundles an isogeny with an affine coordinate-ring map -+and a proof of `AddHomProperty`. Identity, composition and Frobenius preserve -+this data, yielding additive homomorphisms on rational points. - --In our setup, the unconditional theorem is genuinely hard — it reduces to one --of those upstream infrastructures, none of which are fully in the project yet. --Instead, we package the **closure under standard constructions**: any isogeny --built from `id`, `compose`, and `frobenius` automatically carries an --`AddHomProperty`, hence a bundled `AddMonoidHom` on points. -- --The `WithHom` bundle below is the canonical recipient of these closure --operations. Future extensions (mulByInt, neg, dual, factor-through-Frobenius, --…) should provide their own `WithHom` instances by discharging the --`AddHomProperty` witness. -- --## Proof routes for the universal version -- --Silverman's three known routes for the universal Silverman III.4.8: -- --1. **Pic⁰ route** (Silverman III.4.8 proper). Uses -- `σ : Pic⁰(E) ≅ E` (Silverman III.3.4) — gated on `T-III-3-004` in this -- project. The induced pullback `φ_* : Pic⁰(E₁) → Pic⁰(E₂)` is a hom by -- functoriality, and the diagram with σ commutes when `φ(O) = O`. -- --2. **Formal-group route** (deformation argument). An isogeny pulls back to a -- formal-group hom on `Ê`. The hom property holds on the formal neighborhood -- of `O`, then extends to all of `E` by translation invariance and density. -- Requires the bridge `HasseWeil.Isogeny → HasseWeil.FormalGroupHom`, not yet -- built. -- --3. **Addition-formula route** (direct computation). Use the explicit -- `Affine.addX/addY` formulas; show that any `F`-algebra hom on `K(E)` that -- restricts to coord rings preserves these (an algebra-homs-respect-rational- -- functions argument). Requires `addPullbackAlgHom` from -- `HasseWeil/AdditionPullback.lean` (currently has 3 transcendence sorries). -- --All three reduce the universal claim to upstream infrastructure that is --modular: once any one route's gates are filled, `silvermanIII48_via_` --can be added as a one-liner taking the upstream output as a witness. -/ -+Silverman III.4.8 proves the group-homomorphism property for isogenies using -+`Pic⁰(E) ≅ E` and the functoriality of the Picard variety. -/ - - namespace Isogeny - -@@ -627,23 +592,6 @@ noncomputable def Isogeny.WithHom.frobenius - show (Isogeny.frobenius W).toPointMap (Isogeny.frobeniusCoordHom W) P = P - exact Isogeny.frobenius_toPointMap W P - --/-! ### Future extensions (mulByInt, neg, dual) -- --For each of the following, providing a `WithHom` instance requires both a --coord-ring lift (often non-trivial) and the `AddHomProperty` proof: -- --* `mulByInt n` for `n ≥ 2`: the affine coord-ring lift doesn't naturally -- exist (image of `x` is `Φₙ/Ψₙ²`, with poles at the `n`-torsion). Resolution -- requires a localization-based `CoordHom` or a projective coord model. -- --* `neg` (the `[-1]` isogeny): `(x, y) ↦ (x, -y - a₁x - a₃)`. Has a clean -- affine coord-ring lift via `Affine.negY`. The `AddHomProperty` is -- `-(P+Q) = -P + -Q`, which holds by `neg_add` on the abelian group `W.Point`. -- Construction is straightforward in principle but requires explicit -- `AlgHom` building from the negY formula on the function field. - --* `dual α`: requires the existence-uniqueness of the dual isogeny -- (Silverman III.6.1), gated on either Pic⁰ or kernel/factorization -- infrastructure (`T-III-6-001` in the project ticket board). -/ - - end HasseWeil.EC -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/ClassGroup.lean b/projects/HasseWeil/HasseWeil/Isogeny/ClassGroup.lean -index 9b2003a2e..5d5eaceb9 100644 ---- a/projects/HasseWeil/HasseWeil/Isogeny/ClassGroup.lean -+++ b/projects/HasseWeil/HasseWeil/Isogeny/ClassGroup.lean -@@ -8,59 +8,12 @@ import HasseWeil.Foundation.Ramification - import HasseWeil.Pic0.ClassGroupNorm - - /-! --# The isogeny ↔ class-group bridge (reusable Pic⁰ infrastructure) -+An injective finite coordinate-ring pullback associated to an elliptic-curve -+endomorphism induces extension and relative-norm maps on the ideal class group. -+Their composite raises each class to the coordinate-ring extension degree. -+A compatible fraction-field tower identifies this degree with the isogeny degree. - --This file packages, for an endomorphism `α : Isogeny E E` of an elliptic curve `E`, the data and --lemmas needed to push `α` down to the ideal class group `ClassGroup E.CoordinateRing` and recover --the dual relation `α̂ ∘ α = [deg α]` at the level of `ClassGroup`. -- --The function-field pullback `α.pullback : E.FunctionField →ₐ[F] E.FunctionField` does **not** in --general restrict to the coordinate ring `R := E.CoordinateRing` (this is the --integrality-preservation content of Silverman III.3.4, deliberately *not* discharged here). We --therefore carry the restriction as **data**, an `Isogeny.CoordHom`, mirroring --`Curves.CurveMap.CoordHom`. -- --The deep obligations are carried as **hypotheses** (witness-parametric), not discharged universally: -- --* injectivity of the coordinate-ring restriction (`hinj`), giving `FaithfulSMul`/`IsTorsionFree`; --* finiteness of `R` over itself through the restriction (`Module.Finite`), giving the `ClassGroup` -- norm/extension maps and matching `α.degree` to the coordinate-ring `finrank`. -- --These are instantiable per isogeny (e.g. Frobenius, multiplication-by-`n`); the universal versions --are separate, flagged-deep tickets. -- --## Main definitions -- --* `HasseWeil.Isogeny.CoordHom`: the coordinate-ring restriction witness for `α : Isogeny E E`. --* `HasseWeil.Isogeny.CoordHom.toAlgebra`: the induced `R`-algebra structure on `R`. --* `HasseWeil.Isogeny.classNorm` / `Isogeny.classMap`: the relative norm / extension maps on -- `ClassGroup R` induced by a `CoordHom`. -- --## Main results -- --* `HasseWeil.Isogeny.degree_eq_finrank_coordinateRing_of_tower_eq`: `α.degree` equals the -- coordinate-ring `finrank` of `ch.toAlgebra`, given a fraction-field tower witness for the -- `ch`-twisted coordinate ring (witness-parametric, to sidestep a same-type instance diamond — see -- the lemma's docstring). --* `HasseWeil.Isogeny.classNorm_comp_classMap`: `classNorm (classMap c) = c ^ (finrank R R)` — the -- class-group shadow of `α̂ ∘ α = [deg α]`, exponent as the coordinate-ring degree. --* `HasseWeil.Isogeny.classNorm_comp_classMap_degree`: the same with exponent `α.degree` (combines -- the previous two; carries the tower witness as hypotheses). -- --## Design note -- --The function-field pullback restricted to coordinate rings and lifted back to the fraction field --gives, on the *same* carriers `R` and `FF`, a *non-identity* algebra structure. Several would-be --"auto-derived" scalar towers (`R → R → FF`, `R → FF → FF`) are therefore **false** as stated with --the canonical base action, and `finrank_of_isFractionRing` cannot be applied with `S = R`, --`S' = FF` literally (the `IsFractionRing` typeclass cannot distinguish the canonical inclusion from --the twisted map). The deep obligations (injectivity `hinj`, finiteness `Module.Finite`, and the --fraction-field tower witness for the degree bridge) are consequently carried as **hypotheses**; --they are instantiable per isogeny (Frobenius, multiplication-by-`n`). -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*], III.3.4, III.4, III.6. -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.3.4. - -/ - - open WeierstrassCurve Polynomial -@@ -146,7 +99,7 @@ noncomputable def classNorm (ch : α.CoordHom) (hinj : Function.Injective ch.toA - haveI hfinI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin - haveI htfI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := - ch.isTorsionFree hinj -- @ClassGroup.relNorm E.CoordinateRing E.CoordinateRing _ _ _ _ _ _ _ _ ch.toAlgebra hfinI htfI -+ @ClassGroup.relNorm E.CoordinateRing E.CoordinateRing _ _ _ _ ch.toAlgebra hfinI htfI - - /-- The **extension map on the class group** induced by `α : Isogeny E E` and a coordinate-ring - restriction witness `ch`, with the finiteness obligation carried as a hypothesis. -@@ -160,7 +113,7 @@ noncomputable def classMap (ch : α.CoordHom) (hinj : Function.Injective ch.toAl - haveI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin - haveI htfI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := - ch.isTorsionFree hinj -- @ClassGroup.map E.CoordinateRing E.CoordinateRing _ _ _ _ _ _ ch.toAlgebra htfI -+ @ClassGroup.map E.CoordinateRing E.CoordinateRing _ _ _ _ ch.toAlgebra htfI - - /-- **Function-field ↔ coordinate-ring degree bridge (witness-parametric `_of_tower_eq` form).** - -@@ -168,23 +121,11 @@ The function-field degree `α.degree` equals the coordinate-ring degree - `Module.finrank R R` (with `R` carrying `ch.toAlgebra`), *given* a fraction-field tower witness for - the `ch`-twisted coordinate ring. - --The deep obstruction (see the file-level note and the round report) is a genuine **same-type --instance diamond**: `Algebra.IsAlgebraic.finrank_of_isFractionRing` needs the source/target rings --`R, S` and their fraction fields `R', S'` to be *distinguishable type pairs* so that --`IsFractionRing R R'` and `IsFractionRing S S'` can coexist with the canonical inclusion (for `R'`) --and the `ch`-twisted map (for the `S → S'` tower) respectively. With `S = R` and `S' = R' = FF` --*literally*, Lean's instance resolution cannot keep the two `Algebra R FF` structures apart, even --though the required equation `α.pullback (algebraMap R FF r) = algebraMap R FF (ch.toAlgHom r)` is --exactly `ch.compat`. -- --We therefore expose the bridge witness-parametrically: the caller supplies a *distinct nominal copy* --`S` of the `ch`-twisted coordinate ring together with its fraction field `S'` (a copy of --`E.FunctionField` carrying `α.toAlgebra`), the standard fraction-field tower instances, and the two --`Module.finrank`-transfer equalities `hSR`, `hS'FF` (each a `LinearEquiv.finrank_eq` away once the --copies are chosen). These are dischargeable per isogeny (Frobenius, multiplication-by-`n`). -- --The conclusion is then a one-line application of `finrank_of_isFractionRing` between the four --distinct type slots `R, FF, S, S'`. -/ -+The coordinate-ring algebra induced by the endomorphism differs from the -+canonical algebra on the same carrier. Distinct nominal copies `S` and `S'` -+represent the twisted coordinate ring and its fraction field. Compatible -+scalar towers and the rank-transfer equalities `hSR` and `hS'FF` allow the -+fraction-field rank theorem to compare their degrees. -/ - theorem degree_eq_finrank_coordinateRing_of_tower_eq (ch : α.CoordHom) - (S : Type*) [CommRing S] [Algebra E.CoordinateRing S] - [FaithfulSMul E.CoordinateRing S] [Algebra.IsAlgebraic E.CoordinateRing S] [NoZeroDivisors S] -@@ -197,7 +138,7 @@ theorem degree_eq_finrank_coordinateRing_of_tower_eq (ch : α.CoordHom) - (hS'FF : @Module.finrank E.FunctionField S' _ _ _ = α.degree) : - α.degree = @Module.finrank E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := by - rw [← hSR, ← hS'FF] -- exact Algebra.IsAlgebraic.finrank_of_isFractionRing E.CoordinateRing E.FunctionField S S' -+ exact IsFractionRing.finrank_eq E.CoordinateRing E.FunctionField S S' - - /-- **The class-group dual relation (coordinate-ring `finrank` form).** - -@@ -209,17 +150,17 @@ the `ch.toAlgebra` structure): - This is the class-group shadow of `α̂ ∘ α = [deg α]`, with the exponent expressed as the - coordinate-ring degree. To express the exponent as `α.degree` (the function-field degree), compose - with `degree_eq_finrank_coordinateRing_of_tower_eq` (the function-field ↔ coordinate-ring degree --bridge, separately flagged). -/ -+bridge). -/ - theorem classNorm_comp_classMap (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) - (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) - (c : ClassGroup E.CoordinateRing) : - α.classNorm ch hinj hfin (α.classMap ch hinj hfin c) = - c ^ @Module.finrank E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := by -- letI := ch.toAlgebra -- haveI hfinI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin -- haveI htfI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := -+ let := ch.toAlgebra -+ have hfinI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin -+ have htfI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := - ch.isTorsionFree hinj -- exact @ClassGroup.relNorm_comp_map E.CoordinateRing E.CoordinateRing _ _ _ _ _ _ _ _ -+ exact @ClassGroup.relNorm_comp_map E.CoordinateRing E.CoordinateRing _ _ _ _ - ch.toAlgebra hfinI htfI c - - /-- **The class-group dual relation (`α.degree` form).** -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/FormalSeries.lean b/projects/HasseWeil/HasseWeil/Isogeny/FormalSeries.lean -index 0cabc394abc4ca7608ba92b737cb85363078b59b..dcd6e5526f0503f078f119bafd1bb4a80e1148f6 100644 -GIT binary patch -delta 8683 -zcmbtaZHygN8P06CYnk#T+wHc1a7x>-OLuQ6ZH*SIEv2gq3oUdhl&0y-z4zREN9NAl -z&dlBI@-=`MP=in==KdgjC{Z!~K`+UM!~`VP9~u=CqyJP0nt)M(A8H~oKJRn -zS`@;^%sq3?`}w@@`<(vdxq*kDU-@Ex-=yQs*nwkvk*GSgnhc~DIkp>`=5#}fnjbW6 -zSA;TfWGMWausz{~eqDNV_^OdeY?yar30C^TDb*Dc$XyXccBdHq6> -z{IlzI*~IYg&$P$ -z%J!=KO(4Uz8#!Jb3ua|trlQgpcgw&R72gXZ(k_y5&@3snD!#1MoQi|v^r56*AYD6> -z>hN@*$mdhSitXBgD9?%6hEr+KyIe=R62TN6FI?K1B>`j3Z4q`Lg*@4U%pr`{4oPf0 -zyAUNZGf7Fc#F!o&lwnC6YL`RUq#Zdp!SRxJ-Jw|2VTaJPt5vcH48~@L0bMu)Viwh- -z%^a`VuJ8u%r)ZMB=uDemK_}ZY9WRn~8Km~f97JEYeEcYyb_@HkjTd -z8`_bEI8L@C{^dm_b06$4Pqgv>F8rGNt|((;uI0m`AzaXGhY|U#A_H}p7Uf!#y#p(R -zu_()ER!T1yEfluvds0+=;rWoO*>dMt)`}m%+AZI!lC9GKgRfIX)A*jUAv=_uvE8<^ -zid_#R#F=#>cD5EATYI(G@i<6fxr*OJlp-TMGYtT1V&sldYrJfSh+u2mn3%KJ`;gTo -z^VHi-oJ6rksY5b4K^6l7pGmg2ncD=S-YPjUD>B?A4mrt$Io1u$odd(lJ;l7>_)h-N -zw=Q}2!gFKnu62g-SsCR4*s3JWFe)4_>d^7`mlZKNI#TF4VXD{%8pCHuDuVS$uwX*$Rd>`Yx&o) -zwDbvl0p!Y3O&gaW3;;!;mr6dK=DjPMO&d|tom{hXMV}LPli{7K&Lg}+j49!||GK<3 -z)YtZs*3)ZOh7G$V6MyKEiq%auUX$^+k=~XP0uFhVpT2eP@Q{Fkb=gQmAd(bwFtiE^JC+Rm3haVU4jB -zt%@a(v8VyO>0(SVlLx2P0L;mWH77vAB2HXMCDb&f2R4mnf`RRaN2X_3gw -zOtb8GjF-ri@vWx0b$lGCf^2QV6=@tqggX@Zsb@!)c5Oii1}ak|^{G;F%OfH=FtM)t -z_1jv;Sr~rR?R{sl?D;i!oW-i-vLl<$;>f8ZGb{E^s6I)1m1B;gS6467EX3tugyoI} -zah}|H?BbD11L!=C+(Ca8iLl*NmI!-WfXL@2fbd(F#0(NM1k?r52~pa^w(fRz6^nBw -z9gEAKj#HV3gWM`@;QF)pDXSoP#{-YXsxD>+5|%9PEC5id=_91lQEoyrBxp6HJ`aEj -zwVjF-vwqvHGV%ZyR2|WcC+B^Z7aV`F9TWo?ozgVyt$`hRR+c0_oRAi=uq7)_O?3sj -zpY3Ut%wotlWHXdNk}R+_nrkH8p2aoJB1BIm)*)b;`w2sf^~&x%ai1~#WZ$afWbNFf -z^{4(g@9Zk*!OBtqx*V9lisaD;Mbvc`9+je5a#0Jg7@|Y7=Ck{#F=rfYqi4|`AQZZiIwXX -z#EzD2E;$i?W!WFQ{n1YcmjCrPci*@&Mja@W0f^FDPYW(G%}M2&IUY)E3_08yp$%U4 -zn?irw(`TD$K-OXfi-ltZ1_uxQcmQwpXw72`DovK<7(xpZj*9v;ZwrZ1CHVVRaR9g@+n<( -zG3=^3&H69Ki?knMCp3Jw+P&qGm-@C&Eiq2!0fmEDH9(i|VSkt4ZS7tbf(9@`8I_^M -z5%tUpqUK+j{O5rSx-Wk1_XB1mkINIsU0I8gWyStMW#%=i;5!Bpc -zst;jnru|&*OX3C2ECQNT$*srcZ~Qi%NcGg^OHaLw2|e-JxhQOhER3urrw#qkdR12 -zDiJ-osN2#7FEdyY)=_WEwqpq4iIJn;u`zLU+p$qh4OIV&ou$gfdG+1YIXWD^=J$?S+(lw>+Blak@_YXc(+O?e6c~`&O -zitaC-xp&q7@qJSN?zg*ZUbw$03?&(h -zQy>en)V53vFmj|zP35f{z(|gPo$${10q;%JgA1Z003bMltd_)WGyx*HoiI6dddL{- -zobrwJDX9lRt5^kYEwiVoNh4h;R7xMtxT+Nc9(OE^bFVhL0SlVK^3l*Sx{qC%1x2%jV2!?4b)e2)|Tb-WuZ*`sm8CazkAS -z+9CjN#h|QJ7}Z!z5`BotoTw{a`MJ^WH=QW?!KI@6_g4qbiFG#$zFdzXL;*IA6RBru -z{}ZpZbmZ`ORg6kxwspW#{dq=~S(A!>w?t05G9z_f&X>XB-4}lL&ia+iVs$%j{i?qo -z1O7~M*V`MfCZWaAf(iB!1yh;~_q(psieR?eOOd}96Qd`OA$yX?-v04Ld9dkV?B4Uv -z>AvL6A6?un|8>^||I4nMyRUxGzI5!P$di10!{DHGw>6GDN*QfdG3mTDIv=k$`UgJh -zc0--ya^rV&ZL!EL$=*M&nSWFmj~iFz>BQ8srp{4D78cIVjaL{qD!X@{y23cPPN#h# -z7#WH>ug)0j=Fi_~JigYL?wk_Fa7>*YF@$^pQxXRNm~*fF5Eb;~Yh7*?(Q#1s>~g-L -zNSfBj)nnU6t(2fGT&$2}*-gb6E>dtcg4xEYqFJWP7g28WnG@WIhC#m_nRHhogBeXus}8(S -z@-!YOOx#PwiuiR6^qL?fM5#+qoe|+e2CV?c>!|JG7l-L!BIc1;4geU#2%*k3;EVA!PE1asQz)P&+MMV5hdZH73))wM={;~)9cbBBy?o@aZwd#Sg%xLO_Ki^lN$ -z!_&q~tM#%?^Ls4gjXwP-<~LW2%Bt*f4Xz=mG^dwKsx?batr$E+l~esj;Y{YsUC6d! -z@Gb%GYgV}AX3P`fKO(Y~yb?QjYLUrY%hauCPz`7hC!_HIdjZJ7I@`j5W -zEES`uH7GzgKSH6{d{f>ih^U$DA(|5VB;wgraUu}r!b -z*$2L2rpps;!Op4sjG*$^1au -z*kGJLO=<-`Bt;(^cHRpSh*LAh&a_yRB4hjf%QMEa{ppKi_ZZt3e3U%#^4iYs`;1G5 -zEptoJu^RT0c>c=yf8S$F^{Gwfr|vh*{=qE#a|oC}@{sYDzH|KAabU?!ve}vZvhhKD -zu*bfXL3XMl1%kS(Scb@^OSWEaFTa#Yz0*T)6A4^!Gn0SAJ?vll74nyPQ#6MZ8Xz|L -zk0jIszugk9JzElsr6$Me$jw3tgFj&**AuXrD4!exJ!ev=E6xshRB>@b52r#9{MmvL -zM62eX=Z+Yx%aDR=V>P$u4(KnArZ~R3Q87Po^)UnRv~P!v6hIkj4qH( -R2C9z#kg;-JJZ5ZK@n1s&V=w>! - -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/FunctionField.lean b/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/FunctionField.lean -index 6c27d435c..f83025581 100644 ---- a/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/FunctionField.lean -+++ b/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/FunctionField.lean -@@ -15,43 +15,6 @@ import Mathlib.RingTheory.IsTensorProduct - import HasseWeil.Foundation.Auxiliary.Universal - import HasseWeil.Isogeny.FunctionField - --/-! --# The Frobenius Isogeny via Function Fields -- --We construct the q-th power Frobenius as a concrete isogeny `π : E → E` using the --function field pullback `π* : K(E) →ₐ[K] K(E)` given by `x ↦ x^q`. -- --## Main Definitions -- --* `HasseWeil.frobeniusIsogeny`: The Frobenius as a `PullbackIsogeny K W W`, with pullback -- given by `frobeniusAlgHom K K(E)`. -- --## Main Results -- --* `HasseWeil.frobeniusIsogeny_degree`: The Frobenius isogeny has degree `q = #K`. --* `HasseWeil.frobeniusIsogeny_pow_mem_fieldRange`: pure inseparability of `K(E) / K(E)^q` -- (Silverman II.2.11(b)), stated as a power-membership fact. --* `HasseWeil.frobeniusIsogeny_pullback_range`: the pullback image is exactly the `q`-th -- powers in `K(E)` (Silverman II.2.11(a)). -- --## Implementation notes -- --The degree `[K(E) : K(E)^q] = q` is obtained from the tower law. Writing `x` for the image --of `X` in the coordinate ring, so `K(E) = K(x, y)`: -- --* `[K(E) : K(x)] = 2` and `[K(E)^q : K(x^q)] = 2` (the Weierstrass equation is the minimal -- polynomial of `y` over `K(x)`, and of `y^q` over `K(x^q)`); --* `[K(x) : K(x^q)] = q` (computed via `RatFunc.finrank_eq_max_natDegree`, after identifying -- the Frobenius range in `RatFunc K` with `K⟮X^q⟯`); --* the tower law gives `[K(E) : K(E)^q] · 2 = 2 · q`, hence `[K(E) : K(E)^q] = q`. -- --The Frobenius-twisted `Module.finrank` is reduced to the plain field extension `[K(E) : K(E)^q]` --via `Algebra.finrank_eq_of_equiv_equiv`. -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*][silverman2009], III.4.6, II.2.11 ---/ - - open WeierstrassCurve FiniteField - open scoped Polynomial -@@ -98,7 +61,7 @@ private theorem frobenius_finrank_eq_fieldRange_finrank : - (frobeniusAlgHom K W.toAffine.FunctionField).toRingHom x - simp [AlgEquiv.ofInjective_apply] - --/-- Explicit module instance: `K[X]` acts on `CoordinateRing` via the algebra structure. -/ -+ - noncomputable instance coordinateRing_module : - Module K[X] W.toAffine.CoordinateRing := - @Algebra.toModule K[X] W.toAffine.CoordinateRing _ _ inferInstance -@@ -107,7 +70,7 @@ instance coordinateRing_finite : Module.Finite K[X] W.toAffine.CoordinateRing := - Module.Finite.of_basis (Affine.CoordinateRing.basis W.toAffine) - - omit [DecidableEq K] [Fintype K] [W.toAffine.IsElliptic] in --/-- The coordinate ring `K[x, y]/(W)` is a free `K[X]`-module of rank `2` (Silverman II.2). -/ -+ - theorem finrank_coordinateRing_eq_two : - Module.finrank K[X] W.toAffine.CoordinateRing = 2 := - (Module.finrank_eq_card_basis (Affine.CoordinateRing.basis W.toAffine)).trans -@@ -206,7 +169,7 @@ private theorem frobenius_fieldRange_ratFunc : - obtain ⟨p, r, _hr, rfl⟩ : ∃ p r : K[X], algebraMap K[X] (RatFunc K) r ≠ 0 ∧ - g = algebraMap K[X] (RatFunc K) p / algebraMap K[X] (RatFunc K) r := - ⟨g.num, g.denom, RatFunc.algebraMap_ne_zero g.denom_ne_zero, g.num_div_denom.symm⟩ -- simp only [div_pow, ← map_pow, ← FiniteField.expand_card (K := K)] -+ simp only [div_pow, ← map_pow, ← FiniteField.Polynomial.expand_card (K := K)] - have hmem : ∀ f : K[X], algebraMap K[X] (RatFunc K) (Polynomial.expand K q f) ∈ A := by - intro f - have h_amap : ∀ g : K[X], -@@ -340,8 +303,8 @@ private theorem finrank_over_frobenius_image : - lia - - omit [DecidableEq K] [W.toAffine.IsElliptic] in --/-- **Core algebraic fact**: `[K(E) : K(E)^q] = q`, where the module structure on `K(E)` over --itself is via the `q`-th power Frobenius (Silverman II.2.11(a)). -/ -+ -+ - theorem frobenius_finrank_functionField : - @Module.finrank W.toAffine.FunctionField W.toAffine.FunctionField _ _ - (frobeniusAlgHom K W.toAffine.FunctionField).toRingHom.toAlgebra.toModule = -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/OrdAtInfty.lean b/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/OrdAtInfty.lean -index 166040c82..a3a20a730 100644 ---- a/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/OrdAtInfty.lean -+++ b/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/OrdAtInfty.lean -@@ -10,23 +10,19 @@ import HasseWeil.Foundation.EC.GenericPointZsmul - import HasseWeil.Foundation.EC.MulByIntBaseCase - - /-! --# Frobenius-specialized addition-pullback ord-at-infinity computations -+# Orders at infinity for Frobenius addition - --For `α = frobeniusIsog W` (the Frobenius endomorphism over a finite field --`K` with `q = #K ≥ 2`), we compute the order at infinity of the addition- --formula slope and related quantities. These are the building blocks for the --pole bound `ord_∞(addPullback_x W (frobeniusIsog W)) ≤ -2`, which closes --Sorry 1 of `HasseWeil/AdditionPullback.lean` for the case actually used by --HOLE D in the unconditional Hasse-Weil bound. -+For Frobenius `π` over a finite field of size `q`, the coordinate differences -+have orders `−2q` and `−3q`, so their slope has order `−q`. Clearing the -+addition-formula denominator and reducing by the Weierstrass equation gives -+the precise coordinate pole orders. - --## Main lemmas -+The same arguments apply to negative Frobenius and the pencil `r·π − s·id`. -+Curve-negation invariance places the summed x-coordinate in `K(x)`; its pole -+then proves transcendence and the injectivity required for the function-field -+pullback. - --* `ordAtInfty_addSlope_frobenius`: `ord_∞(L) = -q` where `L = addSlope W π`. --* `ordAtInfty_addSlope_sq_frobenius`: `ord_∞(L²) = -2q`. -- --## References -- --* Silverman, *The Arithmetic of Elliptic Curves*, IV.1 (orders at infinity). -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.1. - -/ - - open WeierstrassCurve HasseWeil.Curves -@@ -64,7 +60,7 @@ theorem addSlope_frobenius_eq : - simp only [addSlope] - exact Affine.slope_of_X_ne (x_gen_ne_frobeniusIsog_pullback_x_gen W) - --/-- `ord_∞(x_gen − π·x) = -2q` (sign-flipped form of the previously-shipped -+/-- `ord_∞(x_gen − π·x) = -2q` (sign-flipped form of the corresponding - `ordAtInfty_frobeniusIsog_pullback_x_gen_sub_x_gen`). -/ - theorem ordAtInfty_x_gen_sub_frobeniusIsog_pullback_x_gen : - (W_smooth W).ordAtInfty (x_gen W - (frobeniusIsog W).pullback (x_gen W)) = -@@ -98,7 +94,7 @@ theorem x_gen_sub_frobeniusIsog_pullback_x_gen_ne_zero : - exact WithTop.coe_ne_top h_top - - /-- **`ord_∞(addSlope W π) = -q`** where `q = #K`. Direct from --`ordAtInfty_div_of_ord_eq` with the shipped sub-ord lemmas. -/ -+`ordAtInfty_div_of_ord_eq` with the sub-ord lemmas. -/ - theorem ordAtInfty_addSlope_frobenius : - (W_smooth W).ordAtInfty (addSlope W (frobeniusIsog W)) = - ((-(Fintype.card K : ℤ)) : WithTop ℤ) := by -@@ -131,9 +127,8 @@ theorem ordAtInfty_addSlope_sq_frobenius : - push_cast - ring - --/-- **Witness-parametric Sorry 1 closure for the Frobenius case** (Path Y): --given a pole hypothesis on `addPullback_x W (frobeniusIsog W)`, derive False --from `addPullback_x = algebraMap K _ c`. -/ -+/-- A pole of the Frobenius addition x-coordinate rules out every constant -+ value in the base field. -/ - theorem addPullback_x_ne_const_frobenius_of_pole - (hxy : AddNonInverse W (frobeniusIsog W)) - (h_pole : -@@ -142,7 +137,7 @@ theorem addPullback_x_ne_const_frobenius_of_pole - False := - addPullback_x_ne_const_of_pole hxy c h_pole hc - --/-! ### Path X-prime: pole bound for q ≥ 3 with cancellation witness -+/-! ### pole bound for q ≥ 3 with cancellation witness - - `addPullback_x = L² + a₁L - a₂ - x_gen - π·x`. Regroup as - `(L² - π·x) + (a₁L - a₂ - x_gen)`. The right group has ord exactly `-q` -@@ -231,26 +226,14 @@ private theorem ordAtInfty_add_le_neg_two {A B : KE} (hq : 3 ≤ Fintype.card K) - have : (3 : ℤ) ≤ (Fintype.card K : ℤ) := by exact_mod_cast hq - linarith - --/-- **Pole bound for q ≥ 3 with cancellation witness** (Path X-prime, --**SUPERSEDED**): `ord_∞(addPullback_x W π) ≤ -2`, given the structural --witness `ord(L² - π·x) ≠ -q`. -- --**Status: SUPERSEDED.** The hypothesised witness is unprovable when --`a₁ ≠ 0`. Direct term-by-term ord arithmetic on the `(y - π·y)² --- π·x · (x - π·x)²` numerator shows that the term `-a₁·π·x·π·y` at --ord `-5q` is the unique smallest (when `a₁ ≠ 0`), forcing --`ord(L² - π·x) = -q` exactly. So `lt_or_gt_of_ne h_witness` cannot --be applied: the witness is false in the case it is supposed to discharge. -- --The replacement is the direct numerator-of-`addPullback_x` analysis --shipped below as `addPullbackNumerator_frobenius`, which sidesteps the --`L² - π·x` regrouping entirely. The lemmas immediately below are kept --for now to preserve a stable API in case downstream callers reference --them, but should not be used to close Sorry 1. -- --The witness-parametric form remains formally true (vacuously, since --the witness premise is unsatisfiable in the relevant case) but yields --no usable closure. -/ -+/-- A pole bound under the additional cancellation witness -+ `ord(L² − π·x) ≠ −q`. -+ -+ When `a₁ ≠ 0`, direct numerator comparison forces -+ `ord(L² − π·x) = −q`: the term `−a₁·π·x·π·y` has uniquely minimal -+ order `−5q`. Thus the extra witness excludes that situation. The -+ reduced-numerator argument gives the coordinate pole without this -+ witness. -/ - theorem addPullback_x_pole_frobenius_of_lc_witness - (hq : 3 ≤ Fintype.card K) - (ha1 : W.toAffine.a₁ ≠ 0) (ha2 : W.toAffine.a₂ ≠ 0) -@@ -286,7 +269,7 @@ theorem addPullback_x_pole_frobenius_of_lc_witness - ordAtInfty_a1L_minus_a2_minus_xgen_frobenius W hq ha1 ha2 - exact ordAtInfty_add_le_neg_two W hq h_ord_B h_witness - --/-- **Sorry 1 closure for Frobenius case (q ≥ 3)** with leading-coefficient -+/-- **Nonconstancy from the coordinate pole for Frobenius case (q ≥ 3)** with leading-coefficient - witness. Composes the pole bound with `addPullback_x_ne_const_frobenius_of_pole`. -/ - theorem addPullback_x_ne_const_frobenius_q_ge_3_of_witness - (hq : 3 ≤ Fintype.card K) -@@ -305,36 +288,19 @@ theorem addPullback_x_ne_const_frobenius_q_ge_3_of_witness - exact_mod_cast (by norm_num : (-2 : ℤ) < 0) - exact addPullback_x_ne_const_frobenius_of_pole W hxy h_pole c hc - --/-! ### Direct numerator approach (replaces the broken `_lc_witness` path) -- --The witness `ord(L² - π·x) ≠ -q` is unprovable because `ord(L² - π·x) = -q` --exactly when `a₁ ≠ 0` (the case of interest). Instead we work directly with --the numerator of `addPullback_x · (x - π·x)²`. -- --Multiplying the addition formula `addPullback_x = L² + a₁·L - a₂ - x_gen - π·x` --through by `(x - π·x)²` (using `L = (y - π·y)/(x - π·x)`) yields the polynomial- --shaped element -- --``` --T₁ + T₂ - T₃ -- with T₁ = (y_gen - π·y)², -- T₂ = a₁ · (x_gen - π·x) · (y_gen - π·y), -- T₃ = (x_gen - π·x)² · (a₂ + x_gen + π·x). --``` -+/-! ### Clearing the addition denominator - --The `ord_∞` values, for `q ≥ 2`: -+Multiplying `L² + a₁L − a₂ − x − π·x` by `(x − π·x)²` gives -+`T₁ + T₂ − T₃`, with -+`T₁ = (y − π·y)²`, `T₂ = a₁(x − π·x)(y − π·y)` and -+`T₃ = (x − π·x)²(a₂ + x + π·x)`. -+Their orders are `−6q`, `−5q` (when `a₁ ≠ 0`) and `−6q`. - --| term | ord | --|------|------| --| `T₁` | `-6q` | --| `T₂` | `-5q` (when `a₁ ≠ 0`) | --| `T₃` | `-6q` | -- --The leading-coefficient analysis at `-6q` (deferred to a follow-up session) --gives `lc(T₁) + lc(-T₃) = 2·c_x^{3q} ≠ 0` in characteristic `≠ 2`, hence --`ord(T₁ + T₂ - T₃) = -6q` and `ord(addPullback_x) = -6q + 4q = -2q < 0`. -- --These lemmas ship the term-ord half of the analysis. -/ -+The Weierstrass equation reduces this numerator so that `x(π·x)²`, of -+order `−2 − 4q`, strictly dominates the remaining terms. Since the -+squared denominator has order `−4q`, the summed x-coordinate has order -+`−2`, in every characteristic. -+-/ - - /-- The denominator `y_gen − π·y` is nonzero (its ord is finite). -/ - theorem y_gen_sub_frobeniusIsog_pullback_y_gen_ne_zero : -@@ -396,7 +362,7 @@ theorem addPullbackNumerator_frobenius_eq : - ring - - /-- **`ord_∞(T₁) = -6q`** where `T₁ = (y_gen − π·y)²` and `q = #K`. --Direct from `ordAtInfty_pow_of_ord_eq` applied to the shipped -+Direct from `ordAtInfty_pow_of_ord_eq` applied to - `ordAtInfty_y_gen_sub_frobeniusIsog_pullback_y_gen`. -/ - theorem ordAtInfty_T1_frobenius : - (W_smooth W).ordAtInfty -@@ -411,7 +377,7 @@ theorem ordAtInfty_T1_frobenius : - ring - - /-- **`ord_∞(T₂) = -5q`** where `T₂ = a₁·(x_gen − π·x)·(y_gen − π·y)` --and `a₁ ≠ 0`. Multiplicativity of `ord_∞` plus the shipped sub-ord lemmas. -/ -+and `a₁ ≠ 0`. Multiplicativity of `ord_∞` plus the sub-ord lemmas. -/ - theorem ordAtInfty_T2_frobenius (ha₁ : W.toAffine.a₁ ≠ 0) : - (W_smooth W).ordAtInfty - (algebraMap K KE W.toAffine.a₁ * -@@ -551,7 +517,7 @@ a polynomial-shaped expression whose unique smallest-order term is - `x_gen · (π·x)²` at order `-2 - 4q`. - - This reduction yields `ord_∞(addPullback_x) = -2` (independent of q!), --which immediately closes Sorry 1 for `q ≥ 3` in **any characteristic** -+which immediately closes the nonconstancy condition for `q ≥ 3` in **any characteristic** - (the `x_gen · (π·x)²` term has coefficient `1`, never vanishing). -/ - - /-- The Weierstrass-reduced form of `addPullbackNumerator_frobenius`. -@@ -651,7 +617,7 @@ than `x_gen · (π·x)²` has `ord_∞ ≥ -3 - 3q`. The dominant term has - `ord_∞ = -2 - 4q`. Since `-3 - 3q > -2 - 4q` for `q ≥ 2`, strict - non-archimedean additivity gives `ord(reduced) = -2 - 4q`. -/ - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Helper: `ord(algebraMap c · f) ≥ ord(f)`. The `algebraMap K KE c` - factor never makes the order more negative — when `c = 0` the product - is zero (ord `⊤`), and when `c ≠ 0` the algebraMap value has ord 0. -/ -@@ -860,6 +826,7 @@ private lemma ord_a4_mul_x_add_pi_x_ge (hq : 2 ≤ Fintype.card K) : - rw [ord_x_gen_add_pi_x_eq W hq] - exact WithTop.coe_le_coe.mpr h_int - -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Helper: `ord_∞(2 · a₆) ≥ -3 - 3q` for `q ≥ 2`. -/ - private lemma ord_two_mul_a6_ge (hq : 2 ≤ Fintype.card K) : - (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ -@@ -1020,7 +987,7 @@ theorem ordAtInfty_addPullbackNumerator_reduced_frobenius_eq - ((W_smooth W).ordAtInfty_add_eq_of_lt (ord_dom_lt_rest W hq)).trans - (ord_x_gen_mul_pi_x_sq_eq W) - --/-! ### Sorry 1 closure for Frobenius case (q ≥ 2, any characteristic) -/ -+/-! ### Nonconstancy from the coordinate pole for Frobenius case (q ≥ 2, any characteristic) -/ - - /-- **`ord_∞(addPullback_x W π) = -2`** for `q ≥ 2` (any characteristic). - -@@ -1061,7 +1028,7 @@ theorem ord_addPullback_x_frobenius (hq : 2 ≤ Fintype.card K) : - congr 1 - ring - --/-- **Sorry 1 closure for the Frobenius case** (`q ≥ 2`, any characteristic): -+/-- **Nonconstancy from the coordinate pole for the Frobenius case** (`q ≥ 2`, any characteristic): - `addPullback_x W (frobeniusIsog W)` is not the image of any constant `c ∈ K`. - - Direct from `ord_addPullback_x_frobenius` (which gives `ord = -2 < 0`, -@@ -1074,44 +1041,21 @@ theorem addPullback_x_ne_const_frobenius - rw [ord_addPullback_x_frobenius W hq] - exact_mod_cast (by norm_num : (-2 : ℤ) < 0) - --/-- **Inequality wrapper** for `ord_addPullback_x_frobenius`. -- --Some downstream consumers (CLOSE-A-1 ticket spec) want the `≤ -2` form --rather than the equality. Trivial corollary. -/ -+/-- The Frobenius addition x-coordinate has order at most minus two. -/ - theorem ordAtInfty_addPullback_x_frobenius_le_neg_two - (hq : 2 ≤ Fintype.card K) : - (W_smooth W).ordAtInfty (addPullback_x W (frobeniusIsog W)) ≤ - ((-2 : ℤ) : WithTop ℤ) := - (ord_addPullback_x_frobenius W hq).le - --/-! ### `negFrobeniusIsog`: the `−π` isogeny (HOLE-D-bound work, Day 1) -- --For HOLE D, we ultimately need the addition-pullback for `1 − π`, which --is `id + α` with `α = −π`. The `−π` isogeny is constructed as the --composition `[-1] ∘ π` via the existing `Isogeny.comp` and `mulByInt _ (-1)`. -- --By `Isogeny.comp_algebraMap_eq`, the resulting pullback is --`f ↦ frobeniusIsog.pullback (mulByInt _ (-1)).pullback f`. For the two --generators: --* `(negFrobeniusIsog W).pullback (x_gen W)` reduces to -- `(frobeniusIsog W).pullback (x_gen W) = π·x_gen` (since `[-1]` fixes -- `x_gen`). --* `(negFrobeniusIsog W).pullback (y_gen W)` reduces to -- `(frobeniusIsog W).pullback (negY x_gen y_gen) = -- (frobeniusIsog W).pullback (-y_gen - a₁·x_gen - a₃)`. By Frobenius -- being a ring hom and `a_i^q = a_i` in `K = F_q`, this equals -- `-π·y_gen - a₁·π·x_gen - a₃` in any characteristic (in char 2 the -- signs are no-ops). -- --Both pullbacks have the same `ord_∞` as the Frobenius case (`-2q` and --`-3q` respectively), so the term-ord chain shipped earlier in this file --templates over to `negFrobeniusIsog` with name-prefix swaps. The reduced- --numerator analysis (Weierstrass identity certificate) also carries --forward, since `(π·x_gen, negY π·x π·y)` is on the curve by `equation_neg`. -- --This file ships only the structural definition tonight. The Day 2 work --(ord lemmas + pullback formulas + Sorry 1 closure for `α = -π`) is --factored separately and reuses the existing helpers verbatim. -/ -+/-! ### Negative Frobenius -+ -+The isogeny `−π` is the composition `[-1] ∘ π`. Its pullback sends -+`x` to `π·x` and `y` to `−π·y − a₁·π·x − a₃`, in every characteristic. -+These coordinates have orders `−2q` and `−3q`. The Weierstrass equation -+for the negated point gives the corresponding reduced-numerator pole -+calculation for `1 − π`. -+-/ - - /-- The `-π` isogeny as `[-1] ∘ π`, via `Isogeny.comp` of the existing - `mulByInt _ (-1)` and `frobeniusIsog W` isogenies. -/ -@@ -1131,6 +1075,7 @@ theorem negFrobeniusIsog_toAddMonoidHom_apply (P : W.toAffine.Point) : - rw [mulByInt_apply] - exact (neg_one_zsmul _).trans rfl - -+omit [Fintype K] in - /-- The `[-1]`-pullback sends `y_gen` to `negY x_gen y_gen = -y_gen − a₁·x_gen - − a₃` (the curve-negation formula). - -@@ -1188,7 +1133,7 @@ theorem negFrobeniusIsog_pullback_y_gen : - simp only [map_sub, map_neg, map_mul, - AlgHom.commutes (frobeniusIsog W).pullback] - --/-! ### `ord_∞` lemmas for the negFrobeniusIsog pullbacks (Day 2 first half) -+/-! ### `ord_∞` lemmas for the negFrobeniusIsog pullbacks - - With the pullback formulas in place, the ord values match the Frobenius - case: -@@ -1265,7 +1210,7 @@ theorem ordAtInfty_negFrobeniusIsog_pullback_y_gen - exact ordAtInfty_sub_eq_of_coe_lt_le W h_lt_q h_neg_πy - (a1_pi_x_plus_a3_ge_neg_two_q W hq) - --/-! ### addPullbackNumerator for negFrobenius (Day 2 second half opener) -+/-! ### addPullbackNumerator for negFrobenius - - Mirrors the Frobenius numerator + reduction identity, with `α = negFrobeniusIsog W` - instead of `α = frobeniusIsog W`. The (u, v) point used in the reduction is -@@ -1640,7 +1585,7 @@ theorem ordAtInfty_addPullbackNumerator_reduced_negFrobenius_eq - ((W_smooth W).ordAtInfty_add_eq_of_lt (ord_dom_lt_negFrob_rest W hq)).trans - (ord_x_gen_mul_negFrob_pi_x_sq_eq W) - --/-! ### Sorry 1 closure for the negFrobenius case (Day 2 final) -+/-! ### Nonconstancy from the coordinate pole for the negFrobenius case - - `ord(addPullback_x W (-π)) = -2` follows by dividing the reduced numerator - (ord = -2 - 4q) through `(x_gen − negFrob.pb x_gen)²` (ord = -4q). Then -@@ -1740,12 +1685,11 @@ theorem ord_addPullback_x_negFrobenius (hq : 2 ≤ Fintype.card K) : - congr 1 - ring - --/-- **Sorry 1 closure for the negFrobenius case** (`q ≥ 2`, any characteristic): -+/-- **Nonconstancy from the coordinate pole for the negFrobenius case** (`q ≥ 2`, any characteristic): - `addPullback_x W (negFrobeniusIsog W)` is not the image of any constant `c ∈ K`. - - Direct from `ord_addPullback_x_negFrobenius` (which gives `ord = -2 < 0`, --a pole) plus `addPullback_x_ne_const_of_pole`. This is the closure needed --for HOLE D's `1 − π` use case (since `1 − π = id + (-π)`). -/ -+a pole) plus `addPullback_x_ne_const_of_pole`. For `1 − π`, the addition formula is `id + (−π)`. -/ - theorem addPullback_x_ne_const_negFrobenius - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) (c : K) -@@ -1754,11 +1698,7 @@ theorem addPullback_x_ne_const_negFrobenius - rw [ord_addPullback_x_negFrobenius W hq] - exact_mod_cast (by norm_num : (-2 : ℤ) < 0) - --/-- **Inequality wrapper** for `ord_addPullback_x_negFrobenius`. -- --Companion to `ordAtInfty_addPullback_x_frobenius_le_neg_two` for the --`−π` (negFrobenius) case — the load-bearing case for HOLE D's `1 − π` --analysis. Trivial corollary of the equality form. -/ -+/-- The Frobenius addition x-coordinate has order at most minus two. -/ - theorem ordAtInfty_addPullback_x_negFrobenius_le_neg_two - (hq : 2 ≤ Fintype.card K) : - (W_smooth W).ordAtInfty (addPullback_x W (negFrobeniusIsog W)) ≤ -@@ -1838,7 +1778,7 @@ private theorem ord_RHS_lower_ge_neg_four_negFrobenius - exact ord_add_ge_of_both_ge W - (ord_add_ge_of_both_ge W h_a₂_term h_a₄_term) h_a₆_term - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Helper: `ord(a₆) ≥ 0` (where `a₆` is a constant in K, viewed in KE). -/ - private theorem ord_a₆_ge_zero : - (0 : WithTop ℤ) ≤ (W_smooth W).ordAtInfty -@@ -2181,66 +2121,25 @@ theorem ord_addPullback_y_negFrobenius (hq : 2 ≤ Fintype.card K) : - have h_m_eq : m = -3 := by omega - exact_mod_cast h_m_eq - --/-! ### Day 3a: addPullbackAlgHom for the negFrobenius case -- --The existing `addPullbackAlgHom W α hxy hinj` construction --(`HasseWeil.AdditionPullback`) is generic over `α`. For HOLE D we want --this for `α = negFrobeniusIsog W`. The injectivity input --`hinj : Function.Injective (addCoordAlgHom hxy)` was generically --provided by a sorry-bearing `addCoordAlgHom_injective` chain (general-`α` --transcendence of `addPullback_x` resting on an open III.3.6 pole witness) — --that chain has since been **removed**; only the witness-parametric and --negFrobenius forms remain. -- --We ship `addPullbackAlgHom_negFrobenius_of_inj` as a **witness-parametric --form** taking the (axiom-clean) injectivity proof as a hypothesis. --Discharging this hypothesis axiom-clean for `α = negFrobeniusIsog W` --requires one of: -- --1. Closing Sorry 2 + Sorry 3 generically (~350 LOC, mathlib `minpoly` -- machinery). -- --2. A negFrobenius-specific σ-invariance argument: prove -- `(mulByInt W (-1)).pullback (addPullback_x W (negFrobeniusIsog W)) -- = addPullback_x W (negFrobeniusIsog W)`. This says addPullback_x is -- fixed by the curve-negation involution `σ : K(E) → K(E)`. By Galois -- theory (K(E) over K(x) is degree-2, σ generates the Galois group), -- σ-fixed elements lie in `K(x) = F(x_gen)`, which discharges the -- `px ∉ F(x_gen)` case of the transcendence argument for the -- negFrobenius case. Then `addPullback_x_ne_const_negFrobenius` -- closes Case 1, completing the chain. -- --Path 2 is more focused (~100-200 LOC) and closes only what HOLE D --needs. The σ-invariance lemma proof structure: apply --`(mulByInt W (-1)).pullback` to the addX formula --`addPullback_x = L² + a₁L − a₂ − x_gen − π·x`, distribute the AlgHom --over operations, substitute known values: --* `(mulByInt W (-1)).pullback x_gen = x_gen` (`mulByInt_pullback_x_neg_one`). --* `(mulByInt W (-1)).pullback y_gen = −y_gen − a₁·x_gen − a₃` -- (`mulByInt_pullback_y_neg_one`). --* `(mulByInt W (-1)).pullback (π·x_gen) = π·x_gen` (since `π·x_gen -- = x_gen^q` and AlgHom preserves powers and fixes `x_gen`). --* `(mulByInt W (-1)).pullback (π·y_gen) = -π·y - a₁·π·x - a₃` (via -- Frobenius distributing over `−y − a₁·x − a₃` in char p, with -- `a^q = a` in `K = F_q`). -- --Substituting and using `(σ(L_neg)+L_neg) = -a₁` (a curve-arithmetic --identity, computable via `field_simp; ring` after the algebra-hom --rewrites), we get `σ(L_neg² + a₁·L_neg) = L_neg² + a₁·L_neg`. The --remaining terms in addPullback_x (`a₂`, `x_gen`, `π·x_gen`) are all --σ-fixed. So addPullback_x is σ-invariant. ∎ -/ -- --/-- Witness-parametric `addPullbackAlgHom` for `α = negFrobeniusIsog W`, --parametric on the `addCoordAlgHom hxy`-injectivity hypothesis. Once --that hypothesis is dischargeable axiom-clean (via Path 2 above or --Sorry 2 + Sorry 3 closure), the resulting algebra-hom feeds the --`isogOneSub` placeholder replacement and closes HOLE D. -/ -+/-! ### Injectivity of the negative-Frobenius addition pullback -+ -+Curve negation fixes `x` and sends `y` to `−y − a₁x − a₃`. Applying it to -+the negative-Frobenius slope gives `σ(L) + L = −a₁`, hence fixes -+`L² + a₁L` and the summed x-coordinate. The fixed field is `K(x)`. -+An algebraic element of this rational function field is constant, whereas -+the summed x-coordinate has a pole. It is therefore transcendental over -+`K`, which proves injectivity of its polynomial evaluation homomorphism -+and then of the coordinate-ring homomorphism. -+-/ -+ -+/-- The function-field addition pullback for negative Frobenius, given -+ injectivity of the coordinate-ring homomorphism. -/ - noncomputable def addPullbackAlgHom_negFrobenius_of_inj - (hxy : AddNonInverse W (negFrobeniusIsog W)) - (hinj : Function.Injective (addCoordAlgHom hxy)) : KE →ₐ[K] KE := - addPullbackAlgHom hxy hinj - --/-! ### σ-invariance lemmas (Path 2 to discharge `hinj` axiom-clean) -/ -+/-! ### Curve-negation invariance -/ - - /-- **σ-invariance Step 1**: - `σ(π·y_gen) = (negFrobeniusIsog W).pullback (y_gen W)` where -@@ -2360,7 +2259,7 @@ theorem addPullback_x_negFrobenius_sigma_invariant : - - /-! ### Galois group identification: {1, σ} on K(E)/K(x) - --Day 3a-final opener. To deduce that σ-fixed elements lie in K(x), we -+To deduce that σ-fixed elements lie in K(x), we - need to know that {1, σ} is the full Galois group of K(E)/K(x). - - The two structural facts: -@@ -2370,6 +2269,7 @@ The two structural facts: - - Combined with `[K(E) : K(x)] = 2`, this is the full Galois group. -/ - -+omit [Fintype K] in - /-- **σ has order 2**: `(mulByInt W (-1)).pullback.comp (mulByInt W (-1)).pullback - = AlgHom.id`. The Galois-group order-2 statement, derived from the isogeny - identity `[-1] ∘ [-1] = [1]` (`mulByInt_comp_eq_mul`) plus -@@ -2395,6 +2295,7 @@ theorem mulByInt_neg_one_pullback_comp_self : - from rfl] at h_pb - rw [h_pb, mulByInt_one_pullback_eq_id] - -+omit [Fintype K] in - /-- **σ ∘ σ = id pointwise**: for any `z ∈ KE`, - `(mulByInt W (-1)).pullback ((mulByInt W (-1)).pullback z) = z`. -/ - theorem mulByInt_neg_one_pullback_pow_two_apply (z : KE) : -@@ -2413,6 +2314,7 @@ forces non-triviality). In characteristic 2 we need the discriminant: a curve - with `a₁ = a₃ = 0` would have `Δ = 0` (by `Δ_of_char_two`), contradicting - `[IsElliptic]`. -/ - -+omit [Fintype K] in - /-- **σ ≠ id in characteristic 2**: the curve-negation involution - `σ = (mulByInt W (-1)).pullback` does not fix `y_gen`. - -@@ -2481,6 +2383,7 @@ private lemma two_K_eq_zero_of_two_fractionRing - rw [map_zero, map_ofNat] - exact h - -+omit [Fintype K] in - /-- **σ ≠ id in characteristic ≠ 2**: in char ≠ 2, the curve-negation involution - σ does not fix `y_gen`. - -@@ -2515,6 +2418,7 @@ theorem mulByInt_neg_one_pullback_y_gen_ne_y_gen_char_ne_two - obtain ⟨_, hq_zero⟩ := (W_smooth W).decomp_zero_iff h_zero_smul - exact h2 (two_K_eq_zero_of_two_fractionRing hq_zero) - -+omit [Fintype K] in - /-- **σ ≠ id (unified)**: in any characteristic, the curve-negation involution - `σ = (mulByInt W (-1)).pullback` does not fix `y_gen`. - -@@ -2525,7 +2429,7 @@ theorem mulByInt_neg_one_pullback_y_gen_ne_y_gen : - (mulByInt W.toAffine (-1)).pullback (y_gen W) ≠ y_gen W := by - by_cases h2 : (2 : K) = 0 - · -- Char 2 case via `[CharP K 2]` derived from `h2`. -- haveI : CharP K 2 := CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero h2 -+ have : CharP K 2 := CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero h2 - exact mulByInt_neg_one_pullback_y_gen_ne_y_gen_char_two W - · -- Char ≠ 2 case directly. - exact mulByInt_neg_one_pullback_y_gen_ne_y_gen_char_ne_two W h2 -@@ -2535,6 +2439,7 @@ theorem mulByInt_neg_one_pullback_y_gen_ne_y_gen : - A small first piece toward σ-fixed → K(x): σ commutes with the constant - embedding `K → K(E)`. -/ - -+omit [Fintype K] in - /-- σ fixes the image of `K → K(E)`: for any `c : K`, - `σ(algebraMap c) = algebraMap c`. Immediate from σ being a `K`-algebra hom. -/ - @[simp] theorem mulByInt_neg_one_pullback_algebraMap_K (c : K) : -@@ -2542,6 +2447,7 @@ embedding `K → K(E)`. -/ - algebraMap K KE c := - AlgHom.commutes (mulByInt W.toAffine (-1)).pullback c - -+omit [Fintype K] in - /-- σ fixes `algebraMap (Polynomial K) KE p` for any polynomial `p`. - Using `algebraMap p = aeval x_gen p` (via algebra-hom uniqueness on the - generator `X ↦ x_gen`) plus σ commutes with `aeval` and σ fixes `x_gen`. -/ -@@ -2566,6 +2472,7 @@ theorem mulByInt_neg_one_pullback_algebraMap_polyK (p : Polynomial K) : - simpa using this - rw [h_eval, ← Polynomial.aeval_algHom_apply, mulByInt_pullback_x_neg_one] - -+omit [Fintype K] in - /-- σ fixes the image of `Frac(K[X]) → K(E)`: for any `r ∈ Frac(K[X])`, - `σ(algebraMap r) = algebraMap r`. Lifts `mulByInt_neg_one_pullback_algebraMap_polyK` - via `IsLocalization.surj` denominator clearing. -/ -@@ -2598,6 +2505,7 @@ theorem mulByInt_neg_one_pullback_algebraMap_kx - - /-! ### Path 2 Step 3 Piece 3b: σ acts on coordY -/ - -+omit [Fintype K] in - /-- σ acts on `y_gen` as `-y_gen - a₁·x - a₃`. (Re-statement of - `mulByInt_pullback_y_neg_one` for use with the basis decomposition machinery.) -/ - theorem mulByInt_neg_one_pullback_y_gen_eq : -@@ -2608,6 +2516,7 @@ theorem mulByInt_neg_one_pullback_y_gen_eq : - - /-! ### Path 2 Step 3 Piece 3c helpers -/ - -+omit [Fintype K] [DecidableEq K] in - /-- The polynomial `a₁ X + a₃` is nonzero in characteristic 2 for an elliptic - curve. If it were zero, then `a₁ = a₃ = 0`, and `Δ_of_char_two` would give - `Δ = 0`, contradicting `[IsElliptic]`. -/ -@@ -2625,6 +2534,7 @@ theorem a₁X_plus_a₃_ne_zero_char_two [CharP K 2] : - rw [WeierstrassCurve.Δ_of_char_two, h_a1, h_a3]; ring - exact W.toAffine.isUnit_Δ.ne_zero h_delta - -+omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Image of the polynomial `a₁ X + a₃` under `K[X] → KE`: equals - `a₁ · x_gen + a₃` in `KE`. -/ - theorem algebraMap_a₁X_plus_a₃ : -@@ -2642,6 +2552,7 @@ theorem algebraMap_a₁X_plus_a₃ : - intro c; rw [Polynomial.C_eq_algebraMap, ← IsScalarTower.algebraMap_apply] - rw [map_add, map_mul, h_C, h_C, h_x_alg] - -+omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The image of `a₁ X + a₃` under the composite `K[X] → Frac(K[X]) → KE` equals - `a₁ · x_gen + a₃` in `KE`. Lifts `algebraMap_a₁X_plus_a₃` along the scalar tower - `K[X] → Frac(K[X]) → KE`. -/ -@@ -2665,6 +2576,7 @@ private lemma smul_one_add_smul_y_gen_eq_algebraMap - algebraMap (FractionRing (Polynomial K)) KE b * y_gen W := by - simp only [Algebra.smul_def, mul_one] - -+omit [Fintype K] in - /-- σ acting on an `algebraMap`-decomposition: applying `σ = (mulByInt W (-1)).pullback` - to `algebraMap a + (algebraMap b) · y_gen` gives - `algebraMap a + (algebraMap b) · (-y_gen - a₁·x - a₃)`, since σ fixes the -@@ -2684,6 +2596,7 @@ private lemma mulByInt_neg_one_pullback_algebraMap_add_algebraMap_mul_y_gen - mulByInt_neg_one_pullback_algebraMap_kx, - mulByInt_neg_one_pullback_y_gen_eq] - -+omit [Fintype K] in - /-- Helper for Piece 3c: the σ-equation as a vanishing `{1, Y}`-decomposition. - - If `f = a • 1 + b • Y` is fixed by `σ = (mulByInt W (-1)).pullback`, then applying -@@ -2719,6 +2632,7 @@ private lemma sigma_fixed_decomp_coeffs_vanish {a b : FractionRing (Polynomial K - map_mul, map_mul, algebraMap_fractionRing_a₁X_plus_a₃ W, map_ofNat] - linear_combination -h_combine - -+omit [Fintype K] in - /-- Helper for Piece 3c: char-split forcing `b = 0`. - - From the two vanishing coefficients of `sigma_fixed_decomp_coeffs_vanish`, -@@ -2733,7 +2647,7 @@ private lemma eq_zero_of_mul_a₁X_plus_a₃_and_two_mul_eq_zero - (hqb : 2 * b = 0) : b = 0 := by - by_cases h2 : (2 : K) = 0 - · -- Char 2: `a₁ X + a₃ ≠ 0`, so `b · (a₁X+a₃) = 0` forces `b = 0`. -- haveI : CharP K 2 := CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero h2 -+ have : CharP K 2 := CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero h2 - have h_bXf_ne : algebraMap (Polynomial K) (FractionRing (Polynomial K)) - (Polynomial.C W.toAffine.a₁ * Polynomial.X + Polynomial.C W.toAffine.a₃) ≠ 0 := - fun h_eq ↦ a₁X_plus_a₃_ne_zero_char_two W -@@ -2756,6 +2670,7 @@ the image of `Frac(K[X]) → K(E)`. Combines the σ-action on the basis - decomposition `{1, Y}` (Pieces 0/1/2/3b) with `decomp_zero_iff` and a - char-split. -/ - -+omit [Fintype K] in - /-- **Path 2 Step 3 Piece 3c**: If `f ∈ KE` is fixed by `σ`, then - `f` is in the image of `algebraMap (Frac K[X]) KE`. - -@@ -2796,18 +2711,18 @@ theorem addPullback_x_negFrobenius_in_KX_image : - sigma_fixed_implies_in_KX_image W _ - (addPullback_x_negFrobenius_sigma_invariant W) - --/-! ### Path 2 Steps 4+5: addPullback_x_negFrobenius is transcendental -+/-! ### addPullback_x_negFrobenius is transcendental - --The consumer of `addPullback_x_negFrobenius_in_KX_image`. Combines that -+Apply `addPullback_x_negFrobenius_in_KX_image`. Combines that - witness with `algebraic_in_fracRing_eq_const` (algebraic-closure-of-K-in-K(x)) - and `addPullback_x_ne_const_negFrobenius` (the non-constancy lemma) to --discharge transcendence axiom-clean for the `α = -π` case. -/ -+prove transcendence for the `α = -π` case. -/ - --/-- **Path 2 Step 4+5 (axiom-clean closure of Sorry 2 for α = -π)**: -+/-- **Transcendence for negative Frobenius**: - `addPullback_x W (negFrobeniusIsog W)` is transcendental over `K`. - - Proof outline: --* By `addPullback_x_negFrobenius_in_KX_image` (Piece 3d): there exists -+* By `addPullback_x_negFrobenius_in_KX_image`: there exists - `r : Frac(K[X])` with `addPullback_x = algebraMap _ KE r`. - * If `addPullback_x` were algebraic over `K`, so would `r` be (since - `algebraMap _ KE` is injective and pulls back transcendence). -@@ -2836,18 +2751,15 @@ theorem addPullback_x_transcendental_negFrobenius - rw [hr, hc, ← IsScalarTower.algebraMap_apply K (FractionRing (Polynomial K)) KE] - exact addPullback_x_ne_const_negFrobenius W hq hxy c hc' - --/-! ### Day 3b: addCoordAlgHom injectivity for the negFrobenius case -+/-! ### Coordinate-ring injectivity from transcendence - --Consumer of `addPullback_x_transcendental_negFrobenius` (Steps 4+5). Uses the --witness-parametric `addCoordAlgHom_injective_of_baseHom_inj` with the --unconditional base-hom injectivity below (the sorry-bearing generic --`addBaseHom_injective` has been removed). -/ -+Transcendence of the summed x-coordinate gives injectivity of polynomial -+evaluation, and the integral coordinate-ring extension gives injectivity -+of the coordinate homomorphism. -+-/ - --/-- **Day 3b helper**: `addBaseHom W (negFrobeniusIsog W)` is injective. --Axiom-clean negFrobenius base-hom injectivity: rewrites the base-hom as --`Polynomial.aeval (addPullback_x W (negFrob W))` (`addBaseHom_eq_aeval`) --and applies `transcendental_iff_injective` to the unconditional --`addPullback_x_transcendental_negFrobenius`. -/ -+/-- Transcendence of the negative-Frobenius addition x-coordinate makes its -+ polynomial evaluation homomorphism injective. -/ - theorem addBaseHom_injective_negFrobenius - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) : -@@ -2856,15 +2768,8 @@ theorem addBaseHom_injective_negFrobenius - exact transcendental_iff_injective.mp - (addPullback_x_transcendental_negFrobenius W hq hxy) - --/-- **Day 3b**: `addCoordAlgHom` for `α = negFrobeniusIsog W` is injective. --One-line consumer of `addCoordAlgHom_injective_of_baseHom_inj` and --`addBaseHom_injective_negFrobenius`. Closes one of the three sorries in HOLE D's --downstream chain axiom-clean. -- --Together with `addPullback_x_transcendental_negFrobenius` and Path 2 Step 3, --the negFrobenius `addCoordAlgHom`-injectivity is now fully --unconditional — the input needed by `addPullbackAlgHom_negFrobenius_of_inj` --to build a non-witness-parametric `addPullbackAlgHom_negFrobenius`. -/ -+/-- The negative-Frobenius addition coordinate-ring homomorphism is -+ injective, by injectivity of its polynomial restriction. -/ - theorem addCoordAlgHom_injective_negFrobenius - (hq : 2 ≤ Fintype.card K) - (hxy : AddNonInverse W (negFrobeniusIsog W)) : -@@ -2872,15 +2777,14 @@ theorem addCoordAlgHom_injective_negFrobenius - addCoordAlgHom_injective_of_baseHom_inj hxy - (addBaseHom_injective_negFrobenius W hq hxy) - --/-! ### Day 3c Piece A: AddNonInverse witness + specialized addPullbackAlgHom -+/-! ### The function-field pullback of `1 − π` - --The negFrobenius variant of `addPullbackAlgHom` requires both --`AddNonInverse W (negFrobeniusIsog W)` and the corresponding injectivity --of `addCoordAlgHom`. Both are dischargeable axiom-clean: the non-inverse --condition reduces to `x_gen ≠ π·x_gen` (different orders at infinity), --and injectivity is `addCoordAlgHom_injective_negFrobenius` (c8b4b66). -/ -+The identity and negative-Frobenius x-coordinates differ because their -+orders differ. Together with coordinate-ring injectivity, this constructs -+the addition pullback on the function field. -+-/ - --/-- **Day 3c Piece A.1**: `AddNonInverse W (negFrobeniusIsog W)` holds -+/-- **Non-inverse coordinates**: `AddNonInverse W (negFrobeniusIsog W)` holds - unconditionally. The negation hypothesis would require `x_gen W = π·x_gen` - (the first conjunct), which contradicts - `x_gen_ne_frobeniusIsog_pullback_x_gen` (their orders at infinity differ). -/ -@@ -2890,11 +2794,8 @@ theorem negFrobeniusIsog_addNonInverse : - rw [negFrobeniusIsog_pullback_x_gen] at h_x - exact x_gen_ne_frobeniusIsog_pullback_x_gen W h_x - --/-- **Day 3c Piece A.2**: Specialized `addPullbackAlgHom` for `α = negFrobenius`, --discharging both `AddNonInverse` (via `negFrobeniusIsog_addNonInverse`) and --`addCoordAlgHom`-injectivity (via `addCoordAlgHom_injective_negFrobenius`) --axiom-clean. The unconditional algebra hom corresponding to the rational --map `P ↦ P + (-π)(P) = P - π(P)` (i.e., `1 - π` on rational points). -/ -+/-- The function-field pullback of `P ↦ P − π(P)`, constructed from the -+ non-inverse coordinate witness and the injective coordinate map. -/ - noncomputable def addPullbackAlgHom_negFrobenius - (hq : 2 ≤ Fintype.card K) : KE →ₐ[K] KE := - addPullbackAlgHom_negFrobenius_of_inj W -@@ -2902,22 +2803,14 @@ noncomputable def addPullbackAlgHom_negFrobenius - (addCoordAlgHom_injective_negFrobenius W hq - (negFrobeniusIsog_addNonInverse W)) - --/-! ### Day 3c Piece B: isogOneSub_negFrobenius (replacement for the placeholder) -+/-! ### The isogeny `1 − π` - --The unconditional `1 − π` isogeny: pullback from `addPullbackAlgHom_negFrobenius` --(real addition pullback for `id + (-π)`), rational-point map from --`(AddMonoidHom.id _) - (frobeniusIsog W).toAddMonoidHom`. Replaces the --`isogOneSub (frobeniusIsog W)` placeholder (whose pullback was `AlgHom.id`) --with the mathematically correct pullback. -/ -- --/-- **Day 3c Piece B**: The isogeny `1 − π` with the unconditional addition-formula --pullback. Built from `addPullbackAlgHom_negFrobenius` (the pullback for --`id + (−π) = 1 − π`) and the standard rational-point map --`(AddMonoidHom.id _) - (frobeniusIsog W).toAddMonoidHom`. -+Its function-field pullback is the addition-formula pullback for -+`id + (−π)`, and its point map is `id − π`. -+-/ - --Mathematically this is `1 − π` with the correct pullback that the placeholder --`isogOneSub (frobeniusIsog W)` lacks (it uses `AlgHom.id` as a stub). HOLE D --wire-up consumes this directly via `Isogeny.toAlgebra`/`degree`. -/ -+/-- The isogeny `1 − π` with its addition-formula function-field pullback -+ and the point map `id − π`. -/ - noncomputable def isogOneSub_negFrobenius - (hq : 2 ≤ Fintype.card K) : Isogeny W.toAffine W.toAffine where - pullback := addPullbackAlgHom_negFrobenius W hq -@@ -2932,20 +2825,12 @@ noncomputable def isogOneSub_negFrobenius - (isogOneSub_negFrobenius W hq).toAddMonoidHom = - (AddMonoidHom.id _) - (frobeniusIsog W).toAddMonoidHom := rfl - --/-! ### Day 3c Piece C — REMOVED (2026-05-28 placeholder grind) - --The bridge lemma `isogOneSub_negFrobenius_toAddMonoidHom_eq_oneSubFrobeniusIsog` --(genuine `1−π` and the placeholder agree on `toAddMonoidHom`) existed only to --transfer the placeholder's rational-point API to the genuine isogeny. All --consumers now prove their kernel/point-map facts directly on --`isogOneSub_negFrobenius` (its `toAddMonoidHom = id − frob`, frob's point map --is the identity), so the bridge is no longer needed and has been deleted as --part of removing the placeholder `oneSubFrobeniusIsog`. -/ - --/-! ### D3b base: `AddNonInversePair` for `(zsmul 1 π, mulByInt (-1))` -+/-! ### `AddNonInversePair` for `(zsmul 1 π, mulByInt (-1))` - - The `(r, s) = (1, 1)` specialisation of the genuine `(zsmul r π, mulByInt (-s))` --family that D3b/D4 will assemble into `genuineIsogSmulSub r s`. Both pullbacks -+family defining `genuineIsogSmulSub r s`. Both pullbacks - reduce on x-coord to `x_gen W` and `x_gen W ^ q` respectively via - `mulByInt_x_one` / `mulByInt_x_neg` / `frobeniusIsog_pullback_apply`; the - mismatch is `x_gen_ne_frobeniusIsog_pullback_x_gen`. -/ -@@ -2977,12 +2862,12 @@ theorem AddNonInversePair_zsmul_one_frobenius_mulByInt_neg_one : - rw [frobeniusIsog_pullback_apply] at hne - exact hne h.symm - --/-! ### D3b general consumer: AddNonInversePair for `(zsmul r π, mulByInt -s)` -+/-! ### Non-inverse coordinate pairs: AddNonInversePair for `(zsmul r π, mulByInt -s)` - - Generalises the (1, 1) base case to arbitrary `(r, s) ≠ 0` (with `(r : K) ≠ 0` - and `(s : K) ≠ 0`). The x-coord pullbacks are `(mulByInt_x r)^q` (LHS) and - `mulByInt_x (-s)` (RHS); their orders at infinity are `-2q` and `-2` respectively --(via `ordAtInfty_mulByInt_x` from `OrdAtInftyBridge.lean:207` and -+(via `ordAtInfty_mulByInt_x` for the coordinate pole and - `ordAtInfty_pow`). For `q ≥ 2`, these are unequal, so the pullbacks are - unequal — Silverman III.6 reflection of Frobenius pole-multiplication. -/ - -@@ -3043,7 +2928,7 @@ theorem AddNonInversePair_zsmul_frobenius_mulByInt_neg - exact_mod_cast Fintype.one_lt_card_iff_nontrivial.mpr inferInstance - linarith - --/-! ### D3c step 1: σ-action on `(mulByInt n)` pullbacks (generic in `n ≠ 0`) -+/-! ### σ-action on `(mulByInt n)` pullbacks (generic in `n ≠ 0`) - - For any nonzero `n`, σ commutes with `(mulByInt n).pullback`: their composition - on `x_gen` is `(mulByInt (-n)).pullback x_gen = mulByInt_x W (-n) = mulByInt_x W n`, -@@ -3064,6 +2949,7 @@ private theorem mulByInt_comp_mulByInt_neg_one - (by simpa using neg_ne_zero.mpr hn) - rw [h]; congr 1; ring - -+omit [Fintype K] in - /-- **σ.pb fixes `(mulByInt n).pb x_gen`** for `n ≠ 0`. By `mulByInt` - commutativity, `σ.pb ([n].pb x_gen) = ([n].comp σ).pb x_gen - = (mulByInt (-n)).pb x_gen = mulByInt_x W (-n) = mulByInt_x W n` (the last by -@@ -3080,6 +2966,7 @@ theorem sigma_mulByInt_pullback_x_eq (n : ℤ) (hn : n ≠ 0) : - rw [mulByInt_pullback_x W (-n) (neg_ne_zero.mpr hn), mulByInt_x_neg] - exact (mulByInt_pullback_x W n hn).symm - -+omit [Fintype K] in - /-- **σ.pb on `(mulByInt n).pb y_gen`** for `n ≠ 0`. Same composition path - as the x-version but using `mulByInt_y_neg`: the σ-image is - `negY (mulByInt_x n) (mulByInt_y n) = -mulByInt_y n - a₁·mulByInt_x n - a₃`. -/ -@@ -3117,7 +3004,7 @@ theorem sigma_mulByInt_pullback_y_eq (n : ℤ) (hn : n ≠ 0) : - simp only [WeierstrassCurve.Affine.negY] - rfl - --/-! ### D3c step 2: σ-action on `(zsmul r π).pb` -+/-! ### σ-action on `(zsmul r π).pb` - - For `α₁ = (frobeniusIsog W).zsmul r = (mulByInt r).comp π`, the σ-action - follows from `sigma_mulByInt_pullback_x_eq` / `_y_eq` plus σ commuting -@@ -3176,13 +3063,14 @@ theorem sigma_zsmul_frobenius_pullback_y_eq (r : ℤ) (hr : r ≠ 0) : - simp only [map_sub, map_neg, map_mul, - AlgHom.commutes (frobeniusIsog W).pullback] - --/-! ### D3c step 3: x-ne mismatch witness for `(zsmul r π, mulByInt -s)` -+/-! ### x-ne mismatch witness for `(zsmul r π, mulByInt -s)` - - Extracted from `AddNonInversePair_zsmul_frobenius_mulByInt_neg`'s internal - proof: the x-coord pullbacks differ at `ord_∞` (`-2q` vs `-2`). Used - directly as the `h_x_ne` argument to the generic - `addPullback_x_pair_sigma_invariant`. -/ - -+omit [DecidableEq K] in - /-- The `ord_∞` contradiction behind the `x`-coord mismatch: `(mulByInt_x W r)^|K|` - (order `-2q`) cannot equal `mulByInt_x W (-s)` (order `-2`), since `|K|·(-2) = -2` - would force `|K| ≤ 1`. -/ -@@ -3224,16 +3112,16 @@ theorem zsmul_frobenius_pullback_x_ne_mulByInt_neg_pullback_x - rw [zsmul_frobenius_pullback_x_gen W r hr, mulByInt_neg_pullback_x_gen W s hs] - exact mulByInt_x_pow_card_ne_mulByInt_x_neg W r s hr hrK hs hsK - --/-! ### D3c step 4: σ-invariance specialised + K(x) image -+/-! ### σ-invariance specialised + K(x) image - - Specialise `addPullback_x_pair_sigma_invariant` to - `(α₁, α₂) = (zsmul r π, mulByInt -s)` using the four σ-symmetry helpers --shipped above, then chain with `sigma_fixed_implies_in_KX_image` to extract -+above, then chain with `sigma_fixed_implies_in_KX_image` to extract - the K(x) image. -/ - - /-- **σ-invariance of `addPullback_x_pair (zsmul r π, mulByInt -s)`**. - Specialisation of the generic `addPullback_x_pair_sigma_invariant` for --the family used by D3c/D4. -/ -+this pencil family. -/ - theorem addPullback_x_pair_zsmul_frobenius_mulByInt_neg_sigma_invariant - (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) - (hrK : (r : K) ≠ 0) (hsK : (s : K) ≠ 0) : -@@ -3262,7 +3150,7 @@ theorem addPullback_x_pair_zsmul_frobenius_mulByInt_neg_in_KX_image - (addPullback_x_pair_zsmul_frobenius_mulByInt_neg_sigma_invariant - W r s hr hs hrK hsK) - --/-! ### D3c step 5: ord helpers for `(zsmul r π).pb x_gen` and -+/-! ### ord helpers for `(zsmul r π).pb x_gen` and - `(mulByInt -s).pb x_gen` - - Concrete ord values needed by the pole-bound argument: `(zsmul r π).pb x_gen -@@ -3302,6 +3190,7 @@ theorem ordAtInfty_zsmul_frobenius_pullback_x_gen - push_cast - rfl - -+omit [Fintype K] in - /-- `ord_∞((mulByInt (-s)).pb x_gen) = -2` for `s ≠ 0` with `(s : K) ≠ 0`. - Direct from `(mulByInt -s).pb x_gen = mulByInt_x W (-s)` plus - `ordAtInfty_mulByInt_x`. -/ -@@ -3361,7 +3250,7 @@ private lemma ordAtInfty_mulByInt_x_mul_y (r : ℤ) {M m : ℤ} - refine ((W_smooth W).ordAtInfty_mul hX_ne hY_ne).trans ?_ - rw [hX_ord, hm]; push_cast; rfl - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- For `M < 0` the right-hand side of the Weierstrass equation is dominated by `X³`, so - `ord_∞(X³ + a₂·X² + a₄·X + a₆) = 3M` where `M = ord_∞(mulByInt_x W r)`. Repeated strict - non-archimedean additivity: `3M < 2M < M < 0`, so each successive `aᵢ·Xⁱ` term has strictly larger -@@ -3434,7 +3323,7 @@ private lemma mulByInt_y_ne_zero_of_weierstrass_lhs_ord (r : ℤ) {M : ℤ} - (congrArg (W_smooth W).ordAtInfty h_zero).trans (W_smooth W).ordAtInfty_zero - exact WithTop.top_ne_coe (h_ord_eq.symm.trans h_lhs_ord) - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- The halving lower bound `2m ≤ 3M`, where `m = ord_∞(mulByInt_y W r)` and `M = ord_∞(mulByInt_x W - r)`. If instead `2m ≥ 3M + 1`, every Weierstrass LHS term (`Y²`, `a₁·X·Y`, `a₃·Y`) would have order - `≥ 3M + 1`, so the LHS order would be `≥ 3M + 1`, contradicting `ord(LHS) = 3M`. -/ -@@ -3477,7 +3366,7 @@ private lemma two_mul_ordAtInfty_mulByInt_y_le (r : ℤ) {M m : ℤ} (hM_neg : M - have : (3 * M + 1 : ℤ) ≤ 3 * M := by exact_mod_cast h_lhs_ge - omega - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- When `m < M` and `m < 0` (which hold once `2m ≤ 3M` with `M < 0`), the term `Y²` strictly - dominates the other two Weierstrass LHS terms, so `ord_∞(Y² + a₁·X·Y + a₃·Y) = 2m`, where `m = - ord_∞(mulByInt_y W r)`. -/ -@@ -3520,6 +3409,7 @@ private lemma ordAtInfty_mulByInt_weierstrass_lhs_eq (r : ℤ) {M m : ℤ} - refine (((W_smooth W).ordAtInfty_add_eq_of_lt h_a3y_gt').trans h_inner_eq).trans ?_ - exact hY_sq_ord - -+omit [Fintype K] in - /-- **`ord_∞(mulByInt_y W r) = 3M/2`** for `r ≠ 0`, where `M = ord_∞(mulByInt_x W r)` is the - (even, `≤ -2`) `x`-order — **no** `(r : K) ≠ 0` hypothesis. The curve point - `(mulByInt_x W r, mulByInt_y W r)` satisfies the Weierstrass equation -@@ -3563,13 +3453,14 @@ theorem ordAtInfty_mulByInt_y_eq_of_x - rw [hm, h_target] - exact_mod_cast (by omega : m = 3 * M₂) - --/-! ### D3c step 6: ord helpers for `mulByInt_y` and the y-pullbacks -+/-! ### ord helpers for `mulByInt_y` and the y-pullbacks - - To compute `ord_∞` of the pair `addPullback_x`, we need ord values for - the y-coordinate pullbacks: `ord((zsmul r π).pb y_gen) = -3q` and - `ord((mulByInt -s).pb y_gen) = -3`. These chain through - `ord(mulByInt_y W r) = -3` (curve-equation argument with x-ord = -2). -/ - -+omit [Fintype K] in - /-- **`ord_∞(mulByInt_y W r) = -3`** for `r ≠ 0` with `(r : K) ≠ 0`. - The `(mulByInt_x W r, mulByInt_y W r)` curve point has `ord(mulByInt_x) = -2`, - so the curve equation `Y² + a₁·X·Y + a₃·Y = X³ + ...` forces -@@ -3624,6 +3515,7 @@ theorem ordAtInfty_zsmul_frobenius_pullback_y_gen - push_cast - rfl - -+omit [Fintype K] in - /-- `ord_∞((mulByInt -s).pb y_gen) = -3` for `s ≠ 0` with `(s : K) ≠ 0`. - Direct from `(mulByInt -s).pb y_gen = mulByInt_y W (-s)` plus - `ordAtInfty_mulByInt_y_eq_neg_three`. -/ -@@ -3701,7 +3593,7 @@ theorem ordAtInfty_zsmul_frobenius_pullback_y_gen_of_x - rw [h_eq] - exact ((W_smooth W).ord_pow_concrete hY_ne ((3 * M) / 2) (Fintype.card K) hY_ord) - --/-! ### D3c step 7: ord helpers for the pair differences -+/-! ### ord helpers for the pair differences - - The slope `L = (Y₁ - Y₂) / (X₁ - X₂)` requires ord of the differences: - `ord(α₁(x) - α₂(x)) = -2q` (α₁(x) dominates, ord = -2q < -2 = ord(α₂(x))), -@@ -3754,7 +3646,7 @@ theorem zsmul_frobenius_sub_mulByInt_neg_x_ne_zero - rw [ordAtInfty_zsmul_frobenius_sub_mulByInt_neg_x W r s hr hs hrK hsK] at h_top - exact WithTop.coe_ne_top h_top - --/-! ### D3c step 8: numerator + reduced form for the pair (zsmul r π, mulByInt -s) -+/-! ### numerator + reduced form for the pair (zsmul r π, mulByInt -s) - - Mirror of `addPullbackNumerator_negFrobenius` and `_reduced` for the pair - version. The numerator is `(X₁-X₂)² · addPullback_x_pair` (cleared of the -@@ -3830,7 +3722,7 @@ private theorem weierstrass_relation_pullback (α : Isogeny W.toAffine W.toAffin - `addPullbackNumerator_negFrobenius_eq_reduced`, with both Weierstrass - equations applied via `linear_combination h_α₁ + h_α₂`. -/ - theorem addPullbackNumerator_pair_zsmul_frobenius_mulByInt_neg_eq_reduced -- (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) : -+ (r s : ℤ) (_hr : r ≠ 0) (_hs : s ≠ 0) : - addPullbackNumerator_pair_zsmul_frobenius_mulByInt_neg W r s = - addPullbackNumerator_reduced_pair_zsmul_frobenius_mulByInt_neg W r s := by - have h_α₁ := weierstrass_relation_pullback W ((frobeniusIsog W).zsmul r) -@@ -3885,7 +3777,7 @@ theorem addPullbackNumerator_pair_zsmul_frobenius_mulByInt_neg_eq - field_simp - ring - --/-! ### D3c step 9: `ord(reduced_pair) = -4q - 2` -+/-! ### `ord(reduced_pair) = -4q - 2` - - Mirror of `ordAtInfty_addPullbackNumerator_reduced_negFrobenius_eq` for - the pair version. Dominant term: `α₁(x)² · α₂(x)` (ord = -4q-2). All -@@ -3914,6 +3806,7 @@ private lemma zsmul_frobenius_pullback_x_gen_ne_zero - rw [ordAtInfty_zsmul_frobenius_pullback_x_gen W r hr hrK] at h_top - exact WithTop.coe_ne_top h_top - -+omit [Fintype K] in - /-- `(mulByInt -s).pb y_gen ≠ 0` for `s ≠ 0` with `(s : K) ≠ 0`. -/ - private lemma mulByInt_neg_pullback_y_gen_ne_zero - (s : ℤ) (hs : s ≠ 0) (hsK : (s : K) ≠ 0) : -@@ -3925,6 +3818,7 @@ private lemma mulByInt_neg_pullback_y_gen_ne_zero - rw [ordAtInfty_mulByInt_neg_pullback_y_gen W s hs hsK] at h_top - exact WithTop.coe_ne_top h_top - -+omit [Fintype K] in - /-- `(mulByInt -s).pb x_gen ≠ 0` for `s ≠ 0` with `(s : K) ≠ 0`. -/ - private lemma mulByInt_neg_pullback_x_gen_ne_zero - (s : ℤ) (hs : s ≠ 0) (hsK : (s : K) ≠ 0) : -@@ -4120,6 +4014,7 @@ private lemma ord_zsmul_frobenius_mulByInt_neg_rest_term_a₄_ge - exact_mod_cast (by linarith : - (-3 * (Fintype.card K : ℤ) - 3 : ℤ) ≤ -2 * (Fintype.card K : ℤ)) - -+omit [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Rest term 2: `ord(2 · a₆) ≥ -3q - 3`. The constant `a₆` has order `≥ 0` (or `⊤` if - zero), which clears `-3q - 3`; `ord_two_mul_ge` handles the `2·` factor in any - characteristic. -/ -@@ -4385,7 +4280,7 @@ theorem ord_addPullback_x_pair_zsmul_frobenius_mulByInt_neg - (-4 * (Fintype.card K : ℤ)) h_num_ord h_den_ord).trans ?_ - congr 1; ring - --/-! ### D3c: the `y`-coordinate `∞`-order for the pair `(zsmul r π, mulByInt -s)` -+/-! ### the `y`-coordinate `∞`-order for the pair `(zsmul r π, mulByInt -s)` - - The pair analogue of `ord_addPullback_y_negFrobenius = -3`. The proof is the *same* - Weierstrass-equation argument: from `ord_∞(addPullback_x_pair) = -2` and the curve equation -@@ -4400,7 +4295,7 @@ private theorem ord_addPullback_x_sq_pair_zsmul_frobenius_mulByInt_neg - (W_smooth W).ordAtInfty - (addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) ^ 2) = - ((-4 : ℤ) : WithTop ℤ) := by -- haveI : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic -+ have : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic - have hX_ne : addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) ≠ 0 := - fun h ↦ WithTop.coe_ne_top - (((W_smooth W).ordAtInfty_eq_top_iff _).mpr h ▸ -@@ -4415,7 +4310,7 @@ private theorem ord_addPullback_x_cube_pair_zsmul_frobenius_mulByInt_neg - (W_smooth W).ordAtInfty - (addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) ^ 3) = - ((-6 : ℤ) : WithTop ℤ) := by -- haveI : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic -+ have : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic - have hX_ne : addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) ≠ 0 := - fun h ↦ WithTop.coe_ne_top - (((W_smooth W).ordAtInfty_eq_top_iff _).mpr h ▸ -@@ -4435,7 +4330,7 @@ private theorem ord_RHS_pair_zsmul_frobenius_mulByInt_neg - addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) + - algebraMap K KE W.toAffine.a₆) = - ((-6 : ℤ) : WithTop ℤ) := by -- haveI : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic -+ have : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic - set X := addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) with hX - have h_X3 : (W_smooth W).ordAtInfty (X ^ 3) = ((-6 : ℤ) : WithTop ℤ) := - ord_addPullback_x_cube_pair_zsmul_frobenius_mulByInt_neg W r s hr hs hrK hsK -@@ -4525,7 +4420,7 @@ private theorem addPullback_y_pair_zsmul_frobenius_mulByInt_neg_ne_zero - (h_ord_eq.symm.trans - (ord_weierstrass_lhs_pair_zsmul_frobenius_mulByInt_neg W r s hr hs hrK hsK)) - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Order-arithmetic helper (step (a)): if `ord(LHS) = -6`, the y-order `m` of the Weierstrass LHS - satisfies `m ≤ -3`. Otherwise all three summands would have order `≥ -4`, forcing `ord(LHS) ≥ -4`, - contradicting `-6`. Purely generic in `X`, `Y`, `m` and the per-term order data. -/ -@@ -4558,7 +4453,7 @@ private theorem ord_y_le_neg_three_of_weierstrass_lhs_ord {X Y : KE} {m : ℤ} - have h46 : (-4 : ℤ) ≤ -6 := by exact_mod_cast h_lhs_ge - omega - --omit [Fintype K] in -+omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in - /-- Order-arithmetic helper (step (b)): when `m ≤ -3`, the `Y²` term strictly dominates both the - `a₁·X·Y` and `a₃·Y` terms (`2m < -2 + m` and `2m < m`), so the order of the Weierstrass LHS equals - `ord(Y²)`. Purely generic in `X`, `Y`, `m` and the per-term order data. -/ -@@ -4603,7 +4498,7 @@ theorem ord_addPullback_y_pair_zsmul_frobenius_mulByInt_neg - (W_smooth W).ordAtInfty - ((addPullback_y_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s))) : KE) = - ((-3 : ℤ) : WithTop ℤ) := by -- haveI : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic -+ have : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic - set X := addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) with hX - set Y := addPullback_y_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) with hY - have hX_ne : X ≠ 0 := -@@ -4633,21 +4528,13 @@ theorem ord_addPullback_y_pair_zsmul_frobenius_mulByInt_neg - have h_2m : (2 * m : ℤ) = -6 := by exact_mod_cast h_lhs_ord - rw [hm]; exact_mod_cast (by omega : m = -3) - --/-! ### D4: pole-bound-parametric `genuineIsogSmulSub` -+/-! ### The pencil `r·π − s·id` - --Worker D consumes `genuineIsogSmulSub r s` for the genuine `r·π - s·id` --isogeny. The constructor needs: --1. The `AddNonInversePair` witness — shipped axiom-clean as -- `AddNonInversePair_zsmul_frobenius_mulByInt_neg`. --2. `addCoordAlgHomPair`-injectivity — reducible (via base-hom + transcendence -- chain) to a pole bound `ord_∞ < 0` on the pair pullback x-coord. -- --We ship the **pole-bound-parametric** form. The pole bound discharges --axiom-clean via the same numerator/denominator/Weierstrass-reduction --chain as `ord_addPullback_x_negFrobenius` (the (1,1) base case here), --mirrored to the pair version with α₁(x)²·α₂(x) as the dominant term --(ord = -4q-2). Worker D supplies the pole bound (or waits for the --follow-up axiom-clean discharge). -/ -+Different coordinate orders provide the non-inverse-pair witness. -+A pole of the summed x-coordinate gives polynomial and coordinate-ring -+injectivity through curve-negation invariance and its `K(x)` image. -+These facts construct the pencil isogeny's function-field pullback. -+-/ - - /-- **Witness-parametric base-hom injectivity** for the - `(zsmul r π, mulByInt -s)` family: takes the pole bound hypothesis -@@ -4713,17 +4600,9 @@ theorem addCoordAlgHomPair_injective_zsmul_frobenius_mulByInt_neg_of_pole - (addBaseHomPair_injective_zsmul_frobenius_mulByInt_neg_of_pole - W r s hr hs hrK hsK h_pole) - --/-- **D4: genuine `r·π - s·id` isogeny constructor (pole-bound-parametric)**. -- --The genuine `r·π - s·id` isogeny with the *real* function-field pullback --(replacing the `AlgHom.id` placeholder of `Endomorphism.lean`'s --`isogSmulSub`). On rational points equals --`(zsmul r π).toAddMonoidHom + (mulByInt -s).toAddMonoidHom`. -- --Worker D in `DegreeQuadraticForm.lean` consumes this as the `r·π - s·id` --isogeny family. The pole bound discharges axiom-clean via the same --numerator chain as `ord_addPullback_x_negFrobenius` (the (1,1) base --case), mirrored to the pair version. -/ -+/-- The isogeny `r·π − s·id`, given the pole of its addition x-coordinate. -+ Its function-field pullback comes from the addition formulas, and its -+ point map is `(r·π) + (−s·id)`. -/ - noncomputable def genuineIsogSmulSub_of_pole - (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) - (hrK : (r : K) ≠ 0) (hsK : (s : K) ≠ 0) -@@ -4747,12 +4626,11 @@ noncomputable def genuineIsogSmulSub_of_pole - (mulByInt W.toAffine (-s)).toAddMonoidHom := - rfl - --/-! ### D4 unconditional: `genuineIsogSmulSub` -+/-! ### Constructing the pencil from its coordinate pole - --With `ord_addPullback_x_pair_zsmul_frobenius_mulByInt_neg = -2 < 0` --discharged axiom-clean, the witness-parametric `genuineIsogSmulSub_of_pole` --becomes unconditional. The unconditional form is what Worker D consumes --in `DegreeQuadraticForm.lean` for the polarisation. -/ -+The addition x-coordinate has order `−2`, hence a pole. This supplies -+the injectivity witness for the function-field pullback of `r·π − s·id`. -+-/ - - /-- The pole bound `ord_∞ < 0` discharges from - `ord_addPullback_x_pair_zsmul_frobenius_mulByInt_neg = -2`. -/ -@@ -4765,11 +4643,9 @@ private theorem h_pole_discharge - rw [ord_addPullback_x_pair_zsmul_frobenius_mulByInt_neg W r s hr hs hrK hsK] - exact_mod_cast (by norm_num : (-2 : ℤ) < 0) - --/-- **D4 (unconditional)**: the genuine `r·π - s·id` isogeny for --`r, s ≠ 0` with `(r : K), (s : K) ≠ 0`. Pullback is the *real* --function-field pullback; on rational points equals --`r · π + (-s) · id = r · π - s · id`. Worker D in --`DegreeQuadraticForm.lean` consumes this directly. -/ -+/-- The isogeny `r·π − s·id` when the two integers and their base-field -+ images are nonzero. Its pullback is the addition-formula pullback, -+ and its point map is `r·π − s·id`. -/ - noncomputable def genuineIsogSmulSub - (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) - (hrK : (r : K) ≠ 0) (hsK : (s : K) ≠ 0) : -@@ -4785,7 +4661,7 @@ noncomputable def genuineIsogSmulSub - (mulByInt W.toAffine (-s)).toAddMonoidHom := - rfl - --/-! ### D4 inseparable: the `p ∣ r` pole bound `ord_∞(addPullback_x_pair) = -2` -+/-! ### Inseparable pencil: the `p ∣ r` pole bound `ord_∞(addPullback_x_pair) = -2` - - For the **inseparable** pencil summand `r·π` (when `p ∣ r`, so `(r : K) = 0`), the `x`-pole of - `α₁ = (frobeniusIsog).zsmul r` is `ord_∞(α₁^* x_gen) = q·M` with -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/FunctionField.lean b/projects/HasseWeil/HasseWeil/Isogeny/FunctionField.lean -index 390492635..fba307a06 100644 ---- a/projects/HasseWeil/HasseWeil/Isogeny/FunctionField.lean -+++ b/projects/HasseWeil/HasseWeil/Isogeny/FunctionField.lean -@@ -7,30 +7,6 @@ import Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Point - import Mathlib.LinearAlgebra.Dimension.Finrank - import Mathlib.LinearAlgebra.Basis.VectorSpace - --/-! --# Isogenies via Function Field Extensions -- --We define isogenies between elliptic curves as injective `K`-algebra homomorphisms --on function fields, following Silverman III.4. The degree of an isogeny is the degree --of the corresponding field extension. -- --## Main Definitions -- --* `HasseWeil.Isogeny`: An isogeny from `E₁` to `E₂`, represented as an injective -- `K`-algebra homomorphism `K(E₂) →ₐ[K] K(E₁)` on function fields. --* `HasseWeil.Isogeny.degree`: The degree `[K(E₁) : φ*K(E₂)]`. -- --## Design Note -- --The degree is defined as `Module.finrank K(E₂) K(E₁)` where `K(E₁)` is given a --`K(E₂)`-algebra structure via the pullback `φ* : K(E₂) →ₐ[F] K(E₁)`. This avoids --working with subalgebra ranges and makes the tower law (degree multiplicativity) --a direct application of `Module.finrank_mul_finrank`. -- --## References -- --* [Silverman, *The Arithmetic of Elliptic Curves*], III.4 ---/ - - open WeierstrassCurve Polynomial - -@@ -49,8 +25,7 @@ namespace PullbackIsogeny - variable {F : Type*} [Field F] - variable {W₁ W₂ W₃ : Affine F} [W₁.IsElliptic] [W₂.IsElliptic] [W₃.IsElliptic] - --/-- The pullback of an isogeny is injective: any algebra homomorphism from a field -- is injective because the kernel of a ring homomorphism from a field is trivial. -/ -+ - theorem pullback_injective (φ : PullbackIsogeny F W₁ W₂) : - Function.Injective φ.pullback := - φ.pullback.toRingHom.injective -@@ -61,8 +36,7 @@ noncomputable def toAlgebra (φ : PullbackIsogeny F W₁ W₂) : - Algebra W₂.FunctionField W₁.FunctionField := - φ.pullback.toRingHom.toAlgebra - --/-- The degree of an isogeny, defined as `[K(E₁) : K(E₂)]` where `K(E₁)` is -- a `K(E₂)`-module via the pullback. -/ -+ - noncomputable def degree (φ : PullbackIsogeny F W₁ W₂) : ℕ := - @Module.finrank W₂.FunctionField W₁.FunctionField _ _ φ.toAlgebra.toModule - -@@ -81,12 +55,12 @@ theorem comp_algebraMap_eq (ψ : PullbackIsogeny F W₂ W₃) (φ : PullbackIsog - theorem comp_degree (ψ : PullbackIsogeny F W₂ W₃) (φ : PullbackIsogeny F W₁ W₂) : - (ψ.comp φ).degree = φ.degree * ψ.degree := by - simp only [degree] -- letI inst₁ : Algebra W₂.FunctionField W₁.FunctionField := φ.toAlgebra -- letI inst₂ : Algebra W₃.FunctionField W₂.FunctionField := ψ.toAlgebra -- letI inst₃ : Algebra W₃.FunctionField W₁.FunctionField := (ψ.comp φ).toAlgebra -- haveI : IsScalarTower W₃.FunctionField W₂.FunctionField W₁.FunctionField := -+ let inst₁ : Algebra W₂.FunctionField W₁.FunctionField := φ.toAlgebra -+ let inst₂ : Algebra W₃.FunctionField W₂.FunctionField := ψ.toAlgebra -+ let inst₃ : Algebra W₃.FunctionField W₁.FunctionField := (ψ.comp φ).toAlgebra -+ have : IsScalarTower W₃.FunctionField W₂.FunctionField W₁.FunctionField := - IsScalarTower.of_algebraMap_eq fun x => rfl -- haveI : Module.Free W₂.FunctionField W₁.FunctionField := -+ have : Module.Free W₂.FunctionField W₁.FunctionField := - Module.Free.of_divisionRing _ _ - rw [mul_comm] - exact (Module.finrank_mul_finrank -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/GroupHom/PicZero.lean b/projects/HasseWeil/HasseWeil/Isogeny/GroupHom/PicZero.lean -index 1b98e70eec533a4bac61cd0a445abb7372a63eea..603d41e1f0ecdaf549903d24babfdd67af8baf36 100644 -GIT binary patch -delta 1063 -zcmaKr&x#X45XO;}tTYJXNkOGBxBnCWi2d$O*V=*_F< -z0mL^5Nnq?e||E*d~UkuOl_es6@Sha9z!S)C`TQ*wF|cP -z#mKnBsA{yxc);@Abe;iuP^Pjn(6B@}q)?>JyF)COZ)cCBGDCt&TFAbB$@;Kg)V`6{ -zd95%{Pb}zIz-U>5HKc=&vJ%Gs*oy*bibn5yQ!AaUFgP~A%T;xmRD{DINqfN8wj@QN -zJW3-cQj;&DH+CNFx!*$1f&&NS&G%OXZKAkNj)~NYHsts$3;@-Kzf4C -zBdptRW9$p@3`gitE4&4>$DRJ{P3PNw8sCfKV@|w6lkPn0LXKXc&N-)a)^-@wesv;I -z99hF&JO>sE8ImuSntj-S#m~*bg@eJ`Gj}@T_a&t9hlEk`MQ$;>&ERUc+ukc -z*EY?O+mmNogKb#8{|H-8x3k6Gl}{VfNLC`Qck+kgTN{gxeZ}SDlCh3f^fsdLY!TQz -zr$7^a9ko~-qvfH&FaAA$5NpdKVzX=4Z$9ioq=@e+)}dha7Oh~?jn@fVfy0g9P3;se -J&fhq=_!|#HjPn2h - -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/Kernel.lean b/projects/HasseWeil/HasseWeil/Isogeny/Kernel.lean -index 2b2b0f7f5..f46fb56a6 100644 ---- a/projects/HasseWeil/HasseWeil/Isogeny/Kernel.lean -+++ b/projects/HasseWeil/HasseWeil/Isogeny/Kernel.lean -@@ -7,36 +7,6 @@ import HasseWeil.Foundation.Basic - import Mathlib.FieldTheory.Galois.Basic - import Mathlib.FieldTheory.SeparableDegree - --/-! --# Kernel of an Isogeny -- --For an isogeny `φ : E₁ → E₂`, we collect the structural facts about `ker φ` --as an `AddSubgroup` of `E₁.Point`. These are foundational for the dual --isogeny construction (Silverman III.6) and the Hasse bound (V.1). -- --## Main definitions -- --* `Isogeny.kernel φ` — the kernel of `φ.toAddMonoidHom`, viewed as an -- `AddSubgroup` of `W₁.Point`. A thin wrapper around `AddMonoidHom.ker`. --* `Isogeny.IsSeparable φ` — separability of the induced field extension. -- --## Deep results (not yet proved) -- --The following correspond to tickets `T-III-4-011/012/015`; they require --substantial infrastructure (finiteness of fibers for finite morphisms of --smooth curves, and the Galois theory of `K(E₁)/φ*K(E₂)`) and are deferred. -- --* **Silverman III.4.10(a)** — nonzero isogeny has finite kernel. --* **Silverman III.4.10(b)** — `#ker φ ≤ deg_s φ ≤ deg φ`. --* **Silverman III.4.10(c)** — equality when `φ` is separable. -- --Once available, these unblock the dual isogeny chain (T-III-6-001 etc.). -- --## References -- --* [J Silverman, *The Arithmetic of Elliptic Curves*][silverman2009], III.4.10. -- ---/ - - open WeierstrassCurve - -@@ -47,7 +17,7 @@ variable {W₁ W₂ : Affine F} [W₁.IsElliptic] [W₂.IsElliptic] - - namespace Isogeny - --/-- The kernel of an isogeny `φ`, as an `AddSubgroup` of `W₁.Point`. -/ -+ - noncomputable def kernel (φ : Isogeny W₁ W₂) : AddSubgroup W₁.Point := - φ.toAddMonoidHom.ker - -@@ -58,25 +28,20 @@ noncomputable def kernel (φ : Isogeny W₁ W₂) : AddSubgroup W₁.Point := - @[simp] theorem zero_mem_kernel (φ : Isogeny W₁ W₂) : (0 : W₁.Point) ∈ φ.kernel := - (φ.kernel).zero_mem - --/-- The kernel is preserved by composition (fiberwise): `ker φ ⊆ ker (ψ ∘ φ)`. -/ -+ - theorem kernel_comp_le {W₃ : Affine F} [W₃.IsElliptic] (ψ : Isogeny W₂ W₃) - (φ : Isogeny W₁ W₂) : φ.kernel ≤ (ψ.comp φ).kernel := by - intro P hP - simp only [mem_kernel_iff, comp_apply] at hP ⊢ - rw [hP, map_zero] - --/-- **T-III-4-011 witness form**: If the fiber `φ⁻¹({0})` (as a subtype -- of `W₁.Point`) is finite, then `φ.kernel` is a finite additive subgroup. - -- The hypothesis `h_fiber` is a specific case of T-II-2-002 (finite fibers -- for nonconstant morphisms of smooth curves) applied to the fiber over `0`. -- Full unconditional version awaits that foundational curve-theory result. -/ - theorem kernel_finite_of_fiber_finite (φ : Isogeny W₁ W₂) - (h_fiber : Finite {P : W₁.Point // φ.toAddMonoidHom P = 0}) : - Finite φ.kernel := - Finite.of_equiv _ (Equiv.subtypeEquivRight (mem_kernel_iff φ)).symm - --/-- `ker [1] = ⊥` (trivial kernel, since [1] is the identity on points). -/ -+ - @[simp] theorem kernel_mulByInt_one {W : WeierstrassCurve F} [W.toAffine.IsElliptic] : - (mulByInt W.toAffine 1).kernel = ⊥ := by - ext P -@@ -108,8 +73,7 @@ theorem mem_kernel_comp_of_mem_kernel {W₃ : Affine F} [W₃.IsElliptic] - (hP : P ∈ φ.kernel) : P ∈ (ψ.comp φ).kernel := - kernel_comp_le ψ φ hP - --/-- If `ψ` has trivial kernel, `ker (ψ ∘ φ) = ker φ`: applying a "monomorphic" -- post-composition doesn't enlarge the kernel. -/ -+ - theorem kernel_comp_of_kernel_eq_bot {W₃ : Affine F} [W₃.IsElliptic] - {ψ : Isogeny W₂ W₃} (hψ : ψ.kernel = ⊥) (φ : Isogeny W₁ W₂) : - (ψ.comp φ).kernel = φ.kernel := by -@@ -123,9 +87,7 @@ theorem kernel_comp_of_kernel_eq_bot {W₃ : Affine F} [W₃.IsElliptic] - · intro h - rw [h, map_zero] - --/-- **Kernel finiteness over finite fields (unconditional)**: when `W₁.Point` -- is finite (e.g., for an elliptic curve over a finite field), every kernel -- is automatically finite. -/ -+ - instance kernel_finite_of_point_finite [Finite W₁.Point] (φ : Isogeny W₁ W₂) : - Finite φ.kernel := - inferInstance -@@ -135,15 +97,12 @@ theorem kernel_card_le_point_card [Finite W₁.Point] (φ : Isogeny W₁ W₂) : - Nat.card φ.kernel ≤ Nat.card W₁.Point := - Nat.card_le_card_of_injective _ (Subtype.val_injective) - --/-- **Lagrange for kernel**: over a finite field, `#ker φ ∣ #W₁.Point` -- (subgroup cardinality divides group cardinality). -/ -+ - theorem kernel_card_dvd_point_card [Finite W₁.Point] (φ : Isogeny W₁ W₂) : - Nat.card φ.kernel ∣ Nat.card W₁.Point := - AddSubgroup.card_addSubgroup_dvd_card φ.kernel - --/-- **Kernel of sum** (for AddSubgroup inclusion): `ker φ ∩ ker ψ ≤ ker (φ + ψ)`, -- where `(φ + ψ)` is a hypothetical isogeny with summed action. -- (Purely algebraic: if φ(P) = 0 and ψ(P) = 0, then φ(P) + ψ(P) = 0.) -/ -+ - theorem kernel_inf_le_kernel_of_sum (φ ψ : Isogeny W₁ W₂) - (σ : Isogeny W₁ W₂) (hσ : σ.toAddMonoidHom = φ.toAddMonoidHom + ψ.toAddMonoidHom) : - φ.kernel ⊓ ψ.kernel ≤ σ.kernel := by -@@ -151,7 +110,7 @@ theorem kernel_inf_le_kernel_of_sum (φ ψ : Isogeny W₁ W₂) - simp only [AddSubgroup.mem_inf, mem_kernel_iff] at hP - simp only [mem_kernel_iff, hσ, AddMonoidHom.add_apply, hP.1, hP.2, add_zero] - --/-- An isogeny has trivial kernel iff its toAddMonoidHom is injective. -/ -+ - theorem kernel_eq_bot_iff_injective (φ : Isogeny W₁ W₂) : - φ.kernel = ⊥ ↔ Function.Injective φ.toAddMonoidHom := - AddMonoidHom.ker_eq_bot_iff φ.toAddMonoidHom -@@ -161,23 +120,20 @@ theorem id_toAddMonoidHom_injective : - Function.Injective (Isogeny.id W₁).toAddMonoidHom := - Function.injective_id - --/-- `ker (ψ ∘ φ) = φ⁻¹(ker ψ)` (as an AddSubgroup): the kernel of a composition -- is the preimage of the outer kernel. -/ -+ - theorem kernel_comp_eq_comap {W₃ : Affine F} [W₃.IsElliptic] - (ψ : Isogeny W₂ W₃) (φ : Isogeny W₁ W₂) : - (ψ.comp φ).kernel = ψ.kernel.comap φ.toAddMonoidHom := by - ext P - simp [mem_kernel_iff] - --/-- For a nonzero isogeny with finite kernel, the action of the kernel on -- any nonempty fiber is transitive. I.e., `φ⁻¹(Q) = P₀ + ker φ` as sets -- (when `φ(P₀) = Q`). -/ -+ - theorem fiber_eq_coset (φ : Isogeny W₁ W₂) - {P₀ : W₁.Point} {Q : W₂.Point} (hP₀ : φ.toAddMonoidHom P₀ = Q) : - {P : W₁.Point | φ.toAddMonoidHom P = Q} = - {P : W₁.Point | ∃ T ∈ φ.kernel, P = P₀ + T} := by - ext P -- simp only [Set.mem_setOf_eq] -+ simp only [Set.mem_ofPred_eq] - constructor - · intro hP - refine ⟨P - P₀, ?_, by abel⟩ -@@ -193,10 +149,7 @@ theorem mem_fiber_iff_sub_mem_kernel (φ : Isogeny W₁ W₂) - φ.toAddMonoidHom P = Q ↔ P - P₀ ∈ φ.kernel := by - rw [mem_kernel_iff, map_sub, hP₀, sub_eq_zero] - --/-- **Fiber cardinality = kernel cardinality** (via coset structure): the -- fiber `φ⁻¹(Q)` of a nonempty fiber (with `P₀ ∈ φ⁻¹(Q)`) has the same -- cardinality as `ker φ`. This is the group-theoretic content of the -- fiber-cardinality formula (before invoking any ramification theory). -/ -+ - noncomputable def fiberEquivKernel (φ : Isogeny W₁ W₂) - {P₀ : W₁.Point} {Q : W₂.Point} (hP₀ : φ.toAddMonoidHom P₀ = Q) : - {P : W₁.Point // φ.toAddMonoidHom P = Q} ≃ φ.kernel where -@@ -213,12 +166,11 @@ theorem fiber_finite_of_kernel_finite (φ : Isogeny W₁ W₂) - Finite {P : W₁.Point // φ.toAddMonoidHom P = Q} := by - rcases Classical.em (∃ P₀, φ.toAddMonoidHom P₀ = Q) with ⟨P₀, hP₀⟩ | h_empty - · exact Finite.of_equiv _ (fiberEquivKernel φ hP₀).symm -- · haveI : IsEmpty {P : W₁.Point // φ.toAddMonoidHom P = Q} := -+ · have : IsEmpty {P : W₁.Point // φ.toAddMonoidHom P = Q} := - ⟨fun ⟨P, hP⟩ ↦ h_empty ⟨P, hP⟩⟩ - infer_instance - --/-- **Bijection of nonempty fibers**: any two nonempty fibers of `φ` are in -- bijection. (They're both cosets of the kernel, hence have the same size.) -/ -+ - noncomputable def fiberEquivFiber (φ : Isogeny W₁ W₂) - {P₀ : W₁.Point} {Q : W₂.Point} (hP₀ : φ.toAddMonoidHom P₀ = Q) - {P₁ : W₁.Point} {Q' : W₂.Point} (hP₁ : φ.toAddMonoidHom P₁ = Q') : -@@ -226,21 +178,12 @@ noncomputable def fiberEquivFiber (φ : Isogeny W₁ W₂) - {P : W₁.Point // φ.toAddMonoidHom P = Q'} := - (fiberEquivKernel φ hP₀).trans (fiberEquivKernel φ hP₁).symm - --/-- **T-III-4-015 step 1** (kernel-as-fiber-over-zero): the kernel of an -- isogeny is in canonical bijection with the fiber over the identity point. -- Direct specialization of `fiberEquivKernel` to `Q = 0` (image of `P₀ = 0`). - -- This is the foundational set-theoretic identification: `φ.kernel ≃ φ⁻¹(0)`. -- Combined with `fiber_card_eq_kernel_card` (which generalizes to any `Q` in -- image), this gives the standard isogeny-fiber result that connects the -- kernel cardinality to the fiber structure. -/ - noncomputable def kernel_equiv_fiber_zero (φ : Isogeny W₁ W₂) : - φ.kernel ≃ {P : W₁.Point // φ.toAddMonoidHom P = 0} := - (fiberEquivKernel φ (by simp : φ.toAddMonoidHom 0 = 0)).symm - --/-- **Corollary** (kernel-cardinality = fiber-zero-cardinality): when the kernel -- is finite, the cardinality of the fiber over zero equals the cardinality of -- the kernel. Direct from `kernel_equiv_fiber_zero`. -/ -+ - theorem kernel_card_eq_fiber_zero_card (φ : Isogeny W₁ W₂) - [Finite φ.kernel] : - Nat.card φ.kernel = Nat.card {P : W₁.Point // φ.toAddMonoidHom P = 0} := -@@ -253,7 +196,7 @@ theorem fiber_card_eq_kernel_card (φ : Isogeny W₁ W₂) - Nat.card {P : W₁.Point // φ.toAddMonoidHom P = Q} = Nat.card φ.kernel := - Nat.card_congr (fiberEquivKernel φ hP₀) - --/-- The kernel of the identity isogeny is trivial. -/ -+ - @[simp] theorem kernel_id : (Isogeny.id W₁).kernel = ⊥ := by - ext P - simp [mem_kernel_iff, id_toAddMonoidHom] -@@ -308,15 +251,7 @@ theorem fiber_card_eq_sepDegree_of_witness (φ : Isogeny W₁ W₂) - rw [← fiber_card_eq_kernel_card φ rfl (P₀ := P₀_wit)] - exact h_wit - --/-- **Hasse-bound shortcut**: if `|ker φ| = φ.sepDegree` (a finite-field -- fact that can be proved directly without going through the generic -- II.2.6(b) fiber-size theorem), then the fiber over `φ(0)` (i.e. the -- kernel) provides the fiber witness used by the historical witness-parametric -- Hasse-bound route. - -- Reduces T-II-2-009's "existential fiber-size = sepDegree" witness to the -- simpler `|ker| = sepDegree` fact, which is directly accessible for -- separable isogenies over finite fields via the V.1 chain. -/ - theorem fiber_witness_of_ker_card_eq_sepDegree (φ : Isogeny W₁ W₂) - [Finite φ.kernel] - (h_ker_sep : Nat.card φ.kernel = φ.sepDegree) : -@@ -327,13 +262,7 @@ theorem fiber_witness_of_ker_card_eq_sepDegree (φ : Isogeny W₁ W₂) - rw [fiber_card_eq_kernel_card φ (P₀ := 0) (Q := φ.toAddMonoidHom 0) rfl, - h_ker_sep] - --/-- **T-III-4-015 step 2 closer** (witness-parametric): given a witness that --the fiber over zero has cardinality `φ.sepDegree`, the kernel cardinality --equals `φ.sepDegree`. Direct from `kernel_card_eq_fiber_zero_card`. - --The witness `h_fiber_card_zero` is the SUBSTANTIVE content of Silverman --III.4.10/12 specialized to fiber over zero: for separable isogenies, every --fiber has cardinality = sepDegree. -/ - theorem kernel_card_eq_sepDegree_of_fiber_zero_witness (φ : Isogeny W₁ W₂) - [h_ker : Finite φ.kernel] - (h_fiber_card_zero : -@@ -341,9 +270,7 @@ theorem kernel_card_eq_sepDegree_of_fiber_zero_witness (φ : Isogeny W₁ W₂) - Nat.card φ.kernel = φ.sepDegree := by - rw [kernel_card_eq_fiber_zero_card φ, h_fiber_card_zero] - --/-- **T-III-4-015 witness form for separable isogenies**: If `φ` is -- separable and has a finite kernel, and at least one fiber has -- cardinality = `sepDegree`, then `#ker φ = deg φ`. -/ -+ - theorem card_kernel_eq_degree_of_separable_witness (φ : Isogeny W₁ W₂) - [h_ker : Finite φ.kernel] (hsep : φ.IsSeparable) - (hfin : @FiniteDimensional W₂.FunctionField W₁.FunctionField _ _ -@@ -385,16 +312,7 @@ theorem sepDegree_eq_card_emb (φ : Isogeny W₁ W₂) : - AlgebraicClosure W₁.FunctionField) := - rfl - --/-- **R2 reduction brick** (Silverman III.4.10c, embeddings half): for a --separable, finite-dimensional isogeny `φ`, if the **embedding count equals the --kernel count** — `φ.sepDegree = #ker φ`, i.e. --`#(K(E₁) →ₐ[φ*K(E₂)] Ω) = #ker φ` — then `#ker φ = deg φ`. - --This is the clean compositional consumer for the embeddings-classification --route: `#ker φ = sepDegree φ` (hypothesis) `= deg φ` (separability, via --`isSeparable_iff_sepDegree_eq_degree`). The substantive content is delegated --to the hypothesis `h_count`, which is exactly the embedding↔kernel bijection --`Emb ≃ ker φ`. -/ - theorem card_kernel_eq_degree_of_sepDegree_eq_card_kernel (φ : Isogeny W₁ W₂) - (hsep : φ.IsSeparable) - (hfin : @FiniteDimensional W₂.FunctionField W₁.FunctionField _ _ -@@ -491,9 +409,9 @@ theorem card_aut_eq_degree_of_isGalois (φ : Isogeny W₁ W₂) - (hgal : @IsGalois W₂.FunctionField _ W₁.FunctionField _ φ.toAlgebra) : - Nat.card (@AlgEquiv W₂.FunctionField W₁.FunctionField W₁.FunctionField _ _ _ - φ.toAlgebra φ.toAlgebra) = φ.degree := by -- letI := φ.toAlgebra -- haveI := hfin -- haveI := hgal -+ let := φ.toAlgebra -+ have := hfin -+ have := hgal - exact IsGalois.card_aut_eq_finrank W₂.FunctionField W₁.FunctionField - - /-- **T-III-4-015 step 4** (IsGalois from Separable + Normal): given the -@@ -510,7 +428,7 @@ theorem isGalois_of_separable_and_normal (φ : Isogeny W₁ W₂) - (h_normal : letI := φ.toAlgebra - Normal W₂.FunctionField W₁.FunctionField) : - @IsGalois W₂.FunctionField _ W₁.FunctionField _ φ.toAlgebra := by -- letI := φ.toAlgebra -+ let := φ.toAlgebra - exact isGalois_iff.mpr ⟨h_sep, h_normal⟩ - - /-- **T-III-4-015 step 4b** (IsGalois from Isogeny.IsSeparable + Normal): -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/OmegaCoeffViaFormalGroup.lean b/projects/HasseWeil/HasseWeil/Isogeny/OmegaCoeffViaFormalGroup.lean -index b4f3c844a3d84552f61642e618d4c4c2e3ea997f..ee9bf1a49bf89477daa167de9f0698966a7944f9 100644 -GIT binary patch -delta 6076 -zcmaJ_3v?9K89x7pfD9!Vfq;T=Av}_hT?h~L1ffMFCGrXq6h+KVcJJnV~qaRa|Lk=&EPeaL;?f429`E^~RjYaDxGP0r(Bd=1)Q$58kDx<436OCh$K%21hNRMJ= -z?Bz>goPBo()Lce-GE@@^@zpdL1UDVL1%3UP@tWY&c5L>yZ -zm639K4??!t`z5a>1gg-exP-ePNz(?UB%X^CR1;N1eE1RpA@G-@kxam!6u^lwaBAzevDtR^VR -zUksy0($J3E78q#DEJcHGRTrtMlH<<{^9Ekp&`4TaTVrzstT61FPV}+aPFgyz;#$7f -zL+|M~`|)5Rrp;6@iLdRN*0ipph0G%@b!)rusc|iTuRlvnw=;d%r~==%t}QMuj^qDm -z2JfJ@cueAV2f+|v2|ZvYsFp4-;kRzM@2y=dASD0-}$698%%*HdkL#VWxwcwh^H -zGTwy}HpPX5E!pRfPK?4tro=87*il782b+|bD!Pr7LVT`p1s-$a&YfhYcThN1yf8>| -z@F9HIgm;Fs&nHx|r>+?0JYT(R!1-LOoU9lnAX^!#8#L=Q)Vx$#ST0BlVa&1K4`(5H -z-~p$hz~eEDOtHb|voEDH-)a&!_!`gt9LuV0cEEXU_!Vh};}SuQ;+3&S(G><=pH~cO -zO7ScjV;h+fj}dNSk9SdpAOkeA*T+w&5jf%j%T<#C$FdlysT9~}Rdr)mqYi$IaRG#` -zUi9<8meCz4T~+lSlc2jjTt-FeDOt0h46^+nBqCX~gRbvTY06^%ocLk*_0P4&h2F1* -zlFnEpqpg#q>Cq@z;2E@$bLD8+Gm1zHXETX}BAxD=gsf>g9;zdSa6;4bmN4m=$%DZoLZyH(fk`6kjh+<5F$TFd{ -z$5|>!u+0+YUv9puse*KY>D)wY%2*0`iAQY4Xi5b>4>n?c6(Qam&B>VkF}rkANzWC8 -z8#qHCVT&>bVJ`rL|0SpzBYw)oC4Qk24o;7JG8kZ($0dvrx`EeQid7bTJa|xM -z>vgA9QdmyJ2znLcVFIbGtqrnW-t>s5n6CR3hg*tMQX|0%BSD3M8_^ijm)h4WZvsPk -z)te|dXw=KZXybeq^A{pnF|o{}Nx$OYjwnf_m^xO6y+p8Mpan$P(FZ25lMghrO$X;N -zi|wwA%NMw8XDNW4{YZtbfX?HeRwxAz%lHLqidyX<7AnoWJ^5w0iU~a_n%XJw -zj}mwc^0*MSDR(|@4oE9iR^f_9t8fNo_#O^{y^;5L0Y6G-@+0?*AHE5!#CW01CGcXH -zvtzOF4I%=qvsPQjGnF&t$6LX9-yL1SrW_dOv>j-JQcYBhZO&NqE(r>W2_4tos5Q4}Mjj`!27z0m4 -z+>bAW-wd*65@@hLoD5?})_E(hCRf+jlLnGJar5Tn8oPE1d|s8Rmk9o;^S?Dsg+=a$ -zsW5(6s3f(wUIf1#5~@kv?u+5+$e2mnop125p0V(^n%YnEv -z20iw_m%)tD@m4R1#sX@Id+F4jzZ{OjBo*eYX4BV5L1{ -zB^>YPrVFlw{WjE~5+7X&V=80q$P)>b;v|8SduRe-P}Q3n#WyT{!EMJ(yeb}Zo7cc> -zs10ulS9+oS_Knv-18RKa8mO!+w0h-Opi?*xau@`qhbYiEbMb}!%|#^MYMnV3;iVte -zi^XGn238df6~oW=bxWZ->6slnFt1AS`{{5zUKN`in}y-X^;7i(B5%pz9T^qrR8>;g -zMdS_545(yi+%zz#-AtEqf%4abo7qbtUQ0vaz)+XgG#_j+M< -zg}eNl@F2MF-UK_qez*@NxQF`SS+IBC2t({$x4`>it$kt>6x>@j!w7FL4#m2u{rB78 -zV!QTsxYUl{4sW`b-T_AkxzTUKsR3eBg-R{^8xKLV?LGu6-N9Qx8pPl0?Rk$tpMCHV -z__h1k_rW;h$VVT8mtEy?7y&h_LYyix=#oX#m&Wa1ZHJrOD|WzA?Pc81JRf-yRtL{h_CTBe?B2Ks?u``C;@s4xoJG(XN|r|bZrBo|4%tZO -zd8fibDys&SlfBp}B)V|w*1eI^(gVjSKgG$Kav}rWQ1^}nJkyBSQ{6V)Y-3ZgPDbT(mW5#RDUrcMh{t= -z!OY*0TUY!>H{g7ZwBSE6?1uf%-p9JS){wj{eDD@i%vDM@r_vR?5$nK=g2&;&rmI5; -zQ9Sj;Z9D7g?DQrWAM?bkk72{#saqYo!CQYz&yi*IF=QqkN6a05ufI&A?jN230Q(aM -z=DQdD5bg@9Z$8oFc1}~A4@LR37H>^sAkb_l_Ieow2j1LUXRhF(jgt<)L*WIu(k-jp -yaelL1tZoC2D656B?$&UMTvcAm+OQu++M`@}%f+X`Al}{RPv9K?am}+ZEb@O<2dy*! - -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/OrdTransport.lean b/projects/HasseWeil/HasseWeil/Isogeny/OrdTransport.lean -index 25e8c912a..3e6fa927e 100644 ---- a/projects/HasseWeil/HasseWeil/Isogeny/OrdTransport.lean -+++ b/projects/HasseWeil/HasseWeil/Isogeny/OrdTransport.lean -@@ -6,34 +6,25 @@ Authors: Chris Birkbeck - import HasseWeil.Foundation.EC.TranslateOrdInfty - - /-! --# General DVR order-transport along a field hom (Silverman II.2.5, the unramified case) -+# Unramified order transport along a field homomorphism - --This file isolates the *purely valuation-theoretic* core of the order-transport --`ord_P (φ g) = ord_Q g` for an injective field homomorphism `φ : K(C) → K(C)` and a pair of smooth --points `P` (source) and `Q` (target). It is the abstract DVR-transport step (Step 1 of the --divisor-pullback brief): once one knows -+Let `φ : E → K(C)` be a field homomorphism and `P` a smooth point of `C`. -+Suppose the comap of the point valuation at `P` is equivalent to a surjective -+integer-valued valuation `v_Q` on `E`. If `ord_P (φ t) = 1` for one element `t`, -+the comap is also surjective, and the equivalent normalized valuations are equal. - --* **(same place)** the comap valuation `(pointValuation Q).comap φ` is `Valuation.IsEquiv` to -- `pointValuation P` — i.e. `φ` carries the valuation ring of `Q` onto that of `P`; and --* **(unramified, `e = 1`)** `ord_P (φ t) = 1` for a *single* uniformizer `t` at `Q`, -+The equivalence expresses equality of places, or valuation rings; the order-one -+condition fixes the ramification index to `1`. Together these give -+`ord_P (φ g) = ord_Q g` for every `g`. - --the value-precise identity `ord_P (φ g) = ord_Q g` holds for **all** `g` (no ramification factor). --The two inputs are genuinely independent: the first is "same place / same valuation ring", the --second is the normalization `e = 1` (the ramification index), which for `[ℓ]` is the geometric --content of separability. -- --The main export is `comap_pointValuation_eq_of_isEquiv_of_ord_eq_one`, plus the small valuation glue --lemmas it rests on (`Fintype`-free; the `[Fintype K]`-scoped versions they were derived from lived --in `Hasse/L6Witnesses.lean`, which no longer exists, so these are now the only copies). -- --Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.5–2.6, III.4.10c. -+Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.5–2.6 and III.4.10c. - -/ - - open WeierstrassCurve HasseWeil.Curves - - namespace HasseWeil - --variable {F : Type*} [Field F] [DecidableEq F] -+variable {F : Type*} [Field F] - - /-- A `ℤᵐ⁰`-valued valuation on a field is surjective as soon as some element takes the value - `exp (-1)`: the negative powers of that element realise every `exp (-n)`, and `0 ↦ 0`. Shared core -@@ -143,8 +134,7 @@ Let `φ : E → K(C)` be a ring hom from a field `E`, `P` a smooth point of `C`, - then `(pointValuation P).comap φ = v_Q` *as valuations* (not merely equivalent). Reading off `ord`, - this yields `ord_P (φ g) = ord_Q g` for all `g` with no ramification factor. - --This packages Step 1 of the divisor-pullback brief: the entire affine/infinity order-transport for --a separable isogeny reduces to discharging the two displayed inputs. -/ -+The two hypotheses separate equality of valuation rings from the order normalization. -/ - theorem comap_pointValuation_eq_of_isEquiv_of_ord_eq_one - {E : Type*} [Field E] (φ : E →+* C.FunctionField) (P : C.SmoothPoint) - (v_Q : _root_.Valuation E (WithZero (Multiplicative ℤ))) (hv_Q : Function.Surjective v_Q) -diff --git a/projects/HasseWeil/HasseWeil/Isogeny/SeparableWitnessReductions.lean b/projects/HasseWeil/HasseWeil/Isogeny/SeparableWitnessReductions.lean -index a8ca2af446a345ac435d9f954c6af5b621ff0cba..7f04d3fd4cc31b5fb8d41b6bcd3ca5f5abba841c 100644 -GIT binary patch -delta 2578 -zcmb_e&u<$=6qb`BwG&W5B_X0x`brgIBYT^KHX;!@K~jZCEszKVRp^d)$Ig)58E0lU -zjg63VsG|1Da)3jnUbw&oVZSbwl^dMkb3fZcK7}G-uHcP -zzxlQB;BMjDy+Zp9xkVMH!eeFFU`nt6G;cAW!Ur9zkC_+oEgm&N)2EOxg&6=;Nb3Ou)pKlD6ZPyu?N}(xy2M70uAb{swnr`-~|%%FcY6bjSC(z -z{9%D#CYXXL?o}F+iwGh`g$`)Mr2wy2HSn+zU?KS<48<@}6Kb)*@};QQfWQJ4G7&js -zDbk>rjuda(`w+=)^SLY<0cfPbZG)nV6vUeOz=iGm8Vw}Z#G`>1XVqbT^FjuvN0rY7 -z4G=^JR#FJL`Bw%Z+bXnoEK)SzVd~TcOJ{HewO$^Sl-+oxQ&7<|)5Srk# -zx?&8|m128dtSkUGtD-0;IVh&ZC*r4y(&aa=-*7E=-qANel% -z@`Zb=s|aA7$&lfYJfP{A3`aypzNV=-j3XR<+J2566xm|mxBLOipE=?t17{}M4w%r? -zH=u6eMH<4&(7yIR7*5>%JGWM#xWD_+E6^&zJlLxuo_?~w3oD=E -zp=%PJNPcizE-9|?00j~bA)00^IEPX)H12eMzxYF;u$p{zshGSxc6OpnsMc|4dg3UV -z!+Pv%FnMS6T%pt%8Xp>Huja;JIg+U$)o_h(r|?1}4uUH6HUOWmGl#4iPUjh#7j%_* -z6g3Af_PK$LPo~b2(<)#tL&ay29jOwmSfXaAwnSLxyBso@f-Eu`k5R9KX+a01e6&9&{c#KcBuLLmt7+H<`zM+`>63~yx;g4;2}0P025KG~M(_<{sr}^GlWmTk?R8x* -zQ&Jbhu1{}AOlaft#)#M^+EccHj4+Ru05A0nFm>ZfUCFp{$Rd-o%fp?*!q-nd;TB`7 -z_W&a0*5ku%(R{R468>HP9BEE!9U7(&``z4dB#0IY*$;B -zv1k9u!?n>7>@9Px%(SjJQKF{KPj&tX<4Qw^J9^sm7eSMTeHU -zi=QT6z~k=`hMU*dTx;gZgf~8G|J89tn9qR2-$D3R-$V1&;BKp?0POgs!S+dFIHs?SMns6v} -zn-IvP#C8lM&Z(d3riKD?i9=1zqYuZCAx)scx}EA~R(~MJ -zRq71upnQ)Y*MPH4q>p*Y0N3@<4ud49ouZzDp~0Z3a3!;88(CcH#v&0^)1^dn5}6cg -zhLN>R)9xeRWo9pRQkvC7Iyz#rV{L6in`ZO2+3K|;HaFJRntPfTn?1CN-zj#^GJ;uSd!l7J%o{`Slhk^t -zoU-^T@H=mLSngc>^!4-4BSuzhBAVns*tBMrrE9OkE&RDQ9Quppco>uzFD_XHkJjZU_&7a -zByeX`u35P+%%8fxUha-R8j_Xwdmz8v`62MV`gy*?Xb|YSm3%y%FPGDIK^$m+$)c(S -zCWcMwiN|k&+8TTy3l|ChoD#Y=jUz<&Pz5`F8y7OU&n=B$h|W0g)5`ZJ+xY|R=mgSmuR>Hv7DgJ&V3l08_C(3l5iX)6P8Oj& -zG1veN{HR$aH``S(BE+%uxX?%!KXH$Zbj&ZiMTy2=*KgvBcU8+%+m|Wl5OH-Z)bR8A -z41R9cUi8$>@~vmWVa`uakPp6C163+T$wN!2&J3;Fq<5?n?+?HX>HO>@-1vWYWYr^B -znGv~o_vd9Ra<_R;sheVy;JuSF>@uFCxo*4ajj;~*j(oEuoiWc|(t~}EiVp{XNcQvc -z@F+w6`oIUpIKOC0v(={-< -zD)G8AljZmRylu2CoqVP`v~a{|J@ge~z|WqWByT_a!YDw=v*-R^^7S>6zxnu$(l1KU -zEf@Y(9NvwWR+dit(wxj?_Q_BG0sQj6_hTv?lE3=Azrx>94!gp_84G)$UBt%0)G2B} -zxugq+AQ}3>3%Tjmt|oey-!%@N4+@K4cyOX0p9Ir@$Bh-LviMuijQ7Xf2q#10Z?*8J -zpe=ne4TiSW!EOHcZ-T#q_(eS|^`D#te}qXRHi>)qzymYIdo!RcXk0-XQ{8LI$lXiz -z_G_JQuJ~aT>cz{AP${Y#VUU08_FDeR+J*f5+T~*FH(;R;G5Bc2mLqCf;pIX})c50L -zB*8|3(>HCqIJEPtj+;p}V>#=T6istAB64d@VVpdM?!_0nc|~$(CTmMgNdMKrnqnrYW>5H!@I-4Id1>O&9EKH -zn@MA1S7MFWGzhc&El;zeSW4;Pef8cr8Q3USe;VUKn -zhCR?zRHGswJ+u!h%L=;I`Dn$0qIaciy=XoGr-y0OS*zdqOE_LE7#W+ynh&7Dzw|rU -zQ7W#ShD+kE_hCyB<1o$LLolmY%;8ID>)^-mo^nw%)a8gn7vTnf!aw1;kbmGJRENdW -N7opyde+tJ#{{ctriJ1TZ - -diff --git a/projects/HasseWeil/HasseWeil/Pic0/ClassGroupNorm.lean b/projects/HasseWeil/HasseWeil/Pic0/ClassGroupNorm.lean -index a3e70337f..dec8deca0 100644 ---- a/projects/HasseWeil/HasseWeil/Pic0/ClassGroupNorm.lean -+++ b/projects/HasseWeil/HasseWeil/Pic0/ClassGroupNorm.lean -@@ -4,7 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Chris Birkbeck - -/ - import Mathlib.LinearAlgebra.FreeModule.Norm --import Mathlib.NumberTheory.RamificationInertia.Basic -+import Mathlib.RingTheory.RamificationInertia.Basic -+import Mathlib.NumberTheory.RamificationInertia.Inertia -+import Mathlib.NumberTheory.RamificationInertia.Ramification -+import Mathlib.RingTheory.Ideal.Norm.AbsNorm -+import Mathlib.RingTheory.SimpleModule.Basic - import Mathlib.RingTheory.ClassGroup.Basic - import Mathlib.RingTheory.Ideal.Norm.RelNorm - import Mathlib.RingTheory.Localization.AtPrime.Extension -@@ -33,8 +37,8 @@ open scoped nonZeroDivisors - namespace HasseWeil - - variable {R S : Type*} --variable [CommRing R] [IsDomain R] [IsIntegrallyClosed R] [IsDedekindDomain R] --variable [CommRing S] [IsDomain S] [IsIntegrallyClosed S] [IsDedekindDomain S] -+variable [CommRing R] [IsDedekindDomain R] -+variable [CommRing S] [IsDedekindDomain S] - variable [Algebra R S] [Module.Finite R S] [Module.IsTorsionFree R S] - - /-- The relative norm of an integral ideal, packaged as a homomorphism of `nonZeroDivisors` -@@ -74,14 +78,14 @@ theorem mk0CompRelNorm0_eq_of_mk0_eq {I J : (Ideal S)⁰} - -- Provide the (deliberately non-instance) lift algebra on the fraction fields, so that - -- `Algebra.intNorm_ne_zero` (which assumes `FiniteDimensional (FractionRing R) (FractionRing S)`) - -- is available. -- letI : Algebra (FractionRing R) (FractionRing S) := -+ let : Algebra (FractionRing R) (FractionRing S) := - FractionRing.liftAlgebra R (FractionRing S) -- haveI : IsScalarTower R (FractionRing R) (FractionRing S) := -+ have : IsScalarTower R (FractionRing R) (FractionRing S) := - FractionRing.isScalarTower_liftAlgebra R (FractionRing S) -- haveI : IsLocalization (Algebra.algebraMapSubmonoid S R⁰) (FractionRing S) := -+ have : IsLocalization (Algebra.algebraMapSubmonoid S R⁰) (FractionRing S) := - IsIntegralClosure.isLocalization R (FractionRing R) (FractionRing S) S -- haveI : IsScalarTower R S (FractionRing S) := IsScalarTower.of_algebraMap_eq fun _ ↦ rfl -- haveI : FiniteDimensional (FractionRing R) (FractionRing S) := -+ have : IsScalarTower R S (FractionRing S) := IsScalarTower.of_algebraMap_eq fun _ ↦ rfl -+ have : FiniteDimensional (FractionRing R) (FractionRing S) := - Module.Finite.of_isLocalization R S R⁰ - rw [ClassGroup.mk0_eq_mk0_iff] at h - obtain ⟨x, y, hx, hy, hxy⟩ := h -@@ -177,30 +181,21 @@ transports `e`, `f` across the localisation, leaving only the relative-norm/loca - compatibility — see the residual note after `Ideal.relNorm_eq_under_of_inertiaDeg_one`.) -/ - - -- The `S/R` fraction-field tower + residue-degree `finrank` bookkeeping need elaboration room. --/-- **`relNorm 𝔪 = p ^ inertiaDeg' p 𝔪` over a local base extension, unconditionally** (no --`PerfectField`). For a **local** Dedekind domain `S` (a DVR) module-finite over a Dedekind domain --`R`, with `𝔪 = IsLocalRing.maximalIdeal S` lying over a maximal `p ≠ ⊥` of `R`, the relative norm --of `𝔪` is `p ^ inertiaDeg' p 𝔪`. -- --Proof (see the section note): `p · S = 𝔪^e` (unique prime, via --`Ideal.map_algebraMap_eq_finset_prod_pow` + `IsLocalRing.primesOver_eq`); applying `relNorm` and --`Ideal.relNorm_algebraMap` gives `(relNorm 𝔪)^e = p^{e·f}` using --`Ideal.ramificationIdx_mul_inertiaDeg_of_isLocalRing` (`e·f = [Frac S : Frac R]`); writing --`relNorm 𝔪 = p^s` (`Ideal.exists_relNorm_eq_pow_of_isPrime`) and cancelling the prime power --(`pow_injective_of_not_isUnit`) pins `s = f`. **No separability / Galois / `PerfectField`.** -/ -+ -+ - theorem Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing - {R S : Type*} -- [CommRing R] [IsDomain R] [IsIntegrallyClosed R] [IsDedekindDomain R] -- [CommRing S] [IsDomain S] [IsIntegrallyClosed S] [IsDedekindDomain S] [IsLocalRing S] -+ [CommRing R] [IsDedekindDomain R] -+ [CommRing S] [IsDedekindDomain S] [IsLocalRing S] - [Algebra R S] [Module.Finite R S] [Module.IsTorsionFree R S] - {p : Ideal R} [p.IsMaximal] (hp0 : p ≠ ⊥) - [(IsLocalRing.maximalIdeal S).LiesOver p] : - Ideal.relNorm R (IsLocalRing.maximalIdeal S) = -- p ^ p.inertiaDeg' (IsLocalRing.maximalIdeal S) := by -+ p ^ (IsLocalRing.maximalIdeal S).inertiaDeg R := by - set m := IsLocalRing.maximalIdeal S with hm - set e := Ideal.ramificationIdx' p m with he_def -- set f := p.inertiaDeg' m with hf_def -- haveI : m.IsMaximal := IsLocalRing.maximalIdeal.isMaximal S -+ set f := m.inertiaDeg R with hf_def -+ have : m.IsMaximal := IsLocalRing.maximalIdeal.isMaximal S - have he0 : e ≠ 0 := Ideal.IsDedekindDomain.ramificationIdx'_ne_zero_of_liesOver m hp0 - -- `p · S = 𝔪^e` (the *unique* prime over `p`, so the factorisation is a single term). - have hmap : Ideal.map (algebraMap R S) p = m ^ e := by -@@ -217,15 +212,23 @@ theorem Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing - (by rw [← IsLocalRing.primesOver_eq S hp0, ← Set.mem_toFinset]; exact hb)) hne - · intro h - exact absurd (by rw [Set.mem_toFinset, IsLocalRing.primesOver_eq S hp0]; rfl) h -- -- `e · f = [Frac S : Frac R]` (the fundamental identity; *no* separability hypothesis). -- letI : Algebra (FractionRing R) (FractionRing S) := FractionRing.liftAlgebra R _ -- haveI : IsScalarTower R (FractionRing R) (FractionRing S) := -- FractionRing.isScalarTower_liftAlgebra R _ -- haveI : IsScalarTower R S (FractionRing S) := IsScalarTower.of_algebraMap_eq fun _ ↦ rfl -- -- `relNorm_algebraMap`'s exponent is `finrank R S`, so transport `e·f` down the fraction fields. -- have hef : e * f = Module.finrank R S := -- (Ideal.ramificationIdx_mul_inertiaDeg_of_isLocalRing S (FractionRing R) (FractionRing S) -- hp0).trans (IsFractionRing.finrank_eq R (FractionRing R) S (FractionRing S)) -+ have hef : e * f = Module.finrank R S := by -+ classical -+ let : Unique (p.primesOver S) := -+ { default := ⟨m, by -+ rw [IsLocalRing.primesOver_eq S hp0] -+ exact Set.mem_singleton m⟩ -+ uniq q := Subtype.ext (by -+ have hq : (q : Ideal S) ∈ ({m} : Set (Ideal S)) := by -+ simpa only [IsLocalRing.primesOver_eq S hp0] using q.2 -+ exact Set.mem_singleton_iff.mp hq) } -+ have h := Ideal.sum_ramification_inertia_eq_finrank p S -+ have hd : ((default : p.primesOver S) : Ideal S) = m := by -+ have hq : ((default : p.primesOver S) : Ideal S) ∈ ({m} : Set (Ideal S)) := by -+ simpa only [IsLocalRing.primesOver_eq S hp0] using (default : p.primesOver S).2 -+ exact Set.mem_singleton_iff.mp hq -+ simpa only [Fintype.sum_unique, hd, -+ ← Ideal.ramificationIdx'_eq_ramificationIdx p m hp0] using h - -- `(relNorm 𝔪)^e = relNorm(𝔪^e) = relNorm(p · S) = p^{[Frac S:Frac R]} = p^{e·f}`. - have h3 : (Ideal.relNorm R m) ^ e = p ^ (e * f) := by - rw [← map_pow, ← hmap, Ideal.relNorm_algebraMap, hef] -@@ -233,7 +236,7 @@ theorem Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing - obtain ⟨s, hs⟩ := Ideal.exists_relNorm_eq_pow_of_isPrime m p - rw [hs, ← pow_mul] at h3 - have hpr : Prime p := (Ideal.prime_iff_isPrime hp0).mpr inferInstance -- have hse : s * e = e * f := pow_injective_of_not_isUnit hpr.not_unit hpr.ne_zero h3 -+ have hse : s * e = e * f := pow_injective_of_not_isUnit hpr.not_isUnit hpr.ne_zero h3 - have hsf : s = f := - Nat.eq_of_mul_eq_mul_right (Nat.pos_of_ne_zero he0) (by rw [hse]; ring) - rw [hs, hsf] -@@ -245,16 +248,15 @@ collapses (`pow_one`) and `p = 𝔪.under R`, giving `relNorm R 𝔪 = 𝔪.unde - S) 𝔪`) with **no** separability hypothesis. -/ - theorem Ideal.relNorm_maximalIdeal_eq_under_of_inertiaDeg_one_of_isLocalRing - {R S : Type*} -- [CommRing R] [IsDomain R] [IsIntegrallyClosed R] [IsDedekindDomain R] -- [CommRing S] [IsDomain S] [IsIntegrallyClosed S] [IsDedekindDomain S] [IsLocalRing S] -+ [CommRing R] [IsDedekindDomain R] -+ [CommRing S] [IsDedekindDomain S] [IsLocalRing S] - [Algebra R S] [Module.Finite R S] [Module.IsTorsionFree R S] - (hp0 : (IsLocalRing.maximalIdeal S).under R ≠ ⊥) -- (hf : Ideal.inertiaDeg' ((IsLocalRing.maximalIdeal S).under R) -- (IsLocalRing.maximalIdeal S) = 1) : -+ (hf : (IsLocalRing.maximalIdeal S).inertiaDeg R = 1) : - Ideal.relNorm R (IsLocalRing.maximalIdeal S) = (IsLocalRing.maximalIdeal S).under R := by -- haveI : ((IsLocalRing.maximalIdeal S).under R).IsMaximal := -+ have : ((IsLocalRing.maximalIdeal S).under R).IsMaximal := - Ideal.IsMaximal.under R (IsLocalRing.maximalIdeal S) -- haveI : (IsLocalRing.maximalIdeal S).LiesOver ((IsLocalRing.maximalIdeal S).under R) := -+ have : (IsLocalRing.maximalIdeal S).LiesOver ((IsLocalRing.maximalIdeal S).under R) := - Ideal.over_under _ - rw [Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing hp0, hf, pow_one] - -@@ -271,19 +273,10 @@ The key observation is that `Algebra.intNorm A B x` is defined as the restrictio - `B`, not on the integral model `B`. Hence two integral models `B`, `B'` of the same field extension - have the same `intNorm`, and therefore the same `relNorm` on corresponding ideals. -/ - --/-- **`intNorm` depends only on the common fraction field.** If `B` and `B'` are integrally closed --domains, both integral over `A` and both having `L` as a common fraction field over `K = Frac A` --(with `B → B'` compatible), then `intNorm A B x = intNorm A B' (algebraMap B B' x)`. - --This is `Algebra.algebraMap_intNorm` (`algebraMap A K (intNorm A B x) = norm K (algebraMap B L x)`) --applied to both `B` and `B'` with the **same** ambient field `L`: the two field norms coincide --because `algebraMap B L = algebraMap B' L ∘ algebraMap B B'` (the scalar tower `B → B' → L`). --No module-finiteness of `B'` over `A` is required (only finiteness at the fraction-field level --`[FiniteDimensional K L]`), which is why this survives the passage to a non-finite localisation. -/ - theorem intNorm_eq_intNorm_of_common_fractionField - {A K L B B' : Type*} -- [CommRing A] [IsDomain A] [IsIntegrallyClosed A] -- [Field K] [Algebra A K] [IsFractionRing A K] -+ [CommRing A] [IsDomain A] [IsIntegrallyClosed A] [Field K] [Algebra A K] [IsFractionRing A K] - [Field L] [Algebra K L] [Algebra A L] [IsScalarTower A K L] [FiniteDimensional K L] - [CommRing B] [IsDomain B] [IsIntegrallyClosed B] [Algebra A B] [Algebra.IsIntegral A B] - [Module.IsTorsionFree A B] [Algebra B L] [IsScalarTower A B L] [IsIntegralClosure B A L] -@@ -297,32 +290,17 @@ theorem intNorm_eq_intNorm_of_common_fractionField - congr 1 - rw [← IsScalarTower.algebraMap_apply B B' L] - --/-- **`relNorm` is unchanged under top-localisation of a principal prime.** If `B` is a Dedekind --**PID** (e.g. the semilocal localisation `Sₚ`), `Q` a principal ideal of `B`, and `B'` an --integrally closed domain sharing the fraction field `L = Frac B`, then --`relNorm A Q = relNorm A (Q.map (B → B'))`. -- --The proof writes `Q = span{π}` (principal), so `relNorm A Q = span{intNorm A B π}` and --`relNorm A (Q.map) = span{intNorm A B' (algebraMap π)}` (`relNorm_singleton`, `Ideal.map_span`), --and the two generators agree by `intNorm_eq_intNorm_of_common_fractionField`. -- --**Caveat.** `Ideal.relNorm A B'` is only well-typed under `[Module.Finite A B']` (mathlib's --`relNorm`/`spanNorm` carry this in their definition). This is exactly why this bridge does **not** --discharge the general-base residual: the intended `B' = Localization.AtPrime Q` (a DVR isolating one --of several primes over `p`) is **not** module-finite over `A = Rₚ` when several primes lie over `p`, --so the right-hand side is ill-typed there. It applies when finiteness is preserved — e.g. when `Q` --is the *unique* prime over `p` (`finite_of_primesOver_eq_singleton`), which is the already-handled --local case `Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing`. -/ -+ - theorem relNorm_eq_relNorm_localization - {A K L B B' : Type*} -- [CommRing A] [IsDomain A] [IsIntegrallyClosed A] [IsDedekindDomain A] -+ [CommRing A] [IsDedekindDomain A] - [Field K] [Algebra A K] [IsFractionRing A K] - [Field L] [Algebra K L] [Algebra A L] [IsScalarTower A K L] [FiniteDimensional K L] -- [CommRing B] [IsDomain B] [IsIntegrallyClosed B] [IsDedekindDomain B] -+ [CommRing B] [IsDedekindDomain B] - [Algebra A B] [Algebra.IsIntegral A B] [Module.Finite A B] - [Module.IsTorsionFree A B] [Algebra B L] [IsScalarTower A B L] [IsIntegralClosure B A L] - [IsPrincipalIdealRing B] -- [CommRing B'] [IsDomain B'] [IsIntegrallyClosed B'] [IsDedekindDomain B'] -+ [CommRing B'] [IsDedekindDomain B'] - [Algebra A B'] [Algebra.IsIntegral A B'] [Module.Finite A B'] [Module.IsTorsionFree A B'] - [Algebra B' L] [IsScalarTower A B' L] [IsIntegralClosure B' A L] - [Algebra B B'] [IsScalarTower A B B'] [IsScalarTower B B' L] -@@ -351,8 +329,7 @@ This reduces the `PerfectField` gate to the **single** residual stated in - hypothesis `hlocal` — the per-prime relative norm over a DVR base (see the residual note after - `Ideal.relNorm_eq_under_of_inertiaDeg_one`). -/ - --omit [IsDomain R] [IsIntegrallyClosed R] [IsDedekindDomain R] [IsDomain S] -- [IsIntegrallyClosed S] [IsDedekindDomain S] [Module.IsTorsionFree R S] in -+omit [IsDedekindDomain R] [IsDedekindDomain S] [Module.IsTorsionFree R S] in - /-- **The extension of `𝔭` to a localisation away from `𝔭.under` is `⊤`.** If the maximal prime - `q` of `R` differs from `p = P.under R`, then `p ⊄ q`, so an element `a ∈ p ⊆ P` lands outside `q`, - hence becomes a unit in `Sₚ = Localization (algebraMapSubmonoid S q.primeCompl)`; since -@@ -361,7 +338,7 @@ of `relNorm_eq_under_of_localized`.) -/ - theorem map_eq_top_of_under_ne (P : Ideal S) (q : Ideal R) [hq : q.IsMaximal] [P.IsMaximal] - (hne : P.under R ≠ q) : - P.map (algebraMap S (Localization (Algebra.algebraMapSubmonoid S q.primeCompl))) = ⊤ := by -- haveI : (P.under R).IsMaximal := Ideal.IsMaximal.under R P -+ have : (P.under R).IsMaximal := Ideal.IsMaximal.under R P - obtain ⟨a, hap, haq⟩ : ∃ a, a ∈ P.under R ∧ a ∉ q := by - by_contra h; push Not at h - exact hne (((Ideal.IsMaximal.under R P).eq_of_le hq.ne_top h)) -@@ -374,7 +351,7 @@ theorem map_eq_top_of_under_ne (P : Ideal S) (q : Ideal R) [hq : q.IsMaximal] [P - exact (P.map _).eq_top_of_isUnit_mem (Ideal.mem_map_of_mem _ haP) hunit ▸ Submodule.mem_top - - -- The semilocal `Sₚ` Dedekind/finite/torsion-free instance bundle over the DVR `Rₚ` pushes instance ---- synthesis (e.g. `IsDomain Sₚ`) past the default budget at statement elaboration. -+ - /-- **The relative norm localises (top + bottom) at a maximal prime `q` of `R`.** Pushing - `relNorm R P` along `R → Rₚ := Localization.AtPrime q` equals the relative norm over `Rₚ` of the - extension of `P` to the semilocal `Sₚ = Localization (algebraMapSubmonoid S q.primeCompl)`. -@@ -417,8 +394,8 @@ theorem relNorm_eq_under_of_localized (P : Ideal S) [P.IsMaximal] (hP : P ≠ - (P.map (algebraMap S (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)))) - = IsLocalRing.maximalIdeal (Localization.AtPrime (P.under R))) : - Ideal.relNorm R P = P.under R := by -- haveI : (P.under R).IsMaximal := Ideal.IsMaximal.under R P -- haveI hpne : NeZero (P.under R) := ⟨Ideal.under_ne_bot R hP⟩ -+ have : (P.under R).IsMaximal := Ideal.IsMaximal.under R P -+ have hpne : NeZero (P.under R) := ⟨Ideal.under_ne_bot R hP⟩ - have hnotfield : ¬ IsField R := - Ring.not_isField_of_ne_of_ne (Ideal.under_ne_bot R hP) (Ideal.IsMaximal.ne_top inferInstance) - refine Ideal.eq_of_localization_maximal (fun q hq ↦ ?_) -@@ -426,39 +403,15 @@ theorem relNorm_eq_under_of_localized (P : Ideal S) [P.IsMaximal] (hP : P ≠ - · subst hqp - rw [relNorm_map_localization P (P.under R), hlocal, - Localization.AtPrime.map_eq_maximalIdeal] -- · haveI : NeZero q := ⟨Ring.ne_bot_of_isMaximal_of_not_isField hq hnotfield⟩ -+ · have : NeZero q := ⟨Ring.ne_bot_of_isMaximal_of_not_isField hq hnotfield⟩ - rw [relNorm_map_localization P q, map_eq_top_of_under_ne P q hqp, Ideal.relNorm_top, - IsLocalization.AtPrime.map_eq_top_of_not_le _ (fun hle ↦ hqp - ((Ideal.IsMaximal.under R P).eq_of_le hq.ne_top hle))] - --/-! #### The per-prime relative norm over a DVR base — the `PerfectField`-free residual, **CLOSED** -- --The single remaining input of `relNorm_eq_under_of_localized` — the per-prime relative norm --`relNorm Rₚ 𝔮 = maximalIdeal Rₚ` over a **DVR** base `Rₚ` at residue degree one — is discharged --here, --**without `PerfectField`**, via the **module-length** route (no residue *field* structure on the --base, --so no `Field (Rₚ ⧸ m)` instance diamond). -- --The engine is the `Rₚ`-module-length identity over a **PID** base (`Rₚ` is a DVR, hence a PID): --for a nonzero principal `Q = (π)` of a free-finite `Rₚ`-algebra `Sₚ`, -- -- `length_{Rₚ}(Sₚ ⧸ Q) = length_{Rₚ}(Rₚ ⧸ relNorm Rₚ Q)` (`relNorm_length_eq_span`), -- --proved by Smith normal form (`Ideal.quotientEquivPiSpan` is `Rₚ`-linear) + additivity of the order --of --vanishing (`Ring.ord_mul`, `Ideal.relNorm_singleton`, `Algebra.intNorm_eq_norm`, --`associated_norm_prod_smith`). When `f = inertiaDeg' = 1`, `Sₚ ⧸ Q` is a **simple** `Rₚ`-module --(`isSimpleModule_quot_of_inertiaDeg_one`: the residue algebra map `Rₚ → Sₚ ⧸ Q` is onto, so --`Sₚ ⧸ Q ≃ₗ[Rₚ] Rₚ ⧸ m`), hence `length = 1`; the identity then forces `Rₚ ⧸ relNorm Rₚ Q` to be --simple, --i.e. `relNorm Rₚ Q` maximal, i.e. `= m` (`IsLocalRing.eq_maximalIdeal`). **No Galois, no --`PerfectField`.** -/ - - /-- **Additivity of the order of vanishing over a finite product** (`Ring.ord_mul`, iterated). For - nonzero `cᵢ` in a commutative domain, `ord (∏ cᵢ) = ∑ ord cᵢ`. -/ --theorem Ring.ord_finset_prod {A : Type*} [CommRing A] [IsDomain A] -- {ι : Type*} (s : Finset ι) (c : ι → A) (hc : ∀ i ∈ s, c i ≠ 0) : -+theorem Ring.ord_finset_prod {A : Type*} [CommRing A] [IsDomain A] {ι : Type*} (s : Finset ι) (c : ι → A) (hc : ∀ i ∈ s, c i ≠ 0) : - Ring.ord A (∏ i ∈ s, c i) = ∑ i ∈ s, Ring.ord A (c i) := by - classical - induction s using Finset.induction with -@@ -469,18 +422,11 @@ theorem Ring.ord_finset_prod {A : Type*} [CommRing A] [IsDomain A] - rw [mem_nonZeroDivisors_iff_ne_zero] - exact Finset.prod_ne_zero_iff.mpr (fun i hi ↦ hc i (Finset.mem_insert_of_mem hi)) - --/-- **Norm–length identity over a PID base.** For a free-finite algebra `Sₚ` over a PID `Rₚ` --(integrally closed domains), and a nonzero element `π`, the `Rₚ`-module length of `Sₚ ⧸ (π)` equals --the `Rₚ`-module length of `Rₚ ⧸ relNorm Rₚ (π)`. - --Proof: `relNorm Rₚ (π) = (Algebra.norm Rₚ π)` (`relNorm_singleton`, `intNorm_eq_norm`), whose order --of vanishing is `∑ᵢ length(Rₚ ⧸ (cᵢ))` for the Smith coefficients `cᵢ` --(`associated_norm_prod_smith`, `Ring.ord_finset_prod`, `Ring.ord = length(·⧸·)`); the same sum is --`length(Sₚ ⧸ (π))` by the `Rₚ`-linear `Ideal.quotientEquivPiSpan` + `length_pi_of_fintype`. -/ - theorem relNorm_length_eq_span - {Rp Sp : Type*} - [CommRing Rp] [IsDomain Rp] [IsPrincipalIdealRing Rp] [IsIntegrallyClosed Rp] -- [CommRing Sp] [IsDomain Sp] [IsIntegrallyClosed Sp] [IsDedekindDomain Sp] -+ [CommRing Sp] [IsDedekindDomain Sp] - [Algebra Rp Sp] [Module.Finite Rp Sp] [Module.IsTorsionFree Rp Sp] - (π : Sp) (hπ0 : π ≠ 0) : - Module.length Rp (Rp ⧸ Ideal.relNorm Rp (Ideal.span {π})) = -@@ -510,30 +456,23 @@ theorem relNorm_length_eq_span - -- The explicit residue-field algebra structure (built on the `Ideal.Quotient.field`-derived - -- semiring - -- via `algebraQuotientOfLEComap`) keeps the surjectivity/`finrank` bookkeeping in elaboration ---- budget -+ - -- *without* the `algebraOfLiesOver` instance-diamond (which carries free metavariables). --/-- **`Sₚ ⧸ Q` is a simple `Rₚ`-module at residue degree one** (the diamond-free `f = 1` input). For --a maximal ideal `Q` of `Sₚ` lying over a maximal `m` of `Rₚ` with `inertiaDeg' m Q = 1`, the residue --algebra map `Rₚ → Sₚ ⧸ Q` is **surjective** with kernel `m` (the residue extension is trivial), so --`Sₚ ⧸ Q ≃ₗ[Rₚ] Rₚ ⧸ m`, a simple `Rₚ`-module. -- --Diamond-free: the residue `Field (Rₚ ⧸ m)` and the residue algebra `Algebra (Rₚ ⧸ m) (Sₚ ⧸ Q)` are --introduced together by `algebraQuotientOfLEComap` on the **same** field-derived semiring, so the --`FiniteDimensional`/`finrank` synthesis never disagrees with `inertiaDeg'`'s --`Module (Rₚ ⧸ m) (Sₚ ⧸ Q)`. -/ -+ -+ - theorem isSimpleModule_quot_of_inertiaDeg_one - {Rp Sp : Type*} [CommRing Rp] [CommRing Sp] [Algebra Rp Sp] - (Q : Ideal Sp) [hQ : Q.IsMaximal] (m : Ideal Rp) [hm : m.IsMaximal] -- [hlo : Q.LiesOver m] (hf : Ideal.inertiaDeg' m Q = 1) : -+ [hlo : Q.LiesOver m] (hf : Q.inertiaDeg Rp = 1) : - IsSimpleModule Rp (Sp ⧸ Q) := by -- letI : Field (Rp ⧸ m) := Ideal.Quotient.field m -- letI alg : Algebra (Rp ⧸ m) (Sp ⧸ Q) := -+ let : Field (Rp ⧸ m) := Ideal.Quotient.field m -+ let alg : Algebra (Rp ⧸ m) (Sp ⧸ Q) := - Ideal.Quotient.algebraQuotientOfLEComap (le_of_eq (Q.over_def m)) -- haveI hst : IsScalarTower Rp (Rp ⧸ m) (Sp ⧸ Q) := IsScalarTower.of_algebraMap_eq' rfl -+ have hst : IsScalarTower Rp (Rp ⧸ m) (Sp ⧸ Q) := IsScalarTower.of_algebraMap_eq' rfl - have hfr : Module.finrank (Rp ⧸ m) (Sp ⧸ Q) = 1 := by -- rw [← Ideal.inertiaDeg'_algebraMap m Q]; exact hf -- haveI : Nontrivial (Sp ⧸ Q) := Ideal.Quotient.nontrivial_iff.mpr hQ.ne_top -- haveI : FiniteDimensional (Rp ⧸ m) (Sp ⧸ Q) := Module.finite_of_finrank_eq_succ hfr -+ rw [← Ideal.inertiaDeg_eq_of_isMaximal m Q]; exact hf -+ have : Nontrivial (Sp ⧸ Q) := Ideal.Quotient.nontrivial_iff.mpr hQ.ne_top -+ have : FiniteDimensional (Rp ⧸ m) (Sp ⧸ Q) := Module.finite_of_finrank_eq_succ hfr - have hsurj' : Function.Surjective (algebraMap (Rp ⧸ m) (Sp ⧸ Q)) := by - have hinj : Function.Injective (Algebra.linearMap (Rp ⧸ m) (Sp ⧸ Q)) := - (algebraMap (Rp ⧸ m) (Sp ⧸ Q)).injective -@@ -556,32 +495,23 @@ theorem isSimpleModule_quot_of_inertiaDeg_one - exact ⟨m, hm, ⟨(LinearMap.quotKerEquivOfSurjective _ hsurjRp).symm.trans - (Submodule.quotEquivOfEq _ _ hker)⟩⟩ - ---- The module-length chain over the DVR base (Smith + `Ring.ord` additivity + simplicity) needs -+ - -- room. --/-- **The per-prime relative norm over a DVR base at residue degree one** (the `PerfectField`-free --residual, **CLOSED**). For a DVR `Rₚ` (a local PID), a Dedekind PID `Sₚ` free-finite torsion-free --over `Rₚ`, and a nonzero maximal ideal `Q` of `Sₚ` lying over `m = maximalIdeal Rₚ` with --`inertiaDeg' m Q = 1`, the relative norm `relNorm Rₚ Q = m`. -- --Proof (module-length, **no** residue-field instance, **no** Galois/`PerfectField`): --`Sₚ ⧸ Q` is `Rₚ`-simple (`isSimpleModule_quot_of_inertiaDeg_one`), so `length_{Rₚ}(Sₚ ⧸ Q) = 1`; the --norm–length identity `relNorm_length_eq_span` transports this to --`length_{Rₚ}(Rₚ ⧸ relNorm Rₚ Q) = 1`, --making `Rₚ ⧸ relNorm Rₚ Q` simple, i.e. `relNorm Rₚ Q` maximal, hence `= m` --(`IsLocalRing.eq_maximalIdeal`). -/ -+ -+ - theorem relNorm_eq_maximalIdeal_of_inertiaDeg_one - {Rp Sp : Type*} - [CommRing Rp] [IsDomain Rp] [IsPrincipalIdealRing Rp] [IsIntegrallyClosed Rp] [IsLocalRing Rp] -- [CommRing Sp] [IsDomain Sp] [IsIntegrallyClosed Sp] [IsDedekindDomain Sp] -+ [CommRing Sp] [IsDedekindDomain Sp] - [IsPrincipalIdealRing Sp] - [Algebra Rp Sp] [Module.Finite Rp Sp] [Module.IsTorsionFree Rp Sp] - (Q : Ideal Sp) [hQ : Q.IsMaximal] (hQ0 : Q ≠ ⊥) - [hlo : Q.LiesOver (IsLocalRing.maximalIdeal Rp)] -- (hf : Ideal.inertiaDeg' (IsLocalRing.maximalIdeal Rp) Q = 1) : -+ (hf : Q.inertiaDeg Rp = 1) : - Ideal.relNorm Rp Q = IsLocalRing.maximalIdeal Rp := by - set m := IsLocalRing.maximalIdeal Rp with hm -- haveI : m.IsMaximal := IsLocalRing.maximalIdeal.isMaximal Rp -- haveI hsimp : IsSimpleModule Rp (Sp ⧸ Q) := isSimpleModule_quot_of_inertiaDeg_one Q m hf -+ have : m.IsMaximal := IsLocalRing.maximalIdeal.isMaximal Rp -+ have hsimp : IsSimpleModule Rp (Sp ⧸ Q) := isSimpleModule_quot_of_inertiaDeg_one Q m hf - have hlen1 : Module.length Rp (Sp ⧸ Q) = 1 := Module.length_eq_one Rp (Sp ⧸ Q) - obtain ⟨π, hπ⟩ := (IsPrincipalIdealRing.principal Q).principal - have hπ0 : π ≠ 0 := by rintro rfl; apply hQ0; rw [hπ]; simp -@@ -595,8 +525,7 @@ theorem relNorm_eq_maximalIdeal_of_inertiaDeg_one - exact IsLocalRing.eq_maximalIdeal hmax - - -- The abstract `Rₚ`/`Sₚ` localisation instance bundle (in the binders) needs synthesis room. --omit [IsIntegrallyClosed R] [IsDedekindDomain R] [IsDomain S] [IsIntegrallyClosed S] -- [IsDedekindDomain S] [Module.Finite R S] [Module.IsTorsionFree R S] in -+omit [IsDedekindDomain S] [Module.Finite R S] [Module.IsTorsionFree R S] in - /-- **The per-prime relative norm at residue degree one, general semilocal `Rₚ`/`Sₚ`.** The - hypothesis `hlocal` of `relNorm_eq_under_of_localized`, stated over abstract localisation data - `Rₚ`/`Sₚ` (so the expensive concrete-`Localization` instances are deferred): for a maximal `P` of -@@ -608,83 +537,58 @@ The prime/maximal/`LiesOver`/`inertiaDeg'`-transport facts for `P·Sₚ` come fr - `relNorm_eq_maximalIdeal_of_inertiaDeg_one`. -/ - theorem relNorm_map_eq_maximalIdeal_general - (p : Ideal R) [hp : p.IsMaximal] (hp0 : p ≠ ⊥) -- (Rp : Type*) [CommRing Rp] [IsDomain Rp] [IsIntegrallyClosed Rp] [IsDedekindDomain Rp] -+ (Rp : Type*) [CommRing Rp] [IsDedekindDomain Rp] - [IsPrincipalIdealRing Rp] [Algebra R Rp] [IsLocalization.AtPrime Rp p] [IsLocalRing Rp] - [Module.IsTorsionFree R Rp] -- (Sp : Type*) [CommRing Sp] [IsDomain Sp] [IsIntegrallyClosed Sp] [IsDedekindDomain Sp] -+ (Sp : Type*) [CommRing Sp] [IsDedekindDomain Sp] - [IsPrincipalIdealRing Sp] [Algebra S Sp] - [IsLocalization (Algebra.algebraMapSubmonoid S p.primeCompl) Sp] - [Algebra Rp Sp] [Module.Finite Rp Sp] [Module.IsTorsionFree Rp Sp] - [Algebra R Sp] [IsScalarTower R S Sp] [IsScalarTower R Rp Sp] - (P : Ideal S) [hPmax : P.IsMaximal] [hPp : P.LiesOver p] -- (hf : Ideal.inertiaDeg' p P = 1) : -+ (hf : P.inertiaDeg R = 1) : - Ideal.relNorm Rp (P.map (algebraMap S Sp)) = IsLocalRing.maximalIdeal Rp := by -- haveI hQprime : (P.map (algebraMap S Sp)).IsPrime := -+ have hQprime : (P.map (algebraMap S Sp)).IsPrime := - IsLocalization.AtPrime.isPrime_map_of_liesOver S p Sp P -- haveI hQlo : (P.map (algebraMap S Sp)).LiesOver (IsLocalRing.maximalIdeal Rp) := -+ have hQlo : (P.map (algebraMap S Sp)).LiesOver (IsLocalRing.maximalIdeal Rp) := - IsLocalization.AtPrime.liesOver_map_of_liesOver p Rp Sp P - have hm0 : IsLocalRing.maximalIdeal Rp ≠ ⊥ := by - rw [← IsLocalization.AtPrime.map_eq_maximalIdeal p Rp] - exact Ideal.map_ne_bot_of_ne_bot hp0 - have hQ0 : (P.map (algebraMap S Sp)) ≠ ⊥ := Ideal.ne_bot_of_liesOver_of_ne_bot hm0 _ -- haveI hQmax : (P.map (algebraMap S Sp)).IsMaximal := -+ have hQmax : (P.map (algebraMap S Sp)).IsMaximal := - Ring.DimensionLEOne.maximalOfPrime hQ0 hQprime -- rw [Ideal.inertiaDeg'_eq_inertiaDeg] at hf -- have hfQ : Ideal.inertiaDeg' (IsLocalRing.maximalIdeal Rp) (P.map (algebraMap S Sp)) = 1 := by -- rw [Ideal.inertiaDeg'_eq_inertiaDeg, -- IsLocalization.AtPrime.inertiaDeg_map_eq_inertiaDeg p Rp Sp P] -+ have hfQ : (P.map (algebraMap S Sp)).inertiaDeg Rp = 1 := by -+ rw [IsLocalization.AtPrime.inertiaDeg_map_eq_inertiaDeg p Rp Sp P] - exact hf - exact relNorm_eq_maximalIdeal_of_inertiaDeg_one (P.map (algebraMap S Sp)) hQ0 hfQ - - -- The concrete semilocal `Sₚ` / DVR `Rₚ` localisation instance bundle is expensive to synthesise. --/-- **`relNorm 𝔭 = comap 𝔭` for a maximal prime of residue degree one** (Silverman III.4.10(a), --`f = 1`; ideal form). For a maximal ideal `P` of `S` with `inertiaDeg' (P.under R) P = 1`, the --relative norm `Ideal.relNorm R P` equals the contraction `P.under R = comap (algebraMap R S) P`. -- --This is reduced (no `PerfectField`) to the per-prime DVR-base norm via the global→semilocal --`relNorm_eq_under_of_localized`; see the body and `relNorm_map_eq_maximalIdeal_general`. -- --**Unconditional — no `PerfectField`.** Mathlib's `Ideal.relNorm_eq_pow_of_isMaximal` --(`relNorm 𝔭 = 𝔭.under^f`) is gated on `[PerfectField (FractionRing R)]` (its proof reduces to the --**Galois** case), which fails for a function field over a finite base. That hypothesis is *not* --mathematically necessary at `f = 1` (standard `e · f` theory, Silverman III.4.10), and is now --removed: the global→semilocal reduction `relNorm_eq_under_of_localized` reduces --`relNorm R P = P.under R` to the **single** semilocal per-prime input -- -- `relNorm Rₚ (P·Sₚ) = maximalIdeal Rₚ` (`Rₚ = Localization.AtPrime p`, `Sₚ = semilocal loc. S`), -- --which `relNorm_map_eq_maximalIdeal_general` discharges via the **module-length** route over the DVR --base (`relNorm_eq_maximalIdeal_of_inertiaDeg_one` ← `relNorm_length_eq_span` + --`isSimpleModule_quot_of_inertiaDeg_one`) — no Galois, no `PerfectField`, and **no** `Field (Rₚ ⧸ m)` --instance diamond (the length is taken over the DVR `Rₚ`, never the residue field). The inertia --degree transports across the localisation via `IsLocalization.AtPrime.inertiaDeg_map_eq_inertiaDeg`. -- --(The shipped local-base specialisation --`Ideal.relNorm_maximalIdeal_eq_under_of_inertiaDeg_one_of_isLocalRing` is now subsumed for the --general base; it is retained as a lighter-weight `IsLocalRing` form.) -/ -+ -+ - theorem Ideal.relNorm_eq_under_of_inertiaDeg_one - {P : Ideal S} [hPmax : P.IsMaximal] (hP : P ≠ ⊥) -- (hf : Ideal.inertiaDeg' (P.under R) P = 1) : -+ (hf : P.inertiaDeg R = 1) : - Ideal.relNorm R P = P.under R := by -- letI hnz := NeZero.mk (Ideal.under_ne_bot R hP) -- haveI hpmax : (P.under R).IsMaximal := Ideal.IsMaximal.under R P -- haveI : P.LiesOver (P.under R) := Ideal.over_under P -- -- Pre-establish the heavy semilocal `Sₚ` / DVR `Rₚ` instances so the discharge stays in budget. -- haveI iDed : IsDedekindDomain -+ let hnz := NeZero.mk (Ideal.under_ne_bot R hP) -+ have hpmax : (P.under R).IsMaximal := Ideal.IsMaximal.under R P -+ have : P.LiesOver (P.under R) := Ideal.over_under P -+ -+ have iDed : IsDedekindDomain - (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance -- haveI iPID : IsPrincipalIdealRing -+ have iPID : IsPrincipalIdealRing - (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance -- haveI iFin : Module.Finite (Localization.AtPrime (P.under R)) -+ have iFin : Module.Finite (Localization.AtPrime (P.under R)) - (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance -- haveI iTF : Module.IsTorsionFree (Localization.AtPrime (P.under R)) -+ have iTF : Module.IsTorsionFree (Localization.AtPrime (P.under R)) - (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance -- haveI iIC : IsIntegrallyClosed -+ have iIC : IsIntegrallyClosed - (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance -- haveI iST2 : IsScalarTower R (Localization.AtPrime (P.under R)) -+ have iST2 : IsScalarTower R (Localization.AtPrime (P.under R)) - (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance -- haveI iST3 : IsScalarTower R S -+ have iST3 : IsScalarTower R S - (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance -- haveI iTFr : Module.IsTorsionFree R (Localization.AtPrime (P.under R)) := inferInstance -+ have iTFr : Module.IsTorsionFree R (Localization.AtPrime (P.under R)) := inferInstance - refine relNorm_eq_under_of_localized P hP ?_ - exact relNorm_map_eq_maximalIdeal_general (P.under R) (Ideal.under_ne_bot R hP) - (Localization.AtPrime (P.under R)) -@@ -696,81 +600,47 @@ contraction `comap (algebraMap R S) P` (which is nonzero by `Ideal.under_ne_bot` - `(Ideal R)⁰`. -/ - theorem relNorm0_eq_comap_of_inertiaDeg_one - (P : (Ideal S)⁰) [hPmax : (P : Ideal S).IsMaximal] -- (hf : Ideal.inertiaDeg' ((P : Ideal S).under R) (P : Ideal S) = 1) : -+ (hf : (P : Ideal S).inertiaDeg R = 1) : - (relNorm0 (R := R) (S := S) P : Ideal R) = - Ideal.comap (algebraMap R S) (P : Ideal S) := - Ideal.relNorm_eq_under_of_inertiaDeg_one (R := R) (S := S) - (mem_nonZeroDivisors_iff_ne_zero.mp P.2) hf - --/-- **`class(relNorm 𝔭) = class(comap 𝔭)` for a maximal prime of residue degree one** --(Silverman III.4.10(a), `f = 1`; class-group form). The `ClassGroup.mk0` class of `relNorm0 P` is --the class of the contraction `comap (algebraMap R S) P`. - --This is the residue-degree-`1` content that bridges the divisor pushforward `φ_* = relNorm` --(`classNorm`) with the set-theoretic point image `comap` (the shipped `toClass_toPointMap`), pinning --the `Pic⁰` naturality `hnat` at a rational point. The `comap`-nonzero membership proof is supplied --via `Ideal.under_ne_bot`. -/ - theorem ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one - (P : (Ideal S)⁰) [hPmax : (P : Ideal S).IsMaximal] -- (hf : Ideal.inertiaDeg' ((P : Ideal S).under R) (P : Ideal S) = 1) -+ (hf : (P : Ideal S).inertiaDeg R = 1) - (hcomap : Ideal.comap (algebraMap R S) (P : Ideal S) ∈ (Ideal R)⁰) : - ClassGroup.mk0 (relNorm0 (R := R) (S := S) P) = - ClassGroup.mk0 (⟨Ideal.comap (algebraMap R S) (P : Ideal S), hcomap⟩ : (Ideal R)⁰) := - congrArg ClassGroup.mk0 (Subtype.ext (relNorm0_eq_comap_of_inertiaDeg_one (R := R) (S := S) P hf)) - --/-! ### `inertiaDeg' = 1` at a residue-degree-one prime, for an `F`-algebra self-map `R →ₐ[F] R` - --The residue/inertia degree `f = inertiaDeg' (M.under R) M = finrank (R ⧸ M.under R) (R ⧸ M)` is `1` --whenever the residue field `R ⧸ M` is *one-dimensional over the ground field `F`* (an `F`-rational --point: `R ⧸ M ≅ F`). This is Silverman III.4.10(a) `f = 1`: at a rational point the inseparability --of an `F`-algebra self-map `g : R →ₐ[F] R` (e.g. Frobenius) lives entirely in the **ramification** --`e`, never in `f`. -- --The proof is **diamond-free** (it does *not* invoke `finrank_mul_finrank`, which is what blocks the --`Module.Free` "Piece 9" route in `Curves/GenericFiber.lean`): it bounds --`finrank (R ⧸ M.under R) (R ⧸ M) ≤ 1` directly by surjectivity of the residue-field algebra map. --That surjectivity holds because `g` is an `F`-algebra hom — so it fixes the image of `F`, and --`algebraMap F (R ⧸ M)` is already surjective when `finrank F (R ⧸ M) = 1`; hence every residue class --is hit by a *constant* `algebraMap F (R ⧸ M.under R) c`. Positivity (`finrank ≥ 1`) is --`Module.finrank_pos` (the residue extension is finite + nontrivial). -+-- The residue-field `finrank` bookkeeping (surjectivity bound + tower) needs more elaboration room. - --`g` need only be *module-finite over itself through `g`* (`hfin`) for `M.under R` to be maximal --(going-up / `Algebra.IsIntegral.of_finite`); this is exactly the `Module.Finite` witness an --`Isogeny.CoordHom` already carries. -/ - ---- The twisted self-algebra `R →[g] R` pushes instance synthesis past the default budget. ---- The residue-field `finrank` bookkeeping (surjectivity bound + tower) needs more elaboration room. --/-- **`inertiaDeg' = 1` at a rational point, for an `F`-algebra self-map** (Silverman III.4.10(a), --`f = 1`). For an `F`-algebra `R`, an `F`-algebra hom `g : R →ₐ[F] R` that is module-finite over --itself through `g`, and a maximal ideal `M` whose residue field is one-dimensional over `F` --(`finrank F (R ⧸ M) = 1`, the `F`-rational condition), the inertia degree of `M.under R` (the --contraction `comap g M`) under `M` is `1`. -- --Diamond-free (no `finrank_mul_finrank`): see the section note. This is the missing `f = 1` input --that, via `Ideal.relNorm_eq_under_of_inertiaDeg_one`, collapses `relNorm 𝔪 = comap 𝔪` at rational --points — the residue-degree content of the `Pic⁰` naturality `hnat`. -/ - theorem Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one - {F : Type*} [Field F] {R : Type*} [CommRing R] [Algebra F R] (g : R →ₐ[F] R) - (hfin : @Module.Finite R R _ _ g.toRingHom.toAlgebra.toModule) - (M : Ideal R) [hM : M.IsMaximal] - (hres : Module.finrank F (R ⧸ M) = 1) : - letI : Algebra R R := g.toRingHom.toAlgebra -- Ideal.inertiaDeg' (M.under R) M = 1 := by -- letI inst : Algebra R R := g.toRingHom.toAlgebra -- haveI instFin : @Module.Finite R R _ _ inst.toModule := hfin -- haveI : @Algebra.IsIntegral R R _ _ inst := -+ M.inertiaDeg R = 1 := by -+ let inst : Algebra R R := g.toRingHom.toAlgebra -+ have instFin : @Module.Finite R R _ _ inst.toModule := hfin -+ have : @Algebra.IsIntegral R R _ _ inst := - @Algebra.IsIntegral.of_finite R R _ _ inst instFin - -- The twisted self-algebra is a scalar tower over `F`: `g` fixes the image of `F`. -- haveI hst : @IsScalarTower F R R _ inst.toSMul _ := -+ have hst : @IsScalarTower F R R _ inst.toSMul _ := - @IsScalarTower.of_algebraMap_eq F R R _ _ _ _ inst _ fun c ↦ by - change algebraMap F R c = g.toRingHom (algebraMap F R c) - rw [show g.toRingHom (algebraMap F R c) = g (algebraMap F R c) from rfl, AlgHom.commutes] -- haveI : M.LiesOver (M.under R) := Ideal.over_under M -- haveI hmax : (M.under R).IsMaximal := Ideal.IsMaximal.under R M -- haveI : Field (R ⧸ M.under R) := Ideal.Quotient.field _ -- rw [Ideal.inertiaDeg'_algebraMap] -- haveI : Nontrivial (R ⧸ M) := Ideal.Quotient.nontrivial_iff.mpr hM.ne_top -- haveI : FiniteDimensional F (R ⧸ M) := Module.finite_of_finrank_eq_succ hres -+ have : M.LiesOver (M.under R) := Ideal.over_under M -+ have hmax : (M.under R).IsMaximal := Ideal.IsMaximal.under R M -+ have : Field (R ⧸ M.under R) := Ideal.Quotient.field _ -+ rw [Ideal.inertiaDeg_eq_of_isMaximal (M.under R) M] -+ have : Nontrivial (R ⧸ M) := Ideal.Quotient.nontrivial_iff.mpr hM.ne_top -+ have : FiniteDimensional F (R ⧸ M) := Module.finite_of_finrank_eq_succ hres - -- `algebraMap F (R ⧸ M)` is surjective: injective `F`-linear map between equal (= 1) finrank. - have hFsurj : Function.Surjective (algebraMap F (R ⧸ M)) := by - have hinj : Function.Injective (Algebra.linearMap F (R ⧸ M)) := -@@ -785,7 +655,7 @@ theorem Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one - obtain ⟨c₀, hc₀⟩ := hFsurj w - exact ⟨algebraMap F (R ⧸ M.under R) c₀, by - rw [← IsScalarTower.algebraMap_apply F (R ⧸ M.under R) (R ⧸ M), hc₀]⟩ -- haveI hfinMod : Module.Finite (R ⧸ M.under R) (R ⧸ M) := -+ have hfinMod : Module.Finite (R ⧸ M.under R) (R ⧸ M) := - Module.Finite.of_surjective (Algebra.linearMap (R ⧸ M.under R) (R ⧸ M)) - (by intro w; obtain ⟨c, hc⟩ := hsurj w; exact ⟨c, hc⟩) - have h_le : Module.finrank (R ⧸ M.under R) (R ⧸ M) ≤ 1 := -@@ -805,23 +675,6 @@ theorem ClassGroup.relNorm_mul (a b : ClassGroup S) : - ClassGroup.relNorm (R := R) a * ClassGroup.relNorm (R := R) b := - map_mul _ a b - --/-! --## The class-group extension (pullback) map and the dual relation -- --We now build the *extension* direction `ClassGroup R →* ClassGroup S`, induced by --`Ideal.map (algebraMap R S)` (extend an ideal of `R` to `S`), by exactly the same descent --technique used for `relNorm`. Composing the relative norm with the extension recovers raising to --the `n`-th power, where `n = [Frac S : Frac R] = Module.finrank R S` --(`ClassGroup.relNorm_comp_map`). This is the class-group shadow of the dual-isogeny relation --`α̂ ∘ α = [deg α]`. -- --The whole arithmetic core --`Ideal.relNorm R (Ideal.map (algebraMap R S) I) = I ^ n` --is already available in mathlib as `Ideal.relNorm_algebraMap` (proved by localising at maximal --ideals and reducing to `Algebra.norm_algebraMap`); in particular it needs **no** --separability/Galois/`PerfectField` hypothesis, so the ramification–inertia route is not needed --here. ---/ - - /-- The extension of an integral ideal, packaged as a homomorphism of `nonZeroDivisors` monoids - `(Ideal R)⁰ →* (Ideal S)⁰`, using that `Ideal.map (algebraMap R S)` sends nonzero ideals to nonzero -@@ -844,12 +697,12 @@ noncomputable def map0 : (Ideal R)⁰ →* (Ideal S)⁰ where - noncomputable def mk0CompMap0 : (Ideal R)⁰ →* ClassGroup S := - (ClassGroup.mk0 (R := S)).comp map0 - --omit [IsIntegrallyClosed R] [IsDedekindDomain R] [IsIntegrallyClosed S] [Module.Finite R S] in -+omit [Module.Finite R S] in - @[simp] - theorem mk0CompMap0_apply (I : (Ideal R)⁰) : - mk0CompMap0 (S := S) I = ClassGroup.mk0 (map0 I) := rfl - --omit [IsIntegrallyClosed R] [IsIntegrallyClosed S] [Module.Finite R S] in -+omit [Module.Finite R S] in - /-- Well-definedness of the descent: if two integral ideals of `R` have the same class in - `ClassGroup R`, their extensions have the same class in `ClassGroup S`. - -@@ -893,7 +746,7 @@ noncomputable def ClassGroup.map : ClassGroup R →* ClassGroup S where - Function.surjInv_eq ClassGroup.mk0_surjective, - Function.surjInv_eq ClassGroup.mk0_surjective] - --omit [IsIntegrallyClosed R] [IsIntegrallyClosed S] [Module.Finite R S] in -+omit [Module.Finite R S] in - /-- The defining computation of `ClassGroup.map` on an integral representative: the extension of the - class of `I` is the class of `Ideal.map (algebraMap R S) I` (which lies in `(Ideal S)⁰` by - `Ideal.map_eq_bot_iff_of_injective`, here packaged as `map0 I`). -/ -@@ -903,39 +756,24 @@ theorem ClassGroup.map_mk0 (I : (Ideal R)⁰) : - refine (mk0CompMap0_eq_of_mk0_eq ?_).trans (mk0CompMap0_apply I) - rw [Function.surjInv_eq ClassGroup.mk0_surjective] - --omit [IsIntegrallyClosed R] [IsIntegrallyClosed S] [Module.Finite R S] in -+omit [Module.Finite R S] in - /-- `map_one` sanity check: the extension of the trivial class is trivial. -/ - theorem ClassGroup.map_one : ClassGroup.map (R := R) (S := S) 1 = 1 := - _root_.map_one _ - --omit [IsIntegrallyClosed R] [IsIntegrallyClosed S] [Module.Finite R S] in -+omit [Module.Finite R S] in - /-- `map_mul` sanity check: the extension map is multiplicative. -/ - theorem ClassGroup.map_mul (a b : ClassGroup R) : - ClassGroup.map (S := S) (a * b) = - ClassGroup.map (S := S) a * ClassGroup.map (S := S) b := - _root_.map_mul _ a b - --/-- The **ideal-level arithmetic core** of the dual relation: the relative norm of the extension of --an integral ideal `I` of `R` is `I ^ n`, where `n = Module.finrank R S`. - --Since mathlib moved `Ideal.relNorm_algebraMap`'s exponent from --`Module.finrank (FractionRing R) (FractionRing S)` to `Module.finrank R S`, this is now *literally* --that lemma — the fraction-field transport it used to perform is gone. Kept as the name the --class-group descent below cites; a cleanup pass can inline it. -/ - theorem Ideal.relNorm_map_algebraMap (I : Ideal R) : - Ideal.relNorm R (Ideal.map (algebraMap R S) I) = I ^ Module.finrank R S := - Ideal.relNorm_algebraMap S I - --/-- **The target: the dual relation at the class-group level.** -- --The composite of the class-group extension map with the relative norm is raising to the `n`-th --power, where `n = Module.finrank R S = [Frac S : Frac R]`: --`relNorm (map c) = c ^ n` for every `c : ClassGroup R`. This is the arithmetic core, on ideal --classes, of `α̂ ∘ α = [deg α]`. - --The proof picks an integral representative `c = mk0 I` (`ClassGroup.mk0_surjective`), computes both --descents with `ClassGroup.map_mk0` and `ClassGroup.relNorm_mk0`, and reduces to the ideal-level --identity `Ideal.relNorm_map_algebraMap`. Compatibility of `mk0` with `(· ^ n)` is `map_pow`. -/ - theorem ClassGroup.relNorm_comp_map (c : ClassGroup R) : - ClassGroup.relNorm (ClassGroup.map (S := S) c) = c ^ Module.finrank R S := by - obtain ⟨I, rfl⟩ := ClassGroup.mk0_surjective c -diff --git a/projects/HasseWeil/HasseWeil/Pic0/PicDual.lean b/projects/HasseWeil/HasseWeil/Pic0/PicDual.lean -index d0543c22f..40854d96f 100644 ---- a/projects/HasseWeil/HasseWeil/Pic0/PicDual.lean -+++ b/projects/HasseWeil/HasseWeil/Pic0/PicDual.lean -@@ -8,68 +8,22 @@ import HasseWeil.Pic0.ToClassSurjective - import HasseWeil.Foundation.Basic - - /-! --# The Pic⁰ dual isogeny and the dual relation `α ∘ α̂ = [deg α]` (Silverman III.6.1) -- --For an endomorphism `α : Isogeny E E` of an elliptic curve `E`, equipped with a coordinate-ring --restriction witness `ch : α.CoordHom` (the comorphism `α* : R → R` on `R := E.CoordinateRing`), --this file builds the **Pic⁰ dual** as a point endomorphism and proves the dual relation, following --**Silverman, *The Arithmetic of Elliptic Curves*, III.6.1** *to the letter*. -- --## Silverman III.6.1 (verified against the in-repo PDF, book p.80–82) -- --Let `κ : E ≅ Pic⁰(E)`, `P ↦ class of `(P) − (O)``. Silverman III.6.1(b) **defines** the dual via --the **divisor pullback** `φ*` (II.3.6/II.3.7): -- --``` -- κ φ* κ⁻¹ -- φ̂ : E ───→ Pic⁰(E) ───→ Pic⁰(E) ───→ E , --``` -- --i.e. `φ̂ = κ⁻¹ ∘ φ* ∘ κ`, where `φ* : Pic⁰(E) → Pic⁰(E)` is the **pullback** of divisor classes --`(Q) ↦ Σ_{P ↦ Q} e_φ(P)·(P)` (Silverman II.3, book p.29). At the level of the affine ideal class --group `Pic⁰(E) ≅ ClassGroup R`, this pullback is the **ideal extension** `𝔪_Q ↦ 𝔪_Q·𝒪 = ∏ 𝔓^{e}`, --which is exactly the shipped `HasseWeil.Isogeny.classMap` (= `HasseWeil.ClassGroup.map`). -- --The companion **divisor pushforward** `φ_*` (II.3.6/II.3.7), `(P) ↦ (φP)`, is at the ideal level the --**relative norm** `𝔓 ↦ 𝔮^{f}`, the shipped `HasseWeil.Isogeny.classNorm` (= `ClassGroup.relNorm`). --Silverman II.3.6(e) gives `φ_* ∘ φ* = [deg φ]` on `Pic⁰`; its shipped shadow is --`HasseWeil.Isogeny.classNorm_comp_classMap` (`classNorm (classMap c) = c ^ finrank R R`). -- --## Main definitions -- --* `HasseWeil.Isogeny.picDual` — `φ̂ = κ⁻¹ ∘ classMap ∘ κ` as a point endomorphism `E.Point →+ -- E.Point` (the III.6.1(b) construction; `classMap` = extension = the divisor pullback `φ*`). --* `HasseWeil.Isogeny.picPushforward` — `κ⁻¹ ∘ classNorm ∘ κ`, the κ-transport of the divisor -- pushforward `φ_*` (= `classNorm` = relative norm). -- --## Main results -- --* `HasseWeil.Isogeny.picPushforward_comp_picDual` / `..._degree` — **unconditional** (modulo the -- carried `CoordHom`/`Module.Finite`/tower witnesses): the κ-transport of Silverman II.3.6(e), -- `picPushforward ∘ picDual = [finrank R R]` (resp. `= [α.degree]`), as `AddMonoidHom`s. --* `HasseWeil.Isogeny.toAddMonoidHom_comp_picDual` — **the III.6.1 target** `α ∘ α̂ = [deg α]` -- (`α.toAddMonoidHom.comp α.picDual = [α.degree]`), carrying the III.3.4 **naturality** of `κ` on -- the point map (`hnat : κ ∘ α = classNorm ∘ κ`) as a witness-parametric hypothesis. --* `HasseWeil.Isogeny.picDual_comp_toAddMonoidHom` — the companion `α̂ ∘ α = [deg α]` -- (III.6.2(a) order), under the same naturality witness. -- --## Why the III.3.4 naturality is a *carried hypothesis*, not derived -- --The unconditional results above tie `picDual` to `picPushforward` (both κ-transports), with **no** --extra input. Identifying `picPushforward` with the *actual* point map `α.toAddMonoidHom` is the --**III.3.4 naturality** `κ ∘ α = classNorm ∘ κ` (i.e. `κ₂(αP) = φ_*κ₁(P)`). As documented in --`HasseWeil/Pic0/ToClassFunctorial.lean`, the point-map ↔ ideal-map link the shipped API exposes is --the **`comap`** (set-theoretic point image), which on a prime `𝔓 / 𝔮` gives `𝔮`, whereas the --pushforward `φ_* = relNorm` gives `𝔮^{f}` — they differ by the **inertia/residue degree** `f`. --Bridging them is exactly the ramification bookkeeping `relNorm (comap …) = (·)^?` --(`relNorm_eq_pow_of_isMaximal`, needing `PerfectField (FractionRing R)`), the III.3.4 content the --`Isogeny` carries as *independent data*. It is therefore taken as a hypothesis here (dischargeable --per isogeny: Frobenius, multiplication-by-`n`), keeping every theorem `#print axioms`-clean. -+# The Picard dual isogeny -+ -+For an elliptic-curve endomorphism `α` with a coordinate-ring comorphism, -+transporting ideal extension along `κ : E ≃ Pic⁰(E)` defines the Picard dual. -+Transporting the relative ideal norm defines the point-group pushforward. -+The norm–extension identity gives `picPushforward ∘ picDual = [deg α]`. -+Under the naturality relation between the point map and `κ`, this yields -+`α ∘ α̂ = [deg α]`; surjectivity gives the companion relation by cancellation. -+ -+At rational points, residue degree one identifies the relative ideal norm -+with contraction. This proves the corresponding naturality reduction -+without a perfectness assumption on the function field. - - ## References - --* [Silverman, *The Arithmetic of Elliptic Curves*], II.3.6–3.7 (divisor pullback/pushforward, -- `φ_*φ* = [deg]`), III.3.4 (functoriality of `E ≅ Pic⁰(E)`), III.6.1 (the dual isogeny). -+* [Silverman, *The Arithmetic of Elliptic Curves*], II.3.6–3.7, III.3.4, III.6.1. - -/ - - open WeierstrassCurve Polynomial -@@ -114,7 +68,7 @@ Silverman's **divisor pullback** `φ* : Pic⁰(E) → Pic⁰(E)`. This is *exac - definition `φ̂ = κ₁⁻¹ ∘ φ* ∘ κ₂`. - - The `CoordHom` witness `ch`, injectivity `hinj`, and finiteness `hfin` are the data/hypotheses the --shipped `classMap` requires (carried, not discharged universally — instantiable per isogeny). -/ -+`classMap` requires (carried, not discharged universally — instantiable per isogeny). -/ - noncomputable def picDual (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) - (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) : - E.Point →+ E.Point := -@@ -188,7 +142,7 @@ theorem classTransport_comp_eq - - /-! ### The dual relation `φ_* ∘ φ* = [deg]`, transported to the point group - --Silverman II.3.6(e): `φ_* ∘ φ* = [deg φ]` on `Pic⁰(E)`. Its shipped class-group shadow is -+Silverman II.3.6(e): `φ_* ∘ φ* = [deg φ]` on `Pic⁰(E)`. Its class-group shadow is - `classNorm_comp_classMap` (`classNorm (classMap c) = c ^ finrank R R`). We transport it across `κ` - to obtain `picPushforward ∘ picDual = [finrank R R]` as point endomorphisms — **unconditionally** - (beyond the carried `CoordHom`/`Module.Finite` witnesses the `classMap`/`classNorm` already need). -@@ -196,7 +150,7 @@ The `α.degree` form follows from the degree bridge `classNorm_comp_classMap_deg - - /-- **κ-transport of `φ_* ∘ φ* = [deg]` (coordinate-ring `finrank` form).** - --`picPushforward ∘ picDual = [finrank R R]` as point endomorphisms, the κ-conjugate of the shipped -+`picPushforward ∘ picDual = [finrank R R]` as point endomorphisms, the κ-conjugate of the - class-group identity `classNorm (classMap c) = c ^ finrank R R` (= Silverman II.3.6(e) - `φ_* ∘ φ* = [deg]`). Unconditional beyond the carried `CoordHom`/`Module.Finite` witnesses. - -@@ -210,7 +164,7 @@ theorem picPushforward_comp_picDual (ch : α.CoordHom) (hinj : Function.Injectiv - ((@Module.finrank E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule : ℕ) : - ℤ))).toAddMonoidHom := - -- `picPushforward ∘ picDual = classTransport classNorm ∘ classTransport classMap`, and -- -- `classNorm (classMap c) = c ^ finrank` is the shipped `classNorm_comp_classMap`. -+ -- `classNorm (classMap c) = c ^ finrank` is the `classNorm_comp_classMap`. - classTransport_comp_eq (α.classMap ch hinj hfin) (α.classNorm ch hinj hfin) _ - (α.classNorm_comp_classMap ch hinj hfin) - -@@ -238,19 +192,12 @@ theorem picPushforward_comp_picDual_degree (ch : α.CoordHom) - congr 2 - exact_mod_cast (α.degree_eq_finrank_coordinateRing_of_tower_eq ch S S' hSR hS'FF).symm - --/-! ### The III.6.1 target `α ∘ α̂ = [deg α]` on the point group -+/-! ### The dual relation on the point group - --The unconditional `picPushforward_comp_picDual` ties `picDual` to `picPushforward`. To reach the --brief's target `α ∘ α̂ = [deg α]` — with the *actual* point map `α.toAddMonoidHom` — we additionally --need the **Silverman III.3.4 naturality** of `κ` on the point map: that under `κ`, the point map --`α.toAddMonoidHom` corresponds to the divisor pushforward `φ_*` (= `classNorm`). In the κ-conjugate --form, this is exactly `α.toAddMonoidHom = α.picPushforward …`. -- --As documented in `HasseWeil/Pic0/ToClassFunctorial.lean`, the shipped point-map ↔ ideal-map link is --the **`comap`** (set-theoretic point image), which differs from `φ_* = relNorm` by the residue --degree; bridging them is the III.3.4 ramification bookkeeping the `Isogeny` carries as independent --data. We therefore take the naturality as a witness-parametric hypothesis (dischargeable per --isogeny), keeping the result `#print axioms`-clean. -/ -+The relation between the Picard dual and Picard pushforward yields the -+point-group dual relation under the naturality condition -+`κ (α P) = classNorm (κ P)`. The relative norm differs from contraction by the -+residue degree; for rational points this degree is one. -/ - - /-- **The III.3.4 naturality witness, raw form**: under `κ = toClassEquiv'`, the point map of `α` - corresponds to the relative-norm class map `classNorm` (the divisor pushforward `φ_*`): -@@ -279,44 +226,14 @@ theorem toAddMonoidHom_eq_picPushforward_iff (ch : α.CoordHom) - rw [picPushforward_apply, ← h P, - (WeierstrassCurve.Affine.Point.toClassEquiv' (W := E)).symm_apply_apply] - --/-! #### Isolating the `hnat` residual to the rational-point ideal identity (`comap = relNorm`) -- --`Naturality` is structurally a **carried datum**: an abstract `Isogeny E E` stores its `pullback` --and `toAddMonoidHom` as *independent* fields (`HasseWeil/Basic.lean`), with no derivation linking --the point map to the comorphism `ch` — so `hnat` cannot be proved in general, only verified per --isogeny where both fields are explicit (Frobenius, mult-by-`n`). -- --What we *can* ship axiom-clean is the exact reduction of the **right-hand side** of `Naturality` to --a concrete ideal class. The RHS `classNorm (κ P)` for a rational point `P = (x, y)` is the `mk0` --class of the **relative norm** `relNorm (maximalIdealAt P) = relNorm ⟨X − x, Y − y⟩` (Silverman's --divisor pushforward `φ_*`). Combined with the shipped `ToClassFunctorial.toClass_toPointMap` --(whose ideal is the **`comap`** `α*⁻¹(maximalIdealAt P)`), this pins the *entire* remaining content --of `hnat` to the single residue-degree identity -- --``` --class (relNorm (maximalIdealAt P)) = class (comap α* (maximalIdealAt P)) (rational P) --``` -- --which holds because a rational point has residue degree `f = 1`, so `relNorm 𝔪_P = 𝔪_P ∩ R = --comap α* 𝔪_P` (for `f = 1`, `relNorm 𝔭 = (comap 𝔭)^f = comap 𝔭`). Mathlib has no --`relNorm = (comap)^{inertiaDeg'}` lemma (and the project's `inertiaDeg' = 1`-at-smooth-points --computation is `Module.Free`-diamond-blocked, see `Curves/GenericFiber.lean` Piece 9), so this last --step stays a per-isogeny obligation; the lemma below is the bridge that *reduces to it*. -/ -- --/-- **The `classNorm`/`κ` side of `Naturality`, evaluated at a rational point (axiom-clean --bridge).** -- --For a rational point `P = (x, y)` (a mathlib `Point.some`), the value of the relative-norm class map --`classNorm` on `κ P = toClassEquiv' P` is the `mk0` class of the **relative ideal norm** of the --maximal ideal `XYIdeal E x (C y) = ⟨X − x, Y − y⟩` at `P` (= Silverman's divisor pushforward `φ_*`, --packaged as `relNorm0`). This unfolds the *right-hand side* of the III.3.4 naturality predicate --`Naturality` at `Point.some`, reducing the whole `hnat` obligation to the ideal-class identity --`class (relNorm 𝔪_P) = class (comap α* 𝔪_P)` against the shipped `toClass_toPointMap` (the --`comap` form) — exactly the residue-degree-`1` content (see the section note). -- --Proof: `κ (some) = toClass (some) = mk (XYIdeal' h) = mk0 ⟨XYIdeal, _⟩` (the project's --`mk0_eq_mk_XYIdeal'` bridge), then `ClassGroup.relNorm_mk0` computes the norm on the integral --representative. -/ -+/-! #### Naturality at rational points -+ -+For a rational point `P`, `classNorm (κ P)` is represented by the relative -+norm of its maximal ideal. Residue degree one identifies this norm with the -+contraction under the coordinate-ring comorphism. Thus naturality reduces -+to agreement between the given point map and the contracted ideal class. -/ -+ -+/-- The relative-norm class map on a rational point is represented by the relative norm of its maximal ideal. -/ - theorem classNorm_toClassEquiv'_some (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) - (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) - {x y : F} (h : E.Nonsingular x y) -@@ -331,9 +248,9 @@ theorem classNorm_toClassEquiv'_some (ch : α.CoordHom) (hinj : Function.Injecti - ch.isTorsionFree hinj - ClassGroup.mk0 (HasseWeil.relNorm0 (R := E.CoordinateRing) (S := E.CoordinateRing) - ⟨WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y), hmem⟩) := by -- letI := ch.toAlgebra -- haveI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin -- haveI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := -+ let := ch.toAlgebra -+ have : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin -+ have : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := - ch.isTorsionFree hinj - rw [WeierstrassCurve.Affine.Point.toClassEquiv'_apply, - WeierstrassCurve.Affine.Point.toClass_some, -@@ -341,23 +258,11 @@ theorem classNorm_toClassEquiv'_some (ch : α.CoordHom) (hinj : Function.Injecti - show HasseWeil.ClassGroup.relNorm (ClassGroup.mk0 _) = _ - rw [HasseWeil.ClassGroup.relNorm_mk0] - --/-! #### Discharging `hnat`: the residue-degree-`1` (`comap = relNorm`) step at rational points -- --Combining the shipped `classNorm_toClassEquiv'_some` (the `relNorm0` form of the `Naturality` RHS) --with the residue-degree bridge of `ClassGroupNorm` (`relNorm 𝔪 = comap 𝔪` at `inertiaDeg' = 1`, the --`inertiaDeg' = 1` itself supplied **diamond-free** by --`Ideal`.`inertiaDeg_under_eq_one_of_algHom_…`), --we reduce the entire `hnat`/`Naturality` obligation to the **point-map ↔ `comap` agreement** — that --the actual point map `α.toAddMonoidHom` sends `(x, y)` to a point whose `κ`-class is the contraction --`comap α* 𝔪_{(x,y)}` (Silverman III.3.4, the `comap` form shipped as `toClass_toPointMap`). -+/-! #### The residue-degree-one norm identity - --The residue-degree step needs `PerfectField (FractionRing R) = PerfectField K(E)` (the hypothesis of --mathlib's `Ideal.relNorm_eq_pow_of_isMaximal`). This holds for perfect base fields (e.g. `char 0`, --or algebraically closed of characteristic `0`). **Honest residual:** for a function field over a --*finite* field `K(E)` is *imperfect*, so this last `relNorm = comap` step is not covered by the --mathlib lemma there; pinning the exponent without `PerfectField`/Galois would require a degree-count --adaptation of the project's `relNorm_maximalIdealAt` (`Curves/NormValuation.lean`) to the twisted --`R →[α*] R` extension. Everything *below* the `PerfectField` hypothesis is unconditional. -/ -+The rational-point residue field has rank one over the base field. The -+class-group norm identity at residue degree one then identifies relative -+norm with contraction, without assuming the function field is perfect. -/ - - /-- **The `comap α* 𝔪_P` ideal is a nonzero divisor** (carried side condition for the `mk0` class). - For a rational point `P = (x, y)`, the contraction `comap α* (XYIdeal E x (C y))` of the (nonzero) -@@ -371,36 +276,16 @@ theorem comap_XYIdeal_mem_nonZeroDivisors (ch : α.CoordHom) - Ideal.comap ch.toAlgHom.toRingHom - (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)) ∈ - (Ideal E.CoordinateRing)⁰ := by -- letI := ch.toAlgebra -- haveI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin -- haveI : Algebra.IsIntegral E.CoordinateRing E.CoordinateRing := -+ let := ch.toAlgebra -+ have : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin -+ have : Algebra.IsIntegral E.CoordinateRing E.CoordinateRing := - Algebra.IsIntegral.of_finite _ _ - have hbot : WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y) ≠ ⊥ := - mem_nonZeroDivisors_iff_ne_zero.mp hmem - exact mem_nonZeroDivisors_iff_ne_zero.mpr - (Ideal.under_ne_bot (A := E.CoordinateRing) (B := E.CoordinateRing) hbot) - --/-- **The `classNorm`/`comap` identity at a rational point (residue degree `1`) — UNCONDITIONAL.** -- --For a rational point `P = (x, y)` and a coordinate-ring restriction `ch`, the relative-norm class --`classNorm0 (XYIdeal E x (C y))` (the `Naturality` RHS, via `classNorm_toClassEquiv'_some`) equals --the class of the **contraction** `comap α* (XYIdeal E x (C y))` — Silverman's divisor pushforward --`φ_*` collapses to the set-theoretic point image at a rational point, where the residue degree --`f = 1`. -- --**`PerfectField`-free.** Mathlib's `Ideal.relNorm_eq_pow_of_isMaximal` is gated on --`[PerfectField (FractionRing R)]` (its proof reduces to the Galois case, which fails for a function --field over a finite base), but that hypothesis is *not* needed at `f = 1`: the shipped --`ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one` (`ClassGroupNorm.lean`) discharges --`relNorm 𝔪 = comap 𝔪` from `inertiaDeg' = 1` alone via the module-length / DVR-base route, with --**no** --`PerfectField`. This removes the previous `[PerfectField E.FunctionField]` hypothesis. -- --Proof: `XYIdeal` is maximal (`quotientXYIdealEquiv`) with residue field `F` (so `finrank F (R/𝔪) = --1`), hence `inertiaDeg' (𝔪.under R) 𝔪 = 1` --(`Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one`, diamond-free); then --`ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one` (`relNorm 𝔪 = comap 𝔪` under `f = 1`, --unconditional) finishes. -/ -+/-- At a rational point, residue degree one identifies the relative-norm ideal class with the contracted ideal class. -/ - theorem mk0_relNorm0_XYIdeal_eq_mk0_comap - (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) - (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) -@@ -419,18 +304,16 @@ theorem mk0_relNorm0_XYIdeal_eq_mk0_comap - ClassGroup.mk0 (⟨Ideal.comap ch.toAlgHom.toRingHom - (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)), hcomap⟩ : - (Ideal E.CoordinateRing)⁰) := by -- letI := ch.toAlgebra -- haveI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin -- haveI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := -+ let := ch.toAlgebra -+ have : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin -+ have : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := - ch.isTorsionFree hinj -- haveI hMmax : (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)).IsMaximal := -+ have hMmax : (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)).IsMaximal := - Ideal.Quotient.maximal_of_isField _ - ((WeierstrassCurve.Affine.CoordinateRing.quotientXYIdealEquiv h.1).toRingEquiv.isField - (Field.toIsField F)) -- have hf : Ideal.inertiaDeg' -- ((WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)).under -- E.CoordinateRing) -- (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)) = 1 := -+ have hf : (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x -+ (Polynomial.C y)).inertiaDeg E.CoordinateRing = 1 := - Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one ch.toAlgHom hfin _ - (WeierstrassCurve.Affine.Point.finrank_quotient_XYIdeal_eq_one h.1) - exact ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one -@@ -484,21 +367,7 @@ theorem Naturality_of_toClassEquiv'_some_eq_relNorm0 - rw [classNorm_toClassEquiv'_some ch hinj hfin h hmem] - exact hpoint x y h hmem - --/-- **Discharging `hnat` from point-map ↔ `comap` agreement (residue degree `1`) — UNCONDITIONAL.** -- --The `Naturality` predicate `hnat` holds whenever, for every rational point `P = (x, y)`, the actual --point map `α.toAddMonoidHom` sends `(x, y)` to a point whose `κ`-class is the contraction --`comap α* 𝔪_{(x,y)}` (the `comap` form of Silverman III.3.4 — exactly what `toClass_toPointMap` --supplies for a *geometric* isogeny whose point map is `toPointMap`). This is the precise reduction --of `hnat` to its remaining content: the `relNorm`-vs-`comap` gap is closed here by the residue --identity `mk0_relNorm0_XYIdeal_eq_mk0_comap`, which is now **`PerfectField`-free** (it routes --through --the shipped `ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one`, valid at `f = 1` with no --`PerfectField`). **No `PerfectField E.FunctionField` hypothesis** — the only residual is the --point-map ↔ `comap` agreement `hpoint`, i.e. Silverman III.3.4 for the *actual* point map (supplied --per isogeny by `toClass_toPointMap` whenever the point map is the geometric `toPointMap`). -- --The basepoint case is automatic (`κ 0 = 0 = ofMul (classNorm 1)`). -/ -+/-- Agreement of the point map with contracted rational-point ideal classes implies naturality of the Picard identification. -/ - theorem Naturality_of_toClassEquiv'_some_eq_comap - (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) - (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) -@@ -536,25 +405,7 @@ theorem Naturality_of_toClassEquiv'_some_eq_comap - mk0_relNorm0_XYIdeal_eq_mk0_comap ch hinj hfin h hmem hcomap] - exact hpoint x y h hcomap - --/-- **UNCONDITIONAL `Naturality` from a `CoordHom` (Silverman III.3.4) — the `hnat` discharge.** -- --Given a coordinate-ring restriction `ch : α.CoordHom` and the **single genuine residual** that the --actual point map `α.toAddMonoidHom` realises the III.3.4 *set-theoretic point image* — i.e. for each --rational `(x, y)` the `κ`-class of `α.toAddMonoidHom (x, y)` is the contraction `comap α* 𝔪_{(x,y)}` --(`hpoint`, exactly what the shipped `toClass_toPointMap` supplies for an isogeny whose point map is --the geometric `toPointMap`) — the full naturality `α.Naturality ch hinj hfin` holds. -- --This is the **unconditional** wiring requested for the Route-C `hnat` discharge: it threads the --divisor-pushforward RHS (`classNorm_toClassEquiv'_some`) through the residue-degree-`1` --identity `relNorm 𝔪 = comap 𝔪`, now **`PerfectField`-free** (`mk0_relNorm0_XYIdeal_eq_mk0_comap` → --`ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one`, `inertiaDeg' = 1` from --`Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one`). The `relNorm`-vs-`comap` --residue bookkeeping is *fully discharged*; the only carried datum is `hpoint`, the point-map ↔ --`comap` agreement (Silverman III.3.4 for the actual point map), which is the genuine per-isogeny / --base-change content (CoordHom data) — **not** a `PerfectField`/Galois obligation. -- --Identical statement to `Naturality_of_toClassEquiv'_some_eq_comap`; provided under the --`naturality_of_coordHom` name the Route-C assembly consumes. -/ -+/-- Naturality follows from the coordinate-ring comorphism and its agreement with the rational-point map. -/ - theorem naturality_of_coordHom - (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) - (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) -@@ -617,7 +468,7 @@ for `β = φ + ψ`. At the point level, with the III.3.4 naturality - composite `picDual ∘ α.toAddMonoidHom` is `κ⁻¹ ∘ (classMap ∘ classNorm) ∘ κ`. - - **Honest scope note.** This is `φ* ∘ φ_*` (extension after norm) — the **opposite** order to the --shipped `classNorm_comp_classMap` (`classNorm ∘ classMap = φ_* ∘ φ*`). The two orders are *not* -+`classNorm_comp_classMap` (`classNorm ∘ classMap = φ_* ∘ φ*`). The two orders are *not* - interchangeable from commutativity of `ClassGroup` alone (`f(g c) = g(f c)` needs `f ∘ g = g ∘ f` - as maps, not a commutative codomain), and mathlib provides only `relNorm_algebraMap` - (`relNorm ∘ map`), **not** `map ∘ relNorm = (·)^n`. The reverse-order class identity -@@ -664,6 +515,7 @@ theorem comp_eq_mulByInt_of_comp_eq_of_surjective - -- `g (f (g Q)) = g (m • Q) = m • g Q`, and the RHS `[m] (g Q) = m • g Q`. - rw [hf, g.map_zsmul, mulByInt_apply] - -+omit [WeierstrassCurve.IsElliptic E] in - /-- **Right-cancellation of a surjective additive point endomorphism (Silverman II.2.3, equality - form).** If `g : E.Point →+ E.Point` is **surjective** and two maps `f₁, f₂` agree after - post-composition with `g` (i.e. `f₁ ∘ g = f₂ ∘ g`), then `f₁ = f₂`. This is the abstract content of -@@ -730,9 +582,9 @@ theorem picDual_comp_toAddMonoidHom_of_surjective_degree (ch : α.CoordHom) - Silverman III.6.1(a)/III.6.2 states the dual is **unique**: `φ̂` is the *only* `δ` with - `δφ = [deg φ]`. The proof is right-cancellation of the surjective (nonconstant) `φ`. We give the - point-map form: --from `(picDual α) ∘ α = [deg α]` (the shipped `picDual_comp_toAddMonoidHom_of_surjective`) and any -+from `(picDual α) ∘ α = [deg α]` (the `picDual_comp_toAddMonoidHom_of_surjective`) and any - hypothetical `β` with `β ∘ α = [deg α]`, the surjection `α` cancels on the right to force --`picDual α = β`. Specialising `β` to the κ-transport of a *shipped* dual isogeny (e.g. the -+`picDual α = β`. Specialising `β` to the κ-transport of a dual isogeny (e.g. the - Verschiebung `V` of Frobenius `π`, with `V ∘ π = [q]` from `IsDualOf V π`) **identifies `picDual π` - with `V`** — the milestone "Pic⁰ dual of Frobenius = Verschiebung". -/ - -@@ -796,26 +648,23 @@ theorem picDual_eq_of_comp_toAddMonoidHom_eq_degree (ch : α.CoordHom) - ((picDual_comp_toAddMonoidHom_of_surjective_degree ch hinj hfin hnat hsurjDual - S S' hSR hS'FF).trans hβ.symm) - --/-! #### Non-circular `picDual` of a *single* isogeny whose degree is independently known -+/-! #### Duals of isogenies with independently known degrees - --The III.6.1(a) uniqueness `picDual_eq_of_comp_toAddMonoidHom_eq_degree` identifies `picDual α` with --any point map `δ` satisfying `δ ∘ α = [deg α]` — **non-circularly whenever `deg α` is known --independently** of the Pic⁰ chain. Two such cases, used to seed the dual algebra for `rπ − s`: -+The uniqueness statement in Silverman III.6.1(a) identifies `picDual α` with -+any point map `δ` satisfying `δ ∘ α = [deg α]`. For Frobenius, its degree -+is the field cardinality `q` and the composition with Verschiebung is `[q]`. -+For scalar multiplication `[n]`, the degree is `n²` and self-composition is -+`[n²]`. - --* **`picDual π = V`** (Frobenius dual = Verschiebung), where `deg π = #K = q` is shipped -- (`frobeniusIsog_degree`) and `V ∘ π = [q]` comes from `IsDualOf V π`. --* **`picDual [n] = [n]`** (scalar self-dual, III.6.2(b)/(d)), where `deg [n] = n²` and -- `[n] ∘ [n] = [n²]` are shipped (`mulByInt_degree`, `mulByInt_comp_eq_mul`). -- --Both are genuinely non-circular: the degree of a *single* Frobenius / scalar is shipped, unlike --`deg(rπ − s)` (which is the Route-C conclusion). They are the seeds for the dual-additivity step --`picDual(rπ − s) = rV − s` — whose *combination* nonetheless needs III.6.2(c) (see the note in --`RouteCGeometric.lean`). -/ -+These degree calculations identify the individual duals without assuming -+the degree formula for `rπ − s`. The further formula -+`picDual(rπ − s) = rV − s` requires dual additivity, Silverman III.6.2(c). -+-/ - - /-- **`picDual α = δ` when `δ ∘ α = [d]` and `α.degree = d` (degree given as data, non-circular).** - --The III.6.1(a) uniqueness specialised to an *explicit integer degree* `d`: if `α.degree = d` (an --**independently-shipped** degree, e.g. `frobeniusIsog_degree`, `mulByInt_degree`) and a point map -+The III.6.1(a) uniqueness specialised to an *explicit integer degree* `d`: if `α.degree = d` (a -+**known** degree, e.g. `frobeniusIsog_degree`, `mulByInt_degree`) and a point map - `δ` satisfies `δ ∘ α = [d]`, then `picDual α = δ`. This is the non-circular seed form (it does not - route through the Pic⁰ push-pull degree, only through the *given* `d`). -/ - theorem picDual_eq_of_comp_toAddMonoidHom_eq_of_degree_eq (ch : α.CoordHom) -@@ -847,11 +696,11 @@ The III.6.2(b) dual-of-composition `(φ∘ψ)^ = ψ̂∘φ̂` specialised to `r - `picDual_eq_of_comp_toAddMonoidHom_eq_of_degree_eq` with the **independently-known** degree - `deg(r • α) = deg α · r²` (`Isogeny.zsmul_degree` / `mulByInt_degree`) and the composite - `(r • δ) ∘ (r • α) = r² • (δ ∘ α) = r² • [deg α] = [r² · deg α]`, where `δ` is the dual value of `α` --(any point map with `δ ∘ α = [deg α]`, e.g. the κ-transport of a shipped `IsDualOf` partner). -+(any point map with `δ ∘ α = [deg α]`, e.g. the κ-transport of a `IsDualOf` partner). - --This is **non-circular**: it routes only through the *given* degree `deg α` (independently shipped -+This is **non-circular**: it routes only through the *given* degree `deg α` (independently - for a single Frobenius / scalar / `α`), never through the Pic⁰ push-pull degree of `r • α`. It is --the generic engine behind the Route-C seed `picDual(rπ) = rV` (take `α = π`, `δ = V`, -+the generic engine behind the dual-additivity seed `picDual(rπ) = rV` (take `α = π`, `δ = V`, - `deg π = #K = q`). - - Residuals: the per-`(r • α)` CoordHom data (`chr` + the two surjectivities + tower `(S, S')`), -@@ -898,10 +747,10 @@ theorem picDual_zsmul_eq_zsmul_of_comp_eq - exact picDual_eq_of_comp_toAddMonoidHom_eq_of_degree_eq chr hinjr hfinr hnatr hsurjDualr - hsurjr S S' hSR hS'FF hdeg hcomp - --/-- **`picDual(r • α) = r • α̂` from a shipped `IsDualOf` partner (route-2 seed, `IsDualOf` form).** -+/-- **`picDual(r • α) = r • α̂` from a `IsDualOf` partner (route-2 seed, `IsDualOf` form).** - - As `picDual_zsmul_eq_zsmul_of_comp_eq`, but taking the dual value of `α` in the *full-isogeny* --`IsDualOf δ_isog α` form (`δ_isog ∘ α = [deg α]`), which is how the Route-C Vieta bundle supplies it -+`IsDualOf δ_isog α` form (`δ_isog ∘ α = [deg α]`), which is how the dual-additivity Vieta bundle supplies it - (e.g. `IsDualOf V π`). Concludes `picDual(r • α) = r • δ_isog` at the point-map level. -/ - theorem picDual_zsmul_eq_zsmul_of_isDual - {α δ_isog : Isogeny E E} (r : ℤ) (hr : r ≠ 0) -@@ -932,10 +781,10 @@ The Silverman III.8 trace relation `α + α̂ = [tr α]` *determines* `α̂` onc - `δ` satisfies the *same* relation `α + δ = [tr α]`: subtract `α` to get `α̂ = [tr α] − α = δ`. This - is a pure point-group cancellation (no degree, no uniqueness, **non-circular**). - --It is the final algebraic step of the Route-C dual-additivity output `picDual(rπ−s) = rV − s`: with -+It is the final algebraic step of the dual-additivity dual-additivity output `picDual(rπ−s) = rV − s`: with - `α = rπ − s`, the irreducible input `htrace_dual` is III.8 for `α` (equivalently III.6.2(c) - additivity, since `tr(rπ−s) = r·t − 2s`), while the candidate identity `htrace_delta` --(`α + (rV − s) = [r·t − 2s]`) is derived *non-circularly* from the shipped `π + V = [t]`. This -+(`α + (rV − s) = [r·t − 2s]`) is derived *non-circularly* from the `π + V = [t]`. This - lemma performs the subtraction generically. -/ - theorem picDual_eq_of_trace_relations (ch : α.CoordHom) - (hinj : Function.Injective ch.toAlgHom) -@@ -958,7 +807,7 @@ maps).** - The point-map identity `(r·π − s) + (r·V − s) = [r·t − 2s]` for abstract endomorphisms `π, V` of - `E.Point` satisfying `π + V = [t]` (the Frobenius trace relation). This is the **non-circular** - half --of the Route-C dual-additivity output: pointwise -+of the dual-additivity dual-additivity output: pointwise - `r·π P − s·P + r·V P − s·P = r·(π P + V P) − 2s·P = r·(t·P) − 2s·P = (r·t − 2s)·P`. - - It carries no `picDual` and no degree — pure point-group algebra from `hsum` — and is the candidate -@@ -990,8 +839,8 @@ Pic⁰ dual `picDual α` equals `r·V − s` — *provided* the Silverman III.8 - `htrace_dual` is the **single irreducible residual** (Silverman III.8 for `α`, equivalently - III.6.2(c) additivity since `tr α = r·t − 2s`); everything else — the candidate trace half - `smul_sub_add_smul_sub_eq_mulByInt` — is **non-circular** from `hsum`. This is the engine that --discharges the Route-C `hpicval` (take `α = rπ − s`, `π = π.toAddMonoidHom`, `V = V.toAddMonoidHom`; --`hbeta` is the `rfl`-true `genuineIsogSmulSub_toAddMonoidHom`-shape and `hsum` the shipped -+discharges the dual-additivity `hpicval` (take `α = rπ − s`, `π = π.toAddMonoidHom`, `V = V.toAddMonoidHom`; -+`hbeta` is the `rfl`-true `genuineIsogSmulSub_toAddMonoidHom`-shape and `hsum` the - `π + V = [t]`). The per-piece `picDual` values `picDual π = V`, `picDual(rπ) = rV`, - `picDual [n] = [n]` (the non-circular seeds) are exactly what `htrace_dual` decomposes into. -/ - theorem picDual_eq_smul_sub_of_sum_trace (ch : α.CoordHom) -diff --git a/projects/HasseWeil/HasseWeil/Pic0/ToClassSurjective.lean b/projects/HasseWeil/HasseWeil/Pic0/ToClassSurjective.lean -index 31ceaa04d..e7193a4aa 100644 ---- a/projects/HasseWeil/HasseWeil/Pic0/ToClassSurjective.lean -+++ b/projects/HasseWeil/HasseWeil/Pic0/ToClassSurjective.lean -@@ -9,88 +9,6 @@ import Mathlib.RingTheory.OrderOfVanishing.Basic - import Mathlib.RingTheory.Polynomial.DegreeLT - import HasseWeil.Foundation.Ramification - --/-! --# Surjectivity of `Point.toClass` and the isomorphism `E ≅ Pic⁰(E)` (affine model) -- --For a Weierstrass curve `W : WeierstrassCurve.Affine F` over a field `F`, mathlib provides the --group homomorphism -- --``` --WeierstrassCurve.Affine.Point.toClass : W.Point →+ Additive (ClassGroup W.CoordinateRing) --``` -- --(`Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean`) sending the point at infinity to `0` --and an affine point `P = (x, y)` to the class of the fractional ideal `⟨X - x, Y - y⟩`. Mathlib --proves this is **injective** (`WeierstrassCurve.Affine.Point.toClass_injective`), realising --`W.Point` as a subgroup of the affine ideal class group. It does **not** prove surjectivity. -- --This file packages the surjectivity. The statement that every ideal class is the class of some --`XYIdeal'` (or trivial) is the genus-1 divisor-reduction theorem: on a smooth genus-1 curve every --degree-0 divisor class is represented by `(P) - (O)`. We isolate that statement as the --predicate `ClassRepresentableByPoints W` and prove that it is *equivalent* to surjectivity of --`toClass`, and that surjectivity packages into the group isomorphism --`W.Point ≃+ Additive (ClassGroup W.CoordinateRing)`. -- --## Main definitions -- --* `WeierstrassCurve.Affine.Point.ClassRepresentableByPoints`: the predicate that every element of -- `ClassGroup W.CoordinateRing` is trivial or the class of `XYIdeal' h` for a nonsingular point. --* `WeierstrassCurve.Affine.Point.ClassReducesToCodimLEOne`: the genus-1 reduction input — every -- nonzero integral ideal class has a representative of `F`-codimension `≤ 1`. This is now **proved -- unconditionally** (`classReducesToCodimLEOne_holds`). --* `WeierstrassCurve.Affine.Point.toClassEquiv'`: the **unconditional** group isomorphism -- `W.Point ≃+ Additive (ClassGroup W.CoordinateRing)` for `[W.IsElliptic]`, built from injectivity + -- the unconditional surjectivity `toClass_surjective'`. -- --## Main results -- --The **norm-degree dictionary** (the surjectivity counterpart of mathlib's `natDegree_norm_ne_one`, --which powers `toClass_injective`), all axiom-clean: -- --* `eq_XYIdeal_of_finrank_quotient_eq_one`: every nonzero ideal `I` with `finrank F (R/I) = 1` is -- the point ideal `XYIdeal W x (C y)` of a (necessarily nonsingular, under `[W.IsElliptic]`) point. --* `mk0_eq_one_of_finrank_quotient_eq_zero` and -- `mk0_eq_mk_XYIdeal'_of_finrank_quotient_eq_one`: the two codimension endpoints, identifying -- codimension `0` (resp. `1`) ideals with the trivial class (resp. a point class). --* `integralIdealRepresentableByPoints_of_classReducesToCodimLEOne` and -- `toClass_surjective_of_classReducesToCodimLEOne`: the codimension reduction predicate implies the -- integral-ideal reduction, hence surjectivity of `toClass` (using the now axiom-clean Dedekind -- instance `HasseWeil.coordinateRing_isDedekindDomain`). -- --and the unconditional headline results: -- --* `toClass_surjective'`: **unconditional** surjectivity of `toClass` for `[W.IsElliptic]`. --* `toClassEquiv'`: the **unconditional** isomorphism `W.Point ≃+ Pic⁰(E)`. -- --## Implementation notes -- --The full unconditional surjectivity reduces, via three landed and axiom-clean ingredients, to the --genus-1 codimension reduction `ClassReducesToCodimLEOne`, which is **now also proved**. -- --1. `IsDedekindDomain W.CoordinateRing` is **available and axiom-clean** via -- `HasseWeil.coordinateRing_isDedekindDomain` (imported here), which fires under `[W.IsElliptic]`. -- --2. **The ring-theoretic codimension infrastructure** (field-agnostic, no `[Fintype F]`): -- * `finiteDimensional_quotient_of_ne_bot`: every nonzero ideal has finite `F`-codimension. -- * `finrank_quotient_smul`: codimension additivity for multiplication by a *principal* ideal. -- * `finrank_quotient_mul`: the **general** codimension additivity -- `finrank F (R ⧸ I·J) = finrank F (R ⧸ I) + finrank F (R ⧸ J)` for arbitrary nonzero `I, J`, -- via the short exact sequence `0 → I/(I·J) → R/(I·J) → R/I → 0` -- (`Submodule.quotientQuotientEquivQuotient` + `Submodule.finrank_quotient_add_finrank`) and the -- invertible-ideal kernel isomorphism `quotIdealMulEquiv : I/(I·J) ≃ R/J` built from mathlib's -- `FractionalIdeal.quotientEquiv`. -- --3. **The genus-1 reduction proper**, `classReducesToCodimLEOne_holds`: every nonzero integral ideal -- class has a representative of `F`-codimension `≤ 1` (Riemann–Roch for `g = 1`). Proved from the -- concrete Riemann–Roch inequality `exists_mem_norm_natDegree_le` (every nonzero ideal `I` has a -- nonzero element of norm degree `≤ finrank F (R ⧸ I) + 1`, by an exact `F`-dimension count using -- `CoordinateRing.degree_norm_smul_basis` and rank–nullity) plus the general additivity (2): from a -- small-norm element of a representative of the inverse class, the Dedekind factorisation -- `(a) = I'·J` yields a codimension-`≤ 1` representative of the class. -- --Everything in this file is `#print axioms`-clean (`[propext, Classical.choice, Quot.sound]`), --including the unconditional `toClass_surjective'` and `toClassEquiv'`. ---/ - - open Polynomial Module - -@@ -240,10 +158,8 @@ theorem eq_of_le_of_finrank_quotient_eq {I J : Ideal W.CoordinateRing} (hJI : J - exact (Submodule.Quotient.mk_eq_zero _).mp hr0 - - omit [DecidableEq F] in --/-- **An `F`-algebra hom `R → F` from a codimension-1 quotient.** If `R/I` is 1-dimensional over the --field `F`, then `algebraMap F (R/I)` is an isomorphism, and composing its inverse with the quotient --map gives an `F`-algebra hom `φ : R →ₐ[F] F` whose kernel is exactly `I`. Evaluating `φ` at the --images of `X` and `Y` will produce the point. -/ -+ -+ - theorem exists_algHom_ker_eq_of_finrank_quotient_eq_one (I : Ideal W.CoordinateRing) - [Nontrivial (W.CoordinateRing ⧸ I)] - (hfin : Module.finrank F (W.CoordinateRing ⧸ I) = 1) : -@@ -289,8 +205,8 @@ theorem equation_of_algHom (φ : W.CoordinateRing →ₐ[F] F) : - exact heq.symm - - omit [DecidableEq F] in --/-- The images of `X - x` and `Y - y` in `R` lie in the kernel of `φ` whenever --`x = φ(X̄)` and `y = φ(Ȳ)`. -/ -+ -+ - theorem algHom_XClass_eq_zero (φ : W.CoordinateRing →ₐ[F] F) : - φ (CoordinateRing.XClass W (φ (CoordinateRing.mk W (C X)))) = 0 := by - set x := φ (CoordinateRing.mk W (C X)) with hx -@@ -303,7 +219,7 @@ theorem algHom_XClass_eq_zero (φ : W.CoordinateRing →ₐ[F] F) : - rw [Algebra.algebraMap_self_apply, sub_self] - - omit [DecidableEq F] in --/-- The image of `Y - y` in `R` lies in the kernel of `φ` whenever `y = φ(Ȳ)`. -/ -+ - theorem algHom_YClass_eq_zero (φ : W.CoordinateRing →ₐ[F] F) : - φ (CoordinateRing.YClass W (C (φ (CoordinateRing.mk W Y)))) = 0 := by - set y := φ (CoordinateRing.mk W Y) with hy -@@ -328,9 +244,9 @@ theorem eq_XYIdeal_of_finrank_quotient_eq_one [W.IsElliptic] (I : Ideal W.Coordi - set y := φ (CoordinateRing.mk W Y) with hy - have hEq : W.Equation x y := equation_of_algHom φ - have hNS : W.Nonsingular x y := (equation_iff_nonsingular).mp hEq -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ CoordinateRing.XYIdeal W x (C y)) := -+ have : FiniteDimensional F (W.CoordinateRing ⧸ CoordinateRing.XYIdeal W x (C y)) := - finiteDimensional_quotient_XYIdeal hEq -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ I) := -+ have : FiniteDimensional F (W.CoordinateRing ⧸ I) := - Module.finite_of_finrank_eq_succ hfin - refine ⟨x, y, hNS, ?_⟩ - have hsub : CoordinateRing.XYIdeal W x (C y) ≤ I := by -@@ -352,9 +268,7 @@ theorem finiteDimensional_quotient_of_ne_bot [W.IsElliptic] (I : Ideal W.Coordin - classical - exact Module.Finite.equiv (Ideal.quotientEquivDirectSum F (CoordinateRing.basis W) hI).symm - --/-- **The degree of an ideal of `F[X]`.** For an ideal `J` of the PID `F[X]`, the natural degree of --its monic generator. On `⊥` it is `0`; on a nonzero ideal `⟨g⟩` it is `g.natDegree`. This packages --the codimension `finrank F (F[X] ⧸ J)` purely polynomially. -/ -+ - noncomputable def idealNatDegree (J : Ideal F[X]) : ℕ := - (Submodule.IsPrincipal.generator J).natDegree - -@@ -422,10 +336,10 @@ theorem finrank_quotient_eq_sum_smithCoeffs [W.IsElliptic] (I : Ideal W.Coordina - Module.finrank F (W.CoordinateRing ⧸ I) - = ∑ i, (Ideal.smithCoeffs (CoordinateRing.basis W) I hI i).natDegree := by - classical -- haveI hFree : ∀ i, Module.Free F -+ have hFree : ∀ i, Module.Free F - (F[X] ⧸ Ideal.span ({Ideal.smithCoeffs (CoordinateRing.basis W) I hI i} : Set F[X])) := - fun i ↦ inferInstance -- haveI hFin : ∀ i, Module.Finite F -+ have hFin : ∀ i, Module.Finite F - (F[X] ⧸ Ideal.span ({Ideal.smithCoeffs (CoordinateRing.basis W) I hI i} : Set F[X])) := - fun i ↦ inferInstance - rw [Ideal.finrank_quotient_eq_sum (I := I) (hI := hI) F (CoordinateRing.basis W)] -@@ -443,12 +357,8 @@ theorem smul_ideal_eq_span_mul (a : W.CoordinateRing) (I : Ideal W.CoordinateRin - · rintro ⟨z, hz, rfl⟩; exact ⟨z, hz, by rw [smul_eq_mul]⟩ - - omit [DecidableEq F] in --/-- **Codimension additivity for multiplication by a principal ideal.** For a nonzero `a ∈ R` and a --nonzero ideal `I`, `finrank F (R ⧸ ⟨a⟩·I) = finrank F (R ⧸ I) + finrank F (R ⧸ ⟨a⟩)`. This is the --additivity of `F`-codimension along the multiplication-by-`a` short exact sequence --`R ⧸ I → R ⧸ (a•I) → R ⧸ ⟨a⟩` (`Ideal.mulQuot`/`Ideal.quotOfMul`, restricted to `F`-linear maps and --fed to `Module.length_eq_add_of_exact`, with `Module.length F = finrank F` over the field `F`). --It is the special case of the genus-1 norm-degree additivity for a principal factor. -/ -+ -+ - theorem finrank_quotient_smul [W.IsElliptic] {a : W.CoordinateRing} (ha : a ≠ 0) - (I : Ideal W.CoordinateRing) (hI : I ≠ ⊥) : - Module.finrank F (W.CoordinateRing ⧸ (a • I)) = -@@ -459,17 +369,17 @@ theorem finrank_quotient_smul [W.IsElliptic] {a : W.CoordinateRing} (ha : a ≠ - have haspan : Ideal.span ({a} : Set W.CoordinateRing) ≠ ⊥ := by - rwa [Ne, Ideal.span_singleton_eq_bot] - have haI : a • I ≠ ⊥ := by rw [smul_ideal_eq_span_mul]; exact mul_ne_zero haspan hI -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ Ideal.span ({a} : Set W.CoordinateRing)) := -+ have : FiniteDimensional F (W.CoordinateRing ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI -+ have : FiniteDimensional F (W.CoordinateRing ⧸ Ideal.span ({a} : Set W.CoordinateRing)) := - finiteDimensional_quotient_of_ne_bot _ haspan -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ (a • I)) := -+ have : FiniteDimensional F (W.CoordinateRing ⧸ (a • I)) := - finiteDimensional_quotient_of_ne_bot _ haI - have hlen := Module.length_eq_add_of_exact - ((Ideal.mulQuot a I).restrictScalars F) ((Ideal.quotOfMul a I).restrictScalars F) - (Ideal.mulQuot_injective I hanz) (Ideal.quotOfMul_surjective I) - (Ideal.exact_mulQuot_quotOfMul I) - rw [Module.length_eq_finrank, Module.length_eq_finrank, Module.length_eq_finrank, -- ← Nat.cast_add, ENat.coe_inj] at hlen -+ ← Nat.cast_add, ENat.natCast_inj] at hlen - exact hlen - - omit [DecidableEq F] in -@@ -554,10 +464,8 @@ private noncomputable def quotEquivOneCoeIdealQuot_aux [W.IsElliptic] {J : Ideal - exact hry - - omit [DecidableEq F] in --/-- **The invertible-ideal quotient isomorphism `I/(I·J) ≃ R/J`.** For nonzero ideals `I, J` of the --(Dedekind) coordinate ring `R`, the `R`-module quotient of the ideal `I` (viewed as a submodule of --`R`) by its submodule `I·J` is `R`-linearly isomorphic to `R/J`; this holds because `I` is --invertible. -/ -+ -+ - noncomputable def quotIdealMulEquiv [W.IsElliptic] {I J : Ideal W.CoordinateRing} - (hI : I ≠ ⊥) (hJ : J ≠ ⊥) : - ((I : Submodule W.CoordinateRing W.CoordinateRing) ⧸ -@@ -582,23 +490,17 @@ noncomputable def quotIdealMulEquiv [W.IsElliptic] {I J : Ideal W.CoordinateRing - (eqe.trans (quotEquivOneCoeIdealQuot_aux hinj).symm) - - omit [DecidableEq F] in --/-- **General codimension additivity.** For arbitrary nonzero ideals `I, J` of --`R := W.CoordinateRing`, --`finrank F (R ⧸ I·J) = finrank F (R ⧸ I) + finrank F (R ⧸ J)`. This upgrades `finrank_quotient_smul` --(the principal-factor case) to all factors, via the short exact sequence --`0 → I/(I·J) → R/(I·J) → R/I → 0` (`Submodule.quotientQuotientEquivQuotient` + --`Submodule.finrank_quotient_add_finrank`) together with the invertible-ideal kernel identification --`I/(I·J) ≃ R/J` (`quotIdealMulEquiv`). It is the genus-1 norm-degree additivity in `F`-codimension --form. -/ -+ -+ - theorem finrank_quotient_mul [W.IsElliptic] {I J : Ideal W.CoordinateRing} - (hI : I ≠ ⊥) (hJ : J ≠ ⊥) : - Module.finrank F (W.CoordinateRing ⧸ (I * J)) = - Module.finrank F (W.CoordinateRing ⧸ I) + Module.finrank F (W.CoordinateRing ⧸ J) := by - have hIJ : I * J ≠ ⊥ := mul_ne_zero hI hJ -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ (I * J)) := -+ have : FiniteDimensional F (W.CoordinateRing ⧸ (I * J)) := - finiteDimensional_quotient_of_ne_bot _ hIJ -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ J) := finiteDimensional_quotient_of_ne_bot _ hJ -+ have : FiniteDimensional F (W.CoordinateRing ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI -+ have : FiniteDimensional F (W.CoordinateRing ⧸ J) := finiteDimensional_quotient_of_ne_bot _ hJ - have hIJ_le : I * J ≤ I := Ideal.mul_le_left - set M : Submodule (W.CoordinateRing) (W.CoordinateRing ⧸ (I * J)) := - Submodule.map (Submodule.mkQ (I * J)) -@@ -620,7 +522,7 @@ theorem finrank_quotient_mul [W.IsElliptic] {I J : Ideal W.CoordinateRing} - have e3 : (LinearMap.range g) ≃ₗ[R] M := LinearEquiv.ofEq _ _ hrange - exact ((Submodule.quotEquivOfEq _ _ hker.symm).trans (g.quotKerEquivRange.trans e3)).symm - have eM : M ≃ₗ[W.CoordinateRing] (W.CoordinateRing ⧸ J) := e2a.trans (quotIdealMulEquiv hI hJ) -- haveI : FiniteDimensional F M := (eM.restrictScalars F).symm.finiteDimensional -+ have : FiniteDimensional F M := (eM.restrictScalars F).symm.finiteDimensional - have key : Module.finrank F ((W.CoordinateRing ⧸ (I * J)) ⧸ (M.restrictScalars F)) - + Module.finrank F (M.restrictScalars F) = Module.finrank F (W.CoordinateRing ⧸ (I * J)) := - Submodule.finrank_quotient_add_finrank (M.restrictScalars F) -@@ -666,7 +568,7 @@ theorem mk0_eq_mk_XYIdeal'_of_finrank_quotient_eq_one [W.IsElliptic] (J : Ideal - (hfin : Module.finrank F (W.CoordinateRing ⧸ J) = 1) : - ∃ (x y : F) (h : W.Nonsingular x y), - ClassGroup.mk0 ⟨J, hmem⟩ = ClassGroup.mk W.FunctionField (CoordinateRing.XYIdeal' h) := by -- haveI : Nontrivial (W.CoordinateRing ⧸ J) := Module.nontrivial_of_finrank_eq_succ hfin -+ have : Nontrivial (W.CoordinateRing ⧸ J) := Module.nontrivial_of_finrank_eq_succ hfin - obtain ⟨x, y, h, hJ⟩ := eq_XYIdeal_of_finrank_quotient_eq_one J hfin - have hmem' : CoordinateRing.XYIdeal W x (C y) ∈ (Ideal W.CoordinateRing)⁰ := hJ ▸ hmem - refine ⟨x, y, h, ?_⟩ -@@ -723,10 +625,7 @@ private theorem two_nsmul_degree_le' {p : F[X]} {n : ℕ} (hp : p.degree < (n : - rw [nsmul_eq_mul]; push_cast; ring, Nat.cast_le] - lia - --/-- **The basis-combination map** `(p, q) ↦ p · 1 + q · Ȳ`, restricted to polynomials of bounded --degree (`degreeLT F a × degreeLT F b`), as an `F`-linear map into `R`. Its image is the space of --elements whose norm degree we can control; its kernel intersected with the codimension count gives --the Riemann–Roch element. -/ -+ - noncomputable def basisCombMap (W : WeierstrassCurve.Affine F) (a b : ℕ) : - (Polynomial.degreeLT F a × Polynomial.degreeLT F b) →ₗ[F] W.CoordinateRing where - toFun pq := (pq.1 : F[X]) • (1 : W.CoordinateRing) + (pq.2 : F[X]) • (CoordinateRing.basis W 1) -@@ -780,19 +679,15 @@ theorem basisCombMap_ne_zero {a b : ℕ} (pq : Polynomial.degreeLT F a × Polyno - exact Prod.ext (Subtype.ext hp) (Subtype.ext hq) - - omit [DecidableEq F] in --/-- **The genus-1 Riemann–Roch inequality (concrete form).** Every nonzero ideal `I` of --`R := W.CoordinateRing` contains a nonzero element `a` with `(Algebra.norm F[X] a).natDegree ≤ --finrank F (R ⧸ I) + 1`. This is `ℓ(D) ≥ deg D` for `g = 1` made explicit, proved by the exact --`F`-dimension count: the bounded-degree basis combinations form an `F`-subspace of dimension --`ℓ + 1 > ℓ = finrank F (R ⧸ I)`, so rank–nullity for its composite into `R ⧸ I` forces a nonzero --kernel element. No finiteness of `F` is needed (`F[X]` is Euclidean). -/ -+ -+ - theorem exists_mem_norm_natDegree_le [W.IsElliptic] (I : Ideal W.CoordinateRing) (hI : I ≠ ⊥) : - ∃ a ∈ I, a ≠ 0 ∧ - (Algebra.norm F[X] a).natDegree ≤ Module.finrank F (W.CoordinateRing ⧸ I) + 1 := by - classical - set R := W.CoordinateRing - set ℓ := Module.finrank F (R ⧸ I) with hℓ -- haveI : FiniteDimensional F (R ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI -+ have : FiniteDimensional F (R ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI - obtain ⟨da, hda⟩ : ∃ da, da = (ℓ + 1) / 2 + 1 := ⟨_, rfl⟩ - obtain ⟨db, hdb⟩ : ∃ db, db = ℓ / 2 := ⟨_, rfl⟩ - set ψ : (Polynomial.degreeLT F da × Polynomial.degreeLT F db) →ₗ[F] (R ⧸ I) := -@@ -809,7 +704,7 @@ theorem exists_mem_norm_natDegree_le [W.IsElliptic] (I : Ideal W.CoordinateRing) - have hrange_le : Module.finrank F (LinearMap.range ψ) ≤ ℓ := - le_trans (Submodule.finrank_le _) (le_of_eq hℓ.symm) - have hker_pos : 0 < Module.finrank F (LinearMap.ker ψ) := by lia -- haveI : Nontrivial (LinearMap.ker ψ) := Module.nontrivial_of_finrank_pos hker_pos -+ have : Nontrivial (LinearMap.ker ψ) := Module.nontrivial_of_finrank_pos hker_pos - obtain ⟨z, hz⟩ := exists_ne (0 : LinearMap.ker ψ) - set pq := (z : Polynomial.degreeLT F da × Polynomial.degreeLT F db) with hpq - have hpq_ne : pq ≠ 0 := fun h ↦ hz (Subtype.ext h) -@@ -873,7 +768,7 @@ theorem classReducesToCodimLEOne_holds [W.IsElliptic] : - rw [hI', inv_inv] at hmk0 - rcases Nat.le_one_iff_eq_zero_or_eq_one.mp hfinle with h0 | h1 - · left -- haveI : FiniteDimensional F (W.CoordinateRing ⧸ J) := -+ have : FiniteDimensional F (W.CoordinateRing ⧸ J) := - finiteDimensional_quotient_of_ne_bot _ (mem_nonZeroDivisors_iff_ne_zero.mp hJmem) - have hone : ClassGroup.mk0 ⟨J, hJmem⟩ = 1 := - mk0_eq_one_of_finrank_quotient_eq_zero J hJmem h0 +diff --git a/lakefile.toml b/lakefile.toml +index 2bca04769..e4a5c654b 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -12,7 +12,7 @@ pp.unicode.fun = true # universal across all origin projects + [[require]] + name = "mathlib" + git = "https://github.com/leanprover-community/mathlib4.git" +-rev = "e4b72ca0d01c" # daily steady-state bump 2026-08-25, toolchain v4.34.0-rc2 ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" # Zauner compatibility: Lean/Mathlib v4.34.1 + + # ───────────────────────── shared, refactored-out lemmas ───────────────────────── + [[lean_lib]] +@@ -85,7 +85,6 @@ globs = ["CebotarevDensity"] + [lean_lib.leanOptions] + autoImplicit = false + relaxedAutoImplicit = false +-maxSynthPendingDepth = 3 + + # ───────── Belabas–Friedman: effective residue of the Dedekind zeta function ───────── + # Imports mathlib (and CebotarevDensity for the ζ_K Euler product); built on demand. +diff --git a/lean-toolchain b/lean-toolchain +index b814d987e..ba8ebf2db 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.34.0-rc2 ++leanprover/lean4:v4.34.1 +diff --git a/projects/Chebotarev/CebotarevDensity/Abelian.lean b/projects/Chebotarev/CebotarevDensity/Abelian.lean +index ceca8bdf6..497e8ecc3 100644 +--- a/projects/Chebotarev/CebotarevDensity/Abelian.lean ++++ b/projects/Chebotarev/CebotarevDensity/Abelian.lean +@@ -233,13 +233,13 @@ private theorem prime_dvd_natAbs_discr_cyclotomic_dvd + (E : Type*) [Field E] [NumberField E] (m : ℕ) [NeZero m] [IsCyclotomicExtension {m} ℚ E] + {p : ℕ} (hp : p.Prime) (hpd : p ∣ (NumberField.discr E).natAbs) : p ∣ m := by + by_contra hpm +- haveI : Fact (Nat.Prime p) := ⟨hp⟩ ++ have : Fact (Nat.Prime p) := ⟨hp⟩ + have hpprime : Prime (p : ℤ) := Nat.prime_iff_prime_int.mp hp + refine absurd (Int.ofNat_dvd_left.mpr hpd) ?_ + rw [NumberField.not_dvd_discr_iff_forall_liesOver E (𝓞 E) hpprime] + intro P hPmax hlo +- haveI := hPmax.isPrime +- haveI := hlo ++ have := hPmax.isPrime ++ have := hlo + have hspanbot : Ideal.span {(p : ℤ)} ≠ ⊥ := by + rw [Ne, Ideal.span_singleton_eq_bot]; exact hpprime.ne_zero + have hPbot : P ≠ ⊥ := Ideal.ne_bot_of_liesOver_of_ne_bot hspanbot P +@@ -263,9 +263,9 @@ private theorem cyclotomicField_finrank_eq + (Set.mem_singleton m) (NeZero.ne m) + set K₁ : IntermediateField ℚ M := IntermediateField.adjoin ℚ {ζ} with hK₁def + set K₂ : IntermediateField ℚ M := (IsScalarTower.toAlgHom ℚ K M).fieldRange with hK₂def +- haveI hK₁cyc : IsCyclotomicExtension {m} ℚ K₁ := ++ have hK₁cyc : IsCyclotomicExtension {m} ℚ K₁ := + hζ.intermediateField_adjoin_isCyclotomicExtension (K := ℚ) +- haveI : IsGalois ℚ K₁ := IsCyclotomicExtension.isGalois (S := {m}) (K := ℚ) (L := K₁) ++ have : IsGalois ℚ K₁ := IsCyclotomicExtension.isGalois (S := {m}) (K := ℚ) (L := K₁) + have hfinK₁ : Module.finrank ℚ K₁ = m.totient := + IsCyclotomicExtension.finrank K₁ (Polynomial.cyclotomic.irreducible_rat (NeZero.pos m)) + have hsup : K₁ ⊔ K₂ = ⊤ := by +@@ -317,8 +317,8 @@ private theorem compositum_charProd_bijective + [IsGalois K L] [IsGalois K M] (m : ℕ) [NeZero m] [IsCyclotomicExtension {m} L M] + (hcop : ((NumberField.discr L).natAbs).Coprime m) (ζ : M) (hζ : IsPrimitiveRoot ζ m) : + Function.Bijective ((AlgEquiv.restrictNormalHom L).prod (hζ.autToPow K)) := by +- haveI : FiniteDimensional K M := inferInstance +- haveI : IsGalois L M := IsGalois.tower_top_of_isGalois K L M ++ have : FiniteDimensional K M := inferInstance ++ have : IsGalois L M := IsGalois.tower_top_of_isGalois K L M + set χK : Gal(M/K) →* (ZMod m)ˣ := hζ.autToPow K with hχK + set Φ : Gal(M/K) →* Gal(L/K) × (ZMod m)ˣ := + (AlgEquiv.restrictNormalHom L).prod χK with hΦ +@@ -372,8 +372,8 @@ private theorem autToPow_L_bijective + [IsGalois K L] [IsGalois K M] (m : ℕ) [NeZero m] [IsCyclotomicExtension {m} L M] + (hcop : ((NumberField.discr L).natAbs).Coprime m) (ζ : M) (hζ : IsPrimitiveRoot ζ m) : + Function.Bijective (hζ.autToPow L) := by +- haveI : FiniteDimensional K M := inferInstance +- haveI : IsGalois L M := IsGalois.tower_top_of_isGalois K L M ++ have : FiniteDimensional K M := inferInstance ++ have : IsGalois L M := IsGalois.tower_top_of_isGalois K L M + have hML : Module.finrank L M = m.totient := cyclotomicField_finrank_eq L M m hcop + have hcardML : Nat.card Gal(M/L) = Nat.card (ZMod m)ˣ := by + rw [IsGalois.card_aut_eq_finrank L M, hML, Nat.card_eq_fintype_card, +@@ -426,7 +426,7 @@ private theorem compositum_isCyclotomic_over_fixedField + (IntermediateField.adjoin_le_iff.mpr (Set.singleton_subset_iff.mpr + (IntermediateField.subset_adjoin K _ hζ.pow_eq_one))) + (IntermediateField.adjoin_le_iff.mpr fun x hx ↦ by +- obtain ⟨i, -, rfl⟩ := hζ.eq_pow_of_pow_eq_one (Set.mem_setOf_eq ▸ hx) ++ obtain ⟨i, -, rfl⟩ := hζ.eq_pow_of_pow_eq_one (Set.mem_ofPred_eq ▸ hx) + exact pow_mem (IntermediateField.subset_adjoin K _ (Set.mem_singleton ζ)) i) + have hsup : (F ⊔ Kμ).fixingSubgroup = ⊥ := by + rw [IntermediateField.fixingSubgroup_sup, IntermediateField.fixingSubgroup_fixedField, _hmeet] +@@ -437,8 +437,8 @@ private theorem compositum_isCyclotomic_over_fixedField + apply IntermediateField.restrictScalars_injective K + rw [IntermediateField.restrictScalars_adjoin_eq_sup, hadjζ, htop] + rfl +- haveI : Algebra.IsIntegral ↥F M := Algebra.IsIntegral.of_finite ↥F M +- haveI hcyc : IsCyclotomicExtension {m} ↥F (IntermediateField.adjoin (↥F) {ζ}) := ++ have : Algebra.IsIntegral ↥F M := Algebra.IsIntegral.of_finite ↥F M ++ have hcyc : IsCyclotomicExtension {m} ↥F (IntermediateField.adjoin (↥F) {ζ}) := + IsPrimitiveRoot.intermediateField_adjoin_isCyclotomicExtension (K := ↥F) hζ + rw [htopF] at hcyc + exact IsCyclotomicExtension.equiv (S := {m}) (A := ↥F) (f := IntermediateField.topEquiv) +@@ -454,7 +454,7 @@ private theorem smul_algebraMap_eq_repl + [Algebra K L] [Algebra K M] [Algebra L M] [IsScalarTower K L M] + [IsGalois K L] [IsGalois K M] (σ : Gal(M/K)) (y : 𝓞 L) : + σ • (algebraMap (𝓞 L) (𝓞 M) y) = algebraMap (𝓞 L) (𝓞 M) ((σ.restrictNormal L) • y) := by +- haveI : IsScalarTower (𝓞 K) (𝓞 L) (𝓞 M) := inferInstance ++ have : IsScalarTower (𝓞 K) (𝓞 L) (𝓞 M) := inferInstance + have hbridgeM : ∀ (g : M ≃ₐ[K] M) (x : 𝓞 M), ((g • x : 𝓞 M) : M) = g • (x : M) := fun g x ↦ + by simpa [Algebra.smul_def] using + (smul_distrib_smul (G := M ≃ₐ[K] M) (R := 𝓞 M) (S := M) g x 1).symm +@@ -479,7 +479,7 @@ private theorem isArithFrobAt_restrictNormal_repl + [IsGalois K L] [IsGalois K M] (σ : Gal(M/K)) (𝔓 : Ideal (𝓞 M)) + (hσ : IsArithFrobAt (𝓞 K) σ 𝔓) : + IsArithFrobAt (𝓞 K) (σ.restrictNormal L) (𝔓.under (𝓞 L)) := by +- haveI : IsScalarTower (𝓞 K) (𝓞 L) (𝓞 M) := inferInstance ++ have : IsScalarTower (𝓞 K) (𝓞 L) (𝓞 M) := inferInstance + have hunder : (𝔓.under (𝓞 L)).under (𝓞 K) = 𝔓.under (𝓞 K) := Ideal.under_under 𝔓 + intro y + rw [hunder, Ideal.under, Ideal.mem_comap, map_sub, map_pow, +@@ -495,16 +495,16 @@ private theorem frobeniusClass_proj_isPrime_aux + (_hfr : frobeniusClass K M 𝔭 = ConjClasses.mk τM) : + frobeniusClass K L 𝔭 = ConjClasses.mk σ := by + obtain ⟨𝔓, h𝔓p, h𝔓lo, -⟩ := exists_prime_liesOver K M 𝔭 (UnramifiedIn.ne_bot K M _hunrM) +- haveI := h𝔓p +- haveI := h𝔓lo +- haveI : Finite (𝓞 M ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 ++ have := h𝔓p ++ have := h𝔓lo ++ have : Finite (𝓞 M ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 + (ne_bot_of_ramificationIdx_eq_one K M (UnramifiedIn.ramificationIdx_eq_one K M _hunrM 𝔓 h𝔓lo)) + set σM : Gal(M/K) := arithFrobAt (𝓞 K) Gal(M/K) 𝔓 + have hMfrobσM : IsArithFrobAt (𝓞 K) σM 𝔓 := IsArithFrobAt.arithFrobAt (𝓞 K) Gal(M/K) 𝔓 + have hconjM : IsConj σM τM := ConjClasses.mk_eq_mk_iff_isConj.mp + ((frobeniusClass_eq_mk_of_isArithFrobAt K M 𝔭 _hunrM σM 𝔓 hMfrobσM h𝔓lo).symm.trans _hfr) +- haveI : (𝔓.under (𝓞 L)).IsPrime := Ideal.IsPrime.under (𝓞 L) 𝔓 +- haveI : (𝔓.under (𝓞 L)).LiesOver 𝔭 := ⟨((Ideal.under_under 𝔓).trans h𝔓lo.over.symm).symm⟩ ++ have : (𝔓.under (𝓞 L)).IsPrime := Ideal.IsPrime.under (𝓞 L) 𝔓 ++ have : (𝔓.under (𝓞 L)).LiesOver 𝔭 := ⟨((Ideal.under_under 𝔓).trans h𝔓lo.over.symm).symm⟩ + rw [frobeniusClass_eq_mk_of_isArithFrobAt K L 𝔭 _hunrL (σM.restrictNormal L) (𝔓.under (𝓞 L)) + (isArithFrobAt_restrictNormal_repl K L M σM 𝔓 hMfrobσM) inferInstance] + refine ConjClasses.mk_eq_mk_iff_isConj.mpr ?_ +@@ -527,12 +527,12 @@ private theorem frobeniusClass_proj + (_hfr : frobeniusClass K M 𝔭 = ConjClasses.mk τM) : + frobeniusClass K L 𝔭 = ConjClasses.mk σ := by + by_cases hp : 𝔭.IsPrime +- · haveI := hp ++ · have := hp + exact frobeniusClass_proj_isPrime_aux K L M σ τM _hτM 𝔭 _hunrM _hunrL _hfr + · have hMjunk : frobeniusClass K M 𝔭 = ConjClasses.mk 1 := by +- rw [frobeniusClass, dif_neg fun h ↦ hp h.1] ++ rw [frobeniusClass, dite_eq_right fun h ↦ hp h.1] + have hLjunk : frobeniusClass K L 𝔭 = ConjClasses.mk 1 := by +- rw [frobeniusClass, dif_neg fun h ↦ hp h.1] ++ rw [frobeniusClass, dite_eq_right fun h ↦ hp h.1] + have hconj : IsConj (1 : Gal(M/K)) τM := + ConjClasses.mk_eq_mk_iff_isConj.mp (hMjunk.symm.trans _hfr) + have hτM1 : τM = 1 := isConj_one_right.mp hconj +@@ -583,16 +583,16 @@ private theorem isGalois_compositum_base + [IsScalarTower K L M] [IsCyclotomicExtension {m} L M] : IsGalois K M := by + obtain ⟨ζ, hζ⟩ : ∃ r : M, IsPrimitiveRoot r m := + IsCyclotomicExtension.exists_isPrimitiveRoot (S := {m}) L M (Set.mem_singleton m) (NeZero.ne m) +- haveI : FiniteDimensional K M := inferInstance +- haveI hsep : Algebra.IsSeparable K M := inferInstance ++ have : FiniteDimensional K M := inferInstance ++ have hsep : Algebra.IsSeparable K M := inferInstance + set A : IntermediateField K M := (IsScalarTower.toAlgHom K L M).fieldRange with hA + set B : IntermediateField K M := IntermediateField.adjoin K {ζ} with hB +- haveI hAnormal : Normal K A := ++ have hAnormal : Normal K A := + Normal.of_algEquiv (AlgEquiv.ofInjectiveField (IsScalarTower.toAlgHom K L M)) +- haveI hBcyc : IsCyclotomicExtension {m} K B := ++ have hBcyc : IsCyclotomicExtension {m} K B := + hζ.intermediateField_adjoin_isCyclotomicExtension (K := K) +- haveI hBgal : IsGalois K B := IsCyclotomicExtension.isGalois (S := {m}) (K := K) (L := B) +- haveI hBnormal : Normal K B := hBgal.to_normal ++ have hBgal : IsGalois K B := IsCyclotomicExtension.isGalois (S := {m}) (K := K) (L := B) ++ have hBnormal : Normal K B := hBgal.to_normal + have hsup : A ⊔ B = ⊤ := by + have hζalg : IsAlgebraic K ζ := Algebra.IsAlgebraic.isAlgebraic ζ + have hsubalg : (IsScalarTower.toAlgHom K L M).range ⊔ Algebra.adjoin K {ζ} +@@ -606,7 +606,7 @@ private theorem isGalois_compositum_base + IntermediateField.adjoin_simple_toSubalgebra_of_isAlgebraic hζalg, + AlgHom.fieldRange_toSubalgebra, IntermediateField.top_toSubalgebra] + exact hsubalg +- haveI hnormal : Normal K M := by ++ have hnormal : Normal K M := by + have h := IntermediateField.normal_sup K M A B + rw [hsup] at h + exact Normal.of_algEquiv (IntermediateField.topEquiv (F := K) (E := M)) +@@ -615,35 +615,38 @@ private theorem isGalois_compositum_base + /-- **Unramifiedness descends to an intermediate field.** If a prime `𝔭` of `K` is unramified + in the top field `M` of a tower `K ⊆ L ⊆ M`, it is unramified in `L`: for a maximal prime `𝔮` + of `𝓞 L` over `𝔭`, pick a prime `𝔓` of `𝓞 M` over `𝔮`; then `e(𝔓/𝔭) = 1` (from the `M`-side +-hypothesis) factors as `e(𝔮/𝔭)·e(𝔓/𝔮)` (`Ideal.ramificationIdx_algebra_tower`), forcing ++hypothesis) factors as `e(𝔮/𝔭)·e(𝔓/𝔮)` (`Ideal.ramificationIdx'_algebra_tower`), forcing + `e(𝔮/𝔭) = 1`. Supplies C4's `_hunrL : UnramifiedIn K L 𝔭` input from `UnramifiedIn K M 𝔭`. -/ + private theorem unramifiedIn_tower_descend + (K L M : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Field M] [NumberField M] + [Algebra K L] [Algebra K M] [Algebra L M] [IsScalarTower K L M] [IsGalois K L] [IsGalois K M] + (𝔭 : Ideal (𝓞 K)) (hunr : UnramifiedIn K M 𝔭) : UnramifiedIn K L 𝔭 := by +- haveI : IsScalarTower (𝓞 K) (𝓞 L) (𝓞 M) := inferInstance ++ have : IsScalarTower (𝓞 K) (𝓞 L) (𝓞 M) := inferInstance + refine ⟨hunr.1, fun 𝔮 h𝔮max h𝔮lo ↦ ?_⟩ +- haveI := h𝔮max +- haveI := h𝔮lo +- haveI h𝔮p : 𝔮.IsPrime := h𝔮max.isPrime ++ have := h𝔮max ++ have := h𝔮lo ++ have h𝔮p : 𝔮.IsPrime := h𝔮max.isPrime + have h𝔮bot : 𝔮 ≠ ⊥ := Ideal.ne_bot_of_liesOver_of_ne_bot hunr.1 𝔮 + obtain ⟨𝔓, _, h𝔓p, h𝔓comap⟩ := + Ideal.exists_ideal_over_prime_of_isIntegral (S := 𝓞 M) 𝔮 ⊥ (by simp) +- haveI := h𝔓p +- haveI h𝔓lo𝔮 : 𝔓.LiesOver 𝔮 := ⟨h𝔓comap.symm⟩ ++ have := h𝔓p ++ have h𝔓lo𝔮 : 𝔓.LiesOver 𝔮 := ⟨h𝔓comap.symm⟩ + have h𝔓bot : 𝔓 ≠ ⊥ := Ideal.ne_bot_of_liesOver_of_ne_bot h𝔮bot 𝔓 +- haveI h𝔓max : 𝔓.IsMaximal := h𝔓p.isMaximal h𝔓bot ++ have h𝔓max : 𝔓.IsMaximal := h𝔓p.isMaximal h𝔓bot + have h𝔮under : Ideal.under (𝓞 L) 𝔓 = 𝔮 := h𝔓lo𝔮.over.symm + have h𝔭under : Ideal.under (𝓞 K) 𝔮 = 𝔭 := h𝔮lo.over.symm +- haveI h𝔓lo𝔭 : 𝔓.LiesOver 𝔭 := ⟨by rw [← h𝔭under, ← h𝔮under, Ideal.under_under]⟩ ++ have h𝔓lo𝔭 : 𝔓.LiesOver 𝔭 := ⟨by rw [← h𝔭under, ← h𝔮under, Ideal.under_under]⟩ + have hunderP : Ideal.under (𝓞 K) 𝔓 = 𝔭 := h𝔓lo𝔭.over.symm + have hP1 : (Ideal.under (𝓞 K) 𝔓).ramificationIdx' 𝔓 = 1 := by + rw [Ideal.ramificationIdx'_eq_ramificationIdx _ 𝔓 (hunderP ▸ hunr.1)] + exact Ideal.ramificationIdx_eq_one_iff.mpr (hunr.2 𝔓 h𝔓max h𝔓lo𝔭) + rw [hunderP] at hP1 +- have htower := Ideal.ramificationIdx_algebra_tower (R := 𝓞 K) (S := 𝓞 L) (T := 𝓞 M) ++ have htower := Ideal.ramificationIdx'_algebra_tower (R := 𝓞 K) (S := 𝓞 L) (T := 𝓞 M) + (p := 𝔭) (P := 𝔮) (Q := 𝔓) (Ideal.map_ne_bot_of_ne_bot h𝔮bot) +- (Ideal.map_ne_bot_of_ne_bot hunr.1) (by rw [Ideal.map_le_iff_le_comap, h𝔓comap]) ++ (Ideal.map_ne_bot_of_ne_bot hunr.1) (by ++ rw [Ideal.map_le_iff_le_comap] ++ change 𝔮 ≤ 𝔓.under (𝓞 L) ++ rw [h𝔓comap]) + rw [hP1] at htower + have he𝔮 : 𝔭.ramificationIdx' 𝔮 = 1 := Nat.eq_one_of_mul_eq_one_right htower.symm + rw [← Ideal.ramificationIdx_eq_one_iff, +@@ -732,15 +735,15 @@ private theorem density_crossing_fibre_aux + frobeniusClass K M 𝔭 = ConjClasses.mk s} + ((Nat.card Gal(L/K) * Nat.card ((ZMod m)ˣ) : ℝ)⁻¹) := by + set F : IntermediateField K M := IntermediateField.fixedField (Subgroup.zpowers s) with hF +- haveI : IsScalarTower K ↥F M := F.isScalarTower_mid' +- haveI : IsCyclotomicExtension {m} ↥F M := ++ have : IsScalarTower K ↥F M := F.isScalarTower_mid' ++ have : IsCyclotomicExtension {m} ↥F M := + compositum_isCyclotomic_over_fixedField K L M m s hgate + set σE : Gal(M/↥F) := + IntermediateField.subgroupEquivAlgEquiv (Subgroup.zpowers s) ⟨s, Subgroup.mem_zpowers s⟩ + have hlift := density_lift_through_fixedField_repl K M s F σE + (by ext x; rfl) rfl (chebotarev_cyclotomic (K := ↥F) (L := M) m hm4 σE) + have hcarrier : Nat.card (ConjClasses.mk s).carrier = 1 := by +- letI : CommMonoid Gal(M/K) := IsMulCommutative.instCommMonoid ++ let : CommMonoid Gal(M/K) := IsMulCommutative.instCommMonoid + have hcar : (ConjClasses.mk s).carrier = {s} := by + ext a + rw [ConjClasses.mem_carrier_iff_mk_eq, ConjClasses.mk_eq_mk_iff_isConj, +@@ -782,11 +785,11 @@ private theorem exists_crossing_family_tagged + (∀ τ, HasDirichletDensity (S τ) + ((Nat.card Gal(L/K) * Nat.card ((ZMod m)ˣ) : ℝ)⁻¹)) := by + classical +- haveI : NeZero m := ⟨by lia⟩ ++ have : NeZero m := ⟨by lia⟩ + let M := CyclotomicField m L +- haveI : IsGalois K M := isGalois_compositum_base K L m M +- haveI : IsGalois L M := IsGalois.tower_top_of_isGalois K L M +- haveI : FiniteDimensional K M := inferInstance ++ have : IsGalois K M := isGalois_compositum_base K L m M ++ have : IsGalois L M := IsGalois.tower_top_of_isGalois K L M ++ have : FiniteDimensional K M := inferInstance + obtain ⟨ζ, hζ⟩ : ∃ r : M, IsPrimitiveRoot r m := + IsCyclotomicExtension.exists_isPrimitiveRoot (S := {m}) L M (Set.mem_singleton m) (NeZero.ne m) + set χK : Gal(M/K) →* (ZMod m)ˣ := hζ.autToPow K with hχK +@@ -796,10 +799,10 @@ private theorem exists_crossing_family_tagged + MulEquiv.ofBijective _ hΦbij with hequivΦ + set e2 : Gal(M/L) ≃* (ZMod m)ˣ := + MulEquiv.ofBijective (hζ.autToPow L) (autToPow_L_bijective K L M m hcop ζ hζ) with he2 +- haveI : IsMulCommutative Gal(M/L) := ++ have : IsMulCommutative Gal(M/L) := + .of_comm fun a b ↦ e2.injective (by rw [map_mul, map_mul]; exact mul_comm (e2 a) (e2 b)) +- haveI hGcomm : ∀ x y : Gal(L/K), x * y = y * x := fun x y ↦ mul_comm' x y +- haveI : IsMulCommutative Gal(M/K) := ++ have hGcomm : ∀ x y : Gal(L/K), x * y = y * x := fun x y ↦ mul_comm' x y ++ have : IsMulCommutative Gal(M/K) := + .of_comm fun a b ↦ equivΦ.injective (by + rw [map_mul, map_mul, Prod.mul_def, Prod.mul_def, hGcomm, mul_comm + ((equivΦ a).2) ((equivΦ b).2)]) +@@ -933,8 +936,8 @@ private theorem factorization_ordCompl_mul_pow (E p v : ℕ) (hp : p.Prime) (hE + simp only [Finsupp.coe_add, Pi.add_apply, hp.factorization_pow, Finsupp.single_apply, + Nat.factorization_ordCompl] + by_cases hq : q = p +- · subst hq; rw [Finsupp.erase_same, if_pos rfl, if_pos rfl, zero_add] +- · rw [Finsupp.erase_ne hq, if_neg fun h ↦ hq h.symm, if_neg hq, add_zero] ++ · subst hq; rw [Finsupp.erase_same, ite_eq_left rfl, ite_eq_left rfl, zero_add] ++ · rw [Finsupp.erase_ne hq, ite_eq_right fun h ↦ hq h.symm, ite_eq_right hq, add_zero] + + /-- If `d ∣ E` and the `p`-adic valuation of `d` is `≤ v - 1`, then `d` divides the + "capped" modulus `ordCompl[p] E * p ^ (v - 1)` (which replaces `E`'s `p`-part by +@@ -947,8 +950,8 @@ private theorem dvd_capped (E d p v : ℕ) (hp : p.Prime) (hE : E ≠ 0) (hd : d + intro q + rw [factorization_ordCompl_mul_pow E p v hp hE q] + by_cases hq : q = p +- · subst hq; rwa [if_pos rfl] +- · rw [if_neg hq]; exact (Nat.factorization_le_iff_dvd hdne hE).mpr hd q ++ · subst hq; rwa [ite_eq_left rfl] ++ · rw [ite_eq_right hq]; exact (Nat.factorization_le_iff_dvd hdne hE).mpr hd q + + /-- The capped modulus `ordCompl[p] E * p ^ (v - 1)` divides `E` when `v - 1 ≤ v_p(E)`. -/ + private theorem M_dvd_E (E p v : ℕ) (hp : p.Prime) (hE : E ≠ 0) (hle : v - 1 ≤ E.factorization p) : +@@ -958,8 +961,8 @@ private theorem M_dvd_E (E p v : ℕ) (hp : p.Prime) (hE : E ≠ 0) (hle : v - 1 + intro q + rw [factorization_ordCompl_mul_pow E p v hp hE q] + by_cases hq : q = p +- · subst hq; rwa [if_pos rfl] +- · rw [if_neg hq] ++ · subst hq; rwa [ite_eq_left rfl] ++ · rw [ite_eq_right hq] + + /-- Factoring out the complementary `p`-power: `E = (ordCompl[p] E * p ^ (v - 1)) * + p ^ (v_p(E) - (v - 1))`, used to compute `E / M = p ^ (v_p(E) - (v - 1))`. -/ +@@ -1341,7 +1344,7 @@ theorem liminf_ratio_ge_inv_card_G + rw [Nat.coprime_comm, (hmp k).coprime_iff_not_dvd] + exact fun hdvd ↦ absurd (Nat.le_of_dvd hdBpos hdvd) (Nat.not_le.mpr (hmgt k)) + have hexp : ∀ k, Monoid.exponent (ZMod (m k))ˣ = m k - 1 := fun k ↦ by +- haveI : Fact (m k).Prime := ⟨hmp k⟩ ++ have : Fact (m k).Prime := ⟨hmp k⟩ + rw [IsCyclic.exponent_eq_card, Nat.card_eq_fintype_card, ZMod.card_units_eq_totient, + Nat.totient_prime (hmp k)] + have hbound : ∀ k : ℕ, +@@ -1393,7 +1396,7 @@ theorem ratioSum_frobeniusFibres_tendsto_one + set R : Set (Ideal (𝓞 K)) := + {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭} with hR + set D : ℝ → ℝ := primeIdealZetaSum (Set.univ : Set (Ideal (𝓞 K))) with hD +- letI : CommMonoid Gal(L/K) := IsMulCommutative.instCommMonoid ++ let : CommMonoid Gal(L/K) := IsMulCommutative.instCommMonoid + have hmk_inj : Function.Injective (ConjClasses.mk : Gal(L/K) → ConjClasses Gal(L/K)) := + ConjClasses.mk_injective + have hpd : ((Finset.univ : Finset Gal(L/K)) : Set Gal(L/K)).PairwiseDisjoint S := by +@@ -1514,7 +1517,7 @@ theorem tendsto_inv_card_of_liminf_ge_of_sum_tendsto_one {ι : Type*} [Fintype + have hFlimsup : limsup F l = 1 := hsum.limsup_eq + have hgle : ∀ i, l.IsBoundedUnder (· ≤ ·) (g i) := + isBoundedUnder_le_of_isBoundedUnder_le_sum g hFle hbelow +- haveI : Nonempty ι := ⟨i₀⟩ ++ have : Nonempty ι := ⟨i₀⟩ + have hNpos : 0 < N := Fintype.card_pos + have hNR : (0 : ℝ) < N := by exact_mod_cast hNpos + set t : Finset ι := Finset.univ.erase i₀ with ht +diff --git a/projects/Chebotarev/CebotarevDensity/AbsoluteDegreeOneDensity.lean b/projects/Chebotarev/CebotarevDensity/AbsoluteDegreeOneDensity.lean +new file mode 100644 +index 000000000..a484ff648 +--- /dev/null ++++ b/projects/Chebotarev/CebotarevDensity/AbsoluteDegreeOneDensity.lean +@@ -0,0 +1,144 @@ ++module ++ ++public import CebotarevDensity.Density ++public import CebotarevDensity.ForMathlib.TsumFiberBound ++public import Mathlib.RingTheory.RamificationInertia.Basic ++public import Mathlib.NumberTheory.RamificationInertia.Inertia ++public import Mathlib.Analysis.PSeries ++public import Mathlib.RingTheory.Ideal.Int ++ ++/-! ++# Discarding primes of absolute residue degree greater than one ++ ++The higher-degree terms are bounded by `[K : ℚ] * ∑ n⁻²`, independently of ++`s > 1`. They consequently have zero Dirichlet density, even after intersection ++with an arbitrary set of prime ideals. ++-/ ++ ++@[expose] public section ++ ++noncomputable section ++ ++open Filter NumberField Topology Set ++ ++namespace Chebotarev ++ ++variable {K : Type*} [Field K] [NumberField K] ++ ++private theorem absNorm_rpow_neg_le_intUnder_sq ++ (P : Ideal (𝓞 K)) [P.IsPrime] (hP : P ≠ ⊥) ++ (hdegree : ¬ P.absNorm.Prime) {s : ℝ} (hs : 1 < s) : ++ (P.absNorm : ℝ) ^ (-s) ≤ ((P.under ℤ).absNorm : ℝ) ^ (-(2 : ℝ)) := by ++ let : NeZero P := ⟨hP⟩ ++ have hp : (P.under ℤ).absNorm.Prime := Nat.absNorm_under_prime P ++ have : P.LiesOver (P.under ℤ) := Ideal.over_under (A := ℤ) (P := P) ++ have hpow := (Ideal.absNorm_pow_inertiaDeg (P.under ℤ) P).symm ++ have hdeg : 2 ≤ P.inertiaDeg ℤ := by ++ have hpos : 0 < P.inertiaDeg ℤ := Ideal.inertiaDeg_pos P ℤ ++ have hne : P.inertiaDeg ℤ ≠ 1 := by ++ intro h ++ apply hdegree ++ rw [hpow, h, pow_one] ++ exact hp ++ omega ++ rw [hpow, Nat.cast_pow, ++ ← Real.rpow_natCast ((P.under ℤ).absNorm : ℝ) (P.inertiaDeg ℤ), ++ ← Real.rpow_mul (by positivity)] ++ apply Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hp.one_lt.le) ++ nlinarith [mul_le_mul (show (2 : ℝ) ≤ (P.inertiaDeg ℤ : ℝ) by exact_mod_cast hdeg) ++ hs.le (by norm_num) (by positivity : (0 : ℝ) ≤ (P.inertiaDeg ℤ : ℝ))] ++ ++/-- The non-prime-norm part of any set of prime ideals has a uniform Dirichlet-series bound. -/ ++theorem primeIdealZetaSum_nonprimeNorm_le (S : Set (Ideal (𝓞 K))) {s : ℝ} (hs : 1 < s) : ++ primeIdealZetaSum {P | P ∈ S ∧ ¬ P.absNorm.Prime} s ≤ ++ (Module.finrank ℚ K : ℝ) * ∑' n : ℕ, (n : ℝ) ^ (-(2 : ℝ)) := by ++ let A := {P : Ideal (𝓞 K) // (P ∈ S ∧ ¬ P.absNorm.Prime) ∧ P.IsPrime ∧ P ≠ ⊥} ++ let B := {p : Ideal ℤ // p.IsPrime ∧ p ≠ ⊥} ++ have hunder : ∀ P : A, (P.1.under ℤ).IsPrime ∧ P.1.under ℤ ≠ ⊥ := by ++ intro P ++ let := P.2.2.1 ++ exact ⟨inferInstance, Ideal.IsIntegral.under_ne_bot ℤ P.2.2.2⟩ ++ let g : A → B := fun P => ⟨P.1.under ℤ, hunder P⟩ ++ have hfib : ∀ p : B, Finite (g ⁻¹' {p} : Set A) ∧ ++ Nat.card (g ⁻¹' {p} : Set A) ≤ Module.finrank ℚ K := by ++ intro p ++ let := p.2.1 ++ let : p.1.IsMaximal := p.2.1.isMaximal p.2.2 ++ have hmem : ∀ P : (g ⁻¹' {p} : Set A), P.1.1.IsPrime ∧ P.1.1.LiesOver p.1 := by ++ intro P ++ let := P.1.2.2.1 ++ refine ⟨P.1.2.2.1, ⟨?_⟩⟩ ++ exact (congrArg Subtype.val P.2 : P.1.1.under ℤ = p.1) ▸ ++ (Ideal.over_under (A := ℤ) (P := P.1.1)).over ++ let f : (g ⁻¹' {p} : Set A) → p.1.primesOver (𝓞 K) := fun P => ⟨P.1.1, hmem P⟩ ++ have hfinj : Function.Injective f := by ++ intro P Q h ++ apply Subtype.ext ++ apply Subtype.ext ++ exact congrArg (fun x : p.1.primesOver (𝓞 K) => x.1) h ++ let : Finite (p.1.primesOver (𝓞 K)) := ++ (IsDedekindDomain.primesOver_finite p.1 _).to_subtype ++ have hcard : Nat.card (p.1.primesOver (𝓞 K)) ≤ Module.finrank ℚ K := by ++ classical ++ let : Fintype (p.1.primesOver (𝓞 K)) := Fintype.ofFinite _ ++ calc ++ Nat.card (p.1.primesOver (𝓞 K)) = ∑ _q : p.1.primesOver (𝓞 K), (1 : ℕ) := by ++ simp [Nat.card_eq_fintype_card] ++ _ ≤ ∑ q : p.1.primesOver (𝓞 K), q.1.ramificationIdx ℤ * q.1.inertiaDeg ℤ := by ++ apply Finset.sum_le_sum ++ intro q _ ++ have : q.1.IsPrime := q.2.1 ++ exact Nat.mul_pos (Ideal.ramificationIdx_pos q.1 ℤ) (Ideal.inertiaDeg_pos q.1 ℤ) ++ _ = Module.finrank ℤ (𝓞 K) := Ideal.sum_ramification_inertia_eq_finrank p.1 (𝓞 K) ++ _ = Module.finrank ℚ K := RingOfIntegers.rank K ++ exact ⟨Finite.of_injective f hfinj, (Nat.card_le_card_of_injective f hfinj).trans hcard⟩ ++ have hnorminj : Function.Injective (fun p : B => p.1.absNorm) := by ++ intro p q h ++ change p.1.absNorm = q.1.absNorm at h ++ apply Subtype.ext ++ rw [← Int.ideal_span_absNorm_eq_self p.1, ← Int.ideal_span_absNorm_eq_self q.1, h] ++ have hnat : Summable (fun n : ℕ => (n : ℝ) ^ (-(2 : ℝ))) := ++ Real.summable_nat_rpow.mpr (by norm_num) ++ have hsum : Summable (fun p : B => (p.1.absNorm : ℝ) ^ (-(2 : ℝ))) := ++ hnat.comp_injective hnorminj ++ calc ++ primeIdealZetaSum {P | P ∈ S ∧ ¬ P.absNorm.Prime} s ≤ ++ (Module.finrank ℚ K : ℝ) * ∑' p : B, (p.1.absNorm : ℝ) ^ (-(2 : ℝ)) := by ++ apply tsum_real_comp_le_card_fibre_mul g _ _ _ ++ (summable_prime_absNorm_rpow _ hs) hsum ++ (fun _ => by positivity) (fun _ => by positivity) ++ · intro P ++ let := P.2.2.1 ++ exact absNorm_rpow_neg_le_intUnder_sq P.1 P.2.2.2 P.2.1.2 hs ++ · exact fun p => (hfib p).1 ++ · exact fun p => (hfib p).2 ++ _ ≤ (Module.finrank ℚ K : ℝ) * ∑' n : ℕ, (n : ℝ) ^ (-(2 : ℝ)) := by ++ apply mul_le_mul_of_nonneg_left _ (by positivity) ++ exact hsum.tsum_le_tsum_of_inj _ hnorminj (fun _ _ => by positivity) ++ (fun _ => le_rfl) hnat ++ ++/-- Removing prime ideals of absolute residue degree greater than one preserves density. -/ ++theorem HasDirichletDensity.primeNorm {S : Set (Ideal (𝓞 K))} {δ : ℝ} ++ (hS : HasDirichletDensity S δ) : ++ HasDirichletDensity {P | P ∈ S ∧ P.absNorm.Prime} δ := by ++ let T : Set (Ideal (𝓞 K)) := {P | P ∈ S ∧ P.absNorm.Prime} ++ let U : Set (Ideal (𝓞 K)) := {P | P ∈ S ∧ ¬ P.absNorm.Prime} ++ have hzero : HasDirichletDensity U 0 := ++ tendsto_primeIdealZetaSum_div_univ_zero_of_le_const K U _ ++ (eventually_nhdsWithin_of_forall fun s hs => primeIdealZetaSum_nonprimeNorm_le S hs) ++ have hdisjoint : Disjoint T U := by ++ rw [Set.disjoint_left] ++ exact fun _ ht hu => hu.2 ht.2 ++ have hunion : T ∪ U = S := by ++ ext P ++ simp only [T, U, Set.mem_union, Set.mem_ofPred_eq] ++ tauto ++ have h := hS.sub hzero ++ simp only [sub_zero] at h ++ apply h.congr' ++ filter_upwards [self_mem_nhdsWithin] with s hs ++ have hsum : primeIdealZetaSum S s = primeIdealZetaSum T s + primeIdealZetaSum U s := by ++ rw [← hunion, primeIdealZetaSum_union_of_disjoint hdisjoint hs] ++ rw [hsum, add_div, add_sub_cancel_right] ++ ++end Chebotarev +diff --git a/projects/Chebotarev/CebotarevDensity/Cyclotomic.lean b/projects/Chebotarev/CebotarevDensity/Cyclotomic.lean +index c0e83f4b7..7a08eb09f 100644 +--- a/projects/Chebotarev/CebotarevDensity/Cyclotomic.lean ++++ b/projects/Chebotarev/CebotarevDensity/Cyclotomic.lean +@@ -205,7 +205,7 @@ theorem character_orthogonality_cyclotomic_eq + ConjClasses.mk_eq_mk_iff_isConj.mp (hmk.trans _h) + rw [SemiconjBy, mul_comm' (c : Gal(L/K))] at hc + rw [mul_right_cancel hc, mul_inv_cancel] +- rw [sum_galoisCharacter_mul_inv_eq K L σ τ, if_pos heq] ++ rw [sum_galoisCharacter_mul_inv_eq K L σ τ, ite_eq_left heq] + + /-- Sharifi 7.2.1 character orthogonality, **non-matching case**: + when `frobeniusClass K L 𝔭 ≠ ConjClasses.mk σ`, the character sum +@@ -222,7 +222,7 @@ theorem character_orthogonality_cyclotomic_ne + have hmk : ConjClasses.mk τ = frobeniusClass K L 𝔭 := Quotient.out_eq _ + have hne : σ * τ⁻¹ ≠ 1 := fun hσ ↦ + _h <| hmk.symm.trans (congrArg ConjClasses.mk (mul_inv_eq_one.mp hσ)).symm +- rw [sum_galoisCharacter_mul_inv_eq K L σ τ, if_neg hne] ++ rw [sum_galoisCharacter_mul_inv_eq K L σ τ, ite_eq_right hne] + + /-! ### Complex-analytic core of the cyclotomic χ≠1 bound + +@@ -615,7 +615,7 @@ private theorem artinLSeries_prime_sum_bounded_of_analytic_extension + set D : Set ℂ := {s : ℂ | 1 - (Module.finrank ℚ K : ℝ)⁻¹ < s.re} with hD + have hDopen : IsOpen D := by rw [hD]; exact isOpen_lt continuous_const Complex.continuous_re + have hmemD : ∀ s : ℝ, 1 ≤ s → (s : ℂ) ∈ D := fun s hs ↦ by +- rw [hD]; simp only [Set.mem_setOf_eq, Complex.ofReal_re] ++ rw [hD]; simp only [Set.mem_ofPred_eq, Complex.ofReal_re] + have hfr : 0 < Module.finrank ℚ K := Module.finrank_pos + have : (0 : ℝ) < (Module.finrank ℚ K : ℝ)⁻¹ := by positivity + linarith +@@ -796,8 +796,8 @@ private theorem sum_charTwist_mul_twistedPrimeSum_eq + (Nat.card Gal(L/K) : ℂ) * (Ideal.absNorm 𝔭.1 : ℂ) ^ (-(s : ℂ)) else 0 := fun 𝔭 ↦ by + have := 𝔭.2.1 + by_cases h : frobeniusClass K L 𝔭.1 = ConjClasses.mk σ +- · rw [sum_charTwist_eq K L m σ 𝔭.1 𝔭.2.2 h, if_pos h] +- · rw [sum_charTwist_ne K L m σ 𝔭.1 𝔭.2.2 h, if_neg h, zero_mul] ++ · rw [sum_charTwist_eq K L m σ 𝔭.1 𝔭.2.2 h, ite_eq_left h] ++ · rw [sum_charTwist_ne K L m σ 𝔭.1 𝔭.2.2 h, ite_eq_right h, zero_mul] + have hfinj : Function.Injective + (fun 𝔭 : {𝔭 : Ideal (𝓞 K) // 𝔭 ∈ {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ + frobeniusClass K L 𝔭 = ConjClasses.mk σ} ∧ 𝔭.IsPrime ∧ 𝔭 ≠ ⊥} ↦ +@@ -812,11 +812,11 @@ private theorem sum_charTwist_mul_twistedPrimeSum_eq + (f := fun 𝔭 : {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭} ↦ + if frobeniusClass K L 𝔭.1 = ConjClasses.mk σ then (Ideal.absNorm 𝔭.1 : ℝ) ^ (-s) else 0) + ?_] +- · exact tsum_congr fun 𝔭 ↦ (if_pos 𝔭.2.1.2.2).symm ++ · exact tsum_congr fun 𝔭 ↦ (ite_eq_left 𝔭.2.1.2.2).symm + · rintro 𝔭 h𝔭 + have h : frobeniusClass K L 𝔭.1 = ConjClasses.mk σ := by + by_contra hne +- exact h𝔭 (if_neg hne) ++ exact h𝔭 (ite_eq_right hne) + exact ⟨⟨𝔭.1, ⟨𝔭.2.1, 𝔭.2.2, h⟩, 𝔭.2.1, UnramifiedIn.ne_bot K L 𝔭.2.2⟩, rfl⟩ + rw [hinterchange, tsum_congr hcollapse, hfibre, Complex.ofReal_tsum, ← tsum_mul_left] + refine tsum_congr fun 𝔭 ↦ ?_ +diff --git a/projects/Chebotarev/CebotarevDensity/CyclotomicNormResidue.lean b/projects/Chebotarev/CebotarevDensity/CyclotomicNormResidue.lean +index 4cf9574ba..1bcb85b86 100644 +--- a/projects/Chebotarev/CebotarevDensity/CyclotomicNormResidue.lean ++++ b/projects/Chebotarev/CebotarevDensity/CyclotomicNormResidue.lean +@@ -56,7 +56,7 @@ theorem cyclotomic_frobenius_acts_as_norm_power + haveI : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 hP + ∀ ζ : L, ζ ∈ primitiveRoots m L → + arithFrobAt (𝓞 K) Gal(L/K) 𝔓 ζ = ζ ^ Ideal.absNorm 𝔭 := by +- haveI : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 hP ++ have : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 hP + intro ζ hζmem + set φ := arithFrobAt (𝓞 K) Gal(L/K) 𝔓 + have hζ : IsPrimitiveRoot ζ m := (mem_primitiveRoots (NeZero.pos m)).mp hζmem +@@ -64,9 +64,8 @@ theorem cyclotomic_frobenius_acts_as_norm_power + have hzc : (algebraMap (𝓞 L) L) z = ζ := rfl + have hzpow : z ^ m = 1 := hζ.toInteger_isPrimitiveRoot.pow_eq_one + set q := Ideal.absNorm 𝔭 +- have h𝔭ne : 𝔭 ≠ ⊥ := UnramifiedIn.ne_bot K L hunr + have hcopP : (Ideal.absNorm 𝔓).Coprime m := by +- rw [Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver 𝔓 𝔭 ‹𝔭.IsPrime› h𝔭ne] ++ rw [← Ideal.absNorm_pow_inertiaDeg 𝔭 𝔓] + exact Nat.Coprime.pow_left _ hcop + have hN1 : Ideal.absNorm 𝔓 ≠ 1 := fun h ↦ ‹𝔓.IsPrime›.ne_top (Ideal.absNorm_eq_one_iff.mp h) + have hmnotmem : (m : 𝓞 L) ∉ 𝔓 := by +@@ -92,7 +91,6 @@ private theorem pow_natModEq_of_pow_eq {S : Type*} [CommRing S] [IsDomain S] {μ + [NeZero n] (hμ : IsPrimitiveRoot μ n) {a b : ℕ} (h : μ ^ a = μ ^ b) : a ≡ b [MOD n] := + hμ.eq_orderOf ▸ (hμ.isOfFinOrder (NeZero.ne n)).pow_eq_pow_iff_modEq.mp h + +-set_option backward.isDefEq.respectTransparency false in + /-- **The cyclotomic Frobenius is the norm residue** (multiplicative form). For `L = K(μ_m)`, + a primitive `m`-th root `ζ` of unity in `L`, and a prime `𝔭` of `K` unramified in `L` with + `N𝔭` coprime to `m`, the cyclotomic character `IsPrimitiveRoot.autToPow` sends the Frobenius +@@ -105,15 +103,16 @@ theorem autToPow_frobeniusClass_out + hζ.autToPow K ((frobeniusClass K L 𝔭).out : L ≃ₐ[K] L) = + ZMod.unitOfCoprime (Ideal.absNorm 𝔭) hcop := by + obtain ⟨𝔓, h𝔓prime, h𝔓lo, _⟩ := exists_prime_liesOver K L 𝔭 (UnramifiedIn.ne_bot K L hunr) +- haveI := h𝔓prime +- haveI := h𝔓lo +- haveI : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 h𝔓lo ++ have := h𝔓prime ++ have := h𝔓lo ++ have : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 h𝔓lo + set φ : L ≃ₐ[K] L := arithFrobAt (𝓞 K) Gal(L/K) 𝔓 + have hclass : frobeniusClass K L 𝔭 = ConjClasses.mk φ := + frobeniusClass_eq_mk_of_isArithFrobAt K L 𝔭 hunr φ 𝔓 + (IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) 𝔓) h𝔓lo + have hconj : IsConj ((frobeniusClass K L 𝔭).out) φ := by +- rw [← ConjClasses.mk_eq_mk_iff_isConj, ← hclass, ConjClasses.mk, Quotient.out_eq] ++ apply ConjClasses.mk_eq_mk_iff_isConj.mp ++ exact (Quotient.out_eq (frobeniusClass K L 𝔭)).trans hclass + rw [isConj_iff_eq.mp ((hζ.autToPow K).map_isConj hconj)] + have hact : φ ζ = ζ ^ Ideal.absNorm 𝔭 := + cyclotomic_frobenius_acts_as_norm_power K L m 𝔭 hunr hcop 𝔓 h𝔓lo ζ +@@ -145,7 +144,7 @@ private theorem smul_algebraMap_eq + (σ : L ≃ₐ[K] L) (y : 𝓞 F) : + haveI : IsScalarTower K F L := F.isScalarTower_mid' + σ • (algebraMap (𝓞 F) (𝓞 L) y) = algebraMap (𝓞 F) (𝓞 L) ((σ.restrictNormal F) • y) := by +- haveI : IsScalarTower K F L := F.isScalarTower_mid' ++ have : IsScalarTower K F L := F.isScalarTower_mid' + have hbridgeL : ∀ (g : L ≃ₐ[K] L) (x : 𝓞 L), ((g • x : 𝓞 L) : L) = g • (x : L) := fun g x ↦ + by simpa [Algebra.smul_def] using + (smul_distrib_smul (G := L ≃ₐ[K] L) (R := 𝓞 L) (S := L) g x 1).symm +@@ -173,7 +172,7 @@ private theorem isArithFrobAt_restrictNormal + (𝔓 : Ideal (𝓞 L)) (hσ : IsArithFrobAt (𝓞 K) σ 𝔓) : + haveI : IsScalarTower K F L := F.isScalarTower_mid' + IsArithFrobAt (𝓞 K) (σ.restrictNormal F) (𝔓.under (𝓞 F)) := by +- haveI : IsScalarTower K F L := F.isScalarTower_mid' ++ have : IsScalarTower K F L := F.isScalarTower_mid' + intro y + rw [Ideal.under_under 𝔓, Ideal.under, Ideal.mem_comap, map_sub, map_pow, + show (MulSemiringAction.toAlgHom (𝓞 K) (𝓞 F) (σ.restrictNormal F)) y +@@ -188,21 +187,20 @@ private theorem unramifiedIn_intermediateField + (F : IntermediateField K L) [IsGalois K F] + (𝔭 : Ideal (𝓞 K)) (hunr : UnramifiedIn K L 𝔭) : + UnramifiedIn K (↥F) 𝔭 := by +- haveI : IsScalarTower K F L := F.isScalarTower_mid' +- haveI : IsScalarTower (𝓞 K) (𝓞 F) (𝓞 L) := inferInstance ++ have : IsScalarTower K F L := F.isScalarTower_mid' ++ have : IsScalarTower (𝓞 K) (𝓞 F) (𝓞 L) := inferInstance + refine ⟨hunr.1, fun 𝔮 h𝔮max h𝔮lo ↦ ?_⟩ +- haveI := h𝔮lo +- haveI := h𝔮max.isPrime ++ have := h𝔮lo ++ have := h𝔮max.isPrime + obtain ⟨𝔓, h𝔓prime, h𝔓lo, -⟩ := exists_prime_liesOver (↥F) L 𝔮 + (Ideal.ne_bot_of_liesOver_of_ne_bot hunr.1 𝔮) +- haveI := h𝔓prime +- haveI := h𝔓lo +- haveI : 𝔓.LiesOver 𝔭 := ⟨by rw [← Ideal.under_under (B := 𝓞 F) 𝔓, h𝔓lo.over.symm, h𝔮lo.over.symm]⟩ +- haveI : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := ++ have := h𝔓prime ++ have := h𝔓lo ++ have : 𝔓.LiesOver 𝔭 := ⟨by rw [← Ideal.under_under (B := 𝓞 F) 𝔓, h𝔓lo.over.symm, h𝔮lo.over.symm]⟩ ++ have : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := + hunr.2 𝔓 (h𝔓prime.isMaximal (Ideal.ne_bot_of_liesOver_of_ne_bot hunr.1 𝔓)) inferInstance + exact Algebra.IsUnramifiedAt.of_liesOver (𝓞 K) 𝔮 𝔓 + +-set_option backward.isDefEq.respectTransparency false in + /-- **Step (A): a Frobenius-trivial prime splits completely.** For `F = fixedField H` with `H` + abelian (hence normal) and a nonzero prime `𝔭` of `𝓞 K` unramified in `L` whose Frobenius + representative lies in `H`, the `F`-Frobenius class of `𝔭` is trivial: `frobeniusClass K F 𝔭 = [1]`. +@@ -220,19 +218,20 @@ private theorem frobeniusClass_fixedField_eq_one + IsGalois.of_fixedField_normal_subgroup H + frobeniusClass K (↥(IntermediateField.fixedField H)) 𝔭 = ConjClasses.mk 1 := by + set F := IntermediateField.fixedField H with hF +- haveI : IsScalarTower K F L := F.isScalarTower_mid' +- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H +- haveI : NumberField F := NumberField.of_intermediateField F ++ have : IsScalarTower K F L := F.isScalarTower_mid' ++ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H ++ have : NumberField F := NumberField.of_intermediateField F + obtain ⟨𝔓, h𝔓p, h𝔓lo, -⟩ := exists_prime_liesOver K L 𝔭 (UnramifiedIn.ne_bot K L hunr) +- haveI := h𝔓p +- haveI := h𝔓lo +- haveI : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 h𝔓lo ++ have := h𝔓p ++ have := h𝔓lo ++ have : Finite (𝓞 L ⧸ 𝔓) := UnramifiedIn.finite_quotient K L hunr 𝔓 h𝔓lo + set σ : L ≃ₐ[K] L := arithFrobAt (𝓞 K) Gal(L/K) 𝔓 + have hclass : frobeniusClass K L 𝔭 = ConjClasses.mk σ := + frobeniusClass_eq_mk_of_isArithFrobAt K L 𝔭 hunr σ 𝔓 + (IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) 𝔓) h𝔓lo + have hconj : IsConj σ ((frobeniusClass K L 𝔭).out) := by +- rw [← ConjClasses.mk_eq_mk_iff_isConj, hclass.symm, ConjClasses.mk, Quotient.out_eq] ++ apply ConjClasses.mk_eq_mk_iff_isConj.mp ++ exact hclass.symm.trans (Quotient.out_eq (frobeniusClass K L 𝔭)).symm + have hσeq : σ = (frobeniusClass K L 𝔭).out := by + obtain ⟨c, hc⟩ := hconj + rw [SemiconjBy, mul_comm' (c : Gal(L/K)) σ] at hc +@@ -244,7 +243,7 @@ private theorem frobeniusClass_fixedField_eq_one + MonoidHom.mem_ker.mp <| (IntermediateField.restrictNormalHom_ker F).ge hσfix + have h𝔮lo : (𝔓.under (𝓞 F)).LiesOver 𝔭 := + ⟨by rw [← Ideal.under_under (B := 𝓞 F) 𝔓]; exact h𝔓lo.over⟩ +- haveI := h𝔮lo ++ have := h𝔮lo + have hfrobF : IsArithFrobAt (𝓞 K) (σ.restrictNormal F) (𝔓.under (𝓞 F)) := + isArithFrobAt_restrictNormal K L F σ 𝔓 (IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) 𝔓) + rw [frobeniusClass_eq_mk_of_isArithFrobAt K (↥F) 𝔭 (unramifiedIn_intermediateField K L F 𝔭 hunr) +@@ -267,14 +266,14 @@ private theorem finrank_residue_fixedField_eq_one + ∀ 𝔮 : Ideal (𝓞 ↥(IntermediateField.fixedField H)), 𝔮.IsPrime → 𝔮.LiesOver 𝔭 → + Module.finrank (𝓞 K ⧸ 𝔮.under (𝓞 K)) (𝓞 ↥(IntermediateField.fixedField H) ⧸ 𝔮) = 1 := by + set F := IntermediateField.fixedField H +- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H +- haveI : NumberField F := NumberField.of_intermediateField F ++ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H ++ have : NumberField F := NumberField.of_intermediateField F + have hunrF : UnramifiedIn K (↥F) 𝔭 := unramifiedIn_intermediateField K L F 𝔭 hunr + have hfc : frobeniusClass K (↥F) 𝔭 = ConjClasses.mk (1 : Gal(↥F/K)) := + frobeniusClass_fixedField_eq_one K L H 𝔭 hunr hmem + intro 𝔮 h𝔮p h𝔮lo +- haveI := h𝔮p +- haveI := h𝔮lo ++ have := h𝔮p ++ have := h𝔮lo + rw [finrank_residue_eq_orderOf K (↥F) (1 : Gal(↥F/K)) (ConjClasses.mk 1) rfl 𝔭 hunrF hfc 𝔮 + h𝔮lo, orderOf_one] + +@@ -291,13 +290,13 @@ private theorem card_primesOver_fixedField_eq_finrank + 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭 ∧ 𝔮 ≠ ⊥} = + Module.finrank K ↥(IntermediateField.fixedField H) := by + set F := IntermediateField.fixedField H +- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H +- haveI : NumberField F := NumberField.of_intermediateField F ++ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H ++ have : NumberField F := NumberField.of_intermediateField F + have hunrF : UnramifiedIn K (↥F) 𝔭 := unramifiedIn_intermediateField K L F 𝔭 hunr + have hresdeg := finrank_residue_fixedField_eq_one K L H 𝔭 hunr hmem + obtain ⟨𝔮₀, h𝔮₀p, h𝔮₀lo, -⟩ := exists_prime_liesOver K (↥F) 𝔭 (UnramifiedIn.ne_bot K L hunr) +- haveI := h𝔮₀p +- haveI := h𝔮₀lo ++ have := h𝔮₀p ++ have := h𝔮₀lo + have hcard := card_primesAbove_mul_finrank_eq K (↥F) 𝔭 hunrF 𝔮₀ h𝔮₀lo + rw [hresdeg 𝔮₀ h𝔮₀p h𝔮₀lo, mul_one] at hcard + rw [hcard, IsGalois.card_aut_eq_finrank K (↥F)] +@@ -318,18 +317,19 @@ private theorem absNorm_eq_of_liesOver_fixedField + ∀ 𝔮 : Ideal (𝓞 ↥(IntermediateField.fixedField H)), 𝔮.IsPrime → 𝔮.LiesOver 𝔭 → + Ideal.absNorm 𝔮 = Ideal.absNorm 𝔭 := by + set F := IntermediateField.fixedField H +- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H +- haveI : NumberField F := NumberField.of_intermediateField F ++ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H ++ have : NumberField F := NumberField.of_intermediateField F + have hresdeg := finrank_residue_fixedField_eq_one K L H 𝔭 hunr hmem + intro 𝔮 h𝔮p h𝔮lo +- haveI := h𝔮p +- haveI := h𝔮lo +- have hinert : (𝔮.under (𝓞 K)).inertiaDeg' 𝔮 = 1 := by +- rw [Ideal.inertiaDeg'_algebraMap] ++ have := h𝔮p ++ have := h𝔮lo ++ have : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal (UnramifiedIn.ne_bot K L hunr) ++ have : 𝔮.IsMaximal := Ideal.IsMaximal.of_liesOver_isMaximal 𝔮 𝔭 ++ have : (𝔮.under (𝓞 K)).IsMaximal := h𝔮lo.over ▸ ‹𝔭.IsMaximal› ++ have hinert : 𝔮.inertiaDeg (𝓞 K) = 1 := by ++ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔮.under (𝓞 K)) 𝔮] + exact hresdeg 𝔮 h𝔮p h𝔮lo +- have hunder : 𝔮.under (𝓞 K) = 𝔭 := h𝔮lo.over.symm +- rw [Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver 𝔮 (𝔮.under (𝓞 K)) inferInstance +- (hunder ▸ UnramifiedIn.ne_bot K L hunr), hinert, pow_one, hunder] ++ rw [← Ideal.absNorm_pow_inertiaDeg 𝔭 𝔮, hinert, pow_one] + + /-! ### Coprime-restricted Frobenii generation + +@@ -409,8 +409,8 @@ private theorem finite_primesLiesOver_ne_bot (F : IntermediateField K L) [IsGalo + (𝔭 : Ideal (𝓞 K)) [𝔭.IsMaximal] : + haveI : NumberField F := NumberField.of_intermediateField F + Finite {𝔮 : Ideal (𝓞 ↥F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭 ∧ 𝔮 ≠ ⊥} := by +- haveI : NumberField F := NumberField.of_intermediateField F +- haveI : Finite (𝔭.primesOver (𝓞 ↥F)) := ++ have : NumberField F := NumberField.of_intermediateField F ++ have : Finite (𝔭.primesOver (𝓞 ↥F)) := + (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 ↥F)).to_subtype + refine Finite.of_injective (β := 𝔭.primesOver (𝓞 ↥F)) (fun y ↦ ⟨y.1, y.2.1, y.2.2.1⟩) + fun a b hab ↦ Subtype.ext ?_ +@@ -436,8 +436,8 @@ private theorem primeIdealZetaSum_under_eq_finrank_mul [IsMulCommutative Gal(L/K + = (Module.finrank K ↥(IntermediateField.fixedField H) : ℝ) * primeIdealZetaSum + {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ (Ideal.absNorm 𝔭).Coprime m} s := by + set F := IntermediateField.fixedField H +- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H +- haveI : NumberField F := NumberField.of_intermediateField F ++ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H ++ have : NumberField F := NumberField.of_intermediateField F + set U : Set (Ideal (𝓞 K)) := + {𝔭 | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ (Ideal.absNorm 𝔭).Coprime m} + set V : Set (Ideal (𝓞 F)) := +@@ -446,9 +446,9 @@ private theorem primeIdealZetaSum_under_eq_finrank_mul [IsMulCommutative Gal(L/K + set IV := {𝔮 : Ideal (𝓞 F) // 𝔮 ∈ V ∧ 𝔮.IsPrime ∧ 𝔮 ≠ ⊥} + have hφ_mem : ∀ 𝔮 : IV, (𝔮.1.under (𝓞 K)) ∈ U ∧ (𝔮.1.under (𝓞 K)).IsPrime + ∧ (𝔮.1.under (𝓞 K)) ≠ ⊥ := fun 𝔮 ↦ by +- haveI := 𝔮.2.2.1 ++ have := 𝔮.2.2.1 + exact ⟨⟨inferInstance, 𝔮.2.1.2.1, 𝔮.2.1.2.2⟩, inferInstance, +- Ideal.IsIntegral.comap_ne_bot (𝓞 K) 𝔮.2.2.2⟩ ++ Ideal.IsIntegral.under_ne_bot (𝓞 K) 𝔮.2.2.2⟩ + set φ : IV → IU := fun 𝔮 ↦ ⟨𝔮.1.under (𝓞 K), hφ_mem 𝔮⟩ + set e := Equiv.sigmaFiberEquiv φ + have hsummSig : Summable (fun p : Σ 𝔭 : IU, {𝔮 : IV // φ 𝔮 = 𝔭} ↦ +@@ -458,13 +458,13 @@ private theorem primeIdealZetaSum_under_eq_finrank_mul [IsMulCommutative Gal(L/K + rw [primeIdealZetaSum_def, ← e.tsum_eq (fun 𝔮 : IV ↦ (Ideal.absNorm (𝔮.1) : ℝ) ^ (-s)), + hsummSig.tsum_sigma, primeIdealZetaSum_def, ← tsum_mul_left] + refine tsum_congr (fun 𝔭 ↦ ?_) +- haveI := 𝔭.2.2.1 ++ have := 𝔭.2.2.1 + have hfibeq : {𝔮 : IV // φ 𝔮 = 𝔭} ≃ + {𝔮 : Ideal (𝓞 F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭.1 ∧ 𝔮 ≠ ⊥} := + { toFun := fun x ↦ ⟨x.1.1, x.1.2.2.1, ⟨(Subtype.ext_iff.mp x.2).symm⟩, x.1.2.2.2⟩ + invFun := fun y ↦ ⟨⟨y.1, ⟨y.2.1, by +- haveI := y.2.1 +- haveI := y.2.2.1 ++ have := y.2.1 ++ have := y.2.2.1 + exact (y.2.2.1.over ▸ 𝔭.2.1.2 : UnramifiedIn K L (y.1.under (𝓞 K)) ∧ + (Ideal.absNorm (y.1.under (𝓞 K))).Coprime m)⟩, y.2.1, y.2.2.2⟩, + Subtype.ext (haveI := y.2.2.1; y.2.2.1.over.symm)⟩ +@@ -474,10 +474,10 @@ private theorem primeIdealZetaSum_under_eq_finrank_mul [IsMulCommutative Gal(L/K + = (Ideal.absNorm 𝔭.1 : ℝ) ^ (-s) := fun x ↦ by + change (Ideal.absNorm x.1.1 : ℝ) ^ (-s) = (Ideal.absNorm 𝔭.1 : ℝ) ^ (-s) + rw [(hsplit 𝔭.1 𝔭.2.2.1 𝔭.2.1.2.1 𝔭.2.1.2.2).2 x.1.1 x.1.2.2.1 ⟨(Subtype.ext_iff.mp x.2).symm⟩] +- haveI : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 +- haveI : Finite {𝔮 : Ideal (𝓞 F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭.1 ∧ 𝔮 ≠ ⊥} := ++ have : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 ++ have : Finite {𝔮 : Ideal (𝓞 F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭.1 ∧ 𝔮 ≠ ⊥} := + finite_primesLiesOver_ne_bot K L F 𝔭.1 +- haveI : Finite {𝔮 : IV // φ 𝔮 = 𝔭} := Finite.of_equiv _ hfibeq.symm ++ have : Finite {𝔮 : IV // φ 𝔮 = 𝔭} := Finite.of_equiv _ hfibeq.symm + rw [tsum_congr hconst, tsum_const, Nat.card_congr hfibeq, + (hsplit 𝔭.1 𝔭.2.2.1 𝔭.2.1.2.1 𝔭.2.1.2.2).1, nsmul_eq_mul, mul_comm] + +@@ -498,8 +498,8 @@ private theorem finrank_mul_unramified_coprime_le_univ + {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ (Ideal.absNorm 𝔭).Coprime m} s + ≤ primeIdealZetaSum (Set.univ : Set (Ideal (𝓞 ↥(IntermediateField.fixedField H)))) s := by + set F := IntermediateField.fixedField H +- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H +- haveI : NumberField F := NumberField.of_intermediateField F ++ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H ++ have : NumberField F := NumberField.of_intermediateField F + have hsplit : ∀ 𝔭 : Ideal (𝓞 K), 𝔭.IsPrime → UnramifiedIn K L 𝔭 → (Ideal.absNorm 𝔭).Coprime m → + Nat.card {𝔮 : Ideal (𝓞 F) // 𝔮.IsPrime ∧ 𝔮.LiesOver 𝔭 ∧ 𝔮 ≠ ⊥} = Module.finrank K ↥F + ∧ ∀ 𝔮 : Ideal (𝓞 F), 𝔮.IsPrime → 𝔮.LiesOver 𝔭 → Ideal.absNorm 𝔮 = Ideal.absNorm 𝔭 := +@@ -522,8 +522,8 @@ private theorem finrank_fixedField_le_one_of_forall_frobenius_mem_of_coprime + (Ideal.absNorm 𝔭).Coprime m → ((frobeniusClass K L 𝔭).out : L ≃ₐ[K] L) ∈ H) : + Module.finrank K (IntermediateField.fixedField H) ≤ 1 := by + set F := IntermediateField.fixedField H +- haveI : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H +- haveI : NumberField F := NumberField.of_intermediateField F ++ have : IsGalois K F := IsGalois.of_fixedField_normal_subgroup H ++ have : NumberField F := NumberField.of_intermediateField F + set d : ℕ := Module.finrank K ↥F + rw [← Nat.cast_le (α := ℝ), Nat.cast_one] + set A : ℝ → ℝ := fun s ↦ primeIdealZetaSum +diff --git a/projects/Chebotarev/CebotarevDensity/FixedFieldDensity.lean b/projects/Chebotarev/CebotarevDensity/FixedFieldDensity.lean +index 7d40bad6a..33f8b2367 100644 +--- a/projects/Chebotarev/CebotarevDensity/FixedFieldDensity.lean ++++ b/projects/Chebotarev/CebotarevDensity/FixedFieldDensity.lean +@@ -1,8 +1,9 @@ + module + + public import Mathlib.RingTheory.Ideal.Over +-public import Mathlib.NumberTheory.RamificationInertia.Basic ++public import Mathlib.RingTheory.RamificationInertia.Basic + public import CebotarevDensity.Cyclotomic ++public import CebotarevDensity.ForMathlib.TsumFiberBound + + /-! + # Density transfer through a fixed-field subextension (Sharifi 7.2.2 Step 1) +@@ -65,18 +66,18 @@ theorem frobeniusFibre_card_eq_of_isConj + simp only [MulAction.toPerm_apply] + constructor + · rintro ⟨hp, hP, hne, hfrob⟩ +- haveI := hp +- haveI := hP ++ have := hp ++ have := hP + refine ⟨inferInstance, inferInstance, ?_, ?_⟩ + · rw [← Ideal.smul_bot c] + exact (MulAction.injective c).ne hne + · exact hc ▸ hfrob.conj c + · rintro ⟨hp, hP, hne, hfrob⟩ +- haveI := hp +- haveI := hP ++ have := hp ++ have := hP + have hsmul : c⁻¹ • (c • 𝔓) = 𝔓 := inv_smul_smul c 𝔓 +- haveI hp' : 𝔓.IsPrime := hsmul ▸ (inferInstance : (c⁻¹ • (c • 𝔓)).IsPrime) +- haveI hP' : 𝔓.LiesOver 𝔭 := hsmul ▸ (inferInstance : (c⁻¹ • (c • 𝔓)).LiesOver 𝔭) ++ have hp' : 𝔓.IsPrime := hsmul ▸ (inferInstance : (c⁻¹ • (c • 𝔓)).IsPrime) ++ have hP' : 𝔓.LiesOver 𝔭 := hsmul ▸ (inferInstance : (c⁻¹ • (c • 𝔓)).LiesOver 𝔭) + have hne' : 𝔓 ≠ ⊥ := by + rw [← hsmul, ← Ideal.smul_bot c⁻¹] + exact (MulAction.injective c⁻¹).ne hne +@@ -84,7 +85,6 @@ theorem frobeniusFibre_card_eq_of_isConj + have hconj := hfrob.conj c⁻¹ + rwa [hsmul, ← hc, show c⁻¹ * (c * σ * c⁻¹) * c⁻¹⁻¹ = σ by group] at hconj + +-set_option backward.isDefEq.respectTransparency false in + /-- **Balanced fibre count.** If every prime above `𝔭` has Frobenius in the class `C = [σ]` + and conjugate Frobenius values occur equally often (`hequi`), the total number of primes + above `𝔭` is `|C|` times the number with `Frob_𝔓 = σ`: partition by the (class-`C`-valued) +@@ -103,21 +103,21 @@ theorem card_primesAbove_eq_card_carrier_mul_frobeniusFibre + * Nat.card {𝔓 : Ideal (𝓞 L) // ∃ (_ : 𝔓.IsPrime) (_ : 𝔓.LiesOver 𝔭) (_ : 𝔓 ≠ ⊥), + IsArithFrobAt (𝓞 K) σ 𝔓} := by + have hpbot : 𝔭 ≠ ⊥ := UnramifiedIn.ne_bot K L hunr +- haveI : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal hpbot +- haveI : Finite (𝔭.primesOver (𝓞 L)) := (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 L)).to_subtype +- haveI : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := ++ have : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal hpbot ++ have : Finite (𝔭.primesOver (𝓞 L)) := (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 L)).to_subtype ++ have : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := + Finite.of_injective + (fun 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} ↦ + (⟨𝔓.1, 𝔓.2.1, 𝔓.2.2.1⟩ : 𝔭.primesOver (𝓞 L))) +- fun _ _ hab ↦ Subtype.ext (by simpa using hab) +- haveI : Fintype C.carrier := Fintype.ofFinite _ ++ fun _ _ hab ↦ Subtype.ext (congrArg (fun q : 𝔭.primesOver (𝓞 L) ↦ q.1) hab) ++ have : Fintype C.carrier := Fintype.ofFinite _ + have hfinP : ∀ (𝔓 : Ideal (𝓞 L)) [𝔓.IsPrime] (hP : 𝔓.LiesOver 𝔭), Finite (𝓞 L ⧸ 𝔓) := + fun 𝔓 _ hP ↦ UnramifiedIn.finite_quotient K L hunr 𝔓 hP + have hmem : ∀ (𝔓 : Ideal (𝓞 L)) [𝔓.IsPrime] (hP : 𝔓.LiesOver 𝔭), + haveI := hfinP 𝔓 hP + arithFrobAt (𝓞 K) Gal(L/K) 𝔓 ∈ C.carrier := by + intro 𝔓 _ hP +- haveI := hfinP 𝔓 hP ++ have := hfinP 𝔓 hP + rw [ConjClasses.mem_carrier_iff_mk_eq, ← frobeniusClass_eq_mk_of_isArithFrobAt K L 𝔭 hunr _ 𝔓 + (IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) 𝔓) hP, hCfrob] + have hconj : ∀ g : C.carrier, IsConj σ g.1 := by +@@ -138,18 +138,18 @@ theorem card_primesAbove_eq_card_carrier_mul_frobeniusFibre + refine Nat.card_congr ⟨fun x ↦ ⟨x.1.1, x.1.2.1, x.1.2.2.1, x.1.2.2.2, ?_⟩, + fun x ↦ ⟨⟨x.1, by obtain ⟨hp, hP, hne, _⟩ := x.2; exact ⟨hp, hP, hne⟩⟩, ?_⟩, + fun _ ↦ rfl, fun _ ↦ rfl⟩ +- · haveI := x.1.2.1 +- haveI := hfinP x.1.1 x.1.2.2.1 ++ · have := x.1.2.1 ++ have := hfinP x.1.1 x.1.2.2.1 + rw [← Subtype.ext_iff.mp x.2] + exact IsArithFrobAt.arithFrobAt (𝓞 K) Gal(L/K) x.1.1 + · obtain ⟨hp, hP, hne, hg⟩ := x.2 +- haveI := hp +- haveI := hP +- haveI := hfinP x.1 hP +- haveI : Algebra.IsUnramifiedAt (𝓞 K) x.1 := ++ have := hp ++ have := hP ++ have := hfinP x.1 hP ++ have : Algebra.IsUnramifiedAt (𝓞 K) x.1 := + Ideal.ramificationIdx_eq_one_iff.mp + ((Ideal.ramificationIdx'_eq_ramificationIdx (x.1.under (𝓞 K)) x.1 +- (Ideal.IsIntegral.comap_ne_bot (𝓞 K) hne)).symm.trans ++ (Ideal.IsIntegral.under_ne_bot (𝓞 K) hne)).symm.trans + (UnramifiedIn.ramificationIdx_eq_one K L hunr x.1 hP)) + exact Subtype.ext (eq_arithFrobAt_of_isArithFrobAt K L x.1 g.1 hg).symm + simp_rw [hfib] +@@ -239,11 +239,11 @@ theorem arithFrobAt_restrictScalars_eq (E : IntermediateField K L) + Ideal.finiteQuotientOfFreeOfNeBot 𝔓 (ne_bot_of_ramificationIdx_eq_one K L hunrK) + haveI : IsGalois (↥E) L := IsGalois.tower_top_intermediateField E + (arithFrobAt (𝓞 ↥E) Gal(L/(↥E)) 𝔓).restrictScalars K = arithFrobAt (𝓞 K) Gal(L/K) 𝔓 := by +- haveI : IsScalarTower K ↥E L := E.isScalarTower_mid' +- haveI : IsGalois (↥E) L := IsGalois.tower_top_intermediateField E +- haveI : IsGaloisGroup Gal(L/(↥E)) (↥E) L := IsGaloisGroup.of_isGalois (↥E) L +- haveI hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hunrK +- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot ++ have : IsScalarTower K ↥E L := E.isScalarTower_mid' ++ have : IsGalois (↥E) L := IsGalois.tower_top_intermediateField E ++ have : IsGaloisGroup Gal(L/(↥E)) (↥E) L := IsGaloisGroup.of_isGalois (↥E) L ++ have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hunrK ++ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot + set σE := arithFrobAt (𝓞 ↥E) Gal(L/(↥E)) 𝔓 with hσE + have hKfrob1 : IsArithFrobAt (𝓞 K) (σE.restrictScalars K) 𝔓 := by + intro x +@@ -279,28 +279,29 @@ private theorem stabilizer_intermediate_eq_top_of_frobenius + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' + MulAction.stabilizer + Gal(L/↥(IntermediateField.fixedField (Subgroup.zpowers σ))) 𝔓 = ⊤ := by +- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' + have hraK := UnramifiedIn.ramificationIdx_eq_one K L hunrK 𝔓 hPK + have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hraK + have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := UnramifiedIn.ne_bot K L hunrK +- haveI : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot +- haveI : (𝔓.under (𝓞 K)).IsMaximal := ++ have : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot ++ have : (𝔓.under (𝓞 K)).IsMaximal := + (inferInstance : (𝔓.under (𝓞 K)).IsPrime).isMaximal hpbot +- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot +- haveI : Algebra.IsSeparable (𝓞 K ⧸ 𝔓.under (𝓞 K)) (𝓞 L ⧸ 𝔓) := by +- letI : Field (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.Quotient.field _ +- letI : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ ++ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot ++ have : Algebra.IsSeparable (𝓞 K ⧸ 𝔓.under (𝓞 K)) (𝓞 L ⧸ 𝔓) := by ++ let : Field (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.Quotient.field _ ++ let : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ + exact IsGalois.to_isSeparable + have hmem : σ ∈ MulAction.stabilizer Gal(L/K) 𝔓 := hfrob.mem_stabilizer +- have hinertK : (𝔓.under (𝓞 K)).inertiaDeg' 𝔓 = orderOf σ := by +- rw [Ideal.inertiaDeg'_algebraMap, orderOf_eq_finrank_of_isArithFrobAt K L σ 𝔓 hraK hfrob] ++ have hinertK : 𝔓.inertiaDeg (𝓞 K) = orderOf σ := by ++ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔓.under (𝓞 K)) 𝔓, ++ orderOf_eq_finrank_of_isArithFrobAt K L σ 𝔓 hraK hfrob] + have hcardstab' : Nat.card (MulAction.stabilizer Gal(L/K) 𝔓) = orderOf σ := by + rw [Ideal.card_stabilizer_eq (𝔓.under (𝓞 K)) 𝔓, + Ideal.ramificationIdxIn_eq_ramificationIdx (𝔓.under (𝓞 K)) 𝔓 Gal(L/K), + ← Ideal.ramificationIdx'_eq_ramificationIdx (𝔓.under (𝓞 K)) 𝔓 hpbot, hraK, one_mul, + Ideal.inertiaDegIn_eq_inertiaDeg (𝔓.under (𝓞 K)) 𝔓 Gal(L/K), +- ← Ideal.inertiaDeg'_eq_inertiaDeg (𝔓.under (𝓞 K)) 𝔓, hinertK] ++ hinertK] + have hstab : Subgroup.zpowers σ = MulAction.stabilizer Gal(L/K) 𝔓 := + Subgroup.eq_of_le_of_card_ge (by rwa [Subgroup.zpowers_le]) + (by rw [Nat.card_zpowers, hcardstab']) +@@ -331,34 +332,33 @@ private theorem inertiaDeg_under_E_eq_one_of_frobenius + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' + Ideal.ramificationIdx' + (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 = 1 +- ∧ (𝔓.under (𝓞 K)).inertiaDeg' +- (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) = 1 ++ ∧ (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).inertiaDeg (𝓞 K) = 1 + ∧ Nat.card (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) + ⧸ 𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) + = Nat.card (𝓞 K ⧸ 𝔓.under (𝓞 K)) := by + set E := IntermediateField.fixedField (Subgroup.zpowers σ) with hE +- haveI : IsScalarTower K ↥E L := E.isScalarTower_mid' +- haveI : IsGalois (↥E) L := IsGalois.tower_top_intermediateField _ ++ have : IsScalarTower K ↥E L := E.isScalarTower_mid' ++ have : IsGalois (↥E) L := IsGalois.tower_top_intermediateField _ + have hraK := UnramifiedIn.ramificationIdx_eq_one K L hunrK 𝔓 hPK + have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hraK + have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := UnramifiedIn.ne_bot K L hunrK +- haveI : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot +- haveI : (𝔓.under (𝓞 K)).IsMaximal := ++ have : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot ++ have : (𝔓.under (𝓞 K)).IsMaximal := + (inferInstance : (𝔓.under (𝓞 K)).IsPrime).isMaximal hpbot +- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot +- haveI hPEp : (𝔓.under (𝓞 ↥E)).IsPrime := inferInstance +- haveI hPK' : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) +- haveI hPEK : (𝔓.under (𝓞 ↥E)).LiesOver (𝔓.under (𝓞 K)) := inferInstance +- haveI hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥E)) := Ideal.over_under (A := 𝓞 ↥E) (P := 𝔓) +- have hpEbot : 𝔓.under (𝓞 ↥E) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 ↥E) hPbot +- haveI : (𝔓.under (𝓞 ↥E)).IsMaximal := hPEp.isMaximal hpEbot ++ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot ++ have hPEp : (𝔓.under (𝓞 ↥E)).IsPrime := inferInstance ++ have hPK' : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) ++ have hPEK : (𝔓.under (𝓞 ↥E)).LiesOver (𝔓.under (𝓞 K)) := inferInstance ++ have hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥E)) := Ideal.over_under (A := 𝓞 ↥E) (P := 𝔓) ++ have hpEbot : 𝔓.under (𝓞 ↥E) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 ↥E) hPbot ++ have : (𝔓.under (𝓞 ↥E)).IsMaximal := hPEp.isMaximal hpEbot + have hraE : Ideal.ramificationIdx' (𝔓.under (𝓞 ↥E)) 𝔓 = 1 := by + have htower := Ideal.ramificationIdx'_algebra_tower' (𝔓.under (𝓞 K)) (𝔓.under (𝓞 ↥E)) 𝔓 + rw [hraK] at htower + exact Nat.eq_one_of_mul_eq_one_left htower.symm +- haveI : Algebra.IsSeparable (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) (𝓞 L ⧸ 𝔓) := by +- letI : Field (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) := Ideal.Quotient.field _ +- letI : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ ++ have : Algebra.IsSeparable (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) (𝓞 L ⧸ 𝔓) := by ++ let : Field (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) := Ideal.Quotient.field _ ++ let : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ + exact IsGalois.to_isSeparable + have hstabE : MulAction.stabilizer Gal(L/(↥E)) 𝔓 = ⊤ := + stabilizer_intermediate_eq_top_of_frobenius σ 𝔓 hunrK hPK hfrob horderE +@@ -369,26 +369,25 @@ private theorem inertiaDeg_under_E_eq_one_of_frobenius + Ideal.ramificationIdxIn_eq_ramificationIdx (𝔓.under (𝓞 ↥E)) 𝔓 Gal(L/(↥E)), + ← Ideal.ramificationIdx'_eq_ramificationIdx (𝔓.under (𝓞 ↥E)) 𝔓 hpEbot, hraE, one_mul, + Ideal.inertiaDegIn_eq_inertiaDeg (𝔓.under (𝓞 ↥E)) 𝔓 Gal(L/(↥E)), +- ← Ideal.inertiaDeg'_eq_inertiaDeg (𝔓.under (𝓞 ↥E)) 𝔓, +- Ideal.inertiaDeg'_algebraMap] at hcardE +- have hinertTower : (𝔓.under (𝓞 K)).inertiaDeg' 𝔓 +- = (𝔓.under (𝓞 K)).inertiaDeg' (𝔓.under (𝓞 ↥E)) +- * (𝔓.under (𝓞 ↥E)).inertiaDeg' 𝔓 := +- Ideal.inertiaDeg'_algebra_tower (𝔓.under (𝓞 K)) (𝔓.under (𝓞 ↥E)) 𝔓 +- have hinertK : (𝔓.under (𝓞 K)).inertiaDeg' 𝔓 = orderOf σ := by +- rw [Ideal.inertiaDeg'_algebraMap, orderOf_eq_finrank_of_isArithFrobAt K L σ 𝔓 hraK hfrob] +- have hfPE : (𝔓.under (𝓞 ↥E)).inertiaDeg' 𝔓 = orderOf σ := by +- rw [Ideal.inertiaDeg'_algebraMap, ← hcardE, horderE] ++ Ideal.inertiaDeg_eq_of_isMaximal (𝔓.under (𝓞 ↥E)) 𝔓] at hcardE ++ have hinertTower : 𝔓.inertiaDeg (𝓞 K) ++ = (𝔓.under (𝓞 ↥E)).inertiaDeg (𝓞 K) ++ * 𝔓.inertiaDeg (𝓞 ↥E) := ++ Ideal.inertiaDeg_tower (R := 𝓞 K) (𝔓.under (𝓞 ↥E)) 𝔓 ++ have hinertK : 𝔓.inertiaDeg (𝓞 K) = orderOf σ := by ++ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔓.under (𝓞 K)) 𝔓, ++ orderOf_eq_finrank_of_isArithFrobAt K L σ 𝔓 hraK hfrob] ++ have hfPE : 𝔓.inertiaDeg (𝓞 ↥E) = orderOf σ := by ++ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔓.under (𝓞 ↥E)) 𝔓, ← hcardE, horderE] + have hpos : 0 < orderOf σ := orderOf_pos_iff.mpr (isOfFinOrder_of_finite σ) +- have hinertPK : (𝔓.under (𝓞 K)).inertiaDeg' (𝔓.under (𝓞 ↥E)) = 1 := by ++ have hinertPK : (𝔓.under (𝓞 ↥E)).inertiaDeg (𝓞 K) = 1 := by + rw [hinertK, hfPE] at hinertTower + exact Nat.eq_of_mul_eq_mul_right hpos (by rw [one_mul]; exact hinertTower.symm) + refine ⟨hraE, hinertPK, ?_⟩ + have hnormP : Nat.card (𝓞 ↥E ⧸ 𝔓.under (𝓞 ↥E)) +- = Nat.card (𝓞 K ⧸ 𝔓.under (𝓞 K)) ^ (𝔓.under (𝓞 K)).inertiaDeg' (𝔓.under (𝓞 ↥E)) := by ++ = Nat.card (𝓞 K ⧸ 𝔓.under (𝓞 K)) ^ (𝔓.under (𝓞 ↥E)).inertiaDeg (𝓞 K) := by + simpa [Submodule.cardQuot_apply, Ideal.absNorm_apply] using +- Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver (𝔓.under (𝓞 ↥E)) (𝔓.under (𝓞 K)) +- inferInstance hpbot ++ (Ideal.absNorm_pow_inertiaDeg (𝔓.under (𝓞 K)) (𝔓.under (𝓞 ↥E))).symm + rw [hnormP, hinertPK, pow_one] + + open scoped Pointwise in +@@ -405,15 +404,15 @@ private theorem eq_of_liesOver_under_E_of_frobenius + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' + 𝔔.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))))) : + 𝔔 = 𝔓 := by +- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := ++ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := + IsGalois.tower_top_intermediateField _ +- haveI : IsGaloisGroup Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) ++ have : IsGaloisGroup Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) + (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := IsGaloisGroup.of_isGalois _ L + set E := IntermediateField.fixedField (Subgroup.zpowers σ) with hE +- haveI := hQ +- haveI : 𝔓.LiesOver (𝔓.under (𝓞 ↥E)) := Ideal.over_under (A := 𝓞 ↥E) (P := 𝔓) ++ have := hQ ++ have : 𝔓.LiesOver (𝔓.under (𝓞 ↥E)) := Ideal.over_under (A := 𝓞 ↥E) (P := 𝔓) + have hstabE : MulAction.stabilizer Gal(L/(↥E)) 𝔓 = ⊤ := + stabilizer_intermediate_eq_top_of_frobenius σ 𝔓 hunrK hPK hfrob horderE + obtain ⟨τ, hτ⟩ := Ideal.exists_smul_eq_of_isGaloisGroup (𝔓.under (𝓞 ↥E)) 𝔓 𝔔 Gal(L/(↥E)) +@@ -446,18 +445,18 @@ private theorem arithFrobAt_E_eq_of_isArithFrobAt + IsGalois.tower_top_intermediateField _ + arithFrobAt (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) + Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 = σE := by +- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := ++ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := + IsGalois.tower_top_intermediateField _ + have hraK : Ideal.ramificationIdx' (𝔓.under (𝓞 K)) 𝔓 = 1 := + UnramifiedIn.ramificationIdx_eq_one K L hunrK 𝔓 hPK + have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hraK +- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot +- haveI : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := ++ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot ++ have : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := + Ideal.ramificationIdx_eq_one_iff.mp + ((Ideal.ramificationIdx'_eq_ramificationIdx (𝔓.under (𝓞 K)) 𝔓 +- (Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPbot)).symm.trans hraK) ++ (Ideal.IsIntegral.under_ne_bot (𝓞 K) hPbot)).symm.trans hraK) + have hbridge := arithFrobAt_restrictScalars_eq + (IntermediateField.fixedField (Subgroup.zpowers σ)) 𝔓 hraK hraE hnorm + rw [(eq_arithFrobAt_of_isArithFrobAt K L 𝔓 σ hfrob).symm] at hbridge +@@ -480,49 +479,47 @@ private theorem exists_arithFrobAt_over_fibrePrime + (hPunr : UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P) + (hPfrob : frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P + = ConjClasses.mk σE) +- (hPdeg : (P.under (𝓞 K)).inertiaDeg' P = 1) (hPbot : P ≠ ⊥) : ++ (hPdeg : P.inertiaDeg (𝓞 K) = 1) (hPbot : P ≠ ⊥) : + ∃ (𝔓 : Ideal (𝓞 L)) (_ : 𝔓.IsPrime) (_ : 𝔓.LiesOver P) (_ : 𝔓 ≠ ⊥), + 𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) = P ∧ + IsArithFrobAt (𝓞 K) σ 𝔓 := by +- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := ++ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := + IsGalois.tower_top_intermediateField _ + obtain ⟨𝔓, h𝔓p, h𝔓lo, h𝔓bot⟩ := exists_prime_liesOver + (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L P hPbot +- haveI := h𝔓p +- haveI := h𝔓lo ++ have := h𝔓p ++ have := h𝔓lo + have hPeq : 𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) = P := + h𝔓lo.over.symm +- haveI hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := ++ have hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := + Ideal.over_under (A := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) (P := 𝔓) + have hunderK : 𝔓.under (𝓞 K) = P.under (𝓞 K) := by + rw [← Ideal.under_under (B := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) 𝔓, hPeq] + have hunrK : UnramifiedIn K L (𝔓.under (𝓞 K)) := hunderK ▸ hunrP +- haveI : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) +- have hinertPK1 : (𝔓.under (𝓞 K)).inertiaDeg' +- (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) = 1 := by +- rw [hPeq, hunderK] ++ have : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) ++ have hinertPK1 : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).inertiaDeg (𝓞 K) = 1 := by ++ rw [hPeq] + exact hPdeg + have hraE : Ideal.ramificationIdx' + (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 = 1 := + (Ideal.ramificationIdx'_eq_ramificationIdx + (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 +- (Ideal.IsIntegral.comap_ne_bot _ h𝔓bot)).trans ++ (Ideal.IsIntegral.under_ne_bot _ h𝔓bot)).trans + (Ideal.ramificationIdx_eq_one_iff.mpr + (hPunr.2 𝔓 (h𝔓p.isMaximal h𝔓bot) (hPeq ▸ hPPE))) + have hnorm : Nat.card (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) + ⧸ 𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) + = Nat.card (𝓞 K ⧸ 𝔓.under (𝓞 K)) := by +- have hnP := Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver +- (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) (𝔓.under (𝓞 K)) +- inferInstance (UnramifiedIn.ne_bot K L hunrK) ++ have hnP := (Ideal.absNorm_pow_inertiaDeg (𝔓.under (𝓞 K)) ++ (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))))).symm + simp only [Submodule.cardQuot_apply, Ideal.absNorm_apply] at hnP ⊢ + rw [hnP, hinertPK1, pow_one] +- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 h𝔓bot ++ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 h𝔓bot + have hfrEeqσE : arithFrobAt (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) + Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓 = σE := by +- letI : CommMonoid Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := ++ let : CommMonoid Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := + IsMulCommutative.instCommMonoid + have hcl := frobeniusClass_eq_mk_of_isArithFrobAt + (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L P hPunr _ 𝔓 +@@ -560,40 +557,40 @@ private theorem under_E_mem_fibre_of_isArithFrobAt + {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | + P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ + frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P +- = ConjClasses.mk σE ∧ (P.under (𝓞 K)).inertiaDeg' P = 1} ++ = ConjClasses.mk σE ∧ P.inertiaDeg (𝓞 K) = 1} + ∧ (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver 𝔭 + ∧ (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) ≠ ⊥ := by +- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := ++ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := + IsGalois.tower_top_intermediateField _ +- haveI := hP ++ have := hP + have hunderK : 𝔓.under (𝓞 K) = 𝔭 := hP.over.symm + have hunrK : UnramifiedIn K L (𝔓.under (𝓞 K)) := hunderK ▸ hunr +- haveI : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) +- haveI : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot ++ have : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) ++ have : Finite (𝓞 L ⧸ 𝔓) := Ideal.finiteQuotientOfFreeOfNeBot 𝔓 hPbot + obtain ⟨hraE, hinPK, hnorm⟩ := + inertiaDeg_under_E_eq_one_of_frobenius σ 𝔓 hunrK inferInstance hfrob horderE + have hfrE := arithFrobAt_E_eq_of_isArithFrobAt σ σE hσE 𝔓 hunrK inferInstance hfrob horderE + hraE hnorm + have hunram : UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L + (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := by +- refine ⟨Ideal.IsIntegral.comap_ne_bot _ hPbot, fun 𝔔 h𝔔max h𝔔lo ↦ ?_⟩ +- haveI := h𝔔max.isPrime ++ refine ⟨Ideal.IsIntegral.under_ne_bot _ hPbot, fun 𝔔 h𝔔max h𝔔lo ↦ ?_⟩ ++ have := h𝔔max.isPrime + have h𝔔eq : 𝔔 = 𝔓 := eq_of_liesOver_under_E_of_frobenius σ 𝔓 hunrK inferInstance hfrob + horderE 𝔔 h𝔔lo + subst h𝔔eq + exact Ideal.ramificationIdx_eq_one_iff.mp + ((Ideal.ramificationIdx'_eq_ramificationIdx + (𝔔.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔔 +- (Ideal.IsIntegral.comap_ne_bot _ hPbot)).symm.trans hraE) +- haveI hPEK : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver 𝔭 := by +- haveI : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver ++ (Ideal.IsIntegral.under_ne_bot _ hPbot)).symm.trans hraE) ++ have hPEK : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver 𝔭 := by ++ have : (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).LiesOver + (𝔓.under (𝓞 K)) := inferInstance + rwa [hunderK] at this +- haveI hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := ++ have hPPE : 𝔓.LiesOver (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := + Ideal.over_under (A := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) (P := 𝔓) +- refine ⟨⟨inferInstance, hunram, ?_, ?_⟩, hPEK, Ideal.IsIntegral.comap_ne_bot _ hPbot⟩ ++ refine ⟨⟨inferInstance, hunram, ?_, ?_⟩, hPEK, Ideal.IsIntegral.under_ne_bot _ hPbot⟩ + · rw [frobeniusClass_eq_mk_of_isArithFrobAt + (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) + L (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) hunram _ 𝔓 +@@ -601,9 +598,7 @@ private theorem under_E_mem_fibre_of_isArithFrobAt + Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) 𝔓) hPPE, + ConjClasses.mk_eq_mk_iff_isConj] + exact isConj_iff.mpr ⟨1, by simp [hfrE]⟩ +- · rw [show (𝔓.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))).under (𝓞 K) +- = 𝔓.under (𝓞 K) from Ideal.under_under 𝔓] +- exact hinPK ++ · exact hinPK + + /-- **Fibre bijection: degree-one `E`-primes with Frobenius `σ_E` ↔ `L`-primes with + Frobenius `σ`** (Sharifi 7.2.2 p. 143). For a prime `𝔭` of `𝓞 K` unramified in `L` with +@@ -628,12 +623,12 @@ private theorem card_fibre_E_eq_card_fibre_L + P ∈ {P | P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P + ∧ frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P + = ConjClasses.mk σE +- ∧ (P.under (𝓞 K)).inertiaDeg' P = 1} ∧ P.LiesOver 𝔭 ∧ P ≠ ⊥} ++ ∧ P.inertiaDeg (𝓞 K) = 1} ∧ P.LiesOver 𝔭 ∧ P ≠ ⊥} + = Nat.card {𝔓 : Ideal (𝓞 L) // ∃ (_ : 𝔓.IsPrime) (_ : 𝔓.LiesOver 𝔭) (_ : 𝔓 ≠ ⊥), + IsArithFrobAt (𝓞 K) σ 𝔓} := by +- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := ++ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := + IsGalois.tower_top_intermediateField _ + refine (Nat.card_congr (Equiv.ofBijective + (fun 𝔓 ↦ ⟨𝔓.1.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))), +@@ -641,37 +636,37 @@ private theorem card_fibre_E_eq_card_fibre_L + exact under_E_mem_fibre_of_isArithFrobAt σ σE hσE horderE 𝔭 hunr 𝔓.1 hP hPbot hfrob⟩) + ⟨?_, ?_⟩)).symm + · rintro ⟨𝔓₁, h𝔓₁, hP₁, hP₁bot, hfrob₁⟩ ⟨𝔓₂, h𝔓₂, hP₂, hP₂bot, hfrob₂⟩ hΦ +- haveI := h𝔓₁ +- haveI := h𝔓₂ +- haveI := hP₁ +- haveI := hP₂ ++ have := h𝔓₁ ++ have := h𝔓₂ ++ have := hP₁ ++ have := hP₂ + have hunderK₁ : 𝔓₁.under (𝓞 K) = 𝔭 := hP₁.over.symm + have hunrK₁ : UnramifiedIn K L (𝔓₁.under (𝓞 K)) := hunderK₁ ▸ hunr +- haveI : 𝔓₁.LiesOver (𝔓₁.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓₁) ++ have : 𝔓₁.LiesOver (𝔓₁.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓₁) + have hΦ' : 𝔓₂.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) + = 𝔓₁.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) := + congrArg Subtype.val hΦ |>.symm +- haveI hP₂lo : 𝔓₂.LiesOver ++ have hP₂lo : 𝔓₂.LiesOver + (𝔓₁.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := by +- haveI : 𝔓₂.LiesOver ++ have : 𝔓₂.LiesOver + (𝔓₂.under (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := + Ideal.over_under (A := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) (P := 𝔓₂) + rwa [hΦ'] at this + exact Subtype.ext (eq_of_liesOver_under_E_of_frobenius σ 𝔓₁ hunrK₁ inferInstance hfrob₁ + horderE 𝔓₂ hP₂lo).symm + · rintro ⟨P, ⟨hPp, hPunr, hPfrob, hPdeg⟩, hPlo, hPbot⟩ +- haveI := hPp +- haveI := hPlo ++ have := hPp ++ have := hPlo + have hunrP : UnramifiedIn K L (P.under (𝓞 K)) := hPlo.over.symm ▸ hunr + obtain ⟨𝔓, h𝔓p, h𝔓lo, h𝔓bot, hPeq, hfrobK⟩ := + exists_arithFrobAt_over_fibrePrime σ σE hσE P hunrP hPunr hPfrob hPdeg hPbot +- haveI := h𝔓p +- haveI := h𝔓lo ++ have := h𝔓p ++ have := h𝔓lo + have hunderK : 𝔓.under (𝓞 K) = 𝔭 := by + rw [← Ideal.under_under (B := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) 𝔓, + hPeq] + exact hPlo.over.symm +- haveI hPK𝔓 : 𝔓.LiesOver 𝔭 := hunderK ▸ Ideal.over_under (A := 𝓞 K) (P := 𝔓) ++ have hPK𝔓 : 𝔓.LiesOver 𝔭 := hunderK ▸ Ideal.over_under (A := 𝓞 K) (P := 𝔓) + exact ⟨⟨𝔓, h𝔓p, hPK𝔓, h𝔓bot, hfrobK⟩, Subtype.ext hPeq⟩ + + /-- **A degree-one fibre prime has `K`-Frobenius class `[σ]`** (Sharifi 7.2.2 p. 143). If `P` +@@ -690,18 +685,18 @@ private theorem frobeniusClass_under_eq_of_mem_fibre + (hPunr : UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P) + (hPfrob : frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P + = ConjClasses.mk σE) +- (hPdeg : (P.under (𝓞 K)).inertiaDeg' P = 1) (hPbot : P ≠ ⊥) : ++ (hPdeg : P.inertiaDeg (𝓞 K) = 1) (hPbot : P ≠ ⊥) : + frobeniusClass K L (P.under (𝓞 K)) = ConjClasses.mk σ := by +- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := ++ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := + IsGalois.tower_top_intermediateField _ + obtain ⟨𝔓, h𝔓p, h𝔓lo, h𝔓bot, hPeq, hfrobK⟩ := + exists_arithFrobAt_over_fibrePrime σ σE hσE P hunrP hPunr hPfrob hPdeg hPbot +- haveI := h𝔓p +- haveI := h𝔓lo ++ have := h𝔓p ++ have := h𝔓lo + have hunderK : P.under (𝓞 K) = 𝔓.under (𝓞 K) := by + rw [← hPeq, Ideal.under_under] + have hunrK : UnramifiedIn K L (𝔓.under (𝓞 K)) := hunderK ▸ hunrP +- haveI : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) ++ have : 𝔓.LiesOver (𝔓.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓) + rw [hunderK, + frobeniusClass_eq_mk_of_isArithFrobAt K L (𝔓.under (𝓞 K)) hunrK _ 𝔓 hfrobK inferInstance] + +@@ -715,8 +710,8 @@ private theorem tsum_comp_eq_card_fibre_smul {β γ : Type*} (g : β → γ) (h + ∑' b, h (g b) = c * ∑' y, h y := by + rw [← (hsumm.hasSum.tsum_fiberwise g).tsum_eq, ← tsum_mul_left] + refine tsum_congr fun y ↦ ?_ +- haveI := hfin y +- letI := Fintype.ofFinite (g ⁻¹' {y} : Set β) ++ have := hfin y ++ let := Fintype.ofFinite (g ⁻¹' {y} : Set β) + rw [tsum_congr fun b : (g ⁻¹' {y} : Set β) ↦ congrArg h b.2, tsum_fintype, Finset.sum_const, + Finset.card_univ, ← Nat.card_eq_fintype_card, nsmul_eq_mul, hcard, mul_comm] + +@@ -738,13 +733,12 @@ private theorem card_fibre_T1_over_prime + Nat.card {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // + P ∈ {P | P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P + ∧ frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P +- = ConjClasses.mk σE ∧ (P.under (𝓞 K)).inertiaDeg' P = 1} ++ = ConjClasses.mk σE ∧ P.inertiaDeg (𝓞 K) = 1} + ∧ P.LiesOver 𝔭 ∧ P ≠ ⊥} + = Nat.card Gal(L/K) := by + rw [card_fibre_E_eq_card_fibre_L σ σE hσE horderE 𝔭 hunr𝔭 hfrob𝔭, mul_comm, ← mul_assoc] + exact count_primes_above_with_frobenius_eq_sigma K L σ (ConjClasses.mk σ) rfl 𝔭 hunr𝔭 hfrob𝔭 + +-set_option backward.isDefEq.respectTransparency false in + /-- **LEAF A: the degree-one part of `T` carries the main term** (Sharifi 7.2.2 p. 143). For + `1 < s`, the partial Dirichlet sum over the set `T₁` of degree-one (over `K`) primes `P` of + `𝓞 E` above an unramified-in-`L` prime, with `Frob^E_P = [σ_E]`, equals `|G|/(f·|C|)` times the +@@ -767,26 +761,26 @@ private theorem primeIdealZetaSum_fibre_eq_smul + {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | + P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ + frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P +- = ConjClasses.mk σE ∧ (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ ++ = ConjClasses.mk σE ∧ P.inertiaDeg (𝓞 K) = 1 ∧ + UnramifiedIn K L (P.under (𝓞 K))} s + = ((Nat.card Gal(L/K) : ℝ) / (orderOf σ * Nat.card (ConjClasses.mk σ).carrier)) + * primeIdealZetaSum {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ + frobeniusClass K L 𝔭 = ConjClasses.mk σ} s := by +- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- haveI : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := ++ have : IsGalois (↥(IntermediateField.fixedField (Subgroup.zpowers σ))) L := + IsGalois.tower_top_intermediateField _ + set Sset := {𝔭 : Ideal (𝓞 K) | 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭 ∧ + frobeniusClass K L 𝔭 = ConjClasses.mk σ} with hSset + set T₁set := {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | + P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ + frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P = ConjClasses.mk σE ∧ +- (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} with hT₁set ++ P.inertiaDeg (𝓞 K) = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} with hT₁set + set S' := {𝔭 : Ideal (𝓞 K) // 𝔭 ∈ Sset ∧ 𝔭.IsPrime ∧ 𝔭 ≠ ⊥} with hS' + have hgmem : ∀ P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥}, + P.1.under (𝓞 K) ∈ Sset ∧ (P.1.under (𝓞 K)).IsPrime ∧ P.1.under (𝓞 K) ≠ ⊥ := by + rintro ⟨P, ⟨hPp, hPunr, hPfrob, hPdeg, hunrP⟩, _, hPbot⟩ +- haveI := hPp ++ have := hPp + refine ⟨⟨inferInstance, hunrP, ?_⟩, inferInstance, UnramifiedIn.ne_bot K L hunrP⟩ + exact frobeniusClass_under_eq_of_mem_fibre σ σE hσE horderE P hunrP hPunr hPfrob hPdeg hPbot + set g : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥} → S' := +@@ -794,28 +788,28 @@ private theorem primeIdealZetaSum_fibre_eq_smul + have hnormeq : ∀ P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥}, + (Ideal.absNorm P.1 : ℝ) = (Ideal.absNorm (P.1.under (𝓞 K)) : ℝ) := by + rintro ⟨P, ⟨hPp, _, _, hPdeg, _⟩, _, hPbot⟩ +- haveI := hPp +- have hpbot : P.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPbot +- haveI : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) +- have hpow := Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver P (P.under (𝓞 K)) inferInstance hpbot ++ have := hPp ++ have hpbot : P.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) hPbot ++ have : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) ++ have hpow := (Ideal.absNorm_pow_inertiaDeg (P.under (𝓞 K)) P).symm + rw [hPdeg, pow_one] at hpow + rw [hpow] + have hcardfib : ∀ 𝔭 : S', (orderOf σ * Nat.card (ConjClasses.mk σ).carrier) * + Nat.card {P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥} // g P = 𝔭} = Nat.card Gal(L/K) := by + intro 𝔭 + obtain ⟨hp𝔭, hunr𝔭, hfrob𝔭⟩ := 𝔭.2.1 +- haveI := hp𝔭 ++ have := hp𝔭 + have hreindex : Nat.card {P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥} // g P = 𝔭} + = Nat.card {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // + P ∈ {P | P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) + L P ∧ frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P +- = ConjClasses.mk σE ∧ (P.under (𝓞 K)).inertiaDeg' P = 1} ++ = ConjClasses.mk σE ∧ P.inertiaDeg (𝓞 K) = 1} + ∧ P.LiesOver 𝔭.1 ∧ P ≠ ⊥} := by + refine Nat.card_congr ⟨fun x ↦ ⟨x.1.1, ?_, ?_, x.1.2.2.2⟩, + fun y ↦ ⟨⟨y.1, ?_, y.2.1.1, y.2.2.2⟩, ?_⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩ + · exact ⟨x.1.2.1.1, x.1.2.1.2.1, x.1.2.1.2.2.1, x.1.2.1.2.2.2.1⟩ + · exact ⟨(congrArg Subtype.val x.2).symm ▸ (Ideal.over_under (A := 𝓞 K) (P := x.1.1)).over⟩ +- · haveI := y.2.1.1 ++ · have := y.2.1.1 + have hunderK : y.1.under (𝓞 K) = 𝔭.1 := (y.2.2.1).over.symm + exact ⟨y.2.1.1, y.2.1.2.1, y.2.1.2.2.1, y.2.1.2.2.2, by rw [hunderK]; exact hunr𝔭⟩ + · exact Subtype.ext (y.2.2.1).over.symm +@@ -823,18 +817,20 @@ private theorem primeIdealZetaSum_fibre_eq_smul + exact card_fibre_T1_over_prime σ σE hσE horderE 𝔭.1 hunr𝔭 hfrob𝔭 + have hfibfin : ∀ 𝔭 : S', Finite {P : {P // P ∈ T₁set ∧ P.IsPrime ∧ P ≠ ⊥} // g P = 𝔭} := by + intro 𝔭 +- haveI := 𝔭.2.2.1 +- haveI : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 +- haveI : Finite (𝔭.1.primesOver ++ have := 𝔭.2.2.1 ++ have : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 ++ have : Finite (𝔭.1.primesOver + (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := + (IsDedekindDomain.primesOver_finite 𝔭.1 _).to_subtype + refine Finite.of_injective (β := 𝔭.1.primesOver + (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) + (fun P ↦ ⟨P.1.1, P.1.2.2.1, ?_⟩) ?_ +- · haveI := P.1.2.2.1 ++ · have := P.1.2.2.1 + exact ⟨(congrArg Subtype.val P.2).symm ▸ (Ideal.over_under (A := 𝓞 K) (P := P.1.1)).over⟩ + · rintro ⟨⟨P, hP⟩, hgP⟩ ⟨⟨Q, hQ⟩, hgQ⟩ hPQ +- simpa using hPQ ++ exact Subtype.ext (Subtype.ext (congrArg ++ (fun q : 𝔭.1.primesOver ++ (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) ↦ q.1) hPQ)) + have hordC_pos : (0 : ℝ) < orderOf σ * Nat.card (ConjClasses.mk σ).carrier := by + have h₁ : 0 < orderOf σ := orderOf_pos_iff.mpr (isOfFinOrder_of_finite σ) + have : Nonempty (ConjClasses.mk σ).carrier := ⟨⟨σ, ConjClasses.mem_carrier_mk⟩⟩ +@@ -871,83 +867,55 @@ most `[E:K]` primes of `𝓞 E` above it, by `Ideal.card_primesOverFinset_le_fin + over `B` is bounded by the finite cardinality of `B`. Both are constants in `s`, so + `Σ_{T₂} s ≤ C` for all `s > 1`, whence `Σ_{T₂}/Σ_univ^E → 0` since `Σ_univ^E → ∞`. -/ + +-/-- **Fibre-counting bound for `ℝ≥0∞`-valued sums.** If every fibre `g ⁻¹' {y}` is finite with at +-most `d` elements, then `Σ_b f(g b) ≤ d · Σ_y f y`: group `b` by its image `g b`, on each fibre +-the summand is the constant `f y`, and the fibre has `≤ d` terms. -/ +-private theorem tsum_comp_le_card_fibre_mul {β γ : Type*} (g : β → γ) (f : γ → ℝ≥0∞) (d : ℕ) +- (hfin : ∀ y, Finite (g ⁻¹' {y} : Set β)) (hfib : ∀ y, Nat.card (g ⁻¹' {y} : Set β) ≤ d) : +- ∑' b, f (g b) ≤ (d : ℝ≥0∞) * ∑' y, f y := by +- rw [← ENNReal.tsum_fiberwise (fun b ↦ f (g b)) g, ← ENNReal.tsum_mul_left] +- refine ENNReal.tsum_le_tsum (fun y ↦ ?_) +- rw [tsum_congr (fun b : (g ⁻¹' {y} : Set β) ↦ by rw [b.2])] +- haveI := hfin y +- letI := Fintype.ofFinite (g ⁻¹' {y} : Set β) +- rw [tsum_fintype, Finset.sum_const, Finset.card_univ, ← Nat.card_eq_fintype_card, nsmul_eq_mul] +- gcongr +- exact_mod_cast hfib y +- +-/-- **Fibre-counting bound for real-valued sums.** The `ℝ`-valued companion of +-`tsum_comp_le_card_fibre_mul`: for nonnegative summable `FA, FK` with `FA b ≤ FK (g b)` and every +-fibre `g ⁻¹' {y}` finite of size `≤ d`, the sum `Σ_b FA b` is at most `d · Σ_y FK y`. -/ +-private theorem tsum_real_comp_le_card_fibre_mul {β γ : Type*} (g : β → γ) (FA : β → ℝ) +- (FK : γ → ℝ) (d : ℕ) (hsummA : Summable FA) (hsummK : Summable FK) (hnonnegA : ∀ b, 0 ≤ FA b) +- (hnonnegK : ∀ y, 0 ≤ FK y) (hterm : ∀ b, FA b ≤ FK (g b)) +- (hfin : ∀ y, Finite (g ⁻¹' {y} : Set β)) (hfib : ∀ y, Nat.card (g ⁻¹' {y} : Set β) ≤ d) : +- ∑' b, FA b ≤ (d : ℝ) * ∑' y, FK y := by +- have hchain : ∑' b, ENNReal.ofReal (FA b) +- ≤ (d : ℝ≥0∞) * ∑' y, ENNReal.ofReal (FK y) := +- calc ∑' b, ENNReal.ofReal (FA b) ≤ ∑' b, ENNReal.ofReal (FK (g b)) := +- ENNReal.tsum_le_tsum fun b ↦ ENNReal.ofReal_le_ofReal (hterm b) +- _ ≤ (d : ℝ≥0∞) * ∑' y, ENNReal.ofReal (FK y) := +- tsum_comp_le_card_fibre_mul g (ENNReal.ofReal <| FK ·) d hfin hfib +- rw [← ENNReal.ofReal_tsum_of_nonneg hnonnegA hsummA, +- ← ENNReal.ofReal_tsum_of_nonneg hnonnegK hsummK] at hchain +- rw [← ENNReal.toReal_ofReal (tsum_nonneg hnonnegA), +- ← ENNReal.toReal_ofReal (mul_nonneg (Nat.cast_nonneg d) (tsum_nonneg hnonnegK)), +- ENNReal.ofReal_mul (Nat.cast_nonneg d), ENNReal.ofReal_natCast] +- exact ENNReal.toReal_mono (ENNReal.mul_ne_top (by simp) ENNReal.ofReal_ne_top) hchain +- + omit [IsGalois K L] in + /-- For a degree-`≥ 2` prime `P` of `𝓞 E` over `𝔭 = P ∩ 𝓞 K`, the Dirichlet term is dominated by + the square term of `𝔭`: `N P^{-s} ≤ N𝔭^{-2}` for `1 < s`. Here `N P = N𝔭^{f}` with `f ≥ 2` and + `N𝔭 ≥ 2`, so the exponent `f·s ≥ 2` dominates. -/ + private theorem absNorm_rpow_neg_le_under_sq (σ : Gal(L/K)) + (P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) [P.IsPrime] +- (hPb : P ≠ ⊥) {s : ℝ} (hs : 1 < s) (hdeg : 2 ≤ (P.under (𝓞 K)).inertiaDeg' P) : ++ (hPb : P ≠ ⊥) {s : ℝ} (hs : 1 < s) (hdeg : 2 ≤ P.inertiaDeg (𝓞 K)) : + (Ideal.absNorm P : ℝ) ^ (-s) ≤ (Ideal.absNorm (P.under (𝓞 K)) : ℝ) ^ (-(2 : ℝ)) := by + have hppr : (P.under (𝓞 K)).IsPrime := inferInstance +- have hpbot : P.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPb +- haveI : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) +- have hpow := Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver P (P.under (𝓞 K)) hppr hpbot ++ have hpbot : P.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) hPb ++ have : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) ++ have hpow := (Ideal.absNorm_pow_inertiaDeg (P.under (𝓞 K)) P).symm + have hn2 : 2 ≤ Ideal.absNorm (P.under (𝓞 K)) := by + have h0 : Ideal.absNorm (P.under (𝓞 K)) ≠ 0 := Ideal.absNorm_eq_zero_iff.not.mpr hpbot + have h1 : Ideal.absNorm (P.under (𝓞 K)) ≠ 1 := Ideal.absNorm_eq_one_iff.not.mpr hppr.ne_top + omega + rw [hpow, Nat.cast_pow, +- ← Real.rpow_natCast (Ideal.absNorm (P.under (𝓞 K)) : ℝ) ((P.under (𝓞 K)).inertiaDeg' P), ++ ← Real.rpow_natCast (Ideal.absNorm (P.under (𝓞 K)) : ℝ) (P.inertiaDeg (𝓞 K)), + ← Real.rpow_mul (by positivity)] + refine Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast Nat.one_le_of_lt hn2) ?_ +- nlinarith [mul_le_mul (show (2 : ℝ) ≤ ((P.under (𝓞 K)).inertiaDeg' P : ℝ) by exact_mod_cast hdeg) +- hs.le (by norm_num) (by positivity : (0 : ℝ) ≤ ((P.under (𝓞 K)).inertiaDeg' P : ℝ))] ++ nlinarith [mul_le_mul (show (2 : ℝ) ≤ (P.inertiaDeg (𝓞 K) : ℝ) by exact_mod_cast hdeg) ++ hs.le (by norm_num) (by positivity : (0 : ℝ) ≤ (P.inertiaDeg (𝓞 K) : ℝ))] + + omit [IsGalois K L] in + /-- The number of primes of `𝓞 E` over a fixed maximal prime `𝔭` of `𝓞 K` is at most `[E : K]`, + a `Nat.card` repackaging of `Ideal.card_primesOverFinset_le_finrank`. -/ + private theorem card_primesOver_le_finrank (σ : Gal(L/K)) + [NoZeroSMulDivisors (𝓞 K) (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))] +- (𝔭 : Ideal (𝓞 K)) [𝔭.IsMaximal] (h𝔭 : 𝔭 ≠ ⊥) : ++ (𝔭 : Ideal (𝓞 K)) [𝔭.IsMaximal] (_h𝔭 : 𝔭 ≠ ⊥) : + Nat.card {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // + P.IsPrime ∧ P.LiesOver 𝔭} + ≤ Module.finrank K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) := by +- letI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := +- (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- rw [show {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // +- P.IsPrime ∧ P.LiesOver 𝔭} +- = ↥(𝔭.primesOver (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) from rfl, +- Nat.card_coe_set_eq, ← IsDedekindDomain.coe_primesOverFinset h𝔭, Set.ncard_coe_finset] +- exact Ideal.card_primesOverFinset_le_finrank (R := 𝓞 K) +- (S := 𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) +- (K := K) (L := ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) h𝔭 ++ classical ++ let E := IntermediateField.fixedField (Subgroup.zpowers σ) ++ let : IsScalarTower K ↥E L := E.isScalarTower_mid' ++ let : Finite (𝔭.primesOver (𝓞 ↥E)) := ++ (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 ↥E)).to_subtype ++ let : Fintype (𝔭.primesOver (𝓞 ↥E)) := Fintype.ofFinite _ ++ change Nat.card (𝔭.primesOver (𝓞 ↥E)) ≤ Module.finrank K ↥E ++ calc ++ Nat.card (𝔭.primesOver (𝓞 ↥E)) = ∑ _q : 𝔭.primesOver (𝓞 ↥E), (1 : ℕ) := by ++ simp [Nat.card_eq_fintype_card] ++ _ ≤ ∑ q : 𝔭.primesOver (𝓞 ↥E), q.1.ramificationIdx (𝓞 K) * q.1.inertiaDeg (𝓞 K) := by ++ apply Finset.sum_le_sum ++ intro q _ ++ have : q.1.IsPrime := q.2.1 ++ exact Nat.mul_pos (Ideal.ramificationIdx_pos q.1 (𝓞 K)) (Ideal.inertiaDeg_pos q.1 (𝓞 K)) ++ _ = Module.finrank (𝓞 K) (𝓞 ↥E) := Ideal.sum_ramification_inertia_eq_finrank 𝔭 (𝓞 ↥E) ++ _ = Module.finrank K ↥E := (IsFractionRing.finrank_eq (𝓞 K) K (𝓞 ↥E) ↥E).symm + + /-- **The degree-`≥ 2` part of `T₂` is bounded by a constant.** For `1 < s`, the partial sum over + the set `A` of primes `P` of `𝓞 E` whose underlying `K`-prime is unramified in `L` but of inertia +@@ -958,13 +926,13 @@ degree `≥ 2` is bounded by `[E:K]·Σ_𝔭 N𝔭^{-2}`. Indeed `N P = N𝔭^{f + private theorem primeIdealZetaSum_degTwo_le (σ : Gal(L/K)) {s : ℝ} + (hs : 1 < s) (Aset : Set (Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))))) + (hA : Aset = {P | P.IsPrime ∧ P ≠ ⊥ ∧ +- UnramifiedIn K L (P.under (𝓞 K)) ∧ 2 ≤ (P.under (𝓞 K)).inertiaDeg' P}) : ++ UnramifiedIn K L (P.under (𝓞 K)) ∧ 2 ≤ P.inertiaDeg (𝓞 K)}) : + primeIdealZetaSum Aset s + ≤ (Module.finrank K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) : ℝ) + * primeIdealZetaSum (univ : Set (Ideal (𝓞 K))) 2 := by +- letI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ let : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- haveI : NoZeroSMulDivisors (𝓞 K) ++ have : NoZeroSMulDivisors (𝓞 K) + (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) := + ⟨fun {c x} h ↦ by + rw [Algebra.smul_def, mul_eq_zero] at h +@@ -974,24 +942,24 @@ private theorem primeIdealZetaSum_degTwo_le (σ : Gal(L/K)) {s : ℝ} + set KP := {𝔭 : Ideal (𝓞 K) // 𝔭 ∈ (univ : Set (Ideal (𝓞 K))) ∧ 𝔭.IsPrime ∧ 𝔭 ≠ ⊥} with hKP + have hunder : ∀ P : AP, (P.1.under (𝓞 K)).IsPrime ∧ P.1.under (𝓞 K) ≠ ⊥ := by + rintro ⟨P, hPA, hPp, hPb⟩ +- haveI := hPp +- exact ⟨inferInstance, Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPb⟩ ++ have := hPp ++ exact ⟨inferInstance, Ideal.IsIntegral.under_ne_bot (𝓞 K) hPb⟩ + set g : AP → KP := fun P ↦ ⟨P.1.under (𝓞 K), mem_univ _, (hunder P).1, (hunder P).2⟩ with hg + have hterm : ∀ P : AP, (Ideal.absNorm P.1 : ℝ) ^ (-s) + ≤ (Ideal.absNorm (g P).1 : ℝ) ^ (-(2 : ℝ)) := by + rintro ⟨P, hPA, hPp, hPb⟩ +- haveI := hPp ++ have := hPp + rw [hA] at hPA + exact absNorm_rpow_neg_le_under_sq σ P hPb hs hPA.2.2.2 + have hinj : ∀ 𝔭 : KP, Finite (g ⁻¹' {𝔭} : Set AP) ∧ + Nat.card (g ⁻¹' {𝔭} : Set AP) + ≤ Module.finrank K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) := by + intro 𝔭 +- haveI := 𝔭.2.2.1 +- haveI : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 ++ have := 𝔭.2.2.1 ++ have : 𝔭.1.IsMaximal := 𝔭.2.2.1.isMaximal 𝔭.2.2.2 + have hmem : ∀ P : (g ⁻¹' {𝔭} : Set AP), P.1.1.IsPrime ∧ P.1.1.LiesOver 𝔭.1 := by + rintro ⟨⟨P, hPA, hPp, hPb⟩, hgP⟩ +- haveI := hPp ++ have := hPp + exact ⟨hPp, ⟨(congrArg Subtype.val hgP : P.under (𝓞 K) = 𝔭.1) ▸ + (Ideal.over_under (A := 𝓞 K) (P := P)).over⟩⟩ + set hmap : (g ⁻¹' {𝔭} : Set AP) → {P : Ideal (𝓞 ↥(IntermediateField.fixedField +@@ -999,7 +967,7 @@ private theorem primeIdealZetaSum_degTwo_le (σ : Gal(L/K)) {s : ℝ} + have hmapinj : Function.Injective hmap := by + rintro ⟨⟨P, hP⟩, hgP⟩ ⟨⟨Q, hQ⟩, hgQ⟩ hPQ + exact Subtype.ext (Subtype.ext (by simpa only [hhmap, Subtype.mk.injEq] using hPQ)) +- haveI : Finite {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // ++ have : Finite {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) // + P.IsPrime ∧ P.LiesOver 𝔭.1} := + (IsDedekindDomain.primesOver_finite 𝔭.1 _).to_subtype + exact ⟨Finite.of_injective hmap hmapinj, (Nat.card_le_card_of_injective hmap hmapinj).trans +@@ -1021,12 +989,12 @@ private theorem ramifiedBelow_finite (σ : Gal(L/K)) + (𝔭.primesOver (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))))) ?_) + · rw [hB] + rintro P ⟨hPp, hPb, hPnu⟩ +- haveI := hPp +- exact Set.mem_biUnion ⟨inferInstance, Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPb, hPnu⟩ ++ have := hPp ++ exact Set.mem_biUnion ⟨inferInstance, Ideal.IsIntegral.under_ne_bot (𝓞 K) hPb, hPnu⟩ + ⟨hPp, Ideal.over_under (A := 𝓞 K) (P := P)⟩ + · rintro 𝔭 ⟨hp, hb, -⟩ +- haveI := hp +- haveI : 𝔭.IsMaximal := hp.isMaximal hb ++ have := hp ++ have : 𝔭.IsMaximal := hp.isMaximal hb + exact IsDedekindDomain.primesOver_finite 𝔭 _ + + /-- **LEAF B: the degree-`≥ 2` part of `T` vanishes in the density ratio** (Sharifi 7.2.2 +@@ -1051,32 +1019,32 @@ private theorem primeIdealZetaSum_T2_div_univ_tendsto_zero + P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ + frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P + = ConjClasses.mk σE} | +- (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))}) : ++ P.inertiaDeg (𝓞 K) = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))}) : + Tendsto (fun s : ℝ ↦ primeIdealZetaSum T₂set s + / primeIdealZetaSum (univ : Set (Ideal (𝓞 ↥(IntermediateField.fixedField + (Subgroup.zpowers σ))))) s) (𝓝[>] 1) (𝓝 0) := by +- haveI : IsGalois ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsGalois ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + IsGalois.tower_top_intermediateField _ + set Aset := {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | + P.IsPrime ∧ P ≠ ⊥ ∧ UnramifiedIn K L (P.under (𝓞 K)) ∧ +- 2 ≤ (P.under (𝓞 K)).inertiaDeg' P} with hAdef ++ 2 ≤ P.inertiaDeg (𝓞 K)} with hAdef + set Bset := {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | + P.IsPrime ∧ P ≠ ⊥ ∧ ¬ UnramifiedIn K L (P.under (𝓞 K))} with hBdef + have hsub : T₂set ⊆ Aset ∪ Bset := by + rw [hT₂] + rintro P ⟨⟨hPp, hPunr, hPfr⟩, hPnotT1⟩ +- haveI := hPp +- simp only [Set.mem_setOf_eq, not_and] at hPnotT1 ++ have := hPp ++ simp only [Set.mem_ofPred_eq, not_and] at hPnotT1 + have hPb : P ≠ ⊥ := UnramifiedIn.ne_bot _ L hPunr + by_cases hunrK : UnramifiedIn K L (P.under (𝓞 K)) + · refine Or.inl ⟨hPp, hPb, hunrK, ?_⟩ +- have hdegne : (P.under (𝓞 K)).inertiaDeg' P ≠ 1 := fun hdeg1 ↦ ++ have hdegne : P.inertiaDeg (𝓞 K) ≠ 1 := fun hdeg1 ↦ + hPnotT1 ⟨hPp, hPunr, hPfr⟩ hdeg1 hunrK + have hppr : (P.under (𝓞 K)).IsPrime := inferInstance +- haveI : (P.under (𝓞 K)).IsMaximal := +- hppr.isMaximal (Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPb) +- haveI : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) +- have hpos : 0 < (P.under (𝓞 K)).inertiaDeg' P := Ideal.inertiaDeg_pos' _ _ ++ have : (P.under (𝓞 K)).IsMaximal := ++ hppr.isMaximal (Ideal.IsIntegral.under_ne_bot (𝓞 K) hPb) ++ have : P.LiesOver (P.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := P) ++ have hpos : 0 < P.inertiaDeg (𝓞 K) := Ideal.inertiaDeg_pos P (𝓞 K) + omega + · exact Or.inr ⟨hPp, hPb, hunrK⟩ + have hdisj : Disjoint Aset Bset := by +@@ -1149,9 +1117,9 @@ theorem density_lift_through_fixedField + frobeniusClass K L 𝔭 = ConjClasses.mk σ} + ((Nat.card (ConjClasses.mk σ).carrier : ℝ) / Nat.card Gal(L/K)) := by + subst _hEfix +- haveI : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := ++ have : IsScalarTower K ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L := + (IntermediateField.fixedField (Subgroup.zpowers σ)).isScalarTower_mid' +- haveI : IsMulCommutative Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := ++ have : IsMulCommutative Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := + isMulCommutative_galGroup_fixedField σ + have horderE' : + orderOf σ = Nat.card Gal(L/(↥(IntermediateField.fixedField (Subgroup.zpowers σ)))) := +@@ -1160,7 +1128,7 @@ theorem density_lift_through_fixedField + P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ + frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P + = ConjClasses.mk σE} with hTset +- set T₁set := {P ∈ Tset | (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} ++ set T₁set := {P ∈ Tset | P.inertiaDeg (𝓞 K) = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} + with hT₁set + set T₂set := Tset \ T₁set with hT₂set + have hT₁sub : T₁set ⊆ Tset := fun x hx ↦ hx.1 +@@ -1212,10 +1180,10 @@ theorem density_lift_through_fixedField + have hT₁flat : T₁set = {P : Ideal (𝓞 ↥(IntermediateField.fixedField (Subgroup.zpowers σ))) | + P.IsPrime ∧ UnramifiedIn ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P ∧ + frobeniusClass ↥(IntermediateField.fixedField (Subgroup.zpowers σ)) L P = ConjClasses.mk σE ∧ +- (P.under (𝓞 K)).inertiaDeg' P = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} := by ++ P.inertiaDeg (𝓞 K) = 1 ∧ UnramifiedIn K L (P.under (𝓞 K))} := by + rw [hT₁set, hTset] + ext P +- simp only [Set.mem_setOf_eq] ++ simp only [Set.mem_ofPred_eq] + tauto + have hleafA := primeIdealZetaSum_fibre_eq_smul σ σE hσE horderE' hs + rw [← hT₁flat] at hleafA +diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/CharacterOrthogonality.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/CharacterOrthogonality.lean +index a82fed3f7..a4a9a2d72 100644 +--- a/projects/Chebotarev/CebotarevDensity/ForMathlib/CharacterOrthogonality.lean ++++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/CharacterOrthogonality.lean +@@ -78,7 +78,7 @@ theorem card_mul_eq_sum_of_sum_char_mul_eq_zero {G : Type*} [CommGroup G] [Finty + intro s + by_cases hs : s = u + · subst hs; simp +- · rw [if_neg hs] ++ · rw [ite_eq_right hs] + exact sum_char_apply_eq_zero_of_ne_one fun h ↦ hs (inv_mul_eq_one.mp h).symm + calc (Fintype.card (G →* Rˣ) : R) * f u + = ∑ s : G, (if s = u then (Fintype.card (G →* Rˣ) : R) else 0) * f s := by +diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/IdealCongruenceCount.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/IdealCongruenceCount.lean +index 96f816150..4499927f7 100644 +--- a/projects/Chebotarev/CebotarevDensity/ForMathlib/IdealCongruenceCount.lean ++++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/IdealCongruenceCount.lean +@@ -331,7 +331,7 @@ theorem exists_card_coset_inter_smul_sub_volume_mul_rpow_le + set Ts : (ι → ℝ) →L[ℝ] (ι → ℝ) := (T.symm.toContinuousLinearEquiv : (ι → ℝ) →L[ℝ] (ι → ℝ)) + with hTs + have hTslip : LipschitzWith ‖Ts‖₊ (T.symm : (ι → ℝ) → (ι → ℝ)) := by +- simpa [hTs] using Ts.lipschitz ++ simpa [hTs] using Ts.lipschitzWith + have hD'bdd : Bornology.IsBounded D' := hTslip.isBounded_image hbdd + have hD'meas : MeasurableSet D' := + (T.symm.toContinuousLinearEquiv.toHomeomorph.toMeasurableEquiv).measurableSet_image.mpr hmeas +@@ -434,10 +434,10 @@ private theorem norm_eq_prod_real_emb_mul_prod_complex {K : Type*} [Field K] [Nu + star_involutive.eq_iff] + rw [hfilter] + by_cases hw : IsReal w +- · rw [dif_pos hw, ComplexEmbedding.isReal_iff.mp (isReal_iff.mp hw), ++ · rw [dite_eq_left hw, ComplexEmbedding.isReal_iff.mp (isReal_iff.mp hw), + Finset.insert_eq_self.mpr (Finset.mem_singleton_self _), Finset.prod_singleton, + embedding_of_isReal_apply hw] +- · rw [dif_neg hw, Finset.prod_pair] ++ · rw [dite_eq_right hw, Finset.prod_pair] + · rw [ComplexEmbedding.conjugate_coe_eq, Complex.mul_conj] + norm_cast + rw [Complex.normSq_eq_norm_sq] +@@ -452,8 +452,8 @@ private theorem norm_eq_prod_real_emb_mul_prod_complex {K : Type*} [Field K] [Nu + simp_rw [hperplace] + rw [prod_eq_prod_mul_prod] + congr 1 +- · rw [Finset.prod_congr rfl (fun w _ ↦ by rw [dif_pos w.2]), Complex.ofReal_prod] +- · rw [Finset.prod_congr rfl (fun w _ ↦ by rw [dif_neg (not_isReal_iff_isComplex.mpr w.2)]), ++ · rw [Finset.prod_congr rfl (fun w _ ↦ by rw [dite_eq_left w.2]), Complex.ofReal_prod] ++ · rw [Finset.prod_congr rfl (fun w _ ↦ by rw [dite_eq_right (not_isReal_iff_isComplex.mpr w.2)]), + Complex.ofReal_prod] + exact_mod_cast hcc + +@@ -520,7 +520,7 @@ open Ideal in + /-- **Class split of the residue count.** The number of nonzero integral ideals of norm `≤ N` + with norm residue `a (mod c)` is the sum over the (finite) class group of the per-class counts. + The class group is a `Fintype`; finiteness of each fibre follows from +-`Ideal.finite_setOf_absNorm_le₀`. -/ ++`Ideal.finite_setOfPred_absNorm_le₀`. -/ + private theorem card_norm_le_residue_eq_sum_class {K : Type*} [Field K] [NumberField K] + (c : ℕ) [NeZero c] (a : ZMod c) (N : ℕ) : + Nat.card {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ N ∧ +@@ -530,7 +530,7 @@ private theorem card_norm_le_residue_eq_sum_class {K : Type*} [Field K] [NumberF + ((Ideal.absNorm (I : Ideal (𝓞 K)) : ZMod c)) = a) ∧ ClassGroup.mk0 I = C} := by + classical + have hbase : Finite {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ N} := +- Ideal.finite_setOf_absNorm_le₀ N ++ Ideal.finite_setOfPred_absNorm_le₀ N + have hfin : Finite {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ N ∧ + ((Ideal.absNorm (I : Ideal (𝓞 K)) : ZMod c)) = a} := + Finite.of_injective (fun I ↦ (⟨I.1, I.2.1⟩ : +@@ -660,7 +660,7 @@ private theorem cone_normLe_eq_smul_normLeOne {K : Type*} [Field K] [NumberField + have ht0 : (0 : ℝ) < t := lt_of_lt_of_le one_pos ht + have htne : t ≠ 0 := ht0.ne' + ext x +- simp only [Set.mem_setOf_eq, Set.mem_smul_set, normLeOne, Set.mem_inter_iff, Set.mem_setOf_eq] ++ simp only [Set.mem_ofPred_eq, Set.mem_smul_set, normLeOne, Set.mem_inter_iff, Set.mem_ofPred_eq] + constructor + · rintro ⟨hcone, hnorm⟩ + refine ⟨t⁻¹ • x, ⟨(smul_mem_iff_mem (inv_ne_zero htne)).mpr hcone, ?_⟩, ?_⟩ +@@ -736,8 +736,8 @@ private theorem exists_lipschitz_cube_cover_hyperplane_slab {ι : Type*} [Fintyp + rw [dist_pi_le_iff (by positivity)] + intro i + by_cases hij : i = j +- · simp only [hφ, dif_pos hij, dist_self]; positivity +- · simp only [hφ, dif_neg hij] ++ · simp only [hφ, dite_eq_left hij, dist_self]; positivity ++ · simp only [hφ, dite_eq_right hij] + have hreorg : (2 * R) * c (σ.symm ⟨i, hij⟩) - R - ((2 * R) * c' (σ.symm ⟨i, hij⟩) - R) + = (2 * R) * (c (σ.symm ⟨i, hij⟩) - c' (σ.symm ⟨i, hij⟩)) := by ring + rw [Real.dist_eq, hreorg, abs_mul, abs_of_nonneg (by positivity : (0 : ℝ) ≤ 2 * R), +@@ -752,8 +752,8 @@ private theorem exists_lipschitz_cube_cover_hyperplane_slab {ι : Type*} [Fintyp + refine ⟨0, ⟨le_refl _, zero_le_one⟩, ?_⟩ + ext i; simp only [hφ] + by_cases hij : i = j +- · rw [dif_pos hij, hx0]; rfl +- · rw [dif_neg hij, hx0]; simp [← hR0] ++ · rw [dite_eq_left hij, hx0]; rfl ++ · rw [dite_eq_right hij, hx0]; simp [← hR0] + · refine ⟨fun k ↦ (x (σ k) + R) / (2 * R), ⟨?_, ?_⟩, ?_⟩ + · intro k; simp only [Pi.zero_apply] + rw [le_div_iff₀ (by positivity)]; have := (abs_le.mp (hxbd (σ k))).1; linarith +@@ -761,8 +761,8 @@ private theorem exists_lipschitz_cube_cover_hyperplane_slab {ι : Type*} [Fintyp + rw [div_le_one (by positivity)]; have := (abs_le.mp (hxbd (σ k))).2; linarith + · ext i + by_cases hij : i = j +- · rw [hφ]; simp only; rw [dif_pos hij, hij]; exact hxj.symm +- · rw [hφ]; simp only [dif_neg hij, Equiv.apply_symm_apply]; field_simp; ring ++ · rw [hφ]; simp only; rw [dite_eq_left hij, hij]; exact hxj.symm ++ · rw [hφ]; simp only [dite_eq_right hij, Equiv.apply_symm_apply]; field_simp; ring + + /-- **Union of two Lipschitz cube covers.** If `A` and `B` are each covered by finitely many + `Lipschitz`-images of `[0,1]^(card ι - 1)`, so is `A ∪ B` (concatenate the families, take the max +@@ -822,13 +822,13 @@ private theorem frontier_signOrthant_subset {ι κ : Type*} [Finite κ] (g : κ + set O : Set (ι → ℝ) := {y | (∀ k ∈ s, y (g k) ≤ 0) ∧ (∀ k ∉ s, 0 ≤ y (g k))} with hO + set Os : Set (ι → ℝ) := {y | (∀ k ∈ s, y (g k) < 0) ∧ (∀ k ∉ s, 0 < y (g k))} with hOs + have hOclosed : IsClosed O := by +- simp only [hO, Set.setOf_and, Set.setOf_forall] ++ simp only [hO, Set.ofPred_and, Set.ofPred_forall] + exact (isClosed_iInter fun k ↦ isClosed_iInter fun _ ↦ + isClosed_le (continuous_apply (g k)) continuous_const).inter + (isClosed_iInter fun k ↦ isClosed_iInter fun _ ↦ + isClosed_le continuous_const (continuous_apply (g k))) + have hOsopen : IsOpen Os := by +- simp only [hOs, Set.setOf_and, Set.setOf_forall] ++ simp only [hOs, Set.ofPred_and, Set.ofPred_forall] + exact (isOpen_iInter_of_finite fun k ↦ isOpen_iInter_of_finite fun _ ↦ + isOpen_lt (continuous_apply (g k)) continuous_const).inter + (isOpen_iInter_of_finite fun k ↦ isOpen_iInter_of_finite fun _ ↦ +@@ -840,7 +840,7 @@ private theorem frontier_signOrthant_subset {ι κ : Type*} [Finite κ] (g : κ + rw [frontier_eq_closure_inter_closure] at hy + rw [interior_eq_compl_closure_compl]; exact fun hh ↦ hh hy.2 + by_contra hcon +- simp only [Set.mem_iUnion, Set.mem_setOf_eq, not_exists] at hcon ++ simp only [Set.mem_iUnion, Set.mem_ofPred_eq, not_exists] at hcon + exact hyni (mem_interior.mpr ⟨Os, hsub, hOsopen, + ⟨fun k hk ↦ lt_of_le_of_ne (hyO.1 k hk) (hcon k), + fun k hk ↦ lt_of_le_of_ne (hyO.2 k hk) (Ne.symm (hcon k))⟩⟩) +@@ -985,14 +985,14 @@ private theorem exists_card_cell_sub_mul_rpow_le_explicit {ι : Type*} [Fintype + * t ^ (Fintype.card ι)| + ≤ C * t ^ (Fintype.card ι - 1 : ℕ) := by + classical +- haveI : Fintype κ := Fintype.ofFinite κ ++ have : Fintype κ := Fintype.ofFinite κ + set T' : (ι → ℝ) ≃ₗ[ℝ] (ι → ℝ) := (LinearEquiv.smulOfNeZero ℝ (ι → ℝ) (m : ℝ) hm).trans T + set Ds : Set (ι → ℝ) := + D₀ ∩ {y : ι → ℝ | (∀ k ∈ s, y (g k) ≤ 0) ∧ (∀ k ∉ s, 0 ≤ y (g k))} + have hDsbdd : Bornology.IsBounded Ds := hbdd.subset Set.inter_subset_left + have hOclosed : IsClosed {y : ι → ℝ | (∀ k ∈ s, y (g k) ≤ 0) ∧ (∀ k ∉ s, 0 ≤ y (g k))} := by + classical +- rw [setOf_and] ++ rw [ofPred_and] + refine IsClosed.inter ?_ ?_ + · have h : {y : ι → ℝ | ∀ k ∈ s, y (g k) ≤ 0} = ⋂ k ∈ s, {y : ι → ℝ | y (g k) ≤ 0} := by + ext y; simp +@@ -1514,7 +1514,7 @@ private theorem exists_card_residue_fibre_sub_mul_rpow_le_explicit {K : Type*} [ + ((Φ.toHomeomorph.toMeasurableEquiv).measurableSet_image.mpr (measurableSet_normLeOne K)) + hcov (Sum.inl : {w : InfinitePlace K // IsReal w} → index K) s + refine ⟨cellC, fun t ht ↦ ?_⟩ +- rw [if_pos ⟨a₀, horth₀, hcos₀, hres₀⟩] ++ rw [ite_eq_left ⟨a₀, horth₀, hcos₀, hres₀⟩] + have hfibre : Nat.card {a : idealSet K J // + (mixedEmbedding.norm (a : mixedSpace K) ≤ t ^ Module.finrank ℚ K ∧ + ((intNorm (idealSetEquiv K J a).val : ZMod m) = (b : ZMod m))) ∧ +@@ -1538,7 +1538,7 @@ private theorem exists_card_residue_fibre_sub_mul_rpow_le_explicit {K : Type*} [ + rw [hpow1, hpow2] + exact hcell (T (fun i ↦ ((k i).val : ℝ))) t ht + · refine ⟨0, fun t ht ↦ ?_⟩ +- rw [if_neg hQ] ++ rw [ite_eq_right hQ] + have hempty : IsEmpty {a : idealSet K J // + (mixedEmbedding.norm (a : mixedSpace K) ≤ t ^ Module.finrank ℚ K ∧ + ((intNorm (idealSetEquiv K J a).val : ZMod m) = (b : ZMod m))) ∧ +@@ -1590,14 +1590,14 @@ private theorem exists_card_residue_fibre_sub_mul_rpow_le {K : Type*} [Field K] + open Ideal NumberField.mixedEmbedding NumberField.mixedEmbedding.fundamentalCone Units in + /-- **Finiteness of bounded-norm cone points.** The cone points of `idealSet K J` of norm `≤ s` + form a finite set: they inject (via `integerSetEquiv ∘ idealSetMap`) into the product of the +-finite set of integral ideals of norm `≤ ⌊s⌋` (`Ideal.finite_setOf_absNorm_le₀`) with the finite ++finite set of integral ideals of norm `≤ ⌊s⌋` (`Ideal.finite_setOfPred_absNorm_le₀`) with the finite + torsion group. -/ + private theorem finite_idealSet_norm_le {K : Type*} [Field K] [NumberField K] + (J : (Ideal (𝓞 K))⁰) (s : ℝ) : + Finite {a : idealSet K J // mixedEmbedding.norm (a : mixedSpace K) ≤ s} := by + classical + have : Finite {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ ⌊s⌋₊} := +- (Ideal.finite_setOf_absNorm_le₀ ⌊s⌋₊).to_subtype ++ (Ideal.finite_setOfPred_absNorm_le₀ ⌊s⌋₊).to_subtype + refine Finite.of_injective (β := {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ ⌊s⌋₊} × + torsion K) (fun a ↦ ⟨⟨(integerSetEquiv K (idealSetMap K J a.1)).1.1, ?_⟩, + (integerSetEquiv K (idealSetMap K J a.1)).2⟩) ?_ +@@ -1838,7 +1838,7 @@ private theorem exists_card_norm_le_residue_class_eq_sub_mul_rpow_le + classical + obtain ⟨J, hJ⟩ := ClassGroup.mk0_surjective C⁻¹ + have hNJ : 0 < Ideal.absNorm (J : Ideal (𝓞 K)) := absNorm_pos_of_nonZeroDivisors J +- haveI : NeZero (c * Ideal.absNorm (J : Ideal (𝓞 K))) := ++ have : NeZero (c * Ideal.absNorm (J : Ideal (𝓞 K))) := + ⟨Nat.mul_ne_zero (NeZero.ne c) hNJ.ne'⟩ + obtain ⟨κ, C', hκ⟩ := exists_card_dvd_principal_residue_eq_sub_mul_rpow_le + (c * Ideal.absNorm (J : Ideal (𝓞 K))) (a.val * Ideal.absNorm (J : Ideal (𝓞 K))) J +@@ -2403,7 +2403,7 @@ private theorem crt_single_coset {ι : Type*} [Finite ι] (L L' : Submodule ℤ + = {z | ∃ x ∈ M, z = m • x} := by + intro M + ext z +- simp only [Set.mem_smul_set, SetLike.mem_coe, Set.mem_setOf_eq] ++ simp only [Set.mem_smul_set, SetLike.mem_coe, Set.mem_ofPred_eq] + exact ⟨fun ⟨x, hx, h⟩ ↦ ⟨x, hx, by rw [← h, Nat.cast_smul_eq_nsmul]⟩, + fun ⟨x, hx, h⟩ ↦ ⟨x, hx, by rw [h, Nat.cast_smul_eq_nsmul]⟩⟩ + have hbij := hcop.nsmul_right_bijective +@@ -2429,7 +2429,7 @@ private theorem crt_single_coset {ι : Type*} [Finite ι] (L L' : Submodule ℤ + rw [QuotientAddGroup.eq_zero_iff, AddSubgroup.mem_addSubgroupOf] at hq0 + simpa using hq0 + ext a +- simp only [Set.mem_setOf_eq, hmsmul, Set.mem_vadd_set, Set.mem_setOf_eq, vadd_eq_add] ++ simp only [Set.mem_ofPred_eq, hmsmul, Set.mem_vadd_set, Set.mem_ofPred_eq, vadd_eq_add] + constructor + · rintro ⟨haL', w, ⟨x, hxL, rfl⟩, hweq⟩ + rw [hξeq] at hweq +@@ -2578,7 +2578,7 @@ private theorem exists_card_fibre_dvd_eq_card_cell {K : Type*} [Field K] [Number + have hrel : L'.toAddSubgroup.relIndex L.toAddSubgroup = Ideal.absNorm (𝔟 : Ideal (𝓞 K)) := + relIndex_chart_eq_absNorm J 𝔟 T T' hT hT' + have hNB : 0 < Ideal.absNorm (𝔟 : Ideal (𝓞 K)) := absNorm_pos_of_nonZeroDivisors 𝔟 +- haveI hfin : Finite (L.toAddSubgroup ⧸ L'.toAddSubgroup.addSubgroupOf L.toAddSubgroup) := by ++ have hfin : Finite (L.toAddSubgroup ⧸ L'.toAddSubgroup.addSubgroupOf L.toAddSubgroup) := by + rw [← AddSubgroup.index_ne_zero_iff_finite] + rw [show (L'.toAddSubgroup.addSubgroupOf L.toAddSubgroup).index + = L'.toAddSubgroup.relIndex L.toAddSubgroup from rfl, hrel] +@@ -2779,7 +2779,7 @@ private theorem exists_card_fibre_dvd_residue_sub_mul_rpow_le {K : Type*} [Field + ((fun i ↦ (round ((T.symm (Φ (a : mixedSpace K))) i) : ZMod m)) = k) ∧ + ((intNorm (idealSetEquiv K J a).val : ZMod m) = (b : ZMod m)) + · obtain ⟨a₀, horth₀, hcos₀, hres₀⟩ := hQ +- rw [if_pos ⟨a₀, horth₀, hcos₀, hres₀⟩] ++ rw [ite_eq_left ⟨a₀, horth₀, hcos₀, hres₀⟩] + have hdrop : Nat.card {a : idealSet K (𝔟 * J) // + (mixedEmbedding.norm (a : mixedSpace K) ≤ t ^ d ∧ + ((intNorm (idealSetEquiv K (𝔟 * J) a).val : ZMod m) = (b : ZMod m))) ∧ +@@ -2806,7 +2806,7 @@ private theorem exists_card_fibre_dvd_residue_sub_mul_rpow_le {K : Type*} [Field + have hcell'' := hcell' ξ' t ht + rw [smul_chart_lattice_eq T' m hm, ← hOs, hdetratio, hcard] at hcell'' + exact hcell''.trans (by gcongr; exact le_abs_self _) +- · rw [if_neg hQ, zero_div, zero_mul, sub_zero] ++ · rw [ite_eq_right hQ, zero_div, zero_mul, sub_zero] + have : IsEmpty {a : idealSet K (𝔟 * J) // + (mixedEmbedding.norm (a : mixedSpace K) ≤ t ^ d ∧ + ((intNorm (idealSetEquiv K (𝔟 * J) a).val : ZMod m) = (b : ZMod m))) ∧ +@@ -3011,7 +3011,7 @@ private theorem cardNormLeResidueClassDvd_div_density {K : Type*} [Field K] [Num + have hNJ : 0 < NJ := absNorm_pos_of_nonZeroDivisors J + have hNBc : NB.Coprime c := by rw [hNBdef, ZMod.isUnit_iff_coprime] at hu; exact hu + have hcop : NB.Coprime (c * NJ) := Nat.Coprime.mul_right hNBc (hNJdef ▸ hJcop.symm) +- haveI : NeZero (c * NJ) := ⟨Nat.mul_ne_zero (NeZero.ne c) hNJ.ne'⟩ ++ have : NeZero (c * NJ) := ⟨Nat.mul_ne_zero (NeZero.ne c) hNJ.ne'⟩ + have hm : ((c * NJ : ℕ) : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (NeZero.ne (c * NJ)) + obtain ⟨κ, C', hJcone, h𝔟Jcone⟩ := + exists_card_idealSet_residue_real_le_dvd (c * NJ) hm (y.val * NJ) J 𝔟 hcop +diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/LatticePointCount.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/LatticePointCount.lean +index d1ed572f5..ad3fc2802 100644 +--- a/projects/Chebotarev/CebotarevDensity/ForMathlib/LatticePointCount.lean ++++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/LatticePointCount.lean +@@ -296,7 +296,7 @@ theorem abs_card_inter_sub_volume_mul_pow_le {s : Set (ι → ℝ)} + set Tag : Set (ι → ℤ) := {ν | tag n ν ∈ s} with hTag + have himg : index n '' (s ∩ (n : ℝ)⁻¹ • span ℤ (Set.range (Pi.basisFun ℝ ι))) = Tag := by + ext ν +- simp only [hTag, Set.mem_image, Set.mem_inter_iff, Set.mem_setOf_eq] ++ simp only [hTag, Set.mem_image, Set.mem_inter_iff, Set.mem_ofPred_eq] + constructor + · rintro ⟨x, ⟨hxs, hxL⟩, rfl⟩ + rwa [tag_index_eq_self_of_mem_smul_span n hxL] +diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/NormLeOneLipschitz.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/NormLeOneLipschitz.lean +index 8241f43b0..e8d648364 100644 +--- a/projects/Chebotarev/CebotarevDensity/ForMathlib/NormLeOneLipschitz.lean ++++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/NormLeOneLipschitz.lean +@@ -152,19 +152,19 @@ open scoped Classical in + theorem contDiff_faceMapZero : ContDiff ℝ 1 (faceMapZero K) := by + refine (contDiff_expMapBasis K).comp (contDiff_pi.mpr fun w ↦ ?_) + by_cases hw : w = w₀ +- · simpa only [dif_pos hw] using contDiff_const +- · simpa only [dif_neg hw] using contDiff_apply ℝ ℝ _ ++ · simpa only [dite_eq_left hw] using contDiff_const ++ · simpa only [dite_eq_right hw] using contDiff_apply ℝ ℝ _ + + open scoped Classical in + theorem contDiff_faceMapSide (i : {w : InfinitePlace K // w ≠ w₀}) (a : ℝ) : + ContDiff ℝ 1 (faceMapSide K i a) := by + refine (contDiff_apply ℝ ℝ i).smul ((contDiff_expMapBasis K).comp (contDiff_pi.mpr fun w ↦ ?_)) + by_cases hw : w = w₀ +- · simpa only [dif_pos hw] using contDiff_const +- · simp only [dif_neg hw] ++ · simpa only [dite_eq_left hw] using contDiff_const ++ · simp only [dite_eq_right hw] + by_cases hi : (⟨w, hw⟩ : {w // w ≠ w₀}) = i +- · simpa only [if_pos hi] using contDiff_const +- · simpa only [if_neg hi] using contDiff_apply ℝ ℝ _ ++ · simpa only [ite_eq_left hi] using contDiff_const ++ · simpa only [ite_eq_right hi] using contDiff_apply ℝ ℝ _ + + /-- **Abstract topological core.** For an open injective map `f` and a set `s`, if the closure of + `f '' s` is contained in `f '' closure s` together with one extra point `p`, then the frontier of +@@ -222,12 +222,12 @@ private theorem expMapBasis_mem_iUnion_faceMapSide + fun w' ↦ if w' = w₀ then 0 else y w' := by + funext w' + by_cases hw'₀ : w' = w₀ +- · simp only [dif_pos hw'₀, if_pos hw'₀] +- · simp only [dif_neg hw'₀, if_neg hw'₀] ++ · simp only [dite_eq_left hw'₀, ite_eq_left hw'₀] ++ · simp only [dite_eq_right hw'₀, ite_eq_right hw'₀] + by_cases hw'w : (⟨w', hw'₀⟩ : {w // w ≠ w₀}) = i + · obtain rfl : w' = w := by rw [hi, Subtype.mk_eq_mk] at hw'w; exact hw'w +- simp only [if_pos hw'w] +- · simp only [hc, if_neg hw'w] ++ simp only [ite_eq_left hw'w] ++ · simp only [hc, ite_eq_right hw'w] + rw [faceMapSide, expMapBasis_apply'' y, hci, hfun] + refine Set.mem_iUnion.mpr ⟨i, Set.mem_iUnion₂.mpr ⟨y w, ?_, ⟨c, hcmem, hkey⟩⟩⟩ + rcases ha with h | h <;> simp [h] +@@ -252,16 +252,16 @@ theorem image_boundary_subset_faces : + have hIcc : ∀ v : InfinitePlace K, v ≠ w₀ → y v ∈ Icc (0 : ℝ) 1 := fun v hv ↦ by + simpa [hv] using hyc v + by_cases hwe : w = w₀ +- · rw [if_pos hwe, Set.mem_Iio, not_lt, hwe] at hw ++ · rw [ite_eq_left hwe, Set.mem_Iio, not_lt, hwe] at hw + have hy0 : y w₀ = 0 := le_antisymm hw₀ hw + refine Or.inl ⟨fun i ↦ y i.1, ⟨fun i ↦ (hIcc i.1 i.2).1, fun i ↦ (hIcc i.1 i.2).2⟩, ?_⟩ + rw [faceMapZero] + congr 1 + funext v + by_cases hv : v = w₀ +- · rw [dif_pos hv, hv, hy0] +- · simp only [dif_neg hv] +- · rw [if_neg hwe] at hw ++ · rw [dite_eq_left hv, hv, hy0] ++ · simp only [dite_eq_right hv] ++ · rw [ite_eq_right hwe] at hw + have h1 := hIcc w hwe + rw [Set.mem_Ioo, not_and_or, not_lt, not_lt] at hw + refine Or.inr (expMapBasis_mem_iUnion_faceMapSide K hwe hw₀ hIcc ?_) +@@ -598,8 +598,8 @@ theorem mem_iUnion_image_liftToMixed_of_eq + refine Prod.ext (funext fun w ↦ ?_) (funext fun w ↦ ?_) + · simp only [hε, hmodreal w] + by_cases hpos : 0 ≤ x.1 w +- · rw [decide_eq_true hpos, if_pos rfl, one_mul, abs_of_nonneg hpos] +- · rw [decide_eq_false hpos, if_neg (by simp), abs_of_neg (not_le.mp hpos)] ++ · rw [decide_eq_true hpos, ite_eq_left rfl, one_mul, abs_of_nonneg hpos] ++ · rw [decide_eq_false hpos, ite_eq_right (by simp), abs_of_neg (not_le.mp hpos)] + ring + · simp only [hcph w, hmodcplx w] + exact hθeq w +@@ -675,7 +675,7 @@ theorem normLeOne_frontier_lipschitz_cover_index : + refine ⟨m, ‖(Φ : mixedSpace K →L[ℝ] (index K → ℝ))‖₊ * (M * 1), + fun j c ↦ Φ (φ j (fun a ↦ c (g.symm a))), + fun j ↦ (Φ : mixedSpace K →L[ℝ] (index K → ℝ)).lipschitzWith.comp ((hφ j).comp +- (IsometryEquiv.piCongrLeft' (Y := fun _ ↦ ℝ) g).isometry.lipschitz), ?_⟩ ++ (IsometryEquiv.piCongrLeft' (Y := fun _ ↦ ℝ) g).isometry.lipschitzWith), ?_⟩ + rw [← Φ.coe_toHomeomorph, ← Φ.toHomeomorph.image_frontier] + refine (Set.image_mono hcov).trans ?_ + rw [Set.image_iUnion] +diff --git a/projects/Chebotarev/CebotarevDensity/ForMathlib/TsumFiberBound.lean b/projects/Chebotarev/CebotarevDensity/ForMathlib/TsumFiberBound.lean +new file mode 100644 +index 000000000..02e8c54a0 +--- /dev/null ++++ b/projects/Chebotarev/CebotarevDensity/ForMathlib/TsumFiberBound.lean +@@ -0,0 +1,51 @@ ++module ++ ++public import Mathlib.Topology.Algebra.InfiniteSum.Real ++public import Mathlib.Topology.Instances.ENNReal.Lemmas ++ ++/-! Fibre-counting bounds for nonnegative sums. -/ ++ ++@[expose] public section ++ ++open Set ++open scoped ENNReal ++ ++namespace Chebotarev ++ ++/-- **Fibre-counting bound for `ℝ≥0∞`-valued sums.** If every fibre `g ⁻¹' {y}` is finite with at ++most `d` elements, then `Σ_b f(g b) ≤ d · Σ_y f y`: group `b` by its image `g b`, on each fibre ++the summand is the constant `f y`, and the fibre has `≤ d` terms. -/ ++private theorem tsum_comp_le_card_fibre_mul {β γ : Type*} (g : β → γ) (f : γ → ℝ≥0∞) (d : ℕ) ++ (hfin : ∀ y, Finite (g ⁻¹' {y} : Set β)) (hfib : ∀ y, Nat.card (g ⁻¹' {y} : Set β) ≤ d) : ++ ∑' b, f (g b) ≤ (d : ℝ≥0∞) * ∑' y, f y := by ++ rw [← ENNReal.tsum_fiberwise (fun b ↦ f (g b)) g, ← ENNReal.tsum_mul_left] ++ refine ENNReal.tsum_le_tsum (fun y ↦ ?_) ++ rw [tsum_congr (fun b : (g ⁻¹' {y} : Set β) ↦ by rw [b.2])] ++ have := hfin y ++ let := Fintype.ofFinite (g ⁻¹' {y} : Set β) ++ rw [tsum_fintype, Finset.sum_const, Finset.card_univ, ← Nat.card_eq_fintype_card, nsmul_eq_mul] ++ gcongr ++ exact_mod_cast hfib y ++ ++/-- **Fibre-counting bound for real-valued sums.** The `ℝ`-valued companion of ++`tsum_comp_le_card_fibre_mul`: for nonnegative summable `FA, FK` with `FA b ≤ FK (g b)` and every ++fibre `g ⁻¹' {y}` finite of size `≤ d`, the sum `Σ_b FA b` is at most `d · Σ_y FK y`. -/ ++theorem tsum_real_comp_le_card_fibre_mul {β γ : Type*} (g : β → γ) (FA : β → ℝ) ++ (FK : γ → ℝ) (d : ℕ) (hsummA : Summable FA) (hsummK : Summable FK) (hnonnegA : ∀ b, 0 ≤ FA b) ++ (hnonnegK : ∀ y, 0 ≤ FK y) (hterm : ∀ b, FA b ≤ FK (g b)) ++ (hfin : ∀ y, Finite (g ⁻¹' {y} : Set β)) (hfib : ∀ y, Nat.card (g ⁻¹' {y} : Set β) ≤ d) : ++ ∑' b, FA b ≤ (d : ℝ) * ∑' y, FK y := by ++ have hchain : ∑' b, ENNReal.ofReal (FA b) ++ ≤ (d : ℝ≥0∞) * ∑' y, ENNReal.ofReal (FK y) := ++ calc ∑' b, ENNReal.ofReal (FA b) ≤ ∑' b, ENNReal.ofReal (FK (g b)) := ++ ENNReal.tsum_le_tsum fun b ↦ ENNReal.ofReal_le_ofReal (hterm b) ++ _ ≤ (d : ℝ≥0∞) * ∑' y, ENNReal.ofReal (FK y) := ++ tsum_comp_le_card_fibre_mul g (ENNReal.ofReal <| FK ·) d hfin hfib ++ rw [← ENNReal.ofReal_tsum_of_nonneg hnonnegA hsummA, ++ ← ENNReal.ofReal_tsum_of_nonneg hnonnegK hsummK] at hchain ++ rw [← ENNReal.toReal_ofReal (tsum_nonneg hnonnegA), ++ ← ENNReal.toReal_ofReal (mul_nonneg (Nat.cast_nonneg d) (tsum_nonneg hnonnegK)), ++ ENNReal.ofReal_mul (Nat.cast_nonneg d), ENNReal.ofReal_natCast] ++ exact ENNReal.toReal_mono (ENNReal.mul_ne_top (by simp) ENNReal.ofReal_ne_top) hchain ++ ++end Chebotarev +diff --git a/projects/Chebotarev/CebotarevDensity/Frobenius.lean b/projects/Chebotarev/CebotarevDensity/Frobenius.lean +index a5556b12b..de813c534 100644 +--- a/projects/Chebotarev/CebotarevDensity/Frobenius.lean ++++ b/projects/Chebotarev/CebotarevDensity/Frobenius.lean +@@ -102,7 +102,7 @@ theorem UnramifiedIn.ramificationIdx_eq_one [IsGalois K L] + (hP : 𝔓.LiesOver 𝔭) : Ideal.ramificationIdx' (𝔓.under (𝓞 K)) 𝔓 = 1 := by + have := hP + have h𝔓 : 𝔓 ≠ ⊥ := Ideal.ne_bot_of_liesOver_of_ne_bot hunr.1 𝔓 +- have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) h𝔓 ++ have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) h𝔓 + have : Algebra.IsUnramifiedAt (𝓞 K) 𝔓 := hunr.2 𝔓 (‹𝔓.IsPrime›.isMaximal h𝔓) hP + rw [Ideal.ramificationIdx'_eq_ramificationIdx (𝔓.under (𝓞 K)) 𝔓 hpbot] + exact Ideal.ramificationIdx_eq_one_of_isUnramifiedAt +@@ -120,7 +120,7 @@ theorem inertiaGroup_trivial_of_unramified [IsGalois K L] + (hunr : Ideal.ramificationIdx' (𝔓.under (𝓞 K)) 𝔓 = 1) : + Ideal.inertia Gal(L/K) 𝔓 = ⊥ := by + have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L hunr +- have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPbot ++ have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) hPbot + have : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot + have : (𝔓.under (𝓞 K)).IsMaximal := + (inferInstance : (𝔓.under (𝓞 K)).IsPrime).isMaximal hpbot +@@ -129,7 +129,7 @@ theorem inertiaGroup_trivial_of_unramified [IsGalois K L] + let : Field (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.Quotient.field _ + let : Field (𝓞 L ⧸ 𝔓) := Ideal.Quotient.field _ + exact IsGalois.to_isSeparable +- haveI : Finite (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.finiteQuotientOfFreeOfNeBot _ hpbot ++ have : Finite (𝓞 K ⧸ 𝔓.under (𝓞 K)) := Ideal.finiteQuotientOfFreeOfNeBot _ hpbot + have hcard : + Nat.card (Ideal.inertia Gal(L/K) 𝔓) = + Ideal.ramificationIdx' (𝔓.under (𝓞 K)) 𝔓 := by +@@ -206,7 +206,7 @@ theorem frobeniusClass_eq_mk_of_isArithFrobAt [IsGalois K L] + (σ : Gal(L/K)) (𝔓 : Ideal (𝓞 L)) [𝔓.IsPrime] (hσ : IsArithFrobAt (𝓞 K) σ 𝔓) + (hP : 𝔓.LiesOver 𝔭) : + frobeniusClass K L 𝔭 = ConjClasses.mk σ := by +- rw [frobeniusClass, dif_pos ⟨‹𝔭.IsPrime›, hunr⟩] ++ rw [frobeniusClass, dite_eq_left ⟨‹𝔭.IsPrime›, hunr⟩] + exact (exists_frobeniusClass K L 𝔭 hunr).choose_spec σ 𝔓 hσ hP + + /-- The order of an arithmetic Frobenius at an unramified prime is its residue degree. -/ +@@ -218,7 +218,7 @@ theorem orderOf_eq_finrank_of_isArithFrobAt + (hσ : IsArithFrobAt (𝓞 K) σ 𝔓) : + orderOf σ = Module.finrank (𝓞 K ⧸ 𝔓.under (𝓞 K)) (𝓞 L ⧸ 𝔓) := by + have hPbot : 𝔓 ≠ ⊥ := ne_bot_of_ramificationIdx_eq_one K L h +- have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.comap_ne_bot (𝓞 K) hPbot ++ have hpbot : 𝔓.under (𝓞 K) ≠ ⊥ := Ideal.IsIntegral.under_ne_bot (𝓞 K) hPbot + have : 𝔓.IsMaximal := ‹𝔓.IsPrime›.isMaximal hPbot + have : (𝔓.under (𝓞 K)).IsMaximal := + (inferInstance : (𝔓.under (𝓞 K)).IsPrime).isMaximal hpbot +@@ -287,14 +287,13 @@ theorem card_primesAbove_mul_finrank_eq + let : Field (𝓞 K ⧸ 𝔓₀.under (𝓞 K)) := Ideal.Quotient.field _ + let : Field (𝓞 L ⧸ 𝔓₀) := Ideal.Quotient.field _ + exact IsGalois.to_isSeparable +- haveI : Finite (𝓞 K ⧸ 𝔓₀.under (𝓞 K)) := ++ have : Finite (𝓞 K ⧸ 𝔓₀.under (𝓞 K)) := + Ideal.finiteQuotientOfFreeOfNeBot _ hp_under_bot + have H := + Ideal.ncard_primesOver_mul_card_inertia_mul_finrank + (G := Gal(L/K)) (𝔓₀.under (𝓞 K)) 𝔓₀ + rw [inertiaGroup_trivial_of_unramified K L 𝔓₀ he, Subgroup.card_bot, mul_one, +- ← Ideal.inertiaDeg'_eq_inertiaDeg (𝔓₀.under (𝓞 K)) 𝔓₀, +- Ideal.inertiaDeg'_algebraMap (𝔓₀.under (𝓞 K)) 𝔓₀] at H ++ Ideal.inertiaDeg_eq_of_isMaximal (𝔓₀.under (𝓞 K)) 𝔓₀] at H + have hset : (𝔓₀.under (𝓞 K)).primesOver (𝓞 L) + = {𝔓 : Ideal (𝓞 L) | 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := by + ext 𝔓 +@@ -427,7 +426,7 @@ theorem finite_primes_natCast_mem (p : ℕ) (hp : p ≠ 0) : + have hfin := Ideal.finite_factors (R := 𝓞 K) hspan + apply Set.Finite.ofFinset (hfin.toFinset.image (·.asIdeal)) + intro 𝔭 +- simp only [Set.Finite.mem_toFinset, Finset.mem_image, Set.mem_setOf_eq] ++ simp only [Set.Finite.mem_toFinset, Finset.mem_image, Set.mem_ofPred_eq] + constructor + · rintro ⟨v, hv, rfl⟩ + exact +diff --git a/projects/Chebotarev/CebotarevDensity/Main.lean b/projects/Chebotarev/CebotarevDensity/Main.lean +index 678f99731..5cb630f0a 100644 +--- a/projects/Chebotarev/CebotarevDensity/Main.lean ++++ b/projects/Chebotarev/CebotarevDensity/Main.lean +@@ -90,7 +90,7 @@ so `|C| = 1`. -/ + theorem ConjClasses_carrier_card_eq_one_of_comm + {G : Type*} [Monoid G] [IsMulCommutative G] [Finite G] (g : G) : + Nat.card (ConjClasses.mk g).carrier = 1 := by +- letI : CommMonoid G := IsMulCommutative.instCommMonoid ++ let : CommMonoid G := IsMulCommutative.instCommMonoid + have h : (ConjClasses.mk g).carrier = {g} := by + ext a + simp [ConjClasses.mem_carrier_iff_mk_eq, ConjClasses.mk_eq_mk_iff_isConj, isConj_iff_eq] +@@ -260,7 +260,7 @@ private theorem ratPrime_eq_span (𝔭 : Ideal (𝓞 ℚ)) (hp : 𝔭.IsPrime) ( + `p`, via the same `𝓞 ℚ ≃+* ℤ` transport (`comap` of the prime `span {(p : ℤ)}`). -/ + private theorem span_nat_isPrime {p : ℕ} (hpp : p.Prime) : + (Ideal.span {(p : 𝓞 ℚ)}).IsPrime := by +- haveI : (Ideal.span {(p : ℤ)}).IsPrime := ++ have : (Ideal.span {(p : ℤ)}).IsPrime := + (Ideal.span_singleton_prime (by exact_mod_cast hpp.ne_zero)).mpr + (Nat.prime_iff_prime_int.mp hpp) + rw [ratSpan_eq_comap_intSpan] +@@ -278,8 +278,8 @@ private theorem unramifiedIn_cyclotomic_of_coprime {K : Type*} [Field K] [Number + UnramifiedIn K L 𝔭 := by + classical + refine ⟨h𝔭, fun 𝔓 h𝔓max h𝔓lo ↦ ?_⟩ +- haveI := h𝔓lo +- haveI : 𝔓.IsPrime := h𝔓max.isPrime ++ have := h𝔓lo ++ have : 𝔓.IsPrime := h𝔓max.isPrime + rw [← not_dvd_differentIdeal_iff (A := 𝓞 K) (B := 𝓞 L)] + intro hdvd + obtain ⟨ζ, hζ⟩ := IsCyclotomicExtension.exists_isPrimitiveRoot K L +@@ -337,7 +337,7 @@ private theorem frobeniusClass_eq_iff_residue + (𝔭 : Ideal (𝓞 ℚ)) [𝔭.IsPrime] (hunr : UnramifiedIn ℚ L 𝔭) + (hcop : (Ideal.absNorm 𝔭).Coprime n) : + frobeniusClass ℚ L 𝔭 = ConjClasses.mk σ ↔ (Ideal.absNorm 𝔭 : ZMod n) = a := by +- letI : CommMonoid (L ≃ₐ[ℚ] L) := IsMulCommutative.instCommMonoid ++ let : CommMonoid (L ≃ₐ[ℚ] L) := IsMulCommutative.instCommMonoid + have hdict := autToPow_frobeniusClass_out ℚ L n hζ 𝔭 hunr hcop + rw [show frobeniusClass ℚ L 𝔭 = ConjClasses.mk (frobeniusClass ℚ L 𝔭).out from + (Quotient.out_eq _).symm, ConjClasses.mk_eq_mk_iff_isConj, isConj_iff_eq] +@@ -389,7 +389,7 @@ private theorem dirichlet_AP_fibre_diff_image_subset_bad + (fun p : ℕ ↦ Ideal.span {(p : 𝓞 ℚ)}) '' {p : ℕ | p.Prime ∧ (p : ZMod n) = a} ⊆ + (fun q : ℕ ↦ Ideal.span {(q : 𝓞 ℚ)}) '' {q : ℕ | q.Prime ∧ q ∣ n} := by + rintro 𝔭 ⟨⟨hpr, hunr, hfrob⟩, hnotI⟩ +- haveI := hpr ++ have := hpr + obtain ⟨q, hqp, hqeq⟩ := ratPrime_eq_span 𝔭 hpr (UnramifiedIn.ne_bot ℚ L hunr) + have hnorm : Ideal.absNorm 𝔭 = q := by rw [hqeq, absNorm_span_nat] + by_cases hcop : (Ideal.absNorm 𝔭).Coprime n +@@ -414,7 +414,7 @@ private theorem dirichlet_AP_image_diff_fibre_subset_bad + (fun q : ℕ ↦ Ideal.span {(q : 𝓞 ℚ)}) '' {q : ℕ | q.Prime ∧ q ∣ n} := by + rintro 𝔭 ⟨⟨p, ⟨hpp, hpa⟩, rfl⟩, hnotF⟩ + have hprime : (Ideal.span {(p : 𝓞 ℚ)}).IsPrime := span_nat_isPrime hpp +- haveI := hprime ++ have := hprime + have hp0 : (p : 𝓞 ℚ) ≠ 0 := Nat.cast_ne_zero.mpr hpp.ne_zero + by_cases hdvd : p ∣ n + · exact ⟨p, ⟨hpp, hdvd⟩, rfl⟩ +@@ -438,11 +438,11 @@ private theorem dirichlet_AP_main (n : ℕ) (hn4 : n % 4 ≠ 2) (hn : 1 ≤ n) + ((Nat.totient n : ℝ)⁻¹) := by + have : NeZero n := ⟨by lia⟩ + -- The module system does not auto-synthesise `NeZero (n : ℚ)` for `CyclotomicField n ℚ` here. +- haveI : NeZero ((n : ℕ) : ℚ) := ⟨by exact_mod_cast (show n ≠ 0 by lia)⟩ ++ have : NeZero ((n : ℕ) : ℚ) := ⟨by exact_mod_cast (show n ≠ 0 by lia)⟩ + set L := CyclotomicField n ℚ +- haveI : IsCyclotomicExtension {n} ℚ L := CyclotomicField.isCyclotomicExtension n ℚ +- haveI : IsGalois ℚ L := IsCyclotomicExtension.isGalois {n} ℚ L +- haveI : IsMulCommutative (L ≃ₐ[ℚ] L) := ++ have : IsCyclotomicExtension {n} ℚ L := CyclotomicField.isCyclotomicExtension n ℚ ++ have : IsGalois ℚ L := IsCyclotomicExtension.isGalois {n} ℚ L ++ have : IsMulCommutative (L ≃ₐ[ℚ] L) := + IsCyclotomicExtension.isMulCommutative (S := {n}) ℚ L + have hirr : Irreducible (Polynomial.cyclotomic n ℚ) := + Polynomial.cyclotomic.irreducible_rat (by lia) +diff --git a/projects/Chebotarev/CebotarevDensity/NumberFieldEulerProduct.lean b/projects/Chebotarev/CebotarevDensity/NumberFieldEulerProduct.lean +index 753a2f1ee..28b3b5b8b 100644 +--- a/projects/Chebotarev/CebotarevDensity/NumberFieldEulerProduct.lean ++++ b/projects/Chebotarev/CebotarevDensity/NumberFieldEulerProduct.lean +@@ -2,7 +2,7 @@ module + + public import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics + public import Mathlib.Analysis.Normed.Ring.InfiniteSum +-public import Mathlib.Data.Finite.Vector ++public import Mathlib.Data.Fintype.Vector + public import Mathlib.Data.Finsupp.Multiset + public import Mathlib.Data.Sym.Card + public import Mathlib.NumberTheory.NumberField.Cyclotomic.Basic +@@ -249,7 +249,7 @@ lemma sum_idealNormMultiplicity_isBigO : + classical + have h_finite : ∀ (b : ℕ), {I : NonzeroIdeal L | Ideal.absNorm I.1 = b}.Finite := fun b ↦ + Set.Finite.preimage (f := fun I : NonzeroIdeal L ↦ I.1) (fun _ _ _ _ ↦ Subtype.ext) +- (Ideal.finite_setOf_absNorm_eq (S := 𝓞 L) b) ++ (Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 L) b) + have h_sum_card : ∀ n : ℕ, ∑ k ∈ Finset.Icc 1 n, idealNormMultiplicity L k = + Nat.card {I : NonzeroIdeal L // Ideal.absNorm I.1 ≤ n} := fun n ↦ by + have key := Finset.card_preimage_eq_sum_card_image_eq (f := fun I : NonzeroIdeal L ↦ +@@ -257,7 +257,7 @@ lemma sum_idealNormMultiplicity_isBigO : + rw [show ((fun I : NonzeroIdeal L ↦ Ideal.absNorm I.1) ⁻¹' ↑(Finset.Icc 1 n)) = + {I : NonzeroIdeal L | Ideal.absNorm I.1 ≤ n} by + ext ⟨I, hI⟩ +- simp only [Set.mem_preimage, Finset.coe_Icc, Set.mem_Icc, Set.mem_setOf_eq] ++ simp only [Set.mem_preimage, Finset.coe_Icc, Set.mem_Icc, Set.mem_ofPred_eq] + exact ⟨fun h ↦ h.2, fun h ↦ + ⟨Nat.one_le_iff_ne_zero.mpr (mt Ideal.absNorm_eq_zero_iff.mp hI), h⟩⟩] at key + exact key.symm +@@ -501,7 +501,7 @@ eventually captured, so the partial sums tend to `∑_𝔞 N𝔞^{-s} = ζ_K(s)` + private instance instFiniteAbsNormFiber (n : ℕ) : + Finite {I : NonzeroIdeal L // Ideal.absNorm I.1 = n} := + Set.Finite.to_subtype <| Set.Finite.of_finite_image (f := fun I : NonzeroIdeal L ↦ I.1) +- ((Ideal.finite_setOf_absNorm_eq (S := 𝓞 L) n).subset (by rintro _ ⟨⟨I, _⟩, rfl, rfl⟩; rfl)) ++ ((Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 L) n).subset (by rintro _ ⟨⟨I, _⟩, rfl, rfl⟩; rfl)) + (fun _ _ _ _ ↦ Subtype.ext) + + private lemma tsum_absNormFiber {M : Type*} [AddCommGroup M] [TopologicalSpace M] [T2Space M] +@@ -583,14 +583,14 @@ private theorem factorization_prod_primePow_eq + rw [factorization_prod_primePow_apply L S e 𝔮] + simp_rw [factorization_primePow_apply L] + by_cases h𝔮 : 𝔮 ∈ S +- · rw [if_pos h𝔮, Finset.sum_eq_single (⟨𝔮, h𝔮⟩ : {x // x ∈ S})] +- · rw [if_pos rfl] ++ · rw [ite_eq_left h𝔮, Finset.sum_eq_single (⟨𝔮, h𝔮⟩ : {x // x ∈ S})] ++ · rw [ite_eq_left rfl] + · rintro b _ hb +- rw [if_neg (fun h ↦ hb (Subtype.ext h.symm))] ++ rw [ite_eq_right (fun h ↦ hb (Subtype.ext h.symm))] + · exact fun h ↦ absurd (Finset.mem_attach S _) h +- · rw [if_neg h𝔮, Finset.sum_eq_zero] ++ · rw [ite_eq_right h𝔮, Finset.sum_eq_zero] + rintro ⟨b, hb⟩ - +- rw [if_neg (fun h : 𝔮 = b ↦ h𝔮 (h.symm ▸ hb))] ++ rw [ite_eq_right (fun h : 𝔮 = b ↦ h𝔮 (h.symm ▸ hb))] + + open UniqueFactorizationMonoid in + /-- The normalized prime factors of `𝔞` as a `Finset` of nonzero prime ideals. -/ +@@ -624,9 +624,9 @@ private theorem factorization_idealOfExp_eq + classical + have hprod : (∏ 𝔭 ∈ S.attach, 𝔭.1.1 ^ (fun q ↦ if h : q ∈ S then f ⟨q, h⟩ else 0) 𝔭.1) + = ∏ 𝔭 ∈ S.attach, 𝔭.1.1 ^ f 𝔭 := +- Finset.prod_congr rfl fun 𝔭 _ ↦ by simp only [dif_pos 𝔭.2] ++ Finset.prod_congr rfl fun 𝔭 _ ↦ by simp only [dite_eq_left 𝔭.2] + rw [← hprod, factorization_prod_primePow_eq L S +- (fun q ↦ if h : q ∈ S then f ⟨q, h⟩ else 0) 𝔮.1, if_pos 𝔮.2, dif_pos 𝔮.2] ++ (fun q ↦ if h : q ∈ S then f ⟨q, h⟩ else 0) 𝔮.1, ite_eq_left 𝔮.2, dite_eq_left 𝔮.2] + + open UniqueFactorizationMonoid in + private theorem prod_primePow_count_eq (S : Finset {𝔭 : Ideal (𝓞 L) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥}) +diff --git a/projects/Chebotarev/CebotarevDensity/ZetaProduct.lean b/projects/Chebotarev/CebotarevDensity/ZetaProduct.lean +index 356695e9a..c67aa3c90 100644 +--- a/projects/Chebotarev/CebotarevDensity/ZetaProduct.lean ++++ b/projects/Chebotarev/CebotarevDensity/ZetaProduct.lean +@@ -172,11 +172,11 @@ private theorem norm_galoisCharacterOnIdeal_le_one + (χ : galoisCharacter K L) (𝔞 : Ideal (𝓞 K)) : + ‖galoisCharacterOnIdeal K L χ 𝔞‖ ≤ 1 := by + rw [galoisCharacterOnIdeal, norm_prod] +- refine Finset.prod_le_one (fun i _ ↦ norm_nonneg _) (fun 𝔭 _ ↦ ?_) ++ refine Finset.prod_le_one₀ (fun i _ ↦ norm_nonneg _) (fun 𝔭 _ ↦ ?_) + rw [norm_pow] + by_cases h : UnramifiedIn K L 𝔭 +- · rw [if_pos h, norm_galoisCharacter_out, one_pow] +- · rw [if_neg h, norm_zero] ++ · rw [ite_eq_left h, norm_galoisCharacter_out, one_pow] ++ · rw [ite_eq_right h, norm_zero] + exact zero_pow_le_one _ + + /-- Sharifi 7.1.18 (p. 141): Euler product for an abelian Galois +@@ -212,18 +212,18 @@ theorem exists_artinLSeries_eulerProduct_abelian + have hsupp : Function.mulSupport f ⊆ Set.range g := by + intro 𝔭 hmem + simp only [Function.mem_mulSupport, hf] at hmem +- haveI := 𝔭.2.1 ++ have := 𝔭.2.1 + have hunr : UnramifiedIn K L 𝔭.1 := by + by_contra hnr + apply hmem +- rw [hw, galoisCharacterOnIdeal_apply_prime K L χ 𝔭.1 𝔭.2.2, if_neg hnr, zero_mul, sub_zero, ++ rw [hw, galoisCharacterOnIdeal_apply_prime K L χ 𝔭.1 𝔭.2.2, ite_eq_right hnr, zero_mul, sub_zero, + inv_one] + exact ⟨⟨𝔭.1, 𝔭.2.1, hunr⟩, rfl⟩ + rw [← hg_inj.tprod_eq hsupp] + refine tprod_congr fun 𝔭 ↦ ?_ + simp only [hf, hg, hw] +- haveI := 𝔭.2.1 +- rw [galoisCharacterOnIdeal_apply_prime K L χ 𝔭.1 𝔭.2.2.ne_bot, if_pos 𝔭.2.2] ++ have := 𝔭.2.1 ++ rw [galoisCharacterOnIdeal_apply_prime K L χ 𝔭.1 𝔭.2.2.ne_bot, ite_eq_left 𝔭.2.2] + + /-! ### Sub-lemmas for `dedekindZeta_local_factor_eq_product_artin_local` + +@@ -350,7 +350,6 @@ private theorem cpow_neg_absNorm_eq_pow {a b : ℕ} (f : ℕ) (s : ℂ) + (h : b = a ^ f) : ((b : ℂ)) ^ (-s) = ((a : ℂ) ^ (-s)) ^ f := by + rw [h, Nat.cast_pow, ← Complex.natCast_cpow_natCast_mul, Complex.cpow_nat_mul] + +-set_option backward.isDefEq.respectTransparency false in + /-- Sharifi 7.1.16 (p. 141) local step: the local Euler factor at an + unramified prime `𝔭` of `K` factors as a product over characters. + Source quote (paraphrased identity): the local factor +@@ -365,12 +364,12 @@ theorem dedekindZeta_local_factor_eq_product_artin_local + (1 - (χ (frobeniusClass K L 𝔭).out : ℂ) * (Ideal.absNorm 𝔭 : ℂ) ^ (-s))⁻¹ := by + classical + open scoped IsMulCommutative in +- letI : CommGroup Gal(L/K) := inferInstance ++ let : CommGroup Gal(L/K) := inferInstance + set σ : Gal(L/K) := (frobeniusClass K L 𝔭).out + set Y : ℂ := (Ideal.absNorm 𝔭 : ℂ) ^ (-s) with hY + set f : ℕ := orderOf σ with hf +- haveI : Fintype Gal(L/K) := Fintype.ofFinite _ +- haveI : Fintype (Gal(L/K) →* ℂˣ) := Fintype.ofFinite _ ++ have : Fintype Gal(L/K) := Fintype.ofFinite _ ++ have : Fintype (Gal(L/K) →* ℂˣ) := Fintype.ofFinite _ + have hfpos : 0 < f := hf ▸ orderOf_pos_iff.mpr (isOfFinOrder_of_finite σ) + have hcount : Nat.card {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} + = Nat.card Gal(L/K) / f := by +@@ -383,29 +382,29 @@ theorem dedekindZeta_local_factor_eq_product_artin_local + = ((1 - Y ^ f) ^ (Nat.card Gal(L/K) / f))⁻¹ := by + rw [tprod_fintype, Finset.prod_inv_distrib, prod_galoisCharacter_one_sub σ Y, hf] + have hpbot : 𝔭 ≠ ⊥ := UnramifiedIn.ne_bot K L _hunr +- haveI : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal hpbot +- haveI : Finite (𝔭.primesOver (𝓞 L)) := (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 L)).to_subtype +- haveI : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := ++ have : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal hpbot ++ have : Finite (𝔭.primesOver (𝓞 L)) := (IsDedekindDomain.primesOver_finite 𝔭 (𝓞 L)).to_subtype ++ have : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := + Finite.of_injective + (fun 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} ↦ + (⟨𝔓.1, 𝔓.2.1, 𝔓.2.2.1⟩ : 𝔭.primesOver (𝓞 L))) +- fun _ _ hab ↦ Subtype.ext (by simpa using hab) +- haveI : Fintype {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := Fintype.ofFinite _ ++ fun _ _ hab ↦ Subtype.ext (congrArg (fun q : 𝔭.primesOver (𝓞 L) ↦ q.1) hab) ++ have : Fintype {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥} := Fintype.ofFinite _ + have hterm : ∀ 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver 𝔭 ∧ 𝔓 ≠ ⊥}, + (1 - (Ideal.absNorm 𝔓.1 : ℂ) ^ (-s))⁻¹ = (1 - Y ^ f)⁻¹ := by + intro 𝔓 +- haveI := 𝔓.2.1 +- haveI hlo : 𝔓.1.LiesOver 𝔭 := 𝔓.2.2.1 +- have hdeg : (𝔓.1.under (𝓞 K)).inertiaDeg' 𝔓.1 = f := by +- rw [Ideal.inertiaDeg'_algebraMap, hf] ++ have := 𝔓.2.1 ++ have hlo : 𝔓.1.LiesOver 𝔭 := 𝔓.2.2.1 ++ have : 𝔓.1.IsMaximal := 𝔓.2.1.isMaximal 𝔓.2.2.2 ++ have : (𝔓.1.under (𝓞 K)).IsMaximal := hlo.over ▸ ‹𝔭.IsMaximal› ++ have hdeg : 𝔓.1.inertiaDeg (𝓞 K) = f := by ++ rw [Ideal.inertiaDeg_eq_of_isMaximal (𝔓.1.under (𝓞 K)) 𝔓.1, hf] + exact finrank_residue_eq_orderOf K L σ (frobeniusClass K L 𝔭) (Quotient.out_eq _) + 𝔭 _hunr rfl 𝔓.1 hlo +- haveI : 𝔓.1.LiesOver (𝔓.1.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓.1) +- have hpubot : 𝔓.1.under (𝓞 K) ≠ ⊥ := hlo.over ▸ hpbot +- haveI : (𝔓.1.under (𝓞 K)).IsPrime := hlo.over ▸ ‹𝔭.IsPrime› ++ have : 𝔓.1.LiesOver (𝔓.1.under (𝓞 K)) := Ideal.over_under (A := 𝓞 K) (P := 𝔓.1) ++ have : (𝔓.1.under (𝓞 K)).IsPrime := hlo.over ▸ ‹𝔭.IsPrime› + have hnorm : Ideal.absNorm 𝔓.1 = Ideal.absNorm 𝔭 ^ f := by +- rw [Ideal.absNorm_eq_pow_inertiaDeg'_of_liesOver 𝔓.1 (𝔓.1.under (𝓞 K)) inferInstance hpubot, +- hdeg, ← hlo.over] ++ rw [← Ideal.absNorm_pow_inertiaDeg 𝔭 𝔓.1, hdeg] + rw [cpow_neg_absNorm_eq_pow f s hnorm, hY] + rw [tprod_congr hterm, tprod_fintype, Finset.prod_const, Finset.card_univ, + ← Nat.card_eq_fintype_card, hcount, hRHS, Nat.card_eq_fintype_card, inv_pow] +@@ -460,7 +459,7 @@ open Classical in + (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] + [IsMulCommutative Gal(L/K)] (𝔭 : Ideal (𝓞 K)) [𝔭.IsPrime] (h𝔭 : 𝔭 ≠ ⊥) : + frobeniusIdeal K L 𝔭 = (frobeniusClass K L 𝔭).out := by +- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } ++ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } + rw [frobeniusIdeal, UniqueFactorizationMonoid.normalizedFactors_irreducible + (Ideal.prime_of_isPrime h𝔭 ‹_›).irreducible, normalize_eq, Multiset.map_singleton, + Multiset.prod_singleton] +@@ -470,7 +469,7 @@ theorem frobeniusIdeal_mul + (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] + [IsMulCommutative Gal(L/K)] {𝔞 𝔟 : Ideal (𝓞 K)} (h𝔞 : 𝔞 ≠ ⊥) (h𝔟 : 𝔟 ≠ ⊥) : + frobeniusIdeal K L (𝔞 * 𝔟) = frobeniusIdeal K L 𝔞 * frobeniusIdeal K L 𝔟 := by +- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } ++ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } + rw [frobeniusIdeal, frobeniusIdeal, frobeniusIdeal, + UniqueFactorizationMonoid.normalizedFactors_mul h𝔞 h𝔟, Multiset.map_add, Multiset.prod_add] + +@@ -479,7 +478,7 @@ theorem frobeniusIdeal_mul + (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] + [IsMulCommutative Gal(L/K)] : + frobeniusIdeal K L ⊤ = 1 := by +- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } ++ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } + rw [frobeniusIdeal, ← Ideal.one_eq_top, UniqueFactorizationMonoid.normalizedFactors_one, + Multiset.map_zero, Multiset.prod_zero] + +@@ -495,7 +494,7 @@ theorem galoisCharacterOnIdeal_eq_char_frobeniusIdeal + [IsCyclotomicExtension {m} K L] (χ : galoisCharacter K L) {𝔞 : Ideal (𝓞 K)} + (hU : ∀ 𝔭 ∈ UniqueFactorizationMonoid.normalizedFactors 𝔞, UnramifiedIn K L 𝔭) : + galoisCharacterOnIdeal K L χ 𝔞 = (χ (frobeniusIdeal K L 𝔞) : ℂ) := by +- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } ++ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } + have hfrob : (χ (frobeniusIdeal K L 𝔞) : ℂ) = + ((UniqueFactorizationMonoid.normalizedFactors 𝔞).map + (fun 𝔭 ↦ (χ (frobeniusClass K L 𝔭).out : ℂ))).prod := by +@@ -504,7 +503,7 @@ theorem galoisCharacterOnIdeal_eq_char_frobeniusIdeal + rfl + rw [galoisCharacterOnIdeal_eq_map_prod, hfrob] + refine congrArg Multiset.prod (Multiset.map_congr rfl fun 𝔭 h𝔭 ↦ ?_) +- rw [if_pos (hU 𝔭 h𝔭)] ++ rw [ite_eq_left (hU 𝔭 h𝔭)] + + open Classical in + /-- If the ideal character `χ(𝔞)` is nonzero then every prime factor of `𝔞` is unramified in `L` +@@ -516,7 +515,7 @@ private theorem unramifiedIn_of_mem_normalizedFactors_of_galoisCharacterOnIdeal_ + by_contra hnr + refine h ?_ + rw [galoisCharacterOnIdeal_eq_map_prod] +- exact Multiset.prod_eq_zero (Multiset.mem_map.mpr ⟨𝔭, h𝔭, if_neg hnr⟩) ++ exact Multiset.prod_eq_zero (Multiset.mem_map.mpr ⟨𝔭, h𝔭, ite_eq_right hnr⟩) + + open Classical in + /-- **Helper 1a (cardinality form) — value-fibre = unramified-supported Frobenius-value-fibre.** For +@@ -555,8 +554,8 @@ theorem charFibre_mem_range {G : Type*} [CommGroup G] [Finite G] (χ : G →* + (hζ : ζ ^ orderOf χ = 1) : + ∃ g : G, χ g = ζ := by + classical +- haveI : NeZero (orderOf χ) := ⟨(orderOf_pos_iff.mpr (isOfFinOrder_of_finite χ)).ne'⟩ +- haveI : Finite (MonoidHom.range χ) := ++ have : NeZero (orderOf χ) := ⟨(orderOf_pos_iff.mpr (isOfFinOrder_of_finite χ)).ne'⟩ ++ have : Finite (MonoidHom.range χ) := + Finite.of_surjective χ.rangeRestrict χ.rangeRestrict_surjective + have hpow : ∀ g : G, (χ g) ^ orderOf χ = 1 := fun g ↦ by + rw [← MonoidHom.pow_apply, pow_orderOf_eq_one, MonoidHom.one_apply] +@@ -620,8 +619,8 @@ private theorem unramifiedIn_of_coprime_absNorm + UnramifiedIn K L 𝔭 := by + classical + refine ⟨h𝔭, fun 𝔓 h𝔓max h𝔓lo ↦ ?_⟩ +- haveI := h𝔓lo +- haveI : 𝔓.IsPrime := h𝔓max.isPrime ++ have := h𝔓lo ++ have : 𝔓.IsPrime := h𝔓max.isPrime + rw [← not_dvd_differentIdeal_iff (A := 𝓞 K) (B := 𝓞 L)] + intro hdvd + obtain ⟨ζ, hζ⟩ := IsCyclotomicExtension.exists_isPrimitiveRoot K L +@@ -697,7 +696,7 @@ private theorem autToPow_frobeniusIdeal + intro hpa hcop + have hp' : p ≠ ⊥ := hp.ne_zero + have ha' : a ≠ ⊥ := ha +- haveI : p.IsPrime := Ideal.isPrime_of_prime hp ++ have : p.IsPrime := Ideal.isPrime_of_prime hp + have hsplit : Ideal.absNorm (p * a) = Ideal.absNorm p * Ideal.absNorm a := + map_mul Ideal.absNorm p a + have hcp : (Ideal.absNorm p).Coprime m := +@@ -885,7 +884,7 @@ private theorem card_fibre_eq_card_good_fibre + intro 𝔭 h𝔭 + rw [normalizedFactors_mul h0 h𝔟, Multiset.mem_add] at h𝔭 + rcases h𝔭 with h𝔭 | h𝔭 +- · haveI : 𝔭.IsPrime := Ideal.isPrime_of_prime (prime_of_normalized_factor _ h𝔭) ++ · have : 𝔭.IsPrime := Ideal.isPrime_of_prime (prime_of_normalized_factor _ h𝔭) + exact unramifiedIn_of_coprime_absNorm K L m 𝔭 + (prime_of_normalized_factor _ h𝔭).ne_zero + (coprime_absNorm_of_mem_factors_of_coprime K m hcop h𝔭) +@@ -921,18 +920,18 @@ omit [NumberField L] [FiniteDimensional K L] [IsMulCommutative Gal(L/K)] [NeZero + /-- The bad-supported ideals of norm `≤ N` form a finite set: they are a subset of the (finitely + many) ideals of norm `≤ N`. -/ + private theorem finite_isBadPart (N : ℕ) : {𝔟 : Ideal (𝓞 K) | IsBadPart K L m N 𝔟}.Finite := +- (Ideal.finite_setOf_absNorm_le (S := 𝓞 K) N).subset fun _ h𝔟 ↦ h𝔟.2.2 ++ (Ideal.finite_setOfPred_absNorm_le (S := 𝓞 K) N).subset fun _ h𝔟 ↦ h𝔟.2.2 + + open UniqueFactorizationMonoid in + /-- The L2 fibre subtype at `g` is finite (subset of all ideals of norm `≤ N`). -/ + private instance finite_L2 (g : Gal(L/K)) (N : ℕ) : + Finite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N ∧ + (∀ 𝔭 ∈ normalizedFactors 𝔞, UnramifiedIn K L 𝔭) ∧ frobeniusIdeal K L 𝔞 = g} := by +- haveI : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N} := +- (Ideal.finite_setOf_absNorm_le (S := 𝓞 K) N).to_subtype ++ have : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N} := ++ (Ideal.finite_setOfPred_absNorm_le (S := 𝓞 K) N).to_subtype + exact Finite.of_injective (β := {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N}) + (fun 𝔞 ↦ ⟨𝔞.1, 𝔞.2.2.1⟩) +- (fun _ _ hab ↦ Subtype.ext (by simpa using hab)) ++ (fun _ _ hab ↦ Subtype.ext (congrArg (fun q : {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N} ↦ q.1) hab)) + + omit [FiniteDimensional K L] [NeZero m] [IsCyclotomicExtension {m} K L] in + open UniqueFactorizationMonoid in +@@ -1054,7 +1053,7 @@ private theorem autToPow_range_le_realizedResidues + have hHtop : H = ⊤ := by + refine subgroup_eq_top_of_forall_frobenius_mem_of_coprime K L m H + (fun 𝔭 h𝔭p h𝔭ne h𝔭unr h𝔭cop ↦ ?_) +- haveI := h𝔭p ++ have := h𝔭p + rw [hH, Subgroup.mem_comap, autToPow_frobeniusClass_out K L m hζ 𝔭 h𝔭unr h𝔭cop] + exact ⟨⟨𝔭, mem_nonZeroDivisors_of_ne_zero h𝔭ne⟩, by rw [ZMod.coe_unitOfCoprime]⟩ + intro a ha +@@ -1203,7 +1202,7 @@ private theorem sum_rpow_le_euler_prod (K : Type*) [Field K] [NumberField K] + rw [Finset.prod_sum P (fun _ ↦ Finset.range (Kn + 1)) + (fun 𝔭 k ↦ (((Ideal.absNorm 𝔭 : ℝ)) ^ e) ^ k)] + _ ≤ ∏ 𝔭 ∈ P, (1 - ((Ideal.absNorm 𝔭 : ℝ)) ^ e)⁻¹ := by +- refine Finset.prod_le_prod ++ refine Finset.prod_le_prod₀ + (fun 𝔭 h𝔭 ↦ Finset.sum_nonneg fun k _ ↦ pow_nonneg (hx0 𝔭 h𝔭) k) (fun 𝔭 h𝔭 ↦ ?_) + have h1x : 0 < 1 - ((Ideal.absNorm 𝔭 : ℝ)) ^ e := by have := hxlt 𝔭 h𝔭; linarith + have hkey := geom_sum_mul (((Ideal.absNorm 𝔭 : ℝ)) ^ e) (Kn + 1) +@@ -1658,7 +1657,7 @@ private theorem coprime_absNorm_of_unramified_of_finrank_eq_one + by_contra hncop + obtain ⟨p, hpm, hpmem𝔭⟩ := exists_primeFactor_natCast_mem_of_not_coprime K m 𝔭 h𝔭 hncop + have hp : p.Prime := (Nat.mem_primeFactors.mp hpm).1 +- haveI : Fact p.Prime := ⟨hp⟩ ++ have : Fact p.Prime := ⟨hp⟩ + have hpdvd : p ∣ m := Nat.dvd_of_mem_primeFactors hpm + have hm0 : m ≠ 0 := (Nat.mem_primeFactors.mp hpm).2.2 + set v := m.factorization p with hv +@@ -1684,11 +1683,11 @@ private theorem coprime_absNorm_of_unramified_of_finrank_eq_one + have hφ2 : 2 ≤ p ^ k * (p - 1) := two_le_pow_mul_pred hp hbad + have hspan𝔭 : Ideal.span {(p : 𝓞 K)} = 𝔭 := + span_singleton_natCast_eq_of_finrank_eq_one K hd1 p hp 𝔭 hpmem𝔭 +- haveI : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal h𝔭 ++ have : 𝔭.IsMaximal := ‹𝔭.IsPrime›.isMaximal h𝔭 + obtain ⟨𝔓, h𝔓max, h𝔓lo⟩ := + Ideal.exists_maximal_ideal_liesOver_of_isIntegral (R := 𝓞 K) (S := 𝓞 L) 𝔭 +- haveI : 𝔓.IsPrime := h𝔓max.isPrime +- haveI := h𝔓lo ++ have : 𝔓.IsPrime := h𝔓max.isPrime ++ have := h𝔓lo + have hnotdvd : ¬ 𝔓 ∣ differentIdeal (𝓞 K) (𝓞 L) := by + rw [not_dvd_differentIdeal_iff (A := 𝓞 K) (B := 𝓞 L)] + exact hunr.2 𝔓 h𝔓max h𝔓lo +@@ -1747,7 +1746,7 @@ private theorem card_fibre_bound_eq_one {ζ : L} (hζ : IsPrimitiveRoot ζ m) + rw [Ideal.one_eq_top] at this; exact htop this + obtain ⟨𝔭, h𝔭⟩ := Multiset.exists_mem_of_ne_zero hfac0 + have hprime := prime_of_normalized_factor 𝔭 h𝔭 +- haveI : 𝔭.IsPrime := Ideal.isPrime_of_prime hprime ++ have : 𝔭.IsPrime := Ideal.isPrime_of_prime hprime + exact (hfac 𝔭 h𝔭).2 (coprime_absNorm_of_unramified_of_finrank_eq_one K L m hd1 𝔭 + hprime.ne_zero (hfac 𝔭 h𝔭).1 hm) + rw [card_L2_eq_sum_residue K L m hζ g N, hbadtop, Finset.sum_singleton, +@@ -1819,9 +1818,9 @@ private theorem card_unramifiedSupported_frobeniusValueFibre_eq_sum + (∀ 𝔭 ∈ UniqueFactorizationMonoid.normalizedFactors 𝔞, UnramifiedIn K L 𝔭) ∧ + frobeniusIdeal K L 𝔞 = g.1} := by + classical +- haveI hfinN : Finite {𝔞 : Ideal (𝓞 K) // Ideal.absNorm 𝔞 ≤ N} := +- (Ideal.finite_setOf_absNorm_le (S := 𝓞 K) N).to_subtype +- haveI hfin : ∀ g : {g : Gal(L/K) // (χ g : ℂ) = ζ}, ++ have hfinN : Finite {𝔞 : Ideal (𝓞 K) // Ideal.absNorm 𝔞 ≤ N} := ++ (Ideal.finite_setOfPred_absNorm_le (S := 𝓞 K) N).to_subtype ++ have hfin : ∀ g : {g : Gal(L/K) // (χ g : ℂ) = ζ}, + Finite {𝔞 : Ideal (𝓞 K) // + 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N ∧ + (∀ 𝔭 ∈ UniqueFactorizationMonoid.normalizedFactors 𝔞, UnramifiedIn K L 𝔭) ∧ +@@ -1916,7 +1915,7 @@ theorem exists_card_galoisCharacterOnIdeal_eq_const_mul_add_pow + rw [← hζuval] + exact ⟨fun h ↦ Units.ext h, fun h ↦ congrArg Units.val h⟩ + rw [heq] +- letI : CommGroup Gal(L/K) := { mul_comm := mul_comm' } ++ let : CommGroup Gal(L/K) := { mul_comm := mul_comm' } + exact card_charFibre_eq_card_ker χ ζu hζun + have hcardℝ : (Fintype.card {g : Gal(L/K) // (χ g : ℂ) = ζ} : ℝ) = (κ₀ : ℝ) := by + rw [← Nat.card_eq_fintype_card, hSκ₀] +@@ -1985,7 +1984,7 @@ private theorem galoisCharacterOnIdeal_mem_insert_zero_nthRootsFinset + · push Not at hU + obtain ⟨𝔭, h𝔭, hram⟩ := hU + rw [galoisCharacterOnIdeal_eq_map_prod, +- Multiset.prod_eq_zero (Multiset.mem_map.mpr ⟨𝔭, h𝔭, if_neg hram⟩)] ++ Multiset.prod_eq_zero (Multiset.mem_map.mpr ⟨𝔭, h𝔭, ite_eq_right hram⟩)] + exact Finset.mem_insert_self _ _ + + private theorem sum_galoisCharacterOnIdeal_eq_sum_card_sub_mul +@@ -2044,9 +2043,9 @@ many) ideals of norm `≤ N`. -/ + private theorem finite_nonzeroIdeal_absNorm_le (K : Type*) [Field K] [NumberField K] (N : ℕ) : + Finite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N} := + haveI : Finite {𝔞 : Ideal (𝓞 K) // Ideal.absNorm 𝔞 ≤ N} := +- (Ideal.finite_setOf_absNorm_le (S := 𝓞 K) N).to_subtype ++ (Ideal.finite_setOfPred_absNorm_le (S := 𝓞 K) N).to_subtype + Finite.of_injective (fun a ↦ (⟨a.1, a.2.2⟩ : {𝔞 : Ideal (𝓞 K) // Ideal.absNorm 𝔞 ≤ N})) +- fun _ _ hab ↦ Subtype.ext (by simpa using hab) ++ fun _ _ hab ↦ Subtype.ext (congrArg (fun q : {I : Ideal (𝓞 K) // Ideal.absNorm I ≤ N} ↦ q.1) hab) + + /-- Sharifi 7.1.19 step 1 (p. 142): geometry-of-numbers bound. The + partial-sum character sum `Σ_{N𝔞≤N} χ(𝔞)` (with `χ(𝔞) = galoisCharacterOnIdeal K L χ 𝔞` the +@@ -2067,7 +2066,7 @@ theorem character_sum_geometry_of_numbers_bound + refine ⟨(orderOf χ : ℝ) * C', fun N ↦ ?_⟩ + have hC' : 0 ≤ C' := (abs_nonneg _).trans (by simpa using hcount 1 (one_pow _) 1 le_rfl) + rcases Nat.eq_zero_or_pos N with rfl | hN1 +- · haveI : IsEmpty {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ 0} := ++ · have : IsEmpty {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ 0} := + ⟨fun 𝔞 ↦ 𝔞.2.1 (Ideal.absNorm_eq_zero_iff.mp (Nat.le_zero.mp 𝔞.2.2))⟩ + rw [tsum_empty, norm_zero] + positivity +@@ -2079,8 +2078,8 @@ theorem character_sum_geometry_of_numbers_bound + set R : Finset ℂ := Polynomial.nthRootsFinset (orderOf χ) (1 : ℂ) with hR + have hmemR : ∀ {z : ℂ}, z ∈ R ↔ z ^ orderOf χ = 1 := fun {z} ↦ + Polynomial.mem_nthRootsFinset (Nat.pos_of_ne_zero hord0) 1 +- haveI := finite_nonzeroIdeal_absNorm_le K N +- haveI := Fintype.ofFinite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N} ++ have := finite_nonzeroIdeal_absNorm_le K N ++ have := Fintype.ofFinite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N} + rw [tsum_fintype, sum_galoisCharacterOnIdeal_eq_sum_card_sub_mul K L m χ hord2 C₀ N] + calc ‖∑ v ∈ R, (((Nat.card {𝔞 : Ideal (𝓞 K) // + 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ N ∧ galoisCharacterOnIdeal K L χ 𝔞 = v} : ℝ) +@@ -2111,7 +2110,7 @@ private theorem finite_nonzeroIdeal_absNorm_eq + (K : Type*) [Field K] [NumberField K] (n : ℕ) : + Finite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = n} := + Set.Finite.to_subtype <| Set.Finite.of_finite_image (f := fun I : NonzeroIdeal K ↦ I.1) +- ((Ideal.finite_setOf_absNorm_eq (S := 𝓞 K) n).subset (by rintro _ ⟨⟨I, _⟩, rfl, rfl⟩; rfl)) ++ ((Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 K) n).subset (by rintro _ ⟨⟨I, _⟩, rfl, rfl⟩; rfl)) + (fun _ _ _ _ ↦ Subtype.ext) + + /-- The `0`-th coefficient vanishes: no nonzero ideal has norm `0`, so the fibre is empty. -/ +@@ -2128,8 +2127,8 @@ private theorem norm_galoisCharacterCoeff_le + (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] + (χ : galoisCharacter K L) (n : ℕ) : + ‖galoisCharacterCoeff K L χ n‖ ≤ (idealNormMultiplicity K n : ℝ) := by +- haveI := finite_nonzeroIdeal_absNorm_eq K n +- haveI := Fintype.ofFinite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = n} ++ have := finite_nonzeroIdeal_absNorm_eq K n ++ have := Fintype.ofFinite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = n} + calc ‖galoisCharacterCoeff K L χ n‖ + ≤ ∑' 𝔞 : {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = n}, + ‖galoisCharacterOnIdeal K L χ 𝔞.1.1‖ := +@@ -2154,8 +2153,8 @@ private theorem sum_galoisCharacterCoeff_eq_tsum_absNorm_le + ∑' 𝔞 : {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ n}, + galoisCharacterOnIdeal K L χ 𝔞.1 := by + classical +- haveI := finite_nonzeroIdeal_absNorm_le K n +- haveI := Fintype.ofFinite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ n} ++ have := finite_nonzeroIdeal_absNorm_le K n ++ have := Fintype.ofFinite {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ n} + rw [tsum_fintype, ← Finset.sum_fiberwise_of_maps_to (t := Finset.Icc 1 n) + (g := fun 𝔞 : {𝔞 : Ideal (𝓞 K) // 𝔞 ≠ ⊥ ∧ Ideal.absNorm 𝔞 ≤ n} ↦ Ideal.absNorm 𝔞.1) + (fun 𝔞 _ ↦ Finset.mem_Icc.mpr +@@ -2163,8 +2162,8 @@ private theorem sum_galoisCharacterCoeff_eq_tsum_absNorm_le + (fun 𝔞 ↦ galoisCharacterOnIdeal K L χ 𝔞.1)] + refine Finset.sum_congr rfl fun k hk ↦ ?_ + rw [galoisCharacterCoeff, ← Finset.sum_subtype_eq_sum_filter, Finset.subtype_univ] +- haveI := finite_nonzeroIdeal_absNorm_eq K k +- haveI := Fintype.ofFinite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = k} ++ have := finite_nonzeroIdeal_absNorm_eq K k ++ have := Fintype.ofFinite {𝔞 : NonzeroIdeal K // Ideal.absNorm 𝔞.1 = k} + rw [tsum_fintype] + exact Fintype.sum_equiv + { toFun := fun ⟨⟨𝔞, h𝔞ne⟩, hnorm⟩ ↦ +@@ -2260,8 +2259,8 @@ private theorem setIntegral_Ioi_one_mul_cpow_eq_mellin (S : ℝ → ℂ) (hS : + ae_iff.mpr (by simp : volume {x : ℝ | ¬x ≠ 1} = 0)] with t ht _ + rw [indicator_apply] + by_cases h1 : t ∈ Ioi (1 : ℝ) +- · rw [if_pos h1] +- · rw [if_neg h1, hS t (lt_of_le_of_ne (not_lt.mp (by simpa using h1)) ht), smul_zero] ++ · rw [ite_eq_left h1] ++ · rw [ite_eq_right h1, hS t (lt_of_le_of_ne (not_lt.mp (by simpa using h1)) ht), smul_zero] + + open Filter Topology Set MeasureTheory Asymptotics in + /-- Sharifi 7.1.19 step 1b (p. 142) — analytic extension of `L(χ,·)`. +@@ -2467,7 +2466,7 @@ private theorem norm_one_sub_inv_sub_one_le {y : ℂ} (hy : ‖y‖ ≤ 1 / 2) : + + /-- A nonzero prime ideal `𝔭` of a number ring has `2 ≤ N𝔭`: its norm is neither `0` (only `⊥` has + norm `0`) nor `1` (only `⊤` has norm `1`). -/ +-private theorem two_le_absNorm {R : Type*} [CommRing R] [IsDedekindDomain R] ++private theorem two_le_absNorm {R : Type*} [CommRing R] [IsDedekindDomain R] [Infinite R] + [Module.Free ℤ R] [Module.Finite ℤ R] {𝔭 : Ideal R} (hp : 𝔭.IsPrime) (hb : 𝔭 ≠ ⊥) : + 2 ≤ Ideal.absNorm 𝔭 := by + have hne0 : Ideal.absNorm 𝔭 ≠ 0 := fun h ↦ hb (Ideal.absNorm_eq_zero_iff.mp h) +@@ -2476,7 +2475,7 @@ private theorem two_le_absNorm {R : Type*} [CommRing R] [IsDedekindDomain R] + + /-- For a nonzero prime `𝔭` of a number ring and `Re s > 1`, `‖N𝔭^{-s}‖ ≤ 1/2` (since `N𝔭 ≥ 2`, + `Re s > 1`). The bound that lets the Euler factors enter `norm_one_sub_inv_sub_one_le`. -/ +-private theorem norm_absNorm_cpow_neg_le_half {R : Type*} [CommRing R] [IsDedekindDomain R] ++private theorem norm_absNorm_cpow_neg_le_half {R : Type*} [CommRing R] [IsDedekindDomain R] [Infinite R] + [Module.Free ℤ R] [Module.Finite ℤ R] {s : ℂ} (hs : 1 < s.re) + (𝔭 : {𝔭 : Ideal R // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥}) : + ‖(Ideal.absNorm 𝔭.1 : ℂ) ^ (-s)‖ ≤ 1 / 2 := by +@@ -2581,7 +2580,7 @@ private def underUP + (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] + (𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ UnramifiedIn K L (𝔓.under (𝓞 K))}) : + {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ UnramifiedIn K L 𝔭} := +- ⟨𝔓.1.under (𝓞 K), by haveI := 𝔓.2.1; exact inferInstance, 𝔓.2.2.2⟩ ++ ⟨𝔓.1.under (𝓞 K), by have := 𝔓.2.1; exact inferInstance, 𝔓.2.2.2⟩ + + @[simp] private theorem underUP_val + (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] +@@ -2600,8 +2599,8 @@ private def fiberUnderEquiv + toFun 𝔓 := ⟨𝔓.1.1, 𝔓.1.2.1, ⟨by + have h := congrArg Subtype.val 𝔓.2; rw [underUP_val] at h; rw [← h]⟩, 𝔓.1.2.2.1⟩ + invFun 𝔔 := ⟨⟨𝔔.1, 𝔔.2.1, 𝔔.2.2.2, by +- haveI := 𝔔.2.1; haveI := 𝔔.2.2.1; rw [← 𝔔.2.2.1.over]; exact c.2.2⟩, by +- haveI := 𝔔.2.1; haveI := 𝔔.2.2.1 ++ have := 𝔔.2.1; have := 𝔔.2.2.1; rw [← 𝔔.2.2.1.over]; exact c.2.2⟩, by ++ have := 𝔔.2.1; have := 𝔔.2.2.1 + exact Subtype.ext (by rw [underUP_val]; exact 𝔔.2.2.1.over.symm)⟩ + left_inv 𝔓 := by ext; rfl + right_inv 𝔔 := by ext; rfl +@@ -2632,7 +2631,6 @@ private def ramifiedFlattenEquiv + left_inv _ := rfl + right_inv _ := rfl + +-set_option backward.isDefEq.respectTransparency false in + /-- The unramified part of the prime-ideal Euler product equals `∏_χ L_χ`. Regroup the unramified + `L`-primes fibrewise over the `K`-prime below them (`Equiv.sigmaFiberEquiv` + + `Multipliable.tprod_sigma`); each fibre product is `∏_χ (1 - χ(σ_𝔭) N𝔭^{-s})^{-1}` +@@ -2672,16 +2670,16 @@ private theorem tprod_unramified_eq_prod_artinDirichletSeries + HasProd (fun 𝔓 : {𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ + UnramifiedIn K L (𝔓.under (𝓞 K))} // underUP K L 𝔓 = c} ↦ F 𝔓.1.1) (G c) := by + intro c +- haveI : c.1.IsPrime := c.2.1 +- haveI : c.1.IsMaximal := c.2.1.isMaximal (UnramifiedIn.ne_bot K L c.2.2) +- haveI : Finite (c.1.primesOver (𝓞 L)) := ++ have : c.1.IsPrime := c.2.1 ++ have : c.1.IsMaximal := c.2.1.isMaximal (UnramifiedIn.ne_bot K L c.2.2) ++ have : Finite (c.1.primesOver (𝓞 L)) := + (IsDedekindDomain.primesOver_finite c.1 (𝓞 L)).to_subtype +- haveI : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver c.1 ∧ 𝔓 ≠ ⊥} := ++ have : Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver c.1 ∧ 𝔓 ≠ ⊥} := + Finite.of_injective + (fun 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓.LiesOver c.1 ∧ 𝔓 ≠ ⊥} ↦ + (⟨𝔓.1, 𝔓.2.1, 𝔓.2.2.1⟩ : c.1.primesOver (𝓞 L))) +- (fun _ _ hab ↦ Subtype.ext (by simpa using hab)) +- haveI : Finite {𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ ++ (fun _ _ hab ↦ Subtype.ext (congrArg (fun q : c.1.primesOver (𝓞 L) ↦ q.1) hab)) ++ have : Finite {𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ + UnramifiedIn K L (𝔓.under (𝓞 K))} // underUP K L 𝔓 = c} := + Finite.of_equiv _ (fiberUnderEquiv K L c).symm + have hval : (∏' 𝔓 : {𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ +@@ -2786,12 +2784,12 @@ private instance finite_ramifiedAbove + (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] [IsGalois K L] : + Finite {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ ¬ UnramifiedIn K L (𝔓.under (𝓞 K))} := by + classical +- haveI : Finite {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭} := ++ have : Finite {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭} := + (finite_ramifiedIn K L).to_subtype +- haveI : ∀ 𝔭 : {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭}, ++ have : ∀ 𝔭 : {𝔭 : Ideal (𝓞 K) // 𝔭.IsPrime ∧ 𝔭 ≠ ⊥ ∧ ¬ UnramifiedIn K L 𝔭}, + Finite (𝔭.1.primesOver (𝓞 L)) := fun 𝔭 ↦ by +- haveI : 𝔭.1.IsPrime := 𝔭.2.1 +- haveI : 𝔭.1.IsMaximal := 𝔭.2.1.isMaximal 𝔭.2.2.1 ++ have : 𝔭.1.IsPrime := 𝔭.2.1 ++ have : 𝔭.1.IsMaximal := 𝔭.2.1.isMaximal 𝔭.2.2.1 + exact (IsDedekindDomain.primesOver_finite 𝔭.1 (𝓞 L)).to_subtype + refine Finite.of_injective + (fun 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ ¬ UnramifiedIn K L (𝔓.under (𝓞 K))} ↦ +@@ -2834,7 +2832,7 @@ private theorem log_norm_ramified_factor_bounded + ¬ UnramifiedIn K L (𝔓.under (𝓞 K))}, (1 - (Ideal.absNorm 𝔓.1 : ℂ) ^ (-(s : ℂ)))⁻¹‖| ≤ + C := by + classical +- haveI : Fintype {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ ++ have : Fintype {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ + ¬ UnramifiedIn K L (𝔓.under (𝓞 K))} := Fintype.ofFinite _ + set R : ℝ → ℂ := fun s ↦ ∏ 𝔓 : {𝔓 : Ideal (𝓞 L) // 𝔓.IsPrime ∧ 𝔓 ≠ ⊥ ∧ + ¬ UnramifiedIn K L (𝔓.under (𝓞 K))}, (1 - (Ideal.absNorm 𝔓.1 : ℂ) ^ (-(s : ℂ)))⁻¹ with hR +@@ -2932,7 +2930,7 @@ private theorem analyticAt_one_of_analyticOn_finrankDomain (K : Type*) [Field K] + have hdpos : (0 : ℝ) < (Module.finrank ℚ K : ℝ)⁻¹ := by + have : 0 < Module.finrank ℚ K := Module.finrank_pos + positivity +- simp only [Set.mem_setOf_eq, Complex.one_re]; linarith ++ simp only [Set.mem_ofPred_eq, Complex.one_re]; linarith + exact hLf.analyticAt ((isOpen_lt continuous_const Complex.continuous_re).mem_nhds hmem) + + open Filter Topology Set in +@@ -3034,8 +3032,8 @@ private theorem sum_ite_pole_zero_cancel + (if χ' = 1 then a else if χ' = χ then -a else 0) = + (if χ' = 1 then a else 0) + (if χ' = χ then -a else 0) := fun χ' ↦ by + by_cases h1 : χ' = 1 +- · rw [if_pos h1, if_pos h1, if_neg (h1 ▸ Ne.symm hχ), add_zero] +- · rw [if_neg h1, if_neg h1]; by_cases hc : χ' = χ <;> simp [hc] ++ · rw [ite_eq_left h1, ite_eq_left h1, ite_eq_right (h1 ▸ Ne.symm hχ), add_zero] ++ · rw [ite_eq_right h1, ite_eq_right h1]; by_cases hc : χ' = χ <;> simp [hc] + rw [Finset.sum_congr rfl fun χ' _ ↦ hsplit χ', Finset.sum_add_distrib, + Finset.sum_ite_eq' Finset.univ (1 : galoisCharacter K L), Finset.sum_ite_eq' Finset.univ χ] + simp +@@ -3061,14 +3059,14 @@ private theorem log_norm_artinDirichletSeries_le_pole_zero_ite + by_cases h1 : χ' = 1 + · subst h1 + obtain ⟨C1, hC1⟩ := log_norm_artinDirichletSeries_one_le K L +- exact ⟨C1, by filter_upwards [hC1] with s hs; rwa [if_pos rfl]⟩ ++ exact ⟨C1, by filter_upwards [hC1] with s hs; rwa [ite_eq_left rfl]⟩ + · by_cases hc : χ' = χ + · subst hc +- exact ⟨Cχ, by filter_upwards [hCχ] with s hs; rwa [if_neg h1, if_pos rfl]⟩ ++ exact ⟨Cχ, by filter_upwards [hCχ] with s hs; rwa [ite_eq_right h1, ite_eq_left rfl]⟩ + · obtain ⟨C, hC⟩ := artinDirichletSeries_norm_le_of_ne_one K L m hm χ' h1 + refine ⟨Real.log (max C 1), ?_⟩ + filter_upwards [hC] with s hs +- simp only [if_neg h1, if_neg hc, zero_add] ++ simp only [ite_eq_right h1, ite_eq_right hc, zero_add] + have hmax1 : (1 : ℝ) ≤ max C 1 := le_max_right _ _ + rcases le_total ‖artinDirichletSeries K L χ' (s : ℂ)‖ 0 with h0 | h0 + · have hz : ‖artinDirichletSeries K L χ' (s : ℂ)‖ = 0 := le_antisymm h0 (norm_nonneg _) +diff --git a/projects/DedekindResidue/DedekindResidue/AuxiliaryFunction.lean b/projects/DedekindResidue/DedekindResidue/AuxiliaryFunction.lean +index 8e22b1de6..f9545f056 100644 +--- a/projects/DedekindResidue/DedekindResidue/AuxiliaryFunction.lean ++++ b/projects/DedekindResidue/DedekindResidue/AuxiliaryFunction.lean +@@ -44,7 +44,7 @@ noncomputable def auxF (s : ℂ) (X t : ℝ) : ℂ := + + /-- On the plateau `|t| ≤ log X`, `F_{s,X}(t) = 1` — eq. (11). -/ + theorem auxF_of_le (s : ℂ) (X : ℝ) {t : ℝ} (h : |t| ≤ Real.log X) : auxF s X t = 1 := by +- unfold auxF; exact if_pos h ++ unfold auxF; exact ite_eq_left h + + /-- `F_{s,X}(0) = 1` whenever `X ≥ 1` (so `log X ≥ 0`, putting `0` on the plateau). -/ + theorem auxF_zero (s : ℂ) {X : ℝ} (hX : 1 ≤ X) : auxF s X 0 = 1 := +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/AnalyticControl.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/AnalyticControl.lean +index 5c23f3c90..8c56d23e6 100644 +--- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/AnalyticControl.lean ++++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/AnalyticControl.lean +@@ -228,7 +228,7 @@ theorem exists_re_norm_dedekindZeta_ge_half : + · simp + rcases eq_or_ne n 0 with rfl | hn0 + · simp +- rw [if_neg hn1, LSeries.norm_term_eq, LSeries.norm_term_eq, if_neg hn0, if_neg hn0, ++ rw [ite_eq_right hn1, LSeries.norm_term_eq, LSeries.norm_term_eq, ite_eq_right hn0, ite_eq_right hn0, + show ((2:ℂ)).re = (2:ℝ) by norm_num] + have hn2 : (2:ℝ) ≤ (n:ℝ) := by exact_mod_cast (by omega : 2 ≤ n) + have hnpos : (0:ℝ) < n := by linarith +@@ -259,7 +259,7 @@ theorem exists_re_norm_dedekindZeta_ge_half : + refine Summable.of_nonneg_of_le (fun n => norm_nonneg _) (fun n => ?_) hsummS.norm + rcases eq_or_ne n 1 with rfl | hn1 + · simp +- · rw [if_neg hn1] ++ · rw [ite_eq_right hn1] + have hcompar : Summable (fun n : ℕ => (1/2:ℝ)^m * ‖LSeries.term f 2 n‖) := + (hsum2.norm).mul_left _ + have hRbound : ‖∑' n : ℕ, ite (n = 1) 0 (LSeries.term f s n)‖ ≤ T * (1/2)^m := by +@@ -463,7 +463,7 @@ theorem norm_dedekindZeta_le_of_two_le_re {s : ℂ} (hs : 2 ≤ s.re) : + intro n + rcases eq_or_ne n 0 with rfl | hn0 + · simp +- rw [LSeries.norm_term_eq, LSeries.norm_term_eq, if_neg hn0, if_neg hn0, ++ rw [LSeries.norm_term_eq, LSeries.norm_term_eq, ite_eq_right hn0, ite_eq_right hn0, + show ((2:ℂ)).re = (2:ℝ) by norm_num] + have hn1 : (1:ℝ) ≤ (n:ℝ) := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hn0 + gcongr +@@ -602,11 +602,10 @@ theorem one_add_abs_im_le_two_norm_sub_four {z : ℂ} (_h1 : -1 ≤ z.re) (h2 : + simpa using h + linarith + +-/-- The comparator sine-exponent: `n_K = r₁ + 2r₂`. -/ ++ + noncomputable def gammaExponent : ℕ := nrRealPlaces K + 2 * nrComplexPlaces K + +-/-- Right boundary bound for the comparator +-`G = H⁴·sin(πz)^{n_K}/(z-4)^{4n_K+8}` on `Re z = 2`. -/ ++ + theorem comparator_bound_right : + ∃ M : ℝ, 0 < M ∧ ∀ t : ℝ, + ‖completedDedekindZetaEntire K (((2:ℝ) : ℂ) + (t : ℂ) * Complex.I)‖^4 +@@ -715,8 +714,7 @@ theorem comparator_bound_right : + + (B * 25)^4 * Real.exp ((n:ℝ) * (π * 2)) / 2^(4*n+8) := + le_add_of_nonneg_left (by positivity) + +-/-- Left boundary bound for the comparator on `Re z = -1`, by reflecting to the right +-boundary through the functional equation. -/ ++ + theorem comparator_bound_left : + ∃ M : ℝ, 0 < M ∧ ∀ t : ℝ, + ‖completedDedekindZetaEntire K (((-1:ℝ) : ℂ) + (t : ℂ) * Complex.I)‖^4 +@@ -794,10 +792,7 @@ theorem comparator_bound_left : + (by positivity) (pow_le_pow_left₀ (norm_nonneg _) hden _) + _ ≤ M := hM (-t) + +-/-- Sub-double-exponential growth of the AC-A3 comparator +-`completedDedekindZetaEntire K ^ 4 * sin (π z) ^ n / (z - 4) ^ (4 n + 8)` on the strip +-`-1 ≤ Re ≤ 2`, from the polynomial strip bound `‖H‖ ≤ B (1 + ‖z‖)²`. Supplies the +-growth hypothesis of the Phragmén–Lindelöf step in `comparator_bound_strip`. -/ ++ + private theorem comparator_isBigO_growth {B : ℝ} (hB0 : 0 ≤ B) + (hB : ∀ w : ℂ, -1 ≤ w.re → w.re ≤ 2 → + ‖completedDedekindZetaEntire K w‖ ≤ B * (1 + ‖w‖) ^ 2) : +@@ -904,8 +899,7 @@ private theorem comparator_isBigO_growth {B : ℝ} (hB0 : 0 ≤ B) + nlinarith + exact mul_le_mul_of_nonneg_left hexp_le (by positivity) + +-/-- **The comparator is bounded on the whole strip** `-1 ≤ Re z ≤ 2` +-(Phragmén–Lindelöf between the two boundary bounds). -/ ++ + theorem comparator_bound_strip : + ∃ M : ℝ, 0 < M ∧ ∀ z : ℂ, -1 ≤ z.re → z.re ≤ 2 → + ‖completedDedekindZetaEntire K z^4 * Complex.sin (π * z)^(gammaExponent K) +@@ -925,7 +919,7 @@ theorem comparator_bound_strip : + simp [sub_eq_zero] at this + rw [this] at hw + norm_num at hw +- -- differentiability up to the boundary ++ + have hfd : DiffContOnCl ℂ f (Complex.re ⁻¹' Set.Ioo (-1 : ℝ) 2) := by + have hcl : closure (Complex.re ⁻¹' Set.Ioo (-1 : ℝ) 2) + ⊆ Complex.re ⁻¹' Set.Icc (-1 : ℝ) 2 := +@@ -946,7 +940,7 @@ theorem comparator_bound_strip : + fun z => Real.exp (Bg * Real.exp (c * |z.im|)) := by + simp only [hf, hn] + exact comparator_isBigO_growth K hB0 hB +- -- boundary bounds in PL form ++ + have hle_a : ∀ w : ℂ, w.re = -1 → ‖f w‖ ≤ M₁ + M₂ := by + intro w hw + have hweq : w = ((-1:ℝ) : ℂ) + (w.im : ℂ) * Complex.I := by +@@ -995,7 +989,7 @@ theorem exists_H_strip_decay : + set t : ℝ := z.im with hts + set C₀ : ℝ := (M * 5^(4*n+8) * 3^n) ^ ((1:ℝ)/4) + 1 with hC₀ + have hC₀0 : 0 < C₀ := by positivity +- -- the comparator bound, cleared of the normalizer ++ + have hcomp := hM z h1 h2 + rw [norm_div, norm_mul, norm_pow, norm_pow, norm_pow] at hcomp + -- sine lower bound +@@ -1041,7 +1035,7 @@ theorem exists_H_strip_decay : + rw [abs_sub_comm, abs_of_pos (by linarith : (0:ℝ) < 4 - z.re)] + linarith + nlinarith [abs_nonneg t] +- -- solve the comparator inequality for ‖H‖⁴ ++ + have hsinpos : (0:ℝ) < ‖Complex.sin (π * z)‖ := by + have h3 : (0:ℝ) < Real.exp (π * |t|) / 3 := by positivity + linarith +@@ -1656,8 +1650,7 @@ theorem exists_H_upper_right (σ₁ : ℝ) (hσ₁ : 2 ≤ σ₁) : + rw [pow_add] + ring + +-/-- Sphere-sup bound for the Jensen ball: at center `A+iT` with radius `A+1`, every +-point of the closed ball satisfies the decaying envelope bound (in terms of `|T|`). -/ ++ + theorem exists_H_ball_sup (A : ℝ) (hA : 2 ≤ A) : + ∃ C : ℝ, 0 < C ∧ ∃ P : ℕ, ∀ T : ℝ, A + 5 ≤ |T| → + ∀ z ∈ Metric.closedBall ((A : ℂ) + (T : ℂ) * Complex.I) (A + 1), +@@ -1743,10 +1736,7 @@ theorem exists_H_ball_sup (A : ℝ) (hA : 2 ≤ A) : + rw [mul_pow] + ring + +-/-- **AC-A4: per-height zero counting.** There are an abscissa `A` and a constant `C` +-such that for all heights `|T| ≥ A+5`, the number of zeros of `H` (with multiplicity) +-in the closed ball of radius `√(A²+1)` around `A+iT` — a ball containing the critical +-slab `0 ≤ Re ≤ 1`, `|Im - T| ≤ 1` — is at most `C·log(2+|T|)`. -/ ++ + theorem exists_ball_zero_count : + ∃ A : ℝ, 2 ≤ A ∧ ∃ C : ℝ, 0 < C ∧ ∀ T : ℝ, A + 5 ≤ |T| → + ((∑ᶠ u, (MeromorphicOn.divisor (completedDedekindZetaEntire K) +@@ -1858,7 +1848,7 @@ theorem exists_ball_zero_count : + meromorphicOrderAt (fun _ : ℂ => (completedDedekindZetaEntire K c)⁻¹) z ≠ ⊤ := by + intro z _ + classical +- rw [meromorphicOrderAt_const, if_neg (inv_ne_zero hHcne)] ++ rw [meromorphicOrderAt_const, ite_eq_right (inv_ne_zero hHcne)] + exact WithTop.zero_ne_top + have hcmem : c ∈ Metric.closedBall c |Real.sqrt (A^2+1)| := by + rw [habs_r] +@@ -2079,10 +2069,7 @@ theorem exists_H_ball_factorization (c : ℂ) {R : ℝ} + congr 1 + rw [Function.FactorizedRational.finprod_eq_fun hfinsupp] + +-/-- Sphere-sup bound for the Landau ball: at center `A+iT` with the larger radius +-`A+3`, every point of the closed ball satisfies the decaying envelope bound (in +-terms of `|T|`). Left of the critical strip the functional equation reflects the +-bound from the right half-plane. -/ ++ + theorem exists_H_ball_sup_big (A : ℝ) (hA : 2 ≤ A) : + ∃ C : ℝ, 0 < C ∧ ∃ P : ℕ, ∀ T : ℝ, A + 5 ≤ |T| → + ∀ z ∈ Metric.closedBall ((A : ℂ) + (T : ℂ) * Complex.I) (A + 3), +@@ -2186,10 +2173,7 @@ theorem exists_H_ball_sup_big (A : ℝ) (hA : 2 ≤ A) : + rw [mul_pow] + ring + +-/-- **Per-height zero counting at the Landau radius.** Given the abscissa `A` with the +-envelope-matched center lower bound, the number of zeros of `H` (with multiplicity) in +-the closed ball of radius `A+2` around `A+iT` is at most `C·log(2+|T|)`. Parametric in +-`A` and the center bound so that downstream users can share one `A`. -/ ++ + theorem exists_ball_zero_count_big (A : ℝ) (hA2 : 2 ≤ A) (cL : ℝ) (hcL : 0 < cL) + (hlow : ∀ t : ℝ, 2 ≤ |t| → + cL * Real.exp (-(((gammaExponent K : ℕ) : ℝ) * (π * |t|)) / 4) +@@ -2298,7 +2282,7 @@ theorem exists_ball_zero_count_big (A : ℝ) (hA2 : 2 ≤ A) (cL : ℝ) (hcL : 0 + meromorphicOrderAt (fun _ : ℂ => (completedDedekindZetaEntire K c)⁻¹) z ≠ ⊤ := by + intro z _ + classical +- rw [meromorphicOrderAt_const, if_neg (inv_ne_zero hHcne)] ++ rw [meromorphicOrderAt_const, ite_eq_right (inv_ne_zero hHcne)] + exact WithTop.zero_ne_top + have hcmem : c ∈ Metric.closedBall c |A + 2| := by + rw [habs_r] +@@ -2482,11 +2466,7 @@ theorem exists_H_two_radius_factorization (c : ℂ) {r₁ r₂ : ℝ} (h12 : r + rw [hfac z hz, hsplit z] + ring + +-/-- **Landau's logarithmic-derivative bound** (A5-ii-c, generic form): if `h` is +-holomorphic and zero-free on `ball c r` with `‖h‖ ≤ mS` there and `mL ≤ ‖h c‖` at the +-center, then `‖h'/h‖ ≤ 32·r·(log(mS/mL) + 1)` on the concentric closed ball of radius +-`r - 3/4`. Chain: holomorphic logarithm on the convex ball, Borel–Carathéodory from the +-`Re`-bound `log(mS/mL)`, then the Schwarz derivative estimate on quarter-balls. -/ ++ + theorem norm_logDeriv_le_of_norm_le {h : ℂ → ℂ} {c : ℂ} {r : ℝ} (hr : 3/4 < r) + (hd : DifferentiableOn ℂ h (Metric.ball c r)) + (h0 : ∀ z ∈ Metric.ball c r, h z ≠ 0) +@@ -2535,7 +2515,7 @@ theorem norm_logDeriv_le_of_norm_le {h : ℂ → ℂ} {c : ℂ} {r : ℝ} (hr : + intro w hw + refine Complex.borelCaratheodory_zero hM0 hGd ?_ hr0 hw ?_ + · intro x hx +- simp only [Set.mem_setOf_eq] ++ simp only [Set.mem_ofPred_eq] + refine hreG (c + x) ?_ + rw [Metric.mem_ball] at hx ⊢ + simpa [dist_eq_norm] using hx +@@ -2630,7 +2610,7 @@ private theorem pow_sum_toNat_le_norm_prod_sub {F : Finset ℂ} {D : ℂ → ℤ + (hzu : ∀ u ∈ F, b ≤ ‖z - u‖) : + b ^ (∑ u ∈ F, (D u).toNat) ≤ ‖∏ u ∈ F, (z - u) ^ D u‖ := by + rw [norm_prod_sub_zpow hD, ← Finset.prod_pow_eq_pow_sum] +- exact Finset.prod_le_prod (fun u _ => by positivity) ++ exact Finset.prod_le_prod₀ (fun u _ => by positivity) + (fun u hu => pow_le_pow_left₀ hb (hzu u hu) _) + + /-- Upper bound for the norm of a monic-type product: if every factor distance `‖z - u‖` +@@ -2640,13 +2620,10 @@ private theorem norm_prod_sub_le_pow {F : Finset ℂ} {D : ℂ → ℤ} + (hzu : ∀ u ∈ F, ‖z - u‖ ≤ B) : + ‖∏ u ∈ F, (z - u) ^ D u‖ ≤ B ^ (∑ u ∈ F, (D u).toNat) := by + rw [norm_prod_sub_zpow hD, ← Finset.prod_pow_eq_pow_sum] +- exact Finset.prod_le_prod (fun u _ => by positivity) ++ exact Finset.prod_le_prod₀ (fun u _ => by positivity) + (fun u hu => pow_le_pow_left₀ (norm_nonneg _) (hzu u hu) _) + +-/-- **Divisor monotonicity from an open ball to its closed ball.** For an everywhere-analytic +-`f`, the (nonnegative) zero-count divisor over `ball c r` sums to at most the divisor over +-`closedBall c r`, since the local orders agree and the open-ball support is contained in the +-closed-ball support. -/ ++ + private theorem finsum_divisor_ball_le_closedBall {f : ℂ → ℂ} + (hf : ∀ z : ℂ, AnalyticAt ℂ f z) (c : ℂ) (r : ℝ) : + (∑ᶠ u, (MeromorphicOn.divisor f (Metric.ball c r)) u) +@@ -2692,9 +2669,7 @@ private theorem finsum_divisor_ball_le_closedBall {f : ℂ → ℂ} + exact hu (hfin₁.mem_toFinset.mpr (Function.mem_support.mpr h0))) + _ ≤ ∑ u ∈ hfincl.toFinset, Dcl u := Finset.sum_le_sum (fun u _ => hpt u) + +-/-- **Maximum-modulus sup bound on a closed ball from a bound on its sphere.** If `f` is +-analytic on the open ball `ball c R` and `‖f‖ ≤ C` on the sphere `sphere c ρ` (with +-`0 < ρ < R`), then `‖f‖ ≤ C` on the whole closed ball `closedBall c ρ`. -/ ++ + private theorem norm_le_of_frontier_ball {f : ℂ → ℂ} {c : ℂ} {ρ R : ℝ} + (hρ : 0 < ρ) (hρR : ρ < R) + (hanal : AnalyticOnNhd ℂ f (Metric.ball c R)) +@@ -2891,7 +2866,7 @@ theorem exists_H_landau_cofactor : + _ ≤ ((∑ᶠ u, (MeromorphicOn.divisor (completedDedekindZetaEntire K) + (Metric.closedBall c (A+2))) u : ℤ) : ℝ) := by exact_mod_cast hDnatZ_le + _ ≤ Cc * Real.log (2 + |T|) := hclosed +- -- export the open-ball zero count ++ + have hcount_open : ((∑ᶠ u, D₁ u : ℤ) : ℝ) + ≤ (32 * (A+2) + * (|Real.log (cB/cL)| + (P+Pn) + Cc * Real.log (2*(A+2)) + 1) + Cc) +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/Existence.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/Existence.lean +index d305719d4..3dc187db1 100644 +--- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/Existence.lean ++++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/Existence.lean +@@ -48,7 +48,7 @@ theorem prod_place_gamma (σ : ℝ) : + rw [Finset.prod_const, Finset.card_univ]] + refine Finset.prod_congr rfl (fun w _ => ?_) + rw [show (mult (w : InfinitePlace K) : ℝ) = 1 by +- rw [mult, if_pos w.2] ++ rw [mult, ite_eq_left w.2] + norm_num] + norm_num + · rw [show (π ^ (-(2 * σ)) * Real.Gamma (2 * σ)) ^ (nrComplexPlaces K) +@@ -60,7 +60,7 @@ theorem prod_place_gamma (σ : ℝ) : + (fun w : InfinitePlace K => not_isReal_iff_isComplex))).trans rfl).symm] + refine Finset.prod_congr rfl (fun w _ => ?_) + rw [show (mult (w : InfinitePlace K) : ℝ) = 2 by +- rw [mult, if_neg w.2] ++ rw [mult, ite_eq_right w.2] + norm_num] + + open scoped Classical in +@@ -231,7 +231,7 @@ theorem analyticOnNhd_completedDedekindZeta : + intro h + have : z = 0 := by linear_combination (2:ℂ) * h + rw [this] at hz +- norm_num [Set.mem_setOf_eq] at hz ++ norm_num [Set.mem_ofPred_eq] at hz + have hzk : z / 2 ≠ (((heckeFEPair K).k : ℝ) : ℂ) := by + intro h + rw [show (heckeFEPair K).k = 1/2 from rfl] at h +@@ -239,7 +239,7 @@ theorem analyticOnNhd_completedDedekindZeta : + push_cast at h + linear_combination (2:ℂ) * h + rw [this] at hz +- norm_num [Set.mem_setOf_eq] at hz ++ norm_num [Set.mem_ofPred_eq] at hz + have hd := (heckeFEPair K).differentiableAt_Λ (Or.inl hz2) (Or.inl hzk) + have hhalf : DifferentiableAt ℂ (fun w : ℂ => w / 2) z := by fun_prop + exact DifferentiableAt.comp (𝕜 := ℂ) (g := (heckeFEPair K).Λ) +@@ -358,7 +358,7 @@ theorem completedDedekindZeta_eq_of_one_lt_re {s : ℂ} (hs : 1 < s.re) : + exact (LSeries_hasDerivAt hz').differentiableAt + have hF₂ := analyticOnNhd_completedZetaPrefactor_mul_dedekindZeta K hζat + have h2mem : (2:ℂ) ∈ {z : ℂ | 1 < z.re} := by +- norm_num [Set.mem_setOf_eq] ++ norm_num [Set.mem_ofPred_eq] + have hfreq := frequently_completedDedekindZeta_eq K + have hEq := hF₁.eqOn_of_preconnected_of_frequently_eq hF₂ hUconn h2mem hfreq + exact hEq hs +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/FunctionalEquation.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/FunctionalEquation.lean +index e9cae2b15..8df65b3b9 100644 +--- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/FunctionalEquation.lean ++++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/FunctionalEquation.lean +@@ -82,10 +82,10 @@ theorem IsCompletedDedekindZeta.eqOn {K : Type*} [Field K] [NumberField K] + intro s hs + have hs0' : s ≠ 0 := by + rintro rfl +- norm_num [Set.mem_setOf_eq, Complex.zero_re] at hs ++ norm_num [Set.mem_ofPred_eq, Complex.zero_re] at hs + have hs1' : s ≠ 1 := by + rintro rfl +- norm_num [Set.mem_setOf_eq, Complex.one_re] at hs ++ norm_num [Set.mem_ofPred_eq, Complex.one_re] at hs + rw [hH₁eq s hs0' hs1', hH₂eq s hs0' hs1', h₁.1 s hs, h₂.1 s hs] + have h2mem : (2 : ℂ) ∈ {s : ℂ | 1 < s.re} := by norm_num [Complex.ofReal_re] + have := AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/HeckeTheta.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/HeckeTheta.lean +index 372944eb4..ba69d2efb 100644 +--- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/HeckeTheta.lean ++++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/HeckeTheta.lean +@@ -8,23 +8,6 @@ module + public import Mathlib + public import DedekindResidue.CompletedZeta.IdealLattice + +-/-! +-# The multivariable Hecke theta of a fractional ideal (SP1-AGE-3) +- +-Hecke's functional-equation argument for a number field of unit rank `> 0` uses the +-**multivariable** theta of an ideal lattice, with one weight per infinite place, averaged +-over a fundamental domain of the unit action. This file builds the per-place weight +-machinery and the theta function itself: +- +-* `placeWeights c` — expand per-place weights to the `index K` coordinates (equal on the +- `(re, im)` pair of a complex place — the shape preserved by the unit action, since complex +- multiplication mixes the pair but preserves `re² + im²`); +-* `sum_placeWeights_embeddingCoords_sq` — `∑ᵢ c_i·ζ(x)ᵢ² = ∑_w c_w·w(x)²`: the weighted +- square-sum of embedding coordinates is the place-absolute-value form. +- +-The unit equivariance `Θ(c·w(ε)², L_I) = Θ(c, L_I)` and the box-averaged `g_I` follow +-(SP1-AGE-3 continuation), then the Mellin definition of `Λ_K` (AGE-4). +--/ + + namespace DedekindResidue + +@@ -36,8 +19,7 @@ open scoped nonZeroDivisors Real + + variable (K : Type*) [Field K] [NumberField K] + +-/-- The `ℝ`-cast field degree `[K : ℚ]` is positive — the packaged `Module.finrank_pos` used +-for the degree denominators throughout the Hecke-weight normalisation. -/ ++ + theorem finrank_pos_real : (0 : ℝ) < (Module.finrank ℚ K : ℝ) := by + have := Module.finrank_pos (R := ℚ) (M := K) + positivity +@@ -198,10 +180,10 @@ theorem placeWeights_dualPlaceWeights (c : InfinitePlace K → ℝ) (i : index K + placeWeights K (dualPlaceWeights K c) i + = (placeWeights K c i)⁻¹ * (dualityWeights K i) ^ 2 := by + rcases i with w | ⟨w, j⟩ +- · simp only [placeWeights, Sum.elim_inl, dualPlaceWeights, dualityWeights, if_pos w.2] ++ · simp only [placeWeights, Sum.elim_inl, dualPlaceWeights, dualityWeights, ite_eq_left w.2] + norm_num + · simp only [placeWeights, Sum.elim_inr, dualPlaceWeights, dualityWeights] +- rw [if_neg (by rw [not_isReal_iff_isComplex]; exact w.2)] ++ rw [ite_eq_right (by rw [not_isReal_iff_isComplex]; exact w.2)] + fin_cases j <;> norm_num <;> ring + + open scoped Classical in +@@ -237,7 +219,6 @@ theorem heckeTheta_inversion (I : (FractionalIdeal (𝓞 K)⁰ K)ˣ) + ring + + +- + open scoped Classical in + /-- Extend hyperplane coordinates `u : logSpace K` (indexed by `w ≠ w₀`) to all infinite + places by the trace-zero condition: the `w₀`-component is `-∑_{w ≠ w₀} u_w`. On the image of +@@ -268,10 +249,8 @@ theorem fullLog_add (u v : logSpace K) : + · rfl + + open scoped Classical in +-/-- **The Hecke weight family**: `c(t,u)_w = t^{1/n}·exp(2·(trace-zero extension of u)_w / mult w)`. +-Pinned by two requirements: `∏_w c_w^{mult w} = t` (the norm ray, giving `N(𝔞)^{-s}` under the +-Mellin transform) and equivariance under `u ↦ u + logEmbedding ε` matching +-`heckeTheta_unit_mul` (making the theta integrand periodic modulo the unit lattice). -/ ++ ++ + noncomputable def heckeWeights (t : ℝ) (u : logSpace K) : InfinitePlace K → ℝ := fun w => + t ^ ((1 : ℝ) / (Module.finrank ℚ K)) * Real.exp (2 * fullLog K u w / mult w) + +@@ -322,11 +301,11 @@ theorem sum_fullLog (u : logSpace K) : ∑ w : InfinitePlace K, fullLog K u w = + have h1 : fullLog K u (w₀ : InfinitePlace K) + = -∑ w' : {w : InfinitePlace K // w ≠ (w₀ : InfinitePlace K)}, u w' := by + rw [fullLog] +- exact dif_pos rfl ++ exact dite_eq_left rfl + have h2 : ∀ w : {w : InfinitePlace K // w ≠ (w₀ : InfinitePlace K)}, + fullLog K u (w : InfinitePlace K) = u w := by + intro w +- rw [fullLog, dif_neg w.2] ++ rw [fullLog, dite_eq_right w.2] + rw [h1, Finset.sum_congr rfl (fun w _ => h2 w)] + ring + +@@ -404,7 +383,7 @@ theorem prod_placeWeights (c : InfinitePlace K → ℝ) : + congr 1 + · refine Finset.prod_congr rfl (fun w _ => ?_) + simp only [placeWeights, Sum.elim_inl] +- rw [mult, if_pos w.2, pow_one] ++ rw [mult, ite_eq_left w.2, pow_one] + · have hre : (∏ i : {w : InfinitePlace K // ¬ IsReal w}, c ↑i ^ mult (i : InfinitePlace K)) + = ∏ w : {w : InfinitePlace K // IsComplex w}, c ↑w ^ mult (w : InfinitePlace K) := + Fintype.prod_equiv (Equiv.subtypeEquivRight +@@ -413,7 +392,7 @@ theorem prod_placeWeights (c : InfinitePlace K → ℝ) : + refine Finset.prod_congr rfl (fun w _ => ?_) + rw [Fin.prod_univ_two] + simp only [placeWeights, Sum.elim_inr] +- rw [mult, if_neg (by rw [not_isReal_iff_isComplex]; exact w.2)] ++ rw [mult, ite_eq_right (by rw [not_isReal_iff_isComplex]; exact w.2)] + ring + + open scoped Classical in +@@ -471,7 +450,7 @@ theorem fullLog_dualShift (w : InfinitePlace K) : + (mult (w : InfinitePlace K) : ℝ) / 2 * + (if IsReal (w : InfinitePlace K) then 0 else Real.log 4)) = 0 := by + refine Finset.sum_eq_zero (fun w _ => ?_) +- rw [if_pos w.2, mul_zero] ++ rw [ite_eq_left w.2, mul_zero] + have hc : (∑ w : {w : InfinitePlace K // ¬ IsReal w}, + (mult (w : InfinitePlace K) : ℝ) / 2 * + (if IsReal (w : InfinitePlace K) then 0 else Real.log 4)) +@@ -480,7 +459,7 @@ theorem fullLog_dualShift (w : InfinitePlace K) : + (mult (w : InfinitePlace K) : ℝ) / 2 * + (if IsReal (w : InfinitePlace K) then 0 else Real.log 4) = Real.log 4 := by + intro w +- rw [if_neg w.2, mult, if_neg w.2] ++ rw [ite_eq_right w.2, mult, ite_eq_right w.2] + norm_num + rw [Finset.sum_congr rfl (fun w _ => hterm w), Finset.sum_const, nsmul_eq_mul] + congr 1 +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/MellinAgreement.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/MellinAgreement.lean +index c1ddb8fb9..cb30568d9 100644 +--- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/MellinAgreement.lean ++++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/MellinAgreement.lean +@@ -341,7 +341,7 @@ theorem lintegral_eq_tsum_box_shift (f : logSpace K → ℝ≥0∞) : + classical + set B := (basisUnitLattice K).ofZLatticeBasis ℝ with hB + have hFD := ZSpan.isAddFundamentalDomain B volume +- haveI : VAddInvariantMeasure (Submodule.span ℤ (Set.range ⇑B)) (logSpace K) volume := ++ have : VAddInvariantMeasure (Submodule.span ℤ (Set.range ⇑B)) (logSpace K) volume := + inferInstanceAs + (VAddInvariantMeasure (Submodule.span ℤ (Set.range ⇑B)).toAddSubgroup + (logSpace K) volume) +@@ -453,11 +453,11 @@ theorem tsum_ite_eq_tsum_coneUnfold_ennreal (J : (Ideal (𝓞 K))⁰) + have hgpr : g ((euclidMixedEquiv K).symm + ((∏ i, fundSystem K i ^ (pr.2 i)) • ((pr.1 : mixedSpace K)))) ≠ 0 := by + rw [hvw] +- rwa [if_neg hvne] at hv ++ rwa [ite_eq_right hvne] at hv + refine ⟨⟨pr, hgpr⟩, ?_⟩ + exact Subtype.ext hvw + · rintro ⟨p, hp⟩ +- rw [if_neg (hne p)] ++ rw [ite_eq_right (hne p)] + + open scoped Classical in + /-- The canonical algebraic preimage of a cone point. -/ +@@ -577,9 +577,9 @@ theorem lintegral_box_theta_tail (J : (Ideal (𝓞 K))⁰) {t : ℝ} (ht : 0 < t + rw [lintegral_tsum (fun v => ?_)] + swap + · by_cases hv : v = 0 +- · simp only [if_pos hv] ++ · simp only [ite_eq_left hv] + exact aemeasurable_const +- · simp only [if_neg hv] ++ · simp only [ite_eq_right hv] + exact (ENNReal.continuous_ofReal.comp (continuous_gaussTerm K t _)).aemeasurable + -- Step 3: the per-v box integral is `ite (v = 0) 0 (G ↑v)` + have hstep3 : ∀ v : idealZLattice K (FractionalIdeal.mk0 K J), +@@ -589,12 +589,12 @@ theorem lintegral_box_theta_tail (J : (Ideal (𝓞 K))⁰) {t : ℝ} (ht : 0 < t + = if v = 0 then 0 else G (v : EuclideanSpace ℝ (index K)) := by + intro v + by_cases hv : v = 0 +- · rw [if_pos hv] ++ · rw [ite_eq_left hv] + rw [setLIntegral_congr_fun (ZSpan.fundamentalDomain_measurableSet _) +- (fun u _ => if_pos hv), lintegral_zero] +- · rw [if_neg hv, hG] ++ (fun u _ => ite_eq_left hv), lintegral_zero] ++ · rw [ite_eq_right hv, hG] + exact setLIntegral_congr_fun (ZSpan.fundamentalDomain_measurableSet _) +- (fun u _ => if_neg hv) ++ (fun u _ => ite_eq_right hv) + rw [tsum_congr hstep3] + -- Step 4: cone reindex (on the G-valued family) + rw [tsum_ite_eq_tsum_coneUnfold_ennreal K J G] +@@ -692,7 +692,7 @@ theorem heckeLogMap_injective : Function.Injective (heckeLogMap K) := by + field_simp at this + linarith + rw [fullLog] at hfl +- rw [dif_neg w'.2] at hfl ++ rw [dite_eq_right w'.2] at hfl + simpa using hfl + rw [hτ, hu] + rfl +@@ -906,7 +906,7 @@ theorem tsum_idealSet_norm_rpow (J : (Ideal (𝓞 K))⁰) (σ : ℝ) : + (∑' _ζ : torsion K, ENNReal.ofReal ((((n : ℝ)) ^ 2) ^ (-σ))) + = (torsionOrder K) * ENNReal.ofReal ((((n : ℝ)) ^ 2) ^ (-σ)) := by + intro I +- letI := Fintype.ofFinite (torsion K) ++ let := Fintype.ofFinite (torsion K) + rw [tsum_fintype, Finset.sum_const, nsmul_eq_mul, Units.torsionOrder, + Nat.card_eq_fintype_card] + norm_cast +@@ -1142,8 +1142,8 @@ theorem sum_mult_heckeLogCLE (p : ℝ × logSpace K) : + field_simp + + open scoped Classical in +-/-- **The universal Mellin constant in closed form**: the change of variables along the +-Hecke substitution factorises the master integral into per-place Gamma integrals. -/ ++ ++ + theorem lintegral_exp_heckeLog (σ : ℝ) (hσ : 0 < σ) : + ∫⁻ p : ℝ × logSpace K, ENNReal.ofReal (Real.exp (σ * p.1 + - π * ∑ w : InfinitePlace K, Real.exp ((heckeLogCLE K p) w))) +@@ -1367,7 +1367,7 @@ theorem setLIntegral_box_swap (f : logSpace K → ℝ≥0∞) + have h2 := ZSpan.isAddFundamentalDomain ((basisUnitLattice K).ofZLatticeBasis ℝ) volume + rw [(Module.Free.chooseBasis ℤ (unitLattice K)).ofZLatticeBasis_span ℝ] at h1 + rw [(basisUnitLattice K).ofZLatticeBasis_span ℝ] at h2 +- haveI : VAddInvariantMeasure (unitLattice K) (logSpace K) volume := ++ have : VAddInvariantMeasure (unitLattice K) (logSpace K) volume := + inferInstanceAs (VAddInvariantMeasure (unitLattice K).toAddSubgroup (logSpace K) volume) + refine h1.setLIntegral_eq h2 (f := f) (fun l x => ?_) + rw [Submodule.vadd_def, vadd_eq_add] +@@ -1774,8 +1774,8 @@ theorem sum_count_eq_card_le (n : ℕ) : + ∑ k ∈ Finset.Icc 1 n, + (Nat.card {I : Ideal (𝓞 K) // Ideal.absNorm I = k} : ℝ) + = (Nat.card {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ n} : ℝ) := by +- haveI : ∀ k : (Finset.Icc 1 n), Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = (k : ℕ)} := +- fun k => (Ideal.finite_setOf_absNorm_eq (S := 𝓞 K) (k : ℕ)).to_subtype ++ have : ∀ k : (Finset.Icc 1 n), Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = (k : ℕ)} := ++ fun k => (Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 K) (k : ℕ)).to_subtype + rw [show (Nat.card {I : (Ideal (𝓞 K))⁰ // Ideal.absNorm (I : Ideal (𝓞 K)) ≤ n}) + = Nat.card (Σ k : (Finset.Icc 1 n), + {I : Ideal (𝓞 K) // Ideal.absNorm I = (k : ℕ)}) from +@@ -1885,18 +1885,18 @@ theorem summable_ideal_norm_rpow {s : ℝ} (hs : 1 < s) : + exact h1.congr (fun n => (h2 n)) + refine h3.congr (fun n => ?_) + by_cases hn : n = 0 +- · rw [if_pos hn, hn] ++ · rw [ite_eq_left hn, hn] + rw [Nat.cast_zero, Real.zero_rpow (by linarith), mul_zero] +- · rw [if_neg hn, Real.rpow_neg (Nat.cast_nonneg n), div_eq_mul_inv] ++ · rw [ite_eq_right hn, Real.rpow_neg (Nat.cast_nonneg n), div_eq_mul_inv] + -- transfer to the ideal-indexed sum by fibering over the norm + have hnn : ∀ p : (Σ n : ℕ, {b : (Ideal (𝓞 K))⁰ // + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n}), + 0 ≤ ((Ideal.absNorm ((p.2 : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) : ℝ)) ^ (-s) := + fun p => Real.rpow_nonneg (Nat.cast_nonneg _) _ +- haveI hfibfin : ∀ n : ℕ, Finite {b : (Ideal (𝓞 K))⁰ // ++ have hfibfin : ∀ n : ℕ, Finite {b : (Ideal (𝓞 K))⁰ // + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n} := fun n => by +- haveI : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = n} := +- (Ideal.finite_setOf_absNorm_eq (S := 𝓞 K) n).to_subtype ++ have : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = n} := ++ (Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 K) n).to_subtype + exact Finite.of_injective _ (normFiber_forget_injective K n) + rw [← Equiv.summable_iff (Equiv.sigmaFiberEquiv (fun b : (Ideal (𝓞 K))⁰ => + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K))))] +@@ -1909,7 +1909,7 @@ theorem summable_ideal_norm_rpow {s : ℝ} (hs : 1 < s) : + = ((n : ℝ)) ^ (-s) := by + intro b + rw [b.2] +- haveI : Fintype {b : (Ideal (𝓞 K))⁰ // ++ have : Fintype {b : (Ideal (𝓞 K))⁰ // + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n} := Fintype.ofFinite _ + rw [show (∑' b : {b : (Ideal (𝓞 K))⁰ // + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n}, +@@ -1961,10 +1961,10 @@ theorem dedekindZeta_real_eq {s : ℝ} (hs : 1 < s) : + rw [tsum_congr h2, ← Complex.ofReal_tsum] + congr 1 + -- fiber-glue the real n-sum into the ideal-type sum +- haveI hfibfin : ∀ n : ℕ, Finite {b : (Ideal (𝓞 K))⁰ // ++ have hfibfin : ∀ n : ℕ, Finite {b : (Ideal (𝓞 K))⁰ // + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n} := fun n => by +- haveI : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = n} := +- (Ideal.finite_setOf_absNorm_eq (S := 𝓞 K) n).to_subtype ++ have : Finite {I : Ideal (𝓞 K) // Ideal.absNorm I = n} := ++ (Ideal.finite_setOfPred_absNorm_eq (S := 𝓞 K) n).to_subtype + exact Finite.of_injective _ (normFiber_forget_injective K n) + have hsum := summable_ideal_norm_rpow K hs + have hsigma : Summable (fun p : (Σ n : ℕ, {b : (Ideal (𝓞 K))⁰ // +@@ -1986,7 +1986,7 @@ theorem dedekindZeta_real_eq {s : ℝ} (hs : 1 < s) : + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n}, + ((Ideal.absNorm ((b.val : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) : ℝ)) ^ (-s) + = ((n : ℝ)) ^ (-s) := fun b => by rw [b.2] +- haveI : Fintype {b : (Ideal (𝓞 K))⁰ // ++ have : Fintype {b : (Ideal (𝓞 K))⁰ // + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n} := Fintype.ofFinite _ + rw [show (∑' b : {b : (Ideal (𝓞 K))⁰ // + Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) = n}, +@@ -1997,8 +1997,8 @@ theorem dedekindZeta_real_eq {s : ℝ} (hs : 1 < s) : + rw [tsum_fintype, Finset.sum_const, nsmul_eq_mul, Finset.card_univ] + by_cases hn : n = 0 + · subst hn +- rw [if_pos rfl, Nat.cast_zero, Real.zero_rpow (by linarith), mul_zero] +- · rw [if_neg hn] ++ rw [ite_eq_left rfl, Nat.cast_zero, Real.zero_rpow (by linarith), mul_zero] ++ · rw [ite_eq_right hn] + congr 2 + rw [← Nat.card_eq_fintype_card] + exact Nat.card_congr (normFiberEquiv K n hn).symm +@@ -2014,8 +2014,7 @@ theorem heckeF_dev_nonneg {t : ℝ} (ht : 0 < t) : + rw [hFsum] + exact Finset.sum_nonneg (fun C _ => heckeGClass_dev_nonneg K C ht) + +-/-- Positivity of the Gamma-product factor `∏ w, π^(-mult w·σ)·Γ(mult w·σ)` of the closed +-Hecke Λ-form (each factor is positive for `σ > 0`). -/ ++ + theorem prod_pi_rpow_mul_Gamma_nonneg {σ : ℝ} (hσ0 : 0 < σ) : + 0 ≤ ∏ w : InfinitePlace K, + π ^ (-((mult w : ℝ) * σ)) * Real.Gamma ((mult w : ℝ) * σ) := by +@@ -2026,8 +2025,7 @@ theorem prod_pi_rpow_mul_Gamma_nonneg {σ : ℝ} (hσ0 : 0 < σ) : + positivity + positivity + +-/-- Nonnegativity of the closed real Λ-form (a `heckeBeta` power times the nonnegative +-Gamma-product times a nonnegative ideal-norm `tsum`). -/ ++ + theorem heckeClosedLambdaForm_nonneg {σ : ℝ} (hσ0 : 0 < σ) : + (0:ℝ) ≤ (heckeBeta K) ^ (-σ) + * ((((heckeJacobian K : ℝ≥0)) : ℝ) +@@ -2044,8 +2042,8 @@ theorem heckeClosedLambdaForm_nonneg {σ : ℝ} (hσ0 : 0 < σ) : + positivity + + open scoped Classical in +-/-- The `ENNReal.ofReal` of the Mellin integral of the Hecke theta deviation equals the +-`ofReal` of the closed Γ–ζ form; the ENNReal core of `heckeFEPair_Λ_real`. -/ ++ ++ + theorem ennreal_ofReal_integral_heckeF_dev_eq {σ : ℝ} (hσ0 : 0 < σ) (h2σ : 1 < 2 * σ) + (hri : IntegrableOn (fun t : ℝ => t ^ (σ - 1) * (heckeF K t - heckeFConst K)) + (Set.Ioi (0:ℝ)) volume) +@@ -2066,7 +2064,7 @@ theorem ennreal_ofReal_integral_heckeF_dev_eq {σ : ℝ} (hσ0 : 0 < σ) (h2σ : + fun t ht => ENNReal.ofReal_mul (Real.rpow_nonneg (le_of_lt ht) _) + rw [setLIntegral_congr_fun measurableSet_Ioi hsplit, + lintegral_mellin_heckeF_dev K hσ0] +- -- identify the closed ENNReal form with ofReal of the real one ++ + have hzsum : (∑' b : (Ideal (𝓞 K))⁰, + ENNReal.ofReal ((((Ideal.absNorm ((b : (Ideal (𝓞 K))⁰) : Ideal (𝓞 K)) : ℝ)) ^ 2) + ^ (-σ))) +@@ -2094,8 +2092,8 @@ theorem ennreal_ofReal_integral_heckeF_dev_eq {σ : ℝ} (hσ0 : 0 < σ) (h2σ : + ← ENNReal.ofReal_mul (by positivity)] + + open scoped Classical in +-/-- **The Λ-value identification (e-vi)**: at real `σ > 1/2` the abstract completed +-function of the Hecke theta pair is the closed Γ–ζ form. -/ ++ ++ + theorem heckeFEPair_Λ_real {σ : ℝ} (hσ : 1/2 < σ) : + (heckeFEPair K).Λ (σ : ℂ) + = (((heckeBeta K) ^ (-σ) +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonLattice.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonLattice.lean +index db7f899ca..d8a411dcb 100644 +--- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonLattice.lean ++++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonLattice.lean +@@ -9,22 +9,6 @@ public import Mathlib + public import DedekindResidue.CompletedZeta.DualLattice + public import DedekindResidue.CompletedZeta.PoissonSummation + +-/-! +-# Poisson summation over a general `ℤ`-lattice (SP1-AGP, leaf P.3) +- +-Transport of the `ℤ^ι` Poisson formula (`tsum_eq_tsum_fourier_zpoint`) to an arbitrary +-`ℤ`-lattice `L ⊂ EuclideanSpace ℝ ι`: conjugate by the linear equivalence sending the standard +-lattice to `L`. The Fourier side transforms by the **`GL` change-of-variables law** +-(`fourier_comp_linearEquiv`, new to this development: mathlib only has the isometry case +-`Real.fourier_comp_linearIsometry`), the dual lattice appears via `dualZLattice_eq_span` +-(P.1), and the covolume factor via `ZLattice.covolume_eq_det_mul_measureReal`. +- +-## Main results (this file) +-* `DedekindResidue.fourier_comp_linearEquiv` — +- `𝓕(g ∘ T) w = |det T|⁻¹ • 𝓕 g ((T⁻¹)^* w)` for `T ∈ GL(EuclideanSpace ℝ ι)`. +-* `DedekindResidue.tsum_eq_tsum_fourier_zlattice` — **Poisson summation over a `ℤ`-lattice**: +- `∑'_{v ∈ L} g(v) = covol(L)⁻¹ • ∑'_{w ∈ L♯} 𝓕g(w)`. +--/ + + namespace DedekindResidue + +@@ -160,7 +144,7 @@ theorem adjoint_symm_latticeEquiv_zpoint [DecidableEq ι] + innerₗ_nondegenerate c i j + rw [← innerₗ_apply_apply] + exact this +- simp only [this, mul_ite, mul_one, mul_zero, Finset.sum_ite_eq, Finset.mem_univ, if_true] ++ simp only [this, mul_ite, mul_one, mul_zero, Finset.sum_ite_eq, Finset.mem_univ, ite_true] + rw [hLHS, hRHS] + + /-- **P3d.** The determinant of the lattice-basis change of variables is (up to sign) the +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonSummation.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/PoissonSummation.lean +index d37431765b6cd844993a19f34fa0da37c8e6c6ad..9e1c836c4e548e89a5aebceddd3da2d4fbff7de7 100644 +GIT binary patch +delta 148 +zcmbQ$!F2Q!m%Xs$<$LWp-SeBP72dKPNxEa`VGL +USD5*mwL>O}g0*eln;9zw0CzSwivR!s + +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaEstimates.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaEstimates.lean +index c9a2e644c..4c7e21d05 100644 +--- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaEstimates.lean ++++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaEstimates.lean +@@ -91,12 +91,12 @@ theorem tsum_ite_gaussian_tail (L : Submodule ℤ (EuclideanSpace ℝ ι)) + rw [← smul_eq_mul, ← tsum_const_smul'' (Real.exp (-π * (a - a₀) * δ ^ 2))] + refine Summable.tsum_le_tsum (fun v => ?_) ?_ (hsum₀.const_smul _) + · by_cases hv : v = 0 +- · rw [if_pos hv] ++ · rw [ite_eq_left hv] + have : (0:ℝ) < Real.exp (-π * (a - a₀) * δ ^ 2) + * Real.exp (-π * ∑ i, a₀ * ((v : EuclideanSpace ℝ ι) i) ^ 2) := by + positivity + exact le_of_lt (by simpa [smul_eq_mul] using this) +- · rw [if_neg hv, smul_eq_mul, ← Real.exp_add] ++ · rw [ite_eq_right hv, smul_eq_mul, ← Real.exp_add] + refine Real.exp_le_exp.mpr ?_ + have hnorm : δ ^ 2 ≤ ∑ i, ((v : EuclideanSpace ℝ ι) i) ^ 2 := by + have h1 : δ ^ 2 ≤ ‖(v : EuclideanSpace ℝ ι)‖ ^ 2 := +diff --git a/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaLattice.lean b/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaLattice.lean +index dab1b9d9e..efc5f57f2 100644 +--- a/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaLattice.lean ++++ b/projects/DedekindResidue/DedekindResidue/CompletedZeta/ThetaLattice.lean +@@ -10,30 +10,6 @@ public import DedekindResidue.CompletedZeta.DualLattice + public import DedekindResidue.CompletedZeta.PoissonSummation + public import DedekindResidue.CompletedZeta.PoissonLattice + +-/-! +-# The lattice Gaussian theta function and its transformation law (SP1-AGΘ) +- +-For a `ℤ`-lattice `L ⊂ EuclideanSpace ℝ ι` the **theta function** +-`Θ_L(t) := ∑_{v ∈ L} e^{-π t ‖v‖²}` (`t > 0`) satisfies the **inversion law** +- +-`Θ_L(t) = covol(L)⁻¹ · t^{-n/2} · Θ_{L♯}(1/t)`, +- +-the standard lattice theta transformation (Neukirch, *Algebraic Number Theory*, VII §3; +-the 1-D case is mathlib's `jacobiTheta` functional equation). It is the Gaussian +-instantiation of the lattice Poisson formula `tsum_eq_tsum_fourier_zlattice` (P.3): mathlib's +-`fourier_gaussian_innerProductSpace` at `b = πt` gives `𝓕 g_t(w) = t^{-n/2} e^{-π‖w‖²/t}`, +-and `summable_gaussian_zlattice` discharges the convergence hypotheses. +- +-This is the analytic engine of the Hecke functional-equation route (SP1-AGE → SP1-FE): +-applied to the ideal lattices of a number field it produces the completed `Λ_K`. +- +-## Main definitions / results (this file) +-* `DedekindResidue.thetaLattice L t` — `Θ_L(t) = ∑'_{v ∈ L} exp(-π t ‖v‖²)` (real-valued). +-* `thetaLattice_transform` — **the inversion law** `Θ_L(t) = covol(L)⁻¹·t^{-n/2}·Θ_{L♯}(1/t)` +- for `t > 0`, fully proven from the lattice Poisson formula + mathlib's Gaussian Fourier +- transform (`fourier_gaussianCM`), with both convergence hypotheses discharged +- (`summable_norm_restrict_gaussianCM`, `summable_fourier_gaussianCM`). +--/ + + namespace DedekindResidue + +@@ -72,12 +48,12 @@ theorem norm_gaussianCM_apply (t : ℝ) (x : EuclideanSpace ℝ ι) : + push_cast; ring + rw [this, Complex.ofReal_re] + +-/-- Sub-level sets of a lattice are finite (lattice ∩ closed ball in a proper space). -/ ++ + theorem finite_norm_le_zlattice (L : Submodule ℤ (EuclideanSpace ℝ ι)) + [DiscreteTopology L] (R : ℝ) : + {v : L | ‖(v : EuclideanSpace ℝ ι)‖ ≤ R}.Finite := by + have hcl : IsClosed (L : Set (EuclideanSpace ℝ ι)) := by +- rw [← Submodule.coe_toAddSubgroup]; exact AddSubgroup.isClosed_of_discrete ++ rw [← Submodule.coe_toAddSubgroup]; exact AddSubgroup.isClosed_of_discreteTopology + have hfb : (Metric.closedBall 0 R ∩ (L : Set (EuclideanSpace ℝ ι))).Finite := + Metric.finite_isBounded_inter_isClosed DiscreteTopology.isDiscrete + Metric.isBounded_closedBall hcl +@@ -107,7 +83,7 @@ theorem summable_norm_restrict_gaussianCM (L : Submodule ℤ (EuclideanSpace ℝ + · exact (summable_gaussian_zlattice L (by positivity)).mul_left _ + · rw [Filter.eventually_cofinite] + refine (finite_norm_le_zlattice L R').subset (fun v hv => ?_) +- simp only [Set.mem_setOf_eq] at hv ⊢ ++ simp only [Set.mem_ofPred_eq] at hv ⊢ + by_contra hnotle + rw [not_le] at hnotle + refine hv ?_ +diff --git a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/FourierJordan.lean b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/FourierJordan.lean +index 5171d0c7f..e5f838c02 100644 +--- a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/FourierJordan.lean ++++ b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/FourierJordan.lean +@@ -10,7 +10,7 @@ public import Mathlib.Analysis.Fourier.RiemannLebesgueLemma + public import DedekindResidue.ExplicitFormula.PhiTransform + + /-! +-# Fourier–Jordan inversion: the Dirichlet integral (SP2-FJ-c) ++# Fourier–Jordan inversion: the Dirichlet integral + + The classical Dirichlet integral `∫₀^∞ (sin x)/x dx = π/2`, phrased as convergence of the + truncated integrals `∫₀^b (sin x)/x dx → π/2` as `b → ∞`. This is the analytic engine of +@@ -18,7 +18,7 @@ Jordan's pointwise Fourier-inversion criterion for functions of bounded variatio + Poitou's proof of the explicit formula (Poitou, *Sur les petits discriminants*, Séminaire + DPP 1976/77, exposé 6, p. 6-03) to invert the transform `Φ` on the prime side. + +-Not available in mathlib. We follow the Frullani/Fubini route: ++The Frullani/Fubini argument uses + `1/x = ∫₀^∞ e^{-xy} dy`, so + `∫₀^b (sin x)/x dx = ∫₀^∞ (1 - e^{-yb}(cos y + y sin b))/(1+y²) dy` + by Fubini and the closed form of the damped sine integral; dominated convergence then gives +@@ -181,7 +181,7 @@ theorem integral_sinc_eq {b : ℝ} (hb : 0 < b) : + rw [mul_comm x y]; ring)] + exact integral_exp_neg_mul_sin y b + +-/-- **The Dirichlet integral** (SP2-FJ-c): `∫₀^∞ sin x/x dx = π/2`, as a limit of the ++/-- **The Dirichlet integral**: `∫₀^∞ sin x/x dx = π/2`, as a limit of the + truncated integrals. Fubini against `1/x = ∫ e^{-xy} dy` plus dominated convergence. -/ + theorem tendsto_integral_sinc_atTop : + Filter.Tendsto (fun b : ℝ => ∫ x in (0:ℝ)..b, Real.sin x / x) +@@ -490,7 +490,7 @@ theorem integral_fourier_window_collapse {H : ℝ → ℂ} (hH : Integrable H) { + refine MeasureTheory.integral_congr_ae ?_ + have h0 : ∀ᵐ (u : ℝ), u ≠ 0 := by + rw [MeasureTheory.ae_iff] +- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] ++ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] + exact MeasureTheory.measure_singleton 0 + filter_upwards [h0] with u hu + rw [MeasureTheory.integral_const_mul] +@@ -740,7 +740,7 @@ theorem abs_integral_monotone_kernel_le {g K : ℝ → ℝ} (hg : Monotone g) { + have hcount : Set.Countable {x : ℝ | g x ≠ Function.rightLim g x} := by + refine Set.Countable.mono ?_ hg.countable_not_continuousAt + intro x hx +- simp only [Set.mem_setOf_eq] at hx ⊢ ++ simp only [Set.mem_ofPred_eq] at hx ⊢ + intro hcont + exact hx (hcont.continuousWithinAt.rightLim_eq).symm + have hnull : volume {x : ℝ | g x ≠ Function.rightLim g x} = 0 := +@@ -1023,8 +1023,8 @@ theorem integral_dirichlet_split {H : ℝ → ℂ} (hH : Integrable H) {δ : ℝ + funext u + simp only [Set.indicator_apply, Set.mem_Ico, Set.mem_Ioc] + by_cases hu : -δ ≤ -u ∧ -u < 0 +- · rw [if_pos hu, if_pos ⟨by linarith [hu.2], by linarith [hu.1]⟩] +- · rw [if_neg hu, if_neg (fun h => hu ⟨by linarith [h.2], by linarith [h.1]⟩)] ++ · rw [ite_eq_left hu, ite_eq_left ⟨by linarith [hu.2], by linarith [hu.1]⟩] ++ · rw [ite_eq_right hu, ite_eq_right (fun h => hu ⟨by linarith [h.2], by linarith [h.1]⟩)] + rw [h1, h2, h3, MeasureTheory.integral_indicator measurableSet_Ioc] + have hK_even : ∀ u : ℝ, f (-u) = H (-u) * ((2 * Real.sin (T * u) / u : ℝ) : ℂ) := by + intro u +@@ -1122,8 +1122,7 @@ theorem tendsto_integral_dirichlet_plateau {δ : ℝ} (hδ : 0 < δ) : + push_cast + ring + +-/-- **Jordan's Fourier inversion criterion, Dirichlet-kernel form** (SP2-FJ-a/g; Poitou +-p. 6-03): for integrable `H` whose real and imaginary parts have bounded variation, with ++/-- **Jordan's Fourier inversion criterion, Dirichlet-kernel form**: for integrable `H` whose real and imaginary parts have bounded variation, with + one-sided limits `Hp` (from the right) and `Hm` (from the left) at `0`, + + `∫_ℝ H(u) · 2sin(Tu)/u du → π(Hp + Hm)` as `T → ∞`. +@@ -1394,7 +1393,7 @@ theorem tendsto_integral_dirichlet_jordan {H : ℝ → ℂ} (hH : Integrable H) + (add_lt_add_of_lt_of_lt hfarT hplat_piece) (hRright.trans hδR.le)) (hRleft.trans hδL.le) + _ = ε := by ring + +-/-- **Jordan's Fourier inversion, symmetric-window form** (SP2-FJ-a; Poitou p. 6-03): for ++/-- **Jordan's Fourier inversion, symmetric-window form**: for + integrable `H` of bounded variation with one-sided limits `Hp`, `Hm` at `0`, + + `∫_{-T}^{T} (∫_ℝ H(u) e^{itu} du) dt → π(Hp + Hm)` as `T → ∞`. +diff --git a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/GammaSide.lean b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/GammaSide.lean +index 1f1506cfc..ebf01aa5c 100644 +--- a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/GammaSide.lean ++++ b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/GammaSide.lean +@@ -10,35 +10,13 @@ public import DedekindResidue.ExplicitFormula.RectangleContour + public import DedekindResidue.Lemma2 + + /-! +-# The archimedean side: digamma integrals (SP2-Γψ) ++Gauss's integral representation of the digamma function supplies the ++archimedean part of Poitou's explicit formula. It follows from the ++logarithmic derivative of Euler's gamma integral, the Frullani representation ++of the logarithm and Fubini's theorem. Taking digamma differences cancels ++the counterterms and gives the kernel used on vertical lines. + +-Poitou's computation of the archimedean part of the explicit formula (Poitou, *Sur les +-petits discriminants*, exposé 6, pp. 6-03–6-06) rests on **Gauss's integral formula** +-(his eq. (5)) +- +-`ψ(z) = -∫₀^∞ (e^{-xz}/(1-e^{-x}) - e^{-x}/x) dx`, `Re z > 0`, +- +-and its consequences for `Re ψ` on vertical lines. Mathlib defines `Complex.digamma` +-(as `logDeriv Gamma`) but has no integral representation (explicit TODO in +-`Mathlib.Analysis.SpecialFunctions.Gamma.Digamma`), so this file builds it from the +-Euler integral: `Γ'(z) = ∫₀^∞ t^{z-1}e^{-t} log t dt` (mathlib's +-`hasDerivAt_GammaIntegral`), the Frullani representation of `log`, and Fubini — the +-classical Gauss derivation. +- +-## Main results +- +-- `integral_frullani_log` : `∫₀^∞ (e^{-x} - e^{-tx})/x dx = log t` for `t > 0`. +-- `integrableOn_rpow_mul_exp_neg_mul_abs_log` : the log-weighted Euler integrand is +- integrable. +-- `abs_frullani_kernel_le` : exponential domination of the Frullani kernel. +-- `integral_gauss_inner` : the inner evaluation +- `∫₀^∞ t^{z-1}e^{-t}(e^{-x}-e^{-tx})/x dt = Γ(z)(e^{-x} - (1+x)^{-z})/x`. +-- `digamma_eq_integral_gauss_one` : **Gauss's first form** +- `ψ(z) = ∫₀^∞ (e^{-x} - (1+x)^{-z})/x dx` for `Re z > 0`. +-- `integrableOn_gauss_one_integrand` : integrability of that integrand. +-- `digamma_sub_digamma_eq_integral` : **Poitou's difference form** +- `ψ(w) - ψ(σ) = ∫₀^∞ (e^{-σu} - e^{-wu})/(1-e^{-u}) du` (`x = e^u - 1`), the form his +- eq. (5) is used in — both counterterms cancel in the difference. ++Reference: Poitou, *Sur les petits discriminants*, exposé 6, pp. 6-03–6-06. + -/ + + @[expose] public section +@@ -1216,7 +1194,7 @@ theorem hasDerivAt_gammaFT {F : ℝ → ℂ} (hF : Integrable F) + refine h0.congr ?_ + refine (MeasureTheory.ae_restrict_iff' measurableSet_Ioc).mpr ?_ + filter_upwards [MeasureTheory.ae_iff.mpr (by +- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] ++ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] + exact MeasureTheory.measure_singleton (0:ℝ) : volume {x : ℝ | ¬ x ≠ 0} = 0)] + with x hx _ + have hxne : (x:ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hx +@@ -1364,7 +1342,7 @@ theorem hasDerivAt_gammaFT {F : ℝ → ℂ} (hF : Integrable F) + refine MeasureTheory.integral_congr_ae ?_ + refine ((MeasureTheory.ae_restrict_iff' measurableSet_Ioc).mpr ?_) + filter_upwards [MeasureTheory.ae_iff.mpr (by +- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] ++ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] + exact MeasureTheory.measure_singleton (0:ℝ) : volume {x : ℝ | ¬ x ≠ 0} = 0)] + with x hx _ + have hxne : (x:ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hx +@@ -1518,7 +1496,7 @@ theorem hasDerivAt_rhoFT {k : ℝ → ℂ} (hk : Integrable k) (t : ℝ) : + rw [h0, Real.exp_zero, mul_one] + · exact hk.norm + · filter_upwards [MeasureTheory.ae_iff.mpr (by +- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] ++ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] + exact MeasureTheory.measure_singleton (0:ℝ) : volume {x : ℝ | ¬ x ≠ 0} = 0)] + with x hx + intro τ _ +@@ -2479,7 +2457,8 @@ theorem tendsto_eLpNorm_indicator_truncation {g : ℝ → ℂ} + = (∫⁻ x, ((Set.Ioc (-(n:ℝ)) (n:ℝ))ᶜ.indicator (fun y => ‖g y‖ₑ ^ (2:ℝ)) x)) + ^ (1/(2:ℝ)) := by + intro n +- rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (by norm_num) (by norm_num)] ++ rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (by norm_num) (by norm_num) ++ ((hg.aestronglyMeasurable.indicator measurableSet_Ioc).sub hg.aestronglyMeasurable)] + rw [show ((2:ℝ≥0∞).toReal) = (2:ℝ) by norm_num] + congr 1 + refine lintegral_congr (fun x => ?_) +@@ -2507,7 +2486,8 @@ theorem tendsto_eLpNorm_indicator_truncation {g : ℝ → ℂ} + · rw [Set.indicator_of_notMem hx] + exact bot_le + · have := hg.eLpNorm_lt_top +- rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (by norm_num) (by norm_num), ++ rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (by norm_num) (by norm_num) ++ hg.aestronglyMeasurable, + show ((2:ℝ≥0∞).toReal) = (2:ℝ) by norm_num] at this + have h1 : (∫⁻ x, ‖g x‖ₑ ^ (2:ℝ)) < ⊤ := by + by_contra hcon +@@ -2615,11 +2595,7 @@ theorem gammaFT_ae_eq_fourierL2 {F : ℝ → ℂ} (hF : Integrable F) + exact tendsto_eLpNorm_indicator_truncation hFdiv2 + have hmeas : TendstoInMeasure volume (fun n : ℕ => 𝓕 (fun x : ℝ => hn n x)) atTop + ((𝓕 (hFdiv2.toLp h) : Lp ℂ 2 (volume : Measure ℝ)) : ℝ → ℂ) := by +- refine tendstoInMeasure_of_tendsto_eLpNorm (p := 2) (by norm_num) ?_ ?_ heLp +- · intro n +- refine Continuous.aestronglyMeasurable ?_ +- exact VectorFourier.fourierIntegral_continuous (by fun_prop) (by fun_prop) (hn1 n) +- · exact (MeasureTheory.Lp.memLp _).aestronglyMeasurable ++ exact MeasureTheory.tendstoInMeasure_of_tendsto_eLpNorm (p := 2) (by norm_num) heLp + obtain ⟨ns, hns_mono, hns_ae⟩ := hmeas.exists_seq_tendsto_ae + have hqmp : Measure.QuasiMeasurePreserving (fun t : ℝ => -t/(2*π)) + volume volume := by +@@ -2637,7 +2613,7 @@ theorem gammaFT_ae_eq_fourierL2 {F : ℝ → ℂ} (hF : Integrable F) + have hae_t := hqmp.ae hns_ae + have hne : ∀ᵐ t : ℝ, t ≠ 0 := by + rw [MeasureTheory.ae_iff] +- simp only [ne_eq, not_not, Set.setOf_eq_eq_singleton] ++ simp only [ne_eq, not_not, Set.ofPred_eq_eq_singleton] + exact MeasureTheory.measure_singleton 0 + filter_upwards [hae_t, hne] with t hlim ht + have hpt : Tendsto (fun i : ℕ => 𝓕 (fun x : ℝ => hn (ns i) x) (-t/(2*π))) +@@ -4275,7 +4251,7 @@ theorem differentiableAt_logDeriv_gammaFactor (K : Type*) [Field K] [NumberField + have hU : IsOpen {w : ℂ | 0 < w.re} := isOpen_lt continuous_const Complex.continuous_re + have hdiff : DifferentiableOn ℂ (gammaFactor K) {w : ℂ | 0 < w.re} := by + intro w hw +- rw [Set.mem_setOf_eq] at hw ++ rw [Set.mem_ofPred_eq] at hw + exact (((differentiableAt_Gammaℝ_of_re_pos hw).pow _).mul + ((differentiableAt_Gammaℂ_of_re_pos hw).pow _)).differentiableWithinAt + have han : AnalyticOnNhd ℂ (gammaFactor K) {w : ℂ | 0 < w.re} := +diff --git a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/PrimeSide.lean b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/PrimeSide.lean +index 257b1ee8f..bfe4ae128 100644 +--- a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/PrimeSide.lean ++++ b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/PrimeSide.lean +@@ -557,11 +557,11 @@ instance countable_ideal_ringOfIntegers (K : Type*) [Field K] [NumberField K] : + Countable (Ideal (𝓞 K)) := by + have h0 : (Set.univ : Set (Ideal (𝓞 K))) = ⋃ n : ℕ, {I | Ideal.absNorm I = n} := by + ext I +- simp only [Set.mem_univ, Set.mem_iUnion, Set.mem_setOf_eq, true_iff] ++ simp only [Set.mem_univ, Set.mem_iUnion, Set.mem_ofPred_eq, true_iff] + exact ⟨Ideal.absNorm I, rfl⟩ + have h1 : (Set.univ : Set (Ideal (𝓞 K))).Countable := by + rw [h0] +- exact Set.countable_iUnion (fun n => (Ideal.finite_setOf_absNorm_eq n).countable) ++ exact Set.countable_iUnion (fun n => (Ideal.finite_setOfPred_absNorm_eq n).countable) + exact Set.countable_univ_iff.mp h1 + + /-- A pointwise `tsum` of integrable functions with summable `L¹` norms is +diff --git a/projects/DedekindResidue/DedekindResidue/ExplicitFormula/ZeroCapture.lean b/projects/DedekindResidue/DedekindResidue/ExplicitFormula/ZeroCapture.lean +index 7d31587b8f2e079d6c96c21bf6d5ff6fd91172a5..74884c4ad50c792dfd89f70ce83086df94199c96 100644 +GIT binary patch +delta 407 +zcmY+9u}T9$5Qd3~2&au$3NnRQg&>HHDI?lxV;jO`cP_WMH+$|*5|T!IhU=o0jh4Y! +zi4S69?F0A%?h#M}+bsV#|9tcM(0H3Q=B{>o$$$*5AO=rLkO!8UAQ^#jd0|ON!zpRH +zHmqSvf{+ebiE#`mDsesl#+MY{>7f$P6qGl8!vio9;)Hhr#N-qqV8$Uw*Fb?qM{npjc3?1+tVA3;Kw& +zF7N6)2T`IZ?4(*08 1/2`, `X ≥ 1`). -/ ++ + theorem integrable_auxF_kernel (s : ℂ) {X : ℝ} (hX : 1 ≤ X) (hs : 1/2 < s.re) (γ : ℝ) : + Integrable (fun t : ℝ => auxF s X t * Complex.exp (Complex.I * t * γ)) := by + refine Integrable.mono' +@@ -186,9 +174,7 @@ theorem hasDerivAt_gAux_deriv (h : ℂ) {t : ℝ} (ht : 0 < t) : + field_simp + ring + +-/-- Master decay bound: a continuous multiplier `φ` bounded on `(T, ∞)` times the +-kernel `e^{-ht}/t` (with `Re h > 0`, `T > 0`) is integrable on `(T, ∞)`, by comparison +-with `(C/T)·e^{-Re h · t}`. -/ ++ + theorem integrableOn_bounded_mul_exp_div {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) + {φ : ℝ → ℂ} (hφc : ContinuousOn φ (Set.Ioi T)) {C : ℝ} + (hφb : ∀ t ∈ Set.Ioi T, ‖φ t‖ ≤ C) : +@@ -218,7 +204,7 @@ theorem integrableOn_bounded_mul_exp_div {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT + mul_le_mul (hφb t ht) hle (by positivity) hC0 + _ = C / T * Real.exp (-h.re * t) := by ring + +-/-- The kernel `e^{-ht}/t` times an eventually-bounded multiplier tends to `0` at `∞`. -/ ++ + theorem tendsto_exp_div_mul_atTop {h : ℂ} (hh : 0 < h.re) {v : ℝ → ℂ} {C : ℝ} + (hv : ∀ᶠ t : ℝ in Filter.atTop, ‖v t‖ ≤ C) : + Filter.Tendsto (fun t : ℝ => Complex.exp (-h * t) / t * v t) Filter.atTop (nhds 0) := by +@@ -343,7 +329,7 @@ theorem integral_Ioi_gAux_ibp₁ (h : ℂ) (hh : 0 < h.re) {T γ : ℝ} (hT : 0 + gcongr + exact abs_le.mpr ⟨Real.neg_one_le_sin _, Real.sin_le_one _⟩ + +-/-- Integrability of the kernel against a bounded continuous real multiplier. -/ ++ + theorem integrableOn_exp_div_mul_real {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) + {ψ : ℝ → ℝ} (hψc : Continuous ψ) {C : ℝ} (hψb : ∀ t, |ψ t| ≤ C) : + IntegrableOn (fun t : ℝ => Complex.exp (-h * t) / t * ((ψ t : ℝ) : ℂ)) +@@ -412,9 +398,7 @@ theorem integrableOn_gAux_deriv2_mul_real {h : ℂ} (hh : 0 < h.re) {T : ℝ} (h + rw [norm_pow] + linarith + +-/-- Second integration by parts for the Fourier tail: with `g(t) = e^{-ht}/t`, +-`∫_T^∞ (g″(t)·(-cos(tγ)/γ²) + g′(t)·sin(tγ)/γ) dt = +-(h+1/T)·g(T)·cos(Tγ)/γ²`, stated with the boundary value in raw `-(u(T)·v(T))` form. -/ ++ + theorem integral_Ioi_gAux_ibp₂ (h : ℂ) (hh : 0 < h.re) {T γ : ℝ} (hT : 0 < T) + (hγ : γ ≠ 0) : + (∫ t in Set.Ioi T, +@@ -561,9 +545,7 @@ theorem tail_integral_identity (h : ℂ) (hh : 0 < h.re) {T γ : ℝ} (hT : 0 < + field_simp at h2 ⊢ + linear_combination (-1 : ℂ) * h2 + +-/-- On the tail `t > log X`, the auxiliary function factors as a constant times the +-exponential kernel: `F_{s,X}(t) = log X · e^{h·log X} · (e^{-h t}/t)` with `h = s - 1/2` +-(the `|t| > log X` branch of `auxF`, rearranged). -/ ++ + theorem auxF_of_gt (s : ℂ) {X : ℝ} (hX : 1 < X) {t : ℝ} (ht : Real.log X < t) : + auxF s X t + = (Real.log X : ℂ) * Complex.exp ((s - 1/2) * (Real.log X : ℂ)) +@@ -574,17 +556,13 @@ theorem auxF_of_gt (s : ℂ) {X : ℝ} (hX : 1 < X) {t : ℝ} (ht : Real.log X < + rw [abs_of_pos htpos] + exact not_le.mpr ht + have htc : ((t : ℝ) : ℂ) ≠ 0 := by exact_mod_cast htpos.ne' +- rw [auxF, if_neg hnot, abs_of_pos htpos] ++ rw [auxF, ite_eq_right hnot, abs_of_pos htpos] + push_cast + rw [show -(s - 1/2) * ((t:ℂ) - (Real.log X : ℂ)) + = -(s - 1/2) * (t:ℂ) + (s - 1/2) * (Real.log X : ℂ) by ring, Complex.exp_add] + field_simp + +-/-- **Belabas–Friedman Lemma 2, eq. (8)** (the `γ ≠ 0` case): the paper-convention +-Fourier transform of the auxiliary function `F_{s,X}` in closed form. With `h = s - 1/2` +-and `T = log X`, +-`F̂(γ) = 2h²·sin(Tγ)/((h²+γ²)γ) + 2(h+1/T)·cos(Tγ)/(h²+γ²) +- - 4/(h²+γ²)·∫_T^∞ cos(tγ)·F_{s,X}(t)·(ht+1)/t² dt`. -/ ++ + theorem fourier_auxF (s : ℂ) {X : ℝ} (hX : 1 < X) (hs : 1/2 < s.re) {γ : ℝ} + (hγ : γ ≠ 0) : + paperFourierIntegral (auxF s X) γ +@@ -706,9 +684,7 @@ theorem fourier_auxF (s : ℂ) {X : ℝ} (hX : 1 < X) (hs : 1/2 < s.re) {γ : + + (4*s - 2)*(Real.log X : ℂ)*(γ:ℂ)*Complex.cos ((Real.log X : ℂ)*(γ:ℂ)) + + 4*(γ:ℂ)*Complex.cos ((Real.log X : ℂ)*(γ:ℂ)))) * hEE' + +-/-- FTC on `(T,∞)` for the second-derivative kernel: with `g(t) = e^{-ht}/t` and `Re h > 0`, +-`∫_T^∞ (h² + (2ht+2)/t²)·g(t) dt = (h + 1/T)·g(T)`. The integrand has antiderivative +-`-(h + 1/t)·g(t)`, which vanishes at `∞`. -/ ++ + theorem integral_Ioi_gAux_deriv2 {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) : + (∫ t in Set.Ioi T, (h^2 + (2*h*t + 2)/t^2) * (Complex.exp (-h * t) / t)) + = (h + 1/(T:ℂ)) * (Complex.exp (-h * (T:ℂ)) / (T:ℂ)) := by +@@ -734,7 +710,7 @@ theorem integral_Ioi_gAux_deriv2 {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T + rw [norm_neg] + exact norm_affine_inv_le h hT htT + +-/-- Integrability on `(T,∞)` of the remainder kernel `g(t)·(ht+1)/t²`, `g(t) = e^{-ht}/t`. -/ ++ + theorem integrableOn_gAux_mul_affine_div_sq {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) : + IntegrableOn (fun t : ℝ => + (Complex.exp (-h * t) / t) * ((h*t + 1)/t^2)) (Set.Ioi T) := by +@@ -749,9 +725,7 @@ theorem integrableOn_gAux_mul_affine_div_sq {h : ℂ} (hh : 0 < h.re) {T : ℝ} + · intro t ht + exact norm_affine_div_sq_le h hT (le_of_lt ht) + +-/-- Linearity split of the second-derivative-kernel integral into plain and remainder parts: +-with `g(t) = e^{-ht}/t`, +-`∫_T^∞ (h²+(2ht+2)/t²)·g = h²·∫_T^∞ g + 2·∫_T^∞ g·(ht+1)/t²`. -/ ++ + theorem integral_Ioi_gAux_deriv2_split {h : ℂ} (hh : 0 < h.re) {T : ℝ} (hT : 0 < T) : + (∫ t in Set.Ioi T, (h^2 + (2*h*t + 2)/t^2) * (Complex.exp (-h * t) / t)) + = h^2 * (∫ t in Set.Ioi T, Complex.exp (-h * t) / t) +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/BernoulliGeneralized.lean b/projects/FltRegularBernoulli/BernoulliRegular/BernoulliGeneralized.lean +index f626dd2f5..69ea46900 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/BernoulliGeneralized.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/BernoulliGeneralized.lean +@@ -182,7 +182,7 @@ lemma bernoulliGen_teichmuller_inverse_eq_p_sub_one_div_p_add_padicInt + ((p - 1 : ℚ_[p]) / p) + z := by + have hp : Nat.Prime p := Fact.out + have hp_gt2 : 2 < p := lt_of_le_of_ne hp.two_le (Ne.symm hp_odd) +- haveI : NeZero p := ⟨hp.ne_zero⟩ ++ have : NeZero p := ⟨hp.ne_zero⟩ + let ωZ : DirichletCharacter ℤ_[p] p := (teichmullerChar p) ^ (p - 2) + let ωQ : DirichletCharacter ℚ_[p] p := (teichmullerCharQp p) ^ (p - 2) + let S : ℤ_[p] := ∑ a : ZMod p, ωZ a * (a.val : ℤ_[p]) +@@ -206,7 +206,7 @@ lemma bernoulliGen_teichmuller_inverse_eq_p_sub_one_div_p_add_padicInt + dsimp [ωZ]; rw [MulChar.pow_apply' _ hpow_ne_zero, map_pow, teichmullerChar_apply, + toZMod_teichmuller] + have hval : PadicInt.toZMod (a.val : ℤ_[p]) = a := by simp +- rw [map_mul, hω, hval, if_neg ha] ++ rw [map_mul, hω, hval, ite_eq_right ha] + calc + a ^ (p - 2) * a = a ^ ((p - 2) + 1) := by rw [mul_comm, pow_succ'] + _ = a ^ (p - 1) := by congr; omega +@@ -215,7 +215,7 @@ lemma bernoulliGen_teichmuller_inverse_eq_p_sub_one_div_p_add_padicInt + have hsplit : + (∑ a : ZMod p, if a = 0 then 0 else 1) = + (Finset.univ.erase (0 : ZMod p)).sum (fun _ ↦ (1 : ZMod p)) := by +- rw [← Finset.sum_erase_add _ _ (Finset.mem_univ 0), if_pos rfl, add_zero] ++ rw [← Finset.sum_erase_add _ _ (Finset.mem_univ 0), ite_eq_left rfl, add_zero] + refine Finset.sum_congr rfl fun a ha ↦ ?_ + simp [(Finset.mem_erase.mp ha).1] + calc +@@ -278,7 +278,7 @@ lemma val_add_val_neg_cast [NeZero N] (a : ZMod N) : + ((a.val : R) + ((-a).val : R)) = if a = 0 then (0 : R) else (N : R) := by + rcases eq_or_ne a 0 with rfl | ha + · simp +- · rw [if_neg ha, ZMod.neg_val, if_neg ha, Nat.cast_sub (ZMod.val_lt _).le] ++ · rw [ite_eq_right ha, ZMod.neg_val, ite_eq_right ha, Nat.cast_sub (ZMod.val_lt _).le] + ring + + omit [Algebra ℚ R] in +@@ -386,7 +386,7 @@ theorem bernoulli_mem_padicInt_of_lt_sub_one {p : ℕ} [hp : Fact p.Prime] + -- `k ≥ 1`. Apply `sum_bernoulli (k + 1) = 0`. + have hkp1_lt : k + 1 < p := by omega + have h_sum := _root_.sum_bernoulli (k + 1) +- rw [if_neg (by omega : k + 1 ≠ 1), Finset.sum_range_succ] at h_sum ++ rw [ite_eq_right (by omega : k + 1 ≠ 1), Finset.sum_range_succ] at h_sum + have h_choose_k : (Nat.choose (k + 1) k : ℚ) = (k + 1 : ℚ) := by + rw [Nat.choose_succ_self_right]; push_cast; rfl + rw [h_choose_k] at h_sum +@@ -399,7 +399,7 @@ theorem bernoulli_mem_padicInt_of_lt_sub_one {p : ℕ} [hp : Fact p.Prime] + let z_of : ℕ → ℤ_[p] := fun j ↦ + if h : j < k then (hj_wit j h).choose else 0 + have hz_of : ∀ j, j < k → (bernoulli j : ℚ_[p]) = ((z_of j : ℤ_[p]) : ℚ_[p]) := by +- intro j hj; simp only [z_of, dif_pos hj]; exact (hj_wit j hj).choose_spec ++ intro j hj; simp only [z_of, dite_eq_left hj]; exact (hj_wit j hj).choose_spec + let S : ℤ_[p] := ∑ j ∈ Finset.range k, (Nat.choose (k + 1) j : ℤ_[p]) * z_of j + have hS_coe : (S : ℚ_[p]) = + ∑ j ∈ Finset.range k, (Nat.choose (k + 1) j : ℚ_[p]) * (bernoulli j : ℚ_[p]) := by +@@ -541,7 +541,7 @@ theorem bernoulli_pSubOne_add_inv_p_mem_padicInt + -- Step 1: From `sum_bernoulli p = 0` derive + -- `p * bernoulli (p - 1) + 1 = -∑ k ∈ range (p - 2), C(p, k+1) * bernoulli (k+1)`. + have h_sum := _root_.sum_bernoulli p +- rw [if_neg hp.ne_one] at h_sum ++ rw [ite_eq_right hp.ne_one] at h_sum + have hp_eq : p = (p - 1) + 1 := by omega + nth_rewrite 1 [hp_eq] at h_sum + rw [Finset.sum_range_succ] at h_sum +@@ -576,7 +576,7 @@ theorem bernoulli_pSubOne_add_inv_p_mem_padicInt + if h : k < p - 2 then (h_wit k h).choose else 0 + have hz_of : ∀ k, k < p - 2 → + ((_root_.bernoulli (k + 1) : ℚ) : ℚ_[p]) = (z_of k : ℚ_[p]) := by +- intro k hk; simp only [z_of, dif_pos hk]; exact (h_wit k hk).choose_spec ++ intro k hk; simp only [z_of, dite_eq_left hk]; exact (h_wit k hk).choose_spec + -- `c k : ℕ := C(p, k + 1) / p`, satisfying `p * c k = C(p, k + 1)` for `k < p - 2`. + let c : ℕ → ℕ := fun k ↦ Nat.choose p (k + 1) / p + have hc_eq : ∀ k, k < p - 2 → p * c k = Nat.choose p (k + 1) := fun k hk ↦ +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/Characters.lean b/projects/FltRegularBernoulli/BernoulliRegular/Characters.lean +index 356776bea..c528b5dc6 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/Characters.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/Characters.lean +@@ -221,16 +221,16 @@ Dirichlet characters mod `p` is (noncanonically) isomorphic to + `(ZMod p)ˣ`, hence cyclic of order `p - 1`. -/ + lemma dirichletCharacter_mulEquiv_zmodUnits : + Nonempty (DirichletCharacter ℤ_[p] p ≃* (ZMod p)ˣ) := by +- haveI : NeZero p := ⟨hp.1.ne_zero⟩ +- haveI : HasEnoughRootsOfUnity ℤ_[p] (Monoid.exponent (ZMod p)ˣ) := ++ have : NeZero p := ⟨hp.1.ne_zero⟩ ++ have : HasEnoughRootsOfUnity ℤ_[p] (Monoid.exponent (ZMod p)ˣ) := + exponent_zmod_units (p := p) ▸ inferInstance + exact DirichletCharacter.mulEquiv_units ℤ_[p] p + + /-- The `ℤ_[p]`-valued Dirichlet character group mod `p` has `p - 1` + elements. -/ + lemma card_dirichletCharacter : Nat.card (DirichletCharacter ℤ_[p] p) = p - 1 := by +- haveI : NeZero p := ⟨hp.1.ne_zero⟩ +- haveI : HasEnoughRootsOfUnity ℤ_[p] (Monoid.exponent (ZMod p)ˣ) := ++ have : NeZero p := ⟨hp.1.ne_zero⟩ ++ have : HasEnoughRootsOfUnity ℤ_[p] (Monoid.exponent (ZMod p)ˣ) := + exponent_zmod_units (p := p) ▸ inferInstance + rw [DirichletCharacter.card_eq_totient_of_hasEnoughRootsOfUnity, + Nat.totient_prime hp.1] +@@ -313,7 +313,7 @@ lemma teichmuller_neg_one (hp_odd : p ≠ 2) : teichmuller p (-1) = -1 := by + have h_sq : teichmuller p (-1 : ZMod p) ^ 2 = 1 := by + rw [sq, ← map_mul, neg_one_mul, neg_neg, map_one] + rcases sq_eq_one_iff.mp h_sq with h1 | h_neg +- · haveI : Fact (2 < p) := ⟨lt_of_le_of_ne hp.1.two_le (Ne.symm hp_odd)⟩ ++ · have : Fact (2 < p) := ⟨lt_of_le_of_ne hp.1.two_le (Ne.symm hp_odd)⟩ + exact absurd (by simpa using congrArg PadicInt.toZMod h1) ZMod.neg_one_ne_one + · exact h_neg + +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/Basic.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/Basic.lean +index 7733831c9..d24c5d66e 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/Basic.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/Basic.lean +@@ -54,9 +54,9 @@ prime `p`, paired with the standard additive character + `ZMod.stdAddChar : AddChar (ZMod p) ℂ`, evaluates to `-1`. -/ + theorem gaussSum_one_stdAddChar : + gaussSum (1 : DirichletCharacter ℂ p) (ZMod.stdAddChar (N := p)) = -1 := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ +- haveI : Fact (1 < p) := ⟨hp.out.one_lt⟩ +- haveI : Nontrivial (ZMod p) := ZMod.nontrivial p ++ have : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : Fact (1 < p) := ⟨hp.out.one_lt⟩ ++ have : Nontrivial (ZMod p) := ZMod.nontrivial p + -- `stdAddChar` is not the trivial additive character, so its values sum to `0`. + have h_ne : (ZMod.stdAddChar (N := p)) ≠ 1 := by + intro h +@@ -83,7 +83,7 @@ theorem gaussSum_one_stdAddChar : + MulChar.map_nonunit _ (by simp) + simp [h0] + · have hu : IsUnit a := ha.isUnit +- simp [MulChar.one_apply hu, if_neg ha] ++ simp [MulChar.one_apply hu, ite_eq_right ha] + classical + calc gaussSum (1 : DirichletCharacter ℂ p) (ZMod.stdAddChar (N := p)) + = ∑ a : ZMod p, (1 : DirichletCharacter ℂ p) a * (ZMod.stdAddChar (N := p)) a := rfl +@@ -107,7 +107,7 @@ theorem gaussSum_mul_gaussSum_inv_stdAddChar + gaussSum χ (ZMod.stdAddChar (N := p)) * + gaussSum χ⁻¹ (ZMod.stdAddChar (N := p)) = + χ (-1) * p := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + have h_prim : (ZMod.stdAddChar : AddChar (ZMod p) ℂ).IsPrimitive := + ZMod.isPrimitive_stdAddChar p + have h_card : (Fintype.card (ZMod p) : ℂ) = p := by +@@ -153,7 +153,7 @@ does not vanish as soon as their product is nontrivial. -/ + theorem jacobiSum_ne_zero_stdAddChar + {χ φ : DirichletCharacter ℂ p} (hχφ : χ * φ ≠ 1) : + jacobiSum χ φ ≠ 0 := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + by_cases hχ : χ = 1 + · subst hχ + have hφ : φ ≠ 1 := by simpa using hχφ +@@ -187,7 +187,7 @@ character factoring through `1` is the trivial character. -/ + theorem DirichletCharacter.isPrimitive_of_ne_one + {χ : DirichletCharacter ℂ p} (hχ : χ ≠ 1) : + χ.IsPrimitive := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + rw [DirichletCharacter.isPrimitive_def] + rcases (Nat.dvd_prime hp.out).mp χ.conductor_dvd_level with h | h + · exact absurd ((DirichletCharacter.factorsThrough_one_iff χ).mp +@@ -340,7 +340,7 @@ theorem dft_quadraticCharComplex_eq_gaussSum (hp₂ : p ≠ 2) (k : ZMod p) : + ZMod.dft (quadraticCharComplex p) k = + quadraticCharComplex p (-k) * + gaussSum (quadraticCharComplex p) (ZMod.stdAddChar (N := p)) := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + have hprim : (quadraticCharComplex p).IsPrimitive := + DirichletCharacter.isPrimitive_of_ne_one (p := p) + (quadraticCharComplex_ne_one (p := p) hp₂) +@@ -352,12 +352,12 @@ theorem dft_quadraticCharComplex_eq_gaussSum (hp₂ : p ≠ 2) (k : ZMod p) : + `p` at `0` and `0` away from `0`. -/ + theorem dft_const_one (k : ZMod p) : + ZMod.dft (fun _ : ZMod p ↦ (1 : ℂ)) k = if k = 0 then p else 0 := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + by_cases hk : k = 0 + · subst hk + rw [ZMod.dft_apply_zero] + simp +- · rw [ZMod.dft_apply, if_neg hk] ++ · rw [ZMod.dft_apply, ite_eq_right hk] + have hne : ((ZMod.stdAddChar : AddChar (ZMod p) ℂ).mulShift (-k)) ≠ 1 := by + intro hshift + have heval : (ZMod.stdAddChar (N := p)) (-k) = 1 := by +@@ -466,7 +466,7 @@ theorem conj_gaussSum_quadraticCharComplex_eq_neg_self_of_mod_four_eq_three + theorem gaussSum_quadraticCharComplex_sq (hp₂ : p ≠ 2) : + gaussSum (quadraticCharComplex p) (ZMod.stdAddChar (N := p)) ^ 2 = + quadraticCharComplex p (-1) * p := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + simpa [ZMod.card] using + gaussSum_sq (χ := quadraticCharComplex p) + (quadraticCharComplex_ne_one (p := p) hp₂) +@@ -579,7 +579,7 @@ character `χ : DirichletCharacter ℂ p`. Uses `χ^(p-1) = 1` + membership in + `Algebra.adjoin ℤ {μ_{p-1}}`, which is contained in the integral closure. -/ + theorem DirichletCharacter.isIntegral_apply (χ : DirichletCharacter ℂ p) (a : ZMod p) : + IsIntegral ℤ (χ a) := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + have hp_sub : 0 < p - 1 := by have := hp.out.one_lt; omega + set μ : ℂ := Complex.exp (2 * Real.pi * Complex.I / (p - 1 : ℕ)) + have hμ : IsPrimitiveRoot μ (p - 1) := +@@ -597,7 +597,7 @@ theorem DirichletCharacter.isIntegral_apply (χ : DirichletCharacter ℂ p) (a : + integral over `ℤ` (each is a `p`-th root of unity). -/ + theorem ZMod.isIntegral_stdAddChar (a : ZMod p) : + IsIntegral ℤ ((ZMod.stdAddChar : AddChar (ZMod p) ℂ) a) := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + have hx_pow : ((ZMod.stdAddChar : AddChar (ZMod p) ℂ) a) ^ p = 1 := by + rw [← AddChar.map_nsmul_eq_pow, show ((p : ℕ) • a : ZMod p) = 0 from by + rw [show ((p : ℕ) • a : ZMod p) = (p : ZMod p) * a from by ring, +@@ -636,7 +636,7 @@ theorem gaussSum_mem_algebraAdjoin_stickelbergerComplexRoot + (χ : DirichletCharacter ℂ p) : + gaussSum χ (ZMod.stdAddChar : AddChar (ZMod p) ℂ) ∈ + Algebra.adjoin ℤ ({stickelbergerComplexRoot p} : Set ℂ) := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + have hp_one_lt : 1 < p := hp.out.one_lt + have hp_sub : 0 < p - 1 := by omega + have hp_pos : 0 < p := hp.out.pos +@@ -665,7 +665,7 @@ theorem gaussSum_mem_algebraAdjoin_stickelbergerComplexRoot + have h_pow : χ ^ (p - 1) = 1 := by + have h := MulChar.pow_card_eq_one χ (M := ZMod p) + rwa [ZMod.card_units_eq_totient, Nat.totient_prime hp.out] at h +- haveI : NeZero (p - 1) := ⟨hp_sub.ne'⟩ ++ have : NeZero (p - 1) := ⟨hp_sub.ne'⟩ + have h_mem : χ a ∈ Algebra.adjoin ℤ ({ζ ^ p} : Set ℂ) := + MulChar.apply_mem_algebraAdjoin_of_pow_eq_one h_pow hζ_pm1 a + have h_sub : Algebra.adjoin ℤ ({ζ ^ p} : Set ℂ) ≤ Algebra.adjoin ℤ ({ζ} : Set ℂ) := by +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BlockDeterminant.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BlockDeterminant.lean +index c3148c6ba..5764b48d9 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BlockDeterminant.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BlockDeterminant.lean +@@ -280,7 +280,7 @@ theorem toMatrix_deltaZeroConstOneDirichletCharacterBasis_normalizedDft : + simp [Module.Basis.repr_self, hij] + simpa only [Matrix.mul_diagonal, PEquiv.toMatrix_apply, Equiv.toPEquiv_apply, + Equiv.Perm.coe_inv, Option.mem_def, Option.some.injEq, ite_mul, one_mul, zero_mul, hneq', +- if_false] ++ ite_false] + using hsingle + + /-- The determinant of that monomial matrix: the sign of the permutation times the +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BranchChoice.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BranchChoice.lean +index 34468899d..419594284 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BranchChoice.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/BranchChoice.lean +@@ -50,7 +50,7 @@ theorem card_even_eq_card_odd_characters (hp₂ : p ≠ 2) : + simp only [E, O, Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and, iff_true] + exact DirichletCharacter.even_or_odd χ + have hneg_ne_one : (-1 : ZMod p) ≠ 1 := by +- haveI : Fact (2 < p) := ⟨lt_of_le_of_ne hp.out.two_le (Ne.symm hp₂)⟩ ++ have : Fact (2 < p) := ⟨lt_of_le_of_ne hp.out.two_le (Ne.symm hp₂)⟩ + exact ZMod.neg_one_ne_one + have hsum_zero : + ∑ χ : DirichletCharacter ℂ p, χ (-1 : ZMod p) = 0 := +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Operator.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Operator.lean +index e01362db2..cdfae2bc9 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Operator.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Operator.lean +@@ -172,7 +172,7 @@ noncomputable def zmodEquivFin : ZMod p ≃ Fin p := + + theorem zmodEquivFin_symm_apply (i : Fin p) : + (zmodEquivFin (p := p)).symm i = (i : ZMod p) := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + change ZMod.finEquiv p i = (i : ZMod p) + cases p with + | zero => +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Trace.lean b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Trace.lean +index a5de9475f..f41b89788 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Trace.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/GaussSum/SignInvariant/Trace.lean +@@ -49,12 +49,12 @@ theorem dft_deltaZero_eq_constOne : + /-- The DFT of the constant-one function is concentrated at `0`. -/ + theorem dft_constOne (k : ZMod p) : + ZMod.dft (fun _ : ZMod p ↦ (1 : ℂ)) k = if k = 0 then p else 0 := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + by_cases hk : k = 0 + · subst hk + rw [ZMod.dft_apply_zero] + simp +- · rw [ZMod.dft_apply, if_neg hk] ++ · rw [ZMod.dft_apply, ite_eq_right hk] + have hne : ((ZMod.stdAddChar : AddChar (ZMod p) ℂ).mulShift (-k)) ≠ 1 := by + intro hshift + have heval : (ZMod.stdAddChar (N := p)) (-k) = 1 := by +@@ -149,7 +149,7 @@ theorem dft_eq_scalar_smul_inv_character {χ : DirichletCharacter ℂ p} + ZMod.dft χ = + (χ⁻¹ (-1) * gaussSum χ (ZMod.stdAddChar (N := p))) • + ((χ⁻¹ : DirichletCharacter ℂ p) : ZMod p → ℂ) := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + have hprim : χ.IsPrimitive := DirichletCharacter.isPrimitive_of_ne_one (p := p) hχ + ext k + simp only [Pi.smul_apply, smul_eq_mul] +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Defs.lean b/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Defs.lean +index e65342489..e45157576 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Defs.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Defs.lean +@@ -64,7 +64,7 @@ theorem odd_LFunction_one_eq_oddLValueRhs_of_LFunction_inv_zero + (Or.inr hp.out.ne_one), hχinv_odd.gammaFactor_def] + simp + have hfe := DirichletCharacter.IsPrimitive.completedLFunction_one_sub (χ := χ) hχ_prim (0 : ℂ) +- rw [DirichletCharacter.rootNumber, if_neg hχ_odd.not_even, pow_one, ++ rw [DirichletCharacter.rootNumber, ite_eq_right hχ_odd.not_even, pow_one, + ← mul_comm_div, ← mul_comm_div, ← Complex.cpow_sub _ _ (by exact_mod_cast hp.out.ne_zero), + sub_sub, add_halves, hL0, hχ0] at hfe + have hfe' : DirichletCharacter.completedLFunction χ 1 = +diff --git a/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Even.lean b/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Even.lean +index da64fd5da..f1e07c897 100644 +--- a/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Even.lean ++++ b/projects/FltRegularBernoulli/BernoulliRegular/LValueAtOne/Even.lean +@@ -96,7 +96,7 @@ private lemma LFunction_dft_inv_eq_gaussSum_mul_LFunction + {χ : DirichletCharacter ℂ p} (hχ_even : χ.Even) (hχinv_prim : (χ⁻¹).IsPrimitive) : + ZMod.LFunction (ZMod.dft (fun a : ZMod p => χ⁻¹ a)) 1 = + gaussSum χ⁻¹ (ZMod.stdAddChar (N := p)) * ZMod.LFunction χ 1 := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + have hft : + ZMod.dft (fun a : ZMod p => χ⁻¹ a) = fun a : ZMod p => + gaussSum χ⁻¹ (ZMod.stdAddChar (N := p)) * χ a := by +@@ -152,7 +152,7 @@ private lemma sum_mulChar_cosZeta_eq_neg_evenLValueLogSum + {χ : DirichletCharacter ℂ p} (hχinv_zero : χ⁻¹ 0 = 0) : + ∑ a : ZMod p, χ⁻¹ a * HurwitzZeta.cosZeta (ZMod.toAddCircle a) 1 = + -evenLValueLogSum p χ := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + simp only [evenLValueLogSum] + calc + ∑ a : ZMod p, χ⁻¹ a * HurwitzZeta.cosZeta (ZMod.toAddCircle a) 1 +@@ -176,7 +176,7 @@ theorem even_LFunction_one_eq_evenLValueRhs + {χ : DirichletCharacter ℂ p} (hχ_prim : χ.IsPrimitive) (hχ_even : χ.Even) + (hχ_ne_one : χ ≠ 1) : + DirichletCharacter.LFunction χ 1 = evenLValueRhs p χ := by +- haveI : NeZero p := ⟨hp.out.ne_zero⟩ ++ have : NeZero p := ⟨hp.out.ne_zero⟩ + change ZMod.LFunction (fun a : ZMod p => χ a) 1 = evenLValueRhs p χ + have hχinv_even : (χ⁻¹).Even := by + rw [DirichletCharacter.Even] at hχ_even ⊢ +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/CharP.lean b/projects/HasseWeil/HasseWeil/FormalGroup/CharP.lean +index f9dac12ed..b5845ada0 100644 +--- a/projects/HasseWeil/HasseWeil/FormalGroup/CharP.lean ++++ b/projects/HasseWeil/HasseWeil/FormalGroup/CharP.lean +@@ -61,7 +61,7 @@ private theorem exists_expand_of_coeff_vanishing (p : ℕ) (hp : p ≠ 0) + vanishes unless `p ∣ n` (or `n = 0`). -/ + private theorem coeff_eq_zero_of_derivative_eq_zero_charP {p : ℕ} + [Fact p.Prime] [CharP R p] {f : PowerSeries R} +- (hf : PowerSeries.derivative R f = 0) ++ (hf : PowerSeries.derivative (R := R) f = 0) + (n : ℕ) (hpn : ¬ p ∣ n) : + PowerSeries.coeff n f = 0 := by + -- `n ≠ 0` since `p ∣ 0`; write `n = m + 1`. +@@ -101,7 +101,7 @@ theorem FormalGroup.mulByP_exists_expand (F : FormalGroup R) (p : ℕ) + apply exists_expand_of_coeff_vanishing p hp_prime.out.ne_zero + intro n hpn + -- `derivative [p] = 0`, from the chain rule and `[p] = 0` in characteristic `p`. +- have hder : PowerSeries.derivative R (F.mulByNatHom p).toSeries = 0 := by ++ have hder : PowerSeries.derivative (R := R) (F.mulByNatHom p).toSeries = 0 := by + have chain := FormalGroupHom.invariantDifferential_chain (F.mulByNatHom p) + have hp_zero : + PowerSeries.C (PowerSeries.coeff 1 (F.mulByNatHom p).toSeries) * +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/Differential.lean b/projects/HasseWeil/HasseWeil/FormalGroup/Differential.lean +index 655b8afa6..7d00d2a24 100644 +--- a/projects/HasseWeil/HasseWeil/FormalGroup/Differential.lean ++++ b/projects/HasseWeil/HasseWeil/FormalGroup/Differential.lean +@@ -193,7 +193,7 @@ private theorem coeff_subst_runit_eq (n : ℕ) + · simp only [hd0, pow_zero, one_mul, MvPowerSeries.coeff_X_pow] + have hne : d 1 ≠ n := + fun h ↦ hd (Finsupp.ext (fun i ↦ by fin_cases i <;> simp [*, Finsupp.single_eq_same])) +- rw [if_neg (fun h ↦ hne ((Finsupp.single_injective (1 : Fin 2)).eq_iff.mp h).symm)] ++ rw [ite_eq_right (fun h ↦ hne ((Finsupp.single_injective (1 : Fin 2)).eq_iff.mp h).symm)] + · rw [zero_pow hd0, zero_mul, map_zero] + + -- Helper: coeff at (single 1 m) of F.toSeries equals [m = 1] (from runit: F(0,Y)=Y) +@@ -234,11 +234,11 @@ private theorem coeff_one_pow {f : PowerSeries R} (hf : PowerSeries.constantCoef + PowerSeries.coeff 1 (f ^ d) = if d = 1 then PowerSeries.coeff 1 f else 0 := by + by_cases hd : d = 1 + · simp [hd] +- · rw [if_neg hd] ++ · rw [ite_eq_right hd] + rcases d with _ | _ | d + · simp only [pow_zero] + show PowerSeries.coeff 1 (1 : PowerSeries R) = 0 +- rw [PowerSeries.coeff_one, if_neg one_ne_zero] ++ rw [PowerSeries.coeff_one, ite_eq_right one_ne_zero] + · omega + · exact coeff_one_pow_eq_zero hf (by omega) + +@@ -258,12 +258,12 @@ private theorem coeff_subst_X0 (g : PowerSeries R) (a b : ℕ) : + · simp [MvPowerSeries.coeff_X_pow, smul_eq_mul] + · intro d hd + simp only [MvPowerSeries.coeff_X_pow, smul_eq_mul] +- rw [if_neg (fun h ↦ hd ((Finsupp.single_injective (0 : Fin 2)).eq_iff.mp h).symm), ++ rw [ite_eq_right (fun h ↦ hd ((Finsupp.single_injective (0 : Fin 2)).eq_iff.mp h).symm), + mul_zero] +- · rw [if_neg hb] ++ · rw [ite_eq_right hb] + apply finsum_eq_zero_of_forall_eq_zero + intro d +- rw [MvPowerSeries.coeff_X_pow, if_neg] ++ rw [MvPowerSeries.coeff_X_pow, ite_eq_right] + · exact smul_zero _ + · intro h + have := DFunLike.congr_fun h 1 +@@ -284,12 +284,12 @@ private theorem coeff_subst_X1 (g : PowerSeries R) (a b : ℕ) : + · simp [MvPowerSeries.coeff_X_pow, smul_eq_mul] + · intro d hd + simp only [MvPowerSeries.coeff_X_pow, smul_eq_mul] +- rw [if_neg (fun h ↦ hd ((Finsupp.single_injective (1 : Fin 2)).eq_iff.mp h).symm), ++ rw [ite_eq_right (fun h ↦ hd ((Finsupp.single_injective (1 : Fin 2)).eq_iff.mp h).symm), + mul_zero] +- · rw [if_neg hab] ++ · rw [ite_eq_right hab] + apply finsum_eq_zero_of_forall_eq_zero + intro d +- rw [MvPowerSeries.coeff_X_pow, if_neg] ++ rw [MvPowerSeries.coeff_X_pow, ite_eq_right] + · exact smul_zero _ + · intro h + have := DFunLike.congr_fun h 0 +@@ -333,7 +333,7 @@ private lemma coeff_subst_X0_X1_mul_eq_zero_of_ne (g : PowerSeries R) (d0 d1 n : + from finsupp_fin2_decompose e2] + rw [coeff_subst_X0, coeff_subst_X1] + by_cases h1 : e1 1 = 0 +- · rw [if_pos h1] ++ · rw [ite_eq_left h1] + by_cases h2 : e2 0 = 0 + · -- Both e1 1 = 0 and e2 0 = 0: forces (e1, e2) = (single 0 1, single 1 n) + exfalso; apply hne +@@ -348,8 +348,8 @@ private lemma coeff_subst_X0_X1_mul_eq_zero_of_ne (g : PowerSeries R) (d0 d1 n : + rw [finsupp_fin2_decompose e1, h1, he10]; simp + · show e2 = Finsupp.single 1 n + rw [finsupp_fin2_decompose e2, h2, he21]; simp +- · rw [if_neg h2, mul_zero] +- · rw [if_neg h1, zero_mul] ++ · rw [ite_eq_right h2, mul_zero] ++ · rw [ite_eq_right h1, zero_mul] + + -- Orthogonality: coeff_{(1,n)} (f(X_0)^d0 * f(X_1)^d1) = coeff_1(f^d0) * coeff_n(f^d1) + private theorem coeff_10_prod_orthogonal (g : PowerSeries R) (d0 d1 n : ℕ) : +@@ -424,15 +424,15 @@ private lemma finsum_fin2_reduce_full (p : (Fin 2 →₀ ℕ) → R) : + Set.indicator (Set.range ι) (fun d ↦ if d 0 = 1 then p d else 0) d := by + intro d; classical rw [Set.indicator_apply] + by_cases hd : d ∈ Set.range ι +- · rw [if_pos hd] +- · rw [if_neg hd, if_neg (mt (hmem d).mpr hd)] ++ · rw [ite_eq_left hd] ++ · rw [ite_eq_right hd, ite_eq_right (mt (hmem d).mpr hd)] + conv_lhs => arg 1; ext d; rw [key d] + rw [← finsum_mem_def, ← finsum_subtype_eq_finsum_cond (· ∈ Set.range ι), + ← finsum_comp_equiv (Equiv.ofInjective ι hinj)] + congr 1; ext k + show (if (ι k : Fin 2 →₀ ℕ) 0 = 1 then p (ι k) else 0) = + p (Finsupp.single 0 1 + Finsupp.single 1 k) +- rw [if_pos (hι0 k)] ++ rw [ite_eq_left (hι0 k)] + + -- Helper: c * finsum f = finsum (c * f ·) when f has finite support. + private lemma mul_finsum_of_support_subset {α : Type*} (c : R) (f : α → R) +@@ -503,11 +503,11 @@ private theorem antidiag_term_vanish (F : FormalGroup R) (d n : ℕ) + rcases Nat.eq_zero_or_pos (e1 0) with he10 | he10 + · have he1eq : e1 = Finsupp.single 1 (e1 1) := Finsupp.ext fun i ↦ by + fin_cases i <;> simp_all [Finsupp.single_eq_same] +- rw [he1eq, coeff_single1_F, if_neg (fun h ↦ hA ⟨he10, h⟩), zero_mul] ++ rw [he1eq, coeff_single1_F, ite_eq_right (fun h ↦ hA ⟨he10, h⟩), zero_mul] + · have he20 : e2 0 = 0 := by omega + have he2eq : e2 = Finsupp.single 1 (e2 1) := Finsupp.ext fun i ↦ by + fin_cases i <;> simp_all [Finsupp.single_eq_same] +- rw [he2eq, coeff_runit_pow, if_neg (fun h ↦ hB ⟨by omega, h⟩), mul_zero] ++ rw [he2eq, coeff_runit_pow, ite_eq_right (fun h ↦ hB ⟨by omega, h⟩), mul_zero] + + -- Sub-lemma: the antidiagonal sum for `coeff_{(1,n)} (F^d * F)` collapses to the two + -- surviving terms — pair A `(single 1 1, single 0 1 + single 1 (n-1))` and pair B +@@ -661,9 +661,9 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : + induction d with + | zero => + intro n +- simp only [pow_zero, Nat.zero_le, le_add_iff_nonneg_left, if_true, ++ simp only [pow_zero, Nat.zero_le, le_add_iff_nonneg_left, ite_true, + Nat.cast_zero, zero_mul, MvPowerSeries.coeff_one] +- rw [if_neg]; intro h ++ rw [ite_eq_right]; intro h + exact absurd (DFunLike.congr_fun h 0) (by + simp [Finsupp.add_apply, Finsupp.single_eq_same]) + | succ d ih => +@@ -671,7 +671,7 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : + -- For d+1 > n+1, use direct vanishing from nilpotent coefficient + by_cases hdn : d + 1 ≤ n + 1 + · -- d + 1 ≤ n + 1, i.e., d ≤ n +- rw [if_pos hdn] ++ rw [ite_eq_left hdn] + have hdn' : d ≤ n := by omega + rw [pow_succ, mul_comm, MvPowerSeries.coeff_mul] + -- The antidiag sum: Σ coeff_e1(F) * coeff_e2(F^d) +@@ -703,7 +703,7 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : + (Finsupp.single (0 : Fin 2) 1 + Finsupp.single (1 : Fin 2) (n - 1)) + (F.toSeries ^ d) = + (d : R) * PowerSeries.coeff (n - d) F.dX_at_zero := by +- rw [coeff_single1_F, if_pos rfl, one_mul, ih, if_pos (by omega : d ≤ n - 1 + 1)] ++ rw [coeff_single1_F, ite_eq_left rfl, one_mul, ih, ite_eq_left (by omega : d ≤ n - 1 + 1)] + have : n - 1 + 1 - d = n - d := by omega + rw [this] + -- Compute pair B value +@@ -713,7 +713,7 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : + F.toSeries * + MvPowerSeries.coeff (Finsupp.single (1 : Fin 2) d) (F.toSeries ^ d) = + PowerSeries.coeff (n - d) F.dX_at_zero := by +- rw [coeff_runit_pow, if_pos rfl, mul_one, FormalGroup.dX_at_zero, ++ rw [coeff_runit_pow, ite_eq_left rfl, mul_one, FormalGroup.dX_at_zero, + PowerSeries.coeff_mk] + -- The sum = A_val + B_val = (d+1) * coeff_{n-d} dxF + -- (the split into the two surviving terms is `coeff_10_FG_pow_antidiag_split`) +@@ -725,7 +725,7 @@ private theorem coeff_10_FG_pow (F : FormalGroup R) : + · -- A_val + B_val = (d+1) * coeff_{n+1-(d+1)} dxF + rw [show n + 1 - (d + 1) = n - d from by omega]; push_cast; ring + · -- d + 1 > n + 1: coeff vanishes by nilpotent degree bound +- rw [if_neg hdn] ++ rw [ite_eq_right hdn] + exact coeff_10_FG_pow_succ_vanish F hdn + + /-- The explicit `Finset` sum that both sides of `coeff_10_lhs` reduce to: +@@ -770,7 +770,7 @@ private theorem coeff_10_subst_eq_sum (F G : FormalGroup R) (f : FormalGroupHom + rw [Function.mem_support, ne_eq] at hd + rw [Finset.mem_coe, Finset.mem_range] + by_contra h; push Not at h +- exact hd (if_neg (by omega : ¬(d ≤ n + 1))))] ++ exact hd (ite_eq_right (by omega : ¬(d ≤ n + 1))))] + -- Kill the d = 0 term (it contributes 0 since d = 0 gives 0 * ... = 0) + rw [Finset.sum_range_succ' (n := n + 1)] + simp only [Nat.cast_zero, zero_mul, Nat.sub_zero, le_add_iff_nonneg_left, +@@ -784,7 +784,7 @@ private theorem coeff_10_subst_eq_sum (F G : FormalGroup R) (f : FormalGroupHom + (↑(k + 1) : R) * PowerSeries.coeff (k + 1) f.toSeries * + PowerSeries.coeff (n - k) F.dX_at_zero := by + intro k hk; rw [Finset.mem_range] at hk +- rw [if_pos (by omega : k + 1 ≤ n + 1)] ++ rw [ite_eq_left (by omega : k + 1 ≤ n + 1)] + have : n + 1 - (k + 1) = n - k := by omega + rw [this] + rw [Finset.sum_congr rfl hsimp] +@@ -795,7 +795,7 @@ unfolds (via `coeff_mul` and `coeff_derivative`) to the explicit range sum + bijection `k ↦ (k, n - k)`. -/ + private theorem coeff_derivative_mul_dX_eq_sum (F G : FormalGroup R) + (f : FormalGroupHom F G) (n : ℕ) : +- PowerSeries.coeff n (PowerSeries.derivative R f.toSeries * F.dX_at_zero) = ++ PowerSeries.coeff n (PowerSeries.derivative (R := R) f.toSeries * F.dX_at_zero) = + coeff_10_sum F G f n := by + rw [coeff_10_sum] + -- Expand the RHS via `coeff_mul` and `coeff_derivative`, then match the range sum against +@@ -824,11 +824,11 @@ private theorem coeff_derivative_mul_dX_eq_sum (F G : FormalGroup R) + private theorem coeff_10_lhs (F G : FormalGroup R) (f : FormalGroupHom F G) (n : ℕ) : + MvPowerSeries.coeff (Finsupp.single (0 : Fin 2) 1 + Finsupp.single (1 : Fin 2) n) + (PowerSeries.subst F.toSeries f.toSeries) = +- PowerSeries.coeff n (PowerSeries.derivative R f.toSeries * F.dX_at_zero) := ++ PowerSeries.coeff n (PowerSeries.derivative (R := R) f.toSeries * F.dX_at_zero) := + (coeff_10_subst_eq_sum F G f n).trans (coeff_derivative_mul_dX_eq_sum F G f n).symm + + theorem FormalGroup.dX_at_zero_chain (f : FormalGroupHom F G) : +- (PowerSeries.derivative R f.toSeries) * F.dX_at_zero = ++ (PowerSeries.derivative (R := R) f.toSeries) * F.dX_at_zero = + PowerSeries.C (PowerSeries.coeff 1 f.toSeries) * + PowerSeries.subst f.toSeries G.dX_at_zero := by + ext n +@@ -882,14 +882,14 @@ invariant differential. + Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.4, Corollary 4.3. -/ + theorem FormalGroup.invariantDiff_chain (f : FormalGroupHom F G) : + PowerSeries.subst f.toSeries G.invariantDiff * +- (PowerSeries.derivative R f.toSeries) = ++ (PowerSeries.derivative (R := R) f.toSeries) = + PowerSeries.C (PowerSeries.coeff 1 f.toSeries) * F.invariantDiff := by + -- Set up abbreviations to ensure all terms are in PowerSeries R, avoiding + -- MvPowerSeries Unit R / PowerSeries R defeq issues with rw/simp. + set c₁ : PowerSeries R := PowerSeries.C (PowerSeries.coeff 1 f.toSeries) + set ωG' : PowerSeries R := PowerSeries.subst f.toSeries G.invariantDiff + set dG' : PowerSeries R := PowerSeries.subst f.toSeries G.dX_at_zero +- set f' : PowerSeries R := PowerSeries.derivative R f.toSeries ++ set f' : PowerSeries R := PowerSeries.derivative (R := R) f.toSeries + set ωF : PowerSeries R := F.invariantDiff + set dF : PowerSeries R := F.dX_at_zero + -- Two ingredients: the `dX_at_zero` chain identity `f' * dF = c₁ * dG'` and the +@@ -1207,7 +1207,7 @@ private lemma coeff_prod_subst_vec_zero_X0 (d e : Fin 2 →₀ ℕ) : + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_zero] + by_cases hd0 : d 0 = 0 + · simp [hd0] +- · rw [zero_pow hd0, zero_mul, map_zero, if_neg hd0] ++ · rw [zero_pow hd0, zero_mul, map_zero, ite_eq_right hd0] + + /-- Reindexing: a finsum over `d : Fin 2 →₀ ℕ` of a term that vanishes unless + `d 0 = 0` collapses to a finsum over `n : ℕ` along `n ↦ Finsupp.single 1 n`, the +@@ -1434,4 +1434,4 @@ theorem invariantDiff_translation (F : FormalGroup R) : + + end FormalGroup + +-end HasseWeil.FormalGroup +\ No newline at end of file ++end HasseWeil.FormalGroup +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/EvalGroup.lean b/projects/HasseWeil/HasseWeil/FormalGroup/EvalGroup.lean +index 5d7732dc9..9c4831e16 100644 +--- a/projects/HasseWeil/HasseWeil/FormalGroup/EvalGroup.lean ++++ b/projects/HasseWeil/HasseWeil/FormalGroup/EvalGroup.lean +@@ -9,49 +9,6 @@ import Mathlib.Algebra.Group.MinimalAxioms + import Mathlib.RingTheory.AdicCompletion.Topology + import Mathlib.RingTheory.PowerSeries.Evaluation + +-/-! +-# The group `F(M)` associated to a formal group over a complete local ring +-# (Silverman IV.3, ticket T-IV-3-001) +- +-Let `R` be a commutative local ring with maximal ideal `M = IsLocalRing.maximalIdeal R`, +-equipped with the `M`-adic topology (so that it is both a topological ring with +-a linear topology, a uniform ring, etc.), and assume moreover that it is +-`M`-adically complete (so `R` is Hausdorff and complete for this topology). +- +-For a formal group law `F(X, Y) ∈ R[[X, Y]]`, the set `M` acquires a structure of +-an abelian group via +- `x +_F y := F(x, y) = MvPowerSeries.eval₂ (RingHom.id R) ![x, y] F.toSeries`. +- +-The convergence of the power series `F(x, y)` is guaranteed by `x, y ∈ M` (they are +-topologically nilpotent, as `M^n → 0` in the adic topology) and by completeness. +- +-## Main definitions +- +-* `HasseWeil.FormalGroup.FormalGroup.evalAdd F x y` — the binary operation +- `x +_F y` on `M`, returning an element of `R`. +-* `HasseWeil.FormalGroup.FormalGroup.evalAdd_mem F x y` — the operation is closed +- in `M`, i.e. `evalAdd F x y ∈ M`. +-* `HasseWeil.FormalGroup.FormalGroup.evalNeg F x` — the formal negation +- `-_F x := i(x)` for `x ∈ M`, where `i = F.inverse` is the formal inverse +- power series. +-* `HasseWeil.FormalGroup.FormalGroup.evalNeg_mem F x` — the negation is closed +- in `M`, i.e. `evalNeg F x ∈ M`. +- +-The formal-group axioms induce the group laws for `evalAdd`; the resulting +-operation and `evalNeg` are bundled as an `AddCommGroup` on `F.EvalGroup hAdic`. +-The substitution bridge used for associativity and inverses is proved for the +-`M`-adic uniformity, where `MvPowerSeries.eval₂_subst` does not apply directly. +- +-## Assumptions on `R` +- +-We require `R` to be a `CommRing`, `IsLocalRing`, equipped with topology and uniform +-space structure coming from the `M`-adic topology, and `M`-adically complete. +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*], IV.3 (Definition of the group +- `F(M)`, p. 122). +--/ + + set_option linter.dupNamespace false + +@@ -127,10 +84,8 @@ noncomputable def FormalGroup.evalAdd (F : FormalGroup R) + /-! ### Closure under `+_F`: `evalAdd F x y ∈ M` -/ + + omit [IsUniformAddGroup R] [IsLinearTopology R R] [T2Space R] [CompleteSpace R] in +-/-- The maximal ideal is closed in the `M`-adic topology. + +-`M` is open (as the basis of neighborhoods of 0 at level 1, i.e. `M^1 = M`), +-hence closed. -/ ++ + lemma maximalIdeal_isClosed + (hAdic : IsAdic (IsLocalRing.maximalIdeal R)) : + IsClosed (IsLocalRing.maximalIdeal R : Set R) := by +@@ -296,7 +251,7 @@ private lemma coeff_swap_diag (d : Fin 2 →₀ ℕ) : + ((MvPowerSeries.X (1 : Fin 2) : MvPowerSeries (Fin 2) R) ^ ((finsupp_swap d) 0) * + (MvPowerSeries.X 0) ^ ((finsupp_swap d) 1)) = 1 := by + rw [coeff_X_one_pow_mul_X_zero_pow, finsupp_swap_apply_zero, finsupp_swap_apply_one, +- if_pos] ++ ite_eq_left] + ext i; fin_cases i <;> simp + + omit [IsLocalRing R] [UniformSpace R] [IsUniformAddGroup R] [IsTopologicalRing R] +@@ -450,7 +405,7 @@ private lemma coeff_single_X_pow_mul_zero_pow_of_ne + rw [show ((MvPowerSeries.X (0 : Fin 2) : MvPowerSeries (Fin 2) R) ^ (d 0)) = + MvPowerSeries.monomial (R := R) (Finsupp.single 0 (d 0)) 1 from by + rw [MvPowerSeries.X_pow_eq]] +- rw [MvPowerSeries.coeff_monomial, if_neg] ++ rw [MvPowerSeries.coeff_monomial, ite_eq_right] + intro heq + apply hdj + have := DFunLike.congr_fun heq 0 +@@ -528,9 +483,9 @@ private lemma evalAdd_zero_right_term_eq (F : FormalGroup R) + rw [hd_single, HasseWeil.FG.FormalGroup.coeff_10] + rw [show (Finsupp.single (0 : Fin 2) 1) 0 = 1 from by + simp] +- rw [pow_one, one_mul, if_pos rfl] ++ rw [pow_one, one_mul, ite_eq_left rfl] + · +- rw [hdeq, F.coeff_j0_of_ne_one (d 0) hd0, zero_mul, if_neg] ++ rw [hdeq, F.coeff_j0_of_ne_one (d 0) hd0, zero_mul, ite_eq_right] + intro hcontra + apply hd0 + have := DFunLike.congr_fun hcontra 0 +@@ -538,7 +493,7 @@ private lemma evalAdd_zero_right_term_eq (F : FormalGroup R) + · + rw [Finsupp.prod_fintype _ _ (fun i ↦ pow_zero _), Fin.prod_univ_two, + Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_zero, +- zero_pow hd1, mul_zero, mul_zero, if_neg] ++ zero_pow hd1, mul_zero, mul_zero, ite_eq_right] + intro hcontra + apply hd1 + have := DFunLike.congr_fun hcontra 1 +@@ -585,7 +540,7 @@ private lemma coeff_single_zero_pow_mul_X_pow_of_ne + rw [show ((MvPowerSeries.X (1 : Fin 2) : MvPowerSeries (Fin 2) R) ^ (d 1)) = + MvPowerSeries.monomial (R := R) (Finsupp.single 1 (d 1)) 1 from by + rw [MvPowerSeries.X_pow_eq]] +- rw [MvPowerSeries.coeff_monomial, if_neg] ++ rw [MvPowerSeries.coeff_monomial, ite_eq_right] + intro heq + apply hdj + have := DFunLike.congr_fun heq 1 +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroup.lean b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroup.lean +index 2febf6bff..953c00c2d 100644 +--- a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroup.lean ++++ b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroup.lean +@@ -197,16 +197,16 @@ theorem conv₂_truncate (n : ℕ) : + (if n - i < n then formalW_coeff W (n - i) else 0) = + formalW_coeff W i * formalW_coeff W (n - i) + rcases lt_or_eq_of_le hi with h_lt | h_eq +- · rw [if_pos h_lt] ++ · rw [ite_eq_left h_lt] + by_cases h_ni : n - i < n +- · rw [if_pos h_ni] ++ · rw [ite_eq_left h_ni] + · have h_i_eq_zero : i = 0 := by omega + subst h_i_eq_zero +- rw [if_neg h_ni] ++ rw [ite_eq_right h_ni] + rw [show formalW_coeff W 0 = 0 from formalW_coeff_zero W] + ring + · subst h_eq +- rw [if_neg (by omega : ¬ (i < i))] ++ rw [ite_eq_right (by omega : ¬ (i < i))] + rw [show i - i = 0 from Nat.sub_self i] + rw [show formalW_coeff W 0 = 0 from formalW_coeff_zero W] + ring +@@ -223,9 +223,9 @@ theorem conv₂_truncate' (n : ℕ) (hn : 1 ≤ n) : + (if n - 1 - i < n then formalW_coeff W (n - 1 - i) else 0) = + formalW_coeff W i * formalW_coeff W (n - 1 - i) + have h_i_lt_n : i < n := by omega +- rw [if_pos h_i_lt_n] ++ rw [ite_eq_left h_i_lt_n] + have h_ni_lt_n : n - 1 - i < n := by omega +- rw [if_pos h_ni_lt_n] ++ rw [ite_eq_left h_ni_lt_n] + + /-- `coeff n (formalW W * formalW W) = conv₂ (formalW_coeff W) n`. -/ + theorem coeff_formalW_sq (n : ℕ) : +@@ -287,19 +287,19 @@ private theorem conv₃_truncate_term {n i j : ℕ} (hi : i ≤ n) (hj : j ≤ n + (if n - i - j < n then formalW_coeff W (n - i - j) else 0) = + formalW_coeff W i * formalW_coeff W j * formalW_coeff W (n - i - j) := by + rcases lt_or_eq_of_le hi with h_i_lt | h_i_eq +- · rw [if_pos h_i_lt] ++ · rw [ite_eq_left h_i_lt] + rcases lt_or_eq_of_le hj with h_j_lt | h_j_eq + · -- j ≤ n - i and j < n - i, so j < n + have h_j_lt_n : j < n := by omega +- rw [if_pos h_j_lt_n] ++ rw [ite_eq_left h_j_lt_n] + by_cases h_k_lt_n : n - i - j < n +- · rw [if_pos h_k_lt_n] ++ · rw [ite_eq_left h_k_lt_n] + · -- n - i - j ≥ n means i + j = 0 + have h_i_eq_zero : i = 0 := by omega + have h_j_eq_zero : j = 0 := by omega + subst h_i_eq_zero + subst h_j_eq_zero +- rw [if_neg h_k_lt_n] ++ rw [ite_eq_right h_k_lt_n] + rw [show formalW_coeff W 0 = 0 from formalW_coeff_zero W] + ring + · -- j = n - i +@@ -313,7 +313,7 @@ private theorem conv₃_truncate_term {n i j : ℕ} (hi : i ≤ n) (hj : j ≤ n + -- j ≤ n - n = 0, so j = 0 + have h_j_eq_zero : j = 0 := by omega + subst h_j_eq_zero +- rw [if_neg (by omega : ¬ (i < i))] ++ rw [ite_eq_right (by omega : ¬ (i < i))] + rw [show formalW_coeff W 0 = 0 from formalW_coeff_zero W] + ring + +@@ -389,7 +389,7 @@ private theorem formalW_step_eq_recurrence_rhs_of_lt_three (n : ℕ) (hn3 : n < + unfold formalW_step + dsimp only + simp only [dite_eq_ite] +- rw [if_pos hn3, if_neg (by omega : ¬ (n = 3))] ++ rw [ite_eq_left hn3, ite_eq_right (by omega : ¬ (n = 3))] + interval_cases n + all_goals + simp [conv₂, conv₃, formalW_coeff_zero, formalW_coeff_one, formalW_coeff_two, +@@ -408,11 +408,11 @@ private theorem formalW_step_eq_recurrence_rhs_three (n : ℕ) (hn_eq3 : n = 3) + unfold formalW_step + dsimp only + simp only [dite_eq_ite] +- rw [if_neg (by omega : ¬ (n < 3)), if_pos hn_eq3] ++ rw [ite_eq_right (by omega : ¬ (n < 3)), ite_eq_left hn_eq3] + subst hn_eq3 + simp only [] +- rw [if_pos (by norm_num : (1 : ℕ) ≤ 3), if_pos (by norm_num : (2 : ℕ) ≤ 3), +- if_pos (by norm_num : (1 : ℕ) ≤ 3)] ++ rw [ite_eq_left (by norm_num : (1 : ℕ) ≤ 3), ite_eq_left (by norm_num : (2 : ℕ) ≤ 3), ++ ite_eq_left (by norm_num : (1 : ℕ) ≤ 3)] + rw [show formalW_coeff W (3 - 1) = formalW_coeff W 2 from by norm_num, + show formalW_coeff W (3 - 2) = formalW_coeff W 1 from by norm_num, + formalW_coeff_one W, formalW_coeff_two W] +@@ -434,17 +434,17 @@ private theorem formalW_step_eq_recurrence_rhs_of_four_le (n : ℕ) (hn4 : 4 ≤ + dsimp only + simp only [dite_eq_ite] + -- Clear the step's `n < 3` / `n = 3` guards (LHS) and the `n = 3` term on the RHS. +- rw [if_neg (by omega : ¬ (n < 3)), if_neg (by omega : ¬ (n = 3)), +- if_neg (by omega : ¬ (n = 3))] +- rw [if_pos (show 1 ≤ n from by omega), if_pos (show 2 ≤ n from by omega), +- if_pos (show 1 ≤ n from by omega)] ++ rw [ite_eq_right (by omega : ¬ (n < 3)), ite_eq_right (by omega : ¬ (n = 3)), ++ ite_eq_right (by omega : ¬ (n = 3))] ++ rw [ite_eq_left (show 1 ≤ n from by omega), ite_eq_left (show 2 ≤ n from by omega), ++ ite_eq_left (show 1 ≤ n from by omega)] + -- Use conv₂_truncate, conv₃_truncate for the LHS + rw [conv₂_truncate W n, conv₂_truncate' W n (by omega), conv₃_truncate W n] + -- The truncated w(n-1) and w(n-2) become formalW_coeff (already beta-reduced) + rw [show (if n - 1 < n then formalW_coeff W (n - 1) else 0) = formalW_coeff W (n - 1) from +- if_pos (by omega)] ++ ite_eq_left (by omega)] + rw [show (if n - 2 < n then formalW_coeff W (n - 2) else 0) = formalW_coeff W (n - 2) from +- if_pos (by omega)] ++ ite_eq_left (by omega)] + ring + + /-- The `formalW_step` recursion equals the recurrence right-hand side from +@@ -491,23 +491,5 @@ theorem formalW_recurrence : + formalW_coeff_eq_step W n] + exact formalW_step_eq_recurrence_rhs W n + +-/-! ### Uniqueness of `formalW` (Silverman IV.1.1(b)) +- +-Uniqueness of `formalW` follows the factoring pattern: if `d := w' - formalW W`, +-then `d = K · d` for some `K` with zero constant coefficient, hence `d = 0` +-by `PowerSeries.eq_zero_of_self_eq_mul_self` +-(see `HasseWeil/PowerSeriesHelpers.lean`). +- +-**Status**: infrastructure ready (`eq_zero_of_self_eq_mul_self`), but the +-factoring step `RHS(w') − RHS(formalW W) = K · d` cannot be established by +-`ring`/`linear_combination`/`abel` because of a `PowerSeries R` typeclass +-gap: `RightDistribClass (PowerSeries R)` and `IsRightCancelAdd (PowerSeries R)` +-fail to synthesize in Lean 4.29 / mathlib v4.29.0-rc6, blocking the ring +-tactic on distributivity-heavy identities. The factoring works on simple +-identities in isolation but stops mid-normalisation on the multi-term +-combination needed here. A coefficient-induction route (via +-`PowerSeries.ext` and strong induction on `n`, using `coeff_mul`) avoids +-the ring issue and is the recommended next step. +--/ + + end HasseWeil +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupAssoc.lean b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupAssoc.lean +index b2a59710e..f835d413b 100644 +--- a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupAssoc.lean ++++ b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupAssoc.lean +@@ -122,7 +122,7 @@ theorem formalGroupLaw_coeff_right_unit (n : ℕ) : + -- d 0 = n, d 1 = 0, so the definition enters the "j = 0" branch + -- and returns "if i = 1 then 1 else 0" = "if n = 1 then 1 else 0". + simp only [formalGroupLaw_coeff] +- simp only [Finsupp.single_apply, if_true, if_false, show (0 : Fin 2) ≠ 1 from by decide] ++ simp only [Finsupp.single_apply, ite_true, ite_false, show (0 : Fin 2) ≠ 1 from by decide] + split_ifs <;> simp_all + + /-- `F(0, Y) = Y`: coefficient `F_{0,n} = [n=1]`. -/ +@@ -130,7 +130,7 @@ theorem formalGroupLaw_coeff_left_unit (n : ℕ) : + formalGroupLaw_coeff W (Finsupp.single 1 n) = + if n = 1 then 1 else 0 := by + simp only [formalGroupLaw_coeff] +- simp only [Finsupp.single_apply, if_true, if_false, show (1 : Fin 2) ≠ 0 from by decide] ++ simp only [Finsupp.single_apply, ite_true, ite_false, show (1 : Fin 2) ≠ 0 from by decide] + + /-! ### The ring homomorphism property of the pullback coefficient (Silverman III.5.6) -/ + +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupCorrespondence.lean b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupCorrespondence.lean +index c3196d467..960671107 100644 +--- a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupCorrespondence.lean ++++ b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupCorrespondence.lean +@@ -5,41 +5,6 @@ import Mathlib.RingTheory.Kaehler.Basic + import Mathlib.LinearAlgebra.Dimension.FreeAndStrongRankCondition + import Mathlib.LinearAlgebra.Basis.VectorSpace + +-/-! +-# Formal Group ↔ Curve Correspondence (Silverman IV.1–2, IV.4) +- +-This file establishes the connection between the formal group of an elliptic curve +-and the curve's group law. The key results: +- +-1. **Local parameter**: z = -x/y is a local uniformizer at O (Silverman IV.1). +-2. **w(z)**: The power series solving w = f(z,w) (already in FormalGroup.lean). +-3. **Formal group law**: z(P+Q) = F(z(P), z(Q)) where F is the formal group law. +-4. **Pullback coefficient**: For [m], the formal group series has linear coefficient m. +- +-## The Key Connection (Silverman IV.4) +- +-For an endomorphism φ of E, the pullback coefficient a_φ is defined by: +- φ*ω = a_φ · ω +-where ω = dx/(2y+a₁x+a₃) is the invariant differential. +- +-Equivalently (via the formal group): φ induces a power series φ_F(T) = a_φ T + O(T²), +-and a_φ is the linear coefficient. +- +-The map φ ↦ a_φ is a ring homomorphism End(E) → K̄ (Silverman Cor. III.5.6). +- +-## Kähler Module is 1-Dimensional (Silverman III.1.5) +- +-For an elliptic curve E/K (genus 1), the space Ω_{K(E)/K} of differentials is +-1-dimensional over K(E). This means every differential η can be written as c·ω +-for a unique c ∈ K(E). +- +-This follows from the Riemann-Roch theorem (genus = dim Ω) applied to the +-function field K(E) of transcendence degree 1 over K. +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, III.1.5, III.5, IV.1–4 +--/ + + open WeierstrassCurve + +@@ -286,13 +251,12 @@ private lemma span_invariantDifferential_eq_top : + (Set.singleton_subset_iff.mpr (D_coordXFF_mem_span_invariantDifferential E)) + (D_mem_derivSpanX E f) + +--- The Kähler differential module Ω[K(E)/F] is generated by dx/(2y+a₁x+a₃) +--- as a K(E)-module. Every element η ∈ Ω is of the form c · ω for some c ∈ K(E). ++ + -- This follows from E having genus 1: by Riemann-Roch, dim_K(E) Ω = g = 1. + -- Reference: Silverman III.1.5, Prop. II.4.2(a). + theorem kaehler_rank_one : + Module.finrank E.FunctionField (KaehlerDifferential F E.FunctionField) = 1 := by +- haveI : Module.Free E.FunctionField (KaehlerDifferential F E.FunctionField) := ++ have : Module.Free E.FunctionField (KaehlerDifferential F E.FunctionField) := + Module.Free.of_divisionRing _ _ + rw [finrank_eq_one_iff'] + refine ⟨invariantDifferential E, invariantDifferential_ne_zero E, fun w ↦ ?_⟩ +@@ -309,6 +273,7 @@ section MulByMFormal + + variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The formal group power series [m]_F(T) = m·T + O(T²) for the multiplication + by m map. The linear coefficient is m. + +@@ -321,6 +286,7 @@ theorem formalMulByInt_linear_coeff (m : ℤ) : + formalMulByInt_coeff W.toAffine m 1 = (m : F) := by + simp only [formalMulByInt_coeff, one_ne_zero, ↓reduceIte] + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The multiplication-by-m on the formal group starts with 0 (no constant term). -/ + theorem formalMulByInt_const_zero (m : ℤ) : + formalMulByInt_coeff W.toAffine m 0 = 0 := by +@@ -352,6 +318,7 @@ section Correspondence + + variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The formal group ↔ curve correspondence for the pullback coefficient. + + For the multiplication-by-m endomorphism [m]: +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupLawSpec.lean b/projects/HasseWeil/HasseWeil/FormalGroup/FormalGroupLawSpec.lean +index b652da19cfba4c065baf926dcd4db03ff6447aa1..e63da5ebe93847d80c49394dc1eddf0cefbfaea9 100644 +GIT binary patch +delta 1896 +zcmZ3rm~~wz>x9pnrMNmcxJy#wQw!sZGSf3kHZK=i$;br}$Vp8rnXVwkD6%?M78D +zyZLJAV|FC5&3kLb7*X`>t(DpQrEVItG_to6lTbW1d3KYPEOIi;KvDn+{bx-xIX5Tu +zm9nB3erK`=lI4>%r({bZTVsrB%aSRT_DIr*L<HQ3;uQ@uDKK?#bUTYNPPgFFBy5my}{uPj0Tbv>cY?puvy=R{_dPoAs~# +zvEI%n!YFTmWbt+*7seY*(4-30hX`PhzU@-(jK)kl#6|%~%k&IS#%s33>cEIJun{R< +zjJ}i^vHiLiBR``b+0KBv3z2rf?uzwgltPY~>1IBRfwZs$DUzmN_hAgBg&oKq* simp [h0, h1] +- rw [if_neg this, smul_zero])] ++ rw [ite_eq_right this, smul_zero])] + -- Eval at d = Finsupp.single 1 1: d 0 = 0, d 1 = 1. + have hd01 : (Finsupp.single (1 : Fin 2) 1) 0 = 0 := by simp + have hd11 : (Finsupp.single (1 : Fin 2) 1) 1 = 1 := by simp +- rw [hd01, hd11, if_pos ⟨rfl, rfl⟩] ++ rw [hd01, hd11, ite_eq_left ⟨rfl, rfl⟩] + -- coeff (Finsupp.single 1 1) F.toSeries = 1 by the right-unit axiom. + rw [HasseWeil.FG.FormalGroup.coeff_01, one_smul] + +@@ -460,7 +423,7 @@ private theorem support_finite_coeff_smul_indicator + apply hne + ext i + fin_cases i <;> simp [h0, h1] +- rw [if_neg this, smul_zero] ++ rw [ite_eq_right this, smul_zero] + + /-- The map `d ↦ coeff d F • coeff k (X^(d 0) * g^(d 1))` has finite support; + this is the support of the `![X, g]`-substitution coefficient finsum, finite by +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/Logarithm.lean b/projects/HasseWeil/HasseWeil/FormalGroup/Logarithm.lean +index 401695b65..199e735cd 100644 +--- a/projects/HasseWeil/HasseWeil/FormalGroup/Logarithm.lean ++++ b/projects/HasseWeil/HasseWeil/FormalGroup/Logarithm.lean +@@ -6,33 +6,6 @@ Authors: Chris Birkbeck + import HasseWeil.FormalGroup.InvariantDiff + import Mathlib.Algebra.Module.Rat + +-/-! +-# The formal logarithm of a formal group (Silverman IV.5) +- +-For a formal group `F` over a `ℚ`-algebra `R` (or more generally a ring with a +-`Module ℚ R` structure), the **formal logarithm** +- +-`log_F(T) := ∫₀^T ω_F(s) ds = T + (c₁/2) T² + (c₂/3) T³ + ⋯` +- +-is the integral of the normalized invariant differential +-`ω_F(T) = 1 + c₁T + c₂T² + ⋯`. It is a power series with +-constant term `0` and linear coefficient `1`. +- +-## Main definition +- +-* `HasseWeil.FormalGroup.FormalGroup.log F` — the formal logarithm of `F`, +- defined over any commutative ring `R` equipped with a `ℚ`-module structure. +- +-## Main results +- +-* `FormalGroup.log_coeff_zero` — `constantCoeff (log F) = 0`. +-* `FormalGroup.log_coeff_succ` — `coeff (n + 1) (log F) = (1/(n+1)) • coeff n ω_F`. +-* `FormalGroup.log_coeff_one` — `coeff 1 (log F) = 1`. +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*], IV.5. +--/ + + set_option linter.dupNamespace false + +@@ -40,16 +13,7 @@ namespace HasseWeil.FormalGroup + + variable {R : Type*} [CommRing R] + +-/-- The **formal logarithm** of a formal group `F` over a ring `R` with a +-`Module ℚ R` structure. +- +-Concretely, if `ω_F(T) = 1 + c₁T + c₂T² + ⋯`, then +-`log_F(T) = T + (c₁/2)T² + (c₂/3)T³ + ⋯ = ∑ (c_{n-1}/n)·T^n`. + +-The coefficient at `T^n` for `n ≥ 1` is the ℚ-scalar multiple +-`((n : ℚ)⁻¹) • (coeff of ω_F at n - 1)`. +- +-Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.5. -/ + noncomputable def FormalGroup.log (F : FormalGroup R) [Module ℚ R] : + PowerSeries R := + PowerSeries.mk fun n ↦ +@@ -91,24 +55,6 @@ theorem FormalGroup.log_coeff_one (F : FormalGroup R) [Module ℚ R] : + rw [PowerSeries.coeff_zero_eq_constantCoeff_apply] + exact F.normalizedDifferential_isNormalized + +-/-! ### The formal exponential +- +-We construct `exp_F` as the compositional inverse of `log_F` via an iterative +-truncation argument. +- +-Let `f : PowerSeries R` with `coeff 0 f = 0` and `coeff 1 f = 1` +-(e.g., `f = log_F`). We build the compositional inverse `g` incrementally: +- +-* `compInvTrunc f 0 = 0`. +-* `compInvTrunc f (n+1) = compInvTrunc f n + c · T^(n+1)` where the correction +- `c` is chosen so that `coeff (n+1) (f ∘ compInvTrunc f (n+1)) = [n+1 = 1]` +- (Kronecker delta). Since `f = T + O(T²)`, this determines `c` uniquely: +- `c = δ_{1, n+1} - coeff (n+1) (f(compInvTrunc f n))`. +- +-By induction, `compInvTrunc f n` has the correct coefficients up to degree `n`, +-and adding a `T^(n+1)` correction doesn't change any lower coefficient. +-The compositional inverse is recovered by taking the `n`-th coefficient of +-`compInvTrunc f n`. -/ + + /-- Iterative truncation of the compositional inverse of `f`. + At each step we add a correction of the form `c · T^(n+1)` chosen to zero out +@@ -205,7 +151,7 @@ theorem compInverse_coeff_one (f : PowerSeries R) : + else -PowerSeries.coeff (0 + 1) + (PowerSeries.subst (compInvTrunc f 0) f)) * + PowerSeries.X ^ (0 + 1)) = 1 +- rw [compInvTrunc_zero, if_pos rfl, coeff_one_subst_zero, sub_zero, zero_add] ++ rw [compInvTrunc_zero, ite_eq_left rfl, coeff_one_subst_zero, sub_zero, zero_add] + -- Goal: coeff 1 (C 1 * X^1) = 1. + simp + +@@ -248,7 +194,7 @@ theorem coeff_compInvTrunc_succ_of_le (f : PowerSeries R) (n k : ℕ) (hk : k + PowerSeries.C _ * PowerSeries.X ^ (n + 1)) = _ + rw [map_add, PowerSeries.coeff_C_mul_X_pow] + -- `k ≠ n + 1` since `k ≤ n`. +- rw [if_neg (by omega : k ≠ n + 1), add_zero] ++ rw [ite_eq_right (by omega : k ≠ n + 1), add_zero] + + open PowerSeries in + /-- For `k ≤ n`, the `k`-th coefficient of `compInvTrunc f n` equals the +@@ -383,7 +329,7 @@ theorem coeff_monomial_pow_high (n : ℕ) (c : R) (i : ℕ) (hi : 2 ≤ i) : + PowerSeries.coeff (n + 1) ((PowerSeries.C c * PowerSeries.X ^ (n + 1)) ^ i) = 0 := by + rw [monomial_pow_eq] + rw [PowerSeries.coeff_C_mul_X_pow] +- rw [if_neg] ++ rw [ite_eq_right] + intro heq + -- n + 1 = i * (n + 1) with i ≥ 2 contradicts n + 1 ≥ 1. + nlinarith +@@ -460,7 +406,7 @@ private theorem coeff_add_monomial_pow_eq_zero (g : PowerSeries R) (n : ℕ) (c + PowerSeries.coeff (n + 1) (g ^ 0) + (if (0 : ℕ) = 1 then c else 0) := by + rw [coeff_add_monomial_pow_eq_sum, Finset.sum_range_one] + simp only [Nat.choose_self, Nat.cast_one, one_mul, pow_zero, Nat.sub_self, mul_one] +- rw [if_neg (by decide : (0 : ℕ) ≠ 1), add_zero] ++ rw [ite_eq_right (by decide : (0 : ℕ) ≠ 1), add_zero] + + open PowerSeries in + /-- The `d = 1` case of `coeff_add_monomial_pow_eq`: the expansion has two terms, +@@ -478,11 +424,11 @@ private theorem coeff_add_monomial_pow_eq_one (g : PowerSeries R) (n : ℕ) (c : + rw [show (h ^ 0 : PowerSeries R) = 1 from pow_zero _] + rw [show (h ^ 1 : PowerSeries R) = h from pow_one _] + rw [show (g ^ 0 : PowerSeries R) = 1 from pow_zero _] +- rw [if_pos rfl] ++ rw [ite_eq_left rfl] + simp only [Nat.cast_one, one_mul, mul_one] + -- Goal: coeff (n+1) g + coeff (n+1) h = coeff (n+1) g + c + rw [show PowerSeries.coeff (n + 1) h = c from by +- rw [hdef, PowerSeries.coeff_C_mul_X_pow, if_pos rfl]] ++ rw [hdef, PowerSeries.coeff_C_mul_X_pow, ite_eq_left rfl]] + + open PowerSeries in + /-- The `d + 2` case of `coeff_add_monomial_pow_eq`: split the binomial sum into +@@ -517,7 +463,7 @@ private theorem coeff_add_monomial_pow_eq_succ_succ (g : PowerSeries R) + rw [Finset.sum_eq_zero (fun m hm ↦ by + simp only [Finset.mem_filter, Finset.mem_range] at hm + rw [coeff_monomial_pow_mul_eq_zero g n c hm.2 (d + 2 - m), mul_zero]), add_zero] +- rw [if_neg (by omega : d + 2 ≠ 1), add_zero] ++ rw [ite_eq_right (by omega : d + 2 ≠ 1), add_zero] + -- The m = 1 term vanishes since g has zero constant coefficient. + rw [coeff_monomial_mul_pow_succ_eq_zero g hg n c d, mul_zero, add_zero] + +@@ -577,8 +523,8 @@ theorem coeff_subst_add_monomial (f g : PowerSeries R) (n : ℕ) (c : R) + congr 1 + rw [finsum_eq_single _ 1 (by + intro d hd +- rw [if_neg hd, smul_zero])] +- rw [if_pos rfl, smul_eq_mul, mul_comm] ++ rw [ite_eq_right hd, smul_zero])] ++ rw [ite_eq_left rfl, smul_eq_mul, mul_comm] + + /-! ### The core invariant and the compositional-inverse identity -/ + +@@ -881,15 +827,7 @@ theorem compInverseOfUnit_coeff_one (f : PowerSeries R) (u : R) (hu : IsUnit u) + -- Goal: v ^ 1 * coeff 1 (compInverse (v • f)) = v. + rw [pow_one, compInverse_coeff_one, mul_one] + +-/-- The **formal exponential** of a formal group `F` over a ring with a +-`ℚ`-module structure. +- +-Defined as the compositional inverse of `log_F`, via `compInverse`. +-The full inverse identity `log_F ∘ exp_F = X` (Silverman IV.5.2) is future +-work — this file only establishes the definition and basic coefficient +-properties. + +-Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.5. -/ + noncomputable def FormalGroup.exp (F : FormalGroup R) [Module ℚ R] : + PowerSeries R := + compInverse F.log +@@ -936,14 +874,7 @@ theorem FormalGroup.commutative_of_torsion_free (F : FormalGroup R) + F.toSeries = F.toSeries := + F.commutative + +-/-- **Silverman IV.5.4 (coefficient identity)**: for `n ≥ 1`, +-`n • log_F.coeff n = ω_F.coeff (n - 1)`. + +-This is the `ℚ`-module-level identity that, after multiplying by `(n : ℚ)⁻¹`, +-recovers the explicit formula `log_F.coeff n = (n : ℚ)⁻¹ • ω_F.coeff (n-1)` +-(which is the content of `log_coeff_succ`). Over a torsion-free `ℤ`-algebra +-it shows `n · log_F.coeff n` lies in the image of `ω_F`, which is the +-`ℤ[a_i]`-containment stated in Silverman. -/ + theorem FormalGroup.log_coeff_succ_nsmul (F : FormalGroup R) [Module ℚ R] (n : ℕ) : + (n + 1) • PowerSeries.coeff (n + 1) F.log = + PowerSeries.coeff n F.normalizedDifferential.toSeries := by +@@ -1064,23 +995,23 @@ private theorem FormalGroup.dX_at_zero_additiveFormalGroup [Module ℚ R] : + | 0 => + -- The LHS: (if pos then 1 else 0) + (if single 0 1 = single 1 1 then 1 else 0) + -- = 1 + 0 = 1. +- simp only [Finsupp.single_zero, add_zero, if_true] +- rw [if_neg (by ++ simp only [Finsupp.single_zero, add_zero, ite_true] ++ rw [ite_eq_right (by + intro h + have := DFunLike.congr_fun h 0 + simp [Finsupp.single_eq_same] at this)] + rw [add_zero, PowerSeries.coeff_zero_eq_constantCoeff_apply] + simp + | k + 1 => +- rw [if_neg (by ++ rw [ite_eq_right (by + intro h + have := DFunLike.congr_fun h 1 + simp [Finsupp.add_apply, Finsupp.single_eq_same] at this)] +- rw [if_neg (by ++ rw [ite_eq_right (by + intro h + have h0 := DFunLike.congr_fun h 0 + simp [Finsupp.add_apply, Finsupp.single_eq_same] at h0)] +- rw [zero_add, PowerSeries.coeff_one, if_neg (by omega : k + 1 ≠ 0)] ++ rw [zero_add, PowerSeries.coeff_one, ite_eq_right (by omega : k + 1 ≠ 0)] + + /-- For the additive formal group, the normalized differential `ω_{Ĝ_a}` is the + constant series `1`. This follows from `dX_at_zero = 1` (see +@@ -1121,8 +1052,8 @@ theorem FormalGroup.log_additiveFormalGroup [Module ℚ R] : + -- so its coefficient at `n + 1 ≥ 1` is `0`. + rw [FormalGroup.normalizedDifferential_toSeries_additiveFormalGroup] + -- Goal: ((n+2)⁻¹ : ℚ) • coeff (n+1) (1 : PowerSeries R) = coeff (n+2) X +- rw [PowerSeries.coeff_one, if_neg (by omega : n + 1 ≠ 0), smul_zero, +- PowerSeries.coeff_X, if_neg (by omega : n + 1 + 1 ≠ 1)] ++ rw [PowerSeries.coeff_one, ite_eq_right (by omega : n + 1 ≠ 0), smul_zero, ++ PowerSeries.coeff_X, ite_eq_right (by omega : n + 1 + 1 ≠ 1)] + + /-- **Silverman IV.5.2 for `Ĝ_a`**: the additive formal group's log is + the identity, and as a trivial consequence, it preserves addition. -/ +@@ -1146,15 +1077,6 @@ theorem FormalGroup.additiveFormalGroup_logPreservesAdd [Module ℚ R] : + -- Goal: (additiveFormalGroup R).toSeries = X 0 + X 1. This is rfl by definition. + rfl + +-/-! #### The general case: `LogPreservesAdd F` via Silverman IV.4.2 +- +-The proof follows Silverman IV.5: differentiate both sides of +-`log_F(F(X, Y)) = log_F(X) + log_F(Y)` with respect to `X`. The LHS derivative +-(chain rule + IV.4.2 translation invariance) equals `ω_F(X)`; the RHS +-derivative is `ω_F(X)` directly. Hence both sides have the same partial +-derivative in `X`. Combined with agreement at `X = 0` (via the right unit +-`F(0, Y) = Y` and `log_F(0) = 0`), they are equal because `Module ℚ R` +-makes `R` torsion-free. -/ + + /-- **Key derivative identity**: `pderiv' () F.log = F.invariantDiff` + (both viewed as `MvPowerSeries Unit R = PowerSeries R`). +@@ -1210,9 +1132,7 @@ private theorem pderiv_PowerSeries_subst {τ : Type*} + /-! #### Uniqueness: a two-variable series is determined by its derivative in + variable 0 and its value at `X 0 = 0`. -/ + +-/-- Auxiliary: if `h : MvPowerSeries (Fin 2) R` has zero derivative in variable +-`0` (over a `Module ℚ R`), then all coefficients with positive 0-degree vanish. +--/ ++ + private theorem coeff_zero_of_pderiv_zero_fin2 [Module ℚ R] + (h : MvPowerSeries (Fin 2) R) (hd : MvPowerSeries.pderiv' 0 h = 0) + (e : Fin 2 →₀ ℕ) (he : e 0 ≠ 0) : +@@ -1226,9 +1146,9 @@ private theorem coeff_zero_of_pderiv_zero_fin2 [Module ℚ R] + intro i + by_cases hi : i = 0 + · subst hi +- rw [Finsupp.single_apply, if_pos rfl, ha] ++ rw [Finsupp.single_apply, ite_eq_left rfl, ha] + exact Nat.succ_pos a +- · rw [Finsupp.single_apply, if_neg (Ne.symm hi)] ++ · rw [Finsupp.single_apply, ite_eq_right (Ne.symm hi)] + exact Nat.zero_le _ + have hd_sum : d + Finsupp.single (0 : Fin 2) 1 = e := by + rw [hd_def, tsub_add_cancel_of_le hle] +@@ -1520,7 +1440,7 @@ private theorem coeff_subst_zero_X1_at_single_1 (h : MvPowerSeries (Fin 2) R) (b + rw [finsum_eq_single _ (Finsupp.single (1 : Fin 2) b)] + · -- Case d = single 1 b: d.prod _ = (X 1)^b, coeff (single 1 b) ((X 1)^b) = 1. + rw [prod_eval_zero_X1_of_fst_eq_zero _ (by simp), coeff_single_1_X1_pow, +- if_pos (by simp), smul_eq_mul, mul_one] ++ ite_eq_left (by simp), smul_eq_mul, mul_one] + · -- For d ≠ single 1 b: the contribution is zero. + intro d hd + -- Two cases: d 0 ≠ 0 OR (d 0 = 0 AND d 1 ≠ b). +@@ -1535,7 +1455,7 @@ private theorem coeff_subst_zero_X1_at_single_1 (h : MvPowerSeries (Fin 2) R) (b + rw [h0]; simp + · change d 1 = (Finsupp.single (1 : Fin 2) b) 1 + rw [h1]; simp +- rw [prod_eval_zero_X1_of_fst_eq_zero _ h0, coeff_single_1_X1_pow, if_neg hd1, smul_zero] ++ rw [prod_eval_zero_X1_of_fst_eq_zero _ h0, coeff_single_1_X1_pow, ite_eq_right hd1, smul_zero] + · -- d 0 ≠ 0: d.prod = 0. + rw [prod_eval_zero_X1_of_fst_ne_zero _ h0, map_zero, smul_zero] + +@@ -1601,15 +1521,6 @@ theorem FormalGroup.logPreservesAdd (F : FormalGroup R) [Module ℚ R] : + exact eq_zero_of_pderiv_zero_and_subst_zero_X1 h + (hh ▸ pderiv_zero_LogPreservesAdd_diff F) (hh ▸ subst_zero_X1_LogPreservesAdd_diff F) + +-/-! #### Packaging `log_F` as a formal group homomorphism +- +-Assuming `LogPreservesAdd F` (i.e., the target identity of Silverman IV.5.2), +-we package `log_F` as a `FormalGroupHom F (additiveFormalGroup R)`. +- +-The construction only requires the identity of `LogPreservesAdd` plus the +-fact that `log_F` has zero constant coefficient (which is `log_coeff_zero`). +-The `preserves_add` axiom of the homomorphism is an unfolding of the +-`LogPreservesAdd` identity. -/ + + /-- Under the hypothesis `LogPreservesAdd F`, `log_F` extends to a formal + group homomorphism `F → Ĝ_a`. This is the packaging part of the +@@ -1663,11 +1574,7 @@ noncomputable def FormalGroup.additiveFormalGroup_logHom [Module ℚ R] : + (additiveFormalGroup R).logHomOfLogPreservesAdd + (FormalGroup.additiveFormalGroup_logPreservesAdd) + +-/-- **`log_F` as a `FormalGroupHom`** (Silverman IV.5.2 packaged). + +-For a formal group `F` over a `ℚ`-module `R`, `log_F : F → Ĝ_a` is a formal +-group homomorphism. The underlying series is `F.log`, and the `preserves_add` +-axiom is `F.logPreservesAdd`. -/ + noncomputable def FormalGroup.logHom (F : FormalGroup R) [Module ℚ R] : + FormalGroupHom F (additiveFormalGroup R) := + F.logHomOfLogPreservesAdd F.logPreservesAdd +diff --git a/projects/HasseWeil/HasseWeil/FormalGroup/PDeriv.lean b/projects/HasseWeil/HasseWeil/FormalGroup/PDeriv.lean +index 1cb34befc..a82fdd140 100644 +--- a/projects/HasseWeil/HasseWeil/FormalGroup/PDeriv.lean ++++ b/projects/HasseWeil/HasseWeil/FormalGroup/PDeriv.lean +@@ -9,43 +9,6 @@ import Mathlib.RingTheory.MvPowerSeries.Basic + import Mathlib.RingTheory.MvPowerSeries.PiTopology + import Mathlib.RingTheory.MvPowerSeries.Substitution + +-/-! +-# Partial derivatives of multivariate formal power series +- +-This file defines the formal partial derivative `MvPowerSeries.pderiv' s` on +-`MvPowerSeries σ R`. Mathlib provides a univariate version +-`PowerSeries.derivative` for `PowerSeries R` and a polynomial version +-`MvPolynomial.pderiv`, but there is no `pderiv'` for multivariate power series. +- +-The derivative is defined by the convention +- +- `pderiv' s f := ∑_d ((d s + 1) • coeff_{d + e_s} f) · X^d`, +- +-which matches the univariate `PowerSeries.derivativeFun` for `σ = Unit` and +-agrees with `MvPolynomial.pderiv` under the coercion +-`MvPolynomial σ R → MvPowerSeries σ R` (see `pderiv'_coe`). +- +-This is used downstream in the proof of Silverman IV.4.2 (translation +-invariance of the invariant differential on a formal group). +- +-## Main definitions and results +- +-* `MvPowerSeries.pderiv' s f` — partial derivative w.r.t. `s : σ`. +-* `MvPowerSeries.coeff_pderiv'` — the coefficient of the derivative. +-* `MvPowerSeries.pderiv_add`, `pderiv_zero`, `pderiv_smul`, `pderiv'_C`, +- `pderiv'_X_self`, `pderiv'_X_of_ne`, `pderiv_sub`, `pderiv_neg`, `pderiv'_one` +- — basic API. +-* `MvPowerSeries.pderiv_monomial` — the derivative of a monomial. +-* `MvPowerSeries.pderiv_mul` — **Leibniz rule** for the multivariate formal +- derivative. +-* `MvPowerSeries.pderiv'_coe` — agreement with `MvPolynomial.pderiv`. +-* `MvPowerSeries.continuous_pderiv` — continuity of `pderiv'` in the product +- topology. +-* `MvPowerSeries.pderiv_subst` — **substitution chain rule** for +- `MvPowerSeries.pderiv'` over a finite index type. +-* `MvPowerSeries.pderiv_subst_fin2` — specialization to `σ = Fin 2`, as used +- in Silverman IV.4.2. +--/ + + noncomputable section + +@@ -106,13 +69,13 @@ private lemma add_single_ne_zero (d : σ →₀ ℕ) (s : σ) : + theorem pderiv'_one (s : σ) : pderiv' s (1 : MvPowerSeries σ R) = 0 := by + classical + ext d +- rw [coeff_pderiv', coeff_one, if_neg (add_single_ne_zero d s), smul_zero, coeff_zero] ++ rw [coeff_pderiv', coeff_one, ite_eq_right (add_single_ne_zero d s), smul_zero, coeff_zero] + + @[simp] + theorem pderiv'_C (s : σ) (r : R) : pderiv' s (C (σ := σ) r) = 0 := by + classical + ext d +- rw [coeff_pderiv', coeff_C, if_neg (add_single_ne_zero d s), smul_zero, coeff_zero] ++ rw [coeff_pderiv', coeff_C, ite_eq_right (add_single_ne_zero d s), smul_zero, coeff_zero] + + @[simp] + theorem pderiv'_X_self (s : σ) : pderiv' s (X s : MvPowerSeries σ R) = 1 := by +@@ -122,14 +85,14 @@ theorem pderiv'_X_self (s : σ) : pderiv' s (X s : MvPowerSeries σ R) = 1 := by + by_cases hd : d = 0 + · subst hd + have h : (0 : σ →₀ ℕ) + Finsupp.single s 1 = Finsupp.single s 1 := by simp +- rw [h, if_pos rfl, if_pos rfl, Finsupp.coe_zero, Pi.zero_apply, zero_add, one_smul] ++ rw [h, ite_eq_left rfl, ite_eq_left rfl, Finsupp.coe_zero, Pi.zero_apply, zero_add, one_smul] + · have h : d + Finsupp.single s 1 ≠ Finsupp.single s 1 := by + intro heq + apply hd + have : d + Finsupp.single s 1 = 0 + Finsupp.single s 1 := by + rw [heq, zero_add] + exact add_right_cancel this +- rw [if_neg h, if_neg hd, smul_zero] ++ rw [ite_eq_right h, ite_eq_right hd, smul_zero] + + @[simp] + theorem pderiv'_X_of_ne {s t : σ} (h : s ≠ t) : +@@ -142,9 +105,9 @@ theorem pderiv'_X_of_ne {s t : σ} (h : s ≠ t) : + have hs : (d + Finsupp.single s 1 : σ →₀ ℕ) s = (Finsupp.single t (1 : ℕ)) s := by + rw [heq] + rw [Finsupp.add_apply, single_self_apply, +- Finsupp.single_apply, if_neg h.symm] at hs ++ Finsupp.single_apply, ite_eq_right h.symm] at hs + omega +- rw [if_neg h', smul_zero] ++ rw [ite_eq_right h', smul_zero] + + /-! ### Leibniz rule -/ + +@@ -161,7 +124,7 @@ private lemma smul_eq_zero_of_not_le {s : σ} {a : σ →₀ ℕ} + · subst hi + rw [single_self_apply] + exact Nat.one_le_iff_ne_zero.mpr hne +- · rw [Finsupp.single_apply, if_neg (Ne.symm hi)] ++ · rw [Finsupp.single_apply, ite_eq_right (Ne.symm hi)] + exact Nat.zero_le _ + rw [this] + simp +@@ -342,20 +305,20 @@ private lemma coeff_pderiv_monomial_single_le {s : σ} {n d : σ →₀ ℕ} {a + have hdeq : d = n - Finsupp.single s 1 := by + rw [← hd] + exact (add_tsub_cancel_right d _).symm +- rw [if_pos hd, if_pos hdeq] ++ rw [ite_eq_left hd, ite_eq_left hdeq] + -- `(d s + 1) • a = a * n s`. + have heq : d s + 1 = n s := by + have hds : (d + Finsupp.single s 1 : σ →₀ ℕ) s = n s := by rw [hd] + simp only [Finsupp.add_apply, he_s] at hds + exact hds + rw [heq, nsmul_eq_mul, mul_comm] +- · rw [if_neg hd] ++ · rw [ite_eq_right hd] + -- d + single s 1 ≠ n means d ≠ n - single s 1 (when single s 1 ≤ n). + have hd' : d ≠ n - Finsupp.single s 1 := by + intro heq + apply hd + rw [heq, tsub_add_cancel_of_le hle] +- rw [if_neg hd', smul_zero] ++ rw [ite_eq_right hd', smul_zero] + + /-- Per-coefficient identity behind `pderiv_monomial` when `¬ single s 1 ≤ n` (i.e. + `single s 1 ⊄ n`): then `n s = 0`, so the right-hand coefficient `a * n s` vanishes, and +@@ -376,7 +339,7 @@ private lemma coeff_pderiv_monomial_not_single_le {s : σ} {n d : σ →₀ ℕ} + · subst hi + rw [he_s] + exact Nat.one_le_iff_ne_zero.mpr hne +- · rw [Finsupp.single_apply, if_neg (Ne.symm hi)] ++ · rw [Finsupp.single_apply, ite_eq_right (Ne.symm hi)] + exact Nat.zero_le _ + rw [hns, Nat.cast_zero, mul_zero] + -- and `d + single s 1 = n` is impossible. +@@ -385,7 +348,7 @@ private lemma coeff_pderiv_monomial_not_single_le {s : σ} {n d : σ →₀ ℕ} + apply hle + rw [← heq] + exact le_add_self +- rw [if_neg hne, smul_zero] ++ rw [ite_eq_right hne, smul_zero] + split_ifs <;> rfl + + theorem pderiv_monomial (s : σ) (n : σ →₀ ℕ) (a : R) : +diff --git a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback.lean b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback.lean +index 0ec0adda3..569d1317f 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback.lean +@@ -26,9 +26,7 @@ addition formulas from mathlib. + ## References + + * Silverman, *The Arithmetic of Elliptic Curves*, III.2.3c (explicit addition +- formulas) + III.3.6 (`+` is a morphism). Round-13 D-R13-A-04 fix: III.3.6 is +- the morphism property; the explicit formula is III.2.3c (referenced inside +- III.3.6's proof at book p. 64). ++ formulas) and III.3.6 (`+` is a morphism). + * Mathlib: `WeierstrassCurve.Affine.equation_add` + -/ + +@@ -268,7 +266,7 @@ omit [DecidableEq F] [W.toAffine.IsElliptic] α in + private lemma minpoly_F_x_gen_natDegree_le_two + (α : KE) (hfin : Module.finrank (FractionRing (Polynomial F)) KE = 2) : + (minpoly (FractionRing (Polynomial F)) α).natDegree ≤ 2 := by +- haveI : FiniteDimensional (FractionRing (Polynomial F)) KE := ++ have : FiniteDimensional (FractionRing (Polynomial F)) KE := + Module.finite_of_finrank_pos (by rw [hfin]; exact (by decide : 0 < 2)) + have h_le := minpoly.natDegree_le (A := FractionRing (Polynomial F)) (B := KE) (x := α) + rw [hfin] at h_le +@@ -311,7 +309,7 @@ private lemma addPullback_x_quadratic_over_F_case_two + rw [Polynomial.aeval_eq_sum_range, h_eq_2_F] at h_aeval + simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add, + pow_zero, pow_one, Algebra.smul_def, mul_one] at h_aeval +- rw [h_lc_2, map_one, one_mul] at h_aeval ++ rw [h_lc_2, map_one (algebraMap F KE), one_mul] at h_aeval + rw [map_neg, neg_mul, sub_neg_eq_add] + linear_combination h_aeval + +diff --git a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/Differential.lean b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/Differential.lean +index 35e8ea489..2925f2b5b 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/Differential.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/Differential.lean +@@ -12,27 +12,17 @@ import HasseWeil.HasseBound.QuadraticFormHoleE + /-! + # Differential pullback for the addition isogeny `1 − π` + +-Witness #1 of `hasse_bound_via_signed_QF_negFrobenius` needs the omega-pullback +-coefficient of `isogOneSub_negFrobenius W hq` to equal `1`. This file assembles the +-separability of `1 − π` from that coefficient via the cotangent (T-II-4-004) criterion, +-and computes the supporting coefficients for `mulByInt (-1)` and `negFrobeniusIsog`. ++The invariant-differential coefficient of `1 − π` is one under the corresponding ++additivity hypothesis. The cotangent criterion then gives separability. The supporting ++computations identify the coefficients of negation and negative Frobenius as `-1` and zero. + +-The omega-coefficient identity itself is reduced to a Silverman III.5.2 additivity +-hypothesis (the `id + (-1)·π` decomposition); several witness-parametric consumers below +-take that hypothesis in different shapes and produce the separability conclusion. ++The function-field extension defined by the pullback of `1 − π` is finite-dimensional: ++its x-coordinate is transcendental, hence forms a transcendence basis, and the function ++field is algebraic over the pullback range. Finite-dimensionality gives the equivalence ++between separability and a nonzero invariant-differential coefficient. + +-## Main results +- +-* `isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero`: the T-II-4-004 +- separability criterion for `1 − π`, unconditional. +-* `omegaPullbackCoeff_mulByInt_neg_one`, `omegaPullbackCoeff_negFrobeniusIsog`: the +- supporting omega-coefficient computations. +-* `isogOneSub_negFrobenius_finiteDimensional`: Witness #2 (finite-dimensionality). +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, III.5.2 (additivity), +- III.5.3 (`[m]*ω = m·ω`), III.5.5 (Frobenius is purely inseparable). ++References: Silverman, *The Arithmetic of Elliptic Curves*, III.5.2 (additivity), ++III.5.3 (`[m]*ω = m·ω`), and III.5.5 (Frobenius is purely inseparable). + -/ + + open WeierstrassCurve +@@ -44,17 +34,8 @@ variable (W : WeierstrassCurve K) [W.toAffine.IsElliptic] + + local notation "KE" => W.toAffine.FunctionField + +-/-- **Witness-parametric Witness #1 omega-coefficient closer**: takes the +-Silverman III.5.2 additivity witness for `isogOneSub_negFrobenius` and +-produces the deliverable `omegaPullbackCoeff = 1`. +- +-The additivity hypothesis is exactly the III.5.2 specialization to the +-`1 − π = 1·id + (-1)·π` decomposition. Closing it via the witness-parametric +-bridge chain (`omegaPullbackCoeff_add_of_leading_witness`, +-`FormalIsogenySeries.lean`; the unconditional +-`omegaPullbackCoeff_add_via_bridge_of_constCoeff` was deleted 2026-06-11 as +-refutable) is the substantive piece — once that's in hand, this lemma fires +-the closure axiom-clean. -/ ++/-- The additivity identity for `1 − π = id + (-1)·π` implies that its ++invariant-differential coefficient is one (Silverman III.5.2). -/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_additivity_witness + (hq : 2 ≤ Fintype.card K) + (h_add : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = +@@ -64,11 +45,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_additivity_witness + simpa using omegaPullbackCoeff_m_plus_n_frob_of_witness W + (isogOneSub_negFrobenius W hq) 1 (-1) h_add + +-/-- **Hom decomposition for `1 − π`**: the rational-point map of +-`isogOneSub_negFrobenius W hq` equals the sum of `(Isogeny.id W.toAffine).toAddMonoidHom` +-and `(negFrobeniusIsog W).toAddMonoidHom`. (Historically the `h_add` input of the +-deleted-2026-06-11 `omegaPullbackCoeff_add_via_bridge_of_constCoeff`; retained as the +-group-law decomposition identity in its own right.) -/ ++/-- The rational-point map of `1 − π` is the sum of the identity map and negative Frobenius. ++-/ + theorem isogOneSub_negFrobenius_toAddMonoidHom_decomposition + (hq : 2 ≤ Fintype.card K) : + (isogOneSub_negFrobenius W hq).toAddMonoidHom = +@@ -81,15 +59,8 @@ theorem isogOneSub_negFrobenius_toAddMonoidHom_decomposition + rw [Isogeny.id_toAddMonoidHom, AddMonoidHom.id_apply, + negFrobeniusIsog_toAddMonoidHom_apply, sub_eq_add_neg] + +-/-- **Composed Witness #1**: separability of `isogOneSub_negFrobenius W hq`, +-taking only the additivity sum hypothesis (Silverman III.5.2 input for the +-specific `1 − π = 1·id + (-1)·π` decomposition) and the T-II-4-004 +-differential separability criterion. +- +-Hypothesis count drops from two (omega-coeff + T-II-4-004) to two of a +-sharper shape (additivity sum + T-II-4-004) — the additivity sum is the +-direct discharge target of the T-DIFFERENTIAL-PULLBACK-ADDITION-MAP +-infrastructure, removing one layer of indirection. -/ ++/-- The differential additivity identity and the nonzero-coefficient separability ++criterion imply that `1 − π` is separable. -/ + theorem isogOneSub_negFrobenius_isSeparable_of_additivity_and_T2_4_004 + (hq : 2 ≤ Fintype.card K) + (h_add : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = +@@ -103,15 +74,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_additivity_and_T2_4_004 + W hq h_add) + h_sep_iff + +-/-- **Composed Witness #1 (sharper)**: separability of `isogOneSub_negFrobenius W hq`, +-taking the additivity sum, Witness #2 (FiniteDim), and the algebra-Kähler bridge +-(Subsingleton ↔ pullbackKaehler injective) as inputs. +- +-Composes Commit 13 (T-II-4-004 full iff witness-parametric) with the existing +-additivity-Witness-1 closer. Replaces the iff hypothesis with the two +-witnesses underlying it; when the bridge discharges (cotangent-sequence +-argument unblocked by Sub-piece A break-through), this becomes an +-unconditional consumer of Witness #2 only. -/ ++/-- Differential additivity, finite-dimensionality, and the cotangent criterion imply ++separability of `1 − π`. -/ + theorem isogOneSub_negFrobenius_isSeparable_of_additivity_finiteDim_bridge + (hq : 2 ≤ Fintype.card K) + (h_add : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = +@@ -127,9 +91,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_additivity_finiteDim_bridge + (isSeparable_iff_omegaPullbackCoeff_ne_zero_of_witnesses W + (isogOneSub_negFrobenius W hq) h_fin h_bridge) + +-/-- **{addPullback_x_negFrobenius} is alg-indep over K (axiom-clean)**: +-the singleton family is algebraically independent over `K`, by transcendentality +-(`addPullback_x_transcendental_negFrobenius`). -/ ++/-- The singleton consisting of the x-coordinate of `1 − π` is algebraically independent ++because that coordinate is transcendental over the base field. -/ + theorem addPullback_x_negFrobenius_algebraicIndependent + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) : +@@ -139,9 +102,8 @@ theorem addPullback_x_negFrobenius_algebraicIndependent + rw [algebraicIndependent_unique_type_iff] + exact addPullback_x_transcendental_negFrobenius W hq hxy + +-/-- **{addPullback_x_negFrobenius} is a transcendence basis (axiom-clean)**: +-combines alg-independence with `trdeg K K(E) = 1` to yield the 1-element +-transcendence basis via `AlgebraicIndependent.isTranscendenceBasis_of_lift_trdeg_le_of_finite`. -/ ++/-- The x-coordinate of `1 − π` is a transcendence basis, since the function field has ++transcendence degree one. -/ + theorem addPullback_x_negFrobenius_isTranscendenceBasis + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) : +@@ -153,13 +115,8 @@ theorem addPullback_x_negFrobenius_isTranscendenceBasis + rw [weierstrass_functionField_trdeg_eq_one W] + simp + +-/-- **K(E) is algebraic over `Algebra.adjoin K {addPullback_x_negFrobenius}` +-(axiom-clean, Path (a) step 4)**: applying `IsTranscendenceBasis.isAlgebraic` +-to the trans-basis singleton gives the relative algebraicity over the +-adjoin subalgebra. +- +-@-explicit `Subalgebra.toAlgebra` to bypass typeclass-synthesis flakiness +-on the specific Weierstrass term `addPullback_x W (negFrobeniusIsog W)`. -/ ++/-- The function field is algebraic over the subalgebra generated by the x-coordinate ++of `1 − π`. -/ + theorem addPullback_x_negFrobenius_isAlgebraic_subalgebra + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) : +@@ -170,9 +127,8 @@ theorem addPullback_x_negFrobenius_isAlgebraic_subalgebra + (Subalgebra.toAlgebra _) := + (addPullback_x_negFrobenius_isTranscendenceBasis W hq hxy).isAlgebraic + +-/-- **addPullback_x is in the negFrobenius pullback's range (axiom-clean)**: +-direct identification via the `addPullbackAlgHom` construction — +-`x_gen` maps to `addPullback_x`. -/ ++/-- The x-coordinate of `1 − π` belongs to its pullback range: it is the image of `x_gen`. ++-/ + theorem addPullback_x_negFrobenius_mem_range + (hq : 2 ≤ Fintype.card K) : + addPullback_x W (negFrobeniusIsog W) ∈ +@@ -195,11 +151,8 @@ theorem addPullback_x_negFrobenius_mem_range + AdjoinRoot.lift_mk] + simp [addBaseHom, Polynomial.eval₂_C] + +-/-- **Algebraicity over α.pullback.range** (Path (a) step 5, witness-parametric): +-given `addPullback_x ∈ (isogOneSub_negFrobenius W hq).pullback.range`, +-lift the IsAlgebraic from the smaller adjoin subalgebra to α.pullback.range. +- +-Uses `IsAlgebraic.tower_top_of_subalgebra_le` element-wise. -/ ++/-- If the x-coordinate belongs to the pullback range, algebraicity over the subalgebra ++it generates implies algebraicity over that range. -/ + theorem addPullback_x_negFrobenius_isAlgebraic_range_of_witness + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) +@@ -223,8 +176,7 @@ theorem addPullback_x_negFrobenius_isAlgebraic_range_of_witness + exact ((addPullback_x_negFrobenius_isAlgebraic_subalgebra W hq hxy).isAlgebraic + y).tower_top_of_subalgebra_le h_le + +-/-- **Algebraicity over α.pullback.range (UNCONDITIONAL, axiom-clean)**: +-discharges Commit 26 by feeding Commit 27's membership witness. -/ ++/-- The function field is algebraic over the pullback range of `1 − π`. -/ + theorem addPullback_x_negFrobenius_isAlgebraic_range + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) : +@@ -236,12 +188,8 @@ theorem addPullback_x_negFrobenius_isAlgebraic_range + (addPullback_x_negFrobenius_mem_range W hq) + + set_option backward.isDefEq.respectTransparency.types false in +-/-- **Algebraicity over the type-synonym wrapper (UNCONDITIONAL, axiom-clean, +-Path (a) step 8)**: `K(E)` is algebraic over `IsogenyAlgebraSource W +-(isogOneSub_negFrobenius W hq)`. +- +-Transfers Commit 28's algebraicity-over-`α.pullback.range` to the type-synonym +-form via the bijective range iso `α.pullback : K(E) ≃ₐ[K] α.pullback.range`. -/ ++/-- Algebraicity over the pullback range transfers to the algebra-source type via the ++range isomorphism `K(E) ≃ₐ[K] α.pullback.range`. -/ + theorem isogOneSub_negFrobenius_isAlgebraic_synonym + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) : +@@ -265,41 +213,18 @@ theorem isogOneSub_negFrobenius_isAlgebraic_synonym + change α.pullback (e.symm z) = (z : W.toAffine.FunctionField) + exact congrArg Subtype.val (e.apply_symm_apply z) + +-/-- **WITNESS #2 UNCONDITIONAL (axiom-clean)**: K(E) is finite-dimensional +-over `(isogOneSub_negFrobenius W hq).pullback K(E)` (via `α.toAlgebra.toModule`). +- +-Composes: +-* Commit 18 (`isogeny_finiteDimensional_of_isAlgebraic_synonym`): the +- type-synonym Witness #2 producer. +-* Commit 19 (`isogenyAlgebraSource_essFiniteType` UNCONDITIONAL): synonym +- EssFiniteType from FractionRing localization + `EssFiniteType.of_comp`. +-* Commit 29 (`isogOneSub_negFrobenius_isAlgebraic_synonym` UNCONDITIONAL): +- synonym IsAlgebraic from trans-deg + IsTranscendenceBasis + range iso. +- +-This closes the bound's Witness #2 fully unconditional. T-II-4-004's full +-iff (Commit 17 = `isSeparable_iff_omegaPullbackCoeff_ne_zero_of_finiteDim`) +-chains to fully unconditional `α.IsSeparable ↔ ω-coeff ≠ 0` for the +-negFrobenius case. -/ ++/-- The pullback function-field extension for `1 − π` is finite-dimensional, since it ++is algebraic and essentially of finite type. -/ + theorem isogOneSub_negFrobenius_finiteDimensional + (hq : 2 ≤ Fintype.card K) : + @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField + _ _ (isogOneSub_negFrobenius W hq).toAlgebra.toModule := by +- haveI := isogOneSub_negFrobenius_isAlgebraic_synonym W hq ++ have := isogOneSub_negFrobenius_isAlgebraic_synonym W hq + (negFrobeniusIsog_addNonInverse W) + exact isogeny_finiteDimensional_of_isAlgebraic_synonym W (isogOneSub_negFrobenius W hq) + +-/-- **T-II-4-004 FULLY UNCONDITIONAL for negFrobenius (axiom-clean)**: +-the iff `α.IsSeparable ↔ omegaPullbackCoeff W α ≠ 0` for +-`α = isogOneSub_negFrobenius W hq` lands axiom-clean with no remaining +-hypotheses (modulo only the `hq : 2 ≤ Fintype.card K` standing on +-the bound's signature). +- +-One-line composition of Commit 17 (witness-parametric iff on FiniteDim) +-+ Commit 30 (Witness #2 UNCONDITIONAL). +- +-This closes T-II-4-004 for the bound's purpose. The bound's deferred- +-witness count drops to 2 (Witness #1 unconditional + the additivity +-discharge for general α through BRIDGE-001). -/ ++/-- The isogeny `1 − π` is separable exactly when its invariant-differential coefficient ++is nonzero. -/ + theorem isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero + (hq : 2 ≤ Fintype.card K) : + (isogOneSub_negFrobenius W hq).IsSeparable ↔ +@@ -308,11 +233,8 @@ theorem isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero + (isogOneSub_negFrobenius W hq) + (isogOneSub_negFrobenius_finiteDimensional W hq) + +--- `[Fintype K]` is unused in the statement but needed transitively by the proof's +--- instance resolution, so it cannot be `omit`ted. +-/-- **`alpha_star_u` for `mulByInt (-1)` equals `-u_gen` (axiom-clean)**: +-the negation isogeny pulls `u_gen = 2y + a₁x + a₃` to its negative +-(via `mulByInt_pullback_y_neg_one`). -/ ++omit [Fintype K] in ++/-- Negation pulls `u_gen = 2y + a₁x + a₃` back to `-u_gen`. -/ + theorem alpha_star_u_mulByInt_neg_one : + alpha_star_u W (mulByInt W.toAffine (-1)) = -u_gen W := by + change 2 * (mulByInt W.toAffine (-1)).pullback (y_gen W) + +@@ -324,14 +246,9 @@ theorem alpha_star_u_mulByInt_neg_one : + rw [mulByInt_pullback_y_neg_one, mulByInt_pullback_x_neg_one] + ring + +--- `[Fintype K]` is unused in the statement but needed transitively by the proof. +-/-- **omegaPullbackCoeff for `mulByInt (-1)` equals `-1` (axiom-clean)**: +-direct via `omegaPullbackCoeff_unique` + the spec equation, using +-`alpha_star_u_mulByInt_neg_one` and `mulByInt_pullback_x_neg_one`. +- +-This is independent of the Wronskian-based `omegaPullbackCoeff_mulByInt`, +-so it lands axiom-clean (`omegaPullbackCoeff_mulByInt` uses `sorryAx` via +-the Wronskian derivation). -/ ++omit [Fintype K] in ++/-- The invariant-differential coefficient of negation is `-1`, by the differential ++of the x-coordinate and the negation formula for `u_gen`. -/ + theorem omegaPullbackCoeff_mulByInt_neg_one : + omegaPullbackCoeff W (mulByInt W.toAffine (-1)) = -1 := by + apply omegaPullbackCoeff_unique +@@ -342,13 +259,8 @@ theorem omegaPullbackCoeff_mulByInt_neg_one : + rw [h_pb_x, alpha_star_u_mulByInt_neg_one, inv_neg, neg_smul, neg_one_smul] + rfl + +-/-- **omegaPullbackCoeff for `negFrobeniusIsog` = 0 (axiom-clean)**: +-`negFrobeniusIsog = mulByInt(-1) ∘ frobeniusIsog`, so by the chain rule +-`omegaPullbackCoeff_comp_of_base` (with the outer-base coefficient -1 ∈ K), +-`omega-coeff(negFrob) = (-1) * omega-coeff(frobenius) = (-1) * 0 = 0`. +- +-Avoids the Wronskian-tainted `omegaPullbackCoeff_mulByInt`; uses the +-direct `omegaPullbackCoeff_mulByInt_neg_one` (Commit 35) instead. -/ ++/-- Negative Frobenius has invariant-differential coefficient zero, by the chain rule ++for negation composed with Frobenius. -/ + theorem omegaPullbackCoeff_negFrobeniusIsog : + omegaPullbackCoeff W (negFrobeniusIsog W) = 0 := by + simp only [negFrobeniusIsog] +@@ -358,13 +270,8 @@ theorem omegaPullbackCoeff_negFrobeniusIsog : + push_cast + rfl + +-/-- **Witness #1 (witness-parametric on additivity ONLY, axiom-clean)**: +-separability of `isogOneSub_negFrobenius W hq`, taking only the additivity +-sum hypothesis. T-II-4-004 iff (Commit 31) + Witness #2 (Commit 30) absorbed. +- +-When the additivity discharge lands (per-α BRIDGE-001 instances + +-`omegaPullbackCoeff_add_of_leading_witness`, `FormalIsogenySeries.lean`), +-this fires the unconditional Witness #1 of the bound. -/ ++/-- Differential additivity gives coefficient one and hence separability of `1 − π`. ++-/ + theorem isogOneSub_negFrobenius_isSeparable_of_h_add_only + (hq : 2 ≤ Fintype.card K) + (h_add : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = +@@ -374,13 +281,7 @@ theorem isogOneSub_negFrobenius_isSeparable_of_h_add_only + isogOneSub_negFrobenius_isSeparable_of_additivity_and_T2_4_004 W hq h_add + (isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero W hq) + +-/-- **Witness #1 (taking ONLY `omegaPullbackCoeff = 1`, axiom-clean)**: +-shorter consumer of the existing chain — takes only the omega-coefficient +-identity (= 1), since T-II-4-004 iff (Commit 31) is now unconditional. +- +-When the omega-coefficient computation lands axiom-clean (via either direct +-algebraic computation or BRIDGE-001 + III.5.2), this fires the unconditional +-Witness #1 of the bound. -/ ++/-- A differential coefficient equal to one implies separability of `1 − π`. -/ + theorem isogOneSub_negFrobenius_isSeparable_of_h_coeff_only + (hq : 2 ≤ Fintype.card K) + (h_coeff : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = 1) : +@@ -388,9 +289,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_h_coeff_only + isogOneSub_negFrobenius_isSeparable_of_witnesses W hq h_coeff + (isogOneSub_negFrobenius_isSeparable_iff_omegaPullbackCoeff_ne_zero W hq) + +-/-- **Witness #3 (FiniteDim absorbed)**: sepDegree = pointCount for +-`isogOneSub_negFrobenius W hq`, taking only IsSeparable, the fiber witness, +-and Finite kernel — Witness #2 is absorbed via Commit 30 (unconditional). -/ ++/-- Separability and a fiber-cardinality witness identify the separable degree of ++`1 − π` with the rational-point count. -/ + theorem isogOneSub_negFrobenius_sepDegree_eq_pointCount_of_sep_and_fiber + [Fintype W.toAffine.Point] + (hq : 2 ≤ Fintype.card K) +@@ -423,14 +323,8 @@ theorem isogOneSub_negFrobenius_fiber_witness_of_sepDegree_eq_pointCount + (AddMonoidHom.id _) - (frobeniusIsog W).toAddMonoidHom) + h_sepDeg + +-/-- **Witness #1 via leading-coefficient bridge witness (axiom-clean)**: +-takes BRIDGE-001 for the three isogenies + leading-coefficient additivity +-of formal series, then chains via Commit 46 to derive omega-coeff(γ) = 1 +-unconditional, which closes Witness #1 via Commit 38. +- +-When the leading-coefficient additivity (`h_leading_add`) and BRIDGE-001 for +-negFrobeniusIsog and isogOneSub_negFrobenius are discharged, this becomes +-the unconditional Witness #1 of the bound. -/ ++/-- Leading-coefficient additivity and its equality with the differential coefficients ++for negative Frobenius and `1 − π` imply separability of `1 − π`. -/ + theorem isogOneSub_negFrobenius_isSeparable_via_leading_witnesses + (hq : 2 ≤ Fintype.card K) + (h_bridge_negFrob : omegaPullbackCoeff W (negFrobeniusIsog W) = +diff --git a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/SilvermanIV14.lean b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/SilvermanIV14.lean +index fa13c9ee6..d6729de59 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/SilvermanIV14.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/AdditionPullback/SilvermanIV14.lean +@@ -8,50 +8,20 @@ import HasseWeil.Foundation.BridgeFrobenius + import HasseWeil.Foundation.HahnSeriesAux + + /-! +-# Silverman IV.1.4 scaffold for the leading-coefficient bridge ++# Local expansions and differential pullback for `1 − π` + +-Substantive computation toward closing BRIDGE-001 / BRIDGE-003 for the +-specific case `γ = isogOneSub_negFrobenius`. The deliverable target is +-the leading-coefficient identity: ++For the addition isogeny `γ = 1 − π`, the x- and y-coordinate pullbacks have orders ++`-2` and `-3` at infinity. Thus the pullback of the parameter `t = -x/y` has order one. ++Laurent-series leading coefficients relate its linear formal-series coefficient to ++the leading coefficient of the y-coordinate. Negative Frobenius has zero linear ++coefficient, because its parameter pullback has order `q ≥ 2`. + +-``` +-PowerSeries.coeff 1 (formalIsogenySeries W (isogOneSub_negFrobenius W hq)) = 1 +-``` +- +-which equivalently says: +- +-``` +-(localExpand W (addPullbackAlgHom_negFrobenius W hq (localParam W))).coeff (1 : ℤ) = 1 +-``` +- +-where `localParam W = -x_gen / y_gen` is the local parameter at the point at +-infinity `O`. +- +-## Decomposition +- +-The substantive piece breaks into: +- +-1. **Order computation** — `ord (γ.pullback localParam) = 1` at infinity. +- Direct from `ord (addPullback_x) = -2` (`ord_addPullback_x_negFrobenius`, +- existing) and `ord (addPullback_y) = -3` (analog, this file). +-2. **Leading-coefficient computation** — extract the coefficient of `t¹` in +- the Laurent expansion. The key formula (at the formal-group leading order): +- `coeff 1 (formal γ) = 1 - (coeff q (formal id) * coeff 1 (formal frobeniusIsog))`. +- Specializes via `formalIsogenySeries_id = X` (coeff 1 = 1) and +- `formalIsogenySeries_frobenius = X^q` (coeff 1 = 0 for q ≥ 2), +- giving `coeff 1 = 1 + 0 = 1`. +- +-## Sub-helpers shipped here +- +-* `ord_addPullback_y_negFrobenius` — `ord (addPullback_y W (negFrobeniusIsog W)) = -3`. +-* `ord_localParam_pullback_negFrobenius` — `ord (γ.pullback localParam) = 1`. +-* `formalIsogenySeries_isogOneSub_negFrobenius_constantCoeff` — the +- `constantCoeff = 0` fact (genuine isogeny). +- +-## References ++Kähler differentiation of the curve and addition-slope equations proves that the ++invariant-differential coefficient of `γ` is one, and hence that `γ` is separable. ++The general addition formulas retain the hypotheses relating coordinate pullbacks, ++point maps, and formal series. + +-* Silverman, *The Arithmetic of Elliptic Curves*, IV.1.4 (formal group law +- agreement with the addition formula's local expansion). ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.1.4 and III.5.2. + -/ + + open WeierstrassCurve PowerSeries LaurentSeries +@@ -63,21 +33,8 @@ variable (W : WeierstrassCurve K) [W.toAffine.IsElliptic] + + local notation "KE" => W.toAffine.FunctionField + +-/-- **Order of `-addPullback_x / addPullback_y = 1` at infinity (axiom-clean, +-witness-parametric)**: given `ord (addPullback_x) = -2` and `ord (addPullback_y) +-= -3`, the local-parameter form `-addPullback_x / addPullback_y` (which equals +-`γ.pullback (localParam W)` once the addition-pullback γ is realized as a ring +-hom) has order `1` at infinity. +- +-Substantive content of Silverman IV.1.4's leading-order claim: since +-`γ.pullback (localParam) = γ.pullback (-x_gen / y_gen) = -γ.pullback(x_gen) / +-γ.pullback(y_gen) = -addPullback_x / addPullback_y` for any ring-hom realization +-of γ, the order-1 fact reduces to the purely arithmetic +-`ord(-a / b) = ord(a) - ord(b) = -2 - (-3) = 1`. +- +-Witness-parametric: plugs the existing axiom-clean +-`ord_addPullback_x_negFrobenius` and the (currently sorry-bearing) +-`ord_addPullback_y_negFrobenius` into a closed-form ord computation. -/ ++/-- Coordinate orders `-2` and `-3` imply that `-addPullback_x / addPullback_y` has ++order one at infinity, by `ord(-a/b) = ord(a) - ord(b)`. -/ + theorem ord_neg_addPullback_x_div_y_negFrobenius + (h_x : (W_smooth W).ordAtInfty (addPullback_x W (negFrobeniusIsog W)) = + ((-2 : ℤ) : WithTop ℤ)) +@@ -99,15 +56,8 @@ theorem ord_neg_addPullback_x_div_y_negFrobenius + ((W_smooth W).ordAtInfty_neg _).trans h_x + exact ((W_smooth W).ord_div_concrete h_y_ne (-2) (-3) h_neg_x h_y).trans rfl + +-/-- **IV.1.4 step 1 unconditional**: `ord(-addPullback_x / addPullback_y) = 1` +-at infinity for the negFrobenius case (q ≥ 2, any characteristic). Combines +-the witness-parametric `ord_neg_addPullback_x_div_y_negFrobenius` with the +-two axiom-clean witnesses `ord_addPullback_x_negFrobenius` and the new +-`ord_addPullback_y_negFrobenius`. +- +-This is the substantive ord-1 conclusion of Silverman IV.1.4 step 1. The +-ord-1 fact for `γ.pullback (localParam W)` follows once the addition-pullback +-ring hom γ is realized via `addPullbackAlgHom_negFrobenius W hq`. -/ ++/-- The local parameter of `1 − π` has order one at infinity, in every characteristic. ++-/ + theorem ord_neg_addPullback_x_div_y_negFrobenius_unconditional + (hq : 2 ≤ Fintype.card K) : + (W_smooth W).ordAtInfty +@@ -119,7 +69,7 @@ theorem ord_neg_addPullback_x_div_y_negFrobenius_unconditional + (ord_addPullback_y_negFrobenius W hq) + + /-- **`(negFrob).pullback localParam = ((mulByInt(-1)).pullback localParam)^q`** +-(axiom-clean). Direct from `negFrob = mulByInt(-1) ∘ frobenius` and ++. Direct from `negFrob = mulByInt(-1) ∘ frobenius` and + `frobenius.pullback = (·)^q`. -/ + theorem negFrobeniusIsog_pullback_localParam_eq_pow : + (negFrobeniusIsog W).pullback (localParam W) = +@@ -127,7 +77,8 @@ theorem negFrobeniusIsog_pullback_localParam_eq_pow : + simp only [negFrobeniusIsog] + rw [Isogeny.comp_algebraMap_eq, frobeniusIsog_pullback_apply] + +-/-- **Closed form for `(mulByInt(-1)).pullback localParam`** (axiom-clean). ++omit [Fintype K] in ++/-- **Closed form for `(mulByInt(-1)).pullback localParam`** . + The σ-action on the local parameter `t = -x/y` evaluates to + `x_gen / (y_gen + a₁·x_gen + a₃)`. From `mulByInt_pullback_x_neg_one` + (σ fixes `x_gen`) and `mulByInt_pullback_y_neg_one` (σ sends `y_gen` to +@@ -146,10 +97,10 @@ theorem mulByInt_neg_one_pullback_localParam : + rw [neg_div_neg_eq] + + /-- **`ord((negFrobeniusIsog W).pullback (localParam W)) = q`** at infinity +-(axiom-clean). Direct from the chain rule on `localParam = -x_gen/y_gen`: ++. Direct from the chain rule on `localParam = -x_gen/y_gen`: + `(negFrob).pullback localParam = -(negFrob).pullback x_gen / (negFrob).pullback y_gen`, + combined with `ord((negFrob).pb x_gen) = -2q` and `ord((negFrob).pb y_gen) = -3q` +-(both existing axiom-clean), gives `ord = -2q - (-3q) = q`. ++, gives `ord = -2q - (-3q) = q`. + + This computes the order of the local-parameter image under `−π` directly (i.e., + without going through the addition-pullback γ). For q ≥ 2 this gives ord ≥ 2, +@@ -185,22 +136,22 @@ theorem ord_negFrobeniusIsog_pullback_localParam (hq : 2 ≤ Fintype.card K) : + ring + + omit [Fintype K] in +-/-- **`constantCoeff (formal id) = 0` (axiom-clean, scaffold extraction)**: ++/-- **`constantCoeff (formal id) = 0` **: + direct from `formalIsogenySeries_id = X`. -/ + @[simp] theorem constantCoeff_formalIsogenySeries_id : + PowerSeries.constantCoeff (formalIsogenySeries W (Isogeny.id W.toAffine)) = 0 := by + rw [formalIsogenySeries_id, PowerSeries.constantCoeff_X] + +-/-- **`constantCoeff (formal frobenius) = 0` (axiom-clean, scaffold extraction)**: ++/-- **`constantCoeff (formal frobenius) = 0` **: + direct from `formalIsogenySeries_frobenius = X^q` for `q ≥ 1`. -/ + @[simp] theorem constantCoeff_formalIsogenySeries_frobenius + (h : 1 ≤ Fintype.card K) : + PowerSeries.constantCoeff (formalIsogenySeries W (frobeniusIsog W)) = 0 := by + rw [formalIsogenySeries_frobenius, ← PowerSeries.coeff_zero_eq_constantCoeff_apply, + PowerSeries.coeff_X_pow] +- exact if_neg (by omega) ++ exact ite_eq_right (by omega) + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **Orderbound for denominator's lower terms**: the orderTop of + `HahnSeries.C a₁ * formalX + HahnSeries.C a₃` is ≥ -2 in `LaurentSeries K` + (since each term has orderTop ≥ -2). -/ +@@ -225,7 +176,7 @@ private theorem orderTop_a₁_formalX_plus_a₃_ge_neg_two : + · rw [HahnSeries.C_apply, HahnSeries.orderTop_single ha₃] + exact_mod_cast (by norm_num : (-2 : ℤ) ≤ 0) + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **orderTop of the localExpand of the denominator = -3**: in + `LaurentSeries K`, `formalY + C a₁ * formalX + C a₃` has orderTop = -3, + since `formalY` (orderTop = -3) strictly dominates the other terms +@@ -244,8 +195,9 @@ theorem orderTop_localExpand_y_gen_plus_a₁_x_gen_plus_a₃ : + refine lt_of_lt_of_le ?_ (orderTop_a₁_formalX_plus_a₃_ge_neg_two W) + exact_mod_cast (by norm_num : (-3 : ℤ) < -2) + ++omit [Fintype K] in + /-- **orderTop of `localExpand((mulByInt(-1)).pullback (localParam W)) = 1`** +-(axiom-clean). The σ-image of the local parameter has orderTop = 1 in ++. The σ-image of the local parameter has orderTop = 1 in + `LaurentSeries K`: from the closed form `σ(t) = formalX / denom` (with + `denom = formalY + C(a₁)·formalX + C(a₃)` in LaurentSeries K), and: + * `orderTop formalX = -2` +@@ -320,14 +272,8 @@ theorem coeff_one_formalIsogenySeries_negFrobeniusIsog_of_orderTop_witness + exact_mod_cast (by linarith : (1 : ℤ) < (Fintype.card K : ℤ)) + exact HahnSeries.coeff_eq_zero_of_lt_orderTop h_lt + +-/-- **`constantCoeff (formal negFrob) = 0` (axiom-clean, unconditional)** for q ≥ 1. +- +-Same orderTop argument as `coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero`, +-but for `coeff 0` (= constantCoeff). Holds for any q ≥ 1 (since orderTop ≥ q ≥ 1 > 0). +- +-This discharges the `h_β_const` hypothesis of +-`formalIsogenySeries_add_coeff_one_via_FGL` (`FormalIsogenySeries.lean`) +-for β = negFrobeniusIsog. -/ ++/-- The formal series of negative Frobenius has zero constant coefficient: its order ++is at least `q ≥ 1`. -/ + @[simp] theorem constantCoeff_formalIsogenySeries_negFrobeniusIsog + (hq : 1 ≤ Fintype.card K) : + PowerSeries.constantCoeff (formalIsogenySeries W (negFrobeniusIsog W)) = 0 := by +@@ -349,35 +295,16 @@ for β = negFrobeniusIsog. -/ + exact_mod_cast (by linarith : (0 : ℤ) < (Fintype.card K : ℤ)) + exact HahnSeries.coeff_eq_zero_of_lt_orderTop h_lt + +-/-- **`coeff 1 (formal negFrob) = 0` (axiom-clean, unconditional)** for q ≥ 2. +- +-Discharges the orderTop witness in +-`coeff_one_formalIsogenySeries_negFrobeniusIsog_of_orderTop_witness` using +-the axiom-clean `orderTop_localExpand_mulByInt_neg_one_pullback_localParam = 1`. +- +-This is the cascade collapse: with this `coeff 1 (formal negFrob) = 0` +-in hand, the `h_negfrob` hypothesis of +-`coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_witnesses` +-(helper 4 from previous batch) discharges, leaving only the BRIDGE-003 +-leading-coefficient additivity to close IV.1.4 step 2 unconditionally. -/ ++/-- Negative Frobenius has zero linear formal-series coefficient, since its parameter ++pullback has order `q ≥ 2`. -/ + theorem coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero + (hq : 2 ≤ Fintype.card K) : + PowerSeries.coeff 1 (formalIsogenySeries W (negFrobeniusIsog W)) = 0 := + coeff_one_formalIsogenySeries_negFrobeniusIsog_of_orderTop_witness W hq + (orderTop_localExpand_mulByInt_neg_one_pullback_localParam W).symm.le + +-/-- **BRIDGE-001 for `negFrobeniusIsog` (axiom-clean, UNCONDITIONAL)** for q ≥ 2. +- +-Both sides equal 0: +-* LHS: `omegaPullbackCoeff(negFrob) = 0` (axiom-clean, Differential.lean) +-* RHS: `algebraMap (coeff 1 (formal negFrob)) = algebraMap 0 = 0` (axiom-clean, +- prior commit `coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero`). +- +-This BRIDGE-001 instance is one of the three needed by the additivity bridge +-`omegaPullbackCoeff_add_of_leading_witness` for the +-`γ = id + (-π)` case. Combined with `omegaPullbackCoeff_eq_formalIsogenyLeading_id` +-(axiom-clean, FormalIsogenySeries.lean), the only remaining BRIDGE-001 is for +-`γ = isogOneSub_negFrobenius` itself. -/ ++/-- For negative Frobenius, the differential coefficient equals the image of the linear ++formal-series coefficient: both are zero. -/ + theorem omegaPullbackCoeff_eq_formalIsogenyLeading_negFrobeniusIsog + (hq : 2 ≤ Fintype.card K) : + omegaPullbackCoeff W (negFrobeniusIsog W) = +@@ -386,21 +313,8 @@ theorem omegaPullbackCoeff_eq_formalIsogenyLeading_negFrobeniusIsog + rw [coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero W hq, map_zero] + exact omegaPullbackCoeff_negFrobeniusIsog W + +-/-- **Leading-coefficient closure for `isogOneSub_negFrobenius` (axiom-clean, +-witness-parametric)**: from +-* the additivity decomposition `h_add : coeff 1 (formal (id + (-π))) = +- coeff 1 (formal id) + coeff 1 (formal (-π))` (Silverman IV.1.4 / formal +- group law leading-order additivity), and +-* `h_negfrob : coeff 1 (formal (-π)) = 0` (Silverman III.5.5 inseparability +- on `−π = mulByInt(-1) ∘ π`), +-combine with the existing axiom-clean `coeff_one_formalIsogenySeries_id = 1` +-to conclude `coeff 1 (formal (id + (-π))) = 1`. +- +-This is Silverman IV.1.4's substantive arithmetic content for the +-`isogOneSub_negFrobenius` case, factored as a witness consumer that +-plumbs the (still-missing) BRIDGE-003 leading-order additivity and the +-(also missing but Frobenius-flavored) `(-π)` linear-coeff vanishing into +-the closed-form `1 + 0 = 1`. -/ ++/-- Linear-coefficient additivity and vanishing for negative Frobenius give linear ++coefficient one for `1 − π`. -/ + theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_witnesses + (hq : 2 ≤ Fintype.card K) + (h_add : PowerSeries.coeff 1 +@@ -413,17 +327,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_witnesses + (formalIsogenySeries W (isogOneSub_negFrobenius W hq)) = 1 := by + rw [h_add, coeff_one_formalIsogenySeries_id, h_negfrob, add_zero] + +-/-- **IV.1.4 step 2: closer (axiom-clean, witness-parametric on h_add ONLY)**. +- +-With `coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero` (axiom-clean +-unconditional from the localExpand → orderTop bridge), `h_negfrob` is +-discharged automatically. The remaining hypothesis `h_add` is the +-BRIDGE-003 leading-coefficient additivity for the specific +-`id + (-π)` decomposition. +- +-Once BRIDGE-003 is closed for this case, `coeff 1 (formal γ) = 1` ships +-unconditionally and feeds directly into the omega-pullback Witness #1 +-chain (commits 45-48). -/ ++/-- Linear-coefficient additivity implies that the formal series of `1 − π` has linear ++coefficient one. -/ + theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_h_add + (hq : 2 ≤ Fintype.card K) + (h_add : PowerSeries.coeff 1 +@@ -435,15 +340,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_h_add + coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_of_witnesses W hq h_add + (coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero W hq) + +-/-- **`coeff 1 (formal isogOneSub_negFrobenius) = 1` (axiom-clean, +-witness-parametric on BRIDGE-003 for our case)**: given the BRIDGE-003 +-identity `formal γ = subst F (formal id, formal negFrob)` for our case, +-applies `coeff_one_subst_bivariate` (axiom-clean from FormalIsogenySeries.lean) +-+ the formal group law's leading coefficients + the axiom-clean constantCoeff +-witnesses to conclude. +- +-Closes IV.1.4 step 2 unconditionally up to one named witness: BRIDGE-003 for +-`id + (-π)`. -/ ++/-- If the formal series of `1 − π` is obtained by substituting those of the identity ++and negative Frobenius into the formal group law, its linear coefficient is one. -/ + theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_via_bridge_003 + (hq : 2 ≤ Fintype.card K) + (h_bridge_003 : +@@ -467,21 +365,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_via_bridge_003 + rw [coeff_one_formalIsogenySeries_id W, + coeff_one_formalIsogenySeries_negFrobeniusIsog_eq_zero W hq, add_zero] + +-/-- **Witness #1 omega-coefficient closer (axiom-clean, witness-parametric on +-BRIDGE-001 for γ + leading-additivity)**: takes BRIDGE-001 for the addition +-isogeny γ = `isogOneSub_negFrobenius` and the leading-coefficient additivity +-for `id + (-π)`, and produces `omegaPullbackCoeff(γ) = 1`. +- +-Composes: +-* `omegaPullbackCoeff_add_of_leading_witness` (axiom-clean, FormalIsogenySeries.lean) +-* `omegaPullbackCoeff_eq_formalIsogenyLeading_id` (axiom-clean) +-* `omegaPullbackCoeff_eq_formalIsogenyLeading_negFrobeniusIsog` (axiom-clean, +- this file) +-* `omegaPullbackCoeff_id`, `omegaPullbackCoeff_negFrobeniusIsog` +- (axiom-clean, prior commits) +- +-Result: `omegaPullbackCoeff(γ) = omegaPullbackCoeff(id) + omegaPullbackCoeff(negFrob) +-= 1 + 0 = 1`. -/ ++/-- Equality of the differential and linear formal-series coefficients for `1 − π`, ++together with linear-coefficient additivity, gives differential coefficient one. -/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading + (hq : 2 ≤ Fintype.card K) + (h_bridge_γ : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = +@@ -500,12 +385,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading + rw [h_omega_add, omegaPullbackCoeff_id W, omegaPullbackCoeff_negFrobeniusIsog W, + add_zero] + +-/-- **Witness #1 (witness-parametric on BRIDGE-001 for γ + leading-additivity, +-axiom-clean)**: separability of `isogOneSub_negFrobenius W hq`, taking only +-the BRIDGE-001 for γ + leading-coefficient additivity. T-II-4-004 absorbed. +- +-Once BRIDGE-001 for γ + the leading-additivity (= BRIDGE-003 specialization) +-land, this fires the unconditional Witness #1 of the Hasse-Weil bound. -/ ++/-- The differential/formal-series coefficient identity and linear-coefficient ++additivity imply separability of `1 − π`. -/ + theorem isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading + (hq : 2 ≤ Fintype.card K) + (h_bridge_γ : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = +@@ -520,17 +401,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading + (omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading W hq + h_bridge_γ h_leading_add) + +-/-- **Witness #1 closer (axiom-clean) taking BRIDGE-001 for γ + BRIDGE-003 +-for our case**: with both substantive witnesses in hand, produces +-`(isogOneSub_negFrobenius W hq).IsSeparable`. +- +-Chain: +-1. BRIDGE-003 for our case → `coeff 1 (formal γ) = 1` +- (via `coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_via_bridge_003`). +-2. Leading-additivity follows trivially: `1 = 1 + 0`. +-3. BRIDGE-001 for γ + leading-additivity → `omegaPullbackCoeff(γ) = 1` +- (via the existing `isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading`). +-4. T-II-4-004 (axiom-clean) → IsSeparable. -/ ++/-- A formal group law substitution identity and equality of the differential and ++linear formal-series coefficients imply separability of `1 − π`. -/ + theorem isogOneSub_negFrobenius_isSeparable_of_bridge_001_γ_and_bridge_003 + (hq : 2 ≤ Fintype.card K) + (h_bridge_001_γ : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = +@@ -557,12 +429,8 @@ theorem isogOneSub_negFrobenius_isSeparable_of_bridge_001_γ_and_bridge_003 + exact isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading W hq + h_bridge_001_γ h_leading_add + +-/-- **omegaPullbackCoeff(γ) = 1 axiom-clean given BRIDGE-001 for γ + BRIDGE-003 for our case**. +-Direct consequence: derives `coeff 1 (formal γ) = 1` from BRIDGE-003 via the +-just-shipped via_bridge_003 closer, then leading-additivity follows trivially +-(both sides = 1), then the existing +-`omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading` +-fires. -/ ++/-- Formal group law substitution and the differential/formal-series coefficient ++identity give differential coefficient one for `1 − π`. -/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_bridge_001_γ_and_bridge_003 + (hq : 2 ≤ Fintype.card K) + (h_bridge_001_γ : omegaPullbackCoeff W (isogOneSub_negFrobenius W hq) = +@@ -589,14 +457,15 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_bridge_001_γ_and_ + exact omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading W hq + h_bridge_001_γ h_leading_add + +-/-- **Sub-helper 1**: `localExpand(x_gen - π·x_gen) = formalX - formalX^q` +-(axiom-clean). Direct from `localExpand` ring hom + `frobeniusIsog_pullback_apply`. -/ ++/-- `localExpand(x_gen - π·x_gen) = formalX - formalX^q` ++. Direct from `localExpand` ring hom + `frobeniusIsog_pullback_apply`. -/ + theorem localExpand_x_gen_sub_frobenius_pullback_x_gen : + localExpand W (x_gen W - (frobeniusIsog W).pullback (x_gen W)) = + formalX W - (formalX W) ^ Fintype.card K := by + rw [frobeniusIsog_pullback_apply, map_sub, map_pow, localExpand_x_gen] + +-/-- **Sub-helper 2**: `(formalX - formalX^q).orderTop = -2q` for q ≥ 2. ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX - formalX^q).orderTop = -2q` for q ≥ 2. + For q ≥ 2, `formalX^q` strictly dominates `formalX` (orderTop -2q < -2), + so by `orderTop_add_eq_right`, the sum's orderTop = orderTop(-formalX^q) = -2q. -/ + theorem orderTop_formalX_sub_formalX_pow (hq : 2 ≤ Fintype.card K) : +@@ -620,14 +489,15 @@ theorem orderTop_formalX_sub_formalX_pow (hq : 2 ≤ Fintype.card K) : + nlinarith + rw [HahnSeries.orderTop_add_eq_right h_lt, hX_neg_pow_orderTop] + +-/-- **Sub-helper 3**: `localExpand((x_gen - π·x_gen)²) = (formalX - formalX^q)²`. ++/-- `localExpand((x_gen - π·x_gen)²) = (formalX - formalX^q)²`. + Direct from `localExpand` ring hom + `localExpand_x_gen_sub_frobenius_pullback_x_gen`. -/ + theorem localExpand_x_gen_sub_frob_pullback_x_gen_sq : + localExpand W ((x_gen W - (frobeniusIsog W).pullback (x_gen W)) ^ 2) = + (formalX W - (formalX W) ^ Fintype.card K) ^ 2 := by + rw [map_pow, localExpand_x_gen_sub_frobenius_pullback_x_gen] + +-/-- **Sub-helper 4**: `((formalX - formalX^q)²).orderTop = -4q` for q ≥ 2. ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `((formalX - formalX^q)²).orderTop = -4q` for q ≥ 2. + By `orderTop_mul` + `orderTop_formalX_sub_formalX_pow`. -/ + theorem orderTop_formalX_sub_formalX_pow_sq (hq : 2 ≤ Fintype.card K) : + ((formalX W - (formalX W) ^ Fintype.card K) ^ 2 : LaurentSeries K).orderTop = +@@ -641,7 +511,7 @@ theorem orderTop_formalX_sub_formalX_pow_sq (hq : 2 ≤ Fintype.card K) : + congr 1 + ring + +-/-- **Sub-helper 5**: `localExpand(x_gen · (π·x_gen)²) = formalX^(2q+1)`. ++/-- `localExpand(x_gen · (π·x_gen)²) = formalX^(2q+1)`. + The dominant term of `addPullbackNumerator_reduced_negFrobenius` at infinity. -/ + theorem localExpand_x_gen_mul_frob_pullback_x_gen_sq : + localExpand W (x_gen W * (frobeniusIsog W).pullback (x_gen W) ^ 2) = +@@ -649,7 +519,8 @@ theorem localExpand_x_gen_mul_frob_pullback_x_gen_sq : + rw [frobeniusIsog_pullback_apply, ← pow_mul, map_mul, map_pow, localExpand_x_gen] + ring + +-/-- **Sub-helper 6**: `(formalX^(2q+1)).orderTop = -4q - 2` for q ≥ 1. ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX^(2q+1)).orderTop = -4q - 2` for q ≥ 1. + Direct from `formalX_pow_orderTop`. -/ + theorem orderTop_formalX_pow_two_q_plus_one : + ((formalX W) ^ (2 * Fintype.card K + 1) : LaurentSeries K).orderTop = +@@ -659,13 +530,14 @@ theorem orderTop_formalX_pow_two_q_plus_one : + push_cast + ring + +-/-- **Sub-helper 7**: `(formalX^(2q+1)).leadingCoeff = 1`. ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX^(2q+1)).leadingCoeff = 1`. + Direct from `formalX_pow_leadingCoeff`. -/ + theorem leadingCoeff_formalX_pow_two_q_plus_one : + ((formalX W) ^ (2 * Fintype.card K + 1) : LaurentSeries K).leadingCoeff = 1 := + formalX_pow_leadingCoeff W (2 * Fintype.card K + 1) + +-/-- **Sub-helper 8**: `(localExpand(x_gen · (π·x_gen)²)).orderTop = -2 - 4q`. Composes ++/-- `(localExpand(x_gen · (π·x_gen)²)).orderTop = -2 - 4q`. Composes + the dominant-term identification with the orderTop computation. -/ + theorem orderTop_localExpand_x_gen_mul_frob_pullback_x_gen_sq : + (localExpand W (x_gen W * (frobeniusIsog W).pullback (x_gen W) ^ 2)).orderTop = +@@ -673,7 +545,7 @@ theorem orderTop_localExpand_x_gen_mul_frob_pullback_x_gen_sq : + rw [localExpand_x_gen_mul_frob_pullback_x_gen_sq W] + exact orderTop_formalX_pow_two_q_plus_one W + +-/-- **Sub-helper 9**: `(localExpand(x_gen · (π·x_gen)²)).leadingCoeff = 1`. The ++/-- `(localExpand(x_gen · (π·x_gen)²)).leadingCoeff = 1`. The + leading coefficient at infinity of the dominant term is 1 (rather than 0 or + some other value), which feeds into the leading-coefficient analysis for + `addPullback_x` and ultimately `coeff 1 (formal γ) = 1`. -/ +@@ -682,8 +554,8 @@ theorem leadingCoeff_localExpand_x_gen_mul_frob_pullback_x_gen_sq : + rw [localExpand_x_gen_mul_frob_pullback_x_gen_sq W] + exact leadingCoeff_formalX_pow_two_q_plus_one W + +-omit [Fintype K] in +-/-- **Sub-helper 10**: `(formalY^n).orderTop = -3 * n`. ++omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalY^n).orderTop = -3 * n`. + Mirror of `formalX_pow_orderTop`. -/ + theorem formalY_pow_orderTop (n : ℕ) : + ((formalY W) ^ n : LaurentSeries K).orderTop = +@@ -704,14 +576,15 @@ theorem formalY_pow_orderTop (n : ℕ) : + push_cast + ring + +-/-- **Sub-helper 11**: `localExpand(y_gen · π·y_gen) = formalY · formalY^q`. ++/-- `localExpand(y_gen · π·y_gen) = formalY · formalY^q`. + Direct from `localExpand` ring hom + `frobeniusIsog_pullback_apply`. -/ + theorem localExpand_y_gen_mul_frob_pullback_y_gen : + localExpand W (y_gen W * (frobeniusIsog W).pullback (y_gen W)) = + formalY W * (formalY W) ^ Fintype.card K := by + rw [frobeniusIsog_pullback_apply, map_mul, map_pow, localExpand_y_gen] + +-/-- **Sub-helper 12**: `(formalY · formalY^q).orderTop = -3 - 3q` for q ≥ 1. ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalY · formalY^q).orderTop = -3 - 3q` for q ≥ 1. + Direct from `orderTop_mul` + `formalY_orderTop` + `formalY_pow_orderTop`. -/ + theorem orderTop_formalY_mul_formalY_pow : + (formalY W * (formalY W) ^ Fintype.card K : LaurentSeries K).orderTop = +@@ -719,7 +592,7 @@ theorem orderTop_formalY_mul_formalY_pow : + rw [HahnSeries.orderTop_mul, formalY_orderTop, formalY_pow_orderTop, ← WithTop.coe_add, + show ((-3 : ℤ) + -3 * (Fintype.card K : ℤ)) = -3 - 3 * (Fintype.card K : ℤ) from by ring] + +-/-- **Sub-helper 13**: `localExpand(x_gen² · π·x_gen) = formalX^(q+2)`. ++/-- `localExpand(x_gen² · π·x_gen) = formalX^(q+2)`. + The "term 6" of `addPullbackNumerator_reduced_negFrobenius`: `x² · π·x` with + orderTop -4 - 2q (sub-dominant). -/ + theorem localExpand_x_gen_sq_mul_frob_pullback_x_gen : +@@ -729,7 +602,8 @@ theorem localExpand_x_gen_sq_mul_frob_pullback_x_gen : + congr 1 + ring + +-/-- **Sub-helper 14**: `(formalX^(q+2)).orderTop = -4 - 2q`. -/ ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX^(q+2)).orderTop = -4 - 2q`. -/ + theorem orderTop_formalX_pow_q_plus_two : + ((formalX W) ^ (Fintype.card K + 2) : LaurentSeries K).orderTop = + (((-4 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by +@@ -738,7 +612,7 @@ theorem orderTop_formalX_pow_q_plus_two : + push_cast + ring + +-/-- **Sub-helper 15**: `localExpand(x_gen · π·x_gen) = formalX^(q+1)`. ++/-- `localExpand(x_gen · π·x_gen) = formalX^(q+1)`. + The "x · π·x" component (used in term 8 of `addPullbackNumerator_reduced`). -/ + theorem localExpand_x_gen_mul_frob_pullback_x_gen : + localExpand W (x_gen W * (frobeniusIsog W).pullback (x_gen W)) = +@@ -746,7 +620,8 @@ theorem localExpand_x_gen_mul_frob_pullback_x_gen : + rw [frobeniusIsog_pullback_apply, map_mul, map_pow, localExpand_x_gen, + show Fintype.card K + 1 = 1 + Fintype.card K from by ring, pow_add, pow_one] + +-/-- **Sub-helper 16**: `(formalX^(q+1)).orderTop = -2 - 2q`. -/ ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX^(q+1)).orderTop = -2 - 2q`. -/ + theorem orderTop_formalX_pow_q_plus_one : + ((formalX W) ^ (Fintype.card K + 1) : LaurentSeries K).orderTop = + (((-2 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by +@@ -755,14 +630,15 @@ theorem orderTop_formalX_pow_q_plus_one : + push_cast + ring + +-/-- **Sub-helper 17**: `localExpand(x_gen + π·x_gen) = formalX + formalX^q`. ++/-- `localExpand(x_gen + π·x_gen) = formalX + formalX^q`. + Term 1's "x + π·x" component (used in `a₄ · (x + π·x)`). -/ + theorem localExpand_x_gen_add_frob_pullback_x_gen : + localExpand W (x_gen W + (frobeniusIsog W).pullback (x_gen W)) = + formalX W + (formalX W) ^ Fintype.card K := by + rw [frobeniusIsog_pullback_apply, map_add, map_pow, localExpand_x_gen] + +-/-- **Sub-helper 18**: `(formalX + formalX^q).orderTop ≥ -2q` for q ≥ 1. ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX + formalX^q).orderTop ≥ -2q` for q ≥ 1. + Via `min_orderTop_le_orderTop_add` + `formalX_orderTop` + `formalX_pow_orderTop`. -/ + theorem orderTop_formalX_add_formalX_pow_ge_neg_two_q (hq : 2 ≤ Fintype.card K) : + (((-2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -777,14 +653,15 @@ theorem orderTop_formalX_add_formalX_pow_ge_neg_two_q (hq : 2 ≤ Fintype.card K + · -- -2q ≤ orderTop formalX^q = -2q + rw [formalX_pow_orderTop] + +-/-- **Sub-helper 19**: `localExpand(y_gen + π·y_gen) = formalY + formalY^q`. ++/-- `localExpand(y_gen + π·y_gen) = formalY + formalY^q`. + Term 3's "y + π·y" component (used in `a₃ · (y + π·y)`). -/ + theorem localExpand_y_gen_add_frob_pullback_y_gen : + localExpand W (y_gen W + (frobeniusIsog W).pullback (y_gen W)) = + formalY W + (formalY W) ^ Fintype.card K := by + rw [frobeniusIsog_pullback_apply, map_add, map_pow, localExpand_y_gen] + +-/-- **Sub-helper 20**: `(formalY + formalY^q).orderTop ≥ -3q` for q ≥ 1. ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalY + formalY^q).orderTop ≥ -3q` for q ≥ 1. + Via `min_orderTop_le_orderTop_add` + `formalY_orderTop` + `formalY_pow_orderTop`. -/ + theorem orderTop_formalY_add_formalY_pow_ge_neg_three_q (hq : 2 ≤ Fintype.card K) : + (((-3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -797,13 +674,14 @@ theorem orderTop_formalY_add_formalY_pow_ge_neg_three_q (hq : 2 ≤ Fintype.card + nlinarith + · rw [formalY_pow_orderTop] + +-/-- **Sub-helper 21**: `localExpand(x · π·y) = formalX · formalY^q`. -/ ++/-- `localExpand(x · π·y) = formalX · formalY^q`. -/ + theorem localExpand_x_gen_mul_frob_pullback_y_gen : + localExpand W (x_gen W * (frobeniusIsog W).pullback (y_gen W)) = + formalX W * (formalY W) ^ Fintype.card K := by + rw [frobeniusIsog_pullback_apply, map_mul, map_pow, localExpand_x_gen, localExpand_y_gen] + +-/-- **Sub-helper 22**: `(formalX · formalY^q).orderTop = -2 - 3q`. -/ ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX · formalY^q).orderTop = -2 - 3q`. -/ + theorem orderTop_formalX_mul_formalY_pow : + (formalX W * (formalY W) ^ Fintype.card K : LaurentSeries K).orderTop = + (((-2 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by +@@ -811,13 +689,14 @@ theorem orderTop_formalX_mul_formalY_pow : + show ((-2 : ℤ) + (-3 : ℤ) * (Fintype.card K : ℤ)) = + -2 - 3 * (Fintype.card K : ℤ) from by ring] + +-/-- **Sub-helper 23**: `localExpand(π·x · y) = formalX^q · formalY`. -/ ++/-- `localExpand(π·x · y) = formalX^q · formalY`. -/ + theorem localExpand_frob_pullback_x_gen_mul_y_gen : + localExpand W ((frobeniusIsog W).pullback (x_gen W) * y_gen W) = + (formalX W) ^ Fintype.card K * formalY W := by + rw [frobeniusIsog_pullback_apply, map_mul, map_pow, localExpand_x_gen, localExpand_y_gen] + +-/-- **Sub-helper 24**: `(formalX^q · formalY).orderTop = -3 - 2q`. -/ ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX^q · formalY).orderTop = -3 - 2q`. -/ + theorem orderTop_formalX_pow_mul_formalY : + ((formalX W) ^ Fintype.card K * formalY W : LaurentSeries K).orderTop = + (((-3 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by +@@ -825,7 +704,8 @@ theorem orderTop_formalX_pow_mul_formalY : + show ((-2 : ℤ) * (Fintype.card K : ℤ) + (-3 : ℤ)) = + -3 - 2 * (Fintype.card K : ℤ) from by ring] + +-/-- **Sub-helper 25**: `(formalX·formalY^q + formalX^q·formalY).orderTop ≥ -2 - 3q` ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX·formalY^q + formalX^q·formalY).orderTop ≥ -2 - 3q` + for q ≥ 2. Via `min_orderTop_le_orderTop_add`, since `-2-3q ≤ min(-2-3q, -3-2q)` for q ≥ 2. -/ + theorem orderTop_formalX_mul_formalY_pow_plus_formalX_pow_mul_formalY_ge + (hq : 2 ≤ Fintype.card K) : +@@ -841,7 +721,7 @@ theorem orderTop_formalX_mul_formalY_pow_plus_formalX_pow_mul_formalY_ge + nlinarith + + omit [Fintype K] in +-/-- **Sub-helper 26**: `(HahnSeries.C c).orderTop ≥ 0` for any `c : K`. ++/-- `(HahnSeries.C c).orderTop ≥ 0` for any `c : K`. + Helper for term 2 (`2·a₆`) and similar constant-coefficient bounds. -/ + theorem orderTop_HahnSeries_C_ge_zero (c : K) : + (0 : WithTop ℤ) ≤ (HahnSeries.C c : LaurentSeries K).orderTop := by +@@ -851,8 +731,8 @@ theorem orderTop_HahnSeries_C_ge_zero (c : K) : + · rw [HahnSeries.C_apply, HahnSeries.orderTop_single hc] + rfl + +-omit [Fintype K] in +-/-- **Sub-helper 27**: `localExpand W (algebraMap K KE c) = HahnSeries.C c`. ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `localExpand W (algebraMap K KE c) = HahnSeries.C c`. + Direct from `localExpand_algebraMap` + `HahnSeries.ofPowerSeries_C`. The + constant-coefficient bridge: `algebraMap K KE` factors through `localExpand` + to give a constant Hahn series. -/ +@@ -861,8 +741,8 @@ theorem localExpand_algebraMap_eq_C (c : K) : + rw [localExpand_algebraMap] + exact HahnSeries.ofPowerSeries_C c + +-omit [Fintype K] in +-/-- **Sub-helper 28**: `(localExpand W (algebraMap K KE c * f)).orderTop ≥ ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(localExpand W (algebraMap K KE c * f)).orderTop ≥ + (localExpand W f).orderTop`. The constant factor `algebraMap K KE c` has + orderTop ≥ 0 in the local expansion (it's a constant Hahn series), so + multiplication by it does not decrease the orderTop. Bridge for terms 1, 3, 5 +@@ -877,8 +757,8 @@ theorem orderTop_localExpand_algebraMap_mul_ge (c : K) (f : KE) : + _ ≤ (HahnSeries.C c : LaurentSeries K).orderTop + (localExpand W f).orderTop := by + gcongr + +-omit [Fintype K] in +-/-- **Sub-helper 29**: `(localExpand W (2 * f)).orderTop ≥ (localExpand W f).orderTop`. ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(localExpand W (2 * f)).orderTop ≥ (localExpand W f).orderTop`. + Bridge for terms 4, 7 of `addPullbackNumerator_reduced_negFrobenius` (the `2·...` + terms). Uses `2 * f = f + f` to dodge characteristic-2 considerations. -/ + theorem orderTop_localExpand_two_mul_ge (f : KE) : +@@ -887,15 +767,14 @@ theorem orderTop_localExpand_two_mul_ge (f : KE) : + refine le_trans ?_ HahnSeries.min_orderTop_le_orderTop_add + exact le_min (le_refl _) (le_refl _) + +-omit [Fintype K] in +-/-- **Sub-helper 30**: `(localExpand W (-f)).orderTop = (localExpand W f).orderTop`. ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(localExpand W (-f)).orderTop = (localExpand W f).orderTop`. + Negation preserves orderTop. -/ + theorem orderTop_localExpand_neg (f : KE) : + (localExpand W (-f)).orderTop = (localExpand W f).orderTop := by + rw [map_neg, HahnSeries.orderTop_neg] + +-/-- **Sub-helper 31**: +-`localExpand((negFrob).pullback y_gen) = -formalY^q - C(a₁)·formalX^q - C(a₃)`. ++/-- `localExpand((negFrob).pullback y_gen) = -formalY^q - C(a₁)·formalX^q - C(a₃)`. + Direct from `negFrobeniusIsog_pullback_y_gen` + ring-hom facts. -/ + theorem localExpand_negFrobeniusIsog_pullback_y_gen : + localExpand W ((negFrobeniusIsog W).pullback (y_gen W)) = +@@ -907,7 +786,8 @@ theorem localExpand_negFrobeniusIsog_pullback_y_gen : + localExpand_y_gen, localExpand_x_gen, localExpand_algebraMap_eq_C, + localExpand_algebraMap_eq_C] + +-/-- **Sub-helper 32**: `(C(a₁)·formalX^q + C(a₃)).orderTop ≥ -2q` for q ≥ 1. -/ ++omit [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(C(a₁)·formalX^q + C(a₃)).orderTop ≥ -2q` for q ≥ 1. -/ + theorem orderTop_C_a₁_mul_formalX_pow_plus_C_a₃_ge : + (((-2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ + (HahnSeries.C W.a₁ * (formalX W) ^ Fintype.card K + +@@ -929,7 +809,7 @@ theorem orderTop_C_a₁_mul_formalX_pow_plus_C_a₃_ge : + have : (Fintype.card K : ℤ) ≥ 0 := by positivity + nlinarith + +-/-- **Sub-helper 33**: `(localExpand((negFrob).pullback y_gen)).orderTop = -3q` ++/-- `(localExpand((negFrob).pullback y_gen)).orderTop = -3q` + for q ≥ 2. The `formalY^q` term dominates strictly. -/ + theorem orderTop_localExpand_negFrobeniusIsog_pullback_y_gen + (hq : 2 ≤ Fintype.card K) : +@@ -962,8 +842,8 @@ theorem orderTop_localExpand_negFrobeniusIsog_pullback_y_gen + nlinarith + rw [HahnSeries.orderTop_add_eq_left h_lt, h_neg_y_pow] + +-omit [Fintype K] in +-/-- **Sub-helper 34**: `(C(a₃) · formalY).orderTop ≥ -3` for q ≥ 1. -/ ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(C(a₃) · formalY).orderTop ≥ -3` for q ≥ 1. -/ + theorem orderTop_C_a₃_mul_formalY_ge : + (((-3 : ℤ)) : WithTop ℤ) ≤ + (HahnSeries.C W.a₃ * formalY W : LaurentSeries K).orderTop := by +@@ -974,7 +854,8 @@ theorem orderTop_C_a₃_mul_formalY_ge : + · rw [HahnSeries.C_apply, HahnSeries.orderTop_single ha₃, + show ((0 : ℤ) : WithTop ℤ) = (0 : WithTop ℤ) from rfl, zero_add] + +-/-- **Sub-helper 35**: `(C(a₁) · (formalY · formalX^q)).orderTop ≥ -2-3q` ++omit [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(C(a₁) · (formalY · formalX^q)).orderTop ≥ -2-3q` + for q ≥ 1. -/ + theorem orderTop_C_a₁_mul_formalY_mul_formalX_pow_ge (hq : 1 ≤ Fintype.card K) : + (((-2 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -995,7 +876,7 @@ theorem orderTop_C_a₁_mul_formalY_mul_formalX_pow_ge (hq : 1 ≤ Fintype.card + have h_q : (1 : ℤ) ≤ (Fintype.card K : ℤ) := by exact_mod_cast hq + omega + +-/-- **Sub-helper 36**: `localExpand(y · negFrob.π·y) = -formalY · formalY^q - ++/-- `localExpand(y · negFrob.π·y) = -formalY · formalY^q - + C(a₁) · (formalY · formalX^q) - C(a₃) · formalY`. -/ + theorem localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen : + localExpand W (y_gen W * (negFrobeniusIsog W).pullback (y_gen W)) = +@@ -1005,11 +886,11 @@ theorem localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen : + rw [map_mul, localExpand_negFrobeniusIsog_pullback_y_gen, localExpand_y_gen] + ring + +-/-- **Sub-helper 37**: `(localExpand(y · negFrob.π·y)).orderTop ≥ -3-3q` for q ≥ 2. ++/-- `(localExpand(y · negFrob.π·y)).orderTop ≥ -3-3q` for q ≥ 2. + Each of the three terms has orderTop ≥ -3-3q: +-* `-formalY · formalY^q`: = -3-3q (sub-helper 12). +-* `-C(a₁) · (formalY · formalX^q)`: ≥ -2-3q ≥ -3-3q (sub-helper 35). +-* `-C(a₃) · formalY`: ≥ -3 ≥ -3-3q for q ≥ 0 (sub-helper 34). -/ ++* `-formalY · formalY^q`: = -3-3q. ++* `-C(a₁) · (formalY · formalX^q)`: ≥ -2-3q ≥ -3-3q. ++* `-C(a₃) · formalY`: ≥ -3 ≥ -3-3q for q ≥ 0. -/ + theorem orderTop_localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen_ge + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1041,7 +922,7 @@ theorem orderTop_localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen_ge + have h_q_nn : (0 : ℤ) ≤ (Fintype.card K : ℤ) := by positivity + linarith + +-/-- **Sub-helper 38**: `(localExpand(y_gen + (negFrob).pullback y_gen)).orderTop = -3q` ++/-- `(localExpand(y_gen + (negFrob).pullback y_gen)).orderTop = -3q` + for q ≥ 2. The `(negFrob).pullback y_gen` part dominates strictly (orderTop -3q + < -3 for q ≥ 2). -/ + theorem orderTop_localExpand_y_gen_add_negFrobeniusIsog_pullback_y_gen +@@ -1063,7 +944,7 @@ theorem orderTop_localExpand_y_gen_add_negFrobeniusIsog_pullback_y_gen + nlinarith + rw [HahnSeries.orderTop_add_eq_right h_lt, h_negFrob_y] + +-/-- **Sub-helper 39**: `(localExpand(a₃ · (y_gen + (negFrob).pullback y_gen))).orderTop ≥ -3q`. -/ ++/-- `(localExpand(a₃ · (y_gen + (negFrob).pullback y_gen))).orderTop ≥ -3q`. -/ + theorem orderTop_localExpand_a₃_mul_y_gen_add_negFrobeniusIsog_pullback_y_gen_ge + (hq : 2 ≤ Fintype.card K) : + (((-3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1072,7 +953,7 @@ theorem orderTop_localExpand_a₃_mul_y_gen_add_negFrobeniusIsog_pullback_y_gen_ + refine le_trans ?_ (orderTop_localExpand_algebraMap_mul_ge W W.a₃ _) + rw [orderTop_localExpand_y_gen_add_negFrobeniusIsog_pullback_y_gen W hq] + +-/-- **Sub-helper 40**: `(localExpand(x_gen + (negFrob).pullback x_gen)).orderTop ≥ -2q` ++/-- `(localExpand(x_gen + (negFrob).pullback x_gen)).orderTop ≥ -2q` + for q ≥ 2. Uses the fact that `(negFrob).pullback x_gen = (frob).pullback x_gen`. -/ + theorem orderTop_localExpand_x_gen_add_negFrobeniusIsog_pullback_x_gen_ge + (hq : 2 ≤ Fintype.card K) : +@@ -1082,7 +963,7 @@ theorem orderTop_localExpand_x_gen_add_negFrobeniusIsog_pullback_x_gen_ge + rw [negFrobeniusIsog_pullback_x_gen, localExpand_x_gen_add_frob_pullback_x_gen] + exact orderTop_formalX_add_formalX_pow_ge_neg_two_q W hq + +-/-- **Sub-helper 41**: `(localExpand(a₄ · (x_gen + (negFrob).pullback x_gen))).orderTop ≥ -2q`. -/ ++/-- `(localExpand(a₄ · (x_gen + (negFrob).pullback x_gen))).orderTop ≥ -2q`. -/ + theorem orderTop_localExpand_a₄_mul_x_gen_add_negFrobeniusIsog_pullback_x_gen_ge + (hq : 2 ≤ Fintype.card K) : + (((-2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1091,8 +972,8 @@ theorem orderTop_localExpand_a₄_mul_x_gen_add_negFrobeniusIsog_pullback_x_gen_ + refine le_trans ?_ (orderTop_localExpand_algebraMap_mul_ge W W.a₄ _) + exact orderTop_localExpand_x_gen_add_negFrobeniusIsog_pullback_x_gen_ge W hq + +-omit [Fintype K] in +-/-- **Sub-helper 42**: `(localExpand(2·a₆)).orderTop ≥ 0`. -/ ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(localExpand(2·a₆)).orderTop ≥ 0`. -/ + theorem orderTop_localExpand_two_mul_a₆_ge : + (0 : WithTop ℤ) ≤ + (localExpand W ((2 : W.toAffine.FunctionField) * +@@ -1101,7 +982,7 @@ theorem orderTop_localExpand_two_mul_a₆_ge : + rw [localExpand_algebraMap_eq_C] + exact orderTop_HahnSeries_C_ge_zero W.a₆ + +-/-- **Sub-helper 43**: `(localExpand(2 · y_gen · (negFrob).π·y)).orderTop ≥ -3-3q`. -/ ++/-- `(localExpand(2 · y_gen · (negFrob).π·y)).orderTop ≥ -3-3q`. -/ + theorem orderTop_localExpand_two_mul_y_gen_mul_negFrob_π_y_ge + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1114,7 +995,7 @@ theorem orderTop_localExpand_two_mul_y_gen_mul_negFrob_π_y_ge + refine le_trans ?_ (orderTop_localExpand_two_mul_ge W _) + exact orderTop_localExpand_y_gen_mul_negFrobeniusIsog_pullback_y_gen_ge W hq + +-/-- **Sub-helper 44**: `(localExpand(x_gen² · (negFrob).π·x)).orderTop = -4 - 2q`. -/ ++/-- `(localExpand(x_gen² · (negFrob).π·x)).orderTop = -4 - 2q`. -/ + theorem orderTop_localExpand_x_gen_sq_mul_negFrobeniusIsog_pullback_x_gen : + (localExpand W (x_gen W ^ 2 * + (negFrobeniusIsog W).pullback (x_gen W))).orderTop = +@@ -1122,7 +1003,7 @@ theorem orderTop_localExpand_x_gen_sq_mul_negFrobeniusIsog_pullback_x_gen : + rw [negFrobeniusIsog_pullback_x_gen, localExpand_x_gen_sq_mul_frob_pullback_x_gen] + exact orderTop_formalX_pow_q_plus_two W + +-/-- **Sub-helper 45**: `(localExpand(x_gen · ((negFrob).π·x)²)).orderTop = -2 - 4q`. ++/-- `(localExpand(x_gen · ((negFrob).π·x)²)).orderTop = -2 - 4q`. + The DOMINANT term of `addPullbackNumerator_reduced_negFrobenius`. -/ + theorem orderTop_localExpand_x_gen_mul_negFrobeniusIsog_pullback_x_gen_sq : + (localExpand W (x_gen W * +@@ -1131,7 +1012,7 @@ theorem orderTop_localExpand_x_gen_mul_negFrobeniusIsog_pullback_x_gen_sq : + rw [negFrobeniusIsog_pullback_x_gen] + exact orderTop_localExpand_x_gen_mul_frob_pullback_x_gen_sq W + +-/-- **Sub-helper 46**: `(localExpand(2 · a₂ · x_gen · (negFrob).π·x)).orderTop ≥ -2 - 2q`. -/ ++/-- `(localExpand(2 · a₂ · x_gen · (negFrob).π·x)).orderTop ≥ -2 - 2q`. -/ + theorem orderTop_localExpand_two_mul_a₂_mul_x_gen_mul_negFrob_π_x_ge : + (((-2 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ + (localExpand W ((2 : W.toAffine.FunctionField) * +@@ -1149,7 +1030,7 @@ theorem orderTop_localExpand_two_mul_a₂_mul_x_gen_mul_negFrob_π_x_ge : + localExpand_x_gen_mul_frob_pullback_x_gen] + exact (orderTop_formalX_pow_q_plus_one W).symm.le + +-/-- **Sub-helper 47**: `(localExpand(x · (negFrob).π·y)).orderTop = -2 - 3q` for q ≥ 2. -/ ++/-- `(localExpand(x · (negFrob).π·y)).orderTop = -2 - 3q` for q ≥ 2. -/ + theorem orderTop_localExpand_x_gen_mul_negFrob_pullback_y_gen + (hq : 2 ≤ Fintype.card K) : + (localExpand W (x_gen W * (negFrobeniusIsog W).pullback (y_gen W))).orderTop = +@@ -1159,16 +1040,16 @@ theorem orderTop_localExpand_x_gen_mul_negFrob_pullback_y_gen + show ((-2 : ℤ) + (-3 : ℤ) * (Fintype.card K : ℤ)) = + -2 - 3 * (Fintype.card K : ℤ) from by ring] + +-/-- **Sub-helper 48**: `(localExpand((negFrob).π·x · y)).orderTop = -3 - 2q`. -/ ++/-- `(localExpand((negFrob).π·x · y)).orderTop = -3 - 2q`. -/ + theorem orderTop_localExpand_negFrob_pullback_x_gen_mul_y_gen : + (localExpand W ((negFrobeniusIsog W).pullback (x_gen W) * y_gen W)).orderTop = + (((-3 - 2 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) := by + rw [negFrobeniusIsog_pullback_x_gen, localExpand_frob_pullback_x_gen_mul_y_gen] + exact orderTop_formalX_pow_mul_formalY W + +-/-- **Sub-helper 49** (Term 5 inner): `(localExpand(x · negFrob.π·y + ++/-- Term 5 inner: `(localExpand(x · negFrob.π·y + + negFrob.π·x · y)).orderTop ≥ -3-3q` for q ≥ 2. The `min_orderTop_le_orderTop_add` +-extracts both summands. Sub-helper 47 = -2-3q ≥ -3-3q, sub-helper 48 = -3-2q ≥ -3-3q. -/ ++The summands have orders `-2-3q` and `-3-2q`, both at least `-3-3q`. -/ + theorem orderTop_localExpand_x_gen_mul_negFrob_π_y_plus_negFrob_π_x_mul_y_gen_ge + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1185,8 +1066,8 @@ theorem orderTop_localExpand_x_gen_mul_negFrob_π_y_plus_negFrob_π_x_mul_y_gen_ + refine WithTop.coe_le_coe.mpr ?_ + linarith + +-/-- **Sub-helper 50** (Term 5 outer): `(localExpand(a₁ · (x · negFrob.π·y + +-negFrob.π·x · y))).orderTop ≥ -3-3q` for q ≥ 2. Composition of sub-helpers 28 + 49. -/ ++/-- Term 5 outer: `(localExpand(a₁ · (x · negFrob.π·y + ++negFrob.π·x · y))).orderTop ≥ -3-3q` for q ≥ 2. Multiplication by a base-field constant preserves the lower order bound. -/ + theorem orderTop_localExpand_a₁_mul_x_negFrob_π_y_plus_negFrob_π_x_y_ge + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1196,8 +1077,8 @@ theorem orderTop_localExpand_a₁_mul_x_negFrob_π_y_plus_negFrob_π_x_y_ge + refine le_trans ?_ (orderTop_localExpand_algebraMap_mul_ge W W.a₁ _) + exact orderTop_localExpand_x_gen_mul_negFrob_π_y_plus_negFrob_π_x_mul_y_gen_ge W hq + +-/-- **Sub-helper 51** (Term 1 promoted): `(localExpand(a₄ · (x_gen + +-negFrob.π·x))).orderTop ≥ -3-3q` for q ≥ 1. From sub-helper 41 (≥ -2q). -/ ++/-- Term 1 promoted: `(localExpand(a₄ · (x_gen + ++negFrob.π·x))).orderTop ≥ -3-3q` for q ≥ 1. The sharper lower bound is `-2q`. -/ + theorem orderTop_localExpand_a₄_mul_x_gen_add_negFrob_π_x_promoted + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1208,7 +1089,8 @@ theorem orderTop_localExpand_a₄_mul_x_gen_add_negFrob_π_x_promoted + refine WithTop.coe_le_coe.mpr ?_ + linarith + +-/-- **Sub-helper 52** (Term 2 promoted): `(localExpand(2·a₆)).orderTop ≥ -3-3q`. -/ ++omit [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- Term 2 promoted: `(localExpand(2·a₆)).orderTop ≥ -3-3q`. -/ + theorem orderTop_localExpand_two_mul_a₆_promoted + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1219,8 +1101,8 @@ theorem orderTop_localExpand_two_mul_a₆_promoted + refine WithTop.coe_le_coe.mpr ?_ + linarith + +-/-- **Sub-helper 53** (Term 3 promoted): `(localExpand(a₃ · (y_gen + +-negFrob.π·y))).orderTop ≥ -3-3q`. From sub-helper 39 (≥ -3q). -/ ++/-- Term 3 promoted: `(localExpand(a₃ · (y_gen + ++negFrob.π·y))).orderTop ≥ -3-3q`. The sharper lower bound is `-3q`. -/ + theorem orderTop_localExpand_a₃_mul_y_gen_add_negFrob_π_y_promoted + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1231,8 +1113,8 @@ theorem orderTop_localExpand_a₃_mul_y_gen_add_negFrob_π_y_promoted + refine WithTop.coe_le_coe.mpr ?_ + linarith + +-/-- **Sub-helper 54** (Term 6 promoted): `(localExpand(x² · negFrob.π·x)).orderTop ≥ -3-3q`. +-From sub-helper 44 (= -4-2q). -/ ++/-- Term 6 promoted: `(localExpand(x² · negFrob.π·x)).orderTop ≥ -3-3q`. ++The exact order is `-4-2q`. -/ + theorem orderTop_localExpand_x_gen_sq_mul_negFrob_π_x_promoted + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1243,8 +1125,8 @@ theorem orderTop_localExpand_x_gen_sq_mul_negFrob_π_x_promoted + refine WithTop.coe_le_coe.mpr ?_ + linarith + +-/-- **Sub-helper 55** (Term 8 promoted): `(localExpand(2·a₂·x·negFrob.π·x)).orderTop ≥ -3-3q`. +-From sub-helper 46 (≥ -2-2q). -/ ++/-- Term 8 promoted: `(localExpand(2·a₂·x·negFrob.π·x)).orderTop ≥ -3-3q`. ++The sharper lower bound is `-2-2q`. -/ + theorem orderTop_localExpand_two_a₂_x_negFrob_π_x_promoted + (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1257,14 +1139,14 @@ theorem orderTop_localExpand_two_a₂_x_negFrob_π_x_promoted + linarith + + omit [Fintype K] [DecidableEq K] in +-/-- **Sub-helper 56**: `add_ge_of_both_ge` — addition preserves orderTop bounds. -/ ++/-- `add_ge_of_both_ge` — addition preserves orderTop bounds. -/ + theorem orderTop_add_ge_of_both_ge {a b : LaurentSeries K} {n : WithTop ℤ} + (ha : n ≤ a.orderTop) (hb : n ≤ b.orderTop) : + n ≤ (a + b).orderTop := + le_trans (le_min ha hb) HahnSeries.min_orderTop_le_orderTop_add + + omit [Fintype K] [DecidableEq K] in +-/-- **Sub-helper 57**: `sub_ge_of_both_ge` — subtraction preserves orderTop bounds. ++/-- `sub_ge_of_both_ge` — subtraction preserves orderTop bounds. + Uses `HahnSeries.orderTop_neg` to convert `b` ↔ `-b`. -/ + theorem orderTop_sub_ge_of_both_ge {a b : LaurentSeries K} {n : WithTop ℤ} + (ha : n ≤ a.orderTop) (hb : n ≤ b.orderTop) : +@@ -1274,7 +1156,7 @@ theorem orderTop_sub_ge_of_both_ge {a b : LaurentSeries K} {n : WithTop ℤ} + rw [HahnSeries.orderTop_neg] + exact hb + +-/-- **Sub-helper 58** (Cumulative sum): `(localExpand(rest)).orderTop ≥ -3-3q`, ++/-- Cumulative sum: `(localExpand(rest)).orderTop ≥ -3-3q`, + where `rest` is `addPullbackNumerator_reduced_negFrobenius` minus the dominant + term `x · (negFrob.π·x)²`. Sequential `add/sub_ge_of_both_ge` chain over + the 7 sub-dominant term bounds. -/ +@@ -1339,7 +1221,7 @@ private theorem addPullbackNumerator_reduced_negFrobenius_split_eq : + + /-- The dominant term `localExpand(x_gen · (negFrob.π·x)²)` has strictly smaller + `orderTop` than the `rest` (for `q ≥ 2`): `-2-4q < -3-3q`. Combines the dominant +-order (sub-helper 45) with the `rest ≥ -3-3q` bound (sub-helper 58). -/ ++order with the `rest ≥ -3-3q` bound. -/ + private theorem orderTop_localExpand_dominant_lt_rest_negFrobenius + (hq : 2 ≤ Fintype.card K) : + (localExpand W (x_gen W * +@@ -1374,8 +1256,8 @@ private theorem orderTop_localExpand_dominant_lt_rest_negFrobenius + for q ≥ 2. + + Algebraic decomposition: the full expression is `rest + dominant`, where +-* `dominant = x_gen · (negFrob.π·x)²` has orderTop = -2-4q (sub-helper 45) +-* `rest` (the other 7 terms) has orderTop ≥ -3-3q (sub-helper 58) ++* `dominant = x_gen · (negFrob.π·x)²` has orderTop = -2-4q ++* `rest` (the other 7 terms) has orderTop ≥ -3-3q + + For q ≥ 2: -2-4q < -3-3q, so `orderTop_add_eq_right` extracts the dominant + orderTop. -/ +@@ -1442,7 +1324,7 @@ private lemma orderTop_localExpand_dominant_lt_rest (hq : 2 ≤ Fintype.card K) + /-- **Leading coefficient companion**: + `(localExpand(addPullbackNumerator_reduced_negFrobenius)).leadingCoeff = 1` + for q ≥ 2. The leading coefficient of the dominant term `x_gen · (negFrob.π·x)²` +-is 1 (sub-helper 9 / `leadingCoeff_localExpand_x_gen_mul_frob_pullback_x_gen_sq`), ++is 1 by `leadingCoeff_localExpand_x_gen_mul_frob_pullback_x_gen_sq`, + which propagates through the strict-non-arch via `leadingCoeff_add_eq_right`. -/ + theorem leadingCoeff_localExpand_addPullbackNumerator_reduced_negFrobenius_eq + (hq : 2 ≤ Fintype.card K) : +@@ -1454,7 +1336,8 @@ theorem leadingCoeff_localExpand_addPullbackNumerator_reduced_negFrobenius_eq + negFrobeniusIsog_pullback_x_gen] + exact leadingCoeff_localExpand_x_gen_mul_frob_pullback_x_gen_sq W + +-/-- **Sub-helper 61**: `(formalX - formalX^q).leadingCoeff = -1` for q ≥ 2. ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- `(formalX - formalX^q).leadingCoeff = -1` for q ≥ 2. + The dominant term `-formalX^q` (orderTop -2q < -2) determines the leading + coefficient via `leadingCoeff_add_eq_right`. -/ + theorem leadingCoeff_formalX_sub_formalX_pow (hq : 2 ≤ Fintype.card K) : +@@ -1469,16 +1352,16 @@ theorem leadingCoeff_formalX_sub_formalX_pow (hq : 2 ≤ Fintype.card K) : + rw [HahnSeries.leadingCoeff_add_eq_right h_lt, HahnSeries.leadingCoeff_neg, + formalX_pow_leadingCoeff] + +-/-- **Sub-helper 62**: `((formalX - formalX^q)²).leadingCoeff = 1` for q ≥ 2. +-Direct from `HahnSeries.leadingCoeff_mul` (squared) and sub-helper 61 +-(`(-1)² = 1`). -/ ++omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- Squaring `formalX - formalX^q`, whose leading coefficient is `-1`, gives leading ++coefficient one. -/ + theorem leadingCoeff_formalX_sub_formalX_pow_sq (hq : 2 ≤ Fintype.card K) : + ((formalX W - (formalX W) ^ Fintype.card K) ^ 2 : LaurentSeries K).leadingCoeff = 1 := by + rw [sq, HahnSeries.leadingCoeff_mul, leadingCoeff_formalX_sub_formalX_pow W hq] + ring + +-/-- **Sub-helper 63**: `(localExpand((x_gen - negFrob.π·x)²)).orderTop = -4q` for q ≥ 2. +-Bridges via `negFrobeniusIsog_pullback_x_gen` to the frobenius-side sub-helper 4. -/ ++/-- `(localExpand((x_gen - negFrob.π·x)²)).orderTop = -4q` for q ≥ 2. ++Negative Frobenius has the same x-coordinate pullback as Frobenius. -/ + theorem orderTop_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq + (hq : 2 ≤ Fintype.card K) : + (localExpand W ((x_gen W - +@@ -1487,7 +1370,7 @@ theorem orderTop_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq + rw [negFrobeniusIsog_pullback_x_gen, localExpand_x_gen_sub_frob_pullback_x_gen_sq] + exact orderTop_formalX_sub_formalX_pow_sq W hq + +-/-- **Sub-helper 64**: `(localExpand((x_gen - negFrob.π·x)²)).leadingCoeff = 1` for q ≥ 2. -/ ++/-- `(localExpand((x_gen - negFrob.π·x)²)).leadingCoeff = 1` for q ≥ 2. -/ + theorem leadingCoeff_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq + (hq : 2 ≤ Fintype.card K) : + (localExpand W ((x_gen W - +@@ -1495,7 +1378,7 @@ theorem leadingCoeff_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq + rw [negFrobeniusIsog_pullback_x_gen, localExpand_x_gen_sub_frob_pullback_x_gen_sq] + exact leadingCoeff_formalX_sub_formalX_pow_sq W hq + +-/-- **Sub-helper 65**: `(localExpand((x_gen - negFrob.π·x)²)) ≠ 0` for q ≥ 2. ++/-- `(localExpand((x_gen - negFrob.π·x)²)) ≠ 0` for q ≥ 2. + Direct from orderTop being a finite value. -/ + theorem localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_ne_zero + (hq : 2 ≤ Fintype.card K) : +@@ -1508,7 +1391,7 @@ theorem localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_ne_zero + rw [orderTop_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq W hq] at h_top + exact WithTop.coe_ne_top h_top + +-/-- **Sub-helper 65b**: `(x_gen - negFrob.π·x) ≠ 0` in K(E). Derived from the ++/-- `(x_gen - negFrob.π·x) ≠ 0` in K(E). Derived from the + LaurentSeries-side fact `(formalX - formalX^q).orderTop = -2q ≠ ⊤`. -/ + private theorem x_gen_sub_negFrob_pullback_x_gen_ne_zero_local + (hq : 2 ≤ Fintype.card K) : +@@ -1569,7 +1452,7 @@ theorem leadingCoeff_localExpand_addPullback_x_negFrobenius_eq + leadingCoeff_localExpand_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq W hq] + ring + +-/-- **Sub-helper 66**: `localExpand(addPullback_x_negFrobenius) ≠ 0` for q ≥ 2. ++/-- `localExpand(addPullback_x_negFrobenius) ≠ 0` for q ≥ 2. + Direct from orderTop being a finite value. -/ + theorem localExpand_addPullback_x_negFrobenius_ne_zero + (hq : 2 ≤ Fintype.card K) : +@@ -1580,11 +1463,11 @@ theorem localExpand_addPullback_x_negFrobenius_ne_zero + rw [orderTop_localExpand_addPullback_x_negFrobenius_eq W hq] at h_top + exact WithTop.coe_ne_top h_top + +-/-- **Sub-helper 67**: `(localExpand(addPullback_x_negFrobenius)).coeff (-2) = 1` for q ≥ 2. ++/-- `(localExpand(addPullback_x_negFrobenius)).coeff (-2) = 1` for q ≥ 2. + Direct extraction of the leading coefficient at the leading exponent + via `HahnSeries.coeff_untop_eq_leadingCoeff` (when orderTop = -2 finite). + +-This is the ACTUAL coefficient value at the most-negative exponent, the ++This is the coefficient value at the most-negative exponent, the + LaurentSeries-side input for the IV.1.4 step 2 leading-coefficient + computation. -/ + theorem coeff_neg_two_localExpand_addPullback_x_negFrobenius_eq +@@ -1602,7 +1485,7 @@ theorem coeff_neg_two_localExpand_addPullback_x_negFrobenius_eq + rw [← h_untop, HahnSeries.coeff_untop_eq_leadingCoeff] + exact h_leadingCoeff + +-/-- **Sub-helper 68**: `((localExpand addPullback_x)^2).orderTop = -4`. -/ ++/-- `((localExpand addPullback_x)^2).orderTop = -4`. -/ + theorem orderTop_localExpand_addPullback_x_negFrobenius_sq + (hq : 2 ≤ Fintype.card K) : + ((localExpand W (addPullback_x W (negFrobeniusIsog W))) ^ 2 : +@@ -1612,7 +1495,7 @@ theorem orderTop_localExpand_addPullback_x_negFrobenius_sq + orderTop_localExpand_addPullback_x_negFrobenius_eq W hq, ← WithTop.coe_add] + congr 1 + +-/-- **Sub-helper 69**: `((localExpand addPullback_x)^3).orderTop = -6`. -/ ++/-- `((localExpand addPullback_x)^3).orderTop = -6`. -/ + theorem orderTop_localExpand_addPullback_x_negFrobenius_cube + (hq : 2 ≤ Fintype.card K) : + ((localExpand W (addPullback_x W (negFrobeniusIsog W))) ^ 3 : +@@ -1623,7 +1506,7 @@ theorem orderTop_localExpand_addPullback_x_negFrobenius_cube + orderTop_localExpand_addPullback_x_negFrobenius_eq W hq, ← WithTop.coe_add] + congr 1 + +-/-- **Sub-helper 70**: `localExpand(addPullback_y)` is nonzero for q ≥ 2. ++/-- `localExpand(addPullback_y)` is nonzero for q ≥ 2. + Direct from `localExpand` being a ring hom to a field + addPullback_y ≠ 0 + (via `ord_addPullback_y_negFrobenius`). -/ + theorem localExpand_addPullback_y_negFrobenius_ne_zero +@@ -1638,7 +1521,7 @@ theorem localExpand_addPullback_y_negFrobenius_ne_zero + rw [h_y_eq_zero] at h_y_ord + exact WithTop.top_ne_coe ((W_smooth W).ordAtInfty_zero.symm.trans h_y_ord) + +-/-- **Sub-helper 71**: localExpand of the curve equation ++/-- localExpand of the curve equation + `Y² + a₁·X·Y + a₃·Y = X³ + a₂·X² + a₄·X + a₆` applied to the addPullback + coordinates. Direct from `addPullback_equation` + `localExpand` ring hom. + +@@ -1675,7 +1558,7 @@ theorem localExpand_addPullback_curve_equation : + rw [ha₁, ha₂, ha₃, ha₄, ha₆] at h_le + exact h_le + +-/-- **Sub-helper 72**: `(localExpand(a₂·X² + a₄·X + a₆)).orderTop ≥ -4` for q ≥ 2. ++/-- `(localExpand(a₂·X² + a₄·X + a₆)).orderTop ≥ -4` for q ≥ 2. + The non-cubic RHS terms have orderTop bounded by -4 (since `a₂·X²` has + orderTop ≥ -4 = orderTop X² when a₂ ≠ 0, and `a₄·X` has orderTop ≥ -2 ≥ -4, + and `a₆` has orderTop ≥ 0 ≥ -4). -/ +@@ -1713,7 +1596,7 @@ theorem orderTop_localExpand_RHS_lower_terms_ge + refine le_trans ?_ (orderTop_HahnSeries_C_ge_zero W.a₆) + exact_mod_cast (by norm_num : (-4 : ℤ) ≤ 0) + +-/-- **Sub-helper 73**: `(localExpand(X³ + a₂·X² + a₄·X + a₆)).orderTop = -6` ++/-- `(localExpand(X³ + a₂·X² + a₄·X + a₆)).orderTop = -6` + for q ≥ 2. Strict non-arch with `X³` dominating (orderTop -6) and the other + terms bounded ≥ -4. -/ + theorem orderTop_localExpand_addPullback_RHS_eq +@@ -1751,8 +1634,7 @@ theorem orderTop_localExpand_addPullback_RHS_eq + exact (HahnSeries.orderTop_add_eq_left h_lt).trans + (orderTop_localExpand_addPullback_x_negFrobenius_cube W hq) + +-/-- **Sub-helper 74** (Y-side LHS orderTop = -6): direct from sub-helper 73 + +-the curve equation (sub-helper 71). -/ ++/-- Y-side LHS orderTop = -6: the curve equation identifies its order with the cubic right-hand side. -/ + theorem orderTop_localExpand_addPullback_LHS_eq + (hq : 2 ≤ Fintype.card K) : + ((localExpand W (addPullback_y W (negFrobeniusIsog W)))^2 + +@@ -1766,8 +1648,8 @@ theorem orderTop_localExpand_addPullback_LHS_eq + rw [localExpand_addPullback_curve_equation W] + exact orderTop_localExpand_addPullback_RHS_eq W hq + +-/-- **Sub-helper 75** (extract m): `localExpand(addPullback_y).orderTop = (m : ℤ)` +-for some integer `m`. Uses sub-helper 70 (≠ 0). -/ ++/-- extract m: `localExpand(addPullback_y).orderTop = (m : ℤ)` ++for some integer `m`. The series is nonzero, so its order is finite. -/ + theorem exists_m_orderTop_localExpand_addPullback_y_negFrobenius + (hq : 2 ≤ Fintype.card K) : + ∃ m : ℤ, (localExpand W (addPullback_y W (negFrobeniusIsog W))).orderTop = +@@ -1779,7 +1661,7 @@ theorem exists_m_orderTop_localExpand_addPullback_y_negFrobenius + obtain ⟨m, hm⟩ := WithTop.ne_top_iff_exists.mp h_ne_top + exact ⟨m, hm.symm⟩ + +-/-- **Sub-helper 76** (Y² orderTop = 2m): with `m = orderTop(Y)`, `Y²` has orderTop `2m`. -/ ++/-- Y² orderTop = 2m: with `m = orderTop(Y)`, `Y²` has orderTop `2m`. -/ + theorem orderTop_localExpand_addPullback_y_negFrobenius_sq_eq_two_m + (_hq : 2 ≤ Fintype.card K) (m : ℤ) + (hm : (localExpand W (addPullback_y W (negFrobeniusIsog W))).orderTop = +@@ -1790,7 +1672,7 @@ theorem orderTop_localExpand_addPullback_y_negFrobenius_sq_eq_two_m + rw [sq, HahnSeries.orderTop_mul, hm, ← WithTop.coe_add] + congr 1; ring + +-/-- **Sub-helper 77** (X·Y orderTop = -2 + m): -/ ++/-- X·Y orderTop = -2 + m: -/ + theorem orderTop_localExpand_addPullback_x_mul_y_negFrobenius_eq + (hq : 2 ≤ Fintype.card K) (m : ℤ) + (hm : (localExpand W (addPullback_y W (negFrobeniusIsog W))).orderTop = +@@ -1858,7 +1740,7 @@ private theorem orderTop_a3_mul_y_negFrobenius_ge (m : ℤ) (h_m_ge : -2 ≤ m) + rw [zero_add] + refine WithTop.coe_le_coe.mpr ?_; linarith + +-/-- **Sub-helper 78** (rule out m ≥ -2): if `m ≥ -2`, then LHS orderTop ≥ -4, ++/-- rule out m ≥ -2: if `m ≥ -2`, then LHS orderTop ≥ -4, + contradicting LHS orderTop = -6. -/ + theorem m_le_neg_three_orderTop_localExpand_addPullback_y_negFrobenius + (hq : 2 ≤ Fintype.card K) (m : ℤ) +@@ -1876,7 +1758,7 @@ theorem m_le_neg_three_orderTop_localExpand_addPullback_y_negFrobenius + have h46 : (-4 : ℤ) ≤ -6 := by exact_mod_cast h_lhs_ge + omega + +-/-- **Sub-helper 79** (Y² strictly dominates a₁·X·Y, given m ≤ -3): for `m ≤ -3`, ++/-- Y² strictly dominates a₁·X·Y, given m ≤ -3: for `m ≤ -3`, + `Y²` has orderTop = `2m ≤ -6 < -2 + m = orderTop(a₁·X·Y)`. -/ + theorem orderTop_y_sq_lt_a1xy_negFrobenius + (hq : 2 ≤ Fintype.card K) (m : ℤ) (h_m_le : m ≤ -3) +@@ -1907,7 +1789,7 @@ theorem orderTop_y_sq_lt_a1xy_negFrobenius + refine WithTop.coe_lt_coe.mpr ?_ + linarith + +-/-- **Sub-helper 80** (Y² strictly dominates a₃·Y, given m ≤ -3): for `m ≤ -3`, ++/-- Y² strictly dominates a₃·Y, given m ≤ -3: for `m ≤ -3`, + `Y²` has orderTop = `2m ≤ -6 < m = orderTop(a₃·Y)` (since `2m < m` for `m ≤ -3`). -/ + theorem orderTop_y_sq_lt_a3y_negFrobenius + (hq : 2 ≤ Fintype.card K) (m : ℤ) (h_m_le : m ≤ -3) +@@ -1976,8 +1858,8 @@ theorem orderTop_localExpand_addPullback_y_negFrobenius_eq + congr 1 + omega + +-/-- **Sub-helper 84**: leadingCoeff of `(localExpand X)^3 = 1`, derived from +-sub-helper main companion (`leadingCoeff(localExpand X) = 1`) + leadingCoeff_mul. -/ ++/-- leadingCoeff of `(localExpand X)^3 = 1`, derived from ++`leadingCoeff(localExpand X) = 1` and multiplicativity of leading coefficients. -/ + theorem leadingCoeff_localExpand_addPullback_x_negFrobenius_cube_eq + (hq : 2 ≤ Fintype.card K) : + ((localExpand W (addPullback_x W (negFrobeniusIsog W))) ^ 3 : +@@ -1987,7 +1869,7 @@ theorem leadingCoeff_localExpand_addPullback_x_negFrobenius_cube_eq + leadingCoeff_localExpand_addPullback_x_negFrobenius_eq W hq] + ring + +-/-- **Sub-helper 85**: leadingCoeff of RHS = 1. ++/-- leadingCoeff of RHS = 1. + + Strict-dominance of `X³` on RHS (orderTop -6 < -4 of other terms) gives + `leadingCoeff(RHS) = leadingCoeff(X³) = 1` via `leadingCoeff_add_eq_left`. -/ +@@ -2025,7 +1907,7 @@ theorem leadingCoeff_localExpand_addPullback_RHS_eq + rw [HahnSeries.leadingCoeff_add_eq_left h_lt] + exact leadingCoeff_localExpand_addPullback_x_negFrobenius_cube_eq W hq + +-/-- **Sub-helper 86**: leadingCoeff of LHS = 1. ++/-- leadingCoeff of LHS = 1. + + LHS = RHS (curve equation), so leadingCoeff equal. -/ + theorem leadingCoeff_localExpand_addPullback_LHS_eq +@@ -2040,7 +1922,7 @@ theorem leadingCoeff_localExpand_addPullback_LHS_eq + rw [localExpand_addPullback_curve_equation W] + exact leadingCoeff_localExpand_addPullback_RHS_eq W hq + +-/-- **Sub-helper 87**: leadingCoeff of `Y²` extracted from LHS via strict-dominance. ++/-- leadingCoeff of `Y²` extracted from LHS via strict-dominance. + + For the actual y-orderTop = -3, `Y²` (orderTop = -6) strictly dominates `a₁·X·Y` + (orderTop = -5) and `a₃·Y` (orderTop = -3). So `leadingCoeff(LHS) = leadingCoeff(Y²)`. -/ +@@ -2080,7 +1962,7 @@ theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_sq_eq_one + exact h_lhs_lc + + /-- **MAIN Y-SIDE LEADING-COEFFICIENT**: `(leadingCoeff(localExpand addPullback_y))² = 1` +-for q ≥ 2. From `leadingCoeff(Y²) = 1` (sub-helper 87) + `leadingCoeff_mul`. -/ ++for q ≥ 2. From `leadingCoeff(Y²) = 1` + `leadingCoeff_mul`. -/ + theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_sq + (hq : 2 ≤ Fintype.card K) : + ((localExpand W (addPullback_y W (negFrobeniusIsog W))).leadingCoeff)^2 = 1 := by +@@ -2089,7 +1971,7 @@ theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_sq + rw [sq] + exact h + +-/-- **Sub-helper 89**: `leadingCoeff(localExpand addPullback_y) ≠ 0` for q ≥ 2. ++/-- `leadingCoeff(localExpand addPullback_y) ≠ 0` for q ≥ 2. + Direct from the squared identity = 1 (so leadingCoeff = ±1). -/ + theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_ne_zero + (hq : 2 ≤ Fintype.card K) : +@@ -2099,7 +1981,7 @@ theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_ne_zero + rw [h, sq, mul_zero] at h_sq + exact zero_ne_one h_sq + +-/-- **Sub-helper 89b**: `addPullbackAlgHom_negFrobenius (x_gen) = addPullback_x`. -/ ++/-- `addPullbackAlgHom_negFrobenius (x_gen) = addPullback_x`. -/ + theorem addPullbackAlgHom_negFrobenius_x_gen_eq + (hq : 2 ≤ Fintype.card K) : + addPullbackAlgHom_negFrobenius W hq (x_gen W) = +@@ -2119,7 +2001,7 @@ theorem addPullbackAlgHom_negFrobenius_x_gen_eq + rw [AdjoinRoot.lift_mk] + simp [addBaseHom, Polynomial.eval₂_C] + +-/-- **Sub-helper 89c**: `addPullbackAlgHom_negFrobenius (y_gen) = addPullback_y`. -/ ++/-- `addPullbackAlgHom_negFrobenius (y_gen) = addPullback_y`. -/ + theorem addPullbackAlgHom_negFrobenius_y_gen_eq + (hq : 2 ≤ Fintype.card K) : + addPullbackAlgHom_negFrobenius W hq (y_gen W) = +@@ -2141,8 +2023,7 @@ theorem addPullbackAlgHom_negFrobenius_y_gen_eq + rw [AdjoinRoot.lift_mk] + simp [addBaseHom, Polynomial.eval₂_X] + +-/-- **Sub-helper 90**: +-`localExpand(γ.pullback localParam) = -localExpand(addPullback_x) / localExpand(addPullback_y)` ++/-- `localExpand(γ.pullback localParam) = -localExpand(addPullback_x) / localExpand(addPullback_y)` + for γ = isogOneSub_negFrobenius. Direct ring-hom + AlgHom.commutes_div + map_div₀. -/ + theorem localExpand_isogOneSub_negFrobenius_pullback_localParam + (hq : 2 ≤ Fintype.card K) : +@@ -2155,7 +2036,7 @@ theorem localExpand_isogOneSub_negFrobenius_pullback_localParam + addPullbackAlgHom_negFrobenius_x_gen_eq W hq, + addPullbackAlgHom_negFrobenius_y_gen_eq W hq] + +-/-- **Sub-helper 91**: `(localExpand(γ.pullback localParam)).orderTop = 1` for ++/-- `(localExpand(γ.pullback localParam)).orderTop = 1` for + γ = isogOneSub_negFrobenius. Via `orderTop_div`: `-2 - (-3) = 1`. -/ + theorem orderTop_localExpand_isogOneSub_negFrobenius_pullback_localParam + (hq : 2 ≤ Fintype.card K) : +@@ -2169,7 +2050,7 @@ theorem orderTop_localExpand_isogOneSub_negFrobenius_pullback_localParam + orderTop_localExpand_addPullback_y_negFrobenius_eq W hq] + rfl + +-/-- **Sub-helper 92**: `(localExpand(γ.pullback localParam)).leadingCoeff = -1 / leadingCoeff(Y)` ++/-- `(localExpand(γ.pullback localParam)).leadingCoeff = -1 / leadingCoeff(Y)` + for γ = isogOneSub_negFrobenius. Via `leadingCoeff_div` + `leadingCoeff_neg`. -/ + theorem leadingCoeff_localExpand_isogOneSub_negFrobenius_pullback_localParam + (hq : 2 ≤ Fintype.card K) : +@@ -2181,7 +2062,7 @@ theorem leadingCoeff_localExpand_isogOneSub_negFrobenius_pullback_localParam + rw [HahnSeries.leadingCoeff_neg, + leadingCoeff_localExpand_addPullback_x_negFrobenius_eq W hq] + +-/-- **Sub-helper 93**: `coeff 1 (formal γ) = -1 / leadingCoeff(Y)` for γ = isogOneSub_negFrobenius. ++/-- `coeff 1 (formal γ) = -1 / leadingCoeff(Y)` for γ = isogOneSub_negFrobenius. + + Via `formalIsogenySeries_coeff` + `coeff_untop_eq_leadingCoeff` at orderTop = 1. + This is the LaurentSeries-side computation of `coeff 1 (formal γ)` modulo +@@ -2209,8 +2090,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_eq_neg_one_div_lea + HahnSeries.coeff_untop_eq_leadingCoeff] + exact h_Z_lc + +-/-- **Sub-helper 94** (witness-parametric coeff 1 = 1): with `leadingCoeff(Y) = -1` +-witness, `coeff 1 (formalIsogenySeries γ) = 1` axiom-clean. -/ ++/-- witness-parametric coeff 1 = 1: with `leadingCoeff(Y) = -1` ++witness, `coeff 1 (formalIsogenySeries γ) = 1`. -/ + theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_eq_one_of_y_lc + (hq : 2 ≤ Fintype.card K) + (h_y_lc : (localExpand W (addPullback_y W (negFrobeniusIsog W))).leadingCoeff = -1) : +@@ -2220,9 +2101,8 @@ theorem coeff_one_formalIsogenySeries_isogOneSub_negFrobenius_eq_one_of_y_lc + -- Goal: -1 / -1 = 1 + norm_num + +-/-- **Sub-helper 95** (Witness #1 closer via leadingCoeff(Y) witness + BRIDGE-001 γ): +-takes `leadingCoeff(Y) = -1` as the LaurentSeries-side witness and BRIDGE-001 +-for γ as the K(E)-side witness, fires Witness #1 unconditional. -/ ++/-- A y-coordinate Laurent leading coefficient of `-1`, together with equality of the ++differential and linear formal-series coefficients, implies separability of `1 − π`. -/ + theorem isogOneSub_negFrobenius_isSeparable_via_y_lc_and_bridge_001 + (hq : 2 ≤ Fintype.card K) + (h_y_lc : (localExpand W (addPullback_y W (negFrobeniusIsog W))).leadingCoeff = -1) +@@ -2241,8 +2121,8 @@ theorem isogOneSub_negFrobenius_isSeparable_via_y_lc_and_bridge_001 + exact isogOneSub_negFrobenius_isSeparable_of_bridge_and_leading W hq + h_bridge_001_γ h_leading_add + +-/-- **Sub-helper 96** (omegaPullbackCoeff = 1 via leadingCoeff(Y) + BRIDGE-001 γ): +-companion to 95 producing `omegaPullbackCoeff(γ) = 1`. -/ ++/-- A y-coordinate Laurent leading coefficient of `-1` and the differential/formal-series ++coefficient identity give differential coefficient one for `1 − π`. -/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_y_lc_and_bridge_001 + (hq : 2 ≤ Fintype.card K) + (h_y_lc : (localExpand W (addPullback_y W (negFrobeniusIsog W))).leadingCoeff = -1) +@@ -2261,12 +2141,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_y_lc_and_bridge_00 + exact omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_of_bridge_and_leading W hq + h_bridge_001_γ h_leading_add + +-/-- **Sub-helper 96b** (sign determination — char 2 case axiom-clean): +-in characteristic 2, `(localExpand addPullback_y).leadingCoeff = -1` +-because `c_y² = 1` (sub-helper 88) and `1 = -1` in char 2 (via `CharTwo.neg_eq`). +- +-This pins the sign for characteristic 2 axiom-clean, closing the +-sign-determination work for q = 2^k case. -/ ++/-- In characteristic two the y-coordinate Laurent leading coefficient is `-1`, ++since its square is one and `1 = -1`. -/ + theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_eq_neg_one_char_two + [CharP K 2] + (hq : 2 ≤ Fintype.card K) : +@@ -2294,8 +2170,8 @@ theorem leadingCoeff_localExpand_addPullback_y_negFrobenius_eq_neg_one_char_two + pow_eq_zero_iff (n := 2) (by norm_num : 2 ≠ 0) |>.mp h_c_plus_one_sq + exact eq_neg_of_add_eq_zero_left h_c_plus_one + +-/-- **Sub-helper 98** (Witness #1 char 2): in characteristic 2, the y-side +-sign pin is automatic via 96b. Witness #1 fires with only BRIDGE-001 for γ. -/ ++/-- In characteristic two, equality of the differential and linear formal-series ++coefficients implies separability of `1 − π`. -/ + theorem isogOneSub_negFrobenius_isSeparable_char_two + [CharP K 2] + (hq : 2 ≤ Fintype.card K) +@@ -2307,7 +2183,7 @@ theorem isogOneSub_negFrobenius_isSeparable_char_two + (leadingCoeff_localExpand_addPullback_y_negFrobenius_eq_neg_one_char_two W hq) + h_bridge_001_γ + +-/-- **Sub-helper 99** (omegaPullbackCoeff(γ) = 1 char 2). -/ ++/-- omegaPullbackCoeff(γ) = 1 char 2. -/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_char_two + [CharP K 2] + (hq : 2 ≤ Fintype.card K) +@@ -2319,10 +2195,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_char_two + (leadingCoeff_localExpand_addPullback_y_negFrobenius_eq_neg_one_char_two W hq) + h_bridge_001_γ + +-/-- **Sub-helper 101** (BRIDGE-001 for γ char-2 from omega witness): takes +-`omegaPullbackCoeff(γ) = 1` directly and discharges BRIDGE-001 for γ +-axiom-clean. The LaurentSeries side gives `coeff 1 (formal γ) = 1` via +-y-lc (sub-helper 96b) + ratio chain. -/ ++/-- In characteristic two, differential coefficient one implies its equality with the ++linear formal-series coefficient, which is also one. -/ + theorem bridge_001_γ_isogOneSub_negFrobenius_char_two + [CharP K 2] + (hq : 2 ≤ Fintype.card K) +@@ -2336,7 +2210,7 @@ theorem bridge_001_γ_isogOneSub_negFrobenius_char_two + exact (map_one _).symm + + omit [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in +-/-- **Sub-helper 104** (Frobenius D vanishing): for finite K with characteristic ++/-- Frobenius D vanishing: for finite K with characteristic + p (and `q = #K` a power of p), the Kähler differential of `x_gen^q` vanishes. + + Proof: `D(x^q) = q · x^(q-1) · D(x)` (Leibniz pow), and `(q : K) = 0` since +@@ -2355,9 +2229,8 @@ theorem kaehler_D_x_gen_pow_card_eq_zero + rw [Nat.cast_smul_eq_nsmul, smul_assoc]] + rw [h_card_zero, zero_smul, zero_smul] + +-/-- **Sub-helper 105** (Frobenius D pullback vanishing): the Kähler differential +-of `(frobeniusIsog).pullback x_gen` vanishes. Direct from sub-helper 104 + +-`frobeniusIsog_pullback_apply` (= `x_gen^q`). -/ ++/-- The Kähler differential of the Frobenius pullback of `x_gen` vanishes, because that ++pullback is a q-th power. -/ + theorem kaehler_D_frobeniusIsog_pullback_x_gen + (p : ℕ) [Fact p.Prime] [CharP K p] : + KaehlerDifferential.D K W.toAffine.FunctionField +@@ -2365,7 +2238,7 @@ theorem kaehler_D_frobeniusIsog_pullback_x_gen + rw [frobeniusIsog_pullback_apply] + exact kaehler_D_x_gen_pow_card_eq_zero W p + +-/-- **Sub-helper 106** (Frobenius D pullback y vanishing): the Kähler differential ++/-- Frobenius D pullback y vanishing: the Kähler differential + of `(frobeniusIsog).pullback y_gen` vanishes. Same proof shape as 105. -/ + theorem kaehler_D_frobeniusIsog_pullback_y_gen + (p : ℕ) [Fact p.Prime] [CharP K p] : +@@ -2382,13 +2255,13 @@ theorem kaehler_D_frobeniusIsog_pullback_y_gen + rw [Nat.cast_smul_eq_nsmul, smul_assoc]] + rw [h_card_zero, zero_smul, zero_smul] + +-/-- **Sub-helper 107** (negFrobenius D pullback x vanishing): the Kähler differential ++/-- negFrobenius D pullback x vanishing: the Kähler differential + of `(negFrobeniusIsog).pullback x_gen` vanishes. + + `negFrobeniusIsog = mulByInt(-1) ∘ frobeniusIsog`, so + `(negFrob).pullback x_gen = frobenius.pullback ((mulByInt(-1)).pullback x_gen) = + frobenius.pullback x_gen = x_gen^q` (since `[-1]` fixes `x_gen`). +-Then by sub-helper 104, `D(x_gen^q) = 0`. -/ ++The differential of a q-th power vanishes. -/ + theorem kaehler_D_negFrobeniusIsog_pullback_x_gen + (p : ℕ) [Fact p.Prime] [CharP K p] : + KaehlerDifferential.D K W.toAffine.FunctionField +@@ -2396,13 +2269,13 @@ theorem kaehler_D_negFrobeniusIsog_pullback_x_gen + rw [negFrobeniusIsog_pullback_x_gen] + exact kaehler_D_frobeniusIsog_pullback_x_gen W p + +-/-- **Sub-helper 108** (negFrobenius D pullback y vanishing): the Kähler differential ++/-- negFrobenius D pullback y vanishing: the Kähler differential + of `(negFrobeniusIsog).pullback y_gen` vanishes. + + `(negFrob).pullback y_gen = -π·y_gen - a₁·π·x_gen - a₃` (where π·· = + frobeniusIsog.pullback). The differential operator `D` is a K-derivation, + so `D(constant) = 0` for `a₃ ∈ K`, and `D(a₁ · f) = a₁ · D(f)` for `a₁ ∈ K`, +-and `D(-f) = -D(f)`. Combined with sub-helpers 105-106, all three terms ++and `D(-f) = -D(f)`. Vanishing of both Frobenius coordinate differentials shows that all three terms + vanish. -/ + theorem kaehler_D_negFrobeniusIsog_pullback_y_gen + (p : ℕ) [Fact p.Prime] [CharP K p] : +@@ -2419,7 +2292,7 @@ theorem kaehler_D_negFrobeniusIsog_pullback_y_gen + simp + + omit [Fintype K] in +-/-- **Sub-helper 109** (D(addPullback_x) formula via slope). ++/-- D(addPullback_x) formula via slope. + + For any α : Isogeny W W with `D((α).pullback x_gen) = 0` (i.e., α has its + x-pullback Kähler-flat, true for Frobenius / negFrobenius in characteristic +@@ -2452,9 +2325,9 @@ theorem kaehler_D_addPullback_x_via_slope_witness + (Nat.cast_smul_eq_nsmul (R := KE) 2 _).symm] + rw [smul_smul] + +-/-- **Sub-helper 110** (D(addPullback_x) for negFrobenius — specialized). ++/-- D(addPullback_x) for negFrobenius — specialized. + +-Direct from sub-helper 109 + sub-helper 107: for the addition-pullback ++Differentiating the addition formula and using the vanishing Frobenius differential gives, for the addition-pullback + under negFrobenius, `D(addPullback_x) = (2·ℓ + a₁) • D(ℓ) - D(x_gen)` + where ℓ = addSlope W (negFrobeniusIsog W). + +@@ -2473,7 +2346,7 @@ theorem kaehler_D_addPullback_x_negFrobenius + (kaehler_D_negFrobeniusIsog_pullback_x_gen W p) + + omit [Fintype K] in +-/-- **Route B core (III.5.2), general slope-differential formula** (no `D(α*x)=0` ++/-- **General slope-differential formula** (no `D(α*x)=0` + hypothesis): for any `α`, the Kähler differential of the `id + α` addition-pullback + x-coordinate is the slope term minus `D(x_gen)` minus `D(α*x)`. Generalizes + `kaehler_D_addPullback_x_via_slope_witness` (which drops the last term under the +@@ -2502,19 +2375,8 @@ theorem kaehler_D_addPullback_x_general + rw [show (2 : ℕ) • (ℓ • D ℓ) = ((2 : KE)) • (ℓ • D ℓ) from + (Nat.cast_smul_eq_nsmul (R := KE) 2 _).symm, smul_smul] + +-/-- **Sub-helper 111** (ω(γ) = 1 via Kähler witness). +- +-Closing-arc witness consumer: given that +- `(α*(u))⁻¹ • D(addPullback_x) = invariantDifferential` +-(equivalently, `α*(u) • ω = D(addPullback_x)` for ω = invariantDifferential), +-conclude `omegaPullbackCoeff(γ) = 1`. Direct from +-`omegaPullbackCoeff_spec` + `omegaPullbackCoeff_unique`. +- +-The hypothesis is the SUBSTANTIVE Kähler identity in K(E) that III.5.2 / IV.1.4 +-carries out: relating the slope's differential to the addition-pullback's +-differential. Once this identity is closed (via, e.g., the curve equation +-matching at orderTop -6 and the slope-of-formal-identity lemma), `ω(γ) = 1` +-follows axiom-clean and the Hasse-Weil bound discharges via sub-helper 103. -/ ++/-- The Kähler identity `(α*u)⁻¹ • D(α*x) = ω` gives differential coefficient one. ++This follows from the defining identity and uniqueness of the coefficient. -/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_kaehler_witness + (hq : 2 ≤ Fintype.card K) + (h_kaehler : +@@ -2528,12 +2390,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_kaehler_witness + simp only [x_gen] at h_kaehler + exact h_kaehler + +-/-- **Sub-helper 113** (Kähler ω(γ) = 1 via pullbackKaehler witness — closing-arc). +- +-The cleaner reformulation of sub-helper 111 using `pullbackKaehler` directly: +-given `γ.pullbackKaehler ω = ω`, conclude `omegaPullbackCoeff(γ) = 1`. +- +-Direct from `pullbackKaehler_invariantDifferential` + `omegaPullbackCoeff_unique`. -/ ++/-- An isogeny fixing the invariant differential has differential coefficient one. ++-/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_pullbackKaehler_witness + (hq : 2 ≤ Fintype.card K) + (h_pK : (isogOneSub_negFrobenius W hq).pullbackKaehler +@@ -2544,7 +2402,7 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_pullbackKaehler_wi + exact h_pK + + omit [Fintype K] in +-/-- **Sub-helper 114** (id.pullbackKaehler ω = ω, axiom-clean). ++/-- id.pullbackKaehler ω = ω. + + The identity isogeny acts trivially on the invariant differential. Direct + from `pullbackKaehler_invariantDifferential (Isogeny.id W.toAffine)` + +@@ -2554,28 +2412,15 @@ theorem pullbackKaehler_invariantDifferential_id : + invariantDifferential W.toAffine := by + rw [Isogeny.pullbackKaehler_invariantDifferential, omegaPullbackCoeff_id, one_smul] + +-/-- **Sub-helper 115** ((-π).pullbackKaehler ω = 0, axiom-clean). +- +-The negation-of-Frobenius isogeny annihilates the invariant differential +-(at the cotangent level). Direct from `pullbackKaehler_invariantDifferential +-(negFrobeniusIsog W)` + `omegaPullbackCoeff_negFrobeniusIsog = 0` +-(Differential.lean line 430, axiom-clean). -/ ++/-- Negative Frobenius annihilates the invariant differential, because its ++invariant-differential coefficient is zero. -/ + theorem pullbackKaehler_invariantDifferential_negFrobeniusIsog : + (negFrobeniusIsog W).pullbackKaehler (invariantDifferential W.toAffine) = 0 := by + rw [Isogeny.pullbackKaehler_invariantDifferential, + omegaPullbackCoeff_negFrobeniusIsog, zero_smul] + +-/-- **Sub-helper 116** (γ.pullbackKaehler ω = ω via III.5.2 additivity witness — axiom-clean). +- +-Given the III.5.2 additivity at the differential level for our specific +-decomposition `γ = id + (-π)`: +- `γ.pullbackKaehler ω = id.pullbackKaehler ω + (-π).pullbackKaehler ω`, +-combine with sub-helpers 114-115 (axiom-clean: `id.pullbackKaehler ω = ω` and +-`(-π).pullbackKaehler ω = 0`) to conclude `γ.pullbackKaehler ω = ω + 0 = ω`. +- +-This is the closing-arc commit: the only remaining substantive input is the +-III.5.2 differential additivity for our specific case, which is the III.5.2 +-content for elliptic curve isogenies. -/ ++/-- Differential additivity for `id + (-π)` gives pullback of the invariant differential ++equal to itself, since the identity fixes it and negative Frobenius annihilates it. -/ + theorem pullbackKaehler_invariantDifferential_isogOneSub_negFrobenius_via_additivity_witness + (hq : 2 ≤ Fintype.card K) + (h_add : (isogOneSub_negFrobenius W hq).pullbackKaehler +@@ -2587,11 +2432,8 @@ theorem pullbackKaehler_invariantDifferential_isogOneSub_negFrobenius_via_additi + rw [h_add, pullbackKaehler_invariantDifferential_id W, + pullbackKaehler_invariantDifferential_negFrobeniusIsog W, add_zero] + +-/-- **Sub-helper 117** (ω(γ) = 1 via III.5.2 additivity witness — closing-arc). +- +-Composes sub-helper 113 (Kähler witness → ω(γ) = 1) with sub-helper 116 +-(III.5.2 additivity → γ.pullbackKaehler ω = ω). The single substantive +-input is the III.5.2 differential additivity for our specific decomposition. -/ ++/-- Additivity of the pullback of the invariant differential for `id + (-π)` gives ++differential coefficient one. -/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_additivity_witness + (hq : 2 ≤ Fintype.card K) + (h_add : (isogOneSub_negFrobenius W hq).pullbackKaehler +@@ -2603,20 +2445,9 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one_via_additivity_witness + (pullbackKaehler_invariantDifferential_isogOneSub_negFrobenius_via_additivity_witness + W hq h_add) + +-/-- **Sub-helper 119** (Kähler witness via slope-derivative witness — closing-arc). +- +-Given `D(addSlope W (negFrobeniusIsog W)) = c • D(x_gen)` for some `c : K(E)` +-(derived from differentiating the slope formula `(y_gen - π·y) / (x_gen - π·x)` +-with the Frobenius differential vanishing — sub-helpers 107, 108) and the +-algebraic identity in K(E): +- `(2ℓ + a₁) · c - 1 = (alpha_star_u γ) · u_gen⁻¹` +-(equivalently, after clearing denominators: the K(E) identity that the III.5.2 +-content carries out), conclude the Kähler witness needed by sub-helper 111. +- +-This factors the III.5.2 differential additivity through an explicit K(E) +-identity. The slope-derivative witness is the Kähler-differential form of +-the curve-tangent calculation; the K(E) identity is the substantive arithmetic +-content of III.5.2 for our `id + (-π)` decomposition. -/ ++/-- A slope derivative `D(ℓ) = c • D(x)` and the coefficient identity ++`((2ℓ + a₁)c - 1)u = α*u` imply `(α*u)⁻¹ • D(α*x) = ω` for `α = 1 − π`. ++This expresses differential additivity through an identity in the function field. -/ + theorem kaehler_witness_via_slope_deriv_witness + (p : ℕ) [Fact p.Prime] [CharP K p] + (hq : 2 ≤ Fintype.card K) +@@ -2665,14 +2496,8 @@ theorem kaehler_witness_via_slope_deriv_witness + linear_combination h_KE_identity + + omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in +-/-- **Sub-helper 120** (Weierstrass equation in K(E), axiom-clean): +-`y_gen² + a₁·x_gen·y_gen + a₃·y_gen = x_gen³ + a₂·x_gen² + a₄·x_gen + a₆` +-in K(E). Direct from the affine equation `Affine.Equation` for the generic +-point on `W_KE`, with W_KE coefficients lifted to algebraMap form. +- +-This is the foundational K(E) identity that the curve-equation Kähler +-differential identity (sub-helper 121) builds upon. No derivation involved +-yet — purely the equation in K(E). -/ ++/-- The generic coordinates satisfy the Weierstrass equation in the function field. ++-/ + theorem weierstrass_equation_in_KE : + y_gen W ^ 2 + algebraMap K KE W.a₁ * x_gen W * y_gen W + + algebraMap K KE W.a₃ * y_gen W = +@@ -2684,14 +2509,8 @@ theorem weierstrass_equation_in_KE : + exact h_gen + + omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in +-/-- **Sub-helper 121** (Kähler form of curve equation, axiom-clean foundation): +-literal D-application of the Weierstrass equation in K(E): +-`D(y² + a₁xy + a₃y) = D(x³ + a₂x² + a₄x + a₆)` in `Ω[K(E)/K]`. +- +-Direct from `congrArg D` applied to `weierstrass_equation_in_KE` (sub-helper +-120). The substantive Kähler identity `(a₃ + 2y + a₁x)·Dy = (3x² + 2a₂x + +-a₄ - a₁y)·Dx` follows by Leibniz expansion; the explicit ℕ-smul ↔ KE-smul +-conversion in that expansion is technical and deferred. -/ ++/-- Applying the universal derivation to the generic Weierstrass equation gives ++`D(y² + a₁xy + a₃y) = D(x³ + a₂x² + a₄x + a₆)` in `Ω[K(E)/K]`. -/ + theorem kaehler_D_weierstrass_equation_K_E : + KaehlerDifferential.D K W.toAffine.FunctionField + (y_gen W ^ 2 + +@@ -2706,9 +2525,8 @@ theorem kaehler_D_weierstrass_equation_K_E : + (weierstrass_equation_in_KE W) + + omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in +-/-- **Sub-helper 122** (D(y²) via pow_two — axiom-clean KE-smul-only): +-`D(y_gen²) = y_gen • D(y_gen) + y_gen • D(y_gen)`. Wall-break: avoids +-`Derivation.leibniz_pow`'s ℕ-smul. -/ ++/-- D(y²) via pow_two — KE-smul-only: ++`D(y_gen²) = y_gen • D(y_gen) + y_gen • D(y_gen)`. The product rule expresses both summands using function-field scalar multiplication. -/ + theorem kaehler_D_y_gen_sq : + KaehlerDifferential.D K W.toAffine.FunctionField (y_gen W ^ 2) = + y_gen W • KaehlerDifferential.D K W.toAffine.FunctionField (y_gen W) + +@@ -2717,7 +2535,7 @@ theorem kaehler_D_y_gen_sq : + (KaehlerDifferential.D K W.toAffine.FunctionField).leibniz (y_gen W) (y_gen W)] + + omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in +-/-- **Sub-helper 123** (D(x²) via pow_two — axiom-clean): ++/-- D(x²) via pow_two —: + `D(x_gen²) = x_gen • D(x_gen) + x_gen • D(x_gen)`. -/ + theorem kaehler_D_x_gen_sq : + KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W ^ 2) = +@@ -2727,7 +2545,7 @@ theorem kaehler_D_x_gen_sq : + (KaehlerDifferential.D K W.toAffine.FunctionField).leibniz (x_gen W) (x_gen W)] + + omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in +-/-- **Sub-helper 124** (D(x³) via pow expansion + leibniz — axiom-clean): ++/-- D(x³) via pow expansion + leibniz —: + `D(x_gen³) = x_gen² • D(x_gen) + x_gen • D(x_gen²)`. -/ + theorem kaehler_D_x_gen_cube : + KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W ^ 3) = +@@ -2739,9 +2557,8 @@ theorem kaehler_D_x_gen_cube : + (KaehlerDifferential.D K W.toAffine.FunctionField).leibniz (x_gen W ^ 2) (x_gen W)] + + omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in +-/-- **Sub-helper 125** (D-distribution of Weierstrass equation LHS, axiom-clean): +-fully Leibniz-expanded LHS in KE-smul-only form. Uses sub-helper 122 (D(y²) +-bypass) + Derivation.leibniz + D.map_algebraMap. -/ ++/-- Applying the product rule to the left-hand side of the Weierstrass equation gives ++its expansion using function-field scalar multiplication. -/ + theorem kaehler_D_weierstrass_LHS_expanded : + KaehlerDifferential.D K W.toAffine.FunctionField + (y_gen W ^ 2 + +@@ -2770,8 +2587,8 @@ theorem kaehler_D_weierstrass_LHS_expanded : + simp only [smul_zero, add_zero] + + omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in +-/-- **Sub-helper 126** (D-distribution of Weierstrass equation RHS, axiom-clean): +-fully Leibniz-expanded RHS. Uses sub-helpers 123, 124. -/ ++/-- D-distribution of Weierstrass equation RHS: ++fully Leibniz-expanded RHS. The product rule expands the square and cube. -/ + theorem kaehler_D_weierstrass_RHS_expanded : + KaehlerDifferential.D K W.toAffine.FunctionField + (x_gen W ^ 3 + +@@ -2803,17 +2620,10 @@ theorem kaehler_D_weierstrass_RHS_expanded : + (KaehlerDifferential.D K W.toAffine.FunctionField).map_algebraMap W.a₆] + simp only [smul_zero, add_zero] + +-/-- **Sub-helper 127** (curve-equation Kähler identity, axiom-clean): +- ++omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in ++/-- Differentiating the Weierstrass equation gives + `(a₃ + 2y + a₁x) • D(y) = (3x² + 2a₂x + a₄ - a₁y) • D(x)` in `Ω[K(E)/K]`. +- +-Combines sub-helper 121 (D(LHS) = D(RHS) via congrArg) + 125 (LHS expansion) +-+ 126 (RHS expansion) + `linear_combination`. All KE-smul throughout — +-ℕ-smul wall bypassed via sub-helpers 122-124. +- +-This is the SUBSTANTIVE K(E) Kähler identity. NO witnesses. Foundational +-for sub-helper 128 (D(slope)) and the III.5.2 invariant-differential +-additivity. -/ ++-/ + theorem kaehler_curve_equation_K_E : + (algebraMap K KE W.a₃ + (2 : KE) * y_gen W + + algebraMap K KE W.a₁ * x_gen W) • +@@ -2823,10 +2633,7 @@ theorem kaehler_curve_equation_K_E : + algebraMap K KE W.a₄ - + algebraMap K KE W.a₁ * y_gen W) • + KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) := by +- -- Sixth wall-break attempt: pre-rewrite goal `(2 : KE) * y_gen` to +- -- `y_gen + y_gen` using ring identities BEFORE expansion, eliminating the +- -- (2 : KE) literal at the source. Then both sides use only +-additive +- -- composition + KE-smul, no `(2 : ℕ)` casts anywhere. ++ -- Expand the integer coefficients as sums in the function field before differentiating. + set Dx := KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) + set Dy := KaehlerDifferential.D K W.toAffine.FunctionField (y_gen W) + -- Substitute literals with explicit sums in K(E). +@@ -2851,24 +2658,9 @@ theorem kaehler_curve_equation_K_E : + -- Now both sides are sums of (KE-coefficient) • (Dx or Dy). Match via abel. + linear_combination (norm := abel) h_eq + +-/-- **Sub-helper 128** (D(addSlope) for negFrobenius — substantive K(E) identity, axiom-clean): +- +-The Kähler derivative of `addSlope W (negFrobeniusIsog W) = +-(y_gen - π·y) / (x_gen - π·x)` satisfies the closed-form identity: +- +-``` +-(x_gen - π·x)² • D(addSlope) = (x_gen - π·x) • D(y_gen) - (y_gen - π·y) • D(x_gen) +-``` +- +-where π·x = (negFrob).pullback x_gen, π·y = (negFrob).pullback y_gen. +- +-Proof: apply `Derivation.leibniz_div` to `addSlope_negFrobeniusIsog_eq`, +-simplify via `D(π·x) = 0` (sub-helper 107), `D(π·y) = 0` (sub-helper 108), +-cancel Den² · Den⁻² = 1. +- +-This is the SUBSTANTIVE K(E) Kähler identity for the addition slope — +-NO witnesses, NO hypotheses beyond Mathlib's quotient rule and the +-existing Frobenius-differential vanishing (axiom-clean). -/ ++/-- The quotient rule and vanishing of Frobenius differentials give ++`Den² • D(ℓ) = Den • D(y) - N • D(x)` for the addition slope, where ++`Den = x - (-π)*x` and `N = y - (-π)*y`. -/ + theorem kaehler_D_addSlope_negFrobenius + (p : ℕ) [Fact p.Prime] [CharP K p] : + (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 • +@@ -2902,7 +2694,7 @@ theorem kaehler_D_addSlope_negFrobenius + rw [one_smul] + + omit [Fintype K] in +-/-- **Route B core (III.5.2), general slope differential** (no Frobenius flatness): for any `α` ++/-- **General slope differential** (no Frobenius flatness): for any `α` + with `x_gen ≠ α*x_gen` (non-doubling), the Kähler derivative of `addSlope = (y−α*y)/(x−α*x)` + satisfies `Den²·D(addSlope) = Den·(D(y)−D(α*y)) − N·(D(x)−D(α*x))` where `N = y−α*y`, + `Den = x−α*x`. Generalizes `kaehler_D_addSlope_negFrobenius` (which used `D(π*x)=D(π*y)=0`). -/ +@@ -2931,10 +2723,9 @@ theorem kaehler_D_addSlope_general + show Den ^ 2 * Den⁻¹ ^ 2 = 1 from by rw [← mul_pow, mul_inv_cancel₀ hDen_ne, one_pow], + one_smul] + +-/-- **Sub-helper 129** (D(γ.pullback x_gen) cleared form, axiom-clean): ++/-- D(γ.pullback x_gen) cleared form: + +-Combines sub-helper 110 (`D(addPullback_x) = (2ℓ + a₁) • D(ℓ) - D(x_gen)`) +-with sub-helper 128 (`Den² • D(addSlope) = Den • D(y_gen) - N • D(x_gen)`) ++Combines the differentiated addition formula with the denominator-cleared slope derivative + to give a single closed-form identity for D(γ.pullback x_gen) involving + D(y_gen) and D(x_gen) (with Den² as the multiplier). + +@@ -2949,7 +2740,7 @@ where ℓ = addSlope, Den = x_gen - π·x, N = y_gen - π·y. + + This is the substantive D(γ.pullback x_gen) reduction in K(E), expressed + purely in terms of the curve generators' Kähler differentials and Den, N +-without any inverses. Foundational for the III.5.2 cascade closure. -/ ++without any inverses. This is a differential form of Silverman III.5.2. -/ + theorem kaehler_D_addPullback_x_negFrobenius_cleared + (p : ℕ) [Fact p.Prime] [CharP K p] : + (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 • +@@ -2963,14 +2754,14 @@ theorem kaehler_D_addPullback_x_negFrobenius_cleared + KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W)) - + (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 • + KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) := by +- -- Multiply sub-helper 110 by Den² and use sub-helper 128. ++ -- Multiply the x-coordinate differential by Den² and substitute the slope derivative. + rw [kaehler_D_addPullback_x_negFrobenius W p, smul_sub, smul_smul] + rw [mul_comm ((x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2) + (2 * addSlope W (negFrobeniusIsog W) + algebraMap K KE W.a₁)] + rw [← smul_smul, kaehler_D_addSlope_negFrobenius W p, smul_sub] + + omit [Fintype K] in +-/-- **Route B core (III.5.2), general cleared form**: combines `kaehler_D_addPullback_x_general` ++/-- **General cleared form**: combines `kaehler_D_addPullback_x_general` + with `kaehler_D_addSlope_general` to clear the `Den²` denominator from `D(addPullback_x)` for + arbitrary `α` (non-doubling). Generalizes `kaehler_D_addPullback_x_negFrobenius_cleared`. -/ + theorem kaehler_D_addPullback_x_general_cleared +@@ -3004,8 +2795,9 @@ theorem kaehler_D_x_gen_eq_u_smul_omega : + (u_gen W)⁻¹ • KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) from rfl, + smul_smul, mul_inv_cancel₀ (u_gen_ne_zero W), one_smul] + ++omit [Fintype K] [DecidableEq K] in + /-- **RB-ω2 leaf**: `D(y_gen) = (3x²+2a₂x+a₄−a₁y) • ω`. From the curve-equation differential +-`u_gen·D(y) = (3x²+2a₂x+a₄−a₁y)·D(x)` (Sub-helper 121 chain) and `D(x) = u_gen·ω` (RB-ω1), ++`u_gen·D(y) = (3x²+2a₂x+a₄−a₁y)·D(x)` from the differentiated curve equation and `D(x) = u_gen·ω` , + dividing through by `u_gen ≠ 0`. Silverman III.5: the relation `(2y+a₁x+a₃)dy = + (3x²+2a₂x+a₄−a₁y)dx` from differentiating the Weierstrass equation. -/ + theorem kaehler_D_y_gen_eq_num_smul_omega : +@@ -3032,7 +2824,7 @@ omit [Fintype K] in + /-- **RB-ω3 leaf** (α-image differentials): for the omega coefficient + `a_α = omegaPullbackCoeff W α`, `D(α*x) = (α*u)·a_α·ω` and `D(α*y) = (α*num)·a_α·ω`. From + `omegaPullbackCoeff_spec` (`a_α•ω = (α*u)⁻¹•D(α*x)`) and the α-image curve-equation differential +-(Sub-helper 121 at the pulled-back point `(α*x, α*y)`, also on the curve by `pullback_equation`). -/ ++(the differentiated curve equation at the pulled-back point `(α*x, α*y)`, also on the curve by `pullback_equation`). -/ + theorem kaehler_D_alpha_pullback_x_eq_smul_omega + (α : Isogeny W.toAffine W.toAffine) : + KaehlerDifferential.D K W.toAffine.FunctionField (α.pullback (x_gen W)) = +@@ -3049,6 +2841,7 @@ theorem kaehler_D_alpha_pullback_x_eq_smul_omega + rw [hspec, smul_smul, mul_inv_cancel₀ h_au_ne, one_smul] + rw [← key, smul_smul] + ++omit [Fintype K] in + /-- **RB-ω3b leaf** (α-image `D(y)`): `D(α*y) = (α*num)·a_α·ω`. From the α-image curve-equation + differential (apply `Isogeny.pullbackKaehler` to `kaehler_curve_equation_K_E` — `pullbackKaehler` is + α-semilinear and sends `D g ↦ D(α*g)`) + `kaehler_D_alpha_pullback_x_eq_smul_omega` (RB-ω3a), cancel +@@ -3094,6 +2887,7 @@ theorem kaehler_D_alpha_pullback_y_eq_smul_omega + congr 1 + ring + ++omit [Fintype K] in + /-- **RB-ω4 leaf (the III.5.2 ring collapse)**: for genuine α (x≠α*x), the differential of the + addition-pullback x-coordinate equals `addPullback_u • (1 + a_α) • ω`, where + `addPullback_u = 2·addPullback_y + a₁·addPullback_x + a₃` is the u-coordinate at the sum point. +@@ -3151,23 +2945,11 @@ theorem kaehler_D_addPullback_x_eq_one_add_smul_omega + (-(2 * (Y - PY) + c1 * (X - PX)) * (1 - omegaPullbackCoeff W α)) * hP + + ((2 * (Y - PY) + c1 * (X - PX)) * (1 - omegaPullbackCoeff W α)) * hαP + +-/-- **Sub-helper 130** (D(addSlope) reduced to D(x_gen) via curve equation, axiom-clean): +- +-Combines sub-helper 127 (curve equation Kähler identity) with sub-helper 128 +-(D(slope) identity) to express D(addSlope) entirely in terms of D(x_gen): +- +-``` +-(u_gen · Den²) • D(addSlope) = (Den · num - u_gen · N) • D(x_gen) +-``` +- +-where: +-- u_gen = a₃ + 2y + a₁x +-- Den = x - π·x +-- N = y - π·y +-- num = 3x² + 2a₂x + a₄ - a₁y +- +-Substantive K(E) Kähler identity — combines axiom-clean Path A sub-helpers +-127 + 128. Foundational for ω(γ) = 1 via the Kähler-witness route. -/ ++/-- The differential of the addition slope satisfies ++`(u · Den²) • D(ℓ) = (Den · num - u · N) • D(x)`, where ++`u = a₃ + 2y + a₁x`, `num = 3x² + 2a₂x + a₄ - a₁y`, ++`Den = x - (-π)*x`, and `N = y - (-π)*y`. ++This combines the quotient rule with the differentiated curve equation. -/ + theorem kaehler_D_addSlope_via_curve_equation_negFrobenius + (p : ℕ) [Fact p.Prime] [CharP K p] : + ((algebraMap K KE W.a₃ + (2 : KE) * y_gen W + +@@ -3184,7 +2966,7 @@ theorem kaehler_D_addSlope_via_curve_equation_negFrobenius + algebraMap K KE W.a₁ * x_gen W) * + (y_gen W - (negFrobeniusIsog W).pullback (y_gen W))) • + KaehlerDifferential.D K W.toAffine.FunctionField (x_gen W) := by +- -- Multiply sub-helper 128 by u_gen' on the left, then substitute via 127. ++ -- Multiply the slope derivative by u, then substitute the differentiated curve equation. + have h_slope := kaehler_D_addSlope_negFrobenius W p + have h_curve := kaehler_curve_equation_K_E W + -- Step 1: multiply h_slope by u_gen' (smul-distribute). +@@ -3203,13 +2985,8 @@ theorem kaehler_D_addSlope_via_curve_equation_negFrobenius + -- Now collect smul forms. + rw [smul_smul, smul_smul, ← sub_smul] + +-/-- **Sub-helper 131** (`alpha_star_u` computed explicitly for γ, axiom-clean): +-the explicit form of `alpha_star_u (isogOneSub_negFrobenius W hq)` in K(E): +-`α*(u) = 2·addPullback_y + a₁·addPullback_x + a₃`. +- +-Direct from `alpha_star_u_eq` + sub-helpers 89b, 89c (axiom-clean +-`γ.pullback x_gen = addPullback_x` and `γ.pullback y_gen = addPullback_y`) +-+ `u_gen` definition. -/ ++/-- For `γ = 1 − π`, the pulled-back differential denominator is ++`α*u = 2·addPullback_y + a₁·addPullback_x + a₃`. -/ + theorem alpha_star_u_isogOneSub_negFrobenius + (hq : 2 ≤ Fintype.card K) : + alpha_star_u W (isogOneSub_negFrobenius W hq) = +@@ -3233,13 +3010,13 @@ theorem alpha_star_u_isogOneSub_negFrobenius + rw [(isogOneSub_negFrobenius W hq).pullback.commutes W.a₁, + (isogOneSub_negFrobenius W hq).pullback.commutes W.a₃] + +-/-- **Sub-helper 132** (α*(u) + u_gen identity in K(E), axiom-clean): ++/-- α*(u) + u_gen identity in K(E): + + `α*(u) + u_gen = -(2ℓ + a₁) · (addPullback_x - x_gen)` in K(E) + + where ℓ = addSlope W (negFrobeniusIsog W). + +-Proof: substitute α*(u) = 2·addPullback_y + a₁·addPullback_x + a₃ (sub-helper 131) ++Proof: substitute α*(u) = 2·addPullback_y + a₁·addPullback_x + a₃ + and addPullback_y via Affine.addY/negY/negAddY definitional unfoldings, + then verify by ring algebra in K(E). + +@@ -3247,8 +3024,7 @@ This is the substantive K(E) identity that simplifies the RHS of the + target Kähler-witness identity to: + `(α*(u) + u_gen) · Den² = -(2ℓ + a₁) · (addPullback_x - x_gen) · Den²`. + +-Combined with sub-helper 130 (LHS reduction), the target K(E) identity +-becomes a sub-divisible polynomial identity. -/ ++Together with the slope derivative formula, this reduces differential additivity to a polynomial identity. -/ + theorem alpha_star_u_plus_u_gen_negFrobenius + (hq : 2 ≤ Fintype.card K) : + alpha_star_u W (isogOneSub_negFrobenius W hq) + u_gen W = +@@ -3266,7 +3042,7 @@ theorem alpha_star_u_plus_u_gen_negFrobenius + rw [h_a1, h_a2, h_a3] + ring + +-/-- **Sub-helper 133** (curve equation for π·(x_gen, y_gen) in K(E), axiom-clean): ++/-- curve equation for π·(x_gen, y_gen) in K(E): + + The π-shifted Weierstrass equation in K(E): + `(π·y)² + a₁(π·x)(π·y) + a₃(π·y) = (π·x)³ + a₂(π·x)² + a₄(π·x) + a₆` +@@ -3274,7 +3050,7 @@ The π-shifted Weierstrass equation in K(E): + where π·x = (negFrob).pullback x_gen, π·y = (negFrob).pullback y_gen. + + Proof: apply `(negFrobeniusIsog W).pullback` (a K-algebra hom) to +-`weierstrass_equation_in_KE` (sub-helper 120). The hom respects + and * ++`weierstrass_equation_in_KE`. The hom respects + and * + and fixes algebraMap-images of K, so the equation transforms term-by-term. -/ + theorem weierstrass_equation_pi_negFrobenius : + (negFrobeniusIsog W).pullback (y_gen W) ^ 2 + +@@ -3296,7 +3072,7 @@ theorem weierstrass_equation_pi_negFrobenius : + AlgHom.commutes (negFrobeniusIsog W).pullback] at h_pi + exact h_pi + +-/-- **Sub-helper 134** (substantive K(E) polynomial identity for III.5.2, axiom-clean): ++/-- substantive K(E) polynomial identity for III.5.2: + + The K(E) ring identity that closes the Kähler-witness route to ω(γ) = 1: + +@@ -3316,7 +3092,7 @@ where: + + Proof: substitute the slope formula `ℓ = (y - π·y)/(x - π·x)` (squared and + multiplied by Den² gives the polynomial form), then close via +-`linear_combination` with the two curve equations (sub-helpers 120 + 133) ++`linear_combination` with the two curve equations + as multipliers. The identity holds because γ = id - π is a curve isogeny, + which respects the curve equation. + +@@ -3342,7 +3118,7 @@ theorem kaehler_witness_polynomial_identity_negFrobenius : + have h_curve_pi := weierstrass_equation_pi_negFrobenius W + linear_combination -h_curve + h_curve_pi + +-/-- **Sub-helper 135** ((addPullback_x - x_gen) · Den² polynomial form, axiom-clean): ++/-- (addPullback_x - x_gen) · Den² polynomial form: + + ``` + (addPullback_x - x_gen) · Den² = +@@ -3355,7 +3131,7 @@ slope formula `ℓ = (y - π·y) / (x - π·x)` giving `ℓ · (x - π·x) = (y + hence `ℓ² · (x - π·x)² = (y - π·y)²` and `ℓ · (x - π·x)² = (y - π·y) · (x - π·x)`. + + Substantive polynomial-form bridge between the slope-divisor identity +-and the curve-equation polynomial identity (sub-helper 134). -/ ++and the curve-equation polynomial identity. -/ + theorem addPullback_x_sub_x_gen_mul_Den_sq_negFrobenius : + (addPullback_x W (negFrobeniusIsog W) - x_gen W) * + (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 = +@@ -3394,18 +3170,8 @@ theorem addPullback_x_sub_x_gen_mul_Den_sq_negFrobenius : + algebraMap K KE W.a₁ * + (x_gen W - (negFrobeniusIsog W).pullback (x_gen W))) * h_slope_lin + +-/-- **Sub-helper 136** (curve-equation form of K(E) Kähler-witness identity, axiom-clean): +- +-``` +-Den · num - u_gen · N + (addPullback_x - x_gen) · Den² = 0 +-``` +- +-Combines sub-helper 134 (polynomial form identity) with sub-helper 135 +-(`(addPullback_x - x_gen) · Den² = polynomial form`) to give the K(E) +-identity in the form needed by the Kähler-witness consumer. +- +-This is THE identity that closes ω(γ) = 1 / Witness #1 / III.5.2 via +-the Kähler witness route. -/ ++/-- The two curve equations and the addition formula give ++`Den · num - u · N + (addPullback_x - x) · Den² = 0` in the function field. -/ + theorem kaehler_witness_curve_form_negFrobenius : + (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) * + ((3 : KE) * x_gen W ^ 2 + +@@ -3420,14 +3186,8 @@ theorem kaehler_witness_curve_form_negFrobenius : + rw [addPullback_x_sub_x_gen_mul_Den_sq_negFrobenius W] + exact kaehler_witness_polynomial_identity_negFrobenius W + +-/-- **Sub-helper 137** (K(E) coefficient identity for Kähler witness, axiom-clean): +-the K(E) coefficient identity that closes the Kähler-witness chain: +- +-``` +-(2ℓ + a₁) · (Den · num - u_gen · N) = (α*(u) + u_gen) · Den² +-``` +- +-Combines sub-helpers 132 + 136 axiom-clean. -/ ++/-- The addition formulas and curve equations give the coefficient identity ++`(2ℓ + a₁)(Den · num - u · N) = (α*u + u) · Den²`. -/ + theorem kaehler_witness_coefficient_identity_negFrobenius + (hq : 2 ≤ Fintype.card K) : + ((2 : KE) * addSlope W (negFrobeniusIsog W) + +@@ -3443,7 +3203,7 @@ theorem kaehler_witness_coefficient_identity_negFrobenius + (alpha_star_u W (isogOneSub_negFrobenius W hq) + u_gen W) * + (x_gen W - (negFrobeniusIsog W).pullback (x_gen W)) ^ 2 := by + rw [alpha_star_u_plus_u_gen_negFrobenius W hq] +- -- Use sub-helper 136 (curve-form K(E) identity, axiom-clean): ++ -- The curve-form identity gives: + -- Den·num - u_gen·N + (addPullback_x - x_gen)·Den² = 0. + -- Multiply by (2ℓ+a₁) to get: (2ℓ+a₁)·(Den·num - u_gen·N + (addPullback_x - x_gen)·Den²) = 0. + -- Rearrange to: (2ℓ+a₁)·(Den·num - u_gen·N) = -(2ℓ+a₁)·(addPullback_x - x_gen)·Den². +@@ -3451,16 +3211,9 @@ theorem kaehler_witness_coefficient_identity_negFrobenius + linear_combination + (2 * addSlope W (negFrobeniusIsog W) + algebraMap K KE W.a₁) * h_136 + +-/-- **Sub-helper 138** (ω(γ) = 1 axiom-clean — Witness #1 omega-coefficient). +- +-Instantiates `kaehler_witness_via_slope_deriv_witness` with the explicit +-witness `c := (Den · num - u · N) / (u · Den²)`, where `u = a₃ + 2y + a₁x`, +-`Den = x - π·x`, `N = y - π·y`, `num = 3x² + 2a₂x + a₄ - a₁y`. +- +-The slope-deriv witness `D(addSlope) = c • D(x_gen)` follows from sub-helper +-130 by smul-cancelling `u · Den²`. The K(E) coefficient identity +-`((2ℓ + a₁) · c - 1) · u_gen = α*(u)` follows from sub-helper 137 by +-field-simplification + linear_combination. -/ ++/-- The invariant-differential coefficient of `1 − π` is one. ++The slope derivative has coefficient `c = (Den · num - u · N)/(u · Den²)` relative ++to `D(x)`, and the two curve equations give `((2ℓ + a₁)c - 1)u = α*u`. -/ + theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one + (p : ℕ) [Fact p.Prime] [CharP K p] + (hq : 2 ≤ Fintype.card K) : +@@ -3496,11 +3249,8 @@ theorem omegaPullbackCoeff_isogOneSub_negFrobenius_eq_one + sub_eq_iff_eq_add, div_eq_iff huDen_ne] + linear_combination u * h_137 + +-/-- **Sub-helper 139** (Witness #1 axiom-clean — IsSeparable γ). +- +-Composes sub-helper 138 (ω(γ) = 1 axiom-clean) with +-`isogOneSub_negFrobenius_isSeparable_of_h_coeff_only` (T-II-4-004 absorbed, +-axiom-clean) to produce the unconditional Witness #1 of the Hasse-Weil bound. -/ ++/-- The isogeny `1 − π` is separable, because its invariant-differential coefficient ++is one. -/ + theorem isogOneSub_negFrobenius_isSeparable + (p : ℕ) [Fact p.Prime] [CharP K p] + (hq : 2 ≤ Fintype.card K) : +@@ -3607,7 +3357,7 @@ rule (`kaehler_D_addSlopePair_clearDenomSq`) with the `addX` Leibniz expansion + (`kaehler_D_addPullback_x_pair_via_slope`) into a single denominator-free expression for + `(X₁ - X₂)² • D(addPullback_x_pair)`. A leaf of + `kaehler_D_addPullback_x_pair_eq_smul_omega`. -/ +-private theorem kaehler_D_addPullback_x_pair_clearDenomSq ++theorem kaehler_D_addPullback_x_pair_clearDenomSq + (α₁ α₂ : Isogeny W.toAffine W.toAffine) + (h_ne : α₁.pullback (x_gen W) ≠ α₂.pullback (x_gen W)) : + (α₁.pullback (x_gen W) - α₂.pullback (x_gen W)) ^ 2 • +@@ -3641,7 +3391,7 @@ unfolding `addPullback_x/y_pair` and `alpha_star_u`, substituting the two pullba + equations (`pullback_equation α₁/α₂`), clearing the denominator, and closing with the free-variable + algebra core `kaehler_D_addPullback_x_pair_ring_identity`. The scalar half of + `kaehler_D_addPullback_x_pair_eq_smul_omega`. -/ +-private theorem kaehler_D_addPullback_x_pair_coeff_collapse ++theorem kaehler_D_addPullback_x_pair_coeff_collapse + (α₁ α₂ : Isogeny W.toAffine W.toAffine) + (h_ne : α₁.pullback (x_gen W) ≠ α₂.pullback (x_gen W)) : + (2 * addSlopePair α₁ α₂ + algebraMap K KE W.a₁) * +@@ -3691,6 +3441,7 @@ private theorem kaehler_D_addPullback_x_pair_coeff_collapse + (omegaPullbackCoeff W α₁) (omegaPullbackCoeff W α₂) (algebraMap K KE W.a₂) + (algebraMap K KE W.a₃) (algebraMap K KE W.a₄) (algebraMap K KE W.a₆) hα₁ hα₂ + ++omit [Fintype K] in + /-- **General-pair III.5.2 differential collapse**: for genuine pairs (`α₁*x ≠ α₂*x`), the + differential of the pair addition `x`-coordinate is + `u₃ • ((a_{α₁} + a_{α₂}) • ω)`, where `u₃ = 2·addPullback_y_pair + a₁·addPullback_x_pair + a₃` +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/DiffQuotientRule.lean b/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/DiffQuotientRule.lean +index 218313002..5de8144cd 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/DiffQuotientRule.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/DiffQuotientRule.lean +@@ -22,6 +22,7 @@ variable (E : Affine F) [E.IsElliptic] + local notation "KE" => E.FunctionField + + omit [DecidableEq F] in ++omit [WeierstrassCurve.IsElliptic E] in + /-- `D(f⁻¹) = -f⁻² • D(f)` for nonzero `f ∈ K(E)`. -/ + theorem D_inv_smul (f : KE) (hf : f ≠ 0) : + KaehlerDifferential.D F KE f⁻¹ = +@@ -36,7 +37,7 @@ theorem D_inv_smul (f : KE) (hf : f ≠ 0) : + _ = f⁻¹ • (-(f⁻¹ • D f)) := by rw [h3] + _ = -(f⁻¹ ^ 2 • D f) := by rw [smul_neg, smul_smul, ← sq] + +-omit [DecidableEq F] in ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic E] in + /-- `D(f * g⁻¹) = g⁻¹ • D(f) + (stuff involving D(g))`. Leibniz + inverse rule. -/ + theorem D_mul_inv_smul (f g : KE) (hg : g ≠ 0) : + KaehlerDifferential.D F KE (f * g⁻¹) = +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/EllipticDivisibilitySequence.lean b/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/EllipticDivisibilitySequence.lean +index b07632812..bf6d0816a 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/EllipticDivisibilitySequence.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Auxiliary/EllipticDivisibilitySequence.lean +@@ -12,21 +12,6 @@ import Mathlib.NumberTheory.EllipticDivisibilitySequence + import Mathlib.Tactic.IntervalCases + import Mathlib.Tactic.LinearCombination + +-/-! +-# Additional lemmas for elliptic divisibility sequences +- +-This file provides definitions and lemmas about normalised elliptic divisibility sequences +-that are not yet in mathlib. These are needed for the division polynomial / ZSMul development. +- +-The key results are: +-* `IsEllipticSequence.normEDS`: a normalised EDS is an elliptic sequence. +-* `IsEllipticSequence.ext`: two elliptic sequences with the same first four terms are equal. +-* `normEDS_two_three_two`: when `b = 2, c = 3, d = 2`, the normalised EDS is the identity. +-* `complEDSAux₂`: auxiliary complement used in the `ω` definition. +-* `redInvarDenom`, `redInvarNum`: reduced invariant decomposition. +- +-Ported from the LutzNagell project (`LutzNagell/EllipticDivisibilitySequence.lean`). +--/ + + open scoped nonZeroDivisors + +@@ -417,12 +402,12 @@ theorem rel₄_of_anti_oddRec_evenRec (one : W 1 ∈ R⁰) (two : W 2 ∈ R⁰) + linarith only [hba] + obtain ⟨m, rfl|rfl⟩ := b.even_or_odd' + · have ea : Even a := by rw [← ha']; exact (even_two_mul _).add even_two +- simp_rw [cMin, dMin, if_pos ea] ++ simp_rw [cMin, dMin, ite_eq_left ea] + convert (rel₃_iff₄ W (m + 1) m 1).mp ((rel₃_iff_oddRec W m).mpr <| oddRec _ ?_) using 2 + all_goals linarith only [h6, ha'] + · have nea : ¬ Even a := by + rw [← ha', not_even_iff_odd]; convert odd_two_mul_add_one (m + 1) using 1; ring +- simp_rw [cMin, dMin, if_neg nea] ++ simp_rw [cMin, dMin, ite_eq_right nea] + convert (rel₄_iff_evenRec W (m + 1)).mpr (evenRec _ ?_) using 2 + all_goals linarith only [h6, ha'] + +@@ -623,9 +608,9 @@ lemma invarDenom_normEDS_two : + simp [EllSequence.invarDenom] + + lemma normEDS_six_eq_mul : normEDS b c d 6 = (normEDS b c d 5 - d ^ 2) * b * c := by +- rw [show (6 : ℤ) = 2 * 3 by rfl, ← normEDS_mul_complEDS₂, complEDS₂, if_neg (by decide)] ++ rw [show (6 : ℤ) = 2 * 3 by rfl, ← normEDS_mul_complEDS₂, complEDS₂, ite_eq_right (by decide)] + simp_rw [Int.reduceAdd, Int.reduceSub, normEDS_three, normEDS] +- rw [preNormEDS_one, preNormEDS_two, preNormEDS_four, if_neg (by decide)] ++ rw [preNormEDS_one, preNormEDS_two, preNormEDS_four, ite_eq_right (by decide)] + ring + + end NormEDSLemmas +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Basic.lean b/projects/HasseWeil/HasseWeil/Foundation/Basic.lean +index b2c035a234ea01cc215b69064d795adea7e2c888..31b9bd23d3724605cf874fab7e45adf87d019f61 100644 +GIT binary patch +delta 149 +zcmbPop6UH6rVT$CCl|9>Y+k}C%(OXyr;2fNDc?hu$>G9oljni4;^dor0+Yo=6egRC +zv~1oZGLdKV1C51(j9inqSSoH#v0iP*%B8ETkT5y1LUD3$)xyn<)vAn>m)E3j=B;(* +z0x}dQm$b`I=B?G7yrIiz^ZWK@=FQ8yrCGR3QsYw#7%Q6xKL#el{&hlaS!J&=&}hShiD#91=AxstSRUrY%Y-qEZ!)y<=zSdS^Sk +zwv%v3kOHd20ii82Q2rziQ6*4IS7-%-OAq{r1CRq!PlbRKQ9w$l1ch>7b{xkct$o_r +zH}k&t-Z$TSv+z~D`%(SHIy7ejwt$)}P4pQsvYM8_$y27H9GfDbu_V@jOdD7?Dbr10 +zDX@e+ImNgdv9K +zJuUO48AGE_Tr0B9NNQ_rYHAnT-R^F{+xN(i|1Fq`fK#2317M +zVTNDH@B$Bv*1d7zV?LLM%4C +zJa5Mab~`ULkN6u|YEoy`ILSDlxBpxp@I;ZK(?pFJj0#C?NXEIa^E&F3+foUzk)9BP +zvv^NKO)bk%tAO7^J+|BZO%p8DtY>p(AG-?_R$UIxDm)u0DR02V5(d#ZNdoa{A=TM_(O}k;Xxa3X4I^Fl4;MS^ulF?BpIvWvzMOnR +z>8cnsY=4^A=`1|k)nFf4xy$~xq0Twa2k%?|X|V5KZGP|XSKIowCL%j?qr=Nwm<~FB +zV4raBtPwrnjIX@nt0<;Ryjusf5Clt*G6-u^k<) +zsS0>_2O30$4_i=&4|)sTZK%zCrxjf-n%o!L(bD=d-hra18dTwIC;Gh*3?NIwxrG4w +zwZ58zd!`$m^H)95_aK_Ct9oKFg5FiCo){lO{}xFtzBvDzGtduldo9@Jo_P!{*EEsS +zS*%6Gb3%B*7(+u6c-@WaIl@h{F+AN5#t=fSWx simp + | tmul x y => simp [KaehlerDifferential.mapBaseChange_tmul, h_map_zero] + | add x y hx hy => simp [map_add, hx, hy] + +-/-- **T-II-4-004 forward direction (axiom-clean)**: if `α` is separable, +-then `omegaPullbackCoeff W α ≠ 0`. +- +-Pipeline: `IsSeparable → Subsingleton Ω[K(E)/K(E)_α]` → +-`mapBaseChange surjective` (via the type synonym) → in particular, +-`invariantDifferential ∈ image(mapBaseChange)` (cotangent exact sequence). +-A nonzero image element forces `α.pullbackKaehler` not-identically-zero, +-which (with the 1-dim Ω structure) forces `omegaPullbackCoeff ≠ 0`. -/ + theorem isogeny_omegaCoeff_ne_zero_of_isSeparable + (α : Isogeny W.toAffine W.toAffine) + (h_sep : α.IsSeparable) : +@@ -761,7 +556,7 @@ theorem isogeny_omegaCoeff_ne_zero_of_isSeparable + have h_pK_zero : ∀ ω' : Ω[W.toAffine.FunctionField⁄F], + α.pullbackKaehler ω' = 0 := + pullbackKaehler_eq_zero_of_omegaPullbackCoeff_eq_zero W α h_zero +- haveI : Subsingleton (Ω[W.toAffine.FunctionField⁄IsogenyAlgebraSource W α]) := ++ have : Subsingleton (Ω[W.toAffine.FunctionField⁄IsogenyAlgebraSource W α]) := + (isogeny_subsingleton_via_synonym_eq W α).mpr + (isogeny_subsingleton_kaehler_of_isSeparable W α h_sep) + have h_surj : Function.Surjective (KaehlerDifferential.mapBaseChange F +@@ -779,12 +574,6 @@ theorem isogeny_omegaCoeff_ne_zero_of_isSeparable + rw [h_mbc_zero, LinearMap.zero_apply] at ht + exact (invariantDifferential_ne_zero W.toAffine) ht.symm + +-/-- **T-II-4-004 reverse direction (witness-parametric on FiniteDim only, +-axiom-clean)**: if `omegaPullbackCoeff W α ≠ 0` and `K(E)` is finite-dimensional +-over `K(E)_α` (Witness #2), then `α` is separable. +- +-Combines the cotangent-sequence bridge (omega-coeff ≠ 0 → Subsingleton) with the +-algebra-Kähler reverse direction (Subsingleton + FiniteDim → IsSeparable). -/ + theorem isogeny_isSeparable_of_omegaCoeff_ne_zero_finiteDim + (α : Isogeny W.toAffine W.toAffine) + (h_coeff : omegaPullbackCoeff W α ≠ 0) +@@ -796,14 +585,6 @@ theorem isogeny_isSeparable_of_omegaCoeff_ne_zero_finiteDim + (isogeny_subsingleton_kaehler_of_omegaCoeff_ne_zero W α h_coeff)) + h_fin + +-/-- **T-II-4-004 full iff (witness-parametric on FiniteDim only, axiom-clean)**: +-the deliverable iff `α.IsSeparable ↔ omegaPullbackCoeff W α ≠ 0` modulo only +-the Witness #2 hypothesis (FiniteDimensional). +- +-Combines the forward direction (no extra hypothesis) and the reverse direction +-(needs FiniteDim). +- +-Once Witness #2 discharges unconditionally, the full T-II-4-004 lands. -/ + theorem isSeparable_iff_omegaPullbackCoeff_ne_zero_of_finiteDim + (α : Isogeny W.toAffine W.toAffine) + (h_fin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField +@@ -812,16 +593,6 @@ theorem isSeparable_iff_omegaPullbackCoeff_ne_zero_of_finiteDim + ⟨isogeny_omegaCoeff_ne_zero_of_isSeparable W α, + fun h ↦ isogeny_isSeparable_of_omegaCoeff_ne_zero_finiteDim W α h h_fin⟩ + +-/-- **T-II-4-004 reverse direction (axiom-clean, unconditional)**: if the +-differential pullback `α.pullbackKaehler` is injective on `Ω[K(E)/F]`, then `α` +-is separable. +- +-Discharge path: +-* Witness #2 (`FiniteDimensional` of `K(E)/(image)`) — gives `EssFiniteType`. +-* Connection from `omegaPullbackCoeff ≠ 0` (the scalar form of injectivity) +- to `Subsingleton Ω[K(E)/(image)]` (the algebra-side condition). +-* Mathlib's `Algebra.FormallyUnramified.iff_isSeparable` for the final +- conclusion. -/ + theorem isogeny_isSeparable_of_pullbackKaehler_injective + (α : Isogeny W.toAffine W.toAffine) + (h_inj : Function.Injective α.pullbackKaehler) : +@@ -830,14 +601,6 @@ theorem isogeny_isSeparable_of_pullbackKaehler_injective + ((pullbackKaehler_injective_iff_omegaPullbackCoeff_ne_zero W α).mp h_inj) + (isogeny_finiteDimensional W α) + +-/-- **T-II-4-004 algebra-Kähler half (axiom-clean)**: an isogeny `α` is separable +-(in the `Algebra.IsSeparable` sense) iff its differential pullback +-`α.pullbackKaehler` is injective on `Ω[K(E)/F]`. +- +-This is the substantive Silverman II.4.2(c) algebra-Kähler glue. +-The forward direction: `Algebra.IsSeparable → FormallyUnramified +-→ Ω[K(E)/(image)] = 0 → cotangent surjective → pullbackKaehler injective`. +-The reverse: the converse chain via `FormallyUnramified.iff_isSeparable`. -/ + theorem isSeparable_iff_pullbackKaehler_injective + (α : Isogeny W.toAffine W.toAffine) : + α.IsSeparable ↔ Function.Injective α.pullbackKaehler := +@@ -845,12 +608,6 @@ theorem isSeparable_iff_pullbackKaehler_injective + (isogeny_omegaCoeff_ne_zero_of_isSeparable W α h), + isogeny_isSeparable_of_pullbackKaehler_injective W α⟩ + +-/-- **T-II-4-004 (elliptic curve form, deliverable target)**: separability of +-an isogeny `α` is equivalent to its omega-pullback coefficient being nonzero +-(equivalently, to the differential pullback `α*` being injective on +-`Ω[K(E)/F]`). +- +-Reference: Silverman II.4.2(c). -/ + theorem isSeparable_iff_omegaPullbackCoeff_ne_zero + (α : Isogeny W.toAffine W.toAffine) : + α.IsSeparable ↔ omegaPullbackCoeff W α ≠ 0 := +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Divisors.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Divisors.lean +index 272a5d45e..77de07569 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Divisors.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Divisors.lean +@@ -16,9 +16,6 @@ The divisor group `Div C` of a smooth plane curve `C` is the free abelian group + on its smooth points: a formal sum `Σ nₚ (P)` with integer coefficients that + are zero for all but finitely many points. + +-This closes tickets `T-II-3-001` (`Divisor`) and `T-II-3-002` +-(`Divisor.degree`, `Divisor.degreeHom`). +- + ## References + + * [Silverman, *The Arithmetic of Elliptic Curves*], II.3 (definition) +@@ -95,7 +92,7 @@ end Divisor + noncomputable abbrev Divisor₀ (C : SmoothPlaneCurve F) : AddSubgroup (Divisor C) := + Divisor.degZero C + +-/-! ### `divisorOf f`: the principal divisor (T-II-3-005) -/ ++ + + namespace SmoothPlaneCurve + +@@ -116,7 +113,7 @@ noncomputable def divisorOf (C : SmoothPlaneCurve F) (f : C.FunctionField) : + rw [this]; exact Set.finite_empty + · refine (C.finite_setOf_ord_P_nonzero hf).subset ?_ + intro P hP +- simp only [Set.mem_setOf_eq] ++ simp only [Set.mem_ofPred_eq] + intro h0 + apply hP + simp [h0] +@@ -184,7 +181,7 @@ noncomputable def divisorHom (C : SmoothPlaneCurve F) : + congr 1 + exact C.divisorOf_mul u.ne_zero v.ne_zero + +-/-! ### Principal divisors and linear equivalence (T-II-3-006) -/ ++ + + /-- A divisor `D` on `C` is **principal** if `D = div(f)` for some nonzero + rational function `f ∈ F(C)`. Equivalently, `D` lies in the image of the +@@ -244,7 +241,7 @@ theorem LinearlyEquiv.trans {C : SmoothPlaneCurve F} {D₁ D₂ D₃ : Divisor C + rw [show D₁ - D₃ = (D₁ - D₂) + (D₂ - D₃) by abel] + exact h₁.add h₂ + +-/-! ### T-II-3-008: constants have zero divisor -/ ++ + + /-- `ord_P` of an `F`-constant `c ≠ 0` is zero: a nonzero constant is a unit + at every smooth point (image of the F-subfield, which lives in the local +@@ -289,15 +286,11 @@ zeros or poles. -/ + refine Finsupp.ext fun P ↦ ?_ + rw [divisorOf_apply, C.ord_P_algebraMap_F_of_ne_zero hc P]; rfl + +-/-! ### T-II-3-008 (⇒): `divisorOf = 0 ⇒ const` (prime-indexed via IC-006) -/ + +-/-- **T-II-3-008 (⇒), prime-indexed**: if `f ∈ F(C)` has valuation at most 1 +-at every nonzero prime of `C.CoordinateRing` **and** has nonnegative order at +-infinity, then `f` is the image of a constant from `F`. This is the content +-of Silverman II.3.1(a) `⇒` in the prime-indexed reformulation made available +-by IC-006; the SmoothPoint-indexed statement follows once every nonzero +-prime is in the image of `SmoothPoint.toHeightOneSpectrum` (the surjection +-step under `[IsAlgClosed F]`, tracked separately). -/ ++ ++/-- If a function has valuation at most one at every nonzero prime of the ++coordinate ring and has nonnegative order at infinity, it is constant. ++This is the prime-indexed form of Silverman II.3.1(a). -/ + theorem const_of_valuation_le_one_of_ordAtInfty_nonneg + [IsIntegrallyClosed C.CoordinateRing] (f : C.FunctionField) + (h_primes : ∀ v : IsDedekindDomain.HeightOneSpectrum C.CoordinateRing, +@@ -306,7 +299,7 @@ theorem const_of_valuation_le_one_of_ordAtInfty_nonneg + ∃ c : F, f = algebraMap F C.FunctionField c := + C.const_of_no_poles_of_valuation_of_ordAtInfty f h_primes h_inf + +-/-! ### Pic and Pic₀ (T-II-3-007) -/ ++ + + /-- The **Picard group** of `C`: divisors modulo principal divisors. + Silverman II.3 (definition). -/ +@@ -314,8 +307,7 @@ abbrev Pic (C : SmoothPlaneCurve F) : Type _ := + Divisor C ⧸ C.principalSubgroup + + /-- The **degree-zero Picard group** `Pic⁰(C)`: degree-zero divisors modulo +-principal divisors (principal divisors automatically have degree zero by +-Silverman II.3.1(b), tracked as T-II-3-009). -/ ++principal divisors (principal divisors have degree zero by Silverman II.3.1(b)). -/ + abbrev Pic₀ (C : SmoothPlaneCurve F) : Type _ := + (Divisor.degZero C) ⧸ (C.principalSubgroup.addSubgroupOf (Divisor.degZero C)) + +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/EffectiveSumReduce.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/EffectiveSumReduce.lean +index 03a560829..5a38ff39d 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/EffectiveSumReduce.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/EffectiveSumReduce.lean +@@ -92,6 +92,7 @@ omit [W.IsElliptic] in + @[simp] theorem listSum_cons (P : W.Point) (Ps : List W.Point) : + listSum W (P :: Ps) = P + listSum W Ps := rfl + ++omit [W.IsElliptic] in + /-- σ on the list-divisor equals the list sum. -/ + theorem projectiveDivisorSum_listToDivisor (Ps : List W.Point) : + projectiveDivisorSum W (listToDivisor W Ps) = listSum W Ps := by +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Miller.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/Miller.lean +index 0cca33fbbad2caeffd72dbaa7a093fb8e19faddd..746ea1a153571d3a8d47b2d1a9b99a29dd929f72 100644 +GIT binary patch +delta 2890 +zcmai0+iw(A7|&@5mm#SrY$F%pD^_fEce%8PDFKAE)EdohfrOw5%<0V8og*{n3^TJ^ +zN@5nGCK^qMjyN$<6Z``Vu_XJVk!XDIi4dMmOcUdS58{LRz>D8GGuxe(Hok2;=X|%{ +zi?0$z;a|@gA9y_iaHY!xLh#&639l~$poK~mO*-S`}3w0128iLK6JjCo~77Z^B +zm9pRI{R8TLn!}_6iH6 +znpAxKiT>DIx4y+$ST>AtRu32}>91KuAy`s`>{0_GxpNROyJ6v6B$z{Y-yTm(QSX+DxO}#=EgT~Z;e~Gx988rw6ZOE562E +zmj%y;I2o5lT#7Lqc7U^;!*+@=4P$V&TvhZm7unca&c?G26TomVETeM9N`rR*)SO8< +z0!=D-=&gQ3c^M#? +zR*^ycVejUC<1}M%n!A|SqawrSVEp)oEy?B0WK&Y#LEf4F{ojjEubIFjN#A}lnC#y~ +zwzUlNA{Ir*v%WN;um>F9GIA-}Bc(D{**TUfDImo(-BGqEJ-4H!l&cDoGL-hJ6Ea|) +z`uaMu{}i*^=Xa2|2&p9f17x&i^O|N_q*Y=Z&_*(nPBaC15#l21>Jg!I(-qZKL&#E% +z3m&nOFI|+YA4ng8nL~jh5Xg?>C#QtpK-W5JB9Mf|H_bvpDTl&1v)M(CMrKQoa?w7t +zi%b%7Ci!U(89W9lDQbu%CIaTV+(*2@Y6MND@N^80QS&9Dt|+=&9Z~d?EdylF5yNt5 +zK&^-cJXDvLb`M$iWmpN?(F7*R&i0kvWFu*v(Pq}2Mm|-heV9RzN|+Fh)m~mNS``|f +zCj;NXGSF94?YdBPJM#>QywTLAZk^2pRIwXJXt^>e50DLMJ@*F5!!^2|uI*$2ifCdD +z5n=Wf+y~R3iFQ_lfjGU%tcc?*GYeF_Qrd(ERhNTDaN8mz#D(tT(otszoK +z&YvUelj|k&u&gwvMn%=G`@a}ra_?nQ*kvdSQ$Q>&qeb|YTm(TqhM;9(bLc*TN&D~pq%VbXksF~0Gc1~AXn1P4tBygfe|11p +z$jDJhuc2k^TZP}+FGTyh7f26j9T$kdL~p^;QE;}+H8+qZO%$T7`|%s0gCm<&BJ%?l +zGE`#jxnX21LGM-AE^`xYH2Hp(aH^#YtRwk3?Q=^Nj}HO0QL$%S{`oL@C5G90Hu9Bf +zt8q|!sro{1rE&C*mS1e28zbNJK0Q@KU(Q3UpISrHIna}@j*@3il#RSybCK#vy+e?M +zYB^y?h|KbpF|xSQN897a$QRW?HLax-R7&XVzf=-2y|ZOs<}~PP=__u@`oh_y>noa- +znIXhCuWoOnmJ3HH--XKr)wkj$4EQwjv9B`(Vz);{Za3G{)54jxI5qP+c8KGcbv>>=XJ28v$$=Sfk +z(+Ii;C!of*Ay!gvUVt(e|6fjgZy-wM<1FQFU!21V6rlU-5Q^CC{%D&8>C_9gi?Jt{ +zQV*3WLY5Lg#k;=47}#bp2i@O?V6Nrt*q9-3C;}x@*MX#niye+U*vB7uCEmy|dA?Pq +zq!vnd=29GTOadUKc#nKv4P3*mQF(HY^PT4FgZy<~)<5UKGRMh-uR(O=b +z#tz^>z!2+$oe>=?E&dMO>1tZ-S4mw~{$*NR4mbPYXT;BuKYj6EMsH2cZVa)o^g7zi +zQ3epmfM^q(#{M3&jNiO + +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/ProjectiveDivisor.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/ProjectiveDivisor.lean +index 42df6e4ba..40dbf3639 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/ProjectiveDivisor.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/ProjectiveDivisor.lean +@@ -233,7 +233,7 @@ theorem projectiveDivisorOf_apply_affine (f : C.FunctionField) (P : C.SmoothPoin + (ProjectiveSmoothPoint.infinity : ProjectiveSmoothPoint C) := by + intro h; nomatch h + rw [Finsupp.add_apply, Finsupp.single_eq_of_ne h_ne, add_zero, +- Finsupp.mapDomain_apply ProjectiveSmoothPoint.affine_injective ++ Finsupp.mapDomain_apply_of_injective ProjectiveSmoothPoint.affine_injective + (C.divisorOf f) P, C.divisorOf_apply] + + theorem projectiveDivisorOf_apply_infinity (f : C.FunctionField) : +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/PushforwardDivisor.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/PushforwardDivisor.lean +index 37f06f385..9d556ad1d 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/PushforwardDivisor.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Divisor/PushforwardDivisor.lean +@@ -8,40 +8,17 @@ import HasseWeil.Foundation.Curves.Map.CoordHomFinite + import HasseWeil.Foundation.Curves.Valuation.NormValuation + + /-! +-# The divisor pushforward of a finite curve map preserves principal divisors ++# Divisor pushforward and principal divisors + +-For a (nonconstant) curve map `φ : C₁ → C₂` between smooth plane curves, the +-**divisor pushforward** `φ_∗ : Div(C₁) → Div(C₂)` sends `Σ nᵢ (Pᵢ)` to +-`Σ nᵢ (φ Pᵢ)`. Silverman II.3.6 / II.3.7 says it carries *principal* divisors +-to *principal* divisors, via the **norm–conorm identity** ++For a finite curve map `φ : C₁ → C₂` over an algebraically closed field, the ++divisor pushforward sends `Σ nᵢ(Pᵢ)` to `Σ nᵢ(φ(Pᵢ))`. The norm–conorm identity ++`div(N_φ f) = φ_∗(div f)` shows that principal divisors remain principal. ++Here `N_φ` is the field norm from `K(C₁)` to `φ*K(C₂)`. + +- `div(N_φ f) = φ_∗(div f)` (Silverman II.3.6) +- +-where `N_φ f = Norm_{K(C₁)/φ*K(C₂)}(f) ∈ K(C₂)` is the field norm (already +-defined as `CurveMap.pushforward`). This is the only deep input to Silverman +-III.4.8 (every isogeny is a group homomorphism, proved at the divisor/σ level in +-`HasseWeil/EC/IsogenyAG/GroupHom.lean`). +- +-## The valuation-theoretic pushforward +- +-We realise the divisor pushforward as `Finsupp.mapDomain` along the place-image +-map `P ↦ φ(P)` (affine smooth point `↦` affine smooth point, `∞ ↦ ∞`), supplied +-by a coordinate-ring witness `cd : φ.CoordHom`. This is definitionally the +-point-map pushforward `pushforwardProjectiveDivisor`, so the compatibility +-sub-leaf NEW-1(iii) is `rfl`; the mathematical content is concentrated in the +-norm–conorm identity NEW-1(ii). +- +-## Main definitions +- +-* `CurveMap.pushforwardDivisorVal` — the valuation-theoretic divisor pushforward +- (= `pushforwardProjectiveDivisor`, via the place-image map). +- +-## Main results +- +-* `CurveMap.projectiveDivisorOf_pushforward_eq_pushforwardDivisorVal` — the +- norm–conorm identity `div(N_φ f) = φ_∗(div f)` (Silverman II.3.6). +-* `EC.Isogeny.pushforward_preserves_principal` — the gap `h_pres`: the +- pushforward of a principal projective divisor is principal (Silverman II.3.7). ++The pushforward is realized by `Finsupp.mapDomain` along the projective ++place-image map. Its coefficients are sums over the fibres. The local ++norm formula, together with residue degree one, identifies these coefficients ++with the orders of the norm. + + ## References + +@@ -50,7 +27,6 @@ norm–conorm identity NEW-1(ii). + + open WeierstrassCurve + +-set_option linter.unusedSectionVars false + + namespace HasseWeil.Curves.CurveMap + +@@ -58,7 +34,7 @@ variable {F : Type*} [Field F] + variable {C₁ C₂ : SmoothPlaneCurve F} + [C₁.toAffine.IsElliptic] [C₂.toAffine.IsElliptic] + +-/-! ### NEW-1(i): the valuation-theoretic divisor pushforward -/ ++/-! ### the valuation-theoretic divisor pushforward -/ + + /-- The place-image map on the projective closure induced by a curve map `φ` + together with a coordinate-ring witness: an affine smooth point `P` is sent to +@@ -96,7 +72,7 @@ theorem degree_pushforwardDivisorVal (φ : CurveMap C₁ C₂) (cd : φ.CoordHom + simp only [ProjectiveDivisor.degree] + rw [Finsupp.sum_mapDomain_index (h := fun _ n ↦ n) (fun _ ↦ rfl) (fun _ _ _ ↦ rfl)] + +-/-! ### NEW-1(ii): the norm–conorm identity `div(N_φ f) = φ_∗(div f)` ++/-! ### the norm–conorm identity `div(N_φ f) = φ_∗(div f)` + + The mathematical content is the per-place identity (Silverman II.3.6) + +@@ -107,7 +83,7 @@ by generalising the `F[X] → F[C]` machinery of `NormValuation.lean` to the + coordinate-ring extension `F[C₂] → F[C₁]` supplied by a `CoordHom`. The generic + ideal/localisation lemmas (`count_preservation_localization`, + `count_finset_prod_factors`, `map_eq_localRing_max_pow_count`, …) are reused +-verbatim; the curve-specific inputs are `inertiaDeg' = 1`, `relNorm m_P = m_{φP}`, ++verbatim; the curve-specific inputs are `inertiaDeg = 1`, `relNorm m_P = m_{φP}`, + and the fibre bijection `maximalIdealAt_toPointMap`. -/ + + section NormConorm +@@ -129,8 +105,8 @@ theorem coordHom_injective : Function.Injective cd.toAlgHom := by + injective into a domain). -/ + theorem isTorsionFree_coordHom : + @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ cd.toAlgebra.toModule := by +- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- haveI : FaithfulSMul C₂.CoordinateRing C₁.CoordinateRing := ++ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ have : FaithfulSMul C₂.CoordinateRing C₁.CoordinateRing := + (faithfulSMul_iff_algebraMap_injective C₂.CoordinateRing C₁.CoordinateRing).mpr + (CurveMap.coordHom_injective φ cd) + infer_instance +@@ -146,8 +122,8 @@ private theorem isScalarTower_residueField_maximalIdealAt (P : C₁.SmoothPoint) + ⟨maximalIdealAt_toPointMap cd P⟩ + IsScalarTower F (C₂.CoordinateRing ⧸ C₂.maximalIdealAt (toPointMap cd P)) + (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := by +- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- haveI : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := ++ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ have : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := + ⟨maximalIdealAt_toPointMap cd P⟩ + set Q := toPointMap cd P with hQ + refine IsScalarTower.of_algebraMap_eq fun c ↦ ?_ +@@ -177,15 +153,15 @@ private theorem finrank_residueField_maximalIdealAt_le_one (P : C₁.SmoothPoint + ⟨maximalIdealAt_toPointMap cd P⟩ + Module.finrank (C₂.CoordinateRing ⧸ C₂.maximalIdealAt (toPointMap cd P)) + (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) ≤ 1 := by +- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- haveI : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := ++ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ have : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := + ⟨maximalIdealAt_toPointMap cd P⟩ + set Q := toPointMap cd P with hQ +- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q +- haveI hPmax : (C₁.maximalIdealAt P).IsMaximal := C₁.maximalIdealAt_isMaximal P +- haveI : Field (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) := Ideal.Quotient.field _ +- haveI : Field (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := Ideal.Quotient.field _ +- haveI htower := isScalarTower_residueField_maximalIdealAt φ cd P ++ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hPmax : (C₁.maximalIdealAt P).IsMaximal := C₁.maximalIdealAt_isMaximal P ++ have : Field (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) := Ideal.Quotient.field _ ++ have : Field (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := Ideal.Quotient.field _ ++ have htower := isScalarTower_residueField_maximalIdealAt φ cd P + have hbijSP := C₁.algebraMap_bijective_quotient_of_maximal hPmax + refine finrank_le_one (1 : C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) fun w ↦ ?_ + obtain ⟨c, hc⟩ := hbijSP.2 w +@@ -212,16 +188,17 @@ theorem inertiaDeg_maximalIdealAt_toPointMap (P : C₁.SmoothPoint) : + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra + haveI : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := + ⟨(maximalIdealAt_toPointMap cd P)⟩ +- Ideal.inertiaDeg' (C₂.maximalIdealAt (toPointMap cd P)) (C₁.maximalIdealAt P) = 1 := by +- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- haveI hLies : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := ++ (C₁.maximalIdealAt P).inertiaDeg C₂.CoordinateRing = 1 := by ++ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ have hLies : (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := + ⟨maximalIdealAt_toPointMap cd P⟩ + set Q := toPointMap cd P with hQ +- haveI hPmax : (C₁.maximalIdealAt P).IsMaximal := C₁.maximalIdealAt_isMaximal P +- rw [Ideal.inertiaDeg'_algebraMap] ++ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hPmax : (C₁.maximalIdealAt P).IsMaximal := C₁.maximalIdealAt_isMaximal P ++ rw [Ideal.inertiaDeg_eq_of_isMaximal (C₂.maximalIdealAt Q) (C₁.maximalIdealAt P)] + -- The residue field `F[C₁]/m_P` is `F` (alg-closed), hence nontrivial. +- haveI : Field (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := Ideal.Quotient.field _ +- haveI : Nontrivial (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := ++ have : Field (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := Ideal.Quotient.field _ ++ have : Nontrivial (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := + (Ideal.Quotient.nontrivial_iff).mpr hPmax.ne_top + -- Squeeze the residue rank between `1` (`finrank_pos`) and `1` (alg-closed surjectivity). + have hSP : Module.finrank F (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) = 1 := +@@ -229,9 +206,9 @@ theorem inertiaDeg_maximalIdealAt_toPointMap (P : C₁.SmoothPoint) : + have h_le : Module.finrank (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) + (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) ≤ 1 := + finrank_residueField_maximalIdealAt_le_one φ cd P +- haveI : Module.Finite F (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := ++ have : Module.Finite F (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := + Module.finite_of_finrank_pos (by rw [hSP]; norm_num) +- haveI : Module.Finite (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) ++ have : Module.Finite (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) + (C₁.CoordinateRing ⧸ C₁.maximalIdealAt P) := + Module.Finite.of_restrictScalars_finite F _ _ + have h_ge : 1 ≤ Module.finrank (C₂.CoordinateRing ⧸ C₂.maximalIdealAt Q) +@@ -244,22 +221,17 @@ packaged as a `LiesOver` instance for the `cd`-induced algebra. -/ + theorem maximalIdealAt_liesOver_toPointMap (P : C₁.SmoothPoint) : + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra + (C₁.maximalIdealAt P).LiesOver (C₂.maximalIdealAt (toPointMap cd P)) := +- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra + ⟨maximalIdealAt_toPointMap cd P⟩ + + end NormConorm + +-/-! ### NEW-1(ii) — structural sub-lemmas of the norm–conorm identity ++/-! ### Coordinate-ring norms + +-The norm–conorm identity is assembled below from three sub-lemmas, each carrying its +-own elaboration budget so the assembling theorem stays light: +-* `relNorm_maximalIdealAt_eq` — the **`s = 1` core** `relNorm(m_R) = m_{φR}`; +-* `count_relNorm_eq_sum_fiber` — the **affine count identity** matching +- `count_{m_Q}(relNorm(span{w}))` to the fibre sum `Σ_{φP=Q} count_{m_P}(span{w})`; +-* `projectiveDivisorOf_pushforward_algebraMap_eq` — the **`algebraMap` case** of the +- norm–conorm identity (affine coefficients via the count identity, infinity +- coefficient forced by degree). +-The `f = u/v` reduction is then a short additivity argument in the main theorem. -/ ++The prime-ideal identity `relNorm(m_P) = m_{φP}` gives the corresponding ++valuation count as a sum over the fibre. Equality of affine coefficients, ++together with degree zero, determines the projective divisor. Additivity ++then extends the identity to quotients of coordinate-ring elements. -/ + + section NormConormSteps + +@@ -276,8 +248,8 @@ finiteness/degree arguments. -/ + private theorem faithfulSMul_coordinateRing_functionField : + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra + FaithfulSMul C₂.CoordinateRing C₁.FunctionField := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ + rw [RingHom.algebraMap_toAlgebra] + rfl +@@ -300,9 +272,9 @@ private theorem isScalarTower_coordinateRing_functionField : + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra + letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra + IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra +- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ + rw [RingHom.algebraMap_toAlgebra] + rfl +@@ -321,23 +293,23 @@ to `K(C₂)`). This is the algebraicity input to the localisation-finiteness st + private theorem isAlgebraic_functionField : + letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra + Algebra.IsAlgebraic C₂.FunctionField C₁.FunctionField := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ + rw [RingHom.algebraMap_toAlgebra] + rfl +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ algCR.toModule := ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ algCR.toModule := + cd.module_finite +- haveI hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := ++ have hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := + Algebra.IsIntegral.of_finite C₂.CoordinateRing C₁.CoordinateRing +- haveI faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := ++ have faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := + faithfulSMul_coordinateRing_functionField φ cd +- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra +- haveI tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := ++ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ have tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := + isScalarTower_coordinateRing_functionField φ cd +- haveI hab : Algebra.IsAlgebraic C₂.CoordinateRing C₁.CoordinateRing := ++ have hab : Algebra.IsAlgebraic C₂.CoordinateRing C₁.CoordinateRing := + Algebra.IsIntegral.isAlgebraic +- haveI halgAB : Algebra.IsAlgebraic C₂.CoordinateRing C₁.FunctionField := ++ have halgAB : Algebra.IsAlgebraic C₂.CoordinateRing C₁.FunctionField := + (IsFractionRing.isAlgebraic_iff' C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField).mp hab + exact (IsFractionRing.comap_isAlgebraic_iff (A := C₂.CoordinateRing) + (K := C₂.FunctionField) (C := C₁.FunctionField)).mp halgAB +@@ -352,25 +324,25 @@ theorem finiteDimensional_functionField : + have hfin : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ + cd.toAlgebra.toModule := by + exact cd.module_finite +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ + rw [RingHom.algebraMap_toAlgebra] + rfl +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin +- haveI hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin ++ have hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := + Algebra.IsIntegral.of_finite C₂.CoordinateRing C₁.CoordinateRing +- haveI faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := ++ have faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := + faithfulSMul_coordinateRing_functionField φ cd +- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra +- haveI tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := ++ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ have tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := + isScalarTower_coordinateRing_functionField φ cd +- haveI halgFF : Algebra.IsAlgebraic C₂.FunctionField C₁.FunctionField := ++ have halgFF : Algebra.IsAlgebraic C₂.FunctionField C₁.FunctionField := + isAlgebraic_functionField φ cd +- haveI hicl : IsIntegralClosure C₁.CoordinateRing C₂.CoordinateRing C₁.FunctionField := ++ have hicl : IsIntegralClosure C₁.CoordinateRing C₂.CoordinateRing C₁.FunctionField := + IsIntegralClosure.of_isIntegrallyClosed C₁.CoordinateRing C₂.CoordinateRing _ +- haveI hloc : IsLocalization ++ have hloc : IsLocalization + (Algebra.algebraMapSubmonoid C₁.CoordinateRing (nonZeroDivisors C₂.CoordinateRing)) + C₁.FunctionField := + IsIntegralClosure.isLocalization C₂.CoordinateRing C₂.FunctionField C₁.FunctionField +@@ -394,12 +366,12 @@ private theorem finrank_functionField_eq_degree : + faithfulSMul_coordinateRing_functionField φ cd + @Module.finrank C₂.FunctionField C₁.FunctionField _ _ + (FractionRing.liftAlgebra C₂.CoordinateRing C₁.FunctionField).toModule = φ.degree := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ + rw [RingHom.algebraMap_toAlgebra] + rfl +- haveI faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := ++ have faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := + faithfulSMul_coordinateRing_functionField φ cd + have halgmap : + IsFractionRing.lift (A := C₂.CoordinateRing) (K := C₂.FunctionField) +@@ -436,13 +408,13 @@ private theorem one_le_of_relNorm_eq_pow + isTorsionFree_coordHom φ cd + Ideal.relNorm C₂.CoordinateRing P' = q ^ t) : + 1 ≤ t := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI : P'.LiesOver q := hlies ++ have : P'.LiesOver q := hlies + rcases Nat.eq_zero_or_pos t with ht0 | ht0 + · exfalso + have hcomap : P'.comap (algebraMap C₂.CoordinateRing C₁.CoordinateRing) = q := +@@ -468,35 +440,26 @@ private theorem inertiaDeg_eq_one_of_liesOver_maximalIdealAt (Q : C₂.SmoothPoi + cd.module_finite + haveI : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- Ideal.inertiaDeg' (C₂.maximalIdealAt Q) P' = 1 := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ P'.inertiaDeg C₂.CoordinateRing = 1 := by ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI hP'prime' : P'.IsPrime := hP'prime +- haveI hP'lies' : P'.LiesOver (C₂.maximalIdealAt Q) := hP'lies +- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hP'prime' : P'.IsPrime := hP'prime ++ have hP'lies' : P'.LiesOver (C₂.maximalIdealAt Q) := hP'lies ++ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q + have hQ0 : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + have hP'_ne_bot : P' ≠ ⊥ := by + intro h + apply hQ0 + have hh : C₂.maximalIdealAt Q = P'.under C₂.CoordinateRing := hP'lies.over + rw [hh, h, Ideal.under_bot] +- haveI hP'max : P'.IsMaximal := Ideal.IsPrime.isMaximal hP'prime hP'_ne_bot ++ have hP'max : P'.IsMaximal := Ideal.IsPrime.isMaximal hP'prime hP'_ne_bot + obtain ⟨P'', hP''⟩ := C₁.exists_smoothPoint_of_isMaximal hP'max +- haveI hlies'' : (C₁.maximalIdealAt P'').LiesOver +- (C₂.maximalIdealAt (toPointMap cd P'')) := +- maximalIdealAt_liesOver_toPointMap φ cd P'' +- have h1 : C₂.maximalIdealAt (toPointMap cd P'') = +- (C₁.maximalIdealAt P'').under C₂.CoordinateRing := hlies''.over +- have h2 : C₂.maximalIdealAt Q = P'.under C₂.CoordinateRing := hP'lies.over +- rw [hP''] at h1 +- have hpeq : C₂.maximalIdealAt (toPointMap cd P'') = C₂.maximalIdealAt Q := h1.trans h2.symm +- have hid := inertiaDeg_maximalIdealAt_toPointMap φ cd P'' +- rw [← hP'', ← hpeq] +- exact hid ++ rw [← hP''] ++ exact inertiaDeg_maximalIdealAt_toPointMap φ cd P'' + + include φ cd in + /-- **Sum of ramification indices equals `φ.degree`**: over a smooth point `Q` of +@@ -514,12 +477,12 @@ private theorem sum_ramificationIdx_eq_degree (Q : C₂.SmoothPoint) + isTorsionFree_coordHom φ cd + ∑ P' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing, + (C₂.maximalIdealAt Q).ramificationIdx' P' = φ.degree := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q + have hQ0 : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + have hsumef := φ.sum_ramificationIdx_mul_inertiaDeg_eq_degree cd hfin hQmax hQ0 + rw [← hsumef] +@@ -557,12 +520,12 @@ private theorem degree_eq_sum_relNormExp_mul_ramificationIdx (Q : C₂.SmoothPoi + haveI : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q + φ.degree = ∑ P' ∈ ((C₂.maximalIdealAt Q).primesOver C₁.CoordinateRing).toFinset, + sfn P' * (C₂.maximalIdealAt Q).ramificationIdx' P' := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q + set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def + have hp0 : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + have hpNotUnit : ¬ IsUnit p := by rw [Ideal.isUnit_iff]; exact hQmax.ne_top +@@ -571,11 +534,11 @@ private theorem degree_eq_sum_relNormExp_mul_ramificationIdx (Q : C₂.SmoothPoi + finrank_functionField_eq_degree φ cd + -- `relNorm_algebraMap`'s exponent is the *coordinate-ring* `finrank`, so pull `hcoh` down the + -- fraction-field tower with `IsFractionRing.finrank_eq`. +- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := ++ let algFF : Algebra C₂.FunctionField C₁.FunctionField := + FractionRing.liftAlgebra C₂.CoordinateRing C₁.FunctionField +- haveI towerFF : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := ++ have towerFF : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := + FractionRing.isScalarTower_liftAlgebra C₂.CoordinateRing C₁.FunctionField +- haveI towerCR : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by ++ have towerCR : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ + rw [RingHom.algebraMap_toAlgebra] + rfl +@@ -619,14 +582,14 @@ private theorem one_le_ramificationIdx_of_liesOver_maximalIdealAt (Q : C₂.Smoo + haveI : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + 1 ≤ (C₂.maximalIdealAt Q).ramificationIdx' P' := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI : P'.IsPrime := hP'prime +- haveI : P'.LiesOver (C₂.maximalIdealAt Q) := hP'lies ++ have : P'.IsPrime := hP'prime ++ have : P'.LiesOver (C₂.maximalIdealAt Q) := hP'lies + have hp0 : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + rw [Nat.one_le_iff_ne_zero] + exact Ideal.IsDedekindDomain.ramificationIdx'_ne_zero_of_liesOver P' hp0 +@@ -664,17 +627,17 @@ theorem relNorm_maximalIdealAt_eq + have hfin : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ + cd.toAlgebra.toModule := by + exact cd.module_finite +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := hfin ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + set Q := toPointMap cd R with hQ +- haveI hLies : (C₁.maximalIdealAt R).LiesOver (C₂.maximalIdealAt Q) := ++ have hLies : (C₁.maximalIdealAt R).LiesOver (C₂.maximalIdealAt Q) := + maximalIdealAt_liesOver_toPointMap φ cd R +- haveI hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q +- haveI hRmax : (C₁.maximalIdealAt R).IsMaximal := C₁.maximalIdealAt_isMaximal R +- haveI hRprime : (C₁.maximalIdealAt R).IsPrime := hRmax.isPrime ++ have hQmax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hRmax : (C₁.maximalIdealAt R).IsMaximal := C₁.maximalIdealAt_isMaximal R ++ have hRprime : (C₁.maximalIdealAt R).IsPrime := hRmax.isPrime + have hQ0 : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + obtain ⟨s, hs⟩ := Ideal.exists_relNorm_eq_pow_of_isPrime + (C₁.maximalIdealAt R) (C₂.maximalIdealAt Q) +@@ -683,14 +646,14 @@ theorem relNorm_maximalIdealAt_eq + have hge1 : 1 ≤ s := one_le_of_relNorm_eq_pow φ cd hQmax s hLies hs + set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def + -- Every residue degree over `m_Q` is `1`. +- have hinertia : ∀ P' ∈ p.primesOver C₁.CoordinateRing, Ideal.inertiaDeg' p P' = 1 := by ++ have hinertia : ∀ P' ∈ p.primesOver C₁.CoordinateRing, P'.inertiaDeg C₂.CoordinateRing = 1 := by + intro P' hP' + obtain ⟨hP'prime, hP'lies⟩ := hP' + exact inertiaDeg_eq_one_of_liesOver_maximalIdealAt φ cd Q P' hP'prime hP'lies + have hp0 : p ≠ ⊥ := hQ0 + have hpNotUnit : ¬ IsUnit p := by + rw [Ideal.isUnit_iff]; exact hQmax.ne_top +- haveI hpMax : p.IsMaximal := hQmax ++ have hpMax : p.IsMaximal := hQmax + -- Each relative norm over `m_Q` is a positive power of `m_Q`. + have hexp : ∀ P' ∈ p.primesOver C₁.CoordinateRing, + ∃ t : ℕ, 1 ≤ t ∧ Ideal.relNorm C₂.CoordinateRing P' = p ^ t := by +@@ -753,16 +716,16 @@ private theorem primesOverFinset_ne_bot {p : Ideal C₂.CoordinateRing} + (hpMax : p.IsMaximal) (hp_ne : p ≠ ⊥) : + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra + ∀ Q' ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, Q' ≠ ⊥ := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI faithCR : FaithfulSMul C₂.CoordinateRing C₁.CoordinateRing := ++ have faithCR : FaithfulSMul C₂.CoordinateRing C₁.CoordinateRing := + (faithfulSMul_iff_algebraMap_injective C₂.CoordinateRing C₁.CoordinateRing).mpr + (CurveMap.coordHom_injective φ cd) +- haveI hpMax' : p.IsMaximal := hpMax ++ have hpMax' : p.IsMaximal := hpMax + intro Q' hQ' + rw [IsDedekindDomain.mem_primesOverFinset_iff (B := C₁.CoordinateRing) hp_ne] at hQ' + intro h_eq +@@ -790,15 +753,15 @@ private theorem exists_smoothPoint_relNorm_maximalIdealAt_eq + ∃ P' : C₁.SmoothPoint, C₁.maximalIdealAt P' = Q' ∧ + Ideal.relNorm C₂.CoordinateRing Q' = C₂.maximalIdealAt (toPointMap cd P') ∧ + Q'.LiesOver (C₂.maximalIdealAt (toPointMap cd P')) := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI hQ'max' : Q'.IsMaximal := hQ'max ++ have hQ'max' : Q'.IsMaximal := hQ'max + obtain ⟨P', hP'⟩ := C₁.exists_smoothPoint_of_isMaximal hQ'max +- haveI hlies' : (C₁.maximalIdealAt P').LiesOver ++ have hlies' : (C₁.maximalIdealAt P').LiesOver + (C₂.maximalIdealAt (toPointMap cd P')) := + maximalIdealAt_liesOver_toPointMap φ cd P' + refine ⟨P', hP', ?_, hP' ▸ hlies'⟩ +@@ -822,15 +785,15 @@ private theorem count_maximalIdealAt_relNorm_pow_self (Q : C₂.SmoothPoint) + isTorsionFree_coordHom φ cd + (Associates.mk (C₂.maximalIdealAt Q)).count + (Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q') ^ k)).factors = k := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI hQ'lies' : Q'.LiesOver (C₂.maximalIdealAt Q) := hQ'lies ++ have hQ'lies' : Q'.LiesOver (C₂.maximalIdealAt Q) := hQ'lies + set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def +- haveI hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q + have hp_ne : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + have h_vp_irr : Irreducible (Associates.mk p) := + (⟨p, hpMax.isPrime, hp_ne⟩ : +@@ -862,14 +825,14 @@ private theorem count_maximalIdealAt_relNorm_pow_of_not_liesOver (Q : C₂.Smoot + isTorsionFree_coordHom φ cd + (Associates.mk (C₂.maximalIdealAt Q)).count + (Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q') ^ k)).factors = 0 := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def +- haveI hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q + have hp_ne : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + have h_vp_irr : Irreducible (Associates.mk p) := + (⟨p, hpMax.isPrime, hp_ne⟩ : +@@ -880,7 +843,7 @@ private theorem count_maximalIdealAt_relNorm_pow_of_not_liesOver (Q : C₂.Smoot + rw [hrel] + intro hpe + exact hQ'not (hpe ▸ hlies') +- haveI hP'max2 : (Ideal.relNorm C₂.CoordinateRing Q').IsMaximal := ++ have hP'max2 : (Ideal.relNorm C₂.CoordinateRing Q').IsMaximal := + hrel ▸ C₂.maximalIdealAt_isMaximal _ + have hP'_ne_bot2 : Ideal.relNorm C₂.CoordinateRing Q' ≠ ⊥ := hrel ▸ C₂.maximalIdealAt_ne_bot _ + have h_vP'_irr : Irreducible (Associates.mk (Ideal.relNorm C₂.CoordinateRing Q')) := +@@ -915,14 +878,14 @@ private theorem count_factors_relNorm_pow_eq_ite (Q : C₂.SmoothPoint) + (Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q') ^ k)).factors = + if Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing + then k else 0 := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + have hp_ne : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q +- haveI hpMax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hpMax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q + by_cases h_over : Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing + · rw [if_pos h_over] + haveI hQ'lies : Q'.LiesOver (C₂.maximalIdealAt Q) := +@@ -979,11 +942,11 @@ private theorem associates_relNorm_pow_ne_zero + haveI : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q'.asIdeal) ^ k) ≠ 0 := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + rw [Associates.mk_ne_zero] + apply pow_ne_zero +@@ -1018,14 +981,14 @@ private theorem count_relNorm_span_eq_sum_support (Q : C₂.SmoothPoint) + (Associates.mk ((Ideal.relNorm C₂.CoordinateRing Q'.asIdeal) ^ + ((Associates.mk Q'.asIdeal).count + (Associates.mk (Ideal.span ({w} : Set _))).factors))).factors := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def +- haveI hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q + have hp_ne : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + have h_vp_irr : Irreducible (Associates.mk p) := + (⟨p, hpMax.isPrime, hp_ne⟩ : +@@ -1070,15 +1033,15 @@ theorem count_relNorm_eq_sum_fiber : + ∑ Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing, + (Associates.mk Q').count (Associates.mk (Ideal.span ({w} : Set _))).factors := by + classical +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + intro w hw Q + set p : Ideal C₂.CoordinateRing := C₂.maximalIdealAt Q with hp_def +- haveI hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hpMax : p.IsMaximal := C₂.maximalIdealAt_isMaximal Q + have hp_ne : p ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + have hI_ne : Ideal.span ({w} : Set C₁.CoordinateRing) ≠ 0 := by + rw [Ne, Ideal.zero_eq_bot, Ideal.span_singleton_eq_bot]; exact hw +@@ -1185,28 +1148,28 @@ private theorem pushforward_algebraMap_eq_algebraMap_intNorm (w : C₁.Coordinat + algebraMap C₂.CoordinateRing C₂.FunctionField + (Algebra.intNorm C₂.CoordinateRing C₁.CoordinateRing w) := by + classical +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := ++ have hint : Algebra.IsIntegral C₂.CoordinateRing C₁.CoordinateRing := + Algebra.IsIntegral.of_finite C₂.CoordinateRing C₁.CoordinateRing +- haveI tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by ++ have tower2 : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ + rw [RingHom.algebraMap_toAlgebra] + rfl +- haveI faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := ++ have faith : FaithfulSMul C₂.CoordinateRing C₁.FunctionField := + faithfulSMul_coordinateRing_functionField φ cd +- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra +- haveI tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := by ++ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ have tower1 : IsScalarTower C₂.CoordinateRing C₂.FunctionField C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_smul fun r x ↦ ?_ + rw [Algebra.smul_def] + show φ.pullback ((algebraMap C₂.CoordinateRing C₂.FunctionField) r) * x = r • x + rw [cd.compat r, ← IsScalarTower.algebraMap_smul C₁.CoordinateRing r x, ← Algebra.smul_def] + rfl +- haveI hfd : FiniteDimensional C₂.FunctionField C₁.FunctionField := ++ have hfd : FiniteDimensional C₂.FunctionField C₁.FunctionField := + finiteDimensional_functionField φ cd + rw [Algebra.algebraMap_intNorm (A := C₂.CoordinateRing) (B := C₁.CoordinateRing) + (K := C₂.FunctionField) (L := C₁.FunctionField) w] +@@ -1226,11 +1189,11 @@ private theorem intNorm_ne_zero_of_ne_zero (w : C₁.CoordinateRing) (hw : w ≠ + isTorsionFree_coordHom φ cd + Algebra.intNorm C₂.CoordinateRing C₁.CoordinateRing w ≠ 0 := by + classical +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + have hw_FF : algebraMap C₁.CoordinateRing C₁.FunctionField w ≠ 0 := by + intro h +@@ -1283,25 +1246,25 @@ private theorem exists_smoothPoint_maximalIdealAt_eq_of_mem_primesOverFinset + (hQ' : letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra + Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing) : + ∃ P' : C₁.SmoothPoint, C₁.maximalIdealAt P' = Q' ∧ toPointMap cd P' = Q := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd +- haveI hpMax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q ++ have hpMax : (C₂.maximalIdealAt Q).IsMaximal := C₂.maximalIdealAt_isMaximal Q + have hp_ne : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q + rw [IsDedekindDomain.mem_primesOverFinset_iff (B := C₁.CoordinateRing) hp_ne] at hQ' + obtain ⟨hQ'prime, hQ'lies⟩ := hQ' +- haveI : Q'.IsPrime := hQ'prime +- haveI : Q'.LiesOver (C₂.maximalIdealAt Q) := hQ'lies +- haveI hQ'max : Q'.IsMaximal := Ideal.IsPrime.isMaximal hQ'prime (by ++ have : Q'.IsPrime := hQ'prime ++ have : Q'.LiesOver (C₂.maximalIdealAt Q) := hQ'lies ++ have hQ'max : Q'.IsMaximal := Ideal.IsPrime.isMaximal hQ'prime (by + intro h; apply hp_ne + have : C₂.maximalIdealAt Q = Q'.under C₂.CoordinateRing := hQ'lies.over + rw [this, h, Ideal.under_bot]) + obtain ⟨P', hP'⟩ := C₁.exists_smoothPoint_of_isMaximal hQ'max + refine ⟨P', hP', ?_⟩ +- haveI hlies' : (C₁.maximalIdealAt P').LiesOver ++ have hlies' : (C₁.maximalIdealAt P').LiesOver + (C₂.maximalIdealAt (toPointMap cd P')) := + maximalIdealAt_liesOver_toPointMap φ cd P' + have h1 : C₂.maximalIdealAt (toPointMap cd P') = +@@ -1333,11 +1296,11 @@ private theorem affine_section_injOn_attach (Q : C₂.SmoothPoint) : + (_ : b ∈ (IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing).attach), + ProjectiveSmoothPoint.affine (g a.1 a.2) = ProjectiveSmoothPoint.affine (g b.1 b.2) → + a = b := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + intro g hg a _ b _ hab + simp only [ProjectiveSmoothPoint.affine.injEq] at hab +@@ -1373,11 +1336,11 @@ private theorem sum_filter_support_eq_sum_image_section + ∑ x ∈ (IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) + C₁.CoordinateRing).attach.image + (fun Q' ↦ ProjectiveSmoothPoint.affine (g Q'.1 Q'.2)), D x := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + intro g hg_ideal hg_Q + have hp_ne : C₂.maximalIdealAt Q ≠ ⊥ := C₂.maximalIdealAt_ne_bot Q +@@ -1439,11 +1402,11 @@ private theorem sum_image_section_eq_sum_primesOver + (C₁.projectiveDivisorOf (algebraMap C₁.CoordinateRing C₁.FunctionField w)) x) = + ∑ Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing, + ((Associates.mk Q').count (Associates.mk (Ideal.span ({w} : Set _))).factors : ℤ) := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + intro g hg_ideal + rw [Finset.sum_image (affine_section_injOn_attach φ cd Q g hg_ideal)] +@@ -1480,11 +1443,11 @@ private theorem pushforwardDivisorVal_projectiveDivisorOf_affine_eq_sum_fiber + ∑ Q' ∈ IsDedekindDomain.primesOverFinset (C₂.maximalIdealAt Q) C₁.CoordinateRing, + ((Associates.mk Q').count (Associates.mk (Ideal.span ({w} : Set _))).factors : ℤ) := by + classical +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + -- Choose a section `pt` of the fibre `{primes over m_Q} → {smooth points P'}`, with + -- `m_{pt Q'} = Q'` and `φ (pt Q') = Q`, via the existence lemma. +@@ -1532,11 +1495,11 @@ private theorem projectiveDivisorOf_pushforward_algebraMap_apply_affine + φ.pushforwardDivisorVal cd (C₁.projectiveDivisorOf + (algebraMap C₁.CoordinateRing C₁.FunctionField w)) (ProjectiveSmoothPoint.affine Q) := by + classical +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := cd.toAlgebra ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have hfin' : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + cd.module_finite +- haveI htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := ++ have htf : @Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing _ _ modCR := + isTorsionFree_coordHom φ cd + have hnw : Algebra.intNorm C₂.CoordinateRing C₁.CoordinateRing w ≠ 0 := + intNorm_ne_zero_of_ne_zero φ cd w hw +@@ -1585,10 +1548,10 @@ theorem projectiveDivisorOf_pushforward_algebraMap_eq + + end NormConormSteps + +-/-! ### NEW-1(ii): the `f = u/v` reduction ++/-! ### the `f = u/v` reduction + + The deep per-place arithmetic is the `algebraMap` case +-`projectiveDivisorOf_pushforward_algebraMap_eq` (in `section NormConormSteps`). ++`projectiveDivisorOf_pushforward_algebraMap_eq`. + The norm–conorm identity for a *general* `f ∈ K(C₁)` follows from it by the + multiplicativity of both sides together with `IsFractionRing.div_surjective`. + The next four `private` helpers package that reduction: +@@ -1606,8 +1569,8 @@ private theorem projectiveDivisorOf_pushforward_zero (φ : CurveMap C₁ C₂) + FiniteDimensional C₂.FunctionField C₁.FunctionField) : + C₂.projectiveDivisorOf (φ.pushforward (0 : C₁.FunctionField)) = + φ.pushforwardDivisorVal cd (C₁.projectiveDivisorOf (0 : C₁.FunctionField)) := by +- letI algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra +- haveI : FiniteDimensional C₂.FunctionField C₁.FunctionField := hfd ++ let algFF : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ have : FiniteDimensional C₂.FunctionField C₁.FunctionField := hfd + rw [show φ.pushforward (0 : C₁.FunctionField) = 0 from Algebra.norm_zero, + C₂.projectiveDivisorOf_zero, C₁.projectiveDivisorOf_zero, map_zero] + +@@ -1690,44 +1653,16 @@ private theorem projectiveDivisorOf_pushforward_eq_of_algebraMap (φ : CurveMap + pushforwardDivisorVal_projectiveDivisorOf_eq_sub_of_mul_eq φ cd hf hav_ne hf_av, + hau, hav, key u hu_ne, key v hv_ne] + +-/-- **NEW-1(ii) — Silverman II.3.6, norm–conorm identity** `div(N_φ f) = φ_∗(div f)`. +-For a curve map `φ : C₁ → C₂` with coordinate-ring witness `cd` and a function +-`f ∈ K(C₁)`, the projective divisor of the conorm `N_φ f = φ.pushforward f` +-equals the valuation-theoretic pushforward of the projective divisor of `f`. +- +-The content is the per-place identity `ord_Q(N_φ f) = Σ_{P ↦ Q} f_{P/Q}·ord_P(f)` +-(with inertia degrees `f_{P/Q} = 1` over an algebraically closed field), proved +-via `Ideal.sum_ramification_inertia`, `Ideal.relNorm`, and `Algebra.intNorm`. +- +-The proof is the generalisation of the `F[X] → F[C]` machinery of +-`NormValuation.lean` (`count_relNorm_singleton_eq_sum_count_fiber`, +-`relNorm_maximalIdealAt`) to the *coordinate-ring extension* `F[C₂] → F[C₁]` +-induced by `cd`. The instance-heavy steps are factored into the sub-lemmas of +-`section NormConormSteps`, each re-establishing the `cd`-induced algebra and its +-`Module.Finite`/`IsTorsionFree` structure internally (a `relNorm`/`intNorm` +-statement only typechecks with those instances in scope, so the sub-lemmas state +-them via `letI`/`haveI`-in-type and re-derive them in the body): +-* `finiteDimensional_functionField` — the finite extension `K(C₂) → K(C₁)` +- (needed only for the `f = 0` branch below); +-* the degree/`finrank` coherence `finrank_{liftAlgebra} = φ.degree` +- (`IsFractionRing.lift_unique` + `cd.compat`, so `relNorm_algebraMap` yields +- `m_Q ^ φ.degree`), computed inside `relNorm_maximalIdealAt_eq`; +-* `relNorm_maximalIdealAt_eq` — the **`s = 1` core** `relNorm_{F[C₂]}(m_P) = m_{φP}` +- from the global balance `relNorm(m_Q·F[C₁]) = m_Q^{φ.degree} = +- ∏ relNorm(m_{P'})^{e_{P'}}` together with `Σ e_{P'}·f_{P'} = φ.degree` +- (`sum_ramificationIdx_mul_inertiaDeg_eq_degree`) and `f_{P'} = 1` +- (`inertiaDeg_maximalIdealAt_toPointMap`), forcing each exponent to 1; +-* `count_relNorm_eq_sum_fiber` — the affine count identity +- `count_{m_Q}(relNorm (span{u})) = Σ_{Q' over m_Q} count_{Q'}(span{u})`; +-* `projectiveDivisorOf_pushforward_algebraMap_eq` — the `algebraMap` case, matching +- the affine coefficients to the `mapDomain` fibre sum of `pushforwardDivisorVal` +- via the bijection `{P : φP = Q} ≃ {primes over m_Q}` (`maximalIdealAt_toPointMap` +- + `exists_smoothPoint_of_isMaximal`), the place at infinity being forced by +- `projectiveDivisorOf_degree_eq_zero` (both projective divisors have degree `0`, +- and `pushforwardDivisorVal` preserves degree). +-Here the general `f = u/v` reduces to `f = algebraMap u`, `u ∈ F[C₁]` nonzero, via +-`IsFractionRing.div_surjective` and the additivity of both sides +-(`projectiveDivisorOf_mul`, `pushforward_mul`, `pushforwardDivisorVal` a hom). -/ ++/-- **Silverman II.3.6, norm–conorm identity** `div(N_φ f) = φ_∗(div f)`. ++ ++For a curve map with a coordinate-ring witness over an algebraically closed field, ++the local norm formula is `ord_Q(N_φ f) = Σ_{P ↦ Q} ord_P(f)`, since the residue ++degrees are one. The prime-ideal norm formula follows from the fundamental ++ramification identity and the degree of the function-field extension. The ++bijection between points over `Q` and primes over its maximal ideal then gives ++the affine coefficients; degree zero determines the coefficient at infinity. ++The quotient representation `f = u/v` and additivity extend the identity from ++nonzero coordinate-ring elements to all rational functions. -/ + theorem projectiveDivisorOf_pushforward_eq_pushforwardDivisorVal [IsAlgClosed F] + [IsDedekindDomain C₁.CoordinateRing] [IsDedekindDomain C₂.CoordinateRing] + (φ : CurveMap C₁ C₂) (cd : φ.CoordHom) +@@ -1746,7 +1681,7 @@ theorem projectiveDivisorOf_pushforward_eq_pushforwardDivisorVal [IsAlgClosed F] + + end HasseWeil.Curves.CurveMap + +-/-! ### NEW-1(iii)/(iv): compatibility + the gap `h_pres` -/ ++/-! ### Compatibility of divisor pushforwards -/ + + namespace HasseWeil.EC.Isogeny + +@@ -1755,7 +1690,7 @@ open HasseWeil.Curves + variable {F : Type*} [Field F] [DecidableEq F] + variable {W₁ W₂ : Affine F} [W₁.IsElliptic] [W₂.IsElliptic] + +-/-- **NEW-1(iii)**: the point-map pushforward `pushforwardProjectiveDivisor` ++/-- the point-map pushforward `pushforwardProjectiveDivisor` + agrees with the valuation-theoretic pushforward `pushforwardDivisorVal`. By + construction the two `mapDomain` place-image maps coincide, so this is `rfl` + up to the `(φP).toProjectiveSmoothPoint = affine (toPointMap cd P)` identity. -/ +@@ -1776,10 +1711,10 @@ theorem pushforwardProjectiveDivisor_eq_pushforwardDivisorVal (φ : Isogeny W₁ + -- `affine (toPointMap cd P')` after the round-trip. + rfl + +-/-- **NEW-1(iv) / `h_pres` — Silverman II.3.7**: the pushforward `φ_∗` carries ++/-- **Silverman II.3.7**: the pushforward `φ_∗` carries + principal projective divisors to principal ones. This is the sole deep input to + Silverman III.4.8 (`EC.Isogeny.addHomProperty`); it falls out of the norm–conorm +-identity (NEW-1 ii) since the pushforward of `div f` is `div(N_φ f)`, again ++identity since the pushforward of `div f` is `div(N_φ f)`, again + principal. -/ + theorem pushforward_preserves_principal [IsAlgClosed F] + [IsDedekindDomain (⟨W₁⟩ : SmoothPlaneCurve F).CoordinateRing] +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/AFConditional.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/AFConditional.lean +index d56788426..bb5320f8d 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/AFConditional.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/AFConditional.lean +@@ -3,27 +3,16 @@ import HasseWeil.Foundation.Curves.Ramification.PoleOrderParity + import HasseWeil.Isogeny.GroupHom.PicZero + + /-! +-# AF unified package: conditional witnesses ++# Divisor witnesses for additivity of isogenies + +-Wires together the shipped infrastructure into the witnesses needed by +-`AddHomProperty_of_picZero_witnesses` (the universal Silverman III.4.8 +-theorem). Each witness is parametrized over the remaining outstanding +-hypotheses, making the dependency chain explicit: ++The reduction `D ~ (σD) − (O)` of degree-zero divisors identifies their ++Picard classes with point classes. Combined with the assertion that ++`(P) − (O)` is principal only when `P = O`, it shows that the sum of ++points vanishes on principal divisors. These two identities give the ++Picard-group witnesses for additivity of an isogeny whose pushforward ++preserves principal divisors. + +-* `h_inj` (`κ ∘ σ̄ = id`): `DivZeroReduce W` (= reduction lemma). +-* `h_van` (`σ` vanishes on principal): `DivZeroReduce W` AND a +- `point_minus_O_principal_eq_zero` over arbitrary functions +- (= the no-finite-poles bridge). +- +-Once `DivZeroReduce W` lands (which itself decomposes into the +-list-induction `effective_sum_reduce` + Finsupp-to-list bridge for +-multiplicities) and the no-finite-poles bridge, the AF unified package +-fully closes B-4-003 conditionally on Miller (the geometric chord/tangent +-construction, the only remaining genuinely-new mathematical piece). +- +-## References +- +-* `T-PIC-AF-UNIFIED.md` for the full plan. ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.3–III.4. + -/ + + open WeierstrassCurve +@@ -33,19 +22,14 @@ namespace HasseWeil.Curves + variable {F : Type*} [Field F] [DecidableEq F] + (W : Affine F) [W.IsElliptic] + +-/-- The full divisor reduction property: every degree-zero divisor is +-linearly equivalent to `(σD) − (O)`. The proof requires Miller (via +-`effective_sum_reduce`) plus a Finsupp-to-list bridge for handling +-multiplicities. Both are outstanding tickets. -/ ++/-- Every degree-zero divisor is linearly equivalent to `(σD) − (O)`, ++where `σD` is its sum of points with multiplicity. -/ + def DivZeroReduce : Prop := + ∀ D : ProjectiveDivisor.degZero (⟨W⟩ : SmoothPlaneCurve F), + SmoothPlaneCurve.ProjLinearlyEquiv (⟨W⟩ : SmoothPlaneCurve F) + D.val (kappaDivisor W (projectiveDivisorSum W D.val)) + +-/-- The unconditional `point_minus_O` property: if `(P) − (O)` is +-principal, then `P = 0`. The proof requires the parity lemma (shipped +-as `point_minus_O_principal_eq_zero_of_coord`) plus the no-finite-poles +-→ CR-image bridge (outstanding ticket: `T-PIC-AF-UNIFIED.md` piece (a)). -/ ++/-- A point divisor `(P) − (O)` is principal only when `P = O`. -/ + def PointMinusOPrincipalEqZero : Prop := + ∀ P : W.Point, + SmoothPlaneCurve.ProjIsPrincipal (⟨W⟩ : SmoothPlaneCurve F) +@@ -112,11 +96,8 @@ theorem h_van_degZero_of_divZeroReduce_and_pointMinusO + + /-! ### `PointMinusOPrincipalEqZero` from the no-finite-poles bridge -/ + +-/-- The no-finite-poles → CR-image bridge: any nonzero function with all +-local orders nonneg lies in the coordinate-ring image. The proof composes +-worker-I's `pointValuation_algebraMap_le_one`, `smoothPointEquivMaxIdeal` +-(under `[IsAlgClosed F] [IsElliptic]`), and mathlib's +-`mem_coordinateRing_of_valuation_le_one`. ~80-150 LOC follow-up ticket. -/ ++/-- A nonzero function with nonnegative order at every affine point ++lies in the image of the coordinate ring. -/ + def NoFinitePolesBridge : Prop := + ∀ (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField), f ≠ 0 → + (∀ P : (⟨W⟩ : SmoothPlaneCurve F).SmoothPoint, +@@ -151,9 +132,9 @@ theorem pointMinusO_of_bridge + ((ProjectiveSmoothPoint.infinity : ProjectiveSmoothPoint + (⟨W⟩ : SmoothPlaneCurve F))) ≠ ProjectiveSmoothPoint.affine Q := by + nofun +- rw [if_neg h_inf_ne, sub_zero] at h_eq ++ rw [ite_eq_right h_inf_ne, sub_zero] at h_eq + by_cases h_eq_pt : P.toProjectiveSmoothPoint = ProjectiveSmoothPoint.affine Q +- · rw [if_pos h_eq_pt] at h_eq ++ · rw [ite_eq_left h_eq_pt] at h_eq + cases h_top : (⟨W⟩ : SmoothPlaneCurve F).ord_P Q f with + | top => + rw [h_top, WithTop.untopD_top] at h_eq +@@ -163,7 +144,7 @@ theorem pointMinusO_of_bridge + have hn : n = 1 := h_eq.symm + subst hn + exact_mod_cast (by decide : (0 : ℤ) ≤ 1) +- · rw [if_neg h_eq_pt] at h_eq ++ · rw [ite_eq_right h_eq_pt] at h_eq + cases h_top : (⟨W⟩ : SmoothPlaneCurve F).ord_P Q f with + | top => + exact absurd (((⟨W⟩ : SmoothPlaneCurve F).ord_P_eq_top_iff (P := Q) f).mp h_top) hf_ne +@@ -174,17 +155,10 @@ theorem pointMinusO_of_bridge + + /-! ### Bundled AFInputs structure -/ + +-/-- The three input Props needed for the AF unified package on a single +-elliptic curve `W`: +- +-* `miller`: chord/tangent geometric identity at the divisor level. +-* `divZeroReduce`: combinatorial reduction `D ~ (σD) − (O)` for D ∈ Div⁰. +-* `noFinitePolesBridge`: the algebraic bridge from "no finite poles" to +- "in coordinate-ring image". +- +-Each is its own outstanding ticket; once all three are discharged for a +-specific `W`, both witnesses needed by `AddHomProperty_of_picZero_witnesses` +-(restricted to that curve's side of the isogeny) follow immediately. -/ ++/-- The divisor identities needed to identify an elliptic curve with ++its degree-zero Picard group: the Miller relation, reduction of ++degree-zero divisors to point divisors, and the coordinate-ring ++characterization of functions with no finite poles. -/ + structure AFInputs (W : Affine F) [W.IsElliptic] where + miller : MillerHypothesis W + divZeroReduce : DivZeroReduce W +@@ -217,12 +191,9 @@ theorem h_van_degZero {W : Affine F} [W.IsElliptic] (a : AFInputs W) + + end AFInputs + +-/-! ### Final B-4-003 wrapper -/ ++/-! ### Additivity from divisor witnesses -/ + +-/-- The "principal divisors lie in degZero" predicate. Proved by +-worker-K's T-II-3-009 (`projectiveDivisorOf_degree_zero`) under +-`[IsAlgClosed F]`. We take it as a hypothesis here to keep the wrapper +-conditional. -/ ++/-- Principal projective divisors have degree zero. -/ + def PrincipalImpliesDegZero (W : Affine F) [W.IsElliptic] : Prop := + ∀ D : ProjectiveDivisor (⟨W⟩ : SmoothPlaneCurve F), + D ∈ (⟨W⟩ : SmoothPlaneCurve F).projPrincipalSubgroup → +@@ -230,8 +201,8 @@ def PrincipalImpliesDegZero (W : Affine F) [W.IsElliptic] : Prop := + + namespace AFInputs + +-/-- The full h_van witness, given `AFInputs` + the principal-implies-degZero +-bridge (worker-K's T-II-3-009). -/ ++/-- The sum of points vanishes on principal divisors, given the divisor ++identities in `AFInputs` and the degree-zero property of principal divisors. -/ + theorem h_van {W : Affine F} [W.IsElliptic] (a : AFInputs W) + (h_pdz : PrincipalImpliesDegZero W) + (D : ProjectiveDivisor (⟨W⟩ : SmoothPlaneCurve F)) +@@ -241,20 +212,9 @@ theorem h_van {W : Affine F} [W.IsElliptic] (a : AFInputs W) + + end AFInputs + +-/-- **Final conditional B-4-003** for an isogeny: given `AFInputs` for +-both curves, the principal-degZero bridge for both curves, and the +-pushforward-preserves-principal hypothesis (T-PIC-C-003), the universal +-hom property holds. +- +-This closes B-4-003 over `[IsAlgClosed F]` modulo: +-- `MillerHypothesis` for both W₁ and W₂ (geometric chord/tangent — the BIG remaining piece) +-- `DivZeroReduce` for both W₁ and W₂ (Finsupp decomposition + miller corollaries) +-- `NoFinitePolesBridge` for both W₁ and W₂ (valuation bridge) +-- `PrincipalImpliesDegZero` for both W₁ and W₂ (worker-K's T-II-3-009) +-- `h_pres` (T-PIC-C-003 = norm-divisor identity) +- +-All the structural plumbing is here; the remaining work is to prove +-each of these Props for elliptic curves. -/ ++/-- An isogeny is additive given the divisor identities on both curves, ++the degree-zero property of principal divisors, and preservation of ++principal divisors by its pushforward. See Silverman III.4.8. -/ + theorem AddHomProperty_of_AFInputs + {W₁ W₂ : Affine F} [W₁.IsElliptic] [W₂.IsElliptic] + (φ : HasseWeil.EC.Isogeny W₁ W₂) +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/GenericFiber.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/GenericFiber.lean +index 7a21963e5..91c992b49 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/GenericFiber.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Fiber/GenericFiber.lean +@@ -12,38 +12,13 @@ import Mathlib.RingTheory.DedekindDomain.Different + import Mathlib.RingTheory.DedekindDomain.Factorization + + /-! +-# Generic fiber cardinality (T-II-2-009, Silverman II.2.6(b)) ++For a coordinate-ring morphism, if a nonzero prime is unramified and all residue ++field degrees above it are one, its number of primes above equals the ++function-field degree. For a separable morphism this is the separable degree. ++The algebraic support also identifies finite ramification loci through the ++different ideal and constructs smooth points over algebraically closed fields. + +-For a nonconstant morphism `φ : C₁ → C₂` of smooth curves, for almost all +-points `Q ∈ C₂`, the fiber `φ⁻¹(Q)` has cardinality equal to the +-separable degree `deg_s(φ)`. +- +-This file provides the **algebraic-geometric content** of T-II-2-009 at +-the Dedekind-domain level, building on the `CurveMap` + `CoordHom` +-infrastructure: if we can exhibit a maximal ideal `p ⊂ C₂.CoordinateRing` +-that is **unramified** and has **trivial residue-field degrees**, then +-the number of primes above it equals the function-field degree `deg(φ)` +-(which coincides with `deg_s(φ)` for separable `φ`). +- +-This is one side of Silverman's II.2.6(b): the fibre-cardinality statement +-in terms of the discrete-prime count. The other direction — **exhibiting** +-such an unramified prime `p` — requires the primitive-element-plus- +-discriminant construction over a base that sees "almost all" `Q` (i.e. +-the unramified locus is a dense open). Over arbitrary `F`, this is the +-main piece still missing; see the progress note at the end. +- +-## Main results +- +-* `CurveMap.primesOverFinset_card_eq_degree_of_unramified` — given an +- unramified prime `p` with every residue-field degree `f_P = 1`, the +- number of primes above `p` equals `φ.degree`. +-* `CurveMap.primesOverFinset_card_eq_sepDegree_of_separable_and_unramified` +- — same conclusion in terms of `sepDegree` under the separability +- hypothesis (which forces `deg = sepDeg`). +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*], II.2.6(b). ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.6(b). + -/ + + namespace HasseWeil.Curves +@@ -52,12 +27,6 @@ namespace CurveMap + + variable {F : Type*} [Field F] {C₁ C₂ : SmoothPlaneCurve F} + +-/-- **T-II-2-009, algebraic direction** (unramified + trivial residue +-degrees ⇒ fiber count = degree). Given a `CurveMap` with `CoordHom` +-witness and a maximal ideal `p ⊂ C₂.CoordinateRing` that is +-(i) non-zero, (ii) has every ramification index = 1 on the primes above it, +-and (iii) has every inertia (residue) degree = 1, the number of primes +-above `p` equals `φ.degree`. -/ + theorem primesOverFinset_card_eq_degree_of_unramified + [IsIntegrallyClosed C₂.CoordinateRing] + [IsIntegrallyClosed C₁.CoordinateRing] +@@ -67,10 +36,10 @@ theorem primesOverFinset_card_eq_degree_of_unramified + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + ∀ P ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, + Ideal.ramificationIdx' p P * +- Ideal.inertiaDeg' p P = 1) : ++ P.inertiaDeg C₂.CoordinateRing = 1) : + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + (IsDedekindDomain.primesOverFinset p C₁.CoordinateRing).card = φ.degree := by +- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra ++ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + have hsum := φ.sum_ramificationIdx_mul_inertiaDeg_eq_degree + coordHom coordHom.module_finite hpMax hp0 + -- Σ_{P ∈ S} (e · f) = deg. With each e·f = 1, LHS = S.card. +@@ -80,10 +49,6 @@ theorem primesOverFinset_card_eq_degree_of_unramified + rw [Finset.sum_const, Nat.smul_one_eq_cast] at hsum' + exact_mod_cast hsum' + +-/-- **T-II-2-009 (separable case)**: for a separable `CurveMap` with an +-unramified + trivial-residue-degree prime, the fiber count equals +-`sepDegree`. Uses the fact that `sepDegree = degree` for separable +-extensions (via `Field.finSepDegree_eq_finrank_iff`). -/ + theorem primesOverFinset_card_eq_sepDegree_of_separable_and_unramified + [IsIntegrallyClosed C₂.CoordinateRing] + [IsIntegrallyClosed C₁.CoordinateRing] +@@ -94,11 +59,11 @@ theorem primesOverFinset_card_eq_sepDegree_of_separable_and_unramified + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + ∀ P ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, + Ideal.ramificationIdx' p P * +- Ideal.inertiaDeg' p P = 1) : ++ P.inertiaDeg C₂.CoordinateRing = 1) : + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + (IsDedekindDomain.primesOverFinset p C₁.CoordinateRing).card = φ.separableDegree := by + -- separable + finite-dim ⇒ sepDegree = degree. +- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra + have hsep_eq : φ.degree = φ.separableDegree := by + change φ.degree = @Field.finSepDegree _ _ _ _ φ.toAlgebra + have hinsep : φ.inseparableDegree = 1 := hsep +@@ -112,17 +77,6 @@ theorem primesOverFinset_card_eq_sepDegree_of_separable_and_unramified + exact φ.primesOverFinset_card_eq_degree_of_unramified coordHom + hpMax hp0 h_ef_one + +-/-! ### Piece 1 — bad locus `{p : p ∣ differentIdeal}` is finite +- +-For a finite separable extension of Dedekind domains `A → B`, the set of +-maximal ideals `p ⊂ A` that ramify (i.e. divide `differentIdeal A B`) +-is **finite**. Direct consequence of `differentIdeal_ne_bot` + +-`Ideal.finite_factors`. -/ +- +-/-- **T-II-2-009 Piece 1**: the set of height-one primes of `B` that +-divide `differentIdeal A B` is finite. These are the "ramified primes" +-in the `A → B` extension (primes above which at least one prime of `B` +-has `e_P ≥ 2`). Silverman II.2.6(b) "finitely many bad Q". -/ + theorem _root_.IsDedekindDomain.finite_ramified_primes + {A : Type*} [CommRing A] [IsDedekindDomain A] + {B : Type*} [CommRing B] [IsDedekindDomain B] +@@ -132,20 +86,13 @@ theorem _root_.IsDedekindDomain.finite_ramified_primes + (FractionRing.liftAlgebra A (FractionRing B))) : + {P : IsDedekindDomain.HeightOneSpectrum B | + P.asIdeal ∣ differentIdeal A B}.Finite := by +- letI : Algebra (FractionRing A) (FractionRing B) := ++ let : Algebra (FractionRing A) (FractionRing B) := + FractionRing.liftAlgebra A (FractionRing B) +- haveI : IsScalarTower A (FractionRing A) (FractionRing B) := ++ have : IsScalarTower A (FractionRing A) (FractionRing B) := + FractionRing.isScalarTower_liftAlgebra A (FractionRing B) +- haveI := hsep ++ have := hsep + exact Ideal.finite_factors (differentIdeal_ne_bot (A := A) (B := B)) + +-/-! ### Piece 2 — `¬ P ∣ differentIdeal ⇒ IsUnramifiedAt A P` +- +-Direct corollary of mathlib's `not_dvd_differentIdeal_iff`. Packages the +-easier direction as a standalone lemma for use in Pieces 3–5. -/ +- +-/-- **T-II-2-009 Piece 2**: a prime of `B` that does not divide the +-different ideal is unramified over `A`. -/ + theorem _root_.IsDedekindDomain.isUnramifiedAt_of_not_dvd_differentIdeal + {A : Type*} [CommRing A] [IsDedekindDomain A] + {B : Type*} [CommRing B] [IsDedekindDomain B] +@@ -155,50 +102,27 @@ theorem _root_.IsDedekindDomain.isUnramifiedAt_of_not_dvd_differentIdeal + (FractionRing.liftAlgebra A (FractionRing B))) + {P : Ideal B} [P.IsPrime] (hnd : ¬ P ∣ differentIdeal A B) : + Algebra.IsUnramifiedAt A P := by +- letI : Algebra (FractionRing A) (FractionRing B) := ++ let : Algebra (FractionRing A) (FractionRing B) := + FractionRing.liftAlgebra A (FractionRing B) +- haveI : IsScalarTower A (FractionRing A) (FractionRing B) := ++ have : IsScalarTower A (FractionRing A) (FractionRing B) := + FractionRing.isScalarTower_liftAlgebra A (FractionRing B) +- haveI := hsep ++ have := hsep + exact not_dvd_differentIdeal_iff.mp hnd + +-/-! ### Piece 3 — `IsUnramifiedAt P ⇒ e_{P|A} = 1` +- +-Corollary of mathlib's `Ideal.ramificationIdx_eq_one_of_isUnramifiedAt`. +-Packages the ramification-index side of unramifiedness; the inertia-degree +-side (`f_P = 1`) requires the residue field to be trivial over the base, +-which is **automatic over algebraically closed `F`** but must be supplied +-externally over arbitrary base fields. -/ +- +-/-- **T-II-2-009 Piece 3 (ramification half)**: a prime `P` of `B` that is +-unramified over `A` has ramification index `1` (at its image in `A`). +-Direct corollary of mathlib's `Ideal.ramificationIdx_eq_one_of_isUnramifiedAt`. -/ + theorem _root_.IsDedekindDomain.ramificationIdx_eq_one_of_isUnramifiedAt_of_ne_bot + {A : Type*} [CommRing A] [IsDomain A] + {B : Type*} [CommRing B] [IsDomain B] [IsNoetherianRing B] + [Algebra A B] [Algebra.EssFiniteType A B] + {P : Ideal B} [P.IsPrime] [Algebra.IsUnramifiedAt A P] (hP : P ≠ ⊥) : + Ideal.ramificationIdx' (P.under A) P = 1 := by +- haveI : P.LiesOver (P.under A) := ⟨rfl⟩ +- letI := Localization.AtPrime.algebraOfLiesOver (P.under A) P ++ have : P.LiesOver (P.under A) := ⟨rfl⟩ ++ let := Localization.AtPrime.algebraOfLiesOver (P.under A) P + have hmap : (P.under A).map (algebraMap A (Localization.AtPrime P)) = + IsLocalRing.maximalIdeal _ := + ((Algebra.isUnramifiedAt_iff_map_eq A (P.under A) P).mp ‹_›).2 + exact Ideal.ramificationIdx'_eq_one_of_map_localization Ideal.map_comap_le hP + (Ideal.primeCompl_le_nonZeroDivisors P) hmap + +-/-! ### Piece 4 — existence of an unramified prime +- +-Given Piece 1 (bad locus finite) and the assumption that `B` has +-infinitely many height-one primes (a genuine curve-theory input, since a +-Dedekind domain of infinite F-dimension has infinite spectrum), there +-exists a prime `P` of `B` outside the ramified locus. Piece 2 then turns +-"not in bad locus" into `IsUnramifiedAt A P`. -/ +- +-/-- **T-II-2-009 Piece 4**: combining Piece 1 (bad locus finite) + Piece 2 +-(not-in-bad-locus ⇒ IsUnramifiedAt), plus the hypothesis that `B` has +-infinitely many height-one primes, we extract a specific prime +-`P : HeightOneSpectrum B` that is unramified over `A`. -/ + theorem _root_.IsDedekindDomain.exists_unramified_prime + {A : Type*} [CommRing A] [IsDedekindDomain A] + {B : Type*} [CommRing B] [IsDedekindDomain B] +@@ -229,30 +153,9 @@ theorem _root_.IsDedekindDomain.exists_unramified_prime + exact hfin_bad.subset this + obtain ⟨P, hP⟩ := hgood_nonempty + refine ⟨P, ?_⟩ +- haveI : P.asIdeal.IsPrime := P.isPrime ++ have : P.asIdeal.IsPrime := P.isPrime + exact IsDedekindDomain.isUnramifiedAt_of_not_dvd_differentIdeal hsep hP + +-/-! ### Piece 5 — composed theorem at the abstract Dedekind level +- +-Combining Pieces 1–4 yields: for a finite separable extension of Dedekind +-domains `A → B` with `B` having infinitely many height-one primes, there +-exists a specific prime `P` of `B` for which the ramification index is +-exactly `1`. +- +-Specialised to `CurveMap + CoordHom` + `[IsAlgClosed F]` (where residue +-field degrees are automatically `1`), this gives `(primesOverFinset).card +-= φ.degree` — the full Silverman II.2.6(b) content. -/ +- +-/-- **T-II-2-009 Piece 5 (composed at A → B level)**: assembles Pieces +-1–4 into a single witness. For `A → B` Dedekind + finite separable + +-`B` infinite in primes, there exists a `P ∈ HeightOneSpectrum B`, +-nonzero, with `ramificationIdx' (P.under A → P) = 1`. +- +-The inertia degree `f_P = 1` is NOT concluded here — it depends on the +-residue-field extension being trivial, which is automatic over +-algebraically closed base (or for F-rational smooth points), and +-supplied as a separate hypothesis when needed (see +-`primesOverFinset_card_eq_degree_of_unramified`). -/ + theorem _root_.IsDedekindDomain.exists_unramifiedPrime_ramificationIdx_eq_one + {A : Type*} [CommRing A] [IsDedekindDomain A] + {B : Type*} [CommRing B] [IsDedekindDomain B] +@@ -265,31 +168,17 @@ theorem _root_.IsDedekindDomain.exists_unramifiedPrime_ramificationIdx_eq_one + ∃ P : IsDedekindDomain.HeightOneSpectrum B, + Ideal.ramificationIdx' (P.asIdeal.under A) P.asIdeal = 1 := by + obtain ⟨P, hunram⟩ := IsDedekindDomain.exists_unramified_prime hsep hinf +- haveI : P.asIdeal.IsPrime := P.isPrime +- haveI := hunram ++ have : P.asIdeal.IsPrime := P.isPrime ++ have := hunram + refine ⟨P, ?_⟩ + exact IsDedekindDomain.ramificationIdx_eq_one_of_isUnramifiedAt_of_ne_bot P.ne_bot + + end CurveMap + +-/-! ### Piece 6 — HeightOneSpectrum infinite over alg-closed base +- +-Over an algebraically closed base `F` with `[IsElliptic]`, the coordinate +-ring `C.CoordinateRing` has infinitely many height-one primes. The proof +-goes via the `smoothPointEquivHeightOneSpectrum` bijection +-(in `HasseWeil/Curves/SmoothPointPrime.lean`), reducing to showing +-`C.SmoothPoint` is infinite. This follows because for each `x ∈ F`, the +-Weierstrass equation in `y` is a quadratic over an algebraically closed +-field and hence has a root — giving an injection `F → C.SmoothPoint`. -/ +- + namespace SmoothPlaneCurve + + variable {F : Type*} [Field F] + +-/-- **T-II-2-009 Piece 6 (smooth points)**: for every `x ∈ F` over an +-algebraically closed field, there exists `y : F` with `(x, y)` a +-nonsingular point on the elliptic curve (any point on an elliptic curve +-is automatically nonsingular since `Δ ≠ 0`). -/ + theorem exists_smoothPoint_of_x + [IsAlgClosed F] (C : SmoothPlaneCurve F) [C.toAffine.IsElliptic] (x : F) : + ∃ P : C.SmoothPoint, P.x = x := by +@@ -320,9 +209,6 @@ theorem exists_smoothPoint_of_x + (W := C.toAffine)).mp heq + exact ⟨⟨x, y, hns⟩, rfl⟩ + +-/-- **T-II-2-009 Piece 6**: `C.SmoothPoint` is infinite over an +-algebraically closed base. Via the injection `x ↦ (smooth point with +-that x-coordinate)`. -/ + theorem smoothPoint_infinite + [IsAlgClosed F] (C : SmoothPlaneCurve F) [C.toAffine.IsElliptic] : + Infinite C.SmoothPoint := by +@@ -338,17 +224,13 @@ theorem smoothPoint_infinite + rw [h₁, h₂] at this + exact this + +-/-- **T-II-2-009 Piece 6 (main)**: the height-one spectrum of +-`C.CoordinateRing` is infinite over an algebraically closed elliptic +-curve, via the bijection `SmoothPoint ≃ HeightOneSpectrum` from +-`HasseWeil/Curves/SmoothPointPrime.lean`. -/ + theorem heightOneSpectrum_infinite + [IsAlgClosed F] (C : SmoothPlaneCurve F) [C.toAffine.IsElliptic] + [IsIntegrallyClosed C.CoordinateRing] : + Set.Infinite ({_P : IsDedekindDomain.HeightOneSpectrum C.CoordinateRing | + True}) := by +- haveI : Infinite C.SmoothPoint := C.smoothPoint_infinite +- haveI : Infinite (IsDedekindDomain.HeightOneSpectrum C.CoordinateRing) := ++ have : Infinite C.SmoothPoint := C.smoothPoint_infinite ++ have : Infinite (IsDedekindDomain.HeightOneSpectrum C.CoordinateRing) := + Infinite.of_injective C.smoothPointEquivHeightOneSpectrum + C.smoothPointEquivHeightOneSpectrum.injective + exact Set.infinite_univ +@@ -358,52 +240,11 @@ end SmoothPlaneCurve + namespace CurveMap + variable {F : Type*} [Field F] {C₁ C₂ : SmoothPlaneCurve F} + +-/-! ### Piece 7 — residue fields at smooth points are `F` +- +-The residue-field-degree-one content (f_P = 1) of T-II-2-009 Piece 7. +-Rather than prove `inertiaDeg' = 1` directly — which hits a diamond +-between `Module.Free` from `Ideal.Quotient` vs `DivisionRing` paths — +-we package the residue-field F-rank: `finrank F (C.CoordinateRing / +-maximalIdealAt P) = 1`. Any consumer wanting `inertiaDeg' = 1` over an +-F-rational SmoothPoint combines this (for source + target) with the +-tower `finrank_mul_finrank`; the direct +-`inertiaDeg_maximalIdealAt` covers the specific `F[X] → F[C]` case. -/ +- +-/-- **T-II-2-009 Piece 7 (residue field)**: the residue field of +-`C.CoordinateRing` at a smooth point `P` equals `F` (as `F`-module of +-rank 1). Direct re-export of `finrank_quotientMaximalIdealAt` +-for use in the Piece 8 chain. -/ + theorem finrank_quotientMaximalIdealAt_eq_one + (C : SmoothPlaneCurve F) (P : C.SmoothPoint) : + Module.finrank F (C.CoordinateRing ⧸ C.maximalIdealAt P) = 1 := + C.finrank_quotientMaximalIdealAt P + +-/-! ### Piece 8 — final assembly: T-II-2-009 for CurveMap +- +-Combines Pieces 1–7: given a CurveMap with CoordHom, separable, +-and ([IsAlgClosed F] providing infinite spectrum + residue-degree=1), +-there's a maximal ideal of `C₂.CoordinateRing` whose fiber (primes above +-it in `C₁.CoordinateRing`) has cardinality equal to `φ.separableDegree`. +- +-The `f_P = 1` side of the inertia +-computation is supplied as a **witness hypothesis** (`h_inertia_one`) +-rather than proven in-line, due to the `Module.Free` diamond between +-`Ideal.Quotient.semiring` and `DivisionRing.toDivisionSemiring.toSemiring` +-paths. Under `[IsAlgClosed F]`, the hypothesis is always satisfied +-(both residue fields are `F`); the caller supplies it via +-`SmoothPlaneCurve.finrank_quotientMaximalIdealAt_eq_one` (Piece 7) for +-each prime in their specific setting. -/ +- +-/-- **T-II-2-009 Piece 8 (full assembly, witness form)**: given the +-witness hypotheses for unramified existence + trivial residue degrees, +-produce a prime of `C₂.CoordinateRing` whose fiber in `C₁.CoordinateRing` +-has cardinality `φ.separableDegree`. +- +-The existence of an unramified Q (via Pieces 1–6 for alg-closed base) is +-bundled as `h_unramified_Q`. The trivial residue degree is bundled as +-`h_inertia_one` (follows from Piece 7 over [IsAlgClosed F] via the +-`maximalIdealAt` ↔ `HeightOneSpectrum` bijection from +-`smoothPointEquivHeightOneSpectrum`). -/ + theorem exists_heightOneSpectrum_fiber_card_eq_sepDegree + [IsIntegrallyClosed C₂.CoordinateRing] + [IsIntegrallyClosed C₁.CoordinateRing] +@@ -414,94 +255,15 @@ theorem exists_heightOneSpectrum_fiber_card_eq_sepDegree + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + ∀ P ∈ IsDedekindDomain.primesOverFinset Q.asIdeal C₁.CoordinateRing, + Ideal.ramificationIdx' Q.asIdeal P * +- Ideal.inertiaDeg' Q.asIdeal P = 1) : ++ P.inertiaDeg C₂.CoordinateRing = 1) : + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + (IsDedekindDomain.primesOverFinset Q.asIdeal C₁.CoordinateRing).card = φ.separableDegree := by +- haveI : Q.asIdeal.IsPrime := Q.isPrime +- haveI hQmax : Q.asIdeal.IsMaximal := ++ have : Q.asIdeal.IsPrime := Q.isPrime ++ have hQmax : Q.asIdeal.IsMaximal := + Q.isPrime.isMaximal Q.ne_bot + exact φ.primesOverFinset_card_eq_sepDegree_of_separable_and_unramified + coordHom hsep hQmax Q.ne_bot h_ef_one_Q + +-/-! ### Piece 9 — `inertiaDeg' = 1` at smooth points: diamond-blocked +- +-**Status**: blocked by the `Module.Free (C₂.CR/Q) (C₁.CR/P)` typeclass +-diamond. The attempted workaround — using `F` as outer ring in +-`Module.finrank_mul_finrank F _ _` — does **not** bypass the problem, +-because `finrank_mul_finrank` still requires `Module.Free` on the +-intermediate extension. Specifically: +- +-- `Module.Free.of_divisionRing` produces `Module.Free` via +- `DivisionRing.toDivisionSemiring.toSemiring`. +-- The expected instance on `(C₂.CR/Q)`-module `(C₁.CR/P)` goes through +- `Ideal.Quotient.semiring` and `Algebra.toModule`. +-- These two `Semiring` parent-paths do not unify — the same `Module.Free` +- diamond between the two `Semiring` structures. +- +-The narrower witness form (`exists_heightOneSpectrum_fiber_card_eq_sepDegree`, +-Piece 8 above) takes the `e_P · f_P = 1` hypothesis as input and is the +-shippable deliverable. Closing `inertiaDeg' = 1` without the diamond +-requires either: +- +-1. A mathlib-level change to make `Ideal.Quotient.semiring` and +- `Field`-derived `Semiring` agree definitionally, OR +-2. A residue-field algebra isomorphism `C.CR/(maximalIdealAt P) ≃ₐ[F] F` +- (under `[IsAlgClosed F]`), expressed without passing through +- `Module.Free` synthesis on the intermediate quotient, OR +-3. A direct computation of `Ideal.inertiaDeg'` from the algebra-map +- surjectivity at smooth points on an algebraically closed base. +- +-The second route is the most promising — a dedicated file +-`HasseWeil/Curves/ResidueFieldAtSmoothPoint.lean` building an explicit +-`AlgEquiv` at each smooth point and then transporting `inertiaDeg'` +-through it would sidestep `finrank_mul_finrank` entirely. Estimated +-~100 LOC. Deferred. -/ +- +-/-! ### Progress note — the remaining piece (existence of unramified p) +- +-The full T-II-2-009 statement **`∃ Q, #φ⁻¹(Q) = sepDeg(φ)`** reduces (via +-the theorems above) to exhibiting a maximal `p ⊂ C₂.CoordinateRing` with +-the ramification + inertia witnesses. Over an algebraically-closed base +-field `F`, such a `p` always exists because: +- +-1. **Primitive element**: the separable closure `L ⊂ C₁.FunctionField` +- of `φ*(C₂.FunctionField)` is generated by a primitive element `α` +- with minimal polynomial `m(T) ∈ (φ*C₂.FunctionField)[T]` of degree +- `sepDeg(φ)`. +- +-2. **Discriminant**: `m` is separable (primitive-element condition), so +- `discriminant(m)` is a nonzero element of `φ*C₂.FunctionField`. +- Viewed in `C₂.FunctionField`, it has finitely many zeros (as an element +- of a function field with a degree structure). +- +-3. **Dense open**: at any `p ⊂ C₂.CoordinateRing` outside the zero locus +- of `discriminant(m)`, the specialisation `m̄ ∈ (C₂.CoordinateRing/p)[T]` +- has `sepDeg(φ)` distinct roots in `C₁.CoordinateRing/P` for each `P` +- above `p`. This gives the ramification + inertia witnesses. +- +-The formalisation gap: +-- Mathlib has `Field.exists_primitive_element` (step 1) and +- `Polynomial.discriminant_ne_zero_of_separable` (step 2). +-- Step 3 requires the algebraic-geometric bridge between "discriminant +- nonzero at `p`" and "unramified at `p` with trivial residue +- extensions". For Dedekind extensions this is +- `Algebra.IsUnramifiedAt ↔ ¬ p ∣ differentIdeal`, and over alg-closed +- base the residue fields all equal `F`, making `inertiaDeg' = 1` +- automatic. +- +-This last step is ~200 lines of algebraic-geometric infrastructure +-following Silverman + Neukirch (*Algebraic Number Theory*, III.2). The +-algebraic core (steps 1–2) is immediate in mathlib; step 3 is the +-substantive remaining content. Tracked under T-II-2-009's progress log. +- +-The **alternative path** `#ker β_pc = sepDeg β_pc` (for the specific +-β_pc = 1 − π) can be closed *without* the full T-II-2-009 once +-`AdditionPullback.lean` replaces the `isogOneSub` placeholder — that +-gives the real function-field pullback, from which `deg β_pc = +-[K(E) : φ*K(E)] = q + 1 − t` follows via explicit computation, and +-`#ker β_pc = pointCount = q + 1 − t` then furnishes `#ker β_pc = deg +-β_pc` directly. -/ +- + end CurveMap + + end HasseWeil.Curves +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Frobenius/FrobeniusFixedPoint.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Frobenius/FrobeniusFixedPoint.lean +index 758285749..d4ec75e01 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Frobenius/FrobeniusFixedPoint.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Frobenius/FrobeniusFixedPoint.lean +@@ -9,60 +9,12 @@ import Mathlib.FieldTheory.Finite.Basic + import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure + + /-! +-# Geometric Frobenius on points over the algebraic closure (Route B, Step 2) ++For a finite field `K` of cardinality `q`, the map `(x, y) ↦ (x ^ q, y ^ q)` ++on the algebraic-closure points of a Weierstrass curve fixes exactly the ++`K`-rational points. Consequently the kernel of the identity minus Frobenius ++has cardinality equal to the number of `K`-rational points. + +-For a finite field `K` with `q = Fintype.card K` and a Weierstrass curve `W` over `K`, +-base-changed to `L = AlgebraicClosure K`, this file builds the **geometric Frobenius** +-endomorphism on the `L`-points, +- +-``` +-geomFrobeniusPoint : (W.baseChange L).toAffine.Point →+ (W.baseChange L).toAffine.Point +-``` +- +-acting as `(x, y) ↦ (x ^ q, y ^ q)` (and `0 ↦ 0`), via mathlib's `FiniteField.frobeniusAlgHom` +-(`x ↦ x ^ q`, a `K`-algebra hom on `L`) transported to points by the project's +-`HasseWeil.Affine.Point.map`. The codomain identification +- +-``` +-(W.baseChange L).map (frobeniusAlgHom K L) = W.baseChange L +-``` +- +-(`WeierstrassCurve.map_baseChange`, because the `q`-power map is a `K`-algebra hom and so +-fixes the `algebraMap K L` image) makes this an *endomorphism* of the same point type. +- +-It also packages the base-change inclusion of `K`-points +- +-``` +-includePointBC : W.toAffine.Point →+ (W.baseChange L).toAffine.Point +-``` +- +-via `HasseWeil.Affine.Point.map (algebraMap K L)`. +- +-## Main result (Step 2 = S2) +- +-* `HasseWeil.geomFrobeniusPoint_fixed_iff_mem_range_includePointBC`: +- `geomFrobeniusPoint P = P ↔ P ∈ Set.range includePointBC`, +- the *point-level* fixed-locus theorem. Proof by cases on `P`: +- - `P = 0` is fixed and `0 = includePointBC 0`; +- - `P = (x, y)` is fixed iff `x ^ q = x ∧ y ^ q = y`, iff (by Step 1 +- `frobenius_fixed_iff_mem_baseField`) both coordinates lie in `range (algebraMap K L)`, +- iff `P = includePointBC (x₀, y₀)`. +- +-## Further results (S3/S4 and the `1 − π` kernel) +- +-* `fixedLocus_geomFrobenius_eq_range_includePointBC` (S3): the `Set`-form of S2 — the +- geometric-Frobenius fixed locus equals `Set.range (includePointBC W)`. +-* `ncard_fixedLocus_geomFrobenius_eq_pointCount` (S4): that fixed locus has cardinality +- `Fintype.card W.toAffine.Point` (`= pointCount W`), using injectivity of `includePointBC`. +-* `ncard_ker_oneSubGeomFrobHom_eq_pointCount`: the same count for the kernel of the +- `AddMonoidHom` `id − geomFrobeniusPoint`. +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, V.1.1. +-* Step 1: `HasseWeil.frobenius_fixed_iff_mem_baseField` (`Curves/FrobeniusFixedLocus.lean`). +-* mathlib: `FiniteField.frobeniusAlgHom`, `WeierstrassCurve.map_baseChange`, +- `WeierstrassCurve.Affine.Point.map`. ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, V.1.1. + -/ + + open WeierstrassCurve +@@ -76,8 +28,6 @@ local notation "L" => AlgebraicClosure K + + noncomputable local instance : DecidableEq (AlgebraicClosure K) := Classical.decEq _ + +-/-! ### The geometric Frobenius `K`-algebra hom and the codomain identification -/ +- + /-- The geometric Frobenius `K`-algebra hom `x ↦ x ^ q` on `L = AlgebraicClosure K`, + as a ring hom. This is `FiniteField.frobeniusAlgHom K L`, coerced to a `RingHom`. -/ + noncomputable def geomFrobRingHom : AlgebraicClosure K →+* AlgebraicClosure K := +@@ -106,13 +56,11 @@ fixes `algebraMap K L`). -/ + rw [AlgHom.toRingHom_eq_coe] + exact W.map_baseChange (FiniteField.frobeniusAlgHom K (AlgebraicClosure K)) + +-/-! ### Geometric Frobenius on points and the base-change inclusion -/ +- + /-- The geometric Frobenius on `L`-points as a raw map: mathlib's + `WeierstrassCurve.Affine.Point.map` of the geometric Frobenius `K`-algebra hom + `frobeniusAlgHom K L : L →ₐ[K] L`. Its codomain `W⟮L⟯ = Point (W.baseChange L)` + is **definitionally** `(W.baseChange L).toAffine.Point`, so no cast is needed. +-This mirrors `frobeniusW_KE` in `Hasse/IsogOneSubXyFamily.lean`. -/ ++-/ + noncomputable def geomFrobeniusPointFun : + (W.baseChange (AlgebraicClosure K)).toAffine.Point → + (W.baseChange (AlgebraicClosure K)).toAffine.Point := +@@ -184,17 +132,9 @@ theorem includePointBC_injective : Function.Injective (includePointBC W) := by + subst hx' hy' + rfl + +-/-! ### S2 — the point-level fixed-locus theorem +- +-We work directly with the raw functions to keep the rewriting along +-`map_geomFrob_baseChange_eq_self` explicit. The `0` case is reflexivity; the affine case +-reduces, via `HasseWeil.Affine.Point.map_some` and `some.injEq`, to the conjunction +-`x ^ q = x ∧ y ^ q = y`, which Step 1 (`frobenius_fixed_iff_mem_baseField`) turns into +-membership of both coordinates in `range (algebraMap K L)`. -/ +- + omit [DecidableEq K] in + set_option backward.isDefEq.respectTransparency false in +-/-- **S2 (point fixed-locus)**: a point `P` over the algebraic closure is fixed by the ++/-- a point `P` over the algebraic closure is fixed by the + geometric Frobenius iff it is the base-change inclusion of a `K`-rational point. + + `geomFrobeniusPointFun P = P ↔ P ∈ Set.range (includePointBC W)`. +@@ -202,7 +142,7 @@ geometric Frobenius iff it is the base-change inclusion of a `K`-rational point. + Proof by cases on `P`: + * `P = 0`: fixed, and `0 = includePointBC 0`. + * `P = some x y h`: `Frob P = P ↔ x ^ q = x ∧ y ^ q = y` (coordinatewise, by +- `Affine.Point.map_some` + `some.injEq`), and by Step 1 each coordinate is fixed iff it ++ `Affine.Point.map_some` + `some.injEq`), and each coordinate is fixed iff it + lies in `range (algebraMap K L)`; assembling the two `K`-rational coordinates back into a + nonsingular `K`-point gives `P ∈ range includePointBC`. + +@@ -217,7 +157,7 @@ theorem geomFrobeniusPoint_fixed_iff_mem_range_includePointBC + · -- `P = 0`: fixed (`map_zero` is `rfl`), and `0 = includePointBC 0`. + exact iff_of_true rfl ⟨0, includePointBC_zero W⟩ + · -- `P = some x y h`. LHS reduces to `x ^ q = x ∧ y ^ q = y` (coordinatewise), +- -- each equivalent by Step 1 to membership in `range (algebraMap K L)`. ++ -- each equivalent to membership in `range (algebraMap K L)`. + rw [geomFrobeniusPointFun_some, Affine.Point.some.injEq] + show (FiniteField.frobeniusAlgHom K (AlgebraicClosure K)) x = x ∧ + (FiniteField.frobeniusAlgHom K (AlgebraicClosure K)) y = y ↔ _ +@@ -242,37 +182,18 @@ theorem geomFrobeniusPoint_fixed_iff_mem_range_includePointBC + rw [Affine.Point.some.injEq] at hQ + exact ⟨⟨x₀, hQ.1⟩, ⟨y₀, hQ.2⟩⟩ + +-/-! ### S3 — kernel of `1 − π` over `L` = image of `E(K)` +- +-The forward inclusion `range includePointBC ⊆ +-{P | geomFrobeniusPointFun P = P}` is the "rational ⇒ fixed" direction (a rational `P` +-has `(1 − π)P = P − πP = P − P = 0`); the reverse is the substantive S2 content. As an +-*equality of sets* this is literally S2 (`geomFrobeniusPoint_fixed_iff_mem_range_includePointBC`) +-repackaged, so we state it that way and reduce to S2. -/ +- + omit [DecidableEq K] in +-/-- **S3 (set form)**: the fixed locus of the geometric Frobenius equals the image of the +-`K`-rational points. This is S2 in `Set` form. -/ ++/-- the fixed locus of the geometric Frobenius equals the image of the ++`K`-rational points. -/ + theorem fixedLocus_geomFrobenius_eq_range_includePointBC : + {P : (W.baseChange (AlgebraicClosure K)).toAffine.Point | geomFrobeniusPointFun W P = P} = + Set.range (includePointBC W) := by + ext P + exact geomFrobeniusPoint_fixed_iff_mem_range_includePointBC W P + +-/-! ### S4 — cardinality glue +- +-The final glue: `# ker(id − geomFrobeniusPoint) = pointCount W`. S2/S3 identify the +-fixed locus with `range includePointBC`, and `includePointBC` is injective (it is +-`Affine.Point.map` of an injective ring hom, see `WeierstrassCurve.Affine.Point.map_injective`), +-so the fixed locus is in bijection with `W.toAffine.Point`, whose cardinality is `pointCount W`. +-Combined with the algebraic-closed fibre count +-(`CurveMap.exists_heightOneSpectrum_fiber_card_eq_sepDegree_unconditional`) this yields +-`deg(1 − π) = pointCount`. -/ +- + omit [DecidableEq K] in +-/-- **S4 (cardinality)**: the number of geometric-Frobenius-fixed `L`-points equals +-the `K`-rational point count `Fintype.card W.toAffine.Point` (= `pointCount`). Reduces to S3 +-(`fixedLocus … = range includePointBC`) plus injectivity of `includePointBC`. -/ ++/-- the number of geometric-Frobenius-fixed `L`-points equals ++the `K`-rational point count `Fintype.card W.toAffine.Point` (= `pointCount`). -/ + theorem ncard_fixedLocus_geomFrobenius_eq_pointCount [Fintype W.toAffine.Point] : + {P : (W.baseChange (AlgebraicClosure K)).toAffine.Point | + geomFrobeniusPointFun W P = P}.ncard = Fintype.card W.toAffine.Point := by +@@ -280,15 +201,6 @@ theorem ncard_fixedLocus_geomFrobenius_eq_pointCount [Fintype W.toAffine.Point] + Set.ncard_range_of_injective (includePointBC_injective W), + Nat.card_eq_fintype_card] + +-/-! ### PRIORITY 1 — kernel of `id − geomFrobenius` over `L` +- +-The geometric Frobenius on `L`-points is already mathlib's +-`WeierstrassCurve.Affine.Point.map (frobeniusAlgHom K L)`, an `AddMonoidHom` +-`(W.baseChange L)⟮L⟯ →+ (W.baseChange L)⟮L⟯` whose `.toFun` is definitionally +-`geomFrobeniusPointFun W` (mirroring `frobeniusW_KE` in +-`Hasse/IsogOneSubXyFamily.lean`). We bundle it, form `1 − π` as an +-`AddMonoidHom`, and identify its kernel with the fixed locus. -/ +- + /-- **Geometric Frobenius on `L`-points as an `AddMonoidHom`**: mathlib's + `Affine.Point.map (frobeniusAlgHom K L)`. Its `.toFun` is definitionally + `geomFrobeniusPointFun W`. -/ +@@ -317,19 +229,19 @@ omit [DecidableEq K] in + oneSubGeomFrobHom W P = P - geomFrobeniusPointFun W P := rfl + + omit [DecidableEq K] in +-/-- **PRIORITY 1 (kernel = fixed locus)**: `P ∈ ker(id − geomFrob) ⟺ ++/-- `P ∈ ker(id − geomFrob) ⟺ + geomFrob P = P`. Direct from `sub_eq_zero`. -/ + theorem ker_oneSubGeomFrobHom_eq_fixedLocus : + ((oneSubGeomFrobHom W).ker : Set (W.baseChange (AlgebraicClosure K)).toAffine.Point) = + {P | geomFrobeniusPointFun W P = P} := by + ext P +- rw [SetLike.mem_coe, AddMonoidHom.mem_ker, Set.mem_setOf_eq, oneSubGeomFrobHom_apply, ++ rw [SetLike.mem_coe, AddMonoidHom.mem_ker, Set.mem_ofPred_eq, oneSubGeomFrobHom_apply, + sub_eq_zero, eq_comm] + + omit [DecidableEq K] in +-/-- **PRIORITY 1 (cardinality)**: the geometric-Frobenius fixed locus, i.e. ++/-- the geometric-Frobenius fixed locus, i.e. + `ker(id − geomFrob)`, has cardinality `pointCount W`. Composes +-`ker_oneSubGeomFrobHom_eq_fixedLocus` with S4 ++`ker_oneSubGeomFrobHom_eq_fixedLocus` with + (`ncard_fixedLocus_geomFrobenius_eq_pointCount`). -/ + theorem ncard_ker_oneSubGeomFrobHom_eq_pointCount [Fintype W.toAffine.Point] : + ((oneSubGeomFrobHom W).ker : +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/IntegralClosure.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/IntegralClosure.lean +index b3c5b8f64e3264fafd4ab131a093d258bbd32966..e257fed368990ece1c76792d0f26d887b83c989d 100644 +GIT binary patch +delta 353 +zcmYjMy-EW?5QaljTx|5TH6vK4gcKrzQN(~xU}9kv*1O5w;O%VO-HWCY?JTTTC8f0p +z5w7wfYF8~CqW>#7;BLNURz{Cib3_j7D!*ELspUs +zOcTct(*O;)+fEQcL~=^@g$1dM1;yBaQ;twi#H>3 +zt#Xz-sH}VYetuP1T$s5zn +l`4E)ESU?jPzVBaPd$SHSLviD5wL0_XU)k?k-Ws*%{sE*_f>{6n + +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CoordHomFinite.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CoordHomFinite.lean +index 5456f6e64..33637b28c 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CoordHomFinite.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CoordHomFinite.lean +@@ -6,70 +6,20 @@ Authors: Chris Birkbeck + import HasseWeil.Foundation.Curves.Map.CurveMap + + /-! +-# Module-finiteness along a coordinate-ring witness (the standing `hfin`, DERIVED) +- +-For a curve map `φ : C₁ → C₂` with a coordinate-ring pullback witness +-`cd : φ.CoordHom`, the coordinate ring `F[C₁]` is a **finite module** over +-`F[C₂]` via `cd.toAlgebra` — *unconditionally*. This derives the standing +-`Module.Finite` hypothesis (`hfin`) carried throughout the isogeny theory by +-`CurveMap.sum_ramificationIdx_mul_inertiaDeg_eq_degree`, +-`EC.Isogeny.addHomProperty` / `toBasicIsogeny` (K̄-level), +-`EC.Isogeny.addHomProperty_descend` / `toBasicIsogenyDescend` +-(K-level), `Isogeny.pushforward` (`Curves/PushforwardDivisor.lean`), +-`EC/KernelCount.lean`, and friends. +- +-## The proof (no separability, no places classification) +- +-Write `u := ψ(x₂) ∈ F[C₁]` for the image of the coordinate generator of `C₂` +-under an injective `F`-algebra map `ψ : F[C₂] →ₐ[F] F[C₁]`, and decompose +-`u = p•1 + q•Y` in the `{1, Y}` basis of `F[C₁]` over `F[x₁] = F[X]`. Then +-`u` satisfies the quadratic relation of its conjugate pair over `F[X]`: +- +-`u² − t(x₁)·u + n(x₁) = 0`, where `t := 2p − q·(a₁X + a₃)` and +-`n := p² − pq·(a₁X + a₃) − q²·(X³ + a₂X² + a₄X + a₆)` +- +-(`n` is mathlib's `Algebra.norm F[X] u`; the difference of the two sides is +-`q²·W(X, Y)`, which vanishes mod the Weierstrass polynomial). Reading the +-relation backwards as a polynomial in `x₁` with coefficients in the image of +-`ψ` gives `n(T) − u·t(T) + u² = 0` at `T = x₁`. +- +-**The parity trick**: `deg(p²) = 2 deg p` is even while +-`deg(q²·(X³ + ⋯)) = 2 deg q + 3` is odd, so the two leading terms never +-cancel: `deg n = max(2 deg p, 2 deg q + 3)` with leading coefficient a +-**unit of `F`** (`WeierstrassCurve.Affine.CoordinateRing.degree_norm_smul_basis`), +-and `deg t < deg n`. Hence the displayed `T`-polynomial is monic after +-scaling by that unit's inverse, with coefficients in the image of `F[C₂]`: +-the generator `x₁` is **integral** over `F[C₂]`. (`u ∉ F·1` because `ψ` is +-injective, ruling out the degenerate `q = 0 ∧ p constant` case.) Since +-`F[C₁]` is spanned by `F[x₁]·{1, Y}`, module-finiteness follows from +-`IsIntegral.fg_adjoin_singleton`. +- +-This argument works in **any characteristic and for inseparable maps** (for +-the Frobenius comorphism `u = x₁^p` it produces the monic witness +-`(T^p − u)²`-style relation), so no separability hypothesis, no AKLB +-machinery, and no Nagata-style finiteness of integral closures is needed. +-The classical "places of `K(C₁)` over affine places of `C₂` are point +-places" wall is bypassed entirely by the explicit Weierstrass presentation. +- +-## Main results +- +-* `algHom_coordinateRing_isIntegralElem_X` — the keystone: the coordinate +- generator `x₁` is integral over `F[C₂]` along any injective `F`-algebra +- hom `F[C₂] →ₐ[F] F[C₁]`. +-* `algHom_coordinateRing_module_finite` — `F[C₁]` is a finite module over +- `F[C₂]` along any injective `F`-algebra hom. +-* `CurveMap.CoordHom.toAlgHom_injective` — a `CoordHom` is automatically +- injective (from `compat` plus injectivity of the function-field pullback). +-* `CurveMap.CoordHom.module_finite` — **the deliverable**: the standing +- `hfin` hypothesis holds for every `(φ, cd)`, with no further assumptions. +-* `CurveMap.sum_ramificationIdx_mul_inertiaDeg_eq_degree'` — Silverman +- II.2.6(a) `Σ e·f = deg φ` with `hfin` discharged. +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*], II.2.6, II.3 (finiteness +- of morphisms of smooth curves) — obtained here by direct +- Weierstrass-presentation algebra instead of valuation theory. ++An injective homomorphism between Weierstrass coordinate rings makes the target ++a finite module over the source. Writing the image of the source coordinate as ++`u = p + qY`, its trace and norm give a quadratic relation in `u` with ++polynomial coefficients in the target coordinate. The terms of the norm have ++opposite degree parity, so its leading coefficient is a unit and the trace ++has smaller degree. Reading this relation as a polynomial in the target ++coordinate gives a monic integral relation after scaling. ++ ++A compatible function-field pullback makes the coordinate-ring homomorphism ++injective. Thus the finite-module hypothesis in the weighted ramification ++sum follows for every coordinate-ring pullback witness, without separability ++or characteristic assumptions. ++ ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.6 and II.3. + -/ + + namespace HasseWeil.Curves +@@ -413,9 +363,9 @@ theorem algHom_coordinateRing_module_finite + (ψ : C₂.CoordinateRing →ₐ[F] C₁.CoordinateRing) (hψ : Function.Injective ψ) : + @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ + ψ.toRingHom.toAlgebra.toModule := by +- letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := ψ.toRingHom.toAlgebra +- letI : Module C₂.CoordinateRing C₁.CoordinateRing := Algebra.toModule +- haveI : IsScalarTower F C₂.CoordinateRing C₁.CoordinateRing := ++ let : Algebra C₂.CoordinateRing C₁.CoordinateRing := ψ.toRingHom.toAlgebra ++ let : Module C₂.CoordinateRing C₁.CoordinateRing := Algebra.toModule ++ have : IsScalarTower F C₂.CoordinateRing C₁.CoordinateRing := + IsScalarTower.of_algebraMap_eq fun c ↦ (ψ.commutes c).symm + have hx : IsIntegral C₂.CoordinateRing + (algebraMap (Polynomial F) C₁.CoordinateRing Polynomial.X) := +@@ -487,12 +437,7 @@ namespace CurveMap + -- Instance synthesis and unification at curve-indexed coordinate-ring types + -- (`AdjoinRoot`-quotients) need a higher budget; same settings as + -- `CurveMap.sum_ramificationIdx_mul_inertiaDeg_eq_degree`. +-/-- **Silverman II.2.6(a), Σ e·f form, `hfin`-free** (T-II-2-008): for a +-`CurveMap φ : C₁ → C₂` with coordinate-ring pullback witness `coordHom`, the +-sum `Σ_{P over p} e_P · f_P` equals the function-field degree `φ.degree`. +-The module-finiteness input of +-`sum_ramificationIdx_mul_inertiaDeg_eq_degree` is supplied by +-`CoordHom.module_finite`. -/ ++ + theorem sum_ramificationIdx_mul_inertiaDeg_eq_degree' + {C₁ C₂ : SmoothPlaneCurve F} + [IsIntegrallyClosed C₂.CoordinateRing] +@@ -502,7 +447,7 @@ theorem sum_ramificationIdx_mul_inertiaDeg_eq_degree' + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + ∑ P ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, + Ideal.ramificationIdx' p P * +- Ideal.inertiaDeg' p P = φ.degree := ++ P.inertiaDeg C₂.CoordinateRing = φ.degree := + φ.sum_ramificationIdx_mul_inertiaDeg_eq_degree coordHom + coordHom.module_finite hpMax hp0 + +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMap.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMap.lean +index aae9d4fe3..67470605c 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMap.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMap.lean +@@ -1,6 +1,6 @@ + import HasseWeil.Foundation.Curves.Valuation.Valuation + import HasseWeil.Foundation.Curves.IntegralClosure +-import Mathlib.NumberTheory.RamificationInertia.Basic ++import Mathlib.RingTheory.RamificationInertia.Basic + + /-! + # Curve maps via function-field pullback +@@ -14,10 +14,6 @@ injective). + The **degree** of `φ` is the dimension of `K(C₁)` as a `K(C₂)`-module via + the pullback: `deg φ = [K(C₁) : φ*K(C₂)]`. + +-This closes tickets T-II-INFRA-B-006/007 of the Stream-A infrastructure plan +-and provides the foundational object for T-II-2-002..011 (which will add +-surjectivity, ramification, and the fiber-card formula). +- + ## References + + * [Silverman, *The Arithmetic of Elliptic Curves*], II.2.4 (curves-fields +@@ -79,8 +75,6 @@ theorem comp_assoc {C₄ : SmoothPlaneCurve F} + @[simp] theorem comp_id (φ : CurveMap C₁ C₂) : φ.comp (id C₁) = φ := + CurveMap.ext (AlgHom.id_comp _) + +-/-! ### Degree -/ +- + /-- The algebra structure on `K(C₁)` induced by the pullback of `φ`. -/ + @[reducible] + noncomputable def toAlgebra (φ : CurveMap C₁ C₂) : +@@ -110,12 +104,12 @@ theorem comp_algebraMap_eq (ψ : CurveMap C₂ C₃) (φ : CurveMap C₁ C₂) + theorem degree_comp (ψ : CurveMap C₂ C₃) (φ : CurveMap C₁ C₂) : + (ψ.comp φ).degree = φ.degree * ψ.degree := by + simp only [degree] +- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra +- letI : Algebra C₃.FunctionField C₂.FunctionField := ψ.toAlgebra +- letI : Algebra C₃.FunctionField C₁.FunctionField := (ψ.comp φ).toAlgebra +- haveI : IsScalarTower C₃.FunctionField C₂.FunctionField C₁.FunctionField := ++ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ let : Algebra C₃.FunctionField C₂.FunctionField := ψ.toAlgebra ++ let : Algebra C₃.FunctionField C₁.FunctionField := (ψ.comp φ).toAlgebra ++ have : IsScalarTower C₃.FunctionField C₂.FunctionField C₁.FunctionField := + IsScalarTower.of_algebraMap_eq fun _ ↦ rfl +- haveI : Module.Free C₂.FunctionField C₁.FunctionField := ++ have : Module.Free C₂.FunctionField C₁.FunctionField := + Module.Free.of_divisionRing _ _ + rw [mul_comm] + exact (Module.finrank_mul_finrank +@@ -138,27 +132,11 @@ def IsSeparable (φ : CurveMap C₁ C₂) : Prop := φ.inseparableDegree = 1 + /-- A curve map is **purely inseparable** if its separable degree is 1. -/ + def IsPurelyInseparable (φ : CurveMap C₁ C₂) : Prop := φ.separableDegree = 1 + +--- **Silverman II.2.4.1** (pullback half, deferred): if `φ : C₁ → C₂` has +--- degree 1, its pullback is surjective. +--- Proof sketch: `finrank_eq_one_iff'` gives `v ≠ 0` with `K(C₁) = K(C₂) • v`. +--- From `c₀ • v = 1` in a field, `v = (algebraMap c₀)⁻¹`, so every `x ∈ K(C₁)` +--- is `c_x • v = algebraMap c_x / algebraMap c₀ = algebraMap (c_x / c₀)`. +--- The Lean proof needs `algebraMap C₂.FunctionField C₁.FunctionField` to +--- resolve to `φ.pullback.toRingHom` via `haveI : Algebra ... := φ.toAlgebra`, +--- but instance synthesis tends to pick unrelated `Algebra` instances. +--- Deferred for future cleanup. +- +-/-! ### Ramification order -/ +- + /-- The order of the pullback of a function `t ∈ K(C₂)` at a smooth point + `P ∈ C₁`: `ord_P (φ* t)`. When `t` is a uniformizer at the image point + `φ(P) ∈ C₂`, this equals Silverman's ramification index `e_φ(P)` of II.2.5. + +-Our formulation takes the test function `t` as an explicit argument rather +-than deriving it from an intrinsic "image point" `φ(P)`, since the +-point-image correspondence (Silverman II.2.4(c)) is deferred to later +-infrastructure. Downstream users supply a uniformizer at the intended +-image point. ++The test function `t` is an explicit uniformizer at the intended image point. + Reference: Silverman II.2.5 (definition). -/ + noncomputable def ramificationIndex (φ : CurveMap C₁ C₂) (P : C₁.SmoothPoint) + (t : C₂.FunctionField) : WithTop ℤ := +@@ -239,8 +217,6 @@ theorem one_le_ramificationIndex_of_pullback_pointValuation_lt_one + (1 : WithTop ℤ) ≤ φ.ramificationIndex P t := + (C₁.one_le_ord_P_iff_pointValuation_lt_one (φ.pullback_ne_zero ht)).mpr h + +-/-! ### Pushforward / Norm map (T-II-2-005) -/ +- + /-- The **pushforward** (norm map) `φ_* : K(C₁) →* K(C₂)` for a curve map + `φ : C₁ → C₂`, defined as the `K(C₂)`-algebra norm on `K(C₁)` via `φ.toAlgebra`. + Silverman's `φ_* = (φ*)⁻¹ ∘ N_{K(C₁)/φ*K(C₂)}` simplifies to the direct +@@ -255,7 +231,7 @@ noncomputable def pushforward (φ : CurveMap C₁ C₂) : + Reference: Silverman II.2 (after definition of `φ_*`). -/ + theorem pushforward_pullback (φ : CurveMap C₁ C₂) (g : C₂.FunctionField) : + φ.pushforward (φ.pullback g) = g ^ φ.degree := by +- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra + exact Algebra.norm_algebraMap g + + /-- The pushforward is multiplicative. -/ +@@ -268,18 +244,6 @@ theorem pushforward_pullback (φ : CurveMap C₁ C₂) (g : C₂.FunctionField) + φ.pushforward (1 : C₁.FunctionField) = 1 := + φ.pushforward.map_one + +-/-! ### Fiber cardinality (T-II-2-011): Silverman II.2.7 +- +-The classical Silverman II.2.7 asserts that a nonconstant curve map `φ` is +-unramified iff every geometric fiber has cardinality `deg(φ)`. Since our +-`CurveMap` models the function-field side only (no explicit `fiber` type), +-we record the combinatorial content as a **witness-parametric** statement: +-given a `Finset` of points, their ramification indices, and the sum formula +-II.2.6(a) (`Σ e_φ(P) = deg(φ)` witness), the fiber-count equals `deg(φ)` iff +-every index is `1`. Once II.2.6(a) is formalized, this immediately gives +-T-II-2-011 for every image point `Q`. +--/ +- + /-- **Combinatorial lemma**: if `e : α → ℤ` is ≥ 1 on every element of a + finset `S`, then `∑ P ∈ S, e P = #S` iff each `e P = 1`. + +@@ -298,7 +262,7 @@ theorem _root_.Finset.sum_eq_card_iff_forall_eq_one_of_one_le + linarith + · exact (Finset.sum_congr rfl h).trans hconst + +-/-- **Witness-parametric Silverman II.2.7** (T-II-2-011): given a finite ++/-- **Witness-parametric Silverman II.2.7**: given a finite + fiber `S` with ramification indices ≥ 1 summing to `deg(φ)`, the fiber + count equals `deg(φ)` iff every ramification index equals `1`. + +@@ -321,15 +285,13 @@ theorem fiber_card_eq_degree_iff_all_ramificationIndexℤ_one + rw [← hsum, eq_comm] + exact Finset.sum_eq_card_iff_forall_eq_one_of_one_le hle + +-/-! ### Degree-one morphisms are isomorphisms on function fields (T-II-2-006) -/ +- + /-- **Silverman II.2.4.1 (pullback-surjectivity form)**: if a curve map `φ` + has degree 1, its pullback `φ*` is surjective. Combined with the automatic + injectivity of pullbacks, `φ*` is then a bijection of function fields. -/ + theorem pullback_surjective_of_degree_one (φ : CurveMap C₁ C₂) + (h : φ.degree = 1) : Function.Surjective φ.pullback := by +- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra +- haveI : Module.Free C₂.FunctionField C₁.FunctionField := ++ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ have : Module.Free C₂.FunctionField C₁.FunctionField := + Module.Free.of_divisionRing _ _ + have hfr : Module.finrank C₂.FunctionField C₁.FunctionField = 1 := h + obtain ⟨v, _hv_ne, hv⟩ := finrank_eq_one_iff'.mp hfr +@@ -345,17 +307,6 @@ theorem pullback_surjective_of_degree_one (φ : CurveMap C₁ C₂) + rw [map_div₀, div_eq_mul_inv, ← hv_eq, ← Algebra.smul_def] + exact hcv + +-/-! ### Silverman II.2.6(a): `Σ e_φ(P) · f_φ(P) = deg(φ)` (T-II-2-008 via +-coordinate-ring algebra witness) +- +-`CurveMap` stores only the function-field pullback; a generic Dedekind-style +-sum-of-ramification-indices formula requires the pullback to restrict to a +-ring hom `C₂.CoordinateRing → C₁.CoordinateRing`. We expose this as an +-**auxiliary data bundle** (`CurveMap.CoordHom`) together with a compatibility +-condition. For the specific coordinate function `x : C → A¹` +-(`algebraMap F[X] → F[C]`), see `HasseWeil/Curves/NormValuation.lean`'s +-`sum_ramificationIdx_over_fiber` for the unconditional instance. -/ +- + /-- **Coordinate-ring pullback witness**: for a `CurveMap φ : C₁ → C₂`, a + ring hom `C₂.CoordinateRing → C₁.CoordinateRing` compatible with the + function-field pullback. Not every function-field pullback restricts to +@@ -378,7 +329,7 @@ noncomputable def CoordHom.toAlgebra {φ : CurveMap C₁ C₂} (coordHom : φ.Co + Algebra C₂.CoordinateRing C₁.CoordinateRing := + coordHom.toAlgHom.toRingHom.toAlgebra + +-/-- **Silverman II.2.6(a), Σ e·f form** (T-II-2-008, generic `CurveMap`): ++/-- **Silverman II.2.6(a), Σ e·f form**: + for a `CurveMap φ : C₁ → C₂` with coordinate-ring pullback witness + `coordHom` and finite-module structure, the sum `Σ_{P over p} e_P · f_P` + equals the function-field degree `φ.degree`. +@@ -402,16 +353,16 @@ theorem sum_ramificationIdx_mul_inertiaDeg_eq_degree + letI : Algebra C₂.CoordinateRing C₁.CoordinateRing := coordHom.toAlgebra + ∑ P ∈ IsDedekindDomain.primesOverFinset p C₁.CoordinateRing, + Ideal.ramificationIdx' p P * +- Ideal.inertiaDeg' p P = φ.degree := by +- letI algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := ++ P.inertiaDeg C₂.CoordinateRing = φ.degree := by ++ let algCR : Algebra C₂.CoordinateRing C₁.CoordinateRing := + coordHom.toAlgebra +- letI : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra +- haveI : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing ++ let : Algebra C₂.FunctionField C₁.FunctionField := φ.toAlgebra ++ have : IsScalarTower C₂.CoordinateRing C₁.CoordinateRing + C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_eq fun x ↦ ?_ + rw [RingHom.algebraMap_toAlgebra] + rfl +- haveI : IsScalarTower C₂.CoordinateRing C₂.FunctionField ++ have : IsScalarTower C₂.CoordinateRing C₂.FunctionField + C₁.FunctionField := by + refine IsScalarTower.of_algebraMap_smul fun r x ↦ ?_ + rw [Algebra.smul_def] +@@ -420,12 +371,44 @@ theorem sum_ramificationIdx_mul_inertiaDeg_eq_degree + rw [coordHom.compat r, ← IsScalarTower.algebraMap_smul C₁.CoordinateRing r x, + ← Algebra.smul_def] + rfl +- haveI : p.IsMaximal := hpMax +- letI modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule +- haveI : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ ++ have : p.IsMaximal := hpMax ++ let modCR : Module C₂.CoordinateRing C₁.CoordinateRing := algCR.toModule ++ have : @Module.Finite C₂.CoordinateRing C₁.CoordinateRing _ _ + modCR := hfin +- exact Ideal.sum_ramification_inertia (R := C₂.CoordinateRing) +- (S := C₁.CoordinateRing) C₂.FunctionField C₁.FunctionField hp0 ++ have : Module.IsTorsionFree C₂.CoordinateRing C₁.CoordinateRing := by ++ apply Module.isTorsionFree_iff_algebraMap_injective.mpr ++ intro a b hab ++ apply IsFractionRing.injective C₂.CoordinateRing C₂.FunctionField ++ apply φ.pullback.injective ++ change φ.pullback (algebraMap C₂.CoordinateRing C₂.FunctionField a) = ++ φ.pullback (algebraMap C₂.CoordinateRing C₂.FunctionField b) ++ rw [coordHom.compat a, coordHom.compat b] ++ exact congrArg (algebraMap C₁.CoordinateRing C₁.FunctionField) hab ++ classical ++ let : Fintype (p.primesOver C₁.CoordinateRing) := Fintype.ofFinite _ ++ calc ++ _ = ∑ P : p.primesOver C₁.CoordinateRing, ++ P.1.ramificationIdx C₂.CoordinateRing * P.1.inertiaDeg C₂.CoordinateRing := by ++ apply Finset.sum_bij (fun P hP ↦ ++ ⟨P, (IsDedekindDomain.mem_primesOverFinset_iff hp0 C₁.CoordinateRing).mp hP⟩) ++ · intro P hP ++ exact Finset.mem_univ _ ++ · intro P hP Q hQ h ++ exact congrArg Subtype.val h ++ · intro P _ ++ exact ⟨P.1, ++ (IsDedekindDomain.mem_primesOverFinset_iff hp0 C₁.CoordinateRing).mpr P.2, rfl⟩ ++ · intro P hP ++ obtain ⟨hprime, hover⟩ := ++ (IsDedekindDomain.mem_primesOverFinset_iff hp0 C₁.CoordinateRing).mp hP ++ let := hprime ++ let := hover ++ rw [Ideal.ramificationIdx'_eq_ramificationIdx p P hp0] ++ _ = Module.finrank C₂.CoordinateRing C₁.CoordinateRing := ++ Ideal.sum_ramification_inertia_eq_finrank p C₁.CoordinateRing ++ _ = φ.degree := ++ (IsFractionRing.finrank_eq C₂.CoordinateRing C₂.FunctionField ++ C₁.CoordinateRing C₁.FunctionField).symm + + end CurveMap + +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMapBaseChange.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMapBaseChange.lean +index e1c402904..2537c2d15 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMapBaseChange.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Map/CurveMapBaseChange.lean +@@ -16,33 +16,14 @@ import Mathlib.RingTheory.TensorProduct.Free + /-! + # Base change of curves and curve maps + +-For a smooth plane curve `C / F` and an `F`-algebra extension `L`, this file builds the +-natural scalar-extension maps and identifies the scalar extension of the coordinate ring +-and function field with the base-changed curve. These are foundations for the +-Galois-descent route to the unconditional `AddHomProperty` (Phase G of the Pic⁰ roadmap). ++Scalar extension identifies the coordinate ring of a smooth plane curve with the ++coordinate ring of its base change. The corresponding function-field tensor product ++is a localization of the coordinate-ring tensor product. For algebraic field extensions, ++this gives the natural isomorphism between scalar extension and the fraction field ++of the extended coordinate ring. + +-## Main definitions +- +-* `SmoothPlaneCurve.coordRingMap` — the include of coordinate rings. +-* `SmoothPlaneCurve.functionFieldMap` — the include of function fields. +-* `SmoothPlaneCurve.coordRingScalarExt` — the scalar-extension iso +- `L ⊗[F] C.CoordinateRing ≃ₐ[L] (C.baseChange L).CoordinateRing`. +-* `CurveMap.CoordHom.baseChangeAlgHom` — the base-changed coordinate-ring alg hom of a `CoordHom`. +- +-## Main results +- +-* `SmoothPlaneCurve.isDomain_tensorCoordRing` — `L ⊗[F] C.CoordinateRing` is a domain. +-* `SmoothPlaneCurve.tensor_functionField_isFractionRing` — `L ⊗[F] C.FunctionField` is the +- fraction ring of `L ⊗[F] C.CoordinateRing`. +-* `SmoothPlaneCurve.functionField_tensor_locBaseChange` — localization commutes with the base +- change `L/F`: `L ⊗[F] C.FunctionField ≃ₐ[L] FractionRing (L ⊗[F] C.CoordinateRing)`. +- +-## Implementation notes +- +-The `Algebra F` / `Algebra F[X]` instances on `AdjoinRoot W.polynomial` form a typeclass +-diamond that blocks synthesis of the tensor-product algebra/module structures. Section +-`PhaseGInstances` pins the F-route instances at high priority so signatures mentioning +-`L ⊗[F] C.CoordinateRing` (and its function-field analogue) elaborate diamond-free. ++The algebra and module structures are chosen compatibly with the scalar tower through ++the polynomial ring. + + ## References + +@@ -179,7 +160,6 @@ theorem baseChange_inner_comp_mapRingHom_eq {φ : CurveMap C₁ C₂} + C₁.coordRingMap L (cd.toAlgHom + (algebraMap (Polynomial F) C₂.CoordinateRing (Polynomial.C a))) + rw [Polynomial.map_C] +- change (cd.baseChangeInnerAlgHom L) (Polynomial.C (algebraMap F L a)) = _ + simp only [baseChangeInnerAlgHom] + rw [Polynomial.aeval_C, show (algebraMap (Polynomial F) C₂.CoordinateRing) (Polynomial.C a) = + algebraMap F C₂.CoordinateRing a from +@@ -262,8 +242,8 @@ noncomputable instance (priority := 100000) coordRingModuleBase : + /-- `CommRing` on the scalar-extension tensor `L ⊗[F] C.CR`, pinned at high + priority. The default synthesis loses to the `Algebra F` / `Algebra F[X]` + diamond on `AdjoinRoot W.polynomial` (it tries the `F[X]`-route algebra on +-`C.CR`); pinning the F-route `CommRing` here unblocks any signature that +-mentions `L ⊗[F] C.CR` (e.g. `FractionRing (L ⊗[F] C.CR)`). -/ ++`C.CR`). This instance uses the algebra over `F` in the tensor product ++and its fraction field. -/ + noncomputable instance (priority := 100000) tensorCoordRingCommRing + (L : Type*) [Field L] [Algebra F L] : + CommRing (L ⊗[F] C.toAffine.CoordinateRing) := +@@ -310,8 +290,8 @@ noncomputable instance (priority := 100000) tensorFunctionFieldFLScalarTower + pinned at high priority. The same `Algebra F` / `Algebra F[X]` diamond on + `AdjoinRoot W.polynomial` that taints `L ⊗[F] C.CR` recurs at the function-field + level (since `C.FF = FractionRing C.CR` carries the `C.CR`-algebra, which routes +-back through the diamond). Pinning the F-route `CommRing` unblocks any signature +-mentioning `L ⊗[F] C.FF`. -/ ++back through the diamond). This instance uses the algebra over `F` ++in the function-field tensor product. -/ + noncomputable instance (priority := 100000) tensorFunctionFieldCommRing + (L : Type*) [Field L] [Algebra F L] : + CommRing (L ⊗[F] C.toAffine.FunctionField) := +@@ -693,8 +673,7 @@ theorem tensorFunctionFieldStructureHom_injective (L : Type*) [Field L] [Algebra + Module.Flat.lTensor_preserves_injective_linearMap gF hg + have hfun : ⇑(C.tensorFunctionFieldStructureHom L) = ⇑(LinearMap.lTensor L gF) := by + funext x +- induction x using TensorProduct.induction_on with +- | zero => simp ++ induction x using TensorProduct.inductionOn with + | tmul l u => + rw [LinearMap.lTensor_tmul] + change Algebra.TensorProduct.map (AlgHom.id L L) +@@ -707,12 +686,12 @@ theorem tensorFunctionFieldStructureHom_injective (L : Type*) [Field L] [Algebra + exact hlin + + /-- `C.CoordinateRing ⊗[F] L` is a domain, for any field extension `L/F`. Obtained from the +-sibling `isDomain_tensorCoordRing` (which gives the `L`-on-the-left orientation ++`isDomain_tensorCoordRing` (which gives the `L`-on-the-left orientation + `L ⊗[F] C.CoordinateRing`) by transporting the domain structure across the commutativity + ring-iso `Algebra.TensorProduct.comm`. -/ + private theorem tensorCoordRing_comm_isDomain (L : Type*) [Field L] [Algebra F L] : + IsDomain (C.toAffine.CoordinateRing ⊗[F] L) := by +- letI := C.isDomain_tensorCoordRing L ++ let := C.isDomain_tensorCoordRing L + exact + (Algebra.TensorProduct.comm F L C.toAffine.CoordinateRing).symm.toRingEquiv.toMulEquiv.isDomain + (L ⊗[F] C.toAffine.CoordinateRing) +@@ -727,9 +706,9 @@ private theorem tensorCoordRing_algebraMapSubmonoid_le_nonZeroDivisors + Algebra.algebraMapSubmonoid (C.toAffine.CoordinateRing ⊗[F] L) + (nonZeroDivisors C.toAffine.CoordinateRing) ≤ + nonZeroDivisors (C.toAffine.CoordinateRing ⊗[F] L) := by +- haveI hflatCR : Module.Flat F C.toAffine.CoordinateRing := Module.Flat.of_free +- letI := C.tensorCoordRing_comm_isDomain L +- haveI hnzdCR : NoZeroDivisors (C.toAffine.CoordinateRing ⊗[F] L) := ++ have hflatCR : Module.Flat F C.toAffine.CoordinateRing := Module.Flat.of_free ++ let := C.tensorCoordRing_comm_isDomain L ++ have hnzdCR : NoZeroDivisors (C.toAffine.CoordinateRing ⊗[F] L) := + isCancelMulZero_iff_noZeroDivisors.mp ‹IsDomain _›.toIsCancelMulZero + have hinjL : Function.Injective + (Algebra.TensorProduct.includeLeft : +@@ -758,11 +737,11 @@ private theorem tensorFunctionField_isLocalization (L : Type*) [Field L] [Algebr + (Algebra.algebraMapSubmonoid (C.toAffine.CoordinateRing ⊗[F] L) + (nonZeroDivisors C.toAffine.CoordinateRing)) + (C.toAffine.FunctionField ⊗[F] L) := by +- letI algBC : Algebra (C.toAffine.CoordinateRing ⊗[F] L) (C.toAffine.FunctionField ⊗[F] L) := ++ let algBC : Algebra (C.toAffine.CoordinateRing ⊗[F] L) (C.toAffine.FunctionField ⊗[F] L) := + (Algebra.TensorProduct.map + (IsScalarTower.toAlgHom F C.toAffine.CoordinateRing C.toAffine.FunctionField) + (AlgHom.id F L)).toRingHom.toAlgebra +- haveI tower : IsScalarTower C.toAffine.CoordinateRing (C.toAffine.CoordinateRing ⊗[F] L) ++ have tower : IsScalarTower C.toAffine.CoordinateRing (C.toAffine.CoordinateRing ⊗[F] L) + (C.toAffine.FunctionField ⊗[F] L) := + IsScalarTower.of_algebraMap_eq fun _ ↦ rfl + exact @IsLocalization.tensorProduct_tensorProduct F L _ _ _ C.toAffine.CoordinateRing _ _ +@@ -786,14 +765,14 @@ the function field on the **left** (`FunctionField ⊗[F] L`) to match that cons + private theorem tensorFunctionField_isDomain (L : Type*) [Field L] [Algebra F L] : + IsDomain (C.toAffine.FunctionField ⊗[F] L) := by + -- `C.CoordinateRing ⊗[F] L` is a domain (the base ring of the localization below). +- letI := C.tensorCoordRing_comm_isDomain L ++ let := C.tensorCoordRing_comm_isDomain L + -- The natural `lTensor`-of-localization algebra structure exhibiting the function field + -- tensor as a localization of the coordinate-ring tensor. +- letI _algBC : Algebra (C.toAffine.CoordinateRing ⊗[F] L) (C.toAffine.FunctionField ⊗[F] L) := ++ let _algBC : Algebra (C.toAffine.CoordinateRing ⊗[F] L) (C.toAffine.FunctionField ⊗[F] L) := + (Algebra.TensorProduct.map + (IsScalarTower.toAlgHom F C.toAffine.CoordinateRing C.toAffine.FunctionField) + (AlgHom.id F L)).toRingHom.toAlgebra +- haveI := C.tensorFunctionField_isLocalization L ++ have := C.tensorFunctionField_isLocalization L + -- A localization of a domain at a submonoid of nonzerodivisors is again a domain. + exact IsLocalization.isDomain_of_le_nonZeroDivisors (C.toAffine.FunctionField ⊗[F] L) + (C.tensorCoordRing_algebraMapSubmonoid_le_nonZeroDivisors L) +@@ -805,7 +784,7 @@ when consumed by `tensor_functionField_isFractionRing`. -/ + theorem tensor_functionField_isField (L : Type*) [Field L] [Algebra F L] + [Algebra.IsAlgebraic F L] : + IsField (L ⊗[F] C.toAffine.FunctionField) := by +- haveI := C.tensorFunctionField_isDomain L ++ have := C.tensorFunctionField_isDomain L + have hF : IsField (C.toAffine.FunctionField ⊗[F] L) := + Algebra.TensorProduct.isField_of_isAlgebraic F C.toAffine.FunctionField L + (Or.inr (inferInstance : Algebra.IsAlgebraic F L)) +@@ -842,7 +821,7 @@ private theorem oneTmul_mem_nonZeroDivisors (L : Type*) [Field L] [Algebra F L] + (hb : b ∈ nonZeroDivisors C.toAffine.CoordinateRing) : + (1 ⊗ₜ b : L ⊗[F] C.toAffine.CoordinateRing) + ∈ nonZeroDivisors (L ⊗[F] C.toAffine.CoordinateRing) := by +- letI := C.isDomain_tensorCoordRing L ++ let := C.isDomain_tensorCoordRing L + rw [mem_nonZeroDivisors_iff_ne_zero] + have hb0 : b ≠ 0 := mem_nonZeroDivisors_iff_ne_zero.mp hb + intro hc +@@ -861,17 +840,15 @@ theorem tensor_functionField_surj (L : Type*) [Field L] [Algebra F L] : + (L ⊗[F] C.toAffine.FunctionField) x.2 + = algebraMap (L ⊗[F] C.toAffine.CoordinateRing) + (L ⊗[F] C.toAffine.FunctionField) x.1 := by +- letI alg := C.tensorFunctionFieldAlgebra L +- letI := C.isDomain_tensorCoordRing L +- haveI hflatL : Module.Flat F L := Module.Flat.of_free ++ let alg := C.tensorFunctionFieldAlgebra L ++ let := C.isDomain_tensorCoordRing L ++ have hflatL : Module.Flat F L := Module.Flat.of_free + have halg : ∀ (l : L) (u : C.toAffine.CoordinateRing), + algebraMap (L ⊗[F] C.toAffine.CoordinateRing) (L ⊗[F] C.toAffine.FunctionField) (l ⊗ₜ u) + = l ⊗ₜ algebraMap C.toAffine.CoordinateRing C.toAffine.FunctionField u := + fun l u ↦ rfl + refine fun z ↦ ?_ +- induction z using TensorProduct.induction_on with +- | zero => +- exact ⟨(0, 1), by rw [zero_mul, map_zero]⟩ ++ induction z using TensorProduct.inductionOn with + | tmul l f => + obtain ⟨a, b, hbmem, hab⟩ := IsFractionRing.div_surjective (A := C.toAffine.CoordinateRing) f + refine ⟨(l ⊗ₜ a, ⟨1 ⊗ₜ b, C.oneTmul_mem_nonZeroDivisors L b hbmem⟩), ?_⟩ +@@ -895,8 +872,8 @@ theorem tensor_functionField_isFractionRing (L : Type*) [Field L] [Algebra F L] + [Algebra.IsAlgebraic F L] : + @IsFractionRing (L ⊗[F] C.toAffine.CoordinateRing) _ + (L ⊗[F] C.toAffine.FunctionField) _ (C.tensorFunctionFieldAlgebra L) := by +- letI alg := C.tensorFunctionFieldAlgebra L +- letI := C.isDomain_tensorCoordRing L ++ let alg := C.tensorFunctionFieldAlgebra L ++ let := C.isDomain_tensorCoordRing L + have hinj : Function.Injective + (algebraMap (L ⊗[F] C.toAffine.CoordinateRing) (L ⊗[F] C.toAffine.FunctionField)) := + C.tensorFunctionFieldStructureHom_injective L +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/InseparableDegree.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/InseparableDegree.lean +index ebd777c8c..9132c544f 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/InseparableDegree.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/InseparableDegree.lean +@@ -8,29 +8,13 @@ import Mathlib.FieldTheory.PurelyInseparable.Basic + import Mathlib.FieldTheory.SeparableClosure + + /-! +-# Inseparable degree API for isogenies (Silverman II.2.10-12) ++For an elliptic-curve isogeny, the separable degree times the inseparable degree ++equals the function-field degree. In positive characteristic the inseparable ++degree is a power of the characteristic. The separable closure of the pullback ++field gives the maximal intermediate field over which the extension is purely ++inseparable. + +-This file builds the inseparable-degree / separable-closure API for +-elliptic-curve isogenies, building on mathlib's +-`Mathlib.FieldTheory.SeparableClosure` (`Field.sepDegree`, +-`Field.finInsepDegree`, `separableClosure`) and +-`Mathlib.FieldTheory.PurelyInseparable.Basic` (`IsPurelyInseparable`, +-`isPurelyInseparable_iff_pow_mem`, `IsPurelyInseparable.pow_mem`). +- +-## Main results +- +-* `Isogeny.inseparableDegree_dvd_degree` — the inseparable degree +- divides the degree (consequence of `finSepDegree · finInsepDegree = +- finrank`, mathlib `PurelyInseparable/Basic.lean:595`). +-* `Isogeny.inseparableDegree_eq_one_iff_separable` — direct from the +- project's definition `IsSeparable := inseparableDegree = 1`. +-* `Isogeny.inseparableDegree_isPow_of_charP` — in characteristic `p`, +- the inseparable degree is a power of `p`. Uses +- `isPurelyInseparable_iff_pow_mem` (mathlib). +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*], II.2.10-12. ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.10–12. + -/ + + open WeierstrassCurve +@@ -70,7 +54,7 @@ theorem separableDegree_mul_finInsepDegree (α : Isogeny W W) : + α.separableDegree * + Field.finInsepDegree W.FunctionField W.FunctionField = + α.degree := by +- letI : Algebra W.FunctionField W.FunctionField := α.toAlgebra ++ let : Algebra W.FunctionField W.FunctionField := α.toAlgebra + rw [separableDegree_eq_finSepDegree, degree_eq_finrank] + exact Field.finSepDegree_mul_finInsepDegree W.FunctionField W.FunctionField + +@@ -83,7 +67,7 @@ theorem inseparableDegree_eq_finInsepDegree (α : Isogeny W W) + letI : Algebra W.FunctionField W.FunctionField := α.toAlgebra + α.inseparableDegree = + Field.finInsepDegree W.FunctionField W.FunctionField := by +- letI : Algebra W.FunctionField W.FunctionField := α.toAlgebra ++ let : Algebra W.FunctionField W.FunctionField := α.toAlgebra + -- inseparableDegree = degree / separableDegree + -- = (separableDegree * finInsepDegree) / separableDegree + -- = finInsepDegree (since separableDegree > 0) +@@ -102,7 +86,7 @@ theorem inseparableDegree_dvd_degree (α : Isogeny W W) : + α.inseparableDegree ∣ α.degree := by + -- inseparableDegree = degree / separableDegree; degree = separableDegree * finInsepDegree. + -- So separableDegree | degree, hence (degree / separableDegree) | degree. +- letI : Algebra W.FunctionField W.FunctionField := α.toAlgebra ++ let : Algebra W.FunctionField W.FunctionField := α.toAlgebra + have h_mul := separableDegree_mul_finInsepDegree α + show α.degree / α.separableDegree ∣ α.degree + rw [show α.degree = α.separableDegree * +@@ -130,15 +114,15 @@ theorem inseparableDegree_isPow_of_charP + (α : Isogeny W.toAffine W.toAffine) + (h_deg_pos : 0 < α.degree) : + ∃ e : ℕ, α.inseparableDegree = p ^ e := by +- letI alg : Algebra W.toAffine.FunctionField W.toAffine.FunctionField := α.toAlgebra ++ let alg : Algebra W.toAffine.FunctionField W.toAffine.FunctionField := α.toAlgebra + -- CharP transports along the algebraMap (it's a ringHom into a field of char p) +- haveI : CharP W.toAffine.FunctionField p := ++ have : CharP W.toAffine.FunctionField p := + charP_of_injective_algebraMap + (algebraMap K W.toAffine.FunctionField).injective p + -- ExpChar from CharP + Prime +- haveI : ExpChar W.toAffine.FunctionField p := ExpChar.prime Fact.out ++ have : ExpChar W.toAffine.FunctionField p := ExpChar.prime Fact.out + -- From h_deg_pos: FiniteDimensional via the matching finrank +- haveI hfin : @FiniteDimensional W.toAffine.FunctionField ++ have hfin : @FiniteDimensional W.toAffine.FunctionField + W.toAffine.FunctionField _ _ alg.toModule := + @FiniteDimensional.of_finrank_pos _ _ _ _ alg.toModule h_deg_pos + -- Pull down the mathlib lemma with explicit instances +@@ -155,7 +139,7 @@ theorem inseparableDegree_isPow_of_charP + rw [inseparableDegree_eq_finInsepDegree α h_sep_pos] + exact he + +-/-! ### P0-B — `Isogeny.separableSubfield` ++/-! The separable subfield + + The maximal intermediate field over which `K(E)` is purely inseparable. + Direct specialisation of `Mathlib.FieldTheory.separableClosure` to +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/PoleOrderParity.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/PoleOrderParity.lean +index 07d5e7569..e5fe1c773 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/PoleOrderParity.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/PoleOrderParity.lean +@@ -183,7 +183,7 @@ theorem point_minus_O_principal_eq_zero_of_coord + have := congr_arg ProjectiveSmoothPoint.toAffinePoint h + rwa [P.toProjectiveSmoothPoint_toAffinePoint, + ProjectiveSmoothPoint.toAffinePoint_infinity] at this +- rw [if_neg h_ne, if_pos rfl] ++ rw [ite_eq_right h_ne, ite_eq_left rfl] + decide + -- Use projectiveDivisorOf_apply_infinity to convert: -1 = (ordAtInfty f).untopD 0 + rw [SmoothPlaneCurve.projectiveDivisorOf_apply_infinity] at h_inf +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/RamificationAtInfinity.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/RamificationAtInfinity.lean +index c09705086..7142cc012 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/RamificationAtInfinity.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Ramification/RamificationAtInfinity.lean +@@ -3,82 +3,21 @@ Copyright (c) 2026 Chris Birkbeck. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Chris Birkbeck + -/ +-import Mathlib.NumberTheory.RamificationInertia.Basic ++import Mathlib.RingTheory.RamificationInertia.Basic ++import Mathlib.LinearAlgebra.Dimension.Localization ++import Mathlib.NumberTheory.RamificationInertia.Ramification + import Mathlib.RingTheory.DedekindDomain.IntegralClosure + + /-! +-# Abstract ramification at infinity (Worker A Action 1) +- +-For a smooth plane curve `C` over a field `k` and a nonconstant function +-`f ∈ K(C)`, this file establishes the **function-field-degree-equals-pole- +-divisor-degree identity**: +- +-``` +-[K(C) : k(f)] = Σ_{P pole of f} (- ord_P f) · [κ(P) : k]. +-``` +- +-This is *not* Riemann–Roch. It is the degree formula for the finite morphism +-`f : C → ℙ¹`, scoped to the fibre at `∞`. The proof goes via Mathlib's +-`Ideal.sum_ramification_inertia` applied at the `(u)`-prime of `k[u]`, where +-`u = 1/f` is the uniformizer at infinity on `ℙ¹`: +- +- * `e_P = ord_P(u) = -ord_P(f)` (ramification index), +- * `f_P = [κ(P) : κ((u))] = [κ(P) : k]` (inertia degree). +- +-## Strategy +- +-The proof packages Mathlib's abstract ramification–inertia machinery: pick +-the integral closure `S` of `k[u]` in `K(C)` (via the algebra structure +-`u ↦ 1/f`), observe `S` is Dedekind, then `Ideal.sum_ramification_inertia` +-at the `(u)` prime gives the sum directly. The curve-specific notation +-(`poleSupport`, `ordAt`, `kappa`) is bookkeeping over the resulting finset. +- +-This is the deliverable for "Worker A — Action 1 abstract ramification-at- +-infinity setup". Worker B's closing application combines this with their +-Action 2 (translation valuation transport) plus Action 3 (a small closed- +-point lemma) to discharge the project's `pc_sepDeg_eq_pointCount` witness. +- +-## Main definitions +- +-* `polyToFieldOfInv f`, `ratFunToFieldOfInv hf` — the `k`-algebra maps +- `Polynomial k →ₐ[k] L` and `FractionRing (Polynomial k) →ₐ[k] L` sending the +- indeterminate to `f⁻¹` (the uniformizer `u = 1/f`). +-* `LinfAt f` — `L` as a type synonym carrying the `X ↦ f⁻¹` polynomial-algebra +- structure, so it does not clash with the project's pre-existing `X ↦ coordX` +- instance. +-* `Sinf f` — structural package of "an integral closure of `Polynomial k` in +- `LinfAt f`": the carrier plus every typeclass instance the closing theorem +- needs as an honest field. +-* `xIdeal`, `Sinf.ordAt`, `Sinf.kappa` — the prime `(X)` at infinity, the order +- `-(ramificationIdx' …)`, and the residue field `carrier ⧸ P`. +- +-## Main results +- +-* `finrank_eq_sum_ramificationIdx_mul_inertiaDeg` — the abstract fundamental +- identity `Σ e(P) · f(P) = [LinfAt f : k(f)]` from `Ideal.sum_ramification_inertia`. +-* `finrank_eq_weighted_poleDegree_of_nonconstant` — the closing corollary +- `[L : k(f)] = Σ_P (−ord_P f) · inertiaDeg' P`. +-* `Sinf.inertiaDeg_eq_one_of_algebraMap_surjective` — `inertiaDeg' (X) P = 1` +- when the residue map `k → κ(P)` is surjective. +- +-## Implementation notes +- +-`LinfAt` and `Sinf` exist to dodge two Lean-elaboration hazards. `LinfAt f` +-isolates the `X ↦ f⁻¹` algebra structure from the project's `X ↦ coordX` one; +-transcendence is carried as `Fact (Transcendental k f⁻¹)` (use sites declare +-`haveI : Fact (Transcendental k f⁻¹) := ⟨_⟩` once and the algebra instances +-resolve). `Sinf` bundles the integral-closure instances as record fields so they +-resolve by projection, sidestepping the `Meta.SynthInstance.tryResolve` +-negative-cache anomaly that the `↥(integralClosure …)` Subalgebra coercion +-triggers under `Ideal.sum_ramification_inertia` (commit 538ff64). +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, II.2 (degree of a +- morphism between curves; formula II.2.6.a as the sum over preimages of +- one point). +-* Mathlib's `Ideal.sum_ramification_inertia` provides the abstract +- fundamental identity `Σ e · f = [Frac S : Frac R]`. ++# Ramification at infinity ++ ++For a nonconstant function on a smooth curve, the degree of the function-field ++extension equals the degree of its pole divisor. Applying the fundamental ++ramification–inertia identity to the prime `(X)` of `k[X]`, embedded by ++`X ↦ f⁻¹`, identifies its ramification indices with pole orders and its ++inertia degrees with residue-field degrees. ++ ++See Silverman, *The Arithmetic of Elliptic Curves*, II.2. + -/ + + namespace HasseWeil.Curves +@@ -144,11 +83,7 @@ theorem ratFunToFieldOfInv_injective {L : Type*} [Field L] [Algebra k L] + Function.Injective (ratFunToFieldOfInv hf) := + (ratFunToFieldOfInv hf).toRingHom.injective + +-/-- The function field viewed as a type-synonym, used to install a +-`Polynomial k`-algebra structure via `X ↦ f⁻¹` that does not conflict with +-the project's existing `X ↦ coordX` instance. +-The unused argument `_f` indexes the algebra structure intended for the +-synonym. -/ ++ + @[nolint unusedArguments] + def LinfAt {L : Type*} [Field L] [Algebra k L] (_f : L) : Type _ := L + +@@ -238,12 +173,7 @@ instance isScalarTower_k_fractionRing + + end LinfAt + +-/-- Structural package of "an integral closure of `Polynomial k` inside +-`LinfAt f`": carrier type plus every typeclass instance the closing +-`Ideal.sum_ramification_inertia` invocation requires, bundled as record +-fields so `letI` can install them at the use site. Sidesteps the Lean 4 +-synthesis anomaly that affects the `↥(integralClosure …)` Subalgebra +-coercion (commit 538ff64). -/ ++ + structure Sinf.{u} {L : Type*} [Field L] [Algebra k L] (f : L) where + /-- Carrier type — canonically `↥(integralClosure (Polynomial k) (LinfAt f))`. -/ + carrier : Type u +@@ -262,18 +192,14 @@ structure Sinf.{u} {L : Type*} [Field L] [Algebra k L] (f : L) where + [isFractionRing : IsFractionRing carrier (LinfAt (k := k) f)] + /-- Compatible scalar tower with the ambient `Polynomial k → LinfAt f`. -/ + [isScalarTower : IsScalarTower (Polynomial k) carrier (LinfAt (k := k) f)] +- /-- Finite as a `Polynomial k`-module. -/ ++ + [moduleFinite : Module.Finite (Polynomial k) carrier] +- /-- Torsion-free as a `Polynomial k`-module (algebraMap injective). -/ ++ + [isTorsionFree : Module.IsTorsionFree (Polynomial k) carrier] + + section SinfConstruction + + +-/-- Canonical construction of `Sinf` from Mathlib's `integralClosure` +-Subalgebra. Given the ambient finite-separability hypotheses, all the +-required instances are synthesised once here; downstream code consumes +-them only by field projection. -/ + noncomputable def Sinf.ofIntegralClosure + {L : Type*} [Field L] [Algebra k L] (f : L) [Fact (Transcendental k f⁻¹)] + [Module.Finite (FractionRing (Polynomial k)) (LinfAt (k := k) f)] +@@ -288,13 +214,13 @@ noncomputable def Sinf.ofIntegralClosure + (integralClosure (Polynomial k) (LinfAt (k := k) f)) := + IsIntegralClosure.finite (Polynomial k) (FractionRing (Polynomial k)) + (LinfAt (k := k) f) (integralClosure (Polynomial k) (LinfAt (k := k) f)) +- haveI : FaithfulSMul (Polynomial k) (LinfAt (k := k) f) := by ++ have : FaithfulSMul (Polynomial k) (LinfAt (k := k) f) := by + rw [faithfulSMul_iff_algebraMap_injective] + exact polyToFieldOfInv_injective_of_transcendental + (Fact.out (p := Transcendental k f⁻¹)) +- haveI : Module.IsTorsionFree (Polynomial k) (LinfAt (k := k) f) := ++ have : Module.IsTorsionFree (Polynomial k) (LinfAt (k := k) f) := + inferInstance +- haveI : Module.IsTorsionFree (Polynomial k) ++ have : Module.IsTorsionFree (Polynomial k) + (integralClosure (Polynomial k) (LinfAt (k := k) f)) := + Subalgebra.instIsTorsionFree (integralClosure (Polynomial k) + (LinfAt (k := k) f)) +@@ -316,13 +242,7 @@ theorem xIdeal_ne_bot : (xIdeal (k := k)) ≠ ⊥ := by + rw [xIdeal, Ne, Ideal.span_singleton_eq_bot] + exact Polynomial.X_ne_zero + +-/-- **Abstract fundamental ramification–inertia identity at infinity.** +-For a function `f` realising `LinfAt f` as a finite separable extension of +-`FractionRing (Polynomial k) = k(f)` and an integral-closure package +-`data : Sinf k f`, the sum over primes of the carrier lying over `(X)` of +-`e(P) · f(P)` equals `[LinfAt f : k(f)]`. This is the abstract content of +-the `[K(C):k(f)] = Σ (pole degree)` identity, before specialisation to +-`LinfAt f = K(C)` for a smooth curve `C`. -/ ++ + theorem finrank_eq_sum_ramificationIdx_mul_inertiaDeg + {L : Type*} [Field L] [Algebra k L] (f : L) [Fact (Transcendental k f⁻¹)] + [Module.Finite (FractionRing (Polynomial k)) (LinfAt (k := k) f)] +@@ -332,18 +252,42 @@ theorem finrank_eq_sum_ramificationIdx_mul_inertiaDeg + letI := data.algPoly + ∑ P ∈ IsDedekindDomain.primesOverFinset (xIdeal (k := k)) data.carrier, + Ideal.ramificationIdx' (xIdeal (k := k)) P * +- Ideal.inertiaDeg' (xIdeal (k := k)) P = ++ P.inertiaDeg (Polynomial k) = + Module.finrank (FractionRing (Polynomial k)) (LinfAt (k := k) f) := by +- letI := data.commRing +- letI := data.isDomain +- letI := data.isDedekindDomain +- letI := data.algPoly +- letI := data.algLinfAt +- letI := data.isFractionRing +- letI := data.isScalarTower +- letI := data.moduleFinite +- exact Ideal.sum_ramification_inertia (R := Polynomial k) data.carrier +- (FractionRing (Polynomial k)) (LinfAt (k := k) f) xIdeal_ne_bot ++ let := data.commRing ++ let := data.isDomain ++ let := data.isDedekindDomain ++ let := data.algPoly ++ let := data.algLinfAt ++ let := data.isFractionRing ++ let := data.isScalarTower ++ let := data.moduleFinite ++ classical ++ let := data.isTorsionFree ++ let : Fintype ((xIdeal (k := k)).primesOver data.carrier) := Fintype.ofFinite _ ++ calc ++ _ = ∑ P : (xIdeal (k := k)).primesOver data.carrier, ++ P.1.ramificationIdx (Polynomial k) * P.1.inertiaDeg (Polynomial k) := by ++ apply Finset.sum_bij (fun P hP ↦ ++ ⟨P, (IsDedekindDomain.mem_primesOverFinset_iff xIdeal_ne_bot data.carrier).mp hP⟩) ++ · intro P hP ++ exact Finset.mem_univ _ ++ · intro P hP Q hQ h ++ exact congrArg Subtype.val h ++ · intro P _ ++ exact ⟨P.1, ++ (IsDedekindDomain.mem_primesOverFinset_iff xIdeal_ne_bot data.carrier).mpr P.2, rfl⟩ ++ · intro P hP ++ obtain ⟨hprime, hover⟩ := ++ (IsDedekindDomain.mem_primesOverFinset_iff xIdeal_ne_bot data.carrier).mp hP ++ let := hprime ++ let := hover ++ rw [Ideal.ramificationIdx'_eq_ramificationIdx (xIdeal (k := k)) P xIdeal_ne_bot] ++ _ = Module.finrank (Polynomial k) data.carrier := ++ Ideal.sum_ramification_inertia_eq_finrank (xIdeal (k := k)) data.carrier ++ _ = Module.finrank (FractionRing (Polynomial k)) (LinfAt (k := k) f) := ++ (IsFractionRing.finrank_eq (Polynomial k) (FractionRing (Polynomial k)) ++ data.carrier (LinfAt (k := k) f)).symm + + /-- The `R[X] ⧸ (X) ≃ₐ[R] R`-style algebra equivalence specialised to + `R = k`, given by evaluation at `0`. -/ +@@ -374,8 +318,8 @@ theorem Sinf.toNat_neg_ordAt_eq_ramificationIdx + ∀ P : Ideal data.carrier, + (-(data.ordAt P)).toNat = + Ideal.ramificationIdx' (xIdeal (k := k)) P := by +- letI := data.commRing +- letI := data.algPoly ++ let := data.commRing ++ let := data.algPoly + intro P + simp [Sinf.ordAt] + +@@ -415,16 +359,34 @@ theorem Sinf.inertiaDeg_eq_finrank_kappa + letI := data.commRing + letI := data.algPoly + ∀ (P : Ideal data.carrier) [P.LiesOver (xIdeal (k := k))], +- Ideal.inertiaDeg' (xIdeal (k := k)) P = +- Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.kappa P) := by +- letI := data.commRing +- letI := data.algPoly ++ (if h : P.comap (algebraMap (Polynomial k) data.carrier) = xIdeal (k := k) then ++ letI : Algebra (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P) := ++ Ideal.Quotient.algebraQuotientOfLEComap h.ge ++ Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.kappa P) ++ else 0) = Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.kappa P) := by ++ let := data.commRing ++ let := data.algPoly + intro P _ +- exact Ideal.inertiaDeg'_algebraMap _ _ ++ simp only [dite_eq_left (Ideal.over_def P (xIdeal (k := k))).symm] ++ ++/-- For a prime above `(X)`, the inertia degree is its residue-field degree. -/ ++theorem Sinf.prime_inertiaDeg_eq_finrank_kappa ++ {L : Type*} [Field L] [Algebra k L] {f : L} ++ (data : Sinf (k := k) f) : ++ letI := data.commRing ++ letI := data.algPoly ++ ∀ (P : Ideal data.carrier) [P.IsPrime] [P.LiesOver (xIdeal (k := k))], ++ P.inertiaDeg (Polynomial k) = ++ Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.kappa P) := by ++ let := data.commRing ++ let := data.algPoly ++ let := data.moduleFinite ++ intro P _ _ ++ let : P.IsMaximal := Ideal.isMaximal_of_isIntegral_of_isMaximal_under (R := Polynomial k) P (by ++ simpa only [← Ideal.over_def P (xIdeal (k := k))] using (xIdeal_isMaximal (k := k))) ++ exact Ideal.inertiaDeg_eq_of_isMaximal (xIdeal (k := k)) P ++ + +-/-- The `Polynomial k ⧸ xIdeal`-finrank of a module agrees with its +-`k`-finrank, given a compatible scalar tower `k → (Polynomial k ⧸ xIdeal) +-→ M`. Uses `quotientXAlgEquiv` plus the tower formula. -/ + theorem finrank_residue_eq_finrank_k + {M : Type*} [AddCommGroup M] [Module (Polynomial k ⧸ xIdeal (k := k)) M] + [Module k M] [IsScalarTower k (Polynomial k ⧸ xIdeal (k := k)) M] +@@ -439,7 +401,7 @@ theorem finrank_residue_eq_finrank_k + /-- **Abstract inertia-degree-one criterion at `(X)`.** For an *arbitrary* prime `P` of the + `Sinf` carrier lying over `xIdeal := (X)`, if the structure algebra map + `(Polynomial k ⧸ (X)) → (carrier ⧸ P)` (`≅ k → κ(P)`) is surjective, then the inertia +-degree `inertiaDeg' (X) P` equals `1`. This is the field-agnostic, `CoordinateRing`-free, ++degree `P.inertiaDeg (Polynomial k)` equals `1`. This is the field-agnostic, `CoordinateRing`-free, + `IsAlgClosed`-free criterion for any prime over `(X)`. -/ + theorem Sinf.inertiaDeg_eq_one_of_algebraMap_surjective + {L : Type*} [Field L] [Algebra k L] {f : L} +@@ -455,31 +417,26 @@ theorem Sinf.inertiaDeg_eq_one_of_algebraMap_surjective + (algebraMap (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P))) : + letI := data.commRing + letI := data.algPoly +- Ideal.inertiaDeg' (xIdeal (k := k)) P = 1 := by +- letI := data.commRing +- letI := data.algPoly +- letI := data.isDomain +- letI := data.moduleFinite +- haveI hmax : (xIdeal (k := k)).IsMaximal := xIdeal_isMaximal +- letI : Algebra (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P) := ++ P.inertiaDeg (Polynomial k) = 1 := by ++ let := data.commRing ++ let := data.algPoly ++ let := data.isDomain ++ let := data.moduleFinite ++ have hmax : (xIdeal (k := k)).IsMaximal := xIdeal_isMaximal ++ let : Algebra (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P) := + Ideal.Quotient.algebraQuotientOfLEComap + (Ideal.LiesOver.over (p := xIdeal (k := k)) (P := P)).le +- rw [Ideal.inertiaDeg'_algebraMap] ++ let : P.IsMaximal := Ideal.isMaximal_of_isIntegral_of_isMaximal_under (R := Polynomial k) P (by ++ simpa only [← Ideal.over_def P (xIdeal (k := k))] using (xIdeal_isMaximal (k := k))) ++ rw [Ideal.inertiaDeg_eq_of_isMaximal (xIdeal (k := k)) P] + refine le_antisymm ?_ ?_ + · refine finrank_le_one (1 : data.carrier ⧸ P) fun w ↦ ?_ + obtain ⟨c, hc⟩ := h_surj w + exact ⟨c, by rwa [Algebra.algebraMap_eq_smul_one] at hc⟩ +- · have hpos := Ideal.inertiaDeg'_pos (xIdeal (k := k)) P +- rwa [Ideal.inertiaDeg'_algebraMap] at hpos +- +-/-- **Closing corollary (abstract form).** The function-field degree +-`[L : k(f)]` over the Sinf data equals the weighted pole-divisor degree +-`Σ_P (−ord_P f) · f_P` (with `f_P = inertiaDeg' xIdeal P`). This is the +-abstract form of the `[K(C) : k(f)] = Σ_{P pole of f} (−ord_P f) · [κ(P) : +-k]` identity; Worker B's PoleDivisorFallback specialisation substitutes +-`L = K(E)`, `f = γ*x_gen`, and converts `inertiaDeg'` to `[κ(P) : k]` +-using `inertiaDeg_eq_finrank_kappa` plus the `quotientXAlgEquiv` +-`Polynomial k ⧸ xIdeal ≃ k`. -/ ++ · exact Nat.succ_le_of_lt (Module.finrank_pos : ++ 0 < Module.finrank (Polynomial k ⧸ xIdeal (k := k)) (data.carrier ⧸ P)) ++ ++ + theorem finrank_eq_weighted_poleDegree_of_nonconstant + {L : Type*} [Field L] [Algebra k L] (f : L) [Fact (Transcendental k f⁻¹)] + [Module.Finite (FractionRing (Polynomial k)) (LinfAt (k := k) f)] +@@ -490,16 +447,16 @@ theorem finrank_eq_weighted_poleDegree_of_nonconstant + Module.finrank (FractionRing (Polynomial k)) (LinfAt (k := k) f) = + ∑ P ∈ IsDedekindDomain.primesOverFinset (xIdeal (k := k)) data.carrier, + (-(data.ordAt P)).toNat * +- Ideal.inertiaDeg' (xIdeal (k := k)) P := by +- letI := data.commRing +- letI := data.algPoly +- letI := data.isDomain +- letI := data.isDedekindDomain +- letI := data.algLinfAt +- letI := data.isFractionRing +- letI := data.isScalarTower +- letI := data.moduleFinite +- letI := data.isTorsionFree ++ P.inertiaDeg (Polynomial k) := by ++ let := data.commRing ++ let := data.algPoly ++ let := data.isDomain ++ let := data.isDedekindDomain ++ let := data.algLinfAt ++ let := data.isFractionRing ++ let := data.isScalarTower ++ let := data.moduleFinite ++ let := data.isTorsionFree + have h := finrank_eq_sum_ramificationIdx_mul_inertiaDeg + (k := k) (L := L) f data + rw [← h] +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Transcendence.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Transcendence.lean +index bdce413c5..a6490d166 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Transcendence.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Transcendence.lean +@@ -16,19 +16,6 @@ that a nonconstant curve map `φ : C₁ → C₂` induces a finite extension + `K(C₁) / φ*(K(C₂))`: the range of `φ.pullback` is an intermediate ring + containing the algebraic structure of `F[x]`, and transitivity does the rest. + +-This closes the *first piece* of the infrastructure needed for +-T-II-INFRA-B-009 (Silverman II.2.4(a), `CurveMap.pullback_image_finite_codim`). +-The full finiteness still requires transcendence-degree theory, which +-mathlib provides via `IsTranscendenceBasis`/`trdeg` but whose bridge to our +-subalgebra setting (`Algebra.adjoin F {C.coordX}`) needs additional +-typeclass-plumbing. That bridge is tracked as a follow-up. +- +-## Main results +- +-- `SmoothPlaneCurve.isAlgebraic_polynomialX_functionField`: `F(C)` is +- algebraic over `F[X]` (instance). Consequence of +- `IsLocalization.isAlgebraic` + `Algebra.IsAlgebraic.of_finite` + transitivity. +- + ## References + + * [Silverman, *The Arithmetic of Elliptic Curves*], II.1, II.2.4 +@@ -49,29 +36,19 @@ algebraic over the base), `F(x) → F(C)` is algebraic (finite of rank 2), and + algebraicness is transitive. -/ + instance isAlgebraic_polynomialX_functionField : + Algebra.IsAlgebraic (Polynomial F) C.FunctionField := by +- haveI : Algebra.IsAlgebraic (Polynomial F) (FractionRing (Polynomial F)) := ++ have : Algebra.IsAlgebraic (Polynomial F) (FractionRing (Polynomial F)) := + IsLocalization.isAlgebraic _ (nonZeroDivisors _) +- haveI : Algebra.IsAlgebraic (FractionRing (Polynomial F)) C.FunctionField := ++ have : Algebra.IsAlgebraic (FractionRing (Polynomial F)) C.FunctionField := + Algebra.IsAlgebraic.of_finite _ _ + exact Algebra.IsAlgebraic.trans (R := Polynomial F) + (S := FractionRing (Polynomial F)) (A := C.FunctionField) + +-/-- Every element of `F(C)` is integral over `F[X]`: since `F[X]` is a field +-(well, an integral domain), integrality and algebraicness coincide over it +-only for the algebraic case when the ring is a field. Here, since `F[X]` +-is an ID and `F(C)` is a domain, we can state integrality directly. +- +-**Remark**: `F[X]` is NOT a field, so `IsAlgebraic` and `IsIntegral` over +-`F[X]` are distinct notions in general; however, an element of `F(C)` that +-is a root of any nonzero polynomial over `F[X]` is a root of SOME monic +-polynomial (divide by the leading coefficient after clearing denominators +-in the fraction field). We don't need this strengthening for the main +-application. -/ ++/-- The function field is integral over the fraction field of the polynomial ring. -/ + instance isIntegral_fracPolynomialX_functionField : + Algebra.IsIntegral (FractionRing (Polynomial F)) C.FunctionField := by + exact (Algebra.IsAlgebraic.of_finite (FractionRing (Polynomial F)) C.FunctionField).isIntegral + +-/-! ### T-II-1-005: Uniformizer is not a `p`-th power in char `p > 0` -/ ++ + + /-- **Silverman Exercise II.2.15 (⇐), char-`p` half**: if `t ∈ F(C)` is a + uniformizer at some smooth point `P`, then `t` is not a `p`-th power in +@@ -103,7 +80,7 @@ theorem notMem_pthPowers_of_uniformizer {p : ℕ} (hp : 1 < p) + `F(C)` is finite over `Frac(F[X]) = F(x)`, so trdeg = 1 by additivity of + transcendence degree across the tower `F → F[X] → F(x) → F(C)`. -/ + +-/-- **trdeg F K(E) = 1 (axiom-clean)**: the function field of a smooth ++/-- **trdeg F K(E) = 1**: the function field of a smooth + plane curve has transcendence degree 1 over the base field. + + Tower computation: `trdeg F (Polynomial F) = 1` (mathlib's +@@ -113,11 +90,11 @@ Tower computation: `trdeg F (Polynomial F) = 1` (mathlib's + `FiniteOverKx`). Apply `trdeg_add_eq` twice. -/ + theorem functionField_trdeg_eq_one : Algebra.trdeg F C.FunctionField = 1 := by + have h_fund : Algebra.trdeg F (FractionRing (Polynomial F)) = 1 := by +- haveI : Algebra.IsAlgebraic (Polynomial F) (FractionRing (Polynomial F)) := ++ have : Algebra.IsAlgebraic (Polynomial F) (FractionRing (Polynomial F)) := + IsLocalization.isAlgebraic _ (nonZeroDivisors _) + rw [← trdeg_add_eq F (Polynomial F) (A := FractionRing (Polynomial F)), + Polynomial.trdeg_of_isDomain, trdeg_eq_zero, add_zero] +- haveI : Algebra.IsAlgebraic (FractionRing (Polynomial F)) C.FunctionField := ++ have : Algebra.IsAlgebraic (FractionRing (Polynomial F)) C.FunctionField := + Algebra.IsAlgebraic.of_finite _ _ + rw [← trdeg_add_eq F (FractionRing (Polynomial F)) (A := C.FunctionField), h_fund, + trdeg_eq_zero, add_zero] +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/AlgebraicNonNegOrd.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/AlgebraicNonNegOrd.lean +index c599cad55..ad80470ae 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/AlgebraicNonNegOrd.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/AlgebraicNonNegOrd.lean +@@ -84,7 +84,7 @@ theorem ord_P_nonneg_of_isAlgebraic + · rw [hf, ord_P_zero]; exact le_top + · have hv : C.pointValuation P f ≠ 0 := (C.pointValuation P).ne_zero_iff.mpr hf + simp only [ord_P] +- rw [dif_neg hv, show (0 : WithTop ℤ) = ((0 : ℤ) : WithTop ℤ) from rfl, ++ rw [dite_eq_right hv, show (0 : WithTop ℤ) = ((0 : ℤ) : WithTop ℤ) from rfl, + WithTop.coe_le_coe] + -- The order is `-toAdd (unzero hv)`, so `≤ 1` for the valuation becomes + -- `toAdd (unzero hv) ≤ toAdd 1 = 0`, giving `0 ≤ -toAdd (unzero hv)`. +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/Infinity.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/Infinity.lean +index bf9827ace..e8e5e12b2 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/Infinity.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/Infinity.lean +@@ -22,25 +22,21 @@ with the classical values + ordAtInfty(x) = -2, ordAtInfty(y) = -3. + ``` + +-Rather than building a local ring at infinity and extracting the valuation +-from its DVR structure (the approach outlined in the Phase-D ticket +-`T-II-INFRA-D-001`), this file defines `ordAtInfty` algebraically via the +-algebra norm `N : F(C) → F(x)`: ++The order at infinity is defined algebraically using the norm ++`N : F(C) → F(x)`: + + ``` + ordAtInfty(f) := - intDegree (N(f)) ∈ ℤ ∪ {∞}. + ``` + +-The rationale is that for a degree-2 extension of `F(x)`, ramified only at +-the place at infinity of `ℙ¹_F` with ramification index 2 and residue ++The rationale is that when the unique place of a degree-2 extension of `F(x)` above ++the place at infinity of `ℙ¹_F` has ramification index 2 and residue + degree 1, the valuation at the unique place of `F(C)` above infinity is + related to the ℙ¹-valuation of the norm by the classical formula + `v_K(N(f)) = f_w · w(f)` with `f_w = 1`. Concretely, + `ordAtInfty(f) = ordAtInfty(N(f))` where the right-hand side is the order at + infinity on `F(x)`, computed by `- intDegree`. + +-This closes (partial form) ticket `T-II-INFRA-D-002`. +- + ## References + + * [Silverman, *The Arithmetic of Elliptic Curves*], IV.1 (for +@@ -87,7 +83,7 @@ noncomputable def ordAtInfty (f : C.FunctionField) : WithTop ℤ := + if f = 0 then ⊤ + else ((- RatFunc.intDegree (C.normAsRatFunc f) : ℤ) : WithTop ℤ) + +-@[simp] theorem ordAtInfty_zero : C.ordAtInfty 0 = ⊤ := if_pos rfl ++@[simp] theorem ordAtInfty_zero : C.ordAtInfty 0 = ⊤ := ite_eq_left rfl + + theorem ordAtInfty_eq_top_iff (f : C.FunctionField) : + C.ordAtInfty f = ⊤ ↔ f = 0 := by +@@ -98,7 +94,7 @@ theorem ordAtInfty_eq_top_iff (f : C.FunctionField) : + + theorem ordAtInfty_of_ne {f : C.FunctionField} (hf : f ≠ 0) : + C.ordAtInfty f = (- RatFunc.intDegree (C.normAsRatFunc f) : ℤ) := +- if_neg hf ++ ite_eq_right hf + + /-- Multiplicativity of `ordAtInfty`: for nonzero `f, g`, + `ordAtInfty(f · g) = ordAtInfty(f) + ordAtInfty(g)`. -/ +@@ -950,7 +946,7 @@ private theorem degree_sub_C_leadingCoeff_div_mul_lt {n d : Polynomial F} + have h_deg : n.degree = (Polynomial.C lam * d).degree := by + rw [Polynomial.degree_C_mul hlam_ne, Polynomial.degree_eq_natDegree hn, + Polynomial.degree_eq_natDegree hd, h_eq] +- exact Polynomial.degree_sub_lt h_deg hn h_lc ++ exact Polynomial.degree_sub_lt_left h_deg hn h_lc + + private theorem ratFunc_exists_C_sub_intDegree_neg {r : RatFunc F} + (hr : r.intDegree ≤ 0) : +@@ -1056,13 +1052,13 @@ theorem ordAtInftyVal_eq_exp_neg_ordAtInfty {f : C.FunctionField} (hf : f ≠ 0) + have : (n : WithTop ℤ) = ((- RatFunc.intDegree (C.normAsRatFunc f) : ℤ) : WithTop ℤ) := + hn.symm.trans hN + have hni : n = - RatFunc.intDegree (C.normAsRatFunc f) := by exact_mod_cast this +- rw [ordAtInftyVal, if_neg hf, hni, neg_neg] ++ rw [ordAtInftyVal, ite_eq_right hf, hni, neg_neg] + +-@[simp] theorem ordAtInftyVal_zero : C.ordAtInftyVal 0 = 0 := if_pos rfl ++@[simp] theorem ordAtInftyVal_zero : C.ordAtInftyVal 0 = 0 := ite_eq_left rfl + + theorem ordAtInftyVal_ne_zero {f : C.FunctionField} (hf : f ≠ 0) : + C.ordAtInftyVal f ≠ 0 := by +- rw [ordAtInftyVal, if_neg hf]; exact WithZero.exp_ne_zero ++ rw [ordAtInftyVal, ite_eq_right hf]; exact WithZero.exp_ne_zero + + @[simp] theorem ordAtInftyVal_one : C.ordAtInftyVal (1 : C.FunctionField) = 1 := by + rw [C.ordAtInftyVal_eq_exp_neg_ordAtInfty one_ne_zero C.ordAtInfty_one, neg_zero, +@@ -1325,7 +1321,7 @@ theorem smoothPoint_x_preimage_finite (a : F) : + (t := {y : F | (C.fiberQuadratic a).IsRoot y}) + (fun _ hP ↦ C.fiberQuadratic_isRoot_of_smoothPoint hP) + (fun _ hP₁ _ hP₂ hy ↦ SmoothPoint.ext (hP₁.trans hP₂.symm) hy) +- (Polynomial.finite_setOf_isRoot (C.fiberQuadratic_ne_zero a)) ++ (Polynomial.finite_setOfPred_isRoot (C.fiberQuadratic_ne_zero a)) + + /-- The x-projection preimage of a finite set of `x`-values is finite. In + particular, `{P : C.SmoothPoint | P.x ∈ roots f}` is finite for any nonzero +@@ -1460,7 +1456,7 @@ theorem pointValuation_algebraMap_le_one (u : C.CoordinateRing) + exact IsDedekindDomain.HeightOneSpectrum.valuation_le_one + (IsDiscreteValuationRing.maximalIdeal (C.localRingAt P)) _ + +-/-- **Step (B'') foundational structural lemma (one direction)**: every ++/-- every + element of `C.localRingAt P` (after embedding into `K(C)`) has valuation + ≤ 1 at `P`. Direct from `IsDedekindDomain.HeightOneSpectrum.valuation_le_one` + applied at the localRingAt level (the localRing is a DVR, hence a Dedekind +@@ -1472,7 +1468,7 @@ theorem pointValuation_algebraMap_localRingAt_le_one + exact IsDedekindDomain.HeightOneSpectrum.valuation_le_one + (IsDiscreteValuationRing.maximalIdeal (C.localRingAt P)) x + +-/-- **Step (B'') foundational structural lemma (converse direction)**: every ++/-- every + element of `K(C)` with valuation ≤ 1 at `P` lifts to an element of + `C.localRingAt P`. Together with the easy direction, this characterises + the `algebraMap (localRingAt P) → KE` image as exactly +@@ -1533,7 +1529,7 @@ theorem exists_mul_algebraMap_eq_of_pointValuation_le_one + exact h2 + + +-/-- **Step (B'') foundational structural identification (biconditional)**: ++/-- + combines `pointValuation_algebraMap_localRingAt_le_one` and + `mem_localRingAt_image_of_pointValuation_le_one` into the canonical iff form. + This characterises the `algebraMap (localRingAt P) → KE` image as exactly +@@ -1552,7 +1548,7 @@ theorem ord_P_eq_zero_iff_pointValuation_eq_one (C : SmoothPlaneCurve F) + C.ord_P P f = 0 ↔ C.pointValuation P f = 1 := by + have hv : C.pointValuation P f ≠ 0 := (C.pointValuation P).ne_zero_iff.mpr hf + simp only [ord_P] +- rw [dif_neg hv] ++ rw [dite_eq_right hv] + constructor + · intro h + have h_nat : -((WithZero.unzero hv).toAdd : ℤ) = 0 := by exact_mod_cast h +@@ -1599,7 +1595,7 @@ theorem finite_setOf_mem_maximalIdealAt {u : C.CoordinateRing} (hu : u ≠ 0) : + hu ((Algebra.norm_eq_zero_iff (R := Polynomial F)).mp h) + refine (C.smoothPoint_x_preimage_finite_of_set + {a : F | (Algebra.norm (Polynomial F) u).IsRoot a} +- (Polynomial.finite_setOf_isRoot hNu_ne)).subset ?_ ++ (Polynomial.finite_setOfPred_isRoot hNu_ne)).subset ?_ + intro P (hP : u ∈ C.maximalIdealAt P) + rw [← hpq, C.mem_maximalIdealAt_iff_eval_zero P p q] at hP + change (Algebra.norm (Polynomial F) u).IsRoot P.x +@@ -1647,7 +1643,7 @@ theorem finite_setOf_ord_P_nonzero {f : C.FunctionField} (hf : f ≠ 0) : + (C.finite_setOf_ord_P_nonzero_of_coordinateRing hv_ne)).subset ?_ + intro P hP + by_contra h_both +- simp only [Set.mem_union, Set.mem_setOf_eq, not_or, not_not] at h_both ++ simp only [Set.mem_union, Set.mem_ofPred_eq, not_or, not_not] at h_both + obtain ⟨hu0, hv0⟩ := h_both + have hord : C.ord_P P + (algebraMap C.CoordinateRing C.FunctionField u) = +@@ -1658,8 +1654,7 @@ theorem finite_setOf_ord_P_nonzero {f : C.FunctionField} (hf : f ≠ 0) : + exact hP hord.symm + + /-- **Silverman II.1.2, Part 1**: a nonzero function on a smooth plane curve +-has zeros and poles at only finitely many smooth points. This is an alias +-for `finite_setOf_ord_P_nonzero` matching the ticket statement. -/ ++has zeros and poles at only finitely many smooth points. -/ + theorem finite_zeros_poles (f : C.FunctionField) (hf : f ≠ 0) : + {P : C.SmoothPoint | C.ord_P P f ≠ 0}.Finite := + C.finite_setOf_ord_P_nonzero hf +@@ -1668,16 +1663,6 @@ theorem finite_zeros_poles (f : C.FunctionField) (hf : f ≠ 0) : + if `f ∈ F(C)` has nonnegative order at infinity AND lies in the coordinate + ring, then `f` is the image of a constant from `F`. + +-This is the best form provable with our current infrastructure. The full +-"no-affine-poles ⟹ in CoordinateRing" step is the integral-closure +-property of smooth curves: for a smooth Weierstrass curve `[C.toAffine.IsElliptic]`, +-`C.CoordinateRing` is a Dedekind domain, hence integrally closed, and any +-`f ∈ F(C)` with `ord_P f ≥ 0` at every closed point is automatically in +-`C.CoordinateRing`. Without the `IsElliptic` hypothesis (or an equivalent +-smoothness assumption), singular points can have local rings that don't +-align with the global coordinate ring structure, and the integral-closure +-step requires genuinely new algebra-of-curves infrastructure. +- + Reference: Silverman II.1.2, second part; Hartshorne I.6.12. -/ + theorem const_of_no_poles_of_coordinateRing (f : C.FunctionField) + (h_coord : ∃ u : C.CoordinateRing, +@@ -1691,9 +1676,9 @@ theorem const_of_no_poles_of_coordinateRing (f : C.FunctionField) + exact (IsScalarTower.algebraMap_apply F C.CoordinateRing + C.FunctionField c).symm + +-/-- **IC-006 (Silverman II.1.2, Part 2, prime-indexed)**: if `f ∈ F(C)` has ++/-- **Silverman II.1.2, Part 2, prime-indexed**: if `f ∈ F(C)` has + nonnegative valuation at every nonzero prime of `C.CoordinateRing` **and** at +-infinity, then `f` is constant. Combines IC-006's Dedekind-Liouville bridge ++infinity, then `f` is constant. Combines the Dedekind-Liouville bridge + `mem_coordinateRing_of_valuation_le_one` with the CoordinateRing-form + algebraic Liouville `const_of_no_poles_of_coordinateRing`. -/ + theorem const_of_no_poles_of_valuation_of_ordAtInfty +@@ -1705,7 +1690,7 @@ theorem const_of_no_poles_of_valuation_of_ordAtInfty + C.const_of_no_poles_of_coordinateRing f + (C.mem_coordinateRing_of_valuation_le_one f h_primes) h_inf + +-/-- **IC-006 (integrality-based Liouville)**: if `f ∈ F(C)` is integral over ++/-- **Integrality-based Liouville**: if `f ∈ F(C)` is integral over + `F[X]` **and** has nonnegative order at infinity, then `f` is constant. + This is the cleanest consequence of `IsIntegrallyClosed C.CoordinateRing`: + integrality over `F[X]` lifts `f` into `C.CoordinateRing`, and then +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/NoFinitePolesBridge.lean b/projects/HasseWeil/HasseWeil/Foundation/Curves/Valuation/NoFinitePolesBridge.lean +index 0b44dea28cc6d4c4dd158920e7563ca5babef0db..966395e5596ce0a1deb52980a2031a07e846aa7d 100644 +GIT binary patch +delta 3411 +zcmb7G&yN&E6wdAge5EE9}B};;=g2BWeOl^0~bYXW_Q`NJ} +zaG7{9o}G(&(UVt6CZ3IFPnvk)WQc!)Cr^H_s;B4Yq8_KG>ect&_r34EzrR}grg(U5 +z>C9F)k4mL;OZ%!!DA&|hxhf?UI+ZpEwzMIU4|dM4Ez#iDCF)<1vHVo!aS&;3VwDS= +zH7f5kNRSa6N~F}TqEaI4Y)mSQjFgpWFW66HPO79`nd-b_snk>^lE#sn9GO%mIx?i2 +znbu`LA<+gz2B`AV0){ct7CMjldLmUPDVv)AH!71hq+9rA{At<~Y1d)2BsxY)mvq2y +zPW+?WjKYp009_=y__?c5puRAYkbXCkG41voUMn&gq&h<4v9ghoC`ld96(^+YGTW8L +zCaS>gnJnEAMv+rnr>Wkz)HXVEr^a!jL>Lh@OKH>tmjeN)pb;Mw>rALT41)J$TN;^1 +z@*)j>e=2;YLEGEm`S3zGJa+icL!WH!Nzukpe6DoQeBjAte<{kp}Kz +z%XB2Zup!+*R0xGN@?6xQ$vzs6cFmJ6}M2xN6^pJf{sF?x@c +z)bt+K^d43iT}V^*E&^R`OqJV>Q}DQ5BG%c~7^1l90S0U<04o=EPy;=MrX!d4;vOG9 +zq!*X}HJM7f|3ORKj(Mpd9^a)kWDBS>?Oa>wUG~!3MwQ$)=vZNPRcQn~Va~n-xVNBt +zU0o`?L-Kwp^VmNnM|!M0dq2Uv7?;=SIUM{DY;gB1?8C8fGmwKjGVo4aCFEwos0n7w +zDkL|pYAcbc%;Zr3XXj?~7<~Kk=~KP|otf{6Tv;?gNo+j>b?SxT@iTv}EQZYUqMDNI +zS5JmNA@DLWy4y)~w{(ou3iKtSabwqvU8?4)qb%?l*R|I*AC~9ORA0d#IElgWGpmF3 +zwIf4n^bZYApMPnI2l&aU@jYww4F;D}Ylq&X8?7+d;L(^%3y*rzEUygJNVpp&N%(J?SMZk40ddm*Kd*jDLeH@zzULB?mwfxf8+63XZlD-7stf|}ZOMYI^x@f^bM*L&FX`-!b06dGO>9y(Rf=O73}qYZ#%tm0m|W{Yu-7%Q6qZBOG^-Sq(k3PS$%8!_bAN2q`w#WA1_0BT0 +zwreCX5)$gAT!sU;@^b|VWF)vzkT{3t!hs8dE241d8Qz=Ob=Igtimb?rM@h=`j%%lplD1#bX63`LxXDpWhF +z%RzQIE{lML4PH@9R9P7Ip&ClfYhGROuvUabu}Ft35i){GA6i^RJcL+^DA6ElJW2$v +z)DYk=u=#!fJ&`maX>z#8LMb#fls~N>d1-AKj^nDM^k3k^Mzf>AEX*7-*C%!j +zHgHqi3BwAjwx}d`3$$4bB7&f-B^J~VfGLh&)OgJCBTB#`)kV+}Ypya?6A=qV(kB#B +z@wTVg9i&NRoy+wTDI=C^ +zTvv%kSvU7q_8kle9|L7uj%f28H*fElJ6VLI1ZP!YquZR+BlSk%{^88Gbp~O8`rYSAV4+wUOD}Ue^ +zy{wbSwp4Lb=yu79(95m$;mU|LIxX#-u)0ZQZ3P6V{RHXD?S8Z-RH7x=T$?#u96R#?*wZ6f;$a^?nSAsW$QR(Ih(M#-Nf!|{J`*uc +z8UCdzuR$I4oM74cdcksoLt%c}b8vX);ky%$tfs=rY7b3u;Xs+lXm=9SDO!Pu&>?iz +zqEb#f9^xeoD0-4U1dCV`PByHN^vMX!=TrNKTYJ_XDr}hRvj?Z`I_x8uujUtCpx%O@ +z*}Z{BpbWgxh@s&$xRZQN#ACG*LC;W~ZEGxe?Qb_ff~6n6fn(5GMhs*`L_^TRUv83C +z=qrDCb^oh7uASc=4U}Noi(GBUCRzcRT8`^6u{v}aV$b*sj}5Q`Zh5ID+C0)|m@IS? +zMk=o}9G7|rr$1+?tV+J>@pgsRob*#P=&lm!$&P%07GP;zgxH-n`ZtZ5x&Qb-b8wnU +z_Y=A59NhzGvMx8f7MIO)i}%lL}$4$InfcRxyuqqYJ_2djUC2@SpS`;M!b!a^DlK8>v=37lGE4owFgc=C75# +z&;OsX`S6l8Nee19L~mPiMYB0MceRM~@CHYUx)d&{Ae?^_C9c{Ldej0g10%jIh +z6uBd!G{g#{7tFg)9UlI2>gP#w@lwhBdgjBydMA!Cd@XqmF40|S=XS~j4NO0}KySxv +zrb1vzy3gHbcX`wbtz}iPgrl(Nm;g;HN=GIm*wK_oFR&QV3PwUL<0RP>4Ev<@3e!9lxs%$o +ziwR`P42~Sy+48$A41906bs;GXFJ8J;xPIBadve2@iMQ@zA|2dOGK^_Bdjr`9xg7Jd +zw*tEE{BC@9pd@e_YQP!307$S)K^o0eXFig>^e$U4ir?IwoE=z6IS W.toAffine.FunctionField + + omit [DecidableEq F] in +-/-- `pointValuation P f = exp (-n)` from `ord_P P f = n` (for `f ≠ 0`). Curve-side +-mirror of `ordAtInftyValuation_eq_exp_neg_of_ordAtInfty_eq`, kept local to avoid an +-import of `Hasse.L6Witnesses`. -/ ++/-- `pointValuation P f = exp (-n)` follows from `ord_P P f = n` for `f ≠ 0`. -/ + theorem pointValuation_eq_exp_neg_of_ord_P_eq {C : Curves.SmoothPlaneCurve F} {P : C.SmoothPoint} + {f : C.FunctionField} {n : ℤ} (hf : f ≠ 0) (hn : C.ord_P P f = (n : WithTop ℤ)) : + C.pointValuation P f = WithZero.exp (-n) := by + have hv : C.pointValuation P f ≠ 0 := (C.pointValuation P).ne_zero_iff.mpr hf + have hord : C.ord_P P f = ((-(WithZero.unzero hv).toAdd : ℤ) : WithTop ℤ) := by + simp only [Curves.SmoothPlaneCurve.ord_P] +- rw [dif_neg hv] ++ rw [dite_eq_right hv] + have hneq : n = -(WithZero.unzero hv).toAdd := by exact_mod_cast (hord.symm.trans hn).symm + rw [hneq, neg_neg, WithZero.exp, ofAdd_toAdd, WithZero.coe_unzero] + +@@ -84,8 +62,8 @@ theorem valuation_aeval_eq_exp (w : Valuation KE (WithZero (Multiplicative ℤ)) + intro i + rw [Algebra.smul_def, map_mul, map_pow, hu, ← WithZero.exp_nsmul] + by_cases hci : p.coeff i = 0 +- · rw [if_pos hci, hci, RingHom.map_zero, map_zero, zero_mul] +- · rw [if_neg hci, hc _ hci, one_mul] ++ · rw [ite_eq_left hci, hci, RingHom.map_zero, map_zero, zero_mul] ++ · rw [ite_eq_right hci, hc _ hci, one_mul] + congr 1 + rw [nsmul_eq_mul] + ring +@@ -97,13 +75,13 @@ theorem valuation_aeval_eq_exp (w : Valuation KE (WithZero (Multiplicative ℤ)) + refine (Valuation.map_sum_eq_of_lt w (Finset.self_mem_range_succ n) ?_).trans ?_ + · intro i hi + rw [Finset.mem_sdiff, Finset.mem_range, Finset.mem_singleton] at hi +- rw [h_term i, h_term n, if_neg h_lead_ne] ++ rw [h_term i, h_term n, ite_eq_right h_lead_ne] + by_cases hci : p.coeff i = 0 +- · rw [if_pos hci] ++ · rw [ite_eq_left hci] + exact lt_of_le_of_ne zero_le (Ne.symm WithZero.exp_ne_zero) +- · rw [if_neg hci, WithZero.exp_lt_exp] ++ · rw [ite_eq_right hci, WithZero.exp_lt_exp] + omega +- · rw [h_term n, if_neg h_lead_ne] ++ · rw [h_term n, ite_eq_right h_lead_ne] + + omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `algebraMap (Polynomial F) K(E)` is `aeval x_gen` (both are the F-algebra hom +@@ -277,10 +255,11 @@ theorem ordAtInftyValuation_basis_summands_distinct {r₁ r₂ : FractionRing (P + intro h_eq + omega + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + set_option backward.isDefEq.respectTransparency.types false in + /-- **Value on the coordinate function `y`.** A valuation `w` with `w y_gen = exp 3` + agrees with `ordAtInftyValuation` on `coordYInFunctionField` (which is `y_gen`): +-both equal `exp (-3)`. -/ ++both equal `exp 3`. -/ + private theorem valuation_coordYInFunctionField_eq_ordAtInftyValuation + (w : Valuation KE (WithZero (Multiplicative ℤ))) (hy : w (y_gen W) = WithZero.exp 3) : + w (W_smooth W).coordYInFunctionField = +@@ -359,6 +338,7 @@ private theorem eq_ordAtInftyValuation_of_agree_fracPolyX_coordY + exact valuation_eq_add_of_eq_of_eq_of_distinct W w (W_smooth W).ordAtInftyValuation + (h_rat p) hβc_agree (ordAtInftyValuation_basis_summands_distinct W h_not_both) + ++omit [W.toAffine.IsElliptic] in + /-- **Valuation determined by `x_gen`, `y_gen`.** A `ℤᵐ⁰`-valued valuation `w` on + `K(E)` with `w x_gen = exp 2`, `w y_gen = exp 3`, and trivial on `F^×` equals + `ordAtInftyValuation`. The decomposition `f = α + β·coordY` (`α, β ∈ F(x)`) plus +@@ -372,8 +352,9 @@ theorem eq_ordAtInftyValuation_of_x_y (w : Valuation KE (WithZero (Multiplicativ + (valuation_algebraMap_fracPolyX_eq_ordAtInftyValuation W w hx hc) + (valuation_coordYInFunctionField_eq_ordAtInftyValuation W w hy) + ++omit [W.toAffine.IsElliptic] in + /-- `ord_P (-T) (τ_T x_gen) = -2`, uniformly across 2-torsion and non-2-torsion +-`T = (xk, yk)`. Dispatches to the two shipped cases. -/ ++`T = (xk, yk)`. -/ + theorem ord_P_negSmoothPoint_translateX_xy_eq_neg_two + (xk yk : F) (h_ns : W.toAffine.Nonsingular xk yk) : + (W_smooth W).ord_P (negSmoothPoint W xk yk h_ns) +@@ -382,6 +363,7 @@ theorem ord_P_negSmoothPoint_translateX_xy_eq_neg_two + · exact ord_P_translateX_xy_eq_neg_two_at_2tor W xk yk h_ns h + · exact ord_P_translateX_xy_eq_neg_two_of_non_2_tor W xk yk h_ns h + ++omit [W.toAffine.IsElliptic] in + /-- `ord_P (-T) (τ_T y_gen) = -3`, uniformly across 2-torsion and non-2-torsion. -/ + theorem ord_P_negSmoothPoint_translateY_xy_eq_neg_three + (xk yk : F) (h_ns : W.toAffine.Nonsingular xk yk) : +@@ -461,11 +443,8 @@ theorem ord_P_negSmoothPoint_translateAlgEquivOfPoint_eq_ordAtInfty_some + rw [hm, hn] + exact_mod_cast neg_injective h_at_f + +-/-- **Unconditional discharge of `IsTranslateOrdAtInftyCompatible`.** For a finite +-smooth point `P` and a group element `k` with `P + k = O` (so `P = -k`), the +-translation pullback `τ_k` carries the order at `P` to the order at infinity: +-`ord_P P (τ_k f) = ordAtInfty f` for all `f`. Gates the Weil-pairing divisor +-transport. -/ ++/-- For a finite smooth point `P` and a group element `k` with `P + k = O`, ++translation pullback satisfies `ord_P P (τ_k f) = ordAtInfty f` for every `f`. -/ + theorem isTranslateOrdAtInftyCompatible_translateAlgEquivOfPoint + (P : (W_smooth W).SmoothPoint) (k : (W_smooth W).toAffine.Point) + (h_zero : P.toAffinePoint + k = Affine.Point.zero) : +diff --git a/projects/HasseWeil/HasseWeil/Foundation/EC/TranslateValuation.lean b/projects/HasseWeil/HasseWeil/Foundation/EC/TranslateValuation.lean +index 0fbf76569d790458fadca970039cf32598f16d3b..8fbe28c64fdb18776583e7ad48fb72d1d909f59c 100644 +GIT binary patch +delta 113 +zcmcckfaA%1jt!d_H~(RbV>B!+PAyhQ&d)7KEXhpD%*iaNRLDr=YRz^_cI$YZ+^qJR))JIH9oa4z9=(2qojGB^7eVkjK8Xo1-H+g$GBx8 +E0DZwO_W%F@ + +diff --git a/projects/HasseWeil/HasseWeil/Foundation/EC/Translation.lean b/projects/HasseWeil/HasseWeil/Foundation/EC/Translation.lean +index c135cb1b2..798b434d7 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/EC/Translation.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/EC/Translation.lean +@@ -6,43 +6,17 @@ Authors: Chris Birkbeck + import HasseWeil.Foundation.AdditionPullback + + /-! +-# Translation by a base-field point on K(E) ++# Translation by a base-field point on the function field + +-For an elliptic curve `W` over `F` and a point `(xk, yk) ∈ W(F)` (= a base-field +-solution of the Weierstrass equation), translation by `k = (xk, yk)` lifts +-to a K-algebra automorphism `τ_k : K(E) ≃ₐ[F] K(E)` defined by: ++Translation by a point `k = (xk, yk)` of an elliptic curve acts on its ++function field through the addition formulas. The slope is ++`(y_gen − yk) / (x_gen − xk)`, and the translated coordinate functions ++are obtained from this slope by `addX` and `addY`. The coordinate-ring ++homomorphism extends to the function field when the evaluation map is ++injective. Kernel translations preserve pullbacks along isogenies, ++relating the point kernel to function-field automorphisms. + +-* `τ_k(x_gen) = (W_KE).addX(x_gen, xk, slope_k)` where +- `slope_k = (y_gen - yk) / (x_gen - xk)`. +-* `τ_k(y_gen) = (W_KE).addY(x_gen, xk, y_gen, slope_k)`. +- +-This is the substantive Galois-correspondence content for elliptic +-isogenies (Silverman III.4.10(a)): for an isogeny `α : E → E`, the kernel +-of `α` (as an additive subgroup of `E.Point`) acts on `K(E₁)/α*K(E₂)` as +-the Galois group, and the bijection `α.kernel ≃ Aut(K(E)/α*K(E))` sends +-each kernel element `k` to the translation automorphism `τ_k`. +- +-This file constructs the translation algebra hom directly via the addition +-formula on coordinates, paralleling +-`HasseWeil/AdditionPullback.lean`'s `addPullbackAlgHom_negFrobenius` +-construction. +- +-## Foundational definitions +- +-The translation construction is parallel to `addPullback_x` / `addPullback_y` +-but with the second point a base-field constant rather than `α.pullback`. +- +-* `translateSlope_xy xk yk` — slope from `(x_gen, y_gen)` to `(xk, yk)`. +-* `translateX_xy xk yk` — x-coord of `P_gen + (xk, yk)`. +-* `translateY_xy xk yk` — y-coord of `P_gen + (xk, yk)`. +- +-These are foundational K(E)-elements; the algebra-hom construction (analog +-of `addPullbackAlgHom`) requires the `AddNonInverse` and injectivity +-witnesses. +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, III.4.10(a). ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10(a). + -/ + + open WeierstrassCurve +@@ -293,6 +267,7 @@ noncomputable def translateAlgHom (xk yk : F) (h_eq : W.toAffine.Equation xk yk) + (translateCoordAlgHom_injective_of_baseHom_inj W xk yk h_eq hxy hxinj) + + omit [DecidableEq F] in ++omit [W.toAffine.IsElliptic] in + /-- A pole of `translateX_xy` at infinity forces non-constancy: if + `ordAtInfty (translateX_xy) < 0` then `translateX_xy` is not `algebraMap F KE c` + for any `c : F`. -/ +@@ -329,6 +304,7 @@ theorem translateBaseHom_injective_of_transcendental (xk yk : F) + exact transcendental_iff_injective.mp h_trans + + omit [DecidableEq F] in ++omit [W.toAffine.IsElliptic] in + private theorem ordAtInfty_sub_const_of_neg_aux {g : KE} {n : ℤ} (hn : n < 0) + (hg : (W_smooth W).ordAtInfty g = ((n : ℤ) : WithTop ℤ)) (c : F) : + (W_smooth W).ordAtInfty (g - algebraMap F KE c) = ((n : ℤ) : WithTop ℤ) := by +@@ -339,7 +315,7 @@ private theorem ordAtInfty_sub_const_of_neg_aux {g : KE} {n : ℤ} (hn : n < 0) + rw [hg, ordAtInfty_algebraMap_F_nonzero W hc] + exact_mod_cast hn + +-omit [DecidableEq F] in ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- For any `xk ∈ F`, `ord(x_gen - xk) = -2`, since the constant `xk` has + nonnegative order while `x_gen` has order `-2`. -/ + theorem ord_x_gen_sub_const (xk : F) : +@@ -370,7 +346,7 @@ theorem translateSlope_xy_eq (xk yk : F) : + intro h_eq + exact x_gen_sub_const_ne_zero W xk (sub_eq_zero.mpr h_eq) + +-omit [DecidableEq F] in ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ord(y_gen - yk) = -3` for any `yk : F`. -/ + theorem ord_y_gen_sub_const (yk : F) : + (W_smooth W).ordAtInfty (y_gen W - algebraMap F KE yk) = +@@ -378,9 +354,9 @@ theorem ord_y_gen_sub_const (yk : F) : + classical + exact ordAtInfty_sub_const_of_neg_aux W (by norm_num) (ordAtInfty_y_gen W) yk + +-omit [DecidableEq F] in +-/-- `ord(translateSlope_xy) = -1` for non-zero `xk` (so the slope is in secant +-form). -/ ++omit [DecidableEq F] [W.toAffine.IsElliptic] in ++/-- The translation slope has order `−1` at infinity, as the quotient ++of coordinate differences of orders `−3` and `−2`. -/ + theorem ord_translateSlope_xy (xk yk : F) : + (W_smooth W).ordAtInfty (translateSlope_xy W xk yk) = + ((-1 : ℤ) : WithTop ℤ) := by +diff --git a/projects/HasseWeil/HasseWeil/Foundation/EC/TranslationOrd.lean b/projects/HasseWeil/HasseWeil/Foundation/EC/TranslationOrd.lean +index cea73bd37ab5ea56657974cbcf2551bdc8ca43c8..d6dda63fd0bbf1363e9aa0b34f4b582268277efa 100644 +GIT binary patch +delta 10891 +zcmbta4U8PuUDxc4-DVn_#<9c2ahzu*jh$rooJ-U;y@WJQAi*W>ozqi-DAn!U?%TVG +zXJ^hcv%b5Mu#E&X6;!3U&{4yO+Nx@men5&zhSCyb2_ZFw8X<&S2~;%#3JMS+N}xm$ +z{Qm#<-hAxtotq*>if?w_d;gE$|M&lR^P9i6=i9$>*)yNFK5&23@d6RWT^T205aNF# +zjlD1lyws0Ef&aWv$RO}nQ@_6xa;sw|ODN_fwIs$XGT-64Ad%mtmny5=5&~taynV%4O(xMyg|{#e#a3 +z-;`ak-s(g!i645Y6rCtc#`NLVgR$&zQtg4k}!OQh)e +zG8lHJUAKAw+0`4QQ9p`TSNx=p9RrB#b^8!MV1JzPf`M`XoxuhH+Y+%*4Lap} +zx4mA3!a70$PTzdx(W#~~B}W27q;4rUkO^5C(TzYObNu(SH@>yz;lqFSZMy~0RK#xW +z;Zmwi@5`6(O(qMpe^_%=?f9mqXU4B0iSd&(x4%W#_$g? +zPsU7F{FnpOV_ujRn~g8*Kl|xFf9g<8$-DmTJ&m_6jDR5f-TB59Ckg;v#NA>9G9^wc +zxXF&~vo1fo{>py{dok=~r}kK%rhnv@UT(ea{ul{Rq1`M$Xx+E-eH;{~U7 +zXysR|S^qG#dG^(V+0!3wyd}T%*R8Kw`13&a+LPAR`9FT#y3F2mF6_(x^2)}WayzSO)Litn&_$eeTt0<^i{z1}He1N~!;U&&c +z!sIgsxq8GY#MCi5#VGimqyhq-M-BviFUv0H6ZdGV#dXYt+*7>CrW=;F>4ck~{6l+}HBn8N)}!Xet7)s<**hMw4`tJTZST)-{kpxY +zVa;b>KkOVhUVRFynR~ +zkAZ4kXh_Q#n(`4Lr=&uIG1=7s(KHtgQM93Y4HVd?#ZOap$1YHwD!j7|j?|lQCDpqq +zCrg(akB%#(MRpIB2S8{F)>2d*fPmah`NMx|U&F>)MYX%+8}N*rmxwhV^_$rOhIicu +zix`BQmDNd#nw`j=&aDgBMsd{f;+Sa`s4y}PQI4a^nHM(+yuo!J{^m#Rrr|@-Q6(9p1#--`hM+!i!EWa7_zSybU9*+3b&O>n|CYUXrXKa~#X~fkdBnb+ +zV)0P^$LHuAuk80Wh7U+sjeA-0Y~4SmD^iYe +z-Fs?KT8V-#T#U^}mQfH+i+QA3ZVR{})2)UAL}dZMrO*rr#S)vL0WtZR_f~>0$I)OF +zeYWg_082d81*+(&+Ptb<>J;q}q(vPRa~xCU%E}Vcc2yo3->c+A74;})pSxi1YlI7A +zN6vfThtZamnx*6-)V2zOm6#<^q*lwaWU$1`O_9n~WF}l^YD)BO5HEh@vtow3{W4u- +zr(dx5X5ah+`;s~Hd#P@_hf#y60LwLqa$y8D1>5Ej578=2!aG(o*5STq1I{sFfOd^ +zjUsdlgwMKlr#AgENkiN^gu_MRk@%jBsYt +zf!m9MAX)gKjI$bk6O*3e~MKIsZ$h}jH8b0RP-*Dbs=`7A!&cltNHhtlykzFfBDw$km)*@c0g{Y-GnjV&K +z8)Fu)70C|xQT8FD;%r!jnFv!N;EvN4Q?SVR~Kn#^>pGZjkH0Z?xU| +zHo|uqzvEDTDLZ;fJu&yG(0;0j7)xNHnHOVBub(b>>SW>0D=93vrCri`B +zdLo563foX78(*WrQL$ICU`q-nT&s%;sG@MajQfe|^s_F;SQ}bqwjWibTaC+A52C2a +zw9%ysH8~I|N3)MkJC|m^I^#T=@4mvh!n&Uv%{s6xRTe5NTC-o-c9(^DS-Vo
  • nO +zIpus!ryoV9U72)Zx{?A5R5w(GH&q>&O3;v`94O&6Me|)BYb6qHsgf!=xo0f7PnQAI +zW}s#f>Cn`?iYssfllp32NDXBdJH~xAmju@Q7_ +zW7^Oc-FHgLIpMO~#!-tPqn<86#P(`3 +zWIu4kk@mz98X!Ar-Wrb-<|ADZm)q~0rxG$T-6vwDRgi)CR>H7*uUnU!U +z-HK;sL%xQt6#Ecq=!a*36AxoCeQ7>2aN-*cec__FuU#Z_9H}8a1DSkMIS<8+7eixQ +zQN+!1aL++`O2*+(>e-&4dv%I(W;+xQ8#r0ZhE6~U*G6&h3n&^E9&MM`$co13DqCBD +zf{d7Z5CpQ@TJk!l>Nlede=TEs!-d6hc9X{$;7EPzR`PgD=~eS_!B>KZD~7dNV$5UN +zEB|HhJyCTVGG1kZ$K+F3Zq$2qYXaq%iHYpwZ5WE}zQe(6`&bnbEn_fLkcRN+GK;K1 +zmkcFJ%)m>d6vz_|41;@u(_zf{z1?v1yJ9!@Uh#m-8#yCIP+^v_0xYR;-o%_BZSw +z&+gr4?at5L>9iWR-eaaZW>8u^hG(ROMGTg*>yJ6_+&wlOo60|R%vrZ8B@d_sUm_Ty +z<;J}hQxu$A_!98|I9I0k%=`61D(b0VNN%S>JsHr&olJ&gjDpbE;6;L|a9iOPAAMqse^>Jwi2N#uXusa;?cZOfkZ0K<6r0<{do*D(34q)COlb>-0UlhPBZ`Tob#GJ +zd%_fUx`v7I(GaK@k%{0?w&Ac-RVIanX&bZuJ>eY6{`q~*t|7<@V_up(pX7dzxWXP-&3^%M)oI2^4C9%8lz=d-B;O;-qls6mk#K5b~Rc^{eb5hRA93Vo6Y2Zx9GfTAAch|cKtKH*>JLr@^^KeXB)vA +z*;M%wMF=C5ScrUS45q(gK!<`hpo8Lxe9E)lg3bx3*{2?HuFVez&X=wHkne|wnq +z&VS~#^WAOBL6r?KHAi<=WlY{#dL3LWqI07tEl3X4HL9`l0=bBA-V5iVy-NoDvi2G3 +z>mOQ3l@K=M4_uNo_W4^IbTXLn0^}T}K)G=!VO|YCjetcVkFt|){J6<24TRH6UDS3< +z8`m)btJ4VkEidk@_Q`$KUaP W.toAffine.FunctionField + noncomputable def formalU : PowerSeries F := + PowerSeries.mk (fun n ↦ formalW_coeff W (n + 3)) + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The constant coefficient of `formalU` is 1. -/ + @[simp] theorem formalU_constantCoeff : + @PowerSeries.constantCoeff F _ (formalU W) = 1 := by + rw [← PowerSeries.coeff_zero_eq_constantCoeff_apply, formalU, PowerSeries.coeff_mk, + zero_add, formalW_coeff_three] + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `formalU W` is a unit in `F⟦X⟧`. -/ + theorem formalU_isUnit : IsUnit (formalU W) := by + rw [PowerSeries.isUnit_iff_constantCoeff] +@@ -92,16 +46,19 @@ theorem formalU_isUnit : IsUnit (formalU W) := by + noncomputable def formalU_inv : PowerSeries F := + PowerSeries.invOfUnit (formalU W) 1 + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `formalU * formalU_inv = 1` in `F⟦X⟧`. -/ + @[simp] theorem formalU_mul_inv : formalU W * formalU_inv W = 1 := + PowerSeries.mul_invOfUnit (formalU W) 1 + (by rw [formalU_constantCoeff]; rfl) + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `formalU_inv * formalU = 1` in `F⟦X⟧`. -/ + @[simp] theorem formalU_inv_mul : formalU_inv W * formalU W = 1 := + PowerSeries.invOfUnit_mul (formalU W) 1 + (by rw [formalU_constantCoeff]; rfl) + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The constant coefficient of `formalU_inv` is 1. -/ + @[simp] theorem formalU_inv_constantCoeff : + @PowerSeries.constantCoeff F _ (formalU_inv W) = 1 := by +@@ -131,6 +88,7 @@ In `LaurentSeries F`, `formalX W` has order `-2` and `formalY W` has order `-3`. + These follow because `formalU_inv W` has order `0` (constant coeff = 1) and + `single (-2) 1` resp. `single (-3) 1` have orders `-2` resp. `-3`. -/ + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `ofPowerSeries ℤ F (formalU_inv W)` is nonzero in `LaurentSeries F`. -/ + theorem ofPowerSeries_formalU_inv_ne_zero : + (HahnSeries.ofPowerSeries ℤ F (formalU_inv W) : LaurentSeries F) ≠ 0 := by +@@ -144,12 +102,14 @@ theorem ofPowerSeries_formalU_inv_ne_zero : + rw [h] at h_nonzero + exact one_ne_zero h_nonzero.symm + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `formalX W ≠ 0`. -/ + theorem formalX_ne_zero : formalX W ≠ 0 := by + rw [formalX] + exact mul_ne_zero (HahnSeries.single_ne_zero one_ne_zero) + (ofPowerSeries_formalU_inv_ne_zero W) + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `formalY W ≠ 0`. -/ + theorem formalY_ne_zero : formalY W ≠ 0 := by + rw [formalY] +@@ -157,6 +117,7 @@ theorem formalY_ne_zero : formalY W ≠ 0 := by + rw [ne_eq, neg_eq_zero] + exact HahnSeries.single_ne_zero one_ne_zero + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `ofPowerSeries ℤ F (formalU_inv W)` has `orderTop = 0`. This is because the + series has constant coefficient 1, so its order is ≤ 0; and all coefficients + at negative indices vanish (since `ofPowerSeries` embeds `ℕ ↪ ℤ`), so its order +@@ -177,10 +138,11 @@ theorem ofPowerSeries_formalU_inv_orderTop : + rw [HahnSeries.le_orderTop_iff_forall] + intro n hn + have : ((formalU_inv W : PowerSeries F) : LaurentSeries F).coeff n = 0 := by +- rw [PowerSeries.coeff_coe, if_pos]; exact_mod_cast hn ++ rw [PowerSeries.coeff_coe, ite_eq_left]; exact_mod_cast hn + exact this + exact le_antisymm h_le h_ge + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `formalX W` has `orderTop = -2` in `LaurentSeries F`. -/ + theorem formalX_orderTop : + (formalX W).orderTop = ((-2 : ℤ) : WithTop ℤ) := by +@@ -188,6 +150,7 @@ theorem formalX_orderTop : + ofPowerSeries_formalU_inv_orderTop] + rfl + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `formalY W` has `orderTop = -3` in `LaurentSeries F`. -/ + theorem formalY_orderTop : + (formalY W).orderTop = ((-3 : ℤ) : WithTop ℤ) := by +@@ -204,6 +167,7 @@ has leading coefficient `-1`. These come from expanding the definitions: + `formalX = single(-2,1) · (lifted u_inv)` with `(lifted u_inv).leadingCoeff = 1` + (since `u_inv` has constant coefficient `1`). -/ + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- The leading coefficient of the lifted `formalU_inv` is `1` (its constant + coefficient as a power series). -/ + theorem ofPowerSeries_formalU_inv_leadingCoeff : +@@ -222,12 +186,14 @@ theorem ofPowerSeries_formalU_inv_leadingCoeff : + rw [hS, this, PowerSeries.coeff_zero_eq_constantCoeff_apply] + exact formalU_inv_constantCoeff W + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `formalX W` has leading coefficient `1`. -/ + theorem formalX_leadingCoeff : + (formalX W).leadingCoeff = 1 := by + rw [formalX, HahnSeries.leadingCoeff_mul, HahnSeries.leadingCoeff_of_single, + ofPowerSeries_formalU_inv_leadingCoeff, mul_one] + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `formalY W` has leading coefficient `-1`. -/ + theorem formalY_leadingCoeff : + (formalY W).leadingCoeff = -1 := by +@@ -244,9 +210,8 @@ Weierstrass equation `y² + a₁xy + a₃y - x³ - ... - a₆ = 0` after substit + So the proof of `formalXY_weierstrass` is essentially: state the recurrence, + clear denominators in the field `LaurentSeries F`, and conclude via the recurrence. -/ + +--- The Silverman IV.1.1 recurrence `formalW_recurrence` is now proved in +--- `HasseWeil/FormalGroup.lean` and used directly here. + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `formalW W ≠ 0` because its coefficient at index 3 is 1. -/ + theorem formalW_ne_zero : formalW W ≠ 0 := by + intro h +@@ -258,6 +223,7 @@ theorem formalW_ne_zero : formalW W ≠ 0 := by + rw [this] at h3 + exact one_ne_zero h3 + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `HahnSeries.ofPowerSeries ℤ F (formalW W) ≠ 0` in `LaurentSeries F`. -/ + theorem lifted_formalW_ne_zero : + HahnSeries.ofPowerSeries ℤ F (formalW W) ≠ 0 := by +@@ -265,6 +231,7 @@ theorem lifted_formalW_ne_zero : + exact formalW_ne_zero W + (HahnSeries.ofPowerSeries_injective (h.trans (map_zero _).symm)) + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `formalW = X^3 * formalU` as `PowerSeries F`. -/ + theorem formalW_eq_X3_mul_U : + formalW W = PowerSeries.X ^ 3 * formalU W := by +@@ -282,7 +249,7 @@ theorem formalW_eq_X3_mul_U : + rw [hLHS] + -- RHS: (X^3 * formalU).coeff n = 0 for n < 3 + rw [PowerSeries.coeff_X_pow_mul'] +- rw [if_neg (by omega : ¬ 3 ≤ n)] ++ rw [ite_eq_right (by omega : ¬ 3 ≤ n)] + · push Not at hn + obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hn + rw [add_comm 3 m, PowerSeries.coeff_X_pow_mul] +@@ -290,11 +257,12 @@ theorem formalW_eq_X3_mul_U : + rw [show formalU W = PowerSeries.mk (fun n ↦ formalW_coeff W (n + 3)) from rfl, + PowerSeries.coeff_mk] + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `formalW W` has `PowerSeries.order` equal to 3 (since `formalW = X^3 * formalU` + and `formalU` is a unit). -/ + theorem formalW_ps_order : (formalW W).order = 3 := by + rw [formalW_eq_X3_mul_U, PowerSeries.order_mul, PowerSeries.order_X_pow, +- PowerSeries.order_zero_of_unit (formalU_isUnit W)] ++ PowerSeries.order_zero_of_isUnit (formalU_isUnit W)] + rfl + + omit [DecidableEq F] in +@@ -335,6 +303,7 @@ private theorem formalW_recurrence_lift : + HahnSeries.ofPowerSeries_X] at h + exact h + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Helper: `formalY W * lifted_formalW W = -1` in `LaurentSeries F`. -/ + private theorem formalY_mul_formalW : + formalY W * HahnSeries.ofPowerSeries ℤ F (formalW W) = -1 := by +@@ -355,6 +324,7 @@ private theorem formalY_mul_formalW : + _ = -(1 : LaurentSeries F) * 1 := by rw [h1, h2] + _ = -1 := by ring + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Helper: `formalX W * lifted_formalW W = single 1 1` in `LaurentSeries F`. -/ + private theorem formalX_mul_formalW : + formalX W * HahnSeries.ofPowerSeries ℤ F (formalW W) = +@@ -377,12 +347,14 @@ private theorem formalX_mul_formalW : + _ = HahnSeries.single (1 : ℤ) (1 : F) * 1 := by rw [h1, h2] + _ = HahnSeries.single (1 : ℤ) (1 : F) := mul_one _ + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `formalY W = -1 / lifted_formalW W` in `LaurentSeries F`. -/ + theorem formalY_eq_div : + formalY W = -1 / HahnSeries.ofPowerSeries ℤ F (formalW W) := by + rw [eq_div_iff (lifted_formalW_ne_zero W)] + exact formalY_mul_formalW W + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `formalX W = (single 1 1) / lifted_formalW W` in `LaurentSeries F`. -/ + theorem formalX_eq_div : + formalX W = HahnSeries.single (1 : ℤ) (1 : F) / +@@ -390,6 +362,7 @@ theorem formalX_eq_div : + rw [eq_div_iff (lifted_formalW_ne_zero W)] + exact formalX_mul_formalW W + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `(formalX W, formalY W)` satisfies the Weierstrass equation of `W` over `F`, + interpreted as an identity in `LaurentSeries F`. + +@@ -445,6 +418,7 @@ noncomputable def localParam : KE := + + /- `x_gen_ne_zero` HOISTED to `Foundation/MulByIntPullback.lean` (#7621). -/ + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The local parameter is nonzero in `K(E)`. -/ + theorem localParam_ne_zero : localParam W ≠ 0 := by + simp only [localParam] +@@ -470,16 +444,19 @@ through `AdjoinRoot.lift` and `IsLocalization.lift`. -/ + noncomputable def localExpand_inner : Polynomial F →+* LaurentSeries F := + Polynomial.eval₂RingHom (algebraMap F (LaurentSeries F)) (formalX W) + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The inner ring hom sends `Polynomial.X` to `formalX W`. -/ + @[simp] theorem localExpand_inner_X : + localExpand_inner W Polynomial.X = formalX W := by + simp [localExpand_inner] + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The inner ring hom sends constants to their algebra image. -/ + @[simp] theorem localExpand_inner_C (a : F) : + localExpand_inner W (Polynomial.C a) = algebraMap F (LaurentSeries F) a := by + simp [localExpand_inner] + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- The Weierstrass polynomial, evaluated via the inner ring hom at `formalY W`, + vanishes. This is `formalXY_weierstrass` expressed in terms of `Polynomial.eval₂`. -/ + private theorem localExpand_weierstrass_eval : +@@ -505,11 +482,13 @@ private noncomputable def localExpand_coordHom : + W.toAffine.CoordinateRing →+* LaurentSeries F := + AdjoinRoot.lift (localExpand_inner W) (formalY W) (localExpand_weierstrass_eval W) + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- The coordinate ring lift sends `AdjoinRoot.root` to `formalY W`. -/ + @[simp] private theorem localExpand_coordHom_root : + localExpand_coordHom W (AdjoinRoot.root W.toAffine.polynomial) = formalY W := by + simp [localExpand_coordHom, AdjoinRoot.lift_root] + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `(formalX W ^ n).orderTop = -2 * n` in `LaurentSeries F` (for `n : ℕ`). -/ + theorem formalX_pow_orderTop (n : ℕ) : + ((formalX W) ^ n).orderTop = ((-2 * n : ℤ) : WithTop ℤ) := by +@@ -526,6 +505,7 @@ theorem formalX_pow_orderTop (n : ℕ) : + push_cast + ring + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `(formalX W ^ n).leadingCoeff = 1` in `LaurentSeries F` (for `n : ℕ`). -/ + theorem formalX_pow_leadingCoeff (n : ℕ) : + ((formalX W) ^ n).leadingCoeff = 1 := by +@@ -536,6 +516,7 @@ theorem formalX_pow_leadingCoeff (n : ℕ) : + | succ k ih => + rw [pow_succ, HahnSeries.leadingCoeff_mul, ih, formalX_leadingCoeff, mul_one] + ++omit [W.toAffine.IsElliptic] in + /-- Auxiliary: for a polynomial `p : F[X]` with `p ≠ 0`, the image + `localExpand_inner W p` has `orderTop = -2 * p.natDegree` in `LaurentSeries F`. + +@@ -588,6 +569,7 @@ theorem localExpand_inner_orderTop_eq {p : Polynomial F} (hp : p ≠ 0) : + nlinarith + exact (HahnSeries.orderTop_add_eq_right h_lt).trans hB_ord + ++omit [W.toAffine.IsElliptic] in + /-- Auxiliary: for a nonzero polynomial `p : F[X]`, `localExpand_inner W p ≠ 0`. -/ + theorem localExpand_inner_ne_zero_of_ne_zero {p : Polynomial F} (hp : p ≠ 0) : + localExpand_inner W p ≠ 0 := by +@@ -596,6 +578,7 @@ theorem localExpand_inner_ne_zero_of_ne_zero {p : Polynomial F} (hp : p ≠ 0) : + rw [h, HahnSeries.orderTop_zero] at horder + exact absurd horder WithTop.top_ne_coe + ++omit [W.toAffine.IsElliptic] in + /-- Auxiliary: for a polynomial `p : F[X]` with `p ≠ 0`, the image + `localExpand_inner W p` has leading coefficient equal to `p.leadingCoeff`. + +@@ -653,6 +636,7 @@ theorem localExpand_inner_leadingCoeff {p : Polynomial F} (hp : p ≠ 0) : + nlinarith + rw [HahnSeries.leadingCoeff_add_eq_right h_lt, hB_lead, ← hDecomp] + ++omit [W.toAffine.IsElliptic] in + /-- Auxiliary: `(localExpand_inner W q) * formalY W` has odd `orderTop` + (`= -2 * natDegree q - 3`) when `q ≠ 0`. -/ + theorem localExpand_inner_mul_formalY_orderTop +@@ -663,6 +647,7 @@ theorem localExpand_inner_mul_formalY_orderTop + ← WithTop.coe_add] + rfl + ++omit [W.toAffine.IsElliptic] in + /-- The coordinate ring lift is injective. + + **Proof (Silverman IV.1)**: We use `exists_smul_basis_eq` to write any +@@ -738,20 +723,11 @@ private theorem localExpand_coordHom_injective : + rw [Affine.CoordinateRing.smul, Polynomial.C_0, map_zero, zero_mul, zero_add, + Affine.CoordinateRing.smul, Polynomial.C_0, map_zero, zero_mul] + +-/-- The **local expansion** ring hom `K(E) → LaurentSeries F`, sending `x_gen ↦ +- formalX W` and `y_gen ↦ formalY W`. +- +-The construction: +-1. Build the inner ring hom `i : F[X] →+* LaurentSeries F` sending `X ↦ formalX W`. +-2. Lift to `R = AdjoinRoot W.polynomial = F[X][Y]/(W) →+* LaurentSeries F` via +- `AdjoinRoot.lift` with root `formalY W`, using `formalXY_weierstrass` for +- the evaluation condition. +-3. Extend to `K(E) = FractionRing R →+* LaurentSeries F` via `IsFractionRing.lift`, +- using that the coordinate ring lift is injective (source is a domain, target +- is a field, and the map is nonzero — sends `1` to `1`). -/ ++ + noncomputable def localExpand : KE →+* LaurentSeries F := + IsFractionRing.lift (localExpand_coordHom_injective W) + ++omit [W.toAffine.IsElliptic] in + /-- `localExpand` sends `x_gen` to `formalX W`. -/ + @[simp] theorem localExpand_x_gen : localExpand W (x_gen W) = formalX W := by + simp only [localExpand, x_gen] +@@ -761,11 +737,13 @@ noncomputable def localExpand : KE →+* LaurentSeries F := + ((AdjoinRoot.of W.toAffine.polynomial) Polynomial.X) = formalX W + simp [localExpand_coordHom, AdjoinRoot.lift_of, localExpand_inner] + ++omit [W.toAffine.IsElliptic] in + /-- `localExpand` sends `y_gen` to `formalY W`. -/ + @[simp] theorem localExpand_y_gen : localExpand W (y_gen W) = formalY W := by + simp only [localExpand, y_gen] + rw [IsFractionRing.lift_algebraMap, localExpand_coordHom_root] + ++omit [W.toAffine.IsElliptic] in + /-- `localExpand` is an `F`-algebra hom. -/ + theorem localExpand_algebraMap (a : F) : + localExpand W (algebraMap F KE a) = +@@ -781,6 +759,7 @@ theorem localExpand_algebraMap (a : F) : + simp [localExpand_coordHom, AdjoinRoot.lift_of, localExpand_inner, + LaurentSeries.algebraMap_apply, HahnSeries.ofPowerSeries_C] + ++omit [W.toAffine.IsElliptic] in + /-- `localExpand` agrees with the inner ring hom `localExpand_inner` on the image + of `F[X]` in `K(E)`: `localExpand (algebraMap (Polynomial F) KE p) = + localExpand_inner W p`. Both factor the algebra map through the coordinate ring +@@ -795,6 +774,7 @@ theorem localExpand_algebraMap_polynomial (p : Polynomial F) : + localExpand_inner W p + simp [localExpand_coordHom, AdjoinRoot.lift_of] + ++omit [W.toAffine.IsElliptic] in + /-- The `orderTop` of the local expansion of `algebraMap (Polynomial F) KE p` for a + nonzero polynomial `p` is `-2 · natDegree p`. This is `localExpand_inner_orderTop_eq` + transported through `localExpand_algebraMap_polynomial`. -/ +@@ -804,6 +784,7 @@ theorem orderTop_localExpand_algebraMap_polynomial {p : Polynomial F} (hp : p + rw [localExpand_algebraMap_polynomial] + exact localExpand_inner_orderTop_eq W hp + ++omit [W.toAffine.IsElliptic] in + /-- `localExpand` sends `localParam W` to the variable `t` of `LaurentSeries F`. + This is the key compatibility: the local parameter expands to the formal variable. -/ + theorem localExpand_localParam : +diff --git a/projects/HasseWeil/HasseWeil/Foundation/MulByIntPullback.lean b/projects/HasseWeil/HasseWeil/Foundation/MulByIntPullback.lean +index f41767ca5..e2383c638 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/MulByIntPullback.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/MulByIntPullback.lean +@@ -368,7 +368,7 @@ private lemma aeval_x_gen (p : Polynomial F) : + Polynomial.aeval_X_left_apply] + + -- The `Subalgebra F KE` scalar-tower instances and the `aeval` defeq steps below need the +--- relaxed transparency; this is a defeq setting, not a heartbeat budget. ++ + /- `mulByInt_x W n = Φ_n(x_gen) / ΨSq_n(x_gen)` is transcendental over `F` for `n ≠ 0`. + + The proof uses the integral closure approach: if `mulByInt_x` were algebraic over `F`, +@@ -382,7 +382,7 @@ private lemma mulByInt_x_transcendental (n : ℤ) (hn : n ≠ 0) : + intro h_alg + apply x_gen_transcendental W + set S : Subalgebra F KE := Algebra.adjoin F ({mulByInt_x W n} : Set KE) with hS_def +- haveI hS_alg : Algebra.IsAlgebraic F S := ++ have hS_alg : Algebra.IsAlgebraic F S := + (Subalgebra.isAlgebraic_iff S).mp + (Algebra.isAlgebraic_adjoin_singleton_iff.mpr h_alg) + have hmem : mulByInt_x W n ∈ S := Algebra.subset_adjoin (Set.mem_singleton _) +@@ -448,10 +448,8 @@ private lemma norm_smul_basis_ne_zero (p q : Polynomial F) (hq : q ≠ 0) : + (not_le.mpr (WithBot.bot_lt_iff_ne_bot.mpr this)) + + omit [W.toAffine.IsElliptic] in +-/-- The image in `R = F[C]` of the `F[X]`-norm of the basis element `r' = p•1 + q•Y` +-factors as `r' * conj_r`, where `conj_r` is the `F[X]`-conjugate class. Extracted as its +-own lemma so it elaborates in a light context (the `coe_norm_smul_basis` rewrite and the +-ring-hom bookkeeping are heartbeat-heavy inside the main injectivity proof). -/ ++ ++ + private lemma algebraMap_norm_smul_basis_eq (p q : Polynomial F) : + algebraMap (Polynomial F) R (Algebra.norm (Polynomial F) + (p • (1 : R) + q • Affine.CoordinateRing.mk W.toAffine Polynomial.X)) = +diff --git a/projects/HasseWeil/HasseWeil/Foundation/OmegaCoeffMulByIntFiniteField.lean b/projects/HasseWeil/HasseWeil/Foundation/OmegaCoeffMulByIntFiniteField.lean +index a61618eea..51a6ac743 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/OmegaCoeffMulByIntFiniteField.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/OmegaCoeffMulByIntFiniteField.lean +@@ -8,35 +8,35 @@ import HasseWeil.HasseBound.Primitives + import HasseWeil.Foundation.EC.MulByIntAddRecurrence + + /-! +-# Silverman III.5.3: `a_{[m]} = m` via curve-side additivity (Route B assembly) ++# Pullback coefficients of integer multiplication + +-Builds on **RB-ω4** (`kaehler_D_addPullback_x_eq_one_add_smul_omega`, the Silverman III.5.2 +-collapse) to assemble `omegaPullbackCoeff (mulByInt m) = m` WITHOUT the EDS Wronskian and WITHOUT +-the formal-group correspondence. ++The addition formula for the invariant differential gives ++`a_{id+α} = 1 + a_α` and `a_{α+β} = a_α + a_β`. The multiplication-coordinate ++recurrence then proves `a_{[m]} = m` for nonzero integers by induction and ++negation. In positive characteristic, multiplication by the characteristic ++has zero differential coefficient. Over a finite field, the same holds for ++multiplication by its cardinality and supplies the differential input to ++Verschiebung factorization. + +-* **RB-ADD** (`omegaPullbackCoeff_addIsog_id`): +- `omegaPullbackCoeff (id ⊞ α) = 1 + omegaPullbackCoeff α`. +-* **RB-ID/SUM/IND**: `id ⊞ [m] = [m+1]`, induction → `omegaPullbackCoeff (mulByInt m) = m`. +- +-This is Silverman III.5.2 `(φ+ψ)*ω = φ*ω + ψ*ω` specialised to `φ = id`, then III.5.3's induction. ++References: Silverman, *The Arithmetic of Elliptic Curves*, III.5.2–3. + -/ + + open WeierstrassCurve + + namespace HasseWeil + +-variable {K : Type*} [Field K] [Fintype K] [DecidableEq K] ++variable {K : Type*} [Field K] [DecidableEq K] + (W : WeierstrassCurve K) [W.toAffine.IsElliptic] + + local notation "KE" => W.toAffine.FunctionField + local notation "R" => W.toAffine.CoordinateRing + +-/-- **RB-ADD** (Silverman III.5.2, `φ = id` case): for the genuine sum isogeny `σ = id ⊞ α` ++/-- Silverman III.5.2 for addition with the identity: for the genuine sum isogeny `σ = id ⊞ α` + (built via `addIsog` on the pair `(id, α)`), the omega-pullback coefficient is `1 + a_α`. + + Proof: by uniqueness in the 1-dimensional Kähler module. `omegaPullbackCoeff_spec` gives + `a_σ • ω = (α*u of σ)⁻¹ • D(σ*x)`. Now `σ*x = addPullback_x α` and `α*u of σ = u₃ := +-2·addPullback_y + a₁·addPullback_x + a₃`, while RB-ω4 says `D(addPullback_x α) = u₃ · (1+a_α) · ω`. ++2·addPullback_y + a₁·addPullback_x + a₃`, while the addition identity says `D(addPullback_x α) = u₃ · (1+a_α) · ω`. + So `a_σ • ω = u₃⁻¹ · u₃ · (1+a_α) · ω = (1+a_α) · ω`, hence `a_σ = 1 + a_α`. -/ + theorem omegaPullbackCoeff_addIsog_id + (α : Isogeny W.toAffine W.toAffine) +@@ -115,21 +115,16 @@ theorem omegaPullbackCoeff_addIsog_pair + kaehler_D_addPullback_x_pair_eq_smul_omega W α₁ α₂ h_ne, smul_smul, + inv_mul_cancel₀ hu3_ne, one_smul] + +--- **RB-ID core** (`addPullback_xy_mulByInt_eq_succ`, the Silverman III.5.3 addition recurrence +--- `P ⊞ [m]P = [m+1]P`) lives in `HasseWeil.EC.MulByIntAddRecurrence` (minimal imports, to skirt the +--- `(W_KE W).toAffine.Point` ℤ-smul instance diamond — see `SK-ROUTEB-SMUL-DIAMOND` there). It is +--- imported above and consumed by RB-IND below. +- +-/-- **RB chord step** (Silverman III.5.3 recurrence at the differential level): for `k ≥ 2`, ++/-- The Silverman III.5.3 recurrence at the differential level: for `k ≥ 2`, + `a_{[k+1]} = 1 + a_{[k]}`. + + Proof. By uniqueness in the 1-dimensional Kähler module. `omegaPullbackCoeff_spec` gives + `a_{[k+1]} • ω = (α*u of [k+1])⁻¹ • D([k+1]*x)`. Now: +-* `[k+1]*x = mulByInt_x (k+1) = addPullback_x [k]` (RB-ID), so `D([k+1]*x) = D(addPullback_x [k])`. +-* RB-ω4 (α = `[k]`, with `x_gen ≠ [k]*x` since `k ≥ 2`): ++* `[k+1]*x = mulByInt_x (k+1) = addPullback_x [k]` (the multiplication-coordinate recurrence), so `D([k+1]*x) = D(addPullback_x [k])`. ++* The differential addition identity (α = `[k]`, with `x_gen ≠ [k]*x` since `k ≥ 2`): + `D(addPullback_x [k]) = u₃ • ((1 + a_{[k]}) • ω)` + where `u₃ = 2·addPullback_y [k] + a₁·addPullback_x [k] + a₃`. +-* RB-ID rewrites `addPullback_x/y [k] = mulByInt_x/y (k+1)`, so `u₃ = α*u of [k+1]` (definitionally, ++* The coordinate recurrence rewrites `addPullback_x/y [k] = mulByInt_x/y (k+1)`, so `u₃ = α*u of [k+1]` (definitionally, + via `alpha_star_u_mulByInt`). + + Hence `a_{[k+1]} • ω = u₃⁻¹ • (u₃ • (1 + a_{[k]}) • ω) = (1 + a_{[k]}) • ω`. -/ +@@ -142,15 +137,15 @@ theorem omegaPullbackCoeff_mulByInt_succ (k : ℤ) (hk2 : 2 ≤ k) : + have hx_ne : x_gen W ≠ mulByInt_x W k := by + rw [← mulByInt_x_one W] + exact mulByInt_x_ne_mulByInt_x W 1 k one_ne_zero hk0 (by omega) (by omega) +- -- `[k]*x = mulByInt_x k`, so RB-ω4's hypothesis `x_gen ≠ [k]*x` is `hx_ne`. ++ -- `[k]*x = mulByInt_x k`, so the differential addition hypothesis `x_gen ≠ [k]*x` is `hx_ne`. + have hkx : (mulByInt W.toAffine k).pullback (x_gen W) = mulByInt_x W k := + mulByInt_pullback_x W k hk0 + have hx_ne_pb : x_gen W ≠ (mulByInt W.toAffine k).pullback (x_gen W) := by + rw [hkx]; exact hx_ne +- -- RB-ID: `addPullback_x/y [k] = mulByInt_x/y (k+1)`. ++ -- The coordinate recurrence: `addPullback_x/y [k] = mulByInt_x/y (k+1)`. + obtain ⟨hAx, hAy⟩ := addPullback_xy_mulByInt_eq_succ W k hk0 hk1 hx_ne + -- `α*u of [k+1] = u₃ := 2·addPullback_y [k] + a₁·addPullback_x [k] + a₃` +- -- (def + RB-ID + alpha_star_u_mulByInt). ++ -- (by the coordinate recurrence and alpha_star_u_mulByInt). + have hu : alpha_star_u W (mulByInt W.toAffine (k + 1)) + = 2 * addPullback_y W (mulByInt W.toAffine k) + + algebraMap K KE W.a₁ * addPullback_x W (mulByInt W.toAffine k) +@@ -159,7 +154,7 @@ theorem omegaPullbackCoeff_mulByInt_succ (k : ℤ) (hk2 : 2 ≤ k) : + have hu3_ne : 2 * addPullback_y W (mulByInt W.toAffine k) + + algebraMap K KE W.a₁ * addPullback_x W (mulByInt W.toAffine k) + algebraMap K KE W.a₃ ≠ 0 := + hu ▸ alpha_star_u_ne_zero W (mulByInt W.toAffine (k + 1)) +- -- `[k+1]*x = addPullback_x [k]` (mulByInt_pullback_x + RB-ID). ++ -- `[k+1]*x = addPullback_x [k]` (by mulByInt_pullback_x and the coordinate recurrence). + have hpx : (mulByInt W.toAffine (k + 1)).pullback + (algebraMap R KE (algebraMap (Polynomial K) R Polynomial.X)) + = addPullback_x W (mulByInt W.toAffine k) := by +@@ -169,7 +164,7 @@ theorem omegaPullbackCoeff_mulByInt_succ (k : ℤ) (hk2 : 2 ≤ k) : + kaehler_D_addPullback_x_eq_one_add_smul_omega W (mulByInt W.toAffine k) hx_ne_pb, smul_smul, + inv_mul_cancel₀ hu3_ne, one_smul] + +-/-- `a_{[n]} = n` for all `n ≥ 2`, by `Int.leInduction` from the axiom-clean base case `n = 2` ++/-- `a_{[n]} = n` for all `n ≥ 2`, by `Int.leInduction` from the base case `n = 2` + (`omegaPullbackCoeff_mulByInt_two`), with step `k ≥ 2 ⟹ k+1` via the chord step + `omegaPullbackCoeff_mulByInt_succ`. -/ + theorem omegaPullbackCoeff_mulByInt_ge_two (n : ℤ) (hn : 2 ≤ n) : +@@ -180,7 +175,7 @@ theorem omegaPullbackCoeff_mulByInt_ge_two (n : ℤ) (hn : 2 ≤ n) : + rw [omegaPullbackCoeff_mulByInt_succ W k hk2, ih, Int.cast_add, Int.cast_one, map_add, + map_one, add_comm] + +-/-- **RB-IND** (Silverman III.5.3, positive case): `a_{[n]} = n` for all `n ≥ 1`. Combines the ++/-- Silverman III.5.3 for positive integers: `a_{[n]} = n` for all `n ≥ 1`. Combines the + `n = 1` case (`[1] = id`, `a_id = 1`) with `omegaPullbackCoeff_mulByInt_ge_two`. -/ + theorem omegaPullbackCoeff_mulByInt_pos (n : ℤ) (hn : 1 ≤ n) : + omegaPullbackCoeff W (mulByInt W.toAffine n) = algebraMap K KE n := by +@@ -188,8 +183,7 @@ theorem omegaPullbackCoeff_mulByInt_pos (n : ℤ) (hn : 1 ≤ n) : + · subst h1; rw [mulByInt_one_eq_id, omegaPullbackCoeff_id, Int.cast_one, map_one] + · exact omegaPullbackCoeff_mulByInt_ge_two W n (by omega) + +-omit [Fintype K] in +-/-- **RB negation**: `a_{[-n]} = -a_{[n]}` for `n ≠ 0`. The `[-n]`-pullback of `x_gen` ++/-- Negation of the multiplication differential coefficient: `a_{[-n]} = -a_{[n]}` for `n ≠ 0`. The `[-n]`-pullback of `x_gen` + agrees with the `[n]`-pullback (`mulByInt_x_neg`), while `α*u` flips sign + (`negY`-symmetry of `mulByInt_y`), so the spec equation flips sign and uniqueness + gives the result. -/ +@@ -219,9 +213,9 @@ theorem omegaPullbackCoeff_mulByInt_neg (n : ℤ) (hn : n ≠ 0) : + congr 1 + exact (omegaPullbackCoeff_spec W (mulByInt W.toAffine n)).symm + +-/-- **RB-IND (Silverman III.5.3)**, integer form: `a_{[n]} = n` for all `n ≠ 0`, by the chord-step +-induction (positive `n`) and the negation symmetry (negative `n`). Reroutes +-`omegaPullbackCoeff_mulByInt` off the (still partial) EDS Wronskian. -/ ++/-- Silverman III.5.3 for all nonzero integers: `a_{[n]} = n`. ++Positive integers follow by the chord recurrence and negative integers by ++negation symmetry. -/ + theorem omegaPullbackCoeff_mulByInt_routeB (n : ℤ) (hn : n ≠ 0) : + omegaPullbackCoeff W (mulByInt W.toAffine n) = algebraMap K KE n := by + rcases lt_or_gt_of_ne hn with hneg | hpos +@@ -233,21 +227,17 @@ theorem omegaPullbackCoeff_mulByInt_routeB (n : ℤ) (hn : n ≠ 0) : + · -- n > 0: direct from the positive induction. + exact omegaPullbackCoeff_mulByInt_pos W n (by omega) + +-/-- **Pillar B endpoint (wronskian-free, formal-group-free)**: in characteristic `p`, `[p]*ω = 0`, +-i.e. `a_{[p]} = (p : K) = 0`. The axiom-clean Route B replacement for the formal-group +-`omegaPullbackCoeff_mulByInt_p_eq_zero_via_formalGroup` and the wronskian +-`omegaPullbackCoeff_mulByInt`. Direct from `omegaPullbackCoeff_mulByInt_routeB` +-+ `CharP.cast_eq_zero`. -/ ++/-- In characteristic `p`, multiplication by `p` has zero differential ++coefficient, since its coefficient is the image of `p` in the base field. -/ + theorem omegaPullbackCoeff_mulByInt_p_eq_zero_routeB (p : ℕ) [CharP K p] (hp : p ≠ 0) : + omegaPullbackCoeff W (mulByInt W.toAffine (p : ℤ)) = 0 := by + rw [omegaPullbackCoeff_mulByInt_routeB W (p : ℤ) (by exact_mod_cast hp), + show ((p : ℤ) : K) = 0 from by rw [Int.cast_natCast]; exact CharP.cast_eq_zero K p, map_zero] + +-/-- **Pillar B endpoint at `q = #K`** (`[q]*ω = 0`): over the finite field `K`, the ω-pullback +-coefficient of `[q]` vanishes, since `a_{[q]} = (q : K) = 0` (`#K = char^n`). Axiom-clean via +-`omegaPullbackCoeff_mulByInt_routeB`; this is the `q`-th-root input to the Verschiebung +-factorisation `[q] = V ∘ Frob`. -/ +-theorem omegaPullbackCoeff_mulByInt_card_eq_zero : ++/-- Over a finite field, multiplication by its cardinality has zero ++differential coefficient. This is the differential input to the Verschiebung ++factorization `[q] = V ∘ Frob`. -/ ++theorem omegaPullbackCoeff_mulByInt_card_eq_zero [Fintype K] : + omegaPullbackCoeff W (mulByInt W.toAffine (Fintype.card K : ℤ)) = 0 := by + rw [omegaPullbackCoeff_mulByInt_routeB W (Fintype.card K : ℤ) + (by exact_mod_cast Fintype.card_ne_zero), +diff --git a/projects/HasseWeil/HasseWeil/Foundation/OmegaPullbackCoeff.lean b/projects/HasseWeil/HasseWeil/Foundation/OmegaPullbackCoeff.lean +index 61150a90c..a51582216 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/OmegaPullbackCoeff.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/OmegaPullbackCoeff.lean +@@ -24,7 +24,7 @@ With `a_α ∈ F`: + - Additivity: `a_{α+β} = a_α + a_β` (from Silverman III.5.2) + - `a_{[n]} = n` (from Silverman III.5.3) + +-## Implementation ++## Kähler differential construction + + The pullback `α*(ω)` in the Kähler differential module Ω[K(E)/F] is computed as: + `α*(ω) = D(α*(x)) · α*(u)⁻¹` +@@ -98,11 +98,9 @@ theorem omegaPullbackCoeff_spec (α : Isogeny W.toAffine W.toAffine) : + (α.pullback + (algebraMap R KE (algebraMap (Polynomial F) R Polynomial.X))))).choose_spec + +--- Chain rule for `omegaPullbackCoeff`. The chain rule `a_{α∘β} = a_α · a_β` holds when `a_α` +--- is in the base field `F` (so that `β*(a_α) = a_α`); for the Silverman convention `a_α ∈ F` +--- always holds (Silverman III.5.5). It is proved abstractly as `omegaPullbackCoeff_comp_of_base` +--- in `HasseWeil/InvariantDifferentialPullback.lean`; not restated here to avoid a naming clash. +--- For `α = [n]` we get `a_{[n]} = n ∈ F`, which is what the Hasse bound needs. ++-- The chain rule `a_{α∘β} = a_α · a_β` holds when `a_α` lies in the base ++-- field, so that the pullback by `β` fixes it. For multiplication by `n`, the ++-- differential coefficient is `n`, as in Silverman III.5.3. + + /-- Uniqueness of the omega-based pullback coefficient: in the 1-dimensional Kähler module, + if `c₁ • ω = c₂ • ω` then `c₁ = c₂` (since `ω ≠ 0` and `KE` is a field). -/ +@@ -124,7 +122,7 @@ theorem mulByInt_pullback_x (n : ℤ) (hn : n ≠ 0) : + (mulByInt W.toAffine n).pullback + (algebraMap R KE (algebraMap (Polynomial F) R Polynomial.X)) = + mulByInt_x W n := by +- have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dif_neg hn ++ have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dite_eq_right hn + rw [hpb] + change mulByInt_pullbackRingHom W n hn + (algebraMap R KE (algebraMap (Polynomial F) R Polynomial.X)) = _ +@@ -140,7 +138,7 @@ theorem mulByInt_pullback_y (n : ℤ) (hn : n ≠ 0) : + (mulByInt W.toAffine n).pullback + (algebraMap R KE (AdjoinRoot.root W.toAffine.polynomial)) = + mulByInt_y W n := by +- have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dif_neg hn ++ have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dite_eq_right hn + rw [hpb] + change mulByInt_pullbackRingHom W n hn + (algebraMap R KE (AdjoinRoot.root W.toAffine.polynomial)) = _ +@@ -331,11 +329,6 @@ private lemma wronskian_X_mul_sub (f q : Polynomial F) : + simp [Polynomial.derivative_sub, Polynomial.derivative_mul, Polynomial.derivative_X] + ring + +--- The auxiliary ring identity `wronskian_aux_three` has been moved to +--- `HasseWeil/WronskianAux.lean` (together with `wronskian_aux_four`) to isolate +--- its expensive elaboration. It is reused unchanged from there. +- +--- Case m=3: proved via `wronskian_aux_three` from `HasseWeil/WronskianAux.lean`. + -- The key insight: both LHS and RHS factor through Ψ₃, and after cancellation + -- the identity reduces to wronskian_aux_three (a tractable ring computation). + omit [DecidableEq F] [W.toAffine.IsElliptic] in +@@ -371,10 +364,7 @@ private lemma wronskian_Φ_ΨSq_three : + + -- Silverman III.3.7 auxiliary: verified ring identity for m=4. + -- Only expands to b₂, b₄, b₆, b₈ (not a₁..a₆) keeping the ring computation tractable. +--- The auxiliary ring identity `wronskian_aux_four` has been moved to +--- `HasseWeil/WronskianAux.lean` to isolate its ~57 GB ring elaboration. + +--- Case m=4: proved via `wronskian_aux_four` from `HasseWeil/WronskianAux.lean`. + -- After applying wronskian_X_mul_sub to restructure the Wronskian, + -- and expanding preΨ(8) via preΨ_even(4)/preΨ_odd(2)/preΨ_even(3), + -- the goal matches wronskian_aux_four exactly (up to 1-simplification). +@@ -420,96 +410,6 @@ private lemma wronskian_Φ_ΨSq_four : + simp only [Polynomial.C_ofNat] at haux ⊢ + linear_combination haux + +-omit [DecidableEq F] [W.toAffine.IsElliptic] in +-/-- The polynomial Wronskian identity for non-negative integers, by **strong induction**. +- +- Base cases `m = 0,1,2` use direct computation; `m = 3,4` use the factored ring identities +- (`wronskian_aux_three`, `wronskian_aux_four`). For `m = n+5` the proof is by strong induction: +- the induction hypothesis `ih` provides the identity at **all** smaller indices `k < m`. +- +- ## Status of the `m ≥ 5` inductive step +- +- The inductive step is the elliptic-divisibility-sequence (EDS) Wronskian recursion. Writing +- `p k := W.preΨ k` and `s := W.Ψ₂Sq`, and `W(k) := Φ_k' ΨSq_k − Φ_k ΨSq_k'`, the target is +- `W(k) = k · p(2k)`. The two halving recursions that drive the induction are (both verified by +- computer algebra against the actual division polynomials): +- +- * **Even step.** `W(2m) = 2 · complEDS₂(2m) · W(m)`, where +- `complEDS₂(2m) = p(2m-1)² p(2m+2) − p(2m-2) p(2m+1)²`. Combined with the induction hypothesis +- `W(m) = m · p(2m)` and `p(4m) = complEDS₂(2m) · p(2m)` (mathlib's `preNormEDS_mul_complEDS₂`) +- this collapses to `W(2m) = 2m · p(4m)`, i.e. the claim at `2m`. Both `m` and `m±1 < 2m`. +- * **Odd step.** The analogous reduction of `W(2m+1)` to `W(m)` and `W(m+1)`. +- +- The irreducible algebraic content of *each* halving step is the **EDS addition formula** +- (Ward's relation), verified by CAS in the exact form +- `p(i+j) p(i-j) = Aᵢ · p(i+1) p(i-1) p(j)² − Aⱼ · p(j+1) p(j-1) p(i)²`, +- with `Aᵢ = s²` iff (`i` odd and `j` even) else `1`, and `Aⱼ = s²` iff (`i` even and `j` odd) +- else `1`. Its `j = 2` specialisation is the Somos‑4 relation +- `p(m+2) p(m-2) = (Even m ? 1 : s²) · p(m+1) p(m-1) − Ψ₃ · p(m)²`. +- +- The even step `W(2m) = 2·complEDS₂(2m)·W(m)` is **not** a free-ring identity in the consecutive +- `preΨ` values alone — it is provably *false* without further relations, and is *not* closed by +- Somos‑4 together with the Weierstrass `b`-relation either: it genuinely requires the addition +- formula at general index `j`. Mathlib does not currently provide the EDS addition formula +- (only the duplication recursions `preΨ_even`/`preΨ_odd`), so closing this step needs that +- formula to be developed first. The `WronskianAux` `m = 3,4` proofs avoid it only because, at +- fixed small index, the difference factors through the single `b`-relation with an explicitly +- computed multiplier; +- that multiplier grows with the index, so the same device does not generalise. +- +- An **axiom-clean** alternative is available downstream of this file via the function field: +- the field-general Route-B chord induction `omegaCoeff_mulByInt` +- (`HasseWeil/RouteBGeneral.lean`) proves the differential statement `[n]*ω = n·ω` +- (Silverman III.5.3) over any field, with no EDS Wronskian; it cannot be imported here (it +- depends transitively on this file), but every former geometric consumer of the Wronskian +- (`Hasse/Separability.lean`, `PullbackCoeff.lean`) now routes through it, so this `sorry` is +- **consumer-free**. The polynomial identity itself also has an axiom-clean downstream proof: +- `wronskian_Φ_ΨSq_general` (`EC/WronskianGeneral.lean`). -/ +-private lemma wronskian_Φ_ΨSq_nat (m : ℕ) : +- Polynomial.derivative (W.Φ (m : ℤ)) * W.ΨSq (m : ℤ) - +- W.Φ (m : ℤ) * Polynomial.derivative (W.ΨSq (m : ℤ)) = +- Polynomial.C ((m : ℤ) : F) * W.preΨ (2 * (m : ℤ)) := by +- induction m using Nat.strong_induction_on with +- | _ m ih => +- -- `ih : ∀ k < m, (the identity at k)` — the strong induction hypothesis. +- match m, ih with +- | 0, _ => exact wronskian_Φ_ΨSq_zero W +- | 1, _ => exact_mod_cast wronskian_Φ_ΨSq_one W +- | 2, _ => exact_mod_cast wronskian_Φ_ΨSq_two W +- | 3, _ => exact_mod_cast wronskian_Φ_ΨSq_three W +- | 4, _ => exact_mod_cast wronskian_Φ_ΨSq_four W +- | (n + 5), ih => +- -- General case `m = n+5 ≥ 5`. The induction hypothesis `ih k hk` gives the identity at +- -- every `k < n+5`, in particular at the halves `⌊(n+5)/2⌋`, `⌈(n+5)/2⌉` needed by the EDS +- -- Wronskian recursion (even/odd halving step). The single missing ingredient is the EDS +- -- addition formula (see the docstring above); supplying it closes this step via +- -- `linear_combination` of the induction hypothesis at the halves with the +- -- addition-formula / Somos‑4 instances. +- sorry +- +-omit [DecidableEq F] [W.toAffine.IsElliptic] in +-/-- The division polynomial Wronskian identity: +- `Φ_n' · ΨSq_n - Φ_n · ΨSq_n' = n · preΨ(2n)` as polynomials in `F[X]`. +- +- Reference: Silverman Exercise III.3.7. +- +- Proved by reducing to the natural number case via `wronskian_Φ_ΨSq_neg_of` +- (negation symmetry) and `wronskian_Φ_ΨSq_nat` (positive case by induction). -/ +-theorem wronskian_Φ_ΨSq (n : ℤ) : +- Polynomial.derivative (W.Φ n) * W.ΨSq n - W.Φ n * Polynomial.derivative (W.ΨSq n) = +- Polynomial.C (n : F) * W.preΨ (2 * n) := by +- rcases lt_or_ge n 0 with hneg | hpos +- · -- n < 0: use negation symmetry on the positive case +- have hm : (0 : ℤ) ≤ -n := by omega +- obtain ⟨m, hm_eq⟩ := Int.eq_ofNat_of_zero_le hm +- have hn_eq : n = -(m : ℤ) := by omega +- rw [hn_eq] +- exact wronskian_Φ_ΨSq_neg_of W (wronskian_Φ_ΨSq_nat W m) +- · -- n ≥ 0: directly from wronskian_Φ_ΨSq_nat +- obtain ⟨m, hm_eq⟩ := Int.eq_ofNat_of_zero_le hpos +- subst hm_eq +- exact wronskian_Φ_ΨSq_nat W m +- + omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `Φ_ff` and `ΨSq_ff` factor through `algebraMap (Polynomial F) KE`. -/ + private lemma Φ_ff_eq_algebraMap_poly (n : ℤ) : +@@ -527,7 +427,7 @@ private lemma ΨSq_ff_eq_algebraMap_poly (n : ℤ) : + This is the polynomial shadow of the third division polynomial `ω_n` and follows from the + geometric facts `preΨ(2n)·u = ψ_n·ψc_n` (i.e. `ψ_{2n} = ψ_n·ψc_n`, `ψc_spec_ff`) and + `α*(u) = ψc_n/ψ_n³` (`ω_spec_ff`), together with `ΨSq_ff = ψ_n²` (`ψ_ff_sq_eq`). It does **not** +- use the division-polynomial Wronskian, so it is axiom-clean and can be combined with the ++ use the division-polynomial Wronskian, and can be combined with the + chord-recursion `omegaPullbackCoeff_mulByInt_routeB` downstream to recover the polynomial + Wronskian. -/ + theorem preΨ_two_mul_u_eq_ΨSq_sq_mul_alpha_star_u (n : ℤ) (hn : n ≠ 0) : +@@ -543,7 +443,7 @@ theorem preΨ_two_mul_u_eq_ΨSq_sq_mul_alpha_star_u (n : ℤ) (hn : n ≠ 0) : + have h_preΨ_u : algebraMap (Polynomial F) KE (W.preΨ (2 * n)) * u_gen W = ψn * ψcn := by + rw [hψn_def, hψcn_def, ψc_spec_ff W n, Affine.CoordinateRing.mk_ψ (W := W.toAffine) (2 * n)] + have hΨ_eq : W.Ψ (2 * n) = Polynomial.C (W.preΨ (2 * n)) * W.ψ₂ := by +- rw [WeierstrassCurve.Ψ, if_pos (even_two_mul n)] ++ rw [WeierstrassCurve.Ψ, ite_eq_left (even_two_mul n)] + rw [hΨ_eq, map_mul, map_mul, + show W.ψ₂ = W.toAffine.polynomialY from rfl, mk_polynomialY_eq_u_gen W] + rfl +@@ -578,8 +478,7 @@ theorem preΨ_two_mul_u_eq_ΨSq_sq_mul_alpha_star_u (n : ℤ) (hn : n ≠ 0) : + - mk(polynomialY) = u_gen in K(E) + + Taking `hpoly` as a hypothesis lets specific values of `n` (e.g. `n = 2`) be +- discharged from the axiom-clean per-value polynomial lemmas +- (`wronskian_Φ_ΨSq_two`, …), independently of the general `wronskian_Φ_ΨSq`. ++ discharged from the per-value polynomial identities such as `wronskian_Φ_ΨSq_two`. + Reference: Silverman Exercise III.3.7, III.5.3 -/ + theorem divPoly_wronskian_identity_of_poly (n : ℤ) (hn : n ≠ 0) + (hpoly : Polynomial.derivative (W.Φ n) * W.ΨSq n - +@@ -618,7 +517,7 @@ theorem divPoly_wronskian_identity_of_poly (n : ℤ) (hn : n ≠ 0) + have h_preΨ_u : algebraMap (Polynomial F) KE (W.preΨ (2 * n)) * u_gen W = ψn * ψcn := by + rw [hψn_def, hψcn_def, ψc_spec_ff W n, Affine.CoordinateRing.mk_ψ (W := W.toAffine) (2 * n)] + have hΨ_eq : W.Ψ (2 * n) = Polynomial.C (W.preΨ (2 * n)) * W.ψ₂ := by +- rw [WeierstrassCurve.Ψ, if_pos (even_two_mul n)] ++ rw [WeierstrassCurve.Ψ, ite_eq_left (even_two_mul n)] + rw [hΨ_eq, map_mul, map_mul, + show W.ψ₂ = W.toAffine.polynomialY from rfl, mk_polynomialY_eq_u_gen W] + rfl +@@ -646,20 +545,6 @@ theorem divPoly_wronskian_identity_of_poly (n : ℤ) (hn : n ≠ 0) + h_preΨ_u, h_alpha_u, show ΨSq_ff W n = ψn ^ 2 from (ψ_ff_sq_eq W n).symm] + field_simp + +-/-- The division polynomial Wronskian identity in K(E) (general `n`), via the +- general polynomial-level identity `wronskian_Φ_ΨSq`. +- Reference: Silverman Exercise III.3.7, III.5.3 -/ +-theorem divPoly_wronskian_identity (n : ℤ) (hn : n ≠ 0) : +- (algebraMap (Polynomial F) KE (Polynomial.derivative (W.Φ n)) * +- ΨSq_ff W n - +- Φ_ff W n * +- algebraMap (Polynomial F) KE (Polynomial.derivative (W.ΨSq n))) * +- u_gen W = +- algebraMap F KE n * +- ΨSq_ff W n ^ 2 * +- alpha_star_u W (mulByInt W.toAffine n) := +- divPoly_wronskian_identity_of_poly W n hn (wronskian_Φ_ΨSq (W := W) n) +- + -- Chain rule for `D` on polynomial images in K(E), using `Derivation.comp_aeval_eq`: for + -- `p : F[X]` and `a ∈ KE`, `D(aeval a p) = aeval a (derivative p) • D(a)`. + +@@ -695,8 +580,7 @@ theorem D_poly_eval (p : Polynomial F) : + via the quotient rule and chain rule for the universal derivation. + + Taking `hpoly` as a hypothesis lets specific values of `n` be discharged from +- the axiom-clean per-value polynomial lemmas (`wronskian_Φ_ΨSq_two`, …), +- independently of the general `wronskian_Φ_ΨSq`. -/ ++ the per-value polynomial identities such as `wronskian_Φ_ΨSq_two`. -/ + theorem omegaPullbackCoeff_mulByInt_of_poly (n : ℤ) (hn : n ≠ 0) + (hpoly : Polynomial.derivative (W.Φ n) * W.ΨSq n - + W.Φ n * Polynomial.derivative (W.ΨSq n) = +@@ -768,7 +652,7 @@ theorem omegaPullbackCoeff_mulByInt_of_poly (n : ℤ) (hn : n ≠ 0) + + This is the converse of `omegaPullbackCoeff_mulByInt_of_poly`'s final algebra: the spec + `a • ω = α*(u)⁻¹ • D(α*x)` together with `a = n` and the chain/quotient rule for `D` gives the +- scalar identity `(Φ' Ψ − Φ Ψ') · u = n · Ψ² · α*u` in K(E). Fed the axiom-clean ++ scalar identity `(Φ' Ψ − Φ Ψ') · u = n · Ψ² · α*u` in K(E). Given the + `omegaPullbackCoeff_mulByInt_routeB` (downstream), it recovers the K(E) Wronskian — and then, + via the bridge `preΨ_two_mul_u_eq_ΨSq_sq_mul_alpha_star_u` and injectivity of + `algebraMap (Polynomial F) KE`, the **polynomial** Wronskian — without the EDS addition +@@ -843,30 +727,10 @@ theorem divPoly_wronskian_identity_of_omega (n : ℤ) (hn : n ≠ 0) + -- Goal is already in the `set` names `Φ, Ψ, Φ', Ψ', u, αu`; `hfin` matches up to symmetry. + linear_combination -hfin + +-/-- For [n], the omega-based pullback coefficient is n (general `n`, via the +- general polynomial-level Wronskian identity `wronskian_Φ_ΨSq`). +- Silverman III.5.3, IV.2.3. +- +- NOTE: this routing through `wronskian_Φ_ΨSq` inherits its `sorryAx` taint +- (the `m ≥ 5` branch of `wronskian_Φ_ΨSq_nat`). The **axiom-clean, field-general** +- proof of the same statement, via the Route-B chord recurrence (Silverman +- III.5.2/3 at the differential level), is `HasseWeil.omegaCoeff_mulByInt` in +- `HasseWeil/RouteBGeneral.lean`. That module cannot be imported here (its chord +- step lives downstream of this file), so the replacement cannot be applied in +- place — instead all former consumers (`Hasse/Separability.lean`, +- `PullbackCoeff.lean`) now route through `omegaCoeff_mulByInt`, leaving this +- theorem (and its Wronskian `sorry`) **consumer-free**. -/ +-theorem omegaPullbackCoeff_mulByInt (n : ℤ) (hn : n ≠ 0) : +- omegaPullbackCoeff W (mulByInt W.toAffine n) = algebraMap F KE n := +- omegaPullbackCoeff_mulByInt_of_poly W n hn (wronskian_Φ_ΨSq (W := W) n) +- +-/-- **Axiom-clean base case `[2]`**: `omegaPullbackCoeff W (mulByInt 2) = 2`. +- +- Uses the per-value polynomial Wronskian lemma `wronskian_Φ_ΨSq_two` (a direct +- `ring` computation, axiom-clean) through `omegaPullbackCoeff_mulByInt_of_poly`, +- so it does NOT depend on the general `wronskian_Φ_ΨSq` (whose `m ≥ 5` branch +- is unproved). Seeds the Route-B chord induction (`m ≥ 3` follows from the +- chord step `omegaPullbackCoeff_mulByInt_succ`). -/ ++/-- The differential coefficient of multiplication by two is two. ++ ++ The per-value polynomial identity `wronskian_Φ_ΨSq_two` gives the base case ++ for the differential chord recurrence. -/ + theorem omegaPullbackCoeff_mulByInt_two : + omegaPullbackCoeff W (mulByInt W.toAffine 2) = algebraMap F KE (2 : ℤ) := + omegaPullbackCoeff_mulByInt_of_poly W 2 (by norm_num) +diff --git a/projects/HasseWeil/HasseWeil/Foundation/OrdAtInftyBridge.lean b/projects/HasseWeil/HasseWeil/Foundation/OrdAtInftyBridge.lean +index 78be88908..b82e10035 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/OrdAtInftyBridge.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/OrdAtInftyBridge.lean +@@ -8,28 +8,13 @@ import HasseWeil.Foundation.OmegaPullbackCoeff + import HasseWeil.Foundation.Curves.Valuation.Infinity + + /-! +-# Bridge from `W.toAffine` to `SmoothPlaneCurve` for `ordAtInfty` ++# Orders at infinity of generic Weierstrass coordinates + +-This file provides the minimal bridge needed to apply worker-I's +-`ordAtInfty` infrastructure (in `HasseWeil/Curves/Infinity.lean`) to the +-generic-point framework used by `MulByIntPullback.lean` and +-`AdditionPullback.lean`. +- +-Concretely: given `W : WeierstrassCurve F` with `W.toAffine.IsElliptic`, +-we wrap `W.toAffine` as a `SmoothPlaneCurve F` and re-export the +-`ordAtInfty` results for `x_gen W` and `y_gen W` (and the +-basefield-algebraMap) in a directly usable form. +- +-The downstream consumer is the witness-parametric pole argument +-`addPullback_x_ne_const_of_pole` (`AdditionPullback.lean`), whose pole +-witnesses are supplied per-isogeny (e.g. in `AdditionPullback/Frobenius.lean`). +- +-## Main results +- +-* `W_smooth W : SmoothPlaneCurve F` — the bridge wrapper. +-* `ordAtInfty_x_gen` — `ord_∞(x_gen) = -2`. +-* `ordAtInfty_y_gen` — `ord_∞(y_gen) = -3`. +-* `ordAtInfty_algebraMap_F_nonzero` — constants from `F` have `ord_∞ = 0`. ++For an elliptic Weierstrass curve `W`, the generic coordinates have orders ++`ord_∞(x_gen W) = -2` and `ord_∞(y_gen W) = -3`. Nonzero base-field constants ++have order zero. Scalar-tower identities relate the division polynomials in ++the coordinate ring and function field, giving the pole orders of the ++multiplication-by-integer pullbacks, including the inseparable case. + + ## References + +@@ -45,19 +30,21 @@ variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] + + local notation "KE" => W.toAffine.FunctionField + +-/-- Wrap `W.toAffine` as a `SmoothPlaneCurve F` so that worker-I's +-`ordAtInfty` infrastructure applies. -/ ++/-- The smooth plane curve associated to the affine Weierstrass equation. -/ + noncomputable def W_smooth : SmoothPlaneCurve F := + ⟨W.toAffine⟩ + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- The affine curve underlying the `SmoothPlaneCurve` wrapper is `W`. -/ + @[simp] theorem W_smooth_toAffine : (W_smooth W).toAffine = W.toAffine := rfl + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- The function field of the SmoothPlaneCurve wrapper equals `KE` + definitionally (both are `W.toAffine.FunctionField`). -/ + @[simp] theorem W_smooth_functionField : + (W_smooth W).FunctionField = KE := rfl + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- The `coordX` of the wrapper matches our `x_gen W` at the function-field + level. Both are `algebraMap (Polynomial F) KE Polynomial.X`. -/ + theorem coordX_W_smooth_eq_x_gen : (W_smooth W).coordX = x_gen W := by +@@ -67,12 +54,14 @@ theorem coordX_W_smooth_eq_x_gen : (W_smooth W).coordX = x_gen W := by + rw [← IsScalarTower.algebraMap_apply (Polynomial F) W.toAffine.CoordinateRing KE] + rfl + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ord_∞(x_gen W) = -2` — Silverman II.1 / IV.1 for the generic x. -/ + theorem ordAtInfty_x_gen : + (W_smooth W).ordAtInfty (x_gen W) = ((-2 : ℤ) : WithTop ℤ) := by + rw [← coordX_W_smooth_eq_x_gen] + exact (W_smooth W).ordAtInfty_coordX + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- The `coordY` of the wrapper matches our `y_gen W` at the function-field + level. Both are the image of `AdjoinRoot.root W.polynomial` under the + algebraMap to `KE`. The `basis_one` lemma identifies +@@ -82,12 +71,14 @@ theorem coordY_W_smooth_eq_y_gen : (W_smooth W).coordY = y_gen W := by + rw [Affine.CoordinateRing.basis_one] + rfl + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ord_∞(y_gen W) = -3` — Silverman II.1 / IV.1 for the generic y. -/ + theorem ordAtInfty_y_gen : + (W_smooth W).ordAtInfty (y_gen W) = ((-3 : ℤ) : WithTop ℤ) := by + rw [← coordY_W_smooth_eq_y_gen] + exact (W_smooth W).ordAtInfty_coordY + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ord_∞(algebraMap F KE c) = 0` for nonzero `c : F`. Direct corollary of + `SmoothPlaneCurve.ordAtInfty_algebraMap_F_nonzero` applied to `W_smooth W`. -/ + theorem ordAtInfty_algebraMap_F_nonzero {c : F} (hc : c ≠ 0) : +@@ -96,9 +87,7 @@ theorem ordAtInfty_algebraMap_F_nonzero {c : F} (hc : c ≠ 0) : + + /-! ### Powers of generators -/ + +-/- `x_gen_ne_zero` / `y_gen_ne_zero` HOISTED to `Foundation/MulByIntPullback.lean` next to +-the defs (#7621) — they were declared BOTH here and in `LocalExpansion.lean` (same names, +-same namespace), so no module could import both files without an environment clash. -/ ++ + + omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `y_gen W` and `(W_smooth W).coordYInFunctionField` are the same element of +@@ -110,12 +99,13 @@ theorem y_gen_eq_coordYInFunctionField : + /-- `mulByInt_y W n ≠ 0` for `n ≠ 0`: it is the image of `y_gen ≠ 0` under the + field embedding `[n]^*`. -/ + theorem mulByInt_y_ne_zero (n : ℤ) (hn : n ≠ 0) : mulByInt_y W n ≠ 0 := by +- have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dif_neg hn ++ have hpb : (mulByInt W.toAffine n).pullback = mulByInt_pullbackAlgHom W n hn := dite_eq_right hn + have h : mulByInt_pullbackAlgHom W n hn (y_gen W) = mulByInt_y W n := + hpb ▸ mulByInt_pullback_y W n hn + rw [← h] + exact (map_ne_zero (mulByInt_pullbackAlgHom W n hn)).mpr (y_gen_ne_zero W) + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ord_∞(x_gen^n) = n • (-2)`. -/ + theorem ordAtInfty_x_gen_pow (n : ℕ) : + (W_smooth W).ordAtInfty (x_gen W ^ n) = n • ((-2 : ℤ) : WithTop ℤ) := by +@@ -124,6 +114,7 @@ theorem ordAtInfty_x_gen_pow (n : ℕ) : + rw [ordAtInfty_x_gen] at h + exact h + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ord_∞(y_gen^n) = n • (-3)`. -/ + theorem ordAtInfty_y_gen_pow (n : ℕ) : + (W_smooth W).ordAtInfty (y_gen W ^ n) = n • ((-3 : ℤ) : WithTop ℤ) := by +@@ -140,6 +131,7 @@ Both `Φ_ff W n` and `ΨSq_ff W n` are defined as + This bridges to `ordAtInfty_algebraMap_polynomial_of_ne_zero` for the + ord computation. -/ + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `Φ_ff W n = algebraMap (Polynomial F) KE (W.Φ n)` via the scalar tower + `F[X] → CoordinateRing → FunctionField`. -/ + theorem Φ_ff_eq_algebraMap_polynomial (n : ℤ) : +@@ -147,6 +139,7 @@ theorem Φ_ff_eq_algebraMap_polynomial (n : ℤ) : + (IsScalarTower.algebraMap_apply + (Polynomial F) W.toAffine.CoordinateRing KE (W.Φ n)).symm + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ΨSq_ff W n = algebraMap (Polynomial F) KE (W.ΨSq n)` via the scalar tower + `F[X] → CoordinateRing → FunctionField`. -/ + theorem ΨSq_ff_eq_algebraMap_polynomial (n : ℤ) : +@@ -159,6 +152,7 @@ theorem ΨSq_ff_eq_algebraMap_polynomial (n : ℤ) : + Direct from the tower bridge + `ordAtInfty_algebraMap_polynomial_of_ne_zero` + + mathlib's `natDegree_Φ` / `natDegree_ΨSq`. -/ + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ord_∞(Φ_ff W n) = -2 · n.natAbs²`. -/ + theorem ordAtInfty_Φ_ff (n : ℤ) : + (W_smooth W).ordAtInfty (Φ_ff W n) = +@@ -171,6 +165,7 @@ theorem ordAtInfty_Φ_ff (n : ℤ) : + push_cast + ring_nf + ++omit [DecidableEq F] [W.toAffine.IsElliptic] in + /-- `ord_∞(ΨSq_ff W n) = -2 · (n.natAbs² - 1)` for `(n : F) ≠ 0`. -/ + theorem ordAtInfty_ΨSq_ff (n : ℤ) (hnF : (n : F) ≠ 0) : + (W_smooth W).ordAtInfty (ΨSq_ff W n) = +@@ -203,6 +198,7 @@ private theorem algebraMap_polynomial_KE_injective : + Affine.CoordinateRing.algebraMap_poly_injective + + omit [DecidableEq F] in ++omit [W.toAffine.IsElliptic] in + /-- `Φ_ff W n ≠ 0` for any n. Direct from `W.Φ_ne_zero` + algebraMap injectivity. -/ + theorem Φ_ff_ne_zero (n : ℤ) : Φ_ff W n ≠ 0 := by + classical +@@ -211,12 +207,14 @@ theorem Φ_ff_ne_zero (n : ℤ) : Φ_ff W n ≠ 0 := by + exact W.Φ_ne_zero n + (algebraMap_polynomial_KE_injective W (h.trans (map_zero _).symm)) + ++omit [DecidableEq F] in + /-- `mulByInt_x W n ≠ 0` for `n ≠ 0`. Direct from `Φ_ff_ne_zero` and + `ΨSq_ff_ne_zero`. -/ + theorem mulByInt_x_ne_zero (n : ℤ) (hn : n ≠ 0) : mulByInt_x W n ≠ 0 := by + simp only [mulByInt_x] + exact div_ne_zero (Φ_ff_ne_zero W n) (ΨSq_ff_ne_zero W hn) + ++omit [DecidableEq F] in + /-- `ord_∞(mulByInt_x W n) = -2` for `n ≠ 0` and `(n : F) ≠ 0`. + + Direct from `ordAtInfty_Φ_ff`, `ordAtInfty_ΨSq_ff`, and division: the +@@ -250,6 +248,7 @@ theorem ordAtInfty_mulByInt_x (n : ℤ) (hn : n ≠ 0) (hnF : (n : F) ≠ 0) : + congr 1 + ring] + ++omit [DecidableEq F] in + /-- **Unconditional pole of `mulByInt_x W n`**: `ord_∞(mulByInt_x W n) < 0` for + every `n ≠ 0`, with **no** `(n : F) ≠ 0` hypothesis. + +@@ -262,8 +261,7 @@ numerator therefore strictly out-degrees the denominator, so the ratio + `Φ_ff / ΨSq_ff` has a pole at `O`: + `ord = -2·natAbs² - (-2·natDegree (ΨSq n)) ≤ -2·natAbs² + 2(natAbs² - 1) = -2 < 0`. + +-This is exactly the brick needed for the V-side "summand reduces to `O`" facts, +-where the Frobenius factor `r·q` lands in the inseparable regime. -/ ++-/ + theorem ordAtInfty_mulByInt_x_neg (n : ℤ) (hn : n ≠ 0) : + (W_smooth W).ordAtInfty (mulByInt_x W n) < 0 := by + classical +@@ -304,6 +302,7 @@ theorem ordAtInfty_mulByInt_x_neg (n : ℤ) (hn : n ≠ 0) : + -- Transport `h_int` across the `WithTop ℤ` coercions. + exact_mod_cast h_int + ++omit [DecidableEq F] in + /-- **`ord_∞(mulByInt_x W n)` is an explicit even value `≤ -2`** for every `n ≠ 0`, with **no** + `(n : F) ≠ 0` hypothesis — so it holds in the *inseparable* case `(n : F) = 0` (e.g. `n = r` with + `p ∣ r`). +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Ramification.lean b/projects/HasseWeil/HasseWeil/Foundation/Ramification.lean +index 8a1dfaa9c..d72959809 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Ramification.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Ramification.lean +@@ -6,7 +6,9 @@ Authors: Chris Birkbeck + import Mathlib.Algebra.Polynomial.SpecificDegree + import Mathlib.FieldTheory.IntermediateField.Algebraic + import Mathlib.FieldTheory.SeparableDegree +-import Mathlib.NumberTheory.RamificationInertia.Basic ++import Mathlib.RingTheory.RamificationInertia.Basic ++import Mathlib.NumberTheory.RamificationInertia.Inertia ++import Mathlib.NumberTheory.RamificationInertia.Ramification + import Mathlib.RingTheory.Algebraic.Integral + import Mathlib.RingTheory.Artinian.Ring + import Mathlib.RingTheory.DedekindDomain.Basic +@@ -25,61 +27,6 @@ import Mathlib.RingTheory.Polynomial.GaussLemma + import HasseWeil.Isogeny.FunctionField + import HasseWeil.Foundation.Valuation + +-/-! +-# Ramification Theory for Elliptic Curve Isogenies +- +-We connect mathlib's `Ideal.ramificationIdx'` and `Ideal.inertiaDeg'` to the +-theory of elliptic curve isogenies, specializing the general framework from +-`Mathlib.NumberTheory.RamificationInertia` to coordinate ring extensions. +- +-For an isogeny `φ : E₁ → E₂`, the pullback `φ* : K(E₂) →ₐ[F] K(E₁)` restricts to +-a ring homomorphism on coordinate rings. The ramification index `e_P(φ)` at a +-prime `P` of `R₁ = K[E₁]` is `Ideal.ramificationIdx' (φ*.restrict) p P` where +-`p = φ*⁻¹(P)` is the prime of `R₂ = K[E₂]` below `P`. +- +-## Main results +- +-* `HasseWeil.coordinateRing_isDedekindDomain`: the coordinate ring of an elliptic curve +- is a Dedekind domain. Proved via `IsIntegralClosure.isDedekindDomain`: the coordinate +- ring `R = F[X][Y]/(W)` is the integral closure of the PID `F[X]` in the function field +- `K(E) = Frac(R)`, and `K(E)/F(X)` is a finite separable extension of degree 2. +-* `HasseWeil.coordinateRing_isIntegrallyClosed`: the coordinate ring is integrally closed +- in its fraction field, via `IsIntegrallyClosed.of_localization_maximal` together with +- principality of the maximal ideal at every localization. +-* `HasseWeil.coordinateRing_dimensionLEOne`: the coordinate ring has Krull dimension at +- most 1 (every nonzero prime is maximal), from the principal ideal theorem. +- +-## Strategy +- +-The `IsIntegralClosure.isDedekindDomain` route shows that `CoordinateRing` is the integral +-closure of the PID `F[X]` in the function field. The key steps: +- +-1. **`F[X]` is Dedekind**: it is a PID, hence Dedekind (automatic from mathlib). +-2. **`CoordinateRing` is integrally closed**: via `IsIntegrallyClosed.of_localization_maximal`, +- each localization at a nonzero maximal ideal `P` is a DVR (hence integrally closed). The +- DVR property follows from the TFAE for Noetherian local domains of dimension `≤ 1` with a +- principal maximal ideal; principality (`maximalIdeal_isPrincipal_of_nonsingular`) uses +- nonsingularity at each closed point (`Δ ≠ 0`), via the Jacobian identity and a case split +- on the characteristic. +-3. **`CoordinateRing` is the integral closure of `F[X]` in `FunctionField`**: elements +- integral over `F[X]` are integral over `CoordinateRing` (by `tower_top`), hence lie in +- `CoordinateRing` (by step 2 and `isIntegrallyClosed_iff`). +-4. **`FunctionField / FractionRing(F[X])` is finite** of degree 2. +-5. **`FunctionField / FractionRing(F[X])` is separable**: from `finSepDegree` dividing 2 and +- the existence of a separable root (the Weierstrass polynomial has nonzero Y-derivative). +-6. **Apply `IsIntegralClosure.isDedekindDomain`**: combines all the above. +- +-## Implementation notes +- +-This file is open infrastructure for the full isogeny ramification theory (the degree-sum +-formula `deg φ = Σ e_P · f_P`, unramifiedness of separable isogenies, and equal fibre sizes +-from translation invariance are not yet formalised here). The Dedekind-domain results it +-provides are complete and axiom-clean. +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*], II.2, III.4.10 +--/ + + open WeierstrassCurve Polynomial Ideal IntermediateField + open scoped Polynomial.Bivariate nonZeroDivisors IntermediateField +@@ -157,8 +104,8 @@ private lemma nonsingular_at_maximal (E : Affine F) [E.IsElliptic] + (P : Ideal E.CoordinateRing) (hPmax : P.IsMaximal) : + AdjoinRoot.mk E.polynomial E.polynomialX ∉ P ∨ + AdjoinRoot.mk E.polynomial E.polynomialY ∉ P := by +- letI : P.IsPrime := hPmax.isPrime +- haveI : Field (E.CoordinateRing ⧸ P) := Ideal.Quotient.field P ++ let : P.IsPrime := hPmax.isPrime ++ have : Field (E.CoordinateRing ⧸ P) := Ideal.Quotient.field P + let φ : F →+* (E.CoordinateRing ⧸ P) := + (Ideal.Quotient.mk P).comp ((AdjoinRoot.of E.polynomial).comp C) + let x₀ := (Ideal.Quotient.mk P) (AdjoinRoot.mk E.polynomial (C X)) +@@ -178,8 +125,8 @@ private lemma nonsingular_at_maximal (E : Affine F) [E.IsElliptic] + exact Ideal.Quotient.eq_zero_iff_mem.mpr hmem) + + -- The mathlib `Algebra (Polynomial F) E.CoordinateRing` instance is `noncomputable`, so the +--- synthesizer cannot derive `Module` within `maxSynthPendingDepth = 3`. These explicit `Module`, +--- `Module.Finite`, and `Module.IsTorsionFree` instances let downstream synthesis find them. ++ ++ + noncomputable instance instModulePolynomialCoordinateRing (E : Affine F) : + Module (Polynomial F) E.CoordinateRing := + @Algebra.toModule _ _ _ _ (Affine.CoordinateRing.instAlgebraPolynomial) +@@ -190,7 +137,7 @@ noncomputable instance instModuleFinitePolynomialCoordinateRing (E : Affine F) : + + noncomputable instance instIsTorsionFreePolynomialCoordinateRing (E : Affine F) [E.IsElliptic] : + Module.IsTorsionFree (Polynomial F) E.CoordinateRing := +- @AdjoinRoot.noZeroSMulDivisors_of_prime_of_degree_ne_zero (Polynomial F) _ E.polynomial _ ++ @AdjoinRoot.isTorsionFree_of_prime_of_degree_ne_zero (Polynomial F) _ E.polynomial _ + (Irreducible.prime Affine.irreducible_polynomial) + (by rw [Affine.degree_polynomial]; exact two_ne_zero) + +@@ -455,11 +402,11 @@ private lemma isReduced_quotient_of_polyY_notMem (E : Affine F) [E.IsElliptic] + (P.comap (algebraMap (Polynomial F) E.CoordinateRing))) + rw [h_rad.radical] at h; exact h ▸ Ideal.radical_isRadical _ + rw [Ideal.isRadical_iff_quotient_reduced] +- haveI : (P.comap (algebraMap (Polynomial F) E.CoordinateRing)).IsMaximal := ++ have : (P.comap (algebraMap (Polynomial F) E.CoordinateRing)).IsMaximal := + Ideal.IsPrime.isMaximal (Ideal.IsPrime.comap _) hp_ne_bot + set p := P.comap (algebraMap (Polynomial F) E.CoordinateRing) with hp_def +- letI kfield : Field (F[X] ⧸ p) := Ideal.Quotient.field p +- haveI : IsDomain (F[X] ⧸ p) := kfield.isDomain ++ let kfield : Field (F[X] ⧸ p) := Ideal.Quotient.field p ++ have : IsDomain (F[X] ⧸ p) := kfield.isDomain + set φ : F[X] →+* (F[X] ⧸ p) := Ideal.Quotient.mk p with hφ_def + set Wbar := E.polynomial.map φ with hWbar_def + have hequiv := AdjoinRoot.quotAdjoinRootEquivQuotPolynomialQuot p E.polynomial +@@ -485,11 +432,11 @@ private theorem maximalIdeal_isPrincipal_case_polyY_notMem (E : Affine F) [E.IsE + (P : Ideal E.CoordinateRing) (hPbot : P ≠ ⊥) (hPmax : P.IsMaximal) + (hY : AdjoinRoot.mk E.polynomial E.polynomialY ∉ P) : + (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by +- letI := hPmax.isPrime +- haveI := IsLocalization.isNoetherianRing P.primeCompl (Localization.AtPrime P) inferInstance ++ let := hPmax.isPrime ++ have := IsLocalization.isNoetherianRing P.primeCompl (Localization.AtPrime P) inferInstance + set g := algebraMap (Polynomial F) E.CoordinateRing with hg_def + set p := P.comap g with hp_def +- haveI : Algebra.IsIntegral (Polynomial F) E.CoordinateRing := ++ have : Algebra.IsIntegral (Polynomial F) E.CoordinateRing := + Algebra.IsIntegral.of_finite (Polynomial F) E.CoordinateRing + suffices h : Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P = + Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) (Ideal.map g p) by +@@ -502,7 +449,7 @@ private theorem maximalIdeal_isPrincipal_case_polyY_notMem (E : Affine F) [E.IsE + have hg_inj : Function.Injective g := coordinateRing_algebraMap_injective E + have hp_ne_bot : p ≠ ⊥ := by + intro hp_bot; rw [hp_def] at hp_bot +- exact hPbot (eq_bot_of_comap_eq_bot hp_bot) ++ exact hPbot (eq_bot_of_under_eq_bot (R := Polynomial F) hp_bot) + have hJ_ne_top : J ≠ ⊤ := by + intro hJ_top + have : Ideal.map f P = ⊤ := +@@ -510,16 +457,16 @@ private theorem maximalIdeal_isPrincipal_case_polyY_notMem (E : Affine F) [E.IsE + rw [Localization.AtPrime.map_eq_maximalIdeal] at this + exact (IsLocalRing.maximalIdeal.isMaximal + (R := Localization.AtPrime P)).ne_top this +- haveI : Nontrivial (Localization.AtPrime P ⧸ J) := ++ have : Nontrivial (Localization.AtPrime P ⧸ J) := + Ideal.Quotient.nontrivial_iff.mpr hJ_ne_top +- haveI : IsLocalRing (Localization.AtPrime P ⧸ J) := ++ have : IsLocalRing (Localization.AtPrime P ⧸ J) := + IsLocalRing.of_surjective' (Ideal.Quotient.mk J) Ideal.Quotient.mk_surjective +- haveI : Ring.DimensionLEOne (Localization.AtPrime P) := ++ have : Ring.DimensionLEOne (Localization.AtPrime P) := + Ring.DimensionLEOne.localization (Localization.AtPrime P) + P.primeCompl_le_nonZeroDivisors +- haveI : Ring.KrullDimLE 0 (Localization.AtPrime P ⧸ J) := ++ have : Ring.KrullDimLE 0 (Localization.AtPrime P ⧸ J) := + krullDimLE_zero_quotient_of_polyY_notMem E P J g hg_inj p hp_ne_bot hJ_def +- haveI : IsReduced (Localization.AtPrime P ⧸ J) := ++ have : IsReduced (Localization.AtPrime P ⧸ J) := + isReduced_quotient_of_polyY_notMem E P J g hg_def p hp_def hp_ne_bot hY hJ_def + exact @Ring.KrullDimLE.isField_of_isReduced _ _ ‹_› ‹_› ‹_› + · -- `J ≤ P.map f` follows from `p.map g ≤ P` (`map_comap_le`). +@@ -584,8 +531,8 @@ private lemma YminusAlpha_sq_mem_of_char2_square (E : Affine F) [E.IsElliptic] + (h_cubic_factor : X ^ 3 + C E.a₂ * X ^ 2 + C E.a₄ * X + C E.a₆ - C δ = (X - C x₀) * w₃) + (hα : α ^ 2 = δ) : + (AdjoinRoot.mk E.polynomial (Y - C (C α))) ^ 2 ∈ P := by +- haveI hCharP_FX : CharP F[X] 2 := Polynomial.charP +- haveI hCharP_FXY : CharP F[X][Y] 2 := Polynomial.charP ++ have hCharP_FX : CharP F[X] 2 := Polynomial.charP ++ have hCharP_FXY : CharP F[X][Y] 2 := Polynomial.charP + have h_two_FX : (2 : F[X]) = 0 := by exact_mod_cast CharP.cast_eq_zero F[X] 2 + have h_two_FXY : (2 : F[X][Y]) = 0 := by exact_mod_cast CharP.cast_eq_zero F[X][Y] 2 + have h_step : (AdjoinRoot.mk E.polynomial (Y - C (C α))) ^ 2 = +@@ -649,7 +596,7 @@ private theorem maximalIdeal_isPrincipal_case_char2_ordinary_square (E : Affine + (h_cubic_factor : X ^ 3 + C E.a₂ * X ^ 2 + C E.a₄ * X + C E.a₆ - C δ = (X - C x₀) * w₃) + (hα : α ^ 2 = δ) : + (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by +- letI := hPmax.isPrime ++ let := hPmax.isPrime + -- `(x₀, α)` satisfies `E.Equation` (α² + (a₁x₀+a₃)α = δ = α²) and is smooth (`Δ ≠ 0`). + have h_eq : E.Equation x₀ α := by + rw [Affine.equation_iff] +@@ -674,7 +621,7 @@ private theorem maximalIdeal_isPrincipal_case_char2_ordinary_square (E : Affine + have h_P_eq : P = pointIdeal E x₀ α := + (Ideal.IsMaximal.eq_of_le (pointIdeal_isMaximal E h_ns) hPmax.ne_top h_pointIdeal_le).symm + subst h_P_eq +- haveI : IsDiscreteValuationRing (Localization.AtPrime (pointIdeal E x₀ α)) := ++ have : IsDiscreteValuationRing (Localization.AtPrime (pointIdeal E x₀ α)) := + HasseWeil.localRing_isDVR E h_ns + rw [Localization.AtPrime.map_eq_maximalIdeal] + exact IsDiscreteValuationRing.toIsPrincipalIdealRing.principal _ +@@ -931,10 +878,10 @@ private theorem maximalIdeal_isPrincipal_case_char2_ordinary_nonsquare + (hc_in_p : c ∈ P.comap (algebraMap (Polynomial F) E.CoordinateRing)) + (h_sq : ∀ α : F, α ^ 2 ≠ δ) : + (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by +- letI := hPmax.isPrime +- -- `f_quad = X² + C δ` is irreducible (δ not a square); build `proj = lift i_hom (root f_quad)`. ++ let := hPmax.isPrime ++ + set f_quad : Polynomial F := (Polynomial.X : Polynomial F) ^ 2 + Polynomial.C δ with hf_quad_def +- haveI hFact : Fact (Irreducible f_quad) := ++ have hFact : Fact (Irreducible f_quad) := + ⟨X_sq_add_C_irreducible_of_not_square δ h2 h_sq⟩ + set i_hom : F[X] →+* AdjoinRoot f_quad := + (AdjoinRoot.of f_quad).comp (Polynomial.evalRingHom x₀) with hi_hom_def +@@ -985,7 +932,7 @@ private lemma comap_eq_span_c_of_char2_ordinary (E : Affine F) [E.IsElliptic] + exact h_a1 h_coeff_1.symm + have hp_ne_bot : p ≠ ⊥ := fun hbot ↦ hc_ne_zero (by + rw [hbot, Ideal.mem_bot] at hc_in_p; exact hc_in_p) +- haveI : p.IsMaximal := Ring.DimensionLEOne.maximalOfPrime hp_ne_bot (Ideal.IsPrime.comap _) ++ have : p.IsMaximal := Ring.DimensionLEOne.maximalOfPrime hp_ne_bot (Ideal.IsPrime.comap _) + exact maximal_eq_span_of_mem_linear p (IsPrincipalIdealRing.principal p) c hc_ne_zero + (by rw [hc_def]; exact Polynomial.natDegree_linear h_a1) hc_in_p + +@@ -1032,9 +979,9 @@ private theorem maximalIdeal_isPrincipal_case_char2_ordinary (E : Affine F) [E.I + (h4 : (4 : F) = 0) (h_a1 : E.a₁ ≠ 0) + (hY : AdjoinRoot.mk E.polynomial E.polynomialY ∈ P) : + (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by +- letI := hPmax.isPrime ++ let := hPmax.isPrime + have h2 : (2 : F) = 0 := two_eq_zero_of_four_eq_zero h4 +- haveI hCharP : CharP F 2 := ++ have hCharP : CharP F 2 := + (CharP.charP_iff_prime_eq_zero Nat.prime_two).mpr h2 + -- `polyY = C c` with `c = a₁X + a₃`, so `c ∈ p`, and `p = span {c}`. + set c : F[X] := C E.a₁ * X + C E.a₃ with hc_def +@@ -1088,7 +1035,7 @@ private theorem polynomialY_notMem_of_char2_a1_eq_zero (E : Affine F) [E.IsEllip + have h2sq_eq : (2 : F) ^ 2 = 4 := by ring + rw [h2sq_eq]; exact h4 + exact pow_eq_zero_iff (by omega : 2 ≠ 0) |>.mp h2sq +- haveI hCharP : CharP F 2 := ++ have hCharP : CharP F 2 := + (CharP.charP_iff_prime_eq_zero Nat.prime_two).mpr h2 + have hΔ : E.Δ ≠ 0 := fun h ↦ not_isUnit_zero (h ▸ IsElliptic.isUnit (W := E)) + have ha3_ne : E.a₃ ≠ 0 := by +@@ -1256,14 +1203,14 @@ private theorem maximalIdeal_isPrincipal_case_charNe2 (E : Affine F) [E.IsEllipt + (hY : AdjoinRoot.mk E.polynomial E.polynomialY ∈ P) + (hX : AdjoinRoot.mk E.polynomial E.polynomialX ∉ P) : + (Ideal.map (algebraMap E.CoordinateRing (Localization.AtPrime P)) P).IsPrincipal := by +- letI := hPmax.isPrime ++ let := hPmax.isPrime + set g := algebraMap (Polynomial F) E.CoordinateRing with hg_def + set p := P.comap g with hp_def + set f := algebraMap E.CoordinateRing (Localization.AtPrime P) with hf_def +- have hp_ne_bot : p ≠ ⊥ := fun hp_bot ↦ hPbot (eq_bot_of_comap_eq_bot hp_bot) +- haveI hp_maximal : p.IsMaximal := ++ have hp_ne_bot : p ≠ ⊥ := fun hp_bot ↦ hPbot (eq_bot_of_under_eq_bot (R := Polynomial F) hp_bot) ++ have hp_maximal : p.IsMaximal := + Ring.DimensionLEOne.maximalOfPrime hp_ne_bot (Ideal.IsPrime.comap _) +- haveI hp_principal : p.IsPrincipal := IsPrincipalIdealRing.principal p ++ have hp_principal : p.IsPrincipal := IsPrincipalIdealRing.principal p + have h2 : (2 : F) ≠ 0 := fun h2zero ↦ h4 (by + have : (4 : F) = 2 * 2 := by norm_num + rw [this, h2zero]; ring) +@@ -1302,15 +1249,15 @@ private theorem maximalIdeal_isPrincipal_case_charNe2 (E : Affine F) [E.IsEllipt + rw [map_eq_span_of_charNe2 E P π hY hmkCπ_in_span hP_le_span] + exact ⟨⟨_, rfl⟩⟩ + +--- Reduces to a clean case-dispatch over the closed-point geometry: each branch is a leaf lemma ++ + -- above (`..._case_polyY_notMem`, char-2 supersingular/ordinary, char-≠2 Jacobian). + private theorem maximalIdeal_isPrincipal_of_nonsingular (E : Affine F) [E.IsElliptic] + (P : Ideal E.CoordinateRing) (_ : P ≠ ⊥) (hPmax : P.IsMaximal) : + (IsLocalRing.maximalIdeal (Localization.AtPrime P)).IsPrincipal := by +- letI := hPmax.isPrime ++ let := hPmax.isPrime + -- The maximal ideal `m = P.map f` (`f = algebraMap R R_P`); reduce to principality of `P.map f`. + rw [← Localization.AtPrime.map_eq_maximalIdeal] +- -- Dispatch on the closed-point geometry. Each leaf lemma handles one configuration. ++ + by_cases hY : AdjoinRoot.mk E.polynomial E.polynomialY ∉ P + · -- `mk(polynomialY) ∉ P`: the squarefree-quotient leaf lemma. + exact maximalIdeal_isPrincipal_case_polyY_notMem E P ‹P ≠ ⊥› hPmax hY +@@ -1325,21 +1272,21 @@ private theorem maximalIdeal_isPrincipal_of_nonsingular (E : Affine F) [E.IsElli + · -- Char ≠ 2: Jacobian factorisation of the Y-discriminant. + exact maximalIdeal_isPrincipal_case_charNe2 E P ‹P ≠ ⊥› hPmax h4 hY hX + +-/-- The coordinate ring of an elliptic curve is integrally closed in its fraction field. -/ ++ + instance coordinateRing_isIntegrallyClosed (E : Affine F) [E.IsElliptic] : + IsIntegrallyClosed E.CoordinateRing := by + apply IsIntegrallyClosed.of_localization_maximal + intro P hP0 hPmax +- haveI := IsLocalization.isNoetherianRing P.primeCompl (Localization.AtPrime P) inferInstance +- haveI : Ring.DimensionLEOne (Localization.AtPrime P) := ++ have := IsLocalization.isNoetherianRing P.primeCompl (Localization.AtPrime P) inferInstance ++ have : Ring.DimensionLEOne (Localization.AtPrime P) := + Ring.DimensionLEOne.localization (Localization.AtPrime P) P.primeCompl_le_nonZeroDivisors +- haveI : IsPrincipalIdealRing (Localization.AtPrime P) := ++ have : IsPrincipalIdealRing (Localization.AtPrime P) := + ((tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain + (Localization.AtPrime P)).out 5 1).mp + (maximalIdeal_isPrincipal_of_nonsingular E P hP0 hPmax) + exact UniqueFactorizationMonoid.instIsIntegrallyClosed + +--- Typeclass synthesis over the tower F[X] → CoordinateRing → FunctionField needs more budget. ++ + noncomputable instance coordinateRing_isIntegralClosure (E : Affine F) [E.IsElliptic] : + IsIntegralClosure E.CoordinateRing (Polynomial F) E.FunctionField where + algebraMap_injective _ _ h := +@@ -1385,24 +1332,24 @@ private theorem root_aeval_polynomial_map (E : Affine F) [E.IsElliptic] : + simp [IsScalarTower.algebraMap_apply (Polynomial F) E.CoordinateRing E.FunctionField] } + + -- The separability proof reasons over two cases via finSepDegree; typeclass +--- synthesis for the tower through FractionRing F[X] needs more budget. ++ + noncomputable instance functionField_isSeparable (E : Affine F) [E.IsElliptic] : + Algebra.IsSeparable (FractionRing (Polynomial F)) E.FunctionField := by + set K := FractionRing (Polynomial F) + -- `finSepDegree K L ∣ finrank K L = 2` and `≠ 1` (as `y` is separable), so it equals `finrank`. + have h_dvd := Field.finSepDegree_dvd_finrank K E.FunctionField +- haveI : FiniteDimensional K E.FunctionField := functionField_finiteDimensional E ++ have : FiniteDimensional K E.FunctionField := functionField_finiteDimensional E + have h_fr : Module.finrank K E.FunctionField = 2 := by +- haveI : Algebra.IsAlgebraic (Polynomial F) E.CoordinateRing := ++ have : Algebra.IsAlgebraic (Polynomial F) E.CoordinateRing := + (Algebra.IsIntegral.of_finite (Polynomial F) E.CoordinateRing).isAlgebraic + change Module.finrank (FractionRing (Polynomial F)) E.FunctionField = 2 +- rw [Algebra.IsAlgebraic.finrank_of_isFractionRing (Polynomial F) ++ rw [IsFractionRing.finrank_eq (Polynomial F) + (FractionRing (Polynomial F)) E.CoordinateRing E.FunctionField, + Module.finrank_eq_card_basis (Affine.CoordinateRing.basis E), Fintype.card_fin] + rw [h_fr] at h_dvd + have h_not_1 : Field.finSepDegree K E.FunctionField ≠ 1 := by + intro h1 +- haveI := isPurelyInseparable_of_finSepDegree_eq_one h1 ++ have := isPurelyInseparable_of_finSepDegree_eq_one h1 + set y : E.FunctionField := + algebraMap E.CoordinateRing E.FunctionField (AdjoinRoot.root E.polynomial) + have hy_int : IsIntegral K y := IsIntegral.of_finite _ _ +@@ -1446,8 +1393,7 @@ instance coordinateRing_isDedekindDomain (E : Affine F) [E.IsElliptic] : + IsIntegralClosure.isDedekindDomain (Polynomial F) (FractionRing (Polynomial F)) + E.FunctionField E.CoordinateRing + +-/-- The coordinate ring of an elliptic curve is integrally closed (consequence of being +-a Dedekind domain). -/ ++ + instance isIntegrallyClosed_coordinateRing (E : Affine F) [E.IsElliptic] : + IsIntegrallyClosed E.CoordinateRing := + inferInstance +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Valuation.lean b/projects/HasseWeil/HasseWeil/Foundation/Valuation.lean +index 7750f062d..5ec611dcc 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Valuation.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Valuation.lean +@@ -239,7 +239,7 @@ theorem localRing_isDVR {x₀ y₀ : F} (h : W.Nonsingular x₀ y₀) : + let P := pointIdeal W x₀ y₀ + haveI : P.IsPrime := (pointIdeal_isMaximal W h).isPrime + IsDiscreteValuationRing (Localization.AtPrime P) := by +- intro P; letI : P.IsPrime := (pointIdeal_isMaximal W h).isPrime ++ intro P; let : P.IsPrime := (pointIdeal_isMaximal W h).isPrime + let f := algebraMap W.CoordinateRing (Localization.AtPrime P) + -- Nonsingularity: WLOG polynomialY.evalEval x₀ y₀ ≠ 0 + -- (The other case swaps X↔Y roles; we handle the Y case.) +@@ -274,7 +274,7 @@ theorem localRing_isDVR {x₀ y₀ : F} (h : W.Nonsingular x₀ y₀) : + (M := P.primeCompl) _ P.primeCompl_le_nonZeroDivisors)] at hbot + exact (Affine.CoordinateRing.XClass_ne_zero (W' := W) (x := x₀)) + (eq_bot_iff.mp hbot (subset_span (Set.mem_insert _ _))) +- haveI : IsPrincipalIdealRing (Localization.AtPrime P) := ++ have : IsPrincipalIdealRing (Localization.AtPrime P) := + ((tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain + (Localization.AtPrime P)).out 5 1).mp hprincipal + exact ⟨hne⟩ +@@ -306,7 +306,7 @@ theorem localRing_isDVR {x₀ y₀ : F} (h : W.Nonsingular x₀ y₀) : + (M := P.primeCompl) _ P.primeCompl_le_nonZeroDivisors)] at hbot + exact (Affine.CoordinateRing.XClass_ne_zero (W' := W) (x := x₀)) + (eq_bot_iff.mp hbot (subset_span (Set.mem_insert _ _))) +- haveI : IsPrincipalIdealRing (Localization.AtPrime P) := ++ have : IsPrincipalIdealRing (Localization.AtPrime P) := + ((tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain + (Localization.AtPrime P)).out 5 1).mp hprincipal + exact ⟨hne⟩ +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/Genuine.lean b/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/Genuine.lean +index 16c9844e05e8a3a4e84977c4344686797b691a85..cdf52885c82d916e7b1c8e267acd875b4c7fe0ab 100644 +GIT binary patch +delta 6150 +zcma)Ae~c7o8P42M3e$opJt$z?uLb3f-tBRu5kp%Q3WW2l0$wRdC^I|z?e14*XZB`h +zx!d~3wp1(H)*npb5)+#y))W0Rj;;;kBRMKHuNjfQ!*4~Kd8x)C4wZh8wB6s~kI0zGs^ARVm7LO}WkZ%f=lo;rLz{1q~;{N{vwA +z+hMa-lTpwVei={wprkxIlA_*l-Jao0-;z`QI!@1q$*01_XC|So_R8)y#pE9$^%k}X)b$hlGzmh{=!%*$5*CvNre$MkMfBn)yz24L#H5Sqfpo-3J&zlr)4Tl +zys%MA0n0xoL`w~48+cqy0Qe`kfW%TRB<^`GLSMg^R5>AtF5^nc +zWKhQ6ecwItiO1K+{)b*)b2RY%a$(o5&an?)GH1}0kvM%&I;uqcKeQm`&LCcMdTL5M +z;!3n6YFLugy^sVy2s`i0zPx7BV>+=MW=iGpCiMb{q(W*MvF?7s>(o`AQ0Dh +z5F4RW6^mdQ?FYj2%N%4dt(OWkRm)1ch_7Z>z-K#tzx#f-(&*5MIhtkVlmoIA72ivPNJ7pt>w0NWK%Z)D6l_1H^8fWCuo=yZAo$gtH} +zFHAwV>i!}SVu?1brL*Xg1mULsKR)2_xt8U14Ri#{1?70<(-&?%N1FR67?P6}^ND9JZH|AqZcV)Vi_`IoFMO->o6o#xbi(KS(Y2<4z>*TgKldbuTIKJtFn9NN_HTYfp=Z1@N{I +z0k}X~PkNdlHKoaxvKmN-K4Z!BBV9zTS}0Z@I{c7}f9+|ikSArH8(*Sa6s(hGhw5ZcoS9w)*)<+ef&nH%Ao-hoUd@w!fJeuLrPBpWt3=Xx`}M9 +zMg7|hej^8goHJV11L;UAHHivV*9S#11b&&lNZ5kQP1*~^J?|?zLkU|rDsUREjqz2l +zOFgv+)?9Vc7QI(&-@aWOmoUX_H2_Qzhb7dtR>R0ZG!bu~YN#f3wCF<_l-IfISKk|n +zugz}j{QTE{+Suw_hJq#+PRAkIJa446tY{Jl8brbxKY12!PoAQ`CoB=7XkocY>Ci%t +zONC(%nGZu&V?LCa7QYR>e;IU~6k9WT@>=-(75*F%#9#W`rgu%Ji_>6kn(eO~FgEVc +zwoTV5IZ^=NG+jQigzab68=D?AUEcwgbUMWW9j(lorE3!eGOW{S3Gvqbkk2Jknn4MY +zy+bgLv{TdZo3mS6q_Z`BqD_^$nLBPwl2uMu1Ae@o7PRzJ9n(}VCcS4BjgIzT26@7; +zaYo`yLT3Nx(w +zi>PqIGQhDj6oWWZHt9-Q8g$W4tppm6j1_R>qldm0fbwF+Y^GGCPZuumSJ_2D{MOs| +zwx>@Tx3!-zjSZd4?~JV4NQKssW!D+)ua6p+2#Jr*CuApGL2qFHDdn+0MdVN~x{*MO +zF`a#3eS!?gvJ%mVlI{IRa4$sQ>05>goh$AGuy*cV#SS8vSRBSnc4SkNndfb{!BU4* +zaY=%llv5D<$%E0p)^2VH5Ja53e&JbIU}>YjVacEuJqrb;G|ldxZ#Nz=4C|{~jIsFI +ze>QYy*Bf)AvHi|_yWfAeaqH^#8=H-9uY^d~z0-&$GI9{TZypkx{43)`n&+EGJZ7?U;*Gb8(yOS!CZa49fMZjuHdQoM1-xTSmRVdM6ZZAfs1 +zN}}kxk{i4B5u-NR{q3CL81YYz-nojH(thJnV=J5-hLwv8D%|{eWDU}3WR8DQxgZY& +zIK5v23l3vA4dE7hy=5Tb^n+Z?!7DiGI2tMU_j+z<3e+cyn4nqnZ|z<@ZG6fYNpjdW +zG>3v2KQl4b23yv)AAG{NXZURc5oGW}Ne9Fz(f}eNmSB2qmG@pdE+&~ 1` — Silverman III.6.2 step +- +-The substantive content is the **Frobenius factorisation** of `[p^k]`: +-`[p^k] = π_{p^k} ∘ V_{p^k}` on the curve, pulled back to +-`[p^k]^* = V_{p^k}^* ∘ π_{p^k}^*` on the function field, where +-`π_{p^k}^* x = x^{p^k}`. This forces `[p^k]^* x = (V_{p^k}^* x)^{p^k}`, +-i.e., `[p^k]^* x` is a `p^k`-th power in `K(E)`. Equivalently +-`Φ_{p^k}, Ψ_{p^k}² ∈ R[X^{p^k}]`. +- +-### Polynomial-side recurrence approach (Worker C's stream) +- +-The polynomial-side argument avoids constructing `V_{p^k}`. The chain: +-1. Base case `k = 1`: `Φ_p, Ψ_p² ∈ R[X^p]` — shipped (`Φ_two_mem_expand_two_charP`, +- `Φ_three_mem_expand_three_charP`, etc.) for `p = 2, 3`. +-2. Sub-step (function-field level): `[p^k]^* x ∈ R(x^{p^k})` — derivable +- inductively from base + ring-hom properties of `[p]^*`. +-3. Polynomial extraction: from `[p^k]^* x = Φ_{p^k}/Ψ_{p^k}² ∈ R(x^{p^k})`, +- conclude `Φ_{p^k}, Ψ_{p^k}² ∈ R[X^{p^k}]`. +- +-Step 3 requires **coprimality of `Φ_{p^k}` and `Ψ_{p^k}²`** as polynomials +-in `R[X]`. Mathlib provides this for the curve case via +-`WeierstrassCurve.Φ.coprime_ΨSq` or analogous (Silverman III.6 background). +-Step 2 is reasonable to formalise from the base case via induction on `k`. +- +-### The missing recurrence +- +-Direct propagation `Φ_{p^k} → Φ_{p^{k+1}}` via division-polynomial recurrence +-needs the **multiplication-by-p formula**: +-`preΨ (p · m) = F(preΨ_{m-?}, ..., preΨ_{m+?})` for prime `p` and any `m`. +- +-Mathlib provides the **doubling+adding-one** recurrences: +-* `WeierstrassCurve.preΨ_even (m) : preΨ (2m) = ...` +-* `WeierstrassCurve.preΨ_odd (m) : preΨ (2m+1) = ...` +- +-For `p = 2`, `2m` is `p · m`, so the doubling formula is the multiplication-by-2 +-recurrence directly. For `p ≥ 3`, multiplication-by-`p` is **not** doubling +-and requires a derived formula. The classical derivation iterates the +-doubling+add-one chain `p` times, but the resulting polynomial identity is +-sympy-territory complexity for each odd prime. +- +-The general formula is in Silverman §III.6 / Sutherland Lecture 6 (modern +-treatment) but is not in mathlib. Shipping it for arbitrary prime `p` +-requires either: +-* A general recurrence proof from `preΨ_even`/`preΨ_odd` via induction +- on the binary expansion of `p · m` (~200 LOC of polynomial manipulation +- + sympy-verified per-prime multipliers). +-* A direct port of the bivariate recurrence `Ψ_{m+n} Ψ_{m-n} = ...` +- (Silverman Exercise 3.7) — ~50 LOC of polynomial identities, then derive +- multiplication-by-`p` as `m + (p-1)·m`. +- +-### What's shipped here +- +-The polynomial-side propagation building blocks are in place: +-* `pow_mem_expand_charP`, `pow_pow_mem_expand_pow_charP` — `f^(p^n) ∈ expand`-range. +-* `pow_pow_mem_expand_pow_succ_of_expand_charP` — `f ∈ expand p` → +- `f^(p^k) ∈ expand (p^(k+1))`. Used in the inductive step's +- Frobenius-cycle argument. +-* `expand_pow_map_iterateFrobenius` — equational form +- `expand (p^n) (f.map iterateFrobenius) = f^(p^n)`. +- +-The next concrete sub-piece (deferred to the multiplication-by-p recurrence +-port): the full propagation theorem +-`Φ_p_pow_mul_p_mem_expand_charP : Φ_{p^k} ∈ expand (p^k) → Φ_{p^{k+1}} ∈ expand (p^{k+1})`. -/ ++/-! ### Propagation to powers of the characteristic ++ ++The Frobenius factorization of multiplication by `p^k` implies that the ++pulled-back coordinates are `p^k`-th powers. On the polynomial side this ++corresponds to membership of the coprime division-polynomial numerator and ++denominator in `R[X^(p^k)]`. Powers and iterated Frobenius give the expansion ++identities used to propagate this membership. ++-/ + + + end GenericExpand +diff --git a/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/UniversalQthRootWitness.lean b/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/UniversalQthRootWitness.lean +index c7790ab47..43c07c0ea 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/UniversalQthRootWitness.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/Verschiebung/UniversalQthRootWitness.lean +@@ -8,50 +8,26 @@ import HasseWeil.Foundation.Verschiebung.VerschiebungIsDualOfFrobenius + import HasseWeil.Foundation.Verschiebung.Route2Universal + + /-! +-# The universal q-th-root witness (general characteristic) — Route B +- +-This file discharges, for an arbitrary finite field `K` (`q = #K = p^k`, +-`p = char K`), the **universal q-th-root witness** +- +-``` +-h_qth_root : ∀ z, ∃ g, g ^ q = [q]* z +-``` +- +-(`[q]*` the pullback of the multiplication-by-q isogeny on `K(E)`), and feeds +-it through the proven reducer `verschiebungIsog_isDualOf_frobenius_of_qth_root_witness` +-to obtain `verschiebung_isDualOf_frobenius_general` — the GAP-QF keystone. +- +-## Strategy (uniform in `p`, no per-prime polynomial witnesses) +- +-The keystone reduces (via `mulByInt_q_pullback_fieldRange_subset_frobenius_of_xy_witness` +-and `functionField_eq_intermediateField_adjoin_xy`) to two generator facts: +- +-* `[q]* x_gen ∈ R` and `[q]* y_gen ∈ R`, where `R = (frobeniusIsog W).pullback.range = K(E)^q`. +- +-Both are obtained from the **Kähler differential** kernel theorem +-`kaehlerD_eq_zero_iff_mem_pth_powers` (`ker D = K(E)^p`, char `p`) and the +-**separability** of `K(E)/K(x_gen)` (`functionField_isSeparable`), with no +-characteristic-specific polynomial computation: +- +-* **x-side base** `[p]* x_gen ∈ adjoin K {x_gen^p}`: `[p]* x_gen` is rational in +- `x_gen` (so lies in `K(x_gen)`) and has `D([p]* x_gen) = 0` +- (`D_mulByInt_p_pullback_x_gen_eq_zero`), hence is a `p`-th power `g^p` with +- `g ∈ K(E)`; since `K(E)/K(x_gen)` is separable, the purely-inseparable element +- `g` lies in `K(x_gen)`, so `[p]* x_gen = g^p ∈ adjoin K {x_gen^p}`. The +- existing induction `mulByInt_pow_pullback_x_gen_mem_adjoin_pow_of_base`-style +- bootstrap (re-derived here taking the Kähler base) lifts this to +- `[q]* x_gen ∈ adjoin K {x_gen^q} ⊆ R`. +-* **y-side** `[q]* y_gen ∈ R`: `y_gen` satisfies the separable Weierstrass +- quadratic over `K(x_gen)`; applying `[q]*` gives that `[q]* y_gen` is a root of +- a **separable** quadratic over `R` (its discriminant is `([q]*(2y+a₁x+a₃))² ≠ 0`, +- using injectivity of `[q]*` and `2y+a₁x+a₃ ≠ 0`), with coefficients in `R` +- (because `[q]* x_gen ∈ R`). So `[q]* y_gen` is separable over `R`; as `K(E)/R` +- is purely inseparable (`frobeniusIsog_intermediateField_isPurelyInseparable`), +- `[q]* y_gen ∈ R`. ++# Universal `q`-th roots of multiplication pullbacks ++ ++For a finite field `K` of cardinality `q = p^k`, every multiplication pullback ++`[q]* z` on `K(E)` is a `q`-th power. The resulting image inclusion in Frobenius ++pullback constructs the dual of Frobenius. ++ ++It suffices to show that `[q]* x` and `[q]* y` lie in the Frobenius image ++`R = K(E)^q`. The Kähler differential of `[p]* x` vanishes, so it is a `p`-th ++power `g^p`. Since `K(E)/K(x)` is separable and `[p]* x ∈ K(x)`, the purely ++inseparable element `g` lies in `K(x)`. Induction gives ++`[q]* x ∈ K(x^q) ⊆ R`. ++ ++The Weierstrass equation then makes `[q]* y` separable over `R`: the pulled-back ++quadratic has nonzero derivative at `[q]* y`, since `[q]*` is injective and ++`2y + a₁x + a₃ ≠ 0`. As `K(E)/R` is purely inseparable, `[q]* y` belongs to `R`. ++The argument applies in every characteristic. + + ## References + +-* Silverman, *The Arithmetic of Elliptic Curves*, II.2.12, III.5.5, III.6.2. ++* Silverman, *The Arithmetic of Elliptic Curves*, II.2.12, III.5.5, and III.6.2. + -/ + + open WeierstrassCurve +@@ -71,10 +47,10 @@ omit [Fintype K] [DecidableEq K] in + theorem mem_fractionRing_range_of_pow_mem (p : ℕ) [Fact p.Prime] [CharP K p] + (g : KE) (hg : g ^ p ∈ (algebraMap Mff KE).range) : + g ∈ (algebraMap Mff KE).range := by +- haveI : Algebra.IsSeparable Mff KE := functionField_isSeparable W.toAffine +- haveI : CharP (Polynomial K) p := inferInstance +- haveI : CharP Mff p := inferInstance +- haveI : ExpChar Mff p := ExpChar.prime Fact.out ++ have : Algebra.IsSeparable Mff KE := functionField_isSeparable W.toAffine ++ have : CharP (Polynomial K) p := inferInstance ++ have : CharP Mff p := inferInstance ++ have : ExpChar Mff p := ExpChar.prime Fact.out + have hsep : IsSeparable Mff g := Algebra.IsSeparable.isSeparable Mff g + have hsd1 : (minpoly Mff g).natSepDegree = 1 := by + rw [minpoly.natSepDegree_eq_one_iff_pow_mem p] +@@ -93,7 +69,7 @@ the scalar-tower factoring of the structure map through `M = FractionRing K[X]`. + theorem algebraMap_polynomial_eq_fractionRing (q : Polynomial K) : + algebraMap (Polynomial K) KE q = + algebraMap Mff KE (algebraMap (Polynomial K) Mff q) := by +- haveI : IsScalarTower (Polynomial K) Mff KE := functionField_isScalarTower W.toAffine ++ have : IsScalarTower (Polynomial K) Mff KE := functionField_isScalarTower W.toAffine + rw [← IsScalarTower.algebraMap_apply] + + omit [Fintype K] [DecidableEq K] in +@@ -158,7 +134,7 @@ theorem mulByInt_p_pullback_x_gen_mem_adjoin_pow_routeB + (p : ℕ) [Fact p.Prime] [CharP K p] : + (mulByInt W.toAffine (p : ℤ)).pullback (x_gen W) ∈ + IntermediateField.adjoin K ({x_gen W ^ p} : Set KE) := by +- haveI : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p ++ have : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p + have hp_ne : (p : ℤ) ≠ 0 := by exact_mod_cast (Fact.out : p.Prime).pos.ne' + have hD := D_mulByInt_p_pullback_x_gen_eq_zero W p + obtain ⟨g, hg⟩ := (kaehlerD_eq_zero_iff_mem_pth_powers W p _).mp hD +@@ -175,8 +151,8 @@ theorem mulByInt_p_pullback_x_gen_mem_adjoin_pow_routeB + exact adjoin_simple_pow_le_adjoin_simple_pow p (x_gen W) g hg_mem + + omit [Fintype K] in +-/-- `[p ^ (k+1)]` factors as `[p ^ k] ∘ [p]` (shared scaffolding for the x- and +-y-side `p^k`-power inductions). -/ ++/-- `[p ^ (k+1)]` factors as `[p ^ k] ∘ [p]` (the common composition identity in the x- and ++y-coordinate `p^k`-power inductions). -/ + private theorem mulByInt_pow_succ_comp (p : ℕ) [Fact p.Prime] (k : ℕ) : + mulByInt W.toAffine ((p ^ (k + 1) : ℕ) : ℤ) = + (mulByInt W.toAffine ((p ^ k : ℕ) : ℤ)).comp +@@ -195,7 +171,7 @@ theorem mulByInt_pow_pullback_x_gen_mem_adjoin_pow_routeB + (p : ℕ) [Fact p.Prime] [CharP K p] : + ∀ k, (mulByInt W.toAffine ((p ^ k : ℕ) : ℤ)).pullback (x_gen W) ∈ + IntermediateField.adjoin K ({x_gen W ^ (p ^ k : ℕ)} : Set KE) := by +- haveI : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p ++ have : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p + intro k + induction k with + | zero => exact mulByInt_pow_zero_pullback_x_gen_mem_adjoin_pow W p +@@ -355,7 +331,7 @@ theorem mulByInt_p_pullback_y_gen_mem_adjoin_pair_pow + (p : ℕ) [Fact p.Prime] [CharP K p] : + (mulByInt W.toAffine (p : ℤ)).pullback (y_gen W) ∈ + IntermediateField.adjoin K ({x_gen W ^ p, y_gen W ^ p} : Set KE) := by +- haveI : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p ++ have : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p + obtain ⟨h, hh⟩ := (kaehlerD_eq_zero_iff_mem_pth_powers W p _).mp + (D_mulByInt_p_pullback_y_gen_eq_zero W p) + have hh_mem : h ∈ IntermediateField.adjoin K ({x_gen W, y_gen W} : Set KE) := by +@@ -369,7 +345,7 @@ theorem mulByInt_pow_pullback_y_gen_mem_adjoin_pair_pow + (p : ℕ) [Fact p.Prime] [CharP K p] : + ∀ k, (mulByInt W.toAffine ((p ^ k : ℕ) : ℤ)).pullback (y_gen W) ∈ + IntermediateField.adjoin K ({x_gen W ^ (p ^ k : ℕ), y_gen W ^ (p ^ k : ℕ)} : Set KE) := by +- haveI : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p ++ have : CharP KE p := charP_of_injective_algebraMap (algebraMap K KE).injective p + intro k + induction k with + | zero => +@@ -450,8 +426,8 @@ theorem qth_root_witness_general : + g ^ Fintype.card K = + (mulByInt W.toAffine ((Fintype.card K : ℕ) : ℤ)).pullback z := by + obtain ⟨p, hCharP, ⟨n, _⟩, hp_prime, _⟩ := FiniteField.card' K +- haveI : Fact p.Prime := ⟨hp_prime⟩ +- haveI := hCharP ++ have : Fact p.Prime := ⟨hp_prime⟩ ++ have := hCharP + exact qth_root_witness_of_charP W p + + /-- **The GAP-QF keystone (general characteristic)**: the Verschiebung is the dual of +diff --git a/projects/HasseWeil/HasseWeil/Foundation/WallA/VSideDual.lean b/projects/HasseWeil/HasseWeil/Foundation/WallA/VSideDual.lean +index e5247f095..049bee4e1 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/WallA/VSideDual.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/WallA/VSideDual.lean +@@ -8,47 +8,16 @@ import HasseWeil.HasseBound.SumTrace + import HasseWeil.Foundation.Verschiebung.Genuine + + /-! +-# Wall A — the V-side dual route to the signed III.6.3 degree identity +- +-This file assembles the **V-side genuine isogeny** `β_dual = r·V − s` (built on the +-Verschiebung `V`, mirroring the π-side genuine `β = r·π − s`) into the pivot-chain scaffold +-shipped in `HasseWeil.GapSpines`, in order to drive +- +- `deg(r·π − s) = q·r² − t·r·s + s²` (the Wall-A keystone; its unconditional sorried form +- `genuineIsogSmulSub_degree_eq_signed` was retired 2026-06-11 — the witness-parametric +- `genuineIsogSmulSub_degree_eq_signed_via_walls` is the shipped form). +- +-## What is proved here, unconditionally +- +-* `isogeny_isGenuineWith_pointMap` — **any** isogeny `φ` is `IsGenuineWith` the geometric action +- `Affine.Point.map φ.pullback` on `(W_KE).Point`. This is the clean, general form of the +- "the pullback is the comorphism of a geometric map" non-vacuity check (`map_some`). +-* `betaDualV` — the V-side genuine isogeny `r·V − s`, constructed via the genuine-sum combinator +- `addIsog` applied to the Verschiebung (so **`addIsog` does generalise to `V`** — the V-side +- pole/injectivity bricks already live in `Verschiebung/Genuine.lean`). +-* `betaDualV_toAddMonoidHom_sub` — the point-map of `betaDualV` is `r·V − s·id` +- (`h_beta_dual_hom`), using `V.toAddMonoidHom = [q]` (`verschiebungIsog_of_witness`). +-* `betaDualV_isDual_pi` — `IsDualOf V π` (`h_isDual_V_pi`), from `verschiebung_dual_exists`'s +- underlying witness. +-* `genuineIsogSmulSub_degree_eq_signed_closed` — the **closing lemma**: it constructs `V` and +- `β_dual = r·V − s` internally, discharges `h_isDual_V_pi`, `h_beta_dual_hom`, `h_beta_pos`, and +- reduces the Wall-A keystone to exactly the three *standing dual residuals* (the genuine III.6.1 / +- III.6.2 content the project has not yet shipped unconditionally): +- +- 1. `h_sum_trace` : `π + V = [t]` (the trace relation, Silverman III.6.2(b); itself the +- output of `sum_trace_frobenius_witness` modulo `IsDualOf (1−V) (1−π)`); +- 2. `h_pullback_eq`: the full-isogeny **comorphism** identity `(β_dual ∘ β)* = [N]*` (the +- "double-Vieta" pullback match — the geometrically irreducible content); +- 3. `h_isDual_pair`: `IsDualOf β_dual β` (Silverman III.6.1 for the genuine pair). +- +- Everything else is internal; this is the honest reduction of Wall A to the standing dual +- residuals, composed through `genuineIsogSmulSub_degree_eq_signed_of_full_pivot_chain`. +- +-The unconditional statement (the former bare-`sorry` +-`GapSpines.genuineIsogSmulSub_degree_eq_signed`, deleted 2026-06-11 with the legacy skeleton +-chain) would require the three residuals above unconditionally (the project has not +-shipped `IsDualOf (1−V) (1−π)` nor the double-Vieta pullback identity); this +-witness-parametric closing lemma is the live form. ++# Verschiebung and the signed degree identity ++ ++Let `π` be Frobenius, `V` its dual, and `t` its trace. The isogeny `r V - s` ++provides the dual candidate for `r π - s`. Their point maps, a trace relation, ++a composition pullback identity, and a duality witness imply the signed degree ++formula `deg(r π - s) = q r² - t r s + s²`, under the stated nonvanishing hypotheses. ++ ++The trace, pullback, and duality identities remain explicit mathematical inputs. ++The construction also identifies the geometric action associated with any isogeny ++pullback at the generic point. + + ## References + +@@ -64,14 +33,11 @@ namespace WallA + variable {K : Type*} [Field K] [Fintype K] [DecidableEq K] + variable (W : WeierstrassCurve K) [W.toAffine.IsElliptic] [Fintype W.toAffine.Point] + +-/-! ### A general genuineness witness: any isogeny is genuine with `map pullback` ++/-! ### Geometric action of an isogeny pullback + +-`IsGenuineWith φ g` (`GapSpines`) only constrains the geometric action `g` at the generic point +-`P_gen = (x_gen, y_gen)`: it asks `g P_gen = some (φ.pullback x_gen) (φ.pullback y_gen)`. For the +-**canonical** action `Affine.Point.map (W' := W) φ.pullback` this is exactly `Affine.Point.map_some` +-applied to `genericPoint = some x_gen y_gen _`. So genuineness with the canonical action holds for +-*every* isogeny, with no hypotheses — this is the clean non-vacuity form (it confirms `IsGenuine` +-is satisfied by any genuine geometric isogeny, the pullback being its comorphism). -/ ++For the canonical action `Affine.Point.map φ.pullback`, evaluation at the generic ++point is `some (φ* x) (φ* y)`. This supplies `IsGenuineWith` for every isogeny. ++-/ + omit [Fintype K] [Fintype W.toAffine.Point] in + theorem isogeny_isGenuineWith_pointMap (φ : Isogeny W.toAffine W.toAffine) : + IsGenuineWith W φ (WeierstrassCurve.Affine.Point.map (W' := W) φ.pullback) := by +@@ -86,14 +52,14 @@ omit [Fintype K] [Fintype W.toAffine.Point] in + theorem isogeny_isGenuine (φ : Isogeny W.toAffine W.toAffine) : IsGenuine W φ := + ⟨_, isogeny_isGenuineWith_pointMap W φ⟩ + +-/-! ### The Verschiebung as a concrete `V` with `IsDualOf V π` ++/-! ### Verschiebung duality + +-We pin a single concrete Verschiebung witness, `verschiebungV`, from the connected (axiom-clean +-modulo the upstream `[q] = V ∘ π` factorisation) inclusion `mulByInt_q_pullback_subset_frobenius`. +-Its `IsDualOf V π` is `verschiebung_dual_exists`'s underlying witness, and its point map is the +-`[q]`-point map (`verschiebungIsog_of_witness.toAddMonoidHom = (mulByInt q).toAddMonoidHom`). -/ ++The image inclusion `Im([q]*) ⊆ Im(π*)` constructs a Verschiebung `V` dual to ++Frobenius. On rational points over the finite field, Frobenius is the identity, ++so the point map of `V` is multiplication by `q`. ++-/ + +-/-- The inclusion `Im([q]*) ⊆ Im(π*)` (Silverman II.2.11/III.6.2), the connected witness. -/ ++/-- The image inclusion `Im([q]*) ⊆ Im(π*)`. See Silverman II.2.11 and III.6.2. -/ + noncomputable abbrev hSubset (hq : 2 ≤ Fintype.card K) : + (mulByInt W.toAffine ((Fintype.card K : ℕ) : ℤ)).pullback.range ≤ + (frobeniusIsog W).pullback.range := +@@ -104,11 +70,13 @@ noncomputable def verschiebungV (hq : 2 ≤ Fintype.card K) : + Isogeny W.toAffine W.toAffine := + verschiebungIsog_of_witness W (hSubset W hq) + +-/-- `IsDualOf V π` for the concrete Verschiebung (`h_isDual_V_pi`, Silverman III.6.1 Case 2). -/ ++omit [Fintype W.toAffine.Point] in ++/-- The concrete Verschiebung is dual to Frobenius. See Silverman III.6.1. -/ + theorem verschiebungV_isDual (hq : 2 ≤ Fintype.card K) : + IsDualOf W.toAffine (verschiebungV W hq) (frobeniusIsog W) := + verschiebungIsog_of_witness_isDualOf_frobenius W (hSubset W hq) + ++omit [Fintype W.toAffine.Point] in + /-- The point map of the concrete Verschiebung is the `[q]`-point map (`= q • ·`). Frobenius on + `F_q`-rational points is the identity, so the dual `V` (`V ∘ π = [q]`) must carry the `[q]`-point + map. -/ +@@ -117,12 +85,12 @@ map. -/ + (mulByInt W.toAffine ((Fintype.card K : ℕ) : ℤ)).toAddMonoidHom := + rfl + +-/-! ### The V-side genuine isogeny `β_dual = r·V − s` ++/-! ### The isogeny `r V - s` + +-This is `addIsog` of the genuine pair `(V.zsmul r, [−s])` — the **exact mirror** of the π-side +-`genuineIsogSmulSub = addIsog (π.zsmul r, [−s])`. So `addIsog` *does* generalise to `V`: the V-side +-non-inverse / injectivity / pole bricks are the ones shipped in `Verschiebung/Genuine.lean` +-(`genuineIsogSmulSubV_universal_unconditional`). Its point map is `r·V + (−s) = r·V − s`. -/ ++The addition construction applied to `(V.zsmul r, [-s])` gives an isogeny with ++point map `r V - s id`, using the distinct-coordinate and pole identities for ++Verschiebung. ++-/ + + /-- The V-side genuine isogeny `r·V − s` on the concrete Verschiebung `V`. -/ + noncomputable def betaDualV (hq : 2 ≤ Fintype.card K) +@@ -131,6 +99,7 @@ noncomputable def betaDualV (hq : 2 ≤ Fintype.card K) + genuineIsogSmulSubV_universal_unconditional W (verschiebungV W hq) + (verschiebungV_isDual W hq) r s hr hs hrK hsK + ++omit [Fintype W.toAffine.Point] in + /-- The point map of `betaDualV` is `r·V − s·id` (`h_beta_dual_hom`). + + `betaDualV.toAddMonoidHom = (V.zsmul r) + [−s]`, and `(V.zsmul r) = [r] ∘ V`, so pointwise this is +@@ -150,28 +119,19 @@ theorem betaDualV_toAddMonoidHom_sub (hq : 2 ≤ Fintype.card K) + AddMonoidHom.id_apply, Isogeny.zsmul_apply, mulByInt_apply] + rw [neg_smul, sub_eq_add_neg] + +-/-! ### The Wall-A keystone, reduced to the standing dual residuals +- +-`genuineIsogSmulSub_degree_eq_signed_closed` is the live, witness-parametric form of the Wall-A +-keystone (whose unconditional sorried form was deleted 2026-06-11). It constructs the concrete +-Verschiebung +-`V` and the V-side genuine isogeny `β_dual = r·V − s` internally, discharges the three *structural* +-pivot inputs (`h_isDual_V_pi`, `h_beta_dual_hom`, `h_beta_pos`), and reduces the keystone to exactly +-the three **standing dual residuals** plus the nonvanishing of `N`: +- +-* `h_sum_trace` — the trace relation `π + V = [t]` (Silverman III.6.2(b); the output of +- `sum_trace_frobenius_witness` once `IsDualOf (1−V) (1−π)` ships); +-* `h_pullback_eq` — the comorphism identity `(β_dual ∘ β)* = [N]*` (the double-Vieta pullback match, +- the geometrically irreducible content of Wall A — equivalently, that `β_dual ∘ β` is genuine with +- the `[N]` action; see `GapSpines.genuine_dual_comp_eq_mulByInt_of_isGenuineWith`); +-* `h_isDual_pair` — `IsDualOf β_dual β` (Silverman III.6.1 for the genuine pair); +-* `h_N_ne` — `N = q·r² − t·r·s + s² ≠ 0` (automatic in the Hasse assembly: `β_dual ∘ β = [N]` +- forces `deg β · deg β_dual = N²`, so `N ≠ 0`; carried here as a hypothesis). +- +-The composition is `genuineIsogSmulSub_degree_eq_signed_of_full_pivot_chain` (GapSpines), with the +-internally-built `V = verschiebungV`, `β_dual = betaDualV`. This is the honest reduction of Wall A: +-the only inputs are the genuine III.6.1/III.6.2 facts the project has not yet shipped +-unconditionally. -/ ++/-! ### The signed degree identity ++ ++For `β = r π - s` and `β_dual = r V - s`, assume: ++ ++* the trace relation `π + V = [t]` on points; ++* the pullback identity `(β_dual ∘ β)* = [N]*`, where `N = q r² - t r s + s²`; ++* the duality relation `IsDualOf β_dual β`; ++* `N ≠ 0`. ++ ++These inputs, together with the constructed point map of `β_dual` and positivity ++of the degree of `β`, give `deg β = N`. See Silverman III.6.1–III.6.3. ++-/ ++omit [Fintype W.toAffine.Point] in + theorem genuineIsogSmulSub_degree_eq_signed_closed (hq : 2 ≤ Fintype.card K) + (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) (hrK : (r : K) ≠ 0) (hsK : (s : K) ≠ 0) + (h_sum_trace : (frobeniusIsog W).toAddMonoidHom + (verschiebungV W hq).toAddMonoidHom = +diff --git a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux.lean b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux.lean +index 2c92295af..6cd2db847 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux.lean +@@ -1,120 +1,32 @@ ++import HasseWeil.Foundation.WronskianAux.Prefix + /- + Copyright (c) 2026 Chris Birkbeck. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Chris Birkbeck + -/ +-import Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic +-import Mathlib.Algebra.Polynomial.Derivation +-import HasseWeil.Foundation.WronskianAux.CNorm +- +-/-! +-# Wronskian identities for Weierstrass division polynomials +- +-Two auxiliary polynomial identities used in the proof of the division-polynomial +-Wronskian identity (Silverman III.3 Exercise 3.7): +- +-* `wronskian_aux_three` — the `m = 3` case. +-* `wronskian_aux_four` — the `m = 4` case. +- +-## Strategy +- +-Both identities are pure polynomial identities in `R[X]` that hold because of +-`b_relation : 4·b₈ = b₂·b₆ - b₄²`. Concretely, `LHS - RHS` factors as +-`M(X) · (4b₈ - b₂b₆ + b₄²)` in `ℤ[b₂,b₄,b₆,b₈,X]` for an explicit polynomial +-`M`. The multipliers `M` were computed by dividing the expanded difference by +-`(4b₈ - b₂b₆ + b₄²)` over `ℤ[b₂,b₄,b₆,b₈]` (with `b₈` as the leading variable); +-see `scripts/compute_multipliers.py`. +- +-The proof uses `linear_combination M · h_P` where `h_P` is `b_relation` lifted +-to `R[X]`. The `C`-normalization lemmas imported from `CNorm.lean` handle the +-`C (Nat.cast n : R)` vs `C (OfNat.ofNat n : R)` atomization issue that +-otherwise blocks `ring` from closing the residual. +- +-Resource usage (vs original): +- +-* `wronskian_aux_three`: default `maxHeartbeats 200000` (was 32M, 160× reduction). +-* `wronskian_aux_four`: `maxHeartbeats 350000` (was 64M, ~180× reduction; measured +- minimum — 300000 fails). See TODO below for reducing to default. +- +-TODO (cleanup): reduce `wronskian_aux_four` `maxHeartbeats` to 200K (default). +- +-The 350K is required because `ring` must normalize a single degree-30 polynomial +-identity against the degree-26 multiplier `M`; the `evalMulProd` step in ring's +-normalization exceeds 300K heartbeats. Options to fit default: +- +-* Coefficient-wise approach via `Polynomial.ext_iff_natDegree_le`: works for +- `coeff 0` at default (using `eval 0` trick, which is a ring hom), but +- `Polynomial.coeff_mul` on nested products (`Ψ₃^3`, `preΨ₄ * Ψ₂Sq^2`, etc.) +- makes simp hit `max_steps` for `coeff i > 0`. Over arbitrary `CommRing R`, +- `(derivative^i p).eval 0 = i! · coeff i p` can't be inverted (no division). +-* New tactic: bounded-degree coefficient extraction avoiding simp's antidiagonal +- explosion — doesn't exist in mathlib yet. +-* Formalize in the quotient ring `ℤ[b₂,b₄,b₆,b₈] / (4b₈ - b₂b₆ + b₄²)` where +- `b_relation` becomes a ring identity — would work on 3 atoms instead of 4, +- smaller ring work, likely fits default. Requires building the quotient. +-* Manual algebraic split of m=4 into smaller sub-identities — research-level +- mathematical work. +- +-RAM usage: ~1-2 GB (was ~57 GB, ~30× reduction). +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, III.3 Exercise 3.7. +--/ +- + open WeierstrassCurve Polynomial +- + namespace HasseWeil +- + variable {R : Type*} [CommRing R] (W : WeierstrassCurve R) + +--- `b_relation` lifted to an equality in `R[X]`. The `C`-distributed statement shape is +--- load-bearing: the `wronskian_aux_*` proofs below pass this to `linear_combination`, +--- whose `ring` normalization treats each `C _` application as an atom. +-private lemma b_relation_poly : +- ((4 : R[X]) * Polynomial.C W.b₈ : R[X]) = +- Polynomial.C W.b₂ * Polynomial.C W.b₆ - Polynomial.C W.b₄ ^ 2 := by +- simpa [Polynomial.C_ofNat] using congrArg Polynomial.C W.b_relation +- +-/-- Wronskian auxiliary identity, `m = 3` case (Silverman III.3.7). +-`4·Ψ₃³ + 2·preΨ₄·Ψ₂Sq·Ψ₃' − (preΨ₄·Ψ₂Sq)'·Ψ₃ +-= 3·preΨ₄·Ψ₂Sq² − 3·preΨ₄²`. ++lemma wronskian_derivative_three : Polynomial.derivative W.Ψ₃ = 3 * W.Ψ₂Sq := by ++ simp only [Ψ₃, Ψ₂Sq, Polynomial.derivative_add, Polynomial.derivative_mul, ++ Polynomial.derivative_pow, Polynomial.derivative_X, Polynomial.derivative_C, ++ Polynomial.derivative_ofNat, Polynomial.C_mul, ++ Polynomial.C_ofNat, Nat.cast_ofNat] ++ ring + +-Multiplier: `M = b₈² + 4b₆b₈·X + 6b₄b₈·X² + 4b₂b₈·X³ + (b₂b₆ + 34b₈)·X⁴ +- + 36b₆·X⁵ + 18b₄·X⁶ + 4b₂·X⁷ + 9·X⁸`. -/ +-lemma wronskian_aux_three : +- 4 * W.Ψ₃ ^ 3 + 2 * W.preΨ₄ * W.Ψ₂Sq * Polynomial.derivative W.Ψ₃ - +- Polynomial.derivative (W.preΨ₄ * W.Ψ₂Sq) * W.Ψ₃ = +- Polynomial.C 3 * W.preΨ₄ * W.Ψ₂Sq ^ 2 - Polynomial.C 3 * W.preΨ₄ ^ 2 := by ++lemma wronskian_three_derivative_two : ++ W.Ψ₃ * Polynomial.derivative W.Ψ₂Sq = 2 * W.preΨ₄ + 2 * W.Ψ₂Sq ^ 2 := by + linear_combination (norm := ( +- simp only [Ψ₃, preΨ₄, Ψ₂Sq, +- Polynomial.derivative_add, Polynomial.derivative_sub, +- Polynomial.derivative_mul, Polynomial.derivative_pow, Polynomial.derivative_X, +- Polynomial.derivative_C, Polynomial.derivative_ofNat, +- Polynomial.C_add, Polynomial.C_sub, Polynomial.C_mul, Polynomial.C_pow, +- Polynomial.C_ofNat, Nat.cast_ofNat] +- ring)) +- (Polynomial.C (W.b₈ ^ 2) +- + Polynomial.C (4 * W.b₆ * W.b₈) * Polynomial.X +- + Polynomial.C (6 * W.b₄ * W.b₈) * Polynomial.X ^ 2 +- + Polynomial.C (4 * W.b₂ * W.b₈) * Polynomial.X ^ 3 +- + Polynomial.C (W.b₂ * W.b₆ + 34 * W.b₈) * Polynomial.X ^ 4 +- + Polynomial.C (36 * W.b₆) * Polynomial.X ^ 5 +- + Polynomial.C (18 * W.b₄) * Polynomial.X ^ 6 +- + Polynomial.C (4 * W.b₂) * Polynomial.X ^ 7 +- + Polynomial.C 9 * Polynomial.X ^ 8) * b_relation_poly W +- +--- Measured minimum (2026-07-16, #7205): 300000 fails at `synthesize pending MVars` +--- (ring's normalization of the degree-30 residual), 350000 passes. Removal attempts: +--- default budget and a type-ascribed multiplier both time out — the structural fix is the +--- quotient-ring route documented above (producer/decompose work). +-set_option maxHeartbeats 350000 in +-/-- Wronskian auxiliary identity, `m = 4` case (Silverman III.3.7). +- +-Multiplier `M(X)` is a degree-26 polynomial in `W.b₂, W.b₄, W.b₆, W.b₈` with +-integer coefficients, computed offline by polynomial division of `LHS - RHS` +-by `(4b₈ - b₂b₆ + b₄²)` over `ℤ[b₂, b₄, b₆, b₈]`. See +-`scripts/compute_multipliers.py` for the derivation. -/ ++ simp only [Ψ₃, preΨ₄, Ψ₂Sq, Polynomial.derivative_add, Polynomial.derivative_mul, ++ Polynomial.derivative_pow, Polynomial.derivative_X, Polynomial.derivative_C, ++ Polynomial.derivative_ofNat, Polynomial.C_sub, ++ Polynomial.C_mul, Polynomial.C_pow, Polynomial.C_ofNat, Nat.cast_ofNat] ++ ring)) (-2 * Polynomial.X ^ 2) * wronskian_b_relation_poly W ++ ++/-- The fourth Wronskian identity follows from the third identity and the two ++small derivative relations above. This factorization avoids expansion of the ++original degree-26 multiplier. -/ + lemma wronskian_aux_four : + (W.preΨ₄ ^ 2 * W.Ψ₂Sq) ^ 2 - + (Polynomial.derivative (W.Ψ₃ * (W.preΨ₄ * W.Ψ₂Sq ^ 2 - W.Ψ₃ ^ 3)) * +@@ -126,315 +38,12 @@ lemma wronskian_aux_four : + (W.Ψ₃ * ((W.preΨ₄ * W.Ψ₂Sq ^ 2 - W.Ψ₃ ^ 3) - W.preΨ₄ ^ 2)) - + W.preΨ₄ * (W.preΨ₄ * W.Ψ₂Sq ^ 2 - W.Ψ₃ ^ 3) ^ 2) := by + linear_combination (norm := ( +- simp only [Ψ₃, preΨ₄, Ψ₂Sq, +- Polynomial.derivative_mul, Polynomial.derivative_pow, +- Polynomial.derivative_add, Polynomial.derivative_sub, +- Polynomial.derivative_X, Polynomial.derivative_C, Polynomial.derivative_ofNat, +- Polynomial.C_mul, Polynomial.C_sub, Polynomial.C_add, Polynomial.C_pow, +- Polynomial.C_neg, Polynomial.C_ofNat, Nat.cast_ofNat] ++ simp only [Polynomial.derivative_mul, Polynomial.derivative_sub, ++ Polynomial.derivative_pow, Polynomial.C_ofNat, Nat.cast_ofNat] + ring)) +- (Polynomial.C (-W.b₆ ^ 6 * W.b₈ ^ 2 + (-2 * W.b₆ ^ 2 * W.b₈ ^ 5) +- + 2 * W.b₄ * W.b₈ ^ 6 +- + (-W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 4) +- + 2 * W.b₄ * W.b₆ ^ 4 * W.b₈ ^ 3) +- + Polynomial.C (-26 * W.b₆ ^ 3 * W.b₈ ^ 4 + (-4 * W.b₆ ^ 7 * W.b₈) +- + 2 * W.b₂ * W.b₈ ^ 6 +- + (-4 * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 4) +- + 2 * W.b₂ * W.b₆ ^ 4 * W.b₈ ^ 3 +- + 2 * W.b₄ * W.b₆ ^ 5 * W.b₈ ^ 2 +- + 6 * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ ^ 3 +- + 24 * W.b₄ * W.b₆ * W.b₈ ^ 5 +- + (-2 * W.b₂ * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 4)) * Polynomial.X +- + Polynomial.C (-4 * W.b₆ ^ 8 + 20 * W.b₈ ^ 6 + (-108 * W.b₆ ^ 4 * W.b₈ ^ 3) +- + (-4 * W.b₄ ^ 4 * W.b₈ ^ 4) + 28 * W.b₄ ^ 2 * W.b₈ ^ 5 +- + (-W.b₂ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 4) +- + (-18 * W.b₄ * W.b₆ ^ 6 * W.b₈) +- + (-2 * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 3) +- + 6 * W.b₂ * W.b₆ ^ 5 * W.b₈ ^ 2 +- + 26 * W.b₂ * W.b₆ * W.b₈ ^ 5 +- + 27 * W.b₄ ^ 2 * W.b₆ ^ 4 * W.b₈ ^ 2 +- + 54 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 4 +- + (-10 * W.b₂ * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 4) +- + 6 * W.b₂ * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 3) * Polynomial.X ^ 2 +- + Polynomial.C (-196 * W.b₆ ^ 5 * W.b₈ ^ 2 + (-28 * W.b₄ * W.b₆ ^ 7) +- + 280 * W.b₆ * W.b₈ ^ 5 +- + (-96 * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 3) +- + (-16 * W.b₄ ^ 4 * W.b₆ * W.b₈ ^ 3) +- + (-16 * W.b₄ ^ 2 * W.b₆ ^ 5 * W.b₈) +- + (-12 * W.b₂ * W.b₄ ^ 3 * W.b₈ ^ 4) +- + 40 * W.b₂ * W.b₄ * W.b₈ ^ 5 +- + 52 * W.b₄ ^ 3 * W.b₆ ^ 3 * W.b₈ ^ 2 +- + 96 * W.b₂ * W.b₆ ^ 2 * W.b₈ ^ 4 +- + 156 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 4 +- + (-16 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 3) +- + (-8 * W.b₂ ^ 2 * W.b₄ * W.b₆ * W.b₈ ^ 4) +- + 44 * W.b₂ * W.b₄ * W.b₆ ^ 4 * W.b₈ ^ 2) * Polynomial.X ^ 3 +- + Polynomial.C (-136 * W.b₆ ^ 6 * W.b₈ + (-76 * W.b₄ ^ 2 * W.b₆ ^ 6) +- + (-9 * W.b₂ * W.b₆ ^ 7) +- + (-8 * W.b₄ ^ 5 * W.b₈ ^ 3) + 12 * W.b₂ ^ 2 * W.b₈ ^ 5 +- + 48 * W.b₄ ^ 3 * W.b₈ ^ 4 + 356 * W.b₄ * W.b₈ ^ 5 +- + 1374 * W.b₆ ^ 2 * W.b₈ ^ 4 + (-508 * W.b₄ * W.b₆ ^ 4 * W.b₈ ^ 2) +- + (-13 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₈ ^ 4) +- + (-2 * W.b₂ ^ 3 * W.b₆ * W.b₈ ^ 4) +- + 11 * W.b₂ ^ 2 * W.b₆ ^ 4 * W.b₈ ^ 2 +- + 28 * W.b₄ ^ 4 * W.b₆ ^ 2 * W.b₈ ^ 2 +- + 30 * W.b₄ ^ 3 * W.b₆ ^ 4 * W.b₈ +- + 128 * W.b₂ * W.b₆ ^ 3 * W.b₈ ^ 3 +- + 216 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 3 +- + (-52 * W.b₂ * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 3) +- + (-20 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 3) +- + 30 * W.b₂ * W.b₄ * W.b₆ ^ 5 * W.b₈ +- + 81 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ ^ 2 +- + 240 * W.b₂ * W.b₄ * W.b₆ * W.b₈ ^ 4) * Polynomial.X ^ 4 +- + Polynomial.C (-2 * W.b₆ ^ 7 + (-100 * W.b₄ ^ 3 * W.b₆ ^ 5) + 188 * W.b₂ * W.b₈ ^ 5 +- + 3056 * W.b₆ ^ 3 * W.b₈ ^ 3 + (-468 * W.b₄ * W.b₆ ^ 5 * W.b₈) +- + (-410 * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ ^ 2) +- + (-46 * W.b₂ * W.b₄ * W.b₆ ^ 6) +- + (-28 * W.b₂ * W.b₆ ^ 4 * W.b₈ ^ 2) +- + (-24 * W.b₂ * W.b₄ ^ 4 * W.b₈ ^ 3) +- + (-6 * W.b₂ ^ 3 * W.b₄ * W.b₈ ^ 4) +- + (-6 * W.b₂ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 3) +- + 14 * W.b₂ ^ 2 * W.b₆ ^ 5 * W.b₈ +- + 56 * W.b₄ ^ 4 * W.b₆ ^ 3 * W.b₈ +- + 64 * W.b₂ * W.b₄ ^ 2 * W.b₈ ^ 4 +- + 68 * W.b₂ ^ 2 * W.b₆ * W.b₈ ^ 4 +- + 248 * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 3 + 3168 * W.b₄ * W.b₆ * W.b₈ ^ 4 +- + (-58 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 3) +- + 24 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 2 +- + 24 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 2 +- + 122 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 4 * W.b₈ +- + 528 * W.b₂ * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 3) * Polynomial.X ^ 5 +- + Polynomial.C (664 * W.b₈ ^ 5 + (-W.b₂ ^ 4 * W.b₈ ^ 4) + (-64 * W.b₄ ^ 4 * W.b₆ ^ 4) +- + (-6 * W.b₂ ^ 2 * W.b₆ ^ 6) + 116 * W.b₄ * W.b₆ ^ 6 +- + 116 * W.b₄ ^ 4 * W.b₈ ^ 3 + 1500 * W.b₄ ^ 2 * W.b₈ ^ 4 +- + 2572 * W.b₆ ^ 4 * W.b₈ ^ 2 + (-W.b₂ ^ 3 * W.b₆ ^ 3 * W.b₈ ^ 2) +- + (-758 * W.b₄ ^ 2 * W.b₆ ^ 4 * W.b₈) +- + (-110 * W.b₂ * W.b₆ ^ 5 * W.b₈) +- + (-106 * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 2) +- + (-85 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 5) +- + (-26 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₈ ^ 3) +- + 12 * W.b₂ ^ 2 * W.b₄ * W.b₈ ^ 4 +- + 24 * W.b₄ ^ 5 * W.b₆ ^ 2 * W.b₈ +- + 168 * W.b₂ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 3 +- + 1610 * W.b₂ * W.b₆ * W.b₈ ^ 4 +- + 10544 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 3 +- + (-27 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 2) +- + (-26 * W.b₂ ^ 3 * W.b₄ * W.b₆ * W.b₈ ^ 3) +- + (-20 * W.b₂ * W.b₄ ^ 4 * W.b₆ * W.b₈ ^ 2) +- + 76 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 4 * W.b₈ +- + 78 * W.b₂ * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 2 +- + 156 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 3 * W.b₈ +- + 484 * W.b₂ * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 3) * Polynomial.X ^ 6 +- + Polynomial.C (-336 * W.b₆ ^ 5 * W.b₈ + (-16 * W.b₄ ^ 5 * W.b₆ ^ 3) +- + (-4 * W.b₂ ^ 3 * W.b₈ ^ 4) + 48 * W.b₂ * W.b₆ ^ 6 +- + 516 * W.b₄ ^ 2 * W.b₆ ^ 5 + 6552 * W.b₆ * W.b₈ ^ 4 +- + (-1032 * W.b₄ ^ 3 * W.b₆ ^ 3 * W.b₈) +- + (-68 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 4) +- + (-20 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 5) +- + (-12 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₈ ^ 3) +- + (-4 * W.b₂ ^ 4 * W.b₆ * W.b₈ ^ 3) +- + 12 * W.b₂ ^ 3 * W.b₆ ^ 4 * W.b₈ +- + 80 * W.b₂ ^ 2 * W.b₆ ^ 3 * W.b₈ ^ 2 +- + 212 * W.b₄ ^ 4 * W.b₆ * W.b₈ ^ 2 +- + 304 * W.b₂ * W.b₄ ^ 3 * W.b₈ ^ 3 + 1272 * W.b₂ * W.b₄ * W.b₈ ^ 4 +- + 5552 * W.b₂ * W.b₆ ^ 2 * W.b₈ ^ 3 +- + 11312 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 3 +- + 12336 * W.b₄ * W.b₆ ^ 3 * W.b₈ ^ 2 +- + (-472 * W.b₂ * W.b₄ * W.b₆ ^ 4 * W.b₈) +- + (-44 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 2) +- + (-28 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 2) +- + 64 * W.b₂ * W.b₄ ^ 4 * W.b₆ ^ 2 * W.b₈ +- + 108 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 2 +- + 116 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ +- + 240 * W.b₂ ^ 2 * W.b₄ * W.b₆ * W.b₈ ^ 3) * Polynomial.X ^ 7 +- + Polynomial.C (-883 * W.b₆ ^ 6 + (-W.b₂ ^ 3 * W.b₆ ^ 5) + 198 * W.b₄ ^ 5 * W.b₈ ^ 2 +- + 216 * W.b₂ ^ 2 * W.b₈ ^ 4 + 790 * W.b₄ ^ 3 * W.b₆ ^ 4 +- + 4720 * W.b₄ ^ 3 * W.b₈ ^ 3 + 5526 * W.b₄ * W.b₈ ^ 4 +- + 26236 * W.b₆ ^ 2 * W.b₈ ^ 3 + (-918 * W.b₄ ^ 4 * W.b₆ ^ 2 * W.b₈) +- + (-270 * W.b₄ * W.b₆ ^ 4 * W.b₈) +- + (-70 * W.b₂ ^ 2 * W.b₆ ^ 4 * W.b₈) +- + (-22 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 4) +- + (-20 * W.b₂ * W.b₄ ^ 4 * W.b₆ ^ 3) +- + (-6 * W.b₂ ^ 4 * W.b₆ ^ 2 * W.b₈ ^ 2) +- + (-2 * W.b₂ ^ 4 * W.b₄ * W.b₈ ^ 3) +- + 32 * W.b₂ ^ 3 * W.b₆ * W.b₈ ^ 3 +- + 300 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₈ ^ 3 +- + 354 * W.b₂ * W.b₄ * W.b₆ ^ 5 + 7316 * W.b₂ * W.b₆ ^ 3 * W.b₈ ^ 2 +- + 21030 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 2 +- + (-1346 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈) +- + (-33 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 2) +- + 30 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 3 * W.b₈ +- + 54 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ +- + 72 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 2 +- + 588 * W.b₂ * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 2 +- + 10848 * W.b₂ * W.b₄ * W.b₆ * W.b₈ ^ 3) * Polynomial.X ^ 8 +- + Polynomial.C (-4494 * W.b₄ * W.b₆ ^ 5 + 62 * W.b₂ ^ 2 * W.b₆ ^ 5 +- + 506 * W.b₄ ^ 4 * W.b₆ ^ 3 +- + 1870 * W.b₂ * W.b₈ ^ 4 + 47004 * W.b₆ ^ 3 * W.b₈ ^ 2 +- + (-312 * W.b₄ ^ 5 * W.b₆ * W.b₈) +- + (-8 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ ^ 3) +- + (-2 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 4) +- + (-2 * W.b₂ ^ 3 * W.b₆ ^ 2 * W.b₈ ^ 2) +- + 2 * W.b₂ ^ 4 * W.b₆ ^ 3 * W.b₈ +- + 136 * W.b₂ ^ 3 * W.b₄ * W.b₈ ^ 3 +- + 550 * W.b₂ * W.b₄ ^ 4 * W.b₈ ^ 2 +- + 706 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 4 +- + 1610 * W.b₄ ^ 2 * W.b₆ ^ 3 * W.b₈ +- + 2042 * W.b₂ * W.b₆ ^ 4 * W.b₈ +- + 2344 * W.b₂ ^ 2 * W.b₆ * W.b₈ ^ 3 +- + 7136 * W.b₂ * W.b₄ ^ 2 * W.b₈ ^ 3 +- + 18064 * W.b₄ ^ 3 * W.b₆ * W.b₈ ^ 2 +- + 49456 * W.b₄ * W.b₆ * W.b₈ ^ 3 +- + (-1592 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈) +- + (-600 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 3 * W.b₈) +- + (-10 * W.b₂ ^ 4 * W.b₄ * W.b₆ * W.b₈ ^ 2) +- + 18 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ +- + 546 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 2 +- + 21708 * W.b₂ * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 2) * Polynomial.X ^ 9 +- + Polynomial.C (3532 * W.b₈ ^ 4 + (-9537 * W.b₄ ^ 2 * W.b₆ ^ 4) +- + (-936 * W.b₂ * W.b₆ ^ 5) +- + 24 * W.b₂ ^ 4 * W.b₈ ^ 3 + 114 * W.b₄ ^ 5 * W.b₆ ^ 2 +- + 6304 * W.b₄ ^ 4 * W.b₈ ^ 2 + 27864 * W.b₄ ^ 2 * W.b₈ ^ 3 +- + 35644 * W.b₆ ^ 4 * W.b₈ + (-W.b₂ ^ 5 * W.b₆ * W.b₈ ^ 2) +- + (-W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ ^ 3) +- + (-98 * W.b₂ ^ 3 * W.b₆ ^ 3 * W.b₈) +- + 192 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 4 +- + 532 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 3 +- + 578 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₈ ^ 2 +- + 3608 * W.b₂ ^ 2 * W.b₄ * W.b₈ ^ 3 +- + 4818 * W.b₂ ^ 2 * W.b₆ ^ 2 * W.b₈ ^ 2 +- + 5778 * W.b₄ ^ 3 * W.b₆ ^ 2 * W.b₈ +- + 19028 * W.b₂ * W.b₆ * W.b₈ ^ 3 +- + 131228 * W.b₄ * W.b₆ ^ 2 * W.b₈ ^ 2 +- + (-966 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈) +- + (-598 * W.b₂ * W.b₄ ^ 4 * W.b₆ * W.b₈) +- + 2 * W.b₂ ^ 4 * W.b₄ * W.b₆ ^ 2 * W.b₈ +- + 222 * W.b₂ ^ 3 * W.b₄ * W.b₆ * W.b₈ ^ 2 +- + 6986 * W.b₂ * W.b₄ * W.b₆ ^ 3 * W.b₈ +- + 26712 * W.b₂ * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 2) * Polynomial.X ^ 10 +- + Polynomial.C (8884 * W.b₆ ^ 5 + (-9916 * W.b₄ ^ 3 * W.b₆ ^ 3) +- + 12 * W.b₂ ^ 3 * W.b₆ ^ 4 +- + 640 * W.b₂ ^ 3 * W.b₈ ^ 3 + 36848 * W.b₆ * W.b₈ ^ 3 +- + (-4596 * W.b₂ * W.b₄ * W.b₆ ^ 4) +- + 36 * W.b₂ ^ 4 * W.b₆ * W.b₈ ^ 2 +- + 132 * W.b₂ * W.b₄ ^ 4 * W.b₆ ^ 2 +- + 180 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 3 +- + 288 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₈ ^ 2 +- + 1968 * W.b₂ ^ 2 * W.b₆ ^ 3 * W.b₈ +- + 6096 * W.b₄ ^ 4 * W.b₆ * W.b₈ +- + 11592 * W.b₂ * W.b₄ ^ 3 * W.b₈ ^ 2 +- + 24400 * W.b₂ * W.b₄ * W.b₈ ^ 3 +- + 49728 * W.b₂ * W.b₆ ^ 2 * W.b₈ ^ 2 +- + 124416 * W.b₄ * W.b₆ ^ 3 * W.b₈ +- + 134568 * W.b₄ ^ 2 * W.b₆ * W.b₈ ^ 2 +- + (-408 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ * W.b₈) +- + (-240 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 2 * W.b₈) +- + 12480 * W.b₂ ^ 2 * W.b₄ * W.b₆ * W.b₈ ^ 2 +- + 13560 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈) * Polynomial.X ^ 11 +- + Polynomial.C (-4902 * W.b₄ ^ 4 * W.b₆ ^ 2 + (-545 * W.b₂ ^ 2 * W.b₆ ^ 4) +- + 1932 * W.b₄ ^ 5 * W.b₈ + 5736 * W.b₂ ^ 2 * W.b₈ ^ 3 +- + 35344 * W.b₄ * W.b₆ ^ 4 + 45144 * W.b₄ * W.b₈ ^ 3 +- + 46752 * W.b₄ ^ 3 * W.b₈ ^ 2 + 105356 * W.b₆ ^ 2 * W.b₈ ^ 2 +- + (-7315 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 3) +- + (-18 * W.b₂ ^ 4 * W.b₆ ^ 2 * W.b₈) +- + 18 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 3 +- + 50 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆ ^ 2 +- + 68 * W.b₂ ^ 4 * W.b₄ * W.b₈ ^ 2 +- + 1960 * W.b₂ ^ 3 * W.b₆ * W.b₈ ^ 2 +- + 7602 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₈ ^ 2 +- + 45016 * W.b₂ * W.b₆ ^ 3 * W.b₈ +- + 173648 * W.b₄ ^ 2 * W.b₆ ^ 2 * W.b₈ +- + (-118 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ * W.b₈) +- + 7284 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 2 * W.b₈ +- + 12548 * W.b₂ * W.b₄ ^ 3 * W.b₆ * W.b₈ +- + 107360 * W.b₂ * W.b₄ * W.b₆ * W.b₈ ^ 2) * Polynomial.X ^ 12 +- + Polynomial.C (-912 * W.b₄ ^ 5 * W.b₆ + 6 * W.b₂ ^ 5 * W.b₈ ^ 2 +- + 12024 * W.b₂ * W.b₆ ^ 4 +- + 20232 * W.b₂ * W.b₈ ^ 3 + 59770 * W.b₄ ^ 2 * W.b₆ ^ 3 +- + 112576 * W.b₆ ^ 3 * W.b₈ + (-4656 * W.b₂ * W.b₄ ^ 3 * W.b₆ ^ 2) +- + (-1600 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 3) +- + 6 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆ ^ 2 +- + 1206 * W.b₂ ^ 3 * W.b₆ ^ 2 * W.b₈ +- + 2124 * W.b₂ ^ 3 * W.b₄ * W.b₈ ^ 2 +- + 3892 * W.b₂ * W.b₄ ^ 4 * W.b₈ +- + 22208 * W.b₂ ^ 2 * W.b₆ * W.b₈ ^ 2 +- + 54192 * W.b₂ * W.b₄ ^ 2 * W.b₈ ^ 2 +- + 108840 * W.b₄ ^ 3 * W.b₆ * W.b₈ +- + 217088 * W.b₄ * W.b₆ * W.b₈ ^ 2 +- + (-12 * W.b₂ ^ 4 * W.b₄ * W.b₆ * W.b₈) +- + 8514 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ * W.b₈ +- + 128256 * W.b₂ * W.b₄ * W.b₆ ^ 2 * W.b₈) * Polynomial.X ^ 13 +- + Polynomial.C (24720 * W.b₈ ^ 3 + 39812 * W.b₆ ^ 4 + (-69 * W.b₂ ^ 3 * W.b₆ ^ 3) +- + 210 * W.b₂ ^ 4 * W.b₈ ^ 2 + 24836 * W.b₄ ^ 4 * W.b₈ +- + 51722 * W.b₄ ^ 3 * W.b₆ ^ 2 + 101464 * W.b₄ ^ 2 * W.b₈ ^ 2 +- + (-1395 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ ^ 2) +- + (-1026 * W.b₂ * W.b₄ ^ 4 * W.b₆) +- + 2946 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₈ +- + 20544 * W.b₂ ^ 2 * W.b₄ * W.b₈ ^ 2 +- + 24296 * W.b₂ ^ 2 * W.b₆ ^ 2 * W.b₈ +- + 40930 * W.b₂ * W.b₄ * W.b₆ ^ 3 +- + 85700 * W.b₂ * W.b₆ * W.b₈ ^ 2 + 308736 * W.b₄ * W.b₆ ^ 2 * W.b₈ +- + 2394 * W.b₂ ^ 3 * W.b₄ * W.b₆ * W.b₈ +- + 116300 * W.b₂ * W.b₄ ^ 2 * W.b₆ * W.b₈) * Polynomial.X ^ 14 +- + Polynomial.C (2472 * W.b₂ ^ 3 * W.b₈ ^ 2 + 7232 * W.b₂ ^ 2 * W.b₆ ^ 3 +- + 22172 * W.b₄ ^ 4 * W.b₆ + 108016 * W.b₆ * W.b₈ ^ 2 +- + 132592 * W.b₄ * W.b₆ ^ 3 + (-380 * W.b₂ ^ 2 * W.b₄ ^ 3 * W.b₆) +- + (-100 * W.b₂ ^ 3 * W.b₄ * W.b₆ ^ 2) +- + 236 * W.b₂ ^ 4 * W.b₆ * W.b₈ +- + 1060 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₈ +- + 33232 * W.b₂ * W.b₄ ^ 3 * W.b₈ +- + 50972 * W.b₂ * W.b₄ ^ 2 * W.b₆ ^ 2 +- + 72816 * W.b₂ * W.b₄ * W.b₈ ^ 2 +- + 110896 * W.b₂ * W.b₆ ^ 2 * W.b₈ +- + 263536 * W.b₄ ^ 2 * W.b₆ * W.b₈ +- + 40912 * W.b₂ ^ 2 * W.b₄ * W.b₆ * W.b₈) * Polynomial.X ^ 15 +- + Polynomial.C (3710 * W.b₄ ^ 5 + 8 * W.b₂ ^ 4 * W.b₆ ^ 2 +- + 12320 * W.b₂ ^ 2 * W.b₈ ^ 2 +- + 43908 * W.b₂ * W.b₆ ^ 3 + 70896 * W.b₄ ^ 3 * W.b₈ +- + 85422 * W.b₄ * W.b₈ ^ 2 +- + 149190 * W.b₆ ^ 2 * W.b₈ + 157539 * W.b₄ ^ 2 * W.b₆ ^ 2 +- + (-37 * W.b₂ ^ 3 * W.b₄ ^ 2 * W.b₆) +- + 182 * W.b₂ ^ 4 * W.b₄ * W.b₈ +- + 4632 * W.b₂ ^ 3 * W.b₆ * W.b₈ +- + 16268 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₈ +- + 16744 * W.b₂ ^ 2 * W.b₄ * W.b₆ ^ 2 +- + 27268 * W.b₂ * W.b₄ ^ 3 * W.b₆ +- + 175520 * W.b₂ * W.b₄ * W.b₆ * W.b₈) * Polynomial.X ^ 16 +- + Polynomial.C (65230 * W.b₆ ^ 3 + 12 * W.b₂ ^ 5 * W.b₈ + 1794 * W.b₂ ^ 3 * W.b₆ ^ 2 +- + 5302 * W.b₂ * W.b₄ ^ 4 + 27230 * W.b₂ * W.b₈ ^ 2 +- + 79828 * W.b₄ ^ 3 * W.b₆ +- + 6 * W.b₂ ^ 4 * W.b₄ * W.b₆ + 3432 * W.b₂ ^ 3 * W.b₄ * W.b₈ +- + 12422 * W.b₂ ^ 2 * W.b₄ ^ 2 * W.b₆ +- + 27992 * W.b₂ ^ 2 * W.b₆ * W.b₈ +- + 66496 * W.b₂ * W.b₄ ^ 2 * W.b₈ + 97734 * W.b₂ * W.b₄ * W.b₆ ^ 2 +- + 223992 * W.b₄ * W.b₆ * W.b₈) * Polynomial.X ^ 17 +- + Polynomial.C (14684 * W.b₄ ^ 4 + 21868 * W.b₈ ^ 2 + W.b₂ ^ 5 * W.b₆ +- + 264 * W.b₂ ^ 4 * W.b₈ +- + 2982 * W.b₂ ^ 2 * W.b₄ ^ 3 + 14687 * W.b₂ ^ 2 * W.b₆ ^ 2 +- + 81548 * W.b₄ ^ 2 * W.b₈ + 139902 * W.b₄ * W.b₆ ^ 2 +- + 2466 * W.b₂ ^ 3 * W.b₄ * W.b₆ + 20136 * W.b₂ ^ 2 * W.b₄ * W.b₈ +- + 67922 * W.b₂ * W.b₆ * W.b₈ +- + 70114 * W.b₂ * W.b₄ ^ 2 * W.b₆) * Polynomial.X ^ 18 +- + Polynomial.C (180 * W.b₂ ^ 4 * W.b₆ + 824 * W.b₂ ^ 3 * W.b₄ ^ 2 +- + 1984 * W.b₂ ^ 3 * W.b₈ +- + 16324 * W.b₂ * W.b₄ ^ 3 + 40320 * W.b₂ * W.b₆ ^ 2 +- + 57464 * W.b₆ * W.b₈ +- + 97500 * W.b₄ ^ 2 * W.b₆ + 20040 * W.b₂ ^ 2 * W.b₄ * W.b₆ +- + 47624 * W.b₂ * W.b₄ * W.b₈) * Polynomial.X ^ 19 +- + Polynomial.C (22160 * W.b₄ ^ 3 + 36374 * W.b₆ ^ 2 + 112 * W.b₂ ^ 4 * W.b₄ +- + 1874 * W.b₂ ^ 3 * W.b₆ + 6675 * W.b₂ ^ 2 * W.b₄ ^ 2 +- + 6828 * W.b₂ ^ 2 * W.b₈ +- + 39492 * W.b₄ * W.b₈ +- + 54192 * W.b₂ * W.b₄ * W.b₆) * Polynomial.X ^ 20 +- + Polynomial.C (6 * W.b₂ ^ 5 + 1194 * W.b₂ ^ 3 * W.b₄ + 7420 * W.b₂ ^ 2 * W.b₆ +- + 11068 * W.b₂ * W.b₈ + 17840 * W.b₂ * W.b₄ ^ 2 +- + 48224 * W.b₄ * W.b₆) * Polynomial.X ^ 21 +- + Polynomial.C (79 * W.b₂ ^ 4 + 6872 * W.b₈ + 15692 * W.b₄ ^ 2 +- + 4724 * W.b₂ ^ 2 * W.b₄ +- + 12978 * W.b₂ * W.b₆) * Polynomial.X ^ 22 +- + Polynomial.C (412 * W.b₂ ^ 3 + 8440 * W.b₆ + 8216 * W.b₂ * W.b₄) * Polynomial.X ^ 23 +- + Polynomial.C (1064 * W.b₂ ^ 2 + 5306 * W.b₄) * Polynomial.X ^ 24 +- + Polynomial.C (1362 * W.b₂) * Polynomial.X ^ 25 +- + Polynomial.C 692 * Polynomial.X ^ 26) * b_relation_poly W ++ (2 * W.Ψ₃ ^ 3 * W.preΨ₄ - W.preΨ₄ ^ 2 * W.Ψ₂Sq ^ 2) * wronskian_aux_three W + ++ (W.preΨ₄ ^ 3 * W.Ψ₂Sq ^ 3) * wronskian_derivative_three W + ++ (W.Ψ₃ ^ 3 * W.preΨ₄ ^ 2 - 2 * W.preΨ₄ ^ 3 * W.Ψ₂Sq ^ 2) * ++ wronskian_three_derivative_two W + + end HasseWeil +diff --git a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/CNorm.lean b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/CNorm.lean +index 4dee067bc..528b604a5 100644 +--- a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/CNorm.lean ++++ b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/CNorm.lean +@@ -1,25 +1,11 @@ + import Mathlib.Algebra.Polynomial.Basic + + /-! +-# C-normalization simp set for polynomial ring tactics ++# Normalization of polynomial coefficients + +-`Polynomial.derivative_pow` produces `C ((n : ℕ) : R) * p^(n-1) * derivative p`, +-where `((n : ℕ) : R)` is `Nat.cast n`. On the other side of an identity, +-`Polynomial.C` is often applied to literals `(n : R)` which use `OfNat.ofNat`. +-`ring` sees `C (Nat.cast n : R)` and `C (OfNat.ofNat n : R)` as distinct atoms, +-blocking cancellation. +- +-The pair `Nat.cast_ofNat` (already `@[simp]` in mathlib) plus +-`Polynomial.C_ofNat` (not `@[simp]`) normalizes every `C k` for numeric `k` to +-the polynomial literal `(k : Polynomial R)`. `Polynomial.C_ofNat` must be +-explicitly included in `simp only` at call sites; this file just documents the +-intended usage. +- +-Typical use: +-``` +-simp only [..., Polynomial.C_ofNat, Polynomial.C_mul, Polynomial.C_sub, +- Polynomial.C_pow, Polynomial.C_add, ...] +-``` +-(`Nat.cast_ofNat` fires automatically since it is `@[simp]` — `simp only` +-actually does not pick it up, so include it too for safety.) ++`Polynomial.derivative_pow` introduces coefficients of the form ++`Polynomial.C (Nat.cast n : R)`. Numerical coefficients may instead be written ++with `OfNat.ofNat`, which polynomial ring normalization can treat as a distinct ++atom. Explicit simplification by `Nat.cast_ofNat` and `Polynomial.C_ofNat` ++identifies both forms with the corresponding polynomial numeral. + -/ +diff --git a/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/Prefix.lean b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/Prefix.lean +new file mode 100644 +index 000000000..b1df73ddd +--- /dev/null ++++ b/projects/HasseWeil/HasseWeil/Foundation/WronskianAux/Prefix.lean +@@ -0,0 +1,62 @@ ++import Mathlib.AlgebraicGeometry.EllipticCurve.DivisionPolynomial.Basic ++import Mathlib.Algebra.Polynomial.Derivation ++import Mathlib.Tactic.LinearCombination ++import HasseWeil.Foundation.WronskianAux.CNorm ++ ++ ++/- ++Copyright (c) 2026 Chris Birkbeck. All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Chris Birkbeck ++-/ ++ ++/-! ++# Third Wronskian identity ++ ++The third division-polynomial Wronskian identity follows from the Weierstrass ++coefficient relation. Its polynomial multiplier has degree eight. ++-/ ++ ++open WeierstrassCurve Polynomial ++ ++namespace HasseWeil ++ ++variable {R : Type*} [CommRing R] (W : WeierstrassCurve R) ++ ++-- The Weierstrass coefficient relation lifted to the polynomial ring, with ++-- coefficient maps distributed for polynomial normalization. ++lemma wronskian_b_relation_poly : ++ ((4 : R[X]) * Polynomial.C W.b₈ : R[X]) = ++ Polynomial.C W.b₂ * Polynomial.C W.b₆ - Polynomial.C W.b₄ ^ 2 := by ++ simpa [Polynomial.C_ofNat] using congrArg Polynomial.C W.b_relation ++ ++/-- Wronskian auxiliary identity, `m = 3` case (Silverman III.3.7). ++`4·Ψ₃³ + 2·preΨ₄·Ψ₂Sq·Ψ₃' − (preΨ₄·Ψ₂Sq)'·Ψ₃ ++= 3·preΨ₄·Ψ₂Sq² − 3·preΨ₄²`. ++ ++Multiplier: `M = b₈² + 4b₆b₈·X + 6b₄b₈·X² + 4b₂b₈·X³ + (b₂b₆ + 34b₈)·X⁴ ++ + 36b₆·X⁵ + 18b₄·X⁶ + 4b₂·X⁷ + 9·X⁸`. -/ ++lemma wronskian_aux_three : ++ 4 * W.Ψ₃ ^ 3 + 2 * W.preΨ₄ * W.Ψ₂Sq * Polynomial.derivative W.Ψ₃ - ++ Polynomial.derivative (W.preΨ₄ * W.Ψ₂Sq) * W.Ψ₃ = ++ Polynomial.C 3 * W.preΨ₄ * W.Ψ₂Sq ^ 2 - Polynomial.C 3 * W.preΨ₄ ^ 2 := by ++ linear_combination (norm := ( ++ simp only [Ψ₃, preΨ₄, Ψ₂Sq, ++ Polynomial.derivative_add, Polynomial.derivative_sub, ++ Polynomial.derivative_mul, Polynomial.derivative_pow, Polynomial.derivative_X, ++ Polynomial.derivative_C, Polynomial.derivative_ofNat, ++ Polynomial.C_add, Polynomial.C_sub, Polynomial.C_mul, Polynomial.C_pow, ++ Polynomial.C_ofNat, Nat.cast_ofNat] ++ ring)) ++ (Polynomial.C (W.b₈ ^ 2) ++ + Polynomial.C (4 * W.b₆ * W.b₈) * Polynomial.X ++ + Polynomial.C (6 * W.b₄ * W.b₈) * Polynomial.X ^ 2 ++ + Polynomial.C (4 * W.b₂ * W.b₈) * Polynomial.X ^ 3 ++ + Polynomial.C (W.b₂ * W.b₆ + 34 * W.b₈) * Polynomial.X ^ 4 ++ + Polynomial.C (36 * W.b₆) * Polynomial.X ^ 5 ++ + Polynomial.C (18 * W.b₄) * Polynomial.X ^ 6 ++ + Polynomial.C (4 * W.b₂) * Polynomial.X ^ 7 ++ + Polynomial.C 9 * Polynomial.X ^ 8) * wronskian_b_relation_poly W ++ ++ ++end HasseWeil +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/Infrastructure.lean b/projects/HasseWeil/HasseWeil/HasseBound/Infrastructure.lean +index 9facfb997176c5ac380d29e70848729672edc3fd..8c198b73959a7180a7e5398bfbe82ea2777afe6b 100644 +GIT binary patch +delta 2643 +zcmaJ@ZHN_B7-sHj!hk6$mLKUG;^Nw!yRH*r>&*IHM1?##LO9-Dj4?3|gq +zd#$*d1x3);5sJcemo&-BWd8J{K&U_Vp(|}vWGF&lko}ShEa*KmcV_QOiXxZs%=^CQ +zd7qCt_HoPEliDZR9rbmNLtUR*Pz;#mQ_hScC61j1n^vjd9+=Dq{81vT2Gl0Zr#>Y@ +z*LRf3P49ppuIZTt>QKK1rdJ9ocsvVRsN)b1T#qt~x~7wq7FfG(>q&8oS6nWzI%iPi +zUL|l$0U~f+rv^SYqs*q3=@T0^m_iU3qCO)+G!2#0yEqcF7)ecO@kQdI*nn^@X*SC`*@d&esSS9O=9^9CP?(Xi~iYxo&%B-%SP?NYG +z=S9H3y}6EDhiVZ$UhnY&VKflna>{(e;sNuM@oI7iURy+c0iGETXhf%=%q#fEbIVjz +z!fW?EqitL_>=P!UODG_*PYe;lj(t2Hl*)~3xPjvoOzWv=NpaJP=|Y4gL+ryRmQ2rt +z*Ve#P9C>tnwj6E0OU_u9t3w`KC=cp-yAikZ`4HAjm%3h505x^abrfoZG3EU<~fhm~;UPK{xC +z#I=mPWt{CJ9>@RpXcbRZ$tu;-Dx*LwA0GRXP}qkuyfB$ZJG`^ca_Nf1J~2vpP47*se;&T +zz~h0pm!LgV8-!FSdt@-69yT4hQK0W0ZBaNu)D +z)e`=@o>WOc(qKX$Tz!v4an@};fXmg+I1X}d!zz# +zY;d8xNaxFyrB->-8xMc=AI^jy4fSa9>b^blcr8B_AqS8jj)Q!1-#ksn=by`~Pv4MR +zpIyC75f%E@qm9&D0-O4q`HH$k@*q?WMVZRWFScnA(wE=Q$OEsu8G5hI(L(L@F)e$$ +z8dezv0?N3Q0+}zLm#s6D@>7@2L3sVpzoE=ab-&qla5F +zSmn=mLA&Qx@5#rG&dWBpH599=rlU*=Su(Kn{K2Jb+uG2YmTqesz;dTY7HeI%D%XuR +zwzMZXJ?TDKWep4ldf*Y*hK1zldxz!GV=twi@BsAXb3X4xPh=$5Es|tRvF}V(O&p@4 +z4S6Sz9AD57yppTyU^;O8$3)t&$U18{^T>&RwZ*rZSur1-D)3B4!pS+ylzk}vS|*x^ +z+A~)2NePYABd&)6V18sMc!fjZh`C;6bZpN`2bLKbU&P}9ceghX-5WLPMqZrC2{A`J +zz%z>6!3;)ALbFr_)Kj-{8p8yqH$Lsv>YWV7h&=#r7i&~yvgHISs??ito|Q15TueDq +zbkH$S{;8f(8*zA@b$iJ=&S(-3?u +zJK;Hz6({+r3tW$AxYKPM1Buae(Pa4W%()gVO4vAE@0=3ZvNJwc&cATHBl%cLnkkAm +z?uM-UpU9S@-<@p=>oq+wekl*|QWLe99pINw8v2G!k>>H2$j#q+B>6~@zkUC=oc6=Q +F{{V?d-7EkA + +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/PointCount.lean b/projects/HasseWeil/HasseWeil/HasseBound/PointCount.lean +index e004de056..c8fa5b0d3 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/PointCount.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/PointCount.lean +@@ -149,7 +149,7 @@ theorem card_kernel_eq_pointCount_of_kernel_eq_top + + /-- **Sub-helper III-4-015-S3** (fiber witness via degree = pointCount): + under separability + `β.degree = pointCount`, the fiber witness for the +-Hasse bound consumer ships axiom-clean. ++Hasse bound consumer exists. + + Proof chain: + 1. `β.degree = pointCount` (input). +@@ -215,7 +215,7 @@ omit [Fintype K] in + given `Aut(K(E₁)/α*K(E₂)) ≃ α.kernel` (the substantive Galois-correspondence + content for elliptic isogenies) and a witness for `Nat.card Aut = α.degree` + (the IsGalois card_aut_eq_finrank applied to our specific algebra), derive +-`Nat.card α.kernel = α.degree` axiom-clean. ++`Nat.card α.kernel = α.degree` . + + Reduces the III.4.10(a) wall to two named witnesses: + 1. `Nat.card Aut = α.degree` (IsGalois + finrank). +@@ -263,9 +263,9 @@ theorem card_aut_eq_degree_of_isGalois + W.toAffine.FunctionField _ _ β.toAlgebra.toModule) : + Nat.card (@AlgEquiv W.toAffine.FunctionField W.toAffine.FunctionField + W.toAffine.FunctionField _ _ _ β.toAlgebra β.toAlgebra) = β.degree := by +- letI := β.toAlgebra +- haveI := hgal +- haveI := hfin ++ let := β.toAlgebra ++ have := hgal ++ have := hfin + exact IsGalois.card_aut_eq_finrank W.toAffine.FunctionField W.toAffine.FunctionField + + /-- **Sub-helper III-4-015-S9** (full chain: IsGalois + bijection → fiber witness): +@@ -275,7 +275,7 @@ final closing-arc consumer. Takes: + - Aut ≃ β.kernel bijection (the substantive Galois-correspondence content). + + Produces the fiber witness used by the historical witness-parametric +-Hasse-bound route, axiom-clean. ++Hasse-bound route, . + + The cascade reduces T-III-4-015 to two named witnesses via this consumer: + 1. `IsGalois (α*K(E₂)) K(E₁)` (Mathlib has the structure; needs Normal). +@@ -346,7 +346,7 @@ theorem fiber_witness_via_inverse_witnesses + (aut_kernel_equiv_of_inverse_witnesses W β _ forward inverse + h_left_inv h_right_inv) + +-/-- **Forward map at k = 0** (axiom-clean): the translation by 0 is the identity ++/-- **Forward map at k = 0** (): the translation by 0 is the identity + algebra automorphism. -/ + noncomputable def aut_of_kernel_zero + {F : Type*} [Field F] [DecidableEq F] +@@ -354,7 +354,7 @@ noncomputable def aut_of_kernel_zero + W.toAffine.FunctionField ≃ₐ[F] W.toAffine.FunctionField := + AlgEquiv.refl + +-/-- **Forward map at k = 0 is the identity** (axiom-clean). -/ ++/-- **Forward map at k = 0 is the identity** (). -/ + @[simp] theorem aut_of_kernel_zero_apply + {F : Type*} [Field F] [DecidableEq F] + (W : WeierstrassCurve F) [W.toAffine.IsElliptic] +@@ -362,21 +362,9 @@ noncomputable def aut_of_kernel_zero + aut_of_kernel_zero W f = f := + rfl + +-/-- **Substantive partial forward-map construction** (Sub-helper III-4-015-S12): +-the forward map for the substantive cases requires the curve-translation +-algebra automorphism `τ_k : K(E) ≃ₐ[F] K(E)` defined by +-`τ_k(x_gen) = x-coord(P_gen + k)` and `τ_k(y_gen) = y-coord(P_gen + k)`. +- +-Construction parallels Worker A's `addPullbackAlgHom_negFrobenius`: +-1. Define `τ_k` via the addition formula (`addX`, `addY`). +-2. Show it's a K-algebra hom (well-defined modulo Weierstrass). +-3. Show it has inverse `τ_(-k)` (since τ is a group action). +-4. For k ∈ β.kernel, show `τ_k` fixes `β.pullback`'s image. +- +-This sub-helper takes the substantive `τ_k` AS A WITNESS — a precise +-statement of what's needed beyond what's currently in mathlib. The +-construction itself is ~200-300 LOC of `addCoordAlgHom`-style infrastructure +-applied to the translation map. -/ ++/-- A kernel-indexed family of translation algebra automorphisms. ++For a kernel point `k`, translation by `k` fixes the image of the pullback; ++the family is supplied as an explicit witness. -/ + noncomputable def aut_of_kernel_construction_witness + (β : Isogeny W.toAffine W.toAffine) + (translation_at : β.kernel → +@@ -400,7 +388,7 @@ noncomputable def kernelTranslateForward + kernelTranslateForward W β ⟨0, h_zero_mem⟩ = AlgEquiv.refl := rfl + + /-- **Layer 2 forward map under `β.toAlgebra`** (witness-parametric). +-Takes Worker A's `translateAlgEquivOfPoint W k.val` (an F-AlgEquiv) and ++Takes `translateAlgEquivOfPoint W k.val` (an F-AlgEquiv) and + the covariance identity `τ_k ∘ β.pullback = β.pullback` (provided as + hypothesis), and produces the `K(E)`-AlgEquiv (under `β.toAlgebra`) + consumed by the S10 bijection. -/ +@@ -425,7 +413,7 @@ noncomputable def kernelTranslateForwardAsAut + W.toAffine.FunctionField _ _ _ β.toAlgebra β.toAlgebra) := + fun k ↦ kernelTranslateAsAut W β k (h_invariance_family k) + +-/-- **`kernelTranslateAsAut` at `k = 0`** is the identity AlgEquiv (axiom-clean). ++/-- **`kernelTranslateAsAut` at `k = 0`** is the identity AlgEquiv (). + The `h_invariance` hypothesis at k = 0 is automatic since `τ_0 = refl`. -/ + @[simp] theorem kernelTranslateAsAut_zero + (β : Isogeny W.toAffine W.toAffine) +@@ -436,7 +424,7 @@ The `h_invariance` hypothesis at k = 0 is automatic since `τ_0 = refl`. -/ + kernelTranslateAsAut W β ⟨0, h_zero_mem⟩ h_invariance = + @AlgEquiv.refl W.toAffine.FunctionField W.toAffine.FunctionField + _ _ β.toAlgebra := by +- letI := β.toAlgebra ++ let := β.toAlgebra + apply AlgEquiv.ext + intro f + change translateAlgEquivOfPoint W (0 : W.toAffine.Point) f = f +@@ -474,6 +462,7 @@ omit [DecidableEq F] [W.toAffine.IsElliptic] in + (x : W.toAffine.FunctionField) : + x ∈ algHomFieldEqualizer W f g ↔ f x = g x := Iff.rfl + ++omit [DecidableEq F] in + /-- **Two `F`-AlgHoms `K(E) → K(E)` agreeing on `x_gen`, `y_gen` are equal**: + `K(E)` is generated over `F` by `x_gen` and `y_gen`. -/ + theorem algHom_ext_of_eq_on_xy [Fintype F] +@@ -553,7 +542,7 @@ theorem kernel_pullback_invariance_id + rw [translateAlgEquivOfPoint_zero] + rfl + +-/-- **`SMulCommClass` for Worker A's master action**: the translation ++/-- **Commuting scalar multiplication for the translation action**: the translation + action commutes with `F`-scalar multiplication because every + `translateAlgEquivOfPoint W k` is an F-AlgEquiv (hence F-linear). -/ + instance translateMulSemiringAction_smulCommClass : +@@ -564,7 +553,7 @@ instance translateMulSemiringAction_smulCommClass : + rw [Algebra.smul_def, Algebra.smul_def, map_mul, AlgEquiv.commutes] + + /-- **Restricted action**: `Multiplicative β.kernel` acts on `K(E)` via +-the inclusion `β.kernel → E.Point` composed with Worker A's master action ++the inclusion `β.kernel → E.Point` composed with the translation action + `translateMulSemiringAction`. -/ + noncomputable instance kernelMulSemiringAction + (β : Isogeny W.toAffine W.toAffine) : +@@ -632,12 +621,12 @@ theorem xy_family_zero + (β.pullback (y_gen W)) = β.pullback (y_gen W)) := + ⟨rfl, rfl⟩ + +-/-- **Layer 2 closure (witness-parametric on finrank match)**: under the ++/-- **Fixed-field equality from a rank equality**: under the + xy-covariance family + finrank equality, `β.pullback.fieldRange = + FixedPoints.intermediateField (Multiplicative β.kernel)`. + + Direct application of `IntermediateField.eq_of_le_of_finrank_eq'` to the +-forward inclusion (just shipped) plus the finrank-match witness. -/ ++forward inclusion plus the finrank-match witness. -/ + theorem pullback_fieldRange_eq_fixedField_of_finrank_match [Fintype F] + (β : Isogeny W.toAffine W.toAffine) + [hfindim : FiniteDimensional ↥β.pullback.fieldRange W.toAffine.FunctionField] +@@ -659,11 +648,11 @@ theorem pullback_fieldRange_eq_fixedField_of_finrank_match [Fintype F] + (pullback_fieldRange_le_fixedField_of_xy_family W β h_xy_family) + h_finrank_match + +-/-- **Layer 2 closure (Artin-machinery sourced)**: the finrank match ++/-- **Fixed-field equality from Artin's theorem**: the finrank match + witness can be sourced from Mathlib's `FixedPoints.finrank_eq_card` (which +-gives `[K(E) : FixedPoints] = |G|` axiom-clean from Faithful + Fintype) and ++gives `[K(E) : FixedPoints] = |G|` from Faithful + Fintype) and + the cardinality match `|β.kernel| = β.degree` (Silverman III.4.10(b), +-T-V-1-003 / V.1.3) plus the intrinsic relation ++V.1.3) plus the intrinsic relation + `[K(E) : β.pullback.fieldRange] = β.degree` (witness-parametric below). + + This is the **packaged Artin-route closure**: takes the Hasse-content card +@@ -707,11 +696,10 @@ theorem faithfulSMul_kernel_of_translate_inj + + /-- **`FaithfulSMul` (UNCONDITIONAL)**: discharges the witness in + `faithfulSMul_kernel_of_translate_inj` using +-`translateAlgEquivOfPoint_injective` (just shipped in `EC/TranslationOrd`). ++`translateAlgEquivOfPoint_injective` . + + Direct corollary: for any isogeny β over a finite field, the restricted +-action `kernelMulSemiringAction β` is faithful axiom-clean. This collapses +-the FaithfulSMul witness in the Layer-2 cascade — combined with finiteness ++action `kernelMulSemiringAction β` is faithful . Combined with finiteness + of β.kernel (over finite F), Mathlib's Artin machinery + (`FixedPoints.finrank_eq_card`) applies unconditionally. -/ + instance faithfulSMul_kernel +@@ -730,10 +718,10 @@ closure given the cardinality match `Fintype.card β.kernel = β.degree` + theorem finrank_pullback_fieldRange_eq_degree + (β : Isogeny W.toAffine W.toAffine) : + Module.finrank ↥β.pullback.fieldRange W.toAffine.FunctionField = β.degree := by +- letI inst1 : Algebra W.toAffine.FunctionField W.toAffine.FunctionField := β.toAlgebra +- letI inst_im : Algebra ↥β.pullback.fieldRange W.toAffine.FunctionField := ++ let inst1 : Algebra W.toAffine.FunctionField W.toAffine.FunctionField := β.toAlgebra ++ let inst_im : Algebra ↥β.pullback.fieldRange W.toAffine.FunctionField := + IntermediateField.toAlgebra _ +- letI mod_im : Module ↥β.pullback.fieldRange W.toAffine.FunctionField := ++ let mod_im : Module ↥β.pullback.fieldRange W.toAffine.FunctionField := + inst_im.toModule + change @Module.finrank ↥β.pullback.fieldRange W.toAffine.FunctionField _ _ mod_im = + β.degree +@@ -758,7 +746,7 @@ theorem finrank_pullback_fieldRange_eq_degree + exact (Algebra.finrank_eq_of_equiv_equiv i j h_compat).symm + + /-- **Layer 2 closure (UNCONDITIONAL on the intrinsic part)**: combines +-`pullback_fieldRange_eq_fixedField_of_finrank_match` with the just-shipped ++`pullback_fieldRange_eq_fixedField_of_finrank_match` with the + intrinsic finrank relation, leaving only the Hasse-content cardinality + match `Nat.card β.kernel = β.degree` as a witness. + +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorFallback.lean b/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorFallback.lean +index 6c96651f4795880dc78a3532568e069e75c9f7d2..cc60cff7787880be5b3c3d19acf7c586481df8fa 100644 +GIT binary patch +delta 1398 +zcmaize{54#6vuP!>)P%i;@HNvI?EjcWp-m@#vX|aO7X*9>aTvBwdElvf41^%Bu^{&2kRwp!B?Qr$%Y#4-*{HxlMOve +zVJ^zVwn`cbl=4GQY;)1>!}au+mSr3_Kj&CN?d9)m|J{|_QR8eGO-oyaT`O${KoENeo4kz6A6TaT6=^v$1*)~t#uBT3~p_kQ%kd>S(Hjo +z9W6S(*Ga=xF~!ZBcwJ=5A^Y>wJ3R&RV34M!r)_g?dMy6uk|lbrEBD_ewN9?(J9|yw +z-G|SwqEoLF(i8I@mRbf*erWa}(Ef9)S?WcQm$3o7^vxev(($*vnRxX_z6Ys2oojt- +zdEc3sl4bJN$u&wAg=ycJ;q2JHXVF1$@bPn-opu@@y;zbb7n^wM;%h+1zI~KU6oHS8 +zRY4Vlic^h`NuV!Da8+$T)ae@-!?L@ev5Q@19j3ze3XkeP|S-?7Dz2 +zn9T8rYoCMPA^N|B&z$113-GCveKQSJqWm)a4MHw^5qo|HNY>xH8ps5C&57y +zG6})Peqv%v?mNOH62u{*6H~KD5Vv<>4O^zB#{)zU65Y}wxFewltgxYD5=&^2xN7J9 +zmm{;KLW|V=E6$KLnW=|x(&{vgM5q&ot+@POvU;3sP`9TSHaTjNI5GE=c-quGJ84KY +z*7RUH5HL(Bj2e2-hH8-zX*V@BZkdUIm5>pvWxCVT>ZlRv(&g)yE#zmBhADbgC0t}2~@5`h{X~C^j$8k=nJBuyqpoqcYxTp4;{%}zs^7iiS`&8{-6AJ5gYm$z83Gl +Hfdc3sx_cCT + +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorTwoTorsion.lean b/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorTwoTorsion.lean +index 25f0c6948..31fbb612c 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorTwoTorsion.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/PoleDivisorTwoTorsion.lean +@@ -6,49 +6,20 @@ Authors: Chris Birkbeck + import HasseWeil.HasseBound.PoleDivisorFallback + + /-! +-# Bridge at `addPullbackNumerator_negFrobenius` for 2-torsion (T-T21-2TORSION-BRIDGE) +- +-The non-2-torsion bridge `bridge_at_addPullbackNumerator_negFrobenius_of_non_2_tor` +-(`PoleDivisorFallback.lean:2353`) goes through `bridge_at_x_gen_of_non_2_tor` +-(`PoleDivisorFallback.lean:606`), which uses +-`ord_P_translateX_xy_eq_neg_two_of_non_2_tor` (`EC/TranslationOrd.lean:1379`) +-as the substantive `= -2` identity at `−T` (with `T` non-2-torsion). +- +-This file ships the **2-torsion analogue**: +-`ord_P (translateX_xy W xT yT) = -2` at the smooth point `−T = T` (where +-`−T = T` modulo `Nonsingular`-prop-irrelevance for 2-torsion), and +-propagates it to the base bridges and the full +-`bridge_at_addPullbackNumerator_negFrobenius` at 2-torsion. +- +-The chain is: +- +-* `ord_P_x_gen_sub_const_ge_two_at_2tor` — `ord_P (x_gen − xk) ≥ 2` from the +- curve identity `(y − yk)·A = (x − xk)·(B − a₁·yk)` at 2-torsion T with +- `ord_P (y − yk) = 1`, `ord_P A ≥ 1`, `ord_P (B − a₁·yk) = 0`. +-* `ord_P_A_eq_one_at_2tor` — `ord_P A = 1` exactly via strict comparison +- `ord_P (y − yk) = 1 < 2 ≤ ord_P (a₁·(x − xk))` in `A = (y − yk) + a₁·(x − xk)`. +-* `ord_P_translateSlope_xy_eq_neg_one_at_2tor` — `ord_P slope = −1` exactly +- via `slope = (B − a₁·yk) / A` with `ord = 0 − 1 = −1`. +-* `ord_P_translateX_xy_eq_neg_two_at_2tor` — `ord_P translateX_xy = −2` +- exactly via `translateX_xy = slope² + rest` with strict comparison. +-* `bridge_at_x_gen_of_2_tor` — bridge `ord_P (τ_{−T} x_gen) = ord_∞ x_gen`. +-* `bridge_at_x_gen_pow_card_of_2_tor` — bridge for `x_gen^q`. +-* `bridge_at_y_gen_of_2_tor` and `bridge_at_y_gen_pow_card_of_2_tor` — +- y-side analogues, derived via `translateY_xy` analysis. +-* `bridge_at_addPullbackNumerator_negFrobenius_of_2_tor` — the full Num +- bridge at 2-torsion via the dominant-T7 strict comparison. +- +-After this lands, the chain `T21 → T22 → T23 → T24` (L6 closer) is +-unblocked: `support_card_eq_pointCount_of_two_torsion_ord_witness` +-(`L6Witnesses.lean:497`) consumes the 2-torsion ord witness, and the +-T22 composer becomes unconditional. +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, II.1, III.2. +-* `tickets/hasse/T-T21-2TORSION-BRIDGE.md` — the spawned sub-ticket. +-* `EC/TranslationOrd.lean:2566+` — the 2-torsion `A`-factorisation and +- per-piece order bounds. ++# Orders of translated coordinates at smooth two-torsion points ++ ++At a smooth two-torsion point `T`, the curve identity ++`(y − y_T)A = (x − x_T)(B − a₁y_T)` gives `ord_T(x − x_T) ≥ 2`. ++The factorization `A = (y − y_T) + a₁(x − x_T)` then gives `ord_T A = 1`, ++so the translation slope has order `-1`. Strict comparison in the addition ++formulas yields orders `-2` and `-3` for the translated x- and y-coordinates. ++ ++These coordinate orders identify local orders after translation with orders at ++infinity, including powers, products, and the reduced addition numerator for ++negative Frobenius. In that numerator the term `x · (π*x)²`, of order `-2-4q`, ++strictly dominates the other terms. ++ ++References: Silverman, *The Arithmetic of Elliptic Curves*, II.1 and III.2. + -/ + + open WeierstrassCurve HasseWeil.Curves +@@ -76,7 +47,7 @@ private lemma pi_y_gen_ne_zero_aux (hq : 2 ≤ Fintype.card K) : + rw [ordAtInfty_negFrobeniusIsog_pullback_y_gen W hq] at h_top + exact WithTop.coe_ne_top h_top + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **`ord_P (x_gen − xk) ≥ 2` at smooth 2-torsion `T`** via the curve + identity `(y − yk)·A = (x − xk)·(B − a₁·yk)` and the ord facts at + 2-torsion. -/ +@@ -117,7 +88,9 @@ theorem ord_P_x_gen_sub_const_ge_two_at_2tor (xk yk : K) + (y_gen W + algebraMap K KE yk + + algebraMap K KE W.a₁ * x_gen W + algebraMap K KE W.a₃)) := by + rw [h_LHS_mul, h_yd_ord] +- exact add_le_add (le_refl _) h_A_ge ++ calc ++ ((2 : ℤ) : WithTop ℤ) = ((1 : ℤ) : WithTop ℤ) + ((1 : ℤ) : WithTop ℤ) := by norm_num ++ _ ≤ _ := add_le_add le_rfl h_A_ge + have h_RHS_ord : ((2 : ℤ) : WithTop ℤ) ≤ (W_smooth W).ord_P P + ((x_gen W - algebraMap K KE xk) * + (x_gen W ^ 2 + x_gen W * algebraMap K KE xk + +@@ -143,7 +116,7 @@ theorem ord_P_x_gen_sub_const_ge_two_at_2tor (xk yk : K) + rw [h_mul_eq, h_Bma_ord, add_zero] at h_RHS_ord + exact h_RHS_ord + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **`ord_P A = 1` exactly at smooth 2-torsion `T`** via strict comparison + `ord_P (y − yk) = 1 < 2 ≤ ord_P (a₁·(x − xk))` in the factorisation + `A = (y − yk) + a₁·(x − xk)`. -/ +@@ -185,7 +158,7 @@ theorem ord_P_A_eq_one_at_2tor (xk yk : K) + have h_add := SmoothPlaneCurve.ord_P_add_eq_of_lt h_strict + exact h_add.trans h_yd_ord + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **`ord_P slope = -1` exactly at smooth 2-torsion `T`** via + `slope = (B − a₁·yk) / A` with `ord = 0 − 1 = −1` (using the + sharpened `ord_P A = 1`). -/ +@@ -233,7 +206,7 @@ theorem ord_P_translateSlope_xy_eq_neg_one_at_2tor (xk yk : K) + rw [h_mul, h_inv, h_Bma_ord, h_A_ord, zero_add] + rfl + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **`ord_P (translateX_xy) = -2` exactly at smooth 2-torsion `T`**: + `translateX_xy = slope² + (a₁·slope − a₂ − x_gen − xk)`. With + `ord_P slope = −1` exactly, `ord_P (slope²) = −2`, and the rest has +@@ -383,7 +356,7 @@ theorem ord_T_translateAlgEquivOfPoint_neg_x_gen_eq_neg_two_at_2tor (xT yT : K) + omit [Fintype K] in + /-- **Bridge at `f = x_gen` for 2-torsion `T`** (clean version): the analog of + `bridge_at_x_gen_of_non_2_tor` for 2-torsion. Composes the 2-torsion `ord_T` +-value with the shipped `ordAtInfty_x_gen = -2`. -/ ++value with the `ordAtInfty_x_gen = -2`. -/ + theorem bridge_at_x_gen_of_2_tor (xT yT : K) + (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) : + (W_smooth W).ord_P (⟨xT, yT, h_ns⟩ : (W_smooth W).SmoothPoint) +@@ -474,7 +447,7 @@ theorem bridge_at_x_gen_sub_negFrobeniusIsog_pullback_x_gen_of_2_tor (xT yT : K) + exact bridge_at_x_gen_sub_x_gen_pow_card_of_2_tor W xT yT h_ns h_2_tor hq + + /-- **Bridge at `(x_gen - (negFrob).pullback x_gen)^2` (slope-denominator squared)** +-for 2-torsion `T`. Pow on the just-shipped bridge for `x_gen - negFrob.pullback x_gen`. ++for 2-torsion `T`. Pow on the bridge for `x_gen - negFrob.pullback x_gen`. + Mirrors `bridge_at_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_of_non_2_tor`. -/ + theorem bridge_at_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor (xT yT : K) + (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) +@@ -492,7 +465,7 @@ theorem bridge_at_x_gen_sub_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor (xT yT : + W xT yT h_ns h_2_tor hq) 2 + + /-- **Bridge at `((negFrob).pullback x_gen)^2` for 2-torsion `T`**: pow on +-the just-shipped bridge for `(negFrob).pullback x_gen`. Mirrors the non-2-tor ++the bridge for `(negFrob).pullback x_gen`. Mirrors the non-2-tor + version (`bridge_at_negFrobeniusIsog_pullback_x_gen_sq_of_non_2_tor`). -/ + theorem bridge_at_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor (xT yT : K) + (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) : +@@ -525,7 +498,7 @@ theorem bridge_at_x_gen_mul_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor (xT yT : + (bridge_at_negFrobeniusIsog_pullback_x_gen_sq_of_2_tor W xT yT h_ns h_2_tor) + + /-- **Bridge at T6 = `x_gen² · (negFrob).pullback x_gen`** for 2-torsion `T`: +-mul on bridges for `x_gen²` (pow) and `(negFrob).pullback x_gen` (shipped). -/ ++mul on bridges for `x_gen²` (pow) and `(negFrob).pullback x_gen` . -/ + theorem bridge_at_x_gen_sq_mul_negFrobeniusIsog_pullback_x_gen_of_2_tor (xT yT : K) + (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) : + (W_smooth W).ord_P (⟨xT, yT, h_ns⟩ : (W_smooth W).SmoothPoint) +@@ -563,11 +536,10 @@ theorem bridge_at_x_gen_mul_negFrobeniusIsog_pullback_x_gen_of_2_tor (xT yT : K) + (bridge_at_x_gen_of_2_tor W xT yT h_ns h_2_tor) + (bridge_at_negFrobeniusIsog_pullback_x_gen_of_2_tor W xT yT h_ns h_2_tor) + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **`ord_P (x_gen − xk) = 2` EXACTLY at smooth 2-torsion `T`** via the curve + identity `(y − yk)·A = (x − xk)·(B − a₁·yk)` with the EXACT `ord_P A = 1` +-(shipped at `ord_P_A_eq_one_at_2tor`) and `ord_P (B − a₁·yk) = 0` (shipped at +-`ord_P_B_minus_a1_yk_eq_zero_at_2tor`). Tightens the shipped `≥ 2` to equality. -/ ++(given by `ord_P_A_eq_one_at_2tor`) and `ord_P (B − a₁·yk) = 0` (given by `ord_P_B_minus_a1_yk_eq_zero_at_2tor`). Tightens the `≥ 2` to equality. -/ + theorem ord_P_x_gen_sub_const_eq_two_at_2tor (xk yk : K) + (h_ns : W.toAffine.Nonsingular xk yk) (h_2_tor : yk = W.toAffine.negY xk yk) : + (W_smooth W).ord_P (negSmoothPoint W xk yk h_ns) +@@ -631,10 +603,9 @@ theorem ord_P_x_gen_sub_const_eq_two_at_2tor (xk yk : K) + rw [h_mul_eq, h_Bma_ord, add_zero] at h_RHS_ord + exact h_RHS_ord + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Nonnegativity of `ord_P` of the `T3` coefficient `yd·(a₂ + 2x + xk') − a₁²·yd`, given the basic +-order data. Extracted from `ord_P_translateY_xy_eq_neg_three_at_2tor` to keep its per-term `ord_P` +-bound bookkeeping under the default heartbeat budget. -/ ++order data. -/ + theorem ord_P_translateY_T3_coef_nonneg + {P : (W_smooth W).SmoothPoint} {yd a1 a2 xk' : KE} + (h_yd_ord : (W_smooth W).ord_P P yd = ((1 : ℤ) : WithTop ℤ)) +@@ -717,8 +688,7 @@ theorem ord_P_translateY_T3_coef_nonneg + + omit [Fintype K] [DecidableEq K] [W.toAffine.IsElliptic] in + /-- Nonnegativity of `ord_P` of the `T4` coefficient `−y + a₁·(a₂ + x + xk') − a₃`, given the basic +-order data. Extracted from `ord_P_translateY_xy_eq_neg_three_at_2tor` to keep its per-term `ord_P` +-bound bookkeeping under the default heartbeat budget. -/ ++order data. -/ + theorem ord_P_translateY_T4_coef_nonneg + {P : (W_smooth W).SmoothPoint} {a1 a2 a3 xk' : KE} + (h_xg_nn : (0 : WithTop ℤ) ≤ (W_smooth W).ord_P P (x_gen W)) +@@ -779,9 +749,9 @@ theorem ord_P_translateY_T4_coef_nonneg + SmoothPlaneCurve.ord_P_add_le (P := P) _ _ + exact (le_min h12' h_neg_a3_nn).trans h123 + +-omit [Fintype K] in ++omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Nonnegativity of `ord_P (y_gen)`: the generic `y`-coordinate has no pole at any smooth point, +-since its `pointValuation` is `≤ 1`. Extracted from `ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ ++since its `pointValuation` is `≤ 1`. -/ + private theorem ord_P_y_gen_nonneg {P : (W_smooth W).SmoothPoint} : + (0 : WithTop ℤ) ≤ (W_smooth W).ord_P P (y_gen W) := by + by_cases hf : y_gen W = 0 +@@ -794,7 +764,7 @@ private theorem ord_P_y_gen_nonneg {P : (W_smooth W).SmoothPoint} : + have hv : (W_smooth W).pointValuation P (y_gen W) ≠ 0 := + ((W_smooth W).pointValuation P).ne_zero_iff.mpr hf + simp only [SmoothPlaneCurve.ord_P] +- rw [dif_neg hv] ++ rw [dite_eq_right hv] + rw [show (0 : WithTop ℤ) = ((0 : ℤ) : WithTop ℤ) from rfl, + WithTop.coe_le_coe] + have h_unz_le : WithZero.unzero hv ≤ 1 := by +@@ -807,9 +777,9 @@ private theorem ord_P_y_gen_nonneg {P : (W_smooth W).SmoothPoint} : + rw [h1] at h2; exact h2 + omega + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The `T2` term `-(2·a₁·yd²·xd)` has `ord_P ≥ 4` at 2-torsion, given `ord_P yd = 1`, +-`ord_P xd = 2` and `ord_P a₁ ≥ 0`. Extracted from `ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ ++`ord_P xd = 2` and `ord_P a₁ ≥ 0`. -/ + private theorem ord_P_translateY_T2_term_ge_four + {P : (W_smooth W).SmoothPoint} {a1 yd xd : KE} + (h_yd_sq : (W_smooth W).ord_P P (yd ^ 2) = ((2 : ℤ) : WithTop ℤ)) +@@ -857,10 +827,9 @@ private theorem ord_P_translateY_T2_term_ge_four + (((2 : ℤ) : WithTop ℤ) + ((2 : ℤ) : WithTop ℤ)) := + add_le_add h_2a1_nn (le_refl _) + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The `T3` term `(yd·(a₂ + 2x + xk') - a₁²·yd)·xd²` has `ord_P ≥ 4` at 2-torsion: the +-coefficient is nonnegative (`ord_P_translateY_T3_coef_nonneg`) and `ord_P xd² = 4`. Extracted from +-`ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ ++coefficient is nonnegative (`ord_P_translateY_T3_coef_nonneg`) and `ord_P xd² = 4`. -/ + private theorem ord_P_translateY_T3_term_ge_four + {P : (W_smooth W).SmoothPoint} {a1 a2 yd xd xk' : KE} + (h_yd_ord : (W_smooth W).ord_P P yd = ((1 : ℤ) : WithTop ℤ)) +@@ -889,8 +858,7 @@ private theorem ord_P_translateY_T3_term_ge_four + + omit [Fintype K] [DecidableEq K] [W.toAffine.IsElliptic] in + /-- The `T4` term `(-y + a₁·(a₂ + x + xk') - a₃)·xd³` has `ord_P ≥ 6` at 2-torsion: the +-coefficient is nonnegative (`ord_P_translateY_T4_coef_nonneg`) and `ord_P xd³ = 6`. Extracted from +-`ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ ++coefficient is nonnegative (`ord_P_translateY_T4_coef_nonneg`) and `ord_P xd³ = 6`. -/ + private theorem ord_P_translateY_T4_term_ge_six + {P : (W_smooth W).SmoothPoint} {a1 a2 a3 xd xk' : KE} + (h_xd_cube_eq : (W_smooth W).ord_P P (xd ^ 3) = ((6 : ℤ) : WithTop ℤ)) +@@ -920,8 +888,7 @@ private theorem ord_P_translateY_T4_term_ge_six + + omit [Fintype K] [DecidableEq K] [W.toAffine.IsElliptic] in + /-- Extract `ord_P f = -3` from `ord_P (f · g) = 3` and `ord_P g = 6`: since `f · g` has finite +-order, `f ≠ 0`, so `ord_P f` is a finite integer `k` with `k + 6 = 3`. Extracted from +-`ord_P_translateY_xy_eq_neg_three_at_2tor` (with `g = xd³`). -/ ++order, `f ≠ 0`, so `ord_P f` is a finite integer `k` with `k + 6 = 3`. -/ + private theorem ord_P_eq_neg_three_of_mul_eq_three + {P : (W_smooth W).SmoothPoint} {f g : KE} + (h_LHS_ord : (W_smooth W).ord_P P (f * g) = ((3 : ℤ) : WithTop ℤ)) +@@ -949,8 +916,7 @@ private theorem ord_P_eq_neg_three_of_mul_eq_three + + omit [Fintype K] [DecidableEq K] [W.toAffine.IsElliptic] in + /-- A four-term sum `d + (A + (B + C))` has `ord_P` equal to that of its dominant term `d` when +-`ord_P d = 3` and each of `A`, `B`, `C` has `ord_P ≥ 4`. Extracted from +-`ord_P_translateY_xy_eq_neg_three_at_2tor`. -/ ++`ord_P d = 3` and each of `A`, `B`, `C` has `ord_P ≥ 4`. -/ + private theorem ord_P_dominant_sum_eq_three + {P : (W_smooth W).SmoothPoint} {d A B C : KE} + (h_d : (W_smooth W).ord_P P d = ((3 : ℤ) : WithTop ℤ)) +@@ -969,15 +935,14 @@ private theorem ord_P_dominant_sum_eq_three + exact lt_of_lt_of_le (by exact_mod_cast (show (3 : ℤ) < 4 by norm_num)) h_ABC + exact (SmoothPlaneCurve.ord_P_add_eq_of_lt h_strict).trans h_d + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **`ord_P (translateY_xy) = -3` at smooth 2-torsion `T`** via the algebraic + identity `translateY_xy_mul_cube_eq` and the 2-tor ord values +-`ord_P (yd) = 1` (shipped at `ord_P_y_gen_sub_negY_const_eq_one_of_2_tor`) +-+ `ord_P (xd) = 2` exactly (shipped at `ord_P_x_gen_sub_const_eq_two_at_2tor`). ++`ord_P (yd) = 1` (given by `ord_P_y_gen_sub_negY_const_eq_one_of_2_tor`) +++ `ord_P (xd) = 2` exactly (given by `ord_P_x_gen_sub_const_eq_two_at_2tor`). + At 2-tor the RHS dominant is `-yd³` with ord = 3, all other RHS terms have + ord ≥ 4 (strict); LHS = `translateY · xd³` has ord = `ord(translateY) + 6`, +-forcing `ord(translateY) = -3`. Mirrors the non-2-tor proof at +-`EC/TranslationOrd.lean:1536`. -/ ++forcing `ord(translateY) = -3`. Mirrors the non-2-tor proof at -/ + theorem ord_P_translateY_xy_eq_neg_three_at_2tor (xk yk : K) + (h_ns : W.toAffine.Nonsingular xk yk) (h_2_tor : yk = W.toAffine.negY xk yk) : + (W_smooth W).ord_P (negSmoothPoint W xk yk h_ns) +@@ -1072,11 +1037,7 @@ theorem ord_P_translateY_xy_eq_neg_three_at_2tor (xk yk : K) + -- ord_P translateY + 6 = 3 ⟹ ord_P translateY = -3. + exact ord_P_eq_neg_three_of_mul_eq_three W h_LHS_ord h_xd_cube_eq + +-/-- **Type abbreviation for the y-side substantive value at 2-torsion T**: +-`ord_P (translateY_xy) = -3` at the negated point. This is the single +-substantive witness the y-side chain reduces to. +- +-⟶ Now DISCHARGEABLE via `ord_P_translateY_xy_eq_neg_three_at_2tor` (just shipped). -/ ++/-- The y-coordinate after translation has order `-3` at the negated point. -/ + abbrev TwoTorYValueWitness (xT yT : K) (h_ns : W.toAffine.Nonsingular xT yT) : Prop := + (W_smooth W).ord_P + (negSmoothPoint W xT (W.toAffine.negY xT yT) +@@ -1084,7 +1045,7 @@ abbrev TwoTorYValueWitness (xT yT : K) (h_ns : W.toAffine.Nonsingular xT yT) : P + (translateY_xy W xT (W.toAffine.negY xT yT)) = + ((-3 : ℤ) : WithTop ℤ) + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- **Discharge `TwoTorYValueWitness` from the substantive y-side lemma**: at smooth + 2-torsion `T`, the y-side ord = -3 value follows directly from + `ord_P_translateY_xy_eq_neg_three_at_2tor` applied at the negated coordinates. -/ +@@ -1222,7 +1183,7 @@ theorem bridge_at_y_gen_of_2_tor (xT yT : K) + (twoTorYValueWitness_discharge W xT yT h_ns h_2_tor) + + /-- **Bridge at `f = y_gen^q` for 2-torsion `T` (UNCONDITIONAL)**: pow on the +-just-shipped unconditional y-side base bridge. -/ ++the y-coordinate order identity. -/ + theorem bridge_at_y_gen_pow_card_of_2_tor (xT yT : K) + (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) : + (W_smooth W).ord_P (⟨xT, yT, h_ns⟩ : (W_smooth W).SmoothPoint) +@@ -1246,7 +1207,7 @@ theorem bridge_at_y_gen_sub_y_gen_pow_card_of_2_tor (xT yT : K) + (twoTorYValueWitness_discharge W xT yT h_ns h_2_tor) hq + + /-- **Bridge at `(negFrob).pullback y_gen` for 2-torsion `T` (UNCONDITIONAL)**: +-mirrors `bridge_at_negFrobeniusIsog_pullback_y_gen_of_non_2_tor` (`PoleDivisorFallback.lean:1034`) ++mirrors `bridge_at_negFrobeniusIsog_pullback_y_gen_of_non_2_tor` + using the now-unconditional 2-tor y-side bridges. The pullback expands as + `-y_gen^q - a₁·x_gen^q - a₃`; strict-comparison isolates `-y_gen^q` with ord `-3q` + as the dominant term. -/ +@@ -1393,7 +1354,7 @@ theorem bridge_at_negFrobeniusIsog_pullback_y_gen_of_2_tor (xT yT : K) + (Conditional.ordAtInfty_neg_y_gen_pow_card_lt_rest W hq) + + /-- **Bridge at T1 = `a₄ · (x_gen + (negFrob).pullback x_gen)` for 2-torsion `T` (UNCONDITIONAL)**: +-const_mul on the strict-add bridge (already shipped). -/ ++const_mul on the strict-add bridge (proved). -/ + theorem bridge_at_T1_a4_x_add_pi_x_of_2_tor (xT yT : K) + (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) + (hq : 2 ≤ Fintype.card K) : +@@ -1719,7 +1680,7 @@ under `hq`, **UNCONDITIONAL**. + Mirror of `bridge_at_addPullbackNumerator_negFrobenius_of_non_2_tor`: apply + `ord_P_translateAlgEquivOfPoint_sum_dominant` with dom = T7 (x · π·x², + ord = -2-4q) and the same seven other terms; the per-term bridges are the +-2-torsion versions just shipped, and the strict-comparison framework is ++2-torsion versions proved, and the strict-comparison framework is + identical because the `ordAtInfty_T*_ge` bounds are universal in T. -/ + theorem bridge_at_addPullbackNumerator_negFrobenius_of_2_tor (xT yT : K) + (h_ns : W.toAffine.Nonsingular xT yT) (h_2_tor : yT = W.toAffine.negY xT yT) +@@ -1811,7 +1772,7 @@ theorem bridge_at_addPullbackNumerator_negFrobenius_of_2_tor (xT yT : K) + /-- **Bridge at `addPullback_x W (negFrobeniusIsog W)`** for 2-torsion T + under `hq`, **UNCONDITIONAL**. Discharges the + `bridge_at_addPullback_x_negFrobenius_of_bridge_at_Num` Conditional consumer +-with the just-shipped 2-tor Num bridge. ++with the 2-tor Num bridge. + + Note: `bridge_at_addPullback_x_negFrobenius_of_bridge_at_Num` requires a + non-2-torsion hypothesis only for its appeal to +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/Primitives.lean b/projects/HasseWeil/HasseWeil/HasseBound/Primitives.lean +index 7b7c9f9bdd2de81fd56ed1658ddd95a0088e6cef..bc3351f74e8f72d1c306fa97c7af59533db0a65e 100644 +GIT binary patch +delta 9240 +zcmb_iZH!!18P0ACttZiz#2Q*kIZYdxS!QN;+foo%bSVWEO1o+6R^+4i&diyeL+{)> +zz4y-UPNUocNdXOrxtOR41pFicJ#+nBf)OVl1*P$ij|hTAh_dJh3ggg4X#rbwrqL4 +z+A=Naw+q~~tGp@~r02N2Vws*NJjM>z1$TwlvV0FeEz^%haMR~Uglh|nHyvr?w(sz! +zD;t8#sxU2&OB*5s{P4xRYg&-$cr8~H81CD?thITwWm#pja>V0KP3e(QYf<`jJ_lVZ +zbt%d%dp=T7xDwl_ICfR~(y<}ecg>23g!)o=B~D65J1G>^R+2rK&8F2R)x?5u+q_aY +z@wN}49xw_&z539G?L0SK7S{6d@Mg2(lx4oaIG>rBDeVZ4ub$kmP|}d)3+nn6xSz{v +zitF^$TxqfdVLp`cL=)?jEvN-71Td^|W0Dv7nd3%2-21U_1pAa-)O!j7A+xTqD?&pFrCeW{Bo^wyF|igGOHE5wq|fW^rUQj=xx~UJKhX)MZ7qx& +z#cc+UUg9+k9|1++_CPfcK;VaD25#UjJk2CDlr|j26B@aB;WUKr%1Yw8^jxE5ncQm% +z?A?;bgcndK_;r9EFTGe7HiPMM2lFu2J{XDsbj^mW$%;vSjCHDFi40~;k{#hc29!Cx +zFSkUmU>_xR0FHA&TF|Fq+Hk$nq +zGVBXjL&+#NDu|-M9uht!-fdq>ACqBm%lAJ+rtDDywv0`}6+&cL#I8hsE}K}lCWTcE +zf4=n(yQ5W895b@Cqmm~^xpatGO5w!#mEmtc{k?#6iK4Nnb6Js)j2)d~ELt$tm|`9g +z(X$APputv}NHhY~saoPU#t~*(7HX2$s?;fksk%}(5n6auR$I{qxj2ec9PNUo8z;j- +zZo@nRTN5-<+Kq$NSbp&9TpXU|HT;|6wgIu#7K{rulY4Z%H|WmOR=KJ0)Jj4koG7ka +zP5x#=&2S{QuJgO%H6!bI?#u~}P|wXeR@-(O$P4_IPHueDkXzy5iLr6U#*3TzmMxhY +z7?oxf<*Le2X+`OzDi^NV`PG2lDe`GvLk)9Wc}%AgI3H4yFDX6hE9Evfjv7G1bz1ZF +z%nD7{S%6Fg1j7SG#Ifr*zDkukhJ>XuHEgbM?3Q~$nn7g4oEIh58NcfHBkc1wlBw%q +z*WszD3-?0XY)NU+OkG+L-5lsZ*# +zk(F&Rudg6SI97{pMpbjp(EI}SP2_U})wjSc;p5Z&1}`I8BSOLfSS(B@0mXeto-xOl +zAN*#3$_>Z4{pg(r*BQ^q&5iM6`MZwl%lM4CH%)AV+@BUG@RmoPDGgOp^>wZ6238k< +z=y6*m(gkp|6rOQnZi%*D-B~0*H+_bMNIwo`rszNVjJ3m`)i#Dd*tfp(%ylE@Uq74K +zrm2C+0v~AytLe0rc{%}wh0pEZ*qONbmGf0fh_6$*jF9KB4B51p0$y=Y(xi>*4`$hC +z!9)gJ-S%p5Amwsk3wG6Xt69-$81Py^Wqrv|mBVPm$*J}Vi9D3B%NA-Y9-2cqqe`ln +zq3BH(%qU%xOW3yoyxIr$YP!<2eGmacB?f`L?`Cxh0%raqSU!Li)neIPUpd0Fs{tihgW*8KHXk1A +z+;e+4ddEz(9+GSKg1l*gw`&`J;2xNf?g1vb1*{0h>})>#&PV{Q(6h`78%d6c@tmQ9 +zKJsj`U)H-3Tb|cKn?f0*TYEfa$ST+&v9BWK47DBQTH2=uC>mtYMumzAx9P)SRYh)> +zcrOSnMm+@qE|w95bQ^6_H8YCB>pY`^qXMr|nG>1@Om=4o+E<31nby20yC$zY4g7JN +zD2$DQX8Niy_rq6WGe}V=DU@9CH!ajaM**Bo%^%lflydX7T%~iW_MKI?QZx*JDzia? +zIwz|IUi<*RRKBz+e0^z6__@}a@ZsBK_)1`ePd>XUyylMS@R2WH+SzclJn~WanNx$C +zr8*@hAa5oOHgp=^zej>;-BD!>oFN*DgJhwOA}}LXr*jlbLP=S+>>xB$vxdI3x2uup +zYEo{`&5pD1?y6v>-{$>GYmXV=9;qSN`{>%eZne6L()YAAf0NVbTpK(yiXv=#zT2w! +zDwcYJkk?$NfoM>Pvp)zm>8|)J8-kgfO-wSihAxOvFB_B1OX!*IxQyE|1#WoT{hQGu +z4eVRpMk14l~AS0#LgP1doUSZo@UB3MM^fLjD~o +zwWGiTZK3*Bppv84C+8!v6%<+&Xc`Dn(xginR^8Wu&Xle|eBScJC7n0FR>m&%a6{>+ +zhBC^<)lfmt7YyG;9;b$Ol3zxoT>Vy5pY%)vMM`-sGw5z~t?zj)1_Z0CWm=7q%eK;X +zV7~LQwIjid9y7%pSaF%T%s?q|Hr-doHlcl+s3imamYX!biHH%QGgu&6LoZN~fi7Fc +zfics_5$t)s{FM_Nzrb!NVf;EwF4T^@ydcKjGf}4^3XU|;6Z9#uN^~ba5A~=m3bYZC +z#c19^6|D`6NB-jpjC~R^#!);4+B01fYb{$lzUm=+FxC^VZXQKQk;B9s8O{gZIR@gH +zaAet_@d1d?Ko~l2e|t)k84{HtjHK;Agi)UK98GPnKzu!u=BWKn!9fLsr9cREvlvBN +z(^-TsWKvw`;1latDn|8Tlpt(B3MD4KyME>TZt7}P2zFU7$~G{IrlT345(kKTA=U-k +zz#Par7d`!`qEB(DPO=Im))YXp0yQm!i>6j_@=mE>FB8-gu2}F;Zpw@xC3bL+Jug3x +z#GttG9!-qz!;d9&Rp51*oW+biND8@je50M`<2;u>N1>%g0D9`^=^&(l^#rCqs>4-d +zJF{R{S-RC2$01&?Xzj(%-m`LdYNA?_N1|2Iz>3QQ48|CSlF9+euF*&=e962hAauLC +zzeFJHK{Hd2)u@zeCyoYK+NtBfB_fwD3mnss*X^sI*HlTNSvw61frzS9pS6oB&bcLP +zer60pkE9}ty)=QqQ_&Ot<0l)g+^xmy{LyFhXr-=&s6;Ip;j1UNbRK@8z2ZYkXd9hZ +zPg*O2TTLIw1OQm6c}Ou_)Usa9vuc^vMH +z{o?Ua>O;`h>)|@gW2ovihlGz7Jg#JDO%CF@0T~lvkekg@X*|kj5(VHhFlSd;xXYm@q-|P^qG2jYBSaOobCck{18q1$uZS24(Lrp7jzmyGumwV +zIAB!gA8ndKYi1e6Ud+aT4#`l9W9<#J_$+Q>L-QC?Hj|+q3%8z~3@2W@IT*g1x-qYOj6x5Inqn`eW|RZR +z3be{N9zuGN&`AL%ueHeiXnCdPIEG)!vQ-(5y}owr +zYQ?{{moCqoT;jxu2IO`{HZehsOznkN{^{}X)SIiqEq|W9diMeycE(_53>_tWWpA`< +ziN$G`+Th`D{&?YS@#r!!L6;-p=n6exG%SeM?{#^~HhRO#`Sh=shfghkOKJJw8+(fx +zf9Q1woi?*}3b&ozawIhtjth$2hq+8Eo5V!w^IBD$IIDK0+wq6k30=-3Z}WAt3CyWK +z@o>%A%SKpu_1O*6yl&!fTFd1spoTeRUn>Q0kPpJse|x%f>dk+Rg#Y>bTO$XUIq+lUh~< +zJwgLRkN8*wp6&|JO`zt0CE+-ZVhx8pI5J4}ZP}6o;j_By_^A(+*cVUKjY +zPX+n(V|@9cC;3ENT{8;|!7b^R;#k(E(7jWjCfOV=ftkL?Z7673gZyW*v?H#tbilI( +zhg{TdSv;$B!>I}@YXA2L#C#Q)sEcUaz>25%QjTWDlX>;y^vQgHwoXklk#xGg#*oA@ +zXfB8&gCR9YklMFy7A&5EMcM!Jmfb}39TQ|5q(4n7flT7KVhNNJ +zMpUC_)lp=8kSPppikiaEWxE@GK65^ug5#SRTmSoFu&WD%B2B8bO;lSGL5uC)9rw3J +zPBj`+d;%Qphtzf4511#2u|3V>dz0PwFcXHKLa-0AhkY^}!y@;?2QCI9#usP$l~ACB +zzj|lu-t_Q(8fW*>JeMj>^3{j|uV?pg6=P$3pBmA)?QqAri3>`&a3EHJGzi=0Cf1>* +Rs55!BCGGRbU?={!^Zyl&|9Joa + +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/SepDegreeEqPointCount.lean b/projects/HasseWeil/HasseWeil/HasseBound/SepDegreeEqPointCount.lean +index b0f7c26f8594ff8704015e2653ececd9d147c830..fcdb5384128782484b7f84f20c3c1e14fb287923 100644 +GIT binary patch +delta 1421 +zcmaKs&x;gC6vvs-_@fCT5z&jwOJ>CxogNt!4I38^>jq&^7M0B@acX+rOqX_7HC5H~ +z10j=BPTuO6z3R!3NRvYX@#t~If5U@E&v{kdGhs!9fuXyr-uu?)eZTc$v3L8=Ms0B) +zGp5)eK^Wp#Ap#RaFfoG2(*Y`wBT&q6DOduTDCX6;y;f}`amRHuN +z9iLa$2_BGeZD?zXq!b32$SFiJ&7?-aS(fmKo3e8oGR4ztNNU_UoeU=-lxm17i07Fk +z3L14AxG3dIl|rtOEao}|Nx0}EGi49Ef8w1zeDX>0>g3-w`~0hW +zi{Nq?dM=;xUPXoQjL32aOx$*6QK;RtbIrw=Y)WG{s8SqqN4)efVM2-rts2a|%H;ve +zDV;btCcAg~S+RR|z5c(h(iqe~%@gJ=DI%V+BwQw;LSL;|*_2G33lmgxEqhZ^4n~>g +z)nBI4PuTg!<@)p|gKeL!{ZZ_;KGf~|Z;sgQ#+`Gp0b4OsJJ5p+HZ~#lPXR#8CTL$a +zp4+GEZ|%?LCwEt%S0chnc`4C(@Z%U&$Zj*j>>MbFHwbsAO$- +zLHKm~OrkQJRnF9_oJ7n=B5|g#g5q}vKIL=|(TznEROxufgR)!Zr0P(CZ^If-v!t4; +zyZ9(?gnVThqSY-PbbqTCjjKoMr=WSy5!#W-T*#EuZP_cLYsYKFzt?}Q6VBC~YRN{2)9t6}5oq#TK<0dw!* +z$w@b_e4e>OqNg$-ou2H13_AS)rb<2~Ocx3v$4Ji2K~`eCo11F>w1&WVFR#gbp8Yyu +zKv=0%mR0Jiw>E4}yE6;T6-E2O^pCpMZ?MyH$R3)h2Evh`!e&2gY@9yAY@N{IyxDQ> +zloChEH*L+0)AuA&?g`8=j{G>wY?=N2^r5`~twfHyufl&9b{Cj;s23ANN&KU7jH;q6 +zvooloz1OI6rI`((pk&p|Y+G(7m{V4^C7B0St#laoJ-@~*Sz83=Ryv8|-&phZO`b&a +z*;lp=F<4W9x&N(K2ZGbgKl(<0n3q1B2j=F^H3Q?0XnO`M +zH&1;!ILSQt`PsgL&oooMbf)pvG&p@DMlQC_89-t&ix(8Y6S2+lUfG?q8b-$!zzh7< +zBB8bwKUTmC(Fm#cJ}&l+lLoO8HY+qO;`XU-R!9{Em`kq3@C?1V +z7~Z3npTHiPvjlc0Im5MzrYn9r9f6U2rwq+~2c)fs;k-iuS0b=wF=XfWp%2qc$h~JKOl!yEx^kv(ho5c`1~?-06#njm-Tq(sFmv# +z?w^MnCBAMk&P=4vrFft9mBpu3qL{a*9>t0kf)`BnSX39(jVekFG2PaU>~m`Mip~`A +z6=4?N1rrsYXA}!*ObrV&C8T=lVyi-*Hob4yx!6?Z)7%24E}#k?`_<(FO_)_Rj*e7K +zwyYNjSAMldb;l$g@F`B6lmcr`zZiafeKNET>eu2}e09gIdVWpmh^|1ol(g +zOE?_q>uq>|#qI~w6}Re_?*`<0wn(dU+)u-=I+9_RQnLHr+;iVYc-U=3sbY%qAIJiQJM+{dRTQNYFtI{ +z?!sZTVGj<1Dmu0s|N5;ya*dY`4dLcqOEmfK;NPO%o_GlJ>{>a>i&!aLco7R`6c^ip +z)ToV$r&w^fuG_s(iCe1+2=aRs&98)YabgEGpP1X#k+^KSM|4sLc2dJ*$Y|SnOyh;e +z@oH=W_M|1rCvl;5m77n&e_|p}`3nwC;OsQ+=^!8ReA=ge_xwgUlYXXRA%@ +zN*aCyvmH#l=FfEDKIB~&u?bRH;e3mZ<(e-N5a+ZwEN9ck%lM-k(xZV_L|T hf ?_, hc⟩ + simpa [h] using hc + ++omit [DecidableEq F] in + /-- If `τ g / g` has trivial projective divisor, then `τ g` is a nonzero scalar multiple + of `g`. -/ + theorem pairing_const_of_transport [IsAlgClosed F] [W.IsElliptic] +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorPullback.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorPullback.lean +index aa75199b4..8789a8842 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorPullback.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorPullback.lean +@@ -10,55 +10,23 @@ import HasseWeil.HasseBound.WeilPairing.SigmaBridge + import HasseWeil.HasseBound.WeilPairing.TorsionGeometric + + /-! +-# Divisor-pullback functoriality for the separable multiplication-by-`ℓ` isogeny ++# Divisor pullback for multiplication by `ℓ` + +-For a separable isogeny `φ = [ℓ]` (`(ℓ : F) ≠ 0`, `[IsAlgClosed F]`) and a nonzero rational +-function `h ∈ K(E)`, the divisor of the pulled-back function `φ.pullback h` equals the geometric +-pullback of `div h`: +-``` +-divisorOf (φ.pullback h) = pullback-of-divisor (divisorOf h). +-``` +-Because `[ℓ]` is **separable** (unramified — every fibre is étale, multiplicity `1`), the pullback +-of a single place `(Q)` is the multiplicity-free fibre sum `Σ_{φP=Q} (P)` (the repo's +-`pullbackDiv`, `WeilPairing/Pullback.lean`). The geometric heart is the per-place +-**unramified order-transport** +-``` +-ord_P (φ.pullback h) = ord_{φ(P)} (h) (no ramification factor `e_P > 1`), +-``` +-which, summed over all places, yields the divisor identity. This is Silverman III.4.10c / +-III.8.1–2 in divisor language: the geometric content of the separability of `[ℓ]`. +- +-## Architecture +- +-* **Item 1 — the core (`OrdTransport` / `ordTransport_mulByInt`).** The per-place transport +- `ord_P P (φ.pullback h) = (ord of h at φ(P))` is the deep geometric unramifiedness statement. +- It is the exact isogeny analogue of the translation order-transport proven in +- `EC/TranslateValuation.lean` + `EC/TranslateOrdInfty.lean` (≈5000 lines): a valuation on `K(E)` +- pinned by its values on `x_gen`, `y_gen`. For an isogeny the base values +- `ord_P P (φ.pullback x_gen)`, `ord_P P (φ.pullback y_gen)` are the `ℓ`-division-polynomial orders, +- whose computation is the genuine ramification content. We **isolate** this as the named predicate +- `OrdTransport` (a per-`(P, φ)` hypothesis bundling the projective place transport) and prove the +- full divisor assembly on top of it. +- +-* **Item 2 — the assembly (`projectiveDivisorOf_pullback_eq_pullbackDivisor`).** Given the core +- for every place, the projective divisor of `φ.pullback h` equals the fibre-pullback of the +- projective divisor of `h`. This is a pure `Finsupp` computation: every coefficient matches by +- the core, and the supports are related by the (finite) fibre structure. Fully proven modulo the +- core. +- +-* **Item 3 — the pairing-facing corollaries.** `pullback_divisorOf_eq_of_divisorOf_eq` (the +- shape bilinearity-in-`T` and nondegeneracy consume) and the III.8.1 relation +- `weilFunction_pow_mem_pullback_range`-style statement, parametric on the core. +- +-Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10c, III.8.1, III.8.2. ++For a separable multiplication-by-`ℓ` isogeny over an algebraically closed field, ++the geometric pullback of a place is the multiplicity-free fiber sum. ++The per-place hypothesis `OrdTransport` expresses the unramified order identity ++`ord_P (φ*h) = ord_{φ(P)} h`, including the projective place at infinity. ++Summing these identities over all places identifies the projective divisor of ++`φ*h` with the fiber pullback of the divisor of `h`. ++ ++References: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10c, ++III.8.1, and III.8.2. + -/ + + open WeierstrassCurve HasseWeil.Curves + + namespace HasseWeil.WeilPairing.DivisorPullback + +-set_option linter.unusedSectionVars false +- + variable {F : Type*} [Field F] [DecidableEq F] {W : WeierstrassCurve.Affine F} [W.IsElliptic] + + /-- Local abbreviation for the function field `K(E)` (`= (⟨W⟩ : SmoothPlaneCurve F).FunctionField`), +@@ -70,6 +38,7 @@ local notation3 "KE" => W.toAffine.FunctionField + noncomputable def projOrdAt (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField) (Q : W.Point) : ℤ := + (⟨W⟩ : SmoothPlaneCurve F).projectiveDivisorOf f Q.toProjectiveSmoothPoint + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W] in + theorem projOrdAt_some (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField) {x y : F} + (h : W.Nonsingular x y) : + projOrdAt f (Affine.Point.some x y h) = +@@ -77,6 +46,7 @@ theorem projOrdAt_some (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField) {x y : + rw [projOrdAt, Affine.Point.toProjectiveSmoothPoint_some, + (⟨W⟩ : SmoothPlaneCurve F).projectiveDivisorOf_apply_affine f ⟨x, y, h⟩] + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W] in + theorem projOrdAt_zero (f : (⟨W⟩ : SmoothPlaneCurve F).FunctionField) : + projOrdAt f (0 : W.Point) = ((⟨W⟩ : SmoothPlaneCurve F).ordAtInfty f).untopD 0 := by + rw [projOrdAt, Affine.Point.toProjectiveSmoothPoint_zero, +@@ -107,7 +77,7 @@ theorem coeff_affine_pullback_eq {φ : Isogeny W W} + + /-- **The fibre-pullback of a projective divisor** under a point-map endomorphism with finite + kernel: `φ*(D) = Σ_v D(v) · pullbackDiv(v)`, the `ℤ`-linear extension of the multiplicity-free +-fibre pullback `pullbackDiv` (`WeilPairing/Pullback.lean`) over the (projective) places of `D`. ++fibre pullback `pullbackDiv` over the (projective) places of `D`. + The place at infinity pulls back to `pullbackDiv f h 0 = Σ_{φP=O}(P)` (the kernel). -/ + noncomputable def pullbackDivisor (f : W.Point →+ W.Point) (hf : Finite f.ker) + (D : ProjectiveDivisor (⟨W⟩ : SmoothPlaneCurve F)) : +@@ -154,10 +124,10 @@ theorem pullbackDiv_apply (f : W.Point →+ W.Point) (hf : Finite f.ker) + (Q : W.Point) (w : ProjectiveSmoothPoint (⟨W⟩ : SmoothPlaneCurve F)) : + pullbackDiv f hf Q w = if f w.toAffinePoint = Q then 1 else 0 := by + classical +- letI : Fintype {R : W.Point // f R = Q} := @Fintype.ofFinite _ (fiber_finite f hf Q) ++ let : Fintype {R : W.Point // f R = Q} := @Fintype.ofFinite _ (fiber_finite f hf Q) + rw [pullbackDiv, Finsupp.finsetSum_apply] + by_cases hwQ : f w.toAffinePoint = Q +- · rw [if_pos hwQ] ++ · rw [ite_eq_left hwQ] + have hwproj : (⟨w.toAffinePoint, hwQ⟩ : {R : W.Point // f R = Q}).val.toProjectiveSmoothPoint = + w := Affine.Point.toAffinePoint_toProjectiveSmoothPoint w + rw [Finset.sum_eq_single (⟨w.toAffinePoint, hwQ⟩ : {R : W.Point // f R = Q})] +@@ -173,7 +143,7 @@ theorem pullbackDiv_apply (f : W.Point →+ W.Point) (hf : Finite f.ker) + exact Subtype.ext hRval + · intro hni + exact absurd (Finset.mem_univ _) hni +- · rw [if_neg hwQ] ++ · rw [ite_eq_right hwQ] + refine Finset.sum_eq_zero (fun R _ ↦ ?_) + rw [Finsupp.single_eq_of_ne] + intro hcontra +@@ -209,9 +179,9 @@ theorem pullbackDivisor_apply (f : W.Point →+ W.Point) (hf : Finite f.ker) + intro v _ + rw [Finsupp.coe_smul, Pi.smul_apply, pullbackDiv_apply, smul_eq_mul] + by_cases hv : f w.toAffinePoint = v.toAffinePoint +- · rw [if_pos hv, mul_one, if_pos] ++ · rw [ite_eq_left hv, mul_one, ite_eq_left] + rw [hv, Affine.Point.toAffinePoint_toProjectiveSmoothPoint] +- · rw [if_neg hv, mul_zero, if_neg] ++ · rw [ite_eq_right hv, mul_zero, ite_eq_right] + intro hcontra + apply hv + have := congrArg ProjectiveSmoothPoint.toAffinePoint hcontra +@@ -219,8 +189,8 @@ theorem pullbackDivisor_apply (f : W.Point →+ W.Point) (hf : Finite f.ker) + rw [Finset.sum_congr rfl hterm, + Finset.sum_ite_eq D.support (f w.toAffinePoint).toProjectiveSmoothPoint (fun v ↦ D v)] + by_cases hmem : (f w.toAffinePoint).toProjectiveSmoothPoint ∈ D.support +- · rw [if_pos hmem] +- · rw [if_neg hmem, Finsupp.notMem_support_iff.mp hmem] ++ · rw [ite_eq_left hmem] ++ · rw [ite_eq_right hmem, Finsupp.notMem_support_iff.mp hmem] + + /-- **The per-place core, projective form.** For the isogeny `φ`, the coefficient of + `projectiveDivisorOf (φ.pullback h)` at the projective place `w` equals the coefficient of +@@ -336,7 +306,7 @@ theorem inftyOrdTransport_mulByInt (ℓ : ℤ) (hℓ : ℓ ≠ 0) (hℓF : (ℓ + rw [hm, hn, WithTop.untopD_coe, WithTop.untopD_coe] + omega + +-/-- **Comap-valuation identity, affine-image case** (proven, axiom-clean). The comap of ++/-- **Comap-valuation identity, affine-image case** . The comap of + `pointValuation P` along `[ℓ].pullback` equals `pointValuation` at the affine image smooth point + `⟨x, y, h_ns⟩`. This is the unramifiedness of `[ℓ]` at an affine image (Silverman III.4.10c). -/ + theorem comap_pointValuation_mulByInt_eq_affine [IsAlgClosed F] (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) +@@ -529,8 +499,7 @@ Hence `φ.pullback f_T` and `g_T^ℓ` have the *same* divisor, so they differ by + (`Constancy`): the relation `f_T ∘ [ℓ] = c · g_T^ℓ` that nondegeneracy consumes. + + Parametric on the per-place core `ProjOrdTransport [ℓ]` (`= projOrdTransport_mulByInt`), and on the +-finiteness of `ker[ℓ]` (the caller supplies `mulByInt_ker_finite`, keeping this file decoupled from +-`Pairing.lean`/`TorsionCardEll`). The conclusion's right side is exactly `ℓ • (div g_T)`. -/ ++finiteness of `ker[ℓ]`. The conclusion's right side is exactly `ℓ • (div g_T)`. -/ + theorem projectiveDivisorOf_pullback_weilFunction (ℓ : ℤ) + [hker : Finite (mulByInt W ℓ).toAddMonoidHom.ker] (hcore : ProjOrdTransport (mulByInt W ℓ)) + (T : W.Point) {fT : (⟨W⟩ : SmoothPlaneCurve F).FunctionField} +@@ -573,7 +542,7 @@ divisor the Abel–Jacobi divisor `D = (T₁+T₂) − (T₁) − (T₂) + (O)`, + they differ by a constant. + + Parametric on the per-place core `ProjOrdTransport [ℓ]` (`= projOrdTransport_mulByInt`) and the +-finiteness of `ker[ℓ]` (caller-supplied, decoupling this file from `Pairing.lean`). -/ ++finiteness of `ker[ℓ]`. -/ + theorem projectiveDivisorOf_pullback_bilinFunction (ℓ : ℤ) + [hker : Finite (mulByInt W ℓ).toAddMonoidHom.ker] (hcore : ProjOrdTransport (mulByInt W ℓ)) + (T₁ T₂ : W.Point) {k : (⟨W⟩ : SmoothPlaneCurve F).FunctionField} +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorTranslate.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorTranslate.lean +index 5aa369762..ba8eced54 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorTranslate.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/DivisorTranslate.lean +@@ -11,7 +11,7 @@ import HasseWeil.HasseBound.WeilPairing.WeilFunction + /-! + # Divisor transport under translation + +-This file proves the projective divisor transport facts for translation by a ++We prove the projective divisor transport facts for translation by a + point on a Weierstrass curve, as used in the Weil pairing construction. + + ## Main definitions +@@ -38,8 +38,6 @@ namespace HasseWeil + + open HasseWeil.WeilPairing + +-set_option linter.unusedSectionVars false +- + variable {F : Type*} [Field F] [DecidableEq F] + variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] + +@@ -53,6 +51,7 @@ noncomputable def placeTranslate (S : W.toAffine.Point) : + ((Equiv.addRight S).trans + (WeierstrassCurve.Affine.Point.equivProjectiveSmoothPoint (W := W.toAffine))) + ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + theorem placeTranslate_apply (S : W.toAffine.Point) + (v : ProjectiveSmoothPoint (W_smooth W)) : + placeTranslate W S v = +@@ -60,6 +59,7 @@ theorem placeTranslate_apply (S : W.toAffine.Point) + (v.toAffinePoint + S) := by + rfl + ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + @[simp] theorem placeTranslate_affine (S : W.toAffine.Point) + (P : (W_smooth W).SmoothPoint) : + placeTranslate W S (ProjectiveSmoothPoint.affine P) = +@@ -68,6 +68,7 @@ theorem placeTranslate_apply (S : W.toAffine.Point) + rw [placeTranslate_apply] + rfl + ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + @[simp] theorem placeTranslate_infinity (S : W.toAffine.Point) : + placeTranslate W S ProjectiveSmoothPoint.infinity = + S.toProjectiveSmoothPoint := by +@@ -75,6 +76,7 @@ theorem placeTranslate_apply (S : W.toAffine.Point) + change (((0 : W.toAffine.Point) + S)).toProjectiveSmoothPoint = _ + rw [zero_add] + ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Translation by `O` is the identity place permutation. -/ + @[simp] theorem placeTranslate_zero : + placeTranslate W (0 : W.toAffine.Point) = Equiv.refl _ := by +@@ -89,13 +91,16 @@ noncomputable def ordProj (v : ProjectiveSmoothPoint (W_smooth W)) + | ProjectiveSmoothPoint.affine P => (W_smooth W).ord_P P f + | ProjectiveSmoothPoint.infinity => (W_smooth W).ordAtInfty f + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + @[simp] theorem ordProj_affine (P : (W_smooth W).SmoothPoint) (f : KE) : + ordProj W (ProjectiveSmoothPoint.affine P) f = (W_smooth W).ord_P P f := rfl + ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + @[simp] theorem ordProj_infinity (f : KE) : + ordProj W ProjectiveSmoothPoint.infinity f = (W_smooth W).ordAtInfty f := rfl + + set_option backward.isDefEq.respectTransparency.types false in ++omit [DecidableEq F] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The coefficient of `projectiveDivisorOf f` at `v` is `(ordProj v f).untopD 0`. -/ + theorem projectiveDivisorOf_apply_ordProj (f : KE) + (v : ProjectiveSmoothPoint (W_smooth W)) : +@@ -119,6 +124,7 @@ theorem ord_P_translate (P : (W_smooth W).SmoothPoint) + · exact translate_ord_eq_all_nonzero W P xk yk h_ns h f hf + + set_option backward.isDefEq.respectTransparency.types false in ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + /-- If `P + S` is finite, `placeTranslate W S (affine P)` is the translated affine place. -/ + theorem placeTranslate_affine_of_isSome (S : (W_smooth W).toAffine.Point) + (P : (W_smooth W).SmoothPoint) +@@ -132,6 +138,7 @@ theorem placeTranslate_affine_of_isSome (S : (W_smooth W).toAffine.Point) + P S h).symm + + set_option backward.isDefEq.respectTransparency.types false in ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + /-- When `P + S = O` (the translate hits infinity), the place + `placeTranslate W S (affine P)` is the place at infinity. -/ + theorem placeTranslate_affine_eq_infinity (S : (W_smooth W).toAffine.Point) +@@ -283,6 +290,7 @@ theorem projectiveDivisorOf_translate_div_eq_zero_of_invariant + _ = 0 := by rw [hself, sub_self] + + set_option backward.isDefEq.respectTransparency.types false in ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The `toAffinePoint` of a translated place is `w.toAffinePoint + S`. -/ + theorem placeTranslate_toAffinePoint (S : (W_smooth W).toAffine.Point) + (w : ProjectiveSmoothPoint (W_smooth W)) : +@@ -299,7 +307,7 @@ theorem pullbackDiv_apply (f : W.toAffine.Point →+ W.toAffine.Point) + (w : ProjectiveSmoothPoint (W_smooth W)) : + pullbackDiv (W := W.toAffine) f hker Q w = + if f w.toAffinePoint = Q then (1 : ℤ) else 0 := by +- letI : Fintype {P : W.toAffine.Point // f P = Q} := ++ let : Fintype {P : W.toAffine.Point // f P = Q} := + @Fintype.ofFinite _ (fiber_finite f hker Q) + rw [pullbackDiv, Finset.sum_apply'] + simp only [Finsupp.single_apply] +@@ -314,19 +322,19 @@ theorem pullbackDiv_apply (f : W.toAffine.Point →+ W.toAffine.Point) + rw [hPeq, + WeierstrassCurve.Affine.Point.toAffinePoint_toProjectiveSmoothPoint] + by_cases hQ : f w.toAffinePoint = Q +- · rw [if_pos hQ, Finset.sum_eq_single (⟨w.toAffinePoint, hQ⟩ : ++ · rw [ite_eq_left hQ, Finset.sum_eq_single (⟨w.toAffinePoint, hQ⟩ : + {P : W.toAffine.Point // f P = Q})] +- · rw [if_pos ((hkey w.toAffinePoint).mpr rfl)] ++ · rw [ite_eq_left ((hkey w.toAffinePoint).mpr rfl)] + · rintro ⟨P, hP⟩ _ hne +- rw [if_neg] ++ rw [ite_eq_right] + intro hPw + exact hne (Subtype.ext ((hkey P).mp hPw)) + · intro h + exact absurd (Finset.mem_univ _) h +- · rw [if_neg hQ] ++ · rw [ite_eq_right hQ] + apply Finset.sum_eq_zero + rintro ⟨P, hP⟩ _ +- rw [if_neg] ++ rw [ite_eq_right] + intro hPw + exact hQ (by + rw [← (hkey P).mp hPw] +@@ -366,6 +374,7 @@ theorem equivMapDomain_placeTranslate_pullbackDiv (S : (W_smooth W).toAffine.Poi + rw [Finsupp.equivMapDomain_symm_apply] + exact pullbackDiv_placeTranslate_apply_general W S f hker Q w + ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + /-- `equivMapDomain` fixes a divisor invariant under `placeTranslate W S`. -/ + theorem equivMapDomain_placeTranslate_symm_eq_self + (S : (W_smooth W).toAffine.Point) +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Fiber.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Fiber.lean +index 2d0e9d56e..5a54b5281 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Fiber.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Fiber.lean +@@ -6,20 +6,6 @@ Authors: Chris Birkbeck + import Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Point + import Mathlib.Tactic + +-/-! +-# Route 2A — fibres of point-map endomorphisms as kernel cosets (keystone foundation) +- +-The multiplicity-free geometric divisor pullback `β*((Q)) = Σ_{βP=Q} (P)` (separable case, used by +-both the Weil-pairing construction and the separable adjoint, Silverman III.8) is summed over the +-**fibre** `{P : βP = Q}`. This file ships the group-theoretic foundation: a fibre of a point-map +-endomorphism is a coset of the kernel, hence finite when the kernel is finite. +- +-This is the point-map (`AddMonoidHom`) form of the project's `EC.Isogeny` fibre machinery — the +-level at which the Weil pairing and the pullback divisor operate. +- +-Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4 (fibres of an isogeny are cosets of +-the kernel). +--/ + + namespace HasseWeil.WeilPairing + +@@ -29,8 +15,7 @@ open WeierstrassCurve + + variable {F : Type*} [Field F] [DecidableEq F] {W : WeierstrassCurve.Affine F} [W.IsElliptic] + +-/-- **Fibre as a kernel coset.** Given `f P₀ = Q`, the fibre `{P : f P = Q}` is in canonical +-bijection with `ker f` via `P ↦ P − P₀`. -/ ++ + def fiberEquivKer (f : W.Point →+ W.Point) {P₀ Q : W.Point} (hP₀ : f P₀ = Q) : + {P : W.Point // f P = Q} ≃ f.ker where + toFun := fun ⟨P, hP⟩ => ⟨P - P₀, by rw [AddMonoidHom.mem_ker, map_sub, hP, hP₀, sub_self]⟩ +@@ -38,16 +23,15 @@ def fiberEquivKer (f : W.Point →+ W.Point) {P₀ Q : W.Point} (hP₀ : f P₀ + left_inv := fun ⟨P, hP⟩ => by simp + right_inv := fun ⟨T, hT⟩ => by simp + +-/-- **Fibres are finite when the kernel is.** -/ ++ + theorem fiber_finite (f : W.Point →+ W.Point) (h : Finite f.ker) (Q : W.Point) : + Finite {P : W.Point // f P = Q} := by + rcases Classical.em (∃ P₀, f P₀ = Q) with ⟨P₀, hP₀⟩ | hempty + · exact Finite.of_equiv _ (fiberEquivKer f hP₀).symm +- · haveI : IsEmpty {P : W.Point // f P = Q} := ⟨fun ⟨P, hP⟩ => hempty ⟨P, hP⟩⟩ ++ · have : IsEmpty {P : W.Point // f P = Q} := ⟨fun ⟨P, hP⟩ => hempty ⟨P, hP⟩⟩ + infer_instance + +-/-- **Fibre cardinality = kernel cardinality** (for a nonempty fibre). The constant fibre size that +-makes `deg = #ker` for a separable isogeny (Silverman III.4.10c). -/ ++ + theorem fiber_card_eq_ker_card (f : W.Point →+ W.Point) {P₀ Q : W.Point} (hP₀ : f P₀ = Q) : + Nat.card {P : W.Point // f P = Q} = Nat.card f.ker := + Nat.card_eq_of_bijective _ (fiberEquivKer f hP₀).bijective +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobMatrixData.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobMatrixData.lean +index 30cf18d00..7da5769f2 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobMatrixData.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobMatrixData.lean +@@ -9,7 +9,7 @@ import HasseWeil.Isogeny.BaseChange.Basic + /-! + # Frobenius matrix data over the algebraic closure + +-This file supplies the per-`ℓ` Frobenius-matrix determinant data used by ++The per-`ℓ` Frobenius-matrix determinant data give the hypotheses of + `hasse_bound_via_weil_pairing`, after base-changing `E/K` to `AlgebraicClosure K`. + + ## Main definitions +@@ -29,10 +29,6 @@ This file supplies the per-`ℓ` Frobenius-matrix determinant data used by + * Silverman, *The Arithmetic of Elliptic Curves*, III.8.1 (the pairing + Galois equivariance), + III.8.6 (`det φ_ℓ = deg φ`), V.1.1 / V.2.3.1 (the Hasse bound assembly). + +-## Name-clash note +- +-`pullbackDivisor_kappaDivisor` is declared in both `HfactLemma.lean` and `PairingNondeg.lean`. +-This file imports neither directly, so no clash arises and no rename is needed. + -/ + + open WeierstrassCurve Real Matrix +@@ -155,7 +151,7 @@ theorem frob_det_residual_baseChange + (1 - M).det = ((Fintype.card K + 1 - + isogTrace (frobeniusIsog W) (isogOneSub_negFrobenius W hq) : ℤ) : ZMod ℓ) ∧ + ((r' : ZMod ℓ) • M - (s' : ZMod ℓ) • 1).det = (deg r' s' : ZMod ℓ) := by +- letI : Fact ℓ.Prime := ⟨hℓp⟩ ++ let : Fact ℓ.Prime := ⟨hℓp⟩ + obtain ⟨hπ, h1, hrs⟩ := hsc + have hDd : ((deg r' s').toNat : ℤ) = deg r' s' := Int.toNat_of_nonneg (hdeg_nonneg r' s') + exact frob_det_residual_of_weil_scaling (W.baseChange L) ℓ hℓF +@@ -193,7 +189,7 @@ theorem hres_of_baseChange_scalings + (1 - M).det = ((Fintype.card K + 1 - + isogTrace (frobeniusIsog W) (isogOneSub_negFrobenius W hq) : ℤ) : ZMod ℓ) ∧ + ((r' : ZMod ℓ) • M - (s' : ZMod ℓ) • 1).det = (deg r' s' : ZMod ℓ) := by +- haveI : CharP L p := charP_of_injective_algebraMap (FaithfulSMul.algebraMap_injective K L) p ++ have : CharP L p := charP_of_injective_algebraMap (FaithfulSMul.algebraMap_injective K L) p + obtain ⟨hFrob, hOneSub, hPencil⟩ := hscale + intro r' s' hps ℓ hℓp hℓne + have hℓF : (ℓ : L) ≠ 0 := +@@ -218,7 +214,7 @@ theorem hres_of_baseChange_scalings_coprime + (1 - M).det = ((Fintype.card K + 1 - + isogTrace (frobeniusIsog W) (isogOneSub_negFrobenius W hq) : ℤ) : ZMod ℓ) ∧ + ((r' : ZMod ℓ) • M - (s' : ZMod ℓ) • 1).det = (deg r' s' : ZMod ℓ) := by +- haveI : CharP L p := charP_of_injective_algebraMap (FaithfulSMul.algebraMap_injective K L) p ++ have : CharP L p := charP_of_injective_algebraMap (FaithfulSMul.algebraMap_injective K L) p + obtain ⟨hFrob, hOneSub, hPencil⟩ := hscale + intro r' s' hpr hps ℓ hℓp hℓne + have hℓF : (ℓ : L) ≠ 0 := +@@ -238,16 +234,16 @@ theorem hasse_bound_unconditional_of_baseChange_scalings + |(↑(pointCount W.toAffine) - ↑(Fintype.card K) - 1 : ℝ)| ≤ + 2 * Real.sqrt (Fintype.card K : ℝ) := by + obtain ⟨p, hCharP, ⟨n, _hn⟩, hp_prime, hcard⟩ := FiniteField.card' K +- haveI : Fact p.Prime := ⟨hp_prime⟩ +- haveI : CharP K p := hCharP +- haveI : Fact (Fintype.card K = p ^ (n : ℕ)) := ⟨hcard⟩ ++ have : Fact p.Prime := ⟨hp_prime⟩ ++ have : CharP K p := hCharP ++ have : Fact (Fintype.card K = p ^ (n : ℕ)) := ⟨hcard⟩ + have hpchar : ringChar K = p := by rw [ringChar.eq_iff]; exact hCharP +- haveI : ExpChar (AlgebraicClosure K) p := ++ have : ExpChar (AlgebraicClosure K) p := + haveI : CharP (AlgebraicClosure K) p := + charP_of_injective_algebraMap + (FaithfulSMul.algebraMap_injective K (AlgebraicClosure K)) p + ExpChar.prime hp_prime +- haveI : (W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic := inferInstance ++ have : (W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic := inferInstance + exact hasse_bound_via_weil_pairing W hq deg hdeg_nonneg + (hres_of_baseChange_scalings W p (n : ℕ) (AlgebraicClosure K) hq deg hdeg_nonneg hpchar + (hscale p (n : ℕ) ⟨hp_prime⟩ hCharP ⟨hcard⟩)) +@@ -261,16 +257,16 @@ theorem hasse_bound_unconditional_of_baseChange_scalings_coprime + |(↑(pointCount W.toAffine) - ↑(Fintype.card K) - 1 : ℝ)| ≤ + 2 * Real.sqrt (Fintype.card K : ℝ) := by + obtain ⟨p, hCharP, ⟨n, _hn⟩, hp_prime, hcard⟩ := FiniteField.card' K +- haveI : Fact p.Prime := ⟨hp_prime⟩ +- haveI : CharP K p := hCharP +- haveI : Fact (Fintype.card K = p ^ (n : ℕ)) := ⟨hcard⟩ ++ have : Fact p.Prime := ⟨hp_prime⟩ ++ have : CharP K p := hCharP ++ have : Fact (Fintype.card K = p ^ (n : ℕ)) := ⟨hcard⟩ + have hpchar : ringChar K = p := by rw [ringChar.eq_iff]; exact hCharP +- haveI : ExpChar (AlgebraicClosure K) p := ++ have : ExpChar (AlgebraicClosure K) p := + haveI : CharP (AlgebraicClosure K) p := + charP_of_injective_algebraMap + (FaithfulSMul.algebraMap_injective K (AlgebraicClosure K)) p + ExpChar.prime hp_prime +- haveI : (W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic := inferInstance ++ have : (W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic := inferInstance + exact hasse_bound_via_weil_pairing_both W hq deg hdeg_nonneg + (hres_of_baseChange_scalings_coprime W p (n : ℕ) (AlgebraicClosure K) hq deg + hdeg_nonneg hpchar +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusDivisorGalois.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusDivisorGalois.lean +index a5cecf0c5..2cc3630be 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusDivisorGalois.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusDivisorGalois.lean +@@ -14,7 +14,7 @@ import HasseWeil.Foundation.Curves.Valuation.NoFinitePolesBridge + /-! + # Divisor Galois descent for the arithmetic Frobenius `σ` of `K̄(E)` + +-This file applies the abstract divisor-Galois-descent engine (`DivisorGalois.lean`) to the concrete ++Divisor Galois descent for the concrete + arithmetic Frobenius `σ = frobeniusFunctionFieldEquiv W` of the function field `K̄(E)`, proving the + affine order transport + +@@ -112,19 +112,19 @@ theorem pointValuation_frobeniusFunctionFieldEquiv + (frobeniusFunctionFieldEquiv W g) = + (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : + SmoothPlaneCurve (AlgebraicClosure K)).pointValuation Q g := by +- haveI hMell : ((W.baseChange (AlgebraicClosure K)).map ++ have hMell : ((W.baseChange (AlgebraicClosure K)).map + (coeffFrobEquiv (K := K) : + AlgebraicClosure K →+* AlgebraicClosure K)).toAffine.IsElliptic := by + rw [map_coeffFrobEquiv_eq W]; infer_instance +- haveI hMic : IsIntegrallyClosed (⟨((W.baseChange (AlgebraicClosure K)).map ++ have hMic : IsIntegrallyClosed (⟨((W.baseChange (AlgebraicClosure K)).map + (coeffFrobEquiv (K := K) : AlgebraicClosure K →+* AlgebraicClosure K)).toAffine⟩ : + SmoothPlaneCurve (AlgebraicClosure K)).CoordinateRing := by + rw [map_coeffFrobEquiv_eq W]; infer_instance +- haveI hMdd : IsDedekindDomain (⟨((W.baseChange (AlgebraicClosure K)).map ++ have hMdd : IsDedekindDomain (⟨((W.baseChange (AlgebraicClosure K)).map + (coeffFrobEquiv (K := K) : AlgebraicClosure K →+* AlgebraicClosure K)).toAffine⟩ : + SmoothPlaneCurve (AlgebraicClosure K)).CoordinateRing := + SmoothPlaneCurve.isDedekindDomain_coordinateRing _ +- haveI hEdd : IsDedekindDomain (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : ++ have hEdd : IsDedekindDomain (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : + SmoothPlaneCurve (AlgebraicClosure K)).CoordinateRing := + SmoothPlaneCurve.isDedekindDomain_coordinateRing _ + rw [frobeniusFunctionFieldEquiv, RingEquiv.trans_apply, ffFrobCast, +@@ -144,9 +144,8 @@ theorem pointValuation_frobeniusFunctionFieldEquiv + (by rw [pointOnMapped_x, hPx]) (by rw [pointOnMapped_y, hPy])).symm) g + + /- The order-at-infinity transport `ordAtInfty (σ g) = ordAtInfty g`: the arithmetic Frobenius `σ` +-fixes the place at infinity. Mirrors `OrdAtInftyBaseChange.lean` (the base-change `ord_∞` +-transport), replacing the injective `algebraMap K L` by the coefficient Frobenius `coeffFrobEquiv` +-(also injective). -/ ++fixes the place at infinity. Injectivity of the coefficient Frobenius identifies the ++orders of the corresponding norm polynomials. -/ + + /-- `crFrobEquiv` (= `CoordinateRing.map e`) on the `K̄[X]`-basis decomposition `p • 1 + q • y`: + it sends the coefficients `p, q` through `Polynomial.map e` and fixes the basis `{1, y}`. +@@ -305,7 +304,7 @@ omit [DecidableEq K] [W.toAffine.IsElliptic] + ((FiniteField.frobeniusAlgEquivOfAlgebraic K (AlgebraicClosure K)).symm P.y) = P.y + rw [AlgEquiv.coe_ringEquiv, AlgEquiv.apply_symm_apply] + +-omit [W.toAffine.IsElliptic] [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] in ++omit [W.toAffine.IsElliptic] [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] [DecidableEq K] in + /-- **`π̄` recovers `P` from its inverse-Frobenius point** (at the affine-point level): + `geomFrobeniusPointFun (geomFrobSmoothPointInv P).toAffinePoint = P.toAffinePoint`. -/ + theorem geomFrobeniusPointFun_geomFrobSmoothPointInv +@@ -341,6 +340,7 @@ open HasseWeil + + omit [W.toAffine.IsElliptic] in + set_option backward.isDefEq.respectTransparency false in ++omit [DecidableEq K] in + /-- **The fibre-divisor place comparison** (the combinatorial heart of σ-naturality). The + coefficient of the fibre divisor `[ℓ]^*(π̄T)` at an affine place `P` equals the coefficient of + `[ℓ]^*(T)` at the inverse-Frobenius place `geomFrobSmoothPointInv P`, because +@@ -382,6 +382,7 @@ theorem pullbackDiv_geomFrobInv_eq (ℓ : ℤ) (hℓ : (ℓ : AlgebraicClosure K + + omit [W.toAffine.IsElliptic] in + set_option backward.isDefEq.respectTransparency false in ++omit [DecidableEq K] in + /-- **The fibre-divisor place comparison at infinity**: + `pullbackDiv [ℓ] (π̄T) ∞ = pullbackDiv [ℓ] T ∞` (both equal `if 0 = Q`, and `0 = π̄T ⟺ 0 = T` since + π̄ is injective with `π̄ 0 = 0`). -/ +@@ -500,7 +501,7 @@ theorem frobeniusFunctionFieldEquiv_weilFunction_eq_smul + (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField c * + weilFunction (W.baseChange (AlgebraicClosure K)) ℓ hℓ + (HasseWeil.geomFrobeniusPoint W T) hπT := by +- haveI hEdd : IsDedekindDomain (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : ++ have hEdd : IsDedekindDomain (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : + SmoothPlaneCurve (AlgebraicClosure K)).CoordinateRing := + SmoothPlaneCurve.isDedekindDomain_coordinateRing _ + set gT := weilFunction (W.baseChange (AlgebraicClosure K)) ℓ hℓ T hT with hgT +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusGenericCovariance.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/FrobeniusGenericCovariance.lean +index 2e94ad5e465c6dada76ce68439b6c5d25480b4c3..86c212da5910eadae69fd7f1828430aaa2ee4c24 100644 +GIT binary patch +delta 1209 +zcmb7E&1(}u6eq1;EL8eQOKs)RT1+t6QYk70LHr~Zv6$RS+nwxAvIDy_o0-|Py%>dF +zyeWJ0YPT-f7?!fp8C)21U82(&hoHYY=sCDh_CIqQtbq*&?JGr&}397Lo?F;Xzx3VXPT% +zAZ8&w#t9CK#4eQzcA54;OTtw^G!xu3mb5M;(qS#CEa&iGrvmvp@`jBaq*#EvkbS`o +zWP`}^hp(VgaBRzZLF?E7Wm$s?3y^o1ER2;#R#Qsla@oFP-|V~`d!Ng71$sI$+dfvu +zw#wQlBxximlGoJhYImkgP@^u1Q8crfaVw?VAS97>EOx&OTGdxL(7uQpKFT}~oZ=uZ +zGl5CTd?hAAz +zjgVoWfJ9NS4+TR}k&s%_80m`;9~t>fg(eOed6kSVLA5xcjq!!ReO<3Q8 +z&1B{JVsbP-m3$~(8m{^@*|;*>J{>VKkftt>GXi%iW>v&utUKuiFb`d1df#&LBxul@ +zB+p0$dxh;L<_Ig7`=$KecC+B5=vS_OI@e3bg~d7Bs>j?l;Vh-rb;VIOJm-VFac~MC +z`F?G-GrIKd;>_Rt8Ml^8C3up&9-2<SBl89v}V#6%nlU + +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/HfactLemma.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/HfactLemma.lean +index 66737344a..5d4f80a0a 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/HfactLemma.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/HfactLemma.lean +@@ -9,57 +9,21 @@ import HasseWeil.HasseBound.WeilPairing.Constancy + import HasseWeil.Pic0.PicDual + + /-! +-# The separable divisor factorisation `hfact` (Silverman III.8.2 / III.6.1b) ++# Divisor factorization for the separable Weil-pairing adjoint + +-This file discharges the **divisor factorisation hypothesis** `hfact` of +-`HasseWeil.WeilPairing.weilPairing_adjoint_core` (the separable adjoint, Silverman III.8.2): for a +-separable isogeny `φ : E → E`, the Weil functions `g_T = weilFunction W ℓ T`, `g_U = weilFunction +-W ℓ U` (with `U = picDual φ T = φ̂ T`), and an appropriate `k ∈ K(E)`, +-``` +-φ^* g_T = c · (g_U · ([ℓ]^* k)) for some c ∈ Fˣ. +-``` ++Let `g_T` and `g_U` be Weil functions, and suppose the projective-divisor class ++identity `φ*((T) − (O)) ∼ (U) − (O)` holds. Divisor pullback functoriality and ++commutation with multiplication by `ℓ` then give ++`div(φ*g_T) = div(g_U · ([ℓ]*k))` for a suitable function `k`. ++Functions with the same projective divisor differ by a nonzero base-field ++constant, so `φ*g_T = c · g_U · ([ℓ]*k)`. + +-## The mathematics (Silverman III.8.2 proof, divisor language) +- +-Write `div g_T = [ℓ]^*((T) − (O))` (`weilFunction_divisor`, the fibre-difference divisor). Then +- +-* `div(φ^* g_T) = φ^*(div g_T) = φ^*([ℓ]^*((T) − (O)))` — the divisor-pullback functoriality +- `div(φ^* h) = φ^*(div h)` for the separable `φ` (`DivisorPullback.ProjOrdTransport φ`, the +- analogue of `projOrdTransport_mulByInt` for `[ℓ]`); +-* `φ^* ∘ [ℓ]^* = [ℓ]^* ∘ φ^*` on divisors (the function-field shadow of `[ℓ] ∘ φ = φ ∘ [ℓ]`, which +- holds for *any* additive point maps: `[ℓ]` commutes with every homomorphism) — proven here as +- `pullbackDivisor_comm`; +-* the **`picDual` divisor-class identity** (Silverman III.6.1b, the genuine separability content) +- `φ^*((T) − (O)) ∼ (U) − (O)` with `U = φ̂ T`, i.e. `φ^*(kappaDivisor T) − kappaDivisor U` is +- principal `= div k₀` — isolated below as the single minimal hypothesis `PicDualDivisorClass φ` +- (a projective-divisor avatar of `PicDual.Naturality`, see the residual note). +- +-Combining: `div(φ^* g_T) = [ℓ]^*(φ^*(kappaDivisor T)) = [ℓ]^*(kappaDivisor U + div k₀) = div(g_U) + +-div([ℓ]^* k₀) = div(g_U · [ℓ]^* k₀)`. Two functions with the same projective divisor differ by a +-nonzero constant `c ∈ Fˣ` (`Constancy.const_unit_of_projectiveDivisorOf_eq_zero`), which is exactly +-`hfact`. +- +-## The isolated minimal residual `PicDualDivisorClass` +- +-The decisive ingredient is the divisor-class identity `φ^*((T) − (O)) ∼ (φ̂ T) − (O)` *expressed in +-the projective-divisor model* `ProjectiveDivisor` (where `weilFunction_divisor`/`hfact` speak), +-namely `(⟨W⟩).ProjIsPrincipal (pullbackDivisor φ (kappaDivisor T) − kappaDivisor (φ̂ T))`. +- +-This is the **honest frontier**: `picDual = κ⁻¹ ∘ classMap ∘ κ` is defined in the *affine ideal +-class group* model `ClassGroup R` (`PicDual.lean`), where `classMap = ClassGroup.map` is the ideal +-extension `𝔪 ↦ 𝔪·𝒪` — Silverman's divisor pullback `φ^*`. But `hfact` lives in the *projective +-divisor* model `PicProj₀`/`projectiveDivisorOf`. The two `Pic⁰(E)` models are connected by `κ` +-(the canonical `E ≅ Pic⁰(E)` of III.3.4), but the repo carries no bridge `ClassGroup.map ↔ +-pullbackDivisor`; building it is exactly the `comap`-vs-`relNorm` (residue-degree) bookkeeping that +-`PicDual.Naturality` documents as carried per-isogeny data. We therefore isolate the divisor-class +-identity as the one minimal hypothesis `PicDualDivisorClass φ ch hinj hfin`, dischargeable per +-isogeny just as `ProjOrdTransport`/`Naturality` are throughout the project, and prove the *entire* +-`hfact` factorisation on top of it. +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, III.6.1 (the dual isogeny, `φ̂ = κ⁻¹ ∘ φ^* ∘ κ`), +- III.8.2 (Prop 8.2, the separable adjoint via the multiplicity-free pullback). ++The projective-divisor class identity is an explicit hypothesis. The ideal-class ++definition of `picDual` uses extension of ideals in the affine coordinate ring; ++identifying it with projective divisor pullback requires compatibility of those ++two models of `Pic⁰`. The factorization proofs retain this compatibility input. ++ ++References: Silverman, *The Arithmetic of Elliptic Curves*, III.6.1 and III.8.2. + -/ + + open WeierstrassCurve HasseWeil.Curves +@@ -68,8 +32,6 @@ namespace HasseWeil.WeilPairing + + open HasseWeil HasseWeil.WeilPairing.DivisorPullback + +-set_option linter.unusedSectionVars false +- + variable {F : Type*} [Field F] [DecidableEq F] + variable (W : WeierstrassCurve F) [W.toAffine.IsElliptic] + [IsIntegrallyClosed (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing] +@@ -78,13 +40,14 @@ local notation "KE" => W.toAffine.FunctionField + + /-! ### Commutation of fibre-pullback divisors `φ^* ∘ ψ^* = (ψ ∘ φ)^*` + +-The fibre-pullback `pullbackDivisor f` (`DivisorPullback.lean`) transports a coefficient along the ++The fibre-pullback `pullbackDivisor f` transports a coefficient along the + point map `f`: `(pullbackDivisor f D) w = D (f w)` (`pullbackDivisor_apply`). Hence two such + pullbacks compose by composing the point maps in the *opposite* order: + `pullbackDivisor f (pullbackDivisor g D) w = D (g (f w))`. We only need the special case where the + two maps **commute** as point endomorphisms (`g ∘ f = f ∘ g`), which is automatic when one of them + is `[ℓ]` (multiplication-by-`ℓ` commutes with every additive hom). -/ + ++omit [IsIntegrallyClosed (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing] in + /-- **Fibre-pullback divisors of commuting point maps commute.** If `f g : E.Point →+ E.Point` + commute (`g.comp f = f.comp g` — automatic when one is `[ℓ]`), then their fibre-pullback divisor + operators commute: `pullbackDivisor f (pullbackDivisor g D) = pullbackDivisor g (pullbackDivisor f +@@ -110,11 +73,10 @@ theorem pullbackDivisor_comm {f g : W.toAffine.Point →+ W.toAffine.Point} + `pullbackDivisor [ℓ] (kappaDivisor T)` of the Abel–Jacobi divisor `(T) − (O) = kappaDivisor T` + (`pullbackDivisor` distributes over the difference of the two `single`s; `∞.toAffinePoint = O`). -/ + ++omit [IsIntegrallyClosed (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing] in + /-- **The fibre-pullback of `(T) − (O)` is `[ℓ]^*(T) − [ℓ]^*(O)`** (= `div g_T`). The fibre-pullback + `pullbackDivisor [ℓ]` of `kappaDivisor T = (T) − (O)` equals `pullbackDiv [ℓ] T − pullbackDiv [ℓ] +-O`. (Local copy of `PairingNondeg.pullbackDivisor_kappaDivisor`, kept here to avoid the import; +-named `…_local` to avoid the cross-file name clash with the `PairingNondeg` copy, so that downstream +-files importing both `HfactLemma` and `DetDeg`/`PairingNondeg` — e.g. `SeparableScaling` — compile.) ++O`. + -/ + theorem pullbackDivisor_kappaDivisor_local (ℓ : ℤ) + [hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker] (T : W.toAffine.Point) : +@@ -135,7 +97,7 @@ theorem weilFunction_divisor_eq_pullbackDivisor_kappaDivisor [IsAlgClosed F] + (⟨W.toAffine⟩ : SmoothPlaneCurve F).projectiveDivisorOf (weilFunction W ℓ hℓ T hT) = + pullbackDivisor (W := W.toAffine) (mulByInt W.toAffine ℓ).toAddMonoidHom + (mulByInt_ker_finite W ℓ hℓ) (Curves.kappaDivisor W.toAffine T) := by +- haveI : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ ++ have : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ + rw [show (⟨W.toAffine⟩ : SmoothPlaneCurve F).projectiveDivisorOf (weilFunction W ℓ hℓ T hT) = + (W_smooth W).projectiveDivisorOf (weilFunction W ℓ hℓ T hT) from rfl, + weilFunction_divisor W ℓ hℓ T hT, pullbackDivisor_kappaDivisor_local W ℓ T] +@@ -146,7 +108,7 @@ theorem weilFunction_divisor_eq_pullbackDivisor_kappaDivisor [IsAlgClosed F] + fibre-pullback `φ^*((T) − (O))` is *linearly equivalent* to `(φ̂ T) − (O)` (with `φ̂ = picDual φ`), + i.e. their difference `pullbackDivisor φ (kappaDivisor T) − kappaDivisor (φ̂ T)` is principal. This + is the one ingredient that cannot be assembled from the project's *projective*-model API: `picDual` +-is built from the *affine* ideal-class-group divisor pullback `classMap` (`PicDual.lean`), and the ++is built from the *affine* ideal-class-group divisor pullback `classMap`, and the + ClassGroup↔ProjectiveDivisor bridge is the carried `PicDual.Naturality` data (the `comap`-vs- + `relNorm`/residue-degree bookkeeping). Everything else in `hfact` is proven on top of this. -/ + +@@ -209,7 +171,7 @@ theorem hfact_projectiveDivisorOf_eq (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) + (φ.pullback (weilFunction W ℓ hℓ T hT)) = + (⟨W.toAffine⟩ : SmoothPlaneCurve F).projectiveDivisorOf + (weilFunction W ℓ hℓ U hU * (mulByInt W.toAffine ℓ).pullback k₀) := by +- haveI hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ ++ have hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ + have hcoreℓ : ProjOrdTransport (mulByInt W.toAffine ℓ) := projOrdTransport_mulByInt ℓ hℓ + set κT := Curves.kappaDivisor W.toAffine T + set κU := Curves.kappaDivisor W.toAffine U with hκU +@@ -274,7 +236,7 @@ theorem hfact_of_picDualDivisorClass (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) + (weilFunction W ℓ hℓ ((φ.picDual ch hinj hfin) T) + (by rw [← map_zsmul, hT, map_zero]) * + (mulByInt W.toAffine ℓ).pullback k) := by +- haveI : IsDedekindDomain (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing := inferInstance ++ have : IsDedekindDomain (⟨W.toAffine⟩ : SmoothPlaneCurve F).CoordinateRing := inferInstance + have hU : ℓ • (φ.picDual ch hinj hfin) T = 0 := by rw [← map_zsmul, hT, map_zero] + -- The Abel–Jacobi function `k₀` of the `picDual` divisor-class identity, and its divisor. + obtain ⟨k₀, hk₀_ne, hk₀_div⟩ := hpd T +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/OneSubDualDivisor.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/OneSubDualDivisor.lean +index d3000b32d30e10c2b46fc50f6a717384d41259f1..4a6db4566facbd1bd32e68b7dfa22044d93fa66b 100644 +GIT binary patch +delta 1573 +zcmah}&5ImG6lXU0vBl!9n;17SA1|6U)7smxCJt^e=w(9&1Xr^dNKEXS?waW`-BoQ> +z^@KUdBqRm}5wvpfAd89@5g}wedGL@wAREDpm!Ny|;vXOcebv3QnZywRe)+a`{kxid?Ab^BxS%P>Hc-$kr;4^x23*Sy6FowXOEvnzc7w*#K2Q-uuH?Hc +zGQ7(`s+cKa6csv`%J^U}9ouQQ2anr3hxWW(?#_zT@I2*AlbCfBV;WjL2%kC66s%tj +z185pB2~(^s6<#mmBEl_H028syq{{=R-d$ZEo%&0C5s=pq9iGhw*tK?eb82-h#y*RP&? +zu8zO3;=#s;pF#a~&-36IxSsJfzP$J~tb{&jNy1w{;GWMB3T`;FiRvtN==eii(4v|_ +zlu*$@y4r6*xLDR)zZim%4kt}JtfeTAAWEe!6!Y;M*HEgXSV|3-!Y8g)Mc`J;r5yIt +z<+(o3^0Zf87fGcUiXmbyI&g~dbRnl)xd$E56#s*gfJh2$RDm)|0fk27BeKT4i#||J +z29#TJVIZTqh6~&zvM}h2NTT#yP{S6mwtabWcIr*mMim9BM~I!BJ_3h>BR({n&7cu1 +z)?40i{X(7M8Y|nI(?8W#2OrOTGGVX1c+h^Z{hFN)o)|3c_wo`{=2+UkI=^FoUZg3~8l86p=6HR?b2Rd>>A`RQjY+J#*0?e;$d~?@oU3pH8f=7p +zbh!Qd#BTfO>HYo9qZQ>2GdCI`X1Ub7BxooDL6W-Yn3C#JpqLt3Rvt?=IIktWT%vl8 +zV~Q3Z;kg_iFbB5ghoJt|Y&l1wG9~%iN0Fc0T}|H@9}xTJnSC=SdD>+vLr1+8ECz?Y +z!R+yq6T8N>1+Hm(_rzSktz=eVsT406AoY8t#>?m70NxKw7x~bE|1#-=fbZqSUL2wE +zfJ=WM=xuJ)*BVc~f~t`JQpHJyBR$08{88Ei`P&SQaPZA*zfK)+O^+pH7y^!zoe#i& +z$@$kiYL`wo`_4k>xXcB`#ubY>^CjeAHBtAOs0tIO)i@jZa3SFswqb%~y~EzaC simp only [hax, hay] + +-/-- **The base-changed `(1 − π)_{K̄}` point map is `id − geomFrobenius`** (= `oneSubGeomFrobHom`), +-over `L = AlgebraicClosure K`. Combines the constructional `toAddMonoidHom = id − π̄` +-(`oneSubFrobeniusIsogBaseChange_toAddMonoidHom`) with the linchpin `π̄ = geomFrobeniusPoint`. -/ ++omit [DecidableEq K] in ++/-- The base-changed `1 − π` point map is the difference of the identity and geometric ++Frobenius over the algebraic closure. -/ + theorem oneSubFrobeniusIsogBaseChange_toAddMonoidHom_eq_oneSubGeomFrobHom + [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] + (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] +@@ -260,13 +205,9 @@ variable (p r : ℕ) [Fact p.Prime] [CharP K p] [Fact (Fintype.card K = p ^ r)] + + noncomputable local instance instDecEqAC' : DecidableEq (AlgebraicClosure K) := Classical.decEq _ + +-/-- **Witness 1 — `finiteKer`** (PROVED, axiom-clean): the kernel of `(1 − π)_{K̄}` is finite. +- +-Via the linchpin, `ker(id − π̄) = ker(oneSubGeomFrobHom)`, whose underlying set is the +-geometric-Frobenius fixed locus `= range(includePointBC)` (Step S2/S3 of +-`FrobeniusFixedPoint.lean`), +-i.e. the image of the **finite** point set `E(𝔽_q) = W.toAffine.Point` under the base-change +-inclusion — hence finite. -/ ++omit [DecidableEq K] in ++/-- The kernel of base-changed `1 − π` is finite: it is the geometric-Frobenius fixed locus, ++which is the image of the finite rational point set under base change. -/ + theorem oneSubFrobeniusIsogBaseChange_finiteKer + [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] + (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] +@@ -281,9 +222,9 @@ theorem oneSubFrobeniusIsogBaseChange_finiteKer + rw [← hset] at hfin + exact hfin.to_subtype + +-/-- **`#ker(1 − π)_{K̄} = pointCount W`** (PROVED, axiom-clean). Via the linchpin the kernel is the +-geometric-Frobenius fixed locus, whose cardinality is the `𝔽_q`-rational point count +-(`ncard_ker_oneSubGeomFrobHom_eq_pointCount`). This is the *clean half* of `hkerdeg`. -/ ++omit [DecidableEq K] in ++/-- The cardinality of the kernel of base-changed `1 − π` equals the rational point count, ++by its identification with the geometric-Frobenius fixed locus. -/ + theorem oneSubFrobeniusIsogBaseChange_nat_card_ker_eq_pointCount + [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] + (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] +@@ -299,16 +240,9 @@ theorem oneSubFrobeniusIsogBaseChange_nat_card_ker_eq_pointCount + rw [hcard, ncard_ker_oneSubGeomFrobHom_eq_pointCount] + rfl + +-/-- **Witness 3 — `hkerdeg`, reduced to V.1.3** (axiom-clean reduction). Given the degree identity +-`φ_L.degree = pointCount W` (Silverman V.1.3, `isogOneSub_negFrobenius_degree_eq_pointCount` +-base-changed through `hdeg_bc` — the project's known sharp residual), the separable degree match +-`#ker(1 − π)_{K̄} = φ_L.degree` follows from the *proved* clean count +-`#ker = pointCount`. +- +-The V.1.3 degree identity is taken as a hypothesis so this reduction is itself axiom-clean and the +-V.1.3 dependence is explicit (the caller supplies `hdeg_eq` from +-`(oneSubFrobeniusIsogBaseChange_degree_eq_of_finrankBaseChange W p r L hq).trans +- (isogOneSub_negFrobenius_degree_eq_pointCount W hq)` once `hq` is available). -/ ++omit [DecidableEq K] in ++/-- The degree identity of Silverman V.1.3, supplied as a hypothesis, identifies the ++kernel cardinality with the degree of the base-changed `1 − π` isogeny. -/ + theorem oneSubFrobeniusIsogBaseChange_hkerdeg_of_degree_eq_pointCount + [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] + (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] +@@ -321,11 +255,9 @@ theorem oneSubFrobeniusIsogBaseChange_hkerdeg_of_degree_eq_pointCount + (oneSubFrobeniusIsogBaseChange W p r (AlgebraicClosure K) pullback_L).degree := by + rw [oneSubFrobeniusIsogBaseChange_nat_card_ker_eq_pointCount, hdeg_eq] + +-omit [Fintype W.toAffine.Point] in +-/-- **Witness 2 — `hsurj` from the dual composition `φ ∘ δ = [N]`** (axiom-clean reduction). For +-any `N` with `(N : K̄) ≠ 0`, surjectivity of `[N]` on `E(K̄)`-points (`mulByInt_point_surjective`) +-turns the dual composition `φ ∘ δ = [N]` into surjectivity of `φ`. This is the second consequence +-(alongside `hdc`) of bundling the divisor-pushforward dual as an `IsDualOf`. -/ ++omit [Fintype W.toAffine.Point] [DecidableEq K] in ++/-- A dual composition `φ ∘ δ = [N]`, with `N` nonzero in the algebraic closure, implies ++surjectivity of `φ` by surjectivity of multiplication by `N` (Silverman III.4.10). -/ + theorem oneSubFrobeniusIsogBaseChange_hsurj_of_self_comp_dual + [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] + (pullback_L : (W.baseChange (AlgebraicClosure K)).toAffine.FunctionField →ₐ[AlgebraicClosure K] +@@ -363,14 +295,10 @@ variable [(W.baseChange (AlgebraicClosure K)).toAffine.IsElliptic] + (⟨(W.baseChange (AlgebraicClosure K)).toAffine⟩ : SmoothPlaneCurve + (AlgebraicClosure K)).CoordinateRing] + +-/-- **Assemble `OneSubScalingData` over `K̄` from only the still-open witnesses.** +- +-Discharges `pullback_L` (concrete `oneSubFrobeniusPullback_L`), `hdeg_bc` (proved, no hypothesis), +-`finiteKer` (proved), `hkerdeg` (from the V.1.3 identity `hdeg_eq`), and `hsurj` (from the +-dual composition +-`hself` + `mulByInt_point_surjective`). The caller supplies only the genuinely-deep divisor-level +-residuals: the dual `δ` with *both* composition identities `hdc`/`hself` (an `IsDualOf`), the +-divisor-pullback functoriality `hproj`, and the translation covariance `hcomm'`. -/ ++/-- Scaling data over the algebraic closure constructed from the degree identity, both dual ++composition identities, divisor-pullback functoriality, and translation covariance. The ++geometric-Frobenius fixed locus supplies the finite kernel and its cardinality; the second ++dual composition supplies surjectivity. -/ + noncomputable def mkOneSubScalingDataConcrete_of_witnesses (hq : 2 ≤ Fintype.card K) + (hdeg_eq : + (oneSubFrobeniusIsogBaseChange W p r (AlgebraicClosure K) +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingNondeg.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingNondeg.lean +index 18c4b2749..327e9d223 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingNondeg.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingNondeg.lean +@@ -13,7 +13,7 @@ import HasseWeil.HasseBound.WeilPairing.TorsionCardEll + /-! + # Nondegeneracy of the Weil pairing + +-This file proves that the finite-level Weil pairing over an algebraically closed field is ++We prove that the finite-level Weil pairing over an algebraically closed field is + nondegenerate in its second argument. The proof uses surjectivity of multiplication on curve + points, injectivity of divisor pullback, the Galois fixed-field description, and Abel--Jacobi. + +@@ -154,7 +154,7 @@ theorem aut_eq_translate (ℓ : ℤ) (hℓ0 : ℓ ≠ 0) + (mulByInt W.toAffine ℓ).toAlgebra (mulByInt W.toAffine ℓ).toAlgebra) : + ∃ k : W.toAffine.Point, ℓ • k = 0 ∧ + ∀ z : KE, σ z = translateAlgEquivOfPoint W k z := by +- letI := (mulByInt W.toAffine ℓ).toAlgebra ++ let := (mulByInt W.toAffine ℓ).toAlgebra + have hcov := hcov_mulByInt_of_xy W ℓ hℓ0 (hxy_mulByInt W ℓ hℓ0) + set forward := kernelTranslateForwardAut W (mulByInt W.toAffine ℓ) hcov with hfwd_def + obtain ⟨k, hk_mem, hk_lift⟩ := hdesc_mulByInt W ℓ hℓ0 σ +@@ -183,10 +183,10 @@ theorem mem_pullback_range_of_translate_fixed (ℓ : ℤ) (hℓ : (ℓ : F) ≠ + translateAlgEquivOfPoint W S g = g) : + ∃ h : KE, (mulByInt W.toAffine ℓ).pullback h = g := by + have hℓ0 : ℓ ≠ 0 := by rintro rfl; norm_num at hℓ +- letI := (mulByInt W.toAffine ℓ).toAlgebra +- haveI hfin : @FiniteDimensional KE KE _ _ (mulByInt W.toAffine ℓ).toAlgebra.toModule := ++ let := (mulByInt W.toAffine ℓ).toAlgebra ++ have hfin : @FiniteDimensional KE KE _ _ (mulByInt W.toAffine ℓ).toAlgebra.toModule := + isogeny_finiteDimensional W (mulByInt W.toAffine ℓ) +- haveI hgal : @IsGalois KE _ KE _ (mulByInt W.toAffine ℓ).toAlgebra := ++ have hgal : @IsGalois KE _ KE _ (mulByInt W.toAffine ℓ).toAlgebra := + Isogeny.isGalois_of_isSeparable_and_normal (mulByInt W.toAffine ℓ) + (mulByInt_isSeparable W ℓ hℓ) (h_normal_mulByInt W ℓ hℓ0) + have hfix : ∀ σ : @AlgEquiv KE KE KE _ _ _ +@@ -217,7 +217,7 @@ theorem weilPairing_nondegenerate (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) + (h_deg : ∀ S : W.toAffine.Point, (hS : ℓ • S = 0) → + weilPairing W ℓ hℓ S T hS hT = 1) : + T = 0 := by +- haveI hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ ++ have hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ + obtain ⟨h, hh⟩ := mem_pullback_range_of_translate_fixed W ℓ hℓ (fun S hS ↦ by + rw [weilPairing_translate W ℓ hℓ S T hS hT, h_deg S hS, map_one, one_mul]) + apply eq_zero_of_kappaDivisor_principal W +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingProps.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingProps.lean +index 403c142bc..70880d716 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingProps.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PairingProps.lean +@@ -9,9 +9,9 @@ import HasseWeil.HasseBound.WeilPairing.Pairing + /-! + # Weil-pairing properties: bilinearity in the second slot and alternating (Silverman III.8.1) + +-This file proves the two remaining structural properties of the finite-level Weil pairing +-`e_ℓ : E[ℓ] × E[ℓ] → F` (ticket `T-R2-PAIRING-PROPS`), over an algebraically closed field `F`, +-extending the slot-1 bilinearity `weilPairing_mul_left` from `Pairing.lean`: ++We prove bilinearity and alternation of the finite-level Weil pairing ++`e_ℓ : E[ℓ] × E[ℓ] → F`, over an algebraically closed field `F`, ++extending the slot-1 bilinearity `weilPairing_mul_left`: + + * `weilPairing_mul_right` — **bilinearity in the second slot** (Silverman III.8.1b): + `e_ℓ(S, T₁ + T₂) = e_ℓ(S, T₁) · e_ℓ(S, T₂)`. +@@ -112,7 +112,7 @@ theorem weilPairing_mul_right (ℓ : ℤ) (hℓ : (ℓ : F) ≠ 0) + weilPairing W ℓ hℓ S (T₁ + T₂) hS h₁₂ = + weilPairing W ℓ hℓ S T₁ hS hT₁ * weilPairing W ℓ hℓ S T₂ hS hT₂ := by + have hℓ0 : ℓ ≠ 0 := by rintro rfl; simp at hℓ +- haveI hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ ++ have hker : Finite (mulByInt W.toAffine ℓ).toAddMonoidHom.ker := mulByInt_ker_finite W ℓ hℓ + obtain ⟨k, hk_ne, hk_div⟩ := bilinDivisor_isPrincipal W T₁ T₂ + set u : KE := (mulByInt W.toAffine ℓ).pullback k + have hu_ne : u ≠ 0 := +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PencilDualDivisor.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/PencilDualDivisor.lean +index 5f516ab8e619e3cdfcf79eb728f53efdfb81a2c5..4401ef64fd20246d7f73d595ce01960cce1b673b 100644 +GIT binary patch +delta 2332 +zcmbVOzi%8x7}b$LF@+rj*nx1)hb%>V(%u>$k!`>fHjX7L6oIoq5sI_p-MPCVyR(~_ +zT^lQ)3z7u_M1iKEp`f5dLb?VzXebcE4ODdb188U|_-1zRhtFpdMOWNuc6R1{?|bik +z_sbWRuiyT@Uh(Uod_p!82^17dsieCRgOrJYN5ECmX5s*Rd2}DlP8WElV3#TeL5GSq +zgAP@YCR}6?)0FrUj_&_6PdZ7a#=j%*#Y1&ZI;9=lRPNORW7i* +zIl?zjTX2U-!6FE#47n&)sR#+8lZ?55zX8wI-!47XMN&Ep2^=2Sq5-lhSxmVA_I?`i +zfM>u3@o(5ZGz*$GXhsdCSRign1Vhq!!K%tre2ax3XqHPl>|6l=X_=pgw^)lwrazxr +z?^-}xTU*|e*KlZ!05~Dv!*)wZbJb}javv)xVB>Wm7K->HY6z{lVBWmyExzbbH>iPg +zj4D$$j7X_KP`jg*Mz0RJhGK3O{>pdws!_eoFivD}R^i_d(UK%o&x8VFFv5!A12~uU_sJ7C6njuV5ggc@*u^ +z;11BJ&2}Y)P7>osrX8+g7mC)Ri%`yT&x*r+XivG$B-2<=p-aoNtwi)UOS20eX)*>) +z9_=w1Q(yCbzyROoVmtn6@!2a%CAcfknWyXVJFD +zWM5e`vKZ$P_249`!Wg}2=aa{~rwErU)a%yA1K$o?HE5C%Pd|r^1RfzJmoZe!nDh|% +zbrX?3YX?snSJ`OoE@xJr|IejGGX%ioh_A<2)6uHDn6oi}y<2T;RP;wL{RAhGfq(Sz8-5=ew&uB>zWV87-5bXziZuv@7L9pi^SK~W +z5wbS2I3&H~*>XS7#PRgS*=G$ih+ZpIf>K45%=eXaS^}dl^&cyr>BA@A)W5#``y4q- +z85??SdA4gNOEEXcX)qRM=!1iSK7^I(Ku!I+agQCkrG0UB1yO=&%}!1cqwQnEV^tgs +z#+PJm90%wL9QNqFGHcFgp~R + +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Pullback.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Pullback.lean +index 6a6379829..9fe8fdd6a 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Pullback.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Pullback.lean +@@ -7,22 +7,16 @@ import HasseWeil.HasseBound.WeilPairing.Fiber + import HasseWeil.Foundation.Curves.Divisor.PicZero + + /-! +-# Route 2A — the multiplicity-free geometric divisor pullback (keystone) ++# Multiplicity-free geometric divisor pullback + +-For a **separable** point-map endomorphism `f` (étale fibres, `e = 1`), the pullback divisor is +-the mult-1 fibre sum `f*((Q)) = Σ_{fP=Q} (P)`. This is the central new object of the Weil-pairing +-route — the same divisor pullback Route 1 lacked, now in the multiplicity-free regime — used by +-both the pairing construction (`div g = [ℓ]*((T)) − [ℓ]*((O))`) and the separable adjoint +-(Silverman III.8.2's function `h`). +- +-This file ships the definition and its **degree**: `deg(f*((Q))) = #fibre = #ker f` (Silverman +-III.4.10c, the separable case). The `σ`-bridge and the addition-formula linkage are downstream. ++For a separable point-map endomorphism `f`, the pullback of `(Q)` is the sum ++of the points in its finite fibre, each with multiplicity one. Its degree ++is the cardinality of the kernel, as in Silverman III.4.10(c). This divisor ++also gives the geometric group sum used in the dual isogeny formula. + -/ + + namespace HasseWeil.WeilPairing + +-set_option linter.unusedSectionVars false +- + open WeierstrassCurve + + variable {F : Type*} [Field F] [DecidableEq F] {W : WeierstrassCurve.Affine F} [W.IsElliptic] +@@ -44,7 +38,7 @@ noncomputable def pullbackDiv (f : W.Point →+ W.Point) (h : Finite f.ker) (Q : + /-- **Degree of the mult-1 pullback** (Silverman III.4.10c, separable): `deg(f*((Q))) = #ker f`. -/ + theorem degree_pullbackDiv (f : W.Point →+ W.Point) (h : Finite f.ker) {P₀ Q : W.Point} + (hP₀ : f P₀ = Q) : (pullbackDiv f h Q).degree = Nat.card f.ker := by +- letI : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) ++ let : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) + rw [pullbackDiv, ← Curves.ProjectiveDivisor.degreeHom_apply, map_sum] + simp only [Curves.ProjectiveDivisor.degreeHom_apply, degree_single, Finset.sum_const, + Finset.card_univ, nsmul_eq_mul, mul_one] +@@ -55,7 +49,7 @@ fibre). The start of the III.6.1(b) `σ`-bridge `σ(f*((Q))−f*((O))) = f̂(Q)` + theorem projectiveDivisorSum_pullbackDiv (f : W.Point →+ W.Point) (h : Finite f.ker) (Q : W.Point) : + letI : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) + Curves.projectiveDivisorSum W (pullbackDiv f h Q) = ∑ P : {P : W.Point // f P = Q}, P.val := by +- letI : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) ++ let : Fintype {P : W.Point // f P = Q} := @Fintype.ofFinite _ (fiber_finite f h Q) + rw [pullbackDiv, ← Curves.projectiveDivisorSumHom_apply, map_sum] + refine Finset.sum_congr rfl (fun P _ => ?_) + rw [Curves.projectiveDivisorSumHom_apply, Curves.projectiveDivisorSum_single, one_zsmul, +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Scaling/FrobeniusGalois.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Scaling/FrobeniusGalois.lean +index ef66a86e649eed9ded1a96df6f25baa29b62948a..8e90832e3d316d0e2eae1846034a1632be1da6fb 100644 +GIT binary patch +delta 2327 +zcmai0%WoS+7?(qM4Si7ML87McMJahG_NEaRNK>JZ5EKGPRV@ld(4EZA+Cz7DoY}EM +zs8FcNg(I3P0>qg^B};HbJyhxesr(Jxd*c97k@#lD-r7l;+~SRQzVG)O|MqL?Ve8J) +zz#t*jx>;Etordti?GR)Py3Th8bXGHRvL|D*TQm4YUws>P@(YIOl}rWjh%O=Fq$!*B%T1O5wSmo*vUDV +zf6J4D)w$2M&GRST8<>sS%@Z4^=L>|;IT3P3-5IfxDZE1yiCjcfQ(}HterY&w;x+=0 +zqtJy|F}I!?+S?JxwzfPZ)bdK0Y*8ibPUU@+prlQOL-Z~*8-Rc)WHS4bD_QJZ_Pn5m +zUO=xEL9M!|P{b-as{7F_ojN`3INqn+ep~@*e+>6aXL^u9EYVcv_p{^gF1f!sW#}Aa +z*!dR4vp(_8D3c!G-gs6ApiM1PsTy^Wr%B5E)shRC?71k)jKoiDER-&8f|=FxAM4 +z!d)vERGUlB6u}Jm2a$+lt}t=n%w*SOb*c~pS0dMf9kr;Lyf$Gzc=@E63I1&V6U+~q +z_t(jpKBBuNL;Afq??^g?mwo=RC17RRL(!8&?&N+=zTNcZ>~$M)^@0FuJmU%-j+*xr +z6q>QO0xZ%)YXI^(&LO&v!V23nDXsC7;ED3{t?uO>-L1d}1LA~qBDorR)8(aqWKYbT +z!Eq-Hq^@Jt2}X+GFWFwPrL_0NQo?e&>0OATyP$^*{`&SOxPbL!Q)tcC8&vCzZZch& +zc4{NSJT%Y%nxmIG0u{-b#^?m(IOl?a)v-3a^!H%NA)h%Cc^OSv<0ywRcV8JX-!GAK +zzDoKwETfHOOGF&ZkIN$i0YUE#w;!$kTq>;?`r7d4Or~km-b4Fa4rq*Cc2@}+0#RF0 +zT~lCD;DzMlPn{VGlOC7)aa12yek_r<33|-lIFH>L3B{R4CW~|x*sy(l`D0Pz8vRZ^ +zU`|AyXL##D|;ro*VE#1s3|U +z3&l-h!*ZaF5x%)I0TahG#ISj^`ht1!ji=39AKt%Fc-mcJD3?9jhN8Fx&~xF`=98Ms +aLUGMSj%_Y;>+00`ZV?{k+VPiq@T6vr6iG88ur20KlN->H_wY89K*NgZ4$Y7ZuaKy5HIX`|83(`uaEna#|s +zTLoP8;6pEk(k(gWBZPnsfk3~3X+J{2&|44jDdg5SE6bK3%1Nu8x9|7o{ocI&b>AJ;#vrE?lW^=QL1hg+*FMvmA6ee{mpI~Fy7w|ECTOM*H +zia$3N`ynIlM-+j`GJ`F;gsV!|2(vXIv7eZ5$e5ts@Gsi6Ra!Gwct+)f;=}3jA +zQirBkP)LJR+5wsCjEtNgIEfooN9TR}K2IULnPrF!22fAmPw`QfjWC3{Pg)&xJDr%GXCI}FB`01{P)75 +zP6_e;R~Sj*H|6WcaOXRasyJ9`6c6X-2fK?aGt-I&2TNbfO+9?I{NTd!l=iGquS2cY +zDxNbKY<~LF>}I5u<5JmjAd_J@i~Uf5&pBmvESju1sV)@9!9sDl_HlE#b|ZVGposbM +zSni``-snghnnR`)g(!x1-5`TEwWAMbwu`?Sm#<8}4xl(`T=}*dGN475v>-$BG3pe3 +zzF>Us&gfDVja-n&L_|>#bJ|Se;h9aY@ZjF(uRrMT(EIm?hwiNL?3Bf~C&3BSr=MW8 +oq9vY+?Kdridc*sq4W^)rXIJNo-)bKf(0p3FY_1IcX?`;MKVysjBLDyZ + +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Scaling/Separable.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/Scaling/Separable.lean +index af497faf2bb3780fc6a0ffbb0e47d99a5a4bc929..887cec98266c9fc13bfc5a472077ef8e615afbe0 100644 +GIT binary patch +delta 850 +zcmY+C!E4k&6vk-}1p{h9gx1rez3g_=1*;UX6j|`#LQ&|Z2QQjw<|UanI}>LnyIn!H +z2U)x+2Jz%UFZEc7c&mEzBJTgtf55v4`jWM!-ZGQ-zVCa#H%DKme;rI8-k!=grxx!B +zqau_7jpKMR0^>VMNDG3aw89R+$A`yH^V)dSalJaM!{pd;x9UEGDoIq|K&VwWfBSlF +zfk_UQRJiDou7;2WR%!8=S)nBO^`Xc*YV)E9Wjt!BB$< +z2SP^q&kOTIlci}w5y9W01V27{Ww!+;L3CM!{~Af&^WDlH_ozM)7E+Cq65sP75CCQ^FXrm_`!%0i&comMHy@c_; +zzeY%dn8=>ZB#c868c7QQ_ktwj$gB5NNymd!(SJj0BrO{Y112EKG6JTftb|0^HZdd# +z8KAid9g*}<=U*;fUvQmvyWL!EuGCoFh4TAGbH%LyP7bTZr`cCmijBs1C*Nqi&p+Rt +nDZZ^ P.val) + (fun T => P₀ + (T : W.Point)) (fun P => ?_) + simp only [fiberEquivKer, Equiv.coe_fn_mk] +@@ -41,7 +39,7 @@ theorem sigma_pullbackDiv_sub (f : W.Point →+ W.Point) (h : Finite f.ker) {P + (hP₀ : f P₀ = Q) : + Curves.projectiveDivisorSum W (pullbackDiv f h Q) - + Curves.projectiveDivisorSum W (pullbackDiv f h 0) = Nat.card f.ker • P₀ := by +- letI : Fintype f.ker := @Fintype.ofFinite _ h ++ let : Fintype f.ker := @Fintype.ofFinite _ h + have hQ := projectiveDivisorSum_pullbackDiv f h Q + have hO := projectiveDivisorSum_pullbackDiv f h 0 + rw [hQ, hO, fiber_sum_eq_ker_sum f h hP₀, +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionKernelRational.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionKernelRational.lean +index 378e2e72b..f1d4ef6ca 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionKernelRational.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionKernelRational.lean +@@ -11,26 +11,19 @@ import HasseWeil.Foundation.EC.GenericPointZsmul + import HasseWeil.Foundation.EC.SeparableKernelTorsor + + /-! +-# Kernel-rationality of `[ℓ]` over `K̄` (Silverman III.4.10c) ++# Rationality of torsion kernels over an algebraically closed field + +-For the multiplication-by-`ℓ` isogeny `[ℓ] = mulByInt W.toAffine ℓ` over an algebraically closed +-field `F = K̄`, we discharge the two genuine-isogeny coherence inputs of the capstone +-`HasseWeil.card_kernel_eq_degree_of_separable_concrete` (`SeparableKernelTorsor.lean`): ++For a nonzero integer `ℓ`, every point in the kernel of multiplication ++by `ℓ` over an extension of an algebraically closed base field already ++comes from a torsion point over that base field. The division-polynomial ++identity makes its x-coordinate algebraic, and the Weierstrass equation ++then makes its y-coordinate algebraic. + +-* `hdesc_mulByInt` — the inverse-witness descent: every fibre `σ(P_gen) − P_gen` (`σ` an +- automorphism of `K(E)/[ℓ]*K(E)`) is an `F`-rational kernel point of `[ℓ]`. +-* `h_normal_mulByInt` — the function-field extension `K(E)/[ℓ]*K(E)` is normal. ++Consequently, automorphisms of `K(E)/[ℓ]*K(E)` differ from the generic ++point by rational kernel points. The minimal polynomials of the generic ++coordinates split in `K(E)`, proving normality of this extension. + +-Both rest on **kernel-rationality** (`kernelDescends_general`, specialised to +-`kernelOverKE_descends` at `L = K(E)`): over `K̄`, every point `Q` of `E` with coordinates in a +-field extension `L` that is killed by `[ℓ]` already descends to a `K̄`-rational `ℓ`-torsion point. +-The reason is the division-polynomial connection `[ℓ]Q = O ⟹ ψ_ℓ(x(Q), y(Q)) = 0 ⟹ Ψ²_ℓ(x(Q)) = 0`: +-the `x`-coordinate of `Q` is a root of the `ℓ`-division polynomial `Ψ²_ℓ`, whose coefficients lie +-in `K̄` (not just `L`); since `K̄` is algebraically closed, `Ψ²_ℓ` splits over `K̄`, so `x(Q)` is +-the image of a `K̄`-element. The `y`-coordinate then descends via the Weierstrass +-equation over `K̄`. +- +-Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10c. ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.4.10(c). + -/ + + open WeierstrassCurve Polynomial +@@ -228,7 +221,7 @@ of `[ℓ]`. + + The geometric action `g` of `[ℓ]` on `(W_KE).Point` is multiplication-by-`ℓ` (`zsmulAddGroupHom ℓ`), + whose value at the generic point is `(mulByInt_x ℓ, mulByInt_y ℓ) = ([ℓ]*x_gen, [ℓ]*y_gen)` +-(`zsmul_genericPoint_eq` + `mulByInt_pullback_x/y`); this is the genuine data. The shipped ++(`zsmul_genericPoint_eq` + `mulByInt_pullback_x/y`); the generic-point identity. The lemma + `genericPointAct_mem_ker_g` then yields `g(σ P_gen) = g(P_gen)` — using `σ.commutes` (it fixes the + pullback range) and the equivariance `g ∘ (Point.map σ) = (Point.map σ) ∘ g`, which here is just + `map_zsmul`. Thus `ℓ • (σ P_gen − P_gen) = 0`, and `kernelOverKE_descends` produces the descended +@@ -241,7 +234,7 @@ theorem hdesc_mulByInt [IsAlgClosed F] (ℓ : ℤ) (hℓ : ℓ ≠ 0) : + liftPointToKE W k = + genericPointAct W (mulByInt W.toAffine ℓ) σ - genericPoint W := by + intro σ +- letI := (mulByInt W.toAffine ℓ).toAlgebra ++ let := (mulByInt W.toAffine ℓ).toAlgebra + set g : (W_KE W).toAffine.Point →+ (W_KE W).toAffine.Point := zsmulAddGroupHom ℓ + obtain ⟨hns, hsmul⟩ := zsmul_genericPoint_eq W ℓ hℓ + have hsmul' : ℓ • genericPoint W = +@@ -449,16 +442,15 @@ theorem minpoly_gen_splits_of_mem_range [IsAlgClosed F] (ℓ : ℤ) (_hℓ : ℓ + letI := (mulByInt W.toAffine ℓ).toAlgebra + Polynomial.Splits ((minpoly W.toAffine.FunctionField a).map + (algebraMap W.toAffine.FunctionField W.toAffine.FunctionField)) := by +- letI algB := (mulByInt W.toAffine ℓ).toAlgebra +- -- Re-pin the canonical `Algebra K(E) Ω` to use `Algebra.id` for the `[Algebra K(E) K(E)]` slot +- -- of `AlgebraicClosure.instAlgebra` (otherwise the ambient `letI := pullback` poisons it, making +- -- the proof's `algebraMap K(E) Ω` disagree with the one baked into `hmem`). +- letI stdΩ : Algebra W.toAffine.FunctionField (AlgebraicClosure W.toAffine.FunctionField) := ++ let algB := (mulByInt W.toAffine ℓ).toAlgebra ++ -- Use the standard embedding into the algebraic closure for the coordinate field, ++ -- while the base-field action on that coordinate field is the isogeny pullback. ++ let stdΩ : Algebra W.toAffine.FunctionField (AlgebraicClosure W.toAffine.FunctionField) := + @AlgebraicClosure.instAlgebra W.toAffine.FunctionField _ W.toAffine.FunctionField _ + (Algebra.id W.toAffine.FunctionField) +- haveI hfin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField ++ have hfin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField + _ _ algB.toModule := isogeny_finiteDimensional W (mulByInt W.toAffine ℓ) +- haveI halg : Algebra.IsAlgebraic W.toAffine.FunctionField W.toAffine.FunctionField := ++ have halg : Algebra.IsAlgebraic W.toAffine.FunctionField W.toAffine.FunctionField := + Algebra.IsAlgebraic.of_finite _ _ + -- `Ω = AlgebraicClosure K(E)` is made a *base*-algebra via the ring hom `algebraMap ∘ pullback`, + -- supplied *inline* to the abstract criterion (never a scope instance, so the standard +@@ -486,7 +478,7 @@ theorem minpoly_gen_splits_of_mem_range [IsAlgClosed F] (ℓ : ℤ) (_hℓ : ℓ + rfl + -- Build the `F`-algHom `g` by restricting scalars along `F → B`, using the inline scalar tower + -- `F → B → Ω` (`of_algHom` for `(algebraMap) ∘ pullback`); supplied `@`-explicitly. +- haveI htower : @IsScalarTower F W.toAffine.FunctionField ++ have htower : @IsScalarTower F W.toAffine.FunctionField + (AlgebraicClosure W.toAffine.FunctionField) _ + (((algebraMap W.toAffine.FunctionField (AlgebraicClosure W.toAffine.FunctionField)).comp + (mulByInt W.toAffine ℓ).pullback.toRingHom).toAlgebra).toSMul _ := +@@ -537,11 +529,11 @@ once the two generator minimal polynomials do (`mulByInt_genCoords_minpoly_split + theorem h_normal_mulByInt [IsAlgClosed F] (ℓ : ℤ) (hℓ : ℓ ≠ 0) : + letI := (mulByInt W.toAffine ℓ).toAlgebra + Normal W.toAffine.FunctionField W.toAffine.FunctionField := by +- letI := (mulByInt W.toAffine ℓ).toAlgebra +- haveI hfin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField ++ let := (mulByInt W.toAffine ℓ).toAlgebra ++ have hfin : @FiniteDimensional W.toAffine.FunctionField W.toAffine.FunctionField + _ _ (mulByInt W.toAffine ℓ).toAlgebra.toModule := + isogeny_finiteDimensional W (mulByInt W.toAffine ℓ) +- haveI halg : Algebra.IsAlgebraic W.toAffine.FunctionField W.toAffine.FunctionField := ++ have halg : Algebra.IsAlgebraic W.toAffine.FunctionField W.toAffine.FunctionField := + Algebra.IsAlgebraic.of_finite _ _ + obtain ⟨hsx, hsy⟩ := mulByInt_genCoords_minpoly_splits W ℓ hℓ + refine normal_iff.mpr fun z ↦ ⟨(halg.isAlgebraic z).isIntegral, ?_⟩ +diff --git a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionModule.lean b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionModule.lean +index e011591e1..dcc33eba4 100644 +--- a/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionModule.lean ++++ b/projects/HasseWeil/HasseWeil/HasseBound/WeilPairing/TorsionModule.lean +@@ -10,27 +10,16 @@ import Mathlib.FieldTheory.Finiteness + import Mathlib.LinearAlgebra.Dimension.Free + + /-! +-# `E[ℓ] ≅ (ZMod ℓ)²` — the geometric `ℓ`-torsion as a 2-dimensional `ZMod ℓ`-vector space ++# The two-dimensional module of prime torsion points + +-For `ℓ` prime and `F` algebraically closed with `(ℓ : F) ≠ 0` (i.e. `ℓ ≠ char F`), the geometric +-`ℓ`-torsion `E[ℓ] = W.toAffine[(ℓ : ℤ)]` is a 2-dimensional vector space over the field `ZMod ℓ`. ++For a prime `ℓ` different from the characteristic of an algebraically ++closed field, the geometric torsion subgroup `E[ℓ]` has cardinality ++`ℓ²`. Since every element is killed by `ℓ`, it is a vector space over ++`ZMod ℓ`. The finite-vector-space cardinality formula gives dimension ++two, hence a basis indexed by `Fin 2` and an identification with ++`Fin 2 → ZMod ℓ`. + +-This builds on the axiom-clean cardinality theorem +-`HasseWeil.WeilPairing.TorsionGeometric.card_torsion_ell` (`#E[ℓ] = ℓ²`, Silverman III.6.4(a)) +-and packages the structure-theoretic consequences: +- +-* `card_torsion_ell_nat` — `Nat.card E[ℓ] = ℓ²` (no `ℤ`-coercion); +-* `torsion_ell_finite` — `E[ℓ]` is finite; +-* the `Module (ZMod ℓ)` structure on `E[ℓ]` (every element is killed by `ℓ`), via +- `AddCommGroup.zmodModule`; +-* `finrank_torsion_ell` — `finrank (ZMod ℓ) E[ℓ] = 2`, via `Module.natCard_eq_pow_finrank`; +-* `torsion_ell_basis` — a `Basis (Fin 2) (ZMod ℓ) E[ℓ]`, via `Module.finBasisOfFinrankEq`; +-* `torsion_ell_linearEquiv` — `E[ℓ] ≃ₗ[ZMod ℓ] (Fin 2 → ZMod ℓ)`, via `Basis.equivFun`. +- +-These are the structures the downstream mod-`ℓ` Galois representation +-`ρ_ℓ : End(E) → GL₂(ZMod ℓ)` consumes. +- +-Reference: Silverman III.6.4(a), III.7. ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.6.4(a), III.7. + -/ + + open WeierstrassCurve +@@ -97,13 +86,13 @@ theorem torsion_ell_finite : Finite W.toAffine[(ℓ : ℤ)] := by + forces `ℓ^finrank = ℓ²`, hence `finrank = 2` since `ℓ ≥ 2`. -/ + theorem finrank_torsion_ell : + Module.finrank (ZMod ℓ) W.toAffine[(ℓ : ℤ)] = 2 := by +- haveI := torsion_ell_finite W ℓ hℓF ++ have := torsion_ell_finite W ℓ hℓF + have hcard : Nat.card W.toAffine[(ℓ : ℤ)] + = Nat.card (ZMod ℓ) ^ Module.finrank (ZMod ℓ) W.toAffine[(ℓ : ℤ)] := + Module.natCard_eq_pow_finrank + rw [card_torsion_ell_nat W ℓ hℓF] at hcard + have hZcard : Nat.card (ZMod ℓ) = ℓ := by +- haveI : NeZero ℓ := ⟨hℓ.out.pos.ne'⟩ ++ have : NeZero ℓ := ⟨hℓ.out.pos.ne'⟩ + rw [Nat.card_eq_fintype_card, ZMod.card] + rw [hZcard] at hcard + -- `ℓ ^ 2 = ℓ ^ finrank`, and `ℓ ≥ 2`, so the exponents agree. +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Basic.lean b/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Basic.lean +index 5e7b88094453689a80fefbc79c4a6dcb9032a838..e2365c39fcec4a07f8b7e2aac47dfbd1ec0b90ad 100644 +GIT binary patch +delta 481 +zcmX^2mhsOf#tjvWlTF!QZ@$9$o-sB*H?u?`+9fqPGbJ%8C)Kr3!7WxHIy^NqwWzqH +zD6zQMxwNP(RnN27H76&tpd>R{A^cHOBVi>?u?m@alN)&DHb3BANMma@H}GC(+$=39 +z!8Ey1v}W^jNllK;b}DHCo1d8f;1b95VK&HZn{PWkXT&La&?Sa>bGz4C7Mv=K{jam( +zl;jLkV!|n@6)}ZRo(qSwxb$^(6|}S_CuGZP*2>v~+mxqy0!+*bRtl2^!=)#S6mHu5 +Iw)i0v0F`R9Hvj+t + +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Concrete.lean b/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Concrete.lean +index a56daff33..930b5c5e6 100644 +--- a/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Concrete.lean ++++ b/projects/HasseWeil/HasseWeil/Isogeny/BaseChange/Concrete.lean +@@ -6,72 +6,23 @@ Authors: Chris Birkbeck + import HasseWeil.HasseBound.WeilPairing.Scaling.OneSub + + /-! +-# Concrete base-change of a function-field pullback (CoordHom-free) ++# Base change of function-field pullbacks + +-For a smooth plane curve `C / F` and an `F`-algebra extension `L` with `L/F` algebraic, the +-function-field scalar-extension iso `K(C_L) ≅ L ⊗_F K(C)` is **already** available, axiom-clean, in +-`HasseWeil/Curves/CurveMapBaseChange.lean`: ++For an algebraic field extension `L/F`, the canonical scalar-extension ++isomorphism `Φ : L ⊗[F] K(C) ≃ₐ[L] K(C_L)` transports a function-field ++endomorphism `f` to `Φ ∘ (id_L ⊗ f) ∘ Φ⁻¹`. + +-* `functionField_tensor_locBaseChange L : (L ⊗ K(C)) ≃ₐ[L] FractionRing (L ⊗ C.CR)`, +-* `functionField_baseChange_fracEquiv L : FractionRing (L ⊗ C.CR) ≃ₐ[L] K(C_L)`. ++The type synonym `Twist f` carries the scalar action through `f`. An ++explicit tensor-product linear equivalence identifies its base change ++with `Twist (id_L ⊗ f)`, proving preservation of the twisted module rank ++and hence of the degree of the pullback. + +-Composing them gives the iso `Φ : (L ⊗ K(C)) ≃ₐ[L] K(C_L)` (`tensorFunctionFieldEquiv`). ++For `1 - π`, this constructs the base-changed pullback and its degree ++identity. The scaling data retain explicit hypotheses for the geometric ++kernel, divisor transport, duality, surjectivity and translation covariance. + +-This file uses `Φ` to **construct** the base-change of an arbitrary function-field `F`-algebra hom +-`f : K(C) →ₐ[F] K(C)` — *no `CoordHom` required* — as the conjugate +- +- `baseChangePullback f := Φ ∘ (id_L ⊗ f) ∘ Φ⁻¹ : K(C_L) →ₐ[L] K(C_L)`, +- +-an honest `L`-algebra hom (`Algebra.TensorProduct.map (AlgHom.id L) f` is the `L`-linear scalar +-extension of the `F`-linear `f`, conjugated by the `L`-algebra equiv `Φ`). +- +-The payoff (`oneSubFrobeniusPullback_L`) is the concrete `pullback_L` field of `OneSubScalingData` +-for the separable genuine isogeny `1 − π`, whose pullback has poles at the affine kernel so admits +-**no** `CoordHom` — hence the whole CoordHom-free route. +- +-## Degree preservation +- +-`finrank_baseChangePullback_eq_finrank_lTensorMap` reduces the degree of the conjugate +-`baseChangePullback f` (as an `Isogeny`, via `Isogeny.degree_eq_of_finrank_eq`) to the `finrank` of +-the *scalar extension* `id_L ⊗ f` over `L ⊗ K(C)`, by transporting the finrank along the `L`-algebra +-equiv `Φ` (`Algebra.finrank_eq_of_equiv_equiv`). This **conjugation step is proved here in full**. +- +-The remaining equality `finrank_{L ⊗ K(C), via id_L ⊗ f}(L ⊗ K(C)) = finrank_{K(C), via f} K(C)` +-is the curve-free **base-change-of-finrank** content; it is **proved here in full** as +-`finrankBaseChange`, by realizing the `f`-twisted self-module `K(C)` as the type synonym `Twist f` +-and exhibiting `(L ⊗ K(C)) ⊗_{K(C)} Twist f ≃ₗ[L ⊗ K(C)] Twist (id_L ⊗ f)` (so +-`Module.finrank_baseChange` applies). Hence `baseChangePullback_finrank_eq` (and the degree +-preservation it feeds) carries **no** finrank hypothesis. +- +-## What this file discharges for `OneSubScalingData` +- +-`mkOneSubScalingDataConcrete` assembles a full `OneSubScalingData` for the genuine `1 − π` base +-change in which: +- +-* `pullback_L` is **constructed** as the concrete `oneSubFrobeniusPullback_L` (the conjugate +- `Φ ∘ (id_L ⊗ (1−π).pullback) ∘ Φ⁻¹`) — *no longer a raw input* (axiom-clean); +-* `hdeg_bc` is **fully discharged** by the proved conjugation step +- `finrank_baseChangePullback_eq_finrank_lTensorMap` chained with the proved curve-free +- `finrankBaseChange` — no carried hypothesis. +- +-The remaining inputs are exactly the genuinely-deep **K̄-level geometric** residuals, each stated +-against the concrete pullback: +- +-* `finiteKer` — finiteness of `ker(1 − π)_{K̄}` (a separable isogeny has finite kernel over `K̄`); +-* `hproj` — `ProjOrdTransport` (multiplicity-free divisor pullback); +-* `δ`/`hdc` — the divisor-pushforward dual `1 − V̄` and Silverman III.6.2(a) `δ ∘ φ = [#ker φ]`; +-* `hsurj` — surjectivity over `K̄` (Silverman III.4.10a); +-* `hkerdeg` — the separable degree match `#ker = deg` (Silverman III.4.10c); +-* `hcomm'` — the translation covariance (Silverman III.8.2). +- +-These are the genuine geometric content of the base-changed separable isogeny; the project ships no +-concrete base-change of a non-Frobenius isogeny's *point map* (only the witness-parametric +-`mkBaseChange`), so they remain carried (cf. `ProjOrdTransport`/`Naturality` elsewhere). +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, II.2.11 (degree under base change), +- III.4.10a/c, III.6.2(a), III.8.2, III.8.6.1. ++References: Silverman, *The Arithmetic of Elliptic Curves*, II.2.11, ++III.4.10, III.6.2(a), and III.8.2–6. + -/ + + open WeierstrassCurve HasseWeil.Curves +@@ -149,8 +100,7 @@ local notation "lTM" => Algebra.TensorProduct.map (AlgHom.id L L) f + attribute [local instance] Algebra.TensorProduct.rightAlgebra + + /-- `eFwd` is surjective, from its action on pure tensors (`heFwd`) and the section `eInv` +-(`heInv`). Stated with the forward/inverse maps as opaque parameters so it elaborates within the +-default heartbeat budget. -/ ++(`heInv`). The forward and inverse maps are explicit parameters. -/ + private theorem twistLTensor_surjective [Module A (Twist (lTM))] + [IsScalarTower A (L ⊗[F] A) (Twist (lTM))] + (eFwd : ((L ⊗[F] A) ⊗[A] (Twist f)) →ₗ[L ⊗[F] A] (Twist (lTM))) +@@ -164,7 +114,6 @@ private theorem twistLTensor_surjective [Module A (Twist (lTM))] + refine ⟨eInv (Twist.toB (lTM) z), ?_⟩ + apply Twist.toB_injective (lTM) + induction (Twist.toB (lTM) z) with +- | zero => simp only [map_zero]; rfl + | add x y hx hy => + rw [map_add, map_add, Twist.toB_add] + rw [show Twist.toB (lTM) (eFwd (eInv x)) = x from hx, +@@ -176,7 +125,7 @@ private theorem twistLTensor_surjective [Module A (Twist (lTM))] + Algebra.TensorProduct.tmul_mul_tmul, mul_one, one_mul] + + /-- `eInv ∘ toB ∘ eFwd = id`, from the action on pure tensors. The left inverse, giving +-injectivity of `eFwd`. Forward/inverse maps are opaque parameters for heartbeat budget. -/ ++injectivity of `eFwd`. The forward and inverse maps are explicit parameters. -/ + private theorem twistLTensor_leftInverse [Module A (Twist (lTM))] + [IsScalarTower A (L ⊗[F] A) (Twist (lTM))] + (eFwd : ((L ⊗[F] A) ⊗[A] (Twist f)) →ₗ[L ⊗[F] A] (Twist (lTM))) +@@ -188,14 +137,9 @@ private theorem twistLTensor_leftInverse [Module A (Twist (lTM))] + ∀ t : (L ⊗[F] A) ⊗[A] (Twist f), eInv (Twist.toB (lTM) (eFwd t)) = t := by + intro t + induction t with +- | zero => rw [map_zero (f := eFwd), show Twist.toB (lTM) 0 = 0 from rfl, +- map_zero (f := eInv)] + | add x y hx hy => rw [map_add (f := eFwd), Twist.toB_add, map_add (f := eInv), hx, hy] + | tmul w m => + induction w with +- | zero => +- rw [TensorProduct.zero_tmul, map_zero (f := eFwd), +- show Twist.toB (lTM) 0 = 0 from rfl, map_zero (f := eInv)] + | add x y hx hy => + rw [TensorProduct.add_tmul, map_add (f := eFwd), Twist.toB_add, map_add (f := eInv), + hx, hy] +@@ -222,9 +166,9 @@ equals the `A`-module finrank of `A` via `f`. Proved by exhibiting the `L ⊗ A + private theorem finrank_lTensorMap_eq_finrank : + @Module.finrank (L ⊗[F] A) (L ⊗[F] A) _ _ (lTM).toRingHom.toAlgebra.toModule = + @Module.finrank A A _ _ f.toRingHom.toAlgebra.toModule := by +- letI iA_TwL : Module A (Twist (lTM)) := ++ let iA_TwL : Module A (Twist (lTM)) := + Module.compHom (Twist (lTM)) (algebraMap A (L ⊗[F] A)) +- haveI iA_TwL_tower : IsScalarTower A (L ⊗[F] A) (Twist (lTM)) := ++ have iA_TwL_tower : IsScalarTower A (L ⊗[F] A) (Twist (lTM)) := + SMul.comp.isScalarTower (algebraMap A (L ⊗[F] A)) + let l : (Twist f) →ₗ[A] (Twist (lTM)) := + { toFun := fun m ↦ Twist.ofB (lTM) (1 ⊗ₜ[F] Twist.toB f m) +@@ -292,8 +236,7 @@ variable (L : Type*) [Field L] [Algebra F L] [Algebra.IsAlgebraic F L] + + /-- **The function-field scalar-extension iso** `Φ : (L ⊗_F K(C)) ≃ₐ[L] K(C_L)`, the composite of + `functionField_tensor_locBaseChange` (`L ⊗ K(C) ≅ FractionRing (L ⊗ C.CR)`) and +-`functionField_baseChange_fracEquiv` (`FractionRing (L ⊗ C.CR) ≅ K(C_L)`). Both are shipped +-axiom-clean in `CurveMapBaseChange.lean`. -/ ++`functionField_baseChange_fracEquiv` (`FractionRing (L ⊗ C.CR) ≅ K(C_L)`). These are the canonical tensor and fraction-field identifications. -/ + noncomputable def tensorFunctionFieldEquiv : + letI := C.isDomain_tensorCoordRing L + (L ⊗[F] C.toAffine.FunctionField) ≃ₐ[L] (C.baseChange L).toAffine.FunctionField := +@@ -307,7 +250,7 @@ noncomputable def lTensorMap (f : C.toAffine.FunctionField →ₐ[F] C.toAffine. + (L ⊗[F] C.toAffine.FunctionField) →ₐ[L] (L ⊗[F] C.toAffine.FunctionField) := + Algebra.TensorProduct.map (AlgHom.id L L) f + +-set_option linter.unusedSectionVars false in ++omit [Algebra.IsAlgebraic F L] in + @[simp] theorem lTensorMap_tmul + (f : C.toAffine.FunctionField →ₐ[F] C.toAffine.FunctionField) (l : L) + (u : C.toAffine.FunctionField) : +@@ -355,10 +298,10 @@ theorem finrank_baseChangePullback_eq_finrank_lTensorMap + (baseChangePullback C L f).toRingHom.toAlgebra.toModule = + @Module.finrank (L ⊗[F] C.toAffine.FunctionField) (L ⊗[F] C.toAffine.FunctionField) _ _ + (lTensorMap C L f).toRingHom.toAlgebra.toModule := by +- letI := C.isDomain_tensorCoordRing L +- letI algBcp : Algebra (C.baseChange L).toAffine.FunctionField ++ let := C.isDomain_tensorCoordRing L ++ let algBcp : Algebra (C.baseChange L).toAffine.FunctionField + (C.baseChange L).toAffine.FunctionField := (baseChangePullback C L f).toRingHom.toAlgebra +- letI algLt : Algebra (L ⊗[F] C.toAffine.FunctionField) (L ⊗[F] C.toAffine.FunctionField) := ++ let algLt : Algebra (L ⊗[F] C.toAffine.FunctionField) (L ⊗[F] C.toAffine.FunctionField) := + (lTensorMap C L f).toRingHom.toAlgebra + refine Algebra.finrank_eq_of_equiv_equiv (tensorFunctionFieldEquiv C L).symm.toRingEquiv + (tensorFunctionFieldEquiv C L).symm.toRingEquiv ?_ +@@ -380,7 +323,7 @@ def FinrankBaseChange (f : C.toAffine.FunctionField →ₐ[F] C.toAffine.Functio + @Module.finrank C.toAffine.FunctionField C.toAffine.FunctionField _ _ + f.toRingHom.toAlgebra.toModule + +-set_option linter.unusedSectionVars false in ++omit [Algebra.IsAlgebraic F L] in + /-- **The base-change-of-finrank fact, proved (curve-free).** For an `F`-algebra endomorphism `f` + of the field `K(C)`, base change along `F → L` preserves the degree of the (injective) field + endomorphism: `[L ⊗ K(C) : (id_L ⊗ f)(L ⊗ K(C))] = [K(C) : f(K(C))]`. -/ +@@ -422,7 +365,7 @@ noncomputable def oneSubFrobeniusPullback_L (hq : 2 ≤ Fintype.card K) : + + /-- **Degree preservation for the concrete `1 − π` base change** (curve-free, fully discharged). + Chains the proved conjugation step (inside `baseChangePullback_finrank_eq`, which now invokes the +-proved `finrankBaseChange`) into the shipped witness-parametric ++proved `finrankBaseChange`) into the corresponding + `oneSubFrobeniusIsogBaseChange_degree_eq_of_finrank`. This **discharges the `hdeg_bc` field** of + `OneSubScalingData` with no carried `FinrankBaseChange` hypothesis. -/ + theorem oneSubFrobeniusIsogBaseChange_degree_eq_of_finrankBaseChange (hq : 2 ≤ Fintype.card K) : +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/Basic.lean b/projects/HasseWeil/HasseWeil/Isogeny/Basic.lean +index 01ae90e29..fc74956a0 100644 +--- a/projects/HasseWeil/HasseWeil/Isogeny/Basic.lean ++++ b/projects/HasseWeil/HasseWeil/Isogeny/Basic.lean +@@ -45,7 +45,7 @@ image of `x` has poles at the `n`-torsion). + The current `pullback_ordAtInfty_nonneg` field captures "morphism is defined at + the basepoint" (regular functions pull back to regular functions). It does not + strictly capture `φ(O) = O` — that would require the strict-positive form +-`0 < ord_∞ f → 0 < ord_∞ pullback f`. A future refinement may strengthen this. ++`0 < ord_∞ f → 0 < ord_∞ pullback f`. + + ## References + +@@ -296,6 +296,7 @@ noncomputable def Isogeny.frobenius : Isogeny W W where + · rw [(⟨W⟩ : Curves.SmoothPlaneCurve K).ordAtInfty_pow hf] + exact nsmul_nonneg h _ + ++omit [DecidableEq K] in + @[simp] theorem Isogeny.frobenius_pullback (f : W.FunctionField) : + (Isogeny.frobenius W).toCurveMap.pullback f = f ^ Fintype.card K := + congr_fun (FiniteField.coe_frobeniusAlgHom (K := K) (R := W.FunctionField)) f +@@ -313,12 +314,14 @@ noncomputable def Isogeny.frobeniusCoordHom : + (FiniteField.frobeniusAlgHom K W.CoordinateRing u) + simp only [FiniteField.coe_frobeniusAlgHom, map_pow] + ++omit [DecidableEq K] in + /-- The Frobenius isogeny has degree `q := #K`. Inherits from + `HasseWeil.frobenius_finrank_functionField`. Reference: Silverman III.4.6. -/ + @[simp] theorem Isogeny.frobenius_degree : + (Isogeny.frobenius W).degree = Fintype.card K := + HasseWeil.frobenius_finrank_functionField K W + ++omit [DecidableEq K] in + /-- **Frobenius coordinate-evaluation step.** Evaluating a pulled-back + coordinate-ring element `r` through the Frobenius coordinate hom at a smooth + point `(x, y)` equals the `q`-th power (`q := #K`) of the plain evaluation: +@@ -336,6 +339,7 @@ private theorem Isogeny.frobenius_evalAtPullback {x y : K} + ⟨x, y, h⟩ (FiniteField.frobeniusAlgHom K W.CoordinateRing r) = _ + simp only [FiniteField.coe_frobeniusAlgHom, map_pow] + ++omit [DecidableEq K] in + /-- The Frobenius isogeny acts as the **identity** on `K`-rational points: for + any `(x, y) ∈ W(K)`, Frobenius sends `(x, y) ↦ (x^q, y^q) = (x, y)` since + `x^q = x` for all `x ∈ K` by `FiniteField.pow_card`. The basepoint is +@@ -383,23 +387,17 @@ end Frobenius + + /-! ### Multiplication-by-`n` isogeny + +-The endomorphism `[n] : E → E` is constructed via the function-field pullback +-`mulByInt_pullbackAlgHom` from `HasseWeil/MulByIntPullback.lean` (built from +-division polynomials). ++The endomorphism `[n] : E → E` is constructed from the division-polynomial ++function-field pullback `mulByInt_pullbackAlgHom`. + +-The basepoint condition `pullback_ordAtInfty_nonneg` for `[n]` is genuinely +-non-trivial — it requires the ramification-theoretic fact that +-`ord_∞([n]*f) = e · ord_∞(f)` for some positive integer `e` (the local +-ramification index of `[n]` at `O`). For now we expose this as an explicit +-hypothesis (`mulByIntOfBasepoint`); a follow-up ticket will discharge it via +-the existing `mulByInt_finrank` infrastructure or a dedicated valuation +-extension argument. ++The construction `mulByIntOfBasepoint` takes an explicit hypothesis that the ++pullback preserves functions regular at infinity. The corresponding local ++ramification formula is `ord_∞([n]*f) = e · ord_∞(f)` with positive ramification ++index `e`. + +-Note that `[n]` does *not* admit a `coordHom` witness in the affine model — +-its pullback of `x` is `Φ_n / Ψ_n²`, a fraction with poles at the +-`n`-torsion. Hence `Isogeny.toPointMap` cannot be invoked for `mulByInt` +-directly via the affine route; this is the design reason for separating +-`coordHom` from the structure. -/ ++For `n ≥ 2`, the pullback of `x` is `Φ_n / Ψ_n²`, with poles at the `n`-torsion. ++Thus this projective morphism does not generally induce a map of affine ++coordinate rings. -/ + + section MulByInt + +@@ -428,6 +426,7 @@ noncomputable def Isogeny.mulByIntOfBasepoint {n : ℤ} (hn : n ≠ 0) + toCurveMap := { pullback := HasseWeil.mulByInt_pullbackAlgHom W n hn } + pullback_ordAtInfty_nonneg := h_basepoint + ++omit [DecidableEq F] in + @[simp] theorem Isogeny.mulByIntOfBasepoint_pullback {n : ℤ} (hn : n ≠ 0) + (h_basepoint : MulByIntBasepoint W hn) (f : W.FunctionField) : + (Isogeny.mulByIntOfBasepoint W hn h_basepoint).toCurveMap.pullback f = +@@ -435,48 +434,14 @@ noncomputable def Isogeny.mulByIntOfBasepoint {n : ℤ} (hn : n ≠ 0) + + end MulByInt + +-/-! ### Universal group-homomorphism property: bundled `WithHom` isogenies ++/-! ### Bundled group-homomorphism property + +-This is the working framework for **Silverman III.4.8** (every isogeny is a +-group homomorphism). Silverman's argument uses `Pic⁰(E) ≅ E` and the +-contravariant functoriality of the Picard variety on morphisms; alternative +-routes go via the formal group of `E` or direct addition-formula computation. ++The `WithHom` structure bundles an isogeny with an affine coordinate-ring map ++and a proof of `AddHomProperty`. Identity, composition and Frobenius preserve ++this data, yielding additive homomorphisms on rational points. + +-In our setup, the unconditional theorem is genuinely hard — it reduces to one +-of those upstream infrastructures, none of which are fully in the project yet. +-Instead, we package the **closure under standard constructions**: any isogeny +-built from `id`, `compose`, and `frobenius` automatically carries an +-`AddHomProperty`, hence a bundled `AddMonoidHom` on points. +- +-The `WithHom` bundle below is the canonical recipient of these closure +-operations. Future extensions (mulByInt, neg, dual, factor-through-Frobenius, +-…) should provide their own `WithHom` instances by discharging the +-`AddHomProperty` witness. +- +-## Proof routes for the universal version +- +-Silverman's three known routes for the universal Silverman III.4.8: +- +-1. **Pic⁰ route** (Silverman III.4.8 proper). Uses +- `σ : Pic⁰(E) ≅ E` (Silverman III.3.4) — gated on `T-III-3-004` in this +- project. The induced pullback `φ_* : Pic⁰(E₁) → Pic⁰(E₂)` is a hom by +- functoriality, and the diagram with σ commutes when `φ(O) = O`. +- +-2. **Formal-group route** (deformation argument). An isogeny pulls back to a +- formal-group hom on `Ê`. The hom property holds on the formal neighborhood +- of `O`, then extends to all of `E` by translation invariance and density. +- Requires the bridge `HasseWeil.Isogeny → HasseWeil.FormalGroupHom`, not yet +- built. +- +-3. **Addition-formula route** (direct computation). Use the explicit +- `Affine.addX/addY` formulas; show that any `F`-algebra hom on `K(E)` that +- restricts to coord rings preserves these (an algebra-homs-respect-rational- +- functions argument). Requires `addPullbackAlgHom` from +- `HasseWeil/AdditionPullback.lean` (currently has 3 transcendence sorries). +- +-All three reduce the universal claim to upstream infrastructure that is +-modular: once any one route's gates are filled, `silvermanIII48_via_` +-can be added as a one-liner taking the upstream output as a witness. -/ ++Silverman III.4.8 proves the group-homomorphism property for isogenies using ++`Pic⁰(E) ≅ E` and the functoriality of the Picard variety. -/ + + namespace Isogeny + +@@ -627,23 +592,6 @@ noncomputable def Isogeny.WithHom.frobenius + show (Isogeny.frobenius W).toPointMap (Isogeny.frobeniusCoordHom W) P = P + exact Isogeny.frobenius_toPointMap W P + +-/-! ### Future extensions (mulByInt, neg, dual) +- +-For each of the following, providing a `WithHom` instance requires both a +-coord-ring lift (often non-trivial) and the `AddHomProperty` proof: +- +-* `mulByInt n` for `n ≥ 2`: the affine coord-ring lift doesn't naturally +- exist (image of `x` is `Φₙ/Ψₙ²`, with poles at the `n`-torsion). Resolution +- requires a localization-based `CoordHom` or a projective coord model. +- +-* `neg` (the `[-1]` isogeny): `(x, y) ↦ (x, -y - a₁x - a₃)`. Has a clean +- affine coord-ring lift via `Affine.negY`. The `AddHomProperty` is +- `-(P+Q) = -P + -Q`, which holds by `neg_add` on the abelian group `W.Point`. +- Construction is straightforward in principle but requires explicit +- `AlgHom` building from the negY formula on the function field. + +-* `dual α`: requires the existence-uniqueness of the dual isogeny +- (Silverman III.6.1), gated on either Pic⁰ or kernel/factorization +- infrastructure (`T-III-6-001` in the project ticket board). -/ + + end HasseWeil.EC +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/ClassGroup.lean b/projects/HasseWeil/HasseWeil/Isogeny/ClassGroup.lean +index 9b2003a2e..5d5eaceb9 100644 +--- a/projects/HasseWeil/HasseWeil/Isogeny/ClassGroup.lean ++++ b/projects/HasseWeil/HasseWeil/Isogeny/ClassGroup.lean +@@ -8,59 +8,12 @@ import HasseWeil.Foundation.Ramification + import HasseWeil.Pic0.ClassGroupNorm + + /-! +-# The isogeny ↔ class-group bridge (reusable Pic⁰ infrastructure) ++An injective finite coordinate-ring pullback associated to an elliptic-curve ++endomorphism induces extension and relative-norm maps on the ideal class group. ++Their composite raises each class to the coordinate-ring extension degree. ++A compatible fraction-field tower identifies this degree with the isogeny degree. + +-This file packages, for an endomorphism `α : Isogeny E E` of an elliptic curve `E`, the data and +-lemmas needed to push `α` down to the ideal class group `ClassGroup E.CoordinateRing` and recover +-the dual relation `α̂ ∘ α = [deg α]` at the level of `ClassGroup`. +- +-The function-field pullback `α.pullback : E.FunctionField →ₐ[F] E.FunctionField` does **not** in +-general restrict to the coordinate ring `R := E.CoordinateRing` (this is the +-integrality-preservation content of Silverman III.3.4, deliberately *not* discharged here). We +-therefore carry the restriction as **data**, an `Isogeny.CoordHom`, mirroring +-`Curves.CurveMap.CoordHom`. +- +-The deep obligations are carried as **hypotheses** (witness-parametric), not discharged universally: +- +-* injectivity of the coordinate-ring restriction (`hinj`), giving `FaithfulSMul`/`IsTorsionFree`; +-* finiteness of `R` over itself through the restriction (`Module.Finite`), giving the `ClassGroup` +- norm/extension maps and matching `α.degree` to the coordinate-ring `finrank`. +- +-These are instantiable per isogeny (e.g. Frobenius, multiplication-by-`n`); the universal versions +-are separate, flagged-deep tickets. +- +-## Main definitions +- +-* `HasseWeil.Isogeny.CoordHom`: the coordinate-ring restriction witness for `α : Isogeny E E`. +-* `HasseWeil.Isogeny.CoordHom.toAlgebra`: the induced `R`-algebra structure on `R`. +-* `HasseWeil.Isogeny.classNorm` / `Isogeny.classMap`: the relative norm / extension maps on +- `ClassGroup R` induced by a `CoordHom`. +- +-## Main results +- +-* `HasseWeil.Isogeny.degree_eq_finrank_coordinateRing_of_tower_eq`: `α.degree` equals the +- coordinate-ring `finrank` of `ch.toAlgebra`, given a fraction-field tower witness for the +- `ch`-twisted coordinate ring (witness-parametric, to sidestep a same-type instance diamond — see +- the lemma's docstring). +-* `HasseWeil.Isogeny.classNorm_comp_classMap`: `classNorm (classMap c) = c ^ (finrank R R)` — the +- class-group shadow of `α̂ ∘ α = [deg α]`, exponent as the coordinate-ring degree. +-* `HasseWeil.Isogeny.classNorm_comp_classMap_degree`: the same with exponent `α.degree` (combines +- the previous two; carries the tower witness as hypotheses). +- +-## Design note +- +-The function-field pullback restricted to coordinate rings and lifted back to the fraction field +-gives, on the *same* carriers `R` and `FF`, a *non-identity* algebra structure. Several would-be +-"auto-derived" scalar towers (`R → R → FF`, `R → FF → FF`) are therefore **false** as stated with +-the canonical base action, and `finrank_of_isFractionRing` cannot be applied with `S = R`, +-`S' = FF` literally (the `IsFractionRing` typeclass cannot distinguish the canonical inclusion from +-the twisted map). The deep obligations (injectivity `hinj`, finiteness `Module.Finite`, and the +-fraction-field tower witness for the degree bridge) are consequently carried as **hypotheses**; +-they are instantiable per isogeny (Frobenius, multiplication-by-`n`). +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*], III.3.4, III.4, III.6. ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, III.3.4. + -/ + + open WeierstrassCurve Polynomial +@@ -146,7 +99,7 @@ noncomputable def classNorm (ch : α.CoordHom) (hinj : Function.Injective ch.toA + haveI hfinI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin + haveI htfI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := + ch.isTorsionFree hinj +- @ClassGroup.relNorm E.CoordinateRing E.CoordinateRing _ _ _ _ _ _ _ _ ch.toAlgebra hfinI htfI ++ @ClassGroup.relNorm E.CoordinateRing E.CoordinateRing _ _ _ _ ch.toAlgebra hfinI htfI + + /-- The **extension map on the class group** induced by `α : Isogeny E E` and a coordinate-ring + restriction witness `ch`, with the finiteness obligation carried as a hypothesis. +@@ -160,7 +113,7 @@ noncomputable def classMap (ch : α.CoordHom) (hinj : Function.Injective ch.toAl + haveI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin + haveI htfI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := + ch.isTorsionFree hinj +- @ClassGroup.map E.CoordinateRing E.CoordinateRing _ _ _ _ _ _ ch.toAlgebra htfI ++ @ClassGroup.map E.CoordinateRing E.CoordinateRing _ _ _ _ ch.toAlgebra htfI + + /-- **Function-field ↔ coordinate-ring degree bridge (witness-parametric `_of_tower_eq` form).** + +@@ -168,23 +121,11 @@ The function-field degree `α.degree` equals the coordinate-ring degree + `Module.finrank R R` (with `R` carrying `ch.toAlgebra`), *given* a fraction-field tower witness for + the `ch`-twisted coordinate ring. + +-The deep obstruction (see the file-level note and the round report) is a genuine **same-type +-instance diamond**: `Algebra.IsAlgebraic.finrank_of_isFractionRing` needs the source/target rings +-`R, S` and their fraction fields `R', S'` to be *distinguishable type pairs* so that +-`IsFractionRing R R'` and `IsFractionRing S S'` can coexist with the canonical inclusion (for `R'`) +-and the `ch`-twisted map (for the `S → S'` tower) respectively. With `S = R` and `S' = R' = FF` +-*literally*, Lean's instance resolution cannot keep the two `Algebra R FF` structures apart, even +-though the required equation `α.pullback (algebraMap R FF r) = algebraMap R FF (ch.toAlgHom r)` is +-exactly `ch.compat`. +- +-We therefore expose the bridge witness-parametrically: the caller supplies a *distinct nominal copy* +-`S` of the `ch`-twisted coordinate ring together with its fraction field `S'` (a copy of +-`E.FunctionField` carrying `α.toAlgebra`), the standard fraction-field tower instances, and the two +-`Module.finrank`-transfer equalities `hSR`, `hS'FF` (each a `LinearEquiv.finrank_eq` away once the +-copies are chosen). These are dischargeable per isogeny (Frobenius, multiplication-by-`n`). +- +-The conclusion is then a one-line application of `finrank_of_isFractionRing` between the four +-distinct type slots `R, FF, S, S'`. -/ ++The coordinate-ring algebra induced by the endomorphism differs from the ++canonical algebra on the same carrier. Distinct nominal copies `S` and `S'` ++represent the twisted coordinate ring and its fraction field. Compatible ++scalar towers and the rank-transfer equalities `hSR` and `hS'FF` allow the ++fraction-field rank theorem to compare their degrees. -/ + theorem degree_eq_finrank_coordinateRing_of_tower_eq (ch : α.CoordHom) + (S : Type*) [CommRing S] [Algebra E.CoordinateRing S] + [FaithfulSMul E.CoordinateRing S] [Algebra.IsAlgebraic E.CoordinateRing S] [NoZeroDivisors S] +@@ -197,7 +138,7 @@ theorem degree_eq_finrank_coordinateRing_of_tower_eq (ch : α.CoordHom) + (hS'FF : @Module.finrank E.FunctionField S' _ _ _ = α.degree) : + α.degree = @Module.finrank E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := by + rw [← hSR, ← hS'FF] +- exact Algebra.IsAlgebraic.finrank_of_isFractionRing E.CoordinateRing E.FunctionField S S' ++ exact IsFractionRing.finrank_eq E.CoordinateRing E.FunctionField S S' + + /-- **The class-group dual relation (coordinate-ring `finrank` form).** + +@@ -209,17 +150,17 @@ the `ch.toAlgebra` structure): + This is the class-group shadow of `α̂ ∘ α = [deg α]`, with the exponent expressed as the + coordinate-ring degree. To express the exponent as `α.degree` (the function-field degree), compose + with `degree_eq_finrank_coordinateRing_of_tower_eq` (the function-field ↔ coordinate-ring degree +-bridge, separately flagged). -/ ++bridge). -/ + theorem classNorm_comp_classMap (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) + (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) + (c : ClassGroup E.CoordinateRing) : + α.classNorm ch hinj hfin (α.classMap ch hinj hfin c) = + c ^ @Module.finrank E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := by +- letI := ch.toAlgebra +- haveI hfinI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin +- haveI htfI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := ++ let := ch.toAlgebra ++ have hfinI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin ++ have htfI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := + ch.isTorsionFree hinj +- exact @ClassGroup.relNorm_comp_map E.CoordinateRing E.CoordinateRing _ _ _ _ _ _ _ _ ++ exact @ClassGroup.relNorm_comp_map E.CoordinateRing E.CoordinateRing _ _ _ _ + ch.toAlgebra hfinI htfI c + + /-- **The class-group dual relation (`α.degree` form).** +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/FormalSeries.lean b/projects/HasseWeil/HasseWeil/Isogeny/FormalSeries.lean +index 0cabc394abc4ca7608ba92b737cb85363078b59b..dcd6e5526f0503f078f119bafd1bb4a80e1148f6 100644 +GIT binary patch +delta 8683 +zcmbtaZHygN8P06CYnk#T+wHc1a7x>-OLuQ6ZH*SIEv2gq3oUdhl&0y-z4zREN9NAl +z&dlBI@-=`MP=in==KdgjC{Z!~K`+UM!~`VP9~u=CqyJP0nt)M(A8H~oKJRn +zS`@;^%sq3?`}w@@`<(vdxq*kDU-@Ex-=yQs*nwkvk*GSgnhc~DIkp>`=5#}fnjbW6 +zSA;TfWGMWausz{~eqDNV_^OdeY?yar30C^TDb*Dc$XyXccBdHq6> +z{IlzI*~IYg&$P$ +z%J!=KO(4Uz8#!Jb3ua|trlQgpcgw&R72gXZ(k_y5&@3snD!#1MoQi|v^r56*AYD6> +z>hN@*$mdhSitXBgD9?%6hEr+KyIe=R62TN6FI?K1B>`j3Z4q`Lg*@4U%pr`{4oPf0 +zyAUNZGf7Fc#F!o&lwnC6YL`RUq#Zdp!SRxJ-Jw|2VTaJPt5vcH48~@L0bMu)Viwh- +z%^a`VuJ8u%r)ZMB=uDemK_}ZY9WRn~8Km~f97JEYeEcYyb_@HkjTd +z8`_bEI8L@C{^dm_b06$4Pqgv>F8rGNt|((;uI0m`AzaXGhY|U#A_H}p7Uf!#y#p(R +zu_()ER!T1yEfluvds0+=;rWoO*>dMt)`}m%+AZI!lC9GKgRfIX)A*jUAv=_uvE8<^ +zid_#R#F=#>cD5EATYI(G@i<6fxr*OJlp-TMGYtT1V&sldYrJfSh+u2mn3%KJ`;gTo +z^VHi-oJ6rksY5b4K^6l7pGmg2ncD=S-YPjUD>B?A4mrt$Io1u$odd(lJ;l7>_)h-N +zw=Q}2!gFKnu62g-SsCR4*s3JWFe)4_>d^7`mlZKNI#TF4VXD{%8pCHuDuVS$uwX*$Rd>`Yx&o) +zwDbvl0p!Y3O&gaW3;;!;mr6dK=DjPMO&d|tom{hXMV}LPli{7K&Lg}+j49!||GK<3 +z)YtZs*3)ZOh7G$V6MyKEiq%auUX$^+k=~XP0uFhVpT2eP@Q{Fkb=gQmAd(bwFtiE^JC+Rm3haVU4jB +zt%@a(v8VyO>0(SVlLx2P0L;mWH77vAB2HXMCDb&f2R4mnf`RRaN2X_3gw +zOtb8GjF-ri@vWx0b$lGCf^2QV6=@tqggX@Zsb@!)c5Oii1}ak|^{G;F%OfH=FtM)t +z_1jv;Sr~rR?R{sl?D;i!oW-i-vLl<$;>f8ZGb{E^s6I)1m1B;gS6467EX3tugyoI} +zah}|H?BbD11L!=C+(Ca8iLl*NmI!-WfXL@2fbd(F#0(NM1k?r52~pa^w(fRz6^nBw +z9gEAKj#HV3gWM`@;QF)pDXSoP#{-YXsxD>+5|%9PEC5id=_91lQEoyrBxp6HJ`aEj +zwVjF-vwqvHGV%ZyR2|WcC+B^Z7aV`F9TWo?ozgVyt$`hRR+c0_oRAi=uq7)_O?3sj +zpY3Ut%wotlWHXdNk}R+_nrkH8p2aoJB1BIm)*)b;`w2sf^~&x%ai1~#WZ$afWbNFf +z^{4(g@9Zk*!OBtqx*V9lisaD;Mbvc`9+je5a#0Jg7@|Y7=Ck{#F=rfYqi4|`AQZZiIwXX +z#EzD2E;$i?W!WFQ{n1YcmjCrPci*@&Mja@W0f^FDPYW(G%}M2&IUY)E3_08yp$%U4 +zn?irw(`TD$K-OXfi-ltZ1_uxQcmQwpXw72`DovK<7(xpZj*9v;ZwrZ1CHVVRaR9g@+n<( +zG3=^3&H69Ki?knMCp3Jw+P&qGm-@C&Eiq2!0fmEDH9(i|VSkt4ZS7tbf(9@`8I_^M +z5%tUpqUK+j{O5rSx-Wk1_XB1mkINIsU0I8gWyStMW#%=i;5!Bpc +zst;jnru|&*OX3C2ECQNT$*srcZ~Qi%NcGg^OHaLw2|e-JxhQOhER3urrw#qkdR12 +zDiJ-osN2#7FEdyY)=_WEwqpq4iIJn;u`zLU+p$qh4OIV&ou$gfdG+1YIXWD^=J$?S+(lw>+Blak@_YXc(+O?e6c~`&O +zitaC-xp&q7@qJSN?zg*ZUbw$03?&(h +zQy>en)V53vFmj|zP35f{z(|gPo$${10q;%JgA1Z003bMltd_)WGyx*HoiI6dddL{- +zobrwJDX9lRt5^kYEwiVoNh4h;R7xMtxT+Nc9(OE^bFVhL0SlVK^3l*Sx{qC%1x2%jV2!?4b)e2)|Tb-WuZ*`sm8CazkAS +z+9CjN#h|QJ7}Z!z5`BotoTw{a`MJ^WH=QW?!KI@6_g4qbiFG#$zFdzXL;*IA6RBru +z{}ZpZbmZ`ORg6kxwspW#{dq=~S(A!>w?t05G9z_f&X>XB-4}lL&ia+iVs$%j{i?qo +z1O7~M*V`MfCZWaAf(iB!1yh;~_q(psieR?eOOd}96Qd`OA$yX?-v04Ld9dkV?B4Uv +z>AvL6A6?un|8>^||I4nMyRUxGzI5!P$di10!{DHGw>6GDN*QfdG3mTDIv=k$`UgJh +zc0--ya^rV&ZL!EL$=*M&nSWFmj~iFz>BQ8srp{4D78cIVjaL{qD!X@{y23cPPN#h# +z7#WH>ug)0j=Fi_~JigYL?wk_Fa7>*YF@$^pQxXRNm~*fF5Eb;~Yh7*?(Q#1s>~g-L +zNSfBj)nnU6t(2fGT&$2}*-gb6E>dtcg4xEYqFJWP7g28WnG@WIhC#m_nRHhogBeXus}8(S +z@-!YOOx#PwiuiR6^qL?fM5#+qoe|+e2CV?c>!|JG7l-L!BIc1;4geU#2%*k3;EVA!PE1asQz)P&+MMV5hdZH73))wM={;~)9cbBBy?o@aZwd#Sg%xLO_Ki^lN$ +z!_&q~tM#%?^Ls4gjXwP-<~LW2%Bt*f4Xz=mG^dwKsx?batr$E+l~esj;Y{YsUC6d! +z@Gb%GYgV}AX3P`fKO(Y~yb?QjYLUrY%hauCPz`7hC!_HIdjZJ7I@`j5W +zEES`uH7GzgKSH6{d{f>ih^U$DA(|5VB;wgraUu}r!b +z*$2L2rpps;!Op4sjG*$^1au +z*kGJLO=<-`Bt;(^cHRpSh*LAh&a_yRB4hjf%QMEa{ppKi_ZZt3e3U%#^4iYs`;1G5 +zEptoJu^RT0c>c=yf8S$F^{Gwfr|vh*{=qE#a|oC}@{sYDzH|KAabU?!ve}vZvhhKD +zu*bfXL3XMl1%kS(Scb@^OSWEaFTa#Yz0*T)6A4^!Gn0SAJ?vll74nyPQ#6MZ8Xz|L +zk0jIszugk9JzElsr6$Me$jw3tgFj&**AuXrD4!exJ!ev=E6xshRB>@b52r#9{MmvL +zM62eX=Z+Yx%aDR=V>P$u4(KnArZ~R3Q87Po^)UnRv~P!v6hIkj4qH( +R2C9z#kg;-JJZ5ZK@n1s&V=w>! + +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/FunctionField.lean b/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/FunctionField.lean +index 6c27d435c..f83025581 100644 +--- a/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/FunctionField.lean ++++ b/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/FunctionField.lean +@@ -15,43 +15,6 @@ import Mathlib.RingTheory.IsTensorProduct + import HasseWeil.Foundation.Auxiliary.Universal + import HasseWeil.Isogeny.FunctionField + +-/-! +-# The Frobenius Isogeny via Function Fields +- +-We construct the q-th power Frobenius as a concrete isogeny `π : E → E` using the +-function field pullback `π* : K(E) →ₐ[K] K(E)` given by `x ↦ x^q`. +- +-## Main Definitions +- +-* `HasseWeil.frobeniusIsogeny`: The Frobenius as a `PullbackIsogeny K W W`, with pullback +- given by `frobeniusAlgHom K K(E)`. +- +-## Main Results +- +-* `HasseWeil.frobeniusIsogeny_degree`: The Frobenius isogeny has degree `q = #K`. +-* `HasseWeil.frobeniusIsogeny_pow_mem_fieldRange`: pure inseparability of `K(E) / K(E)^q` +- (Silverman II.2.11(b)), stated as a power-membership fact. +-* `HasseWeil.frobeniusIsogeny_pullback_range`: the pullback image is exactly the `q`-th +- powers in `K(E)` (Silverman II.2.11(a)). +- +-## Implementation notes +- +-The degree `[K(E) : K(E)^q] = q` is obtained from the tower law. Writing `x` for the image +-of `X` in the coordinate ring, so `K(E) = K(x, y)`: +- +-* `[K(E) : K(x)] = 2` and `[K(E)^q : K(x^q)] = 2` (the Weierstrass equation is the minimal +- polynomial of `y` over `K(x)`, and of `y^q` over `K(x^q)`); +-* `[K(x) : K(x^q)] = q` (computed via `RatFunc.finrank_eq_max_natDegree`, after identifying +- the Frobenius range in `RatFunc K` with `K⟮X^q⟯`); +-* the tower law gives `[K(E) : K(E)^q] · 2 = 2 · q`, hence `[K(E) : K(E)^q] = q`. +- +-The Frobenius-twisted `Module.finrank` is reduced to the plain field extension `[K(E) : K(E)^q]` +-via `Algebra.finrank_eq_of_equiv_equiv`. +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*][silverman2009], III.4.6, II.2.11 +--/ + + open WeierstrassCurve FiniteField + open scoped Polynomial +@@ -98,7 +61,7 @@ private theorem frobenius_finrank_eq_fieldRange_finrank : + (frobeniusAlgHom K W.toAffine.FunctionField).toRingHom x + simp [AlgEquiv.ofInjective_apply] + +-/-- Explicit module instance: `K[X]` acts on `CoordinateRing` via the algebra structure. -/ ++ + noncomputable instance coordinateRing_module : + Module K[X] W.toAffine.CoordinateRing := + @Algebra.toModule K[X] W.toAffine.CoordinateRing _ _ inferInstance +@@ -107,7 +70,7 @@ instance coordinateRing_finite : Module.Finite K[X] W.toAffine.CoordinateRing := + Module.Finite.of_basis (Affine.CoordinateRing.basis W.toAffine) + + omit [DecidableEq K] [Fintype K] [W.toAffine.IsElliptic] in +-/-- The coordinate ring `K[x, y]/(W)` is a free `K[X]`-module of rank `2` (Silverman II.2). -/ ++ + theorem finrank_coordinateRing_eq_two : + Module.finrank K[X] W.toAffine.CoordinateRing = 2 := + (Module.finrank_eq_card_basis (Affine.CoordinateRing.basis W.toAffine)).trans +@@ -206,7 +169,7 @@ private theorem frobenius_fieldRange_ratFunc : + obtain ⟨p, r, _hr, rfl⟩ : ∃ p r : K[X], algebraMap K[X] (RatFunc K) r ≠ 0 ∧ + g = algebraMap K[X] (RatFunc K) p / algebraMap K[X] (RatFunc K) r := + ⟨g.num, g.denom, RatFunc.algebraMap_ne_zero g.denom_ne_zero, g.num_div_denom.symm⟩ +- simp only [div_pow, ← map_pow, ← FiniteField.expand_card (K := K)] ++ simp only [div_pow, ← map_pow, ← FiniteField.Polynomial.expand_card (K := K)] + have hmem : ∀ f : K[X], algebraMap K[X] (RatFunc K) (Polynomial.expand K q f) ∈ A := by + intro f + have h_amap : ∀ g : K[X], +@@ -340,8 +303,8 @@ private theorem finrank_over_frobenius_image : + lia + + omit [DecidableEq K] [W.toAffine.IsElliptic] in +-/-- **Core algebraic fact**: `[K(E) : K(E)^q] = q`, where the module structure on `K(E)` over +-itself is via the `q`-th power Frobenius (Silverman II.2.11(a)). -/ ++ ++ + theorem frobenius_finrank_functionField : + @Module.finrank W.toAffine.FunctionField W.toAffine.FunctionField _ _ + (frobeniusAlgHom K W.toAffine.FunctionField).toRingHom.toAlgebra.toModule = +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/OrdAtInfty.lean b/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/OrdAtInfty.lean +index 166040c82..a3a20a730 100644 +--- a/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/OrdAtInfty.lean ++++ b/projects/HasseWeil/HasseWeil/Isogeny/Frobenius/OrdAtInfty.lean +@@ -10,23 +10,19 @@ import HasseWeil.Foundation.EC.GenericPointZsmul + import HasseWeil.Foundation.EC.MulByIntBaseCase + + /-! +-# Frobenius-specialized addition-pullback ord-at-infinity computations ++# Orders at infinity for Frobenius addition + +-For `α = frobeniusIsog W` (the Frobenius endomorphism over a finite field +-`K` with `q = #K ≥ 2`), we compute the order at infinity of the addition- +-formula slope and related quantities. These are the building blocks for the +-pole bound `ord_∞(addPullback_x W (frobeniusIsog W)) ≤ -2`, which closes +-Sorry 1 of `HasseWeil/AdditionPullback.lean` for the case actually used by +-HOLE D in the unconditional Hasse-Weil bound. ++For Frobenius `π` over a finite field of size `q`, the coordinate differences ++have orders `−2q` and `−3q`, so their slope has order `−q`. Clearing the ++addition-formula denominator and reducing by the Weierstrass equation gives ++the precise coordinate pole orders. + +-## Main lemmas ++The same arguments apply to negative Frobenius and the pencil `r·π − s·id`. ++Curve-negation invariance places the summed x-coordinate in `K(x)`; its pole ++then proves transcendence and the injectivity required for the function-field ++pullback. + +-* `ordAtInfty_addSlope_frobenius`: `ord_∞(L) = -q` where `L = addSlope W π`. +-* `ordAtInfty_addSlope_sq_frobenius`: `ord_∞(L²) = -2q`. +- +-## References +- +-* Silverman, *The Arithmetic of Elliptic Curves*, IV.1 (orders at infinity). ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, IV.1. + -/ + + open WeierstrassCurve HasseWeil.Curves +@@ -64,7 +60,7 @@ theorem addSlope_frobenius_eq : + simp only [addSlope] + exact Affine.slope_of_X_ne (x_gen_ne_frobeniusIsog_pullback_x_gen W) + +-/-- `ord_∞(x_gen − π·x) = -2q` (sign-flipped form of the previously-shipped ++/-- `ord_∞(x_gen − π·x) = -2q` (sign-flipped form of the corresponding + `ordAtInfty_frobeniusIsog_pullback_x_gen_sub_x_gen`). -/ + theorem ordAtInfty_x_gen_sub_frobeniusIsog_pullback_x_gen : + (W_smooth W).ordAtInfty (x_gen W - (frobeniusIsog W).pullback (x_gen W)) = +@@ -98,7 +94,7 @@ theorem x_gen_sub_frobeniusIsog_pullback_x_gen_ne_zero : + exact WithTop.coe_ne_top h_top + + /-- **`ord_∞(addSlope W π) = -q`** where `q = #K`. Direct from +-`ordAtInfty_div_of_ord_eq` with the shipped sub-ord lemmas. -/ ++`ordAtInfty_div_of_ord_eq` with the sub-ord lemmas. -/ + theorem ordAtInfty_addSlope_frobenius : + (W_smooth W).ordAtInfty (addSlope W (frobeniusIsog W)) = + ((-(Fintype.card K : ℤ)) : WithTop ℤ) := by +@@ -131,9 +127,8 @@ theorem ordAtInfty_addSlope_sq_frobenius : + push_cast + ring + +-/-- **Witness-parametric Sorry 1 closure for the Frobenius case** (Path Y): +-given a pole hypothesis on `addPullback_x W (frobeniusIsog W)`, derive False +-from `addPullback_x = algebraMap K _ c`. -/ ++/-- A pole of the Frobenius addition x-coordinate rules out every constant ++ value in the base field. -/ + theorem addPullback_x_ne_const_frobenius_of_pole + (hxy : AddNonInverse W (frobeniusIsog W)) + (h_pole : +@@ -142,7 +137,7 @@ theorem addPullback_x_ne_const_frobenius_of_pole + False := + addPullback_x_ne_const_of_pole hxy c h_pole hc + +-/-! ### Path X-prime: pole bound for q ≥ 3 with cancellation witness ++/-! ### pole bound for q ≥ 3 with cancellation witness + + `addPullback_x = L² + a₁L - a₂ - x_gen - π·x`. Regroup as + `(L² - π·x) + (a₁L - a₂ - x_gen)`. The right group has ord exactly `-q` +@@ -231,26 +226,14 @@ private theorem ordAtInfty_add_le_neg_two {A B : KE} (hq : 3 ≤ Fintype.card K) + have : (3 : ℤ) ≤ (Fintype.card K : ℤ) := by exact_mod_cast hq + linarith + +-/-- **Pole bound for q ≥ 3 with cancellation witness** (Path X-prime, +-**SUPERSEDED**): `ord_∞(addPullback_x W π) ≤ -2`, given the structural +-witness `ord(L² - π·x) ≠ -q`. +- +-**Status: SUPERSEDED.** The hypothesised witness is unprovable when +-`a₁ ≠ 0`. Direct term-by-term ord arithmetic on the `(y - π·y)² +-- π·x · (x - π·x)²` numerator shows that the term `-a₁·π·x·π·y` at +-ord `-5q` is the unique smallest (when `a₁ ≠ 0`), forcing +-`ord(L² - π·x) = -q` exactly. So `lt_or_gt_of_ne h_witness` cannot +-be applied: the witness is false in the case it is supposed to discharge. +- +-The replacement is the direct numerator-of-`addPullback_x` analysis +-shipped below as `addPullbackNumerator_frobenius`, which sidesteps the +-`L² - π·x` regrouping entirely. The lemmas immediately below are kept +-for now to preserve a stable API in case downstream callers reference +-them, but should not be used to close Sorry 1. +- +-The witness-parametric form remains formally true (vacuously, since +-the witness premise is unsatisfiable in the relevant case) but yields +-no usable closure. -/ ++/-- A pole bound under the additional cancellation witness ++ `ord(L² − π·x) ≠ −q`. ++ ++ When `a₁ ≠ 0`, direct numerator comparison forces ++ `ord(L² − π·x) = −q`: the term `−a₁·π·x·π·y` has uniquely minimal ++ order `−5q`. Thus the extra witness excludes that situation. The ++ reduced-numerator argument gives the coordinate pole without this ++ witness. -/ + theorem addPullback_x_pole_frobenius_of_lc_witness + (hq : 3 ≤ Fintype.card K) + (ha1 : W.toAffine.a₁ ≠ 0) (ha2 : W.toAffine.a₂ ≠ 0) +@@ -286,7 +269,7 @@ theorem addPullback_x_pole_frobenius_of_lc_witness + ordAtInfty_a1L_minus_a2_minus_xgen_frobenius W hq ha1 ha2 + exact ordAtInfty_add_le_neg_two W hq h_ord_B h_witness + +-/-- **Sorry 1 closure for Frobenius case (q ≥ 3)** with leading-coefficient ++/-- **Nonconstancy from the coordinate pole for Frobenius case (q ≥ 3)** with leading-coefficient + witness. Composes the pole bound with `addPullback_x_ne_const_frobenius_of_pole`. -/ + theorem addPullback_x_ne_const_frobenius_q_ge_3_of_witness + (hq : 3 ≤ Fintype.card K) +@@ -305,36 +288,19 @@ theorem addPullback_x_ne_const_frobenius_q_ge_3_of_witness + exact_mod_cast (by norm_num : (-2 : ℤ) < 0) + exact addPullback_x_ne_const_frobenius_of_pole W hxy h_pole c hc + +-/-! ### Direct numerator approach (replaces the broken `_lc_witness` path) +- +-The witness `ord(L² - π·x) ≠ -q` is unprovable because `ord(L² - π·x) = -q` +-exactly when `a₁ ≠ 0` (the case of interest). Instead we work directly with +-the numerator of `addPullback_x · (x - π·x)²`. +- +-Multiplying the addition formula `addPullback_x = L² + a₁·L - a₂ - x_gen - π·x` +-through by `(x - π·x)²` (using `L = (y - π·y)/(x - π·x)`) yields the polynomial- +-shaped element +- +-``` +-T₁ + T₂ - T₃ +- with T₁ = (y_gen - π·y)², +- T₂ = a₁ · (x_gen - π·x) · (y_gen - π·y), +- T₃ = (x_gen - π·x)² · (a₂ + x_gen + π·x). +-``` ++/-! ### Clearing the addition denominator + +-The `ord_∞` values, for `q ≥ 2`: ++Multiplying `L² + a₁L − a₂ − x − π·x` by `(x − π·x)²` gives ++`T₁ + T₂ − T₃`, with ++`T₁ = (y − π·y)²`, `T₂ = a₁(x − π·x)(y − π·y)` and ++`T₃ = (x − π·x)²(a₂ + x + π·x)`. ++Their orders are `−6q`, `−5q` (when `a₁ ≠ 0`) and `−6q`. + +-| term | ord | +-|------|------| +-| `T₁` | `-6q` | +-| `T₂` | `-5q` (when `a₁ ≠ 0`) | +-| `T₃` | `-6q` | +- +-The leading-coefficient analysis at `-6q` (deferred to a follow-up session) +-gives `lc(T₁) + lc(-T₃) = 2·c_x^{3q} ≠ 0` in characteristic `≠ 2`, hence +-`ord(T₁ + T₂ - T₃) = -6q` and `ord(addPullback_x) = -6q + 4q = -2q < 0`. +- +-These lemmas ship the term-ord half of the analysis. -/ ++The Weierstrass equation reduces this numerator so that `x(π·x)²`, of ++order `−2 − 4q`, strictly dominates the remaining terms. Since the ++squared denominator has order `−4q`, the summed x-coordinate has order ++`−2`, in every characteristic. ++-/ + + /-- The denominator `y_gen − π·y` is nonzero (its ord is finite). -/ + theorem y_gen_sub_frobeniusIsog_pullback_y_gen_ne_zero : +@@ -396,7 +362,7 @@ theorem addPullbackNumerator_frobenius_eq : + ring + + /-- **`ord_∞(T₁) = -6q`** where `T₁ = (y_gen − π·y)²` and `q = #K`. +-Direct from `ordAtInfty_pow_of_ord_eq` applied to the shipped ++Direct from `ordAtInfty_pow_of_ord_eq` applied to + `ordAtInfty_y_gen_sub_frobeniusIsog_pullback_y_gen`. -/ + theorem ordAtInfty_T1_frobenius : + (W_smooth W).ordAtInfty +@@ -411,7 +377,7 @@ theorem ordAtInfty_T1_frobenius : + ring + + /-- **`ord_∞(T₂) = -5q`** where `T₂ = a₁·(x_gen − π·x)·(y_gen − π·y)` +-and `a₁ ≠ 0`. Multiplicativity of `ord_∞` plus the shipped sub-ord lemmas. -/ ++and `a₁ ≠ 0`. Multiplicativity of `ord_∞` plus the sub-ord lemmas. -/ + theorem ordAtInfty_T2_frobenius (ha₁ : W.toAffine.a₁ ≠ 0) : + (W_smooth W).ordAtInfty + (algebraMap K KE W.toAffine.a₁ * +@@ -551,7 +517,7 @@ a polynomial-shaped expression whose unique smallest-order term is + `x_gen · (π·x)²` at order `-2 - 4q`. + + This reduction yields `ord_∞(addPullback_x) = -2` (independent of q!), +-which immediately closes Sorry 1 for `q ≥ 3` in **any characteristic** ++which immediately closes the nonconstancy condition for `q ≥ 3` in **any characteristic** + (the `x_gen · (π·x)²` term has coefficient `1`, never vanishing). -/ + + /-- The Weierstrass-reduced form of `addPullbackNumerator_frobenius`. +@@ -651,7 +617,7 @@ than `x_gen · (π·x)²` has `ord_∞ ≥ -3 - 3q`. The dominant term has + `ord_∞ = -2 - 4q`. Since `-3 - 3q > -2 - 4q` for `q ≥ 2`, strict + non-archimedean additivity gives `ord(reduced) = -2 - 4q`. -/ + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Helper: `ord(algebraMap c · f) ≥ ord(f)`. The `algebraMap K KE c` + factor never makes the order more negative — when `c = 0` the product + is zero (ord `⊤`), and when `c ≠ 0` the algebraMap value has ord 0. -/ +@@ -860,6 +826,7 @@ private lemma ord_a4_mul_x_add_pi_x_ge (hq : 2 ≤ Fintype.card K) : + rw [ord_x_gen_add_pi_x_eq W hq] + exact WithTop.coe_le_coe.mpr h_int + ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Helper: `ord_∞(2 · a₆) ≥ -3 - 3q` for `q ≥ 2`. -/ + private lemma ord_two_mul_a6_ge (hq : 2 ≤ Fintype.card K) : + (((-3 - 3 * (Fintype.card K : ℤ)) : ℤ) : WithTop ℤ) ≤ +@@ -1020,7 +987,7 @@ theorem ordAtInfty_addPullbackNumerator_reduced_frobenius_eq + ((W_smooth W).ordAtInfty_add_eq_of_lt (ord_dom_lt_rest W hq)).trans + (ord_x_gen_mul_pi_x_sq_eq W) + +-/-! ### Sorry 1 closure for Frobenius case (q ≥ 2, any characteristic) -/ ++/-! ### Nonconstancy from the coordinate pole for Frobenius case (q ≥ 2, any characteristic) -/ + + /-- **`ord_∞(addPullback_x W π) = -2`** for `q ≥ 2` (any characteristic). + +@@ -1061,7 +1028,7 @@ theorem ord_addPullback_x_frobenius (hq : 2 ≤ Fintype.card K) : + congr 1 + ring + +-/-- **Sorry 1 closure for the Frobenius case** (`q ≥ 2`, any characteristic): ++/-- **Nonconstancy from the coordinate pole for the Frobenius case** (`q ≥ 2`, any characteristic): + `addPullback_x W (frobeniusIsog W)` is not the image of any constant `c ∈ K`. + + Direct from `ord_addPullback_x_frobenius` (which gives `ord = -2 < 0`, +@@ -1074,44 +1041,21 @@ theorem addPullback_x_ne_const_frobenius + rw [ord_addPullback_x_frobenius W hq] + exact_mod_cast (by norm_num : (-2 : ℤ) < 0) + +-/-- **Inequality wrapper** for `ord_addPullback_x_frobenius`. +- +-Some downstream consumers (CLOSE-A-1 ticket spec) want the `≤ -2` form +-rather than the equality. Trivial corollary. -/ ++/-- The Frobenius addition x-coordinate has order at most minus two. -/ + theorem ordAtInfty_addPullback_x_frobenius_le_neg_two + (hq : 2 ≤ Fintype.card K) : + (W_smooth W).ordAtInfty (addPullback_x W (frobeniusIsog W)) ≤ + ((-2 : ℤ) : WithTop ℤ) := + (ord_addPullback_x_frobenius W hq).le + +-/-! ### `negFrobeniusIsog`: the `−π` isogeny (HOLE-D-bound work, Day 1) +- +-For HOLE D, we ultimately need the addition-pullback for `1 − π`, which +-is `id + α` with `α = −π`. The `−π` isogeny is constructed as the +-composition `[-1] ∘ π` via the existing `Isogeny.comp` and `mulByInt _ (-1)`. +- +-By `Isogeny.comp_algebraMap_eq`, the resulting pullback is +-`f ↦ frobeniusIsog.pullback (mulByInt _ (-1)).pullback f`. For the two +-generators: +-* `(negFrobeniusIsog W).pullback (x_gen W)` reduces to +- `(frobeniusIsog W).pullback (x_gen W) = π·x_gen` (since `[-1]` fixes +- `x_gen`). +-* `(negFrobeniusIsog W).pullback (y_gen W)` reduces to +- `(frobeniusIsog W).pullback (negY x_gen y_gen) = +- (frobeniusIsog W).pullback (-y_gen - a₁·x_gen - a₃)`. By Frobenius +- being a ring hom and `a_i^q = a_i` in `K = F_q`, this equals +- `-π·y_gen - a₁·π·x_gen - a₃` in any characteristic (in char 2 the +- signs are no-ops). +- +-Both pullbacks have the same `ord_∞` as the Frobenius case (`-2q` and +-`-3q` respectively), so the term-ord chain shipped earlier in this file +-templates over to `negFrobeniusIsog` with name-prefix swaps. The reduced- +-numerator analysis (Weierstrass identity certificate) also carries +-forward, since `(π·x_gen, negY π·x π·y)` is on the curve by `equation_neg`. +- +-This file ships only the structural definition tonight. The Day 2 work +-(ord lemmas + pullback formulas + Sorry 1 closure for `α = -π`) is +-factored separately and reuses the existing helpers verbatim. -/ ++/-! ### Negative Frobenius ++ ++The isogeny `−π` is the composition `[-1] ∘ π`. Its pullback sends ++`x` to `π·x` and `y` to `−π·y − a₁·π·x − a₃`, in every characteristic. ++These coordinates have orders `−2q` and `−3q`. The Weierstrass equation ++for the negated point gives the corresponding reduced-numerator pole ++calculation for `1 − π`. ++-/ + + /-- The `-π` isogeny as `[-1] ∘ π`, via `Isogeny.comp` of the existing + `mulByInt _ (-1)` and `frobeniusIsog W` isogenies. -/ +@@ -1131,6 +1075,7 @@ theorem negFrobeniusIsog_toAddMonoidHom_apply (P : W.toAffine.Point) : + rw [mulByInt_apply] + exact (neg_one_zsmul _).trans rfl + ++omit [Fintype K] in + /-- The `[-1]`-pullback sends `y_gen` to `negY x_gen y_gen = -y_gen − a₁·x_gen + − a₃` (the curve-negation formula). + +@@ -1188,7 +1133,7 @@ theorem negFrobeniusIsog_pullback_y_gen : + simp only [map_sub, map_neg, map_mul, + AlgHom.commutes (frobeniusIsog W).pullback] + +-/-! ### `ord_∞` lemmas for the negFrobeniusIsog pullbacks (Day 2 first half) ++/-! ### `ord_∞` lemmas for the negFrobeniusIsog pullbacks + + With the pullback formulas in place, the ord values match the Frobenius + case: +@@ -1265,7 +1210,7 @@ theorem ordAtInfty_negFrobeniusIsog_pullback_y_gen + exact ordAtInfty_sub_eq_of_coe_lt_le W h_lt_q h_neg_πy + (a1_pi_x_plus_a3_ge_neg_two_q W hq) + +-/-! ### addPullbackNumerator for negFrobenius (Day 2 second half opener) ++/-! ### addPullbackNumerator for negFrobenius + + Mirrors the Frobenius numerator + reduction identity, with `α = negFrobeniusIsog W` + instead of `α = frobeniusIsog W`. The (u, v) point used in the reduction is +@@ -1640,7 +1585,7 @@ theorem ordAtInfty_addPullbackNumerator_reduced_negFrobenius_eq + ((W_smooth W).ordAtInfty_add_eq_of_lt (ord_dom_lt_negFrob_rest W hq)).trans + (ord_x_gen_mul_negFrob_pi_x_sq_eq W) + +-/-! ### Sorry 1 closure for the negFrobenius case (Day 2 final) ++/-! ### Nonconstancy from the coordinate pole for the negFrobenius case + + `ord(addPullback_x W (-π)) = -2` follows by dividing the reduced numerator + (ord = -2 - 4q) through `(x_gen − negFrob.pb x_gen)²` (ord = -4q). Then +@@ -1740,12 +1685,11 @@ theorem ord_addPullback_x_negFrobenius (hq : 2 ≤ Fintype.card K) : + congr 1 + ring + +-/-- **Sorry 1 closure for the negFrobenius case** (`q ≥ 2`, any characteristic): ++/-- **Nonconstancy from the coordinate pole for the negFrobenius case** (`q ≥ 2`, any characteristic): + `addPullback_x W (negFrobeniusIsog W)` is not the image of any constant `c ∈ K`. + + Direct from `ord_addPullback_x_negFrobenius` (which gives `ord = -2 < 0`, +-a pole) plus `addPullback_x_ne_const_of_pole`. This is the closure needed +-for HOLE D's `1 − π` use case (since `1 − π = id + (-π)`). -/ ++a pole) plus `addPullback_x_ne_const_of_pole`. For `1 − π`, the addition formula is `id + (−π)`. -/ + theorem addPullback_x_ne_const_negFrobenius + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) (c : K) +@@ -1754,11 +1698,7 @@ theorem addPullback_x_ne_const_negFrobenius + rw [ord_addPullback_x_negFrobenius W hq] + exact_mod_cast (by norm_num : (-2 : ℤ) < 0) + +-/-- **Inequality wrapper** for `ord_addPullback_x_negFrobenius`. +- +-Companion to `ordAtInfty_addPullback_x_frobenius_le_neg_two` for the +-`−π` (negFrobenius) case — the load-bearing case for HOLE D's `1 − π` +-analysis. Trivial corollary of the equality form. -/ ++/-- The Frobenius addition x-coordinate has order at most minus two. -/ + theorem ordAtInfty_addPullback_x_negFrobenius_le_neg_two + (hq : 2 ≤ Fintype.card K) : + (W_smooth W).ordAtInfty (addPullback_x W (negFrobeniusIsog W)) ≤ +@@ -1838,7 +1778,7 @@ private theorem ord_RHS_lower_ge_neg_four_negFrobenius + exact ord_add_ge_of_both_ge W + (ord_add_ge_of_both_ge W h_a₂_term h_a₄_term) h_a₆_term + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Helper: `ord(a₆) ≥ 0` (where `a₆` is a constant in K, viewed in KE). -/ + private theorem ord_a₆_ge_zero : + (0 : WithTop ℤ) ≤ (W_smooth W).ordAtInfty +@@ -2181,66 +2121,25 @@ theorem ord_addPullback_y_negFrobenius (hq : 2 ≤ Fintype.card K) : + have h_m_eq : m = -3 := by omega + exact_mod_cast h_m_eq + +-/-! ### Day 3a: addPullbackAlgHom for the negFrobenius case +- +-The existing `addPullbackAlgHom W α hxy hinj` construction +-(`HasseWeil.AdditionPullback`) is generic over `α`. For HOLE D we want +-this for `α = negFrobeniusIsog W`. The injectivity input +-`hinj : Function.Injective (addCoordAlgHom hxy)` was generically +-provided by a sorry-bearing `addCoordAlgHom_injective` chain (general-`α` +-transcendence of `addPullback_x` resting on an open III.3.6 pole witness) — +-that chain has since been **removed**; only the witness-parametric and +-negFrobenius forms remain. +- +-We ship `addPullbackAlgHom_negFrobenius_of_inj` as a **witness-parametric +-form** taking the (axiom-clean) injectivity proof as a hypothesis. +-Discharging this hypothesis axiom-clean for `α = negFrobeniusIsog W` +-requires one of: +- +-1. Closing Sorry 2 + Sorry 3 generically (~350 LOC, mathlib `minpoly` +- machinery). +- +-2. A negFrobenius-specific σ-invariance argument: prove +- `(mulByInt W (-1)).pullback (addPullback_x W (negFrobeniusIsog W)) +- = addPullback_x W (negFrobeniusIsog W)`. This says addPullback_x is +- fixed by the curve-negation involution `σ : K(E) → K(E)`. By Galois +- theory (K(E) over K(x) is degree-2, σ generates the Galois group), +- σ-fixed elements lie in `K(x) = F(x_gen)`, which discharges the +- `px ∉ F(x_gen)` case of the transcendence argument for the +- negFrobenius case. Then `addPullback_x_ne_const_negFrobenius` +- closes Case 1, completing the chain. +- +-Path 2 is more focused (~100-200 LOC) and closes only what HOLE D +-needs. The σ-invariance lemma proof structure: apply +-`(mulByInt W (-1)).pullback` to the addX formula +-`addPullback_x = L² + a₁L − a₂ − x_gen − π·x`, distribute the AlgHom +-over operations, substitute known values: +-* `(mulByInt W (-1)).pullback x_gen = x_gen` (`mulByInt_pullback_x_neg_one`). +-* `(mulByInt W (-1)).pullback y_gen = −y_gen − a₁·x_gen − a₃` +- (`mulByInt_pullback_y_neg_one`). +-* `(mulByInt W (-1)).pullback (π·x_gen) = π·x_gen` (since `π·x_gen +- = x_gen^q` and AlgHom preserves powers and fixes `x_gen`). +-* `(mulByInt W (-1)).pullback (π·y_gen) = -π·y - a₁·π·x - a₃` (via +- Frobenius distributing over `−y − a₁·x − a₃` in char p, with +- `a^q = a` in `K = F_q`). +- +-Substituting and using `(σ(L_neg)+L_neg) = -a₁` (a curve-arithmetic +-identity, computable via `field_simp; ring` after the algebra-hom +-rewrites), we get `σ(L_neg² + a₁·L_neg) = L_neg² + a₁·L_neg`. The +-remaining terms in addPullback_x (`a₂`, `x_gen`, `π·x_gen`) are all +-σ-fixed. So addPullback_x is σ-invariant. ∎ -/ +- +-/-- Witness-parametric `addPullbackAlgHom` for `α = negFrobeniusIsog W`, +-parametric on the `addCoordAlgHom hxy`-injectivity hypothesis. Once +-that hypothesis is dischargeable axiom-clean (via Path 2 above or +-Sorry 2 + Sorry 3 closure), the resulting algebra-hom feeds the +-`isogOneSub` placeholder replacement and closes HOLE D. -/ ++/-! ### Injectivity of the negative-Frobenius addition pullback ++ ++Curve negation fixes `x` and sends `y` to `−y − a₁x − a₃`. Applying it to ++the negative-Frobenius slope gives `σ(L) + L = −a₁`, hence fixes ++`L² + a₁L` and the summed x-coordinate. The fixed field is `K(x)`. ++An algebraic element of this rational function field is constant, whereas ++the summed x-coordinate has a pole. It is therefore transcendental over ++`K`, which proves injectivity of its polynomial evaluation homomorphism ++and then of the coordinate-ring homomorphism. ++-/ ++ ++/-- The function-field addition pullback for negative Frobenius, given ++ injectivity of the coordinate-ring homomorphism. -/ + noncomputable def addPullbackAlgHom_negFrobenius_of_inj + (hxy : AddNonInverse W (negFrobeniusIsog W)) + (hinj : Function.Injective (addCoordAlgHom hxy)) : KE →ₐ[K] KE := + addPullbackAlgHom hxy hinj + +-/-! ### σ-invariance lemmas (Path 2 to discharge `hinj` axiom-clean) -/ ++/-! ### Curve-negation invariance -/ + + /-- **σ-invariance Step 1**: + `σ(π·y_gen) = (negFrobeniusIsog W).pullback (y_gen W)` where +@@ -2360,7 +2259,7 @@ theorem addPullback_x_negFrobenius_sigma_invariant : + + /-! ### Galois group identification: {1, σ} on K(E)/K(x) + +-Day 3a-final opener. To deduce that σ-fixed elements lie in K(x), we ++To deduce that σ-fixed elements lie in K(x), we + need to know that {1, σ} is the full Galois group of K(E)/K(x). + + The two structural facts: +@@ -2370,6 +2269,7 @@ The two structural facts: + + Combined with `[K(E) : K(x)] = 2`, this is the full Galois group. -/ + ++omit [Fintype K] in + /-- **σ has order 2**: `(mulByInt W (-1)).pullback.comp (mulByInt W (-1)).pullback + = AlgHom.id`. The Galois-group order-2 statement, derived from the isogeny + identity `[-1] ∘ [-1] = [1]` (`mulByInt_comp_eq_mul`) plus +@@ -2395,6 +2295,7 @@ theorem mulByInt_neg_one_pullback_comp_self : + from rfl] at h_pb + rw [h_pb, mulByInt_one_pullback_eq_id] + ++omit [Fintype K] in + /-- **σ ∘ σ = id pointwise**: for any `z ∈ KE`, + `(mulByInt W (-1)).pullback ((mulByInt W (-1)).pullback z) = z`. -/ + theorem mulByInt_neg_one_pullback_pow_two_apply (z : KE) : +@@ -2413,6 +2314,7 @@ forces non-triviality). In characteristic 2 we need the discriminant: a curve + with `a₁ = a₃ = 0` would have `Δ = 0` (by `Δ_of_char_two`), contradicting + `[IsElliptic]`. -/ + ++omit [Fintype K] in + /-- **σ ≠ id in characteristic 2**: the curve-negation involution + `σ = (mulByInt W (-1)).pullback` does not fix `y_gen`. + +@@ -2481,6 +2383,7 @@ private lemma two_K_eq_zero_of_two_fractionRing + rw [map_zero, map_ofNat] + exact h + ++omit [Fintype K] in + /-- **σ ≠ id in characteristic ≠ 2**: in char ≠ 2, the curve-negation involution + σ does not fix `y_gen`. + +@@ -2515,6 +2418,7 @@ theorem mulByInt_neg_one_pullback_y_gen_ne_y_gen_char_ne_two + obtain ⟨_, hq_zero⟩ := (W_smooth W).decomp_zero_iff h_zero_smul + exact h2 (two_K_eq_zero_of_two_fractionRing hq_zero) + ++omit [Fintype K] in + /-- **σ ≠ id (unified)**: in any characteristic, the curve-negation involution + `σ = (mulByInt W (-1)).pullback` does not fix `y_gen`. + +@@ -2525,7 +2429,7 @@ theorem mulByInt_neg_one_pullback_y_gen_ne_y_gen : + (mulByInt W.toAffine (-1)).pullback (y_gen W) ≠ y_gen W := by + by_cases h2 : (2 : K) = 0 + · -- Char 2 case via `[CharP K 2]` derived from `h2`. +- haveI : CharP K 2 := CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero h2 ++ have : CharP K 2 := CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero h2 + exact mulByInt_neg_one_pullback_y_gen_ne_y_gen_char_two W + · -- Char ≠ 2 case directly. + exact mulByInt_neg_one_pullback_y_gen_ne_y_gen_char_ne_two W h2 +@@ -2535,6 +2439,7 @@ theorem mulByInt_neg_one_pullback_y_gen_ne_y_gen : + A small first piece toward σ-fixed → K(x): σ commutes with the constant + embedding `K → K(E)`. -/ + ++omit [Fintype K] in + /-- σ fixes the image of `K → K(E)`: for any `c : K`, + `σ(algebraMap c) = algebraMap c`. Immediate from σ being a `K`-algebra hom. -/ + @[simp] theorem mulByInt_neg_one_pullback_algebraMap_K (c : K) : +@@ -2542,6 +2447,7 @@ embedding `K → K(E)`. -/ + algebraMap K KE c := + AlgHom.commutes (mulByInt W.toAffine (-1)).pullback c + ++omit [Fintype K] in + /-- σ fixes `algebraMap (Polynomial K) KE p` for any polynomial `p`. + Using `algebraMap p = aeval x_gen p` (via algebra-hom uniqueness on the + generator `X ↦ x_gen`) plus σ commutes with `aeval` and σ fixes `x_gen`. -/ +@@ -2566,6 +2472,7 @@ theorem mulByInt_neg_one_pullback_algebraMap_polyK (p : Polynomial K) : + simpa using this + rw [h_eval, ← Polynomial.aeval_algHom_apply, mulByInt_pullback_x_neg_one] + ++omit [Fintype K] in + /-- σ fixes the image of `Frac(K[X]) → K(E)`: for any `r ∈ Frac(K[X])`, + `σ(algebraMap r) = algebraMap r`. Lifts `mulByInt_neg_one_pullback_algebraMap_polyK` + via `IsLocalization.surj` denominator clearing. -/ +@@ -2598,6 +2505,7 @@ theorem mulByInt_neg_one_pullback_algebraMap_kx + + /-! ### Path 2 Step 3 Piece 3b: σ acts on coordY -/ + ++omit [Fintype K] in + /-- σ acts on `y_gen` as `-y_gen - a₁·x - a₃`. (Re-statement of + `mulByInt_pullback_y_neg_one` for use with the basis decomposition machinery.) -/ + theorem mulByInt_neg_one_pullback_y_gen_eq : +@@ -2608,6 +2516,7 @@ theorem mulByInt_neg_one_pullback_y_gen_eq : + + /-! ### Path 2 Step 3 Piece 3c helpers -/ + ++omit [Fintype K] [DecidableEq K] in + /-- The polynomial `a₁ X + a₃` is nonzero in characteristic 2 for an elliptic + curve. If it were zero, then `a₁ = a₃ = 0`, and `Δ_of_char_two` would give + `Δ = 0`, contradicting `[IsElliptic]`. -/ +@@ -2625,6 +2534,7 @@ theorem a₁X_plus_a₃_ne_zero_char_two [CharP K 2] : + rw [WeierstrassCurve.Δ_of_char_two, h_a1, h_a3]; ring + exact W.toAffine.isUnit_Δ.ne_zero h_delta + ++omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Image of the polynomial `a₁ X + a₃` under `K[X] → KE`: equals + `a₁ · x_gen + a₃` in `KE`. -/ + theorem algebraMap_a₁X_plus_a₃ : +@@ -2642,6 +2552,7 @@ theorem algebraMap_a₁X_plus_a₃ : + intro c; rw [Polynomial.C_eq_algebraMap, ← IsScalarTower.algebraMap_apply] + rw [map_add, map_mul, h_C, h_C, h_x_alg] + ++omit [Fintype K] [DecidableEq K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The image of `a₁ X + a₃` under the composite `K[X] → Frac(K[X]) → KE` equals + `a₁ · x_gen + a₃` in `KE`. Lifts `algebraMap_a₁X_plus_a₃` along the scalar tower + `K[X] → Frac(K[X]) → KE`. -/ +@@ -2665,6 +2576,7 @@ private lemma smul_one_add_smul_y_gen_eq_algebraMap + algebraMap (FractionRing (Polynomial K)) KE b * y_gen W := by + simp only [Algebra.smul_def, mul_one] + ++omit [Fintype K] in + /-- σ acting on an `algebraMap`-decomposition: applying `σ = (mulByInt W (-1)).pullback` + to `algebraMap a + (algebraMap b) · y_gen` gives + `algebraMap a + (algebraMap b) · (-y_gen - a₁·x - a₃)`, since σ fixes the +@@ -2684,6 +2596,7 @@ private lemma mulByInt_neg_one_pullback_algebraMap_add_algebraMap_mul_y_gen + mulByInt_neg_one_pullback_algebraMap_kx, + mulByInt_neg_one_pullback_y_gen_eq] + ++omit [Fintype K] in + /-- Helper for Piece 3c: the σ-equation as a vanishing `{1, Y}`-decomposition. + + If `f = a • 1 + b • Y` is fixed by `σ = (mulByInt W (-1)).pullback`, then applying +@@ -2719,6 +2632,7 @@ private lemma sigma_fixed_decomp_coeffs_vanish {a b : FractionRing (Polynomial K + map_mul, map_mul, algebraMap_fractionRing_a₁X_plus_a₃ W, map_ofNat] + linear_combination -h_combine + ++omit [Fintype K] in + /-- Helper for Piece 3c: char-split forcing `b = 0`. + + From the two vanishing coefficients of `sigma_fixed_decomp_coeffs_vanish`, +@@ -2733,7 +2647,7 @@ private lemma eq_zero_of_mul_a₁X_plus_a₃_and_two_mul_eq_zero + (hqb : 2 * b = 0) : b = 0 := by + by_cases h2 : (2 : K) = 0 + · -- Char 2: `a₁ X + a₃ ≠ 0`, so `b · (a₁X+a₃) = 0` forces `b = 0`. +- haveI : CharP K 2 := CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero h2 ++ have : CharP K 2 := CharTwo.of_one_ne_zero_of_two_eq_zero one_ne_zero h2 + have h_bXf_ne : algebraMap (Polynomial K) (FractionRing (Polynomial K)) + (Polynomial.C W.toAffine.a₁ * Polynomial.X + Polynomial.C W.toAffine.a₃) ≠ 0 := + fun h_eq ↦ a₁X_plus_a₃_ne_zero_char_two W +@@ -2756,6 +2670,7 @@ the image of `Frac(K[X]) → K(E)`. Combines the σ-action on the basis + decomposition `{1, Y}` (Pieces 0/1/2/3b) with `decomp_zero_iff` and a + char-split. -/ + ++omit [Fintype K] in + /-- **Path 2 Step 3 Piece 3c**: If `f ∈ KE` is fixed by `σ`, then + `f` is in the image of `algebraMap (Frac K[X]) KE`. + +@@ -2796,18 +2711,18 @@ theorem addPullback_x_negFrobenius_in_KX_image : + sigma_fixed_implies_in_KX_image W _ + (addPullback_x_negFrobenius_sigma_invariant W) + +-/-! ### Path 2 Steps 4+5: addPullback_x_negFrobenius is transcendental ++/-! ### addPullback_x_negFrobenius is transcendental + +-The consumer of `addPullback_x_negFrobenius_in_KX_image`. Combines that ++Apply `addPullback_x_negFrobenius_in_KX_image`. Combines that + witness with `algebraic_in_fracRing_eq_const` (algebraic-closure-of-K-in-K(x)) + and `addPullback_x_ne_const_negFrobenius` (the non-constancy lemma) to +-discharge transcendence axiom-clean for the `α = -π` case. -/ ++prove transcendence for the `α = -π` case. -/ + +-/-- **Path 2 Step 4+5 (axiom-clean closure of Sorry 2 for α = -π)**: ++/-- **Transcendence for negative Frobenius**: + `addPullback_x W (negFrobeniusIsog W)` is transcendental over `K`. + + Proof outline: +-* By `addPullback_x_negFrobenius_in_KX_image` (Piece 3d): there exists ++* By `addPullback_x_negFrobenius_in_KX_image`: there exists + `r : Frac(K[X])` with `addPullback_x = algebraMap _ KE r`. + * If `addPullback_x` were algebraic over `K`, so would `r` be (since + `algebraMap _ KE` is injective and pulls back transcendence). +@@ -2836,18 +2751,15 @@ theorem addPullback_x_transcendental_negFrobenius + rw [hr, hc, ← IsScalarTower.algebraMap_apply K (FractionRing (Polynomial K)) KE] + exact addPullback_x_ne_const_negFrobenius W hq hxy c hc' + +-/-! ### Day 3b: addCoordAlgHom injectivity for the negFrobenius case ++/-! ### Coordinate-ring injectivity from transcendence + +-Consumer of `addPullback_x_transcendental_negFrobenius` (Steps 4+5). Uses the +-witness-parametric `addCoordAlgHom_injective_of_baseHom_inj` with the +-unconditional base-hom injectivity below (the sorry-bearing generic +-`addBaseHom_injective` has been removed). -/ ++Transcendence of the summed x-coordinate gives injectivity of polynomial ++evaluation, and the integral coordinate-ring extension gives injectivity ++of the coordinate homomorphism. ++-/ + +-/-- **Day 3b helper**: `addBaseHom W (negFrobeniusIsog W)` is injective. +-Axiom-clean negFrobenius base-hom injectivity: rewrites the base-hom as +-`Polynomial.aeval (addPullback_x W (negFrob W))` (`addBaseHom_eq_aeval`) +-and applies `transcendental_iff_injective` to the unconditional +-`addPullback_x_transcendental_negFrobenius`. -/ ++/-- Transcendence of the negative-Frobenius addition x-coordinate makes its ++ polynomial evaluation homomorphism injective. -/ + theorem addBaseHom_injective_negFrobenius + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) : +@@ -2856,15 +2768,8 @@ theorem addBaseHom_injective_negFrobenius + exact transcendental_iff_injective.mp + (addPullback_x_transcendental_negFrobenius W hq hxy) + +-/-- **Day 3b**: `addCoordAlgHom` for `α = negFrobeniusIsog W` is injective. +-One-line consumer of `addCoordAlgHom_injective_of_baseHom_inj` and +-`addBaseHom_injective_negFrobenius`. Closes one of the three sorries in HOLE D's +-downstream chain axiom-clean. +- +-Together with `addPullback_x_transcendental_negFrobenius` and Path 2 Step 3, +-the negFrobenius `addCoordAlgHom`-injectivity is now fully +-unconditional — the input needed by `addPullbackAlgHom_negFrobenius_of_inj` +-to build a non-witness-parametric `addPullbackAlgHom_negFrobenius`. -/ ++/-- The negative-Frobenius addition coordinate-ring homomorphism is ++ injective, by injectivity of its polynomial restriction. -/ + theorem addCoordAlgHom_injective_negFrobenius + (hq : 2 ≤ Fintype.card K) + (hxy : AddNonInverse W (negFrobeniusIsog W)) : +@@ -2872,15 +2777,14 @@ theorem addCoordAlgHom_injective_negFrobenius + addCoordAlgHom_injective_of_baseHom_inj hxy + (addBaseHom_injective_negFrobenius W hq hxy) + +-/-! ### Day 3c Piece A: AddNonInverse witness + specialized addPullbackAlgHom ++/-! ### The function-field pullback of `1 − π` + +-The negFrobenius variant of `addPullbackAlgHom` requires both +-`AddNonInverse W (negFrobeniusIsog W)` and the corresponding injectivity +-of `addCoordAlgHom`. Both are dischargeable axiom-clean: the non-inverse +-condition reduces to `x_gen ≠ π·x_gen` (different orders at infinity), +-and injectivity is `addCoordAlgHom_injective_negFrobenius` (c8b4b66). -/ ++The identity and negative-Frobenius x-coordinates differ because their ++orders differ. Together with coordinate-ring injectivity, this constructs ++the addition pullback on the function field. ++-/ + +-/-- **Day 3c Piece A.1**: `AddNonInverse W (negFrobeniusIsog W)` holds ++/-- **Non-inverse coordinates**: `AddNonInverse W (negFrobeniusIsog W)` holds + unconditionally. The negation hypothesis would require `x_gen W = π·x_gen` + (the first conjunct), which contradicts + `x_gen_ne_frobeniusIsog_pullback_x_gen` (their orders at infinity differ). -/ +@@ -2890,11 +2794,8 @@ theorem negFrobeniusIsog_addNonInverse : + rw [negFrobeniusIsog_pullback_x_gen] at h_x + exact x_gen_ne_frobeniusIsog_pullback_x_gen W h_x + +-/-- **Day 3c Piece A.2**: Specialized `addPullbackAlgHom` for `α = negFrobenius`, +-discharging both `AddNonInverse` (via `negFrobeniusIsog_addNonInverse`) and +-`addCoordAlgHom`-injectivity (via `addCoordAlgHom_injective_negFrobenius`) +-axiom-clean. The unconditional algebra hom corresponding to the rational +-map `P ↦ P + (-π)(P) = P - π(P)` (i.e., `1 - π` on rational points). -/ ++/-- The function-field pullback of `P ↦ P − π(P)`, constructed from the ++ non-inverse coordinate witness and the injective coordinate map. -/ + noncomputable def addPullbackAlgHom_negFrobenius + (hq : 2 ≤ Fintype.card K) : KE →ₐ[K] KE := + addPullbackAlgHom_negFrobenius_of_inj W +@@ -2902,22 +2803,14 @@ noncomputable def addPullbackAlgHom_negFrobenius + (addCoordAlgHom_injective_negFrobenius W hq + (negFrobeniusIsog_addNonInverse W)) + +-/-! ### Day 3c Piece B: isogOneSub_negFrobenius (replacement for the placeholder) ++/-! ### The isogeny `1 − π` + +-The unconditional `1 − π` isogeny: pullback from `addPullbackAlgHom_negFrobenius` +-(real addition pullback for `id + (-π)`), rational-point map from +-`(AddMonoidHom.id _) - (frobeniusIsog W).toAddMonoidHom`. Replaces the +-`isogOneSub (frobeniusIsog W)` placeholder (whose pullback was `AlgHom.id`) +-with the mathematically correct pullback. -/ +- +-/-- **Day 3c Piece B**: The isogeny `1 − π` with the unconditional addition-formula +-pullback. Built from `addPullbackAlgHom_negFrobenius` (the pullback for +-`id + (−π) = 1 − π`) and the standard rational-point map +-`(AddMonoidHom.id _) - (frobeniusIsog W).toAddMonoidHom`. ++Its function-field pullback is the addition-formula pullback for ++`id + (−π)`, and its point map is `id − π`. ++-/ + +-Mathematically this is `1 − π` with the correct pullback that the placeholder +-`isogOneSub (frobeniusIsog W)` lacks (it uses `AlgHom.id` as a stub). HOLE D +-wire-up consumes this directly via `Isogeny.toAlgebra`/`degree`. -/ ++/-- The isogeny `1 − π` with its addition-formula function-field pullback ++ and the point map `id − π`. -/ + noncomputable def isogOneSub_negFrobenius + (hq : 2 ≤ Fintype.card K) : Isogeny W.toAffine W.toAffine where + pullback := addPullbackAlgHom_negFrobenius W hq +@@ -2932,20 +2825,12 @@ noncomputable def isogOneSub_negFrobenius + (isogOneSub_negFrobenius W hq).toAddMonoidHom = + (AddMonoidHom.id _) - (frobeniusIsog W).toAddMonoidHom := rfl + +-/-! ### Day 3c Piece C — REMOVED (2026-05-28 placeholder grind) + +-The bridge lemma `isogOneSub_negFrobenius_toAddMonoidHom_eq_oneSubFrobeniusIsog` +-(genuine `1−π` and the placeholder agree on `toAddMonoidHom`) existed only to +-transfer the placeholder's rational-point API to the genuine isogeny. All +-consumers now prove their kernel/point-map facts directly on +-`isogOneSub_negFrobenius` (its `toAddMonoidHom = id − frob`, frob's point map +-is the identity), so the bridge is no longer needed and has been deleted as +-part of removing the placeholder `oneSubFrobeniusIsog`. -/ + +-/-! ### D3b base: `AddNonInversePair` for `(zsmul 1 π, mulByInt (-1))` ++/-! ### `AddNonInversePair` for `(zsmul 1 π, mulByInt (-1))` + + The `(r, s) = (1, 1)` specialisation of the genuine `(zsmul r π, mulByInt (-s))` +-family that D3b/D4 will assemble into `genuineIsogSmulSub r s`. Both pullbacks ++family defining `genuineIsogSmulSub r s`. Both pullbacks + reduce on x-coord to `x_gen W` and `x_gen W ^ q` respectively via + `mulByInt_x_one` / `mulByInt_x_neg` / `frobeniusIsog_pullback_apply`; the + mismatch is `x_gen_ne_frobeniusIsog_pullback_x_gen`. -/ +@@ -2977,12 +2862,12 @@ theorem AddNonInversePair_zsmul_one_frobenius_mulByInt_neg_one : + rw [frobeniusIsog_pullback_apply] at hne + exact hne h.symm + +-/-! ### D3b general consumer: AddNonInversePair for `(zsmul r π, mulByInt -s)` ++/-! ### Non-inverse coordinate pairs: AddNonInversePair for `(zsmul r π, mulByInt -s)` + + Generalises the (1, 1) base case to arbitrary `(r, s) ≠ 0` (with `(r : K) ≠ 0` + and `(s : K) ≠ 0`). The x-coord pullbacks are `(mulByInt_x r)^q` (LHS) and + `mulByInt_x (-s)` (RHS); their orders at infinity are `-2q` and `-2` respectively +-(via `ordAtInfty_mulByInt_x` from `OrdAtInftyBridge.lean:207` and ++(via `ordAtInfty_mulByInt_x` for the coordinate pole and + `ordAtInfty_pow`). For `q ≥ 2`, these are unequal, so the pullbacks are + unequal — Silverman III.6 reflection of Frobenius pole-multiplication. -/ + +@@ -3043,7 +2928,7 @@ theorem AddNonInversePair_zsmul_frobenius_mulByInt_neg + exact_mod_cast Fintype.one_lt_card_iff_nontrivial.mpr inferInstance + linarith + +-/-! ### D3c step 1: σ-action on `(mulByInt n)` pullbacks (generic in `n ≠ 0`) ++/-! ### σ-action on `(mulByInt n)` pullbacks (generic in `n ≠ 0`) + + For any nonzero `n`, σ commutes with `(mulByInt n).pullback`: their composition + on `x_gen` is `(mulByInt (-n)).pullback x_gen = mulByInt_x W (-n) = mulByInt_x W n`, +@@ -3064,6 +2949,7 @@ private theorem mulByInt_comp_mulByInt_neg_one + (by simpa using neg_ne_zero.mpr hn) + rw [h]; congr 1; ring + ++omit [Fintype K] in + /-- **σ.pb fixes `(mulByInt n).pb x_gen`** for `n ≠ 0`. By `mulByInt` + commutativity, `σ.pb ([n].pb x_gen) = ([n].comp σ).pb x_gen + = (mulByInt (-n)).pb x_gen = mulByInt_x W (-n) = mulByInt_x W n` (the last by +@@ -3080,6 +2966,7 @@ theorem sigma_mulByInt_pullback_x_eq (n : ℤ) (hn : n ≠ 0) : + rw [mulByInt_pullback_x W (-n) (neg_ne_zero.mpr hn), mulByInt_x_neg] + exact (mulByInt_pullback_x W n hn).symm + ++omit [Fintype K] in + /-- **σ.pb on `(mulByInt n).pb y_gen`** for `n ≠ 0`. Same composition path + as the x-version but using `mulByInt_y_neg`: the σ-image is + `negY (mulByInt_x n) (mulByInt_y n) = -mulByInt_y n - a₁·mulByInt_x n - a₃`. -/ +@@ -3117,7 +3004,7 @@ theorem sigma_mulByInt_pullback_y_eq (n : ℤ) (hn : n ≠ 0) : + simp only [WeierstrassCurve.Affine.negY] + rfl + +-/-! ### D3c step 2: σ-action on `(zsmul r π).pb` ++/-! ### σ-action on `(zsmul r π).pb` + + For `α₁ = (frobeniusIsog W).zsmul r = (mulByInt r).comp π`, the σ-action + follows from `sigma_mulByInt_pullback_x_eq` / `_y_eq` plus σ commuting +@@ -3176,13 +3063,14 @@ theorem sigma_zsmul_frobenius_pullback_y_eq (r : ℤ) (hr : r ≠ 0) : + simp only [map_sub, map_neg, map_mul, + AlgHom.commutes (frobeniusIsog W).pullback] + +-/-! ### D3c step 3: x-ne mismatch witness for `(zsmul r π, mulByInt -s)` ++/-! ### x-ne mismatch witness for `(zsmul r π, mulByInt -s)` + + Extracted from `AddNonInversePair_zsmul_frobenius_mulByInt_neg`'s internal + proof: the x-coord pullbacks differ at `ord_∞` (`-2q` vs `-2`). Used + directly as the `h_x_ne` argument to the generic + `addPullback_x_pair_sigma_invariant`. -/ + ++omit [DecidableEq K] in + /-- The `ord_∞` contradiction behind the `x`-coord mismatch: `(mulByInt_x W r)^|K|` + (order `-2q`) cannot equal `mulByInt_x W (-s)` (order `-2`), since `|K|·(-2) = -2` + would force `|K| ≤ 1`. -/ +@@ -3224,16 +3112,16 @@ theorem zsmul_frobenius_pullback_x_ne_mulByInt_neg_pullback_x + rw [zsmul_frobenius_pullback_x_gen W r hr, mulByInt_neg_pullback_x_gen W s hs] + exact mulByInt_x_pow_card_ne_mulByInt_x_neg W r s hr hrK hs hsK + +-/-! ### D3c step 4: σ-invariance specialised + K(x) image ++/-! ### σ-invariance specialised + K(x) image + + Specialise `addPullback_x_pair_sigma_invariant` to + `(α₁, α₂) = (zsmul r π, mulByInt -s)` using the four σ-symmetry helpers +-shipped above, then chain with `sigma_fixed_implies_in_KX_image` to extract ++above, then chain with `sigma_fixed_implies_in_KX_image` to extract + the K(x) image. -/ + + /-- **σ-invariance of `addPullback_x_pair (zsmul r π, mulByInt -s)`**. + Specialisation of the generic `addPullback_x_pair_sigma_invariant` for +-the family used by D3c/D4. -/ ++this pencil family. -/ + theorem addPullback_x_pair_zsmul_frobenius_mulByInt_neg_sigma_invariant + (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) + (hrK : (r : K) ≠ 0) (hsK : (s : K) ≠ 0) : +@@ -3262,7 +3150,7 @@ theorem addPullback_x_pair_zsmul_frobenius_mulByInt_neg_in_KX_image + (addPullback_x_pair_zsmul_frobenius_mulByInt_neg_sigma_invariant + W r s hr hs hrK hsK) + +-/-! ### D3c step 5: ord helpers for `(zsmul r π).pb x_gen` and ++/-! ### ord helpers for `(zsmul r π).pb x_gen` and + `(mulByInt -s).pb x_gen` + + Concrete ord values needed by the pole-bound argument: `(zsmul r π).pb x_gen +@@ -3302,6 +3190,7 @@ theorem ordAtInfty_zsmul_frobenius_pullback_x_gen + push_cast + rfl + ++omit [Fintype K] in + /-- `ord_∞((mulByInt (-s)).pb x_gen) = -2` for `s ≠ 0` with `(s : K) ≠ 0`. + Direct from `(mulByInt -s).pb x_gen = mulByInt_x W (-s)` plus + `ordAtInfty_mulByInt_x`. -/ +@@ -3361,7 +3250,7 @@ private lemma ordAtInfty_mulByInt_x_mul_y (r : ℤ) {M m : ℤ} + refine ((W_smooth W).ordAtInfty_mul hX_ne hY_ne).trans ?_ + rw [hX_ord, hm]; push_cast; rfl + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- For `M < 0` the right-hand side of the Weierstrass equation is dominated by `X³`, so + `ord_∞(X³ + a₂·X² + a₄·X + a₆) = 3M` where `M = ord_∞(mulByInt_x W r)`. Repeated strict + non-archimedean additivity: `3M < 2M < M < 0`, so each successive `aᵢ·Xⁱ` term has strictly larger +@@ -3434,7 +3323,7 @@ private lemma mulByInt_y_ne_zero_of_weierstrass_lhs_ord (r : ℤ) {M : ℤ} + (congrArg (W_smooth W).ordAtInfty h_zero).trans (W_smooth W).ordAtInfty_zero + exact WithTop.top_ne_coe (h_ord_eq.symm.trans h_lhs_ord) + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- The halving lower bound `2m ≤ 3M`, where `m = ord_∞(mulByInt_y W r)` and `M = ord_∞(mulByInt_x W + r)`. If instead `2m ≥ 3M + 1`, every Weierstrass LHS term (`Y²`, `a₁·X·Y`, `a₃·Y`) would have order + `≥ 3M + 1`, so the LHS order would be `≥ 3M + 1`, contradicting `ord(LHS) = 3M`. -/ +@@ -3477,7 +3366,7 @@ private lemma two_mul_ordAtInfty_mulByInt_y_le (r : ℤ) {M m : ℤ} (hM_neg : M + have : (3 * M + 1 : ℤ) ≤ 3 * M := by exact_mod_cast h_lhs_ge + omega + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- When `m < M` and `m < 0` (which hold once `2m ≤ 3M` with `M < 0`), the term `Y²` strictly + dominates the other two Weierstrass LHS terms, so `ord_∞(Y² + a₁·X·Y + a₃·Y) = 2m`, where `m = + ord_∞(mulByInt_y W r)`. -/ +@@ -3520,6 +3409,7 @@ private lemma ordAtInfty_mulByInt_weierstrass_lhs_eq (r : ℤ) {M m : ℤ} + refine (((W_smooth W).ordAtInfty_add_eq_of_lt h_a3y_gt').trans h_inner_eq).trans ?_ + exact hY_sq_ord + ++omit [Fintype K] in + /-- **`ord_∞(mulByInt_y W r) = 3M/2`** for `r ≠ 0`, where `M = ord_∞(mulByInt_x W r)` is the + (even, `≤ -2`) `x`-order — **no** `(r : K) ≠ 0` hypothesis. The curve point + `(mulByInt_x W r, mulByInt_y W r)` satisfies the Weierstrass equation +@@ -3563,13 +3453,14 @@ theorem ordAtInfty_mulByInt_y_eq_of_x + rw [hm, h_target] + exact_mod_cast (by omega : m = 3 * M₂) + +-/-! ### D3c step 6: ord helpers for `mulByInt_y` and the y-pullbacks ++/-! ### ord helpers for `mulByInt_y` and the y-pullbacks + + To compute `ord_∞` of the pair `addPullback_x`, we need ord values for + the y-coordinate pullbacks: `ord((zsmul r π).pb y_gen) = -3q` and + `ord((mulByInt -s).pb y_gen) = -3`. These chain through + `ord(mulByInt_y W r) = -3` (curve-equation argument with x-ord = -2). -/ + ++omit [Fintype K] in + /-- **`ord_∞(mulByInt_y W r) = -3`** for `r ≠ 0` with `(r : K) ≠ 0`. + The `(mulByInt_x W r, mulByInt_y W r)` curve point has `ord(mulByInt_x) = -2`, + so the curve equation `Y² + a₁·X·Y + a₃·Y = X³ + ...` forces +@@ -3624,6 +3515,7 @@ theorem ordAtInfty_zsmul_frobenius_pullback_y_gen + push_cast + rfl + ++omit [Fintype K] in + /-- `ord_∞((mulByInt -s).pb y_gen) = -3` for `s ≠ 0` with `(s : K) ≠ 0`. + Direct from `(mulByInt -s).pb y_gen = mulByInt_y W (-s)` plus + `ordAtInfty_mulByInt_y_eq_neg_three`. -/ +@@ -3701,7 +3593,7 @@ theorem ordAtInfty_zsmul_frobenius_pullback_y_gen_of_x + rw [h_eq] + exact ((W_smooth W).ord_pow_concrete hY_ne ((3 * M) / 2) (Fintype.card K) hY_ord) + +-/-! ### D3c step 7: ord helpers for the pair differences ++/-! ### ord helpers for the pair differences + + The slope `L = (Y₁ - Y₂) / (X₁ - X₂)` requires ord of the differences: + `ord(α₁(x) - α₂(x)) = -2q` (α₁(x) dominates, ord = -2q < -2 = ord(α₂(x))), +@@ -3754,7 +3646,7 @@ theorem zsmul_frobenius_sub_mulByInt_neg_x_ne_zero + rw [ordAtInfty_zsmul_frobenius_sub_mulByInt_neg_x W r s hr hs hrK hsK] at h_top + exact WithTop.coe_ne_top h_top + +-/-! ### D3c step 8: numerator + reduced form for the pair (zsmul r π, mulByInt -s) ++/-! ### numerator + reduced form for the pair (zsmul r π, mulByInt -s) + + Mirror of `addPullbackNumerator_negFrobenius` and `_reduced` for the pair + version. The numerator is `(X₁-X₂)² · addPullback_x_pair` (cleared of the +@@ -3830,7 +3722,7 @@ private theorem weierstrass_relation_pullback (α : Isogeny W.toAffine W.toAffin + `addPullbackNumerator_negFrobenius_eq_reduced`, with both Weierstrass + equations applied via `linear_combination h_α₁ + h_α₂`. -/ + theorem addPullbackNumerator_pair_zsmul_frobenius_mulByInt_neg_eq_reduced +- (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) : ++ (r s : ℤ) (_hr : r ≠ 0) (_hs : s ≠ 0) : + addPullbackNumerator_pair_zsmul_frobenius_mulByInt_neg W r s = + addPullbackNumerator_reduced_pair_zsmul_frobenius_mulByInt_neg W r s := by + have h_α₁ := weierstrass_relation_pullback W ((frobeniusIsog W).zsmul r) +@@ -3885,7 +3777,7 @@ theorem addPullbackNumerator_pair_zsmul_frobenius_mulByInt_neg_eq + field_simp + ring + +-/-! ### D3c step 9: `ord(reduced_pair) = -4q - 2` ++/-! ### `ord(reduced_pair) = -4q - 2` + + Mirror of `ordAtInfty_addPullbackNumerator_reduced_negFrobenius_eq` for + the pair version. Dominant term: `α₁(x)² · α₂(x)` (ord = -4q-2). All +@@ -3914,6 +3806,7 @@ private lemma zsmul_frobenius_pullback_x_gen_ne_zero + rw [ordAtInfty_zsmul_frobenius_pullback_x_gen W r hr hrK] at h_top + exact WithTop.coe_ne_top h_top + ++omit [Fintype K] in + /-- `(mulByInt -s).pb y_gen ≠ 0` for `s ≠ 0` with `(s : K) ≠ 0`. -/ + private lemma mulByInt_neg_pullback_y_gen_ne_zero + (s : ℤ) (hs : s ≠ 0) (hsK : (s : K) ≠ 0) : +@@ -3925,6 +3818,7 @@ private lemma mulByInt_neg_pullback_y_gen_ne_zero + rw [ordAtInfty_mulByInt_neg_pullback_y_gen W s hs hsK] at h_top + exact WithTop.coe_ne_top h_top + ++omit [Fintype K] in + /-- `(mulByInt -s).pb x_gen ≠ 0` for `s ≠ 0` with `(s : K) ≠ 0`. -/ + private lemma mulByInt_neg_pullback_x_gen_ne_zero + (s : ℤ) (hs : s ≠ 0) (hsK : (s : K) ≠ 0) : +@@ -4120,6 +4014,7 @@ private lemma ord_zsmul_frobenius_mulByInt_neg_rest_term_a₄_ge + exact_mod_cast (by linarith : + (-3 * (Fintype.card K : ℤ) - 3 : ℤ) ≤ -2 * (Fintype.card K : ℤ)) + ++omit [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Rest term 2: `ord(2 · a₆) ≥ -3q - 3`. The constant `a₆` has order `≥ 0` (or `⊤` if + zero), which clears `-3q - 3`; `ord_two_mul_ge` handles the `2·` factor in any + characteristic. -/ +@@ -4385,7 +4280,7 @@ theorem ord_addPullback_x_pair_zsmul_frobenius_mulByInt_neg + (-4 * (Fintype.card K : ℤ)) h_num_ord h_den_ord).trans ?_ + congr 1; ring + +-/-! ### D3c: the `y`-coordinate `∞`-order for the pair `(zsmul r π, mulByInt -s)` ++/-! ### the `y`-coordinate `∞`-order for the pair `(zsmul r π, mulByInt -s)` + + The pair analogue of `ord_addPullback_y_negFrobenius = -3`. The proof is the *same* + Weierstrass-equation argument: from `ord_∞(addPullback_x_pair) = -2` and the curve equation +@@ -4400,7 +4295,7 @@ private theorem ord_addPullback_x_sq_pair_zsmul_frobenius_mulByInt_neg + (W_smooth W).ordAtInfty + (addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) ^ 2) = + ((-4 : ℤ) : WithTop ℤ) := by +- haveI : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic ++ have : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic + have hX_ne : addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) ≠ 0 := + fun h ↦ WithTop.coe_ne_top + (((W_smooth W).ordAtInfty_eq_top_iff _).mpr h ▸ +@@ -4415,7 +4310,7 @@ private theorem ord_addPullback_x_cube_pair_zsmul_frobenius_mulByInt_neg + (W_smooth W).ordAtInfty + (addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) ^ 3) = + ((-6 : ℤ) : WithTop ℤ) := by +- haveI : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic ++ have : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic + have hX_ne : addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) ≠ 0 := + fun h ↦ WithTop.coe_ne_top + (((W_smooth W).ordAtInfty_eq_top_iff _).mpr h ▸ +@@ -4435,7 +4330,7 @@ private theorem ord_RHS_pair_zsmul_frobenius_mulByInt_neg + addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) + + algebraMap K KE W.toAffine.a₆) = + ((-6 : ℤ) : WithTop ℤ) := by +- haveI : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic ++ have : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic + set X := addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) with hX + have h_X3 : (W_smooth W).ordAtInfty (X ^ 3) = ((-6 : ℤ) : WithTop ℤ) := + ord_addPullback_x_cube_pair_zsmul_frobenius_mulByInt_neg W r s hr hs hrK hsK +@@ -4525,7 +4420,7 @@ private theorem addPullback_y_pair_zsmul_frobenius_mulByInt_neg_ne_zero + (h_ord_eq.symm.trans + (ord_weierstrass_lhs_pair_zsmul_frobenius_mulByInt_neg W r s hr hs hrK hsK)) + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Order-arithmetic helper (step (a)): if `ord(LHS) = -6`, the y-order `m` of the Weierstrass LHS + satisfies `m ≤ -3`. Otherwise all three summands would have order `≥ -4`, forcing `ord(LHS) ≥ -4`, + contradicting `-6`. Purely generic in `X`, `Y`, `m` and the per-term order data. -/ +@@ -4558,7 +4453,7 @@ private theorem ord_y_le_neg_three_of_weierstrass_lhs_ord {X Y : KE} {m : ℤ} + have h46 : (-4 : ℤ) ≤ -6 := by exact_mod_cast h_lhs_ge + omega + +-omit [Fintype K] in ++omit [Fintype K] [WeierstrassCurve.IsElliptic W.toAffine] in + /-- Order-arithmetic helper (step (b)): when `m ≤ -3`, the `Y²` term strictly dominates both the + `a₁·X·Y` and `a₃·Y` terms (`2m < -2 + m` and `2m < m`), so the order of the Weierstrass LHS equals + `ord(Y²)`. Purely generic in `X`, `Y`, `m` and the per-term order data. -/ +@@ -4603,7 +4498,7 @@ theorem ord_addPullback_y_pair_zsmul_frobenius_mulByInt_neg + (W_smooth W).ordAtInfty + ((addPullback_y_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s))) : KE) = + ((-3 : ℤ) : WithTop ℤ) := by +- haveI : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic ++ have : (W_smooth W).toAffine.IsElliptic := inferInstanceAs W.toAffine.IsElliptic + set X := addPullback_x_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) with hX + set Y := addPullback_y_pair ((frobeniusIsog W).zsmul r) (mulByInt W.toAffine (-s)) with hY + have hX_ne : X ≠ 0 := +@@ -4633,21 +4528,13 @@ theorem ord_addPullback_y_pair_zsmul_frobenius_mulByInt_neg + have h_2m : (2 * m : ℤ) = -6 := by exact_mod_cast h_lhs_ord + rw [hm]; exact_mod_cast (by omega : m = -3) + +-/-! ### D4: pole-bound-parametric `genuineIsogSmulSub` ++/-! ### The pencil `r·π − s·id` + +-Worker D consumes `genuineIsogSmulSub r s` for the genuine `r·π - s·id` +-isogeny. The constructor needs: +-1. The `AddNonInversePair` witness — shipped axiom-clean as +- `AddNonInversePair_zsmul_frobenius_mulByInt_neg`. +-2. `addCoordAlgHomPair`-injectivity — reducible (via base-hom + transcendence +- chain) to a pole bound `ord_∞ < 0` on the pair pullback x-coord. +- +-We ship the **pole-bound-parametric** form. The pole bound discharges +-axiom-clean via the same numerator/denominator/Weierstrass-reduction +-chain as `ord_addPullback_x_negFrobenius` (the (1,1) base case here), +-mirrored to the pair version with α₁(x)²·α₂(x) as the dominant term +-(ord = -4q-2). Worker D supplies the pole bound (or waits for the +-follow-up axiom-clean discharge). -/ ++Different coordinate orders provide the non-inverse-pair witness. ++A pole of the summed x-coordinate gives polynomial and coordinate-ring ++injectivity through curve-negation invariance and its `K(x)` image. ++These facts construct the pencil isogeny's function-field pullback. ++-/ + + /-- **Witness-parametric base-hom injectivity** for the + `(zsmul r π, mulByInt -s)` family: takes the pole bound hypothesis +@@ -4713,17 +4600,9 @@ theorem addCoordAlgHomPair_injective_zsmul_frobenius_mulByInt_neg_of_pole + (addBaseHomPair_injective_zsmul_frobenius_mulByInt_neg_of_pole + W r s hr hs hrK hsK h_pole) + +-/-- **D4: genuine `r·π - s·id` isogeny constructor (pole-bound-parametric)**. +- +-The genuine `r·π - s·id` isogeny with the *real* function-field pullback +-(replacing the `AlgHom.id` placeholder of `Endomorphism.lean`'s +-`isogSmulSub`). On rational points equals +-`(zsmul r π).toAddMonoidHom + (mulByInt -s).toAddMonoidHom`. +- +-Worker D in `DegreeQuadraticForm.lean` consumes this as the `r·π - s·id` +-isogeny family. The pole bound discharges axiom-clean via the same +-numerator chain as `ord_addPullback_x_negFrobenius` (the (1,1) base +-case), mirrored to the pair version. -/ ++/-- The isogeny `r·π − s·id`, given the pole of its addition x-coordinate. ++ Its function-field pullback comes from the addition formulas, and its ++ point map is `(r·π) + (−s·id)`. -/ + noncomputable def genuineIsogSmulSub_of_pole + (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) + (hrK : (r : K) ≠ 0) (hsK : (s : K) ≠ 0) +@@ -4747,12 +4626,11 @@ noncomputable def genuineIsogSmulSub_of_pole + (mulByInt W.toAffine (-s)).toAddMonoidHom := + rfl + +-/-! ### D4 unconditional: `genuineIsogSmulSub` ++/-! ### Constructing the pencil from its coordinate pole + +-With `ord_addPullback_x_pair_zsmul_frobenius_mulByInt_neg = -2 < 0` +-discharged axiom-clean, the witness-parametric `genuineIsogSmulSub_of_pole` +-becomes unconditional. The unconditional form is what Worker D consumes +-in `DegreeQuadraticForm.lean` for the polarisation. -/ ++The addition x-coordinate has order `−2`, hence a pole. This supplies ++the injectivity witness for the function-field pullback of `r·π − s·id`. ++-/ + + /-- The pole bound `ord_∞ < 0` discharges from + `ord_addPullback_x_pair_zsmul_frobenius_mulByInt_neg = -2`. -/ +@@ -4765,11 +4643,9 @@ private theorem h_pole_discharge + rw [ord_addPullback_x_pair_zsmul_frobenius_mulByInt_neg W r s hr hs hrK hsK] + exact_mod_cast (by norm_num : (-2 : ℤ) < 0) + +-/-- **D4 (unconditional)**: the genuine `r·π - s·id` isogeny for +-`r, s ≠ 0` with `(r : K), (s : K) ≠ 0`. Pullback is the *real* +-function-field pullback; on rational points equals +-`r · π + (-s) · id = r · π - s · id`. Worker D in +-`DegreeQuadraticForm.lean` consumes this directly. -/ ++/-- The isogeny `r·π − s·id` when the two integers and their base-field ++ images are nonzero. Its pullback is the addition-formula pullback, ++ and its point map is `r·π − s·id`. -/ + noncomputable def genuineIsogSmulSub + (r s : ℤ) (hr : r ≠ 0) (hs : s ≠ 0) + (hrK : (r : K) ≠ 0) (hsK : (s : K) ≠ 0) : +@@ -4785,7 +4661,7 @@ noncomputable def genuineIsogSmulSub + (mulByInt W.toAffine (-s)).toAddMonoidHom := + rfl + +-/-! ### D4 inseparable: the `p ∣ r` pole bound `ord_∞(addPullback_x_pair) = -2` ++/-! ### Inseparable pencil: the `p ∣ r` pole bound `ord_∞(addPullback_x_pair) = -2` + + For the **inseparable** pencil summand `r·π` (when `p ∣ r`, so `(r : K) = 0`), the `x`-pole of + `α₁ = (frobeniusIsog).zsmul r` is `ord_∞(α₁^* x_gen) = q·M` with +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/FunctionField.lean b/projects/HasseWeil/HasseWeil/Isogeny/FunctionField.lean +index 390492635..fba307a06 100644 +--- a/projects/HasseWeil/HasseWeil/Isogeny/FunctionField.lean ++++ b/projects/HasseWeil/HasseWeil/Isogeny/FunctionField.lean +@@ -7,30 +7,6 @@ import Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Point + import Mathlib.LinearAlgebra.Dimension.Finrank + import Mathlib.LinearAlgebra.Basis.VectorSpace + +-/-! +-# Isogenies via Function Field Extensions +- +-We define isogenies between elliptic curves as injective `K`-algebra homomorphisms +-on function fields, following Silverman III.4. The degree of an isogeny is the degree +-of the corresponding field extension. +- +-## Main Definitions +- +-* `HasseWeil.Isogeny`: An isogeny from `E₁` to `E₂`, represented as an injective +- `K`-algebra homomorphism `K(E₂) →ₐ[K] K(E₁)` on function fields. +-* `HasseWeil.Isogeny.degree`: The degree `[K(E₁) : φ*K(E₂)]`. +- +-## Design Note +- +-The degree is defined as `Module.finrank K(E₂) K(E₁)` where `K(E₁)` is given a +-`K(E₂)`-algebra structure via the pullback `φ* : K(E₂) →ₐ[F] K(E₁)`. This avoids +-working with subalgebra ranges and makes the tower law (degree multiplicativity) +-a direct application of `Module.finrank_mul_finrank`. +- +-## References +- +-* [Silverman, *The Arithmetic of Elliptic Curves*], III.4 +--/ + + open WeierstrassCurve Polynomial + +@@ -49,8 +25,7 @@ namespace PullbackIsogeny + variable {F : Type*} [Field F] + variable {W₁ W₂ W₃ : Affine F} [W₁.IsElliptic] [W₂.IsElliptic] [W₃.IsElliptic] + +-/-- The pullback of an isogeny is injective: any algebra homomorphism from a field +- is injective because the kernel of a ring homomorphism from a field is trivial. -/ ++ + theorem pullback_injective (φ : PullbackIsogeny F W₁ W₂) : + Function.Injective φ.pullback := + φ.pullback.toRingHom.injective +@@ -61,8 +36,7 @@ noncomputable def toAlgebra (φ : PullbackIsogeny F W₁ W₂) : + Algebra W₂.FunctionField W₁.FunctionField := + φ.pullback.toRingHom.toAlgebra + +-/-- The degree of an isogeny, defined as `[K(E₁) : K(E₂)]` where `K(E₁)` is +- a `K(E₂)`-module via the pullback. -/ ++ + noncomputable def degree (φ : PullbackIsogeny F W₁ W₂) : ℕ := + @Module.finrank W₂.FunctionField W₁.FunctionField _ _ φ.toAlgebra.toModule + +@@ -81,12 +55,12 @@ theorem comp_algebraMap_eq (ψ : PullbackIsogeny F W₂ W₃) (φ : PullbackIsog + theorem comp_degree (ψ : PullbackIsogeny F W₂ W₃) (φ : PullbackIsogeny F W₁ W₂) : + (ψ.comp φ).degree = φ.degree * ψ.degree := by + simp only [degree] +- letI inst₁ : Algebra W₂.FunctionField W₁.FunctionField := φ.toAlgebra +- letI inst₂ : Algebra W₃.FunctionField W₂.FunctionField := ψ.toAlgebra +- letI inst₃ : Algebra W₃.FunctionField W₁.FunctionField := (ψ.comp φ).toAlgebra +- haveI : IsScalarTower W₃.FunctionField W₂.FunctionField W₁.FunctionField := ++ let inst₁ : Algebra W₂.FunctionField W₁.FunctionField := φ.toAlgebra ++ let inst₂ : Algebra W₃.FunctionField W₂.FunctionField := ψ.toAlgebra ++ let inst₃ : Algebra W₃.FunctionField W₁.FunctionField := (ψ.comp φ).toAlgebra ++ have : IsScalarTower W₃.FunctionField W₂.FunctionField W₁.FunctionField := + IsScalarTower.of_algebraMap_eq fun x => rfl +- haveI : Module.Free W₂.FunctionField W₁.FunctionField := ++ have : Module.Free W₂.FunctionField W₁.FunctionField := + Module.Free.of_divisionRing _ _ + rw [mul_comm] + exact (Module.finrank_mul_finrank +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/GroupHom/PicZero.lean b/projects/HasseWeil/HasseWeil/Isogeny/GroupHom/PicZero.lean +index 1b98e70eec533a4bac61cd0a445abb7372a63eea..603d41e1f0ecdaf549903d24babfdd67af8baf36 100644 +GIT binary patch +delta 1063 +zcmaKr&x#X45XO;}tTYJXNkOGBxBnCWi2d$O*V=*_F< +z0mL^5Nnq?e||E*d~UkuOl_es6@Sha9z!S)C`TQ*wF|cP +z#mKnBsA{yxc);@Abe;iuP^Pjn(6B@}q)?>JyF)COZ)cCBGDCt&TFAbB$@;Kg)V`6{ +zd95%{Pb}zIz-U>5HKc=&vJ%Gs*oy*bibn5yQ!AaUFgP~A%T;xmRD{DINqfN8wj@QN +zJW3-cQj;&DH+CNFx!*$1f&&NS&G%OXZKAkNj)~NYHsts$3;@-Kzf4C +zBdptRW9$p@3`gitE4&4>$DRJ{P3PNw8sCfKV@|w6lkPn0LXKXc&N-)a)^-@wesv;I +z99hF&JO>sE8ImuSntj-S#m~*bg@eJ`Gj}@T_a&t9hlEk`MQ$;>&ERUc+ukc +z*EY?O+mmNogKb#8{|H-8x3k6Gl}{VfNLC`Qck+kgTN{gxeZ}SDlCh3f^fsdLY!TQz +zr$7^a9ko~-qvfH&FaAA$5NpdKVzX=4Z$9ioq=@e+)}dha7Oh~?jn@fVfy0g9P3;se +J&fhq=_!|#HjPn2h + +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/Kernel.lean b/projects/HasseWeil/HasseWeil/Isogeny/Kernel.lean +index 2b2b0f7f5..f46fb56a6 100644 +--- a/projects/HasseWeil/HasseWeil/Isogeny/Kernel.lean ++++ b/projects/HasseWeil/HasseWeil/Isogeny/Kernel.lean +@@ -7,36 +7,6 @@ import HasseWeil.Foundation.Basic + import Mathlib.FieldTheory.Galois.Basic + import Mathlib.FieldTheory.SeparableDegree + +-/-! +-# Kernel of an Isogeny +- +-For an isogeny `φ : E₁ → E₂`, we collect the structural facts about `ker φ` +-as an `AddSubgroup` of `E₁.Point`. These are foundational for the dual +-isogeny construction (Silverman III.6) and the Hasse bound (V.1). +- +-## Main definitions +- +-* `Isogeny.kernel φ` — the kernel of `φ.toAddMonoidHom`, viewed as an +- `AddSubgroup` of `W₁.Point`. A thin wrapper around `AddMonoidHom.ker`. +-* `Isogeny.IsSeparable φ` — separability of the induced field extension. +- +-## Deep results (not yet proved) +- +-The following correspond to tickets `T-III-4-011/012/015`; they require +-substantial infrastructure (finiteness of fibers for finite morphisms of +-smooth curves, and the Galois theory of `K(E₁)/φ*K(E₂)`) and are deferred. +- +-* **Silverman III.4.10(a)** — nonzero isogeny has finite kernel. +-* **Silverman III.4.10(b)** — `#ker φ ≤ deg_s φ ≤ deg φ`. +-* **Silverman III.4.10(c)** — equality when `φ` is separable. +- +-Once available, these unblock the dual isogeny chain (T-III-6-001 etc.). +- +-## References +- +-* [J Silverman, *The Arithmetic of Elliptic Curves*][silverman2009], III.4.10. +- +--/ + + open WeierstrassCurve + +@@ -47,7 +17,7 @@ variable {W₁ W₂ : Affine F} [W₁.IsElliptic] [W₂.IsElliptic] + + namespace Isogeny + +-/-- The kernel of an isogeny `φ`, as an `AddSubgroup` of `W₁.Point`. -/ ++ + noncomputable def kernel (φ : Isogeny W₁ W₂) : AddSubgroup W₁.Point := + φ.toAddMonoidHom.ker + +@@ -58,25 +28,20 @@ noncomputable def kernel (φ : Isogeny W₁ W₂) : AddSubgroup W₁.Point := + @[simp] theorem zero_mem_kernel (φ : Isogeny W₁ W₂) : (0 : W₁.Point) ∈ φ.kernel := + (φ.kernel).zero_mem + +-/-- The kernel is preserved by composition (fiberwise): `ker φ ⊆ ker (ψ ∘ φ)`. -/ ++ + theorem kernel_comp_le {W₃ : Affine F} [W₃.IsElliptic] (ψ : Isogeny W₂ W₃) + (φ : Isogeny W₁ W₂) : φ.kernel ≤ (ψ.comp φ).kernel := by + intro P hP + simp only [mem_kernel_iff, comp_apply] at hP ⊢ + rw [hP, map_zero] + +-/-- **T-III-4-011 witness form**: If the fiber `φ⁻¹({0})` (as a subtype +- of `W₁.Point`) is finite, then `φ.kernel` is a finite additive subgroup. + +- The hypothesis `h_fiber` is a specific case of T-II-2-002 (finite fibers +- for nonconstant morphisms of smooth curves) applied to the fiber over `0`. +- Full unconditional version awaits that foundational curve-theory result. -/ + theorem kernel_finite_of_fiber_finite (φ : Isogeny W₁ W₂) + (h_fiber : Finite {P : W₁.Point // φ.toAddMonoidHom P = 0}) : + Finite φ.kernel := + Finite.of_equiv _ (Equiv.subtypeEquivRight (mem_kernel_iff φ)).symm + +-/-- `ker [1] = ⊥` (trivial kernel, since [1] is the identity on points). -/ ++ + @[simp] theorem kernel_mulByInt_one {W : WeierstrassCurve F} [W.toAffine.IsElliptic] : + (mulByInt W.toAffine 1).kernel = ⊥ := by + ext P +@@ -108,8 +73,7 @@ theorem mem_kernel_comp_of_mem_kernel {W₃ : Affine F} [W₃.IsElliptic] + (hP : P ∈ φ.kernel) : P ∈ (ψ.comp φ).kernel := + kernel_comp_le ψ φ hP + +-/-- If `ψ` has trivial kernel, `ker (ψ ∘ φ) = ker φ`: applying a "monomorphic" +- post-composition doesn't enlarge the kernel. -/ ++ + theorem kernel_comp_of_kernel_eq_bot {W₃ : Affine F} [W₃.IsElliptic] + {ψ : Isogeny W₂ W₃} (hψ : ψ.kernel = ⊥) (φ : Isogeny W₁ W₂) : + (ψ.comp φ).kernel = φ.kernel := by +@@ -123,9 +87,7 @@ theorem kernel_comp_of_kernel_eq_bot {W₃ : Affine F} [W₃.IsElliptic] + · intro h + rw [h, map_zero] + +-/-- **Kernel finiteness over finite fields (unconditional)**: when `W₁.Point` +- is finite (e.g., for an elliptic curve over a finite field), every kernel +- is automatically finite. -/ ++ + instance kernel_finite_of_point_finite [Finite W₁.Point] (φ : Isogeny W₁ W₂) : + Finite φ.kernel := + inferInstance +@@ -135,15 +97,12 @@ theorem kernel_card_le_point_card [Finite W₁.Point] (φ : Isogeny W₁ W₂) : + Nat.card φ.kernel ≤ Nat.card W₁.Point := + Nat.card_le_card_of_injective _ (Subtype.val_injective) + +-/-- **Lagrange for kernel**: over a finite field, `#ker φ ∣ #W₁.Point` +- (subgroup cardinality divides group cardinality). -/ ++ + theorem kernel_card_dvd_point_card [Finite W₁.Point] (φ : Isogeny W₁ W₂) : + Nat.card φ.kernel ∣ Nat.card W₁.Point := + AddSubgroup.card_addSubgroup_dvd_card φ.kernel + +-/-- **Kernel of sum** (for AddSubgroup inclusion): `ker φ ∩ ker ψ ≤ ker (φ + ψ)`, +- where `(φ + ψ)` is a hypothetical isogeny with summed action. +- (Purely algebraic: if φ(P) = 0 and ψ(P) = 0, then φ(P) + ψ(P) = 0.) -/ ++ + theorem kernel_inf_le_kernel_of_sum (φ ψ : Isogeny W₁ W₂) + (σ : Isogeny W₁ W₂) (hσ : σ.toAddMonoidHom = φ.toAddMonoidHom + ψ.toAddMonoidHom) : + φ.kernel ⊓ ψ.kernel ≤ σ.kernel := by +@@ -151,7 +110,7 @@ theorem kernel_inf_le_kernel_of_sum (φ ψ : Isogeny W₁ W₂) + simp only [AddSubgroup.mem_inf, mem_kernel_iff] at hP + simp only [mem_kernel_iff, hσ, AddMonoidHom.add_apply, hP.1, hP.2, add_zero] + +-/-- An isogeny has trivial kernel iff its toAddMonoidHom is injective. -/ ++ + theorem kernel_eq_bot_iff_injective (φ : Isogeny W₁ W₂) : + φ.kernel = ⊥ ↔ Function.Injective φ.toAddMonoidHom := + AddMonoidHom.ker_eq_bot_iff φ.toAddMonoidHom +@@ -161,23 +120,20 @@ theorem id_toAddMonoidHom_injective : + Function.Injective (Isogeny.id W₁).toAddMonoidHom := + Function.injective_id + +-/-- `ker (ψ ∘ φ) = φ⁻¹(ker ψ)` (as an AddSubgroup): the kernel of a composition +- is the preimage of the outer kernel. -/ ++ + theorem kernel_comp_eq_comap {W₃ : Affine F} [W₃.IsElliptic] + (ψ : Isogeny W₂ W₃) (φ : Isogeny W₁ W₂) : + (ψ.comp φ).kernel = ψ.kernel.comap φ.toAddMonoidHom := by + ext P + simp [mem_kernel_iff] + +-/-- For a nonzero isogeny with finite kernel, the action of the kernel on +- any nonempty fiber is transitive. I.e., `φ⁻¹(Q) = P₀ + ker φ` as sets +- (when `φ(P₀) = Q`). -/ ++ + theorem fiber_eq_coset (φ : Isogeny W₁ W₂) + {P₀ : W₁.Point} {Q : W₂.Point} (hP₀ : φ.toAddMonoidHom P₀ = Q) : + {P : W₁.Point | φ.toAddMonoidHom P = Q} = + {P : W₁.Point | ∃ T ∈ φ.kernel, P = P₀ + T} := by + ext P +- simp only [Set.mem_setOf_eq] ++ simp only [Set.mem_ofPred_eq] + constructor + · intro hP + refine ⟨P - P₀, ?_, by abel⟩ +@@ -193,10 +149,7 @@ theorem mem_fiber_iff_sub_mem_kernel (φ : Isogeny W₁ W₂) + φ.toAddMonoidHom P = Q ↔ P - P₀ ∈ φ.kernel := by + rw [mem_kernel_iff, map_sub, hP₀, sub_eq_zero] + +-/-- **Fiber cardinality = kernel cardinality** (via coset structure): the +- fiber `φ⁻¹(Q)` of a nonempty fiber (with `P₀ ∈ φ⁻¹(Q)`) has the same +- cardinality as `ker φ`. This is the group-theoretic content of the +- fiber-cardinality formula (before invoking any ramification theory). -/ ++ + noncomputable def fiberEquivKernel (φ : Isogeny W₁ W₂) + {P₀ : W₁.Point} {Q : W₂.Point} (hP₀ : φ.toAddMonoidHom P₀ = Q) : + {P : W₁.Point // φ.toAddMonoidHom P = Q} ≃ φ.kernel where +@@ -213,12 +166,11 @@ theorem fiber_finite_of_kernel_finite (φ : Isogeny W₁ W₂) + Finite {P : W₁.Point // φ.toAddMonoidHom P = Q} := by + rcases Classical.em (∃ P₀, φ.toAddMonoidHom P₀ = Q) with ⟨P₀, hP₀⟩ | h_empty + · exact Finite.of_equiv _ (fiberEquivKernel φ hP₀).symm +- · haveI : IsEmpty {P : W₁.Point // φ.toAddMonoidHom P = Q} := ++ · have : IsEmpty {P : W₁.Point // φ.toAddMonoidHom P = Q} := + ⟨fun ⟨P, hP⟩ ↦ h_empty ⟨P, hP⟩⟩ + infer_instance + +-/-- **Bijection of nonempty fibers**: any two nonempty fibers of `φ` are in +- bijection. (They're both cosets of the kernel, hence have the same size.) -/ ++ + noncomputable def fiberEquivFiber (φ : Isogeny W₁ W₂) + {P₀ : W₁.Point} {Q : W₂.Point} (hP₀ : φ.toAddMonoidHom P₀ = Q) + {P₁ : W₁.Point} {Q' : W₂.Point} (hP₁ : φ.toAddMonoidHom P₁ = Q') : +@@ -226,21 +178,12 @@ noncomputable def fiberEquivFiber (φ : Isogeny W₁ W₂) + {P : W₁.Point // φ.toAddMonoidHom P = Q'} := + (fiberEquivKernel φ hP₀).trans (fiberEquivKernel φ hP₁).symm + +-/-- **T-III-4-015 step 1** (kernel-as-fiber-over-zero): the kernel of an +- isogeny is in canonical bijection with the fiber over the identity point. +- Direct specialization of `fiberEquivKernel` to `Q = 0` (image of `P₀ = 0`). + +- This is the foundational set-theoretic identification: `φ.kernel ≃ φ⁻¹(0)`. +- Combined with `fiber_card_eq_kernel_card` (which generalizes to any `Q` in +- image), this gives the standard isogeny-fiber result that connects the +- kernel cardinality to the fiber structure. -/ + noncomputable def kernel_equiv_fiber_zero (φ : Isogeny W₁ W₂) : + φ.kernel ≃ {P : W₁.Point // φ.toAddMonoidHom P = 0} := + (fiberEquivKernel φ (by simp : φ.toAddMonoidHom 0 = 0)).symm + +-/-- **Corollary** (kernel-cardinality = fiber-zero-cardinality): when the kernel +- is finite, the cardinality of the fiber over zero equals the cardinality of +- the kernel. Direct from `kernel_equiv_fiber_zero`. -/ ++ + theorem kernel_card_eq_fiber_zero_card (φ : Isogeny W₁ W₂) + [Finite φ.kernel] : + Nat.card φ.kernel = Nat.card {P : W₁.Point // φ.toAddMonoidHom P = 0} := +@@ -253,7 +196,7 @@ theorem fiber_card_eq_kernel_card (φ : Isogeny W₁ W₂) + Nat.card {P : W₁.Point // φ.toAddMonoidHom P = Q} = Nat.card φ.kernel := + Nat.card_congr (fiberEquivKernel φ hP₀) + +-/-- The kernel of the identity isogeny is trivial. -/ ++ + @[simp] theorem kernel_id : (Isogeny.id W₁).kernel = ⊥ := by + ext P + simp [mem_kernel_iff, id_toAddMonoidHom] +@@ -308,15 +251,7 @@ theorem fiber_card_eq_sepDegree_of_witness (φ : Isogeny W₁ W₂) + rw [← fiber_card_eq_kernel_card φ rfl (P₀ := P₀_wit)] + exact h_wit + +-/-- **Hasse-bound shortcut**: if `|ker φ| = φ.sepDegree` (a finite-field +- fact that can be proved directly without going through the generic +- II.2.6(b) fiber-size theorem), then the fiber over `φ(0)` (i.e. the +- kernel) provides the fiber witness used by the historical witness-parametric +- Hasse-bound route. + +- Reduces T-II-2-009's "existential fiber-size = sepDegree" witness to the +- simpler `|ker| = sepDegree` fact, which is directly accessible for +- separable isogenies over finite fields via the V.1 chain. -/ + theorem fiber_witness_of_ker_card_eq_sepDegree (φ : Isogeny W₁ W₂) + [Finite φ.kernel] + (h_ker_sep : Nat.card φ.kernel = φ.sepDegree) : +@@ -327,13 +262,7 @@ theorem fiber_witness_of_ker_card_eq_sepDegree (φ : Isogeny W₁ W₂) + rw [fiber_card_eq_kernel_card φ (P₀ := 0) (Q := φ.toAddMonoidHom 0) rfl, + h_ker_sep] + +-/-- **T-III-4-015 step 2 closer** (witness-parametric): given a witness that +-the fiber over zero has cardinality `φ.sepDegree`, the kernel cardinality +-equals `φ.sepDegree`. Direct from `kernel_card_eq_fiber_zero_card`. + +-The witness `h_fiber_card_zero` is the SUBSTANTIVE content of Silverman +-III.4.10/12 specialized to fiber over zero: for separable isogenies, every +-fiber has cardinality = sepDegree. -/ + theorem kernel_card_eq_sepDegree_of_fiber_zero_witness (φ : Isogeny W₁ W₂) + [h_ker : Finite φ.kernel] + (h_fiber_card_zero : +@@ -341,9 +270,7 @@ theorem kernel_card_eq_sepDegree_of_fiber_zero_witness (φ : Isogeny W₁ W₂) + Nat.card φ.kernel = φ.sepDegree := by + rw [kernel_card_eq_fiber_zero_card φ, h_fiber_card_zero] + +-/-- **T-III-4-015 witness form for separable isogenies**: If `φ` is +- separable and has a finite kernel, and at least one fiber has +- cardinality = `sepDegree`, then `#ker φ = deg φ`. -/ ++ + theorem card_kernel_eq_degree_of_separable_witness (φ : Isogeny W₁ W₂) + [h_ker : Finite φ.kernel] (hsep : φ.IsSeparable) + (hfin : @FiniteDimensional W₂.FunctionField W₁.FunctionField _ _ +@@ -385,16 +312,7 @@ theorem sepDegree_eq_card_emb (φ : Isogeny W₁ W₂) : + AlgebraicClosure W₁.FunctionField) := + rfl + +-/-- **R2 reduction brick** (Silverman III.4.10c, embeddings half): for a +-separable, finite-dimensional isogeny `φ`, if the **embedding count equals the +-kernel count** — `φ.sepDegree = #ker φ`, i.e. +-`#(K(E₁) →ₐ[φ*K(E₂)] Ω) = #ker φ` — then `#ker φ = deg φ`. + +-This is the clean compositional consumer for the embeddings-classification +-route: `#ker φ = sepDegree φ` (hypothesis) `= deg φ` (separability, via +-`isSeparable_iff_sepDegree_eq_degree`). The substantive content is delegated +-to the hypothesis `h_count`, which is exactly the embedding↔kernel bijection +-`Emb ≃ ker φ`. -/ + theorem card_kernel_eq_degree_of_sepDegree_eq_card_kernel (φ : Isogeny W₁ W₂) + (hsep : φ.IsSeparable) + (hfin : @FiniteDimensional W₂.FunctionField W₁.FunctionField _ _ +@@ -491,9 +409,9 @@ theorem card_aut_eq_degree_of_isGalois (φ : Isogeny W₁ W₂) + (hgal : @IsGalois W₂.FunctionField _ W₁.FunctionField _ φ.toAlgebra) : + Nat.card (@AlgEquiv W₂.FunctionField W₁.FunctionField W₁.FunctionField _ _ _ + φ.toAlgebra φ.toAlgebra) = φ.degree := by +- letI := φ.toAlgebra +- haveI := hfin +- haveI := hgal ++ let := φ.toAlgebra ++ have := hfin ++ have := hgal + exact IsGalois.card_aut_eq_finrank W₂.FunctionField W₁.FunctionField + + /-- **T-III-4-015 step 4** (IsGalois from Separable + Normal): given the +@@ -510,7 +428,7 @@ theorem isGalois_of_separable_and_normal (φ : Isogeny W₁ W₂) + (h_normal : letI := φ.toAlgebra + Normal W₂.FunctionField W₁.FunctionField) : + @IsGalois W₂.FunctionField _ W₁.FunctionField _ φ.toAlgebra := by +- letI := φ.toAlgebra ++ let := φ.toAlgebra + exact isGalois_iff.mpr ⟨h_sep, h_normal⟩ + + /-- **T-III-4-015 step 4b** (IsGalois from Isogeny.IsSeparable + Normal): +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/OmegaCoeffViaFormalGroup.lean b/projects/HasseWeil/HasseWeil/Isogeny/OmegaCoeffViaFormalGroup.lean +index b4f3c844a3d84552f61642e618d4c4c2e3ea997f..ee9bf1a49bf89477daa167de9f0698966a7944f9 100644 +GIT binary patch +delta 6076 +zcmaJ_3v?9K89x7pfD9!Vfq;T=Av}_hT?h~L1ffMFCGrXq6h+KVcJJnV~qaRa|Lk=&EPeaL;?f429`E^~RjYaDxGP0r(Bd=1)Q$58kDx<436OCh$K%21hNRMJ= +z?Bz>goPBo()Lce-GE@@^@zpdL1UDVL1%3UP@tWY&c5L>yZ +zm639K4??!t`z5a>1gg-exP-ePNz(?UB%X^CR1;N1eE1RpA@G-@kxam!6u^lwaBAzevDtR^VR +zUksy0($J3E78q#DEJcHGRTrtMlH<<{^9Ekp&`4TaTVrzstT61FPV}+aPFgyz;#$7f +zL+|M~`|)5Rrp;6@iLdRN*0ipph0G%@b!)rusc|iTuRlvnw=;d%r~==%t}QMuj^qDm +z2JfJ@cueAV2f+|v2|ZvYsFp4-;kRzM@2y=dASD0-}$698%%*HdkL#VWxwcwh^H +zGTwy}HpPX5E!pRfPK?4tro=87*il782b+|bD!Pr7LVT`p1s-$a&YfhYcThN1yf8>| +z@F9HIgm;Fs&nHx|r>+?0JYT(R!1-LOoU9lnAX^!#8#L=Q)Vx$#ST0BlVa&1K4`(5H +z-~p$hz~eEDOtHb|voEDH-)a&!_!`gt9LuV0cEEXU_!Vh};}SuQ;+3&S(G><=pH~cO +zO7ScjV;h+fj}dNSk9SdpAOkeA*T+w&5jf%j%T<#C$FdlysT9~}Rdr)mqYi$IaRG#` +zUi9<8meCz4T~+lSlc2jjTt-FeDOt0h46^+nBqCX~gRbvTY06^%ocLk*_0P4&h2F1* +zlFnEpqpg#q>Cq@z;2E@$bLD8+Gm1zHXETX}BAxD=gsf>g9;zdSa6;4bmN4m=$%DZoLZyH(fk`6kjh+<5F$TFd{ +z$5|>!u+0+YUv9puse*KY>D)wY%2*0`iAQY4Xi5b>4>n?c6(Qam&B>VkF}rkANzWC8 +z8#qHCVT&>bVJ`rL|0SpzBYw)oC4Qk24o;7JG8kZ($0dvrx`EeQid7bTJa|xM +z>vgA9QdmyJ2znLcVFIbGtqrnW-t>s5n6CR3hg*tMQX|0%BSD3M8_^ijm)h4WZvsPk +z)te|dXw=KZXybeq^A{pnF|o{}Nx$OYjwnf_m^xO6y+p8Mpan$P(FZ25lMghrO$X;N +zi|wwA%NMw8XDNW4{YZtbfX?HeRwxAz%lHLqidyX<7AnoWJ^5w0iU~a_n%XJw +zj}mwc^0*MSDR(|@4oE9iR^f_9t8fNo_#O^{y^;5L0Y6G-@+0?*AHE5!#CW01CGcXH +zvtzOF4I%=qvsPQjGnF&t$6LX9-yL1SrW_dOv>j-JQcYBhZO&NqE(r>W2_4tos5Q4}Mjj`!27z0m4 +z+>bAW-wd*65@@hLoD5?})_E(hCRf+jlLnGJar5Tn8oPE1d|s8Rmk9o;^S?Dsg+=a$ +zsW5(6s3f(wUIf1#5~@kv?u+5+$e2mnop125p0V(^n%YnEv +z20iw_m%)tD@m4R1#sX@Id+F4jzZ{OjBo*eYX4BV5L1{ +zB^>YPrVFlw{WjE~5+7X&V=80q$P)>b;v|8SduRe-P}Q3n#WyT{!EMJ(yeb}Zo7cc> +zs10ulS9+oS_Knv-18RKa8mO!+w0h-Opi?*xau@`qhbYiEbMb}!%|#^MYMnV3;iVte +zi^XGn238df6~oW=bxWZ->6slnFt1AS`{{5zUKN`in}y-X^;7i(B5%pz9T^qrR8>;g +zMdS_545(yi+%zz#-AtEqf%4abo7qbtUQ0vaz)+XgG#_j+M< +zg}eNl@F2MF-UK_qez*@NxQF`SS+IBC2t({$x4`>it$kt>6x>@j!w7FL4#m2u{rB78 +zV!QTsxYUl{4sW`b-T_AkxzTUKsR3eBg-R{^8xKLV?LGu6-N9Qx8pPl0?Rk$tpMCHV +z__h1k_rW;h$VVT8mtEy?7y&h_LYyix=#oX#m&Wa1ZHJrOD|WzA?Pc81JRf-yRtL{h_CTBe?B2Ks?u``C;@s4xoJG(XN|r|bZrBo|4%tZO +zd8fibDys&SlfBp}B)V|w*1eI^(gVjSKgG$Kav}rWQ1^}nJkyBSQ{6V)Y-3ZgPDbT(mW5#RDUrcMh{t= +z!OY*0TUY!>H{g7ZwBSE6?1uf%-p9JS){wj{eDD@i%vDM@r_vR?5$nK=g2&;&rmI5; +zQ9Sj;Z9D7g?DQrWAM?bkk72{#saqYo!CQYz&yi*IF=QqkN6a05ufI&A?jN230Q(aM +z=DQdD5bg@9Z$8oFc1}~A4@LR37H>^sAkb_l_Ieow2j1LUXRhF(jgt<)L*WIu(k-jp +yaelL1tZoC2D656B?$&UMTvcAm+OQu++M`@}%f+X`Al}{RPv9K?am}+ZEb@O<2dy*! + +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/OrdTransport.lean b/projects/HasseWeil/HasseWeil/Isogeny/OrdTransport.lean +index 25e8c912a..3e6fa927e 100644 +--- a/projects/HasseWeil/HasseWeil/Isogeny/OrdTransport.lean ++++ b/projects/HasseWeil/HasseWeil/Isogeny/OrdTransport.lean +@@ -6,34 +6,25 @@ Authors: Chris Birkbeck + import HasseWeil.Foundation.EC.TranslateOrdInfty + + /-! +-# General DVR order-transport along a field hom (Silverman II.2.5, the unramified case) ++# Unramified order transport along a field homomorphism + +-This file isolates the *purely valuation-theoretic* core of the order-transport +-`ord_P (φ g) = ord_Q g` for an injective field homomorphism `φ : K(C) → K(C)` and a pair of smooth +-points `P` (source) and `Q` (target). It is the abstract DVR-transport step (Step 1 of the +-divisor-pullback brief): once one knows ++Let `φ : E → K(C)` be a field homomorphism and `P` a smooth point of `C`. ++Suppose the comap of the point valuation at `P` is equivalent to a surjective ++integer-valued valuation `v_Q` on `E`. If `ord_P (φ t) = 1` for one element `t`, ++the comap is also surjective, and the equivalent normalized valuations are equal. + +-* **(same place)** the comap valuation `(pointValuation Q).comap φ` is `Valuation.IsEquiv` to +- `pointValuation P` — i.e. `φ` carries the valuation ring of `Q` onto that of `P`; and +-* **(unramified, `e = 1`)** `ord_P (φ t) = 1` for a *single* uniformizer `t` at `Q`, ++The equivalence expresses equality of places, or valuation rings; the order-one ++condition fixes the ramification index to `1`. Together these give ++`ord_P (φ g) = ord_Q g` for every `g`. + +-the value-precise identity `ord_P (φ g) = ord_Q g` holds for **all** `g` (no ramification factor). +-The two inputs are genuinely independent: the first is "same place / same valuation ring", the +-second is the normalization `e = 1` (the ramification index), which for `[ℓ]` is the geometric +-content of separability. +- +-The main export is `comap_pointValuation_eq_of_isEquiv_of_ord_eq_one`, plus the small valuation glue +-lemmas it rests on (`Fintype`-free; the `[Fintype K]`-scoped versions they were derived from lived +-in `Hasse/L6Witnesses.lean`, which no longer exists, so these are now the only copies). +- +-Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.5–2.6, III.4.10c. ++Reference: Silverman, *The Arithmetic of Elliptic Curves*, II.2.5–2.6 and III.4.10c. + -/ + + open WeierstrassCurve HasseWeil.Curves + + namespace HasseWeil + +-variable {F : Type*} [Field F] [DecidableEq F] ++variable {F : Type*} [Field F] + + /-- A `ℤᵐ⁰`-valued valuation on a field is surjective as soon as some element takes the value + `exp (-1)`: the negative powers of that element realise every `exp (-n)`, and `0 ↦ 0`. Shared core +@@ -143,8 +134,7 @@ Let `φ : E → K(C)` be a ring hom from a field `E`, `P` a smooth point of `C`, + then `(pointValuation P).comap φ = v_Q` *as valuations* (not merely equivalent). Reading off `ord`, + this yields `ord_P (φ g) = ord_Q g` for all `g` with no ramification factor. + +-This packages Step 1 of the divisor-pullback brief: the entire affine/infinity order-transport for +-a separable isogeny reduces to discharging the two displayed inputs. -/ ++The two hypotheses separate equality of valuation rings from the order normalization. -/ + theorem comap_pointValuation_eq_of_isEquiv_of_ord_eq_one + {E : Type*} [Field E] (φ : E →+* C.FunctionField) (P : C.SmoothPoint) + (v_Q : _root_.Valuation E (WithZero (Multiplicative ℤ))) (hv_Q : Function.Surjective v_Q) +diff --git a/projects/HasseWeil/HasseWeil/Isogeny/SeparableWitnessReductions.lean b/projects/HasseWeil/HasseWeil/Isogeny/SeparableWitnessReductions.lean +index a8ca2af446a345ac435d9f954c6af5b621ff0cba..7f04d3fd4cc31b5fb8d41b6bcd3ca5f5abba841c 100644 +GIT binary patch +delta 2578 +zcmb_e&u<$=6qb`BwG&W5B_X0x`brgIBYT^KHX;!@K~jZCEszKVRp^d)$Ig)58E0lU +zjg63VsG|1Da)3jnUbw&oVZSbwl^dMkb3fZcK7}G-uHcP +zzxlQB;BMjDy+Zp9xkVMH!eeFFU`nt6G;cAW!Ur9zkC_+oEgm&N)2EOxg&6=;Nb3Ou)pKlD6ZPyu?N}(xy2M70uAb{swnr`-~|%%FcY6bjSC(z +z{9%D#CYXXL?o}F+iwGh`g$`)Mr2wy2HSn+zU?KS<48<@}6Kb)*@};QQfWQJ4G7&js +zDbk>rjuda(`w+=)^SLY<0cfPbZG)nV6vUeOz=iGm8Vw}Z#G`>1XVqbT^FjuvN0rY7 +z4G=^JR#FJL`Bw%Z+bXnoEK)SzVd~TcOJ{HewO$^Sl-+oxQ&7<|)5Srk# +zx?&8|m128dtSkUGtD-0;IVh&ZC*r4y(&aa=-*7E=-qANel% +z@`Zb=s|aA7$&lfYJfP{A3`aypzNV=-j3XR<+J2566xm|mxBLOipE=?t17{}M4w%r? +zH=u6eMH<4&(7yIR7*5>%JGWM#xWD_+E6^&zJlLxuo_?~w3oD=E +zp=%PJNPcizE-9|?00j~bA)00^IEPX)H12eMzxYF;u$p{zshGSxc6OpnsMc|4dg3UV +z!+Pv%FnMS6T%pt%8Xp>Huja;JIg+U$)o_h(r|?1}4uUH6HUOWmGl#4iPUjh#7j%_* +z6g3Af_PK$LPo~b2(<)#tL&ay29jOwmSfXaAwnSLxyBso@f-Eu`k5R9KX+a01e6&9&{c#KcBuLLmt7+H<`zM+`>63~yx;g4;2}0P025KG~M(_<{sr}^GlWmTk?R8x* +zQ&Jbhu1{}AOlaft#)#M^+EccHj4+Ru05A0nFm>ZfUCFp{$Rd-o%fp?*!q-nd;TB`7 +z_W&a0*5ku%(R{R468>HP9BEE!9U7(&``z4dB#0IY*$;B +zv1k9u!?n>7>@9Px%(SjJQKF{KPj&tX<4Qw^J9^sm7eSMTeHU +zi=QT6z~k=`hMU*dTx;gZgf~8G|J89tn9qR2-$D3R-$V1&;BKp?0POgs!S+dFIHs?SMns6v} +zn-IvP#C8lM&Z(d3riKD?i9=1zqYuZCAx)scx}EA~R(~MJ +zRq71upnQ)Y*MPH4q>p*Y0N3@<4ud49ouZzDp~0Z3a3!;88(CcH#v&0^)1^dn5}6cg +zhLN>R)9xeRWo9pRQkvC7Iyz#rV{L6in`ZO2+3K|;HaFJRntPfTn?1CN-zj#^GJ;uSd!l7J%o{`Slhk^t +zoU-^T@H=mLSngc>^!4-4BSuzhBAVns*tBMrrE9OkE&RDQ9Quppco>uzFD_XHkJjZU_&7a +zByeX`u35P+%%8fxUha-R8j_Xwdmz8v`62MV`gy*?Xb|YSm3%y%FPGDIK^$m+$)c(S +zCWcMwiN|k&+8TTy3l|ChoD#Y=jUz<&Pz5`F8y7OU&n=B$h|W0g)5`ZJ+xY|R=mgSmuR>Hv7DgJ&V3l08_C(3l5iX)6P8Oj& +zG1veN{HR$aH``S(BE+%uxX?%!KXH$Zbj&ZiMTy2=*KgvBcU8+%+m|Wl5OH-Z)bR8A +z41R9cUi8$>@~vmWVa`uakPp6C163+T$wN!2&J3;Fq<5?n?+?HX>HO>@-1vWYWYr^B +znGv~o_vd9Ra<_R;sheVy;JuSF>@uFCxo*4ajj;~*j(oEuoiWc|(t~}EiVp{XNcQvc +z@F+w6`oIUpIKOC0v(={-< +zD)G8AljZmRylu2CoqVP`v~a{|J@ge~z|WqWByT_a!YDw=v*-R^^7S>6zxnu$(l1KU +zEf@Y(9NvwWR+dit(wxj?_Q_BG0sQj6_hTv?lE3=Azrx>94!gp_84G)$UBt%0)G2B} +zxugq+AQ}3>3%Tjmt|oey-!%@N4+@K4cyOX0p9Ir@$Bh-LviMuijQ7Xf2q#10Z?*8J +zpe=ne4TiSW!EOHcZ-T#q_(eS|^`D#te}qXRHi>)qzymYIdo!RcXk0-XQ{8LI$lXiz +z_G_JQuJ~aT>cz{AP${Y#VUU08_FDeR+J*f5+T~*FH(;R;G5Bc2mLqCf;pIX})c50L +zB*8|3(>HCqIJEPtj+;p}V>#=T6istAB64d@VVpdM?!_0nc|~$(CTmMgNdMKrnqnrYW>5H!@I-4Id1>O&9EKH +zn@MA1S7MFWGzhc&El;zeSW4;Pef8cr8Q3USe;VUKn +zhCR?zRHGswJ+u!h%L=;I`Dn$0qIaciy=XoGr-y0OS*zdqOE_LE7#W+ynh&7Dzw|rU +zQ7W#ShD+kE_hCyB<1o$LLolmY%;8ID>)^-mo^nw%)a8gn7vTnf!aw1;kbmGJRENdW +N7opyde+tJ#{{ctriJ1TZ + +diff --git a/projects/HasseWeil/HasseWeil/Pic0/ClassGroupNorm.lean b/projects/HasseWeil/HasseWeil/Pic0/ClassGroupNorm.lean +index a3e70337f..dec8deca0 100644 +--- a/projects/HasseWeil/HasseWeil/Pic0/ClassGroupNorm.lean ++++ b/projects/HasseWeil/HasseWeil/Pic0/ClassGroupNorm.lean +@@ -4,7 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Chris Birkbeck + -/ + import Mathlib.LinearAlgebra.FreeModule.Norm +-import Mathlib.NumberTheory.RamificationInertia.Basic ++import Mathlib.RingTheory.RamificationInertia.Basic ++import Mathlib.NumberTheory.RamificationInertia.Inertia ++import Mathlib.NumberTheory.RamificationInertia.Ramification ++import Mathlib.RingTheory.Ideal.Norm.AbsNorm ++import Mathlib.RingTheory.SimpleModule.Basic + import Mathlib.RingTheory.ClassGroup.Basic + import Mathlib.RingTheory.Ideal.Norm.RelNorm + import Mathlib.RingTheory.Localization.AtPrime.Extension +@@ -33,8 +37,8 @@ open scoped nonZeroDivisors + namespace HasseWeil + + variable {R S : Type*} +-variable [CommRing R] [IsDomain R] [IsIntegrallyClosed R] [IsDedekindDomain R] +-variable [CommRing S] [IsDomain S] [IsIntegrallyClosed S] [IsDedekindDomain S] ++variable [CommRing R] [IsDedekindDomain R] ++variable [CommRing S] [IsDedekindDomain S] + variable [Algebra R S] [Module.Finite R S] [Module.IsTorsionFree R S] + + /-- The relative norm of an integral ideal, packaged as a homomorphism of `nonZeroDivisors` +@@ -74,14 +78,14 @@ theorem mk0CompRelNorm0_eq_of_mk0_eq {I J : (Ideal S)⁰} + -- Provide the (deliberately non-instance) lift algebra on the fraction fields, so that + -- `Algebra.intNorm_ne_zero` (which assumes `FiniteDimensional (FractionRing R) (FractionRing S)`) + -- is available. +- letI : Algebra (FractionRing R) (FractionRing S) := ++ let : Algebra (FractionRing R) (FractionRing S) := + FractionRing.liftAlgebra R (FractionRing S) +- haveI : IsScalarTower R (FractionRing R) (FractionRing S) := ++ have : IsScalarTower R (FractionRing R) (FractionRing S) := + FractionRing.isScalarTower_liftAlgebra R (FractionRing S) +- haveI : IsLocalization (Algebra.algebraMapSubmonoid S R⁰) (FractionRing S) := ++ have : IsLocalization (Algebra.algebraMapSubmonoid S R⁰) (FractionRing S) := + IsIntegralClosure.isLocalization R (FractionRing R) (FractionRing S) S +- haveI : IsScalarTower R S (FractionRing S) := IsScalarTower.of_algebraMap_eq fun _ ↦ rfl +- haveI : FiniteDimensional (FractionRing R) (FractionRing S) := ++ have : IsScalarTower R S (FractionRing S) := IsScalarTower.of_algebraMap_eq fun _ ↦ rfl ++ have : FiniteDimensional (FractionRing R) (FractionRing S) := + Module.Finite.of_isLocalization R S R⁰ + rw [ClassGroup.mk0_eq_mk0_iff] at h + obtain ⟨x, y, hx, hy, hxy⟩ := h +@@ -177,30 +181,21 @@ transports `e`, `f` across the localisation, leaving only the relative-norm/loca + compatibility — see the residual note after `Ideal.relNorm_eq_under_of_inertiaDeg_one`.) -/ + + -- The `S/R` fraction-field tower + residue-degree `finrank` bookkeeping need elaboration room. +-/-- **`relNorm 𝔪 = p ^ inertiaDeg' p 𝔪` over a local base extension, unconditionally** (no +-`PerfectField`). For a **local** Dedekind domain `S` (a DVR) module-finite over a Dedekind domain +-`R`, with `𝔪 = IsLocalRing.maximalIdeal S` lying over a maximal `p ≠ ⊥` of `R`, the relative norm +-of `𝔪` is `p ^ inertiaDeg' p 𝔪`. +- +-Proof (see the section note): `p · S = 𝔪^e` (unique prime, via +-`Ideal.map_algebraMap_eq_finset_prod_pow` + `IsLocalRing.primesOver_eq`); applying `relNorm` and +-`Ideal.relNorm_algebraMap` gives `(relNorm 𝔪)^e = p^{e·f}` using +-`Ideal.ramificationIdx_mul_inertiaDeg_of_isLocalRing` (`e·f = [Frac S : Frac R]`); writing +-`relNorm 𝔪 = p^s` (`Ideal.exists_relNorm_eq_pow_of_isPrime`) and cancelling the prime power +-(`pow_injective_of_not_isUnit`) pins `s = f`. **No separability / Galois / `PerfectField`.** -/ ++ ++ + theorem Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing + {R S : Type*} +- [CommRing R] [IsDomain R] [IsIntegrallyClosed R] [IsDedekindDomain R] +- [CommRing S] [IsDomain S] [IsIntegrallyClosed S] [IsDedekindDomain S] [IsLocalRing S] ++ [CommRing R] [IsDedekindDomain R] ++ [CommRing S] [IsDedekindDomain S] [IsLocalRing S] + [Algebra R S] [Module.Finite R S] [Module.IsTorsionFree R S] + {p : Ideal R} [p.IsMaximal] (hp0 : p ≠ ⊥) + [(IsLocalRing.maximalIdeal S).LiesOver p] : + Ideal.relNorm R (IsLocalRing.maximalIdeal S) = +- p ^ p.inertiaDeg' (IsLocalRing.maximalIdeal S) := by ++ p ^ (IsLocalRing.maximalIdeal S).inertiaDeg R := by + set m := IsLocalRing.maximalIdeal S with hm + set e := Ideal.ramificationIdx' p m with he_def +- set f := p.inertiaDeg' m with hf_def +- haveI : m.IsMaximal := IsLocalRing.maximalIdeal.isMaximal S ++ set f := m.inertiaDeg R with hf_def ++ have : m.IsMaximal := IsLocalRing.maximalIdeal.isMaximal S + have he0 : e ≠ 0 := Ideal.IsDedekindDomain.ramificationIdx'_ne_zero_of_liesOver m hp0 + -- `p · S = 𝔪^e` (the *unique* prime over `p`, so the factorisation is a single term). + have hmap : Ideal.map (algebraMap R S) p = m ^ e := by +@@ -217,15 +212,23 @@ theorem Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing + (by rw [← IsLocalRing.primesOver_eq S hp0, ← Set.mem_toFinset]; exact hb)) hne + · intro h + exact absurd (by rw [Set.mem_toFinset, IsLocalRing.primesOver_eq S hp0]; rfl) h +- -- `e · f = [Frac S : Frac R]` (the fundamental identity; *no* separability hypothesis). +- letI : Algebra (FractionRing R) (FractionRing S) := FractionRing.liftAlgebra R _ +- haveI : IsScalarTower R (FractionRing R) (FractionRing S) := +- FractionRing.isScalarTower_liftAlgebra R _ +- haveI : IsScalarTower R S (FractionRing S) := IsScalarTower.of_algebraMap_eq fun _ ↦ rfl +- -- `relNorm_algebraMap`'s exponent is `finrank R S`, so transport `e·f` down the fraction fields. +- have hef : e * f = Module.finrank R S := +- (Ideal.ramificationIdx_mul_inertiaDeg_of_isLocalRing S (FractionRing R) (FractionRing S) +- hp0).trans (IsFractionRing.finrank_eq R (FractionRing R) S (FractionRing S)) ++ have hef : e * f = Module.finrank R S := by ++ classical ++ let : Unique (p.primesOver S) := ++ { default := ⟨m, by ++ rw [IsLocalRing.primesOver_eq S hp0] ++ exact Set.mem_singleton m⟩ ++ uniq q := Subtype.ext (by ++ have hq : (q : Ideal S) ∈ ({m} : Set (Ideal S)) := by ++ simpa only [IsLocalRing.primesOver_eq S hp0] using q.2 ++ exact Set.mem_singleton_iff.mp hq) } ++ have h := Ideal.sum_ramification_inertia_eq_finrank p S ++ have hd : ((default : p.primesOver S) : Ideal S) = m := by ++ have hq : ((default : p.primesOver S) : Ideal S) ∈ ({m} : Set (Ideal S)) := by ++ simpa only [IsLocalRing.primesOver_eq S hp0] using (default : p.primesOver S).2 ++ exact Set.mem_singleton_iff.mp hq ++ simpa only [Fintype.sum_unique, hd, ++ ← Ideal.ramificationIdx'_eq_ramificationIdx p m hp0] using h + -- `(relNorm 𝔪)^e = relNorm(𝔪^e) = relNorm(p · S) = p^{[Frac S:Frac R]} = p^{e·f}`. + have h3 : (Ideal.relNorm R m) ^ e = p ^ (e * f) := by + rw [← map_pow, ← hmap, Ideal.relNorm_algebraMap, hef] +@@ -233,7 +236,7 @@ theorem Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing + obtain ⟨s, hs⟩ := Ideal.exists_relNorm_eq_pow_of_isPrime m p + rw [hs, ← pow_mul] at h3 + have hpr : Prime p := (Ideal.prime_iff_isPrime hp0).mpr inferInstance +- have hse : s * e = e * f := pow_injective_of_not_isUnit hpr.not_unit hpr.ne_zero h3 ++ have hse : s * e = e * f := pow_injective_of_not_isUnit hpr.not_isUnit hpr.ne_zero h3 + have hsf : s = f := + Nat.eq_of_mul_eq_mul_right (Nat.pos_of_ne_zero he0) (by rw [hse]; ring) + rw [hs, hsf] +@@ -245,16 +248,15 @@ collapses (`pow_one`) and `p = 𝔪.under R`, giving `relNorm R 𝔪 = 𝔪.unde + S) 𝔪`) with **no** separability hypothesis. -/ + theorem Ideal.relNorm_maximalIdeal_eq_under_of_inertiaDeg_one_of_isLocalRing + {R S : Type*} +- [CommRing R] [IsDomain R] [IsIntegrallyClosed R] [IsDedekindDomain R] +- [CommRing S] [IsDomain S] [IsIntegrallyClosed S] [IsDedekindDomain S] [IsLocalRing S] ++ [CommRing R] [IsDedekindDomain R] ++ [CommRing S] [IsDedekindDomain S] [IsLocalRing S] + [Algebra R S] [Module.Finite R S] [Module.IsTorsionFree R S] + (hp0 : (IsLocalRing.maximalIdeal S).under R ≠ ⊥) +- (hf : Ideal.inertiaDeg' ((IsLocalRing.maximalIdeal S).under R) +- (IsLocalRing.maximalIdeal S) = 1) : ++ (hf : (IsLocalRing.maximalIdeal S).inertiaDeg R = 1) : + Ideal.relNorm R (IsLocalRing.maximalIdeal S) = (IsLocalRing.maximalIdeal S).under R := by +- haveI : ((IsLocalRing.maximalIdeal S).under R).IsMaximal := ++ have : ((IsLocalRing.maximalIdeal S).under R).IsMaximal := + Ideal.IsMaximal.under R (IsLocalRing.maximalIdeal S) +- haveI : (IsLocalRing.maximalIdeal S).LiesOver ((IsLocalRing.maximalIdeal S).under R) := ++ have : (IsLocalRing.maximalIdeal S).LiesOver ((IsLocalRing.maximalIdeal S).under R) := + Ideal.over_under _ + rw [Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing hp0, hf, pow_one] + +@@ -271,19 +273,10 @@ The key observation is that `Algebra.intNorm A B x` is defined as the restrictio + `B`, not on the integral model `B`. Hence two integral models `B`, `B'` of the same field extension + have the same `intNorm`, and therefore the same `relNorm` on corresponding ideals. -/ + +-/-- **`intNorm` depends only on the common fraction field.** If `B` and `B'` are integrally closed +-domains, both integral over `A` and both having `L` as a common fraction field over `K = Frac A` +-(with `B → B'` compatible), then `intNorm A B x = intNorm A B' (algebraMap B B' x)`. + +-This is `Algebra.algebraMap_intNorm` (`algebraMap A K (intNorm A B x) = norm K (algebraMap B L x)`) +-applied to both `B` and `B'` with the **same** ambient field `L`: the two field norms coincide +-because `algebraMap B L = algebraMap B' L ∘ algebraMap B B'` (the scalar tower `B → B' → L`). +-No module-finiteness of `B'` over `A` is required (only finiteness at the fraction-field level +-`[FiniteDimensional K L]`), which is why this survives the passage to a non-finite localisation. -/ + theorem intNorm_eq_intNorm_of_common_fractionField + {A K L B B' : Type*} +- [CommRing A] [IsDomain A] [IsIntegrallyClosed A] +- [Field K] [Algebra A K] [IsFractionRing A K] ++ [CommRing A] [IsDomain A] [IsIntegrallyClosed A] [Field K] [Algebra A K] [IsFractionRing A K] + [Field L] [Algebra K L] [Algebra A L] [IsScalarTower A K L] [FiniteDimensional K L] + [CommRing B] [IsDomain B] [IsIntegrallyClosed B] [Algebra A B] [Algebra.IsIntegral A B] + [Module.IsTorsionFree A B] [Algebra B L] [IsScalarTower A B L] [IsIntegralClosure B A L] +@@ -297,32 +290,17 @@ theorem intNorm_eq_intNorm_of_common_fractionField + congr 1 + rw [← IsScalarTower.algebraMap_apply B B' L] + +-/-- **`relNorm` is unchanged under top-localisation of a principal prime.** If `B` is a Dedekind +-**PID** (e.g. the semilocal localisation `Sₚ`), `Q` a principal ideal of `B`, and `B'` an +-integrally closed domain sharing the fraction field `L = Frac B`, then +-`relNorm A Q = relNorm A (Q.map (B → B'))`. +- +-The proof writes `Q = span{π}` (principal), so `relNorm A Q = span{intNorm A B π}` and +-`relNorm A (Q.map) = span{intNorm A B' (algebraMap π)}` (`relNorm_singleton`, `Ideal.map_span`), +-and the two generators agree by `intNorm_eq_intNorm_of_common_fractionField`. +- +-**Caveat.** `Ideal.relNorm A B'` is only well-typed under `[Module.Finite A B']` (mathlib's +-`relNorm`/`spanNorm` carry this in their definition). This is exactly why this bridge does **not** +-discharge the general-base residual: the intended `B' = Localization.AtPrime Q` (a DVR isolating one +-of several primes over `p`) is **not** module-finite over `A = Rₚ` when several primes lie over `p`, +-so the right-hand side is ill-typed there. It applies when finiteness is preserved — e.g. when `Q` +-is the *unique* prime over `p` (`finite_of_primesOver_eq_singleton`), which is the already-handled +-local case `Ideal.relNorm_maximalIdeal_eq_pow_inertiaDeg_of_isLocalRing`. -/ ++ + theorem relNorm_eq_relNorm_localization + {A K L B B' : Type*} +- [CommRing A] [IsDomain A] [IsIntegrallyClosed A] [IsDedekindDomain A] ++ [CommRing A] [IsDedekindDomain A] + [Field K] [Algebra A K] [IsFractionRing A K] + [Field L] [Algebra K L] [Algebra A L] [IsScalarTower A K L] [FiniteDimensional K L] +- [CommRing B] [IsDomain B] [IsIntegrallyClosed B] [IsDedekindDomain B] ++ [CommRing B] [IsDedekindDomain B] + [Algebra A B] [Algebra.IsIntegral A B] [Module.Finite A B] + [Module.IsTorsionFree A B] [Algebra B L] [IsScalarTower A B L] [IsIntegralClosure B A L] + [IsPrincipalIdealRing B] +- [CommRing B'] [IsDomain B'] [IsIntegrallyClosed B'] [IsDedekindDomain B'] ++ [CommRing B'] [IsDedekindDomain B'] + [Algebra A B'] [Algebra.IsIntegral A B'] [Module.Finite A B'] [Module.IsTorsionFree A B'] + [Algebra B' L] [IsScalarTower A B' L] [IsIntegralClosure B' A L] + [Algebra B B'] [IsScalarTower A B B'] [IsScalarTower B B' L] +@@ -351,8 +329,7 @@ This reduces the `PerfectField` gate to the **single** residual stated in + hypothesis `hlocal` — the per-prime relative norm over a DVR base (see the residual note after + `Ideal.relNorm_eq_under_of_inertiaDeg_one`). -/ + +-omit [IsDomain R] [IsIntegrallyClosed R] [IsDedekindDomain R] [IsDomain S] +- [IsIntegrallyClosed S] [IsDedekindDomain S] [Module.IsTorsionFree R S] in ++omit [IsDedekindDomain R] [IsDedekindDomain S] [Module.IsTorsionFree R S] in + /-- **The extension of `𝔭` to a localisation away from `𝔭.under` is `⊤`.** If the maximal prime + `q` of `R` differs from `p = P.under R`, then `p ⊄ q`, so an element `a ∈ p ⊆ P` lands outside `q`, + hence becomes a unit in `Sₚ = Localization (algebraMapSubmonoid S q.primeCompl)`; since +@@ -361,7 +338,7 @@ of `relNorm_eq_under_of_localized`.) -/ + theorem map_eq_top_of_under_ne (P : Ideal S) (q : Ideal R) [hq : q.IsMaximal] [P.IsMaximal] + (hne : P.under R ≠ q) : + P.map (algebraMap S (Localization (Algebra.algebraMapSubmonoid S q.primeCompl))) = ⊤ := by +- haveI : (P.under R).IsMaximal := Ideal.IsMaximal.under R P ++ have : (P.under R).IsMaximal := Ideal.IsMaximal.under R P + obtain ⟨a, hap, haq⟩ : ∃ a, a ∈ P.under R ∧ a ∉ q := by + by_contra h; push Not at h + exact hne (((Ideal.IsMaximal.under R P).eq_of_le hq.ne_top h)) +@@ -374,7 +351,7 @@ theorem map_eq_top_of_under_ne (P : Ideal S) (q : Ideal R) [hq : q.IsMaximal] [P + exact (P.map _).eq_top_of_isUnit_mem (Ideal.mem_map_of_mem _ haP) hunit ▸ Submodule.mem_top + + -- The semilocal `Sₚ` Dedekind/finite/torsion-free instance bundle over the DVR `Rₚ` pushes instance +--- synthesis (e.g. `IsDomain Sₚ`) past the default budget at statement elaboration. ++ + /-- **The relative norm localises (top + bottom) at a maximal prime `q` of `R`.** Pushing + `relNorm R P` along `R → Rₚ := Localization.AtPrime q` equals the relative norm over `Rₚ` of the + extension of `P` to the semilocal `Sₚ = Localization (algebraMapSubmonoid S q.primeCompl)`. +@@ -417,8 +394,8 @@ theorem relNorm_eq_under_of_localized (P : Ideal S) [P.IsMaximal] (hP : P ≠ + (P.map (algebraMap S (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)))) + = IsLocalRing.maximalIdeal (Localization.AtPrime (P.under R))) : + Ideal.relNorm R P = P.under R := by +- haveI : (P.under R).IsMaximal := Ideal.IsMaximal.under R P +- haveI hpne : NeZero (P.under R) := ⟨Ideal.under_ne_bot R hP⟩ ++ have : (P.under R).IsMaximal := Ideal.IsMaximal.under R P ++ have hpne : NeZero (P.under R) := ⟨Ideal.under_ne_bot R hP⟩ + have hnotfield : ¬ IsField R := + Ring.not_isField_of_ne_of_ne (Ideal.under_ne_bot R hP) (Ideal.IsMaximal.ne_top inferInstance) + refine Ideal.eq_of_localization_maximal (fun q hq ↦ ?_) +@@ -426,39 +403,15 @@ theorem relNorm_eq_under_of_localized (P : Ideal S) [P.IsMaximal] (hP : P ≠ + · subst hqp + rw [relNorm_map_localization P (P.under R), hlocal, + Localization.AtPrime.map_eq_maximalIdeal] +- · haveI : NeZero q := ⟨Ring.ne_bot_of_isMaximal_of_not_isField hq hnotfield⟩ ++ · have : NeZero q := ⟨Ring.ne_bot_of_isMaximal_of_not_isField hq hnotfield⟩ + rw [relNorm_map_localization P q, map_eq_top_of_under_ne P q hqp, Ideal.relNorm_top, + IsLocalization.AtPrime.map_eq_top_of_not_le _ (fun hle ↦ hqp + ((Ideal.IsMaximal.under R P).eq_of_le hq.ne_top hle))] + +-/-! #### The per-prime relative norm over a DVR base — the `PerfectField`-free residual, **CLOSED** +- +-The single remaining input of `relNorm_eq_under_of_localized` — the per-prime relative norm +-`relNorm Rₚ 𝔮 = maximalIdeal Rₚ` over a **DVR** base `Rₚ` at residue degree one — is discharged +-here, +-**without `PerfectField`**, via the **module-length** route (no residue *field* structure on the +-base, +-so no `Field (Rₚ ⧸ m)` instance diamond). +- +-The engine is the `Rₚ`-module-length identity over a **PID** base (`Rₚ` is a DVR, hence a PID): +-for a nonzero principal `Q = (π)` of a free-finite `Rₚ`-algebra `Sₚ`, +- +- `length_{Rₚ}(Sₚ ⧸ Q) = length_{Rₚ}(Rₚ ⧸ relNorm Rₚ Q)` (`relNorm_length_eq_span`), +- +-proved by Smith normal form (`Ideal.quotientEquivPiSpan` is `Rₚ`-linear) + additivity of the order +-of +-vanishing (`Ring.ord_mul`, `Ideal.relNorm_singleton`, `Algebra.intNorm_eq_norm`, +-`associated_norm_prod_smith`). When `f = inertiaDeg' = 1`, `Sₚ ⧸ Q` is a **simple** `Rₚ`-module +-(`isSimpleModule_quot_of_inertiaDeg_one`: the residue algebra map `Rₚ → Sₚ ⧸ Q` is onto, so +-`Sₚ ⧸ Q ≃ₗ[Rₚ] Rₚ ⧸ m`), hence `length = 1`; the identity then forces `Rₚ ⧸ relNorm Rₚ Q` to be +-simple, +-i.e. `relNorm Rₚ Q` maximal, i.e. `= m` (`IsLocalRing.eq_maximalIdeal`). **No Galois, no +-`PerfectField`.** -/ + + /-- **Additivity of the order of vanishing over a finite product** (`Ring.ord_mul`, iterated). For + nonzero `cᵢ` in a commutative domain, `ord (∏ cᵢ) = ∑ ord cᵢ`. -/ +-theorem Ring.ord_finset_prod {A : Type*} [CommRing A] [IsDomain A] +- {ι : Type*} (s : Finset ι) (c : ι → A) (hc : ∀ i ∈ s, c i ≠ 0) : ++theorem Ring.ord_finset_prod {A : Type*} [CommRing A] [IsDomain A] {ι : Type*} (s : Finset ι) (c : ι → A) (hc : ∀ i ∈ s, c i ≠ 0) : + Ring.ord A (∏ i ∈ s, c i) = ∑ i ∈ s, Ring.ord A (c i) := by + classical + induction s using Finset.induction with +@@ -469,18 +422,11 @@ theorem Ring.ord_finset_prod {A : Type*} [CommRing A] [IsDomain A] + rw [mem_nonZeroDivisors_iff_ne_zero] + exact Finset.prod_ne_zero_iff.mpr (fun i hi ↦ hc i (Finset.mem_insert_of_mem hi)) + +-/-- **Norm–length identity over a PID base.** For a free-finite algebra `Sₚ` over a PID `Rₚ` +-(integrally closed domains), and a nonzero element `π`, the `Rₚ`-module length of `Sₚ ⧸ (π)` equals +-the `Rₚ`-module length of `Rₚ ⧸ relNorm Rₚ (π)`. + +-Proof: `relNorm Rₚ (π) = (Algebra.norm Rₚ π)` (`relNorm_singleton`, `intNorm_eq_norm`), whose order +-of vanishing is `∑ᵢ length(Rₚ ⧸ (cᵢ))` for the Smith coefficients `cᵢ` +-(`associated_norm_prod_smith`, `Ring.ord_finset_prod`, `Ring.ord = length(·⧸·)`); the same sum is +-`length(Sₚ ⧸ (π))` by the `Rₚ`-linear `Ideal.quotientEquivPiSpan` + `length_pi_of_fintype`. -/ + theorem relNorm_length_eq_span + {Rp Sp : Type*} + [CommRing Rp] [IsDomain Rp] [IsPrincipalIdealRing Rp] [IsIntegrallyClosed Rp] +- [CommRing Sp] [IsDomain Sp] [IsIntegrallyClosed Sp] [IsDedekindDomain Sp] ++ [CommRing Sp] [IsDedekindDomain Sp] + [Algebra Rp Sp] [Module.Finite Rp Sp] [Module.IsTorsionFree Rp Sp] + (π : Sp) (hπ0 : π ≠ 0) : + Module.length Rp (Rp ⧸ Ideal.relNorm Rp (Ideal.span {π})) = +@@ -510,30 +456,23 @@ theorem relNorm_length_eq_span + -- The explicit residue-field algebra structure (built on the `Ideal.Quotient.field`-derived + -- semiring + -- via `algebraQuotientOfLEComap`) keeps the surjectivity/`finrank` bookkeeping in elaboration +--- budget ++ + -- *without* the `algebraOfLiesOver` instance-diamond (which carries free metavariables). +-/-- **`Sₚ ⧸ Q` is a simple `Rₚ`-module at residue degree one** (the diamond-free `f = 1` input). For +-a maximal ideal `Q` of `Sₚ` lying over a maximal `m` of `Rₚ` with `inertiaDeg' m Q = 1`, the residue +-algebra map `Rₚ → Sₚ ⧸ Q` is **surjective** with kernel `m` (the residue extension is trivial), so +-`Sₚ ⧸ Q ≃ₗ[Rₚ] Rₚ ⧸ m`, a simple `Rₚ`-module. +- +-Diamond-free: the residue `Field (Rₚ ⧸ m)` and the residue algebra `Algebra (Rₚ ⧸ m) (Sₚ ⧸ Q)` are +-introduced together by `algebraQuotientOfLEComap` on the **same** field-derived semiring, so the +-`FiniteDimensional`/`finrank` synthesis never disagrees with `inertiaDeg'`'s +-`Module (Rₚ ⧸ m) (Sₚ ⧸ Q)`. -/ ++ ++ + theorem isSimpleModule_quot_of_inertiaDeg_one + {Rp Sp : Type*} [CommRing Rp] [CommRing Sp] [Algebra Rp Sp] + (Q : Ideal Sp) [hQ : Q.IsMaximal] (m : Ideal Rp) [hm : m.IsMaximal] +- [hlo : Q.LiesOver m] (hf : Ideal.inertiaDeg' m Q = 1) : ++ [hlo : Q.LiesOver m] (hf : Q.inertiaDeg Rp = 1) : + IsSimpleModule Rp (Sp ⧸ Q) := by +- letI : Field (Rp ⧸ m) := Ideal.Quotient.field m +- letI alg : Algebra (Rp ⧸ m) (Sp ⧸ Q) := ++ let : Field (Rp ⧸ m) := Ideal.Quotient.field m ++ let alg : Algebra (Rp ⧸ m) (Sp ⧸ Q) := + Ideal.Quotient.algebraQuotientOfLEComap (le_of_eq (Q.over_def m)) +- haveI hst : IsScalarTower Rp (Rp ⧸ m) (Sp ⧸ Q) := IsScalarTower.of_algebraMap_eq' rfl ++ have hst : IsScalarTower Rp (Rp ⧸ m) (Sp ⧸ Q) := IsScalarTower.of_algebraMap_eq' rfl + have hfr : Module.finrank (Rp ⧸ m) (Sp ⧸ Q) = 1 := by +- rw [← Ideal.inertiaDeg'_algebraMap m Q]; exact hf +- haveI : Nontrivial (Sp ⧸ Q) := Ideal.Quotient.nontrivial_iff.mpr hQ.ne_top +- haveI : FiniteDimensional (Rp ⧸ m) (Sp ⧸ Q) := Module.finite_of_finrank_eq_succ hfr ++ rw [← Ideal.inertiaDeg_eq_of_isMaximal m Q]; exact hf ++ have : Nontrivial (Sp ⧸ Q) := Ideal.Quotient.nontrivial_iff.mpr hQ.ne_top ++ have : FiniteDimensional (Rp ⧸ m) (Sp ⧸ Q) := Module.finite_of_finrank_eq_succ hfr + have hsurj' : Function.Surjective (algebraMap (Rp ⧸ m) (Sp ⧸ Q)) := by + have hinj : Function.Injective (Algebra.linearMap (Rp ⧸ m) (Sp ⧸ Q)) := + (algebraMap (Rp ⧸ m) (Sp ⧸ Q)).injective +@@ -556,32 +495,23 @@ theorem isSimpleModule_quot_of_inertiaDeg_one + exact ⟨m, hm, ⟨(LinearMap.quotKerEquivOfSurjective _ hsurjRp).symm.trans + (Submodule.quotEquivOfEq _ _ hker)⟩⟩ + +--- The module-length chain over the DVR base (Smith + `Ring.ord` additivity + simplicity) needs ++ + -- room. +-/-- **The per-prime relative norm over a DVR base at residue degree one** (the `PerfectField`-free +-residual, **CLOSED**). For a DVR `Rₚ` (a local PID), a Dedekind PID `Sₚ` free-finite torsion-free +-over `Rₚ`, and a nonzero maximal ideal `Q` of `Sₚ` lying over `m = maximalIdeal Rₚ` with +-`inertiaDeg' m Q = 1`, the relative norm `relNorm Rₚ Q = m`. +- +-Proof (module-length, **no** residue-field instance, **no** Galois/`PerfectField`): +-`Sₚ ⧸ Q` is `Rₚ`-simple (`isSimpleModule_quot_of_inertiaDeg_one`), so `length_{Rₚ}(Sₚ ⧸ Q) = 1`; the +-norm–length identity `relNorm_length_eq_span` transports this to +-`length_{Rₚ}(Rₚ ⧸ relNorm Rₚ Q) = 1`, +-making `Rₚ ⧸ relNorm Rₚ Q` simple, i.e. `relNorm Rₚ Q` maximal, hence `= m` +-(`IsLocalRing.eq_maximalIdeal`). -/ ++ ++ + theorem relNorm_eq_maximalIdeal_of_inertiaDeg_one + {Rp Sp : Type*} + [CommRing Rp] [IsDomain Rp] [IsPrincipalIdealRing Rp] [IsIntegrallyClosed Rp] [IsLocalRing Rp] +- [CommRing Sp] [IsDomain Sp] [IsIntegrallyClosed Sp] [IsDedekindDomain Sp] ++ [CommRing Sp] [IsDedekindDomain Sp] + [IsPrincipalIdealRing Sp] + [Algebra Rp Sp] [Module.Finite Rp Sp] [Module.IsTorsionFree Rp Sp] + (Q : Ideal Sp) [hQ : Q.IsMaximal] (hQ0 : Q ≠ ⊥) + [hlo : Q.LiesOver (IsLocalRing.maximalIdeal Rp)] +- (hf : Ideal.inertiaDeg' (IsLocalRing.maximalIdeal Rp) Q = 1) : ++ (hf : Q.inertiaDeg Rp = 1) : + Ideal.relNorm Rp Q = IsLocalRing.maximalIdeal Rp := by + set m := IsLocalRing.maximalIdeal Rp with hm +- haveI : m.IsMaximal := IsLocalRing.maximalIdeal.isMaximal Rp +- haveI hsimp : IsSimpleModule Rp (Sp ⧸ Q) := isSimpleModule_quot_of_inertiaDeg_one Q m hf ++ have : m.IsMaximal := IsLocalRing.maximalIdeal.isMaximal Rp ++ have hsimp : IsSimpleModule Rp (Sp ⧸ Q) := isSimpleModule_quot_of_inertiaDeg_one Q m hf + have hlen1 : Module.length Rp (Sp ⧸ Q) = 1 := Module.length_eq_one Rp (Sp ⧸ Q) + obtain ⟨π, hπ⟩ := (IsPrincipalIdealRing.principal Q).principal + have hπ0 : π ≠ 0 := by rintro rfl; apply hQ0; rw [hπ]; simp +@@ -595,8 +525,7 @@ theorem relNorm_eq_maximalIdeal_of_inertiaDeg_one + exact IsLocalRing.eq_maximalIdeal hmax + + -- The abstract `Rₚ`/`Sₚ` localisation instance bundle (in the binders) needs synthesis room. +-omit [IsIntegrallyClosed R] [IsDedekindDomain R] [IsDomain S] [IsIntegrallyClosed S] +- [IsDedekindDomain S] [Module.Finite R S] [Module.IsTorsionFree R S] in ++omit [IsDedekindDomain S] [Module.Finite R S] [Module.IsTorsionFree R S] in + /-- **The per-prime relative norm at residue degree one, general semilocal `Rₚ`/`Sₚ`.** The + hypothesis `hlocal` of `relNorm_eq_under_of_localized`, stated over abstract localisation data + `Rₚ`/`Sₚ` (so the expensive concrete-`Localization` instances are deferred): for a maximal `P` of +@@ -608,83 +537,58 @@ The prime/maximal/`LiesOver`/`inertiaDeg'`-transport facts for `P·Sₚ` come fr + `relNorm_eq_maximalIdeal_of_inertiaDeg_one`. -/ + theorem relNorm_map_eq_maximalIdeal_general + (p : Ideal R) [hp : p.IsMaximal] (hp0 : p ≠ ⊥) +- (Rp : Type*) [CommRing Rp] [IsDomain Rp] [IsIntegrallyClosed Rp] [IsDedekindDomain Rp] ++ (Rp : Type*) [CommRing Rp] [IsDedekindDomain Rp] + [IsPrincipalIdealRing Rp] [Algebra R Rp] [IsLocalization.AtPrime Rp p] [IsLocalRing Rp] + [Module.IsTorsionFree R Rp] +- (Sp : Type*) [CommRing Sp] [IsDomain Sp] [IsIntegrallyClosed Sp] [IsDedekindDomain Sp] ++ (Sp : Type*) [CommRing Sp] [IsDedekindDomain Sp] + [IsPrincipalIdealRing Sp] [Algebra S Sp] + [IsLocalization (Algebra.algebraMapSubmonoid S p.primeCompl) Sp] + [Algebra Rp Sp] [Module.Finite Rp Sp] [Module.IsTorsionFree Rp Sp] + [Algebra R Sp] [IsScalarTower R S Sp] [IsScalarTower R Rp Sp] + (P : Ideal S) [hPmax : P.IsMaximal] [hPp : P.LiesOver p] +- (hf : Ideal.inertiaDeg' p P = 1) : ++ (hf : P.inertiaDeg R = 1) : + Ideal.relNorm Rp (P.map (algebraMap S Sp)) = IsLocalRing.maximalIdeal Rp := by +- haveI hQprime : (P.map (algebraMap S Sp)).IsPrime := ++ have hQprime : (P.map (algebraMap S Sp)).IsPrime := + IsLocalization.AtPrime.isPrime_map_of_liesOver S p Sp P +- haveI hQlo : (P.map (algebraMap S Sp)).LiesOver (IsLocalRing.maximalIdeal Rp) := ++ have hQlo : (P.map (algebraMap S Sp)).LiesOver (IsLocalRing.maximalIdeal Rp) := + IsLocalization.AtPrime.liesOver_map_of_liesOver p Rp Sp P + have hm0 : IsLocalRing.maximalIdeal Rp ≠ ⊥ := by + rw [← IsLocalization.AtPrime.map_eq_maximalIdeal p Rp] + exact Ideal.map_ne_bot_of_ne_bot hp0 + have hQ0 : (P.map (algebraMap S Sp)) ≠ ⊥ := Ideal.ne_bot_of_liesOver_of_ne_bot hm0 _ +- haveI hQmax : (P.map (algebraMap S Sp)).IsMaximal := ++ have hQmax : (P.map (algebraMap S Sp)).IsMaximal := + Ring.DimensionLEOne.maximalOfPrime hQ0 hQprime +- rw [Ideal.inertiaDeg'_eq_inertiaDeg] at hf +- have hfQ : Ideal.inertiaDeg' (IsLocalRing.maximalIdeal Rp) (P.map (algebraMap S Sp)) = 1 := by +- rw [Ideal.inertiaDeg'_eq_inertiaDeg, +- IsLocalization.AtPrime.inertiaDeg_map_eq_inertiaDeg p Rp Sp P] ++ have hfQ : (P.map (algebraMap S Sp)).inertiaDeg Rp = 1 := by ++ rw [IsLocalization.AtPrime.inertiaDeg_map_eq_inertiaDeg p Rp Sp P] + exact hf + exact relNorm_eq_maximalIdeal_of_inertiaDeg_one (P.map (algebraMap S Sp)) hQ0 hfQ + + -- The concrete semilocal `Sₚ` / DVR `Rₚ` localisation instance bundle is expensive to synthesise. +-/-- **`relNorm 𝔭 = comap 𝔭` for a maximal prime of residue degree one** (Silverman III.4.10(a), +-`f = 1`; ideal form). For a maximal ideal `P` of `S` with `inertiaDeg' (P.under R) P = 1`, the +-relative norm `Ideal.relNorm R P` equals the contraction `P.under R = comap (algebraMap R S) P`. +- +-This is reduced (no `PerfectField`) to the per-prime DVR-base norm via the global→semilocal +-`relNorm_eq_under_of_localized`; see the body and `relNorm_map_eq_maximalIdeal_general`. +- +-**Unconditional — no `PerfectField`.** Mathlib's `Ideal.relNorm_eq_pow_of_isMaximal` +-(`relNorm 𝔭 = 𝔭.under^f`) is gated on `[PerfectField (FractionRing R)]` (its proof reduces to the +-**Galois** case), which fails for a function field over a finite base. That hypothesis is *not* +-mathematically necessary at `f = 1` (standard `e · f` theory, Silverman III.4.10), and is now +-removed: the global→semilocal reduction `relNorm_eq_under_of_localized` reduces +-`relNorm R P = P.under R` to the **single** semilocal per-prime input +- +- `relNorm Rₚ (P·Sₚ) = maximalIdeal Rₚ` (`Rₚ = Localization.AtPrime p`, `Sₚ = semilocal loc. S`), +- +-which `relNorm_map_eq_maximalIdeal_general` discharges via the **module-length** route over the DVR +-base (`relNorm_eq_maximalIdeal_of_inertiaDeg_one` ← `relNorm_length_eq_span` + +-`isSimpleModule_quot_of_inertiaDeg_one`) — no Galois, no `PerfectField`, and **no** `Field (Rₚ ⧸ m)` +-instance diamond (the length is taken over the DVR `Rₚ`, never the residue field). The inertia +-degree transports across the localisation via `IsLocalization.AtPrime.inertiaDeg_map_eq_inertiaDeg`. +- +-(The shipped local-base specialisation +-`Ideal.relNorm_maximalIdeal_eq_under_of_inertiaDeg_one_of_isLocalRing` is now subsumed for the +-general base; it is retained as a lighter-weight `IsLocalRing` form.) -/ ++ ++ + theorem Ideal.relNorm_eq_under_of_inertiaDeg_one + {P : Ideal S} [hPmax : P.IsMaximal] (hP : P ≠ ⊥) +- (hf : Ideal.inertiaDeg' (P.under R) P = 1) : ++ (hf : P.inertiaDeg R = 1) : + Ideal.relNorm R P = P.under R := by +- letI hnz := NeZero.mk (Ideal.under_ne_bot R hP) +- haveI hpmax : (P.under R).IsMaximal := Ideal.IsMaximal.under R P +- haveI : P.LiesOver (P.under R) := Ideal.over_under P +- -- Pre-establish the heavy semilocal `Sₚ` / DVR `Rₚ` instances so the discharge stays in budget. +- haveI iDed : IsDedekindDomain ++ let hnz := NeZero.mk (Ideal.under_ne_bot R hP) ++ have hpmax : (P.under R).IsMaximal := Ideal.IsMaximal.under R P ++ have : P.LiesOver (P.under R) := Ideal.over_under P ++ ++ have iDed : IsDedekindDomain + (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance +- haveI iPID : IsPrincipalIdealRing ++ have iPID : IsPrincipalIdealRing + (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance +- haveI iFin : Module.Finite (Localization.AtPrime (P.under R)) ++ have iFin : Module.Finite (Localization.AtPrime (P.under R)) + (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance +- haveI iTF : Module.IsTorsionFree (Localization.AtPrime (P.under R)) ++ have iTF : Module.IsTorsionFree (Localization.AtPrime (P.under R)) + (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance +- haveI iIC : IsIntegrallyClosed ++ have iIC : IsIntegrallyClosed + (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance +- haveI iST2 : IsScalarTower R (Localization.AtPrime (P.under R)) ++ have iST2 : IsScalarTower R (Localization.AtPrime (P.under R)) + (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance +- haveI iST3 : IsScalarTower R S ++ have iST3 : IsScalarTower R S + (Localization (Algebra.algebraMapSubmonoid S (P.under R).primeCompl)) := inferInstance +- haveI iTFr : Module.IsTorsionFree R (Localization.AtPrime (P.under R)) := inferInstance ++ have iTFr : Module.IsTorsionFree R (Localization.AtPrime (P.under R)) := inferInstance + refine relNorm_eq_under_of_localized P hP ?_ + exact relNorm_map_eq_maximalIdeal_general (P.under R) (Ideal.under_ne_bot R hP) + (Localization.AtPrime (P.under R)) +@@ -696,81 +600,47 @@ contraction `comap (algebraMap R S) P` (which is nonzero by `Ideal.under_ne_bot` + `(Ideal R)⁰`. -/ + theorem relNorm0_eq_comap_of_inertiaDeg_one + (P : (Ideal S)⁰) [hPmax : (P : Ideal S).IsMaximal] +- (hf : Ideal.inertiaDeg' ((P : Ideal S).under R) (P : Ideal S) = 1) : ++ (hf : (P : Ideal S).inertiaDeg R = 1) : + (relNorm0 (R := R) (S := S) P : Ideal R) = + Ideal.comap (algebraMap R S) (P : Ideal S) := + Ideal.relNorm_eq_under_of_inertiaDeg_one (R := R) (S := S) + (mem_nonZeroDivisors_iff_ne_zero.mp P.2) hf + +-/-- **`class(relNorm 𝔭) = class(comap 𝔭)` for a maximal prime of residue degree one** +-(Silverman III.4.10(a), `f = 1`; class-group form). The `ClassGroup.mk0` class of `relNorm0 P` is +-the class of the contraction `comap (algebraMap R S) P`. + +-This is the residue-degree-`1` content that bridges the divisor pushforward `φ_* = relNorm` +-(`classNorm`) with the set-theoretic point image `comap` (the shipped `toClass_toPointMap`), pinning +-the `Pic⁰` naturality `hnat` at a rational point. The `comap`-nonzero membership proof is supplied +-via `Ideal.under_ne_bot`. -/ + theorem ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one + (P : (Ideal S)⁰) [hPmax : (P : Ideal S).IsMaximal] +- (hf : Ideal.inertiaDeg' ((P : Ideal S).under R) (P : Ideal S) = 1) ++ (hf : (P : Ideal S).inertiaDeg R = 1) + (hcomap : Ideal.comap (algebraMap R S) (P : Ideal S) ∈ (Ideal R)⁰) : + ClassGroup.mk0 (relNorm0 (R := R) (S := S) P) = + ClassGroup.mk0 (⟨Ideal.comap (algebraMap R S) (P : Ideal S), hcomap⟩ : (Ideal R)⁰) := + congrArg ClassGroup.mk0 (Subtype.ext (relNorm0_eq_comap_of_inertiaDeg_one (R := R) (S := S) P hf)) + +-/-! ### `inertiaDeg' = 1` at a residue-degree-one prime, for an `F`-algebra self-map `R →ₐ[F] R` + +-The residue/inertia degree `f = inertiaDeg' (M.under R) M = finrank (R ⧸ M.under R) (R ⧸ M)` is `1` +-whenever the residue field `R ⧸ M` is *one-dimensional over the ground field `F`* (an `F`-rational +-point: `R ⧸ M ≅ F`). This is Silverman III.4.10(a) `f = 1`: at a rational point the inseparability +-of an `F`-algebra self-map `g : R →ₐ[F] R` (e.g. Frobenius) lives entirely in the **ramification** +-`e`, never in `f`. +- +-The proof is **diamond-free** (it does *not* invoke `finrank_mul_finrank`, which is what blocks the +-`Module.Free` "Piece 9" route in `Curves/GenericFiber.lean`): it bounds +-`finrank (R ⧸ M.under R) (R ⧸ M) ≤ 1` directly by surjectivity of the residue-field algebra map. +-That surjectivity holds because `g` is an `F`-algebra hom — so it fixes the image of `F`, and +-`algebraMap F (R ⧸ M)` is already surjective when `finrank F (R ⧸ M) = 1`; hence every residue class +-is hit by a *constant* `algebraMap F (R ⧸ M.under R) c`. Positivity (`finrank ≥ 1`) is +-`Module.finrank_pos` (the residue extension is finite + nontrivial). ++-- The residue-field `finrank` bookkeeping (surjectivity bound + tower) needs more elaboration room. + +-`g` need only be *module-finite over itself through `g`* (`hfin`) for `M.under R` to be maximal +-(going-up / `Algebra.IsIntegral.of_finite`); this is exactly the `Module.Finite` witness an +-`Isogeny.CoordHom` already carries. -/ + +--- The twisted self-algebra `R →[g] R` pushes instance synthesis past the default budget. +--- The residue-field `finrank` bookkeeping (surjectivity bound + tower) needs more elaboration room. +-/-- **`inertiaDeg' = 1` at a rational point, for an `F`-algebra self-map** (Silverman III.4.10(a), +-`f = 1`). For an `F`-algebra `R`, an `F`-algebra hom `g : R →ₐ[F] R` that is module-finite over +-itself through `g`, and a maximal ideal `M` whose residue field is one-dimensional over `F` +-(`finrank F (R ⧸ M) = 1`, the `F`-rational condition), the inertia degree of `M.under R` (the +-contraction `comap g M`) under `M` is `1`. +- +-Diamond-free (no `finrank_mul_finrank`): see the section note. This is the missing `f = 1` input +-that, via `Ideal.relNorm_eq_under_of_inertiaDeg_one`, collapses `relNorm 𝔪 = comap 𝔪` at rational +-points — the residue-degree content of the `Pic⁰` naturality `hnat`. -/ + theorem Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one + {F : Type*} [Field F] {R : Type*} [CommRing R] [Algebra F R] (g : R →ₐ[F] R) + (hfin : @Module.Finite R R _ _ g.toRingHom.toAlgebra.toModule) + (M : Ideal R) [hM : M.IsMaximal] + (hres : Module.finrank F (R ⧸ M) = 1) : + letI : Algebra R R := g.toRingHom.toAlgebra +- Ideal.inertiaDeg' (M.under R) M = 1 := by +- letI inst : Algebra R R := g.toRingHom.toAlgebra +- haveI instFin : @Module.Finite R R _ _ inst.toModule := hfin +- haveI : @Algebra.IsIntegral R R _ _ inst := ++ M.inertiaDeg R = 1 := by ++ let inst : Algebra R R := g.toRingHom.toAlgebra ++ have instFin : @Module.Finite R R _ _ inst.toModule := hfin ++ have : @Algebra.IsIntegral R R _ _ inst := + @Algebra.IsIntegral.of_finite R R _ _ inst instFin + -- The twisted self-algebra is a scalar tower over `F`: `g` fixes the image of `F`. +- haveI hst : @IsScalarTower F R R _ inst.toSMul _ := ++ have hst : @IsScalarTower F R R _ inst.toSMul _ := + @IsScalarTower.of_algebraMap_eq F R R _ _ _ _ inst _ fun c ↦ by + change algebraMap F R c = g.toRingHom (algebraMap F R c) + rw [show g.toRingHom (algebraMap F R c) = g (algebraMap F R c) from rfl, AlgHom.commutes] +- haveI : M.LiesOver (M.under R) := Ideal.over_under M +- haveI hmax : (M.under R).IsMaximal := Ideal.IsMaximal.under R M +- haveI : Field (R ⧸ M.under R) := Ideal.Quotient.field _ +- rw [Ideal.inertiaDeg'_algebraMap] +- haveI : Nontrivial (R ⧸ M) := Ideal.Quotient.nontrivial_iff.mpr hM.ne_top +- haveI : FiniteDimensional F (R ⧸ M) := Module.finite_of_finrank_eq_succ hres ++ have : M.LiesOver (M.under R) := Ideal.over_under M ++ have hmax : (M.under R).IsMaximal := Ideal.IsMaximal.under R M ++ have : Field (R ⧸ M.under R) := Ideal.Quotient.field _ ++ rw [Ideal.inertiaDeg_eq_of_isMaximal (M.under R) M] ++ have : Nontrivial (R ⧸ M) := Ideal.Quotient.nontrivial_iff.mpr hM.ne_top ++ have : FiniteDimensional F (R ⧸ M) := Module.finite_of_finrank_eq_succ hres + -- `algebraMap F (R ⧸ M)` is surjective: injective `F`-linear map between equal (= 1) finrank. + have hFsurj : Function.Surjective (algebraMap F (R ⧸ M)) := by + have hinj : Function.Injective (Algebra.linearMap F (R ⧸ M)) := +@@ -785,7 +655,7 @@ theorem Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one + obtain ⟨c₀, hc₀⟩ := hFsurj w + exact ⟨algebraMap F (R ⧸ M.under R) c₀, by + rw [← IsScalarTower.algebraMap_apply F (R ⧸ M.under R) (R ⧸ M), hc₀]⟩ +- haveI hfinMod : Module.Finite (R ⧸ M.under R) (R ⧸ M) := ++ have hfinMod : Module.Finite (R ⧸ M.under R) (R ⧸ M) := + Module.Finite.of_surjective (Algebra.linearMap (R ⧸ M.under R) (R ⧸ M)) + (by intro w; obtain ⟨c, hc⟩ := hsurj w; exact ⟨c, hc⟩) + have h_le : Module.finrank (R ⧸ M.under R) (R ⧸ M) ≤ 1 := +@@ -805,23 +675,6 @@ theorem ClassGroup.relNorm_mul (a b : ClassGroup S) : + ClassGroup.relNorm (R := R) a * ClassGroup.relNorm (R := R) b := + map_mul _ a b + +-/-! +-## The class-group extension (pullback) map and the dual relation +- +-We now build the *extension* direction `ClassGroup R →* ClassGroup S`, induced by +-`Ideal.map (algebraMap R S)` (extend an ideal of `R` to `S`), by exactly the same descent +-technique used for `relNorm`. Composing the relative norm with the extension recovers raising to +-the `n`-th power, where `n = [Frac S : Frac R] = Module.finrank R S` +-(`ClassGroup.relNorm_comp_map`). This is the class-group shadow of the dual-isogeny relation +-`α̂ ∘ α = [deg α]`. +- +-The whole arithmetic core +-`Ideal.relNorm R (Ideal.map (algebraMap R S) I) = I ^ n` +-is already available in mathlib as `Ideal.relNorm_algebraMap` (proved by localising at maximal +-ideals and reducing to `Algebra.norm_algebraMap`); in particular it needs **no** +-separability/Galois/`PerfectField` hypothesis, so the ramification–inertia route is not needed +-here. +--/ + + /-- The extension of an integral ideal, packaged as a homomorphism of `nonZeroDivisors` monoids + `(Ideal R)⁰ →* (Ideal S)⁰`, using that `Ideal.map (algebraMap R S)` sends nonzero ideals to nonzero +@@ -844,12 +697,12 @@ noncomputable def map0 : (Ideal R)⁰ →* (Ideal S)⁰ where + noncomputable def mk0CompMap0 : (Ideal R)⁰ →* ClassGroup S := + (ClassGroup.mk0 (R := S)).comp map0 + +-omit [IsIntegrallyClosed R] [IsDedekindDomain R] [IsIntegrallyClosed S] [Module.Finite R S] in ++omit [Module.Finite R S] in + @[simp] + theorem mk0CompMap0_apply (I : (Ideal R)⁰) : + mk0CompMap0 (S := S) I = ClassGroup.mk0 (map0 I) := rfl + +-omit [IsIntegrallyClosed R] [IsIntegrallyClosed S] [Module.Finite R S] in ++omit [Module.Finite R S] in + /-- Well-definedness of the descent: if two integral ideals of `R` have the same class in + `ClassGroup R`, their extensions have the same class in `ClassGroup S`. + +@@ -893,7 +746,7 @@ noncomputable def ClassGroup.map : ClassGroup R →* ClassGroup S where + Function.surjInv_eq ClassGroup.mk0_surjective, + Function.surjInv_eq ClassGroup.mk0_surjective] + +-omit [IsIntegrallyClosed R] [IsIntegrallyClosed S] [Module.Finite R S] in ++omit [Module.Finite R S] in + /-- The defining computation of `ClassGroup.map` on an integral representative: the extension of the + class of `I` is the class of `Ideal.map (algebraMap R S) I` (which lies in `(Ideal S)⁰` by + `Ideal.map_eq_bot_iff_of_injective`, here packaged as `map0 I`). -/ +@@ -903,39 +756,24 @@ theorem ClassGroup.map_mk0 (I : (Ideal R)⁰) : + refine (mk0CompMap0_eq_of_mk0_eq ?_).trans (mk0CompMap0_apply I) + rw [Function.surjInv_eq ClassGroup.mk0_surjective] + +-omit [IsIntegrallyClosed R] [IsIntegrallyClosed S] [Module.Finite R S] in ++omit [Module.Finite R S] in + /-- `map_one` sanity check: the extension of the trivial class is trivial. -/ + theorem ClassGroup.map_one : ClassGroup.map (R := R) (S := S) 1 = 1 := + _root_.map_one _ + +-omit [IsIntegrallyClosed R] [IsIntegrallyClosed S] [Module.Finite R S] in ++omit [Module.Finite R S] in + /-- `map_mul` sanity check: the extension map is multiplicative. -/ + theorem ClassGroup.map_mul (a b : ClassGroup R) : + ClassGroup.map (S := S) (a * b) = + ClassGroup.map (S := S) a * ClassGroup.map (S := S) b := + _root_.map_mul _ a b + +-/-- The **ideal-level arithmetic core** of the dual relation: the relative norm of the extension of +-an integral ideal `I` of `R` is `I ^ n`, where `n = Module.finrank R S`. + +-Since mathlib moved `Ideal.relNorm_algebraMap`'s exponent from +-`Module.finrank (FractionRing R) (FractionRing S)` to `Module.finrank R S`, this is now *literally* +-that lemma — the fraction-field transport it used to perform is gone. Kept as the name the +-class-group descent below cites; a cleanup pass can inline it. -/ + theorem Ideal.relNorm_map_algebraMap (I : Ideal R) : + Ideal.relNorm R (Ideal.map (algebraMap R S) I) = I ^ Module.finrank R S := + Ideal.relNorm_algebraMap S I + +-/-- **The target: the dual relation at the class-group level.** +- +-The composite of the class-group extension map with the relative norm is raising to the `n`-th +-power, where `n = Module.finrank R S = [Frac S : Frac R]`: +-`relNorm (map c) = c ^ n` for every `c : ClassGroup R`. This is the arithmetic core, on ideal +-classes, of `α̂ ∘ α = [deg α]`. + +-The proof picks an integral representative `c = mk0 I` (`ClassGroup.mk0_surjective`), computes both +-descents with `ClassGroup.map_mk0` and `ClassGroup.relNorm_mk0`, and reduces to the ideal-level +-identity `Ideal.relNorm_map_algebraMap`. Compatibility of `mk0` with `(· ^ n)` is `map_pow`. -/ + theorem ClassGroup.relNorm_comp_map (c : ClassGroup R) : + ClassGroup.relNorm (ClassGroup.map (S := S) c) = c ^ Module.finrank R S := by + obtain ⟨I, rfl⟩ := ClassGroup.mk0_surjective c +diff --git a/projects/HasseWeil/HasseWeil/Pic0/PicDual.lean b/projects/HasseWeil/HasseWeil/Pic0/PicDual.lean +index d0543c22f..40854d96f 100644 +--- a/projects/HasseWeil/HasseWeil/Pic0/PicDual.lean ++++ b/projects/HasseWeil/HasseWeil/Pic0/PicDual.lean +@@ -8,68 +8,22 @@ import HasseWeil.Pic0.ToClassSurjective + import HasseWeil.Foundation.Basic + + /-! +-# The Pic⁰ dual isogeny and the dual relation `α ∘ α̂ = [deg α]` (Silverman III.6.1) +- +-For an endomorphism `α : Isogeny E E` of an elliptic curve `E`, equipped with a coordinate-ring +-restriction witness `ch : α.CoordHom` (the comorphism `α* : R → R` on `R := E.CoordinateRing`), +-this file builds the **Pic⁰ dual** as a point endomorphism and proves the dual relation, following +-**Silverman, *The Arithmetic of Elliptic Curves*, III.6.1** *to the letter*. +- +-## Silverman III.6.1 (verified against the in-repo PDF, book p.80–82) +- +-Let `κ : E ≅ Pic⁰(E)`, `P ↦ class of `(P) − (O)``. Silverman III.6.1(b) **defines** the dual via +-the **divisor pullback** `φ*` (II.3.6/II.3.7): +- +-``` +- κ φ* κ⁻¹ +- φ̂ : E ───→ Pic⁰(E) ───→ Pic⁰(E) ───→ E , +-``` +- +-i.e. `φ̂ = κ⁻¹ ∘ φ* ∘ κ`, where `φ* : Pic⁰(E) → Pic⁰(E)` is the **pullback** of divisor classes +-`(Q) ↦ Σ_{P ↦ Q} e_φ(P)·(P)` (Silverman II.3, book p.29). At the level of the affine ideal class +-group `Pic⁰(E) ≅ ClassGroup R`, this pullback is the **ideal extension** `𝔪_Q ↦ 𝔪_Q·𝒪 = ∏ 𝔓^{e}`, +-which is exactly the shipped `HasseWeil.Isogeny.classMap` (= `HasseWeil.ClassGroup.map`). +- +-The companion **divisor pushforward** `φ_*` (II.3.6/II.3.7), `(P) ↦ (φP)`, is at the ideal level the +-**relative norm** `𝔓 ↦ 𝔮^{f}`, the shipped `HasseWeil.Isogeny.classNorm` (= `ClassGroup.relNorm`). +-Silverman II.3.6(e) gives `φ_* ∘ φ* = [deg φ]` on `Pic⁰`; its shipped shadow is +-`HasseWeil.Isogeny.classNorm_comp_classMap` (`classNorm (classMap c) = c ^ finrank R R`). +- +-## Main definitions +- +-* `HasseWeil.Isogeny.picDual` — `φ̂ = κ⁻¹ ∘ classMap ∘ κ` as a point endomorphism `E.Point →+ +- E.Point` (the III.6.1(b) construction; `classMap` = extension = the divisor pullback `φ*`). +-* `HasseWeil.Isogeny.picPushforward` — `κ⁻¹ ∘ classNorm ∘ κ`, the κ-transport of the divisor +- pushforward `φ_*` (= `classNorm` = relative norm). +- +-## Main results +- +-* `HasseWeil.Isogeny.picPushforward_comp_picDual` / `..._degree` — **unconditional** (modulo the +- carried `CoordHom`/`Module.Finite`/tower witnesses): the κ-transport of Silverman II.3.6(e), +- `picPushforward ∘ picDual = [finrank R R]` (resp. `= [α.degree]`), as `AddMonoidHom`s. +-* `HasseWeil.Isogeny.toAddMonoidHom_comp_picDual` — **the III.6.1 target** `α ∘ α̂ = [deg α]` +- (`α.toAddMonoidHom.comp α.picDual = [α.degree]`), carrying the III.3.4 **naturality** of `κ` on +- the point map (`hnat : κ ∘ α = classNorm ∘ κ`) as a witness-parametric hypothesis. +-* `HasseWeil.Isogeny.picDual_comp_toAddMonoidHom` — the companion `α̂ ∘ α = [deg α]` +- (III.6.2(a) order), under the same naturality witness. +- +-## Why the III.3.4 naturality is a *carried hypothesis*, not derived +- +-The unconditional results above tie `picDual` to `picPushforward` (both κ-transports), with **no** +-extra input. Identifying `picPushforward` with the *actual* point map `α.toAddMonoidHom` is the +-**III.3.4 naturality** `κ ∘ α = classNorm ∘ κ` (i.e. `κ₂(αP) = φ_*κ₁(P)`). As documented in +-`HasseWeil/Pic0/ToClassFunctorial.lean`, the point-map ↔ ideal-map link the shipped API exposes is +-the **`comap`** (set-theoretic point image), which on a prime `𝔓 / 𝔮` gives `𝔮`, whereas the +-pushforward `φ_* = relNorm` gives `𝔮^{f}` — they differ by the **inertia/residue degree** `f`. +-Bridging them is exactly the ramification bookkeeping `relNorm (comap …) = (·)^?` +-(`relNorm_eq_pow_of_isMaximal`, needing `PerfectField (FractionRing R)`), the III.3.4 content the +-`Isogeny` carries as *independent data*. It is therefore taken as a hypothesis here (dischargeable +-per isogeny: Frobenius, multiplication-by-`n`), keeping every theorem `#print axioms`-clean. ++# The Picard dual isogeny ++ ++For an elliptic-curve endomorphism `α` with a coordinate-ring comorphism, ++transporting ideal extension along `κ : E ≃ Pic⁰(E)` defines the Picard dual. ++Transporting the relative ideal norm defines the point-group pushforward. ++The norm–extension identity gives `picPushforward ∘ picDual = [deg α]`. ++Under the naturality relation between the point map and `κ`, this yields ++`α ∘ α̂ = [deg α]`; surjectivity gives the companion relation by cancellation. ++ ++At rational points, residue degree one identifies the relative ideal norm ++with contraction. This proves the corresponding naturality reduction ++without a perfectness assumption on the function field. + + ## References + +-* [Silverman, *The Arithmetic of Elliptic Curves*], II.3.6–3.7 (divisor pullback/pushforward, +- `φ_*φ* = [deg]`), III.3.4 (functoriality of `E ≅ Pic⁰(E)`), III.6.1 (the dual isogeny). ++* [Silverman, *The Arithmetic of Elliptic Curves*], II.3.6–3.7, III.3.4, III.6.1. + -/ + + open WeierstrassCurve Polynomial +@@ -114,7 +68,7 @@ Silverman's **divisor pullback** `φ* : Pic⁰(E) → Pic⁰(E)`. This is *exac + definition `φ̂ = κ₁⁻¹ ∘ φ* ∘ κ₂`. + + The `CoordHom` witness `ch`, injectivity `hinj`, and finiteness `hfin` are the data/hypotheses the +-shipped `classMap` requires (carried, not discharged universally — instantiable per isogeny). -/ ++`classMap` requires (carried, not discharged universally — instantiable per isogeny). -/ + noncomputable def picDual (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) + (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) : + E.Point →+ E.Point := +@@ -188,7 +142,7 @@ theorem classTransport_comp_eq + + /-! ### The dual relation `φ_* ∘ φ* = [deg]`, transported to the point group + +-Silverman II.3.6(e): `φ_* ∘ φ* = [deg φ]` on `Pic⁰(E)`. Its shipped class-group shadow is ++Silverman II.3.6(e): `φ_* ∘ φ* = [deg φ]` on `Pic⁰(E)`. Its class-group shadow is + `classNorm_comp_classMap` (`classNorm (classMap c) = c ^ finrank R R`). We transport it across `κ` + to obtain `picPushforward ∘ picDual = [finrank R R]` as point endomorphisms — **unconditionally** + (beyond the carried `CoordHom`/`Module.Finite` witnesses the `classMap`/`classNorm` already need). +@@ -196,7 +150,7 @@ The `α.degree` form follows from the degree bridge `classNorm_comp_classMap_deg + + /-- **κ-transport of `φ_* ∘ φ* = [deg]` (coordinate-ring `finrank` form).** + +-`picPushforward ∘ picDual = [finrank R R]` as point endomorphisms, the κ-conjugate of the shipped ++`picPushforward ∘ picDual = [finrank R R]` as point endomorphisms, the κ-conjugate of the + class-group identity `classNorm (classMap c) = c ^ finrank R R` (= Silverman II.3.6(e) + `φ_* ∘ φ* = [deg]`). Unconditional beyond the carried `CoordHom`/`Module.Finite` witnesses. + +@@ -210,7 +164,7 @@ theorem picPushforward_comp_picDual (ch : α.CoordHom) (hinj : Function.Injectiv + ((@Module.finrank E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule : ℕ) : + ℤ))).toAddMonoidHom := + -- `picPushforward ∘ picDual = classTransport classNorm ∘ classTransport classMap`, and +- -- `classNorm (classMap c) = c ^ finrank` is the shipped `classNorm_comp_classMap`. ++ -- `classNorm (classMap c) = c ^ finrank` is the `classNorm_comp_classMap`. + classTransport_comp_eq (α.classMap ch hinj hfin) (α.classNorm ch hinj hfin) _ + (α.classNorm_comp_classMap ch hinj hfin) + +@@ -238,19 +192,12 @@ theorem picPushforward_comp_picDual_degree (ch : α.CoordHom) + congr 2 + exact_mod_cast (α.degree_eq_finrank_coordinateRing_of_tower_eq ch S S' hSR hS'FF).symm + +-/-! ### The III.6.1 target `α ∘ α̂ = [deg α]` on the point group ++/-! ### The dual relation on the point group + +-The unconditional `picPushforward_comp_picDual` ties `picDual` to `picPushforward`. To reach the +-brief's target `α ∘ α̂ = [deg α]` — with the *actual* point map `α.toAddMonoidHom` — we additionally +-need the **Silverman III.3.4 naturality** of `κ` on the point map: that under `κ`, the point map +-`α.toAddMonoidHom` corresponds to the divisor pushforward `φ_*` (= `classNorm`). In the κ-conjugate +-form, this is exactly `α.toAddMonoidHom = α.picPushforward …`. +- +-As documented in `HasseWeil/Pic0/ToClassFunctorial.lean`, the shipped point-map ↔ ideal-map link is +-the **`comap`** (set-theoretic point image), which differs from `φ_* = relNorm` by the residue +-degree; bridging them is the III.3.4 ramification bookkeeping the `Isogeny` carries as independent +-data. We therefore take the naturality as a witness-parametric hypothesis (dischargeable per +-isogeny), keeping the result `#print axioms`-clean. -/ ++The relation between the Picard dual and Picard pushforward yields the ++point-group dual relation under the naturality condition ++`κ (α P) = classNorm (κ P)`. The relative norm differs from contraction by the ++residue degree; for rational points this degree is one. -/ + + /-- **The III.3.4 naturality witness, raw form**: under `κ = toClassEquiv'`, the point map of `α` + corresponds to the relative-norm class map `classNorm` (the divisor pushforward `φ_*`): +@@ -279,44 +226,14 @@ theorem toAddMonoidHom_eq_picPushforward_iff (ch : α.CoordHom) + rw [picPushforward_apply, ← h P, + (WeierstrassCurve.Affine.Point.toClassEquiv' (W := E)).symm_apply_apply] + +-/-! #### Isolating the `hnat` residual to the rational-point ideal identity (`comap = relNorm`) +- +-`Naturality` is structurally a **carried datum**: an abstract `Isogeny E E` stores its `pullback` +-and `toAddMonoidHom` as *independent* fields (`HasseWeil/Basic.lean`), with no derivation linking +-the point map to the comorphism `ch` — so `hnat` cannot be proved in general, only verified per +-isogeny where both fields are explicit (Frobenius, mult-by-`n`). +- +-What we *can* ship axiom-clean is the exact reduction of the **right-hand side** of `Naturality` to +-a concrete ideal class. The RHS `classNorm (κ P)` for a rational point `P = (x, y)` is the `mk0` +-class of the **relative norm** `relNorm (maximalIdealAt P) = relNorm ⟨X − x, Y − y⟩` (Silverman's +-divisor pushforward `φ_*`). Combined with the shipped `ToClassFunctorial.toClass_toPointMap` +-(whose ideal is the **`comap`** `α*⁻¹(maximalIdealAt P)`), this pins the *entire* remaining content +-of `hnat` to the single residue-degree identity +- +-``` +-class (relNorm (maximalIdealAt P)) = class (comap α* (maximalIdealAt P)) (rational P) +-``` +- +-which holds because a rational point has residue degree `f = 1`, so `relNorm 𝔪_P = 𝔪_P ∩ R = +-comap α* 𝔪_P` (for `f = 1`, `relNorm 𝔭 = (comap 𝔭)^f = comap 𝔭`). Mathlib has no +-`relNorm = (comap)^{inertiaDeg'}` lemma (and the project's `inertiaDeg' = 1`-at-smooth-points +-computation is `Module.Free`-diamond-blocked, see `Curves/GenericFiber.lean` Piece 9), so this last +-step stays a per-isogeny obligation; the lemma below is the bridge that *reduces to it*. -/ +- +-/-- **The `classNorm`/`κ` side of `Naturality`, evaluated at a rational point (axiom-clean +-bridge).** +- +-For a rational point `P = (x, y)` (a mathlib `Point.some`), the value of the relative-norm class map +-`classNorm` on `κ P = toClassEquiv' P` is the `mk0` class of the **relative ideal norm** of the +-maximal ideal `XYIdeal E x (C y) = ⟨X − x, Y − y⟩` at `P` (= Silverman's divisor pushforward `φ_*`, +-packaged as `relNorm0`). This unfolds the *right-hand side* of the III.3.4 naturality predicate +-`Naturality` at `Point.some`, reducing the whole `hnat` obligation to the ideal-class identity +-`class (relNorm 𝔪_P) = class (comap α* 𝔪_P)` against the shipped `toClass_toPointMap` (the +-`comap` form) — exactly the residue-degree-`1` content (see the section note). +- +-Proof: `κ (some) = toClass (some) = mk (XYIdeal' h) = mk0 ⟨XYIdeal, _⟩` (the project's +-`mk0_eq_mk_XYIdeal'` bridge), then `ClassGroup.relNorm_mk0` computes the norm on the integral +-representative. -/ ++/-! #### Naturality at rational points ++ ++For a rational point `P`, `classNorm (κ P)` is represented by the relative ++norm of its maximal ideal. Residue degree one identifies this norm with the ++contraction under the coordinate-ring comorphism. Thus naturality reduces ++to agreement between the given point map and the contracted ideal class. -/ ++ ++/-- The relative-norm class map on a rational point is represented by the relative norm of its maximal ideal. -/ + theorem classNorm_toClassEquiv'_some (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) + (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) + {x y : F} (h : E.Nonsingular x y) +@@ -331,9 +248,9 @@ theorem classNorm_toClassEquiv'_some (ch : α.CoordHom) (hinj : Function.Injecti + ch.isTorsionFree hinj + ClassGroup.mk0 (HasseWeil.relNorm0 (R := E.CoordinateRing) (S := E.CoordinateRing) + ⟨WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y), hmem⟩) := by +- letI := ch.toAlgebra +- haveI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin +- haveI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := ++ let := ch.toAlgebra ++ have : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin ++ have : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := + ch.isTorsionFree hinj + rw [WeierstrassCurve.Affine.Point.toClassEquiv'_apply, + WeierstrassCurve.Affine.Point.toClass_some, +@@ -341,23 +258,11 @@ theorem classNorm_toClassEquiv'_some (ch : α.CoordHom) (hinj : Function.Injecti + show HasseWeil.ClassGroup.relNorm (ClassGroup.mk0 _) = _ + rw [HasseWeil.ClassGroup.relNorm_mk0] + +-/-! #### Discharging `hnat`: the residue-degree-`1` (`comap = relNorm`) step at rational points +- +-Combining the shipped `classNorm_toClassEquiv'_some` (the `relNorm0` form of the `Naturality` RHS) +-with the residue-degree bridge of `ClassGroupNorm` (`relNorm 𝔪 = comap 𝔪` at `inertiaDeg' = 1`, the +-`inertiaDeg' = 1` itself supplied **diamond-free** by +-`Ideal`.`inertiaDeg_under_eq_one_of_algHom_…`), +-we reduce the entire `hnat`/`Naturality` obligation to the **point-map ↔ `comap` agreement** — that +-the actual point map `α.toAddMonoidHom` sends `(x, y)` to a point whose `κ`-class is the contraction +-`comap α* 𝔪_{(x,y)}` (Silverman III.3.4, the `comap` form shipped as `toClass_toPointMap`). ++/-! #### The residue-degree-one norm identity + +-The residue-degree step needs `PerfectField (FractionRing R) = PerfectField K(E)` (the hypothesis of +-mathlib's `Ideal.relNorm_eq_pow_of_isMaximal`). This holds for perfect base fields (e.g. `char 0`, +-or algebraically closed of characteristic `0`). **Honest residual:** for a function field over a +-*finite* field `K(E)` is *imperfect*, so this last `relNorm = comap` step is not covered by the +-mathlib lemma there; pinning the exponent without `PerfectField`/Galois would require a degree-count +-adaptation of the project's `relNorm_maximalIdealAt` (`Curves/NormValuation.lean`) to the twisted +-`R →[α*] R` extension. Everything *below* the `PerfectField` hypothesis is unconditional. -/ ++The rational-point residue field has rank one over the base field. The ++class-group norm identity at residue degree one then identifies relative ++norm with contraction, without assuming the function field is perfect. -/ + + /-- **The `comap α* 𝔪_P` ideal is a nonzero divisor** (carried side condition for the `mk0` class). + For a rational point `P = (x, y)`, the contraction `comap α* (XYIdeal E x (C y))` of the (nonzero) +@@ -371,36 +276,16 @@ theorem comap_XYIdeal_mem_nonZeroDivisors (ch : α.CoordHom) + Ideal.comap ch.toAlgHom.toRingHom + (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)) ∈ + (Ideal E.CoordinateRing)⁰ := by +- letI := ch.toAlgebra +- haveI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin +- haveI : Algebra.IsIntegral E.CoordinateRing E.CoordinateRing := ++ let := ch.toAlgebra ++ have : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin ++ have : Algebra.IsIntegral E.CoordinateRing E.CoordinateRing := + Algebra.IsIntegral.of_finite _ _ + have hbot : WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y) ≠ ⊥ := + mem_nonZeroDivisors_iff_ne_zero.mp hmem + exact mem_nonZeroDivisors_iff_ne_zero.mpr + (Ideal.under_ne_bot (A := E.CoordinateRing) (B := E.CoordinateRing) hbot) + +-/-- **The `classNorm`/`comap` identity at a rational point (residue degree `1`) — UNCONDITIONAL.** +- +-For a rational point `P = (x, y)` and a coordinate-ring restriction `ch`, the relative-norm class +-`classNorm0 (XYIdeal E x (C y))` (the `Naturality` RHS, via `classNorm_toClassEquiv'_some`) equals +-the class of the **contraction** `comap α* (XYIdeal E x (C y))` — Silverman's divisor pushforward +-`φ_*` collapses to the set-theoretic point image at a rational point, where the residue degree +-`f = 1`. +- +-**`PerfectField`-free.** Mathlib's `Ideal.relNorm_eq_pow_of_isMaximal` is gated on +-`[PerfectField (FractionRing R)]` (its proof reduces to the Galois case, which fails for a function +-field over a finite base), but that hypothesis is *not* needed at `f = 1`: the shipped +-`ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one` (`ClassGroupNorm.lean`) discharges +-`relNorm 𝔪 = comap 𝔪` from `inertiaDeg' = 1` alone via the module-length / DVR-base route, with +-**no** +-`PerfectField`. This removes the previous `[PerfectField E.FunctionField]` hypothesis. +- +-Proof: `XYIdeal` is maximal (`quotientXYIdealEquiv`) with residue field `F` (so `finrank F (R/𝔪) = +-1`), hence `inertiaDeg' (𝔪.under R) 𝔪 = 1` +-(`Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one`, diamond-free); then +-`ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one` (`relNorm 𝔪 = comap 𝔪` under `f = 1`, +-unconditional) finishes. -/ ++/-- At a rational point, residue degree one identifies the relative-norm ideal class with the contracted ideal class. -/ + theorem mk0_relNorm0_XYIdeal_eq_mk0_comap + (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) + (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) +@@ -419,18 +304,16 @@ theorem mk0_relNorm0_XYIdeal_eq_mk0_comap + ClassGroup.mk0 (⟨Ideal.comap ch.toAlgHom.toRingHom + (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)), hcomap⟩ : + (Ideal E.CoordinateRing)⁰) := by +- letI := ch.toAlgebra +- haveI : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin +- haveI : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := ++ let := ch.toAlgebra ++ have : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := hfin ++ have : @Module.IsTorsionFree E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule := + ch.isTorsionFree hinj +- haveI hMmax : (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)).IsMaximal := ++ have hMmax : (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)).IsMaximal := + Ideal.Quotient.maximal_of_isField _ + ((WeierstrassCurve.Affine.CoordinateRing.quotientXYIdealEquiv h.1).toRingEquiv.isField + (Field.toIsField F)) +- have hf : Ideal.inertiaDeg' +- ((WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)).under +- E.CoordinateRing) +- (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x (Polynomial.C y)) = 1 := ++ have hf : (WeierstrassCurve.Affine.CoordinateRing.XYIdeal E x ++ (Polynomial.C y)).inertiaDeg E.CoordinateRing = 1 := + Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one ch.toAlgHom hfin _ + (WeierstrassCurve.Affine.Point.finrank_quotient_XYIdeal_eq_one h.1) + exact ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one +@@ -484,21 +367,7 @@ theorem Naturality_of_toClassEquiv'_some_eq_relNorm0 + rw [classNorm_toClassEquiv'_some ch hinj hfin h hmem] + exact hpoint x y h hmem + +-/-- **Discharging `hnat` from point-map ↔ `comap` agreement (residue degree `1`) — UNCONDITIONAL.** +- +-The `Naturality` predicate `hnat` holds whenever, for every rational point `P = (x, y)`, the actual +-point map `α.toAddMonoidHom` sends `(x, y)` to a point whose `κ`-class is the contraction +-`comap α* 𝔪_{(x,y)}` (the `comap` form of Silverman III.3.4 — exactly what `toClass_toPointMap` +-supplies for a *geometric* isogeny whose point map is `toPointMap`). This is the precise reduction +-of `hnat` to its remaining content: the `relNorm`-vs-`comap` gap is closed here by the residue +-identity `mk0_relNorm0_XYIdeal_eq_mk0_comap`, which is now **`PerfectField`-free** (it routes +-through +-the shipped `ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one`, valid at `f = 1` with no +-`PerfectField`). **No `PerfectField E.FunctionField` hypothesis** — the only residual is the +-point-map ↔ `comap` agreement `hpoint`, i.e. Silverman III.3.4 for the *actual* point map (supplied +-per isogeny by `toClass_toPointMap` whenever the point map is the geometric `toPointMap`). +- +-The basepoint case is automatic (`κ 0 = 0 = ofMul (classNorm 1)`). -/ ++/-- Agreement of the point map with contracted rational-point ideal classes implies naturality of the Picard identification. -/ + theorem Naturality_of_toClassEquiv'_some_eq_comap + (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) + (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) +@@ -536,25 +405,7 @@ theorem Naturality_of_toClassEquiv'_some_eq_comap + mk0_relNorm0_XYIdeal_eq_mk0_comap ch hinj hfin h hmem hcomap] + exact hpoint x y h hcomap + +-/-- **UNCONDITIONAL `Naturality` from a `CoordHom` (Silverman III.3.4) — the `hnat` discharge.** +- +-Given a coordinate-ring restriction `ch : α.CoordHom` and the **single genuine residual** that the +-actual point map `α.toAddMonoidHom` realises the III.3.4 *set-theoretic point image* — i.e. for each +-rational `(x, y)` the `κ`-class of `α.toAddMonoidHom (x, y)` is the contraction `comap α* 𝔪_{(x,y)}` +-(`hpoint`, exactly what the shipped `toClass_toPointMap` supplies for an isogeny whose point map is +-the geometric `toPointMap`) — the full naturality `α.Naturality ch hinj hfin` holds. +- +-This is the **unconditional** wiring requested for the Route-C `hnat` discharge: it threads the +-divisor-pushforward RHS (`classNorm_toClassEquiv'_some`) through the residue-degree-`1` +-identity `relNorm 𝔪 = comap 𝔪`, now **`PerfectField`-free** (`mk0_relNorm0_XYIdeal_eq_mk0_comap` → +-`ClassGroup.mk0_relNorm0_eq_mk0_comap_of_inertiaDeg_one`, `inertiaDeg' = 1` from +-`Ideal.inertiaDeg_under_eq_one_of_algHom_of_residueField_finrank_one`). The `relNorm`-vs-`comap` +-residue bookkeeping is *fully discharged*; the only carried datum is `hpoint`, the point-map ↔ +-`comap` agreement (Silverman III.3.4 for the actual point map), which is the genuine per-isogeny / +-base-change content (CoordHom data) — **not** a `PerfectField`/Galois obligation. +- +-Identical statement to `Naturality_of_toClassEquiv'_some_eq_comap`; provided under the +-`naturality_of_coordHom` name the Route-C assembly consumes. -/ ++/-- Naturality follows from the coordinate-ring comorphism and its agreement with the rational-point map. -/ + theorem naturality_of_coordHom + (ch : α.CoordHom) (hinj : Function.Injective ch.toAlgHom) + (hfin : @Module.Finite E.CoordinateRing E.CoordinateRing _ _ ch.toAlgebra.toModule) +@@ -617,7 +468,7 @@ for `β = φ + ψ`. At the point level, with the III.3.4 naturality + composite `picDual ∘ α.toAddMonoidHom` is `κ⁻¹ ∘ (classMap ∘ classNorm) ∘ κ`. + + **Honest scope note.** This is `φ* ∘ φ_*` (extension after norm) — the **opposite** order to the +-shipped `classNorm_comp_classMap` (`classNorm ∘ classMap = φ_* ∘ φ*`). The two orders are *not* ++`classNorm_comp_classMap` (`classNorm ∘ classMap = φ_* ∘ φ*`). The two orders are *not* + interchangeable from commutativity of `ClassGroup` alone (`f(g c) = g(f c)` needs `f ∘ g = g ∘ f` + as maps, not a commutative codomain), and mathlib provides only `relNorm_algebraMap` + (`relNorm ∘ map`), **not** `map ∘ relNorm = (·)^n`. The reverse-order class identity +@@ -664,6 +515,7 @@ theorem comp_eq_mulByInt_of_comp_eq_of_surjective + -- `g (f (g Q)) = g (m • Q) = m • g Q`, and the RHS `[m] (g Q) = m • g Q`. + rw [hf, g.map_zsmul, mulByInt_apply] + ++omit [WeierstrassCurve.IsElliptic E] in + /-- **Right-cancellation of a surjective additive point endomorphism (Silverman II.2.3, equality + form).** If `g : E.Point →+ E.Point` is **surjective** and two maps `f₁, f₂` agree after + post-composition with `g` (i.e. `f₁ ∘ g = f₂ ∘ g`), then `f₁ = f₂`. This is the abstract content of +@@ -730,9 +582,9 @@ theorem picDual_comp_toAddMonoidHom_of_surjective_degree (ch : α.CoordHom) + Silverman III.6.1(a)/III.6.2 states the dual is **unique**: `φ̂` is the *only* `δ` with + `δφ = [deg φ]`. The proof is right-cancellation of the surjective (nonconstant) `φ`. We give the + point-map form: +-from `(picDual α) ∘ α = [deg α]` (the shipped `picDual_comp_toAddMonoidHom_of_surjective`) and any ++from `(picDual α) ∘ α = [deg α]` (the `picDual_comp_toAddMonoidHom_of_surjective`) and any + hypothetical `β` with `β ∘ α = [deg α]`, the surjection `α` cancels on the right to force +-`picDual α = β`. Specialising `β` to the κ-transport of a *shipped* dual isogeny (e.g. the ++`picDual α = β`. Specialising `β` to the κ-transport of a dual isogeny (e.g. the + Verschiebung `V` of Frobenius `π`, with `V ∘ π = [q]` from `IsDualOf V π`) **identifies `picDual π` + with `V`** — the milestone "Pic⁰ dual of Frobenius = Verschiebung". -/ + +@@ -796,26 +648,23 @@ theorem picDual_eq_of_comp_toAddMonoidHom_eq_degree (ch : α.CoordHom) + ((picDual_comp_toAddMonoidHom_of_surjective_degree ch hinj hfin hnat hsurjDual + S S' hSR hS'FF).trans hβ.symm) + +-/-! #### Non-circular `picDual` of a *single* isogeny whose degree is independently known ++/-! #### Duals of isogenies with independently known degrees + +-The III.6.1(a) uniqueness `picDual_eq_of_comp_toAddMonoidHom_eq_degree` identifies `picDual α` with +-any point map `δ` satisfying `δ ∘ α = [deg α]` — **non-circularly whenever `deg α` is known +-independently** of the Pic⁰ chain. Two such cases, used to seed the dual algebra for `rπ − s`: ++The uniqueness statement in Silverman III.6.1(a) identifies `picDual α` with ++any point map `δ` satisfying `δ ∘ α = [deg α]`. For Frobenius, its degree ++is the field cardinality `q` and the composition with Verschiebung is `[q]`. ++For scalar multiplication `[n]`, the degree is `n²` and self-composition is ++`[n²]`. + +-* **`picDual π = V`** (Frobenius dual = Verschiebung), where `deg π = #K = q` is shipped +- (`frobeniusIsog_degree`) and `V ∘ π = [q]` comes from `IsDualOf V π`. +-* **`picDual [n] = [n]`** (scalar self-dual, III.6.2(b)/(d)), where `deg [n] = n²` and +- `[n] ∘ [n] = [n²]` are shipped (`mulByInt_degree`, `mulByInt_comp_eq_mul`). +- +-Both are genuinely non-circular: the degree of a *single* Frobenius / scalar is shipped, unlike +-`deg(rπ − s)` (which is the Route-C conclusion). They are the seeds for the dual-additivity step +-`picDual(rπ − s) = rV − s` — whose *combination* nonetheless needs III.6.2(c) (see the note in +-`RouteCGeometric.lean`). -/ ++These degree calculations identify the individual duals without assuming ++the degree formula for `rπ − s`. The further formula ++`picDual(rπ − s) = rV − s` requires dual additivity, Silverman III.6.2(c). ++-/ + + /-- **`picDual α = δ` when `δ ∘ α = [d]` and `α.degree = d` (degree given as data, non-circular).** + +-The III.6.1(a) uniqueness specialised to an *explicit integer degree* `d`: if `α.degree = d` (an +-**independently-shipped** degree, e.g. `frobeniusIsog_degree`, `mulByInt_degree`) and a point map ++The III.6.1(a) uniqueness specialised to an *explicit integer degree* `d`: if `α.degree = d` (a ++**known** degree, e.g. `frobeniusIsog_degree`, `mulByInt_degree`) and a point map + `δ` satisfies `δ ∘ α = [d]`, then `picDual α = δ`. This is the non-circular seed form (it does not + route through the Pic⁰ push-pull degree, only through the *given* `d`). -/ + theorem picDual_eq_of_comp_toAddMonoidHom_eq_of_degree_eq (ch : α.CoordHom) +@@ -847,11 +696,11 @@ The III.6.2(b) dual-of-composition `(φ∘ψ)^ = ψ̂∘φ̂` specialised to `r + `picDual_eq_of_comp_toAddMonoidHom_eq_of_degree_eq` with the **independently-known** degree + `deg(r • α) = deg α · r²` (`Isogeny.zsmul_degree` / `mulByInt_degree`) and the composite + `(r • δ) ∘ (r • α) = r² • (δ ∘ α) = r² • [deg α] = [r² · deg α]`, where `δ` is the dual value of `α` +-(any point map with `δ ∘ α = [deg α]`, e.g. the κ-transport of a shipped `IsDualOf` partner). ++(any point map with `δ ∘ α = [deg α]`, e.g. the κ-transport of a `IsDualOf` partner). + +-This is **non-circular**: it routes only through the *given* degree `deg α` (independently shipped ++This is **non-circular**: it routes only through the *given* degree `deg α` (independently + for a single Frobenius / scalar / `α`), never through the Pic⁰ push-pull degree of `r • α`. It is +-the generic engine behind the Route-C seed `picDual(rπ) = rV` (take `α = π`, `δ = V`, ++the generic engine behind the dual-additivity seed `picDual(rπ) = rV` (take `α = π`, `δ = V`, + `deg π = #K = q`). + + Residuals: the per-`(r • α)` CoordHom data (`chr` + the two surjectivities + tower `(S, S')`), +@@ -898,10 +747,10 @@ theorem picDual_zsmul_eq_zsmul_of_comp_eq + exact picDual_eq_of_comp_toAddMonoidHom_eq_of_degree_eq chr hinjr hfinr hnatr hsurjDualr + hsurjr S S' hSR hS'FF hdeg hcomp + +-/-- **`picDual(r • α) = r • α̂` from a shipped `IsDualOf` partner (route-2 seed, `IsDualOf` form).** ++/-- **`picDual(r • α) = r • α̂` from a `IsDualOf` partner (route-2 seed, `IsDualOf` form).** + + As `picDual_zsmul_eq_zsmul_of_comp_eq`, but taking the dual value of `α` in the *full-isogeny* +-`IsDualOf δ_isog α` form (`δ_isog ∘ α = [deg α]`), which is how the Route-C Vieta bundle supplies it ++`IsDualOf δ_isog α` form (`δ_isog ∘ α = [deg α]`), which is how the dual-additivity Vieta bundle supplies it + (e.g. `IsDualOf V π`). Concludes `picDual(r • α) = r • δ_isog` at the point-map level. -/ + theorem picDual_zsmul_eq_zsmul_of_isDual + {α δ_isog : Isogeny E E} (r : ℤ) (hr : r ≠ 0) +@@ -932,10 +781,10 @@ The Silverman III.8 trace relation `α + α̂ = [tr α]` *determines* `α̂` onc + `δ` satisfies the *same* relation `α + δ = [tr α]`: subtract `α` to get `α̂ = [tr α] − α = δ`. This + is a pure point-group cancellation (no degree, no uniqueness, **non-circular**). + +-It is the final algebraic step of the Route-C dual-additivity output `picDual(rπ−s) = rV − s`: with ++It is the final algebraic step of the dual-additivity dual-additivity output `picDual(rπ−s) = rV − s`: with + `α = rπ − s`, the irreducible input `htrace_dual` is III.8 for `α` (equivalently III.6.2(c) + additivity, since `tr(rπ−s) = r·t − 2s`), while the candidate identity `htrace_delta` +-(`α + (rV − s) = [r·t − 2s]`) is derived *non-circularly* from the shipped `π + V = [t]`. This ++(`α + (rV − s) = [r·t − 2s]`) is derived *non-circularly* from the `π + V = [t]`. This + lemma performs the subtraction generically. -/ + theorem picDual_eq_of_trace_relations (ch : α.CoordHom) + (hinj : Function.Injective ch.toAlgHom) +@@ -958,7 +807,7 @@ maps).** + The point-map identity `(r·π − s) + (r·V − s) = [r·t − 2s]` for abstract endomorphisms `π, V` of + `E.Point` satisfying `π + V = [t]` (the Frobenius trace relation). This is the **non-circular** + half +-of the Route-C dual-additivity output: pointwise ++of the dual-additivity dual-additivity output: pointwise + `r·π P − s·P + r·V P − s·P = r·(π P + V P) − 2s·P = r·(t·P) − 2s·P = (r·t − 2s)·P`. + + It carries no `picDual` and no degree — pure point-group algebra from `hsum` — and is the candidate +@@ -990,8 +839,8 @@ Pic⁰ dual `picDual α` equals `r·V − s` — *provided* the Silverman III.8 + `htrace_dual` is the **single irreducible residual** (Silverman III.8 for `α`, equivalently + III.6.2(c) additivity since `tr α = r·t − 2s`); everything else — the candidate trace half + `smul_sub_add_smul_sub_eq_mulByInt` — is **non-circular** from `hsum`. This is the engine that +-discharges the Route-C `hpicval` (take `α = rπ − s`, `π = π.toAddMonoidHom`, `V = V.toAddMonoidHom`; +-`hbeta` is the `rfl`-true `genuineIsogSmulSub_toAddMonoidHom`-shape and `hsum` the shipped ++discharges the dual-additivity `hpicval` (take `α = rπ − s`, `π = π.toAddMonoidHom`, `V = V.toAddMonoidHom`; ++`hbeta` is the `rfl`-true `genuineIsogSmulSub_toAddMonoidHom`-shape and `hsum` the + `π + V = [t]`). The per-piece `picDual` values `picDual π = V`, `picDual(rπ) = rV`, + `picDual [n] = [n]` (the non-circular seeds) are exactly what `htrace_dual` decomposes into. -/ + theorem picDual_eq_smul_sub_of_sum_trace (ch : α.CoordHom) +diff --git a/projects/HasseWeil/HasseWeil/Pic0/ToClassSurjective.lean b/projects/HasseWeil/HasseWeil/Pic0/ToClassSurjective.lean +index 31ceaa04d..e7193a4aa 100644 +--- a/projects/HasseWeil/HasseWeil/Pic0/ToClassSurjective.lean ++++ b/projects/HasseWeil/HasseWeil/Pic0/ToClassSurjective.lean +@@ -9,88 +9,6 @@ import Mathlib.RingTheory.OrderOfVanishing.Basic + import Mathlib.RingTheory.Polynomial.DegreeLT + import HasseWeil.Foundation.Ramification + +-/-! +-# Surjectivity of `Point.toClass` and the isomorphism `E ≅ Pic⁰(E)` (affine model) +- +-For a Weierstrass curve `W : WeierstrassCurve.Affine F` over a field `F`, mathlib provides the +-group homomorphism +- +-``` +-WeierstrassCurve.Affine.Point.toClass : W.Point →+ Additive (ClassGroup W.CoordinateRing) +-``` +- +-(`Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean`) sending the point at infinity to `0` +-and an affine point `P = (x, y)` to the class of the fractional ideal `⟨X - x, Y - y⟩`. Mathlib +-proves this is **injective** (`WeierstrassCurve.Affine.Point.toClass_injective`), realising +-`W.Point` as a subgroup of the affine ideal class group. It does **not** prove surjectivity. +- +-This file packages the surjectivity. The statement that every ideal class is the class of some +-`XYIdeal'` (or trivial) is the genus-1 divisor-reduction theorem: on a smooth genus-1 curve every +-degree-0 divisor class is represented by `(P) - (O)`. We isolate that statement as the +-predicate `ClassRepresentableByPoints W` and prove that it is *equivalent* to surjectivity of +-`toClass`, and that surjectivity packages into the group isomorphism +-`W.Point ≃+ Additive (ClassGroup W.CoordinateRing)`. +- +-## Main definitions +- +-* `WeierstrassCurve.Affine.Point.ClassRepresentableByPoints`: the predicate that every element of +- `ClassGroup W.CoordinateRing` is trivial or the class of `XYIdeal' h` for a nonsingular point. +-* `WeierstrassCurve.Affine.Point.ClassReducesToCodimLEOne`: the genus-1 reduction input — every +- nonzero integral ideal class has a representative of `F`-codimension `≤ 1`. This is now **proved +- unconditionally** (`classReducesToCodimLEOne_holds`). +-* `WeierstrassCurve.Affine.Point.toClassEquiv'`: the **unconditional** group isomorphism +- `W.Point ≃+ Additive (ClassGroup W.CoordinateRing)` for `[W.IsElliptic]`, built from injectivity + +- the unconditional surjectivity `toClass_surjective'`. +- +-## Main results +- +-The **norm-degree dictionary** (the surjectivity counterpart of mathlib's `natDegree_norm_ne_one`, +-which powers `toClass_injective`), all axiom-clean: +- +-* `eq_XYIdeal_of_finrank_quotient_eq_one`: every nonzero ideal `I` with `finrank F (R/I) = 1` is +- the point ideal `XYIdeal W x (C y)` of a (necessarily nonsingular, under `[W.IsElliptic]`) point. +-* `mk0_eq_one_of_finrank_quotient_eq_zero` and +- `mk0_eq_mk_XYIdeal'_of_finrank_quotient_eq_one`: the two codimension endpoints, identifying +- codimension `0` (resp. `1`) ideals with the trivial class (resp. a point class). +-* `integralIdealRepresentableByPoints_of_classReducesToCodimLEOne` and +- `toClass_surjective_of_classReducesToCodimLEOne`: the codimension reduction predicate implies the +- integral-ideal reduction, hence surjectivity of `toClass` (using the now axiom-clean Dedekind +- instance `HasseWeil.coordinateRing_isDedekindDomain`). +- +-and the unconditional headline results: +- +-* `toClass_surjective'`: **unconditional** surjectivity of `toClass` for `[W.IsElliptic]`. +-* `toClassEquiv'`: the **unconditional** isomorphism `W.Point ≃+ Pic⁰(E)`. +- +-## Implementation notes +- +-The full unconditional surjectivity reduces, via three landed and axiom-clean ingredients, to the +-genus-1 codimension reduction `ClassReducesToCodimLEOne`, which is **now also proved**. +- +-1. `IsDedekindDomain W.CoordinateRing` is **available and axiom-clean** via +- `HasseWeil.coordinateRing_isDedekindDomain` (imported here), which fires under `[W.IsElliptic]`. +- +-2. **The ring-theoretic codimension infrastructure** (field-agnostic, no `[Fintype F]`): +- * `finiteDimensional_quotient_of_ne_bot`: every nonzero ideal has finite `F`-codimension. +- * `finrank_quotient_smul`: codimension additivity for multiplication by a *principal* ideal. +- * `finrank_quotient_mul`: the **general** codimension additivity +- `finrank F (R ⧸ I·J) = finrank F (R ⧸ I) + finrank F (R ⧸ J)` for arbitrary nonzero `I, J`, +- via the short exact sequence `0 → I/(I·J) → R/(I·J) → R/I → 0` +- (`Submodule.quotientQuotientEquivQuotient` + `Submodule.finrank_quotient_add_finrank`) and the +- invertible-ideal kernel isomorphism `quotIdealMulEquiv : I/(I·J) ≃ R/J` built from mathlib's +- `FractionalIdeal.quotientEquiv`. +- +-3. **The genus-1 reduction proper**, `classReducesToCodimLEOne_holds`: every nonzero integral ideal +- class has a representative of `F`-codimension `≤ 1` (Riemann–Roch for `g = 1`). Proved from the +- concrete Riemann–Roch inequality `exists_mem_norm_natDegree_le` (every nonzero ideal `I` has a +- nonzero element of norm degree `≤ finrank F (R ⧸ I) + 1`, by an exact `F`-dimension count using +- `CoordinateRing.degree_norm_smul_basis` and rank–nullity) plus the general additivity (2): from a +- small-norm element of a representative of the inverse class, the Dedekind factorisation +- `(a) = I'·J` yields a codimension-`≤ 1` representative of the class. +- +-Everything in this file is `#print axioms`-clean (`[propext, Classical.choice, Quot.sound]`), +-including the unconditional `toClass_surjective'` and `toClassEquiv'`. +--/ + + open Polynomial Module + +@@ -240,10 +158,8 @@ theorem eq_of_le_of_finrank_quotient_eq {I J : Ideal W.CoordinateRing} (hJI : J + exact (Submodule.Quotient.mk_eq_zero _).mp hr0 + + omit [DecidableEq F] in +-/-- **An `F`-algebra hom `R → F` from a codimension-1 quotient.** If `R/I` is 1-dimensional over the +-field `F`, then `algebraMap F (R/I)` is an isomorphism, and composing its inverse with the quotient +-map gives an `F`-algebra hom `φ : R →ₐ[F] F` whose kernel is exactly `I`. Evaluating `φ` at the +-images of `X` and `Y` will produce the point. -/ ++ ++ + theorem exists_algHom_ker_eq_of_finrank_quotient_eq_one (I : Ideal W.CoordinateRing) + [Nontrivial (W.CoordinateRing ⧸ I)] + (hfin : Module.finrank F (W.CoordinateRing ⧸ I) = 1) : +@@ -289,8 +205,8 @@ theorem equation_of_algHom (φ : W.CoordinateRing →ₐ[F] F) : + exact heq.symm + + omit [DecidableEq F] in +-/-- The images of `X - x` and `Y - y` in `R` lie in the kernel of `φ` whenever +-`x = φ(X̄)` and `y = φ(Ȳ)`. -/ ++ ++ + theorem algHom_XClass_eq_zero (φ : W.CoordinateRing →ₐ[F] F) : + φ (CoordinateRing.XClass W (φ (CoordinateRing.mk W (C X)))) = 0 := by + set x := φ (CoordinateRing.mk W (C X)) with hx +@@ -303,7 +219,7 @@ theorem algHom_XClass_eq_zero (φ : W.CoordinateRing →ₐ[F] F) : + rw [Algebra.algebraMap_self_apply, sub_self] + + omit [DecidableEq F] in +-/-- The image of `Y - y` in `R` lies in the kernel of `φ` whenever `y = φ(Ȳ)`. -/ ++ + theorem algHom_YClass_eq_zero (φ : W.CoordinateRing →ₐ[F] F) : + φ (CoordinateRing.YClass W (C (φ (CoordinateRing.mk W Y)))) = 0 := by + set y := φ (CoordinateRing.mk W Y) with hy +@@ -328,9 +244,9 @@ theorem eq_XYIdeal_of_finrank_quotient_eq_one [W.IsElliptic] (I : Ideal W.Coordi + set y := φ (CoordinateRing.mk W Y) with hy + have hEq : W.Equation x y := equation_of_algHom φ + have hNS : W.Nonsingular x y := (equation_iff_nonsingular).mp hEq +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ CoordinateRing.XYIdeal W x (C y)) := ++ have : FiniteDimensional F (W.CoordinateRing ⧸ CoordinateRing.XYIdeal W x (C y)) := + finiteDimensional_quotient_XYIdeal hEq +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ I) := ++ have : FiniteDimensional F (W.CoordinateRing ⧸ I) := + Module.finite_of_finrank_eq_succ hfin + refine ⟨x, y, hNS, ?_⟩ + have hsub : CoordinateRing.XYIdeal W x (C y) ≤ I := by +@@ -352,9 +268,7 @@ theorem finiteDimensional_quotient_of_ne_bot [W.IsElliptic] (I : Ideal W.Coordin + classical + exact Module.Finite.equiv (Ideal.quotientEquivDirectSum F (CoordinateRing.basis W) hI).symm + +-/-- **The degree of an ideal of `F[X]`.** For an ideal `J` of the PID `F[X]`, the natural degree of +-its monic generator. On `⊥` it is `0`; on a nonzero ideal `⟨g⟩` it is `g.natDegree`. This packages +-the codimension `finrank F (F[X] ⧸ J)` purely polynomially. -/ ++ + noncomputable def idealNatDegree (J : Ideal F[X]) : ℕ := + (Submodule.IsPrincipal.generator J).natDegree + +@@ -422,10 +336,10 @@ theorem finrank_quotient_eq_sum_smithCoeffs [W.IsElliptic] (I : Ideal W.Coordina + Module.finrank F (W.CoordinateRing ⧸ I) + = ∑ i, (Ideal.smithCoeffs (CoordinateRing.basis W) I hI i).natDegree := by + classical +- haveI hFree : ∀ i, Module.Free F ++ have hFree : ∀ i, Module.Free F + (F[X] ⧸ Ideal.span ({Ideal.smithCoeffs (CoordinateRing.basis W) I hI i} : Set F[X])) := + fun i ↦ inferInstance +- haveI hFin : ∀ i, Module.Finite F ++ have hFin : ∀ i, Module.Finite F + (F[X] ⧸ Ideal.span ({Ideal.smithCoeffs (CoordinateRing.basis W) I hI i} : Set F[X])) := + fun i ↦ inferInstance + rw [Ideal.finrank_quotient_eq_sum (I := I) (hI := hI) F (CoordinateRing.basis W)] +@@ -443,12 +357,8 @@ theorem smul_ideal_eq_span_mul (a : W.CoordinateRing) (I : Ideal W.CoordinateRin + · rintro ⟨z, hz, rfl⟩; exact ⟨z, hz, by rw [smul_eq_mul]⟩ + + omit [DecidableEq F] in +-/-- **Codimension additivity for multiplication by a principal ideal.** For a nonzero `a ∈ R` and a +-nonzero ideal `I`, `finrank F (R ⧸ ⟨a⟩·I) = finrank F (R ⧸ I) + finrank F (R ⧸ ⟨a⟩)`. This is the +-additivity of `F`-codimension along the multiplication-by-`a` short exact sequence +-`R ⧸ I → R ⧸ (a•I) → R ⧸ ⟨a⟩` (`Ideal.mulQuot`/`Ideal.quotOfMul`, restricted to `F`-linear maps and +-fed to `Module.length_eq_add_of_exact`, with `Module.length F = finrank F` over the field `F`). +-It is the special case of the genus-1 norm-degree additivity for a principal factor. -/ ++ ++ + theorem finrank_quotient_smul [W.IsElliptic] {a : W.CoordinateRing} (ha : a ≠ 0) + (I : Ideal W.CoordinateRing) (hI : I ≠ ⊥) : + Module.finrank F (W.CoordinateRing ⧸ (a • I)) = +@@ -459,17 +369,17 @@ theorem finrank_quotient_smul [W.IsElliptic] {a : W.CoordinateRing} (ha : a ≠ + have haspan : Ideal.span ({a} : Set W.CoordinateRing) ≠ ⊥ := by + rwa [Ne, Ideal.span_singleton_eq_bot] + have haI : a • I ≠ ⊥ := by rw [smul_ideal_eq_span_mul]; exact mul_ne_zero haspan hI +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ Ideal.span ({a} : Set W.CoordinateRing)) := ++ have : FiniteDimensional F (W.CoordinateRing ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI ++ have : FiniteDimensional F (W.CoordinateRing ⧸ Ideal.span ({a} : Set W.CoordinateRing)) := + finiteDimensional_quotient_of_ne_bot _ haspan +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ (a • I)) := ++ have : FiniteDimensional F (W.CoordinateRing ⧸ (a • I)) := + finiteDimensional_quotient_of_ne_bot _ haI + have hlen := Module.length_eq_add_of_exact + ((Ideal.mulQuot a I).restrictScalars F) ((Ideal.quotOfMul a I).restrictScalars F) + (Ideal.mulQuot_injective I hanz) (Ideal.quotOfMul_surjective I) + (Ideal.exact_mulQuot_quotOfMul I) + rw [Module.length_eq_finrank, Module.length_eq_finrank, Module.length_eq_finrank, +- ← Nat.cast_add, ENat.coe_inj] at hlen ++ ← Nat.cast_add, ENat.natCast_inj] at hlen + exact hlen + + omit [DecidableEq F] in +@@ -554,10 +464,8 @@ private noncomputable def quotEquivOneCoeIdealQuot_aux [W.IsElliptic] {J : Ideal + exact hry + + omit [DecidableEq F] in +-/-- **The invertible-ideal quotient isomorphism `I/(I·J) ≃ R/J`.** For nonzero ideals `I, J` of the +-(Dedekind) coordinate ring `R`, the `R`-module quotient of the ideal `I` (viewed as a submodule of +-`R`) by its submodule `I·J` is `R`-linearly isomorphic to `R/J`; this holds because `I` is +-invertible. -/ ++ ++ + noncomputable def quotIdealMulEquiv [W.IsElliptic] {I J : Ideal W.CoordinateRing} + (hI : I ≠ ⊥) (hJ : J ≠ ⊥) : + ((I : Submodule W.CoordinateRing W.CoordinateRing) ⧸ +@@ -582,23 +490,17 @@ noncomputable def quotIdealMulEquiv [W.IsElliptic] {I J : Ideal W.CoordinateRing + (eqe.trans (quotEquivOneCoeIdealQuot_aux hinj).symm) + + omit [DecidableEq F] in +-/-- **General codimension additivity.** For arbitrary nonzero ideals `I, J` of +-`R := W.CoordinateRing`, +-`finrank F (R ⧸ I·J) = finrank F (R ⧸ I) + finrank F (R ⧸ J)`. This upgrades `finrank_quotient_smul` +-(the principal-factor case) to all factors, via the short exact sequence +-`0 → I/(I·J) → R/(I·J) → R/I → 0` (`Submodule.quotientQuotientEquivQuotient` + +-`Submodule.finrank_quotient_add_finrank`) together with the invertible-ideal kernel identification +-`I/(I·J) ≃ R/J` (`quotIdealMulEquiv`). It is the genus-1 norm-degree additivity in `F`-codimension +-form. -/ ++ ++ + theorem finrank_quotient_mul [W.IsElliptic] {I J : Ideal W.CoordinateRing} + (hI : I ≠ ⊥) (hJ : J ≠ ⊥) : + Module.finrank F (W.CoordinateRing ⧸ (I * J)) = + Module.finrank F (W.CoordinateRing ⧸ I) + Module.finrank F (W.CoordinateRing ⧸ J) := by + have hIJ : I * J ≠ ⊥ := mul_ne_zero hI hJ +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ (I * J)) := ++ have : FiniteDimensional F (W.CoordinateRing ⧸ (I * J)) := + finiteDimensional_quotient_of_ne_bot _ hIJ +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ J) := finiteDimensional_quotient_of_ne_bot _ hJ ++ have : FiniteDimensional F (W.CoordinateRing ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI ++ have : FiniteDimensional F (W.CoordinateRing ⧸ J) := finiteDimensional_quotient_of_ne_bot _ hJ + have hIJ_le : I * J ≤ I := Ideal.mul_le_left + set M : Submodule (W.CoordinateRing) (W.CoordinateRing ⧸ (I * J)) := + Submodule.map (Submodule.mkQ (I * J)) +@@ -620,7 +522,7 @@ theorem finrank_quotient_mul [W.IsElliptic] {I J : Ideal W.CoordinateRing} + have e3 : (LinearMap.range g) ≃ₗ[R] M := LinearEquiv.ofEq _ _ hrange + exact ((Submodule.quotEquivOfEq _ _ hker.symm).trans (g.quotKerEquivRange.trans e3)).symm + have eM : M ≃ₗ[W.CoordinateRing] (W.CoordinateRing ⧸ J) := e2a.trans (quotIdealMulEquiv hI hJ) +- haveI : FiniteDimensional F M := (eM.restrictScalars F).symm.finiteDimensional ++ have : FiniteDimensional F M := (eM.restrictScalars F).symm.finiteDimensional + have key : Module.finrank F ((W.CoordinateRing ⧸ (I * J)) ⧸ (M.restrictScalars F)) + + Module.finrank F (M.restrictScalars F) = Module.finrank F (W.CoordinateRing ⧸ (I * J)) := + Submodule.finrank_quotient_add_finrank (M.restrictScalars F) +@@ -666,7 +568,7 @@ theorem mk0_eq_mk_XYIdeal'_of_finrank_quotient_eq_one [W.IsElliptic] (J : Ideal + (hfin : Module.finrank F (W.CoordinateRing ⧸ J) = 1) : + ∃ (x y : F) (h : W.Nonsingular x y), + ClassGroup.mk0 ⟨J, hmem⟩ = ClassGroup.mk W.FunctionField (CoordinateRing.XYIdeal' h) := by +- haveI : Nontrivial (W.CoordinateRing ⧸ J) := Module.nontrivial_of_finrank_eq_succ hfin ++ have : Nontrivial (W.CoordinateRing ⧸ J) := Module.nontrivial_of_finrank_eq_succ hfin + obtain ⟨x, y, h, hJ⟩ := eq_XYIdeal_of_finrank_quotient_eq_one J hfin + have hmem' : CoordinateRing.XYIdeal W x (C y) ∈ (Ideal W.CoordinateRing)⁰ := hJ ▸ hmem + refine ⟨x, y, h, ?_⟩ +@@ -723,10 +625,7 @@ private theorem two_nsmul_degree_le' {p : F[X]} {n : ℕ} (hp : p.degree < (n : + rw [nsmul_eq_mul]; push_cast; ring, Nat.cast_le] + lia + +-/-- **The basis-combination map** `(p, q) ↦ p · 1 + q · Ȳ`, restricted to polynomials of bounded +-degree (`degreeLT F a × degreeLT F b`), as an `F`-linear map into `R`. Its image is the space of +-elements whose norm degree we can control; its kernel intersected with the codimension count gives +-the Riemann–Roch element. -/ ++ + noncomputable def basisCombMap (W : WeierstrassCurve.Affine F) (a b : ℕ) : + (Polynomial.degreeLT F a × Polynomial.degreeLT F b) →ₗ[F] W.CoordinateRing where + toFun pq := (pq.1 : F[X]) • (1 : W.CoordinateRing) + (pq.2 : F[X]) • (CoordinateRing.basis W 1) +@@ -780,19 +679,15 @@ theorem basisCombMap_ne_zero {a b : ℕ} (pq : Polynomial.degreeLT F a × Polyno + exact Prod.ext (Subtype.ext hp) (Subtype.ext hq) + + omit [DecidableEq F] in +-/-- **The genus-1 Riemann–Roch inequality (concrete form).** Every nonzero ideal `I` of +-`R := W.CoordinateRing` contains a nonzero element `a` with `(Algebra.norm F[X] a).natDegree ≤ +-finrank F (R ⧸ I) + 1`. This is `ℓ(D) ≥ deg D` for `g = 1` made explicit, proved by the exact +-`F`-dimension count: the bounded-degree basis combinations form an `F`-subspace of dimension +-`ℓ + 1 > ℓ = finrank F (R ⧸ I)`, so rank–nullity for its composite into `R ⧸ I` forces a nonzero +-kernel element. No finiteness of `F` is needed (`F[X]` is Euclidean). -/ ++ ++ + theorem exists_mem_norm_natDegree_le [W.IsElliptic] (I : Ideal W.CoordinateRing) (hI : I ≠ ⊥) : + ∃ a ∈ I, a ≠ 0 ∧ + (Algebra.norm F[X] a).natDegree ≤ Module.finrank F (W.CoordinateRing ⧸ I) + 1 := by + classical + set R := W.CoordinateRing + set ℓ := Module.finrank F (R ⧸ I) with hℓ +- haveI : FiniteDimensional F (R ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI ++ have : FiniteDimensional F (R ⧸ I) := finiteDimensional_quotient_of_ne_bot _ hI + obtain ⟨da, hda⟩ : ∃ da, da = (ℓ + 1) / 2 + 1 := ⟨_, rfl⟩ + obtain ⟨db, hdb⟩ : ∃ db, db = ℓ / 2 := ⟨_, rfl⟩ + set ψ : (Polynomial.degreeLT F da × Polynomial.degreeLT F db) →ₗ[F] (R ⧸ I) := +@@ -809,7 +704,7 @@ theorem exists_mem_norm_natDegree_le [W.IsElliptic] (I : Ideal W.CoordinateRing) + have hrange_le : Module.finrank F (LinearMap.range ψ) ≤ ℓ := + le_trans (Submodule.finrank_le _) (le_of_eq hℓ.symm) + have hker_pos : 0 < Module.finrank F (LinearMap.ker ψ) := by lia +- haveI : Nontrivial (LinearMap.ker ψ) := Module.nontrivial_of_finrank_pos hker_pos ++ have : Nontrivial (LinearMap.ker ψ) := Module.nontrivial_of_finrank_pos hker_pos + obtain ⟨z, hz⟩ := exists_ne (0 : LinearMap.ker ψ) + set pq := (z : Polynomial.degreeLT F da × Polynomial.degreeLT F db) with hpq + have hpq_ne : pq ≠ 0 := fun h ↦ hz (Subtype.ext h) +@@ -873,7 +768,7 @@ theorem classReducesToCodimLEOne_holds [W.IsElliptic] : + rw [hI', inv_inv] at hmk0 + rcases Nat.le_one_iff_eq_zero_or_eq_one.mp hfinle with h0 | h1 + · left +- haveI : FiniteDimensional F (W.CoordinateRing ⧸ J) := ++ have : FiniteDimensional F (W.CoordinateRing ⧸ J) := + finiteDimensional_quotient_of_ne_bot _ (mem_nonZeroDivisors_iff_ne_zero.mp hJmem) + have hone : ClassGroup.mk0 ⟨J, hJmem⟩ = 1 := + mk0_eq_one_of_finrank_quotient_eq_zero J hJmem h0 diff --git a/lean/patches/AbsorptionCutoff-lean4341.patch b/lean/patches/AbsorptionCutoff-lean4341.patch index 6bf8b9b8ae5bf6eed37d3c73d9fd3e659f5bd942..2386161f30aa4691e22d4fc6864ee6847f59c20a 100644 --- a/lean/patches/AbsorptionCutoff-lean4341.patch +++ b/lean/patches/AbsorptionCutoff-lean4341.patch @@ -1,111 +1,111 @@ -diff --git a/AbsorptionCutoff/Supercritical/Renewal.lean b/AbsorptionCutoff/Supercritical/Renewal.lean -index be4e8d0..84e0b74 100644 ---- a/AbsorptionCutoff/Supercritical/Renewal.lean -+++ b/AbsorptionCutoff/Supercritical/Renewal.lean -@@ -599,7 +599,7 @@ theorem exists_pos_le_norm_one_sub_charFun {μ : Measure ℝ} [IsProbabilityMeas - have ht₀ne : t₀ ≠ 0 := by - intro h - have h' := ht₀K.2 -- simp only [Set.mem_setOf_eq, h, abs_zero] at h' -+ simp only [Set.mem_ofPred_eq, h, abs_zero] at h' - linarith - have hpos : 0 < ‖1 - charFun μ t₀‖ := by - rw [norm_pos_iff, sub_ne_zero] -@@ -1246,7 +1246,7 @@ theorem tendsto_driNorm_tail {g : ℝ → ℝ≥0∞} (hg : driNorm g ≠ ∞) : - have hkey := hS (Finset.Icc (-(N : ℤ)) (N : ℤ)) hsub - have hset : {k : ℤ | (N : ℤ) < |k|} = ((Finset.Icc (-(N : ℤ)) (N : ℤ) : Finset ℤ) : Set ℤ)ᶜ := by - ext k -- simp only [Set.mem_setOf_eq, Set.mem_compl_iff, Finset.coe_Icc, Set.mem_Icc] -+ simp only [Set.mem_ofPred_eq, Set.mem_compl_iff, Finset.coe_Icc, Set.mem_Icc] - rw [← not_le, abs_le] - rw [hset, ← tsum_subtype] - exact hkey -@@ -1431,7 +1431,7 @@ theorem exists_hasCompactSupport_driNorm_sub_lt {z : ℝ → ℂ} (hz : Continuo - exact ENNReal.ofReal_le_one.2 (cutoff_le_one M x) - · refine lt_of_le_of_lt (ENNReal.tsum_le_tsum fun k => ?_) hN - by_cases hk : (N : ℤ) < |k| -- · rw [Set.indicator_apply, if_pos (show k ∈ {k : ℤ | (N : ℤ) < |k|} from hk)] -+ · rw [Set.indicator_apply, ite_eq_left (show k ∈ {k : ℤ | (N : ℤ) < |k|} from hk)] - refine cellSup_mono (fun x => ?_) k - rw [show z x - (cutoff M x : ℂ) * z x = ((1 - cutoff M x : ℝ) : ℂ) * z x by push_cast; ring, - enorm_mul] -@@ -1439,7 +1439,7 @@ theorem exists_hasCompactSupport_driNorm_sub_lt {z : ℝ → ℂ} (hz : Continuo - rw [← ofReal_norm, Complex.norm_real, Real.norm_eq_abs, - abs_of_nonneg (by linarith [cutoff_le_one M x])] - exact ENNReal.ofReal_le_one.2 (by linarith [cutoff_nonneg M x]) -- · rw [Set.indicator_apply, if_neg (show k ∉ {k : ℤ | (N : ℤ) < |k|} from hk), -+ · rw [Set.indicator_apply, ite_eq_right (show k ∉ {k : ℤ | (N : ℤ) < |k|} from hk), - nonpos_iff_eq_zero] - refine iSup₂_eq_bot.2 fun x hx => ?_ - obtain ⟨h1, h2⟩ := abs_le.1 (not_lt.1 hk) -diff --git a/AbsorptionCutoff/Supercritical/RenewalApprox.lean b/AbsorptionCutoff/Supercritical/RenewalApprox.lean -index a394d70..d4094ca 100644 ---- a/AbsorptionCutoff/Supercritical/RenewalApprox.lean -+++ b/AbsorptionCutoff/Supercritical/RenewalApprox.lean -@@ -295,7 +295,7 @@ theorem exists_forall_norm_smoothed_sub_le {w : ℝ → ℂ} (hwc : Continuous w - · have h2M : ‖w (x - u) - w x‖ ≤ 2 * M := - le_trans (norm_sub_le _ _) (by linarith [hM (x - u), hM x]) - have : Set.indicator {u : ℝ | δ < |u|} (smoothKernel a) u = smoothKernel a u := by -- rw [Set.indicator_apply, if_pos (show u ∈ {u : ℝ | δ < |u|} from hu)] -+ rw [Set.indicator_apply, ite_eq_left (show u ∈ {u : ℝ | δ < |u|} from hu)] - rw [hg] - simp only [this] - nlinarith [mul_nonneg hε.le hK0] -@@ -309,7 +309,7 @@ theorem exists_forall_norm_smoothed_sub_le {w : ℝ → ℂ} (hwc : Continuous w - rw [dist_eq_norm] at this - linarith - have : Set.indicator {u : ℝ | δ < |u|} (smoothKernel a) u = 0 := by -- rw [Set.indicator_apply, if_neg (show u ∉ {u : ℝ | δ < |u|} from hu)] -+ rw [Set.indicator_apply, ite_eq_right (show u ∉ {u : ℝ | δ < |u|} from hu)] - rw [hg] - simp only [this] - nlinarith -diff --git a/lakefile.toml b/lakefile.toml -index 34acdfc..1a2b828 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,26 +4,26 @@ keywords = ["math"] - defaultTargets = ["AbsorptionCutoff"] - - [leanOptions] --pp.unicode.fun = true # pretty-prints `fun a ↦ b` -+pp.unicode.fun = true - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true - maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -- -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[require]] - name = "checkdecls" - git = "https://github.com/PatrickMassot/checkdecls.git" --[[lean_lib]] --name = "AbsorptionCutoff" - --# Mathlib-only comparator surface. Kept out of `defaultTargets` so a plain --# `lake build` never elaborates the intentional statement-level `sorry` that --# each `Challenge.lean` ends with. Build it with `lake build Audit`. - [[lean_lib]] --name = "Audit" --globs = ["Audit", "Audit.+"] -+name = "AbsorptionCutoff" -+globs = [ -+ "AbsorptionCutoff.Supercritical.Renewal", -+ "AbsorptionCutoff.Supercritical.RenewalAbel", -+ "AbsorptionCutoff.Supercritical.RenewalKernel", -+ "AbsorptionCutoff.Supercritical.RenewalSinc", -+ "AbsorptionCutoff.Supercritical.RenewalApprox" -+] -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f49..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/AbsorptionCutoff/Supercritical/Renewal.lean b/AbsorptionCutoff/Supercritical/Renewal.lean +index be4e8d0..84e0b74 100644 +--- a/AbsorptionCutoff/Supercritical/Renewal.lean ++++ b/AbsorptionCutoff/Supercritical/Renewal.lean +@@ -599,7 +599,7 @@ theorem exists_pos_le_norm_one_sub_charFun {μ : Measure ℝ} [IsProbabilityMeas + have ht₀ne : t₀ ≠ 0 := by + intro h + have h' := ht₀K.2 +- simp only [Set.mem_setOf_eq, h, abs_zero] at h' ++ simp only [Set.mem_ofPred_eq, h, abs_zero] at h' + linarith + have hpos : 0 < ‖1 - charFun μ t₀‖ := by + rw [norm_pos_iff, sub_ne_zero] +@@ -1246,7 +1246,7 @@ theorem tendsto_driNorm_tail {g : ℝ → ℝ≥0∞} (hg : driNorm g ≠ ∞) : + have hkey := hS (Finset.Icc (-(N : ℤ)) (N : ℤ)) hsub + have hset : {k : ℤ | (N : ℤ) < |k|} = ((Finset.Icc (-(N : ℤ)) (N : ℤ) : Finset ℤ) : Set ℤ)ᶜ := by + ext k +- simp only [Set.mem_setOf_eq, Set.mem_compl_iff, Finset.coe_Icc, Set.mem_Icc] ++ simp only [Set.mem_ofPred_eq, Set.mem_compl_iff, Finset.coe_Icc, Set.mem_Icc] + rw [← not_le, abs_le] + rw [hset, ← tsum_subtype] + exact hkey +@@ -1431,7 +1431,7 @@ theorem exists_hasCompactSupport_driNorm_sub_lt {z : ℝ → ℂ} (hz : Continuo + exact ENNReal.ofReal_le_one.2 (cutoff_le_one M x) + · refine lt_of_le_of_lt (ENNReal.tsum_le_tsum fun k => ?_) hN + by_cases hk : (N : ℤ) < |k| +- · rw [Set.indicator_apply, if_pos (show k ∈ {k : ℤ | (N : ℤ) < |k|} from hk)] ++ · rw [Set.indicator_apply, ite_eq_left (show k ∈ {k : ℤ | (N : ℤ) < |k|} from hk)] + refine cellSup_mono (fun x => ?_) k + rw [show z x - (cutoff M x : ℂ) * z x = ((1 - cutoff M x : ℝ) : ℂ) * z x by push_cast; ring, + enorm_mul] +@@ -1439,7 +1439,7 @@ theorem exists_hasCompactSupport_driNorm_sub_lt {z : ℝ → ℂ} (hz : Continuo + rw [← ofReal_norm, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (by linarith [cutoff_le_one M x])] + exact ENNReal.ofReal_le_one.2 (by linarith [cutoff_nonneg M x]) +- · rw [Set.indicator_apply, if_neg (show k ∉ {k : ℤ | (N : ℤ) < |k|} from hk), ++ · rw [Set.indicator_apply, ite_eq_right (show k ∉ {k : ℤ | (N : ℤ) < |k|} from hk), + nonpos_iff_eq_zero] + refine iSup₂_eq_bot.2 fun x hx => ?_ + obtain ⟨h1, h2⟩ := abs_le.1 (not_lt.1 hk) +diff --git a/AbsorptionCutoff/Supercritical/RenewalApprox.lean b/AbsorptionCutoff/Supercritical/RenewalApprox.lean +index a394d70..d4094ca 100644 +--- a/AbsorptionCutoff/Supercritical/RenewalApprox.lean ++++ b/AbsorptionCutoff/Supercritical/RenewalApprox.lean +@@ -295,7 +295,7 @@ theorem exists_forall_norm_smoothed_sub_le {w : ℝ → ℂ} (hwc : Continuous w + · have h2M : ‖w (x - u) - w x‖ ≤ 2 * M := + le_trans (norm_sub_le _ _) (by linarith [hM (x - u), hM x]) + have : Set.indicator {u : ℝ | δ < |u|} (smoothKernel a) u = smoothKernel a u := by +- rw [Set.indicator_apply, if_pos (show u ∈ {u : ℝ | δ < |u|} from hu)] ++ rw [Set.indicator_apply, ite_eq_left (show u ∈ {u : ℝ | δ < |u|} from hu)] + rw [hg] + simp only [this] + nlinarith [mul_nonneg hε.le hK0] +@@ -309,7 +309,7 @@ theorem exists_forall_norm_smoothed_sub_le {w : ℝ → ℂ} (hwc : Continuous w + rw [dist_eq_norm] at this + linarith + have : Set.indicator {u : ℝ | δ < |u|} (smoothKernel a) u = 0 := by +- rw [Set.indicator_apply, if_neg (show u ∉ {u : ℝ | δ < |u|} from hu)] ++ rw [Set.indicator_apply, ite_eq_right (show u ∉ {u : ℝ | δ < |u|} from hu)] + rw [hg] + simp only [this] + nlinarith +diff --git a/lakefile.toml b/lakefile.toml +index 34acdfc..1a2b828 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,26 +4,26 @@ keywords = ["math"] + defaultTargets = ["AbsorptionCutoff"] + + [leanOptions] +-pp.unicode.fun = true # pretty-prints `fun a ↦ b` ++pp.unicode.fun = true + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true + maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" +- ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[require]] + name = "checkdecls" + git = "https://github.com/PatrickMassot/checkdecls.git" +-[[lean_lib]] +-name = "AbsorptionCutoff" + +-# Mathlib-only comparator surface. Kept out of `defaultTargets` so a plain +-# `lake build` never elaborates the intentional statement-level `sorry` that +-# each `Challenge.lean` ends with. Build it with `lake build Audit`. + [[lean_lib]] +-name = "Audit" +-globs = ["Audit", "Audit.+"] ++name = "AbsorptionCutoff" ++globs = [ ++ "AbsorptionCutoff.Supercritical.Renewal", ++ "AbsorptionCutoff.Supercritical.RenewalAbel", ++ "AbsorptionCutoff.Supercritical.RenewalKernel", ++ "AbsorptionCutoff.Supercritical.RenewalSinc", ++ "AbsorptionCutoff.Supercritical.RenewalApprox" ++] +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f49..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/ClassFieldTheory-lean4341.patch b/lean/patches/ClassFieldTheory-lean4341.patch index bff9ccd8bcec226f594d0d2c359becebf06150b8..dbc569846ae53c9b01701417922e218c73734a61 100644 --- a/lean/patches/ClassFieldTheory-lean4341.patch +++ b/lean/patches/ClassFieldTheory-lean4341.patch @@ -1,31757 +1,31757 @@ -diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusGeometry.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusGeometry.lean -index ba13223..d57b89f 100644 ---- a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusGeometry.lean -+++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusGeometry.lean -@@ -4,19 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainNaturality --import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.DoubleCosetOrbitGeometry - --set_option autoImplicit false -+import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainTransferNormOrbitMk - --/-! --# Transfer--norm Frobenius geometry - --For a finite Galois extension and an intermediate field, this module builds the --Frobenius-side subgroup and orbit equivalences used in transfer--norm --naturality. The reusable orbit and double-coset constructions are isolated in --`DoubleCosetOrbitGeometry`. ---/ -+set_option autoImplicit false -+ - - universe u - -@@ -35,424 +28,9 @@ section transferFrobeniusGeometry - - variable {G : Type u} [Group G] [TopologicalSpace G] - --/-- The absolute group of an intermediate field, identified with its --literal copy inside the absolute group of the base field. -/ --noncomputable def transferNormNaturalityIntermediateAbsoluteEquiv -- (K K' : ClosedSubgroup G) -- (hK'K : K'.toSubgroup ≤ K.toSubgroup) : -- K'.toSubgroup ≃* extensionSubgroup K K' hK'K := -- MulEquiv.ofBijective -- ((Subgroup.inclusion hK'K).codRestrict -- (extensionSubgroup K K' hK'K) (fun k' => k'.2)) -- ⟨fun _ _ h => Subtype.ext (congrArg (fun z => z.1.1) h), by -- rintro ⟨k, hk'⟩ -- let k' : K'.toSubgroup := ⟨k.1, hk'⟩ -- exact ⟨k', Subtype.ext rfl⟩⟩ -- --/-- The absolute intermediate-field equivalence evaluates by the underlying transfer map. -/ --@[simp] --theorem transferNormNaturalityIntermediateAbsoluteEquiv_apply -- (K K' : ClosedSubgroup G) -- (hK'K : K'.toSubgroup ≤ K.toSubgroup) -- (k' : K'.toSubgroup) : -- ((transferNormNaturalityIntermediateAbsoluteEquiv K K' hK'K k').1 : G) = k'.1 := -- rfl -- --/-- Normality of `L | K` restricts to every intermediate field `K'`. -/ --theorem transferNormNaturality_intermediateExtension_normal -- (K K' L : ClosedSubgroup G) -- (hLK' : L.toSubgroup ≤ K'.toSubgroup) -- (hK'K : K'.toSubgroup ≤ K.toSubgroup) -- [hLnormal : (extensionSubgroup K L (hLK'.trans hK'K)).Normal] : -- (extensionSubgroup K' L hLK').Normal := by -- have hcomap : extensionSubgroup K' L hLK' = -- (extensionSubgroup K L (hLK'.trans hK'K)).comap -- (Subgroup.inclusion hK'K) := by -- ext k' -- rw [Subgroup.mem_comap, mem_extensionSubgroup_iff, -- mem_extensionSubgroup_iff] -- rfl -- rw [hcomap] -- exact hLnormal.comap (Subgroup.inclusion hK'K) - - namespace DegreeData - --/-- The restriction map on the infinite Frobenius quotients is injective --when the top field is unchanged. -/ --theorem transferNormNaturalityFrobeniusTowerMap_injective -- (D : DegreeData G) [IsTopologicalGroup G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -- Function.Injective -- (D.finiteReciprocityNaturalityFrobeniusTowerMap -- E.base.field E.field.field L L -- (hL.trans E.below) hL E.below le_rfl) := by -- intro x y -- refine QuotientGroup.induction_on x ?_ -- intro k' -- refine QuotientGroup.induction_on y ?_ -- intro l' h -- apply QuotientGroup.eq.mpr -- have hmem : -- (Subgroup.inclusion E.below k')⁻¹ * Subgroup.inclusion E.below l' ∈ -- D.extensionInertiaWithin E.base.field L (hL.trans E.below) := -- QuotientGroup.eq.mp h -- constructor -- · apply (mem_extensionSubgroup_iff E.field.field L hL (k'⁻¹ * l')).2 -- have hG := (mem_extensionSubgroup_iff E.base.field L -- (hL.trans E.below) -- ((Subgroup.inclusion E.below k')⁻¹ * -- Subgroup.inclusion E.below l')).1 hmem.1 -- simpa using hG -- · have hI := hmem.2 -- change D.degree (((Subgroup.inclusion E.below k')⁻¹ * -- Subgroup.inclusion E.below l' : E.base.field.toSubgroup) : G) = 1 at hI -- change D.degree ((k'⁻¹ * l' : E.field.field.toSubgroup) : G) = 1 -- exact hI -- --/-- The copy of `G(\widetilde L/K')` inside --`G(\widetilde L/K)`. This is the subgroup `H` used in the classical --double-coset proof of transfer--norm naturality. -/ --def transferNormNaturalityFrobeniusIntermediateSubgroup -- (D : DegreeData G) [IsTopologicalGroup G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -- Subgroup (E.base.field.toSubgroup ⧸ -- D.extensionInertiaWithin E.base.field L (hL.trans E.below)) := -- (D.finiteReciprocityNaturalityFrobeniusTowerMap -- E.base.field E.field.field L L -- (hL.trans E.below) hL E.below le_rfl).range -- --/-- The subgroup above is also the image of `G_K'` under the quotient --projection `G_K → G(\widetilde L/K)`. -/ --theorem transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -- (D : DegreeData G) [IsTopologicalGroup G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -- D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL = -- (extensionSubgroup E.base.field E.field.field E.below).map -- (QuotientGroup.mk' -- (D.extensionInertiaWithin E.base.field L -- (hL.trans E.below))) := by -- ext q -- constructor -- · rintro ⟨x, rfl⟩ -- refine QuotientGroup.induction_on x ?_ -- intro k' -- refine ⟨Subgroup.inclusion E.below k', ?_, rfl⟩ -- exact k'.2 -- · rintro ⟨k, hk', rfl⟩ -- let k' : E.field.field.toSubgroup := ⟨k.1, hk'⟩ -- refine ⟨QuotientGroup.mk k', ?_⟩ -- change QuotientGroup.mk (Subgroup.inclusion E.below k') = -- QuotientGroup.mk k -- rfl -- --/-- Quotient projection maps the literal absolute subgroup belonging to --`K'` onto its copy `H` inside `G(\widetilde L/K)`. -/ --noncomputable def transferNormNaturalityIntermediateToFrobeniusSubgroup -- (D : DegreeData G) [IsTopologicalGroup G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -- extensionSubgroup E.base.field E.field.field E.below →* -- D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL := by -- refine ((QuotientGroup.mk' -- (D.extensionInertiaWithin E.base.field L (hL.trans E.below))).comp -- (extensionSubgroup E.base.field E.field.field E.below).subtype).codRestrict -- (D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL) ?_ -- intro m -- change QuotientGroup.mk m.1 ∈ -- D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL -- rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -- E L hL] -- exact ⟨m.1, m.2, rfl⟩ -- --/-- The map from the intermediate quotient onto the Frobenius subgroup is surjective. -/ --theorem transferNormNaturalityIntermediateToFrobeniusSubgroup_surjective -- (D : DegreeData G) [IsTopologicalGroup G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -- Function.Surjective -- (D.transferNormNaturalityIntermediateToFrobeniusSubgroup -- E L hL) := by -- intro h -- have hh : h.1 ∈ -- (extensionSubgroup E.base.field E.field.field E.below).map -- (QuotientGroup.mk' -- (D.extensionInertiaWithin E.base.field L (hL.trans E.below))) := by -- rw [← D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -- E L hL] -- exact h.2 -- obtain ⟨m, hm, hval⟩ := hh -- refine ⟨⟨m, hm⟩, ?_⟩ -- apply Subtype.ext -- unfold transferNormNaturalityIntermediateToFrobeniusSubgroup -- simpa only [MonoidHom.codRestrict_apply, MonoidHom.comp_apply, -- Subgroup.subtype_apply] using hval -- --/-- The intermediate-to-Frobenius map has the stated value on each representative. -/ --@[simp] --theorem transferNormNaturalityIntermediateToFrobeniusSubgroup_apply -- (D : DegreeData G) [IsTopologicalGroup G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] -- (m : extensionSubgroup E.base.field E.field.field E.below) : -- (D.transferNormNaturalityIntermediateToFrobeniusSubgroup -- E L hL m).1 = -- (QuotientGroup.mk m.1 : E.base.field.toSubgroup ⧸ -- D.extensionInertiaWithin E.base.field L (hL.trans E.below)) := by -- rfl -- --/-- The canonical coset equivalence from `G_K/G_Σ` to --`G(\widetilde L/K)/Γ` intertwines the two copies of the `K'`-action. -/ --theorem frobeniusFixedCosetClosureEquiv_equivariant -- (D : DegreeData G) [IsTopologicalGroup G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] -- (σ : D.FrobeniusElements E.base L (hL.trans E.below)) -- (m : extensionSubgroup E.base.field E.field.field E.below) -- (x : E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field -- (D.frobeniusFixedField E.base L (hL.trans E.below) σ) -- (D.frobeniusFixedField_le E.base L (hL.trans E.below) σ)) : -- D.frobeniusFixedCosetClosureEquiv E.base L (hL.trans E.below) σ (m • x) = -- (D.transferNormNaturalityIntermediateToFrobeniusSubgroup -- E L hL m) • -- D.frobeniusFixedCosetClosureEquiv E.base L -- (hL.trans E.below) σ x := by -- refine Quotient.inductionOn' x ?_ -- intro k -- change QuotientGroup.mk (QuotientGroup.mk (m.1 * k)) = -- QuotientGroup.mk -- ((D.transferNormNaturalityIntermediateToFrobeniusSubgroup -- E L hL m).1 * QuotientGroup.mk k) -- rw [D.transferNormNaturalityIntermediateToFrobeniusSubgroup_apply] -- rfl -- --/-- Restriction from the infinite Frobenius quotient onto the finite --Galois quotient is surjective. -/ --theorem transferNormNaturalityExtensionRestriction_surjective -- (D : DegreeData G) -- (K L : ClosedSubgroup G) -- (hLK : L.toSubgroup ≤ K.toSubgroup) -- [hLnormal : (extensionSubgroup K L hLK).Normal] : -- Function.Surjective (D.extensionRestriction K L hLK) := by -- intro q -- refine QuotientGroup.induction_on q ?_ -- intro k -- exact ⟨QuotientGroup.mk k, rfl⟩ -- --/-- The kernel of restriction to `G(L/K)` is contained in the subgroup --coming from `G(\widetilde L/K')`. -/ --theorem transferNormNaturalityExtensionRestriction_ker_le_intermediate -- (D : DegreeData G) [IsTopologicalGroup G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -- (D.extensionRestriction E.base.field L (hL.trans E.below)).ker ≤ -- D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL := by -- rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -- E L hL] -- intro q hq -- revert hq -- refine QuotientGroup.induction_on q ?_ -- intro k hk -- change D.extensionRestriction E.base.field L (hL.trans E.below) -- (QuotientGroup.mk k) = 1 at hk -- rw [D.extensionRestriction_mk] at hk -- have hkL : k ∈ -- extensionSubgroup E.base.field L (hL.trans E.below) := by -- exact QuotientGroup.eq_one_iff k |>.1 hk -- have hkK' : k ∈ -- extensionSubgroup E.base.field E.field.field E.below := by -- apply (mem_extensionSubgroup_iff -- E.base.field E.field.field E.below k).2 -- exact hL ((mem_extensionSubgroup_iff E.base.field L -- (hL.trans E.below) k).1 hkL) -- exact ⟨k, hkK', rfl⟩ -- --/-- `H` has finite index in `G(\widetilde L/K)`, with no normality --assumption on the intermediate extension `K'/K`. -/ --theorem transferNormNaturalityFrobeniusIntermediateFiniteIndex -- (D : DegreeData G) [IsTopologicalGroup G] -- (R : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ R.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup R.base.field L (hL.trans R.below)).Normal] -- [hL'normal : (extensionSubgroup R.field.field L hL).Normal] : -- (D.transferNormNaturalityFrobeniusIntermediateSubgroup R L hL).FiniteIndex := by -- rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -- R L hL] -- let I := D.extensionInertiaWithin R.base.field L (hL.trans R.below) -- let M := extensionSubgroup R.base.field R.field.field R.below -- have hIM : I ≤ M := by -- intro k hk -- apply (mem_extensionSubgroup_iff -- R.base.field R.field.field R.below k).2 -- exact hL ((mem_extensionSubgroup_iff R.base.field L -- (hL.trans R.below) k).1 hk.1) -- let p := QuotientGroup.mk' I -- have hker : p.ker ≤ M := by -- simpa [p] using hIM -- let : M.FiniteIndex := Subgroup.finiteIndex_of_finite_quotient -- rw [Subgroup.finiteIndex_iff, -- M.index_map_eq (QuotientGroup.mk'_surjective I) hker] -- exact Subgroup.FiniteIndex.index_ne_zero -- --/-- The copy of `G(\widetilde L/K')` is closed in --`G(\widetilde L/K)`. -/ --theorem transferNormNaturalityFrobeniusIntermediate_isClosed -- (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -- IsClosed (D.transferNormNaturalityFrobeniusIntermediateSubgroup -- E L hL : Set -- (E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L -- (hL.trans E.below))) := by -- let : CompactSpace E.field.field.toSubgroup := -- isCompact_iff_compactSpace.mp E.field.field.isClosed'.isCompact -- let : IsClosed -- (D.extensionInertiaWithin E.field.field L hL : -- Set E.field.field.toSubgroup) := -- D.extensionInertiaWithin_isClosed E.field L hL -- let : IsClosed (D.extensionInertiaWithin E.base.field L -- (hL.trans E.below) : Set E.base.field.toSubgroup) := -- D.extensionInertiaWithin_isClosed E.base L (hL.trans E.below) -- let f := D.finiteReciprocityNaturalityFrobeniusTowerMapContinuous -- E.base.field E.field.field L L -- (hL.trans E.below) hL E.below le_rfl -- change IsClosed (Set.range f) -- have hrange : Set.range f = Set.range f.toContinuousMap := by -- ext y -- constructor <;> rintro ⟨x, rfl⟩ <;> exact ⟨x, rfl⟩ -- rw [hrange] -- simpa only [Set.image_univ] using -- (isCompact_univ.image f.continuous).isClosed -- --/-- The transfer-orbit index set --`⟨σ⟩ \ G(\widetilde L/K) / H` is canonically the norm double-coset --index set `G_K' \ G_K / G_Σ`. The equivalence is inversion of double --cosets, followed by passage from powers of `σ` to their closure `Γ` and --the canonical identification `G_K/G_Σ ≃ G(\widetilde L/K)/Γ`. -/ --noncomputable def transferNormNaturalityTransferNormOrbitEquiv -- (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] -- (σ : D.FrobeniusElements E.base L (hL.trans E.below)) : -- Quotient (orbitRel (Subgroup.zpowers σ.1) -- ((E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L -- (hL.trans E.below)) ⧸ -- D.transferNormNaturalityFrobeniusIntermediateSubgroup -- E L hL)) ≃ -- Quotient (orbitRel -- (extensionSubgroup E.base.field E.field.field E.below) -- (E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field -- (D.frobeniusFixedField E.base L (hL.trans E.below) σ) -- (D.frobeniusFixedField_le E.base L -- (hL.trans E.below) σ))) := by -- let P := E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L -- (hL.trans E.below) -- let H := D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL -- let M := extensionSubgroup E.base.field E.field.field E.below -- let Γ := D.frobeniusClosure E.base L (hL.trans E.below) σ -- let S := D.frobeniusFixedField E.base L (hL.trans E.below) σ -- let hSK := D.frobeniusFixedField_le E.base L (hL.trans E.below) σ -- let f : M →* H := D.transferNormNaturalityIntermediateToFrobeniusSubgroup -- E L hL -- let e := D.frobeniusFixedCosetClosureEquiv -- E.base L (hL.trans E.below) σ -- letI : H.FiniteIndex := -- D.transferNormNaturalityFrobeniusIntermediateFiniteIndex E L hL -- have hHclosed : IsClosed (H : Set P) := -- D.transferNormNaturalityFrobeniusIntermediate_isClosed E L hL -- have hΓ : -- (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup = Γ.toSubgroup := by -- simp [Γ, DegreeData.frobeniusClosure] -- let eΓ : P ⧸ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup ≃ -- P ⧸ Γ.toSubgroup := Subgroup.quotientEquivOfEq hΓ -- have heΓ (h : H) -- (x : P ⧸ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup) : -- eΓ (h • x) = h • eΓ x := by -- refine Quotient.inductionOn' x ?_ -- intro p -- rfl -- let eΓorbit := orbitQuotientEquivOfSurjectiveEquivariant -- (MonoidHom.id H) Function.surjective_id eΓ heΓ -- have hf : Function.Surjective f := -- D.transferNormNaturalityIntermediateToFrobeniusSubgroup_surjective -- E L hL -- have he (m : M) -- (x : E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field S hSK) : -- e (m • x) = f m • e x := by -- exact D.frobeniusFixedCosetClosureEquiv_equivariant -- E L hL σ m x -- let eAction := orbitQuotientEquivOfSurjectiveEquivariant f hf e he -- exact (orbitQuotientSwapEquiv (Subgroup.zpowers σ.1) H).trans -- ((orbitQuotientClosedCyclicEquiv H hHclosed σ.1).trans -- (eΓorbit.trans eAction.symm)) -- --/-- The transfer-norm orbit equivalence sends quotient representatives to their norm orbits. -/ --@[simp] --theorem transferNormNaturalityTransferNormOrbitEquiv_mk -- (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] -- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -- [hLnormal : -- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] -- (σ : D.FrobeniusElements E.base L (hL.trans E.below)) -- (k : E.base.field.toSubgroup) : -- D.transferNormNaturalityTransferNormOrbitEquiv E L hL σ -- (Quotient.mk'' (QuotientGroup.mk -- (QuotientGroup.mk k : E.base.field.toSubgroup ⧸ -- D.extensionInertiaWithin E.base.field L (hL.trans E.below)) : -- (E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L -- (hL.trans E.below)) ⧸ -- D.transferNormNaturalityFrobeniusIntermediateSubgroup -- E L hL)) = -- Quotient.mk'' (QuotientGroup.mk k⁻¹ : -- E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field -- (D.frobeniusFixedField E.base L (hL.trans E.below) σ) -- (D.frobeniusFixedField_le E.base L -- (hL.trans E.below) σ)) := by -- unfold transferNormNaturalityTransferNormOrbitEquiv -- simp only [Equiv.trans_apply, orbitQuotientSwapEquiv_mk, -- orbitQuotientClosedCyclicEquiv_mk, -- orbitQuotientEquivOfSurjectiveEquivariant_mk, -- orbitQuotientEquivOfSurjectiveEquivariant_symm_mk, -- Subgroup.quotientEquivOfEq_mk] -- apply congrArg Quotient.mk'' -- exact (D.frobeniusFixedCosetClosureEquiv E.base L -- (hL.trans E.below) σ).symm_apply_apply (QuotientGroup.mk k⁻¹) -- - /-- On the classical chosen transfer representative `t`, the preceding - equivalence is literally the norm orbit represented by `t⁻¹`. -/ - theorem transferNormNaturalityTransferNormOrbitEquiv_apply -diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusRestriction.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusRestriction.lean -new file mode 100644 -index 0000000..4f8dc8c ---- /dev/null -+++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusRestriction.lean -@@ -0,0 +1,142 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+ -+import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainTransferFrobeniusSubgroup -+ -+ -+set_option autoImplicit false -+ -+ -+universe u -+ -+namespace ClassFormation -+ -+open KummerTheory -+open CyclicCohomology -+open CategoryTheory -+ -+noncomputable section -+ -+open scoped BigOperators -+open MulAction -+ -+section transferFrobeniusGeometry -+ -+variable {G : Type u} [Group G] [TopologicalSpace G] -+ -+ -+namespace DegreeData -+ -+/-- Restriction from the infinite Frobenius quotient onto the finite -+Galois quotient is surjective. -/ -+theorem transferNormNaturalityExtensionRestriction_surjective -+ (D : DegreeData G) -+ (K L : ClosedSubgroup G) -+ (hLK : L.toSubgroup ≤ K.toSubgroup) -+ [hLnormal : (extensionSubgroup K L hLK).Normal] : -+ Function.Surjective (D.extensionRestriction K L hLK) := by -+ intro q -+ refine QuotientGroup.induction_on q ?_ -+ intro k -+ exact ⟨QuotientGroup.mk k, rfl⟩ -+ -+ -+theorem transferNormNaturalityExtensionRestriction_ker_le_intermediate -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -+ (D.extensionRestriction E.base.field L (hL.trans E.below)).ker ≤ -+ D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL := by -+ rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -+ E L hL] -+ intro q hq -+ revert hq -+ refine QuotientGroup.induction_on q ?_ -+ intro k hk -+ change D.extensionRestriction E.base.field L (hL.trans E.below) -+ (QuotientGroup.mk k) = 1 at hk -+ rw [D.extensionRestriction_mk] at hk -+ have hkL : k ∈ -+ extensionSubgroup E.base.field L (hL.trans E.below) := by -+ exact QuotientGroup.eq_one_iff k |>.1 hk -+ have hkK' : k ∈ -+ extensionSubgroup E.base.field E.field.field E.below := by -+ apply (mem_extensionSubgroup_iff -+ E.base.field E.field.field E.below k).2 -+ exact hL ((mem_extensionSubgroup_iff E.base.field L -+ (hL.trans E.below) k).1 hkL) -+ exact ⟨k, hkK', rfl⟩ -+ -+/-- `H` has finite index in `G(\widetilde L/K)`, with no normality -+assumption on the intermediate extension `K'/K`. -/ -+theorem transferNormNaturalityFrobeniusIntermediateFiniteIndex -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (R : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ R.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup R.base.field L (hL.trans R.below)).Normal] -+ [hL'normal : (extensionSubgroup R.field.field L hL).Normal] : -+ (D.transferNormNaturalityFrobeniusIntermediateSubgroup R L hL).FiniteIndex := by -+ rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -+ R L hL] -+ let I := D.extensionInertiaWithin R.base.field L (hL.trans R.below) -+ let M := extensionSubgroup R.base.field R.field.field R.below -+ have hIM : I ≤ M := by -+ intro k hk -+ apply (mem_extensionSubgroup_iff -+ R.base.field R.field.field R.below k).2 -+ exact hL ((mem_extensionSubgroup_iff R.base.field L -+ (hL.trans R.below) k).1 hk.1) -+ let p := QuotientGroup.mk' I -+ have hker : p.ker ≤ M := by -+ simpa [p] using hIM -+ let : M.FiniteIndex := Subgroup.finiteIndex_of_finite_quotient -+ rw [Subgroup.finiteIndex_iff, -+ M.index_map_eq (QuotientGroup.mk'_surjective I) hker] -+ exact Subgroup.FiniteIndex.index_ne_zero -+ -+/-- The copy of `G(\widetilde L/K')` is closed in -+`G(\widetilde L/K)`. -/ -+theorem transferNormNaturalityFrobeniusIntermediate_isClosed -+ (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -+ IsClosed (D.transferNormNaturalityFrobeniusIntermediateSubgroup -+ E L hL : Set -+ (E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L -+ (hL.trans E.below))) := by -+ let : CompactSpace E.field.field.toSubgroup := -+ isCompact_iff_compactSpace.mp E.field.field.isClosed'.isCompact -+ let : IsClosed -+ (D.extensionInertiaWithin E.field.field L hL : -+ Set E.field.field.toSubgroup) := -+ D.extensionInertiaWithin_isClosed E.field L hL -+ let : IsClosed (D.extensionInertiaWithin E.base.field L -+ (hL.trans E.below) : Set E.base.field.toSubgroup) := -+ D.extensionInertiaWithin_isClosed E.base L (hL.trans E.below) -+ let f := D.finiteReciprocityNaturalityFrobeniusTowerMapContinuous -+ E.base.field E.field.field L L -+ (hL.trans E.below) hL E.below le_rfl -+ change IsClosed (Set.range f) -+ have hrange : Set.range f = Set.range f.toContinuousMap := by -+ ext y -+ constructor <;> rintro ⟨x, rfl⟩ <;> exact ⟨x, rfl⟩ -+ rw [hrange] -+ simpa only [Set.image_univ] using -+ (isCompact_univ.image f.continuous).isClosed -+ -+ -+end DegreeData -+end transferFrobeniusGeometry -+end -+end ClassFormation -diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusSubgroup.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusSubgroup.lean -new file mode 100644 -index 0000000..d46fda8 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusSubgroup.lean -@@ -0,0 +1,249 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainNaturality -+import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.DoubleCosetOrbitGeometry -+ -+ -+set_option autoImplicit false -+ -+ -+universe u -+ -+namespace ClassFormation -+ -+open KummerTheory -+open CyclicCohomology -+open CategoryTheory -+ -+noncomputable section -+ -+open scoped BigOperators -+open MulAction -+ -+section transferFrobeniusGeometry -+ -+variable {G : Type u} [Group G] [TopologicalSpace G] -+ -+/-- The absolute group of an intermediate field, identified with its -+literal copy inside the absolute group of the base field. -/ -+noncomputable def transferNormNaturalityIntermediateAbsoluteEquiv -+ (K K' : ClosedSubgroup G) -+ (hK'K : K'.toSubgroup ≤ K.toSubgroup) : -+ K'.toSubgroup ≃* extensionSubgroup K K' hK'K := -+ MulEquiv.ofBijective -+ ((Subgroup.inclusion hK'K).codRestrict -+ (extensionSubgroup K K' hK'K) (fun k' => k'.2)) -+ ⟨fun _ _ h => Subtype.ext (congrArg (fun z => z.1.1) h), by -+ rintro ⟨k, hk'⟩ -+ let k' : K'.toSubgroup := ⟨k.1, hk'⟩ -+ exact ⟨k', Subtype.ext rfl⟩⟩ -+ -+/-- The absolute intermediate-field equivalence evaluates by the underlying transfer map. -/ -+@[simp] -+theorem transferNormNaturalityIntermediateAbsoluteEquiv_apply -+ (K K' : ClosedSubgroup G) -+ (hK'K : K'.toSubgroup ≤ K.toSubgroup) -+ (k' : K'.toSubgroup) : -+ ((transferNormNaturalityIntermediateAbsoluteEquiv K K' hK'K k').1 : G) = k'.1 := -+ rfl -+ -+/-- Normality of `L | K` restricts to every intermediate field `K'`. -/ -+theorem transferNormNaturality_intermediateExtension_normal -+ (K K' L : ClosedSubgroup G) -+ (hLK' : L.toSubgroup ≤ K'.toSubgroup) -+ (hK'K : K'.toSubgroup ≤ K.toSubgroup) -+ [hLnormal : (extensionSubgroup K L (hLK'.trans hK'K)).Normal] : -+ (extensionSubgroup K' L hLK').Normal := by -+ have hcomap : extensionSubgroup K' L hLK' = -+ (extensionSubgroup K L (hLK'.trans hK'K)).comap -+ (Subgroup.inclusion hK'K) := by -+ ext k' -+ rw [Subgroup.mem_comap, mem_extensionSubgroup_iff, -+ mem_extensionSubgroup_iff] -+ rfl -+ rw [hcomap] -+ exact hLnormal.comap (Subgroup.inclusion hK'K) -+ -+namespace DegreeData -+ -+/-- The restriction map on the infinite Frobenius quotients is injective -+when the top field is unchanged. -/ -+theorem transferNormNaturalityFrobeniusTowerMap_injective -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -+ Function.Injective -+ (D.finiteReciprocityNaturalityFrobeniusTowerMap -+ E.base.field E.field.field L L -+ (hL.trans E.below) hL E.below le_rfl) := by -+ intro x y -+ refine QuotientGroup.induction_on x ?_ -+ intro k' -+ refine QuotientGroup.induction_on y ?_ -+ intro l' h -+ apply QuotientGroup.eq.mpr -+ have hmem : -+ (Subgroup.inclusion E.below k')⁻¹ * Subgroup.inclusion E.below l' ∈ -+ D.extensionInertiaWithin E.base.field L (hL.trans E.below) := -+ QuotientGroup.eq.mp h -+ constructor -+ · apply (mem_extensionSubgroup_iff E.field.field L hL (k'⁻¹ * l')).2 -+ have hG := (mem_extensionSubgroup_iff E.base.field L -+ (hL.trans E.below) -+ ((Subgroup.inclusion E.below k')⁻¹ * -+ Subgroup.inclusion E.below l')).1 hmem.1 -+ simpa using hG -+ · have hI := hmem.2 -+ change D.degree (((Subgroup.inclusion E.below k')⁻¹ * -+ Subgroup.inclusion E.below l' : E.base.field.toSubgroup) : G) = 1 at hI -+ change D.degree ((k'⁻¹ * l' : E.field.field.toSubgroup) : G) = 1 -+ exact hI -+ -+/-- The copy of `G(\widetilde L/K')` inside -+`G(\widetilde L/K)`. This is the subgroup `H` used in the classical -+double-coset proof of transfer--norm naturality. -/ -+def transferNormNaturalityFrobeniusIntermediateSubgroup -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -+ Subgroup (E.base.field.toSubgroup ⧸ -+ D.extensionInertiaWithin E.base.field L (hL.trans E.below)) := -+ (D.finiteReciprocityNaturalityFrobeniusTowerMap -+ E.base.field E.field.field L L -+ (hL.trans E.below) hL E.below le_rfl).range -+ -+/-- The subgroup above is also the image of `G_K'` under the quotient -+projection `G_K → G(\widetilde L/K)`. -/ -+theorem transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -+ D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL = -+ (extensionSubgroup E.base.field E.field.field E.below).map -+ (QuotientGroup.mk' -+ (D.extensionInertiaWithin E.base.field L -+ (hL.trans E.below))) := by -+ ext q -+ constructor -+ · rintro ⟨x, rfl⟩ -+ refine QuotientGroup.induction_on x ?_ -+ intro k' -+ refine ⟨Subgroup.inclusion E.below k', ?_, rfl⟩ -+ exact k'.2 -+ · rintro ⟨k, hk', rfl⟩ -+ let k' : E.field.field.toSubgroup := ⟨k.1, hk'⟩ -+ refine ⟨QuotientGroup.mk k', ?_⟩ -+ change QuotientGroup.mk (Subgroup.inclusion E.below k') = -+ QuotientGroup.mk k -+ rfl -+ -+/-- Quotient projection maps the literal absolute subgroup belonging to -+`K'` onto its copy `H` inside `G(\widetilde L/K)`. -/ -+noncomputable def transferNormNaturalityIntermediateToFrobeniusSubgroup -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -+ extensionSubgroup E.base.field E.field.field E.below →* -+ D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL := by -+ refine ((QuotientGroup.mk' -+ (D.extensionInertiaWithin E.base.field L (hL.trans E.below))).comp -+ (extensionSubgroup E.base.field E.field.field E.below).subtype).codRestrict -+ (D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL) ?_ -+ intro m -+ change QuotientGroup.mk m.1 ∈ -+ D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL -+ rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -+ E L hL] -+ exact ⟨m.1, m.2, rfl⟩ -+ -+/-- The map from the intermediate quotient onto the Frobenius subgroup is surjective. -/ -+theorem transferNormNaturalityIntermediateToFrobeniusSubgroup_surjective -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : -+ Function.Surjective -+ (D.transferNormNaturalityIntermediateToFrobeniusSubgroup -+ E L hL) := by -+ intro h -+ have hh : h.1 ∈ -+ (extensionSubgroup E.base.field E.field.field E.below).map -+ (QuotientGroup.mk' -+ (D.extensionInertiaWithin E.base.field L (hL.trans E.below))) := by -+ rw [← D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map -+ E L hL] -+ exact h.2 -+ obtain ⟨m, hm, hval⟩ := hh -+ refine ⟨⟨m, hm⟩, ?_⟩ -+ apply Subtype.ext -+ unfold transferNormNaturalityIntermediateToFrobeniusSubgroup -+ simpa only [MonoidHom.codRestrict_apply, MonoidHom.comp_apply, -+ Subgroup.subtype_apply] using hval -+ -+/-- The intermediate-to-Frobenius map has the stated value on each representative. -/ -+@[simp] -+theorem transferNormNaturalityIntermediateToFrobeniusSubgroup_apply -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] -+ (m : extensionSubgroup E.base.field E.field.field E.below) : -+ (D.transferNormNaturalityIntermediateToFrobeniusSubgroup -+ E L hL m).1 = -+ (QuotientGroup.mk m.1 : E.base.field.toSubgroup ⧸ -+ D.extensionInertiaWithin E.base.field L (hL.trans E.below)) := by -+ rfl -+ -+/-- The canonical coset equivalence from `G_K/G_Σ` to -+`G(\widetilde L/K)/Γ` intertwines the two copies of the `K'`-action. -/ -+theorem frobeniusFixedCosetClosureEquiv_equivariant -+ (D : DegreeData G) [IsTopologicalGroup G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] -+ (σ : D.FrobeniusElements E.base L (hL.trans E.below)) -+ (m : extensionSubgroup E.base.field E.field.field E.below) -+ (x : E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field -+ (D.frobeniusFixedField E.base L (hL.trans E.below) σ) -+ (D.frobeniusFixedField_le E.base L (hL.trans E.below) σ)) : -+ D.frobeniusFixedCosetClosureEquiv E.base L (hL.trans E.below) σ (m • x) = -+ (D.transferNormNaturalityIntermediateToFrobeniusSubgroup -+ E L hL m) • -+ D.frobeniusFixedCosetClosureEquiv E.base L -+ (hL.trans E.below) σ x := by -+ refine Quotient.inductionOn' x ?_ -+ intro k -+ change QuotientGroup.mk (QuotientGroup.mk (m.1 * k)) = -+ QuotientGroup.mk -+ ((D.transferNormNaturalityIntermediateToFrobeniusSubgroup -+ E L hL m).1 * QuotientGroup.mk k) -+ rw [D.transferNormNaturalityIntermediateToFrobeniusSubgroup_apply] -+ rfl -+ -+ -+end DegreeData -+end transferFrobeniusGeometry -+end -+end ClassFormation -diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitEquiv.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitEquiv.lean -new file mode 100644 -index 0000000..5ce3d85 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitEquiv.lean -@@ -0,0 +1,107 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+ -+import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainTransferFrobeniusRestriction -+ -+ -+set_option autoImplicit false -+ -+ -+universe u -+ -+namespace ClassFormation -+ -+open KummerTheory -+open CyclicCohomology -+open CategoryTheory -+ -+noncomputable section -+ -+open scoped BigOperators -+open MulAction -+ -+section transferFrobeniusGeometry -+ -+variable {G : Type u} [Group G] [TopologicalSpace G] -+ -+ -+namespace DegreeData -+ -+/-- The transfer-orbit index set -+`⟨σ⟩ \ G(\widetilde L/K) / H` is canonically the norm double-coset -+index set `G_K' \ G_K / G_Σ`. The equivalence is inversion of double -+cosets, followed by passage from powers of `σ` to their closure `Γ` and -+the canonical identification `G_K/G_Σ ≃ G(\widetilde L/K)/Γ`. -/ -+noncomputable def transferNormNaturalityTransferNormOrbitEquiv -+ (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] -+ (σ : D.FrobeniusElements E.base L (hL.trans E.below)) : -+ Quotient (orbitRel (Subgroup.zpowers σ.1) -+ ((E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L -+ (hL.trans E.below)) ⧸ -+ D.transferNormNaturalityFrobeniusIntermediateSubgroup -+ E L hL)) ≃ -+ Quotient (orbitRel -+ (extensionSubgroup E.base.field E.field.field E.below) -+ (E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field -+ (D.frobeniusFixedField E.base L (hL.trans E.below) σ) -+ (D.frobeniusFixedField_le E.base L -+ (hL.trans E.below) σ))) := by -+ let P := E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L -+ (hL.trans E.below) -+ let H := D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL -+ let M := extensionSubgroup E.base.field E.field.field E.below -+ let Γ := D.frobeniusClosure E.base L (hL.trans E.below) σ -+ let S := D.frobeniusFixedField E.base L (hL.trans E.below) σ -+ let hSK := D.frobeniusFixedField_le E.base L (hL.trans E.below) σ -+ let f : M →* H := D.transferNormNaturalityIntermediateToFrobeniusSubgroup -+ E L hL -+ let e := D.frobeniusFixedCosetClosureEquiv -+ E.base L (hL.trans E.below) σ -+ letI : H.FiniteIndex := -+ D.transferNormNaturalityFrobeniusIntermediateFiniteIndex E L hL -+ have hHclosed : IsClosed (H : Set P) := -+ D.transferNormNaturalityFrobeniusIntermediate_isClosed E L hL -+ have hΓ : -+ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup = Γ.toSubgroup := by -+ simp only [Γ, DegreeData.frobeniusClosure, Set.range_const] -+ let eΓ : P ⧸ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup ≃ -+ P ⧸ Γ.toSubgroup := Subgroup.quotientEquivOfEq hΓ -+ have heΓ (h : H) -+ (x : P ⧸ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup) : -+ eΓ (h • x) = h • eΓ x := by -+ refine Quotient.inductionOn' x ?_ -+ intro p -+ change eΓ (QuotientGroup.mk (h.val * p)) = h • eΓ (QuotientGroup.mk p) -+ simp only [eΓ, Subgroup.quotientEquivOfEq_mk] -+ rfl -+ let eΓorbit := orbitQuotientEquivOfSurjectiveEquivariant -+ (MonoidHom.id H) Function.surjective_id eΓ heΓ -+ have hf : Function.Surjective f := -+ D.transferNormNaturalityIntermediateToFrobeniusSubgroup_surjective -+ E L hL -+ have he (m : M) -+ (x : E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field S hSK) : -+ e (m • x) = f m • e x := by -+ exact D.frobeniusFixedCosetClosureEquiv_equivariant -+ E L hL σ m x -+ let eAction := orbitQuotientEquivOfSurjectiveEquivariant f hf e he -+ exact (orbitQuotientSwapEquiv (Subgroup.zpowers σ.1) H).trans -+ ((orbitQuotientClosedCyclicEquiv H hHclosed σ.1).trans -+ (eΓorbit.trans eAction.symm)) -+ -+ -+end DegreeData -+ -+end transferFrobeniusGeometry -+end -+ -+end ClassFormation -diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitMk.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitMk.lean -new file mode 100644 -index 0000000..0e23056 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitMk.lean -@@ -0,0 +1,74 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+ -+import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainTransferNormOrbitEquiv -+ -+ -+set_option autoImplicit false -+ -+ -+universe u -+ -+namespace ClassFormation -+ -+open KummerTheory -+open CyclicCohomology -+open CategoryTheory -+ -+noncomputable section -+ -+open scoped BigOperators -+open MulAction -+ -+section transferFrobeniusGeometry -+ -+variable {G : Type u} [Group G] [TopologicalSpace G] -+ -+ -+namespace DegreeData -+ -+/-- The transfer-norm orbit equivalence sends quotient representatives to their norm orbits. -/ -+@[simp] -+theorem transferNormNaturalityTransferNormOrbitEquiv_mk -+ (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] -+ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) -+ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) -+ [hLnormal : -+ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] -+ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] -+ (σ : D.FrobeniusElements E.base L (hL.trans E.below)) -+ (k : E.base.field.toSubgroup) : -+ D.transferNormNaturalityTransferNormOrbitEquiv E L hL σ -+ (Quotient.mk'' (QuotientGroup.mk -+ (QuotientGroup.mk k : E.base.field.toSubgroup ⧸ -+ D.extensionInertiaWithin E.base.field L (hL.trans E.below)) : -+ (E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L -+ (hL.trans E.below)) ⧸ -+ D.transferNormNaturalityFrobeniusIntermediateSubgroup -+ E L hL)) = -+ Quotient.mk'' (QuotientGroup.mk k⁻¹ : -+ E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field -+ (D.frobeniusFixedField E.base L (hL.trans E.below) σ) -+ (D.frobeniusFixedField_le E.base L -+ (hL.trans E.below) σ)) := by -+ unfold transferNormNaturalityTransferNormOrbitEquiv -+ simp only [Equiv.trans_apply, orbitQuotientSwapEquiv_mk, -+ orbitQuotientClosedCyclicEquiv_mk, -+ orbitQuotientEquivOfSurjectiveEquivariant_mk, -+ orbitQuotientEquivOfSurjectiveEquivariant_symm_mk, -+ Subgroup.quotientEquivOfEq_mk] -+ apply congrArg Quotient.mk'' -+ exact (D.frobeniusFixedCosetClosureEquiv E.base L -+ (hL.trans E.below) σ).symm_apply_apply (QuotientGroup.mk k⁻¹) -+ -+ -+end DegreeData -+ -+end transferFrobeniusGeometry -+end -+ -+end ClassFormation -diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/AdeleBaseChange.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/AdeleBaseChange.lean -index fa7f215..d8d918e 100644 ---- a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/AdeleBaseChange.lean -+++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/AdeleBaseChange.lean -@@ -7,15 +7,9 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - import ClassFieldTheory.AlgebraicNumberTheory.Idele.BaseChange - import ClassFieldTheory.AlgebraicNumberTheory.Completion.AdicCompletionComparison - --set_option autoImplicit false - --/-! --# Scalar extension from relative to ordinary adeles -+set_option autoImplicit false - --This file upgrades the relative-to-ordinary idele comparison to the --underlying adele rings. The additive structure is needed to transport --determinant norms in a field tower. ---/ - - open scoped NumberField TensorProduct RestrictedProduct - open NumberField IsDedekindDomain -diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/Idele/NormTopology/ExtensionBehavior.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/Idele/NormTopology/ExtensionBehavior.lean -index 2e624da..f838ee6 100644 ---- a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/Idele/NormTopology/ExtensionBehavior.lean -+++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/Idele/NormTopology/ExtensionBehavior.lean -@@ -6,6 +6,7 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - - import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormTopology.FiniteNormArithmetic - -+ - set_option autoImplicit false - - /-! -@@ -40,12 +41,20 @@ private theorem infinitePlaceCompletionMap_isometry - Isometry - (NumberField.LiesOver.completionMap - (v := v₀) (w := W)) := by -- unfold NumberField.LiesOver.completionMap -- exact -- (InfinitePlace.Completion.isometryEquivCompletion W).symm.isometry.comp -- ((UniformSpace.Completion.isometry_mapRingHom -- (InfinitePlace.LiesOver.isometry_algebraMap W v₀)).comp -- (InfinitePlace.Completion.isometryEquivCompletion v₀).isometry) -+ apply AddMonoidHomClass.isometry_of_norm -+ (NumberField.LiesOver.completionMap (v := v₀) (w := W)) -+ intro x -+ refine InfinitePlace.Completion.induction_on v₀ x -+ (isClosed_eq -+ (continuous_norm.comp NumberField.LiesOver.continuous_completionMap) -+ continuous_norm) ?_ -+ intro a -+ rw [NumberField.LiesOver.completionMap_coe] -+ have h := (InfinitePlace.LiesOver.isometry_algebraMap W v₀).norm_map_of_map_zero -+ (map_zero (algebraMap (WithAbs v₀.1) (WithAbs W.1))) a -+ simp only [InfinitePlace.Completion.norm_coe, WithAbs.norm_eq_apply_ofAbs, -+ WithAbs.equiv_apply, InfinitePlace.coe_apply] at h ⊢ -+ with_reducible exact h - - omit [NumberField L] in - /-- Mapping a unit along an infinite-place completion map preserves its -diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/Ideal.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/Ideal.lean -index d626883..6255279 100644 ---- a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/Ideal.lean -+++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/Ideal.lean -@@ -4,23 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Topology --import ClassFieldTheory.AlgebraicNumberTheory.Idele.LocallyCompact --import ClassFieldTheory.AlgebraicNumberTheory.Idele.PrincipalNorm --import ValuedFieldTheory.Valuation.AbsoluteValue.Theory.AbsoluteValues --import Mathlib.NumberTheory.NumberField.Completion.InfinitePlace --import Mathlib.Topology.Algebra.IsOpenUnits --import Mathlib.Topology.Algebra.Ring.Compact - --set_option autoImplicit false -+import ClassFieldTheory.AlgebraicNumberTheory.RayClass.IdealApproximation - --/-! --# Ideals prime to a ray-class modulus - --This file defines the subgroup of fractional ideals prime to a modulus, --connects it with the corresponding finite-idele higher-unit conditions, and --develops the approximation maps used in ray-class ideal constructions. ---/ -+set_option autoImplicit false -+ - - open scoped NumberField WithZero Classical - open NumberField IsDedekindDomain -@@ -32,690 +21,6 @@ variable {K : Type*} [Field K] [NumberField K] - - namespace RayClass - --/-- Fractional ideals having valuation zero at every finite prime in the --support of the modulus. -/ --def primeToModulusIdeals (m : Modulus K) : -- Subgroup (FractionalIdealGroup K) where -- carrier := {I | ∀ v, v ∈ m.finitePart.support → -- FractionalIdeal.count K v -- (I : FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0} -- one_mem' v _ := FractionalIdeal.count_one K v -- mul_mem' {I J} hI hJ v hv := by -- rw [Units.val_mul, -- FractionalIdeal.count_mul K v (Units.ne_zero I) (Units.ne_zero J), -- hI v hv, hJ v hv, add_zero] -- inv_mem' {I} hI v hv := by -- rw [Units.val_inv_eq_inv_val, FractionalIdeal.count_inv K v, -- hI v hv, neg_zero] -- --@[simp] --theorem mem_primeToModulusIdeals_iff -- (m : Modulus K) (I : FractionalIdealGroup K) : -- I ∈ primeToModulusIdeals m ↔ -- ∀ v, v ∈ m.finitePart.support → -- FractionalIdeal.count K v -- (I : FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0 := -- Iff.rfl -- --/-- A finite prime outside the support of `m`, regarded as an element of --the group of fractional ideals prime to `m`. -/ --def primeToModulusIdeal -- (m : Modulus K) -- (v : HeightOneSpectrum (𝓞 K)) -- (hv : v ∉ m.finitePart.support) : -- primeToModulusIdeals m := -- ⟨FractionalIdealGroup.prime v, by -- intro w hw -- have hwv : w ≠ v := by -- intro h -- exact hv (h ▸ hw) -- change -- FractionalIdeal.count K w -- (v.asIdeal : -- FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = -- 0 -- exact -- FractionalIdeal.count_maximal_coprime -- K w hwv.symm⟩ -- --/-- Coercing a prime outside the modulus support recovers its prime --fractional ideal. -/ --@[simp] --theorem primeToModulusIdeal_coe -- (m : Modulus K) -- (v : HeightOneSpectrum (𝓞 K)) -- (hv : v ∉ m.finitePart.support) : -- (primeToModulusIdeal m v hv : -- FractionalIdealGroup K) = -- FractionalIdealGroup.prime v := -- rfl -- --/-- Finite ideles satisfying the higher-unit condition at every prime in --the support of the modulus. -/ --def finitePrimeToModulusSubgroup (m : Modulus K) : -- Subgroup (FiniteIdeleGroup K) where -- carrier := {a | ∀ v, v ∈ m.finitePart.support → -- a v ∈ localHigherUnitGroup v (m.finitePart v)} -- one_mem' v _ := (localHigherUnitGroup v (m.finitePart v)).one_mem -- mul_mem' ha hb v hv := -- (localHigherUnitGroup v (m.finitePart v)).mul_mem (ha v hv) (hb v hv) -- inv_mem' ha v hv := -- (localHigherUnitGroup v (m.finitePart v)).inv_mem (ha v hv) -- --/-- Ideles satisfying the infinite positivity and finite higher-unit --conditions of a modulus. -/ --def idelePrimeToModulusSubgroup (m : Modulus K) : -- Subgroup (IdeleGroup K) := -- m.infiniteCongruenceSubgroup.prod -- (finitePrimeToModulusSubgroup m) -- --theorem localHigherUnitGroup_le_integralUnits -- (v : HeightOneSpectrum (𝓞 K)) (n : ℕ) : -- localHigherUnitGroup v n ≤ -- (v.adicCompletionIntegers K).units := by -- intro x hx -- rw [mem_localHigherUnitGroup_iff] at hx -- obtain ⟨y, rfl, _⟩ := hx -- exact y.property -- --theorem fractionalIdeal_mem_primeToModulusIdeals -- (m : Modulus K) (a : IdeleGroup K) -- (ha : a ∈ idelePrimeToModulusSubgroup m) : -- IdeleGroup.fractionalIdeal a ∈ primeToModulusIdeals m := by -- intro v hv -- change FractionalIdeal.count K v -- (((FractionalIdealGroup.factorization (K := K)) -- (FiniteIdeleGroup.valuationVector a.2) : -- FractionalIdealGroup K) : -- FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0 -- rw [FractionalIdealGroup.count_factorization, -- FiniteIdeleGroup.valuationVector_apply] -- apply (FiniteIdeleGroup.localOrder_eq_zero_iff v (a.2 v)).2 -- exact localHigherUnitGroup_le_integralUnits v (m.finitePart v) (ha.2 v hv) -- --/-- The fractional-ideal map restricted to ideles prime to a modulus. -/ --def primeToIdealMap (m : Modulus K) : -- idelePrimeToModulusSubgroup m →* -- primeToModulusIdeals m where -- toFun a := -- ⟨IdeleGroup.fractionalIdeal a, -- fractionalIdeal_mem_primeToModulusIdeals m a a.property⟩ -- map_one' := by -- apply Subtype.ext -- exact map_one _ -- map_mul' a b := by -- apply Subtype.ext -- exact map_mul _ _ _ -- --/-- A finite idele with a prescribed valuation vector away from the --support of a modulus and value one on its support. -/ --def valuationVectorSectionPrimeTo -- (m : Modulus K) -- (e : HeightOneSpectrum (𝓞 K) →₀ ℤ) : -- FiniteIdeleGroup K := -- ⟨fun v => -- if v ∈ m.finitePart.support then 1 -- else FiniteIdeleGroup.chosenLocalOrderSection v (e v), by -- filter_upwards -- [m.finitePart.support.eventually_cofinite_notMem, -- e.support.eventually_cofinite_notMem] with v hvm he -- simp only [hvm, ↓reduceIte] -- apply (FiniteIdeleGroup.localOrder_eq_zero_iff v _).1 -- rw [FiniteIdeleGroup.localOrder_chosenLocalOrderSection, -- Finsupp.notMem_support_iff.mp he]⟩ -- --theorem valuationVector_valuationVectorSectionPrimeTo -- (m : Modulus K) -- (e : HeightOneSpectrum (𝓞 K) →₀ ℤ) -- (he : ∀ v, v ∈ m.finitePart.support → e v = 0) : -- FiniteIdeleGroup.valuationVector -- (valuationVectorSectionPrimeTo m e) = -- Multiplicative.ofAdd e := by -- apply Multiplicative.ext -- ext v -- rw [FiniteIdeleGroup.valuationVector_apply] -- by_cases hv : v ∈ m.finitePart.support -- · change -- (FiniteIdeleGroup.localOrder v -- (if v ∈ m.finitePart.support then 1 -- else FiniteIdeleGroup.chosenLocalOrderSection v (e v))).toAdd = -- e v -- rw [ite_eq_left hv, map_one] -- exact (he v hv).symm -- · change -- (FiniteIdeleGroup.localOrder v -- (if v ∈ m.finitePart.support then 1 -- else FiniteIdeleGroup.chosenLocalOrderSection v (e v))).toAdd = -- e v -- rw [ite_eq_right hv, -- FiniteIdeleGroup.localOrder_chosenLocalOrderSection] -- --theorem primeToIdealMap_surjective (m : Modulus K) : -- Function.Surjective (primeToIdealMap m) := by -- intro I -- let e : HeightOneSpectrum (𝓞 K) →₀ ℤ := -- FractionalIdealGroup.countVector (I : FractionalIdealGroup K) -- have he : ∀ v, v ∈ m.finitePart.support → e v = 0 := by -- intro v hv -- exact I.property v hv -- let a : IdeleGroup K := -- (1, valuationVectorSectionPrimeTo m e) -- have ha : a ∈ idelePrimeToModulusSubgroup m := by -- constructor -- · exact m.infiniteCongruenceSubgroup.one_mem -- · intro v hv -- change -- (if v ∈ m.finitePart.support then 1 -- else FiniteIdeleGroup.chosenLocalOrderSection v (e v)) ∈ -- localHigherUnitGroup v (m.finitePart v) -- rw [ite_eq_left hv] -- exact (localHigherUnitGroup v (m.finitePart v)).one_mem -- refine ⟨⟨a, ha⟩, ?_⟩ -- apply Subtype.ext -- apply FractionalIdealGroup.ext_count -- intro v -- change FractionalIdeal.count K v -- (((FractionalIdealGroup.factorization (K := K)) -- (FiniteIdeleGroup.valuationVector -- (valuationVectorSectionPrimeTo m e)) : -- FractionalIdealGroup K) : -- FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = -- FractionalIdeal.count K v -- ((I : FractionalIdealGroup K) : -- FractionalIdeal (nonZeroDivisors (𝓞 K)) K) -- rw [valuationVector_valuationVectorSectionPrimeTo m e he, -- FractionalIdealGroup.count_factorization] -- exact FractionalIdealGroup.countVector_apply I v -- --theorem ideleCongruenceSubgroup_le_primeTo -- (m : Modulus K) : -- m.ideleCongruenceSubgroup ≤ -- idelePrimeToModulusSubgroup m := by -- intro a ha -- exact ⟨ha.1, fun v _ => ha.2 v⟩ -- --/-- The congruence subgroup, viewed inside the subgroup of ideles prime --to the modulus. -/ --def congruenceSubgroupInPrimeTo (m : Modulus K) : -- Subgroup (idelePrimeToModulusSubgroup m) := -- m.ideleCongruenceSubgroup.subgroupOf -- (idelePrimeToModulusSubgroup m) -- --theorem primeToIdealMap_ker (m : Modulus K) : -- (primeToIdealMap m).ker = -- congruenceSubgroupInPrimeTo m := by -- ext a -- constructor -- · intro ha -- have hintegral : -- (a : IdeleGroup K) ∈ -- IdeleGroup.integralAtFinitePlaces (K := K) := by -- rw [← IdeleGroup.fractionalIdeal_ker, -- MonoidHom.mem_ker] -- exact congrArg Subtype.val -- (MonoidHom.mem_ker.mp ha) -- constructor -- · exact a.property.1 -- · intro v -- by_cases hv : v ∈ m.finitePart.support -- · exact a.property.2 v hv -- · rw [Finsupp.notMem_support_iff.mp hv, -- localHigherUnitGroup_zero] -- exact hintegral v -- · intro ha -- apply MonoidHom.mem_ker.mpr -- apply Subtype.ext -- change IdeleGroup.fractionalIdeal (a : IdeleGroup K) = 1 -- rw [← MonoidHom.mem_ker, -- IdeleGroup.fractionalIdeal_ker] -- intro v -- exact localHigherUnitGroup_le_integralUnits v (m.finitePart v) (ha.2 v) -- --/-- The quotient of ideles prime to a modulus by the congruence subgroup, --identified with fractional ideals prime to the modulus. -/ --def quotientCongruenceEquivPrimeToIdeals (m : Modulus K) : -- idelePrimeToModulusSubgroup m ⧸ -- congruenceSubgroupInPrimeTo m ≃* -- primeToModulusIdeals m := by -- rw [← primeToIdealMap_ker m] -- exact QuotientGroup.quotientKerEquivOfSurjective -- (primeToIdealMap m) (primeToIdealMap_surjective m) -- --/-- Principal ideles satisfying the modulus conditions, considered inside --`I_K^(m)`. -/ --def principalSubgroupInPrimeTo (m : Modulus K) : -- Subgroup (idelePrimeToModulusSubgroup m) := -- Subgroup.comap (idelePrimeToModulusSubgroup m).subtype -- (IdeleGroup.principalSubgroup K) -- --/-- Principal ideals generated by a totally positive element congruent to --one modulo the finite modulus. -/ --def principalRayIdealSubgroup (m : Modulus K) : -- Subgroup (primeToModulusIdeals m) := -- Subgroup.map (primeToIdealMap m) -- (principalSubgroupInPrimeTo m) -- --theorem mem_principalRayIdealSubgroup_iff -- (m : Modulus K) (I : primeToModulusIdeals m) : -- I ∈ principalRayIdealSubgroup m ↔ -- ∃ x : Kˣ, -- ∃ _hx : IdeleGroup.principalIdele K x ∈ -- idelePrimeToModulusSubgroup m, -- toPrincipalIdeal (𝓞 K) K x = -- (I : FractionalIdealGroup K) := by -- constructor -- · rintro ⟨a, ha, hmap⟩ -- obtain ⟨x, hx⟩ := ha -- refine ⟨x, ?_, ?_⟩ -- · rw [hx] -- exact a.property -- · have hval := congrArg Subtype.val hmap -- change IdeleGroup.fractionalIdeal (a : IdeleGroup K) = -- (I : FractionalIdealGroup K) at hval -- rw [← IdeleGroup.fractionalIdeal_principalIdele] -- exact (congrArg (IdeleGroup.fractionalIdeal (K := K)) hx).trans hval -- · rintro ⟨x, hx, hideal⟩ -- let a : idelePrimeToModulusSubgroup m := -- ⟨IdeleGroup.principalIdele K x, hx⟩ -- have ha : a ∈ principalSubgroupInPrimeTo m := by -- change IdeleGroup.principalIdele K x ∈ -- IdeleGroup.principalSubgroup K -- exact ⟨x, rfl⟩ -- refine ⟨a, ha, ?_⟩ -- apply Subtype.ext -- change IdeleGroup.fractionalIdeal -- (IdeleGroup.principalIdele K x) = -- (I : FractionalIdealGroup K) -- rw [IdeleGroup.fractionalIdeal_principalIdele, hideal] -- --/-- The ideal-theoretic ray class group `J_K^m / P_K^m`. -/ --abbrev IdealRayClassGroup (m : Modulus K) := -- primeToModulusIdeals m ⧸ principalRayIdealSubgroup m -- --/-- The canonical projection from ideles prime to the modulus to the --ideal-theoretic ray class group. -/ --def idealRayProjection (m : Modulus K) : -- idelePrimeToModulusSubgroup m →* -- IdealRayClassGroup m := -- (QuotientGroup.mk' (principalRayIdealSubgroup m)).comp -- (primeToIdealMap m) -- --/-- The subgroup generated by congruence ideles and principal ideles --inside the ideles prime to a modulus. -/ --def raySubgroupInPrimeTo (m : Modulus K) : -- Subgroup (idelePrimeToModulusSubgroup m) := -- congruenceSubgroupInPrimeTo m ⊔ -- principalSubgroupInPrimeTo m -- --theorem idealRayProjection_surjective (m : Modulus K) : -- Function.Surjective (idealRayProjection m) := by -- intro c -- obtain ⟨I, rfl⟩ := -- QuotientGroup.mk'_surjective -- (principalRayIdealSubgroup m) c -- obtain ⟨a, rfl⟩ := primeToIdealMap_surjective m I -- exact ⟨a, rfl⟩ -- --theorem idealRayProjection_ker (m : Modulus K) : -- (idealRayProjection m).ker = -- raySubgroupInPrimeTo m := by -- ext a -- constructor -- · intro ha -- change QuotientGroup.mk' -- (principalRayIdealSubgroup m) -- (primeToIdealMap m a) = 1 at ha -- rw [QuotientGroup.mk'_apply, -- QuotientGroup.eq_one_iff] at ha -- obtain ⟨p, hp, hpa⟩ := ha -- let n : idelePrimeToModulusSubgroup m := a * p⁻¹ -- have hn : n ∈ congruenceSubgroupInPrimeTo m := by -- rw [← primeToIdealMap_ker m, MonoidHom.mem_ker] -- change primeToIdealMap m (a * p⁻¹) = 1 -- rw [map_mul, map_inv, hpa] -- simp -- rw [raySubgroupInPrimeTo, Subgroup.mem_sup] -- refine ⟨n, hn, p, hp, ?_⟩ -- dsimp [n] -- group -- · intro ha -- rw [raySubgroupInPrimeTo, Subgroup.mem_sup] at ha -- obtain ⟨n, hn, p, hp, rfl⟩ := ha -- change QuotientGroup.mk' -- (principalRayIdealSubgroup m) -- (primeToIdealMap m (n * p)) = 1 -- rw [map_mul] -- have hn' : primeToIdealMap m n = 1 := -- MonoidHom.mem_ker.mp -- ((primeToIdealMap_ker m).symm ▸ hn) -- rw [hn', one_mul] -- rw [QuotientGroup.mk'_apply, -- QuotientGroup.eq_one_iff] -- exact ⟨p, hp, rfl⟩ -- --/-- The quotient of ideles prime to the modulus by the full ray subgroup, --identified with the ideal-theoretic ray class group. -/ --def quotientRaySubgroupEquivIdealRayClassGroup -- (m : Modulus K) : -- idelePrimeToModulusSubgroup m ⧸ -- raySubgroupInPrimeTo m ≃* -- IdealRayClassGroup m := -- (QuotientGroup.quotientMulEquivOfEq -- (idealRayProjection_ker m).symm).trans -- (QuotientGroup.quotientKerEquivOfSurjective -- (idealRayProjection m) -- (idealRayProjection_surjective m)) -- --/-- The quotient equivalence induced by the ideal-ray projection evaluates on --the class of a prime-to-modulus idele as the original projection. -/ --@[simp] --theorem quotientRaySubgroupEquivIdealRayClassGroup_mk -- (m : Modulus K) (a : idelePrimeToModulusSubgroup m) : -- quotientRaySubgroupEquivIdealRayClassGroup m -- (QuotientGroup.mk' (raySubgroupInPrimeTo m) a) = -- idealRayProjection m a := by -- rw [quotientRaySubgroupEquivIdealRayClassGroup, -- MulEquiv.trans_apply, QuotientGroup.mk'_apply, -- QuotientGroup.quotientMulEquivOfEq_mk] -- exact QuotientGroup.kerLift_mk (idealRayProjection m) a -- --/-! ### Simultaneous approximation at the places in a modulus -/ -- --/-- The finite primes in `m`, together with all infinite places. -/ --abbrev ApproximationPlace (m : Modulus K) := -- (↥m.finitePart.support) ⊕ InfinitePlace K -- --/-- The absolute value represented by an approximation place. -/ --abbrev approximationAbsoluteValue (m : Modulus K) : -- ApproximationPlace m → AbsoluteValue K ℝ -- | Sum.inl v => NumberField.HeightOneSpectrum.adicAbv K v.1 -- | Sum.inr w => w.1 -- --theorem adicAbv_isNontrivial -- (v : HeightOneSpectrum (𝓞 K)) : -- (NumberField.HeightOneSpectrum.adicAbv K v).IsNontrivial := by -- obtain ⟨x, hxv, hx0⟩ := -- Submodule.exists_mem_ne_zero_of_ne_bot v.ne_bot -- refine ⟨algebraMap (𝓞 K) K x, ?_, ?_⟩ -- · exact (FaithfulSMul.algebraMap_eq_zero_iff (𝓞 K) K).not.mpr hx0 -- · apply ne_of_lt -- rw [← FinitePlace.norm_embedding] -- exact (FinitePlace.norm_lt_one_iff_mem (K := K) v x).2 hxv -- --theorem adicAbv_not_isEquiv_of_ne -- {v w : HeightOneSpectrum (𝓞 K)} (hvw : v ≠ w) : -- ¬ (NumberField.HeightOneSpectrum.adicAbv K v).IsEquiv -- (NumberField.HeightOneSpectrum.adicAbv K w) := by -- intro h -- have hnotle : ¬ v.asIdeal ≤ w.asIdeal := by -- intro hvw_le -- have htop_le : (⊤ : Ideal (𝓞 K)) ≤ w.asIdeal := by -- rw [← (v.isCoprime_of_ne w hvw).sup_eq] -- exact sup_le hvw_le le_rfl -- exact w.isPrime.ne_top (top_unique htop_le) -- obtain ⟨x, hxv, hxw⟩ := Set.not_subset.mp hnotle -- have hvlt : -- NumberField.HeightOneSpectrum.adicAbv K v -- (algebraMap (𝓞 K) K x) < 1 := by -- rw [← FinitePlace.norm_embedding] -- exact (FinitePlace.norm_lt_one_iff_mem (K := K) v x).2 hxv -- have hweq : -- NumberField.HeightOneSpectrum.adicAbv K w -- (algebraMap (𝓞 K) K x) = 1 := by -- rw [← FinitePlace.norm_embedding] -- exact (FinitePlace.norm_eq_one_iff_notMem (K := K) w x).2 hxw -- exact (ne_of_lt hvlt) (h.eq_one_iff.mpr hweq) -- --theorem adicAbv_not_isEquiv_infinitePlace -- (v : HeightOneSpectrum (𝓞 K)) (w : InfinitePlace K) : -- ¬ (NumberField.HeightOneSpectrum.adicAbv K v).IsEquiv w.1 := by -- intro h -- have hle : -- w.1 ((2 : ℕ) : K) ≤ 1 := -- h.le_one_iff.mp -- (NumberField.HeightOneSpectrum.adicAbv_natCast_le_one K v 2) -- have hw : -- w.1 ((2 : ℕ) : K) = (2 : ℝ) := -- NumberField.InfinitePlace.map_natCast w 2 -- have hfalse : (2 : ℝ) ≤ 1 := hw ▸ hle -- norm_num at hfalse -- --theorem approximationAbsoluteValue_isNontrivial -- (m : Modulus K) : -- ∀ i, (approximationAbsoluteValue m i).IsNontrivial -- | Sum.inl v => by -- change -- (NumberField.HeightOneSpectrum.adicAbv K v.1).IsNontrivial -- exact adicAbv_isNontrivial v.1 -- | Sum.inr w => by -- change w.1.IsNontrivial -- exact w.isNontrivial -- --theorem approximationAbsoluteValue_pairwise -- (m : Modulus K) : -- Pairwise fun i j => -- ¬ (approximationAbsoluteValue m i).IsEquiv -- (approximationAbsoluteValue m j) := by -- intro i j hij -- cases i with -- | inl v => -- cases j with -- | inl w => -- apply adicAbv_not_isEquiv_of_ne -- intro hvw -- apply hij -- exact congrArg Sum.inl (Subtype.ext hvw) -- | inr w => -- exact adicAbv_not_isEquiv_infinitePlace v.1 w -- | inr v => -- cases j with -- | inl w => -- exact fun h => -- adicAbv_not_isEquiv_infinitePlace w.1 v h.symm -- | inr w => -- intro h -- apply hij -- congr -- change v.1.IsEquiv w.1 at h -- exact -- (InfinitePlace.eq_iff_isEquiv (K := K)).mpr h -- --/-- The corresponding product of local completions. -/ --abbrev approximationCompletion (m : Modulus K) : -- ApproximationPlace m → Type _ -- | Sum.inl v => v.1.adicCompletion K -- | Sum.inr w => w.Completion -- --noncomputable instance approximationCompletionTopologicalSpace -- (m : Modulus K) (i : ApproximationPlace m) : -- TopologicalSpace (approximationCompletion m i) := by -- cases i <;> simp only [approximationCompletion] <;> infer_instance -- --/-- Coordinatewise completion of the valued copies of `K`. -/ --def approximationCompletionMap (m : Modulus K) : -- ∀ i : ApproximationPlace m, -- WithAbs (approximationAbsoluteValue m i) → -- approximationCompletion m i -- | Sum.inl v => -- fun x => -- FinitePlace.embedding v.1 -- (WithAbs.equiv -- (NumberField.HeightOneSpectrum.adicAbv K v.1) x) -- | Sum.inr w => fun x => (x : w.Completion) -- --theorem denseRange_finiteApproximationCompletionMap -- (v : HeightOneSpectrum (𝓞 K)) : -- DenseRange -- (fun x : -- WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => -- FinitePlace.embedding v -- (WithAbs.equiv -- (NumberField.HeightOneSpectrum.adicAbv K v) x)) := by -- have hrange : -- Set.range -- (fun x : -- WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => -- FinitePlace.embedding v -- (WithAbs.equiv -- (NumberField.HeightOneSpectrum.adicAbv K v) x)) = -- Set.range (algebraMap K (v.adicCompletion K)) := by -- ext y -- constructor -- · rintro ⟨x, rfl⟩ -- exact -- ⟨WithAbs.equiv -- (NumberField.HeightOneSpectrum.adicAbv K v) x, rfl⟩ -- · rintro ⟨x, rfl⟩ -- refine -- ⟨(WithAbs.equiv -- (NumberField.HeightOneSpectrum.adicAbv K v)).symm x, ?_⟩ -- rfl -- rw [DenseRange, hrange] -- exact v.denseRange_algebraMap K -- --theorem continuous_finiteApproximationCompletionMap -- (v : HeightOneSpectrum (𝓞 K)) : -- Continuous -- (fun x : -- WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => -- FinitePlace.embedding v -- (WithAbs.equiv -- (NumberField.HeightOneSpectrum.adicAbv K v) x)) := by -- apply Isometry.continuous -- apply Isometry.of_dist_eq -- intro x y -- rw [dist_eq_norm, dist_eq_norm, ← map_sub, -- FinitePlace.norm_embedding] -- rfl -- --theorem denseRange_approximationCompletionMap -- (m : Modulus K) : -- ∀ i, DenseRange (approximationCompletionMap m i) -- | Sum.inl v => denseRange_finiteApproximationCompletionMap v.1 -- | Sum.inr w => -- NumberField.InfinitePlace.Completion.denseRange_coe w -- --theorem continuous_approximationCompletionMap -- (m : Modulus K) : -- ∀ i, Continuous (approximationCompletionMap m i) -- | Sum.inl v => continuous_finiteApproximationCompletionMap v.1 -- | Sum.inr w => -- NumberField.InfinitePlace.Completion.continuous_coe w -- --/-- The diagonal embedding into the finite product of the relevant --completions. -/ --def approximationEmbedding (m : Modulus K) : -- K → (i : ApproximationPlace m) → approximationCompletion m i := -- (Pi.map (approximationCompletionMap m)) ∘ -- algebraMap K -- ((i : ApproximationPlace m) → -- WithAbs (approximationAbsoluteValue m i)) -- --@[simp] --theorem approximationEmbedding_finite -- (m : Modulus K) (x : K) (v : ↥m.finitePart.support) : -- approximationEmbedding m x (Sum.inl v) = -- FinitePlace.embedding v.1 x := -- rfl -- --@[simp] --theorem approximationEmbedding_infinite -- (m : Modulus K) (x : K) (w : InfinitePlace K) : -- approximationEmbedding m x (Sum.inr w) = -- (x : w.Completion) := -- rfl -- --theorem denseRange_approximationEmbedding (m : Modulus K) : -- DenseRange (approximationEmbedding m) := by -- exact -- (DenseRange.piMap -- (denseRange_approximationCompletionMap m)).comp -- (AbsoluteValue.denseRange_algebraMap_pi -- (approximationAbsoluteValue_isNontrivial m) -- (approximationAbsoluteValue_pairwise m)) -- (.piMap (continuous_approximationCompletionMap m)) -- --/-- The open set of field elements whose ratio with a fixed unit lies in --a prescribed open unit set. -/ --def unitRatioSet -- {F : Type*} [Field F] (a : Fˣ) (U : Subgroup Fˣ) : -- Set F := -- Units.val '' (fun y : Fˣ => a * y⁻¹) ⁻¹' (U : Set Fˣ) -- --/-- The unit-ratio set associated to an open set of units is open. -/ --theorem isOpen_unitRatioSet -- {F : Type*} [Field F] [TopologicalSpace F] -- [IsTopologicalRing F] [ContinuousInv₀ F] [T1Space F] -- (a : Fˣ) (U : Subgroup Fˣ) -- (hU : IsOpen (U : Set Fˣ)) : -- IsOpen (unitRatioSet a U) := by -- apply IsOpenUnits.isOpenEmbedding_unitsVal.isOpenMap -- exact hU.preimage (continuous_const.mul continuous_inv) -- --/-- The value of the distinguished unit belongs to its unit-ratio set. -/ --theorem val_mem_unitRatioSet -- {F : Type*} [Field F] (a : Fˣ) (U : Subgroup Fˣ) : -- (a : F) ∈ unitRatioSet a U := by -- exact ⟨a, by simp, rfl⟩ -- --/-- The open local conditions that make `a / x` prime to `m`. -/ --def approximationTarget (m : Modulus K) (a : IdeleGroup K) : -- ∀ i : ApproximationPlace m, Set (approximationCompletion m i) -- | Sum.inl v => -- unitRatioSet (a.2 v.1) -- (localHigherUnitGroup v.1 (m.finitePart v.1)) -- | Sum.inr w => -- unitRatioSet -- (ContinuousMulEquiv.piUnits a.1 w) -- (m.localInfiniteCongruenceSubgroup w) -- --theorem isOpen_approximationTarget -- (m : Modulus K) (a : IdeleGroup K) : -- ∀ i, IsOpen (approximationTarget m a i) -- | Sum.inl v => by -- change IsOpen -- (unitRatioSet (a.2 v.1) -- (localHigherUnitGroup v.1 (m.finitePart v.1))) -- exact isOpen_unitRatioSet _ _ -- (isOpen_localHigherUnitGroup v.1 (m.finitePart v.1)) -- | Sum.inr w => by -- change IsOpen -- (unitRatioSet -- (ContinuousMulEquiv.piUnits a.1 w) -- (m.localInfiniteCongruenceSubgroup w)) -- apply isOpen_unitRatioSet _ _ -- classical -- by_cases hw : w.IsReal -- · by_cases hmem : (⟨w, hw⟩ : RealPlace K) ∈ m.infinitePart -- · rw [Modulus.localInfiniteCongruenceSubgroup, -- dite_eq_left hw, dite_eq_left hmem] -- exact isOpen_infinitePositiveSubgroup w -- · rw [Modulus.localInfiniteCongruenceSubgroup, -- dite_eq_left hw, dite_eq_right hmem] -- exact isOpen_univ -- · rw [Modulus.localInfiniteCongruenceSubgroup, dite_eq_right hw] -- exact isOpen_univ -- --/-- The given idele itself lies in the product of its approximation --neighborhoods. -/ --def approximationTargetPoint -- (m : Modulus K) (a : IdeleGroup K) : -- (i : ApproximationPlace m) → approximationCompletion m i -- | Sum.inl v => (a.2 v.1 : v.1.adicCompletion K) -- | Sum.inr w => -- (ContinuousMulEquiv.piUnits a.1 w : w.Completion) -- --theorem approximationTargetPoint_mem -- (m : Modulus K) (a : IdeleGroup K) : -- approximationTargetPoint m a ∈ -- Set.univ.pi (approximationTarget m a) := by -- intro i _hi -- cases i with -- | inl v => -- exact val_mem_unitRatioSet _ _ -- | inr w => -- exact val_mem_unitRatioSet _ _ -- - /-- Weak approximation in the precise open local cosets required by the - modulus. -/ - theorem exists_principal_quotient_mem_primeTo -diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealApproximation.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealApproximation.lean -new file mode 100644 -index 0000000..168aa31 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealApproximation.lean -@@ -0,0 +1,322 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+ -+import ClassFieldTheory.AlgebraicNumberTheory.RayClass.IdealGroups -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped NumberField WithZero Classical -+open NumberField IsDedekindDomain -+ -+noncomputable section -+ -+ -+variable {K : Type*} [Field K] [NumberField K] -+ -+namespace RayClass -+ -+/-! ### Simultaneous approximation at the places in a modulus -/ -+ -+/-- The finite primes in `m`, together with all infinite places. -/ -+abbrev ApproximationPlace (m : Modulus K) := -+ (↥m.finitePart.support) ⊕ InfinitePlace K -+ -+/-- The absolute value represented by an approximation place. -/ -+abbrev approximationAbsoluteValue (m : Modulus K) : -+ ApproximationPlace m → AbsoluteValue K ℝ -+ | Sum.inl v => NumberField.HeightOneSpectrum.adicAbv K v.1 -+ | Sum.inr w => w.1 -+ -+theorem adicAbv_isNontrivial -+ (v : HeightOneSpectrum (𝓞 K)) : -+ (NumberField.HeightOneSpectrum.adicAbv K v).IsNontrivial := by -+ obtain ⟨x, hxv, hx0⟩ := -+ Submodule.exists_mem_ne_zero_of_ne_bot v.ne_bot -+ refine ⟨algebraMap (𝓞 K) K x, ?_, ?_⟩ -+ · exact (FaithfulSMul.algebraMap_eq_zero_iff (𝓞 K) K).not.mpr hx0 -+ · apply ne_of_lt -+ rw [← FinitePlace.norm_embedding] -+ exact (FinitePlace.norm_lt_one_iff_mem (K := K) v x).2 hxv -+ -+theorem adicAbv_not_isEquiv_of_ne -+ {v w : HeightOneSpectrum (𝓞 K)} (hvw : v ≠ w) : -+ ¬ (NumberField.HeightOneSpectrum.adicAbv K v).IsEquiv -+ (NumberField.HeightOneSpectrum.adicAbv K w) := by -+ intro h -+ have hnotle : ¬ v.asIdeal ≤ w.asIdeal := by -+ intro hvw_le -+ have htop_le : (⊤ : Ideal (𝓞 K)) ≤ w.asIdeal := by -+ rw [← (v.isCoprime_of_ne w hvw).sup_eq] -+ exact sup_le hvw_le le_rfl -+ exact w.isPrime.ne_top (top_unique htop_le) -+ obtain ⟨x, hxv, hxw⟩ := Set.not_subset.mp hnotle -+ have hvlt : -+ NumberField.HeightOneSpectrum.adicAbv K v -+ (algebraMap (𝓞 K) K x) < 1 := by -+ rw [← FinitePlace.norm_embedding] -+ exact (FinitePlace.norm_lt_one_iff_mem (K := K) v x).2 hxv -+ have hweq : -+ NumberField.HeightOneSpectrum.adicAbv K w -+ (algebraMap (𝓞 K) K x) = 1 := by -+ rw [← FinitePlace.norm_embedding] -+ exact (FinitePlace.norm_eq_one_iff_notMem (K := K) w x).2 hxw -+ exact (ne_of_lt hvlt) (h.eq_one_iff.mpr hweq) -+ -+theorem adicAbv_not_isEquiv_infinitePlace -+ (v : HeightOneSpectrum (𝓞 K)) (w : InfinitePlace K) : -+ ¬ (NumberField.HeightOneSpectrum.adicAbv K v).IsEquiv w.1 := by -+ intro h -+ have hle : -+ w.1 ((2 : ℕ) : K) ≤ 1 := -+ h.le_one_iff.mp -+ (NumberField.HeightOneSpectrum.adicAbv_natCast_le_one K v 2) -+ have hw : -+ w.1 ((2 : ℕ) : K) = (2 : ℝ) := -+ NumberField.InfinitePlace.map_natCast w 2 -+ have hfalse : (2 : ℝ) ≤ 1 := hw ▸ hle -+ norm_num at hfalse -+ -+theorem approximationAbsoluteValue_isNontrivial -+ (m : Modulus K) : -+ ∀ i, (approximationAbsoluteValue m i).IsNontrivial -+ | Sum.inl v => by -+ change -+ (NumberField.HeightOneSpectrum.adicAbv K v.1).IsNontrivial -+ exact adicAbv_isNontrivial v.1 -+ | Sum.inr w => by -+ change w.1.IsNontrivial -+ exact w.isNontrivial -+ -+theorem approximationAbsoluteValue_pairwise -+ (m : Modulus K) : -+ Pairwise fun i j => -+ ¬ (approximationAbsoluteValue m i).IsEquiv -+ (approximationAbsoluteValue m j) := by -+ intro i j hij -+ cases i with -+ | inl v => -+ cases j with -+ | inl w => -+ apply adicAbv_not_isEquiv_of_ne -+ intro hvw -+ apply hij -+ exact congrArg Sum.inl (Subtype.ext hvw) -+ | inr w => -+ exact adicAbv_not_isEquiv_infinitePlace v.1 w -+ | inr v => -+ cases j with -+ | inl w => -+ exact fun h => -+ adicAbv_not_isEquiv_infinitePlace w.1 v h.symm -+ | inr w => -+ intro h -+ apply hij -+ congr -+ change v.1.IsEquiv w.1 at h -+ exact -+ (InfinitePlace.eq_iff_isEquiv (K := K)).mpr h -+ -+/-- The corresponding product of local completions. -/ -+abbrev approximationCompletion (m : Modulus K) : -+ ApproximationPlace m → Type _ -+ | Sum.inl v => v.1.adicCompletion K -+ | Sum.inr w => w.Completion -+ -+noncomputable instance approximationCompletionTopologicalSpace -+ (m : Modulus K) (i : ApproximationPlace m) : -+ TopologicalSpace (approximationCompletion m i) := by -+ cases i <;> simp only [approximationCompletion] <;> infer_instance -+ -+/-- Coordinatewise completion of the valued copies of `K`. -/ -+def approximationCompletionMap (m : Modulus K) : -+ ∀ i : ApproximationPlace m, -+ WithAbs (approximationAbsoluteValue m i) → -+ approximationCompletion m i -+ | Sum.inl v => -+ fun x => -+ FinitePlace.embedding v.1 -+ (WithAbs.equiv -+ (NumberField.HeightOneSpectrum.adicAbv K v.1) x) -+ | Sum.inr w => fun x => (x : w.Completion) -+ -+theorem denseRange_finiteApproximationCompletionMap -+ (v : HeightOneSpectrum (𝓞 K)) : -+ DenseRange -+ (fun x : -+ WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => -+ FinitePlace.embedding v -+ (WithAbs.equiv -+ (NumberField.HeightOneSpectrum.adicAbv K v) x)) := by -+ have hrange : -+ Set.range -+ (fun x : -+ WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => -+ FinitePlace.embedding v -+ (WithAbs.equiv -+ (NumberField.HeightOneSpectrum.adicAbv K v) x)) = -+ Set.range (algebraMap K (v.adicCompletion K)) := by -+ ext y -+ constructor -+ · rintro ⟨x, rfl⟩ -+ exact -+ ⟨WithAbs.equiv -+ (NumberField.HeightOneSpectrum.adicAbv K v) x, rfl⟩ -+ · rintro ⟨x, rfl⟩ -+ refine -+ ⟨(WithAbs.equiv -+ (NumberField.HeightOneSpectrum.adicAbv K v)).symm x, ?_⟩ -+ rfl -+ rw [DenseRange, hrange] -+ exact v.denseRange_algebraMap K -+ -+theorem continuous_finiteApproximationCompletionMap -+ (v : HeightOneSpectrum (𝓞 K)) : -+ Continuous -+ (fun x : -+ WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => -+ FinitePlace.embedding v -+ (WithAbs.equiv -+ (NumberField.HeightOneSpectrum.adicAbv K v) x)) := by -+ apply Isometry.continuous -+ apply Isometry.of_dist_eq -+ intro x y -+ rw [dist_eq_norm, dist_eq_norm, ← map_sub, -+ FinitePlace.norm_embedding] -+ rfl -+ -+theorem denseRange_approximationCompletionMap -+ (m : Modulus K) : -+ ∀ i, DenseRange (approximationCompletionMap m i) -+ | Sum.inl v => denseRange_finiteApproximationCompletionMap v.1 -+ | Sum.inr w => -+ NumberField.InfinitePlace.Completion.denseRange_coe w -+ -+theorem continuous_approximationCompletionMap -+ (m : Modulus K) : -+ ∀ i, Continuous (approximationCompletionMap m i) -+ | Sum.inl v => continuous_finiteApproximationCompletionMap v.1 -+ | Sum.inr w => -+ NumberField.InfinitePlace.Completion.continuous_coe w -+ -+/-- The diagonal embedding into the finite product of the relevant -+completions. -/ -+def approximationEmbedding (m : Modulus K) : -+ K → (i : ApproximationPlace m) → approximationCompletion m i := -+ (Pi.map (approximationCompletionMap m)) ∘ -+ algebraMap K -+ ((i : ApproximationPlace m) → -+ WithAbs (approximationAbsoluteValue m i)) -+ -+@[simp] -+theorem approximationEmbedding_finite -+ (m : Modulus K) (x : K) (v : ↥m.finitePart.support) : -+ approximationEmbedding m x (Sum.inl v) = -+ FinitePlace.embedding v.1 x := -+ rfl -+ -+@[simp] -+theorem approximationEmbedding_infinite -+ (m : Modulus K) (x : K) (w : InfinitePlace K) : -+ approximationEmbedding m x (Sum.inr w) = -+ (x : w.Completion) := -+ rfl -+ -+theorem denseRange_approximationEmbedding (m : Modulus K) : -+ DenseRange (approximationEmbedding m) := by -+ exact -+ (DenseRange.piMap -+ (denseRange_approximationCompletionMap m)).comp -+ (AbsoluteValue.denseRange_algebraMap_pi -+ (approximationAbsoluteValue_isNontrivial m) -+ (approximationAbsoluteValue_pairwise m)) -+ (.piMap (continuous_approximationCompletionMap m)) -+ -+/-- The open set of field elements whose ratio with a fixed unit lies in -+a prescribed open unit set. -/ -+def unitRatioSet -+ {F : Type*} [Field F] (a : Fˣ) (U : Subgroup Fˣ) : -+ Set F := -+ Units.val '' (fun y : Fˣ => a * y⁻¹) ⁻¹' (U : Set Fˣ) -+ -+/-- The unit-ratio set associated to an open set of units is open. -/ -+theorem isOpen_unitRatioSet -+ {F : Type*} [Field F] [TopologicalSpace F] -+ [IsTopologicalRing F] [ContinuousInv₀ F] [T1Space F] -+ (a : Fˣ) (U : Subgroup Fˣ) -+ (hU : IsOpen (U : Set Fˣ)) : -+ IsOpen (unitRatioSet a U) := by -+ apply IsOpenUnits.isOpenEmbedding_unitsVal.isOpenMap -+ exact hU.preimage (continuous_const.mul continuous_inv) -+ -+/-- The value of the distinguished unit belongs to its unit-ratio set. -/ -+theorem val_mem_unitRatioSet -+ {F : Type*} [Field F] (a : Fˣ) (U : Subgroup Fˣ) : -+ (a : F) ∈ unitRatioSet a U := by -+ exact ⟨a, by simp, rfl⟩ -+ -+/-- The open local conditions that make `a / x` prime to `m`. -/ -+def approximationTarget (m : Modulus K) (a : IdeleGroup K) : -+ ∀ i : ApproximationPlace m, Set (approximationCompletion m i) -+ | Sum.inl v => -+ unitRatioSet (a.2 v.1) -+ (localHigherUnitGroup v.1 (m.finitePart v.1)) -+ | Sum.inr w => -+ unitRatioSet -+ (ContinuousMulEquiv.piUnits a.1 w) -+ (m.localInfiniteCongruenceSubgroup w) -+ -+theorem isOpen_approximationTarget -+ (m : Modulus K) (a : IdeleGroup K) : -+ ∀ i, IsOpen (approximationTarget m a i) -+ | Sum.inl v => by -+ change IsOpen -+ (unitRatioSet (a.2 v.1) -+ (localHigherUnitGroup v.1 (m.finitePart v.1))) -+ exact isOpen_unitRatioSet _ _ -+ (isOpen_localHigherUnitGroup v.1 (m.finitePart v.1)) -+ | Sum.inr w => by -+ change IsOpen -+ (unitRatioSet -+ (ContinuousMulEquiv.piUnits a.1 w) -+ (m.localInfiniteCongruenceSubgroup w)) -+ apply isOpen_unitRatioSet _ _ -+ classical -+ by_cases hw : w.IsReal -+ · by_cases hmem : (⟨w, hw⟩ : RealPlace K) ∈ m.infinitePart -+ · rw [Modulus.localInfiniteCongruenceSubgroup, -+ dite_eq_left hw, dite_eq_left hmem] -+ exact isOpen_infinitePositiveSubgroup w -+ · rw [Modulus.localInfiniteCongruenceSubgroup, -+ dite_eq_left hw, dite_eq_right hmem] -+ exact isOpen_univ -+ · rw [Modulus.localInfiniteCongruenceSubgroup, dite_eq_right hw] -+ exact isOpen_univ -+ -+/-- The given idele itself lies in the product of its approximation -+neighborhoods. -/ -+def approximationTargetPoint -+ (m : Modulus K) (a : IdeleGroup K) : -+ (i : ApproximationPlace m) → approximationCompletion m i -+ | Sum.inl v => (a.2 v.1 : v.1.adicCompletion K) -+ | Sum.inr w => -+ (ContinuousMulEquiv.piUnits a.1 w : w.Completion) -+ -+theorem approximationTargetPoint_mem -+ (m : Modulus K) (a : IdeleGroup K) : -+ approximationTargetPoint m a ∈ -+ Set.univ.pi (approximationTarget m a) := by -+ intro i _hi -+ cases i with -+ | inl v => -+ exact val_mem_unitRatioSet _ _ -+ | inr w => -+ exact val_mem_unitRatioSet _ _ -+ -+ -+end RayClass -diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealGroups.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealGroups.lean -new file mode 100644 -index 0000000..2b15f82 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealGroups.lean -@@ -0,0 +1,417 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Topology -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.LocallyCompact -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.PrincipalNorm -+import ValuedFieldTheory.Valuation.AbsoluteValue.Theory.AbsoluteValues -+import Mathlib.NumberTheory.NumberField.Completion.InfinitePlace -+import Mathlib.Topology.Algebra.IsOpenUnits -+import Mathlib.Topology.Algebra.Ring.Compact -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped NumberField WithZero Classical -+open NumberField IsDedekindDomain -+ -+noncomputable section -+ -+ -+variable {K : Type*} [Field K] [NumberField K] -+ -+namespace RayClass -+ -+/-- Fractional ideals having valuation zero at every finite prime in the -+support of the modulus. -/ -+def primeToModulusIdeals (m : Modulus K) : -+ Subgroup (FractionalIdealGroup K) where -+ carrier := {I | ∀ v, v ∈ m.finitePart.support → -+ FractionalIdeal.count K v -+ (I : FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0} -+ one_mem' v _ := FractionalIdeal.count_one K v -+ mul_mem' {I J} hI hJ v hv := by -+ rw [Units.val_mul, -+ FractionalIdeal.count_mul K v (Units.ne_zero I) (Units.ne_zero J), -+ hI v hv, hJ v hv, add_zero] -+ inv_mem' {I} hI v hv := by -+ rw [Units.val_inv_eq_inv_val, FractionalIdeal.count_inv K v, -+ hI v hv, neg_zero] -+ -+@[simp] -+theorem mem_primeToModulusIdeals_iff -+ (m : Modulus K) (I : FractionalIdealGroup K) : -+ I ∈ primeToModulusIdeals m ↔ -+ ∀ v, v ∈ m.finitePart.support → -+ FractionalIdeal.count K v -+ (I : FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0 := -+ Iff.rfl -+ -+/-- A finite prime outside the support of `m`, regarded as an element of -+the group of fractional ideals prime to `m`. -/ -+def primeToModulusIdeal -+ (m : Modulus K) -+ (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ m.finitePart.support) : -+ primeToModulusIdeals m := -+ ⟨FractionalIdealGroup.prime v, by -+ intro w hw -+ have hwv : w ≠ v := by -+ intro h -+ exact hv (h ▸ hw) -+ change -+ FractionalIdeal.count K w -+ (v.asIdeal : -+ FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = -+ 0 -+ exact -+ FractionalIdeal.count_maximal_coprime -+ K w hwv.symm⟩ -+ -+/-- Coercing a prime outside the modulus support recovers its prime -+fractional ideal. -/ -+@[simp] -+theorem primeToModulusIdeal_coe -+ (m : Modulus K) -+ (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ m.finitePart.support) : -+ (primeToModulusIdeal m v hv : -+ FractionalIdealGroup K) = -+ FractionalIdealGroup.prime v := -+ rfl -+ -+/-- Finite ideles satisfying the higher-unit condition at every prime in -+the support of the modulus. -/ -+def finitePrimeToModulusSubgroup (m : Modulus K) : -+ Subgroup (FiniteIdeleGroup K) where -+ carrier := {a | ∀ v, v ∈ m.finitePart.support → -+ a v ∈ localHigherUnitGroup v (m.finitePart v)} -+ one_mem' v _ := (localHigherUnitGroup v (m.finitePart v)).one_mem -+ mul_mem' ha hb v hv := -+ (localHigherUnitGroup v (m.finitePart v)).mul_mem (ha v hv) (hb v hv) -+ inv_mem' ha v hv := -+ (localHigherUnitGroup v (m.finitePart v)).inv_mem (ha v hv) -+ -+/-- Ideles satisfying the infinite positivity and finite higher-unit -+conditions of a modulus. -/ -+def idelePrimeToModulusSubgroup (m : Modulus K) : -+ Subgroup (IdeleGroup K) := -+ m.infiniteCongruenceSubgroup.prod -+ (finitePrimeToModulusSubgroup m) -+ -+theorem localHigherUnitGroup_le_integralUnits -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ) : -+ localHigherUnitGroup v n ≤ -+ (v.adicCompletionIntegers K).units := by -+ intro x hx -+ rw [mem_localHigherUnitGroup_iff] at hx -+ obtain ⟨y, rfl, _⟩ := hx -+ exact y.property -+ -+theorem fractionalIdeal_mem_primeToModulusIdeals -+ (m : Modulus K) (a : IdeleGroup K) -+ (ha : a ∈ idelePrimeToModulusSubgroup m) : -+ IdeleGroup.fractionalIdeal a ∈ primeToModulusIdeals m := by -+ intro v hv -+ change FractionalIdeal.count K v -+ (((FractionalIdealGroup.factorization (K := K)) -+ (FiniteIdeleGroup.valuationVector a.2) : -+ FractionalIdealGroup K) : -+ FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0 -+ rw [FractionalIdealGroup.count_factorization, -+ FiniteIdeleGroup.valuationVector_apply] -+ apply (FiniteIdeleGroup.localOrder_eq_zero_iff v (a.2 v)).2 -+ exact localHigherUnitGroup_le_integralUnits v (m.finitePart v) (ha.2 v hv) -+ -+/-- The fractional-ideal map restricted to ideles prime to a modulus. -/ -+def primeToIdealMap (m : Modulus K) : -+ idelePrimeToModulusSubgroup m →* -+ primeToModulusIdeals m where -+ toFun a := -+ ⟨IdeleGroup.fractionalIdeal a, -+ fractionalIdeal_mem_primeToModulusIdeals m a a.property⟩ -+ map_one' := by -+ apply Subtype.ext -+ exact map_one _ -+ map_mul' a b := by -+ apply Subtype.ext -+ exact map_mul _ _ _ -+ -+/-- A finite idele with a prescribed valuation vector away from the -+support of a modulus and value one on its support. -/ -+def valuationVectorSectionPrimeTo -+ (m : Modulus K) -+ (e : HeightOneSpectrum (𝓞 K) →₀ ℤ) : -+ FiniteIdeleGroup K := -+ ⟨fun v => -+ if v ∈ m.finitePart.support then 1 -+ else FiniteIdeleGroup.chosenLocalOrderSection v (e v), by -+ filter_upwards -+ [m.finitePart.support.eventually_cofinite_notMem, -+ e.support.eventually_cofinite_notMem] with v hvm he -+ simp only [hvm, ↓reduceIte] -+ apply (FiniteIdeleGroup.localOrder_eq_zero_iff v _).1 -+ rw [FiniteIdeleGroup.localOrder_chosenLocalOrderSection, -+ Finsupp.notMem_support_iff.mp he]⟩ -+ -+theorem valuationVector_valuationVectorSectionPrimeTo -+ (m : Modulus K) -+ (e : HeightOneSpectrum (𝓞 K) →₀ ℤ) -+ (he : ∀ v, v ∈ m.finitePart.support → e v = 0) : -+ FiniteIdeleGroup.valuationVector -+ (valuationVectorSectionPrimeTo m e) = -+ Multiplicative.ofAdd e := by -+ apply Multiplicative.ext -+ ext v -+ rw [FiniteIdeleGroup.valuationVector_apply] -+ by_cases hv : v ∈ m.finitePart.support -+ · change -+ (FiniteIdeleGroup.localOrder v -+ (if v ∈ m.finitePart.support then 1 -+ else FiniteIdeleGroup.chosenLocalOrderSection v (e v))).toAdd = -+ e v -+ rw [ite_eq_left hv, map_one] -+ exact (he v hv).symm -+ · change -+ (FiniteIdeleGroup.localOrder v -+ (if v ∈ m.finitePart.support then 1 -+ else FiniteIdeleGroup.chosenLocalOrderSection v (e v))).toAdd = -+ e v -+ rw [ite_eq_right hv, -+ FiniteIdeleGroup.localOrder_chosenLocalOrderSection] -+ -+theorem primeToIdealMap_surjective (m : Modulus K) : -+ Function.Surjective (primeToIdealMap m) := by -+ intro I -+ let e : HeightOneSpectrum (𝓞 K) →₀ ℤ := -+ FractionalIdealGroup.countVector (I : FractionalIdealGroup K) -+ have he : ∀ v, v ∈ m.finitePart.support → e v = 0 := by -+ intro v hv -+ exact I.property v hv -+ let a : IdeleGroup K := -+ (1, valuationVectorSectionPrimeTo m e) -+ have ha : a ∈ idelePrimeToModulusSubgroup m := by -+ constructor -+ · exact m.infiniteCongruenceSubgroup.one_mem -+ · intro v hv -+ change -+ (if v ∈ m.finitePart.support then 1 -+ else FiniteIdeleGroup.chosenLocalOrderSection v (e v)) ∈ -+ localHigherUnitGroup v (m.finitePart v) -+ rw [ite_eq_left hv] -+ exact (localHigherUnitGroup v (m.finitePart v)).one_mem -+ refine ⟨⟨a, ha⟩, ?_⟩ -+ apply Subtype.ext -+ apply FractionalIdealGroup.ext_count -+ intro v -+ change FractionalIdeal.count K v -+ (((FractionalIdealGroup.factorization (K := K)) -+ (FiniteIdeleGroup.valuationVector -+ (valuationVectorSectionPrimeTo m e)) : -+ FractionalIdealGroup K) : -+ FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = -+ FractionalIdeal.count K v -+ ((I : FractionalIdealGroup K) : -+ FractionalIdeal (nonZeroDivisors (𝓞 K)) K) -+ rw [valuationVector_valuationVectorSectionPrimeTo m e he, -+ FractionalIdealGroup.count_factorization] -+ exact FractionalIdealGroup.countVector_apply I v -+ -+theorem ideleCongruenceSubgroup_le_primeTo -+ (m : Modulus K) : -+ m.ideleCongruenceSubgroup ≤ -+ idelePrimeToModulusSubgroup m := by -+ intro a ha -+ exact ⟨ha.1, fun v _ => ha.2 v⟩ -+ -+/-- The congruence subgroup, viewed inside the subgroup of ideles prime -+to the modulus. -/ -+def congruenceSubgroupInPrimeTo (m : Modulus K) : -+ Subgroup (idelePrimeToModulusSubgroup m) := -+ m.ideleCongruenceSubgroup.subgroupOf -+ (idelePrimeToModulusSubgroup m) -+ -+theorem primeToIdealMap_ker (m : Modulus K) : -+ (primeToIdealMap m).ker = -+ congruenceSubgroupInPrimeTo m := by -+ ext a -+ constructor -+ · intro ha -+ have hintegral : -+ (a : IdeleGroup K) ∈ -+ IdeleGroup.integralAtFinitePlaces (K := K) := by -+ rw [← IdeleGroup.fractionalIdeal_ker, -+ MonoidHom.mem_ker] -+ exact congrArg Subtype.val -+ (MonoidHom.mem_ker.mp ha) -+ constructor -+ · exact a.property.1 -+ · intro v -+ by_cases hv : v ∈ m.finitePart.support -+ · exact a.property.2 v hv -+ · rw [Finsupp.notMem_support_iff.mp hv, -+ localHigherUnitGroup_zero] -+ exact hintegral v -+ · intro ha -+ apply MonoidHom.mem_ker.mpr -+ apply Subtype.ext -+ change IdeleGroup.fractionalIdeal (a : IdeleGroup K) = 1 -+ rw [← MonoidHom.mem_ker, -+ IdeleGroup.fractionalIdeal_ker] -+ intro v -+ exact localHigherUnitGroup_le_integralUnits v (m.finitePart v) (ha.2 v) -+ -+/-- The quotient of ideles prime to a modulus by the congruence subgroup, -+identified with fractional ideals prime to the modulus. -/ -+def quotientCongruenceEquivPrimeToIdeals (m : Modulus K) : -+ idelePrimeToModulusSubgroup m ⧸ -+ congruenceSubgroupInPrimeTo m ≃* -+ primeToModulusIdeals m := by -+ rw [← primeToIdealMap_ker m] -+ exact QuotientGroup.quotientKerEquivOfSurjective -+ (primeToIdealMap m) (primeToIdealMap_surjective m) -+ -+/-- Principal ideles satisfying the modulus conditions, considered inside -+`I_K^(m)`. -/ -+def principalSubgroupInPrimeTo (m : Modulus K) : -+ Subgroup (idelePrimeToModulusSubgroup m) := -+ Subgroup.comap (idelePrimeToModulusSubgroup m).subtype -+ (IdeleGroup.principalSubgroup K) -+ -+/-- Principal ideals generated by a totally positive element congruent to -+one modulo the finite modulus. -/ -+def principalRayIdealSubgroup (m : Modulus K) : -+ Subgroup (primeToModulusIdeals m) := -+ Subgroup.map (primeToIdealMap m) -+ (principalSubgroupInPrimeTo m) -+ -+theorem mem_principalRayIdealSubgroup_iff -+ (m : Modulus K) (I : primeToModulusIdeals m) : -+ I ∈ principalRayIdealSubgroup m ↔ -+ ∃ x : Kˣ, -+ ∃ _hx : IdeleGroup.principalIdele K x ∈ -+ idelePrimeToModulusSubgroup m, -+ toPrincipalIdeal (𝓞 K) K x = -+ (I : FractionalIdealGroup K) := by -+ constructor -+ · rintro ⟨a, ha, hmap⟩ -+ obtain ⟨x, hx⟩ := ha -+ refine ⟨x, ?_, ?_⟩ -+ · rw [hx] -+ exact a.property -+ · have hval := congrArg Subtype.val hmap -+ change IdeleGroup.fractionalIdeal (a : IdeleGroup K) = -+ (I : FractionalIdealGroup K) at hval -+ rw [← IdeleGroup.fractionalIdeal_principalIdele] -+ exact (congrArg (IdeleGroup.fractionalIdeal (K := K)) hx).trans hval -+ · rintro ⟨x, hx, hideal⟩ -+ let a : idelePrimeToModulusSubgroup m := -+ ⟨IdeleGroup.principalIdele K x, hx⟩ -+ have ha : a ∈ principalSubgroupInPrimeTo m := by -+ change IdeleGroup.principalIdele K x ∈ -+ IdeleGroup.principalSubgroup K -+ exact ⟨x, rfl⟩ -+ refine ⟨a, ha, ?_⟩ -+ apply Subtype.ext -+ change IdeleGroup.fractionalIdeal -+ (IdeleGroup.principalIdele K x) = -+ (I : FractionalIdealGroup K) -+ rw [IdeleGroup.fractionalIdeal_principalIdele, hideal] -+ -+/-- The ideal-theoretic ray class group `J_K^m / P_K^m`. -/ -+abbrev IdealRayClassGroup (m : Modulus K) := -+ primeToModulusIdeals m ⧸ principalRayIdealSubgroup m -+ -+/-- The canonical projection from ideles prime to the modulus to the -+ideal-theoretic ray class group. -/ -+def idealRayProjection (m : Modulus K) : -+ idelePrimeToModulusSubgroup m →* -+ IdealRayClassGroup m := -+ (QuotientGroup.mk' (principalRayIdealSubgroup m)).comp -+ (primeToIdealMap m) -+ -+/-- The subgroup generated by congruence ideles and principal ideles -+inside the ideles prime to a modulus. -/ -+def raySubgroupInPrimeTo (m : Modulus K) : -+ Subgroup (idelePrimeToModulusSubgroup m) := -+ congruenceSubgroupInPrimeTo m ⊔ -+ principalSubgroupInPrimeTo m -+ -+theorem idealRayProjection_surjective (m : Modulus K) : -+ Function.Surjective (idealRayProjection m) := by -+ intro c -+ obtain ⟨I, rfl⟩ := -+ QuotientGroup.mk'_surjective -+ (principalRayIdealSubgroup m) c -+ obtain ⟨a, rfl⟩ := primeToIdealMap_surjective m I -+ exact ⟨a, rfl⟩ -+ -+theorem idealRayProjection_ker (m : Modulus K) : -+ (idealRayProjection m).ker = -+ raySubgroupInPrimeTo m := by -+ ext a -+ constructor -+ · intro ha -+ change QuotientGroup.mk' -+ (principalRayIdealSubgroup m) -+ (primeToIdealMap m a) = 1 at ha -+ rw [QuotientGroup.mk'_apply, -+ QuotientGroup.eq_one_iff] at ha -+ obtain ⟨p, hp, hpa⟩ := ha -+ let n : idelePrimeToModulusSubgroup m := a * p⁻¹ -+ have hn : n ∈ congruenceSubgroupInPrimeTo m := by -+ rw [← primeToIdealMap_ker m, MonoidHom.mem_ker] -+ change primeToIdealMap m (a * p⁻¹) = 1 -+ rw [map_mul, map_inv, hpa] -+ simp -+ rw [raySubgroupInPrimeTo, Subgroup.mem_sup] -+ refine ⟨n, hn, p, hp, ?_⟩ -+ dsimp [n] -+ group -+ · intro ha -+ rw [raySubgroupInPrimeTo, Subgroup.mem_sup] at ha -+ obtain ⟨n, hn, p, hp, rfl⟩ := ha -+ change QuotientGroup.mk' -+ (principalRayIdealSubgroup m) -+ (primeToIdealMap m (n * p)) = 1 -+ rw [map_mul] -+ have hn' : primeToIdealMap m n = 1 := -+ MonoidHom.mem_ker.mp -+ ((primeToIdealMap_ker m).symm ▸ hn) -+ rw [hn', one_mul] -+ rw [QuotientGroup.mk'_apply, -+ QuotientGroup.eq_one_iff] -+ exact ⟨p, hp, rfl⟩ -+ -+/-- The quotient of ideles prime to the modulus by the full ray subgroup, -+identified with the ideal-theoretic ray class group. -/ -+def quotientRaySubgroupEquivIdealRayClassGroup -+ (m : Modulus K) : -+ idelePrimeToModulusSubgroup m ⧸ -+ raySubgroupInPrimeTo m ≃* -+ IdealRayClassGroup m := -+ (QuotientGroup.quotientMulEquivOfEq -+ (idealRayProjection_ker m).symm).trans -+ (QuotientGroup.quotientKerEquivOfSurjective -+ (idealRayProjection m) -+ (idealRayProjection_surjective m)) -+ -+/-- The quotient equivalence induced by the ideal-ray projection evaluates on -+the class of a prime-to-modulus idele as the original projection. -/ -+@[simp] -+theorem quotientRaySubgroupEquivIdealRayClassGroup_mk -+ (m : Modulus K) (a : idelePrimeToModulusSubgroup m) : -+ quotientRaySubgroupEquivIdealRayClassGroup m -+ (QuotientGroup.mk' (raySubgroupInPrimeTo m) a) = -+ idealRayProjection m a := by -+ rw [quotientRaySubgroupEquivIdealRayClassGroup, -+ MulEquiv.trans_apply, QuotientGroup.mk'_apply, -+ QuotientGroup.quotientMulEquivOfEq_mk] -+ exact QuotientGroup.kerLift_mk (idealRayProjection m) a -+ -+ -+end RayClass -diff --git a/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassIdealModulusProjection.lean b/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassIdealModulusProjection.lean -index e37e3df..415463a 100644 ---- a/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassIdealModulusProjection.lean -+++ b/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassIdealModulusProjection.lean -@@ -90,7 +90,7 @@ private theorem rayCongruent_of_le - · intro v hv - exact hx.2 v (hmn.2 hv) - --private theorem rayPrimeToIdeals_antitone -+theorem rayPrimeToIdeals_antitone - {K : Type u} [Field K] [NumberField K] - {m n : RayClassModulus K} (hmn : m ≤ n) : - rayClassPrimeToIdeals n ≤ rayClassPrimeToIdeals m := by -diff --git a/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassOfFinitePrime.lean b/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassOfFinitePrime.lean -index a3e9746..d8d3db5 100644 ---- a/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassOfFinitePrime.lean -+++ b/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassOfFinitePrime.lean -@@ -9,6 +9,7 @@ import ClassFieldTheory.Definitions.ConductorsAndRayClassFields.OrdinaryRayClass - import ClassFieldTheory.Definitions.ConductorsAndRayClassFields.RayClassGroup - import ClassFieldTheory.Definitions.FrobeniusAndHilbertClassFields.FinitePrimeFractionalIdeal - -+ - set_option autoImplicit false - - /-! -@@ -24,7 +25,7 @@ namespace ClassFieldTheory - - universe u - --private lemma finitePrimeFractionalIdeal_mem_primeTo -+lemma finitePrimeFractionalIdeal_mem_primeTo - {K : Type u} [Field K] [NumberField K] - (m : RayClassModulus K) - (v : HeightOneSpectrum (𝓞 K)) -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocity.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocity.lean -index 053f2b7..e213e03 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocity.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocity.lean -@@ -4,158 +4,18 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.RayClassFieldRealization --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.ArithmeticNormalization -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ArithmeticRayClassFieldReciprocityNormResidue - - set_option autoImplicit false -- --/-! --# Arithmetic reciprocity for actual ray class fields -- --This is the canonical topological isomorphism --`Gal(Kᵐ/K) ≃ₜ* C_K/C_Kᵐ` with arithmetic Frobenius --normalization. It uses the actual selected ray class field, its exact --idèle norm range, the finite Krull topology, and the native ray-class --quotient topology. ---/ -- - open scoped Classical NumberField -- - noncomputable section -- - namespace GlobalClassFieldTheory - namespace GlobalClassFields -- - open NumberField - open Reciprocity -- --private theorem arithmeticRayClassIdeleClassGroupIsMulCommutative -- {F : Type} [Field F] [NumberField F] : -- IsMulCommutative (IdeleClassGroup F) := -- ⟨⟨fun a b => mul_comm a b⟩⟩ -- - attribute [local instance] arithmeticRayClassIdeleClassGroupIsMulCommutative -- - variable {K : Type} [Field K] [NumberField K] - --/-- Arithmetic reciprocity followed by transport between equal norm --quotients sends a norm-residue symbol to its represented quotient class. -/ --private theorem -- arithmeticReciprocity_quotientMulEquivOfEq_globalNormResidue -- {F E : Type} [Field F] [NumberField F] -- [Field E] [NumberField E] [Algebra F E] -- [FiniteDimensional F E] [IsAbelianGalois F E] -- (H : Subgroup (IdeleClassGroup F)) -- (h : (_root_.ideleClassNorm F E).range = H) -- (c : IdeleClassGroup F) : -- QuotientGroup.quotientMulEquivOfEq h -- (arithmeticGlobalReciprocityContinuousMulEquiv F E -- (arithmeticGlobalNormResidueMonoidHom F E c)) = -- QuotientGroup.mk' H c := by -- let e := arithmeticGlobalReciprocityContinuousMulEquiv F E -- let q := -- QuotientGroup.mk' -- (_root_.ideleClassNorm F E).range c -- have hsymm : -- e.symm q = arithmeticGlobalNormResidueMonoidHom F E c := -- arithmeticGlobalReciprocityContinuousMulEquiv_symm_mk F E c -- have he : -- e (arithmeticGlobalNormResidueMonoidHom F E c) = q := by -- calc -- e (arithmeticGlobalNormResidueMonoidHom F E c) = -- e (e.symm q) := -- congrArg (fun σ => e σ) hsymm.symm -- _ = q := e.apply_symm_apply q -- calc -- QuotientGroup.quotientMulEquivOfEq h -- (arithmeticGlobalReciprocityContinuousMulEquiv F E -- (arithmeticGlobalNormResidueMonoidHom F E c)) = -- QuotientGroup.quotientMulEquivOfEq h q := -- congrArg (fun x => QuotientGroup.quotientMulEquivOfEq h x) he -- _ = QuotientGroup.mk' H c := -- QuotientGroup.quotientMulEquivOfEq_mk h c -- --/-- Arithmetic global reciprocity for the actual selected ray class --field, bundled with both native topologies. -/ --noncomputable def -- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup -- (m : RayClass.Modulus K) : -- Gal((rayClassField K m) / K) ≃ₜ* -- RayClass.RayClassGroup m := by -- letI normQuotientDiscreteTopology : DiscreteTopology -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm -- K (rayClassField K m)).range) := -- ideleClassNormQuotient_discreteTopology -- K (rayClassField K m) -- letI rayClassGroupDiscreteTopology : DiscreteTopology -- (RayClass.RayClassGroup m) := -- QuotientGroup.discreteTopology -- (RayClass.isOpen_congruenceSubgroup m) -- let quotientTransport : -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm -- K (rayClassField K m)).range) ≃ₜ* -- RayClass.RayClassGroup m := -- { QuotientGroup.quotientMulEquivOfEq -- (rayClassField_ideleClassNorm_range_over_original -- (K := K) m) with -- continuous_toFun := continuous_of_discreteTopology -- continuous_invFun := continuous_of_discreteTopology } -- exact -- (arithmeticGlobalReciprocityContinuousMulEquiv -- K (rayClassField K m)).trans -- quotientTransport -- --/-- Pointwise evaluation of arithmetic ray-class reciprocity separates --global reciprocity from the transport between the equal norm quotients. -/ --private theorem -- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_apply -- (m : RayClass.Modulus K) -- (σ : Gal((rayClassField K m) / K)) : -- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup -- (K := K) m σ = -- QuotientGroup.quotientMulEquivOfEq -- (rayClassField_ideleClassNorm_range_over_original -- (K := K) m) -- (arithmeticGlobalReciprocityContinuousMulEquiv -- K (rayClassField K m) σ) := by -- rfl -- --/-- Arithmetic ray-class reciprocity sends the arithmetic global --norm-residue symbol of an idèle class to its literal ray class. -/ --@[simp] --theorem -- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_globalNormResidue -- (m : RayClass.Modulus K) -- (c : IdeleClassGroup K) : -- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup -- (K := K) m -- (arithmeticGlobalNormResidueMonoidHom -- K (rayClassField K m) c) = -- QuotientGroup.mk' -- (RayClass.Modulus.congruenceSubgroup m) c := by -- calc -- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup -- (K := K) m -- (arithmeticGlobalNormResidueMonoidHom -- K (rayClassField K m) c) = -- QuotientGroup.quotientMulEquivOfEq -- (rayClassField_ideleClassNorm_range_over_original -- (K := K) m) -- (arithmeticGlobalReciprocityContinuousMulEquiv -- K (rayClassField K m) -- (arithmeticGlobalNormResidueMonoidHom -- K (rayClassField K m) c)) := -- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_apply -- (K := K) m _ -- _ = QuotientGroup.mk' -- (RayClass.Modulus.congruenceSubgroup m) c := -- arithmeticReciprocity_quotientMulEquivOfEq_globalNormResidue -- (RayClass.Modulus.congruenceSubgroup m) -- (rayClassField_ideleClassNorm_range_over_original -- (K := K) m) c -- - /-- Inverse arithmetic ray reciprocity sends a represented ray class - back to the arithmetic global norm-residue symbol. -/ - @[simp] -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityBase.lean -new file mode 100644 -index 0000000..6519cd0 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityBase.lean -@@ -0,0 +1,112 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.RayClassFieldRealization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.ArithmeticNormalization -+ -+ -+set_option autoImplicit false -+ -+/-! -+# Arithmetic reciprocity for actual ray class fields -+ -+This is the canonical topological isomorphism -+`Gal(Kᵐ/K) ≃ₜ* C_K/C_Kᵐ` with arithmetic Frobenius -+normalization. It uses the actual selected ray class field, its exact -+idèle norm range, the finite Krull topology, and the native ray-class -+quotient topology. -+-/ -+ -+open scoped Classical NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace GlobalClassFields -+ -+open NumberField -+open Reciprocity -+ -+theorem arithmeticRayClassIdeleClassGroupIsMulCommutative -+ {F : Type} [Field F] [NumberField F] : -+ IsMulCommutative (IdeleClassGroup F) := -+ ⟨⟨fun a b => mul_comm a b⟩⟩ -+ -+attribute [local instance] arithmeticRayClassIdeleClassGroupIsMulCommutative -+ -+variable {K : Type} [Field K] [NumberField K] -+ -+/-- Arithmetic reciprocity followed by transport between equal norm -+quotients sends a norm-residue symbol to its represented quotient class. -/ -+theorem -+ arithmeticReciprocity_quotientMulEquivOfEq_globalNormResidue -+ {F E : Type} [Field F] [NumberField F] -+ [Field E] [NumberField E] [Algebra F E] -+ [FiniteDimensional F E] [IsAbelianGalois F E] -+ (H : Subgroup (IdeleClassGroup F)) -+ (h : (_root_.ideleClassNorm F E).range = H) -+ (c : IdeleClassGroup F) : -+ QuotientGroup.quotientMulEquivOfEq h -+ (arithmeticGlobalReciprocityContinuousMulEquiv F E -+ (arithmeticGlobalNormResidueMonoidHom F E c)) = -+ QuotientGroup.mk' H c := by -+ let e := arithmeticGlobalReciprocityContinuousMulEquiv F E -+ let q := -+ QuotientGroup.mk' -+ (_root_.ideleClassNorm F E).range c -+ have hsymm : -+ e.symm q = arithmeticGlobalNormResidueMonoidHom F E c := -+ arithmeticGlobalReciprocityContinuousMulEquiv_symm_mk F E c -+ have he : -+ e (arithmeticGlobalNormResidueMonoidHom F E c) = q := by -+ calc -+ e (arithmeticGlobalNormResidueMonoidHom F E c) = -+ e (e.symm q) := -+ congrArg (fun σ => e σ) hsymm.symm -+ _ = q := e.apply_symm_apply q -+ calc -+ QuotientGroup.quotientMulEquivOfEq h -+ (arithmeticGlobalReciprocityContinuousMulEquiv F E -+ (arithmeticGlobalNormResidueMonoidHom F E c)) = -+ QuotientGroup.quotientMulEquivOfEq h q := -+ congrArg (fun x => QuotientGroup.quotientMulEquivOfEq h x) he -+ _ = QuotientGroup.mk' H c := -+ QuotientGroup.quotientMulEquivOfEq_mk h c -+ -+/-- Arithmetic global reciprocity for the actual selected ray class -+field, bundled with both native topologies. -/ -+noncomputable def -+ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup -+ (m : RayClass.Modulus K) : -+ Gal((rayClassField K m) / K) ≃ₜ* -+ RayClass.RayClassGroup m := by -+ letI normQuotientDiscreteTopology : DiscreteTopology -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm -+ K (rayClassField K m)).range) := -+ ideleClassNormQuotient_discreteTopology -+ K (rayClassField K m) -+ letI rayClassGroupDiscreteTopology : DiscreteTopology -+ (RayClass.RayClassGroup m) := -+ QuotientGroup.discreteTopology -+ (RayClass.isOpen_congruenceSubgroup m) -+ let quotientTransport : -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm -+ K (rayClassField K m)).range) ≃ₜ* -+ RayClass.RayClassGroup m := -+ { QuotientGroup.quotientMulEquivOfEq -+ (rayClassField_ideleClassNorm_range_over_original -+ (K := K) m) with -+ continuous_toFun := continuous_of_discreteTopology -+ continuous_invFun := continuous_of_discreteTopology } -+ exact -+ (arithmeticGlobalReciprocityContinuousMulEquiv -+ K (rayClassField K m)).trans -+ quotientTransport -+ -+end GlobalClassFields -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityEvaluation.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityEvaluation.lean -new file mode 100644 -index 0000000..41d3435 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityEvaluation.lean -@@ -0,0 +1,51 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ArithmeticRayClassFieldReciprocityBase -+ -+set_option autoImplicit false -+open scoped Classical NumberField -+noncomputable section -+namespace GlobalClassFieldTheory -+namespace GlobalClassFields -+open NumberField -+open Reciprocity -+attribute [local instance] arithmeticRayClassIdeleClassGroupIsMulCommutative -+private theorem mulEquiv_toEquiv_apply -+ {A B : Type*} [Mul A] [Mul B] -+ (e : A ≃* B) (x : A) : e.toEquiv x = e x := by rfl -+ -+private theorem continuousMulEquiv_toMulEquiv_apply -+ {A B : Type*} [TopologicalSpace A] [TopologicalSpace B] [Mul A] [Mul B] -+ (e : A ≃ₜ* B) (x : A) : e.toMulEquiv x = e x := by rfl -+ -+variable {K : Type} [Field K] [NumberField K] -+ -+ -+/-- Evaluation of ray class reciprocity is global reciprocity transported -+through the equality of the ray norm subgroup and the idele norm range. -/ -+theorem -+ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_apply -+ (m : RayClass.Modulus K) -+ (σ : Gal((rayClassField K m) / K)) : -+ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup -+ (K := K) m σ = -+ QuotientGroup.quotientMulEquivOfEq -+ (rayClassField_ideleClassNorm_range_over_original -+ (K := K) m) -+ (arithmeticGlobalReciprocityContinuousMulEquiv -+ K (rayClassField K m) σ) := by -+ simp only [arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup, -+ ContinuousMulEquiv.trans, MulEquiv.trans, Equiv.trans, -+ ContinuousMulEquiv.coe_mk, MulEquiv.coe_mk, Equiv.coe_fn_mk, -+ Function.comp_apply, -+ mulEquiv_toEquiv_apply] -+ have h := continuousMulEquiv_toMulEquiv_apply -+ (arithmeticGlobalReciprocityContinuousMulEquiv K (rayClassField K m)) σ -+ with_reducible exact congrArg (fun q => QuotientGroup.quotientMulEquivOfEq (rayClassField_ideleClassNorm_range_over_original (K := K) m) q) h -+ -+end GlobalClassFields -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityNormResidue.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityNormResidue.lean -new file mode 100644 -index 0000000..ce8c03e ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityNormResidue.lean -@@ -0,0 +1,54 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ArithmeticRayClassFieldReciprocityEvaluation -+ -+set_option autoImplicit false -+open scoped Classical NumberField -+noncomputable section -+namespace GlobalClassFieldTheory -+namespace GlobalClassFields -+open NumberField -+open Reciprocity -+attribute [local instance] arithmeticRayClassIdeleClassGroupIsMulCommutative -+variable {K : Type} [Field K] [NumberField K] -+ -+/-- Arithmetic ray-class reciprocity sends the arithmetic global -+norm-residue symbol of an idèle class to its literal ray class. -/ -+@[simp] -+theorem -+ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_globalNormResidue -+ (m : RayClass.Modulus K) -+ (c : IdeleClassGroup K) : -+ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup -+ (K := K) m -+ (arithmeticGlobalNormResidueMonoidHom -+ K (rayClassField K m) c) = -+ QuotientGroup.mk' -+ (RayClass.Modulus.congruenceSubgroup m) c := by -+ calc -+ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup -+ (K := K) m -+ (arithmeticGlobalNormResidueMonoidHom -+ K (rayClassField K m) c) = -+ QuotientGroup.quotientMulEquivOfEq -+ (rayClassField_ideleClassNorm_range_over_original -+ (K := K) m) -+ (arithmeticGlobalReciprocityContinuousMulEquiv -+ K (rayClassField K m) -+ (arithmeticGlobalNormResidueMonoidHom -+ K (rayClassField K m) c)) := -+ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_apply -+ (K := K) m _ -+ _ = QuotientGroup.mk' -+ (RayClass.Modulus.congruenceSubgroup m) c := -+ arithmeticReciprocity_quotientMulEquivOfEq_globalNormResidue -+ (RayClass.Modulus.congruenceSubgroup m) -+ (rayClassField_ideleClassNorm_range_over_original -+ (K := K) m) c -+ -+end GlobalClassFields -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActual.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActual.lean -index 11beea0..7ab1c83 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActual.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActual.lean -@@ -4,106 +4,17 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldReciprocity.Transport --import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.BigHilbertClassFieldNaturality --import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldComparison - --set_option autoImplicit false -- --/-! --# Big Hilbert reciprocity over the realized base field -- --This leaf specializes the shared reciprocity transport to the actual base --field of the selected big Hilbert class field. ---/ -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldReciprocity.BigActualEquiv - -+set_option autoImplicit false - open scoped Classical IsMulCommutative NumberField -- - noncomputable section -- - namespace GlobalClassFieldTheory - namespace GlobalClassFields -- - open Reciprocity -- - variable {K : Type} [Field K] [NumberField K] -- --local instance -- bigHilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative -- {F : Type} [Field F] [NumberField F] : -- IsMulCommutative (IdeleClassGroup F) := -- hilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative -- --/-- The actual norm range of the selected big Hilbert class field is --the intrinsic big-Hilbert norm subgroup of its actual base field. -/ --theorem bigHilbertClassField_ideleClassNorm_range_eq_intrinsic : -- (_root_.ideleClassNorm -- (bigHilbertClassFieldBase K) -- (bigHilbertClassField K)).range = -- bigHilbertClassFieldNormSubgroup -- (K := bigHilbertClassFieldBase K) := by -- rw [bigHilbertClassField_ideleClassNorm_range] -- exact -- bigHilbertClassFieldNormSubgroup_map_ideleClassCongr -- (bigHilbertClassFieldBaseEquiv (K := K)) -- --/-- Global reciprocity identifies the genuine Galois group of the --selected big Hilbert class field with the narrow ideal class group of --the original number field. -/ --private noncomputable def bigHilbertClassFieldReciprocityData : -- {e : Gal((bigHilbertClassField K) / -- (bigHilbertClassFieldBase K)) ≃* -- RayClass.NarrowClassGroup K // -- ∀ c : IdeleClassGroup (bigHilbertClassFieldBase K), -- e (globalNormResidueMonoidHom -- (bigHilbertClassFieldBase K) -- (bigHilbertClassField K) c) = -- bigHilbertNarrowClassGroupCongr -- (bigHilbertClassFieldBaseEquiv (K := K)).symm -- (bigHilbertClassFieldQuotientEquivNarrowClassGroup -- (K := bigHilbertClassFieldBase K) -- (QuotientGroup.mk' -- (bigHilbertClassFieldNormSubgroup -- (K := bigHilbertClassFieldBase K)) c))} := by -- let d := hilbertClassFieldGlobalReciprocityTransportData -- (bigHilbertClassFieldNormSubgroup -- (K := bigHilbertClassFieldBase K)) -- (bigHilbertClassField_ideleClassNorm_range_eq_intrinsic -- (K := K)) -- ((bigHilbertClassFieldQuotientEquivNarrowClassGroup -- (K := bigHilbertClassFieldBase K)).trans -- (bigHilbertNarrowClassGroupCongr -- (bigHilbertClassFieldBaseEquiv (K := K)).symm)) -- refine ⟨d.1, ?_⟩ -- intro c -- exact d.2 c -- --/-- The reciprocity equivalence from the actual big Hilbert Galois group --to the narrow class group of the original number field. -/ --noncomputable def bigHilbertClassFieldGaloisEquivNarrowClassGroup : -- Gal((bigHilbertClassField K) / -- (bigHilbertClassFieldBase K)) ≃* -- RayClass.NarrowClassGroup K := -- (bigHilbertClassFieldReciprocityData (K := K)).1 -- --/-- Under big-Hilbert reciprocity, the actual global norm-residue --symbol is the narrow ideal class of its idèle-class representative, --transported back to the original number field. -/ --@[simp] --theorem bigHilbertClassFieldGaloisEquivNarrowClassGroup_globalNormResidue -- (c : IdeleClassGroup (bigHilbertClassFieldBase K)) : -- bigHilbertClassFieldGaloisEquivNarrowClassGroup (K := K) -- (globalNormResidueMonoidHom -- (bigHilbertClassFieldBase K) -- (bigHilbertClassField K) c) = -- bigHilbertNarrowClassGroupCongr -- (bigHilbertClassFieldBaseEquiv (K := K)).symm -- (bigHilbertClassFieldQuotientEquivNarrowClassGroup -- (K := bigHilbertClassFieldBase K) -- (QuotientGroup.mk' -- (bigHilbertClassFieldNormSubgroup -- (K := bigHilbertClassFieldBase K)) c)) := by -- exact (bigHilbertClassFieldReciprocityData (K := K)).2 c -+attribute [local instance] bigHilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative - - /-- Representative form of big-Hilbert reciprocity: the global - norm-residue symbol of an actual idèle maps to its narrow ideal -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualData.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualData.lean -new file mode 100644 -index 0000000..4dd276f ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualData.lean -@@ -0,0 +1,84 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldReciprocity.Transport -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.BigHilbertClassFieldNaturality -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldComparison -+ -+ -+set_option autoImplicit false -+ -+/-! -+# Big Hilbert reciprocity over the realized base field -+ -+This leaf specializes the shared reciprocity transport to the actual base -+field of the selected big Hilbert class field. -+-/ -+ -+open scoped Classical IsMulCommutative NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace GlobalClassFields -+ -+open Reciprocity -+ -+variable {K : Type} [Field K] [NumberField K] -+ -+local instance -+ bigHilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative -+ {F : Type} [Field F] [NumberField F] : -+ IsMulCommutative (IdeleClassGroup F) := -+ hilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative -+ -+/-- The actual norm range of the selected big Hilbert class field is -+the intrinsic big-Hilbert norm subgroup of its actual base field. -/ -+theorem bigHilbertClassField_ideleClassNorm_range_eq_intrinsic : -+ (_root_.ideleClassNorm -+ (bigHilbertClassFieldBase K) -+ (bigHilbertClassField K)).range = -+ bigHilbertClassFieldNormSubgroup -+ (K := bigHilbertClassFieldBase K) := by -+ rw [bigHilbertClassField_ideleClassNorm_range] -+ exact -+ bigHilbertClassFieldNormSubgroup_map_ideleClassCongr -+ (bigHilbertClassFieldBaseEquiv (K := K)) -+ -+/-- Global reciprocity identifies the genuine Galois group of the -+selected big Hilbert class field with the narrow ideal class group of -+the original number field. -/ -+noncomputable def bigHilbertClassFieldReciprocityData : -+ {e : Gal((bigHilbertClassField K) / -+ (bigHilbertClassFieldBase K)) ≃* -+ RayClass.NarrowClassGroup K // -+ ∀ c : IdeleClassGroup (bigHilbertClassFieldBase K), -+ e (globalNormResidueMonoidHom -+ (bigHilbertClassFieldBase K) -+ (bigHilbertClassField K) c) = -+ bigHilbertNarrowClassGroupCongr -+ (bigHilbertClassFieldBaseEquiv (K := K)).symm -+ (bigHilbertClassFieldQuotientEquivNarrowClassGroup -+ (K := bigHilbertClassFieldBase K) -+ (QuotientGroup.mk' -+ (bigHilbertClassFieldNormSubgroup -+ (K := bigHilbertClassFieldBase K)) c))} := by -+ let d := hilbertClassFieldGlobalReciprocityTransportData -+ (bigHilbertClassFieldNormSubgroup -+ (K := bigHilbertClassFieldBase K)) -+ (bigHilbertClassField_ideleClassNorm_range_eq_intrinsic -+ (K := K)) -+ ((bigHilbertClassFieldQuotientEquivNarrowClassGroup -+ (K := bigHilbertClassFieldBase K)).trans -+ (bigHilbertNarrowClassGroupCongr -+ (bigHilbertClassFieldBaseEquiv (K := K)).symm)) -+ refine ⟨d.1, ?_⟩ -+ intro c -+ exact d.2 c -+ -+ -+end GlobalClassFields -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualEquiv.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualEquiv.lean -new file mode 100644 -index 0000000..19f756c ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualEquiv.lean -@@ -0,0 +1,48 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldReciprocity.BigActualData -+ -+set_option autoImplicit false -+open scoped Classical IsMulCommutative NumberField -+noncomputable section -+namespace GlobalClassFieldTheory -+namespace GlobalClassFields -+open Reciprocity -+variable {K : Type} [Field K] [NumberField K] -+attribute [local instance] bigHilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative -+ -+/-- The reciprocity equivalence from the actual big Hilbert Galois group -+to the narrow class group of the original number field. -/ -+noncomputable def bigHilbertClassFieldGaloisEquivNarrowClassGroup : -+ Gal((bigHilbertClassField K) / -+ (bigHilbertClassFieldBase K)) ≃* -+ RayClass.NarrowClassGroup K := -+ (bigHilbertClassFieldReciprocityData (K := K)).1 -+ -+/-- Under big-Hilbert reciprocity, the actual global norm-residue -+symbol is the narrow ideal class of its idèle-class representative, -+transported back to the original number field. -/ -+@[simp] -+theorem bigHilbertClassFieldGaloisEquivNarrowClassGroup_globalNormResidue -+ (c : IdeleClassGroup (bigHilbertClassFieldBase K)) : -+ bigHilbertClassFieldGaloisEquivNarrowClassGroup (K := K) -+ (globalNormResidueMonoidHom -+ (bigHilbertClassFieldBase K) -+ (bigHilbertClassField K) c) = -+ bigHilbertNarrowClassGroupCongr -+ (bigHilbertClassFieldBaseEquiv (K := K)).symm -+ (bigHilbertClassFieldQuotientEquivNarrowClassGroup -+ (K := bigHilbertClassFieldBase K) -+ (QuotientGroup.mk' -+ (bigHilbertClassFieldNormSubgroup -+ (K := bigHilbertClassFieldBase K)) c)) := by -+ exact (bigHilbertClassFieldReciprocityData (K := K)).2 c -+ -+ -+end GlobalClassFields -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/RationalFiniteNormTransfer/Representatives.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/RationalFiniteNormTransfer/Representatives.lean -index a5d0b1a..45c9a3e 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/RationalFiniteNormTransfer/Representatives.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/RationalFiniteNormTransfer/Representatives.lean -@@ -6,6 +6,7 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - - import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.RationalFiniteNormTransfer.FieldSpine - -+ - set_option autoImplicit false - - /-! -@@ -56,7 +57,8 @@ noncomputable def rationalFiniteNormTransferAbstractRepresentative - [hfinite : Finite - (K.toSubgroup ⧸ extensionSubgroup K L hLK)] - (a : KummerTheory.ambientFixedAddSubgroup -- rationalIdeleClassRepresentation K) := by -+ rationalIdeleClassRepresentation K) : -+ rationalFiniteNormTransferExtensionIdeleClass K L hLK := by - letI hLfinite := RationalFiniteNormTransferInternal.absoluteFinite - K L hLK (hKfinite := hKfinite) (hfinite := hfinite) - let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hLK -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalization.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalization.lean -index 0ce4c1f..63f8f94 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalization.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalization.lean -@@ -4,188 +4,18 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.PrincipalIdealTheorem --import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.PrincipalIdealTransfer --import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerUnramified -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertPrincipalizationClassGroup - - set_option autoImplicit false -- --/-! --# Principalization in the selected small Hilbert class field -- --The selected second small Hilbert class field is Galois over the --canonical fixed-field copy of the original base, and its maximal --abelian intermediate field is the selected first small Hilbert class --field. Witt transfer therefore places every idele class extended from --that fixed-field copy in the norm range from the second stage. --Functoriality of actual idele extension along the degree-one --identification of the original field with its fixed-field copy gives --the same range inclusion for idele classes extended from the original --field itself. -- --The exact second-stage norm subgroup is the intrinsic small-Hilbert --subgroup, so the genuine map from the original field on small-Hilbert --quotients is trivial. Its naturality with extension of ideal classes --then gives the class-group, integral-ideal, and fractional-ideal forms --of principalization over the original number field. ---/ -- - open scoped Classical IsMulCommutative NumberField -- - noncomputable section -- - namespace GlobalClassFieldTheory - namespace IdealClassFieldTheory -- --open ClassFormation --open GlobalClassFields --open KummerTheory --open LocalClassFieldTheory --open Reciprocity -- --local instance -- smallHilbertPrincipalization_ideleClassGroupIsMulCommutative -- {F : Type} [Field F] [NumberField F] : -- IsMulCommutative (IdeleClassGroup F) := -- ⟨⟨fun a b => mul_comm a b⟩⟩ -- --local instance -- smallHilbertPrincipalization_ideleClassSubgroupNormal -- {F : Type} [Field F] [NumberField F] -- (N : Subgroup (IdeleClassGroup F)) : N.Normal := -- N.normal_of_isMulCommutative -- --local instance -- smallHilbertPrincipalization_smallHilbertQuotientGroup -- {F : Type} [Field F] [NumberField F] : -- Group -- (IdeleClassGroup F ⧸ -- smallHilbertClassFieldNormSubgroup (K := F)) := -- QuotientGroup.Quotient.group -- (smallHilbertClassFieldNormSubgroup (K := F)) -- --local instance -- smallHilbertPrincipalization_smallHilbertQuotientOne -- {F : Type} [Field F] [NumberField F] : -- One -- (IdeleClassGroup F ⧸ -- smallHilbertClassFieldNormSubgroup (K := F)) := -- ⟨(smallHilbertPrincipalization_smallHilbertQuotientGroup -- (F := F)).one⟩ -- -+open ClassFormation GlobalClassFields KummerTheory LocalClassFieldTheory Reciprocity -+attribute [local instance] smallHilbertPrincipalization_ideleClassGroupIsMulCommutative -+ smallHilbertPrincipalization_ideleClassSubgroupNormal - variable (K : Type) [Field K] [NumberField K] - --private theorem smallHilbertClassFieldIdeleExtensionMap_apply_eq_one -- (q : IdeleClassGroup K ⧸ -- smallHilbertClassFieldNormSubgroup (K := K)) : -- smallHilbertClassFieldIdeleExtensionMap -- K (smallHilbertClassField K) q = -- (1 : IdeleClassGroup (smallHilbertClassField K) ⧸ -- smallHilbertClassFieldNormSubgroup -- (K := smallHilbertClassField K)) := by -- induction q using QuotientGroup.induction_on with -- | _ c => -- change -- smallHilbertClassFieldIdeleExtensionMap -- K (smallHilbertClassField K) -- (QuotientGroup.mk' -- (smallHilbertClassFieldNormSubgroup (K := K)) c) = -- 1 -- have hcontainment := -- smallHilbertClassField_ideleClassExtension_range_le_secondNormRange K -- unfold smallHilbertClassFieldSecondNormRangeContainment at hcontainment -- have hmembership : -- ideleClassExtension K (smallHilbertClassField K) c ∈ -- smallHilbertClassFieldNormSubgroup -- (K := smallHilbertClassField K) := -- hcontainment ⟨c, rfl⟩ -- calc -- smallHilbertClassFieldIdeleExtensionMap -- K (smallHilbertClassField K) -- (QuotientGroup.mk' -- (smallHilbertClassFieldNormSubgroup (K := K)) c) = -- QuotientGroup.mk' -- (smallHilbertClassFieldNormSubgroup -- (K := smallHilbertClassField K)) -- (ideleClassExtension K (smallHilbertClassField K) c) := -- smallHilbertClassFieldIdeleExtensionMap_mk' -- K (smallHilbertClassField K) c -- _ = 1 := -- (QuotientGroup.eq_one_iff -- (ideleClassExtension K (smallHilbertClassField K) c)).2 -- hmembership -- --/-- The map induced by genuine idele extension from the original --number field on the two small-Hilbert reciprocity quotients is --trivial. -/ --theorem smallHilbertClassFieldIdeleExtensionMap_eq_one : -- @Eq -- ((IdeleClassGroup K ⧸ -- smallHilbertClassFieldNormSubgroup (K := K)) →* -- (IdeleClassGroup (smallHilbertClassField K) ⧸ -- smallHilbertClassFieldNormSubgroup -- (K := smallHilbertClassField K))) -- (smallHilbertClassFieldIdeleExtensionMap -- K (smallHilbertClassField K)) -- (1 : -- (IdeleClassGroup K ⧸ -- smallHilbertClassFieldNormSubgroup (K := K)) →* -- (IdeleClassGroup (smallHilbertClassField K) ⧸ -- smallHilbertClassFieldNormSubgroup -- (K := smallHilbertClassField K))) := by -- apply MonoidHom.ext -- intro q -- simpa only [MonoidHom.one_apply] using -- smallHilbertClassFieldIdeleExtensionMap_apply_eq_one K q -- --private theorem smallHilbertClassFieldClassGroupExtension_apply_eq_one -- (c : ClassGroup (𝓞 K)) : -- ClassGroup.extendedHom -- (𝓞 K) (𝓞 (smallHilbertClassField K)) c = -- (1 : ClassGroup (𝓞 (smallHilbertClassField K))) := by -- obtain ⟨q, rfl⟩ := -- (smallHilbertClassFieldQuotientEquivClassGroup -- (K := K)).surjective c -- have hidele := -- smallHilbertClassFieldIdeleExtensionMap_apply_eq_one K q -- have hnaturality := -- smallHilbertClassFieldIdeleExtensionMap_naturality -- K (smallHilbertClassField K) q -- calc -- ClassGroup.extendedHom -- (𝓞 K) (𝓞 (smallHilbertClassField K)) -- (smallHilbertClassFieldQuotientEquivClassGroup (K := K) q) = -- smallHilbertClassFieldQuotientEquivClassGroup -- (K := smallHilbertClassField K) -- (smallHilbertClassFieldIdeleExtensionMap -- K (smallHilbertClassField K) q) := -- hnaturality.symm -- _ = smallHilbertClassFieldQuotientEquivClassGroup -- (K := smallHilbertClassField K) 1 := -- congrArg -- (smallHilbertClassFieldQuotientEquivClassGroup -- (K := smallHilbertClassField K)) hidele -- _ = 1 := -- (smallHilbertClassFieldQuotientEquivClassGroup -- (K := smallHilbertClassField K)).map_one -- --/-- Extension of ideal classes from a number field to its selected --small Hilbert class field is the trivial homomorphism. This follows --directly from the naturality equality identifying actual idele --extension with actual extension of ideal classes. -/ --theorem smallHilbertClassFieldClassGroupExtension_eq_one : -- @Eq -- (ClassGroup (𝓞 K) →* -- ClassGroup (𝓞 (smallHilbertClassField K))) -- (ClassGroup.extendedHom -- (𝓞 K) (𝓞 (smallHilbertClassField K))) -- (1 : ClassGroup (𝓞 K) →* -- ClassGroup (𝓞 (smallHilbertClassField K))) := by -- apply MonoidHom.ext -- intro c -- simpa only [MonoidHom.one_apply] using -- smallHilbertClassFieldClassGroupExtension_apply_eq_one K c -- - /-- Every ideal of a number field becomes principal after extension - to the selected small Hilbert class field. -/ - theorem allIdealsBecomePrincipalInSmallHilbertClassField : -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationBase.lean -new file mode 100644 -index 0000000..ae72e33 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationBase.lean -@@ -0,0 +1,91 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.PrincipalIdealTheorem -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.PrincipalIdealTransfer -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerUnramified -+ -+ -+set_option autoImplicit false -+ -+/-! -+# Principalization in the selected small Hilbert class field -+ -+The selected second small Hilbert class field is Galois over the -+canonical fixed-field copy of the original base, and its maximal -+abelian intermediate field is the selected first small Hilbert class -+field. Witt transfer therefore places every idele class extended from -+that fixed-field copy in the norm range from the second stage. -+Functoriality of actual idele extension along the degree-one -+identification of the original field with its fixed-field copy gives -+the same range inclusion for idele classes extended from the original -+field itself. -+ -+The exact second-stage norm subgroup is the intrinsic small-Hilbert -+subgroup, so the genuine map from the original field on small-Hilbert -+quotients is trivial. Its naturality with extension of ideal classes -+then gives the class-group, integral-ideal, and fractional-ideal forms -+of principalization over the original number field. -+-/ -+ -+open scoped Classical IsMulCommutative NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace IdealClassFieldTheory -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open LocalClassFieldTheory -+open Reciprocity -+ -+local instance -+ smallHilbertPrincipalization_ideleClassGroupIsMulCommutative -+ {F : Type} [Field F] [NumberField F] : -+ IsMulCommutative (IdeleClassGroup F) := -+ ⟨⟨fun a b => mul_comm a b⟩⟩ -+ -+local instance -+ smallHilbertPrincipalization_ideleClassSubgroupNormal -+ {F : Type} [Field F] [NumberField F] -+ (N : Subgroup (IdeleClassGroup F)) : N.Normal := -+ N.normal_of_isMulCommutative -+ -+/-- A generic field-extension form keeps the class-field construction opaque. -/ -+theorem smallHilbertExtension_trivial_of_range -+ (K L : Type) [Field K] [NumberField K] [Field L] [NumberField L] -+ [Algebra K L] [FiniteDimensional K L] -+ (h : (ideleClassExtension K L).range ≤ -+ smallHilbertClassFieldNormSubgroup (K := L)) -+ (q : IdeleClassGroup K ⧸ smallHilbertClassFieldNormSubgroup (K := K)) : -+ smallHilbertClassFieldIdeleExtensionMap K L q = 1 := by -+ refine QuotientGroup.induction_on q ?_ -+ intro c -+ exact (smallHilbertClassFieldIdeleExtensionMap_mk' K L c).trans -+ ((QuotientGroup.eq_one_iff (ideleClassExtension K L c)).mpr (h ⟨c, rfl⟩)) -+ -+variable (K : Type) [Field K] [NumberField K] -+ -+/-- Extension to the small Hilbert class field sends each reciprocity -+quotient class to the identity class. -/ -+theorem smallHilbertClassFieldIdeleExtensionMap_apply_eq_one -+ (q : IdeleClassGroup K ⧸ -+ smallHilbertClassFieldNormSubgroup (K := K)) : -+ smallHilbertClassFieldIdeleExtensionMap -+ K (smallHilbertClassField K) q = -+ (1 : IdeleClassGroup (smallHilbertClassField K) ⧸ -+ smallHilbertClassFieldNormSubgroup -+ (K := smallHilbertClassField K)) := by -+ have hcontainment := -+ smallHilbertClassField_ideleClassExtension_range_le_secondNormRange K -+ unfold smallHilbertClassFieldSecondNormRangeContainment at hcontainment -+ exact smallHilbertExtension_trivial_of_range K (smallHilbertClassField K) -+ hcontainment q -+ -+end IdealClassFieldTheory -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationClassGroup.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationClassGroup.lean -new file mode 100644 -index 0000000..7889495 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationClassGroup.lean -@@ -0,0 +1,68 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertPrincipalizationIdele -+ -+set_option autoImplicit false -+open scoped Classical IsMulCommutative NumberField -+noncomputable section -+namespace GlobalClassFieldTheory -+namespace IdealClassFieldTheory -+open ClassFormation GlobalClassFields KummerTheory LocalClassFieldTheory Reciprocity -+attribute [local instance] smallHilbertPrincipalization_ideleClassGroupIsMulCommutative -+ smallHilbertPrincipalization_ideleClassSubgroupNormal -+variable (K : Type) [Field K] [NumberField K] -+ -+private theorem smallHilbertClassFieldClassGroupExtension_apply_eq_one -+ (c : ClassGroup (𝓞 K)) : -+ ClassGroup.extendedHom -+ (𝓞 K) (𝓞 (smallHilbertClassField K)) c = -+ (1 : ClassGroup (𝓞 (smallHilbertClassField K))) := by -+ obtain ⟨q, rfl⟩ := -+ (smallHilbertClassFieldQuotientEquivClassGroup -+ (K := K)).surjective c -+ have hidele := -+ smallHilbertClassFieldIdeleExtensionMap_apply_eq_one K q -+ have hnaturality := -+ smallHilbertClassFieldIdeleExtensionMap_naturality -+ K (smallHilbertClassField K) q -+ calc -+ ClassGroup.extendedHom -+ (𝓞 K) (𝓞 (smallHilbertClassField K)) -+ (smallHilbertClassFieldQuotientEquivClassGroup (K := K) q) = -+ smallHilbertClassFieldQuotientEquivClassGroup -+ (K := smallHilbertClassField K) -+ (smallHilbertClassFieldIdeleExtensionMap -+ K (smallHilbertClassField K) q) := -+ hnaturality.symm -+ _ = smallHilbertClassFieldQuotientEquivClassGroup -+ (K := smallHilbertClassField K) 1 := -+ congrArg -+ (smallHilbertClassFieldQuotientEquivClassGroup -+ (K := smallHilbertClassField K)) hidele -+ _ = 1 := -+ (smallHilbertClassFieldQuotientEquivClassGroup -+ (K := smallHilbertClassField K)).map_one -+ -+/-- Extension of ideal classes from a number field to its selected -+small Hilbert class field is the trivial homomorphism. This follows -+directly from the naturality equality identifying actual idele -+extension with actual extension of ideal classes. -/ -+theorem smallHilbertClassFieldClassGroupExtension_eq_one : -+ @Eq -+ (ClassGroup (𝓞 K) →* -+ ClassGroup (𝓞 (smallHilbertClassField K))) -+ (ClassGroup.extendedHom -+ (𝓞 K) (𝓞 (smallHilbertClassField K))) -+ (1 : ClassGroup (𝓞 K) →* -+ ClassGroup (𝓞 (smallHilbertClassField K))) := by -+ apply MonoidHom.ext -+ intro c -+ simpa only [MonoidHom.one_apply] using -+ smallHilbertClassFieldClassGroupExtension_apply_eq_one K c -+ -+end IdealClassFieldTheory -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationIdele.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationIdele.lean -new file mode 100644 -index 0000000..e11bcfb ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationIdele.lean -@@ -0,0 +1,43 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertPrincipalizationBase -+ -+set_option autoImplicit false -+open scoped Classical IsMulCommutative NumberField -+noncomputable section -+namespace GlobalClassFieldTheory -+namespace IdealClassFieldTheory -+open ClassFormation GlobalClassFields KummerTheory LocalClassFieldTheory Reciprocity -+attribute [local instance] smallHilbertPrincipalization_ideleClassGroupIsMulCommutative -+ smallHilbertPrincipalization_ideleClassSubgroupNormal -+variable (K : Type) [Field K] [NumberField K] -+ -+/-- The map induced by genuine idele extension from the original -+number field on the two small-Hilbert reciprocity quotients is -+trivial. -/ -+theorem smallHilbertClassFieldIdeleExtensionMap_eq_one : -+ @Eq -+ ((IdeleClassGroup K ⧸ -+ smallHilbertClassFieldNormSubgroup (K := K)) →* -+ (IdeleClassGroup (smallHilbertClassField K) ⧸ -+ smallHilbertClassFieldNormSubgroup -+ (K := smallHilbertClassField K))) -+ (smallHilbertClassFieldIdeleExtensionMap -+ K (smallHilbertClassField K)) -+ (1 : -+ (IdeleClassGroup K ⧸ -+ smallHilbertClassFieldNormSubgroup (K := K)) →* -+ (IdeleClassGroup (smallHilbertClassField K) ⧸ -+ smallHilbertClassFieldNormSubgroup -+ (K := smallHilbertClassField K))) := by -+ apply MonoidHom.ext -+ intro q -+ simpa only [MonoidHom.one_apply] using -+ smallHilbertClassFieldIdeleExtensionMap_apply_eq_one K q -+ -+end IdealClassFieldTheory -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealization.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealization.lean -index 3edfd94..f01c3d8 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealization.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealization.lean -@@ -4,28 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldRealization --import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerConjugation --import Mathlib.Data.Rat.Cast.Defs - --set_option autoImplicit false -- --/-! --# Actual realization of the two-stage small Hilbert tower -- --The first small Hilbert class field is the actual finite abelian --subextension selected in `HilbertClassFieldRealization`. Over its actual --fixed field, the closed finite-index small-Hilbert norm subgroup has a --finite Galois norm neighbourhood. We embed that neighbourhood in the --rational separable closure compatibly with the already chosen first --stage. Finite abelian classification then selects the second small --Hilbert class field over the literal first-stage subgroup. -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerRealizationSecond - --The compatibility of the embedding is essential: an unrelated chosen --copy of the middle number field would produce a class field over a --conjugate closed subgroup rather than over the first-stage subgroup --itself. ---/ -+set_option autoImplicit false - - open scoped Classical NumberField - -@@ -43,33 +25,10 @@ open LocalClassFieldTheory - open RamificationTheory - open Reciprocity - --/-- The ordinary idèle-class operations used by the two-stage transport, --fixed at the canonical principal-subgroup quotient. -/ --@[instance_reducible] --private noncomputable def smallHilbertTowerIdeleClassCommGroup -- (F : Type) [Field F] [NumberField F] : -- CommGroup (IdeleClassGroup F) := -- QuotientGroup.Quotient.commGroup (IdeleGroup.principalSubgroup F) - - attribute [local instance] smallHilbertTowerIdeleClassCommGroup -- --private theorem addSubgroup_comap_symm_eq_map -- {A B : Type*} [AddGroup A] [AddGroup B] -- (H : AddSubgroup A) (e : A ≃+ B) : -- H.comap e.symm.toAddMonoidHom = -- H.map e.toAddMonoidHom := by -- exact (AddSubgroup.map_equiv_eq_comap_symm e H).symm -- --private noncomputable abbrev -- closedFiniteIndexNormAmbientCanonicalBaseAlgebra -- (F : Type) [Field F] [NumberField F] -- (H : Subgroup (IdeleClassGroup F)) -- (hclosed : IsClosed (H : Set (IdeleClassGroup F))) -- [H.FiniteIndex] : -- Algebra F -- (closedFiniteIndexClassFieldNormAmbient -- (K := F) H hclosed) := -- inferInstance -+ smallHilbertTowerNormAmbientAlgebra -+ smallHilbertTowerNormAmbientIsGalois - - section RationalFixedField - -@@ -78,758 +37,9 @@ variable - (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) - (L : FiniteAbelianSubextension K.field) - --private noncomputable abbrev smallHilbertTowerMiddleFiniteAbstractField : -- FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -- { field := L.field -- finite := by -- let : Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- K.field (le_baseField K.field)) := -- K.finite -- let : Finite -- (K.field.toSubgroup ⧸ -- extensionSubgroup K.field L.field L.below) := -- L.finite -- exact -- FiniteGaloisSubextension.finite_extension_trans -- L.below (le_baseField K.field) } -- --local notation "E" => -- abstractFixedField ℚ (SeparableClosure ℚ) L.field -- --local notation "N" => -- smallHilbertClassFieldNormAmbient E -- --private noncomputable instance -- smallHilbertTowerMiddleAbstractQuotientFinite : -- Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- L.field (le_baseField L.field)) := -- (smallHilbertTowerMiddleFiniteAbstractField K L).finite -- --private noncomputable instance -- smallHilbertTowerMiddleFiniteDimensional : -- FiniteDimensional ℚ E := -- abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) L.field inferInstance -- --private noncomputable instance -- smallHilbertTowerMiddleNumberField : -- NumberField E := -- NumberField.of_module_finite ℚ E -- --/-- The canonical small-Hilbert subgroup over the literal middle field. --This typed endpoint avoids repeatedly reducing the finite-abstract-field --package merely to recover its `field = L.field` projection. -/ --noncomputable def smallHilbertTowerMiddleNormSubgroup : -- AddSubgroup -- (ambientFixedAddSubgroup -- rationalIdeleClassRepresentation L.field) := -- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup.comap -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom -- --/-- The typed `comap` endpoint is the canonical transported `map` endpoint. --This uses only the generic additive equivalence law. -/ --theorem smallHilbertTowerMiddleNormSubgroup_eq_map : -- smallHilbertTowerMiddleNormSubgroup K L = -- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup.map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).toAddMonoidHom := by -- exact addSubgroup_comap_symm_eq_map -- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup -- (rationalAbstractFixedFieldIdeleClassEquivFixed L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)) -- --@[reducible] --private noncomputable def -- smallHilbertTowerNormAmbientAlgebra : -- Algebra E N := -- closedFiniteIndexNormAmbientCanonicalBaseAlgebra E -- (smallHilbertClassFieldNormSubgroup (K := E)) -- (smallHilbertClassFieldNormSubgroup_isClosed (K := E)) -- --attribute [local instance] smallHilbertTowerNormAmbientAlgebra -- --@[reducible] --private noncomputable def -- smallHilbertTowerNormAmbientSMul : -- SMul E N := -- Algebra.toSMul -- (self := smallHilbertTowerNormAmbientAlgebra K L) -- --@[reducible] --private noncomputable def -- smallHilbertTowerNormAmbientModule : -- Module E N := -- @Algebra.toModule E N _ _ -- (smallHilbertTowerNormAmbientAlgebra K L) -- --private theorem -- smallHilbertTowerNormAmbientScalarTower : -- @IsScalarTower ℚ E N -- (Algebra.toSMul (R := ℚ) (A := E)) -- (smallHilbertTowerNormAmbientSMul K L) -- (Algebra.toSMul (R := ℚ) (A := N)) := by -- exact IsScalarTower.of_algebraMap_eq' -- (R := ℚ) (S := E) (A := N) -- (RingHom.ext_rat (algebraMap ℚ N) -- ((algebraMap E N).comp (algebraMap ℚ E))) -- --private noncomputable def -- smallHilbertTowerNormAmbientAlgHom : -- E →ₐ[ℚ] N := -- { toRingHom := algebraMap E N -- commutes' := fun r => -- (RingHom.congr_fun -- (RingHom.ext_rat -- ((algebraMap E N).comp (algebraMap ℚ E)) -- (algebraMap ℚ N)) r) } -- --private theorem smallHilbertTowerNormAmbientAlgHom_apply -- (x : E) : -- smallHilbertTowerNormAmbientAlgHom K L x = -- algebraMap E N x := by -- rfl -- --private theorem -- smallHilbertTowerNormAmbientIsGalois : -- IsGalois E N := by -- unfold smallHilbertClassFieldNormAmbient -- closedFiniteIndexClassFieldNormAmbient -- exact -- closedFiniteIndexNormAmbientIsGalois -- (smallHilbertClassFieldNormSubgroup (K := E)) -- (smallHilbertClassFieldNormSubgroup_isClosed (K := E)) -- --attribute [local instance] smallHilbertTowerNormAmbientIsGalois -- --private noncomputable def -- smallHilbertNormNeighborhoodForwardAlignment : -- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := by -- let j₀ : N →ₐ[ℚ] SeparableClosure ℚ := -- numberFieldSeparableClosureEmbedding N -- let i₀ : E →ₐ[ℚ] SeparableClosure ℚ := -- j₀.comp (smallHilbertTowerNormAmbientAlgHom K L) -- exact -- AlgEquiv.ofBijective -- (i₀.liftNormal (SeparableClosure ℚ)) -- (AlgHom.normal_bijective -- ℚ (SeparableClosure ℚ) (SeparableClosure ℚ) _) -- --/-- The separable-closure automorphism which aligns an arbitrary chosen --embedding of the norm-neighbourhood field with the already embedded --middle field. -/ --private noncomputable def -- smallHilbertNormNeighborhoodAlignment : -- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := -- (smallHilbertNormNeighborhoodForwardAlignment K L).symm -- --@[simp] --private theorem smallHilbertNormNeighborhoodForwardAlignment_apply -- (x : E) : -- smallHilbertNormNeighborhoodForwardAlignment K L -- (x : SeparableClosure ℚ) = -- (numberFieldSeparableClosureEmbedding N) -- (algebraMap E N x) := by -- let j₀ : N →ₐ[ℚ] SeparableClosure ℚ := -- numberFieldSeparableClosureEmbedding N -- let i₀ : E →ₐ[ℚ] SeparableClosure ℚ := -- j₀.comp (smallHilbertTowerNormAmbientAlgHom K L) -- dsimp only [smallHilbertNormNeighborhoodForwardAlignment, -- AlgEquiv.ofBijective_apply] -- calc -- _ = i₀ x := by -- simpa only [IntermediateField.algebraMap_apply, -- Algebra.algebraMap_self, RingHom.id_apply] using -- i₀.liftNormal_commutes (SeparableClosure ℚ) x -- _ = j₀ (algebraMap E N x) := by -- change -- j₀ (smallHilbertTowerNormAmbientAlgHom K L x) = -- j₀ (algebraMap E N x) -- exact congrArg j₀ -- (smallHilbertTowerNormAmbientAlgHom_apply K L x) -- --/-- A controlled embedding of the concrete finite Galois norm --neighbourhood. Its restriction to the middle field is the literal --inclusion of that fixed field in `SeparableClosure ℚ`. -/ --private noncomputable def -- smallHilbertNormNeighborhoodEmbedding : -- N →ₐ[ℚ] SeparableClosure ℚ := -- (smallHilbertNormNeighborhoodAlignment K L).toAlgHom.comp -- (numberFieldSeparableClosureEmbedding N) -- --@[simp] --private theorem smallHilbertNormNeighborhoodEmbedding_algebraMap -- (x : E) : -- smallHilbertNormNeighborhoodEmbedding K L -- (algebraMap E N x) = -- (x : SeparableClosure ℚ) := by -- change -- (smallHilbertNormNeighborhoodForwardAlignment K L).symm -- ((numberFieldSeparableClosureEmbedding N) -- (algebraMap E N x)) = -- (x : SeparableClosure ℚ) -- rw [← smallHilbertNormNeighborhoodForwardAlignment_apply K L x] -- exact -- (smallHilbertNormNeighborhoodForwardAlignment K L).symm_apply_apply _ -- --private abbrev smallHilbertNormNeighborhoodEmbeddedBase : -- ClosedSubgroup -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -- closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange -- ((smallHilbertNormNeighborhoodEmbedding K L).comp -- (smallHilbertTowerNormAmbientAlgHom K L))) -- --private abbrev smallHilbertNormNeighborhoodEmbeddedField : -- ClosedSubgroup -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -- closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange -- (smallHilbertNormNeighborhoodEmbedding K L)) -- --private theorem smallHilbertNormNeighborhoodEmbeddedField_le_base : -- (smallHilbertNormNeighborhoodEmbeddedField K L).toSubgroup ≤ -- (smallHilbertNormNeighborhoodEmbeddedBase K L).toSubgroup := by -- change -- (AlgHom.fieldRange -- (smallHilbertNormNeighborhoodEmbedding K L)).fixingSubgroup ≤ -- (AlgHom.fieldRange -- ((smallHilbertNormNeighborhoodEmbedding K L).comp -- (smallHilbertTowerNormAmbientAlgHom K L))).fixingSubgroup -- apply -- (AlgHom.fieldRange -- ((smallHilbertNormNeighborhoodEmbedding K L).comp -- (smallHilbertTowerNormAmbientAlgHom K L))).fixingSubgroup_le -- exact -- AlgHom.range_comp_le_range -- (smallHilbertTowerNormAmbientAlgHom K L) -- (smallHilbertNormNeighborhoodEmbedding K L) -- --private theorem smallHilbertNormNeighborhoodEmbeddedBase_eq : -- smallHilbertNormNeighborhoodEmbeddedBase K L = L.field := by -- have hi : -- (smallHilbertNormNeighborhoodEmbedding K L).comp -- (smallHilbertTowerNormAmbientAlgHom K L) = -- (abstractFixedField ℚ (SeparableClosure ℚ) L.field).val := by -- apply AlgHom.ext -- intro x -- change smallHilbertNormNeighborhoodEmbedding K L -- (smallHilbertTowerNormAmbientAlgHom K L x) = (x : SeparableClosure ℚ) -- rw [smallHilbertTowerNormAmbientAlgHom_apply K L x] -- exact smallHilbertNormNeighborhoodEmbedding_algebraMap K L x -- change -- closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange -- ((smallHilbertNormNeighborhoodEmbedding K L).comp -- (smallHilbertTowerNormAmbientAlgHom K L))) = -- L.field -- rw [hi, IntermediateField.fieldRange_val] -- exact -- closedFixingSubgroup_abstractFixedField_eq -- ℚ (SeparableClosure ℚ) L.field -- --private noncomputable def -- smallHilbertNormNeighborhoodSeparableClosureEquiv : -- let j := smallHilbertNormNeighborhoodEmbedding K L -- let i := j.comp (smallHilbertTowerNormAmbientAlgHom K L) -- let : Algebra E (SeparableClosure ℚ) := -- i.toRingHom.toAlgebra -- SeparableClosure E ≃ₐ[E] SeparableClosure ℚ := by -- intro j i alg -- let : @IsScalarTower ℚ E (SeparableClosure ℚ) -- (Algebra.toSMul (R := ℚ) (A := E)) -- alg.toSMul -- (Algebra.toSMul (R := ℚ) (A := SeparableClosure ℚ)) := -- IsScalarTower.of_algebraMap_eq' i.comp_algebraMap.symm -- let : IsSepClosure E (SeparableClosure ℚ) := -- ⟨IsSepClosure.sep_closed ℚ, -- Algebra.isSeparable_tower_top_of_isSeparable -- ℚ E (SeparableClosure ℚ)⟩ -- exact -- IsSepClosure.equiv E -- (SeparableClosure E) (SeparableClosure ℚ) -- --private noncomputable def -- smallHilbertFiniteGaloisNormNeighborhoodRaw : -- FiniteGaloisSubextension -- (smallHilbertNormNeighborhoodEmbeddedBase K L) := by -- let : @IsScalarTower ℚ E N -- (Algebra.toSMul (R := ℚ) (A := E)) -- (smallHilbertTowerNormAmbientSMul K L) -- (Algebra.toSMul (R := ℚ) (A := N)) := -- smallHilbertTowerNormAmbientScalarTower K L -- let j : N →ₐ[ℚ] SeparableClosure ℚ := -- smallHilbertNormNeighborhoodEmbedding K L -- let i : E →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ E N) -- let B : ClosedSubgroup (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -- closedFixingSubgroup ℚ (SeparableClosure ℚ) i.fieldRange -- let T : ClosedSubgroup (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -- smallHilbertNormNeighborhoodEmbeddedField K L -- have hTB : T.toSubgroup ≤ B.toSubgroup := by -- change j.fieldRange.fixingSubgroup ≤ i.fieldRange.fixingSubgroup -- apply i.fieldRange.fixingSubgroup_le -- exact AlgHom.range_comp_le_range (IsScalarTower.toAlgHom ℚ E N) j -- let raw : FiniteGaloisSubextension B := { -- field := T -- below := hTB -- normal := ambientEmbeddedExtensionSubgroup_normal ℚ E N j -- (smallHilbertNormNeighborhoodSeparableClosureEquiv K L) -- finite := ambientEmbeddedExtensionQuotient_finite ℚ E N j -- (smallHilbertNormNeighborhoodSeparableClosureEquiv K L) } -- have hi : IsScalarTower.toAlgHom ℚ E N = -- smallHilbertTowerNormAmbientAlgHom K L := by -- apply AlgHom.ext -- intro x -- exact (IsScalarTower.toAlgHom_apply ℚ E N x).trans -- (smallHilbertTowerNormAmbientAlgHom_apply K L x).symm -- have hB : B = smallHilbertNormNeighborhoodEmbeddedBase K L := -- congrArg -- (fun f : E →ₐ[ℚ] N => -- closedFixingSubgroup ℚ (SeparableClosure ℚ) (j.comp f).fieldRange) hi -- exact hB ▸ raw -- --private noncomputable def rebaseFiniteGaloisSubextension -- {G : Type} [Group G] [TopologicalSpace G] -- {B B' : ClosedSubgroup G} (h : B = B') -- (P : FiniteGaloisSubextension B) : -- FiniteGaloisSubextension B' := -- h ▸ P -- --@[simp] --private theorem rebaseFiniteGaloisSubextension_field -- {G : Type} [Group G] [TopologicalSpace G] -- {B B' : ClosedSubgroup G} (h : B = B') -- (P : FiniteGaloisSubextension B) : -- (rebaseFiniteGaloisSubextension h P).field = P.field := by -- cases h -- rfl -- --private theorem -- rebaseRationalFiniteGaloisSubextension_fixedField_eq -- {B B' : ClosedSubgroup -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} -- (h : B = B') (P : FiniteGaloisSubextension B) : -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (rebaseFiniteGaloisSubextension h P).below).restrictScalars ℚ = -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- P.below).restrictScalars ℚ := by -- cases h -- rfl -- --/-- An actual finite Galois norm neighbourhood over the literal --first-stage subgroup. It is produced by the finite-index Kummer --construction and the controlled embedding above. -/ --noncomputable def smallHilbertFiniteGaloisNormNeighborhood : -- FiniteGaloisSubextension L.field := -- rebaseFiniteGaloisSubextension -- (smallHilbertNormNeighborhoodEmbeddedBase_eq K L) -- (smallHilbertFiniteGaloisNormNeighborhoodRaw K L) -- --/-- The abstract norm subgroup of the chosen neighbourhood, pinned to the --literal middle-field carrier. -/ --noncomputable def smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup : -- AddSubgroup -- (ambientFixedAddSubgroup -- rationalIdeleClassRepresentation L.field) := -- (smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -- rationalIdeleClassRepresentation -- --private noncomputable abbrev -- smallHilbertFiniteGaloisNormNeighborhoodTopField : Type := -- abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (smallHilbertFiniteGaloisNormNeighborhood K L).below -- --local notation "E₂" => -- smallHilbertFiniteGaloisNormNeighborhoodTopField K L -- --private noncomputable instance -- smallHilbertFiniteGaloisNormNeighborhoodQuotientFinite : -- Finite -- (L.field.toSubgroup ⧸ -- extensionSubgroup L.field -- (smallHilbertFiniteGaloisNormNeighborhood K L).field -- (smallHilbertFiniteGaloisNormNeighborhood K L).below) := -- (smallHilbertFiniteGaloisNormNeighborhood K L).finite -- --private noncomputable instance -- smallHilbertFiniteGaloisNormNeighborhoodFiniteDimensional : -- FiniteDimensional E E₂ := -- abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) L.field -- (smallHilbertFiniteGaloisNormNeighborhood K L).field -- (smallHilbertFiniteGaloisNormNeighborhood K L).below -- inferInstance inferInstance -- --private noncomputable instance -- smallHilbertFiniteGaloisNormNeighborhoodScalarTower : -- IsScalarTower ℚ E E₂ := -- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -- --private noncomputable instance -- smallHilbertFiniteGaloisNormNeighborhoodAbsoluteFiniteDimensional : -- FiniteDimensional ℚ E₂ := -- FiniteDimensional.trans ℚ E E₂ -- --private noncomputable instance -- smallHilbertFiniteGaloisNormNeighborhoodNumberField : -- NumberField E₂ := -- NumberField.of_module_finite ℚ E₂ -- --private noncomputable instance -- smallHilbertFiniteGaloisNormNeighborhoodIsGalois : -- IsGalois E E₂ := -- abstractRelativeFixedField_isGalois -- ℚ (SeparableClosure ℚ) L.field -- (smallHilbertFiniteGaloisNormNeighborhood K L).field -- (smallHilbertFiniteGaloisNormNeighborhood K L).below -- (smallHilbertFiniteGaloisNormNeighborhood K L).normal -- --private theorem -- smallHilbertFiniteGaloisNormNeighborhood_fixedField_eq_range : -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ = -- AlgHom.fieldRange -- (smallHilbertNormNeighborhoodEmbedding K L) := by -- rw [show -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ = -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (smallHilbertFiniteGaloisNormNeighborhoodRaw K L).below).restrictScalars ℚ -- from -- rebaseRationalFiniteGaloisSubextension_fixedField_eq -- (smallHilbertNormNeighborhoodEmbeddedBase_eq K L) -- (smallHilbertFiniteGaloisNormNeighborhoodRaw K L)] -- exact -- InfiniteGalois.fixedField_fixingSubgroup -- (AlgHom.fieldRange -- (smallHilbertNormNeighborhoodEmbedding K L)) -- --private noncomputable def -- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv : -- N ≃ₐ[ℚ] -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ := -- (smallHilbertNormNeighborhoodEmbedding K L).equivFieldRange.trans -- (IntermediateField.equivOfEq -- (smallHilbertFiniteGaloisNormNeighborhood_fixedField_eq_range -- K L).symm) -- --@[simp] --private theorem -- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv_algebraMap -- (x : E) : -- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv K L -- (algebraMap E N x) = -- algebraMap E -- E₂ x := by -- apply Subtype.ext -- change -- smallHilbertNormNeighborhoodEmbedding K L -- (algebraMap E N x) = -- (x : SeparableClosure ℚ) -- exact smallHilbertNormNeighborhoodEmbedding_algebraMap K L x -- --private noncomputable def -- smallHilbertFiniteGaloisNormNeighborhoodRelativeTopEquiv : -- N ≃ₐ[E] E₂ := { -- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv K L with -- commutes' := fun x => -- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv_algebraMap -- K L x } -- --private theorem -- smallHilbertFiniteGaloisNormNeighborhood_ordinaryNorm_le : -- (_root_.ideleClassNorm E N).range ≤ -- smallHilbertClassFieldNormSubgroup (K := E) := by -- simpa only [smallHilbertClassFieldNormAmbient] using -- (closedFiniteIndexClassFieldNormAmbient_normRange_le -- (K := E) (smallHilbertClassFieldNormSubgroup (K := E)) -- (smallHilbertClassFieldNormSubgroup_isClosed (K := E))) -- --private theorem -- smallHilbertFiniteGaloisNormNeighborhood_ordinaryNormRange_eq : -- (_root_.ideleClassNorm E N).range = -- (_root_.ideleClassNorm E E₂).range := by -- simpa only [ordinaryIdeleClassNorm_range_eq_relative] using -- (ideleClassNorm_range_algEquiv -- (K := E) -- (smallHilbertFiniteGaloisNormNeighborhoodRelativeTopEquiv -- K L)).symm -- --private theorem -- smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq : -- ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -- rationalIdeleClassRepresentation).map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -- (_root_.ideleClassNorm E E₂).range.toAddSubgroup := by -- change -- (finiteNormSubgroup rationalIdeleClassRepresentation -- L.field -- (smallHilbertFiniteGaloisNormNeighborhood K L).field -- (smallHilbertFiniteGaloisNormNeighborhood K L).below).map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -- (_root_.ideleClassNorm E E₂).range.toAddSubgroup -- exact -- (map_rationalFiniteNormSubgroup_eq_ordinaryIdeleClassNormRange_concrete -- L.field -- (smallHilbertFiniteGaloisNormNeighborhood K L).field -- (smallHilbertFiniteGaloisNormNeighborhood K L).below -- (smallHilbertFiniteGaloisNormNeighborhood K L).normal) -- --/-- The abstract norm map lands directly in the ordinary norm range of the --chosen neighbourhood. Composing the two named subgroup equalities here --keeps downstream membership proofs pointwise. -/ --private theorem -- smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq_ordinaryNormRange : -- ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -- rationalIdeleClassRepresentation).map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -- (_root_.ideleClassNorm E N).range.toAddSubgroup := -- (smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq K L).trans -- (congrArg Subgroup.toAddSubgroup -- (smallHilbertFiniteGaloisNormNeighborhood_ordinaryNormRange_eq K L).symm) -- --/-- Pointwise form of the combined norm-range equality. -/ --private theorem -- smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_mem_ordinaryNormRange -- (a : Additive (IdeleClassGroup E)) -- (ha : -- a ∈ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -- rationalIdeleClassRepresentation).map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom) : -- a ∈ (_root_.ideleClassNorm E N).range.toAddSubgroup := -- (le_of_eq -- (smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq_ordinaryNormRange -- K L)) ha -- --/-- The actual finite Galois norm neighbourhood has abstract norm --subgroup contained in the canonical small-Hilbert subgroup of the --middle fixed field. This is the source-producing norm-topology input; --no norm-openness premise is assumed. -/ --theorem smallHilbertFiniteGaloisNormNeighborhood_normSubgroup_le : -- ∀ a : ambientFixedAddSubgroup -- rationalIdeleClassRepresentation L.field, -- a ∈ smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup K L → -- a ∈ smallHilbertTowerMiddleNormSubgroup K L := by -- intro a ha -- change -- a ∈ (smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -- rationalIdeleClassRepresentation at ha -- have haMap : -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm a ∈ -- ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -- rationalIdeleClassRepresentation).map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom := -- ⟨a, ha, rfl⟩ -- have haOrdinary : -- (rationalAbstractFixedFieldIdeleClassEquivFixed L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm a ∈ -- (_root_.ideleClassNorm E N).range.toAddSubgroup := -- smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_mem_ordinaryNormRange -- K L _ haMap -- exact smallHilbertFiniteGaloisNormNeighborhood_ordinaryNorm_le K L haOrdinary -- --/-- The canonical small-Hilbert subgroup of the actual middle fixed --field is open in the genuine norm topology. -/ --theorem smallHilbertNormSubgroupInRationalClassFormation_isNormOpen : -- IsNormOpen rationalIdeleClassRepresentation L.field -- (smallHilbertTowerMiddleNormSubgroup K L : -- Set -- (ambientFixedAddSubgroup -- rationalIdeleClassRepresentation L.field)) := by -- rw [normTopology_addSubgroup_isOpen_iff] -- refine -- ⟨smallHilbertFiniteGaloisNormNeighborhood K L, ?_⟩ -- change -- smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup K L ≤ -- smallHilbertTowerMiddleNormSubgroup K L -- exact smallHilbertFiniteGaloisNormNeighborhood_normSubgroup_le K L -- --/-- The second small Hilbert class field as an actual finite abelian --subextension of the literal first-stage field. -/ --noncomputable def secondSmallHilbertClassFieldSubextension : -- FiniteAbelianSubextension L.field := by -- let H : FiniteAbelianSubextension.NormOpenAddSubgroup -- rationalIdeleClassRepresentation L.field := -- ⟨smallHilbertTowerMiddleNormSubgroup K L, -- smallHilbertNormSubgroupInRationalClassFormation_isNormOpen K L⟩ -- exact -- Classical.choose -- (FiniteAbelianSubextension.normSubgroupMap_surjective -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (smallHilbertTowerMiddleFiniteAbstractField K L) H) -- --/-- The second-stage extension realizes exactly the canonical --small-Hilbert norm subgroup of the actual middle field. -/ --@[simp] --theorem secondSmallHilbertClassFieldSubextension_normSubgroup : -- (secondSmallHilbertClassFieldSubextension K L).normSubgroup -- rationalIdeleClassRepresentation = -- smallHilbertTowerMiddleNormSubgroup K L := by -- let H : FiniteAbelianSubextension.NormOpenAddSubgroup -- rationalIdeleClassRepresentation L.field := -- ⟨smallHilbertTowerMiddleNormSubgroup K L, -- smallHilbertNormSubgroupInRationalClassFormation_isNormOpen K L⟩ -- have h := -- Classical.choose_spec -- (FiniteAbelianSubextension.normSubgroupMap_surjective -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (smallHilbertTowerMiddleFiniteAbstractField K L) H) -- exact congrArg Subtype.val h -- --private noncomputable abbrev secondSmallHilbertClassFieldTopField : Type := -- abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (secondSmallHilbertClassFieldSubextension K L).below -- --local notation "T₂" => secondSmallHilbertClassFieldTopField K L -- --private noncomputable instance -- secondSmallHilbertClassFieldSubextensionQuotientFinite : -- Finite -- (L.field.toSubgroup ⧸ -- extensionSubgroup L.field -- (secondSmallHilbertClassFieldSubextension K L).field -- (secondSmallHilbertClassFieldSubextension K L).below) := -- (secondSmallHilbertClassFieldSubextension K L).finite -- --private noncomputable instance -- secondSmallHilbertClassFieldTopFiniteDimensional : -- FiniteDimensional E T₂ := -- abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) L.field -- (secondSmallHilbertClassFieldSubextension K L).field -- (secondSmallHilbertClassFieldSubextension K L).below -- inferInstance inferInstance -- --private noncomputable instance -- secondSmallHilbertClassFieldTopScalarTower : -- IsScalarTower ℚ E T₂ := -- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -- --private noncomputable instance -- secondSmallHilbertClassFieldTopAbsoluteFiniteDimensional : -- FiniteDimensional ℚ T₂ := -- FiniteDimensional.trans ℚ E T₂ -- --private noncomputable instance -- secondSmallHilbertClassFieldTopNumberField : -- NumberField T₂ := -- NumberField.of_module_finite ℚ T₂ -- --private noncomputable instance -- secondSmallHilbertClassFieldTopIsGalois : -- IsGalois E T₂ := -- abstractRelativeFixedField_isGalois -- ℚ (SeparableClosure ℚ) L.field -- (secondSmallHilbertClassFieldSubextension K L).field -- (secondSmallHilbertClassFieldSubextension K L).below -- (secondSmallHilbertClassFieldSubextension K L).normal -- --private theorem -- secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_actualNormRange : -- ((secondSmallHilbertClassFieldSubextension K L).normSubgroup -- rationalIdeleClassRepresentation).map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -- (_root_.ideleClassNorm E T₂).range.toAddSubgroup := by -- change -- (finiteNormSubgroup rationalIdeleClassRepresentation -- L.field -- (secondSmallHilbertClassFieldSubextension K L).field -- (secondSmallHilbertClassFieldSubextension K L).below).map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -- (_root_.ideleClassNorm E T₂).range.toAddSubgroup -- exact -- map_rationalFiniteNormSubgroup_eq_ordinaryIdeleClassNormRange_concrete -- L.field -- (secondSmallHilbertClassFieldSubextension K L).field -- (secondSmallHilbertClassFieldSubextension K L).below -- (secondSmallHilbertClassFieldSubextension K L).normal -- --private theorem -- secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_smallHilbertNormSubgroup : -- ((secondSmallHilbertClassFieldSubextension K L).normSubgroup -- rationalIdeleClassRepresentation).map -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup := by -- let e : Additive (IdeleClassGroup E) ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation L.field := -- rationalAbstractFixedFieldIdeleClassEquivFixed L.field -- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L) -- let H : AddSubgroup (Additive (IdeleClassGroup E)) := -- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup -- let back : AddSubgroup -- (ambientFixedAddSubgroup rationalIdeleClassRepresentation L.field) → -- AddSubgroup (Additive (IdeleClassGroup E)) := -- fun n => n.map e.symm.toAddMonoidHom -- have hNorm : -- back ((secondSmallHilbertClassFieldSubextension K L).normSubgroup -- rationalIdeleClassRepresentation) = -- back (smallHilbertTowerMiddleNormSubgroup K L) := -- congrArg back (secondSmallHilbertClassFieldSubextension_normSubgroup K L) -- have hCancel : back (smallHilbertTowerMiddleNormSubgroup K L) = H := -- AddSubgroup.map_comap_eq_self_of_surjective e.symm.surjective H -- exact hNorm.trans hCancel -- --/-- The actual second small Hilbert class field has exactly the intrinsic --small-Hilbert norm range over the literal middle fixed field. -/ --@[simp] --theorem secondSmallHilbertClassFieldSubextension_ideleClassNorm_range : -- (_root_.ideleClassNorm E T₂).range = -- smallHilbertClassFieldNormSubgroup (K := E) := by -- apply Subgroup.toAddSubgroup.injective -- exact -- (secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_actualNormRange -- K L).symm.trans -- (secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_smallHilbertNormSubgroup -- K L) - --/-- Compatibility of the typed middle endpoint with the canonical endpoint --used by the conjugation API. -/ --theorem smallHilbertTowerMiddleNormSubgroup_eq_conjugationEndpoint : -- smallHilbertTowerMiddleNormSubgroup K L = -- smallHilbertNormSubgroupInRationalClassFormation -- (L.toFiniteGaloisExtension.toFiniteAbstractFieldExtension).field := by -- have hField : -- (L.toFiniteGaloisExtension.toFiniteAbstractFieldExtension).field.field = -- L.field := by -- rfl -- unfold smallHilbertNormSubgroupInRationalClassFormation -- cases hField -- exact smallHilbertTowerMiddleNormSubgroup_eq_map K L -+local notation "E" => abstractFixedField ℚ (SeparableClosure ℚ) L.field -+local notation "N" => smallHilbertClassFieldNormAmbient E - - end RationalFixedField - -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationBase.lean -new file mode 100644 -index 0000000..31a4787 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationBase.lean -@@ -0,0 +1,278 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldRealization -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerConjugation -+import Mathlib.Data.Rat.Cast.Defs -+ -+ -+set_option autoImplicit false -+ -+/-! -+# Actual realization of the two-stage small Hilbert tower -+ -+The first small Hilbert class field is the actual finite abelian -+subextension selected in `HilbertClassFieldRealization`. Over its actual -+fixed field, the closed finite-index small-Hilbert norm subgroup has a -+finite Galois norm neighbourhood. We embed that neighbourhood in the -+rational separable closure compatibly with the already chosen first -+stage. Finite abelian classification then selects the second small -+Hilbert class field over the literal first-stage subgroup. -+ -+The compatibility of the embedding is essential: an unrelated chosen -+copy of the middle number field would produce a class field over a -+conjugate closed subgroup rather than over the first-stage subgroup -+itself. -+-/ -+ -+open scoped Classical NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace IdealClassFieldTheory -+ -+open AlgebraicNumberTheory -+open ClassFormation -+open CyclicCohomology -+open GlobalClassFields -+open KummerTheory -+open LocalClassFieldTheory -+open RamificationTheory -+open Reciprocity -+ -+/-- The ordinary idèle-class operations used by the two-stage transport, -+fixed at the canonical principal-subgroup quotient. -/ -+@[instance_reducible] -+noncomputable def smallHilbertTowerIdeleClassCommGroup -+ (F : Type) [Field F] [NumberField F] : -+ CommGroup (IdeleClassGroup F) := -+ QuotientGroup.Quotient.commGroup (IdeleGroup.principalSubgroup F) -+ -+attribute [local instance] smallHilbertTowerIdeleClassCommGroup -+ -+private theorem addSubgroup_comap_symm_eq_map -+ {A B : Type*} [AddGroup A] [AddGroup B] -+ (H : AddSubgroup A) (e : A ≃+ B) : -+ H.comap e.symm.toAddMonoidHom = -+ H.map e.toAddMonoidHom := by -+ exact (AddSubgroup.map_equiv_eq_comap_symm e H).symm -+ -+private noncomputable abbrev -+ closedFiniteIndexNormAmbientCanonicalBaseAlgebra -+ (F : Type) [Field F] [NumberField F] -+ (H : Subgroup (IdeleClassGroup F)) -+ (hclosed : IsClosed (H : Set (IdeleClassGroup F))) -+ [H.FiniteIndex] : -+ Algebra F -+ (closedFiniteIndexClassFieldNormAmbient -+ (K := F) H hclosed) := -+ inferInstance -+ -+section RationalFixedField -+ -+variable -+ (K : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (L : FiniteAbelianSubextension K.field) -+ -+/-- The finite abstract field attached to the intermediate field of the -+finite abelian extension, with finiteness obtained by transitivity. -/ -+noncomputable abbrev smallHilbertTowerMiddleFiniteAbstractField : -+ FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -+ { field := L.field -+ finite := by -+ let : Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ K.field (le_baseField K.field)) := -+ K.finite -+ let : Finite -+ (K.field.toSubgroup ⧸ -+ extensionSubgroup K.field L.field L.below) := -+ L.finite -+ exact -+ FiniteGaloisSubextension.finite_extension_trans -+ L.below (le_baseField K.field) } -+ -+local notation "E" => -+ abstractFixedField ℚ (SeparableClosure ℚ) L.field -+ -+local notation "N" => -+ smallHilbertClassFieldNormAmbient E -+ -+noncomputable instance -+ smallHilbertTowerMiddleAbstractQuotientFinite : -+ Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ L.field (le_baseField L.field)) := -+ (smallHilbertTowerMiddleFiniteAbstractField K L).finite -+ -+private noncomputable instance -+ smallHilbertTowerMiddleFiniteDimensional : -+ FiniteDimensional ℚ E := -+ abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) L.field inferInstance -+ -+private noncomputable instance -+ smallHilbertTowerMiddleNumberField : -+ NumberField E := -+ NumberField.of_module_finite ℚ E -+ -+ -+/-- The small Hilbert norm subgroup of the intermediate number field, -+transported to its ambient fixed idele-class representation. -/ -+noncomputable def smallHilbertTowerMiddleNormSubgroup : -+ AddSubgroup -+ (ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation L.field) := -+ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup.comap -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom -+ -+/-- The typed `comap` endpoint is the canonical transported `map` endpoint. -+This uses only the generic additive equivalence law. -/ -+theorem smallHilbertTowerMiddleNormSubgroup_eq_map : -+ smallHilbertTowerMiddleNormSubgroup K L = -+ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup.map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).toAddMonoidHom := by -+ exact addSubgroup_comap_symm_eq_map -+ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup -+ (rationalAbstractFixedFieldIdeleClassEquivFixed L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)) -+ -+/-- The algebra structure of the intermediate field on its small Hilbert -+class-field norm ambient. -/ -+@[reducible] -+noncomputable def -+ smallHilbertTowerNormAmbientAlgebra : -+ Algebra E N := -+ closedFiniteIndexNormAmbientCanonicalBaseAlgebra E -+ (smallHilbertClassFieldNormSubgroup (K := E)) -+ (smallHilbertClassFieldNormSubgroup_isClosed (K := E)) -+ -+attribute [local instance] smallHilbertTowerNormAmbientAlgebra -+ -+/-- Scalar multiplication of the intermediate field on its small Hilbert -+class-field norm ambient. -/ -+@[reducible] -+noncomputable def -+ smallHilbertTowerNormAmbientSMul : -+ SMul E N := -+ Algebra.toSMul -+ (self := smallHilbertTowerNormAmbientAlgebra K L) -+ -+@[reducible] -+private noncomputable def -+ smallHilbertTowerNormAmbientModule : -+ Module E N := -+ @Algebra.toModule E N _ _ -+ (smallHilbertTowerNormAmbientAlgebra K L) -+ -+theorem -+ smallHilbertTowerNormAmbientScalarTower : -+ @IsScalarTower ℚ E N -+ (Algebra.toSMul (R := ℚ) (A := E)) -+ (smallHilbertTowerNormAmbientSMul K L) -+ (Algebra.toSMul (R := ℚ) (A := N)) := by -+ exact IsScalarTower.of_algebraMap_eq' -+ (R := ℚ) (S := E) (A := N) -+ (RingHom.ext_rat (algebraMap ℚ N) -+ ((algebraMap E N).comp (algebraMap ℚ E))) -+ -+/-- The rational algebra embedding of the intermediate field into its -+small Hilbert class-field norm ambient. -/ -+noncomputable def -+ smallHilbertTowerNormAmbientAlgHom : -+ E →ₐ[ℚ] N := -+ { toRingHom := algebraMap E N -+ commutes' := fun r => -+ (RingHom.congr_fun -+ (RingHom.ext_rat -+ ((algebraMap E N).comp (algebraMap ℚ E)) -+ (algebraMap ℚ N)) r) } -+ -+theorem smallHilbertTowerNormAmbientAlgHom_apply -+ (x : E) : -+ smallHilbertTowerNormAmbientAlgHom K L x = -+ algebraMap E N x := by -+ rfl -+ -+theorem -+ smallHilbertTowerNormAmbientIsGalois : -+ IsGalois E N := by -+ unfold smallHilbertClassFieldNormAmbient -+ closedFiniteIndexClassFieldNormAmbient -+ exact -+ closedFiniteIndexNormAmbientIsGalois -+ (smallHilbertClassFieldNormSubgroup (K := E)) -+ (smallHilbertClassFieldNormSubgroup_isClosed (K := E)) -+ -+attribute [local instance] smallHilbertTowerNormAmbientIsGalois -+ -+/-- The separable-closure automorphism extending the induced embedding -+of the intermediate field into the norm-neighborhood field. -/ -+noncomputable def -+ smallHilbertNormNeighborhoodForwardAlignment : -+ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := by -+ let j₀ : N →ₐ[ℚ] SeparableClosure ℚ := -+ numberFieldSeparableClosureEmbedding N -+ let i₀ : E →ₐ[ℚ] SeparableClosure ℚ := -+ j₀.comp (smallHilbertTowerNormAmbientAlgHom K L) -+ exact -+ AlgEquiv.ofBijective -+ (i₀.liftNormal (SeparableClosure ℚ)) -+ (AlgHom.normal_bijective -+ ℚ (SeparableClosure ℚ) (SeparableClosure ℚ) _) -+ -+/-- The separable-closure automorphism which aligns an arbitrary chosen -+embedding of the norm-neighbourhood field with the already embedded -+middle field. -/ -+noncomputable def -+ smallHilbertNormNeighborhoodAlignment : -+ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := -+ (smallHilbertNormNeighborhoodForwardAlignment K L).symm -+ -+@[simp] -+theorem smallHilbertNormNeighborhoodForwardAlignment_apply -+ (x : E) : -+ smallHilbertNormNeighborhoodForwardAlignment K L -+ (x : SeparableClosure ℚ) = -+ (numberFieldSeparableClosureEmbedding N) -+ (algebraMap E N x) := by -+ let j₀ : N →ₐ[ℚ] SeparableClosure ℚ := -+ numberFieldSeparableClosureEmbedding N -+ let i₀ : E →ₐ[ℚ] SeparableClosure ℚ := -+ j₀.comp (smallHilbertTowerNormAmbientAlgHom K L) -+ dsimp only [smallHilbertNormNeighborhoodForwardAlignment, -+ AlgEquiv.ofBijective_apply] -+ calc -+ _ = i₀ x := by -+ simpa only [IntermediateField.algebraMap_apply, -+ Algebra.algebraMap_self, RingHom.id_apply] using -+ i₀.liftNormal_commutes (SeparableClosure ℚ) x -+ _ = j₀ (algebraMap E N x) := by -+ change -+ j₀ (smallHilbertTowerNormAmbientAlgHom K L x) = -+ j₀ (algebraMap E N x) -+ exact congrArg j₀ -+ (smallHilbertTowerNormAmbientAlgHom_apply K L x) -+ -+ -+end RationalFixedField -+end IdealClassFieldTheory -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationEmbedding.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationEmbedding.lean -new file mode 100644 -index 0000000..b76d2bd ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationEmbedding.lean -@@ -0,0 +1,190 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerRealizationBase -+ -+set_option autoImplicit false -+ -+open scoped Classical NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace IdealClassFieldTheory -+ -+open AlgebraicNumberTheory -+open ClassFormation -+open CyclicCohomology -+open GlobalClassFields -+open KummerTheory -+open LocalClassFieldTheory -+open RamificationTheory -+open Reciprocity -+ -+ -+attribute [local instance] smallHilbertTowerIdeleClassCommGroup -+ smallHilbertTowerNormAmbientAlgebra -+ smallHilbertTowerNormAmbientIsGalois -+ -+section RationalFixedField -+ -+variable -+ (K : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (L : FiniteAbelianSubextension K.field) -+ -+ -+local notation "E" => abstractFixedField ℚ (SeparableClosure ℚ) L.field -+local notation "N" => smallHilbertClassFieldNormAmbient E -+ -+/-- A controlled embedding of the concrete finite Galois norm -+neighbourhood. Its restriction to the middle field is the literal -+inclusion of that fixed field in `SeparableClosure ℚ`. -/ -+noncomputable def -+ smallHilbertNormNeighborhoodEmbedding : -+ N →ₐ[ℚ] SeparableClosure ℚ := -+ (smallHilbertNormNeighborhoodAlignment K L).toAlgHom.comp -+ (numberFieldSeparableClosureEmbedding N) -+ -+@[simp] -+theorem smallHilbertNormNeighborhoodEmbedding_algebraMap -+ (x : E) : -+ smallHilbertNormNeighborhoodEmbedding K L -+ (algebraMap E N x) = -+ (x : SeparableClosure ℚ) := by -+ change -+ (smallHilbertNormNeighborhoodForwardAlignment K L).symm -+ ((numberFieldSeparableClosureEmbedding N) -+ (algebraMap E N x)) = -+ (x : SeparableClosure ℚ) -+ rw [← smallHilbertNormNeighborhoodForwardAlignment_apply K L x] -+ exact -+ (smallHilbertNormNeighborhoodForwardAlignment K L).symm_apply_apply _ -+ -+private abbrev smallHilbertNormNeighborhoodEmbeddedBase : -+ ClosedSubgroup -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange -+ ((smallHilbertNormNeighborhoodEmbedding K L).comp -+ (smallHilbertTowerNormAmbientAlgHom K L))) -+ -+private abbrev smallHilbertNormNeighborhoodEmbeddedField : -+ ClosedSubgroup -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange -+ (smallHilbertNormNeighborhoodEmbedding K L)) -+ -+private theorem smallHilbertNormNeighborhoodEmbeddedField_le_base : -+ (smallHilbertNormNeighborhoodEmbeddedField K L).toSubgroup ≤ -+ (smallHilbertNormNeighborhoodEmbeddedBase K L).toSubgroup := by -+ change -+ (AlgHom.fieldRange -+ (smallHilbertNormNeighborhoodEmbedding K L)).fixingSubgroup ≤ -+ (AlgHom.fieldRange -+ ((smallHilbertNormNeighborhoodEmbedding K L).comp -+ (smallHilbertTowerNormAmbientAlgHom K L))).fixingSubgroup -+ apply -+ (AlgHom.fieldRange -+ ((smallHilbertNormNeighborhoodEmbedding K L).comp -+ (smallHilbertTowerNormAmbientAlgHom K L))).fixingSubgroup_le -+ exact -+ AlgHom.range_comp_le_range -+ (smallHilbertTowerNormAmbientAlgHom K L) -+ (smallHilbertNormNeighborhoodEmbedding K L) -+ -+theorem smallHilbertNormNeighborhoodEmbeddedBase_eq : -+ smallHilbertNormNeighborhoodEmbeddedBase K L = L.field := by -+ have hi : -+ (smallHilbertNormNeighborhoodEmbedding K L).comp -+ (smallHilbertTowerNormAmbientAlgHom K L) = -+ (abstractFixedField ℚ (SeparableClosure ℚ) L.field).val := by -+ apply AlgHom.ext -+ intro x -+ change smallHilbertNormNeighborhoodEmbedding K L -+ (smallHilbertTowerNormAmbientAlgHom K L x) = (x : SeparableClosure ℚ) -+ rw [smallHilbertTowerNormAmbientAlgHom_apply K L x] -+ exact smallHilbertNormNeighborhoodEmbedding_algebraMap K L x -+ change -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange -+ ((smallHilbertNormNeighborhoodEmbedding K L).comp -+ (smallHilbertTowerNormAmbientAlgHom K L))) = -+ L.field -+ rw [hi, IntermediateField.fieldRange_val] -+ exact -+ closedFixingSubgroup_abstractFixedField_eq -+ ℚ (SeparableClosure ℚ) L.field -+ -+private noncomputable def -+ smallHilbertNormNeighborhoodSeparableClosureEquiv : -+ let j := smallHilbertNormNeighborhoodEmbedding K L -+ let i := j.comp (smallHilbertTowerNormAmbientAlgHom K L) -+ let : Algebra E (SeparableClosure ℚ) := -+ i.toRingHom.toAlgebra -+ SeparableClosure E ≃ₐ[E] SeparableClosure ℚ := by -+ intro j i alg -+ let : @IsScalarTower ℚ E (SeparableClosure ℚ) -+ (Algebra.toSMul (R := ℚ) (A := E)) -+ alg.toSMul -+ (Algebra.toSMul (R := ℚ) (A := SeparableClosure ℚ)) := -+ IsScalarTower.of_algebraMap_eq' i.comp_algebraMap.symm -+ let : IsSepClosure E (SeparableClosure ℚ) := -+ ⟨IsSepClosure.sep_closed ℚ, -+ Algebra.isSeparable_tower_top_of_isSeparable -+ ℚ E (SeparableClosure ℚ)⟩ -+ exact -+ IsSepClosure.equiv E -+ (SeparableClosure E) (SeparableClosure ℚ) -+ -+/-- The finite Galois extension given by the embedded small Hilbert -+norm-neighborhood field over the embedded intermediate field. -/ -+noncomputable def -+ smallHilbertFiniteGaloisNormNeighborhoodRaw : -+ FiniteGaloisSubextension -+ (smallHilbertNormNeighborhoodEmbeddedBase K L) := by -+ let : @IsScalarTower ℚ E N -+ (Algebra.toSMul (R := ℚ) (A := E)) -+ (smallHilbertTowerNormAmbientSMul K L) -+ (Algebra.toSMul (R := ℚ) (A := N)) := -+ smallHilbertTowerNormAmbientScalarTower K L -+ let j : N →ₐ[ℚ] SeparableClosure ℚ := -+ smallHilbertNormNeighborhoodEmbedding K L -+ let i : E →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ E N) -+ let B : ClosedSubgroup (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) i.fieldRange -+ let T : ClosedSubgroup (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -+ smallHilbertNormNeighborhoodEmbeddedField K L -+ have hTB : T.toSubgroup ≤ B.toSubgroup := by -+ change j.fieldRange.fixingSubgroup ≤ i.fieldRange.fixingSubgroup -+ apply i.fieldRange.fixingSubgroup_le -+ exact AlgHom.range_comp_le_range (IsScalarTower.toAlgHom ℚ E N) j -+ let raw : FiniteGaloisSubextension B := { -+ field := T -+ below := hTB -+ normal := ambientEmbeddedExtensionSubgroup_normal ℚ E N j -+ (smallHilbertNormNeighborhoodSeparableClosureEquiv K L) -+ finite := ambientEmbeddedExtensionQuotient_finite ℚ E N j -+ (smallHilbertNormNeighborhoodSeparableClosureEquiv K L) } -+ have hi : IsScalarTower.toAlgHom ℚ E N = -+ smallHilbertTowerNormAmbientAlgHom K L := by -+ apply AlgHom.ext -+ intro x -+ exact (IsScalarTower.toAlgHom_apply ℚ E N x).trans -+ (smallHilbertTowerNormAmbientAlgHom_apply K L x).symm -+ have hB : B = smallHilbertNormNeighborhoodEmbeddedBase K L := -+ congrArg -+ (fun f : E →ₐ[ℚ] N => -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) (j.comp f).fieldRange) hi -+ exact hB ▸ raw -+ -+ -+end RationalFixedField -+end IdealClassFieldTheory -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationNorm.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationNorm.lean -new file mode 100644 -index 0000000..7c2a69a ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationNorm.lean -@@ -0,0 +1,272 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerRealizationEmbedding -+ -+set_option autoImplicit false -+ -+open scoped Classical NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace IdealClassFieldTheory -+ -+open AlgebraicNumberTheory -+open ClassFormation -+open CyclicCohomology -+open GlobalClassFields -+open KummerTheory -+open LocalClassFieldTheory -+open RamificationTheory -+open Reciprocity -+ -+ -+attribute [local instance] smallHilbertTowerIdeleClassCommGroup -+ smallHilbertTowerNormAmbientAlgebra -+ smallHilbertTowerNormAmbientIsGalois -+ -+section RationalFixedField -+ -+variable -+ (K : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (L : FiniteAbelianSubextension K.field) -+ -+ -+local notation "E" => abstractFixedField ℚ (SeparableClosure ℚ) L.field -+local notation "N" => smallHilbertClassFieldNormAmbient E -+ -+private noncomputable def rebaseFiniteGaloisSubextension -+ {G : Type} [Group G] [TopologicalSpace G] -+ {B B' : ClosedSubgroup G} (h : B = B') -+ (P : FiniteGaloisSubextension B) : -+ FiniteGaloisSubextension B' := -+ h ▸ P -+ -+@[simp] -+private theorem rebaseFiniteGaloisSubextension_field -+ {G : Type} [Group G] [TopologicalSpace G] -+ {B B' : ClosedSubgroup G} (h : B = B') -+ (P : FiniteGaloisSubextension B) : -+ (rebaseFiniteGaloisSubextension h P).field = P.field := by -+ cases h -+ rfl -+ -+private theorem -+ rebaseRationalFiniteGaloisSubextension_fixedField_eq -+ {B B' : ClosedSubgroup -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} -+ (h : B = B') (P : FiniteGaloisSubextension B) : -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (rebaseFiniteGaloisSubextension h P).below).restrictScalars ℚ = -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ P.below).restrictScalars ℚ := by -+ cases h -+ rfl -+ -+/-- An actual finite Galois norm neighbourhood over the literal -+first-stage subgroup. It is produced by the finite-index Kummer -+construction and the controlled embedding above. -/ -+noncomputable def smallHilbertFiniteGaloisNormNeighborhood : -+ FiniteGaloisSubextension L.field := -+ rebaseFiniteGaloisSubextension -+ (smallHilbertNormNeighborhoodEmbeddedBase_eq K L) -+ (smallHilbertFiniteGaloisNormNeighborhoodRaw K L) -+ -+ -+/-- The norm subgroup of the small Hilbert norm-neighborhood extension -+in the ambient fixed idele-class representation. -/ -+noncomputable def smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup : -+ AddSubgroup -+ (ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation L.field) := -+ (smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -+ rationalIdeleClassRepresentation -+ -+/-- The relative fixed field realizing the top field of the small -+Hilbert norm-neighborhood extension. -/ -+noncomputable abbrev -+ smallHilbertFiniteGaloisNormNeighborhoodTopField : Type := -+ abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below -+ -+local notation "E₂" => -+ smallHilbertFiniteGaloisNormNeighborhoodTopField K L -+ -+private noncomputable instance -+ smallHilbertFiniteGaloisNormNeighborhoodQuotientFinite : -+ Finite -+ (L.field.toSubgroup ⧸ -+ extensionSubgroup L.field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below) := -+ (smallHilbertFiniteGaloisNormNeighborhood K L).finite -+ -+private noncomputable instance -+ smallHilbertFiniteGaloisNormNeighborhoodFiniteDimensional : -+ FiniteDimensional E E₂ := -+ abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) L.field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below -+ inferInstance inferInstance -+ -+private noncomputable instance -+ smallHilbertFiniteGaloisNormNeighborhoodScalarTower : -+ IsScalarTower ℚ E E₂ := -+ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -+ -+private noncomputable instance -+ smallHilbertFiniteGaloisNormNeighborhoodAbsoluteFiniteDimensional : -+ FiniteDimensional ℚ E₂ := -+ FiniteDimensional.trans ℚ E E₂ -+ -+private noncomputable instance -+ smallHilbertFiniteGaloisNormNeighborhoodNumberField : -+ NumberField E₂ := -+ NumberField.of_module_finite ℚ E₂ -+ -+private noncomputable instance -+ smallHilbertFiniteGaloisNormNeighborhoodIsGalois : -+ IsGalois E E₂ := -+ abstractRelativeFixedField_isGalois -+ ℚ (SeparableClosure ℚ) L.field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below -+ (smallHilbertFiniteGaloisNormNeighborhood K L).normal -+ -+private theorem -+ smallHilbertFiniteGaloisNormNeighborhood_fixedField_eq_range : -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ = -+ AlgHom.fieldRange -+ (smallHilbertNormNeighborhoodEmbedding K L) := by -+ rw [show -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ = -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (smallHilbertFiniteGaloisNormNeighborhoodRaw K L).below).restrictScalars ℚ -+ from -+ rebaseRationalFiniteGaloisSubextension_fixedField_eq -+ (smallHilbertNormNeighborhoodEmbeddedBase_eq K L) -+ (smallHilbertFiniteGaloisNormNeighborhoodRaw K L)] -+ exact -+ InfiniteGalois.fixedField_fixingSubgroup -+ (AlgHom.fieldRange -+ (smallHilbertNormNeighborhoodEmbedding K L)) -+ -+private noncomputable def -+ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv : -+ N ≃ₐ[ℚ] -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ := -+ (smallHilbertNormNeighborhoodEmbedding K L).equivFieldRange.trans -+ (IntermediateField.equivOfEq -+ (smallHilbertFiniteGaloisNormNeighborhood_fixedField_eq_range -+ K L).symm) -+ -+@[simp] -+private theorem -+ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv_algebraMap -+ (x : E) : -+ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv K L -+ (algebraMap E N x) = -+ algebraMap E -+ E₂ x := by -+ apply Subtype.ext -+ change -+ smallHilbertNormNeighborhoodEmbedding K L -+ (algebraMap E N x) = -+ (x : SeparableClosure ℚ) -+ exact smallHilbertNormNeighborhoodEmbedding_algebraMap K L x -+ -+private noncomputable def -+ smallHilbertFiniteGaloisNormNeighborhoodRelativeTopEquiv : -+ N ≃ₐ[E] E₂ := { -+ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv K L with -+ commutes' := fun x => -+ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv_algebraMap -+ K L x } -+ -+theorem -+ smallHilbertFiniteGaloisNormNeighborhood_ordinaryNorm_le : -+ (_root_.ideleClassNorm E N).range ≤ -+ smallHilbertClassFieldNormSubgroup (K := E) := by -+ simpa only [smallHilbertClassFieldNormAmbient] using -+ (closedFiniteIndexClassFieldNormAmbient_normRange_le -+ (K := E) (smallHilbertClassFieldNormSubgroup (K := E)) -+ (smallHilbertClassFieldNormSubgroup_isClosed (K := E))) -+ -+private theorem -+ smallHilbertFiniteGaloisNormNeighborhood_ordinaryNormRange_eq : -+ (_root_.ideleClassNorm E N).range = -+ (_root_.ideleClassNorm E E₂).range := by -+ simpa only [ordinaryIdeleClassNorm_range_eq_relative] using -+ (ideleClassNorm_range_algEquiv -+ (K := E) -+ (smallHilbertFiniteGaloisNormNeighborhoodRelativeTopEquiv -+ K L)).symm -+ -+private theorem -+ smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq : -+ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -+ rationalIdeleClassRepresentation).map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -+ (_root_.ideleClassNorm E E₂).range.toAddSubgroup := by -+ change -+ (finiteNormSubgroup rationalIdeleClassRepresentation -+ L.field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below).map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -+ (_root_.ideleClassNorm E E₂).range.toAddSubgroup -+ exact -+ (map_rationalFiniteNormSubgroup_eq_ordinaryIdeleClassNormRange_concrete -+ L.field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).field -+ (smallHilbertFiniteGaloisNormNeighborhood K L).below -+ (smallHilbertFiniteGaloisNormNeighborhood K L).normal) -+ -+/-- The abstract norm map lands directly in the ordinary norm range of the -+chosen neighbourhood. Composing the two named subgroup equalities here -+keeps downstream membership proofs pointwise. -/ -+private theorem -+ smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq_ordinaryNormRange : -+ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -+ rationalIdeleClassRepresentation).map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -+ (_root_.ideleClassNorm E N).range.toAddSubgroup := -+ (smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq K L).trans -+ (congrArg Subgroup.toAddSubgroup -+ (smallHilbertFiniteGaloisNormNeighborhood_ordinaryNormRange_eq K L).symm) -+ -+/-- Pointwise form of the combined norm-range equality. -/ -+theorem -+ smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_mem_ordinaryNormRange -+ (a : Additive (IdeleClassGroup E)) -+ (ha : -+ a ∈ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -+ rationalIdeleClassRepresentation).map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom) : -+ a ∈ (_root_.ideleClassNorm E N).range.toAddSubgroup := -+ (le_of_eq -+ (smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq_ordinaryNormRange -+ K L)) ha -+ -+ -+end RationalFixedField -+end IdealClassFieldTheory -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationSecond.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationSecond.lean -new file mode 100644 -index 0000000..768d9b0 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationSecond.lean -@@ -0,0 +1,256 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerRealizationNorm -+ -+set_option autoImplicit false -+ -+open scoped Classical NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace IdealClassFieldTheory -+ -+open AlgebraicNumberTheory -+open ClassFormation -+open CyclicCohomology -+open GlobalClassFields -+open KummerTheory -+open LocalClassFieldTheory -+open RamificationTheory -+open Reciprocity -+ -+ -+attribute [local instance] smallHilbertTowerIdeleClassCommGroup -+ smallHilbertTowerNormAmbientAlgebra -+ smallHilbertTowerNormAmbientIsGalois -+ -+section RationalFixedField -+ -+variable -+ (K : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (L : FiniteAbelianSubextension K.field) -+ -+ -+local notation "E" => abstractFixedField ℚ (SeparableClosure ℚ) L.field -+local notation "N" => smallHilbertClassFieldNormAmbient E -+ -+local notation "E₂" => smallHilbertFiniteGaloisNormNeighborhoodTopField K L -+ -+/-- The actual finite Galois norm neighbourhood has abstract norm -+subgroup contained in the canonical small-Hilbert subgroup of the -+middle fixed field. This is the source-producing norm-topology input; -+no norm-openness premise is assumed. -/ -+theorem smallHilbertFiniteGaloisNormNeighborhood_normSubgroup_le : -+ ∀ a : ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation L.field, -+ a ∈ smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup K L → -+ a ∈ smallHilbertTowerMiddleNormSubgroup K L := by -+ intro a ha -+ change -+ a ∈ (smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -+ rationalIdeleClassRepresentation at ha -+ have haMap : -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm a ∈ -+ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup -+ rationalIdeleClassRepresentation).map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom := -+ ⟨a, ha, rfl⟩ -+ have haOrdinary : -+ (rationalAbstractFixedFieldIdeleClassEquivFixed L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm a ∈ -+ (_root_.ideleClassNorm E N).range.toAddSubgroup := -+ smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_mem_ordinaryNormRange -+ K L _ haMap -+ exact smallHilbertFiniteGaloisNormNeighborhood_ordinaryNorm_le K L haOrdinary -+ -+/-- The canonical small-Hilbert subgroup of the actual middle fixed -+field is open in the genuine norm topology. -/ -+theorem smallHilbertNormSubgroupInRationalClassFormation_isNormOpen : -+ IsNormOpen rationalIdeleClassRepresentation L.field -+ (smallHilbertTowerMiddleNormSubgroup K L : -+ Set -+ (ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation L.field)) := by -+ rw [normTopology_addSubgroup_isOpen_iff] -+ refine -+ ⟨smallHilbertFiniteGaloisNormNeighborhood K L, ?_⟩ -+ change -+ smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup K L ≤ -+ smallHilbertTowerMiddleNormSubgroup K L -+ exact smallHilbertFiniteGaloisNormNeighborhood_normSubgroup_le K L -+ -+/-- The second small Hilbert class field as an actual finite abelian -+subextension of the literal first-stage field. -/ -+noncomputable def secondSmallHilbertClassFieldSubextension : -+ FiniteAbelianSubextension L.field := by -+ let H : FiniteAbelianSubextension.NormOpenAddSubgroup -+ rationalIdeleClassRepresentation L.field := -+ ⟨smallHilbertTowerMiddleNormSubgroup K L, -+ smallHilbertNormSubgroupInRationalClassFormation_isNormOpen K L⟩ -+ exact -+ Classical.choose -+ (FiniteAbelianSubextension.normSubgroupMap_surjective -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (smallHilbertTowerMiddleFiniteAbstractField K L) H) -+ -+/-- The second-stage extension realizes exactly the canonical -+small-Hilbert norm subgroup of the actual middle field. -/ -+@[simp] -+theorem secondSmallHilbertClassFieldSubextension_normSubgroup : -+ (secondSmallHilbertClassFieldSubextension K L).normSubgroup -+ rationalIdeleClassRepresentation = -+ smallHilbertTowerMiddleNormSubgroup K L := by -+ let H : FiniteAbelianSubextension.NormOpenAddSubgroup -+ rationalIdeleClassRepresentation L.field := -+ ⟨smallHilbertTowerMiddleNormSubgroup K L, -+ smallHilbertNormSubgroupInRationalClassFormation_isNormOpen K L⟩ -+ have h := -+ Classical.choose_spec -+ (FiniteAbelianSubextension.normSubgroupMap_surjective -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (smallHilbertTowerMiddleFiniteAbstractField K L) H) -+ exact congrArg Subtype.val h -+ -+private noncomputable abbrev secondSmallHilbertClassFieldTopField : Type := -+ abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (secondSmallHilbertClassFieldSubextension K L).below -+ -+local notation "T₂" => secondSmallHilbertClassFieldTopField K L -+ -+private noncomputable instance -+ secondSmallHilbertClassFieldSubextensionQuotientFinite : -+ Finite -+ (L.field.toSubgroup ⧸ -+ extensionSubgroup L.field -+ (secondSmallHilbertClassFieldSubextension K L).field -+ (secondSmallHilbertClassFieldSubextension K L).below) := -+ (secondSmallHilbertClassFieldSubextension K L).finite -+ -+private noncomputable instance -+ secondSmallHilbertClassFieldTopFiniteDimensional : -+ FiniteDimensional E T₂ := -+ abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) L.field -+ (secondSmallHilbertClassFieldSubextension K L).field -+ (secondSmallHilbertClassFieldSubextension K L).below -+ inferInstance inferInstance -+ -+private noncomputable instance -+ secondSmallHilbertClassFieldTopScalarTower : -+ IsScalarTower ℚ E T₂ := -+ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -+ -+private noncomputable instance -+ secondSmallHilbertClassFieldTopAbsoluteFiniteDimensional : -+ FiniteDimensional ℚ T₂ := -+ FiniteDimensional.trans ℚ E T₂ -+ -+private noncomputable instance -+ secondSmallHilbertClassFieldTopNumberField : -+ NumberField T₂ := -+ NumberField.of_module_finite ℚ T₂ -+ -+private noncomputable instance -+ secondSmallHilbertClassFieldTopIsGalois : -+ IsGalois E T₂ := -+ abstractRelativeFixedField_isGalois -+ ℚ (SeparableClosure ℚ) L.field -+ (secondSmallHilbertClassFieldSubextension K L).field -+ (secondSmallHilbertClassFieldSubextension K L).below -+ (secondSmallHilbertClassFieldSubextension K L).normal -+ -+private theorem -+ secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_actualNormRange : -+ ((secondSmallHilbertClassFieldSubextension K L).normSubgroup -+ rationalIdeleClassRepresentation).map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -+ (_root_.ideleClassNorm E T₂).range.toAddSubgroup := by -+ change -+ (finiteNormSubgroup rationalIdeleClassRepresentation -+ L.field -+ (secondSmallHilbertClassFieldSubextension K L).field -+ (secondSmallHilbertClassFieldSubextension K L).below).map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -+ (_root_.ideleClassNorm E T₂).range.toAddSubgroup -+ exact -+ map_rationalFiniteNormSubgroup_eq_ordinaryIdeleClassNormRange_concrete -+ L.field -+ (secondSmallHilbertClassFieldSubextension K L).field -+ (secondSmallHilbertClassFieldSubextension K L).below -+ (secondSmallHilbertClassFieldSubextension K L).normal -+ -+private theorem -+ secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_smallHilbertNormSubgroup : -+ ((secondSmallHilbertClassFieldSubextension K L).normSubgroup -+ rationalIdeleClassRepresentation).map -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = -+ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup := by -+ let e : Additive (IdeleClassGroup E) ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation L.field := -+ rationalAbstractFixedFieldIdeleClassEquivFixed L.field -+ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L) -+ let H : AddSubgroup (Additive (IdeleClassGroup E)) := -+ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup -+ let back : AddSubgroup -+ (ambientFixedAddSubgroup rationalIdeleClassRepresentation L.field) → -+ AddSubgroup (Additive (IdeleClassGroup E)) := -+ fun n => n.map e.symm.toAddMonoidHom -+ have hNorm : -+ back ((secondSmallHilbertClassFieldSubextension K L).normSubgroup -+ rationalIdeleClassRepresentation) = -+ back (smallHilbertTowerMiddleNormSubgroup K L) := -+ congrArg back (secondSmallHilbertClassFieldSubextension_normSubgroup K L) -+ have hCancel : back (smallHilbertTowerMiddleNormSubgroup K L) = H := -+ AddSubgroup.map_comap_eq_self_of_surjective e.symm.surjective H -+ exact hNorm.trans hCancel -+ -+/-- The actual second small Hilbert class field has exactly the intrinsic -+small-Hilbert norm range over the literal middle fixed field. -/ -+@[simp] -+theorem secondSmallHilbertClassFieldSubextension_ideleClassNorm_range : -+ (_root_.ideleClassNorm E T₂).range = -+ smallHilbertClassFieldNormSubgroup (K := E) := by -+ apply Subgroup.toAddSubgroup.injective -+ exact -+ (secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_actualNormRange -+ K L).symm.trans -+ (secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_smallHilbertNormSubgroup -+ K L) -+ -+/-- Compatibility of the typed middle endpoint with the canonical endpoint -+used by the conjugation API. -/ -+theorem smallHilbertTowerMiddleNormSubgroup_eq_conjugationEndpoint : -+ smallHilbertTowerMiddleNormSubgroup K L = -+ smallHilbertNormSubgroupInRationalClassFormation -+ (L.toFiniteGaloisExtension.toFiniteAbstractFieldExtension).field := by -+ have hField : -+ (L.toFiniteGaloisExtension.toFiniteAbstractFieldExtension).field.field = -+ L.field := by -+ rfl -+ unfold smallHilbertNormSubgroupInRationalClassFormation -+ cases hField -+ exact smallHilbertTowerMiddleNormSubgroup_eq_map K L -+ -+ -+end RationalFixedField -+end IdealClassFieldTheory -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidue.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidue.lean -index 8984e0a..3f1f8ad 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidue.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidue.lean -@@ -4,24 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidue -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidueFixedFields - --set_option autoImplicit false -- --/-! --# Global norm residue on actual fixed fields - --An abstract finite abelian subextension of the rational absolute Galois --group determines an actual finite abelian extension between its two --fixed number fields. This file transports the abstract norm-residue --symbol directly to the ordinary idele-class norm quotient of those --fixed fields. -+set_option autoImplicit false - --Keeping this construction in one ambient separable closure is essential --for the norm--restriction diagrams: no independently chosen embedding of --either field is introduced. ---/ - - open scoped IsMulCommutative NumberField - open NumberField -@@ -38,1460 +25,26 @@ open AlgebraicNumberTheory - open LocalClassFieldTheory - open RamificationTheory - --/-- The algebra structure on the rational separable closure induced by a --specified rational field embedding. It is deliberately not an instance: --different embeddings of the same field need not induce definitionally equal --algebra structures. -/ --@[reducible] --noncomputable def rationalEmbeddingSeparableClosureAlgebra -- {F : Type} [Field F] [Algebra ℚ F] -- (i : F →ₐ[ℚ] SeparableClosure ℚ) : -- Algebra F (SeparableClosure ℚ) := -- i.toRingHom.toAlgebra -- --/-- Two rational embeddings of the same number field into the fixed --rational separable closure differ by an automorphism of that --separable closure. -/ --theorem exists_numberFieldEmbeddingComparisonAutomorphism -- {F : Type} [Field F] [NumberField F] -- (i j : F →ₐ[ℚ] SeparableClosure ℚ) : -- ∃ σ : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ, -- ∀ x : F, σ (i x) = j x := by -- let hAlgebra : Algebra F (SeparableClosure ℚ) := -- rationalEmbeddingSeparableClosureAlgebra i -- let hScalarTower : IsScalarTower ℚ F (SeparableClosure ℚ) := -- IsScalarTower.of_algebraMap_eq' i.comp_algebraMap.symm -- let hSeparable : Algebra.IsSeparable F (SeparableClosure ℚ) := -- Algebra.isSeparable_tower_top_of_isSeparable -- ℚ F (SeparableClosure ℚ) -- obtain ⟨φ, hφ⟩ := -- (IsSepClosed.surjective_domRestrict_of_isSeparable -- (K := ℚ) (L := F) -- (M := SeparableClosure ℚ) -- (E := SeparableClosure ℚ)) j -- let σ : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := -- AlgEquiv.ofBijective φ -- (Normal.toIsAlgebraic.algHom_bijective₂ -- φ (AlgHom.id ℚ (SeparableClosure ℚ))).1 -- refine ⟨σ, ?_⟩ -- intro x -- have hx := -- congrArg (fun ψ : F →ₐ[ℚ] SeparableClosure ℚ => ψ x) hφ -- exact hx -- --/-- The canonical comparison automorphism between two rational --embeddings of one number field into the fixed separable closure. -/ --noncomputable def numberFieldEmbeddingComparisonAutomorphism -- {F : Type} [Field F] [NumberField F] -- (i j : F →ₐ[ℚ] SeparableClosure ℚ) : -- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := -- Classical.choose -- (exists_numberFieldEmbeddingComparisonAutomorphism i j) -- --/-- The comparison automorphism carries the first embedded copy of the --number field to the second one pointwise. -/ --@[simp] --theorem numberFieldEmbeddingComparisonAutomorphism_apply -- {F : Type} [Field F] [NumberField F] -- (i j : F →ₐ[ℚ] SeparableClosure ℚ) -- (x : F) : -- numberFieldEmbeddingComparisonAutomorphism i j (i x) = -- j x := -- Classical.choose_spec -- (exists_numberFieldEmbeddingComparisonAutomorphism i j) x -- --/-- Conjugating the fixing subgroup of one embedded copy of a number --field by the comparison automorphism gives the fixing subgroup of the --other embedded copy. -/ --theorem conjugateClosedFixingSubgroup_embeddingRange -- {F : Type} [Field F] [NumberField F] -- (i j : F →ₐ[ℚ] SeparableClosure ℚ) : -- conjugateClosedSubgroup -- (RamificationTheory.closedFixingSubgroup -- ℚ (SeparableClosure ℚ) i.fieldRange) -- (numberFieldEmbeddingComparisonAutomorphism j i) = -- RamificationTheory.closedFixingSubgroup -- ℚ (SeparableClosure ℚ) j.fieldRange := by -- let s := -- numberFieldEmbeddingComparisonAutomorphism j i -- ext τ -- change -- τ ∈ conjugateClosedSubgroup -- (closedFixingSubgroup ℚ (SeparableClosure ℚ) i.fieldRange) s ↔ -- τ ∈ closedFixingSubgroup ℚ (SeparableClosure ℚ) j.fieldRange -- rw [conjugateClosedSubgroup_mem] -- change -- s * τ * s⁻¹ ∈ i.fieldRange.fixingSubgroup ↔ -- τ ∈ j.fieldRange.fixingSubgroup -- rw [IntermediateField.mem_fixingSubgroup_iff, -- IntermediateField.mem_fixingSubgroup_iff] -- constructor -- · intro h x hx -- rcases hx with ⟨y, rfl⟩ -- have hi := h (i y) ⟨y, rfl⟩ -- have hs : -- s (j y) = i y := -- numberFieldEmbeddingComparisonAutomorphism_apply j i y -- change s (τ (s.symm (i y))) = i y at hi -- have hpre : s.symm (i y) = j y := by -- rw [← hs, s.symm_apply_apply] -- rw [hpre, ← hs] at hi -- exact s.injective hi -- · intro h x hx -- rcases hx with ⟨y, rfl⟩ -- have hj := h (j y) ⟨y, rfl⟩ -- have hs : -- s (j y) = i y := -- numberFieldEmbeddingComparisonAutomorphism_apply j i y -- change s (τ (s.symm (i y))) = i y -- have hpre : s.symm (i y) = j y := by -- rw [← hs, s.symm_apply_apply] -- rw [hpre, hj, hs] -- --section EmbeddedNumberFieldRealization -- --local instance numberFieldEmbeddedIdeleClassGroupIsMulCommutative -- {F : Type} [Field F] [NumberField F] -- : IsMulCommutative (IdeleClassGroup F) := -- ⟨⟨fun a b => mul_comm a b⟩⟩ -- --local instance numberFieldEmbeddedIdeleClassSubgroupNormal -- {F : Type} [Field F] [NumberField F] -- (N : Subgroup (IdeleClassGroup F)) : N.Normal := -- N.normal_of_isMulCommutative -- --variable -- (K L : Type) [Field K] [NumberField K] -- [Field L] [NumberField L] [Algebra K L] -- --/-- The lower embedding obtained by restricting an explicitly supplied --embedding of the top field into the rational separable closure. -/ --noncomputable def numberFieldEmbeddedLowerEmbedding -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- K →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ K L) -- --/-- The exact algebra structure on the rational separable closure induced by --the lower embedding of an explicitly embedded number-field tower. Keeping --this as a reducible definition lets every use of the associated separable- --closure equivalence share one definitionally identical algebra structure. -/ --@[reducible] --noncomputable def numberFieldEmbeddedSeparableClosureAlgebra -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- Algebra K (SeparableClosure ℚ) := -- rationalEmbeddingSeparableClosureAlgebra -- (numberFieldEmbeddedLowerEmbedding K L j) -- --/-- The fixing subgroup of the explicitly embedded lower field. -/ --abbrev numberFieldEmbeddedBaseSubgroup -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- ClosedSubgroup -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -- closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedLowerEmbedding K L j).fieldRange -- --/-- The fixing subgroup of the explicitly embedded top field. -/ --abbrev numberFieldEmbeddedTopSubgroup -- (_K L : Type) [Field L] [NumberField L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- ClosedSubgroup -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -- closedFixingSubgroup ℚ (SeparableClosure ℚ) j.fieldRange -- --/-- The top fixing subgroup lies in the lower fixing subgroup. -/ --theorem numberFieldEmbeddedTopSubgroup_le_baseSubgroup -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- (numberFieldEmbeddedTopSubgroup K L j).toSubgroup ≤ -- (numberFieldEmbeddedBaseSubgroup K L j).toSubgroup := by -- change -- j.fieldRange.fixingSubgroup ≤ -- (numberFieldEmbeddedLowerEmbedding K L j).fieldRange.fixingSubgroup -- apply -- (numberFieldEmbeddedLowerEmbedding K L j).fieldRange.fixingSubgroup_le -- intro x hx -- rcases hx with ⟨y, rfl⟩ -- exact ⟨algebraMap K L y, rfl⟩ -- --/-- The separable closure of the actual lower field, identified with --the rational separable closure carrying the algebra structure induced --by an explicit compatible embedding. -/ --noncomputable def numberFieldEmbeddedSeparableClosureEquiv -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- letI : Algebra K (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra K L j -- SeparableClosure K ≃ₐ[K] SeparableClosure ℚ := by -- letI : Algebra K (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra K L j -- letI hScalarTower : IsScalarTower ℚ K (SeparableClosure ℚ) := -- IsScalarTower.of_algebraMap_eq' -- (numberFieldEmbeddedLowerEmbedding K L j).comp_algebraMap.symm -- letI hseparable : Algebra.IsSeparable K (SeparableClosure ℚ) := -- Algebra.isSeparable_tower_top_of_isSeparable -- ℚ K (SeparableClosure ℚ) -- letI hSepClosure : IsSepClosure K (SeparableClosure ℚ) := -- ⟨IsSepClosure.sep_closed ℚ, hseparable⟩ -- exact -- IsSepClosure.equiv K -- (SeparableClosure K) (SeparableClosure ℚ) -- --/-- The relative subgroup arising from an explicit compatible --number-field embedding is normal. -/ --theorem numberFieldEmbeddedExtensionSubgroup_normal -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).Normal := by -- let i := numberFieldEmbeddedLowerEmbedding K L j -- let hAlgebra : Algebra K (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra K L j -- let e := numberFieldEmbeddedSeparableClosureEquiv K L j -- change -- (CyclicCohomology.extensionSubgroup -- (closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange i)) -- (closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange j)) _).Normal -- exact ambientEmbeddedExtensionSubgroup_normal ℚ K L j e -- --/-- The normality witness for an explicitly embedded tower, registered at --the precise subgroup used by the downstream quotient constructions. -/ --noncomputable local instance -- numberFieldEmbeddedExtensionSubgroupNormal -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal K L j -- --/-- The relative quotient arising from an explicit compatible --number-field embedding is finite. -/ --theorem numberFieldEmbeddedExtensionQuotient_finite -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- Finite -- ((numberFieldEmbeddedBaseSubgroup K L j).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := by -- let i := numberFieldEmbeddedLowerEmbedding K L j -- let hAlgebra : Algebra K (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra K L j -- let e := numberFieldEmbeddedSeparableClosureEquiv K L j -- change -- Finite -- ((closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange i)).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange i)) -- (closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange j)) _) -- exact ambientEmbeddedExtensionQuotient_finite ℚ K L j e -- --/-- The relative-index witness for an explicitly embedded tower, registered --at the exact quotient consumed by `FiniteNormQuotient`. -/ --noncomputable local instance -- numberFieldEmbeddedExtensionQuotientFinite -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- Finite -- ((numberFieldEmbeddedBaseSubgroup K L j).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -- numberFieldEmbeddedExtensionQuotient_finite K L j -- --/-- The finite abstract field determined by the lower member of an --explicitly embedded number-field tower. -/ --noncomputable abbrev numberFieldEmbeddedFiniteAbstractField -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) where -- field := numberFieldEmbeddedBaseSubgroup K L j -- finite := by -- simpa only [numberFieldEmbeddedBaseSubgroup] using -- (ambientEmbeddedAbsoluteQuotientFinite -- ℚ K (numberFieldEmbeddedLowerEmbedding K L j)) -- --/-- The absolute-index witness for the lower member of an explicitly embedded --tower, registered at its specialized quotient type. -/ --noncomputable local instance -- numberFieldEmbeddedAbsoluteQuotientFinite -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (numberFieldEmbeddedBaseSubgroup K L j) -- (le_baseField -- (numberFieldEmbeddedBaseSubgroup K L j))) := -- (numberFieldEmbeddedFiniteAbstractField K L j).finite -- --/-- The finite Galois subextension determined by an explicitly embedded --number-field tower. -/ --noncomputable abbrev numberFieldEmbeddedFiniteGaloisSubextension -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteGaloisSubextension -- (numberFieldEmbeddedBaseSubgroup K L j) where -- field := numberFieldEmbeddedTopSubgroup K L j -- below := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -- normal := numberFieldEmbeddedExtensionSubgroup_normal K L j -- finite := numberFieldEmbeddedExtensionQuotient_finite K L j -- --/-- Shared finite-dimensional data for the fixed field of the lower subgroup --in an explicitly embedded number-field tower. -/ --noncomputable local instance -- numberFieldEmbeddedAbstractFixedFieldFiniteDimensional -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteDimensional ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) := -- abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedAbsoluteQuotientFinite K L j) -- --/-- Shared relative finite-dimensional data for the two fixed fields of an --explicitly embedded number-field tower. -/ --noncomputable local instance -- numberFieldEmbeddedAbstractRelativeFixedFieldFiniteDimensional -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteDimensional -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -- abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -- (numberFieldEmbeddedAbsoluteQuotientFinite K L j) -- (numberFieldEmbeddedExtensionQuotientFinite K L j) -- --local instance numberFieldEmbeddedAbstractFixedFieldScalarTower -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- IsScalarTower ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -- --noncomputable local instance -- numberFieldEmbeddedAbstractRelativeFixedFieldAbsoluteFiniteDimensional -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteDimensional ℚ -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -- FiniteDimensional.trans ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) -- --noncomputable local instance -- numberFieldEmbeddedAbstractFixedFieldNumberField -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- NumberField -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) := -- NumberField.of_module_finite ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) -- --noncomputable local instance -- numberFieldEmbeddedAbstractRelativeFixedFieldNumberField -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- NumberField -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -- NumberField.of_module_finite ℚ -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) -- --noncomputable local instance -- numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsFiniteDimensional -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteDimensional ℚ -- ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := by -- change FiniteDimensional ℚ -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) -- infer_instance -- --noncomputable local instance -- numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsNumberField -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- NumberField -- ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := -- NumberField.of_module_finite ℚ _ -- --noncomputable local instance -- numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsAlgebra -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- Algebra -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) -- ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := -- (IntermediateField.inclusion -- (abstractFixedField_le ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j))).toRingHom.toAlgebra -- --noncomputable local instance -- numberFieldEmbeddedAbstractRelativeFixedFieldIsGalois -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- IsGalois -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -- abstractRelativeFixedField_isGalois -- ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -- (numberFieldEmbeddedExtensionSubgroupNormal K L j) -- --/-- The quotient of the two explicitly embedded fixing subgroups is --the actual relative Galois group. -/ --noncomputable def -- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient ≃* -- Gal(L / K) := by -- let i := numberFieldEmbeddedLowerEmbedding K L j -- letI hAlgebra : Algebra K (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra K L j -- let e := numberFieldEmbeddedSeparableClosureEquiv K L j -- let H₀ := -- closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange i) -- let J₀ := -- closedFixingSubgroup ℚ (SeparableClosure ℚ) -- (AlgHom.fieldRange j) -- let hJH : J₀.toSubgroup ≤ H₀.toSubgroup := by -- change j.fieldRange.fixingSubgroup ≤ i.fieldRange.fixingSubgroup -- apply i.fieldRange.fixingSubgroup_le -- intro x hx -- rcases hx with ⟨y, rfl⟩ -- exact ⟨algebraMap K L y, rfl⟩ -- letI : (CyclicCohomology.extensionSubgroup H₀ J₀ hJH).Normal := -- ambientEmbeddedExtensionSubgroup_normal ℚ K L j e -- change -- (H₀.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H₀ J₀ hJH) ≃* -- Gal(L / K) -- exact ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ K L j e -- --/-- The original lower field is canonically equivalent to the fixed --field of its explicitly embedded fixing subgroup. -/ --noncomputable def numberFieldEmbeddedAbstractBaseFieldEquiv -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- K ≃ₐ[ℚ] -- abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j) := -- (numberFieldEmbeddedLowerEmbedding K L j).equivFieldRange.trans -- (IntermediateField.equivOfEq -- (InfiniteGalois.fixedField_fixingSubgroup -- (numberFieldEmbeddedLowerEmbedding K L j).fieldRange).symm) -- --/-- The original top field is canonically equivalent to the relative --fixed field of its explicitly embedded fixing subgroup. -/ --noncomputable def numberFieldEmbeddedAbstractTopFieldEquiv -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- L ≃ₐ[ℚ] -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup -- K L j)).restrictScalars ℚ := -- j.equivFieldRange.trans -- (IntermediateField.equivOfEq -- (InfiniteGalois.fixedField_fixingSubgroup j.fieldRange).symm) -- --/-- The two explicit fixed-field equivalences commute with the tower --algebra maps. -/ --@[simp] --theorem numberFieldEmbeddedAbstractFieldEquiv_algebraMap -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (x : K) : -- numberFieldEmbeddedAbstractTopFieldEquiv K L j -- (algebraMap K L x) = -- algebraMap -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L j)) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j x) := by -- apply Subtype.ext -- rfl -- --/-- The ordinary idele class group of the explicitly embedded lower --field, transported to the fixed part of the rational absolute --idele-class representation. -/ --noncomputable def numberFieldEmbeddedIdeleClassEquivAmbientFixed -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- Additive (IdeleClassGroup K) ≃+ -- ambientFixedAddSubgroup -- rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j) := by -- let H := numberFieldEmbeddedBaseSubgroup K L j -- exact -- (MulEquiv.toAdditive -- (ideleClassCongr -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j))).trans -- (rationalAbstractFixedFieldIdeleClassEquivFixed H) -- --/-- The abstract finite norm quotient of an explicitly embedded tower --is its genuine ordinary idele-class norm quotient. -/ --noncomputable def -- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteNormQuotient rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ≃+ -- Additive -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm K L).range) := by -- let hnormal := -- numberFieldEmbeddedExtensionSubgroupNormal K L j -- let H := numberFieldEmbeddedBaseSubgroup K L j -- let J := numberFieldEmbeddedTopSubgroup K L j -- let hJH := -- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -- let fixedFieldEquiv := -- rationalFiniteNormQuotientEquivIdeleClassNormQuotient -- H J hJH hnormal -- let actualFieldEquiv := -- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -- exact -- fixedFieldEquiv.trans -- (MulEquiv.toAdditive actualFieldEquiv.symm) -- --private theorem numberFieldEmbeddedOrdinaryNormQuotientCongr_symm_mk -- {K₀ L₀ K₁ L₁ : Type} -- [Field K₀] [NumberField K₀] -- [Field L₀] [NumberField L₀] [Algebra K₀ L₀] -- [Field K₁] [NumberField K₁] -- [Field L₁] [NumberField L₁] [Algebra K₁ L₁] -- (eK : K₀ ≃ₐ[ℚ] K₁) -- (eL : L₀ ≃ₐ[ℚ] L₁) -- (h : ∀ x : K₀, -- eL (algebraMap K₀ L₀ x) = -- algebraMap K₁ L₁ (eK x)) -- (c : IdeleClassGroup K₁) : -- (ordinaryIdeleClassNormQuotientCongrOfAlgEquiv eK eL h).symm -- (QuotientGroup.mk' -- (_root_.ideleClassNorm K₁ L₁).range c) = -- QuotientGroup.mk' -- (_root_.ideleClassNorm K₀ L₀).range -- ((ideleClassCongr eK).symm c) := by -- let e := ordinaryIdeleClassNormQuotientCongrOfAlgEquiv eK eL h -- apply e.injective -- rw [e.apply_symm_apply, -- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv_mk, -- MulEquiv.apply_symm_apply] -- --private noncomputable def numberFieldEmbeddedFiniteNormClassPublicValue -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j)) : -- Additive -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm K L).range) := -- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -- K L j -- (finiteNormClass rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -- a) -- --private noncomputable def numberFieldEmbeddedFiniteNormClassExpectedValue -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j)) : -- Additive -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm K L).range) := -- Additive.ofMul -- (QuotientGroup.mk' -- (_root_.ideleClassNorm K L).range -- (Additive.toMul -- ((numberFieldEmbeddedIdeleClassEquivAmbientFixed K L j).symm a))) -- --private noncomputable def -- numberFieldEmbeddedFiniteNormClassDirectComparisonValue -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j)) : -- Additive -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm K L).range) := by -- let hnormal := -- numberFieldEmbeddedExtensionSubgroupNormal K L j -- let H := numberFieldEmbeddedBaseSubgroup K L j -- let J := numberFieldEmbeddedTopSubgroup K L j -- let hJH := -- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -- let fixedFieldEquiv := -- rationalFiniteNormQuotientEquivIdeleClassNormQuotient -- H J hJH hnormal -- let actualFieldEquiv := -- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -- exact -- MulEquiv.toAdditive actualFieldEquiv.symm -- (fixedFieldEquiv -- (finiteNormClass rationalIdeleClassRepresentation -- H J hJH a)) -- --private theorem -- numberFieldEmbeddedFiniteNormClassPublicValue_eq_directComparison -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j)) : -- numberFieldEmbeddedFiniteNormClassPublicValue K L j a = -- numberFieldEmbeddedFiniteNormClassDirectComparisonValue K L j a := by -- unfold numberFieldEmbeddedFiniteNormClassPublicValue -- unfold numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -- unfold numberFieldEmbeddedFiniteNormClassDirectComparisonValue -- rfl -- --private noncomputable def numberFieldEmbeddedActualNormClassRepresentativeValue -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j)) : -- Additive -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm K L).range) := by -- let H := numberFieldEmbeddedBaseSubgroup K L j -- let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -- let F := abstractFixedField ℚ (SeparableClosure ℚ) H -- let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hJH -- let actualFieldEquiv := -- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -- exact -- Additive.ofMul -- (actualFieldEquiv.symm -- (QuotientGroup.mk' -- (_root_.ideleClassNorm F E).range -- (Additive.toMul -- ((rationalAbstractFixedFieldIdeleClassEquivFixed H).symm a)))) -- --private theorem -- numberFieldEmbeddedFiniteNormClassDirectComparison_eq_actualValue -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j)) : -- numberFieldEmbeddedFiniteNormClassDirectComparisonValue K L j a = -- numberFieldEmbeddedActualNormClassRepresentativeValue K L j a := by -- let hnormal := numberFieldEmbeddedExtensionSubgroupNormal K L j -- let H := numberFieldEmbeddedBaseSubgroup K L j -- let J := numberFieldEmbeddedTopSubgroup K L j -- let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -- let actualFieldEquiv := -- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -- have hfixed := -- rationalFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass -- H J hJH hnormal a -- unfold numberFieldEmbeddedFiniteNormClassDirectComparisonValue -- unfold numberFieldEmbeddedActualNormClassRepresentativeValue -- exact congrArg (MulEquiv.toAdditive actualFieldEquiv.symm) hfixed -- --private theorem numberFieldEmbeddedActualNormClassRepresentativeValue_eq_expected -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j)) : -- numberFieldEmbeddedActualNormClassRepresentativeValue K L j a = -- numberFieldEmbeddedFiniteNormClassExpectedValue K L j a := by -- let H := numberFieldEmbeddedBaseSubgroup K L j -- let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -- let F := abstractFixedField ℚ (SeparableClosure ℚ) H -- let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hJH -- let actualFieldEquiv := -- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -- let c : IdeleClassGroup F := -- Additive.toMul -- ((rationalAbstractFixedFieldIdeleClassEquivFixed H).symm a) -- unfold numberFieldEmbeddedActualNormClassRepresentativeValue -- unfold numberFieldEmbeddedFiniteNormClassExpectedValue -- change -- Additive.ofMul -- (actualFieldEquiv.symm -- (QuotientGroup.mk' -- (_root_.ideleClassNorm F E).range c)) = -- Additive.ofMul -- (QuotientGroup.mk' -- (_root_.ideleClassNorm K L).range -- ((ideleClassCongr -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j)).symm c)) -- exact -- congrArg Additive.ofMul -- (numberFieldEmbeddedOrdinaryNormQuotientCongr_symm_mk -- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) c) -- --/-- On a finite norm-class representative, the explicit fixed-field --comparison is the genuine ordinary idele-class quotient. -/ --@[simp] --theorem -- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j)) : -- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient K L j -- (finiteNormClass rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) a) = -- Additive.ofMul -- (QuotientGroup.mk' -- (_root_.ideleClassNorm K L).range -- (Additive.toMul -- ((numberFieldEmbeddedIdeleClassEquivAmbientFixed K L j).symm a))) := by -- change -- numberFieldEmbeddedFiniteNormClassPublicValue K L j a = -- numberFieldEmbeddedFiniteNormClassExpectedValue K L j a -- exact -- (numberFieldEmbeddedFiniteNormClassPublicValue_eq_directComparison -- K L j a).trans -- ((numberFieldEmbeddedFiniteNormClassDirectComparison_eq_actualValue -- K L j a).trans -- (numberFieldEmbeddedActualNormClassRepresentativeValue_eq_expected -- K L j a)) -- --/-- On an ordinary idele class, the explicit fixed-part realization --followed by the abstract finite norm-class map is the genuine quotient --class modulo the ordinary idele-class norm. -/ --@[simp] --theorem -- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass -- [FiniteDimensional K L] [IsGalois K L] -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (c : IdeleClassGroup K) : -- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient K L j -- (finiteNormClass rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K L j (Additive.ofMul c))) = -- Additive.ofMul -- (QuotientGroup.mk' -- (_root_.ideleClassNorm K L).range c) := by -- simpa only [AddEquiv.symm_apply_apply, toMul_ofMul] using -- (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass -- K L j -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K L j (Additive.ofMul c))) -- --variable [FiniteDimensional K L] [IsAbelianGalois K L] -- --/-- The abelianized quotient of the explicitly embedded tower is the --actual abelian Galois group. -/ --noncomputable def -- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- Additive -- (Abelianization -- (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient) ≃+ -- Additive Gal(L / K) := -- MulEquiv.toAdditive -- ((MulEquiv.abelianizationCongr -- (numberFieldEmbeddedExtensionQuotientEquivGaloisGroup K L j)).trans -- (Abelianization.equivOfComm : -- Gal(L / K) ≃* -- Abelianization Gal(L / K)).symm) -- --/-- The actual global norm-residue equivalence constructed from an --explicit compatible embedding of a finite abelian number-field --extension into the rational separable closure. -/ --noncomputable def globalNormResidueEquivOfEmbedding -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- Additive -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm K L).range) ≃+ -- Additive Gal(L / K) := by -- let eNorm : -- FiniteNormQuotient rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ≃+ -- Additive -- (Abelianization -- (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient) := -- rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldEmbeddedFiniteAbstractField K L j) -- (numberFieldEmbeddedFiniteGaloisSubextension K L j) -- exact -- (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -- K L j).symm.trans -- (eNorm.trans -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L j)) -- --/-- The explicit-embedding norm-residue equivalence on a finite norm class. -/ --theorem globalNormResidueEquivOfEmbedding_finiteNormClass -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (x : FiniteNormQuotient rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) : -- globalNormResidueEquivOfEmbedding K L j -- (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -- K L j x) = -- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup K L j -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldEmbeddedFiniteAbstractField K L j) -- (numberFieldEmbeddedFiniteGaloisSubextension K L j) x) := by -- simp only [globalNormResidueEquivOfEmbedding, AddEquiv.trans_apply, -- AddEquiv.symm_apply_apply] -- --/-- The global norm-residue homomorphism obtained from an explicit --compatible embedding. -/ --noncomputable def globalNormResidueMonoidHomOfEmbedding -- (j : L →ₐ[ℚ] SeparableClosure ℚ) : -- IdeleClassGroup K →* Gal(L / K) := by -- let e : -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm K L).range) ≃* -- Gal(L / K) := -- AddEquiv.toMultiplicative -- (globalNormResidueEquivOfEmbedding K L j) -- exact -- e.toMonoidHom.comp -- (QuotientGroup.mk' -- (_root_.ideleClassNorm K L).range) -- --/-- Evaluation of the explicit-embedding global norm-residue map is --the abstract norm-residue symbol evaluated on the corresponding genuine --fixed-part finite norm class. -/ --@[simp] --theorem globalNormResidueMonoidHomOfEmbedding_apply -- (j : L →ₐ[ℚ] SeparableClosure ℚ) -- (c : IdeleClassGroup K) : -- globalNormResidueMonoidHomOfEmbedding K L j c = -- Additive.toMul -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L j -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldEmbeddedFiniteAbstractField K L j) -- (numberFieldEmbeddedFiniteGaloisSubextension K L j) -- (finiteNormClass rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup K L j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K L j (Additive.ofMul c))))) := by -- have hclass := -- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass -- K L j c -- change -- Additive.toMul -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L j -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldEmbeddedFiniteAbstractField K L j) -- (numberFieldEmbeddedFiniteGaloisSubextension K L j) -- ((numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -- K L j).symm -- (Additive.ofMul -- (QuotientGroup.mk' -- (_root_.ideleClassNorm K L).range c))))) = -- _ -- rw [← hclass, -- (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -- K L j).symm_apply_apply] -- --omit [FiniteDimensional K L] [IsAbelianGalois K L] in --/-- The ambient-fixed idèle-class transport for the standard embedding is --the same map as the transport for an explicitly supplied embedding. This --comparison is kept at the transport boundary, before forming norm quotients --or applying reciprocity. -/ --theorem numberFieldTowerIdeleClassEquivAmbientFixed_eq_embedded_standard : -- numberFieldTowerIdeleClassEquivAmbientFixed K L = -- numberFieldEmbeddedIdeleClassEquivAmbientFixed K L -- (numberFieldSeparableClosureEmbedding L) := by -- let j := numberFieldSeparableClosureEmbedding L -- have hBase : -- numberFieldTowerAbstractBaseFieldEquiv K L = -- numberFieldEmbeddedAbstractBaseFieldEquiv K L j := by -- rfl -- unfold numberFieldTowerIdeleClassEquivAmbientFixed -- numberFieldEmbeddedIdeleClassEquivAmbientFixed -- rw [hBase] -- dsimp only -- congr 1 -- --/- At the chosen embedding, both constructions use the same fixed tower and --abstract reciprocity data. We compare their values on the particular fixed --idele class needed below; the two implementations of the finite norm-quotient --equivalence are deliberately not compared as dependent structures. -/ --private theorem numberFieldTowerNormResidueValue_eq_embedded_standard -- (c : IdeleClassGroup K) : -- numberFieldTowerAbelianizedExtensionQuotientEquivGaloisGroup K L -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldTowerReciprocityFiniteAbstractField K L) -- (numberFieldTowerFiniteGaloisSubextension K L) -- (finiteNormClass rationalIdeleClassRepresentation -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) -- (numberFieldTowerIdeleClassEquivAmbientFixed K L (Additive.ofMul c)))) = -- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L (numberFieldSeparableClosureEmbedding L) -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldEmbeddedFiniteAbstractField K L -- (numberFieldSeparableClosureEmbedding L)) -- (numberFieldEmbeddedFiniteGaloisSubextension K L -- (numberFieldSeparableClosureEmbedding L)) -- (finiteNormClass rationalIdeleClassRepresentation -- (numberFieldEmbeddedBaseSubgroup K L -- (numberFieldSeparableClosureEmbedding L)) -- (numberFieldEmbeddedTopSubgroup K L -- (numberFieldSeparableClosureEmbedding L)) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L -- (numberFieldSeparableClosureEmbedding L)) -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed K L -- (numberFieldSeparableClosureEmbedding L) (Additive.ofMul c)))) := by -- have hIdeleClassEquiv : -- numberFieldTowerIdeleClassEquivAmbientFixed K L = -- numberFieldEmbeddedIdeleClassEquivAmbientFixed K L -- (numberFieldSeparableClosureEmbedding L) := by -- exact numberFieldTowerIdeleClassEquivAmbientFixed_eq_embedded_standard K L -- have hFiniteAbstractField : -- numberFieldTowerReciprocityFiniteAbstractField K L = -- numberFieldEmbeddedFiniteAbstractField K L -- (numberFieldSeparableClosureEmbedding L) := by -- rfl -- have hSubextension : -- numberFieldTowerFiniteGaloisSubextension K L = -- numberFieldEmbeddedFiniteGaloisSubextension K L -- (numberFieldSeparableClosureEmbedding L) := by -- rfl -- have hGaloisComparison : -- numberFieldTowerAbelianizedExtensionQuotientEquivGaloisGroup K L = -- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L (numberFieldSeparableClosureEmbedding L) := by -- rfl -- simp only [← hGaloisComparison] -- cases hFiniteAbstractField -- cases hSubextension -- rw [← hIdeleClassEquiv] -- rfl -- --/-- At the standard embedding, the two global norm-residue equivalences --agree on the actual norm quotient. The comparison is extensional: it uses --surjectivity of the quotient map and the established evaluation formulas, --not definitional equality of the two quotient constructions. -/ --theorem globalNormResidueEquiv_eq_ofEmbedding_standard : -- globalNormResidueEquiv K L = -- globalNormResidueEquivOfEmbedding K L -- (numberFieldSeparableClosureEmbedding L) := by -- apply AddEquiv.ext -- intro q -- obtain ⟨c, hc⟩ := -- QuotientGroup.mk'_surjective -- (_root_.ideleClassNorm K L).range (Additive.toMul q) -- have hq : -- Additive.ofMul -- (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c) = q := -- Additive.toMul.injective hc -- rw [← hq] -- have hTower := -- numberFieldTowerFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass -- K L c -- have hEmbedded := -- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass -- K L (numberFieldSeparableClosureEmbedding L) c -- conv_lhs => -- rw [← hTower, globalNormResidueEquiv_finiteNormClass] -- conv_rhs => -- rw [← hEmbedded, globalNormResidueEquivOfEmbedding_finiteNormClass] -- exact numberFieldTowerNormResidueValue_eq_embedded_standard K L c -- --/-- The existing global norm-residue map is the explicit-embedding --construction for the standard chosen embedding of the top field. -/ --theorem globalNormResidueMonoidHom_eq_ofEmbedding_standard : -- globalNormResidueMonoidHom K L = -- globalNormResidueMonoidHomOfEmbedding K L -- (numberFieldSeparableClosureEmbedding L) := by -- apply MonoidHom.ext -- intro c -- apply Additive.toMul.injective -- change -- globalNormResidueEquiv K L -- (Additive.ofMul -- (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c)) = -- globalNormResidueEquivOfEmbedding K L -- (numberFieldSeparableClosureEmbedding L) -- (Additive.ofMul -- (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c)) -- exact congrArg -- (fun e : -- Additive -- (IdeleClassGroup K ⧸ -- (_root_.ideleClassNorm K L).range) ≃+ -- Additive (Gal(L / K)) => -- e (Additive.ofMul -- (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c))) -- (globalNormResidueEquiv_eq_ofEmbedding_standard K L) -- --end EmbeddedNumberFieldRealization -- --section EmbeddedNumberFieldRestriction -- --variable -- (K K' L L' : Type) -- [Field K] [NumberField K] -- [Field K'] [NumberField K'] -- [Field L] [NumberField L] -- [Field L'] [NumberField L'] -- [Algebra K K'] [Algebra K L] [Algebra K L'] -- [Algebra K' L'] [Algebra L L'] -- [IsScalarTower K K' L'] [IsScalarTower K L L'] -- --/-- A compatible common embedding reverses the inclusion of the two base --fields into an inclusion of their fixing subgroups. -/ --theorem numberFieldEmbeddedBaseSubgroup_le_of_tower -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ L L') -- (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup ≤ -- (numberFieldEmbeddedBaseSubgroup K L jLower).toSubgroup := by -- dsimp only -- change -- (numberFieldEmbeddedLowerEmbedding K' L' j).fieldRange.fixingSubgroup ≤ -- (numberFieldEmbeddedLowerEmbedding K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).fieldRange.fixingSubgroup -- apply -- (numberFieldEmbeddedLowerEmbedding K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).fieldRange.fixingSubgroup_le -- intro x hx -- rcases hx with ⟨y, rfl⟩ -- refine ⟨algebraMap K K' y, ?_⟩ -- change -- j (algebraMap K' L' (algebraMap K K' y)) = -- j (algebraMap L L' (algebraMap K L y)) -- rw [← IsScalarTower.algebraMap_apply K K' L', -- ← IsScalarTower.algebraMap_apply K L L'] -- --omit [Field K] [NumberField K] -- [Field K'] [NumberField K'] -- [Algebra K K'] [Algebra K L] [Algebra K L'] [Algebra K' L'] -- [IsScalarTower K K' L'] [IsScalarTower K L L'] in --/-- A compatible common embedding reverses the inclusion of the two top --fields into an inclusion of their fixing subgroups. -/ --theorem numberFieldEmbeddedTopSubgroup_le_of_tower -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ L L') -- (numberFieldEmbeddedTopSubgroup K' L' j).toSubgroup ≤ -- (numberFieldEmbeddedTopSubgroup K L jLower).toSubgroup := by -- dsimp only -- change -- j.fieldRange.fixingSubgroup ≤ -- (j.comp -- (IsScalarTower.toAlgHom ℚ L L')).fieldRange.fixingSubgroup -- apply -- (j.comp -- (IsScalarTower.toAlgHom ℚ L L')).fieldRange.fixingSubgroup_le -- intro x hx -- rcases hx with ⟨y, rfl⟩ -- exact ⟨algebraMap L L' y, rfl⟩ -- --end EmbeddedNumberFieldRestriction -- - variable - (K : FiniteAbstractField - (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) - (L : FiniteAbelianSubextension K.field) - --local instance abstractFixedFieldBaseQuotientFinite : -- Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- K.field (le_baseField K.field)) := -- K.finite -- --local instance abstractFixedFieldRelativeQuotientFinite : -- Finite -- (K.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup K.field L.field L.below) := -- L.finite -- --local instance abstractFixedFieldRelativeQuotientIsMulCommutative : -- IsMulCommutative L.extensionQuotient := -- L.commutative - --noncomputable local instance abstractFixedFieldFiniteDimensional : -- FiniteDimensional ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) := -- abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) K.field K.finite -- --noncomputable local instance abstractRelativeFixedFieldFiniteDimensional : -- FiniteDimensional -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) := -- abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) -- K.field L.field L.below K.finite L.finite -- --local instance abstractFixedFieldRelativeScalarTower : -- IsScalarTower ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) := -- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -- --noncomputable local instance abstractRelativeFixedFieldAbsoluteFiniteDimensional : -- FiniteDimensional ℚ -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) := -- FiniteDimensional.trans ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) -- --noncomputable local instance abstractFixedFieldNumberField : -- NumberField -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) := -- NumberField.of_module_finite ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -- --/-- The lower fixed idèle-class group is commutative. Naming the mixin --before the public quotient declarations avoids delayed normality synthesis --inside their definition bodies. -/ --local instance -- abstractFixedFieldIdeleClassGroupIsMulCommutative : -- IsMulCommutative -- (IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field)) := -- ⟨⟨fun a b => mul_comm a b⟩⟩ -- --noncomputable local instance abstractRelativeFixedFieldNumberField : -- NumberField -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) := -- NumberField.of_module_finite ℚ -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) -- --/-- Use the same explicit Galois witness as the fixed-field quotient --comparison. Deriving it through `IsAbelianGalois` produces an equivalent --but much larger dependent instance path. -/ --noncomputable local instance -- abstractRelativeFixedFieldIsGalois : -- IsGalois -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) := -- abstractRelativeFixedField_isGalois -- ℚ (SeparableClosure ℚ) -- K.field L.field L.below L.normal -- --noncomputable local instance abstractRelativeFixedFieldIsAbelianGalois : -- IsAbelianGalois -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) := -- finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois L -- --/-- Use one opaque normality witness for the actual fixed-field norm range. --This keeps every occurrence of its quotient group on the same instance path. -/ --local instance -- abstractFixedFieldIdeleClassNormRangeNormal : -- ((_root_.ideleClassNorm -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below)).range).Normal := by -- infer_instance -- --/-- The abelianized abstract extension quotient is the actual Galois --group of the corresponding pair of fixed fields. -/ --noncomputable def -- abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below -- Additive -- (Abelianization -- (FiniteGaloisSubextension.extensionQuotient -- L.toFiniteGaloisExtension)) ≃+ -- Additive (Gal(E / F)) := by -- dsimp only -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below -- let e : -- L.extensionQuotient ≃* -- Gal(E / F) := -- L.extensionQuotientMulEquiv.trans -- (abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) -- K.field L.field L.below L.normal) -- exact -- MulEquiv.toAdditive -- ((Abelianization.equivOfComm : -- L.extensionQuotient ≃* -- Abelianization L.extensionQuotient).symm.trans e) -- --/-- The actual fixed-field global norm-residue equivalence -- --`C_F / N_{E/F} C_E ≃ Gal(E/F)` -- --attached to an abstract finite abelian subextension in the rational --absolute class formation. -/ --noncomputable def abstractFixedFieldGlobalNormResidueEquiv : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below -- Additive -- (IdeleClassGroup F ⧸ -- (_root_.ideleClassNorm F E).range) ≃+ -- Additive (Gal(E / F)) := by -- dsimp only -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below -- let eNorm : -- FiniteNormQuotient rationalIdeleClassRepresentation -- K.field L.field L.below ≃+ -- Additive -- (Abelianization L.toFiniteGaloisExtension.extensionQuotient) := -- rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- K L.toFiniteGaloisExtension -- exact -- (rationalFiniteNormQuotientEquivIdeleClassNormQuotient -- K.field L.field L.below L.normal).symm.trans -- (eNorm.trans -- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup -- K L)) -- --/-- The abstract finite norm-residue equivalence with its dependent source --instance fixed to the public finite norm quotient. -/ --private noncomputable def abstractFixedFieldFiniteNormResidueGaloisEquiv : -- FiniteNormQuotient rationalIdeleClassRepresentation -- K.field L.field L.below ≃+ -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field))) := by -- letI : AddCommGroup -- (FiniteNormQuotient rationalIdeleClassRepresentation -- K.field L.field L.below) := -- finiteNormQuotientAddCommGroup rationalIdeleClassRepresentation -- K.field L.field L.below -- exact -- @AddEquiv.trans -- (FiniteNormQuotient rationalIdeleClassRepresentation -- K.field L.field L.below) -- (Additive -- (Abelianization -- L.toFiniteGaloisExtension.extensionQuotient)) -- (Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) K.field)))) -- inferInstance inferInstance inferInstance -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- K L.toFiniteGaloisExtension) -- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup -- K L) -- --/-- The abstract norm-residue symbol on the fixed part of the rational --absolute idele-class representation, with its value transported to the --actual Galois group of the two fixed fields. This is the form consumed --directly by the abstract norm--restriction naturality theorem. -/ --noncomputable def ambientFixedGlobalNormResidueAddMonoidHom : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below -- ambientFixedAddSubgroup -- rationalIdeleClassRepresentation K.field →+ -- Additive (Gal(E / F)) := by -- dsimp only -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below -- exact -- (abstractFixedFieldFiniteNormResidueGaloisEquiv K L).toAddMonoidHom.comp -- (finiteNormClassHom rationalIdeleClassRepresentation -- K.field L.field L.below) -- --/-- The ordinary idele class group of the lower fixed field, transported --to the fixed part of the rational absolute idele-class representation. -/ --private noncomputable def abstractFixedFieldIdeleClassToAmbientFixedMonoidHom : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- IdeleClassGroup F →* -- Multiplicative -- (ambientFixedAddSubgroup -- rationalIdeleClassRepresentation K.field) := -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- K.field).toAddMonoidHom.toMultiplicativeRight -- --/-- The actual norm-residue homomorphism on the ordinary idele class --group of the lower fixed field, constructed without choosing a second --field embedding. -/ --noncomputable def abstractFixedFieldGlobalNormResidueMonoidHom : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) L.below -- IdeleClassGroup F →* Gal(E / F) := -- (ambientFixedGlobalNormResidueAddMonoidHom K L).toMultiplicative.comp -- (abstractFixedFieldIdeleClassToAmbientFixedMonoidHom K) -- --/-- Pointwise form of the ambient fixed-part norm-residue homomorphism. -/ --private theorem ambientFixedGlobalNormResidueAddMonoidHom_apply -- (a : -- ambientFixedAddSubgroup -- rationalIdeleClassRepresentation K.field) : -- ambientFixedGlobalNormResidueAddMonoidHom K L a = -- abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup -- K L -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- K L.toFiniteGaloisExtension -- (finiteNormClass rationalIdeleClassRepresentation -- K.field L.field L.below a)) := by -- change -- abstractFixedFieldFiniteNormResidueGaloisEquiv K L -- (finiteNormClass rationalIdeleClassRepresentation -- K.field L.field L.below a) = _ -- rfl -- --/-- Pointwise form of the transported fixed-field norm-residue homomorphism. -/ --private theorem abstractFixedFieldGlobalNormResidueMonoidHom_apply : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) K.field -- ∀ c : IdeleClassGroup F, -- abstractFixedFieldGlobalNormResidueMonoidHom K L c = -- Additive.toMul -- (ambientFixedGlobalNormResidueAddMonoidHom K L -- ((rationalAbstractFixedFieldIdeleClassEquivFixed K.field) -- (Additive.ofMul c))) := by -- dsimp only -- intro c -- rfl -- --/-- Transporting an ordinary fixed-field idele class to the ambient --fixed part and applying the abstract norm-residue map gives exactly the --actual fixed-field norm-residue value. -/ --@[simp] --theorem abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply -- (a : -- ambientFixedAddSubgroup -- rationalIdeleClassRepresentation K.field) : -- abstractFixedFieldGlobalNormResidueMonoidHom K L -- (Additive.toMul -- ((rationalAbstractFixedFieldIdeleClassEquivFixed -- K.field).symm a)) = -- Additive.toMul -- (ambientFixedGlobalNormResidueAddMonoidHom K L a) := by -- rw [abstractFixedFieldGlobalNormResidueMonoidHom_apply] -- change -- Additive.toMul -- (ambientFixedGlobalNormResidueAddMonoidHom K L -- ((rationalAbstractFixedFieldIdeleClassEquivFixed K.field) -- ((rationalAbstractFixedFieldIdeleClassEquivFixed -- K.field).symm a))) = -- Additive.toMul -- (ambientFixedGlobalNormResidueAddMonoidHom K L a) -- rw [(rationalAbstractFixedFieldIdeleClassEquivFixed -- K.field).apply_symm_apply] -+attribute [local instance] -+ abstractFixedFieldBaseQuotientFinite -+ abstractFixedFieldRelativeQuotientFinite -+ abstractFixedFieldRelativeQuotientIsMulCommutative -+ abstractFixedFieldFiniteDimensional -+ abstractRelativeFixedFieldFiniteDimensional -+ abstractFixedFieldRelativeScalarTower -+ abstractRelativeFixedFieldAbsoluteFiniteDimensional -+ abstractFixedFieldNumberField -+ abstractFixedFieldIdeleClassGroupIsMulCommutative -+ abstractRelativeFixedFieldNumberField -+ abstractRelativeFixedFieldIsGalois -+ abstractRelativeFixedFieldIsAbelianGalois -+ abstractFixedFieldIdeleClassNormRangeNormal - - /-- The ambient fixed-part reciprocity value vanishes precisely when its - finite norm class vanishes. -/ -@@ -1644,8 +197,7 @@ theorem abstractFixedFieldGlobalNormResidueMonoidHom_surjective : - rw [abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply, ha] - rfl - --/-- The kernel of the fixed-field global norm-residue homomorphism is --the genuine ordinary idele-class norm range. -/ -+ - @[simp] - theorem abstractFixedFieldGlobalNormResidueMonoidHom_ker : - (abstractFixedFieldGlobalNormResidueMonoidHom K L).ker = -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddedReciprocity.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddedReciprocity.lean -new file mode 100644 -index 0000000..c07e4ec ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddedReciprocity.lean -@@ -0,0 +1,386 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidueNormClasses -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+section EmbeddedNumberFieldRealization -+ -+variable -+ (K L : Type) [Field K] [NumberField K] -+ [Field L] [NumberField L] [Algebra K L] -+ -+ -+attribute [local instance] -+ numberFieldEmbeddedIdeleClassGroupIsMulCommutative -+ numberFieldEmbeddedIdeleClassSubgroupNormal -+ numberFieldEmbeddedExtensionSubgroupNormal -+ numberFieldEmbeddedExtensionQuotientFinite -+ numberFieldEmbeddedAbsoluteQuotientFinite -+ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional -+ numberFieldEmbeddedAbstractRelativeFixedFieldFiniteDimensional -+ numberFieldEmbeddedAbstractFixedFieldScalarTower -+ numberFieldEmbeddedAbstractRelativeFixedFieldAbsoluteFiniteDimensional -+ numberFieldEmbeddedAbstractFixedFieldNumberField -+ numberFieldEmbeddedAbstractRelativeFixedFieldNumberField -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsFiniteDimensional -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsNumberField -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsAlgebra -+ numberFieldEmbeddedAbstractRelativeFixedFieldIsGalois -+ -+variable [FiniteDimensional K L] [IsAbelianGalois K L] -+ -+/-- The abelianized quotient of the explicitly embedded tower is the -+actual abelian Galois group. -/ -+noncomputable def -+ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ Additive -+ (Abelianization -+ (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient) ≃+ -+ Additive Gal(L / K) := -+ MulEquiv.toAdditive -+ ((MulEquiv.abelianizationCongr -+ (numberFieldEmbeddedExtensionQuotientEquivGaloisGroup K L j)).trans -+ (Abelianization.equivOfComm : -+ Gal(L / K) ≃* -+ Abelianization Gal(L / K)).symm) -+ -+/-- The actual global norm-residue equivalence constructed from an -+explicit compatible embedding of a finite abelian number-field -+extension into the rational separable closure. -/ -+noncomputable def globalNormResidueEquivOfEmbedding -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ Additive -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm K L).range) ≃+ -+ Additive Gal(L / K) := by -+ let eNorm : -+ FiniteNormQuotient rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ≃+ -+ Additive -+ (Abelianization -+ (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient) := -+ rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldEmbeddedFiniteAbstractField K L j) -+ (numberFieldEmbeddedFiniteGaloisSubextension K L j) -+ exact -+ (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -+ K L j).symm.trans -+ (eNorm.trans -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L j)) -+ -+/-- The explicit-embedding norm-residue equivalence on a finite norm class. -/ -+theorem globalNormResidueEquivOfEmbedding_finiteNormClass -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (x : FiniteNormQuotient rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) : -+ globalNormResidueEquivOfEmbedding K L j -+ (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -+ K L j x) = -+ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup K L j -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldEmbeddedFiniteAbstractField K L j) -+ (numberFieldEmbeddedFiniteGaloisSubextension K L j) x) := by -+ simp only [globalNormResidueEquivOfEmbedding, AddEquiv.trans_apply, -+ AddEquiv.symm_apply_apply] -+ -+/-- The global norm-residue homomorphism obtained from an explicit -+compatible embedding. -/ -+noncomputable def globalNormResidueMonoidHomOfEmbedding -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ IdeleClassGroup K →* Gal(L / K) := by -+ let e : -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm K L).range) ≃* -+ Gal(L / K) := -+ AddEquiv.toMultiplicative -+ (globalNormResidueEquivOfEmbedding K L j) -+ exact -+ e.toMonoidHom.comp -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm K L).range) -+ -+/-- Evaluation of the explicit-embedding global norm-residue map is -+the abstract norm-residue symbol evaluated on the corresponding genuine -+fixed-part finite norm class. -/ -+@[simp] -+theorem globalNormResidueMonoidHomOfEmbedding_apply -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (c : IdeleClassGroup K) : -+ globalNormResidueMonoidHomOfEmbedding K L j c = -+ Additive.toMul -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L j -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldEmbeddedFiniteAbstractField K L j) -+ (numberFieldEmbeddedFiniteGaloisSubextension K L j) -+ (finiteNormClass rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K L j (Additive.ofMul c))))) := by -+ have hclass := -+ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass -+ K L j c -+ change -+ Additive.toMul -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L j -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldEmbeddedFiniteAbstractField K L j) -+ (numberFieldEmbeddedFiniteGaloisSubextension K L j) -+ ((numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -+ K L j).symm -+ (Additive.ofMul -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm K L).range c))))) = -+ _ -+ rw [← hclass, -+ (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -+ K L j).symm_apply_apply] -+ -+omit [FiniteDimensional K L] [IsAbelianGalois K L] in -+ -+ -+theorem numberFieldTowerIdeleClassEquivAmbientFixed_eq_embedded_standard : -+ numberFieldTowerIdeleClassEquivAmbientFixed K L = -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed K L -+ (numberFieldSeparableClosureEmbedding L) := by -+ let j := numberFieldSeparableClosureEmbedding L -+ have hBase : -+ numberFieldTowerAbstractBaseFieldEquiv K L = -+ numberFieldEmbeddedAbstractBaseFieldEquiv K L j := by -+ rfl -+ unfold numberFieldTowerIdeleClassEquivAmbientFixed -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ rw [hBase] -+ dsimp only -+ congr 1 -+ -+/- At the chosen embedding, both constructions use the same fixed tower and -+abstract reciprocity data. We compare their values on the particular fixed -+idele class needed below; the two implementations of the finite norm-quotient -+equivalence are deliberately not compared as dependent structures. -/ -+private theorem numberFieldTowerNormResidueValue_eq_embedded_standard -+ (c : IdeleClassGroup K) : -+ numberFieldTowerAbelianizedExtensionQuotientEquivGaloisGroup K L -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldTowerReciprocityFiniteAbstractField K L) -+ (numberFieldTowerFiniteGaloisSubextension K L) -+ (finiteNormClass rationalIdeleClassRepresentation -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) -+ (numberFieldTowerIdeleClassEquivAmbientFixed K L (Additive.ofMul c)))) = -+ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L (numberFieldSeparableClosureEmbedding L) -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldEmbeddedFiniteAbstractField K L -+ (numberFieldSeparableClosureEmbedding L)) -+ (numberFieldEmbeddedFiniteGaloisSubextension K L -+ (numberFieldSeparableClosureEmbedding L)) -+ (finiteNormClass rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L -+ (numberFieldSeparableClosureEmbedding L)) -+ (numberFieldEmbeddedTopSubgroup K L -+ (numberFieldSeparableClosureEmbedding L)) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L -+ (numberFieldSeparableClosureEmbedding L)) -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed K L -+ (numberFieldSeparableClosureEmbedding L) (Additive.ofMul c)))) := by -+ have hIdeleClassEquiv : -+ numberFieldTowerIdeleClassEquivAmbientFixed K L = -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed K L -+ (numberFieldSeparableClosureEmbedding L) := by -+ exact numberFieldTowerIdeleClassEquivAmbientFixed_eq_embedded_standard K L -+ have hFiniteAbstractField : -+ numberFieldTowerReciprocityFiniteAbstractField K L = -+ numberFieldEmbeddedFiniteAbstractField K L -+ (numberFieldSeparableClosureEmbedding L) := by -+ rfl -+ have hSubextension : -+ numberFieldTowerFiniteGaloisSubextension K L = -+ numberFieldEmbeddedFiniteGaloisSubextension K L -+ (numberFieldSeparableClosureEmbedding L) := by -+ rfl -+ have hGaloisComparison : -+ numberFieldTowerAbelianizedExtensionQuotientEquivGaloisGroup K L = -+ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L (numberFieldSeparableClosureEmbedding L) := by -+ rfl -+ simp only [← hGaloisComparison] -+ cases hFiniteAbstractField -+ cases hSubextension -+ rw [← hIdeleClassEquiv] -+ rfl -+ -+/-- At the standard embedding, the two global norm-residue equivalences -+agree on the actual norm quotient. The comparison is extensional: it uses -+surjectivity of the quotient map and the established evaluation formulas, -+not definitional equality of the two quotient constructions. -/ -+theorem globalNormResidueEquiv_eq_ofEmbedding_standard : -+ globalNormResidueEquiv K L = -+ globalNormResidueEquivOfEmbedding K L -+ (numberFieldSeparableClosureEmbedding L) := by -+ apply AddEquiv.ext -+ intro q -+ obtain ⟨c, hc⟩ := -+ QuotientGroup.mk'_surjective -+ (_root_.ideleClassNorm K L).range (Additive.toMul q) -+ have hq : -+ Additive.ofMul -+ (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c) = q := -+ Additive.toMul.injective hc -+ rw [← hq] -+ have hTower := -+ numberFieldTowerFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass -+ K L c -+ have hEmbedded := -+ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass -+ K L (numberFieldSeparableClosureEmbedding L) c -+ conv_lhs => -+ rw [← hTower, globalNormResidueEquiv_finiteNormClass] -+ conv_rhs => -+ rw [← hEmbedded, globalNormResidueEquivOfEmbedding_finiteNormClass] -+ exact numberFieldTowerNormResidueValue_eq_embedded_standard K L c -+ -+/-- The existing global norm-residue map is the explicit-embedding -+construction for the standard chosen embedding of the top field. -/ -+theorem globalNormResidueMonoidHom_eq_ofEmbedding_standard : -+ globalNormResidueMonoidHom K L = -+ globalNormResidueMonoidHomOfEmbedding K L -+ (numberFieldSeparableClosureEmbedding L) := by -+ apply MonoidHom.ext -+ intro c -+ apply Additive.toMul.injective -+ change -+ globalNormResidueEquiv K L -+ (Additive.ofMul -+ (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c)) = -+ globalNormResidueEquivOfEmbedding K L -+ (numberFieldSeparableClosureEmbedding L) -+ (Additive.ofMul -+ (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c)) -+ exact congrArg -+ (fun e : -+ Additive -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm K L).range) ≃+ -+ Additive (Gal(L / K)) => -+ e (Additive.ofMul -+ (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c))) -+ (globalNormResidueEquiv_eq_ofEmbedding_standard K L) -+ -+end EmbeddedNumberFieldRealization -+ -+section EmbeddedNumberFieldRestriction -+ -+variable -+ (K K' L L' : Type) -+ [Field K] [NumberField K] -+ [Field K'] [NumberField K'] -+ [Field L] [NumberField L] -+ [Field L'] [NumberField L'] -+ [Algebra K K'] [Algebra K L] [Algebra K L'] -+ [Algebra K' L'] [Algebra L L'] -+ [IsScalarTower K K' L'] [IsScalarTower K L L'] -+ -+/-- A compatible common embedding reverses the inclusion of the two base -+fields into an inclusion of their fixing subgroups. -/ -+theorem numberFieldEmbeddedBaseSubgroup_le_of_tower -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ L L') -+ (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup ≤ -+ (numberFieldEmbeddedBaseSubgroup K L jLower).toSubgroup := by -+ dsimp only -+ change -+ (numberFieldEmbeddedLowerEmbedding K' L' j).fieldRange.fixingSubgroup ≤ -+ (numberFieldEmbeddedLowerEmbedding K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).fieldRange.fixingSubgroup -+ apply -+ (numberFieldEmbeddedLowerEmbedding K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).fieldRange.fixingSubgroup_le -+ intro x hx -+ rcases hx with ⟨y, rfl⟩ -+ refine ⟨algebraMap K K' y, ?_⟩ -+ change -+ j (algebraMap K' L' (algebraMap K K' y)) = -+ j (algebraMap L L' (algebraMap K L y)) -+ rw [← IsScalarTower.algebraMap_apply K K' L', -+ ← IsScalarTower.algebraMap_apply K L L'] -+ -+omit [Field K] [NumberField K] -+ [Field K'] [NumberField K'] -+ [Algebra K K'] [Algebra K L] [Algebra K L'] [Algebra K' L'] -+ [IsScalarTower K K' L'] [IsScalarTower K L L'] in -+/-- A compatible common embedding reverses the inclusion of the two top -+fields into an inclusion of their fixing subgroups. -/ -+theorem numberFieldEmbeddedTopSubgroup_le_of_tower -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ L L') -+ (numberFieldEmbeddedTopSubgroup K' L' j).toSubgroup ≤ -+ (numberFieldEmbeddedTopSubgroup K L jLower).toSubgroup := by -+ dsimp only -+ change -+ j.fieldRange.fixingSubgroup ≤ -+ (j.comp -+ (IsScalarTower.toAlgHom ℚ L L')).fieldRange.fixingSubgroup -+ apply -+ (j.comp -+ (IsScalarTower.toAlgHom ℚ L L')).fieldRange.fixingSubgroup_le -+ intro x hx -+ rcases hx with ⟨y, rfl⟩ -+ exact ⟨algebraMap L L' y, rfl⟩ -+ -+end EmbeddedNumberFieldRestriction -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddings.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddings.lean -new file mode 100644 -index 0000000..2451e8f ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddings.lean -@@ -0,0 +1,586 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidue -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+/-- The algebra structure on the rational separable closure induced by a -+specified rational field embedding. It is deliberately not an instance: -+different embeddings of the same field need not induce definitionally equal -+algebra structures. -/ -+@[reducible] -+noncomputable def rationalEmbeddingSeparableClosureAlgebra -+ {F : Type} [Field F] [Algebra ℚ F] -+ (i : F →ₐ[ℚ] SeparableClosure ℚ) : -+ Algebra F (SeparableClosure ℚ) := -+ i.toRingHom.toAlgebra -+ -+/-- Two rational embeddings of the same number field into the fixed -+rational separable closure differ by an automorphism of that -+separable closure. -/ -+theorem exists_numberFieldEmbeddingComparisonAutomorphism -+ {F : Type} [Field F] [NumberField F] -+ (i j : F →ₐ[ℚ] SeparableClosure ℚ) : -+ ∃ σ : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ, -+ ∀ x : F, σ (i x) = j x := by -+ let hAlgebra : Algebra F (SeparableClosure ℚ) := -+ rationalEmbeddingSeparableClosureAlgebra i -+ let hScalarTower : IsScalarTower ℚ F (SeparableClosure ℚ) := -+ IsScalarTower.of_algebraMap_eq' i.comp_algebraMap.symm -+ let hSeparable : Algebra.IsSeparable F (SeparableClosure ℚ) := -+ Algebra.isSeparable_tower_top_of_isSeparable -+ ℚ F (SeparableClosure ℚ) -+ obtain ⟨φ, hφ⟩ := -+ (IsSepClosed.surjective_domRestrict_of_isSeparable -+ (K := ℚ) (L := F) -+ (M := SeparableClosure ℚ) -+ (E := SeparableClosure ℚ)) j -+ let σ : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := -+ AlgEquiv.ofBijective φ -+ (Normal.toIsAlgebraic.algHom_bijective₂ -+ φ (AlgHom.id ℚ (SeparableClosure ℚ))).1 -+ refine ⟨σ, ?_⟩ -+ intro x -+ have hx := -+ congrArg (fun ψ : F →ₐ[ℚ] SeparableClosure ℚ => ψ x) hφ -+ exact hx -+ -+/-- The canonical comparison automorphism between two rational -+embeddings of one number field into the fixed separable closure. -/ -+noncomputable def numberFieldEmbeddingComparisonAutomorphism -+ {F : Type} [Field F] [NumberField F] -+ (i j : F →ₐ[ℚ] SeparableClosure ℚ) : -+ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := -+ Classical.choose -+ (exists_numberFieldEmbeddingComparisonAutomorphism i j) -+ -+/-- The comparison automorphism carries the first embedded copy of the -+number field to the second one pointwise. -/ -+@[simp] -+theorem numberFieldEmbeddingComparisonAutomorphism_apply -+ {F : Type} [Field F] [NumberField F] -+ (i j : F →ₐ[ℚ] SeparableClosure ℚ) -+ (x : F) : -+ numberFieldEmbeddingComparisonAutomorphism i j (i x) = -+ j x := -+ Classical.choose_spec -+ (exists_numberFieldEmbeddingComparisonAutomorphism i j) x -+ -+/-- Conjugating the fixing subgroup of one embedded copy of a number -+field by the comparison automorphism gives the fixing subgroup of the -+other embedded copy. -/ -+theorem conjugateClosedFixingSubgroup_embeddingRange -+ {F : Type} [Field F] [NumberField F] -+ (i j : F →ₐ[ℚ] SeparableClosure ℚ) : -+ conjugateClosedSubgroup -+ (RamificationTheory.closedFixingSubgroup -+ ℚ (SeparableClosure ℚ) i.fieldRange) -+ (numberFieldEmbeddingComparisonAutomorphism j i) = -+ RamificationTheory.closedFixingSubgroup -+ ℚ (SeparableClosure ℚ) j.fieldRange := by -+ let s := -+ numberFieldEmbeddingComparisonAutomorphism j i -+ ext τ -+ change -+ τ ∈ conjugateClosedSubgroup -+ (closedFixingSubgroup ℚ (SeparableClosure ℚ) i.fieldRange) s ↔ -+ τ ∈ closedFixingSubgroup ℚ (SeparableClosure ℚ) j.fieldRange -+ rw [conjugateClosedSubgroup_mem] -+ change -+ s * τ * s⁻¹ ∈ i.fieldRange.fixingSubgroup ↔ -+ τ ∈ j.fieldRange.fixingSubgroup -+ rw [IntermediateField.mem_fixingSubgroup_iff, -+ IntermediateField.mem_fixingSubgroup_iff] -+ constructor -+ · intro h x hx -+ rcases hx with ⟨y, rfl⟩ -+ have hi := h (i y) ⟨y, rfl⟩ -+ have hs : -+ s (j y) = i y := -+ numberFieldEmbeddingComparisonAutomorphism_apply j i y -+ change s (τ (s.symm (i y))) = i y at hi -+ have hpre : s.symm (i y) = j y := by -+ rw [← hs, s.symm_apply_apply] -+ rw [hpre, ← hs] at hi -+ exact s.injective hi -+ · intro h x hx -+ rcases hx with ⟨y, rfl⟩ -+ have hj := h (j y) ⟨y, rfl⟩ -+ have hs : -+ s (j y) = i y := -+ numberFieldEmbeddingComparisonAutomorphism_apply j i y -+ change s (τ (s.symm (i y))) = i y -+ have hpre : s.symm (i y) = j y := by -+ rw [← hs, s.symm_apply_apply] -+ rw [hpre, hj, hs] -+ -+section EmbeddedNumberFieldRealization -+ -+local instance numberFieldEmbeddedIdeleClassGroupIsMulCommutative -+ {F : Type} [Field F] [NumberField F] -+ : IsMulCommutative (IdeleClassGroup F) := -+ ⟨⟨fun a b => mul_comm a b⟩⟩ -+ -+local instance numberFieldEmbeddedIdeleClassSubgroupNormal -+ {F : Type} [Field F] [NumberField F] -+ (N : Subgroup (IdeleClassGroup F)) : N.Normal := -+ N.normal_of_isMulCommutative -+ -+variable -+ (K L : Type) [Field K] [NumberField K] -+ [Field L] [NumberField L] [Algebra K L] -+ -+/-- The lower embedding obtained by restricting an explicitly supplied -+embedding of the top field into the rational separable closure. -/ -+noncomputable def numberFieldEmbeddedLowerEmbedding -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ K →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ K L) -+ -+/-- The exact algebra structure on the rational separable closure induced by -+the lower embedding of an explicitly embedded number-field tower. Keeping -+this as a reducible definition lets every use of the associated separable- -+closure equivalence share one definitionally identical algebra structure. -/ -+@[reducible] -+noncomputable def numberFieldEmbeddedSeparableClosureAlgebra -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ Algebra K (SeparableClosure ℚ) := -+ rationalEmbeddingSeparableClosureAlgebra -+ (numberFieldEmbeddedLowerEmbedding K L j) -+ -+/-- The fixing subgroup of the explicitly embedded lower field. -/ -+abbrev numberFieldEmbeddedBaseSubgroup -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ ClosedSubgroup -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedLowerEmbedding K L j).fieldRange -+ -+/-- The fixing subgroup of the explicitly embedded top field. -/ -+abbrev numberFieldEmbeddedTopSubgroup -+ (_K L : Type) [Field L] [NumberField L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ ClosedSubgroup -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) j.fieldRange -+ -+/-- The top fixing subgroup lies in the lower fixing subgroup. -/ -+theorem numberFieldEmbeddedTopSubgroup_le_baseSubgroup -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ (numberFieldEmbeddedTopSubgroup K L j).toSubgroup ≤ -+ (numberFieldEmbeddedBaseSubgroup K L j).toSubgroup := by -+ change -+ j.fieldRange.fixingSubgroup ≤ -+ (numberFieldEmbeddedLowerEmbedding K L j).fieldRange.fixingSubgroup -+ apply -+ (numberFieldEmbeddedLowerEmbedding K L j).fieldRange.fixingSubgroup_le -+ intro x hx -+ rcases hx with ⟨y, rfl⟩ -+ exact ⟨algebraMap K L y, rfl⟩ -+ -+/-- The separable closure of the actual lower field, identified with -+the rational separable closure carrying the algebra structure induced -+by an explicit compatible embedding. -/ -+noncomputable def numberFieldEmbeddedSeparableClosureEquiv -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ letI : Algebra K (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra K L j -+ SeparableClosure K ≃ₐ[K] SeparableClosure ℚ := by -+ letI : Algebra K (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra K L j -+ letI hScalarTower : IsScalarTower ℚ K (SeparableClosure ℚ) := -+ IsScalarTower.of_algebraMap_eq' -+ (numberFieldEmbeddedLowerEmbedding K L j).comp_algebraMap.symm -+ letI hseparable : Algebra.IsSeparable K (SeparableClosure ℚ) := -+ Algebra.isSeparable_tower_top_of_isSeparable -+ ℚ K (SeparableClosure ℚ) -+ letI hSepClosure : IsSepClosure K (SeparableClosure ℚ) := -+ ⟨IsSepClosure.sep_closed ℚ, hseparable⟩ -+ exact -+ IsSepClosure.equiv K -+ (SeparableClosure K) (SeparableClosure ℚ) -+ -+/-- The relative subgroup arising from an explicit compatible -+number-field embedding is normal. -/ -+theorem numberFieldEmbeddedExtensionSubgroup_normal -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).Normal := by -+ let i := numberFieldEmbeddedLowerEmbedding K L j -+ let hAlgebra : Algebra K (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra K L j -+ let e := numberFieldEmbeddedSeparableClosureEquiv K L j -+ change -+ (CyclicCohomology.extensionSubgroup -+ (closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange i)) -+ (closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange j)) _).Normal -+ exact ambientEmbeddedExtensionSubgroup_normal ℚ K L j e -+ -+/-- The normality witness for an explicitly embedded tower, registered at -+the precise subgroup used by the downstream quotient constructions. -/ -+noncomputable local instance -+ numberFieldEmbeddedExtensionSubgroupNormal -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal K L j -+ -+/-- The relative quotient arising from an explicit compatible -+number-field embedding is finite. -/ -+theorem numberFieldEmbeddedExtensionQuotient_finite -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ Finite -+ ((numberFieldEmbeddedBaseSubgroup K L j).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := by -+ let i := numberFieldEmbeddedLowerEmbedding K L j -+ let hAlgebra : Algebra K (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra K L j -+ let e := numberFieldEmbeddedSeparableClosureEquiv K L j -+ change -+ Finite -+ ((closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange i)).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange i)) -+ (closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange j)) _) -+ exact ambientEmbeddedExtensionQuotient_finite ℚ K L j e -+ -+/-- The relative-index witness for an explicitly embedded tower, registered -+at the exact quotient consumed by `FiniteNormQuotient`. -/ -+noncomputable local instance -+ numberFieldEmbeddedExtensionQuotientFinite -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ Finite -+ ((numberFieldEmbeddedBaseSubgroup K L j).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -+ numberFieldEmbeddedExtensionQuotient_finite K L j -+ -+/-- The finite abstract field determined by the lower member of an -+explicitly embedded number-field tower. -/ -+noncomputable abbrev numberFieldEmbeddedFiniteAbstractField -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) where -+ field := numberFieldEmbeddedBaseSubgroup K L j -+ finite := by -+ simpa only [numberFieldEmbeddedBaseSubgroup] using -+ (ambientEmbeddedAbsoluteQuotientFinite -+ ℚ K (numberFieldEmbeddedLowerEmbedding K L j)) -+ -+/-- The absolute-index witness for the lower member of an explicitly embedded -+tower, registered at its specialized quotient type. -/ -+noncomputable local instance -+ numberFieldEmbeddedAbsoluteQuotientFinite -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (le_baseField -+ (numberFieldEmbeddedBaseSubgroup K L j))) := -+ (numberFieldEmbeddedFiniteAbstractField K L j).finite -+ -+/-- The finite Galois subextension determined by an explicitly embedded -+number-field tower. -/ -+noncomputable abbrev numberFieldEmbeddedFiniteGaloisSubextension -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteGaloisSubextension -+ (numberFieldEmbeddedBaseSubgroup K L j) where -+ field := numberFieldEmbeddedTopSubgroup K L j -+ below := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -+ normal := numberFieldEmbeddedExtensionSubgroup_normal K L j -+ finite := numberFieldEmbeddedExtensionQuotient_finite K L j -+ -+/-- Shared finite-dimensional data for the fixed field of the lower subgroup -+in an explicitly embedded number-field tower. -/ -+noncomputable local instance -+ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteDimensional ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) := -+ abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedAbsoluteQuotientFinite K L j) -+ -+/-- Shared relative finite-dimensional data for the two fixed fields of an -+explicitly embedded number-field tower. -/ -+noncomputable local instance -+ numberFieldEmbeddedAbstractRelativeFixedFieldFiniteDimensional -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteDimensional -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -+ abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -+ (numberFieldEmbeddedAbsoluteQuotientFinite K L j) -+ (numberFieldEmbeddedExtensionQuotientFinite K L j) -+ -+local instance numberFieldEmbeddedAbstractFixedFieldScalarTower -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ IsScalarTower ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -+ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -+ -+noncomputable local instance -+ numberFieldEmbeddedAbstractRelativeFixedFieldAbsoluteFiniteDimensional -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteDimensional ℚ -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -+ FiniteDimensional.trans ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) -+ -+noncomputable local instance -+ numberFieldEmbeddedAbstractFixedFieldNumberField -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ NumberField -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) := -+ NumberField.of_module_finite ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) -+ -+noncomputable local instance -+ numberFieldEmbeddedAbstractRelativeFixedFieldNumberField -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ NumberField -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -+ NumberField.of_module_finite ℚ -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) -+ -+noncomputable local instance -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsFiniteDimensional -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteDimensional ℚ -+ ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := by -+ change FiniteDimensional ℚ -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) -+ infer_instance -+ -+noncomputable local instance -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsNumberField -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ NumberField -+ ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := -+ NumberField.of_module_finite ℚ _ -+ -+noncomputable local instance -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsAlgebra -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ Algebra -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) -+ ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := -+ (IntermediateField.inclusion -+ (abstractFixedField_le ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j))).toRingHom.toAlgebra -+ -+noncomputable local instance -+ numberFieldEmbeddedAbstractRelativeFixedFieldIsGalois -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ IsGalois -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := -+ abstractRelativeFixedField_isGalois -+ ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -+ (numberFieldEmbeddedExtensionSubgroupNormal K L j) -+ -+/-- The quotient of the two explicitly embedded fixing subgroups is -+the actual relative Galois group. -/ -+noncomputable def -+ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient ≃* -+ Gal(L / K) := by -+ let i := numberFieldEmbeddedLowerEmbedding K L j -+ letI hAlgebra : Algebra K (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra K L j -+ let e := numberFieldEmbeddedSeparableClosureEquiv K L j -+ let H₀ := -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange i) -+ let J₀ := -+ closedFixingSubgroup ℚ (SeparableClosure ℚ) -+ (AlgHom.fieldRange j) -+ let hJH : J₀.toSubgroup ≤ H₀.toSubgroup := by -+ change j.fieldRange.fixingSubgroup ≤ i.fieldRange.fixingSubgroup -+ apply i.fieldRange.fixingSubgroup_le -+ intro x hx -+ rcases hx with ⟨y, rfl⟩ -+ exact ⟨algebraMap K L y, rfl⟩ -+ letI : (CyclicCohomology.extensionSubgroup H₀ J₀ hJH).Normal := -+ ambientEmbeddedExtensionSubgroup_normal ℚ K L j e -+ change -+ (H₀.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H₀ J₀ hJH) ≃* -+ Gal(L / K) -+ exact ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ K L j e -+ -+/-- The original lower field is canonically equivalent to the fixed -+field of its explicitly embedded fixing subgroup. -/ -+noncomputable def numberFieldEmbeddedAbstractBaseFieldEquiv -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ K ≃ₐ[ℚ] -+ abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j) := -+ (numberFieldEmbeddedLowerEmbedding K L j).equivFieldRange.trans -+ (IntermediateField.equivOfEq -+ (InfiniteGalois.fixedField_fixingSubgroup -+ (numberFieldEmbeddedLowerEmbedding K L j).fieldRange).symm) -+ -+/-- The original top field is canonically equivalent to the relative -+fixed field of its explicitly embedded fixing subgroup. -/ -+noncomputable def numberFieldEmbeddedAbstractTopFieldEquiv -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ L ≃ₐ[ℚ] -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup -+ K L j)).restrictScalars ℚ := -+ j.equivFieldRange.trans -+ (IntermediateField.equivOfEq -+ (InfiniteGalois.fixedField_fixingSubgroup j.fieldRange).symm) -+ -+/-- The two explicit fixed-field equivalences commute with the tower -+algebra maps. -/ -+@[simp] -+theorem numberFieldEmbeddedAbstractFieldEquiv_algebraMap -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (x : K) : -+ numberFieldEmbeddedAbstractTopFieldEquiv K L j -+ (algebraMap K L x) = -+ algebraMap -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L j)) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j x) := by -+ apply Subtype.ext -+ rfl -+ -+/-- The ordinary idele class group of the explicitly embedded lower -+field, transported to the fixed part of the rational absolute -+idele-class representation. -/ -+noncomputable def numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ Additive (IdeleClassGroup K) ≃+ -+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j) := by -+ let H := numberFieldEmbeddedBaseSubgroup K L j -+ exact -+ (MulEquiv.toAdditive -+ (ideleClassCongr -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j))).trans -+ (rationalAbstractFixedFieldIdeleClassEquivFixed H) -+ -+/-- The abstract finite norm quotient of an explicitly embedded tower -+is its genuine ordinary idele-class norm quotient. -/ -+noncomputable def -+ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteNormQuotient rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ≃+ -+ Additive -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm K L).range) := by -+ let hnormal := -+ numberFieldEmbeddedExtensionSubgroupNormal K L j -+ let H := numberFieldEmbeddedBaseSubgroup K L j -+ let J := numberFieldEmbeddedTopSubgroup K L j -+ let hJH := -+ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -+ let fixedFieldEquiv := -+ rationalFiniteNormQuotientEquivIdeleClassNormQuotient -+ H J hJH hnormal -+ let actualFieldEquiv := -+ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -+ exact -+ fixedFieldEquiv.trans -+ (MulEquiv.toAdditive actualFieldEquiv.symm) -+ -+ -+end EmbeddedNumberFieldRealization -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueFixedFields.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueFixedFields.lean -new file mode 100644 -index 0000000..7520ff3 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueFixedFields.lean -@@ -0,0 +1,359 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidueEmbeddedReciprocity -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+ -+variable -+ (K : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (L : FiniteAbelianSubextension K.field) -+ -+local instance abstractFixedFieldBaseQuotientFinite : -+ Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ K.field (le_baseField K.field)) := -+ K.finite -+ -+local instance abstractFixedFieldRelativeQuotientFinite : -+ Finite -+ (K.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup K.field L.field L.below) := -+ L.finite -+ -+local instance abstractFixedFieldRelativeQuotientIsMulCommutative : -+ IsMulCommutative L.extensionQuotient := -+ L.commutative -+ -+noncomputable local instance abstractFixedFieldFiniteDimensional : -+ FiniteDimensional ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) := -+ abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) K.field K.finite -+ -+noncomputable local instance abstractRelativeFixedFieldFiniteDimensional : -+ FiniteDimensional -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) := -+ abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) -+ K.field L.field L.below K.finite L.finite -+ -+local instance abstractFixedFieldRelativeScalarTower : -+ IsScalarTower ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) := -+ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -+ -+noncomputable local instance abstractRelativeFixedFieldAbsoluteFiniteDimensional : -+ FiniteDimensional ℚ -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) := -+ FiniteDimensional.trans ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) -+ -+noncomputable local instance abstractFixedFieldNumberField : -+ NumberField -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) := -+ NumberField.of_module_finite ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -+ -+/-- The lower fixed idèle-class group is commutative. Naming the mixin -+before the public quotient declarations avoids delayed normality synthesis -+inside their definition bodies. -/ -+local instance -+ abstractFixedFieldIdeleClassGroupIsMulCommutative : -+ IsMulCommutative -+ (IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field)) := -+ ⟨⟨fun a b => mul_comm a b⟩⟩ -+ -+noncomputable local instance abstractRelativeFixedFieldNumberField : -+ NumberField -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) := -+ NumberField.of_module_finite ℚ -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) -+ -+/-- Use the same explicit Galois witness as the fixed-field quotient -+comparison. Deriving it through `IsAbelianGalois` produces an equivalent -+but much larger dependent instance path. -/ -+noncomputable local instance -+ abstractRelativeFixedFieldIsGalois : -+ IsGalois -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) := -+ abstractRelativeFixedField_isGalois -+ ℚ (SeparableClosure ℚ) -+ K.field L.field L.below L.normal -+ -+noncomputable local instance abstractRelativeFixedFieldIsAbelianGalois : -+ IsAbelianGalois -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) := -+ finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois L -+ -+/-- Use one opaque normality witness for the actual fixed-field norm range. -+This keeps every occurrence of its quotient group on the same instance path. -/ -+local instance -+ abstractFixedFieldIdeleClassNormRangeNormal : -+ ((_root_.ideleClassNorm -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below)).range).Normal := by -+ infer_instance -+ -+/-- The abelianized abstract extension quotient is the actual Galois -+group of the corresponding pair of fixed fields. -/ -+noncomputable def -+ abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below -+ Additive -+ (Abelianization -+ (FiniteGaloisSubextension.extensionQuotient -+ L.toFiniteGaloisExtension)) ≃+ -+ Additive (Gal(E / F)) := by -+ dsimp only -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below -+ let e : -+ L.extensionQuotient ≃* -+ Gal(E / F) := -+ L.extensionQuotientMulEquiv.trans -+ (abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) -+ K.field L.field L.below L.normal) -+ exact -+ MulEquiv.toAdditive -+ ((Abelianization.equivOfComm : -+ L.extensionQuotient ≃* -+ Abelianization L.extensionQuotient).symm.trans e) -+ -+/-- The actual fixed-field global norm-residue equivalence -+ -+`C_F / N_{E/F} C_E ≃ Gal(E/F)` -+ -+attached to an abstract finite abelian subextension in the rational -+absolute class formation. -/ -+noncomputable def abstractFixedFieldGlobalNormResidueEquiv : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below -+ Additive -+ (IdeleClassGroup F ⧸ -+ (_root_.ideleClassNorm F E).range) ≃+ -+ Additive (Gal(E / F)) := by -+ dsimp only -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below -+ let eNorm : -+ FiniteNormQuotient rationalIdeleClassRepresentation -+ K.field L.field L.below ≃+ -+ Additive -+ (Abelianization L.toFiniteGaloisExtension.extensionQuotient) := -+ rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ K L.toFiniteGaloisExtension -+ exact -+ (rationalFiniteNormQuotientEquivIdeleClassNormQuotient -+ K.field L.field L.below L.normal).symm.trans -+ (eNorm.trans -+ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup -+ K L)) -+ -+/-- The abstract finite norm-residue equivalence with its dependent source -+instance fixed to the public finite norm quotient. -/ -+noncomputable def abstractFixedFieldFiniteNormResidueGaloisEquiv : -+ FiniteNormQuotient rationalIdeleClassRepresentation -+ K.field L.field L.below ≃+ -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field))) := by -+ letI : AddCommGroup -+ (FiniteNormQuotient rationalIdeleClassRepresentation -+ K.field L.field L.below) := -+ finiteNormQuotientAddCommGroup rationalIdeleClassRepresentation -+ K.field L.field L.below -+ exact -+ @AddEquiv.trans -+ (FiniteNormQuotient rationalIdeleClassRepresentation -+ K.field L.field L.below) -+ (Additive -+ (Abelianization -+ L.toFiniteGaloisExtension.extensionQuotient)) -+ (Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) K.field)))) -+ inferInstance inferInstance inferInstance -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ K L.toFiniteGaloisExtension) -+ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup -+ K L) -+ -+/-- The abstract norm-residue symbol on the fixed part of the rational -+absolute idele-class representation, with its value transported to the -+actual Galois group of the two fixed fields. This is the form consumed -+directly by the abstract norm--restriction naturality theorem. -/ -+noncomputable def ambientFixedGlobalNormResidueAddMonoidHom : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below -+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation K.field →+ -+ Additive (Gal(E / F)) := by -+ dsimp only -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below -+ exact -+ (abstractFixedFieldFiniteNormResidueGaloisEquiv K L).toAddMonoidHom.comp -+ (finiteNormClassHom rationalIdeleClassRepresentation -+ K.field L.field L.below) -+ -+/-- The ordinary idele class group of the lower fixed field, transported -+to the fixed part of the rational absolute idele-class representation. -/ -+private noncomputable def abstractFixedFieldIdeleClassToAmbientFixedMonoidHom : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ IdeleClassGroup F →* -+ Multiplicative -+ (ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation K.field) := -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ K.field).toAddMonoidHom.toMultiplicativeRight -+ -+/-- The actual norm-residue homomorphism on the ordinary idele class -+group of the lower fixed field, constructed without choosing a second -+field embedding. -/ -+noncomputable def abstractFixedFieldGlobalNormResidueMonoidHom : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) L.below -+ IdeleClassGroup F →* Gal(E / F) := -+ (ambientFixedGlobalNormResidueAddMonoidHom K L).toMultiplicative.comp -+ (abstractFixedFieldIdeleClassToAmbientFixedMonoidHom K) -+ -+/-- Pointwise form of the ambient fixed-part norm-residue homomorphism. -/ -+theorem ambientFixedGlobalNormResidueAddMonoidHom_apply -+ (a : -+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation K.field) : -+ ambientFixedGlobalNormResidueAddMonoidHom K L a = -+ abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup -+ K L -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ K L.toFiniteGaloisExtension -+ (finiteNormClass rationalIdeleClassRepresentation -+ K.field L.field L.below a)) := by -+ change -+ abstractFixedFieldFiniteNormResidueGaloisEquiv K L -+ (finiteNormClass rationalIdeleClassRepresentation -+ K.field L.field L.below a) = _ -+ rfl -+ -+/-- Pointwise form of the transported fixed-field norm-residue homomorphism. -/ -+private theorem abstractFixedFieldGlobalNormResidueMonoidHom_apply : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) K.field -+ ∀ c : IdeleClassGroup F, -+ abstractFixedFieldGlobalNormResidueMonoidHom K L c = -+ Additive.toMul -+ (ambientFixedGlobalNormResidueAddMonoidHom K L -+ ((rationalAbstractFixedFieldIdeleClassEquivFixed K.field) -+ (Additive.ofMul c))) := by -+ dsimp only -+ intro c -+ rfl -+ -+/-- Transporting an ordinary fixed-field idele class to the ambient -+fixed part and applying the abstract norm-residue map gives exactly the -+actual fixed-field norm-residue value. -/ -+@[simp] -+theorem abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply -+ (a : -+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation K.field) : -+ abstractFixedFieldGlobalNormResidueMonoidHom K L -+ (Additive.toMul -+ ((rationalAbstractFixedFieldIdeleClassEquivFixed -+ K.field).symm a)) = -+ Additive.toMul -+ (ambientFixedGlobalNormResidueAddMonoidHom K L a) := by -+ rw [abstractFixedFieldGlobalNormResidueMonoidHom_apply] -+ change -+ Additive.toMul -+ (ambientFixedGlobalNormResidueAddMonoidHom K L -+ ((rationalAbstractFixedFieldIdeleClassEquivFixed K.field) -+ ((rationalAbstractFixedFieldIdeleClassEquivFixed -+ K.field).symm a))) = -+ Additive.toMul -+ (ambientFixedGlobalNormResidueAddMonoidHom K L a) -+ rw [(rationalAbstractFixedFieldIdeleClassEquivFixed -+ K.field).apply_symm_apply] -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueNormClasses.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueNormClasses.lean -new file mode 100644 -index 0000000..9a8db28 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueNormClasses.lean -@@ -0,0 +1,294 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidueEmbeddings -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+section EmbeddedNumberFieldRealization -+ -+variable -+ (K L : Type) [Field K] [NumberField K] -+ [Field L] [NumberField L] [Algebra K L] -+ -+ -+attribute [local instance] -+ numberFieldEmbeddedIdeleClassGroupIsMulCommutative -+ numberFieldEmbeddedIdeleClassSubgroupNormal -+ numberFieldEmbeddedExtensionSubgroupNormal -+ numberFieldEmbeddedExtensionQuotientFinite -+ numberFieldEmbeddedAbsoluteQuotientFinite -+ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional -+ numberFieldEmbeddedAbstractRelativeFixedFieldFiniteDimensional -+ numberFieldEmbeddedAbstractFixedFieldScalarTower -+ numberFieldEmbeddedAbstractRelativeFixedFieldAbsoluteFiniteDimensional -+ numberFieldEmbeddedAbstractFixedFieldNumberField -+ numberFieldEmbeddedAbstractRelativeFixedFieldNumberField -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsFiniteDimensional -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsNumberField -+ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsAlgebra -+ numberFieldEmbeddedAbstractRelativeFixedFieldIsGalois -+ -+private theorem numberFieldEmbeddedOrdinaryNormQuotientCongr_symm_mk -+ {K₀ L₀ K₁ L₁ : Type} -+ [Field K₀] [NumberField K₀] -+ [Field L₀] [NumberField L₀] [Algebra K₀ L₀] -+ [Field K₁] [NumberField K₁] -+ [Field L₁] [NumberField L₁] [Algebra K₁ L₁] -+ (eK : K₀ ≃ₐ[ℚ] K₁) -+ (eL : L₀ ≃ₐ[ℚ] L₁) -+ (h : ∀ x : K₀, -+ eL (algebraMap K₀ L₀ x) = -+ algebraMap K₁ L₁ (eK x)) -+ (c : IdeleClassGroup K₁) : -+ (ordinaryIdeleClassNormQuotientCongrOfAlgEquiv eK eL h).symm -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm K₁ L₁).range c) = -+ QuotientGroup.mk' -+ (_root_.ideleClassNorm K₀ L₀).range -+ ((ideleClassCongr eK).symm c) := by -+ let e := ordinaryIdeleClassNormQuotientCongrOfAlgEquiv eK eL h -+ apply e.injective -+ rw [e.apply_symm_apply, -+ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv_mk, -+ MulEquiv.apply_symm_apply] -+ -+private noncomputable def numberFieldEmbeddedFiniteNormClassPublicValue -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j)) : -+ Additive -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm K L).range) := -+ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -+ K L j -+ (finiteNormClass rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -+ a) -+ -+private noncomputable def numberFieldEmbeddedFiniteNormClassExpectedValue -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j)) : -+ Additive -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm K L).range) := -+ Additive.ofMul -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm K L).range -+ (Additive.toMul -+ ((numberFieldEmbeddedIdeleClassEquivAmbientFixed K L j).symm a))) -+ -+private noncomputable def -+ numberFieldEmbeddedFiniteNormClassDirectComparisonValue -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j)) : -+ Additive -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm K L).range) := by -+ let hnormal := -+ numberFieldEmbeddedExtensionSubgroupNormal K L j -+ let H := numberFieldEmbeddedBaseSubgroup K L j -+ let J := numberFieldEmbeddedTopSubgroup K L j -+ let hJH := -+ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -+ let fixedFieldEquiv := -+ rationalFiniteNormQuotientEquivIdeleClassNormQuotient -+ H J hJH hnormal -+ let actualFieldEquiv := -+ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -+ exact -+ MulEquiv.toAdditive actualFieldEquiv.symm -+ (fixedFieldEquiv -+ (finiteNormClass rationalIdeleClassRepresentation -+ H J hJH a)) -+ -+private theorem -+ numberFieldEmbeddedFiniteNormClassPublicValue_eq_directComparison -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j)) : -+ numberFieldEmbeddedFiniteNormClassPublicValue K L j a = -+ numberFieldEmbeddedFiniteNormClassDirectComparisonValue K L j a := by -+ unfold numberFieldEmbeddedFiniteNormClassPublicValue -+ unfold numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient -+ unfold numberFieldEmbeddedFiniteNormClassDirectComparisonValue -+ rfl -+ -+private noncomputable def numberFieldEmbeddedActualNormClassRepresentativeValue -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j)) : -+ Additive -+ (IdeleClassGroup K ⧸ -+ (_root_.ideleClassNorm K L).range) := by -+ let H := numberFieldEmbeddedBaseSubgroup K L j -+ let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -+ let F := abstractFixedField ℚ (SeparableClosure ℚ) H -+ let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hJH -+ let actualFieldEquiv := -+ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -+ exact -+ Additive.ofMul -+ (actualFieldEquiv.symm -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm F E).range -+ (Additive.toMul -+ ((rationalAbstractFixedFieldIdeleClassEquivFixed H).symm a)))) -+ -+private theorem -+ numberFieldEmbeddedFiniteNormClassDirectComparison_eq_actualValue -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j)) : -+ numberFieldEmbeddedFiniteNormClassDirectComparisonValue K L j a = -+ numberFieldEmbeddedActualNormClassRepresentativeValue K L j a := by -+ let hnormal := numberFieldEmbeddedExtensionSubgroupNormal K L j -+ let H := numberFieldEmbeddedBaseSubgroup K L j -+ let J := numberFieldEmbeddedTopSubgroup K L j -+ let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -+ let actualFieldEquiv := -+ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -+ have hfixed := -+ rationalFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass -+ H J hJH hnormal a -+ unfold numberFieldEmbeddedFiniteNormClassDirectComparisonValue -+ unfold numberFieldEmbeddedActualNormClassRepresentativeValue -+ exact congrArg (MulEquiv.toAdditive actualFieldEquiv.symm) hfixed -+ -+private theorem numberFieldEmbeddedActualNormClassRepresentativeValue_eq_expected -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j)) : -+ numberFieldEmbeddedActualNormClassRepresentativeValue K L j a = -+ numberFieldEmbeddedFiniteNormClassExpectedValue K L j a := by -+ let H := numberFieldEmbeddedBaseSubgroup K L j -+ let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j -+ let F := abstractFixedField ℚ (SeparableClosure ℚ) H -+ let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hJH -+ let actualFieldEquiv := -+ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) -+ let c : IdeleClassGroup F := -+ Additive.toMul -+ ((rationalAbstractFixedFieldIdeleClassEquivFixed H).symm a) -+ unfold numberFieldEmbeddedActualNormClassRepresentativeValue -+ unfold numberFieldEmbeddedFiniteNormClassExpectedValue -+ change -+ Additive.ofMul -+ (actualFieldEquiv.symm -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm F E).range c)) = -+ Additive.ofMul -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm K L).range -+ ((ideleClassCongr -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j)).symm c)) -+ exact -+ congrArg Additive.ofMul -+ (numberFieldEmbeddedOrdinaryNormQuotientCongr_symm_mk -+ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) -+ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) c) -+ -+/-- On a finite norm-class representative, the explicit fixed-field -+comparison is the genuine ordinary idele-class quotient. -/ -+@[simp] -+theorem -+ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j)) : -+ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient K L j -+ (finiteNormClass rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) a) = -+ Additive.ofMul -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm K L).range -+ (Additive.toMul -+ ((numberFieldEmbeddedIdeleClassEquivAmbientFixed K L j).symm a))) := by -+ change -+ numberFieldEmbeddedFiniteNormClassPublicValue K L j a = -+ numberFieldEmbeddedFiniteNormClassExpectedValue K L j a -+ exact -+ (numberFieldEmbeddedFiniteNormClassPublicValue_eq_directComparison -+ K L j a).trans -+ ((numberFieldEmbeddedFiniteNormClassDirectComparison_eq_actualValue -+ K L j a).trans -+ (numberFieldEmbeddedActualNormClassRepresentativeValue_eq_expected -+ K L j a)) -+ -+/-- On an ordinary idele class, the explicit fixed-part realization -+followed by the abstract finite norm-class map is the genuine quotient -+class modulo the ordinary idele-class norm. -/ -+@[simp] -+theorem -+ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass -+ [FiniteDimensional K L] [IsGalois K L] -+ (j : L →ₐ[ℚ] SeparableClosure ℚ) -+ (c : IdeleClassGroup K) : -+ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient K L j -+ (finiteNormClass rationalIdeleClassRepresentation -+ (numberFieldEmbeddedBaseSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup K L j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K L j (Additive.ofMul c))) = -+ Additive.ofMul -+ (QuotientGroup.mk' -+ (_root_.ideleClassNorm K L).range c) := by -+ simpa only [AddEquiv.symm_apply_apply, toMul_ofMul] using -+ (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass -+ K L j -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K L j (Additive.ofMul c))) -+ -+ -+end EmbeddedNumberFieldRealization -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtin.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtin.lean -index d3e6e51..75c1574 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtin.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtin.lean -@@ -4,26 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicIdeleClassValuation --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.InfiniteGlobalArtin --import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.MaximalUnramifiedReciprocity -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinComparison - --set_option autoImplicit false -- --/-! --# Cyclotomic Artin coordinates over abstract fixed fields - --The cyclotomic degree datum on the rational absolute Galois group has --an actual maximal-unramified field over every finite abstract fixed --field. This file identifies its genuine Galois group with --`Multiplicative ZHat`, using the normalized degree map, and supplies --the abelian Galois structure needed by the actual infinite global --Artin homomorphism. -+set_option autoImplicit false - --These constructions are the source side of the comparison between --abstract finite reciprocity and the chosen local-factor product. No --reciprocity comparison is assumed in their definitions. ---/ - - open scoped IsMulCommutative NumberField - -@@ -35,2336 +20,11 @@ namespace Reciprocity - open ClassFormation - open KummerTheory - --/-- Keep this module on the rational algebra structures used by the --cyclotomic fixed-field API. Generic intermediate-field instances are --propositionally equal here but not definitionally interchangeable. -/ --noncomputable local instance -- cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra : -- Algebra ℚ (SeparableClosure ℚ) := -- DivisionRing.toRatAlgebra -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra : -- Algebra ℚ rationalCyclotomicZHatField := -- DivisionRing.toRatAlgebra -- --/-- Cyclotomic field inertia is contained in the original abstract --field subgroup. -/ --theorem rationalCyclotomicFieldInertia_le -- (H : ClosedSubgroup -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- (rationalCyclotomicDegreeData.fieldInertia H).toSubgroup ≤ -- H.toSubgroup := by -- intro σ hσ -- exact hσ.1 -- --/-- Viewing cyclotomic field inertia inside its ambient field subgroup --gives exactly the kernel of normalized degree. -/ --theorem extensionSubgroup_rationalCyclotomicFieldInertia -- (H : ClosedSubgroup -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- CyclicCohomology.extensionSubgroup H -- (rationalCyclotomicDegreeData.fieldInertia H) -- (rationalCyclotomicFieldInertia_le H) = -- rationalCyclotomicDegreeData.fieldInertiaWithin H := by -- ext σ -- rw [ -- mem_extensionSubgroup_iff, -- rationalCyclotomicDegreeData.mem_fieldInertiaWithin_iff, -- rationalCyclotomicDegreeData.mem_fieldInertia_iff] -- exact and_iff_right σ.2 -- --/-- The actual Galois group of the cyclotomic maximal-unramified --extension of an abstract fixed field, in its normalized `ZHat` --coordinate. -/ --noncomputable def abstractFixedFieldCyclotomicGalEquivZHat -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) ≃* -- Multiplicative ZHat := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- let qField : -- H.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI ≃* -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) := -- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- let qInertia : -- H.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI ≃* -- H.field.toSubgroup ⧸ -- rationalCyclotomicDegreeData.fieldInertiaWithin H.field := -- QuotientGroup.quotientMulEquivOfEq -- (extensionSubgroup_rationalCyclotomicFieldInertia H.field) -- exact -- qField.symm.trans -- (qInertia.trans -- (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -- (H.toFiniteResidueAbstractField -- rationalCyclotomicDegreeData))) -- --/-- On an absolute-Galois representative fixing the lower field, the --actual cyclotomic Galois coordinate is its normalized degree. -/ --@[simp] --theorem abstractFixedFieldCyclotomicGalEquivZHat_extensionClass -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (σ : H.field.toSubgroup) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- abstractFixedFieldCyclotomicGalEquivZHat H -- (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- (QuotientGroup.mk σ)) = -- rationalCyclotomicDegreeData.normalizedDegree -- (H.toFiniteResidueAbstractField -- rationalCyclotomicDegreeData) σ := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- let qField := -- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- change -- (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -- (H.toFiniteResidueAbstractField -- rationalCyclotomicDegreeData)) -- (QuotientGroup.quotientMulEquivOfEq -- (extensionSubgroup_rationalCyclotomicFieldInertia H.field) -- (qField.symm (qField (QuotientGroup.mk σ)))) = -- rationalCyclotomicDegreeData.normalizedDegree -- (H.toFiniteResidueAbstractField -- rationalCyclotomicDegreeData) σ -- rw [qField.symm_apply_apply] -- rfl -- --/-- Quotient-level evaluation of the actual cyclotomic Galois --coordinate. -/ --@[simp] --theorem abstractFixedFieldCyclotomicGalEquivZHat_quotientClass -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (q : -- H.field.toSubgroup ⧸ -- rationalCyclotomicDegreeData.fieldInertiaWithin H.field) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- let qInertia : -- H.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI ≃* -- H.field.toSubgroup ⧸ -- rationalCyclotomicDegreeData.fieldInertiaWithin H.field := -- QuotientGroup.quotientMulEquivOfEq -- (extensionSubgroup_rationalCyclotomicFieldInertia H.field) -- abstractFixedFieldCyclotomicGalEquivZHat H -- (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- (qInertia.symm q)) = -- rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -- (H.toFiniteResidueAbstractField -- rationalCyclotomicDegreeData) q := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- let qField := -- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- let qInertia : -- H.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI ≃* -- H.field.toSubgroup ⧸ -- rationalCyclotomicDegreeData.fieldInertiaWithin H.field := -- QuotientGroup.quotientMulEquivOfEq -- (extensionSubgroup_rationalCyclotomicFieldInertia H.field) -- change -- (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -- (H.toFiniteResidueAbstractField -- rationalCyclotomicDegreeData)) -- (qInertia -- (qField.symm -- (qField (qInertia.symm q)))) = -- rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -- (H.toFiniteResidueAbstractField -- rationalCyclotomicDegreeData) q -- rw [qField.symm_apply_apply, qInertia.apply_symm_apply] -- --/-- The extension fixed by cyclotomic field inertia is an actual --abelian Galois extension of the lower abstract fixed field. -/ --theorem abstractFixedFieldCyclotomic_isAbelianGalois -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- IsAbelianGalois -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- let : IsGalois -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) := -- LocalClassFieldTheory.abstractRelativeFixedField_isGalois -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- let e := -- abstractFixedFieldCyclotomicGalEquivZHat H -- exact -- { is_comm.comm := by -- intro σ τ -- apply e.injective -- simpa only [map_mul] using mul_comm (e σ) (e τ) } -- --/-- The rational cyclotomic `ZHat`-field embedded in the actual --maximal-unramified compositum of an abstract fixed field. -/ --noncomputable def -- rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- rationalCyclotomicZHatField →ₐ[ℚ] -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let J := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- have hTJ : -- rationalCyclotomicZHatField ≤ J := by -- change -- rationalCyclotomicZHatField ≤ -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- rw [ -- rationalCyclotomicDegreeData_fixedField_fieldInertia] -- exact le_sup_right -- exact IntermediateField.inclusion hTJ -- --noncomputable instance -- abstractFixedFieldCyclotomicCompositum_algebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- Algebra rationalCyclotomicZHatField -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) := -- ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H).toRingHom).toAlgebra -- --instance abstractFixedFieldCyclotomicCompositum_scalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- IsScalarTower ℚ rationalCyclotomicZHatField -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) := -- IsScalarTower.of_algebraMap_eq' -- ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H).comp_algebraMap).symm -- --instance abstractFixedFieldCyclotomicCompositum_baseScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- IsScalarTower ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- apply IsScalarTower.of_algebraMap_eq -- intro x -- apply Subtype.ext -- rfl -- --/-- Restriction from the actual maximal-unramified compositum of an --abstract fixed field to the rational cyclotomic factor. -/ --noncomputable def abstractFixedFieldCyclotomicRestriction -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) →* -- Gal(rationalCyclotomicZHatField / ℚ) := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- exact -- IntermediateField.restrictRestrictAlgEquivMapHom -- ℚ rationalCyclotomicZHatField -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) -- --/-- On a quotient representative, cyclotomic restriction of the --actual relative automorphism is ordinary restriction of the same --ambient absolute-Galois automorphism. -/ --noncomputable local instance -- cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal : -- Normal ℚ rationalCyclotomicZHatField := -- rationalCyclotomicZHatField_isNormal -- --@[simp] --theorem abstractFixedFieldCyclotomicRestriction_extensionClass -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (σ : H.field.toSubgroup) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- abstractFixedFieldCyclotomicRestriction H -- (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- (QuotientGroup.mk σ)) = -- AlgEquiv.restrictNormalHom -- rationalCyclotomicZHatField σ.1 := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- let τ := -- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- (QuotientGroup.mk' -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) hI) -- σ) -- apply AlgEquiv.ext -- intro x -- apply Subtype.ext -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI -- have hrestrict : -- algebraMap rationalCyclotomicZHatField U -- ((abstractFixedFieldCyclotomicRestriction H τ) x) = -- τ (algebraMap rationalCyclotomicZHatField U x) := by -- change -- algebraMap rationalCyclotomicZHatField U -- ((AlgEquiv.restrictNormal -- (MulSemiringAction.toAlgEquiv ℚ U τ) -- rationalCyclotomicZHatField) x) = -- (MulSemiringAction.toAlgEquiv ℚ U τ) -- (algebraMap rationalCyclotomicZHatField U x) -- exact -- AlgEquiv.restrictNormal_commutes -- (MulSemiringAction.toAlgEquiv ℚ U τ) -- rationalCyclotomicZHatField x -- have halgebraMap_eq_embedding -- (z : rationalCyclotomicZHatField) : -- algebraMap rationalCyclotomicZHatField U z = -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H z : U) := by -- rfl -- have hembedding_coe -- (z : rationalCyclotomicZHatField) : -- (((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H z : U) : SeparableClosure ℚ)) = -- (z : SeparableClosure ℚ) := by -- rfl -- have halgebraMap_coe -- (z : rationalCyclotomicZHatField) : -- ((algebraMap rationalCyclotomicZHatField U z : U) : -- SeparableClosure ℚ) = -- (z : SeparableClosure ℚ) := by -- rw [halgebraMap_eq_embedding] -- exact hembedding_coe z -- have hambient := -- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup_mk_apply_val -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal σ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H x) -- calc -- (((abstractFixedFieldCyclotomicRestriction H τ) x : -- rationalCyclotomicZHatField) : -- SeparableClosure ℚ) = -- ((τ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H x) : -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) : -- SeparableClosure ℚ) := by -- calc -- (((abstractFixedFieldCyclotomicRestriction H τ) x : -- rationalCyclotomicZHatField) : SeparableClosure ℚ) = -- ((algebraMap rationalCyclotomicZHatField U -- ((abstractFixedFieldCyclotomicRestriction H τ) x) : U) : -- SeparableClosure ℚ) := -- (halgebraMap_coe -- ((abstractFixedFieldCyclotomicRestriction H τ) x)).symm -- _ = ((τ (algebraMap rationalCyclotomicZHatField U x) : U) : -- SeparableClosure ℚ) := -- congrArg (fun y : U => (y : SeparableClosure ℚ)) hrestrict -- _ = ((τ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H x) : U) : SeparableClosure ℚ) := by -- rw [halgebraMap_eq_embedding] -- _ = σ.1 (x : SeparableClosure ℚ) := by -- calc -- ((τ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H x) : U) : SeparableClosure ℚ) = -- σ.1 -- ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H x : U) : SeparableClosure ℚ) := by -- simpa only [τ, U] using hambient.symm -- _ = σ.1 (x : SeparableClosure ℚ) := by -- rw [hembedding_coe] -- _ = -- (((AlgEquiv.restrictNormalHom -- rationalCyclotomicZHatField σ.1) x : -- rationalCyclotomicZHatField) : -- SeparableClosure ℚ) := by -- exact -- (AlgEquiv.restrictNormal_commutes -- σ.1 rationalCyclotomicZHatField x).symm -- --/-- Raw cyclotomic restriction is residue-degree multiplication of --the normalized actual Galois coordinate. -/ --theorem -- abstractFixedFieldCyclotomicRestriction_coordinate -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (τ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) : -- Multiplicative.toAdd -- (rationalCyclotomicZHatFieldGalEquivZHat -- (abstractFixedFieldCyclotomicRestriction H τ)) = -- (H.residueDegree rationalCyclotomicDegreeData : ℕ) • -- Multiplicative.toAdd -- (abstractFixedFieldCyclotomicGalEquivZHat H τ) := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let hnormal : -- (CyclicCohomology.extensionSubgroup H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI).Normal := by -- rw [extensionSubgroup_rationalCyclotomicFieldInertia] -- infer_instance -- let qField := -- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) H.field -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- hI hnormal -- obtain ⟨q, rfl⟩ := qField.surjective τ -- refine Quotient.inductionOn' q ?_ -- intro σ -- rw [ -- abstractFixedFieldCyclotomicRestriction_extensionClass, -- abstractFixedFieldCyclotomicGalEquivZHat_extensionClass] -- exact -- (rationalCyclotomicDegreeData.residueDegree_nsmul_normalizedDegree -- (H.toFiniteResidueAbstractField -- rationalCyclotomicDegreeData) σ).symm -- --/-- The canonical compositum of an abstract fixed field with a finite --layer of the rational cyclotomic `ZHat`-extension. -/ --def abstractFixedFieldCyclotomicFiniteCompositum -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IntermediateField ℚ (SeparableClosure ℚ) := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field ⊔ -- IntermediateField.lift E.toIntermediateField -- --noncomputable instance -- abstractFixedFieldCyclotomicFiniteCompositum_finiteDimensional -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- FiniteDimensional ℚ -- (abstractFixedFieldCyclotomicFiniteCompositum H E) := by -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- let : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- let : FiniteDimensional ℚ -- (IntermediateField.lift E.toIntermediateField) := -- ((IntermediateField.liftAlgEquiv -- E.toIntermediateField).toLinearEquiv).finiteDimensional -- exact IntermediateField.finiteDimensional_sup -- F (IntermediateField.lift E.toIntermediateField) -- --noncomputable instance -- abstractFixedFieldCyclotomicFiniteCompositum_numberField -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- NumberField -- (abstractFixedFieldCyclotomicFiniteCompositum H E) := -- NumberField.of_module_finite ℚ -- (abstractFixedFieldCyclotomicFiniteCompositum H E) -- --/-- The lower abstract fixed field embedded into its finite --cyclotomic compositum. -/ --noncomputable def -- abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field →ₐ[ℚ] -- abstractFixedFieldCyclotomicFiniteCompositum H E := -- IntermediateField.inclusion -- (show -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field ≤ -- abstractFixedFieldCyclotomicFiniteCompositum H E from -- le_sup_left) -- --/-- The fixed field attached to a finite abstract field is a number --field. Keeping this as the single file-local instance makes it --available while later theorem binders are elaborated. -/ --noncomputable local instance -- abstractFixedFieldCyclotomic_numberField -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- NumberField -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) := by -- let : FiniteDimensional ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- exact -- NumberField.of_module_finite ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- --/-- A finite rational cyclotomic layer embedded into its compositum --with the abstract fixed field. -/ --noncomputable def -- abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- E →ₐ[ℚ] -- abstractFixedFieldCyclotomicFiniteCompositum H E := -- (IntermediateField.inclusion -- (show -- IntermediateField.lift E.toIntermediateField ≤ -- abstractFixedFieldCyclotomicFiniteCompositum H E from -- le_sup_right)).comp -- (IntermediateField.liftAlgEquiv E.toIntermediateField).toAlgHom -- --noncomputable instance -- abstractFixedFieldCyclotomicFiniteCompositum_baseAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteCompositum H E) := -- RingHom.toAlgebra -- (AlgHom.toRingHom -- (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E)) -- --noncomputable instance -- abstractFixedFieldCyclotomicFiniteCompositum_layerAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra E -- (abstractFixedFieldCyclotomicFiniteCompositum H E) := -- RingHom.toAlgebra -- (AlgHom.toRingHom -- (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E)) -- --/-- The finite-layer action induced by its explicit embedding into the --finite compositum. -/ --noncomputable instance -- abstractFixedFieldCyclotomicFiniteCompositum_layerSMul -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- SMul E -- (abstractFixedFieldCyclotomicFiniteCompositum H E) := -- Algebra.toSMul -- (self := -- abstractFixedFieldCyclotomicFiniteCompositum_layerAlgebra H E) -- --instance -- abstractFixedFieldCyclotomicFiniteCompositum_baseScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsScalarTower ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteCompositum H E) := -- IsScalarTower.of_algebraMap_eq' -- (AlgHom.comp_algebraMap -- (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E)).symm -- --instance -- abstractFixedFieldCyclotomicFiniteCompositum_layerScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsScalarTower ℚ E -- (abstractFixedFieldCyclotomicFiniteCompositum H E) := -- IsScalarTower.of_algebraMap_eq' -- (AlgHom.comp_algebraMap -- (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E)).symm -- --/-- Inclusion of the finite cyclotomic compositum into the actual --maximal-unramified compositum. -/ --noncomputable def -- abstractFixedFieldCyclotomicFiniteCompositumInclusion -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- abstractFixedFieldCyclotomicFiniteCompositum H E →ₐ[ℚ] -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let J := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicDegreeData.fieldInertia H.field) -- have hle : -- abstractFixedFieldCyclotomicFiniteCompositum H E ≤ J := by -- dsimp only [J] -- rw [ -- rationalCyclotomicDegreeData_fixedField_fieldInertia H.field] -- exact -- sup_le_sup le_rfl -- (IntermediateField.lift_le E.toIntermediateField) -- exact IntermediateField.inclusion hle -- --/-- The same finite-compositum inclusion over the lower abstract fixed --field. -/ --noncomputable def -- abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- abstractFixedFieldCyclotomicFiniteCompositum H E →ₐ[ -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field] -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI := by -- let f := -- abstractFixedFieldCyclotomicFiniteCompositumInclusion H E -- exact -- { f.toRingHom with -- commutes' := by -- intro x -- rfl } -- --/-- The finite cyclotomic compositum as an intermediate field of the --actual maximal-unramified extension. -/ --noncomputable def abstractFixedFieldCyclotomicFiniteLayer -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- IntermediateField -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) := -- (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase H E).fieldRange -- --/-- The base algebra on the finite field range, obtained from the --explicit base embedding followed by the field-range equivalence. -/ --noncomputable instance -- abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) := -- RingHom.toAlgebra -- ((AlgHom.toRingHom -- (AlgEquiv.toAlgHom -- (AlgHom.equivFieldRange -- (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase -- H E)))).comp -- (AlgHom.toRingHom -- (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E))) -- --/-- The scalar action belonging to the canonical base algebra on the --finite field range. -/ --noncomputable instance -- abstractFixedFieldCyclotomicFiniteLayer_baseSMul -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- SMul -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) := -- Algebra.toSMul -- (self := abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E) -- --/-- The module structure belonging to the canonical base algebra on --the finite field range. -/ --noncomputable instance -- abstractFixedFieldCyclotomicFiniteLayer_baseModule -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Module -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) := -- @Algebra.toModule -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- _ _ -- (abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E) -- --/-- The field-range equivalence rebuilt over the explicit base --algebras. Its underlying ring equivalence is the canonical one. -/ --noncomputable def -- abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- abstractFixedFieldCyclotomicFiniteCompositum H E ≃ₐ[ -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field] -- abstractFixedFieldCyclotomicFiniteLayer H E := -- AlgEquiv.ofRingEquiv -- (f := -- (AlgHom.equivFieldRange -- (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase -- H E)).toRingEquiv) -- (fun _ => rfl) -- --noncomputable instance -- abstractFixedFieldCyclotomicFiniteLayer_finiteDimensional -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- FiniteDimensional -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) := -- (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer -- H E).toLinearEquiv.finiteDimensional -- --noncomputable instance -- abstractFixedFieldCyclotomicFiniteLayer_numberField -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- NumberField -- (abstractFixedFieldCyclotomicFiniteLayer H E) := -- NumberField.of_module_finite -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- --noncomputable instance -- abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsAbelianGalois -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let : IsAbelianGalois -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- exact -- IsAbelianGalois.of_algHom -- ((abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase -- H E).comp -- (AlgEquiv.toAlgHom -- (AlgEquiv.symm -- (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer -- H E)))) -- --instance -- abstractFixedFieldCyclotomicFiniteLayer_baseScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsScalarTower ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) := by -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- apply IsScalarTower.of_algebraMap_eq -- intro x -- apply Subtype.ext -- change -- algebraMap ℚ -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) x = -- algebraMap -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) -- (algebraMap ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) x) -- exact -- IsScalarTower.algebraMap_apply -- ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) x -- --/-- The finite rational layer embedded into its corresponding --intermediate field over the abstract fixed field. -/ --noncomputable def -- abstractFixedFieldCyclotomicFiniteLayerEmbedding -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- E →ₐ[ℚ] -- abstractFixedFieldCyclotomicFiniteLayer H E := by -- exact -- (AlgEquiv.toAlgHom -- (AlgEquiv.restrictScalars ℚ -- (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer -- H E))).comp -- (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E) -- --noncomputable instance -- abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra E -- (abstractFixedFieldCyclotomicFiniteLayer H E) := -- RingHom.toAlgebra -- (AlgHom.toRingHom -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E)) -- --/-- The finite-layer action on its actual image in the relative fixed --field. -/ --noncomputable instance -- abstractFixedFieldCyclotomicFiniteLayer_layerSMul -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- SMul E -- (abstractFixedFieldCyclotomicFiniteLayer H E) := -- Algebra.toSMul -- (self := abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E) -- --instance -- abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsScalarTower ℚ E -- (abstractFixedFieldCyclotomicFiniteLayer H E) := -- IsScalarTower.of_algebraMap_eq' -- (AlgHom.comp_algebraMap -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E)).symm -- --/-- The finite cyclotomic layer as an object of the finite-Galois --inverse system of the actual maximal-unramified extension. -/ --@[reducible] --noncomputable def -- abstractFixedFieldCyclotomicFiniteGaloisLayer -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- FiniteGaloisIntermediateField -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field)) where -- toIntermediateField := -- abstractFixedFieldCyclotomicFiniteLayer H E -- finiteDimensional := -- abstractFixedFieldCyclotomicFiniteLayer_finiteDimensional H E -- isGalois := -- (abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E).toIsGalois -- --/-- The explicit base algebra on a finite cyclotomic layer is the canonical --intermediate-field inclusion used by the finite Galois inverse system. -/ --theorem abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra_eq_algebra' -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E = -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).algebra' := by -- apply Algebra.algebra_ext -- intro x -- apply Subtype.ext -- rfl -- --/-- The finite Galois layer uses its canonical inclusion into the full --relative fixed field for the upper scalar action. -/ --instance -- abstractFixedFieldCyclotomicFiniteGaloisLayer_scalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsScalarTower -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).toIntermediateField -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field)) := by -- let i : -- (abstractFixedFieldCyclotomicFiniteGaloisLayer -- H E).toIntermediateField →ₐ[ -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field] -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) := -- { (abstractFixedFieldCyclotomicFiniteGaloisLayer -- H E).toIntermediateField.val.toRingHom with -- commutes' := by -- intro x -- rfl } -- exact -- IsScalarTower.of_algebraMap_eq' -- (AlgHom.comp_algebraMap i).symm -- --/-- The canonical inclusion of the finite cyclotomic layer into the --full abstract-fixed-field compositum. -/ --private noncomputable def -- abstractFixedFieldCyclotomicFiniteLayerInclusion -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- abstractFixedFieldCyclotomicFiniteLayer H E →ₐ[ -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field] -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) := -- IntermediateField.val -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- --/-- The two embeddings of a finite rational cyclotomic layer into the --full abstract-fixed-field compositum agree. -/ --private theorem -- abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- (z : E) : -- abstractFixedFieldCyclotomicFiniteLayerInclusion H E -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E z) = -- rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -- (z : rationalCyclotomicZHatField) := by -- exact Subtype.ext rfl -- --/-- Restriction to `E` commutes pointwise with the restriction from the --full rational cyclotomic tower. -/ --private theorem -- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- [Normal ℚ E] -- (σ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) -- (z : E) : -- ((AlgEquiv.restrictNormalHom E -- (abstractFixedFieldCyclotomicRestriction H σ)) z : -- rationalCyclotomicZHatField) = -- (abstractFixedFieldCyclotomicRestriction H σ) -- (z : rationalCyclotomicZHatField) := by -- exact -- AlgEquiv.restrictNormal_commutes -- (abstractFixedFieldCyclotomicRestriction H σ) E z -- --/-- The raw cyclotomic restriction commutes with the canonical embedding --of the full rational cyclotomic tower. -/ --private theorem -- abstractFixedFieldCyclotomicRestriction_embedding_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (σ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) -- (z : rationalCyclotomicZHatField) : -- rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -- (abstractFixedFieldCyclotomicRestriction H σ z) = -- σ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H z) := by -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) -- exact -- AlgEquiv.restrictNormal_commutes -- (MulSemiringAction.toAlgEquiv ℚ U σ) -- rationalCyclotomicZHatField z -- --/-- Restriction to the finite compositum layer commutes with its --canonical inclusion into the full compositum. -/ --private theorem -- restrictNormalHom_abstractFixedFieldCyclotomicFiniteLayer_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- [Normal -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E)] -- (σ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) -- (z : abstractFixedFieldCyclotomicFiniteLayer H E) : -- abstractFixedFieldCyclotomicFiniteLayerInclusion H E -- (AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteLayer H E) σ z) = -- σ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E z) := by -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) -- let P : IntermediateField F U := -- abstractFixedFieldCyclotomicFiniteLayer H E -- exact -- AlgEquiv.restrictNormal_commutes -- (MulSemiringAction.toAlgEquiv F U σ) P z -- --/-- Restricting the finite-compositum action further to `E` commutes --with the explicit embedding of `E` into that finite layer. -/ --private theorem -- abstractFixedFieldCyclotomicFiniteLayerEmbedding_restrict_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- [Normal ℚ E] -- [Normal -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E)] -- (σ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) -- (z : E) : -- abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -- (IntermediateField.restrictRestrictAlgEquivMapHom -- ℚ E -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- (AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) z) = -- (AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E z) := by -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) -- let P : IntermediateField F U := -- abstractFixedFieldCyclotomicFiniteLayer H E -- exact -- AlgEquiv.restrictNormal_commutes -- (MulSemiringAction.toAlgEquiv ℚ P -- (AlgEquiv.restrictNormalHom P σ)) E z -- --/-- The left finite-level restriction, after both canonical embeddings into --the full compositum, is the action of `σ` on the cyclotomic embedding. -/ --private theorem -- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_left_embedded -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- [Normal ℚ E] -- (σ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) -- (x : E) : -- abstractFixedFieldCyclotomicFiniteLayerInclusion H E -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -- (AlgEquiv.restrictNormalHom E -- (abstractFixedFieldCyclotomicRestriction H σ) x)) = -- σ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -- (x : rationalCyclotomicZHatField)) := by -- calc -- abstractFixedFieldCyclotomicFiniteLayerInclusion H E -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -- (AlgEquiv.restrictNormalHom E -- (abstractFixedFieldCyclotomicRestriction H σ) x)) = -- rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -- (((AlgEquiv.restrictNormalHom E -- (abstractFixedFieldCyclotomicRestriction H σ) x) : -- rationalCyclotomicZHatField)) := -- abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion H E _ -- _ = rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -- (abstractFixedFieldCyclotomicRestriction H σ -- (x : rationalCyclotomicZHatField)) := -- congrArg -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H) -- (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_apply -- H E σ x) -- _ = σ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H (x : rationalCyclotomicZHatField)) := -- abstractFixedFieldCyclotomicRestriction_embedding_apply -- H σ (x : rationalCyclotomicZHatField) -- --/-- The right finite-level restriction, after both canonical embeddings into --the full compositum, is the same action of `σ`. -/ --private theorem -- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_right_embedded -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- [Normal ℚ E] -- [Normal -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E)] -- (σ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) -- (x : E) : -- abstractFixedFieldCyclotomicFiniteLayerInclusion H E -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -- (IntermediateField.restrictRestrictAlgEquivMapHom -- ℚ E -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- (AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x)) = -- σ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -- (x : rationalCyclotomicZHatField)) := by -- calc -- abstractFixedFieldCyclotomicFiniteLayerInclusion H E -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -- (IntermediateField.restrictRestrictAlgEquivMapHom -- ℚ E -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- (AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x)) = -- abstractFixedFieldCyclotomicFiniteLayerInclusion H E -- ((AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x)) := -- congrArg -- (abstractFixedFieldCyclotomicFiniteLayerInclusion H E) -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding_restrict_apply -- H E σ x) -- _ = σ -- (abstractFixedFieldCyclotomicFiniteLayerInclusion H E -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x)) := -- restrictNormalHom_abstractFixedFieldCyclotomicFiniteLayer_apply -- H E σ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x) -- _ = σ -- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -- H (x : rationalCyclotomicZHatField)) := -- congrArg σ -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion H E x) -- --/-- Pointwise form of finite-layer restriction compatibility. -/ --private theorem -- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_pointwise -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- [Normal ℚ E] -- [Normal -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E)] -- (σ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) -- (x : E) : -- AlgEquiv.restrictNormalHom E -- (abstractFixedFieldCyclotomicRestriction H σ) x = -- IntermediateField.restrictRestrictAlgEquivMapHom -- ℚ E -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- (AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x := by -- apply -- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E).injective -- apply -- (abstractFixedFieldCyclotomicFiniteLayerInclusion H E).injective -- exact -- (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_left_embedded -- H E σ x).trans -- (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_right_embedded -- H E σ x).symm -- --/-- Restricting through a finite layer commutes with restriction from --the full abstract-fixed-field compositum. -/ --theorem -- restrictNormalHom_abstractFixedFieldCyclotomicRestriction -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- (σ : -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) : -- letI : Normal ℚ E := E.isGalois.to_normal -- AlgEquiv.restrictNormalHom E -- (abstractFixedFieldCyclotomicRestriction H σ) = -- IntermediateField.restrictRestrictAlgEquivMapHom -- ℚ E -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- (AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -- σ) := by -- let : Normal ℚ E := E.isGalois.to_normal -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) -- let T := rationalCyclotomicZHatField -- let P : IntermediateField F U := -- abstractFixedFieldCyclotomicFiniteLayer H E -- let : Algebra T U := -- abstractFixedFieldCyclotomicCompositum_algebra H -- let : IsScalarTower ℚ T U := -- abstractFixedFieldCyclotomicCompositum_scalarTower H -- let : Algebra E P := -- abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E -- let : IsScalarTower ℚ E P := -- abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower H E -- let : IsAbelianGalois F P := by -- change IsAbelianGalois F -- (abstractFixedFieldCyclotomicFiniteLayer H E) -- exact -- abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E -- let : Normal F P := IsGalois.to_normal -- apply AlgEquiv.ext -- intro x -- exact -- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_pointwise -- H E σ x -- --section FiniteCoordinateHelpers -- --/-- Opaque three-step equality composition used to keep large dependent --finite-level coordinates out of endpoint proof normalization. -/ --private theorem cyclotomicAbstractFixedFieldArtin_eqTransThree -- {α : Type} {a b c d : α} -- (hab : a = b) (hbc : b = c) (hcd : c = d) : -- a = d := -- hab.trans (hbc.trans hcd) -- --private abbrev cyclotomicAbstractFixedFieldArtinCoordinateBase -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- --private abbrev cyclotomicAbstractFixedFieldArtinCoordinateRelative -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (rationalCyclotomicFieldInertia_le H.field) -- --private abbrev cyclotomicAbstractFixedFieldArtinCoordinateLayer -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IntermediateField -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -- abstractFixedFieldCyclotomicFiniteLayer H E -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- Algebra ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H).algebra' -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateBaseFiniteDimensional -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- FiniteDimensional ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- NumberField -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := -- NumberField.of_module_finite ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateBaseSeparableAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- Algebra -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (SeparableClosure ℚ) := -- IntermediateField.toAlgebra -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateRelativeAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- Algebra -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H).algebra' -- --local instance -- cyclotomicAbstractFixedFieldArtinCoordinateRelativeScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- IsScalarTower ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -- abstractFixedFieldCyclotomicCompositum_baseScalarTower H -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateRelativeIsAbelianGalois -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -- IsAbelianGalois -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateAlgebra -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra ℚ E := -- E.toIntermediateField.algebra' -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateNumberField -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- NumberField E := -- NumberField.of_module_finite ℚ E -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsAbelianGalois ℚ E := -- IsAbelianGalois.of_algHom E.toIntermediateField.val -- --local instance -- cyclotomicAbstractFixedFieldArtinCoordinateNormal -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Normal ℚ E := -- E.isGalois.to_normal -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).algebra' -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -- DivisionRing.toRatAlgebra -- --local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsScalarTower ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := by -- let hI := rationalCyclotomicFieldInertia_le H.field -- apply IsScalarTower.of_algebraMap_eq -- intro x -- apply Subtype.ext -- change -- algebraMap ℚ -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) x = -- algebraMap -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) -- (algebraMap ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) x) -- exact -- IsScalarTower.algebraMap_apply -- ℚ -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI) x -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- NumberField -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) := -- abstractFixedFieldCyclotomicFiniteLayer_numberField H E -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra E -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -- abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerSMul -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- SMul E -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -- abstractFixedFieldCyclotomicFiniteLayer_layerSMul H E -- --local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsScalarTower ℚ E -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -- abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower H E -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerRelativeAlgebra -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Algebra -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -- IntermediateField.toAlgebra -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) -- --local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerRelativeScalarTower -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsScalarTower -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -- abstractFixedFieldCyclotomicFiniteGaloisLayer_scalarTower H E -- --noncomputable local instance -- cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- IsAbelianGalois -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -- abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E -- --/-- The full abstract Artin symbol whose finite coordinates are compared --below. Naming this endpoint keeps its relative fixed-field data opaque. -/ --private noncomputable def -- cyclotomicAbstractFixedFieldArtinAbstractEndpoint -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : -- Gal(rationalCyclotomicZHatField / ℚ) := -- abstractFixedFieldCyclotomicRestriction H -- (infiniteGlobalArtinMonoidHom -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a) -- --/-- The rational norm Artin symbol serving as the other full endpoint. -/ --private noncomputable def -- cyclotomicAbstractFixedFieldArtinRationalEndpoint -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : -- Gal(rationalCyclotomicZHatField / ℚ) := -- rationalCyclotomicZHatGlobalArtin -- (IdeleGroup.norm ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) a) -- --/-- The finite restriction map packaged together with its pointwise Artin --naturality law. The map is inferred from the generic hom-level theorem, so --no concrete instance tower is compared after the opaque boundary. -/ --private noncomputable def cyclotomicAbstractFixedFieldArtinCoordinateMapData -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- {f : Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / -- cyclotomicAbstractFixedFieldArtinCoordinateBase H) →* -- Gal(E / ℚ) // -- f.comp -- (@globalArtinMonoidHomOfNumberField -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -- (inferInstance : Field -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) -- (inferInstance : Field -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E)) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E)) = -- (globalArtinMonoidHom (K := ℚ) (L := E)).comp -- (IdeleGroup.norm ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H))} := by -- have hnat := -- @globalArtinMonoidHomOfNumberField_norm_restriction -- ℚ E -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -- inferInstance inferInstance -- inferInstance -- (cyclotomicAbstractFixedFieldArtinCoordinateNumberField E) -- (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) -- (cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois E) -- inferInstance -- (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) -- inferInstance -- (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E) -- exact -- ⟨(@AlgEquiv.restrictNormalHom -- ℚ inferInstance -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -- inferInstance -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) -- E inferInstance -- (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateNormal E)).comp -- (@AlgEquiv.restrictScalarsHom -- ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -- inferInstance inferInstance inferInstance -- (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E)), -- hnat⟩ -- --/-- The fixed restriction map from the relative finite layer to one rational --cyclotomic coordinate. -/ --private noncomputable def cyclotomicAbstractFixedFieldArtinCoordinateMap -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / -- cyclotomicAbstractFixedFieldArtinCoordinateBase H) →* -- Gal(E / ℚ) := -- (cyclotomicAbstractFixedFieldArtinCoordinateMapData H E).1 -- --/-- Naturality of the named coordinate map, kept at the hom level so later --pointwise rewrites match the opaque map without unfolding its data package. -/ --private theorem cyclotomicAbstractFixedFieldArtinCoordinateMap_naturality -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- (cyclotomicAbstractFixedFieldArtinCoordinateMap H E).comp -- (globalArtinMonoidHom -- (K := cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (L := abstractFixedFieldCyclotomicFiniteGaloisLayer H E)) = -- (globalArtinMonoidHom (K := ℚ) (L := E)).comp -- (IdeleGroup.norm ℚ -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) := -- (cyclotomicAbstractFixedFieldArtinCoordinateMapData H E).2 -- --/-- Pointwise identification of the named coordinate map with the concrete --two-stage restriction used by the abstract fixed-field comparison. -/ --private theorem cyclotomicAbstractFixedFieldArtinCoordinateMap_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) -- (σ : Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / -- cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : -- cyclotomicAbstractFixedFieldArtinCoordinateMap H E σ = -- @IntermediateField.restrictRestrictAlgEquivMapHom -- ℚ E -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -- inferInstance inferInstance inferInstance inferInstance -- (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) -- (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateNormal E) σ := -- rfl -- --/-- The relative projection, common rational finite value, and rational --infinite projection, with both comparison steps packaged by the generic --provider before this concrete tower becomes opaque. -/ --private noncomputable def -- cyclotomicAbstractFixedFieldArtinCoordinateBridgeData -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) := -- @compRestrictNormalHomInfiniteGlobalArtinRationalCyclotomicDataOfNumberField -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) -- (inferInstance : Field -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) -- (inferInstance : Field -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H)) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelativeAlgebra H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelativeIsAbelianGalois H) -- a -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E) -- E -- (cyclotomicAbstractFixedFieldArtinCoordinateNumberField E) -- (cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois E) -- (cyclotomicAbstractFixedFieldArtinCoordinateMap H E) -- (cyclotomicAbstractFixedFieldArtinCoordinateMap_naturality H E) -- --/-- The abstract endpoint after projection to one finite coordinate. -/ --private noncomputable def -- cyclotomicAbstractFixedFieldArtinAbstractCoordinate -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Gal(E / ℚ) := -- AlgEquiv.restrictNormalHom E -- (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) -- --/-- The relative infinite Artin symbol, restricted to a finite layer and --then mapped to the corresponding rational coordinate. -/ --private noncomputable def -- cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Gal(E / ℚ) := -- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.1 -- --/-- The finite relative Artin symbol mapped to one rational coordinate. -/ --private noncomputable def -- cyclotomicAbstractFixedFieldArtinFiniteCoordinate -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Gal(E / ℚ) := -- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.1 -- --/-- The finite rational Artin coordinate of the idele norm. -/ --private noncomputable def -- cyclotomicAbstractFixedFieldArtinRationalCoordinate -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Gal(E / ℚ) := -- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.1 -- --/-- Naturality of the finite global Artin map at the concrete cyclotomic --coordinate. -/ --private theorem -- cyclotomicAbstractFixedFieldArtinCoordinateNaturality -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E = -- cyclotomicAbstractFixedFieldArtinRationalCoordinate H a E := by -- rfl -- --/-- The rational endpoint after projection to one finite coordinate. -/ --private noncomputable def -- cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- Gal(E / ℚ) := -- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.2 -- --/-- The abstract restriction map projected to the concrete finite layer. -/ --private theorem -- cyclotomicAbstractFixedFieldArtinCoordinateRestriction -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = -- cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E := by -- calc -- cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = -- AlgEquiv.restrictNormalHom E -- (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) := rfl -- _ = cyclotomicAbstractFixedFieldArtinCoordinateMap H E -- (AlgEquiv.restrictNormalHom -- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -- (infiniteGlobalArtinMonoidHom -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a)) := -- (restrictNormalHom_abstractFixedFieldCyclotomicRestriction -- H E -- (infiniteGlobalArtinMonoidHom -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a)).trans -- (cyclotomicAbstractFixedFieldArtinCoordinateMap_apply H E _).symm -- _ = cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E := rfl -- --/-- Restricting the infinite relative Artin symbol supplies exactly the --finite Artin coordinate. -/ --private theorem -- cyclotomicAbstractFixedFieldArtinCoordinateLayerProjection -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E = -- cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E := -- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).2.1 -- --/-- The rational cyclotomic Artin map projected to the same finite --coordinate. -/ --private theorem -- cyclotomicAbstractFixedFieldArtinCoordinateRationalProjection -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate H a E = -- cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E := by -- exact -- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).2.2.symm -- --/-- Equality of the two full endpoints at one opaque finite coordinate. -/ --private theorem -- cyclotomicAbstractFixedFieldArtinFiniteCoordinateComparison -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -- (E : -- FiniteGaloisIntermediateField -- ℚ rationalCyclotomicZHatField) : -- AlgEquiv.restrictNormalHom E -- (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) = -- AlgEquiv.restrictNormalHom E -- (cyclotomicAbstractFixedFieldArtinRationalEndpoint H a) := by -- change -- cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = -- cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate H a E -- exact -- cyclotomicAbstractFixedFieldArtin_eqTransThree -- (cyclotomicAbstractFixedFieldArtinCoordinateRestriction H a E) -- (cyclotomicAbstractFixedFieldArtinCoordinateLayerProjection H a E) -- (cyclotomicAbstractFixedFieldArtinCoordinateRationalProjection -- H a E).symm -- --/-- The finite-coordinate comparison assembled in the rational cyclotomic --inverse limit. -/ --private theorem -- abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtin_inverseLimit -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : -- IdeleGroup -- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : -- cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a = -- cyclotomicAbstractFixedFieldArtinRationalEndpoint H a := by -- apply -- (InfiniteGalois.continuousMulEquivToLimit -- ℚ rationalCyclotomicZHatField).injective -- apply Subtype.ext -- funext Eop -- exact -- cyclotomicAbstractFixedFieldArtinFiniteCoordinateComparison -- H a Eop.unop -- --end FiniteCoordinateHelpers -- --/-- The actual infinite global Artin map on an abstract fixed field --restricts to the rational cyclotomic Artin map of the ordinary idele --norm. -/ --@[simp] --theorem -- abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtinMonoidHom -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : -- IdeleGroup -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) : -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- letI : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- letI : NumberField F := -- NumberField.of_module_finite ℚ F -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI -- letI : IsAbelianGalois F U := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- abstractFixedFieldCyclotomicRestriction H -- (infiniteGlobalArtinMonoidHom F U a) = -- rationalCyclotomicZHatGlobalArtin -- (IdeleGroup.norm ℚ F a) := by -- exact -- abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtin_inverseLimit -- H a -- --/-- In the normalized actual Galois coordinate, the infinite global --Artin symbol is exactly the normalized cyclotomic idele value. -/ --theorem -- abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : -- IdeleGroup -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) : -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- letI : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- letI : NumberField F := -- NumberField.of_module_finite ℚ F -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI -- letI : IsAbelianGalois F U := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- Multiplicative.toAdd -- (abstractFixedFieldCyclotomicGalEquivZHat H -- (infiniteGlobalArtinMonoidHom F U a)) = -- normalizedCyclotomicZHatIdeleValue F -- (Additive.ofMul a) := by -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- let : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- let : NumberField F := -- NumberField.of_module_finite ℚ F -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI -- let : IsAbelianGalois F U := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- apply -- zHatMulNat_injective -- (H.residueDegree rationalCyclotomicDegreeData).pos -- calc -- (H.residueDegree rationalCyclotomicDegreeData : ℕ) • -- Multiplicative.toAdd -- (abstractFixedFieldCyclotomicGalEquivZHat H -- (infiniteGlobalArtinMonoidHom F U a)) = -- Multiplicative.toAdd -- (rationalCyclotomicZHatFieldGalEquivZHat -- (abstractFixedFieldCyclotomicRestriction H -- (infiniteGlobalArtinMonoidHom F U a))) := by -- exact -- (abstractFixedFieldCyclotomicRestriction_coordinate H -- (infiniteGlobalArtinMonoidHom F U a)).symm -- _ = -- Multiplicative.toAdd -- (rationalCyclotomicZHatFieldGalEquivZHat -- (rationalCyclotomicZHatGlobalArtin -- (IdeleGroup.norm ℚ F a))) := by -- rw [ -- abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtinMonoidHom] -- _ = -- cyclotomicZHatNormComposite F -- (Additive.ofMul a) := by -- rfl -- _ = -- cyclotomicZHatIntersectionDegree F • -- normalizedCyclotomicZHatIdeleValue F -- (Additive.ofMul a) := by -- exact -- (cyclotomicZHatIntersectionDegree_nsmul_normalizedIdeleValue -- F (Additive.ofMul a)).symm -- _ = -- (H.residueDegree rationalCyclotomicDegreeData : ℕ) • -- normalizedCyclotomicZHatIdeleValue F -- (Additive.ofMul a) := by -- rw [ -- cyclotomicZHatIntersectionDegree_abstractFixedField_eq_residueDegree -- H] -- --/-- Representative form of the actual cyclotomic Artin-coordinate --identity after descent of the normalized value to the idele class --group. -/ --theorem -- abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom_mk -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (a : -- IdeleGroup -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)) : -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- letI : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- letI : NumberField F := -- NumberField.of_module_finite ℚ F -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI -- letI : IsAbelianGalois F U := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- Multiplicative.toAdd -- (abstractFixedFieldCyclotomicGalEquivZHat H -- (infiniteGlobalArtinMonoidHom F U a)) = -- normalizedCyclotomicZHatIdeleClassValueContinuous F -- (Additive.ofMul -- (QuotientGroup.mk' -- (IdeleGroup.principalSubgroup F) a)) := by -- have hSeparableClosureAlgebra : -- cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra = -- rationalSeparableClosureAlgebra := -- Subsingleton.elim _ _ -- cases hSeparableClosureAlgebra -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI -- let : IsAbelianGalois F U := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- calc -- Multiplicative.toAdd -- (abstractFixedFieldCyclotomicGalEquivZHat H -- (infiniteGlobalArtinMonoidHom F U a)) = -- normalizedCyclotomicZHatIdeleValue F -- (Additive.ofMul a) := -- abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom -- H a -- _ = -- normalizedCyclotomicZHatIdeleClassValueContinuous F -- (Additive.ofMul -- (QuotientGroup.mk' -- (IdeleGroup.principalSubgroup F) a)) := -- (normalizedCyclotomicZHatIdeleClassValueContinuous_mk -- (K := F) a).symm -- --/-- The genuine infinite global Artin symbol of the cyclotomic --maximal-unramified extension kills every principal idele of the --abstract fixed field. -/ --@[simp] --theorem -- infiniteGlobalArtinMonoidHom_abstractFixedFieldCyclotomic_principalIdele -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (x : -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field)ˣ) : -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- letI : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- letI : NumberField F := -- NumberField.of_module_finite ℚ F -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI -- letI : IsAbelianGalois F U := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- infiniteGlobalArtinMonoidHom F U -- (IdeleGroup.principalIdele F x) = -- 1 := by -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H.field -- let : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- let : NumberField F := -- NumberField.of_module_finite ℚ F -- let hI := -- rationalCyclotomicFieldInertia_le H.field -- let U := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hI -- let : IsAbelianGalois F U := -- abstractFixedFieldCyclotomic_isAbelianGalois H -- have hcoord : -- Multiplicative.toAdd -- (abstractFixedFieldCyclotomicGalEquivZHat H -- (infiniteGlobalArtinMonoidHom F U -- (IdeleGroup.principalIdele F x))) = 0 := -- (abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom -- H (IdeleGroup.principalIdele F x)).trans -- (normalizedCyclotomicZHatIdeleValue_principalIdele_eq_zero F x) -- apply (abstractFixedFieldCyclotomicGalEquivZHat H).injective -- rw [map_one] -- apply Multiplicative.ext -- exact hcoord.trans toAdd_one.symm -+attribute [local instance] -+ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal -+ abstractFixedFieldCyclotomic_numberField - - /-- The genuine cyclotomic maximal-unramified Artin map descended to - the idele class group of an abstract fixed field. -/ -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinBase.lean -new file mode 100644 -index 0000000..dc971fc ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinBase.lean -@@ -0,0 +1,545 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicIdeleClassValuation -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.InfiniteGlobalArtin -+import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.MaximalUnramifiedReciprocity -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open KummerTheory -+ -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra : -+ Algebra ℚ (SeparableClosure ℚ) := -+ DivisionRing.toRatAlgebra -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra : -+ Algebra ℚ rationalCyclotomicZHatField := -+ DivisionRing.toRatAlgebra -+ -+/-- Cyclotomic field inertia is contained in the original abstract -+field subgroup. -/ -+theorem rationalCyclotomicFieldInertia_le -+ (H : ClosedSubgroup -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ (rationalCyclotomicDegreeData.fieldInertia H).toSubgroup ≤ -+ H.toSubgroup := by -+ intro σ hσ -+ exact hσ.1 -+ -+ -+theorem extensionSubgroup_rationalCyclotomicFieldInertia -+ (H : ClosedSubgroup -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ CyclicCohomology.extensionSubgroup H -+ (rationalCyclotomicDegreeData.fieldInertia H) -+ (rationalCyclotomicFieldInertia_le H) = -+ rationalCyclotomicDegreeData.fieldInertiaWithin H := by -+ ext σ -+ rw [ -+ mem_extensionSubgroup_iff, -+ rationalCyclotomicDegreeData.mem_fieldInertiaWithin_iff, -+ rationalCyclotomicDegreeData.mem_fieldInertia_iff] -+ exact and_iff_right σ.2 -+ -+/-- The actual Galois group of the cyclotomic maximal-unramified -+extension of an abstract fixed field, in its normalized `ZHat` -+coordinate. -/ -+noncomputable def abstractFixedFieldCyclotomicGalEquivZHat -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) ≃* -+ Multiplicative ZHat := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ let qField : -+ H.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI ≃* -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) := -+ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ let qInertia : -+ H.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI ≃* -+ H.field.toSubgroup ⧸ -+ rationalCyclotomicDegreeData.fieldInertiaWithin H.field := -+ QuotientGroup.quotientMulEquivOfEq -+ (extensionSubgroup_rationalCyclotomicFieldInertia H.field) -+ exact -+ qField.symm.trans -+ (qInertia.trans -+ (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -+ (H.toFiniteResidueAbstractField -+ rationalCyclotomicDegreeData))) -+ -+/-- On an absolute-Galois representative fixing the lower field, the -+actual cyclotomic Galois coordinate is its normalized degree. -/ -+@[simp] -+theorem abstractFixedFieldCyclotomicGalEquivZHat_extensionClass -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (σ : H.field.toSubgroup) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ abstractFixedFieldCyclotomicGalEquivZHat H -+ (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ (QuotientGroup.mk σ)) = -+ rationalCyclotomicDegreeData.normalizedDegree -+ (H.toFiniteResidueAbstractField -+ rationalCyclotomicDegreeData) σ := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ let qField := -+ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ change -+ (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -+ (H.toFiniteResidueAbstractField -+ rationalCyclotomicDegreeData)) -+ (QuotientGroup.quotientMulEquivOfEq -+ (extensionSubgroup_rationalCyclotomicFieldInertia H.field) -+ (qField.symm (qField (QuotientGroup.mk σ)))) = -+ rationalCyclotomicDegreeData.normalizedDegree -+ (H.toFiniteResidueAbstractField -+ rationalCyclotomicDegreeData) σ -+ rw [qField.symm_apply_apply] -+ rfl -+ -+/-- Quotient-level evaluation of the actual cyclotomic Galois -+coordinate. -/ -+@[simp] -+theorem abstractFixedFieldCyclotomicGalEquivZHat_quotientClass -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (q : -+ H.field.toSubgroup ⧸ -+ rationalCyclotomicDegreeData.fieldInertiaWithin H.field) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ let qInertia : -+ H.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI ≃* -+ H.field.toSubgroup ⧸ -+ rationalCyclotomicDegreeData.fieldInertiaWithin H.field := -+ QuotientGroup.quotientMulEquivOfEq -+ (extensionSubgroup_rationalCyclotomicFieldInertia H.field) -+ abstractFixedFieldCyclotomicGalEquivZHat H -+ (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ (qInertia.symm q)) = -+ rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -+ (H.toFiniteResidueAbstractField -+ rationalCyclotomicDegreeData) q := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ let qField := -+ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ let qInertia : -+ H.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI ≃* -+ H.field.toSubgroup ⧸ -+ rationalCyclotomicDegreeData.fieldInertiaWithin H.field := -+ QuotientGroup.quotientMulEquivOfEq -+ (extensionSubgroup_rationalCyclotomicFieldInertia H.field) -+ change -+ (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -+ (H.toFiniteResidueAbstractField -+ rationalCyclotomicDegreeData)) -+ (qInertia -+ (qField.symm -+ (qField (qInertia.symm q)))) = -+ rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv -+ (H.toFiniteResidueAbstractField -+ rationalCyclotomicDegreeData) q -+ rw [qField.symm_apply_apply, qInertia.apply_symm_apply] -+ -+/-- The extension fixed by cyclotomic field inertia is an actual -+abelian Galois extension of the lower abstract fixed field. -/ -+theorem abstractFixedFieldCyclotomic_isAbelianGalois -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ IsAbelianGalois -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ let : IsGalois -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) := -+ LocalClassFieldTheory.abstractRelativeFixedField_isGalois -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ let e := -+ abstractFixedFieldCyclotomicGalEquivZHat H -+ exact -+ { is_comm.comm := by -+ intro σ τ -+ apply e.injective -+ simpa only [map_mul] using mul_comm (e σ) (e τ) } -+ -+/-- The rational cyclotomic `ZHat`-field embedded in the actual -+maximal-unramified compositum of an abstract fixed field. -/ -+noncomputable def -+ rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ rationalCyclotomicZHatField →ₐ[ℚ] -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let J := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ have hTJ : -+ rationalCyclotomicZHatField ≤ J := by -+ change -+ rationalCyclotomicZHatField ≤ -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ rw [ -+ rationalCyclotomicDegreeData_fixedField_fieldInertia] -+ exact le_sup_right -+ exact IntermediateField.inclusion hTJ -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicCompositum_algebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ Algebra rationalCyclotomicZHatField -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) := -+ ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H).toRingHom).toAlgebra -+ -+instance abstractFixedFieldCyclotomicCompositum_scalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ IsScalarTower ℚ rationalCyclotomicZHatField -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) := -+ IsScalarTower.of_algebraMap_eq' -+ ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H).comp_algebraMap).symm -+ -+instance abstractFixedFieldCyclotomicCompositum_baseScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ IsScalarTower ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ apply IsScalarTower.of_algebraMap_eq -+ intro x -+ apply Subtype.ext -+ rfl -+ -+/-- Restriction from the actual maximal-unramified compositum of an -+abstract fixed field to the rational cyclotomic factor. -/ -+noncomputable def abstractFixedFieldCyclotomicRestriction -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) →* -+ Gal(rationalCyclotomicZHatField / ℚ) := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ exact -+ IntermediateField.restrictRestrictAlgEquivMapHom -+ ℚ rationalCyclotomicZHatField -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) -+ -+/-- On a quotient representative, cyclotomic restriction of the -+actual relative automorphism is ordinary restriction of the same -+ambient absolute-Galois automorphism. -/ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal : -+ Normal ℚ rationalCyclotomicZHatField := -+ rationalCyclotomicZHatField_isNormal -+ -+@[simp] -+theorem abstractFixedFieldCyclotomicRestriction_extensionClass -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (σ : H.field.toSubgroup) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ abstractFixedFieldCyclotomicRestriction H -+ (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ (QuotientGroup.mk σ)) = -+ AlgEquiv.restrictNormalHom -+ rationalCyclotomicZHatField σ.1 := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ let τ := -+ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ (QuotientGroup.mk' -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) hI) -+ σ) -+ apply AlgEquiv.ext -+ intro x -+ apply Subtype.ext -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI -+ have hrestrict : -+ algebraMap rationalCyclotomicZHatField U -+ ((abstractFixedFieldCyclotomicRestriction H τ) x) = -+ τ (algebraMap rationalCyclotomicZHatField U x) := by -+ change -+ algebraMap rationalCyclotomicZHatField U -+ ((AlgEquiv.restrictNormal -+ (MulSemiringAction.toAlgEquiv ℚ U τ) -+ rationalCyclotomicZHatField) x) = -+ (MulSemiringAction.toAlgEquiv ℚ U τ) -+ (algebraMap rationalCyclotomicZHatField U x) -+ exact -+ AlgEquiv.restrictNormal_commutes -+ (MulSemiringAction.toAlgEquiv ℚ U τ) -+ rationalCyclotomicZHatField x -+ have halgebraMap_eq_embedding -+ (z : rationalCyclotomicZHatField) : -+ algebraMap rationalCyclotomicZHatField U z = -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H z : U) := by -+ rfl -+ have hembedding_coe -+ (z : rationalCyclotomicZHatField) : -+ (((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H z : U) : SeparableClosure ℚ)) = -+ (z : SeparableClosure ℚ) := by -+ rfl -+ have halgebraMap_coe -+ (z : rationalCyclotomicZHatField) : -+ ((algebraMap rationalCyclotomicZHatField U z : U) : -+ SeparableClosure ℚ) = -+ (z : SeparableClosure ℚ) := by -+ rw [halgebraMap_eq_embedding] -+ exact hembedding_coe z -+ have hambient := -+ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup_mk_apply_val -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal σ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H x) -+ calc -+ (((abstractFixedFieldCyclotomicRestriction H τ) x : -+ rationalCyclotomicZHatField) : -+ SeparableClosure ℚ) = -+ ((τ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H x) : -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) : -+ SeparableClosure ℚ) := by -+ calc -+ (((abstractFixedFieldCyclotomicRestriction H τ) x : -+ rationalCyclotomicZHatField) : SeparableClosure ℚ) = -+ ((algebraMap rationalCyclotomicZHatField U -+ ((abstractFixedFieldCyclotomicRestriction H τ) x) : U) : -+ SeparableClosure ℚ) := -+ (halgebraMap_coe -+ ((abstractFixedFieldCyclotomicRestriction H τ) x)).symm -+ _ = ((τ (algebraMap rationalCyclotomicZHatField U x) : U) : -+ SeparableClosure ℚ) := -+ congrArg (fun y : U => (y : SeparableClosure ℚ)) hrestrict -+ _ = ((τ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H x) : U) : SeparableClosure ℚ) := by -+ rw [halgebraMap_eq_embedding] -+ _ = σ.1 (x : SeparableClosure ℚ) := by -+ calc -+ ((τ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H x) : U) : SeparableClosure ℚ) = -+ σ.1 -+ ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H x : U) : SeparableClosure ℚ) := by -+ simpa only [τ, U] using hambient.symm -+ _ = σ.1 (x : SeparableClosure ℚ) := by -+ rw [hembedding_coe] -+ _ = -+ (((AlgEquiv.restrictNormalHom -+ rationalCyclotomicZHatField σ.1) x : -+ rationalCyclotomicZHatField) : -+ SeparableClosure ℚ) := by -+ exact -+ (AlgEquiv.restrictNormal_commutes -+ σ.1 rationalCyclotomicZHatField x).symm -+ -+/-- Raw cyclotomic restriction is residue-degree multiplication of -+the normalized actual Galois coordinate. -/ -+theorem -+ abstractFixedFieldCyclotomicRestriction_coordinate -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (τ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) : -+ Multiplicative.toAdd -+ (rationalCyclotomicZHatFieldGalEquivZHat -+ (abstractFixedFieldCyclotomicRestriction H τ)) = -+ (H.residueDegree rationalCyclotomicDegreeData : ℕ) • -+ Multiplicative.toAdd -+ (abstractFixedFieldCyclotomicGalEquivZHat H τ) := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let hnormal : -+ (CyclicCohomology.extensionSubgroup H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI).Normal := by -+ rw [extensionSubgroup_rationalCyclotomicFieldInertia] -+ infer_instance -+ let qField := -+ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) H.field -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ hI hnormal -+ obtain ⟨q, rfl⟩ := qField.surjective τ -+ refine Quotient.inductionOn' q ?_ -+ intro σ -+ rw [ -+ abstractFixedFieldCyclotomicRestriction_extensionClass, -+ abstractFixedFieldCyclotomicGalEquivZHat_extensionClass] -+ exact -+ (rationalCyclotomicDegreeData.residueDegree_nsmul_normalizedDegree -+ (H.toFiniteResidueAbstractField -+ rationalCyclotomicDegreeData) σ).symm -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinComparison.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinComparison.lean -new file mode 100644 -index 0000000..0788ef1 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinComparison.lean -@@ -0,0 +1,273 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinCoordinates -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open KummerTheory -+ -+attribute [local instance] -+ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal -+ abstractFixedFieldCyclotomic_numberField -+ -+/-- The actual infinite global Artin map on an abstract fixed field -+restricts to the rational cyclotomic Artin map of the ordinary idele -+norm. -/ -+@[simp] -+theorem -+ abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtinMonoidHom -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : -+ IdeleGroup -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) : -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ letI : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ letI : NumberField F := -+ NumberField.of_module_finite ℚ F -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI -+ letI : IsAbelianGalois F U := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ abstractFixedFieldCyclotomicRestriction H -+ (infiniteGlobalArtinMonoidHom F U a) = -+ rationalCyclotomicZHatGlobalArtin -+ (IdeleGroup.norm ℚ F a) := by -+ exact -+ abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtin_inverseLimit -+ H a -+ -+/-- In the normalized actual Galois coordinate, the infinite global -+Artin symbol is exactly the normalized cyclotomic idele value. -/ -+theorem -+ abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : -+ IdeleGroup -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) : -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ letI : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ letI : NumberField F := -+ NumberField.of_module_finite ℚ F -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI -+ letI : IsAbelianGalois F U := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ Multiplicative.toAdd -+ (abstractFixedFieldCyclotomicGalEquivZHat H -+ (infiniteGlobalArtinMonoidHom F U a)) = -+ normalizedCyclotomicZHatIdeleValue F -+ (Additive.ofMul a) := by -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ let : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ let : NumberField F := -+ NumberField.of_module_finite ℚ F -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI -+ let : IsAbelianGalois F U := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ apply -+ zHatMulNat_injective -+ (H.residueDegree rationalCyclotomicDegreeData).pos -+ calc -+ (H.residueDegree rationalCyclotomicDegreeData : ℕ) • -+ Multiplicative.toAdd -+ (abstractFixedFieldCyclotomicGalEquivZHat H -+ (infiniteGlobalArtinMonoidHom F U a)) = -+ Multiplicative.toAdd -+ (rationalCyclotomicZHatFieldGalEquivZHat -+ (abstractFixedFieldCyclotomicRestriction H -+ (infiniteGlobalArtinMonoidHom F U a))) := by -+ exact -+ (abstractFixedFieldCyclotomicRestriction_coordinate H -+ (infiniteGlobalArtinMonoidHom F U a)).symm -+ _ = -+ Multiplicative.toAdd -+ (rationalCyclotomicZHatFieldGalEquivZHat -+ (rationalCyclotomicZHatGlobalArtin -+ (IdeleGroup.norm ℚ F a))) := by -+ rw [ -+ abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtinMonoidHom] -+ _ = -+ cyclotomicZHatNormComposite F -+ (Additive.ofMul a) := by -+ rfl -+ _ = -+ cyclotomicZHatIntersectionDegree F • -+ normalizedCyclotomicZHatIdeleValue F -+ (Additive.ofMul a) := by -+ exact -+ (cyclotomicZHatIntersectionDegree_nsmul_normalizedIdeleValue -+ F (Additive.ofMul a)).symm -+ _ = -+ (H.residueDegree rationalCyclotomicDegreeData : ℕ) • -+ normalizedCyclotomicZHatIdeleValue F -+ (Additive.ofMul a) := by -+ rw [ -+ cyclotomicZHatIntersectionDegree_abstractFixedField_eq_residueDegree -+ H] -+ -+/-- Representative form of the actual cyclotomic Artin-coordinate -+identity after descent of the normalized value to the idele class -+group. -/ -+theorem -+ abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom_mk -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : -+ IdeleGroup -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) : -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ letI : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ letI : NumberField F := -+ NumberField.of_module_finite ℚ F -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI -+ letI : IsAbelianGalois F U := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ Multiplicative.toAdd -+ (abstractFixedFieldCyclotomicGalEquivZHat H -+ (infiniteGlobalArtinMonoidHom F U a)) = -+ normalizedCyclotomicZHatIdeleClassValueContinuous F -+ (Additive.ofMul -+ (QuotientGroup.mk' -+ (IdeleGroup.principalSubgroup F) a)) := by -+ have hSeparableClosureAlgebra : -+ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra = -+ rationalSeparableClosureAlgebra := -+ Subsingleton.elim _ _ -+ cases hSeparableClosureAlgebra -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI -+ let : IsAbelianGalois F U := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ calc -+ Multiplicative.toAdd -+ (abstractFixedFieldCyclotomicGalEquivZHat H -+ (infiniteGlobalArtinMonoidHom F U a)) = -+ normalizedCyclotomicZHatIdeleValue F -+ (Additive.ofMul a) := -+ abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom -+ H a -+ _ = -+ normalizedCyclotomicZHatIdeleClassValueContinuous F -+ (Additive.ofMul -+ (QuotientGroup.mk' -+ (IdeleGroup.principalSubgroup F) a)) := -+ (normalizedCyclotomicZHatIdeleClassValueContinuous_mk -+ (K := F) a).symm -+ -+/-- The genuine infinite global Artin symbol of the cyclotomic -+maximal-unramified extension kills every principal idele of the -+abstract fixed field. -/ -+@[simp] -+theorem -+ infiniteGlobalArtinMonoidHom_abstractFixedFieldCyclotomic_principalIdele -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (x : -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)ˣ) : -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ letI : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ letI : NumberField F := -+ NumberField.of_module_finite ℚ F -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI -+ letI : IsAbelianGalois F U := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ infiniteGlobalArtinMonoidHom F U -+ (IdeleGroup.principalIdele F x) = -+ 1 := by -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ let : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ let : NumberField F := -+ NumberField.of_module_finite ℚ F -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI -+ let : IsAbelianGalois F U := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ have hcoord : -+ Multiplicative.toAdd -+ (abstractFixedFieldCyclotomicGalEquivZHat H -+ (infiniteGlobalArtinMonoidHom F U -+ (IdeleGroup.principalIdele F x))) = 0 := -+ (abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom -+ H (IdeleGroup.principalIdele F x)).trans -+ (normalizedCyclotomicZHatIdeleValue_principalIdele_eq_zero F x) -+ apply (abstractFixedFieldCyclotomicGalEquivZHat H).injective -+ rw [map_one] -+ apply Multiplicative.ext -+ exact hcoord.trans toAdd_one.symm -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCompositum.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCompositum.lean -new file mode 100644 -index 0000000..1295a7e ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCompositum.lean -@@ -0,0 +1,257 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinBase -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open KummerTheory -+ -+attribute [local instance] -+ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal -+ -+/-- The canonical compositum of an abstract fixed field with a finite -+layer of the rational cyclotomic `ZHat`-extension. -/ -+def abstractFixedFieldCyclotomicFiniteCompositum -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IntermediateField ℚ (SeparableClosure ℚ) := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field ⊔ -+ IntermediateField.lift E.toIntermediateField -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteCompositum_finiteDimensional -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ FiniteDimensional ℚ -+ (abstractFixedFieldCyclotomicFiniteCompositum H E) := by -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ let : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ let : FiniteDimensional ℚ -+ (IntermediateField.lift E.toIntermediateField) := -+ ((IntermediateField.liftAlgEquiv -+ E.toIntermediateField).toLinearEquiv).finiteDimensional -+ exact IntermediateField.finiteDimensional_sup -+ F (IntermediateField.lift E.toIntermediateField) -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteCompositum_numberField -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ NumberField -+ (abstractFixedFieldCyclotomicFiniteCompositum H E) := -+ NumberField.of_module_finite ℚ -+ (abstractFixedFieldCyclotomicFiniteCompositum H E) -+ -+/-- The lower abstract fixed field embedded into its finite -+cyclotomic compositum. -/ -+noncomputable def -+ abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field →ₐ[ℚ] -+ abstractFixedFieldCyclotomicFiniteCompositum H E := -+ IntermediateField.inclusion -+ (show -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field ≤ -+ abstractFixedFieldCyclotomicFiniteCompositum H E from -+ le_sup_left) -+ -+ -+noncomputable local instance -+ abstractFixedFieldCyclotomic_numberField -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ NumberField -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) := by -+ let : FiniteDimensional ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ exact -+ NumberField.of_module_finite ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ -+/-- A finite rational cyclotomic layer embedded into its compositum -+with the abstract fixed field. -/ -+noncomputable def -+ abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ E →ₐ[ℚ] -+ abstractFixedFieldCyclotomicFiniteCompositum H E := -+ (IntermediateField.inclusion -+ (show -+ IntermediateField.lift E.toIntermediateField ≤ -+ abstractFixedFieldCyclotomicFiniteCompositum H E from -+ le_sup_right)).comp -+ (IntermediateField.liftAlgEquiv E.toIntermediateField).toAlgHom -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteCompositum_baseAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteCompositum H E) := -+ RingHom.toAlgebra -+ (AlgHom.toRingHom -+ (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E)) -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteCompositum_layerAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra E -+ (abstractFixedFieldCyclotomicFiniteCompositum H E) := -+ RingHom.toAlgebra -+ (AlgHom.toRingHom -+ (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E)) -+ -+/-- The finite-layer action induced by its explicit embedding into the -+finite compositum. -/ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteCompositum_layerSMul -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ SMul E -+ (abstractFixedFieldCyclotomicFiniteCompositum H E) := -+ Algebra.toSMul -+ (self := -+ abstractFixedFieldCyclotomicFiniteCompositum_layerAlgebra H E) -+ -+instance -+ abstractFixedFieldCyclotomicFiniteCompositum_baseScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsScalarTower ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteCompositum H E) := -+ IsScalarTower.of_algebraMap_eq' -+ (AlgHom.comp_algebraMap -+ (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E)).symm -+ -+instance -+ abstractFixedFieldCyclotomicFiniteCompositum_layerScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsScalarTower ℚ E -+ (abstractFixedFieldCyclotomicFiniteCompositum H E) := -+ IsScalarTower.of_algebraMap_eq' -+ (AlgHom.comp_algebraMap -+ (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E)).symm -+ -+/-- Inclusion of the finite cyclotomic compositum into the actual -+maximal-unramified compositum. -/ -+noncomputable def -+ abstractFixedFieldCyclotomicFiniteCompositumInclusion -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ abstractFixedFieldCyclotomicFiniteCompositum H E →ₐ[ℚ] -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let J := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicDegreeData.fieldInertia H.field) -+ have hle : -+ abstractFixedFieldCyclotomicFiniteCompositum H E ≤ J := by -+ dsimp only [J] -+ rw [ -+ rationalCyclotomicDegreeData_fixedField_fieldInertia H.field] -+ exact -+ sup_le_sup le_rfl -+ (IntermediateField.lift_le E.toIntermediateField) -+ exact IntermediateField.inclusion hle -+ -+/-- The same finite-compositum inclusion over the lower abstract fixed -+field. -/ -+noncomputable def -+ abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ abstractFixedFieldCyclotomicFiniteCompositum H E →ₐ[ -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field] -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI := by -+ let f := -+ abstractFixedFieldCyclotomicFiniteCompositumInclusion H E -+ exact -+ { f.toRingHom with -+ commutes' := by -+ intro x -+ rfl } -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCoordinates.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCoordinates.lean -new file mode 100644 -index 0000000..64ed13e ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCoordinates.lean -@@ -0,0 +1,668 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinFiniteRestriction -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open KummerTheory -+ -+attribute [local instance] -+ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal -+ abstractFixedFieldCyclotomic_numberField -+ -+section FiniteCoordinateHelpers -+ -+/-- Opaque three-step equality composition used to keep large dependent -+finite-level coordinates out of endpoint proof normalization. -/ -+private theorem cyclotomicAbstractFixedFieldArtin_eqTransThree -+ {α : Type} {a b c d : α} -+ (hab : a = b) (hbc : b = c) (hcd : c = d) : -+ a = d := -+ hab.trans (hbc.trans hcd) -+ -+private abbrev cyclotomicAbstractFixedFieldArtinCoordinateBase -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ -+private abbrev cyclotomicAbstractFixedFieldArtinCoordinateRelative -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) -+ -+private abbrev cyclotomicAbstractFixedFieldArtinCoordinateLayer -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IntermediateField -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -+ abstractFixedFieldCyclotomicFiniteLayer H E -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ Algebra ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H).algebra' -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateBaseFiniteDimensional -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ FiniteDimensional ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ NumberField -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := -+ NumberField.of_module_finite ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateBaseSeparableAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ Algebra -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (SeparableClosure ℚ) := -+ IntermediateField.toAlgebra -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateRelativeAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ Algebra -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H).algebra' -+ -+local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateRelativeScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ IsScalarTower ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -+ abstractFixedFieldCyclotomicCompositum_baseScalarTower H -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateRelativeIsAbelianGalois -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : -+ IsAbelianGalois -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateAlgebra -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra ℚ E := -+ E.toIntermediateField.algebra' -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateNumberField -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ NumberField E := -+ NumberField.of_module_finite ℚ E -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsAbelianGalois ℚ E := -+ IsAbelianGalois.of_algHom E.toIntermediateField.val -+ -+local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateNormal -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Normal ℚ E := -+ E.isGalois.to_normal -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).algebra' -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -+ DivisionRing.toRatAlgebra -+ -+local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsScalarTower ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := by -+ let hI := rationalCyclotomicFieldInertia_le H.field -+ apply IsScalarTower.of_algebraMap_eq -+ intro x -+ apply Subtype.ext -+ change -+ algebraMap ℚ -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) x = -+ algebraMap -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) -+ (algebraMap ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) x) -+ exact -+ IsScalarTower.algebraMap_apply -+ ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) x -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ NumberField -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) := -+ abstractFixedFieldCyclotomicFiniteLayer_numberField H E -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra E -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -+ abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerSMul -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ SMul E -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -+ abstractFixedFieldCyclotomicFiniteLayer_layerSMul H E -+ -+local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsScalarTower ℚ E -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -+ abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower H E -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerRelativeAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -+ IntermediateField.toAlgebra -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) -+ -+local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerRelativeScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsScalarTower -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := -+ abstractFixedFieldCyclotomicFiniteGaloisLayer_scalarTower H E -+ -+noncomputable local instance -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsAbelianGalois -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := -+ abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E -+ -+/-- The full abstract Artin symbol whose finite coordinates are compared -+below. Naming this endpoint keeps its relative fixed-field data opaque. -/ -+private noncomputable def -+ cyclotomicAbstractFixedFieldArtinAbstractEndpoint -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : -+ Gal(rationalCyclotomicZHatField / ℚ) := -+ abstractFixedFieldCyclotomicRestriction H -+ (infiniteGlobalArtinMonoidHom -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a) -+ -+/-- The rational norm Artin symbol serving as the other full endpoint. -/ -+private noncomputable def -+ cyclotomicAbstractFixedFieldArtinRationalEndpoint -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : -+ Gal(rationalCyclotomicZHatField / ℚ) := -+ rationalCyclotomicZHatGlobalArtin -+ (IdeleGroup.norm ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) a) -+ -+ -+private noncomputable def cyclotomicAbstractFixedFieldArtinCoordinateMapData -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ {f : Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / -+ cyclotomicAbstractFixedFieldArtinCoordinateBase H) →* -+ Gal(E / ℚ) // -+ f.comp -+ (@globalArtinMonoidHomOfNumberField -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -+ (inferInstance : Field -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) -+ (inferInstance : Field -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E)) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E)) = -+ (globalArtinMonoidHom (K := ℚ) (L := E)).comp -+ (IdeleGroup.norm ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H))} := by -+ have hnat := -+ @globalArtinMonoidHomOfNumberField_norm_restriction -+ ℚ E -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -+ inferInstance inferInstance -+ inferInstance -+ (cyclotomicAbstractFixedFieldArtinCoordinateNumberField E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois E) -+ inferInstance -+ (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) -+ inferInstance -+ (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E) -+ exact -+ ⟨(@AlgEquiv.restrictNormalHom -+ ℚ inferInstance -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -+ inferInstance -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) -+ E inferInstance -+ (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateNormal E)).comp -+ (@AlgEquiv.restrictScalarsHom -+ ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -+ inferInstance inferInstance inferInstance -+ (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E)), -+ hnat⟩ -+ -+/-- The fixed restriction map from the relative finite layer to one rational -+cyclotomic coordinate. -/ -+private noncomputable def cyclotomicAbstractFixedFieldArtinCoordinateMap -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / -+ cyclotomicAbstractFixedFieldArtinCoordinateBase H) →* -+ Gal(E / ℚ) := -+ (cyclotomicAbstractFixedFieldArtinCoordinateMapData H E).1 -+ -+ -+private theorem cyclotomicAbstractFixedFieldArtinCoordinateMap_naturality -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ (cyclotomicAbstractFixedFieldArtinCoordinateMap H E).comp -+ (globalArtinMonoidHom -+ (K := cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (L := abstractFixedFieldCyclotomicFiniteGaloisLayer H E)) = -+ (globalArtinMonoidHom (K := ℚ) (L := E)).comp -+ (IdeleGroup.norm ℚ -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) := -+ (cyclotomicAbstractFixedFieldArtinCoordinateMapData H E).2 -+ -+/-- Pointwise identification of the named coordinate map with the concrete -+two-stage restriction used by the abstract fixed-field comparison. -/ -+private theorem cyclotomicAbstractFixedFieldArtinCoordinateMap_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ (σ : Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / -+ cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : -+ cyclotomicAbstractFixedFieldArtinCoordinateMap H E σ = -+ @IntermediateField.restrictRestrictAlgEquivMapHom -+ ℚ E -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -+ inferInstance inferInstance inferInstance inferInstance -+ (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateNormal E) σ := -+ rfl -+ -+/-- The relative projection, common rational finite value, and rational -+infinite projection, with both comparison steps packaged by the generic -+provider before this concrete tower becomes opaque. -/ -+private noncomputable def -+ cyclotomicAbstractFixedFieldArtinCoordinateBridgeData -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) := -+ @compRestrictNormalHomInfiniteGlobalArtinRationalCyclotomicDataOfNumberField -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) -+ (inferInstance : Field -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) -+ (inferInstance : Field -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H)) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelativeAlgebra H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelativeIsAbelianGalois H) -+ a -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E) -+ E -+ (cyclotomicAbstractFixedFieldArtinCoordinateNumberField E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateMap H E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateMap_naturality H E) -+ -+/-- The abstract endpoint after projection to one finite coordinate. -/ -+private noncomputable def -+ cyclotomicAbstractFixedFieldArtinAbstractCoordinate -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Gal(E / ℚ) := -+ AlgEquiv.restrictNormalHom E -+ (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) -+ -+/-- The relative infinite Artin symbol, restricted to a finite layer and -+then mapped to the corresponding rational coordinate. -/ -+private noncomputable def -+ cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Gal(E / ℚ) := -+ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.1 -+ -+/-- The finite relative Artin symbol mapped to one rational coordinate. -/ -+private noncomputable def -+ cyclotomicAbstractFixedFieldArtinFiniteCoordinate -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Gal(E / ℚ) := -+ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.1 -+ -+/-- The finite rational Artin coordinate of the idele norm. -/ -+private noncomputable def -+ cyclotomicAbstractFixedFieldArtinRationalCoordinate -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Gal(E / ℚ) := -+ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.1 -+ -+/-- Naturality of the finite global Artin map at the concrete cyclotomic -+coordinate. -/ -+private theorem -+ cyclotomicAbstractFixedFieldArtinCoordinateNaturality -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E = -+ cyclotomicAbstractFixedFieldArtinRationalCoordinate H a E := by -+ rfl -+ -+/-- The rational endpoint after projection to one finite coordinate. -/ -+private noncomputable def -+ cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Gal(E / ℚ) := -+ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.2 -+ -+/-- The abstract restriction map projected to the concrete finite layer. -/ -+private theorem -+ cyclotomicAbstractFixedFieldArtinCoordinateRestriction -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = -+ cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E := by -+ calc -+ cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = -+ AlgEquiv.restrictNormalHom E -+ (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) := rfl -+ _ = cyclotomicAbstractFixedFieldArtinCoordinateMap H E -+ (AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -+ (infiniteGlobalArtinMonoidHom -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a)) := -+ (restrictNormalHom_abstractFixedFieldCyclotomicRestriction -+ H E -+ (infiniteGlobalArtinMonoidHom -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a)).trans -+ (cyclotomicAbstractFixedFieldArtinCoordinateMap_apply H E _).symm -+ _ = cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E := rfl -+ -+/-- Restricting the infinite relative Artin symbol supplies exactly the -+finite Artin coordinate. -/ -+private theorem -+ cyclotomicAbstractFixedFieldArtinCoordinateLayerProjection -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E = -+ cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E := -+ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).2.1 -+ -+/-- The rational cyclotomic Artin map projected to the same finite -+coordinate. -/ -+private theorem -+ cyclotomicAbstractFixedFieldArtinCoordinateRationalProjection -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate H a E = -+ cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E := by -+ exact -+ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).2.2.symm -+ -+/-- Equality of the two full endpoints at one opaque finite coordinate. -/ -+private theorem -+ cyclotomicAbstractFixedFieldArtinFiniteCoordinateComparison -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ AlgEquiv.restrictNormalHom E -+ (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) = -+ AlgEquiv.restrictNormalHom E -+ (cyclotomicAbstractFixedFieldArtinRationalEndpoint H a) := by -+ change -+ cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = -+ cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate H a E -+ exact -+ cyclotomicAbstractFixedFieldArtin_eqTransThree -+ (cyclotomicAbstractFixedFieldArtinCoordinateRestriction H a E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateLayerProjection H a E) -+ (cyclotomicAbstractFixedFieldArtinCoordinateRationalProjection -+ H a E).symm -+ -+/-- The finite-coordinate comparison assembled in the rational cyclotomic -+inverse limit. -/ -+theorem -+ abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtin_inverseLimit -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (a : -+ IdeleGroup -+ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : -+ cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a = -+ cyclotomicAbstractFixedFieldArtinRationalEndpoint H a := by -+ apply -+ (InfiniteGalois.continuousMulEquivToLimit -+ ℚ rationalCyclotomicZHatField).injective -+ apply Subtype.ext -+ funext Eop -+ exact -+ cyclotomicAbstractFixedFieldArtinFiniteCoordinateComparison -+ H a Eop.unop -+ -+end FiniteCoordinateHelpers -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteLayer.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteLayer.lean -new file mode 100644 -index 0000000..0ee433c ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteLayer.lean -@@ -0,0 +1,298 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinCompositum -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open KummerTheory -+ -+attribute [local instance] -+ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal -+ abstractFixedFieldCyclotomic_numberField -+ -+/-- The finite cyclotomic compositum as an intermediate field of the -+actual maximal-unramified extension. -/ -+noncomputable def abstractFixedFieldCyclotomicFiniteLayer -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ IntermediateField -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) := -+ (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase H E).fieldRange -+ -+/-- The base algebra on the finite field range, obtained from the -+explicit base embedding followed by the field-range equivalence. -/ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := -+ RingHom.toAlgebra -+ ((AlgHom.toRingHom -+ (AlgEquiv.toAlgHom -+ (AlgHom.equivFieldRange -+ (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase -+ H E)))).comp -+ (AlgHom.toRingHom -+ (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E))) -+ -+/-- The scalar action belonging to the canonical base algebra on the -+finite field range. -/ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteLayer_baseSMul -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ SMul -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := -+ Algebra.toSMul -+ (self := abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E) -+ -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteLayer_baseModule -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Module -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := -+ @Algebra.toModule -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ _ _ -+ (abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E) -+ -+/-- The field-range equivalence rebuilt over the explicit base -+algebras. Its underlying ring equivalence is the canonical one. -/ -+noncomputable def -+ abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ abstractFixedFieldCyclotomicFiniteCompositum H E ≃ₐ[ -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field] -+ abstractFixedFieldCyclotomicFiniteLayer H E := -+ AlgEquiv.ofRingEquiv -+ (f := -+ (AlgHom.equivFieldRange -+ (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase -+ H E)).toRingEquiv) -+ (fun _ => rfl) -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteLayer_finiteDimensional -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ FiniteDimensional -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := -+ (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer -+ H E).toLinearEquiv.finiteDimensional -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteLayer_numberField -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ NumberField -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := -+ NumberField.of_module_finite -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsAbelianGalois -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ let : IsAbelianGalois -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) := -+ abstractFixedFieldCyclotomic_isAbelianGalois H -+ exact -+ IsAbelianGalois.of_algHom -+ ((abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase -+ H E).comp -+ (AlgEquiv.toAlgHom -+ (AlgEquiv.symm -+ (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer -+ H E)))) -+ -+instance -+ abstractFixedFieldCyclotomicFiniteLayer_baseScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsScalarTower ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := by -+ let hI := -+ rationalCyclotomicFieldInertia_le H.field -+ apply IsScalarTower.of_algebraMap_eq -+ intro x -+ apply Subtype.ext -+ change -+ algebraMap ℚ -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) x = -+ algebraMap -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) -+ (algebraMap ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) x) -+ exact -+ IsScalarTower.algebraMap_apply -+ ℚ -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hI) x -+ -+/-- The finite rational layer embedded into its corresponding -+intermediate field over the abstract fixed field. -/ -+noncomputable def -+ abstractFixedFieldCyclotomicFiniteLayerEmbedding -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ E →ₐ[ℚ] -+ abstractFixedFieldCyclotomicFiniteLayer H E := by -+ exact -+ (AlgEquiv.toAlgHom -+ (AlgEquiv.restrictScalars ℚ -+ (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer -+ H E))).comp -+ (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E) -+ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ Algebra E -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := -+ RingHom.toAlgebra -+ (AlgHom.toRingHom -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E)) -+ -+/-- The finite-layer action on its actual image in the relative fixed -+field. -/ -+noncomputable instance -+ abstractFixedFieldCyclotomicFiniteLayer_layerSMul -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ SMul E -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := -+ Algebra.toSMul -+ (self := abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E) -+ -+instance -+ abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsScalarTower ℚ E -+ (abstractFixedFieldCyclotomicFiniteLayer H E) := -+ IsScalarTower.of_algebraMap_eq' -+ (AlgHom.comp_algebraMap -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E)).symm -+ -+/-- The finite cyclotomic layer as an object of the finite-Galois -+inverse system of the actual maximal-unramified extension. -/ -+@[reducible] -+noncomputable def -+ abstractFixedFieldCyclotomicFiniteGaloisLayer -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ FiniteGaloisIntermediateField -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field)) where -+ toIntermediateField := -+ abstractFixedFieldCyclotomicFiniteLayer H E -+ finiteDimensional := -+ abstractFixedFieldCyclotomicFiniteLayer_finiteDimensional H E -+ isGalois := -+ (abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E).toIsGalois -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteRestriction.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteRestriction.lean -new file mode 100644 -index 0000000..bcfbbc2 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteRestriction.lean -@@ -0,0 +1,462 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinFiniteLayer -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open KummerTheory -+ -+attribute [local instance] -+ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra -+ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal -+ abstractFixedFieldCyclotomic_numberField -+ -+/-- The explicit base algebra on a finite cyclotomic layer is the canonical -+intermediate-field inclusion used by the finite Galois inverse system. -/ -+theorem abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra_eq_algebra' -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E = -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).algebra' := by -+ apply Algebra.algebra_ext -+ intro x -+ apply Subtype.ext -+ rfl -+ -+/-- The finite Galois layer uses its canonical inclusion into the full -+relative fixed field for the upper scalar action. -/ -+instance -+ abstractFixedFieldCyclotomicFiniteGaloisLayer_scalarTower -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ IsScalarTower -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).toIntermediateField -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field)) := by -+ let i : -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer -+ H E).toIntermediateField →ₐ[ -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field] -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) := -+ { (abstractFixedFieldCyclotomicFiniteGaloisLayer -+ H E).toIntermediateField.val.toRingHom with -+ commutes' := by -+ intro x -+ rfl } -+ exact -+ IsScalarTower.of_algebraMap_eq' -+ (AlgHom.comp_algebraMap i).symm -+ -+/-- The canonical inclusion of the finite cyclotomic layer into the -+full abstract-fixed-field compositum. -/ -+private noncomputable def -+ abstractFixedFieldCyclotomicFiniteLayerInclusion -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) : -+ abstractFixedFieldCyclotomicFiniteLayer H E →ₐ[ -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field] -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) := -+ IntermediateField.val -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ -+/-- The two embeddings of a finite rational cyclotomic layer into the -+full abstract-fixed-field compositum agree. -/ -+private theorem -+ abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ (z : E) : -+ abstractFixedFieldCyclotomicFiniteLayerInclusion H E -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E z) = -+ rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -+ (z : rationalCyclotomicZHatField) := by -+ exact Subtype.ext rfl -+ -+/-- Restriction to `E` commutes pointwise with the restriction from the -+full rational cyclotomic tower. -/ -+private theorem -+ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ [Normal ℚ E] -+ (σ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) -+ (z : E) : -+ ((AlgEquiv.restrictNormalHom E -+ (abstractFixedFieldCyclotomicRestriction H σ)) z : -+ rationalCyclotomicZHatField) = -+ (abstractFixedFieldCyclotomicRestriction H σ) -+ (z : rationalCyclotomicZHatField) := by -+ exact -+ AlgEquiv.restrictNormal_commutes -+ (abstractFixedFieldCyclotomicRestriction H σ) E z -+ -+/-- The raw cyclotomic restriction commutes with the canonical embedding -+of the full rational cyclotomic tower. -/ -+private theorem -+ abstractFixedFieldCyclotomicRestriction_embedding_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (σ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) -+ (z : rationalCyclotomicZHatField) : -+ rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -+ (abstractFixedFieldCyclotomicRestriction H σ z) = -+ σ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H z) := by -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) -+ exact -+ AlgEquiv.restrictNormal_commutes -+ (MulSemiringAction.toAlgEquiv ℚ U σ) -+ rationalCyclotomicZHatField z -+ -+/-- Restriction to the finite compositum layer commutes with its -+canonical inclusion into the full compositum. -/ -+private theorem -+ restrictNormalHom_abstractFixedFieldCyclotomicFiniteLayer_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ [Normal -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E)] -+ (σ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) -+ (z : abstractFixedFieldCyclotomicFiniteLayer H E) : -+ abstractFixedFieldCyclotomicFiniteLayerInclusion H E -+ (AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteLayer H E) σ z) = -+ σ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E z) := by -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) -+ let P : IntermediateField F U := -+ abstractFixedFieldCyclotomicFiniteLayer H E -+ exact -+ AlgEquiv.restrictNormal_commutes -+ (MulSemiringAction.toAlgEquiv F U σ) P z -+ -+/-- Restricting the finite-compositum action further to `E` commutes -+with the explicit embedding of `E` into that finite layer. -/ -+private theorem -+ abstractFixedFieldCyclotomicFiniteLayerEmbedding_restrict_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ [Normal ℚ E] -+ [Normal -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E)] -+ (σ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) -+ (z : E) : -+ abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -+ (IntermediateField.restrictRestrictAlgEquivMapHom -+ ℚ E -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ (AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) z) = -+ (AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E z) := by -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) -+ let P : IntermediateField F U := -+ abstractFixedFieldCyclotomicFiniteLayer H E -+ exact -+ AlgEquiv.restrictNormal_commutes -+ (MulSemiringAction.toAlgEquiv ℚ P -+ (AlgEquiv.restrictNormalHom P σ)) E z -+ -+/-- The left finite-level restriction, after both canonical embeddings into -+the full compositum, is the action of `σ` on the cyclotomic embedding. -/ -+private theorem -+ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_left_embedded -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ [Normal ℚ E] -+ (σ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) -+ (x : E) : -+ abstractFixedFieldCyclotomicFiniteLayerInclusion H E -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -+ (AlgEquiv.restrictNormalHom E -+ (abstractFixedFieldCyclotomicRestriction H σ) x)) = -+ σ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -+ (x : rationalCyclotomicZHatField)) := by -+ calc -+ abstractFixedFieldCyclotomicFiniteLayerInclusion H E -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -+ (AlgEquiv.restrictNormalHom E -+ (abstractFixedFieldCyclotomicRestriction H σ) x)) = -+ rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -+ (((AlgEquiv.restrictNormalHom E -+ (abstractFixedFieldCyclotomicRestriction H σ) x) : -+ rationalCyclotomicZHatField)) := -+ abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion H E _ -+ _ = rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -+ (abstractFixedFieldCyclotomicRestriction H σ -+ (x : rationalCyclotomicZHatField)) := -+ congrArg -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H) -+ (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_apply -+ H E σ x) -+ _ = σ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H (x : rationalCyclotomicZHatField)) := -+ abstractFixedFieldCyclotomicRestriction_embedding_apply -+ H σ (x : rationalCyclotomicZHatField) -+ -+/-- The right finite-level restriction, after both canonical embeddings into -+the full compositum, is the same action of `σ`. -/ -+private theorem -+ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_right_embedded -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ [Normal ℚ E] -+ [Normal -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E)] -+ (σ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) -+ (x : E) : -+ abstractFixedFieldCyclotomicFiniteLayerInclusion H E -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -+ (IntermediateField.restrictRestrictAlgEquivMapHom -+ ℚ E -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ (AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x)) = -+ σ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H -+ (x : rationalCyclotomicZHatField)) := by -+ calc -+ abstractFixedFieldCyclotomicFiniteLayerInclusion H E -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E -+ (IntermediateField.restrictRestrictAlgEquivMapHom -+ ℚ E -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ (AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x)) = -+ abstractFixedFieldCyclotomicFiniteLayerInclusion H E -+ ((AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x)) := -+ congrArg -+ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E) -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding_restrict_apply -+ H E σ x) -+ _ = σ -+ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x)) := -+ restrictNormalHom_abstractFixedFieldCyclotomicFiniteLayer_apply -+ H E σ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x) -+ _ = σ -+ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum -+ H (x : rationalCyclotomicZHatField)) := -+ congrArg σ -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion H E x) -+ -+/-- Pointwise form of finite-layer restriction compatibility. -/ -+private theorem -+ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_pointwise -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ [Normal ℚ E] -+ [Normal -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E)] -+ (σ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) -+ (x : E) : -+ AlgEquiv.restrictNormalHom E -+ (abstractFixedFieldCyclotomicRestriction H σ) x = -+ IntermediateField.restrictRestrictAlgEquivMapHom -+ ℚ E -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ (AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x := by -+ apply -+ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E).injective -+ apply -+ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E).injective -+ exact -+ (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_left_embedded -+ H E σ x).trans -+ (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_right_embedded -+ H E σ x).symm -+ -+/-- Restricting through a finite layer commutes with restriction from -+the full abstract-fixed-field compositum. -/ -+theorem -+ restrictNormalHom_abstractFixedFieldCyclotomicRestriction -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (E : -+ FiniteGaloisIntermediateField -+ ℚ rationalCyclotomicZHatField) -+ (σ : -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field)) : -+ letI : Normal ℚ E := E.isGalois.to_normal -+ AlgEquiv.restrictNormalHom E -+ (abstractFixedFieldCyclotomicRestriction H σ) = -+ IntermediateField.restrictRestrictAlgEquivMapHom -+ ℚ E -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field) -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ (AlgEquiv.restrictNormalHom -+ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) -+ σ) := by -+ let : Normal ℚ E := E.isGalois.to_normal -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field -+ let U := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (rationalCyclotomicFieldInertia_le H.field) -+ let T := rationalCyclotomicZHatField -+ let P : IntermediateField F U := -+ abstractFixedFieldCyclotomicFiniteLayer H E -+ let : Algebra T U := -+ abstractFixedFieldCyclotomicCompositum_algebra H -+ let : IsScalarTower ℚ T U := -+ abstractFixedFieldCyclotomicCompositum_scalarTower H -+ let : Algebra E P := -+ abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E -+ let : IsScalarTower ℚ E P := -+ abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower H E -+ let : IsAbelianGalois F P := by -+ change IsAbelianGalois F -+ (abstractFixedFieldCyclotomicFiniteLayer H E) -+ exact -+ abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E -+ let : Normal F P := IsGalois.to_normal -+ apply AlgEquiv.ext -+ intro x -+ exact -+ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_pointwise -+ H E σ x -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/FiniteGaloisRealizationCore.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/FiniteGaloisRealizationCore.lean -index 73951e8..edb78f8 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/FiniteGaloisRealizationCore.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/FiniteGaloisRealizationCore.lean -@@ -15,6 +15,7 @@ import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.FixedField - import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.FixedFieldIntrinsicReciprocity.BaseComparison.IntrinsicBaseEquivalence - import ValuedFieldTheory.Valuation.Completion.AbsoluteValueExtensions - -+ - set_option autoImplicit false - - /-! -@@ -431,9 +432,16 @@ noncomputable def numberFieldTowerSeparableClosureToBaseSubgroup : - (numberFieldTowerBaseSubgroup K L).toSubgroup := by - let _ : Algebra K (SeparableClosure ℚ) := - numberFieldTowerSeparableClosureBaseAlgebra K L -- refine -+ exact - { toFun := fun σ => -- ⟨AlgEquiv.restrictScalars ℚ σ, ?_⟩ -+ ⟨AlgEquiv.restrictScalars ℚ σ, by -+ change -+ AlgEquiv.restrictScalars ℚ σ ∈ -+ (numberFieldTowerBaseField K L).fixingSubgroup -+ rw [IntermediateField.mem_fixingSubgroup_iff] -+ intro x hx -+ obtain ⟨y, rfl⟩ := hx -+ exact σ.commutes y⟩ - map_one' := by - apply Subtype.ext - rfl -@@ -441,13 +449,6 @@ noncomputable def numberFieldTowerSeparableClosureToBaseSubgroup : - intro σ τ - apply Subtype.ext - rfl } -- change -- AlgEquiv.restrictScalars ℚ σ ∈ -- (numberFieldTowerBaseField K L).fixingSubgroup -- rw [IntermediateField.mem_fixingSubgroup_iff] -- intro x hx -- obtain ⟨y, rfl⟩ := hx -- exact σ.commutes y - - /-- The compatible `K`-absolute Galois group is exactly the fixing - subgroup of the embedded copy of `K` inside the rational absolute -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalHilbertSymbol/FinitePlaceFiniteSupport.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalHilbertSymbol/FinitePlaceFiniteSupport.lean -index 9f029f0..a47f31b 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalHilbertSymbol/FinitePlaceFiniteSupport.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalHilbertSymbol/FinitePlaceFiniteSupport.lean -@@ -6,6 +6,8 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - - import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison - import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin -+import Mathlib.Algebra.FiniteSupport.Basic -+ - - set_option autoImplicit false - -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturality.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturality.lean -index 974d793..dfea338 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturality.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturality.lean -@@ -4,19 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidue --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerAlgEquivNaturality -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityTowerNorm - --set_option autoImplicit false - --/-! --# Naturality of the global norm-residue symbol -+set_option autoImplicit false - --This file records the same-base restriction specialization of abstract --norm-residue naturality in the rational absolute class formation. All --closed subgroups remain in one fixed separable-closure ambient, so the --statement is directly usable by fixed-field overextension arguments. ---/ - - open scoped IsMulCommutative - -@@ -34,2834 +26,11 @@ open RamificationTheory - - universe u - --@[instance_reducible] --private noncomputable def naturalityIdeleClassCommGroup -- (F : Type) [Field F] [NumberField F] : CommGroup (IdeleClassGroup F) := -- QuotientGroup.Quotient.commGroup (IdeleGroup.principalSubgroup F) -- --attribute [local instance] naturalityIdeleClassCommGroup -- --local instance ideleClassGroupIsMulCommutative -- {F : Type} [Field F] [NumberField F] -- : IsMulCommutative (IdeleClassGroup F) := -- ⟨⟨fun a b => mul_comm a b⟩⟩ -- --local instance ideleClassSubgroupNormal -- {F : Type} [Field F] [NumberField F] -- (N : Subgroup (IdeleClassGroup F)) : N.Normal := -- N.normal_of_isMulCommutative -- -- --/-- Two finite Galois subextensions with the same underlying closed subgroup --are equal; the remaining structure fields are proof-irrelevant. -/ --private theorem finiteGaloisSubextension_eq_of_field_eq -- {G : Type u} [Group G] [TopologicalSpace G] -- {K : ClosedSubgroup G} -- (A B : FiniteGaloisSubextension K) -- (h : A.field = B.field) : -- A = B := by -- cases A with -- | mk A hA nA fA => -- cases B with -- | mk B hB nB fB => -- dsimp only at h -- cases h -- rfl -- --/-- Rebase a finite Galois subextension along equality of its bundled base. --The field equality is the only data component; the remaining fields are --proof-irrelevant. -/ --private theorem finiteGaloisSubextension_transport_eq_of_field_eq -- {G : Type u} [Group G] [TopologicalSpace G] -- {A B : FiniteAbstractField G} -- (hAB : A = B) -- (P : FiniteGaloisSubextension A.field) -- (Q : FiniteGaloisSubextension B.field) -- (hfield : P.field = Q.field) : -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField G => -- FiniteGaloisSubextension X.field) -- hAB) -- P = Q := by -- cases hAB -- exact finiteGaloisSubextension_eq_of_field_eq P Q hfield -- --/-- Transporting an additive equivalence between rational ambient fixed --subgroups does not change the underlying direct-limit class. -/ --private theorem rationalAmbientFixedAddEquiv_transport_apply_val -- {A B : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} -- (hAB : A = B) -- {X : Type} [AddGroup X] -- (e : X ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) -- (x : X) : -- ((Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- X ≃+ ambientFixedAddSubgroup -- rationalIdeleClassRepresentation Y.field) -- hAB) -- e x).1) = -- (e x).1 := by -- cases hAB -- rfl -- --/-- Changing only the bundled subgroup of an additive subgroup element --does not change its value in the ambient group. -/ --private theorem addSubgroupCongr_apply_val -- {A : Type} [AddGroup A] -- {H K : AddSubgroup A} -- (h : H = K) (x : H) : -- ((AddEquiv.addSubgroupCongr h x).1 : A) = x.1 := by -- cases h -- rfl -- --/-- Transporting an idele class along a field equality and the corresponding --algebra equivalence leaves its rational direct-limit representative fixed. -/ --private theorem rationalIdeleClassEquivFixed_congr_apply_val -- {A B : IntermediateField ℚ (SeparableClosure ℚ)} -- [FiniteDimensional ℚ A] [FiniteDimensional ℚ B] -- (h : A = B) -- (e : B ≃ₐ[ℚ] A) -- (he : e.trans (IntermediateField.equivOfEq h) = -- (AlgEquiv.refl : B ≃ₐ[ℚ] B)) -- (c : Additive (IdeleClassGroup B)) : -- ((rationalIdeleClassEquivFixed A) -- (MulEquiv.toAdditive (ideleClassCongr e) c)).1 = -- ((rationalIdeleClassEquivFixed B) c).1 := by -- cases h -- have he' : e = AlgEquiv.refl := by -- apply AlgEquiv.ext -- intro x -- have hx := DFunLike.congr_fun he x -- change e x = x at hx -- exact hx -- rw [he'] -- have hc : -- MulEquiv.toAdditive -- (ideleClassCongr (AlgEquiv.refl : A ≃ₐ[ℚ] A)) c = c := by -- cases c with -- | ofMul c => -- exact congrArg Additive.ofMul (ideleClassCongr_refl c) -- rw [hc] -- --/-- Transporting the target intermediate field of a base-field equivalence --preserves its rational fixed-part representative. -/ --private theorem rationalIdeleClassEquivFixed_transport_baseEquiv_val -- {T : Type} [Field T] [NumberField T] -- {A B : IntermediateField ℚ (SeparableClosure ℚ)} -- [FiniteDimensional ℚ A] [FiniteDimensional ℚ B] -- (h : A = B) (e : T ≃ₐ[ℚ] B) -- (c : IdeleClassGroup T) : -- ((rationalIdeleClassEquivFixed A) -- (Additive.ofMul -- (ideleClassCongr (K := T) (M := A) -- (e.trans (IntermediateField.equivOfEq h).symm) c))).1 = -- ((rationalIdeleClassEquivFixed B) -- (Additive.ofMul (ideleClassCongr (K := T) (M := B) e c))).1 := by -- cases h -- have he : -- e.trans (IntermediateField.equivOfEq (rfl : A = A)).symm = e := by -- ext x -- rfl -- rw [he] -- --/-- Equality of the lower and upper closed subgroups transports the raw --extension quotient without exposing dependent rewrites to clients. -/ --private def extensionQuotientMulEquivOfEq -- {G : Type u} [Group G] [TopologicalSpace G] -- {H H' J J' : ClosedSubgroup G} -- (hH : H = H') (hJ : J = J') -- (hJH : J.toSubgroup ≤ H.toSubgroup) -- (hJH' : J'.toSubgroup ≤ H'.toSubgroup) -- [(CyclicCohomology.extensionSubgroup H J hJH).Normal] -- [(CyclicCohomology.extensionSubgroup H' J' hJH').Normal] : -- (H.toSubgroup ⧸ CyclicCohomology.extensionSubgroup H J hJH) ≃* -- (H'.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H' J' hJH') := by -- cases hH -- cases hJ -- exact MulEquiv.refl _ -- --/-- The quotient transport sends a quotient representative to the same --ambient group element, rebundled in the equal lower subgroup. -/ --@[simp] --private theorem extensionQuotientMulEquivOfEq_mk -- {G : Type u} [Group G] [TopologicalSpace G] -- {H H' J J' : ClosedSubgroup G} -- (hH : H = H') (hJ : J = J') -- (hJH : J.toSubgroup ≤ H.toSubgroup) -- (hJH' : J'.toSubgroup ≤ H'.toSubgroup) -- [(CyclicCohomology.extensionSubgroup H J hJH).Normal] -- [(CyclicCohomology.extensionSubgroup H' J' hJH').Normal] -- (σ : H.toSubgroup) : -- extensionQuotientMulEquivOfEq hH hJ hJH hJH' -- (QuotientGroup.mk σ) = -- QuotientGroup.mk -- ((MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup hH)) σ) := by -- cases hH -- cases hJ -- rfl -- --/-- Rebundling an element along equality of closed subgroups preserves its --underlying ambient group element. -/ --private theorem closedSubgroupCongr_apply_val -- {G : Type u} [Group G] [TopologicalSpace G] -- {H H' : ClosedSubgroup G} -- (hH : H = H') (σ : H.toSubgroup) : -- (((MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup hH)) σ).1 : G) = σ.1 := by -- cases hH -- rfl -- --/-- Rebase an abelianized extension-quotient equivalence together with its --finite abstract base. -/ --private def abelianizedExtensionQuotientAddEquiv_transportBase -- {G : Type u} [Group G] [TopologicalSpace G] -- {A B : FiniteAbstractField G} -- (hAB : A = B) -- (P : FiniteGaloisSubextension A.field) -- {X : Type} [AddGroup X] -- (e : Additive (Abelianization P.extensionQuotient) ≃+ X) : -- Additive -- (Abelianization -- (Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField G => -- FiniteGaloisSubextension Y.field) -- hAB) -- P).extensionQuotient) ≃+ X := by -- cases hAB -- exact e -- --/-- Rebase an abelianized equivalence along equality of finite Galois --subextensions over a fixed abstract base. -/ --private def abelianizedExtensionQuotientAddEquiv_transportExtension -- {G : Type u} [Group G] [TopologicalSpace G] -- {K : ClosedSubgroup G} -- {P Q : FiniteGaloisSubextension K} -- (hPQ : P = Q) -- {X : Type} [AddGroup X] -- (e : Additive (Abelianization P.extensionQuotient) ≃+ X) : -- Additive (Abelianization Q.extensionQuotient) ≃+ X := by -- cases hPQ -- exact e -- --/-- The explicit quotient equivalence induced by rebasing a finite Galois --subextension. -/ --private def extensionQuotientMulEquiv_transportFiniteGalois -- {G : Type u} [Group G] [TopologicalSpace G] -- {A B : FiniteAbstractField G} -- (hAB : A = B) -- (P : FiniteGaloisSubextension A.field) -- {Q : FiniteGaloisSubextension B.field} -- (hPQ : -- Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField G => -- FiniteGaloisSubextension Y.field) -- hAB) -- P = Q) : -- Q.extensionQuotient ≃* P.extensionQuotient := by -- cases hAB -- cases hPQ -- exact MulEquiv.refl _ -- --/-- Quotient rebasing sends a canonical representative to the same ambient --group element rebundled in the old base subgroup. -/ --@[simp] --private theorem extensionQuotientMulEquiv_transportFiniteGalois_mk -- {G : Type u} [Group G] [TopologicalSpace G] -- {A B : FiniteAbstractField G} -- (hAB : A = B) -- (P : FiniteGaloisSubextension A.field) -- {Q : FiniteGaloisSubextension B.field} -- (hPQ : -- Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField G => -- FiniteGaloisSubextension Y.field) -- hAB) -- P = Q) -- (σ : B.field.toSubgroup) : -- extensionQuotientMulEquiv_transportFiniteGalois hAB P hPQ -- (Q.extensionQuotientMk σ) = -- P.extensionQuotientMk -- ((MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup -- (congrArg FiniteAbstractField.field hAB).symm)) σ) := by -- cases hAB -- cases hPQ -- rfl -- --/-- Abelianization commutes with simultaneous transport of the abstract base --and its finite Galois subextension. -/ --private theorem abelianizedCanonicalEquiv_transportFiniteGalois -- {G : Type u} [Group G] [TopologicalSpace G] -- {A B : FiniteAbstractField G} -- (hAB : A = B) -- (P : FiniteGaloisSubextension A.field) -- {Q : FiniteGaloisSubextension B.field} -- (hPQ : -- Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField G => -- FiniteGaloisSubextension Y.field) -- hAB) -- P = Q) -- {X : Type} [CommGroup X] -- (e : P.extensionQuotient ≃* X) : -- abelianizedExtensionQuotientAddEquiv_transportExtension hPQ -- (abelianizedExtensionQuotientAddEquiv_transportBase -- hAB P -- (MulEquiv.toAdditive -- (e.abelianizationCongr.trans -- (Abelianization.equivOfComm : X ≃* Abelianization X).symm))) = -- MulEquiv.toAdditive -- (((extensionQuotientMulEquiv_transportFiniteGalois -- hAB P hPQ).trans e).abelianizationCongr.trans -- (Abelianization.equivOfComm : X ≃* Abelianization X).symm) := by -- cases hAB -- cases hPQ -- rfl -- --/-- Package the entire rational finite norm-residue evaluation so that its --dependent base, extension, quotient and comparison maps move together. -/ --private def rationalFiniteNormResidueValue -- (K : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (L : FiniteGaloisSubextension K.field) -- {C X : Type} [AddGroup C] [AddGroup X] -- (eIdele : C ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) -- (eGalois : Additive (Abelianization L.extensionQuotient) ≃+ X) -- (c : C) : X := by -- letI : -- Finite -- (K.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- K.field L.field L.below) := -- L.finite -- exact -- eGalois -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- K L -- (finiteNormClass rationalIdeleClassRepresentation -- K.field L.field L.below (eIdele c))) -- --/-- The packaged norm-residue value is invariant under rebasing the finite --abstract field together with all dependent data. -/ --private theorem rationalFiniteNormResidueValue_transportBase -- {A B : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} -- (hAB : A = B) -- (P : FiniteGaloisSubextension A.field) -- {C X : Type} [AddGroup C] [AddGroup X] -- (eIdele : C ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) -- (eGalois : Additive (Abelianization P.extensionQuotient) ≃+ X) -- (c : C) : -- rationalFiniteNormResidueValue A P eIdele eGalois c = -- rationalFiniteNormResidueValue B -- (Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension Y.field) -- hAB) -- P) -- (Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- C ≃+ ambientFixedAddSubgroup -- rationalIdeleClassRepresentation Y.field) -- hAB) -- eIdele) -- (abelianizedExtensionQuotientAddEquiv_transportBase -- hAB P eGalois) -- c := by -- cases hAB -- rfl -- --/-- The packaged norm-residue value is invariant under equality of the finite --Galois subextension. -/ --private theorem rationalFiniteNormResidueValue_transportExtension -- (K : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- {P Q : FiniteGaloisSubextension K.field} -- (hPQ : P = Q) -- {C X : Type} [AddGroup C] [AddGroup X] -- (eIdele : C ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) -- (eGalois : Additive (Abelianization P.extensionQuotient) ≃+ X) -- (c : C) : -- rationalFiniteNormResidueValue K P eIdele eGalois c = -- rationalFiniteNormResidueValue K Q eIdele -- (abelianizedExtensionQuotientAddEquiv_transportExtension -- hPQ eGalois) -- c := by -- cases hPQ -- rfl -- --/-- Evaluation of the canonical abelianization comparison induced by a --multiplicative equivalence into a commutative group. -/ --private theorem abelianizationCongrToComm_apply -- {Q R : Type*} [Group Q] [CommGroup R] -- (e : Q ≃* R) (q : Q) : -- MulEquiv.toAdditive -- (e.abelianizationCongr.trans -- (Abelianization.equivOfComm : R ≃* Abelianization R).symm) -- (Additive.ofMul (Abelianization.of q)) = -- Additive.ofMul (e q) := by -- apply Additive.toMul.injective -- change -- (Abelianization.equivOfComm : R ≃* Abelianization R).symm -- (e.abelianizationCongr (Abelianization.of q)) = e q -- rw [abelianizationCongr_of] -- exact -- (Abelianization.equivOfComm : R ≃* Abelianization R).symm_apply_apply _ -- --/-- Evaluation of the canonical quotient from the abelianization of a --commutative group. -/ --private theorem commutativeAbelianizationEquiv_apply -- {Q R : Type*} [CommGroup Q] [Group R] -- (e : Q ≃* R) (q : Q) : -- MulEquiv.toAdditive -- ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm.trans e) -- (Additive.ofMul (Abelianization.of q)) = -- Additive.ofMul (e q) := by -- apply Additive.toMul.injective -- change -- e ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm -- (Abelianization.of q)) = e q -- exact congrArg e -- ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm_apply_apply q) -- --section AbstractFixedFieldInclusion -- --variable -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- --local instance naturalityAbstractFixedFieldBaseQuotientFinite : -- Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- H.field (le_baseField H.field)) := -- H.finite -- --local instance naturalityAbstractFixedFieldRelativeQuotientFinite : -- Finite -- (H.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H.field P.field P.below) := -- P.finite -- --noncomputable local instance -- naturalityAbstractFixedFieldFiniteDimensional : -- FiniteDimensional ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) := -- abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) H.field H.finite -- --noncomputable local instance -- naturalityAbstractRelativeFixedFieldFiniteDimensional : -- FiniteDimensional -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) := -- abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) -- H.field P.field P.below H.finite P.finite -- --local instance naturalityAbstractFixedFieldRelativeScalarTower : -- IsScalarTower ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) := -- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -- --noncomputable local instance -- naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional : -- FiniteDimensional ℚ -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) := -- FiniteDimensional.trans ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) -- --noncomputable local instance naturalityAbstractFixedFieldNumberField : -- NumberField -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) := -- NumberField.of_module_finite ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- --noncomputable local instance -- naturalityAbstractRelativeFixedFieldNumberField : -- NumberField -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) := -- NumberField.of_module_finite ℚ -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) -- --/-- Use the same direct fixed-field Galois witness as the intrinsic --norm-residue construction. This prevents the dependent Galois-group type --from being synthesized through a second `IsAbelianGalois` instance path. -/ --noncomputable local instance -- naturalityAbstractRelativeFixedFieldIsGalois : -- IsGalois -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) := -- abstractRelativeFixedField_isGalois -- ℚ (SeparableClosure ℚ) -- H.field P.field P.below P.normal -- --noncomputable local instance -- naturalityAbstractRelativeFixedFieldIsAbelianGalois : -- IsAbelianGalois -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) := -- finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P -- --/-- The lower subgroup obtained from the canonical inclusion of an abstract --fixed-field tower is the original lower closed subgroup. -/ --private theorem -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- numberFieldEmbeddedBaseSubgroup F E j = H.field := by -- dsimp only -- have hi : -- numberFieldEmbeddedLowerEmbedding -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) -- ((abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ) = -- (abstractFixedField -- ℚ (SeparableClosure ℚ) H.field).val := by -- ext x -- rfl -- have hRange : -- (numberFieldEmbeddedLowerEmbedding -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) -- ((abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ)).fieldRange = -- abstractFixedField ℚ (SeparableClosure ℚ) H.field := by -- ext x -- constructor -- · rintro ⟨y, rfl⟩ -- change -- numberFieldEmbeddedLowerEmbedding -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) -- ((abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ) y ∈ -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- rw [hi] -- exact y.property -- · intro hx -- refine ⟨⟨x, hx⟩, ?_⟩ -- rw [hi] -- rfl -- rw [numberFieldEmbeddedBaseSubgroup, hRange] -- exact -- closedFixingSubgroup_abstractFixedField_eq -- ℚ (SeparableClosure ℚ) H.field -- --/-- The upper subgroup obtained from the canonical inclusion of an abstract --fixed-field tower is the original upper closed subgroup. -/ --private theorem -- numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- numberFieldEmbeddedTopSubgroup F E j = P.field := by -- dsimp only -- rw [numberFieldEmbeddedTopSubgroup] -- have hjRangeSelf : -- ((abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ).fieldRange = -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below).restrictScalars ℚ := by -- ext x -- constructor -- · rintro ⟨y, rfl⟩ -- exact y.property -- · intro hx -- exact ⟨⟨x, hx⟩, rfl⟩ -- have hjRange : -- ((abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ).fieldRange = -- abstractFixedField ℚ (SeparableClosure ℚ) P.field := by -- exact hjRangeSelf.trans -- (IntermediateField.extendScalars_restrictScalars -- (abstractFixedField_le -- ℚ (SeparableClosure ℚ) P.below)) -- rw [hjRange] -- exact -- closedFixingSubgroup_abstractFixedField_eq -- ℚ (SeparableClosure ℚ) P.field -- --/-- Transport a packaged rational norm-residue value directly from an equal --abstract base to the finite Galois extension underlying `P`. Keeping the two --dependent transports in their own declaration prevents their elaboration cost --from accumulating in the main fixed-field comparison theorem. -/ --private theorem rationalFiniteNormResidueValue_transportToAbstractExtension -- {A : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} -- (hAH : A = H) -- (L : FiniteGaloisSubextension A.field) -- (hLP : -- Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension Y.field) -- hAH) -- L = -- P.toFiniteGaloisExtension) -- {C X : Type} [AddGroup C] [AddGroup X] -- (eIdele : C ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) -- (eGalois : Additive (Abelianization L.extensionQuotient) ≃+ X) -- (c : C) : -- rationalFiniteNormResidueValue A L eIdele eGalois c = -- rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -- (Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- C ≃+ ambientFixedAddSubgroup -- rationalIdeleClassRepresentation Y.field) -- hAH) -- eIdele) -- (abelianizedExtensionQuotientAddEquiv_transportExtension hLP -- (abelianizedExtensionQuotientAddEquiv_transportBase -- hAH L eGalois)) -- c := by -- calc -- _ = rationalFiniteNormResidueValue H -- (Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension Y.field) -- hAH) -- L) -- (Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- C ≃+ ambientFixedAddSubgroup -- rationalIdeleClassRepresentation Y.field) -- hAH) -- eIdele) -- (abelianizedExtensionQuotientAddEquiv_transportBase hAH L eGalois) -- c := -- rationalFiniteNormResidueValue_transportBase -- (A := A) (B := H) (C := C) (X := X) -- hAH L eIdele eGalois c -- _ = _ := -- rationalFiniteNormResidueValue_transportExtension -- (K := H) -- (P := Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension Y.field) -- hAH) -- L) -- (Q := P.toFiniteGaloisExtension) (C := C) (X := X) -- hLP -- (Eq.mp -- (congrArg -- (fun Y : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- C ≃+ ambientFixedAddSubgroup -- rationalIdeleClassRepresentation Y.field) -- hAH) -- eIdele) -- (abelianizedExtensionQuotientAddEquiv_transportBase hAH L eGalois) -- c -- --/-- The packaged value at the literal fixed-field realization is the ambient --fixed-part norm-residue homomorphism evaluated at the same idele class. -/ --private theorem rationalFiniteNormResidueValue_abstractFixedField_eq_ambient -- (c : IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) : -- rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -- (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) -- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) -- (Additive.ofMul c) = -- ambientFixedGlobalNormResidueAddMonoidHom H P -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- H.field (Additive.ofMul c)) := by -- let eRec := -- rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- H P.toFiniteGaloisExtension -- let eGal := -- abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P -- change -- eGal -- (eRec -- (finiteNormClass rationalIdeleClassRepresentation -- H.field P.field P.below -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- H.field (Additive.ofMul c)))) = -- eGal -- (eRec -- (finiteNormClass rationalIdeleClassRepresentation -- H.field P.field P.below -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- H.field (Additive.ofMul c)))) -- rfl -- --/-- The packaged norm-residue value for the literal fixed-field realization --is the intrinsic abstract fixed-field norm-residue value. -/ --private theorem rationalFiniteNormResidueValue_abstractFixedField_apply -- (c : IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) : -- Additive.toMul -- (rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -- (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) -- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup -- H P) -- (Additive.ofMul c)) = -- abstractFixedFieldGlobalNormResidueMonoidHom H P c := by -- let a := -- rationalAbstractFixedFieldIdeleClassEquivFixed -- H.field (Additive.ofMul c) -- have hAbstract := -- abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply H P a -- calc -- _ = Additive.toMul -- (ambientFixedGlobalNormResidueAddMonoidHom H P -- (rationalAbstractFixedFieldIdeleClassEquivFixed -- H.field (Additive.ofMul c))) := by -- exact congrArg Additive.toMul -- (rationalFiniteNormResidueValue_abstractFixedField_eq_ambient -- (H := H) (P := P) c) -- _ = _ := by -- simpa only [a, AddEquiv.symm_apply_apply, toMul_ofMul] using -- hAbstract.symm -- --/-- The finite abstract field reconstructed from the literal fixed-field --inclusion is the original packaged abstract field. Keeping this structure --equality separate avoids repeatedly rebuilding all of its proof fields. -/ --private theorem -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- numberFieldEmbeddedFiniteAbstractField F E j = H := by -- dsimp only -- exact FiniteAbstractField.eq_of_field_eq _ _ -- (numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P) -- --/-- Pointwise specification of the idele-class comparison after transporting --the explicitly embedded abstract field to the canonical packaged field. The --transport is kept at the value boundary, so clients never compare the two --dependent additive equivalences themselves. -/ --private theorem -- numberFieldEmbeddedIdeleClassEquivAmbientFixed_transport_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (c : Additive -- (IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- Additive (IdeleClassGroup F) ≃+ -- ambientFixedAddSubgroup -- rationalIdeleClassRepresentation X.field) -- hHEmbedded) -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) c = -- rationalAbstractFixedFieldIdeleClassEquivFixed H.field c := by -- dsimp only -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hBase : -- numberFieldEmbeddedBaseSubgroup F E j = H.field := -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -- have hHEmbedded : -- numberFieldEmbeddedFiniteAbstractField F E j = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- have hFixedBase : -- abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup F E j) = F := -- congrArg -- (abstractFixedField ℚ (SeparableClosure ℚ)) hBase -- let eBase : F ≃ₐ[ℚ] F := -- (numberFieldEmbeddedAbstractBaseFieldEquiv F E j).trans -- (IntermediateField.equivOfEq hFixedBase) -- have heBase : -- eBase = (AlgEquiv.refl : F ≃ₐ[ℚ] F) := by -- apply AlgEquiv.ext -- intro x -- apply Subtype.ext -- change x.1 = x.1 -- rfl -- let hEmbeddedQuotientFinite := -- numberFieldEmbeddedAbsoluteQuotientFinite F E j -- let hEmbeddedFixedFiniteDimensional := -- numberFieldEmbeddedAbstractFixedFieldFiniteDimensional F E j -- apply Subtype.ext -- rw [rationalAmbientFixedAddEquiv_transport_apply_val -- hHEmbedded -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) c] -- dsimp only [numberFieldEmbeddedIdeleClassEquivAmbientFixed] -- simp only [AddEquiv.trans_apply] -- change -- ((rationalIdeleClassEquivFixed -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup F E j))) -- (MulEquiv.toAdditive -- (ideleClassCongr -- (numberFieldEmbeddedAbstractBaseFieldEquiv F E j)) c)).1 = -- ((rationalIdeleClassEquivFixed F) c).1 -- exact rationalIdeleClassEquivFixed_congr_apply_val -- hFixedBase -- (numberFieldEmbeddedAbstractBaseFieldEquiv F E j) -- heBase c -- --/-- Transporting the finite Galois subextension reconstructed from the literal --fixed-field inclusion recovers the canonical subextension packaged by `P`. --This is the sole dependent structure equality used by the later quotient --comparisons. -/ --private theorem -- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -- numberFieldEmbeddedFiniteGaloisSubextension F E j -- let hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension X.field) -- hHEmbedded) -- PEmbedded = -- P.toFiniteGaloisExtension := by -- dsimp only -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -- numberFieldEmbeddedFiniteGaloisSubextension F E j -- have hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- exact finiteGaloisSubextension_transport_eq_of_field_eq -- hHEmbedded PEmbedded P.toFiniteGaloisExtension -- (numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P) -- --/-- Opaque endpoint for the extension-quotient comparison supplied by the --literal embedding. Its domain is already the canonical quotient of `P`, so --no client has to reconstruct the two subgroup transports. -/ --private noncomputable def -- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- P.toFiniteGaloisExtension.extensionQuotient ≃* -- Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hBase : -- numberFieldEmbeddedBaseSubgroup F E j = H.field := -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -- have hTop : -- numberFieldEmbeddedTopSubgroup F E j = P.field := -- numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P -- letI hAlgebra : Algebra F (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra F E j -- let eSep := -- numberFieldEmbeddedSeparableClosureEquiv F E j -- letI hEmbeddedExtensionNormal : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal F E j -- exact -- P.toFiniteGaloisExtension.extensionQuotientMulEquiv.trans -- ((extensionQuotientMulEquivOfEq -- hBase.symm hTop.symm P.below -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).trans -- (ambientEmbeddedExtensionQuotientEquivGaloisGroup -- ℚ F E j eSep)) -- --/-- Opaque canonical endpoint for the same quotient, obtained directly from --the abstract fixed-field realization. -/ --private noncomputable def -- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- P.toFiniteGaloisExtension.extensionQuotient ≃* -- Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by -- exact -- P.toFiniteGaloisExtension.extensionQuotientMulEquiv.trans -- (abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) -- H.field P.field P.below P.normal) -- --/-- Pointwise opaque endpoint of the embedded quotient equivalence. -/ --private noncomputable def -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) : -- Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := -- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv H P q -- --/-- Pointwise opaque endpoint of the canonical quotient equivalence. -/ --private noncomputable def -- abstractFixedFieldInclusionCanonicalExtensionQuotientValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) : -- Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := -- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv H P q -- --/-- Fully applied ambient value of the embedded quotient endpoint. -/ --private noncomputable def -- abstractFixedFieldInclusionEmbeddedExtensionQuotientApplyVal -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := -- (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q x : -- SeparableClosure ℚ) -- --/-- Fully applied ambient value of the canonical quotient endpoint. -/ --private noncomputable def -- abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := -- (abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q x : -- SeparableClosure ℚ) -- --/-- The ambient Galois value attached to a representative of the canonical --quotient, packaged behind a literal result type. -/ --private noncomputable def -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) : -- Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hBase : -- numberFieldEmbeddedBaseSubgroup F E j = H.field := -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -- letI hAlgebra : Algebra F (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra F E j -- let eSep := -- numberFieldEmbeddedSeparableClosureEquiv F E j -- letI hEmbeddedExtensionNormal : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal F E j -- let σEmbedded : -- (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := -- (MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ -- exact -- ambientEmbeddedExtensionQuotientEquivGaloisGroup -- ℚ F E j eSep (QuotientGroup.mk σEmbedded) -- --/-- Fully applied ambient value of the packaged representative endpoint. -/ --private noncomputable def -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := -- (abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue H P σ x : -- SeparableClosure ℚ) -- --/-- Ambient action of the representative after rebundling it in the embedded --base subgroup. -/ --private noncomputable def -- abstractFixedFieldInclusionRebasedAutomorphismApplyVal -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hBase : -- numberFieldEmbeddedBaseSubgroup F E j = H.field := -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -- let σEmbedded : -- (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := -- (MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ -- exact σEmbedded.1.1 (x : SeparableClosure ℚ) -- --/-- The embedded quotient endpoint sends a canonical representative to the --packaged ambient value above. -/ --private theorem -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue_mk -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) : -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P -- (P.toFiniteGaloisExtension.extensionQuotientMk σ) = -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue H P σ := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hBase : -- numberFieldEmbeddedBaseSubgroup F E j = H.field := -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -- have hTop : -- numberFieldEmbeddedTopSubgroup F E j = P.field := -- numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P -- let hAlgebra : Algebra F (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra F E j -- let eSep := -- numberFieldEmbeddedSeparableClosureEquiv F E j -- let hEmbeddedExtensionNormal : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal F E j -- simp only [ -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue, -- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv, -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue, -- MulEquiv.trans_apply, -- FiniteGaloisSubextension.extensionQuotientMk_apply] -- exact congrArg -- (ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep) -- (extensionQuotientMulEquivOfEq_mk -- hBase.symm hTop.symm P.below -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j) σ) -- --/-- The packaged ambient endpoint evaluates to the action of the rebundled --representative. -/ --private theorem -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal_eq_rebased -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal H P σ x = -- abstractFixedFieldInclusionRebasedAutomorphismApplyVal H P σ x := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hBase : -- numberFieldEmbeddedBaseSubgroup F E j = H.field := -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -- let hAlgebra : Algebra F (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra F E j -- let eSep := -- numberFieldEmbeddedSeparableClosureEquiv F E j -- let hEmbeddedExtensionNormal : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal F E j -- let σEmbedded : -- (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := -- (MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ -- have hmk := -- ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply -- ℚ F E j eSep σEmbedded x -- change -- (ambientEmbeddedExtensionQuotientEquivGaloisGroup -- ℚ F E j eSep (QuotientGroup.mk σEmbedded) x : -- SeparableClosure ℚ) = -- σEmbedded.1.1 (x : SeparableClosure ℚ) at hmk -- simpa only [ -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal, -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue, -- abstractFixedFieldInclusionRebasedAutomorphismApplyVal] using hmk -- --/-- Rebundling the representative does not change its action in the ambient --separable closure. -/ --private theorem -- abstractFixedFieldInclusionRebasedAutomorphismApplyVal_eq -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : -- abstractFixedFieldInclusionRebasedAutomorphismApplyVal H P σ x = -- σ.1.1 (x : SeparableClosure ℚ) := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hBase : -- numberFieldEmbeddedBaseSubgroup F E j = H.field := -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -- let σEmbedded : -- (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := -- (MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ -- have hσEmbedded : -- (σEmbedded.1 : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) = σ.1 := -- closedSubgroupCongr_apply_val hBase.symm σ -- change σEmbedded.1.1 (x : SeparableClosure ℚ) = _ -- rw [hσEmbedded] -- --/-- The packaged ambient representative acts by the original automorphism on --the underlying separable-closure value. -/ --private theorem -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal H P σ x = -- σ.1.1 (x : SeparableClosure ℚ) := by -- exact -- (abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal_eq_rebased -- H P σ x).trans -- (abstractFixedFieldInclusionRebasedAutomorphismApplyVal_eq H P σ x) -- --/-- Evaluation of the embedded quotient endpoint on a canonical quotient --representative, stated only in the ambient separable closure. -/ --private theorem -- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv_mk_val -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : -- abstractFixedFieldInclusionEmbeddedExtensionQuotientApplyVal H P -- (P.toFiniteGaloisExtension.extensionQuotientMk σ) x = -- σ.1.1 (x : SeparableClosure ℚ) := by -- calc -- _ = abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal -- H P σ x := by -- exact congrArg -- (fun g => (g x : SeparableClosure ℚ)) -- (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue_mk -- H P σ) -- _ = _ := -- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue_apply -- H P σ x -- --/-- Evaluation of the canonical abstract quotient endpoint on a quotient --representative, again exposed only through its ambient value. -/ --private theorem -- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv_mk_val -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) -- (x : abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) : -- abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal H P -- (P.toFiniteGaloisExtension.extensionQuotientMk σ) x = -- σ.1.1 (x : SeparableClosure ℚ) := by -- simp only [ -- abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal, -- abstractFixedFieldInclusionCanonicalExtensionQuotientValue, -- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv, -- MulEquiv.trans_apply, -- FiniteGaloisSubextension.extensionQuotientMk_apply] -- exact -- (abstractExtensionQuotientEquivGaloisGroup_mk_apply_val -- ℚ (SeparableClosure ℚ) -- H.field P.field P.below P.normal σ x).symm -- --/-- The embedded and canonical quotient endpoints agree on each quotient --class. This pointwise boundary is intentionally weaker than equality of the --dependent `MulEquiv` structures. -/ --private theorem -- abstractFixedFieldInclusionExtensionQuotientEquiv_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) : -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q = -- abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q := by -- refine P.toFiniteGaloisExtension.extensionQuotient_inductionOn -- (motive := fun q => -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q = -- abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q) -- q ?_ -- intro σ -- apply AlgEquiv.ext -- intro x -- apply Subtype.ext -- exact -- (abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv_mk_val -- H P σ x).trans -- (abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv_mk_val -- H P σ x).symm -- --/-- Opaque quotient endpoint obtained by transporting the explicitly embedded --finite Galois subextension back to the canonical package. -/ --private noncomputable def -- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- P.toFiniteGaloisExtension.extensionQuotient ≃* -- Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -- numberFieldEmbeddedFiniteGaloisSubextension F E j -- have hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- have hPEmbedded : -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension X.field) -- hHEmbedded) -- PEmbedded = -- P.toFiniteGaloisExtension := -- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -- exact -- (extensionQuotientMulEquiv_transportFiniteGalois -- hHEmbedded PEmbedded hPEmbedded).trans -- (numberFieldEmbeddedExtensionQuotientEquivGaloisGroup F E j) -- --/-- Pointwise opaque endpoint of the transported quotient equivalence. -/ --private noncomputable def -- abstractFixedFieldInclusionTransportedExtensionQuotientValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) : -- Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := -- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P q -- --/-- Transporting a canonical representative of the embedded finite Galois --package preserves its Galois value. -/ --private theorem -- abstractFixedFieldInclusionTransportedExtensionQuotientValue_mk -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (σ : H.field.toSubgroup) : -- abstractFixedFieldInclusionTransportedExtensionQuotientValue H P -- (P.toFiniteGaloisExtension.extensionQuotientMk σ) = -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P -- (P.toFiniteGaloisExtension.extensionQuotientMk σ) := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hBase : -- numberFieldEmbeddedBaseSubgroup F E j = H.field := -- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -- have hTop : -- numberFieldEmbeddedTopSubgroup F E j = P.field := -- numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -- numberFieldEmbeddedFiniteGaloisSubextension F E j -- have hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- have hPEmbedded : -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension X.field) -- hHEmbedded) -- PEmbedded = -- P.toFiniteGaloisExtension := -- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -- let hAlgebra : Algebra F (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra F E j -- let eSep := -- numberFieldEmbeddedSeparableClosureEquiv F E j -- let hEmbeddedExtensionNormal : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup F E j) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal F E j -- have hFieldEq : -- (congrArg FiniteAbstractField.field hHEmbedded).symm = hBase.symm := -- Subsingleton.elim _ _ -- simp only [ -- abstractFixedFieldInclusionTransportedExtensionQuotientValue, -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue, -- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv, -- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv, -- MulEquiv.trans_apply, -- extensionQuotientMulEquiv_transportFiniteGalois_mk, -- FiniteGaloisSubextension.extensionQuotientMk_apply, -- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup] -- rw [hFieldEq] -- change -- ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep -- (QuotientGroup.mk -- ((MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ)) = _ -- exact -- (congrArg -- (ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep) -- (extensionQuotientMulEquivOfEq_mk -- hBase.symm hTop.symm P.below -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j) σ)).symm -- --/-- Transporting the embedded finite Galois package preserves the value of --its extension-quotient comparison. -/ --private theorem -- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv_apply -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) : -- abstractFixedFieldInclusionTransportedExtensionQuotientValue H P q = -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q := by -- refine P.toFiniteGaloisExtension.extensionQuotient_inductionOn -- (motive := fun q => -- abstractFixedFieldInclusionTransportedExtensionQuotientValue H P q = -- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q) -- q ?_ -- intro σ -- exact abstractFixedFieldInclusionTransportedExtensionQuotientValue_mk -- H P σ -- --/-- Opaque abelianized equivalence obtained by transporting the explicitly --embedded finite Galois package to the canonical one. -/ --private noncomputable def -- abstractFixedFieldInclusionTransportedAbelianizedEquiv -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- Additive -- (Abelianization -- P.toFiniteGaloisExtension.extensionQuotient) ≃+ -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -- numberFieldEmbeddedFiniteGaloisSubextension F E j -- have hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- have hPEmbedded : -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension X.field) -- hHEmbedded) -- PEmbedded = -- P.toFiniteGaloisExtension := -- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -- exact -- abelianizedExtensionQuotientAddEquiv_transportExtension hPEmbedded -- (abelianizedExtensionQuotientAddEquiv_transportBase -- hHEmbedded PEmbedded -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- F E j)) -- --/-- Canonical abelianization comparison built from the already transported --opaque extension-quotient endpoint. -/ --private noncomputable def -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- Additive -- (Abelianization -- P.toFiniteGaloisExtension.extensionQuotient) ≃+ -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by -- let Q := -- Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) -- exact -- MulEquiv.toAdditive -- ((MulEquiv.abelianizationCongr -- (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P)).trans -- (Abelianization.equivOfComm : Q ≃* Abelianization Q).symm) -- --/-- Pointwise opaque value of the transported abelianized equivalence. -/ --private noncomputable def -- abstractFixedFieldInclusionTransportedAbelianizedValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (z : Additive -- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := -- abstractFixedFieldInclusionTransportedAbelianizedEquiv H P z -- --/-- Pointwise opaque value of the canonical abelianization comparison built --from the transported quotient endpoint. -/ --private noncomputable def -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (z : Additive -- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv H P z -- --/-- Pointwise opaque value of the intrinsic abstract fixed-field --abelianization comparison. -/ --private noncomputable def -- abstractFixedFieldInclusionCanonicalAbelianizedValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (z : Additive -- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := -- abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P z -- --/-- The transported abelianized endpoint agrees pointwise with the canonical --abelianization comparison built from the transported quotient endpoint. -/ --private theorem -- abstractFixedFieldInclusionTransportedAbelianizedValue_eq_canonical -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (z : Additive -- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -- abstractFixedFieldInclusionTransportedAbelianizedValue H P z = -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue -- H P z := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -- numberFieldEmbeddedFiniteGaloisSubextension F E j -- have hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- have hPEmbedded : -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension X.field) -- hHEmbedded) -- PEmbedded = -- P.toFiniteGaloisExtension := -- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -- let qEmbedded : PEmbedded.extensionQuotient ≃* Gal(E / F) := -- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup F E j -- have hCanonical : -- abstractFixedFieldInclusionTransportedAbelianizedEquiv H P = -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv -- H P := by -- simpa only [ -- abstractFixedFieldInclusionTransportedAbelianizedEquiv, -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv, -- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv, -- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup, -- qEmbedded] using -- (abelianizedCanonicalEquiv_transportFiniteGalois -- hHEmbedded PEmbedded hPEmbedded qEmbedded) -- exact DFunLike.congr_fun hCanonical z -- --/-- On an abelianization representative, the transported canonical endpoint --is the additive value of the transported quotient endpoint. -/ --private theorem -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_of -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) : -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue H P -- (Additive.ofMul (Abelianization.of q)) = -- Additive.ofMul -- (abstractFixedFieldInclusionTransportedExtensionQuotientValue -- H P q) := by -- simpa only [ -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue, -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv, -- abstractFixedFieldInclusionTransportedExtensionQuotientValue] using -- (abelianizationCongrToComm_apply -- (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P) q) -- --/-- On the same representative, the intrinsic fixed-field endpoint is the --additive value of the canonical quotient endpoint. -/ --private theorem -- abstractFixedFieldInclusionCanonicalAbelianizedValue_of -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (q : P.toFiniteGaloisExtension.extensionQuotient) : -- abstractFixedFieldInclusionCanonicalAbelianizedValue H P -- (Additive.ofMul (Abelianization.of q)) = -- Additive.ofMul -- (abstractFixedFieldInclusionCanonicalExtensionQuotientValue -- H P q) := by -- let hRawQuotientCommGroup : -- CommGroup P.toFiniteGaloisExtension.extensionQuotient := -- { (inferInstance : -- Group P.toFiniteGaloisExtension.extensionQuotient) with -- mul_comm := P.commutative.is_comm.comm } -- let qAbstractRaw := -- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv H P -- change -- MulEquiv.toAdditive -- ((Abelianization.equivOfComm : -- P.toFiniteGaloisExtension.extensionQuotient ≃* -- Abelianization -- P.toFiniteGaloisExtension.extensionQuotient).symm.trans -- qAbstractRaw) -- (Additive.ofMul (Abelianization.of q)) = -- Additive.ofMul (qAbstractRaw q) -- exact commutativeAbelianizationEquiv_apply qAbstractRaw q -- --/-- The canonical abelianization comparison built after transport agrees --pointwise with the intrinsic abstract fixed-field comparison. -/ --private theorem -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_eq -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (z : Additive -- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue H P z = -- abstractFixedFieldInclusionCanonicalAbelianizedValue H P z := by -- let q : P.toFiniteGaloisExtension.extensionQuotient := -- Quotient.out z.toMul -- have hz : Additive.ofMul (Abelianization.of q) = z := by -- apply Additive.ext -- exact Quotient.out_eq' z.toMul -- rw [← hz] -- calc -- _ = Additive.ofMul -- (abstractFixedFieldInclusionTransportedExtensionQuotientValue -- H P q) := -- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_of -- H P q -- _ = Additive.ofMul -- (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue -- H P q) := -- congrArg Additive.ofMul -- (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv_apply -- H P q) -- _ = Additive.ofMul -- (abstractFixedFieldInclusionCanonicalExtensionQuotientValue -- H P q) := -- congrArg Additive.ofMul -- (abstractFixedFieldInclusionExtensionQuotientEquiv_apply H P q) -- _ = _ := -- (abstractFixedFieldInclusionCanonicalAbelianizedValue_of H P q).symm -- --/-- The transported abelianized equivalence agrees pointwise with the --intrinsic abstract fixed-field Galois comparison. -/ --private theorem -- abstractFixedFieldInclusionTransportedAbelianizedValue_eq -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (z : Additive -- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -- abstractFixedFieldInclusionTransportedAbelianizedValue H P z = -- abstractFixedFieldInclusionCanonicalAbelianizedValue H P z := -- (abstractFixedFieldInclusionTransportedAbelianizedValue_eq_canonical -- H P z).trans -- (abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_eq -- H P z) -- --/-- Opaque packaged norm-residue value before transporting the explicitly --embedded abstract field and finite Galois package. -/ --private noncomputable def -- abstractFixedFieldInclusionEmbeddedNormResidueValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (c : Additive -- (IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -- numberFieldEmbeddedFiniteGaloisSubextension F E j -- exact -- rationalFiniteNormResidueValue HEmbedded PEmbedded -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- F E j) -- c -- --/-- Opaque packaged value after transporting both dependent structures to --the canonical `H` and `P` endpoints. -/ --private noncomputable def -- abstractFixedFieldInclusionTransportedNormResidueValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (c : Additive -- (IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- have hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- let eIdeleEmbedded := -- numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j -- let eIdeleOverH : -- Additive (IdeleClassGroup F) ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation H.field := -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- Additive (IdeleClassGroup F) ≃+ -- ambientFixedAddSubgroup -- rationalIdeleClassRepresentation X.field) -- hHEmbedded) -- eIdeleEmbedded -- exact -- rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -- eIdeleOverH -- (abstractFixedFieldInclusionTransportedAbelianizedEquiv H P) -- c -- --/-- Opaque intrinsic packaged norm-residue value at the canonical endpoints. -/ --private noncomputable def -- abstractFixedFieldInclusionCanonicalNormResidueValue -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (c : Additive -- (IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -- Additive -- (Gal( -- (abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below) / -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := -- rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -- (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) -- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) -- c -- --/-- Simultaneous transport of the embedded abstract field and finite Galois --package sends the embedded norm-residue value to the transported endpoint. -/ --private theorem -- abstractFixedFieldInclusionEmbeddedNormResidueValue_eq_transported -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (c : Additive -- (IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -- abstractFixedFieldInclusionEmbeddedNormResidueValue H P c = -- abstractFixedFieldInclusionTransportedNormResidueValue H P c := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -- numberFieldEmbeddedFiniteGaloisSubextension F E j -- have hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- have hPEmbedded : -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- FiniteGaloisSubextension X.field) -- hHEmbedded) -- PEmbedded = -- P.toFiniteGaloisExtension := -- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -- let eIdeleEmbedded := -- numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j -- let eGaloisEmbedded := -- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup F E j -- simpa only [ -- abstractFixedFieldInclusionEmbeddedNormResidueValue, -- abstractFixedFieldInclusionTransportedNormResidueValue, -- abstractFixedFieldInclusionTransportedAbelianizedEquiv, -- eIdeleEmbedded, -- eGaloisEmbedded] using -- (rationalFiniteNormResidueValue_transportToAbstractExtension -- (H := H) (P := P) -- (A := HEmbedded) -- (C := Additive (IdeleClassGroup F)) -- (X := Additive Gal(E / F)) -- hHEmbedded PEmbedded hPEmbedded -- eIdeleEmbedded eGaloisEmbedded c) -- --/-- A packaged finite norm-residue value depends only on the value of its --idele comparison at the chosen input and the value of its Galois comparison --at the resulting norm class. -/ --private theorem rationalFiniteNormResidueValue_congr_apply -- (K : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (L : FiniteGaloisSubextension K.field) -- {C X : Type} [AddGroup C] [AddGroup X] -- (eIdele eIdele' : C ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) -- (eGalois eGalois' : -- Additive (Abelianization L.extensionQuotient) ≃+ X) -- (c : C) -- (heIdele : eIdele c = eIdele' c) -- (heGalois : ∀ z, eGalois z = eGalois' z) : -- rationalFiniteNormResidueValue K L eIdele eGalois c = -- rationalFiniteNormResidueValue K L eIdele' eGalois' c := by -- unfold rationalFiniteNormResidueValue -- rw [heIdele] -- exact heGalois _ -- --/-- The transported packaged value is the intrinsic canonical packaged value; --only the idele input and the eventual abelianized value are compared. -/ --private theorem -- abstractFixedFieldInclusionTransportedNormResidueValue_eq_canonical -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (c : Additive -- (IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -- abstractFixedFieldInclusionTransportedNormResidueValue H P c = -- abstractFixedFieldInclusionCanonicalNormResidueValue H P c := by -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- let HEmbedded := -- numberFieldEmbeddedFiniteAbstractField F E j -- have hHEmbedded : HEmbedded = H := -- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -- let eIdeleEmbedded := -- numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j -- let eIdeleOverH : -- Additive (IdeleClassGroup F) ≃+ -- ambientFixedAddSubgroup rationalIdeleClassRepresentation H.field := -- Eq.mp -- (congrArg -- (fun X : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -- Additive (IdeleClassGroup F) ≃+ -- ambientFixedAddSubgroup -- rationalIdeleClassRepresentation X.field) -- hHEmbedded) -- eIdeleEmbedded -- simpa only [ -- abstractFixedFieldInclusionTransportedNormResidueValue, -- abstractFixedFieldInclusionCanonicalNormResidueValue, -- eIdeleEmbedded, -- eIdeleOverH] using -- (rationalFiniteNormResidueValue_congr_apply -- H P.toFiniteGaloisExtension -- eIdeleOverH -- (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) -- (abstractFixedFieldInclusionTransportedAbelianizedEquiv H P) -- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) -- c -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed_transport_apply H P c) -- (fun z => abstractFixedFieldInclusionTransportedAbelianizedValue_eq -- H P z)) -- --/-- The explicitly embedded and intrinsic packaged norm-residue values agree. -/ --private theorem -- abstractFixedFieldInclusionEmbeddedNormResidueValue_eq -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) -- (c : Additive -- (IdeleClassGroup -- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -- abstractFixedFieldInclusionEmbeddedNormResidueValue H P c = -- abstractFixedFieldInclusionCanonicalNormResidueValue H P c := -- (abstractFixedFieldInclusionEmbeddedNormResidueValue_eq_transported -- H P c).trans -- (abstractFixedFieldInclusionTransportedNormResidueValue_eq_canonical -- H P c) -- --/-- For the literal fixed fields attached to an abstract finite abelian --extension, the norm-residue map obtained from their canonical inclusion in --the rational separable closure is the intrinsic fixed-field norm-residue --map. -/ --theorem -- globalNormResidueMonoidHomOfEmbedding_abstractFixedFieldInclusion -- (H : FiniteAbstractField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- (P : FiniteAbelianSubextension H.field) : -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H.field -- let E := -- abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- globalNormResidueMonoidHomOfEmbedding F E j = -- abstractFixedFieldGlobalNormResidueMonoidHom H P := by -- dsimp only -- apply MonoidHom.ext -- intro c -- rw [globalNormResidueMonoidHomOfEmbedding_apply] -- change -- Additive.toMul -- (abstractFixedFieldInclusionEmbeddedNormResidueValue -- H P (Additive.ofMul c)) = -- abstractFixedFieldGlobalNormResidueMonoidHom H P c -- calc -- _ = Additive.toMul -- (abstractFixedFieldInclusionCanonicalNormResidueValue -- H P (Additive.ofMul c)) := -- congrArg Additive.toMul -- (abstractFixedFieldInclusionEmbeddedNormResidueValue_eq -- H P (Additive.ofMul c)) -- _ = _ := by -- simpa only [abstractFixedFieldInclusionCanonicalNormResidueValue] using -- (rationalFiniteNormResidueValue_abstractFixedField_apply -- (H := H) (P := P) c) -- --end AbstractFixedFieldInclusion -- --section EmbeddedNumberFieldRestriction -- --variable -- (K K' L L' : Type) -- [Field K] [NumberField K] -- [Field K'] [NumberField K'] -- [Field L] [NumberField L] -- [Field L'] [NumberField L'] -- [Algebra K K'] [Algebra K L] [Algebra K L'] -- [Algebra K' L'] [Algebra L L'] -- [IsScalarTower K K' L'] [IsScalarTower K L L'] -- -- --/-- Rebracketing the compatible tower does not change its embedded lower --fixing subgroup. -/ --private theorem numberFieldEmbeddedBaseSubgroup_baseChange_eq -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- numberFieldEmbeddedBaseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j) = -- numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')) := by -- have hi : -- numberFieldEmbeddedLowerEmbedding K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j) = -- numberFieldEmbeddedLowerEmbedding K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')) := by -- ext x -- simp only [numberFieldEmbeddedLowerEmbedding, AlgHom.comp_apply, -- IsScalarTower.coe_toAlgHom'] -- rw [← IsScalarTower.algebraMap_apply K K' L', -- ← IsScalarTower.algebraMap_apply K L L'] -- simp only [numberFieldEmbeddedBaseSubgroup, hi] -- --omit [Field K] [NumberField K] -- [Algebra K K'] [Algebra K L'] [IsScalarTower K K' L'] in --/-- The top subgroup of the rebracketed base-change tower is the embedded --fixing subgroup of the intermediate field. -/ --private theorem numberFieldEmbeddedTopSubgroup_baseChange_eq -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- numberFieldEmbeddedTopSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j) = -- numberFieldEmbeddedBaseSubgroup K' L' j := by -- rfl -- --/-- Reidentify the two presentations of the embedded lower fixing subgroup --without transporting dependent subgroup data through an equality. -/ --private noncomputable def numberFieldEmbeddedBaseChangeBaseEquiv -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- (numberFieldEmbeddedBaseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ≃* -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup := -- MulEquiv.subgroupCongr -- (congrArg ClosedSubgroup.toSubgroup -- (numberFieldEmbeddedBaseSubgroup_baseChange_eq K K' L L' j)) -- --/-- Under the identity equivalence of the two lower fixing subgroups, the --relative subgroup for the base change is exactly the target presentation. -/ --private theorem numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)) -- (numberFieldEmbeddedTopSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j))).map -- (numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j).toMonoidHom = -- CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseSubgroup K' L' j) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) := by -- let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j -- have hTop : -- (numberFieldEmbeddedTopSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup = -- (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup := -- congrArg ClosedSubgroup.toSubgroup -- (numberFieldEmbeddedTopSubgroup_baseChange_eq -- (K := K) (K' := K') (L' := L') j) -- ext x -- constructor -- · rintro ⟨y, hy, rfl⟩ -- change -- ((e y : -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup) : -- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) ∈ -- (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup -- dsimp only [e, numberFieldEmbeddedBaseChangeBaseEquiv] -- rw [MulEquiv.subgroupCongr_apply, ← hTop] -- exact hy -- · intro hx -- refine ⟨e.symm x, ?_, e.apply_symm_apply x⟩ -- change -- (((e.symm x : -- (numberFieldEmbeddedBaseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup) : -- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) ∈ -- (numberFieldEmbeddedTopSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup) -- dsimp only [e, numberFieldEmbeddedBaseChangeBaseEquiv] -- rw [MulEquiv.subgroupCongr_symm_apply, hTop] -- exact hx -- --/-- Normality of the relative subgroup between the two embedded base fields --in a finite Galois base change. -/ --private theorem numberFieldEmbeddedBaseChangeExtensionSubgroup_normal -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseSubgroup K' L' j) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)).Normal := by -- let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j -- have hNormal := -- (numberFieldEmbeddedExtensionSubgroup_normal K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)).map -- e.toMonoidHom e.surjective -- rw [numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq -- K K' L L' j] at hNormal -- exact hNormal -- --noncomputable local instance -- numberFieldEmbeddedBaseChangeExtensionSubgroupNormal -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- (CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseSubgroup K' L' j) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)).Normal := -- numberFieldEmbeddedBaseChangeExtensionSubgroup_normal K K' L L' j -- --/-- Finiteness of the relative quotient between the two embedded base fields --in a finite Galois base change. -/ --private theorem numberFieldEmbeddedBaseChangeExtensionQuotient_finite -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- Finite -- ((numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseSubgroup K' L' j) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := by -- let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j -- let N := -- CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)) -- (numberFieldEmbeddedTopSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)) -- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)) -- let M := -- CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseSubgroup K' L' j) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) -- let hNNormal : N.Normal := -- numberFieldEmbeddedExtensionSubgroup_normal K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j) -- let hMNormal : M.Normal := -- numberFieldEmbeddedBaseChangeExtensionSubgroup_normal K K' L L' j -- let hNFinite : -- Finite -- ((numberFieldEmbeddedBaseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ⧸ N) := -- numberFieldEmbeddedExtensionQuotient_finite K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j) -- have hmap : N.map e.toMonoidHom = M := -- numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq K K' L L' j -- have hle : N ≤ M.comap e.toMonoidHom := by -- rw [← hmap] -- exact Subgroup.le_comap_map e.toMonoidHom N -- let f : -- ((numberFieldEmbeddedBaseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ⧸ N) →* -- ((numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ M) := -- QuotientGroup.map N M e.toMonoidHom hle -- have hmk : Function.Surjective -- (QuotientGroup.mk ∘ e : -- (numberFieldEmbeddedBaseSubgroup K K' -- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup → -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ M) := -- QuotientGroup.mk_surjective.comp e.surjective -- have hsurj : Function.Surjective f := -- QuotientGroup.map_surjective_of_surjective -- (N := N) M e.toMonoidHom hmk hle -- exact Finite.of_surjective f hsurj -- --noncomputable local instance -- numberFieldEmbeddedBaseChangeExtensionQuotientFinite -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- Finite -- ((numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseSubgroup K' L' j) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -- numberFieldEmbeddedBaseChangeExtensionQuotient_finite K K' L L' j -- --/-- Reuse the canonical absolute fixed-field witness for the lower embedded --tower. The base-change relative witness below needs this exact instance path --when forming the absolute finite-dimensional tower. -/ --noncomputable local instance -- numberFieldEmbeddedBaseChangeBaseFixedFieldFiniteDimensional -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteDimensional ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) := -- numberFieldEmbeddedAbstractFixedFieldFiniteDimensional K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')) -- --noncomputable local instance -- numberFieldEmbeddedBaseChangeRelativeFixedFieldFiniteDimensional -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteDimensional -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -- abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseSubgroup K' L' j) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) -- (numberFieldEmbeddedAbsoluteQuotientFinite K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseChangeExtensionQuotientFinite K K' L L' j) -- --local instance -- numberFieldEmbeddedBaseChangeRelativeFixedFieldScalarTower -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- IsScalarTower ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -- --noncomputable local instance -- numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- FiniteDimensional ℚ -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -- FiniteDimensional.trans ℚ -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) -- --noncomputable local instance -- numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- NumberField -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -- NumberField.of_module_finite ℚ -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) -- --noncomputable local instance -- numberFieldEmbeddedBaseChangeRelativeFixedFieldIsGalois -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- IsGalois -- (abstractFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) -- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -- abstractRelativeFixedField_isGalois -- ℚ (SeparableClosure ℚ) -- (numberFieldEmbeddedBaseSubgroup K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -- (numberFieldEmbeddedBaseSubgroup K' L' j) -- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) -- (numberFieldEmbeddedBaseChangeExtensionSubgroupNormal K K' L L' j) -- --/-- In one common rational-separable-closure realization, the canonical --quotient-to-Galois comparisons intertwine abstract restriction with --ordinary restriction of the actual number-field automorphisms. -/ --theorem -- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup_restriction -- [FiniteDimensional K L] [IsAbelianGalois K L] -- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) -- (z : -- Abelianization -- (numberFieldEmbeddedFiniteGaloisSubextension -- K' L' j).extensionQuotient) : -- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ L L') -- let H := -- numberFieldEmbeddedBaseSubgroup K L jLower -- let H' := -- numberFieldEmbeddedBaseSubgroup K' L' j -- let J := -- numberFieldEmbeddedTopSubgroup K L jLower -- let J' := -- numberFieldEmbeddedTopSubgroup K' L' j -- let hH'H := -- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -- let hJ'J := -- numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j -- let hJH := -- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L jLower -- let hJ'H' := -- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K' L' j -- letI _ : -- (CyclicCohomology.extensionSubgroup H J hJH).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal K L jLower -- letI _ : -- (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := -- numberFieldEmbeddedExtensionSubgroup_normal K' L' j -- ((AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K)) -- (Additive.toMul -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K' L' j (Additive.ofMul z))) = -- Additive.toMul -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L jLower -- (MonoidHom.toAdditive -- (normResidueNaturalityAbelianizedRestriction -- H H' J J' -- hJH hJ'H' -- hH'H hJ'J) -- (Additive.ofMul z))) := by -- dsimp only -- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ L L') -- let H := -- numberFieldEmbeddedBaseSubgroup K L jLower -- let H' := -- numberFieldEmbeddedBaseSubgroup K' L' j -- let J := -- numberFieldEmbeddedTopSubgroup K L jLower -- let J' := -- numberFieldEmbeddedTopSubgroup K' L' j -- let hH'H := -- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -- let hJ'J := -- numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j -- let hJH := -- numberFieldEmbeddedTopSubgroup_le_baseSubgroup -- K L jLower -- let hJ'H' := -- numberFieldEmbeddedTopSubgroup_le_baseSubgroup -- K' L' j -- let hLowerNormal : -- (CyclicCohomology.extensionSubgroup H J hJH).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal K L jLower -- let hUpperNormal : -- (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := -- numberFieldEmbeddedExtensionSubgroup_normal K' L' j -- let qLower := -- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup -- K L jLower -- let qUpper := -- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup -- K' L' j -- let qLowerRaw : -- (H.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H J hJH) ≃* -- Gal(L / K) := by -- exact -- { qLower.toEquiv with -- map_mul' := fun x y => qLower.map_mul x y } -- let qUpperRaw : -- (H'.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H' J' hJ'H') ≃* -- Gal(L' / K') := by -- exact -- { qUpper.toEquiv with -- map_mul' := fun x y => qUpper.map_mul x y } -- let restrictActual : -- Gal(L' / K') →* Gal(L / K) := -- (AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K) -- obtain ⟨q, rfl⟩ := -- QuotientGroup.mk_surjective z -- obtain ⟨σ, rfl⟩ := -- (numberFieldEmbeddedFiniteGaloisSubextension -- K' L' j).extensionQuotientMk_surjective q -- change -- restrictActual -- ((Abelianization.equivOfComm (H := Gal(L' / K'))).symm -- (qUpperRaw.abelianizationCongr -- (Abelianization.of (QuotientGroup.mk σ)))) = -- (Abelianization.equivOfComm (H := Gal(L / K))).symm -- (qLowerRaw.abelianizationCongr -- (normResidueNaturalityAbelianizedRestriction -- H H' J J' hJH hJ'H' hH'H hJ'J -- (Abelianization.of (QuotientGroup.mk σ)))) -- rw [normResidueNaturalityAbelianizedRestriction_of_mk, -- abelianizationCongr_of, abelianizationCongr_of] -- change -- restrictActual (qUpperRaw (QuotientGroup.mk σ)) = -- qLowerRaw -- (QuotientGroup.mk (Subgroup.inclusion hH'H σ)) -- apply AlgEquiv.ext -- intro x -- apply jLower.injective -- let hUpperAlgebra : Algebra K' (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra K' L' j -- let eUpper := -- numberFieldEmbeddedSeparableClosureEquiv K' L' j -- let hLowerAlgebra : Algebra K (SeparableClosure ℚ) := -- numberFieldEmbeddedSeparableClosureAlgebra K L jLower -- let eLower := -- numberFieldEmbeddedSeparableClosureEquiv K L jLower -- calc -- jLower -- (restrictActual -- (qUpperRaw (QuotientGroup.mk σ)) x) = -- j -- ((qUpperRaw (QuotientGroup.mk σ)) -- (algebraMap L L' x)) := by -- exact congrArg j -- (AlgEquiv.restrictNormal_commutes -- ((AlgEquiv.restrictScalarsHom K) -- (qUpperRaw (QuotientGroup.mk σ))) -- L x) -- _ = σ.1.1 -- (j (algebraMap L L' x)) := by -- exact -- ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply -- ℚ K' L' j eUpper σ (algebraMap L L' x) -- _ = (Subgroup.inclusion hH'H σ).1.1 -- (jLower x) := rfl -- _ = jLower -- (qLowerRaw -- (QuotientGroup.mk -- (Subgroup.inclusion hH'H σ)) x) := by -- exact -- (ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply -- ℚ K L jLower eLower -- (Subgroup.inclusion hH'H σ) x).symm -- --/-- In a compatible common embedding, the fixed-part relative norm --between two (Galois-related) base fields is the genuine ordinary --idele-class norm. -/ --theorem numberFieldEmbeddedIdeleClassEquivAmbientFixed_relativeNorm -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) -- (c : IdeleClassGroup K') : -- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ L L') -- let H := -- numberFieldEmbeddedBaseSubgroup K L jLower -- let H' := -- numberFieldEmbeddedBaseSubgroup K' L' j -- let hH'H := -- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -- letI _ : Finite -- (H.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H H' hH'H) := -- numberFieldEmbeddedBaseChangeExtensionQuotientFinite -- K K' L L' j -- relativeNorm rationalIdeleClassRepresentation H H' hH'H -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K' L' j (Additive.ofMul c)) = -- numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K L jLower -- (Additive.ofMul (_root_.ideleClassNorm K K' c)) := by -- intro jLower H H' -- let hH'H := -- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -- let hnormal := -- numberFieldEmbeddedBaseChangeExtensionSubgroupNormal K K' L L' j -- let F := -- abstractFixedField ℚ (SeparableClosure ℚ) H -- let E := -- abstractRelativeFixedField ℚ (SeparableClosure ℚ) hH'H -- let _ : -- (CyclicCohomology.extensionSubgroup H H' hH'H).Normal := -- hnormal -- let _ : -- Finite -- (H.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H H' hH'H) := -- numberFieldEmbeddedBaseChangeExtensionQuotientFinite -- K K' L L' j -- let _ : -- Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- H (le_baseField H)) := -- numberFieldEmbeddedAbsoluteQuotientFinite K L jLower -- let _ : NumberField F := -- numberFieldEmbeddedAbstractFixedFieldNumberField K L jLower -- let _ : NumberField E := -- numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField -- K K' L L' j -- let _ : FiniteDimensional ℚ (E.restrictScalars ℚ) := by -- change FiniteDimensional ℚ E -- exact -- numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional -- K K' L L' j -- let _ : NumberField -- (abstractFixedField ℚ (SeparableClosure ℚ) H') := -- numberFieldEmbeddedAbstractFixedFieldNumberField K' L' j -- have hE : -- E.restrictScalars ℚ = -- abstractFixedField ℚ (SeparableClosure ℚ) H' := -- IntermediateField.extendScalars_restrictScalars -- (abstractFixedField_le -- ℚ (SeparableClosure ℚ) hH'H) -- let eRel : -- E ≃ₐ[ℚ] -- abstractFixedField ℚ (SeparableClosure ℚ) H' := -- IntermediateField.equivOfEq hE -- let eK : -- K ≃ₐ[ℚ] F := -- numberFieldEmbeddedAbstractBaseFieldEquiv K L jLower -- let eK'Base : -- K' ≃ₐ[ℚ] -- abstractFixedField ℚ (SeparableClosure ℚ) H' := -- numberFieldEmbeddedAbstractBaseFieldEquiv K' L' j -- let eK' : K' ≃ₐ[ℚ] E := -- eK'Base.trans eRel.symm -- have hcompat (x : K) : -- eK' (algebraMap K K' x) = -- algebraMap F E (eK x) := by -- apply eRel.injective -- apply Subtype.ext -- change -- j (algebraMap K' L' (algebraMap K K' x)) = -- j (algebraMap L L' (algebraMap K L x)) -- rw [← IsScalarTower.algebraMap_apply K K' L', -- ← IsScalarTower.algebraMap_apply K L L'] -- have hupper : -- rationalAbstractRelativeFixedFieldIdeleClassEquivFixed -- H H' hH'H -- (Additive.ofMul (ideleClassCongr eK' c)) = -- numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K' L' j (Additive.ofMul c) := by -- apply Subtype.ext -- change -- ((rationalIdeleClassEquivFixed (E.restrictScalars ℚ)) -- (Additive.ofMul (ideleClassCongr eK' c))).1 = -- ((rationalIdeleClassEquivFixed -- (abstractFixedField ℚ (SeparableClosure ℚ) H')) -- (Additive.ofMul (ideleClassCongr eK'Base c))).1 -- exact rationalIdeleClassEquivFixed_transport_baseEquiv_val -- (T := K') (A := E.restrictScalars ℚ) -- (B := abstractFixedField ℚ (SeparableClosure ℚ) H') hE eK'Base c -- have hrelative := -- rationalAbstractRelativeFixedFieldIdeleClassEquivFixed_relativeNorm -- H H' hH'H hnormal -- (Additive.ofMul (ideleClassCongr eK' c)) -- change -- relativeNorm rationalIdeleClassRepresentation H H' hH'H -- (rationalAbstractRelativeFixedFieldIdeleClassEquivFixed -- H H' hH'H -- (Additive.ofMul (ideleClassCongr eK' c))) = -- rationalAbstractFixedFieldIdeleClassEquivFixed H -- (Additive.ofMul -- (_root_.ideleClassNorm F E -- (ideleClassCongr eK' c))) -- at hrelative -- calc -- relativeNorm rationalIdeleClassRepresentation H H' hH'H -- (numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K' L' j (Additive.ofMul c)) = -- relativeNorm rationalIdeleClassRepresentation H H' hH'H -- (rationalAbstractRelativeFixedFieldIdeleClassEquivFixed -- H H' hH'H (Additive.ofMul (ideleClassCongr eK' c))) := -- congrArg (relativeNorm rationalIdeleClassRepresentation H H' hH'H) -- hupper.symm -- _ = rationalAbstractFixedFieldIdeleClassEquivFixed H -- (Additive.ofMul -- (_root_.ideleClassNorm F E (ideleClassCongr eK' c))) := hrelative -- _ = numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K L jLower (Additive.ofMul (_root_.ideleClassNorm K K' c)) := by -- change -- rationalAbstractFixedFieldIdeleClassEquivFixed H -- (Additive.ofMul -- (_root_.ideleClassNorm F E (ideleClassCongr eK' c))) = -- rationalAbstractFixedFieldIdeleClassEquivFixed H -- (Additive.ofMul -- (ideleClassCongr eK (_root_.ideleClassNorm K K' c))) -- apply congrArg (rationalAbstractFixedFieldIdeleClassEquivFixed H) -- apply congrArg Additive.ofMul -- exact -- (ideleClassCongr_ideleClassNorm -- (K := K) (K' := F) (L := K') (L' := E) eK eK' hcompat c).symm -- --/-- For one common compatible embedding of a Galois base-change --diamond, the genuine global norm-residue maps commute with ordinary --idele-class norm and actual restriction of automorphisms. -/ --theorem globalNormResidueMonoidHomOfEmbedding_norm_restriction -- [FiniteDimensional K L] [IsAbelianGalois K L] -- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ L L') -- ((AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K)).comp -- (globalNormResidueMonoidHomOfEmbedding K' L' j) = -- (globalNormResidueMonoidHomOfEmbedding K L jLower).comp -- (_root_.ideleClassNorm K K') := by -- dsimp only -- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -- j.comp (IsScalarTower.toAlgHom ℚ L L') -- let H := -- numberFieldEmbeddedBaseSubgroup K L jLower -- let H' := -- numberFieldEmbeddedBaseSubgroup K' L' j -- let J := -- numberFieldEmbeddedTopSubgroup K L jLower -- let J' := -- numberFieldEmbeddedTopSubgroup K' L' j -- let hJH := -- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L jLower -- let hJ'H' := -- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K' L' j -- let hH'H := -- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -- let hJ'J := -- numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j -- let _ : -- (CyclicCohomology.extensionSubgroup H J hJH).Normal := -- numberFieldEmbeddedExtensionSubgroup_normal K L jLower -- let _ : -- Finite -- (H.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H J hJH) := -- numberFieldEmbeddedExtensionQuotient_finite K L jLower -- let _ : -- (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := -- numberFieldEmbeddedExtensionSubgroup_normal K' L' j -- let _ : -- Finite -- (H'.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H' J' hJ'H') := -- numberFieldEmbeddedExtensionQuotient_finite K' L' j -- let hHH'finite := -- numberFieldEmbeddedBaseChangeExtensionQuotientFinite K K' L L' j -- let T : -- FiniteAbstractFieldExtension -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -- { field := numberFieldEmbeddedFiniteAbstractField K' L' j -- base := numberFieldEmbeddedFiniteAbstractField K L jLower -- below := hH'H -- finiteQuotient := hHH'finite } -- let hTBaseNormal : -- (CyclicCohomology.extensionSubgroup -- T.base.field J hJH).Normal := by -- change -- (CyclicCohomology.extensionSubgroup H J hJH).Normal -- exact numberFieldEmbeddedExtensionSubgroup_normal K L jLower -- let hTBaseFinite : -- Finite -- (T.base.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- T.base.field J hJH) := by -- change -- Finite -- (H.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H J hJH) -- exact numberFieldEmbeddedExtensionQuotient_finite K L jLower -- let hTFieldNormal : -- (CyclicCohomology.extensionSubgroup -- T.field.field J' hJ'H').Normal := by -- change -- (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal -- exact numberFieldEmbeddedExtensionSubgroup_normal K' L' j -- let hTFieldFinite : -- Finite -- (T.field.field.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup -- T.field.field J' hJ'H') := by -- change -- Finite -- (H'.toSubgroup ⧸ -- CyclicCohomology.extensionSubgroup H' J' hJ'H') -- exact numberFieldEmbeddedExtensionQuotient_finite K' L' j -- let restrictActual : -- Gal(L' / K') →* Gal(L / K) := -- (AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K) -- apply MonoidHom.ext -- intro c -- let a := -- numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K' L' j (Additive.ofMul c) -- have hnat := -- DegreeData.normResidueNaturality_norm_restriction -- (D := rationalCyclotomicDegreeData) -- (A := rationalIdeleClassRepresentation) -- (v := rationalCyclotomicIdeleClassValuationData) -- (hcf := rationalIdeleClassRepresentation_satisfiesClassFieldAxiom) -- (T := T) (L := J) (L' := J') -- (hLnormal := hTBaseNormal) -- (hL'normal := hTFieldNormal) -- (hLKfinite := hTBaseFinite) -- (hL'K'finite := hTFieldFinite) -- hJH hJ'H' hJ'J -- have hnatc := -- DFunLike.congr_fun hnat -- (finiteNormClass rationalIdeleClassRepresentation -- H' J' hJ'H' a) -- change _ = -- rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- T.base -- { field := J -- below := hJH -- normal := hTBaseNormal -- finite := hTBaseFinite } -- (finiteReciprocityNaturalityNormMap -- rationalIdeleClassRepresentation -- T.base.field T.field.field J J' -- hJH hJ'H' T.below hJ'J -- (finiteNormClass rationalIdeleClassRepresentation -- T.field.field J' hJ'H' a)) at hnatc -- rw [finiteReciprocityNaturalityNormMap_finiteNormClass] -- at hnatc -- have hnorm : -- relativeNorm rationalIdeleClassRepresentation -- H H' hH'H a = -- numberFieldEmbeddedIdeleClassEquivAmbientFixed -- K L jLower -- (Additive.ofMul (_root_.ideleClassNorm K K' c)) := -- numberFieldEmbeddedIdeleClassEquivAmbientFixed_relativeNorm -- K K' L L' j c -- calc -- restrictActual -- (globalNormResidueMonoidHomOfEmbedding K' L' j c) = -- restrictActual -- (Additive.toMul -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K' L' j -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldEmbeddedFiniteAbstractField K' L' j) -- (numberFieldEmbeddedFiniteGaloisSubextension K' L' j) -- (finiteNormClass rationalIdeleClassRepresentation -- H' J' hJ'H' a)))) := by -- rw [globalNormResidueMonoidHomOfEmbedding_apply] -- _ = -- Additive.toMul -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L jLower -- (MonoidHom.toAdditive -- (normResidueNaturalityAbelianizedRestriction -- H H' J J' hJH hJ'H' hH'H hJ'J) -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldEmbeddedFiniteAbstractField K' L' j) -- (numberFieldEmbeddedFiniteGaloisSubextension K' L' j) -- (finiteNormClass rationalIdeleClassRepresentation -- H' J' hJ'H' a)))) := by -- exact -- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup_restriction -- K K' L L' j _ -- _ = -- Additive.toMul -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L jLower -- (rationalCyclotomicDegreeData.normResidueSymbol -- rationalIdeleClassRepresentation -- rationalCyclotomicIdeleClassValuationData -- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -- (numberFieldEmbeddedFiniteAbstractField K L jLower) -- (numberFieldEmbeddedFiniteGaloisSubextension K L jLower) -- (finiteNormClass rationalIdeleClassRepresentation -- H J hJH -- (relativeNorm rationalIdeleClassRepresentation -- H H' hH'H a)))) := by -- exact congrArg -- (fun z => -- Additive.toMul -- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -- K L jLower z)) -- hnatc -- _ = -- globalNormResidueMonoidHomOfEmbedding K L jLower -- (_root_.ideleClassNorm K K' c) := by -- rw [hnorm, -- ← globalNormResidueMonoidHomOfEmbedding_apply] - --end EmbeddedNumberFieldRestriction -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal - - variable - {G : IntegralRepGroupType} [Group G] [TopologicalSpace G] -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityAbelianValues.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityAbelianValues.lean -new file mode 100644 -index 0000000..b6abdd5 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityAbelianValues.lean -@@ -0,0 +1,429 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityExtensionValues -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+ -+section AbstractFixedFieldInclusion -+ -+variable -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal -+ naturalityAbstractFixedFieldBaseQuotientFinite -+ naturalityAbstractFixedFieldRelativeQuotientFinite -+ naturalityAbstractFixedFieldFiniteDimensional -+ naturalityAbstractRelativeFixedFieldFiniteDimensional -+ naturalityAbstractFixedFieldRelativeScalarTower -+ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional -+ naturalityAbstractFixedFieldNumberField -+ naturalityAbstractRelativeFixedFieldNumberField -+ naturalityAbstractRelativeFixedFieldIsGalois -+ naturalityAbstractRelativeFixedFieldIsAbelianGalois -+ -+ -+/-- The additive equivalence from the abelianized extension quotient to the -+Galois group of the relative fixed field, transported through its embedding. -/ -+noncomputable def -+ abstractFixedFieldInclusionTransportedAbelianizedEquiv -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ Additive -+ (Abelianization -+ P.toFiniteGaloisExtension.extensionQuotient) ≃+ -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -+ numberFieldEmbeddedFiniteGaloisSubextension F E j -+ have hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ have hPEmbedded : -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension X.field) -+ hHEmbedded) -+ PEmbedded = -+ P.toFiniteGaloisExtension := -+ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -+ exact -+ abelianizedExtensionQuotientAddEquiv_transportExtension hPEmbedded -+ (abelianizedExtensionQuotientAddEquiv_transportBase -+ hHEmbedded PEmbedded -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ F E j)) -+ -+/-- Canonical abelianization comparison built from the already transported -+opaque extension-quotient endpoint. -/ -+private noncomputable def -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ Additive -+ (Abelianization -+ P.toFiniteGaloisExtension.extensionQuotient) ≃+ -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by -+ let Q := -+ Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) -+ exact -+ MulEquiv.toAdditive -+ ((MulEquiv.abelianizationCongr -+ (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P)).trans -+ (Abelianization.equivOfComm : Q ≃* Abelianization Q).symm) -+ -+/-- Pointwise opaque value of the transported abelianized equivalence. -/ -+private noncomputable def -+ abstractFixedFieldInclusionTransportedAbelianizedValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (z : Additive -+ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := -+ abstractFixedFieldInclusionTransportedAbelianizedEquiv H P z -+ -+/-- Pointwise opaque value of the canonical abelianization comparison built -+from the transported quotient endpoint. -/ -+private noncomputable def -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (z : Additive -+ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv H P z -+ -+/-- Pointwise opaque value of the intrinsic abstract fixed-field -+abelianization comparison. -/ -+private noncomputable def -+ abstractFixedFieldInclusionCanonicalAbelianizedValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (z : Additive -+ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := -+ abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P z -+ -+/-- The transported abelianized endpoint agrees pointwise with the canonical -+abelianization comparison built from the transported quotient endpoint. -/ -+private theorem -+ abstractFixedFieldInclusionTransportedAbelianizedValue_eq_canonical -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (z : Additive -+ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -+ abstractFixedFieldInclusionTransportedAbelianizedValue H P z = -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue -+ H P z := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -+ numberFieldEmbeddedFiniteGaloisSubextension F E j -+ have hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ have hPEmbedded : -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension X.field) -+ hHEmbedded) -+ PEmbedded = -+ P.toFiniteGaloisExtension := -+ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -+ let qEmbedded : PEmbedded.extensionQuotient ≃* Gal(E / F) := -+ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup F E j -+ have hCanonical : -+ abstractFixedFieldInclusionTransportedAbelianizedEquiv H P = -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv -+ H P := by -+ simpa only [ -+ abstractFixedFieldInclusionTransportedAbelianizedEquiv, -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv, -+ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv, -+ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup, -+ qEmbedded] using -+ (abelianizedCanonicalEquiv_transportFiniteGalois -+ hHEmbedded PEmbedded hPEmbedded qEmbedded) -+ exact DFunLike.congr_fun hCanonical z -+ -+/-- On an abelianization representative, the transported canonical endpoint -+is the additive value of the transported quotient endpoint. -/ -+private theorem -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_of -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) : -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue H P -+ (Additive.ofMul (Abelianization.of q)) = -+ Additive.ofMul -+ (abstractFixedFieldInclusionTransportedExtensionQuotientValue -+ H P q) := by -+ simpa only [ -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue, -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv, -+ abstractFixedFieldInclusionTransportedExtensionQuotientValue] using -+ (abelianizationCongrToComm_apply -+ (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P) q) -+ -+/-- On the same representative, the intrinsic fixed-field endpoint is the -+additive value of the canonical quotient endpoint. -/ -+private theorem -+ abstractFixedFieldInclusionCanonicalAbelianizedValue_of -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) : -+ abstractFixedFieldInclusionCanonicalAbelianizedValue H P -+ (Additive.ofMul (Abelianization.of q)) = -+ Additive.ofMul -+ (abstractFixedFieldInclusionCanonicalExtensionQuotientValue -+ H P q) := by -+ let hRawQuotientCommGroup : -+ CommGroup P.toFiniteGaloisExtension.extensionQuotient := -+ { (inferInstance : -+ Group P.toFiniteGaloisExtension.extensionQuotient) with -+ mul_comm := P.commutative.is_comm.comm } -+ let qAbstractRaw := -+ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv H P -+ change -+ MulEquiv.toAdditive -+ ((Abelianization.equivOfComm : -+ P.toFiniteGaloisExtension.extensionQuotient ≃* -+ Abelianization -+ P.toFiniteGaloisExtension.extensionQuotient).symm.trans -+ qAbstractRaw) -+ (Additive.ofMul (Abelianization.of q)) = -+ Additive.ofMul (qAbstractRaw q) -+ exact commutativeAbelianizationEquiv_apply qAbstractRaw q -+ -+/-- The canonical abelianization comparison built after transport agrees -+pointwise with the intrinsic abstract fixed-field comparison. -/ -+private theorem -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_eq -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (z : Additive -+ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue H P z = -+ abstractFixedFieldInclusionCanonicalAbelianizedValue H P z := by -+ let q : P.toFiniteGaloisExtension.extensionQuotient := -+ Quotient.out z.toMul -+ have hz : Additive.ofMul (Abelianization.of q) = z := by -+ apply Additive.ext -+ exact Quotient.out_eq' z.toMul -+ rw [← hz] -+ calc -+ _ = Additive.ofMul -+ (abstractFixedFieldInclusionTransportedExtensionQuotientValue -+ H P q) := -+ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_of -+ H P q -+ _ = Additive.ofMul -+ (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue -+ H P q) := -+ congrArg Additive.ofMul -+ (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv_apply -+ H P q) -+ _ = Additive.ofMul -+ (abstractFixedFieldInclusionCanonicalExtensionQuotientValue -+ H P q) := -+ congrArg Additive.ofMul -+ (abstractFixedFieldInclusionExtensionQuotientEquiv_apply H P q) -+ _ = _ := -+ (abstractFixedFieldInclusionCanonicalAbelianizedValue_of H P q).symm -+ -+/-- The transported abelianized equivalence agrees pointwise with the -+intrinsic abstract fixed-field Galois comparison. -/ -+theorem -+ abstractFixedFieldInclusionTransportedAbelianizedValue_eq -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (z : Additive -+ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : -+ abstractFixedFieldInclusionTransportedAbelianizedValue H P z = -+ abstractFixedFieldInclusionCanonicalAbelianizedValue H P z := -+ (abstractFixedFieldInclusionTransportedAbelianizedValue_eq_canonical -+ H P z).trans -+ (abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_eq -+ H P z) -+ -+ -+/-- The norm-residue value of an idele class in the Galois group of the -+relative fixed field, computed through the embedded number-field realization. -/ -+noncomputable def -+ abstractFixedFieldInclusionEmbeddedNormResidueValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (c : Additive -+ (IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -+ numberFieldEmbeddedFiniteGaloisSubextension F E j -+ exact -+ rationalFiniteNormResidueValue HEmbedded PEmbedded -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ F E j) -+ c -+ -+/-- Opaque packaged value after transporting both dependent structures to -+the canonical `H` and `P` endpoints. -/ -+noncomputable def -+ abstractFixedFieldInclusionTransportedNormResidueValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (c : Additive -+ (IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ have hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ let eIdeleEmbedded := -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j -+ let eIdeleOverH : -+ Additive (IdeleClassGroup F) ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation H.field := -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ Additive (IdeleClassGroup F) ≃+ -+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation X.field) -+ hHEmbedded) -+ eIdeleEmbedded -+ exact -+ rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -+ eIdeleOverH -+ (abstractFixedFieldInclusionTransportedAbelianizedEquiv H P) -+ c -+ -+/-- Opaque intrinsic packaged norm-residue value at the canonical endpoints. -/ -+noncomputable def -+ abstractFixedFieldInclusionCanonicalNormResidueValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (c : Additive -+ (IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -+ Additive -+ (Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := -+ rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -+ (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) -+ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) -+ c -+ -+ -+end AbstractFixedFieldInclusion -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityEmbeddedValues.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityEmbeddedValues.lean -new file mode 100644 -index 0000000..2f5a677 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityEmbeddedValues.lean -@@ -0,0 +1,396 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityFixedBase -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+ -+section AbstractFixedFieldInclusion -+ -+variable -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal -+ naturalityAbstractFixedFieldBaseQuotientFinite -+ naturalityAbstractFixedFieldRelativeQuotientFinite -+ naturalityAbstractFixedFieldFiniteDimensional -+ naturalityAbstractRelativeFixedFieldFiniteDimensional -+ naturalityAbstractFixedFieldRelativeScalarTower -+ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional -+ naturalityAbstractFixedFieldNumberField -+ naturalityAbstractRelativeFixedFieldNumberField -+ naturalityAbstractRelativeFixedFieldIsGalois -+ naturalityAbstractRelativeFixedFieldIsAbelianGalois -+ -+/-- The finite abstract field reconstructed from the literal fixed-field -+inclusion is the original packaged abstract field. Keeping this structure -+equality separate avoids repeatedly rebuilding all of its proof fields. -/ -+theorem -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ numberFieldEmbeddedFiniteAbstractField F E j = H := by -+ dsimp only -+ exact FiniteAbstractField.eq_of_field_eq _ _ -+ (numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P) -+ -+ -+theorem -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed_transport_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (c : Additive -+ (IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ Additive (IdeleClassGroup F) ≃+ -+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation X.field) -+ hHEmbedded) -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) c = -+ rationalAbstractFixedFieldIdeleClassEquivFixed H.field c := by -+ dsimp only -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hBase : -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -+ have hHEmbedded : -+ numberFieldEmbeddedFiniteAbstractField F E j = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ have hFixedBase : -+ abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup F E j) = F := -+ congrArg -+ (abstractFixedField ℚ (SeparableClosure ℚ)) hBase -+ let eBase : F ≃ₐ[ℚ] F := -+ (numberFieldEmbeddedAbstractBaseFieldEquiv F E j).trans -+ (IntermediateField.equivOfEq hFixedBase) -+ have heBase : -+ eBase = (AlgEquiv.refl : F ≃ₐ[ℚ] F) := by -+ apply AlgEquiv.ext -+ intro x -+ apply Subtype.ext -+ change x.1 = x.1 -+ rfl -+ let hEmbeddedQuotientFinite := -+ numberFieldEmbeddedAbsoluteQuotientFinite F E j -+ let hEmbeddedFixedFiniteDimensional := -+ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional F E j -+ apply Subtype.ext -+ rw [rationalAmbientFixedAddEquiv_transport_apply_val -+ hHEmbedded -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) c] -+ dsimp only [numberFieldEmbeddedIdeleClassEquivAmbientFixed] -+ simp only [AddEquiv.trans_apply] -+ change -+ ((rationalIdeleClassEquivFixed -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup F E j))) -+ (MulEquiv.toAdditive -+ (ideleClassCongr -+ (numberFieldEmbeddedAbstractBaseFieldEquiv F E j)) c)).1 = -+ ((rationalIdeleClassEquivFixed F) c).1 -+ exact rationalIdeleClassEquivFixed_congr_apply_val -+ hFixedBase -+ (numberFieldEmbeddedAbstractBaseFieldEquiv F E j) -+ heBase c -+ -+/-- Transporting the finite Galois subextension reconstructed from the literal -+fixed-field inclusion recovers the canonical subextension packaged by `P`. -+This is the sole dependent structure equality used by the later quotient -+comparisons. -/ -+theorem -+ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -+ numberFieldEmbeddedFiniteGaloisSubextension F E j -+ let hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension X.field) -+ hHEmbedded) -+ PEmbedded = -+ P.toFiniteGaloisExtension := by -+ dsimp only -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -+ numberFieldEmbeddedFiniteGaloisSubextension F E j -+ have hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ exact finiteGaloisSubextension_transport_eq_of_field_eq -+ hHEmbedded PEmbedded P.toFiniteGaloisExtension -+ (numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P) -+ -+/-- Opaque endpoint for the extension-quotient comparison supplied by the -+literal embedding. Its domain is already the canonical quotient of `P`, so -+no client has to reconstruct the two subgroup transports. -/ -+noncomputable def -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ P.toFiniteGaloisExtension.extensionQuotient ≃* -+ Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hBase : -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -+ have hTop : -+ numberFieldEmbeddedTopSubgroup F E j = P.field := -+ numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P -+ letI hAlgebra : Algebra F (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra F E j -+ let eSep := -+ numberFieldEmbeddedSeparableClosureEquiv F E j -+ letI hEmbeddedExtensionNormal : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal F E j -+ exact -+ P.toFiniteGaloisExtension.extensionQuotientMulEquiv.trans -+ ((extensionQuotientMulEquivOfEq -+ hBase.symm hTop.symm P.below -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).trans -+ (ambientEmbeddedExtensionQuotientEquivGaloisGroup -+ ℚ F E j eSep)) -+ -+/-- Opaque canonical endpoint for the same quotient, obtained directly from -+the abstract fixed-field realization. -/ -+noncomputable def -+ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ P.toFiniteGaloisExtension.extensionQuotient ≃* -+ Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by -+ exact -+ P.toFiniteGaloisExtension.extensionQuotientMulEquiv.trans -+ (abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) -+ H.field P.field P.below P.normal) -+ -+/-- Pointwise opaque endpoint of the embedded quotient equivalence. -/ -+noncomputable def -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) : -+ Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv H P q -+ -+/-- Pointwise opaque endpoint of the canonical quotient equivalence. -/ -+noncomputable def -+ abstractFixedFieldInclusionCanonicalExtensionQuotientValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) : -+ Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := -+ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv H P q -+ -+/-- Fully applied ambient value of the embedded quotient endpoint. -/ -+noncomputable def -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientApplyVal -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := -+ (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q x : -+ SeparableClosure ℚ) -+ -+/-- Fully applied ambient value of the canonical quotient endpoint. -/ -+noncomputable def -+ abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := -+ (abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q x : -+ SeparableClosure ℚ) -+ -+/-- The ambient Galois value attached to a representative of the canonical -+quotient, packaged behind a literal result type. -/ -+noncomputable def -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) : -+ Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hBase : -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -+ letI hAlgebra : Algebra F (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra F E j -+ let eSep := -+ numberFieldEmbeddedSeparableClosureEquiv F E j -+ letI hEmbeddedExtensionNormal : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal F E j -+ let σEmbedded : -+ (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := -+ (MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ -+ exact -+ ambientEmbeddedExtensionQuotientEquivGaloisGroup -+ ℚ F E j eSep (QuotientGroup.mk σEmbedded) -+ -+/-- Fully applied ambient value of the packaged representative endpoint. -/ -+noncomputable def -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := -+ (abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue H P σ x : -+ SeparableClosure ℚ) -+ -+/-- Ambient action of the representative after rebundling it in the embedded -+base subgroup. -/ -+noncomputable def -+ abstractFixedFieldInclusionRebasedAutomorphismApplyVal -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hBase : -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -+ let σEmbedded : -+ (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := -+ (MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ -+ exact σEmbedded.1.1 (x : SeparableClosure ℚ) -+ -+ -+end AbstractFixedFieldInclusion -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityExtensionValues.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityExtensionValues.lean -new file mode 100644 -index 0000000..def7569 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityExtensionValues.lean -@@ -0,0 +1,419 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityEmbeddedValues -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+ -+section AbstractFixedFieldInclusion -+ -+variable -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal -+ naturalityAbstractFixedFieldBaseQuotientFinite -+ naturalityAbstractFixedFieldRelativeQuotientFinite -+ naturalityAbstractFixedFieldFiniteDimensional -+ naturalityAbstractRelativeFixedFieldFiniteDimensional -+ naturalityAbstractFixedFieldRelativeScalarTower -+ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional -+ naturalityAbstractFixedFieldNumberField -+ naturalityAbstractRelativeFixedFieldNumberField -+ naturalityAbstractRelativeFixedFieldIsGalois -+ naturalityAbstractRelativeFixedFieldIsAbelianGalois -+ -+/-- The embedded quotient endpoint sends a canonical representative to the -+packaged ambient value above. -/ -+private theorem -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue_mk -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) : -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P -+ (P.toFiniteGaloisExtension.extensionQuotientMk σ) = -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue H P σ := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hBase : -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -+ have hTop : -+ numberFieldEmbeddedTopSubgroup F E j = P.field := -+ numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P -+ let hAlgebra : Algebra F (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra F E j -+ let eSep := -+ numberFieldEmbeddedSeparableClosureEquiv F E j -+ let hEmbeddedExtensionNormal : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal F E j -+ simp only [ -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue, -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv, -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue, -+ MulEquiv.trans_apply, -+ FiniteGaloisSubextension.extensionQuotientMk_apply] -+ exact congrArg -+ (ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep) -+ (extensionQuotientMulEquivOfEq_mk -+ hBase.symm hTop.symm P.below -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j) σ) -+ -+/-- The packaged ambient endpoint evaluates to the action of the rebundled -+representative. -/ -+private theorem -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal_eq_rebased -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal H P σ x = -+ abstractFixedFieldInclusionRebasedAutomorphismApplyVal H P σ x := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hBase : -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -+ let hAlgebra : Algebra F (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra F E j -+ let eSep := -+ numberFieldEmbeddedSeparableClosureEquiv F E j -+ let hEmbeddedExtensionNormal : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal F E j -+ let σEmbedded : -+ (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := -+ (MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ -+ have hmk := -+ ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply -+ ℚ F E j eSep σEmbedded x -+ change -+ (ambientEmbeddedExtensionQuotientEquivGaloisGroup -+ ℚ F E j eSep (QuotientGroup.mk σEmbedded) x : -+ SeparableClosure ℚ) = -+ σEmbedded.1.1 (x : SeparableClosure ℚ) at hmk -+ simpa only [ -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal, -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue, -+ abstractFixedFieldInclusionRebasedAutomorphismApplyVal] using hmk -+ -+/-- Rebundling the representative does not change its action in the ambient -+separable closure. -/ -+private theorem -+ abstractFixedFieldInclusionRebasedAutomorphismApplyVal_eq -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : -+ abstractFixedFieldInclusionRebasedAutomorphismApplyVal H P σ x = -+ σ.1.1 (x : SeparableClosure ℚ) := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hBase : -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -+ let σEmbedded : -+ (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := -+ (MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ -+ have hσEmbedded : -+ (σEmbedded.1 : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) = σ.1 := -+ closedSubgroupCongr_apply_val hBase.symm σ -+ change σEmbedded.1.1 (x : SeparableClosure ℚ) = _ -+ rw [hσEmbedded] -+ -+/-- The packaged ambient representative acts by the original automorphism on -+the underlying separable-closure value. -/ -+private theorem -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal H P σ x = -+ σ.1.1 (x : SeparableClosure ℚ) := by -+ exact -+ (abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal_eq_rebased -+ H P σ x).trans -+ (abstractFixedFieldInclusionRebasedAutomorphismApplyVal_eq H P σ x) -+ -+/-- Evaluation of the embedded quotient endpoint on a canonical quotient -+representative, stated only in the ambient separable closure. -/ -+private theorem -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv_mk_val -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientApplyVal H P -+ (P.toFiniteGaloisExtension.extensionQuotientMk σ) x = -+ σ.1.1 (x : SeparableClosure ℚ) := by -+ calc -+ _ = abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal -+ H P σ x := by -+ exact congrArg -+ (fun g => (g x : SeparableClosure ℚ)) -+ (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue_mk -+ H P σ) -+ _ = _ := -+ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue_apply -+ H P σ x -+ -+/-- Evaluation of the canonical abstract quotient endpoint on a quotient -+representative, again exposed only through its ambient value. -/ -+private theorem -+ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv_mk_val -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) -+ (x : abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) : -+ abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal H P -+ (P.toFiniteGaloisExtension.extensionQuotientMk σ) x = -+ σ.1.1 (x : SeparableClosure ℚ) := by -+ simp only [ -+ abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal, -+ abstractFixedFieldInclusionCanonicalExtensionQuotientValue, -+ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv, -+ MulEquiv.trans_apply, -+ FiniteGaloisSubextension.extensionQuotientMk_apply] -+ exact -+ (abstractExtensionQuotientEquivGaloisGroup_mk_apply_val -+ ℚ (SeparableClosure ℚ) -+ H.field P.field P.below P.normal σ x).symm -+ -+ -+theorem -+ abstractFixedFieldInclusionExtensionQuotientEquiv_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) : -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q = -+ abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q := by -+ refine P.toFiniteGaloisExtension.extensionQuotient_inductionOn -+ (motive := fun q => -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q = -+ abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q) -+ q ?_ -+ intro σ -+ apply AlgEquiv.ext -+ intro x -+ apply Subtype.ext -+ exact -+ (abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv_mk_val -+ H P σ x).trans -+ (abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv_mk_val -+ H P σ x).symm -+ -+ -+/-- The extension quotient identified with the Galois group of the corresponding -+relative fixed field, after transporting the embedded field structures. -/ -+noncomputable def -+ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ P.toFiniteGaloisExtension.extensionQuotient ≃* -+ Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -+ numberFieldEmbeddedFiniteGaloisSubextension F E j -+ have hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ have hPEmbedded : -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension X.field) -+ hHEmbedded) -+ PEmbedded = -+ P.toFiniteGaloisExtension := -+ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -+ exact -+ (extensionQuotientMulEquiv_transportFiniteGalois -+ hHEmbedded PEmbedded hPEmbedded).trans -+ (numberFieldEmbeddedExtensionQuotientEquivGaloisGroup F E j) -+ -+/-- Pointwise opaque endpoint of the transported quotient equivalence. -/ -+noncomputable def -+ abstractFixedFieldInclusionTransportedExtensionQuotientValue -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) : -+ Gal( -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) / -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := -+ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P q -+ -+ -+private theorem -+ abstractFixedFieldInclusionTransportedExtensionQuotientValue_mk -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (σ : H.field.toSubgroup) : -+ abstractFixedFieldInclusionTransportedExtensionQuotientValue H P -+ (P.toFiniteGaloisExtension.extensionQuotientMk σ) = -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P -+ (P.toFiniteGaloisExtension.extensionQuotientMk σ) := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hBase : -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P -+ have hTop : -+ numberFieldEmbeddedTopSubgroup F E j = P.field := -+ numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -+ numberFieldEmbeddedFiniteGaloisSubextension F E j -+ have hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ have hPEmbedded : -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension X.field) -+ hHEmbedded) -+ PEmbedded = -+ P.toFiniteGaloisExtension := -+ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -+ let hAlgebra : Algebra F (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra F E j -+ let eSep := -+ numberFieldEmbeddedSeparableClosureEquiv F E j -+ let hEmbeddedExtensionNormal : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup F E j) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal F E j -+ have hFieldEq : -+ (congrArg FiniteAbstractField.field hHEmbedded).symm = hBase.symm := -+ Subsingleton.elim _ _ -+ simp only [ -+ abstractFixedFieldInclusionTransportedExtensionQuotientValue, -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue, -+ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv, -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv, -+ MulEquiv.trans_apply, -+ extensionQuotientMulEquiv_transportFiniteGalois_mk, -+ FiniteGaloisSubextension.extensionQuotientMk_apply, -+ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup] -+ rw [hFieldEq] -+ change -+ ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep -+ (QuotientGroup.mk -+ ((MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ)) = _ -+ exact -+ (congrArg -+ (ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep) -+ (extensionQuotientMulEquivOfEq_mk -+ hBase.symm hTop.symm P.below -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j) σ)).symm -+ -+ -+theorem -+ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv_apply -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (q : P.toFiniteGaloisExtension.extensionQuotient) : -+ abstractFixedFieldInclusionTransportedExtensionQuotientValue H P q = -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q := by -+ refine P.toFiniteGaloisExtension.extensionQuotient_inductionOn -+ (motive := fun q => -+ abstractFixedFieldInclusionTransportedExtensionQuotientValue H P q = -+ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q) -+ q ?_ -+ intro σ -+ exact abstractFixedFieldInclusionTransportedExtensionQuotientValue_mk -+ H P σ -+ -+ -+end AbstractFixedFieldInclusion -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedBase.lean -new file mode 100644 -index 0000000..d3a9bb0 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedBase.lean -@@ -0,0 +1,376 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityTransports -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+ -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal -+ -+section AbstractFixedFieldInclusion -+ -+variable -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ -+local instance naturalityAbstractFixedFieldBaseQuotientFinite : -+ Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ H.field (le_baseField H.field)) := -+ H.finite -+ -+local instance naturalityAbstractFixedFieldRelativeQuotientFinite : -+ Finite -+ (H.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H.field P.field P.below) := -+ P.finite -+ -+noncomputable local instance -+ naturalityAbstractFixedFieldFiniteDimensional : -+ FiniteDimensional ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) := -+ abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) H.field H.finite -+ -+noncomputable local instance -+ naturalityAbstractRelativeFixedFieldFiniteDimensional : -+ FiniteDimensional -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) := -+ abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) -+ H.field P.field P.below H.finite P.finite -+ -+local instance naturalityAbstractFixedFieldRelativeScalarTower : -+ IsScalarTower ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) := -+ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -+ -+noncomputable local instance -+ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional : -+ FiniteDimensional ℚ -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) := -+ FiniteDimensional.trans ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) -+ -+noncomputable local instance naturalityAbstractFixedFieldNumberField : -+ NumberField -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) := -+ NumberField.of_module_finite ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ -+noncomputable local instance -+ naturalityAbstractRelativeFixedFieldNumberField : -+ NumberField -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) := -+ NumberField.of_module_finite ℚ -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) -+ -+/-- Use the same direct fixed-field Galois witness as the intrinsic -+norm-residue construction. This prevents the dependent Galois-group type -+from being synthesized through a second `IsAbelianGalois` instance path. -/ -+noncomputable local instance -+ naturalityAbstractRelativeFixedFieldIsGalois : -+ IsGalois -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) := -+ abstractRelativeFixedField_isGalois -+ ℚ (SeparableClosure ℚ) -+ H.field P.field P.below P.normal -+ -+noncomputable local instance -+ naturalityAbstractRelativeFixedFieldIsAbelianGalois : -+ IsAbelianGalois -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) := -+ finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P -+ -+/-- The lower subgroup obtained from the canonical inclusion of an abstract -+fixed-field tower is the original lower closed subgroup. -/ -+theorem -+ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ numberFieldEmbeddedBaseSubgroup F E j = H.field := by -+ dsimp only -+ have hi : -+ numberFieldEmbeddedLowerEmbedding -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) -+ ((abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ) = -+ (abstractFixedField -+ ℚ (SeparableClosure ℚ) H.field).val := by -+ ext x -+ rfl -+ have hRange : -+ (numberFieldEmbeddedLowerEmbedding -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) -+ ((abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ)).fieldRange = -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field := by -+ ext x -+ constructor -+ · rintro ⟨y, rfl⟩ -+ change -+ numberFieldEmbeddedLowerEmbedding -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below) -+ ((abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ) y ∈ -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ rw [hi] -+ exact y.property -+ · intro hx -+ refine ⟨⟨x, hx⟩, ?_⟩ -+ rw [hi] -+ rfl -+ rw [numberFieldEmbeddedBaseSubgroup, hRange] -+ exact -+ closedFixingSubgroup_abstractFixedField_eq -+ ℚ (SeparableClosure ℚ) H.field -+ -+/-- The upper subgroup obtained from the canonical inclusion of an abstract -+fixed-field tower is the original upper closed subgroup. -/ -+theorem -+ numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ numberFieldEmbeddedTopSubgroup F E j = P.field := by -+ dsimp only -+ rw [numberFieldEmbeddedTopSubgroup] -+ have hjRangeSelf : -+ ((abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ).fieldRange = -+ (abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below).restrictScalars ℚ := by -+ ext x -+ constructor -+ · rintro ⟨y, rfl⟩ -+ exact y.property -+ · intro hx -+ exact ⟨⟨x, hx⟩, rfl⟩ -+ have hjRange : -+ ((abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ).fieldRange = -+ abstractFixedField ℚ (SeparableClosure ℚ) P.field := by -+ exact hjRangeSelf.trans -+ (IntermediateField.extendScalars_restrictScalars -+ (abstractFixedField_le -+ ℚ (SeparableClosure ℚ) P.below)) -+ rw [hjRange] -+ exact -+ closedFixingSubgroup_abstractFixedField_eq -+ ℚ (SeparableClosure ℚ) P.field -+ -+/-- Transport a packaged rational norm-residue value directly from an equal -+abstract base to the finite Galois extension underlying `P`. Keeping the two -+dependent transports in their own declaration prevents their elaboration cost -+from accumulating in the main fixed-field comparison theorem. -/ -+theorem rationalFiniteNormResidueValue_transportToAbstractExtension -+ {A : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} -+ (hAH : A = H) -+ (L : FiniteGaloisSubextension A.field) -+ (hLP : -+ Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension Y.field) -+ hAH) -+ L = -+ P.toFiniteGaloisExtension) -+ {C X : Type} [AddGroup C] [AddGroup X] -+ (eIdele : C ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) -+ (eGalois : Additive (Abelianization L.extensionQuotient) ≃+ X) -+ (c : C) : -+ rationalFiniteNormResidueValue A L eIdele eGalois c = -+ rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -+ (Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ C ≃+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation Y.field) -+ hAH) -+ eIdele) -+ (abelianizedExtensionQuotientAddEquiv_transportExtension hLP -+ (abelianizedExtensionQuotientAddEquiv_transportBase -+ hAH L eGalois)) -+ c := by -+ calc -+ _ = rationalFiniteNormResidueValue H -+ (Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension Y.field) -+ hAH) -+ L) -+ (Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ C ≃+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation Y.field) -+ hAH) -+ eIdele) -+ (abelianizedExtensionQuotientAddEquiv_transportBase hAH L eGalois) -+ c := -+ rationalFiniteNormResidueValue_transportBase -+ (A := A) (B := H) (C := C) (X := X) -+ hAH L eIdele eGalois c -+ _ = _ := -+ rationalFiniteNormResidueValue_transportExtension -+ (K := H) -+ (P := Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension Y.field) -+ hAH) -+ L) -+ (Q := P.toFiniteGaloisExtension) (C := C) (X := X) -+ hLP -+ (Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ C ≃+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation Y.field) -+ hAH) -+ eIdele) -+ (abelianizedExtensionQuotientAddEquiv_transportBase hAH L eGalois) -+ c -+ -+/-- The packaged value at the literal fixed-field realization is the ambient -+fixed-part norm-residue homomorphism evaluated at the same idele class. -/ -+private theorem rationalFiniteNormResidueValue_abstractFixedField_eq_ambient -+ (c : IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) : -+ rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -+ (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) -+ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) -+ (Additive.ofMul c) = -+ ambientFixedGlobalNormResidueAddMonoidHom H P -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ H.field (Additive.ofMul c)) := by -+ let eRec := -+ rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ H P.toFiniteGaloisExtension -+ let eGal := -+ abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P -+ change -+ eGal -+ (eRec -+ (finiteNormClass rationalIdeleClassRepresentation -+ H.field P.field P.below -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ H.field (Additive.ofMul c)))) = -+ eGal -+ (eRec -+ (finiteNormClass rationalIdeleClassRepresentation -+ H.field P.field P.below -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ H.field (Additive.ofMul c)))) -+ rfl -+ -+/-- The packaged norm-residue value for the literal fixed-field realization -+is the intrinsic abstract fixed-field norm-residue value. -/ -+theorem rationalFiniteNormResidueValue_abstractFixedField_apply -+ (c : IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) : -+ Additive.toMul -+ (rationalFiniteNormResidueValue H P.toFiniteGaloisExtension -+ (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) -+ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup -+ H P) -+ (Additive.ofMul c)) = -+ abstractFixedFieldGlobalNormResidueMonoidHom H P c := by -+ let a := -+ rationalAbstractFixedFieldIdeleClassEquivFixed -+ H.field (Additive.ofMul c) -+ have hAbstract := -+ abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply H P a -+ calc -+ _ = Additive.toMul -+ (ambientFixedGlobalNormResidueAddMonoidHom H P -+ (rationalAbstractFixedFieldIdeleClassEquivFixed -+ H.field (Additive.ofMul c))) := by -+ exact congrArg Additive.toMul -+ (rationalFiniteNormResidueValue_abstractFixedField_eq_ambient -+ (H := H) (P := P) c) -+ _ = _ := by -+ simpa only [a, AddEquiv.symm_apply_apply, toMul_ofMul] using -+ hAbstract.symm -+ -+ -+end AbstractFixedFieldInclusion -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedComparison.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedComparison.lean -new file mode 100644 -index 0000000..ce523c2 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedComparison.lean -@@ -0,0 +1,237 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityAbelianValues -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+ -+section AbstractFixedFieldInclusion -+ -+variable -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal -+ naturalityAbstractFixedFieldBaseQuotientFinite -+ naturalityAbstractFixedFieldRelativeQuotientFinite -+ naturalityAbstractFixedFieldFiniteDimensional -+ naturalityAbstractRelativeFixedFieldFiniteDimensional -+ naturalityAbstractFixedFieldRelativeScalarTower -+ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional -+ naturalityAbstractFixedFieldNumberField -+ naturalityAbstractRelativeFixedFieldNumberField -+ naturalityAbstractRelativeFixedFieldIsGalois -+ naturalityAbstractRelativeFixedFieldIsAbelianGalois -+ -+ -+private theorem -+ abstractFixedFieldInclusionEmbeddedNormResidueValue_eq_transported -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (c : Additive -+ (IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -+ abstractFixedFieldInclusionEmbeddedNormResidueValue H P c = -+ abstractFixedFieldInclusionTransportedNormResidueValue H P c := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := -+ numberFieldEmbeddedFiniteGaloisSubextension F E j -+ have hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ have hPEmbedded : -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension X.field) -+ hHEmbedded) -+ PEmbedded = -+ P.toFiniteGaloisExtension := -+ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P -+ let eIdeleEmbedded := -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j -+ let eGaloisEmbedded := -+ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup F E j -+ simpa only [ -+ abstractFixedFieldInclusionEmbeddedNormResidueValue, -+ abstractFixedFieldInclusionTransportedNormResidueValue, -+ abstractFixedFieldInclusionTransportedAbelianizedEquiv, -+ eIdeleEmbedded, -+ eGaloisEmbedded] using -+ (rationalFiniteNormResidueValue_transportToAbstractExtension -+ (H := H) (P := P) -+ (A := HEmbedded) -+ (C := Additive (IdeleClassGroup F)) -+ (X := Additive Gal(E / F)) -+ hHEmbedded PEmbedded hPEmbedded -+ eIdeleEmbedded eGaloisEmbedded c) -+ -+/-- A packaged finite norm-residue value depends only on the value of its -+idele comparison at the chosen input and the value of its Galois comparison -+at the resulting norm class. -/ -+private theorem rationalFiniteNormResidueValue_congr_apply -+ (K : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (L : FiniteGaloisSubextension K.field) -+ {C X : Type} [AddGroup C] [AddGroup X] -+ (eIdele eIdele' : C ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) -+ (eGalois eGalois' : -+ Additive (Abelianization L.extensionQuotient) ≃+ X) -+ (c : C) -+ (heIdele : eIdele c = eIdele' c) -+ (heGalois : ∀ z, eGalois z = eGalois' z) : -+ rationalFiniteNormResidueValue K L eIdele eGalois c = -+ rationalFiniteNormResidueValue K L eIdele' eGalois' c := by -+ unfold rationalFiniteNormResidueValue -+ rw [heIdele] -+ exact heGalois _ -+ -+/-- The transported packaged value is the intrinsic canonical packaged value; -+only the idele input and the eventual abelianized value are compared. -/ -+private theorem -+ abstractFixedFieldInclusionTransportedNormResidueValue_eq_canonical -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (c : Additive -+ (IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -+ abstractFixedFieldInclusionTransportedNormResidueValue H P c = -+ abstractFixedFieldInclusionCanonicalNormResidueValue H P c := by -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ let HEmbedded := -+ numberFieldEmbeddedFiniteAbstractField F E j -+ have hHEmbedded : HEmbedded = H := -+ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P -+ let eIdeleEmbedded := -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j -+ let eIdeleOverH : -+ Additive (IdeleClassGroup F) ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation H.field := -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ Additive (IdeleClassGroup F) ≃+ -+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation X.field) -+ hHEmbedded) -+ eIdeleEmbedded -+ simpa only [ -+ abstractFixedFieldInclusionTransportedNormResidueValue, -+ abstractFixedFieldInclusionCanonicalNormResidueValue, -+ eIdeleEmbedded, -+ eIdeleOverH] using -+ (rationalFiniteNormResidueValue_congr_apply -+ H P.toFiniteGaloisExtension -+ eIdeleOverH -+ (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) -+ (abstractFixedFieldInclusionTransportedAbelianizedEquiv H P) -+ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) -+ c -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed_transport_apply H P c) -+ (fun z => abstractFixedFieldInclusionTransportedAbelianizedValue_eq -+ H P z)) -+ -+/-- The explicitly embedded and intrinsic packaged norm-residue values agree. -/ -+private theorem -+ abstractFixedFieldInclusionEmbeddedNormResidueValue_eq -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) -+ (c : Additive -+ (IdeleClassGroup -+ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : -+ abstractFixedFieldInclusionEmbeddedNormResidueValue H P c = -+ abstractFixedFieldInclusionCanonicalNormResidueValue H P c := -+ (abstractFixedFieldInclusionEmbeddedNormResidueValue_eq_transported -+ H P c).trans -+ (abstractFixedFieldInclusionTransportedNormResidueValue_eq_canonical -+ H P c) -+ -+/-- For the literal fixed fields attached to an abstract finite abelian -+extension, the norm-residue map obtained from their canonical inclusion in -+the rational separable closure is the intrinsic fixed-field norm-residue -+map. -/ -+theorem -+ globalNormResidueMonoidHomOfEmbedding_abstractFixedFieldInclusion -+ (H : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (P : FiniteAbelianSubextension H.field) : -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H.field -+ let E := -+ abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ globalNormResidueMonoidHomOfEmbedding F E j = -+ abstractFixedFieldGlobalNormResidueMonoidHom H P := by -+ dsimp only -+ apply MonoidHom.ext -+ intro c -+ rw [globalNormResidueMonoidHomOfEmbedding_apply] -+ change -+ Additive.toMul -+ (abstractFixedFieldInclusionEmbeddedNormResidueValue -+ H P (Additive.ofMul c)) = -+ abstractFixedFieldGlobalNormResidueMonoidHom H P c -+ calc -+ _ = Additive.toMul -+ (abstractFixedFieldInclusionCanonicalNormResidueValue -+ H P (Additive.ofMul c)) := -+ congrArg Additive.toMul -+ (abstractFixedFieldInclusionEmbeddedNormResidueValue_eq -+ H P (Additive.ofMul c)) -+ _ = _ := by -+ simpa only [abstractFixedFieldInclusionCanonicalNormResidueValue] using -+ (rationalFiniteNormResidueValue_abstractFixedField_apply -+ (H := H) (P := P) c) -+ -+end AbstractFixedFieldInclusion -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerBase.lean -new file mode 100644 -index 0000000..dcad422 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerBase.lean -@@ -0,0 +1,339 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityFixedComparison -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+ -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal -+ -+section EmbeddedNumberFieldRestriction -+ -+variable -+ (K K' L L' : Type) -+ [Field K] [NumberField K] -+ [Field K'] [NumberField K'] -+ [Field L] [NumberField L] -+ [Field L'] [NumberField L'] -+ [Algebra K K'] [Algebra K L] [Algebra K L'] -+ [Algebra K' L'] [Algebra L L'] -+ [IsScalarTower K K' L'] [IsScalarTower K L L'] -+ -+ -+/-- Rebracketing the compatible tower does not change its embedded lower -+fixing subgroup. -/ -+private theorem numberFieldEmbeddedBaseSubgroup_baseChange_eq -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ numberFieldEmbeddedBaseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j) = -+ numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')) := by -+ have hi : -+ numberFieldEmbeddedLowerEmbedding K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j) = -+ numberFieldEmbeddedLowerEmbedding K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')) := by -+ ext x -+ simp only [numberFieldEmbeddedLowerEmbedding, AlgHom.comp_apply, -+ IsScalarTower.coe_toAlgHom'] -+ rw [← IsScalarTower.algebraMap_apply K K' L', -+ ← IsScalarTower.algebraMap_apply K L L'] -+ simp only [numberFieldEmbeddedBaseSubgroup, hi] -+ -+omit [Field K] [NumberField K] -+ [Algebra K K'] [Algebra K L'] [IsScalarTower K K' L'] in -+/-- The top subgroup of the rebracketed base-change tower is the embedded -+fixing subgroup of the intermediate field. -/ -+private theorem numberFieldEmbeddedTopSubgroup_baseChange_eq -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ numberFieldEmbeddedTopSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j) = -+ numberFieldEmbeddedBaseSubgroup K' L' j := by -+ rfl -+ -+/-- Reidentify the two presentations of the embedded lower fixing subgroup -+without transporting dependent subgroup data through an equality. -/ -+private noncomputable def numberFieldEmbeddedBaseChangeBaseEquiv -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ (numberFieldEmbeddedBaseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ≃* -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup := -+ MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup -+ (numberFieldEmbeddedBaseSubgroup_baseChange_eq K K' L L' j)) -+ -+/-- Under the identity equivalence of the two lower fixing subgroups, the -+relative subgroup for the base change is exactly the target presentation. -/ -+private theorem numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)) -+ (numberFieldEmbeddedTopSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j))).map -+ (numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j).toMonoidHom = -+ CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseSubgroup K' L' j) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) := by -+ let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j -+ have hTop : -+ (numberFieldEmbeddedTopSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup = -+ (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup := -+ congrArg ClosedSubgroup.toSubgroup -+ (numberFieldEmbeddedTopSubgroup_baseChange_eq -+ (K := K) (K' := K') (L' := L') j) -+ ext x -+ constructor -+ · rintro ⟨y, hy, rfl⟩ -+ change -+ ((e y : -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup) : -+ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) ∈ -+ (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup -+ dsimp only [e, numberFieldEmbeddedBaseChangeBaseEquiv] -+ rw [MulEquiv.subgroupCongr_apply, ← hTop] -+ exact hy -+ · intro hx -+ refine ⟨e.symm x, ?_, e.apply_symm_apply x⟩ -+ change -+ (((e.symm x : -+ (numberFieldEmbeddedBaseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup) : -+ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) ∈ -+ (numberFieldEmbeddedTopSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup) -+ dsimp only [e, numberFieldEmbeddedBaseChangeBaseEquiv] -+ rw [MulEquiv.subgroupCongr_symm_apply, hTop] -+ exact hx -+ -+/-- Normality of the relative subgroup between the two embedded base fields -+in a finite Galois base change. -/ -+private theorem numberFieldEmbeddedBaseChangeExtensionSubgroup_normal -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseSubgroup K' L' j) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)).Normal := by -+ let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j -+ have hNormal := -+ (numberFieldEmbeddedExtensionSubgroup_normal K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)).map -+ e.toMonoidHom e.surjective -+ rw [numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq -+ K K' L L' j] at hNormal -+ exact hNormal -+ -+noncomputable local instance -+ numberFieldEmbeddedBaseChangeExtensionSubgroupNormal -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ (CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseSubgroup K' L' j) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)).Normal := -+ numberFieldEmbeddedBaseChangeExtensionSubgroup_normal K K' L L' j -+ -+/-- Finiteness of the relative quotient between the two embedded base fields -+in a finite Galois base change. -/ -+private theorem numberFieldEmbeddedBaseChangeExtensionQuotient_finite -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ Finite -+ ((numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseSubgroup K' L' j) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := by -+ let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j -+ let N := -+ CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)) -+ (numberFieldEmbeddedTopSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)) -+ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)) -+ let M := -+ CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseSubgroup K' L' j) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) -+ let hNNormal : N.Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j) -+ let hMNormal : M.Normal := -+ numberFieldEmbeddedBaseChangeExtensionSubgroup_normal K K' L L' j -+ let hNFinite : -+ Finite -+ ((numberFieldEmbeddedBaseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ⧸ N) := -+ numberFieldEmbeddedExtensionQuotient_finite K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j) -+ have hmap : N.map e.toMonoidHom = M := -+ numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq K K' L L' j -+ have hle : N ≤ M.comap e.toMonoidHom := by -+ rw [← hmap] -+ exact Subgroup.le_comap_map e.toMonoidHom N -+ let f : -+ ((numberFieldEmbeddedBaseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ⧸ N) →* -+ ((numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ M) := -+ QuotientGroup.map N M e.toMonoidHom hle -+ have hmk : Function.Surjective -+ (QuotientGroup.mk ∘ e : -+ (numberFieldEmbeddedBaseSubgroup K K' -+ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup → -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ M) := -+ QuotientGroup.mk_surjective.comp e.surjective -+ have hsurj : Function.Surjective f := -+ QuotientGroup.map_surjective_of_surjective -+ (N := N) M e.toMonoidHom hmk hle -+ exact Finite.of_surjective f hsurj -+ -+noncomputable local instance -+ numberFieldEmbeddedBaseChangeExtensionQuotientFinite -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ Finite -+ ((numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseSubgroup K' L' j) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -+ numberFieldEmbeddedBaseChangeExtensionQuotient_finite K K' L L' j -+ -+/-- Reuse the canonical absolute fixed-field witness for the lower embedded -+tower. The base-change relative witness below needs this exact instance path -+when forming the absolute finite-dimensional tower. -/ -+noncomputable local instance -+ numberFieldEmbeddedBaseChangeBaseFixedFieldFiniteDimensional -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteDimensional ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) := -+ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')) -+ -+noncomputable local instance -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldFiniteDimensional -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteDimensional -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -+ abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseSubgroup K' L' j) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) -+ (numberFieldEmbeddedAbsoluteQuotientFinite K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseChangeExtensionQuotientFinite K K' L L' j) -+ -+local instance -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldScalarTower -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ IsScalarTower ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -+ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) -+ -+noncomputable local instance -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ FiniteDimensional ℚ -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -+ FiniteDimensional.trans ℚ -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) -+ -+noncomputable local instance -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ NumberField -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -+ NumberField.of_module_finite ℚ -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) -+ -+noncomputable local instance -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldIsGalois -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ IsGalois -+ (abstractFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) -+ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := -+ abstractRelativeFixedField_isGalois -+ ℚ (SeparableClosure ℚ) -+ (numberFieldEmbeddedBaseSubgroup K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) -+ (numberFieldEmbeddedBaseSubgroup K' L' j) -+ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) -+ (numberFieldEmbeddedBaseChangeExtensionSubgroupNormal K K' L L' j) -+ -+ -+end EmbeddedNumberFieldRestriction -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerNorm.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerNorm.lean -new file mode 100644 -index 0000000..a0d887a ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerNorm.lean -@@ -0,0 +1,261 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityTowerRestriction -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+ -+section EmbeddedNumberFieldRestriction -+ -+variable -+ (K K' L L' : Type) -+ [Field K] [NumberField K] -+ [Field K'] [NumberField K'] -+ [Field L] [NumberField L] -+ [Field L'] [NumberField L'] -+ [Algebra K K'] [Algebra K L] [Algebra K L'] -+ [Algebra K' L'] [Algebra L L'] -+ [IsScalarTower K K' L'] [IsScalarTower K L L'] -+ -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal -+ numberFieldEmbeddedBaseChangeExtensionSubgroupNormal -+ numberFieldEmbeddedBaseChangeExtensionQuotientFinite -+ numberFieldEmbeddedBaseChangeBaseFixedFieldFiniteDimensional -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldFiniteDimensional -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldScalarTower -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldIsGalois -+ -+/-- For one common compatible embedding of a Galois base-change -+diamond, the genuine global norm-residue maps commute with ordinary -+idele-class norm and actual restriction of automorphisms. -/ -+theorem globalNormResidueMonoidHomOfEmbedding_norm_restriction -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : -+ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ L L') -+ ((AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K)).comp -+ (globalNormResidueMonoidHomOfEmbedding K' L' j) = -+ (globalNormResidueMonoidHomOfEmbedding K L jLower).comp -+ (_root_.ideleClassNorm K K') := by -+ dsimp only -+ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ L L') -+ let H := -+ numberFieldEmbeddedBaseSubgroup K L jLower -+ let H' := -+ numberFieldEmbeddedBaseSubgroup K' L' j -+ let J := -+ numberFieldEmbeddedTopSubgroup K L jLower -+ let J' := -+ numberFieldEmbeddedTopSubgroup K' L' j -+ let hJH := -+ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L jLower -+ let hJ'H' := -+ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K' L' j -+ let hH'H := -+ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -+ let hJ'J := -+ numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j -+ let _ : -+ (CyclicCohomology.extensionSubgroup H J hJH).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal K L jLower -+ let _ : -+ Finite -+ (H.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H J hJH) := -+ numberFieldEmbeddedExtensionQuotient_finite K L jLower -+ let _ : -+ (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal K' L' j -+ let _ : -+ Finite -+ (H'.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H' J' hJ'H') := -+ numberFieldEmbeddedExtensionQuotient_finite K' L' j -+ let hHH'finite := -+ numberFieldEmbeddedBaseChangeExtensionQuotientFinite K K' L L' j -+ let T : -+ FiniteAbstractFieldExtension -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := -+ { field := numberFieldEmbeddedFiniteAbstractField K' L' j -+ base := numberFieldEmbeddedFiniteAbstractField K L jLower -+ below := hH'H -+ finiteQuotient := hHH'finite } -+ let hTBaseNormal : -+ (CyclicCohomology.extensionSubgroup -+ T.base.field J hJH).Normal := by -+ change -+ (CyclicCohomology.extensionSubgroup H J hJH).Normal -+ exact numberFieldEmbeddedExtensionSubgroup_normal K L jLower -+ let hTBaseFinite : -+ Finite -+ (T.base.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ T.base.field J hJH) := by -+ change -+ Finite -+ (H.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H J hJH) -+ exact numberFieldEmbeddedExtensionQuotient_finite K L jLower -+ let hTFieldNormal : -+ (CyclicCohomology.extensionSubgroup -+ T.field.field J' hJ'H').Normal := by -+ change -+ (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal -+ exact numberFieldEmbeddedExtensionSubgroup_normal K' L' j -+ let hTFieldFinite : -+ Finite -+ (T.field.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ T.field.field J' hJ'H') := by -+ change -+ Finite -+ (H'.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H' J' hJ'H') -+ exact numberFieldEmbeddedExtensionQuotient_finite K' L' j -+ let restrictActual : -+ Gal(L' / K') →* Gal(L / K) := -+ (AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K) -+ apply MonoidHom.ext -+ intro c -+ let a := -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K' L' j (Additive.ofMul c) -+ have hnat := -+ DegreeData.normResidueNaturality_norm_restriction -+ (D := rationalCyclotomicDegreeData) -+ (A := rationalIdeleClassRepresentation) -+ (v := rationalCyclotomicIdeleClassValuationData) -+ (hcf := rationalIdeleClassRepresentation_satisfiesClassFieldAxiom) -+ (T := T) (L := J) (L' := J') -+ (hLnormal := hTBaseNormal) -+ (hL'normal := hTFieldNormal) -+ (hLKfinite := hTBaseFinite) -+ (hL'K'finite := hTFieldFinite) -+ hJH hJ'H' hJ'J -+ have hnatc := -+ DFunLike.congr_fun hnat -+ (finiteNormClass rationalIdeleClassRepresentation -+ H' J' hJ'H' a) -+ change _ = -+ rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ T.base -+ { field := J -+ below := hJH -+ normal := hTBaseNormal -+ finite := hTBaseFinite } -+ (finiteReciprocityNaturalityNormMap -+ rationalIdeleClassRepresentation -+ T.base.field T.field.field J J' -+ hJH hJ'H' T.below hJ'J -+ (finiteNormClass rationalIdeleClassRepresentation -+ T.field.field J' hJ'H' a)) at hnatc -+ rw [finiteReciprocityNaturalityNormMap_finiteNormClass] -+ at hnatc -+ have hnorm : -+ relativeNorm rationalIdeleClassRepresentation -+ H H' hH'H a = -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K L jLower -+ (Additive.ofMul (_root_.ideleClassNorm K K' c)) := -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed_relativeNorm -+ K K' L L' j c -+ calc -+ restrictActual -+ (globalNormResidueMonoidHomOfEmbedding K' L' j c) = -+ restrictActual -+ (Additive.toMul -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K' L' j -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldEmbeddedFiniteAbstractField K' L' j) -+ (numberFieldEmbeddedFiniteGaloisSubextension K' L' j) -+ (finiteNormClass rationalIdeleClassRepresentation -+ H' J' hJ'H' a)))) := by -+ rw [globalNormResidueMonoidHomOfEmbedding_apply] -+ _ = -+ Additive.toMul -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L jLower -+ (MonoidHom.toAdditive -+ (normResidueNaturalityAbelianizedRestriction -+ H H' J J' hJH hJ'H' hH'H hJ'J) -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldEmbeddedFiniteAbstractField K' L' j) -+ (numberFieldEmbeddedFiniteGaloisSubextension K' L' j) -+ (finiteNormClass rationalIdeleClassRepresentation -+ H' J' hJ'H' a)))) := by -+ exact -+ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup_restriction -+ K K' L L' j _ -+ _ = -+ Additive.toMul -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L jLower -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ (numberFieldEmbeddedFiniteAbstractField K L jLower) -+ (numberFieldEmbeddedFiniteGaloisSubextension K L jLower) -+ (finiteNormClass rationalIdeleClassRepresentation -+ H J hJH -+ (relativeNorm rationalIdeleClassRepresentation -+ H H' hH'H a)))) := by -+ exact congrArg -+ (fun z => -+ Additive.toMul -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L jLower z)) -+ hnatc -+ _ = -+ globalNormResidueMonoidHomOfEmbedding K L jLower -+ (_root_.ideleClassNorm K K' c) := by -+ rw [hnorm, -+ ← globalNormResidueMonoidHomOfEmbedding_apply] -+ -+end EmbeddedNumberFieldRestriction -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerRestriction.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerRestriction.lean -new file mode 100644 -index 0000000..16ee169 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerRestriction.lean -@@ -0,0 +1,372 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityTowerBase -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+ -+section EmbeddedNumberFieldRestriction -+ -+variable -+ (K K' L L' : Type) -+ [Field K] [NumberField K] -+ [Field K'] [NumberField K'] -+ [Field L] [NumberField L] -+ [Field L'] [NumberField L'] -+ [Algebra K K'] [Algebra K L] [Algebra K L'] -+ [Algebra K' L'] [Algebra L L'] -+ [IsScalarTower K K' L'] [IsScalarTower K L L'] -+ -+attribute [local instance] -+ naturalityIdeleClassCommGroup -+ ideleClassGroupIsMulCommutative -+ ideleClassSubgroupNormal -+ numberFieldEmbeddedBaseChangeExtensionSubgroupNormal -+ numberFieldEmbeddedBaseChangeExtensionQuotientFinite -+ numberFieldEmbeddedBaseChangeBaseFixedFieldFiniteDimensional -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldFiniteDimensional -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldScalarTower -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldIsGalois -+ -+/-- In one common rational-separable-closure realization, the canonical -+quotient-to-Galois comparisons intertwine abstract restriction with -+ordinary restriction of the actual number-field automorphisms. -/ -+theorem -+ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup_restriction -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) -+ (z : -+ Abelianization -+ (numberFieldEmbeddedFiniteGaloisSubextension -+ K' L' j).extensionQuotient) : -+ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ L L') -+ let H := -+ numberFieldEmbeddedBaseSubgroup K L jLower -+ let H' := -+ numberFieldEmbeddedBaseSubgroup K' L' j -+ let J := -+ numberFieldEmbeddedTopSubgroup K L jLower -+ let J' := -+ numberFieldEmbeddedTopSubgroup K' L' j -+ let hH'H := -+ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -+ let hJ'J := -+ numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j -+ let hJH := -+ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L jLower -+ let hJ'H' := -+ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K' L' j -+ letI _ : -+ (CyclicCohomology.extensionSubgroup H J hJH).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal K L jLower -+ letI _ : -+ (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal K' L' j -+ ((AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K)) -+ (Additive.toMul -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K' L' j (Additive.ofMul z))) = -+ Additive.toMul -+ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup -+ K L jLower -+ (MonoidHom.toAdditive -+ (normResidueNaturalityAbelianizedRestriction -+ H H' J J' -+ hJH hJ'H' -+ hH'H hJ'J) -+ (Additive.ofMul z))) := by -+ dsimp only -+ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ L L') -+ let H := -+ numberFieldEmbeddedBaseSubgroup K L jLower -+ let H' := -+ numberFieldEmbeddedBaseSubgroup K' L' j -+ let J := -+ numberFieldEmbeddedTopSubgroup K L jLower -+ let J' := -+ numberFieldEmbeddedTopSubgroup K' L' j -+ let hH'H := -+ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -+ let hJ'J := -+ numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j -+ let hJH := -+ numberFieldEmbeddedTopSubgroup_le_baseSubgroup -+ K L jLower -+ let hJ'H' := -+ numberFieldEmbeddedTopSubgroup_le_baseSubgroup -+ K' L' j -+ let hLowerNormal : -+ (CyclicCohomology.extensionSubgroup H J hJH).Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal K L jLower -+ let hUpperNormal : -+ (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := -+ numberFieldEmbeddedExtensionSubgroup_normal K' L' j -+ let qLower := -+ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup -+ K L jLower -+ let qUpper := -+ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup -+ K' L' j -+ let qLowerRaw : -+ (H.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H J hJH) ≃* -+ Gal(L / K) := by -+ exact -+ { qLower.toEquiv with -+ map_mul' := fun x y => qLower.map_mul x y } -+ let qUpperRaw : -+ (H'.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H' J' hJ'H') ≃* -+ Gal(L' / K') := by -+ exact -+ { qUpper.toEquiv with -+ map_mul' := fun x y => qUpper.map_mul x y } -+ let restrictActual : -+ Gal(L' / K') →* Gal(L / K) := -+ (AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K) -+ obtain ⟨q, rfl⟩ := -+ QuotientGroup.mk_surjective z -+ obtain ⟨σ, rfl⟩ := -+ (numberFieldEmbeddedFiniteGaloisSubextension -+ K' L' j).extensionQuotientMk_surjective q -+ change -+ restrictActual -+ ((Abelianization.equivOfComm (H := Gal(L' / K'))).symm -+ (qUpperRaw.abelianizationCongr -+ (Abelianization.of (QuotientGroup.mk σ)))) = -+ (Abelianization.equivOfComm (H := Gal(L / K))).symm -+ (qLowerRaw.abelianizationCongr -+ (normResidueNaturalityAbelianizedRestriction -+ H H' J J' hJH hJ'H' hH'H hJ'J -+ (Abelianization.of (QuotientGroup.mk σ)))) -+ rw [normResidueNaturalityAbelianizedRestriction_of_mk, -+ abelianizationCongr_of, abelianizationCongr_of] -+ change -+ restrictActual (qUpperRaw (QuotientGroup.mk σ)) = -+ qLowerRaw -+ (QuotientGroup.mk (Subgroup.inclusion hH'H σ)) -+ apply AlgEquiv.ext -+ intro x -+ apply jLower.injective -+ let hUpperAlgebra : Algebra K' (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra K' L' j -+ let eUpper := -+ numberFieldEmbeddedSeparableClosureEquiv K' L' j -+ let hLowerAlgebra : Algebra K (SeparableClosure ℚ) := -+ numberFieldEmbeddedSeparableClosureAlgebra K L jLower -+ let eLower := -+ numberFieldEmbeddedSeparableClosureEquiv K L jLower -+ calc -+ jLower -+ (restrictActual -+ (qUpperRaw (QuotientGroup.mk σ)) x) = -+ j -+ ((qUpperRaw (QuotientGroup.mk σ)) -+ (algebraMap L L' x)) := by -+ exact congrArg j -+ (AlgEquiv.restrictNormal_commutes -+ ((AlgEquiv.restrictScalarsHom K) -+ (qUpperRaw (QuotientGroup.mk σ))) -+ L x) -+ _ = σ.1.1 -+ (j (algebraMap L L' x)) := by -+ exact -+ ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply -+ ℚ K' L' j eUpper σ (algebraMap L L' x) -+ _ = (Subgroup.inclusion hH'H σ).1.1 -+ (jLower x) := rfl -+ _ = jLower -+ (qLowerRaw -+ (QuotientGroup.mk -+ (Subgroup.inclusion hH'H σ)) x) := by -+ exact -+ (ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply -+ ℚ K L jLower eLower -+ (Subgroup.inclusion hH'H σ) x).symm -+ -+/-- In a compatible common embedding, the fixed-part relative norm -+between two (Galois-related) base fields is the genuine ordinary -+idele-class norm. -/ -+theorem numberFieldEmbeddedIdeleClassEquivAmbientFixed_relativeNorm -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) -+ (c : IdeleClassGroup K') : -+ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := -+ j.comp (IsScalarTower.toAlgHom ℚ L L') -+ let H := -+ numberFieldEmbeddedBaseSubgroup K L jLower -+ let H' := -+ numberFieldEmbeddedBaseSubgroup K' L' j -+ let hH'H := -+ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -+ letI _ : Finite -+ (H.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H H' hH'H) := -+ numberFieldEmbeddedBaseChangeExtensionQuotientFinite -+ K K' L L' j -+ relativeNorm rationalIdeleClassRepresentation H H' hH'H -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K' L' j (Additive.ofMul c)) = -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K L jLower -+ (Additive.ofMul (_root_.ideleClassNorm K K' c)) := by -+ intro jLower H H' -+ let hH'H := -+ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j -+ let hnormal := -+ numberFieldEmbeddedBaseChangeExtensionSubgroupNormal K K' L L' j -+ let F := -+ abstractFixedField ℚ (SeparableClosure ℚ) H -+ let E := -+ abstractRelativeFixedField ℚ (SeparableClosure ℚ) hH'H -+ let _ : -+ (CyclicCohomology.extensionSubgroup H H' hH'H).Normal := -+ hnormal -+ let _ : -+ Finite -+ (H.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H H' hH'H) := -+ numberFieldEmbeddedBaseChangeExtensionQuotientFinite -+ K K' L L' j -+ let _ : -+ Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ H (le_baseField H)) := -+ numberFieldEmbeddedAbsoluteQuotientFinite K L jLower -+ let _ : NumberField F := -+ numberFieldEmbeddedAbstractFixedFieldNumberField K L jLower -+ let _ : NumberField E := -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField -+ K K' L L' j -+ let _ : FiniteDimensional ℚ (E.restrictScalars ℚ) := by -+ change FiniteDimensional ℚ E -+ exact -+ numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional -+ K K' L L' j -+ let _ : NumberField -+ (abstractFixedField ℚ (SeparableClosure ℚ) H') := -+ numberFieldEmbeddedAbstractFixedFieldNumberField K' L' j -+ have hE : -+ E.restrictScalars ℚ = -+ abstractFixedField ℚ (SeparableClosure ℚ) H' := -+ IntermediateField.extendScalars_restrictScalars -+ (abstractFixedField_le -+ ℚ (SeparableClosure ℚ) hH'H) -+ let eRel : -+ E ≃ₐ[ℚ] -+ abstractFixedField ℚ (SeparableClosure ℚ) H' := -+ IntermediateField.equivOfEq hE -+ let eK : -+ K ≃ₐ[ℚ] F := -+ numberFieldEmbeddedAbstractBaseFieldEquiv K L jLower -+ let eK'Base : -+ K' ≃ₐ[ℚ] -+ abstractFixedField ℚ (SeparableClosure ℚ) H' := -+ numberFieldEmbeddedAbstractBaseFieldEquiv K' L' j -+ let eK' : K' ≃ₐ[ℚ] E := -+ eK'Base.trans eRel.symm -+ have hcompat (x : K) : -+ eK' (algebraMap K K' x) = -+ algebraMap F E (eK x) := by -+ apply eRel.injective -+ apply Subtype.ext -+ change -+ j (algebraMap K' L' (algebraMap K K' x)) = -+ j (algebraMap L L' (algebraMap K L x)) -+ rw [← IsScalarTower.algebraMap_apply K K' L', -+ ← IsScalarTower.algebraMap_apply K L L'] -+ have hupper : -+ rationalAbstractRelativeFixedFieldIdeleClassEquivFixed -+ H H' hH'H -+ (Additive.ofMul (ideleClassCongr eK' c)) = -+ numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K' L' j (Additive.ofMul c) := by -+ apply Subtype.ext -+ change -+ ((rationalIdeleClassEquivFixed (E.restrictScalars ℚ)) -+ (Additive.ofMul (ideleClassCongr eK' c))).1 = -+ ((rationalIdeleClassEquivFixed -+ (abstractFixedField ℚ (SeparableClosure ℚ) H')) -+ (Additive.ofMul (ideleClassCongr eK'Base c))).1 -+ exact rationalIdeleClassEquivFixed_transport_baseEquiv_val -+ (T := K') (A := E.restrictScalars ℚ) -+ (B := abstractFixedField ℚ (SeparableClosure ℚ) H') hE eK'Base c -+ have hrelative := -+ rationalAbstractRelativeFixedFieldIdeleClassEquivFixed_relativeNorm -+ H H' hH'H hnormal -+ (Additive.ofMul (ideleClassCongr eK' c)) -+ change -+ relativeNorm rationalIdeleClassRepresentation H H' hH'H -+ (rationalAbstractRelativeFixedFieldIdeleClassEquivFixed -+ H H' hH'H -+ (Additive.ofMul (ideleClassCongr eK' c))) = -+ rationalAbstractFixedFieldIdeleClassEquivFixed H -+ (Additive.ofMul -+ (_root_.ideleClassNorm F E -+ (ideleClassCongr eK' c))) -+ at hrelative -+ calc -+ relativeNorm rationalIdeleClassRepresentation H H' hH'H -+ (numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K' L' j (Additive.ofMul c)) = -+ relativeNorm rationalIdeleClassRepresentation H H' hH'H -+ (rationalAbstractRelativeFixedFieldIdeleClassEquivFixed -+ H H' hH'H (Additive.ofMul (ideleClassCongr eK' c))) := -+ congrArg (relativeNorm rationalIdeleClassRepresentation H H' hH'H) -+ hupper.symm -+ _ = rationalAbstractFixedFieldIdeleClassEquivFixed H -+ (Additive.ofMul -+ (_root_.ideleClassNorm F E (ideleClassCongr eK' c))) := hrelative -+ _ = numberFieldEmbeddedIdeleClassEquivAmbientFixed -+ K L jLower (Additive.ofMul (_root_.ideleClassNorm K K' c)) := by -+ change -+ rationalAbstractFixedFieldIdeleClassEquivFixed H -+ (Additive.ofMul -+ (_root_.ideleClassNorm F E (ideleClassCongr eK' c))) = -+ rationalAbstractFixedFieldIdeleClassEquivFixed H -+ (Additive.ofMul -+ (ideleClassCongr eK (_root_.ideleClassNorm K K' c))) -+ apply congrArg (rationalAbstractFixedFieldIdeleClassEquivFixed H) -+ apply congrArg Additive.ofMul -+ exact -+ (ideleClassCongr_ideleClassNorm -+ (K := K) (K' := F) (L := K') (L' := E) eK eK' hcompat c).symm -+ -+ -+end EmbeddedNumberFieldRestriction -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTransports.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTransports.lean -new file mode 100644 -index 0000000..5a39a62 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTransports.lean -@@ -0,0 +1,445 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidue -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerAlgEquivNaturality -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open ClassFormation -+open GlobalClassFields -+open KummerTheory -+open AlgebraicNumberTheory -+open LocalClassFieldTheory -+open RamificationTheory -+ -+universe u -+ -+/-- The commutative group structure on the quotient of ideles by principal ideles. -/ -+@[instance_reducible] -+noncomputable def naturalityIdeleClassCommGroup -+ (F : Type) [Field F] [NumberField F] : CommGroup (IdeleClassGroup F) := -+ QuotientGroup.Quotient.commGroup (IdeleGroup.principalSubgroup F) -+ -+attribute [local instance] naturalityIdeleClassCommGroup -+ -+local instance ideleClassGroupIsMulCommutative -+ {F : Type} [Field F] [NumberField F] -+ : IsMulCommutative (IdeleClassGroup F) := -+ ⟨⟨fun a b => mul_comm a b⟩⟩ -+ -+local instance ideleClassSubgroupNormal -+ {F : Type} [Field F] [NumberField F] -+ (N : Subgroup (IdeleClassGroup F)) : N.Normal := -+ N.normal_of_isMulCommutative -+ -+ -+/-- Two finite Galois subextensions with the same underlying closed subgroup -+are equal; the remaining structure fields are proof-irrelevant. -/ -+private theorem finiteGaloisSubextension_eq_of_field_eq -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {K : ClosedSubgroup G} -+ (A B : FiniteGaloisSubextension K) -+ (h : A.field = B.field) : -+ A = B := by -+ cases A with -+ | mk A hA nA fA => -+ cases B with -+ | mk B hB nB fB => -+ dsimp only at h -+ cases h -+ rfl -+ -+/-- Rebase a finite Galois subextension along equality of its bundled base. -+The field equality is the only data component; the remaining fields are -+proof-irrelevant. -/ -+theorem finiteGaloisSubextension_transport_eq_of_field_eq -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {A B : FiniteAbstractField G} -+ (hAB : A = B) -+ (P : FiniteGaloisSubextension A.field) -+ (Q : FiniteGaloisSubextension B.field) -+ (hfield : P.field = Q.field) : -+ Eq.mp -+ (congrArg -+ (fun X : FiniteAbstractField G => -+ FiniteGaloisSubextension X.field) -+ hAB) -+ P = Q := by -+ cases hAB -+ exact finiteGaloisSubextension_eq_of_field_eq P Q hfield -+ -+/-- Transporting an additive equivalence between rational ambient fixed -+subgroups does not change the underlying direct-limit class. -/ -+theorem rationalAmbientFixedAddEquiv_transport_apply_val -+ {A B : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} -+ (hAB : A = B) -+ {X : Type} [AddGroup X] -+ (e : X ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) -+ (x : X) : -+ ((Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ X ≃+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation Y.field) -+ hAB) -+ e x).1) = -+ (e x).1 := by -+ cases hAB -+ rfl -+ -+/-- Changing only the bundled subgroup of an additive subgroup element -+does not change its value in the ambient group. -/ -+private theorem addSubgroupCongr_apply_val -+ {A : Type} [AddGroup A] -+ {H K : AddSubgroup A} -+ (h : H = K) (x : H) : -+ ((AddEquiv.addSubgroupCongr h x).1 : A) = x.1 := by -+ cases h -+ rfl -+ -+/-- Transporting an idele class along a field equality and the corresponding -+algebra equivalence leaves its rational direct-limit representative fixed. -/ -+theorem rationalIdeleClassEquivFixed_congr_apply_val -+ {A B : IntermediateField ℚ (SeparableClosure ℚ)} -+ [FiniteDimensional ℚ A] [FiniteDimensional ℚ B] -+ (h : A = B) -+ (e : B ≃ₐ[ℚ] A) -+ (he : e.trans (IntermediateField.equivOfEq h) = -+ (AlgEquiv.refl : B ≃ₐ[ℚ] B)) -+ (c : Additive (IdeleClassGroup B)) : -+ ((rationalIdeleClassEquivFixed A) -+ (MulEquiv.toAdditive (ideleClassCongr e) c)).1 = -+ ((rationalIdeleClassEquivFixed B) c).1 := by -+ cases h -+ have he' : e = AlgEquiv.refl := by -+ apply AlgEquiv.ext -+ intro x -+ have hx := DFunLike.congr_fun he x -+ change e x = x at hx -+ exact hx -+ rw [he'] -+ have hc : -+ MulEquiv.toAdditive -+ (ideleClassCongr (AlgEquiv.refl : A ≃ₐ[ℚ] A)) c = c := by -+ cases c with -+ | ofMul c => -+ exact congrArg Additive.ofMul (ideleClassCongr_refl c) -+ rw [hc] -+ -+/-- Transporting the target intermediate field of a base-field equivalence -+preserves its rational fixed-part representative. -/ -+theorem rationalIdeleClassEquivFixed_transport_baseEquiv_val -+ {T : Type} [Field T] [NumberField T] -+ {A B : IntermediateField ℚ (SeparableClosure ℚ)} -+ [FiniteDimensional ℚ A] [FiniteDimensional ℚ B] -+ (h : A = B) (e : T ≃ₐ[ℚ] B) -+ (c : IdeleClassGroup T) : -+ ((rationalIdeleClassEquivFixed A) -+ (Additive.ofMul -+ (ideleClassCongr (K := T) (M := A) -+ (e.trans (IntermediateField.equivOfEq h).symm) c))).1 = -+ ((rationalIdeleClassEquivFixed B) -+ (Additive.ofMul (ideleClassCongr (K := T) (M := B) e c))).1 := by -+ cases h -+ have he : -+ e.trans (IntermediateField.equivOfEq (rfl : A = A)).symm = e := by -+ ext x -+ rfl -+ rw [he] -+ -+/-- Equality of the lower and upper closed subgroups transports the raw -+extension quotient without exposing dependent rewrites to clients. -/ -+def extensionQuotientMulEquivOfEq -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {H H' J J' : ClosedSubgroup G} -+ (hH : H = H') (hJ : J = J') -+ (hJH : J.toSubgroup ≤ H.toSubgroup) -+ (hJH' : J'.toSubgroup ≤ H'.toSubgroup) -+ [(CyclicCohomology.extensionSubgroup H J hJH).Normal] -+ [(CyclicCohomology.extensionSubgroup H' J' hJH').Normal] : -+ (H.toSubgroup ⧸ CyclicCohomology.extensionSubgroup H J hJH) ≃* -+ (H'.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup H' J' hJH') := by -+ cases hH -+ cases hJ -+ exact MulEquiv.refl _ -+ -+/-- The quotient transport sends a quotient representative to the same -+ambient group element, rebundled in the equal lower subgroup. -/ -+@[simp] -+theorem extensionQuotientMulEquivOfEq_mk -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {H H' J J' : ClosedSubgroup G} -+ (hH : H = H') (hJ : J = J') -+ (hJH : J.toSubgroup ≤ H.toSubgroup) -+ (hJH' : J'.toSubgroup ≤ H'.toSubgroup) -+ [(CyclicCohomology.extensionSubgroup H J hJH).Normal] -+ [(CyclicCohomology.extensionSubgroup H' J' hJH').Normal] -+ (σ : H.toSubgroup) : -+ extensionQuotientMulEquivOfEq hH hJ hJH hJH' -+ (QuotientGroup.mk σ) = -+ QuotientGroup.mk -+ ((MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup hH)) σ) := by -+ cases hH -+ cases hJ -+ rfl -+ -+/-- Rebundling an element along equality of closed subgroups preserves its -+underlying ambient group element. -/ -+theorem closedSubgroupCongr_apply_val -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {H H' : ClosedSubgroup G} -+ (hH : H = H') (σ : H.toSubgroup) : -+ (((MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup hH)) σ).1 : G) = σ.1 := by -+ cases hH -+ rfl -+ -+/-- Rebase an abelianized extension-quotient equivalence together with its -+finite abstract base. -/ -+def abelianizedExtensionQuotientAddEquiv_transportBase -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {A B : FiniteAbstractField G} -+ (hAB : A = B) -+ (P : FiniteGaloisSubextension A.field) -+ {X : Type} [AddGroup X] -+ (e : Additive (Abelianization P.extensionQuotient) ≃+ X) : -+ Additive -+ (Abelianization -+ (Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField G => -+ FiniteGaloisSubextension Y.field) -+ hAB) -+ P).extensionQuotient) ≃+ X := by -+ cases hAB -+ exact e -+ -+/-- Rebase an abelianized equivalence along equality of finite Galois -+subextensions over a fixed abstract base. -/ -+def abelianizedExtensionQuotientAddEquiv_transportExtension -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {K : ClosedSubgroup G} -+ {P Q : FiniteGaloisSubextension K} -+ (hPQ : P = Q) -+ {X : Type} [AddGroup X] -+ (e : Additive (Abelianization P.extensionQuotient) ≃+ X) : -+ Additive (Abelianization Q.extensionQuotient) ≃+ X := by -+ cases hPQ -+ exact e -+ -+/-- The explicit quotient equivalence induced by rebasing a finite Galois -+subextension. -/ -+def extensionQuotientMulEquiv_transportFiniteGalois -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {A B : FiniteAbstractField G} -+ (hAB : A = B) -+ (P : FiniteGaloisSubextension A.field) -+ {Q : FiniteGaloisSubextension B.field} -+ (hPQ : -+ Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField G => -+ FiniteGaloisSubextension Y.field) -+ hAB) -+ P = Q) : -+ Q.extensionQuotient ≃* P.extensionQuotient := by -+ cases hAB -+ cases hPQ -+ exact MulEquiv.refl _ -+ -+/-- Quotient rebasing sends a canonical representative to the same ambient -+group element rebundled in the old base subgroup. -/ -+@[simp] -+theorem extensionQuotientMulEquiv_transportFiniteGalois_mk -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {A B : FiniteAbstractField G} -+ (hAB : A = B) -+ (P : FiniteGaloisSubextension A.field) -+ {Q : FiniteGaloisSubextension B.field} -+ (hPQ : -+ Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField G => -+ FiniteGaloisSubextension Y.field) -+ hAB) -+ P = Q) -+ (σ : B.field.toSubgroup) : -+ extensionQuotientMulEquiv_transportFiniteGalois hAB P hPQ -+ (Q.extensionQuotientMk σ) = -+ P.extensionQuotientMk -+ ((MulEquiv.subgroupCongr -+ (congrArg ClosedSubgroup.toSubgroup -+ (congrArg FiniteAbstractField.field hAB).symm)) σ) := by -+ cases hAB -+ cases hPQ -+ rfl -+ -+/-- Abelianization commutes with simultaneous transport of the abstract base -+and its finite Galois subextension. -/ -+theorem abelianizedCanonicalEquiv_transportFiniteGalois -+ {G : Type u} [Group G] [TopologicalSpace G] -+ {A B : FiniteAbstractField G} -+ (hAB : A = B) -+ (P : FiniteGaloisSubextension A.field) -+ {Q : FiniteGaloisSubextension B.field} -+ (hPQ : -+ Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField G => -+ FiniteGaloisSubextension Y.field) -+ hAB) -+ P = Q) -+ {X : Type} [CommGroup X] -+ (e : P.extensionQuotient ≃* X) : -+ abelianizedExtensionQuotientAddEquiv_transportExtension hPQ -+ (abelianizedExtensionQuotientAddEquiv_transportBase -+ hAB P -+ (MulEquiv.toAdditive -+ (e.abelianizationCongr.trans -+ (Abelianization.equivOfComm : X ≃* Abelianization X).symm))) = -+ MulEquiv.toAdditive -+ (((extensionQuotientMulEquiv_transportFiniteGalois -+ hAB P hPQ).trans e).abelianizationCongr.trans -+ (Abelianization.equivOfComm : X ≃* Abelianization X).symm) := by -+ cases hAB -+ cases hPQ -+ rfl -+ -+ -+/-- The finite norm-residue value, transported from the rational idele-class -+representation and the abelianized extension quotient to the groups `C` and `X`. -/ -+def rationalFiniteNormResidueValue -+ (K : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ (L : FiniteGaloisSubextension K.field) -+ {C X : Type} [AddGroup C] [AddGroup X] -+ (eIdele : C ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) -+ (eGalois : Additive (Abelianization L.extensionQuotient) ≃+ X) -+ (c : C) : X := by -+ letI : -+ Finite -+ (K.field.toSubgroup ⧸ -+ CyclicCohomology.extensionSubgroup -+ K.field L.field L.below) := -+ L.finite -+ exact -+ eGalois -+ (rationalCyclotomicDegreeData.normResidueSymbol -+ rationalIdeleClassRepresentation -+ rationalCyclotomicIdeleClassValuationData -+ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom -+ K L -+ (finiteNormClass rationalIdeleClassRepresentation -+ K.field L.field L.below (eIdele c))) -+ -+/-- The packaged norm-residue value is invariant under rebasing the finite -+abstract field together with all dependent data. -/ -+theorem rationalFiniteNormResidueValue_transportBase -+ {A B : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} -+ (hAB : A = B) -+ (P : FiniteGaloisSubextension A.field) -+ {C X : Type} [AddGroup C] [AddGroup X] -+ (eIdele : C ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) -+ (eGalois : Additive (Abelianization P.extensionQuotient) ≃+ X) -+ (c : C) : -+ rationalFiniteNormResidueValue A P eIdele eGalois c = -+ rationalFiniteNormResidueValue B -+ (Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ FiniteGaloisSubextension Y.field) -+ hAB) -+ P) -+ (Eq.mp -+ (congrArg -+ (fun Y : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => -+ C ≃+ ambientFixedAddSubgroup -+ rationalIdeleClassRepresentation Y.field) -+ hAB) -+ eIdele) -+ (abelianizedExtensionQuotientAddEquiv_transportBase -+ hAB P eGalois) -+ c := by -+ cases hAB -+ rfl -+ -+/-- The packaged norm-residue value is invariant under equality of the finite -+Galois subextension. -/ -+theorem rationalFiniteNormResidueValue_transportExtension -+ (K : FiniteAbstractField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ {P Q : FiniteGaloisSubextension K.field} -+ (hPQ : P = Q) -+ {C X : Type} [AddGroup C] [AddGroup X] -+ (eIdele : C ≃+ -+ ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) -+ (eGalois : Additive (Abelianization P.extensionQuotient) ≃+ X) -+ (c : C) : -+ rationalFiniteNormResidueValue K P eIdele eGalois c = -+ rationalFiniteNormResidueValue K Q eIdele -+ (abelianizedExtensionQuotientAddEquiv_transportExtension -+ hPQ eGalois) -+ c := by -+ cases hPQ -+ rfl -+ -+/-- Evaluation of the canonical abelianization comparison induced by a -+multiplicative equivalence into a commutative group. -/ -+theorem abelianizationCongrToComm_apply -+ {Q R : Type*} [Group Q] [CommGroup R] -+ (e : Q ≃* R) (q : Q) : -+ MulEquiv.toAdditive -+ (e.abelianizationCongr.trans -+ (Abelianization.equivOfComm : R ≃* Abelianization R).symm) -+ (Additive.ofMul (Abelianization.of q)) = -+ Additive.ofMul (e q) := by -+ apply Additive.toMul.injective -+ change -+ (Abelianization.equivOfComm : R ≃* Abelianization R).symm -+ (e.abelianizationCongr (Abelianization.of q)) = e q -+ rw [abelianizationCongr_of] -+ exact -+ (Abelianization.equivOfComm : R ≃* Abelianization R).symm_apply_apply _ -+ -+/-- Evaluation of the canonical quotient from the abelianization of a -+commutative group. -/ -+theorem commutativeAbelianizationEquiv_apply -+ {Q R : Type*} [CommGroup Q] [Group R] -+ (e : Q ≃* R) (q : Q) : -+ MulEquiv.toAdditive -+ ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm.trans e) -+ (Additive.ofMul (Abelianization.of q)) = -+ Additive.ofMul (e q) := by -+ apply Additive.toMul.injective -+ change -+ e ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm -+ (Abelianization.of q)) = e q -+ exact congrArg e -+ ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm_apply_apply q) -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitAbstractFixedField.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitAbstractFixedField.lean -index 08f2620..a101f78 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitAbstractFixedField.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitAbstractFixedField.lean -@@ -7,6 +7,7 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.IdeleClassDirectLimitFixedPoints - import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.AbstractFixedFieldNorm - -+ - set_option autoImplicit false - - /-! -@@ -202,7 +203,7 @@ theorem rationalIdeleClassEquivBaseFixed_coe - E (RelativeIdeleGroup.classInclusion ℚ E c)) - exact Eq.trans h0 (Eq.trans h1 (Eq.trans h2 (Eq.trans h3 h4))) - --private noncomputable instance -+private noncomputable instance abstractFixedFieldNumberField - (K : ClosedSubgroup - (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) - [hfinite : Finite -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitCore.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitCore.lean -index 870927a..7f759bc 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitCore.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitCore.lean -@@ -9,6 +9,7 @@ import GaloisCohomology.Cyclic.NormKernelVanishing - import Mathlib.Algebra.Colimit.DirectLimit - import Mathlib.FieldTheory.Galois.Profinite - -+ - set_option autoImplicit false - - /-! -@@ -107,19 +108,19 @@ noncomputable instance rationalFiniteGaloisIdeleClassMulDistribMulAction - (RelativeIdeleGroup.ClassGroup ℚ E) := - rationalAbsoluteGaloisIdeleClassAction E - --private instance -+private instance classGroupMonoid - (E : FiniteGaloisIntermediateField ℚ (SeparableClosure ℚ)) : - Monoid (RelativeIdeleGroup.ClassGroup ℚ E) := - inferInstance - --private noncomputable instance : -+private noncomputable instance actionFamily : - ∀ E : FiniteGaloisIntermediateField ℚ (SeparableClosure ℚ), - MulDistribMulAction - (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) - (RelativeIdeleGroup.ClassGroup ℚ E) := - fun E => rationalAbsoluteGaloisIdeleClassAction E - --private noncomputable instance : -+private noncomputable instance smulFamily : - ∀ E : FiniteGaloisIntermediateField ℚ (SeparableClosure ℚ), - SMul - (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) -@@ -366,7 +367,7 @@ theorem rationalRelativeIdeleClassEmbedding_comp - (rationalRelativeAdeleEmbedding_comp hEF hFH - (a : RelativeAdeleRing ℚ E))) - --private noncomputable instance : -+private noncomputable instance transitionDirectedSystem : - DirectedSystem - (fun E : FiniteGaloisIntermediateField ℚ (SeparableClosure ℚ) => - RelativeIdeleGroup.ClassGroup ℚ E) -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryField.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryField.lean -index c1e5ac0..1a80072 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryField.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryField.lean -@@ -1,1901 +1,2 @@ --/- --Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. --Released under Apache 2.0 license as described in the file LICENSE. --Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ---/ -- --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData --import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility --import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm -- --set_option autoImplicit false -- --/-! --# The finite p-adic auxiliary field -- --This module realizes the simultaneous finite/cyclotomic lift as an actual --number field and proves the subgroup and intermediate-field identities --needed by the auxiliary-field argument. ---/ -- --open scoped IsMulCommutative NumberField --open AlgebraicNumberTheory IsDedekindDomain NumberField --open IdeleGroup RelativeIdeleGroup --open AlgebraicNumberTheory.Valuations --open HilbertRamification --open CyclicCohomology --open KummerTheory ClassFormation -- --noncomputable section -- --namespace GlobalClassFieldTheory --namespace Reciprocity -- --open GlobalClassFields -- --variable -- {K L : Type} -- [Field K] [NumberField K] -- [Field L] [NumberField L] [Algebra K L] -- [FiniteDimensional K L] [IsAbelianGalois K L] -- --local instance (p : Nat.Primes) : Fact p.1.Prime := -- ⟨p.2⟩ -- --attribute [local instance] -- rationalSeparableClosureAlgebra -- --local instance finitePadicAuxiliaryExtensionNormal : -- (extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)).Normal := -- numberFieldTowerExtensionSubgroup_normal K L -- --local instance finitePadicAuxiliaryExtensionQuotientFinite : -- Finite -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) := -- numberFieldTowerExtensionQuotient_finite K L -- --noncomputable local instance finitePadicAuxiliaryExtensionQuotientIsMulCommutative : -- IsMulCommutative -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) := by -- let e : -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) ≃* -- Gal(L / K) := -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- exact -- { is_comm := -- ⟨fun x y => by -- apply e.injective -- rw [map_mul, map_mul] -- exact -- (inferInstance : -- IsMulCommutative (Gal(L / K))).is_comm.comm -- (e x) (e y)⟩ } -- --/-- The concrete auxiliary fixed field attached to a simultaneous --finite/cyclotomic lift. -/ --noncomputable def numberFieldTowerFinitePadicCyclicFixedField -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- IntermediateField ℚ (SeparableClosure ℚ) := by -- exact -- IntermediateField.fixedField -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ).toSubgroup -- --/-- A nonzero-degree lift produces a genuine number field: its --concrete fixed field is finite over `ℚ`. -/ --theorem numberFieldTowerFinitePadicCyclicFixedField_finiteDimensional -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (hτ : -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ ≠ -- 1) : -- FiniteDimensional ℚ -- (numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ) := by -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let F := -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ -- apply -- (InfiniteGalois.isOpen_iff_finite -- (K := SeparableClosure ℚ) F).1 -- change IsOpen -- (IntermediateField.fixedField S.toSubgroup).fixingSubgroup.carrier -- rw [InfiniteGalois.fixingSubgroup_fixedField S] -- exact -- numberFieldTowerFinitePadicCyclicFixedSubgroup_isOpen -- (K := K) (L := L) p τ hτ -- --/-- The compatible embedded copy of `K` lies in every auxiliary --cyclic fixed field. -/ --theorem numberFieldTowerBaseField_le_finitePadicCyclicFixedField -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- numberFieldTowerBaseField K L ≤ -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ := by -- intro x hx -- change x ∈ IntermediateField.fixedField -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ).toSubgroup -- rw [IntermediateField.mem_fixedField_iff] -- intro σ hσ -- change -- σ ∈ -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ).toSubgroup at hσ -- obtain ⟨u, hu, rfl⟩ := hσ -- exact -- (IntermediateField.mem_fixingSubgroup_iff -- (numberFieldTowerBaseField K L) u.1).1 u.2 x hx -- --/-- The compatible embedding of the original base field into the --genuine auxiliary fixed field. -/ --noncomputable def numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- K →ₐ[ℚ] -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ) := by -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ) -- exact -- (numberFieldTowerLowerEmbedding K L).codRestrict F.toSubalgebra -- (fun x => -- numberFieldTowerBaseField_le_finitePadicCyclicFixedField -- (K := K) (L := L) p τ ⟨x, rfl⟩) -- --/-- Coercing the auxiliary base embedding recovers the fixed lower embedding --into the rational separable closure. -/ --@[simp] --theorem numberFieldTowerFinitePadicAuxiliaryBaseEmbedding_coe -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (x : K) : -- ((numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -- (K := K) (L := L) p τ x : -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ)) : -- SeparableClosure ℚ) = -- numberFieldTowerLowerEmbedding K L x := by -- rfl -- --/-- The compatible copy of the original top field lies in the --auxiliary compositum fixed field. -/ --theorem numberFieldTowerTopField_mem_finitePadicAuxiliaryTopField -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- {x : SeparableClosure ℚ} -- (hx : x ∈ numberFieldInRationalSeparableClosure L) : -- x ∈ -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below := by -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let T := -- numberFieldTowerTopSubgroup L -- change x ∈ IntermediateField.fixedField -- (S.toSubgroup ⊓ T.toSubgroup) -- rw [IntermediateField.mem_fixedField_iff] -- intro σ hσ -- have hσT : σ ∈ T.toSubgroup := -- hσ.2 -- change -- σ ∈ -- (numberFieldInRationalSeparableClosure L).fixingSubgroup -- at hσT -- exact -- (IntermediateField.mem_fixingSubgroup_iff -- (numberFieldInRationalSeparableClosure L) σ).1 -- hσT x hx -- --/-- The compatible embedding of the original top field into the --auxiliary compositum fixed field. -/ --noncomputable def numberFieldTowerFinitePadicAuxiliaryTopEmbedding -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- L →ₐ[ℚ] -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below := by -- let E := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below -- exact -- (numberFieldSeparableClosureEmbedding L).codRestrict -- (E.restrictScalars ℚ).toSubalgebra -- (fun x => -- numberFieldTowerTopField_mem_finitePadicAuxiliaryTopField -- (K := K) (L := L) p τ ⟨x, rfl⟩) -- --/-- Coercing the auxiliary top embedding recovers the chosen top-field --embedding into the rational separable closure. -/ --@[simp] --theorem numberFieldTowerFinitePadicAuxiliaryTopEmbedding_coe -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (x : L) : -- ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding -- (K := K) (L := L) p τ x : -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) : -- SeparableClosure ℚ) = -- numberFieldSeparableClosureEmbedding L x := by -- rfl -- --/-- The compatible base and top embeddings form the actual --base-change square inside the rational separable closure. -/ --theorem numberFieldTowerFinitePadicAuxiliaryEmbedding_algebraMap -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (x : K) : -- ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding -- (K := K) (L := L) p τ (algebraMap K L x) : -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) : -- SeparableClosure ℚ) = -- ((numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -- (K := K) (L := L) p τ x : -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ)) : -- SeparableClosure ℚ) := by -- rfl -- --noncomputable instance -- numberFieldTowerFinitePadicAuxiliary_baseAlgebra -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- Algebra K -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ)) := by -- exact -- (numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -- (K := K) (L := L) p τ).toRingHom.toAlgebra -- --instance -- numberFieldTowerFinitePadicAuxiliary_baseRatScalarTower -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- IsScalarTower ℚ K -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ)) := by -- exact -- IsScalarTower.of_algebraMap_eq' -- (numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -- (K := K) (L := L) p τ).comp_algebraMap.symm -- --noncomputable instance -- numberFieldTowerFinitePadicAuxiliary_topAlgebra -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- Algebra L -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) := by -- exact -- (numberFieldTowerFinitePadicAuxiliaryTopEmbedding -- (K := K) (L := L) p τ).toRingHom.toAlgebra -- --instance -- numberFieldTowerFinitePadicAuxiliary_topRatScalarTower -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- IsScalarTower ℚ L -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) := by -- exact -- IsScalarTower.of_algebraMap_eq' -- (numberFieldTowerFinitePadicAuxiliaryTopEmbedding -- (K := K) (L := L) p τ).comp_algebraMap.symm -- --noncomputable instance -- numberFieldTowerFinitePadicAuxiliary_originalBaseTopAlgebra -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- Algebra K -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) := by -- exact -- ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding -- (K := K) (L := L) p τ).comp -- (IsScalarTower.toAlgHom ℚ K L)).toRingHom.toAlgebra -- --instance -- numberFieldTowerFinitePadicAuxiliary_originalTopScalarTower -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- IsScalarTower K L -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) := by -- exact IsScalarTower.of_algebraMap_eq' rfl -- --instance -- numberFieldTowerFinitePadicAuxiliary_baseTopScalarTower -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- IsScalarTower K -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ)) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) := by -- apply IsScalarTower.of_algebraMap_eq' -- apply RingHom.ext -- intro x -- apply Subtype.ext -- exact -- numberFieldTowerFinitePadicAuxiliaryEmbedding_algebraMap -- (K := K) (L := L) p τ x -- --/-- The genuine auxiliary fixed field is Galois over the original --base field through the compatible embedding above. -/ --theorem numberFieldTowerFinitePadicAuxiliaryBase_isGalois -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- IsGalois K -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ)) := by -- let H := -- numberFieldTowerBaseSubgroup K L -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let hSH := -- numberFieldTowerFinitePadicCyclicFixedSubgroup_le_baseSubgroup -- (K := K) (L := L) p τ -- let B := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) H -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S -- let FB := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hSH -- let auxiliaryBaseAlgebra : Algebra B FB := -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) hSH).algebra -- let auxiliaryBaseGalois : IsGalois B FB := -- LocalClassFieldTheory.abstractRelativeFixedField_isGalois -- ℚ (SeparableClosure ℚ) H S hSH -- (numberFieldTowerFinitePadicCyclicFixedSubgroup_extension_normal -- (K := K) (L := L) p τ) -- let eK := -- numberFieldTowerAbstractBaseFieldEquiv K L -- refine -- @IsGalois.of_equiv_equiv -- B FB _ _ auxiliaryBaseAlgebra -- K F _ _ -- (numberFieldTowerFinitePadicAuxiliary_baseAlgebra -- (K := K) (L := L) p τ) -- auxiliaryBaseGalois -- eK.symm.toRingEquiv (RingEquiv.refl F) ?_ -- apply RingHom.ext -- intro x -- apply Subtype.ext -- change -- ((eK (eK.symm x) : B) : SeparableClosure ℚ) = -- (x : SeparableClosure ℚ) -- exact -- congrArg Subtype.val (eK.apply_symm_apply x) -- --/-- The distinguished absolute lift, regarded as an element of the --auxiliary base subgroup. -/ --noncomputable def numberFieldTowerFinitePadicAuxiliarySubgroupLift -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ).toSubgroup := -- ⟨τ.1, -- numberFieldTowerFinitePadicCyclicFixedSubgroup_generator_mem -- (K := K) (L := L) p τ⟩ -- --/-- The actual automorphism of the auxiliary compositum induced by --the distinguished simultaneous finite/cyclotomic lift. -/ --noncomputable def numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- let P := -- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- Gal( -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below / -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S) := by -- dsimp only -- let P := -- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let σS := -- numberFieldTowerFinitePadicAuxiliarySubgroupLift -- (K := K) (L := L) p τ -- exact -- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -- ℚ (SeparableClosure ℚ) -- S P.field P.below -- P.toFiniteGaloisExtension.normal -- (QuotientGroup.mk' -- (extensionSubgroup -- S P.field P.below) -- σS) -- --/-- On the common separable closure, the auxiliary automorphism acts --by the original distinguished ambient lift. -/ --theorem numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (x : -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) : -- ((numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ x : -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) : -- SeparableClosure ℚ) = -- τ.1 (x : SeparableClosure ℚ) := by -- let P := -- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let σS := -- numberFieldTowerFinitePadicAuxiliarySubgroupLift -- (K := K) (L := L) p τ -- exact -- (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup_mk_apply_val -- ℚ (SeparableClosure ℚ) -- S P.field P.below -- P.toFiniteGaloisExtension.normal σS x).symm -- --/-- Restricting the auxiliary automorphism through the actual --base-change square recovers the finite quotient coordinate of the --distinguished lift. -/ --theorem numberFieldTowerFinitePadicAuxiliaryAutomorphism_restriction -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- ((AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K)) -- (numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ) = -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) := by -- let E := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below -- let σE := -- numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ -- apply AlgEquiv.ext -- intro x -- apply (numberFieldSeparableClosureEmbedding L).injective -- calc -- numberFieldSeparableClosureEmbedding L -- (((AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K)) σE x) = -- ((σE (algebraMap L E x) : E) : -- SeparableClosure ℚ) := by -- exact congrArg Subtype.val -- (AlgEquiv.restrictNormal_commutes -- ((AlgEquiv.restrictScalarsHom K) σE) L x) -- _ = τ.1 (numberFieldSeparableClosureEmbedding L x) := by -- rw [ -- numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val -- (K := K) (L := L) p τ] -- rfl -- _ = -- numberFieldSeparableClosureEmbedding L -- (numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) x) := by -- exact -- (numberFieldTowerExtensionQuotientEquivGaloisGroup_mk_apply -- (K := K) (L := L) τ x).symm -- --/-- Restriction of the chosen separable-closure place to the genuine --auxiliary base field. This is an exact extension of the original --finite place of `K`, not merely an equivalent valuation. -/ --noncomputable def -- numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- AbsoluteValueExtension -- (NumberField.HeightOneSpectrum.adicAbv K v) -- (LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ)) := by -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ) -- let wΩ := -- numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v (chosenFinitePlaceExtension (L := L) v) -- refine -- ⟨wΩ.1.comp (f := F.val.toRingHom) F.val.injective, ?_⟩ -- intro x -- change -- wΩ.1 (numberFieldTowerLowerEmbedding K L x) = -- NumberField.HeightOneSpectrum.adicAbv K v x -- exact wΩ.2 x -- --/-- Restriction of the same separable-closure place to the genuine --auxiliary compositum. Its restriction to `K` agrees exactly with the --original normalized finite absolute value. -/ --noncomputable def -- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- AbsoluteValueExtension -- (NumberField.HeightOneSpectrum.adicAbv K v) -- (LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) := by -- let E := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below -- let wΩ := -- numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v (chosenFinitePlaceExtension (L := L) v) -- refine -- ⟨wΩ.1.comp (f := E.val.toRingHom) E.val.injective, ?_⟩ -- intro x -- change -- wΩ.1 (numberFieldTowerLowerEmbedding K L x) = -- NumberField.HeightOneSpectrum.adicAbv K v x -- exact wΩ.2 x -- --/-- The centre of the restricted place on the auxiliary compositum --lies above the centre of the same place on the auxiliary base field. -/ --theorem -- numberFieldTowerFinitePadicAuxiliaryTopPlace_below -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (hτ : -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ ≠ -- 1) : -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let P := -- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S -- let E := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- letI hHfinite : Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- S (le_baseField S)) := -- (numberFieldTowerFinitePadicAuxiliaryAbstractField -- (K := K) (L := L) p τ hτ).finite -- letI hPfinite : Finite -- (S.toSubgroup ⧸ -- extensionSubgroup S P.field P.below) := -- P.finite -- letI _ : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) S hHfinite -- letI _ : FiniteDimensional F E := -- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) -- S P.field P.below hHfinite hPfinite -- letI _ : IsScalarTower ℚ F E := -- IsScalarTower.of_algebraMap_eq' rfl -- letI _ : FiniteDimensional ℚ E := -- FiniteDimensional.trans ℚ F E -- letI _ : NumberField F := -- NumberField.of_module_finite ℚ F -- letI _ : NumberField E := -- NumberField.of_module_finite ℚ E -- letI _ : Algebra K F := -- numberFieldTowerFinitePadicAuxiliary_baseAlgebra -- (K := K) (L := L) p τ -- finitePlaceBelow (K := F) -- (finitePlaceExtensionCentre -- (K := K) (L := E) v -- (numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (K := K) (L := L) v p τ)) = -- finitePlaceExtensionCentre -- (K := K) (L := F) v -- (numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -- (K := K) (L := L) v p τ) := by -- dsimp only -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let P := -- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S -- let E := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let hHfinite : Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- S (le_baseField S)) := -- (numberFieldTowerFinitePadicAuxiliaryAbstractField -- (K := K) (L := L) p τ hτ).finite -- let hPfinite : Finite -- (S.toSubgroup ⧸ -- extensionSubgroup S P.field P.below) := -- P.finite -- let auxiliaryBaseFiniteDimensional : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) S hHfinite -- let auxiliaryTopFiniteDimensional : FiniteDimensional F E := -- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) -- S P.field P.below hHfinite hPfinite -- let auxiliaryScalarTower : IsScalarTower ℚ F E := -- IsScalarTower.of_algebraMap_eq' rfl -- let auxiliaryAbsoluteFiniteDimensional : FiniteDimensional ℚ E := -- FiniteDimensional.trans ℚ F E -- let auxiliaryBaseNumberField : NumberField F := -- NumberField.of_module_finite ℚ F -- let auxiliaryTopNumberField : NumberField E := -- NumberField.of_module_finite ℚ E -- let auxiliaryOriginalBaseAlgebra : Algebra K F := -- numberFieldTowerFinitePadicAuxiliary_baseAlgebra -- (K := K) (L := L) p τ -- let wF := -- numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -- (K := K) (L := L) v p τ -- let wE := -- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (K := K) (L := L) v p τ -- apply HeightOneSpectrum.ext -- ext x -- change -- algebraMap (𝓞 F) (𝓞 E) x ∈ -- finitePlaceExtensionCentreIdeal -- (K := K) (L := E) v wE ↔ -- x ∈ -- finitePlaceExtensionCentreIdeal -- (K := K) (L := F) v wF -- rw [ -- mem_finitePlaceExtensionCentreIdeal_iff, -- mem_finitePlaceExtensionCentreIdeal_iff] -- rfl -- --/-- Evaluation of the distinguished auxiliary automorphism through the --restricted top-field place. Isolating this coercion calculation prevents the --whole decomposition-group proof from normalizing the fixed-field tower. -/ --private opaque -- numberFieldTowerFinitePadicAuxiliaryTopPlace_automorphism_apply -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -- let P := numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let E := LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (K := K) (L := L) v p τ -- let σE := numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ -- ∀ x : E, -- wE.1 (σE x) = -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v (chosenFinitePlaceExtension (L := L) v)).1 -- (τ.1 (x : SeparableClosure ℚ)) := by -- let : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- dsimp only -- intro x -- change -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v (chosenFinitePlaceExtension (L := L) v)).1 -- ((numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ x : -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) -- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ).below) : SeparableClosure ℚ) = _ -- rw [ -- numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val -- (K := K) (L := L) p τ] -- --/-- The distinguished auxiliary automorphism preserves the top-field place --obtained by restricting the original separable-closure place. -/ --private opaque numberFieldTowerFinitePadicAuxiliaryAutomorphism_mem_topPlaceDecomposition -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (hdecomposition : -- letI : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -- absoluteValueDecompositionGroup K -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v (chosenFinitePlaceExtension (L := L) v)).1) : -- let S := numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let F := LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S -- let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (K := K) (L := L) v p τ -- let σE := numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ -- σE ∈ absoluteValueDecompositionGroup F wE.1 := by -- let : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- dsimp only at hdecomposition ⊢ -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S -- let wE := -- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (K := K) (L := L) v p τ -- let σE := -- numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ -- intro x -- change -- wE.1 (σE x) < 1 ↔ -- wE.1 x < 1 -- rw [ -- numberFieldTowerFinitePadicAuxiliaryTopPlace_automorphism_apply -- (K := K) (L := L) v p τ x, -- show -- wE.1 x = -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v -- (chosenFinitePlaceExtension (L := L) v)).1 -- (x : SeparableClosure ℚ) from rfl] -- exact hdecomposition (x : SeparableClosure ℚ) -- --/-- The restricted top-field place and the chosen extension above its centre --have the same decomposition group. -/ --private opaque numberFieldTowerFinitePadicAuxiliaryTopDecompositionGroup_eq_chosen -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (hτ : -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ ≠ 1) : -- let S := numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let P := numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let F := LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S -- let E := LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- letI hHfinite : Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- S (le_baseField S)) := -- (numberFieldTowerFinitePadicAuxiliaryAbstractField -- (K := K) (L := L) p τ hτ).finite -- letI hPfinite : Finite -- (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := P.finite -- letI : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) S hHfinite -- letI : FiniteDimensional F E := -- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) S P.field P.below hHfinite hPfinite -- letI : IsScalarTower ℚ F E := IsScalarTower.of_algebraMap_eq' rfl -- letI : FiniteDimensional ℚ E := FiniteDimensional.trans ℚ F E -- letI : NumberField F := NumberField.of_module_finite ℚ F -- letI : NumberField E := NumberField.of_module_finite ℚ E -- letI : IsAbelianGalois F E := -- GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P -- letI : Algebra K F := -- numberFieldTowerFinitePadicAuxiliary_baseAlgebra -- (K := K) (L := L) p τ -- let wF := numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -- (K := K) (L := L) v p τ -- let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (K := K) (L := L) v p τ -- let V := finitePlaceExtensionCentre (K := K) (L := F) v wF -- absoluteValueDecompositionGroup F wE.1 = -- absoluteValueDecompositionGroup F -- (chosenFinitePlaceExtension (L := E) V).1 := by -- dsimp only -- let H := -- numberFieldTowerFinitePadicAuxiliaryAbstractField -- (K := K) (L := L) p τ hτ -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let P := -- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S -- let E := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- let hHfinite : Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- S (le_baseField S)) := -- H.finite -- let hPfinite : Finite -- (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := -- P.finite -- let : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) S hHfinite -- let : FiniteDimensional F E := -- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) S P.field P.below hHfinite hPfinite -- let : IsScalarTower ℚ F E := IsScalarTower.of_algebraMap_eq' rfl -- let : FiniteDimensional ℚ E := FiniteDimensional.trans ℚ F E -- let : NumberField F := NumberField.of_module_finite ℚ F -- let : NumberField E := NumberField.of_module_finite ℚ E -- let : IsAbelianGalois F E := -- GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P -- let : Algebra K F := -- numberFieldTowerFinitePadicAuxiliary_baseAlgebra -- (K := K) (L := L) p τ -- let wF := -- numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -- (K := K) (L := L) v p τ -- let wE := -- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (K := K) (L := L) v p τ -- let V := finitePlaceExtensionCentre (K := K) (L := F) v wF -- let W := finitePlaceExtensionCentre (K := K) (L := E) v wE -- let Wover : -- {W' : HeightOneSpectrum (𝓞 E) // -- finitePlaceBelow (K := F) W' = V} := -- ⟨W, -- numberFieldTowerFinitePadicAuxiliaryTopPlace_below -- (K := K) (L := L) v p τ hτ⟩ -- let wFE : -- AbsoluteValueExtension -- (NumberField.HeightOneSpectrum.adicAbv F V) E := -- (finitePlaceExtensionEquivAbove -- (K := F) (L := E) V).symm Wover -- have hwFEcentre : -- finitePlaceExtensionCentre -- (K := F) (L := E) V wFE = -- W := by -- exact -- congrArg Subtype.val -- ((finitePlaceExtensionEquivAbove -- (K := F) (L := E) V).apply_symm_apply Wover) -- have hwEquiv : wE.1.IsEquiv wFE.1 := by -- apply -- finitePlaceExtensions_isEquiv_of_centres_eq -- (F := K) (M := F) v V wE wFE -- exact hwFEcentre.symm -- calc -- absoluteValueDecompositionGroup F wE.1 = -- absoluteValueDecompositionGroup F wFE.1 := -- absoluteValueDecompositionGroup_eq_of_absoluteValue_isEquiv -- (F := F) wE.1 wFE.1 hwEquiv -- _ = -- absoluteValueDecompositionGroup F -- (chosenFinitePlaceExtension (L := E) V).1 := -- absoluteValueDecompositionGroup_eq_of_exactExtensions_of_isMulCommutative -- (F := F) -- (NumberField.HeightOneSpectrum.adicAbv F V) -- (RayClass.adicAbv_isNontrivial V) -- wFE -- (chosenFinitePlaceExtension (L := E) V) -- --/-- Pointwise form of norm/restriction naturality. Keeping the function --equality and its coercion normalization in this small declaration prevents --the auxiliary-field witness construction below from repeatedly elaborating --the full pair of composite homomorphisms. -/ --private theorem globalNormResidueMonoidHomOfEmbedding_norm_restriction_apply -- (K K' L L' : Type) -- [Field K] [NumberField K] -- [Field K'] [NumberField K'] -- [Field L] [NumberField L] -- [Field L'] [NumberField L'] -- [Algebra K K'] [Algebra K L] [Algebra K L'] -- [Algebra K' L'] [Algebra L L'] -- [IsScalarTower K K' L'] [IsScalarTower K L L'] -- [FiniteDimensional K L] [IsAbelianGalois K L] -- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -- [FiniteDimensional K K'] [IsGalois K K'] -- (j : L' →ₐ[ℚ] SeparableClosure ℚ) -- (c : IdeleClassGroup K') : -- ((AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K)) -- (globalNormResidueMonoidHomOfEmbedding K' L' j c) = -- globalNormResidueMonoidHomOfEmbedding K L -- (j.comp (IsScalarTower.toAlgHom ℚ L L')) -- (_root_.ideleClassNorm K K' c) := by -- exact -- DFunLike.congr_fun -- (globalNormResidueMonoidHomOfEmbedding_norm_restriction -- (K := K) (L := L) (K' := K') (L' := L') j) c -- -- -- --/-- The auxiliary-field construction produces a lower local unit --whose chosen local Artin value and global norm-residue value are both --the finite quotient coordinate of the distinguished lift. -/ --opaque numberFieldTowerFinitePadicAuxiliaryLocalGlobalRepresentative -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (hτ : -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ ≠ 1) -- (hdecomposition : -- letI : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -- absoluteValueDecompositionGroup K -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v (chosenFinitePlaceExtension (L := L) v)).1) -- (n : ℕ) (hn : 0 < n) -- (hdegree : -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ = -- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n) -- (hprimaryQuotient : -- numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ ∈ -- CommGroup.primaryComponent -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) -- p.1) : -- {z : (v.adicCompletion K)ˣ // -- chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v z = -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) ∧ -- globalNormResidueMonoidHom K L -- (IdeleGroup.finitePlaceIdeleClass v z) = -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ)} := by -- let H := -- numberFieldTowerFinitePadicAuxiliaryAbstractField -- (K := K) (L := L) p τ hτ -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let P := -- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -- (K := K) (L := L) p τ -- let F := -- LocalClassFieldTheory.abstractFixedField -- ℚ (SeparableClosure ℚ) S -- let E := -- LocalClassFieldTheory.abstractRelativeFixedField -- ℚ (SeparableClosure ℚ) P.below -- letI hHfinite : Finite -- ((baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -- extensionSubgroup -- (baseField -- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -- S (le_baseField S)) := -- H.finite -- letI hPfinite : Finite -- (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := -- P.finite -- letI auxiliaryBaseNumberField : NumberField F := by -- let : FiniteDimensional ℚ F := -- LocalClassFieldTheory.abstractFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) S hHfinite -- exact NumberField.of_module_finite ℚ F -- letI auxiliaryTopNumberField : NumberField E := by -- let : FiniteDimensional F E := -- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -- ℚ (SeparableClosure ℚ) -- S P.field P.below hHfinite hPfinite -- exact NumberField.of_module_finite F E -- letI auxiliaryAbelianGalois : IsAbelianGalois F E := -- GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P -- letI auxiliaryOriginalBaseAlgebra : Algebra K F := -- numberFieldTowerFinitePadicAuxiliary_baseAlgebra -- (K := K) (L := L) p τ -- letI auxiliaryOriginalTopAlgebra : Algebra L E := -- numberFieldTowerFinitePadicAuxiliary_topAlgebra -- (K := K) (L := L) p τ -- letI auxiliaryOriginalBaseTopAlgebra : Algebra K E := -- numberFieldTowerFinitePadicAuxiliary_originalBaseTopAlgebra -- (K := K) (L := L) p τ -- letI auxiliaryOriginalTopScalarTower : IsScalarTower K L E := -- numberFieldTowerFinitePadicAuxiliary_originalTopScalarTower -- (K := K) (L := L) p τ -- letI auxiliaryBaseTopScalarTower : IsScalarTower K F E := -- numberFieldTowerFinitePadicAuxiliary_baseTopScalarTower -- (K := K) (L := L) p τ -- letI auxiliaryOriginalBaseGalois : IsGalois K F := -- numberFieldTowerFinitePadicAuxiliaryBase_isGalois -- (K := K) (L := L) p τ -- let auxiliaryOriginalTopAlgHom : L →ₐ[ℚ] E := -- numberFieldTowerFinitePadicAuxiliaryTopEmbedding -- (K := K) (L := L) p τ -- let wF := -- numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -- (K := K) (L := L) v p τ -- let wE := -- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -- (K := K) (L := L) v p τ -- let V := -- finitePlaceExtensionCentre -- (K := K) (L := F) v wF -- have hVbelow : finitePlaceBelow (K := K) V = v := -- finitePlaceBelow_finitePlaceExtensionCentre -- (K := K) (L := F) v wF -- let Vover : -- {V' : HeightOneSpectrum (𝓞 F) // -- finitePlaceBelow (K := K) V' = v} := -- ⟨V, hVbelow⟩ -- letI auxiliaryCompletionAlgebra : -- Algebra (v.adicCompletion K) (V.adicCompletion F) := -- (finitePlaceAdicCompletionMap K F v Vover).toAlgebra -- let σE : Gal(E / F) := -- numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ -- have hσtop : -- σE ∈ absoluteValueDecompositionGroup F wE.1 := -- numberFieldTowerFinitePadicAuxiliaryAutomorphism_mem_topPlaceDecomposition -- (K := K) (L := L) v p τ hdecomposition -- have hgroup := -- numberFieldTowerFinitePadicAuxiliaryTopDecompositionGroup_eq_chosen -- (K := K) (L := L) v p τ hτ -- have hσchosen : -- σE ∈ absoluteValueDecompositionGroup F -- (chosenFinitePlaceExtension (L := E) V).1 := by -- rw [← hgroup] -- exact hσtop -- have hRange : -- σE ∈ (chosenFinitePlaceArtinMonoidHom -- (K := F) (L := E) V).range := by -- rw [chosenFinitePlaceArtinMonoidHom_range (K := F) (L := E) V] -- exact hσchosen -- let y : (V.adicCompletion F)ˣ := Classical.choose hRange -- have hy : -- chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V y = -- numberFieldTowerFinitePadicAuxiliaryAutomorphism -- (K := K) (L := L) p τ := -- Classical.choose_spec hRange -- let z : (v.adicCompletion K)ˣ := -- LocalFieldTheory.normUnits -- (v.adicCompletion K) (V.adicCompletion F) y -- have hz : -- z = LocalFieldTheory.normUnits -- (v.adicCompletion K) (V.adicCompletion F) y := by -- rfl -- let σK : Gal(L / K) := -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) -- let restriction : Gal(E / F) →* Gal(L / K) := -- (AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K) -- have hrestrict : restriction σE = σK := -- numberFieldTowerFinitePadicAuxiliaryAutomorphism_restriction -- (K := K) (L := L) p τ -- have hlocal : -- chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v z = -- σK := by -- rw [hz] -- have hnat := -- DFunLike.congr_fun -- (chosenFinitePlaceArtinMonoidHom_norm_restriction_of_below_eq -- (K := K) (L := L) (K' := F) (L' := E) -- v V hVbelow) y -- calc -- chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v -- (LocalFieldTheory.normUnits -- (v.adicCompletion K) (V.adicCompletion F) y) = -- restriction -- (chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V y) := by -- simpa only [ -- MonoidHom.coe_comp, Function.comp_apply, restriction] -- using hnat.symm -- _ = restriction σE := congrArg restriction hy -- _ = σK := hrestrict -- let j : E →ₐ[ℚ] SeparableClosure ℚ := -- E.val.restrictScalars ℚ -- have hjLower : -- j.comp auxiliaryOriginalTopAlgHom = -- AlgebraicNumberTheory.numberFieldSeparableClosureEmbedding L := by -- apply AlgHom.ext -- intro a -- exact -- numberFieldTowerFinitePadicAuxiliaryTopEmbedding_coe -- (K := K) (L := L) p τ a -- have hPUnramified : -- P.toFiniteGaloisExtension.IsUnramified -- rationalCyclotomicDegreeData := -- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension_isUnramified -- (K := K) (L := L) p τ n hn hdegree hprimaryQuotient -- have hcompat : -- (globalNormResidueMonoidHomOfEmbedding F E j).comp -- (IdeleGroup.finitePlaceIdeleClass V) = -- chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V := -- globalNormResidueMonoidHomOfEmbedding_comp_finitePlaceIdeleClass_of_abstractFixedFieldUnramified -- H P hPUnramified V -- have hupper : -- globalNormResidueMonoidHomOfEmbedding F E j -- (IdeleGroup.finitePlaceIdeleClass V y) = -- σE := -- (congrArg -- (fun φ : (V.adicCompletion F)ˣ →* Gal(E / F) => φ y) -- hcompat).trans hy -- have hnormClass : -- _root_.ideleClassNorm K F -- (IdeleGroup.finitePlaceIdeleClass V y) = -- IdeleGroup.finitePlaceIdeleClass v z := by -- rw [hz] -- simpa only [Vover] using -- (IdeleGroup.ideleClassNorm_finitePlaceIdeleClass_eq_normUnits -- (K := K) (L := F) v Vover y) -- have hglobal : -- globalNormResidueMonoidHom K L -- (IdeleGroup.finitePlaceIdeleClass v z) = -- σK := by -- calc -- globalNormResidueMonoidHom K L -- (IdeleGroup.finitePlaceIdeleClass v z) = -- globalNormResidueMonoidHom K L -- (_root_.ideleClassNorm K F -- (IdeleGroup.finitePlaceIdeleClass V y)) := -- congrArg (globalNormResidueMonoidHom K L) hnormClass.symm -- _ = globalNormResidueMonoidHomOfEmbedding K L -- (j.comp auxiliaryOriginalTopAlgHom) -- (_root_.ideleClassNorm K F -- (IdeleGroup.finitePlaceIdeleClass V y)) := by -- rw [hjLower, -- ← globalNormResidueMonoidHom_eq_ofEmbedding_standard] -- _ = ((AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K)) -- (globalNormResidueMonoidHomOfEmbedding F E j -- (IdeleGroup.finitePlaceIdeleClass V y)) := by -- apply Eq.symm -- apply -- globalNormResidueMonoidHomOfEmbedding_norm_restriction_apply -- _ = ((AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K)) σE := -- congrArg -- ((AlgEquiv.restrictNormalHom L).comp -- (AlgEquiv.restrictScalarsHom K)) hupper -- _ = restriction σE := rfl -- _ = σK := hrestrict -- exact ⟨z, hlocal, hglobal⟩ -- -- --/-- Every genuine finite-place decomposition automorphism has a --compatible embedded absolute lift with the same finite quotient class --and positive integral cyclotomic `p`-adic degree. -/ --theorem exists_numberFieldTowerFinitePadicLift_of_finitePlace -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (σ : -- absoluteValueDecompositionGroup K -- (chosenFinitePlaceExtension (L := L) v).1) : -- letI _ : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- letI _ : Algebra L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureTopAlgebra L -- letI _ : IsScalarTower K L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureScalarTower K L -- ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) = -- σ.1 ∧ -- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -- absoluteValueDecompositionGroup K -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v -- (chosenFinitePlaceExtension (L := L) v)).1 ∧ -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ ≠ -- 1 ∧ -- ∃ n : ℕ, 0 < n ∧ -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ = -- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by -- let : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- let : Algebra L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureTopAlgebra L -- let : IsScalarTower K L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureScalarTower K L -- obtain ⟨τΩ, hτΩrestrict, n, hn, hτΩdegree⟩ := -- exists_finitePlaceSeparableClosureLift_with_positivePadicCyclotomicDegree -- (K := K) (L := L) v p σ -- let τ : -- (numberFieldTowerBaseSubgroup K L).toSubgroup := -- numberFieldTowerSeparableClosureEquivBaseSubgroup -- K L τΩ.1 -- have hfinite : -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) = -- σ.1 := by -- change -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (QuotientGroup.mk -- (numberFieldTowerSeparableClosureEquivBaseSubgroup -- K L τΩ.1)) = -- σ.1 -- rw [ -- numberFieldTowerExtensionQuotientEquivGaloisGroup_mk_baseSubgroupEquiv] -- exact congrArg Subtype.val hτΩrestrict -- have hdegree : -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ = -- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by -- exact hτΩdegree -- have hdecomposition : -- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -- absoluteValueDecompositionGroup K -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v -- (chosenFinitePlaceExtension (L := L) v)).1 := by -- simpa only [τ, MulEquiv.symm_apply_apply] using τΩ.2 -- refine -- ⟨τ, hfinite, hdecomposition, ?_, n, hn, hdegree⟩ -- rw [hdegree] -- exact -- PadicInt.multiplicative_positiveNatDegree_ne_one -- p.1 n hn -- --/-- Generation of the actual finite Galois group transports back --through the compatible finite quotient coordinate. -/ --theorem -- numberFieldTowerFiniteQuotientCoordinate_generates_of_galoisGenerator -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (σ : Gal(L / K)) -- (hτσ : -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) = -- σ) -- (hσ : Subgroup.closure ({σ} : Set (Gal(L / K))) = ⊤) : -- Subgroup.closure -- ({numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ} : -- Set -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = -- ⊤ := by -- let e := -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- let q : -- (numberFieldTowerFiniteGaloisSubextension -- K L).extensionQuotient := -- numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ -- have hq : e.toMonoidHom q = σ := by -- exact hτσ -- change -- Subgroup.closure -- ({q} : -- Set -- (numberFieldTowerFiniteGaloisSubextension -- K L).extensionQuotient) = -- ⊤ -- apply Subgroup.map_injective (f := e.toMonoidHom) e.injective -- rw [MonoidHom.map_closure, Set.image_singleton, -- hq, hσ, -- Subgroup.map_top_of_surjective e.toMonoidHom e.surjective] -- --/-- If the finite quotient coordinate of a lift generates the whole --finite Galois quotient, then its cyclic preimage together with the --top-field subgroup generates the whole embedded absolute Galois --group. -/ --theorem -- numberFieldTowerFinitePadicCyclicPreimage_sup_extensionSubgroup_eq_top -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (hgenerate : -- Subgroup.closure -- ({numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ} : -- Set -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = -- ⊤) : -- (numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ).toSubgroup ⊔ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) = -- ⊤ := by -- let H := -- numberFieldTowerBaseSubgroup K L -- let N := -- extensionSubgroup -- H -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) -- let Q := H.toSubgroup ⧸ N -- let P := -- numberFieldTowerFinitePadicImage -- (K := K) (L := L) p -- let coordinate := -- numberFieldTowerFinitePadicCoordinate -- (K := K) (L := L) p -- let rangeRestriction := -- numberFieldTowerFinitePadicRangeRestriction -- (K := K) (L := L) p -- let γ : P.toSubgroup := -- rangeRestriction τ -- let Γ := -- ClassFormation.padicCyclicClosure γ -- let finiteProjection : -- P.toSubgroup →* -- Q := -- (MonoidHom.fst Q -- (Multiplicative ℤ_[p.1])).comp -- P.toSubgroup.subtype -- have hprojection : -- Γ.toSubgroup.map finiteProjection = ⊤ := by -- apply top_unique -- rw [← hgenerate] -- apply (Subgroup.closure_le _).2 -- intro q hq -- rw [Set.mem_singleton_iff] at hq -- subst q -- refine -- ⟨γ, -- (ClassFormation.padicCyclicClosureGenerator γ).2, -- ?_⟩ -- rfl -- have hquotientSurjective : -- ∀ q : Q, -- ∃ u : H.toSubgroup, -- u ∈ -- (numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ).toSubgroup ∧ -- numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) u = -- q := by -- intro q -- have hq : -- q ∈ Γ.toSubgroup.map finiteProjection := by -- rw [hprojection] -- trivial -- obtain ⟨z, hzΓ, hzq⟩ := hq -- obtain ⟨u, hu⟩ := -- numberFieldTowerFinitePadicRangeRestriction_surjective -- (K := K) (L := L) p z -- refine ⟨u, ?_, ?_⟩ -- · change rangeRestriction u ∈ Γ.toSubgroup -- rw [hu] -- exact hzΓ -- · calc -- numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) u = -- finiteProjection (rangeRestriction u) := rfl -- _ = finiteProjection z := congrArg finiteProjection hu -- _ = q := hzq -- apply top_unique -- intro h _ -- obtain ⟨u, huU, huq⟩ := -- hquotientSurjective -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) h) -- let k : H.toSubgroup := -- h * u⁻¹ -- have hkN : k ∈ N := by -- apply (QuotientGroup.eq_one_iff (N := N) k).mp -- change -- numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) (h * u⁻¹) = -- 1 -- rw [map_mul, map_inv, huq, mul_inv_cancel] -- have hkSup : -- k ∈ -- (numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ).toSubgroup ⊔ -- N := -- (le_sup_right : -- N ≤ -- (numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ).toSubgroup ⊔ N) hkN -- have huSup : -- u ∈ -- (numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ).toSubgroup ⊔ -- N := -- (le_sup_left : -- (numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ).toSubgroup ≤ -- (numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ).toSubgroup ⊔ N) huU -- have hku : -- k * u = h := by -- simp only [k, inv_mul_cancel_right] -- rw [← hku] -- exact -- ((numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ).toSubgroup ⊔ N).mul_mem -- hkSup huSup -- --/-- Ambient form of the generation statement: the auxiliary cyclic --fixed subgroup together with the subgroup fixing `L` generates the --subgroup fixing `K`. -/ --theorem -- numberFieldTowerFinitePadicCyclicFixedSubgroup_sup_topSubgroup -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (hgenerate : -- Subgroup.closure -- ({numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ} : -- Set -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = -- ⊤) : -- (numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ).toSubgroup ⊔ -- (numberFieldTowerTopSubgroup L).toSubgroup = -- (numberFieldTowerBaseSubgroup K L).toSubgroup := by -- let H := -- numberFieldTowerBaseSubgroup K L -- let T := -- numberFieldTowerTopSubgroup L -- let N := -- extensionSubgroup -- H T -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) -- let U := -- numberFieldTowerFinitePadicCyclicPreimage -- (K := K) (L := L) p τ -- have hrelative : -- U.toSubgroup ⊔ N = ⊤ := -- numberFieldTowerFinitePadicCyclicPreimage_sup_extensionSubgroup_eq_top -- (K := K) (L := L) p τ hgenerate -- have hNmap : -- N.map H.toSubgroup.subtype = -- T.toSubgroup := by -- exact -- Subgroup.map_subgroupOf_eq_of_le -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) -- change -- U.toSubgroup.map H.toSubgroup.subtype ⊔ -- T.toSubgroup = -- H.toSubgroup -- rw [← hNmap, ← Subgroup.map_sup, -- hrelative, ← MonoidHom.range_eq_map, -- H.toSubgroup.range_subtype] -- --/-- The concrete auxiliary fixed field is linearly disjoint from `L` --over the compatible embedded copy of `K`. -/ --theorem -- numberFieldTowerFinitePadicCyclicFixedField_inf_topField -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (hgenerate : -- Subgroup.closure -- ({numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ} : -- Set -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = -- ⊤) : -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ ⊓ -- numberFieldInRationalSeparableClosure L = -- numberFieldTowerBaseField K L := by -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let T := -- numberFieldTowerTopSubgroup L -- let H := -- numberFieldTowerBaseSubgroup K L -- change -- IntermediateField.fixedField S.toSubgroup ⊓ -- numberFieldInRationalSeparableClosure L = -- numberFieldTowerBaseField K L -- rw [ -- ← InfiniteGalois.fixedField_fixingSubgroup -- (numberFieldInRationalSeparableClosure L), -- ← InfiniteGalois.fixedField_fixingSubgroup -- (numberFieldTowerBaseField K L)] -- change -- IntermediateField.fixedField S.toSubgroup ⊓ -- IntermediateField.fixedField T.toSubgroup = -- IntermediateField.fixedField H.toSubgroup -- rw [ -- ← IntermediateField.fixedField_sup_eq_inf, -- numberFieldTowerFinitePadicCyclicFixedSubgroup_sup_topSubgroup -- (K := K) (L := L) p τ hgenerate] -- --/-- If the finite quotient coordinate is `p`-primary, adjoining the --actual rational `p`-primary cyclotomic field to the auxiliary fixed --field contains the compatible copy of `L`. -- --This is the field-theoretic conclusion of the simultaneous --finite/cyclotomic lift: the intersection of the two fixing subgroups --already fixes `L`, hence their fixed-field compositum contains `L`. -/ --theorem -- numberFieldTowerTopField_le_finitePadicCyclicFixedField_sup_padicCyclotomicField -- (p : Nat.Primes) -- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -- (n : ℕ) (hn : 0 < n) -- (hdegree : -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ = -- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n) -- (hprimary : -- numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ ∈ -- CommGroup.primaryComponent -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) -- p.1) : -- numberFieldInRationalSeparableClosure L ≤ -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ ⊔ -- rationalCyclotomicPadicField p := by -- let S := -- numberFieldTowerFinitePadicCyclicFixedSubgroup -- (K := K) (L := L) p τ -- let T := -- numberFieldTowerTopSubgroup L -- let F := -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ -- let C : @IntermediateField ℚ (SeparableClosure ℚ) _ _ -- rationalSeparableClosureAlgebra := -- rationalCyclotomicPadicField p -- have hfixing : -- (F ⊔ C).fixingSubgroup ≤ -- T.toSubgroup := by -- change -- (IntermediateField.fixedField S.toSubgroup ⊔ C).fixingSubgroup ≤ -- T.toSubgroup -- rw [ -- IntermediateField.fixingSubgroup_sup, -- InfiniteGalois.fixingSubgroup_fixedField S] -- intro σ hσ -- apply -- numberFieldTowerFinitePadicCyclicFixedSubgroup_inf_absolutePadicKernel_le_topSubgroup -- (K := K) (L := L) p τ n hn hdegree hprimary -- refine ⟨hσ.1, ?_⟩ -- let : Algebra ℚ rationalCyclotomicZHatField := -- rationalCyclotomicZHatField.algebra' -- let : @Normal ℚ rationalCyclotomicZHatField _ _ -- rationalCyclotomicZHatField.algebra' := -- rationalCyclotomicZHatField_normal -- let E := -- rationalCyclotomicPadicFieldWithinZHat p -- change -- rationalCyclotomicPadicCoordinate p -- (rationalAbsoluteGaloisRestrictionToCyclotomicZHat σ) = -- 1 -- have hr : -- rationalAbsoluteGaloisRestrictionToCyclotomicZHat σ ∈ -- E.fixingSubgroup := by -- rw [IntermediateField.mem_fixingSubgroup_iff] -- intro x hx -- apply Subtype.ext -- have hfix : -- σ x.1 = x.1 := -- (IntermediateField.mem_fixingSubgroup_iff -- (IntermediateField.lift E) σ).1 hσ.2 x.1 -- ((IntermediateField.mem_lift x).2 hx) -- exact -- (AlgEquiv.restrictNormal_commutes -- σ rationalCyclotomicZHatField x).trans hfix -- rw [rationalCyclotomicPadicFieldWithinZHat_fixingSubgroup] -- at hr -- exact hr -- rw [ -- ← InfiniteGalois.fixedField_fixingSubgroup -- (numberFieldInRationalSeparableClosure L)] -- change -- IntermediateField.fixedField T.toSubgroup ≤ -- F ⊔ C -- rw [ -- ← InfiniteGalois.fixedField_fixingSubgroup -- (F ⊔ C)] -- exact -- IntermediateField.fixedField_le hfixing -- --/-- For a finite-place automorphism generating `Gal(L/K)`, construct --the genuine auxiliary number field used in the cyclotomic reduction. -- --The field is finite over `ℚ`, contains the compatible copy of `K`, and --has intersection with the compatible copy of `L` exactly equal to that --copy of `K`. Its defining lift has the prescribed local restriction --and positive integral cyclotomic `p`-adic degree. -/ --theorem exists_finitePlaceCyclotomicAuxiliaryFixedField -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (σ : -- absoluteValueDecompositionGroup K -- (chosenFinitePlaceExtension (L := L) v).1) -- (hσ : -- Subgroup.closure -- ({σ.1} : Set (Gal(L / K))) = -- ⊤) : -- letI _ : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- letI _ : Algebra L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureTopAlgebra L -- letI _ : IsScalarTower K L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureScalarTower K L -- ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) = -- σ.1 ∧ -- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -- absoluteValueDecompositionGroup K -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v -- (chosenFinitePlaceExtension (L := L) v)).1 ∧ -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ ≠ -- 1 ∧ -- FiniteDimensional ℚ -- (numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ) ∧ -- numberFieldTowerBaseField K L ≤ -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ ∧ -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ ⊓ -- numberFieldInRationalSeparableClosure L = -- numberFieldTowerBaseField K L ∧ -- ∃ n : ℕ, 0 < n ∧ -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ = -- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by -- let : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- let : Algebra L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureTopAlgebra L -- let : IsScalarTower K L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureScalarTower K L -- obtain -- ⟨τ, hτσ, hτdecomposition, hτdegree, -- n, hn, hdegree⟩ := -- exists_numberFieldTowerFinitePadicLift_of_finitePlace -- (K := K) (L := L) v p σ -- have hgenerate := -- numberFieldTowerFiniteQuotientCoordinate_generates_of_galoisGenerator -- (K := K) (L := L) τ σ.1 hτσ hσ -- refine -- ⟨τ, hτσ, hτdecomposition, hτdegree, -- numberFieldTowerFinitePadicCyclicFixedField_finiteDimensional -- (K := K) (L := L) p τ hτdegree, -- numberFieldTowerBaseField_le_finitePadicCyclicFixedField -- (K := K) (L := L) p τ, -- numberFieldTowerFinitePadicCyclicFixedField_inf_topField -- (K := K) (L := L) p τ hgenerate, -- n, hn, hdegree⟩ -- --/-- A `p`-primary local generator admits a genuine auxiliary number --field whose compositum with the rational `p`-primary cyclotomic field --contains `L`. -- --Besides the field containment, the construction records the two --properties needed for descent: the auxiliary field meets `L` exactly --in `K`, and the chosen absolute lift has positive integral --cyclotomic degree. -/ --theorem exists_finitePlacePrimaryCyclotomicAuxiliaryFixedField -- (v : HeightOneSpectrum (𝓞 K)) -- (p : Nat.Primes) -- (σ : -- absoluteValueDecompositionGroup K -- (chosenFinitePlaceExtension (L := L) v).1) -- (hgenerate : -- Subgroup.closure -- ({σ.1} : Set (Gal(L / K))) = -- ⊤) -- (hprimary : -- σ.1 ∈ -- CommGroup.primaryComponent -- (Gal(L / K)) p.1) : -- letI _ : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- letI _ : Algebra L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureTopAlgebra L -- letI _ : IsScalarTower K L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureScalarTower K L -- ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- (numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ) = -- σ.1 ∧ -- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -- absoluteValueDecompositionGroup K -- (numberFieldTowerFinitePlaceExtensionToSeparableClosure -- K L v -- (chosenFinitePlaceExtension (L := L) v)).1 ∧ -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ ≠ -- 1 ∧ -- FiniteDimensional ℚ -- (numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ) ∧ -- numberFieldTowerBaseField K L ≤ -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ ∧ -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ ⊓ -- numberFieldInRationalSeparableClosure L = -- numberFieldTowerBaseField K L ∧ -- numberFieldInRationalSeparableClosure L ≤ -- numberFieldTowerFinitePadicCyclicFixedField -- (K := K) (L := L) p τ ⊔ -- rationalCyclotomicPadicField p ∧ -- ∃ n : ℕ, 0 < n ∧ -- numberFieldTowerBaseSubgroupPadicCyclotomicDegree -- (K := K) (L := L) p τ = -- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by -- let : Algebra K (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureBaseAlgebra K L -- let : Algebra L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureTopAlgebra L -- let : IsScalarTower K L (SeparableClosure ℚ) := -- numberFieldTowerSeparableClosureScalarTower K L -- obtain -- ⟨τ, hτσ, hτdecomposition, hτdegree, -- hfinite, hbase, hintersection, -- n, hn, hdegree⟩ := -- exists_finitePlaceCyclotomicAuxiliaryFixedField -- (K := K) (L := L) v p σ hgenerate -- have hprimaryQuotient : -- numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ ∈ -- CommGroup.primaryComponent -- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -- extensionSubgroup -- (numberFieldTowerBaseSubgroup K L) -- (numberFieldTowerTopSubgroup L) -- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) -- p.1 := by -- obtain ⟨m, hm⟩ := hprimary -- refine ⟨m, ?_⟩ -- let e := -- numberFieldTowerExtensionQuotientEquivGaloisGroup K L -- let q := -- numberFieldTowerFiniteQuotientCoordinate -- (K := K) (L := L) τ -- let N : ℕ := p.1 ^ m -- have hq : e q = σ.1 := by -- exact hτσ -- have hmN : σ.1 ^ N = 1 := by -- exact hm -- change q ^ N = 1 -- apply e.injective -- calc -- e (q ^ N) = (e q) ^ N := by -- exact map_pow e q N -- _ = σ.1 ^ N := by rw [hq] -- _ = 1 := hmN -- _ = e 1 := (map_one e).symm -- have hcontainment := -- numberFieldTowerTopField_le_finitePadicCyclicFixedField_sup_padicCyclotomicField -- (K := K) (L := L) p τ n hn hdegree -- hprimaryQuotient -- exact -- ⟨τ, hτσ, hτdecomposition, hτdegree, -- hfinite, hbase, hintersection, -- hcontainment, n, hn, hdegree⟩ -- --end Reciprocity --end GlobalClassFieldTheory -+/- Declaration-preserving split of the original source. See the immutable source-split receipt. -/ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldExistence -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldAutomorphisms.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldAutomorphisms.lean -new file mode 100644 -index 0000000..05e27fe ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldAutomorphisms.lean -@@ -0,0 +1,593 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldBase -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open AlgebraicNumberTheory IsDedekindDomain NumberField -+open IdeleGroup RelativeIdeleGroup -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open CyclicCohomology -+open KummerTheory ClassFormation -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open GlobalClassFields -+ -+variable -+ {K L : Type} -+ [Field K] [NumberField K] -+ [Field L] [NumberField L] [Algebra K L] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ -+ -+local instance splitFactPrimeAutomorphisms (p : Nat.Primes) : Fact p.1.Prime := ⟨p.2⟩ -+ -+attribute [local instance] -+ rationalSeparableClosureAlgebra -+ finitePadicAuxiliaryExtensionNormal -+ finitePadicAuxiliaryExtensionQuotientFinite -+ finitePadicAuxiliaryExtensionQuotientIsMulCommutative -+ -+/-- The distinguished absolute lift, regarded as an element of the -+auxiliary base subgroup. -/ -+noncomputable def numberFieldTowerFinitePadicAuxiliarySubgroupLift -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ).toSubgroup := -+ ⟨τ.1, -+ numberFieldTowerFinitePadicCyclicFixedSubgroup_generator_mem -+ (K := K) (L := L) p τ⟩ -+ -+/-- The actual automorphism of the auxiliary compositum induced by -+the distinguished simultaneous finite/cyclotomic lift. -/ -+noncomputable def numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ let P := -+ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ Gal( -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below / -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S) := by -+ dsimp only -+ let P := -+ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let σS := -+ numberFieldTowerFinitePadicAuxiliarySubgroupLift -+ (K := K) (L := L) p τ -+ exact -+ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup -+ ℚ (SeparableClosure ℚ) -+ S P.field P.below -+ P.toFiniteGaloisExtension.normal -+ (QuotientGroup.mk' -+ (extensionSubgroup -+ S P.field P.below) -+ σS) -+ -+/-- On the common separable closure, the auxiliary automorphism acts -+by the original distinguished ambient lift. -/ -+theorem numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (x : -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) : -+ ((numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ x : -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) : -+ SeparableClosure ℚ) = -+ τ.1 (x : SeparableClosure ℚ) := by -+ let P := -+ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let σS := -+ numberFieldTowerFinitePadicAuxiliarySubgroupLift -+ (K := K) (L := L) p τ -+ exact -+ (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup_mk_apply_val -+ ℚ (SeparableClosure ℚ) -+ S P.field P.below -+ P.toFiniteGaloisExtension.normal σS x).symm -+ -+/-- Restricting the auxiliary automorphism through the actual -+base-change square recovers the finite quotient coordinate of the -+distinguished lift. -/ -+theorem numberFieldTowerFinitePadicAuxiliaryAutomorphism_restriction -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ ((AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K)) -+ (numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ) = -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) := by -+ let E := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below -+ let σE := -+ numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ -+ apply AlgEquiv.ext -+ intro x -+ apply (numberFieldSeparableClosureEmbedding L).injective -+ calc -+ numberFieldSeparableClosureEmbedding L -+ (((AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K)) σE x) = -+ ((σE (algebraMap L E x) : E) : -+ SeparableClosure ℚ) := by -+ exact congrArg Subtype.val -+ (AlgEquiv.restrictNormal_commutes -+ ((AlgEquiv.restrictScalarsHom K) σE) L x) -+ _ = τ.1 (numberFieldSeparableClosureEmbedding L x) := by -+ rw [ -+ numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val -+ (K := K) (L := L) p τ] -+ rfl -+ _ = -+ numberFieldSeparableClosureEmbedding L -+ (numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) x) := by -+ exact -+ (numberFieldTowerExtensionQuotientEquivGaloisGroup_mk_apply -+ (K := K) (L := L) τ x).symm -+ -+/-- Restriction of the chosen separable-closure place to the genuine -+auxiliary base field. This is an exact extension of the original -+finite place of `K`, not merely an equivalent valuation. -/ -+noncomputable def -+ numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ AbsoluteValueExtension -+ (NumberField.HeightOneSpectrum.adicAbv K v) -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ)) := by -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ) -+ let wΩ := -+ numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v (chosenFinitePlaceExtension (L := L) v) -+ refine -+ ⟨wΩ.1.comp (f := F.val.toRingHom) F.val.injective, ?_⟩ -+ intro x -+ change -+ wΩ.1 (numberFieldTowerLowerEmbedding K L x) = -+ NumberField.HeightOneSpectrum.adicAbv K v x -+ exact wΩ.2 x -+ -+/-- Restriction of the same separable-closure place to the genuine -+auxiliary compositum. Its restriction to `K` agrees exactly with the -+original normalized finite absolute value. -/ -+noncomputable def -+ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ AbsoluteValueExtension -+ (NumberField.HeightOneSpectrum.adicAbv K v) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) := by -+ let E := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below -+ let wΩ := -+ numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v (chosenFinitePlaceExtension (L := L) v) -+ refine -+ ⟨wΩ.1.comp (f := E.val.toRingHom) E.val.injective, ?_⟩ -+ intro x -+ change -+ wΩ.1 (numberFieldTowerLowerEmbedding K L x) = -+ NumberField.HeightOneSpectrum.adicAbv K v x -+ exact wΩ.2 x -+ -+/-- The centre of the restricted place on the auxiliary compositum -+lies above the centre of the same place on the auxiliary base field. -/ -+theorem -+ numberFieldTowerFinitePadicAuxiliaryTopPlace_below -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (hτ : -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ ≠ -+ 1) : -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let P := -+ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S -+ let E := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ letI hHfinite : Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ S (le_baseField S)) := -+ (numberFieldTowerFinitePadicAuxiliaryAbstractField -+ (K := K) (L := L) p τ hτ).finite -+ letI hPfinite : Finite -+ (S.toSubgroup ⧸ -+ extensionSubgroup S P.field P.below) := -+ P.finite -+ letI _ : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) S hHfinite -+ letI _ : FiniteDimensional F E := -+ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) -+ S P.field P.below hHfinite hPfinite -+ letI _ : IsScalarTower ℚ F E := -+ IsScalarTower.of_algebraMap_eq' rfl -+ letI _ : FiniteDimensional ℚ E := -+ FiniteDimensional.trans ℚ F E -+ letI _ : NumberField F := -+ NumberField.of_module_finite ℚ F -+ letI _ : NumberField E := -+ NumberField.of_module_finite ℚ E -+ letI _ : Algebra K F := -+ numberFieldTowerFinitePadicAuxiliary_baseAlgebra -+ (K := K) (L := L) p τ -+ finitePlaceBelow (K := F) -+ (finitePlaceExtensionCentre -+ (K := K) (L := E) v -+ (numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (K := K) (L := L) v p τ)) = -+ finitePlaceExtensionCentre -+ (K := K) (L := F) v -+ (numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -+ (K := K) (L := L) v p τ) := by -+ dsimp only -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let P := -+ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S -+ let E := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let hHfinite : Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ S (le_baseField S)) := -+ (numberFieldTowerFinitePadicAuxiliaryAbstractField -+ (K := K) (L := L) p τ hτ).finite -+ let hPfinite : Finite -+ (S.toSubgroup ⧸ -+ extensionSubgroup S P.field P.below) := -+ P.finite -+ let auxiliaryBaseFiniteDimensional : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) S hHfinite -+ let auxiliaryTopFiniteDimensional : FiniteDimensional F E := -+ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) -+ S P.field P.below hHfinite hPfinite -+ let auxiliaryScalarTower : IsScalarTower ℚ F E := -+ IsScalarTower.of_algebraMap_eq' rfl -+ let auxiliaryAbsoluteFiniteDimensional : FiniteDimensional ℚ E := -+ FiniteDimensional.trans ℚ F E -+ let auxiliaryBaseNumberField : NumberField F := -+ NumberField.of_module_finite ℚ F -+ let auxiliaryTopNumberField : NumberField E := -+ NumberField.of_module_finite ℚ E -+ let auxiliaryOriginalBaseAlgebra : Algebra K F := -+ numberFieldTowerFinitePadicAuxiliary_baseAlgebra -+ (K := K) (L := L) p τ -+ let wF := -+ numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -+ (K := K) (L := L) v p τ -+ let wE := -+ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (K := K) (L := L) v p τ -+ apply HeightOneSpectrum.ext -+ ext x -+ change -+ algebraMap (𝓞 F) (𝓞 E) x ∈ -+ finitePlaceExtensionCentreIdeal -+ (K := K) (L := E) v wE ↔ -+ x ∈ -+ finitePlaceExtensionCentreIdeal -+ (K := K) (L := F) v wF -+ rw [ -+ mem_finitePlaceExtensionCentreIdeal_iff, -+ mem_finitePlaceExtensionCentreIdeal_iff] -+ rfl -+ -+/-- Evaluation of the distinguished auxiliary automorphism through the -+restricted top-field place. Isolating this coercion calculation prevents the -+whole decomposition-group proof from normalizing the fixed-field tower. -/ -+public opaque -+ numberFieldTowerFinitePadicAuxiliaryTopPlace_automorphism_apply -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ let P := numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let E := LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (K := K) (L := L) v p τ -+ let σE := numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ -+ ∀ x : E, -+ wE.1 (σE x) = -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v (chosenFinitePlaceExtension (L := L) v)).1 -+ (τ.1 (x : SeparableClosure ℚ)) := by -+ let : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ dsimp only -+ intro x -+ change -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v (chosenFinitePlaceExtension (L := L) v)).1 -+ ((numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ x : -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) : SeparableClosure ℚ) = _ -+ rw [ -+ numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val -+ (K := K) (L := L) p τ] -+ -+/-- The distinguished auxiliary automorphism preserves the top-field place -+obtained by restricting the original separable-closure place. -/ -+public opaque numberFieldTowerFinitePadicAuxiliaryAutomorphism_mem_topPlaceDecomposition -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (hdecomposition : -+ letI : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -+ absoluteValueDecompositionGroup K -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v (chosenFinitePlaceExtension (L := L) v)).1) : -+ let S := numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let F := LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S -+ let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (K := K) (L := L) v p τ -+ let σE := numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ -+ σE ∈ absoluteValueDecompositionGroup F wE.1 := by -+ let : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ dsimp only at hdecomposition ⊢ -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S -+ let wE := -+ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (K := K) (L := L) v p τ -+ let σE := -+ numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ -+ intro x -+ change -+ wE.1 (σE x) < 1 ↔ -+ wE.1 x < 1 -+ rw [ -+ numberFieldTowerFinitePadicAuxiliaryTopPlace_automorphism_apply -+ (K := K) (L := L) v p τ x, -+ show -+ wE.1 x = -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v -+ (chosenFinitePlaceExtension (L := L) v)).1 -+ (x : SeparableClosure ℚ) from rfl] -+ exact hdecomposition (x : SeparableClosure ℚ) -+ -+/-- The restricted top-field place and the chosen extension above its centre -+have the same decomposition group. -/ -+public opaque numberFieldTowerFinitePadicAuxiliaryTopDecompositionGroup_eq_chosen -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (hτ : -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ ≠ 1) : -+ let S := numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let P := numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let F := LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S -+ let E := LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ letI hHfinite : Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ S (le_baseField S)) := -+ (numberFieldTowerFinitePadicAuxiliaryAbstractField -+ (K := K) (L := L) p τ hτ).finite -+ letI hPfinite : Finite -+ (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := P.finite -+ letI : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) S hHfinite -+ letI : FiniteDimensional F E := -+ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) S P.field P.below hHfinite hPfinite -+ letI : IsScalarTower ℚ F E := IsScalarTower.of_algebraMap_eq' rfl -+ letI : FiniteDimensional ℚ E := FiniteDimensional.trans ℚ F E -+ letI : NumberField F := NumberField.of_module_finite ℚ F -+ letI : NumberField E := NumberField.of_module_finite ℚ E -+ letI : IsAbelianGalois F E := -+ GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P -+ letI : Algebra K F := -+ numberFieldTowerFinitePadicAuxiliary_baseAlgebra -+ (K := K) (L := L) p τ -+ let wF := numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -+ (K := K) (L := L) v p τ -+ let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (K := K) (L := L) v p τ -+ let V := finitePlaceExtensionCentre (K := K) (L := F) v wF -+ absoluteValueDecompositionGroup F wE.1 = -+ absoluteValueDecompositionGroup F -+ (chosenFinitePlaceExtension (L := E) V).1 := by -+ dsimp only -+ let H := -+ numberFieldTowerFinitePadicAuxiliaryAbstractField -+ (K := K) (L := L) p τ hτ -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let P := -+ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S -+ let E := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ let hHfinite : Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ S (le_baseField S)) := -+ H.finite -+ let hPfinite : Finite -+ (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := -+ P.finite -+ let : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) S hHfinite -+ let : FiniteDimensional F E := -+ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) S P.field P.below hHfinite hPfinite -+ let : IsScalarTower ℚ F E := IsScalarTower.of_algebraMap_eq' rfl -+ let : FiniteDimensional ℚ E := FiniteDimensional.trans ℚ F E -+ let : NumberField F := NumberField.of_module_finite ℚ F -+ let : NumberField E := NumberField.of_module_finite ℚ E -+ let : IsAbelianGalois F E := -+ GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P -+ let : Algebra K F := -+ numberFieldTowerFinitePadicAuxiliary_baseAlgebra -+ (K := K) (L := L) p τ -+ let wF := -+ numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -+ (K := K) (L := L) v p τ -+ let wE := -+ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (K := K) (L := L) v p τ -+ let V := finitePlaceExtensionCentre (K := K) (L := F) v wF -+ let W := finitePlaceExtensionCentre (K := K) (L := E) v wE -+ let Wover : -+ {W' : HeightOneSpectrum (𝓞 E) // -+ finitePlaceBelow (K := F) W' = V} := -+ ⟨W, -+ numberFieldTowerFinitePadicAuxiliaryTopPlace_below -+ (K := K) (L := L) v p τ hτ⟩ -+ let wFE : -+ AbsoluteValueExtension -+ (NumberField.HeightOneSpectrum.adicAbv F V) E := -+ (finitePlaceExtensionEquivAbove -+ (K := F) (L := E) V).symm Wover -+ have hwFEcentre : -+ finitePlaceExtensionCentre -+ (K := F) (L := E) V wFE = -+ W := by -+ exact -+ congrArg Subtype.val -+ ((finitePlaceExtensionEquivAbove -+ (K := F) (L := E) V).apply_symm_apply Wover) -+ have hwEquiv : wE.1.IsEquiv wFE.1 := by -+ apply -+ finitePlaceExtensions_isEquiv_of_centres_eq -+ (F := K) (M := F) v V wE wFE -+ exact hwFEcentre.symm -+ calc -+ absoluteValueDecompositionGroup F wE.1 = -+ absoluteValueDecompositionGroup F wFE.1 := -+ absoluteValueDecompositionGroup_eq_of_absoluteValue_isEquiv -+ (F := F) wE.1 wFE.1 hwEquiv -+ _ = -+ absoluteValueDecompositionGroup F -+ (chosenFinitePlaceExtension (L := E) V).1 := -+ absoluteValueDecompositionGroup_eq_of_exactExtensions_of_isMulCommutative -+ (F := F) -+ (NumberField.HeightOneSpectrum.adicAbv F V) -+ (RayClass.adicAbv_isNontrivial V) -+ wFE -+ (chosenFinitePlaceExtension (L := E) V) -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldBase.lean -new file mode 100644 -index 0000000..2c56707 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldBase.lean -@@ -0,0 +1,433 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open AlgebraicNumberTheory IsDedekindDomain NumberField -+open IdeleGroup RelativeIdeleGroup -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open CyclicCohomology -+open KummerTheory ClassFormation -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open GlobalClassFields -+ -+variable -+ {K L : Type} -+ [Field K] [NumberField K] -+ [Field L] [NumberField L] [Algebra K L] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ -+local instance (p : Nat.Primes) : Fact p.1.Prime := -+ ⟨p.2⟩ -+ -+attribute [local instance] -+ rationalSeparableClosureAlgebra -+ -+local instance finitePadicAuxiliaryExtensionNormal : -+ (extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)).Normal := -+ numberFieldTowerExtensionSubgroup_normal K L -+ -+local instance finitePadicAuxiliaryExtensionQuotientFinite : -+ Finite -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) := -+ numberFieldTowerExtensionQuotient_finite K L -+ -+noncomputable local instance finitePadicAuxiliaryExtensionQuotientIsMulCommutative : -+ IsMulCommutative -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) := by -+ let e : -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) ≃* -+ Gal(L / K) := -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ exact -+ { is_comm := -+ ⟨fun x y => by -+ apply e.injective -+ rw [map_mul, map_mul] -+ exact -+ (inferInstance : -+ IsMulCommutative (Gal(L / K))).is_comm.comm -+ (e x) (e y)⟩ } -+ -+/-- The concrete auxiliary fixed field attached to a simultaneous -+finite/cyclotomic lift. -/ -+noncomputable def numberFieldTowerFinitePadicCyclicFixedField -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ IntermediateField ℚ (SeparableClosure ℚ) := by -+ exact -+ IntermediateField.fixedField -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ).toSubgroup -+ -+/-- A nonzero-degree lift produces a genuine number field: its -+concrete fixed field is finite over `ℚ`. -/ -+theorem numberFieldTowerFinitePadicCyclicFixedField_finiteDimensional -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (hτ : -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ ≠ -+ 1) : -+ FiniteDimensional ℚ -+ (numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ) := by -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let F := -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ -+ apply -+ (InfiniteGalois.isOpen_iff_finite -+ (K := SeparableClosure ℚ) F).1 -+ change IsOpen -+ (IntermediateField.fixedField S.toSubgroup).fixingSubgroup.carrier -+ rw [InfiniteGalois.fixingSubgroup_fixedField S] -+ exact -+ numberFieldTowerFinitePadicCyclicFixedSubgroup_isOpen -+ (K := K) (L := L) p τ hτ -+ -+/-- The compatible embedded copy of `K` lies in every auxiliary -+cyclic fixed field. -/ -+theorem numberFieldTowerBaseField_le_finitePadicCyclicFixedField -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ numberFieldTowerBaseField K L ≤ -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ := by -+ intro x hx -+ change x ∈ IntermediateField.fixedField -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ).toSubgroup -+ rw [IntermediateField.mem_fixedField_iff] -+ intro σ hσ -+ change -+ σ ∈ -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ).toSubgroup at hσ -+ obtain ⟨u, hu, rfl⟩ := hσ -+ exact -+ (IntermediateField.mem_fixingSubgroup_iff -+ (numberFieldTowerBaseField K L) u.1).1 u.2 x hx -+ -+/-- The compatible embedding of the original base field into the -+genuine auxiliary fixed field. -/ -+noncomputable def numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ K →ₐ[ℚ] -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ) := by -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ) -+ exact -+ (numberFieldTowerLowerEmbedding K L).codRestrict F.toSubalgebra -+ (fun x => -+ numberFieldTowerBaseField_le_finitePadicCyclicFixedField -+ (K := K) (L := L) p τ ⟨x, rfl⟩) -+ -+/-- Coercing the auxiliary base embedding recovers the fixed lower embedding -+into the rational separable closure. -/ -+@[simp] -+theorem numberFieldTowerFinitePadicAuxiliaryBaseEmbedding_coe -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (x : K) : -+ ((numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -+ (K := K) (L := L) p τ x : -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ)) : -+ SeparableClosure ℚ) = -+ numberFieldTowerLowerEmbedding K L x := by -+ rfl -+ -+/-- The compatible copy of the original top field lies in the -+auxiliary compositum fixed field. -/ -+theorem numberFieldTowerTopField_mem_finitePadicAuxiliaryTopField -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ {x : SeparableClosure ℚ} -+ (hx : x ∈ numberFieldInRationalSeparableClosure L) : -+ x ∈ -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below := by -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let T := -+ numberFieldTowerTopSubgroup L -+ change x ∈ IntermediateField.fixedField -+ (S.toSubgroup ⊓ T.toSubgroup) -+ rw [IntermediateField.mem_fixedField_iff] -+ intro σ hσ -+ have hσT : σ ∈ T.toSubgroup := -+ hσ.2 -+ change -+ σ ∈ -+ (numberFieldInRationalSeparableClosure L).fixingSubgroup -+ at hσT -+ exact -+ (IntermediateField.mem_fixingSubgroup_iff -+ (numberFieldInRationalSeparableClosure L) σ).1 -+ hσT x hx -+ -+/-- The compatible embedding of the original top field into the -+auxiliary compositum fixed field. -/ -+noncomputable def numberFieldTowerFinitePadicAuxiliaryTopEmbedding -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ L →ₐ[ℚ] -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below := by -+ let E := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below -+ exact -+ (numberFieldSeparableClosureEmbedding L).codRestrict -+ (E.restrictScalars ℚ).toSubalgebra -+ (fun x => -+ numberFieldTowerTopField_mem_finitePadicAuxiliaryTopField -+ (K := K) (L := L) p τ ⟨x, rfl⟩) -+ -+/-- Coercing the auxiliary top embedding recovers the chosen top-field -+embedding into the rational separable closure. -/ -+@[simp] -+theorem numberFieldTowerFinitePadicAuxiliaryTopEmbedding_coe -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (x : L) : -+ ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding -+ (K := K) (L := L) p τ x : -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) : -+ SeparableClosure ℚ) = -+ numberFieldSeparableClosureEmbedding L x := by -+ rfl -+ -+/-- The compatible base and top embeddings form the actual -+base-change square inside the rational separable closure. -/ -+theorem numberFieldTowerFinitePadicAuxiliaryEmbedding_algebraMap -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (x : K) : -+ ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding -+ (K := K) (L := L) p τ (algebraMap K L x) : -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) : -+ SeparableClosure ℚ) = -+ ((numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -+ (K := K) (L := L) p τ x : -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ)) : -+ SeparableClosure ℚ) := by -+ rfl -+ -+noncomputable instance -+ numberFieldTowerFinitePadicAuxiliary_baseAlgebra -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ Algebra K -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ)) := by -+ exact -+ (numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -+ (K := K) (L := L) p τ).toRingHom.toAlgebra -+ -+instance -+ numberFieldTowerFinitePadicAuxiliary_baseRatScalarTower -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ IsScalarTower ℚ K -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ)) := by -+ exact -+ IsScalarTower.of_algebraMap_eq' -+ (numberFieldTowerFinitePadicAuxiliaryBaseEmbedding -+ (K := K) (L := L) p τ).comp_algebraMap.symm -+ -+noncomputable instance -+ numberFieldTowerFinitePadicAuxiliary_topAlgebra -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ Algebra L -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) := by -+ exact -+ (numberFieldTowerFinitePadicAuxiliaryTopEmbedding -+ (K := K) (L := L) p τ).toRingHom.toAlgebra -+ -+instance -+ numberFieldTowerFinitePadicAuxiliary_topRatScalarTower -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ IsScalarTower ℚ L -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) := by -+ exact -+ IsScalarTower.of_algebraMap_eq' -+ (numberFieldTowerFinitePadicAuxiliaryTopEmbedding -+ (K := K) (L := L) p τ).comp_algebraMap.symm -+ -+noncomputable instance -+ numberFieldTowerFinitePadicAuxiliary_originalBaseTopAlgebra -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ Algebra K -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) := by -+ exact -+ ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding -+ (K := K) (L := L) p τ).comp -+ (IsScalarTower.toAlgHom ℚ K L)).toRingHom.toAlgebra -+ -+instance -+ numberFieldTowerFinitePadicAuxiliary_originalTopScalarTower -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ IsScalarTower K L -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) := by -+ exact IsScalarTower.of_algebraMap_eq' rfl -+ -+instance -+ numberFieldTowerFinitePadicAuxiliary_baseTopScalarTower -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ IsScalarTower K -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ)) -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ).below) := by -+ apply IsScalarTower.of_algebraMap_eq' -+ apply RingHom.ext -+ intro x -+ apply Subtype.ext -+ exact -+ numberFieldTowerFinitePadicAuxiliaryEmbedding_algebraMap -+ (K := K) (L := L) p τ x -+ -+/-- The genuine auxiliary fixed field is Galois over the original -+base field through the compatible embedding above. -/ -+theorem numberFieldTowerFinitePadicAuxiliaryBase_isGalois -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : -+ IsGalois K -+ (LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ)) := by -+ let H := -+ numberFieldTowerBaseSubgroup K L -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let hSH := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup_le_baseSubgroup -+ (K := K) (L := L) p τ -+ let B := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) H -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S -+ let FB := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hSH -+ let auxiliaryBaseAlgebra : Algebra B FB := -+ (LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) hSH).algebra -+ let auxiliaryBaseGalois : IsGalois B FB := -+ LocalClassFieldTheory.abstractRelativeFixedField_isGalois -+ ℚ (SeparableClosure ℚ) H S hSH -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup_extension_normal -+ (K := K) (L := L) p τ) -+ let eK := -+ numberFieldTowerAbstractBaseFieldEquiv K L -+ refine -+ @IsGalois.of_equiv_equiv -+ B FB _ _ auxiliaryBaseAlgebra -+ K F _ _ -+ (numberFieldTowerFinitePadicAuxiliary_baseAlgebra -+ (K := K) (L := L) p τ) -+ auxiliaryBaseGalois -+ eK.symm.toRingEquiv (RingEquiv.refl F) ?_ -+ apply RingHom.ext -+ intro x -+ apply Subtype.ext -+ change -+ ((eK (eK.symm x) : B) : SeparableClosure ℚ) = -+ (x : SeparableClosure ℚ) -+ exact -+ congrArg Subtype.val (eK.apply_symm_apply x) -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldExistence.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldExistence.lean -new file mode 100644 -index 0000000..87681a2 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldExistence.lean -@@ -0,0 +1,234 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldFixedFields -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open AlgebraicNumberTheory IsDedekindDomain NumberField -+open IdeleGroup RelativeIdeleGroup -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open CyclicCohomology -+open KummerTheory ClassFormation -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open GlobalClassFields -+ -+variable -+ {K L : Type} -+ [Field K] [NumberField K] -+ [Field L] [NumberField L] [Algebra K L] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ -+ -+local instance splitFactPrimeExistence (p : Nat.Primes) : Fact p.1.Prime := ⟨p.2⟩ -+ -+attribute [local instance] -+ rationalSeparableClosureAlgebra -+ finitePadicAuxiliaryExtensionNormal -+ finitePadicAuxiliaryExtensionQuotientFinite -+ finitePadicAuxiliaryExtensionQuotientIsMulCommutative -+ -+ -+/-- For a finite-place automorphism generating `Gal(L/K)`, construct -+the genuine auxiliary number field used in the cyclotomic reduction. -+ -+The field is finite over `ℚ`, contains the compatible copy of `K`, and -+has intersection with the compatible copy of `L` exactly equal to that -+copy of `K`. Its defining lift has the prescribed local restriction -+and positive integral cyclotomic `p`-adic degree. -/ -+theorem exists_finitePlaceCyclotomicAuxiliaryFixedField -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (σ : -+ absoluteValueDecompositionGroup K -+ (chosenFinitePlaceExtension (L := L) v).1) -+ (hσ : -+ Subgroup.closure -+ ({σ.1} : Set (Gal(L / K))) = -+ ⊤) : -+ letI _ : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ letI _ : Algebra L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureTopAlgebra L -+ letI _ : IsScalarTower K L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureScalarTower K L -+ ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) = -+ σ.1 ∧ -+ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -+ absoluteValueDecompositionGroup K -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v -+ (chosenFinitePlaceExtension (L := L) v)).1 ∧ -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ ≠ -+ 1 ∧ -+ FiniteDimensional ℚ -+ (numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ) ∧ -+ numberFieldTowerBaseField K L ≤ -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ ∧ -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ ⊓ -+ numberFieldInRationalSeparableClosure L = -+ numberFieldTowerBaseField K L ∧ -+ ∃ n : ℕ, 0 < n ∧ -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ = -+ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by -+ let : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ let : Algebra L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureTopAlgebra L -+ let : IsScalarTower K L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureScalarTower K L -+ obtain -+ ⟨τ, hτσ, hτdecomposition, hτdegree, -+ n, hn, hdegree⟩ := -+ exists_numberFieldTowerFinitePadicLift_of_finitePlace -+ (K := K) (L := L) v p σ -+ have hgenerate := -+ numberFieldTowerFiniteQuotientCoordinate_generates_of_galoisGenerator -+ (K := K) (L := L) τ σ.1 hτσ hσ -+ refine -+ ⟨τ, hτσ, hτdecomposition, hτdegree, -+ numberFieldTowerFinitePadicCyclicFixedField_finiteDimensional -+ (K := K) (L := L) p τ hτdegree, -+ numberFieldTowerBaseField_le_finitePadicCyclicFixedField -+ (K := K) (L := L) p τ, -+ numberFieldTowerFinitePadicCyclicFixedField_inf_topField -+ (K := K) (L := L) p τ hgenerate, -+ n, hn, hdegree⟩ -+ -+/-- A `p`-primary local generator admits a genuine auxiliary number -+field whose compositum with the rational `p`-primary cyclotomic field -+contains `L`. -+ -+Besides the field containment, the construction records the two -+properties needed for descent: the auxiliary field meets `L` exactly -+in `K`, and the chosen absolute lift has positive integral -+cyclotomic degree. -/ -+theorem exists_finitePlacePrimaryCyclotomicAuxiliaryFixedField -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (σ : -+ absoluteValueDecompositionGroup K -+ (chosenFinitePlaceExtension (L := L) v).1) -+ (hgenerate : -+ Subgroup.closure -+ ({σ.1} : Set (Gal(L / K))) = -+ ⊤) -+ (hprimary : -+ σ.1 ∈ -+ CommGroup.primaryComponent -+ (Gal(L / K)) p.1) : -+ letI _ : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ letI _ : Algebra L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureTopAlgebra L -+ letI _ : IsScalarTower K L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureScalarTower K L -+ ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) = -+ σ.1 ∧ -+ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -+ absoluteValueDecompositionGroup K -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v -+ (chosenFinitePlaceExtension (L := L) v)).1 ∧ -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ ≠ -+ 1 ∧ -+ FiniteDimensional ℚ -+ (numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ) ∧ -+ numberFieldTowerBaseField K L ≤ -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ ∧ -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ ⊓ -+ numberFieldInRationalSeparableClosure L = -+ numberFieldTowerBaseField K L ∧ -+ numberFieldInRationalSeparableClosure L ≤ -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ ⊔ -+ rationalCyclotomicPadicField p ∧ -+ ∃ n : ℕ, 0 < n ∧ -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ = -+ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by -+ let : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ let : Algebra L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureTopAlgebra L -+ let : IsScalarTower K L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureScalarTower K L -+ obtain -+ ⟨τ, hτσ, hτdecomposition, hτdegree, -+ hfinite, hbase, hintersection, -+ n, hn, hdegree⟩ := -+ exists_finitePlaceCyclotomicAuxiliaryFixedField -+ (K := K) (L := L) v p σ hgenerate -+ have hprimaryQuotient : -+ numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ ∈ -+ CommGroup.primaryComponent -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) -+ p.1 := by -+ obtain ⟨m, hm⟩ := hprimary -+ refine ⟨m, ?_⟩ -+ let e := -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ let q := -+ numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ -+ let N : ℕ := p.1 ^ m -+ have hq : e q = σ.1 := by -+ exact hτσ -+ have hmN : σ.1 ^ N = 1 := by -+ exact hm -+ change q ^ N = 1 -+ apply e.injective -+ calc -+ e (q ^ N) = (e q) ^ N := by -+ exact map_pow e q N -+ _ = σ.1 ^ N := by rw [hq] -+ _ = 1 := hmN -+ _ = e 1 := (map_one e).symm -+ have hcontainment := -+ numberFieldTowerTopField_le_finitePadicCyclicFixedField_sup_padicCyclotomicField -+ (K := K) (L := L) p τ n hn hdegree -+ hprimaryQuotient -+ exact -+ ⟨τ, hτσ, hτdecomposition, hτdegree, -+ hfinite, hbase, hintersection, -+ hcontainment, n, hn, hdegree⟩ -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldFixedFields.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldFixedFields.lean -new file mode 100644 -index 0000000..1ed247d ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldFixedFields.lean -@@ -0,0 +1,420 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldNormRestriction -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open AlgebraicNumberTheory IsDedekindDomain NumberField -+open IdeleGroup RelativeIdeleGroup -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open CyclicCohomology -+open KummerTheory ClassFormation -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open GlobalClassFields -+ -+variable -+ {K L : Type} -+ [Field K] [NumberField K] -+ [Field L] [NumberField L] [Algebra K L] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ -+ -+local instance splitFactPrimeFixedFields (p : Nat.Primes) : Fact p.1.Prime := ⟨p.2⟩ -+ -+attribute [local instance] -+ rationalSeparableClosureAlgebra -+ finitePadicAuxiliaryExtensionNormal -+ finitePadicAuxiliaryExtensionQuotientFinite -+ finitePadicAuxiliaryExtensionQuotientIsMulCommutative -+ -+/-- Generation of the actual finite Galois group transports back -+through the compatible finite quotient coordinate. -/ -+theorem -+ numberFieldTowerFiniteQuotientCoordinate_generates_of_galoisGenerator -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (σ : Gal(L / K)) -+ (hτσ : -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) = -+ σ) -+ (hσ : Subgroup.closure ({σ} : Set (Gal(L / K))) = ⊤) : -+ Subgroup.closure -+ ({numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ} : -+ Set -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = -+ ⊤ := by -+ let e := -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ let q : -+ (numberFieldTowerFiniteGaloisSubextension -+ K L).extensionQuotient := -+ numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ -+ have hq : e.toMonoidHom q = σ := by -+ exact hτσ -+ change -+ Subgroup.closure -+ ({q} : -+ Set -+ (numberFieldTowerFiniteGaloisSubextension -+ K L).extensionQuotient) = -+ ⊤ -+ apply Subgroup.map_injective (f := e.toMonoidHom) e.injective -+ rw [MonoidHom.map_closure, Set.image_singleton, -+ hq, hσ, -+ Subgroup.map_top_of_surjective e.toMonoidHom e.surjective] -+ -+/-- If the finite quotient coordinate of a lift generates the whole -+finite Galois quotient, then its cyclic preimage together with the -+top-field subgroup generates the whole embedded absolute Galois -+group. -/ -+theorem -+ numberFieldTowerFinitePadicCyclicPreimage_sup_extensionSubgroup_eq_top -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (hgenerate : -+ Subgroup.closure -+ ({numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ} : -+ Set -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = -+ ⊤) : -+ (numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ).toSubgroup ⊔ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) = -+ ⊤ := by -+ let H := -+ numberFieldTowerBaseSubgroup K L -+ let N := -+ extensionSubgroup -+ H -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) -+ let Q := H.toSubgroup ⧸ N -+ let P := -+ numberFieldTowerFinitePadicImage -+ (K := K) (L := L) p -+ let coordinate := -+ numberFieldTowerFinitePadicCoordinate -+ (K := K) (L := L) p -+ let rangeRestriction := -+ numberFieldTowerFinitePadicRangeRestriction -+ (K := K) (L := L) p -+ let γ : P.toSubgroup := -+ rangeRestriction τ -+ let Γ := -+ ClassFormation.padicCyclicClosure γ -+ let finiteProjection : -+ P.toSubgroup →* -+ Q := -+ (MonoidHom.fst Q -+ (Multiplicative ℤ_[p.1])).comp -+ P.toSubgroup.subtype -+ have hprojection : -+ Γ.toSubgroup.map finiteProjection = ⊤ := by -+ apply top_unique -+ rw [← hgenerate] -+ apply (Subgroup.closure_le _).2 -+ intro q hq -+ rw [Set.mem_singleton_iff] at hq -+ subst q -+ refine -+ ⟨γ, -+ (ClassFormation.padicCyclicClosureGenerator γ).2, -+ ?_⟩ -+ rfl -+ have hquotientSurjective : -+ ∀ q : Q, -+ ∃ u : H.toSubgroup, -+ u ∈ -+ (numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ).toSubgroup ∧ -+ numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) u = -+ q := by -+ intro q -+ have hq : -+ q ∈ Γ.toSubgroup.map finiteProjection := by -+ rw [hprojection] -+ trivial -+ obtain ⟨z, hzΓ, hzq⟩ := hq -+ obtain ⟨u, hu⟩ := -+ numberFieldTowerFinitePadicRangeRestriction_surjective -+ (K := K) (L := L) p z -+ refine ⟨u, ?_, ?_⟩ -+ · change rangeRestriction u ∈ Γ.toSubgroup -+ rw [hu] -+ exact hzΓ -+ · calc -+ numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) u = -+ finiteProjection (rangeRestriction u) := rfl -+ _ = finiteProjection z := congrArg finiteProjection hu -+ _ = q := hzq -+ apply top_unique -+ intro h _ -+ obtain ⟨u, huU, huq⟩ := -+ hquotientSurjective -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) h) -+ let k : H.toSubgroup := -+ h * u⁻¹ -+ have hkN : k ∈ N := by -+ apply (QuotientGroup.eq_one_iff (N := N) k).mp -+ change -+ numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) (h * u⁻¹) = -+ 1 -+ rw [map_mul, map_inv, huq, mul_inv_cancel] -+ have hkSup : -+ k ∈ -+ (numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ).toSubgroup ⊔ -+ N := -+ (le_sup_right : -+ N ≤ -+ (numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ).toSubgroup ⊔ N) hkN -+ have huSup : -+ u ∈ -+ (numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ).toSubgroup ⊔ -+ N := -+ (le_sup_left : -+ (numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ).toSubgroup ≤ -+ (numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ).toSubgroup ⊔ N) huU -+ have hku : -+ k * u = h := by -+ simp only [k, inv_mul_cancel_right] -+ rw [← hku] -+ exact -+ ((numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ).toSubgroup ⊔ N).mul_mem -+ hkSup huSup -+ -+/-- Ambient form of the generation statement: the auxiliary cyclic -+fixed subgroup together with the subgroup fixing `L` generates the -+subgroup fixing `K`. -/ -+theorem -+ numberFieldTowerFinitePadicCyclicFixedSubgroup_sup_topSubgroup -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (hgenerate : -+ Subgroup.closure -+ ({numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ} : -+ Set -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = -+ ⊤) : -+ (numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ).toSubgroup ⊔ -+ (numberFieldTowerTopSubgroup L).toSubgroup = -+ (numberFieldTowerBaseSubgroup K L).toSubgroup := by -+ let H := -+ numberFieldTowerBaseSubgroup K L -+ let T := -+ numberFieldTowerTopSubgroup L -+ let N := -+ extensionSubgroup -+ H T -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) -+ let U := -+ numberFieldTowerFinitePadicCyclicPreimage -+ (K := K) (L := L) p τ -+ have hrelative : -+ U.toSubgroup ⊔ N = ⊤ := -+ numberFieldTowerFinitePadicCyclicPreimage_sup_extensionSubgroup_eq_top -+ (K := K) (L := L) p τ hgenerate -+ have hNmap : -+ N.map H.toSubgroup.subtype = -+ T.toSubgroup := by -+ exact -+ Subgroup.map_subgroupOf_eq_of_le -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) -+ change -+ U.toSubgroup.map H.toSubgroup.subtype ⊔ -+ T.toSubgroup = -+ H.toSubgroup -+ rw [← hNmap, ← Subgroup.map_sup, -+ hrelative, ← MonoidHom.range_eq_map, -+ H.toSubgroup.range_subtype] -+ -+/-- The concrete auxiliary fixed field is linearly disjoint from `L` -+over the compatible embedded copy of `K`. -/ -+theorem -+ numberFieldTowerFinitePadicCyclicFixedField_inf_topField -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (hgenerate : -+ Subgroup.closure -+ ({numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ} : -+ Set -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = -+ ⊤) : -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ ⊓ -+ numberFieldInRationalSeparableClosure L = -+ numberFieldTowerBaseField K L := by -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let T := -+ numberFieldTowerTopSubgroup L -+ let H := -+ numberFieldTowerBaseSubgroup K L -+ change -+ IntermediateField.fixedField S.toSubgroup ⊓ -+ numberFieldInRationalSeparableClosure L = -+ numberFieldTowerBaseField K L -+ rw [ -+ ← InfiniteGalois.fixedField_fixingSubgroup -+ (numberFieldInRationalSeparableClosure L), -+ ← InfiniteGalois.fixedField_fixingSubgroup -+ (numberFieldTowerBaseField K L)] -+ change -+ IntermediateField.fixedField S.toSubgroup ⊓ -+ IntermediateField.fixedField T.toSubgroup = -+ IntermediateField.fixedField H.toSubgroup -+ rw [ -+ ← IntermediateField.fixedField_sup_eq_inf, -+ numberFieldTowerFinitePadicCyclicFixedSubgroup_sup_topSubgroup -+ (K := K) (L := L) p τ hgenerate] -+ -+/-- If the finite quotient coordinate is `p`-primary, adjoining the -+actual rational `p`-primary cyclotomic field to the auxiliary fixed -+field contains the compatible copy of `L`. -+ -+This is the field-theoretic conclusion of the simultaneous -+finite/cyclotomic lift: the intersection of the two fixing subgroups -+already fixes `L`, hence their fixed-field compositum contains `L`. -/ -+theorem -+ numberFieldTowerTopField_le_finitePadicCyclicFixedField_sup_padicCyclotomicField -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (n : ℕ) (hn : 0 < n) -+ (hdegree : -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ = -+ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n) -+ (hprimary : -+ numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ ∈ -+ CommGroup.primaryComponent -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) -+ p.1) : -+ numberFieldInRationalSeparableClosure L ≤ -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ ⊔ -+ rationalCyclotomicPadicField p := by -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let T := -+ numberFieldTowerTopSubgroup L -+ let F := -+ numberFieldTowerFinitePadicCyclicFixedField -+ (K := K) (L := L) p τ -+ let C : @IntermediateField ℚ (SeparableClosure ℚ) _ _ -+ rationalSeparableClosureAlgebra := -+ rationalCyclotomicPadicField p -+ have hfixing : -+ (F ⊔ C).fixingSubgroup ≤ -+ T.toSubgroup := by -+ change -+ (IntermediateField.fixedField S.toSubgroup ⊔ C).fixingSubgroup ≤ -+ T.toSubgroup -+ rw [ -+ IntermediateField.fixingSubgroup_sup, -+ InfiniteGalois.fixingSubgroup_fixedField S] -+ intro σ hσ -+ apply -+ numberFieldTowerFinitePadicCyclicFixedSubgroup_inf_absolutePadicKernel_le_topSubgroup -+ (K := K) (L := L) p τ n hn hdegree hprimary -+ refine ⟨hσ.1, ?_⟩ -+ let : Algebra ℚ rationalCyclotomicZHatField := -+ rationalCyclotomicZHatField.algebra' -+ let : @Normal ℚ rationalCyclotomicZHatField _ _ -+ rationalCyclotomicZHatField.algebra' := -+ rationalCyclotomicZHatField_normal -+ let E := -+ rationalCyclotomicPadicFieldWithinZHat p -+ change -+ rationalCyclotomicPadicCoordinate p -+ (rationalAbsoluteGaloisRestrictionToCyclotomicZHat σ) = -+ 1 -+ have hr : -+ rationalAbsoluteGaloisRestrictionToCyclotomicZHat σ ∈ -+ E.fixingSubgroup := by -+ rw [IntermediateField.mem_fixingSubgroup_iff] -+ intro x hx -+ apply Subtype.ext -+ have hfix : -+ σ x.1 = x.1 := -+ (IntermediateField.mem_fixingSubgroup_iff -+ (IntermediateField.lift E) σ).1 hσ.2 x.1 -+ ((IntermediateField.mem_lift x).2 hx) -+ exact -+ (AlgEquiv.restrictNormal_commutes -+ σ rationalCyclotomicZHatField x).trans hfix -+ rw [rationalCyclotomicPadicFieldWithinZHat_fixingSubgroup] -+ at hr -+ exact hr -+ rw [ -+ ← InfiniteGalois.fixedField_fixingSubgroup -+ (numberFieldInRationalSeparableClosure L)] -+ change -+ IntermediateField.fixedField T.toSubgroup ≤ -+ F ⊔ C -+ rw [ -+ ← InfiniteGalois.fixedField_fixingSubgroup -+ (F ⊔ C)] -+ exact -+ IntermediateField.fixedField_le hfixing -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldNormRestriction.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldNormRestriction.lean -new file mode 100644 -index 0000000..c7daa65 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldNormRestriction.lean -@@ -0,0 +1,411 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldAutomorphisms -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData -+import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped IsMulCommutative NumberField -+open AlgebraicNumberTheory IsDedekindDomain NumberField -+open IdeleGroup RelativeIdeleGroup -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open CyclicCohomology -+open KummerTheory ClassFormation -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open GlobalClassFields -+ -+variable -+ {K L : Type} -+ [Field K] [NumberField K] -+ [Field L] [NumberField L] [Algebra K L] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ -+ -+local instance splitFactPrimeNormRestriction (p : Nat.Primes) : Fact p.1.Prime := ⟨p.2⟩ -+ -+attribute [local instance] -+ rationalSeparableClosureAlgebra -+ finitePadicAuxiliaryExtensionNormal -+ finitePadicAuxiliaryExtensionQuotientFinite -+ finitePadicAuxiliaryExtensionQuotientIsMulCommutative -+ -+/-- Pointwise form of norm/restriction naturality. Keeping the function -+equality and its coercion normalization in this small declaration prevents -+the auxiliary-field witness construction below from repeatedly elaborating -+the full pair of composite homomorphisms. -/ -+private theorem globalNormResidueMonoidHomOfEmbedding_norm_restriction_apply -+ (K K' L L' : Type) -+ [Field K] [NumberField K] -+ [Field K'] [NumberField K'] -+ [Field L] [NumberField L] -+ [Field L'] [NumberField L'] -+ [Algebra K K'] [Algebra K L] [Algebra K L'] -+ [Algebra K' L'] [Algebra L L'] -+ [IsScalarTower K K' L'] [IsScalarTower K L L'] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -+ [FiniteDimensional K K'] [IsGalois K K'] -+ (j : L' →ₐ[ℚ] SeparableClosure ℚ) -+ (c : IdeleClassGroup K') : -+ ((AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K)) -+ (globalNormResidueMonoidHomOfEmbedding K' L' j c) = -+ globalNormResidueMonoidHomOfEmbedding K L -+ (j.comp (IsScalarTower.toAlgHom ℚ L L')) -+ (_root_.ideleClassNorm K K' c) := by -+ exact -+ DFunLike.congr_fun -+ (globalNormResidueMonoidHomOfEmbedding_norm_restriction -+ (K := K) (L := L) (K' := K') (L' := L') j) c -+ -+ -+/-- The auxiliary-field construction produces a lower local unit -+whose chosen local Artin value and global norm-residue value are both -+the finite quotient coordinate of the distinguished lift. -/ -+opaque numberFieldTowerFinitePadicAuxiliaryLocalGlobalRepresentative -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) -+ (hτ : -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ ≠ 1) -+ (hdecomposition : -+ letI : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -+ absoluteValueDecompositionGroup K -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v (chosenFinitePlaceExtension (L := L) v)).1) -+ (n : ℕ) (hn : 0 < n) -+ (hdegree : -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ = -+ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n) -+ (hprimaryQuotient : -+ numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ ∈ -+ CommGroup.primaryComponent -+ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ -+ extensionSubgroup -+ (numberFieldTowerBaseSubgroup K L) -+ (numberFieldTowerTopSubgroup L) -+ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) -+ p.1) : -+ {z : (v.adicCompletion K)ˣ // -+ chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v z = -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) ∧ -+ globalNormResidueMonoidHom K L -+ (IdeleGroup.finitePlaceIdeleClass v z) = -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ)} := by -+ let H := -+ numberFieldTowerFinitePadicAuxiliaryAbstractField -+ (K := K) (L := L) p τ hτ -+ let S := -+ numberFieldTowerFinitePadicCyclicFixedSubgroup -+ (K := K) (L := L) p τ -+ let P := -+ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension -+ (K := K) (L := L) p τ -+ let F := -+ LocalClassFieldTheory.abstractFixedField -+ ℚ (SeparableClosure ℚ) S -+ let E := -+ LocalClassFieldTheory.abstractRelativeFixedField -+ ℚ (SeparableClosure ℚ) P.below -+ letI hHfinite : Finite -+ ((baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ -+ extensionSubgroup -+ (baseField -+ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) -+ S (le_baseField S)) := -+ H.finite -+ letI hPfinite : Finite -+ (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := -+ P.finite -+ letI auxiliaryBaseNumberField : NumberField F := by -+ let : FiniteDimensional ℚ F := -+ LocalClassFieldTheory.abstractFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) S hHfinite -+ exact NumberField.of_module_finite ℚ F -+ letI auxiliaryTopNumberField : NumberField E := by -+ let : FiniteDimensional F E := -+ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional -+ ℚ (SeparableClosure ℚ) -+ S P.field P.below hHfinite hPfinite -+ exact NumberField.of_module_finite F E -+ letI auxiliaryAbelianGalois : IsAbelianGalois F E := -+ GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P -+ letI auxiliaryOriginalBaseAlgebra : Algebra K F := -+ numberFieldTowerFinitePadicAuxiliary_baseAlgebra -+ (K := K) (L := L) p τ -+ letI auxiliaryOriginalTopAlgebra : Algebra L E := -+ numberFieldTowerFinitePadicAuxiliary_topAlgebra -+ (K := K) (L := L) p τ -+ letI auxiliaryOriginalBaseTopAlgebra : Algebra K E := -+ numberFieldTowerFinitePadicAuxiliary_originalBaseTopAlgebra -+ (K := K) (L := L) p τ -+ letI auxiliaryOriginalTopScalarTower : IsScalarTower K L E := -+ numberFieldTowerFinitePadicAuxiliary_originalTopScalarTower -+ (K := K) (L := L) p τ -+ letI auxiliaryBaseTopScalarTower : IsScalarTower K F E := -+ numberFieldTowerFinitePadicAuxiliary_baseTopScalarTower -+ (K := K) (L := L) p τ -+ letI auxiliaryOriginalBaseGalois : IsGalois K F := -+ numberFieldTowerFinitePadicAuxiliaryBase_isGalois -+ (K := K) (L := L) p τ -+ let auxiliaryOriginalTopAlgHom : L →ₐ[ℚ] E := -+ numberFieldTowerFinitePadicAuxiliaryTopEmbedding -+ (K := K) (L := L) p τ -+ let wF := -+ numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension -+ (K := K) (L := L) v p τ -+ let wE := -+ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension -+ (K := K) (L := L) v p τ -+ let V := -+ finitePlaceExtensionCentre -+ (K := K) (L := F) v wF -+ have hVbelow : finitePlaceBelow (K := K) V = v := -+ finitePlaceBelow_finitePlaceExtensionCentre -+ (K := K) (L := F) v wF -+ let Vover : -+ {V' : HeightOneSpectrum (𝓞 F) // -+ finitePlaceBelow (K := K) V' = v} := -+ ⟨V, hVbelow⟩ -+ letI auxiliaryCompletionAlgebra : -+ Algebra (v.adicCompletion K) (V.adicCompletion F) := -+ (finitePlaceAdicCompletionMap K F v Vover).toAlgebra -+ let σE : Gal(E / F) := -+ numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ -+ have hσtop : -+ σE ∈ absoluteValueDecompositionGroup F wE.1 := -+ numberFieldTowerFinitePadicAuxiliaryAutomorphism_mem_topPlaceDecomposition -+ (K := K) (L := L) v p τ hdecomposition -+ have hgroup := -+ numberFieldTowerFinitePadicAuxiliaryTopDecompositionGroup_eq_chosen -+ (K := K) (L := L) v p τ hτ -+ have hσchosen : -+ σE ∈ absoluteValueDecompositionGroup F -+ (chosenFinitePlaceExtension (L := E) V).1 := by -+ rw [← hgroup] -+ exact hσtop -+ have hRange : -+ σE ∈ (chosenFinitePlaceArtinMonoidHom -+ (K := F) (L := E) V).range := by -+ rw [chosenFinitePlaceArtinMonoidHom_range (K := F) (L := E) V] -+ exact hσchosen -+ let y : (V.adicCompletion F)ˣ := Classical.choose hRange -+ have hy : -+ chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V y = -+ numberFieldTowerFinitePadicAuxiliaryAutomorphism -+ (K := K) (L := L) p τ := -+ Classical.choose_spec hRange -+ let z : (v.adicCompletion K)ˣ := -+ LocalFieldTheory.normUnits -+ (v.adicCompletion K) (V.adicCompletion F) y -+ have hz : -+ z = LocalFieldTheory.normUnits -+ (v.adicCompletion K) (V.adicCompletion F) y := by -+ rfl -+ let σK : Gal(L / K) := -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) -+ let restriction : Gal(E / F) →* Gal(L / K) := -+ (AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K) -+ have hrestrict : restriction σE = σK := -+ numberFieldTowerFinitePadicAuxiliaryAutomorphism_restriction -+ (K := K) (L := L) p τ -+ have hlocal : -+ chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v z = -+ σK := by -+ rw [hz] -+ have hnat := -+ DFunLike.congr_fun -+ (chosenFinitePlaceArtinMonoidHom_norm_restriction_of_below_eq -+ (K := K) (L := L) (K' := F) (L' := E) -+ v V hVbelow) y -+ calc -+ chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v -+ (LocalFieldTheory.normUnits -+ (v.adicCompletion K) (V.adicCompletion F) y) = -+ restriction -+ (chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V y) := by -+ simpa only [ -+ MonoidHom.coe_comp, Function.comp_apply, restriction] -+ using hnat.symm -+ _ = restriction σE := congrArg restriction hy -+ _ = σK := hrestrict -+ let j : E →ₐ[ℚ] SeparableClosure ℚ := -+ E.val.restrictScalars ℚ -+ have hjLower : -+ j.comp auxiliaryOriginalTopAlgHom = -+ AlgebraicNumberTheory.numberFieldSeparableClosureEmbedding L := by -+ apply AlgHom.ext -+ intro a -+ exact -+ numberFieldTowerFinitePadicAuxiliaryTopEmbedding_coe -+ (K := K) (L := L) p τ a -+ have hPUnramified : -+ P.toFiniteGaloisExtension.IsUnramified -+ rationalCyclotomicDegreeData := -+ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension_isUnramified -+ (K := K) (L := L) p τ n hn hdegree hprimaryQuotient -+ have hcompat : -+ (globalNormResidueMonoidHomOfEmbedding F E j).comp -+ (IdeleGroup.finitePlaceIdeleClass V) = -+ chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V := -+ globalNormResidueMonoidHomOfEmbedding_comp_finitePlaceIdeleClass_of_abstractFixedFieldUnramified -+ H P hPUnramified V -+ have hupper : -+ globalNormResidueMonoidHomOfEmbedding F E j -+ (IdeleGroup.finitePlaceIdeleClass V y) = -+ σE := -+ (congrArg -+ (fun φ : (V.adicCompletion F)ˣ →* Gal(E / F) => φ y) -+ hcompat).trans hy -+ have hnormClass : -+ _root_.ideleClassNorm K F -+ (IdeleGroup.finitePlaceIdeleClass V y) = -+ IdeleGroup.finitePlaceIdeleClass v z := by -+ rw [hz] -+ simpa only [Vover] using -+ (IdeleGroup.ideleClassNorm_finitePlaceIdeleClass_eq_normUnits -+ (K := K) (L := F) v Vover y) -+ have hglobal : -+ globalNormResidueMonoidHom K L -+ (IdeleGroup.finitePlaceIdeleClass v z) = -+ σK := by -+ calc -+ globalNormResidueMonoidHom K L -+ (IdeleGroup.finitePlaceIdeleClass v z) = -+ globalNormResidueMonoidHom K L -+ (_root_.ideleClassNorm K F -+ (IdeleGroup.finitePlaceIdeleClass V y)) := -+ congrArg (globalNormResidueMonoidHom K L) hnormClass.symm -+ _ = globalNormResidueMonoidHomOfEmbedding K L -+ (j.comp auxiliaryOriginalTopAlgHom) -+ (_root_.ideleClassNorm K F -+ (IdeleGroup.finitePlaceIdeleClass V y)) := by -+ rw [hjLower, -+ ← globalNormResidueMonoidHom_eq_ofEmbedding_standard] -+ _ = ((AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K)) -+ (globalNormResidueMonoidHomOfEmbedding F E j -+ (IdeleGroup.finitePlaceIdeleClass V y)) := by -+ apply Eq.symm -+ apply -+ globalNormResidueMonoidHomOfEmbedding_norm_restriction_apply -+ _ = ((AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K)) σE := -+ congrArg -+ ((AlgEquiv.restrictNormalHom L).comp -+ (AlgEquiv.restrictScalarsHom K)) hupper -+ _ = restriction σE := rfl -+ _ = σK := hrestrict -+ exact ⟨z, hlocal, hglobal⟩ -+ -+ -+/-- Every genuine finite-place decomposition automorphism has a -+compatible embedded absolute lift with the same finite quotient class -+and positive integral cyclotomic `p`-adic degree. -/ -+theorem exists_numberFieldTowerFinitePadicLift_of_finitePlace -+ (v : HeightOneSpectrum (𝓞 K)) -+ (p : Nat.Primes) -+ (σ : -+ absoluteValueDecompositionGroup K -+ (chosenFinitePlaceExtension (L := L) v).1) : -+ letI _ : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ letI _ : Algebra L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureTopAlgebra L -+ letI _ : IsScalarTower K L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureScalarTower K L -+ ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) = -+ σ.1 ∧ -+ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -+ absoluteValueDecompositionGroup K -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v -+ (chosenFinitePlaceExtension (L := L) v)).1 ∧ -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ ≠ -+ 1 ∧ -+ ∃ n : ℕ, 0 < n ∧ -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ = -+ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by -+ let : Algebra K (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureBaseAlgebra K L -+ let : Algebra L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureTopAlgebra L -+ let : IsScalarTower K L (SeparableClosure ℚ) := -+ numberFieldTowerSeparableClosureScalarTower K L -+ obtain ⟨τΩ, hτΩrestrict, n, hn, hτΩdegree⟩ := -+ exists_finitePlaceSeparableClosureLift_with_positivePadicCyclotomicDegree -+ (K := K) (L := L) v p σ -+ let τ : -+ (numberFieldTowerBaseSubgroup K L).toSubgroup := -+ numberFieldTowerSeparableClosureEquivBaseSubgroup -+ K L τΩ.1 -+ have hfinite : -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (numberFieldTowerFiniteQuotientCoordinate -+ (K := K) (L := L) τ) = -+ σ.1 := by -+ change -+ numberFieldTowerExtensionQuotientEquivGaloisGroup K L -+ (QuotientGroup.mk -+ (numberFieldTowerSeparableClosureEquivBaseSubgroup -+ K L τΩ.1)) = -+ σ.1 -+ rw [ -+ numberFieldTowerExtensionQuotientEquivGaloisGroup_mk_baseSubgroupEquiv] -+ exact congrArg Subtype.val hτΩrestrict -+ have hdegree : -+ numberFieldTowerBaseSubgroupPadicCyclotomicDegree -+ (K := K) (L := L) p τ = -+ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by -+ exact hτΩdegree -+ have hdecomposition : -+ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ -+ absoluteValueDecompositionGroup K -+ (numberFieldTowerFinitePlaceExtensionToSeparableClosure -+ K L v -+ (chosenFinitePlaceExtension (L := L) v)).1 := by -+ simpa only [τ, MulEquiv.symm_apply_apply] using τΩ.2 -+ refine -+ ⟨τ, hfinite, hdecomposition, ?_, n, hn, hdegree⟩ -+ rw [hdegree] -+ exact -+ PadicInt.multiplicative_positiveNatDegree_ne_one -+ p.1 n hn -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityBase.lean -new file mode 100644 -index 0000000..e5057a1 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityBase.lean -@@ -0,0 +1,488 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.HilbertProductFormula -+import ClassFieldTheory.AlgebraicNumberTheory.PowerResidueSymbols.Ideal -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormApproximation.FinitePlaces -+import Mathlib.NumberTheory.Padics.HeightOneSpectrum -+import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicField -+import ClassFieldTheory.AlgebraicNumberTheory.QuadraticReciprocity -+import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Rational -+import ClassFieldTheory.LocalClassFieldTheory.Kummer.PowerResidueTameFormula -+import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.IdealQuotients -+import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion -+import ValuedFieldTheory.Valuation.Completion.ExtensionInvariants -+import ClassFieldTheory.KummerTheory.Concrete.SimpleExtensionLocalBehavior -+import ClassFieldTheory.KummerTheory.Concrete.SUnitPreparation.FiniteRadicalSupport -+import ClassFieldTheory.LocalClassFieldTheory.Finite.CyclotomicNorm.PrincipalUnits -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped BigOperators Classical NumberField NumberTheorySymbols ValuativeRel WithZero -+open NumberField IsDedekindDomain -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open KummerTheory -+open AlgebraicNumberTheory.PowerResidueSymbols -+open LocalClassFieldTheory.Kummer -+open LocalFieldTheory -+open LocalFieldTheory.IsNonarchimedeanLocalField -+ -+variable (K : Type) [Field K] [NumberField K] -+ -+/-- Equality for the valuation used to define a valuative relation transports -+to equality in the relation's canonical value group. -/ -+theorem canonicalValuation_eq_of_valuation_eq -+ {R Γ : Type*} [Ring R] [LinearOrderedCommGroupWithZero Γ] -+ (v : Valuation R Γ) (x y : R) (hxy : v x = v y) : -+ letI : ValuativeRel R := ValuativeRel.ofValuation v -+ ValuativeRel.valuation R x = ValuativeRel.valuation R y := by -+ let : ValuativeRel R := ValuativeRel.ofValuation v -+ change -+ ValuativeRel.ValueGroupWithZero.mk x 1 = -+ ValuativeRel.ValueGroupWithZero.mk y 1 -+ rw [ValuativeRel.ValueGroupWithZero.mk_eq_mk] -+ constructor -+ · change v (x * (1 : R)) ≤ v (y * (1 : R)) -+ simpa only [mul_one] using hxy.le -+ · change v (y * (1 : R)) ≤ v (x * (1 : R)) -+ simpa only [mul_one] using hxy.ge -+ -+/-- The bounded-natural-number form of nonarchimedeanness for a finite-place -+absolute value. Naming this bridge keeps all completion residue constructions -+on one proof-irrelevant provider. -/ -+private theorem finitePlaceAdicAbv_nonarchimedeanAbsoluteValue -+ (v : HeightOneSpectrum (𝓞 K)) : -+ LubinTate.Valuations.NonarchimedeanAbsoluteValue -+ (HeightOneSpectrum.adicAbv K v) := -+ (AbsoluteValue.isNonarchimedean_iff_bounded_nat -+ (HeightOneSpectrum.adicAbv K v)).1 -+ (HeightOneSpectrum.isNonarchimedean_adicAbv K v) -+ -+/-- Finite-field power-residue symbols commute with a field equivalence. -+The statement is made on underlying units so it can be reused with every -+roots-of-unity transport occurring below. -/ -+theorem finiteFieldPowerResidueSymbol_unitsMap_ringEquiv -+ {k l : Type*} [Field k] [Field l] [Fintype k] [Fintype l] -+ (e : k ≃+* l) (n : ℕ+) -+ (hnk : (n : ℕ) ∣ Fintype.card k - 1) -+ (hnl : (n : ℕ) ∣ Fintype.card l - 1) -+ (u : kˣ) : -+ Units.map e.toMonoidHom -+ ((AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol -+ k n hnk u : -+ rootsOfUnity (n : ℕ) k) : kˣ) = -+ ((AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol -+ l n hnl -+ (Units.map e.toMonoidHom u) : -+ rootsOfUnity (n : ℕ) l) : lˣ) := by -+ rw [ -+ AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol_apply, -+ AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol_apply, -+ map_pow] -+ rw [Fintype.card_congr e.toEquiv] -+ -+/-- The residue field of a finite-place completion is canonically the -+prime-ideal residue field. The construction passes through the localization -+at the prime and then through the residue equivalence induced by completion. -/ -+noncomputable def finitePlacePrimeResidueEquivLocalResidue -+ (v : HeightOneSpectrum (𝓞 K)) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ (𝓞 K ⧸ v.asIdeal) ≃+* 𝓀[C] := by -+ let a := HeightOneSpectrum.adicAbv K v -+ let ha : LubinTate.Valuations.NonarchimedeanAbsoluteValue a := -+ finitePlaceAdicAbv_nonarchimedeanAbsoluteValue K v -+ let C := a.Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ let V := LubinTate.Valuations.exponentialValuationSubring -+ (AlgebraicNumberTheory.Valuations.absoluteValueExponentialValuation a ha) -+ let aC := AbsoluteValue.completionAbsoluteValue a -+ let haC : LubinTate.Valuations.NonarchimedeanAbsoluteValue aC := -+ (AbsoluteValue.isNonarchimedean_iff_bounded_nat aC).1 -+ (AbsoluteValue.completionAbsoluteValue_isNonarchimedean a -+ ((AbsoluteValue.isNonarchimedean_iff_bounded_nat a).2 ha)) -+ let VC := LubinTate.Valuations.exponentialValuationSubring -+ (AlgebraicNumberTheory.Valuations.absoluteValueExponentialValuation aC haC) -+ let Rv := v.valuationSubringAtPrime K -+ letI : IsLocalRing Rv := -+ IsLocalization.AtPrime.isLocalRing Rv v.asIdeal -+ have hBase : Rv.toSubring = V := by -+ ext x -+ rw [AlgebraicNumberTheory.Valuations.mem_absoluteValueExponentialSubring_iff] -+ change x ∈ v.valuationSubringAtPrime K ↔ _ -+ rw [v.valuationSubringAtPrime_eq_valuationSubring] -+ change v.valuation K x ≤ 1 ↔ a x ≤ 1 -+ rw [HeightOneSpectrum.adicAbv_def] -+ exact_mod_cast -+ (WithZeroMulInt.toNNReal_le_one_iff -+ (HeightOneSpectrum.one_lt_absNorm_nnreal v)).symm -+ let eBase : Rv ≃+* V := RingEquiv.subringCongr hBase -+ have hCompletion : VC = 𝒪[C] := by -+ ext x -+ rw [AlgebraicNumberTheory.Valuations.mem_absoluteValueExponentialSubring_iff] -+ change ‖x‖ ≤ 1 ↔ x ∈ 𝒪[C] -+ exact -+ (finitePlaceCompletion_mem_integers_iff_norm_le_one -+ a (HeightOneSpectrum.isNonarchimedean_adicAbv K v) x).symm -+ let eCompletionRing : VC ≃+* 𝒪[C] := -+ RingEquiv.subringCongr hCompletion -+ let eIdeal : (𝓞 K ⧸ v.asIdeal) ≃+* v.asIdeal.ResidueField := -+ RingEquiv.ofBijective -+ (algebraMap (𝓞 K ⧸ v.asIdeal) v.asIdeal.ResidueField) -+ v.asIdeal.bijective_algebraMap_quotient_residueField -+ let eLocalization : Localization.AtPrime v.asIdeal ≃ₐ[𝓞 K] Rv := -+ IsLocalization.algEquiv v.asIdeal.primeCompl _ _ -+ exact -+ eIdeal |>.trans -+ (IsLocalRing.ResidueField.mapEquiv eLocalization.toRingEquiv) |>.trans -+ (IsLocalRing.ResidueField.mapEquiv eBase) |>.trans -+ (AlgebraicNumberTheory.Valuations.completionResidueEquiv a ha) |>.trans -+ (IsLocalRing.ResidueField.mapEquiv eCompletionRing) -+ -+/-- The image of an algebraic integer in the valuation ring of a finite-place -+completion. -/ -+noncomputable def finitePlaceIntegralCompletionElement -+ (v : HeightOneSpectrum (𝓞 K)) (x : 𝓞 K) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ 𝒪[C] := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ exact ⟨algebraMap K C (x : K), by -+ rw [finitePlaceCompletion_mem_integers_iff_norm_le_one -+ (HeightOneSpectrum.adicAbv K v) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv K v)] -+ calc -+ ‖algebraMap K C (x : K)‖ = -+ HeightOneSpectrum.adicAbv K v (x : K) := -+ AbsoluteValue.completionAbsoluteValue_coe -+ (HeightOneSpectrum.adicAbv K v) (x : K) -+ _ ≤ 1 := -+ v.adicAbv_coe_le_one -+ (HeightOneSpectrum.one_lt_absNorm_nnreal v) x⟩ -+ -+/-- The finite-place integral element has the expected underlying completion -+value. -/ -+@[simp] -+theorem finitePlaceIntegralCompletionElement_coe -+ (v : HeightOneSpectrum (𝓞 K)) (x : 𝓞 K) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ (finitePlaceIntegralCompletionElement K v x : C) = -+ algebraMap K C (x : K) := -+ rfl -+ -+/-- The finite-place residue equivalence sends the class of an algebraic -+integer to the residue of its canonical image in the completion. -/ -+@[simp] -+theorem finitePlacePrimeResidueEquivLocalResidue_mk -+ (v : HeightOneSpectrum (𝓞 K)) (x : 𝓞 K) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ finitePlacePrimeResidueEquivLocalResidue K v -+ (Ideal.Quotient.mk v.asIdeal x) = -+ IsLocalRing.residue 𝒪[C] -+ (finitePlaceIntegralCompletionElement K v x) := by -+ simp only [finitePlacePrimeResidueEquivLocalResidue, -+ finitePlaceIntegralCompletionElement, RingEquiv.trans_apply] -+ rw [RingEquiv.ofBijective_apply, -+ Ideal.algebraMap_quotient_residueField_mk] -+ rw [IsScalarTower.algebraMap_apply -+ (NumberField.RingOfIntegers K) (Localization.AtPrime v.asIdeal)] -+ rw [IsLocalRing.ResidueField.algebraMap_eq] -+ simp only [IsLocalRing.ResidueField.mapEquiv_apply, -+ IsLocalRing.ResidueField.map_residue] -+ rw [AlgebraicNumberTheory.Valuations.completionResidueEquiv_residue] -+ simp only [IsLocalRing.ResidueField.map_residue] -+ congr 1 -+ apply Subtype.ext -+ change -+ algebraMap K (HeightOneSpectrum.adicAbv K v).Completion -+ (((IsLocalization.algEquiv v.asIdeal.primeCompl -+ (Localization.AtPrime v.asIdeal) -+ (v.valuationSubringAtPrime K)) -+ (algebraMap (𝓞 K) (Localization.AtPrime v.asIdeal) x) : -+ v.valuationSubringAtPrime K) : K) = -+ algebraMap K (HeightOneSpectrum.adicAbv K v).Completion (x : K) -+ rw [AlgEquiv.commutes] -+ rw [IsScalarTower.algebraMap_apply -+ (NumberField.RingOfIntegers K) (v.valuationSubringAtPrime K)] -+ rfl -+ -+/-- A nonzero algebraic integer, regarded as a global field unit. -/ -+def nonzeroIntegralFieldUnit (x : 𝓞 K) (hx : x ≠ 0) : Kˣ := -+ Units.mk0 (x : K) (by -+ intro hxK -+ apply hx -+ apply Subtype.ext -+ exact hxK) -+ -+omit [NumberField K] in -+@[simp] -+theorem nonzeroIntegralFieldUnit_coe (x : 𝓞 K) (hx : x ≠ 0) : -+ ((nonzeroIntegralFieldUnit K x hx : Kˣ) : K) = (x : K) := -+ rfl -+ -+/-- An algebraic integer avoiding a prime ideal, regarded as a nonzero -+element of the global field. -/ -+noncomputable def primeAvoidingIntegralFieldUnit -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : Kˣ := -+ nonzeroIntegralFieldUnit K x (by -+ intro hx0 -+ apply hx -+ rw [hx0] -+ exact Ideal.zero_mem _) -+ -+omit [NumberField K] in -+@[simp] -+theorem primeAvoidingIntegralFieldUnit_coe -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : -+ ((primeAvoidingIntegralFieldUnit K v x hx : Kˣ) : K) = (x : K) := -+ rfl -+ -+/-- An algebraic integer nonzero modulo `v`, regarded as a unit of the -+valuation ring of the finite-place completion. -/ -+noncomputable def finitePlaceIntegralCompletionUnit -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ 𝒪[C]ˣ := by -+ let a := HeightOneSpectrum.adicAbv K v -+ let C := a.Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ let y : C := algebraMap K C (x : K) -+ have hyNorm : ‖y‖ = 1 := by -+ calc -+ ‖y‖ = a (x : K) := -+ AbsoluteValue.completionAbsoluteValue_coe a (x : K) -+ _ = ‖NumberField.FinitePlace.embedding v (x : K)‖ := -+ (NumberField.FinitePlace.norm_embedding v (x : K)).symm -+ _ = 1 := -+ (NumberField.FinitePlace.norm_eq_one_iff_notMem K v x).2 hx -+ have hyNe : y ≠ 0 := by -+ intro hy -+ rw [hy, norm_zero] at hyNorm -+ exact zero_ne_one hyNorm -+ let yIntegral : 𝒪[C] := ⟨y, by -+ rw [finitePlaceCompletion_mem_integers_iff_norm_le_one -+ a (HeightOneSpectrum.isNonarchimedean_adicAbv K v)] -+ exact hyNorm.le⟩ -+ let yInvIntegral : 𝒪[C] := ⟨y⁻¹, by -+ rw [finitePlaceCompletion_mem_integers_iff_norm_le_one -+ a (HeightOneSpectrum.isNonarchimedean_adicAbv K v), -+ norm_inv, hyNorm, inv_one]⟩ -+ exact { -+ val := yIntegral -+ inv := yInvIntegral -+ val_inv := by -+ apply Subtype.ext -+ exact mul_inv_cancel₀ hyNe -+ inv_val := by -+ apply Subtype.ext -+ exact inv_mul_cancel₀ hyNe } -+ -+/-- Forgetting the integral-unit structure recovers the ordinary image of -+the algebraic integer in the finite-place completion. -/ -+@[simp] -+theorem finitePlaceIntegralCompletionUnit_coe -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ (((finitePlaceIntegralCompletionUnit K v x hx : 𝒪[C]ˣ) : 𝒪[C]) : C) = -+ algebraMap K C (x : K) := by -+ rfl -+ -+/-- The completion image of a prime-avoiding algebraic integer is the field -+unit underlying its canonical valuation-ring unit. -/ -+theorem finitePlaceHilbert_completionUnit_primeAvoidingIntegralFieldUnit -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ finitePlaceHilbert_completionUnit K v -+ (primeAvoidingIntegralFieldUnit K v x hx) = -+ integerUnitsToFieldUnits C -+ (finitePlaceIntegralCompletionUnit K v x hx) := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ let : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ let : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ dsimp only -+ apply Units.ext -+ change -+ algebraMap K C (x : K) = -+ (((finitePlaceIntegralCompletionUnit K v x hx : 𝒪[C]ˣ) : -+ 𝒪[C]) : C) -+ exact (finitePlaceIntegralCompletionUnit_coe K v x hx).symm -+ -+/-- As an element of the completion valuation ring, the lifted unit is the -+canonical lifted algebraic integer. -/ -+@[simp] -+theorem finitePlaceIntegralCompletionUnit_val -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ (finitePlaceIntegralCompletionUnit K v x hx : 𝒪[C]) = -+ finitePlaceIntegralCompletionElement K v x := by -+ dsimp only -+ apply Subtype.ext -+ exact finitePlaceIntegralCompletionUnit_coe K v x hx -+ -+/-- Reduction of the canonical completion unit agrees with reduction modulo -+the corresponding global prime ideal. -/ -+theorem finitePlace_integerUnitsToResidueUnits_integralUnit -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ integerUnitsToResidueUnits C -+ (finitePlaceIntegralCompletionUnit K v x hx) = -+ Units.map -+ (finitePlacePrimeResidueEquivLocalResidue K v).toMonoidHom -+ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealResidueUnit -+ K v x hx) := by -+ dsimp only -+ apply Units.ext -+ change -+ IsLocalRing.residue 𝒪[(HeightOneSpectrum.adicAbv K v).Completion] -+ (finitePlaceIntegralCompletionUnit K v x hx : -+ 𝒪[(HeightOneSpectrum.adicAbv K v).Completion]) = -+ finitePlacePrimeResidueEquivLocalResidue K v -+ (Ideal.Quotient.mk v.asIdeal x) -+ simpa only [finitePlaceIntegralCompletionUnit_val] using -+ (finitePlacePrimeResidueEquivLocalResidue_mk K v x).symm -+ -+/-- The canonical inclusion from integral roots of unity into the common -+field-valued group used by the global Hilbert symbols. -/ -+def integralRootsOfUnityToNthRoots -+ (n : ℕ) : -+ rootsOfUnity n (𝓞 K) →* nthRootsSubgroup K n where -+ toFun z := -+ ⟨Units.map (algebraMap (𝓞 K) K).toMonoidHom z.1, by -+ calc -+ Units.map (algebraMap (𝓞 K) K).toMonoidHom z.1 ^ n = -+ Units.map (algebraMap (𝓞 K) K).toMonoidHom (z.1 ^ n) := -+ (map_pow -+ (Units.map (algebraMap (𝓞 K) K).toMonoidHom) z.1 n).symm -+ _ = 1 := by rw [z.2, map_one]⟩ -+ map_one' := by -+ apply Subtype.ext -+ exact map_one (Units.map (algebraMap (𝓞 K) K).toMonoidHom) -+ map_mul' := by -+ intro z w -+ apply Subtype.ext -+ exact map_mul -+ (Units.map (algebraMap (𝓞 K) K).toMonoidHom) z.1 w.1 -+ -+omit [NumberField K] in -+/-- The integral-root inclusion is the underlying unit map. -/ -+@[simp] -+theorem integralRootsOfUnityToNthRoots_apply -+ (n : ℕ) (z : rootsOfUnity n (𝓞 K)) : -+ (integralRootsOfUnityToNthRoots K n z).1 = -+ Units.map (algebraMap (𝓞 K) K).toMonoidHom z.1 := -+ rfl -+ -+omit [NumberField K] in -+/-- The integral-to-field inclusion is injective on roots of unity. -/ -+theorem integralRootsOfUnityToNthRoots_injective -+ (n : ℕ) : -+ Function.Injective (integralRootsOfUnityToNthRoots K n) := by -+ intro z w h -+ apply Subtype.ext -+ apply -+ (Units.map_injective -+ (f := (algebraMap (𝓞 K) K).toMonoidHom) -+ RingOfIntegers.coe_injective) -+ exact congrArg Subtype.val h -+ -+/-- Reduction after embedding an integral global root of unity into a -+finite-place completion is the transport of reduction modulo the -+corresponding prime ideal. -/ -+theorem finitePlace_localNthRootsReduction_integralRoots -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (z : rootsOfUnity (n : ℕ) (𝓞 K)) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ (localNthRootsReduction C n -+ (nthRootsSubgroupMap K C (n : ℕ) -+ (integralRootsOfUnityToNthRoots K (n : ℕ) z))).1 = -+ Units.map -+ (finitePlacePrimeResidueEquivLocalResidue K v).toMonoidHom -+ (AlgebraicNumberTheory.PowerResidueSymbols.rootsOfUnityReduction -+ K v (n : ℕ) z).1 := by -+ dsimp only -+ apply Units.ext -+ change -+ IsLocalRing.residue 𝒪[(HeightOneSpectrum.adicAbv K v).Completion] -+ (nthRootIntegerUnit -+ (HeightOneSpectrum.adicAbv K v).Completion n -+ (nthRootsSubgroupMap K -+ (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ) -+ (integralRootsOfUnityToNthRoots K (n : ℕ) z)) : -+ 𝒪[(HeightOneSpectrum.adicAbv K v).Completion]) = -+ finitePlacePrimeResidueEquivLocalResidue K v -+ (Ideal.Quotient.mk v.asIdeal (z.1 : 𝓞 K)) -+ rw [finitePlacePrimeResidueEquivLocalResidue_mk] -+ congr 1 -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityCorrection.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityCorrection.lean -new file mode 100644 -index 0000000..83cbaaa ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityCorrection.lean -@@ -0,0 +1,452 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.PowerResidueReciprocityLocalSymbols -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.HilbertProductFormula -+import ClassFieldTheory.AlgebraicNumberTheory.PowerResidueSymbols.Ideal -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormApproximation.FinitePlaces -+import Mathlib.NumberTheory.Padics.HeightOneSpectrum -+import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicField -+import ClassFieldTheory.AlgebraicNumberTheory.QuadraticReciprocity -+import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Rational -+import ClassFieldTheory.LocalClassFieldTheory.Kummer.PowerResidueTameFormula -+import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.IdealQuotients -+import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion -+import ValuedFieldTheory.Valuation.Completion.ExtensionInvariants -+import ClassFieldTheory.KummerTheory.Concrete.SimpleExtensionLocalBehavior -+import ClassFieldTheory.KummerTheory.Concrete.SUnitPreparation.FiniteRadicalSupport -+import ClassFieldTheory.LocalClassFieldTheory.Finite.CyclotomicNorm.PrincipalUnits -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped BigOperators Classical NumberField NumberTheorySymbols ValuativeRel WithZero -+open NumberField IsDedekindDomain -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open KummerTheory -+open AlgebraicNumberTheory.PowerResidueSymbols -+open LocalClassFieldTheory.Kummer -+open LocalFieldTheory -+open LocalFieldTheory.IsNonarchimedeanLocalField -+ -+variable (K : Type) [Field K] [NumberField K] -+/-- Prime avoidance is the common special case of the integral valuation -+formula used for numerator units. -/ -+theorem finitePlaceNormalizedValuation_primeAvoidingIntegralFieldUnit -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : -+ finitePlaceNormalizedValuation K v -+ (primeAvoidingIntegralFieldUnit K v x hx) = -+ -(AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) : ℤ) := by -+ let hx0 : x ≠ 0 := by -+ intro hxzero -+ apply hx -+ rw [hxzero] -+ exact Ideal.zero_mem _ -+ change finitePlaceNormalizedValuation K v -+ (nonzeroIntegralFieldUnit K x hx0) = _ -+ exact finitePlaceNormalizedValuation_nonzeroIntegralFieldUnit K v x hx0 -+ -+/-- Integral form of the finite-place comparison: the exponent is the -+Dedekind multiplicity in the principal denominator ideal. -/ -+theorem finitePlaceHilbertSymbol_integral_eq_primeIdealPowerResidueFactor -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) -+ (ha : a ∉ v.asIdeal) : -+ finitePlaceHilbertSymbol K n hnK hmu v -+ (nonzeroIntegralFieldUnit K a ha0) -+ (nonzeroIntegralFieldUnit K b hb0) = -+ integralRootsOfUnityToNthRoots K (n : ℕ) -+ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol -+ K v n hmu hcoprime a ha) ^ -+ AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {b}) := by -+ have haUnits : -+ nonzeroIntegralFieldUnit K a ha0 = -+ primeAvoidingIntegralFieldUnit K v a ha := by -+ apply Units.ext -+ rfl -+ rw [haUnits, -+ finitePlaceHilbertSymbol_eq_primeIdealPowerResidueFactor -+ K n hnK hmu v hv hcoprime a ha -+ (nonzeroIntegralFieldUnit K b hb0), -+ finitePlaceNormalizedValuation_nonzeroIntegralFieldUnit] -+ simp only [neg_neg, zpow_natCast] -+ -+/-- Finite-place Hilbert symbols inherit skew symmetry from the local -+Hilbert symbol in the canonical completion. -/ -+theorem finitePlaceHilbertSymbol_skew -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (v : HeightOneSpectrum (𝓞 K)) (a b : Kˣ) : -+ finitePlaceHilbertSymbol K n hnK hmu v a b = -+ (finitePlaceHilbertSymbol K n hnK hmu v b a)⁻¹ := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ let : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ let : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ apply nthRootsSubgroupMap_injective K C (n : ℕ) -+ rw [map_inv, -+ finitePlaceHilbertSymbol_map_eq_localHilbertSymbol, -+ finitePlaceHilbertSymbol_map_eq_localHilbertSymbol] -+ exact -+ localHilbertSymbol_skew C n -+ (finitePlaceHilbert_natCast_ne_zero K n hnK v) -+ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) -+ (finitePlaceHilbert_completionUnit K v a) -+ (finitePlaceHilbert_completionUnit K v b) -+ -+/-- If two nonzero algebraic integers are both units at a finite place, the -+corresponding finite-place Hilbert symbol is trivial. -/ -+theorem finitePlaceHilbertSymbol_integral_units_eq_one -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) -+ (ha : a ∉ v.asIdeal) (hb : b ∉ v.asIdeal) : -+ finitePlaceHilbertSymbol K n hnK hmu v -+ (nonzeroIntegralFieldUnit K a ha0) -+ (nonzeroIntegralFieldUnit K b hb0) = 1 := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ let : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ let : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ apply nthRootsSubgroupMap_injective K C (n : ℕ) -+ rw [map_one, finitePlaceHilbertSymbol_map_eq_localHilbertSymbol] -+ have haUnits : -+ finitePlaceHilbert_completionUnit K v -+ (nonzeroIntegralFieldUnit K a ha0) = -+ integerUnitsToFieldUnits C -+ (finitePlaceIntegralCompletionUnit K v a ha) := by -+ apply Units.ext -+ change -+ algebraMap K C (a : K) = -+ (((finitePlaceIntegralCompletionUnit K v a ha : 𝒪[C]ˣ) : -+ 𝒪[C]) : C) -+ exact (finitePlaceIntegralCompletionUnit_coe K v a ha).symm -+ have hbUnits : -+ finitePlaceHilbert_completionUnit K v -+ (nonzeroIntegralFieldUnit K b hb0) = -+ integerUnitsToFieldUnits C -+ (finitePlaceIntegralCompletionUnit K v b hb) := by -+ apply Units.ext -+ change -+ algebraMap K C (b : K) = -+ (((finitePlaceIntegralCompletionUnit K v b hb : 𝒪[C]ˣ) : -+ 𝒪[C]) : C) -+ exact (finitePlaceIntegralCompletionUnit_coe K v b hb).symm -+ unfold finitePlaceLocalHilbertSymbol -+ rw [haUnits, hbUnits] -+ exact -+ localHilbertSymbol_integerUnit_integerUnit_eq_one C n -+ (finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv) -+ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) -+ (finitePlaceIntegralCompletionUnit K v a ha) -+ (finitePlaceIntegralCompletionUnit K v b hb) -+ -+/-- Primewise comparison between the tame finite-place Hilbert factor and -+the quotient of the two ideal power-residue factors. -/ -+theorem powerResidueAwayFromExponentFiniteFactor_integral_eq_idealFactors -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) -+ (hcoprimeA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → -+ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) -+ (hcoprimeB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → -+ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) -+ (haB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → a ∉ P.asIdeal) -+ (hbA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → b ∉ P.asIdeal) -+ (hAwayA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → -+ P ∉ powerResidueExponentFinitePlaces K n) -+ (hAwayB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → -+ P ∉ powerResidueExponentFinitePlaces K n) -+ (P : HeightOneSpectrum (𝓞 K)) : -+ (if P ∈ powerResidueExponentFinitePlaces K n then -+ 1 -+ else -+ finitePlaceHilbertSymbol K n hnK hmu P -+ (nonzeroIntegralFieldUnit K a ha0) -+ (nonzeroIntegralFieldUnit K b hb0)) = -+ integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueFactor K (Ideal.span {b}) n hmu a -+ hcoprimeB haB P) * -+ (integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueFactor K (Ideal.span {a}) n hmu b -+ hcoprimeA hbA P))⁻¹ := by -+ by_cases hPExponent : P ∈ powerResidueExponentFinitePlaces K n -+ · have hPA : ¬ P.asIdeal ∣ Ideal.span {a} := by -+ intro hPA -+ exact (hAwayA P hPA) hPExponent -+ have hPB : ¬ P.asIdeal ∣ Ideal.span {b} := by -+ intro hPB -+ exact (hAwayB P hPB) hPExponent -+ simp only [ite_eq_left hPExponent, idealPowerResidueFactor, -+ dite_eq_right hPA, dite_eq_right hPB, map_one, inv_one, mul_one] -+ · rw [ite_eq_right hPExponent] -+ by_cases hPB : P.asIdeal ∣ Ideal.span {b} -+ · have haP : a ∉ P.asIdeal := haB P hPB -+ have hPA : ¬ P.asIdeal ∣ Ideal.span {a} := by -+ intro hPA -+ apply haP -+ rw [← Ideal.dvd_span_singleton] -+ exact hPA -+ rw [finitePlaceHilbertSymbol_integral_eq_primeIdealPowerResidueFactor -+ K n hnK hmu P (hAwayB P hPB) (hcoprimeB P hPB) -+ a b ha0 hb0 haP] -+ simp only [idealPowerResidueFactor, dite_eq_left hPB, dite_eq_right hPA, -+ map_pow, map_one, inv_one, mul_one] -+ · by_cases hPA : P.asIdeal ∣ Ideal.span {a} -+ · have hbP : b ∉ P.asIdeal := hbA P hPA -+ rw [finitePlaceHilbertSymbol_skew K n hnK hmu] -+ rw [finitePlaceHilbertSymbol_integral_eq_primeIdealPowerResidueFactor -+ K n hnK hmu P (hAwayA P hPA) (hcoprimeA P hPA) -+ b a hb0 ha0 hbP] -+ simp only [idealPowerResidueFactor, dite_eq_right hPB, dite_eq_left hPA, -+ map_pow, map_one, one_mul] -+ · have haP : a ∉ P.asIdeal := by -+ intro haMem -+ apply hPA -+ rw [Ideal.dvd_span_singleton] -+ exact haMem -+ have hbP : b ∉ P.asIdeal := by -+ intro hbMem -+ apply hPB -+ rw [Ideal.dvd_span_singleton] -+ exact hbMem -+ rw [finitePlaceHilbertSymbol_integral_units_eq_one -+ K n hnK hmu P hPExponent a b ha0 hb0 haP hbP] -+ simp only [idealPowerResidueFactor, dite_eq_right hPB, dite_eq_right hPA, -+ map_one, inv_one, mul_one] -+ -+/-- A concrete finite set containing every finite place where a local -+power-residue factor of `a` and `b` may be nontrivial. Its exponent part is -+the exact set of prime divisors of `(n)`. -/ -+noncomputable def powerResidueBadFinitePlaces -+ (n : ℕ+) (a b : Kˣ) : -+ Finset (HeightOneSpectrum (𝓞 K)) := -+ (chosenUnitFiniteSupport (K := K) a ∪ -+ chosenUnitFiniteSupport (K := K) b) ∪ -+ powerResidueExponentFinitePlaces K n -+ -+/-- The explicit bad-place correction in power-residue reciprocity. Every -+factor already lies in the common group `nthRootsSubgroup K n`. -/ -+noncomputable def powerResidueBadPlaceCorrection -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) : -+ nthRootsSubgroup K (n : ℕ) := -+ (∏ v : InfinitePlace K, -+ infinitePlaceHilbertSymbol K n v a b) * -+ (∏ v ∈ powerResidueExponentFinitePlaces K n, -+ finitePlaceHilbertSymbol K n hnK hmu v a b) -+ -+private theorem valuation_eq_one_of_not_mem_chosenUnitFiniteSupport -+ (x : Kˣ) (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ chosenUnitFiniteSupport (K := K) x) : -+ v.valuation K (x : K) = 1 := -+ (mem_SUnitGroup_iff (K := K) -+ (chosenUnitFiniteSupport (K := K) x) x).mp -+ (mem_sUnitGroup_chosenUnitFiniteSupport (K := K) x) v hv -+ -+/-- The finite-place Hilbert symbol is trivial when the exponent and both -+global arguments are units at this place. -/ -+theorem finitePlaceHilbertSymbol_eq_one_of_valuation_eq_one -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) (v : HeightOneSpectrum (𝓞 K)) -+ (hva : v.valuation K (a : K) = 1) -+ (hvb : v.valuation K (b : K) = 1) -+ (hvn : v.valuation K ((n : ℕ) : K) = 1) : -+ finitePlaceHilbertSymbol K n hnK hmu v a b = 1 := by -+ let L := chosenSimpleKummerExtension K n hnK b -+ let : FiniteDimensional K L := -+ chosenSimpleKummerExtension_finiteDimensional K n hnK b -+ let : IsAbelianGalois K L := -+ chosenSimpleKummerExtension_isAbelianGalois K n hnK hmu b -+ let : NumberField L := NumberField.of_module_finite K L -+ have haIntegral : -+ IdeleGroup.finiteComponent v (IdeleGroup.principalIdele K a) ∈ -+ (v.adicCompletionIntegers K).units := by -+ rw [HeightOneSpectrum.adicCompletionIntegers.mem_units_iff_valued_eq_one] -+ rw [IdeleGroup.finiteComponent_principalIdele, -+ HeightOneSpectrum.valuedAdicCompletion_eq_valuation'] -+ exact hva -+ have hUnramified : -+ Algebra.IsUnramifiedAt (𝓞 K) -+ (finitePlaceExtensionCentre -+ (K := K) (L := L) v -+ (chosenFinitePlaceExtension (L := L) v)).asIdeal := by -+ apply -+ chosenSimpleKummerExtension_isUnramifiedAt_at_all_finitePlacesAbove_of_valuation_eq_one -+ (K := K) n hnK hmu b v hvb hvn -+ exact -+ finitePlaceBelow_finitePlaceExtensionCentre -+ (K := K) (L := L) v -+ (chosenFinitePlaceExtension (L := L) v) -+ have hArtin : -+ chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v -+ (IdeleGroup.finiteComponent v (IdeleGroup.principalIdele K a)) = 1 := -+ chosenFinitePlaceArtinMonoidHom_eq_one_of_integral_of_unramifiedAt -+ (K := K) (L := L) v (IdeleGroup.principalIdele K a) -+ haIntegral hUnramified -+ rw [← finitePlaceKummerRootCharacter_localGlobal K n hnK hmu v a b] -+ unfold finitePlaceKummerRootCharacter -+ unfold finitePlaceKummerRootCharacterOfExtension -+ have hcomponent : -+ (IdeleGroup.finiteComponent v (IdeleGroup.principalIdele K a) : -+ (v.adicCompletion K)ˣ) = -+ Units.map (algebraMap K (v.adicCompletion K)).toMonoidHom a := by -+ apply Units.ext -+ calc -+ ((IdeleGroup.finiteComponent v (IdeleGroup.principalIdele K a) : -+ (v.adicCompletion K)ˣ) : v.adicCompletion K) = -+ ((a : K) : v.adicCompletion K) := -+ IdeleGroup.finiteComponent_principalIdele a v -+ _ = algebraMap K (v.adicCompletion K) (a : K) := by -+ symm -+ have hmap := congrFun -+ (IsDedekindDomain.HeightOneSpectrum.algebraMap_adicCompletion -+ (R := 𝓞 K) (S := K) (K := K) (v := v)) (a : K) -+ simpa using hmap -+ rw [hcomponent] at hArtin -+ unfold chosenFinitePlaceArtinMonoidHom at hArtin -+ dsimp only at hArtin ⊢ -+ rw [hArtin, map_one, map_one] -+ -+/-- Outside the concrete bad-place set, the finite-place Hilbert factor is -+trivial. -/ -+theorem finitePlaceHilbertSymbol_eq_one_of_not_mem_powerResidueBadFinitePlaces -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ powerResidueBadFinitePlaces K n a b) : -+ finitePlaceHilbertSymbol K n hnK hmu v a b = 1 := by -+ have hvaSupport : v ∉ chosenUnitFiniteSupport (K := K) a := by -+ intro hva -+ apply hv -+ exact Finset.mem_union_left _ (Finset.mem_union_left _ hva) -+ have hvbSupport : v ∉ chosenUnitFiniteSupport (K := K) b := by -+ intro hvb -+ apply hv -+ exact Finset.mem_union_left _ (Finset.mem_union_right _ hvb) -+ have hvnSupport : -+ v ∉ powerResidueExponentFinitePlaces K n := by -+ intro hvn -+ apply hv -+ exact Finset.mem_union_right _ hvn -+ have hva : v.valuation K (a : K) = 1 := -+ valuation_eq_one_of_not_mem_chosenUnitFiniteSupport K a v hvaSupport -+ have hvb : v.valuation K (b : K) = 1 := -+ valuation_eq_one_of_not_mem_chosenUnitFiniteSupport K b v hvbSupport -+ have hvn : v.valuation K ((n : ℕ) : K) = 1 := by -+ have hvnNotDvd : -+ ¬ v.asIdeal ∣ powerResidueExponentIdeal K n := by -+ simpa only [mem_powerResidueExponentFinitePlaces_iff] using hvnSupport -+ have hvnNotMem : ((n : ℕ) : 𝓞 K) ∉ v.asIdeal := by -+ intro hvnMem -+ apply hvnNotDvd -+ rw [powerResidueExponentIdeal, Ideal.dvd_span_singleton] -+ exact hvnMem -+ simpa only [map_natCast] using -+ (v.valuation_eq_one_iff_notMem (K := K) -+ (r := ((n : ℕ) : 𝓞 K))).2 hvnNotMem -+ exact finitePlaceHilbertSymbol_eq_one_of_valuation_eq_one -+ K n hnK hmu a b v hva hvb hvn -+ -+/-- The multiplicative support of the finite-place Hilbert factors is -+contained in the explicit power-residue bad-place set. -/ -+theorem finitePlaceHilbertSymbol_mulSupport_subset_powerResidueBadFinitePlaces -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) : -+ Function.mulSupport -+ (fun v : HeightOneSpectrum (𝓞 K) => -+ finitePlaceHilbertSymbol K n hnK hmu v a b) ⊆ -+ (powerResidueBadFinitePlaces K n a b : -+ Set (HeightOneSpectrum (𝓞 K))) := by -+ intro v hv -+ change finitePlaceHilbertSymbol K n hnK hmu v a b ≠ 1 at hv -+ change v ∈ powerResidueBadFinitePlaces K n a b -+ by_contra hvBad -+ exact hv -+ (finitePlaceHilbertSymbol_eq_one_of_not_mem_powerResidueBadFinitePlaces -+ K n hnK hmu a b v hvBad) -+ -+/-- The finite-place Hilbert `finprod` is the ordinary product over the -+explicit bad-place set. -/ -+theorem finitePlaceHilbertSymbol_finprod_eq_prod_powerResidueBadFinitePlaces -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) : -+ (∏ᶠ v : HeightOneSpectrum (𝓞 K), -+ finitePlaceHilbertSymbol K n hnK hmu v a b) = -+ ∏ v ∈ powerResidueBadFinitePlaces K n a b, -+ finitePlaceHilbertSymbol K n hnK hmu v a b := by -+ rw [finprod_eq_prod_of_mulSupport_subset _ -+ (finitePlaceHilbertSymbol_mulSupport_subset_powerResidueBadFinitePlaces -+ K n hnK hmu a b)] -+ -+/-- Finite-set form of the Hilbert product formula: the product over all -+explicitly bad finite places is the inverse of the infinite-place product. -/ -+theorem powerResidueBadFinitePlaces_product_eq_infinitePlaceProduct_inv -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) : -+ (∏ v ∈ powerResidueBadFinitePlaces K n a b, -+ finitePlaceHilbertSymbol K n hnK hmu v a b) = -+ (∏ v : InfinitePlace K, -+ infinitePlaceHilbertSymbol K n v a b)⁻¹ := by -+ have hproduct := -+ hilbertSymbol_allPlaces_product_eq_one K n hnK hmu a b -+ rw [ -+ finitePlaceHilbertSymbol_finprod_eq_prod_powerResidueBadFinitePlaces] -+ at hproduct -+ exact (eq_inv_iff_mul_eq_one).2 (by -+ simpa only [mul_comm] using hproduct) -+ -+/-- The product of the finite-place Hilbert factors away from primes dividing -+the exponent. C1 identifies this term with the quotient of the two ideal -+power-residue symbols; the remaining factors are exactly the correction. -/ -+noncomputable def powerResidueAwayFromExponentFiniteProduct -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) : -+ nthRootsSubgroup K (n : ℕ) := -+ ∏ᶠ v : HeightOneSpectrum (𝓞 K), -+ if v ∈ powerResidueExponentFinitePlaces K n then -+ 1 -+ else -+ finitePlaceHilbertSymbol K n hnK hmu v a b -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityGlobal.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityGlobal.lean -new file mode 100644 -index 0000000..8a60735 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityGlobal.lean -@@ -0,0 +1,416 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.PowerResidueReciprocityCorrection -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.HilbertProductFormula -+import ClassFieldTheory.AlgebraicNumberTheory.PowerResidueSymbols.Ideal -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormApproximation.FinitePlaces -+import Mathlib.NumberTheory.Padics.HeightOneSpectrum -+import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicField -+import ClassFieldTheory.AlgebraicNumberTheory.QuadraticReciprocity -+import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Rational -+import ClassFieldTheory.LocalClassFieldTheory.Kummer.PowerResidueTameFormula -+import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.IdealQuotients -+import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion -+import ValuedFieldTheory.Valuation.Completion.ExtensionInvariants -+import ClassFieldTheory.KummerTheory.Concrete.SimpleExtensionLocalBehavior -+import ClassFieldTheory.KummerTheory.Concrete.SUnitPreparation.FiniteRadicalSupport -+import ClassFieldTheory.LocalClassFieldTheory.Finite.CyclotomicNorm.PrincipalUnits -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped BigOperators Classical NumberField NumberTheorySymbols ValuativeRel WithZero -+open NumberField IsDedekindDomain -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open KummerTheory -+open AlgebraicNumberTheory.PowerResidueSymbols -+open LocalClassFieldTheory.Kummer -+open LocalFieldTheory -+open LocalFieldTheory.IsNonarchimedeanLocalField -+ -+variable (K : Type) [Field K] [NumberField K] -+/-- The complete tame finite-place product for two nonzero algebraic -+integers is the quotient of the two ideal power-residue symbols. -/ -+theorem powerResidueAwayFromExponentFiniteProduct_integral_eq_idealSymbol_div -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) -+ (hcoprimeA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → -+ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) -+ (hcoprimeB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → -+ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) -+ (haB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → a ∉ P.asIdeal) -+ (hbA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → b ∉ P.asIdeal) -+ (hAwayA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → -+ P ∉ powerResidueExponentFinitePlaces K n) -+ (hAwayB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → -+ P ∉ powerResidueExponentFinitePlaces K n) : -+ powerResidueAwayFromExponentFiniteProduct K n hnK hmu -+ (nonzeroIntegralFieldUnit K a ha0) -+ (nonzeroIntegralFieldUnit K b hb0) = -+ integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K (Ideal.span {b}) -+ (ideal_span_singleton_ne_zero K hb0) -+ n hmu a hcoprimeB haB) * -+ (integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K (Ideal.span {a}) -+ (ideal_span_singleton_ne_zero K ha0) -+ n hmu b hcoprimeA hbA))⁻¹ := by -+ let IA : Ideal (𝓞 K) := Ideal.span {a} -+ let IB : Ideal (𝓞 K) := Ideal.span {b} -+ have hIA : IA ≠ 0 := by -+ dsimp only [IA] -+ exact ideal_span_singleton_ne_zero K ha0 -+ have hIB : IB ≠ 0 := by -+ dsimp only [IB] -+ exact ideal_span_singleton_ne_zero K hb0 -+ let fB : HeightOneSpectrum (𝓞 K) → nthRootsSubgroup K (n : ℕ) := -+ fun P => integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueFactor K IB n hmu a hcoprimeB haB P) -+ let fA : HeightOneSpectrum (𝓞 K) → nthRootsSubgroup K (n : ℕ) := -+ fun P => integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueFactor K IA n hmu b hcoprimeA hbA P) -+ have hfB : Function.HasFiniteMulSupport fB := -+ (idealPowerResidueFactor_hasFiniteMulSupport -+ K IB hIB n hmu a hcoprimeB haB).subset (by -+ intro P hP -+ change fB P ≠ 1 at hP -+ change idealPowerResidueFactor K IB n hmu a hcoprimeB haB P ≠ 1 -+ intro hOne -+ exact hP (by simp only [fB, hOne, map_one])) -+ have hfA : Function.HasFiniteMulSupport fA := -+ (idealPowerResidueFactor_hasFiniteMulSupport -+ K IA hIA n hmu b hcoprimeA hbA).subset (by -+ intro P hP -+ change fA P ≠ 1 at hP -+ change idealPowerResidueFactor K IA n hmu b hcoprimeA hbA P ≠ 1 -+ intro hOne -+ exact hP (by simp only [fA, hOne, map_one])) -+ have hfAInv : -+ Function.HasFiniteMulSupport (fun P => (fA P)⁻¹) := -+ hfA.subset (by -+ intro P hP -+ change (fA P)⁻¹ ≠ 1 at hP -+ change fA P ≠ 1 -+ intro hOne -+ exact hP (by rw [hOne, inv_one])) -+ let invHom : nthRootsSubgroup K (n : ℕ) →* -+ nthRootsSubgroup K (n : ℕ) := invMonoidHom -+ have hfinprodInv : -+ (∏ᶠ P : HeightOneSpectrum (𝓞 K), (fA P)⁻¹) = -+ (∏ᶠ P : HeightOneSpectrum (𝓞 K), fA P)⁻¹ := by -+ change (∏ᶠ P : HeightOneSpectrum (𝓞 K), invHom (fA P)) = -+ invHom (∏ᶠ P : HeightOneSpectrum (𝓞 K), fA P) -+ exact (MonoidHom.map_finprod invHom hfA).symm -+ calc -+ powerResidueAwayFromExponentFiniteProduct K n hnK hmu -+ (nonzeroIntegralFieldUnit K a ha0) -+ (nonzeroIntegralFieldUnit K b hb0) = -+ ∏ᶠ P : HeightOneSpectrum (𝓞 K), fB P * (fA P)⁻¹ := by -+ apply finprod_congr -+ intro P -+ simpa only [fA, fB, IA, IB] using -+ powerResidueAwayFromExponentFiniteFactor_integral_eq_idealFactors -+ K n hnK hmu a b ha0 hb0 hcoprimeA hcoprimeB haB hbA -+ hAwayA hAwayB P -+ _ = (∏ᶠ P : HeightOneSpectrum (𝓞 K), fB P) * -+ (∏ᶠ P : HeightOneSpectrum (𝓞 K), (fA P)⁻¹) := -+ finprod_mul_distrib hfB hfAInv -+ _ = (∏ᶠ P : HeightOneSpectrum (𝓞 K), fB P) * -+ (∏ᶠ P : HeightOneSpectrum (𝓞 K), fA P)⁻¹ := by -+ rw [hfinprodInv] -+ _ = integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K IB hIB n hmu a hcoprimeB haB) * -+ (integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K IA hIA n hmu b hcoprimeA hbA))⁻¹ := by -+ rw [idealPowerResidueSymbol_eq_finprod, -+ idealPowerResidueSymbol_eq_finprod] -+ rw [MonoidHom.map_finprod -+ (integralRootsOfUnityToNthRoots K (n : ℕ)) -+ (idealPowerResidueFactor_hasFiniteMulSupport -+ K IB hIB n hmu a hcoprimeB haB), -+ MonoidHom.map_finprod -+ (integralRootsOfUnityToNthRoots K (n : ℕ)) -+ (idealPowerResidueFactor_hasFiniteMulSupport -+ K IA hIA n hmu b hcoprimeA hbA)] -+ _ = integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K (Ideal.span {b}) -+ (ideal_span_singleton_ne_zero K hb0) -+ n hmu a hcoprimeB haB) * -+ (integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K (Ideal.span {a}) -+ (ideal_span_singleton_ne_zero K ha0) -+ n hmu b hcoprimeA hbA))⁻¹ := by -+ rfl -+ -+/-- Split the full finite-place product into exponent-prime factors and the -+product away from the exponent. -/ -+theorem finitePlaceHilbertSymbol_finprod_eq_exponent_product_mul_away -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) : -+ (∏ᶠ v : HeightOneSpectrum (𝓞 K), -+ finitePlaceHilbertSymbol K n hnK hmu v a b) = -+ (∏ v ∈ powerResidueExponentFinitePlaces K n, -+ finitePlaceHilbertSymbol K n hnK hmu v a b) * -+ powerResidueAwayFromExponentFiniteProduct K n hnK hmu a b := by -+ let exponentFactor : HeightOneSpectrum (𝓞 K) → -+ nthRootsSubgroup K (n : ℕ) := fun v => -+ if v ∈ powerResidueExponentFinitePlaces K n then -+ finitePlaceHilbertSymbol K n hnK hmu v a b -+ else -+ 1 -+ let awayFactor : HeightOneSpectrum (𝓞 K) → -+ nthRootsSubgroup K (n : ℕ) := fun v => -+ if v ∈ powerResidueExponentFinitePlaces K n then -+ 1 -+ else -+ finitePlaceHilbertSymbol K n hnK hmu v a b -+ have hExponentSupport : -+ Function.mulSupport exponentFactor ⊆ -+ (powerResidueExponentFinitePlaces K n : -+ Set (HeightOneSpectrum (𝓞 K))) := by -+ intro v hv -+ change exponentFactor v ≠ 1 at hv -+ change v ∈ powerResidueExponentFinitePlaces K n -+ by_contra hvExponent -+ exact hv (by simp only [exponentFactor, ite_eq_right hvExponent]) -+ have hExponentFinite : Function.HasFiniteMulSupport exponentFactor := by -+ rw [Function.HasFiniteMulSupport] -+ exact -+ (powerResidueExponentFinitePlaces K n).finite_toSet.subset -+ hExponentSupport -+ have hAwayFinite : Function.HasFiniteMulSupport awayFactor := by -+ rw [Function.HasFiniteMulSupport] -+ exact -+ (finitePlaceHilbertSymbol_hasFiniteMulSupport K n hnK hmu a b).subset -+ (by -+ intro v hv -+ change awayFactor v ≠ 1 at hv -+ change finitePlaceHilbertSymbol K n hnK hmu v a b ≠ 1 -+ by_contra hvOne -+ exact hv (by simp only [awayFactor, hvOne, ite_self])) -+ have hPointwise : -+ (fun v : HeightOneSpectrum (𝓞 K) => -+ finitePlaceHilbertSymbol K n hnK hmu v a b) = -+ fun v => exponentFactor v * awayFactor v := by -+ funext v -+ by_cases hv : v ∈ powerResidueExponentFinitePlaces K n -+ · simp only [exponentFactor, awayFactor, ite_eq_left hv, mul_one] -+ · simp only [exponentFactor, awayFactor, ite_eq_right hv, one_mul] -+ have hExponentProduct : -+ (∏ᶠ v : HeightOneSpectrum (𝓞 K), exponentFactor v) = -+ ∏ v ∈ powerResidueExponentFinitePlaces K n, -+ finitePlaceHilbertSymbol K n hnK hmu v a b := by -+ rw [finprod_eq_prod_of_mulSupport_subset exponentFactor hExponentSupport] -+ apply Finset.prod_congr rfl -+ intro v hv -+ simp only [exponentFactor, ite_eq_left hv] -+ calc -+ (∏ᶠ v : HeightOneSpectrum (𝓞 K), -+ finitePlaceHilbertSymbol K n hnK hmu v a b) = -+ ∏ᶠ v : HeightOneSpectrum (𝓞 K), -+ exponentFactor v * awayFactor v := by -+ rw [hPointwise] -+ _ = (∏ᶠ v : HeightOneSpectrum (𝓞 K), exponentFactor v) * -+ (∏ᶠ v : HeightOneSpectrum (𝓞 K), awayFactor v) := -+ finprod_mul_distrib hExponentFinite hAwayFinite -+ _ = (∏ v ∈ powerResidueExponentFinitePlaces K n, -+ finitePlaceHilbertSymbol K n hnK hmu v a b) * -+ (∏ᶠ v : HeightOneSpectrum (𝓞 K), awayFactor v) := by -+ rw [hExponentProduct] -+ _ = (∏ v ∈ powerResidueExponentFinitePlaces K n, -+ finitePlaceHilbertSymbol K n hnK hmu v a b) * -+ powerResidueAwayFromExponentFiniteProduct K n hnK hmu a b := by -+ rfl -+ -+/-- General Hilbert-product core of power-residue reciprocity. The complete -+finite product away from the exponent is the inverse of the explicit product -+of all infinite-place factors and all exponent-prime factors. -/ -+theorem powerResidueAwayFromExponentFiniteProduct_eq_badPlaceCorrection_inv -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : Kˣ) : -+ powerResidueAwayFromExponentFiniteProduct K n hnK hmu a b = -+ (powerResidueBadPlaceCorrection K n hnK hmu a b)⁻¹ := by -+ have hproduct := -+ hilbertSymbol_allPlaces_product_eq_one K n hnK hmu a b -+ rw [finitePlaceHilbertSymbol_finprod_eq_exponent_product_mul_away] -+ at hproduct -+ exact (eq_inv_iff_mul_eq_one).2 (by -+ unfold powerResidueBadPlaceCorrection -+ simpa only [mul_assoc, mul_comm, mul_left_comm] using hproduct) -+ -+/-- General ideal power-residue reciprocity with the explicit product of -+infinite and exponent-prime Hilbert factors as correction. -/ -+theorem idealPowerResidueSymbol_reciprocity_with_bad_place_correction -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) -+ (hcoprimeA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → -+ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) -+ (hcoprimeB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → -+ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) -+ (haB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → a ∉ P.asIdeal) -+ (hbA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → b ∉ P.asIdeal) -+ (hAwayA : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {a} → -+ P ∉ powerResidueExponentFinitePlaces K n) -+ (hAwayB : -+ ∀ P : HeightOneSpectrum (𝓞 K), -+ P.asIdeal ∣ Ideal.span {b} → -+ P ∉ powerResidueExponentFinitePlaces K n) : -+ integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K (Ideal.span {b}) -+ (ideal_span_singleton_ne_zero K hb0) -+ n hmu a hcoprimeB haB) = -+ (powerResidueBadPlaceCorrection K n hnK hmu -+ (nonzeroIntegralFieldUnit K a ha0) -+ (nonzeroIntegralFieldUnit K b hb0))⁻¹ * -+ integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K (Ideal.span {a}) -+ (ideal_span_singleton_ne_zero K ha0) -+ n hmu b hcoprimeA hbA) := by -+ let symbolAB := integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K (Ideal.span {b}) -+ (ideal_span_singleton_ne_zero K hb0) -+ n hmu a hcoprimeB haB) -+ let symbolBA := integralRootsOfUnityToNthRoots K (n : ℕ) -+ (idealPowerResidueSymbol K (Ideal.span {a}) -+ (ideal_span_singleton_ne_zero K ha0) -+ n hmu b hcoprimeA hbA) -+ let correction := powerResidueBadPlaceCorrection K n hnK hmu -+ (nonzeroIntegralFieldUnit K a ha0) -+ (nonzeroIntegralFieldUnit K b hb0) -+ have hIdeal := -+ powerResidueAwayFromExponentFiniteProduct_integral_eq_idealSymbol_div -+ K n hnK hmu a b ha0 hb0 hcoprimeA hcoprimeB haB hbA -+ hAwayA hAwayB -+ have hCorrection := -+ powerResidueAwayFromExponentFiniteProduct_eq_badPlaceCorrection_inv -+ K n hnK hmu -+ (nonzeroIntegralFieldUnit K a ha0) -+ (nonzeroIntegralFieldUnit K b hb0) -+ have hQuotient : symbolAB * symbolBA⁻¹ = correction⁻¹ := by -+ rw [← hIdeal, hCorrection] -+ change symbolAB = correction⁻¹ * symbolBA -+ calc -+ symbolAB = (symbolAB * symbolBA⁻¹) * symbolBA := by -+ simp only [mul_assoc, inv_mul_cancel, mul_one] -+ _ = correction⁻¹ * symbolBA := by rw [hQuotient] -+ -+/-! ## Quadratic specialization over the rational field -/ -+ -+open AlgebraicNumberTheory.PowerResidueSymbols -+ -+local instance rationalPrimeFact (p : Nat.Primes) : Fact p.1.Prime := -+ ⟨p.2⟩ -+ -+/-- The rational field contains the primitive square root of unity `-1`. -+This is the canonical source of the primitive-root input in the quadratic -+specialization; no root is chosen downstream. -/ -+theorem rationalQuadraticPrimitiveRoots_nonempty : -+ (primitiveRoots 2 ℚ).Nonempty := by -+ refine ⟨-1, (mem_primitiveRoots (by decide)).2 ?_⟩ -+ exact IsPrimitiveRoot.neg_one 0 (by decide) -+ -+/-- The residue field at the rational prime over `p` is canonically `ZMod p`. -+The construction first transports the prime ideal through -+`Rat.ringOfIntegersEquiv` and then uses the standard integer quotient. -/ -+noncomputable def rationalPrimeResidueEquivZMod -+ (p : Nat.Primes) : -+ (𝓞 ℚ ⧸ (RayClass.rationalPrime p).asIdeal) ≃+* ZMod p.1 := by -+ have hIntEquiv : -+ Rat.IsIntegralClosure.intEquiv (𝓞 ℚ) = -+ Rat.ringOfIntegersEquiv := by -+ ext x -+ exact Rat.IsIntegralClosure.intEquiv_apply_eq_ringOfIntegersEquiv x -+ have hmap : -+ Ideal.span {(p.1 : ℤ)} = -+ (RayClass.rationalPrime p).asIdeal.map -+ Rat.ringOfIntegersEquiv := by -+ simpa only [RayClass.natGenerator_rationalPrime, hIntEquiv] using -+ (Rat.HeightOneSpectrum.span_natGenerator -+ (RayClass.rationalPrime p)) -+ exact -+ (Ideal.quotientEquiv -+ (RayClass.rationalPrime p).asIdeal -+ (Ideal.span {(p.1 : ℤ)}) -+ Rat.ringOfIntegersEquiv hmap).trans -+ (Int.quotientSpanNatEquivZMod p.1) -+ -+/-- The rational residue-field equivalence sends an integral residue class to -+the corresponding integer class modulo `p`. -/ -+@[simp] -+theorem rationalPrimeResidueEquivZMod_mk -+ (p : Nat.Primes) (a : 𝓞 ℚ) : -+ rationalPrimeResidueEquivZMod p -+ (Ideal.Quotient.mk (RayClass.rationalPrime p).asIdeal a) = -+ (Rat.ringOfIntegersEquiv a : ZMod p.1) := by -+ rw [rationalPrimeResidueEquivZMod, RingEquiv.trans_apply] -+ have hmk -+ (hIJ : -+ Ideal.span {(p.1 : ℤ)} = -+ (RayClass.rationalPrime p).asIdeal.map -+ Rat.ringOfIntegersEquiv) : -+ Ideal.quotientEquiv -+ (RayClass.rationalPrime p).asIdeal -+ (Ideal.span {(p.1 : ℤ)}) -+ Rat.ringOfIntegersEquiv hIJ -+ (Ideal.Quotient.mk (RayClass.rationalPrime p).asIdeal a) = -+ Ideal.Quotient.mk (Ideal.span {(p.1 : ℤ)}) -+ (Rat.ringOfIntegersEquiv a) := -+ Ideal.quotientEquiv_mk -+ (RayClass.rationalPrime p).asIdeal -+ (Ideal.span {(p.1 : ℤ)}) -+ Rat.ringOfIntegersEquiv hIJ a -+ have hquot : -+ ((Int.quotientSpanNatEquivZMod p.1 : -+ (ℤ ⧸ Ideal.span {(p.1 : ℤ)}) →+* ZMod p.1).comp -+ (Ideal.Quotient.mk (Ideal.span {(p.1 : ℤ)}))) = -+ Int.castRingHom (ZMod p.1) := -+ Int.quotientSpanNatEquivZMod_comp_Quotient_mk p.1 -+ calc -+ _ = Int.quotientSpanNatEquivZMod p.1 -+ (Ideal.Quotient.mk (Ideal.span {(p.1 : ℤ)}) -+ (Rat.ringOfIntegersEquiv a)) := -+ congrArg (Int.quotientSpanNatEquivZMod p.1) (hmk _) -+ _ = _ := congrArg -+ (fun f : ℤ →+* ZMod p.1 => f (Rat.ringOfIntegersEquiv a)) hquot -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityLocalSymbols.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityLocalSymbols.lean -new file mode 100644 -index 0000000..92d5938 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityLocalSymbols.lean -@@ -0,0 +1,557 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.PowerResidueReciprocityBase -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.HilbertProductFormula -+import ClassFieldTheory.AlgebraicNumberTheory.PowerResidueSymbols.Ideal -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormApproximation.FinitePlaces -+import Mathlib.NumberTheory.Padics.HeightOneSpectrum -+import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicField -+import ClassFieldTheory.AlgebraicNumberTheory.QuadraticReciprocity -+import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Rational -+import ClassFieldTheory.LocalClassFieldTheory.Kummer.PowerResidueTameFormula -+import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.IdealQuotients -+import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion -+import ValuedFieldTheory.Valuation.Completion.ExtensionInvariants -+import ClassFieldTheory.KummerTheory.Concrete.SimpleExtensionLocalBehavior -+import ClassFieldTheory.KummerTheory.Concrete.SUnitPreparation.FiniteRadicalSupport -+import ClassFieldTheory.LocalClassFieldTheory.Finite.CyclotomicNorm.PrincipalUnits -+ -+ -+set_option autoImplicit false -+ -+ -+open scoped BigOperators Classical NumberField NumberTheorySymbols ValuativeRel WithZero -+open NumberField IsDedekindDomain -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+open KummerTheory -+open AlgebraicNumberTheory.PowerResidueSymbols -+open LocalClassFieldTheory.Kummer -+open LocalFieldTheory -+open LocalFieldTheory.IsNonarchimedeanLocalField -+ -+variable (K : Type) [Field K] [NumberField K] -+/-- The integral principal ideal generated by the exponent. -/ -+def powerResidueExponentIdeal (n : ℕ+) : Ideal (𝓞 K) := -+ Ideal.span {((n : ℕ) : 𝓞 K)} -+ -+/-- The exponent ideal is nonzero in a number field. -/ -+theorem powerResidueExponentIdeal_ne_zero (n : ℕ+) : -+ powerResidueExponentIdeal K n ≠ 0 := by -+ change Ideal.span {((n : ℕ) : 𝓞 K)} ≠ ⊥ -+ exact Ideal.span_singleton_eq_bot.not.mpr -+ (Nat.cast_ne_zero.mpr n.ne_zero) -+ -+omit [NumberField K] in -+theorem ideal_span_singleton_ne_zero -+ {x : 𝓞 K} (hx : x ≠ 0) : Ideal.span {x} ≠ 0 := -+ Submodule.span_singleton_eq_bot.mp.mt hx -+ -+/-- The finite places dividing the exponent. These, together with all -+infinite places, are precisely the correction places in the reciprocity -+formula once the two principal denominator supports are removed. -/ -+noncomputable def powerResidueExponentFinitePlaces -+ (n : ℕ+) : Finset (HeightOneSpectrum (𝓞 K)) := -+ (Ideal.finite_factors -+ (powerResidueExponentIdeal_ne_zero K n)).toFinset -+ -+/-- Membership in the exponent-place support is divisibility by the exponent -+ideal. -/ -+@[simp] -+theorem mem_powerResidueExponentFinitePlaces_iff -+ (n : ℕ+) (v : HeightOneSpectrum (𝓞 K)) : -+ v ∈ powerResidueExponentFinitePlaces K n ↔ -+ v.asIdeal ∣ powerResidueExponentIdeal K n := -+ Set.Finite.mem_toFinset -+ (Ideal.finite_factors -+ (powerResidueExponentIdeal_ne_zero K n)) -+ -+/-- At a finite place not dividing the exponent, the exponent is a unit in -+the canonical completion. -/ -+theorem finitePlace_natCast_valuation_eq_one_of_not_mem_exponent -+ (n : ℕ+) (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ ValuativeRel.valuation C ((n : ℕ) : C) = 1 := by -+ dsimp only -+ let : IsUltrametricDist -+ (HeightOneSpectrum.adicAbv K v).Completion := -+ finitePlaceArtinCompletionIsUltrametricDist -+ (HeightOneSpectrum.adicAbv K v) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv K v) -+ have hvNotDvd : -+ ¬ v.asIdeal ∣ powerResidueExponentIdeal K n := by -+ simpa only [mem_powerResidueExponentFinitePlaces_iff] using hv -+ have hvNotMem : ((n : ℕ) : 𝓞 K) ∉ v.asIdeal := by -+ intro hvMem -+ apply hvNotDvd -+ rw [powerResidueExponentIdeal, Ideal.dvd_span_singleton] -+ exact hvMem -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ have hNorm : ‖((n : ℕ) : C)‖ = 1 := by -+ calc -+ ‖((n : ℕ) : C)‖ = -+ ‖algebraMap K C (((n : ℕ) : K))‖ := by rw [map_natCast] -+ _ = HeightOneSpectrum.adicAbv K v (((n : ℕ) : K)) := -+ AbsoluteValue.completionAbsoluteValue_coe -+ (HeightOneSpectrum.adicAbv K v) (((n : ℕ) : K)) -+ _ = ‖NumberField.FinitePlace.embedding v (((n : ℕ) : K))‖ := -+ (NumberField.FinitePlace.norm_embedding v (((n : ℕ) : K))).symm -+ _ = 1 := -+ (NumberField.FinitePlace.norm_eq_one_iff_notMem K v -+ (((n : ℕ) : 𝓞 K))).2 hvNotMem -+ let vCNorm := NormedField.valuation (K := C) -+ let : vCNorm.Compatible := Valuation.Compatible.ofValuation vCNorm -+ have hnCNorm : vCNorm ((n : ℕ) : C) = 1 := by -+ change ‖((n : ℕ) : C)‖₊ = 1 -+ exact NNReal.eq (by simpa using hNorm) -+ exact -+ (ValuativeRel.isEquiv vCNorm (ValuativeRel.valuation C)) -+ |>.eq_one_iff_eq_one.mp hnCNorm -+ -+private noncomputable def finitePlaceLocalTamePowerResidueSymbolValue -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ nthRootsSubgroup (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ) := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ exact localTamePowerResidueSymbol C n -+ (finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv) -+ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) -+ (finitePlaceIntegralCompletionUnit K v a ha) -+ -+private noncomputable def finitePlaceLocalTamePowerResidueSymbolFieldValue -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ (HeightOneSpectrum.adicAbv K v).Completion := -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ ((localTamePowerResidueSymbol C n -+ (finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv) -+ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) -+ (finitePlaceIntegralCompletionUnit K v a ha)).1 : C) -+ -+private noncomputable def finitePlacePrimeIdealPowerResidueIntegralRoot -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ rootsOfUnity (n : ℕ) (𝓞 K) := -+ AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol -+ K v n hmu hcoprime a ha -+ -+private noncomputable def finitePlacePrimeIdealPowerResidueGlobalRoot -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : nthRootsSubgroup K (n : ℕ) := -+ integralRootsOfUnityToNthRoots K (n : ℕ) -+ (finitePlacePrimeIdealPowerResidueIntegralRoot K v n hmu hcoprime a ha) -+ -+private noncomputable def finitePlacePrimeIdealPowerResidueFactorValue -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ nthRootsSubgroup (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ) := -+ nthRootsSubgroupMap K (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ) -+ (finitePlacePrimeIdealPowerResidueGlobalRoot K v n hmu hcoprime a ha) -+ -+private noncomputable def finitePlacePrimeIdealPowerResidueFactorFieldValue -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ (HeightOneSpectrum.adicAbv K v).Completion := -+ (((nthRootsSubgroupMap K -+ (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ)) -+ (finitePlacePrimeIdealPowerResidueGlobalRoot K v n hmu hcoprime a ha)).1 : -+ (HeightOneSpectrum.adicAbv K v).Completion) -+ -+private noncomputable def finitePlaceLocalTamePowerResidueSymbolResidueValue -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ 𝓀[C] := by -+ dsimp only -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ letI : Fintype 𝓀[C] := Fintype.ofFinite _ -+ have hnLocal : (n : ℕ) ∣ Fintype.card 𝓀[C] - 1 := by -+ rw [← Nat.card_eq_fintype_card] -+ exact dvd_residueCard_sub_one_of_primitiveRoots C n -+ (finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv) -+ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) -+ exact -+ (((AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol -+ 𝓀[C] n hnLocal -+ (integerUnitsToResidueUnits C -+ (finitePlaceIntegralCompletionUnit K v a ha)) : -+ rootsOfUnity (n : ℕ) 𝓀[C]).1 : 𝓀[C]ˣ) : 𝓀[C]) -+ -+private noncomputable def finitePlacePrimeIdealPowerResidueFactorResidueValue -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ 𝓀[C] := by -+ dsimp only -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ exact -+ (((localNthRootsReduction C n -+ (nthRootsSubgroupMap K C (n : ℕ) -+ (integralRootsOfUnityToNthRoots K (n : ℕ) -+ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol -+ K v n hmu hcoprime a ha)))).1 : 𝓀[C]ˣ) : 𝓀[C]) -+ -+/-- The tame symbol in a finite-place completion is the image of the -+prime-ideal power-residue symbol. All comparisons are canonical: the only -+place hypothesis says that the place does not divide the exponent. -/ -+private theorem finitePlaceLocalTamePowerResidueSymbol_residueValue_eq -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ finitePlaceLocalTamePowerResidueSymbolResidueValue K v n hmu hv a ha = -+ finitePlacePrimeIdealPowerResidueFactorResidueValue -+ K v n hmu hcoprime a ha := by -+ unfold finitePlaceLocalTamePowerResidueSymbolResidueValue -+ unfold finitePlacePrimeIdealPowerResidueFactorResidueValue -+ dsimp only -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ let : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v -+ let : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ let : Field (𝓞 K ⧸ v.asIdeal) := Ideal.Quotient.field v.asIdeal -+ let : Fintype (𝓞 K ⧸ v.asIdeal) := Fintype.ofFinite _ -+ let : Fintype 𝓀[C] := Fintype.ofFinite _ -+ let hnC := finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv -+ let hmuC := finitePlaceHilbert_primitiveRoots_nonempty K n hmu v -+ have hnPrime : -+ (n : ℕ) ∣ Fintype.card (𝓞 K ⧸ v.asIdeal) - 1 := by -+ rw [AlgebraicNumberTheory.PowerResidueSymbols.card_primeIdealResidueField K v] -+ exact -+ AlgebraicNumberTheory.PowerResidueSymbols.dvd_absNorm_sub_one_of_primitiveRoots -+ K v n hmu hcoprime -+ have hnLocal : (n : ℕ) ∣ Fintype.card 𝓀[C] - 1 := by -+ rw [← Nat.card_eq_fintype_card] -+ exact dvd_residueCard_sub_one_of_primitiveRoots C n hnC hmuC -+ rw [finitePlace_localNthRootsReduction_integralRoots] -+ rw [← AlgebraicNumberTheory.PowerResidueSymbols.rootsOfUnityReductionEquiv_apply -+ K v n hmu hcoprime, -+ AlgebraicNumberTheory.PowerResidueSymbols.rootsOfUnityReductionEquiv_primeIdealPowerResidueSymbol -+ K v n hmu hcoprime a ha] -+ rw [finitePlace_integerUnitsToResidueUnits_integralUnit] -+ exact congrArg (fun u : 𝓀[C]ˣ => (u : 𝓀[C])) -+ (finiteFieldPowerResidueSymbol_unitsMap_ringEquiv -+ (finitePlacePrimeResidueEquivLocalResidue K v) -+ n hnPrime hnLocal -+ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealResidueUnit -+ K v a ha)).symm -+ -+private theorem finitePlaceLocalTamePowerResidueSymbolFieldValue_eq_primeIdealValue -+ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : -+ @Eq (HeightOneSpectrum.adicAbv K v).Completion -+ (finitePlaceLocalTamePowerResidueSymbolFieldValue K v n hmu hv a ha) -+ (finitePlacePrimeIdealPowerResidueFactorFieldValue -+ K v n hmu hcoprime a ha) := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ let : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ let : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ let hnC := -+ finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv -+ let hmuC := finitePlaceHilbert_primitiveRoots_nonempty K n hmu v -+ unfold finitePlaceLocalTamePowerResidueSymbolFieldValue -+ unfold finitePlacePrimeIdealPowerResidueFactorFieldValue -+ unfold finitePlacePrimeIdealPowerResidueGlobalRoot -+ unfold finitePlacePrimeIdealPowerResidueIntegralRoot -+ have hRoots : -+ localTamePowerResidueSymbol C n hnC hmuC -+ (finitePlaceIntegralCompletionUnit K v a ha) = -+ nthRootsSubgroupMap K C (n : ℕ) -+ (integralRootsOfUnityToNthRoots K (n : ℕ) -+ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol -+ K v n hmu hcoprime a ha)) := by -+ apply (localNthRootsReductionEquiv C n hnC hmuC).injective -+ rw [localNthRootsReductionEquiv_localTamePowerResidueSymbol] -+ apply Subtype.ext -+ apply Units.ext -+ have hResidue := finitePlaceLocalTamePowerResidueSymbol_residueValue_eq -+ K v n hmu hcoprime hv a ha -+ unfold finitePlaceLocalTamePowerResidueSymbolResidueValue at hResidue -+ unfold finitePlacePrimeIdealPowerResidueFactorResidueValue at hResidue -+ dsimp only at hResidue -+ exact hResidue -+ exact congrArg (fun q : nthRootsSubgroup C (n : ℕ) => (q.1 : C)) hRoots -+ -+/-- The normalized additive valuation of a global field unit in the -+canonical completion at a finite place. -/ -+noncomputable def finitePlaceNormalizedValuation -+ (v : HeightOneSpectrum (𝓞 K)) (x : Kˣ) : ℤ := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ letI : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ letI : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ exact valuationMap C -+ (Additive.ofMul (finitePlaceHilbert_completionUnit K v x)) -+ -+/-- Away from the exponent, a finite-place Hilbert factor with integral-unit -+first entry is the prime-ideal power-residue symbol raised to the negative -+normalized valuation of the second entry. -/ -+theorem finitePlaceHilbertSymbol_eq_primeIdealPowerResidueFactor_zpow -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) (b : Kˣ) : -+ finitePlaceHilbertSymbol K n hnK hmu v -+ (primeAvoidingIntegralFieldUnit K v a ha) b = -+ integralRootsOfUnityToNthRoots K (n : ℕ) -+ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol -+ K v n hmu hcoprime a ha) ^ -+ (-finitePlaceNormalizedValuation K v b) := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ let : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ let : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ let hnC := -+ finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv -+ let hmuC := finitePlaceHilbert_primitiveRoots_nonempty K n hmu v -+ let bC := finitePlaceHilbert_completionUnit K v b -+ apply nthRootsSubgroupMap_injective K C (n : ℕ) -+ rw [finitePlaceHilbertSymbol_map_eq_localHilbertSymbol] -+ change -+ localHilbertSymbol C n -+ (finitePlaceHilbert_natCast_ne_zero K n hnK v) hmuC -+ (finitePlaceHilbert_completionUnit K v -+ (primeAvoidingIntegralFieldUnit K v a ha)) bC = -+ nthRootsSubgroupMap K C (n : ℕ) -+ (integralRootsOfUnityToNthRoots K (n : ℕ) -+ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol -+ K v n hmu hcoprime a ha) ^ -+ (-finitePlaceNormalizedValuation K v b)) -+ rw [finitePlaceHilbert_completionUnit_primeAvoidingIntegralFieldUnit] -+ rw [localHilbertSymbol_tame_formula C n hnC hmuC] -+ change -+ finitePlaceLocalTamePowerResidueSymbolValue K v n hmu hv a ha ^ -+ (-finitePlaceNormalizedValuation K v b) = _ -+ have hBase : -+ finitePlaceLocalTamePowerResidueSymbolValue K v n hmu hv a ha = -+ finitePlacePrimeIdealPowerResidueFactorValue -+ K v n hmu hcoprime a ha := by -+ apply Subtype.ext -+ apply Units.ext -+ simpa only [finitePlaceLocalTamePowerResidueSymbolValue, -+ finitePlacePrimeIdealPowerResidueFactorValue, -+ finitePlaceLocalTamePowerResidueSymbolFieldValue, -+ finitePlacePrimeIdealPowerResidueFactorFieldValue] using -+ finitePlaceLocalTamePowerResidueSymbolFieldValue_eq_primeIdealValue -+ K v n hmu hcoprime hv a ha -+ rw [hBase] -+ unfold finitePlacePrimeIdealPowerResidueFactorValue -+ unfold finitePlacePrimeIdealPowerResidueGlobalRoot -+ unfold finitePlacePrimeIdealPowerResidueIntegralRoot -+ rw [map_zpow] -+ -+/-- Endpoint form of the finite-place local/global power-residue comparison. -/ -+theorem finitePlaceHilbertSymbol_eq_primeIdealPowerResidueFactor -+ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) -+ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) -+ (v : HeightOneSpectrum (𝓞 K)) -+ (hv : v ∉ powerResidueExponentFinitePlaces K n) -+ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) -+ (a : 𝓞 K) (ha : a ∉ v.asIdeal) (b : Kˣ) : -+ finitePlaceHilbertSymbol K n hnK hmu v -+ (primeAvoidingIntegralFieldUnit K v a ha) b = -+ integralRootsOfUnityToNthRoots K (n : ℕ) -+ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol -+ K v n hmu hcoprime a ha) ^ -+ (-finitePlaceNormalizedValuation K v b) := -+ finitePlaceHilbertSymbol_eq_primeIdealPowerResidueFactor_zpow -+ K n hnK hmu v hv hcoprime a ha b -+ -+/-- The Dedekind prime multiplicity is the exponent occurring in the -+integer-valued adic valuation. -/ -+theorem intValuation_eq_exp_neg_idealPrimeMultiplicity -+ (v : HeightOneSpectrum (𝓞 K)) (x : 𝓞 K) (hx : x ≠ 0) : -+ v.intValuation x = -+ WithZero.exp -+ (-(AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) : ℤ)) := by -+ rw [v.intValuation_if_neg hx] -+ rfl -+ -+/-- For an integral element, the normalized valuation in the canonical -+finite-place completion is the negative multiplicity of the prime in its -+principal ideal. -/ -+theorem finitePlaceNormalizedValuation_nonzeroIntegralFieldUnit -+ (v : HeightOneSpectrum (𝓞 K)) -+ (x : 𝓞 K) (hx : x ≠ 0) : -+ finitePlaceNormalizedValuation K v -+ (nonzeroIntegralFieldUnit K x hx) = -+ -(AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) : ℤ) := by -+ let C := (HeightOneSpectrum.adicAbv K v).Completion -+ let : ValuativeRel C := -+ finitePlaceLocalArtinCompletionValuativeRel v -+ let : IsNonarchimedeanLocalField C := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v -+ let : IsUltrametricDist C := -+ finitePlaceArtinCompletionIsUltrametricDist -+ (HeightOneSpectrum.adicAbv K v) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv K v) -+ let m := AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) -+ let πData := chosenFinitePlaceCompletionIntegralUniformizer v -+ have hπIrreducible : Irreducible πData.completionInteger := by -+ rw [IsDiscreteValuationRing.irreducible_iff_uniformizer] -+ let completionDVF : -+ ValuationTheory.DiscreteValuationField.DVF C := -+ { ValueGroup := ValuativeRel.ValueGroupWithZero C -+ valuation := ValuativeRel.valuation C } -+ exact -+ completionDVF.maximalIdeal_eq_span_uniformizer -+ πData.completionInteger_isUniformizer -+ let πC : Cˣ := -+ Units.mk0 (πData.completionInteger : C) -+ πData.completionInteger_isUniformizer.ne_zero -+ let xC : Cˣ := -+ finitePlaceHilbert_completionUnit K v -+ (nonzeroIntegralFieldUnit K x hx) -+ have hIntX : -+ v.intValuation x = WithZero.exp (-(m : ℤ)) := by -+ exact intValuation_eq_exp_neg_idealPrimeMultiplicity K v x hx -+ have hIntPiPow : -+ v.intValuation (πData.integer ^ m) = -+ WithZero.exp (-(m : ℤ)) := by -+ rw [map_pow, πData.intValuation_eq_exp_neg_one] -+ calc -+ WithZero.exp (-1 : ℤ) ^ m = -+ WithZero.exp (m • (-1 : ℤ)) := -+ (WithZero.exp_nsmul m (-1 : ℤ)).symm -+ _ = WithZero.exp (-(m : ℤ)) := by simp -+ have hnormX : -+ ‖(xC : C)‖ = -+ (WithZeroMulInt.toNNReal -+ (HeightOneSpectrum.absNorm_ne_zero v) -+ (WithZero.exp (-(m : ℤ))) : ℝ) := by -+ change ‖algebraMap K C (x : K)‖ = _ -+ calc -+ ‖algebraMap K C (x : K)‖ = -+ HeightOneSpectrum.adicAbv K v (x : K) := -+ AbsoluteValue.completionAbsoluteValue_coe -+ (HeightOneSpectrum.adicAbv K v) (x : K) -+ _ = _ := by -+ rw [HeightOneSpectrum.adicAbv_def, -+ HeightOneSpectrum.valuation_of_algebraMap, hIntX] -+ have hnormPiPow : -+ ‖((πC ^ m : Cˣ) : C)‖ = -+ (WithZeroMulInt.toNNReal -+ (HeightOneSpectrum.absNorm_ne_zero v) -+ (WithZero.exp (-(m : ℤ))) : ℝ) := by -+ have hπC : -+ (πC : C) = algebraMap K C (πData.integer : K) := by -+ exact πData.coe_completionInteger -+ have hπCPow : -+ ((πC ^ m : Cˣ) : C) = -+ algebraMap K C (((πData.integer ^ m : 𝓞 K) : K)) := by -+ have hIntegerPow : -+ (((πData.integer ^ m : 𝓞 K) : K)) = -+ (πData.integer : K) ^ m := by -+ exact map_pow (algebraMap (𝓞 K) K) πData.integer m -+ rw [Units.val_pow_eq_pow_val, hπC, hIntegerPow, map_pow] -+ calc -+ ‖((πC ^ m : Cˣ) : C)‖ = -+ ‖algebraMap K C ((πData.integer ^ m : 𝓞 K) : K)‖ := -+ congrArg norm hπCPow -+ _ = HeightOneSpectrum.adicAbv K v -+ ((πData.integer ^ m : 𝓞 K) : K) := -+ AbsoluteValue.completionAbsoluteValue_coe -+ (HeightOneSpectrum.adicAbv K v) -+ ((πData.integer ^ m : 𝓞 K) : K) -+ _ = -+ (WithZeroMulInt.toNNReal -+ (HeightOneSpectrum.absNorm_ne_zero v) -+ (WithZero.exp (-(m : ℤ))) : ℝ) := by -+ rw [HeightOneSpectrum.adicAbv_def, -+ HeightOneSpectrum.valuation_of_algebraMap, hIntPiPow] -+ have hraw : -+ ValuativeRel.valuation C (xC : C) = -+ ValuativeRel.valuation C ((πC ^ m : Cˣ) : C) := by -+ apply canonicalValuation_eq_of_valuation_eq -+ (v := NormedField.valuation (K := C)) -+ apply NNReal.eq -+ simpa only [NormedField.valuation_apply, coe_nnnorm] using -+ hnormX.trans hnormPiPow.symm -+ have hValuationMap : -+ valuationMap C (Additive.ofMul xC) = -+ valuationMap C (Additive.ofMul (πC ^ m)) := by -+ rw [valuationMap_apply, valuationMap_apply] -+ unfold IsNonarchimedeanLocalField.v -+ congr 2 -+ exact congrArg -+ (_root_.IsNonarchimedeanLocalField.valueGroupWithZeroIsoInt C) hraw -+ have hπCValuation : -+ valuationMap C (Additive.ofMul πC) = -1 := by -+ rw [valuationMap_apply] -+ exact -+ v_integerRingIrreducibleFieldUnit C πData.completionInteger -+ hπIrreducible πC rfl -+ calc -+ finitePlaceNormalizedValuation K v -+ (nonzeroIntegralFieldUnit K x hx) = -+ valuationMap C (Additive.ofMul xC) := rfl -+ _ = valuationMap C (Additive.ofMul (πC ^ m)) := hValuationMap -+ _ = (m : ℤ) * valuationMap C (Additive.ofMul πC) := by -+ rw [valuationMap_ofMul_pow] -+ _ = -(m : ℤ) := by rw [hπCValuation]; simp -+ _ = -(AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) : ℤ) := rfl -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtin.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtin.lean -index 8c5d33f..4536b7d 100644 ---- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtin.lean -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtin.lean -@@ -4,69 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Naganori Yamaguchi (assisted by OpenAI Codex) - -/ - --import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.CompletionToIdeal --import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion --import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.LocalNorm --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.AlgEquiv --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.BaseChange --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.Core --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.NormComparison --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.NormalClosureNorm --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.Tower --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerAlgEquivNaturality --import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerBaseChange --import ClassFieldTheory.AlgebraicNumberTheory.Idele.Relative.FinitePlaceTensorNorm --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlace --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicLocalization --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalPrimeFactorization --import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalPrincipalLocalUnit --import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.SemilinearNaturality --import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.UnramifiedNormalization --import ClassFieldTheory.LocalClassFieldTheory.LubinTateApplication.PadicMultiplicativeArtinComparison --import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicValuationComparison --import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.UnramifiedFrobenius --import ValuedFieldTheory.LocalField.Padic.Cyclotomic.TotallyRamified.EisensteinPolynomial --import Mathlib.NumberTheory.NumberField.Cyclotomic.Galois -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinPrincipal - --set_option autoImplicit false -- --/-! --# Finite-place Artin symbols in rational cyclotomic levels - --At a rational prime away from the cyclotomic level, the chosen completed --extension is unramified. Its normalized local Artin map is therefore the --arithmetic Frobenius raised to the local valuation. The genuine primitive --root in the localized cyclotomic level identifies the image of arithmetic --Frobenius under the global cyclotomic character with the residue prime. ---/ -+set_option autoImplicit false - - open scoped Classical NNReal NumberField ValuativeRel - open NumberField IsDedekindDomain -- --noncomputable section -- --namespace GlobalClassFieldTheory --namespace Reciprocity -- ---- Specializing the generic finite-place comparison to `ℚ` must retain its ---- `Algebra.id` owner rather than selecting the competing rational-field ---- instance introduced after specialization. --@[reducible] noncomputable local instance -- rationalFinitePlaceCompletionRatAlgebra -- (v : HeightOneSpectrum (𝓞 ℚ)) : -- Algebra ℚ (HeightOneSpectrum.adicAbv ℚ v).Completion := by -- letI : Algebra ℚ ℚ := Algebra.id ℚ -- let hWith : Algebra ℚ -- (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) := -- WithAbs.instAlgebra _ -- let hUniform : UniformContinuousConstSMul ℚ -- (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) := -- WithAbs.instUniformContinuousConstSMulReal _ -- exact -- @UniformSpace.Completion.algebra -- (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) _ _ _ _ -- ℚ _ hWith hUniform -- - open AlgebraicNumberTheory.Valuations - open HilbertRamification - open LocalClassFieldTheory -@@ -75,2260 +19,54 @@ open LocalFieldTheory.DiscreteValuationField - open LocalFieldTheory.DiscreteValuationField.Examples.Qp - open LubinTate - --private theorem mappedAbelianLocalArtin_eq_frobenius_zpow -- {F E G : Type} -- [Field F] [ValuativeRel F] [TopologicalSpace F] -- [IsNonarchimedeanLocalField F] -- [Field E] [ValuativeRel E] [UniformSpace E] [IsUniformAddGroup E] -- [IsNonarchimedeanLocalField E] -- [Algebra F E] [FiniteDimensional F E] [IsAbelianGalois F E] -- [Valuation.HasExtension -- (ValuativeRel.valuation F) (ValuativeRel.valuation E)] -- [IsNonarchimedeanLocalField.IsUnramifiedValuedExtension F E] -- [Group G] -- (f : (E ≃ₐ[F] E) →* G) (x : Fˣ) : -- f (LocalClassFieldTheory.abelianLocalArtinMonoidHom F E x) = -- (f (arithmeticFrobeniusOfUnramifiedValuation F E)) ^ -- IsNonarchimedeanLocalField.valuationMap F -- (Additive.ofMul x) := by -- rw [LocalClassFieldTheory.abelianLocalArtinMonoidHom_eq_frobenius_zpow, -- map_zpow] -- --local instance (q : Nat.Primes) : Fact q.1.Prime := -- ⟨q.2⟩ -- --local instance (m : ℕ+) : NeZero (m : ℕ) := -- ⟨m.ne_zero⟩ -- --noncomputable local instance -- rationalCyclotomicLevelFiniteDimensional -- (m : ℕ+) : -- FiniteDimensional ℚ -- (KummerTheory.rationalCyclotomicLevel m) := -- IsCyclotomicExtension.finiteDimensional -- {(m : ℕ)} ℚ (KummerTheory.rationalCyclotomicLevel m) -- --noncomputable local instance -- rationalCyclotomicLevelIsAbelianGalois -- (m : ℕ+) : -- IsAbelianGalois ℚ -- (KummerTheory.rationalCyclotomicLevel m) := by -- have : IsGalois ℚ -- (KummerTheory.rationalCyclotomicLevel m) := -- inferInstance -- let e := -- IsCyclotomicExtension.Rat.galEquivZMod -- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) -- exact -- { is_comm.comm σ τ := by -- apply e.injective -- simp only [map_mul] -- exact mul_comm _ _ } -- --@[reducible] --noncomputable local instance rationalFinitePlaceBaseNontriviallyNormedField -- (q : Nat.Primes) : -- NontriviallyNormedField -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion := -- absoluteValueExtension_completionNontriviallyNormedField -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)) -- (RayClass.adicAbv_isNontrivial -- (RayClass.rationalPrime q)) -- --noncomputable local instance rationalFinitePlaceBaseLocallyCompactSpace -- (q : Nat.Primes) : -- LocallyCompactSpace -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion := -- AbsoluteValue.Completion.locallyCompactSpace -- (finitePlaceCompletionBaseMap_isometry -- (RayClass.rationalPrime q)) -- --noncomputable local instance rationalFinitePlaceBaseIsUltrametricDist -- (q : Nat.Primes) : -- IsUltrametricDist -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion := -- finitePlaceArtinCompletionIsUltrametricDist -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)) -- (HeightOneSpectrum.isNonarchimedean_adicAbv -- ℚ (RayClass.rationalPrime q)) -- --@[reducible] --noncomputable local instance rationalFinitePlaceBaseValued -- (q : Nat.Primes) : -- Valued -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion ℝ≥0 := -- finitePlaceArtinCompletionValued -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)) -- (HeightOneSpectrum.isNonarchimedean_adicAbv -- ℚ (RayClass.rationalPrime q)) -- --@[reducible] --noncomputable local instance rationalFinitePlaceBaseValuativeRel -- (q : Nat.Primes) : -- ValuativeRel -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion := -- finitePlaceLocalArtinCompletionValuativeRel -- (K := ℚ) (RayClass.rationalPrime q) -- --noncomputable local instance -- rationalFinitePlaceBaseValuationIsNontrivial -- (q : Nat.Primes) : -- (Valued.v : -- Valuation -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- ℝ≥0).IsNontrivial := -- (inferInstance : -- (NormedField.valuation -- (K := -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion)).IsNontrivial) -- --noncomputable local instance rationalFinitePlaceBaseValuationCompatible -- (q : Nat.Primes) : -- (Valued.v : -- Valuation -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- ℝ≥0).Compatible := -- Valuation.Compatible.ofValuation _ -- --noncomputable local instance -- rationalFinitePlaceBaseValuativeRelIsNontrivial -- (q : Nat.Primes) : -- ValuativeRel.IsNontrivial -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion := -- (ValuativeRel.isNontrivial_iff_isNontrivial -- (Valued.v : -- Valuation -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- ℝ≥0)).2 inferInstance -- --noncomputable local instance rationalFinitePlaceBaseIsValuativeTopology -- (q : Nat.Primes) : -- IsValuativeTopology -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion := -- isValuativeTopology_of_valued_ofValuation -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion ℝ≥0 -- --noncomputable local instance -- rationalFinitePlaceBaseIsNonarchimedeanLocalField -- (q : Nat.Primes) : -- IsNonarchimedeanLocalField -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion := -- finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField -- (K := ℚ) (RayClass.rationalPrime q) -- --/-! Named compatibility witnesses used by the ramified-prime and ray-norm --modules. They are not installed as a duplicate module-level instance family; --the canonical instances above already provide the same data. -/ -- --/-- Rational cyclotomic levels are finite-dimensional over `ℚ`. -/ --theorem rationalCyclotomicPrincipalPrimeLevelFiniteDimensional -- (m : ℕ+) : -- FiniteDimensional ℚ (KummerTheory.rationalCyclotomicLevel m) := -- rationalCyclotomicLevelFiniteDimensional m -- --/-- Rational cyclotomic levels are abelian Galois extensions of `ℚ`. -/ --theorem rationalCyclotomicPrincipalPrimeLevelIsAbelianGalois -- (m : ℕ+) : -- IsAbelianGalois ℚ (KummerTheory.rationalCyclotomicLevel m) := -- rationalCyclotomicLevelIsAbelianGalois m -- --/-- The canonical nontrivially normed field structure on the completion of --`ℚ` at the rational prime `p`, exposed for principal-prime constructions. -/ --@[reducible] --noncomputable def rationalPrimeFactorCompletionNontriviallyNormedField -- (p : Nat.Primes) : -- NontriviallyNormedField -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion := -- rationalFinitePlaceBaseNontriviallyNormedField p -- --/-- The completion of `ℚ` at `p` is locally compact. -/ --theorem rationalPrimeFactorCompletionLocallyCompactSpace -- (p : Nat.Primes) : -- LocallyCompactSpace -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion := -- rationalFinitePlaceBaseLocallyCompactSpace p -- --/-- The completion of `ℚ` at `p` carries its canonical ultrametric distance. -/ --theorem rationalPrimeFactorCompletionIsUltrametricDist -- (p : Nat.Primes) : -- IsUltrametricDist -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion := -- rationalFinitePlaceBaseIsUltrametricDist p -- --/-- The canonical `ℝ≥0`-valued structure on the completion of `ℚ` at `p`. -/ --@[reducible] --noncomputable def rationalPrimeFactorCompletionValued -- (p : Nat.Primes) : -- Valued -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion ℝ≥0 := -- rationalFinitePlaceBaseValued p -- --/-- The valuative relation induced by the canonical valuation on the --completion of `ℚ` at `p`. -/ --@[reducible] --noncomputable def rationalPrimeFactorCompletionValuativeRel -- (p : Nat.Primes) : -- ValuativeRel -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion := -- rationalFinitePlaceBaseValuativeRel p -- --/-- The canonical valuation on the completion of `ℚ` at `p` is nontrivial. -/ --theorem rationalPrimeFactorCompletionValuationIsNontrivial -- (p : Nat.Primes) : -- (Valued.v : Valuation -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion ℝ≥0).IsNontrivial := -- rationalFinitePlaceBaseValuationIsNontrivial p -- --/-- The canonical valuation on the completion of `ℚ` at `p` is compatible --with its field structure. -/ --theorem rationalPrimeFactorCompletionValuationCompatible -- (p : Nat.Primes) : -- (Valued.v : Valuation -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion ℝ≥0).Compatible := -- rationalFinitePlaceBaseValuationCompatible p -- --/-- The canonical valuative relation on the completion at `p` is nontrivial. -/ --theorem rationalPrimeFactorCompletionValuativeRelIsNontrivial -- (p : Nat.Primes) : -- ValuativeRel.IsNontrivial -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion := -- rationalFinitePlaceBaseValuativeRelIsNontrivial p -- --/-- The completion topology at `p` is induced by its canonical valuation. -/ --theorem rationalPrimeFactorCompletionIsValuativeTopology -- (p : Nat.Primes) : -- IsValuativeTopology -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion := -- rationalFinitePlaceBaseIsValuativeTopology p -- --/-- The completion of `ℚ` at `p` is a nonarchimedean local field. -/ --theorem rationalPrimeFactorCompletionIsNonarchimedeanLocalField -- (p : Nat.Primes) : -- IsNonarchimedeanLocalField -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion := -- rationalFinitePlaceBaseIsNonarchimedeanLocalField p -- --/-- The positive conductor of the `n`-th ramified cyclotomic level at --`p`. -/ --def rationalCyclotomicPrincipalPrimeModulus -- (p : Nat.Primes) (n : ℕ) : ℕ+ := -- ⟨p.1 ^ (n + 1), pow_pos p.2.pos (n + 1)⟩ -- --/-- The rational finite-place completion used at the prime `p`. -/ --abbrev RationalCyclotomicPrincipalPrimeCompletion -- (p : Nat.Primes) := -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion -- --/-- The chosen localized cyclotomic field at level `p ^ (n + 1)`. -/ --abbrev RationalCyclotomicPrincipalPrimeLocalizedLevel -- (p : Nat.Primes) (n : ℕ) := -- rationalCyclotomicLocalizedCompletion -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p) -- --/-- The standard multiplicative Lubin--Tate field at level `n`. -/ --abbrev RationalCyclotomicPrincipalPrimePadicLevel -- (p : Nat.Primes) (n : ℕ) := -- standardLubinTateLevelField -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -- --/-- The valuation ring of the absolute-value completion at `q`, identified --with the standard p-adic integer ring `ℤ_q`. -/ --noncomputable def rationalFinitePlaceCompletionIntegerRingEquivPadicInt -- (q : Nat.Primes) : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion] ≃+* -- ℤ_[q.1] := by -- let v : HeightOneSpectrum (𝓞 ℚ) := -- RayClass.rationalPrime q -- let vQ := HeightOneSpectrum.adicAbv ℚ v -- let eConcreteIntegers : -- 𝒪[vQ.Completion] ≃+* -- v.adicCompletionIntegers ℚ := -- finitePlaceCompletionIntegerRingEquiv v -- exact -- eConcreteIntegers.trans -- (PadicInt.adicCompletionIntegersEquiv -- (𝓞 ℚ) q).symm.toRingEquiv -- --/-- The absolute-value completion at the rational prime `q`, identified --with the standard field `ℚ_q`. -/ --noncomputable def rationalFinitePlaceCompletionRingEquivPadic -- (q : Nat.Primes) : -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion ≃+* -- ℚ_[q.1] := -- IsFractionRing.ringEquivOfRingEquiv -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) -- --/-- The completion-to-`ℚ_q` equivalence respects the rational embedding. -/ --theorem rationalFinitePlaceCompletionRingEquivPadic_algebraMap -- (q : Nat.Primes) (a : ℚ) : -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap ℚ -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion a) = -- algebraMap ℚ ℚ_[q.1] a := by -- exact -- (rationalFinitePlaceCompletionRingEquivPadic q).toRingHom.map_rat_algebraMap a -- --/-- The completion field equivalence and its restriction to valuation --rings commute with the natural inclusions into the fields. -/ --theorem rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe -- (q : Nat.Primes) -- (a : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion]) : -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion] -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion a) = -- algebraMap ℤ_[q.1] ℚ_[q.1] -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q a) := by -- exact -- (IsFractionRing.ringEquivOfRingEquiv_algebraMap -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) a) -- --/-- The canonical rational-completion equivalence preserves the canonical --valuations. -/ --theorem -- rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible -- (p : Nat.Primes) : -- SemilinearValuationCompatible -- (RationalCyclotomicPrincipalPrimeCompletion p) ℚ_[p.1] -- (rationalFinitePlaceCompletionRingEquivPadic p) := by -- let F := RationalCyclotomicPrincipalPrimeCompletion p -- let eK := rationalFinitePlaceCompletionRingEquivPadic p -- let : Algebra F ℚ_[p.1] := eK.toRingHom.toAlgebra -- change -- (ValuativeRel.valuation F).HasExtension -- (ValuativeRel.valuation ℚ_[p.1]) -- let eO := -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt p).trans -- (padicIntEquivValuationSubring p.1) -- have hChosen : -- (localCompleteDVF F).valuation.HasExtension -- (padicDVRValuation p.1) := by -- change -- (localCompleteDVF F).valuation.HasExtension -- (padicCompleteDVF p.1).valuation -- apply -- ValuationTheory.DiscreteValuationField.ValuedExtension.valuation_hasExtension_of_valuationSubring_equiv -- (localCompleteDVF F) -- (padicCompleteDVF p.1) -- eO -- intro z -- change -- algebraMap -- (padicDVRValuation p.1).valuationSubring ℚ_[p.1] -- (padicIntEquivValuationSubring p.1 -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -- p z)) = -- rationalFinitePlaceCompletionRingEquivPadic p -- (algebraMap 𝒪[F] F z) -- symm -- calc -- rationalFinitePlaceCompletionRingEquivPadic p -- (algebraMap 𝒪[F] F z) = -- algebraMap ℤ_[p.1] ℚ_[p.1] -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -- p z) := -- rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe -- p z -- _ = -- algebraMap -- (padicDVRValuation p.1).valuationSubring ℚ_[p.1] -- (padicIntEquivValuationSubring p.1 -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -- p z)) := by -- rw [PadicInt.algebraMap_apply, -- ValuationSubring.algebraMap_apply] -- exact -- (padicIntEquivValuationSubring_coe p.1 -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -- p z)).symm -- have hBase : -- (ValuativeRel.valuation F).HasExtension -- (padicDVRValuation p.1) := by -- rw [← localCompleteDVF_valuation_eq] -- exact hChosen -- refine -- { val_isEquiv_comap := ?_ } -- exact -- hBase.val_isEquiv_comap.trans -- ((padicDVRValuation_isEquiv_valuativeRelValuation -- p.1).comap (algebraMap F ℚ_[p.1])) -- --/-- The rational prime, pulled back from `ℤ_q` to the valuation ring of --the absolute-value completion at `q`. -/ --noncomputable def rationalPrimeFinitePlaceInteger -- (q : Nat.Primes) : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion] := -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q).symm -- (q.1 : ℤ_[q.1]) -- --/-- The pulled-back rational prime is irreducible in the completion --valuation ring. -/ --theorem rationalPrimeFinitePlaceInteger_irreducible -- (q : Nat.Primes) : -- Irreducible (rationalPrimeFinitePlaceInteger q) := by -- exact -- (MulEquiv.irreducible_iff -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -- q).symm.toMulEquiv).2 -- ((PadicInt.prime_p : -- Prime (q.1 : ℤ_[q.1])).irreducible) -- --/-- Coercing the pulled-back prime to the completion field gives the --ordinary image of the rational number `q`. -/ --theorem rationalPrimeFinitePlaceInteger_coe -- (q : Nat.Primes) : -- ((rationalPrimeFinitePlaceInteger q : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion]) : -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion) = -- algebraMap ℚ -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (q.1 : ℚ) := by -- apply -- (rationalFinitePlaceCompletionRingEquivPadic q).injective -- change -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion] -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeFinitePlaceInteger q)) = -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap ℚ -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (q.1 : ℚ)) -- calc -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion] -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeFinitePlaceInteger q)) = -- algebraMap ℤ_[q.1] ℚ_[q.1] -- ((rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) -- (rationalPrimeFinitePlaceInteger q)) := -- rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe -- q (rationalPrimeFinitePlaceInteger q) -- _ = (q.1 : ℚ_[q.1]) := by -- rw [rationalPrimeFinitePlaceInteger, -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -- q).apply_symm_apply, -- PadicInt.algebraMap_apply, -- PadicInt.coe_natCast] -- _ = -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap ℚ -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (q.1 : ℚ)) := by -- rw [ -- rationalFinitePlaceCompletionRingEquivPadic_algebraMap] -- norm_num -- --/-- The rational prime as a field unit of its absolute-value completion. -/ --noncomputable def rationalPrimeFinitePlaceFieldUnit -- (q : Nat.Primes) : -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completionˣ := -- Units.mk0 -- (rationalPrimeFinitePlaceInteger q : -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion) -- (by -- intro hzero -- exact -- (rationalPrimeFinitePlaceInteger_irreducible q).ne_zero -- (Subtype.ext hzero)) -- --/-- In the inverse-standard local reciprocity normalization, the rational --prime itself has normalized additive value `-1`. -/ --theorem rationalPrimeFinitePlaceFieldUnit_valuationMap -- (q : Nat.Primes) : -- IsNonarchimedeanLocalField.valuationMap -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (Additive.ofMul -- (rationalPrimeFinitePlaceFieldUnit q)) = -- -1 := by -- simpa [IsNonarchimedeanLocalField.valuationMap_apply] using -- (LocalFieldTheory.v_integerRingIrreducibleFieldUnit -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeFinitePlaceInteger q) -- (rationalPrimeFinitePlaceInteger_irreducible q) -- (rationalPrimeFinitePlaceFieldUnit q) rfl) -- --/-- The rational `q`-unit part of `x`, pulled back from `ℤ_qˣ` to the --valuation ring of the absolute-value completion. -/ --noncomputable def rationalPrimeUnitFinitePlaceIntegerUnit -- (x : ℚˣ) (q : Nat.Primes) : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion]ˣ := -- Units.map -- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -- q).symm.toMonoidHom -- (padicIntUnitOfRat q -- (rationalPrimeUnit x q : ℚ) -- (rationalPrimeUnit x q).ne_zero -- (padicValRat_rationalPrimeUnit x q)) -- --/-- Forgetting the integrality proof from the pulled-back `q`-unit gives --the ordinary image of the rational `q`-unit in the completion field. -/ --theorem rationalPrimeUnitFinitePlaceIntegerUnit_coe -- (x : ℚˣ) (q : Nat.Primes) : -- (((rationalPrimeUnitFinitePlaceIntegerUnit x q : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion]ˣ) : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion]) : -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion) = -- algebraMap ℚ -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeUnit x q : ℚ) := by -- apply -- (rationalFinitePlaceCompletionRingEquivPadic q).injective -- change -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion] -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeUnitFinitePlaceIntegerUnit x q : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion])) = -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap ℚ -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeUnit x q : ℚ)) -- calc -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion] -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeUnitFinitePlaceIntegerUnit x q : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion])) = -- algebraMap ℤ_[q.1] ℚ_[q.1] -- ((rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) -- (rationalPrimeUnitFinitePlaceIntegerUnit x q : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion])) := -- rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe q -- (rationalPrimeUnitFinitePlaceIntegerUnit x q : -- 𝒪[(HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion]) -- _ = -- ((padicIntUnitOfRat q -- (rationalPrimeUnit x q : ℚ) -- (rationalPrimeUnit x q).ne_zero -- (padicValRat_rationalPrimeUnit x q) : -- ℤ_[q.1]) : ℚ_[q.1]) := by -- rw [rationalPrimeUnitFinitePlaceIntegerUnit] -- simp [PadicInt.algebraMap_apply] -- _ = ((rationalPrimeUnit x q : ℚ) : ℚ_[q.1]) := by -- rw [padicIntUnitOfRat_coe] -- _ = -- rationalFinitePlaceCompletionRingEquivPadic q -- (algebraMap ℚ -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeUnit x q : ℚ)) := by -- rw [ -- rationalFinitePlaceCompletionRingEquivPadic_algebraMap] -- simp -- --/-- The completion field unit underlying the pulled-back rational `q`-unit --has normalized additive value zero. -/ --theorem rationalPrimeUnitFinitePlaceField_valuationMap -- (x : ℚˣ) (q : Nat.Primes) : -- IsNonarchimedeanLocalField.valuationMap -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (Additive.ofMul -- (IsNonarchimedeanLocalField.integerUnitsToFieldUnits -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeUnitFinitePlaceIntegerUnit x q))) = -- 0 := by -- rw [IsNonarchimedeanLocalField.valuationMap_apply] -- exact -- IsNonarchimedeanLocalField.v_integerUnitsToFieldUnits -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (rationalPrimeUnitFinitePlaceIntegerUnit x q) -- --/-- The rational prime `q`, regarded as a unit of `ℚ`. -/ --def rationalPrimeGeneratorUnit (q : Nat.Primes) : ℚˣ := -- Units.mk0 (q.1 : ℚ) (by exact_mod_cast q.2.ne_zero) -- --/-- The underlying rational number of the prime generator unit is `q`. -/ --@[simp] --theorem rationalPrimeGeneratorUnit_coe (q : Nat.Primes) : -- (rationalPrimeGeneratorUnit q : ℚ) = q.1 := -- rfl -- --/-- Reattaching the removed `q`-power to the rational `q`-unit recovers --the original rational field unit. -/ --theorem rationalPrimeGeneratorUnit_zpow_mul_rationalPrimeUnit -- (x : ℚˣ) (q : Nat.Primes) : -- rationalPrimeGeneratorUnit q ^ -- padicValRat q.1 (x : ℚ) * -- rationalPrimeUnit x q = -- x := by -- rw [rationalPrimeGeneratorUnit, rationalPrimeUnit, -- ← mul_assoc, ← zpow_add] -- simp -- --/-- The source unit in the absolute-value completion represented by the --finite component of a rational principal idele. -/ --noncomputable def rationalPrincipalFinitePlaceInput -- (x : ℚˣ) (q : Nat.Primes) : -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completionˣ := -- (finitePlaceCompletionUnitsContinuousMulEquiv -- (RayClass.rationalPrime q)).symm -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime q) -- (IdeleGroup.principalIdele ℚ x)) -- --/-- The source unit represented by a principal finite component is the --ordinary image of the rational field unit in the absolute-value --completion. -/ --theorem rationalPrincipalFinitePlaceInput_eq_algebraMap -- (x : ℚˣ) (q : Nat.Primes) : -- rationalPrincipalFinitePlaceInput x q = -- Units.map -- (algebraMap ℚ -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion).toMonoidHom -- x := by -- apply Units.ext -- let v : HeightOneSpectrum (𝓞 ℚ) := -- RayClass.rationalPrime q -- let vQ := HeightOneSpectrum.adicAbv ℚ v -- let component : (v.adicCompletion ℚ)ˣ := -- IdeleGroup.finiteComponent v -- (IdeleGroup.principalIdele ℚ x) -- apply (finitePlaceCompletionRingEquiv v).injective -- change -- finitePlaceCompletionRingEquiv v -- (rationalPrincipalFinitePlaceInput x q : vQ.Completion) = -- finitePlaceCompletionRingEquiv v -- (algebraMap ℚ vQ.Completion (x : ℚ)) -- have hCompletion : -- finitePlaceCompletionRingEquiv v -- (rationalPrincipalFinitePlaceInput x q : -- vQ.Completion) = -- (component : v.adicCompletion ℚ) := by -- have hUnits := -- congrArg Units.val -- ((finitePlaceCompletionUnitsContinuousMulEquiv v).apply_symm_apply -- component) -- exact hUnits -- have hComponent : -- (component : v.adicCompletion ℚ) = -- algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ) := by -- apply (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm.injective -- calc -- (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm -- (component : v.adicCompletion ℚ) = -- algebraMap ℚ ℚ_[q.1] (x : ℚ) := by -- dsimp only [component] -- rw [IdeleGroup.finiteComponent_principalIdele] -- exact -- (Padic.adicCompletionEquiv -- (𝓞 ℚ) q).symm.commutes (x : ℚ) -- _ = (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm -- (algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ)) := by -- symm -- exact -- (Padic.adicCompletionEquiv -- (𝓞 ℚ) q).symm.commutes (x : ℚ) -- calc -- finitePlaceCompletionRingEquiv v -- (rationalPrincipalFinitePlaceInput x q : -- vQ.Completion) = -- (component : v.adicCompletion ℚ) := hCompletion -- _ = algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ) := hComponent -- _ = finitePlaceCompletionRingEquiv v -- (algebraMap ℚ vQ.Completion (x : ℚ)) := by -- symm -- exact -- (finitePlaceCompletionAlgEquiv (K := ℚ) v).commutes (x : ℚ) -- --/-- The normalized local exponent of a rational principal finite --component is the negative of the usual `q`-adic exponent. The minus sign --records the inverse-standard local reciprocity convention in which a --prime element has normalized value `-1`. -/ --theorem rationalPrincipalFiniteComponent_valuationMap -- (x : ℚˣ) (q : Nat.Primes) : -- IsNonarchimedeanLocalField.valuationMap -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (Additive.ofMul -- ((finitePlaceCompletionUnitsContinuousMulEquiv -- (RayClass.rationalPrime q)).symm -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime q) -- (IdeleGroup.principalIdele ℚ x)))) = -- -padicValRat q.1 (x : ℚ) := by -- let F := -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- let embed : ℚˣ →* Fˣ := -- Units.map (algebraMap ℚ F).toMonoidHom -- let primeUnit : Fˣ := -- rationalPrimeFinitePlaceFieldUnit q -- let integralUnit : 𝒪[F]ˣ := -- rationalPrimeUnitFinitePlaceIntegerUnit x q -- let unitPart : Fˣ := -- IsNonarchimedeanLocalField.integerUnitsToFieldUnits -- F integralUnit -- have hInput : -- rationalPrincipalFinitePlaceInput x q = -- embed x := by -- exact rationalPrincipalFinitePlaceInput_eq_algebraMap x q -- have hPrime : -- embed (rationalPrimeGeneratorUnit q) = -- primeUnit := by -- apply Units.ext -- exact -- (rationalPrimeFinitePlaceInteger_coe q).symm -- have hUnit : -- embed (rationalPrimeUnit x q) = -- unitPart := by -- apply Units.ext -- exact -- (rationalPrimeUnitFinitePlaceIntegerUnit_coe -- x q).symm -- change -- IsNonarchimedeanLocalField.valuationMap F -- (Additive.ofMul -- (rationalPrincipalFinitePlaceInput x q)) = -- -padicValRat q.1 (x : ℚ) -- rw [hInput] -- conv_lhs => -- rw [← rationalPrimeGeneratorUnit_zpow_mul_rationalPrimeUnit -- x q] -- rw [map_mul, map_zpow, hPrime, hUnit, -- IsNonarchimedeanLocalField.valuationMap_ofMul_mul, -- IsNonarchimedeanLocalField.valuationMap_ofMul_zpow, -- rationalPrimeFinitePlaceFieldUnit_valuationMap, -- rationalPrimeUnitFinitePlaceField_valuationMap] -- ring -- --/-- The principal finite component of the rational prime itself has --normalized local exponent `-1`. -/ --theorem rationalPrimePrincipalFiniteComponent_valuationMap -- (q : Nat.Primes) : -- IsNonarchimedeanLocalField.valuationMap -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime q)).Completion -- (Additive.ofMul -- ((finitePlaceCompletionUnitsContinuousMulEquiv -- (RayClass.rationalPrime q)).symm -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime q) -- (IdeleGroup.principalIdele ℚ -- (rationalPrimeGeneratorUnit q))))) = -- -1 := by -- rw [rationalPrincipalFiniteComponent_valuationMap, -- rationalPrimeGeneratorUnit_coe, -- padicValRat.self q.2.one_lt] -- --/-- A cyclotomic automorphism which raises the selected primitive root to --the `q`-th power has cyclotomic character equal to the residue-prime unit. -/ --private theorem rationalCyclotomicLevel_galEquivZMod_eq_unitOfCoprime -- (m : ℕ+) (q : Nat.Primes) -- (hq : ¬ q.1 ∣ (m : ℕ)) -- (σ : KummerTheory.rationalCyclotomicLevel m ≃ₐ[ℚ] -- KummerTheory.rationalCyclotomicLevel m) -- (hσ : -- σ (rationalCyclotomicLevelPrimitiveRoot m) = -- rationalCyclotomicLevelPrimitiveRoot m ^ q.1) : -- IsCyclotomicExtension.Rat.galEquivZMod -- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ = -- ZMod.unitOfCoprime q.1 -- (q.2.coprime_iff_not_dvd.mpr hq) := by -- let ζ := rationalCyclotomicLevelPrimitiveRoot m -- have hζ : IsPrimitiveRoot ζ (m : ℕ) := -- rationalCyclotomicLevelPrimitiveRoot_isPrimitiveRoot m -- have hCharacterRoot : -- σ ζ = -- ζ ^ -- (IsCyclotomicExtension.Rat.galEquivZMod -- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ).val.val := -- IsCyclotomicExtension.Rat.galEquivZMod_apply_of_pow_eq -- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ -- hζ.pow_eq_one -- have hPowers : -- ζ ^ -- (IsCyclotomicExtension.Rat.galEquivZMod -- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ).val.val = -- ζ ^ q.1 := -- hCharacterRoot.symm.trans hσ -- rw [(hζ.isOfFinOrder m.ne_zero).pow_inj_mod, -- ← hζ.eq_orderOf, -- ← ZMod.natCast_eq_natCast_iff', -- ZMod.natCast_val] at hPowers -- apply Units.ext -- simpa using hPowers -- --private abbrev rationalCyclotomicArtinPlace (q : Nat.Primes) : -- HeightOneSpectrum (𝓞 ℚ) := -- RayClass.rationalPrime q -- --private abbrev rationalCyclotomicArtinBaseAbv (q : Nat.Primes) : -- AbsoluteValue ℚ ℝ := -- HeightOneSpectrum.adicAbv ℚ (rationalCyclotomicArtinPlace q) -- --private abbrev rationalCyclotomicArtinLevel (m : ℕ+) := -- KummerTheory.rationalCyclotomicLevel m -- --private abbrev rationalCyclotomicArtinExtension -- (m : ℕ+) (q : Nat.Primes) : -- AbsoluteValueExtension -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinLevel m) := -- chosenFinitePlaceExtension -- (L := rationalCyclotomicArtinLevel m) -- (rationalCyclotomicArtinPlace q) -- --private abbrev rationalCyclotomicArtinLocalizedField -- (m : ℕ+) (q : Nat.Primes) := -- AlgebraicNumberTheory.Valuations.LocalizedCompletion -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q) -- --@[reducible] --noncomputable local instance rationalCyclotomicArtinExtensionAlgebra -- (m : ℕ+) (q : Nat.Primes) : -- Algebra ℚ -- (rationalCyclotomicArtinExtension m q).1.Completion := -- AbsoluteValue.extensionCompletionAlgebra -- (K := ℚ) (rationalCyclotomicArtinExtension m q).1 -- --@[reducible] --noncomputable local instance rationalCyclotomicArtinExtensionSMul -- (m : ℕ+) (q : Nat.Primes) : -- SMul ℚ -- (rationalCyclotomicArtinExtension m q).1.Completion := -- (rationalCyclotomicArtinExtensionAlgebra m q).toSMul -- --@[reducible] --noncomputable local instance -- rationalCyclotomicArtinCompletionAlgebra -- (m : ℕ+) (q : Nat.Primes) : -- Algebra (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinExtension m q).1.Completion := -- AbsoluteValue.completionAlgebra -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q).1 -- (rationalCyclotomicArtinExtension m q).2 -- --@[reducible] --noncomputable local instance rationalCyclotomicArtinLocalizedAlgebra -- (m : ℕ+) (q : Nat.Primes) : -- Algebra (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinLocalizedField m q) := -- finitePlaceLocalArtinLocalizedAlgebra -- (K := ℚ) (L := rationalCyclotomicArtinLevel m) -- (rationalCyclotomicArtinPlace q) -- (rationalCyclotomicArtinExtension m q) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedGlobalAlgebra -- (m : ℕ+) (q : Nat.Primes) : -- Algebra ℚ (rationalCyclotomicArtinLocalizedField m q) := -- LocalClassFieldTheory.localizedCompletionGlobalAlgebra -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedGlobalSMul -- (m : ℕ+) (q : Nat.Primes) : -- SMul ℚ (rationalCyclotomicArtinLocalizedField m q) := -- (rationalCyclotomicArtinLocalizedGlobalAlgebra m q).toSMul -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedScalarTower -- (m : ℕ+) (q : Nat.Primes) : -- IsScalarTower ℚ -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinLocalizedField m q) := by -- constructor -- intro r x y -- simp only [Algebra.smul_def, map_mul, eq_ratCast, -- map_ratCast, mul_assoc] -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedFiniteDimensional -- (m : ℕ+) (q : Nat.Primes) : -- FiniteDimensional -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinLocalizedField m q) := -- finitePlaceLocalArtinFiniteDimensional -- (K := ℚ) (L := rationalCyclotomicArtinLevel m) -- (rationalCyclotomicArtinPlace q) -- (rationalCyclotomicArtinExtension m q) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIsAbelianGalois -- (m : ℕ+) (q : Nat.Primes) : -- IsAbelianGalois -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinLocalizedField m q) := -- finitePlaceLocalArtinIsAbelianGalois -- (K := ℚ) (L := rationalCyclotomicArtinLevel m) -- (rationalCyclotomicArtinPlace q) -- (rationalCyclotomicArtinExtension m q) -- (inferInstance : -- FiniteDimensional ℚ (rationalCyclotomicArtinLevel m)) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIsSeparable -- (m : ℕ+) (q : Nat.Primes) : -- Algebra.IsSeparable -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinLocalizedField m q) := -- (rationalCyclotomicArtinLocalizedIsAbelianGalois m q).toIsGalois.to_isSeparable -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIsCyclotomic -- (m : ℕ+) (q : Nat.Primes) : -- IsCyclotomicExtension {(m : ℕ)} -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinLocalizedField m q) := -- rationalCyclotomicLevel_localizedCompletion_isCyclotomicExtension -- m (rationalCyclotomicArtinPlace q) -- --noncomputable local instance -- rationalCyclotomicArtinExtensionFiniteDimensional -- (m : ℕ+) (q : Nat.Primes) : -- FiniteDimensional -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinExtension m q).1.Completion := -- completionModuleFinite -- (rationalCyclotomicArtinBaseAbv q) -- (RayClass.adicAbv_isNontrivial -- (rationalCyclotomicArtinPlace q)) -- (rationalCyclotomicArtinExtension m q) -- --noncomputable local instance -- rationalCyclotomicArtinExtensionContinuousSMul -- (m : ℕ+) (q : Nat.Primes) : -- ContinuousSMul -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinExtension m q).1.Completion := -- continuousSMul_of_algebraMap _ _ -- (AbsoluteValue.completionMap_isometry -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q).1 -- (rationalCyclotomicArtinExtension m q).2).continuous -- --noncomputable local instance -- rationalCyclotomicArtinExtensionLocallyCompact -- (m : ℕ+) (q : Nat.Primes) : -- LocallyCompactSpace -- (rationalCyclotomicArtinExtension m q).1.Completion := -- LocallyCompactSpace.of_finiteDimensional_of_complete -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinExtension m q).1.Completion -- --private noncomputable def -- rationalCyclotomicArtinLocalizedEquivCompletion -- (m : ℕ+) (q : Nat.Primes) : -- rationalCyclotomicArtinLocalizedField m q ≃ᵢ -- (rationalCyclotomicArtinExtension m q).1.Completion := -- { toEquiv := -- (localizedCompletionEquivCompletion -- (rationalCyclotomicArtinBaseAbv q) -- (RayClass.adicAbv_isNontrivial -- (rationalCyclotomicArtinPlace q)) -- (rationalCyclotomicArtinExtension m q)).toEquiv -- isometry_toFun := -- Isometry.of_dist_eq fun _ _ => rfl } -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedLocallyCompact -- (m : ℕ+) (q : Nat.Primes) : -- LocallyCompactSpace -- (rationalCyclotomicArtinLocalizedField m q) := -- ((rationalCyclotomicArtinLocalizedEquivCompletion m q).toHomeomorph.locallyCompactSpace_iff).2 -- inferInstance -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIsUltrametricDist -- (m : ℕ+) (q : Nat.Primes) : -- IsUltrametricDist -- (rationalCyclotomicArtinLocalizedField m q) := -- localizedCompletionIsUltrametricDist -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q) -- (HeightOneSpectrum.isNonarchimedean_adicAbv -- ℚ (rationalCyclotomicArtinPlace q)) -- --noncomputable local instance rationalCyclotomicArtinLocalizedValued -- (m : ℕ+) (q : Nat.Primes) : -- Valued (rationalCyclotomicArtinLocalizedField m q) ℝ≥0 := -- localizedCompletionFinitePlaceValued -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q) -- (HeightOneSpectrum.isNonarchimedean_adicAbv -- ℚ (rationalCyclotomicArtinPlace q)) -- --@[reducible] --noncomputable local instance -- rationalCyclotomicArtinLocalizedValuativeRel -- (m : ℕ+) (q : Nat.Primes) : -- ValuativeRel (rationalCyclotomicArtinLocalizedField m q) := -- localizedCompletionFinitePlaceValuativeRel -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q) -- (HeightOneSpectrum.isNonarchimedean_adicAbv -- ℚ (rationalCyclotomicArtinPlace q)) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedValuationCompatible -- (m : ℕ+) (q : Nat.Primes) : -- (Valued.v : Valuation -- (rationalCyclotomicArtinLocalizedField m q) ℝ≥0).Compatible := -- Valuation.Compatible.ofValuation _ -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedValuationHasExtension -- (m : ℕ+) (q : Nat.Primes) : -- Valuation.HasExtension -- (ValuativeRel.valuation -- (rationalCyclotomicArtinBaseAbv q).Completion) -- (ValuativeRel.valuation -- (rationalCyclotomicArtinLocalizedField m q)) := -- localizedCompletionValuationHasExtension -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q) -- (HeightOneSpectrum.isNonarchimedean_adicAbv -- ℚ (rationalCyclotomicArtinPlace q)) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedValuationIsNontrivial -- (m : ℕ+) (q : Nat.Primes) : -- (ValuativeRel.valuation -- (rationalCyclotomicArtinLocalizedField m q)).IsNontrivial := -- Valuation.IsNontrivial.of_hasExtension -- (ValuativeRel.valuation -- (rationalCyclotomicArtinBaseAbv q).Completion) -- (ValuativeRel.valuation -- (rationalCyclotomicArtinLocalizedField m q)) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial -- (m : ℕ+) (q : Nat.Primes) : -- ValuativeRel.IsNontrivial -- (rationalCyclotomicArtinLocalizedField m q) := -- (ValuativeRel.isNontrivial_iff_isNontrivial -- (ValuativeRel.valuation -- (rationalCyclotomicArtinLocalizedField m q))).2 inferInstance -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIsValuativeTopology -- (m : ℕ+) (q : Nat.Primes) : -- IsValuativeTopology -- (rationalCyclotomicArtinLocalizedField m q) := -- isValuativeTopology_of_valued_ofValuation -- (rationalCyclotomicArtinLocalizedField m q) ℝ≥0 -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField -- (m : ℕ+) (q : Nat.Primes) : -- IsNonarchimedeanLocalField -- (rationalCyclotomicArtinLocalizedField m q) := -- { toIsValuativeTopology := inferInstance -- toLocallyCompactSpace := inferInstance -- toIsNontrivial := inferInstance } -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIntegerAlgebra -- (m : ℕ+) (q : Nat.Primes) : -- Algebra -- 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] -- (rationalCyclotomicArtinLocalizedField m q) := -- Algebra.ofSubsemiring -- 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIsIntegralClosure -- (m : ℕ+) (q : Nat.Primes) : -- IsIntegralClosure -- 𝒪[rationalCyclotomicArtinLocalizedField m q] -- 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] -- (rationalCyclotomicArtinLocalizedField m q) := -- localizedCompletionIsIntegralClosureWithExtension -- (rationalCyclotomicArtinBaseAbv q) -- (rationalCyclotomicArtinExtension m q) -- (RayClass.adicAbv_isNontrivial -- (rationalCyclotomicArtinPlace q)) -- (HeightOneSpectrum.isNonarchimedean_adicAbv -- ℚ (rationalCyclotomicArtinPlace q)) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedIntegerModuleFinite -- (m : ℕ+) (q : Nat.Primes) : -- Module.Finite -- 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] -- 𝒪[rationalCyclotomicArtinLocalizedField m q] := -- integerRing_moduleFinite_of_isIntegralClosure -- (rationalCyclotomicArtinBaseAbv q).Completion -- (rationalCyclotomicArtinLocalizedField m q) -- --section RationalCyclotomicPrincipalPrime -- --/-! ## Ramified prime-power transport -- --This section reuses the canonical finite-place Artin tower above. In --particular, it introduces no parallel completion/localization instance tower. -/ -- --noncomputable local instance -- rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension -- (p : Nat.Primes) (n : ℕ) : -- IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ -- (KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) := by -- change -- IsCyclotomicExtension -- {(rationalCyclotomicPrincipalPrimeModulus p n : ℕ)} ℚ -- (KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- exact -- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension -- (rationalCyclotomicPrincipalPrimeModulus p n) -- --private abbrev rationalCyclotomicPrincipalPrimePlace -- (p : Nat.Primes) : HeightOneSpectrum (𝓞 ℚ) := -- rationalCyclotomicArtinPlace p -- --private abbrev rationalCyclotomicPrincipalPrimeLevel -- (m : ℕ+) := -- rationalCyclotomicArtinLevel m -- --private abbrev rationalCyclotomicPrincipalPrimeExtension -- (m : ℕ+) (p : Nat.Primes) := -- rationalCyclotomicArtinExtension m p -- --/-- The `ℚ_[p]`-algebra structure on the localized cyclotomic completion, --transported through the canonical comparison with the `p`-adic completion. -/ --@[reducible] --noncomputable def -- rationalCyclotomicPrincipalPrimeLocalizedPadicAlgebra -- (m : ℕ+) (p : Nat.Primes) : -- Algebra ℚ_[p.1] -- (rationalCyclotomicLocalizedCompletion m -- (RayClass.rationalPrime p)) := -- ((algebraMap -- (HeightOneSpectrum.adicAbv ℚ -- (RayClass.rationalPrime p)).Completion -- (rationalCyclotomicLocalizedCompletion m -- (RayClass.rationalPrime p))).comp -- (rationalFinitePlaceCompletionRingEquivPadic p).symm.toRingHom).toAlgebra -- --@[reducible] --noncomputable local instance -- rationalCyclotomicArtinLocalizedPadicAlgebra -- (m : ℕ+) (p : Nat.Primes) : -- Algebra ℚ_[p.1] (rationalCyclotomicArtinLocalizedField m p) := -- rationalCyclotomicPrincipalPrimeLocalizedPadicAlgebra m p -- --private noncomputable def rationalFinitePlaceCompletionAlgEquivPadic -- (p : Nat.Primes) : -- (rationalCyclotomicArtinBaseAbv p).Completion ≃ₐ[ℚ] ℚ_[p.1] := -- AlgEquiv.ofRingEquiv -- (f := rationalFinitePlaceCompletionRingEquivPadic p) -- (rationalFinitePlaceCompletionRingEquivPadic_algebraMap p) -- --noncomputable local instance -- rationalCyclotomicArtinLocalizedPadicScalarTower -- (m : ℕ+) (p : Nat.Primes) : -- IsScalarTower ℚ ℚ_[p.1] -- (rationalCyclotomicArtinLocalizedField m p) := by -- constructor -- intro r x y -- simp only [Algebra.smul_def, map_mul, eq_ratCast, -- map_ratCast, mul_assoc] -- --private theorem rationalCyclotomicArtin_padic_algebraMap -- (m : ℕ+) (p : Nat.Primes) : -- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -- (rationalCyclotomicArtinLocalizedField m p) = -- (algebraMap ℚ_[p.1] -- (rationalCyclotomicArtinLocalizedField m p)) ∘ -- (rationalFinitePlaceCompletionAlgEquivPadic p) := by -- funext a -- change -- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -- (rationalCyclotomicArtinLocalizedField m p) a = -- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -- (rationalCyclotomicArtinLocalizedField m p) -- ((rationalFinitePlaceCompletionRingEquivPadic p).symm -- (rationalFinitePlaceCompletionRingEquivPadic p a)) -- exact -- congrArg -- (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -- (rationalCyclotomicArtinLocalizedField m p)) -- ((rationalFinitePlaceCompletionRingEquivPadic p).symm_apply_apply a).symm -- --private theorem rationalCyclotomicArtin_algebraAdjoin_restrictScalars -- (m : ℕ+) (p : Nat.Primes) : -- (Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion -- ({rationalCyclotomicLocalizedPrimitiveRoot m -- (rationalCyclotomicArtinPlace p)} : -- Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = -- (Algebra.adjoin ℚ_[p.1] -- ({rationalCyclotomicLocalizedPrimitiveRoot m -- (rationalCyclotomicArtinPlace p)} : -- Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ := by -- exact -- Algebra.restrictScalars_adjoin_of_algEquiv -- (E := rationalCyclotomicArtinLocalizedField m p) -- (rationalFinitePlaceCompletionAlgEquivPadic p) -- (rationalCyclotomicArtin_padic_algebraMap m p) -- ({rationalCyclotomicLocalizedPrimitiveRoot m -- (rationalCyclotomicArtinPlace p)} : -- Set (rationalCyclotomicArtinLocalizedField m p)) -- --private theorem -- rationalCyclotomicArtin_baseAlgebraAdjoin_restrict_eq_top -- (m : ℕ+) (p : Nat.Primes) : -- (Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion -- ({rationalCyclotomicLocalizedPrimitiveRoot m -- (rationalCyclotomicArtinPlace p)} : -- Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = -- (⊤ : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion -- (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := by -- have hRoot : IsPrimitiveRoot -- (show rationalCyclotomicArtinLocalizedField m p from -- rationalCyclotomicLocalizedPrimitiveRoot m -- (rationalCyclotomicArtinPlace p)) -- (m : ℕ) := -- rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot -- m (rationalCyclotomicArtinPlace p) -- have hTop : -- Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion -- ({rationalCyclotomicLocalizedPrimitiveRoot m -- (rationalCyclotomicArtinPlace p)} : -- Set (rationalCyclotomicArtinLocalizedField m p)) = ⊤ := -- IsCyclotomicExtension.adjoin_primitive_root_eq_top -- (A := (rationalCyclotomicArtinBaseAbv p).Completion) -- (B := rationalCyclotomicArtinLocalizedField m p) hRoot -- exact congrArg -- (fun A : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion -- (rationalCyclotomicArtinLocalizedField m p) => A.restrictScalars ℚ) -- hTop -- --private theorem rationalCyclotomicArtin_restrictScalars_top_base_eq_padic -- (m : ℕ+) (p : Nat.Primes) : -- (⊤ : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion -- (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ = -- (⊤ : Subalgebra ℚ_[p.1] -- (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := -- (Subalgebra.restrictScalars_top ℚ).trans -- (Subalgebra.restrictScalars_top ℚ).symm -- --private theorem -- rationalCyclotomicArtin_padicAlgebraAdjoin_restrict_eq_top -- (m : ℕ+) (p : Nat.Primes) : -- (Algebra.adjoin ℚ_[p.1] -- ({rationalCyclotomicLocalizedPrimitiveRoot m -- (rationalCyclotomicArtinPlace p)} : -- Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = -- (⊤ : Subalgebra ℚ_[p.1] -- (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := by -- exact -- (rationalCyclotomicArtin_algebraAdjoin_restrictScalars m p).symm.trans -- ((rationalCyclotomicArtin_baseAlgebraAdjoin_restrict_eq_top m p).trans -- (rationalCyclotomicArtin_restrictScalars_top_base_eq_padic m p)) -+noncomputable section - --/-- The finite-dimensional instance for the standard multiplicative level, --named once so all consumers use the same proof term. -/ --theorem rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional -- (p : Nat.Primes) (n : ℕ) : -- FiniteDimensional ℚ_[p.1] -- (standardLubinTateLevelField -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) := -- standardLubinTateLevelField_finiteDimensional -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -+namespace GlobalClassFieldTheory -+namespace Reciprocity - - attribute [local instance] -- rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional -- --noncomputable local instance -- rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois -- (p : Nat.Primes) (n : ℕ) : -- IsAbelianGalois ℚ_[p.1] -- (RationalCyclotomicPrincipalPrimePadicLevel p n) := -- standardLubinTateLevelField_isAbelianGalois -- (padicLocalField p.1) -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -- --@[reducible] --noncomputable local instance rationalPrimeFactorCompletionPadicAlgebra -- (p : Nat.Primes) : -- Algebra (RationalCyclotomicPrincipalPrimeCompletion p) ℚ_[p.1] := -- (rationalFinitePlaceCompletionRingEquivPadic p).toRingHom.toAlgebra -- --/-- The genuine multiplicative Lubin--Tate level is generated by its --primitive `p ^ (n + 1)`-st root of unity. -/ --theorem padicMultiplicativePrimitiveRoot_adjoin_eq_top -- (p : ℕ) [Fact p.Prime] (n : ℕ) : -- let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p -- let T := standardLubinTateLevelField hπ n -- Algebra.adjoin ℚ_[p] -- ({padicMultiplicativePrimitiveRoot p n} : Set T) = -- ⊤ := by -- let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p -- let T := standardLubinTateLevelField hπ n -- let ζ : T := padicMultiplicativePrimitiveRoot p n -- let m := p ^ (n + 1) -- let : NeZero m := -- ⟨pow_ne_zero _ (Fact.out : Nat.Prime p).ne_zero⟩ -- let : FiniteDimensional ℚ_[p] T := -- standardLubinTateLevelField_finiteDimensional hπ n -- have hζ : IsPrimitiveRoot ζ m := by -- simpa only [ζ, m] using -- padicMultiplicativePrimitiveRoot_isPrimitiveRoot p n -- let A : IntermediateField ℚ_[p] T := -- IntermediateField.adjoin ℚ_[p] {ζ} -- let : IsCyclotomicExtension {m} ℚ_[p] A := -- hζ.intermediateField_adjoin_isCyclotomicExtension ℚ_[p] -- have hAfin : -- Module.finrank ℚ_[p] A = Nat.totient m := by -- exact -- IsCyclotomicExtension.finrank A -- (by -- simpa only [m] using -- padicCyclotomicPolynomial_irreducible_prime_pow_succ -- p n) -- have hTfin : -- Module.finrank ℚ_[p] T = Nat.totient m := by -- rw [standardLubinTateLevelField_finrank hπ n] -- have hcard : -- Nat.card (padicLocalField p).residueField = p := by -- simpa [padicLocalField] using -- padicCompleteDVF_residueField_card p -- rw [hcard, Nat.totient_prime_pow -- (Fact.out : Nat.Prime p) (Nat.succ_pos n)] -- simp [Nat.mul_comm] -- have hAeq : A = ⊤ := by -- apply IntermediateField.eq_of_le_of_finrank_eq le_top -- simpa using hAfin.trans hTfin.symm -- calc -- Algebra.adjoin ℚ_[p] {ζ} = A.toSubalgebra := by -- exact -- (IntermediateField.adjoin_toSubalgebra -- ({ζ} : Set T)).symm -- _ = (⊤ : IntermediateField ℚ_[p] T).toSubalgebra := -- congrArg IntermediateField.toSubalgebra hAeq -- _ = ⊤ := rfl -- --/-- The standard multiplicative Lubin--Tate level is the actual --`p ^ (n + 1)`-cyclotomic extension of `ℚ_p`. -/ --theorem padicMultiplicativeLevel_isCyclotomicExtension -- (p : ℕ) [Fact p.Prime] (n : ℕ) : -- let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p -- let T := standardLubinTateLevelField hπ n -- IsCyclotomicExtension {p ^ (n + 1)} ℚ_[p] T := by -- let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p -- let T := standardLubinTateLevelField hπ n -- exact -- padic_isCyclotomicExtension_of_primitiveRoot_adjoin_eq_top -- (padicMultiplicativePrimitiveRoot p n) -- (padicMultiplicativePrimitiveRoot_isPrimitiveRoot p n) -- (padicMultiplicativePrimitiveRoot_adjoin_eq_top p n) -- --private theorem -- rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_isPrimitiveRoot -- (p : Nat.Primes) (n : ℕ) : -- IsPrimitiveRoot -- (rationalCyclotomicLocalizedPrimitiveRoot -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p)) -- (p.1 ^ (n + 1)) := by -- change -- IsPrimitiveRoot -- (rationalCyclotomicLocalizedPrimitiveRoot -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p)) -- (rationalCyclotomicPrincipalPrimeModulus p n : ℕ) -- exact -- rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p) -- --private theorem -- rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_adjoin_eq_top -- (p : Nat.Primes) (n : ℕ) : -- Algebra.adjoin ℚ_[p.1] -- ({rationalCyclotomicLocalizedPrimitiveRoot -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (rationalCyclotomicArtinPlace p)} : -- Set (rationalCyclotomicArtinLocalizedField -- (rationalCyclotomicPrincipalPrimeModulus p n) p)) = -- ⊤ := by -- exact -- (Subalgebra.restrictScalars_injective ℚ) -- (rationalCyclotomicArtin_padicAlgebraAdjoin_restrict_eq_top -- (rationalCyclotomicPrincipalPrimeModulus p n) p) -- --private theorem -- rationalCyclotomicPrincipalPrimeLocalizedLevel_isCyclotomicExtension -- (p : Nat.Primes) (n : ℕ) : -- IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] -- (rationalCyclotomicArtinLocalizedField -- (rationalCyclotomicPrincipalPrimeModulus p n) p) := by -- exact -- padic_isCyclotomicExtension_of_primitiveRoot_adjoin_eq_top -- (rationalCyclotomicLocalizedPrimitiveRoot -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (rationalCyclotomicArtinPlace p)) -- (rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_isPrimitiveRoot -- p n) -- (rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_adjoin_eq_top -- p n) -- --/-- The chosen localized global cyclotomic level, transported over the --completion equivalence, is the standard multiplicative Lubin--Tate level. -/ --noncomputable def rationalCyclotomicLocalizedCompletionPadicAlgEquiv -- (p : Nat.Primes) (n : ℕ) : -- rationalCyclotomicArtinLocalizedField -- (rationalCyclotomicPrincipalPrimeModulus p n) p ≃ₐ[ℚ_[p.1]] -- RationalCyclotomicPrincipalPrimePadicLevel p n := by -- letI : IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] -- (rationalCyclotomicArtinLocalizedField -- (rationalCyclotomicPrincipalPrimeModulus p n) p) := -- rationalCyclotomicPrincipalPrimeLocalizedLevel_isCyclotomicExtension p n -- letI : IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] -- (RationalCyclotomicPrincipalPrimePadicLevel p n) := -- padicMultiplicativeLevel_isCyclotomicExtension p.1 n -- exact -- IsCyclotomicExtension.algEquiv -- {p.1 ^ (n + 1)} ℚ_[p.1] -- (rationalCyclotomicArtinLocalizedField -- (rationalCyclotomicPrincipalPrimeModulus p n) p) -- (RationalCyclotomicPrincipalPrimePadicLevel p n) -- --/-! ## The ramified principal finite-place factor -/ -- --private theorem -- rationalCyclotomicPrincipalPrime_galEquivZMod_eq_of_action -- (p : Nat.Primes) (n : ℕ) -- (sigma : Gal( -- rationalCyclotomicPrincipalPrimeLevel -- (rationalCyclotomicPrincipalPrimeModulus p n) / ℚ)) -- (a : (ZMod (p.1 ^ (n + 1)))ˣ) -- (haction : -- sigma (rationalCyclotomicLevelPrimitiveRoot -- (rationalCyclotomicPrincipalPrimeModulus p n)) = -- rationalCyclotomicLevelPrimitiveRoot -- (rationalCyclotomicPrincipalPrimeModulus p n) ^ a.val.val) : -- IsCyclotomicExtension.Rat.galEquivZMod -- (p.1 ^ (n + 1)) -- (rationalCyclotomicPrincipalPrimeLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (hK := -- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension -- (rationalCyclotomicPrincipalPrimeModulus p n)) sigma = -- a := by -- let m := rationalCyclotomicPrincipalPrimeModulus p n -- let L := rationalCyclotomicPrincipalPrimeLevel m -- let zeta : L := rationalCyclotomicLevelPrimitiveRoot m -- have hzeta : IsPrimitiveRoot zeta (p.1 ^ (n + 1)) := by -- change -- IsPrimitiveRoot -- (rationalCyclotomicLevelPrimitiveRoot m) (m : ℕ) -- exact rationalCyclotomicLevelPrimitiveRoot_isPrimitiveRoot m -- change -- IsCyclotomicExtension.Rat.galEquivZMod -- (p.1 ^ (n + 1)) L -- (hK := -- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) -- sigma = a -- let c := -- IsCyclotomicExtension.Rat.galEquivZMod -- (p.1 ^ (n + 1)) L -- (hK := -- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) -- sigma -- have hc : -- sigma zeta = zeta ^ c.val.val := -- IsCyclotomicExtension.Rat.galEquivZMod_apply_of_pow_eq -- (hK := -- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) -- (p.1 ^ (n + 1)) L sigma hzeta.pow_eq_one -- have hpowers : -- zeta ^ c.val.val = zeta ^ a.val.val := -- hc.symm.trans haction -- rw [(hzeta.isOfFinOrder m.ne_zero).pow_inj_mod, -- ← hzeta.eq_orderOf, -- ← ZMod.natCast_eq_natCast_iff'] at hpowers -- change -- (c.val.val : ZMod (p.1 ^ (n + 1))) = -- (a.val.val : ZMod (p.1 ^ (n + 1))) at hpowers -- have hValues : c.val = a.val := by -- calc -- c.val = (c.val.val : ZMod (p.1 ^ (n + 1))) := -- (ZMod.natCast_zmod_val c.val).symm -- _ = (a.val.val : ZMod (p.1 ^ (n + 1))) := hpowers -- _ = a.val := ZMod.natCast_zmod_val a.val -- change c = a -- apply Units.ext -- exact hValues -- --/-- The chosen finite-place Artin map factors through any extension identified --with the chosen one. -/ --theorem chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq -- {K L : Type} -- [Field K] [NumberField K] -- [Field L] [Algebra K L] -- [FiniteDimensional K L] [IsAbelianGalois K L] -- (v : HeightOneSpectrum (𝓞 K)) -- (w : AbsoluteValueExtension -- (HeightOneSpectrum.adicAbv K v) L) -- (hw : chosenFinitePlaceExtension (L := L) v = w) -- (x : (v.adicCompletion K)ˣ) : -- chosenFinitePlaceArtinMonoidHom -- (K := K) (L := L) v x = -- finitePlaceLocalToGlobalMonoidHom -- (K := K) (L := L) v w -- (finitePlaceLocalArtinMonoidHom -- (K := K) (L := L) v w x) := by -- subst w -- exact -- congrArg -- (fun f : (v.adicCompletion K)ˣ →* (L ≃ₐ[K] L) => f x) -- (finitePlaceArtinMonoidHomOfExtension_factor -- (K := K) (L := L) v -- (chosenFinitePlaceExtension (L := L) v)) -- --private theorem -- chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq_at -- {K L : Type} -- [Field K] [NumberField K] -- [Field L] [Algebra K L] -- [FiniteDimensional K L] [IsAbelianGalois K L] -- (v : HeightOneSpectrum (𝓞 K)) -- (w : AbsoluteValueExtension -- (HeightOneSpectrum.adicAbv K v) L) -- (hw : chosenFinitePlaceExtension (L := L) v = w) -- (x : (v.adicCompletion K)ˣ) (z : L) : -- chosenFinitePlaceArtinMonoidHom -- (K := K) (L := L) v x z = -- finitePlaceLocalToGlobalMonoidHom -- (K := K) (L := L) v w -- (finitePlaceLocalArtinMonoidHom -- (K := K) (L := L) v w x) z := by -- exact -- congrArg (fun sigma : Gal(L / K) => sigma z) -- (chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq -- (K := K) (L := L) v w hw x) -- --private theorem finitePlaceLocalToGlobalMonoidHom_apply_pow_of_localized_action -- {K L : Type} -- [Field K] [NumberField K] -- [Field L] [Algebra K L] -- [FiniteDimensional K L] [IsAbelianGalois K L] -- (v : HeightOneSpectrum (𝓞 K)) -- (w : AbsoluteValueExtension -- (HeightOneSpectrum.adicAbv K v) L) -- (sigma : -- let vK := HeightOneSpectrum.adicAbv K v -- let E := LocalizedCompletion vK w -- letI : Algebra vK.Completion E := -- finitePlaceLocalArtinLocalizedAlgebra v w -- Gal(E / vK.Completion)) -- (z : L) -- (zLocal : -- let vK := HeightOneSpectrum.adicAbv K v -- LocalizedCompletion vK w) -- (e : ℕ) -- (hLocalization : -- let vK := HeightOneSpectrum.adicAbv K v -- let E := LocalizedCompletion vK w -- letI : Algebra vK.Completion E := -- finitePlaceLocalArtinLocalizedAlgebra v w -- let eLoc : L →+* E := -- AbsoluteValue.toAlgebraicLocalization vK w.1 w.2 -- eLoc z = zLocal) -- (hlocal : sigma zLocal = zLocal ^ e) : -- finitePlaceLocalToGlobalMonoidHom -- (K := K) (L := L) v w sigma z = z ^ e := by -- let vK := HeightOneSpectrum.adicAbv K v -- let hvK : vK.IsNontrivial := RayClass.adicAbv_isNontrivial v -- let E := LocalizedCompletion vK w -- let : Algebra vK.Completion E := -- finitePlaceLocalArtinLocalizedAlgebra v w -- let eD : absoluteValueDecompositionGroup K w.1 ≃* Gal(E / vK.Completion) := -- decompositionGroupEquivAlgebraicLocalizationAut vK hvK w -- let eLoc : L →+* E := -- AbsoluteValue.toAlgebraicLocalization vK w.1 w.2 -- let delta : absoluteValueDecompositionGroup K w.1 := eD.symm sigma -- have hDecomposition : eD delta = sigma := eD.apply_symm_apply sigma -- apply eLoc.injective -- calc -- eLoc (finitePlaceLocalToGlobalMonoidHom -- (K := K) (L := L) v w sigma z) = -- eD delta (eLoc z) := -- (localizationRamificationGroups_decompositionGroupEquiv_toLocalization -- vK hvK w delta z).symm -- _ = sigma (eLoc z) := -- congrArg (fun tau : Gal(E / vK.Completion) => tau (eLoc z)) -- hDecomposition -- _ = sigma zLocal := -- congrArg (fun y : E => sigma y) hLocalization -- _ = zLocal ^ e := hlocal -- _ = (eLoc z) ^ e := -- congrArg (fun y : E => y ^ e) hLocalization.symm -- _ = eLoc (z ^ e) := (map_pow eLoc z e).symm -- --private theorem map_primitiveRoot_eq_pow_of_eq_pow -- {M : Type} [CommRing M] [IsDomain M] -- (f : M →* M) (zeta rho : M) (order exponent : ℕ) -- [NeZero order] -- (hzeta : IsPrimitiveRoot zeta order) -- (hrho : IsPrimitiveRoot rho order) -- (hf : f zeta = zeta ^ exponent) : -- f rho = rho ^ exponent := by -- obtain ⟨j, -, hj⟩ := -- hzeta.eq_pow_of_pow_eq_one hrho.pow_eq_one -- calc -- f rho = f (zeta ^ j) := congrArg f hj.symm -- _ = (f zeta) ^ j := map_pow f zeta j -- _ = (zeta ^ exponent) ^ j := congrArg (fun z => z ^ j) hf -- _ = zeta ^ (exponent * j) := (pow_mul zeta exponent j).symm -- _ = zeta ^ (j * exponent) := -- congrArg (fun e : ℕ => zeta ^ e) (Nat.mul_comm exponent j) -- _ = (zeta ^ j) ^ exponent := pow_mul zeta j exponent -- _ = rho ^ exponent := congrArg (fun z => z ^ exponent) hj -- --private theorem finitePlaceLocalArtinMonoidHom_apply_semilinear -- {K L K' L' : Type} -- [Field K] [NumberField K] -- [Field L] [Algebra K L] -- [hKLfinite : FiniteDimensional K L] [IsAbelianGalois K L] -- [Field K'] [ValuativeRel K'] [TopologicalSpace K'] -- [IsNonarchimedeanLocalField K'] -- [Field L'] [Algebra K' L'] -- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -- (v : HeightOneSpectrum (𝓞 K)) -- (w : AbsoluteValueExtension -- (HeightOneSpectrum.adicAbv K v) L) -- (eK : (HeightOneSpectrum.adicAbv K v).Completion ≃+* K') -- (eL : LocalizedCompletion -- (HeightOneSpectrum.adicAbv K v) w ≃+* L') -- (hcomm : ∀ y : (HeightOneSpectrum.adicAbv K v).Completion, -- eL (@algebraMap -- (HeightOneSpectrum.adicAbv K v).Completion -- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) -- _ _ (finitePlaceLocalArtinLocalizedAlgebra v w) y) = -- algebraMap K' L' (eK y)) -- (hExt : SemilinearValuationCompatible -- (HeightOneSpectrum.adicAbv K v).Completion K' eK) -- (x : (v.adicCompletion K)ˣ) -- (z : LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) : -- eL (finitePlaceLocalArtinMonoidHom -- (K := K) (L := L) v w x z) = -- LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' -- (Units.map eK.toMonoidHom -- (finitePlaceLocalArtinInput v x)) (eL z) := by -- calc -- eL (finitePlaceLocalArtinMonoidHom -- (K := K) (L := L) v w x z) = -- eL ((@LocalClassFieldTheory.abelianLocalArtinMonoidHom -- (HeightOneSpectrum.adicAbv K v).Completion -- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) -- (inferInstance : Field -- (HeightOneSpectrum.adicAbv K v).Completion) -- (inferInstance : Field -- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) -- (finitePlaceLocalArtinLocalizedAlgebra v w) -- (finitePlaceLocalArtinCompletionValuativeRel v) -- (inferInstance : TopologicalSpace -- (HeightOneSpectrum.adicAbv K v).Completion) -- (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) -- (finitePlaceLocalArtinFiniteDimensional v w) -- (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) -- (finitePlaceLocalArtinInput v x)) z) := -- congrArg eL -- (finitePlaceLocalArtinMonoidHom_apply_normalized_at -- (K := K) (L := L) v w x z) -- _ = LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' -- (Units.map eK.toMonoidHom -- (finitePlaceLocalArtinInput v x)) (eL z) := -- @abelianLocalArtinMonoidHom_semilinear_action -- (HeightOneSpectrum.adicAbv K v).Completion K' -- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) L' -- (inferInstance : Field -- (HeightOneSpectrum.adicAbv K v).Completion) -- (finitePlaceLocalArtinCompletionValuativeRel v) -- (inferInstance : TopologicalSpace -- (HeightOneSpectrum.adicAbv K v).Completion) -- (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) -- (inferInstance : Field K') -- (inferInstance : ValuativeRel K') -- (inferInstance : TopologicalSpace K') -- (inferInstance : IsNonarchimedeanLocalField K') -- (inferInstance : Field -- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) -- (inferInstance : Field L') -- (finitePlaceLocalArtinLocalizedAlgebra v w) -- (inferInstance : Algebra K' L') -- (finitePlaceLocalArtinFiniteDimensional v w) -- (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) -- (inferInstance : FiniteDimensional K' L') -- (inferInstance : IsAbelianGalois K' L') -- eK eL hcomm hExt (finitePlaceLocalArtinInput v x) z -- --/-- If a semilinearly identified target local Artin value is trivial, then the --corresponding global finite-place Artin value is trivial. This generic bridge --keeps concrete completion and localization instance towers out of downstream --proof terms. -/ --theorem finitePlaceArtinMonoidHomOfExtension_eq_one_of_semilinear -- {K L K' L' : Type} -- [Field K] [NumberField K] -- [Field L] [Algebra K L] -- [hKLfinite : FiniteDimensional K L] [IsAbelianGalois K L] -- [Field K'] [ValuativeRel K'] [TopologicalSpace K'] -- [IsNonarchimedeanLocalField K'] -- [Field L'] [Algebra K' L'] -- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -- (v : HeightOneSpectrum (𝓞 K)) -- (w : AbsoluteValueExtension -- (HeightOneSpectrum.adicAbv K v) L) -- (eK : (HeightOneSpectrum.adicAbv K v).Completion ≃+* K') -- (eL : LocalizedCompletion -- (HeightOneSpectrum.adicAbv K v) w ≃+* L') -- (hcomm : ∀ y : (HeightOneSpectrum.adicAbv K v).Completion, -- eL (@algebraMap -- (HeightOneSpectrum.adicAbv K v).Completion -- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) -- _ _ (finitePlaceLocalArtinLocalizedAlgebra v w) y) = -- algebraMap K' L' (eK y)) -- (hExt : SemilinearValuationCompatible -- (HeightOneSpectrum.adicAbv K v).Completion K' eK) -- (x : (v.adicCompletion K)ˣ) -- (htrivial : -- LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' -- (Units.map eK.toMonoidHom -- (finitePlaceLocalArtinInput v x)) = 1) : -- finitePlaceArtinMonoidHomOfExtension -- (K := K) (L := L) v w x = 1 := by -- rw [finitePlaceArtinMonoidHomOfExtension_factor, -- MonoidHom.comp_apply] -- have hlocal : -- finitePlaceLocalArtinMonoidHom -- (K := K) (L := L) v w x = 1 := by -- rw [finitePlaceLocalArtinMonoidHom_apply_normalized] -- exact -- @abelianLocalArtinMonoidHom_eq_one_of_semilinear -- (HeightOneSpectrum.adicAbv K v).Completion K' -- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) L' -- (inferInstance : Field -- (HeightOneSpectrum.adicAbv K v).Completion) -- (finitePlaceLocalArtinCompletionValuativeRel v) -- (inferInstance : TopologicalSpace -- (HeightOneSpectrum.adicAbv K v).Completion) -- (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) -- (inferInstance : Field K') -- (inferInstance : ValuativeRel K') -- (inferInstance : TopologicalSpace K') -- (inferInstance : IsNonarchimedeanLocalField K') -- (inferInstance : Field -- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) -- (inferInstance : Field L') -- (finitePlaceLocalArtinLocalizedAlgebra v w) -- (inferInstance : Algebra K' L') -- (finitePlaceLocalArtinFiniteDimensional v w) -- (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) -- (inferInstance : FiniteDimensional K' L') -- (inferInstance : IsAbelianGalois K' L') -- eK eL hcomm hExt (finitePlaceLocalArtinInput v x) htrivial -- rw [hlocal, map_one] -- --private noncomputable def rationalCyclotomicPrincipalPrimeLocalizedRoot -- (p : Nat.Primes) (n : ℕ) : -- rationalCyclotomicArtinLocalizedField -- (rationalCyclotomicPrincipalPrimeModulus p n) p := -- rationalCyclotomicLocalizedPrimitiveRoot -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p) -- --private noncomputable def rationalCyclotomicPrincipalPrimeResidueUnit -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- (ZMod (p.1 ^ (n + 1)))ˣ := -- Units.map -- (PadicInt.toZModPow (p := p.1) (n + 1)).toMonoidHom -- (padicIntUnitOfRat p -- (rationalPrimeUnit x p : ℚ) -- (rationalPrimeUnit x p).ne_zero -- (padicValRat_rationalPrimeUnit x p)) -- --private theorem rationalCyclotomicPrincipalPrime_localizedBase_commutes -- (p : Nat.Primes) (n : ℕ) -- (y : (rationalCyclotomicArtinBaseAbv p).Completion) : -- rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -- (rationalCyclotomicArtinLocalizedField -- (rationalCyclotomicPrincipalPrimeModulus p n) p) y) = -- algebraMap ℚ_[p.1] -- (RationalCyclotomicPrincipalPrimePadicLevel p n) -- (rationalFinitePlaceCompletionRingEquivPadic p y) := by -- let m := rationalCyclotomicPrincipalPrimeModulus p n -- let E := rationalCyclotomicArtinLocalizedField m p -- let eL := rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- have hy : -- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y = -- algebraMap ℚ_[p.1] E -- (rationalFinitePlaceCompletionRingEquivPadic p y) := by -- change -- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y = -- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E -- ((rationalFinitePlaceCompletionRingEquivPadic p).symm -- (rationalFinitePlaceCompletionRingEquivPadic p y)) -- exact -- (congrArg -- (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E) -- ((rationalFinitePlaceCompletionRingEquivPadic p).symm_apply_apply y)).symm -- calc -- eL (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y) = -- eL (algebraMap ℚ_[p.1] E -- (rationalFinitePlaceCompletionRingEquivPadic p y)) := -- congrArg eL hy -- _ = algebraMap ℚ_[p.1] -- (RationalCyclotomicPrincipalPrimePadicLevel p n) -- (rationalFinitePlaceCompletionRingEquivPadic p y) := -- eL.commutes (rationalFinitePlaceCompletionRingEquivPadic p y) -- --/-- Specialized ramified-prime bridge from the standard `p`-adic Artin value --to the canonical global finite-place Artin value. The localized completion --and all of its dependent instances remain private to this provider. -/ --theorem -- rationalCyclotomicPrincipalPrime_finitePlaceArtinOfExtension_eq_one_of_padic -- (p : Nat.Primes) (n : ℕ) -- (x : ((RayClass.rationalPrime p).adicCompletion ℚ)ˣ) -- (htrivial : -- abelianLocalArtinMonoidHom ℚ_[p.1] -- (RationalCyclotomicPrincipalPrimePadicLevel p n) -- (Units.map -- (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom -- (finitePlaceLocalArtinInput (RayClass.rationalPrime p) x)) = 1) : -- finitePlaceArtinMonoidHomOfExtension -- (K := ℚ) -- (L := KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (RayClass.rationalPrime p) -- (rationalCyclotomicChosenFinitePlaceExtension -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p)) x = 1 := by -- exact -- finitePlaceArtinMonoidHomOfExtension_eq_one_of_semilinear -- (K := ℚ) -- (L := KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (K' := ℚ_[p.1]) -- (L' := RationalCyclotomicPrincipalPrimePadicLevel p n) -- (RayClass.rationalPrime p) -- (rationalCyclotomicChosenFinitePlaceExtension -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p)) -- (rationalFinitePlaceCompletionRingEquivPadic p) -- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n).toRingEquiv -- (rationalCyclotomicPrincipalPrime_localizedBase_commutes p n) -- (rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible p) -- x htrivial -- --private theorem -- padicMultiplicativePrimitiveRoot_rationalPrimeUnitParameterGaloisAction -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- standardLubinTateUnitParameterEquivGal -- (padicLocalField p.1) -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -- (standardLubinTateUnitParameterClass -- (padicLocalField p.1) n -- (rationalPrimeUnitValuationSubringUnit x p)) -- (padicMultiplicativePrimitiveRoot p.1 n) = -- padicMultiplicativePrimitiveRoot p.1 n ^ -- (PadicInt.toZModPow (p := p.1) (n + 1) -- (padicIntUnitOfRat p -- (rationalPrimeUnit x p : ℚ) -- (rationalPrimeUnit x p).ne_zero -- (padicValRat_rationalPrimeUnit x p) : ℤ_[p.1])).val := by -- let uZ : ℤ_[p.1]ˣ := -- padicIntUnitOfRat p -- (rationalPrimeUnit x p : ℚ) -- (rationalPrimeUnit x p).ne_zero -- (padicValRat_rationalPrimeUnit x p) -- let u : (padicLocalField p.1).valuationSubringˣ := -- Units.map (padicIntEquivValuationSubring p.1).toMonoidHom uZ -- have huRational : -- rationalPrimeUnitValuationSubringUnit x p = u := by -- rfl -- have huPreimage : -- (padicIntEquivValuationSubring p.1).symm -- ((u : (padicLocalField p.1).valuationSubringˣ) : -- (padicLocalField p.1).valuationSubring) = -- (uZ : ℤ_[p.1]) := by -- change -- (padicIntEquivValuationSubring p.1).symm -- (padicIntEquivValuationSubring p.1 (uZ : ℤ_[p.1])) = -- (uZ : ℤ_[p.1]) -- exact -- (padicIntEquivValuationSubring p.1).symm_apply_apply -- (uZ : ℤ_[p.1]) -- have hAction := -- padicMultiplicativePrimitiveRoot_unitParameterGaloisAction -- p.1 n u -- rw [huPreimage] at hAction -- rw [huRational] -- exact hAction -- --private noncomputable def rationalCyclotomicPrincipalPrimePadicTargetArtin -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- Gal(RationalCyclotomicPrincipalPrimePadicLevel p n / ℚ_[p.1]) := -- @LocalClassFieldTheory.abelianLocalArtinMonoidHom -- ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) -- (inferInstance : Field ℚ_[p.1]) -- (inferInstance : Field -- (RationalCyclotomicPrincipalPrimePadicLevel p n)) -- (inferInstance : Algebra ℚ_[p.1] -- (RationalCyclotomicPrincipalPrimePadicLevel p n)) -- (inferInstance : ValuativeRel ℚ_[p.1]) -- (inferInstance : TopologicalSpace ℚ_[p.1]) -- (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) -- (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) -- (standardLubinTateLevelField_isAbelianGalois -- (padicLocalField p.1) -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) -- (Units.map -- (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom -- (rationalPrincipalFinitePlaceInput x p)) -- --private noncomputable def -- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- Gal(RationalCyclotomicPrincipalPrimePadicLevel p n / ℚ_[p.1]) := -- standardLubinTateUnitParameterEquivGal -- (padicLocalField p.1) -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -- (standardLubinTateUnitParameterClass -- (padicLocalField p.1) n -- (rationalPrimeUnitValuationSubringUnit x p)) -- --private theorem -- rationalCyclotomicPrincipalPrime_padicTargetArtin_eq_unitParameter -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- rationalCyclotomicPrincipalPrimePadicTargetArtin p n x = -- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x := by -- let T := RationalCyclotomicPrincipalPrimePadicLevel p n -- let eK := rationalFinitePlaceCompletionRingEquivPadic p -- let : FiniteDimensional ℚ_[p.1] T := -- rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n -- let hpi := padicMultiplicativeLubinTateSeries_isUniformizer p.1 -- let : IsAbelianGalois ℚ_[p.1] T := -- standardLubinTateLevelField_isAbelianGalois -- (padicLocalField p.1) hpi n -- have hsource : -- Units.map eK.toMonoidHom (rationalPrincipalFinitePlaceInput x p) = -- Units.map (algebraMap ℚ ℚ_[p.1]).toMonoidHom x := by -- rw [rationalPrincipalFinitePlaceInput_eq_algebraMap] -- apply Units.ext -- exact rationalFinitePlaceCompletionRingEquivPadic_algebraMap p (x : ℚ) -- change -- LocalClassFieldTheory.abelianLocalArtinMonoidHom ℚ_[p.1] T -- (Units.map eK.toMonoidHom -- (rationalPrincipalFinitePlaceInput x p)) = -- standardLubinTateUnitParameterEquivGal -- (padicLocalField p.1) hpi n -- (standardLubinTateUnitParameterClass -- (padicLocalField p.1) n -- (rationalPrimeUnitValuationSubringUnit x p)) -- rw [hsource] -- rw [ -- padicMultiplicativeAbelianLocalArtin_eq_uniformizerUnitPart, -- rationalPadicFieldUnit_uniformizerUnitPart, -- padicMultiplicativeAbelianLocalArtin_eq_unitParameter] -- --private theorem -- rationalCyclotomicPrincipalPrime_padicArtin_action_eq_unitParameter -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- (@LocalClassFieldTheory.abelianLocalArtinMonoidHom -- ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) -- (inferInstance : Field ℚ_[p.1]) -- (inferInstance : Field -- (RationalCyclotomicPrincipalPrimePadicLevel p n)) -- (inferInstance : Algebra ℚ_[p.1] -- (RationalCyclotomicPrincipalPrimePadicLevel p n)) -- (inferInstance : ValuativeRel ℚ_[p.1]) -- (inferInstance : TopologicalSpace ℚ_[p.1]) -- (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) -- (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) -- (standardLubinTateLevelField_isAbelianGalois -- (padicLocalField p.1) -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) -- (Units.map -- (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom -- (finitePlaceLocalArtinInput -- (K := ℚ) (RayClass.rationalPrime p) -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime p) -- (IdeleGroup.principalIdele ℚ x))))) -- ((rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n).toRingEquiv -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) = -- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := by -- let eK := rationalFinitePlaceCompletionRingEquivPadic p -- have hInput : -- finitePlaceLocalArtinInput -- (K := ℚ) (RayClass.rationalPrime p) -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime p) -- (IdeleGroup.principalIdele ℚ x)) = -- rationalPrincipalFinitePlaceInput x p := by -- rfl -- have hMapped : -- Units.map eK.toMonoidHom -- (finitePlaceLocalArtinInput -- (K := ℚ) (RayClass.rationalPrime p) -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime p) -- (IdeleGroup.principalIdele ℚ x))) = -- Units.map eK.toMonoidHom -- (rationalPrincipalFinitePlaceInput x p) := -- congrArg (Units.map eK.toMonoidHom) hInput -- calc -- _ = rationalCyclotomicPrincipalPrimePadicTargetArtin p n x -- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := by -- exact congrArg -- (fun uQp => -- (@LocalClassFieldTheory.abelianLocalArtinMonoidHom -- ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) -- (inferInstance : Field ℚ_[p.1]) -- (inferInstance : Field -- (RationalCyclotomicPrincipalPrimePadicLevel p n)) -- (inferInstance : Algebra ℚ_[p.1] -- (RationalCyclotomicPrincipalPrimePadicLevel p n)) -- (inferInstance : ValuativeRel ℚ_[p.1]) -- (inferInstance : TopologicalSpace ℚ_[p.1]) -- (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) -- (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) -- (standardLubinTateLevelField_isAbelianGalois -- (padicLocalField p.1) -- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) -- uQp) -- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n))) -- hMapped -- _ = rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := -- congrArg -- (fun tau => tau -- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n))) -- (rationalCyclotomicPrincipalPrime_padicTargetArtin_eq_unitParameter -- p n x) -- --private theorem -- rationalCyclotomicPrincipalPrime_padicUnitParameterArtin_action -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) = -- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) ^ -- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := by -- let m := rationalCyclotomicPrincipalPrimeModulus p n -- let E := rationalCyclotomicArtinLocalizedField m p -- let T := RationalCyclotomicPrincipalPrimePadicLevel p n -- let eL : E ≃ₐ[ℚ_[p.1]] T := -- rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- let zetaE : E := rationalCyclotomicPrincipalPrimeLocalizedRoot p n -- let tau : Gal(T / ℚ_[p.1]) := -- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -- let a := rationalCyclotomicPrincipalPrimeResidueUnit p n x -- let zetaT : T := padicMultiplicativePrimitiveRoot p.1 n -- have hzetaE : IsPrimitiveRoot zetaE (p.1 ^ (n + 1)) := by -- change -- IsPrimitiveRoot -- (rationalCyclotomicLocalizedPrimitiveRoot m -- (RayClass.rationalPrime p)) (m : ℕ) -- exact -- rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot -- m (RayClass.rationalPrime p) -- have hrho : IsPrimitiveRoot (eL zetaE) (p.1 ^ (n + 1)) := -- hzetaE.map_of_injective eL.injective -- have hzetaT : IsPrimitiveRoot zetaT (p.1 ^ (n + 1)) := -- padicMultiplicativePrimitiveRoot_isPrimitiveRoot p.1 n -- have htauZetaT : tau zetaT = zetaT ^ a.val.val := -- padicMultiplicativePrimitiveRoot_rationalPrimeUnitParameterGaloisAction -- p n x -- exact -- map_primitiveRoot_eq_pow_of_eq_pow -- tau.toMonoidHom zetaT (eL zetaE) -- (p.1 ^ (n + 1)) a.val.val hzetaT hrho htauZetaT -- --private theorem rationalCyclotomicPrincipalPrime_localArtin_action -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- finitePlaceLocalArtinMonoidHom -- (K := ℚ) -- (L := KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (RayClass.rationalPrime p) -- (rationalCyclotomicChosenFinitePlaceExtension -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p)) -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime p) -- (IdeleGroup.principalIdele ℚ x)) -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) = -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ^ -- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := by -- let eL := rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -- apply eL.injective -- calc -- _ = _ := -- finitePlaceLocalArtinMonoidHom_apply_semilinear -- (K := ℚ) -- (L := KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (K' := ℚ_[p.1]) -- (L' := RationalCyclotomicPrincipalPrimePadicLevel p n) -- (RayClass.rationalPrime p) -- (rationalCyclotomicChosenFinitePlaceExtension -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p)) -- (rationalFinitePlaceCompletionRingEquivPadic p) -- eL.toRingEquiv -- (rationalCyclotomicPrincipalPrime_localizedBase_commutes p n) -- (rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible -- p) -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime p) -- (IdeleGroup.principalIdele ℚ x)) -- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) -- _ = rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -- (eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := -- rationalCyclotomicPrincipalPrime_padicArtin_action_eq_unitParameter -- p n x -- _ = (eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) ^ -- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := -- rationalCyclotomicPrincipalPrime_padicUnitParameterArtin_action p n x -- _ = eL ((rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ^ -- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val) := -- (map_pow eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) -- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val).symm -- --/-- The finite-place Artin symbol at the ramified prime, in its canonical --local-to-global factored form. Keeping this specialization opaque prevents its --dependent local/global instance tower from being unfolded downstream. -/ --noncomputable def rationalCyclotomicPrincipalPrimeChosenArtin -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n) ≃ₐ[ℚ] -- KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n) := -- finitePlaceLocalToGlobalMonoidHom -- (K := ℚ) -- (L := KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (RayClass.rationalPrime p) -- (rationalCyclotomicChosenFinitePlaceExtension -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p)) -- (finitePlaceLocalArtinMonoidHom -- (K := ℚ) -- (L := KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (RayClass.rationalPrime p) -- (rationalCyclotomicChosenFinitePlaceExtension -- (rationalCyclotomicPrincipalPrimeModulus p n) -- (RayClass.rationalPrime p)) -- (IdeleGroup.finiteComponent -- (RayClass.rationalPrime p) -- (IdeleGroup.principalIdele ℚ x))) -- --/-- At the ramified prime, the cyclotomic character of the chosen finite-place --Artin symbol is the direct reduction of the rational `p`-adic unit. -/ --theorem galEquivZMod_chosenFinitePlaceArtinMonoidHom_principal_at_prime -- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -- IsCyclotomicExtension.Rat.galEquivZMod -- (p.1 ^ (n + 1)) -- (KummerTheory.rationalCyclotomicLevel -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (hK := -- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension -- (rationalCyclotomicPrincipalPrimeModulus p n)) -- (rationalCyclotomicPrincipalPrimeChosenArtin p n x) = -- Units.map -- (PadicInt.toZModPow (p := p.1) (n + 1)).toMonoidHom -- (padicIntUnitOfRat p -- (rationalPrimeUnit x p : ℚ) -- (rationalPrimeUnit x p).ne_zero -- (padicValRat_rationalPrimeUnit x p)) := by -- change _ = rationalCyclotomicPrincipalPrimeResidueUnit p n x -- apply rationalCyclotomicPrincipalPrime_galEquivZMod_eq_of_action p n -- simp only [rationalCyclotomicPrincipalPrimeChosenArtin] -- apply finitePlaceLocalToGlobalMonoidHom_apply_pow_of_localized_action -- (zLocal := rationalCyclotomicPrincipalPrimeLocalizedRoot p n) -- · rfl -- · exact rationalCyclotomicPrincipalPrime_localArtin_action p n x -- --end RationalCyclotomicPrincipalPrime -+ rationalFinitePlaceCompletionRatAlgebra -+ primeFact -+ levelNeZero -+ rationalCyclotomicLevelFiniteDimensional -+ rationalCyclotomicLevelIsAbelianGalois -+ rationalFinitePlaceBaseNontriviallyNormedField -+ rationalFinitePlaceBaseLocallyCompactSpace -+ rationalFinitePlaceBaseIsUltrametricDist -+ rationalFinitePlaceBaseValued -+ rationalFinitePlaceBaseValuativeRel -+ rationalFinitePlaceBaseValuationIsNontrivial -+ rationalFinitePlaceBaseValuationCompatible -+ rationalFinitePlaceBaseValuativeRelIsNontrivial -+ rationalFinitePlaceBaseIsValuativeTopology -+ rationalFinitePlaceBaseIsNonarchimedeanLocalField -+ rationalCyclotomicArtinExtensionAlgebra -+ rationalCyclotomicArtinExtensionSMul -+ rationalCyclotomicArtinCompletionAlgebra -+ rationalCyclotomicArtinLocalizedAlgebra -+ rationalCyclotomicArtinLocalizedGlobalAlgebra -+ rationalCyclotomicArtinLocalizedGlobalSMul -+ rationalCyclotomicArtinLocalizedScalarTower -+ rationalCyclotomicArtinLocalizedFiniteDimensional -+ rationalCyclotomicArtinLocalizedIsAbelianGalois -+ rationalCyclotomicArtinLocalizedIsSeparable -+ rationalCyclotomicArtinLocalizedIsCyclotomic -+ rationalCyclotomicArtinExtensionFiniteDimensional -+ rationalCyclotomicArtinExtensionContinuousSMul -+ rationalCyclotomicArtinExtensionLocallyCompact -+ rationalCyclotomicArtinLocalizedLocallyCompact -+ rationalCyclotomicArtinLocalizedIsUltrametricDist -+ rationalCyclotomicArtinLocalizedValued -+ rationalCyclotomicArtinLocalizedValuativeRel -+ rationalCyclotomicArtinLocalizedValuationCompatible -+ rationalCyclotomicArtinLocalizedValuationHasExtension -+ rationalCyclotomicArtinLocalizedValuationIsNontrivial -+ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial -+ rationalCyclotomicArtinLocalizedIsValuativeTopology -+ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField -+ rationalCyclotomicArtinLocalizedIntegerAlgebra -+ rationalCyclotomicArtinLocalizedIsIntegralClosure -+ rationalCyclotomicArtinLocalizedIntegerModuleFinite - - private theorem rationalCyclotomicArtinUnramified - (m : ℕ+) (q : Nat.Primes) -@@ -2440,8 +178,9 @@ noncomputable def rationalCyclotomicArtinLocalExponent - (rationalCyclotomicArtinBaseAbv q).Completion - (Additive.ofMul (rationalCyclotomicArtinLocalInput q x)) - --/-- The chosen finite-place Artin value in a rational cyclotomic level, with --the completion and Galois instance arguments frozen at the provider boundary. -/ -+ -+/-- The Galois automorphism of the rational cyclotomic extension at level `m` -+assigned to the nonzero `q`-adic input by the chosen finite-place Artin map. -/ - noncomputable def rationalCyclotomicChosenFinitePlaceArtinValue - (m : ℕ+) (q : Nat.Primes) - (x : ((RayClass.rationalPrime q).adicCompletion ℚ)ˣ) : -@@ -2484,7 +223,12 @@ private theorem rationalCyclotomicArtinLocalArtin_eq - (rationalCyclotomicArtinLevel m))) - (finitePlaceLocalArtinInput - (K := ℚ) (rationalCyclotomicArtinPlace q) x) := by -- rfl -+ unfold rationalCyclotomicArtinLocalArtin -+ have h := finitePlaceLocalArtinMonoidHom_apply_normalized -+ (K := ℚ) (L := rationalCyclotomicArtinLevel m) -+ (rationalCyclotomicArtinPlace q) -+ (rationalCyclotomicArtinExtension m q) x -+ with_reducible exact h - - private theorem rationalCyclotomicChosenArithmeticFrobenius_eq_lift - (m : ℕ+) (q : Nat.Primes) -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinAction.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinAction.lean -new file mode 100644 -index 0000000..fd14a9f ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinAction.lean -@@ -0,0 +1,438 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinTransport -+ -+ -+set_option autoImplicit false -+ -+open scoped Classical NNReal NumberField ValuativeRel -+open NumberField IsDedekindDomain -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open LocalClassFieldTheory -+open LocalFieldTheory -+open LocalFieldTheory.DiscreteValuationField -+open LocalFieldTheory.DiscreteValuationField.Examples.Qp -+open LubinTate -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+section RationalCyclotomicPrincipalPrime -+ -+attribute [local instance] -+ rationalFinitePlaceCompletionRatAlgebra -+ primeFact -+ levelNeZero -+ rationalCyclotomicLevelFiniteDimensional -+ rationalCyclotomicLevelIsAbelianGalois -+ rationalFinitePlaceBaseNontriviallyNormedField -+ rationalFinitePlaceBaseLocallyCompactSpace -+ rationalFinitePlaceBaseIsUltrametricDist -+ rationalFinitePlaceBaseValued -+ rationalFinitePlaceBaseValuativeRel -+ rationalFinitePlaceBaseValuationIsNontrivial -+ rationalFinitePlaceBaseValuationCompatible -+ rationalFinitePlaceBaseValuativeRelIsNontrivial -+ rationalFinitePlaceBaseIsValuativeTopology -+ rationalFinitePlaceBaseIsNonarchimedeanLocalField -+ rationalCyclotomicArtinExtensionAlgebra -+ rationalCyclotomicArtinExtensionSMul -+ rationalCyclotomicArtinCompletionAlgebra -+ rationalCyclotomicArtinLocalizedAlgebra -+ rationalCyclotomicArtinLocalizedGlobalAlgebra -+ rationalCyclotomicArtinLocalizedGlobalSMul -+ rationalCyclotomicArtinLocalizedScalarTower -+ rationalCyclotomicArtinLocalizedFiniteDimensional -+ rationalCyclotomicArtinLocalizedIsAbelianGalois -+ rationalCyclotomicArtinLocalizedIsSeparable -+ rationalCyclotomicArtinLocalizedIsCyclotomic -+ rationalCyclotomicArtinExtensionFiniteDimensional -+ rationalCyclotomicArtinExtensionContinuousSMul -+ rationalCyclotomicArtinExtensionLocallyCompact -+ rationalCyclotomicArtinLocalizedLocallyCompact -+ rationalCyclotomicArtinLocalizedIsUltrametricDist -+ rationalCyclotomicArtinLocalizedValued -+ rationalCyclotomicArtinLocalizedValuativeRel -+ rationalCyclotomicArtinLocalizedValuationCompatible -+ rationalCyclotomicArtinLocalizedValuationHasExtension -+ rationalCyclotomicArtinLocalizedValuationIsNontrivial -+ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial -+ rationalCyclotomicArtinLocalizedIsValuativeTopology -+ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField -+ rationalCyclotomicArtinLocalizedIntegerAlgebra -+ rationalCyclotomicArtinLocalizedIsIntegralClosure -+ rationalCyclotomicArtinLocalizedIntegerModuleFinite -+ rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension -+ rationalCyclotomicArtinLocalizedPadicAlgebra -+ rationalCyclotomicArtinLocalizedPadicScalarTower -+ rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois -+ rationalPrimeFactorCompletionPadicAlgebra -+ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional -+ -+/-- If a semilinearly identified target local Artin value is trivial, then the -+corresponding global finite-place Artin value is trivial. This generic bridge -+keeps concrete completion and localization instance towers out of downstream -+proof terms. -/ -+theorem finitePlaceArtinMonoidHomOfExtension_eq_one_of_semilinear -+ {K L K' L' : Type} -+ [Field K] [NumberField K] -+ [Field L] [Algebra K L] -+ [hKLfinite : FiniteDimensional K L] [IsAbelianGalois K L] -+ [Field K'] [ValuativeRel K'] [TopologicalSpace K'] -+ [IsNonarchimedeanLocalField K'] -+ [Field L'] [Algebra K' L'] -+ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -+ (v : HeightOneSpectrum (𝓞 K)) -+ (w : AbsoluteValueExtension -+ (HeightOneSpectrum.adicAbv K v) L) -+ (eK : (HeightOneSpectrum.adicAbv K v).Completion ≃+* K') -+ (eL : LocalizedCompletion -+ (HeightOneSpectrum.adicAbv K v) w ≃+* L') -+ (hcomm : ∀ y : (HeightOneSpectrum.adicAbv K v).Completion, -+ eL (@algebraMap -+ (HeightOneSpectrum.adicAbv K v).Completion -+ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) -+ _ _ (finitePlaceLocalArtinLocalizedAlgebra v w) y) = -+ algebraMap K' L' (eK y)) -+ (hExt : SemilinearValuationCompatible -+ (HeightOneSpectrum.adicAbv K v).Completion K' eK) -+ (x : (v.adicCompletion K)ˣ) -+ (htrivial : -+ LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' -+ (Units.map eK.toMonoidHom -+ (finitePlaceLocalArtinInput v x)) = 1) : -+ finitePlaceArtinMonoidHomOfExtension -+ (K := K) (L := L) v w x = 1 := by -+ rw [finitePlaceArtinMonoidHomOfExtension_factor, -+ MonoidHom.comp_apply] -+ have hlocal : -+ finitePlaceLocalArtinMonoidHom -+ (K := K) (L := L) v w x = 1 := by -+ rw [finitePlaceLocalArtinMonoidHom_apply_normalized] -+ exact -+ @abelianLocalArtinMonoidHom_eq_one_of_semilinear -+ (HeightOneSpectrum.adicAbv K v).Completion K' -+ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) L' -+ (inferInstance : Field -+ (HeightOneSpectrum.adicAbv K v).Completion) -+ (finitePlaceLocalArtinCompletionValuativeRel v) -+ (inferInstance : TopologicalSpace -+ (HeightOneSpectrum.adicAbv K v).Completion) -+ (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) -+ (inferInstance : Field K') -+ (inferInstance : ValuativeRel K') -+ (inferInstance : TopologicalSpace K') -+ (inferInstance : IsNonarchimedeanLocalField K') -+ (inferInstance : Field -+ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) -+ (inferInstance : Field L') -+ (finitePlaceLocalArtinLocalizedAlgebra v w) -+ (inferInstance : Algebra K' L') -+ (finitePlaceLocalArtinFiniteDimensional v w) -+ (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) -+ (inferInstance : FiniteDimensional K' L') -+ (inferInstance : IsAbelianGalois K' L') -+ eK eL hcomm hExt (finitePlaceLocalArtinInput v x) htrivial -+ rw [hlocal, map_one] -+ -+/-- The chosen primitive cyclotomic root in the localized prime-power extension. -/ -+noncomputable def rationalCyclotomicPrincipalPrimeLocalizedRoot -+ (p : Nat.Primes) (n : ℕ) : -+ rationalCyclotomicArtinLocalizedField -+ (rationalCyclotomicPrincipalPrimeModulus p n) p := -+ rationalCyclotomicLocalizedPrimitiveRoot -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p) -+ -+/-- The residue modulo `p^(n+1)` of the `p`-adic unit part of a rational unit. -/ -+noncomputable def rationalCyclotomicPrincipalPrimeResidueUnit -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ (ZMod (p.1 ^ (n + 1)))ˣ := -+ Units.map -+ (PadicInt.toZModPow (p := p.1) (n + 1)).toMonoidHom -+ (padicIntUnitOfRat p -+ (rationalPrimeUnit x p : ℚ) -+ (rationalPrimeUnit x p).ne_zero -+ (padicValRat_rationalPrimeUnit x p)) -+ -+theorem rationalCyclotomicPrincipalPrime_localizedBase_commutes -+ (p : Nat.Primes) (n : ℕ) -+ (y : (rationalCyclotomicArtinBaseAbv p).Completion) : -+ rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -+ (rationalCyclotomicArtinLocalizedField -+ (rationalCyclotomicPrincipalPrimeModulus p n) p) y) = -+ algebraMap ℚ_[p.1] -+ (RationalCyclotomicPrincipalPrimePadicLevel p n) -+ (rationalFinitePlaceCompletionRingEquivPadic p y) := by -+ let m := rationalCyclotomicPrincipalPrimeModulus p n -+ let E := rationalCyclotomicArtinLocalizedField m p -+ let eL := rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ have hy : -+ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y = -+ algebraMap ℚ_[p.1] E -+ (rationalFinitePlaceCompletionRingEquivPadic p y) := by -+ change -+ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y = -+ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E -+ ((rationalFinitePlaceCompletionRingEquivPadic p).symm -+ (rationalFinitePlaceCompletionRingEquivPadic p y)) -+ exact -+ (congrArg -+ (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E) -+ ((rationalFinitePlaceCompletionRingEquivPadic p).symm_apply_apply y)).symm -+ calc -+ eL (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y) = -+ eL (algebraMap ℚ_[p.1] E -+ (rationalFinitePlaceCompletionRingEquivPadic p y)) := -+ congrArg eL hy -+ _ = algebraMap ℚ_[p.1] -+ (RationalCyclotomicPrincipalPrimePadicLevel p n) -+ (rationalFinitePlaceCompletionRingEquivPadic p y) := -+ eL.commutes (rationalFinitePlaceCompletionRingEquivPadic p y) -+ -+/-- Specialized ramified-prime bridge from the standard `p`-adic Artin value -+to the canonical global finite-place Artin value. The localized completion -+and all of its dependent instances remain private to this provider. -/ -+theorem -+ rationalCyclotomicPrincipalPrime_finitePlaceArtinOfExtension_eq_one_of_padic -+ (p : Nat.Primes) (n : ℕ) -+ (x : ((RayClass.rationalPrime p).adicCompletion ℚ)ˣ) -+ (htrivial : -+ abelianLocalArtinMonoidHom ℚ_[p.1] -+ (RationalCyclotomicPrincipalPrimePadicLevel p n) -+ (Units.map -+ (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom -+ (finitePlaceLocalArtinInput (RayClass.rationalPrime p) x)) = 1) : -+ finitePlaceArtinMonoidHomOfExtension -+ (K := ℚ) -+ (L := KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (RayClass.rationalPrime p) -+ (rationalCyclotomicChosenFinitePlaceExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p)) x = 1 := by -+ exact -+ finitePlaceArtinMonoidHomOfExtension_eq_one_of_semilinear -+ (K := ℚ) -+ (L := KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (K' := ℚ_[p.1]) -+ (L' := RationalCyclotomicPrincipalPrimePadicLevel p n) -+ (RayClass.rationalPrime p) -+ (rationalCyclotomicChosenFinitePlaceExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p)) -+ (rationalFinitePlaceCompletionRingEquivPadic p) -+ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n).toRingEquiv -+ (rationalCyclotomicPrincipalPrime_localizedBase_commutes p n) -+ (rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible p) -+ x htrivial -+ -+theorem -+ padicMultiplicativePrimitiveRoot_rationalPrimeUnitParameterGaloisAction -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ standardLubinTateUnitParameterEquivGal -+ (padicLocalField p.1) -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -+ (standardLubinTateUnitParameterClass -+ (padicLocalField p.1) n -+ (rationalPrimeUnitValuationSubringUnit x p)) -+ (padicMultiplicativePrimitiveRoot p.1 n) = -+ padicMultiplicativePrimitiveRoot p.1 n ^ -+ (PadicInt.toZModPow (p := p.1) (n + 1) -+ (padicIntUnitOfRat p -+ (rationalPrimeUnit x p : ℚ) -+ (rationalPrimeUnit x p).ne_zero -+ (padicValRat_rationalPrimeUnit x p) : ℤ_[p.1])).val := by -+ let uZ : ℤ_[p.1]ˣ := -+ padicIntUnitOfRat p -+ (rationalPrimeUnit x p : ℚ) -+ (rationalPrimeUnit x p).ne_zero -+ (padicValRat_rationalPrimeUnit x p) -+ let u : (padicLocalField p.1).valuationSubringˣ := -+ Units.map (padicIntEquivValuationSubring p.1).toMonoidHom uZ -+ have huRational : -+ rationalPrimeUnitValuationSubringUnit x p = u := by -+ rfl -+ have huPreimage : -+ (padicIntEquivValuationSubring p.1).symm -+ ((u : (padicLocalField p.1).valuationSubringˣ) : -+ (padicLocalField p.1).valuationSubring) = -+ (uZ : ℤ_[p.1]) := by -+ change -+ (padicIntEquivValuationSubring p.1).symm -+ (padicIntEquivValuationSubring p.1 (uZ : ℤ_[p.1])) = -+ (uZ : ℤ_[p.1]) -+ exact -+ (padicIntEquivValuationSubring p.1).symm_apply_apply -+ (uZ : ℤ_[p.1]) -+ have hAction := -+ padicMultiplicativePrimitiveRoot_unitParameterGaloisAction -+ p.1 n u -+ rw [huPreimage] at hAction -+ rw [huRational] -+ exact hAction -+ -+private noncomputable def rationalCyclotomicPrincipalPrimePadicTargetArtin -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ Gal(RationalCyclotomicPrincipalPrimePadicLevel p n / ℚ_[p.1]) := -+ @LocalClassFieldTheory.abelianLocalArtinMonoidHom -+ ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) -+ (inferInstance : Field ℚ_[p.1]) -+ (inferInstance : Field -+ (RationalCyclotomicPrincipalPrimePadicLevel p n)) -+ (inferInstance : Algebra ℚ_[p.1] -+ (RationalCyclotomicPrincipalPrimePadicLevel p n)) -+ (inferInstance : ValuativeRel ℚ_[p.1]) -+ (inferInstance : TopologicalSpace ℚ_[p.1]) -+ (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) -+ (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) -+ (standardLubinTateLevelField_isAbelianGalois -+ (padicLocalField p.1) -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) -+ (Units.map -+ (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom -+ (rationalPrincipalFinitePlaceInput x p)) -+ -+/-- The cyclotomic Galois automorphism corresponding to the unit parameter of `x` -+under the standard Lubin–Tate equivalence. -/ -+noncomputable def -+ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ Gal(RationalCyclotomicPrincipalPrimePadicLevel p n / ℚ_[p.1]) := -+ standardLubinTateUnitParameterEquivGal -+ (padicLocalField p.1) -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -+ (standardLubinTateUnitParameterClass -+ (padicLocalField p.1) n -+ (rationalPrimeUnitValuationSubringUnit x p)) -+ -+private theorem -+ rationalCyclotomicPrincipalPrime_padicTargetArtin_eq_unitParameter -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ rationalCyclotomicPrincipalPrimePadicTargetArtin p n x = -+ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x := by -+ let T := RationalCyclotomicPrincipalPrimePadicLevel p n -+ let eK := rationalFinitePlaceCompletionRingEquivPadic p -+ let : FiniteDimensional ℚ_[p.1] T := -+ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n -+ let hpi := padicMultiplicativeLubinTateSeries_isUniformizer p.1 -+ let : IsAbelianGalois ℚ_[p.1] T := -+ standardLubinTateLevelField_isAbelianGalois -+ (padicLocalField p.1) hpi n -+ have hsource : -+ Units.map eK.toMonoidHom (rationalPrincipalFinitePlaceInput x p) = -+ Units.map (algebraMap ℚ ℚ_[p.1]).toMonoidHom x := by -+ rw [rationalPrincipalFinitePlaceInput_eq_algebraMap] -+ apply Units.ext -+ exact rationalFinitePlaceCompletionRingEquivPadic_algebraMap p (x : ℚ) -+ change -+ LocalClassFieldTheory.abelianLocalArtinMonoidHom ℚ_[p.1] T -+ (Units.map eK.toMonoidHom -+ (rationalPrincipalFinitePlaceInput x p)) = -+ standardLubinTateUnitParameterEquivGal -+ (padicLocalField p.1) hpi n -+ (standardLubinTateUnitParameterClass -+ (padicLocalField p.1) n -+ (rationalPrimeUnitValuationSubringUnit x p)) -+ rw [hsource] -+ rw [ -+ padicMultiplicativeAbelianLocalArtin_eq_uniformizerUnitPart, -+ rationalPadicFieldUnit_uniformizerUnitPart, -+ padicMultiplicativeAbelianLocalArtin_eq_unitParameter] -+ -+theorem -+ rationalCyclotomicPrincipalPrime_padicArtin_action_eq_unitParameter -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ (@LocalClassFieldTheory.abelianLocalArtinMonoidHom -+ ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) -+ (inferInstance : Field ℚ_[p.1]) -+ (inferInstance : Field -+ (RationalCyclotomicPrincipalPrimePadicLevel p n)) -+ (inferInstance : Algebra ℚ_[p.1] -+ (RationalCyclotomicPrincipalPrimePadicLevel p n)) -+ (inferInstance : ValuativeRel ℚ_[p.1]) -+ (inferInstance : TopologicalSpace ℚ_[p.1]) -+ (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) -+ (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) -+ (standardLubinTateLevelField_isAbelianGalois -+ (padicLocalField p.1) -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) -+ (Units.map -+ (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom -+ (finitePlaceLocalArtinInput -+ (K := ℚ) (RayClass.rationalPrime p) -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime p) -+ (IdeleGroup.principalIdele ℚ x))))) -+ ((rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n).toRingEquiv -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) = -+ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -+ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := by -+ let eK := rationalFinitePlaceCompletionRingEquivPadic p -+ have hInput : -+ finitePlaceLocalArtinInput -+ (K := ℚ) (RayClass.rationalPrime p) -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime p) -+ (IdeleGroup.principalIdele ℚ x)) = -+ rationalPrincipalFinitePlaceInput x p := by -+ rfl -+ have hMapped : -+ Units.map eK.toMonoidHom -+ (finitePlaceLocalArtinInput -+ (K := ℚ) (RayClass.rationalPrime p) -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime p) -+ (IdeleGroup.principalIdele ℚ x))) = -+ Units.map eK.toMonoidHom -+ (rationalPrincipalFinitePlaceInput x p) := -+ congrArg (Units.map eK.toMonoidHom) hInput -+ calc -+ _ = rationalCyclotomicPrincipalPrimePadicTargetArtin p n x -+ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := by -+ exact congrArg -+ (fun uQp => -+ (@LocalClassFieldTheory.abelianLocalArtinMonoidHom -+ ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) -+ (inferInstance : Field ℚ_[p.1]) -+ (inferInstance : Field -+ (RationalCyclotomicPrincipalPrimePadicLevel p n)) -+ (inferInstance : Algebra ℚ_[p.1] -+ (RationalCyclotomicPrincipalPrimePadicLevel p n)) -+ (inferInstance : ValuativeRel ℚ_[p.1]) -+ (inferInstance : TopologicalSpace ℚ_[p.1]) -+ (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) -+ (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) -+ (standardLubinTateLevelField_isAbelianGalois -+ (padicLocalField p.1) -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) -+ uQp) -+ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n))) -+ hMapped -+ _ = rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -+ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := -+ congrArg -+ (fun tau => tau -+ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n))) -+ (rationalCyclotomicPrincipalPrime_padicTargetArtin_eq_unitParameter -+ p n x) -+ -+ -+end RationalCyclotomicPrincipalPrime -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinBase.lean -new file mode 100644 -index 0000000..3646afc ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinBase.lean -@@ -0,0 +1,924 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.CompletionToIdeal -+import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion -+import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.LocalNorm -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.AlgEquiv -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.BaseChange -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.Core -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.NormComparison -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.NormalClosureNorm -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.Tower -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerAlgEquivNaturality -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerBaseChange -+import ClassFieldTheory.AlgebraicNumberTheory.Idele.Relative.FinitePlaceTensorNorm -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlace -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicLocalization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalPrimeFactorization -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalPrincipalLocalUnit -+import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.SemilinearNaturality -+import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.UnramifiedNormalization -+import ClassFieldTheory.LocalClassFieldTheory.LubinTateApplication.PadicMultiplicativeArtinComparison -+import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicValuationComparison -+import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.UnramifiedFrobenius -+import ValuedFieldTheory.LocalField.Padic.Cyclotomic.TotallyRamified.EisensteinPolynomial -+import Mathlib.NumberTheory.NumberField.Cyclotomic.Galois -+ -+ -+set_option autoImplicit false -+ -+/-! -+# Finite-place Artin symbols in rational cyclotomic levels -+ -+At a rational prime away from the cyclotomic level, the chosen completed -+extension is unramified. Its normalized local Artin map is therefore the -+arithmetic Frobenius raised to the local valuation. The genuine primitive -+root in the localized cyclotomic level identifies the image of arithmetic -+Frobenius under the global cyclotomic character with the residue prime. -+-/ -+ -+open scoped Classical NNReal NumberField ValuativeRel -+open NumberField IsDedekindDomain -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+-- Specializing the generic finite-place comparison to `ℚ` must retain its -+-- `Algebra.id` owner rather than selecting the competing rational-field -+-- instance introduced after specialization. -+@[reducible] noncomputable local instance -+ rationalFinitePlaceCompletionRatAlgebra -+ (v : HeightOneSpectrum (𝓞 ℚ)) : -+ Algebra ℚ (HeightOneSpectrum.adicAbv ℚ v).Completion := by -+ letI : Algebra ℚ ℚ := Algebra.id ℚ -+ let hWith : Algebra ℚ -+ (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) := -+ WithAbs.instAlgebra _ -+ let hUniform : UniformContinuousConstSMul ℚ -+ (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) := -+ WithAbs.instUniformContinuousConstSMulReal _ -+ exact -+ @UniformSpace.Completion.algebra -+ (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) _ _ _ _ -+ ℚ _ hWith hUniform -+ -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open LocalClassFieldTheory -+open LocalFieldTheory -+open LocalFieldTheory.DiscreteValuationField -+open LocalFieldTheory.DiscreteValuationField.Examples.Qp -+open LubinTate -+ -+theorem mappedAbelianLocalArtin_eq_frobenius_zpow -+ {F E G : Type} -+ [Field F] [ValuativeRel F] [TopologicalSpace F] -+ [IsNonarchimedeanLocalField F] -+ [Field E] [ValuativeRel E] [UniformSpace E] [IsUniformAddGroup E] -+ [IsNonarchimedeanLocalField E] -+ [Algebra F E] [FiniteDimensional F E] [IsAbelianGalois F E] -+ [Valuation.HasExtension -+ (ValuativeRel.valuation F) (ValuativeRel.valuation E)] -+ [IsNonarchimedeanLocalField.IsUnramifiedValuedExtension F E] -+ [Group G] -+ (f : (E ≃ₐ[F] E) →* G) (x : Fˣ) : -+ f (LocalClassFieldTheory.abelianLocalArtinMonoidHom F E x) = -+ (f (arithmeticFrobeniusOfUnramifiedValuation F E)) ^ -+ IsNonarchimedeanLocalField.valuationMap F -+ (Additive.ofMul x) := by -+ rw [LocalClassFieldTheory.abelianLocalArtinMonoidHom_eq_frobenius_zpow, -+ map_zpow] -+ -+local instance primeFact (q : Nat.Primes) : Fact q.1.Prime := -+ ⟨q.2⟩ -+ -+local instance levelNeZero (m : ℕ+) : NeZero (m : ℕ) := -+ ⟨m.ne_zero⟩ -+ -+noncomputable local instance -+ rationalCyclotomicLevelFiniteDimensional -+ (m : ℕ+) : -+ FiniteDimensional ℚ -+ (KummerTheory.rationalCyclotomicLevel m) := -+ IsCyclotomicExtension.finiteDimensional -+ {(m : ℕ)} ℚ (KummerTheory.rationalCyclotomicLevel m) -+ -+noncomputable local instance -+ rationalCyclotomicLevelIsAbelianGalois -+ (m : ℕ+) : -+ IsAbelianGalois ℚ -+ (KummerTheory.rationalCyclotomicLevel m) := by -+ have : IsGalois ℚ -+ (KummerTheory.rationalCyclotomicLevel m) := -+ inferInstance -+ let e := -+ IsCyclotomicExtension.Rat.galEquivZMod -+ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) -+ exact -+ { is_comm.comm σ τ := by -+ apply e.injective -+ simp only [map_mul] -+ exact mul_comm _ _ } -+ -+@[reducible] -+noncomputable local instance rationalFinitePlaceBaseNontriviallyNormedField -+ (q : Nat.Primes) : -+ NontriviallyNormedField -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion := -+ absoluteValueExtension_completionNontriviallyNormedField -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)) -+ (RayClass.adicAbv_isNontrivial -+ (RayClass.rationalPrime q)) -+ -+noncomputable local instance rationalFinitePlaceBaseLocallyCompactSpace -+ (q : Nat.Primes) : -+ LocallyCompactSpace -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion := -+ AbsoluteValue.Completion.locallyCompactSpace -+ (finitePlaceCompletionBaseMap_isometry -+ (RayClass.rationalPrime q)) -+ -+noncomputable local instance rationalFinitePlaceBaseIsUltrametricDist -+ (q : Nat.Primes) : -+ IsUltrametricDist -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion := -+ finitePlaceArtinCompletionIsUltrametricDist -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv -+ ℚ (RayClass.rationalPrime q)) -+ -+@[reducible] -+noncomputable local instance rationalFinitePlaceBaseValued -+ (q : Nat.Primes) : -+ Valued -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion ℝ≥0 := -+ finitePlaceArtinCompletionValued -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv -+ ℚ (RayClass.rationalPrime q)) -+ -+@[reducible] -+noncomputable local instance rationalFinitePlaceBaseValuativeRel -+ (q : Nat.Primes) : -+ ValuativeRel -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion := -+ finitePlaceLocalArtinCompletionValuativeRel -+ (K := ℚ) (RayClass.rationalPrime q) -+ -+noncomputable local instance -+ rationalFinitePlaceBaseValuationIsNontrivial -+ (q : Nat.Primes) : -+ (Valued.v : -+ Valuation -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ ℝ≥0).IsNontrivial := -+ (inferInstance : -+ (NormedField.valuation -+ (K := -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion)).IsNontrivial) -+ -+noncomputable local instance rationalFinitePlaceBaseValuationCompatible -+ (q : Nat.Primes) : -+ (Valued.v : -+ Valuation -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ ℝ≥0).Compatible := -+ Valuation.Compatible.ofValuation _ -+ -+noncomputable local instance -+ rationalFinitePlaceBaseValuativeRelIsNontrivial -+ (q : Nat.Primes) : -+ ValuativeRel.IsNontrivial -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion := -+ (ValuativeRel.isNontrivial_iff_isNontrivial -+ (Valued.v : -+ Valuation -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ ℝ≥0)).2 inferInstance -+ -+noncomputable local instance rationalFinitePlaceBaseIsValuativeTopology -+ (q : Nat.Primes) : -+ IsValuativeTopology -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion := -+ isValuativeTopology_of_valued_ofValuation -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion ℝ≥0 -+ -+noncomputable local instance -+ rationalFinitePlaceBaseIsNonarchimedeanLocalField -+ (q : Nat.Primes) : -+ IsNonarchimedeanLocalField -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion := -+ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField -+ (K := ℚ) (RayClass.rationalPrime q) -+ -+ -+/-- Rational cyclotomic levels are finite-dimensional over `ℚ`. -/ -+theorem rationalCyclotomicPrincipalPrimeLevelFiniteDimensional -+ (m : ℕ+) : -+ FiniteDimensional ℚ (KummerTheory.rationalCyclotomicLevel m) := -+ rationalCyclotomicLevelFiniteDimensional m -+ -+/-- Rational cyclotomic levels are abelian Galois extensions of `ℚ`. -/ -+theorem rationalCyclotomicPrincipalPrimeLevelIsAbelianGalois -+ (m : ℕ+) : -+ IsAbelianGalois ℚ (KummerTheory.rationalCyclotomicLevel m) := -+ rationalCyclotomicLevelIsAbelianGalois m -+ -+/-- The canonical nontrivially normed field structure on the completion of -+`ℚ` at the rational prime `p`, exposed for principal-prime constructions. -/ -+@[reducible] -+noncomputable def rationalPrimeFactorCompletionNontriviallyNormedField -+ (p : Nat.Primes) : -+ NontriviallyNormedField -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion := -+ rationalFinitePlaceBaseNontriviallyNormedField p -+ -+/-- The completion of `ℚ` at `p` is locally compact. -/ -+theorem rationalPrimeFactorCompletionLocallyCompactSpace -+ (p : Nat.Primes) : -+ LocallyCompactSpace -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion := -+ rationalFinitePlaceBaseLocallyCompactSpace p -+ -+/-- The completion of `ℚ` at `p` carries its canonical ultrametric distance. -/ -+theorem rationalPrimeFactorCompletionIsUltrametricDist -+ (p : Nat.Primes) : -+ IsUltrametricDist -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion := -+ rationalFinitePlaceBaseIsUltrametricDist p -+ -+/-- The canonical `ℝ≥0`-valued structure on the completion of `ℚ` at `p`. -/ -+@[reducible] -+noncomputable def rationalPrimeFactorCompletionValued -+ (p : Nat.Primes) : -+ Valued -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion ℝ≥0 := -+ rationalFinitePlaceBaseValued p -+ -+/-- The valuative relation induced by the canonical valuation on the -+completion of `ℚ` at `p`. -/ -+@[reducible] -+noncomputable def rationalPrimeFactorCompletionValuativeRel -+ (p : Nat.Primes) : -+ ValuativeRel -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion := -+ rationalFinitePlaceBaseValuativeRel p -+ -+/-- The canonical valuation on the completion of `ℚ` at `p` is nontrivial. -/ -+theorem rationalPrimeFactorCompletionValuationIsNontrivial -+ (p : Nat.Primes) : -+ (Valued.v : Valuation -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion ℝ≥0).IsNontrivial := -+ rationalFinitePlaceBaseValuationIsNontrivial p -+ -+/-- The canonical valuation on the completion of `ℚ` at `p` is compatible -+with its field structure. -/ -+theorem rationalPrimeFactorCompletionValuationCompatible -+ (p : Nat.Primes) : -+ (Valued.v : Valuation -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion ℝ≥0).Compatible := -+ rationalFinitePlaceBaseValuationCompatible p -+ -+/-- The canonical valuative relation on the completion at `p` is nontrivial. -/ -+theorem rationalPrimeFactorCompletionValuativeRelIsNontrivial -+ (p : Nat.Primes) : -+ ValuativeRel.IsNontrivial -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion := -+ rationalFinitePlaceBaseValuativeRelIsNontrivial p -+ -+/-- The completion topology at `p` is induced by its canonical valuation. -/ -+theorem rationalPrimeFactorCompletionIsValuativeTopology -+ (p : Nat.Primes) : -+ IsValuativeTopology -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion := -+ rationalFinitePlaceBaseIsValuativeTopology p -+ -+/-- The completion of `ℚ` at `p` is a nonarchimedean local field. -/ -+theorem rationalPrimeFactorCompletionIsNonarchimedeanLocalField -+ (p : Nat.Primes) : -+ IsNonarchimedeanLocalField -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion := -+ rationalFinitePlaceBaseIsNonarchimedeanLocalField p -+ -+/-- The positive conductor of the `n`-th ramified cyclotomic level at -+`p`. -/ -+def rationalCyclotomicPrincipalPrimeModulus -+ (p : Nat.Primes) (n : ℕ) : ℕ+ := -+ ⟨p.1 ^ (n + 1), pow_pos p.2.pos (n + 1)⟩ -+ -+/-- The rational finite-place completion used at the prime `p`. -/ -+abbrev RationalCyclotomicPrincipalPrimeCompletion -+ (p : Nat.Primes) := -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion -+ -+/-- The chosen localized cyclotomic field at level `p ^ (n + 1)`. -/ -+abbrev RationalCyclotomicPrincipalPrimeLocalizedLevel -+ (p : Nat.Primes) (n : ℕ) := -+ rationalCyclotomicLocalizedCompletion -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p) -+ -+/-- The standard multiplicative Lubin--Tate field at level `n`. -/ -+abbrev RationalCyclotomicPrincipalPrimePadicLevel -+ (p : Nat.Primes) (n : ℕ) := -+ standardLubinTateLevelField -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -+ -+/-- The valuation ring of the absolute-value completion at `q`, identified -+with the standard p-adic integer ring `ℤ_q`. -/ -+noncomputable def rationalFinitePlaceCompletionIntegerRingEquivPadicInt -+ (q : Nat.Primes) : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion] ≃+* -+ ℤ_[q.1] := by -+ let v : HeightOneSpectrum (𝓞 ℚ) := -+ RayClass.rationalPrime q -+ let vQ := HeightOneSpectrum.adicAbv ℚ v -+ let eConcreteIntegers : -+ 𝒪[vQ.Completion] ≃+* -+ v.adicCompletionIntegers ℚ := -+ finitePlaceCompletionIntegerRingEquiv v -+ exact -+ eConcreteIntegers.trans -+ (PadicInt.adicCompletionIntegersEquiv -+ (𝓞 ℚ) q).symm.toRingEquiv -+ -+/-- The absolute-value completion at the rational prime `q`, identified -+with the standard field `ℚ_q`. -/ -+noncomputable def rationalFinitePlaceCompletionRingEquivPadic -+ (q : Nat.Primes) : -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion ≃+* -+ ℚ_[q.1] := -+ IsFractionRing.ringEquivOfRingEquiv -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) -+ -+/-- The completion-to-`ℚ_q` equivalence respects the rational embedding. -/ -+theorem rationalFinitePlaceCompletionRingEquivPadic_algebraMap -+ (q : Nat.Primes) (a : ℚ) : -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap ℚ -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion a) = -+ algebraMap ℚ ℚ_[q.1] a := by -+ exact -+ (rationalFinitePlaceCompletionRingEquivPadic q).toRingHom.map_rat_algebraMap a -+ -+/-- The completion field equivalence and its restriction to valuation -+rings commute with the natural inclusions into the fields. -/ -+theorem rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe -+ (q : Nat.Primes) -+ (a : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion]) : -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion] -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion a) = -+ algebraMap ℤ_[q.1] ℚ_[q.1] -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q a) := by -+ exact -+ (IsFractionRing.ringEquivOfRingEquiv_algebraMap -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) a) -+ -+/-- The canonical rational-completion equivalence preserves the canonical -+valuations. -/ -+theorem -+ rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible -+ (p : Nat.Primes) : -+ SemilinearValuationCompatible -+ (RationalCyclotomicPrincipalPrimeCompletion p) ℚ_[p.1] -+ (rationalFinitePlaceCompletionRingEquivPadic p) := by -+ let F := RationalCyclotomicPrincipalPrimeCompletion p -+ let eK := rationalFinitePlaceCompletionRingEquivPadic p -+ let : Algebra F ℚ_[p.1] := eK.toRingHom.toAlgebra -+ change -+ (ValuativeRel.valuation F).HasExtension -+ (ValuativeRel.valuation ℚ_[p.1]) -+ let eO := -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt p).trans -+ (padicIntEquivValuationSubring p.1) -+ have hChosen : -+ (localCompleteDVF F).valuation.HasExtension -+ (padicDVRValuation p.1) := by -+ change -+ (localCompleteDVF F).valuation.HasExtension -+ (padicCompleteDVF p.1).valuation -+ apply -+ ValuationTheory.DiscreteValuationField.ValuedExtension.valuation_hasExtension_of_valuationSubring_equiv -+ (localCompleteDVF F) -+ (padicCompleteDVF p.1) -+ eO -+ intro z -+ change -+ algebraMap -+ (padicDVRValuation p.1).valuationSubring ℚ_[p.1] -+ (padicIntEquivValuationSubring p.1 -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -+ p z)) = -+ rationalFinitePlaceCompletionRingEquivPadic p -+ (algebraMap 𝒪[F] F z) -+ symm -+ calc -+ rationalFinitePlaceCompletionRingEquivPadic p -+ (algebraMap 𝒪[F] F z) = -+ algebraMap ℤ_[p.1] ℚ_[p.1] -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -+ p z) := -+ rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe -+ p z -+ _ = -+ algebraMap -+ (padicDVRValuation p.1).valuationSubring ℚ_[p.1] -+ (padicIntEquivValuationSubring p.1 -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -+ p z)) := by -+ rw [PadicInt.algebraMap_apply, -+ ValuationSubring.algebraMap_apply] -+ exact -+ (padicIntEquivValuationSubring_coe p.1 -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -+ p z)).symm -+ have hBase : -+ (ValuativeRel.valuation F).HasExtension -+ (padicDVRValuation p.1) := by -+ rw [← localCompleteDVF_valuation_eq] -+ exact hChosen -+ refine -+ { val_isEquiv_comap := ?_ } -+ exact -+ hBase.val_isEquiv_comap.trans -+ ((padicDVRValuation_isEquiv_valuativeRelValuation -+ p.1).comap (algebraMap F ℚ_[p.1])) -+ -+/-- The rational prime, pulled back from `ℤ_q` to the valuation ring of -+the absolute-value completion at `q`. -/ -+noncomputable def rationalPrimeFinitePlaceInteger -+ (q : Nat.Primes) : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion] := -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q).symm -+ (q.1 : ℤ_[q.1]) -+ -+/-- The pulled-back rational prime is irreducible in the completion -+valuation ring. -/ -+theorem rationalPrimeFinitePlaceInteger_irreducible -+ (q : Nat.Primes) : -+ Irreducible (rationalPrimeFinitePlaceInteger q) := by -+ exact -+ (MulEquiv.irreducible_iff -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -+ q).symm.toMulEquiv).2 -+ ((PadicInt.prime_p : -+ Prime (q.1 : ℤ_[q.1])).irreducible) -+ -+/-- Coercing the pulled-back prime to the completion field gives the -+ordinary image of the rational number `q`. -/ -+theorem rationalPrimeFinitePlaceInteger_coe -+ (q : Nat.Primes) : -+ ((rationalPrimeFinitePlaceInteger q : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion]) : -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion) = -+ algebraMap ℚ -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (q.1 : ℚ) := by -+ apply -+ (rationalFinitePlaceCompletionRingEquivPadic q).injective -+ change -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion] -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeFinitePlaceInteger q)) = -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap ℚ -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (q.1 : ℚ)) -+ calc -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion] -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeFinitePlaceInteger q)) = -+ algebraMap ℤ_[q.1] ℚ_[q.1] -+ ((rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) -+ (rationalPrimeFinitePlaceInteger q)) := -+ rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe -+ q (rationalPrimeFinitePlaceInteger q) -+ _ = (q.1 : ℚ_[q.1]) := by -+ rw [rationalPrimeFinitePlaceInteger, -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -+ q).apply_symm_apply, -+ PadicInt.algebraMap_apply, -+ PadicInt.coe_natCast] -+ _ = -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap ℚ -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (q.1 : ℚ)) := by -+ rw [ -+ rationalFinitePlaceCompletionRingEquivPadic_algebraMap] -+ norm_num -+ -+/-- The rational prime as a field unit of its absolute-value completion. -/ -+noncomputable def rationalPrimeFinitePlaceFieldUnit -+ (q : Nat.Primes) : -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completionˣ := -+ Units.mk0 -+ (rationalPrimeFinitePlaceInteger q : -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion) -+ (by -+ intro hzero -+ exact -+ (rationalPrimeFinitePlaceInteger_irreducible q).ne_zero -+ (Subtype.ext hzero)) -+ -+/-- In the inverse-standard local reciprocity normalization, the rational -+prime itself has normalized additive value `-1`. -/ -+theorem rationalPrimeFinitePlaceFieldUnit_valuationMap -+ (q : Nat.Primes) : -+ IsNonarchimedeanLocalField.valuationMap -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (Additive.ofMul -+ (rationalPrimeFinitePlaceFieldUnit q)) = -+ -1 := by -+ simpa [IsNonarchimedeanLocalField.valuationMap_apply] using -+ (LocalFieldTheory.v_integerRingIrreducibleFieldUnit -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeFinitePlaceInteger q) -+ (rationalPrimeFinitePlaceInteger_irreducible q) -+ (rationalPrimeFinitePlaceFieldUnit q) rfl) -+ -+/-- The rational `q`-unit part of `x`, pulled back from `ℤ_qˣ` to the -+valuation ring of the absolute-value completion. -/ -+noncomputable def rationalPrimeUnitFinitePlaceIntegerUnit -+ (x : ℚˣ) (q : Nat.Primes) : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion]ˣ := -+ Units.map -+ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt -+ q).symm.toMonoidHom -+ (padicIntUnitOfRat q -+ (rationalPrimeUnit x q : ℚ) -+ (rationalPrimeUnit x q).ne_zero -+ (padicValRat_rationalPrimeUnit x q)) -+ -+/-- Forgetting the integrality proof from the pulled-back `q`-unit gives -+the ordinary image of the rational `q`-unit in the completion field. -/ -+theorem rationalPrimeUnitFinitePlaceIntegerUnit_coe -+ (x : ℚˣ) (q : Nat.Primes) : -+ (((rationalPrimeUnitFinitePlaceIntegerUnit x q : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion]ˣ) : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion]) : -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion) = -+ algebraMap ℚ -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeUnit x q : ℚ) := by -+ apply -+ (rationalFinitePlaceCompletionRingEquivPadic q).injective -+ change -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion] -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeUnitFinitePlaceIntegerUnit x q : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion])) = -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap ℚ -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeUnit x q : ℚ)) -+ calc -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion] -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeUnitFinitePlaceIntegerUnit x q : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion])) = -+ algebraMap ℤ_[q.1] ℚ_[q.1] -+ ((rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) -+ (rationalPrimeUnitFinitePlaceIntegerUnit x q : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion])) := -+ rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe q -+ (rationalPrimeUnitFinitePlaceIntegerUnit x q : -+ 𝒪[(HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion]) -+ _ = -+ ((padicIntUnitOfRat q -+ (rationalPrimeUnit x q : ℚ) -+ (rationalPrimeUnit x q).ne_zero -+ (padicValRat_rationalPrimeUnit x q) : -+ ℤ_[q.1]) : ℚ_[q.1]) := by -+ rw [rationalPrimeUnitFinitePlaceIntegerUnit] -+ simp [PadicInt.algebraMap_apply] -+ _ = ((rationalPrimeUnit x q : ℚ) : ℚ_[q.1]) := by -+ rw [padicIntUnitOfRat_coe] -+ _ = -+ rationalFinitePlaceCompletionRingEquivPadic q -+ (algebraMap ℚ -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeUnit x q : ℚ)) := by -+ rw [ -+ rationalFinitePlaceCompletionRingEquivPadic_algebraMap] -+ simp -+ -+/-- The completion field unit underlying the pulled-back rational `q`-unit -+has normalized additive value zero. -/ -+theorem rationalPrimeUnitFinitePlaceField_valuationMap -+ (x : ℚˣ) (q : Nat.Primes) : -+ IsNonarchimedeanLocalField.valuationMap -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (Additive.ofMul -+ (IsNonarchimedeanLocalField.integerUnitsToFieldUnits -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeUnitFinitePlaceIntegerUnit x q))) = -+ 0 := by -+ rw [IsNonarchimedeanLocalField.valuationMap_apply] -+ exact -+ IsNonarchimedeanLocalField.v_integerUnitsToFieldUnits -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (rationalPrimeUnitFinitePlaceIntegerUnit x q) -+ -+/-- The rational prime `q`, regarded as a unit of `ℚ`. -/ -+def rationalPrimeGeneratorUnit (q : Nat.Primes) : ℚˣ := -+ Units.mk0 (q.1 : ℚ) (by exact_mod_cast q.2.ne_zero) -+ -+/-- The underlying rational number of the prime generator unit is `q`. -/ -+@[simp] -+theorem rationalPrimeGeneratorUnit_coe (q : Nat.Primes) : -+ (rationalPrimeGeneratorUnit q : ℚ) = q.1 := -+ rfl -+ -+/-- Reattaching the removed `q`-power to the rational `q`-unit recovers -+the original rational field unit. -/ -+theorem rationalPrimeGeneratorUnit_zpow_mul_rationalPrimeUnit -+ (x : ℚˣ) (q : Nat.Primes) : -+ rationalPrimeGeneratorUnit q ^ -+ padicValRat q.1 (x : ℚ) * -+ rationalPrimeUnit x q = -+ x := by -+ rw [rationalPrimeGeneratorUnit, rationalPrimeUnit, -+ ← mul_assoc, ← zpow_add] -+ simp -+ -+/-- The source unit in the absolute-value completion represented by the -+finite component of a rational principal idele. -/ -+noncomputable def rationalPrincipalFinitePlaceInput -+ (x : ℚˣ) (q : Nat.Primes) : -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completionˣ := -+ (finitePlaceCompletionUnitsContinuousMulEquiv -+ (RayClass.rationalPrime q)).symm -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime q) -+ (IdeleGroup.principalIdele ℚ x)) -+ -+/-- The source unit represented by a principal finite component is the -+ordinary image of the rational field unit in the absolute-value -+completion. -/ -+theorem rationalPrincipalFinitePlaceInput_eq_algebraMap -+ (x : ℚˣ) (q : Nat.Primes) : -+ rationalPrincipalFinitePlaceInput x q = -+ Units.map -+ (algebraMap ℚ -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion).toMonoidHom -+ x := by -+ apply Units.ext -+ let v : HeightOneSpectrum (𝓞 ℚ) := -+ RayClass.rationalPrime q -+ let vQ := HeightOneSpectrum.adicAbv ℚ v -+ let component : (v.adicCompletion ℚ)ˣ := -+ IdeleGroup.finiteComponent v -+ (IdeleGroup.principalIdele ℚ x) -+ apply (finitePlaceCompletionRingEquiv v).injective -+ change -+ finitePlaceCompletionRingEquiv v -+ (rationalPrincipalFinitePlaceInput x q : vQ.Completion) = -+ finitePlaceCompletionRingEquiv v -+ (algebraMap ℚ vQ.Completion (x : ℚ)) -+ have hCompletion : -+ finitePlaceCompletionRingEquiv v -+ (rationalPrincipalFinitePlaceInput x q : -+ vQ.Completion) = -+ (component : v.adicCompletion ℚ) := by -+ have hUnits := -+ congrArg Units.val -+ ((finitePlaceCompletionUnitsContinuousMulEquiv v).apply_symm_apply -+ component) -+ exact hUnits -+ have hComponent : -+ (component : v.adicCompletion ℚ) = -+ algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ) := by -+ apply (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm.injective -+ calc -+ (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm -+ (component : v.adicCompletion ℚ) = -+ algebraMap ℚ ℚ_[q.1] (x : ℚ) := by -+ dsimp only [component] -+ rw [IdeleGroup.finiteComponent_principalIdele] -+ exact -+ (Padic.adicCompletionEquiv -+ (𝓞 ℚ) q).symm.commutes (x : ℚ) -+ _ = (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm -+ (algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ)) := by -+ symm -+ exact -+ (Padic.adicCompletionEquiv -+ (𝓞 ℚ) q).symm.commutes (x : ℚ) -+ calc -+ finitePlaceCompletionRingEquiv v -+ (rationalPrincipalFinitePlaceInput x q : -+ vQ.Completion) = -+ (component : v.adicCompletion ℚ) := hCompletion -+ _ = algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ) := hComponent -+ _ = finitePlaceCompletionRingEquiv v -+ (algebraMap ℚ vQ.Completion (x : ℚ)) := by -+ symm -+ exact -+ (finitePlaceCompletionAlgEquiv (K := ℚ) v).commutes (x : ℚ) -+ -+/-- The normalized local exponent of a rational principal finite -+component is the negative of the usual `q`-adic exponent. The minus sign -+records the inverse-standard local reciprocity convention in which a -+prime element has normalized value `-1`. -/ -+theorem rationalPrincipalFiniteComponent_valuationMap -+ (x : ℚˣ) (q : Nat.Primes) : -+ IsNonarchimedeanLocalField.valuationMap -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (Additive.ofMul -+ ((finitePlaceCompletionUnitsContinuousMulEquiv -+ (RayClass.rationalPrime q)).symm -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime q) -+ (IdeleGroup.principalIdele ℚ x)))) = -+ -padicValRat q.1 (x : ℚ) := by -+ let F := -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ let embed : ℚˣ →* Fˣ := -+ Units.map (algebraMap ℚ F).toMonoidHom -+ let primeUnit : Fˣ := -+ rationalPrimeFinitePlaceFieldUnit q -+ let integralUnit : 𝒪[F]ˣ := -+ rationalPrimeUnitFinitePlaceIntegerUnit x q -+ let unitPart : Fˣ := -+ IsNonarchimedeanLocalField.integerUnitsToFieldUnits -+ F integralUnit -+ have hInput : -+ rationalPrincipalFinitePlaceInput x q = -+ embed x := by -+ exact rationalPrincipalFinitePlaceInput_eq_algebraMap x q -+ have hPrime : -+ embed (rationalPrimeGeneratorUnit q) = -+ primeUnit := by -+ apply Units.ext -+ exact -+ (rationalPrimeFinitePlaceInteger_coe q).symm -+ have hUnit : -+ embed (rationalPrimeUnit x q) = -+ unitPart := by -+ apply Units.ext -+ exact -+ (rationalPrimeUnitFinitePlaceIntegerUnit_coe -+ x q).symm -+ change -+ IsNonarchimedeanLocalField.valuationMap F -+ (Additive.ofMul -+ (rationalPrincipalFinitePlaceInput x q)) = -+ -padicValRat q.1 (x : ℚ) -+ rw [hInput] -+ conv_lhs => -+ rw [← rationalPrimeGeneratorUnit_zpow_mul_rationalPrimeUnit -+ x q] -+ rw [map_mul, map_zpow, hPrime, hUnit, -+ IsNonarchimedeanLocalField.valuationMap_ofMul_mul, -+ IsNonarchimedeanLocalField.valuationMap_ofMul_zpow, -+ rationalPrimeFinitePlaceFieldUnit_valuationMap, -+ rationalPrimeUnitFinitePlaceField_valuationMap] -+ ring -+ -+/-- The principal finite component of the rational prime itself has -+normalized local exponent `-1`. -/ -+theorem rationalPrimePrincipalFiniteComponent_valuationMap -+ (q : Nat.Primes) : -+ IsNonarchimedeanLocalField.valuationMap -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime q)).Completion -+ (Additive.ofMul -+ ((finitePlaceCompletionUnitsContinuousMulEquiv -+ (RayClass.rationalPrime q)).symm -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime q) -+ (IdeleGroup.principalIdele ℚ -+ (rationalPrimeGeneratorUnit q))))) = -+ -1 := by -+ rw [rationalPrincipalFiniteComponent_valuationMap, -+ rationalPrimeGeneratorUnit_coe, -+ padicValRat.self q.2.one_lt] -+ -+/-- A cyclotomic automorphism which raises the selected primitive root to -+the `q`-th power has cyclotomic character equal to the residue-prime unit. -/ -+theorem rationalCyclotomicLevel_galEquivZMod_eq_unitOfCoprime -+ (m : ℕ+) (q : Nat.Primes) -+ (hq : ¬ q.1 ∣ (m : ℕ)) -+ (σ : KummerTheory.rationalCyclotomicLevel m ≃ₐ[ℚ] -+ KummerTheory.rationalCyclotomicLevel m) -+ (hσ : -+ σ (rationalCyclotomicLevelPrimitiveRoot m) = -+ rationalCyclotomicLevelPrimitiveRoot m ^ q.1) : -+ IsCyclotomicExtension.Rat.galEquivZMod -+ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ = -+ ZMod.unitOfCoprime q.1 -+ (q.2.coprime_iff_not_dvd.mpr hq) := by -+ let ζ := rationalCyclotomicLevelPrimitiveRoot m -+ have hζ : IsPrimitiveRoot ζ (m : ℕ) := -+ rationalCyclotomicLevelPrimitiveRoot_isPrimitiveRoot m -+ have hCharacterRoot : -+ σ ζ = -+ ζ ^ -+ (IsCyclotomicExtension.Rat.galEquivZMod -+ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ).val.val := -+ IsCyclotomicExtension.Rat.galEquivZMod_apply_of_pow_eq -+ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ -+ hζ.pow_eq_one -+ have hPowers : -+ ζ ^ -+ (IsCyclotomicExtension.Rat.galEquivZMod -+ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ).val.val = -+ ζ ^ q.1 := -+ hCharacterRoot.symm.trans hσ -+ rw [(hζ.isOfFinOrder m.ne_zero).pow_inj_mod, -+ ← hζ.eq_orderOf, -+ ← ZMod.natCast_eq_natCast_iff', -+ ZMod.natCast_val] at hPowers -+ apply Units.ext -+ simpa using hPowers -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPadic.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPadic.lean -new file mode 100644 -index 0000000..b430bec ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPadic.lean -@@ -0,0 +1,389 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinTower -+ -+ -+set_option autoImplicit false -+ -+open scoped Classical NNReal NumberField ValuativeRel -+open NumberField IsDedekindDomain -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open LocalClassFieldTheory -+open LocalFieldTheory -+open LocalFieldTheory.DiscreteValuationField -+open LocalFieldTheory.DiscreteValuationField.Examples.Qp -+open LubinTate -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+attribute [local instance] -+ rationalFinitePlaceCompletionRatAlgebra -+ primeFact -+ levelNeZero -+ rationalCyclotomicLevelFiniteDimensional -+ rationalCyclotomicLevelIsAbelianGalois -+ rationalFinitePlaceBaseNontriviallyNormedField -+ rationalFinitePlaceBaseLocallyCompactSpace -+ rationalFinitePlaceBaseIsUltrametricDist -+ rationalFinitePlaceBaseValued -+ rationalFinitePlaceBaseValuativeRel -+ rationalFinitePlaceBaseValuationIsNontrivial -+ rationalFinitePlaceBaseValuationCompatible -+ rationalFinitePlaceBaseValuativeRelIsNontrivial -+ rationalFinitePlaceBaseIsValuativeTopology -+ rationalFinitePlaceBaseIsNonarchimedeanLocalField -+ rationalCyclotomicArtinExtensionAlgebra -+ rationalCyclotomicArtinExtensionSMul -+ rationalCyclotomicArtinCompletionAlgebra -+ rationalCyclotomicArtinLocalizedAlgebra -+ rationalCyclotomicArtinLocalizedGlobalAlgebra -+ rationalCyclotomicArtinLocalizedGlobalSMul -+ rationalCyclotomicArtinLocalizedScalarTower -+ rationalCyclotomicArtinLocalizedFiniteDimensional -+ rationalCyclotomicArtinLocalizedIsAbelianGalois -+ rationalCyclotomicArtinLocalizedIsSeparable -+ rationalCyclotomicArtinLocalizedIsCyclotomic -+ rationalCyclotomicArtinExtensionFiniteDimensional -+ rationalCyclotomicArtinExtensionContinuousSMul -+ rationalCyclotomicArtinExtensionLocallyCompact -+ rationalCyclotomicArtinLocalizedLocallyCompact -+ rationalCyclotomicArtinLocalizedIsUltrametricDist -+ rationalCyclotomicArtinLocalizedValued -+ rationalCyclotomicArtinLocalizedValuativeRel -+ rationalCyclotomicArtinLocalizedValuationCompatible -+ rationalCyclotomicArtinLocalizedValuationHasExtension -+ rationalCyclotomicArtinLocalizedValuationIsNontrivial -+ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial -+ rationalCyclotomicArtinLocalizedIsValuativeTopology -+ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField -+ rationalCyclotomicArtinLocalizedIntegerAlgebra -+ rationalCyclotomicArtinLocalizedIsIntegralClosure -+ rationalCyclotomicArtinLocalizedIntegerModuleFinite -+ -+section RationalCyclotomicPrincipalPrime -+ -+/-! ## Ramified prime-power transport -+ -+This section reuses the canonical finite-place Artin tower above. In -+particular, it introduces no parallel completion/localization instance tower. -/ -+ -+noncomputable local instance -+ rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension -+ (p : Nat.Primes) (n : ℕ) : -+ IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ -+ (KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) := by -+ change -+ IsCyclotomicExtension -+ {(rationalCyclotomicPrincipalPrimeModulus p n : ℕ)} ℚ -+ (KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ exact -+ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ -+private abbrev rationalCyclotomicPrincipalPrimePlace -+ (p : Nat.Primes) : HeightOneSpectrum (𝓞 ℚ) := -+ rationalCyclotomicArtinPlace p -+ -+/-- The cyclotomic extension of `ℚ` generated by roots of unity of the given positive level. -/ -+abbrev rationalCyclotomicPrincipalPrimeLevel -+ (m : ℕ+) := -+ rationalCyclotomicArtinLevel m -+ -+private abbrev rationalCyclotomicPrincipalPrimeExtension -+ (m : ℕ+) (p : Nat.Primes) := -+ rationalCyclotomicArtinExtension m p -+ -+/-- The `ℚ_[p]`-algebra structure on the localized cyclotomic completion, -+transported through the canonical comparison with the `p`-adic completion. -/ -+@[reducible] -+noncomputable def -+ rationalCyclotomicPrincipalPrimeLocalizedPadicAlgebra -+ (m : ℕ+) (p : Nat.Primes) : -+ Algebra ℚ_[p.1] -+ (rationalCyclotomicLocalizedCompletion m -+ (RayClass.rationalPrime p)) := -+ ((algebraMap -+ (HeightOneSpectrum.adicAbv ℚ -+ (RayClass.rationalPrime p)).Completion -+ (rationalCyclotomicLocalizedCompletion m -+ (RayClass.rationalPrime p))).comp -+ (rationalFinitePlaceCompletionRingEquivPadic p).symm.toRingHom).toAlgebra -+ -+@[reducible] -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedPadicAlgebra -+ (m : ℕ+) (p : Nat.Primes) : -+ Algebra ℚ_[p.1] (rationalCyclotomicArtinLocalizedField m p) := -+ rationalCyclotomicPrincipalPrimeLocalizedPadicAlgebra m p -+ -+private noncomputable def rationalFinitePlaceCompletionAlgEquivPadic -+ (p : Nat.Primes) : -+ (rationalCyclotomicArtinBaseAbv p).Completion ≃ₐ[ℚ] ℚ_[p.1] := -+ AlgEquiv.ofRingEquiv -+ (f := rationalFinitePlaceCompletionRingEquivPadic p) -+ (rationalFinitePlaceCompletionRingEquivPadic_algebraMap p) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedPadicScalarTower -+ (m : ℕ+) (p : Nat.Primes) : -+ IsScalarTower ℚ ℚ_[p.1] -+ (rationalCyclotomicArtinLocalizedField m p) := by -+ constructor -+ intro r x y -+ simp only [Algebra.smul_def, map_mul, eq_ratCast, -+ map_ratCast, mul_assoc] -+ -+private theorem rationalCyclotomicArtin_padic_algebraMap -+ (m : ℕ+) (p : Nat.Primes) : -+ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -+ (rationalCyclotomicArtinLocalizedField m p) = -+ (algebraMap ℚ_[p.1] -+ (rationalCyclotomicArtinLocalizedField m p)) ∘ -+ (rationalFinitePlaceCompletionAlgEquivPadic p) := by -+ funext a -+ change -+ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -+ (rationalCyclotomicArtinLocalizedField m p) a = -+ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -+ (rationalCyclotomicArtinLocalizedField m p) -+ ((rationalFinitePlaceCompletionRingEquivPadic p).symm -+ (rationalFinitePlaceCompletionRingEquivPadic p a)) -+ exact -+ congrArg -+ (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion -+ (rationalCyclotomicArtinLocalizedField m p)) -+ ((rationalFinitePlaceCompletionRingEquivPadic p).symm_apply_apply a).symm -+ -+private theorem rationalCyclotomicArtin_algebraAdjoin_restrictScalars -+ (m : ℕ+) (p : Nat.Primes) : -+ (Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion -+ ({rationalCyclotomicLocalizedPrimitiveRoot m -+ (rationalCyclotomicArtinPlace p)} : -+ Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = -+ (Algebra.adjoin ℚ_[p.1] -+ ({rationalCyclotomicLocalizedPrimitiveRoot m -+ (rationalCyclotomicArtinPlace p)} : -+ Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ := by -+ exact -+ Algebra.restrictScalars_adjoin_of_algEquiv -+ (E := rationalCyclotomicArtinLocalizedField m p) -+ (rationalFinitePlaceCompletionAlgEquivPadic p) -+ (rationalCyclotomicArtin_padic_algebraMap m p) -+ ({rationalCyclotomicLocalizedPrimitiveRoot m -+ (rationalCyclotomicArtinPlace p)} : -+ Set (rationalCyclotomicArtinLocalizedField m p)) -+ -+private theorem -+ rationalCyclotomicArtin_baseAlgebraAdjoin_restrict_eq_top -+ (m : ℕ+) (p : Nat.Primes) : -+ (Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion -+ ({rationalCyclotomicLocalizedPrimitiveRoot m -+ (rationalCyclotomicArtinPlace p)} : -+ Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = -+ (⊤ : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion -+ (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := by -+ have hRoot : IsPrimitiveRoot -+ (show rationalCyclotomicArtinLocalizedField m p from -+ rationalCyclotomicLocalizedPrimitiveRoot m -+ (rationalCyclotomicArtinPlace p)) -+ (m : ℕ) := -+ rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot -+ m (rationalCyclotomicArtinPlace p) -+ have hTop : -+ Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion -+ ({rationalCyclotomicLocalizedPrimitiveRoot m -+ (rationalCyclotomicArtinPlace p)} : -+ Set (rationalCyclotomicArtinLocalizedField m p)) = ⊤ := -+ IsCyclotomicExtension.adjoin_primitive_root_eq_top -+ (A := (rationalCyclotomicArtinBaseAbv p).Completion) -+ (B := rationalCyclotomicArtinLocalizedField m p) hRoot -+ exact congrArg -+ (fun A : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion -+ (rationalCyclotomicArtinLocalizedField m p) => A.restrictScalars ℚ) -+ hTop -+ -+private theorem rationalCyclotomicArtin_restrictScalars_top_base_eq_padic -+ (m : ℕ+) (p : Nat.Primes) : -+ (⊤ : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion -+ (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ = -+ (⊤ : Subalgebra ℚ_[p.1] -+ (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := -+ (Subalgebra.restrictScalars_top ℚ).trans -+ (Subalgebra.restrictScalars_top ℚ).symm -+ -+private theorem -+ rationalCyclotomicArtin_padicAlgebraAdjoin_restrict_eq_top -+ (m : ℕ+) (p : Nat.Primes) : -+ (Algebra.adjoin ℚ_[p.1] -+ ({rationalCyclotomicLocalizedPrimitiveRoot m -+ (rationalCyclotomicArtinPlace p)} : -+ Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = -+ (⊤ : Subalgebra ℚ_[p.1] -+ (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := by -+ exact -+ (rationalCyclotomicArtin_algebraAdjoin_restrictScalars m p).symm.trans -+ ((rationalCyclotomicArtin_baseAlgebraAdjoin_restrict_eq_top m p).trans -+ (rationalCyclotomicArtin_restrictScalars_top_base_eq_padic m p)) -+ -+/-- The finite-dimensional instance for the standard multiplicative level, -+named once so all consumers use the same proof term. -/ -+theorem rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional -+ (p : Nat.Primes) (n : ℕ) : -+ FiniteDimensional ℚ_[p.1] -+ (standardLubinTateLevelField -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) := -+ standardLubinTateLevelField_finiteDimensional -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -+ -+attribute [local instance] -+ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional -+ -+noncomputable local instance -+ rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois -+ (p : Nat.Primes) (n : ℕ) : -+ IsAbelianGalois ℚ_[p.1] -+ (RationalCyclotomicPrincipalPrimePadicLevel p n) := -+ standardLubinTateLevelField_isAbelianGalois -+ (padicLocalField p.1) -+ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n -+ -+@[reducible] -+noncomputable local instance rationalPrimeFactorCompletionPadicAlgebra -+ (p : Nat.Primes) : -+ Algebra (RationalCyclotomicPrincipalPrimeCompletion p) ℚ_[p.1] := -+ (rationalFinitePlaceCompletionRingEquivPadic p).toRingHom.toAlgebra -+ -+/-- The genuine multiplicative Lubin--Tate level is generated by its -+primitive `p ^ (n + 1)`-st root of unity. -/ -+theorem padicMultiplicativePrimitiveRoot_adjoin_eq_top -+ (p : ℕ) [Fact p.Prime] (n : ℕ) : -+ let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p -+ let T := standardLubinTateLevelField hπ n -+ Algebra.adjoin ℚ_[p] -+ ({padicMultiplicativePrimitiveRoot p n} : Set T) = -+ ⊤ := by -+ let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p -+ let T := standardLubinTateLevelField hπ n -+ let ζ : T := padicMultiplicativePrimitiveRoot p n -+ let m := p ^ (n + 1) -+ let : NeZero m := -+ ⟨pow_ne_zero _ (Fact.out : Nat.Prime p).ne_zero⟩ -+ let : FiniteDimensional ℚ_[p] T := -+ standardLubinTateLevelField_finiteDimensional hπ n -+ have hζ : IsPrimitiveRoot ζ m := by -+ simpa only [ζ, m] using -+ padicMultiplicativePrimitiveRoot_isPrimitiveRoot p n -+ let A : IntermediateField ℚ_[p] T := -+ IntermediateField.adjoin ℚ_[p] {ζ} -+ let : IsCyclotomicExtension {m} ℚ_[p] A := -+ hζ.intermediateField_adjoin_isCyclotomicExtension ℚ_[p] -+ have hAfin : -+ Module.finrank ℚ_[p] A = Nat.totient m := by -+ exact -+ IsCyclotomicExtension.finrank A -+ (by -+ simpa only [m] using -+ padicCyclotomicPolynomial_irreducible_prime_pow_succ -+ p n) -+ have hTfin : -+ Module.finrank ℚ_[p] T = Nat.totient m := by -+ rw [standardLubinTateLevelField_finrank hπ n] -+ have hcard : -+ Nat.card (padicLocalField p).residueField = p := by -+ simpa [padicLocalField] using -+ padicCompleteDVF_residueField_card p -+ rw [hcard, Nat.totient_prime_pow -+ (Fact.out : Nat.Prime p) (Nat.succ_pos n)] -+ simp [Nat.mul_comm] -+ have hAeq : A = ⊤ := by -+ apply IntermediateField.eq_of_le_of_finrank_eq le_top -+ simpa using hAfin.trans hTfin.symm -+ calc -+ Algebra.adjoin ℚ_[p] {ζ} = A.toSubalgebra := by -+ exact -+ (IntermediateField.adjoin_toSubalgebra -+ ({ζ} : Set T)).symm -+ _ = (⊤ : IntermediateField ℚ_[p] T).toSubalgebra := -+ congrArg IntermediateField.toSubalgebra hAeq -+ _ = ⊤ := rfl -+ -+/-- The standard multiplicative Lubin--Tate level is the actual -+`p ^ (n + 1)`-cyclotomic extension of `ℚ_p`. -/ -+theorem padicMultiplicativeLevel_isCyclotomicExtension -+ (p : ℕ) [Fact p.Prime] (n : ℕ) : -+ let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p -+ let T := standardLubinTateLevelField hπ n -+ IsCyclotomicExtension {p ^ (n + 1)} ℚ_[p] T := by -+ let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p -+ let T := standardLubinTateLevelField hπ n -+ exact -+ padic_isCyclotomicExtension_of_primitiveRoot_adjoin_eq_top -+ (padicMultiplicativePrimitiveRoot p n) -+ (padicMultiplicativePrimitiveRoot_isPrimitiveRoot p n) -+ (padicMultiplicativePrimitiveRoot_adjoin_eq_top p n) -+ -+private theorem -+ rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_isPrimitiveRoot -+ (p : Nat.Primes) (n : ℕ) : -+ IsPrimitiveRoot -+ (rationalCyclotomicLocalizedPrimitiveRoot -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p)) -+ (p.1 ^ (n + 1)) := by -+ change -+ IsPrimitiveRoot -+ (rationalCyclotomicLocalizedPrimitiveRoot -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p)) -+ (rationalCyclotomicPrincipalPrimeModulus p n : ℕ) -+ exact -+ rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p) -+ -+private theorem -+ rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_adjoin_eq_top -+ (p : Nat.Primes) (n : ℕ) : -+ Algebra.adjoin ℚ_[p.1] -+ ({rationalCyclotomicLocalizedPrimitiveRoot -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (rationalCyclotomicArtinPlace p)} : -+ Set (rationalCyclotomicArtinLocalizedField -+ (rationalCyclotomicPrincipalPrimeModulus p n) p)) = -+ ⊤ := by -+ exact -+ (Subalgebra.restrictScalars_injective ℚ) -+ (rationalCyclotomicArtin_padicAlgebraAdjoin_restrict_eq_top -+ (rationalCyclotomicPrincipalPrimeModulus p n) p) -+ -+theorem -+ rationalCyclotomicPrincipalPrimeLocalizedLevel_isCyclotomicExtension -+ (p : Nat.Primes) (n : ℕ) : -+ IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] -+ (rationalCyclotomicArtinLocalizedField -+ (rationalCyclotomicPrincipalPrimeModulus p n) p) := by -+ exact -+ padic_isCyclotomicExtension_of_primitiveRoot_adjoin_eq_top -+ (rationalCyclotomicLocalizedPrimitiveRoot -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (rationalCyclotomicArtinPlace p)) -+ (rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_isPrimitiveRoot -+ p n) -+ (rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_adjoin_eq_top -+ p n) -+ -+ -+end RationalCyclotomicPrincipalPrime -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPrincipal.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPrincipal.lean -new file mode 100644 -index 0000000..43c227c ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPrincipal.lean -@@ -0,0 +1,228 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinAction -+ -+ -+set_option autoImplicit false -+ -+open scoped Classical NNReal NumberField ValuativeRel -+open NumberField IsDedekindDomain -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open LocalClassFieldTheory -+open LocalFieldTheory -+open LocalFieldTheory.DiscreteValuationField -+open LocalFieldTheory.DiscreteValuationField.Examples.Qp -+open LubinTate -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+section RationalCyclotomicPrincipalPrime -+ -+attribute [local instance] -+ rationalFinitePlaceCompletionRatAlgebra -+ primeFact -+ levelNeZero -+ rationalCyclotomicLevelFiniteDimensional -+ rationalCyclotomicLevelIsAbelianGalois -+ rationalFinitePlaceBaseNontriviallyNormedField -+ rationalFinitePlaceBaseLocallyCompactSpace -+ rationalFinitePlaceBaseIsUltrametricDist -+ rationalFinitePlaceBaseValued -+ rationalFinitePlaceBaseValuativeRel -+ rationalFinitePlaceBaseValuationIsNontrivial -+ rationalFinitePlaceBaseValuationCompatible -+ rationalFinitePlaceBaseValuativeRelIsNontrivial -+ rationalFinitePlaceBaseIsValuativeTopology -+ rationalFinitePlaceBaseIsNonarchimedeanLocalField -+ rationalCyclotomicArtinExtensionAlgebra -+ rationalCyclotomicArtinExtensionSMul -+ rationalCyclotomicArtinCompletionAlgebra -+ rationalCyclotomicArtinLocalizedAlgebra -+ rationalCyclotomicArtinLocalizedGlobalAlgebra -+ rationalCyclotomicArtinLocalizedGlobalSMul -+ rationalCyclotomicArtinLocalizedScalarTower -+ rationalCyclotomicArtinLocalizedFiniteDimensional -+ rationalCyclotomicArtinLocalizedIsAbelianGalois -+ rationalCyclotomicArtinLocalizedIsSeparable -+ rationalCyclotomicArtinLocalizedIsCyclotomic -+ rationalCyclotomicArtinExtensionFiniteDimensional -+ rationalCyclotomicArtinExtensionContinuousSMul -+ rationalCyclotomicArtinExtensionLocallyCompact -+ rationalCyclotomicArtinLocalizedLocallyCompact -+ rationalCyclotomicArtinLocalizedIsUltrametricDist -+ rationalCyclotomicArtinLocalizedValued -+ rationalCyclotomicArtinLocalizedValuativeRel -+ rationalCyclotomicArtinLocalizedValuationCompatible -+ rationalCyclotomicArtinLocalizedValuationHasExtension -+ rationalCyclotomicArtinLocalizedValuationIsNontrivial -+ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial -+ rationalCyclotomicArtinLocalizedIsValuativeTopology -+ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField -+ rationalCyclotomicArtinLocalizedIntegerAlgebra -+ rationalCyclotomicArtinLocalizedIsIntegralClosure -+ rationalCyclotomicArtinLocalizedIntegerModuleFinite -+ rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension -+ rationalCyclotomicArtinLocalizedPadicAlgebra -+ rationalCyclotomicArtinLocalizedPadicScalarTower -+ rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois -+ rationalPrimeFactorCompletionPadicAlgebra -+ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional -+ -+private theorem -+ rationalCyclotomicPrincipalPrime_padicUnitParameterArtin_action -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -+ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) = -+ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) ^ -+ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := by -+ let m := rationalCyclotomicPrincipalPrimeModulus p n -+ let E := rationalCyclotomicArtinLocalizedField m p -+ let T := RationalCyclotomicPrincipalPrimePadicLevel p n -+ let eL : E ≃ₐ[ℚ_[p.1]] T := -+ rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ let zetaE : E := rationalCyclotomicPrincipalPrimeLocalizedRoot p n -+ let tau : Gal(T / ℚ_[p.1]) := -+ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -+ let a := rationalCyclotomicPrincipalPrimeResidueUnit p n x -+ let zetaT : T := padicMultiplicativePrimitiveRoot p.1 n -+ have hzetaE : IsPrimitiveRoot zetaE (p.1 ^ (n + 1)) := by -+ change -+ IsPrimitiveRoot -+ (rationalCyclotomicLocalizedPrimitiveRoot m -+ (RayClass.rationalPrime p)) (m : ℕ) -+ exact -+ rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot -+ m (RayClass.rationalPrime p) -+ have hrho : IsPrimitiveRoot (eL zetaE) (p.1 ^ (n + 1)) := -+ hzetaE.map_of_injective eL.injective -+ have hzetaT : IsPrimitiveRoot zetaT (p.1 ^ (n + 1)) := -+ padicMultiplicativePrimitiveRoot_isPrimitiveRoot p.1 n -+ have htauZetaT : tau zetaT = zetaT ^ a.val.val := -+ padicMultiplicativePrimitiveRoot_rationalPrimeUnitParameterGaloisAction -+ p n x -+ exact -+ map_primitiveRoot_eq_pow_of_eq_pow -+ tau.toMonoidHom zetaT (eL zetaE) -+ (p.1 ^ (n + 1)) a.val.val hzetaT hrho htauZetaT -+ -+private theorem rationalCyclotomicPrincipalPrime_localArtin_action -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ finitePlaceLocalArtinMonoidHom -+ (K := ℚ) -+ (L := KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (RayClass.rationalPrime p) -+ (rationalCyclotomicChosenFinitePlaceExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p)) -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime p) -+ (IdeleGroup.principalIdele ℚ x)) -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) = -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ^ -+ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := by -+ let eL := rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n -+ apply eL.injective -+ calc -+ _ = _ := -+ finitePlaceLocalArtinMonoidHom_apply_semilinear -+ (K := ℚ) -+ (L := KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (K' := ℚ_[p.1]) -+ (L' := RationalCyclotomicPrincipalPrimePadicLevel p n) -+ (RayClass.rationalPrime p) -+ (rationalCyclotomicChosenFinitePlaceExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p)) -+ (rationalFinitePlaceCompletionRingEquivPadic p) -+ eL.toRingEquiv -+ (rationalCyclotomicPrincipalPrime_localizedBase_commutes p n) -+ (rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible -+ p) -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime p) -+ (IdeleGroup.principalIdele ℚ x)) -+ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) -+ _ = rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x -+ (eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := -+ rationalCyclotomicPrincipalPrime_padicArtin_action_eq_unitParameter -+ p n x -+ _ = (eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) ^ -+ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := -+ rationalCyclotomicPrincipalPrime_padicUnitParameterArtin_action p n x -+ _ = eL ((rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ^ -+ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val) := -+ (map_pow eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) -+ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val).symm -+ -+/-- The finite-place Artin symbol at the ramified prime, in its canonical -+local-to-global factored form. Keeping this specialization opaque prevents its -+dependent local/global instance tower from being unfolded downstream. -/ -+noncomputable def rationalCyclotomicPrincipalPrimeChosenArtin -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n) ≃ₐ[ℚ] -+ KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n) := -+ finitePlaceLocalToGlobalMonoidHom -+ (K := ℚ) -+ (L := KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (RayClass.rationalPrime p) -+ (rationalCyclotomicChosenFinitePlaceExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p)) -+ (finitePlaceLocalArtinMonoidHom -+ (K := ℚ) -+ (L := KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (RayClass.rationalPrime p) -+ (rationalCyclotomicChosenFinitePlaceExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n) -+ (RayClass.rationalPrime p)) -+ (IdeleGroup.finiteComponent -+ (RayClass.rationalPrime p) -+ (IdeleGroup.principalIdele ℚ x))) -+ -+/-- At the ramified prime, the cyclotomic character of the chosen finite-place -+Artin symbol is the direct reduction of the rational `p`-adic unit. -/ -+theorem galEquivZMod_chosenFinitePlaceArtinMonoidHom_principal_at_prime -+ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : -+ IsCyclotomicExtension.Rat.galEquivZMod -+ (p.1 ^ (n + 1)) -+ (KummerTheory.rationalCyclotomicLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (hK := -+ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (rationalCyclotomicPrincipalPrimeChosenArtin p n x) = -+ Units.map -+ (PadicInt.toZModPow (p := p.1) (n + 1)).toMonoidHom -+ (padicIntUnitOfRat p -+ (rationalPrimeUnit x p : ℚ) -+ (rationalPrimeUnit x p).ne_zero -+ (padicValRat_rationalPrimeUnit x p)) := by -+ change _ = rationalCyclotomicPrincipalPrimeResidueUnit p n x -+ apply rationalCyclotomicPrincipalPrime_galEquivZMod_eq_of_action p n -+ simp only [rationalCyclotomicPrincipalPrimeChosenArtin] -+ apply finitePlaceLocalToGlobalMonoidHom_apply_pow_of_localized_action -+ (zLocal := rationalCyclotomicPrincipalPrimeLocalizedRoot p n) -+ · rfl -+ · exact rationalCyclotomicPrincipalPrime_localArtin_action p n x -+ -+end RationalCyclotomicPrincipalPrime -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTower.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTower.lean -new file mode 100644 -index 0000000..77efaa0 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTower.lean -@@ -0,0 +1,357 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinBase -+ -+ -+set_option autoImplicit false -+ -+open scoped Classical NNReal NumberField ValuativeRel -+open NumberField IsDedekindDomain -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open LocalClassFieldTheory -+open LocalFieldTheory -+open LocalFieldTheory.DiscreteValuationField -+open LocalFieldTheory.DiscreteValuationField.Examples.Qp -+open LubinTate -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+attribute [local instance] -+ rationalFinitePlaceCompletionRatAlgebra -+ primeFact -+ levelNeZero -+ rationalCyclotomicLevelFiniteDimensional -+ rationalCyclotomicLevelIsAbelianGalois -+ rationalFinitePlaceBaseNontriviallyNormedField -+ rationalFinitePlaceBaseLocallyCompactSpace -+ rationalFinitePlaceBaseIsUltrametricDist -+ rationalFinitePlaceBaseValued -+ rationalFinitePlaceBaseValuativeRel -+ rationalFinitePlaceBaseValuationIsNontrivial -+ rationalFinitePlaceBaseValuationCompatible -+ rationalFinitePlaceBaseValuativeRelIsNontrivial -+ rationalFinitePlaceBaseIsValuativeTopology -+ rationalFinitePlaceBaseIsNonarchimedeanLocalField -+ -+/-- The finite place of `ℚ` determined by the rational prime `q`. -/ -+abbrev rationalCyclotomicArtinPlace (q : Nat.Primes) : -+ HeightOneSpectrum (𝓞 ℚ) := -+ RayClass.rationalPrime q -+ -+/-- The `q`-adic absolute value on `ℚ` used for the finite-place Artin map. -/ -+abbrev rationalCyclotomicArtinBaseAbv (q : Nat.Primes) : -+ AbsoluteValue ℚ ℝ := -+ HeightOneSpectrum.adicAbv ℚ (rationalCyclotomicArtinPlace q) -+ -+/-- The rational cyclotomic extension at the positive level `m`. -/ -+abbrev rationalCyclotomicArtinLevel (m : ℕ+) := -+ KummerTheory.rationalCyclotomicLevel m -+ -+/-- A chosen extension of the `q`-adic absolute value to the cyclotomic field. -/ -+abbrev rationalCyclotomicArtinExtension -+ (m : ℕ+) (q : Nat.Primes) : -+ AbsoluteValueExtension -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinLevel m) := -+ chosenFinitePlaceExtension -+ (L := rationalCyclotomicArtinLevel m) -+ (rationalCyclotomicArtinPlace q) -+ -+/-- The local completion of the cyclotomic field at the chosen place above `q`. -/ -+abbrev rationalCyclotomicArtinLocalizedField -+ (m : ℕ+) (q : Nat.Primes) := -+ AlgebraicNumberTheory.Valuations.LocalizedCompletion -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q) -+ -+@[reducible] -+noncomputable local instance rationalCyclotomicArtinExtensionAlgebra -+ (m : ℕ+) (q : Nat.Primes) : -+ Algebra ℚ -+ (rationalCyclotomicArtinExtension m q).1.Completion := -+ AbsoluteValue.extensionCompletionAlgebra -+ (K := ℚ) (rationalCyclotomicArtinExtension m q).1 -+ -+@[reducible] -+noncomputable local instance rationalCyclotomicArtinExtensionSMul -+ (m : ℕ+) (q : Nat.Primes) : -+ SMul ℚ -+ (rationalCyclotomicArtinExtension m q).1.Completion := -+ (rationalCyclotomicArtinExtensionAlgebra m q).toSMul -+ -+@[reducible] -+noncomputable local instance -+ rationalCyclotomicArtinCompletionAlgebra -+ (m : ℕ+) (q : Nat.Primes) : -+ Algebra (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinExtension m q).1.Completion := -+ AbsoluteValue.completionAlgebra -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q).1 -+ (rationalCyclotomicArtinExtension m q).2 -+ -+@[reducible] -+noncomputable local instance rationalCyclotomicArtinLocalizedAlgebra -+ (m : ℕ+) (q : Nat.Primes) : -+ Algebra (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinLocalizedField m q) := -+ finitePlaceLocalArtinLocalizedAlgebra -+ (K := ℚ) (L := rationalCyclotomicArtinLevel m) -+ (rationalCyclotomicArtinPlace q) -+ (rationalCyclotomicArtinExtension m q) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedGlobalAlgebra -+ (m : ℕ+) (q : Nat.Primes) : -+ Algebra ℚ (rationalCyclotomicArtinLocalizedField m q) := -+ LocalClassFieldTheory.localizedCompletionGlobalAlgebra -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedGlobalSMul -+ (m : ℕ+) (q : Nat.Primes) : -+ SMul ℚ (rationalCyclotomicArtinLocalizedField m q) := -+ (rationalCyclotomicArtinLocalizedGlobalAlgebra m q).toSMul -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedScalarTower -+ (m : ℕ+) (q : Nat.Primes) : -+ IsScalarTower ℚ -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinLocalizedField m q) := by -+ constructor -+ intro r x y -+ simp only [Algebra.smul_def, map_mul, eq_ratCast, -+ map_ratCast, mul_assoc] -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedFiniteDimensional -+ (m : ℕ+) (q : Nat.Primes) : -+ FiniteDimensional -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinLocalizedField m q) := -+ finitePlaceLocalArtinFiniteDimensional -+ (K := ℚ) (L := rationalCyclotomicArtinLevel m) -+ (rationalCyclotomicArtinPlace q) -+ (rationalCyclotomicArtinExtension m q) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIsAbelianGalois -+ (m : ℕ+) (q : Nat.Primes) : -+ IsAbelianGalois -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinLocalizedField m q) := -+ finitePlaceLocalArtinIsAbelianGalois -+ (K := ℚ) (L := rationalCyclotomicArtinLevel m) -+ (rationalCyclotomicArtinPlace q) -+ (rationalCyclotomicArtinExtension m q) -+ (inferInstance : -+ FiniteDimensional ℚ (rationalCyclotomicArtinLevel m)) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIsSeparable -+ (m : ℕ+) (q : Nat.Primes) : -+ Algebra.IsSeparable -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinLocalizedField m q) := -+ (rationalCyclotomicArtinLocalizedIsAbelianGalois m q).toIsGalois.to_isSeparable -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIsCyclotomic -+ (m : ℕ+) (q : Nat.Primes) : -+ IsCyclotomicExtension {(m : ℕ)} -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinLocalizedField m q) := -+ rationalCyclotomicLevel_localizedCompletion_isCyclotomicExtension -+ m (rationalCyclotomicArtinPlace q) -+ -+noncomputable local instance -+ rationalCyclotomicArtinExtensionFiniteDimensional -+ (m : ℕ+) (q : Nat.Primes) : -+ FiniteDimensional -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinExtension m q).1.Completion := -+ completionModuleFinite -+ (rationalCyclotomicArtinBaseAbv q) -+ (RayClass.adicAbv_isNontrivial -+ (rationalCyclotomicArtinPlace q)) -+ (rationalCyclotomicArtinExtension m q) -+ -+noncomputable local instance -+ rationalCyclotomicArtinExtensionContinuousSMul -+ (m : ℕ+) (q : Nat.Primes) : -+ ContinuousSMul -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinExtension m q).1.Completion := -+ continuousSMul_of_algebraMap _ _ -+ (AbsoluteValue.completionMap_isometry -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q).1 -+ (rationalCyclotomicArtinExtension m q).2).continuous -+ -+noncomputable local instance -+ rationalCyclotomicArtinExtensionLocallyCompact -+ (m : ℕ+) (q : Nat.Primes) : -+ LocallyCompactSpace -+ (rationalCyclotomicArtinExtension m q).1.Completion := -+ LocallyCompactSpace.of_finiteDimensional_of_complete -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinExtension m q).1.Completion -+ -+private noncomputable def -+ rationalCyclotomicArtinLocalizedEquivCompletion -+ (m : ℕ+) (q : Nat.Primes) : -+ rationalCyclotomicArtinLocalizedField m q ≃ᵢ -+ (rationalCyclotomicArtinExtension m q).1.Completion := -+ { toEquiv := -+ (localizedCompletionEquivCompletion -+ (rationalCyclotomicArtinBaseAbv q) -+ (RayClass.adicAbv_isNontrivial -+ (rationalCyclotomicArtinPlace q)) -+ (rationalCyclotomicArtinExtension m q)).toEquiv -+ isometry_toFun := -+ Isometry.of_dist_eq fun _ _ => rfl } -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedLocallyCompact -+ (m : ℕ+) (q : Nat.Primes) : -+ LocallyCompactSpace -+ (rationalCyclotomicArtinLocalizedField m q) := -+ ((rationalCyclotomicArtinLocalizedEquivCompletion m q).toHomeomorph.locallyCompactSpace_iff).2 -+ inferInstance -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIsUltrametricDist -+ (m : ℕ+) (q : Nat.Primes) : -+ IsUltrametricDist -+ (rationalCyclotomicArtinLocalizedField m q) := -+ localizedCompletionIsUltrametricDist -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv -+ ℚ (rationalCyclotomicArtinPlace q)) -+ -+noncomputable local instance rationalCyclotomicArtinLocalizedValued -+ (m : ℕ+) (q : Nat.Primes) : -+ Valued (rationalCyclotomicArtinLocalizedField m q) ℝ≥0 := -+ localizedCompletionFinitePlaceValued -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv -+ ℚ (rationalCyclotomicArtinPlace q)) -+ -+@[reducible] -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedValuativeRel -+ (m : ℕ+) (q : Nat.Primes) : -+ ValuativeRel (rationalCyclotomicArtinLocalizedField m q) := -+ localizedCompletionFinitePlaceValuativeRel -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv -+ ℚ (rationalCyclotomicArtinPlace q)) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedValuationCompatible -+ (m : ℕ+) (q : Nat.Primes) : -+ (Valued.v : Valuation -+ (rationalCyclotomicArtinLocalizedField m q) ℝ≥0).Compatible := -+ Valuation.Compatible.ofValuation _ -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedValuationHasExtension -+ (m : ℕ+) (q : Nat.Primes) : -+ Valuation.HasExtension -+ (ValuativeRel.valuation -+ (rationalCyclotomicArtinBaseAbv q).Completion) -+ (ValuativeRel.valuation -+ (rationalCyclotomicArtinLocalizedField m q)) := -+ localizedCompletionValuationHasExtension -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv -+ ℚ (rationalCyclotomicArtinPlace q)) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedValuationIsNontrivial -+ (m : ℕ+) (q : Nat.Primes) : -+ (ValuativeRel.valuation -+ (rationalCyclotomicArtinLocalizedField m q)).IsNontrivial := -+ Valuation.IsNontrivial.of_hasExtension -+ (ValuativeRel.valuation -+ (rationalCyclotomicArtinBaseAbv q).Completion) -+ (ValuativeRel.valuation -+ (rationalCyclotomicArtinLocalizedField m q)) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial -+ (m : ℕ+) (q : Nat.Primes) : -+ ValuativeRel.IsNontrivial -+ (rationalCyclotomicArtinLocalizedField m q) := -+ (ValuativeRel.isNontrivial_iff_isNontrivial -+ (ValuativeRel.valuation -+ (rationalCyclotomicArtinLocalizedField m q))).2 inferInstance -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIsValuativeTopology -+ (m : ℕ+) (q : Nat.Primes) : -+ IsValuativeTopology -+ (rationalCyclotomicArtinLocalizedField m q) := -+ isValuativeTopology_of_valued_ofValuation -+ (rationalCyclotomicArtinLocalizedField m q) ℝ≥0 -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField -+ (m : ℕ+) (q : Nat.Primes) : -+ IsNonarchimedeanLocalField -+ (rationalCyclotomicArtinLocalizedField m q) := -+ { toIsValuativeTopology := inferInstance -+ toLocallyCompactSpace := inferInstance -+ toIsNontrivial := inferInstance } -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIntegerAlgebra -+ (m : ℕ+) (q : Nat.Primes) : -+ Algebra -+ 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] -+ (rationalCyclotomicArtinLocalizedField m q) := -+ Algebra.ofSubsemiring -+ 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIsIntegralClosure -+ (m : ℕ+) (q : Nat.Primes) : -+ IsIntegralClosure -+ 𝒪[rationalCyclotomicArtinLocalizedField m q] -+ 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] -+ (rationalCyclotomicArtinLocalizedField m q) := -+ localizedCompletionIsIntegralClosureWithExtension -+ (rationalCyclotomicArtinBaseAbv q) -+ (rationalCyclotomicArtinExtension m q) -+ (RayClass.adicAbv_isNontrivial -+ (rationalCyclotomicArtinPlace q)) -+ (HeightOneSpectrum.isNonarchimedean_adicAbv -+ ℚ (rationalCyclotomicArtinPlace q)) -+ -+noncomputable local instance -+ rationalCyclotomicArtinLocalizedIntegerModuleFinite -+ (m : ℕ+) (q : Nat.Primes) : -+ Module.Finite -+ 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] -+ 𝒪[rationalCyclotomicArtinLocalizedField m q] := -+ integerRing_moduleFinite_of_isIntegralClosure -+ (rationalCyclotomicArtinBaseAbv q).Completion -+ (rationalCyclotomicArtinLocalizedField m q) -+ -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTransport.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTransport.lean -new file mode 100644 -index 0000000..666b029 ---- /dev/null -+++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTransport.lean -@@ -0,0 +1,375 @@ -+/- -+Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Naganori Yamaguchi (assisted by OpenAI Codex) -+-/ -+ -+import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinPadic -+ -+ -+set_option autoImplicit false -+ -+open scoped Classical NNReal NumberField ValuativeRel -+open NumberField IsDedekindDomain -+open AlgebraicNumberTheory.Valuations -+open HilbertRamification -+open LocalClassFieldTheory -+open LocalFieldTheory -+open LocalFieldTheory.DiscreteValuationField -+open LocalFieldTheory.DiscreteValuationField.Examples.Qp -+open LubinTate -+ -+noncomputable section -+ -+namespace GlobalClassFieldTheory -+namespace Reciprocity -+ -+section RationalCyclotomicPrincipalPrime -+ -+attribute [local instance] -+ rationalFinitePlaceCompletionRatAlgebra -+ primeFact -+ levelNeZero -+ rationalCyclotomicLevelFiniteDimensional -+ rationalCyclotomicLevelIsAbelianGalois -+ rationalFinitePlaceBaseNontriviallyNormedField -+ rationalFinitePlaceBaseLocallyCompactSpace -+ rationalFinitePlaceBaseIsUltrametricDist -+ rationalFinitePlaceBaseValued -+ rationalFinitePlaceBaseValuativeRel -+ rationalFinitePlaceBaseValuationIsNontrivial -+ rationalFinitePlaceBaseValuationCompatible -+ rationalFinitePlaceBaseValuativeRelIsNontrivial -+ rationalFinitePlaceBaseIsValuativeTopology -+ rationalFinitePlaceBaseIsNonarchimedeanLocalField -+ rationalCyclotomicArtinExtensionAlgebra -+ rationalCyclotomicArtinExtensionSMul -+ rationalCyclotomicArtinCompletionAlgebra -+ rationalCyclotomicArtinLocalizedAlgebra -+ rationalCyclotomicArtinLocalizedGlobalAlgebra -+ rationalCyclotomicArtinLocalizedGlobalSMul -+ rationalCyclotomicArtinLocalizedScalarTower -+ rationalCyclotomicArtinLocalizedFiniteDimensional -+ rationalCyclotomicArtinLocalizedIsAbelianGalois -+ rationalCyclotomicArtinLocalizedIsSeparable -+ rationalCyclotomicArtinLocalizedIsCyclotomic -+ rationalCyclotomicArtinExtensionFiniteDimensional -+ rationalCyclotomicArtinExtensionContinuousSMul -+ rationalCyclotomicArtinExtensionLocallyCompact -+ rationalCyclotomicArtinLocalizedLocallyCompact -+ rationalCyclotomicArtinLocalizedIsUltrametricDist -+ rationalCyclotomicArtinLocalizedValued -+ rationalCyclotomicArtinLocalizedValuativeRel -+ rationalCyclotomicArtinLocalizedValuationCompatible -+ rationalCyclotomicArtinLocalizedValuationHasExtension -+ rationalCyclotomicArtinLocalizedValuationIsNontrivial -+ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial -+ rationalCyclotomicArtinLocalizedIsValuativeTopology -+ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField -+ rationalCyclotomicArtinLocalizedIntegerAlgebra -+ rationalCyclotomicArtinLocalizedIsIntegralClosure -+ rationalCyclotomicArtinLocalizedIntegerModuleFinite -+ rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension -+ rationalCyclotomicArtinLocalizedPadicAlgebra -+ rationalCyclotomicArtinLocalizedPadicScalarTower -+ rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois -+ rationalPrimeFactorCompletionPadicAlgebra -+ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional -+ -+/-- The chosen localized global cyclotomic level, transported over the -+completion equivalence, is the standard multiplicative Lubin--Tate level. -/ -+noncomputable def rationalCyclotomicLocalizedCompletionPadicAlgEquiv -+ (p : Nat.Primes) (n : ℕ) : -+ rationalCyclotomicArtinLocalizedField -+ (rationalCyclotomicPrincipalPrimeModulus p n) p ≃ₐ[ℚ_[p.1]] -+ RationalCyclotomicPrincipalPrimePadicLevel p n := by -+ letI : IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] -+ (rationalCyclotomicArtinLocalizedField -+ (rationalCyclotomicPrincipalPrimeModulus p n) p) := -+ rationalCyclotomicPrincipalPrimeLocalizedLevel_isCyclotomicExtension p n -+ letI : IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] -+ (RationalCyclotomicPrincipalPrimePadicLevel p n) := -+ padicMultiplicativeLevel_isCyclotomicExtension p.1 n -+ exact -+ IsCyclotomicExtension.algEquiv -+ {p.1 ^ (n + 1)} ℚ_[p.1] -+ (rationalCyclotomicArtinLocalizedField -+ (rationalCyclotomicPrincipalPrimeModulus p n) p) -+ (RationalCyclotomicPrincipalPrimePadicLevel p n) -+ -+/-! ## The ramified principal finite-place factor -/ -+ -+theorem -+ rationalCyclotomicPrincipalPrime_galEquivZMod_eq_of_action -+ (p : Nat.Primes) (n : ℕ) -+ (sigma : Gal( -+ rationalCyclotomicPrincipalPrimeLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n) / ℚ)) -+ (a : (ZMod (p.1 ^ (n + 1)))ˣ) -+ (haction : -+ sigma (rationalCyclotomicLevelPrimitiveRoot -+ (rationalCyclotomicPrincipalPrimeModulus p n)) = -+ rationalCyclotomicLevelPrimitiveRoot -+ (rationalCyclotomicPrincipalPrimeModulus p n) ^ a.val.val) : -+ IsCyclotomicExtension.Rat.galEquivZMod -+ (p.1 ^ (n + 1)) -+ (rationalCyclotomicPrincipalPrimeLevel -+ (rationalCyclotomicPrincipalPrimeModulus p n)) -+ (hK := -+ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension -+ (rationalCyclotomicPrincipalPrimeModulus p n)) sigma = -+ a := by -+ let m := rationalCyclotomicPrincipalPrimeModulus p n -+ let L := rationalCyclotomicPrincipalPrimeLevel m -+ let zeta : L := rationalCyclotomicLevelPrimitiveRoot m -+ have hzeta : IsPrimitiveRoot zeta (p.1 ^ (n + 1)) := by -+ change -+ IsPrimitiveRoot -+ (rationalCyclotomicLevelPrimitiveRoot m) (m : ℕ) -+ exact rationalCyclotomicLevelPrimitiveRoot_isPrimitiveRoot m -+ change -+ IsCyclotomicExtension.Rat.galEquivZMod -+ (p.1 ^ (n + 1)) L -+ (hK := -+ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) -+ sigma = a -+ let c := -+ IsCyclotomicExtension.Rat.galEquivZMod -+ (p.1 ^ (n + 1)) L -+ (hK := -+ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) -+ sigma -+ have hc : -+ sigma zeta = zeta ^ c.val.val := -+ IsCyclotomicExtension.Rat.galEquivZMod_apply_of_pow_eq -+ (hK := -+ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) -+ (p.1 ^ (n + 1)) L sigma hzeta.pow_eq_one -+ have hpowers : -+ zeta ^ c.val.val = zeta ^ a.val.val := -+ hc.symm.trans haction -+ rw [(hzeta.isOfFinOrder m.ne_zero).pow_inj_mod, -+ ← hzeta.eq_orderOf, -+ ← ZMod.natCast_eq_natCast_iff'] at hpowers -+ change -+ (c.val.val : ZMod (p.1 ^ (n + 1))) = -+ (a.val.val : ZMod (p.1 ^ (n + 1))) at hpowers -+ have hValues : c.val = a.val := by -+ calc -+ c.val = (c.val.val : ZMod (p.1 ^ (n + 1))) := -+ (ZMod.natCast_zmod_val c.val).symm -+ _ = (a.val.val : ZMod (p.1 ^ (n + 1))) := hpowers -+ _ = a.val := ZMod.natCast_zmod_val a.val -+ change c = a -+ apply Units.ext -+ exact hValues -+ -+/-- The chosen finite-place Artin map factors through any extension identified -+with the chosen one. -/ -+theorem chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq -+ {K L : Type} -+ [Field K] [NumberField K] -+ [Field L] [Algebra K L] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ (v : HeightOneSpectrum (𝓞 K)) -+ (w : AbsoluteValueExtension -+ (HeightOneSpectrum.adicAbv K v) L) -+ (hw : chosenFinitePlaceExtension (L := L) v = w) -+ (x : (v.adicCompletion K)ˣ) : -+ chosenFinitePlaceArtinMonoidHom -+ (K := K) (L := L) v x = -+ finitePlaceLocalToGlobalMonoidHom -+ (K := K) (L := L) v w -+ (finitePlaceLocalArtinMonoidHom -+ (K := K) (L := L) v w x) := by -+ subst w -+ exact -+ congrArg -+ (fun f : (v.adicCompletion K)ˣ →* (L ≃ₐ[K] L) => f x) -+ (finitePlaceArtinMonoidHomOfExtension_factor -+ (K := K) (L := L) v -+ (chosenFinitePlaceExtension (L := L) v)) -+ -+private theorem -+ chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq_at -+ {K L : Type} -+ [Field K] [NumberField K] -+ [Field L] [Algebra K L] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ (v : HeightOneSpectrum (𝓞 K)) -+ (w : AbsoluteValueExtension -+ (HeightOneSpectrum.adicAbv K v) L) -+ (hw : chosenFinitePlaceExtension (L := L) v = w) -+ (x : (v.adicCompletion K)ˣ) (z : L) : -+ chosenFinitePlaceArtinMonoidHom -+ (K := K) (L := L) v x z = -+ finitePlaceLocalToGlobalMonoidHom -+ (K := K) (L := L) v w -+ (finitePlaceLocalArtinMonoidHom -+ (K := K) (L := L) v w x) z := by -+ exact -+ congrArg (fun sigma : Gal(L / K) => sigma z) -+ (chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq -+ (K := K) (L := L) v w hw x) -+ -+theorem finitePlaceLocalToGlobalMonoidHom_apply_pow_of_localized_action -+ {K L : Type} -+ [Field K] [NumberField K] -+ [Field L] [Algebra K L] -+ [FiniteDimensional K L] [IsAbelianGalois K L] -+ (v : HeightOneSpectrum (𝓞 K)) -+ (w : AbsoluteValueExtension -+ (HeightOneSpectrum.adicAbv K v) L) -+ (sigma : -+ let vK := HeightOneSpectrum.adicAbv K v -+ let E := LocalizedCompletion vK w -+ letI : Algebra vK.Completion E := -+ finitePlaceLocalArtinLocalizedAlgebra v w -+ Gal(E / vK.Completion)) -+ (z : L) -+ (zLocal : -+ let vK := HeightOneSpectrum.adicAbv K v -+ LocalizedCompletion vK w) -+ (e : ℕ) -+ (hLocalization : -+ let vK := HeightOneSpectrum.adicAbv K v -+ let E := LocalizedCompletion vK w -+ letI : Algebra vK.Completion E := -+ finitePlaceLocalArtinLocalizedAlgebra v w -+ let eLoc : L →+* E := -+ AbsoluteValue.toAlgebraicLocalization vK w.1 w.2 -+ eLoc z = zLocal) -+ (hlocal : sigma zLocal = zLocal ^ e) : -+ finitePlaceLocalToGlobalMonoidHom -+ (K := K) (L := L) v w sigma z = z ^ e := by -+ let vK := HeightOneSpectrum.adicAbv K v -+ let hvK : vK.IsNontrivial := RayClass.adicAbv_isNontrivial v -+ let E := LocalizedCompletion vK w -+ let : Algebra vK.Completion E := -+ finitePlaceLocalArtinLocalizedAlgebra v w -+ let eD : absoluteValueDecompositionGroup K w.1 ≃* Gal(E / vK.Completion) := -+ decompositionGroupEquivAlgebraicLocalizationAut vK hvK w -+ let eLoc : L →+* E := -+ AbsoluteValue.toAlgebraicLocalization vK w.1 w.2 -+ let delta : absoluteValueDecompositionGroup K w.1 := eD.symm sigma -+ have hDecomposition : eD delta = sigma := eD.apply_symm_apply sigma -+ apply eLoc.injective -+ calc -+ eLoc (finitePlaceLocalToGlobalMonoidHom -+ (K := K) (L := L) v w sigma z) = -+ eD delta (eLoc z) := -+ (localizationRamificationGroups_decompositionGroupEquiv_toLocalization -+ vK hvK w delta z).symm -+ _ = sigma (eLoc z) := -+ congrArg (fun tau : Gal(E / vK.Completion) => tau (eLoc z)) -+ hDecomposition -+ _ = sigma zLocal := -+ congrArg (fun y : E => sigma y) hLocalization -+ _ = zLocal ^ e := hlocal -+ _ = (eLoc z) ^ e := -+ congrArg (fun y : E => y ^ e) hLocalization.symm -+ _ = eLoc (z ^ e) := (map_pow eLoc z e).symm -+ -+theorem map_primitiveRoot_eq_pow_of_eq_pow -+ {M : Type} [CommRing M] [IsDomain M] -+ (f : M →* M) (zeta rho : M) (order exponent : ℕ) -+ [NeZero order] -+ (hzeta : IsPrimitiveRoot zeta order) -+ (hrho : IsPrimitiveRoot rho order) -+ (hf : f zeta = zeta ^ exponent) : -+ f rho = rho ^ exponent := by -+ obtain ⟨j, -, hj⟩ := -+ hzeta.eq_pow_of_pow_eq_one hrho.pow_eq_one -+ calc -+ f rho = f (zeta ^ j) := congrArg f hj.symm -+ _ = (f zeta) ^ j := map_pow f zeta j -+ _ = (zeta ^ exponent) ^ j := congrArg (fun z => z ^ j) hf -+ _ = zeta ^ (exponent * j) := (pow_mul zeta exponent j).symm -+ _ = zeta ^ (j * exponent) := -+ congrArg (fun e : ℕ => zeta ^ e) (Nat.mul_comm exponent j) -+ _ = (zeta ^ j) ^ exponent := pow_mul zeta j exponent -+ _ = rho ^ exponent := congrArg (fun z => z ^ exponent) hj -+ -+theorem finitePlaceLocalArtinMonoidHom_apply_semilinear -+ {K L K' L' : Type} -+ [Field K] [NumberField K] -+ [Field L] [Algebra K L] -+ [hKLfinite : FiniteDimensional K L] [IsAbelianGalois K L] -+ [Field K'] [ValuativeRel K'] [TopologicalSpace K'] -+ [IsNonarchimedeanLocalField K'] -+ [Field L'] [Algebra K' L'] -+ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] -+ (v : HeightOneSpectrum (𝓞 K)) -+ (w : AbsoluteValueExtension -+ (HeightOneSpectrum.adicAbv K v) L) -+ (eK : (HeightOneSpectrum.adicAbv K v).Completion ≃+* K') -+ (eL : LocalizedCompletion -+ (HeightOneSpectrum.adicAbv K v) w ≃+* L') -+ (hcomm : ∀ y : (HeightOneSpectrum.adicAbv K v).Completion, -+ eL (@algebraMap -+ (HeightOneSpectrum.adicAbv K v).Completion -+ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) -+ _ _ (finitePlaceLocalArtinLocalizedAlgebra v w) y) = -+ algebraMap K' L' (eK y)) -+ (hExt : SemilinearValuationCompatible -+ (HeightOneSpectrum.adicAbv K v).Completion K' eK) -+ (x : (v.adicCompletion K)ˣ) -+ (z : LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) : -+ eL (finitePlaceLocalArtinMonoidHom -+ (K := K) (L := L) v w x z) = -+ LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' -+ (Units.map eK.toMonoidHom -+ (finitePlaceLocalArtinInput v x)) (eL z) := by -+ calc -+ eL (finitePlaceLocalArtinMonoidHom -+ (K := K) (L := L) v w x z) = -+ eL ((@LocalClassFieldTheory.abelianLocalArtinMonoidHom -+ (HeightOneSpectrum.adicAbv K v).Completion -+ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) -+ (inferInstance : Field -+ (HeightOneSpectrum.adicAbv K v).Completion) -+ (inferInstance : Field -+ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) -+ (finitePlaceLocalArtinLocalizedAlgebra v w) -+ (finitePlaceLocalArtinCompletionValuativeRel v) -+ (inferInstance : TopologicalSpace -+ (HeightOneSpectrum.adicAbv K v).Completion) -+ (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) -+ (finitePlaceLocalArtinFiniteDimensional v w) -+ (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) -+ (finitePlaceLocalArtinInput v x)) z) := -+ congrArg eL -+ (finitePlaceLocalArtinMonoidHom_apply_normalized_at -+ (K := K) (L := L) v w x z) -+ _ = LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' -+ (Units.map eK.toMonoidHom -+ (finitePlaceLocalArtinInput v x)) (eL z) := -+ @abelianLocalArtinMonoidHom_semilinear_action -+ (HeightOneSpectrum.adicAbv K v).Completion K' -+ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) L' -+ (inferInstance : Field -+ (HeightOneSpectrum.adicAbv K v).Completion) -+ (finitePlaceLocalArtinCompletionValuativeRel v) -+ (inferInstance : TopologicalSpace -+ (HeightOneSpectrum.adicAbv K v).Completion) -+ (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) -+ (inferInstance : Field K') -+ (inferInstance : ValuativeRel K') -+ (inferInstance : TopologicalSpace K') -+ (inferInstance : IsNonarchimedeanLocalField K') -+ (inferInstance : Field -+ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) -+ (inferInstance : Field L') -+ (finitePlaceLocalArtinLocalizedAlgebra v w) -+ (inferInstance : Algebra K' L') -+ (finitePlaceLocalArtinFiniteDimensional v w) -+ (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) -+ (inferInstance : FiniteDimensional K' L') -+ (inferInstance : IsAbelianGalois K' L') -+ eK eL hcomm hExt (finitePlaceLocalArtinInput v x) z -+ -+ -+end RationalCyclotomicPrincipalPrime -+ -+end Reciprocity -+end GlobalClassFieldTheory -diff --git a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FiniteResidueFinrankTransfer.lean b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FiniteResidueFinrankTransfer.lean -index 1ff2c21..3705c23 100644 ---- a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FiniteResidueFinrankTransfer.lean -+++ b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FiniteResidueFinrankTransfer.lean -@@ -9,6 +9,7 @@ import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.FiniteResi - import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.ResidueExtension - import ValuedFieldTheory.Valuation.UniqueRing - -+ - set_option autoImplicit false - - namespace LocalClassFieldTheory -@@ -16,15 +17,6 @@ open CyclicCohomology RamificationTheory ClassFormation - - open LocalFieldTheory ValuationTheory - --/-! --# Finite local reciprocity: comparison of the two finite residue-field models -- --The residue-action exact sequence presents the residue field of a --finite fixed field intrinsically, inside the selected residue algebraic --closure. The norm formula uses the literal residue field of the spectral --valuation on that fixed field. This file compares those presentations by --the uniqueness of the finite extension valuation. ---/ - - noncomputable section - -@@ -53,9 +45,27 @@ noncomputable def valuationSubringEquivDecompositionFieldOfEqTop - let eFZ : F ≃ₐ[F] Z := - (IntermediateField.botEquiv F Omega).symm.trans - (IntermediateField.equivOfEq hZ.symm) -- refine -- { toFun := fun x => ⟨eFZ (x : F), ?_⟩ -- invFun := fun z => ⟨eFZ.symm (z : Z), ?_⟩ -+ exact -+ { toFun := fun x => ⟨eFZ (x : F), by -+ change ((eFZ x : Z) : Omega) ∈ A -+ have he : ((eFZ x : Z) : Omega) = -+ algebraMap F Omega (x : F) := by -+ rfl -+ rw [he] -+ have hx : (x : F) ∈ A.comap (algebraMap F Omega) := by -+ rw [hC] -+ exact x.property -+ exact hx⟩ -+ invFun := fun z => ⟨eFZ.symm (z : Z), by -+ have hz : eFZ.symm (z : Z) ∈ A.comap (algebraMap F Omega) := by -+ change algebraMap F Omega (eFZ.symm (z : Z)) ∈ A -+ have he : algebraMap F Omega (eFZ.symm (z : Z)) = -+ ((z : Z) : Omega) := by -+ exact congrArg Subtype.val (eFZ.apply_symm_apply (z : Z)) -+ rw [he] -+ exact z.property -+ rw [hC] at hz -+ exact hz⟩ - left_inv := fun x => by - apply Subtype.ext - exact eFZ.symm_apply_apply (x : F) -@@ -68,24 +78,6 @@ noncomputable def valuationSubringEquivDecompositionFieldOfEqTop - map_mul' := fun x y => by - apply Subtype.ext - exact map_mul eFZ (x : F) (y : F) } -- · change ((eFZ x : Z) : Omega) ∈ A -- have he : ((eFZ x : Z) : Omega) = -- algebraMap F Omega (x : F) := by -- rfl -- rw [he] -- have hx : (x : F) ∈ A.comap (algebraMap F Omega) := by -- rw [hC] -- exact x.property -- exact hx -- · have hz : eFZ.symm (z : Z) ∈ A.comap (algebraMap F Omega) := by -- change algebraMap F Omega (eFZ.symm (z : Z)) ∈ A -- have he : algebraMap F Omega (eFZ.symm (z : Z)) = -- ((z : Z) : Omega) := by -- exact congrArg Subtype.val (eFZ.apply_symm_apply (z : Z)) -- rw [he] -- exact z.property -- rw [hC] at hz -- exact hz - - /-- The corresponding equivalence between literal and intrinsic residue - fields. -/ -diff --git a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FixedFieldNormResidueNaturality.lean b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FixedFieldNormResidueNaturality.lean -index 08eb9ea..dd20dc0 100644 ---- a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FixedFieldNormResidueNaturality.lean -+++ b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FixedFieldNormResidueNaturality.lean -@@ -10,15 +10,9 @@ import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.LocalHense - import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Main - import Mathlib.FieldTheory.Galois.Notation - --set_option autoImplicit false - --/-! --# Naturality of fixed-field norm-residue symbols -+set_option autoImplicit false - --This file transports norm-restriction and transfer-inclusion naturality --from the closed-subgroup class formation to actual fixed fields in a single --Galois ambient field. ---/ - - noncomputable section - -@@ -521,7 +515,12 @@ theorem upperAbsoluteFinite - /-- The fixed-field norm-residue symbol for the lower horizontal extension, - induced by the canonical local class formation. -/ - noncomputable def lowerNormResidueSymbol -- (T : LocalFixedFieldNormRestrictionSquare k) := by -+ (T : LocalFixedFieldNormRestrictionSquare k) : -+ Additive (abstractFixedField k (SeparableClosure k) T.lowerBase)ˣ →+ -+ Additive (Abelianization -+ Gal(abstractRelativeFixedField k (SeparableClosure k) -+ T.lowerTop_le_lowerBase / -+ abstractFixedField k (SeparableClosure k) T.lowerBase)) := by - letI := T.lowerNormal - letI := T.lowerFinite - letI := T.lowerAbsoluteFinite -@@ -534,7 +533,12 @@ noncomputable def lowerNormResidueSymbol - /-- The fixed-field norm-residue symbol for the upper horizontal extension, - induced by the canonical local class formation. -/ - noncomputable def upperNormResidueSymbol -- (T : LocalFixedFieldNormRestrictionSquare k) := by -+ (T : LocalFixedFieldNormRestrictionSquare k) : -+ Additive (abstractFixedField k (SeparableClosure k) T.upperBase)ˣ →+ -+ Additive (Abelianization -+ Gal(abstractRelativeFixedField k (SeparableClosure k) -+ T.upperTop_le_upperBase / -+ abstractFixedField k (SeparableClosure k) T.upperBase)) := by - letI := T.upperNormal - letI := T.upperFinite - letI := upperAbsoluteFinite T -@@ -552,7 +556,15 @@ noncomputable def normUnits - - /-- Restriction between the abelianized actual relative Galois groups. -/ - noncomputable def abelianizedRestriction -- (T : LocalFixedFieldNormRestrictionSquare k) := by -+ (T : LocalFixedFieldNormRestrictionSquare k) : -+ Additive (Abelianization -+ Gal(abstractRelativeFixedField k (SeparableClosure k) -+ T.upperTop_le_upperBase / -+ abstractFixedField k (SeparableClosure k) T.upperBase)) →+ -+ Additive (Abelianization -+ Gal(abstractRelativeFixedField k (SeparableClosure k) -+ T.lowerTop_le_lowerBase / -+ abstractFixedField k (SeparableClosure k) T.lowerBase)) := by - letI := T.lowerNormal - letI := T.upperNormal - exact -@@ -681,7 +693,12 @@ theorem intermediateAbsoluteFinite - /-- The fixed-field norm-residue symbol for the total extension, induced by - the canonical local class formation. -/ - noncomputable def baseNormResidueSymbol -- (T : LocalFixedFieldTransferTower k) := by -+ (T : LocalFixedFieldTransferTower k) : -+ Additive (abstractFixedField k (SeparableClosure k) T.base)ˣ →+ -+ Additive (Abelianization -+ Gal(abstractRelativeFixedField k (SeparableClosure k) -+ (T.top_le_intermediate.trans T.intermediate_le_base) / -+ abstractFixedField k (SeparableClosure k) T.base)) := by - letI := T.totalNormal - letI := T.totalFinite - letI := T.baseAbsoluteFinite -@@ -695,7 +712,12 @@ noncomputable def baseNormResidueSymbol - /-- The fixed-field norm-residue symbol after changing the base to the - intermediate fixed field, induced by the canonical local class formation. -/ - noncomputable def intermediateNormResidueSymbol -- (T : LocalFixedFieldTransferTower k) := by -+ (T : LocalFixedFieldTransferTower k) : -+ Additive (abstractFixedField k (SeparableClosure k) T.intermediate)ˣ →+ -+ Additive (Abelianization -+ Gal(abstractRelativeFixedField k (SeparableClosure k) -+ T.top_le_intermediate / -+ abstractFixedField k (SeparableClosure k) T.intermediate)) := by - letI := intermediateNormal T - letI := intermediateFinite T - letI := intermediateAbsoluteFinite T -@@ -713,7 +735,15 @@ noncomputable def unitsInclusion - - /-- Transfer between the abelianized actual relative Galois groups. -/ - noncomputable def abelianizedTransfer -- (T : LocalFixedFieldTransferTower k) := by -+ (T : LocalFixedFieldTransferTower k) : -+ Additive (Abelianization -+ Gal(abstractRelativeFixedField k (SeparableClosure k) -+ (T.top_le_intermediate.trans T.intermediate_le_base) / -+ abstractFixedField k (SeparableClosure k) T.base)) →+ -+ Additive (Abelianization -+ Gal(abstractRelativeFixedField k (SeparableClosure k) -+ T.top_le_intermediate / -+ abstractFixedField k (SeparableClosure k) T.intermediate)) := by - letI := T.totalNormal - letI := T.totalFinite - exact -diff --git a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/LocalResidueDatum.lean b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/LocalResidueDatum.lean -index bc7a1de..9da0120 100644 ---- a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/LocalResidueDatum.lean -+++ b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/LocalResidueDatum.lean -@@ -9,6 +9,7 @@ import ValuedFieldTheory.Valuation.DiscreteValuationField.FiniteIntegralClosure - import ValuedFieldTheory.Ramification.GaloisValuation.AbsoluteGalois.FiniteExtensionCorrespondence - import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.FiniteExtensionCompleteDVF - -+ - set_option autoImplicit false - - namespace LocalClassFieldTheory -@@ -17,24 +18,6 @@ open ClassFormation - - open ValuationTheory RamificationTheory LocalFieldTheory - --/-! --# Finite local reciprocity: the local residue degree datum -- --For a nonarchimedean local field `K`, this file makes the choices implicit in --the construction explicit. The canonical local valuation is packaged as a complete --DVF, Chevalley's theorem chooses an extension to `AlgebraicClosure K`, and --that valuation is pulled back to `SeparableClosure K`. Finite-separable --uniqueness shows that its decomposition subgroup is the whole Galois group. --The residue field of the decomposition field is then identified with the --finite residue field of `K`. -- --The remaining step is topological: the reduction action is shown continuous --for the two Krull topologies and is composed with the intrinsic finite-field --degree map from `ResidueAlgebraicClosureDegree`. The selected residue field --is algebraically closed because its extension to the residue of --`AlgebraicClosure K` is purely inseparable and the selected residue field is --perfect over the finite base residue field. ---/ - - noncomputable section - -@@ -187,9 +170,23 @@ private noncomputable def localBaseValuationSubringEquivDecompositionField : - let eKZ : K ≃ₐ[K] Z := - (IntermediateField.botEquiv K (SeparableClosure K)).symm.trans - (IntermediateField.equivOfEq hZ.symm) -- refine -- { toFun := fun x => ⟨eKZ (x : K), ?_⟩ -- invFun := fun z => ⟨eKZ.symm (z : Z), ?_⟩ -+ exact -+ { toFun := fun x => ⟨eKZ (x : K), by -+ change ((eKZ x : Z) : SeparableClosure K) ∈ A -+ have he : ((eKZ x : Z) : SeparableClosure K) = -+ algebraMap K (SeparableClosure K) (x : K) := by -+ rfl -+ rw [he] -+ exact (localSeparableValuationSubring_pullback K (x : K)).2 x.property⟩ -+ invFun := fun z => ⟨eKZ.symm (z : Z), by -+ change eKZ.symm (z : Z) ∈ -+ (localCompleteDVF K).valuation.valuationSubring -+ apply (localSeparableValuationSubring_pullback K (eKZ.symm (z : Z))).1 -+ have he : algebraMap K (SeparableClosure K) (eKZ.symm (z : Z)) = -+ ((z : Z) : SeparableClosure K) := by -+ exact congrArg Subtype.val (eKZ.apply_symm_apply (z : Z)) -+ rw [he] -+ exact z.property⟩ - left_inv := fun x => by - apply Subtype.ext - exact eKZ.symm_apply_apply (x : K) -@@ -202,20 +199,6 @@ private noncomputable def localBaseValuationSubringEquivDecompositionField : - map_mul' := fun x y => by - apply Subtype.ext - exact map_mul eKZ (x : K) (y : K) } -- · change ((eKZ x : Z) : SeparableClosure K) ∈ A -- have he : ((eKZ x : Z) : SeparableClosure K) = -- algebraMap K (SeparableClosure K) (x : K) := by -- rfl -- rw [he] -- exact (localSeparableValuationSubring_pullback K (x : K)).2 x.property -- · change eKZ.symm (z : Z) ∈ -- (localCompleteDVF K).valuation.valuationSubring -- apply (localSeparableValuationSubring_pullback K (eKZ.symm (z : Z))).1 -- have he : algebraMap K (SeparableClosure K) (eKZ.symm (z : Z)) = -- ((z : Z) : SeparableClosure K) := by -- exact congrArg Subtype.val (eKZ.apply_symm_apply (z : Z)) -- rw [he] -- exact z.property - - /-- The residue field in the residue-action exact sequence is canonically the finite residue - field of the original local field. -/ -diff --git a/Lean4/ClassFieldTheory/LubinTate/Padic/CompletedChangedUniformizerFixedField.lean b/Lean4/ClassFieldTheory/LubinTate/Padic/CompletedChangedUniformizerFixedField.lean -index c747c98..aa28793 100644 ---- a/Lean4/ClassFieldTheory/LubinTate/Padic/CompletedChangedUniformizerFixedField.lean -+++ b/Lean4/ClassFieldTheory/LubinTate/Padic/CompletedChangedUniformizerFixedField.lean -@@ -9,6 +9,7 @@ import ClassFieldTheory.LubinTate.Padic.CompletedChangedUniformizerPrimitive - import ClassFieldTheory.LubinTate.Padic.CompletedChangedUniformizerThetaFixed - import ClassFieldTheory.LubinTate.Padic.CompletedUnramifiedFrobeniusFixed - -+ - set_option autoImplicit false - - /-! -@@ -42,7 +43,8 @@ noncomputable def padicCompletedChangedUniformizerFrobeniusAlgEquiv - (u : (padicLocalField p).valuationSubringˣ) (n : ℕ) : - padicCompletedLevelField p n ≃ₐ[ℚ_[p]] - padicCompletedLevelField p n := -- AlgEquiv.ofRingEquiv (by -+ AlgEquiv.ofRingEquiv -+ (f := padicCompletedUnitFrobeniusLiftEquiv p n u⁻¹) (by - intro b - change - padicCompletedUnitFrobeniusLiftEquiv p n u⁻¹ -diff --git a/Lean4/GaloisCohomology/Cyclic/Herbrand/HerbrandLowDegree/Basic.lean b/Lean4/GaloisCohomology/Cyclic/Herbrand/HerbrandLowDegree/Basic.lean -index ea6356d..eb19ced 100644 ---- a/Lean4/GaloisCohomology/Cyclic/Herbrand/HerbrandLowDegree/Basic.lean -+++ b/Lean4/GaloisCohomology/Cyclic/Herbrand/HerbrandLowDegree/Basic.lean -@@ -14,6 +14,7 @@ import Mathlib.GroupTheory.OrderOfElement - import Mathlib.GroupTheory.QuotientGroup.Basic - import Mathlib.GroupTheory.SpecificGroups.Cyclic - -+ - set_option autoImplicit false - - namespace CyclicCohomology -@@ -34,8 +35,7 @@ namespace Herbrand - - universe uG uA uB uC - --/-- Herbrand-quotient theory: the finite-group norm `N_G a = ∏ g, g • a` --for a multiplicative `G`-module. -/ -+ - def tateNorm (G : Type uG) (A : Type uA) [Group G] [Fintype G] [CommGroup A] - [MulDistribMulAction G A] (a : A) : A := - ∏ g : G, g • a -@@ -92,9 +92,8 @@ theorem fixed_of_forall_mem_zpowers_of_sigmaMinusOne_eq_one - omit [Group G] [Fintype G] [CommGroup A] [CommGroup B] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- First-isomorphism cardinality source for finite exactness calculations: --the cardinality of the source of a group homomorphism is the product of the --cardinalities of its kernel and range. -/ -+ -+ - theorem monoidHom_card_eq_card_ker_mul_card_range - {X : Type uA} {Y : Type uB} [Group X] [Group Y] [Finite X] (f : X →* Y) : - Nat.card X = Nat.card (MonoidHom.ker f) * Nat.card (MonoidHom.range f) := by -@@ -128,9 +127,8 @@ theorem card_subgroupOf_eq_card - omit [Fintype G] [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- The multiplicative induced module from the trivial subgroup, represented --as functions on `G` with the right-regular action. This is the concrete model --used in the low-degree Herbrand comparison. -/ -+ -+ - @[reducible] def rightRegularFunctionMulDistribMulAction : - MulDistribMulAction G (G → B) where - smul g f := fun x => f (x * g) -@@ -255,7 +253,7 @@ def tateNormSubgroup (G : Type uG) (A : Type uA) [Group G] [Fintype G] [CommGrou - [MulDistribMulAction G A] : Subgroup A := - MonoidHom.range (tateNormHom (G := G) (A := A)) - --/-- Herbrand-quotient theory: the norm kernel `{a | N_G a = 1}`. -/ -+ - def normKernelSubgroup (G : Type uG) (A : Type uA) [Group G] [Fintype G] [CommGroup A] - [MulDistribMulAction G A] : Subgroup A := - MonoidHom.ker (tateNormHom (G := G) (A := A)) -@@ -267,7 +265,7 @@ def augmentationSubgroup (G : Type uG) (A : Type uA) [Group G] [CommGroup A] - - omit [Fintype G] [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- If `σ` generates `G`, the kernel of `a ↦ a^(σ-1)` is the fixed subgroup. -/ -+ - theorem sigmaMinusOneHom_ker_eq_fixedSubgroup - (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) : - MonoidHom.ker (sigmaMinusOneHom (G := G) (A := A) σ) = fixedSubgroup G A := by -@@ -282,8 +280,8 @@ theorem sigmaMinusOneHom_ker_eq_fixedSubgroup - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- Finite-module source: the norm homomorphism factors the cardinality of --`A` into norm-kernel and norm-image cardinalities. -/ -+ -+ - theorem card_eq_card_normKernelSubgroup_mul_card_tateNormSubgroup [Finite A] : - Nat.card A = Nat.card (normKernelSubgroup G A) * Nat.card (tateNormSubgroup G A) := by - simpa [normKernelSubgroup, tateNormSubgroup] using -@@ -291,9 +289,8 @@ theorem card_eq_card_normKernelSubgroup_mul_card_tateNormSubgroup [Finite A] : - - omit [Fintype G] [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- Finite-module source: for a cyclic generator `σ`, the coboundary --homomorphism factors the cardinality of `A` into fixed and augmentation --cardinalities. -/ -+ -+ - theorem card_eq_card_fixedSubgroup_mul_card_augmentationSubgroup - (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) [Finite A] : - Nat.card A = Nat.card (fixedSubgroup G A) * Nat.card (augmentationSubgroup G A σ) := by -@@ -304,8 +301,8 @@ theorem card_eq_card_fixedSubgroup_mul_card_augmentationSubgroup - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- Finite-module cardinality balance behind `h(G,A)=1`: for a finite cyclic --group action, the product `#A^G · #I_G A` equals `#ker N_G · #N_G A`. -/ -+ -+ - theorem herbrand_finite_module_cardinality_balance - (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) [Finite A] : - Nat.card (fixedSubgroup G A) * Nat.card (augmentationSubgroup G A σ) = -@@ -380,7 +377,7 @@ def HerbrandH0.mk : fixedSubgroup G A →* HerbrandH0 G A := by - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- Canonical projection from the norm kernel to `H⁻¹(G,A)`. -/ -+ - def HerbrandHMinusOne.mk (σ : G) : - normKernelSubgroup G A →* HerbrandHMinusOne G A σ := by - unfold HerbrandHMinusOne -@@ -422,7 +419,7 @@ theorem HerbrandH0.mk_surjective : - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- Every degree-minus-one Herbrand class has a norm-kernel representative. -/ -+ - theorem HerbrandHMinusOne.mk_surjective (σ : G) : - Function.Surjective (HerbrandHMinusOne.mk (G := G) (A := A) σ) := by - intro q -@@ -458,8 +455,8 @@ theorem HerbrandH0.mk_eq_one_iff (a : fixedSubgroup G A) : - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- A norm-kernel representative gives the trivial degree-minus-one class --exactly when it is an augmentation. -/ -+ -+ - @[simp] - theorem HerbrandHMinusOne.mk_eq_one_iff (σ : G) - (a : normKernelSubgroup G A) : -@@ -573,8 +570,8 @@ protected theorem HerbrandH0.inductionOn - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- Eliminate a degree-minus-one Herbrand class through an arbitrary --norm-kernel representative and the canonical class map. -/ -+ -+ - protected theorem HerbrandHMinusOne.inductionOn (σ : G) - {motive : HerbrandHMinusOne G A σ → Prop} - (q : HerbrandHMinusOne G A σ) -@@ -649,7 +646,7 @@ def HerbrandH0.lift {M : Type*} [Group M] - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- Descend a homomorphism on the norm kernel through `H⁻¹(G,A)`. -/ -+ - def HerbrandHMinusOne.lift {M : Type*} [Group M] (σ : G) - (f : normKernelSubgroup G A →* M) - (h : (augmentationSubgroup G A σ).subgroupOf (normKernelSubgroup G A) ≤ -@@ -703,7 +700,7 @@ noncomputable instance herbrandHMinusOneFiniteOfFinite (σ : G) [Finite A] : - omit [Fintype G] [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- Fixed subgroup of the right-regular multiplicative induced module. -/ -+ - abbrev rightRegularFunctionFixedSubgroup : Subgroup (G → B) := by - letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) - exact fixedSubgroup G (G → B) -@@ -711,7 +708,7 @@ abbrev rightRegularFunctionFixedSubgroup : Subgroup (G → B) := by - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- Norm image subgroup of the right-regular multiplicative induced module. -/ -+ - abbrev rightRegularFunctionTateNormSubgroup : Subgroup (G → B) := by - letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) - exact tateNormSubgroup G (G → B) -@@ -719,8 +716,8 @@ abbrev rightRegularFunctionTateNormSubgroup : Subgroup (G → B) := by - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- `H⁰` of the right-regular multiplicative induced module. -/ --def rightRegularFunctionHerbrandH0 := by -+ -+def rightRegularFunctionHerbrandH0 : Type (max uG uB) := by - letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) - exact HerbrandH0 G (G → B) - -@@ -737,7 +734,7 @@ noncomputable instance rightRegularFunctionHerbrandH0CommGroup : - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- Norm-kernel subgroup of the right-regular multiplicative induced module. -/ -+ - abbrev rightRegularFunctionNormKernelSubgroup : Subgroup (G → B) := by - letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) - exact normKernelSubgroup G (G → B) -@@ -745,7 +742,7 @@ abbrev rightRegularFunctionNormKernelSubgroup : Subgroup (G → B) := by - omit [Fintype G] [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- Augmentation subgroup of the right-regular multiplicative induced module. -/ -+ - abbrev rightRegularFunctionAugmentationSubgroup (σ : G) : Subgroup (G → B) := by - letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) - exact augmentationSubgroup G (G → B) σ -@@ -753,8 +750,8 @@ abbrev rightRegularFunctionAugmentationSubgroup (σ : G) : Subgroup (G → B) := - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- `H^{-1}` of the right-regular multiplicative induced module. -/ --def rightRegularFunctionHerbrandHMinusOne (σ : G) := by -+ -+def rightRegularFunctionHerbrandHMinusOne (σ : G) : Type (max uG uB) := by - letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) - exact HerbrandHMinusOne G (G → B) σ - -@@ -791,7 +788,7 @@ theorem tateNorm_sigmaMinusOne_eq_one (σ : G) (a : A) : - _ = 1 := by - rw [hshift, Finset.prod_inv_distrib, mul_inv_cancel] - --/-- The augmentation image lies in the norm kernel. -/ -+ - theorem augmentationSubgroup_le_normKernelSubgroup (σ : G) : - augmentationSubgroup G A σ ≤ normKernelSubgroup G A := by - intro a ha -@@ -858,9 +855,8 @@ theorem herbrandH0_subsingleton_iff_fixed_le_tateNormSubgroup : - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- A quotient-level criterion for vanishing of `H^{-1}`: if every norm-kernel --element is an augmentation element, then the low-degree Herbrand `H^{-1}` --quotient is a subsingleton. -/ -+ -+ - theorem herbrandHMinusOne_subsingleton_of_normKernel_le_augmentationSubgroup - (σ : G) (h : normKernelSubgroup G A ≤ augmentationSubgroup G A σ) : - Subsingleton (HerbrandHMinusOne G A σ) := by -@@ -879,8 +875,7 @@ theorem herbrandHMinusOne_subsingleton_of_normKernel_le_augmentationSubgroup - exact h a.2 - rw [hq, hr] - --/-- Degree-minus-one Herbrand cohomology is trivial exactly when every --norm-kernel element is an augmentation element. -/ -+ - theorem herbrandHMinusOne_subsingleton_iff_normKernel_le_augmentationSubgroup - (σ : G) : - Subsingleton (HerbrandHMinusOne G A σ) ↔ -@@ -986,8 +981,8 @@ theorem herbrandHMinusOne_subsingleton_of_mulEquiv - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- Membership in the right-regular norm kernel is the single product --condition `∏ g, f g = 1`. -/ -+ -+ - theorem rightRegularFunction_mem_normKernelSubgroup_iff (f : G → B) : - f ∈ rightRegularFunctionNormKernelSubgroup (G := G) (B := B) ↔ - (∏ g : G, f g) = 1 := by -@@ -1031,9 +1026,8 @@ theorem rightRegularFunction_mem_normKernelSubgroup_iff (f : G → B) : - omit [Fintype G] [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- The partial primitive along the cyclic powers of `σ`. This is the --candidate used to solve `b (x * σ) * (b x)⁻¹ = f x` on the right-regular --induced module. -/ -+ -+ - def rightRegularCyclicPartialProduct (σ : G) (f : G → B) (i : ℕ) : B := - (Finset.range i).prod (fun k => f (σ ^ k)) - -@@ -1266,8 +1260,8 @@ theorem rightRegularCyclicPrimitive_mul_sigma_mul_inv_of_partialProduct_eq_one - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- A right-regular norm-kernel element has product `1` along one full cyclic --enumeration by a generator. -/ -+ -+ - theorem rightRegularFunction_prod_powers_eq_one_of_mem_normKernel - (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) - {f : G → B} -@@ -1325,8 +1319,8 @@ theorem rightRegularFunction_mem_augmentationSubgroup_iff - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- Concrete `H^{-1}` source for the right-regular multiplicative induced --module: every norm-kernel element is an augmentation element. -/ -+ -+ - theorem rightRegularFunction_normKernel_le_augmentationSubgroup - (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) : - rightRegularFunctionNormKernelSubgroup (G := G) (B := B) ≤ -@@ -1348,8 +1342,8 @@ theorem rightRegularFunction_normKernel_le_augmentationSubgroup - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- The `H^{-1}` quotient of the right-regular multiplicative induced module --is trivial for a cyclic group generated by `σ`. -/ -+ -+ - theorem rightRegularFunction_herbrandHMinusOne_subsingleton - (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) : - Subsingleton (rightRegularFunctionHerbrandHMinusOne (G := G) (B := B) σ) := by -@@ -1362,8 +1356,8 @@ theorem rightRegularFunction_herbrandHMinusOne_subsingleton - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- Concrete `H⁰` source for induced modules: for the right-regular --multiplicative induced module `G → B`, every fixed point is a norm. -/ -+ -+ - theorem rightRegularFunction_fixed_le_tateNormSubgroup : - rightRegularFunctionFixedSubgroup (G := G) (B := B) ≤ - rightRegularFunctionTateNormSubgroup (G := G) (B := B) := by -@@ -1420,8 +1414,8 @@ theorem rightRegularFunction_fixed_le_tateNormSubgroup : - omit [CommGroup A] [CommGroup C] - [MulDistribMulAction G A] [MulDistribMulAction G B] - [MulDistribMulAction G C] in --/-- The `H⁰` quotient of the right-regular multiplicative induced module is --trivial. This is the degree-zero half of the low-degree Herbrand comparison. -/ -+ -+ - theorem rightRegularFunction_herbrandH0_subsingleton : - Subsingleton (rightRegularFunctionHerbrandH0 (G := G) (B := B)) := by - let := rightRegularFunctionMulDistribMulAction (G := G) (B := B) -@@ -1677,8 +1671,8 @@ theorem card_normKernelSubgroup_eq_card_herbrandHMinusOne_mul_card_augmentationS - - omit [CommGroup B] [CommGroup C] - [MulDistribMulAction G B] [MulDistribMulAction G C] in --/-- The two low-degree Herbrand quotients of a finite cyclic module have equal --cardinality, the finite-module source for Herbrand-quotient multiplicativity. -/ -+ -+ - theorem herbrand_finite_module_card_eq - (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) [Finite A] : - Nat.card (HerbrandH0 G A) = Nat.card (HerbrandHMinusOne G A σ) := by -diff --git a/Lean4/ValuedFieldTheory/LocalField/Padic/UnitDecomposition.lean b/Lean4/ValuedFieldTheory/LocalField/Padic/UnitDecomposition.lean -index c3ea784..4f582bb 100644 ---- a/Lean4/ValuedFieldTheory/LocalField/Padic/UnitDecomposition.lean -+++ b/Lean4/ValuedFieldTheory/LocalField/Padic/UnitDecomposition.lean -@@ -12,14 +12,9 @@ import Mathlib.NumberTheory.Padics.ValuativeRel - import Mathlib.NumberTheory.Padics.ProperSpace - import Mathlib.GroupTheory.Torsion - --set_option autoImplicit false - --/-! --# Unit decomposition of the p-adic integers -+set_option autoImplicit false - --This file constructs the reusable topological decomposition of --`ℤ_[p]ˣ` into its finite factor and its principal `p`-adic factor. ---/ - - open scoped Topology - -@@ -457,7 +452,7 @@ noncomputable def padicPrincipalData - rfl - have htop : directTopology = standardTopology := - hdirect.trans (padicPrincipalUnitDirectTopology_eq_standard p) -- let P := fun T : TopologicalSpace U => by -+ let P : TopologicalSpace U → Type := fun T => by - letI : TopologicalSpace U := T - exact Σ a : ℕ, - Multiplicative -diff --git a/lakefile.toml b/lakefile.toml -index ed5e179..5e8b720 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -10,8 +10,8 @@ relaxedAutoImplicit = false - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "5ed2965256430c3649e86755f9576b54eca72435" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "ClassFieldTheory.All" -diff --git a/lean-toolchain b/lean-toolchain -index 12359f9..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.34.0 -+leanprover/lean4:v4.34.1 +diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusGeometry.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusGeometry.lean +index ba13223..d57b89f 100644 +--- a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusGeometry.lean ++++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusGeometry.lean +@@ -4,19 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainNaturality +-import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.DoubleCosetOrbitGeometry + +-set_option autoImplicit false ++import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainTransferNormOrbitMk + +-/-! +-# Transfer--norm Frobenius geometry + +-For a finite Galois extension and an intermediate field, this module builds the +-Frobenius-side subgroup and orbit equivalences used in transfer--norm +-naturality. The reusable orbit and double-coset constructions are isolated in +-`DoubleCosetOrbitGeometry`. +--/ ++set_option autoImplicit false ++ + + universe u + +@@ -35,424 +28,9 @@ section transferFrobeniusGeometry + + variable {G : Type u} [Group G] [TopologicalSpace G] + +-/-- The absolute group of an intermediate field, identified with its +-literal copy inside the absolute group of the base field. -/ +-noncomputable def transferNormNaturalityIntermediateAbsoluteEquiv +- (K K' : ClosedSubgroup G) +- (hK'K : K'.toSubgroup ≤ K.toSubgroup) : +- K'.toSubgroup ≃* extensionSubgroup K K' hK'K := +- MulEquiv.ofBijective +- ((Subgroup.inclusion hK'K).codRestrict +- (extensionSubgroup K K' hK'K) (fun k' => k'.2)) +- ⟨fun _ _ h => Subtype.ext (congrArg (fun z => z.1.1) h), by +- rintro ⟨k, hk'⟩ +- let k' : K'.toSubgroup := ⟨k.1, hk'⟩ +- exact ⟨k', Subtype.ext rfl⟩⟩ +- +-/-- The absolute intermediate-field equivalence evaluates by the underlying transfer map. -/ +-@[simp] +-theorem transferNormNaturalityIntermediateAbsoluteEquiv_apply +- (K K' : ClosedSubgroup G) +- (hK'K : K'.toSubgroup ≤ K.toSubgroup) +- (k' : K'.toSubgroup) : +- ((transferNormNaturalityIntermediateAbsoluteEquiv K K' hK'K k').1 : G) = k'.1 := +- rfl +- +-/-- Normality of `L | K` restricts to every intermediate field `K'`. -/ +-theorem transferNormNaturality_intermediateExtension_normal +- (K K' L : ClosedSubgroup G) +- (hLK' : L.toSubgroup ≤ K'.toSubgroup) +- (hK'K : K'.toSubgroup ≤ K.toSubgroup) +- [hLnormal : (extensionSubgroup K L (hLK'.trans hK'K)).Normal] : +- (extensionSubgroup K' L hLK').Normal := by +- have hcomap : extensionSubgroup K' L hLK' = +- (extensionSubgroup K L (hLK'.trans hK'K)).comap +- (Subgroup.inclusion hK'K) := by +- ext k' +- rw [Subgroup.mem_comap, mem_extensionSubgroup_iff, +- mem_extensionSubgroup_iff] +- rfl +- rw [hcomap] +- exact hLnormal.comap (Subgroup.inclusion hK'K) + + namespace DegreeData + +-/-- The restriction map on the infinite Frobenius quotients is injective +-when the top field is unchanged. -/ +-theorem transferNormNaturalityFrobeniusTowerMap_injective +- (D : DegreeData G) [IsTopologicalGroup G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : +- Function.Injective +- (D.finiteReciprocityNaturalityFrobeniusTowerMap +- E.base.field E.field.field L L +- (hL.trans E.below) hL E.below le_rfl) := by +- intro x y +- refine QuotientGroup.induction_on x ?_ +- intro k' +- refine QuotientGroup.induction_on y ?_ +- intro l' h +- apply QuotientGroup.eq.mpr +- have hmem : +- (Subgroup.inclusion E.below k')⁻¹ * Subgroup.inclusion E.below l' ∈ +- D.extensionInertiaWithin E.base.field L (hL.trans E.below) := +- QuotientGroup.eq.mp h +- constructor +- · apply (mem_extensionSubgroup_iff E.field.field L hL (k'⁻¹ * l')).2 +- have hG := (mem_extensionSubgroup_iff E.base.field L +- (hL.trans E.below) +- ((Subgroup.inclusion E.below k')⁻¹ * +- Subgroup.inclusion E.below l')).1 hmem.1 +- simpa using hG +- · have hI := hmem.2 +- change D.degree (((Subgroup.inclusion E.below k')⁻¹ * +- Subgroup.inclusion E.below l' : E.base.field.toSubgroup) : G) = 1 at hI +- change D.degree ((k'⁻¹ * l' : E.field.field.toSubgroup) : G) = 1 +- exact hI +- +-/-- The copy of `G(\widetilde L/K')` inside +-`G(\widetilde L/K)`. This is the subgroup `H` used in the classical +-double-coset proof of transfer--norm naturality. -/ +-def transferNormNaturalityFrobeniusIntermediateSubgroup +- (D : DegreeData G) [IsTopologicalGroup G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : +- Subgroup (E.base.field.toSubgroup ⧸ +- D.extensionInertiaWithin E.base.field L (hL.trans E.below)) := +- (D.finiteReciprocityNaturalityFrobeniusTowerMap +- E.base.field E.field.field L L +- (hL.trans E.below) hL E.below le_rfl).range +- +-/-- The subgroup above is also the image of `G_K'` under the quotient +-projection `G_K → G(\widetilde L/K)`. -/ +-theorem transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map +- (D : DegreeData G) [IsTopologicalGroup G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : +- D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL = +- (extensionSubgroup E.base.field E.field.field E.below).map +- (QuotientGroup.mk' +- (D.extensionInertiaWithin E.base.field L +- (hL.trans E.below))) := by +- ext q +- constructor +- · rintro ⟨x, rfl⟩ +- refine QuotientGroup.induction_on x ?_ +- intro k' +- refine ⟨Subgroup.inclusion E.below k', ?_, rfl⟩ +- exact k'.2 +- · rintro ⟨k, hk', rfl⟩ +- let k' : E.field.field.toSubgroup := ⟨k.1, hk'⟩ +- refine ⟨QuotientGroup.mk k', ?_⟩ +- change QuotientGroup.mk (Subgroup.inclusion E.below k') = +- QuotientGroup.mk k +- rfl +- +-/-- Quotient projection maps the literal absolute subgroup belonging to +-`K'` onto its copy `H` inside `G(\widetilde L/K)`. -/ +-noncomputable def transferNormNaturalityIntermediateToFrobeniusSubgroup +- (D : DegreeData G) [IsTopologicalGroup G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : +- extensionSubgroup E.base.field E.field.field E.below →* +- D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL := by +- refine ((QuotientGroup.mk' +- (D.extensionInertiaWithin E.base.field L (hL.trans E.below))).comp +- (extensionSubgroup E.base.field E.field.field E.below).subtype).codRestrict +- (D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL) ?_ +- intro m +- change QuotientGroup.mk m.1 ∈ +- D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL +- rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map +- E L hL] +- exact ⟨m.1, m.2, rfl⟩ +- +-/-- The map from the intermediate quotient onto the Frobenius subgroup is surjective. -/ +-theorem transferNormNaturalityIntermediateToFrobeniusSubgroup_surjective +- (D : DegreeData G) [IsTopologicalGroup G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : +- Function.Surjective +- (D.transferNormNaturalityIntermediateToFrobeniusSubgroup +- E L hL) := by +- intro h +- have hh : h.1 ∈ +- (extensionSubgroup E.base.field E.field.field E.below).map +- (QuotientGroup.mk' +- (D.extensionInertiaWithin E.base.field L (hL.trans E.below))) := by +- rw [← D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map +- E L hL] +- exact h.2 +- obtain ⟨m, hm, hval⟩ := hh +- refine ⟨⟨m, hm⟩, ?_⟩ +- apply Subtype.ext +- unfold transferNormNaturalityIntermediateToFrobeniusSubgroup +- simpa only [MonoidHom.codRestrict_apply, MonoidHom.comp_apply, +- Subgroup.subtype_apply] using hval +- +-/-- The intermediate-to-Frobenius map has the stated value on each representative. -/ +-@[simp] +-theorem transferNormNaturalityIntermediateToFrobeniusSubgroup_apply +- (D : DegreeData G) [IsTopologicalGroup G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] +- (m : extensionSubgroup E.base.field E.field.field E.below) : +- (D.transferNormNaturalityIntermediateToFrobeniusSubgroup +- E L hL m).1 = +- (QuotientGroup.mk m.1 : E.base.field.toSubgroup ⧸ +- D.extensionInertiaWithin E.base.field L (hL.trans E.below)) := by +- rfl +- +-/-- The canonical coset equivalence from `G_K/G_Σ` to +-`G(\widetilde L/K)/Γ` intertwines the two copies of the `K'`-action. -/ +-theorem frobeniusFixedCosetClosureEquiv_equivariant +- (D : DegreeData G) [IsTopologicalGroup G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] +- (σ : D.FrobeniusElements E.base L (hL.trans E.below)) +- (m : extensionSubgroup E.base.field E.field.field E.below) +- (x : E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field +- (D.frobeniusFixedField E.base L (hL.trans E.below) σ) +- (D.frobeniusFixedField_le E.base L (hL.trans E.below) σ)) : +- D.frobeniusFixedCosetClosureEquiv E.base L (hL.trans E.below) σ (m • x) = +- (D.transferNormNaturalityIntermediateToFrobeniusSubgroup +- E L hL m) • +- D.frobeniusFixedCosetClosureEquiv E.base L +- (hL.trans E.below) σ x := by +- refine Quotient.inductionOn' x ?_ +- intro k +- change QuotientGroup.mk (QuotientGroup.mk (m.1 * k)) = +- QuotientGroup.mk +- ((D.transferNormNaturalityIntermediateToFrobeniusSubgroup +- E L hL m).1 * QuotientGroup.mk k) +- rw [D.transferNormNaturalityIntermediateToFrobeniusSubgroup_apply] +- rfl +- +-/-- Restriction from the infinite Frobenius quotient onto the finite +-Galois quotient is surjective. -/ +-theorem transferNormNaturalityExtensionRestriction_surjective +- (D : DegreeData G) +- (K L : ClosedSubgroup G) +- (hLK : L.toSubgroup ≤ K.toSubgroup) +- [hLnormal : (extensionSubgroup K L hLK).Normal] : +- Function.Surjective (D.extensionRestriction K L hLK) := by +- intro q +- refine QuotientGroup.induction_on q ?_ +- intro k +- exact ⟨QuotientGroup.mk k, rfl⟩ +- +-/-- The kernel of restriction to `G(L/K)` is contained in the subgroup +-coming from `G(\widetilde L/K')`. -/ +-theorem transferNormNaturalityExtensionRestriction_ker_le_intermediate +- (D : DegreeData G) [IsTopologicalGroup G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : +- (D.extensionRestriction E.base.field L (hL.trans E.below)).ker ≤ +- D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL := by +- rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map +- E L hL] +- intro q hq +- revert hq +- refine QuotientGroup.induction_on q ?_ +- intro k hk +- change D.extensionRestriction E.base.field L (hL.trans E.below) +- (QuotientGroup.mk k) = 1 at hk +- rw [D.extensionRestriction_mk] at hk +- have hkL : k ∈ +- extensionSubgroup E.base.field L (hL.trans E.below) := by +- exact QuotientGroup.eq_one_iff k |>.1 hk +- have hkK' : k ∈ +- extensionSubgroup E.base.field E.field.field E.below := by +- apply (mem_extensionSubgroup_iff +- E.base.field E.field.field E.below k).2 +- exact hL ((mem_extensionSubgroup_iff E.base.field L +- (hL.trans E.below) k).1 hkL) +- exact ⟨k, hkK', rfl⟩ +- +-/-- `H` has finite index in `G(\widetilde L/K)`, with no normality +-assumption on the intermediate extension `K'/K`. -/ +-theorem transferNormNaturalityFrobeniusIntermediateFiniteIndex +- (D : DegreeData G) [IsTopologicalGroup G] +- (R : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ R.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup R.base.field L (hL.trans R.below)).Normal] +- [hL'normal : (extensionSubgroup R.field.field L hL).Normal] : +- (D.transferNormNaturalityFrobeniusIntermediateSubgroup R L hL).FiniteIndex := by +- rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map +- R L hL] +- let I := D.extensionInertiaWithin R.base.field L (hL.trans R.below) +- let M := extensionSubgroup R.base.field R.field.field R.below +- have hIM : I ≤ M := by +- intro k hk +- apply (mem_extensionSubgroup_iff +- R.base.field R.field.field R.below k).2 +- exact hL ((mem_extensionSubgroup_iff R.base.field L +- (hL.trans R.below) k).1 hk.1) +- let p := QuotientGroup.mk' I +- have hker : p.ker ≤ M := by +- simpa [p] using hIM +- let : M.FiniteIndex := Subgroup.finiteIndex_of_finite_quotient +- rw [Subgroup.finiteIndex_iff, +- M.index_map_eq (QuotientGroup.mk'_surjective I) hker] +- exact Subgroup.FiniteIndex.index_ne_zero +- +-/-- The copy of `G(\widetilde L/K')` is closed in +-`G(\widetilde L/K)`. -/ +-theorem transferNormNaturalityFrobeniusIntermediate_isClosed +- (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : +- IsClosed (D.transferNormNaturalityFrobeniusIntermediateSubgroup +- E L hL : Set +- (E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L +- (hL.trans E.below))) := by +- let : CompactSpace E.field.field.toSubgroup := +- isCompact_iff_compactSpace.mp E.field.field.isClosed'.isCompact +- let : IsClosed +- (D.extensionInertiaWithin E.field.field L hL : +- Set E.field.field.toSubgroup) := +- D.extensionInertiaWithin_isClosed E.field L hL +- let : IsClosed (D.extensionInertiaWithin E.base.field L +- (hL.trans E.below) : Set E.base.field.toSubgroup) := +- D.extensionInertiaWithin_isClosed E.base L (hL.trans E.below) +- let f := D.finiteReciprocityNaturalityFrobeniusTowerMapContinuous +- E.base.field E.field.field L L +- (hL.trans E.below) hL E.below le_rfl +- change IsClosed (Set.range f) +- have hrange : Set.range f = Set.range f.toContinuousMap := by +- ext y +- constructor <;> rintro ⟨x, rfl⟩ <;> exact ⟨x, rfl⟩ +- rw [hrange] +- simpa only [Set.image_univ] using +- (isCompact_univ.image f.continuous).isClosed +- +-/-- The transfer-orbit index set +-`⟨σ⟩ \ G(\widetilde L/K) / H` is canonically the norm double-coset +-index set `G_K' \ G_K / G_Σ`. The equivalence is inversion of double +-cosets, followed by passage from powers of `σ` to their closure `Γ` and +-the canonical identification `G_K/G_Σ ≃ G(\widetilde L/K)/Γ`. -/ +-noncomputable def transferNormNaturalityTransferNormOrbitEquiv +- (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] +- (σ : D.FrobeniusElements E.base L (hL.trans E.below)) : +- Quotient (orbitRel (Subgroup.zpowers σ.1) +- ((E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L +- (hL.trans E.below)) ⧸ +- D.transferNormNaturalityFrobeniusIntermediateSubgroup +- E L hL)) ≃ +- Quotient (orbitRel +- (extensionSubgroup E.base.field E.field.field E.below) +- (E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field +- (D.frobeniusFixedField E.base L (hL.trans E.below) σ) +- (D.frobeniusFixedField_le E.base L +- (hL.trans E.below) σ))) := by +- let P := E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L +- (hL.trans E.below) +- let H := D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL +- let M := extensionSubgroup E.base.field E.field.field E.below +- let Γ := D.frobeniusClosure E.base L (hL.trans E.below) σ +- let S := D.frobeniusFixedField E.base L (hL.trans E.below) σ +- let hSK := D.frobeniusFixedField_le E.base L (hL.trans E.below) σ +- let f : M →* H := D.transferNormNaturalityIntermediateToFrobeniusSubgroup +- E L hL +- let e := D.frobeniusFixedCosetClosureEquiv +- E.base L (hL.trans E.below) σ +- letI : H.FiniteIndex := +- D.transferNormNaturalityFrobeniusIntermediateFiniteIndex E L hL +- have hHclosed : IsClosed (H : Set P) := +- D.transferNormNaturalityFrobeniusIntermediate_isClosed E L hL +- have hΓ : +- (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup = Γ.toSubgroup := by +- simp [Γ, DegreeData.frobeniusClosure] +- let eΓ : P ⧸ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup ≃ +- P ⧸ Γ.toSubgroup := Subgroup.quotientEquivOfEq hΓ +- have heΓ (h : H) +- (x : P ⧸ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup) : +- eΓ (h • x) = h • eΓ x := by +- refine Quotient.inductionOn' x ?_ +- intro p +- rfl +- let eΓorbit := orbitQuotientEquivOfSurjectiveEquivariant +- (MonoidHom.id H) Function.surjective_id eΓ heΓ +- have hf : Function.Surjective f := +- D.transferNormNaturalityIntermediateToFrobeniusSubgroup_surjective +- E L hL +- have he (m : M) +- (x : E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field S hSK) : +- e (m • x) = f m • e x := by +- exact D.frobeniusFixedCosetClosureEquiv_equivariant +- E L hL σ m x +- let eAction := orbitQuotientEquivOfSurjectiveEquivariant f hf e he +- exact (orbitQuotientSwapEquiv (Subgroup.zpowers σ.1) H).trans +- ((orbitQuotientClosedCyclicEquiv H hHclosed σ.1).trans +- (eΓorbit.trans eAction.symm)) +- +-/-- The transfer-norm orbit equivalence sends quotient representatives to their norm orbits. -/ +-@[simp] +-theorem transferNormNaturalityTransferNormOrbitEquiv_mk +- (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] +- (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) +- (hL : L.toSubgroup ≤ E.field.field.toSubgroup) +- [hLnormal : +- (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] +- [hL'normal : (extensionSubgroup E.field.field L hL).Normal] +- (σ : D.FrobeniusElements E.base L (hL.trans E.below)) +- (k : E.base.field.toSubgroup) : +- D.transferNormNaturalityTransferNormOrbitEquiv E L hL σ +- (Quotient.mk'' (QuotientGroup.mk +- (QuotientGroup.mk k : E.base.field.toSubgroup ⧸ +- D.extensionInertiaWithin E.base.field L (hL.trans E.below)) : +- (E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L +- (hL.trans E.below)) ⧸ +- D.transferNormNaturalityFrobeniusIntermediateSubgroup +- E L hL)) = +- Quotient.mk'' (QuotientGroup.mk k⁻¹ : +- E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field +- (D.frobeniusFixedField E.base L (hL.trans E.below) σ) +- (D.frobeniusFixedField_le E.base L +- (hL.trans E.below) σ)) := by +- unfold transferNormNaturalityTransferNormOrbitEquiv +- simp only [Equiv.trans_apply, orbitQuotientSwapEquiv_mk, +- orbitQuotientClosedCyclicEquiv_mk, +- orbitQuotientEquivOfSurjectiveEquivariant_mk, +- orbitQuotientEquivOfSurjectiveEquivariant_symm_mk, +- Subgroup.quotientEquivOfEq_mk] +- apply congrArg Quotient.mk'' +- exact (D.frobeniusFixedCosetClosureEquiv E.base L +- (hL.trans E.below) σ).symm_apply_apply (QuotientGroup.mk k⁻¹) +- + /-- On the classical chosen transfer representative `t`, the preceding + equivalence is literally the norm orbit represented by `t⁻¹`. -/ + theorem transferNormNaturalityTransferNormOrbitEquiv_apply +diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusRestriction.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusRestriction.lean +new file mode 100644 +index 0000000..4f8dc8c +--- /dev/null ++++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusRestriction.lean +@@ -0,0 +1,142 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++ ++import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainTransferFrobeniusSubgroup ++ ++ ++set_option autoImplicit false ++ ++ ++universe u ++ ++namespace ClassFormation ++ ++open KummerTheory ++open CyclicCohomology ++open CategoryTheory ++ ++noncomputable section ++ ++open scoped BigOperators ++open MulAction ++ ++section transferFrobeniusGeometry ++ ++variable {G : Type u} [Group G] [TopologicalSpace G] ++ ++ ++namespace DegreeData ++ ++/-- Restriction from the infinite Frobenius quotient onto the finite ++Galois quotient is surjective. -/ ++theorem transferNormNaturalityExtensionRestriction_surjective ++ (D : DegreeData G) ++ (K L : ClosedSubgroup G) ++ (hLK : L.toSubgroup ≤ K.toSubgroup) ++ [hLnormal : (extensionSubgroup K L hLK).Normal] : ++ Function.Surjective (D.extensionRestriction K L hLK) := by ++ intro q ++ refine QuotientGroup.induction_on q ?_ ++ intro k ++ exact ⟨QuotientGroup.mk k, rfl⟩ ++ ++ ++theorem transferNormNaturalityExtensionRestriction_ker_le_intermediate ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : ++ (D.extensionRestriction E.base.field L (hL.trans E.below)).ker ≤ ++ D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL := by ++ rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map ++ E L hL] ++ intro q hq ++ revert hq ++ refine QuotientGroup.induction_on q ?_ ++ intro k hk ++ change D.extensionRestriction E.base.field L (hL.trans E.below) ++ (QuotientGroup.mk k) = 1 at hk ++ rw [D.extensionRestriction_mk] at hk ++ have hkL : k ∈ ++ extensionSubgroup E.base.field L (hL.trans E.below) := by ++ exact QuotientGroup.eq_one_iff k |>.1 hk ++ have hkK' : k ∈ ++ extensionSubgroup E.base.field E.field.field E.below := by ++ apply (mem_extensionSubgroup_iff ++ E.base.field E.field.field E.below k).2 ++ exact hL ((mem_extensionSubgroup_iff E.base.field L ++ (hL.trans E.below) k).1 hkL) ++ exact ⟨k, hkK', rfl⟩ ++ ++/-- `H` has finite index in `G(\widetilde L/K)`, with no normality ++assumption on the intermediate extension `K'/K`. -/ ++theorem transferNormNaturalityFrobeniusIntermediateFiniteIndex ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (R : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ R.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup R.base.field L (hL.trans R.below)).Normal] ++ [hL'normal : (extensionSubgroup R.field.field L hL).Normal] : ++ (D.transferNormNaturalityFrobeniusIntermediateSubgroup R L hL).FiniteIndex := by ++ rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map ++ R L hL] ++ let I := D.extensionInertiaWithin R.base.field L (hL.trans R.below) ++ let M := extensionSubgroup R.base.field R.field.field R.below ++ have hIM : I ≤ M := by ++ intro k hk ++ apply (mem_extensionSubgroup_iff ++ R.base.field R.field.field R.below k).2 ++ exact hL ((mem_extensionSubgroup_iff R.base.field L ++ (hL.trans R.below) k).1 hk.1) ++ let p := QuotientGroup.mk' I ++ have hker : p.ker ≤ M := by ++ simpa [p] using hIM ++ let : M.FiniteIndex := Subgroup.finiteIndex_of_finite_quotient ++ rw [Subgroup.finiteIndex_iff, ++ M.index_map_eq (QuotientGroup.mk'_surjective I) hker] ++ exact Subgroup.FiniteIndex.index_ne_zero ++ ++/-- The copy of `G(\widetilde L/K')` is closed in ++`G(\widetilde L/K)`. -/ ++theorem transferNormNaturalityFrobeniusIntermediate_isClosed ++ (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : ++ IsClosed (D.transferNormNaturalityFrobeniusIntermediateSubgroup ++ E L hL : Set ++ (E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L ++ (hL.trans E.below))) := by ++ let : CompactSpace E.field.field.toSubgroup := ++ isCompact_iff_compactSpace.mp E.field.field.isClosed'.isCompact ++ let : IsClosed ++ (D.extensionInertiaWithin E.field.field L hL : ++ Set E.field.field.toSubgroup) := ++ D.extensionInertiaWithin_isClosed E.field L hL ++ let : IsClosed (D.extensionInertiaWithin E.base.field L ++ (hL.trans E.below) : Set E.base.field.toSubgroup) := ++ D.extensionInertiaWithin_isClosed E.base L (hL.trans E.below) ++ let f := D.finiteReciprocityNaturalityFrobeniusTowerMapContinuous ++ E.base.field E.field.field L L ++ (hL.trans E.below) hL E.below le_rfl ++ change IsClosed (Set.range f) ++ have hrange : Set.range f = Set.range f.toContinuousMap := by ++ ext y ++ constructor <;> rintro ⟨x, rfl⟩ <;> exact ⟨x, rfl⟩ ++ rw [hrange] ++ simpa only [Set.image_univ] using ++ (isCompact_univ.image f.continuous).isClosed ++ ++ ++end DegreeData ++end transferFrobeniusGeometry ++end ++end ClassFormation +diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusSubgroup.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusSubgroup.lean +new file mode 100644 +index 0000000..d46fda8 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferFrobeniusSubgroup.lean +@@ -0,0 +1,249 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainNaturality ++import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.DoubleCosetOrbitGeometry ++ ++ ++set_option autoImplicit false ++ ++ ++universe u ++ ++namespace ClassFormation ++ ++open KummerTheory ++open CyclicCohomology ++open CategoryTheory ++ ++noncomputable section ++ ++open scoped BigOperators ++open MulAction ++ ++section transferFrobeniusGeometry ++ ++variable {G : Type u} [Group G] [TopologicalSpace G] ++ ++/-- The absolute group of an intermediate field, identified with its ++literal copy inside the absolute group of the base field. -/ ++noncomputable def transferNormNaturalityIntermediateAbsoluteEquiv ++ (K K' : ClosedSubgroup G) ++ (hK'K : K'.toSubgroup ≤ K.toSubgroup) : ++ K'.toSubgroup ≃* extensionSubgroup K K' hK'K := ++ MulEquiv.ofBijective ++ ((Subgroup.inclusion hK'K).codRestrict ++ (extensionSubgroup K K' hK'K) (fun k' => k'.2)) ++ ⟨fun _ _ h => Subtype.ext (congrArg (fun z => z.1.1) h), by ++ rintro ⟨k, hk'⟩ ++ let k' : K'.toSubgroup := ⟨k.1, hk'⟩ ++ exact ⟨k', Subtype.ext rfl⟩⟩ ++ ++/-- The absolute intermediate-field equivalence evaluates by the underlying transfer map. -/ ++@[simp] ++theorem transferNormNaturalityIntermediateAbsoluteEquiv_apply ++ (K K' : ClosedSubgroup G) ++ (hK'K : K'.toSubgroup ≤ K.toSubgroup) ++ (k' : K'.toSubgroup) : ++ ((transferNormNaturalityIntermediateAbsoluteEquiv K K' hK'K k').1 : G) = k'.1 := ++ rfl ++ ++/-- Normality of `L | K` restricts to every intermediate field `K'`. -/ ++theorem transferNormNaturality_intermediateExtension_normal ++ (K K' L : ClosedSubgroup G) ++ (hLK' : L.toSubgroup ≤ K'.toSubgroup) ++ (hK'K : K'.toSubgroup ≤ K.toSubgroup) ++ [hLnormal : (extensionSubgroup K L (hLK'.trans hK'K)).Normal] : ++ (extensionSubgroup K' L hLK').Normal := by ++ have hcomap : extensionSubgroup K' L hLK' = ++ (extensionSubgroup K L (hLK'.trans hK'K)).comap ++ (Subgroup.inclusion hK'K) := by ++ ext k' ++ rw [Subgroup.mem_comap, mem_extensionSubgroup_iff, ++ mem_extensionSubgroup_iff] ++ rfl ++ rw [hcomap] ++ exact hLnormal.comap (Subgroup.inclusion hK'K) ++ ++namespace DegreeData ++ ++/-- The restriction map on the infinite Frobenius quotients is injective ++when the top field is unchanged. -/ ++theorem transferNormNaturalityFrobeniusTowerMap_injective ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : ++ Function.Injective ++ (D.finiteReciprocityNaturalityFrobeniusTowerMap ++ E.base.field E.field.field L L ++ (hL.trans E.below) hL E.below le_rfl) := by ++ intro x y ++ refine QuotientGroup.induction_on x ?_ ++ intro k' ++ refine QuotientGroup.induction_on y ?_ ++ intro l' h ++ apply QuotientGroup.eq.mpr ++ have hmem : ++ (Subgroup.inclusion E.below k')⁻¹ * Subgroup.inclusion E.below l' ∈ ++ D.extensionInertiaWithin E.base.field L (hL.trans E.below) := ++ QuotientGroup.eq.mp h ++ constructor ++ · apply (mem_extensionSubgroup_iff E.field.field L hL (k'⁻¹ * l')).2 ++ have hG := (mem_extensionSubgroup_iff E.base.field L ++ (hL.trans E.below) ++ ((Subgroup.inclusion E.below k')⁻¹ * ++ Subgroup.inclusion E.below l')).1 hmem.1 ++ simpa using hG ++ · have hI := hmem.2 ++ change D.degree (((Subgroup.inclusion E.below k')⁻¹ * ++ Subgroup.inclusion E.below l' : E.base.field.toSubgroup) : G) = 1 at hI ++ change D.degree ((k'⁻¹ * l' : E.field.field.toSubgroup) : G) = 1 ++ exact hI ++ ++/-- The copy of `G(\widetilde L/K')` inside ++`G(\widetilde L/K)`. This is the subgroup `H` used in the classical ++double-coset proof of transfer--norm naturality. -/ ++def transferNormNaturalityFrobeniusIntermediateSubgroup ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : ++ Subgroup (E.base.field.toSubgroup ⧸ ++ D.extensionInertiaWithin E.base.field L (hL.trans E.below)) := ++ (D.finiteReciprocityNaturalityFrobeniusTowerMap ++ E.base.field E.field.field L L ++ (hL.trans E.below) hL E.below le_rfl).range ++ ++/-- The subgroup above is also the image of `G_K'` under the quotient ++projection `G_K → G(\widetilde L/K)`. -/ ++theorem transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : ++ D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL = ++ (extensionSubgroup E.base.field E.field.field E.below).map ++ (QuotientGroup.mk' ++ (D.extensionInertiaWithin E.base.field L ++ (hL.trans E.below))) := by ++ ext q ++ constructor ++ · rintro ⟨x, rfl⟩ ++ refine QuotientGroup.induction_on x ?_ ++ intro k' ++ refine ⟨Subgroup.inclusion E.below k', ?_, rfl⟩ ++ exact k'.2 ++ · rintro ⟨k, hk', rfl⟩ ++ let k' : E.field.field.toSubgroup := ⟨k.1, hk'⟩ ++ refine ⟨QuotientGroup.mk k', ?_⟩ ++ change QuotientGroup.mk (Subgroup.inclusion E.below k') = ++ QuotientGroup.mk k ++ rfl ++ ++/-- Quotient projection maps the literal absolute subgroup belonging to ++`K'` onto its copy `H` inside `G(\widetilde L/K)`. -/ ++noncomputable def transferNormNaturalityIntermediateToFrobeniusSubgroup ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : ++ extensionSubgroup E.base.field E.field.field E.below →* ++ D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL := by ++ refine ((QuotientGroup.mk' ++ (D.extensionInertiaWithin E.base.field L (hL.trans E.below))).comp ++ (extensionSubgroup E.base.field E.field.field E.below).subtype).codRestrict ++ (D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL) ?_ ++ intro m ++ change QuotientGroup.mk m.1 ∈ ++ D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL ++ rw [D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map ++ E L hL] ++ exact ⟨m.1, m.2, rfl⟩ ++ ++/-- The map from the intermediate quotient onto the Frobenius subgroup is surjective. -/ ++theorem transferNormNaturalityIntermediateToFrobeniusSubgroup_surjective ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] : ++ Function.Surjective ++ (D.transferNormNaturalityIntermediateToFrobeniusSubgroup ++ E L hL) := by ++ intro h ++ have hh : h.1 ∈ ++ (extensionSubgroup E.base.field E.field.field E.below).map ++ (QuotientGroup.mk' ++ (D.extensionInertiaWithin E.base.field L (hL.trans E.below))) := by ++ rw [← D.transferNormNaturalityFrobeniusIntermediateSubgroup_eq_map ++ E L hL] ++ exact h.2 ++ obtain ⟨m, hm, hval⟩ := hh ++ refine ⟨⟨m, hm⟩, ?_⟩ ++ apply Subtype.ext ++ unfold transferNormNaturalityIntermediateToFrobeniusSubgroup ++ simpa only [MonoidHom.codRestrict_apply, MonoidHom.comp_apply, ++ Subgroup.subtype_apply] using hval ++ ++/-- The intermediate-to-Frobenius map has the stated value on each representative. -/ ++@[simp] ++theorem transferNormNaturalityIntermediateToFrobeniusSubgroup_apply ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] ++ (m : extensionSubgroup E.base.field E.field.field E.below) : ++ (D.transferNormNaturalityIntermediateToFrobeniusSubgroup ++ E L hL m).1 = ++ (QuotientGroup.mk m.1 : E.base.field.toSubgroup ⧸ ++ D.extensionInertiaWithin E.base.field L (hL.trans E.below)) := by ++ rfl ++ ++/-- The canonical coset equivalence from `G_K/G_Σ` to ++`G(\widetilde L/K)/Γ` intertwines the two copies of the `K'`-action. -/ ++theorem frobeniusFixedCosetClosureEquiv_equivariant ++ (D : DegreeData G) [IsTopologicalGroup G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] ++ (σ : D.FrobeniusElements E.base L (hL.trans E.below)) ++ (m : extensionSubgroup E.base.field E.field.field E.below) ++ (x : E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field ++ (D.frobeniusFixedField E.base L (hL.trans E.below) σ) ++ (D.frobeniusFixedField_le E.base L (hL.trans E.below) σ)) : ++ D.frobeniusFixedCosetClosureEquiv E.base L (hL.trans E.below) σ (m • x) = ++ (D.transferNormNaturalityIntermediateToFrobeniusSubgroup ++ E L hL m) • ++ D.frobeniusFixedCosetClosureEquiv E.base L ++ (hL.trans E.below) σ x := by ++ refine Quotient.inductionOn' x ?_ ++ intro k ++ change QuotientGroup.mk (QuotientGroup.mk (m.1 * k)) = ++ QuotientGroup.mk ++ ((D.transferNormNaturalityIntermediateToFrobeniusSubgroup ++ E L hL m).1 * QuotientGroup.mk k) ++ rw [D.transferNormNaturalityIntermediateToFrobeniusSubgroup_apply] ++ rfl ++ ++ ++end DegreeData ++end transferFrobeniusGeometry ++end ++end ClassFormation +diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitEquiv.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitEquiv.lean +new file mode 100644 +index 0000000..5ce3d85 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitEquiv.lean +@@ -0,0 +1,107 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++ ++import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainTransferFrobeniusRestriction ++ ++ ++set_option autoImplicit false ++ ++ ++universe u ++ ++namespace ClassFormation ++ ++open KummerTheory ++open CyclicCohomology ++open CategoryTheory ++ ++noncomputable section ++ ++open scoped BigOperators ++open MulAction ++ ++section transferFrobeniusGeometry ++ ++variable {G : Type u} [Group G] [TopologicalSpace G] ++ ++ ++namespace DegreeData ++ ++/-- The transfer-orbit index set ++`⟨σ⟩ \ G(\widetilde L/K) / H` is canonically the norm double-coset ++index set `G_K' \ G_K / G_Σ`. The equivalence is inversion of double ++cosets, followed by passage from powers of `σ` to their closure `Γ` and ++the canonical identification `G_K/G_Σ ≃ G(\widetilde L/K)/Γ`. -/ ++noncomputable def transferNormNaturalityTransferNormOrbitEquiv ++ (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] ++ (σ : D.FrobeniusElements E.base L (hL.trans E.below)) : ++ Quotient (orbitRel (Subgroup.zpowers σ.1) ++ ((E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L ++ (hL.trans E.below)) ⧸ ++ D.transferNormNaturalityFrobeniusIntermediateSubgroup ++ E L hL)) ≃ ++ Quotient (orbitRel ++ (extensionSubgroup E.base.field E.field.field E.below) ++ (E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field ++ (D.frobeniusFixedField E.base L (hL.trans E.below) σ) ++ (D.frobeniusFixedField_le E.base L ++ (hL.trans E.below) σ))) := by ++ let P := E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L ++ (hL.trans E.below) ++ let H := D.transferNormNaturalityFrobeniusIntermediateSubgroup E L hL ++ let M := extensionSubgroup E.base.field E.field.field E.below ++ let Γ := D.frobeniusClosure E.base L (hL.trans E.below) σ ++ let S := D.frobeniusFixedField E.base L (hL.trans E.below) σ ++ let hSK := D.frobeniusFixedField_le E.base L (hL.trans E.below) σ ++ let f : M →* H := D.transferNormNaturalityIntermediateToFrobeniusSubgroup ++ E L hL ++ let e := D.frobeniusFixedCosetClosureEquiv ++ E.base L (hL.trans E.below) σ ++ letI : H.FiniteIndex := ++ D.transferNormNaturalityFrobeniusIntermediateFiniteIndex E L hL ++ have hHclosed : IsClosed (H : Set P) := ++ D.transferNormNaturalityFrobeniusIntermediate_isClosed E L hL ++ have hΓ : ++ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup = Γ.toSubgroup := by ++ simp only [Γ, DegreeData.frobeniusClosure, Set.range_const] ++ let eΓ : P ⧸ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup ≃ ++ P ⧸ Γ.toSubgroup := Subgroup.quotientEquivOfEq hΓ ++ have heΓ (h : H) ++ (x : P ⧸ (closedSubgroupGenerated ({σ.1} : Set P)).toSubgroup) : ++ eΓ (h • x) = h • eΓ x := by ++ refine Quotient.inductionOn' x ?_ ++ intro p ++ change eΓ (QuotientGroup.mk (h.val * p)) = h • eΓ (QuotientGroup.mk p) ++ simp only [eΓ, Subgroup.quotientEquivOfEq_mk] ++ rfl ++ let eΓorbit := orbitQuotientEquivOfSurjectiveEquivariant ++ (MonoidHom.id H) Function.surjective_id eΓ heΓ ++ have hf : Function.Surjective f := ++ D.transferNormNaturalityIntermediateToFrobeniusSubgroup_surjective ++ E L hL ++ have he (m : M) ++ (x : E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field S hSK) : ++ e (m • x) = f m • e x := by ++ exact D.frobeniusFixedCosetClosureEquiv_equivariant ++ E L hL σ m x ++ let eAction := orbitQuotientEquivOfSurjectiveEquivariant f hf e he ++ exact (orbitQuotientSwapEquiv (Subgroup.zpowers σ.1) H).trans ++ ((orbitQuotientClosedCyclicEquiv H hHclosed σ.1).trans ++ (eΓorbit.trans eAction.symm)) ++ ++ ++end DegreeData ++ ++end transferFrobeniusGeometry ++end ++ ++end ClassFormation +diff --git a/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitMk.lean b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitMk.lean +new file mode 100644 +index 0000000..0e23056 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/AbstractClassFieldTheory/Reciprocity/Construction/MainTransferNormOrbitMk.lean +@@ -0,0 +1,74 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++ ++import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Construction.MainTransferNormOrbitEquiv ++ ++ ++set_option autoImplicit false ++ ++ ++universe u ++ ++namespace ClassFormation ++ ++open KummerTheory ++open CyclicCohomology ++open CategoryTheory ++ ++noncomputable section ++ ++open scoped BigOperators ++open MulAction ++ ++section transferFrobeniusGeometry ++ ++variable {G : Type u} [Group G] [TopologicalSpace G] ++ ++ ++namespace DegreeData ++ ++/-- The transfer-norm orbit equivalence sends quotient representatives to their norm orbits. -/ ++@[simp] ++theorem transferNormNaturalityTransferNormOrbitEquiv_mk ++ (D : DegreeData G) [IsTopologicalGroup G] [CompactSpace G] [T2Space G] ++ (E : FiniteResidueAbstractExtension D) (L : ClosedSubgroup G) ++ (hL : L.toSubgroup ≤ E.field.field.toSubgroup) ++ [hLnormal : ++ (extensionSubgroup E.base.field L (hL.trans E.below)).Normal] ++ [hL'normal : (extensionSubgroup E.field.field L hL).Normal] ++ (σ : D.FrobeniusElements E.base L (hL.trans E.below)) ++ (k : E.base.field.toSubgroup) : ++ D.transferNormNaturalityTransferNormOrbitEquiv E L hL σ ++ (Quotient.mk'' (QuotientGroup.mk ++ (QuotientGroup.mk k : E.base.field.toSubgroup ⧸ ++ D.extensionInertiaWithin E.base.field L (hL.trans E.below)) : ++ (E.base.field.toSubgroup ⧸ D.extensionInertiaWithin E.base.field L ++ (hL.trans E.below)) ⧸ ++ D.transferNormNaturalityFrobeniusIntermediateSubgroup ++ E L hL)) = ++ Quotient.mk'' (QuotientGroup.mk k⁻¹ : ++ E.base.field.toSubgroup ⧸ extensionSubgroup E.base.field ++ (D.frobeniusFixedField E.base L (hL.trans E.below) σ) ++ (D.frobeniusFixedField_le E.base L ++ (hL.trans E.below) σ)) := by ++ unfold transferNormNaturalityTransferNormOrbitEquiv ++ simp only [Equiv.trans_apply, orbitQuotientSwapEquiv_mk, ++ orbitQuotientClosedCyclicEquiv_mk, ++ orbitQuotientEquivOfSurjectiveEquivariant_mk, ++ orbitQuotientEquivOfSurjectiveEquivariant_symm_mk, ++ Subgroup.quotientEquivOfEq_mk] ++ apply congrArg Quotient.mk'' ++ exact (D.frobeniusFixedCosetClosureEquiv E.base L ++ (hL.trans E.below) σ).symm_apply_apply (QuotientGroup.mk k⁻¹) ++ ++ ++end DegreeData ++ ++end transferFrobeniusGeometry ++end ++ ++end ClassFormation +diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/AdeleBaseChange.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/AdeleBaseChange.lean +index fa7f215..d8d918e 100644 +--- a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/AdeleBaseChange.lean ++++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/AdeleBaseChange.lean +@@ -7,15 +7,9 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + import ClassFieldTheory.AlgebraicNumberTheory.Idele.BaseChange + import ClassFieldTheory.AlgebraicNumberTheory.Completion.AdicCompletionComparison + +-set_option autoImplicit false + +-/-! +-# Scalar extension from relative to ordinary adeles ++set_option autoImplicit false + +-This file upgrades the relative-to-ordinary idele comparison to the +-underlying adele rings. The additive structure is needed to transport +-determinant norms in a field tower. +--/ + + open scoped NumberField TensorProduct RestrictedProduct + open NumberField IsDedekindDomain +diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/Idele/NormTopology/ExtensionBehavior.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/Idele/NormTopology/ExtensionBehavior.lean +index 2e624da..f838ee6 100644 +--- a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/Idele/NormTopology/ExtensionBehavior.lean ++++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/Idele/NormTopology/ExtensionBehavior.lean +@@ -6,6 +6,7 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + + import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormTopology.FiniteNormArithmetic + ++ + set_option autoImplicit false + + /-! +@@ -40,12 +41,20 @@ private theorem infinitePlaceCompletionMap_isometry + Isometry + (NumberField.LiesOver.completionMap + (v := v₀) (w := W)) := by +- unfold NumberField.LiesOver.completionMap +- exact +- (InfinitePlace.Completion.isometryEquivCompletion W).symm.isometry.comp +- ((UniformSpace.Completion.isometry_mapRingHom +- (InfinitePlace.LiesOver.isometry_algebraMap W v₀)).comp +- (InfinitePlace.Completion.isometryEquivCompletion v₀).isometry) ++ apply AddMonoidHomClass.isometry_of_norm ++ (NumberField.LiesOver.completionMap (v := v₀) (w := W)) ++ intro x ++ refine InfinitePlace.Completion.induction_on v₀ x ++ (isClosed_eq ++ (continuous_norm.comp NumberField.LiesOver.continuous_completionMap) ++ continuous_norm) ?_ ++ intro a ++ rw [NumberField.LiesOver.completionMap_coe] ++ have h := (InfinitePlace.LiesOver.isometry_algebraMap W v₀).norm_map_of_map_zero ++ (map_zero (algebraMap (WithAbs v₀.1) (WithAbs W.1))) a ++ simp only [InfinitePlace.Completion.norm_coe, WithAbs.norm_eq_apply_ofAbs, ++ WithAbs.equiv_apply, InfinitePlace.coe_apply] at h ⊢ ++ with_reducible exact h + + omit [NumberField L] in + /-- Mapping a unit along an infinite-place completion map preserves its +diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/Ideal.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/Ideal.lean +index d626883..6255279 100644 +--- a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/Ideal.lean ++++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/Ideal.lean +@@ -4,23 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Topology +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.LocallyCompact +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.PrincipalNorm +-import ValuedFieldTheory.Valuation.AbsoluteValue.Theory.AbsoluteValues +-import Mathlib.NumberTheory.NumberField.Completion.InfinitePlace +-import Mathlib.Topology.Algebra.IsOpenUnits +-import Mathlib.Topology.Algebra.Ring.Compact + +-set_option autoImplicit false ++import ClassFieldTheory.AlgebraicNumberTheory.RayClass.IdealApproximation + +-/-! +-# Ideals prime to a ray-class modulus + +-This file defines the subgroup of fractional ideals prime to a modulus, +-connects it with the corresponding finite-idele higher-unit conditions, and +-develops the approximation maps used in ray-class ideal constructions. +--/ ++set_option autoImplicit false ++ + + open scoped NumberField WithZero Classical + open NumberField IsDedekindDomain +@@ -32,690 +21,6 @@ variable {K : Type*} [Field K] [NumberField K] + + namespace RayClass + +-/-- Fractional ideals having valuation zero at every finite prime in the +-support of the modulus. -/ +-def primeToModulusIdeals (m : Modulus K) : +- Subgroup (FractionalIdealGroup K) where +- carrier := {I | ∀ v, v ∈ m.finitePart.support → +- FractionalIdeal.count K v +- (I : FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0} +- one_mem' v _ := FractionalIdeal.count_one K v +- mul_mem' {I J} hI hJ v hv := by +- rw [Units.val_mul, +- FractionalIdeal.count_mul K v (Units.ne_zero I) (Units.ne_zero J), +- hI v hv, hJ v hv, add_zero] +- inv_mem' {I} hI v hv := by +- rw [Units.val_inv_eq_inv_val, FractionalIdeal.count_inv K v, +- hI v hv, neg_zero] +- +-@[simp] +-theorem mem_primeToModulusIdeals_iff +- (m : Modulus K) (I : FractionalIdealGroup K) : +- I ∈ primeToModulusIdeals m ↔ +- ∀ v, v ∈ m.finitePart.support → +- FractionalIdeal.count K v +- (I : FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0 := +- Iff.rfl +- +-/-- A finite prime outside the support of `m`, regarded as an element of +-the group of fractional ideals prime to `m`. -/ +-def primeToModulusIdeal +- (m : Modulus K) +- (v : HeightOneSpectrum (𝓞 K)) +- (hv : v ∉ m.finitePart.support) : +- primeToModulusIdeals m := +- ⟨FractionalIdealGroup.prime v, by +- intro w hw +- have hwv : w ≠ v := by +- intro h +- exact hv (h ▸ hw) +- change +- FractionalIdeal.count K w +- (v.asIdeal : +- FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = +- 0 +- exact +- FractionalIdeal.count_maximal_coprime +- K w hwv.symm⟩ +- +-/-- Coercing a prime outside the modulus support recovers its prime +-fractional ideal. -/ +-@[simp] +-theorem primeToModulusIdeal_coe +- (m : Modulus K) +- (v : HeightOneSpectrum (𝓞 K)) +- (hv : v ∉ m.finitePart.support) : +- (primeToModulusIdeal m v hv : +- FractionalIdealGroup K) = +- FractionalIdealGroup.prime v := +- rfl +- +-/-- Finite ideles satisfying the higher-unit condition at every prime in +-the support of the modulus. -/ +-def finitePrimeToModulusSubgroup (m : Modulus K) : +- Subgroup (FiniteIdeleGroup K) where +- carrier := {a | ∀ v, v ∈ m.finitePart.support → +- a v ∈ localHigherUnitGroup v (m.finitePart v)} +- one_mem' v _ := (localHigherUnitGroup v (m.finitePart v)).one_mem +- mul_mem' ha hb v hv := +- (localHigherUnitGroup v (m.finitePart v)).mul_mem (ha v hv) (hb v hv) +- inv_mem' ha v hv := +- (localHigherUnitGroup v (m.finitePart v)).inv_mem (ha v hv) +- +-/-- Ideles satisfying the infinite positivity and finite higher-unit +-conditions of a modulus. -/ +-def idelePrimeToModulusSubgroup (m : Modulus K) : +- Subgroup (IdeleGroup K) := +- m.infiniteCongruenceSubgroup.prod +- (finitePrimeToModulusSubgroup m) +- +-theorem localHigherUnitGroup_le_integralUnits +- (v : HeightOneSpectrum (𝓞 K)) (n : ℕ) : +- localHigherUnitGroup v n ≤ +- (v.adicCompletionIntegers K).units := by +- intro x hx +- rw [mem_localHigherUnitGroup_iff] at hx +- obtain ⟨y, rfl, _⟩ := hx +- exact y.property +- +-theorem fractionalIdeal_mem_primeToModulusIdeals +- (m : Modulus K) (a : IdeleGroup K) +- (ha : a ∈ idelePrimeToModulusSubgroup m) : +- IdeleGroup.fractionalIdeal a ∈ primeToModulusIdeals m := by +- intro v hv +- change FractionalIdeal.count K v +- (((FractionalIdealGroup.factorization (K := K)) +- (FiniteIdeleGroup.valuationVector a.2) : +- FractionalIdealGroup K) : +- FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0 +- rw [FractionalIdealGroup.count_factorization, +- FiniteIdeleGroup.valuationVector_apply] +- apply (FiniteIdeleGroup.localOrder_eq_zero_iff v (a.2 v)).2 +- exact localHigherUnitGroup_le_integralUnits v (m.finitePart v) (ha.2 v hv) +- +-/-- The fractional-ideal map restricted to ideles prime to a modulus. -/ +-def primeToIdealMap (m : Modulus K) : +- idelePrimeToModulusSubgroup m →* +- primeToModulusIdeals m where +- toFun a := +- ⟨IdeleGroup.fractionalIdeal a, +- fractionalIdeal_mem_primeToModulusIdeals m a a.property⟩ +- map_one' := by +- apply Subtype.ext +- exact map_one _ +- map_mul' a b := by +- apply Subtype.ext +- exact map_mul _ _ _ +- +-/-- A finite idele with a prescribed valuation vector away from the +-support of a modulus and value one on its support. -/ +-def valuationVectorSectionPrimeTo +- (m : Modulus K) +- (e : HeightOneSpectrum (𝓞 K) →₀ ℤ) : +- FiniteIdeleGroup K := +- ⟨fun v => +- if v ∈ m.finitePart.support then 1 +- else FiniteIdeleGroup.chosenLocalOrderSection v (e v), by +- filter_upwards +- [m.finitePart.support.eventually_cofinite_notMem, +- e.support.eventually_cofinite_notMem] with v hvm he +- simp only [hvm, ↓reduceIte] +- apply (FiniteIdeleGroup.localOrder_eq_zero_iff v _).1 +- rw [FiniteIdeleGroup.localOrder_chosenLocalOrderSection, +- Finsupp.notMem_support_iff.mp he]⟩ +- +-theorem valuationVector_valuationVectorSectionPrimeTo +- (m : Modulus K) +- (e : HeightOneSpectrum (𝓞 K) →₀ ℤ) +- (he : ∀ v, v ∈ m.finitePart.support → e v = 0) : +- FiniteIdeleGroup.valuationVector +- (valuationVectorSectionPrimeTo m e) = +- Multiplicative.ofAdd e := by +- apply Multiplicative.ext +- ext v +- rw [FiniteIdeleGroup.valuationVector_apply] +- by_cases hv : v ∈ m.finitePart.support +- · change +- (FiniteIdeleGroup.localOrder v +- (if v ∈ m.finitePart.support then 1 +- else FiniteIdeleGroup.chosenLocalOrderSection v (e v))).toAdd = +- e v +- rw [ite_eq_left hv, map_one] +- exact (he v hv).symm +- · change +- (FiniteIdeleGroup.localOrder v +- (if v ∈ m.finitePart.support then 1 +- else FiniteIdeleGroup.chosenLocalOrderSection v (e v))).toAdd = +- e v +- rw [ite_eq_right hv, +- FiniteIdeleGroup.localOrder_chosenLocalOrderSection] +- +-theorem primeToIdealMap_surjective (m : Modulus K) : +- Function.Surjective (primeToIdealMap m) := by +- intro I +- let e : HeightOneSpectrum (𝓞 K) →₀ ℤ := +- FractionalIdealGroup.countVector (I : FractionalIdealGroup K) +- have he : ∀ v, v ∈ m.finitePart.support → e v = 0 := by +- intro v hv +- exact I.property v hv +- let a : IdeleGroup K := +- (1, valuationVectorSectionPrimeTo m e) +- have ha : a ∈ idelePrimeToModulusSubgroup m := by +- constructor +- · exact m.infiniteCongruenceSubgroup.one_mem +- · intro v hv +- change +- (if v ∈ m.finitePart.support then 1 +- else FiniteIdeleGroup.chosenLocalOrderSection v (e v)) ∈ +- localHigherUnitGroup v (m.finitePart v) +- rw [ite_eq_left hv] +- exact (localHigherUnitGroup v (m.finitePart v)).one_mem +- refine ⟨⟨a, ha⟩, ?_⟩ +- apply Subtype.ext +- apply FractionalIdealGroup.ext_count +- intro v +- change FractionalIdeal.count K v +- (((FractionalIdealGroup.factorization (K := K)) +- (FiniteIdeleGroup.valuationVector +- (valuationVectorSectionPrimeTo m e)) : +- FractionalIdealGroup K) : +- FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = +- FractionalIdeal.count K v +- ((I : FractionalIdealGroup K) : +- FractionalIdeal (nonZeroDivisors (𝓞 K)) K) +- rw [valuationVector_valuationVectorSectionPrimeTo m e he, +- FractionalIdealGroup.count_factorization] +- exact FractionalIdealGroup.countVector_apply I v +- +-theorem ideleCongruenceSubgroup_le_primeTo +- (m : Modulus K) : +- m.ideleCongruenceSubgroup ≤ +- idelePrimeToModulusSubgroup m := by +- intro a ha +- exact ⟨ha.1, fun v _ => ha.2 v⟩ +- +-/-- The congruence subgroup, viewed inside the subgroup of ideles prime +-to the modulus. -/ +-def congruenceSubgroupInPrimeTo (m : Modulus K) : +- Subgroup (idelePrimeToModulusSubgroup m) := +- m.ideleCongruenceSubgroup.subgroupOf +- (idelePrimeToModulusSubgroup m) +- +-theorem primeToIdealMap_ker (m : Modulus K) : +- (primeToIdealMap m).ker = +- congruenceSubgroupInPrimeTo m := by +- ext a +- constructor +- · intro ha +- have hintegral : +- (a : IdeleGroup K) ∈ +- IdeleGroup.integralAtFinitePlaces (K := K) := by +- rw [← IdeleGroup.fractionalIdeal_ker, +- MonoidHom.mem_ker] +- exact congrArg Subtype.val +- (MonoidHom.mem_ker.mp ha) +- constructor +- · exact a.property.1 +- · intro v +- by_cases hv : v ∈ m.finitePart.support +- · exact a.property.2 v hv +- · rw [Finsupp.notMem_support_iff.mp hv, +- localHigherUnitGroup_zero] +- exact hintegral v +- · intro ha +- apply MonoidHom.mem_ker.mpr +- apply Subtype.ext +- change IdeleGroup.fractionalIdeal (a : IdeleGroup K) = 1 +- rw [← MonoidHom.mem_ker, +- IdeleGroup.fractionalIdeal_ker] +- intro v +- exact localHigherUnitGroup_le_integralUnits v (m.finitePart v) (ha.2 v) +- +-/-- The quotient of ideles prime to a modulus by the congruence subgroup, +-identified with fractional ideals prime to the modulus. -/ +-def quotientCongruenceEquivPrimeToIdeals (m : Modulus K) : +- idelePrimeToModulusSubgroup m ⧸ +- congruenceSubgroupInPrimeTo m ≃* +- primeToModulusIdeals m := by +- rw [← primeToIdealMap_ker m] +- exact QuotientGroup.quotientKerEquivOfSurjective +- (primeToIdealMap m) (primeToIdealMap_surjective m) +- +-/-- Principal ideles satisfying the modulus conditions, considered inside +-`I_K^(m)`. -/ +-def principalSubgroupInPrimeTo (m : Modulus K) : +- Subgroup (idelePrimeToModulusSubgroup m) := +- Subgroup.comap (idelePrimeToModulusSubgroup m).subtype +- (IdeleGroup.principalSubgroup K) +- +-/-- Principal ideals generated by a totally positive element congruent to +-one modulo the finite modulus. -/ +-def principalRayIdealSubgroup (m : Modulus K) : +- Subgroup (primeToModulusIdeals m) := +- Subgroup.map (primeToIdealMap m) +- (principalSubgroupInPrimeTo m) +- +-theorem mem_principalRayIdealSubgroup_iff +- (m : Modulus K) (I : primeToModulusIdeals m) : +- I ∈ principalRayIdealSubgroup m ↔ +- ∃ x : Kˣ, +- ∃ _hx : IdeleGroup.principalIdele K x ∈ +- idelePrimeToModulusSubgroup m, +- toPrincipalIdeal (𝓞 K) K x = +- (I : FractionalIdealGroup K) := by +- constructor +- · rintro ⟨a, ha, hmap⟩ +- obtain ⟨x, hx⟩ := ha +- refine ⟨x, ?_, ?_⟩ +- · rw [hx] +- exact a.property +- · have hval := congrArg Subtype.val hmap +- change IdeleGroup.fractionalIdeal (a : IdeleGroup K) = +- (I : FractionalIdealGroup K) at hval +- rw [← IdeleGroup.fractionalIdeal_principalIdele] +- exact (congrArg (IdeleGroup.fractionalIdeal (K := K)) hx).trans hval +- · rintro ⟨x, hx, hideal⟩ +- let a : idelePrimeToModulusSubgroup m := +- ⟨IdeleGroup.principalIdele K x, hx⟩ +- have ha : a ∈ principalSubgroupInPrimeTo m := by +- change IdeleGroup.principalIdele K x ∈ +- IdeleGroup.principalSubgroup K +- exact ⟨x, rfl⟩ +- refine ⟨a, ha, ?_⟩ +- apply Subtype.ext +- change IdeleGroup.fractionalIdeal +- (IdeleGroup.principalIdele K x) = +- (I : FractionalIdealGroup K) +- rw [IdeleGroup.fractionalIdeal_principalIdele, hideal] +- +-/-- The ideal-theoretic ray class group `J_K^m / P_K^m`. -/ +-abbrev IdealRayClassGroup (m : Modulus K) := +- primeToModulusIdeals m ⧸ principalRayIdealSubgroup m +- +-/-- The canonical projection from ideles prime to the modulus to the +-ideal-theoretic ray class group. -/ +-def idealRayProjection (m : Modulus K) : +- idelePrimeToModulusSubgroup m →* +- IdealRayClassGroup m := +- (QuotientGroup.mk' (principalRayIdealSubgroup m)).comp +- (primeToIdealMap m) +- +-/-- The subgroup generated by congruence ideles and principal ideles +-inside the ideles prime to a modulus. -/ +-def raySubgroupInPrimeTo (m : Modulus K) : +- Subgroup (idelePrimeToModulusSubgroup m) := +- congruenceSubgroupInPrimeTo m ⊔ +- principalSubgroupInPrimeTo m +- +-theorem idealRayProjection_surjective (m : Modulus K) : +- Function.Surjective (idealRayProjection m) := by +- intro c +- obtain ⟨I, rfl⟩ := +- QuotientGroup.mk'_surjective +- (principalRayIdealSubgroup m) c +- obtain ⟨a, rfl⟩ := primeToIdealMap_surjective m I +- exact ⟨a, rfl⟩ +- +-theorem idealRayProjection_ker (m : Modulus K) : +- (idealRayProjection m).ker = +- raySubgroupInPrimeTo m := by +- ext a +- constructor +- · intro ha +- change QuotientGroup.mk' +- (principalRayIdealSubgroup m) +- (primeToIdealMap m a) = 1 at ha +- rw [QuotientGroup.mk'_apply, +- QuotientGroup.eq_one_iff] at ha +- obtain ⟨p, hp, hpa⟩ := ha +- let n : idelePrimeToModulusSubgroup m := a * p⁻¹ +- have hn : n ∈ congruenceSubgroupInPrimeTo m := by +- rw [← primeToIdealMap_ker m, MonoidHom.mem_ker] +- change primeToIdealMap m (a * p⁻¹) = 1 +- rw [map_mul, map_inv, hpa] +- simp +- rw [raySubgroupInPrimeTo, Subgroup.mem_sup] +- refine ⟨n, hn, p, hp, ?_⟩ +- dsimp [n] +- group +- · intro ha +- rw [raySubgroupInPrimeTo, Subgroup.mem_sup] at ha +- obtain ⟨n, hn, p, hp, rfl⟩ := ha +- change QuotientGroup.mk' +- (principalRayIdealSubgroup m) +- (primeToIdealMap m (n * p)) = 1 +- rw [map_mul] +- have hn' : primeToIdealMap m n = 1 := +- MonoidHom.mem_ker.mp +- ((primeToIdealMap_ker m).symm ▸ hn) +- rw [hn', one_mul] +- rw [QuotientGroup.mk'_apply, +- QuotientGroup.eq_one_iff] +- exact ⟨p, hp, rfl⟩ +- +-/-- The quotient of ideles prime to the modulus by the full ray subgroup, +-identified with the ideal-theoretic ray class group. -/ +-def quotientRaySubgroupEquivIdealRayClassGroup +- (m : Modulus K) : +- idelePrimeToModulusSubgroup m ⧸ +- raySubgroupInPrimeTo m ≃* +- IdealRayClassGroup m := +- (QuotientGroup.quotientMulEquivOfEq +- (idealRayProjection_ker m).symm).trans +- (QuotientGroup.quotientKerEquivOfSurjective +- (idealRayProjection m) +- (idealRayProjection_surjective m)) +- +-/-- The quotient equivalence induced by the ideal-ray projection evaluates on +-the class of a prime-to-modulus idele as the original projection. -/ +-@[simp] +-theorem quotientRaySubgroupEquivIdealRayClassGroup_mk +- (m : Modulus K) (a : idelePrimeToModulusSubgroup m) : +- quotientRaySubgroupEquivIdealRayClassGroup m +- (QuotientGroup.mk' (raySubgroupInPrimeTo m) a) = +- idealRayProjection m a := by +- rw [quotientRaySubgroupEquivIdealRayClassGroup, +- MulEquiv.trans_apply, QuotientGroup.mk'_apply, +- QuotientGroup.quotientMulEquivOfEq_mk] +- exact QuotientGroup.kerLift_mk (idealRayProjection m) a +- +-/-! ### Simultaneous approximation at the places in a modulus -/ +- +-/-- The finite primes in `m`, together with all infinite places. -/ +-abbrev ApproximationPlace (m : Modulus K) := +- (↥m.finitePart.support) ⊕ InfinitePlace K +- +-/-- The absolute value represented by an approximation place. -/ +-abbrev approximationAbsoluteValue (m : Modulus K) : +- ApproximationPlace m → AbsoluteValue K ℝ +- | Sum.inl v => NumberField.HeightOneSpectrum.adicAbv K v.1 +- | Sum.inr w => w.1 +- +-theorem adicAbv_isNontrivial +- (v : HeightOneSpectrum (𝓞 K)) : +- (NumberField.HeightOneSpectrum.adicAbv K v).IsNontrivial := by +- obtain ⟨x, hxv, hx0⟩ := +- Submodule.exists_mem_ne_zero_of_ne_bot v.ne_bot +- refine ⟨algebraMap (𝓞 K) K x, ?_, ?_⟩ +- · exact (FaithfulSMul.algebraMap_eq_zero_iff (𝓞 K) K).not.mpr hx0 +- · apply ne_of_lt +- rw [← FinitePlace.norm_embedding] +- exact (FinitePlace.norm_lt_one_iff_mem (K := K) v x).2 hxv +- +-theorem adicAbv_not_isEquiv_of_ne +- {v w : HeightOneSpectrum (𝓞 K)} (hvw : v ≠ w) : +- ¬ (NumberField.HeightOneSpectrum.adicAbv K v).IsEquiv +- (NumberField.HeightOneSpectrum.adicAbv K w) := by +- intro h +- have hnotle : ¬ v.asIdeal ≤ w.asIdeal := by +- intro hvw_le +- have htop_le : (⊤ : Ideal (𝓞 K)) ≤ w.asIdeal := by +- rw [← (v.isCoprime_of_ne w hvw).sup_eq] +- exact sup_le hvw_le le_rfl +- exact w.isPrime.ne_top (top_unique htop_le) +- obtain ⟨x, hxv, hxw⟩ := Set.not_subset.mp hnotle +- have hvlt : +- NumberField.HeightOneSpectrum.adicAbv K v +- (algebraMap (𝓞 K) K x) < 1 := by +- rw [← FinitePlace.norm_embedding] +- exact (FinitePlace.norm_lt_one_iff_mem (K := K) v x).2 hxv +- have hweq : +- NumberField.HeightOneSpectrum.adicAbv K w +- (algebraMap (𝓞 K) K x) = 1 := by +- rw [← FinitePlace.norm_embedding] +- exact (FinitePlace.norm_eq_one_iff_notMem (K := K) w x).2 hxw +- exact (ne_of_lt hvlt) (h.eq_one_iff.mpr hweq) +- +-theorem adicAbv_not_isEquiv_infinitePlace +- (v : HeightOneSpectrum (𝓞 K)) (w : InfinitePlace K) : +- ¬ (NumberField.HeightOneSpectrum.adicAbv K v).IsEquiv w.1 := by +- intro h +- have hle : +- w.1 ((2 : ℕ) : K) ≤ 1 := +- h.le_one_iff.mp +- (NumberField.HeightOneSpectrum.adicAbv_natCast_le_one K v 2) +- have hw : +- w.1 ((2 : ℕ) : K) = (2 : ℝ) := +- NumberField.InfinitePlace.map_natCast w 2 +- have hfalse : (2 : ℝ) ≤ 1 := hw ▸ hle +- norm_num at hfalse +- +-theorem approximationAbsoluteValue_isNontrivial +- (m : Modulus K) : +- ∀ i, (approximationAbsoluteValue m i).IsNontrivial +- | Sum.inl v => by +- change +- (NumberField.HeightOneSpectrum.adicAbv K v.1).IsNontrivial +- exact adicAbv_isNontrivial v.1 +- | Sum.inr w => by +- change w.1.IsNontrivial +- exact w.isNontrivial +- +-theorem approximationAbsoluteValue_pairwise +- (m : Modulus K) : +- Pairwise fun i j => +- ¬ (approximationAbsoluteValue m i).IsEquiv +- (approximationAbsoluteValue m j) := by +- intro i j hij +- cases i with +- | inl v => +- cases j with +- | inl w => +- apply adicAbv_not_isEquiv_of_ne +- intro hvw +- apply hij +- exact congrArg Sum.inl (Subtype.ext hvw) +- | inr w => +- exact adicAbv_not_isEquiv_infinitePlace v.1 w +- | inr v => +- cases j with +- | inl w => +- exact fun h => +- adicAbv_not_isEquiv_infinitePlace w.1 v h.symm +- | inr w => +- intro h +- apply hij +- congr +- change v.1.IsEquiv w.1 at h +- exact +- (InfinitePlace.eq_iff_isEquiv (K := K)).mpr h +- +-/-- The corresponding product of local completions. -/ +-abbrev approximationCompletion (m : Modulus K) : +- ApproximationPlace m → Type _ +- | Sum.inl v => v.1.adicCompletion K +- | Sum.inr w => w.Completion +- +-noncomputable instance approximationCompletionTopologicalSpace +- (m : Modulus K) (i : ApproximationPlace m) : +- TopologicalSpace (approximationCompletion m i) := by +- cases i <;> simp only [approximationCompletion] <;> infer_instance +- +-/-- Coordinatewise completion of the valued copies of `K`. -/ +-def approximationCompletionMap (m : Modulus K) : +- ∀ i : ApproximationPlace m, +- WithAbs (approximationAbsoluteValue m i) → +- approximationCompletion m i +- | Sum.inl v => +- fun x => +- FinitePlace.embedding v.1 +- (WithAbs.equiv +- (NumberField.HeightOneSpectrum.adicAbv K v.1) x) +- | Sum.inr w => fun x => (x : w.Completion) +- +-theorem denseRange_finiteApproximationCompletionMap +- (v : HeightOneSpectrum (𝓞 K)) : +- DenseRange +- (fun x : +- WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => +- FinitePlace.embedding v +- (WithAbs.equiv +- (NumberField.HeightOneSpectrum.adicAbv K v) x)) := by +- have hrange : +- Set.range +- (fun x : +- WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => +- FinitePlace.embedding v +- (WithAbs.equiv +- (NumberField.HeightOneSpectrum.adicAbv K v) x)) = +- Set.range (algebraMap K (v.adicCompletion K)) := by +- ext y +- constructor +- · rintro ⟨x, rfl⟩ +- exact +- ⟨WithAbs.equiv +- (NumberField.HeightOneSpectrum.adicAbv K v) x, rfl⟩ +- · rintro ⟨x, rfl⟩ +- refine +- ⟨(WithAbs.equiv +- (NumberField.HeightOneSpectrum.adicAbv K v)).symm x, ?_⟩ +- rfl +- rw [DenseRange, hrange] +- exact v.denseRange_algebraMap K +- +-theorem continuous_finiteApproximationCompletionMap +- (v : HeightOneSpectrum (𝓞 K)) : +- Continuous +- (fun x : +- WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => +- FinitePlace.embedding v +- (WithAbs.equiv +- (NumberField.HeightOneSpectrum.adicAbv K v) x)) := by +- apply Isometry.continuous +- apply Isometry.of_dist_eq +- intro x y +- rw [dist_eq_norm, dist_eq_norm, ← map_sub, +- FinitePlace.norm_embedding] +- rfl +- +-theorem denseRange_approximationCompletionMap +- (m : Modulus K) : +- ∀ i, DenseRange (approximationCompletionMap m i) +- | Sum.inl v => denseRange_finiteApproximationCompletionMap v.1 +- | Sum.inr w => +- NumberField.InfinitePlace.Completion.denseRange_coe w +- +-theorem continuous_approximationCompletionMap +- (m : Modulus K) : +- ∀ i, Continuous (approximationCompletionMap m i) +- | Sum.inl v => continuous_finiteApproximationCompletionMap v.1 +- | Sum.inr w => +- NumberField.InfinitePlace.Completion.continuous_coe w +- +-/-- The diagonal embedding into the finite product of the relevant +-completions. -/ +-def approximationEmbedding (m : Modulus K) : +- K → (i : ApproximationPlace m) → approximationCompletion m i := +- (Pi.map (approximationCompletionMap m)) ∘ +- algebraMap K +- ((i : ApproximationPlace m) → +- WithAbs (approximationAbsoluteValue m i)) +- +-@[simp] +-theorem approximationEmbedding_finite +- (m : Modulus K) (x : K) (v : ↥m.finitePart.support) : +- approximationEmbedding m x (Sum.inl v) = +- FinitePlace.embedding v.1 x := +- rfl +- +-@[simp] +-theorem approximationEmbedding_infinite +- (m : Modulus K) (x : K) (w : InfinitePlace K) : +- approximationEmbedding m x (Sum.inr w) = +- (x : w.Completion) := +- rfl +- +-theorem denseRange_approximationEmbedding (m : Modulus K) : +- DenseRange (approximationEmbedding m) := by +- exact +- (DenseRange.piMap +- (denseRange_approximationCompletionMap m)).comp +- (AbsoluteValue.denseRange_algebraMap_pi +- (approximationAbsoluteValue_isNontrivial m) +- (approximationAbsoluteValue_pairwise m)) +- (.piMap (continuous_approximationCompletionMap m)) +- +-/-- The open set of field elements whose ratio with a fixed unit lies in +-a prescribed open unit set. -/ +-def unitRatioSet +- {F : Type*} [Field F] (a : Fˣ) (U : Subgroup Fˣ) : +- Set F := +- Units.val '' (fun y : Fˣ => a * y⁻¹) ⁻¹' (U : Set Fˣ) +- +-/-- The unit-ratio set associated to an open set of units is open. -/ +-theorem isOpen_unitRatioSet +- {F : Type*} [Field F] [TopologicalSpace F] +- [IsTopologicalRing F] [ContinuousInv₀ F] [T1Space F] +- (a : Fˣ) (U : Subgroup Fˣ) +- (hU : IsOpen (U : Set Fˣ)) : +- IsOpen (unitRatioSet a U) := by +- apply IsOpenUnits.isOpenEmbedding_unitsVal.isOpenMap +- exact hU.preimage (continuous_const.mul continuous_inv) +- +-/-- The value of the distinguished unit belongs to its unit-ratio set. -/ +-theorem val_mem_unitRatioSet +- {F : Type*} [Field F] (a : Fˣ) (U : Subgroup Fˣ) : +- (a : F) ∈ unitRatioSet a U := by +- exact ⟨a, by simp, rfl⟩ +- +-/-- The open local conditions that make `a / x` prime to `m`. -/ +-def approximationTarget (m : Modulus K) (a : IdeleGroup K) : +- ∀ i : ApproximationPlace m, Set (approximationCompletion m i) +- | Sum.inl v => +- unitRatioSet (a.2 v.1) +- (localHigherUnitGroup v.1 (m.finitePart v.1)) +- | Sum.inr w => +- unitRatioSet +- (ContinuousMulEquiv.piUnits a.1 w) +- (m.localInfiniteCongruenceSubgroup w) +- +-theorem isOpen_approximationTarget +- (m : Modulus K) (a : IdeleGroup K) : +- ∀ i, IsOpen (approximationTarget m a i) +- | Sum.inl v => by +- change IsOpen +- (unitRatioSet (a.2 v.1) +- (localHigherUnitGroup v.1 (m.finitePart v.1))) +- exact isOpen_unitRatioSet _ _ +- (isOpen_localHigherUnitGroup v.1 (m.finitePart v.1)) +- | Sum.inr w => by +- change IsOpen +- (unitRatioSet +- (ContinuousMulEquiv.piUnits a.1 w) +- (m.localInfiniteCongruenceSubgroup w)) +- apply isOpen_unitRatioSet _ _ +- classical +- by_cases hw : w.IsReal +- · by_cases hmem : (⟨w, hw⟩ : RealPlace K) ∈ m.infinitePart +- · rw [Modulus.localInfiniteCongruenceSubgroup, +- dite_eq_left hw, dite_eq_left hmem] +- exact isOpen_infinitePositiveSubgroup w +- · rw [Modulus.localInfiniteCongruenceSubgroup, +- dite_eq_left hw, dite_eq_right hmem] +- exact isOpen_univ +- · rw [Modulus.localInfiniteCongruenceSubgroup, dite_eq_right hw] +- exact isOpen_univ +- +-/-- The given idele itself lies in the product of its approximation +-neighborhoods. -/ +-def approximationTargetPoint +- (m : Modulus K) (a : IdeleGroup K) : +- (i : ApproximationPlace m) → approximationCompletion m i +- | Sum.inl v => (a.2 v.1 : v.1.adicCompletion K) +- | Sum.inr w => +- (ContinuousMulEquiv.piUnits a.1 w : w.Completion) +- +-theorem approximationTargetPoint_mem +- (m : Modulus K) (a : IdeleGroup K) : +- approximationTargetPoint m a ∈ +- Set.univ.pi (approximationTarget m a) := by +- intro i _hi +- cases i with +- | inl v => +- exact val_mem_unitRatioSet _ _ +- | inr w => +- exact val_mem_unitRatioSet _ _ +- + /-- Weak approximation in the precise open local cosets required by the + modulus. -/ + theorem exists_principal_quotient_mem_primeTo +diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealApproximation.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealApproximation.lean +new file mode 100644 +index 0000000..168aa31 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealApproximation.lean +@@ -0,0 +1,322 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++ ++import ClassFieldTheory.AlgebraicNumberTheory.RayClass.IdealGroups ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped NumberField WithZero Classical ++open NumberField IsDedekindDomain ++ ++noncomputable section ++ ++ ++variable {K : Type*} [Field K] [NumberField K] ++ ++namespace RayClass ++ ++/-! ### Simultaneous approximation at the places in a modulus -/ ++ ++/-- The finite primes in `m`, together with all infinite places. -/ ++abbrev ApproximationPlace (m : Modulus K) := ++ (↥m.finitePart.support) ⊕ InfinitePlace K ++ ++/-- The absolute value represented by an approximation place. -/ ++abbrev approximationAbsoluteValue (m : Modulus K) : ++ ApproximationPlace m → AbsoluteValue K ℝ ++ | Sum.inl v => NumberField.HeightOneSpectrum.adicAbv K v.1 ++ | Sum.inr w => w.1 ++ ++theorem adicAbv_isNontrivial ++ (v : HeightOneSpectrum (𝓞 K)) : ++ (NumberField.HeightOneSpectrum.adicAbv K v).IsNontrivial := by ++ obtain ⟨x, hxv, hx0⟩ := ++ Submodule.exists_mem_ne_zero_of_ne_bot v.ne_bot ++ refine ⟨algebraMap (𝓞 K) K x, ?_, ?_⟩ ++ · exact (FaithfulSMul.algebraMap_eq_zero_iff (𝓞 K) K).not.mpr hx0 ++ · apply ne_of_lt ++ rw [← FinitePlace.norm_embedding] ++ exact (FinitePlace.norm_lt_one_iff_mem (K := K) v x).2 hxv ++ ++theorem adicAbv_not_isEquiv_of_ne ++ {v w : HeightOneSpectrum (𝓞 K)} (hvw : v ≠ w) : ++ ¬ (NumberField.HeightOneSpectrum.adicAbv K v).IsEquiv ++ (NumberField.HeightOneSpectrum.adicAbv K w) := by ++ intro h ++ have hnotle : ¬ v.asIdeal ≤ w.asIdeal := by ++ intro hvw_le ++ have htop_le : (⊤ : Ideal (𝓞 K)) ≤ w.asIdeal := by ++ rw [← (v.isCoprime_of_ne w hvw).sup_eq] ++ exact sup_le hvw_le le_rfl ++ exact w.isPrime.ne_top (top_unique htop_le) ++ obtain ⟨x, hxv, hxw⟩ := Set.not_subset.mp hnotle ++ have hvlt : ++ NumberField.HeightOneSpectrum.adicAbv K v ++ (algebraMap (𝓞 K) K x) < 1 := by ++ rw [← FinitePlace.norm_embedding] ++ exact (FinitePlace.norm_lt_one_iff_mem (K := K) v x).2 hxv ++ have hweq : ++ NumberField.HeightOneSpectrum.adicAbv K w ++ (algebraMap (𝓞 K) K x) = 1 := by ++ rw [← FinitePlace.norm_embedding] ++ exact (FinitePlace.norm_eq_one_iff_notMem (K := K) w x).2 hxw ++ exact (ne_of_lt hvlt) (h.eq_one_iff.mpr hweq) ++ ++theorem adicAbv_not_isEquiv_infinitePlace ++ (v : HeightOneSpectrum (𝓞 K)) (w : InfinitePlace K) : ++ ¬ (NumberField.HeightOneSpectrum.adicAbv K v).IsEquiv w.1 := by ++ intro h ++ have hle : ++ w.1 ((2 : ℕ) : K) ≤ 1 := ++ h.le_one_iff.mp ++ (NumberField.HeightOneSpectrum.adicAbv_natCast_le_one K v 2) ++ have hw : ++ w.1 ((2 : ℕ) : K) = (2 : ℝ) := ++ NumberField.InfinitePlace.map_natCast w 2 ++ have hfalse : (2 : ℝ) ≤ 1 := hw ▸ hle ++ norm_num at hfalse ++ ++theorem approximationAbsoluteValue_isNontrivial ++ (m : Modulus K) : ++ ∀ i, (approximationAbsoluteValue m i).IsNontrivial ++ | Sum.inl v => by ++ change ++ (NumberField.HeightOneSpectrum.adicAbv K v.1).IsNontrivial ++ exact adicAbv_isNontrivial v.1 ++ | Sum.inr w => by ++ change w.1.IsNontrivial ++ exact w.isNontrivial ++ ++theorem approximationAbsoluteValue_pairwise ++ (m : Modulus K) : ++ Pairwise fun i j => ++ ¬ (approximationAbsoluteValue m i).IsEquiv ++ (approximationAbsoluteValue m j) := by ++ intro i j hij ++ cases i with ++ | inl v => ++ cases j with ++ | inl w => ++ apply adicAbv_not_isEquiv_of_ne ++ intro hvw ++ apply hij ++ exact congrArg Sum.inl (Subtype.ext hvw) ++ | inr w => ++ exact adicAbv_not_isEquiv_infinitePlace v.1 w ++ | inr v => ++ cases j with ++ | inl w => ++ exact fun h => ++ adicAbv_not_isEquiv_infinitePlace w.1 v h.symm ++ | inr w => ++ intro h ++ apply hij ++ congr ++ change v.1.IsEquiv w.1 at h ++ exact ++ (InfinitePlace.eq_iff_isEquiv (K := K)).mpr h ++ ++/-- The corresponding product of local completions. -/ ++abbrev approximationCompletion (m : Modulus K) : ++ ApproximationPlace m → Type _ ++ | Sum.inl v => v.1.adicCompletion K ++ | Sum.inr w => w.Completion ++ ++noncomputable instance approximationCompletionTopologicalSpace ++ (m : Modulus K) (i : ApproximationPlace m) : ++ TopologicalSpace (approximationCompletion m i) := by ++ cases i <;> simp only [approximationCompletion] <;> infer_instance ++ ++/-- Coordinatewise completion of the valued copies of `K`. -/ ++def approximationCompletionMap (m : Modulus K) : ++ ∀ i : ApproximationPlace m, ++ WithAbs (approximationAbsoluteValue m i) → ++ approximationCompletion m i ++ | Sum.inl v => ++ fun x => ++ FinitePlace.embedding v.1 ++ (WithAbs.equiv ++ (NumberField.HeightOneSpectrum.adicAbv K v.1) x) ++ | Sum.inr w => fun x => (x : w.Completion) ++ ++theorem denseRange_finiteApproximationCompletionMap ++ (v : HeightOneSpectrum (𝓞 K)) : ++ DenseRange ++ (fun x : ++ WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => ++ FinitePlace.embedding v ++ (WithAbs.equiv ++ (NumberField.HeightOneSpectrum.adicAbv K v) x)) := by ++ have hrange : ++ Set.range ++ (fun x : ++ WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => ++ FinitePlace.embedding v ++ (WithAbs.equiv ++ (NumberField.HeightOneSpectrum.adicAbv K v) x)) = ++ Set.range (algebraMap K (v.adicCompletion K)) := by ++ ext y ++ constructor ++ · rintro ⟨x, rfl⟩ ++ exact ++ ⟨WithAbs.equiv ++ (NumberField.HeightOneSpectrum.adicAbv K v) x, rfl⟩ ++ · rintro ⟨x, rfl⟩ ++ refine ++ ⟨(WithAbs.equiv ++ (NumberField.HeightOneSpectrum.adicAbv K v)).symm x, ?_⟩ ++ rfl ++ rw [DenseRange, hrange] ++ exact v.denseRange_algebraMap K ++ ++theorem continuous_finiteApproximationCompletionMap ++ (v : HeightOneSpectrum (𝓞 K)) : ++ Continuous ++ (fun x : ++ WithAbs (NumberField.HeightOneSpectrum.adicAbv K v) => ++ FinitePlace.embedding v ++ (WithAbs.equiv ++ (NumberField.HeightOneSpectrum.adicAbv K v) x)) := by ++ apply Isometry.continuous ++ apply Isometry.of_dist_eq ++ intro x y ++ rw [dist_eq_norm, dist_eq_norm, ← map_sub, ++ FinitePlace.norm_embedding] ++ rfl ++ ++theorem denseRange_approximationCompletionMap ++ (m : Modulus K) : ++ ∀ i, DenseRange (approximationCompletionMap m i) ++ | Sum.inl v => denseRange_finiteApproximationCompletionMap v.1 ++ | Sum.inr w => ++ NumberField.InfinitePlace.Completion.denseRange_coe w ++ ++theorem continuous_approximationCompletionMap ++ (m : Modulus K) : ++ ∀ i, Continuous (approximationCompletionMap m i) ++ | Sum.inl v => continuous_finiteApproximationCompletionMap v.1 ++ | Sum.inr w => ++ NumberField.InfinitePlace.Completion.continuous_coe w ++ ++/-- The diagonal embedding into the finite product of the relevant ++completions. -/ ++def approximationEmbedding (m : Modulus K) : ++ K → (i : ApproximationPlace m) → approximationCompletion m i := ++ (Pi.map (approximationCompletionMap m)) ∘ ++ algebraMap K ++ ((i : ApproximationPlace m) → ++ WithAbs (approximationAbsoluteValue m i)) ++ ++@[simp] ++theorem approximationEmbedding_finite ++ (m : Modulus K) (x : K) (v : ↥m.finitePart.support) : ++ approximationEmbedding m x (Sum.inl v) = ++ FinitePlace.embedding v.1 x := ++ rfl ++ ++@[simp] ++theorem approximationEmbedding_infinite ++ (m : Modulus K) (x : K) (w : InfinitePlace K) : ++ approximationEmbedding m x (Sum.inr w) = ++ (x : w.Completion) := ++ rfl ++ ++theorem denseRange_approximationEmbedding (m : Modulus K) : ++ DenseRange (approximationEmbedding m) := by ++ exact ++ (DenseRange.piMap ++ (denseRange_approximationCompletionMap m)).comp ++ (AbsoluteValue.denseRange_algebraMap_pi ++ (approximationAbsoluteValue_isNontrivial m) ++ (approximationAbsoluteValue_pairwise m)) ++ (.piMap (continuous_approximationCompletionMap m)) ++ ++/-- The open set of field elements whose ratio with a fixed unit lies in ++a prescribed open unit set. -/ ++def unitRatioSet ++ {F : Type*} [Field F] (a : Fˣ) (U : Subgroup Fˣ) : ++ Set F := ++ Units.val '' (fun y : Fˣ => a * y⁻¹) ⁻¹' (U : Set Fˣ) ++ ++/-- The unit-ratio set associated to an open set of units is open. -/ ++theorem isOpen_unitRatioSet ++ {F : Type*} [Field F] [TopologicalSpace F] ++ [IsTopologicalRing F] [ContinuousInv₀ F] [T1Space F] ++ (a : Fˣ) (U : Subgroup Fˣ) ++ (hU : IsOpen (U : Set Fˣ)) : ++ IsOpen (unitRatioSet a U) := by ++ apply IsOpenUnits.isOpenEmbedding_unitsVal.isOpenMap ++ exact hU.preimage (continuous_const.mul continuous_inv) ++ ++/-- The value of the distinguished unit belongs to its unit-ratio set. -/ ++theorem val_mem_unitRatioSet ++ {F : Type*} [Field F] (a : Fˣ) (U : Subgroup Fˣ) : ++ (a : F) ∈ unitRatioSet a U := by ++ exact ⟨a, by simp, rfl⟩ ++ ++/-- The open local conditions that make `a / x` prime to `m`. -/ ++def approximationTarget (m : Modulus K) (a : IdeleGroup K) : ++ ∀ i : ApproximationPlace m, Set (approximationCompletion m i) ++ | Sum.inl v => ++ unitRatioSet (a.2 v.1) ++ (localHigherUnitGroup v.1 (m.finitePart v.1)) ++ | Sum.inr w => ++ unitRatioSet ++ (ContinuousMulEquiv.piUnits a.1 w) ++ (m.localInfiniteCongruenceSubgroup w) ++ ++theorem isOpen_approximationTarget ++ (m : Modulus K) (a : IdeleGroup K) : ++ ∀ i, IsOpen (approximationTarget m a i) ++ | Sum.inl v => by ++ change IsOpen ++ (unitRatioSet (a.2 v.1) ++ (localHigherUnitGroup v.1 (m.finitePart v.1))) ++ exact isOpen_unitRatioSet _ _ ++ (isOpen_localHigherUnitGroup v.1 (m.finitePart v.1)) ++ | Sum.inr w => by ++ change IsOpen ++ (unitRatioSet ++ (ContinuousMulEquiv.piUnits a.1 w) ++ (m.localInfiniteCongruenceSubgroup w)) ++ apply isOpen_unitRatioSet _ _ ++ classical ++ by_cases hw : w.IsReal ++ · by_cases hmem : (⟨w, hw⟩ : RealPlace K) ∈ m.infinitePart ++ · rw [Modulus.localInfiniteCongruenceSubgroup, ++ dite_eq_left hw, dite_eq_left hmem] ++ exact isOpen_infinitePositiveSubgroup w ++ · rw [Modulus.localInfiniteCongruenceSubgroup, ++ dite_eq_left hw, dite_eq_right hmem] ++ exact isOpen_univ ++ · rw [Modulus.localInfiniteCongruenceSubgroup, dite_eq_right hw] ++ exact isOpen_univ ++ ++/-- The given idele itself lies in the product of its approximation ++neighborhoods. -/ ++def approximationTargetPoint ++ (m : Modulus K) (a : IdeleGroup K) : ++ (i : ApproximationPlace m) → approximationCompletion m i ++ | Sum.inl v => (a.2 v.1 : v.1.adicCompletion K) ++ | Sum.inr w => ++ (ContinuousMulEquiv.piUnits a.1 w : w.Completion) ++ ++theorem approximationTargetPoint_mem ++ (m : Modulus K) (a : IdeleGroup K) : ++ approximationTargetPoint m a ∈ ++ Set.univ.pi (approximationTarget m a) := by ++ intro i _hi ++ cases i with ++ | inl v => ++ exact val_mem_unitRatioSet _ _ ++ | inr w => ++ exact val_mem_unitRatioSet _ _ ++ ++ ++end RayClass +diff --git a/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealGroups.lean b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealGroups.lean +new file mode 100644 +index 0000000..2b15f82 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/AlgebraicNumberTheory/RayClass/IdealGroups.lean +@@ -0,0 +1,417 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Topology ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.LocallyCompact ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.PrincipalNorm ++import ValuedFieldTheory.Valuation.AbsoluteValue.Theory.AbsoluteValues ++import Mathlib.NumberTheory.NumberField.Completion.InfinitePlace ++import Mathlib.Topology.Algebra.IsOpenUnits ++import Mathlib.Topology.Algebra.Ring.Compact ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped NumberField WithZero Classical ++open NumberField IsDedekindDomain ++ ++noncomputable section ++ ++ ++variable {K : Type*} [Field K] [NumberField K] ++ ++namespace RayClass ++ ++/-- Fractional ideals having valuation zero at every finite prime in the ++support of the modulus. -/ ++def primeToModulusIdeals (m : Modulus K) : ++ Subgroup (FractionalIdealGroup K) where ++ carrier := {I | ∀ v, v ∈ m.finitePart.support → ++ FractionalIdeal.count K v ++ (I : FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0} ++ one_mem' v _ := FractionalIdeal.count_one K v ++ mul_mem' {I J} hI hJ v hv := by ++ rw [Units.val_mul, ++ FractionalIdeal.count_mul K v (Units.ne_zero I) (Units.ne_zero J), ++ hI v hv, hJ v hv, add_zero] ++ inv_mem' {I} hI v hv := by ++ rw [Units.val_inv_eq_inv_val, FractionalIdeal.count_inv K v, ++ hI v hv, neg_zero] ++ ++@[simp] ++theorem mem_primeToModulusIdeals_iff ++ (m : Modulus K) (I : FractionalIdealGroup K) : ++ I ∈ primeToModulusIdeals m ↔ ++ ∀ v, v ∈ m.finitePart.support → ++ FractionalIdeal.count K v ++ (I : FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0 := ++ Iff.rfl ++ ++/-- A finite prime outside the support of `m`, regarded as an element of ++the group of fractional ideals prime to `m`. -/ ++def primeToModulusIdeal ++ (m : Modulus K) ++ (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ m.finitePart.support) : ++ primeToModulusIdeals m := ++ ⟨FractionalIdealGroup.prime v, by ++ intro w hw ++ have hwv : w ≠ v := by ++ intro h ++ exact hv (h ▸ hw) ++ change ++ FractionalIdeal.count K w ++ (v.asIdeal : ++ FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = ++ 0 ++ exact ++ FractionalIdeal.count_maximal_coprime ++ K w hwv.symm⟩ ++ ++/-- Coercing a prime outside the modulus support recovers its prime ++fractional ideal. -/ ++@[simp] ++theorem primeToModulusIdeal_coe ++ (m : Modulus K) ++ (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ m.finitePart.support) : ++ (primeToModulusIdeal m v hv : ++ FractionalIdealGroup K) = ++ FractionalIdealGroup.prime v := ++ rfl ++ ++/-- Finite ideles satisfying the higher-unit condition at every prime in ++the support of the modulus. -/ ++def finitePrimeToModulusSubgroup (m : Modulus K) : ++ Subgroup (FiniteIdeleGroup K) where ++ carrier := {a | ∀ v, v ∈ m.finitePart.support → ++ a v ∈ localHigherUnitGroup v (m.finitePart v)} ++ one_mem' v _ := (localHigherUnitGroup v (m.finitePart v)).one_mem ++ mul_mem' ha hb v hv := ++ (localHigherUnitGroup v (m.finitePart v)).mul_mem (ha v hv) (hb v hv) ++ inv_mem' ha v hv := ++ (localHigherUnitGroup v (m.finitePart v)).inv_mem (ha v hv) ++ ++/-- Ideles satisfying the infinite positivity and finite higher-unit ++conditions of a modulus. -/ ++def idelePrimeToModulusSubgroup (m : Modulus K) : ++ Subgroup (IdeleGroup K) := ++ m.infiniteCongruenceSubgroup.prod ++ (finitePrimeToModulusSubgroup m) ++ ++theorem localHigherUnitGroup_le_integralUnits ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ) : ++ localHigherUnitGroup v n ≤ ++ (v.adicCompletionIntegers K).units := by ++ intro x hx ++ rw [mem_localHigherUnitGroup_iff] at hx ++ obtain ⟨y, rfl, _⟩ := hx ++ exact y.property ++ ++theorem fractionalIdeal_mem_primeToModulusIdeals ++ (m : Modulus K) (a : IdeleGroup K) ++ (ha : a ∈ idelePrimeToModulusSubgroup m) : ++ IdeleGroup.fractionalIdeal a ∈ primeToModulusIdeals m := by ++ intro v hv ++ change FractionalIdeal.count K v ++ (((FractionalIdealGroup.factorization (K := K)) ++ (FiniteIdeleGroup.valuationVector a.2) : ++ FractionalIdealGroup K) : ++ FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = 0 ++ rw [FractionalIdealGroup.count_factorization, ++ FiniteIdeleGroup.valuationVector_apply] ++ apply (FiniteIdeleGroup.localOrder_eq_zero_iff v (a.2 v)).2 ++ exact localHigherUnitGroup_le_integralUnits v (m.finitePart v) (ha.2 v hv) ++ ++/-- The fractional-ideal map restricted to ideles prime to a modulus. -/ ++def primeToIdealMap (m : Modulus K) : ++ idelePrimeToModulusSubgroup m →* ++ primeToModulusIdeals m where ++ toFun a := ++ ⟨IdeleGroup.fractionalIdeal a, ++ fractionalIdeal_mem_primeToModulusIdeals m a a.property⟩ ++ map_one' := by ++ apply Subtype.ext ++ exact map_one _ ++ map_mul' a b := by ++ apply Subtype.ext ++ exact map_mul _ _ _ ++ ++/-- A finite idele with a prescribed valuation vector away from the ++support of a modulus and value one on its support. -/ ++def valuationVectorSectionPrimeTo ++ (m : Modulus K) ++ (e : HeightOneSpectrum (𝓞 K) →₀ ℤ) : ++ FiniteIdeleGroup K := ++ ⟨fun v => ++ if v ∈ m.finitePart.support then 1 ++ else FiniteIdeleGroup.chosenLocalOrderSection v (e v), by ++ filter_upwards ++ [m.finitePart.support.eventually_cofinite_notMem, ++ e.support.eventually_cofinite_notMem] with v hvm he ++ simp only [hvm, ↓reduceIte] ++ apply (FiniteIdeleGroup.localOrder_eq_zero_iff v _).1 ++ rw [FiniteIdeleGroup.localOrder_chosenLocalOrderSection, ++ Finsupp.notMem_support_iff.mp he]⟩ ++ ++theorem valuationVector_valuationVectorSectionPrimeTo ++ (m : Modulus K) ++ (e : HeightOneSpectrum (𝓞 K) →₀ ℤ) ++ (he : ∀ v, v ∈ m.finitePart.support → e v = 0) : ++ FiniteIdeleGroup.valuationVector ++ (valuationVectorSectionPrimeTo m e) = ++ Multiplicative.ofAdd e := by ++ apply Multiplicative.ext ++ ext v ++ rw [FiniteIdeleGroup.valuationVector_apply] ++ by_cases hv : v ∈ m.finitePart.support ++ · change ++ (FiniteIdeleGroup.localOrder v ++ (if v ∈ m.finitePart.support then 1 ++ else FiniteIdeleGroup.chosenLocalOrderSection v (e v))).toAdd = ++ e v ++ rw [ite_eq_left hv, map_one] ++ exact (he v hv).symm ++ · change ++ (FiniteIdeleGroup.localOrder v ++ (if v ∈ m.finitePart.support then 1 ++ else FiniteIdeleGroup.chosenLocalOrderSection v (e v))).toAdd = ++ e v ++ rw [ite_eq_right hv, ++ FiniteIdeleGroup.localOrder_chosenLocalOrderSection] ++ ++theorem primeToIdealMap_surjective (m : Modulus K) : ++ Function.Surjective (primeToIdealMap m) := by ++ intro I ++ let e : HeightOneSpectrum (𝓞 K) →₀ ℤ := ++ FractionalIdealGroup.countVector (I : FractionalIdealGroup K) ++ have he : ∀ v, v ∈ m.finitePart.support → e v = 0 := by ++ intro v hv ++ exact I.property v hv ++ let a : IdeleGroup K := ++ (1, valuationVectorSectionPrimeTo m e) ++ have ha : a ∈ idelePrimeToModulusSubgroup m := by ++ constructor ++ · exact m.infiniteCongruenceSubgroup.one_mem ++ · intro v hv ++ change ++ (if v ∈ m.finitePart.support then 1 ++ else FiniteIdeleGroup.chosenLocalOrderSection v (e v)) ∈ ++ localHigherUnitGroup v (m.finitePart v) ++ rw [ite_eq_left hv] ++ exact (localHigherUnitGroup v (m.finitePart v)).one_mem ++ refine ⟨⟨a, ha⟩, ?_⟩ ++ apply Subtype.ext ++ apply FractionalIdealGroup.ext_count ++ intro v ++ change FractionalIdeal.count K v ++ (((FractionalIdealGroup.factorization (K := K)) ++ (FiniteIdeleGroup.valuationVector ++ (valuationVectorSectionPrimeTo m e)) : ++ FractionalIdealGroup K) : ++ FractionalIdeal (nonZeroDivisors (𝓞 K)) K) = ++ FractionalIdeal.count K v ++ ((I : FractionalIdealGroup K) : ++ FractionalIdeal (nonZeroDivisors (𝓞 K)) K) ++ rw [valuationVector_valuationVectorSectionPrimeTo m e he, ++ FractionalIdealGroup.count_factorization] ++ exact FractionalIdealGroup.countVector_apply I v ++ ++theorem ideleCongruenceSubgroup_le_primeTo ++ (m : Modulus K) : ++ m.ideleCongruenceSubgroup ≤ ++ idelePrimeToModulusSubgroup m := by ++ intro a ha ++ exact ⟨ha.1, fun v _ => ha.2 v⟩ ++ ++/-- The congruence subgroup, viewed inside the subgroup of ideles prime ++to the modulus. -/ ++def congruenceSubgroupInPrimeTo (m : Modulus K) : ++ Subgroup (idelePrimeToModulusSubgroup m) := ++ m.ideleCongruenceSubgroup.subgroupOf ++ (idelePrimeToModulusSubgroup m) ++ ++theorem primeToIdealMap_ker (m : Modulus K) : ++ (primeToIdealMap m).ker = ++ congruenceSubgroupInPrimeTo m := by ++ ext a ++ constructor ++ · intro ha ++ have hintegral : ++ (a : IdeleGroup K) ∈ ++ IdeleGroup.integralAtFinitePlaces (K := K) := by ++ rw [← IdeleGroup.fractionalIdeal_ker, ++ MonoidHom.mem_ker] ++ exact congrArg Subtype.val ++ (MonoidHom.mem_ker.mp ha) ++ constructor ++ · exact a.property.1 ++ · intro v ++ by_cases hv : v ∈ m.finitePart.support ++ · exact a.property.2 v hv ++ · rw [Finsupp.notMem_support_iff.mp hv, ++ localHigherUnitGroup_zero] ++ exact hintegral v ++ · intro ha ++ apply MonoidHom.mem_ker.mpr ++ apply Subtype.ext ++ change IdeleGroup.fractionalIdeal (a : IdeleGroup K) = 1 ++ rw [← MonoidHom.mem_ker, ++ IdeleGroup.fractionalIdeal_ker] ++ intro v ++ exact localHigherUnitGroup_le_integralUnits v (m.finitePart v) (ha.2 v) ++ ++/-- The quotient of ideles prime to a modulus by the congruence subgroup, ++identified with fractional ideals prime to the modulus. -/ ++def quotientCongruenceEquivPrimeToIdeals (m : Modulus K) : ++ idelePrimeToModulusSubgroup m ⧸ ++ congruenceSubgroupInPrimeTo m ≃* ++ primeToModulusIdeals m := by ++ rw [← primeToIdealMap_ker m] ++ exact QuotientGroup.quotientKerEquivOfSurjective ++ (primeToIdealMap m) (primeToIdealMap_surjective m) ++ ++/-- Principal ideles satisfying the modulus conditions, considered inside ++`I_K^(m)`. -/ ++def principalSubgroupInPrimeTo (m : Modulus K) : ++ Subgroup (idelePrimeToModulusSubgroup m) := ++ Subgroup.comap (idelePrimeToModulusSubgroup m).subtype ++ (IdeleGroup.principalSubgroup K) ++ ++/-- Principal ideals generated by a totally positive element congruent to ++one modulo the finite modulus. -/ ++def principalRayIdealSubgroup (m : Modulus K) : ++ Subgroup (primeToModulusIdeals m) := ++ Subgroup.map (primeToIdealMap m) ++ (principalSubgroupInPrimeTo m) ++ ++theorem mem_principalRayIdealSubgroup_iff ++ (m : Modulus K) (I : primeToModulusIdeals m) : ++ I ∈ principalRayIdealSubgroup m ↔ ++ ∃ x : Kˣ, ++ ∃ _hx : IdeleGroup.principalIdele K x ∈ ++ idelePrimeToModulusSubgroup m, ++ toPrincipalIdeal (𝓞 K) K x = ++ (I : FractionalIdealGroup K) := by ++ constructor ++ · rintro ⟨a, ha, hmap⟩ ++ obtain ⟨x, hx⟩ := ha ++ refine ⟨x, ?_, ?_⟩ ++ · rw [hx] ++ exact a.property ++ · have hval := congrArg Subtype.val hmap ++ change IdeleGroup.fractionalIdeal (a : IdeleGroup K) = ++ (I : FractionalIdealGroup K) at hval ++ rw [← IdeleGroup.fractionalIdeal_principalIdele] ++ exact (congrArg (IdeleGroup.fractionalIdeal (K := K)) hx).trans hval ++ · rintro ⟨x, hx, hideal⟩ ++ let a : idelePrimeToModulusSubgroup m := ++ ⟨IdeleGroup.principalIdele K x, hx⟩ ++ have ha : a ∈ principalSubgroupInPrimeTo m := by ++ change IdeleGroup.principalIdele K x ∈ ++ IdeleGroup.principalSubgroup K ++ exact ⟨x, rfl⟩ ++ refine ⟨a, ha, ?_⟩ ++ apply Subtype.ext ++ change IdeleGroup.fractionalIdeal ++ (IdeleGroup.principalIdele K x) = ++ (I : FractionalIdealGroup K) ++ rw [IdeleGroup.fractionalIdeal_principalIdele, hideal] ++ ++/-- The ideal-theoretic ray class group `J_K^m / P_K^m`. -/ ++abbrev IdealRayClassGroup (m : Modulus K) := ++ primeToModulusIdeals m ⧸ principalRayIdealSubgroup m ++ ++/-- The canonical projection from ideles prime to the modulus to the ++ideal-theoretic ray class group. -/ ++def idealRayProjection (m : Modulus K) : ++ idelePrimeToModulusSubgroup m →* ++ IdealRayClassGroup m := ++ (QuotientGroup.mk' (principalRayIdealSubgroup m)).comp ++ (primeToIdealMap m) ++ ++/-- The subgroup generated by congruence ideles and principal ideles ++inside the ideles prime to a modulus. -/ ++def raySubgroupInPrimeTo (m : Modulus K) : ++ Subgroup (idelePrimeToModulusSubgroup m) := ++ congruenceSubgroupInPrimeTo m ⊔ ++ principalSubgroupInPrimeTo m ++ ++theorem idealRayProjection_surjective (m : Modulus K) : ++ Function.Surjective (idealRayProjection m) := by ++ intro c ++ obtain ⟨I, rfl⟩ := ++ QuotientGroup.mk'_surjective ++ (principalRayIdealSubgroup m) c ++ obtain ⟨a, rfl⟩ := primeToIdealMap_surjective m I ++ exact ⟨a, rfl⟩ ++ ++theorem idealRayProjection_ker (m : Modulus K) : ++ (idealRayProjection m).ker = ++ raySubgroupInPrimeTo m := by ++ ext a ++ constructor ++ · intro ha ++ change QuotientGroup.mk' ++ (principalRayIdealSubgroup m) ++ (primeToIdealMap m a) = 1 at ha ++ rw [QuotientGroup.mk'_apply, ++ QuotientGroup.eq_one_iff] at ha ++ obtain ⟨p, hp, hpa⟩ := ha ++ let n : idelePrimeToModulusSubgroup m := a * p⁻¹ ++ have hn : n ∈ congruenceSubgroupInPrimeTo m := by ++ rw [← primeToIdealMap_ker m, MonoidHom.mem_ker] ++ change primeToIdealMap m (a * p⁻¹) = 1 ++ rw [map_mul, map_inv, hpa] ++ simp ++ rw [raySubgroupInPrimeTo, Subgroup.mem_sup] ++ refine ⟨n, hn, p, hp, ?_⟩ ++ dsimp [n] ++ group ++ · intro ha ++ rw [raySubgroupInPrimeTo, Subgroup.mem_sup] at ha ++ obtain ⟨n, hn, p, hp, rfl⟩ := ha ++ change QuotientGroup.mk' ++ (principalRayIdealSubgroup m) ++ (primeToIdealMap m (n * p)) = 1 ++ rw [map_mul] ++ have hn' : primeToIdealMap m n = 1 := ++ MonoidHom.mem_ker.mp ++ ((primeToIdealMap_ker m).symm ▸ hn) ++ rw [hn', one_mul] ++ rw [QuotientGroup.mk'_apply, ++ QuotientGroup.eq_one_iff] ++ exact ⟨p, hp, rfl⟩ ++ ++/-- The quotient of ideles prime to the modulus by the full ray subgroup, ++identified with the ideal-theoretic ray class group. -/ ++def quotientRaySubgroupEquivIdealRayClassGroup ++ (m : Modulus K) : ++ idelePrimeToModulusSubgroup m ⧸ ++ raySubgroupInPrimeTo m ≃* ++ IdealRayClassGroup m := ++ (QuotientGroup.quotientMulEquivOfEq ++ (idealRayProjection_ker m).symm).trans ++ (QuotientGroup.quotientKerEquivOfSurjective ++ (idealRayProjection m) ++ (idealRayProjection_surjective m)) ++ ++/-- The quotient equivalence induced by the ideal-ray projection evaluates on ++the class of a prime-to-modulus idele as the original projection. -/ ++@[simp] ++theorem quotientRaySubgroupEquivIdealRayClassGroup_mk ++ (m : Modulus K) (a : idelePrimeToModulusSubgroup m) : ++ quotientRaySubgroupEquivIdealRayClassGroup m ++ (QuotientGroup.mk' (raySubgroupInPrimeTo m) a) = ++ idealRayProjection m a := by ++ rw [quotientRaySubgroupEquivIdealRayClassGroup, ++ MulEquiv.trans_apply, QuotientGroup.mk'_apply, ++ QuotientGroup.quotientMulEquivOfEq_mk] ++ exact QuotientGroup.kerLift_mk (idealRayProjection m) a ++ ++ ++end RayClass +diff --git a/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassIdealModulusProjection.lean b/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassIdealModulusProjection.lean +index e37e3df..415463a 100644 +--- a/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassIdealModulusProjection.lean ++++ b/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassIdealModulusProjection.lean +@@ -90,7 +90,7 @@ private theorem rayCongruent_of_le + · intro v hv + exact hx.2 v (hmn.2 hv) + +-private theorem rayPrimeToIdeals_antitone ++theorem rayPrimeToIdeals_antitone + {K : Type u} [Field K] [NumberField K] + {m n : RayClassModulus K} (hmn : m ≤ n) : + rayClassPrimeToIdeals n ≤ rayClassPrimeToIdeals m := by +diff --git a/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassOfFinitePrime.lean b/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassOfFinitePrime.lean +index a3e9746..d8d3db5 100644 +--- a/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassOfFinitePrime.lean ++++ b/Lean4/ClassFieldTheory/Definitions/ConductorsAndRayClassFields/RayClassOfFinitePrime.lean +@@ -9,6 +9,7 @@ import ClassFieldTheory.Definitions.ConductorsAndRayClassFields.OrdinaryRayClass + import ClassFieldTheory.Definitions.ConductorsAndRayClassFields.RayClassGroup + import ClassFieldTheory.Definitions.FrobeniusAndHilbertClassFields.FinitePrimeFractionalIdeal + ++ + set_option autoImplicit false + + /-! +@@ -24,7 +25,7 @@ namespace ClassFieldTheory + + universe u + +-private lemma finitePrimeFractionalIdeal_mem_primeTo ++lemma finitePrimeFractionalIdeal_mem_primeTo + {K : Type u} [Field K] [NumberField K] + (m : RayClassModulus K) + (v : HeightOneSpectrum (𝓞 K)) +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocity.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocity.lean +index 053f2b7..e213e03 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocity.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocity.lean +@@ -4,158 +4,18 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.RayClassFieldRealization +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.ArithmeticNormalization ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ArithmeticRayClassFieldReciprocityNormResidue + + set_option autoImplicit false +- +-/-! +-# Arithmetic reciprocity for actual ray class fields +- +-This is the canonical topological isomorphism +-`Gal(Kᵐ/K) ≃ₜ* C_K/C_Kᵐ` with arithmetic Frobenius +-normalization. It uses the actual selected ray class field, its exact +-idèle norm range, the finite Krull topology, and the native ray-class +-quotient topology. +--/ +- + open scoped Classical NumberField +- + noncomputable section +- + namespace GlobalClassFieldTheory + namespace GlobalClassFields +- + open NumberField + open Reciprocity +- +-private theorem arithmeticRayClassIdeleClassGroupIsMulCommutative +- {F : Type} [Field F] [NumberField F] : +- IsMulCommutative (IdeleClassGroup F) := +- ⟨⟨fun a b => mul_comm a b⟩⟩ +- + attribute [local instance] arithmeticRayClassIdeleClassGroupIsMulCommutative +- + variable {K : Type} [Field K] [NumberField K] + +-/-- Arithmetic reciprocity followed by transport between equal norm +-quotients sends a norm-residue symbol to its represented quotient class. -/ +-private theorem +- arithmeticReciprocity_quotientMulEquivOfEq_globalNormResidue +- {F E : Type} [Field F] [NumberField F] +- [Field E] [NumberField E] [Algebra F E] +- [FiniteDimensional F E] [IsAbelianGalois F E] +- (H : Subgroup (IdeleClassGroup F)) +- (h : (_root_.ideleClassNorm F E).range = H) +- (c : IdeleClassGroup F) : +- QuotientGroup.quotientMulEquivOfEq h +- (arithmeticGlobalReciprocityContinuousMulEquiv F E +- (arithmeticGlobalNormResidueMonoidHom F E c)) = +- QuotientGroup.mk' H c := by +- let e := arithmeticGlobalReciprocityContinuousMulEquiv F E +- let q := +- QuotientGroup.mk' +- (_root_.ideleClassNorm F E).range c +- have hsymm : +- e.symm q = arithmeticGlobalNormResidueMonoidHom F E c := +- arithmeticGlobalReciprocityContinuousMulEquiv_symm_mk F E c +- have he : +- e (arithmeticGlobalNormResidueMonoidHom F E c) = q := by +- calc +- e (arithmeticGlobalNormResidueMonoidHom F E c) = +- e (e.symm q) := +- congrArg (fun σ => e σ) hsymm.symm +- _ = q := e.apply_symm_apply q +- calc +- QuotientGroup.quotientMulEquivOfEq h +- (arithmeticGlobalReciprocityContinuousMulEquiv F E +- (arithmeticGlobalNormResidueMonoidHom F E c)) = +- QuotientGroup.quotientMulEquivOfEq h q := +- congrArg (fun x => QuotientGroup.quotientMulEquivOfEq h x) he +- _ = QuotientGroup.mk' H c := +- QuotientGroup.quotientMulEquivOfEq_mk h c +- +-/-- Arithmetic global reciprocity for the actual selected ray class +-field, bundled with both native topologies. -/ +-noncomputable def +- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup +- (m : RayClass.Modulus K) : +- Gal((rayClassField K m) / K) ≃ₜ* +- RayClass.RayClassGroup m := by +- letI normQuotientDiscreteTopology : DiscreteTopology +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm +- K (rayClassField K m)).range) := +- ideleClassNormQuotient_discreteTopology +- K (rayClassField K m) +- letI rayClassGroupDiscreteTopology : DiscreteTopology +- (RayClass.RayClassGroup m) := +- QuotientGroup.discreteTopology +- (RayClass.isOpen_congruenceSubgroup m) +- let quotientTransport : +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm +- K (rayClassField K m)).range) ≃ₜ* +- RayClass.RayClassGroup m := +- { QuotientGroup.quotientMulEquivOfEq +- (rayClassField_ideleClassNorm_range_over_original +- (K := K) m) with +- continuous_toFun := continuous_of_discreteTopology +- continuous_invFun := continuous_of_discreteTopology } +- exact +- (arithmeticGlobalReciprocityContinuousMulEquiv +- K (rayClassField K m)).trans +- quotientTransport +- +-/-- Pointwise evaluation of arithmetic ray-class reciprocity separates +-global reciprocity from the transport between the equal norm quotients. -/ +-private theorem +- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_apply +- (m : RayClass.Modulus K) +- (σ : Gal((rayClassField K m) / K)) : +- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup +- (K := K) m σ = +- QuotientGroup.quotientMulEquivOfEq +- (rayClassField_ideleClassNorm_range_over_original +- (K := K) m) +- (arithmeticGlobalReciprocityContinuousMulEquiv +- K (rayClassField K m) σ) := by +- rfl +- +-/-- Arithmetic ray-class reciprocity sends the arithmetic global +-norm-residue symbol of an idèle class to its literal ray class. -/ +-@[simp] +-theorem +- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_globalNormResidue +- (m : RayClass.Modulus K) +- (c : IdeleClassGroup K) : +- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup +- (K := K) m +- (arithmeticGlobalNormResidueMonoidHom +- K (rayClassField K m) c) = +- QuotientGroup.mk' +- (RayClass.Modulus.congruenceSubgroup m) c := by +- calc +- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup +- (K := K) m +- (arithmeticGlobalNormResidueMonoidHom +- K (rayClassField K m) c) = +- QuotientGroup.quotientMulEquivOfEq +- (rayClassField_ideleClassNorm_range_over_original +- (K := K) m) +- (arithmeticGlobalReciprocityContinuousMulEquiv +- K (rayClassField K m) +- (arithmeticGlobalNormResidueMonoidHom +- K (rayClassField K m) c)) := +- arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_apply +- (K := K) m _ +- _ = QuotientGroup.mk' +- (RayClass.Modulus.congruenceSubgroup m) c := +- arithmeticReciprocity_quotientMulEquivOfEq_globalNormResidue +- (RayClass.Modulus.congruenceSubgroup m) +- (rayClassField_ideleClassNorm_range_over_original +- (K := K) m) c +- + /-- Inverse arithmetic ray reciprocity sends a represented ray class + back to the arithmetic global norm-residue symbol. -/ + @[simp] +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityBase.lean +new file mode 100644 +index 0000000..6519cd0 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityBase.lean +@@ -0,0 +1,112 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.RayClassFieldRealization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.ArithmeticNormalization ++ ++ ++set_option autoImplicit false ++ ++/-! ++# Arithmetic reciprocity for actual ray class fields ++ ++This is the canonical topological isomorphism ++`Gal(Kᵐ/K) ≃ₜ* C_K/C_Kᵐ` with arithmetic Frobenius ++normalization. It uses the actual selected ray class field, its exact ++idèle norm range, the finite Krull topology, and the native ray-class ++quotient topology. ++-/ ++ ++open scoped Classical NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace GlobalClassFields ++ ++open NumberField ++open Reciprocity ++ ++theorem arithmeticRayClassIdeleClassGroupIsMulCommutative ++ {F : Type} [Field F] [NumberField F] : ++ IsMulCommutative (IdeleClassGroup F) := ++ ⟨⟨fun a b => mul_comm a b⟩⟩ ++ ++attribute [local instance] arithmeticRayClassIdeleClassGroupIsMulCommutative ++ ++variable {K : Type} [Field K] [NumberField K] ++ ++/-- Arithmetic reciprocity followed by transport between equal norm ++quotients sends a norm-residue symbol to its represented quotient class. -/ ++theorem ++ arithmeticReciprocity_quotientMulEquivOfEq_globalNormResidue ++ {F E : Type} [Field F] [NumberField F] ++ [Field E] [NumberField E] [Algebra F E] ++ [FiniteDimensional F E] [IsAbelianGalois F E] ++ (H : Subgroup (IdeleClassGroup F)) ++ (h : (_root_.ideleClassNorm F E).range = H) ++ (c : IdeleClassGroup F) : ++ QuotientGroup.quotientMulEquivOfEq h ++ (arithmeticGlobalReciprocityContinuousMulEquiv F E ++ (arithmeticGlobalNormResidueMonoidHom F E c)) = ++ QuotientGroup.mk' H c := by ++ let e := arithmeticGlobalReciprocityContinuousMulEquiv F E ++ let q := ++ QuotientGroup.mk' ++ (_root_.ideleClassNorm F E).range c ++ have hsymm : ++ e.symm q = arithmeticGlobalNormResidueMonoidHom F E c := ++ arithmeticGlobalReciprocityContinuousMulEquiv_symm_mk F E c ++ have he : ++ e (arithmeticGlobalNormResidueMonoidHom F E c) = q := by ++ calc ++ e (arithmeticGlobalNormResidueMonoidHom F E c) = ++ e (e.symm q) := ++ congrArg (fun σ => e σ) hsymm.symm ++ _ = q := e.apply_symm_apply q ++ calc ++ QuotientGroup.quotientMulEquivOfEq h ++ (arithmeticGlobalReciprocityContinuousMulEquiv F E ++ (arithmeticGlobalNormResidueMonoidHom F E c)) = ++ QuotientGroup.quotientMulEquivOfEq h q := ++ congrArg (fun x => QuotientGroup.quotientMulEquivOfEq h x) he ++ _ = QuotientGroup.mk' H c := ++ QuotientGroup.quotientMulEquivOfEq_mk h c ++ ++/-- Arithmetic global reciprocity for the actual selected ray class ++field, bundled with both native topologies. -/ ++noncomputable def ++ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup ++ (m : RayClass.Modulus K) : ++ Gal((rayClassField K m) / K) ≃ₜ* ++ RayClass.RayClassGroup m := by ++ letI normQuotientDiscreteTopology : DiscreteTopology ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm ++ K (rayClassField K m)).range) := ++ ideleClassNormQuotient_discreteTopology ++ K (rayClassField K m) ++ letI rayClassGroupDiscreteTopology : DiscreteTopology ++ (RayClass.RayClassGroup m) := ++ QuotientGroup.discreteTopology ++ (RayClass.isOpen_congruenceSubgroup m) ++ let quotientTransport : ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm ++ K (rayClassField K m)).range) ≃ₜ* ++ RayClass.RayClassGroup m := ++ { QuotientGroup.quotientMulEquivOfEq ++ (rayClassField_ideleClassNorm_range_over_original ++ (K := K) m) with ++ continuous_toFun := continuous_of_discreteTopology ++ continuous_invFun := continuous_of_discreteTopology } ++ exact ++ (arithmeticGlobalReciprocityContinuousMulEquiv ++ K (rayClassField K m)).trans ++ quotientTransport ++ ++end GlobalClassFields ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityEvaluation.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityEvaluation.lean +new file mode 100644 +index 0000000..41d3435 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityEvaluation.lean +@@ -0,0 +1,51 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ArithmeticRayClassFieldReciprocityBase ++ ++set_option autoImplicit false ++open scoped Classical NumberField ++noncomputable section ++namespace GlobalClassFieldTheory ++namespace GlobalClassFields ++open NumberField ++open Reciprocity ++attribute [local instance] arithmeticRayClassIdeleClassGroupIsMulCommutative ++private theorem mulEquiv_toEquiv_apply ++ {A B : Type*} [Mul A] [Mul B] ++ (e : A ≃* B) (x : A) : e.toEquiv x = e x := by rfl ++ ++private theorem continuousMulEquiv_toMulEquiv_apply ++ {A B : Type*} [TopologicalSpace A] [TopologicalSpace B] [Mul A] [Mul B] ++ (e : A ≃ₜ* B) (x : A) : e.toMulEquiv x = e x := by rfl ++ ++variable {K : Type} [Field K] [NumberField K] ++ ++ ++/-- Evaluation of ray class reciprocity is global reciprocity transported ++through the equality of the ray norm subgroup and the idele norm range. -/ ++theorem ++ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_apply ++ (m : RayClass.Modulus K) ++ (σ : Gal((rayClassField K m) / K)) : ++ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup ++ (K := K) m σ = ++ QuotientGroup.quotientMulEquivOfEq ++ (rayClassField_ideleClassNorm_range_over_original ++ (K := K) m) ++ (arithmeticGlobalReciprocityContinuousMulEquiv ++ K (rayClassField K m) σ) := by ++ simp only [arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup, ++ ContinuousMulEquiv.trans, MulEquiv.trans, Equiv.trans, ++ ContinuousMulEquiv.coe_mk, MulEquiv.coe_mk, Equiv.coe_fn_mk, ++ Function.comp_apply, ++ mulEquiv_toEquiv_apply] ++ have h := continuousMulEquiv_toMulEquiv_apply ++ (arithmeticGlobalReciprocityContinuousMulEquiv K (rayClassField K m)) σ ++ with_reducible exact congrArg (fun q => QuotientGroup.quotientMulEquivOfEq (rayClassField_ideleClassNorm_range_over_original (K := K) m) q) h ++ ++end GlobalClassFields ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityNormResidue.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityNormResidue.lean +new file mode 100644 +index 0000000..ce8c03e +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/ArithmeticRayClassFieldReciprocityNormResidue.lean +@@ -0,0 +1,54 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ArithmeticRayClassFieldReciprocityEvaluation ++ ++set_option autoImplicit false ++open scoped Classical NumberField ++noncomputable section ++namespace GlobalClassFieldTheory ++namespace GlobalClassFields ++open NumberField ++open Reciprocity ++attribute [local instance] arithmeticRayClassIdeleClassGroupIsMulCommutative ++variable {K : Type} [Field K] [NumberField K] ++ ++/-- Arithmetic ray-class reciprocity sends the arithmetic global ++norm-residue symbol of an idèle class to its literal ray class. -/ ++@[simp] ++theorem ++ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_globalNormResidue ++ (m : RayClass.Modulus K) ++ (c : IdeleClassGroup K) : ++ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup ++ (K := K) m ++ (arithmeticGlobalNormResidueMonoidHom ++ K (rayClassField K m) c) = ++ QuotientGroup.mk' ++ (RayClass.Modulus.congruenceSubgroup m) c := by ++ calc ++ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup ++ (K := K) m ++ (arithmeticGlobalNormResidueMonoidHom ++ K (rayClassField K m) c) = ++ QuotientGroup.quotientMulEquivOfEq ++ (rayClassField_ideleClassNorm_range_over_original ++ (K := K) m) ++ (arithmeticGlobalReciprocityContinuousMulEquiv ++ K (rayClassField K m) ++ (arithmeticGlobalNormResidueMonoidHom ++ K (rayClassField K m) c)) := ++ arithmeticRayClassFieldGaloisContinuousMulEquivRayClassGroup_apply ++ (K := K) m _ ++ _ = QuotientGroup.mk' ++ (RayClass.Modulus.congruenceSubgroup m) c := ++ arithmeticReciprocity_quotientMulEquivOfEq_globalNormResidue ++ (RayClass.Modulus.congruenceSubgroup m) ++ (rayClassField_ideleClassNorm_range_over_original ++ (K := K) m) c ++ ++end GlobalClassFields ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActual.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActual.lean +index 11beea0..7ab1c83 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActual.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActual.lean +@@ -4,106 +4,17 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldReciprocity.Transport +-import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.BigHilbertClassFieldNaturality +-import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldComparison + +-set_option autoImplicit false +- +-/-! +-# Big Hilbert reciprocity over the realized base field +- +-This leaf specializes the shared reciprocity transport to the actual base +-field of the selected big Hilbert class field. +--/ ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldReciprocity.BigActualEquiv + ++set_option autoImplicit false + open scoped Classical IsMulCommutative NumberField +- + noncomputable section +- + namespace GlobalClassFieldTheory + namespace GlobalClassFields +- + open Reciprocity +- + variable {K : Type} [Field K] [NumberField K] +- +-local instance +- bigHilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative +- {F : Type} [Field F] [NumberField F] : +- IsMulCommutative (IdeleClassGroup F) := +- hilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative +- +-/-- The actual norm range of the selected big Hilbert class field is +-the intrinsic big-Hilbert norm subgroup of its actual base field. -/ +-theorem bigHilbertClassField_ideleClassNorm_range_eq_intrinsic : +- (_root_.ideleClassNorm +- (bigHilbertClassFieldBase K) +- (bigHilbertClassField K)).range = +- bigHilbertClassFieldNormSubgroup +- (K := bigHilbertClassFieldBase K) := by +- rw [bigHilbertClassField_ideleClassNorm_range] +- exact +- bigHilbertClassFieldNormSubgroup_map_ideleClassCongr +- (bigHilbertClassFieldBaseEquiv (K := K)) +- +-/-- Global reciprocity identifies the genuine Galois group of the +-selected big Hilbert class field with the narrow ideal class group of +-the original number field. -/ +-private noncomputable def bigHilbertClassFieldReciprocityData : +- {e : Gal((bigHilbertClassField K) / +- (bigHilbertClassFieldBase K)) ≃* +- RayClass.NarrowClassGroup K // +- ∀ c : IdeleClassGroup (bigHilbertClassFieldBase K), +- e (globalNormResidueMonoidHom +- (bigHilbertClassFieldBase K) +- (bigHilbertClassField K) c) = +- bigHilbertNarrowClassGroupCongr +- (bigHilbertClassFieldBaseEquiv (K := K)).symm +- (bigHilbertClassFieldQuotientEquivNarrowClassGroup +- (K := bigHilbertClassFieldBase K) +- (QuotientGroup.mk' +- (bigHilbertClassFieldNormSubgroup +- (K := bigHilbertClassFieldBase K)) c))} := by +- let d := hilbertClassFieldGlobalReciprocityTransportData +- (bigHilbertClassFieldNormSubgroup +- (K := bigHilbertClassFieldBase K)) +- (bigHilbertClassField_ideleClassNorm_range_eq_intrinsic +- (K := K)) +- ((bigHilbertClassFieldQuotientEquivNarrowClassGroup +- (K := bigHilbertClassFieldBase K)).trans +- (bigHilbertNarrowClassGroupCongr +- (bigHilbertClassFieldBaseEquiv (K := K)).symm)) +- refine ⟨d.1, ?_⟩ +- intro c +- exact d.2 c +- +-/-- The reciprocity equivalence from the actual big Hilbert Galois group +-to the narrow class group of the original number field. -/ +-noncomputable def bigHilbertClassFieldGaloisEquivNarrowClassGroup : +- Gal((bigHilbertClassField K) / +- (bigHilbertClassFieldBase K)) ≃* +- RayClass.NarrowClassGroup K := +- (bigHilbertClassFieldReciprocityData (K := K)).1 +- +-/-- Under big-Hilbert reciprocity, the actual global norm-residue +-symbol is the narrow ideal class of its idèle-class representative, +-transported back to the original number field. -/ +-@[simp] +-theorem bigHilbertClassFieldGaloisEquivNarrowClassGroup_globalNormResidue +- (c : IdeleClassGroup (bigHilbertClassFieldBase K)) : +- bigHilbertClassFieldGaloisEquivNarrowClassGroup (K := K) +- (globalNormResidueMonoidHom +- (bigHilbertClassFieldBase K) +- (bigHilbertClassField K) c) = +- bigHilbertNarrowClassGroupCongr +- (bigHilbertClassFieldBaseEquiv (K := K)).symm +- (bigHilbertClassFieldQuotientEquivNarrowClassGroup +- (K := bigHilbertClassFieldBase K) +- (QuotientGroup.mk' +- (bigHilbertClassFieldNormSubgroup +- (K := bigHilbertClassFieldBase K)) c)) := by +- exact (bigHilbertClassFieldReciprocityData (K := K)).2 c ++attribute [local instance] bigHilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative + + /-- Representative form of big-Hilbert reciprocity: the global + norm-residue symbol of an actual idèle maps to its narrow ideal +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualData.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualData.lean +new file mode 100644 +index 0000000..4dd276f +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualData.lean +@@ -0,0 +1,84 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldReciprocity.Transport ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.BigHilbertClassFieldNaturality ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldComparison ++ ++ ++set_option autoImplicit false ++ ++/-! ++# Big Hilbert reciprocity over the realized base field ++ ++This leaf specializes the shared reciprocity transport to the actual base ++field of the selected big Hilbert class field. ++-/ ++ ++open scoped Classical IsMulCommutative NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace GlobalClassFields ++ ++open Reciprocity ++ ++variable {K : Type} [Field K] [NumberField K] ++ ++local instance ++ bigHilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative ++ {F : Type} [Field F] [NumberField F] : ++ IsMulCommutative (IdeleClassGroup F) := ++ hilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative ++ ++/-- The actual norm range of the selected big Hilbert class field is ++the intrinsic big-Hilbert norm subgroup of its actual base field. -/ ++theorem bigHilbertClassField_ideleClassNorm_range_eq_intrinsic : ++ (_root_.ideleClassNorm ++ (bigHilbertClassFieldBase K) ++ (bigHilbertClassField K)).range = ++ bigHilbertClassFieldNormSubgroup ++ (K := bigHilbertClassFieldBase K) := by ++ rw [bigHilbertClassField_ideleClassNorm_range] ++ exact ++ bigHilbertClassFieldNormSubgroup_map_ideleClassCongr ++ (bigHilbertClassFieldBaseEquiv (K := K)) ++ ++/-- Global reciprocity identifies the genuine Galois group of the ++selected big Hilbert class field with the narrow ideal class group of ++the original number field. -/ ++noncomputable def bigHilbertClassFieldReciprocityData : ++ {e : Gal((bigHilbertClassField K) / ++ (bigHilbertClassFieldBase K)) ≃* ++ RayClass.NarrowClassGroup K // ++ ∀ c : IdeleClassGroup (bigHilbertClassFieldBase K), ++ e (globalNormResidueMonoidHom ++ (bigHilbertClassFieldBase K) ++ (bigHilbertClassField K) c) = ++ bigHilbertNarrowClassGroupCongr ++ (bigHilbertClassFieldBaseEquiv (K := K)).symm ++ (bigHilbertClassFieldQuotientEquivNarrowClassGroup ++ (K := bigHilbertClassFieldBase K) ++ (QuotientGroup.mk' ++ (bigHilbertClassFieldNormSubgroup ++ (K := bigHilbertClassFieldBase K)) c))} := by ++ let d := hilbertClassFieldGlobalReciprocityTransportData ++ (bigHilbertClassFieldNormSubgroup ++ (K := bigHilbertClassFieldBase K)) ++ (bigHilbertClassField_ideleClassNorm_range_eq_intrinsic ++ (K := K)) ++ ((bigHilbertClassFieldQuotientEquivNarrowClassGroup ++ (K := bigHilbertClassFieldBase K)).trans ++ (bigHilbertNarrowClassGroupCongr ++ (bigHilbertClassFieldBaseEquiv (K := K)).symm)) ++ refine ⟨d.1, ?_⟩ ++ intro c ++ exact d.2 c ++ ++ ++end GlobalClassFields ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualEquiv.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualEquiv.lean +new file mode 100644 +index 0000000..19f756c +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/GlobalClassFields/HilbertClassFieldReciprocity/BigActualEquiv.lean +@@ -0,0 +1,48 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldReciprocity.BigActualData ++ ++set_option autoImplicit false ++open scoped Classical IsMulCommutative NumberField ++noncomputable section ++namespace GlobalClassFieldTheory ++namespace GlobalClassFields ++open Reciprocity ++variable {K : Type} [Field K] [NumberField K] ++attribute [local instance] bigHilbertClassFieldReciprocityIdeleClassGroupIsMulCommutative ++ ++/-- The reciprocity equivalence from the actual big Hilbert Galois group ++to the narrow class group of the original number field. -/ ++noncomputable def bigHilbertClassFieldGaloisEquivNarrowClassGroup : ++ Gal((bigHilbertClassField K) / ++ (bigHilbertClassFieldBase K)) ≃* ++ RayClass.NarrowClassGroup K := ++ (bigHilbertClassFieldReciprocityData (K := K)).1 ++ ++/-- Under big-Hilbert reciprocity, the actual global norm-residue ++symbol is the narrow ideal class of its idèle-class representative, ++transported back to the original number field. -/ ++@[simp] ++theorem bigHilbertClassFieldGaloisEquivNarrowClassGroup_globalNormResidue ++ (c : IdeleClassGroup (bigHilbertClassFieldBase K)) : ++ bigHilbertClassFieldGaloisEquivNarrowClassGroup (K := K) ++ (globalNormResidueMonoidHom ++ (bigHilbertClassFieldBase K) ++ (bigHilbertClassField K) c) = ++ bigHilbertNarrowClassGroupCongr ++ (bigHilbertClassFieldBaseEquiv (K := K)).symm ++ (bigHilbertClassFieldQuotientEquivNarrowClassGroup ++ (K := bigHilbertClassFieldBase K) ++ (QuotientGroup.mk' ++ (bigHilbertClassFieldNormSubgroup ++ (K := bigHilbertClassFieldBase K)) c)) := by ++ exact (bigHilbertClassFieldReciprocityData (K := K)).2 c ++ ++ ++end GlobalClassFields ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/RationalFiniteNormTransfer/Representatives.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/RationalFiniteNormTransfer/Representatives.lean +index a5d0b1a..45c9a3e 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/RationalFiniteNormTransfer/Representatives.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/RationalFiniteNormTransfer/Representatives.lean +@@ -6,6 +6,7 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + + import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.RationalFiniteNormTransfer.FieldSpine + ++ + set_option autoImplicit false + + /-! +@@ -56,7 +57,8 @@ noncomputable def rationalFiniteNormTransferAbstractRepresentative + [hfinite : Finite + (K.toSubgroup ⧸ extensionSubgroup K L hLK)] + (a : KummerTheory.ambientFixedAddSubgroup +- rationalIdeleClassRepresentation K) := by ++ rationalIdeleClassRepresentation K) : ++ rationalFiniteNormTransferExtensionIdeleClass K L hLK := by + letI hLfinite := RationalFiniteNormTransferInternal.absoluteFinite + K L hLK (hKfinite := hKfinite) (hfinite := hfinite) + let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hLK +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalization.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalization.lean +index 0ce4c1f..63f8f94 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalization.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalization.lean +@@ -4,188 +4,18 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.PrincipalIdealTheorem +-import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.PrincipalIdealTransfer +-import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerUnramified ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertPrincipalizationClassGroup + + set_option autoImplicit false +- +-/-! +-# Principalization in the selected small Hilbert class field +- +-The selected second small Hilbert class field is Galois over the +-canonical fixed-field copy of the original base, and its maximal +-abelian intermediate field is the selected first small Hilbert class +-field. Witt transfer therefore places every idele class extended from +-that fixed-field copy in the norm range from the second stage. +-Functoriality of actual idele extension along the degree-one +-identification of the original field with its fixed-field copy gives +-the same range inclusion for idele classes extended from the original +-field itself. +- +-The exact second-stage norm subgroup is the intrinsic small-Hilbert +-subgroup, so the genuine map from the original field on small-Hilbert +-quotients is trivial. Its naturality with extension of ideal classes +-then gives the class-group, integral-ideal, and fractional-ideal forms +-of principalization over the original number field. +--/ +- + open scoped Classical IsMulCommutative NumberField +- + noncomputable section +- + namespace GlobalClassFieldTheory + namespace IdealClassFieldTheory +- +-open ClassFormation +-open GlobalClassFields +-open KummerTheory +-open LocalClassFieldTheory +-open Reciprocity +- +-local instance +- smallHilbertPrincipalization_ideleClassGroupIsMulCommutative +- {F : Type} [Field F] [NumberField F] : +- IsMulCommutative (IdeleClassGroup F) := +- ⟨⟨fun a b => mul_comm a b⟩⟩ +- +-local instance +- smallHilbertPrincipalization_ideleClassSubgroupNormal +- {F : Type} [Field F] [NumberField F] +- (N : Subgroup (IdeleClassGroup F)) : N.Normal := +- N.normal_of_isMulCommutative +- +-local instance +- smallHilbertPrincipalization_smallHilbertQuotientGroup +- {F : Type} [Field F] [NumberField F] : +- Group +- (IdeleClassGroup F ⧸ +- smallHilbertClassFieldNormSubgroup (K := F)) := +- QuotientGroup.Quotient.group +- (smallHilbertClassFieldNormSubgroup (K := F)) +- +-local instance +- smallHilbertPrincipalization_smallHilbertQuotientOne +- {F : Type} [Field F] [NumberField F] : +- One +- (IdeleClassGroup F ⧸ +- smallHilbertClassFieldNormSubgroup (K := F)) := +- ⟨(smallHilbertPrincipalization_smallHilbertQuotientGroup +- (F := F)).one⟩ +- ++open ClassFormation GlobalClassFields KummerTheory LocalClassFieldTheory Reciprocity ++attribute [local instance] smallHilbertPrincipalization_ideleClassGroupIsMulCommutative ++ smallHilbertPrincipalization_ideleClassSubgroupNormal + variable (K : Type) [Field K] [NumberField K] + +-private theorem smallHilbertClassFieldIdeleExtensionMap_apply_eq_one +- (q : IdeleClassGroup K ⧸ +- smallHilbertClassFieldNormSubgroup (K := K)) : +- smallHilbertClassFieldIdeleExtensionMap +- K (smallHilbertClassField K) q = +- (1 : IdeleClassGroup (smallHilbertClassField K) ⧸ +- smallHilbertClassFieldNormSubgroup +- (K := smallHilbertClassField K)) := by +- induction q using QuotientGroup.induction_on with +- | _ c => +- change +- smallHilbertClassFieldIdeleExtensionMap +- K (smallHilbertClassField K) +- (QuotientGroup.mk' +- (smallHilbertClassFieldNormSubgroup (K := K)) c) = +- 1 +- have hcontainment := +- smallHilbertClassField_ideleClassExtension_range_le_secondNormRange K +- unfold smallHilbertClassFieldSecondNormRangeContainment at hcontainment +- have hmembership : +- ideleClassExtension K (smallHilbertClassField K) c ∈ +- smallHilbertClassFieldNormSubgroup +- (K := smallHilbertClassField K) := +- hcontainment ⟨c, rfl⟩ +- calc +- smallHilbertClassFieldIdeleExtensionMap +- K (smallHilbertClassField K) +- (QuotientGroup.mk' +- (smallHilbertClassFieldNormSubgroup (K := K)) c) = +- QuotientGroup.mk' +- (smallHilbertClassFieldNormSubgroup +- (K := smallHilbertClassField K)) +- (ideleClassExtension K (smallHilbertClassField K) c) := +- smallHilbertClassFieldIdeleExtensionMap_mk' +- K (smallHilbertClassField K) c +- _ = 1 := +- (QuotientGroup.eq_one_iff +- (ideleClassExtension K (smallHilbertClassField K) c)).2 +- hmembership +- +-/-- The map induced by genuine idele extension from the original +-number field on the two small-Hilbert reciprocity quotients is +-trivial. -/ +-theorem smallHilbertClassFieldIdeleExtensionMap_eq_one : +- @Eq +- ((IdeleClassGroup K ⧸ +- smallHilbertClassFieldNormSubgroup (K := K)) →* +- (IdeleClassGroup (smallHilbertClassField K) ⧸ +- smallHilbertClassFieldNormSubgroup +- (K := smallHilbertClassField K))) +- (smallHilbertClassFieldIdeleExtensionMap +- K (smallHilbertClassField K)) +- (1 : +- (IdeleClassGroup K ⧸ +- smallHilbertClassFieldNormSubgroup (K := K)) →* +- (IdeleClassGroup (smallHilbertClassField K) ⧸ +- smallHilbertClassFieldNormSubgroup +- (K := smallHilbertClassField K))) := by +- apply MonoidHom.ext +- intro q +- simpa only [MonoidHom.one_apply] using +- smallHilbertClassFieldIdeleExtensionMap_apply_eq_one K q +- +-private theorem smallHilbertClassFieldClassGroupExtension_apply_eq_one +- (c : ClassGroup (𝓞 K)) : +- ClassGroup.extendedHom +- (𝓞 K) (𝓞 (smallHilbertClassField K)) c = +- (1 : ClassGroup (𝓞 (smallHilbertClassField K))) := by +- obtain ⟨q, rfl⟩ := +- (smallHilbertClassFieldQuotientEquivClassGroup +- (K := K)).surjective c +- have hidele := +- smallHilbertClassFieldIdeleExtensionMap_apply_eq_one K q +- have hnaturality := +- smallHilbertClassFieldIdeleExtensionMap_naturality +- K (smallHilbertClassField K) q +- calc +- ClassGroup.extendedHom +- (𝓞 K) (𝓞 (smallHilbertClassField K)) +- (smallHilbertClassFieldQuotientEquivClassGroup (K := K) q) = +- smallHilbertClassFieldQuotientEquivClassGroup +- (K := smallHilbertClassField K) +- (smallHilbertClassFieldIdeleExtensionMap +- K (smallHilbertClassField K) q) := +- hnaturality.symm +- _ = smallHilbertClassFieldQuotientEquivClassGroup +- (K := smallHilbertClassField K) 1 := +- congrArg +- (smallHilbertClassFieldQuotientEquivClassGroup +- (K := smallHilbertClassField K)) hidele +- _ = 1 := +- (smallHilbertClassFieldQuotientEquivClassGroup +- (K := smallHilbertClassField K)).map_one +- +-/-- Extension of ideal classes from a number field to its selected +-small Hilbert class field is the trivial homomorphism. This follows +-directly from the naturality equality identifying actual idele +-extension with actual extension of ideal classes. -/ +-theorem smallHilbertClassFieldClassGroupExtension_eq_one : +- @Eq +- (ClassGroup (𝓞 K) →* +- ClassGroup (𝓞 (smallHilbertClassField K))) +- (ClassGroup.extendedHom +- (𝓞 K) (𝓞 (smallHilbertClassField K))) +- (1 : ClassGroup (𝓞 K) →* +- ClassGroup (𝓞 (smallHilbertClassField K))) := by +- apply MonoidHom.ext +- intro c +- simpa only [MonoidHom.one_apply] using +- smallHilbertClassFieldClassGroupExtension_apply_eq_one K c +- + /-- Every ideal of a number field becomes principal after extension + to the selected small Hilbert class field. -/ + theorem allIdealsBecomePrincipalInSmallHilbertClassField : +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationBase.lean +new file mode 100644 +index 0000000..ae72e33 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationBase.lean +@@ -0,0 +1,91 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.PrincipalIdealTheorem ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.PrincipalIdealTransfer ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerUnramified ++ ++ ++set_option autoImplicit false ++ ++/-! ++# Principalization in the selected small Hilbert class field ++ ++The selected second small Hilbert class field is Galois over the ++canonical fixed-field copy of the original base, and its maximal ++abelian intermediate field is the selected first small Hilbert class ++field. Witt transfer therefore places every idele class extended from ++that fixed-field copy in the norm range from the second stage. ++Functoriality of actual idele extension along the degree-one ++identification of the original field with its fixed-field copy gives ++the same range inclusion for idele classes extended from the original ++field itself. ++ ++The exact second-stage norm subgroup is the intrinsic small-Hilbert ++subgroup, so the genuine map from the original field on small-Hilbert ++quotients is trivial. Its naturality with extension of ideal classes ++then gives the class-group, integral-ideal, and fractional-ideal forms ++of principalization over the original number field. ++-/ ++ ++open scoped Classical IsMulCommutative NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace IdealClassFieldTheory ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open LocalClassFieldTheory ++open Reciprocity ++ ++local instance ++ smallHilbertPrincipalization_ideleClassGroupIsMulCommutative ++ {F : Type} [Field F] [NumberField F] : ++ IsMulCommutative (IdeleClassGroup F) := ++ ⟨⟨fun a b => mul_comm a b⟩⟩ ++ ++local instance ++ smallHilbertPrincipalization_ideleClassSubgroupNormal ++ {F : Type} [Field F] [NumberField F] ++ (N : Subgroup (IdeleClassGroup F)) : N.Normal := ++ N.normal_of_isMulCommutative ++ ++/-- A generic field-extension form keeps the class-field construction opaque. -/ ++theorem smallHilbertExtension_trivial_of_range ++ (K L : Type) [Field K] [NumberField K] [Field L] [NumberField L] ++ [Algebra K L] [FiniteDimensional K L] ++ (h : (ideleClassExtension K L).range ≤ ++ smallHilbertClassFieldNormSubgroup (K := L)) ++ (q : IdeleClassGroup K ⧸ smallHilbertClassFieldNormSubgroup (K := K)) : ++ smallHilbertClassFieldIdeleExtensionMap K L q = 1 := by ++ refine QuotientGroup.induction_on q ?_ ++ intro c ++ exact (smallHilbertClassFieldIdeleExtensionMap_mk' K L c).trans ++ ((QuotientGroup.eq_one_iff (ideleClassExtension K L c)).mpr (h ⟨c, rfl⟩)) ++ ++variable (K : Type) [Field K] [NumberField K] ++ ++/-- Extension to the small Hilbert class field sends each reciprocity ++quotient class to the identity class. -/ ++theorem smallHilbertClassFieldIdeleExtensionMap_apply_eq_one ++ (q : IdeleClassGroup K ⧸ ++ smallHilbertClassFieldNormSubgroup (K := K)) : ++ smallHilbertClassFieldIdeleExtensionMap ++ K (smallHilbertClassField K) q = ++ (1 : IdeleClassGroup (smallHilbertClassField K) ⧸ ++ smallHilbertClassFieldNormSubgroup ++ (K := smallHilbertClassField K)) := by ++ have hcontainment := ++ smallHilbertClassField_ideleClassExtension_range_le_secondNormRange K ++ unfold smallHilbertClassFieldSecondNormRangeContainment at hcontainment ++ exact smallHilbertExtension_trivial_of_range K (smallHilbertClassField K) ++ hcontainment q ++ ++end IdealClassFieldTheory ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationClassGroup.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationClassGroup.lean +new file mode 100644 +index 0000000..7889495 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationClassGroup.lean +@@ -0,0 +1,68 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertPrincipalizationIdele ++ ++set_option autoImplicit false ++open scoped Classical IsMulCommutative NumberField ++noncomputable section ++namespace GlobalClassFieldTheory ++namespace IdealClassFieldTheory ++open ClassFormation GlobalClassFields KummerTheory LocalClassFieldTheory Reciprocity ++attribute [local instance] smallHilbertPrincipalization_ideleClassGroupIsMulCommutative ++ smallHilbertPrincipalization_ideleClassSubgroupNormal ++variable (K : Type) [Field K] [NumberField K] ++ ++private theorem smallHilbertClassFieldClassGroupExtension_apply_eq_one ++ (c : ClassGroup (𝓞 K)) : ++ ClassGroup.extendedHom ++ (𝓞 K) (𝓞 (smallHilbertClassField K)) c = ++ (1 : ClassGroup (𝓞 (smallHilbertClassField K))) := by ++ obtain ⟨q, rfl⟩ := ++ (smallHilbertClassFieldQuotientEquivClassGroup ++ (K := K)).surjective c ++ have hidele := ++ smallHilbertClassFieldIdeleExtensionMap_apply_eq_one K q ++ have hnaturality := ++ smallHilbertClassFieldIdeleExtensionMap_naturality ++ K (smallHilbertClassField K) q ++ calc ++ ClassGroup.extendedHom ++ (𝓞 K) (𝓞 (smallHilbertClassField K)) ++ (smallHilbertClassFieldQuotientEquivClassGroup (K := K) q) = ++ smallHilbertClassFieldQuotientEquivClassGroup ++ (K := smallHilbertClassField K) ++ (smallHilbertClassFieldIdeleExtensionMap ++ K (smallHilbertClassField K) q) := ++ hnaturality.symm ++ _ = smallHilbertClassFieldQuotientEquivClassGroup ++ (K := smallHilbertClassField K) 1 := ++ congrArg ++ (smallHilbertClassFieldQuotientEquivClassGroup ++ (K := smallHilbertClassField K)) hidele ++ _ = 1 := ++ (smallHilbertClassFieldQuotientEquivClassGroup ++ (K := smallHilbertClassField K)).map_one ++ ++/-- Extension of ideal classes from a number field to its selected ++small Hilbert class field is the trivial homomorphism. This follows ++directly from the naturality equality identifying actual idele ++extension with actual extension of ideal classes. -/ ++theorem smallHilbertClassFieldClassGroupExtension_eq_one : ++ @Eq ++ (ClassGroup (𝓞 K) →* ++ ClassGroup (𝓞 (smallHilbertClassField K))) ++ (ClassGroup.extendedHom ++ (𝓞 K) (𝓞 (smallHilbertClassField K))) ++ (1 : ClassGroup (𝓞 K) →* ++ ClassGroup (𝓞 (smallHilbertClassField K))) := by ++ apply MonoidHom.ext ++ intro c ++ simpa only [MonoidHom.one_apply] using ++ smallHilbertClassFieldClassGroupExtension_apply_eq_one K c ++ ++end IdealClassFieldTheory ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationIdele.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationIdele.lean +new file mode 100644 +index 0000000..e11bcfb +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertPrincipalizationIdele.lean +@@ -0,0 +1,43 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertPrincipalizationBase ++ ++set_option autoImplicit false ++open scoped Classical IsMulCommutative NumberField ++noncomputable section ++namespace GlobalClassFieldTheory ++namespace IdealClassFieldTheory ++open ClassFormation GlobalClassFields KummerTheory LocalClassFieldTheory Reciprocity ++attribute [local instance] smallHilbertPrincipalization_ideleClassGroupIsMulCommutative ++ smallHilbertPrincipalization_ideleClassSubgroupNormal ++variable (K : Type) [Field K] [NumberField K] ++ ++/-- The map induced by genuine idele extension from the original ++number field on the two small-Hilbert reciprocity quotients is ++trivial. -/ ++theorem smallHilbertClassFieldIdeleExtensionMap_eq_one : ++ @Eq ++ ((IdeleClassGroup K ⧸ ++ smallHilbertClassFieldNormSubgroup (K := K)) →* ++ (IdeleClassGroup (smallHilbertClassField K) ⧸ ++ smallHilbertClassFieldNormSubgroup ++ (K := smallHilbertClassField K))) ++ (smallHilbertClassFieldIdeleExtensionMap ++ K (smallHilbertClassField K)) ++ (1 : ++ (IdeleClassGroup K ⧸ ++ smallHilbertClassFieldNormSubgroup (K := K)) →* ++ (IdeleClassGroup (smallHilbertClassField K) ⧸ ++ smallHilbertClassFieldNormSubgroup ++ (K := smallHilbertClassField K))) := by ++ apply MonoidHom.ext ++ intro q ++ simpa only [MonoidHom.one_apply] using ++ smallHilbertClassFieldIdeleExtensionMap_apply_eq_one K q ++ ++end IdealClassFieldTheory ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealization.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealization.lean +index 3edfd94..f01c3d8 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealization.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealization.lean +@@ -4,28 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldRealization +-import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerConjugation +-import Mathlib.Data.Rat.Cast.Defs + +-set_option autoImplicit false +- +-/-! +-# Actual realization of the two-stage small Hilbert tower +- +-The first small Hilbert class field is the actual finite abelian +-subextension selected in `HilbertClassFieldRealization`. Over its actual +-fixed field, the closed finite-index small-Hilbert norm subgroup has a +-finite Galois norm neighbourhood. We embed that neighbourhood in the +-rational separable closure compatibly with the already chosen first +-stage. Finite abelian classification then selects the second small +-Hilbert class field over the literal first-stage subgroup. ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerRealizationSecond + +-The compatibility of the embedding is essential: an unrelated chosen +-copy of the middle number field would produce a class field over a +-conjugate closed subgroup rather than over the first-stage subgroup +-itself. +--/ ++set_option autoImplicit false + + open scoped Classical NumberField + +@@ -43,33 +25,10 @@ open LocalClassFieldTheory + open RamificationTheory + open Reciprocity + +-/-- The ordinary idèle-class operations used by the two-stage transport, +-fixed at the canonical principal-subgroup quotient. -/ +-@[instance_reducible] +-private noncomputable def smallHilbertTowerIdeleClassCommGroup +- (F : Type) [Field F] [NumberField F] : +- CommGroup (IdeleClassGroup F) := +- QuotientGroup.Quotient.commGroup (IdeleGroup.principalSubgroup F) + + attribute [local instance] smallHilbertTowerIdeleClassCommGroup +- +-private theorem addSubgroup_comap_symm_eq_map +- {A B : Type*} [AddGroup A] [AddGroup B] +- (H : AddSubgroup A) (e : A ≃+ B) : +- H.comap e.symm.toAddMonoidHom = +- H.map e.toAddMonoidHom := by +- exact (AddSubgroup.map_equiv_eq_comap_symm e H).symm +- +-private noncomputable abbrev +- closedFiniteIndexNormAmbientCanonicalBaseAlgebra +- (F : Type) [Field F] [NumberField F] +- (H : Subgroup (IdeleClassGroup F)) +- (hclosed : IsClosed (H : Set (IdeleClassGroup F))) +- [H.FiniteIndex] : +- Algebra F +- (closedFiniteIndexClassFieldNormAmbient +- (K := F) H hclosed) := +- inferInstance ++ smallHilbertTowerNormAmbientAlgebra ++ smallHilbertTowerNormAmbientIsGalois + + section RationalFixedField + +@@ -78,758 +37,9 @@ variable + (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) + (L : FiniteAbelianSubextension K.field) + +-private noncomputable abbrev smallHilbertTowerMiddleFiniteAbstractField : +- FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := +- { field := L.field +- finite := by +- let : Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- K.field (le_baseField K.field)) := +- K.finite +- let : Finite +- (K.field.toSubgroup ⧸ +- extensionSubgroup K.field L.field L.below) := +- L.finite +- exact +- FiniteGaloisSubextension.finite_extension_trans +- L.below (le_baseField K.field) } +- +-local notation "E" => +- abstractFixedField ℚ (SeparableClosure ℚ) L.field +- +-local notation "N" => +- smallHilbertClassFieldNormAmbient E +- +-private noncomputable instance +- smallHilbertTowerMiddleAbstractQuotientFinite : +- Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- L.field (le_baseField L.field)) := +- (smallHilbertTowerMiddleFiniteAbstractField K L).finite +- +-private noncomputable instance +- smallHilbertTowerMiddleFiniteDimensional : +- FiniteDimensional ℚ E := +- abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) L.field inferInstance +- +-private noncomputable instance +- smallHilbertTowerMiddleNumberField : +- NumberField E := +- NumberField.of_module_finite ℚ E +- +-/-- The canonical small-Hilbert subgroup over the literal middle field. +-This typed endpoint avoids repeatedly reducing the finite-abstract-field +-package merely to recover its `field = L.field` projection. -/ +-noncomputable def smallHilbertTowerMiddleNormSubgroup : +- AddSubgroup +- (ambientFixedAddSubgroup +- rationalIdeleClassRepresentation L.field) := +- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup.comap +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom +- +-/-- The typed `comap` endpoint is the canonical transported `map` endpoint. +-This uses only the generic additive equivalence law. -/ +-theorem smallHilbertTowerMiddleNormSubgroup_eq_map : +- smallHilbertTowerMiddleNormSubgroup K L = +- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup.map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).toAddMonoidHom := by +- exact addSubgroup_comap_symm_eq_map +- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup +- (rationalAbstractFixedFieldIdeleClassEquivFixed L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)) +- +-@[reducible] +-private noncomputable def +- smallHilbertTowerNormAmbientAlgebra : +- Algebra E N := +- closedFiniteIndexNormAmbientCanonicalBaseAlgebra E +- (smallHilbertClassFieldNormSubgroup (K := E)) +- (smallHilbertClassFieldNormSubgroup_isClosed (K := E)) +- +-attribute [local instance] smallHilbertTowerNormAmbientAlgebra +- +-@[reducible] +-private noncomputable def +- smallHilbertTowerNormAmbientSMul : +- SMul E N := +- Algebra.toSMul +- (self := smallHilbertTowerNormAmbientAlgebra K L) +- +-@[reducible] +-private noncomputable def +- smallHilbertTowerNormAmbientModule : +- Module E N := +- @Algebra.toModule E N _ _ +- (smallHilbertTowerNormAmbientAlgebra K L) +- +-private theorem +- smallHilbertTowerNormAmbientScalarTower : +- @IsScalarTower ℚ E N +- (Algebra.toSMul (R := ℚ) (A := E)) +- (smallHilbertTowerNormAmbientSMul K L) +- (Algebra.toSMul (R := ℚ) (A := N)) := by +- exact IsScalarTower.of_algebraMap_eq' +- (R := ℚ) (S := E) (A := N) +- (RingHom.ext_rat (algebraMap ℚ N) +- ((algebraMap E N).comp (algebraMap ℚ E))) +- +-private noncomputable def +- smallHilbertTowerNormAmbientAlgHom : +- E →ₐ[ℚ] N := +- { toRingHom := algebraMap E N +- commutes' := fun r => +- (RingHom.congr_fun +- (RingHom.ext_rat +- ((algebraMap E N).comp (algebraMap ℚ E)) +- (algebraMap ℚ N)) r) } +- +-private theorem smallHilbertTowerNormAmbientAlgHom_apply +- (x : E) : +- smallHilbertTowerNormAmbientAlgHom K L x = +- algebraMap E N x := by +- rfl +- +-private theorem +- smallHilbertTowerNormAmbientIsGalois : +- IsGalois E N := by +- unfold smallHilbertClassFieldNormAmbient +- closedFiniteIndexClassFieldNormAmbient +- exact +- closedFiniteIndexNormAmbientIsGalois +- (smallHilbertClassFieldNormSubgroup (K := E)) +- (smallHilbertClassFieldNormSubgroup_isClosed (K := E)) +- +-attribute [local instance] smallHilbertTowerNormAmbientIsGalois +- +-private noncomputable def +- smallHilbertNormNeighborhoodForwardAlignment : +- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := by +- let j₀ : N →ₐ[ℚ] SeparableClosure ℚ := +- numberFieldSeparableClosureEmbedding N +- let i₀ : E →ₐ[ℚ] SeparableClosure ℚ := +- j₀.comp (smallHilbertTowerNormAmbientAlgHom K L) +- exact +- AlgEquiv.ofBijective +- (i₀.liftNormal (SeparableClosure ℚ)) +- (AlgHom.normal_bijective +- ℚ (SeparableClosure ℚ) (SeparableClosure ℚ) _) +- +-/-- The separable-closure automorphism which aligns an arbitrary chosen +-embedding of the norm-neighbourhood field with the already embedded +-middle field. -/ +-private noncomputable def +- smallHilbertNormNeighborhoodAlignment : +- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := +- (smallHilbertNormNeighborhoodForwardAlignment K L).symm +- +-@[simp] +-private theorem smallHilbertNormNeighborhoodForwardAlignment_apply +- (x : E) : +- smallHilbertNormNeighborhoodForwardAlignment K L +- (x : SeparableClosure ℚ) = +- (numberFieldSeparableClosureEmbedding N) +- (algebraMap E N x) := by +- let j₀ : N →ₐ[ℚ] SeparableClosure ℚ := +- numberFieldSeparableClosureEmbedding N +- let i₀ : E →ₐ[ℚ] SeparableClosure ℚ := +- j₀.comp (smallHilbertTowerNormAmbientAlgHom K L) +- dsimp only [smallHilbertNormNeighborhoodForwardAlignment, +- AlgEquiv.ofBijective_apply] +- calc +- _ = i₀ x := by +- simpa only [IntermediateField.algebraMap_apply, +- Algebra.algebraMap_self, RingHom.id_apply] using +- i₀.liftNormal_commutes (SeparableClosure ℚ) x +- _ = j₀ (algebraMap E N x) := by +- change +- j₀ (smallHilbertTowerNormAmbientAlgHom K L x) = +- j₀ (algebraMap E N x) +- exact congrArg j₀ +- (smallHilbertTowerNormAmbientAlgHom_apply K L x) +- +-/-- A controlled embedding of the concrete finite Galois norm +-neighbourhood. Its restriction to the middle field is the literal +-inclusion of that fixed field in `SeparableClosure ℚ`. -/ +-private noncomputable def +- smallHilbertNormNeighborhoodEmbedding : +- N →ₐ[ℚ] SeparableClosure ℚ := +- (smallHilbertNormNeighborhoodAlignment K L).toAlgHom.comp +- (numberFieldSeparableClosureEmbedding N) +- +-@[simp] +-private theorem smallHilbertNormNeighborhoodEmbedding_algebraMap +- (x : E) : +- smallHilbertNormNeighborhoodEmbedding K L +- (algebraMap E N x) = +- (x : SeparableClosure ℚ) := by +- change +- (smallHilbertNormNeighborhoodForwardAlignment K L).symm +- ((numberFieldSeparableClosureEmbedding N) +- (algebraMap E N x)) = +- (x : SeparableClosure ℚ) +- rw [← smallHilbertNormNeighborhoodForwardAlignment_apply K L x] +- exact +- (smallHilbertNormNeighborhoodForwardAlignment K L).symm_apply_apply _ +- +-private abbrev smallHilbertNormNeighborhoodEmbeddedBase : +- ClosedSubgroup +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := +- closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange +- ((smallHilbertNormNeighborhoodEmbedding K L).comp +- (smallHilbertTowerNormAmbientAlgHom K L))) +- +-private abbrev smallHilbertNormNeighborhoodEmbeddedField : +- ClosedSubgroup +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := +- closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange +- (smallHilbertNormNeighborhoodEmbedding K L)) +- +-private theorem smallHilbertNormNeighborhoodEmbeddedField_le_base : +- (smallHilbertNormNeighborhoodEmbeddedField K L).toSubgroup ≤ +- (smallHilbertNormNeighborhoodEmbeddedBase K L).toSubgroup := by +- change +- (AlgHom.fieldRange +- (smallHilbertNormNeighborhoodEmbedding K L)).fixingSubgroup ≤ +- (AlgHom.fieldRange +- ((smallHilbertNormNeighborhoodEmbedding K L).comp +- (smallHilbertTowerNormAmbientAlgHom K L))).fixingSubgroup +- apply +- (AlgHom.fieldRange +- ((smallHilbertNormNeighborhoodEmbedding K L).comp +- (smallHilbertTowerNormAmbientAlgHom K L))).fixingSubgroup_le +- exact +- AlgHom.range_comp_le_range +- (smallHilbertTowerNormAmbientAlgHom K L) +- (smallHilbertNormNeighborhoodEmbedding K L) +- +-private theorem smallHilbertNormNeighborhoodEmbeddedBase_eq : +- smallHilbertNormNeighborhoodEmbeddedBase K L = L.field := by +- have hi : +- (smallHilbertNormNeighborhoodEmbedding K L).comp +- (smallHilbertTowerNormAmbientAlgHom K L) = +- (abstractFixedField ℚ (SeparableClosure ℚ) L.field).val := by +- apply AlgHom.ext +- intro x +- change smallHilbertNormNeighborhoodEmbedding K L +- (smallHilbertTowerNormAmbientAlgHom K L x) = (x : SeparableClosure ℚ) +- rw [smallHilbertTowerNormAmbientAlgHom_apply K L x] +- exact smallHilbertNormNeighborhoodEmbedding_algebraMap K L x +- change +- closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange +- ((smallHilbertNormNeighborhoodEmbedding K L).comp +- (smallHilbertTowerNormAmbientAlgHom K L))) = +- L.field +- rw [hi, IntermediateField.fieldRange_val] +- exact +- closedFixingSubgroup_abstractFixedField_eq +- ℚ (SeparableClosure ℚ) L.field +- +-private noncomputable def +- smallHilbertNormNeighborhoodSeparableClosureEquiv : +- let j := smallHilbertNormNeighborhoodEmbedding K L +- let i := j.comp (smallHilbertTowerNormAmbientAlgHom K L) +- let : Algebra E (SeparableClosure ℚ) := +- i.toRingHom.toAlgebra +- SeparableClosure E ≃ₐ[E] SeparableClosure ℚ := by +- intro j i alg +- let : @IsScalarTower ℚ E (SeparableClosure ℚ) +- (Algebra.toSMul (R := ℚ) (A := E)) +- alg.toSMul +- (Algebra.toSMul (R := ℚ) (A := SeparableClosure ℚ)) := +- IsScalarTower.of_algebraMap_eq' i.comp_algebraMap.symm +- let : IsSepClosure E (SeparableClosure ℚ) := +- ⟨IsSepClosure.sep_closed ℚ, +- Algebra.isSeparable_tower_top_of_isSeparable +- ℚ E (SeparableClosure ℚ)⟩ +- exact +- IsSepClosure.equiv E +- (SeparableClosure E) (SeparableClosure ℚ) +- +-private noncomputable def +- smallHilbertFiniteGaloisNormNeighborhoodRaw : +- FiniteGaloisSubextension +- (smallHilbertNormNeighborhoodEmbeddedBase K L) := by +- let : @IsScalarTower ℚ E N +- (Algebra.toSMul (R := ℚ) (A := E)) +- (smallHilbertTowerNormAmbientSMul K L) +- (Algebra.toSMul (R := ℚ) (A := N)) := +- smallHilbertTowerNormAmbientScalarTower K L +- let j : N →ₐ[ℚ] SeparableClosure ℚ := +- smallHilbertNormNeighborhoodEmbedding K L +- let i : E →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ E N) +- let B : ClosedSubgroup (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := +- closedFixingSubgroup ℚ (SeparableClosure ℚ) i.fieldRange +- let T : ClosedSubgroup (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := +- smallHilbertNormNeighborhoodEmbeddedField K L +- have hTB : T.toSubgroup ≤ B.toSubgroup := by +- change j.fieldRange.fixingSubgroup ≤ i.fieldRange.fixingSubgroup +- apply i.fieldRange.fixingSubgroup_le +- exact AlgHom.range_comp_le_range (IsScalarTower.toAlgHom ℚ E N) j +- let raw : FiniteGaloisSubextension B := { +- field := T +- below := hTB +- normal := ambientEmbeddedExtensionSubgroup_normal ℚ E N j +- (smallHilbertNormNeighborhoodSeparableClosureEquiv K L) +- finite := ambientEmbeddedExtensionQuotient_finite ℚ E N j +- (smallHilbertNormNeighborhoodSeparableClosureEquiv K L) } +- have hi : IsScalarTower.toAlgHom ℚ E N = +- smallHilbertTowerNormAmbientAlgHom K L := by +- apply AlgHom.ext +- intro x +- exact (IsScalarTower.toAlgHom_apply ℚ E N x).trans +- (smallHilbertTowerNormAmbientAlgHom_apply K L x).symm +- have hB : B = smallHilbertNormNeighborhoodEmbeddedBase K L := +- congrArg +- (fun f : E →ₐ[ℚ] N => +- closedFixingSubgroup ℚ (SeparableClosure ℚ) (j.comp f).fieldRange) hi +- exact hB ▸ raw +- +-private noncomputable def rebaseFiniteGaloisSubextension +- {G : Type} [Group G] [TopologicalSpace G] +- {B B' : ClosedSubgroup G} (h : B = B') +- (P : FiniteGaloisSubextension B) : +- FiniteGaloisSubextension B' := +- h ▸ P +- +-@[simp] +-private theorem rebaseFiniteGaloisSubextension_field +- {G : Type} [Group G] [TopologicalSpace G] +- {B B' : ClosedSubgroup G} (h : B = B') +- (P : FiniteGaloisSubextension B) : +- (rebaseFiniteGaloisSubextension h P).field = P.field := by +- cases h +- rfl +- +-private theorem +- rebaseRationalFiniteGaloisSubextension_fixedField_eq +- {B B' : ClosedSubgroup +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} +- (h : B = B') (P : FiniteGaloisSubextension B) : +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (rebaseFiniteGaloisSubextension h P).below).restrictScalars ℚ = +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- P.below).restrictScalars ℚ := by +- cases h +- rfl +- +-/-- An actual finite Galois norm neighbourhood over the literal +-first-stage subgroup. It is produced by the finite-index Kummer +-construction and the controlled embedding above. -/ +-noncomputable def smallHilbertFiniteGaloisNormNeighborhood : +- FiniteGaloisSubextension L.field := +- rebaseFiniteGaloisSubextension +- (smallHilbertNormNeighborhoodEmbeddedBase_eq K L) +- (smallHilbertFiniteGaloisNormNeighborhoodRaw K L) +- +-/-- The abstract norm subgroup of the chosen neighbourhood, pinned to the +-literal middle-field carrier. -/ +-noncomputable def smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup : +- AddSubgroup +- (ambientFixedAddSubgroup +- rationalIdeleClassRepresentation L.field) := +- (smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup +- rationalIdeleClassRepresentation +- +-private noncomputable abbrev +- smallHilbertFiniteGaloisNormNeighborhoodTopField : Type := +- abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (smallHilbertFiniteGaloisNormNeighborhood K L).below +- +-local notation "E₂" => +- smallHilbertFiniteGaloisNormNeighborhoodTopField K L +- +-private noncomputable instance +- smallHilbertFiniteGaloisNormNeighborhoodQuotientFinite : +- Finite +- (L.field.toSubgroup ⧸ +- extensionSubgroup L.field +- (smallHilbertFiniteGaloisNormNeighborhood K L).field +- (smallHilbertFiniteGaloisNormNeighborhood K L).below) := +- (smallHilbertFiniteGaloisNormNeighborhood K L).finite +- +-private noncomputable instance +- smallHilbertFiniteGaloisNormNeighborhoodFiniteDimensional : +- FiniteDimensional E E₂ := +- abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) L.field +- (smallHilbertFiniteGaloisNormNeighborhood K L).field +- (smallHilbertFiniteGaloisNormNeighborhood K L).below +- inferInstance inferInstance +- +-private noncomputable instance +- smallHilbertFiniteGaloisNormNeighborhoodScalarTower : +- IsScalarTower ℚ E E₂ := +- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) +- +-private noncomputable instance +- smallHilbertFiniteGaloisNormNeighborhoodAbsoluteFiniteDimensional : +- FiniteDimensional ℚ E₂ := +- FiniteDimensional.trans ℚ E E₂ +- +-private noncomputable instance +- smallHilbertFiniteGaloisNormNeighborhoodNumberField : +- NumberField E₂ := +- NumberField.of_module_finite ℚ E₂ +- +-private noncomputable instance +- smallHilbertFiniteGaloisNormNeighborhoodIsGalois : +- IsGalois E E₂ := +- abstractRelativeFixedField_isGalois +- ℚ (SeparableClosure ℚ) L.field +- (smallHilbertFiniteGaloisNormNeighborhood K L).field +- (smallHilbertFiniteGaloisNormNeighborhood K L).below +- (smallHilbertFiniteGaloisNormNeighborhood K L).normal +- +-private theorem +- smallHilbertFiniteGaloisNormNeighborhood_fixedField_eq_range : +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ = +- AlgHom.fieldRange +- (smallHilbertNormNeighborhoodEmbedding K L) := by +- rw [show +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ = +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (smallHilbertFiniteGaloisNormNeighborhoodRaw K L).below).restrictScalars ℚ +- from +- rebaseRationalFiniteGaloisSubextension_fixedField_eq +- (smallHilbertNormNeighborhoodEmbeddedBase_eq K L) +- (smallHilbertFiniteGaloisNormNeighborhoodRaw K L)] +- exact +- InfiniteGalois.fixedField_fixingSubgroup +- (AlgHom.fieldRange +- (smallHilbertNormNeighborhoodEmbedding K L)) +- +-private noncomputable def +- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv : +- N ≃ₐ[ℚ] +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ := +- (smallHilbertNormNeighborhoodEmbedding K L).equivFieldRange.trans +- (IntermediateField.equivOfEq +- (smallHilbertFiniteGaloisNormNeighborhood_fixedField_eq_range +- K L).symm) +- +-@[simp] +-private theorem +- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv_algebraMap +- (x : E) : +- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv K L +- (algebraMap E N x) = +- algebraMap E +- E₂ x := by +- apply Subtype.ext +- change +- smallHilbertNormNeighborhoodEmbedding K L +- (algebraMap E N x) = +- (x : SeparableClosure ℚ) +- exact smallHilbertNormNeighborhoodEmbedding_algebraMap K L x +- +-private noncomputable def +- smallHilbertFiniteGaloisNormNeighborhoodRelativeTopEquiv : +- N ≃ₐ[E] E₂ := { +- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv K L with +- commutes' := fun x => +- smallHilbertFiniteGaloisNormNeighborhoodTopEquiv_algebraMap +- K L x } +- +-private theorem +- smallHilbertFiniteGaloisNormNeighborhood_ordinaryNorm_le : +- (_root_.ideleClassNorm E N).range ≤ +- smallHilbertClassFieldNormSubgroup (K := E) := by +- simpa only [smallHilbertClassFieldNormAmbient] using +- (closedFiniteIndexClassFieldNormAmbient_normRange_le +- (K := E) (smallHilbertClassFieldNormSubgroup (K := E)) +- (smallHilbertClassFieldNormSubgroup_isClosed (K := E))) +- +-private theorem +- smallHilbertFiniteGaloisNormNeighborhood_ordinaryNormRange_eq : +- (_root_.ideleClassNorm E N).range = +- (_root_.ideleClassNorm E E₂).range := by +- simpa only [ordinaryIdeleClassNorm_range_eq_relative] using +- (ideleClassNorm_range_algEquiv +- (K := E) +- (smallHilbertFiniteGaloisNormNeighborhoodRelativeTopEquiv +- K L)).symm +- +-private theorem +- smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq : +- ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup +- rationalIdeleClassRepresentation).map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = +- (_root_.ideleClassNorm E E₂).range.toAddSubgroup := by +- change +- (finiteNormSubgroup rationalIdeleClassRepresentation +- L.field +- (smallHilbertFiniteGaloisNormNeighborhood K L).field +- (smallHilbertFiniteGaloisNormNeighborhood K L).below).map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = +- (_root_.ideleClassNorm E E₂).range.toAddSubgroup +- exact +- (map_rationalFiniteNormSubgroup_eq_ordinaryIdeleClassNormRange_concrete +- L.field +- (smallHilbertFiniteGaloisNormNeighborhood K L).field +- (smallHilbertFiniteGaloisNormNeighborhood K L).below +- (smallHilbertFiniteGaloisNormNeighborhood K L).normal) +- +-/-- The abstract norm map lands directly in the ordinary norm range of the +-chosen neighbourhood. Composing the two named subgroup equalities here +-keeps downstream membership proofs pointwise. -/ +-private theorem +- smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq_ordinaryNormRange : +- ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup +- rationalIdeleClassRepresentation).map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = +- (_root_.ideleClassNorm E N).range.toAddSubgroup := +- (smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq K L).trans +- (congrArg Subgroup.toAddSubgroup +- (smallHilbertFiniteGaloisNormNeighborhood_ordinaryNormRange_eq K L).symm) +- +-/-- Pointwise form of the combined norm-range equality. -/ +-private theorem +- smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_mem_ordinaryNormRange +- (a : Additive (IdeleClassGroup E)) +- (ha : +- a ∈ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup +- rationalIdeleClassRepresentation).map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom) : +- a ∈ (_root_.ideleClassNorm E N).range.toAddSubgroup := +- (le_of_eq +- (smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq_ordinaryNormRange +- K L)) ha +- +-/-- The actual finite Galois norm neighbourhood has abstract norm +-subgroup contained in the canonical small-Hilbert subgroup of the +-middle fixed field. This is the source-producing norm-topology input; +-no norm-openness premise is assumed. -/ +-theorem smallHilbertFiniteGaloisNormNeighborhood_normSubgroup_le : +- ∀ a : ambientFixedAddSubgroup +- rationalIdeleClassRepresentation L.field, +- a ∈ smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup K L → +- a ∈ smallHilbertTowerMiddleNormSubgroup K L := by +- intro a ha +- change +- a ∈ (smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup +- rationalIdeleClassRepresentation at ha +- have haMap : +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm a ∈ +- ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup +- rationalIdeleClassRepresentation).map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom := +- ⟨a, ha, rfl⟩ +- have haOrdinary : +- (rationalAbstractFixedFieldIdeleClassEquivFixed L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm a ∈ +- (_root_.ideleClassNorm E N).range.toAddSubgroup := +- smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_mem_ordinaryNormRange +- K L _ haMap +- exact smallHilbertFiniteGaloisNormNeighborhood_ordinaryNorm_le K L haOrdinary +- +-/-- The canonical small-Hilbert subgroup of the actual middle fixed +-field is open in the genuine norm topology. -/ +-theorem smallHilbertNormSubgroupInRationalClassFormation_isNormOpen : +- IsNormOpen rationalIdeleClassRepresentation L.field +- (smallHilbertTowerMiddleNormSubgroup K L : +- Set +- (ambientFixedAddSubgroup +- rationalIdeleClassRepresentation L.field)) := by +- rw [normTopology_addSubgroup_isOpen_iff] +- refine +- ⟨smallHilbertFiniteGaloisNormNeighborhood K L, ?_⟩ +- change +- smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup K L ≤ +- smallHilbertTowerMiddleNormSubgroup K L +- exact smallHilbertFiniteGaloisNormNeighborhood_normSubgroup_le K L +- +-/-- The second small Hilbert class field as an actual finite abelian +-subextension of the literal first-stage field. -/ +-noncomputable def secondSmallHilbertClassFieldSubextension : +- FiniteAbelianSubextension L.field := by +- let H : FiniteAbelianSubextension.NormOpenAddSubgroup +- rationalIdeleClassRepresentation L.field := +- ⟨smallHilbertTowerMiddleNormSubgroup K L, +- smallHilbertNormSubgroupInRationalClassFormation_isNormOpen K L⟩ +- exact +- Classical.choose +- (FiniteAbelianSubextension.normSubgroupMap_surjective +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (smallHilbertTowerMiddleFiniteAbstractField K L) H) +- +-/-- The second-stage extension realizes exactly the canonical +-small-Hilbert norm subgroup of the actual middle field. -/ +-@[simp] +-theorem secondSmallHilbertClassFieldSubextension_normSubgroup : +- (secondSmallHilbertClassFieldSubextension K L).normSubgroup +- rationalIdeleClassRepresentation = +- smallHilbertTowerMiddleNormSubgroup K L := by +- let H : FiniteAbelianSubextension.NormOpenAddSubgroup +- rationalIdeleClassRepresentation L.field := +- ⟨smallHilbertTowerMiddleNormSubgroup K L, +- smallHilbertNormSubgroupInRationalClassFormation_isNormOpen K L⟩ +- have h := +- Classical.choose_spec +- (FiniteAbelianSubextension.normSubgroupMap_surjective +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (smallHilbertTowerMiddleFiniteAbstractField K L) H) +- exact congrArg Subtype.val h +- +-private noncomputable abbrev secondSmallHilbertClassFieldTopField : Type := +- abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (secondSmallHilbertClassFieldSubextension K L).below +- +-local notation "T₂" => secondSmallHilbertClassFieldTopField K L +- +-private noncomputable instance +- secondSmallHilbertClassFieldSubextensionQuotientFinite : +- Finite +- (L.field.toSubgroup ⧸ +- extensionSubgroup L.field +- (secondSmallHilbertClassFieldSubextension K L).field +- (secondSmallHilbertClassFieldSubextension K L).below) := +- (secondSmallHilbertClassFieldSubextension K L).finite +- +-private noncomputable instance +- secondSmallHilbertClassFieldTopFiniteDimensional : +- FiniteDimensional E T₂ := +- abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) L.field +- (secondSmallHilbertClassFieldSubextension K L).field +- (secondSmallHilbertClassFieldSubextension K L).below +- inferInstance inferInstance +- +-private noncomputable instance +- secondSmallHilbertClassFieldTopScalarTower : +- IsScalarTower ℚ E T₂ := +- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) +- +-private noncomputable instance +- secondSmallHilbertClassFieldTopAbsoluteFiniteDimensional : +- FiniteDimensional ℚ T₂ := +- FiniteDimensional.trans ℚ E T₂ +- +-private noncomputable instance +- secondSmallHilbertClassFieldTopNumberField : +- NumberField T₂ := +- NumberField.of_module_finite ℚ T₂ +- +-private noncomputable instance +- secondSmallHilbertClassFieldTopIsGalois : +- IsGalois E T₂ := +- abstractRelativeFixedField_isGalois +- ℚ (SeparableClosure ℚ) L.field +- (secondSmallHilbertClassFieldSubextension K L).field +- (secondSmallHilbertClassFieldSubextension K L).below +- (secondSmallHilbertClassFieldSubextension K L).normal +- +-private theorem +- secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_actualNormRange : +- ((secondSmallHilbertClassFieldSubextension K L).normSubgroup +- rationalIdeleClassRepresentation).map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = +- (_root_.ideleClassNorm E T₂).range.toAddSubgroup := by +- change +- (finiteNormSubgroup rationalIdeleClassRepresentation +- L.field +- (secondSmallHilbertClassFieldSubextension K L).field +- (secondSmallHilbertClassFieldSubextension K L).below).map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = +- (_root_.ideleClassNorm E T₂).range.toAddSubgroup +- exact +- map_rationalFiniteNormSubgroup_eq_ordinaryIdeleClassNormRange_concrete +- L.field +- (secondSmallHilbertClassFieldSubextension K L).field +- (secondSmallHilbertClassFieldSubextension K L).below +- (secondSmallHilbertClassFieldSubextension K L).normal +- +-private theorem +- secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_smallHilbertNormSubgroup : +- ((secondSmallHilbertClassFieldSubextension K L).normSubgroup +- rationalIdeleClassRepresentation).map +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = +- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup := by +- let e : Additive (IdeleClassGroup E) ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation L.field := +- rationalAbstractFixedFieldIdeleClassEquivFixed L.field +- (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L) +- let H : AddSubgroup (Additive (IdeleClassGroup E)) := +- (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup +- let back : AddSubgroup +- (ambientFixedAddSubgroup rationalIdeleClassRepresentation L.field) → +- AddSubgroup (Additive (IdeleClassGroup E)) := +- fun n => n.map e.symm.toAddMonoidHom +- have hNorm : +- back ((secondSmallHilbertClassFieldSubextension K L).normSubgroup +- rationalIdeleClassRepresentation) = +- back (smallHilbertTowerMiddleNormSubgroup K L) := +- congrArg back (secondSmallHilbertClassFieldSubextension_normSubgroup K L) +- have hCancel : back (smallHilbertTowerMiddleNormSubgroup K L) = H := +- AddSubgroup.map_comap_eq_self_of_surjective e.symm.surjective H +- exact hNorm.trans hCancel +- +-/-- The actual second small Hilbert class field has exactly the intrinsic +-small-Hilbert norm range over the literal middle fixed field. -/ +-@[simp] +-theorem secondSmallHilbertClassFieldSubextension_ideleClassNorm_range : +- (_root_.ideleClassNorm E T₂).range = +- smallHilbertClassFieldNormSubgroup (K := E) := by +- apply Subgroup.toAddSubgroup.injective +- exact +- (secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_actualNormRange +- K L).symm.trans +- (secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_smallHilbertNormSubgroup +- K L) + +-/-- Compatibility of the typed middle endpoint with the canonical endpoint +-used by the conjugation API. -/ +-theorem smallHilbertTowerMiddleNormSubgroup_eq_conjugationEndpoint : +- smallHilbertTowerMiddleNormSubgroup K L = +- smallHilbertNormSubgroupInRationalClassFormation +- (L.toFiniteGaloisExtension.toFiniteAbstractFieldExtension).field := by +- have hField : +- (L.toFiniteGaloisExtension.toFiniteAbstractFieldExtension).field.field = +- L.field := by +- rfl +- unfold smallHilbertNormSubgroupInRationalClassFormation +- cases hField +- exact smallHilbertTowerMiddleNormSubgroup_eq_map K L ++local notation "E" => abstractFixedField ℚ (SeparableClosure ℚ) L.field ++local notation "N" => smallHilbertClassFieldNormAmbient E + + end RationalFixedField + +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationBase.lean +new file mode 100644 +index 0000000..31a4787 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationBase.lean +@@ -0,0 +1,278 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.HilbertClassFieldRealization ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerConjugation ++import Mathlib.Data.Rat.Cast.Defs ++ ++ ++set_option autoImplicit false ++ ++/-! ++# Actual realization of the two-stage small Hilbert tower ++ ++The first small Hilbert class field is the actual finite abelian ++subextension selected in `HilbertClassFieldRealization`. Over its actual ++fixed field, the closed finite-index small-Hilbert norm subgroup has a ++finite Galois norm neighbourhood. We embed that neighbourhood in the ++rational separable closure compatibly with the already chosen first ++stage. Finite abelian classification then selects the second small ++Hilbert class field over the literal first-stage subgroup. ++ ++The compatibility of the embedding is essential: an unrelated chosen ++copy of the middle number field would produce a class field over a ++conjugate closed subgroup rather than over the first-stage subgroup ++itself. ++-/ ++ ++open scoped Classical NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace IdealClassFieldTheory ++ ++open AlgebraicNumberTheory ++open ClassFormation ++open CyclicCohomology ++open GlobalClassFields ++open KummerTheory ++open LocalClassFieldTheory ++open RamificationTheory ++open Reciprocity ++ ++/-- The ordinary idèle-class operations used by the two-stage transport, ++fixed at the canonical principal-subgroup quotient. -/ ++@[instance_reducible] ++noncomputable def smallHilbertTowerIdeleClassCommGroup ++ (F : Type) [Field F] [NumberField F] : ++ CommGroup (IdeleClassGroup F) := ++ QuotientGroup.Quotient.commGroup (IdeleGroup.principalSubgroup F) ++ ++attribute [local instance] smallHilbertTowerIdeleClassCommGroup ++ ++private theorem addSubgroup_comap_symm_eq_map ++ {A B : Type*} [AddGroup A] [AddGroup B] ++ (H : AddSubgroup A) (e : A ≃+ B) : ++ H.comap e.symm.toAddMonoidHom = ++ H.map e.toAddMonoidHom := by ++ exact (AddSubgroup.map_equiv_eq_comap_symm e H).symm ++ ++private noncomputable abbrev ++ closedFiniteIndexNormAmbientCanonicalBaseAlgebra ++ (F : Type) [Field F] [NumberField F] ++ (H : Subgroup (IdeleClassGroup F)) ++ (hclosed : IsClosed (H : Set (IdeleClassGroup F))) ++ [H.FiniteIndex] : ++ Algebra F ++ (closedFiniteIndexClassFieldNormAmbient ++ (K := F) H hclosed) := ++ inferInstance ++ ++section RationalFixedField ++ ++variable ++ (K : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (L : FiniteAbelianSubextension K.field) ++ ++/-- The finite abstract field attached to the intermediate field of the ++finite abelian extension, with finiteness obtained by transitivity. -/ ++noncomputable abbrev smallHilbertTowerMiddleFiniteAbstractField : ++ FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := ++ { field := L.field ++ finite := by ++ let : Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ K.field (le_baseField K.field)) := ++ K.finite ++ let : Finite ++ (K.field.toSubgroup ⧸ ++ extensionSubgroup K.field L.field L.below) := ++ L.finite ++ exact ++ FiniteGaloisSubextension.finite_extension_trans ++ L.below (le_baseField K.field) } ++ ++local notation "E" => ++ abstractFixedField ℚ (SeparableClosure ℚ) L.field ++ ++local notation "N" => ++ smallHilbertClassFieldNormAmbient E ++ ++noncomputable instance ++ smallHilbertTowerMiddleAbstractQuotientFinite : ++ Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ L.field (le_baseField L.field)) := ++ (smallHilbertTowerMiddleFiniteAbstractField K L).finite ++ ++private noncomputable instance ++ smallHilbertTowerMiddleFiniteDimensional : ++ FiniteDimensional ℚ E := ++ abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) L.field inferInstance ++ ++private noncomputable instance ++ smallHilbertTowerMiddleNumberField : ++ NumberField E := ++ NumberField.of_module_finite ℚ E ++ ++ ++/-- The small Hilbert norm subgroup of the intermediate number field, ++transported to its ambient fixed idele-class representation. -/ ++noncomputable def smallHilbertTowerMiddleNormSubgroup : ++ AddSubgroup ++ (ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation L.field) := ++ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup.comap ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom ++ ++/-- The typed `comap` endpoint is the canonical transported `map` endpoint. ++This uses only the generic additive equivalence law. -/ ++theorem smallHilbertTowerMiddleNormSubgroup_eq_map : ++ smallHilbertTowerMiddleNormSubgroup K L = ++ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup.map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).toAddMonoidHom := by ++ exact addSubgroup_comap_symm_eq_map ++ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup ++ (rationalAbstractFixedFieldIdeleClassEquivFixed L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)) ++ ++/-- The algebra structure of the intermediate field on its small Hilbert ++class-field norm ambient. -/ ++@[reducible] ++noncomputable def ++ smallHilbertTowerNormAmbientAlgebra : ++ Algebra E N := ++ closedFiniteIndexNormAmbientCanonicalBaseAlgebra E ++ (smallHilbertClassFieldNormSubgroup (K := E)) ++ (smallHilbertClassFieldNormSubgroup_isClosed (K := E)) ++ ++attribute [local instance] smallHilbertTowerNormAmbientAlgebra ++ ++/-- Scalar multiplication of the intermediate field on its small Hilbert ++class-field norm ambient. -/ ++@[reducible] ++noncomputable def ++ smallHilbertTowerNormAmbientSMul : ++ SMul E N := ++ Algebra.toSMul ++ (self := smallHilbertTowerNormAmbientAlgebra K L) ++ ++@[reducible] ++private noncomputable def ++ smallHilbertTowerNormAmbientModule : ++ Module E N := ++ @Algebra.toModule E N _ _ ++ (smallHilbertTowerNormAmbientAlgebra K L) ++ ++theorem ++ smallHilbertTowerNormAmbientScalarTower : ++ @IsScalarTower ℚ E N ++ (Algebra.toSMul (R := ℚ) (A := E)) ++ (smallHilbertTowerNormAmbientSMul K L) ++ (Algebra.toSMul (R := ℚ) (A := N)) := by ++ exact IsScalarTower.of_algebraMap_eq' ++ (R := ℚ) (S := E) (A := N) ++ (RingHom.ext_rat (algebraMap ℚ N) ++ ((algebraMap E N).comp (algebraMap ℚ E))) ++ ++/-- The rational algebra embedding of the intermediate field into its ++small Hilbert class-field norm ambient. -/ ++noncomputable def ++ smallHilbertTowerNormAmbientAlgHom : ++ E →ₐ[ℚ] N := ++ { toRingHom := algebraMap E N ++ commutes' := fun r => ++ (RingHom.congr_fun ++ (RingHom.ext_rat ++ ((algebraMap E N).comp (algebraMap ℚ E)) ++ (algebraMap ℚ N)) r) } ++ ++theorem smallHilbertTowerNormAmbientAlgHom_apply ++ (x : E) : ++ smallHilbertTowerNormAmbientAlgHom K L x = ++ algebraMap E N x := by ++ rfl ++ ++theorem ++ smallHilbertTowerNormAmbientIsGalois : ++ IsGalois E N := by ++ unfold smallHilbertClassFieldNormAmbient ++ closedFiniteIndexClassFieldNormAmbient ++ exact ++ closedFiniteIndexNormAmbientIsGalois ++ (smallHilbertClassFieldNormSubgroup (K := E)) ++ (smallHilbertClassFieldNormSubgroup_isClosed (K := E)) ++ ++attribute [local instance] smallHilbertTowerNormAmbientIsGalois ++ ++/-- The separable-closure automorphism extending the induced embedding ++of the intermediate field into the norm-neighborhood field. -/ ++noncomputable def ++ smallHilbertNormNeighborhoodForwardAlignment : ++ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := by ++ let j₀ : N →ₐ[ℚ] SeparableClosure ℚ := ++ numberFieldSeparableClosureEmbedding N ++ let i₀ : E →ₐ[ℚ] SeparableClosure ℚ := ++ j₀.comp (smallHilbertTowerNormAmbientAlgHom K L) ++ exact ++ AlgEquiv.ofBijective ++ (i₀.liftNormal (SeparableClosure ℚ)) ++ (AlgHom.normal_bijective ++ ℚ (SeparableClosure ℚ) (SeparableClosure ℚ) _) ++ ++/-- The separable-closure automorphism which aligns an arbitrary chosen ++embedding of the norm-neighbourhood field with the already embedded ++middle field. -/ ++noncomputable def ++ smallHilbertNormNeighborhoodAlignment : ++ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := ++ (smallHilbertNormNeighborhoodForwardAlignment K L).symm ++ ++@[simp] ++theorem smallHilbertNormNeighborhoodForwardAlignment_apply ++ (x : E) : ++ smallHilbertNormNeighborhoodForwardAlignment K L ++ (x : SeparableClosure ℚ) = ++ (numberFieldSeparableClosureEmbedding N) ++ (algebraMap E N x) := by ++ let j₀ : N →ₐ[ℚ] SeparableClosure ℚ := ++ numberFieldSeparableClosureEmbedding N ++ let i₀ : E →ₐ[ℚ] SeparableClosure ℚ := ++ j₀.comp (smallHilbertTowerNormAmbientAlgHom K L) ++ dsimp only [smallHilbertNormNeighborhoodForwardAlignment, ++ AlgEquiv.ofBijective_apply] ++ calc ++ _ = i₀ x := by ++ simpa only [IntermediateField.algebraMap_apply, ++ Algebra.algebraMap_self, RingHom.id_apply] using ++ i₀.liftNormal_commutes (SeparableClosure ℚ) x ++ _ = j₀ (algebraMap E N x) := by ++ change ++ j₀ (smallHilbertTowerNormAmbientAlgHom K L x) = ++ j₀ (algebraMap E N x) ++ exact congrArg j₀ ++ (smallHilbertTowerNormAmbientAlgHom_apply K L x) ++ ++ ++end RationalFixedField ++end IdealClassFieldTheory ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationEmbedding.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationEmbedding.lean +new file mode 100644 +index 0000000..b76d2bd +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationEmbedding.lean +@@ -0,0 +1,190 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerRealizationBase ++ ++set_option autoImplicit false ++ ++open scoped Classical NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace IdealClassFieldTheory ++ ++open AlgebraicNumberTheory ++open ClassFormation ++open CyclicCohomology ++open GlobalClassFields ++open KummerTheory ++open LocalClassFieldTheory ++open RamificationTheory ++open Reciprocity ++ ++ ++attribute [local instance] smallHilbertTowerIdeleClassCommGroup ++ smallHilbertTowerNormAmbientAlgebra ++ smallHilbertTowerNormAmbientIsGalois ++ ++section RationalFixedField ++ ++variable ++ (K : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (L : FiniteAbelianSubextension K.field) ++ ++ ++local notation "E" => abstractFixedField ℚ (SeparableClosure ℚ) L.field ++local notation "N" => smallHilbertClassFieldNormAmbient E ++ ++/-- A controlled embedding of the concrete finite Galois norm ++neighbourhood. Its restriction to the middle field is the literal ++inclusion of that fixed field in `SeparableClosure ℚ`. -/ ++noncomputable def ++ smallHilbertNormNeighborhoodEmbedding : ++ N →ₐ[ℚ] SeparableClosure ℚ := ++ (smallHilbertNormNeighborhoodAlignment K L).toAlgHom.comp ++ (numberFieldSeparableClosureEmbedding N) ++ ++@[simp] ++theorem smallHilbertNormNeighborhoodEmbedding_algebraMap ++ (x : E) : ++ smallHilbertNormNeighborhoodEmbedding K L ++ (algebraMap E N x) = ++ (x : SeparableClosure ℚ) := by ++ change ++ (smallHilbertNormNeighborhoodForwardAlignment K L).symm ++ ((numberFieldSeparableClosureEmbedding N) ++ (algebraMap E N x)) = ++ (x : SeparableClosure ℚ) ++ rw [← smallHilbertNormNeighborhoodForwardAlignment_apply K L x] ++ exact ++ (smallHilbertNormNeighborhoodForwardAlignment K L).symm_apply_apply _ ++ ++private abbrev smallHilbertNormNeighborhoodEmbeddedBase : ++ ClosedSubgroup ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange ++ ((smallHilbertNormNeighborhoodEmbedding K L).comp ++ (smallHilbertTowerNormAmbientAlgHom K L))) ++ ++private abbrev smallHilbertNormNeighborhoodEmbeddedField : ++ ClosedSubgroup ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange ++ (smallHilbertNormNeighborhoodEmbedding K L)) ++ ++private theorem smallHilbertNormNeighborhoodEmbeddedField_le_base : ++ (smallHilbertNormNeighborhoodEmbeddedField K L).toSubgroup ≤ ++ (smallHilbertNormNeighborhoodEmbeddedBase K L).toSubgroup := by ++ change ++ (AlgHom.fieldRange ++ (smallHilbertNormNeighborhoodEmbedding K L)).fixingSubgroup ≤ ++ (AlgHom.fieldRange ++ ((smallHilbertNormNeighborhoodEmbedding K L).comp ++ (smallHilbertTowerNormAmbientAlgHom K L))).fixingSubgroup ++ apply ++ (AlgHom.fieldRange ++ ((smallHilbertNormNeighborhoodEmbedding K L).comp ++ (smallHilbertTowerNormAmbientAlgHom K L))).fixingSubgroup_le ++ exact ++ AlgHom.range_comp_le_range ++ (smallHilbertTowerNormAmbientAlgHom K L) ++ (smallHilbertNormNeighborhoodEmbedding K L) ++ ++theorem smallHilbertNormNeighborhoodEmbeddedBase_eq : ++ smallHilbertNormNeighborhoodEmbeddedBase K L = L.field := by ++ have hi : ++ (smallHilbertNormNeighborhoodEmbedding K L).comp ++ (smallHilbertTowerNormAmbientAlgHom K L) = ++ (abstractFixedField ℚ (SeparableClosure ℚ) L.field).val := by ++ apply AlgHom.ext ++ intro x ++ change smallHilbertNormNeighborhoodEmbedding K L ++ (smallHilbertTowerNormAmbientAlgHom K L x) = (x : SeparableClosure ℚ) ++ rw [smallHilbertTowerNormAmbientAlgHom_apply K L x] ++ exact smallHilbertNormNeighborhoodEmbedding_algebraMap K L x ++ change ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange ++ ((smallHilbertNormNeighborhoodEmbedding K L).comp ++ (smallHilbertTowerNormAmbientAlgHom K L))) = ++ L.field ++ rw [hi, IntermediateField.fieldRange_val] ++ exact ++ closedFixingSubgroup_abstractFixedField_eq ++ ℚ (SeparableClosure ℚ) L.field ++ ++private noncomputable def ++ smallHilbertNormNeighborhoodSeparableClosureEquiv : ++ let j := smallHilbertNormNeighborhoodEmbedding K L ++ let i := j.comp (smallHilbertTowerNormAmbientAlgHom K L) ++ let : Algebra E (SeparableClosure ℚ) := ++ i.toRingHom.toAlgebra ++ SeparableClosure E ≃ₐ[E] SeparableClosure ℚ := by ++ intro j i alg ++ let : @IsScalarTower ℚ E (SeparableClosure ℚ) ++ (Algebra.toSMul (R := ℚ) (A := E)) ++ alg.toSMul ++ (Algebra.toSMul (R := ℚ) (A := SeparableClosure ℚ)) := ++ IsScalarTower.of_algebraMap_eq' i.comp_algebraMap.symm ++ let : IsSepClosure E (SeparableClosure ℚ) := ++ ⟨IsSepClosure.sep_closed ℚ, ++ Algebra.isSeparable_tower_top_of_isSeparable ++ ℚ E (SeparableClosure ℚ)⟩ ++ exact ++ IsSepClosure.equiv E ++ (SeparableClosure E) (SeparableClosure ℚ) ++ ++/-- The finite Galois extension given by the embedded small Hilbert ++norm-neighborhood field over the embedded intermediate field. -/ ++noncomputable def ++ smallHilbertFiniteGaloisNormNeighborhoodRaw : ++ FiniteGaloisSubextension ++ (smallHilbertNormNeighborhoodEmbeddedBase K L) := by ++ let : @IsScalarTower ℚ E N ++ (Algebra.toSMul (R := ℚ) (A := E)) ++ (smallHilbertTowerNormAmbientSMul K L) ++ (Algebra.toSMul (R := ℚ) (A := N)) := ++ smallHilbertTowerNormAmbientScalarTower K L ++ let j : N →ₐ[ℚ] SeparableClosure ℚ := ++ smallHilbertNormNeighborhoodEmbedding K L ++ let i : E →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ E N) ++ let B : ClosedSubgroup (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) i.fieldRange ++ let T : ClosedSubgroup (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := ++ smallHilbertNormNeighborhoodEmbeddedField K L ++ have hTB : T.toSubgroup ≤ B.toSubgroup := by ++ change j.fieldRange.fixingSubgroup ≤ i.fieldRange.fixingSubgroup ++ apply i.fieldRange.fixingSubgroup_le ++ exact AlgHom.range_comp_le_range (IsScalarTower.toAlgHom ℚ E N) j ++ let raw : FiniteGaloisSubextension B := { ++ field := T ++ below := hTB ++ normal := ambientEmbeddedExtensionSubgroup_normal ℚ E N j ++ (smallHilbertNormNeighborhoodSeparableClosureEquiv K L) ++ finite := ambientEmbeddedExtensionQuotient_finite ℚ E N j ++ (smallHilbertNormNeighborhoodSeparableClosureEquiv K L) } ++ have hi : IsScalarTower.toAlgHom ℚ E N = ++ smallHilbertTowerNormAmbientAlgHom K L := by ++ apply AlgHom.ext ++ intro x ++ exact (IsScalarTower.toAlgHom_apply ℚ E N x).trans ++ (smallHilbertTowerNormAmbientAlgHom_apply K L x).symm ++ have hB : B = smallHilbertNormNeighborhoodEmbeddedBase K L := ++ congrArg ++ (fun f : E →ₐ[ℚ] N => ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) (j.comp f).fieldRange) hi ++ exact hB ▸ raw ++ ++ ++end RationalFixedField ++end IdealClassFieldTheory ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationNorm.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationNorm.lean +new file mode 100644 +index 0000000..7c2a69a +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationNorm.lean +@@ -0,0 +1,272 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerRealizationEmbedding ++ ++set_option autoImplicit false ++ ++open scoped Classical NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace IdealClassFieldTheory ++ ++open AlgebraicNumberTheory ++open ClassFormation ++open CyclicCohomology ++open GlobalClassFields ++open KummerTheory ++open LocalClassFieldTheory ++open RamificationTheory ++open Reciprocity ++ ++ ++attribute [local instance] smallHilbertTowerIdeleClassCommGroup ++ smallHilbertTowerNormAmbientAlgebra ++ smallHilbertTowerNormAmbientIsGalois ++ ++section RationalFixedField ++ ++variable ++ (K : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (L : FiniteAbelianSubextension K.field) ++ ++ ++local notation "E" => abstractFixedField ℚ (SeparableClosure ℚ) L.field ++local notation "N" => smallHilbertClassFieldNormAmbient E ++ ++private noncomputable def rebaseFiniteGaloisSubextension ++ {G : Type} [Group G] [TopologicalSpace G] ++ {B B' : ClosedSubgroup G} (h : B = B') ++ (P : FiniteGaloisSubextension B) : ++ FiniteGaloisSubextension B' := ++ h ▸ P ++ ++@[simp] ++private theorem rebaseFiniteGaloisSubextension_field ++ {G : Type} [Group G] [TopologicalSpace G] ++ {B B' : ClosedSubgroup G} (h : B = B') ++ (P : FiniteGaloisSubextension B) : ++ (rebaseFiniteGaloisSubextension h P).field = P.field := by ++ cases h ++ rfl ++ ++private theorem ++ rebaseRationalFiniteGaloisSubextension_fixedField_eq ++ {B B' : ClosedSubgroup ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} ++ (h : B = B') (P : FiniteGaloisSubextension B) : ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (rebaseFiniteGaloisSubextension h P).below).restrictScalars ℚ = ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ P.below).restrictScalars ℚ := by ++ cases h ++ rfl ++ ++/-- An actual finite Galois norm neighbourhood over the literal ++first-stage subgroup. It is produced by the finite-index Kummer ++construction and the controlled embedding above. -/ ++noncomputable def smallHilbertFiniteGaloisNormNeighborhood : ++ FiniteGaloisSubextension L.field := ++ rebaseFiniteGaloisSubextension ++ (smallHilbertNormNeighborhoodEmbeddedBase_eq K L) ++ (smallHilbertFiniteGaloisNormNeighborhoodRaw K L) ++ ++ ++/-- The norm subgroup of the small Hilbert norm-neighborhood extension ++in the ambient fixed idele-class representation. -/ ++noncomputable def smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup : ++ AddSubgroup ++ (ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation L.field) := ++ (smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup ++ rationalIdeleClassRepresentation ++ ++/-- The relative fixed field realizing the top field of the small ++Hilbert norm-neighborhood extension. -/ ++noncomputable abbrev ++ smallHilbertFiniteGaloisNormNeighborhoodTopField : Type := ++ abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below ++ ++local notation "E₂" => ++ smallHilbertFiniteGaloisNormNeighborhoodTopField K L ++ ++private noncomputable instance ++ smallHilbertFiniteGaloisNormNeighborhoodQuotientFinite : ++ Finite ++ (L.field.toSubgroup ⧸ ++ extensionSubgroup L.field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below) := ++ (smallHilbertFiniteGaloisNormNeighborhood K L).finite ++ ++private noncomputable instance ++ smallHilbertFiniteGaloisNormNeighborhoodFiniteDimensional : ++ FiniteDimensional E E₂ := ++ abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) L.field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below ++ inferInstance inferInstance ++ ++private noncomputable instance ++ smallHilbertFiniteGaloisNormNeighborhoodScalarTower : ++ IsScalarTower ℚ E E₂ := ++ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) ++ ++private noncomputable instance ++ smallHilbertFiniteGaloisNormNeighborhoodAbsoluteFiniteDimensional : ++ FiniteDimensional ℚ E₂ := ++ FiniteDimensional.trans ℚ E E₂ ++ ++private noncomputable instance ++ smallHilbertFiniteGaloisNormNeighborhoodNumberField : ++ NumberField E₂ := ++ NumberField.of_module_finite ℚ E₂ ++ ++private noncomputable instance ++ smallHilbertFiniteGaloisNormNeighborhoodIsGalois : ++ IsGalois E E₂ := ++ abstractRelativeFixedField_isGalois ++ ℚ (SeparableClosure ℚ) L.field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below ++ (smallHilbertFiniteGaloisNormNeighborhood K L).normal ++ ++private theorem ++ smallHilbertFiniteGaloisNormNeighborhood_fixedField_eq_range : ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ = ++ AlgHom.fieldRange ++ (smallHilbertNormNeighborhoodEmbedding K L) := by ++ rw [show ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ = ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (smallHilbertFiniteGaloisNormNeighborhoodRaw K L).below).restrictScalars ℚ ++ from ++ rebaseRationalFiniteGaloisSubextension_fixedField_eq ++ (smallHilbertNormNeighborhoodEmbeddedBase_eq K L) ++ (smallHilbertFiniteGaloisNormNeighborhoodRaw K L)] ++ exact ++ InfiniteGalois.fixedField_fixingSubgroup ++ (AlgHom.fieldRange ++ (smallHilbertNormNeighborhoodEmbedding K L)) ++ ++private noncomputable def ++ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv : ++ N ≃ₐ[ℚ] ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below).restrictScalars ℚ := ++ (smallHilbertNormNeighborhoodEmbedding K L).equivFieldRange.trans ++ (IntermediateField.equivOfEq ++ (smallHilbertFiniteGaloisNormNeighborhood_fixedField_eq_range ++ K L).symm) ++ ++@[simp] ++private theorem ++ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv_algebraMap ++ (x : E) : ++ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv K L ++ (algebraMap E N x) = ++ algebraMap E ++ E₂ x := by ++ apply Subtype.ext ++ change ++ smallHilbertNormNeighborhoodEmbedding K L ++ (algebraMap E N x) = ++ (x : SeparableClosure ℚ) ++ exact smallHilbertNormNeighborhoodEmbedding_algebraMap K L x ++ ++private noncomputable def ++ smallHilbertFiniteGaloisNormNeighborhoodRelativeTopEquiv : ++ N ≃ₐ[E] E₂ := { ++ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv K L with ++ commutes' := fun x => ++ smallHilbertFiniteGaloisNormNeighborhoodTopEquiv_algebraMap ++ K L x } ++ ++theorem ++ smallHilbertFiniteGaloisNormNeighborhood_ordinaryNorm_le : ++ (_root_.ideleClassNorm E N).range ≤ ++ smallHilbertClassFieldNormSubgroup (K := E) := by ++ simpa only [smallHilbertClassFieldNormAmbient] using ++ (closedFiniteIndexClassFieldNormAmbient_normRange_le ++ (K := E) (smallHilbertClassFieldNormSubgroup (K := E)) ++ (smallHilbertClassFieldNormSubgroup_isClosed (K := E))) ++ ++private theorem ++ smallHilbertFiniteGaloisNormNeighborhood_ordinaryNormRange_eq : ++ (_root_.ideleClassNorm E N).range = ++ (_root_.ideleClassNorm E E₂).range := by ++ simpa only [ordinaryIdeleClassNorm_range_eq_relative] using ++ (ideleClassNorm_range_algEquiv ++ (K := E) ++ (smallHilbertFiniteGaloisNormNeighborhoodRelativeTopEquiv ++ K L)).symm ++ ++private theorem ++ smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq : ++ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup ++ rationalIdeleClassRepresentation).map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = ++ (_root_.ideleClassNorm E E₂).range.toAddSubgroup := by ++ change ++ (finiteNormSubgroup rationalIdeleClassRepresentation ++ L.field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below).map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = ++ (_root_.ideleClassNorm E E₂).range.toAddSubgroup ++ exact ++ (map_rationalFiniteNormSubgroup_eq_ordinaryIdeleClassNormRange_concrete ++ L.field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).field ++ (smallHilbertFiniteGaloisNormNeighborhood K L).below ++ (smallHilbertFiniteGaloisNormNeighborhood K L).normal) ++ ++/-- The abstract norm map lands directly in the ordinary norm range of the ++chosen neighbourhood. Composing the two named subgroup equalities here ++keeps downstream membership proofs pointwise. -/ ++private theorem ++ smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq_ordinaryNormRange : ++ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup ++ rationalIdeleClassRepresentation).map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = ++ (_root_.ideleClassNorm E N).range.toAddSubgroup := ++ (smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq K L).trans ++ (congrArg Subgroup.toAddSubgroup ++ (smallHilbertFiniteGaloisNormNeighborhood_ordinaryNormRange_eq K L).symm) ++ ++/-- Pointwise form of the combined norm-range equality. -/ ++theorem ++ smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_mem_ordinaryNormRange ++ (a : Additive (IdeleClassGroup E)) ++ (ha : ++ a ∈ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup ++ rationalIdeleClassRepresentation).map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom) : ++ a ∈ (_root_.ideleClassNorm E N).range.toAddSubgroup := ++ (le_of_eq ++ (smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_eq_ordinaryNormRange ++ K L)) ha ++ ++ ++end RationalFixedField ++end IdealClassFieldTheory ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationSecond.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationSecond.lean +new file mode 100644 +index 0000000..768d9b0 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/IdealClassFieldTheory/SmallHilbertTowerRealizationSecond.lean +@@ -0,0 +1,256 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.IdealClassFieldTheory.SmallHilbertTowerRealizationNorm ++ ++set_option autoImplicit false ++ ++open scoped Classical NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace IdealClassFieldTheory ++ ++open AlgebraicNumberTheory ++open ClassFormation ++open CyclicCohomology ++open GlobalClassFields ++open KummerTheory ++open LocalClassFieldTheory ++open RamificationTheory ++open Reciprocity ++ ++ ++attribute [local instance] smallHilbertTowerIdeleClassCommGroup ++ smallHilbertTowerNormAmbientAlgebra ++ smallHilbertTowerNormAmbientIsGalois ++ ++section RationalFixedField ++ ++variable ++ (K : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (L : FiniteAbelianSubextension K.field) ++ ++ ++local notation "E" => abstractFixedField ℚ (SeparableClosure ℚ) L.field ++local notation "N" => smallHilbertClassFieldNormAmbient E ++ ++local notation "E₂" => smallHilbertFiniteGaloisNormNeighborhoodTopField K L ++ ++/-- The actual finite Galois norm neighbourhood has abstract norm ++subgroup contained in the canonical small-Hilbert subgroup of the ++middle fixed field. This is the source-producing norm-topology input; ++no norm-openness premise is assumed. -/ ++theorem smallHilbertFiniteGaloisNormNeighborhood_normSubgroup_le : ++ ∀ a : ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation L.field, ++ a ∈ smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup K L → ++ a ∈ smallHilbertTowerMiddleNormSubgroup K L := by ++ intro a ha ++ change ++ a ∈ (smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup ++ rationalIdeleClassRepresentation at ha ++ have haMap : ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm a ∈ ++ ((smallHilbertFiniteGaloisNormNeighborhood K L).normSubgroup ++ rationalIdeleClassRepresentation).map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom := ++ ⟨a, ha, rfl⟩ ++ have haOrdinary : ++ (rationalAbstractFixedFieldIdeleClassEquivFixed L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm a ∈ ++ (_root_.ideleClassNorm E N).range.toAddSubgroup := ++ smallHilbertFiniteGaloisNormNeighborhood_abstractNormMap_mem_ordinaryNormRange ++ K L _ haMap ++ exact smallHilbertFiniteGaloisNormNeighborhood_ordinaryNorm_le K L haOrdinary ++ ++/-- The canonical small-Hilbert subgroup of the actual middle fixed ++field is open in the genuine norm topology. -/ ++theorem smallHilbertNormSubgroupInRationalClassFormation_isNormOpen : ++ IsNormOpen rationalIdeleClassRepresentation L.field ++ (smallHilbertTowerMiddleNormSubgroup K L : ++ Set ++ (ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation L.field)) := by ++ rw [normTopology_addSubgroup_isOpen_iff] ++ refine ++ ⟨smallHilbertFiniteGaloisNormNeighborhood K L, ?_⟩ ++ change ++ smallHilbertFiniteGaloisNormNeighborhoodNormSubgroup K L ≤ ++ smallHilbertTowerMiddleNormSubgroup K L ++ exact smallHilbertFiniteGaloisNormNeighborhood_normSubgroup_le K L ++ ++/-- The second small Hilbert class field as an actual finite abelian ++subextension of the literal first-stage field. -/ ++noncomputable def secondSmallHilbertClassFieldSubextension : ++ FiniteAbelianSubextension L.field := by ++ let H : FiniteAbelianSubextension.NormOpenAddSubgroup ++ rationalIdeleClassRepresentation L.field := ++ ⟨smallHilbertTowerMiddleNormSubgroup K L, ++ smallHilbertNormSubgroupInRationalClassFormation_isNormOpen K L⟩ ++ exact ++ Classical.choose ++ (FiniteAbelianSubextension.normSubgroupMap_surjective ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (smallHilbertTowerMiddleFiniteAbstractField K L) H) ++ ++/-- The second-stage extension realizes exactly the canonical ++small-Hilbert norm subgroup of the actual middle field. -/ ++@[simp] ++theorem secondSmallHilbertClassFieldSubextension_normSubgroup : ++ (secondSmallHilbertClassFieldSubextension K L).normSubgroup ++ rationalIdeleClassRepresentation = ++ smallHilbertTowerMiddleNormSubgroup K L := by ++ let H : FiniteAbelianSubextension.NormOpenAddSubgroup ++ rationalIdeleClassRepresentation L.field := ++ ⟨smallHilbertTowerMiddleNormSubgroup K L, ++ smallHilbertNormSubgroupInRationalClassFormation_isNormOpen K L⟩ ++ have h := ++ Classical.choose_spec ++ (FiniteAbelianSubextension.normSubgroupMap_surjective ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (smallHilbertTowerMiddleFiniteAbstractField K L) H) ++ exact congrArg Subtype.val h ++ ++private noncomputable abbrev secondSmallHilbertClassFieldTopField : Type := ++ abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (secondSmallHilbertClassFieldSubextension K L).below ++ ++local notation "T₂" => secondSmallHilbertClassFieldTopField K L ++ ++private noncomputable instance ++ secondSmallHilbertClassFieldSubextensionQuotientFinite : ++ Finite ++ (L.field.toSubgroup ⧸ ++ extensionSubgroup L.field ++ (secondSmallHilbertClassFieldSubextension K L).field ++ (secondSmallHilbertClassFieldSubextension K L).below) := ++ (secondSmallHilbertClassFieldSubextension K L).finite ++ ++private noncomputable instance ++ secondSmallHilbertClassFieldTopFiniteDimensional : ++ FiniteDimensional E T₂ := ++ abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) L.field ++ (secondSmallHilbertClassFieldSubextension K L).field ++ (secondSmallHilbertClassFieldSubextension K L).below ++ inferInstance inferInstance ++ ++private noncomputable instance ++ secondSmallHilbertClassFieldTopScalarTower : ++ IsScalarTower ℚ E T₂ := ++ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) ++ ++private noncomputable instance ++ secondSmallHilbertClassFieldTopAbsoluteFiniteDimensional : ++ FiniteDimensional ℚ T₂ := ++ FiniteDimensional.trans ℚ E T₂ ++ ++private noncomputable instance ++ secondSmallHilbertClassFieldTopNumberField : ++ NumberField T₂ := ++ NumberField.of_module_finite ℚ T₂ ++ ++private noncomputable instance ++ secondSmallHilbertClassFieldTopIsGalois : ++ IsGalois E T₂ := ++ abstractRelativeFixedField_isGalois ++ ℚ (SeparableClosure ℚ) L.field ++ (secondSmallHilbertClassFieldSubextension K L).field ++ (secondSmallHilbertClassFieldSubextension K L).below ++ (secondSmallHilbertClassFieldSubextension K L).normal ++ ++private theorem ++ secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_actualNormRange : ++ ((secondSmallHilbertClassFieldSubextension K L).normSubgroup ++ rationalIdeleClassRepresentation).map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = ++ (_root_.ideleClassNorm E T₂).range.toAddSubgroup := by ++ change ++ (finiteNormSubgroup rationalIdeleClassRepresentation ++ L.field ++ (secondSmallHilbertClassFieldSubextension K L).field ++ (secondSmallHilbertClassFieldSubextension K L).below).map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = ++ (_root_.ideleClassNorm E T₂).range.toAddSubgroup ++ exact ++ map_rationalFiniteNormSubgroup_eq_ordinaryIdeleClassNormRange_concrete ++ L.field ++ (secondSmallHilbertClassFieldSubextension K L).field ++ (secondSmallHilbertClassFieldSubextension K L).below ++ (secondSmallHilbertClassFieldSubextension K L).normal ++ ++private theorem ++ secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_smallHilbertNormSubgroup : ++ ((secondSmallHilbertClassFieldSubextension K L).normSubgroup ++ rationalIdeleClassRepresentation).map ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L)).symm.toAddMonoidHom = ++ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup := by ++ let e : Additive (IdeleClassGroup E) ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation L.field := ++ rationalAbstractFixedFieldIdeleClassEquivFixed L.field ++ (hfinite := smallHilbertTowerMiddleAbstractQuotientFinite K L) ++ let H : AddSubgroup (Additive (IdeleClassGroup E)) := ++ (smallHilbertClassFieldNormSubgroup (K := E)).toAddSubgroup ++ let back : AddSubgroup ++ (ambientFixedAddSubgroup rationalIdeleClassRepresentation L.field) → ++ AddSubgroup (Additive (IdeleClassGroup E)) := ++ fun n => n.map e.symm.toAddMonoidHom ++ have hNorm : ++ back ((secondSmallHilbertClassFieldSubextension K L).normSubgroup ++ rationalIdeleClassRepresentation) = ++ back (smallHilbertTowerMiddleNormSubgroup K L) := ++ congrArg back (secondSmallHilbertClassFieldSubextension_normSubgroup K L) ++ have hCancel : back (smallHilbertTowerMiddleNormSubgroup K L) = H := ++ AddSubgroup.map_comap_eq_self_of_surjective e.symm.surjective H ++ exact hNorm.trans hCancel ++ ++/-- The actual second small Hilbert class field has exactly the intrinsic ++small-Hilbert norm range over the literal middle fixed field. -/ ++@[simp] ++theorem secondSmallHilbertClassFieldSubextension_ideleClassNorm_range : ++ (_root_.ideleClassNorm E T₂).range = ++ smallHilbertClassFieldNormSubgroup (K := E) := by ++ apply Subgroup.toAddSubgroup.injective ++ exact ++ (secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_actualNormRange ++ K L).symm.trans ++ (secondSmallHilbertClassFieldSubextension_abstractNormMap_eq_smallHilbertNormSubgroup ++ K L) ++ ++/-- Compatibility of the typed middle endpoint with the canonical endpoint ++used by the conjugation API. -/ ++theorem smallHilbertTowerMiddleNormSubgroup_eq_conjugationEndpoint : ++ smallHilbertTowerMiddleNormSubgroup K L = ++ smallHilbertNormSubgroupInRationalClassFormation ++ (L.toFiniteGaloisExtension.toFiniteAbstractFieldExtension).field := by ++ have hField : ++ (L.toFiniteGaloisExtension.toFiniteAbstractFieldExtension).field.field = ++ L.field := by ++ rfl ++ unfold smallHilbertNormSubgroupInRationalClassFormation ++ cases hField ++ exact smallHilbertTowerMiddleNormSubgroup_eq_map K L ++ ++ ++end RationalFixedField ++end IdealClassFieldTheory ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidue.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidue.lean +index 8984e0a..3f1f8ad 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidue.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidue.lean +@@ -4,24 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidue ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidueFixedFields + +-set_option autoImplicit false +- +-/-! +-# Global norm residue on actual fixed fields + +-An abstract finite abelian subextension of the rational absolute Galois +-group determines an actual finite abelian extension between its two +-fixed number fields. This file transports the abstract norm-residue +-symbol directly to the ordinary idele-class norm quotient of those +-fixed fields. ++set_option autoImplicit false + +-Keeping this construction in one ambient separable closure is essential +-for the norm--restriction diagrams: no independently chosen embedding of +-either field is introduced. +--/ + + open scoped IsMulCommutative NumberField + open NumberField +@@ -38,1460 +25,26 @@ open AlgebraicNumberTheory + open LocalClassFieldTheory + open RamificationTheory + +-/-- The algebra structure on the rational separable closure induced by a +-specified rational field embedding. It is deliberately not an instance: +-different embeddings of the same field need not induce definitionally equal +-algebra structures. -/ +-@[reducible] +-noncomputable def rationalEmbeddingSeparableClosureAlgebra +- {F : Type} [Field F] [Algebra ℚ F] +- (i : F →ₐ[ℚ] SeparableClosure ℚ) : +- Algebra F (SeparableClosure ℚ) := +- i.toRingHom.toAlgebra +- +-/-- Two rational embeddings of the same number field into the fixed +-rational separable closure differ by an automorphism of that +-separable closure. -/ +-theorem exists_numberFieldEmbeddingComparisonAutomorphism +- {F : Type} [Field F] [NumberField F] +- (i j : F →ₐ[ℚ] SeparableClosure ℚ) : +- ∃ σ : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ, +- ∀ x : F, σ (i x) = j x := by +- let hAlgebra : Algebra F (SeparableClosure ℚ) := +- rationalEmbeddingSeparableClosureAlgebra i +- let hScalarTower : IsScalarTower ℚ F (SeparableClosure ℚ) := +- IsScalarTower.of_algebraMap_eq' i.comp_algebraMap.symm +- let hSeparable : Algebra.IsSeparable F (SeparableClosure ℚ) := +- Algebra.isSeparable_tower_top_of_isSeparable +- ℚ F (SeparableClosure ℚ) +- obtain ⟨φ, hφ⟩ := +- (IsSepClosed.surjective_domRestrict_of_isSeparable +- (K := ℚ) (L := F) +- (M := SeparableClosure ℚ) +- (E := SeparableClosure ℚ)) j +- let σ : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := +- AlgEquiv.ofBijective φ +- (Normal.toIsAlgebraic.algHom_bijective₂ +- φ (AlgHom.id ℚ (SeparableClosure ℚ))).1 +- refine ⟨σ, ?_⟩ +- intro x +- have hx := +- congrArg (fun ψ : F →ₐ[ℚ] SeparableClosure ℚ => ψ x) hφ +- exact hx +- +-/-- The canonical comparison automorphism between two rational +-embeddings of one number field into the fixed separable closure. -/ +-noncomputable def numberFieldEmbeddingComparisonAutomorphism +- {F : Type} [Field F] [NumberField F] +- (i j : F →ₐ[ℚ] SeparableClosure ℚ) : +- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := +- Classical.choose +- (exists_numberFieldEmbeddingComparisonAutomorphism i j) +- +-/-- The comparison automorphism carries the first embedded copy of the +-number field to the second one pointwise. -/ +-@[simp] +-theorem numberFieldEmbeddingComparisonAutomorphism_apply +- {F : Type} [Field F] [NumberField F] +- (i j : F →ₐ[ℚ] SeparableClosure ℚ) +- (x : F) : +- numberFieldEmbeddingComparisonAutomorphism i j (i x) = +- j x := +- Classical.choose_spec +- (exists_numberFieldEmbeddingComparisonAutomorphism i j) x +- +-/-- Conjugating the fixing subgroup of one embedded copy of a number +-field by the comparison automorphism gives the fixing subgroup of the +-other embedded copy. -/ +-theorem conjugateClosedFixingSubgroup_embeddingRange +- {F : Type} [Field F] [NumberField F] +- (i j : F →ₐ[ℚ] SeparableClosure ℚ) : +- conjugateClosedSubgroup +- (RamificationTheory.closedFixingSubgroup +- ℚ (SeparableClosure ℚ) i.fieldRange) +- (numberFieldEmbeddingComparisonAutomorphism j i) = +- RamificationTheory.closedFixingSubgroup +- ℚ (SeparableClosure ℚ) j.fieldRange := by +- let s := +- numberFieldEmbeddingComparisonAutomorphism j i +- ext τ +- change +- τ ∈ conjugateClosedSubgroup +- (closedFixingSubgroup ℚ (SeparableClosure ℚ) i.fieldRange) s ↔ +- τ ∈ closedFixingSubgroup ℚ (SeparableClosure ℚ) j.fieldRange +- rw [conjugateClosedSubgroup_mem] +- change +- s * τ * s⁻¹ ∈ i.fieldRange.fixingSubgroup ↔ +- τ ∈ j.fieldRange.fixingSubgroup +- rw [IntermediateField.mem_fixingSubgroup_iff, +- IntermediateField.mem_fixingSubgroup_iff] +- constructor +- · intro h x hx +- rcases hx with ⟨y, rfl⟩ +- have hi := h (i y) ⟨y, rfl⟩ +- have hs : +- s (j y) = i y := +- numberFieldEmbeddingComparisonAutomorphism_apply j i y +- change s (τ (s.symm (i y))) = i y at hi +- have hpre : s.symm (i y) = j y := by +- rw [← hs, s.symm_apply_apply] +- rw [hpre, ← hs] at hi +- exact s.injective hi +- · intro h x hx +- rcases hx with ⟨y, rfl⟩ +- have hj := h (j y) ⟨y, rfl⟩ +- have hs : +- s (j y) = i y := +- numberFieldEmbeddingComparisonAutomorphism_apply j i y +- change s (τ (s.symm (i y))) = i y +- have hpre : s.symm (i y) = j y := by +- rw [← hs, s.symm_apply_apply] +- rw [hpre, hj, hs] +- +-section EmbeddedNumberFieldRealization +- +-local instance numberFieldEmbeddedIdeleClassGroupIsMulCommutative +- {F : Type} [Field F] [NumberField F] +- : IsMulCommutative (IdeleClassGroup F) := +- ⟨⟨fun a b => mul_comm a b⟩⟩ +- +-local instance numberFieldEmbeddedIdeleClassSubgroupNormal +- {F : Type} [Field F] [NumberField F] +- (N : Subgroup (IdeleClassGroup F)) : N.Normal := +- N.normal_of_isMulCommutative +- +-variable +- (K L : Type) [Field K] [NumberField K] +- [Field L] [NumberField L] [Algebra K L] +- +-/-- The lower embedding obtained by restricting an explicitly supplied +-embedding of the top field into the rational separable closure. -/ +-noncomputable def numberFieldEmbeddedLowerEmbedding +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- K →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ K L) +- +-/-- The exact algebra structure on the rational separable closure induced by +-the lower embedding of an explicitly embedded number-field tower. Keeping +-this as a reducible definition lets every use of the associated separable- +-closure equivalence share one definitionally identical algebra structure. -/ +-@[reducible] +-noncomputable def numberFieldEmbeddedSeparableClosureAlgebra +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- Algebra K (SeparableClosure ℚ) := +- rationalEmbeddingSeparableClosureAlgebra +- (numberFieldEmbeddedLowerEmbedding K L j) +- +-/-- The fixing subgroup of the explicitly embedded lower field. -/ +-abbrev numberFieldEmbeddedBaseSubgroup +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- ClosedSubgroup +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := +- closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedLowerEmbedding K L j).fieldRange +- +-/-- The fixing subgroup of the explicitly embedded top field. -/ +-abbrev numberFieldEmbeddedTopSubgroup +- (_K L : Type) [Field L] [NumberField L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- ClosedSubgroup +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := +- closedFixingSubgroup ℚ (SeparableClosure ℚ) j.fieldRange +- +-/-- The top fixing subgroup lies in the lower fixing subgroup. -/ +-theorem numberFieldEmbeddedTopSubgroup_le_baseSubgroup +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- (numberFieldEmbeddedTopSubgroup K L j).toSubgroup ≤ +- (numberFieldEmbeddedBaseSubgroup K L j).toSubgroup := by +- change +- j.fieldRange.fixingSubgroup ≤ +- (numberFieldEmbeddedLowerEmbedding K L j).fieldRange.fixingSubgroup +- apply +- (numberFieldEmbeddedLowerEmbedding K L j).fieldRange.fixingSubgroup_le +- intro x hx +- rcases hx with ⟨y, rfl⟩ +- exact ⟨algebraMap K L y, rfl⟩ +- +-/-- The separable closure of the actual lower field, identified with +-the rational separable closure carrying the algebra structure induced +-by an explicit compatible embedding. -/ +-noncomputable def numberFieldEmbeddedSeparableClosureEquiv +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- letI : Algebra K (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra K L j +- SeparableClosure K ≃ₐ[K] SeparableClosure ℚ := by +- letI : Algebra K (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra K L j +- letI hScalarTower : IsScalarTower ℚ K (SeparableClosure ℚ) := +- IsScalarTower.of_algebraMap_eq' +- (numberFieldEmbeddedLowerEmbedding K L j).comp_algebraMap.symm +- letI hseparable : Algebra.IsSeparable K (SeparableClosure ℚ) := +- Algebra.isSeparable_tower_top_of_isSeparable +- ℚ K (SeparableClosure ℚ) +- letI hSepClosure : IsSepClosure K (SeparableClosure ℚ) := +- ⟨IsSepClosure.sep_closed ℚ, hseparable⟩ +- exact +- IsSepClosure.equiv K +- (SeparableClosure K) (SeparableClosure ℚ) +- +-/-- The relative subgroup arising from an explicit compatible +-number-field embedding is normal. -/ +-theorem numberFieldEmbeddedExtensionSubgroup_normal +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).Normal := by +- let i := numberFieldEmbeddedLowerEmbedding K L j +- let hAlgebra : Algebra K (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra K L j +- let e := numberFieldEmbeddedSeparableClosureEquiv K L j +- change +- (CyclicCohomology.extensionSubgroup +- (closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange i)) +- (closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange j)) _).Normal +- exact ambientEmbeddedExtensionSubgroup_normal ℚ K L j e +- +-/-- The normality witness for an explicitly embedded tower, registered at +-the precise subgroup used by the downstream quotient constructions. -/ +-noncomputable local instance +- numberFieldEmbeddedExtensionSubgroupNormal +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal K L j +- +-/-- The relative quotient arising from an explicit compatible +-number-field embedding is finite. -/ +-theorem numberFieldEmbeddedExtensionQuotient_finite +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- Finite +- ((numberFieldEmbeddedBaseSubgroup K L j).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := by +- let i := numberFieldEmbeddedLowerEmbedding K L j +- let hAlgebra : Algebra K (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra K L j +- let e := numberFieldEmbeddedSeparableClosureEquiv K L j +- change +- Finite +- ((closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange i)).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange i)) +- (closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange j)) _) +- exact ambientEmbeddedExtensionQuotient_finite ℚ K L j e +- +-/-- The relative-index witness for an explicitly embedded tower, registered +-at the exact quotient consumed by `FiniteNormQuotient`. -/ +-noncomputable local instance +- numberFieldEmbeddedExtensionQuotientFinite +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- Finite +- ((numberFieldEmbeddedBaseSubgroup K L j).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := +- numberFieldEmbeddedExtensionQuotient_finite K L j +- +-/-- The finite abstract field determined by the lower member of an +-explicitly embedded number-field tower. -/ +-noncomputable abbrev numberFieldEmbeddedFiniteAbstractField +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) where +- field := numberFieldEmbeddedBaseSubgroup K L j +- finite := by +- simpa only [numberFieldEmbeddedBaseSubgroup] using +- (ambientEmbeddedAbsoluteQuotientFinite +- ℚ K (numberFieldEmbeddedLowerEmbedding K L j)) +- +-/-- The absolute-index witness for the lower member of an explicitly embedded +-tower, registered at its specialized quotient type. -/ +-noncomputable local instance +- numberFieldEmbeddedAbsoluteQuotientFinite +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (numberFieldEmbeddedBaseSubgroup K L j) +- (le_baseField +- (numberFieldEmbeddedBaseSubgroup K L j))) := +- (numberFieldEmbeddedFiniteAbstractField K L j).finite +- +-/-- The finite Galois subextension determined by an explicitly embedded +-number-field tower. -/ +-noncomputable abbrev numberFieldEmbeddedFiniteGaloisSubextension +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteGaloisSubextension +- (numberFieldEmbeddedBaseSubgroup K L j) where +- field := numberFieldEmbeddedTopSubgroup K L j +- below := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j +- normal := numberFieldEmbeddedExtensionSubgroup_normal K L j +- finite := numberFieldEmbeddedExtensionQuotient_finite K L j +- +-/-- Shared finite-dimensional data for the fixed field of the lower subgroup +-in an explicitly embedded number-field tower. -/ +-noncomputable local instance +- numberFieldEmbeddedAbstractFixedFieldFiniteDimensional +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteDimensional ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) := +- abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedAbsoluteQuotientFinite K L j) +- +-/-- Shared relative finite-dimensional data for the two fixed fields of an +-explicitly embedded number-field tower. -/ +-noncomputable local instance +- numberFieldEmbeddedAbstractRelativeFixedFieldFiniteDimensional +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteDimensional +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := +- abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) +- (numberFieldEmbeddedAbsoluteQuotientFinite K L j) +- (numberFieldEmbeddedExtensionQuotientFinite K L j) +- +-local instance numberFieldEmbeddedAbstractFixedFieldScalarTower +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- IsScalarTower ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := +- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) +- +-noncomputable local instance +- numberFieldEmbeddedAbstractRelativeFixedFieldAbsoluteFiniteDimensional +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteDimensional ℚ +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := +- FiniteDimensional.trans ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) +- +-noncomputable local instance +- numberFieldEmbeddedAbstractFixedFieldNumberField +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- NumberField +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) := +- NumberField.of_module_finite ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) +- +-noncomputable local instance +- numberFieldEmbeddedAbstractRelativeFixedFieldNumberField +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- NumberField +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := +- NumberField.of_module_finite ℚ +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) +- +-noncomputable local instance +- numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsFiniteDimensional +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteDimensional ℚ +- ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := by +- change FiniteDimensional ℚ +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) +- infer_instance +- +-noncomputable local instance +- numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsNumberField +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- NumberField +- ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := +- NumberField.of_module_finite ℚ _ +- +-noncomputable local instance +- numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsAlgebra +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- Algebra +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) +- ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := +- (IntermediateField.inclusion +- (abstractFixedField_le ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j))).toRingHom.toAlgebra +- +-noncomputable local instance +- numberFieldEmbeddedAbstractRelativeFixedFieldIsGalois +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- IsGalois +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := +- abstractRelativeFixedField_isGalois +- ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) +- (numberFieldEmbeddedExtensionSubgroupNormal K L j) +- +-/-- The quotient of the two explicitly embedded fixing subgroups is +-the actual relative Galois group. -/ +-noncomputable def +- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient ≃* +- Gal(L / K) := by +- let i := numberFieldEmbeddedLowerEmbedding K L j +- letI hAlgebra : Algebra K (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra K L j +- let e := numberFieldEmbeddedSeparableClosureEquiv K L j +- let H₀ := +- closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange i) +- let J₀ := +- closedFixingSubgroup ℚ (SeparableClosure ℚ) +- (AlgHom.fieldRange j) +- let hJH : J₀.toSubgroup ≤ H₀.toSubgroup := by +- change j.fieldRange.fixingSubgroup ≤ i.fieldRange.fixingSubgroup +- apply i.fieldRange.fixingSubgroup_le +- intro x hx +- rcases hx with ⟨y, rfl⟩ +- exact ⟨algebraMap K L y, rfl⟩ +- letI : (CyclicCohomology.extensionSubgroup H₀ J₀ hJH).Normal := +- ambientEmbeddedExtensionSubgroup_normal ℚ K L j e +- change +- (H₀.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H₀ J₀ hJH) ≃* +- Gal(L / K) +- exact ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ K L j e +- +-/-- The original lower field is canonically equivalent to the fixed +-field of its explicitly embedded fixing subgroup. -/ +-noncomputable def numberFieldEmbeddedAbstractBaseFieldEquiv +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- K ≃ₐ[ℚ] +- abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j) := +- (numberFieldEmbeddedLowerEmbedding K L j).equivFieldRange.trans +- (IntermediateField.equivOfEq +- (InfiniteGalois.fixedField_fixingSubgroup +- (numberFieldEmbeddedLowerEmbedding K L j).fieldRange).symm) +- +-/-- The original top field is canonically equivalent to the relative +-fixed field of its explicitly embedded fixing subgroup. -/ +-noncomputable def numberFieldEmbeddedAbstractTopFieldEquiv +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- L ≃ₐ[ℚ] +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup +- K L j)).restrictScalars ℚ := +- j.equivFieldRange.trans +- (IntermediateField.equivOfEq +- (InfiniteGalois.fixedField_fixingSubgroup j.fieldRange).symm) +- +-/-- The two explicit fixed-field equivalences commute with the tower +-algebra maps. -/ +-@[simp] +-theorem numberFieldEmbeddedAbstractFieldEquiv_algebraMap +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (x : K) : +- numberFieldEmbeddedAbstractTopFieldEquiv K L j +- (algebraMap K L x) = +- algebraMap +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L j)) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j x) := by +- apply Subtype.ext +- rfl +- +-/-- The ordinary idele class group of the explicitly embedded lower +-field, transported to the fixed part of the rational absolute +-idele-class representation. -/ +-noncomputable def numberFieldEmbeddedIdeleClassEquivAmbientFixed +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- Additive (IdeleClassGroup K) ≃+ +- ambientFixedAddSubgroup +- rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j) := by +- let H := numberFieldEmbeddedBaseSubgroup K L j +- exact +- (MulEquiv.toAdditive +- (ideleClassCongr +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j))).trans +- (rationalAbstractFixedFieldIdeleClassEquivFixed H) +- +-/-- The abstract finite norm quotient of an explicitly embedded tower +-is its genuine ordinary idele-class norm quotient. -/ +-noncomputable def +- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteNormQuotient rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ≃+ +- Additive +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm K L).range) := by +- let hnormal := +- numberFieldEmbeddedExtensionSubgroupNormal K L j +- let H := numberFieldEmbeddedBaseSubgroup K L j +- let J := numberFieldEmbeddedTopSubgroup K L j +- let hJH := +- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j +- let fixedFieldEquiv := +- rationalFiniteNormQuotientEquivIdeleClassNormQuotient +- H J hJH hnormal +- let actualFieldEquiv := +- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) +- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) +- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) +- exact +- fixedFieldEquiv.trans +- (MulEquiv.toAdditive actualFieldEquiv.symm) +- +-private theorem numberFieldEmbeddedOrdinaryNormQuotientCongr_symm_mk +- {K₀ L₀ K₁ L₁ : Type} +- [Field K₀] [NumberField K₀] +- [Field L₀] [NumberField L₀] [Algebra K₀ L₀] +- [Field K₁] [NumberField K₁] +- [Field L₁] [NumberField L₁] [Algebra K₁ L₁] +- (eK : K₀ ≃ₐ[ℚ] K₁) +- (eL : L₀ ≃ₐ[ℚ] L₁) +- (h : ∀ x : K₀, +- eL (algebraMap K₀ L₀ x) = +- algebraMap K₁ L₁ (eK x)) +- (c : IdeleClassGroup K₁) : +- (ordinaryIdeleClassNormQuotientCongrOfAlgEquiv eK eL h).symm +- (QuotientGroup.mk' +- (_root_.ideleClassNorm K₁ L₁).range c) = +- QuotientGroup.mk' +- (_root_.ideleClassNorm K₀ L₀).range +- ((ideleClassCongr eK).symm c) := by +- let e := ordinaryIdeleClassNormQuotientCongrOfAlgEquiv eK eL h +- apply e.injective +- rw [e.apply_symm_apply, +- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv_mk, +- MulEquiv.apply_symm_apply] +- +-private noncomputable def numberFieldEmbeddedFiniteNormClassPublicValue +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j)) : +- Additive +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm K L).range) := +- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient +- K L j +- (finiteNormClass rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) +- a) +- +-private noncomputable def numberFieldEmbeddedFiniteNormClassExpectedValue +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j)) : +- Additive +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm K L).range) := +- Additive.ofMul +- (QuotientGroup.mk' +- (_root_.ideleClassNorm K L).range +- (Additive.toMul +- ((numberFieldEmbeddedIdeleClassEquivAmbientFixed K L j).symm a))) +- +-private noncomputable def +- numberFieldEmbeddedFiniteNormClassDirectComparisonValue +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j)) : +- Additive +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm K L).range) := by +- let hnormal := +- numberFieldEmbeddedExtensionSubgroupNormal K L j +- let H := numberFieldEmbeddedBaseSubgroup K L j +- let J := numberFieldEmbeddedTopSubgroup K L j +- let hJH := +- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j +- let fixedFieldEquiv := +- rationalFiniteNormQuotientEquivIdeleClassNormQuotient +- H J hJH hnormal +- let actualFieldEquiv := +- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) +- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) +- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) +- exact +- MulEquiv.toAdditive actualFieldEquiv.symm +- (fixedFieldEquiv +- (finiteNormClass rationalIdeleClassRepresentation +- H J hJH a)) +- +-private theorem +- numberFieldEmbeddedFiniteNormClassPublicValue_eq_directComparison +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j)) : +- numberFieldEmbeddedFiniteNormClassPublicValue K L j a = +- numberFieldEmbeddedFiniteNormClassDirectComparisonValue K L j a := by +- unfold numberFieldEmbeddedFiniteNormClassPublicValue +- unfold numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient +- unfold numberFieldEmbeddedFiniteNormClassDirectComparisonValue +- rfl +- +-private noncomputable def numberFieldEmbeddedActualNormClassRepresentativeValue +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j)) : +- Additive +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm K L).range) := by +- let H := numberFieldEmbeddedBaseSubgroup K L j +- let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j +- let F := abstractFixedField ℚ (SeparableClosure ℚ) H +- let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hJH +- let actualFieldEquiv := +- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) +- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) +- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) +- exact +- Additive.ofMul +- (actualFieldEquiv.symm +- (QuotientGroup.mk' +- (_root_.ideleClassNorm F E).range +- (Additive.toMul +- ((rationalAbstractFixedFieldIdeleClassEquivFixed H).symm a)))) +- +-private theorem +- numberFieldEmbeddedFiniteNormClassDirectComparison_eq_actualValue +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j)) : +- numberFieldEmbeddedFiniteNormClassDirectComparisonValue K L j a = +- numberFieldEmbeddedActualNormClassRepresentativeValue K L j a := by +- let hnormal := numberFieldEmbeddedExtensionSubgroupNormal K L j +- let H := numberFieldEmbeddedBaseSubgroup K L j +- let J := numberFieldEmbeddedTopSubgroup K L j +- let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j +- let actualFieldEquiv := +- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) +- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) +- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) +- have hfixed := +- rationalFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass +- H J hJH hnormal a +- unfold numberFieldEmbeddedFiniteNormClassDirectComparisonValue +- unfold numberFieldEmbeddedActualNormClassRepresentativeValue +- exact congrArg (MulEquiv.toAdditive actualFieldEquiv.symm) hfixed +- +-private theorem numberFieldEmbeddedActualNormClassRepresentativeValue_eq_expected +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j)) : +- numberFieldEmbeddedActualNormClassRepresentativeValue K L j a = +- numberFieldEmbeddedFiniteNormClassExpectedValue K L j a := by +- let H := numberFieldEmbeddedBaseSubgroup K L j +- let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j +- let F := abstractFixedField ℚ (SeparableClosure ℚ) H +- let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hJH +- let actualFieldEquiv := +- ordinaryIdeleClassNormQuotientCongrOfAlgEquiv +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) +- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) +- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) +- let c : IdeleClassGroup F := +- Additive.toMul +- ((rationalAbstractFixedFieldIdeleClassEquivFixed H).symm a) +- unfold numberFieldEmbeddedActualNormClassRepresentativeValue +- unfold numberFieldEmbeddedFiniteNormClassExpectedValue +- change +- Additive.ofMul +- (actualFieldEquiv.symm +- (QuotientGroup.mk' +- (_root_.ideleClassNorm F E).range c)) = +- Additive.ofMul +- (QuotientGroup.mk' +- (_root_.ideleClassNorm K L).range +- ((ideleClassCongr +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j)).symm c)) +- exact +- congrArg Additive.ofMul +- (numberFieldEmbeddedOrdinaryNormQuotientCongr_symm_mk +- (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) +- (numberFieldEmbeddedAbstractTopFieldEquiv K L j) +- (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) c) +- +-/-- On a finite norm-class representative, the explicit fixed-field +-comparison is the genuine ordinary idele-class quotient. -/ +-@[simp] +-theorem +- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j)) : +- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient K L j +- (finiteNormClass rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) a) = +- Additive.ofMul +- (QuotientGroup.mk' +- (_root_.ideleClassNorm K L).range +- (Additive.toMul +- ((numberFieldEmbeddedIdeleClassEquivAmbientFixed K L j).symm a))) := by +- change +- numberFieldEmbeddedFiniteNormClassPublicValue K L j a = +- numberFieldEmbeddedFiniteNormClassExpectedValue K L j a +- exact +- (numberFieldEmbeddedFiniteNormClassPublicValue_eq_directComparison +- K L j a).trans +- ((numberFieldEmbeddedFiniteNormClassDirectComparison_eq_actualValue +- K L j a).trans +- (numberFieldEmbeddedActualNormClassRepresentativeValue_eq_expected +- K L j a)) +- +-/-- On an ordinary idele class, the explicit fixed-part realization +-followed by the abstract finite norm-class map is the genuine quotient +-class modulo the ordinary idele-class norm. -/ +-@[simp] +-theorem +- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass +- [FiniteDimensional K L] [IsGalois K L] +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (c : IdeleClassGroup K) : +- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient K L j +- (finiteNormClass rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K L j (Additive.ofMul c))) = +- Additive.ofMul +- (QuotientGroup.mk' +- (_root_.ideleClassNorm K L).range c) := by +- simpa only [AddEquiv.symm_apply_apply, toMul_ofMul] using +- (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass +- K L j +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K L j (Additive.ofMul c))) +- +-variable [FiniteDimensional K L] [IsAbelianGalois K L] +- +-/-- The abelianized quotient of the explicitly embedded tower is the +-actual abelian Galois group. -/ +-noncomputable def +- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- Additive +- (Abelianization +- (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient) ≃+ +- Additive Gal(L / K) := +- MulEquiv.toAdditive +- ((MulEquiv.abelianizationCongr +- (numberFieldEmbeddedExtensionQuotientEquivGaloisGroup K L j)).trans +- (Abelianization.equivOfComm : +- Gal(L / K) ≃* +- Abelianization Gal(L / K)).symm) +- +-/-- The actual global norm-residue equivalence constructed from an +-explicit compatible embedding of a finite abelian number-field +-extension into the rational separable closure. -/ +-noncomputable def globalNormResidueEquivOfEmbedding +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- Additive +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm K L).range) ≃+ +- Additive Gal(L / K) := by +- let eNorm : +- FiniteNormQuotient rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ≃+ +- Additive +- (Abelianization +- (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient) := +- rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldEmbeddedFiniteAbstractField K L j) +- (numberFieldEmbeddedFiniteGaloisSubextension K L j) +- exact +- (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient +- K L j).symm.trans +- (eNorm.trans +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L j)) +- +-/-- The explicit-embedding norm-residue equivalence on a finite norm class. -/ +-theorem globalNormResidueEquivOfEmbedding_finiteNormClass +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (x : FiniteNormQuotient rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) : +- globalNormResidueEquivOfEmbedding K L j +- (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient +- K L j x) = +- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup K L j +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldEmbeddedFiniteAbstractField K L j) +- (numberFieldEmbeddedFiniteGaloisSubextension K L j) x) := by +- simp only [globalNormResidueEquivOfEmbedding, AddEquiv.trans_apply, +- AddEquiv.symm_apply_apply] +- +-/-- The global norm-residue homomorphism obtained from an explicit +-compatible embedding. -/ +-noncomputable def globalNormResidueMonoidHomOfEmbedding +- (j : L →ₐ[ℚ] SeparableClosure ℚ) : +- IdeleClassGroup K →* Gal(L / K) := by +- let e : +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm K L).range) ≃* +- Gal(L / K) := +- AddEquiv.toMultiplicative +- (globalNormResidueEquivOfEmbedding K L j) +- exact +- e.toMonoidHom.comp +- (QuotientGroup.mk' +- (_root_.ideleClassNorm K L).range) +- +-/-- Evaluation of the explicit-embedding global norm-residue map is +-the abstract norm-residue symbol evaluated on the corresponding genuine +-fixed-part finite norm class. -/ +-@[simp] +-theorem globalNormResidueMonoidHomOfEmbedding_apply +- (j : L →ₐ[ℚ] SeparableClosure ℚ) +- (c : IdeleClassGroup K) : +- globalNormResidueMonoidHomOfEmbedding K L j c = +- Additive.toMul +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L j +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldEmbeddedFiniteAbstractField K L j) +- (numberFieldEmbeddedFiniteGaloisSubextension K L j) +- (finiteNormClass rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup K L j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K L j (Additive.ofMul c))))) := by +- have hclass := +- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass +- K L j c +- change +- Additive.toMul +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L j +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldEmbeddedFiniteAbstractField K L j) +- (numberFieldEmbeddedFiniteGaloisSubextension K L j) +- ((numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient +- K L j).symm +- (Additive.ofMul +- (QuotientGroup.mk' +- (_root_.ideleClassNorm K L).range c))))) = +- _ +- rw [← hclass, +- (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient +- K L j).symm_apply_apply] +- +-omit [FiniteDimensional K L] [IsAbelianGalois K L] in +-/-- The ambient-fixed idèle-class transport for the standard embedding is +-the same map as the transport for an explicitly supplied embedding. This +-comparison is kept at the transport boundary, before forming norm quotients +-or applying reciprocity. -/ +-theorem numberFieldTowerIdeleClassEquivAmbientFixed_eq_embedded_standard : +- numberFieldTowerIdeleClassEquivAmbientFixed K L = +- numberFieldEmbeddedIdeleClassEquivAmbientFixed K L +- (numberFieldSeparableClosureEmbedding L) := by +- let j := numberFieldSeparableClosureEmbedding L +- have hBase : +- numberFieldTowerAbstractBaseFieldEquiv K L = +- numberFieldEmbeddedAbstractBaseFieldEquiv K L j := by +- rfl +- unfold numberFieldTowerIdeleClassEquivAmbientFixed +- numberFieldEmbeddedIdeleClassEquivAmbientFixed +- rw [hBase] +- dsimp only +- congr 1 +- +-/- At the chosen embedding, both constructions use the same fixed tower and +-abstract reciprocity data. We compare their values on the particular fixed +-idele class needed below; the two implementations of the finite norm-quotient +-equivalence are deliberately not compared as dependent structures. -/ +-private theorem numberFieldTowerNormResidueValue_eq_embedded_standard +- (c : IdeleClassGroup K) : +- numberFieldTowerAbelianizedExtensionQuotientEquivGaloisGroup K L +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldTowerReciprocityFiniteAbstractField K L) +- (numberFieldTowerFiniteGaloisSubextension K L) +- (finiteNormClass rationalIdeleClassRepresentation +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) +- (numberFieldTowerIdeleClassEquivAmbientFixed K L (Additive.ofMul c)))) = +- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L (numberFieldSeparableClosureEmbedding L) +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldEmbeddedFiniteAbstractField K L +- (numberFieldSeparableClosureEmbedding L)) +- (numberFieldEmbeddedFiniteGaloisSubextension K L +- (numberFieldSeparableClosureEmbedding L)) +- (finiteNormClass rationalIdeleClassRepresentation +- (numberFieldEmbeddedBaseSubgroup K L +- (numberFieldSeparableClosureEmbedding L)) +- (numberFieldEmbeddedTopSubgroup K L +- (numberFieldSeparableClosureEmbedding L)) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L +- (numberFieldSeparableClosureEmbedding L)) +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed K L +- (numberFieldSeparableClosureEmbedding L) (Additive.ofMul c)))) := by +- have hIdeleClassEquiv : +- numberFieldTowerIdeleClassEquivAmbientFixed K L = +- numberFieldEmbeddedIdeleClassEquivAmbientFixed K L +- (numberFieldSeparableClosureEmbedding L) := by +- exact numberFieldTowerIdeleClassEquivAmbientFixed_eq_embedded_standard K L +- have hFiniteAbstractField : +- numberFieldTowerReciprocityFiniteAbstractField K L = +- numberFieldEmbeddedFiniteAbstractField K L +- (numberFieldSeparableClosureEmbedding L) := by +- rfl +- have hSubextension : +- numberFieldTowerFiniteGaloisSubextension K L = +- numberFieldEmbeddedFiniteGaloisSubextension K L +- (numberFieldSeparableClosureEmbedding L) := by +- rfl +- have hGaloisComparison : +- numberFieldTowerAbelianizedExtensionQuotientEquivGaloisGroup K L = +- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L (numberFieldSeparableClosureEmbedding L) := by +- rfl +- simp only [← hGaloisComparison] +- cases hFiniteAbstractField +- cases hSubextension +- rw [← hIdeleClassEquiv] +- rfl +- +-/-- At the standard embedding, the two global norm-residue equivalences +-agree on the actual norm quotient. The comparison is extensional: it uses +-surjectivity of the quotient map and the established evaluation formulas, +-not definitional equality of the two quotient constructions. -/ +-theorem globalNormResidueEquiv_eq_ofEmbedding_standard : +- globalNormResidueEquiv K L = +- globalNormResidueEquivOfEmbedding K L +- (numberFieldSeparableClosureEmbedding L) := by +- apply AddEquiv.ext +- intro q +- obtain ⟨c, hc⟩ := +- QuotientGroup.mk'_surjective +- (_root_.ideleClassNorm K L).range (Additive.toMul q) +- have hq : +- Additive.ofMul +- (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c) = q := +- Additive.toMul.injective hc +- rw [← hq] +- have hTower := +- numberFieldTowerFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass +- K L c +- have hEmbedded := +- numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass +- K L (numberFieldSeparableClosureEmbedding L) c +- conv_lhs => +- rw [← hTower, globalNormResidueEquiv_finiteNormClass] +- conv_rhs => +- rw [← hEmbedded, globalNormResidueEquivOfEmbedding_finiteNormClass] +- exact numberFieldTowerNormResidueValue_eq_embedded_standard K L c +- +-/-- The existing global norm-residue map is the explicit-embedding +-construction for the standard chosen embedding of the top field. -/ +-theorem globalNormResidueMonoidHom_eq_ofEmbedding_standard : +- globalNormResidueMonoidHom K L = +- globalNormResidueMonoidHomOfEmbedding K L +- (numberFieldSeparableClosureEmbedding L) := by +- apply MonoidHom.ext +- intro c +- apply Additive.toMul.injective +- change +- globalNormResidueEquiv K L +- (Additive.ofMul +- (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c)) = +- globalNormResidueEquivOfEmbedding K L +- (numberFieldSeparableClosureEmbedding L) +- (Additive.ofMul +- (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c)) +- exact congrArg +- (fun e : +- Additive +- (IdeleClassGroup K ⧸ +- (_root_.ideleClassNorm K L).range) ≃+ +- Additive (Gal(L / K)) => +- e (Additive.ofMul +- (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c))) +- (globalNormResidueEquiv_eq_ofEmbedding_standard K L) +- +-end EmbeddedNumberFieldRealization +- +-section EmbeddedNumberFieldRestriction +- +-variable +- (K K' L L' : Type) +- [Field K] [NumberField K] +- [Field K'] [NumberField K'] +- [Field L] [NumberField L] +- [Field L'] [NumberField L'] +- [Algebra K K'] [Algebra K L] [Algebra K L'] +- [Algebra K' L'] [Algebra L L'] +- [IsScalarTower K K' L'] [IsScalarTower K L L'] +- +-/-- A compatible common embedding reverses the inclusion of the two base +-fields into an inclusion of their fixing subgroups. -/ +-theorem numberFieldEmbeddedBaseSubgroup_le_of_tower +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ L L') +- (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup ≤ +- (numberFieldEmbeddedBaseSubgroup K L jLower).toSubgroup := by +- dsimp only +- change +- (numberFieldEmbeddedLowerEmbedding K' L' j).fieldRange.fixingSubgroup ≤ +- (numberFieldEmbeddedLowerEmbedding K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).fieldRange.fixingSubgroup +- apply +- (numberFieldEmbeddedLowerEmbedding K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).fieldRange.fixingSubgroup_le +- intro x hx +- rcases hx with ⟨y, rfl⟩ +- refine ⟨algebraMap K K' y, ?_⟩ +- change +- j (algebraMap K' L' (algebraMap K K' y)) = +- j (algebraMap L L' (algebraMap K L y)) +- rw [← IsScalarTower.algebraMap_apply K K' L', +- ← IsScalarTower.algebraMap_apply K L L'] +- +-omit [Field K] [NumberField K] +- [Field K'] [NumberField K'] +- [Algebra K K'] [Algebra K L] [Algebra K L'] [Algebra K' L'] +- [IsScalarTower K K' L'] [IsScalarTower K L L'] in +-/-- A compatible common embedding reverses the inclusion of the two top +-fields into an inclusion of their fixing subgroups. -/ +-theorem numberFieldEmbeddedTopSubgroup_le_of_tower +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ L L') +- (numberFieldEmbeddedTopSubgroup K' L' j).toSubgroup ≤ +- (numberFieldEmbeddedTopSubgroup K L jLower).toSubgroup := by +- dsimp only +- change +- j.fieldRange.fixingSubgroup ≤ +- (j.comp +- (IsScalarTower.toAlgHom ℚ L L')).fieldRange.fixingSubgroup +- apply +- (j.comp +- (IsScalarTower.toAlgHom ℚ L L')).fieldRange.fixingSubgroup_le +- intro x hx +- rcases hx with ⟨y, rfl⟩ +- exact ⟨algebraMap L L' y, rfl⟩ +- +-end EmbeddedNumberFieldRestriction +- + variable + (K : FiniteAbstractField + (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) + (L : FiniteAbelianSubextension K.field) + +-local instance abstractFixedFieldBaseQuotientFinite : +- Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- K.field (le_baseField K.field)) := +- K.finite +- +-local instance abstractFixedFieldRelativeQuotientFinite : +- Finite +- (K.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup K.field L.field L.below) := +- L.finite +- +-local instance abstractFixedFieldRelativeQuotientIsMulCommutative : +- IsMulCommutative L.extensionQuotient := +- L.commutative + +-noncomputable local instance abstractFixedFieldFiniteDimensional : +- FiniteDimensional ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) := +- abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) K.field K.finite +- +-noncomputable local instance abstractRelativeFixedFieldFiniteDimensional : +- FiniteDimensional +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) := +- abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) +- K.field L.field L.below K.finite L.finite +- +-local instance abstractFixedFieldRelativeScalarTower : +- IsScalarTower ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) := +- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) +- +-noncomputable local instance abstractRelativeFixedFieldAbsoluteFiniteDimensional : +- FiniteDimensional ℚ +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) := +- FiniteDimensional.trans ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) +- +-noncomputable local instance abstractFixedFieldNumberField : +- NumberField +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) := +- NumberField.of_module_finite ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) +- +-/-- The lower fixed idèle-class group is commutative. Naming the mixin +-before the public quotient declarations avoids delayed normality synthesis +-inside their definition bodies. -/ +-local instance +- abstractFixedFieldIdeleClassGroupIsMulCommutative : +- IsMulCommutative +- (IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field)) := +- ⟨⟨fun a b => mul_comm a b⟩⟩ +- +-noncomputable local instance abstractRelativeFixedFieldNumberField : +- NumberField +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) := +- NumberField.of_module_finite ℚ +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) +- +-/-- Use the same explicit Galois witness as the fixed-field quotient +-comparison. Deriving it through `IsAbelianGalois` produces an equivalent +-but much larger dependent instance path. -/ +-noncomputable local instance +- abstractRelativeFixedFieldIsGalois : +- IsGalois +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) := +- abstractRelativeFixedField_isGalois +- ℚ (SeparableClosure ℚ) +- K.field L.field L.below L.normal +- +-noncomputable local instance abstractRelativeFixedFieldIsAbelianGalois : +- IsAbelianGalois +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) := +- finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois L +- +-/-- Use one opaque normality witness for the actual fixed-field norm range. +-This keeps every occurrence of its quotient group on the same instance path. -/ +-local instance +- abstractFixedFieldIdeleClassNormRangeNormal : +- ((_root_.ideleClassNorm +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below)).range).Normal := by +- infer_instance +- +-/-- The abelianized abstract extension quotient is the actual Galois +-group of the corresponding pair of fixed fields. -/ +-noncomputable def +- abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below +- Additive +- (Abelianization +- (FiniteGaloisSubextension.extensionQuotient +- L.toFiniteGaloisExtension)) ≃+ +- Additive (Gal(E / F)) := by +- dsimp only +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below +- let e : +- L.extensionQuotient ≃* +- Gal(E / F) := +- L.extensionQuotientMulEquiv.trans +- (abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) +- K.field L.field L.below L.normal) +- exact +- MulEquiv.toAdditive +- ((Abelianization.equivOfComm : +- L.extensionQuotient ≃* +- Abelianization L.extensionQuotient).symm.trans e) +- +-/-- The actual fixed-field global norm-residue equivalence +- +-`C_F / N_{E/F} C_E ≃ Gal(E/F)` +- +-attached to an abstract finite abelian subextension in the rational +-absolute class formation. -/ +-noncomputable def abstractFixedFieldGlobalNormResidueEquiv : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below +- Additive +- (IdeleClassGroup F ⧸ +- (_root_.ideleClassNorm F E).range) ≃+ +- Additive (Gal(E / F)) := by +- dsimp only +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below +- let eNorm : +- FiniteNormQuotient rationalIdeleClassRepresentation +- K.field L.field L.below ≃+ +- Additive +- (Abelianization L.toFiniteGaloisExtension.extensionQuotient) := +- rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- K L.toFiniteGaloisExtension +- exact +- (rationalFiniteNormQuotientEquivIdeleClassNormQuotient +- K.field L.field L.below L.normal).symm.trans +- (eNorm.trans +- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup +- K L)) +- +-/-- The abstract finite norm-residue equivalence with its dependent source +-instance fixed to the public finite norm quotient. -/ +-private noncomputable def abstractFixedFieldFiniteNormResidueGaloisEquiv : +- FiniteNormQuotient rationalIdeleClassRepresentation +- K.field L.field L.below ≃+ +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field))) := by +- letI : AddCommGroup +- (FiniteNormQuotient rationalIdeleClassRepresentation +- K.field L.field L.below) := +- finiteNormQuotientAddCommGroup rationalIdeleClassRepresentation +- K.field L.field L.below +- exact +- @AddEquiv.trans +- (FiniteNormQuotient rationalIdeleClassRepresentation +- K.field L.field L.below) +- (Additive +- (Abelianization +- L.toFiniteGaloisExtension.extensionQuotient)) +- (Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) K.field)))) +- inferInstance inferInstance inferInstance +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- K L.toFiniteGaloisExtension) +- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup +- K L) +- +-/-- The abstract norm-residue symbol on the fixed part of the rational +-absolute idele-class representation, with its value transported to the +-actual Galois group of the two fixed fields. This is the form consumed +-directly by the abstract norm--restriction naturality theorem. -/ +-noncomputable def ambientFixedGlobalNormResidueAddMonoidHom : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below +- ambientFixedAddSubgroup +- rationalIdeleClassRepresentation K.field →+ +- Additive (Gal(E / F)) := by +- dsimp only +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below +- exact +- (abstractFixedFieldFiniteNormResidueGaloisEquiv K L).toAddMonoidHom.comp +- (finiteNormClassHom rationalIdeleClassRepresentation +- K.field L.field L.below) +- +-/-- The ordinary idele class group of the lower fixed field, transported +-to the fixed part of the rational absolute idele-class representation. -/ +-private noncomputable def abstractFixedFieldIdeleClassToAmbientFixedMonoidHom : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- IdeleClassGroup F →* +- Multiplicative +- (ambientFixedAddSubgroup +- rationalIdeleClassRepresentation K.field) := +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- K.field).toAddMonoidHom.toMultiplicativeRight +- +-/-- The actual norm-residue homomorphism on the ordinary idele class +-group of the lower fixed field, constructed without choosing a second +-field embedding. -/ +-noncomputable def abstractFixedFieldGlobalNormResidueMonoidHom : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) L.below +- IdeleClassGroup F →* Gal(E / F) := +- (ambientFixedGlobalNormResidueAddMonoidHom K L).toMultiplicative.comp +- (abstractFixedFieldIdeleClassToAmbientFixedMonoidHom K) +- +-/-- Pointwise form of the ambient fixed-part norm-residue homomorphism. -/ +-private theorem ambientFixedGlobalNormResidueAddMonoidHom_apply +- (a : +- ambientFixedAddSubgroup +- rationalIdeleClassRepresentation K.field) : +- ambientFixedGlobalNormResidueAddMonoidHom K L a = +- abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup +- K L +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- K L.toFiniteGaloisExtension +- (finiteNormClass rationalIdeleClassRepresentation +- K.field L.field L.below a)) := by +- change +- abstractFixedFieldFiniteNormResidueGaloisEquiv K L +- (finiteNormClass rationalIdeleClassRepresentation +- K.field L.field L.below a) = _ +- rfl +- +-/-- Pointwise form of the transported fixed-field norm-residue homomorphism. -/ +-private theorem abstractFixedFieldGlobalNormResidueMonoidHom_apply : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) K.field +- ∀ c : IdeleClassGroup F, +- abstractFixedFieldGlobalNormResidueMonoidHom K L c = +- Additive.toMul +- (ambientFixedGlobalNormResidueAddMonoidHom K L +- ((rationalAbstractFixedFieldIdeleClassEquivFixed K.field) +- (Additive.ofMul c))) := by +- dsimp only +- intro c +- rfl +- +-/-- Transporting an ordinary fixed-field idele class to the ambient +-fixed part and applying the abstract norm-residue map gives exactly the +-actual fixed-field norm-residue value. -/ +-@[simp] +-theorem abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply +- (a : +- ambientFixedAddSubgroup +- rationalIdeleClassRepresentation K.field) : +- abstractFixedFieldGlobalNormResidueMonoidHom K L +- (Additive.toMul +- ((rationalAbstractFixedFieldIdeleClassEquivFixed +- K.field).symm a)) = +- Additive.toMul +- (ambientFixedGlobalNormResidueAddMonoidHom K L a) := by +- rw [abstractFixedFieldGlobalNormResidueMonoidHom_apply] +- change +- Additive.toMul +- (ambientFixedGlobalNormResidueAddMonoidHom K L +- ((rationalAbstractFixedFieldIdeleClassEquivFixed K.field) +- ((rationalAbstractFixedFieldIdeleClassEquivFixed +- K.field).symm a))) = +- Additive.toMul +- (ambientFixedGlobalNormResidueAddMonoidHom K L a) +- rw [(rationalAbstractFixedFieldIdeleClassEquivFixed +- K.field).apply_symm_apply] ++attribute [local instance] ++ abstractFixedFieldBaseQuotientFinite ++ abstractFixedFieldRelativeQuotientFinite ++ abstractFixedFieldRelativeQuotientIsMulCommutative ++ abstractFixedFieldFiniteDimensional ++ abstractRelativeFixedFieldFiniteDimensional ++ abstractFixedFieldRelativeScalarTower ++ abstractRelativeFixedFieldAbsoluteFiniteDimensional ++ abstractFixedFieldNumberField ++ abstractFixedFieldIdeleClassGroupIsMulCommutative ++ abstractRelativeFixedFieldNumberField ++ abstractRelativeFixedFieldIsGalois ++ abstractRelativeFixedFieldIsAbelianGalois ++ abstractFixedFieldIdeleClassNormRangeNormal + + /-- The ambient fixed-part reciprocity value vanishes precisely when its + finite norm class vanishes. -/ +@@ -1644,8 +197,7 @@ theorem abstractFixedFieldGlobalNormResidueMonoidHom_surjective : + rw [abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply, ha] + rfl + +-/-- The kernel of the fixed-field global norm-residue homomorphism is +-the genuine ordinary idele-class norm range. -/ ++ + @[simp] + theorem abstractFixedFieldGlobalNormResidueMonoidHom_ker : + (abstractFixedFieldGlobalNormResidueMonoidHom K L).ker = +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddedReciprocity.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddedReciprocity.lean +new file mode 100644 +index 0000000..c07e4ec +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddedReciprocity.lean +@@ -0,0 +1,386 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidueNormClasses ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++section EmbeddedNumberFieldRealization ++ ++variable ++ (K L : Type) [Field K] [NumberField K] ++ [Field L] [NumberField L] [Algebra K L] ++ ++ ++attribute [local instance] ++ numberFieldEmbeddedIdeleClassGroupIsMulCommutative ++ numberFieldEmbeddedIdeleClassSubgroupNormal ++ numberFieldEmbeddedExtensionSubgroupNormal ++ numberFieldEmbeddedExtensionQuotientFinite ++ numberFieldEmbeddedAbsoluteQuotientFinite ++ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional ++ numberFieldEmbeddedAbstractRelativeFixedFieldFiniteDimensional ++ numberFieldEmbeddedAbstractFixedFieldScalarTower ++ numberFieldEmbeddedAbstractRelativeFixedFieldAbsoluteFiniteDimensional ++ numberFieldEmbeddedAbstractFixedFieldNumberField ++ numberFieldEmbeddedAbstractRelativeFixedFieldNumberField ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsFiniteDimensional ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsNumberField ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsAlgebra ++ numberFieldEmbeddedAbstractRelativeFixedFieldIsGalois ++ ++variable [FiniteDimensional K L] [IsAbelianGalois K L] ++ ++/-- The abelianized quotient of the explicitly embedded tower is the ++actual abelian Galois group. -/ ++noncomputable def ++ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ Additive ++ (Abelianization ++ (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient) ≃+ ++ Additive Gal(L / K) := ++ MulEquiv.toAdditive ++ ((MulEquiv.abelianizationCongr ++ (numberFieldEmbeddedExtensionQuotientEquivGaloisGroup K L j)).trans ++ (Abelianization.equivOfComm : ++ Gal(L / K) ≃* ++ Abelianization Gal(L / K)).symm) ++ ++/-- The actual global norm-residue equivalence constructed from an ++explicit compatible embedding of a finite abelian number-field ++extension into the rational separable closure. -/ ++noncomputable def globalNormResidueEquivOfEmbedding ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ Additive ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm K L).range) ≃+ ++ Additive Gal(L / K) := by ++ let eNorm : ++ FiniteNormQuotient rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ≃+ ++ Additive ++ (Abelianization ++ (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient) := ++ rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldEmbeddedFiniteAbstractField K L j) ++ (numberFieldEmbeddedFiniteGaloisSubextension K L j) ++ exact ++ (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient ++ K L j).symm.trans ++ (eNorm.trans ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L j)) ++ ++/-- The explicit-embedding norm-residue equivalence on a finite norm class. -/ ++theorem globalNormResidueEquivOfEmbedding_finiteNormClass ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (x : FiniteNormQuotient rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) : ++ globalNormResidueEquivOfEmbedding K L j ++ (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient ++ K L j x) = ++ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup K L j ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldEmbeddedFiniteAbstractField K L j) ++ (numberFieldEmbeddedFiniteGaloisSubextension K L j) x) := by ++ simp only [globalNormResidueEquivOfEmbedding, AddEquiv.trans_apply, ++ AddEquiv.symm_apply_apply] ++ ++/-- The global norm-residue homomorphism obtained from an explicit ++compatible embedding. -/ ++noncomputable def globalNormResidueMonoidHomOfEmbedding ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ IdeleClassGroup K →* Gal(L / K) := by ++ let e : ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm K L).range) ≃* ++ Gal(L / K) := ++ AddEquiv.toMultiplicative ++ (globalNormResidueEquivOfEmbedding K L j) ++ exact ++ e.toMonoidHom.comp ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm K L).range) ++ ++/-- Evaluation of the explicit-embedding global norm-residue map is ++the abstract norm-residue symbol evaluated on the corresponding genuine ++fixed-part finite norm class. -/ ++@[simp] ++theorem globalNormResidueMonoidHomOfEmbedding_apply ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (c : IdeleClassGroup K) : ++ globalNormResidueMonoidHomOfEmbedding K L j c = ++ Additive.toMul ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L j ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldEmbeddedFiniteAbstractField K L j) ++ (numberFieldEmbeddedFiniteGaloisSubextension K L j) ++ (finiteNormClass rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K L j (Additive.ofMul c))))) := by ++ have hclass := ++ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass ++ K L j c ++ change ++ Additive.toMul ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L j ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldEmbeddedFiniteAbstractField K L j) ++ (numberFieldEmbeddedFiniteGaloisSubextension K L j) ++ ((numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient ++ K L j).symm ++ (Additive.ofMul ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm K L).range c))))) = ++ _ ++ rw [← hclass, ++ (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient ++ K L j).symm_apply_apply] ++ ++omit [FiniteDimensional K L] [IsAbelianGalois K L] in ++ ++ ++theorem numberFieldTowerIdeleClassEquivAmbientFixed_eq_embedded_standard : ++ numberFieldTowerIdeleClassEquivAmbientFixed K L = ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed K L ++ (numberFieldSeparableClosureEmbedding L) := by ++ let j := numberFieldSeparableClosureEmbedding L ++ have hBase : ++ numberFieldTowerAbstractBaseFieldEquiv K L = ++ numberFieldEmbeddedAbstractBaseFieldEquiv K L j := by ++ rfl ++ unfold numberFieldTowerIdeleClassEquivAmbientFixed ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ rw [hBase] ++ dsimp only ++ congr 1 ++ ++/- At the chosen embedding, both constructions use the same fixed tower and ++abstract reciprocity data. We compare their values on the particular fixed ++idele class needed below; the two implementations of the finite norm-quotient ++equivalence are deliberately not compared as dependent structures. -/ ++private theorem numberFieldTowerNormResidueValue_eq_embedded_standard ++ (c : IdeleClassGroup K) : ++ numberFieldTowerAbelianizedExtensionQuotientEquivGaloisGroup K L ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldTowerReciprocityFiniteAbstractField K L) ++ (numberFieldTowerFiniteGaloisSubextension K L) ++ (finiteNormClass rationalIdeleClassRepresentation ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) ++ (numberFieldTowerIdeleClassEquivAmbientFixed K L (Additive.ofMul c)))) = ++ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L (numberFieldSeparableClosureEmbedding L) ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldEmbeddedFiniteAbstractField K L ++ (numberFieldSeparableClosureEmbedding L)) ++ (numberFieldEmbeddedFiniteGaloisSubextension K L ++ (numberFieldSeparableClosureEmbedding L)) ++ (finiteNormClass rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L ++ (numberFieldSeparableClosureEmbedding L)) ++ (numberFieldEmbeddedTopSubgroup K L ++ (numberFieldSeparableClosureEmbedding L)) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L ++ (numberFieldSeparableClosureEmbedding L)) ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed K L ++ (numberFieldSeparableClosureEmbedding L) (Additive.ofMul c)))) := by ++ have hIdeleClassEquiv : ++ numberFieldTowerIdeleClassEquivAmbientFixed K L = ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed K L ++ (numberFieldSeparableClosureEmbedding L) := by ++ exact numberFieldTowerIdeleClassEquivAmbientFixed_eq_embedded_standard K L ++ have hFiniteAbstractField : ++ numberFieldTowerReciprocityFiniteAbstractField K L = ++ numberFieldEmbeddedFiniteAbstractField K L ++ (numberFieldSeparableClosureEmbedding L) := by ++ rfl ++ have hSubextension : ++ numberFieldTowerFiniteGaloisSubextension K L = ++ numberFieldEmbeddedFiniteGaloisSubextension K L ++ (numberFieldSeparableClosureEmbedding L) := by ++ rfl ++ have hGaloisComparison : ++ numberFieldTowerAbelianizedExtensionQuotientEquivGaloisGroup K L = ++ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L (numberFieldSeparableClosureEmbedding L) := by ++ rfl ++ simp only [← hGaloisComparison] ++ cases hFiniteAbstractField ++ cases hSubextension ++ rw [← hIdeleClassEquiv] ++ rfl ++ ++/-- At the standard embedding, the two global norm-residue equivalences ++agree on the actual norm quotient. The comparison is extensional: it uses ++surjectivity of the quotient map and the established evaluation formulas, ++not definitional equality of the two quotient constructions. -/ ++theorem globalNormResidueEquiv_eq_ofEmbedding_standard : ++ globalNormResidueEquiv K L = ++ globalNormResidueEquivOfEmbedding K L ++ (numberFieldSeparableClosureEmbedding L) := by ++ apply AddEquiv.ext ++ intro q ++ obtain ⟨c, hc⟩ := ++ QuotientGroup.mk'_surjective ++ (_root_.ideleClassNorm K L).range (Additive.toMul q) ++ have hq : ++ Additive.ofMul ++ (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c) = q := ++ Additive.toMul.injective hc ++ rw [← hq] ++ have hTower := ++ numberFieldTowerFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass ++ K L c ++ have hEmbedded := ++ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass ++ K L (numberFieldSeparableClosureEmbedding L) c ++ conv_lhs => ++ rw [← hTower, globalNormResidueEquiv_finiteNormClass] ++ conv_rhs => ++ rw [← hEmbedded, globalNormResidueEquivOfEmbedding_finiteNormClass] ++ exact numberFieldTowerNormResidueValue_eq_embedded_standard K L c ++ ++/-- The existing global norm-residue map is the explicit-embedding ++construction for the standard chosen embedding of the top field. -/ ++theorem globalNormResidueMonoidHom_eq_ofEmbedding_standard : ++ globalNormResidueMonoidHom K L = ++ globalNormResidueMonoidHomOfEmbedding K L ++ (numberFieldSeparableClosureEmbedding L) := by ++ apply MonoidHom.ext ++ intro c ++ apply Additive.toMul.injective ++ change ++ globalNormResidueEquiv K L ++ (Additive.ofMul ++ (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c)) = ++ globalNormResidueEquivOfEmbedding K L ++ (numberFieldSeparableClosureEmbedding L) ++ (Additive.ofMul ++ (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c)) ++ exact congrArg ++ (fun e : ++ Additive ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm K L).range) ≃+ ++ Additive (Gal(L / K)) => ++ e (Additive.ofMul ++ (QuotientGroup.mk' (_root_.ideleClassNorm K L).range c))) ++ (globalNormResidueEquiv_eq_ofEmbedding_standard K L) ++ ++end EmbeddedNumberFieldRealization ++ ++section EmbeddedNumberFieldRestriction ++ ++variable ++ (K K' L L' : Type) ++ [Field K] [NumberField K] ++ [Field K'] [NumberField K'] ++ [Field L] [NumberField L] ++ [Field L'] [NumberField L'] ++ [Algebra K K'] [Algebra K L] [Algebra K L'] ++ [Algebra K' L'] [Algebra L L'] ++ [IsScalarTower K K' L'] [IsScalarTower K L L'] ++ ++/-- A compatible common embedding reverses the inclusion of the two base ++fields into an inclusion of their fixing subgroups. -/ ++theorem numberFieldEmbeddedBaseSubgroup_le_of_tower ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ L L') ++ (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup ≤ ++ (numberFieldEmbeddedBaseSubgroup K L jLower).toSubgroup := by ++ dsimp only ++ change ++ (numberFieldEmbeddedLowerEmbedding K' L' j).fieldRange.fixingSubgroup ≤ ++ (numberFieldEmbeddedLowerEmbedding K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).fieldRange.fixingSubgroup ++ apply ++ (numberFieldEmbeddedLowerEmbedding K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).fieldRange.fixingSubgroup_le ++ intro x hx ++ rcases hx with ⟨y, rfl⟩ ++ refine ⟨algebraMap K K' y, ?_⟩ ++ change ++ j (algebraMap K' L' (algebraMap K K' y)) = ++ j (algebraMap L L' (algebraMap K L y)) ++ rw [← IsScalarTower.algebraMap_apply K K' L', ++ ← IsScalarTower.algebraMap_apply K L L'] ++ ++omit [Field K] [NumberField K] ++ [Field K'] [NumberField K'] ++ [Algebra K K'] [Algebra K L] [Algebra K L'] [Algebra K' L'] ++ [IsScalarTower K K' L'] [IsScalarTower K L L'] in ++/-- A compatible common embedding reverses the inclusion of the two top ++fields into an inclusion of their fixing subgroups. -/ ++theorem numberFieldEmbeddedTopSubgroup_le_of_tower ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ L L') ++ (numberFieldEmbeddedTopSubgroup K' L' j).toSubgroup ≤ ++ (numberFieldEmbeddedTopSubgroup K L jLower).toSubgroup := by ++ dsimp only ++ change ++ j.fieldRange.fixingSubgroup ≤ ++ (j.comp ++ (IsScalarTower.toAlgHom ℚ L L')).fieldRange.fixingSubgroup ++ apply ++ (j.comp ++ (IsScalarTower.toAlgHom ℚ L L')).fieldRange.fixingSubgroup_le ++ intro x hx ++ rcases hx with ⟨y, rfl⟩ ++ exact ⟨algebraMap L L' y, rfl⟩ ++ ++end EmbeddedNumberFieldRestriction ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddings.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddings.lean +new file mode 100644 +index 0000000..2451e8f +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueEmbeddings.lean +@@ -0,0 +1,586 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidue ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++/-- The algebra structure on the rational separable closure induced by a ++specified rational field embedding. It is deliberately not an instance: ++different embeddings of the same field need not induce definitionally equal ++algebra structures. -/ ++@[reducible] ++noncomputable def rationalEmbeddingSeparableClosureAlgebra ++ {F : Type} [Field F] [Algebra ℚ F] ++ (i : F →ₐ[ℚ] SeparableClosure ℚ) : ++ Algebra F (SeparableClosure ℚ) := ++ i.toRingHom.toAlgebra ++ ++/-- Two rational embeddings of the same number field into the fixed ++rational separable closure differ by an automorphism of that ++separable closure. -/ ++theorem exists_numberFieldEmbeddingComparisonAutomorphism ++ {F : Type} [Field F] [NumberField F] ++ (i j : F →ₐ[ℚ] SeparableClosure ℚ) : ++ ∃ σ : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ, ++ ∀ x : F, σ (i x) = j x := by ++ let hAlgebra : Algebra F (SeparableClosure ℚ) := ++ rationalEmbeddingSeparableClosureAlgebra i ++ let hScalarTower : IsScalarTower ℚ F (SeparableClosure ℚ) := ++ IsScalarTower.of_algebraMap_eq' i.comp_algebraMap.symm ++ let hSeparable : Algebra.IsSeparable F (SeparableClosure ℚ) := ++ Algebra.isSeparable_tower_top_of_isSeparable ++ ℚ F (SeparableClosure ℚ) ++ obtain ⟨φ, hφ⟩ := ++ (IsSepClosed.surjective_domRestrict_of_isSeparable ++ (K := ℚ) (L := F) ++ (M := SeparableClosure ℚ) ++ (E := SeparableClosure ℚ)) j ++ let σ : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := ++ AlgEquiv.ofBijective φ ++ (Normal.toIsAlgebraic.algHom_bijective₂ ++ φ (AlgHom.id ℚ (SeparableClosure ℚ))).1 ++ refine ⟨σ, ?_⟩ ++ intro x ++ have hx := ++ congrArg (fun ψ : F →ₐ[ℚ] SeparableClosure ℚ => ψ x) hφ ++ exact hx ++ ++/-- The canonical comparison automorphism between two rational ++embeddings of one number field into the fixed separable closure. -/ ++noncomputable def numberFieldEmbeddingComparisonAutomorphism ++ {F : Type} [Field F] [NumberField F] ++ (i j : F →ₐ[ℚ] SeparableClosure ℚ) : ++ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ := ++ Classical.choose ++ (exists_numberFieldEmbeddingComparisonAutomorphism i j) ++ ++/-- The comparison automorphism carries the first embedded copy of the ++number field to the second one pointwise. -/ ++@[simp] ++theorem numberFieldEmbeddingComparisonAutomorphism_apply ++ {F : Type} [Field F] [NumberField F] ++ (i j : F →ₐ[ℚ] SeparableClosure ℚ) ++ (x : F) : ++ numberFieldEmbeddingComparisonAutomorphism i j (i x) = ++ j x := ++ Classical.choose_spec ++ (exists_numberFieldEmbeddingComparisonAutomorphism i j) x ++ ++/-- Conjugating the fixing subgroup of one embedded copy of a number ++field by the comparison automorphism gives the fixing subgroup of the ++other embedded copy. -/ ++theorem conjugateClosedFixingSubgroup_embeddingRange ++ {F : Type} [Field F] [NumberField F] ++ (i j : F →ₐ[ℚ] SeparableClosure ℚ) : ++ conjugateClosedSubgroup ++ (RamificationTheory.closedFixingSubgroup ++ ℚ (SeparableClosure ℚ) i.fieldRange) ++ (numberFieldEmbeddingComparisonAutomorphism j i) = ++ RamificationTheory.closedFixingSubgroup ++ ℚ (SeparableClosure ℚ) j.fieldRange := by ++ let s := ++ numberFieldEmbeddingComparisonAutomorphism j i ++ ext τ ++ change ++ τ ∈ conjugateClosedSubgroup ++ (closedFixingSubgroup ℚ (SeparableClosure ℚ) i.fieldRange) s ↔ ++ τ ∈ closedFixingSubgroup ℚ (SeparableClosure ℚ) j.fieldRange ++ rw [conjugateClosedSubgroup_mem] ++ change ++ s * τ * s⁻¹ ∈ i.fieldRange.fixingSubgroup ↔ ++ τ ∈ j.fieldRange.fixingSubgroup ++ rw [IntermediateField.mem_fixingSubgroup_iff, ++ IntermediateField.mem_fixingSubgroup_iff] ++ constructor ++ · intro h x hx ++ rcases hx with ⟨y, rfl⟩ ++ have hi := h (i y) ⟨y, rfl⟩ ++ have hs : ++ s (j y) = i y := ++ numberFieldEmbeddingComparisonAutomorphism_apply j i y ++ change s (τ (s.symm (i y))) = i y at hi ++ have hpre : s.symm (i y) = j y := by ++ rw [← hs, s.symm_apply_apply] ++ rw [hpre, ← hs] at hi ++ exact s.injective hi ++ · intro h x hx ++ rcases hx with ⟨y, rfl⟩ ++ have hj := h (j y) ⟨y, rfl⟩ ++ have hs : ++ s (j y) = i y := ++ numberFieldEmbeddingComparisonAutomorphism_apply j i y ++ change s (τ (s.symm (i y))) = i y ++ have hpre : s.symm (i y) = j y := by ++ rw [← hs, s.symm_apply_apply] ++ rw [hpre, hj, hs] ++ ++section EmbeddedNumberFieldRealization ++ ++local instance numberFieldEmbeddedIdeleClassGroupIsMulCommutative ++ {F : Type} [Field F] [NumberField F] ++ : IsMulCommutative (IdeleClassGroup F) := ++ ⟨⟨fun a b => mul_comm a b⟩⟩ ++ ++local instance numberFieldEmbeddedIdeleClassSubgroupNormal ++ {F : Type} [Field F] [NumberField F] ++ (N : Subgroup (IdeleClassGroup F)) : N.Normal := ++ N.normal_of_isMulCommutative ++ ++variable ++ (K L : Type) [Field K] [NumberField K] ++ [Field L] [NumberField L] [Algebra K L] ++ ++/-- The lower embedding obtained by restricting an explicitly supplied ++embedding of the top field into the rational separable closure. -/ ++noncomputable def numberFieldEmbeddedLowerEmbedding ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ K →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ K L) ++ ++/-- The exact algebra structure on the rational separable closure induced by ++the lower embedding of an explicitly embedded number-field tower. Keeping ++this as a reducible definition lets every use of the associated separable- ++closure equivalence share one definitionally identical algebra structure. -/ ++@[reducible] ++noncomputable def numberFieldEmbeddedSeparableClosureAlgebra ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ Algebra K (SeparableClosure ℚ) := ++ rationalEmbeddingSeparableClosureAlgebra ++ (numberFieldEmbeddedLowerEmbedding K L j) ++ ++/-- The fixing subgroup of the explicitly embedded lower field. -/ ++abbrev numberFieldEmbeddedBaseSubgroup ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ ClosedSubgroup ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedLowerEmbedding K L j).fieldRange ++ ++/-- The fixing subgroup of the explicitly embedded top field. -/ ++abbrev numberFieldEmbeddedTopSubgroup ++ (_K L : Type) [Field L] [NumberField L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ ClosedSubgroup ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) j.fieldRange ++ ++/-- The top fixing subgroup lies in the lower fixing subgroup. -/ ++theorem numberFieldEmbeddedTopSubgroup_le_baseSubgroup ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ (numberFieldEmbeddedTopSubgroup K L j).toSubgroup ≤ ++ (numberFieldEmbeddedBaseSubgroup K L j).toSubgroup := by ++ change ++ j.fieldRange.fixingSubgroup ≤ ++ (numberFieldEmbeddedLowerEmbedding K L j).fieldRange.fixingSubgroup ++ apply ++ (numberFieldEmbeddedLowerEmbedding K L j).fieldRange.fixingSubgroup_le ++ intro x hx ++ rcases hx with ⟨y, rfl⟩ ++ exact ⟨algebraMap K L y, rfl⟩ ++ ++/-- The separable closure of the actual lower field, identified with ++the rational separable closure carrying the algebra structure induced ++by an explicit compatible embedding. -/ ++noncomputable def numberFieldEmbeddedSeparableClosureEquiv ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ letI : Algebra K (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra K L j ++ SeparableClosure K ≃ₐ[K] SeparableClosure ℚ := by ++ letI : Algebra K (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra K L j ++ letI hScalarTower : IsScalarTower ℚ K (SeparableClosure ℚ) := ++ IsScalarTower.of_algebraMap_eq' ++ (numberFieldEmbeddedLowerEmbedding K L j).comp_algebraMap.symm ++ letI hseparable : Algebra.IsSeparable K (SeparableClosure ℚ) := ++ Algebra.isSeparable_tower_top_of_isSeparable ++ ℚ K (SeparableClosure ℚ) ++ letI hSepClosure : IsSepClosure K (SeparableClosure ℚ) := ++ ⟨IsSepClosure.sep_closed ℚ, hseparable⟩ ++ exact ++ IsSepClosure.equiv K ++ (SeparableClosure K) (SeparableClosure ℚ) ++ ++/-- The relative subgroup arising from an explicit compatible ++number-field embedding is normal. -/ ++theorem numberFieldEmbeddedExtensionSubgroup_normal ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).Normal := by ++ let i := numberFieldEmbeddedLowerEmbedding K L j ++ let hAlgebra : Algebra K (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra K L j ++ let e := numberFieldEmbeddedSeparableClosureEquiv K L j ++ change ++ (CyclicCohomology.extensionSubgroup ++ (closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange i)) ++ (closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange j)) _).Normal ++ exact ambientEmbeddedExtensionSubgroup_normal ℚ K L j e ++ ++/-- The normality witness for an explicitly embedded tower, registered at ++the precise subgroup used by the downstream quotient constructions. -/ ++noncomputable local instance ++ numberFieldEmbeddedExtensionSubgroupNormal ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal K L j ++ ++/-- The relative quotient arising from an explicit compatible ++number-field embedding is finite. -/ ++theorem numberFieldEmbeddedExtensionQuotient_finite ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ Finite ++ ((numberFieldEmbeddedBaseSubgroup K L j).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := by ++ let i := numberFieldEmbeddedLowerEmbedding K L j ++ let hAlgebra : Algebra K (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra K L j ++ let e := numberFieldEmbeddedSeparableClosureEquiv K L j ++ change ++ Finite ++ ((closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange i)).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange i)) ++ (closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange j)) _) ++ exact ambientEmbeddedExtensionQuotient_finite ℚ K L j e ++ ++/-- The relative-index witness for an explicitly embedded tower, registered ++at the exact quotient consumed by `FiniteNormQuotient`. -/ ++noncomputable local instance ++ numberFieldEmbeddedExtensionQuotientFinite ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ Finite ++ ((numberFieldEmbeddedBaseSubgroup K L j).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := ++ numberFieldEmbeddedExtensionQuotient_finite K L j ++ ++/-- The finite abstract field determined by the lower member of an ++explicitly embedded number-field tower. -/ ++noncomputable abbrev numberFieldEmbeddedFiniteAbstractField ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) where ++ field := numberFieldEmbeddedBaseSubgroup K L j ++ finite := by ++ simpa only [numberFieldEmbeddedBaseSubgroup] using ++ (ambientEmbeddedAbsoluteQuotientFinite ++ ℚ K (numberFieldEmbeddedLowerEmbedding K L j)) ++ ++/-- The absolute-index witness for the lower member of an explicitly embedded ++tower, registered at its specialized quotient type. -/ ++noncomputable local instance ++ numberFieldEmbeddedAbsoluteQuotientFinite ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (le_baseField ++ (numberFieldEmbeddedBaseSubgroup K L j))) := ++ (numberFieldEmbeddedFiniteAbstractField K L j).finite ++ ++/-- The finite Galois subextension determined by an explicitly embedded ++number-field tower. -/ ++noncomputable abbrev numberFieldEmbeddedFiniteGaloisSubextension ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteGaloisSubextension ++ (numberFieldEmbeddedBaseSubgroup K L j) where ++ field := numberFieldEmbeddedTopSubgroup K L j ++ below := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j ++ normal := numberFieldEmbeddedExtensionSubgroup_normal K L j ++ finite := numberFieldEmbeddedExtensionQuotient_finite K L j ++ ++/-- Shared finite-dimensional data for the fixed field of the lower subgroup ++in an explicitly embedded number-field tower. -/ ++noncomputable local instance ++ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteDimensional ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) := ++ abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedAbsoluteQuotientFinite K L j) ++ ++/-- Shared relative finite-dimensional data for the two fixed fields of an ++explicitly embedded number-field tower. -/ ++noncomputable local instance ++ numberFieldEmbeddedAbstractRelativeFixedFieldFiniteDimensional ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteDimensional ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := ++ abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ++ (numberFieldEmbeddedAbsoluteQuotientFinite K L j) ++ (numberFieldEmbeddedExtensionQuotientFinite K L j) ++ ++local instance numberFieldEmbeddedAbstractFixedFieldScalarTower ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ IsScalarTower ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := ++ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) ++ ++noncomputable local instance ++ numberFieldEmbeddedAbstractRelativeFixedFieldAbsoluteFiniteDimensional ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteDimensional ℚ ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := ++ FiniteDimensional.trans ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) ++ ++noncomputable local instance ++ numberFieldEmbeddedAbstractFixedFieldNumberField ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ NumberField ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) := ++ NumberField.of_module_finite ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) ++ ++noncomputable local instance ++ numberFieldEmbeddedAbstractRelativeFixedFieldNumberField ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ NumberField ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := ++ NumberField.of_module_finite ℚ ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) ++ ++noncomputable local instance ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsFiniteDimensional ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteDimensional ℚ ++ ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := by ++ change FiniteDimensional ℚ ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) ++ infer_instance ++ ++noncomputable local instance ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsNumberField ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ NumberField ++ ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := ++ NumberField.of_module_finite ℚ _ ++ ++noncomputable local instance ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsAlgebra ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ Algebra ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) ++ ((abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)).restrictScalars ℚ) := ++ (IntermediateField.inclusion ++ (abstractFixedField_le ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j))).toRingHom.toAlgebra ++ ++noncomputable local instance ++ numberFieldEmbeddedAbstractRelativeFixedFieldIsGalois ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ IsGalois ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) := ++ abstractRelativeFixedField_isGalois ++ ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ++ (numberFieldEmbeddedExtensionSubgroupNormal K L j) ++ ++/-- The quotient of the two explicitly embedded fixing subgroups is ++the actual relative Galois group. -/ ++noncomputable def ++ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ (numberFieldEmbeddedFiniteGaloisSubextension K L j).extensionQuotient ≃* ++ Gal(L / K) := by ++ let i := numberFieldEmbeddedLowerEmbedding K L j ++ letI hAlgebra : Algebra K (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra K L j ++ let e := numberFieldEmbeddedSeparableClosureEquiv K L j ++ let H₀ := ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange i) ++ let J₀ := ++ closedFixingSubgroup ℚ (SeparableClosure ℚ) ++ (AlgHom.fieldRange j) ++ let hJH : J₀.toSubgroup ≤ H₀.toSubgroup := by ++ change j.fieldRange.fixingSubgroup ≤ i.fieldRange.fixingSubgroup ++ apply i.fieldRange.fixingSubgroup_le ++ intro x hx ++ rcases hx with ⟨y, rfl⟩ ++ exact ⟨algebraMap K L y, rfl⟩ ++ letI : (CyclicCohomology.extensionSubgroup H₀ J₀ hJH).Normal := ++ ambientEmbeddedExtensionSubgroup_normal ℚ K L j e ++ change ++ (H₀.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H₀ J₀ hJH) ≃* ++ Gal(L / K) ++ exact ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ K L j e ++ ++/-- The original lower field is canonically equivalent to the fixed ++field of its explicitly embedded fixing subgroup. -/ ++noncomputable def numberFieldEmbeddedAbstractBaseFieldEquiv ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ K ≃ₐ[ℚ] ++ abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j) := ++ (numberFieldEmbeddedLowerEmbedding K L j).equivFieldRange.trans ++ (IntermediateField.equivOfEq ++ (InfiniteGalois.fixedField_fixingSubgroup ++ (numberFieldEmbeddedLowerEmbedding K L j).fieldRange).symm) ++ ++/-- The original top field is canonically equivalent to the relative ++fixed field of its explicitly embedded fixing subgroup. -/ ++noncomputable def numberFieldEmbeddedAbstractTopFieldEquiv ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ L ≃ₐ[ℚ] ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup ++ K L j)).restrictScalars ℚ := ++ j.equivFieldRange.trans ++ (IntermediateField.equivOfEq ++ (InfiniteGalois.fixedField_fixingSubgroup j.fieldRange).symm) ++ ++/-- The two explicit fixed-field equivalences commute with the tower ++algebra maps. -/ ++@[simp] ++theorem numberFieldEmbeddedAbstractFieldEquiv_algebraMap ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (x : K) : ++ numberFieldEmbeddedAbstractTopFieldEquiv K L j ++ (algebraMap K L x) = ++ algebraMap ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L j)) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j)) ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j x) := by ++ apply Subtype.ext ++ rfl ++ ++/-- The ordinary idele class group of the explicitly embedded lower ++field, transported to the fixed part of the rational absolute ++idele-class representation. -/ ++noncomputable def numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ Additive (IdeleClassGroup K) ≃+ ++ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j) := by ++ let H := numberFieldEmbeddedBaseSubgroup K L j ++ exact ++ (MulEquiv.toAdditive ++ (ideleClassCongr ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j))).trans ++ (rationalAbstractFixedFieldIdeleClassEquivFixed H) ++ ++/-- The abstract finite norm quotient of an explicitly embedded tower ++is its genuine ordinary idele-class norm quotient. -/ ++noncomputable def ++ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteNormQuotient rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ≃+ ++ Additive ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm K L).range) := by ++ let hnormal := ++ numberFieldEmbeddedExtensionSubgroupNormal K L j ++ let H := numberFieldEmbeddedBaseSubgroup K L j ++ let J := numberFieldEmbeddedTopSubgroup K L j ++ let hJH := ++ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j ++ let fixedFieldEquiv := ++ rationalFiniteNormQuotientEquivIdeleClassNormQuotient ++ H J hJH hnormal ++ let actualFieldEquiv := ++ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) ++ exact ++ fixedFieldEquiv.trans ++ (MulEquiv.toAdditive actualFieldEquiv.symm) ++ ++ ++end EmbeddedNumberFieldRealization ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueFixedFields.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueFixedFields.lean +new file mode 100644 +index 0000000..7520ff3 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueFixedFields.lean +@@ -0,0 +1,359 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidueEmbeddedReciprocity ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++ ++variable ++ (K : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (L : FiniteAbelianSubextension K.field) ++ ++local instance abstractFixedFieldBaseQuotientFinite : ++ Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ K.field (le_baseField K.field)) := ++ K.finite ++ ++local instance abstractFixedFieldRelativeQuotientFinite : ++ Finite ++ (K.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup K.field L.field L.below) := ++ L.finite ++ ++local instance abstractFixedFieldRelativeQuotientIsMulCommutative : ++ IsMulCommutative L.extensionQuotient := ++ L.commutative ++ ++noncomputable local instance abstractFixedFieldFiniteDimensional : ++ FiniteDimensional ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) := ++ abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) K.field K.finite ++ ++noncomputable local instance abstractRelativeFixedFieldFiniteDimensional : ++ FiniteDimensional ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) := ++ abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) ++ K.field L.field L.below K.finite L.finite ++ ++local instance abstractFixedFieldRelativeScalarTower : ++ IsScalarTower ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) := ++ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) ++ ++noncomputable local instance abstractRelativeFixedFieldAbsoluteFiniteDimensional : ++ FiniteDimensional ℚ ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) := ++ FiniteDimensional.trans ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) ++ ++noncomputable local instance abstractFixedFieldNumberField : ++ NumberField ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) := ++ NumberField.of_module_finite ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) ++ ++/-- The lower fixed idèle-class group is commutative. Naming the mixin ++before the public quotient declarations avoids delayed normality synthesis ++inside their definition bodies. -/ ++local instance ++ abstractFixedFieldIdeleClassGroupIsMulCommutative : ++ IsMulCommutative ++ (IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field)) := ++ ⟨⟨fun a b => mul_comm a b⟩⟩ ++ ++noncomputable local instance abstractRelativeFixedFieldNumberField : ++ NumberField ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) := ++ NumberField.of_module_finite ℚ ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) ++ ++/-- Use the same explicit Galois witness as the fixed-field quotient ++comparison. Deriving it through `IsAbelianGalois` produces an equivalent ++but much larger dependent instance path. -/ ++noncomputable local instance ++ abstractRelativeFixedFieldIsGalois : ++ IsGalois ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) := ++ abstractRelativeFixedField_isGalois ++ ℚ (SeparableClosure ℚ) ++ K.field L.field L.below L.normal ++ ++noncomputable local instance abstractRelativeFixedFieldIsAbelianGalois : ++ IsAbelianGalois ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) := ++ finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois L ++ ++/-- Use one opaque normality witness for the actual fixed-field norm range. ++This keeps every occurrence of its quotient group on the same instance path. -/ ++local instance ++ abstractFixedFieldIdeleClassNormRangeNormal : ++ ((_root_.ideleClassNorm ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below)).range).Normal := by ++ infer_instance ++ ++/-- The abelianized abstract extension quotient is the actual Galois ++group of the corresponding pair of fixed fields. -/ ++noncomputable def ++ abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below ++ Additive ++ (Abelianization ++ (FiniteGaloisSubextension.extensionQuotient ++ L.toFiniteGaloisExtension)) ≃+ ++ Additive (Gal(E / F)) := by ++ dsimp only ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below ++ let e : ++ L.extensionQuotient ≃* ++ Gal(E / F) := ++ L.extensionQuotientMulEquiv.trans ++ (abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) ++ K.field L.field L.below L.normal) ++ exact ++ MulEquiv.toAdditive ++ ((Abelianization.equivOfComm : ++ L.extensionQuotient ≃* ++ Abelianization L.extensionQuotient).symm.trans e) ++ ++/-- The actual fixed-field global norm-residue equivalence ++ ++`C_F / N_{E/F} C_E ≃ Gal(E/F)` ++ ++attached to an abstract finite abelian subextension in the rational ++absolute class formation. -/ ++noncomputable def abstractFixedFieldGlobalNormResidueEquiv : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below ++ Additive ++ (IdeleClassGroup F ⧸ ++ (_root_.ideleClassNorm F E).range) ≃+ ++ Additive (Gal(E / F)) := by ++ dsimp only ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below ++ let eNorm : ++ FiniteNormQuotient rationalIdeleClassRepresentation ++ K.field L.field L.below ≃+ ++ Additive ++ (Abelianization L.toFiniteGaloisExtension.extensionQuotient) := ++ rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ K L.toFiniteGaloisExtension ++ exact ++ (rationalFiniteNormQuotientEquivIdeleClassNormQuotient ++ K.field L.field L.below L.normal).symm.trans ++ (eNorm.trans ++ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup ++ K L)) ++ ++/-- The abstract finite norm-residue equivalence with its dependent source ++instance fixed to the public finite norm quotient. -/ ++noncomputable def abstractFixedFieldFiniteNormResidueGaloisEquiv : ++ FiniteNormQuotient rationalIdeleClassRepresentation ++ K.field L.field L.below ≃+ ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field))) := by ++ letI : AddCommGroup ++ (FiniteNormQuotient rationalIdeleClassRepresentation ++ K.field L.field L.below) := ++ finiteNormQuotientAddCommGroup rationalIdeleClassRepresentation ++ K.field L.field L.below ++ exact ++ @AddEquiv.trans ++ (FiniteNormQuotient rationalIdeleClassRepresentation ++ K.field L.field L.below) ++ (Additive ++ (Abelianization ++ L.toFiniteGaloisExtension.extensionQuotient)) ++ (Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) K.field)))) ++ inferInstance inferInstance inferInstance ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ K L.toFiniteGaloisExtension) ++ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup ++ K L) ++ ++/-- The abstract norm-residue symbol on the fixed part of the rational ++absolute idele-class representation, with its value transported to the ++actual Galois group of the two fixed fields. This is the form consumed ++directly by the abstract norm--restriction naturality theorem. -/ ++noncomputable def ambientFixedGlobalNormResidueAddMonoidHom : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below ++ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation K.field →+ ++ Additive (Gal(E / F)) := by ++ dsimp only ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below ++ exact ++ (abstractFixedFieldFiniteNormResidueGaloisEquiv K L).toAddMonoidHom.comp ++ (finiteNormClassHom rationalIdeleClassRepresentation ++ K.field L.field L.below) ++ ++/-- The ordinary idele class group of the lower fixed field, transported ++to the fixed part of the rational absolute idele-class representation. -/ ++private noncomputable def abstractFixedFieldIdeleClassToAmbientFixedMonoidHom : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ IdeleClassGroup F →* ++ Multiplicative ++ (ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation K.field) := ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ K.field).toAddMonoidHom.toMultiplicativeRight ++ ++/-- The actual norm-residue homomorphism on the ordinary idele class ++group of the lower fixed field, constructed without choosing a second ++field embedding. -/ ++noncomputable def abstractFixedFieldGlobalNormResidueMonoidHom : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) L.below ++ IdeleClassGroup F →* Gal(E / F) := ++ (ambientFixedGlobalNormResidueAddMonoidHom K L).toMultiplicative.comp ++ (abstractFixedFieldIdeleClassToAmbientFixedMonoidHom K) ++ ++/-- Pointwise form of the ambient fixed-part norm-residue homomorphism. -/ ++theorem ambientFixedGlobalNormResidueAddMonoidHom_apply ++ (a : ++ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation K.field) : ++ ambientFixedGlobalNormResidueAddMonoidHom K L a = ++ abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup ++ K L ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ K L.toFiniteGaloisExtension ++ (finiteNormClass rationalIdeleClassRepresentation ++ K.field L.field L.below a)) := by ++ change ++ abstractFixedFieldFiniteNormResidueGaloisEquiv K L ++ (finiteNormClass rationalIdeleClassRepresentation ++ K.field L.field L.below a) = _ ++ rfl ++ ++/-- Pointwise form of the transported fixed-field norm-residue homomorphism. -/ ++private theorem abstractFixedFieldGlobalNormResidueMonoidHom_apply : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) K.field ++ ∀ c : IdeleClassGroup F, ++ abstractFixedFieldGlobalNormResidueMonoidHom K L c = ++ Additive.toMul ++ (ambientFixedGlobalNormResidueAddMonoidHom K L ++ ((rationalAbstractFixedFieldIdeleClassEquivFixed K.field) ++ (Additive.ofMul c))) := by ++ dsimp only ++ intro c ++ rfl ++ ++/-- Transporting an ordinary fixed-field idele class to the ambient ++fixed part and applying the abstract norm-residue map gives exactly the ++actual fixed-field norm-residue value. -/ ++@[simp] ++theorem abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply ++ (a : ++ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation K.field) : ++ abstractFixedFieldGlobalNormResidueMonoidHom K L ++ (Additive.toMul ++ ((rationalAbstractFixedFieldIdeleClassEquivFixed ++ K.field).symm a)) = ++ Additive.toMul ++ (ambientFixedGlobalNormResidueAddMonoidHom K L a) := by ++ rw [abstractFixedFieldGlobalNormResidueMonoidHom_apply] ++ change ++ Additive.toMul ++ (ambientFixedGlobalNormResidueAddMonoidHom K L ++ ((rationalAbstractFixedFieldIdeleClassEquivFixed K.field) ++ ((rationalAbstractFixedFieldIdeleClassEquivFixed ++ K.field).symm a))) = ++ Additive.toMul ++ (ambientFixedGlobalNormResidueAddMonoidHom K L a) ++ rw [(rationalAbstractFixedFieldIdeleClassEquivFixed ++ K.field).apply_symm_apply] ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueNormClasses.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueNormClasses.lean +new file mode 100644 +index 0000000..9a8db28 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/AbstractFixedFieldGlobalNormResidueNormClasses.lean +@@ -0,0 +1,294 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidueEmbeddings ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++section EmbeddedNumberFieldRealization ++ ++variable ++ (K L : Type) [Field K] [NumberField K] ++ [Field L] [NumberField L] [Algebra K L] ++ ++ ++attribute [local instance] ++ numberFieldEmbeddedIdeleClassGroupIsMulCommutative ++ numberFieldEmbeddedIdeleClassSubgroupNormal ++ numberFieldEmbeddedExtensionSubgroupNormal ++ numberFieldEmbeddedExtensionQuotientFinite ++ numberFieldEmbeddedAbsoluteQuotientFinite ++ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional ++ numberFieldEmbeddedAbstractRelativeFixedFieldFiniteDimensional ++ numberFieldEmbeddedAbstractFixedFieldScalarTower ++ numberFieldEmbeddedAbstractRelativeFixedFieldAbsoluteFiniteDimensional ++ numberFieldEmbeddedAbstractFixedFieldNumberField ++ numberFieldEmbeddedAbstractRelativeFixedFieldNumberField ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsFiniteDimensional ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsNumberField ++ numberFieldEmbeddedAbstractRelativeFixedFieldRestrictScalarsAlgebra ++ numberFieldEmbeddedAbstractRelativeFixedFieldIsGalois ++ ++private theorem numberFieldEmbeddedOrdinaryNormQuotientCongr_symm_mk ++ {K₀ L₀ K₁ L₁ : Type} ++ [Field K₀] [NumberField K₀] ++ [Field L₀] [NumberField L₀] [Algebra K₀ L₀] ++ [Field K₁] [NumberField K₁] ++ [Field L₁] [NumberField L₁] [Algebra K₁ L₁] ++ (eK : K₀ ≃ₐ[ℚ] K₁) ++ (eL : L₀ ≃ₐ[ℚ] L₁) ++ (h : ∀ x : K₀, ++ eL (algebraMap K₀ L₀ x) = ++ algebraMap K₁ L₁ (eK x)) ++ (c : IdeleClassGroup K₁) : ++ (ordinaryIdeleClassNormQuotientCongrOfAlgEquiv eK eL h).symm ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm K₁ L₁).range c) = ++ QuotientGroup.mk' ++ (_root_.ideleClassNorm K₀ L₀).range ++ ((ideleClassCongr eK).symm c) := by ++ let e := ordinaryIdeleClassNormQuotientCongrOfAlgEquiv eK eL h ++ apply e.injective ++ rw [e.apply_symm_apply, ++ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv_mk, ++ MulEquiv.apply_symm_apply] ++ ++private noncomputable def numberFieldEmbeddedFiniteNormClassPublicValue ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j)) : ++ Additive ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm K L).range) := ++ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient ++ K L j ++ (finiteNormClass rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ++ a) ++ ++private noncomputable def numberFieldEmbeddedFiniteNormClassExpectedValue ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j)) : ++ Additive ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm K L).range) := ++ Additive.ofMul ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm K L).range ++ (Additive.toMul ++ ((numberFieldEmbeddedIdeleClassEquivAmbientFixed K L j).symm a))) ++ ++private noncomputable def ++ numberFieldEmbeddedFiniteNormClassDirectComparisonValue ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j)) : ++ Additive ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm K L).range) := by ++ let hnormal := ++ numberFieldEmbeddedExtensionSubgroupNormal K L j ++ let H := numberFieldEmbeddedBaseSubgroup K L j ++ let J := numberFieldEmbeddedTopSubgroup K L j ++ let hJH := ++ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j ++ let fixedFieldEquiv := ++ rationalFiniteNormQuotientEquivIdeleClassNormQuotient ++ H J hJH hnormal ++ let actualFieldEquiv := ++ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) ++ exact ++ MulEquiv.toAdditive actualFieldEquiv.symm ++ (fixedFieldEquiv ++ (finiteNormClass rationalIdeleClassRepresentation ++ H J hJH a)) ++ ++private theorem ++ numberFieldEmbeddedFiniteNormClassPublicValue_eq_directComparison ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j)) : ++ numberFieldEmbeddedFiniteNormClassPublicValue K L j a = ++ numberFieldEmbeddedFiniteNormClassDirectComparisonValue K L j a := by ++ unfold numberFieldEmbeddedFiniteNormClassPublicValue ++ unfold numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient ++ unfold numberFieldEmbeddedFiniteNormClassDirectComparisonValue ++ rfl ++ ++private noncomputable def numberFieldEmbeddedActualNormClassRepresentativeValue ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j)) : ++ Additive ++ (IdeleClassGroup K ⧸ ++ (_root_.ideleClassNorm K L).range) := by ++ let H := numberFieldEmbeddedBaseSubgroup K L j ++ let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j ++ let F := abstractFixedField ℚ (SeparableClosure ℚ) H ++ let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hJH ++ let actualFieldEquiv := ++ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) ++ exact ++ Additive.ofMul ++ (actualFieldEquiv.symm ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm F E).range ++ (Additive.toMul ++ ((rationalAbstractFixedFieldIdeleClassEquivFixed H).symm a)))) ++ ++private theorem ++ numberFieldEmbeddedFiniteNormClassDirectComparison_eq_actualValue ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j)) : ++ numberFieldEmbeddedFiniteNormClassDirectComparisonValue K L j a = ++ numberFieldEmbeddedActualNormClassRepresentativeValue K L j a := by ++ let hnormal := numberFieldEmbeddedExtensionSubgroupNormal K L j ++ let H := numberFieldEmbeddedBaseSubgroup K L j ++ let J := numberFieldEmbeddedTopSubgroup K L j ++ let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j ++ let actualFieldEquiv := ++ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) ++ have hfixed := ++ rationalFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass ++ H J hJH hnormal a ++ unfold numberFieldEmbeddedFiniteNormClassDirectComparisonValue ++ unfold numberFieldEmbeddedActualNormClassRepresentativeValue ++ exact congrArg (MulEquiv.toAdditive actualFieldEquiv.symm) hfixed ++ ++private theorem numberFieldEmbeddedActualNormClassRepresentativeValue_eq_expected ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j)) : ++ numberFieldEmbeddedActualNormClassRepresentativeValue K L j a = ++ numberFieldEmbeddedFiniteNormClassExpectedValue K L j a := by ++ let H := numberFieldEmbeddedBaseSubgroup K L j ++ let hJH := numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j ++ let F := abstractFixedField ℚ (SeparableClosure ℚ) H ++ let E := abstractRelativeFixedField ℚ (SeparableClosure ℚ) hJH ++ let actualFieldEquiv := ++ ordinaryIdeleClassNormQuotientCongrOfAlgEquiv ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) ++ let c : IdeleClassGroup F := ++ Additive.toMul ++ ((rationalAbstractFixedFieldIdeleClassEquivFixed H).symm a) ++ unfold numberFieldEmbeddedActualNormClassRepresentativeValue ++ unfold numberFieldEmbeddedFiniteNormClassExpectedValue ++ change ++ Additive.ofMul ++ (actualFieldEquiv.symm ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm F E).range c)) = ++ Additive.ofMul ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm K L).range ++ ((ideleClassCongr ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j)).symm c)) ++ exact ++ congrArg Additive.ofMul ++ (numberFieldEmbeddedOrdinaryNormQuotientCongr_symm_mk ++ (numberFieldEmbeddedAbstractBaseFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractTopFieldEquiv K L j) ++ (numberFieldEmbeddedAbstractFieldEquiv_algebraMap K L j) c) ++ ++/-- On a finite norm-class representative, the explicit fixed-field ++comparison is the genuine ordinary idele-class quotient. -/ ++@[simp] ++theorem ++ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (a : ambientFixedAddSubgroup rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j)) : ++ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient K L j ++ (finiteNormClass rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) a) = ++ Additive.ofMul ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm K L).range ++ (Additive.toMul ++ ((numberFieldEmbeddedIdeleClassEquivAmbientFixed K L j).symm a))) := by ++ change ++ numberFieldEmbeddedFiniteNormClassPublicValue K L j a = ++ numberFieldEmbeddedFiniteNormClassExpectedValue K L j a ++ exact ++ (numberFieldEmbeddedFiniteNormClassPublicValue_eq_directComparison ++ K L j a).trans ++ ((numberFieldEmbeddedFiniteNormClassDirectComparison_eq_actualValue ++ K L j a).trans ++ (numberFieldEmbeddedActualNormClassRepresentativeValue_eq_expected ++ K L j a)) ++ ++/-- On an ordinary idele class, the explicit fixed-part realization ++followed by the abstract finite norm-class map is the genuine quotient ++class modulo the ordinary idele-class norm. -/ ++@[simp] ++theorem ++ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_ideleClass ++ [FiniteDimensional K L] [IsGalois K L] ++ (j : L →ₐ[ℚ] SeparableClosure ℚ) ++ (c : IdeleClassGroup K) : ++ numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient K L j ++ (finiteNormClass rationalIdeleClassRepresentation ++ (numberFieldEmbeddedBaseSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup K L j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L j) ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K L j (Additive.ofMul c))) = ++ Additive.ofMul ++ (QuotientGroup.mk' ++ (_root_.ideleClassNorm K L).range c) := by ++ simpa only [AddEquiv.symm_apply_apply, toMul_ofMul] using ++ (numberFieldEmbeddedFiniteNormQuotientEquivIdeleClassNormQuotient_finiteNormClass ++ K L j ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K L j (Additive.ofMul c))) ++ ++ ++end EmbeddedNumberFieldRealization ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtin.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtin.lean +index d3e6e51..75c1574 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtin.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtin.lean +@@ -4,26 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicIdeleClassValuation +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.InfiniteGlobalArtin +-import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.MaximalUnramifiedReciprocity ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinComparison + +-set_option autoImplicit false +- +-/-! +-# Cyclotomic Artin coordinates over abstract fixed fields + +-The cyclotomic degree datum on the rational absolute Galois group has +-an actual maximal-unramified field over every finite abstract fixed +-field. This file identifies its genuine Galois group with +-`Multiplicative ZHat`, using the normalized degree map, and supplies +-the abelian Galois structure needed by the actual infinite global +-Artin homomorphism. ++set_option autoImplicit false + +-These constructions are the source side of the comparison between +-abstract finite reciprocity and the chosen local-factor product. No +-reciprocity comparison is assumed in their definitions. +--/ + + open scoped IsMulCommutative NumberField + +@@ -35,2336 +20,11 @@ namespace Reciprocity + open ClassFormation + open KummerTheory + +-/-- Keep this module on the rational algebra structures used by the +-cyclotomic fixed-field API. Generic intermediate-field instances are +-propositionally equal here but not definitionally interchangeable. -/ +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra : +- Algebra ℚ (SeparableClosure ℚ) := +- DivisionRing.toRatAlgebra +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra : +- Algebra ℚ rationalCyclotomicZHatField := +- DivisionRing.toRatAlgebra +- +-/-- Cyclotomic field inertia is contained in the original abstract +-field subgroup. -/ +-theorem rationalCyclotomicFieldInertia_le +- (H : ClosedSubgroup +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- (rationalCyclotomicDegreeData.fieldInertia H).toSubgroup ≤ +- H.toSubgroup := by +- intro σ hσ +- exact hσ.1 +- +-/-- Viewing cyclotomic field inertia inside its ambient field subgroup +-gives exactly the kernel of normalized degree. -/ +-theorem extensionSubgroup_rationalCyclotomicFieldInertia +- (H : ClosedSubgroup +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- CyclicCohomology.extensionSubgroup H +- (rationalCyclotomicDegreeData.fieldInertia H) +- (rationalCyclotomicFieldInertia_le H) = +- rationalCyclotomicDegreeData.fieldInertiaWithin H := by +- ext σ +- rw [ +- mem_extensionSubgroup_iff, +- rationalCyclotomicDegreeData.mem_fieldInertiaWithin_iff, +- rationalCyclotomicDegreeData.mem_fieldInertia_iff] +- exact and_iff_right σ.2 +- +-/-- The actual Galois group of the cyclotomic maximal-unramified +-extension of an abstract fixed field, in its normalized `ZHat` +-coordinate. -/ +-noncomputable def abstractFixedFieldCyclotomicGalEquivZHat +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) ≃* +- Multiplicative ZHat := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- let qField : +- H.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI ≃* +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) := +- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- let qInertia : +- H.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI ≃* +- H.field.toSubgroup ⧸ +- rationalCyclotomicDegreeData.fieldInertiaWithin H.field := +- QuotientGroup.quotientMulEquivOfEq +- (extensionSubgroup_rationalCyclotomicFieldInertia H.field) +- exact +- qField.symm.trans +- (qInertia.trans +- (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv +- (H.toFiniteResidueAbstractField +- rationalCyclotomicDegreeData))) +- +-/-- On an absolute-Galois representative fixing the lower field, the +-actual cyclotomic Galois coordinate is its normalized degree. -/ +-@[simp] +-theorem abstractFixedFieldCyclotomicGalEquivZHat_extensionClass +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (σ : H.field.toSubgroup) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- abstractFixedFieldCyclotomicGalEquivZHat H +- (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- (QuotientGroup.mk σ)) = +- rationalCyclotomicDegreeData.normalizedDegree +- (H.toFiniteResidueAbstractField +- rationalCyclotomicDegreeData) σ := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- let qField := +- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- change +- (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv +- (H.toFiniteResidueAbstractField +- rationalCyclotomicDegreeData)) +- (QuotientGroup.quotientMulEquivOfEq +- (extensionSubgroup_rationalCyclotomicFieldInertia H.field) +- (qField.symm (qField (QuotientGroup.mk σ)))) = +- rationalCyclotomicDegreeData.normalizedDegree +- (H.toFiniteResidueAbstractField +- rationalCyclotomicDegreeData) σ +- rw [qField.symm_apply_apply] +- rfl +- +-/-- Quotient-level evaluation of the actual cyclotomic Galois +-coordinate. -/ +-@[simp] +-theorem abstractFixedFieldCyclotomicGalEquivZHat_quotientClass +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (q : +- H.field.toSubgroup ⧸ +- rationalCyclotomicDegreeData.fieldInertiaWithin H.field) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- let qInertia : +- H.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI ≃* +- H.field.toSubgroup ⧸ +- rationalCyclotomicDegreeData.fieldInertiaWithin H.field := +- QuotientGroup.quotientMulEquivOfEq +- (extensionSubgroup_rationalCyclotomicFieldInertia H.field) +- abstractFixedFieldCyclotomicGalEquivZHat H +- (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- (qInertia.symm q)) = +- rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv +- (H.toFiniteResidueAbstractField +- rationalCyclotomicDegreeData) q := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- let qField := +- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- let qInertia : +- H.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI ≃* +- H.field.toSubgroup ⧸ +- rationalCyclotomicDegreeData.fieldInertiaWithin H.field := +- QuotientGroup.quotientMulEquivOfEq +- (extensionSubgroup_rationalCyclotomicFieldInertia H.field) +- change +- (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv +- (H.toFiniteResidueAbstractField +- rationalCyclotomicDegreeData)) +- (qInertia +- (qField.symm +- (qField (qInertia.symm q)))) = +- rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv +- (H.toFiniteResidueAbstractField +- rationalCyclotomicDegreeData) q +- rw [qField.symm_apply_apply, qInertia.apply_symm_apply] +- +-/-- The extension fixed by cyclotomic field inertia is an actual +-abelian Galois extension of the lower abstract fixed field. -/ +-theorem abstractFixedFieldCyclotomic_isAbelianGalois +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- IsAbelianGalois +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- let : IsGalois +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) := +- LocalClassFieldTheory.abstractRelativeFixedField_isGalois +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- let e := +- abstractFixedFieldCyclotomicGalEquivZHat H +- exact +- { is_comm.comm := by +- intro σ τ +- apply e.injective +- simpa only [map_mul] using mul_comm (e σ) (e τ) } +- +-/-- The rational cyclotomic `ZHat`-field embedded in the actual +-maximal-unramified compositum of an abstract fixed field. -/ +-noncomputable def +- rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- rationalCyclotomicZHatField →ₐ[ℚ] +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let J := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- have hTJ : +- rationalCyclotomicZHatField ≤ J := by +- change +- rationalCyclotomicZHatField ≤ +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- rw [ +- rationalCyclotomicDegreeData_fixedField_fieldInertia] +- exact le_sup_right +- exact IntermediateField.inclusion hTJ +- +-noncomputable instance +- abstractFixedFieldCyclotomicCompositum_algebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- Algebra rationalCyclotomicZHatField +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) := +- ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H).toRingHom).toAlgebra +- +-instance abstractFixedFieldCyclotomicCompositum_scalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- IsScalarTower ℚ rationalCyclotomicZHatField +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) := +- IsScalarTower.of_algebraMap_eq' +- ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H).comp_algebraMap).symm +- +-instance abstractFixedFieldCyclotomicCompositum_baseScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- IsScalarTower ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- apply IsScalarTower.of_algebraMap_eq +- intro x +- apply Subtype.ext +- rfl +- +-/-- Restriction from the actual maximal-unramified compositum of an +-abstract fixed field to the rational cyclotomic factor. -/ +-noncomputable def abstractFixedFieldCyclotomicRestriction +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) →* +- Gal(rationalCyclotomicZHatField / ℚ) := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- exact +- IntermediateField.restrictRestrictAlgEquivMapHom +- ℚ rationalCyclotomicZHatField +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) +- +-/-- On a quotient representative, cyclotomic restriction of the +-actual relative automorphism is ordinary restriction of the same +-ambient absolute-Galois automorphism. -/ +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal : +- Normal ℚ rationalCyclotomicZHatField := +- rationalCyclotomicZHatField_isNormal +- +-@[simp] +-theorem abstractFixedFieldCyclotomicRestriction_extensionClass +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (σ : H.field.toSubgroup) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- abstractFixedFieldCyclotomicRestriction H +- (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- (QuotientGroup.mk σ)) = +- AlgEquiv.restrictNormalHom +- rationalCyclotomicZHatField σ.1 := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- let τ := +- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- (QuotientGroup.mk' +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) hI) +- σ) +- apply AlgEquiv.ext +- intro x +- apply Subtype.ext +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI +- have hrestrict : +- algebraMap rationalCyclotomicZHatField U +- ((abstractFixedFieldCyclotomicRestriction H τ) x) = +- τ (algebraMap rationalCyclotomicZHatField U x) := by +- change +- algebraMap rationalCyclotomicZHatField U +- ((AlgEquiv.restrictNormal +- (MulSemiringAction.toAlgEquiv ℚ U τ) +- rationalCyclotomicZHatField) x) = +- (MulSemiringAction.toAlgEquiv ℚ U τ) +- (algebraMap rationalCyclotomicZHatField U x) +- exact +- AlgEquiv.restrictNormal_commutes +- (MulSemiringAction.toAlgEquiv ℚ U τ) +- rationalCyclotomicZHatField x +- have halgebraMap_eq_embedding +- (z : rationalCyclotomicZHatField) : +- algebraMap rationalCyclotomicZHatField U z = +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H z : U) := by +- rfl +- have hembedding_coe +- (z : rationalCyclotomicZHatField) : +- (((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H z : U) : SeparableClosure ℚ)) = +- (z : SeparableClosure ℚ) := by +- rfl +- have halgebraMap_coe +- (z : rationalCyclotomicZHatField) : +- ((algebraMap rationalCyclotomicZHatField U z : U) : +- SeparableClosure ℚ) = +- (z : SeparableClosure ℚ) := by +- rw [halgebraMap_eq_embedding] +- exact hembedding_coe z +- have hambient := +- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup_mk_apply_val +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal σ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H x) +- calc +- (((abstractFixedFieldCyclotomicRestriction H τ) x : +- rationalCyclotomicZHatField) : +- SeparableClosure ℚ) = +- ((τ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H x) : +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) : +- SeparableClosure ℚ) := by +- calc +- (((abstractFixedFieldCyclotomicRestriction H τ) x : +- rationalCyclotomicZHatField) : SeparableClosure ℚ) = +- ((algebraMap rationalCyclotomicZHatField U +- ((abstractFixedFieldCyclotomicRestriction H τ) x) : U) : +- SeparableClosure ℚ) := +- (halgebraMap_coe +- ((abstractFixedFieldCyclotomicRestriction H τ) x)).symm +- _ = ((τ (algebraMap rationalCyclotomicZHatField U x) : U) : +- SeparableClosure ℚ) := +- congrArg (fun y : U => (y : SeparableClosure ℚ)) hrestrict +- _ = ((τ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H x) : U) : SeparableClosure ℚ) := by +- rw [halgebraMap_eq_embedding] +- _ = σ.1 (x : SeparableClosure ℚ) := by +- calc +- ((τ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H x) : U) : SeparableClosure ℚ) = +- σ.1 +- ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H x : U) : SeparableClosure ℚ) := by +- simpa only [τ, U] using hambient.symm +- _ = σ.1 (x : SeparableClosure ℚ) := by +- rw [hembedding_coe] +- _ = +- (((AlgEquiv.restrictNormalHom +- rationalCyclotomicZHatField σ.1) x : +- rationalCyclotomicZHatField) : +- SeparableClosure ℚ) := by +- exact +- (AlgEquiv.restrictNormal_commutes +- σ.1 rationalCyclotomicZHatField x).symm +- +-/-- Raw cyclotomic restriction is residue-degree multiplication of +-the normalized actual Galois coordinate. -/ +-theorem +- abstractFixedFieldCyclotomicRestriction_coordinate +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (τ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) : +- Multiplicative.toAdd +- (rationalCyclotomicZHatFieldGalEquivZHat +- (abstractFixedFieldCyclotomicRestriction H τ)) = +- (H.residueDegree rationalCyclotomicDegreeData : ℕ) • +- Multiplicative.toAdd +- (abstractFixedFieldCyclotomicGalEquivZHat H τ) := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let hnormal : +- (CyclicCohomology.extensionSubgroup H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI).Normal := by +- rw [extensionSubgroup_rationalCyclotomicFieldInertia] +- infer_instance +- let qField := +- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) H.field +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- hI hnormal +- obtain ⟨q, rfl⟩ := qField.surjective τ +- refine Quotient.inductionOn' q ?_ +- intro σ +- rw [ +- abstractFixedFieldCyclotomicRestriction_extensionClass, +- abstractFixedFieldCyclotomicGalEquivZHat_extensionClass] +- exact +- (rationalCyclotomicDegreeData.residueDegree_nsmul_normalizedDegree +- (H.toFiniteResidueAbstractField +- rationalCyclotomicDegreeData) σ).symm +- +-/-- The canonical compositum of an abstract fixed field with a finite +-layer of the rational cyclotomic `ZHat`-extension. -/ +-def abstractFixedFieldCyclotomicFiniteCompositum +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IntermediateField ℚ (SeparableClosure ℚ) := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field ⊔ +- IntermediateField.lift E.toIntermediateField +- +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteCompositum_finiteDimensional +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- FiniteDimensional ℚ +- (abstractFixedFieldCyclotomicFiniteCompositum H E) := by +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- let : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- let : FiniteDimensional ℚ +- (IntermediateField.lift E.toIntermediateField) := +- ((IntermediateField.liftAlgEquiv +- E.toIntermediateField).toLinearEquiv).finiteDimensional +- exact IntermediateField.finiteDimensional_sup +- F (IntermediateField.lift E.toIntermediateField) +- +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteCompositum_numberField +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- NumberField +- (abstractFixedFieldCyclotomicFiniteCompositum H E) := +- NumberField.of_module_finite ℚ +- (abstractFixedFieldCyclotomicFiniteCompositum H E) +- +-/-- The lower abstract fixed field embedded into its finite +-cyclotomic compositum. -/ +-noncomputable def +- abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field →ₐ[ℚ] +- abstractFixedFieldCyclotomicFiniteCompositum H E := +- IntermediateField.inclusion +- (show +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field ≤ +- abstractFixedFieldCyclotomicFiniteCompositum H E from +- le_sup_left) +- +-/-- The fixed field attached to a finite abstract field is a number +-field. Keeping this as the single file-local instance makes it +-available while later theorem binders are elaborated. -/ +-noncomputable local instance +- abstractFixedFieldCyclotomic_numberField +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- NumberField +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) := by +- let : FiniteDimensional ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- exact +- NumberField.of_module_finite ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- +-/-- A finite rational cyclotomic layer embedded into its compositum +-with the abstract fixed field. -/ +-noncomputable def +- abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- E →ₐ[ℚ] +- abstractFixedFieldCyclotomicFiniteCompositum H E := +- (IntermediateField.inclusion +- (show +- IntermediateField.lift E.toIntermediateField ≤ +- abstractFixedFieldCyclotomicFiniteCompositum H E from +- le_sup_right)).comp +- (IntermediateField.liftAlgEquiv E.toIntermediateField).toAlgHom +- +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteCompositum_baseAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteCompositum H E) := +- RingHom.toAlgebra +- (AlgHom.toRingHom +- (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E)) +- +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteCompositum_layerAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra E +- (abstractFixedFieldCyclotomicFiniteCompositum H E) := +- RingHom.toAlgebra +- (AlgHom.toRingHom +- (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E)) +- +-/-- The finite-layer action induced by its explicit embedding into the +-finite compositum. -/ +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteCompositum_layerSMul +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- SMul E +- (abstractFixedFieldCyclotomicFiniteCompositum H E) := +- Algebra.toSMul +- (self := +- abstractFixedFieldCyclotomicFiniteCompositum_layerAlgebra H E) +- +-instance +- abstractFixedFieldCyclotomicFiniteCompositum_baseScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsScalarTower ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteCompositum H E) := +- IsScalarTower.of_algebraMap_eq' +- (AlgHom.comp_algebraMap +- (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E)).symm +- +-instance +- abstractFixedFieldCyclotomicFiniteCompositum_layerScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsScalarTower ℚ E +- (abstractFixedFieldCyclotomicFiniteCompositum H E) := +- IsScalarTower.of_algebraMap_eq' +- (AlgHom.comp_algebraMap +- (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E)).symm +- +-/-- Inclusion of the finite cyclotomic compositum into the actual +-maximal-unramified compositum. -/ +-noncomputable def +- abstractFixedFieldCyclotomicFiniteCompositumInclusion +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- abstractFixedFieldCyclotomicFiniteCompositum H E →ₐ[ℚ] +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let J := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicDegreeData.fieldInertia H.field) +- have hle : +- abstractFixedFieldCyclotomicFiniteCompositum H E ≤ J := by +- dsimp only [J] +- rw [ +- rationalCyclotomicDegreeData_fixedField_fieldInertia H.field] +- exact +- sup_le_sup le_rfl +- (IntermediateField.lift_le E.toIntermediateField) +- exact IntermediateField.inclusion hle +- +-/-- The same finite-compositum inclusion over the lower abstract fixed +-field. -/ +-noncomputable def +- abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- abstractFixedFieldCyclotomicFiniteCompositum H E →ₐ[ +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field] +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI := by +- let f := +- abstractFixedFieldCyclotomicFiniteCompositumInclusion H E +- exact +- { f.toRingHom with +- commutes' := by +- intro x +- rfl } +- +-/-- The finite cyclotomic compositum as an intermediate field of the +-actual maximal-unramified extension. -/ +-noncomputable def abstractFixedFieldCyclotomicFiniteLayer +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- IntermediateField +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) := +- (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase H E).fieldRange +- +-/-- The base algebra on the finite field range, obtained from the +-explicit base embedding followed by the field-range equivalence. -/ +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) := +- RingHom.toAlgebra +- ((AlgHom.toRingHom +- (AlgEquiv.toAlgHom +- (AlgHom.equivFieldRange +- (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase +- H E)))).comp +- (AlgHom.toRingHom +- (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E))) +- +-/-- The scalar action belonging to the canonical base algebra on the +-finite field range. -/ +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteLayer_baseSMul +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- SMul +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) := +- Algebra.toSMul +- (self := abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E) +- +-/-- The module structure belonging to the canonical base algebra on +-the finite field range. -/ +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteLayer_baseModule +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Module +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) := +- @Algebra.toModule +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- _ _ +- (abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E) +- +-/-- The field-range equivalence rebuilt over the explicit base +-algebras. Its underlying ring equivalence is the canonical one. -/ +-noncomputable def +- abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- abstractFixedFieldCyclotomicFiniteCompositum H E ≃ₐ[ +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field] +- abstractFixedFieldCyclotomicFiniteLayer H E := +- AlgEquiv.ofRingEquiv +- (f := +- (AlgHom.equivFieldRange +- (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase +- H E)).toRingEquiv) +- (fun _ => rfl) +- +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteLayer_finiteDimensional +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- FiniteDimensional +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) := +- (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer +- H E).toLinearEquiv.finiteDimensional +- +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteLayer_numberField +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- NumberField +- (abstractFixedFieldCyclotomicFiniteLayer H E) := +- NumberField.of_module_finite +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsAbelianGalois +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let : IsAbelianGalois +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- exact +- IsAbelianGalois.of_algHom +- ((abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase +- H E).comp +- (AlgEquiv.toAlgHom +- (AlgEquiv.symm +- (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer +- H E)))) +- +-instance +- abstractFixedFieldCyclotomicFiniteLayer_baseScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsScalarTower ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) := by +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- apply IsScalarTower.of_algebraMap_eq +- intro x +- apply Subtype.ext +- change +- algebraMap ℚ +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) x = +- algebraMap +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) +- (algebraMap ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) x) +- exact +- IsScalarTower.algebraMap_apply +- ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) x +- +-/-- The finite rational layer embedded into its corresponding +-intermediate field over the abstract fixed field. -/ +-noncomputable def +- abstractFixedFieldCyclotomicFiniteLayerEmbedding +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- E →ₐ[ℚ] +- abstractFixedFieldCyclotomicFiniteLayer H E := by +- exact +- (AlgEquiv.toAlgHom +- (AlgEquiv.restrictScalars ℚ +- (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer +- H E))).comp +- (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E) +- +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra E +- (abstractFixedFieldCyclotomicFiniteLayer H E) := +- RingHom.toAlgebra +- (AlgHom.toRingHom +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E)) +- +-/-- The finite-layer action on its actual image in the relative fixed +-field. -/ +-noncomputable instance +- abstractFixedFieldCyclotomicFiniteLayer_layerSMul +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- SMul E +- (abstractFixedFieldCyclotomicFiniteLayer H E) := +- Algebra.toSMul +- (self := abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E) +- +-instance +- abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsScalarTower ℚ E +- (abstractFixedFieldCyclotomicFiniteLayer H E) := +- IsScalarTower.of_algebraMap_eq' +- (AlgHom.comp_algebraMap +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E)).symm +- +-/-- The finite cyclotomic layer as an object of the finite-Galois +-inverse system of the actual maximal-unramified extension. -/ +-@[reducible] +-noncomputable def +- abstractFixedFieldCyclotomicFiniteGaloisLayer +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- FiniteGaloisIntermediateField +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field)) where +- toIntermediateField := +- abstractFixedFieldCyclotomicFiniteLayer H E +- finiteDimensional := +- abstractFixedFieldCyclotomicFiniteLayer_finiteDimensional H E +- isGalois := +- (abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E).toIsGalois +- +-/-- The explicit base algebra on a finite cyclotomic layer is the canonical +-intermediate-field inclusion used by the finite Galois inverse system. -/ +-theorem abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra_eq_algebra' +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E = +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).algebra' := by +- apply Algebra.algebra_ext +- intro x +- apply Subtype.ext +- rfl +- +-/-- The finite Galois layer uses its canonical inclusion into the full +-relative fixed field for the upper scalar action. -/ +-instance +- abstractFixedFieldCyclotomicFiniteGaloisLayer_scalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsScalarTower +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).toIntermediateField +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field)) := by +- let i : +- (abstractFixedFieldCyclotomicFiniteGaloisLayer +- H E).toIntermediateField →ₐ[ +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field] +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) := +- { (abstractFixedFieldCyclotomicFiniteGaloisLayer +- H E).toIntermediateField.val.toRingHom with +- commutes' := by +- intro x +- rfl } +- exact +- IsScalarTower.of_algebraMap_eq' +- (AlgHom.comp_algebraMap i).symm +- +-/-- The canonical inclusion of the finite cyclotomic layer into the +-full abstract-fixed-field compositum. -/ +-private noncomputable def +- abstractFixedFieldCyclotomicFiniteLayerInclusion +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- abstractFixedFieldCyclotomicFiniteLayer H E →ₐ[ +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field] +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) := +- IntermediateField.val +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- +-/-- The two embeddings of a finite rational cyclotomic layer into the +-full abstract-fixed-field compositum agree. -/ +-private theorem +- abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- (z : E) : +- abstractFixedFieldCyclotomicFiniteLayerInclusion H E +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E z) = +- rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H +- (z : rationalCyclotomicZHatField) := by +- exact Subtype.ext rfl +- +-/-- Restriction to `E` commutes pointwise with the restriction from the +-full rational cyclotomic tower. -/ +-private theorem +- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- [Normal ℚ E] +- (σ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) +- (z : E) : +- ((AlgEquiv.restrictNormalHom E +- (abstractFixedFieldCyclotomicRestriction H σ)) z : +- rationalCyclotomicZHatField) = +- (abstractFixedFieldCyclotomicRestriction H σ) +- (z : rationalCyclotomicZHatField) := by +- exact +- AlgEquiv.restrictNormal_commutes +- (abstractFixedFieldCyclotomicRestriction H σ) E z +- +-/-- The raw cyclotomic restriction commutes with the canonical embedding +-of the full rational cyclotomic tower. -/ +-private theorem +- abstractFixedFieldCyclotomicRestriction_embedding_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (σ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) +- (z : rationalCyclotomicZHatField) : +- rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H +- (abstractFixedFieldCyclotomicRestriction H σ z) = +- σ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H z) := by +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) +- exact +- AlgEquiv.restrictNormal_commutes +- (MulSemiringAction.toAlgEquiv ℚ U σ) +- rationalCyclotomicZHatField z +- +-/-- Restriction to the finite compositum layer commutes with its +-canonical inclusion into the full compositum. -/ +-private theorem +- restrictNormalHom_abstractFixedFieldCyclotomicFiniteLayer_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- [Normal +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E)] +- (σ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) +- (z : abstractFixedFieldCyclotomicFiniteLayer H E) : +- abstractFixedFieldCyclotomicFiniteLayerInclusion H E +- (AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteLayer H E) σ z) = +- σ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E z) := by +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) +- let P : IntermediateField F U := +- abstractFixedFieldCyclotomicFiniteLayer H E +- exact +- AlgEquiv.restrictNormal_commutes +- (MulSemiringAction.toAlgEquiv F U σ) P z +- +-/-- Restricting the finite-compositum action further to `E` commutes +-with the explicit embedding of `E` into that finite layer. -/ +-private theorem +- abstractFixedFieldCyclotomicFiniteLayerEmbedding_restrict_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- [Normal ℚ E] +- [Normal +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E)] +- (σ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) +- (z : E) : +- abstractFixedFieldCyclotomicFiniteLayerEmbedding H E +- (IntermediateField.restrictRestrictAlgEquivMapHom +- ℚ E +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- (AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) z) = +- (AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E z) := by +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) +- let P : IntermediateField F U := +- abstractFixedFieldCyclotomicFiniteLayer H E +- exact +- AlgEquiv.restrictNormal_commutes +- (MulSemiringAction.toAlgEquiv ℚ P +- (AlgEquiv.restrictNormalHom P σ)) E z +- +-/-- The left finite-level restriction, after both canonical embeddings into +-the full compositum, is the action of `σ` on the cyclotomic embedding. -/ +-private theorem +- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_left_embedded +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- [Normal ℚ E] +- (σ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) +- (x : E) : +- abstractFixedFieldCyclotomicFiniteLayerInclusion H E +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E +- (AlgEquiv.restrictNormalHom E +- (abstractFixedFieldCyclotomicRestriction H σ) x)) = +- σ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H +- (x : rationalCyclotomicZHatField)) := by +- calc +- abstractFixedFieldCyclotomicFiniteLayerInclusion H E +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E +- (AlgEquiv.restrictNormalHom E +- (abstractFixedFieldCyclotomicRestriction H σ) x)) = +- rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H +- (((AlgEquiv.restrictNormalHom E +- (abstractFixedFieldCyclotomicRestriction H σ) x) : +- rationalCyclotomicZHatField)) := +- abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion H E _ +- _ = rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H +- (abstractFixedFieldCyclotomicRestriction H σ +- (x : rationalCyclotomicZHatField)) := +- congrArg +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H) +- (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_apply +- H E σ x) +- _ = σ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H (x : rationalCyclotomicZHatField)) := +- abstractFixedFieldCyclotomicRestriction_embedding_apply +- H σ (x : rationalCyclotomicZHatField) +- +-/-- The right finite-level restriction, after both canonical embeddings into +-the full compositum, is the same action of `σ`. -/ +-private theorem +- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_right_embedded +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- [Normal ℚ E] +- [Normal +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E)] +- (σ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) +- (x : E) : +- abstractFixedFieldCyclotomicFiniteLayerInclusion H E +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E +- (IntermediateField.restrictRestrictAlgEquivMapHom +- ℚ E +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- (AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x)) = +- σ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H +- (x : rationalCyclotomicZHatField)) := by +- calc +- abstractFixedFieldCyclotomicFiniteLayerInclusion H E +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E +- (IntermediateField.restrictRestrictAlgEquivMapHom +- ℚ E +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- (AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x)) = +- abstractFixedFieldCyclotomicFiniteLayerInclusion H E +- ((AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x)) := +- congrArg +- (abstractFixedFieldCyclotomicFiniteLayerInclusion H E) +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding_restrict_apply +- H E σ x) +- _ = σ +- (abstractFixedFieldCyclotomicFiniteLayerInclusion H E +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x)) := +- restrictNormalHom_abstractFixedFieldCyclotomicFiniteLayer_apply +- H E σ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x) +- _ = σ +- (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum +- H (x : rationalCyclotomicZHatField)) := +- congrArg σ +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion H E x) +- +-/-- Pointwise form of finite-layer restriction compatibility. -/ +-private theorem +- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_pointwise +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- [Normal ℚ E] +- [Normal +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E)] +- (σ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) +- (x : E) : +- AlgEquiv.restrictNormalHom E +- (abstractFixedFieldCyclotomicRestriction H σ) x = +- IntermediateField.restrictRestrictAlgEquivMapHom +- ℚ E +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- (AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x := by +- apply +- (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E).injective +- apply +- (abstractFixedFieldCyclotomicFiniteLayerInclusion H E).injective +- exact +- (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_left_embedded +- H E σ x).trans +- (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_right_embedded +- H E σ x).symm +- +-/-- Restricting through a finite layer commutes with restriction from +-the full abstract-fixed-field compositum. -/ +-theorem +- restrictNormalHom_abstractFixedFieldCyclotomicRestriction +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- (σ : +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) : +- letI : Normal ℚ E := E.isGalois.to_normal +- AlgEquiv.restrictNormalHom E +- (abstractFixedFieldCyclotomicRestriction H σ) = +- IntermediateField.restrictRestrictAlgEquivMapHom +- ℚ E +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- (AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) +- σ) := by +- let : Normal ℚ E := E.isGalois.to_normal +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) +- let T := rationalCyclotomicZHatField +- let P : IntermediateField F U := +- abstractFixedFieldCyclotomicFiniteLayer H E +- let : Algebra T U := +- abstractFixedFieldCyclotomicCompositum_algebra H +- let : IsScalarTower ℚ T U := +- abstractFixedFieldCyclotomicCompositum_scalarTower H +- let : Algebra E P := +- abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E +- let : IsScalarTower ℚ E P := +- abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower H E +- let : IsAbelianGalois F P := by +- change IsAbelianGalois F +- (abstractFixedFieldCyclotomicFiniteLayer H E) +- exact +- abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E +- let : Normal F P := IsGalois.to_normal +- apply AlgEquiv.ext +- intro x +- exact +- restrictNormalHom_abstractFixedFieldCyclotomicRestriction_pointwise +- H E σ x +- +-section FiniteCoordinateHelpers +- +-/-- Opaque three-step equality composition used to keep large dependent +-finite-level coordinates out of endpoint proof normalization. -/ +-private theorem cyclotomicAbstractFixedFieldArtin_eqTransThree +- {α : Type} {a b c d : α} +- (hab : a = b) (hbc : b = c) (hcd : c = d) : +- a = d := +- hab.trans (hbc.trans hcd) +- +-private abbrev cyclotomicAbstractFixedFieldArtinCoordinateBase +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- +-private abbrev cyclotomicAbstractFixedFieldArtinCoordinateRelative +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (rationalCyclotomicFieldInertia_le H.field) +- +-private abbrev cyclotomicAbstractFixedFieldArtinCoordinateLayer +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IntermediateField +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := +- abstractFixedFieldCyclotomicFiniteLayer H E +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- Algebra ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H).algebra' +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateBaseFiniteDimensional +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- FiniteDimensional ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- NumberField +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := +- NumberField.of_module_finite ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateBaseSeparableAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- Algebra +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (SeparableClosure ℚ) := +- IntermediateField.toAlgebra +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateRelativeAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- Algebra +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H).algebra' +- +-local instance +- cyclotomicAbstractFixedFieldArtinCoordinateRelativeScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- IsScalarTower ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := +- abstractFixedFieldCyclotomicCompositum_baseScalarTower H +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateRelativeIsAbelianGalois +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : +- IsAbelianGalois +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateAlgebra +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra ℚ E := +- E.toIntermediateField.algebra' +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateNumberField +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- NumberField E := +- NumberField.of_module_finite ℚ E +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsAbelianGalois ℚ E := +- IsAbelianGalois.of_algHom E.toIntermediateField.val +- +-local instance +- cyclotomicAbstractFixedFieldArtinCoordinateNormal +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Normal ℚ E := +- E.isGalois.to_normal +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).algebra' +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := +- DivisionRing.toRatAlgebra +- +-local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsScalarTower ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := by +- let hI := rationalCyclotomicFieldInertia_le H.field +- apply IsScalarTower.of_algebraMap_eq +- intro x +- apply Subtype.ext +- change +- algebraMap ℚ +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) x = +- algebraMap +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) +- (algebraMap ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) x) +- exact +- IsScalarTower.algebraMap_apply +- ℚ +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI) x +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- NumberField +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) := +- abstractFixedFieldCyclotomicFiniteLayer_numberField H E +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra E +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := +- abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerSMul +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- SMul E +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := +- abstractFixedFieldCyclotomicFiniteLayer_layerSMul H E +- +-local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsScalarTower ℚ E +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := +- abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower H E +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerRelativeAlgebra +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Algebra +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := +- IntermediateField.toAlgebra +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) +- +-local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerRelativeScalarTower +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsScalarTower +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := +- abstractFixedFieldCyclotomicFiniteGaloisLayer_scalarTower H E +- +-noncomputable local instance +- cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- IsAbelianGalois +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := +- abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E +- +-/-- The full abstract Artin symbol whose finite coordinates are compared +-below. Naming this endpoint keeps its relative fixed-field data opaque. -/ +-private noncomputable def +- cyclotomicAbstractFixedFieldArtinAbstractEndpoint +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : +- Gal(rationalCyclotomicZHatField / ℚ) := +- abstractFixedFieldCyclotomicRestriction H +- (infiniteGlobalArtinMonoidHom +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a) +- +-/-- The rational norm Artin symbol serving as the other full endpoint. -/ +-private noncomputable def +- cyclotomicAbstractFixedFieldArtinRationalEndpoint +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : +- Gal(rationalCyclotomicZHatField / ℚ) := +- rationalCyclotomicZHatGlobalArtin +- (IdeleGroup.norm ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) a) +- +-/-- The finite restriction map packaged together with its pointwise Artin +-naturality law. The map is inferred from the generic hom-level theorem, so +-no concrete instance tower is compared after the opaque boundary. -/ +-private noncomputable def cyclotomicAbstractFixedFieldArtinCoordinateMapData +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- {f : Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / +- cyclotomicAbstractFixedFieldArtinCoordinateBase H) →* +- Gal(E / ℚ) // +- f.comp +- (@globalArtinMonoidHomOfNumberField +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) +- (inferInstance : Field +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) +- (inferInstance : Field +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E)) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E)) = +- (globalArtinMonoidHom (K := ℚ) (L := E)).comp +- (IdeleGroup.norm ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H))} := by +- have hnat := +- @globalArtinMonoidHomOfNumberField_norm_restriction +- ℚ E +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) +- inferInstance inferInstance +- inferInstance +- (cyclotomicAbstractFixedFieldArtinCoordinateNumberField E) +- (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) +- (cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois E) +- inferInstance +- (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) +- inferInstance +- (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E) +- exact +- ⟨(@AlgEquiv.restrictNormalHom +- ℚ inferInstance +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) +- inferInstance +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) +- E inferInstance +- (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateNormal E)).comp +- (@AlgEquiv.restrictScalarsHom +- ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) +- inferInstance inferInstance inferInstance +- (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E)), +- hnat⟩ +- +-/-- The fixed restriction map from the relative finite layer to one rational +-cyclotomic coordinate. -/ +-private noncomputable def cyclotomicAbstractFixedFieldArtinCoordinateMap +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / +- cyclotomicAbstractFixedFieldArtinCoordinateBase H) →* +- Gal(E / ℚ) := +- (cyclotomicAbstractFixedFieldArtinCoordinateMapData H E).1 +- +-/-- Naturality of the named coordinate map, kept at the hom level so later +-pointwise rewrites match the opaque map without unfolding its data package. -/ +-private theorem cyclotomicAbstractFixedFieldArtinCoordinateMap_naturality +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- (cyclotomicAbstractFixedFieldArtinCoordinateMap H E).comp +- (globalArtinMonoidHom +- (K := cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (L := abstractFixedFieldCyclotomicFiniteGaloisLayer H E)) = +- (globalArtinMonoidHom (K := ℚ) (L := E)).comp +- (IdeleGroup.norm ℚ +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) := +- (cyclotomicAbstractFixedFieldArtinCoordinateMapData H E).2 +- +-/-- Pointwise identification of the named coordinate map with the concrete +-two-stage restriction used by the abstract fixed-field comparison. -/ +-private theorem cyclotomicAbstractFixedFieldArtinCoordinateMap_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) +- (σ : Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / +- cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : +- cyclotomicAbstractFixedFieldArtinCoordinateMap H E σ = +- @IntermediateField.restrictRestrictAlgEquivMapHom +- ℚ E +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) +- inferInstance inferInstance inferInstance inferInstance +- (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) +- (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateNormal E) σ := +- rfl +- +-/-- The relative projection, common rational finite value, and rational +-infinite projection, with both comparison steps packaged by the generic +-provider before this concrete tower becomes opaque. -/ +-private noncomputable def +- cyclotomicAbstractFixedFieldArtinCoordinateBridgeData +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) := +- @compRestrictNormalHomInfiniteGlobalArtinRationalCyclotomicDataOfNumberField +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) +- (inferInstance : Field +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) +- (inferInstance : Field +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H)) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelativeAlgebra H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelativeIsAbelianGalois H) +- a +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E) +- E +- (cyclotomicAbstractFixedFieldArtinCoordinateNumberField E) +- (cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois E) +- (cyclotomicAbstractFixedFieldArtinCoordinateMap H E) +- (cyclotomicAbstractFixedFieldArtinCoordinateMap_naturality H E) +- +-/-- The abstract endpoint after projection to one finite coordinate. -/ +-private noncomputable def +- cyclotomicAbstractFixedFieldArtinAbstractCoordinate +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Gal(E / ℚ) := +- AlgEquiv.restrictNormalHom E +- (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) +- +-/-- The relative infinite Artin symbol, restricted to a finite layer and +-then mapped to the corresponding rational coordinate. -/ +-private noncomputable def +- cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Gal(E / ℚ) := +- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.1 +- +-/-- The finite relative Artin symbol mapped to one rational coordinate. -/ +-private noncomputable def +- cyclotomicAbstractFixedFieldArtinFiniteCoordinate +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Gal(E / ℚ) := +- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.1 +- +-/-- The finite rational Artin coordinate of the idele norm. -/ +-private noncomputable def +- cyclotomicAbstractFixedFieldArtinRationalCoordinate +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Gal(E / ℚ) := +- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.1 +- +-/-- Naturality of the finite global Artin map at the concrete cyclotomic +-coordinate. -/ +-private theorem +- cyclotomicAbstractFixedFieldArtinCoordinateNaturality +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E = +- cyclotomicAbstractFixedFieldArtinRationalCoordinate H a E := by +- rfl +- +-/-- The rational endpoint after projection to one finite coordinate. -/ +-private noncomputable def +- cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- Gal(E / ℚ) := +- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.2 +- +-/-- The abstract restriction map projected to the concrete finite layer. -/ +-private theorem +- cyclotomicAbstractFixedFieldArtinCoordinateRestriction +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = +- cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E := by +- calc +- cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = +- AlgEquiv.restrictNormalHom E +- (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) := rfl +- _ = cyclotomicAbstractFixedFieldArtinCoordinateMap H E +- (AlgEquiv.restrictNormalHom +- (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) +- (infiniteGlobalArtinMonoidHom +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a)) := +- (restrictNormalHom_abstractFixedFieldCyclotomicRestriction +- H E +- (infiniteGlobalArtinMonoidHom +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H) +- (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a)).trans +- (cyclotomicAbstractFixedFieldArtinCoordinateMap_apply H E _).symm +- _ = cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E := rfl +- +-/-- Restricting the infinite relative Artin symbol supplies exactly the +-finite Artin coordinate. -/ +-private theorem +- cyclotomicAbstractFixedFieldArtinCoordinateLayerProjection +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E = +- cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E := +- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).2.1 +- +-/-- The rational cyclotomic Artin map projected to the same finite +-coordinate. -/ +-private theorem +- cyclotomicAbstractFixedFieldArtinCoordinateRationalProjection +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate H a E = +- cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E := by +- exact +- (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).2.2.symm +- +-/-- Equality of the two full endpoints at one opaque finite coordinate. -/ +-private theorem +- cyclotomicAbstractFixedFieldArtinFiniteCoordinateComparison +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) +- (E : +- FiniteGaloisIntermediateField +- ℚ rationalCyclotomicZHatField) : +- AlgEquiv.restrictNormalHom E +- (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) = +- AlgEquiv.restrictNormalHom E +- (cyclotomicAbstractFixedFieldArtinRationalEndpoint H a) := by +- change +- cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = +- cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate H a E +- exact +- cyclotomicAbstractFixedFieldArtin_eqTransThree +- (cyclotomicAbstractFixedFieldArtinCoordinateRestriction H a E) +- (cyclotomicAbstractFixedFieldArtinCoordinateLayerProjection H a E) +- (cyclotomicAbstractFixedFieldArtinCoordinateRationalProjection +- H a E).symm +- +-/-- The finite-coordinate comparison assembled in the rational cyclotomic +-inverse limit. -/ +-private theorem +- abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtin_inverseLimit +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : +- IdeleGroup +- (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : +- cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a = +- cyclotomicAbstractFixedFieldArtinRationalEndpoint H a := by +- apply +- (InfiniteGalois.continuousMulEquivToLimit +- ℚ rationalCyclotomicZHatField).injective +- apply Subtype.ext +- funext Eop +- exact +- cyclotomicAbstractFixedFieldArtinFiniteCoordinateComparison +- H a Eop.unop +- +-end FiniteCoordinateHelpers +- +-/-- The actual infinite global Artin map on an abstract fixed field +-restricts to the rational cyclotomic Artin map of the ordinary idele +-norm. -/ +-@[simp] +-theorem +- abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtinMonoidHom +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : +- IdeleGroup +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) : +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- letI : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- letI : NumberField F := +- NumberField.of_module_finite ℚ F +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI +- letI : IsAbelianGalois F U := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- abstractFixedFieldCyclotomicRestriction H +- (infiniteGlobalArtinMonoidHom F U a) = +- rationalCyclotomicZHatGlobalArtin +- (IdeleGroup.norm ℚ F a) := by +- exact +- abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtin_inverseLimit +- H a +- +-/-- In the normalized actual Galois coordinate, the infinite global +-Artin symbol is exactly the normalized cyclotomic idele value. -/ +-theorem +- abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : +- IdeleGroup +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) : +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- letI : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- letI : NumberField F := +- NumberField.of_module_finite ℚ F +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI +- letI : IsAbelianGalois F U := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- Multiplicative.toAdd +- (abstractFixedFieldCyclotomicGalEquivZHat H +- (infiniteGlobalArtinMonoidHom F U a)) = +- normalizedCyclotomicZHatIdeleValue F +- (Additive.ofMul a) := by +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- let : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- let : NumberField F := +- NumberField.of_module_finite ℚ F +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI +- let : IsAbelianGalois F U := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- apply +- zHatMulNat_injective +- (H.residueDegree rationalCyclotomicDegreeData).pos +- calc +- (H.residueDegree rationalCyclotomicDegreeData : ℕ) • +- Multiplicative.toAdd +- (abstractFixedFieldCyclotomicGalEquivZHat H +- (infiniteGlobalArtinMonoidHom F U a)) = +- Multiplicative.toAdd +- (rationalCyclotomicZHatFieldGalEquivZHat +- (abstractFixedFieldCyclotomicRestriction H +- (infiniteGlobalArtinMonoidHom F U a))) := by +- exact +- (abstractFixedFieldCyclotomicRestriction_coordinate H +- (infiniteGlobalArtinMonoidHom F U a)).symm +- _ = +- Multiplicative.toAdd +- (rationalCyclotomicZHatFieldGalEquivZHat +- (rationalCyclotomicZHatGlobalArtin +- (IdeleGroup.norm ℚ F a))) := by +- rw [ +- abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtinMonoidHom] +- _ = +- cyclotomicZHatNormComposite F +- (Additive.ofMul a) := by +- rfl +- _ = +- cyclotomicZHatIntersectionDegree F • +- normalizedCyclotomicZHatIdeleValue F +- (Additive.ofMul a) := by +- exact +- (cyclotomicZHatIntersectionDegree_nsmul_normalizedIdeleValue +- F (Additive.ofMul a)).symm +- _ = +- (H.residueDegree rationalCyclotomicDegreeData : ℕ) • +- normalizedCyclotomicZHatIdeleValue F +- (Additive.ofMul a) := by +- rw [ +- cyclotomicZHatIntersectionDegree_abstractFixedField_eq_residueDegree +- H] +- +-/-- Representative form of the actual cyclotomic Artin-coordinate +-identity after descent of the normalized value to the idele class +-group. -/ +-theorem +- abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom_mk +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (a : +- IdeleGroup +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)) : +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- letI : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- letI : NumberField F := +- NumberField.of_module_finite ℚ F +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI +- letI : IsAbelianGalois F U := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- Multiplicative.toAdd +- (abstractFixedFieldCyclotomicGalEquivZHat H +- (infiniteGlobalArtinMonoidHom F U a)) = +- normalizedCyclotomicZHatIdeleClassValueContinuous F +- (Additive.ofMul +- (QuotientGroup.mk' +- (IdeleGroup.principalSubgroup F) a)) := by +- have hSeparableClosureAlgebra : +- cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra = +- rationalSeparableClosureAlgebra := +- Subsingleton.elim _ _ +- cases hSeparableClosureAlgebra +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI +- let : IsAbelianGalois F U := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- calc +- Multiplicative.toAdd +- (abstractFixedFieldCyclotomicGalEquivZHat H +- (infiniteGlobalArtinMonoidHom F U a)) = +- normalizedCyclotomicZHatIdeleValue F +- (Additive.ofMul a) := +- abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom +- H a +- _ = +- normalizedCyclotomicZHatIdeleClassValueContinuous F +- (Additive.ofMul +- (QuotientGroup.mk' +- (IdeleGroup.principalSubgroup F) a)) := +- (normalizedCyclotomicZHatIdeleClassValueContinuous_mk +- (K := F) a).symm +- +-/-- The genuine infinite global Artin symbol of the cyclotomic +-maximal-unramified extension kills every principal idele of the +-abstract fixed field. -/ +-@[simp] +-theorem +- infiniteGlobalArtinMonoidHom_abstractFixedFieldCyclotomic_principalIdele +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (x : +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field)ˣ) : +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- letI : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- letI : NumberField F := +- NumberField.of_module_finite ℚ F +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI +- letI : IsAbelianGalois F U := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- infiniteGlobalArtinMonoidHom F U +- (IdeleGroup.principalIdele F x) = +- 1 := by +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H.field +- let : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- let : NumberField F := +- NumberField.of_module_finite ℚ F +- let hI := +- rationalCyclotomicFieldInertia_le H.field +- let U := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hI +- let : IsAbelianGalois F U := +- abstractFixedFieldCyclotomic_isAbelianGalois H +- have hcoord : +- Multiplicative.toAdd +- (abstractFixedFieldCyclotomicGalEquivZHat H +- (infiniteGlobalArtinMonoidHom F U +- (IdeleGroup.principalIdele F x))) = 0 := +- (abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom +- H (IdeleGroup.principalIdele F x)).trans +- (normalizedCyclotomicZHatIdeleValue_principalIdele_eq_zero F x) +- apply (abstractFixedFieldCyclotomicGalEquivZHat H).injective +- rw [map_one] +- apply Multiplicative.ext +- exact hcoord.trans toAdd_one.symm ++attribute [local instance] ++ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal ++ abstractFixedFieldCyclotomic_numberField + + /-- The genuine cyclotomic maximal-unramified Artin map descended to + the idele class group of an abstract fixed field. -/ +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinBase.lean +new file mode 100644 +index 0000000..dc971fc +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinBase.lean +@@ -0,0 +1,545 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicIdeleClassValuation ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.InfiniteGlobalArtin ++import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.MaximalUnramifiedReciprocity ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open KummerTheory ++ ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra : ++ Algebra ℚ (SeparableClosure ℚ) := ++ DivisionRing.toRatAlgebra ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra : ++ Algebra ℚ rationalCyclotomicZHatField := ++ DivisionRing.toRatAlgebra ++ ++/-- Cyclotomic field inertia is contained in the original abstract ++field subgroup. -/ ++theorem rationalCyclotomicFieldInertia_le ++ (H : ClosedSubgroup ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ (rationalCyclotomicDegreeData.fieldInertia H).toSubgroup ≤ ++ H.toSubgroup := by ++ intro σ hσ ++ exact hσ.1 ++ ++ ++theorem extensionSubgroup_rationalCyclotomicFieldInertia ++ (H : ClosedSubgroup ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ CyclicCohomology.extensionSubgroup H ++ (rationalCyclotomicDegreeData.fieldInertia H) ++ (rationalCyclotomicFieldInertia_le H) = ++ rationalCyclotomicDegreeData.fieldInertiaWithin H := by ++ ext σ ++ rw [ ++ mem_extensionSubgroup_iff, ++ rationalCyclotomicDegreeData.mem_fieldInertiaWithin_iff, ++ rationalCyclotomicDegreeData.mem_fieldInertia_iff] ++ exact and_iff_right σ.2 ++ ++/-- The actual Galois group of the cyclotomic maximal-unramified ++extension of an abstract fixed field, in its normalized `ZHat` ++coordinate. -/ ++noncomputable def abstractFixedFieldCyclotomicGalEquivZHat ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ≃* ++ Multiplicative ZHat := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ let qField : ++ H.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI ≃* ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) := ++ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ let qInertia : ++ H.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI ≃* ++ H.field.toSubgroup ⧸ ++ rationalCyclotomicDegreeData.fieldInertiaWithin H.field := ++ QuotientGroup.quotientMulEquivOfEq ++ (extensionSubgroup_rationalCyclotomicFieldInertia H.field) ++ exact ++ qField.symm.trans ++ (qInertia.trans ++ (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv ++ (H.toFiniteResidueAbstractField ++ rationalCyclotomicDegreeData))) ++ ++/-- On an absolute-Galois representative fixing the lower field, the ++actual cyclotomic Galois coordinate is its normalized degree. -/ ++@[simp] ++theorem abstractFixedFieldCyclotomicGalEquivZHat_extensionClass ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (σ : H.field.toSubgroup) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ abstractFixedFieldCyclotomicGalEquivZHat H ++ (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ (QuotientGroup.mk σ)) = ++ rationalCyclotomicDegreeData.normalizedDegree ++ (H.toFiniteResidueAbstractField ++ rationalCyclotomicDegreeData) σ := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ let qField := ++ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ change ++ (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv ++ (H.toFiniteResidueAbstractField ++ rationalCyclotomicDegreeData)) ++ (QuotientGroup.quotientMulEquivOfEq ++ (extensionSubgroup_rationalCyclotomicFieldInertia H.field) ++ (qField.symm (qField (QuotientGroup.mk σ)))) = ++ rationalCyclotomicDegreeData.normalizedDegree ++ (H.toFiniteResidueAbstractField ++ rationalCyclotomicDegreeData) σ ++ rw [qField.symm_apply_apply] ++ rfl ++ ++/-- Quotient-level evaluation of the actual cyclotomic Galois ++coordinate. -/ ++@[simp] ++theorem abstractFixedFieldCyclotomicGalEquivZHat_quotientClass ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (q : ++ H.field.toSubgroup ⧸ ++ rationalCyclotomicDegreeData.fieldInertiaWithin H.field) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ let qInertia : ++ H.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI ≃* ++ H.field.toSubgroup ⧸ ++ rationalCyclotomicDegreeData.fieldInertiaWithin H.field := ++ QuotientGroup.quotientMulEquivOfEq ++ (extensionSubgroup_rationalCyclotomicFieldInertia H.field) ++ abstractFixedFieldCyclotomicGalEquivZHat H ++ (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ (qInertia.symm q)) = ++ rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv ++ (H.toFiniteResidueAbstractField ++ rationalCyclotomicDegreeData) q := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ let qField := ++ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ let qInertia : ++ H.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI ≃* ++ H.field.toSubgroup ⧸ ++ rationalCyclotomicDegreeData.fieldInertiaWithin H.field := ++ QuotientGroup.quotientMulEquivOfEq ++ (extensionSubgroup_rationalCyclotomicFieldInertia H.field) ++ change ++ (rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv ++ (H.toFiniteResidueAbstractField ++ rationalCyclotomicDegreeData)) ++ (qInertia ++ (qField.symm ++ (qField (qInertia.symm q)))) = ++ rationalCyclotomicDegreeData.maximalUnramifiedDegreeEquiv ++ (H.toFiniteResidueAbstractField ++ rationalCyclotomicDegreeData) q ++ rw [qField.symm_apply_apply, qInertia.apply_symm_apply] ++ ++/-- The extension fixed by cyclotomic field inertia is an actual ++abelian Galois extension of the lower abstract fixed field. -/ ++theorem abstractFixedFieldCyclotomic_isAbelianGalois ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ IsAbelianGalois ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ let : IsGalois ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) := ++ LocalClassFieldTheory.abstractRelativeFixedField_isGalois ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ let e := ++ abstractFixedFieldCyclotomicGalEquivZHat H ++ exact ++ { is_comm.comm := by ++ intro σ τ ++ apply e.injective ++ simpa only [map_mul] using mul_comm (e σ) (e τ) } ++ ++/-- The rational cyclotomic `ZHat`-field embedded in the actual ++maximal-unramified compositum of an abstract fixed field. -/ ++noncomputable def ++ rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ rationalCyclotomicZHatField →ₐ[ℚ] ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let J := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ have hTJ : ++ rationalCyclotomicZHatField ≤ J := by ++ change ++ rationalCyclotomicZHatField ≤ ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ rw [ ++ rationalCyclotomicDegreeData_fixedField_fieldInertia] ++ exact le_sup_right ++ exact IntermediateField.inclusion hTJ ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicCompositum_algebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ Algebra rationalCyclotomicZHatField ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) := ++ ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H).toRingHom).toAlgebra ++ ++instance abstractFixedFieldCyclotomicCompositum_scalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ IsScalarTower ℚ rationalCyclotomicZHatField ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) := ++ IsScalarTower.of_algebraMap_eq' ++ ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H).comp_algebraMap).symm ++ ++instance abstractFixedFieldCyclotomicCompositum_baseScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ IsScalarTower ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ apply IsScalarTower.of_algebraMap_eq ++ intro x ++ apply Subtype.ext ++ rfl ++ ++/-- Restriction from the actual maximal-unramified compositum of an ++abstract fixed field to the rational cyclotomic factor. -/ ++noncomputable def abstractFixedFieldCyclotomicRestriction ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) →* ++ Gal(rationalCyclotomicZHatField / ℚ) := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ exact ++ IntermediateField.restrictRestrictAlgEquivMapHom ++ ℚ rationalCyclotomicZHatField ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) ++ ++/-- On a quotient representative, cyclotomic restriction of the ++actual relative automorphism is ordinary restriction of the same ++ambient absolute-Galois automorphism. -/ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal : ++ Normal ℚ rationalCyclotomicZHatField := ++ rationalCyclotomicZHatField_isNormal ++ ++@[simp] ++theorem abstractFixedFieldCyclotomicRestriction_extensionClass ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (σ : H.field.toSubgroup) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ abstractFixedFieldCyclotomicRestriction H ++ (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ (QuotientGroup.mk σ)) = ++ AlgEquiv.restrictNormalHom ++ rationalCyclotomicZHatField σ.1 := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ let τ := ++ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ (QuotientGroup.mk' ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) hI) ++ σ) ++ apply AlgEquiv.ext ++ intro x ++ apply Subtype.ext ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI ++ have hrestrict : ++ algebraMap rationalCyclotomicZHatField U ++ ((abstractFixedFieldCyclotomicRestriction H τ) x) = ++ τ (algebraMap rationalCyclotomicZHatField U x) := by ++ change ++ algebraMap rationalCyclotomicZHatField U ++ ((AlgEquiv.restrictNormal ++ (MulSemiringAction.toAlgEquiv ℚ U τ) ++ rationalCyclotomicZHatField) x) = ++ (MulSemiringAction.toAlgEquiv ℚ U τ) ++ (algebraMap rationalCyclotomicZHatField U x) ++ exact ++ AlgEquiv.restrictNormal_commutes ++ (MulSemiringAction.toAlgEquiv ℚ U τ) ++ rationalCyclotomicZHatField x ++ have halgebraMap_eq_embedding ++ (z : rationalCyclotomicZHatField) : ++ algebraMap rationalCyclotomicZHatField U z = ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H z : U) := by ++ rfl ++ have hembedding_coe ++ (z : rationalCyclotomicZHatField) : ++ (((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H z : U) : SeparableClosure ℚ)) = ++ (z : SeparableClosure ℚ) := by ++ rfl ++ have halgebraMap_coe ++ (z : rationalCyclotomicZHatField) : ++ ((algebraMap rationalCyclotomicZHatField U z : U) : ++ SeparableClosure ℚ) = ++ (z : SeparableClosure ℚ) := by ++ rw [halgebraMap_eq_embedding] ++ exact hembedding_coe z ++ have hambient := ++ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup_mk_apply_val ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal σ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H x) ++ calc ++ (((abstractFixedFieldCyclotomicRestriction H τ) x : ++ rationalCyclotomicZHatField) : ++ SeparableClosure ℚ) = ++ ((τ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H x) : ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) : ++ SeparableClosure ℚ) := by ++ calc ++ (((abstractFixedFieldCyclotomicRestriction H τ) x : ++ rationalCyclotomicZHatField) : SeparableClosure ℚ) = ++ ((algebraMap rationalCyclotomicZHatField U ++ ((abstractFixedFieldCyclotomicRestriction H τ) x) : U) : ++ SeparableClosure ℚ) := ++ (halgebraMap_coe ++ ((abstractFixedFieldCyclotomicRestriction H τ) x)).symm ++ _ = ((τ (algebraMap rationalCyclotomicZHatField U x) : U) : ++ SeparableClosure ℚ) := ++ congrArg (fun y : U => (y : SeparableClosure ℚ)) hrestrict ++ _ = ((τ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H x) : U) : SeparableClosure ℚ) := by ++ rw [halgebraMap_eq_embedding] ++ _ = σ.1 (x : SeparableClosure ℚ) := by ++ calc ++ ((τ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H x) : U) : SeparableClosure ℚ) = ++ σ.1 ++ ((rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H x : U) : SeparableClosure ℚ) := by ++ simpa only [τ, U] using hambient.symm ++ _ = σ.1 (x : SeparableClosure ℚ) := by ++ rw [hembedding_coe] ++ _ = ++ (((AlgEquiv.restrictNormalHom ++ rationalCyclotomicZHatField σ.1) x : ++ rationalCyclotomicZHatField) : ++ SeparableClosure ℚ) := by ++ exact ++ (AlgEquiv.restrictNormal_commutes ++ σ.1 rationalCyclotomicZHatField x).symm ++ ++/-- Raw cyclotomic restriction is residue-degree multiplication of ++the normalized actual Galois coordinate. -/ ++theorem ++ abstractFixedFieldCyclotomicRestriction_coordinate ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (τ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) : ++ Multiplicative.toAdd ++ (rationalCyclotomicZHatFieldGalEquivZHat ++ (abstractFixedFieldCyclotomicRestriction H τ)) = ++ (H.residueDegree rationalCyclotomicDegreeData : ℕ) • ++ Multiplicative.toAdd ++ (abstractFixedFieldCyclotomicGalEquivZHat H τ) := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let hnormal : ++ (CyclicCohomology.extensionSubgroup H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI).Normal := by ++ rw [extensionSubgroup_rationalCyclotomicFieldInertia] ++ infer_instance ++ let qField := ++ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) H.field ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ hI hnormal ++ obtain ⟨q, rfl⟩ := qField.surjective τ ++ refine Quotient.inductionOn' q ?_ ++ intro σ ++ rw [ ++ abstractFixedFieldCyclotomicRestriction_extensionClass, ++ abstractFixedFieldCyclotomicGalEquivZHat_extensionClass] ++ exact ++ (rationalCyclotomicDegreeData.residueDegree_nsmul_normalizedDegree ++ (H.toFiniteResidueAbstractField ++ rationalCyclotomicDegreeData) σ).symm ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinComparison.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinComparison.lean +new file mode 100644 +index 0000000..0788ef1 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinComparison.lean +@@ -0,0 +1,273 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinCoordinates ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open KummerTheory ++ ++attribute [local instance] ++ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal ++ abstractFixedFieldCyclotomic_numberField ++ ++/-- The actual infinite global Artin map on an abstract fixed field ++restricts to the rational cyclotomic Artin map of the ordinary idele ++norm. -/ ++@[simp] ++theorem ++ abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtinMonoidHom ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : ++ IdeleGroup ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) : ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ letI : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ letI : NumberField F := ++ NumberField.of_module_finite ℚ F ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI ++ letI : IsAbelianGalois F U := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ abstractFixedFieldCyclotomicRestriction H ++ (infiniteGlobalArtinMonoidHom F U a) = ++ rationalCyclotomicZHatGlobalArtin ++ (IdeleGroup.norm ℚ F a) := by ++ exact ++ abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtin_inverseLimit ++ H a ++ ++/-- In the normalized actual Galois coordinate, the infinite global ++Artin symbol is exactly the normalized cyclotomic idele value. -/ ++theorem ++ abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : ++ IdeleGroup ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) : ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ letI : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ letI : NumberField F := ++ NumberField.of_module_finite ℚ F ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI ++ letI : IsAbelianGalois F U := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ Multiplicative.toAdd ++ (abstractFixedFieldCyclotomicGalEquivZHat H ++ (infiniteGlobalArtinMonoidHom F U a)) = ++ normalizedCyclotomicZHatIdeleValue F ++ (Additive.ofMul a) := by ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ let : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ let : NumberField F := ++ NumberField.of_module_finite ℚ F ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI ++ let : IsAbelianGalois F U := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ apply ++ zHatMulNat_injective ++ (H.residueDegree rationalCyclotomicDegreeData).pos ++ calc ++ (H.residueDegree rationalCyclotomicDegreeData : ℕ) • ++ Multiplicative.toAdd ++ (abstractFixedFieldCyclotomicGalEquivZHat H ++ (infiniteGlobalArtinMonoidHom F U a)) = ++ Multiplicative.toAdd ++ (rationalCyclotomicZHatFieldGalEquivZHat ++ (abstractFixedFieldCyclotomicRestriction H ++ (infiniteGlobalArtinMonoidHom F U a))) := by ++ exact ++ (abstractFixedFieldCyclotomicRestriction_coordinate H ++ (infiniteGlobalArtinMonoidHom F U a)).symm ++ _ = ++ Multiplicative.toAdd ++ (rationalCyclotomicZHatFieldGalEquivZHat ++ (rationalCyclotomicZHatGlobalArtin ++ (IdeleGroup.norm ℚ F a))) := by ++ rw [ ++ abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtinMonoidHom] ++ _ = ++ cyclotomicZHatNormComposite F ++ (Additive.ofMul a) := by ++ rfl ++ _ = ++ cyclotomicZHatIntersectionDegree F • ++ normalizedCyclotomicZHatIdeleValue F ++ (Additive.ofMul a) := by ++ exact ++ (cyclotomicZHatIntersectionDegree_nsmul_normalizedIdeleValue ++ F (Additive.ofMul a)).symm ++ _ = ++ (H.residueDegree rationalCyclotomicDegreeData : ℕ) • ++ normalizedCyclotomicZHatIdeleValue F ++ (Additive.ofMul a) := by ++ rw [ ++ cyclotomicZHatIntersectionDegree_abstractFixedField_eq_residueDegree ++ H] ++ ++/-- Representative form of the actual cyclotomic Artin-coordinate ++identity after descent of the normalized value to the idele class ++group. -/ ++theorem ++ abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom_mk ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : ++ IdeleGroup ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) : ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ letI : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ letI : NumberField F := ++ NumberField.of_module_finite ℚ F ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI ++ letI : IsAbelianGalois F U := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ Multiplicative.toAdd ++ (abstractFixedFieldCyclotomicGalEquivZHat H ++ (infiniteGlobalArtinMonoidHom F U a)) = ++ normalizedCyclotomicZHatIdeleClassValueContinuous F ++ (Additive.ofMul ++ (QuotientGroup.mk' ++ (IdeleGroup.principalSubgroup F) a)) := by ++ have hSeparableClosureAlgebra : ++ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra = ++ rationalSeparableClosureAlgebra := ++ Subsingleton.elim _ _ ++ cases hSeparableClosureAlgebra ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI ++ let : IsAbelianGalois F U := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ calc ++ Multiplicative.toAdd ++ (abstractFixedFieldCyclotomicGalEquivZHat H ++ (infiniteGlobalArtinMonoidHom F U a)) = ++ normalizedCyclotomicZHatIdeleValue F ++ (Additive.ofMul a) := ++ abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom ++ H a ++ _ = ++ normalizedCyclotomicZHatIdeleClassValueContinuous F ++ (Additive.ofMul ++ (QuotientGroup.mk' ++ (IdeleGroup.principalSubgroup F) a)) := ++ (normalizedCyclotomicZHatIdeleClassValueContinuous_mk ++ (K := F) a).symm ++ ++/-- The genuine infinite global Artin symbol of the cyclotomic ++maximal-unramified extension kills every principal idele of the ++abstract fixed field. -/ ++@[simp] ++theorem ++ infiniteGlobalArtinMonoidHom_abstractFixedFieldCyclotomic_principalIdele ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (x : ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)ˣ) : ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ letI : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ letI : NumberField F := ++ NumberField.of_module_finite ℚ F ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI ++ letI : IsAbelianGalois F U := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ infiniteGlobalArtinMonoidHom F U ++ (IdeleGroup.principalIdele F x) = ++ 1 := by ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ let : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ let : NumberField F := ++ NumberField.of_module_finite ℚ F ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI ++ let : IsAbelianGalois F U := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ have hcoord : ++ Multiplicative.toAdd ++ (abstractFixedFieldCyclotomicGalEquivZHat H ++ (infiniteGlobalArtinMonoidHom F U ++ (IdeleGroup.principalIdele F x))) = 0 := ++ (abstractFixedFieldCyclotomicGalEquivZHat_infiniteGlobalArtinMonoidHom ++ H (IdeleGroup.principalIdele F x)).trans ++ (normalizedCyclotomicZHatIdeleValue_principalIdele_eq_zero F x) ++ apply (abstractFixedFieldCyclotomicGalEquivZHat H).injective ++ rw [map_one] ++ apply Multiplicative.ext ++ exact hcoord.trans toAdd_one.symm ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCompositum.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCompositum.lean +new file mode 100644 +index 0000000..1295a7e +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCompositum.lean +@@ -0,0 +1,257 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinBase ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open KummerTheory ++ ++attribute [local instance] ++ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal ++ ++/-- The canonical compositum of an abstract fixed field with a finite ++layer of the rational cyclotomic `ZHat`-extension. -/ ++def abstractFixedFieldCyclotomicFiniteCompositum ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IntermediateField ℚ (SeparableClosure ℚ) := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ⊔ ++ IntermediateField.lift E.toIntermediateField ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteCompositum_finiteDimensional ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ FiniteDimensional ℚ ++ (abstractFixedFieldCyclotomicFiniteCompositum H E) := by ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ let : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ let : FiniteDimensional ℚ ++ (IntermediateField.lift E.toIntermediateField) := ++ ((IntermediateField.liftAlgEquiv ++ E.toIntermediateField).toLinearEquiv).finiteDimensional ++ exact IntermediateField.finiteDimensional_sup ++ F (IntermediateField.lift E.toIntermediateField) ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteCompositum_numberField ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ NumberField ++ (abstractFixedFieldCyclotomicFiniteCompositum H E) := ++ NumberField.of_module_finite ℚ ++ (abstractFixedFieldCyclotomicFiniteCompositum H E) ++ ++/-- The lower abstract fixed field embedded into its finite ++cyclotomic compositum. -/ ++noncomputable def ++ abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field →ₐ[ℚ] ++ abstractFixedFieldCyclotomicFiniteCompositum H E := ++ IntermediateField.inclusion ++ (show ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ≤ ++ abstractFixedFieldCyclotomicFiniteCompositum H E from ++ le_sup_left) ++ ++ ++noncomputable local instance ++ abstractFixedFieldCyclotomic_numberField ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ NumberField ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) := by ++ let : FiniteDimensional ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ exact ++ NumberField.of_module_finite ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ ++/-- A finite rational cyclotomic layer embedded into its compositum ++with the abstract fixed field. -/ ++noncomputable def ++ abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ E →ₐ[ℚ] ++ abstractFixedFieldCyclotomicFiniteCompositum H E := ++ (IntermediateField.inclusion ++ (show ++ IntermediateField.lift E.toIntermediateField ≤ ++ abstractFixedFieldCyclotomicFiniteCompositum H E from ++ le_sup_right)).comp ++ (IntermediateField.liftAlgEquiv E.toIntermediateField).toAlgHom ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteCompositum_baseAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteCompositum H E) := ++ RingHom.toAlgebra ++ (AlgHom.toRingHom ++ (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E)) ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteCompositum_layerAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra E ++ (abstractFixedFieldCyclotomicFiniteCompositum H E) := ++ RingHom.toAlgebra ++ (AlgHom.toRingHom ++ (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E)) ++ ++/-- The finite-layer action induced by its explicit embedding into the ++finite compositum. -/ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteCompositum_layerSMul ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ SMul E ++ (abstractFixedFieldCyclotomicFiniteCompositum H E) := ++ Algebra.toSMul ++ (self := ++ abstractFixedFieldCyclotomicFiniteCompositum_layerAlgebra H E) ++ ++instance ++ abstractFixedFieldCyclotomicFiniteCompositum_baseScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsScalarTower ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteCompositum H E) := ++ IsScalarTower.of_algebraMap_eq' ++ (AlgHom.comp_algebraMap ++ (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E)).symm ++ ++instance ++ abstractFixedFieldCyclotomicFiniteCompositum_layerScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsScalarTower ℚ E ++ (abstractFixedFieldCyclotomicFiniteCompositum H E) := ++ IsScalarTower.of_algebraMap_eq' ++ (AlgHom.comp_algebraMap ++ (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E)).symm ++ ++/-- Inclusion of the finite cyclotomic compositum into the actual ++maximal-unramified compositum. -/ ++noncomputable def ++ abstractFixedFieldCyclotomicFiniteCompositumInclusion ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ abstractFixedFieldCyclotomicFiniteCompositum H E →ₐ[ℚ] ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let J := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicDegreeData.fieldInertia H.field) ++ have hle : ++ abstractFixedFieldCyclotomicFiniteCompositum H E ≤ J := by ++ dsimp only [J] ++ rw [ ++ rationalCyclotomicDegreeData_fixedField_fieldInertia H.field] ++ exact ++ sup_le_sup le_rfl ++ (IntermediateField.lift_le E.toIntermediateField) ++ exact IntermediateField.inclusion hle ++ ++/-- The same finite-compositum inclusion over the lower abstract fixed ++field. -/ ++noncomputable def ++ abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ abstractFixedFieldCyclotomicFiniteCompositum H E →ₐ[ ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field] ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI := by ++ let f := ++ abstractFixedFieldCyclotomicFiniteCompositumInclusion H E ++ exact ++ { f.toRingHom with ++ commutes' := by ++ intro x ++ rfl } ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCoordinates.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCoordinates.lean +new file mode 100644 +index 0000000..64ed13e +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinCoordinates.lean +@@ -0,0 +1,668 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinFiniteRestriction ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open KummerTheory ++ ++attribute [local instance] ++ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal ++ abstractFixedFieldCyclotomic_numberField ++ ++section FiniteCoordinateHelpers ++ ++/-- Opaque three-step equality composition used to keep large dependent ++finite-level coordinates out of endpoint proof normalization. -/ ++private theorem cyclotomicAbstractFixedFieldArtin_eqTransThree ++ {α : Type} {a b c d : α} ++ (hab : a = b) (hbc : b = c) (hcd : c = d) : ++ a = d := ++ hab.trans (hbc.trans hcd) ++ ++private abbrev cyclotomicAbstractFixedFieldArtinCoordinateBase ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ ++private abbrev cyclotomicAbstractFixedFieldArtinCoordinateRelative ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) ++ ++private abbrev cyclotomicAbstractFixedFieldArtinCoordinateLayer ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IntermediateField ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := ++ abstractFixedFieldCyclotomicFiniteLayer H E ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ Algebra ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H).algebra' ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateBaseFiniteDimensional ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ FiniteDimensional ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ NumberField ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) := ++ NumberField.of_module_finite ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateBaseSeparableAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ Algebra ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (SeparableClosure ℚ) := ++ IntermediateField.toAlgebra ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateRelativeAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ Algebra ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H).algebra' ++ ++local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateRelativeScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ IsScalarTower ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := ++ abstractFixedFieldCyclotomicCompositum_baseScalarTower H ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateRelativeIsAbelianGalois ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) : ++ IsAbelianGalois ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateAlgebra ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra ℚ E := ++ E.toIntermediateField.algebra' ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateNumberField ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ NumberField E := ++ NumberField.of_module_finite ℚ E ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsAbelianGalois ℚ E := ++ IsAbelianGalois.of_algHom E.toIntermediateField.val ++ ++local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateNormal ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Normal ℚ E := ++ E.isGalois.to_normal ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).algebra' ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := ++ DivisionRing.toRatAlgebra ++ ++local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsScalarTower ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := by ++ let hI := rationalCyclotomicFieldInertia_le H.field ++ apply IsScalarTower.of_algebraMap_eq ++ intro x ++ apply Subtype.ext ++ change ++ algebraMap ℚ ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) x = ++ algebraMap ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) ++ (algebraMap ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) x) ++ exact ++ IsScalarTower.algebraMap_apply ++ ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) x ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ NumberField ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) := ++ abstractFixedFieldCyclotomicFiniteLayer_numberField H E ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra E ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := ++ abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerSMul ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ SMul E ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := ++ abstractFixedFieldCyclotomicFiniteLayer_layerSMul H E ++ ++local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsScalarTower ℚ E ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := ++ abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower H E ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerRelativeAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := ++ IntermediateField.toAlgebra ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) ++ ++local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerRelativeScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsScalarTower ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) := ++ abstractFixedFieldCyclotomicFiniteGaloisLayer_scalarTower H E ++ ++noncomputable local instance ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsAbelianGalois ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayer H E) := ++ abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E ++ ++/-- The full abstract Artin symbol whose finite coordinates are compared ++below. Naming this endpoint keeps its relative fixed-field data opaque. -/ ++private noncomputable def ++ cyclotomicAbstractFixedFieldArtinAbstractEndpoint ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : ++ Gal(rationalCyclotomicZHatField / ℚ) := ++ abstractFixedFieldCyclotomicRestriction H ++ (infiniteGlobalArtinMonoidHom ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a) ++ ++/-- The rational norm Artin symbol serving as the other full endpoint. -/ ++private noncomputable def ++ cyclotomicAbstractFixedFieldArtinRationalEndpoint ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : ++ Gal(rationalCyclotomicZHatField / ℚ) := ++ rationalCyclotomicZHatGlobalArtin ++ (IdeleGroup.norm ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) a) ++ ++ ++private noncomputable def cyclotomicAbstractFixedFieldArtinCoordinateMapData ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ {f : Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / ++ cyclotomicAbstractFixedFieldArtinCoordinateBase H) →* ++ Gal(E / ℚ) // ++ f.comp ++ (@globalArtinMonoidHomOfNumberField ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) ++ (inferInstance : Field ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) ++ (inferInstance : Field ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E)) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E)) = ++ (globalArtinMonoidHom (K := ℚ) (L := E)).comp ++ (IdeleGroup.norm ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H))} := by ++ have hnat := ++ @globalArtinMonoidHomOfNumberField_norm_restriction ++ ℚ E ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) ++ inferInstance inferInstance ++ inferInstance ++ (cyclotomicAbstractFixedFieldArtinCoordinateNumberField E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois E) ++ inferInstance ++ (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) ++ inferInstance ++ (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerIsAbelianGalois H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E) ++ exact ++ ⟨(@AlgEquiv.restrictNormalHom ++ ℚ inferInstance ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) ++ inferInstance ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) ++ E inferInstance ++ (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateNormal E)).comp ++ (@AlgEquiv.restrictScalarsHom ++ ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) ++ inferInstance inferInstance inferInstance ++ (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E)), ++ hnat⟩ ++ ++/-- The fixed restriction map from the relative finite layer to one rational ++cyclotomic coordinate. -/ ++private noncomputable def cyclotomicAbstractFixedFieldArtinCoordinateMap ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / ++ cyclotomicAbstractFixedFieldArtinCoordinateBase H) →* ++ Gal(E / ℚ) := ++ (cyclotomicAbstractFixedFieldArtinCoordinateMapData H E).1 ++ ++ ++private theorem cyclotomicAbstractFixedFieldArtinCoordinateMap_naturality ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ (cyclotomicAbstractFixedFieldArtinCoordinateMap H E).comp ++ (globalArtinMonoidHom ++ (K := cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (L := abstractFixedFieldCyclotomicFiniteGaloisLayer H E)) = ++ (globalArtinMonoidHom (K := ℚ) (L := E)).comp ++ (IdeleGroup.norm ℚ ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) := ++ (cyclotomicAbstractFixedFieldArtinCoordinateMapData H E).2 ++ ++/-- Pointwise identification of the named coordinate map with the concrete ++two-stage restriction used by the abstract fixed-field comparison. -/ ++private theorem cyclotomicAbstractFixedFieldArtinCoordinateMap_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ (σ : Gal(abstractFixedFieldCyclotomicFiniteGaloisLayer H E / ++ cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : ++ cyclotomicAbstractFixedFieldArtinCoordinateMap H E σ = ++ @IntermediateField.restrictRestrictAlgEquivMapHom ++ ℚ E ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) ++ inferInstance inferInstance inferInstance inferInstance ++ (cyclotomicAbstractFixedFieldArtinCoordinateAlgebra E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateBaseAlgebra H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerRatAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseAlgebra H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerScalarTower H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerBaseScalarTower H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateNormal E) σ := ++ rfl ++ ++/-- The relative projection, common rational finite value, and rational ++infinite projection, with both comparison steps packaged by the generic ++provider before this concrete tower becomes opaque. -/ ++private noncomputable def ++ cyclotomicAbstractFixedFieldArtinCoordinateBridgeData ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) := ++ @compRestrictNormalHomInfiniteGlobalArtinRationalCyclotomicDataOfNumberField ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) ++ (inferInstance : Field ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (cyclotomicAbstractFixedFieldArtinCoordinateBaseNumberField H) ++ (inferInstance : Field ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H)) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelativeAlgebra H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelativeIsAbelianGalois H) ++ a ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerNumberField H E) ++ E ++ (cyclotomicAbstractFixedFieldArtinCoordinateNumberField E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateIsAbelianGalois E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateMap H E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateMap_naturality H E) ++ ++/-- The abstract endpoint after projection to one finite coordinate. -/ ++private noncomputable def ++ cyclotomicAbstractFixedFieldArtinAbstractCoordinate ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Gal(E / ℚ) := ++ AlgEquiv.restrictNormalHom E ++ (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) ++ ++/-- The relative infinite Artin symbol, restricted to a finite layer and ++then mapped to the corresponding rational coordinate. -/ ++private noncomputable def ++ cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Gal(E / ℚ) := ++ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.1 ++ ++/-- The finite relative Artin symbol mapped to one rational coordinate. -/ ++private noncomputable def ++ cyclotomicAbstractFixedFieldArtinFiniteCoordinate ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Gal(E / ℚ) := ++ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.1 ++ ++/-- The finite rational Artin coordinate of the idele norm. -/ ++private noncomputable def ++ cyclotomicAbstractFixedFieldArtinRationalCoordinate ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Gal(E / ℚ) := ++ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.1 ++ ++/-- Naturality of the finite global Artin map at the concrete cyclotomic ++coordinate. -/ ++private theorem ++ cyclotomicAbstractFixedFieldArtinCoordinateNaturality ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E = ++ cyclotomicAbstractFixedFieldArtinRationalCoordinate H a E := by ++ rfl ++ ++/-- The rational endpoint after projection to one finite coordinate. -/ ++private noncomputable def ++ cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Gal(E / ℚ) := ++ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).1.2.2 ++ ++/-- The abstract restriction map projected to the concrete finite layer. -/ ++private theorem ++ cyclotomicAbstractFixedFieldArtinCoordinateRestriction ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = ++ cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E := by ++ calc ++ cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = ++ AlgEquiv.restrictNormalHom E ++ (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) := rfl ++ _ = cyclotomicAbstractFixedFieldArtinCoordinateMap H E ++ (AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) ++ (infiniteGlobalArtinMonoidHom ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a)) := ++ (restrictNormalHom_abstractFixedFieldCyclotomicRestriction ++ H E ++ (infiniteGlobalArtinMonoidHom ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRelative H) a)).trans ++ (cyclotomicAbstractFixedFieldArtinCoordinateMap_apply H E _).symm ++ _ = cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E := rfl ++ ++/-- Restricting the infinite relative Artin symbol supplies exactly the ++finite Artin coordinate. -/ ++private theorem ++ cyclotomicAbstractFixedFieldArtinCoordinateLayerProjection ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ cyclotomicAbstractFixedFieldArtinRestrictedLayerCoordinate H a E = ++ cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E := ++ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).2.1 ++ ++/-- The rational cyclotomic Artin map projected to the same finite ++coordinate. -/ ++private theorem ++ cyclotomicAbstractFixedFieldArtinCoordinateRationalProjection ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate H a E = ++ cyclotomicAbstractFixedFieldArtinFiniteCoordinate H a E := by ++ exact ++ (cyclotomicAbstractFixedFieldArtinCoordinateBridgeData H a E).2.2.symm ++ ++/-- Equality of the two full endpoints at one opaque finite coordinate. -/ ++private theorem ++ cyclotomicAbstractFixedFieldArtinFiniteCoordinateComparison ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ AlgEquiv.restrictNormalHom E ++ (cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a) = ++ AlgEquiv.restrictNormalHom E ++ (cyclotomicAbstractFixedFieldArtinRationalEndpoint H a) := by ++ change ++ cyclotomicAbstractFixedFieldArtinAbstractCoordinate H a E = ++ cyclotomicAbstractFixedFieldArtinRationalEndpointCoordinate H a E ++ exact ++ cyclotomicAbstractFixedFieldArtin_eqTransThree ++ (cyclotomicAbstractFixedFieldArtinCoordinateRestriction H a E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateLayerProjection H a E) ++ (cyclotomicAbstractFixedFieldArtinCoordinateRationalProjection ++ H a E).symm ++ ++/-- The finite-coordinate comparison assembled in the rational cyclotomic ++inverse limit. -/ ++theorem ++ abstractFixedFieldCyclotomicRestriction_infiniteGlobalArtin_inverseLimit ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (a : ++ IdeleGroup ++ (cyclotomicAbstractFixedFieldArtinCoordinateBase H)) : ++ cyclotomicAbstractFixedFieldArtinAbstractEndpoint H a = ++ cyclotomicAbstractFixedFieldArtinRationalEndpoint H a := by ++ apply ++ (InfiniteGalois.continuousMulEquivToLimit ++ ℚ rationalCyclotomicZHatField).injective ++ apply Subtype.ext ++ funext Eop ++ exact ++ cyclotomicAbstractFixedFieldArtinFiniteCoordinateComparison ++ H a Eop.unop ++ ++end FiniteCoordinateHelpers ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteLayer.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteLayer.lean +new file mode 100644 +index 0000000..0ee433c +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteLayer.lean +@@ -0,0 +1,298 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinCompositum ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open KummerTheory ++ ++attribute [local instance] ++ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal ++ abstractFixedFieldCyclotomic_numberField ++ ++/-- The finite cyclotomic compositum as an intermediate field of the ++actual maximal-unramified extension. -/ ++noncomputable def abstractFixedFieldCyclotomicFiniteLayer ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ IntermediateField ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) := ++ (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase H E).fieldRange ++ ++/-- The base algebra on the finite field range, obtained from the ++explicit base embedding followed by the field-range equivalence. -/ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := ++ RingHom.toAlgebra ++ ((AlgHom.toRingHom ++ (AlgEquiv.toAlgHom ++ (AlgHom.equivFieldRange ++ (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase ++ H E)))).comp ++ (AlgHom.toRingHom ++ (abstractFixedFieldCyclotomicFiniteCompositumBaseEmbedding H E))) ++ ++/-- The scalar action belonging to the canonical base algebra on the ++finite field range. -/ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteLayer_baseSMul ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ SMul ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := ++ Algebra.toSMul ++ (self := abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E) ++ ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteLayer_baseModule ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Module ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := ++ @Algebra.toModule ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ _ _ ++ (abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E) ++ ++/-- The field-range equivalence rebuilt over the explicit base ++algebras. Its underlying ring equivalence is the canonical one. -/ ++noncomputable def ++ abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ abstractFixedFieldCyclotomicFiniteCompositum H E ≃ₐ[ ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field] ++ abstractFixedFieldCyclotomicFiniteLayer H E := ++ AlgEquiv.ofRingEquiv ++ (f := ++ (AlgHom.equivFieldRange ++ (abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase ++ H E)).toRingEquiv) ++ (fun _ => rfl) ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteLayer_finiteDimensional ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ FiniteDimensional ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := ++ (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer ++ H E).toLinearEquiv.finiteDimensional ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteLayer_numberField ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ NumberField ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := ++ NumberField.of_module_finite ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsAbelianGalois ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ let : IsAbelianGalois ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) := ++ abstractFixedFieldCyclotomic_isAbelianGalois H ++ exact ++ IsAbelianGalois.of_algHom ++ ((abstractFixedFieldCyclotomicFiniteCompositumInclusionOverBase ++ H E).comp ++ (AlgEquiv.toAlgHom ++ (AlgEquiv.symm ++ (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer ++ H E)))) ++ ++instance ++ abstractFixedFieldCyclotomicFiniteLayer_baseScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsScalarTower ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := by ++ let hI := ++ rationalCyclotomicFieldInertia_le H.field ++ apply IsScalarTower.of_algebraMap_eq ++ intro x ++ apply Subtype.ext ++ change ++ algebraMap ℚ ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) x = ++ algebraMap ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) ++ (algebraMap ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) x) ++ exact ++ IsScalarTower.algebraMap_apply ++ ℚ ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hI) x ++ ++/-- The finite rational layer embedded into its corresponding ++intermediate field over the abstract fixed field. -/ ++noncomputable def ++ abstractFixedFieldCyclotomicFiniteLayerEmbedding ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ E →ₐ[ℚ] ++ abstractFixedFieldCyclotomicFiniteLayer H E := by ++ exact ++ (AlgEquiv.toAlgHom ++ (AlgEquiv.restrictScalars ℚ ++ (abstractFixedFieldCyclotomicFiniteCompositumEquivFiniteLayer ++ H E))).comp ++ (abstractFixedFieldCyclotomicFiniteCompositumLayerEmbedding H E) ++ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ Algebra E ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := ++ RingHom.toAlgebra ++ (AlgHom.toRingHom ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E)) ++ ++/-- The finite-layer action on its actual image in the relative fixed ++field. -/ ++noncomputable instance ++ abstractFixedFieldCyclotomicFiniteLayer_layerSMul ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ SMul E ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := ++ Algebra.toSMul ++ (self := abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E) ++ ++instance ++ abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsScalarTower ℚ E ++ (abstractFixedFieldCyclotomicFiniteLayer H E) := ++ IsScalarTower.of_algebraMap_eq' ++ (AlgHom.comp_algebraMap ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E)).symm ++ ++/-- The finite cyclotomic layer as an object of the finite-Galois ++inverse system of the actual maximal-unramified extension. -/ ++@[reducible] ++noncomputable def ++ abstractFixedFieldCyclotomicFiniteGaloisLayer ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ FiniteGaloisIntermediateField ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field)) where ++ toIntermediateField := ++ abstractFixedFieldCyclotomicFiniteLayer H E ++ finiteDimensional := ++ abstractFixedFieldCyclotomicFiniteLayer_finiteDimensional H E ++ isGalois := ++ (abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E).toIsGalois ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteRestriction.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteRestriction.lean +new file mode 100644 +index 0000000..bcfbbc2 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/CyclotomicAbstractFixedFieldArtinFiniteRestriction.lean +@@ -0,0 +1,462 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicAbstractFixedFieldArtinFiniteLayer ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open KummerTheory ++ ++attribute [local instance] ++ cyclotomicAbstractFixedFieldArtin_separableClosureAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldAlgebra ++ cyclotomicAbstractFixedFieldArtin_cyclotomicZHatFieldNormal ++ abstractFixedFieldCyclotomic_numberField ++ ++/-- The explicit base algebra on a finite cyclotomic layer is the canonical ++intermediate-field inclusion used by the finite Galois inverse system. -/ ++theorem abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra_eq_algebra' ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ abstractFixedFieldCyclotomicFiniteLayer_baseAlgebra H E = ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).algebra' := by ++ apply Algebra.algebra_ext ++ intro x ++ apply Subtype.ext ++ rfl ++ ++/-- The finite Galois layer uses its canonical inclusion into the full ++relative fixed field for the upper scalar action. -/ ++instance ++ abstractFixedFieldCyclotomicFiniteGaloisLayer_scalarTower ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ IsScalarTower ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E).toIntermediateField ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field)) := by ++ let i : ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer ++ H E).toIntermediateField →ₐ[ ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field] ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) := ++ { (abstractFixedFieldCyclotomicFiniteGaloisLayer ++ H E).toIntermediateField.val.toRingHom with ++ commutes' := by ++ intro x ++ rfl } ++ exact ++ IsScalarTower.of_algebraMap_eq' ++ (AlgHom.comp_algebraMap i).symm ++ ++/-- The canonical inclusion of the finite cyclotomic layer into the ++full abstract-fixed-field compositum. -/ ++private noncomputable def ++ abstractFixedFieldCyclotomicFiniteLayerInclusion ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) : ++ abstractFixedFieldCyclotomicFiniteLayer H E →ₐ[ ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field] ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) := ++ IntermediateField.val ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ ++/-- The two embeddings of a finite rational cyclotomic layer into the ++full abstract-fixed-field compositum agree. -/ ++private theorem ++ abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ (z : E) : ++ abstractFixedFieldCyclotomicFiniteLayerInclusion H E ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E z) = ++ rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H ++ (z : rationalCyclotomicZHatField) := by ++ exact Subtype.ext rfl ++ ++/-- Restriction to `E` commutes pointwise with the restriction from the ++full rational cyclotomic tower. -/ ++private theorem ++ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ [Normal ℚ E] ++ (σ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) ++ (z : E) : ++ ((AlgEquiv.restrictNormalHom E ++ (abstractFixedFieldCyclotomicRestriction H σ)) z : ++ rationalCyclotomicZHatField) = ++ (abstractFixedFieldCyclotomicRestriction H σ) ++ (z : rationalCyclotomicZHatField) := by ++ exact ++ AlgEquiv.restrictNormal_commutes ++ (abstractFixedFieldCyclotomicRestriction H σ) E z ++ ++/-- The raw cyclotomic restriction commutes with the canonical embedding ++of the full rational cyclotomic tower. -/ ++private theorem ++ abstractFixedFieldCyclotomicRestriction_embedding_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (σ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) ++ (z : rationalCyclotomicZHatField) : ++ rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H ++ (abstractFixedFieldCyclotomicRestriction H σ z) = ++ σ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H z) := by ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) ++ exact ++ AlgEquiv.restrictNormal_commutes ++ (MulSemiringAction.toAlgEquiv ℚ U σ) ++ rationalCyclotomicZHatField z ++ ++/-- Restriction to the finite compositum layer commutes with its ++canonical inclusion into the full compositum. -/ ++private theorem ++ restrictNormalHom_abstractFixedFieldCyclotomicFiniteLayer_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ [Normal ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E)] ++ (σ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) ++ (z : abstractFixedFieldCyclotomicFiniteLayer H E) : ++ abstractFixedFieldCyclotomicFiniteLayerInclusion H E ++ (AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteLayer H E) σ z) = ++ σ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E z) := by ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) ++ let P : IntermediateField F U := ++ abstractFixedFieldCyclotomicFiniteLayer H E ++ exact ++ AlgEquiv.restrictNormal_commutes ++ (MulSemiringAction.toAlgEquiv F U σ) P z ++ ++/-- Restricting the finite-compositum action further to `E` commutes ++with the explicit embedding of `E` into that finite layer. -/ ++private theorem ++ abstractFixedFieldCyclotomicFiniteLayerEmbedding_restrict_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ [Normal ℚ E] ++ [Normal ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E)] ++ (σ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) ++ (z : E) : ++ abstractFixedFieldCyclotomicFiniteLayerEmbedding H E ++ (IntermediateField.restrictRestrictAlgEquivMapHom ++ ℚ E ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ (AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) z) = ++ (AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E z) := by ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) ++ let P : IntermediateField F U := ++ abstractFixedFieldCyclotomicFiniteLayer H E ++ exact ++ AlgEquiv.restrictNormal_commutes ++ (MulSemiringAction.toAlgEquiv ℚ P ++ (AlgEquiv.restrictNormalHom P σ)) E z ++ ++/-- The left finite-level restriction, after both canonical embeddings into ++the full compositum, is the action of `σ` on the cyclotomic embedding. -/ ++private theorem ++ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_left_embedded ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ [Normal ℚ E] ++ (σ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) ++ (x : E) : ++ abstractFixedFieldCyclotomicFiniteLayerInclusion H E ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E ++ (AlgEquiv.restrictNormalHom E ++ (abstractFixedFieldCyclotomicRestriction H σ) x)) = ++ σ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H ++ (x : rationalCyclotomicZHatField)) := by ++ calc ++ abstractFixedFieldCyclotomicFiniteLayerInclusion H E ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E ++ (AlgEquiv.restrictNormalHom E ++ (abstractFixedFieldCyclotomicRestriction H σ) x)) = ++ rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H ++ (((AlgEquiv.restrictNormalHom E ++ (abstractFixedFieldCyclotomicRestriction H σ) x) : ++ rationalCyclotomicZHatField)) := ++ abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion H E _ ++ _ = rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H ++ (abstractFixedFieldCyclotomicRestriction H σ ++ (x : rationalCyclotomicZHatField)) := ++ congrArg ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H) ++ (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_apply ++ H E σ x) ++ _ = σ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H (x : rationalCyclotomicZHatField)) := ++ abstractFixedFieldCyclotomicRestriction_embedding_apply ++ H σ (x : rationalCyclotomicZHatField) ++ ++/-- The right finite-level restriction, after both canonical embeddings into ++the full compositum, is the same action of `σ`. -/ ++private theorem ++ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_right_embedded ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ [Normal ℚ E] ++ [Normal ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E)] ++ (σ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) ++ (x : E) : ++ abstractFixedFieldCyclotomicFiniteLayerInclusion H E ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E ++ (IntermediateField.restrictRestrictAlgEquivMapHom ++ ℚ E ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ (AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x)) = ++ σ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum H ++ (x : rationalCyclotomicZHatField)) := by ++ calc ++ abstractFixedFieldCyclotomicFiniteLayerInclusion H E ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E ++ (IntermediateField.restrictRestrictAlgEquivMapHom ++ ℚ E ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ (AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x)) = ++ abstractFixedFieldCyclotomicFiniteLayerInclusion H E ++ ((AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x)) := ++ congrArg ++ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E) ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding_restrict_apply ++ H E σ x) ++ _ = σ ++ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x)) := ++ restrictNormalHom_abstractFixedFieldCyclotomicFiniteLayer_apply ++ H E σ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E x) ++ _ = σ ++ (rationalCyclotomicZHatFieldEmbeddingInAbstractFixedFieldCompositum ++ H (x : rationalCyclotomicZHatField)) := ++ congrArg σ ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding_inclusion H E x) ++ ++/-- Pointwise form of finite-layer restriction compatibility. -/ ++private theorem ++ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_pointwise ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ [Normal ℚ E] ++ [Normal ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E)] ++ (σ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) ++ (x : E) : ++ AlgEquiv.restrictNormalHom E ++ (abstractFixedFieldCyclotomicRestriction H σ) x = ++ IntermediateField.restrictRestrictAlgEquivMapHom ++ ℚ E ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ (AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteLayer H E) σ) x := by ++ apply ++ (abstractFixedFieldCyclotomicFiniteLayerEmbedding H E).injective ++ apply ++ (abstractFixedFieldCyclotomicFiniteLayerInclusion H E).injective ++ exact ++ (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_left_embedded ++ H E σ x).trans ++ (restrictNormalHom_abstractFixedFieldCyclotomicRestriction_right_embedded ++ H E σ x).symm ++ ++/-- Restricting through a finite layer commutes with restriction from ++the full abstract-fixed-field compositum. -/ ++theorem ++ restrictNormalHom_abstractFixedFieldCyclotomicRestriction ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (E : ++ FiniteGaloisIntermediateField ++ ℚ rationalCyclotomicZHatField) ++ (σ : ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field)) : ++ letI : Normal ℚ E := E.isGalois.to_normal ++ AlgEquiv.restrictNormalHom E ++ (abstractFixedFieldCyclotomicRestriction H σ) = ++ IntermediateField.restrictRestrictAlgEquivMapHom ++ ℚ E ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field) ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ (AlgEquiv.restrictNormalHom ++ (abstractFixedFieldCyclotomicFiniteGaloisLayer H E) ++ σ) := by ++ let : Normal ℚ E := E.isGalois.to_normal ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field ++ let U := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (rationalCyclotomicFieldInertia_le H.field) ++ let T := rationalCyclotomicZHatField ++ let P : IntermediateField F U := ++ abstractFixedFieldCyclotomicFiniteLayer H E ++ let : Algebra T U := ++ abstractFixedFieldCyclotomicCompositum_algebra H ++ let : IsScalarTower ℚ T U := ++ abstractFixedFieldCyclotomicCompositum_scalarTower H ++ let : Algebra E P := ++ abstractFixedFieldCyclotomicFiniteLayer_layerAlgebra H E ++ let : IsScalarTower ℚ E P := ++ abstractFixedFieldCyclotomicFiniteLayer_layerScalarTower H E ++ let : IsAbelianGalois F P := by ++ change IsAbelianGalois F ++ (abstractFixedFieldCyclotomicFiniteLayer H E) ++ exact ++ abstractFixedFieldCyclotomicFiniteLayer_isAbelianGalois H E ++ let : Normal F P := IsGalois.to_normal ++ apply AlgEquiv.ext ++ intro x ++ exact ++ restrictNormalHom_abstractFixedFieldCyclotomicRestriction_pointwise ++ H E σ x ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/FiniteGaloisRealizationCore.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/FiniteGaloisRealizationCore.lean +index 73951e8..edb78f8 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/FiniteGaloisRealizationCore.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/FiniteGaloisRealizationCore.lean +@@ -15,6 +15,7 @@ import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.FixedField + import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.FixedFieldIntrinsicReciprocity.BaseComparison.IntrinsicBaseEquivalence + import ValuedFieldTheory.Valuation.Completion.AbsoluteValueExtensions + ++ + set_option autoImplicit false + + /-! +@@ -431,9 +432,16 @@ noncomputable def numberFieldTowerSeparableClosureToBaseSubgroup : + (numberFieldTowerBaseSubgroup K L).toSubgroup := by + let _ : Algebra K (SeparableClosure ℚ) := + numberFieldTowerSeparableClosureBaseAlgebra K L +- refine ++ exact + { toFun := fun σ => +- ⟨AlgEquiv.restrictScalars ℚ σ, ?_⟩ ++ ⟨AlgEquiv.restrictScalars ℚ σ, by ++ change ++ AlgEquiv.restrictScalars ℚ σ ∈ ++ (numberFieldTowerBaseField K L).fixingSubgroup ++ rw [IntermediateField.mem_fixingSubgroup_iff] ++ intro x hx ++ obtain ⟨y, rfl⟩ := hx ++ exact σ.commutes y⟩ + map_one' := by + apply Subtype.ext + rfl +@@ -441,13 +449,6 @@ noncomputable def numberFieldTowerSeparableClosureToBaseSubgroup : + intro σ τ + apply Subtype.ext + rfl } +- change +- AlgEquiv.restrictScalars ℚ σ ∈ +- (numberFieldTowerBaseField K L).fixingSubgroup +- rw [IntermediateField.mem_fixingSubgroup_iff] +- intro x hx +- obtain ⟨y, rfl⟩ := hx +- exact σ.commutes y + + /-- The compatible `K`-absolute Galois group is exactly the fixing + subgroup of the embedded copy of `K` inside the rational absolute +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalHilbertSymbol/FinitePlaceFiniteSupport.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalHilbertSymbol/FinitePlaceFiniteSupport.lean +index 9f029f0..a47f31b 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalHilbertSymbol/FinitePlaceFiniteSupport.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalHilbertSymbol/FinitePlaceFiniteSupport.lean +@@ -6,6 +6,8 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + + import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison + import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin ++import Mathlib.Algebra.FiniteSupport.Basic ++ + + set_option autoImplicit false + +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturality.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturality.lean +index 974d793..dfea338 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturality.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturality.lean +@@ -4,19 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidue +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerAlgEquivNaturality ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityTowerNorm + +-set_option autoImplicit false + +-/-! +-# Naturality of the global norm-residue symbol ++set_option autoImplicit false + +-This file records the same-base restriction specialization of abstract +-norm-residue naturality in the rational absolute class formation. All +-closed subgroups remain in one fixed separable-closure ambient, so the +-statement is directly usable by fixed-field overextension arguments. +--/ + + open scoped IsMulCommutative + +@@ -34,2834 +26,11 @@ open RamificationTheory + + universe u + +-@[instance_reducible] +-private noncomputable def naturalityIdeleClassCommGroup +- (F : Type) [Field F] [NumberField F] : CommGroup (IdeleClassGroup F) := +- QuotientGroup.Quotient.commGroup (IdeleGroup.principalSubgroup F) +- +-attribute [local instance] naturalityIdeleClassCommGroup +- +-local instance ideleClassGroupIsMulCommutative +- {F : Type} [Field F] [NumberField F] +- : IsMulCommutative (IdeleClassGroup F) := +- ⟨⟨fun a b => mul_comm a b⟩⟩ +- +-local instance ideleClassSubgroupNormal +- {F : Type} [Field F] [NumberField F] +- (N : Subgroup (IdeleClassGroup F)) : N.Normal := +- N.normal_of_isMulCommutative +- +- +-/-- Two finite Galois subextensions with the same underlying closed subgroup +-are equal; the remaining structure fields are proof-irrelevant. -/ +-private theorem finiteGaloisSubextension_eq_of_field_eq +- {G : Type u} [Group G] [TopologicalSpace G] +- {K : ClosedSubgroup G} +- (A B : FiniteGaloisSubextension K) +- (h : A.field = B.field) : +- A = B := by +- cases A with +- | mk A hA nA fA => +- cases B with +- | mk B hB nB fB => +- dsimp only at h +- cases h +- rfl +- +-/-- Rebase a finite Galois subextension along equality of its bundled base. +-The field equality is the only data component; the remaining fields are +-proof-irrelevant. -/ +-private theorem finiteGaloisSubextension_transport_eq_of_field_eq +- {G : Type u} [Group G] [TopologicalSpace G] +- {A B : FiniteAbstractField G} +- (hAB : A = B) +- (P : FiniteGaloisSubextension A.field) +- (Q : FiniteGaloisSubextension B.field) +- (hfield : P.field = Q.field) : +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField G => +- FiniteGaloisSubextension X.field) +- hAB) +- P = Q := by +- cases hAB +- exact finiteGaloisSubextension_eq_of_field_eq P Q hfield +- +-/-- Transporting an additive equivalence between rational ambient fixed +-subgroups does not change the underlying direct-limit class. -/ +-private theorem rationalAmbientFixedAddEquiv_transport_apply_val +- {A B : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} +- (hAB : A = B) +- {X : Type} [AddGroup X] +- (e : X ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) +- (x : X) : +- ((Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- X ≃+ ambientFixedAddSubgroup +- rationalIdeleClassRepresentation Y.field) +- hAB) +- e x).1) = +- (e x).1 := by +- cases hAB +- rfl +- +-/-- Changing only the bundled subgroup of an additive subgroup element +-does not change its value in the ambient group. -/ +-private theorem addSubgroupCongr_apply_val +- {A : Type} [AddGroup A] +- {H K : AddSubgroup A} +- (h : H = K) (x : H) : +- ((AddEquiv.addSubgroupCongr h x).1 : A) = x.1 := by +- cases h +- rfl +- +-/-- Transporting an idele class along a field equality and the corresponding +-algebra equivalence leaves its rational direct-limit representative fixed. -/ +-private theorem rationalIdeleClassEquivFixed_congr_apply_val +- {A B : IntermediateField ℚ (SeparableClosure ℚ)} +- [FiniteDimensional ℚ A] [FiniteDimensional ℚ B] +- (h : A = B) +- (e : B ≃ₐ[ℚ] A) +- (he : e.trans (IntermediateField.equivOfEq h) = +- (AlgEquiv.refl : B ≃ₐ[ℚ] B)) +- (c : Additive (IdeleClassGroup B)) : +- ((rationalIdeleClassEquivFixed A) +- (MulEquiv.toAdditive (ideleClassCongr e) c)).1 = +- ((rationalIdeleClassEquivFixed B) c).1 := by +- cases h +- have he' : e = AlgEquiv.refl := by +- apply AlgEquiv.ext +- intro x +- have hx := DFunLike.congr_fun he x +- change e x = x at hx +- exact hx +- rw [he'] +- have hc : +- MulEquiv.toAdditive +- (ideleClassCongr (AlgEquiv.refl : A ≃ₐ[ℚ] A)) c = c := by +- cases c with +- | ofMul c => +- exact congrArg Additive.ofMul (ideleClassCongr_refl c) +- rw [hc] +- +-/-- Transporting the target intermediate field of a base-field equivalence +-preserves its rational fixed-part representative. -/ +-private theorem rationalIdeleClassEquivFixed_transport_baseEquiv_val +- {T : Type} [Field T] [NumberField T] +- {A B : IntermediateField ℚ (SeparableClosure ℚ)} +- [FiniteDimensional ℚ A] [FiniteDimensional ℚ B] +- (h : A = B) (e : T ≃ₐ[ℚ] B) +- (c : IdeleClassGroup T) : +- ((rationalIdeleClassEquivFixed A) +- (Additive.ofMul +- (ideleClassCongr (K := T) (M := A) +- (e.trans (IntermediateField.equivOfEq h).symm) c))).1 = +- ((rationalIdeleClassEquivFixed B) +- (Additive.ofMul (ideleClassCongr (K := T) (M := B) e c))).1 := by +- cases h +- have he : +- e.trans (IntermediateField.equivOfEq (rfl : A = A)).symm = e := by +- ext x +- rfl +- rw [he] +- +-/-- Equality of the lower and upper closed subgroups transports the raw +-extension quotient without exposing dependent rewrites to clients. -/ +-private def extensionQuotientMulEquivOfEq +- {G : Type u} [Group G] [TopologicalSpace G] +- {H H' J J' : ClosedSubgroup G} +- (hH : H = H') (hJ : J = J') +- (hJH : J.toSubgroup ≤ H.toSubgroup) +- (hJH' : J'.toSubgroup ≤ H'.toSubgroup) +- [(CyclicCohomology.extensionSubgroup H J hJH).Normal] +- [(CyclicCohomology.extensionSubgroup H' J' hJH').Normal] : +- (H.toSubgroup ⧸ CyclicCohomology.extensionSubgroup H J hJH) ≃* +- (H'.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H' J' hJH') := by +- cases hH +- cases hJ +- exact MulEquiv.refl _ +- +-/-- The quotient transport sends a quotient representative to the same +-ambient group element, rebundled in the equal lower subgroup. -/ +-@[simp] +-private theorem extensionQuotientMulEquivOfEq_mk +- {G : Type u} [Group G] [TopologicalSpace G] +- {H H' J J' : ClosedSubgroup G} +- (hH : H = H') (hJ : J = J') +- (hJH : J.toSubgroup ≤ H.toSubgroup) +- (hJH' : J'.toSubgroup ≤ H'.toSubgroup) +- [(CyclicCohomology.extensionSubgroup H J hJH).Normal] +- [(CyclicCohomology.extensionSubgroup H' J' hJH').Normal] +- (σ : H.toSubgroup) : +- extensionQuotientMulEquivOfEq hH hJ hJH hJH' +- (QuotientGroup.mk σ) = +- QuotientGroup.mk +- ((MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup hH)) σ) := by +- cases hH +- cases hJ +- rfl +- +-/-- Rebundling an element along equality of closed subgroups preserves its +-underlying ambient group element. -/ +-private theorem closedSubgroupCongr_apply_val +- {G : Type u} [Group G] [TopologicalSpace G] +- {H H' : ClosedSubgroup G} +- (hH : H = H') (σ : H.toSubgroup) : +- (((MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup hH)) σ).1 : G) = σ.1 := by +- cases hH +- rfl +- +-/-- Rebase an abelianized extension-quotient equivalence together with its +-finite abstract base. -/ +-private def abelianizedExtensionQuotientAddEquiv_transportBase +- {G : Type u} [Group G] [TopologicalSpace G] +- {A B : FiniteAbstractField G} +- (hAB : A = B) +- (P : FiniteGaloisSubextension A.field) +- {X : Type} [AddGroup X] +- (e : Additive (Abelianization P.extensionQuotient) ≃+ X) : +- Additive +- (Abelianization +- (Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField G => +- FiniteGaloisSubextension Y.field) +- hAB) +- P).extensionQuotient) ≃+ X := by +- cases hAB +- exact e +- +-/-- Rebase an abelianized equivalence along equality of finite Galois +-subextensions over a fixed abstract base. -/ +-private def abelianizedExtensionQuotientAddEquiv_transportExtension +- {G : Type u} [Group G] [TopologicalSpace G] +- {K : ClosedSubgroup G} +- {P Q : FiniteGaloisSubextension K} +- (hPQ : P = Q) +- {X : Type} [AddGroup X] +- (e : Additive (Abelianization P.extensionQuotient) ≃+ X) : +- Additive (Abelianization Q.extensionQuotient) ≃+ X := by +- cases hPQ +- exact e +- +-/-- The explicit quotient equivalence induced by rebasing a finite Galois +-subextension. -/ +-private def extensionQuotientMulEquiv_transportFiniteGalois +- {G : Type u} [Group G] [TopologicalSpace G] +- {A B : FiniteAbstractField G} +- (hAB : A = B) +- (P : FiniteGaloisSubextension A.field) +- {Q : FiniteGaloisSubextension B.field} +- (hPQ : +- Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField G => +- FiniteGaloisSubextension Y.field) +- hAB) +- P = Q) : +- Q.extensionQuotient ≃* P.extensionQuotient := by +- cases hAB +- cases hPQ +- exact MulEquiv.refl _ +- +-/-- Quotient rebasing sends a canonical representative to the same ambient +-group element rebundled in the old base subgroup. -/ +-@[simp] +-private theorem extensionQuotientMulEquiv_transportFiniteGalois_mk +- {G : Type u} [Group G] [TopologicalSpace G] +- {A B : FiniteAbstractField G} +- (hAB : A = B) +- (P : FiniteGaloisSubextension A.field) +- {Q : FiniteGaloisSubextension B.field} +- (hPQ : +- Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField G => +- FiniteGaloisSubextension Y.field) +- hAB) +- P = Q) +- (σ : B.field.toSubgroup) : +- extensionQuotientMulEquiv_transportFiniteGalois hAB P hPQ +- (Q.extensionQuotientMk σ) = +- P.extensionQuotientMk +- ((MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup +- (congrArg FiniteAbstractField.field hAB).symm)) σ) := by +- cases hAB +- cases hPQ +- rfl +- +-/-- Abelianization commutes with simultaneous transport of the abstract base +-and its finite Galois subextension. -/ +-private theorem abelianizedCanonicalEquiv_transportFiniteGalois +- {G : Type u} [Group G] [TopologicalSpace G] +- {A B : FiniteAbstractField G} +- (hAB : A = B) +- (P : FiniteGaloisSubextension A.field) +- {Q : FiniteGaloisSubextension B.field} +- (hPQ : +- Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField G => +- FiniteGaloisSubextension Y.field) +- hAB) +- P = Q) +- {X : Type} [CommGroup X] +- (e : P.extensionQuotient ≃* X) : +- abelianizedExtensionQuotientAddEquiv_transportExtension hPQ +- (abelianizedExtensionQuotientAddEquiv_transportBase +- hAB P +- (MulEquiv.toAdditive +- (e.abelianizationCongr.trans +- (Abelianization.equivOfComm : X ≃* Abelianization X).symm))) = +- MulEquiv.toAdditive +- (((extensionQuotientMulEquiv_transportFiniteGalois +- hAB P hPQ).trans e).abelianizationCongr.trans +- (Abelianization.equivOfComm : X ≃* Abelianization X).symm) := by +- cases hAB +- cases hPQ +- rfl +- +-/-- Package the entire rational finite norm-residue evaluation so that its +-dependent base, extension, quotient and comparison maps move together. -/ +-private def rationalFiniteNormResidueValue +- (K : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (L : FiniteGaloisSubextension K.field) +- {C X : Type} [AddGroup C] [AddGroup X] +- (eIdele : C ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) +- (eGalois : Additive (Abelianization L.extensionQuotient) ≃+ X) +- (c : C) : X := by +- letI : +- Finite +- (K.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- K.field L.field L.below) := +- L.finite +- exact +- eGalois +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- K L +- (finiteNormClass rationalIdeleClassRepresentation +- K.field L.field L.below (eIdele c))) +- +-/-- The packaged norm-residue value is invariant under rebasing the finite +-abstract field together with all dependent data. -/ +-private theorem rationalFiniteNormResidueValue_transportBase +- {A B : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} +- (hAB : A = B) +- (P : FiniteGaloisSubextension A.field) +- {C X : Type} [AddGroup C] [AddGroup X] +- (eIdele : C ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) +- (eGalois : Additive (Abelianization P.extensionQuotient) ≃+ X) +- (c : C) : +- rationalFiniteNormResidueValue A P eIdele eGalois c = +- rationalFiniteNormResidueValue B +- (Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension Y.field) +- hAB) +- P) +- (Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- C ≃+ ambientFixedAddSubgroup +- rationalIdeleClassRepresentation Y.field) +- hAB) +- eIdele) +- (abelianizedExtensionQuotientAddEquiv_transportBase +- hAB P eGalois) +- c := by +- cases hAB +- rfl +- +-/-- The packaged norm-residue value is invariant under equality of the finite +-Galois subextension. -/ +-private theorem rationalFiniteNormResidueValue_transportExtension +- (K : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- {P Q : FiniteGaloisSubextension K.field} +- (hPQ : P = Q) +- {C X : Type} [AddGroup C] [AddGroup X] +- (eIdele : C ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) +- (eGalois : Additive (Abelianization P.extensionQuotient) ≃+ X) +- (c : C) : +- rationalFiniteNormResidueValue K P eIdele eGalois c = +- rationalFiniteNormResidueValue K Q eIdele +- (abelianizedExtensionQuotientAddEquiv_transportExtension +- hPQ eGalois) +- c := by +- cases hPQ +- rfl +- +-/-- Evaluation of the canonical abelianization comparison induced by a +-multiplicative equivalence into a commutative group. -/ +-private theorem abelianizationCongrToComm_apply +- {Q R : Type*} [Group Q] [CommGroup R] +- (e : Q ≃* R) (q : Q) : +- MulEquiv.toAdditive +- (e.abelianizationCongr.trans +- (Abelianization.equivOfComm : R ≃* Abelianization R).symm) +- (Additive.ofMul (Abelianization.of q)) = +- Additive.ofMul (e q) := by +- apply Additive.toMul.injective +- change +- (Abelianization.equivOfComm : R ≃* Abelianization R).symm +- (e.abelianizationCongr (Abelianization.of q)) = e q +- rw [abelianizationCongr_of] +- exact +- (Abelianization.equivOfComm : R ≃* Abelianization R).symm_apply_apply _ +- +-/-- Evaluation of the canonical quotient from the abelianization of a +-commutative group. -/ +-private theorem commutativeAbelianizationEquiv_apply +- {Q R : Type*} [CommGroup Q] [Group R] +- (e : Q ≃* R) (q : Q) : +- MulEquiv.toAdditive +- ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm.trans e) +- (Additive.ofMul (Abelianization.of q)) = +- Additive.ofMul (e q) := by +- apply Additive.toMul.injective +- change +- e ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm +- (Abelianization.of q)) = e q +- exact congrArg e +- ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm_apply_apply q) +- +-section AbstractFixedFieldInclusion +- +-variable +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- +-local instance naturalityAbstractFixedFieldBaseQuotientFinite : +- Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- H.field (le_baseField H.field)) := +- H.finite +- +-local instance naturalityAbstractFixedFieldRelativeQuotientFinite : +- Finite +- (H.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H.field P.field P.below) := +- P.finite +- +-noncomputable local instance +- naturalityAbstractFixedFieldFiniteDimensional : +- FiniteDimensional ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) := +- abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) H.field H.finite +- +-noncomputable local instance +- naturalityAbstractRelativeFixedFieldFiniteDimensional : +- FiniteDimensional +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) := +- abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) +- H.field P.field P.below H.finite P.finite +- +-local instance naturalityAbstractFixedFieldRelativeScalarTower : +- IsScalarTower ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) := +- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) +- +-noncomputable local instance +- naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional : +- FiniteDimensional ℚ +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) := +- FiniteDimensional.trans ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) +- +-noncomputable local instance naturalityAbstractFixedFieldNumberField : +- NumberField +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) := +- NumberField.of_module_finite ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- +-noncomputable local instance +- naturalityAbstractRelativeFixedFieldNumberField : +- NumberField +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) := +- NumberField.of_module_finite ℚ +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) +- +-/-- Use the same direct fixed-field Galois witness as the intrinsic +-norm-residue construction. This prevents the dependent Galois-group type +-from being synthesized through a second `IsAbelianGalois` instance path. -/ +-noncomputable local instance +- naturalityAbstractRelativeFixedFieldIsGalois : +- IsGalois +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) := +- abstractRelativeFixedField_isGalois +- ℚ (SeparableClosure ℚ) +- H.field P.field P.below P.normal +- +-noncomputable local instance +- naturalityAbstractRelativeFixedFieldIsAbelianGalois : +- IsAbelianGalois +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) := +- finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P +- +-/-- The lower subgroup obtained from the canonical inclusion of an abstract +-fixed-field tower is the original lower closed subgroup. -/ +-private theorem +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- numberFieldEmbeddedBaseSubgroup F E j = H.field := by +- dsimp only +- have hi : +- numberFieldEmbeddedLowerEmbedding +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) +- ((abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ) = +- (abstractFixedField +- ℚ (SeparableClosure ℚ) H.field).val := by +- ext x +- rfl +- have hRange : +- (numberFieldEmbeddedLowerEmbedding +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) +- ((abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ)).fieldRange = +- abstractFixedField ℚ (SeparableClosure ℚ) H.field := by +- ext x +- constructor +- · rintro ⟨y, rfl⟩ +- change +- numberFieldEmbeddedLowerEmbedding +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field) +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) +- ((abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ) y ∈ +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- rw [hi] +- exact y.property +- · intro hx +- refine ⟨⟨x, hx⟩, ?_⟩ +- rw [hi] +- rfl +- rw [numberFieldEmbeddedBaseSubgroup, hRange] +- exact +- closedFixingSubgroup_abstractFixedField_eq +- ℚ (SeparableClosure ℚ) H.field +- +-/-- The upper subgroup obtained from the canonical inclusion of an abstract +-fixed-field tower is the original upper closed subgroup. -/ +-private theorem +- numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- numberFieldEmbeddedTopSubgroup F E j = P.field := by +- dsimp only +- rw [numberFieldEmbeddedTopSubgroup] +- have hjRangeSelf : +- ((abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ).fieldRange = +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below).restrictScalars ℚ := by +- ext x +- constructor +- · rintro ⟨y, rfl⟩ +- exact y.property +- · intro hx +- exact ⟨⟨x, hx⟩, rfl⟩ +- have hjRange : +- ((abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ).fieldRange = +- abstractFixedField ℚ (SeparableClosure ℚ) P.field := by +- exact hjRangeSelf.trans +- (IntermediateField.extendScalars_restrictScalars +- (abstractFixedField_le +- ℚ (SeparableClosure ℚ) P.below)) +- rw [hjRange] +- exact +- closedFixingSubgroup_abstractFixedField_eq +- ℚ (SeparableClosure ℚ) P.field +- +-/-- Transport a packaged rational norm-residue value directly from an equal +-abstract base to the finite Galois extension underlying `P`. Keeping the two +-dependent transports in their own declaration prevents their elaboration cost +-from accumulating in the main fixed-field comparison theorem. -/ +-private theorem rationalFiniteNormResidueValue_transportToAbstractExtension +- {A : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} +- (hAH : A = H) +- (L : FiniteGaloisSubextension A.field) +- (hLP : +- Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension Y.field) +- hAH) +- L = +- P.toFiniteGaloisExtension) +- {C X : Type} [AddGroup C] [AddGroup X] +- (eIdele : C ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) +- (eGalois : Additive (Abelianization L.extensionQuotient) ≃+ X) +- (c : C) : +- rationalFiniteNormResidueValue A L eIdele eGalois c = +- rationalFiniteNormResidueValue H P.toFiniteGaloisExtension +- (Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- C ≃+ ambientFixedAddSubgroup +- rationalIdeleClassRepresentation Y.field) +- hAH) +- eIdele) +- (abelianizedExtensionQuotientAddEquiv_transportExtension hLP +- (abelianizedExtensionQuotientAddEquiv_transportBase +- hAH L eGalois)) +- c := by +- calc +- _ = rationalFiniteNormResidueValue H +- (Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension Y.field) +- hAH) +- L) +- (Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- C ≃+ ambientFixedAddSubgroup +- rationalIdeleClassRepresentation Y.field) +- hAH) +- eIdele) +- (abelianizedExtensionQuotientAddEquiv_transportBase hAH L eGalois) +- c := +- rationalFiniteNormResidueValue_transportBase +- (A := A) (B := H) (C := C) (X := X) +- hAH L eIdele eGalois c +- _ = _ := +- rationalFiniteNormResidueValue_transportExtension +- (K := H) +- (P := Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension Y.field) +- hAH) +- L) +- (Q := P.toFiniteGaloisExtension) (C := C) (X := X) +- hLP +- (Eq.mp +- (congrArg +- (fun Y : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- C ≃+ ambientFixedAddSubgroup +- rationalIdeleClassRepresentation Y.field) +- hAH) +- eIdele) +- (abelianizedExtensionQuotientAddEquiv_transportBase hAH L eGalois) +- c +- +-/-- The packaged value at the literal fixed-field realization is the ambient +-fixed-part norm-residue homomorphism evaluated at the same idele class. -/ +-private theorem rationalFiniteNormResidueValue_abstractFixedField_eq_ambient +- (c : IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) : +- rationalFiniteNormResidueValue H P.toFiniteGaloisExtension +- (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) +- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) +- (Additive.ofMul c) = +- ambientFixedGlobalNormResidueAddMonoidHom H P +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- H.field (Additive.ofMul c)) := by +- let eRec := +- rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- H P.toFiniteGaloisExtension +- let eGal := +- abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P +- change +- eGal +- (eRec +- (finiteNormClass rationalIdeleClassRepresentation +- H.field P.field P.below +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- H.field (Additive.ofMul c)))) = +- eGal +- (eRec +- (finiteNormClass rationalIdeleClassRepresentation +- H.field P.field P.below +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- H.field (Additive.ofMul c)))) +- rfl +- +-/-- The packaged norm-residue value for the literal fixed-field realization +-is the intrinsic abstract fixed-field norm-residue value. -/ +-private theorem rationalFiniteNormResidueValue_abstractFixedField_apply +- (c : IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) : +- Additive.toMul +- (rationalFiniteNormResidueValue H P.toFiniteGaloisExtension +- (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) +- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup +- H P) +- (Additive.ofMul c)) = +- abstractFixedFieldGlobalNormResidueMonoidHom H P c := by +- let a := +- rationalAbstractFixedFieldIdeleClassEquivFixed +- H.field (Additive.ofMul c) +- have hAbstract := +- abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply H P a +- calc +- _ = Additive.toMul +- (ambientFixedGlobalNormResidueAddMonoidHom H P +- (rationalAbstractFixedFieldIdeleClassEquivFixed +- H.field (Additive.ofMul c))) := by +- exact congrArg Additive.toMul +- (rationalFiniteNormResidueValue_abstractFixedField_eq_ambient +- (H := H) (P := P) c) +- _ = _ := by +- simpa only [a, AddEquiv.symm_apply_apply, toMul_ofMul] using +- hAbstract.symm +- +-/-- The finite abstract field reconstructed from the literal fixed-field +-inclusion is the original packaged abstract field. Keeping this structure +-equality separate avoids repeatedly rebuilding all of its proof fields. -/ +-private theorem +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- numberFieldEmbeddedFiniteAbstractField F E j = H := by +- dsimp only +- exact FiniteAbstractField.eq_of_field_eq _ _ +- (numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P) +- +-/-- Pointwise specification of the idele-class comparison after transporting +-the explicitly embedded abstract field to the canonical packaged field. The +-transport is kept at the value boundary, so clients never compare the two +-dependent additive equivalences themselves. -/ +-private theorem +- numberFieldEmbeddedIdeleClassEquivAmbientFixed_transport_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (c : Additive +- (IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- Additive (IdeleClassGroup F) ≃+ +- ambientFixedAddSubgroup +- rationalIdeleClassRepresentation X.field) +- hHEmbedded) +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) c = +- rationalAbstractFixedFieldIdeleClassEquivFixed H.field c := by +- dsimp only +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hBase : +- numberFieldEmbeddedBaseSubgroup F E j = H.field := +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P +- have hHEmbedded : +- numberFieldEmbeddedFiniteAbstractField F E j = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- have hFixedBase : +- abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup F E j) = F := +- congrArg +- (abstractFixedField ℚ (SeparableClosure ℚ)) hBase +- let eBase : F ≃ₐ[ℚ] F := +- (numberFieldEmbeddedAbstractBaseFieldEquiv F E j).trans +- (IntermediateField.equivOfEq hFixedBase) +- have heBase : +- eBase = (AlgEquiv.refl : F ≃ₐ[ℚ] F) := by +- apply AlgEquiv.ext +- intro x +- apply Subtype.ext +- change x.1 = x.1 +- rfl +- let hEmbeddedQuotientFinite := +- numberFieldEmbeddedAbsoluteQuotientFinite F E j +- let hEmbeddedFixedFiniteDimensional := +- numberFieldEmbeddedAbstractFixedFieldFiniteDimensional F E j +- apply Subtype.ext +- rw [rationalAmbientFixedAddEquiv_transport_apply_val +- hHEmbedded +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) c] +- dsimp only [numberFieldEmbeddedIdeleClassEquivAmbientFixed] +- simp only [AddEquiv.trans_apply] +- change +- ((rationalIdeleClassEquivFixed +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup F E j))) +- (MulEquiv.toAdditive +- (ideleClassCongr +- (numberFieldEmbeddedAbstractBaseFieldEquiv F E j)) c)).1 = +- ((rationalIdeleClassEquivFixed F) c).1 +- exact rationalIdeleClassEquivFixed_congr_apply_val +- hFixedBase +- (numberFieldEmbeddedAbstractBaseFieldEquiv F E j) +- heBase c +- +-/-- Transporting the finite Galois subextension reconstructed from the literal +-fixed-field inclusion recovers the canonical subextension packaged by `P`. +-This is the sole dependent structure equality used by the later quotient +-comparisons. -/ +-private theorem +- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := +- numberFieldEmbeddedFiniteGaloisSubextension F E j +- let hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension X.field) +- hHEmbedded) +- PEmbedded = +- P.toFiniteGaloisExtension := by +- dsimp only +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := +- numberFieldEmbeddedFiniteGaloisSubextension F E j +- have hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- exact finiteGaloisSubextension_transport_eq_of_field_eq +- hHEmbedded PEmbedded P.toFiniteGaloisExtension +- (numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P) +- +-/-- Opaque endpoint for the extension-quotient comparison supplied by the +-literal embedding. Its domain is already the canonical quotient of `P`, so +-no client has to reconstruct the two subgroup transports. -/ +-private noncomputable def +- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- P.toFiniteGaloisExtension.extensionQuotient ≃* +- Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hBase : +- numberFieldEmbeddedBaseSubgroup F E j = H.field := +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P +- have hTop : +- numberFieldEmbeddedTopSubgroup F E j = P.field := +- numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P +- letI hAlgebra : Algebra F (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra F E j +- let eSep := +- numberFieldEmbeddedSeparableClosureEquiv F E j +- letI hEmbeddedExtensionNormal : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal F E j +- exact +- P.toFiniteGaloisExtension.extensionQuotientMulEquiv.trans +- ((extensionQuotientMulEquivOfEq +- hBase.symm hTop.symm P.below +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).trans +- (ambientEmbeddedExtensionQuotientEquivGaloisGroup +- ℚ F E j eSep)) +- +-/-- Opaque canonical endpoint for the same quotient, obtained directly from +-the abstract fixed-field realization. -/ +-private noncomputable def +- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- P.toFiniteGaloisExtension.extensionQuotient ≃* +- Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by +- exact +- P.toFiniteGaloisExtension.extensionQuotientMulEquiv.trans +- (abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) +- H.field P.field P.below P.normal) +- +-/-- Pointwise opaque endpoint of the embedded quotient equivalence. -/ +-private noncomputable def +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) : +- Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := +- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv H P q +- +-/-- Pointwise opaque endpoint of the canonical quotient equivalence. -/ +-private noncomputable def +- abstractFixedFieldInclusionCanonicalExtensionQuotientValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) : +- Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := +- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv H P q +- +-/-- Fully applied ambient value of the embedded quotient endpoint. -/ +-private noncomputable def +- abstractFixedFieldInclusionEmbeddedExtensionQuotientApplyVal +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := +- (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q x : +- SeparableClosure ℚ) +- +-/-- Fully applied ambient value of the canonical quotient endpoint. -/ +-private noncomputable def +- abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := +- (abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q x : +- SeparableClosure ℚ) +- +-/-- The ambient Galois value attached to a representative of the canonical +-quotient, packaged behind a literal result type. -/ +-private noncomputable def +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) : +- Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hBase : +- numberFieldEmbeddedBaseSubgroup F E j = H.field := +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P +- letI hAlgebra : Algebra F (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra F E j +- let eSep := +- numberFieldEmbeddedSeparableClosureEquiv F E j +- letI hEmbeddedExtensionNormal : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal F E j +- let σEmbedded : +- (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := +- (MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ +- exact +- ambientEmbeddedExtensionQuotientEquivGaloisGroup +- ℚ F E j eSep (QuotientGroup.mk σEmbedded) +- +-/-- Fully applied ambient value of the packaged representative endpoint. -/ +-private noncomputable def +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := +- (abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue H P σ x : +- SeparableClosure ℚ) +- +-/-- Ambient action of the representative after rebundling it in the embedded +-base subgroup. -/ +-private noncomputable def +- abstractFixedFieldInclusionRebasedAutomorphismApplyVal +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hBase : +- numberFieldEmbeddedBaseSubgroup F E j = H.field := +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P +- let σEmbedded : +- (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := +- (MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ +- exact σEmbedded.1.1 (x : SeparableClosure ℚ) +- +-/-- The embedded quotient endpoint sends a canonical representative to the +-packaged ambient value above. -/ +-private theorem +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue_mk +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) : +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P +- (P.toFiniteGaloisExtension.extensionQuotientMk σ) = +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue H P σ := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hBase : +- numberFieldEmbeddedBaseSubgroup F E j = H.field := +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P +- have hTop : +- numberFieldEmbeddedTopSubgroup F E j = P.field := +- numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P +- let hAlgebra : Algebra F (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra F E j +- let eSep := +- numberFieldEmbeddedSeparableClosureEquiv F E j +- let hEmbeddedExtensionNormal : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal F E j +- simp only [ +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue, +- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv, +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue, +- MulEquiv.trans_apply, +- FiniteGaloisSubextension.extensionQuotientMk_apply] +- exact congrArg +- (ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep) +- (extensionQuotientMulEquivOfEq_mk +- hBase.symm hTop.symm P.below +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j) σ) +- +-/-- The packaged ambient endpoint evaluates to the action of the rebundled +-representative. -/ +-private theorem +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal_eq_rebased +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal H P σ x = +- abstractFixedFieldInclusionRebasedAutomorphismApplyVal H P σ x := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hBase : +- numberFieldEmbeddedBaseSubgroup F E j = H.field := +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P +- let hAlgebra : Algebra F (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra F E j +- let eSep := +- numberFieldEmbeddedSeparableClosureEquiv F E j +- let hEmbeddedExtensionNormal : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal F E j +- let σEmbedded : +- (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := +- (MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ +- have hmk := +- ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply +- ℚ F E j eSep σEmbedded x +- change +- (ambientEmbeddedExtensionQuotientEquivGaloisGroup +- ℚ F E j eSep (QuotientGroup.mk σEmbedded) x : +- SeparableClosure ℚ) = +- σEmbedded.1.1 (x : SeparableClosure ℚ) at hmk +- simpa only [ +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal, +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue, +- abstractFixedFieldInclusionRebasedAutomorphismApplyVal] using hmk +- +-/-- Rebundling the representative does not change its action in the ambient +-separable closure. -/ +-private theorem +- abstractFixedFieldInclusionRebasedAutomorphismApplyVal_eq +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : +- abstractFixedFieldInclusionRebasedAutomorphismApplyVal H P σ x = +- σ.1.1 (x : SeparableClosure ℚ) := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hBase : +- numberFieldEmbeddedBaseSubgroup F E j = H.field := +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P +- let σEmbedded : +- (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := +- (MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ +- have hσEmbedded : +- (σEmbedded.1 : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) = σ.1 := +- closedSubgroupCongr_apply_val hBase.symm σ +- change σEmbedded.1.1 (x : SeparableClosure ℚ) = _ +- rw [hσEmbedded] +- +-/-- The packaged ambient representative acts by the original automorphism on +-the underlying separable-closure value. -/ +-private theorem +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal H P σ x = +- σ.1.1 (x : SeparableClosure ℚ) := by +- exact +- (abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal_eq_rebased +- H P σ x).trans +- (abstractFixedFieldInclusionRebasedAutomorphismApplyVal_eq H P σ x) +- +-/-- Evaluation of the embedded quotient endpoint on a canonical quotient +-representative, stated only in the ambient separable closure. -/ +-private theorem +- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv_mk_val +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : +- abstractFixedFieldInclusionEmbeddedExtensionQuotientApplyVal H P +- (P.toFiniteGaloisExtension.extensionQuotientMk σ) x = +- σ.1.1 (x : SeparableClosure ℚ) := by +- calc +- _ = abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal +- H P σ x := by +- exact congrArg +- (fun g => (g x : SeparableClosure ℚ)) +- (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue_mk +- H P σ) +- _ = _ := +- abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue_apply +- H P σ x +- +-/-- Evaluation of the canonical abstract quotient endpoint on a quotient +-representative, again exposed only through its ambient value. -/ +-private theorem +- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv_mk_val +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) +- (x : abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) : +- abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal H P +- (P.toFiniteGaloisExtension.extensionQuotientMk σ) x = +- σ.1.1 (x : SeparableClosure ℚ) := by +- simp only [ +- abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal, +- abstractFixedFieldInclusionCanonicalExtensionQuotientValue, +- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv, +- MulEquiv.trans_apply, +- FiniteGaloisSubextension.extensionQuotientMk_apply] +- exact +- (abstractExtensionQuotientEquivGaloisGroup_mk_apply_val +- ℚ (SeparableClosure ℚ) +- H.field P.field P.below P.normal σ x).symm +- +-/-- The embedded and canonical quotient endpoints agree on each quotient +-class. This pointwise boundary is intentionally weaker than equality of the +-dependent `MulEquiv` structures. -/ +-private theorem +- abstractFixedFieldInclusionExtensionQuotientEquiv_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) : +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q = +- abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q := by +- refine P.toFiniteGaloisExtension.extensionQuotient_inductionOn +- (motive := fun q => +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q = +- abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q) +- q ?_ +- intro σ +- apply AlgEquiv.ext +- intro x +- apply Subtype.ext +- exact +- (abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv_mk_val +- H P σ x).trans +- (abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv_mk_val +- H P σ x).symm +- +-/-- Opaque quotient endpoint obtained by transporting the explicitly embedded +-finite Galois subextension back to the canonical package. -/ +-private noncomputable def +- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- P.toFiniteGaloisExtension.extensionQuotient ≃* +- Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := +- numberFieldEmbeddedFiniteGaloisSubextension F E j +- have hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- have hPEmbedded : +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension X.field) +- hHEmbedded) +- PEmbedded = +- P.toFiniteGaloisExtension := +- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P +- exact +- (extensionQuotientMulEquiv_transportFiniteGalois +- hHEmbedded PEmbedded hPEmbedded).trans +- (numberFieldEmbeddedExtensionQuotientEquivGaloisGroup F E j) +- +-/-- Pointwise opaque endpoint of the transported quotient equivalence. -/ +-private noncomputable def +- abstractFixedFieldInclusionTransportedExtensionQuotientValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) : +- Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := +- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P q +- +-/-- Transporting a canonical representative of the embedded finite Galois +-package preserves its Galois value. -/ +-private theorem +- abstractFixedFieldInclusionTransportedExtensionQuotientValue_mk +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (σ : H.field.toSubgroup) : +- abstractFixedFieldInclusionTransportedExtensionQuotientValue H P +- (P.toFiniteGaloisExtension.extensionQuotientMk σ) = +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P +- (P.toFiniteGaloisExtension.extensionQuotientMk σ) := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hBase : +- numberFieldEmbeddedBaseSubgroup F E j = H.field := +- numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P +- have hTop : +- numberFieldEmbeddedTopSubgroup F E j = P.field := +- numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := +- numberFieldEmbeddedFiniteGaloisSubextension F E j +- have hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- have hPEmbedded : +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension X.field) +- hHEmbedded) +- PEmbedded = +- P.toFiniteGaloisExtension := +- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P +- let hAlgebra : Algebra F (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra F E j +- let eSep := +- numberFieldEmbeddedSeparableClosureEquiv F E j +- let hEmbeddedExtensionNormal : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup F E j) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal F E j +- have hFieldEq : +- (congrArg FiniteAbstractField.field hHEmbedded).symm = hBase.symm := +- Subsingleton.elim _ _ +- simp only [ +- abstractFixedFieldInclusionTransportedExtensionQuotientValue, +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue, +- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv, +- abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv, +- MulEquiv.trans_apply, +- extensionQuotientMulEquiv_transportFiniteGalois_mk, +- FiniteGaloisSubextension.extensionQuotientMk_apply, +- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup] +- rw [hFieldEq] +- change +- ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep +- (QuotientGroup.mk +- ((MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ)) = _ +- exact +- (congrArg +- (ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep) +- (extensionQuotientMulEquivOfEq_mk +- hBase.symm hTop.symm P.below +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j) σ)).symm +- +-/-- Transporting the embedded finite Galois package preserves the value of +-its extension-quotient comparison. -/ +-private theorem +- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv_apply +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) : +- abstractFixedFieldInclusionTransportedExtensionQuotientValue H P q = +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q := by +- refine P.toFiniteGaloisExtension.extensionQuotient_inductionOn +- (motive := fun q => +- abstractFixedFieldInclusionTransportedExtensionQuotientValue H P q = +- abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q) +- q ?_ +- intro σ +- exact abstractFixedFieldInclusionTransportedExtensionQuotientValue_mk +- H P σ +- +-/-- Opaque abelianized equivalence obtained by transporting the explicitly +-embedded finite Galois package to the canonical one. -/ +-private noncomputable def +- abstractFixedFieldInclusionTransportedAbelianizedEquiv +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- Additive +- (Abelianization +- P.toFiniteGaloisExtension.extensionQuotient) ≃+ +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := +- numberFieldEmbeddedFiniteGaloisSubextension F E j +- have hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- have hPEmbedded : +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension X.field) +- hHEmbedded) +- PEmbedded = +- P.toFiniteGaloisExtension := +- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P +- exact +- abelianizedExtensionQuotientAddEquiv_transportExtension hPEmbedded +- (abelianizedExtensionQuotientAddEquiv_transportBase +- hHEmbedded PEmbedded +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- F E j)) +- +-/-- Canonical abelianization comparison built from the already transported +-opaque extension-quotient endpoint. -/ +-private noncomputable def +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- Additive +- (Abelianization +- P.toFiniteGaloisExtension.extensionQuotient) ≃+ +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by +- let Q := +- Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) +- exact +- MulEquiv.toAdditive +- ((MulEquiv.abelianizationCongr +- (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P)).trans +- (Abelianization.equivOfComm : Q ≃* Abelianization Q).symm) +- +-/-- Pointwise opaque value of the transported abelianized equivalence. -/ +-private noncomputable def +- abstractFixedFieldInclusionTransportedAbelianizedValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (z : Additive +- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := +- abstractFixedFieldInclusionTransportedAbelianizedEquiv H P z +- +-/-- Pointwise opaque value of the canonical abelianization comparison built +-from the transported quotient endpoint. -/ +-private noncomputable def +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (z : Additive +- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv H P z +- +-/-- Pointwise opaque value of the intrinsic abstract fixed-field +-abelianization comparison. -/ +-private noncomputable def +- abstractFixedFieldInclusionCanonicalAbelianizedValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (z : Additive +- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := +- abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P z +- +-/-- The transported abelianized endpoint agrees pointwise with the canonical +-abelianization comparison built from the transported quotient endpoint. -/ +-private theorem +- abstractFixedFieldInclusionTransportedAbelianizedValue_eq_canonical +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (z : Additive +- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : +- abstractFixedFieldInclusionTransportedAbelianizedValue H P z = +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue +- H P z := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := +- numberFieldEmbeddedFiniteGaloisSubextension F E j +- have hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- have hPEmbedded : +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension X.field) +- hHEmbedded) +- PEmbedded = +- P.toFiniteGaloisExtension := +- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P +- let qEmbedded : PEmbedded.extensionQuotient ≃* Gal(E / F) := +- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup F E j +- have hCanonical : +- abstractFixedFieldInclusionTransportedAbelianizedEquiv H P = +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv +- H P := by +- simpa only [ +- abstractFixedFieldInclusionTransportedAbelianizedEquiv, +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv, +- abstractFixedFieldInclusionTransportedExtensionQuotientEquiv, +- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup, +- qEmbedded] using +- (abelianizedCanonicalEquiv_transportFiniteGalois +- hHEmbedded PEmbedded hPEmbedded qEmbedded) +- exact DFunLike.congr_fun hCanonical z +- +-/-- On an abelianization representative, the transported canonical endpoint +-is the additive value of the transported quotient endpoint. -/ +-private theorem +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_of +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) : +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue H P +- (Additive.ofMul (Abelianization.of q)) = +- Additive.ofMul +- (abstractFixedFieldInclusionTransportedExtensionQuotientValue +- H P q) := by +- simpa only [ +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue, +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv, +- abstractFixedFieldInclusionTransportedExtensionQuotientValue] using +- (abelianizationCongrToComm_apply +- (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P) q) +- +-/-- On the same representative, the intrinsic fixed-field endpoint is the +-additive value of the canonical quotient endpoint. -/ +-private theorem +- abstractFixedFieldInclusionCanonicalAbelianizedValue_of +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (q : P.toFiniteGaloisExtension.extensionQuotient) : +- abstractFixedFieldInclusionCanonicalAbelianizedValue H P +- (Additive.ofMul (Abelianization.of q)) = +- Additive.ofMul +- (abstractFixedFieldInclusionCanonicalExtensionQuotientValue +- H P q) := by +- let hRawQuotientCommGroup : +- CommGroup P.toFiniteGaloisExtension.extensionQuotient := +- { (inferInstance : +- Group P.toFiniteGaloisExtension.extensionQuotient) with +- mul_comm := P.commutative.is_comm.comm } +- let qAbstractRaw := +- abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv H P +- change +- MulEquiv.toAdditive +- ((Abelianization.equivOfComm : +- P.toFiniteGaloisExtension.extensionQuotient ≃* +- Abelianization +- P.toFiniteGaloisExtension.extensionQuotient).symm.trans +- qAbstractRaw) +- (Additive.ofMul (Abelianization.of q)) = +- Additive.ofMul (qAbstractRaw q) +- exact commutativeAbelianizationEquiv_apply qAbstractRaw q +- +-/-- The canonical abelianization comparison built after transport agrees +-pointwise with the intrinsic abstract fixed-field comparison. -/ +-private theorem +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_eq +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (z : Additive +- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue H P z = +- abstractFixedFieldInclusionCanonicalAbelianizedValue H P z := by +- let q : P.toFiniteGaloisExtension.extensionQuotient := +- Quotient.out z.toMul +- have hz : Additive.ofMul (Abelianization.of q) = z := by +- apply Additive.ext +- exact Quotient.out_eq' z.toMul +- rw [← hz] +- calc +- _ = Additive.ofMul +- (abstractFixedFieldInclusionTransportedExtensionQuotientValue +- H P q) := +- abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_of +- H P q +- _ = Additive.ofMul +- (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue +- H P q) := +- congrArg Additive.ofMul +- (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv_apply +- H P q) +- _ = Additive.ofMul +- (abstractFixedFieldInclusionCanonicalExtensionQuotientValue +- H P q) := +- congrArg Additive.ofMul +- (abstractFixedFieldInclusionExtensionQuotientEquiv_apply H P q) +- _ = _ := +- (abstractFixedFieldInclusionCanonicalAbelianizedValue_of H P q).symm +- +-/-- The transported abelianized equivalence agrees pointwise with the +-intrinsic abstract fixed-field Galois comparison. -/ +-private theorem +- abstractFixedFieldInclusionTransportedAbelianizedValue_eq +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (z : Additive +- (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : +- abstractFixedFieldInclusionTransportedAbelianizedValue H P z = +- abstractFixedFieldInclusionCanonicalAbelianizedValue H P z := +- (abstractFixedFieldInclusionTransportedAbelianizedValue_eq_canonical +- H P z).trans +- (abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_eq +- H P z) +- +-/-- Opaque packaged norm-residue value before transporting the explicitly +-embedded abstract field and finite Galois package. -/ +-private noncomputable def +- abstractFixedFieldInclusionEmbeddedNormResidueValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (c : Additive +- (IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := +- numberFieldEmbeddedFiniteGaloisSubextension F E j +- exact +- rationalFiniteNormResidueValue HEmbedded PEmbedded +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- F E j) +- c +- +-/-- Opaque packaged value after transporting both dependent structures to +-the canonical `H` and `P` endpoints. -/ +-private noncomputable def +- abstractFixedFieldInclusionTransportedNormResidueValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (c : Additive +- (IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- have hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- let eIdeleEmbedded := +- numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j +- let eIdeleOverH : +- Additive (IdeleClassGroup F) ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation H.field := +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- Additive (IdeleClassGroup F) ≃+ +- ambientFixedAddSubgroup +- rationalIdeleClassRepresentation X.field) +- hHEmbedded) +- eIdeleEmbedded +- exact +- rationalFiniteNormResidueValue H P.toFiniteGaloisExtension +- eIdeleOverH +- (abstractFixedFieldInclusionTransportedAbelianizedEquiv H P) +- c +- +-/-- Opaque intrinsic packaged norm-residue value at the canonical endpoints. -/ +-private noncomputable def +- abstractFixedFieldInclusionCanonicalNormResidueValue +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (c : Additive +- (IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : +- Additive +- (Gal( +- (abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below) / +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := +- rationalFiniteNormResidueValue H P.toFiniteGaloisExtension +- (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) +- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) +- c +- +-/-- Simultaneous transport of the embedded abstract field and finite Galois +-package sends the embedded norm-residue value to the transported endpoint. -/ +-private theorem +- abstractFixedFieldInclusionEmbeddedNormResidueValue_eq_transported +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (c : Additive +- (IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : +- abstractFixedFieldInclusionEmbeddedNormResidueValue H P c = +- abstractFixedFieldInclusionTransportedNormResidueValue H P c := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- let PEmbedded : FiniteGaloisSubextension HEmbedded.field := +- numberFieldEmbeddedFiniteGaloisSubextension F E j +- have hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- have hPEmbedded : +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- FiniteGaloisSubextension X.field) +- hHEmbedded) +- PEmbedded = +- P.toFiniteGaloisExtension := +- numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P +- let eIdeleEmbedded := +- numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j +- let eGaloisEmbedded := +- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup F E j +- simpa only [ +- abstractFixedFieldInclusionEmbeddedNormResidueValue, +- abstractFixedFieldInclusionTransportedNormResidueValue, +- abstractFixedFieldInclusionTransportedAbelianizedEquiv, +- eIdeleEmbedded, +- eGaloisEmbedded] using +- (rationalFiniteNormResidueValue_transportToAbstractExtension +- (H := H) (P := P) +- (A := HEmbedded) +- (C := Additive (IdeleClassGroup F)) +- (X := Additive Gal(E / F)) +- hHEmbedded PEmbedded hPEmbedded +- eIdeleEmbedded eGaloisEmbedded c) +- +-/-- A packaged finite norm-residue value depends only on the value of its +-idele comparison at the chosen input and the value of its Galois comparison +-at the resulting norm class. -/ +-private theorem rationalFiniteNormResidueValue_congr_apply +- (K : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (L : FiniteGaloisSubextension K.field) +- {C X : Type} [AddGroup C] [AddGroup X] +- (eIdele eIdele' : C ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) +- (eGalois eGalois' : +- Additive (Abelianization L.extensionQuotient) ≃+ X) +- (c : C) +- (heIdele : eIdele c = eIdele' c) +- (heGalois : ∀ z, eGalois z = eGalois' z) : +- rationalFiniteNormResidueValue K L eIdele eGalois c = +- rationalFiniteNormResidueValue K L eIdele' eGalois' c := by +- unfold rationalFiniteNormResidueValue +- rw [heIdele] +- exact heGalois _ +- +-/-- The transported packaged value is the intrinsic canonical packaged value; +-only the idele input and the eventual abelianized value are compared. -/ +-private theorem +- abstractFixedFieldInclusionTransportedNormResidueValue_eq_canonical +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (c : Additive +- (IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : +- abstractFixedFieldInclusionTransportedNormResidueValue H P c = +- abstractFixedFieldInclusionCanonicalNormResidueValue H P c := by +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- let HEmbedded := +- numberFieldEmbeddedFiniteAbstractField F E j +- have hHEmbedded : HEmbedded = H := +- numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P +- let eIdeleEmbedded := +- numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j +- let eIdeleOverH : +- Additive (IdeleClassGroup F) ≃+ +- ambientFixedAddSubgroup rationalIdeleClassRepresentation H.field := +- Eq.mp +- (congrArg +- (fun X : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => +- Additive (IdeleClassGroup F) ≃+ +- ambientFixedAddSubgroup +- rationalIdeleClassRepresentation X.field) +- hHEmbedded) +- eIdeleEmbedded +- simpa only [ +- abstractFixedFieldInclusionTransportedNormResidueValue, +- abstractFixedFieldInclusionCanonicalNormResidueValue, +- eIdeleEmbedded, +- eIdeleOverH] using +- (rationalFiniteNormResidueValue_congr_apply +- H P.toFiniteGaloisExtension +- eIdeleOverH +- (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) +- (abstractFixedFieldInclusionTransportedAbelianizedEquiv H P) +- (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) +- c +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed_transport_apply H P c) +- (fun z => abstractFixedFieldInclusionTransportedAbelianizedValue_eq +- H P z)) +- +-/-- The explicitly embedded and intrinsic packaged norm-residue values agree. -/ +-private theorem +- abstractFixedFieldInclusionEmbeddedNormResidueValue_eq +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) +- (c : Additive +- (IdeleClassGroup +- (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : +- abstractFixedFieldInclusionEmbeddedNormResidueValue H P c = +- abstractFixedFieldInclusionCanonicalNormResidueValue H P c := +- (abstractFixedFieldInclusionEmbeddedNormResidueValue_eq_transported +- H P c).trans +- (abstractFixedFieldInclusionTransportedNormResidueValue_eq_canonical +- H P c) +- +-/-- For the literal fixed fields attached to an abstract finite abelian +-extension, the norm-residue map obtained from their canonical inclusion in +-the rational separable closure is the intrinsic fixed-field norm-residue +-map. -/ +-theorem +- globalNormResidueMonoidHomOfEmbedding_abstractFixedFieldInclusion +- (H : FiniteAbstractField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- (P : FiniteAbelianSubextension H.field) : +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H.field +- let E := +- abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- globalNormResidueMonoidHomOfEmbedding F E j = +- abstractFixedFieldGlobalNormResidueMonoidHom H P := by +- dsimp only +- apply MonoidHom.ext +- intro c +- rw [globalNormResidueMonoidHomOfEmbedding_apply] +- change +- Additive.toMul +- (abstractFixedFieldInclusionEmbeddedNormResidueValue +- H P (Additive.ofMul c)) = +- abstractFixedFieldGlobalNormResidueMonoidHom H P c +- calc +- _ = Additive.toMul +- (abstractFixedFieldInclusionCanonicalNormResidueValue +- H P (Additive.ofMul c)) := +- congrArg Additive.toMul +- (abstractFixedFieldInclusionEmbeddedNormResidueValue_eq +- H P (Additive.ofMul c)) +- _ = _ := by +- simpa only [abstractFixedFieldInclusionCanonicalNormResidueValue] using +- (rationalFiniteNormResidueValue_abstractFixedField_apply +- (H := H) (P := P) c) +- +-end AbstractFixedFieldInclusion +- +-section EmbeddedNumberFieldRestriction +- +-variable +- (K K' L L' : Type) +- [Field K] [NumberField K] +- [Field K'] [NumberField K'] +- [Field L] [NumberField L] +- [Field L'] [NumberField L'] +- [Algebra K K'] [Algebra K L] [Algebra K L'] +- [Algebra K' L'] [Algebra L L'] +- [IsScalarTower K K' L'] [IsScalarTower K L L'] +- +- +-/-- Rebracketing the compatible tower does not change its embedded lower +-fixing subgroup. -/ +-private theorem numberFieldEmbeddedBaseSubgroup_baseChange_eq +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- numberFieldEmbeddedBaseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j) = +- numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')) := by +- have hi : +- numberFieldEmbeddedLowerEmbedding K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j) = +- numberFieldEmbeddedLowerEmbedding K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')) := by +- ext x +- simp only [numberFieldEmbeddedLowerEmbedding, AlgHom.comp_apply, +- IsScalarTower.coe_toAlgHom'] +- rw [← IsScalarTower.algebraMap_apply K K' L', +- ← IsScalarTower.algebraMap_apply K L L'] +- simp only [numberFieldEmbeddedBaseSubgroup, hi] +- +-omit [Field K] [NumberField K] +- [Algebra K K'] [Algebra K L'] [IsScalarTower K K' L'] in +-/-- The top subgroup of the rebracketed base-change tower is the embedded +-fixing subgroup of the intermediate field. -/ +-private theorem numberFieldEmbeddedTopSubgroup_baseChange_eq +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- numberFieldEmbeddedTopSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j) = +- numberFieldEmbeddedBaseSubgroup K' L' j := by +- rfl +- +-/-- Reidentify the two presentations of the embedded lower fixing subgroup +-without transporting dependent subgroup data through an equality. -/ +-private noncomputable def numberFieldEmbeddedBaseChangeBaseEquiv +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- (numberFieldEmbeddedBaseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ≃* +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup := +- MulEquiv.subgroupCongr +- (congrArg ClosedSubgroup.toSubgroup +- (numberFieldEmbeddedBaseSubgroup_baseChange_eq K K' L L' j)) +- +-/-- Under the identity equivalence of the two lower fixing subgroups, the +-relative subgroup for the base change is exactly the target presentation. -/ +-private theorem numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)) +- (numberFieldEmbeddedTopSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j))).map +- (numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j).toMonoidHom = +- CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseSubgroup K' L' j) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) := by +- let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j +- have hTop : +- (numberFieldEmbeddedTopSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup = +- (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup := +- congrArg ClosedSubgroup.toSubgroup +- (numberFieldEmbeddedTopSubgroup_baseChange_eq +- (K := K) (K' := K') (L' := L') j) +- ext x +- constructor +- · rintro ⟨y, hy, rfl⟩ +- change +- ((e y : +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup) : +- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) ∈ +- (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup +- dsimp only [e, numberFieldEmbeddedBaseChangeBaseEquiv] +- rw [MulEquiv.subgroupCongr_apply, ← hTop] +- exact hy +- · intro hx +- refine ⟨e.symm x, ?_, e.apply_symm_apply x⟩ +- change +- (((e.symm x : +- (numberFieldEmbeddedBaseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup) : +- SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) ∈ +- (numberFieldEmbeddedTopSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup) +- dsimp only [e, numberFieldEmbeddedBaseChangeBaseEquiv] +- rw [MulEquiv.subgroupCongr_symm_apply, hTop] +- exact hx +- +-/-- Normality of the relative subgroup between the two embedded base fields +-in a finite Galois base change. -/ +-private theorem numberFieldEmbeddedBaseChangeExtensionSubgroup_normal +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseSubgroup K' L' j) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)).Normal := by +- let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j +- have hNormal := +- (numberFieldEmbeddedExtensionSubgroup_normal K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)).map +- e.toMonoidHom e.surjective +- rw [numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq +- K K' L L' j] at hNormal +- exact hNormal +- +-noncomputable local instance +- numberFieldEmbeddedBaseChangeExtensionSubgroupNormal +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- (CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseSubgroup K' L' j) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)).Normal := +- numberFieldEmbeddedBaseChangeExtensionSubgroup_normal K K' L L' j +- +-/-- Finiteness of the relative quotient between the two embedded base fields +-in a finite Galois base change. -/ +-private theorem numberFieldEmbeddedBaseChangeExtensionQuotient_finite +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- Finite +- ((numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseSubgroup K' L' j) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := by +- let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j +- let N := +- CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)) +- (numberFieldEmbeddedTopSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)) +- (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)) +- let M := +- CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseSubgroup K' L' j) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) +- let hNNormal : N.Normal := +- numberFieldEmbeddedExtensionSubgroup_normal K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j) +- let hMNormal : M.Normal := +- numberFieldEmbeddedBaseChangeExtensionSubgroup_normal K K' L L' j +- let hNFinite : +- Finite +- ((numberFieldEmbeddedBaseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ⧸ N) := +- numberFieldEmbeddedExtensionQuotient_finite K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j) +- have hmap : N.map e.toMonoidHom = M := +- numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq K K' L L' j +- have hle : N ≤ M.comap e.toMonoidHom := by +- rw [← hmap] +- exact Subgroup.le_comap_map e.toMonoidHom N +- let f : +- ((numberFieldEmbeddedBaseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ⧸ N) →* +- ((numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ M) := +- QuotientGroup.map N M e.toMonoidHom hle +- have hmk : Function.Surjective +- (QuotientGroup.mk ∘ e : +- (numberFieldEmbeddedBaseSubgroup K K' +- (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup → +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ M) := +- QuotientGroup.mk_surjective.comp e.surjective +- have hsurj : Function.Surjective f := +- QuotientGroup.map_surjective_of_surjective +- (N := N) M e.toMonoidHom hmk hle +- exact Finite.of_surjective f hsurj +- +-noncomputable local instance +- numberFieldEmbeddedBaseChangeExtensionQuotientFinite +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- Finite +- ((numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseSubgroup K' L' j) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := +- numberFieldEmbeddedBaseChangeExtensionQuotient_finite K K' L L' j +- +-/-- Reuse the canonical absolute fixed-field witness for the lower embedded +-tower. The base-change relative witness below needs this exact instance path +-when forming the absolute finite-dimensional tower. -/ +-noncomputable local instance +- numberFieldEmbeddedBaseChangeBaseFixedFieldFiniteDimensional +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteDimensional ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) := +- numberFieldEmbeddedAbstractFixedFieldFiniteDimensional K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')) +- +-noncomputable local instance +- numberFieldEmbeddedBaseChangeRelativeFixedFieldFiniteDimensional +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteDimensional +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := +- abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseSubgroup K' L' j) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) +- (numberFieldEmbeddedAbsoluteQuotientFinite K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseChangeExtensionQuotientFinite K K' L L' j) +- +-local instance +- numberFieldEmbeddedBaseChangeRelativeFixedFieldScalarTower +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- IsScalarTower ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := +- IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) +- +-noncomputable local instance +- numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- FiniteDimensional ℚ +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := +- FiniteDimensional.trans ℚ +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) +- +-noncomputable local instance +- numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- NumberField +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := +- NumberField.of_module_finite ℚ +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) +- +-noncomputable local instance +- numberFieldEmbeddedBaseChangeRelativeFixedFieldIsGalois +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- IsGalois +- (abstractFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')))) +- (abstractRelativeFixedField ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := +- abstractRelativeFixedField_isGalois +- ℚ (SeparableClosure ℚ) +- (numberFieldEmbeddedBaseSubgroup K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L'))) +- (numberFieldEmbeddedBaseSubgroup K' L' j) +- (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) +- (numberFieldEmbeddedBaseChangeExtensionSubgroupNormal K K' L L' j) +- +-/-- In one common rational-separable-closure realization, the canonical +-quotient-to-Galois comparisons intertwine abstract restriction with +-ordinary restriction of the actual number-field automorphisms. -/ +-theorem +- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup_restriction +- [FiniteDimensional K L] [IsAbelianGalois K L] +- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) +- (z : +- Abelianization +- (numberFieldEmbeddedFiniteGaloisSubextension +- K' L' j).extensionQuotient) : +- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ L L') +- let H := +- numberFieldEmbeddedBaseSubgroup K L jLower +- let H' := +- numberFieldEmbeddedBaseSubgroup K' L' j +- let J := +- numberFieldEmbeddedTopSubgroup K L jLower +- let J' := +- numberFieldEmbeddedTopSubgroup K' L' j +- let hH'H := +- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j +- let hJ'J := +- numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j +- let hJH := +- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L jLower +- let hJ'H' := +- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K' L' j +- letI _ : +- (CyclicCohomology.extensionSubgroup H J hJH).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal K L jLower +- letI _ : +- (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := +- numberFieldEmbeddedExtensionSubgroup_normal K' L' j +- ((AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K)) +- (Additive.toMul +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K' L' j (Additive.ofMul z))) = +- Additive.toMul +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L jLower +- (MonoidHom.toAdditive +- (normResidueNaturalityAbelianizedRestriction +- H H' J J' +- hJH hJ'H' +- hH'H hJ'J) +- (Additive.ofMul z))) := by +- dsimp only +- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ L L') +- let H := +- numberFieldEmbeddedBaseSubgroup K L jLower +- let H' := +- numberFieldEmbeddedBaseSubgroup K' L' j +- let J := +- numberFieldEmbeddedTopSubgroup K L jLower +- let J' := +- numberFieldEmbeddedTopSubgroup K' L' j +- let hH'H := +- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j +- let hJ'J := +- numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j +- let hJH := +- numberFieldEmbeddedTopSubgroup_le_baseSubgroup +- K L jLower +- let hJ'H' := +- numberFieldEmbeddedTopSubgroup_le_baseSubgroup +- K' L' j +- let hLowerNormal : +- (CyclicCohomology.extensionSubgroup H J hJH).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal K L jLower +- let hUpperNormal : +- (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := +- numberFieldEmbeddedExtensionSubgroup_normal K' L' j +- let qLower := +- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup +- K L jLower +- let qUpper := +- numberFieldEmbeddedExtensionQuotientEquivGaloisGroup +- K' L' j +- let qLowerRaw : +- (H.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H J hJH) ≃* +- Gal(L / K) := by +- exact +- { qLower.toEquiv with +- map_mul' := fun x y => qLower.map_mul x y } +- let qUpperRaw : +- (H'.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H' J' hJ'H') ≃* +- Gal(L' / K') := by +- exact +- { qUpper.toEquiv with +- map_mul' := fun x y => qUpper.map_mul x y } +- let restrictActual : +- Gal(L' / K') →* Gal(L / K) := +- (AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K) +- obtain ⟨q, rfl⟩ := +- QuotientGroup.mk_surjective z +- obtain ⟨σ, rfl⟩ := +- (numberFieldEmbeddedFiniteGaloisSubextension +- K' L' j).extensionQuotientMk_surjective q +- change +- restrictActual +- ((Abelianization.equivOfComm (H := Gal(L' / K'))).symm +- (qUpperRaw.abelianizationCongr +- (Abelianization.of (QuotientGroup.mk σ)))) = +- (Abelianization.equivOfComm (H := Gal(L / K))).symm +- (qLowerRaw.abelianizationCongr +- (normResidueNaturalityAbelianizedRestriction +- H H' J J' hJH hJ'H' hH'H hJ'J +- (Abelianization.of (QuotientGroup.mk σ)))) +- rw [normResidueNaturalityAbelianizedRestriction_of_mk, +- abelianizationCongr_of, abelianizationCongr_of] +- change +- restrictActual (qUpperRaw (QuotientGroup.mk σ)) = +- qLowerRaw +- (QuotientGroup.mk (Subgroup.inclusion hH'H σ)) +- apply AlgEquiv.ext +- intro x +- apply jLower.injective +- let hUpperAlgebra : Algebra K' (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra K' L' j +- let eUpper := +- numberFieldEmbeddedSeparableClosureEquiv K' L' j +- let hLowerAlgebra : Algebra K (SeparableClosure ℚ) := +- numberFieldEmbeddedSeparableClosureAlgebra K L jLower +- let eLower := +- numberFieldEmbeddedSeparableClosureEquiv K L jLower +- calc +- jLower +- (restrictActual +- (qUpperRaw (QuotientGroup.mk σ)) x) = +- j +- ((qUpperRaw (QuotientGroup.mk σ)) +- (algebraMap L L' x)) := by +- exact congrArg j +- (AlgEquiv.restrictNormal_commutes +- ((AlgEquiv.restrictScalarsHom K) +- (qUpperRaw (QuotientGroup.mk σ))) +- L x) +- _ = σ.1.1 +- (j (algebraMap L L' x)) := by +- exact +- ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply +- ℚ K' L' j eUpper σ (algebraMap L L' x) +- _ = (Subgroup.inclusion hH'H σ).1.1 +- (jLower x) := rfl +- _ = jLower +- (qLowerRaw +- (QuotientGroup.mk +- (Subgroup.inclusion hH'H σ)) x) := by +- exact +- (ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply +- ℚ K L jLower eLower +- (Subgroup.inclusion hH'H σ) x).symm +- +-/-- In a compatible common embedding, the fixed-part relative norm +-between two (Galois-related) base fields is the genuine ordinary +-idele-class norm. -/ +-theorem numberFieldEmbeddedIdeleClassEquivAmbientFixed_relativeNorm +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) +- (c : IdeleClassGroup K') : +- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ L L') +- let H := +- numberFieldEmbeddedBaseSubgroup K L jLower +- let H' := +- numberFieldEmbeddedBaseSubgroup K' L' j +- let hH'H := +- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j +- letI _ : Finite +- (H.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H H' hH'H) := +- numberFieldEmbeddedBaseChangeExtensionQuotientFinite +- K K' L L' j +- relativeNorm rationalIdeleClassRepresentation H H' hH'H +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K' L' j (Additive.ofMul c)) = +- numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K L jLower +- (Additive.ofMul (_root_.ideleClassNorm K K' c)) := by +- intro jLower H H' +- let hH'H := +- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j +- let hnormal := +- numberFieldEmbeddedBaseChangeExtensionSubgroupNormal K K' L L' j +- let F := +- abstractFixedField ℚ (SeparableClosure ℚ) H +- let E := +- abstractRelativeFixedField ℚ (SeparableClosure ℚ) hH'H +- let _ : +- (CyclicCohomology.extensionSubgroup H H' hH'H).Normal := +- hnormal +- let _ : +- Finite +- (H.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H H' hH'H) := +- numberFieldEmbeddedBaseChangeExtensionQuotientFinite +- K K' L L' j +- let _ : +- Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- H (le_baseField H)) := +- numberFieldEmbeddedAbsoluteQuotientFinite K L jLower +- let _ : NumberField F := +- numberFieldEmbeddedAbstractFixedFieldNumberField K L jLower +- let _ : NumberField E := +- numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField +- K K' L L' j +- let _ : FiniteDimensional ℚ (E.restrictScalars ℚ) := by +- change FiniteDimensional ℚ E +- exact +- numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional +- K K' L L' j +- let _ : NumberField +- (abstractFixedField ℚ (SeparableClosure ℚ) H') := +- numberFieldEmbeddedAbstractFixedFieldNumberField K' L' j +- have hE : +- E.restrictScalars ℚ = +- abstractFixedField ℚ (SeparableClosure ℚ) H' := +- IntermediateField.extendScalars_restrictScalars +- (abstractFixedField_le +- ℚ (SeparableClosure ℚ) hH'H) +- let eRel : +- E ≃ₐ[ℚ] +- abstractFixedField ℚ (SeparableClosure ℚ) H' := +- IntermediateField.equivOfEq hE +- let eK : +- K ≃ₐ[ℚ] F := +- numberFieldEmbeddedAbstractBaseFieldEquiv K L jLower +- let eK'Base : +- K' ≃ₐ[ℚ] +- abstractFixedField ℚ (SeparableClosure ℚ) H' := +- numberFieldEmbeddedAbstractBaseFieldEquiv K' L' j +- let eK' : K' ≃ₐ[ℚ] E := +- eK'Base.trans eRel.symm +- have hcompat (x : K) : +- eK' (algebraMap K K' x) = +- algebraMap F E (eK x) := by +- apply eRel.injective +- apply Subtype.ext +- change +- j (algebraMap K' L' (algebraMap K K' x)) = +- j (algebraMap L L' (algebraMap K L x)) +- rw [← IsScalarTower.algebraMap_apply K K' L', +- ← IsScalarTower.algebraMap_apply K L L'] +- have hupper : +- rationalAbstractRelativeFixedFieldIdeleClassEquivFixed +- H H' hH'H +- (Additive.ofMul (ideleClassCongr eK' c)) = +- numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K' L' j (Additive.ofMul c) := by +- apply Subtype.ext +- change +- ((rationalIdeleClassEquivFixed (E.restrictScalars ℚ)) +- (Additive.ofMul (ideleClassCongr eK' c))).1 = +- ((rationalIdeleClassEquivFixed +- (abstractFixedField ℚ (SeparableClosure ℚ) H')) +- (Additive.ofMul (ideleClassCongr eK'Base c))).1 +- exact rationalIdeleClassEquivFixed_transport_baseEquiv_val +- (T := K') (A := E.restrictScalars ℚ) +- (B := abstractFixedField ℚ (SeparableClosure ℚ) H') hE eK'Base c +- have hrelative := +- rationalAbstractRelativeFixedFieldIdeleClassEquivFixed_relativeNorm +- H H' hH'H hnormal +- (Additive.ofMul (ideleClassCongr eK' c)) +- change +- relativeNorm rationalIdeleClassRepresentation H H' hH'H +- (rationalAbstractRelativeFixedFieldIdeleClassEquivFixed +- H H' hH'H +- (Additive.ofMul (ideleClassCongr eK' c))) = +- rationalAbstractFixedFieldIdeleClassEquivFixed H +- (Additive.ofMul +- (_root_.ideleClassNorm F E +- (ideleClassCongr eK' c))) +- at hrelative +- calc +- relativeNorm rationalIdeleClassRepresentation H H' hH'H +- (numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K' L' j (Additive.ofMul c)) = +- relativeNorm rationalIdeleClassRepresentation H H' hH'H +- (rationalAbstractRelativeFixedFieldIdeleClassEquivFixed +- H H' hH'H (Additive.ofMul (ideleClassCongr eK' c))) := +- congrArg (relativeNorm rationalIdeleClassRepresentation H H' hH'H) +- hupper.symm +- _ = rationalAbstractFixedFieldIdeleClassEquivFixed H +- (Additive.ofMul +- (_root_.ideleClassNorm F E (ideleClassCongr eK' c))) := hrelative +- _ = numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K L jLower (Additive.ofMul (_root_.ideleClassNorm K K' c)) := by +- change +- rationalAbstractFixedFieldIdeleClassEquivFixed H +- (Additive.ofMul +- (_root_.ideleClassNorm F E (ideleClassCongr eK' c))) = +- rationalAbstractFixedFieldIdeleClassEquivFixed H +- (Additive.ofMul +- (ideleClassCongr eK (_root_.ideleClassNorm K K' c))) +- apply congrArg (rationalAbstractFixedFieldIdeleClassEquivFixed H) +- apply congrArg Additive.ofMul +- exact +- (ideleClassCongr_ideleClassNorm +- (K := K) (K' := F) (L := K') (L' := E) eK eK' hcompat c).symm +- +-/-- For one common compatible embedding of a Galois base-change +-diamond, the genuine global norm-residue maps commute with ordinary +-idele-class norm and actual restriction of automorphisms. -/ +-theorem globalNormResidueMonoidHomOfEmbedding_norm_restriction +- [FiniteDimensional K L] [IsAbelianGalois K L] +- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) : +- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ L L') +- ((AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K)).comp +- (globalNormResidueMonoidHomOfEmbedding K' L' j) = +- (globalNormResidueMonoidHomOfEmbedding K L jLower).comp +- (_root_.ideleClassNorm K K') := by +- dsimp only +- let jLower : L →ₐ[ℚ] SeparableClosure ℚ := +- j.comp (IsScalarTower.toAlgHom ℚ L L') +- let H := +- numberFieldEmbeddedBaseSubgroup K L jLower +- let H' := +- numberFieldEmbeddedBaseSubgroup K' L' j +- let J := +- numberFieldEmbeddedTopSubgroup K L jLower +- let J' := +- numberFieldEmbeddedTopSubgroup K' L' j +- let hJH := +- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L jLower +- let hJ'H' := +- numberFieldEmbeddedTopSubgroup_le_baseSubgroup K' L' j +- let hH'H := +- numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j +- let hJ'J := +- numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j +- let _ : +- (CyclicCohomology.extensionSubgroup H J hJH).Normal := +- numberFieldEmbeddedExtensionSubgroup_normal K L jLower +- let _ : +- Finite +- (H.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H J hJH) := +- numberFieldEmbeddedExtensionQuotient_finite K L jLower +- let _ : +- (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := +- numberFieldEmbeddedExtensionSubgroup_normal K' L' j +- let _ : +- Finite +- (H'.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H' J' hJ'H') := +- numberFieldEmbeddedExtensionQuotient_finite K' L' j +- let hHH'finite := +- numberFieldEmbeddedBaseChangeExtensionQuotientFinite K K' L L' j +- let T : +- FiniteAbstractFieldExtension +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := +- { field := numberFieldEmbeddedFiniteAbstractField K' L' j +- base := numberFieldEmbeddedFiniteAbstractField K L jLower +- below := hH'H +- finiteQuotient := hHH'finite } +- let hTBaseNormal : +- (CyclicCohomology.extensionSubgroup +- T.base.field J hJH).Normal := by +- change +- (CyclicCohomology.extensionSubgroup H J hJH).Normal +- exact numberFieldEmbeddedExtensionSubgroup_normal K L jLower +- let hTBaseFinite : +- Finite +- (T.base.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- T.base.field J hJH) := by +- change +- Finite +- (H.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H J hJH) +- exact numberFieldEmbeddedExtensionQuotient_finite K L jLower +- let hTFieldNormal : +- (CyclicCohomology.extensionSubgroup +- T.field.field J' hJ'H').Normal := by +- change +- (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal +- exact numberFieldEmbeddedExtensionSubgroup_normal K' L' j +- let hTFieldFinite : +- Finite +- (T.field.field.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup +- T.field.field J' hJ'H') := by +- change +- Finite +- (H'.toSubgroup ⧸ +- CyclicCohomology.extensionSubgroup H' J' hJ'H') +- exact numberFieldEmbeddedExtensionQuotient_finite K' L' j +- let restrictActual : +- Gal(L' / K') →* Gal(L / K) := +- (AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K) +- apply MonoidHom.ext +- intro c +- let a := +- numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K' L' j (Additive.ofMul c) +- have hnat := +- DegreeData.normResidueNaturality_norm_restriction +- (D := rationalCyclotomicDegreeData) +- (A := rationalIdeleClassRepresentation) +- (v := rationalCyclotomicIdeleClassValuationData) +- (hcf := rationalIdeleClassRepresentation_satisfiesClassFieldAxiom) +- (T := T) (L := J) (L' := J') +- (hLnormal := hTBaseNormal) +- (hL'normal := hTFieldNormal) +- (hLKfinite := hTBaseFinite) +- (hL'K'finite := hTFieldFinite) +- hJH hJ'H' hJ'J +- have hnatc := +- DFunLike.congr_fun hnat +- (finiteNormClass rationalIdeleClassRepresentation +- H' J' hJ'H' a) +- change _ = +- rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- T.base +- { field := J +- below := hJH +- normal := hTBaseNormal +- finite := hTBaseFinite } +- (finiteReciprocityNaturalityNormMap +- rationalIdeleClassRepresentation +- T.base.field T.field.field J J' +- hJH hJ'H' T.below hJ'J +- (finiteNormClass rationalIdeleClassRepresentation +- T.field.field J' hJ'H' a)) at hnatc +- rw [finiteReciprocityNaturalityNormMap_finiteNormClass] +- at hnatc +- have hnorm : +- relativeNorm rationalIdeleClassRepresentation +- H H' hH'H a = +- numberFieldEmbeddedIdeleClassEquivAmbientFixed +- K L jLower +- (Additive.ofMul (_root_.ideleClassNorm K K' c)) := +- numberFieldEmbeddedIdeleClassEquivAmbientFixed_relativeNorm +- K K' L L' j c +- calc +- restrictActual +- (globalNormResidueMonoidHomOfEmbedding K' L' j c) = +- restrictActual +- (Additive.toMul +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K' L' j +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldEmbeddedFiniteAbstractField K' L' j) +- (numberFieldEmbeddedFiniteGaloisSubextension K' L' j) +- (finiteNormClass rationalIdeleClassRepresentation +- H' J' hJ'H' a)))) := by +- rw [globalNormResidueMonoidHomOfEmbedding_apply] +- _ = +- Additive.toMul +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L jLower +- (MonoidHom.toAdditive +- (normResidueNaturalityAbelianizedRestriction +- H H' J J' hJH hJ'H' hH'H hJ'J) +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldEmbeddedFiniteAbstractField K' L' j) +- (numberFieldEmbeddedFiniteGaloisSubextension K' L' j) +- (finiteNormClass rationalIdeleClassRepresentation +- H' J' hJ'H' a)))) := by +- exact +- numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup_restriction +- K K' L L' j _ +- _ = +- Additive.toMul +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L jLower +- (rationalCyclotomicDegreeData.normResidueSymbol +- rationalIdeleClassRepresentation +- rationalCyclotomicIdeleClassValuationData +- rationalIdeleClassRepresentation_satisfiesClassFieldAxiom +- (numberFieldEmbeddedFiniteAbstractField K L jLower) +- (numberFieldEmbeddedFiniteGaloisSubextension K L jLower) +- (finiteNormClass rationalIdeleClassRepresentation +- H J hJH +- (relativeNorm rationalIdeleClassRepresentation +- H H' hH'H a)))) := by +- exact congrArg +- (fun z => +- Additive.toMul +- (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup +- K L jLower z)) +- hnatc +- _ = +- globalNormResidueMonoidHomOfEmbedding K L jLower +- (_root_.ideleClassNorm K K' c) := by +- rw [hnorm, +- ← globalNormResidueMonoidHomOfEmbedding_apply] + +-end EmbeddedNumberFieldRestriction ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal + + variable + {G : IntegralRepGroupType} [Group G] [TopologicalSpace G] +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityAbelianValues.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityAbelianValues.lean +new file mode 100644 +index 0000000..b6abdd5 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityAbelianValues.lean +@@ -0,0 +1,429 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityExtensionValues ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++ ++section AbstractFixedFieldInclusion ++ ++variable ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal ++ naturalityAbstractFixedFieldBaseQuotientFinite ++ naturalityAbstractFixedFieldRelativeQuotientFinite ++ naturalityAbstractFixedFieldFiniteDimensional ++ naturalityAbstractRelativeFixedFieldFiniteDimensional ++ naturalityAbstractFixedFieldRelativeScalarTower ++ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional ++ naturalityAbstractFixedFieldNumberField ++ naturalityAbstractRelativeFixedFieldNumberField ++ naturalityAbstractRelativeFixedFieldIsGalois ++ naturalityAbstractRelativeFixedFieldIsAbelianGalois ++ ++ ++/-- The additive equivalence from the abelianized extension quotient to the ++Galois group of the relative fixed field, transported through its embedding. -/ ++noncomputable def ++ abstractFixedFieldInclusionTransportedAbelianizedEquiv ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ Additive ++ (Abelianization ++ P.toFiniteGaloisExtension.extensionQuotient) ≃+ ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := ++ numberFieldEmbeddedFiniteGaloisSubextension F E j ++ have hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ have hPEmbedded : ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension X.field) ++ hHEmbedded) ++ PEmbedded = ++ P.toFiniteGaloisExtension := ++ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P ++ exact ++ abelianizedExtensionQuotientAddEquiv_transportExtension hPEmbedded ++ (abelianizedExtensionQuotientAddEquiv_transportBase ++ hHEmbedded PEmbedded ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ F E j)) ++ ++/-- Canonical abelianization comparison built from the already transported ++opaque extension-quotient endpoint. -/ ++private noncomputable def ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ Additive ++ (Abelianization ++ P.toFiniteGaloisExtension.extensionQuotient) ≃+ ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by ++ let Q := ++ Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) ++ exact ++ MulEquiv.toAdditive ++ ((MulEquiv.abelianizationCongr ++ (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P)).trans ++ (Abelianization.equivOfComm : Q ≃* Abelianization Q).symm) ++ ++/-- Pointwise opaque value of the transported abelianized equivalence. -/ ++private noncomputable def ++ abstractFixedFieldInclusionTransportedAbelianizedValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (z : Additive ++ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := ++ abstractFixedFieldInclusionTransportedAbelianizedEquiv H P z ++ ++/-- Pointwise opaque value of the canonical abelianization comparison built ++from the transported quotient endpoint. -/ ++private noncomputable def ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (z : Additive ++ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv H P z ++ ++/-- Pointwise opaque value of the intrinsic abstract fixed-field ++abelianization comparison. -/ ++private noncomputable def ++ abstractFixedFieldInclusionCanonicalAbelianizedValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (z : Additive ++ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := ++ abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P z ++ ++/-- The transported abelianized endpoint agrees pointwise with the canonical ++abelianization comparison built from the transported quotient endpoint. -/ ++private theorem ++ abstractFixedFieldInclusionTransportedAbelianizedValue_eq_canonical ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (z : Additive ++ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : ++ abstractFixedFieldInclusionTransportedAbelianizedValue H P z = ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue ++ H P z := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := ++ numberFieldEmbeddedFiniteGaloisSubextension F E j ++ have hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ have hPEmbedded : ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension X.field) ++ hHEmbedded) ++ PEmbedded = ++ P.toFiniteGaloisExtension := ++ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P ++ let qEmbedded : PEmbedded.extensionQuotient ≃* Gal(E / F) := ++ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup F E j ++ have hCanonical : ++ abstractFixedFieldInclusionTransportedAbelianizedEquiv H P = ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv ++ H P := by ++ simpa only [ ++ abstractFixedFieldInclusionTransportedAbelianizedEquiv, ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv, ++ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv, ++ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup, ++ qEmbedded] using ++ (abelianizedCanonicalEquiv_transportFiniteGalois ++ hHEmbedded PEmbedded hPEmbedded qEmbedded) ++ exact DFunLike.congr_fun hCanonical z ++ ++/-- On an abelianization representative, the transported canonical endpoint ++is the additive value of the transported quotient endpoint. -/ ++private theorem ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_of ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) : ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue H P ++ (Additive.ofMul (Abelianization.of q)) = ++ Additive.ofMul ++ (abstractFixedFieldInclusionTransportedExtensionQuotientValue ++ H P q) := by ++ simpa only [ ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue, ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedEquiv, ++ abstractFixedFieldInclusionTransportedExtensionQuotientValue] using ++ (abelianizationCongrToComm_apply ++ (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P) q) ++ ++/-- On the same representative, the intrinsic fixed-field endpoint is the ++additive value of the canonical quotient endpoint. -/ ++private theorem ++ abstractFixedFieldInclusionCanonicalAbelianizedValue_of ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) : ++ abstractFixedFieldInclusionCanonicalAbelianizedValue H P ++ (Additive.ofMul (Abelianization.of q)) = ++ Additive.ofMul ++ (abstractFixedFieldInclusionCanonicalExtensionQuotientValue ++ H P q) := by ++ let hRawQuotientCommGroup : ++ CommGroup P.toFiniteGaloisExtension.extensionQuotient := ++ { (inferInstance : ++ Group P.toFiniteGaloisExtension.extensionQuotient) with ++ mul_comm := P.commutative.is_comm.comm } ++ let qAbstractRaw := ++ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv H P ++ change ++ MulEquiv.toAdditive ++ ((Abelianization.equivOfComm : ++ P.toFiniteGaloisExtension.extensionQuotient ≃* ++ Abelianization ++ P.toFiniteGaloisExtension.extensionQuotient).symm.trans ++ qAbstractRaw) ++ (Additive.ofMul (Abelianization.of q)) = ++ Additive.ofMul (qAbstractRaw q) ++ exact commutativeAbelianizationEquiv_apply qAbstractRaw q ++ ++/-- The canonical abelianization comparison built after transport agrees ++pointwise with the intrinsic abstract fixed-field comparison. -/ ++private theorem ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_eq ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (z : Additive ++ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue H P z = ++ abstractFixedFieldInclusionCanonicalAbelianizedValue H P z := by ++ let q : P.toFiniteGaloisExtension.extensionQuotient := ++ Quotient.out z.toMul ++ have hz : Additive.ofMul (Abelianization.of q) = z := by ++ apply Additive.ext ++ exact Quotient.out_eq' z.toMul ++ rw [← hz] ++ calc ++ _ = Additive.ofMul ++ (abstractFixedFieldInclusionTransportedExtensionQuotientValue ++ H P q) := ++ abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_of ++ H P q ++ _ = Additive.ofMul ++ (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue ++ H P q) := ++ congrArg Additive.ofMul ++ (abstractFixedFieldInclusionTransportedExtensionQuotientEquiv_apply ++ H P q) ++ _ = Additive.ofMul ++ (abstractFixedFieldInclusionCanonicalExtensionQuotientValue ++ H P q) := ++ congrArg Additive.ofMul ++ (abstractFixedFieldInclusionExtensionQuotientEquiv_apply H P q) ++ _ = _ := ++ (abstractFixedFieldInclusionCanonicalAbelianizedValue_of H P q).symm ++ ++/-- The transported abelianized equivalence agrees pointwise with the ++intrinsic abstract fixed-field Galois comparison. -/ ++theorem ++ abstractFixedFieldInclusionTransportedAbelianizedValue_eq ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (z : Additive ++ (Abelianization P.toFiniteGaloisExtension.extensionQuotient)) : ++ abstractFixedFieldInclusionTransportedAbelianizedValue H P z = ++ abstractFixedFieldInclusionCanonicalAbelianizedValue H P z := ++ (abstractFixedFieldInclusionTransportedAbelianizedValue_eq_canonical ++ H P z).trans ++ (abstractFixedFieldInclusionTransportedCanonicalAbelianizedValue_eq ++ H P z) ++ ++ ++/-- The norm-residue value of an idele class in the Galois group of the ++relative fixed field, computed through the embedded number-field realization. -/ ++noncomputable def ++ abstractFixedFieldInclusionEmbeddedNormResidueValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (c : Additive ++ (IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := ++ numberFieldEmbeddedFiniteGaloisSubextension F E j ++ exact ++ rationalFiniteNormResidueValue HEmbedded PEmbedded ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ F E j) ++ c ++ ++/-- Opaque packaged value after transporting both dependent structures to ++the canonical `H` and `P` endpoints. -/ ++noncomputable def ++ abstractFixedFieldInclusionTransportedNormResidueValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (c : Additive ++ (IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ have hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ let eIdeleEmbedded := ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j ++ let eIdeleOverH : ++ Additive (IdeleClassGroup F) ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation H.field := ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ Additive (IdeleClassGroup F) ≃+ ++ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation X.field) ++ hHEmbedded) ++ eIdeleEmbedded ++ exact ++ rationalFiniteNormResidueValue H P.toFiniteGaloisExtension ++ eIdeleOverH ++ (abstractFixedFieldInclusionTransportedAbelianizedEquiv H P) ++ c ++ ++/-- Opaque intrinsic packaged norm-residue value at the canonical endpoints. -/ ++noncomputable def ++ abstractFixedFieldInclusionCanonicalNormResidueValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (c : Additive ++ (IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : ++ Additive ++ (Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) := ++ rationalFiniteNormResidueValue H P.toFiniteGaloisExtension ++ (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) ++ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) ++ c ++ ++ ++end AbstractFixedFieldInclusion ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityEmbeddedValues.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityEmbeddedValues.lean +new file mode 100644 +index 0000000..2f5a677 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityEmbeddedValues.lean +@@ -0,0 +1,396 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityFixedBase ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++ ++section AbstractFixedFieldInclusion ++ ++variable ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal ++ naturalityAbstractFixedFieldBaseQuotientFinite ++ naturalityAbstractFixedFieldRelativeQuotientFinite ++ naturalityAbstractFixedFieldFiniteDimensional ++ naturalityAbstractRelativeFixedFieldFiniteDimensional ++ naturalityAbstractFixedFieldRelativeScalarTower ++ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional ++ naturalityAbstractFixedFieldNumberField ++ naturalityAbstractRelativeFixedFieldNumberField ++ naturalityAbstractRelativeFixedFieldIsGalois ++ naturalityAbstractRelativeFixedFieldIsAbelianGalois ++ ++/-- The finite abstract field reconstructed from the literal fixed-field ++inclusion is the original packaged abstract field. Keeping this structure ++equality separate avoids repeatedly rebuilding all of its proof fields. -/ ++theorem ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ numberFieldEmbeddedFiniteAbstractField F E j = H := by ++ dsimp only ++ exact FiniteAbstractField.eq_of_field_eq _ _ ++ (numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P) ++ ++ ++theorem ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed_transport_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (c : Additive ++ (IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ Additive (IdeleClassGroup F) ≃+ ++ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation X.field) ++ hHEmbedded) ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) c = ++ rationalAbstractFixedFieldIdeleClassEquivFixed H.field c := by ++ dsimp only ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hBase : ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P ++ have hHEmbedded : ++ numberFieldEmbeddedFiniteAbstractField F E j = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ have hFixedBase : ++ abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup F E j) = F := ++ congrArg ++ (abstractFixedField ℚ (SeparableClosure ℚ)) hBase ++ let eBase : F ≃ₐ[ℚ] F := ++ (numberFieldEmbeddedAbstractBaseFieldEquiv F E j).trans ++ (IntermediateField.equivOfEq hFixedBase) ++ have heBase : ++ eBase = (AlgEquiv.refl : F ≃ₐ[ℚ] F) := by ++ apply AlgEquiv.ext ++ intro x ++ apply Subtype.ext ++ change x.1 = x.1 ++ rfl ++ let hEmbeddedQuotientFinite := ++ numberFieldEmbeddedAbsoluteQuotientFinite F E j ++ let hEmbeddedFixedFiniteDimensional := ++ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional F E j ++ apply Subtype.ext ++ rw [rationalAmbientFixedAddEquiv_transport_apply_val ++ hHEmbedded ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j) c] ++ dsimp only [numberFieldEmbeddedIdeleClassEquivAmbientFixed] ++ simp only [AddEquiv.trans_apply] ++ change ++ ((rationalIdeleClassEquivFixed ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup F E j))) ++ (MulEquiv.toAdditive ++ (ideleClassCongr ++ (numberFieldEmbeddedAbstractBaseFieldEquiv F E j)) c)).1 = ++ ((rationalIdeleClassEquivFixed F) c).1 ++ exact rationalIdeleClassEquivFixed_congr_apply_val ++ hFixedBase ++ (numberFieldEmbeddedAbstractBaseFieldEquiv F E j) ++ heBase c ++ ++/-- Transporting the finite Galois subextension reconstructed from the literal ++fixed-field inclusion recovers the canonical subextension packaged by `P`. ++This is the sole dependent structure equality used by the later quotient ++comparisons. -/ ++theorem ++ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := ++ numberFieldEmbeddedFiniteGaloisSubextension F E j ++ let hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension X.field) ++ hHEmbedded) ++ PEmbedded = ++ P.toFiniteGaloisExtension := by ++ dsimp only ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := ++ numberFieldEmbeddedFiniteGaloisSubextension F E j ++ have hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ exact finiteGaloisSubextension_transport_eq_of_field_eq ++ hHEmbedded PEmbedded P.toFiniteGaloisExtension ++ (numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P) ++ ++/-- Opaque endpoint for the extension-quotient comparison supplied by the ++literal embedding. Its domain is already the canonical quotient of `P`, so ++no client has to reconstruct the two subgroup transports. -/ ++noncomputable def ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ P.toFiniteGaloisExtension.extensionQuotient ≃* ++ Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hBase : ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P ++ have hTop : ++ numberFieldEmbeddedTopSubgroup F E j = P.field := ++ numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P ++ letI hAlgebra : Algebra F (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra F E j ++ let eSep := ++ numberFieldEmbeddedSeparableClosureEquiv F E j ++ letI hEmbeddedExtensionNormal : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal F E j ++ exact ++ P.toFiniteGaloisExtension.extensionQuotientMulEquiv.trans ++ ((extensionQuotientMulEquivOfEq ++ hBase.symm hTop.symm P.below ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).trans ++ (ambientEmbeddedExtensionQuotientEquivGaloisGroup ++ ℚ F E j eSep)) ++ ++/-- Opaque canonical endpoint for the same quotient, obtained directly from ++the abstract fixed-field realization. -/ ++noncomputable def ++ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ P.toFiniteGaloisExtension.extensionQuotient ≃* ++ Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by ++ exact ++ P.toFiniteGaloisExtension.extensionQuotientMulEquiv.trans ++ (abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) ++ H.field P.field P.below P.normal) ++ ++/-- Pointwise opaque endpoint of the embedded quotient equivalence. -/ ++noncomputable def ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) : ++ Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv H P q ++ ++/-- Pointwise opaque endpoint of the canonical quotient equivalence. -/ ++noncomputable def ++ abstractFixedFieldInclusionCanonicalExtensionQuotientValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) : ++ Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := ++ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv H P q ++ ++/-- Fully applied ambient value of the embedded quotient endpoint. -/ ++noncomputable def ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientApplyVal ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := ++ (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q x : ++ SeparableClosure ℚ) ++ ++/-- Fully applied ambient value of the canonical quotient endpoint. -/ ++noncomputable def ++ abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := ++ (abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q x : ++ SeparableClosure ℚ) ++ ++/-- The ambient Galois value attached to a representative of the canonical ++quotient, packaged behind a literal result type. -/ ++noncomputable def ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) : ++ Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hBase : ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P ++ letI hAlgebra : Algebra F (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra F E j ++ let eSep := ++ numberFieldEmbeddedSeparableClosureEquiv F E j ++ letI hEmbeddedExtensionNormal : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal F E j ++ let σEmbedded : ++ (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := ++ (MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ ++ exact ++ ambientEmbeddedExtensionQuotientEquivGaloisGroup ++ ℚ F E j eSep (QuotientGroup.mk σEmbedded) ++ ++/-- Fully applied ambient value of the packaged representative endpoint. -/ ++noncomputable def ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := ++ (abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue H P σ x : ++ SeparableClosure ℚ) ++ ++/-- Ambient action of the representative after rebundling it in the embedded ++base subgroup. -/ ++noncomputable def ++ abstractFixedFieldInclusionRebasedAutomorphismApplyVal ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : SeparableClosure ℚ := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hBase : ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P ++ let σEmbedded : ++ (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := ++ (MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ ++ exact σEmbedded.1.1 (x : SeparableClosure ℚ) ++ ++ ++end AbstractFixedFieldInclusion ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityExtensionValues.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityExtensionValues.lean +new file mode 100644 +index 0000000..def7569 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityExtensionValues.lean +@@ -0,0 +1,419 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityEmbeddedValues ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++ ++section AbstractFixedFieldInclusion ++ ++variable ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal ++ naturalityAbstractFixedFieldBaseQuotientFinite ++ naturalityAbstractFixedFieldRelativeQuotientFinite ++ naturalityAbstractFixedFieldFiniteDimensional ++ naturalityAbstractRelativeFixedFieldFiniteDimensional ++ naturalityAbstractFixedFieldRelativeScalarTower ++ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional ++ naturalityAbstractFixedFieldNumberField ++ naturalityAbstractRelativeFixedFieldNumberField ++ naturalityAbstractRelativeFixedFieldIsGalois ++ naturalityAbstractRelativeFixedFieldIsAbelianGalois ++ ++/-- The embedded quotient endpoint sends a canonical representative to the ++packaged ambient value above. -/ ++private theorem ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue_mk ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) : ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P ++ (P.toFiniteGaloisExtension.extensionQuotientMk σ) = ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue H P σ := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hBase : ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P ++ have hTop : ++ numberFieldEmbeddedTopSubgroup F E j = P.field := ++ numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P ++ let hAlgebra : Algebra F (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra F E j ++ let eSep := ++ numberFieldEmbeddedSeparableClosureEquiv F E j ++ let hEmbeddedExtensionNormal : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal F E j ++ simp only [ ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue, ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv, ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue, ++ MulEquiv.trans_apply, ++ FiniteGaloisSubextension.extensionQuotientMk_apply] ++ exact congrArg ++ (ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep) ++ (extensionQuotientMulEquivOfEq_mk ++ hBase.symm hTop.symm P.below ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j) σ) ++ ++/-- The packaged ambient endpoint evaluates to the action of the rebundled ++representative. -/ ++private theorem ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal_eq_rebased ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal H P σ x = ++ abstractFixedFieldInclusionRebasedAutomorphismApplyVal H P σ x := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hBase : ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P ++ let hAlgebra : Algebra F (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra F E j ++ let eSep := ++ numberFieldEmbeddedSeparableClosureEquiv F E j ++ let hEmbeddedExtensionNormal : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal F E j ++ let σEmbedded : ++ (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := ++ (MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ ++ have hmk := ++ ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply ++ ℚ F E j eSep σEmbedded x ++ change ++ (ambientEmbeddedExtensionQuotientEquivGaloisGroup ++ ℚ F E j eSep (QuotientGroup.mk σEmbedded) x : ++ SeparableClosure ℚ) = ++ σEmbedded.1.1 (x : SeparableClosure ℚ) at hmk ++ simpa only [ ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal, ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue, ++ abstractFixedFieldInclusionRebasedAutomorphismApplyVal] using hmk ++ ++/-- Rebundling the representative does not change its action in the ambient ++separable closure. -/ ++private theorem ++ abstractFixedFieldInclusionRebasedAutomorphismApplyVal_eq ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : ++ abstractFixedFieldInclusionRebasedAutomorphismApplyVal H P σ x = ++ σ.1.1 (x : SeparableClosure ℚ) := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hBase : ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P ++ let σEmbedded : ++ (numberFieldEmbeddedBaseSubgroup F E j).toSubgroup := ++ (MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ ++ have hσEmbedded : ++ (σEmbedded.1 : SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) = σ.1 := ++ closedSubgroupCongr_apply_val hBase.symm σ ++ change σEmbedded.1.1 (x : SeparableClosure ℚ) = _ ++ rw [hσEmbedded] ++ ++/-- The packaged ambient representative acts by the original automorphism on ++the underlying separable-closure value. -/ ++private theorem ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal H P σ x = ++ σ.1.1 (x : SeparableClosure ℚ) := by ++ exact ++ (abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal_eq_rebased ++ H P σ x).trans ++ (abstractFixedFieldInclusionRebasedAutomorphismApplyVal_eq H P σ x) ++ ++/-- Evaluation of the embedded quotient endpoint on a canonical quotient ++representative, stated only in the ambient separable closure. -/ ++private theorem ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv_mk_val ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientApplyVal H P ++ (P.toFiniteGaloisExtension.extensionQuotientMk σ) x = ++ σ.1.1 (x : SeparableClosure ℚ) := by ++ calc ++ _ = abstractFixedFieldInclusionAmbientEmbeddedQuotientMkApplyVal ++ H P σ x := by ++ exact congrArg ++ (fun g => (g x : SeparableClosure ℚ)) ++ (abstractFixedFieldInclusionEmbeddedExtensionQuotientValue_mk ++ H P σ) ++ _ = _ := ++ abstractFixedFieldInclusionAmbientEmbeddedQuotientMkValue_apply ++ H P σ x ++ ++/-- Evaluation of the canonical abstract quotient endpoint on a quotient ++representative, again exposed only through its ambient value. -/ ++private theorem ++ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv_mk_val ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) ++ (x : abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) : ++ abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal H P ++ (P.toFiniteGaloisExtension.extensionQuotientMk σ) x = ++ σ.1.1 (x : SeparableClosure ℚ) := by ++ simp only [ ++ abstractFixedFieldInclusionCanonicalExtensionQuotientApplyVal, ++ abstractFixedFieldInclusionCanonicalExtensionQuotientValue, ++ abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv, ++ MulEquiv.trans_apply, ++ FiniteGaloisSubextension.extensionQuotientMk_apply] ++ exact ++ (abstractExtensionQuotientEquivGaloisGroup_mk_apply_val ++ ℚ (SeparableClosure ℚ) ++ H.field P.field P.below P.normal σ x).symm ++ ++ ++theorem ++ abstractFixedFieldInclusionExtensionQuotientEquiv_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) : ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q = ++ abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q := by ++ refine P.toFiniteGaloisExtension.extensionQuotient_inductionOn ++ (motive := fun q => ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q = ++ abstractFixedFieldInclusionCanonicalExtensionQuotientValue H P q) ++ q ?_ ++ intro σ ++ apply AlgEquiv.ext ++ intro x ++ apply Subtype.ext ++ exact ++ (abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv_mk_val ++ H P σ x).trans ++ (abstractFixedFieldInclusionCanonicalExtensionQuotientEquiv_mk_val ++ H P σ x).symm ++ ++ ++/-- The extension quotient identified with the Galois group of the corresponding ++relative fixed field, after transporting the embedded field structures. -/ ++noncomputable def ++ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ P.toFiniteGaloisExtension.extensionQuotient ≃* ++ Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := ++ numberFieldEmbeddedFiniteGaloisSubextension F E j ++ have hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ have hPEmbedded : ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension X.field) ++ hHEmbedded) ++ PEmbedded = ++ P.toFiniteGaloisExtension := ++ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P ++ exact ++ (extensionQuotientMulEquiv_transportFiniteGalois ++ hHEmbedded PEmbedded hPEmbedded).trans ++ (numberFieldEmbeddedExtensionQuotientEquivGaloisGroup F E j) ++ ++/-- Pointwise opaque endpoint of the transported quotient equivalence. -/ ++noncomputable def ++ abstractFixedFieldInclusionTransportedExtensionQuotientValue ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) : ++ Gal( ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) / ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) := ++ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv H P q ++ ++ ++private theorem ++ abstractFixedFieldInclusionTransportedExtensionQuotientValue_mk ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (σ : H.field.toSubgroup) : ++ abstractFixedFieldInclusionTransportedExtensionQuotientValue H P ++ (P.toFiniteGaloisExtension.extensionQuotientMk σ) = ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P ++ (P.toFiniteGaloisExtension.extensionQuotientMk σ) := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hBase : ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion H P ++ have hTop : ++ numberFieldEmbeddedTopSubgroup F E j = P.field := ++ numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion H P ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := ++ numberFieldEmbeddedFiniteGaloisSubextension F E j ++ have hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ have hPEmbedded : ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension X.field) ++ hHEmbedded) ++ PEmbedded = ++ P.toFiniteGaloisExtension := ++ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P ++ let hAlgebra : Algebra F (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra F E j ++ let eSep := ++ numberFieldEmbeddedSeparableClosureEquiv F E j ++ let hEmbeddedExtensionNormal : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup F E j) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j)).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal F E j ++ have hFieldEq : ++ (congrArg FiniteAbstractField.field hHEmbedded).symm = hBase.symm := ++ Subsingleton.elim _ _ ++ simp only [ ++ abstractFixedFieldInclusionTransportedExtensionQuotientValue, ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue, ++ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv, ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientEquiv, ++ MulEquiv.trans_apply, ++ extensionQuotientMulEquiv_transportFiniteGalois_mk, ++ FiniteGaloisSubextension.extensionQuotientMk_apply, ++ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup] ++ rw [hFieldEq] ++ change ++ ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep ++ (QuotientGroup.mk ++ ((MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup hBase.symm)) σ)) = _ ++ exact ++ (congrArg ++ (ambientEmbeddedExtensionQuotientEquivGaloisGroup ℚ F E j eSep) ++ (extensionQuotientMulEquivOfEq_mk ++ hBase.symm hTop.symm P.below ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup F E j) σ)).symm ++ ++ ++theorem ++ abstractFixedFieldInclusionTransportedExtensionQuotientEquiv_apply ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (q : P.toFiniteGaloisExtension.extensionQuotient) : ++ abstractFixedFieldInclusionTransportedExtensionQuotientValue H P q = ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q := by ++ refine P.toFiniteGaloisExtension.extensionQuotient_inductionOn ++ (motive := fun q => ++ abstractFixedFieldInclusionTransportedExtensionQuotientValue H P q = ++ abstractFixedFieldInclusionEmbeddedExtensionQuotientValue H P q) ++ q ?_ ++ intro σ ++ exact abstractFixedFieldInclusionTransportedExtensionQuotientValue_mk ++ H P σ ++ ++ ++end AbstractFixedFieldInclusion ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedBase.lean +new file mode 100644 +index 0000000..d3a9bb0 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedBase.lean +@@ -0,0 +1,376 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityTransports ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++ ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal ++ ++section AbstractFixedFieldInclusion ++ ++variable ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ ++local instance naturalityAbstractFixedFieldBaseQuotientFinite : ++ Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ H.field (le_baseField H.field)) := ++ H.finite ++ ++local instance naturalityAbstractFixedFieldRelativeQuotientFinite : ++ Finite ++ (H.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H.field P.field P.below) := ++ P.finite ++ ++noncomputable local instance ++ naturalityAbstractFixedFieldFiniteDimensional : ++ FiniteDimensional ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) := ++ abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) H.field H.finite ++ ++noncomputable local instance ++ naturalityAbstractRelativeFixedFieldFiniteDimensional : ++ FiniteDimensional ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) := ++ abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) ++ H.field P.field P.below H.finite P.finite ++ ++local instance naturalityAbstractFixedFieldRelativeScalarTower : ++ IsScalarTower ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) := ++ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) ++ ++noncomputable local instance ++ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional : ++ FiniteDimensional ℚ ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) := ++ FiniteDimensional.trans ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) ++ ++noncomputable local instance naturalityAbstractFixedFieldNumberField : ++ NumberField ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) := ++ NumberField.of_module_finite ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ ++noncomputable local instance ++ naturalityAbstractRelativeFixedFieldNumberField : ++ NumberField ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) := ++ NumberField.of_module_finite ℚ ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) ++ ++/-- Use the same direct fixed-field Galois witness as the intrinsic ++norm-residue construction. This prevents the dependent Galois-group type ++from being synthesized through a second `IsAbelianGalois` instance path. -/ ++noncomputable local instance ++ naturalityAbstractRelativeFixedFieldIsGalois : ++ IsGalois ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) := ++ abstractRelativeFixedField_isGalois ++ ℚ (SeparableClosure ℚ) ++ H.field P.field P.below P.normal ++ ++noncomputable local instance ++ naturalityAbstractRelativeFixedFieldIsAbelianGalois : ++ IsAbelianGalois ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) := ++ finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P ++ ++/-- The lower subgroup obtained from the canonical inclusion of an abstract ++fixed-field tower is the original lower closed subgroup. -/ ++theorem ++ numberFieldEmbeddedBaseSubgroup_abstractFixedFieldInclusion ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ numberFieldEmbeddedBaseSubgroup F E j = H.field := by ++ dsimp only ++ have hi : ++ numberFieldEmbeddedLowerEmbedding ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) ++ ((abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ) = ++ (abstractFixedField ++ ℚ (SeparableClosure ℚ) H.field).val := by ++ ext x ++ rfl ++ have hRange : ++ (numberFieldEmbeddedLowerEmbedding ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) ++ ((abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ)).fieldRange = ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field := by ++ ext x ++ constructor ++ · rintro ⟨y, rfl⟩ ++ change ++ numberFieldEmbeddedLowerEmbedding ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field) ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below) ++ ((abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ) y ∈ ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ rw [hi] ++ exact y.property ++ · intro hx ++ refine ⟨⟨x, hx⟩, ?_⟩ ++ rw [hi] ++ rfl ++ rw [numberFieldEmbeddedBaseSubgroup, hRange] ++ exact ++ closedFixingSubgroup_abstractFixedField_eq ++ ℚ (SeparableClosure ℚ) H.field ++ ++/-- The upper subgroup obtained from the canonical inclusion of an abstract ++fixed-field tower is the original upper closed subgroup. -/ ++theorem ++ numberFieldEmbeddedTopSubgroup_abstractFixedFieldInclusion ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ numberFieldEmbeddedTopSubgroup F E j = P.field := by ++ dsimp only ++ rw [numberFieldEmbeddedTopSubgroup] ++ have hjRangeSelf : ++ ((abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ).fieldRange = ++ (abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below).restrictScalars ℚ := by ++ ext x ++ constructor ++ · rintro ⟨y, rfl⟩ ++ exact y.property ++ · intro hx ++ exact ⟨⟨x, hx⟩, rfl⟩ ++ have hjRange : ++ ((abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below).val.restrictScalars ℚ).fieldRange = ++ abstractFixedField ℚ (SeparableClosure ℚ) P.field := by ++ exact hjRangeSelf.trans ++ (IntermediateField.extendScalars_restrictScalars ++ (abstractFixedField_le ++ ℚ (SeparableClosure ℚ) P.below)) ++ rw [hjRange] ++ exact ++ closedFixingSubgroup_abstractFixedField_eq ++ ℚ (SeparableClosure ℚ) P.field ++ ++/-- Transport a packaged rational norm-residue value directly from an equal ++abstract base to the finite Galois extension underlying `P`. Keeping the two ++dependent transports in their own declaration prevents their elaboration cost ++from accumulating in the main fixed-field comparison theorem. -/ ++theorem rationalFiniteNormResidueValue_transportToAbstractExtension ++ {A : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} ++ (hAH : A = H) ++ (L : FiniteGaloisSubextension A.field) ++ (hLP : ++ Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension Y.field) ++ hAH) ++ L = ++ P.toFiniteGaloisExtension) ++ {C X : Type} [AddGroup C] [AddGroup X] ++ (eIdele : C ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) ++ (eGalois : Additive (Abelianization L.extensionQuotient) ≃+ X) ++ (c : C) : ++ rationalFiniteNormResidueValue A L eIdele eGalois c = ++ rationalFiniteNormResidueValue H P.toFiniteGaloisExtension ++ (Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ C ≃+ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation Y.field) ++ hAH) ++ eIdele) ++ (abelianizedExtensionQuotientAddEquiv_transportExtension hLP ++ (abelianizedExtensionQuotientAddEquiv_transportBase ++ hAH L eGalois)) ++ c := by ++ calc ++ _ = rationalFiniteNormResidueValue H ++ (Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension Y.field) ++ hAH) ++ L) ++ (Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ C ≃+ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation Y.field) ++ hAH) ++ eIdele) ++ (abelianizedExtensionQuotientAddEquiv_transportBase hAH L eGalois) ++ c := ++ rationalFiniteNormResidueValue_transportBase ++ (A := A) (B := H) (C := C) (X := X) ++ hAH L eIdele eGalois c ++ _ = _ := ++ rationalFiniteNormResidueValue_transportExtension ++ (K := H) ++ (P := Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension Y.field) ++ hAH) ++ L) ++ (Q := P.toFiniteGaloisExtension) (C := C) (X := X) ++ hLP ++ (Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ C ≃+ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation Y.field) ++ hAH) ++ eIdele) ++ (abelianizedExtensionQuotientAddEquiv_transportBase hAH L eGalois) ++ c ++ ++/-- The packaged value at the literal fixed-field realization is the ambient ++fixed-part norm-residue homomorphism evaluated at the same idele class. -/ ++private theorem rationalFiniteNormResidueValue_abstractFixedField_eq_ambient ++ (c : IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) : ++ rationalFiniteNormResidueValue H P.toFiniteGaloisExtension ++ (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) ++ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) ++ (Additive.ofMul c) = ++ ambientFixedGlobalNormResidueAddMonoidHom H P ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ H.field (Additive.ofMul c)) := by ++ let eRec := ++ rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ H P.toFiniteGaloisExtension ++ let eGal := ++ abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P ++ change ++ eGal ++ (eRec ++ (finiteNormClass rationalIdeleClassRepresentation ++ H.field P.field P.below ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ H.field (Additive.ofMul c)))) = ++ eGal ++ (eRec ++ (finiteNormClass rationalIdeleClassRepresentation ++ H.field P.field P.below ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ H.field (Additive.ofMul c)))) ++ rfl ++ ++/-- The packaged norm-residue value for the literal fixed-field realization ++is the intrinsic abstract fixed-field norm-residue value. -/ ++theorem rationalFiniteNormResidueValue_abstractFixedField_apply ++ (c : IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field)) : ++ Additive.toMul ++ (rationalFiniteNormResidueValue H P.toFiniteGaloisExtension ++ (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) ++ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup ++ H P) ++ (Additive.ofMul c)) = ++ abstractFixedFieldGlobalNormResidueMonoidHom H P c := by ++ let a := ++ rationalAbstractFixedFieldIdeleClassEquivFixed ++ H.field (Additive.ofMul c) ++ have hAbstract := ++ abstractFixedFieldGlobalNormResidueMonoidHom_fixed_apply H P a ++ calc ++ _ = Additive.toMul ++ (ambientFixedGlobalNormResidueAddMonoidHom H P ++ (rationalAbstractFixedFieldIdeleClassEquivFixed ++ H.field (Additive.ofMul c))) := by ++ exact congrArg Additive.toMul ++ (rationalFiniteNormResidueValue_abstractFixedField_eq_ambient ++ (H := H) (P := P) c) ++ _ = _ := by ++ simpa only [a, AddEquiv.symm_apply_apply, toMul_ofMul] using ++ hAbstract.symm ++ ++ ++end AbstractFixedFieldInclusion ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedComparison.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedComparison.lean +new file mode 100644 +index 0000000..ce523c2 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityFixedComparison.lean +@@ -0,0 +1,237 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityAbelianValues ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++ ++section AbstractFixedFieldInclusion ++ ++variable ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal ++ naturalityAbstractFixedFieldBaseQuotientFinite ++ naturalityAbstractFixedFieldRelativeQuotientFinite ++ naturalityAbstractFixedFieldFiniteDimensional ++ naturalityAbstractRelativeFixedFieldFiniteDimensional ++ naturalityAbstractFixedFieldRelativeScalarTower ++ naturalityAbstractRelativeFixedFieldAbsoluteFiniteDimensional ++ naturalityAbstractFixedFieldNumberField ++ naturalityAbstractRelativeFixedFieldNumberField ++ naturalityAbstractRelativeFixedFieldIsGalois ++ naturalityAbstractRelativeFixedFieldIsAbelianGalois ++ ++ ++private theorem ++ abstractFixedFieldInclusionEmbeddedNormResidueValue_eq_transported ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (c : Additive ++ (IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : ++ abstractFixedFieldInclusionEmbeddedNormResidueValue H P c = ++ abstractFixedFieldInclusionTransportedNormResidueValue H P c := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ let PEmbedded : FiniteGaloisSubextension HEmbedded.field := ++ numberFieldEmbeddedFiniteGaloisSubextension F E j ++ have hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ have hPEmbedded : ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension X.field) ++ hHEmbedded) ++ PEmbedded = ++ P.toFiniteGaloisExtension := ++ numberFieldEmbeddedFiniteGaloisSubextension_transport_eq H P ++ let eIdeleEmbedded := ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j ++ let eGaloisEmbedded := ++ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup F E j ++ simpa only [ ++ abstractFixedFieldInclusionEmbeddedNormResidueValue, ++ abstractFixedFieldInclusionTransportedNormResidueValue, ++ abstractFixedFieldInclusionTransportedAbelianizedEquiv, ++ eIdeleEmbedded, ++ eGaloisEmbedded] using ++ (rationalFiniteNormResidueValue_transportToAbstractExtension ++ (H := H) (P := P) ++ (A := HEmbedded) ++ (C := Additive (IdeleClassGroup F)) ++ (X := Additive Gal(E / F)) ++ hHEmbedded PEmbedded hPEmbedded ++ eIdeleEmbedded eGaloisEmbedded c) ++ ++/-- A packaged finite norm-residue value depends only on the value of its ++idele comparison at the chosen input and the value of its Galois comparison ++at the resulting norm class. -/ ++private theorem rationalFiniteNormResidueValue_congr_apply ++ (K : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (L : FiniteGaloisSubextension K.field) ++ {C X : Type} [AddGroup C] [AddGroup X] ++ (eIdele eIdele' : C ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) ++ (eGalois eGalois' : ++ Additive (Abelianization L.extensionQuotient) ≃+ X) ++ (c : C) ++ (heIdele : eIdele c = eIdele' c) ++ (heGalois : ∀ z, eGalois z = eGalois' z) : ++ rationalFiniteNormResidueValue K L eIdele eGalois c = ++ rationalFiniteNormResidueValue K L eIdele' eGalois' c := by ++ unfold rationalFiniteNormResidueValue ++ rw [heIdele] ++ exact heGalois _ ++ ++/-- The transported packaged value is the intrinsic canonical packaged value; ++only the idele input and the eventual abelianized value are compared. -/ ++private theorem ++ abstractFixedFieldInclusionTransportedNormResidueValue_eq_canonical ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (c : Additive ++ (IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : ++ abstractFixedFieldInclusionTransportedNormResidueValue H P c = ++ abstractFixedFieldInclusionCanonicalNormResidueValue H P c := by ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ let HEmbedded := ++ numberFieldEmbeddedFiniteAbstractField F E j ++ have hHEmbedded : HEmbedded = H := ++ numberFieldEmbeddedFiniteAbstractField_abstractFixedFieldInclusion H P ++ let eIdeleEmbedded := ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed F E j ++ let eIdeleOverH : ++ Additive (IdeleClassGroup F) ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation H.field := ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ Additive (IdeleClassGroup F) ≃+ ++ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation X.field) ++ hHEmbedded) ++ eIdeleEmbedded ++ simpa only [ ++ abstractFixedFieldInclusionTransportedNormResidueValue, ++ abstractFixedFieldInclusionCanonicalNormResidueValue, ++ eIdeleEmbedded, ++ eIdeleOverH] using ++ (rationalFiniteNormResidueValue_congr_apply ++ H P.toFiniteGaloisExtension ++ eIdeleOverH ++ (rationalAbstractFixedFieldIdeleClassEquivFixed H.field) ++ (abstractFixedFieldInclusionTransportedAbelianizedEquiv H P) ++ (abstractFixedFieldAbelianizedExtensionQuotientEquivGaloisGroup H P) ++ c ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed_transport_apply H P c) ++ (fun z => abstractFixedFieldInclusionTransportedAbelianizedValue_eq ++ H P z)) ++ ++/-- The explicitly embedded and intrinsic packaged norm-residue values agree. -/ ++private theorem ++ abstractFixedFieldInclusionEmbeddedNormResidueValue_eq ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) ++ (c : Additive ++ (IdeleClassGroup ++ (abstractFixedField ℚ (SeparableClosure ℚ) H.field))) : ++ abstractFixedFieldInclusionEmbeddedNormResidueValue H P c = ++ abstractFixedFieldInclusionCanonicalNormResidueValue H P c := ++ (abstractFixedFieldInclusionEmbeddedNormResidueValue_eq_transported ++ H P c).trans ++ (abstractFixedFieldInclusionTransportedNormResidueValue_eq_canonical ++ H P c) ++ ++/-- For the literal fixed fields attached to an abstract finite abelian ++extension, the norm-residue map obtained from their canonical inclusion in ++the rational separable closure is the intrinsic fixed-field norm-residue ++map. -/ ++theorem ++ globalNormResidueMonoidHomOfEmbedding_abstractFixedFieldInclusion ++ (H : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (P : FiniteAbelianSubextension H.field) : ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H.field ++ let E := ++ abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ globalNormResidueMonoidHomOfEmbedding F E j = ++ abstractFixedFieldGlobalNormResidueMonoidHom H P := by ++ dsimp only ++ apply MonoidHom.ext ++ intro c ++ rw [globalNormResidueMonoidHomOfEmbedding_apply] ++ change ++ Additive.toMul ++ (abstractFixedFieldInclusionEmbeddedNormResidueValue ++ H P (Additive.ofMul c)) = ++ abstractFixedFieldGlobalNormResidueMonoidHom H P c ++ calc ++ _ = Additive.toMul ++ (abstractFixedFieldInclusionCanonicalNormResidueValue ++ H P (Additive.ofMul c)) := ++ congrArg Additive.toMul ++ (abstractFixedFieldInclusionEmbeddedNormResidueValue_eq ++ H P (Additive.ofMul c)) ++ _ = _ := by ++ simpa only [abstractFixedFieldInclusionCanonicalNormResidueValue] using ++ (rationalFiniteNormResidueValue_abstractFixedField_apply ++ (H := H) (P := P) c) ++ ++end AbstractFixedFieldInclusion ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerBase.lean +new file mode 100644 +index 0000000..dcad422 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerBase.lean +@@ -0,0 +1,339 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityFixedComparison ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++ ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal ++ ++section EmbeddedNumberFieldRestriction ++ ++variable ++ (K K' L L' : Type) ++ [Field K] [NumberField K] ++ [Field K'] [NumberField K'] ++ [Field L] [NumberField L] ++ [Field L'] [NumberField L'] ++ [Algebra K K'] [Algebra K L] [Algebra K L'] ++ [Algebra K' L'] [Algebra L L'] ++ [IsScalarTower K K' L'] [IsScalarTower K L L'] ++ ++ ++/-- Rebracketing the compatible tower does not change its embedded lower ++fixing subgroup. -/ ++private theorem numberFieldEmbeddedBaseSubgroup_baseChange_eq ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ numberFieldEmbeddedBaseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j) = ++ numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')) := by ++ have hi : ++ numberFieldEmbeddedLowerEmbedding K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j) = ++ numberFieldEmbeddedLowerEmbedding K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')) := by ++ ext x ++ simp only [numberFieldEmbeddedLowerEmbedding, AlgHom.comp_apply, ++ IsScalarTower.coe_toAlgHom'] ++ rw [← IsScalarTower.algebraMap_apply K K' L', ++ ← IsScalarTower.algebraMap_apply K L L'] ++ simp only [numberFieldEmbeddedBaseSubgroup, hi] ++ ++omit [Field K] [NumberField K] ++ [Algebra K K'] [Algebra K L'] [IsScalarTower K K' L'] in ++/-- The top subgroup of the rebracketed base-change tower is the embedded ++fixing subgroup of the intermediate field. -/ ++private theorem numberFieldEmbeddedTopSubgroup_baseChange_eq ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ numberFieldEmbeddedTopSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j) = ++ numberFieldEmbeddedBaseSubgroup K' L' j := by ++ rfl ++ ++/-- Reidentify the two presentations of the embedded lower fixing subgroup ++without transporting dependent subgroup data through an equality. -/ ++private noncomputable def numberFieldEmbeddedBaseChangeBaseEquiv ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ (numberFieldEmbeddedBaseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ≃* ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup := ++ MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup ++ (numberFieldEmbeddedBaseSubgroup_baseChange_eq K K' L L' j)) ++ ++/-- Under the identity equivalence of the two lower fixing subgroups, the ++relative subgroup for the base change is exactly the target presentation. -/ ++private theorem numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)) ++ (numberFieldEmbeddedTopSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j))).map ++ (numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j).toMonoidHom = ++ CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseSubgroup K' L' j) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) := by ++ let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j ++ have hTop : ++ (numberFieldEmbeddedTopSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup = ++ (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup := ++ congrArg ClosedSubgroup.toSubgroup ++ (numberFieldEmbeddedTopSubgroup_baseChange_eq ++ (K := K) (K' := K') (L' := L') j) ++ ext x ++ constructor ++ · rintro ⟨y, hy, rfl⟩ ++ change ++ ((e y : ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup) : ++ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) ∈ ++ (numberFieldEmbeddedBaseSubgroup K' L' j).toSubgroup ++ dsimp only [e, numberFieldEmbeddedBaseChangeBaseEquiv] ++ rw [MulEquiv.subgroupCongr_apply, ← hTop] ++ exact hy ++ · intro hx ++ refine ⟨e.symm x, ?_, e.apply_symm_apply x⟩ ++ change ++ (((e.symm x : ++ (numberFieldEmbeddedBaseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup) : ++ SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) ∈ ++ (numberFieldEmbeddedTopSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup) ++ dsimp only [e, numberFieldEmbeddedBaseChangeBaseEquiv] ++ rw [MulEquiv.subgroupCongr_symm_apply, hTop] ++ exact hx ++ ++/-- Normality of the relative subgroup between the two embedded base fields ++in a finite Galois base change. -/ ++private theorem numberFieldEmbeddedBaseChangeExtensionSubgroup_normal ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseSubgroup K' L' j) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)).Normal := by ++ let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j ++ have hNormal := ++ (numberFieldEmbeddedExtensionSubgroup_normal K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)).map ++ e.toMonoidHom e.surjective ++ rw [numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq ++ K K' L L' j] at hNormal ++ exact hNormal ++ ++noncomputable local instance ++ numberFieldEmbeddedBaseChangeExtensionSubgroupNormal ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ (CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseSubgroup K' L' j) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)).Normal := ++ numberFieldEmbeddedBaseChangeExtensionSubgroup_normal K K' L L' j ++ ++/-- Finiteness of the relative quotient between the two embedded base fields ++in a finite Galois base change. -/ ++private theorem numberFieldEmbeddedBaseChangeExtensionQuotient_finite ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ Finite ++ ((numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseSubgroup K' L' j) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := by ++ let e := numberFieldEmbeddedBaseChangeBaseEquiv K K' L L' j ++ let N := ++ CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)) ++ (numberFieldEmbeddedTopSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)) ++ (numberFieldEmbeddedTopSubgroup_le_baseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)) ++ let M := ++ CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseSubgroup K' L' j) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) ++ let hNNormal : N.Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j) ++ let hMNormal : M.Normal := ++ numberFieldEmbeddedBaseChangeExtensionSubgroup_normal K K' L L' j ++ let hNFinite : ++ Finite ++ ((numberFieldEmbeddedBaseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ⧸ N) := ++ numberFieldEmbeddedExtensionQuotient_finite K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j) ++ have hmap : N.map e.toMonoidHom = M := ++ numberFieldEmbeddedBaseChangeExtensionSubgroup_map_eq K K' L L' j ++ have hle : N ≤ M.comap e.toMonoidHom := by ++ rw [← hmap] ++ exact Subgroup.le_comap_map e.toMonoidHom N ++ let f : ++ ((numberFieldEmbeddedBaseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup ⧸ N) →* ++ ((numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ M) := ++ QuotientGroup.map N M e.toMonoidHom hle ++ have hmk : Function.Surjective ++ (QuotientGroup.mk ∘ e : ++ (numberFieldEmbeddedBaseSubgroup K K' ++ (numberFieldEmbeddedLowerEmbedding K' L' j)).toSubgroup → ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ M) := ++ QuotientGroup.mk_surjective.comp e.surjective ++ have hsurj : Function.Surjective f := ++ QuotientGroup.map_surjective_of_surjective ++ (N := N) M e.toMonoidHom hmk hle ++ exact Finite.of_surjective f hsurj ++ ++noncomputable local instance ++ numberFieldEmbeddedBaseChangeExtensionQuotientFinite ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ Finite ++ ((numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseSubgroup K' L' j) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := ++ numberFieldEmbeddedBaseChangeExtensionQuotient_finite K K' L L' j ++ ++/-- Reuse the canonical absolute fixed-field witness for the lower embedded ++tower. The base-change relative witness below needs this exact instance path ++when forming the absolute finite-dimensional tower. -/ ++noncomputable local instance ++ numberFieldEmbeddedBaseChangeBaseFixedFieldFiniteDimensional ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteDimensional ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) := ++ numberFieldEmbeddedAbstractFixedFieldFiniteDimensional K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')) ++ ++noncomputable local instance ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldFiniteDimensional ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteDimensional ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := ++ abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseSubgroup K' L' j) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) ++ (numberFieldEmbeddedAbsoluteQuotientFinite K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseChangeExtensionQuotientFinite K K' L L' j) ++ ++local instance ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldScalarTower ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ IsScalarTower ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := ++ IsScalarTower.of_algebraMap_eq' (RingHom.ext_rat _ _) ++ ++noncomputable local instance ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ FiniteDimensional ℚ ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := ++ FiniteDimensional.trans ℚ ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) ++ ++noncomputable local instance ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ NumberField ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := ++ NumberField.of_module_finite ℚ ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) ++ ++noncomputable local instance ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldIsGalois ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ IsGalois ++ (abstractFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')))) ++ (abstractRelativeFixedField ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j)) := ++ abstractRelativeFixedField_isGalois ++ ℚ (SeparableClosure ℚ) ++ (numberFieldEmbeddedBaseSubgroup K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L'))) ++ (numberFieldEmbeddedBaseSubgroup K' L' j) ++ (numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j) ++ (numberFieldEmbeddedBaseChangeExtensionSubgroupNormal K K' L L' j) ++ ++ ++end EmbeddedNumberFieldRestriction ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerNorm.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerNorm.lean +new file mode 100644 +index 0000000..a0d887a +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerNorm.lean +@@ -0,0 +1,261 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityTowerRestriction ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++ ++section EmbeddedNumberFieldRestriction ++ ++variable ++ (K K' L L' : Type) ++ [Field K] [NumberField K] ++ [Field K'] [NumberField K'] ++ [Field L] [NumberField L] ++ [Field L'] [NumberField L'] ++ [Algebra K K'] [Algebra K L] [Algebra K L'] ++ [Algebra K' L'] [Algebra L L'] ++ [IsScalarTower K K' L'] [IsScalarTower K L L'] ++ ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal ++ numberFieldEmbeddedBaseChangeExtensionSubgroupNormal ++ numberFieldEmbeddedBaseChangeExtensionQuotientFinite ++ numberFieldEmbeddedBaseChangeBaseFixedFieldFiniteDimensional ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldFiniteDimensional ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldScalarTower ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldIsGalois ++ ++/-- For one common compatible embedding of a Galois base-change ++diamond, the genuine global norm-residue maps commute with ordinary ++idele-class norm and actual restriction of automorphisms. -/ ++theorem globalNormResidueMonoidHomOfEmbedding_norm_restriction ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) : ++ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ L L') ++ ((AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K)).comp ++ (globalNormResidueMonoidHomOfEmbedding K' L' j) = ++ (globalNormResidueMonoidHomOfEmbedding K L jLower).comp ++ (_root_.ideleClassNorm K K') := by ++ dsimp only ++ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ L L') ++ let H := ++ numberFieldEmbeddedBaseSubgroup K L jLower ++ let H' := ++ numberFieldEmbeddedBaseSubgroup K' L' j ++ let J := ++ numberFieldEmbeddedTopSubgroup K L jLower ++ let J' := ++ numberFieldEmbeddedTopSubgroup K' L' j ++ let hJH := ++ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L jLower ++ let hJ'H' := ++ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K' L' j ++ let hH'H := ++ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j ++ let hJ'J := ++ numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j ++ let _ : ++ (CyclicCohomology.extensionSubgroup H J hJH).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal K L jLower ++ let _ : ++ Finite ++ (H.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H J hJH) := ++ numberFieldEmbeddedExtensionQuotient_finite K L jLower ++ let _ : ++ (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal K' L' j ++ let _ : ++ Finite ++ (H'.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H' J' hJ'H') := ++ numberFieldEmbeddedExtensionQuotient_finite K' L' j ++ let hHH'finite := ++ numberFieldEmbeddedBaseChangeExtensionQuotientFinite K K' L L' j ++ let T : ++ FiniteAbstractFieldExtension ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) := ++ { field := numberFieldEmbeddedFiniteAbstractField K' L' j ++ base := numberFieldEmbeddedFiniteAbstractField K L jLower ++ below := hH'H ++ finiteQuotient := hHH'finite } ++ let hTBaseNormal : ++ (CyclicCohomology.extensionSubgroup ++ T.base.field J hJH).Normal := by ++ change ++ (CyclicCohomology.extensionSubgroup H J hJH).Normal ++ exact numberFieldEmbeddedExtensionSubgroup_normal K L jLower ++ let hTBaseFinite : ++ Finite ++ (T.base.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ T.base.field J hJH) := by ++ change ++ Finite ++ (H.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H J hJH) ++ exact numberFieldEmbeddedExtensionQuotient_finite K L jLower ++ let hTFieldNormal : ++ (CyclicCohomology.extensionSubgroup ++ T.field.field J' hJ'H').Normal := by ++ change ++ (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal ++ exact numberFieldEmbeddedExtensionSubgroup_normal K' L' j ++ let hTFieldFinite : ++ Finite ++ (T.field.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ T.field.field J' hJ'H') := by ++ change ++ Finite ++ (H'.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H' J' hJ'H') ++ exact numberFieldEmbeddedExtensionQuotient_finite K' L' j ++ let restrictActual : ++ Gal(L' / K') →* Gal(L / K) := ++ (AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K) ++ apply MonoidHom.ext ++ intro c ++ let a := ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K' L' j (Additive.ofMul c) ++ have hnat := ++ DegreeData.normResidueNaturality_norm_restriction ++ (D := rationalCyclotomicDegreeData) ++ (A := rationalIdeleClassRepresentation) ++ (v := rationalCyclotomicIdeleClassValuationData) ++ (hcf := rationalIdeleClassRepresentation_satisfiesClassFieldAxiom) ++ (T := T) (L := J) (L' := J') ++ (hLnormal := hTBaseNormal) ++ (hL'normal := hTFieldNormal) ++ (hLKfinite := hTBaseFinite) ++ (hL'K'finite := hTFieldFinite) ++ hJH hJ'H' hJ'J ++ have hnatc := ++ DFunLike.congr_fun hnat ++ (finiteNormClass rationalIdeleClassRepresentation ++ H' J' hJ'H' a) ++ change _ = ++ rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ T.base ++ { field := J ++ below := hJH ++ normal := hTBaseNormal ++ finite := hTBaseFinite } ++ (finiteReciprocityNaturalityNormMap ++ rationalIdeleClassRepresentation ++ T.base.field T.field.field J J' ++ hJH hJ'H' T.below hJ'J ++ (finiteNormClass rationalIdeleClassRepresentation ++ T.field.field J' hJ'H' a)) at hnatc ++ rw [finiteReciprocityNaturalityNormMap_finiteNormClass] ++ at hnatc ++ have hnorm : ++ relativeNorm rationalIdeleClassRepresentation ++ H H' hH'H a = ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K L jLower ++ (Additive.ofMul (_root_.ideleClassNorm K K' c)) := ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed_relativeNorm ++ K K' L L' j c ++ calc ++ restrictActual ++ (globalNormResidueMonoidHomOfEmbedding K' L' j c) = ++ restrictActual ++ (Additive.toMul ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K' L' j ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldEmbeddedFiniteAbstractField K' L' j) ++ (numberFieldEmbeddedFiniteGaloisSubextension K' L' j) ++ (finiteNormClass rationalIdeleClassRepresentation ++ H' J' hJ'H' a)))) := by ++ rw [globalNormResidueMonoidHomOfEmbedding_apply] ++ _ = ++ Additive.toMul ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L jLower ++ (MonoidHom.toAdditive ++ (normResidueNaturalityAbelianizedRestriction ++ H H' J J' hJH hJ'H' hH'H hJ'J) ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldEmbeddedFiniteAbstractField K' L' j) ++ (numberFieldEmbeddedFiniteGaloisSubextension K' L' j) ++ (finiteNormClass rationalIdeleClassRepresentation ++ H' J' hJ'H' a)))) := by ++ exact ++ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup_restriction ++ K K' L L' j _ ++ _ = ++ Additive.toMul ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L jLower ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ (numberFieldEmbeddedFiniteAbstractField K L jLower) ++ (numberFieldEmbeddedFiniteGaloisSubextension K L jLower) ++ (finiteNormClass rationalIdeleClassRepresentation ++ H J hJH ++ (relativeNorm rationalIdeleClassRepresentation ++ H H' hH'H a)))) := by ++ exact congrArg ++ (fun z => ++ Additive.toMul ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L jLower z)) ++ hnatc ++ _ = ++ globalNormResidueMonoidHomOfEmbedding K L jLower ++ (_root_.ideleClassNorm K K' c) := by ++ rw [hnorm, ++ ← globalNormResidueMonoidHomOfEmbedding_apply] ++ ++end EmbeddedNumberFieldRestriction ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerRestriction.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerRestriction.lean +new file mode 100644 +index 0000000..16ee169 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTowerRestriction.lean +@@ -0,0 +1,372 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalNormResidueNaturalityTowerBase ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++ ++section EmbeddedNumberFieldRestriction ++ ++variable ++ (K K' L L' : Type) ++ [Field K] [NumberField K] ++ [Field K'] [NumberField K'] ++ [Field L] [NumberField L] ++ [Field L'] [NumberField L'] ++ [Algebra K K'] [Algebra K L] [Algebra K L'] ++ [Algebra K' L'] [Algebra L L'] ++ [IsScalarTower K K' L'] [IsScalarTower K L L'] ++ ++attribute [local instance] ++ naturalityIdeleClassCommGroup ++ ideleClassGroupIsMulCommutative ++ ideleClassSubgroupNormal ++ numberFieldEmbeddedBaseChangeExtensionSubgroupNormal ++ numberFieldEmbeddedBaseChangeExtensionQuotientFinite ++ numberFieldEmbeddedBaseChangeBaseFixedFieldFiniteDimensional ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldFiniteDimensional ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldScalarTower ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldIsGalois ++ ++/-- In one common rational-separable-closure realization, the canonical ++quotient-to-Galois comparisons intertwine abstract restriction with ++ordinary restriction of the actual number-field automorphisms. -/ ++theorem ++ numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup_restriction ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) ++ (z : ++ Abelianization ++ (numberFieldEmbeddedFiniteGaloisSubextension ++ K' L' j).extensionQuotient) : ++ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ L L') ++ let H := ++ numberFieldEmbeddedBaseSubgroup K L jLower ++ let H' := ++ numberFieldEmbeddedBaseSubgroup K' L' j ++ let J := ++ numberFieldEmbeddedTopSubgroup K L jLower ++ let J' := ++ numberFieldEmbeddedTopSubgroup K' L' j ++ let hH'H := ++ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j ++ let hJ'J := ++ numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j ++ let hJH := ++ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K L jLower ++ let hJ'H' := ++ numberFieldEmbeddedTopSubgroup_le_baseSubgroup K' L' j ++ letI _ : ++ (CyclicCohomology.extensionSubgroup H J hJH).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal K L jLower ++ letI _ : ++ (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal K' L' j ++ ((AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K)) ++ (Additive.toMul ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K' L' j (Additive.ofMul z))) = ++ Additive.toMul ++ (numberFieldEmbeddedAbelianizedExtensionQuotientEquivGaloisGroup ++ K L jLower ++ (MonoidHom.toAdditive ++ (normResidueNaturalityAbelianizedRestriction ++ H H' J J' ++ hJH hJ'H' ++ hH'H hJ'J) ++ (Additive.ofMul z))) := by ++ dsimp only ++ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ L L') ++ let H := ++ numberFieldEmbeddedBaseSubgroup K L jLower ++ let H' := ++ numberFieldEmbeddedBaseSubgroup K' L' j ++ let J := ++ numberFieldEmbeddedTopSubgroup K L jLower ++ let J' := ++ numberFieldEmbeddedTopSubgroup K' L' j ++ let hH'H := ++ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j ++ let hJ'J := ++ numberFieldEmbeddedTopSubgroup_le_of_tower K K' L L' j ++ let hJH := ++ numberFieldEmbeddedTopSubgroup_le_baseSubgroup ++ K L jLower ++ let hJ'H' := ++ numberFieldEmbeddedTopSubgroup_le_baseSubgroup ++ K' L' j ++ let hLowerNormal : ++ (CyclicCohomology.extensionSubgroup H J hJH).Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal K L jLower ++ let hUpperNormal : ++ (CyclicCohomology.extensionSubgroup H' J' hJ'H').Normal := ++ numberFieldEmbeddedExtensionSubgroup_normal K' L' j ++ let qLower := ++ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup ++ K L jLower ++ let qUpper := ++ numberFieldEmbeddedExtensionQuotientEquivGaloisGroup ++ K' L' j ++ let qLowerRaw : ++ (H.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H J hJH) ≃* ++ Gal(L / K) := by ++ exact ++ { qLower.toEquiv with ++ map_mul' := fun x y => qLower.map_mul x y } ++ let qUpperRaw : ++ (H'.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H' J' hJ'H') ≃* ++ Gal(L' / K') := by ++ exact ++ { qUpper.toEquiv with ++ map_mul' := fun x y => qUpper.map_mul x y } ++ let restrictActual : ++ Gal(L' / K') →* Gal(L / K) := ++ (AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K) ++ obtain ⟨q, rfl⟩ := ++ QuotientGroup.mk_surjective z ++ obtain ⟨σ, rfl⟩ := ++ (numberFieldEmbeddedFiniteGaloisSubextension ++ K' L' j).extensionQuotientMk_surjective q ++ change ++ restrictActual ++ ((Abelianization.equivOfComm (H := Gal(L' / K'))).symm ++ (qUpperRaw.abelianizationCongr ++ (Abelianization.of (QuotientGroup.mk σ)))) = ++ (Abelianization.equivOfComm (H := Gal(L / K))).symm ++ (qLowerRaw.abelianizationCongr ++ (normResidueNaturalityAbelianizedRestriction ++ H H' J J' hJH hJ'H' hH'H hJ'J ++ (Abelianization.of (QuotientGroup.mk σ)))) ++ rw [normResidueNaturalityAbelianizedRestriction_of_mk, ++ abelianizationCongr_of, abelianizationCongr_of] ++ change ++ restrictActual (qUpperRaw (QuotientGroup.mk σ)) = ++ qLowerRaw ++ (QuotientGroup.mk (Subgroup.inclusion hH'H σ)) ++ apply AlgEquiv.ext ++ intro x ++ apply jLower.injective ++ let hUpperAlgebra : Algebra K' (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra K' L' j ++ let eUpper := ++ numberFieldEmbeddedSeparableClosureEquiv K' L' j ++ let hLowerAlgebra : Algebra K (SeparableClosure ℚ) := ++ numberFieldEmbeddedSeparableClosureAlgebra K L jLower ++ let eLower := ++ numberFieldEmbeddedSeparableClosureEquiv K L jLower ++ calc ++ jLower ++ (restrictActual ++ (qUpperRaw (QuotientGroup.mk σ)) x) = ++ j ++ ((qUpperRaw (QuotientGroup.mk σ)) ++ (algebraMap L L' x)) := by ++ exact congrArg j ++ (AlgEquiv.restrictNormal_commutes ++ ((AlgEquiv.restrictScalarsHom K) ++ (qUpperRaw (QuotientGroup.mk σ))) ++ L x) ++ _ = σ.1.1 ++ (j (algebraMap L L' x)) := by ++ exact ++ ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply ++ ℚ K' L' j eUpper σ (algebraMap L L' x) ++ _ = (Subgroup.inclusion hH'H σ).1.1 ++ (jLower x) := rfl ++ _ = jLower ++ (qLowerRaw ++ (QuotientGroup.mk ++ (Subgroup.inclusion hH'H σ)) x) := by ++ exact ++ (ambientEmbeddedExtensionQuotientEquivGaloisGroup_mk_apply ++ ℚ K L jLower eLower ++ (Subgroup.inclusion hH'H σ) x).symm ++ ++/-- In a compatible common embedding, the fixed-part relative norm ++between two (Galois-related) base fields is the genuine ordinary ++idele-class norm. -/ ++theorem numberFieldEmbeddedIdeleClassEquivAmbientFixed_relativeNorm ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) ++ (c : IdeleClassGroup K') : ++ let jLower : L →ₐ[ℚ] SeparableClosure ℚ := ++ j.comp (IsScalarTower.toAlgHom ℚ L L') ++ let H := ++ numberFieldEmbeddedBaseSubgroup K L jLower ++ let H' := ++ numberFieldEmbeddedBaseSubgroup K' L' j ++ let hH'H := ++ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j ++ letI _ : Finite ++ (H.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H H' hH'H) := ++ numberFieldEmbeddedBaseChangeExtensionQuotientFinite ++ K K' L L' j ++ relativeNorm rationalIdeleClassRepresentation H H' hH'H ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K' L' j (Additive.ofMul c)) = ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K L jLower ++ (Additive.ofMul (_root_.ideleClassNorm K K' c)) := by ++ intro jLower H H' ++ let hH'H := ++ numberFieldEmbeddedBaseSubgroup_le_of_tower K K' L L' j ++ let hnormal := ++ numberFieldEmbeddedBaseChangeExtensionSubgroupNormal K K' L L' j ++ let F := ++ abstractFixedField ℚ (SeparableClosure ℚ) H ++ let E := ++ abstractRelativeFixedField ℚ (SeparableClosure ℚ) hH'H ++ let _ : ++ (CyclicCohomology.extensionSubgroup H H' hH'H).Normal := ++ hnormal ++ let _ : ++ Finite ++ (H.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H H' hH'H) := ++ numberFieldEmbeddedBaseChangeExtensionQuotientFinite ++ K K' L L' j ++ let _ : ++ Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ H (le_baseField H)) := ++ numberFieldEmbeddedAbsoluteQuotientFinite K L jLower ++ let _ : NumberField F := ++ numberFieldEmbeddedAbstractFixedFieldNumberField K L jLower ++ let _ : NumberField E := ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldNumberField ++ K K' L L' j ++ let _ : FiniteDimensional ℚ (E.restrictScalars ℚ) := by ++ change FiniteDimensional ℚ E ++ exact ++ numberFieldEmbeddedBaseChangeRelativeFixedFieldAbsoluteFiniteDimensional ++ K K' L L' j ++ let _ : NumberField ++ (abstractFixedField ℚ (SeparableClosure ℚ) H') := ++ numberFieldEmbeddedAbstractFixedFieldNumberField K' L' j ++ have hE : ++ E.restrictScalars ℚ = ++ abstractFixedField ℚ (SeparableClosure ℚ) H' := ++ IntermediateField.extendScalars_restrictScalars ++ (abstractFixedField_le ++ ℚ (SeparableClosure ℚ) hH'H) ++ let eRel : ++ E ≃ₐ[ℚ] ++ abstractFixedField ℚ (SeparableClosure ℚ) H' := ++ IntermediateField.equivOfEq hE ++ let eK : ++ K ≃ₐ[ℚ] F := ++ numberFieldEmbeddedAbstractBaseFieldEquiv K L jLower ++ let eK'Base : ++ K' ≃ₐ[ℚ] ++ abstractFixedField ℚ (SeparableClosure ℚ) H' := ++ numberFieldEmbeddedAbstractBaseFieldEquiv K' L' j ++ let eK' : K' ≃ₐ[ℚ] E := ++ eK'Base.trans eRel.symm ++ have hcompat (x : K) : ++ eK' (algebraMap K K' x) = ++ algebraMap F E (eK x) := by ++ apply eRel.injective ++ apply Subtype.ext ++ change ++ j (algebraMap K' L' (algebraMap K K' x)) = ++ j (algebraMap L L' (algebraMap K L x)) ++ rw [← IsScalarTower.algebraMap_apply K K' L', ++ ← IsScalarTower.algebraMap_apply K L L'] ++ have hupper : ++ rationalAbstractRelativeFixedFieldIdeleClassEquivFixed ++ H H' hH'H ++ (Additive.ofMul (ideleClassCongr eK' c)) = ++ numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K' L' j (Additive.ofMul c) := by ++ apply Subtype.ext ++ change ++ ((rationalIdeleClassEquivFixed (E.restrictScalars ℚ)) ++ (Additive.ofMul (ideleClassCongr eK' c))).1 = ++ ((rationalIdeleClassEquivFixed ++ (abstractFixedField ℚ (SeparableClosure ℚ) H')) ++ (Additive.ofMul (ideleClassCongr eK'Base c))).1 ++ exact rationalIdeleClassEquivFixed_transport_baseEquiv_val ++ (T := K') (A := E.restrictScalars ℚ) ++ (B := abstractFixedField ℚ (SeparableClosure ℚ) H') hE eK'Base c ++ have hrelative := ++ rationalAbstractRelativeFixedFieldIdeleClassEquivFixed_relativeNorm ++ H H' hH'H hnormal ++ (Additive.ofMul (ideleClassCongr eK' c)) ++ change ++ relativeNorm rationalIdeleClassRepresentation H H' hH'H ++ (rationalAbstractRelativeFixedFieldIdeleClassEquivFixed ++ H H' hH'H ++ (Additive.ofMul (ideleClassCongr eK' c))) = ++ rationalAbstractFixedFieldIdeleClassEquivFixed H ++ (Additive.ofMul ++ (_root_.ideleClassNorm F E ++ (ideleClassCongr eK' c))) ++ at hrelative ++ calc ++ relativeNorm rationalIdeleClassRepresentation H H' hH'H ++ (numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K' L' j (Additive.ofMul c)) = ++ relativeNorm rationalIdeleClassRepresentation H H' hH'H ++ (rationalAbstractRelativeFixedFieldIdeleClassEquivFixed ++ H H' hH'H (Additive.ofMul (ideleClassCongr eK' c))) := ++ congrArg (relativeNorm rationalIdeleClassRepresentation H H' hH'H) ++ hupper.symm ++ _ = rationalAbstractFixedFieldIdeleClassEquivFixed H ++ (Additive.ofMul ++ (_root_.ideleClassNorm F E (ideleClassCongr eK' c))) := hrelative ++ _ = numberFieldEmbeddedIdeleClassEquivAmbientFixed ++ K L jLower (Additive.ofMul (_root_.ideleClassNorm K K' c)) := by ++ change ++ rationalAbstractFixedFieldIdeleClassEquivFixed H ++ (Additive.ofMul ++ (_root_.ideleClassNorm F E (ideleClassCongr eK' c))) = ++ rationalAbstractFixedFieldIdeleClassEquivFixed H ++ (Additive.ofMul ++ (ideleClassCongr eK (_root_.ideleClassNorm K K' c))) ++ apply congrArg (rationalAbstractFixedFieldIdeleClassEquivFixed H) ++ apply congrArg Additive.ofMul ++ exact ++ (ideleClassCongr_ideleClassNorm ++ (K := K) (K' := F) (L := K') (L' := E) eK eK' hcompat c).symm ++ ++ ++end EmbeddedNumberFieldRestriction ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTransports.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTransports.lean +new file mode 100644 +index 0000000..5a39a62 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/GlobalNormResidueNaturalityTransports.lean +@@ -0,0 +1,445 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.AbstractFixedFieldGlobalNormResidue ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerAlgEquivNaturality ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open ClassFormation ++open GlobalClassFields ++open KummerTheory ++open AlgebraicNumberTheory ++open LocalClassFieldTheory ++open RamificationTheory ++ ++universe u ++ ++/-- The commutative group structure on the quotient of ideles by principal ideles. -/ ++@[instance_reducible] ++noncomputable def naturalityIdeleClassCommGroup ++ (F : Type) [Field F] [NumberField F] : CommGroup (IdeleClassGroup F) := ++ QuotientGroup.Quotient.commGroup (IdeleGroup.principalSubgroup F) ++ ++attribute [local instance] naturalityIdeleClassCommGroup ++ ++local instance ideleClassGroupIsMulCommutative ++ {F : Type} [Field F] [NumberField F] ++ : IsMulCommutative (IdeleClassGroup F) := ++ ⟨⟨fun a b => mul_comm a b⟩⟩ ++ ++local instance ideleClassSubgroupNormal ++ {F : Type} [Field F] [NumberField F] ++ (N : Subgroup (IdeleClassGroup F)) : N.Normal := ++ N.normal_of_isMulCommutative ++ ++ ++/-- Two finite Galois subextensions with the same underlying closed subgroup ++are equal; the remaining structure fields are proof-irrelevant. -/ ++private theorem finiteGaloisSubextension_eq_of_field_eq ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {K : ClosedSubgroup G} ++ (A B : FiniteGaloisSubextension K) ++ (h : A.field = B.field) : ++ A = B := by ++ cases A with ++ | mk A hA nA fA => ++ cases B with ++ | mk B hB nB fB => ++ dsimp only at h ++ cases h ++ rfl ++ ++/-- Rebase a finite Galois subextension along equality of its bundled base. ++The field equality is the only data component; the remaining fields are ++proof-irrelevant. -/ ++theorem finiteGaloisSubextension_transport_eq_of_field_eq ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {A B : FiniteAbstractField G} ++ (hAB : A = B) ++ (P : FiniteGaloisSubextension A.field) ++ (Q : FiniteGaloisSubextension B.field) ++ (hfield : P.field = Q.field) : ++ Eq.mp ++ (congrArg ++ (fun X : FiniteAbstractField G => ++ FiniteGaloisSubextension X.field) ++ hAB) ++ P = Q := by ++ cases hAB ++ exact finiteGaloisSubextension_eq_of_field_eq P Q hfield ++ ++/-- Transporting an additive equivalence between rational ambient fixed ++subgroups does not change the underlying direct-limit class. -/ ++theorem rationalAmbientFixedAddEquiv_transport_apply_val ++ {A B : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} ++ (hAB : A = B) ++ {X : Type} [AddGroup X] ++ (e : X ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) ++ (x : X) : ++ ((Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ X ≃+ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation Y.field) ++ hAB) ++ e x).1) = ++ (e x).1 := by ++ cases hAB ++ rfl ++ ++/-- Changing only the bundled subgroup of an additive subgroup element ++does not change its value in the ambient group. -/ ++private theorem addSubgroupCongr_apply_val ++ {A : Type} [AddGroup A] ++ {H K : AddSubgroup A} ++ (h : H = K) (x : H) : ++ ((AddEquiv.addSubgroupCongr h x).1 : A) = x.1 := by ++ cases h ++ rfl ++ ++/-- Transporting an idele class along a field equality and the corresponding ++algebra equivalence leaves its rational direct-limit representative fixed. -/ ++theorem rationalIdeleClassEquivFixed_congr_apply_val ++ {A B : IntermediateField ℚ (SeparableClosure ℚ)} ++ [FiniteDimensional ℚ A] [FiniteDimensional ℚ B] ++ (h : A = B) ++ (e : B ≃ₐ[ℚ] A) ++ (he : e.trans (IntermediateField.equivOfEq h) = ++ (AlgEquiv.refl : B ≃ₐ[ℚ] B)) ++ (c : Additive (IdeleClassGroup B)) : ++ ((rationalIdeleClassEquivFixed A) ++ (MulEquiv.toAdditive (ideleClassCongr e) c)).1 = ++ ((rationalIdeleClassEquivFixed B) c).1 := by ++ cases h ++ have he' : e = AlgEquiv.refl := by ++ apply AlgEquiv.ext ++ intro x ++ have hx := DFunLike.congr_fun he x ++ change e x = x at hx ++ exact hx ++ rw [he'] ++ have hc : ++ MulEquiv.toAdditive ++ (ideleClassCongr (AlgEquiv.refl : A ≃ₐ[ℚ] A)) c = c := by ++ cases c with ++ | ofMul c => ++ exact congrArg Additive.ofMul (ideleClassCongr_refl c) ++ rw [hc] ++ ++/-- Transporting the target intermediate field of a base-field equivalence ++preserves its rational fixed-part representative. -/ ++theorem rationalIdeleClassEquivFixed_transport_baseEquiv_val ++ {T : Type} [Field T] [NumberField T] ++ {A B : IntermediateField ℚ (SeparableClosure ℚ)} ++ [FiniteDimensional ℚ A] [FiniteDimensional ℚ B] ++ (h : A = B) (e : T ≃ₐ[ℚ] B) ++ (c : IdeleClassGroup T) : ++ ((rationalIdeleClassEquivFixed A) ++ (Additive.ofMul ++ (ideleClassCongr (K := T) (M := A) ++ (e.trans (IntermediateField.equivOfEq h).symm) c))).1 = ++ ((rationalIdeleClassEquivFixed B) ++ (Additive.ofMul (ideleClassCongr (K := T) (M := B) e c))).1 := by ++ cases h ++ have he : ++ e.trans (IntermediateField.equivOfEq (rfl : A = A)).symm = e := by ++ ext x ++ rfl ++ rw [he] ++ ++/-- Equality of the lower and upper closed subgroups transports the raw ++extension quotient without exposing dependent rewrites to clients. -/ ++def extensionQuotientMulEquivOfEq ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {H H' J J' : ClosedSubgroup G} ++ (hH : H = H') (hJ : J = J') ++ (hJH : J.toSubgroup ≤ H.toSubgroup) ++ (hJH' : J'.toSubgroup ≤ H'.toSubgroup) ++ [(CyclicCohomology.extensionSubgroup H J hJH).Normal] ++ [(CyclicCohomology.extensionSubgroup H' J' hJH').Normal] : ++ (H.toSubgroup ⧸ CyclicCohomology.extensionSubgroup H J hJH) ≃* ++ (H'.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup H' J' hJH') := by ++ cases hH ++ cases hJ ++ exact MulEquiv.refl _ ++ ++/-- The quotient transport sends a quotient representative to the same ++ambient group element, rebundled in the equal lower subgroup. -/ ++@[simp] ++theorem extensionQuotientMulEquivOfEq_mk ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {H H' J J' : ClosedSubgroup G} ++ (hH : H = H') (hJ : J = J') ++ (hJH : J.toSubgroup ≤ H.toSubgroup) ++ (hJH' : J'.toSubgroup ≤ H'.toSubgroup) ++ [(CyclicCohomology.extensionSubgroup H J hJH).Normal] ++ [(CyclicCohomology.extensionSubgroup H' J' hJH').Normal] ++ (σ : H.toSubgroup) : ++ extensionQuotientMulEquivOfEq hH hJ hJH hJH' ++ (QuotientGroup.mk σ) = ++ QuotientGroup.mk ++ ((MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup hH)) σ) := by ++ cases hH ++ cases hJ ++ rfl ++ ++/-- Rebundling an element along equality of closed subgroups preserves its ++underlying ambient group element. -/ ++theorem closedSubgroupCongr_apply_val ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {H H' : ClosedSubgroup G} ++ (hH : H = H') (σ : H.toSubgroup) : ++ (((MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup hH)) σ).1 : G) = σ.1 := by ++ cases hH ++ rfl ++ ++/-- Rebase an abelianized extension-quotient equivalence together with its ++finite abstract base. -/ ++def abelianizedExtensionQuotientAddEquiv_transportBase ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {A B : FiniteAbstractField G} ++ (hAB : A = B) ++ (P : FiniteGaloisSubextension A.field) ++ {X : Type} [AddGroup X] ++ (e : Additive (Abelianization P.extensionQuotient) ≃+ X) : ++ Additive ++ (Abelianization ++ (Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField G => ++ FiniteGaloisSubextension Y.field) ++ hAB) ++ P).extensionQuotient) ≃+ X := by ++ cases hAB ++ exact e ++ ++/-- Rebase an abelianized equivalence along equality of finite Galois ++subextensions over a fixed abstract base. -/ ++def abelianizedExtensionQuotientAddEquiv_transportExtension ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {K : ClosedSubgroup G} ++ {P Q : FiniteGaloisSubextension K} ++ (hPQ : P = Q) ++ {X : Type} [AddGroup X] ++ (e : Additive (Abelianization P.extensionQuotient) ≃+ X) : ++ Additive (Abelianization Q.extensionQuotient) ≃+ X := by ++ cases hPQ ++ exact e ++ ++/-- The explicit quotient equivalence induced by rebasing a finite Galois ++subextension. -/ ++def extensionQuotientMulEquiv_transportFiniteGalois ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {A B : FiniteAbstractField G} ++ (hAB : A = B) ++ (P : FiniteGaloisSubextension A.field) ++ {Q : FiniteGaloisSubextension B.field} ++ (hPQ : ++ Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField G => ++ FiniteGaloisSubextension Y.field) ++ hAB) ++ P = Q) : ++ Q.extensionQuotient ≃* P.extensionQuotient := by ++ cases hAB ++ cases hPQ ++ exact MulEquiv.refl _ ++ ++/-- Quotient rebasing sends a canonical representative to the same ambient ++group element rebundled in the old base subgroup. -/ ++@[simp] ++theorem extensionQuotientMulEquiv_transportFiniteGalois_mk ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {A B : FiniteAbstractField G} ++ (hAB : A = B) ++ (P : FiniteGaloisSubextension A.field) ++ {Q : FiniteGaloisSubextension B.field} ++ (hPQ : ++ Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField G => ++ FiniteGaloisSubextension Y.field) ++ hAB) ++ P = Q) ++ (σ : B.field.toSubgroup) : ++ extensionQuotientMulEquiv_transportFiniteGalois hAB P hPQ ++ (Q.extensionQuotientMk σ) = ++ P.extensionQuotientMk ++ ((MulEquiv.subgroupCongr ++ (congrArg ClosedSubgroup.toSubgroup ++ (congrArg FiniteAbstractField.field hAB).symm)) σ) := by ++ cases hAB ++ cases hPQ ++ rfl ++ ++/-- Abelianization commutes with simultaneous transport of the abstract base ++and its finite Galois subextension. -/ ++theorem abelianizedCanonicalEquiv_transportFiniteGalois ++ {G : Type u} [Group G] [TopologicalSpace G] ++ {A B : FiniteAbstractField G} ++ (hAB : A = B) ++ (P : FiniteGaloisSubextension A.field) ++ {Q : FiniteGaloisSubextension B.field} ++ (hPQ : ++ Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField G => ++ FiniteGaloisSubextension Y.field) ++ hAB) ++ P = Q) ++ {X : Type} [CommGroup X] ++ (e : P.extensionQuotient ≃* X) : ++ abelianizedExtensionQuotientAddEquiv_transportExtension hPQ ++ (abelianizedExtensionQuotientAddEquiv_transportBase ++ hAB P ++ (MulEquiv.toAdditive ++ (e.abelianizationCongr.trans ++ (Abelianization.equivOfComm : X ≃* Abelianization X).symm))) = ++ MulEquiv.toAdditive ++ (((extensionQuotientMulEquiv_transportFiniteGalois ++ hAB P hPQ).trans e).abelianizationCongr.trans ++ (Abelianization.equivOfComm : X ≃* Abelianization X).symm) := by ++ cases hAB ++ cases hPQ ++ rfl ++ ++ ++/-- The finite norm-residue value, transported from the rational idele-class ++representation and the abelianized extension quotient to the groups `C` and `X`. -/ ++def rationalFiniteNormResidueValue ++ (K : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ (L : FiniteGaloisSubextension K.field) ++ {C X : Type} [AddGroup C] [AddGroup X] ++ (eIdele : C ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) ++ (eGalois : Additive (Abelianization L.extensionQuotient) ≃+ X) ++ (c : C) : X := by ++ letI : ++ Finite ++ (K.field.toSubgroup ⧸ ++ CyclicCohomology.extensionSubgroup ++ K.field L.field L.below) := ++ L.finite ++ exact ++ eGalois ++ (rationalCyclotomicDegreeData.normResidueSymbol ++ rationalIdeleClassRepresentation ++ rationalCyclotomicIdeleClassValuationData ++ rationalIdeleClassRepresentation_satisfiesClassFieldAxiom ++ K L ++ (finiteNormClass rationalIdeleClassRepresentation ++ K.field L.field L.below (eIdele c))) ++ ++/-- The packaged norm-residue value is invariant under rebasing the finite ++abstract field together with all dependent data. -/ ++theorem rationalFiniteNormResidueValue_transportBase ++ {A B : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)} ++ (hAB : A = B) ++ (P : FiniteGaloisSubextension A.field) ++ {C X : Type} [AddGroup C] [AddGroup X] ++ (eIdele : C ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation A.field) ++ (eGalois : Additive (Abelianization P.extensionQuotient) ≃+ X) ++ (c : C) : ++ rationalFiniteNormResidueValue A P eIdele eGalois c = ++ rationalFiniteNormResidueValue B ++ (Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ FiniteGaloisSubextension Y.field) ++ hAB) ++ P) ++ (Eq.mp ++ (congrArg ++ (fun Y : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) => ++ C ≃+ ambientFixedAddSubgroup ++ rationalIdeleClassRepresentation Y.field) ++ hAB) ++ eIdele) ++ (abelianizedExtensionQuotientAddEquiv_transportBase ++ hAB P eGalois) ++ c := by ++ cases hAB ++ rfl ++ ++/-- The packaged norm-residue value is invariant under equality of the finite ++Galois subextension. -/ ++theorem rationalFiniteNormResidueValue_transportExtension ++ (K : FiniteAbstractField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ {P Q : FiniteGaloisSubextension K.field} ++ (hPQ : P = Q) ++ {C X : Type} [AddGroup C] [AddGroup X] ++ (eIdele : C ≃+ ++ ambientFixedAddSubgroup rationalIdeleClassRepresentation K.field) ++ (eGalois : Additive (Abelianization P.extensionQuotient) ≃+ X) ++ (c : C) : ++ rationalFiniteNormResidueValue K P eIdele eGalois c = ++ rationalFiniteNormResidueValue K Q eIdele ++ (abelianizedExtensionQuotientAddEquiv_transportExtension ++ hPQ eGalois) ++ c := by ++ cases hPQ ++ rfl ++ ++/-- Evaluation of the canonical abelianization comparison induced by a ++multiplicative equivalence into a commutative group. -/ ++theorem abelianizationCongrToComm_apply ++ {Q R : Type*} [Group Q] [CommGroup R] ++ (e : Q ≃* R) (q : Q) : ++ MulEquiv.toAdditive ++ (e.abelianizationCongr.trans ++ (Abelianization.equivOfComm : R ≃* Abelianization R).symm) ++ (Additive.ofMul (Abelianization.of q)) = ++ Additive.ofMul (e q) := by ++ apply Additive.toMul.injective ++ change ++ (Abelianization.equivOfComm : R ≃* Abelianization R).symm ++ (e.abelianizationCongr (Abelianization.of q)) = e q ++ rw [abelianizationCongr_of] ++ exact ++ (Abelianization.equivOfComm : R ≃* Abelianization R).symm_apply_apply _ ++ ++/-- Evaluation of the canonical quotient from the abelianization of a ++commutative group. -/ ++theorem commutativeAbelianizationEquiv_apply ++ {Q R : Type*} [CommGroup Q] [Group R] ++ (e : Q ≃* R) (q : Q) : ++ MulEquiv.toAdditive ++ ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm.trans e) ++ (Additive.ofMul (Abelianization.of q)) = ++ Additive.ofMul (e q) := by ++ apply Additive.toMul.injective ++ change ++ e ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm ++ (Abelianization.of q)) = e q ++ exact congrArg e ++ ((Abelianization.equivOfComm : Q ≃* Abelianization Q).symm_apply_apply q) ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitAbstractFixedField.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitAbstractFixedField.lean +index 08f2620..a101f78 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitAbstractFixedField.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitAbstractFixedField.lean +@@ -7,6 +7,7 @@ Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.IdeleClassDirectLimitFixedPoints + import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.AbstractFixedFieldNorm + ++ + set_option autoImplicit false + + /-! +@@ -202,7 +203,7 @@ theorem rationalIdeleClassEquivBaseFixed_coe + E (RelativeIdeleGroup.classInclusion ℚ E c)) + exact Eq.trans h0 (Eq.trans h1 (Eq.trans h2 (Eq.trans h3 h4))) + +-private noncomputable instance ++private noncomputable instance abstractFixedFieldNumberField + (K : ClosedSubgroup + (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) + [hfinite : Finite +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitCore.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitCore.lean +index 870927a..7f759bc 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitCore.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/IdeleClassDirectLimitCore.lean +@@ -9,6 +9,7 @@ import GaloisCohomology.Cyclic.NormKernelVanishing + import Mathlib.Algebra.Colimit.DirectLimit + import Mathlib.FieldTheory.Galois.Profinite + ++ + set_option autoImplicit false + + /-! +@@ -107,19 +108,19 @@ noncomputable instance rationalFiniteGaloisIdeleClassMulDistribMulAction + (RelativeIdeleGroup.ClassGroup ℚ E) := + rationalAbsoluteGaloisIdeleClassAction E + +-private instance ++private instance classGroupMonoid + (E : FiniteGaloisIntermediateField ℚ (SeparableClosure ℚ)) : + Monoid (RelativeIdeleGroup.ClassGroup ℚ E) := + inferInstance + +-private noncomputable instance : ++private noncomputable instance actionFamily : + ∀ E : FiniteGaloisIntermediateField ℚ (SeparableClosure ℚ), + MulDistribMulAction + (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) + (RelativeIdeleGroup.ClassGroup ℚ E) := + fun E => rationalAbsoluteGaloisIdeleClassAction E + +-private noncomputable instance : ++private noncomputable instance smulFamily : + ∀ E : FiniteGaloisIntermediateField ℚ (SeparableClosure ℚ), + SMul + (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ) +@@ -366,7 +367,7 @@ theorem rationalRelativeIdeleClassEmbedding_comp + (rationalRelativeAdeleEmbedding_comp hEF hFH + (a : RelativeAdeleRing ℚ E))) + +-private noncomputable instance : ++private noncomputable instance transitionDirectedSystem : + DirectedSystem + (fun E : FiniteGaloisIntermediateField ℚ (SeparableClosure ℚ) => + RelativeIdeleGroup.ClassGroup ℚ E) +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryField.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryField.lean +index c1e5ac0..1a80072 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryField.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryField.lean +@@ -1,1901 +1,2 @@ +-/- +-Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. +-Released under Apache 2.0 license as described in the file LICENSE. +-Authors: Naganori Yamaguchi (assisted by OpenAI Codex) +--/ +- +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData +-import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm +- +-set_option autoImplicit false +- +-/-! +-# The finite p-adic auxiliary field +- +-This module realizes the simultaneous finite/cyclotomic lift as an actual +-number field and proves the subgroup and intermediate-field identities +-needed by the auxiliary-field argument. +--/ +- +-open scoped IsMulCommutative NumberField +-open AlgebraicNumberTheory IsDedekindDomain NumberField +-open IdeleGroup RelativeIdeleGroup +-open AlgebraicNumberTheory.Valuations +-open HilbertRamification +-open CyclicCohomology +-open KummerTheory ClassFormation +- +-noncomputable section +- +-namespace GlobalClassFieldTheory +-namespace Reciprocity +- +-open GlobalClassFields +- +-variable +- {K L : Type} +- [Field K] [NumberField K] +- [Field L] [NumberField L] [Algebra K L] +- [FiniteDimensional K L] [IsAbelianGalois K L] +- +-local instance (p : Nat.Primes) : Fact p.1.Prime := +- ⟨p.2⟩ +- +-attribute [local instance] +- rationalSeparableClosureAlgebra +- +-local instance finitePadicAuxiliaryExtensionNormal : +- (extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)).Normal := +- numberFieldTowerExtensionSubgroup_normal K L +- +-local instance finitePadicAuxiliaryExtensionQuotientFinite : +- Finite +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) := +- numberFieldTowerExtensionQuotient_finite K L +- +-noncomputable local instance finitePadicAuxiliaryExtensionQuotientIsMulCommutative : +- IsMulCommutative +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) := by +- let e : +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) ≃* +- Gal(L / K) := +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- exact +- { is_comm := +- ⟨fun x y => by +- apply e.injective +- rw [map_mul, map_mul] +- exact +- (inferInstance : +- IsMulCommutative (Gal(L / K))).is_comm.comm +- (e x) (e y)⟩ } +- +-/-- The concrete auxiliary fixed field attached to a simultaneous +-finite/cyclotomic lift. -/ +-noncomputable def numberFieldTowerFinitePadicCyclicFixedField +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- IntermediateField ℚ (SeparableClosure ℚ) := by +- exact +- IntermediateField.fixedField +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ).toSubgroup +- +-/-- A nonzero-degree lift produces a genuine number field: its +-concrete fixed field is finite over `ℚ`. -/ +-theorem numberFieldTowerFinitePadicCyclicFixedField_finiteDimensional +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (hτ : +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ ≠ +- 1) : +- FiniteDimensional ℚ +- (numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ) := by +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let F := +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ +- apply +- (InfiniteGalois.isOpen_iff_finite +- (K := SeparableClosure ℚ) F).1 +- change IsOpen +- (IntermediateField.fixedField S.toSubgroup).fixingSubgroup.carrier +- rw [InfiniteGalois.fixingSubgroup_fixedField S] +- exact +- numberFieldTowerFinitePadicCyclicFixedSubgroup_isOpen +- (K := K) (L := L) p τ hτ +- +-/-- The compatible embedded copy of `K` lies in every auxiliary +-cyclic fixed field. -/ +-theorem numberFieldTowerBaseField_le_finitePadicCyclicFixedField +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- numberFieldTowerBaseField K L ≤ +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ := by +- intro x hx +- change x ∈ IntermediateField.fixedField +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ).toSubgroup +- rw [IntermediateField.mem_fixedField_iff] +- intro σ hσ +- change +- σ ∈ +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ).toSubgroup at hσ +- obtain ⟨u, hu, rfl⟩ := hσ +- exact +- (IntermediateField.mem_fixingSubgroup_iff +- (numberFieldTowerBaseField K L) u.1).1 u.2 x hx +- +-/-- The compatible embedding of the original base field into the +-genuine auxiliary fixed field. -/ +-noncomputable def numberFieldTowerFinitePadicAuxiliaryBaseEmbedding +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- K →ₐ[ℚ] +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ) := by +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ) +- exact +- (numberFieldTowerLowerEmbedding K L).codRestrict F.toSubalgebra +- (fun x => +- numberFieldTowerBaseField_le_finitePadicCyclicFixedField +- (K := K) (L := L) p τ ⟨x, rfl⟩) +- +-/-- Coercing the auxiliary base embedding recovers the fixed lower embedding +-into the rational separable closure. -/ +-@[simp] +-theorem numberFieldTowerFinitePadicAuxiliaryBaseEmbedding_coe +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (x : K) : +- ((numberFieldTowerFinitePadicAuxiliaryBaseEmbedding +- (K := K) (L := L) p τ x : +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ)) : +- SeparableClosure ℚ) = +- numberFieldTowerLowerEmbedding K L x := by +- rfl +- +-/-- The compatible copy of the original top field lies in the +-auxiliary compositum fixed field. -/ +-theorem numberFieldTowerTopField_mem_finitePadicAuxiliaryTopField +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- {x : SeparableClosure ℚ} +- (hx : x ∈ numberFieldInRationalSeparableClosure L) : +- x ∈ +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below := by +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let T := +- numberFieldTowerTopSubgroup L +- change x ∈ IntermediateField.fixedField +- (S.toSubgroup ⊓ T.toSubgroup) +- rw [IntermediateField.mem_fixedField_iff] +- intro σ hσ +- have hσT : σ ∈ T.toSubgroup := +- hσ.2 +- change +- σ ∈ +- (numberFieldInRationalSeparableClosure L).fixingSubgroup +- at hσT +- exact +- (IntermediateField.mem_fixingSubgroup_iff +- (numberFieldInRationalSeparableClosure L) σ).1 +- hσT x hx +- +-/-- The compatible embedding of the original top field into the +-auxiliary compositum fixed field. -/ +-noncomputable def numberFieldTowerFinitePadicAuxiliaryTopEmbedding +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- L →ₐ[ℚ] +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below := by +- let E := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below +- exact +- (numberFieldSeparableClosureEmbedding L).codRestrict +- (E.restrictScalars ℚ).toSubalgebra +- (fun x => +- numberFieldTowerTopField_mem_finitePadicAuxiliaryTopField +- (K := K) (L := L) p τ ⟨x, rfl⟩) +- +-/-- Coercing the auxiliary top embedding recovers the chosen top-field +-embedding into the rational separable closure. -/ +-@[simp] +-theorem numberFieldTowerFinitePadicAuxiliaryTopEmbedding_coe +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (x : L) : +- ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding +- (K := K) (L := L) p τ x : +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) : +- SeparableClosure ℚ) = +- numberFieldSeparableClosureEmbedding L x := by +- rfl +- +-/-- The compatible base and top embeddings form the actual +-base-change square inside the rational separable closure. -/ +-theorem numberFieldTowerFinitePadicAuxiliaryEmbedding_algebraMap +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (x : K) : +- ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding +- (K := K) (L := L) p τ (algebraMap K L x) : +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) : +- SeparableClosure ℚ) = +- ((numberFieldTowerFinitePadicAuxiliaryBaseEmbedding +- (K := K) (L := L) p τ x : +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ)) : +- SeparableClosure ℚ) := by +- rfl +- +-noncomputable instance +- numberFieldTowerFinitePadicAuxiliary_baseAlgebra +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- Algebra K +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ)) := by +- exact +- (numberFieldTowerFinitePadicAuxiliaryBaseEmbedding +- (K := K) (L := L) p τ).toRingHom.toAlgebra +- +-instance +- numberFieldTowerFinitePadicAuxiliary_baseRatScalarTower +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- IsScalarTower ℚ K +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ)) := by +- exact +- IsScalarTower.of_algebraMap_eq' +- (numberFieldTowerFinitePadicAuxiliaryBaseEmbedding +- (K := K) (L := L) p τ).comp_algebraMap.symm +- +-noncomputable instance +- numberFieldTowerFinitePadicAuxiliary_topAlgebra +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- Algebra L +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) := by +- exact +- (numberFieldTowerFinitePadicAuxiliaryTopEmbedding +- (K := K) (L := L) p τ).toRingHom.toAlgebra +- +-instance +- numberFieldTowerFinitePadicAuxiliary_topRatScalarTower +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- IsScalarTower ℚ L +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) := by +- exact +- IsScalarTower.of_algebraMap_eq' +- (numberFieldTowerFinitePadicAuxiliaryTopEmbedding +- (K := K) (L := L) p τ).comp_algebraMap.symm +- +-noncomputable instance +- numberFieldTowerFinitePadicAuxiliary_originalBaseTopAlgebra +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- Algebra K +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) := by +- exact +- ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding +- (K := K) (L := L) p τ).comp +- (IsScalarTower.toAlgHom ℚ K L)).toRingHom.toAlgebra +- +-instance +- numberFieldTowerFinitePadicAuxiliary_originalTopScalarTower +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- IsScalarTower K L +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) := by +- exact IsScalarTower.of_algebraMap_eq' rfl +- +-instance +- numberFieldTowerFinitePadicAuxiliary_baseTopScalarTower +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- IsScalarTower K +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ)) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) := by +- apply IsScalarTower.of_algebraMap_eq' +- apply RingHom.ext +- intro x +- apply Subtype.ext +- exact +- numberFieldTowerFinitePadicAuxiliaryEmbedding_algebraMap +- (K := K) (L := L) p τ x +- +-/-- The genuine auxiliary fixed field is Galois over the original +-base field through the compatible embedding above. -/ +-theorem numberFieldTowerFinitePadicAuxiliaryBase_isGalois +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- IsGalois K +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ)) := by +- let H := +- numberFieldTowerBaseSubgroup K L +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let hSH := +- numberFieldTowerFinitePadicCyclicFixedSubgroup_le_baseSubgroup +- (K := K) (L := L) p τ +- let B := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) H +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S +- let FB := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hSH +- let auxiliaryBaseAlgebra : Algebra B FB := +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) hSH).algebra +- let auxiliaryBaseGalois : IsGalois B FB := +- LocalClassFieldTheory.abstractRelativeFixedField_isGalois +- ℚ (SeparableClosure ℚ) H S hSH +- (numberFieldTowerFinitePadicCyclicFixedSubgroup_extension_normal +- (K := K) (L := L) p τ) +- let eK := +- numberFieldTowerAbstractBaseFieldEquiv K L +- refine +- @IsGalois.of_equiv_equiv +- B FB _ _ auxiliaryBaseAlgebra +- K F _ _ +- (numberFieldTowerFinitePadicAuxiliary_baseAlgebra +- (K := K) (L := L) p τ) +- auxiliaryBaseGalois +- eK.symm.toRingEquiv (RingEquiv.refl F) ?_ +- apply RingHom.ext +- intro x +- apply Subtype.ext +- change +- ((eK (eK.symm x) : B) : SeparableClosure ℚ) = +- (x : SeparableClosure ℚ) +- exact +- congrArg Subtype.val (eK.apply_symm_apply x) +- +-/-- The distinguished absolute lift, regarded as an element of the +-auxiliary base subgroup. -/ +-noncomputable def numberFieldTowerFinitePadicAuxiliarySubgroupLift +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ).toSubgroup := +- ⟨τ.1, +- numberFieldTowerFinitePadicCyclicFixedSubgroup_generator_mem +- (K := K) (L := L) p τ⟩ +- +-/-- The actual automorphism of the auxiliary compositum induced by +-the distinguished simultaneous finite/cyclotomic lift. -/ +-noncomputable def numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- let P := +- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- Gal( +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below / +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S) := by +- dsimp only +- let P := +- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let σS := +- numberFieldTowerFinitePadicAuxiliarySubgroupLift +- (K := K) (L := L) p τ +- exact +- LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup +- ℚ (SeparableClosure ℚ) +- S P.field P.below +- P.toFiniteGaloisExtension.normal +- (QuotientGroup.mk' +- (extensionSubgroup +- S P.field P.below) +- σS) +- +-/-- On the common separable closure, the auxiliary automorphism acts +-by the original distinguished ambient lift. -/ +-theorem numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (x : +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) : +- ((numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ x : +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) : +- SeparableClosure ℚ) = +- τ.1 (x : SeparableClosure ℚ) := by +- let P := +- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let σS := +- numberFieldTowerFinitePadicAuxiliarySubgroupLift +- (K := K) (L := L) p τ +- exact +- (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup_mk_apply_val +- ℚ (SeparableClosure ℚ) +- S P.field P.below +- P.toFiniteGaloisExtension.normal σS x).symm +- +-/-- Restricting the auxiliary automorphism through the actual +-base-change square recovers the finite quotient coordinate of the +-distinguished lift. -/ +-theorem numberFieldTowerFinitePadicAuxiliaryAutomorphism_restriction +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- ((AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K)) +- (numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ) = +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) := by +- let E := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below +- let σE := +- numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ +- apply AlgEquiv.ext +- intro x +- apply (numberFieldSeparableClosureEmbedding L).injective +- calc +- numberFieldSeparableClosureEmbedding L +- (((AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K)) σE x) = +- ((σE (algebraMap L E x) : E) : +- SeparableClosure ℚ) := by +- exact congrArg Subtype.val +- (AlgEquiv.restrictNormal_commutes +- ((AlgEquiv.restrictScalarsHom K) σE) L x) +- _ = τ.1 (numberFieldSeparableClosureEmbedding L x) := by +- rw [ +- numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val +- (K := K) (L := L) p τ] +- rfl +- _ = +- numberFieldSeparableClosureEmbedding L +- (numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) x) := by +- exact +- (numberFieldTowerExtensionQuotientEquivGaloisGroup_mk_apply +- (K := K) (L := L) τ x).symm +- +-/-- Restriction of the chosen separable-closure place to the genuine +-auxiliary base field. This is an exact extension of the original +-finite place of `K`, not merely an equivalent valuation. -/ +-noncomputable def +- numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- AbsoluteValueExtension +- (NumberField.HeightOneSpectrum.adicAbv K v) +- (LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ)) := by +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ) +- let wΩ := +- numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v (chosenFinitePlaceExtension (L := L) v) +- refine +- ⟨wΩ.1.comp (f := F.val.toRingHom) F.val.injective, ?_⟩ +- intro x +- change +- wΩ.1 (numberFieldTowerLowerEmbedding K L x) = +- NumberField.HeightOneSpectrum.adicAbv K v x +- exact wΩ.2 x +- +-/-- Restriction of the same separable-closure place to the genuine +-auxiliary compositum. Its restriction to `K` agrees exactly with the +-original normalized finite absolute value. -/ +-noncomputable def +- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- AbsoluteValueExtension +- (NumberField.HeightOneSpectrum.adicAbv K v) +- (LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) := by +- let E := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below +- let wΩ := +- numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v (chosenFinitePlaceExtension (L := L) v) +- refine +- ⟨wΩ.1.comp (f := E.val.toRingHom) E.val.injective, ?_⟩ +- intro x +- change +- wΩ.1 (numberFieldTowerLowerEmbedding K L x) = +- NumberField.HeightOneSpectrum.adicAbv K v x +- exact wΩ.2 x +- +-/-- The centre of the restricted place on the auxiliary compositum +-lies above the centre of the same place on the auxiliary base field. -/ +-theorem +- numberFieldTowerFinitePadicAuxiliaryTopPlace_below +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (hτ : +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ ≠ +- 1) : +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let P := +- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S +- let E := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- letI hHfinite : Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- S (le_baseField S)) := +- (numberFieldTowerFinitePadicAuxiliaryAbstractField +- (K := K) (L := L) p τ hτ).finite +- letI hPfinite : Finite +- (S.toSubgroup ⧸ +- extensionSubgroup S P.field P.below) := +- P.finite +- letI _ : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) S hHfinite +- letI _ : FiniteDimensional F E := +- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) +- S P.field P.below hHfinite hPfinite +- letI _ : IsScalarTower ℚ F E := +- IsScalarTower.of_algebraMap_eq' rfl +- letI _ : FiniteDimensional ℚ E := +- FiniteDimensional.trans ℚ F E +- letI _ : NumberField F := +- NumberField.of_module_finite ℚ F +- letI _ : NumberField E := +- NumberField.of_module_finite ℚ E +- letI _ : Algebra K F := +- numberFieldTowerFinitePadicAuxiliary_baseAlgebra +- (K := K) (L := L) p τ +- finitePlaceBelow (K := F) +- (finitePlaceExtensionCentre +- (K := K) (L := E) v +- (numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (K := K) (L := L) v p τ)) = +- finitePlaceExtensionCentre +- (K := K) (L := F) v +- (numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension +- (K := K) (L := L) v p τ) := by +- dsimp only +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let P := +- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S +- let E := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let hHfinite : Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- S (le_baseField S)) := +- (numberFieldTowerFinitePadicAuxiliaryAbstractField +- (K := K) (L := L) p τ hτ).finite +- let hPfinite : Finite +- (S.toSubgroup ⧸ +- extensionSubgroup S P.field P.below) := +- P.finite +- let auxiliaryBaseFiniteDimensional : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) S hHfinite +- let auxiliaryTopFiniteDimensional : FiniteDimensional F E := +- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) +- S P.field P.below hHfinite hPfinite +- let auxiliaryScalarTower : IsScalarTower ℚ F E := +- IsScalarTower.of_algebraMap_eq' rfl +- let auxiliaryAbsoluteFiniteDimensional : FiniteDimensional ℚ E := +- FiniteDimensional.trans ℚ F E +- let auxiliaryBaseNumberField : NumberField F := +- NumberField.of_module_finite ℚ F +- let auxiliaryTopNumberField : NumberField E := +- NumberField.of_module_finite ℚ E +- let auxiliaryOriginalBaseAlgebra : Algebra K F := +- numberFieldTowerFinitePadicAuxiliary_baseAlgebra +- (K := K) (L := L) p τ +- let wF := +- numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension +- (K := K) (L := L) v p τ +- let wE := +- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (K := K) (L := L) v p τ +- apply HeightOneSpectrum.ext +- ext x +- change +- algebraMap (𝓞 F) (𝓞 E) x ∈ +- finitePlaceExtensionCentreIdeal +- (K := K) (L := E) v wE ↔ +- x ∈ +- finitePlaceExtensionCentreIdeal +- (K := K) (L := F) v wF +- rw [ +- mem_finitePlaceExtensionCentreIdeal_iff, +- mem_finitePlaceExtensionCentreIdeal_iff] +- rfl +- +-/-- Evaluation of the distinguished auxiliary automorphism through the +-restricted top-field place. Isolating this coercion calculation prevents the +-whole decomposition-group proof from normalizing the fixed-field tower. -/ +-private opaque +- numberFieldTowerFinitePadicAuxiliaryTopPlace_automorphism_apply +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : +- let P := numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let E := LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (K := K) (L := L) v p τ +- let σE := numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ +- ∀ x : E, +- wE.1 (σE x) = +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v (chosenFinitePlaceExtension (L := L) v)).1 +- (τ.1 (x : SeparableClosure ℚ)) := by +- let : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- dsimp only +- intro x +- change +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v (chosenFinitePlaceExtension (L := L) v)).1 +- ((numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ x : +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) +- (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ).below) : SeparableClosure ℚ) = _ +- rw [ +- numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val +- (K := K) (L := L) p τ] +- +-/-- The distinguished auxiliary automorphism preserves the top-field place +-obtained by restricting the original separable-closure place. -/ +-private opaque numberFieldTowerFinitePadicAuxiliaryAutomorphism_mem_topPlaceDecomposition +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (hdecomposition : +- letI : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ +- absoluteValueDecompositionGroup K +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v (chosenFinitePlaceExtension (L := L) v)).1) : +- let S := numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let F := LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S +- let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (K := K) (L := L) v p τ +- let σE := numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ +- σE ∈ absoluteValueDecompositionGroup F wE.1 := by +- let : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- dsimp only at hdecomposition ⊢ +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S +- let wE := +- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (K := K) (L := L) v p τ +- let σE := +- numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ +- intro x +- change +- wE.1 (σE x) < 1 ↔ +- wE.1 x < 1 +- rw [ +- numberFieldTowerFinitePadicAuxiliaryTopPlace_automorphism_apply +- (K := K) (L := L) v p τ x, +- show +- wE.1 x = +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v +- (chosenFinitePlaceExtension (L := L) v)).1 +- (x : SeparableClosure ℚ) from rfl] +- exact hdecomposition (x : SeparableClosure ℚ) +- +-/-- The restricted top-field place and the chosen extension above its centre +-have the same decomposition group. -/ +-private opaque numberFieldTowerFinitePadicAuxiliaryTopDecompositionGroup_eq_chosen +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (hτ : +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ ≠ 1) : +- let S := numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let P := numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let F := LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S +- let E := LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- letI hHfinite : Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- S (le_baseField S)) := +- (numberFieldTowerFinitePadicAuxiliaryAbstractField +- (K := K) (L := L) p τ hτ).finite +- letI hPfinite : Finite +- (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := P.finite +- letI : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) S hHfinite +- letI : FiniteDimensional F E := +- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) S P.field P.below hHfinite hPfinite +- letI : IsScalarTower ℚ F E := IsScalarTower.of_algebraMap_eq' rfl +- letI : FiniteDimensional ℚ E := FiniteDimensional.trans ℚ F E +- letI : NumberField F := NumberField.of_module_finite ℚ F +- letI : NumberField E := NumberField.of_module_finite ℚ E +- letI : IsAbelianGalois F E := +- GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P +- letI : Algebra K F := +- numberFieldTowerFinitePadicAuxiliary_baseAlgebra +- (K := K) (L := L) p τ +- let wF := numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension +- (K := K) (L := L) v p τ +- let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (K := K) (L := L) v p τ +- let V := finitePlaceExtensionCentre (K := K) (L := F) v wF +- absoluteValueDecompositionGroup F wE.1 = +- absoluteValueDecompositionGroup F +- (chosenFinitePlaceExtension (L := E) V).1 := by +- dsimp only +- let H := +- numberFieldTowerFinitePadicAuxiliaryAbstractField +- (K := K) (L := L) p τ hτ +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let P := +- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S +- let E := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- let hHfinite : Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- S (le_baseField S)) := +- H.finite +- let hPfinite : Finite +- (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := +- P.finite +- let : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) S hHfinite +- let : FiniteDimensional F E := +- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) S P.field P.below hHfinite hPfinite +- let : IsScalarTower ℚ F E := IsScalarTower.of_algebraMap_eq' rfl +- let : FiniteDimensional ℚ E := FiniteDimensional.trans ℚ F E +- let : NumberField F := NumberField.of_module_finite ℚ F +- let : NumberField E := NumberField.of_module_finite ℚ E +- let : IsAbelianGalois F E := +- GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P +- let : Algebra K F := +- numberFieldTowerFinitePadicAuxiliary_baseAlgebra +- (K := K) (L := L) p τ +- let wF := +- numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension +- (K := K) (L := L) v p τ +- let wE := +- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (K := K) (L := L) v p τ +- let V := finitePlaceExtensionCentre (K := K) (L := F) v wF +- let W := finitePlaceExtensionCentre (K := K) (L := E) v wE +- let Wover : +- {W' : HeightOneSpectrum (𝓞 E) // +- finitePlaceBelow (K := F) W' = V} := +- ⟨W, +- numberFieldTowerFinitePadicAuxiliaryTopPlace_below +- (K := K) (L := L) v p τ hτ⟩ +- let wFE : +- AbsoluteValueExtension +- (NumberField.HeightOneSpectrum.adicAbv F V) E := +- (finitePlaceExtensionEquivAbove +- (K := F) (L := E) V).symm Wover +- have hwFEcentre : +- finitePlaceExtensionCentre +- (K := F) (L := E) V wFE = +- W := by +- exact +- congrArg Subtype.val +- ((finitePlaceExtensionEquivAbove +- (K := F) (L := E) V).apply_symm_apply Wover) +- have hwEquiv : wE.1.IsEquiv wFE.1 := by +- apply +- finitePlaceExtensions_isEquiv_of_centres_eq +- (F := K) (M := F) v V wE wFE +- exact hwFEcentre.symm +- calc +- absoluteValueDecompositionGroup F wE.1 = +- absoluteValueDecompositionGroup F wFE.1 := +- absoluteValueDecompositionGroup_eq_of_absoluteValue_isEquiv +- (F := F) wE.1 wFE.1 hwEquiv +- _ = +- absoluteValueDecompositionGroup F +- (chosenFinitePlaceExtension (L := E) V).1 := +- absoluteValueDecompositionGroup_eq_of_exactExtensions_of_isMulCommutative +- (F := F) +- (NumberField.HeightOneSpectrum.adicAbv F V) +- (RayClass.adicAbv_isNontrivial V) +- wFE +- (chosenFinitePlaceExtension (L := E) V) +- +-/-- Pointwise form of norm/restriction naturality. Keeping the function +-equality and its coercion normalization in this small declaration prevents +-the auxiliary-field witness construction below from repeatedly elaborating +-the full pair of composite homomorphisms. -/ +-private theorem globalNormResidueMonoidHomOfEmbedding_norm_restriction_apply +- (K K' L L' : Type) +- [Field K] [NumberField K] +- [Field K'] [NumberField K'] +- [Field L] [NumberField L] +- [Field L'] [NumberField L'] +- [Algebra K K'] [Algebra K L] [Algebra K L'] +- [Algebra K' L'] [Algebra L L'] +- [IsScalarTower K K' L'] [IsScalarTower K L L'] +- [FiniteDimensional K L] [IsAbelianGalois K L] +- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] +- [FiniteDimensional K K'] [IsGalois K K'] +- (j : L' →ₐ[ℚ] SeparableClosure ℚ) +- (c : IdeleClassGroup K') : +- ((AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K)) +- (globalNormResidueMonoidHomOfEmbedding K' L' j c) = +- globalNormResidueMonoidHomOfEmbedding K L +- (j.comp (IsScalarTower.toAlgHom ℚ L L')) +- (_root_.ideleClassNorm K K' c) := by +- exact +- DFunLike.congr_fun +- (globalNormResidueMonoidHomOfEmbedding_norm_restriction +- (K := K) (L := L) (K' := K') (L' := L') j) c +- +- +- +-/-- The auxiliary-field construction produces a lower local unit +-whose chosen local Artin value and global norm-residue value are both +-the finite quotient coordinate of the distinguished lift. -/ +-opaque numberFieldTowerFinitePadicAuxiliaryLocalGlobalRepresentative +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (hτ : +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ ≠ 1) +- (hdecomposition : +- letI : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ +- absoluteValueDecompositionGroup K +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v (chosenFinitePlaceExtension (L := L) v)).1) +- (n : ℕ) (hn : 0 < n) +- (hdegree : +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ = +- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n) +- (hprimaryQuotient : +- numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ ∈ +- CommGroup.primaryComponent +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) +- p.1) : +- {z : (v.adicCompletion K)ˣ // +- chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v z = +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) ∧ +- globalNormResidueMonoidHom K L +- (IdeleGroup.finitePlaceIdeleClass v z) = +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ)} := by +- let H := +- numberFieldTowerFinitePadicAuxiliaryAbstractField +- (K := K) (L := L) p τ hτ +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let P := +- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension +- (K := K) (L := L) p τ +- let F := +- LocalClassFieldTheory.abstractFixedField +- ℚ (SeparableClosure ℚ) S +- let E := +- LocalClassFieldTheory.abstractRelativeFixedField +- ℚ (SeparableClosure ℚ) P.below +- letI hHfinite : Finite +- ((baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ +- extensionSubgroup +- (baseField +- (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) +- S (le_baseField S)) := +- H.finite +- letI hPfinite : Finite +- (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := +- P.finite +- letI auxiliaryBaseNumberField : NumberField F := by +- let : FiniteDimensional ℚ F := +- LocalClassFieldTheory.abstractFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) S hHfinite +- exact NumberField.of_module_finite ℚ F +- letI auxiliaryTopNumberField : NumberField E := by +- let : FiniteDimensional F E := +- LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional +- ℚ (SeparableClosure ℚ) +- S P.field P.below hHfinite hPfinite +- exact NumberField.of_module_finite F E +- letI auxiliaryAbelianGalois : IsAbelianGalois F E := +- GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P +- letI auxiliaryOriginalBaseAlgebra : Algebra K F := +- numberFieldTowerFinitePadicAuxiliary_baseAlgebra +- (K := K) (L := L) p τ +- letI auxiliaryOriginalTopAlgebra : Algebra L E := +- numberFieldTowerFinitePadicAuxiliary_topAlgebra +- (K := K) (L := L) p τ +- letI auxiliaryOriginalBaseTopAlgebra : Algebra K E := +- numberFieldTowerFinitePadicAuxiliary_originalBaseTopAlgebra +- (K := K) (L := L) p τ +- letI auxiliaryOriginalTopScalarTower : IsScalarTower K L E := +- numberFieldTowerFinitePadicAuxiliary_originalTopScalarTower +- (K := K) (L := L) p τ +- letI auxiliaryBaseTopScalarTower : IsScalarTower K F E := +- numberFieldTowerFinitePadicAuxiliary_baseTopScalarTower +- (K := K) (L := L) p τ +- letI auxiliaryOriginalBaseGalois : IsGalois K F := +- numberFieldTowerFinitePadicAuxiliaryBase_isGalois +- (K := K) (L := L) p τ +- let auxiliaryOriginalTopAlgHom : L →ₐ[ℚ] E := +- numberFieldTowerFinitePadicAuxiliaryTopEmbedding +- (K := K) (L := L) p τ +- let wF := +- numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension +- (K := K) (L := L) v p τ +- let wE := +- numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension +- (K := K) (L := L) v p τ +- let V := +- finitePlaceExtensionCentre +- (K := K) (L := F) v wF +- have hVbelow : finitePlaceBelow (K := K) V = v := +- finitePlaceBelow_finitePlaceExtensionCentre +- (K := K) (L := F) v wF +- let Vover : +- {V' : HeightOneSpectrum (𝓞 F) // +- finitePlaceBelow (K := K) V' = v} := +- ⟨V, hVbelow⟩ +- letI auxiliaryCompletionAlgebra : +- Algebra (v.adicCompletion K) (V.adicCompletion F) := +- (finitePlaceAdicCompletionMap K F v Vover).toAlgebra +- let σE : Gal(E / F) := +- numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ +- have hσtop : +- σE ∈ absoluteValueDecompositionGroup F wE.1 := +- numberFieldTowerFinitePadicAuxiliaryAutomorphism_mem_topPlaceDecomposition +- (K := K) (L := L) v p τ hdecomposition +- have hgroup := +- numberFieldTowerFinitePadicAuxiliaryTopDecompositionGroup_eq_chosen +- (K := K) (L := L) v p τ hτ +- have hσchosen : +- σE ∈ absoluteValueDecompositionGroup F +- (chosenFinitePlaceExtension (L := E) V).1 := by +- rw [← hgroup] +- exact hσtop +- have hRange : +- σE ∈ (chosenFinitePlaceArtinMonoidHom +- (K := F) (L := E) V).range := by +- rw [chosenFinitePlaceArtinMonoidHom_range (K := F) (L := E) V] +- exact hσchosen +- let y : (V.adicCompletion F)ˣ := Classical.choose hRange +- have hy : +- chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V y = +- numberFieldTowerFinitePadicAuxiliaryAutomorphism +- (K := K) (L := L) p τ := +- Classical.choose_spec hRange +- let z : (v.adicCompletion K)ˣ := +- LocalFieldTheory.normUnits +- (v.adicCompletion K) (V.adicCompletion F) y +- have hz : +- z = LocalFieldTheory.normUnits +- (v.adicCompletion K) (V.adicCompletion F) y := by +- rfl +- let σK : Gal(L / K) := +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) +- let restriction : Gal(E / F) →* Gal(L / K) := +- (AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K) +- have hrestrict : restriction σE = σK := +- numberFieldTowerFinitePadicAuxiliaryAutomorphism_restriction +- (K := K) (L := L) p τ +- have hlocal : +- chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v z = +- σK := by +- rw [hz] +- have hnat := +- DFunLike.congr_fun +- (chosenFinitePlaceArtinMonoidHom_norm_restriction_of_below_eq +- (K := K) (L := L) (K' := F) (L' := E) +- v V hVbelow) y +- calc +- chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v +- (LocalFieldTheory.normUnits +- (v.adicCompletion K) (V.adicCompletion F) y) = +- restriction +- (chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V y) := by +- simpa only [ +- MonoidHom.coe_comp, Function.comp_apply, restriction] +- using hnat.symm +- _ = restriction σE := congrArg restriction hy +- _ = σK := hrestrict +- let j : E →ₐ[ℚ] SeparableClosure ℚ := +- E.val.restrictScalars ℚ +- have hjLower : +- j.comp auxiliaryOriginalTopAlgHom = +- AlgebraicNumberTheory.numberFieldSeparableClosureEmbedding L := by +- apply AlgHom.ext +- intro a +- exact +- numberFieldTowerFinitePadicAuxiliaryTopEmbedding_coe +- (K := K) (L := L) p τ a +- have hPUnramified : +- P.toFiniteGaloisExtension.IsUnramified +- rationalCyclotomicDegreeData := +- numberFieldTowerFinitePadicAuxiliaryCompositumSubextension_isUnramified +- (K := K) (L := L) p τ n hn hdegree hprimaryQuotient +- have hcompat : +- (globalNormResidueMonoidHomOfEmbedding F E j).comp +- (IdeleGroup.finitePlaceIdeleClass V) = +- chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V := +- globalNormResidueMonoidHomOfEmbedding_comp_finitePlaceIdeleClass_of_abstractFixedFieldUnramified +- H P hPUnramified V +- have hupper : +- globalNormResidueMonoidHomOfEmbedding F E j +- (IdeleGroup.finitePlaceIdeleClass V y) = +- σE := +- (congrArg +- (fun φ : (V.adicCompletion F)ˣ →* Gal(E / F) => φ y) +- hcompat).trans hy +- have hnormClass : +- _root_.ideleClassNorm K F +- (IdeleGroup.finitePlaceIdeleClass V y) = +- IdeleGroup.finitePlaceIdeleClass v z := by +- rw [hz] +- simpa only [Vover] using +- (IdeleGroup.ideleClassNorm_finitePlaceIdeleClass_eq_normUnits +- (K := K) (L := F) v Vover y) +- have hglobal : +- globalNormResidueMonoidHom K L +- (IdeleGroup.finitePlaceIdeleClass v z) = +- σK := by +- calc +- globalNormResidueMonoidHom K L +- (IdeleGroup.finitePlaceIdeleClass v z) = +- globalNormResidueMonoidHom K L +- (_root_.ideleClassNorm K F +- (IdeleGroup.finitePlaceIdeleClass V y)) := +- congrArg (globalNormResidueMonoidHom K L) hnormClass.symm +- _ = globalNormResidueMonoidHomOfEmbedding K L +- (j.comp auxiliaryOriginalTopAlgHom) +- (_root_.ideleClassNorm K F +- (IdeleGroup.finitePlaceIdeleClass V y)) := by +- rw [hjLower, +- ← globalNormResidueMonoidHom_eq_ofEmbedding_standard] +- _ = ((AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K)) +- (globalNormResidueMonoidHomOfEmbedding F E j +- (IdeleGroup.finitePlaceIdeleClass V y)) := by +- apply Eq.symm +- apply +- globalNormResidueMonoidHomOfEmbedding_norm_restriction_apply +- _ = ((AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K)) σE := +- congrArg +- ((AlgEquiv.restrictNormalHom L).comp +- (AlgEquiv.restrictScalarsHom K)) hupper +- _ = restriction σE := rfl +- _ = σK := hrestrict +- exact ⟨z, hlocal, hglobal⟩ +- +- +-/-- Every genuine finite-place decomposition automorphism has a +-compatible embedded absolute lift with the same finite quotient class +-and positive integral cyclotomic `p`-adic degree. -/ +-theorem exists_numberFieldTowerFinitePadicLift_of_finitePlace +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (σ : +- absoluteValueDecompositionGroup K +- (chosenFinitePlaceExtension (L := L) v).1) : +- letI _ : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- letI _ : Algebra L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureTopAlgebra L +- letI _ : IsScalarTower K L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureScalarTower K L +- ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) = +- σ.1 ∧ +- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ +- absoluteValueDecompositionGroup K +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v +- (chosenFinitePlaceExtension (L := L) v)).1 ∧ +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ ≠ +- 1 ∧ +- ∃ n : ℕ, 0 < n ∧ +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ = +- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by +- let : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- let : Algebra L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureTopAlgebra L +- let : IsScalarTower K L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureScalarTower K L +- obtain ⟨τΩ, hτΩrestrict, n, hn, hτΩdegree⟩ := +- exists_finitePlaceSeparableClosureLift_with_positivePadicCyclotomicDegree +- (K := K) (L := L) v p σ +- let τ : +- (numberFieldTowerBaseSubgroup K L).toSubgroup := +- numberFieldTowerSeparableClosureEquivBaseSubgroup +- K L τΩ.1 +- have hfinite : +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) = +- σ.1 := by +- change +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (QuotientGroup.mk +- (numberFieldTowerSeparableClosureEquivBaseSubgroup +- K L τΩ.1)) = +- σ.1 +- rw [ +- numberFieldTowerExtensionQuotientEquivGaloisGroup_mk_baseSubgroupEquiv] +- exact congrArg Subtype.val hτΩrestrict +- have hdegree : +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ = +- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by +- exact hτΩdegree +- have hdecomposition : +- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ +- absoluteValueDecompositionGroup K +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v +- (chosenFinitePlaceExtension (L := L) v)).1 := by +- simpa only [τ, MulEquiv.symm_apply_apply] using τΩ.2 +- refine +- ⟨τ, hfinite, hdecomposition, ?_, n, hn, hdegree⟩ +- rw [hdegree] +- exact +- PadicInt.multiplicative_positiveNatDegree_ne_one +- p.1 n hn +- +-/-- Generation of the actual finite Galois group transports back +-through the compatible finite quotient coordinate. -/ +-theorem +- numberFieldTowerFiniteQuotientCoordinate_generates_of_galoisGenerator +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (σ : Gal(L / K)) +- (hτσ : +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) = +- σ) +- (hσ : Subgroup.closure ({σ} : Set (Gal(L / K))) = ⊤) : +- Subgroup.closure +- ({numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ} : +- Set +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = +- ⊤ := by +- let e := +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- let q : +- (numberFieldTowerFiniteGaloisSubextension +- K L).extensionQuotient := +- numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ +- have hq : e.toMonoidHom q = σ := by +- exact hτσ +- change +- Subgroup.closure +- ({q} : +- Set +- (numberFieldTowerFiniteGaloisSubextension +- K L).extensionQuotient) = +- ⊤ +- apply Subgroup.map_injective (f := e.toMonoidHom) e.injective +- rw [MonoidHom.map_closure, Set.image_singleton, +- hq, hσ, +- Subgroup.map_top_of_surjective e.toMonoidHom e.surjective] +- +-/-- If the finite quotient coordinate of a lift generates the whole +-finite Galois quotient, then its cyclic preimage together with the +-top-field subgroup generates the whole embedded absolute Galois +-group. -/ +-theorem +- numberFieldTowerFinitePadicCyclicPreimage_sup_extensionSubgroup_eq_top +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (hgenerate : +- Subgroup.closure +- ({numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ} : +- Set +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = +- ⊤) : +- (numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ).toSubgroup ⊔ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) = +- ⊤ := by +- let H := +- numberFieldTowerBaseSubgroup K L +- let N := +- extensionSubgroup +- H +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) +- let Q := H.toSubgroup ⧸ N +- let P := +- numberFieldTowerFinitePadicImage +- (K := K) (L := L) p +- let coordinate := +- numberFieldTowerFinitePadicCoordinate +- (K := K) (L := L) p +- let rangeRestriction := +- numberFieldTowerFinitePadicRangeRestriction +- (K := K) (L := L) p +- let γ : P.toSubgroup := +- rangeRestriction τ +- let Γ := +- ClassFormation.padicCyclicClosure γ +- let finiteProjection : +- P.toSubgroup →* +- Q := +- (MonoidHom.fst Q +- (Multiplicative ℤ_[p.1])).comp +- P.toSubgroup.subtype +- have hprojection : +- Γ.toSubgroup.map finiteProjection = ⊤ := by +- apply top_unique +- rw [← hgenerate] +- apply (Subgroup.closure_le _).2 +- intro q hq +- rw [Set.mem_singleton_iff] at hq +- subst q +- refine +- ⟨γ, +- (ClassFormation.padicCyclicClosureGenerator γ).2, +- ?_⟩ +- rfl +- have hquotientSurjective : +- ∀ q : Q, +- ∃ u : H.toSubgroup, +- u ∈ +- (numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ).toSubgroup ∧ +- numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) u = +- q := by +- intro q +- have hq : +- q ∈ Γ.toSubgroup.map finiteProjection := by +- rw [hprojection] +- trivial +- obtain ⟨z, hzΓ, hzq⟩ := hq +- obtain ⟨u, hu⟩ := +- numberFieldTowerFinitePadicRangeRestriction_surjective +- (K := K) (L := L) p z +- refine ⟨u, ?_, ?_⟩ +- · change rangeRestriction u ∈ Γ.toSubgroup +- rw [hu] +- exact hzΓ +- · calc +- numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) u = +- finiteProjection (rangeRestriction u) := rfl +- _ = finiteProjection z := congrArg finiteProjection hu +- _ = q := hzq +- apply top_unique +- intro h _ +- obtain ⟨u, huU, huq⟩ := +- hquotientSurjective +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) h) +- let k : H.toSubgroup := +- h * u⁻¹ +- have hkN : k ∈ N := by +- apply (QuotientGroup.eq_one_iff (N := N) k).mp +- change +- numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) (h * u⁻¹) = +- 1 +- rw [map_mul, map_inv, huq, mul_inv_cancel] +- have hkSup : +- k ∈ +- (numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ).toSubgroup ⊔ +- N := +- (le_sup_right : +- N ≤ +- (numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ).toSubgroup ⊔ N) hkN +- have huSup : +- u ∈ +- (numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ).toSubgroup ⊔ +- N := +- (le_sup_left : +- (numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ).toSubgroup ≤ +- (numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ).toSubgroup ⊔ N) huU +- have hku : +- k * u = h := by +- simp only [k, inv_mul_cancel_right] +- rw [← hku] +- exact +- ((numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ).toSubgroup ⊔ N).mul_mem +- hkSup huSup +- +-/-- Ambient form of the generation statement: the auxiliary cyclic +-fixed subgroup together with the subgroup fixing `L` generates the +-subgroup fixing `K`. -/ +-theorem +- numberFieldTowerFinitePadicCyclicFixedSubgroup_sup_topSubgroup +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (hgenerate : +- Subgroup.closure +- ({numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ} : +- Set +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = +- ⊤) : +- (numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ).toSubgroup ⊔ +- (numberFieldTowerTopSubgroup L).toSubgroup = +- (numberFieldTowerBaseSubgroup K L).toSubgroup := by +- let H := +- numberFieldTowerBaseSubgroup K L +- let T := +- numberFieldTowerTopSubgroup L +- let N := +- extensionSubgroup +- H T +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) +- let U := +- numberFieldTowerFinitePadicCyclicPreimage +- (K := K) (L := L) p τ +- have hrelative : +- U.toSubgroup ⊔ N = ⊤ := +- numberFieldTowerFinitePadicCyclicPreimage_sup_extensionSubgroup_eq_top +- (K := K) (L := L) p τ hgenerate +- have hNmap : +- N.map H.toSubgroup.subtype = +- T.toSubgroup := by +- exact +- Subgroup.map_subgroupOf_eq_of_le +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L) +- change +- U.toSubgroup.map H.toSubgroup.subtype ⊔ +- T.toSubgroup = +- H.toSubgroup +- rw [← hNmap, ← Subgroup.map_sup, +- hrelative, ← MonoidHom.range_eq_map, +- H.toSubgroup.range_subtype] +- +-/-- The concrete auxiliary fixed field is linearly disjoint from `L` +-over the compatible embedded copy of `K`. -/ +-theorem +- numberFieldTowerFinitePadicCyclicFixedField_inf_topField +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (hgenerate : +- Subgroup.closure +- ({numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ} : +- Set +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = +- ⊤) : +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ ⊓ +- numberFieldInRationalSeparableClosure L = +- numberFieldTowerBaseField K L := by +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let T := +- numberFieldTowerTopSubgroup L +- let H := +- numberFieldTowerBaseSubgroup K L +- change +- IntermediateField.fixedField S.toSubgroup ⊓ +- numberFieldInRationalSeparableClosure L = +- numberFieldTowerBaseField K L +- rw [ +- ← InfiniteGalois.fixedField_fixingSubgroup +- (numberFieldInRationalSeparableClosure L), +- ← InfiniteGalois.fixedField_fixingSubgroup +- (numberFieldTowerBaseField K L)] +- change +- IntermediateField.fixedField S.toSubgroup ⊓ +- IntermediateField.fixedField T.toSubgroup = +- IntermediateField.fixedField H.toSubgroup +- rw [ +- ← IntermediateField.fixedField_sup_eq_inf, +- numberFieldTowerFinitePadicCyclicFixedSubgroup_sup_topSubgroup +- (K := K) (L := L) p τ hgenerate] +- +-/-- If the finite quotient coordinate is `p`-primary, adjoining the +-actual rational `p`-primary cyclotomic field to the auxiliary fixed +-field contains the compatible copy of `L`. +- +-This is the field-theoretic conclusion of the simultaneous +-finite/cyclotomic lift: the intersection of the two fixing subgroups +-already fixes `L`, hence their fixed-field compositum contains `L`. -/ +-theorem +- numberFieldTowerTopField_le_finitePadicCyclicFixedField_sup_padicCyclotomicField +- (p : Nat.Primes) +- (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) +- (n : ℕ) (hn : 0 < n) +- (hdegree : +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ = +- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n) +- (hprimary : +- numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ ∈ +- CommGroup.primaryComponent +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) +- p.1) : +- numberFieldInRationalSeparableClosure L ≤ +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ ⊔ +- rationalCyclotomicPadicField p := by +- let S := +- numberFieldTowerFinitePadicCyclicFixedSubgroup +- (K := K) (L := L) p τ +- let T := +- numberFieldTowerTopSubgroup L +- let F := +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ +- let C : @IntermediateField ℚ (SeparableClosure ℚ) _ _ +- rationalSeparableClosureAlgebra := +- rationalCyclotomicPadicField p +- have hfixing : +- (F ⊔ C).fixingSubgroup ≤ +- T.toSubgroup := by +- change +- (IntermediateField.fixedField S.toSubgroup ⊔ C).fixingSubgroup ≤ +- T.toSubgroup +- rw [ +- IntermediateField.fixingSubgroup_sup, +- InfiniteGalois.fixingSubgroup_fixedField S] +- intro σ hσ +- apply +- numberFieldTowerFinitePadicCyclicFixedSubgroup_inf_absolutePadicKernel_le_topSubgroup +- (K := K) (L := L) p τ n hn hdegree hprimary +- refine ⟨hσ.1, ?_⟩ +- let : Algebra ℚ rationalCyclotomicZHatField := +- rationalCyclotomicZHatField.algebra' +- let : @Normal ℚ rationalCyclotomicZHatField _ _ +- rationalCyclotomicZHatField.algebra' := +- rationalCyclotomicZHatField_normal +- let E := +- rationalCyclotomicPadicFieldWithinZHat p +- change +- rationalCyclotomicPadicCoordinate p +- (rationalAbsoluteGaloisRestrictionToCyclotomicZHat σ) = +- 1 +- have hr : +- rationalAbsoluteGaloisRestrictionToCyclotomicZHat σ ∈ +- E.fixingSubgroup := by +- rw [IntermediateField.mem_fixingSubgroup_iff] +- intro x hx +- apply Subtype.ext +- have hfix : +- σ x.1 = x.1 := +- (IntermediateField.mem_fixingSubgroup_iff +- (IntermediateField.lift E) σ).1 hσ.2 x.1 +- ((IntermediateField.mem_lift x).2 hx) +- exact +- (AlgEquiv.restrictNormal_commutes +- σ rationalCyclotomicZHatField x).trans hfix +- rw [rationalCyclotomicPadicFieldWithinZHat_fixingSubgroup] +- at hr +- exact hr +- rw [ +- ← InfiniteGalois.fixedField_fixingSubgroup +- (numberFieldInRationalSeparableClosure L)] +- change +- IntermediateField.fixedField T.toSubgroup ≤ +- F ⊔ C +- rw [ +- ← InfiniteGalois.fixedField_fixingSubgroup +- (F ⊔ C)] +- exact +- IntermediateField.fixedField_le hfixing +- +-/-- For a finite-place automorphism generating `Gal(L/K)`, construct +-the genuine auxiliary number field used in the cyclotomic reduction. +- +-The field is finite over `ℚ`, contains the compatible copy of `K`, and +-has intersection with the compatible copy of `L` exactly equal to that +-copy of `K`. Its defining lift has the prescribed local restriction +-and positive integral cyclotomic `p`-adic degree. -/ +-theorem exists_finitePlaceCyclotomicAuxiliaryFixedField +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (σ : +- absoluteValueDecompositionGroup K +- (chosenFinitePlaceExtension (L := L) v).1) +- (hσ : +- Subgroup.closure +- ({σ.1} : Set (Gal(L / K))) = +- ⊤) : +- letI _ : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- letI _ : Algebra L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureTopAlgebra L +- letI _ : IsScalarTower K L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureScalarTower K L +- ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) = +- σ.1 ∧ +- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ +- absoluteValueDecompositionGroup K +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v +- (chosenFinitePlaceExtension (L := L) v)).1 ∧ +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ ≠ +- 1 ∧ +- FiniteDimensional ℚ +- (numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ) ∧ +- numberFieldTowerBaseField K L ≤ +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ ∧ +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ ⊓ +- numberFieldInRationalSeparableClosure L = +- numberFieldTowerBaseField K L ∧ +- ∃ n : ℕ, 0 < n ∧ +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ = +- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by +- let : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- let : Algebra L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureTopAlgebra L +- let : IsScalarTower K L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureScalarTower K L +- obtain +- ⟨τ, hτσ, hτdecomposition, hτdegree, +- n, hn, hdegree⟩ := +- exists_numberFieldTowerFinitePadicLift_of_finitePlace +- (K := K) (L := L) v p σ +- have hgenerate := +- numberFieldTowerFiniteQuotientCoordinate_generates_of_galoisGenerator +- (K := K) (L := L) τ σ.1 hτσ hσ +- refine +- ⟨τ, hτσ, hτdecomposition, hτdegree, +- numberFieldTowerFinitePadicCyclicFixedField_finiteDimensional +- (K := K) (L := L) p τ hτdegree, +- numberFieldTowerBaseField_le_finitePadicCyclicFixedField +- (K := K) (L := L) p τ, +- numberFieldTowerFinitePadicCyclicFixedField_inf_topField +- (K := K) (L := L) p τ hgenerate, +- n, hn, hdegree⟩ +- +-/-- A `p`-primary local generator admits a genuine auxiliary number +-field whose compositum with the rational `p`-primary cyclotomic field +-contains `L`. +- +-Besides the field containment, the construction records the two +-properties needed for descent: the auxiliary field meets `L` exactly +-in `K`, and the chosen absolute lift has positive integral +-cyclotomic degree. -/ +-theorem exists_finitePlacePrimaryCyclotomicAuxiliaryFixedField +- (v : HeightOneSpectrum (𝓞 K)) +- (p : Nat.Primes) +- (σ : +- absoluteValueDecompositionGroup K +- (chosenFinitePlaceExtension (L := L) v).1) +- (hgenerate : +- Subgroup.closure +- ({σ.1} : Set (Gal(L / K))) = +- ⊤) +- (hprimary : +- σ.1 ∈ +- CommGroup.primaryComponent +- (Gal(L / K)) p.1) : +- letI _ : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- letI _ : Algebra L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureTopAlgebra L +- letI _ : IsScalarTower K L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureScalarTower K L +- ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- (numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ) = +- σ.1 ∧ +- (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ +- absoluteValueDecompositionGroup K +- (numberFieldTowerFinitePlaceExtensionToSeparableClosure +- K L v +- (chosenFinitePlaceExtension (L := L) v)).1 ∧ +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ ≠ +- 1 ∧ +- FiniteDimensional ℚ +- (numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ) ∧ +- numberFieldTowerBaseField K L ≤ +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ ∧ +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ ⊓ +- numberFieldInRationalSeparableClosure L = +- numberFieldTowerBaseField K L ∧ +- numberFieldInRationalSeparableClosure L ≤ +- numberFieldTowerFinitePadicCyclicFixedField +- (K := K) (L := L) p τ ⊔ +- rationalCyclotomicPadicField p ∧ +- ∃ n : ℕ, 0 < n ∧ +- numberFieldTowerBaseSubgroupPadicCyclotomicDegree +- (K := K) (L := L) p τ = +- (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by +- let : Algebra K (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureBaseAlgebra K L +- let : Algebra L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureTopAlgebra L +- let : IsScalarTower K L (SeparableClosure ℚ) := +- numberFieldTowerSeparableClosureScalarTower K L +- obtain +- ⟨τ, hτσ, hτdecomposition, hτdegree, +- hfinite, hbase, hintersection, +- n, hn, hdegree⟩ := +- exists_finitePlaceCyclotomicAuxiliaryFixedField +- (K := K) (L := L) v p σ hgenerate +- have hprimaryQuotient : +- numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ ∈ +- CommGroup.primaryComponent +- ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ +- extensionSubgroup +- (numberFieldTowerBaseSubgroup K L) +- (numberFieldTowerTopSubgroup L) +- (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) +- p.1 := by +- obtain ⟨m, hm⟩ := hprimary +- refine ⟨m, ?_⟩ +- let e := +- numberFieldTowerExtensionQuotientEquivGaloisGroup K L +- let q := +- numberFieldTowerFiniteQuotientCoordinate +- (K := K) (L := L) τ +- let N : ℕ := p.1 ^ m +- have hq : e q = σ.1 := by +- exact hτσ +- have hmN : σ.1 ^ N = 1 := by +- exact hm +- change q ^ N = 1 +- apply e.injective +- calc +- e (q ^ N) = (e q) ^ N := by +- exact map_pow e q N +- _ = σ.1 ^ N := by rw [hq] +- _ = 1 := hmN +- _ = e 1 := (map_one e).symm +- have hcontainment := +- numberFieldTowerTopField_le_finitePadicCyclicFixedField_sup_padicCyclotomicField +- (K := K) (L := L) p τ n hn hdegree +- hprimaryQuotient +- exact +- ⟨τ, hτσ, hτdecomposition, hτdegree, +- hfinite, hbase, hintersection, +- hcontainment, n, hn, hdegree⟩ +- +-end Reciprocity +-end GlobalClassFieldTheory ++/- Declaration-preserving split of the original source. See the immutable source-split receipt. -/ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldExistence +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldAutomorphisms.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldAutomorphisms.lean +new file mode 100644 +index 0000000..05e27fe +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldAutomorphisms.lean +@@ -0,0 +1,593 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldBase ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open AlgebraicNumberTheory IsDedekindDomain NumberField ++open IdeleGroup RelativeIdeleGroup ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open CyclicCohomology ++open KummerTheory ClassFormation ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open GlobalClassFields ++ ++variable ++ {K L : Type} ++ [Field K] [NumberField K] ++ [Field L] [NumberField L] [Algebra K L] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ ++ ++local instance splitFactPrimeAutomorphisms (p : Nat.Primes) : Fact p.1.Prime := ⟨p.2⟩ ++ ++attribute [local instance] ++ rationalSeparableClosureAlgebra ++ finitePadicAuxiliaryExtensionNormal ++ finitePadicAuxiliaryExtensionQuotientFinite ++ finitePadicAuxiliaryExtensionQuotientIsMulCommutative ++ ++/-- The distinguished absolute lift, regarded as an element of the ++auxiliary base subgroup. -/ ++noncomputable def numberFieldTowerFinitePadicAuxiliarySubgroupLift ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ).toSubgroup := ++ ⟨τ.1, ++ numberFieldTowerFinitePadicCyclicFixedSubgroup_generator_mem ++ (K := K) (L := L) p τ⟩ ++ ++/-- The actual automorphism of the auxiliary compositum induced by ++the distinguished simultaneous finite/cyclotomic lift. -/ ++noncomputable def numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ let P := ++ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ Gal( ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below / ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S) := by ++ dsimp only ++ let P := ++ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let σS := ++ numberFieldTowerFinitePadicAuxiliarySubgroupLift ++ (K := K) (L := L) p τ ++ exact ++ LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup ++ ℚ (SeparableClosure ℚ) ++ S P.field P.below ++ P.toFiniteGaloisExtension.normal ++ (QuotientGroup.mk' ++ (extensionSubgroup ++ S P.field P.below) ++ σS) ++ ++/-- On the common separable closure, the auxiliary automorphism acts ++by the original distinguished ambient lift. -/ ++theorem numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (x : ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) : ++ ((numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ x : ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) : ++ SeparableClosure ℚ) = ++ τ.1 (x : SeparableClosure ℚ) := by ++ let P := ++ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let σS := ++ numberFieldTowerFinitePadicAuxiliarySubgroupLift ++ (K := K) (L := L) p τ ++ exact ++ (LocalClassFieldTheory.abstractExtensionQuotientEquivGaloisGroup_mk_apply_val ++ ℚ (SeparableClosure ℚ) ++ S P.field P.below ++ P.toFiniteGaloisExtension.normal σS x).symm ++ ++/-- Restricting the auxiliary automorphism through the actual ++base-change square recovers the finite quotient coordinate of the ++distinguished lift. -/ ++theorem numberFieldTowerFinitePadicAuxiliaryAutomorphism_restriction ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ ((AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K)) ++ (numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ) = ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) := by ++ let E := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below ++ let σE := ++ numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ ++ apply AlgEquiv.ext ++ intro x ++ apply (numberFieldSeparableClosureEmbedding L).injective ++ calc ++ numberFieldSeparableClosureEmbedding L ++ (((AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K)) σE x) = ++ ((σE (algebraMap L E x) : E) : ++ SeparableClosure ℚ) := by ++ exact congrArg Subtype.val ++ (AlgEquiv.restrictNormal_commutes ++ ((AlgEquiv.restrictScalarsHom K) σE) L x) ++ _ = τ.1 (numberFieldSeparableClosureEmbedding L x) := by ++ rw [ ++ numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val ++ (K := K) (L := L) p τ] ++ rfl ++ _ = ++ numberFieldSeparableClosureEmbedding L ++ (numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) x) := by ++ exact ++ (numberFieldTowerExtensionQuotientEquivGaloisGroup_mk_apply ++ (K := K) (L := L) τ x).symm ++ ++/-- Restriction of the chosen separable-closure place to the genuine ++auxiliary base field. This is an exact extension of the original ++finite place of `K`, not merely an equivalent valuation. -/ ++noncomputable def ++ numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ AbsoluteValueExtension ++ (NumberField.HeightOneSpectrum.adicAbv K v) ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ)) := by ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ) ++ let wΩ := ++ numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v (chosenFinitePlaceExtension (L := L) v) ++ refine ++ ⟨wΩ.1.comp (f := F.val.toRingHom) F.val.injective, ?_⟩ ++ intro x ++ change ++ wΩ.1 (numberFieldTowerLowerEmbedding K L x) = ++ NumberField.HeightOneSpectrum.adicAbv K v x ++ exact wΩ.2 x ++ ++/-- Restriction of the same separable-closure place to the genuine ++auxiliary compositum. Its restriction to `K` agrees exactly with the ++original normalized finite absolute value. -/ ++noncomputable def ++ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ AbsoluteValueExtension ++ (NumberField.HeightOneSpectrum.adicAbv K v) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) := by ++ let E := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below ++ let wΩ := ++ numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v (chosenFinitePlaceExtension (L := L) v) ++ refine ++ ⟨wΩ.1.comp (f := E.val.toRingHom) E.val.injective, ?_⟩ ++ intro x ++ change ++ wΩ.1 (numberFieldTowerLowerEmbedding K L x) = ++ NumberField.HeightOneSpectrum.adicAbv K v x ++ exact wΩ.2 x ++ ++/-- The centre of the restricted place on the auxiliary compositum ++lies above the centre of the same place on the auxiliary base field. -/ ++theorem ++ numberFieldTowerFinitePadicAuxiliaryTopPlace_below ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (hτ : ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ ≠ ++ 1) : ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let P := ++ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S ++ let E := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ letI hHfinite : Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ S (le_baseField S)) := ++ (numberFieldTowerFinitePadicAuxiliaryAbstractField ++ (K := K) (L := L) p τ hτ).finite ++ letI hPfinite : Finite ++ (S.toSubgroup ⧸ ++ extensionSubgroup S P.field P.below) := ++ P.finite ++ letI _ : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) S hHfinite ++ letI _ : FiniteDimensional F E := ++ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) ++ S P.field P.below hHfinite hPfinite ++ letI _ : IsScalarTower ℚ F E := ++ IsScalarTower.of_algebraMap_eq' rfl ++ letI _ : FiniteDimensional ℚ E := ++ FiniteDimensional.trans ℚ F E ++ letI _ : NumberField F := ++ NumberField.of_module_finite ℚ F ++ letI _ : NumberField E := ++ NumberField.of_module_finite ℚ E ++ letI _ : Algebra K F := ++ numberFieldTowerFinitePadicAuxiliary_baseAlgebra ++ (K := K) (L := L) p τ ++ finitePlaceBelow (K := F) ++ (finitePlaceExtensionCentre ++ (K := K) (L := E) v ++ (numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (K := K) (L := L) v p τ)) = ++ finitePlaceExtensionCentre ++ (K := K) (L := F) v ++ (numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension ++ (K := K) (L := L) v p τ) := by ++ dsimp only ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let P := ++ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S ++ let E := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let hHfinite : Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ S (le_baseField S)) := ++ (numberFieldTowerFinitePadicAuxiliaryAbstractField ++ (K := K) (L := L) p τ hτ).finite ++ let hPfinite : Finite ++ (S.toSubgroup ⧸ ++ extensionSubgroup S P.field P.below) := ++ P.finite ++ let auxiliaryBaseFiniteDimensional : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) S hHfinite ++ let auxiliaryTopFiniteDimensional : FiniteDimensional F E := ++ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) ++ S P.field P.below hHfinite hPfinite ++ let auxiliaryScalarTower : IsScalarTower ℚ F E := ++ IsScalarTower.of_algebraMap_eq' rfl ++ let auxiliaryAbsoluteFiniteDimensional : FiniteDimensional ℚ E := ++ FiniteDimensional.trans ℚ F E ++ let auxiliaryBaseNumberField : NumberField F := ++ NumberField.of_module_finite ℚ F ++ let auxiliaryTopNumberField : NumberField E := ++ NumberField.of_module_finite ℚ E ++ let auxiliaryOriginalBaseAlgebra : Algebra K F := ++ numberFieldTowerFinitePadicAuxiliary_baseAlgebra ++ (K := K) (L := L) p τ ++ let wF := ++ numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension ++ (K := K) (L := L) v p τ ++ let wE := ++ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (K := K) (L := L) v p τ ++ apply HeightOneSpectrum.ext ++ ext x ++ change ++ algebraMap (𝓞 F) (𝓞 E) x ∈ ++ finitePlaceExtensionCentreIdeal ++ (K := K) (L := E) v wE ↔ ++ x ∈ ++ finitePlaceExtensionCentreIdeal ++ (K := K) (L := F) v wF ++ rw [ ++ mem_finitePlaceExtensionCentreIdeal_iff, ++ mem_finitePlaceExtensionCentreIdeal_iff] ++ rfl ++ ++/-- Evaluation of the distinguished auxiliary automorphism through the ++restricted top-field place. Isolating this coercion calculation prevents the ++whole decomposition-group proof from normalizing the fixed-field tower. -/ ++public opaque ++ numberFieldTowerFinitePadicAuxiliaryTopPlace_automorphism_apply ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ let P := numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let E := LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (K := K) (L := L) v p τ ++ let σE := numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ ++ ∀ x : E, ++ wE.1 (σE x) = ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v (chosenFinitePlaceExtension (L := L) v)).1 ++ (τ.1 (x : SeparableClosure ℚ)) := by ++ let : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ dsimp only ++ intro x ++ change ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v (chosenFinitePlaceExtension (L := L) v)).1 ++ ((numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ x : ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) : SeparableClosure ℚ) = _ ++ rw [ ++ numberFieldTowerFinitePadicAuxiliaryAutomorphism_apply_val ++ (K := K) (L := L) p τ] ++ ++/-- The distinguished auxiliary automorphism preserves the top-field place ++obtained by restricting the original separable-closure place. -/ ++public opaque numberFieldTowerFinitePadicAuxiliaryAutomorphism_mem_topPlaceDecomposition ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (hdecomposition : ++ letI : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ ++ absoluteValueDecompositionGroup K ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v (chosenFinitePlaceExtension (L := L) v)).1) : ++ let S := numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let F := LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S ++ let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (K := K) (L := L) v p τ ++ let σE := numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ ++ σE ∈ absoluteValueDecompositionGroup F wE.1 := by ++ let : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ dsimp only at hdecomposition ⊢ ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S ++ let wE := ++ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (K := K) (L := L) v p τ ++ let σE := ++ numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ ++ intro x ++ change ++ wE.1 (σE x) < 1 ↔ ++ wE.1 x < 1 ++ rw [ ++ numberFieldTowerFinitePadicAuxiliaryTopPlace_automorphism_apply ++ (K := K) (L := L) v p τ x, ++ show ++ wE.1 x = ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v ++ (chosenFinitePlaceExtension (L := L) v)).1 ++ (x : SeparableClosure ℚ) from rfl] ++ exact hdecomposition (x : SeparableClosure ℚ) ++ ++/-- The restricted top-field place and the chosen extension above its centre ++have the same decomposition group. -/ ++public opaque numberFieldTowerFinitePadicAuxiliaryTopDecompositionGroup_eq_chosen ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (hτ : ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ ≠ 1) : ++ let S := numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let P := numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let F := LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S ++ let E := LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ letI hHfinite : Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ S (le_baseField S)) := ++ (numberFieldTowerFinitePadicAuxiliaryAbstractField ++ (K := K) (L := L) p τ hτ).finite ++ letI hPfinite : Finite ++ (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := P.finite ++ letI : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) S hHfinite ++ letI : FiniteDimensional F E := ++ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) S P.field P.below hHfinite hPfinite ++ letI : IsScalarTower ℚ F E := IsScalarTower.of_algebraMap_eq' rfl ++ letI : FiniteDimensional ℚ E := FiniteDimensional.trans ℚ F E ++ letI : NumberField F := NumberField.of_module_finite ℚ F ++ letI : NumberField E := NumberField.of_module_finite ℚ E ++ letI : IsAbelianGalois F E := ++ GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P ++ letI : Algebra K F := ++ numberFieldTowerFinitePadicAuxiliary_baseAlgebra ++ (K := K) (L := L) p τ ++ let wF := numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension ++ (K := K) (L := L) v p τ ++ let wE := numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (K := K) (L := L) v p τ ++ let V := finitePlaceExtensionCentre (K := K) (L := F) v wF ++ absoluteValueDecompositionGroup F wE.1 = ++ absoluteValueDecompositionGroup F ++ (chosenFinitePlaceExtension (L := E) V).1 := by ++ dsimp only ++ let H := ++ numberFieldTowerFinitePadicAuxiliaryAbstractField ++ (K := K) (L := L) p τ hτ ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let P := ++ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S ++ let E := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ let hHfinite : Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ S (le_baseField S)) := ++ H.finite ++ let hPfinite : Finite ++ (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := ++ P.finite ++ let : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) S hHfinite ++ let : FiniteDimensional F E := ++ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) S P.field P.below hHfinite hPfinite ++ let : IsScalarTower ℚ F E := IsScalarTower.of_algebraMap_eq' rfl ++ let : FiniteDimensional ℚ E := FiniteDimensional.trans ℚ F E ++ let : NumberField F := NumberField.of_module_finite ℚ F ++ let : NumberField E := NumberField.of_module_finite ℚ E ++ let : IsAbelianGalois F E := ++ GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P ++ let : Algebra K F := ++ numberFieldTowerFinitePadicAuxiliary_baseAlgebra ++ (K := K) (L := L) p τ ++ let wF := ++ numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension ++ (K := K) (L := L) v p τ ++ let wE := ++ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (K := K) (L := L) v p τ ++ let V := finitePlaceExtensionCentre (K := K) (L := F) v wF ++ let W := finitePlaceExtensionCentre (K := K) (L := E) v wE ++ let Wover : ++ {W' : HeightOneSpectrum (𝓞 E) // ++ finitePlaceBelow (K := F) W' = V} := ++ ⟨W, ++ numberFieldTowerFinitePadicAuxiliaryTopPlace_below ++ (K := K) (L := L) v p τ hτ⟩ ++ let wFE : ++ AbsoluteValueExtension ++ (NumberField.HeightOneSpectrum.adicAbv F V) E := ++ (finitePlaceExtensionEquivAbove ++ (K := F) (L := E) V).symm Wover ++ have hwFEcentre : ++ finitePlaceExtensionCentre ++ (K := F) (L := E) V wFE = ++ W := by ++ exact ++ congrArg Subtype.val ++ ((finitePlaceExtensionEquivAbove ++ (K := F) (L := E) V).apply_symm_apply Wover) ++ have hwEquiv : wE.1.IsEquiv wFE.1 := by ++ apply ++ finitePlaceExtensions_isEquiv_of_centres_eq ++ (F := K) (M := F) v V wE wFE ++ exact hwFEcentre.symm ++ calc ++ absoluteValueDecompositionGroup F wE.1 = ++ absoluteValueDecompositionGroup F wFE.1 := ++ absoluteValueDecompositionGroup_eq_of_absoluteValue_isEquiv ++ (F := F) wE.1 wFE.1 hwEquiv ++ _ = ++ absoluteValueDecompositionGroup F ++ (chosenFinitePlaceExtension (L := E) V).1 := ++ absoluteValueDecompositionGroup_eq_of_exactExtensions_of_isMulCommutative ++ (F := F) ++ (NumberField.HeightOneSpectrum.adicAbv F V) ++ (RayClass.adicAbv_isNontrivial V) ++ wFE ++ (chosenFinitePlaceExtension (L := E) V) ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldBase.lean +new file mode 100644 +index 0000000..2c56707 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldBase.lean +@@ -0,0 +1,433 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open AlgebraicNumberTheory IsDedekindDomain NumberField ++open IdeleGroup RelativeIdeleGroup ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open CyclicCohomology ++open KummerTheory ClassFormation ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open GlobalClassFields ++ ++variable ++ {K L : Type} ++ [Field K] [NumberField K] ++ [Field L] [NumberField L] [Algebra K L] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ ++local instance (p : Nat.Primes) : Fact p.1.Prime := ++ ⟨p.2⟩ ++ ++attribute [local instance] ++ rationalSeparableClosureAlgebra ++ ++local instance finitePadicAuxiliaryExtensionNormal : ++ (extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)).Normal := ++ numberFieldTowerExtensionSubgroup_normal K L ++ ++local instance finitePadicAuxiliaryExtensionQuotientFinite : ++ Finite ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) := ++ numberFieldTowerExtensionQuotient_finite K L ++ ++noncomputable local instance finitePadicAuxiliaryExtensionQuotientIsMulCommutative : ++ IsMulCommutative ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) := by ++ let e : ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) ≃* ++ Gal(L / K) := ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ exact ++ { is_comm := ++ ⟨fun x y => by ++ apply e.injective ++ rw [map_mul, map_mul] ++ exact ++ (inferInstance : ++ IsMulCommutative (Gal(L / K))).is_comm.comm ++ (e x) (e y)⟩ } ++ ++/-- The concrete auxiliary fixed field attached to a simultaneous ++finite/cyclotomic lift. -/ ++noncomputable def numberFieldTowerFinitePadicCyclicFixedField ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ IntermediateField ℚ (SeparableClosure ℚ) := by ++ exact ++ IntermediateField.fixedField ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ).toSubgroup ++ ++/-- A nonzero-degree lift produces a genuine number field: its ++concrete fixed field is finite over `ℚ`. -/ ++theorem numberFieldTowerFinitePadicCyclicFixedField_finiteDimensional ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (hτ : ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ ≠ ++ 1) : ++ FiniteDimensional ℚ ++ (numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ) := by ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let F := ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ++ apply ++ (InfiniteGalois.isOpen_iff_finite ++ (K := SeparableClosure ℚ) F).1 ++ change IsOpen ++ (IntermediateField.fixedField S.toSubgroup).fixingSubgroup.carrier ++ rw [InfiniteGalois.fixingSubgroup_fixedField S] ++ exact ++ numberFieldTowerFinitePadicCyclicFixedSubgroup_isOpen ++ (K := K) (L := L) p τ hτ ++ ++/-- The compatible embedded copy of `K` lies in every auxiliary ++cyclic fixed field. -/ ++theorem numberFieldTowerBaseField_le_finitePadicCyclicFixedField ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ numberFieldTowerBaseField K L ≤ ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ := by ++ intro x hx ++ change x ∈ IntermediateField.fixedField ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ).toSubgroup ++ rw [IntermediateField.mem_fixedField_iff] ++ intro σ hσ ++ change ++ σ ∈ ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ).toSubgroup at hσ ++ obtain ⟨u, hu, rfl⟩ := hσ ++ exact ++ (IntermediateField.mem_fixingSubgroup_iff ++ (numberFieldTowerBaseField K L) u.1).1 u.2 x hx ++ ++/-- The compatible embedding of the original base field into the ++genuine auxiliary fixed field. -/ ++noncomputable def numberFieldTowerFinitePadicAuxiliaryBaseEmbedding ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ K →ₐ[ℚ] ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ) := by ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ) ++ exact ++ (numberFieldTowerLowerEmbedding K L).codRestrict F.toSubalgebra ++ (fun x => ++ numberFieldTowerBaseField_le_finitePadicCyclicFixedField ++ (K := K) (L := L) p τ ⟨x, rfl⟩) ++ ++/-- Coercing the auxiliary base embedding recovers the fixed lower embedding ++into the rational separable closure. -/ ++@[simp] ++theorem numberFieldTowerFinitePadicAuxiliaryBaseEmbedding_coe ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (x : K) : ++ ((numberFieldTowerFinitePadicAuxiliaryBaseEmbedding ++ (K := K) (L := L) p τ x : ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ)) : ++ SeparableClosure ℚ) = ++ numberFieldTowerLowerEmbedding K L x := by ++ rfl ++ ++/-- The compatible copy of the original top field lies in the ++auxiliary compositum fixed field. -/ ++theorem numberFieldTowerTopField_mem_finitePadicAuxiliaryTopField ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ {x : SeparableClosure ℚ} ++ (hx : x ∈ numberFieldInRationalSeparableClosure L) : ++ x ∈ ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below := by ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let T := ++ numberFieldTowerTopSubgroup L ++ change x ∈ IntermediateField.fixedField ++ (S.toSubgroup ⊓ T.toSubgroup) ++ rw [IntermediateField.mem_fixedField_iff] ++ intro σ hσ ++ have hσT : σ ∈ T.toSubgroup := ++ hσ.2 ++ change ++ σ ∈ ++ (numberFieldInRationalSeparableClosure L).fixingSubgroup ++ at hσT ++ exact ++ (IntermediateField.mem_fixingSubgroup_iff ++ (numberFieldInRationalSeparableClosure L) σ).1 ++ hσT x hx ++ ++/-- The compatible embedding of the original top field into the ++auxiliary compositum fixed field. -/ ++noncomputable def numberFieldTowerFinitePadicAuxiliaryTopEmbedding ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ L →ₐ[ℚ] ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below := by ++ let E := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below ++ exact ++ (numberFieldSeparableClosureEmbedding L).codRestrict ++ (E.restrictScalars ℚ).toSubalgebra ++ (fun x => ++ numberFieldTowerTopField_mem_finitePadicAuxiliaryTopField ++ (K := K) (L := L) p τ ⟨x, rfl⟩) ++ ++/-- Coercing the auxiliary top embedding recovers the chosen top-field ++embedding into the rational separable closure. -/ ++@[simp] ++theorem numberFieldTowerFinitePadicAuxiliaryTopEmbedding_coe ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (x : L) : ++ ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding ++ (K := K) (L := L) p τ x : ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) : ++ SeparableClosure ℚ) = ++ numberFieldSeparableClosureEmbedding L x := by ++ rfl ++ ++/-- The compatible base and top embeddings form the actual ++base-change square inside the rational separable closure. -/ ++theorem numberFieldTowerFinitePadicAuxiliaryEmbedding_algebraMap ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (x : K) : ++ ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding ++ (K := K) (L := L) p τ (algebraMap K L x) : ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) : ++ SeparableClosure ℚ) = ++ ((numberFieldTowerFinitePadicAuxiliaryBaseEmbedding ++ (K := K) (L := L) p τ x : ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ)) : ++ SeparableClosure ℚ) := by ++ rfl ++ ++noncomputable instance ++ numberFieldTowerFinitePadicAuxiliary_baseAlgebra ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ Algebra K ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ)) := by ++ exact ++ (numberFieldTowerFinitePadicAuxiliaryBaseEmbedding ++ (K := K) (L := L) p τ).toRingHom.toAlgebra ++ ++instance ++ numberFieldTowerFinitePadicAuxiliary_baseRatScalarTower ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ IsScalarTower ℚ K ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ)) := by ++ exact ++ IsScalarTower.of_algebraMap_eq' ++ (numberFieldTowerFinitePadicAuxiliaryBaseEmbedding ++ (K := K) (L := L) p τ).comp_algebraMap.symm ++ ++noncomputable instance ++ numberFieldTowerFinitePadicAuxiliary_topAlgebra ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ Algebra L ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) := by ++ exact ++ (numberFieldTowerFinitePadicAuxiliaryTopEmbedding ++ (K := K) (L := L) p τ).toRingHom.toAlgebra ++ ++instance ++ numberFieldTowerFinitePadicAuxiliary_topRatScalarTower ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ IsScalarTower ℚ L ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) := by ++ exact ++ IsScalarTower.of_algebraMap_eq' ++ (numberFieldTowerFinitePadicAuxiliaryTopEmbedding ++ (K := K) (L := L) p τ).comp_algebraMap.symm ++ ++noncomputable instance ++ numberFieldTowerFinitePadicAuxiliary_originalBaseTopAlgebra ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ Algebra K ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) := by ++ exact ++ ((numberFieldTowerFinitePadicAuxiliaryTopEmbedding ++ (K := K) (L := L) p τ).comp ++ (IsScalarTower.toAlgHom ℚ K L)).toRingHom.toAlgebra ++ ++instance ++ numberFieldTowerFinitePadicAuxiliary_originalTopScalarTower ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ IsScalarTower K L ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) := by ++ exact IsScalarTower.of_algebraMap_eq' rfl ++ ++instance ++ numberFieldTowerFinitePadicAuxiliary_baseTopScalarTower ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ IsScalarTower K ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ)) ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ).below) := by ++ apply IsScalarTower.of_algebraMap_eq' ++ apply RingHom.ext ++ intro x ++ apply Subtype.ext ++ exact ++ numberFieldTowerFinitePadicAuxiliaryEmbedding_algebraMap ++ (K := K) (L := L) p τ x ++ ++/-- The genuine auxiliary fixed field is Galois over the original ++base field through the compatible embedding above. -/ ++theorem numberFieldTowerFinitePadicAuxiliaryBase_isGalois ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) : ++ IsGalois K ++ (LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ)) := by ++ let H := ++ numberFieldTowerBaseSubgroup K L ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let hSH := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup_le_baseSubgroup ++ (K := K) (L := L) p τ ++ let B := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) H ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S ++ let FB := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hSH ++ let auxiliaryBaseAlgebra : Algebra B FB := ++ (LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) hSH).algebra ++ let auxiliaryBaseGalois : IsGalois B FB := ++ LocalClassFieldTheory.abstractRelativeFixedField_isGalois ++ ℚ (SeparableClosure ℚ) H S hSH ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup_extension_normal ++ (K := K) (L := L) p τ) ++ let eK := ++ numberFieldTowerAbstractBaseFieldEquiv K L ++ refine ++ @IsGalois.of_equiv_equiv ++ B FB _ _ auxiliaryBaseAlgebra ++ K F _ _ ++ (numberFieldTowerFinitePadicAuxiliary_baseAlgebra ++ (K := K) (L := L) p τ) ++ auxiliaryBaseGalois ++ eK.symm.toRingEquiv (RingEquiv.refl F) ?_ ++ apply RingHom.ext ++ intro x ++ apply Subtype.ext ++ change ++ ((eK (eK.symm x) : B) : SeparableClosure ℚ) = ++ (x : SeparableClosure ℚ) ++ exact ++ congrArg Subtype.val (eK.apply_symm_apply x) ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldExistence.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldExistence.lean +new file mode 100644 +index 0000000..87681a2 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldExistence.lean +@@ -0,0 +1,234 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldFixedFields ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open AlgebraicNumberTheory IsDedekindDomain NumberField ++open IdeleGroup RelativeIdeleGroup ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open CyclicCohomology ++open KummerTheory ClassFormation ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open GlobalClassFields ++ ++variable ++ {K L : Type} ++ [Field K] [NumberField K] ++ [Field L] [NumberField L] [Algebra K L] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ ++ ++local instance splitFactPrimeExistence (p : Nat.Primes) : Fact p.1.Prime := ⟨p.2⟩ ++ ++attribute [local instance] ++ rationalSeparableClosureAlgebra ++ finitePadicAuxiliaryExtensionNormal ++ finitePadicAuxiliaryExtensionQuotientFinite ++ finitePadicAuxiliaryExtensionQuotientIsMulCommutative ++ ++ ++/-- For a finite-place automorphism generating `Gal(L/K)`, construct ++the genuine auxiliary number field used in the cyclotomic reduction. ++ ++The field is finite over `ℚ`, contains the compatible copy of `K`, and ++has intersection with the compatible copy of `L` exactly equal to that ++copy of `K`. Its defining lift has the prescribed local restriction ++and positive integral cyclotomic `p`-adic degree. -/ ++theorem exists_finitePlaceCyclotomicAuxiliaryFixedField ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (σ : ++ absoluteValueDecompositionGroup K ++ (chosenFinitePlaceExtension (L := L) v).1) ++ (hσ : ++ Subgroup.closure ++ ({σ.1} : Set (Gal(L / K))) = ++ ⊤) : ++ letI _ : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ letI _ : Algebra L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureTopAlgebra L ++ letI _ : IsScalarTower K L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureScalarTower K L ++ ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) = ++ σ.1 ∧ ++ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ ++ absoluteValueDecompositionGroup K ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v ++ (chosenFinitePlaceExtension (L := L) v)).1 ∧ ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ ≠ ++ 1 ∧ ++ FiniteDimensional ℚ ++ (numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ) ∧ ++ numberFieldTowerBaseField K L ≤ ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ∧ ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ⊓ ++ numberFieldInRationalSeparableClosure L = ++ numberFieldTowerBaseField K L ∧ ++ ∃ n : ℕ, 0 < n ∧ ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ = ++ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by ++ let : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ let : Algebra L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureTopAlgebra L ++ let : IsScalarTower K L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureScalarTower K L ++ obtain ++ ⟨τ, hτσ, hτdecomposition, hτdegree, ++ n, hn, hdegree⟩ := ++ exists_numberFieldTowerFinitePadicLift_of_finitePlace ++ (K := K) (L := L) v p σ ++ have hgenerate := ++ numberFieldTowerFiniteQuotientCoordinate_generates_of_galoisGenerator ++ (K := K) (L := L) τ σ.1 hτσ hσ ++ refine ++ ⟨τ, hτσ, hτdecomposition, hτdegree, ++ numberFieldTowerFinitePadicCyclicFixedField_finiteDimensional ++ (K := K) (L := L) p τ hτdegree, ++ numberFieldTowerBaseField_le_finitePadicCyclicFixedField ++ (K := K) (L := L) p τ, ++ numberFieldTowerFinitePadicCyclicFixedField_inf_topField ++ (K := K) (L := L) p τ hgenerate, ++ n, hn, hdegree⟩ ++ ++/-- A `p`-primary local generator admits a genuine auxiliary number ++field whose compositum with the rational `p`-primary cyclotomic field ++contains `L`. ++ ++Besides the field containment, the construction records the two ++properties needed for descent: the auxiliary field meets `L` exactly ++in `K`, and the chosen absolute lift has positive integral ++cyclotomic degree. -/ ++theorem exists_finitePlacePrimaryCyclotomicAuxiliaryFixedField ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (σ : ++ absoluteValueDecompositionGroup K ++ (chosenFinitePlaceExtension (L := L) v).1) ++ (hgenerate : ++ Subgroup.closure ++ ({σ.1} : Set (Gal(L / K))) = ++ ⊤) ++ (hprimary : ++ σ.1 ∈ ++ CommGroup.primaryComponent ++ (Gal(L / K)) p.1) : ++ letI _ : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ letI _ : Algebra L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureTopAlgebra L ++ letI _ : IsScalarTower K L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureScalarTower K L ++ ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) = ++ σ.1 ∧ ++ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ ++ absoluteValueDecompositionGroup K ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v ++ (chosenFinitePlaceExtension (L := L) v)).1 ∧ ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ ≠ ++ 1 ∧ ++ FiniteDimensional ℚ ++ (numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ) ∧ ++ numberFieldTowerBaseField K L ≤ ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ∧ ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ⊓ ++ numberFieldInRationalSeparableClosure L = ++ numberFieldTowerBaseField K L ∧ ++ numberFieldInRationalSeparableClosure L ≤ ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ⊔ ++ rationalCyclotomicPadicField p ∧ ++ ∃ n : ℕ, 0 < n ∧ ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ = ++ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by ++ let : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ let : Algebra L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureTopAlgebra L ++ let : IsScalarTower K L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureScalarTower K L ++ obtain ++ ⟨τ, hτσ, hτdecomposition, hτdegree, ++ hfinite, hbase, hintersection, ++ n, hn, hdegree⟩ := ++ exists_finitePlaceCyclotomicAuxiliaryFixedField ++ (K := K) (L := L) v p σ hgenerate ++ have hprimaryQuotient : ++ numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ ∈ ++ CommGroup.primaryComponent ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) ++ p.1 := by ++ obtain ⟨m, hm⟩ := hprimary ++ refine ⟨m, ?_⟩ ++ let e := ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ let q := ++ numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ ++ let N : ℕ := p.1 ^ m ++ have hq : e q = σ.1 := by ++ exact hτσ ++ have hmN : σ.1 ^ N = 1 := by ++ exact hm ++ change q ^ N = 1 ++ apply e.injective ++ calc ++ e (q ^ N) = (e q) ^ N := by ++ exact map_pow e q N ++ _ = σ.1 ^ N := by rw [hq] ++ _ = 1 := hmN ++ _ = e 1 := (map_one e).symm ++ have hcontainment := ++ numberFieldTowerTopField_le_finitePadicCyclicFixedField_sup_padicCyclotomicField ++ (K := K) (L := L) p τ n hn hdegree ++ hprimaryQuotient ++ exact ++ ⟨τ, hτσ, hτdecomposition, hτdegree, ++ hfinite, hbase, hintersection, ++ hcontainment, n, hn, hdegree⟩ ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldFixedFields.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldFixedFields.lean +new file mode 100644 +index 0000000..1ed247d +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldFixedFields.lean +@@ -0,0 +1,420 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldNormRestriction ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open AlgebraicNumberTheory IsDedekindDomain NumberField ++open IdeleGroup RelativeIdeleGroup ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open CyclicCohomology ++open KummerTheory ClassFormation ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open GlobalClassFields ++ ++variable ++ {K L : Type} ++ [Field K] [NumberField K] ++ [Field L] [NumberField L] [Algebra K L] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ ++ ++local instance splitFactPrimeFixedFields (p : Nat.Primes) : Fact p.1.Prime := ⟨p.2⟩ ++ ++attribute [local instance] ++ rationalSeparableClosureAlgebra ++ finitePadicAuxiliaryExtensionNormal ++ finitePadicAuxiliaryExtensionQuotientFinite ++ finitePadicAuxiliaryExtensionQuotientIsMulCommutative ++ ++/-- Generation of the actual finite Galois group transports back ++through the compatible finite quotient coordinate. -/ ++theorem ++ numberFieldTowerFiniteQuotientCoordinate_generates_of_galoisGenerator ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (σ : Gal(L / K)) ++ (hτσ : ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) = ++ σ) ++ (hσ : Subgroup.closure ({σ} : Set (Gal(L / K))) = ⊤) : ++ Subgroup.closure ++ ({numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ} : ++ Set ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = ++ ⊤ := by ++ let e := ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ let q : ++ (numberFieldTowerFiniteGaloisSubextension ++ K L).extensionQuotient := ++ numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ ++ have hq : e.toMonoidHom q = σ := by ++ exact hτσ ++ change ++ Subgroup.closure ++ ({q} : ++ Set ++ (numberFieldTowerFiniteGaloisSubextension ++ K L).extensionQuotient) = ++ ⊤ ++ apply Subgroup.map_injective (f := e.toMonoidHom) e.injective ++ rw [MonoidHom.map_closure, Set.image_singleton, ++ hq, hσ, ++ Subgroup.map_top_of_surjective e.toMonoidHom e.surjective] ++ ++/-- If the finite quotient coordinate of a lift generates the whole ++finite Galois quotient, then its cyclic preimage together with the ++top-field subgroup generates the whole embedded absolute Galois ++group. -/ ++theorem ++ numberFieldTowerFinitePadicCyclicPreimage_sup_extensionSubgroup_eq_top ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (hgenerate : ++ Subgroup.closure ++ ({numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ} : ++ Set ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = ++ ⊤) : ++ (numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ).toSubgroup ⊔ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) = ++ ⊤ := by ++ let H := ++ numberFieldTowerBaseSubgroup K L ++ let N := ++ extensionSubgroup ++ H ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) ++ let Q := H.toSubgroup ⧸ N ++ let P := ++ numberFieldTowerFinitePadicImage ++ (K := K) (L := L) p ++ let coordinate := ++ numberFieldTowerFinitePadicCoordinate ++ (K := K) (L := L) p ++ let rangeRestriction := ++ numberFieldTowerFinitePadicRangeRestriction ++ (K := K) (L := L) p ++ let γ : P.toSubgroup := ++ rangeRestriction τ ++ let Γ := ++ ClassFormation.padicCyclicClosure γ ++ let finiteProjection : ++ P.toSubgroup →* ++ Q := ++ (MonoidHom.fst Q ++ (Multiplicative ℤ_[p.1])).comp ++ P.toSubgroup.subtype ++ have hprojection : ++ Γ.toSubgroup.map finiteProjection = ⊤ := by ++ apply top_unique ++ rw [← hgenerate] ++ apply (Subgroup.closure_le _).2 ++ intro q hq ++ rw [Set.mem_singleton_iff] at hq ++ subst q ++ refine ++ ⟨γ, ++ (ClassFormation.padicCyclicClosureGenerator γ).2, ++ ?_⟩ ++ rfl ++ have hquotientSurjective : ++ ∀ q : Q, ++ ∃ u : H.toSubgroup, ++ u ∈ ++ (numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ).toSubgroup ∧ ++ numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) u = ++ q := by ++ intro q ++ have hq : ++ q ∈ Γ.toSubgroup.map finiteProjection := by ++ rw [hprojection] ++ trivial ++ obtain ⟨z, hzΓ, hzq⟩ := hq ++ obtain ⟨u, hu⟩ := ++ numberFieldTowerFinitePadicRangeRestriction_surjective ++ (K := K) (L := L) p z ++ refine ⟨u, ?_, ?_⟩ ++ · change rangeRestriction u ∈ Γ.toSubgroup ++ rw [hu] ++ exact hzΓ ++ · calc ++ numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) u = ++ finiteProjection (rangeRestriction u) := rfl ++ _ = finiteProjection z := congrArg finiteProjection hu ++ _ = q := hzq ++ apply top_unique ++ intro h _ ++ obtain ⟨u, huU, huq⟩ := ++ hquotientSurjective ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) h) ++ let k : H.toSubgroup := ++ h * u⁻¹ ++ have hkN : k ∈ N := by ++ apply (QuotientGroup.eq_one_iff (N := N) k).mp ++ change ++ numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) (h * u⁻¹) = ++ 1 ++ rw [map_mul, map_inv, huq, mul_inv_cancel] ++ have hkSup : ++ k ∈ ++ (numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ).toSubgroup ⊔ ++ N := ++ (le_sup_right : ++ N ≤ ++ (numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ).toSubgroup ⊔ N) hkN ++ have huSup : ++ u ∈ ++ (numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ).toSubgroup ⊔ ++ N := ++ (le_sup_left : ++ (numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ).toSubgroup ≤ ++ (numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ).toSubgroup ⊔ N) huU ++ have hku : ++ k * u = h := by ++ simp only [k, inv_mul_cancel_right] ++ rw [← hku] ++ exact ++ ((numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ).toSubgroup ⊔ N).mul_mem ++ hkSup huSup ++ ++/-- Ambient form of the generation statement: the auxiliary cyclic ++fixed subgroup together with the subgroup fixing `L` generates the ++subgroup fixing `K`. -/ ++theorem ++ numberFieldTowerFinitePadicCyclicFixedSubgroup_sup_topSubgroup ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (hgenerate : ++ Subgroup.closure ++ ({numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ} : ++ Set ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = ++ ⊤) : ++ (numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ).toSubgroup ⊔ ++ (numberFieldTowerTopSubgroup L).toSubgroup = ++ (numberFieldTowerBaseSubgroup K L).toSubgroup := by ++ let H := ++ numberFieldTowerBaseSubgroup K L ++ let T := ++ numberFieldTowerTopSubgroup L ++ let N := ++ extensionSubgroup ++ H T ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) ++ let U := ++ numberFieldTowerFinitePadicCyclicPreimage ++ (K := K) (L := L) p τ ++ have hrelative : ++ U.toSubgroup ⊔ N = ⊤ := ++ numberFieldTowerFinitePadicCyclicPreimage_sup_extensionSubgroup_eq_top ++ (K := K) (L := L) p τ hgenerate ++ have hNmap : ++ N.map H.toSubgroup.subtype = ++ T.toSubgroup := by ++ exact ++ Subgroup.map_subgroupOf_eq_of_le ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L) ++ change ++ U.toSubgroup.map H.toSubgroup.subtype ⊔ ++ T.toSubgroup = ++ H.toSubgroup ++ rw [← hNmap, ← Subgroup.map_sup, ++ hrelative, ← MonoidHom.range_eq_map, ++ H.toSubgroup.range_subtype] ++ ++/-- The concrete auxiliary fixed field is linearly disjoint from `L` ++over the compatible embedded copy of `K`. -/ ++theorem ++ numberFieldTowerFinitePadicCyclicFixedField_inf_topField ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (hgenerate : ++ Subgroup.closure ++ ({numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ} : ++ Set ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L))) = ++ ⊤) : ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ⊓ ++ numberFieldInRationalSeparableClosure L = ++ numberFieldTowerBaseField K L := by ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let T := ++ numberFieldTowerTopSubgroup L ++ let H := ++ numberFieldTowerBaseSubgroup K L ++ change ++ IntermediateField.fixedField S.toSubgroup ⊓ ++ numberFieldInRationalSeparableClosure L = ++ numberFieldTowerBaseField K L ++ rw [ ++ ← InfiniteGalois.fixedField_fixingSubgroup ++ (numberFieldInRationalSeparableClosure L), ++ ← InfiniteGalois.fixedField_fixingSubgroup ++ (numberFieldTowerBaseField K L)] ++ change ++ IntermediateField.fixedField S.toSubgroup ⊓ ++ IntermediateField.fixedField T.toSubgroup = ++ IntermediateField.fixedField H.toSubgroup ++ rw [ ++ ← IntermediateField.fixedField_sup_eq_inf, ++ numberFieldTowerFinitePadicCyclicFixedSubgroup_sup_topSubgroup ++ (K := K) (L := L) p τ hgenerate] ++ ++/-- If the finite quotient coordinate is `p`-primary, adjoining the ++actual rational `p`-primary cyclotomic field to the auxiliary fixed ++field contains the compatible copy of `L`. ++ ++This is the field-theoretic conclusion of the simultaneous ++finite/cyclotomic lift: the intersection of the two fixing subgroups ++already fixes `L`, hence their fixed-field compositum contains `L`. -/ ++theorem ++ numberFieldTowerTopField_le_finitePadicCyclicFixedField_sup_padicCyclotomicField ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (n : ℕ) (hn : 0 < n) ++ (hdegree : ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ = ++ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n) ++ (hprimary : ++ numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ ∈ ++ CommGroup.primaryComponent ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) ++ p.1) : ++ numberFieldInRationalSeparableClosure L ≤ ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ⊔ ++ rationalCyclotomicPadicField p := by ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let T := ++ numberFieldTowerTopSubgroup L ++ let F := ++ numberFieldTowerFinitePadicCyclicFixedField ++ (K := K) (L := L) p τ ++ let C : @IntermediateField ℚ (SeparableClosure ℚ) _ _ ++ rationalSeparableClosureAlgebra := ++ rationalCyclotomicPadicField p ++ have hfixing : ++ (F ⊔ C).fixingSubgroup ≤ ++ T.toSubgroup := by ++ change ++ (IntermediateField.fixedField S.toSubgroup ⊔ C).fixingSubgroup ≤ ++ T.toSubgroup ++ rw [ ++ IntermediateField.fixingSubgroup_sup, ++ InfiniteGalois.fixingSubgroup_fixedField S] ++ intro σ hσ ++ apply ++ numberFieldTowerFinitePadicCyclicFixedSubgroup_inf_absolutePadicKernel_le_topSubgroup ++ (K := K) (L := L) p τ n hn hdegree hprimary ++ refine ⟨hσ.1, ?_⟩ ++ let : Algebra ℚ rationalCyclotomicZHatField := ++ rationalCyclotomicZHatField.algebra' ++ let : @Normal ℚ rationalCyclotomicZHatField _ _ ++ rationalCyclotomicZHatField.algebra' := ++ rationalCyclotomicZHatField_normal ++ let E := ++ rationalCyclotomicPadicFieldWithinZHat p ++ change ++ rationalCyclotomicPadicCoordinate p ++ (rationalAbsoluteGaloisRestrictionToCyclotomicZHat σ) = ++ 1 ++ have hr : ++ rationalAbsoluteGaloisRestrictionToCyclotomicZHat σ ∈ ++ E.fixingSubgroup := by ++ rw [IntermediateField.mem_fixingSubgroup_iff] ++ intro x hx ++ apply Subtype.ext ++ have hfix : ++ σ x.1 = x.1 := ++ (IntermediateField.mem_fixingSubgroup_iff ++ (IntermediateField.lift E) σ).1 hσ.2 x.1 ++ ((IntermediateField.mem_lift x).2 hx) ++ exact ++ (AlgEquiv.restrictNormal_commutes ++ σ rationalCyclotomicZHatField x).trans hfix ++ rw [rationalCyclotomicPadicFieldWithinZHat_fixingSubgroup] ++ at hr ++ exact hr ++ rw [ ++ ← InfiniteGalois.fixedField_fixingSubgroup ++ (numberFieldInRationalSeparableClosure L)] ++ change ++ IntermediateField.fixedField T.toSubgroup ≤ ++ F ⊔ C ++ rw [ ++ ← InfiniteGalois.fixedField_fixingSubgroup ++ (F ⊔ C)] ++ exact ++ IntermediateField.fixedField_le hfixing ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldNormRestriction.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldNormRestriction.lean +new file mode 100644 +index 0000000..c7daa65 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/LocalGlobalArtinCompatibility/FinitePadicAuxiliaryFieldNormRestriction.lean +@@ -0,0 +1,411 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicAuxiliaryFieldAutomorphisms ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.LocalGlobalArtinCompatibility.FinitePadicCyclicData ++import ClassFieldTheory.GlobalClassFieldTheory.GlobalClassFields.ClassFieldRealization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.CyclotomicUnramifiedLocalGlobalCompatibility ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.Extension.OnePlaceBaseNorm ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped IsMulCommutative NumberField ++open AlgebraicNumberTheory IsDedekindDomain NumberField ++open IdeleGroup RelativeIdeleGroup ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open CyclicCohomology ++open KummerTheory ClassFormation ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open GlobalClassFields ++ ++variable ++ {K L : Type} ++ [Field K] [NumberField K] ++ [Field L] [NumberField L] [Algebra K L] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ ++ ++local instance splitFactPrimeNormRestriction (p : Nat.Primes) : Fact p.1.Prime := ⟨p.2⟩ ++ ++attribute [local instance] ++ rationalSeparableClosureAlgebra ++ finitePadicAuxiliaryExtensionNormal ++ finitePadicAuxiliaryExtensionQuotientFinite ++ finitePadicAuxiliaryExtensionQuotientIsMulCommutative ++ ++/-- Pointwise form of norm/restriction naturality. Keeping the function ++equality and its coercion normalization in this small declaration prevents ++the auxiliary-field witness construction below from repeatedly elaborating ++the full pair of composite homomorphisms. -/ ++private theorem globalNormResidueMonoidHomOfEmbedding_norm_restriction_apply ++ (K K' L L' : Type) ++ [Field K] [NumberField K] ++ [Field K'] [NumberField K'] ++ [Field L] [NumberField L] ++ [Field L'] [NumberField L'] ++ [Algebra K K'] [Algebra K L] [Algebra K L'] ++ [Algebra K' L'] [Algebra L L'] ++ [IsScalarTower K K' L'] [IsScalarTower K L L'] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] ++ [FiniteDimensional K K'] [IsGalois K K'] ++ (j : L' →ₐ[ℚ] SeparableClosure ℚ) ++ (c : IdeleClassGroup K') : ++ ((AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K)) ++ (globalNormResidueMonoidHomOfEmbedding K' L' j c) = ++ globalNormResidueMonoidHomOfEmbedding K L ++ (j.comp (IsScalarTower.toAlgHom ℚ L L')) ++ (_root_.ideleClassNorm K K' c) := by ++ exact ++ DFunLike.congr_fun ++ (globalNormResidueMonoidHomOfEmbedding_norm_restriction ++ (K := K) (L := L) (K' := K') (L' := L') j) c ++ ++ ++/-- The auxiliary-field construction produces a lower local unit ++whose chosen local Artin value and global norm-residue value are both ++the finite quotient coordinate of the distinguished lift. -/ ++opaque numberFieldTowerFinitePadicAuxiliaryLocalGlobalRepresentative ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (τ : (numberFieldTowerBaseSubgroup K L).toSubgroup) ++ (hτ : ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ ≠ 1) ++ (hdecomposition : ++ letI : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ ++ absoluteValueDecompositionGroup K ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v (chosenFinitePlaceExtension (L := L) v)).1) ++ (n : ℕ) (hn : 0 < n) ++ (hdegree : ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ = ++ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n) ++ (hprimaryQuotient : ++ numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ ∈ ++ CommGroup.primaryComponent ++ ((numberFieldTowerBaseSubgroup K L).toSubgroup ⧸ ++ extensionSubgroup ++ (numberFieldTowerBaseSubgroup K L) ++ (numberFieldTowerTopSubgroup L) ++ (numberFieldTowerTopSubgroup_le_baseSubgroup K L)) ++ p.1) : ++ {z : (v.adicCompletion K)ˣ // ++ chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v z = ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) ∧ ++ globalNormResidueMonoidHom K L ++ (IdeleGroup.finitePlaceIdeleClass v z) = ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ)} := by ++ let H := ++ numberFieldTowerFinitePadicAuxiliaryAbstractField ++ (K := K) (L := L) p τ hτ ++ let S := ++ numberFieldTowerFinitePadicCyclicFixedSubgroup ++ (K := K) (L := L) p τ ++ let P := ++ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension ++ (K := K) (L := L) p τ ++ let F := ++ LocalClassFieldTheory.abstractFixedField ++ ℚ (SeparableClosure ℚ) S ++ let E := ++ LocalClassFieldTheory.abstractRelativeFixedField ++ ℚ (SeparableClosure ℚ) P.below ++ letI hHfinite : Finite ++ ((baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)).toSubgroup ⧸ ++ extensionSubgroup ++ (baseField ++ (SeparableClosure ℚ ≃ₐ[ℚ] SeparableClosure ℚ)) ++ S (le_baseField S)) := ++ H.finite ++ letI hPfinite : Finite ++ (S.toSubgroup ⧸ extensionSubgroup S P.field P.below) := ++ P.finite ++ letI auxiliaryBaseNumberField : NumberField F := by ++ let : FiniteDimensional ℚ F := ++ LocalClassFieldTheory.abstractFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) S hHfinite ++ exact NumberField.of_module_finite ℚ F ++ letI auxiliaryTopNumberField : NumberField E := by ++ let : FiniteDimensional F E := ++ LocalClassFieldTheory.abstractRelativeFixedField_finiteDimensional ++ ℚ (SeparableClosure ℚ) ++ S P.field P.below hHfinite hPfinite ++ exact NumberField.of_module_finite F E ++ letI auxiliaryAbelianGalois : IsAbelianGalois F E := ++ GlobalClassFields.finiteAbelianSubextensionAbstractRelativeFixedFieldIsAbelianGalois P ++ letI auxiliaryOriginalBaseAlgebra : Algebra K F := ++ numberFieldTowerFinitePadicAuxiliary_baseAlgebra ++ (K := K) (L := L) p τ ++ letI auxiliaryOriginalTopAlgebra : Algebra L E := ++ numberFieldTowerFinitePadicAuxiliary_topAlgebra ++ (K := K) (L := L) p τ ++ letI auxiliaryOriginalBaseTopAlgebra : Algebra K E := ++ numberFieldTowerFinitePadicAuxiliary_originalBaseTopAlgebra ++ (K := K) (L := L) p τ ++ letI auxiliaryOriginalTopScalarTower : IsScalarTower K L E := ++ numberFieldTowerFinitePadicAuxiliary_originalTopScalarTower ++ (K := K) (L := L) p τ ++ letI auxiliaryBaseTopScalarTower : IsScalarTower K F E := ++ numberFieldTowerFinitePadicAuxiliary_baseTopScalarTower ++ (K := K) (L := L) p τ ++ letI auxiliaryOriginalBaseGalois : IsGalois K F := ++ numberFieldTowerFinitePadicAuxiliaryBase_isGalois ++ (K := K) (L := L) p τ ++ let auxiliaryOriginalTopAlgHom : L →ₐ[ℚ] E := ++ numberFieldTowerFinitePadicAuxiliaryTopEmbedding ++ (K := K) (L := L) p τ ++ let wF := ++ numberFieldTowerFinitePadicAuxiliaryBasePlaceExtension ++ (K := K) (L := L) v p τ ++ let wE := ++ numberFieldTowerFinitePadicAuxiliaryTopPlaceExtension ++ (K := K) (L := L) v p τ ++ let V := ++ finitePlaceExtensionCentre ++ (K := K) (L := F) v wF ++ have hVbelow : finitePlaceBelow (K := K) V = v := ++ finitePlaceBelow_finitePlaceExtensionCentre ++ (K := K) (L := F) v wF ++ let Vover : ++ {V' : HeightOneSpectrum (𝓞 F) // ++ finitePlaceBelow (K := K) V' = v} := ++ ⟨V, hVbelow⟩ ++ letI auxiliaryCompletionAlgebra : ++ Algebra (v.adicCompletion K) (V.adicCompletion F) := ++ (finitePlaceAdicCompletionMap K F v Vover).toAlgebra ++ let σE : Gal(E / F) := ++ numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ ++ have hσtop : ++ σE ∈ absoluteValueDecompositionGroup F wE.1 := ++ numberFieldTowerFinitePadicAuxiliaryAutomorphism_mem_topPlaceDecomposition ++ (K := K) (L := L) v p τ hdecomposition ++ have hgroup := ++ numberFieldTowerFinitePadicAuxiliaryTopDecompositionGroup_eq_chosen ++ (K := K) (L := L) v p τ hτ ++ have hσchosen : ++ σE ∈ absoluteValueDecompositionGroup F ++ (chosenFinitePlaceExtension (L := E) V).1 := by ++ rw [← hgroup] ++ exact hσtop ++ have hRange : ++ σE ∈ (chosenFinitePlaceArtinMonoidHom ++ (K := F) (L := E) V).range := by ++ rw [chosenFinitePlaceArtinMonoidHom_range (K := F) (L := E) V] ++ exact hσchosen ++ let y : (V.adicCompletion F)ˣ := Classical.choose hRange ++ have hy : ++ chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V y = ++ numberFieldTowerFinitePadicAuxiliaryAutomorphism ++ (K := K) (L := L) p τ := ++ Classical.choose_spec hRange ++ let z : (v.adicCompletion K)ˣ := ++ LocalFieldTheory.normUnits ++ (v.adicCompletion K) (V.adicCompletion F) y ++ have hz : ++ z = LocalFieldTheory.normUnits ++ (v.adicCompletion K) (V.adicCompletion F) y := by ++ rfl ++ let σK : Gal(L / K) := ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) ++ let restriction : Gal(E / F) →* Gal(L / K) := ++ (AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K) ++ have hrestrict : restriction σE = σK := ++ numberFieldTowerFinitePadicAuxiliaryAutomorphism_restriction ++ (K := K) (L := L) p τ ++ have hlocal : ++ chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v z = ++ σK := by ++ rw [hz] ++ have hnat := ++ DFunLike.congr_fun ++ (chosenFinitePlaceArtinMonoidHom_norm_restriction_of_below_eq ++ (K := K) (L := L) (K' := F) (L' := E) ++ v V hVbelow) y ++ calc ++ chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v ++ (LocalFieldTheory.normUnits ++ (v.adicCompletion K) (V.adicCompletion F) y) = ++ restriction ++ (chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V y) := by ++ simpa only [ ++ MonoidHom.coe_comp, Function.comp_apply, restriction] ++ using hnat.symm ++ _ = restriction σE := congrArg restriction hy ++ _ = σK := hrestrict ++ let j : E →ₐ[ℚ] SeparableClosure ℚ := ++ E.val.restrictScalars ℚ ++ have hjLower : ++ j.comp auxiliaryOriginalTopAlgHom = ++ AlgebraicNumberTheory.numberFieldSeparableClosureEmbedding L := by ++ apply AlgHom.ext ++ intro a ++ exact ++ numberFieldTowerFinitePadicAuxiliaryTopEmbedding_coe ++ (K := K) (L := L) p τ a ++ have hPUnramified : ++ P.toFiniteGaloisExtension.IsUnramified ++ rationalCyclotomicDegreeData := ++ numberFieldTowerFinitePadicAuxiliaryCompositumSubextension_isUnramified ++ (K := K) (L := L) p τ n hn hdegree hprimaryQuotient ++ have hcompat : ++ (globalNormResidueMonoidHomOfEmbedding F E j).comp ++ (IdeleGroup.finitePlaceIdeleClass V) = ++ chosenFinitePlaceArtinMonoidHom (K := F) (L := E) V := ++ globalNormResidueMonoidHomOfEmbedding_comp_finitePlaceIdeleClass_of_abstractFixedFieldUnramified ++ H P hPUnramified V ++ have hupper : ++ globalNormResidueMonoidHomOfEmbedding F E j ++ (IdeleGroup.finitePlaceIdeleClass V y) = ++ σE := ++ (congrArg ++ (fun φ : (V.adicCompletion F)ˣ →* Gal(E / F) => φ y) ++ hcompat).trans hy ++ have hnormClass : ++ _root_.ideleClassNorm K F ++ (IdeleGroup.finitePlaceIdeleClass V y) = ++ IdeleGroup.finitePlaceIdeleClass v z := by ++ rw [hz] ++ simpa only [Vover] using ++ (IdeleGroup.ideleClassNorm_finitePlaceIdeleClass_eq_normUnits ++ (K := K) (L := F) v Vover y) ++ have hglobal : ++ globalNormResidueMonoidHom K L ++ (IdeleGroup.finitePlaceIdeleClass v z) = ++ σK := by ++ calc ++ globalNormResidueMonoidHom K L ++ (IdeleGroup.finitePlaceIdeleClass v z) = ++ globalNormResidueMonoidHom K L ++ (_root_.ideleClassNorm K F ++ (IdeleGroup.finitePlaceIdeleClass V y)) := ++ congrArg (globalNormResidueMonoidHom K L) hnormClass.symm ++ _ = globalNormResidueMonoidHomOfEmbedding K L ++ (j.comp auxiliaryOriginalTopAlgHom) ++ (_root_.ideleClassNorm K F ++ (IdeleGroup.finitePlaceIdeleClass V y)) := by ++ rw [hjLower, ++ ← globalNormResidueMonoidHom_eq_ofEmbedding_standard] ++ _ = ((AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K)) ++ (globalNormResidueMonoidHomOfEmbedding F E j ++ (IdeleGroup.finitePlaceIdeleClass V y)) := by ++ apply Eq.symm ++ apply ++ globalNormResidueMonoidHomOfEmbedding_norm_restriction_apply ++ _ = ((AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K)) σE := ++ congrArg ++ ((AlgEquiv.restrictNormalHom L).comp ++ (AlgEquiv.restrictScalarsHom K)) hupper ++ _ = restriction σE := rfl ++ _ = σK := hrestrict ++ exact ⟨z, hlocal, hglobal⟩ ++ ++ ++/-- Every genuine finite-place decomposition automorphism has a ++compatible embedded absolute lift with the same finite quotient class ++and positive integral cyclotomic `p`-adic degree. -/ ++theorem exists_numberFieldTowerFinitePadicLift_of_finitePlace ++ (v : HeightOneSpectrum (𝓞 K)) ++ (p : Nat.Primes) ++ (σ : ++ absoluteValueDecompositionGroup K ++ (chosenFinitePlaceExtension (L := L) v).1) : ++ letI _ : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ letI _ : Algebra L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureTopAlgebra L ++ letI _ : IsScalarTower K L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureScalarTower K L ++ ∃ τ : (numberFieldTowerBaseSubgroup K L).toSubgroup, ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) = ++ σ.1 ∧ ++ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ ++ absoluteValueDecompositionGroup K ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v ++ (chosenFinitePlaceExtension (L := L) v)).1 ∧ ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ ≠ ++ 1 ∧ ++ ∃ n : ℕ, 0 < n ∧ ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ = ++ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by ++ let : Algebra K (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureBaseAlgebra K L ++ let : Algebra L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureTopAlgebra L ++ let : IsScalarTower K L (SeparableClosure ℚ) := ++ numberFieldTowerSeparableClosureScalarTower K L ++ obtain ⟨τΩ, hτΩrestrict, n, hn, hτΩdegree⟩ := ++ exists_finitePlaceSeparableClosureLift_with_positivePadicCyclotomicDegree ++ (K := K) (L := L) v p σ ++ let τ : ++ (numberFieldTowerBaseSubgroup K L).toSubgroup := ++ numberFieldTowerSeparableClosureEquivBaseSubgroup ++ K L τΩ.1 ++ have hfinite : ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (numberFieldTowerFiniteQuotientCoordinate ++ (K := K) (L := L) τ) = ++ σ.1 := by ++ change ++ numberFieldTowerExtensionQuotientEquivGaloisGroup K L ++ (QuotientGroup.mk ++ (numberFieldTowerSeparableClosureEquivBaseSubgroup ++ K L τΩ.1)) = ++ σ.1 ++ rw [ ++ numberFieldTowerExtensionQuotientEquivGaloisGroup_mk_baseSubgroupEquiv] ++ exact congrArg Subtype.val hτΩrestrict ++ have hdegree : ++ numberFieldTowerBaseSubgroupPadicCyclotomicDegree ++ (K := K) (L := L) p τ = ++ (Multiplicative.ofAdd (1 : ℤ_[p.1])) ^ n := by ++ exact hτΩdegree ++ have hdecomposition : ++ (numberFieldTowerSeparableClosureEquivBaseSubgroup K L).symm τ ∈ ++ absoluteValueDecompositionGroup K ++ (numberFieldTowerFinitePlaceExtensionToSeparableClosure ++ K L v ++ (chosenFinitePlaceExtension (L := L) v)).1 := by ++ simpa only [τ, MulEquiv.symm_apply_apply] using τΩ.2 ++ refine ++ ⟨τ, hfinite, hdecomposition, ?_, n, hn, hdegree⟩ ++ rw [hdegree] ++ exact ++ PadicInt.multiplicative_positiveNatDegree_ne_one ++ p.1 n hn ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityBase.lean +new file mode 100644 +index 0000000..e5057a1 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityBase.lean +@@ -0,0 +1,488 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.HilbertProductFormula ++import ClassFieldTheory.AlgebraicNumberTheory.PowerResidueSymbols.Ideal ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormApproximation.FinitePlaces ++import Mathlib.NumberTheory.Padics.HeightOneSpectrum ++import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicField ++import ClassFieldTheory.AlgebraicNumberTheory.QuadraticReciprocity ++import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Rational ++import ClassFieldTheory.LocalClassFieldTheory.Kummer.PowerResidueTameFormula ++import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.IdealQuotients ++import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion ++import ValuedFieldTheory.Valuation.Completion.ExtensionInvariants ++import ClassFieldTheory.KummerTheory.Concrete.SimpleExtensionLocalBehavior ++import ClassFieldTheory.KummerTheory.Concrete.SUnitPreparation.FiniteRadicalSupport ++import ClassFieldTheory.LocalClassFieldTheory.Finite.CyclotomicNorm.PrincipalUnits ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped BigOperators Classical NumberField NumberTheorySymbols ValuativeRel WithZero ++open NumberField IsDedekindDomain ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open KummerTheory ++open AlgebraicNumberTheory.PowerResidueSymbols ++open LocalClassFieldTheory.Kummer ++open LocalFieldTheory ++open LocalFieldTheory.IsNonarchimedeanLocalField ++ ++variable (K : Type) [Field K] [NumberField K] ++ ++/-- Equality for the valuation used to define a valuative relation transports ++to equality in the relation's canonical value group. -/ ++theorem canonicalValuation_eq_of_valuation_eq ++ {R Γ : Type*} [Ring R] [LinearOrderedCommGroupWithZero Γ] ++ (v : Valuation R Γ) (x y : R) (hxy : v x = v y) : ++ letI : ValuativeRel R := ValuativeRel.ofValuation v ++ ValuativeRel.valuation R x = ValuativeRel.valuation R y := by ++ let : ValuativeRel R := ValuativeRel.ofValuation v ++ change ++ ValuativeRel.ValueGroupWithZero.mk x 1 = ++ ValuativeRel.ValueGroupWithZero.mk y 1 ++ rw [ValuativeRel.ValueGroupWithZero.mk_eq_mk] ++ constructor ++ · change v (x * (1 : R)) ≤ v (y * (1 : R)) ++ simpa only [mul_one] using hxy.le ++ · change v (y * (1 : R)) ≤ v (x * (1 : R)) ++ simpa only [mul_one] using hxy.ge ++ ++/-- The bounded-natural-number form of nonarchimedeanness for a finite-place ++absolute value. Naming this bridge keeps all completion residue constructions ++on one proof-irrelevant provider. -/ ++private theorem finitePlaceAdicAbv_nonarchimedeanAbsoluteValue ++ (v : HeightOneSpectrum (𝓞 K)) : ++ LubinTate.Valuations.NonarchimedeanAbsoluteValue ++ (HeightOneSpectrum.adicAbv K v) := ++ (AbsoluteValue.isNonarchimedean_iff_bounded_nat ++ (HeightOneSpectrum.adicAbv K v)).1 ++ (HeightOneSpectrum.isNonarchimedean_adicAbv K v) ++ ++/-- Finite-field power-residue symbols commute with a field equivalence. ++The statement is made on underlying units so it can be reused with every ++roots-of-unity transport occurring below. -/ ++theorem finiteFieldPowerResidueSymbol_unitsMap_ringEquiv ++ {k l : Type*} [Field k] [Field l] [Fintype k] [Fintype l] ++ (e : k ≃+* l) (n : ℕ+) ++ (hnk : (n : ℕ) ∣ Fintype.card k - 1) ++ (hnl : (n : ℕ) ∣ Fintype.card l - 1) ++ (u : kˣ) : ++ Units.map e.toMonoidHom ++ ((AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol ++ k n hnk u : ++ rootsOfUnity (n : ℕ) k) : kˣ) = ++ ((AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol ++ l n hnl ++ (Units.map e.toMonoidHom u) : ++ rootsOfUnity (n : ℕ) l) : lˣ) := by ++ rw [ ++ AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol_apply, ++ AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol_apply, ++ map_pow] ++ rw [Fintype.card_congr e.toEquiv] ++ ++/-- The residue field of a finite-place completion is canonically the ++prime-ideal residue field. The construction passes through the localization ++at the prime and then through the residue equivalence induced by completion. -/ ++noncomputable def finitePlacePrimeResidueEquivLocalResidue ++ (v : HeightOneSpectrum (𝓞 K)) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ (𝓞 K ⧸ v.asIdeal) ≃+* 𝓀[C] := by ++ let a := HeightOneSpectrum.adicAbv K v ++ let ha : LubinTate.Valuations.NonarchimedeanAbsoluteValue a := ++ finitePlaceAdicAbv_nonarchimedeanAbsoluteValue K v ++ let C := a.Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ let V := LubinTate.Valuations.exponentialValuationSubring ++ (AlgebraicNumberTheory.Valuations.absoluteValueExponentialValuation a ha) ++ let aC := AbsoluteValue.completionAbsoluteValue a ++ let haC : LubinTate.Valuations.NonarchimedeanAbsoluteValue aC := ++ (AbsoluteValue.isNonarchimedean_iff_bounded_nat aC).1 ++ (AbsoluteValue.completionAbsoluteValue_isNonarchimedean a ++ ((AbsoluteValue.isNonarchimedean_iff_bounded_nat a).2 ha)) ++ let VC := LubinTate.Valuations.exponentialValuationSubring ++ (AlgebraicNumberTheory.Valuations.absoluteValueExponentialValuation aC haC) ++ let Rv := v.valuationSubringAtPrime K ++ letI : IsLocalRing Rv := ++ IsLocalization.AtPrime.isLocalRing Rv v.asIdeal ++ have hBase : Rv.toSubring = V := by ++ ext x ++ rw [AlgebraicNumberTheory.Valuations.mem_absoluteValueExponentialSubring_iff] ++ change x ∈ v.valuationSubringAtPrime K ↔ _ ++ rw [v.valuationSubringAtPrime_eq_valuationSubring] ++ change v.valuation K x ≤ 1 ↔ a x ≤ 1 ++ rw [HeightOneSpectrum.adicAbv_def] ++ exact_mod_cast ++ (WithZeroMulInt.toNNReal_le_one_iff ++ (HeightOneSpectrum.one_lt_absNorm_nnreal v)).symm ++ let eBase : Rv ≃+* V := RingEquiv.subringCongr hBase ++ have hCompletion : VC = 𝒪[C] := by ++ ext x ++ rw [AlgebraicNumberTheory.Valuations.mem_absoluteValueExponentialSubring_iff] ++ change ‖x‖ ≤ 1 ↔ x ∈ 𝒪[C] ++ exact ++ (finitePlaceCompletion_mem_integers_iff_norm_le_one ++ a (HeightOneSpectrum.isNonarchimedean_adicAbv K v) x).symm ++ let eCompletionRing : VC ≃+* 𝒪[C] := ++ RingEquiv.subringCongr hCompletion ++ let eIdeal : (𝓞 K ⧸ v.asIdeal) ≃+* v.asIdeal.ResidueField := ++ RingEquiv.ofBijective ++ (algebraMap (𝓞 K ⧸ v.asIdeal) v.asIdeal.ResidueField) ++ v.asIdeal.bijective_algebraMap_quotient_residueField ++ let eLocalization : Localization.AtPrime v.asIdeal ≃ₐ[𝓞 K] Rv := ++ IsLocalization.algEquiv v.asIdeal.primeCompl _ _ ++ exact ++ eIdeal |>.trans ++ (IsLocalRing.ResidueField.mapEquiv eLocalization.toRingEquiv) |>.trans ++ (IsLocalRing.ResidueField.mapEquiv eBase) |>.trans ++ (AlgebraicNumberTheory.Valuations.completionResidueEquiv a ha) |>.trans ++ (IsLocalRing.ResidueField.mapEquiv eCompletionRing) ++ ++/-- The image of an algebraic integer in the valuation ring of a finite-place ++completion. -/ ++noncomputable def finitePlaceIntegralCompletionElement ++ (v : HeightOneSpectrum (𝓞 K)) (x : 𝓞 K) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ 𝒪[C] := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ exact ⟨algebraMap K C (x : K), by ++ rw [finitePlaceCompletion_mem_integers_iff_norm_le_one ++ (HeightOneSpectrum.adicAbv K v) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv K v)] ++ calc ++ ‖algebraMap K C (x : K)‖ = ++ HeightOneSpectrum.adicAbv K v (x : K) := ++ AbsoluteValue.completionAbsoluteValue_coe ++ (HeightOneSpectrum.adicAbv K v) (x : K) ++ _ ≤ 1 := ++ v.adicAbv_coe_le_one ++ (HeightOneSpectrum.one_lt_absNorm_nnreal v) x⟩ ++ ++/-- The finite-place integral element has the expected underlying completion ++value. -/ ++@[simp] ++theorem finitePlaceIntegralCompletionElement_coe ++ (v : HeightOneSpectrum (𝓞 K)) (x : 𝓞 K) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ (finitePlaceIntegralCompletionElement K v x : C) = ++ algebraMap K C (x : K) := ++ rfl ++ ++/-- The finite-place residue equivalence sends the class of an algebraic ++integer to the residue of its canonical image in the completion. -/ ++@[simp] ++theorem finitePlacePrimeResidueEquivLocalResidue_mk ++ (v : HeightOneSpectrum (𝓞 K)) (x : 𝓞 K) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ finitePlacePrimeResidueEquivLocalResidue K v ++ (Ideal.Quotient.mk v.asIdeal x) = ++ IsLocalRing.residue 𝒪[C] ++ (finitePlaceIntegralCompletionElement K v x) := by ++ simp only [finitePlacePrimeResidueEquivLocalResidue, ++ finitePlaceIntegralCompletionElement, RingEquiv.trans_apply] ++ rw [RingEquiv.ofBijective_apply, ++ Ideal.algebraMap_quotient_residueField_mk] ++ rw [IsScalarTower.algebraMap_apply ++ (NumberField.RingOfIntegers K) (Localization.AtPrime v.asIdeal)] ++ rw [IsLocalRing.ResidueField.algebraMap_eq] ++ simp only [IsLocalRing.ResidueField.mapEquiv_apply, ++ IsLocalRing.ResidueField.map_residue] ++ rw [AlgebraicNumberTheory.Valuations.completionResidueEquiv_residue] ++ simp only [IsLocalRing.ResidueField.map_residue] ++ congr 1 ++ apply Subtype.ext ++ change ++ algebraMap K (HeightOneSpectrum.adicAbv K v).Completion ++ (((IsLocalization.algEquiv v.asIdeal.primeCompl ++ (Localization.AtPrime v.asIdeal) ++ (v.valuationSubringAtPrime K)) ++ (algebraMap (𝓞 K) (Localization.AtPrime v.asIdeal) x) : ++ v.valuationSubringAtPrime K) : K) = ++ algebraMap K (HeightOneSpectrum.adicAbv K v).Completion (x : K) ++ rw [AlgEquiv.commutes] ++ rw [IsScalarTower.algebraMap_apply ++ (NumberField.RingOfIntegers K) (v.valuationSubringAtPrime K)] ++ rfl ++ ++/-- A nonzero algebraic integer, regarded as a global field unit. -/ ++def nonzeroIntegralFieldUnit (x : 𝓞 K) (hx : x ≠ 0) : Kˣ := ++ Units.mk0 (x : K) (by ++ intro hxK ++ apply hx ++ apply Subtype.ext ++ exact hxK) ++ ++omit [NumberField K] in ++@[simp] ++theorem nonzeroIntegralFieldUnit_coe (x : 𝓞 K) (hx : x ≠ 0) : ++ ((nonzeroIntegralFieldUnit K x hx : Kˣ) : K) = (x : K) := ++ rfl ++ ++/-- An algebraic integer avoiding a prime ideal, regarded as a nonzero ++element of the global field. -/ ++noncomputable def primeAvoidingIntegralFieldUnit ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : Kˣ := ++ nonzeroIntegralFieldUnit K x (by ++ intro hx0 ++ apply hx ++ rw [hx0] ++ exact Ideal.zero_mem _) ++ ++omit [NumberField K] in ++@[simp] ++theorem primeAvoidingIntegralFieldUnit_coe ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : ++ ((primeAvoidingIntegralFieldUnit K v x hx : Kˣ) : K) = (x : K) := ++ rfl ++ ++/-- An algebraic integer nonzero modulo `v`, regarded as a unit of the ++valuation ring of the finite-place completion. -/ ++noncomputable def finitePlaceIntegralCompletionUnit ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ 𝒪[C]ˣ := by ++ let a := HeightOneSpectrum.adicAbv K v ++ let C := a.Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ let y : C := algebraMap K C (x : K) ++ have hyNorm : ‖y‖ = 1 := by ++ calc ++ ‖y‖ = a (x : K) := ++ AbsoluteValue.completionAbsoluteValue_coe a (x : K) ++ _ = ‖NumberField.FinitePlace.embedding v (x : K)‖ := ++ (NumberField.FinitePlace.norm_embedding v (x : K)).symm ++ _ = 1 := ++ (NumberField.FinitePlace.norm_eq_one_iff_notMem K v x).2 hx ++ have hyNe : y ≠ 0 := by ++ intro hy ++ rw [hy, norm_zero] at hyNorm ++ exact zero_ne_one hyNorm ++ let yIntegral : 𝒪[C] := ⟨y, by ++ rw [finitePlaceCompletion_mem_integers_iff_norm_le_one ++ a (HeightOneSpectrum.isNonarchimedean_adicAbv K v)] ++ exact hyNorm.le⟩ ++ let yInvIntegral : 𝒪[C] := ⟨y⁻¹, by ++ rw [finitePlaceCompletion_mem_integers_iff_norm_le_one ++ a (HeightOneSpectrum.isNonarchimedean_adicAbv K v), ++ norm_inv, hyNorm, inv_one]⟩ ++ exact { ++ val := yIntegral ++ inv := yInvIntegral ++ val_inv := by ++ apply Subtype.ext ++ exact mul_inv_cancel₀ hyNe ++ inv_val := by ++ apply Subtype.ext ++ exact inv_mul_cancel₀ hyNe } ++ ++/-- Forgetting the integral-unit structure recovers the ordinary image of ++the algebraic integer in the finite-place completion. -/ ++@[simp] ++theorem finitePlaceIntegralCompletionUnit_coe ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ (((finitePlaceIntegralCompletionUnit K v x hx : 𝒪[C]ˣ) : 𝒪[C]) : C) = ++ algebraMap K C (x : K) := by ++ rfl ++ ++/-- The completion image of a prime-avoiding algebraic integer is the field ++unit underlying its canonical valuation-ring unit. -/ ++theorem finitePlaceHilbert_completionUnit_primeAvoidingIntegralFieldUnit ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ finitePlaceHilbert_completionUnit K v ++ (primeAvoidingIntegralFieldUnit K v x hx) = ++ integerUnitsToFieldUnits C ++ (finitePlaceIntegralCompletionUnit K v x hx) := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ let : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ let : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ dsimp only ++ apply Units.ext ++ change ++ algebraMap K C (x : K) = ++ (((finitePlaceIntegralCompletionUnit K v x hx : 𝒪[C]ˣ) : ++ 𝒪[C]) : C) ++ exact (finitePlaceIntegralCompletionUnit_coe K v x hx).symm ++ ++/-- As an element of the completion valuation ring, the lifted unit is the ++canonical lifted algebraic integer. -/ ++@[simp] ++theorem finitePlaceIntegralCompletionUnit_val ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ (finitePlaceIntegralCompletionUnit K v x hx : 𝒪[C]) = ++ finitePlaceIntegralCompletionElement K v x := by ++ dsimp only ++ apply Subtype.ext ++ exact finitePlaceIntegralCompletionUnit_coe K v x hx ++ ++/-- Reduction of the canonical completion unit agrees with reduction modulo ++the corresponding global prime ideal. -/ ++theorem finitePlace_integerUnitsToResidueUnits_integralUnit ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ integerUnitsToResidueUnits C ++ (finitePlaceIntegralCompletionUnit K v x hx) = ++ Units.map ++ (finitePlacePrimeResidueEquivLocalResidue K v).toMonoidHom ++ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealResidueUnit ++ K v x hx) := by ++ dsimp only ++ apply Units.ext ++ change ++ IsLocalRing.residue 𝒪[(HeightOneSpectrum.adicAbv K v).Completion] ++ (finitePlaceIntegralCompletionUnit K v x hx : ++ 𝒪[(HeightOneSpectrum.adicAbv K v).Completion]) = ++ finitePlacePrimeResidueEquivLocalResidue K v ++ (Ideal.Quotient.mk v.asIdeal x) ++ simpa only [finitePlaceIntegralCompletionUnit_val] using ++ (finitePlacePrimeResidueEquivLocalResidue_mk K v x).symm ++ ++/-- The canonical inclusion from integral roots of unity into the common ++field-valued group used by the global Hilbert symbols. -/ ++def integralRootsOfUnityToNthRoots ++ (n : ℕ) : ++ rootsOfUnity n (𝓞 K) →* nthRootsSubgroup K n where ++ toFun z := ++ ⟨Units.map (algebraMap (𝓞 K) K).toMonoidHom z.1, by ++ calc ++ Units.map (algebraMap (𝓞 K) K).toMonoidHom z.1 ^ n = ++ Units.map (algebraMap (𝓞 K) K).toMonoidHom (z.1 ^ n) := ++ (map_pow ++ (Units.map (algebraMap (𝓞 K) K).toMonoidHom) z.1 n).symm ++ _ = 1 := by rw [z.2, map_one]⟩ ++ map_one' := by ++ apply Subtype.ext ++ exact map_one (Units.map (algebraMap (𝓞 K) K).toMonoidHom) ++ map_mul' := by ++ intro z w ++ apply Subtype.ext ++ exact map_mul ++ (Units.map (algebraMap (𝓞 K) K).toMonoidHom) z.1 w.1 ++ ++omit [NumberField K] in ++/-- The integral-root inclusion is the underlying unit map. -/ ++@[simp] ++theorem integralRootsOfUnityToNthRoots_apply ++ (n : ℕ) (z : rootsOfUnity n (𝓞 K)) : ++ (integralRootsOfUnityToNthRoots K n z).1 = ++ Units.map (algebraMap (𝓞 K) K).toMonoidHom z.1 := ++ rfl ++ ++omit [NumberField K] in ++/-- The integral-to-field inclusion is injective on roots of unity. -/ ++theorem integralRootsOfUnityToNthRoots_injective ++ (n : ℕ) : ++ Function.Injective (integralRootsOfUnityToNthRoots K n) := by ++ intro z w h ++ apply Subtype.ext ++ apply ++ (Units.map_injective ++ (f := (algebraMap (𝓞 K) K).toMonoidHom) ++ RingOfIntegers.coe_injective) ++ exact congrArg Subtype.val h ++ ++/-- Reduction after embedding an integral global root of unity into a ++finite-place completion is the transport of reduction modulo the ++corresponding prime ideal. -/ ++theorem finitePlace_localNthRootsReduction_integralRoots ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (z : rootsOfUnity (n : ℕ) (𝓞 K)) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ (localNthRootsReduction C n ++ (nthRootsSubgroupMap K C (n : ℕ) ++ (integralRootsOfUnityToNthRoots K (n : ℕ) z))).1 = ++ Units.map ++ (finitePlacePrimeResidueEquivLocalResidue K v).toMonoidHom ++ (AlgebraicNumberTheory.PowerResidueSymbols.rootsOfUnityReduction ++ K v (n : ℕ) z).1 := by ++ dsimp only ++ apply Units.ext ++ change ++ IsLocalRing.residue 𝒪[(HeightOneSpectrum.adicAbv K v).Completion] ++ (nthRootIntegerUnit ++ (HeightOneSpectrum.adicAbv K v).Completion n ++ (nthRootsSubgroupMap K ++ (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ) ++ (integralRootsOfUnityToNthRoots K (n : ℕ) z)) : ++ 𝒪[(HeightOneSpectrum.adicAbv K v).Completion]) = ++ finitePlacePrimeResidueEquivLocalResidue K v ++ (Ideal.Quotient.mk v.asIdeal (z.1 : 𝓞 K)) ++ rw [finitePlacePrimeResidueEquivLocalResidue_mk] ++ congr 1 ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityCorrection.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityCorrection.lean +new file mode 100644 +index 0000000..83cbaaa +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityCorrection.lean +@@ -0,0 +1,452 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.PowerResidueReciprocityLocalSymbols ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.HilbertProductFormula ++import ClassFieldTheory.AlgebraicNumberTheory.PowerResidueSymbols.Ideal ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormApproximation.FinitePlaces ++import Mathlib.NumberTheory.Padics.HeightOneSpectrum ++import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicField ++import ClassFieldTheory.AlgebraicNumberTheory.QuadraticReciprocity ++import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Rational ++import ClassFieldTheory.LocalClassFieldTheory.Kummer.PowerResidueTameFormula ++import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.IdealQuotients ++import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion ++import ValuedFieldTheory.Valuation.Completion.ExtensionInvariants ++import ClassFieldTheory.KummerTheory.Concrete.SimpleExtensionLocalBehavior ++import ClassFieldTheory.KummerTheory.Concrete.SUnitPreparation.FiniteRadicalSupport ++import ClassFieldTheory.LocalClassFieldTheory.Finite.CyclotomicNorm.PrincipalUnits ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped BigOperators Classical NumberField NumberTheorySymbols ValuativeRel WithZero ++open NumberField IsDedekindDomain ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open KummerTheory ++open AlgebraicNumberTheory.PowerResidueSymbols ++open LocalClassFieldTheory.Kummer ++open LocalFieldTheory ++open LocalFieldTheory.IsNonarchimedeanLocalField ++ ++variable (K : Type) [Field K] [NumberField K] ++/-- Prime avoidance is the common special case of the integral valuation ++formula used for numerator units. -/ ++theorem finitePlaceNormalizedValuation_primeAvoidingIntegralFieldUnit ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ∉ v.asIdeal) : ++ finitePlaceNormalizedValuation K v ++ (primeAvoidingIntegralFieldUnit K v x hx) = ++ -(AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) : ℤ) := by ++ let hx0 : x ≠ 0 := by ++ intro hxzero ++ apply hx ++ rw [hxzero] ++ exact Ideal.zero_mem _ ++ change finitePlaceNormalizedValuation K v ++ (nonzeroIntegralFieldUnit K x hx0) = _ ++ exact finitePlaceNormalizedValuation_nonzeroIntegralFieldUnit K v x hx0 ++ ++/-- Integral form of the finite-place comparison: the exponent is the ++Dedekind multiplicity in the principal denominator ideal. -/ ++theorem finitePlaceHilbertSymbol_integral_eq_primeIdealPowerResidueFactor ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) ++ (ha : a ∉ v.asIdeal) : ++ finitePlaceHilbertSymbol K n hnK hmu v ++ (nonzeroIntegralFieldUnit K a ha0) ++ (nonzeroIntegralFieldUnit K b hb0) = ++ integralRootsOfUnityToNthRoots K (n : ℕ) ++ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol ++ K v n hmu hcoprime a ha) ^ ++ AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {b}) := by ++ have haUnits : ++ nonzeroIntegralFieldUnit K a ha0 = ++ primeAvoidingIntegralFieldUnit K v a ha := by ++ apply Units.ext ++ rfl ++ rw [haUnits, ++ finitePlaceHilbertSymbol_eq_primeIdealPowerResidueFactor ++ K n hnK hmu v hv hcoprime a ha ++ (nonzeroIntegralFieldUnit K b hb0), ++ finitePlaceNormalizedValuation_nonzeroIntegralFieldUnit] ++ simp only [neg_neg, zpow_natCast] ++ ++/-- Finite-place Hilbert symbols inherit skew symmetry from the local ++Hilbert symbol in the canonical completion. -/ ++theorem finitePlaceHilbertSymbol_skew ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (v : HeightOneSpectrum (𝓞 K)) (a b : Kˣ) : ++ finitePlaceHilbertSymbol K n hnK hmu v a b = ++ (finitePlaceHilbertSymbol K n hnK hmu v b a)⁻¹ := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ let : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ let : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ apply nthRootsSubgroupMap_injective K C (n : ℕ) ++ rw [map_inv, ++ finitePlaceHilbertSymbol_map_eq_localHilbertSymbol, ++ finitePlaceHilbertSymbol_map_eq_localHilbertSymbol] ++ exact ++ localHilbertSymbol_skew C n ++ (finitePlaceHilbert_natCast_ne_zero K n hnK v) ++ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) ++ (finitePlaceHilbert_completionUnit K v a) ++ (finitePlaceHilbert_completionUnit K v b) ++ ++/-- If two nonzero algebraic integers are both units at a finite place, the ++corresponding finite-place Hilbert symbol is trivial. -/ ++theorem finitePlaceHilbertSymbol_integral_units_eq_one ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) ++ (ha : a ∉ v.asIdeal) (hb : b ∉ v.asIdeal) : ++ finitePlaceHilbertSymbol K n hnK hmu v ++ (nonzeroIntegralFieldUnit K a ha0) ++ (nonzeroIntegralFieldUnit K b hb0) = 1 := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ let : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ let : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ apply nthRootsSubgroupMap_injective K C (n : ℕ) ++ rw [map_one, finitePlaceHilbertSymbol_map_eq_localHilbertSymbol] ++ have haUnits : ++ finitePlaceHilbert_completionUnit K v ++ (nonzeroIntegralFieldUnit K a ha0) = ++ integerUnitsToFieldUnits C ++ (finitePlaceIntegralCompletionUnit K v a ha) := by ++ apply Units.ext ++ change ++ algebraMap K C (a : K) = ++ (((finitePlaceIntegralCompletionUnit K v a ha : 𝒪[C]ˣ) : ++ 𝒪[C]) : C) ++ exact (finitePlaceIntegralCompletionUnit_coe K v a ha).symm ++ have hbUnits : ++ finitePlaceHilbert_completionUnit K v ++ (nonzeroIntegralFieldUnit K b hb0) = ++ integerUnitsToFieldUnits C ++ (finitePlaceIntegralCompletionUnit K v b hb) := by ++ apply Units.ext ++ change ++ algebraMap K C (b : K) = ++ (((finitePlaceIntegralCompletionUnit K v b hb : 𝒪[C]ˣ) : ++ 𝒪[C]) : C) ++ exact (finitePlaceIntegralCompletionUnit_coe K v b hb).symm ++ unfold finitePlaceLocalHilbertSymbol ++ rw [haUnits, hbUnits] ++ exact ++ localHilbertSymbol_integerUnit_integerUnit_eq_one C n ++ (finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv) ++ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) ++ (finitePlaceIntegralCompletionUnit K v a ha) ++ (finitePlaceIntegralCompletionUnit K v b hb) ++ ++/-- Primewise comparison between the tame finite-place Hilbert factor and ++the quotient of the two ideal power-residue factors. -/ ++theorem powerResidueAwayFromExponentFiniteFactor_integral_eq_idealFactors ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) ++ (hcoprimeA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → ++ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) ++ (hcoprimeB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → ++ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) ++ (haB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → a ∉ P.asIdeal) ++ (hbA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → b ∉ P.asIdeal) ++ (hAwayA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → ++ P ∉ powerResidueExponentFinitePlaces K n) ++ (hAwayB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → ++ P ∉ powerResidueExponentFinitePlaces K n) ++ (P : HeightOneSpectrum (𝓞 K)) : ++ (if P ∈ powerResidueExponentFinitePlaces K n then ++ 1 ++ else ++ finitePlaceHilbertSymbol K n hnK hmu P ++ (nonzeroIntegralFieldUnit K a ha0) ++ (nonzeroIntegralFieldUnit K b hb0)) = ++ integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueFactor K (Ideal.span {b}) n hmu a ++ hcoprimeB haB P) * ++ (integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueFactor K (Ideal.span {a}) n hmu b ++ hcoprimeA hbA P))⁻¹ := by ++ by_cases hPExponent : P ∈ powerResidueExponentFinitePlaces K n ++ · have hPA : ¬ P.asIdeal ∣ Ideal.span {a} := by ++ intro hPA ++ exact (hAwayA P hPA) hPExponent ++ have hPB : ¬ P.asIdeal ∣ Ideal.span {b} := by ++ intro hPB ++ exact (hAwayB P hPB) hPExponent ++ simp only [ite_eq_left hPExponent, idealPowerResidueFactor, ++ dite_eq_right hPA, dite_eq_right hPB, map_one, inv_one, mul_one] ++ · rw [ite_eq_right hPExponent] ++ by_cases hPB : P.asIdeal ∣ Ideal.span {b} ++ · have haP : a ∉ P.asIdeal := haB P hPB ++ have hPA : ¬ P.asIdeal ∣ Ideal.span {a} := by ++ intro hPA ++ apply haP ++ rw [← Ideal.dvd_span_singleton] ++ exact hPA ++ rw [finitePlaceHilbertSymbol_integral_eq_primeIdealPowerResidueFactor ++ K n hnK hmu P (hAwayB P hPB) (hcoprimeB P hPB) ++ a b ha0 hb0 haP] ++ simp only [idealPowerResidueFactor, dite_eq_left hPB, dite_eq_right hPA, ++ map_pow, map_one, inv_one, mul_one] ++ · by_cases hPA : P.asIdeal ∣ Ideal.span {a} ++ · have hbP : b ∉ P.asIdeal := hbA P hPA ++ rw [finitePlaceHilbertSymbol_skew K n hnK hmu] ++ rw [finitePlaceHilbertSymbol_integral_eq_primeIdealPowerResidueFactor ++ K n hnK hmu P (hAwayA P hPA) (hcoprimeA P hPA) ++ b a hb0 ha0 hbP] ++ simp only [idealPowerResidueFactor, dite_eq_right hPB, dite_eq_left hPA, ++ map_pow, map_one, one_mul] ++ · have haP : a ∉ P.asIdeal := by ++ intro haMem ++ apply hPA ++ rw [Ideal.dvd_span_singleton] ++ exact haMem ++ have hbP : b ∉ P.asIdeal := by ++ intro hbMem ++ apply hPB ++ rw [Ideal.dvd_span_singleton] ++ exact hbMem ++ rw [finitePlaceHilbertSymbol_integral_units_eq_one ++ K n hnK hmu P hPExponent a b ha0 hb0 haP hbP] ++ simp only [idealPowerResidueFactor, dite_eq_right hPB, dite_eq_right hPA, ++ map_one, inv_one, mul_one] ++ ++/-- A concrete finite set containing every finite place where a local ++power-residue factor of `a` and `b` may be nontrivial. Its exponent part is ++the exact set of prime divisors of `(n)`. -/ ++noncomputable def powerResidueBadFinitePlaces ++ (n : ℕ+) (a b : Kˣ) : ++ Finset (HeightOneSpectrum (𝓞 K)) := ++ (chosenUnitFiniteSupport (K := K) a ∪ ++ chosenUnitFiniteSupport (K := K) b) ∪ ++ powerResidueExponentFinitePlaces K n ++ ++/-- The explicit bad-place correction in power-residue reciprocity. Every ++factor already lies in the common group `nthRootsSubgroup K n`. -/ ++noncomputable def powerResidueBadPlaceCorrection ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) : ++ nthRootsSubgroup K (n : ℕ) := ++ (∏ v : InfinitePlace K, ++ infinitePlaceHilbertSymbol K n v a b) * ++ (∏ v ∈ powerResidueExponentFinitePlaces K n, ++ finitePlaceHilbertSymbol K n hnK hmu v a b) ++ ++private theorem valuation_eq_one_of_not_mem_chosenUnitFiniteSupport ++ (x : Kˣ) (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ chosenUnitFiniteSupport (K := K) x) : ++ v.valuation K (x : K) = 1 := ++ (mem_SUnitGroup_iff (K := K) ++ (chosenUnitFiniteSupport (K := K) x) x).mp ++ (mem_sUnitGroup_chosenUnitFiniteSupport (K := K) x) v hv ++ ++/-- The finite-place Hilbert symbol is trivial when the exponent and both ++global arguments are units at this place. -/ ++theorem finitePlaceHilbertSymbol_eq_one_of_valuation_eq_one ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) (v : HeightOneSpectrum (𝓞 K)) ++ (hva : v.valuation K (a : K) = 1) ++ (hvb : v.valuation K (b : K) = 1) ++ (hvn : v.valuation K ((n : ℕ) : K) = 1) : ++ finitePlaceHilbertSymbol K n hnK hmu v a b = 1 := by ++ let L := chosenSimpleKummerExtension K n hnK b ++ let : FiniteDimensional K L := ++ chosenSimpleKummerExtension_finiteDimensional K n hnK b ++ let : IsAbelianGalois K L := ++ chosenSimpleKummerExtension_isAbelianGalois K n hnK hmu b ++ let : NumberField L := NumberField.of_module_finite K L ++ have haIntegral : ++ IdeleGroup.finiteComponent v (IdeleGroup.principalIdele K a) ∈ ++ (v.adicCompletionIntegers K).units := by ++ rw [HeightOneSpectrum.adicCompletionIntegers.mem_units_iff_valued_eq_one] ++ rw [IdeleGroup.finiteComponent_principalIdele, ++ HeightOneSpectrum.valuedAdicCompletion_eq_valuation'] ++ exact hva ++ have hUnramified : ++ Algebra.IsUnramifiedAt (𝓞 K) ++ (finitePlaceExtensionCentre ++ (K := K) (L := L) v ++ (chosenFinitePlaceExtension (L := L) v)).asIdeal := by ++ apply ++ chosenSimpleKummerExtension_isUnramifiedAt_at_all_finitePlacesAbove_of_valuation_eq_one ++ (K := K) n hnK hmu b v hvb hvn ++ exact ++ finitePlaceBelow_finitePlaceExtensionCentre ++ (K := K) (L := L) v ++ (chosenFinitePlaceExtension (L := L) v) ++ have hArtin : ++ chosenFinitePlaceArtinMonoidHom (K := K) (L := L) v ++ (IdeleGroup.finiteComponent v (IdeleGroup.principalIdele K a)) = 1 := ++ chosenFinitePlaceArtinMonoidHom_eq_one_of_integral_of_unramifiedAt ++ (K := K) (L := L) v (IdeleGroup.principalIdele K a) ++ haIntegral hUnramified ++ rw [← finitePlaceKummerRootCharacter_localGlobal K n hnK hmu v a b] ++ unfold finitePlaceKummerRootCharacter ++ unfold finitePlaceKummerRootCharacterOfExtension ++ have hcomponent : ++ (IdeleGroup.finiteComponent v (IdeleGroup.principalIdele K a) : ++ (v.adicCompletion K)ˣ) = ++ Units.map (algebraMap K (v.adicCompletion K)).toMonoidHom a := by ++ apply Units.ext ++ calc ++ ((IdeleGroup.finiteComponent v (IdeleGroup.principalIdele K a) : ++ (v.adicCompletion K)ˣ) : v.adicCompletion K) = ++ ((a : K) : v.adicCompletion K) := ++ IdeleGroup.finiteComponent_principalIdele a v ++ _ = algebraMap K (v.adicCompletion K) (a : K) := by ++ symm ++ have hmap := congrFun ++ (IsDedekindDomain.HeightOneSpectrum.algebraMap_adicCompletion ++ (R := 𝓞 K) (S := K) (K := K) (v := v)) (a : K) ++ simpa using hmap ++ rw [hcomponent] at hArtin ++ unfold chosenFinitePlaceArtinMonoidHom at hArtin ++ dsimp only at hArtin ⊢ ++ rw [hArtin, map_one, map_one] ++ ++/-- Outside the concrete bad-place set, the finite-place Hilbert factor is ++trivial. -/ ++theorem finitePlaceHilbertSymbol_eq_one_of_not_mem_powerResidueBadFinitePlaces ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ powerResidueBadFinitePlaces K n a b) : ++ finitePlaceHilbertSymbol K n hnK hmu v a b = 1 := by ++ have hvaSupport : v ∉ chosenUnitFiniteSupport (K := K) a := by ++ intro hva ++ apply hv ++ exact Finset.mem_union_left _ (Finset.mem_union_left _ hva) ++ have hvbSupport : v ∉ chosenUnitFiniteSupport (K := K) b := by ++ intro hvb ++ apply hv ++ exact Finset.mem_union_left _ (Finset.mem_union_right _ hvb) ++ have hvnSupport : ++ v ∉ powerResidueExponentFinitePlaces K n := by ++ intro hvn ++ apply hv ++ exact Finset.mem_union_right _ hvn ++ have hva : v.valuation K (a : K) = 1 := ++ valuation_eq_one_of_not_mem_chosenUnitFiniteSupport K a v hvaSupport ++ have hvb : v.valuation K (b : K) = 1 := ++ valuation_eq_one_of_not_mem_chosenUnitFiniteSupport K b v hvbSupport ++ have hvn : v.valuation K ((n : ℕ) : K) = 1 := by ++ have hvnNotDvd : ++ ¬ v.asIdeal ∣ powerResidueExponentIdeal K n := by ++ simpa only [mem_powerResidueExponentFinitePlaces_iff] using hvnSupport ++ have hvnNotMem : ((n : ℕ) : 𝓞 K) ∉ v.asIdeal := by ++ intro hvnMem ++ apply hvnNotDvd ++ rw [powerResidueExponentIdeal, Ideal.dvd_span_singleton] ++ exact hvnMem ++ simpa only [map_natCast] using ++ (v.valuation_eq_one_iff_notMem (K := K) ++ (r := ((n : ℕ) : 𝓞 K))).2 hvnNotMem ++ exact finitePlaceHilbertSymbol_eq_one_of_valuation_eq_one ++ K n hnK hmu a b v hva hvb hvn ++ ++/-- The multiplicative support of the finite-place Hilbert factors is ++contained in the explicit power-residue bad-place set. -/ ++theorem finitePlaceHilbertSymbol_mulSupport_subset_powerResidueBadFinitePlaces ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) : ++ Function.mulSupport ++ (fun v : HeightOneSpectrum (𝓞 K) => ++ finitePlaceHilbertSymbol K n hnK hmu v a b) ⊆ ++ (powerResidueBadFinitePlaces K n a b : ++ Set (HeightOneSpectrum (𝓞 K))) := by ++ intro v hv ++ change finitePlaceHilbertSymbol K n hnK hmu v a b ≠ 1 at hv ++ change v ∈ powerResidueBadFinitePlaces K n a b ++ by_contra hvBad ++ exact hv ++ (finitePlaceHilbertSymbol_eq_one_of_not_mem_powerResidueBadFinitePlaces ++ K n hnK hmu a b v hvBad) ++ ++/-- The finite-place Hilbert `finprod` is the ordinary product over the ++explicit bad-place set. -/ ++theorem finitePlaceHilbertSymbol_finprod_eq_prod_powerResidueBadFinitePlaces ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) : ++ (∏ᶠ v : HeightOneSpectrum (𝓞 K), ++ finitePlaceHilbertSymbol K n hnK hmu v a b) = ++ ∏ v ∈ powerResidueBadFinitePlaces K n a b, ++ finitePlaceHilbertSymbol K n hnK hmu v a b := by ++ rw [finprod_eq_prod_of_mulSupport_subset _ ++ (finitePlaceHilbertSymbol_mulSupport_subset_powerResidueBadFinitePlaces ++ K n hnK hmu a b)] ++ ++/-- Finite-set form of the Hilbert product formula: the product over all ++explicitly bad finite places is the inverse of the infinite-place product. -/ ++theorem powerResidueBadFinitePlaces_product_eq_infinitePlaceProduct_inv ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) : ++ (∏ v ∈ powerResidueBadFinitePlaces K n a b, ++ finitePlaceHilbertSymbol K n hnK hmu v a b) = ++ (∏ v : InfinitePlace K, ++ infinitePlaceHilbertSymbol K n v a b)⁻¹ := by ++ have hproduct := ++ hilbertSymbol_allPlaces_product_eq_one K n hnK hmu a b ++ rw [ ++ finitePlaceHilbertSymbol_finprod_eq_prod_powerResidueBadFinitePlaces] ++ at hproduct ++ exact (eq_inv_iff_mul_eq_one).2 (by ++ simpa only [mul_comm] using hproduct) ++ ++/-- The product of the finite-place Hilbert factors away from primes dividing ++the exponent. C1 identifies this term with the quotient of the two ideal ++power-residue symbols; the remaining factors are exactly the correction. -/ ++noncomputable def powerResidueAwayFromExponentFiniteProduct ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) : ++ nthRootsSubgroup K (n : ℕ) := ++ ∏ᶠ v : HeightOneSpectrum (𝓞 K), ++ if v ∈ powerResidueExponentFinitePlaces K n then ++ 1 ++ else ++ finitePlaceHilbertSymbol K n hnK hmu v a b ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityGlobal.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityGlobal.lean +new file mode 100644 +index 0000000..8a60735 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityGlobal.lean +@@ -0,0 +1,416 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.PowerResidueReciprocityCorrection ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.HilbertProductFormula ++import ClassFieldTheory.AlgebraicNumberTheory.PowerResidueSymbols.Ideal ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormApproximation.FinitePlaces ++import Mathlib.NumberTheory.Padics.HeightOneSpectrum ++import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicField ++import ClassFieldTheory.AlgebraicNumberTheory.QuadraticReciprocity ++import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Rational ++import ClassFieldTheory.LocalClassFieldTheory.Kummer.PowerResidueTameFormula ++import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.IdealQuotients ++import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion ++import ValuedFieldTheory.Valuation.Completion.ExtensionInvariants ++import ClassFieldTheory.KummerTheory.Concrete.SimpleExtensionLocalBehavior ++import ClassFieldTheory.KummerTheory.Concrete.SUnitPreparation.FiniteRadicalSupport ++import ClassFieldTheory.LocalClassFieldTheory.Finite.CyclotomicNorm.PrincipalUnits ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped BigOperators Classical NumberField NumberTheorySymbols ValuativeRel WithZero ++open NumberField IsDedekindDomain ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open KummerTheory ++open AlgebraicNumberTheory.PowerResidueSymbols ++open LocalClassFieldTheory.Kummer ++open LocalFieldTheory ++open LocalFieldTheory.IsNonarchimedeanLocalField ++ ++variable (K : Type) [Field K] [NumberField K] ++/-- The complete tame finite-place product for two nonzero algebraic ++integers is the quotient of the two ideal power-residue symbols. -/ ++theorem powerResidueAwayFromExponentFiniteProduct_integral_eq_idealSymbol_div ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) ++ (hcoprimeA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → ++ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) ++ (hcoprimeB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → ++ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) ++ (haB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → a ∉ P.asIdeal) ++ (hbA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → b ∉ P.asIdeal) ++ (hAwayA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → ++ P ∉ powerResidueExponentFinitePlaces K n) ++ (hAwayB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → ++ P ∉ powerResidueExponentFinitePlaces K n) : ++ powerResidueAwayFromExponentFiniteProduct K n hnK hmu ++ (nonzeroIntegralFieldUnit K a ha0) ++ (nonzeroIntegralFieldUnit K b hb0) = ++ integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K (Ideal.span {b}) ++ (ideal_span_singleton_ne_zero K hb0) ++ n hmu a hcoprimeB haB) * ++ (integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K (Ideal.span {a}) ++ (ideal_span_singleton_ne_zero K ha0) ++ n hmu b hcoprimeA hbA))⁻¹ := by ++ let IA : Ideal (𝓞 K) := Ideal.span {a} ++ let IB : Ideal (𝓞 K) := Ideal.span {b} ++ have hIA : IA ≠ 0 := by ++ dsimp only [IA] ++ exact ideal_span_singleton_ne_zero K ha0 ++ have hIB : IB ≠ 0 := by ++ dsimp only [IB] ++ exact ideal_span_singleton_ne_zero K hb0 ++ let fB : HeightOneSpectrum (𝓞 K) → nthRootsSubgroup K (n : ℕ) := ++ fun P => integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueFactor K IB n hmu a hcoprimeB haB P) ++ let fA : HeightOneSpectrum (𝓞 K) → nthRootsSubgroup K (n : ℕ) := ++ fun P => integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueFactor K IA n hmu b hcoprimeA hbA P) ++ have hfB : Function.HasFiniteMulSupport fB := ++ (idealPowerResidueFactor_hasFiniteMulSupport ++ K IB hIB n hmu a hcoprimeB haB).subset (by ++ intro P hP ++ change fB P ≠ 1 at hP ++ change idealPowerResidueFactor K IB n hmu a hcoprimeB haB P ≠ 1 ++ intro hOne ++ exact hP (by simp only [fB, hOne, map_one])) ++ have hfA : Function.HasFiniteMulSupport fA := ++ (idealPowerResidueFactor_hasFiniteMulSupport ++ K IA hIA n hmu b hcoprimeA hbA).subset (by ++ intro P hP ++ change fA P ≠ 1 at hP ++ change idealPowerResidueFactor K IA n hmu b hcoprimeA hbA P ≠ 1 ++ intro hOne ++ exact hP (by simp only [fA, hOne, map_one])) ++ have hfAInv : ++ Function.HasFiniteMulSupport (fun P => (fA P)⁻¹) := ++ hfA.subset (by ++ intro P hP ++ change (fA P)⁻¹ ≠ 1 at hP ++ change fA P ≠ 1 ++ intro hOne ++ exact hP (by rw [hOne, inv_one])) ++ let invHom : nthRootsSubgroup K (n : ℕ) →* ++ nthRootsSubgroup K (n : ℕ) := invMonoidHom ++ have hfinprodInv : ++ (∏ᶠ P : HeightOneSpectrum (𝓞 K), (fA P)⁻¹) = ++ (∏ᶠ P : HeightOneSpectrum (𝓞 K), fA P)⁻¹ := by ++ change (∏ᶠ P : HeightOneSpectrum (𝓞 K), invHom (fA P)) = ++ invHom (∏ᶠ P : HeightOneSpectrum (𝓞 K), fA P) ++ exact (MonoidHom.map_finprod invHom hfA).symm ++ calc ++ powerResidueAwayFromExponentFiniteProduct K n hnK hmu ++ (nonzeroIntegralFieldUnit K a ha0) ++ (nonzeroIntegralFieldUnit K b hb0) = ++ ∏ᶠ P : HeightOneSpectrum (𝓞 K), fB P * (fA P)⁻¹ := by ++ apply finprod_congr ++ intro P ++ simpa only [fA, fB, IA, IB] using ++ powerResidueAwayFromExponentFiniteFactor_integral_eq_idealFactors ++ K n hnK hmu a b ha0 hb0 hcoprimeA hcoprimeB haB hbA ++ hAwayA hAwayB P ++ _ = (∏ᶠ P : HeightOneSpectrum (𝓞 K), fB P) * ++ (∏ᶠ P : HeightOneSpectrum (𝓞 K), (fA P)⁻¹) := ++ finprod_mul_distrib hfB hfAInv ++ _ = (∏ᶠ P : HeightOneSpectrum (𝓞 K), fB P) * ++ (∏ᶠ P : HeightOneSpectrum (𝓞 K), fA P)⁻¹ := by ++ rw [hfinprodInv] ++ _ = integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K IB hIB n hmu a hcoprimeB haB) * ++ (integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K IA hIA n hmu b hcoprimeA hbA))⁻¹ := by ++ rw [idealPowerResidueSymbol_eq_finprod, ++ idealPowerResidueSymbol_eq_finprod] ++ rw [MonoidHom.map_finprod ++ (integralRootsOfUnityToNthRoots K (n : ℕ)) ++ (idealPowerResidueFactor_hasFiniteMulSupport ++ K IB hIB n hmu a hcoprimeB haB), ++ MonoidHom.map_finprod ++ (integralRootsOfUnityToNthRoots K (n : ℕ)) ++ (idealPowerResidueFactor_hasFiniteMulSupport ++ K IA hIA n hmu b hcoprimeA hbA)] ++ _ = integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K (Ideal.span {b}) ++ (ideal_span_singleton_ne_zero K hb0) ++ n hmu a hcoprimeB haB) * ++ (integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K (Ideal.span {a}) ++ (ideal_span_singleton_ne_zero K ha0) ++ n hmu b hcoprimeA hbA))⁻¹ := by ++ rfl ++ ++/-- Split the full finite-place product into exponent-prime factors and the ++product away from the exponent. -/ ++theorem finitePlaceHilbertSymbol_finprod_eq_exponent_product_mul_away ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) : ++ (∏ᶠ v : HeightOneSpectrum (𝓞 K), ++ finitePlaceHilbertSymbol K n hnK hmu v a b) = ++ (∏ v ∈ powerResidueExponentFinitePlaces K n, ++ finitePlaceHilbertSymbol K n hnK hmu v a b) * ++ powerResidueAwayFromExponentFiniteProduct K n hnK hmu a b := by ++ let exponentFactor : HeightOneSpectrum (𝓞 K) → ++ nthRootsSubgroup K (n : ℕ) := fun v => ++ if v ∈ powerResidueExponentFinitePlaces K n then ++ finitePlaceHilbertSymbol K n hnK hmu v a b ++ else ++ 1 ++ let awayFactor : HeightOneSpectrum (𝓞 K) → ++ nthRootsSubgroup K (n : ℕ) := fun v => ++ if v ∈ powerResidueExponentFinitePlaces K n then ++ 1 ++ else ++ finitePlaceHilbertSymbol K n hnK hmu v a b ++ have hExponentSupport : ++ Function.mulSupport exponentFactor ⊆ ++ (powerResidueExponentFinitePlaces K n : ++ Set (HeightOneSpectrum (𝓞 K))) := by ++ intro v hv ++ change exponentFactor v ≠ 1 at hv ++ change v ∈ powerResidueExponentFinitePlaces K n ++ by_contra hvExponent ++ exact hv (by simp only [exponentFactor, ite_eq_right hvExponent]) ++ have hExponentFinite : Function.HasFiniteMulSupport exponentFactor := by ++ rw [Function.HasFiniteMulSupport] ++ exact ++ (powerResidueExponentFinitePlaces K n).finite_toSet.subset ++ hExponentSupport ++ have hAwayFinite : Function.HasFiniteMulSupport awayFactor := by ++ rw [Function.HasFiniteMulSupport] ++ exact ++ (finitePlaceHilbertSymbol_hasFiniteMulSupport K n hnK hmu a b).subset ++ (by ++ intro v hv ++ change awayFactor v ≠ 1 at hv ++ change finitePlaceHilbertSymbol K n hnK hmu v a b ≠ 1 ++ by_contra hvOne ++ exact hv (by simp only [awayFactor, hvOne, ite_self])) ++ have hPointwise : ++ (fun v : HeightOneSpectrum (𝓞 K) => ++ finitePlaceHilbertSymbol K n hnK hmu v a b) = ++ fun v => exponentFactor v * awayFactor v := by ++ funext v ++ by_cases hv : v ∈ powerResidueExponentFinitePlaces K n ++ · simp only [exponentFactor, awayFactor, ite_eq_left hv, mul_one] ++ · simp only [exponentFactor, awayFactor, ite_eq_right hv, one_mul] ++ have hExponentProduct : ++ (∏ᶠ v : HeightOneSpectrum (𝓞 K), exponentFactor v) = ++ ∏ v ∈ powerResidueExponentFinitePlaces K n, ++ finitePlaceHilbertSymbol K n hnK hmu v a b := by ++ rw [finprod_eq_prod_of_mulSupport_subset exponentFactor hExponentSupport] ++ apply Finset.prod_congr rfl ++ intro v hv ++ simp only [exponentFactor, ite_eq_left hv] ++ calc ++ (∏ᶠ v : HeightOneSpectrum (𝓞 K), ++ finitePlaceHilbertSymbol K n hnK hmu v a b) = ++ ∏ᶠ v : HeightOneSpectrum (𝓞 K), ++ exponentFactor v * awayFactor v := by ++ rw [hPointwise] ++ _ = (∏ᶠ v : HeightOneSpectrum (𝓞 K), exponentFactor v) * ++ (∏ᶠ v : HeightOneSpectrum (𝓞 K), awayFactor v) := ++ finprod_mul_distrib hExponentFinite hAwayFinite ++ _ = (∏ v ∈ powerResidueExponentFinitePlaces K n, ++ finitePlaceHilbertSymbol K n hnK hmu v a b) * ++ (∏ᶠ v : HeightOneSpectrum (𝓞 K), awayFactor v) := by ++ rw [hExponentProduct] ++ _ = (∏ v ∈ powerResidueExponentFinitePlaces K n, ++ finitePlaceHilbertSymbol K n hnK hmu v a b) * ++ powerResidueAwayFromExponentFiniteProduct K n hnK hmu a b := by ++ rfl ++ ++/-- General Hilbert-product core of power-residue reciprocity. The complete ++finite product away from the exponent is the inverse of the explicit product ++of all infinite-place factors and all exponent-prime factors. -/ ++theorem powerResidueAwayFromExponentFiniteProduct_eq_badPlaceCorrection_inv ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : Kˣ) : ++ powerResidueAwayFromExponentFiniteProduct K n hnK hmu a b = ++ (powerResidueBadPlaceCorrection K n hnK hmu a b)⁻¹ := by ++ have hproduct := ++ hilbertSymbol_allPlaces_product_eq_one K n hnK hmu a b ++ rw [finitePlaceHilbertSymbol_finprod_eq_exponent_product_mul_away] ++ at hproduct ++ exact (eq_inv_iff_mul_eq_one).2 (by ++ unfold powerResidueBadPlaceCorrection ++ simpa only [mul_assoc, mul_comm, mul_left_comm] using hproduct) ++ ++/-- General ideal power-residue reciprocity with the explicit product of ++infinite and exponent-prime Hilbert factors as correction. -/ ++theorem idealPowerResidueSymbol_reciprocity_with_bad_place_correction ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (a b : 𝓞 K) (ha0 : a ≠ 0) (hb0 : b ≠ 0) ++ (hcoprimeA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → ++ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) ++ (hcoprimeB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → ++ (Ideal.absNorm P.asIdeal).Coprime (n : ℕ)) ++ (haB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → a ∉ P.asIdeal) ++ (hbA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → b ∉ P.asIdeal) ++ (hAwayA : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {a} → ++ P ∉ powerResidueExponentFinitePlaces K n) ++ (hAwayB : ++ ∀ P : HeightOneSpectrum (𝓞 K), ++ P.asIdeal ∣ Ideal.span {b} → ++ P ∉ powerResidueExponentFinitePlaces K n) : ++ integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K (Ideal.span {b}) ++ (ideal_span_singleton_ne_zero K hb0) ++ n hmu a hcoprimeB haB) = ++ (powerResidueBadPlaceCorrection K n hnK hmu ++ (nonzeroIntegralFieldUnit K a ha0) ++ (nonzeroIntegralFieldUnit K b hb0))⁻¹ * ++ integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K (Ideal.span {a}) ++ (ideal_span_singleton_ne_zero K ha0) ++ n hmu b hcoprimeA hbA) := by ++ let symbolAB := integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K (Ideal.span {b}) ++ (ideal_span_singleton_ne_zero K hb0) ++ n hmu a hcoprimeB haB) ++ let symbolBA := integralRootsOfUnityToNthRoots K (n : ℕ) ++ (idealPowerResidueSymbol K (Ideal.span {a}) ++ (ideal_span_singleton_ne_zero K ha0) ++ n hmu b hcoprimeA hbA) ++ let correction := powerResidueBadPlaceCorrection K n hnK hmu ++ (nonzeroIntegralFieldUnit K a ha0) ++ (nonzeroIntegralFieldUnit K b hb0) ++ have hIdeal := ++ powerResidueAwayFromExponentFiniteProduct_integral_eq_idealSymbol_div ++ K n hnK hmu a b ha0 hb0 hcoprimeA hcoprimeB haB hbA ++ hAwayA hAwayB ++ have hCorrection := ++ powerResidueAwayFromExponentFiniteProduct_eq_badPlaceCorrection_inv ++ K n hnK hmu ++ (nonzeroIntegralFieldUnit K a ha0) ++ (nonzeroIntegralFieldUnit K b hb0) ++ have hQuotient : symbolAB * symbolBA⁻¹ = correction⁻¹ := by ++ rw [← hIdeal, hCorrection] ++ change symbolAB = correction⁻¹ * symbolBA ++ calc ++ symbolAB = (symbolAB * symbolBA⁻¹) * symbolBA := by ++ simp only [mul_assoc, inv_mul_cancel, mul_one] ++ _ = correction⁻¹ * symbolBA := by rw [hQuotient] ++ ++/-! ## Quadratic specialization over the rational field -/ ++ ++open AlgebraicNumberTheory.PowerResidueSymbols ++ ++local instance rationalPrimeFact (p : Nat.Primes) : Fact p.1.Prime := ++ ⟨p.2⟩ ++ ++/-- The rational field contains the primitive square root of unity `-1`. ++This is the canonical source of the primitive-root input in the quadratic ++specialization; no root is chosen downstream. -/ ++theorem rationalQuadraticPrimitiveRoots_nonempty : ++ (primitiveRoots 2 ℚ).Nonempty := by ++ refine ⟨-1, (mem_primitiveRoots (by decide)).2 ?_⟩ ++ exact IsPrimitiveRoot.neg_one 0 (by decide) ++ ++/-- The residue field at the rational prime over `p` is canonically `ZMod p`. ++The construction first transports the prime ideal through ++`Rat.ringOfIntegersEquiv` and then uses the standard integer quotient. -/ ++noncomputable def rationalPrimeResidueEquivZMod ++ (p : Nat.Primes) : ++ (𝓞 ℚ ⧸ (RayClass.rationalPrime p).asIdeal) ≃+* ZMod p.1 := by ++ have hIntEquiv : ++ Rat.IsIntegralClosure.intEquiv (𝓞 ℚ) = ++ Rat.ringOfIntegersEquiv := by ++ ext x ++ exact Rat.IsIntegralClosure.intEquiv_apply_eq_ringOfIntegersEquiv x ++ have hmap : ++ Ideal.span {(p.1 : ℤ)} = ++ (RayClass.rationalPrime p).asIdeal.map ++ Rat.ringOfIntegersEquiv := by ++ simpa only [RayClass.natGenerator_rationalPrime, hIntEquiv] using ++ (Rat.HeightOneSpectrum.span_natGenerator ++ (RayClass.rationalPrime p)) ++ exact ++ (Ideal.quotientEquiv ++ (RayClass.rationalPrime p).asIdeal ++ (Ideal.span {(p.1 : ℤ)}) ++ Rat.ringOfIntegersEquiv hmap).trans ++ (Int.quotientSpanNatEquivZMod p.1) ++ ++/-- The rational residue-field equivalence sends an integral residue class to ++the corresponding integer class modulo `p`. -/ ++@[simp] ++theorem rationalPrimeResidueEquivZMod_mk ++ (p : Nat.Primes) (a : 𝓞 ℚ) : ++ rationalPrimeResidueEquivZMod p ++ (Ideal.Quotient.mk (RayClass.rationalPrime p).asIdeal a) = ++ (Rat.ringOfIntegersEquiv a : ZMod p.1) := by ++ rw [rationalPrimeResidueEquivZMod, RingEquiv.trans_apply] ++ have hmk ++ (hIJ : ++ Ideal.span {(p.1 : ℤ)} = ++ (RayClass.rationalPrime p).asIdeal.map ++ Rat.ringOfIntegersEquiv) : ++ Ideal.quotientEquiv ++ (RayClass.rationalPrime p).asIdeal ++ (Ideal.span {(p.1 : ℤ)}) ++ Rat.ringOfIntegersEquiv hIJ ++ (Ideal.Quotient.mk (RayClass.rationalPrime p).asIdeal a) = ++ Ideal.Quotient.mk (Ideal.span {(p.1 : ℤ)}) ++ (Rat.ringOfIntegersEquiv a) := ++ Ideal.quotientEquiv_mk ++ (RayClass.rationalPrime p).asIdeal ++ (Ideal.span {(p.1 : ℤ)}) ++ Rat.ringOfIntegersEquiv hIJ a ++ have hquot : ++ ((Int.quotientSpanNatEquivZMod p.1 : ++ (ℤ ⧸ Ideal.span {(p.1 : ℤ)}) →+* ZMod p.1).comp ++ (Ideal.Quotient.mk (Ideal.span {(p.1 : ℤ)}))) = ++ Int.castRingHom (ZMod p.1) := ++ Int.quotientSpanNatEquivZMod_comp_Quotient_mk p.1 ++ calc ++ _ = Int.quotientSpanNatEquivZMod p.1 ++ (Ideal.Quotient.mk (Ideal.span {(p.1 : ℤ)}) ++ (Rat.ringOfIntegersEquiv a)) := ++ congrArg (Int.quotientSpanNatEquivZMod p.1) (hmk _) ++ _ = _ := congrArg ++ (fun f : ℤ →+* ZMod p.1 => f (Rat.ringOfIntegersEquiv a)) hquot ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityLocalSymbols.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityLocalSymbols.lean +new file mode 100644 +index 0000000..92d5938 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/PowerResidueReciprocityLocalSymbols.lean +@@ -0,0 +1,557 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.PowerResidueReciprocityBase ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.GlobalHilbertSymbol.FinitePlaceCharacterComparison ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.FiniteIdeleArtin ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.HilbertProductFormula ++import ClassFieldTheory.AlgebraicNumberTheory.PowerResidueSymbols.Ideal ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.NormApproximation.FinitePlaces ++import Mathlib.NumberTheory.Padics.HeightOneSpectrum ++import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicField ++import ClassFieldTheory.AlgebraicNumberTheory.QuadraticReciprocity ++import ClassFieldTheory.AlgebraicNumberTheory.RayClass.Rational ++import ClassFieldTheory.LocalClassFieldTheory.Kummer.PowerResidueTameFormula ++import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.IdealQuotients ++import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion ++import ValuedFieldTheory.Valuation.Completion.ExtensionInvariants ++import ClassFieldTheory.KummerTheory.Concrete.SimpleExtensionLocalBehavior ++import ClassFieldTheory.KummerTheory.Concrete.SUnitPreparation.FiniteRadicalSupport ++import ClassFieldTheory.LocalClassFieldTheory.Finite.CyclotomicNorm.PrincipalUnits ++ ++ ++set_option autoImplicit false ++ ++ ++open scoped BigOperators Classical NumberField NumberTheorySymbols ValuativeRel WithZero ++open NumberField IsDedekindDomain ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++open KummerTheory ++open AlgebraicNumberTheory.PowerResidueSymbols ++open LocalClassFieldTheory.Kummer ++open LocalFieldTheory ++open LocalFieldTheory.IsNonarchimedeanLocalField ++ ++variable (K : Type) [Field K] [NumberField K] ++/-- The integral principal ideal generated by the exponent. -/ ++def powerResidueExponentIdeal (n : ℕ+) : Ideal (𝓞 K) := ++ Ideal.span {((n : ℕ) : 𝓞 K)} ++ ++/-- The exponent ideal is nonzero in a number field. -/ ++theorem powerResidueExponentIdeal_ne_zero (n : ℕ+) : ++ powerResidueExponentIdeal K n ≠ 0 := by ++ change Ideal.span {((n : ℕ) : 𝓞 K)} ≠ ⊥ ++ exact Ideal.span_singleton_eq_bot.not.mpr ++ (Nat.cast_ne_zero.mpr n.ne_zero) ++ ++omit [NumberField K] in ++theorem ideal_span_singleton_ne_zero ++ {x : 𝓞 K} (hx : x ≠ 0) : Ideal.span {x} ≠ 0 := ++ Submodule.span_singleton_eq_bot.mp.mt hx ++ ++/-- The finite places dividing the exponent. These, together with all ++infinite places, are precisely the correction places in the reciprocity ++formula once the two principal denominator supports are removed. -/ ++noncomputable def powerResidueExponentFinitePlaces ++ (n : ℕ+) : Finset (HeightOneSpectrum (𝓞 K)) := ++ (Ideal.finite_factors ++ (powerResidueExponentIdeal_ne_zero K n)).toFinset ++ ++/-- Membership in the exponent-place support is divisibility by the exponent ++ideal. -/ ++@[simp] ++theorem mem_powerResidueExponentFinitePlaces_iff ++ (n : ℕ+) (v : HeightOneSpectrum (𝓞 K)) : ++ v ∈ powerResidueExponentFinitePlaces K n ↔ ++ v.asIdeal ∣ powerResidueExponentIdeal K n := ++ Set.Finite.mem_toFinset ++ (Ideal.finite_factors ++ (powerResidueExponentIdeal_ne_zero K n)) ++ ++/-- At a finite place not dividing the exponent, the exponent is a unit in ++the canonical completion. -/ ++theorem finitePlace_natCast_valuation_eq_one_of_not_mem_exponent ++ (n : ℕ+) (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ ValuativeRel.valuation C ((n : ℕ) : C) = 1 := by ++ dsimp only ++ let : IsUltrametricDist ++ (HeightOneSpectrum.adicAbv K v).Completion := ++ finitePlaceArtinCompletionIsUltrametricDist ++ (HeightOneSpectrum.adicAbv K v) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv K v) ++ have hvNotDvd : ++ ¬ v.asIdeal ∣ powerResidueExponentIdeal K n := by ++ simpa only [mem_powerResidueExponentFinitePlaces_iff] using hv ++ have hvNotMem : ((n : ℕ) : 𝓞 K) ∉ v.asIdeal := by ++ intro hvMem ++ apply hvNotDvd ++ rw [powerResidueExponentIdeal, Ideal.dvd_span_singleton] ++ exact hvMem ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ have hNorm : ‖((n : ℕ) : C)‖ = 1 := by ++ calc ++ ‖((n : ℕ) : C)‖ = ++ ‖algebraMap K C (((n : ℕ) : K))‖ := by rw [map_natCast] ++ _ = HeightOneSpectrum.adicAbv K v (((n : ℕ) : K)) := ++ AbsoluteValue.completionAbsoluteValue_coe ++ (HeightOneSpectrum.adicAbv K v) (((n : ℕ) : K)) ++ _ = ‖NumberField.FinitePlace.embedding v (((n : ℕ) : K))‖ := ++ (NumberField.FinitePlace.norm_embedding v (((n : ℕ) : K))).symm ++ _ = 1 := ++ (NumberField.FinitePlace.norm_eq_one_iff_notMem K v ++ (((n : ℕ) : 𝓞 K))).2 hvNotMem ++ let vCNorm := NormedField.valuation (K := C) ++ let : vCNorm.Compatible := Valuation.Compatible.ofValuation vCNorm ++ have hnCNorm : vCNorm ((n : ℕ) : C) = 1 := by ++ change ‖((n : ℕ) : C)‖₊ = 1 ++ exact NNReal.eq (by simpa using hNorm) ++ exact ++ (ValuativeRel.isEquiv vCNorm (ValuativeRel.valuation C)) ++ |>.eq_one_iff_eq_one.mp hnCNorm ++ ++private noncomputable def finitePlaceLocalTamePowerResidueSymbolValue ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ nthRootsSubgroup (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ) := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ exact localTamePowerResidueSymbol C n ++ (finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv) ++ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) ++ (finitePlaceIntegralCompletionUnit K v a ha) ++ ++private noncomputable def finitePlaceLocalTamePowerResidueSymbolFieldValue ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ (HeightOneSpectrum.adicAbv K v).Completion := ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ ((localTamePowerResidueSymbol C n ++ (finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv) ++ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) ++ (finitePlaceIntegralCompletionUnit K v a ha)).1 : C) ++ ++private noncomputable def finitePlacePrimeIdealPowerResidueIntegralRoot ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ rootsOfUnity (n : ℕ) (𝓞 K) := ++ AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol ++ K v n hmu hcoprime a ha ++ ++private noncomputable def finitePlacePrimeIdealPowerResidueGlobalRoot ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : nthRootsSubgroup K (n : ℕ) := ++ integralRootsOfUnityToNthRoots K (n : ℕ) ++ (finitePlacePrimeIdealPowerResidueIntegralRoot K v n hmu hcoprime a ha) ++ ++private noncomputable def finitePlacePrimeIdealPowerResidueFactorValue ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ nthRootsSubgroup (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ) := ++ nthRootsSubgroupMap K (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ) ++ (finitePlacePrimeIdealPowerResidueGlobalRoot K v n hmu hcoprime a ha) ++ ++private noncomputable def finitePlacePrimeIdealPowerResidueFactorFieldValue ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ (HeightOneSpectrum.adicAbv K v).Completion := ++ (((nthRootsSubgroupMap K ++ (HeightOneSpectrum.adicAbv K v).Completion (n : ℕ)) ++ (finitePlacePrimeIdealPowerResidueGlobalRoot K v n hmu hcoprime a ha)).1 : ++ (HeightOneSpectrum.adicAbv K v).Completion) ++ ++private noncomputable def finitePlaceLocalTamePowerResidueSymbolResidueValue ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ 𝓀[C] := by ++ dsimp only ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ letI : Fintype 𝓀[C] := Fintype.ofFinite _ ++ have hnLocal : (n : ℕ) ∣ Fintype.card 𝓀[C] - 1 := by ++ rw [← Nat.card_eq_fintype_card] ++ exact dvd_residueCard_sub_one_of_primitiveRoots C n ++ (finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv) ++ (finitePlaceHilbert_primitiveRoots_nonempty K n hmu v) ++ exact ++ (((AlgebraicNumberTheory.PowerResidueSymbols.finiteFieldPowerResidueSymbol ++ 𝓀[C] n hnLocal ++ (integerUnitsToResidueUnits C ++ (finitePlaceIntegralCompletionUnit K v a ha)) : ++ rootsOfUnity (n : ℕ) 𝓀[C]).1 : 𝓀[C]ˣ) : 𝓀[C]) ++ ++private noncomputable def finitePlacePrimeIdealPowerResidueFactorResidueValue ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ 𝓀[C] := by ++ dsimp only ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ exact ++ (((localNthRootsReduction C n ++ (nthRootsSubgroupMap K C (n : ℕ) ++ (integralRootsOfUnityToNthRoots K (n : ℕ) ++ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol ++ K v n hmu hcoprime a ha)))).1 : 𝓀[C]ˣ) : 𝓀[C]) ++ ++/-- The tame symbol in a finite-place completion is the image of the ++prime-ideal power-residue symbol. All comparisons are canonical: the only ++place hypothesis says that the place does not divide the exponent. -/ ++private theorem finitePlaceLocalTamePowerResidueSymbol_residueValue_eq ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ finitePlaceLocalTamePowerResidueSymbolResidueValue K v n hmu hv a ha = ++ finitePlacePrimeIdealPowerResidueFactorResidueValue ++ K v n hmu hcoprime a ha := by ++ unfold finitePlaceLocalTamePowerResidueSymbolResidueValue ++ unfold finitePlacePrimeIdealPowerResidueFactorResidueValue ++ dsimp only ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ let : ValuativeRel C := finitePlaceLocalArtinCompletionValuativeRel v ++ let : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ let : Field (𝓞 K ⧸ v.asIdeal) := Ideal.Quotient.field v.asIdeal ++ let : Fintype (𝓞 K ⧸ v.asIdeal) := Fintype.ofFinite _ ++ let : Fintype 𝓀[C] := Fintype.ofFinite _ ++ let hnC := finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv ++ let hmuC := finitePlaceHilbert_primitiveRoots_nonempty K n hmu v ++ have hnPrime : ++ (n : ℕ) ∣ Fintype.card (𝓞 K ⧸ v.asIdeal) - 1 := by ++ rw [AlgebraicNumberTheory.PowerResidueSymbols.card_primeIdealResidueField K v] ++ exact ++ AlgebraicNumberTheory.PowerResidueSymbols.dvd_absNorm_sub_one_of_primitiveRoots ++ K v n hmu hcoprime ++ have hnLocal : (n : ℕ) ∣ Fintype.card 𝓀[C] - 1 := by ++ rw [← Nat.card_eq_fintype_card] ++ exact dvd_residueCard_sub_one_of_primitiveRoots C n hnC hmuC ++ rw [finitePlace_localNthRootsReduction_integralRoots] ++ rw [← AlgebraicNumberTheory.PowerResidueSymbols.rootsOfUnityReductionEquiv_apply ++ K v n hmu hcoprime, ++ AlgebraicNumberTheory.PowerResidueSymbols.rootsOfUnityReductionEquiv_primeIdealPowerResidueSymbol ++ K v n hmu hcoprime a ha] ++ rw [finitePlace_integerUnitsToResidueUnits_integralUnit] ++ exact congrArg (fun u : 𝓀[C]ˣ => (u : 𝓀[C])) ++ (finiteFieldPowerResidueSymbol_unitsMap_ringEquiv ++ (finitePlacePrimeResidueEquivLocalResidue K v) ++ n hnPrime hnLocal ++ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealResidueUnit ++ K v a ha)).symm ++ ++private theorem finitePlaceLocalTamePowerResidueSymbolFieldValue_eq_primeIdealValue ++ (v : HeightOneSpectrum (𝓞 K)) (n : ℕ+) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) : ++ @Eq (HeightOneSpectrum.adicAbv K v).Completion ++ (finitePlaceLocalTamePowerResidueSymbolFieldValue K v n hmu hv a ha) ++ (finitePlacePrimeIdealPowerResidueFactorFieldValue ++ K v n hmu hcoprime a ha) := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ let : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ let : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ let hnC := ++ finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv ++ let hmuC := finitePlaceHilbert_primitiveRoots_nonempty K n hmu v ++ unfold finitePlaceLocalTamePowerResidueSymbolFieldValue ++ unfold finitePlacePrimeIdealPowerResidueFactorFieldValue ++ unfold finitePlacePrimeIdealPowerResidueGlobalRoot ++ unfold finitePlacePrimeIdealPowerResidueIntegralRoot ++ have hRoots : ++ localTamePowerResidueSymbol C n hnC hmuC ++ (finitePlaceIntegralCompletionUnit K v a ha) = ++ nthRootsSubgroupMap K C (n : ℕ) ++ (integralRootsOfUnityToNthRoots K (n : ℕ) ++ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol ++ K v n hmu hcoprime a ha)) := by ++ apply (localNthRootsReductionEquiv C n hnC hmuC).injective ++ rw [localNthRootsReductionEquiv_localTamePowerResidueSymbol] ++ apply Subtype.ext ++ apply Units.ext ++ have hResidue := finitePlaceLocalTamePowerResidueSymbol_residueValue_eq ++ K v n hmu hcoprime hv a ha ++ unfold finitePlaceLocalTamePowerResidueSymbolResidueValue at hResidue ++ unfold finitePlacePrimeIdealPowerResidueFactorResidueValue at hResidue ++ dsimp only at hResidue ++ exact hResidue ++ exact congrArg (fun q : nthRootsSubgroup C (n : ℕ) => (q.1 : C)) hRoots ++ ++/-- The normalized additive valuation of a global field unit in the ++canonical completion at a finite place. -/ ++noncomputable def finitePlaceNormalizedValuation ++ (v : HeightOneSpectrum (𝓞 K)) (x : Kˣ) : ℤ := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ letI : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ letI : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ exact valuationMap C ++ (Additive.ofMul (finitePlaceHilbert_completionUnit K v x)) ++ ++/-- Away from the exponent, a finite-place Hilbert factor with integral-unit ++first entry is the prime-ideal power-residue symbol raised to the negative ++normalized valuation of the second entry. -/ ++theorem finitePlaceHilbertSymbol_eq_primeIdealPowerResidueFactor_zpow ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) (b : Kˣ) : ++ finitePlaceHilbertSymbol K n hnK hmu v ++ (primeAvoidingIntegralFieldUnit K v a ha) b = ++ integralRootsOfUnityToNthRoots K (n : ℕ) ++ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol ++ K v n hmu hcoprime a ha) ^ ++ (-finitePlaceNormalizedValuation K v b) := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ let : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ let : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ let hnC := ++ finitePlace_natCast_valuation_eq_one_of_not_mem_exponent K n v hv ++ let hmuC := finitePlaceHilbert_primitiveRoots_nonempty K n hmu v ++ let bC := finitePlaceHilbert_completionUnit K v b ++ apply nthRootsSubgroupMap_injective K C (n : ℕ) ++ rw [finitePlaceHilbertSymbol_map_eq_localHilbertSymbol] ++ change ++ localHilbertSymbol C n ++ (finitePlaceHilbert_natCast_ne_zero K n hnK v) hmuC ++ (finitePlaceHilbert_completionUnit K v ++ (primeAvoidingIntegralFieldUnit K v a ha)) bC = ++ nthRootsSubgroupMap K C (n : ℕ) ++ (integralRootsOfUnityToNthRoots K (n : ℕ) ++ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol ++ K v n hmu hcoprime a ha) ^ ++ (-finitePlaceNormalizedValuation K v b)) ++ rw [finitePlaceHilbert_completionUnit_primeAvoidingIntegralFieldUnit] ++ rw [localHilbertSymbol_tame_formula C n hnC hmuC] ++ change ++ finitePlaceLocalTamePowerResidueSymbolValue K v n hmu hv a ha ^ ++ (-finitePlaceNormalizedValuation K v b) = _ ++ have hBase : ++ finitePlaceLocalTamePowerResidueSymbolValue K v n hmu hv a ha = ++ finitePlacePrimeIdealPowerResidueFactorValue ++ K v n hmu hcoprime a ha := by ++ apply Subtype.ext ++ apply Units.ext ++ simpa only [finitePlaceLocalTamePowerResidueSymbolValue, ++ finitePlacePrimeIdealPowerResidueFactorValue, ++ finitePlaceLocalTamePowerResidueSymbolFieldValue, ++ finitePlacePrimeIdealPowerResidueFactorFieldValue] using ++ finitePlaceLocalTamePowerResidueSymbolFieldValue_eq_primeIdealValue ++ K v n hmu hcoprime hv a ha ++ rw [hBase] ++ unfold finitePlacePrimeIdealPowerResidueFactorValue ++ unfold finitePlacePrimeIdealPowerResidueGlobalRoot ++ unfold finitePlacePrimeIdealPowerResidueIntegralRoot ++ rw [map_zpow] ++ ++/-- Endpoint form of the finite-place local/global power-residue comparison. -/ ++theorem finitePlaceHilbertSymbol_eq_primeIdealPowerResidueFactor ++ (n : ℕ+) (hnK : ((n : ℕ) : K) ≠ 0) ++ (hmu : (primitiveRoots (n : ℕ) K).Nonempty) ++ (v : HeightOneSpectrum (𝓞 K)) ++ (hv : v ∉ powerResidueExponentFinitePlaces K n) ++ (hcoprime : (Ideal.absNorm v.asIdeal).Coprime (n : ℕ)) ++ (a : 𝓞 K) (ha : a ∉ v.asIdeal) (b : Kˣ) : ++ finitePlaceHilbertSymbol K n hnK hmu v ++ (primeAvoidingIntegralFieldUnit K v a ha) b = ++ integralRootsOfUnityToNthRoots K (n : ℕ) ++ (AlgebraicNumberTheory.PowerResidueSymbols.primeIdealPowerResidueSymbol ++ K v n hmu hcoprime a ha) ^ ++ (-finitePlaceNormalizedValuation K v b) := ++ finitePlaceHilbertSymbol_eq_primeIdealPowerResidueFactor_zpow ++ K n hnK hmu v hv hcoprime a ha b ++ ++/-- The Dedekind prime multiplicity is the exponent occurring in the ++integer-valued adic valuation. -/ ++theorem intValuation_eq_exp_neg_idealPrimeMultiplicity ++ (v : HeightOneSpectrum (𝓞 K)) (x : 𝓞 K) (hx : x ≠ 0) : ++ v.intValuation x = ++ WithZero.exp ++ (-(AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) : ℤ)) := by ++ rw [v.intValuation_if_neg hx] ++ rfl ++ ++/-- For an integral element, the normalized valuation in the canonical ++finite-place completion is the negative multiplicity of the prime in its ++principal ideal. -/ ++theorem finitePlaceNormalizedValuation_nonzeroIntegralFieldUnit ++ (v : HeightOneSpectrum (𝓞 K)) ++ (x : 𝓞 K) (hx : x ≠ 0) : ++ finitePlaceNormalizedValuation K v ++ (nonzeroIntegralFieldUnit K x hx) = ++ -(AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) : ℤ) := by ++ let C := (HeightOneSpectrum.adicAbv K v).Completion ++ let : ValuativeRel C := ++ finitePlaceLocalArtinCompletionValuativeRel v ++ let : IsNonarchimedeanLocalField C := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v ++ let : IsUltrametricDist C := ++ finitePlaceArtinCompletionIsUltrametricDist ++ (HeightOneSpectrum.adicAbv K v) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv K v) ++ let m := AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) ++ let πData := chosenFinitePlaceCompletionIntegralUniformizer v ++ have hπIrreducible : Irreducible πData.completionInteger := by ++ rw [IsDiscreteValuationRing.irreducible_iff_uniformizer] ++ let completionDVF : ++ ValuationTheory.DiscreteValuationField.DVF C := ++ { ValueGroup := ValuativeRel.ValueGroupWithZero C ++ valuation := ValuativeRel.valuation C } ++ exact ++ completionDVF.maximalIdeal_eq_span_uniformizer ++ πData.completionInteger_isUniformizer ++ let πC : Cˣ := ++ Units.mk0 (πData.completionInteger : C) ++ πData.completionInteger_isUniformizer.ne_zero ++ let xC : Cˣ := ++ finitePlaceHilbert_completionUnit K v ++ (nonzeroIntegralFieldUnit K x hx) ++ have hIntX : ++ v.intValuation x = WithZero.exp (-(m : ℤ)) := by ++ exact intValuation_eq_exp_neg_idealPrimeMultiplicity K v x hx ++ have hIntPiPow : ++ v.intValuation (πData.integer ^ m) = ++ WithZero.exp (-(m : ℤ)) := by ++ rw [map_pow, πData.intValuation_eq_exp_neg_one] ++ calc ++ WithZero.exp (-1 : ℤ) ^ m = ++ WithZero.exp (m • (-1 : ℤ)) := ++ (WithZero.exp_nsmul m (-1 : ℤ)).symm ++ _ = WithZero.exp (-(m : ℤ)) := by simp ++ have hnormX : ++ ‖(xC : C)‖ = ++ (WithZeroMulInt.toNNReal ++ (HeightOneSpectrum.absNorm_ne_zero v) ++ (WithZero.exp (-(m : ℤ))) : ℝ) := by ++ change ‖algebraMap K C (x : K)‖ = _ ++ calc ++ ‖algebraMap K C (x : K)‖ = ++ HeightOneSpectrum.adicAbv K v (x : K) := ++ AbsoluteValue.completionAbsoluteValue_coe ++ (HeightOneSpectrum.adicAbv K v) (x : K) ++ _ = _ := by ++ rw [HeightOneSpectrum.adicAbv_def, ++ HeightOneSpectrum.valuation_of_algebraMap, hIntX] ++ have hnormPiPow : ++ ‖((πC ^ m : Cˣ) : C)‖ = ++ (WithZeroMulInt.toNNReal ++ (HeightOneSpectrum.absNorm_ne_zero v) ++ (WithZero.exp (-(m : ℤ))) : ℝ) := by ++ have hπC : ++ (πC : C) = algebraMap K C (πData.integer : K) := by ++ exact πData.coe_completionInteger ++ have hπCPow : ++ ((πC ^ m : Cˣ) : C) = ++ algebraMap K C (((πData.integer ^ m : 𝓞 K) : K)) := by ++ have hIntegerPow : ++ (((πData.integer ^ m : 𝓞 K) : K)) = ++ (πData.integer : K) ^ m := by ++ exact map_pow (algebraMap (𝓞 K) K) πData.integer m ++ rw [Units.val_pow_eq_pow_val, hπC, hIntegerPow, map_pow] ++ calc ++ ‖((πC ^ m : Cˣ) : C)‖ = ++ ‖algebraMap K C ((πData.integer ^ m : 𝓞 K) : K)‖ := ++ congrArg norm hπCPow ++ _ = HeightOneSpectrum.adicAbv K v ++ ((πData.integer ^ m : 𝓞 K) : K) := ++ AbsoluteValue.completionAbsoluteValue_coe ++ (HeightOneSpectrum.adicAbv K v) ++ ((πData.integer ^ m : 𝓞 K) : K) ++ _ = ++ (WithZeroMulInt.toNNReal ++ (HeightOneSpectrum.absNorm_ne_zero v) ++ (WithZero.exp (-(m : ℤ))) : ℝ) := by ++ rw [HeightOneSpectrum.adicAbv_def, ++ HeightOneSpectrum.valuation_of_algebraMap, hIntPiPow] ++ have hraw : ++ ValuativeRel.valuation C (xC : C) = ++ ValuativeRel.valuation C ((πC ^ m : Cˣ) : C) := by ++ apply canonicalValuation_eq_of_valuation_eq ++ (v := NormedField.valuation (K := C)) ++ apply NNReal.eq ++ simpa only [NormedField.valuation_apply, coe_nnnorm] using ++ hnormX.trans hnormPiPow.symm ++ have hValuationMap : ++ valuationMap C (Additive.ofMul xC) = ++ valuationMap C (Additive.ofMul (πC ^ m)) := by ++ rw [valuationMap_apply, valuationMap_apply] ++ unfold IsNonarchimedeanLocalField.v ++ congr 2 ++ exact congrArg ++ (_root_.IsNonarchimedeanLocalField.valueGroupWithZeroIsoInt C) hraw ++ have hπCValuation : ++ valuationMap C (Additive.ofMul πC) = -1 := by ++ rw [valuationMap_apply] ++ exact ++ v_integerRingIrreducibleFieldUnit C πData.completionInteger ++ hπIrreducible πC rfl ++ calc ++ finitePlaceNormalizedValuation K v ++ (nonzeroIntegralFieldUnit K x hx) = ++ valuationMap C (Additive.ofMul xC) := rfl ++ _ = valuationMap C (Additive.ofMul (πC ^ m)) := hValuationMap ++ _ = (m : ℤ) * valuationMap C (Additive.ofMul πC) := by ++ rw [valuationMap_ofMul_pow] ++ _ = -(m : ℤ) := by rw [hπCValuation]; simp ++ _ = -(AlgebraicNumberTheory.PowerResidueSymbols.idealPrimeMultiplicity K v (Ideal.span {x}) : ℤ) := rfl ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtin.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtin.lean +index 8c5d33f..4536b7d 100644 +--- a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtin.lean ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtin.lean +@@ -4,69 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Naganori Yamaguchi (assisted by OpenAI Codex) + -/ + +-import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.CompletionToIdeal +-import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion +-import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.LocalNorm +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.AlgEquiv +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.BaseChange +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.Core +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.NormComparison +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.NormalClosureNorm +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.Tower +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerAlgEquivNaturality +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerBaseChange +-import ClassFieldTheory.AlgebraicNumberTheory.Idele.Relative.FinitePlaceTensorNorm +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlace +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicLocalization +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalPrimeFactorization +-import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalPrincipalLocalUnit +-import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.SemilinearNaturality +-import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.UnramifiedNormalization +-import ClassFieldTheory.LocalClassFieldTheory.LubinTateApplication.PadicMultiplicativeArtinComparison +-import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicValuationComparison +-import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.UnramifiedFrobenius +-import ValuedFieldTheory.LocalField.Padic.Cyclotomic.TotallyRamified.EisensteinPolynomial +-import Mathlib.NumberTheory.NumberField.Cyclotomic.Galois ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinPrincipal + +-set_option autoImplicit false +- +-/-! +-# Finite-place Artin symbols in rational cyclotomic levels + +-At a rational prime away from the cyclotomic level, the chosen completed +-extension is unramified. Its normalized local Artin map is therefore the +-arithmetic Frobenius raised to the local valuation. The genuine primitive +-root in the localized cyclotomic level identifies the image of arithmetic +-Frobenius under the global cyclotomic character with the residue prime. +--/ ++set_option autoImplicit false + + open scoped Classical NNReal NumberField ValuativeRel + open NumberField IsDedekindDomain +- +-noncomputable section +- +-namespace GlobalClassFieldTheory +-namespace Reciprocity +- +--- Specializing the generic finite-place comparison to `ℚ` must retain its +--- `Algebra.id` owner rather than selecting the competing rational-field +--- instance introduced after specialization. +-@[reducible] noncomputable local instance +- rationalFinitePlaceCompletionRatAlgebra +- (v : HeightOneSpectrum (𝓞 ℚ)) : +- Algebra ℚ (HeightOneSpectrum.adicAbv ℚ v).Completion := by +- letI : Algebra ℚ ℚ := Algebra.id ℚ +- let hWith : Algebra ℚ +- (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) := +- WithAbs.instAlgebra _ +- let hUniform : UniformContinuousConstSMul ℚ +- (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) := +- WithAbs.instUniformContinuousConstSMulReal _ +- exact +- @UniformSpace.Completion.algebra +- (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) _ _ _ _ +- ℚ _ hWith hUniform +- + open AlgebraicNumberTheory.Valuations + open HilbertRamification + open LocalClassFieldTheory +@@ -75,2260 +19,54 @@ open LocalFieldTheory.DiscreteValuationField + open LocalFieldTheory.DiscreteValuationField.Examples.Qp + open LubinTate + +-private theorem mappedAbelianLocalArtin_eq_frobenius_zpow +- {F E G : Type} +- [Field F] [ValuativeRel F] [TopologicalSpace F] +- [IsNonarchimedeanLocalField F] +- [Field E] [ValuativeRel E] [UniformSpace E] [IsUniformAddGroup E] +- [IsNonarchimedeanLocalField E] +- [Algebra F E] [FiniteDimensional F E] [IsAbelianGalois F E] +- [Valuation.HasExtension +- (ValuativeRel.valuation F) (ValuativeRel.valuation E)] +- [IsNonarchimedeanLocalField.IsUnramifiedValuedExtension F E] +- [Group G] +- (f : (E ≃ₐ[F] E) →* G) (x : Fˣ) : +- f (LocalClassFieldTheory.abelianLocalArtinMonoidHom F E x) = +- (f (arithmeticFrobeniusOfUnramifiedValuation F E)) ^ +- IsNonarchimedeanLocalField.valuationMap F +- (Additive.ofMul x) := by +- rw [LocalClassFieldTheory.abelianLocalArtinMonoidHom_eq_frobenius_zpow, +- map_zpow] +- +-local instance (q : Nat.Primes) : Fact q.1.Prime := +- ⟨q.2⟩ +- +-local instance (m : ℕ+) : NeZero (m : ℕ) := +- ⟨m.ne_zero⟩ +- +-noncomputable local instance +- rationalCyclotomicLevelFiniteDimensional +- (m : ℕ+) : +- FiniteDimensional ℚ +- (KummerTheory.rationalCyclotomicLevel m) := +- IsCyclotomicExtension.finiteDimensional +- {(m : ℕ)} ℚ (KummerTheory.rationalCyclotomicLevel m) +- +-noncomputable local instance +- rationalCyclotomicLevelIsAbelianGalois +- (m : ℕ+) : +- IsAbelianGalois ℚ +- (KummerTheory.rationalCyclotomicLevel m) := by +- have : IsGalois ℚ +- (KummerTheory.rationalCyclotomicLevel m) := +- inferInstance +- let e := +- IsCyclotomicExtension.Rat.galEquivZMod +- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) +- exact +- { is_comm.comm σ τ := by +- apply e.injective +- simp only [map_mul] +- exact mul_comm _ _ } +- +-@[reducible] +-noncomputable local instance rationalFinitePlaceBaseNontriviallyNormedField +- (q : Nat.Primes) : +- NontriviallyNormedField +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion := +- absoluteValueExtension_completionNontriviallyNormedField +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)) +- (RayClass.adicAbv_isNontrivial +- (RayClass.rationalPrime q)) +- +-noncomputable local instance rationalFinitePlaceBaseLocallyCompactSpace +- (q : Nat.Primes) : +- LocallyCompactSpace +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion := +- AbsoluteValue.Completion.locallyCompactSpace +- (finitePlaceCompletionBaseMap_isometry +- (RayClass.rationalPrime q)) +- +-noncomputable local instance rationalFinitePlaceBaseIsUltrametricDist +- (q : Nat.Primes) : +- IsUltrametricDist +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion := +- finitePlaceArtinCompletionIsUltrametricDist +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)) +- (HeightOneSpectrum.isNonarchimedean_adicAbv +- ℚ (RayClass.rationalPrime q)) +- +-@[reducible] +-noncomputable local instance rationalFinitePlaceBaseValued +- (q : Nat.Primes) : +- Valued +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion ℝ≥0 := +- finitePlaceArtinCompletionValued +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)) +- (HeightOneSpectrum.isNonarchimedean_adicAbv +- ℚ (RayClass.rationalPrime q)) +- +-@[reducible] +-noncomputable local instance rationalFinitePlaceBaseValuativeRel +- (q : Nat.Primes) : +- ValuativeRel +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion := +- finitePlaceLocalArtinCompletionValuativeRel +- (K := ℚ) (RayClass.rationalPrime q) +- +-noncomputable local instance +- rationalFinitePlaceBaseValuationIsNontrivial +- (q : Nat.Primes) : +- (Valued.v : +- Valuation +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- ℝ≥0).IsNontrivial := +- (inferInstance : +- (NormedField.valuation +- (K := +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion)).IsNontrivial) +- +-noncomputable local instance rationalFinitePlaceBaseValuationCompatible +- (q : Nat.Primes) : +- (Valued.v : +- Valuation +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- ℝ≥0).Compatible := +- Valuation.Compatible.ofValuation _ +- +-noncomputable local instance +- rationalFinitePlaceBaseValuativeRelIsNontrivial +- (q : Nat.Primes) : +- ValuativeRel.IsNontrivial +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion := +- (ValuativeRel.isNontrivial_iff_isNontrivial +- (Valued.v : +- Valuation +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- ℝ≥0)).2 inferInstance +- +-noncomputable local instance rationalFinitePlaceBaseIsValuativeTopology +- (q : Nat.Primes) : +- IsValuativeTopology +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion := +- isValuativeTopology_of_valued_ofValuation +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion ℝ≥0 +- +-noncomputable local instance +- rationalFinitePlaceBaseIsNonarchimedeanLocalField +- (q : Nat.Primes) : +- IsNonarchimedeanLocalField +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion := +- finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField +- (K := ℚ) (RayClass.rationalPrime q) +- +-/-! Named compatibility witnesses used by the ramified-prime and ray-norm +-modules. They are not installed as a duplicate module-level instance family; +-the canonical instances above already provide the same data. -/ +- +-/-- Rational cyclotomic levels are finite-dimensional over `ℚ`. -/ +-theorem rationalCyclotomicPrincipalPrimeLevelFiniteDimensional +- (m : ℕ+) : +- FiniteDimensional ℚ (KummerTheory.rationalCyclotomicLevel m) := +- rationalCyclotomicLevelFiniteDimensional m +- +-/-- Rational cyclotomic levels are abelian Galois extensions of `ℚ`. -/ +-theorem rationalCyclotomicPrincipalPrimeLevelIsAbelianGalois +- (m : ℕ+) : +- IsAbelianGalois ℚ (KummerTheory.rationalCyclotomicLevel m) := +- rationalCyclotomicLevelIsAbelianGalois m +- +-/-- The canonical nontrivially normed field structure on the completion of +-`ℚ` at the rational prime `p`, exposed for principal-prime constructions. -/ +-@[reducible] +-noncomputable def rationalPrimeFactorCompletionNontriviallyNormedField +- (p : Nat.Primes) : +- NontriviallyNormedField +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion := +- rationalFinitePlaceBaseNontriviallyNormedField p +- +-/-- The completion of `ℚ` at `p` is locally compact. -/ +-theorem rationalPrimeFactorCompletionLocallyCompactSpace +- (p : Nat.Primes) : +- LocallyCompactSpace +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion := +- rationalFinitePlaceBaseLocallyCompactSpace p +- +-/-- The completion of `ℚ` at `p` carries its canonical ultrametric distance. -/ +-theorem rationalPrimeFactorCompletionIsUltrametricDist +- (p : Nat.Primes) : +- IsUltrametricDist +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion := +- rationalFinitePlaceBaseIsUltrametricDist p +- +-/-- The canonical `ℝ≥0`-valued structure on the completion of `ℚ` at `p`. -/ +-@[reducible] +-noncomputable def rationalPrimeFactorCompletionValued +- (p : Nat.Primes) : +- Valued +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion ℝ≥0 := +- rationalFinitePlaceBaseValued p +- +-/-- The valuative relation induced by the canonical valuation on the +-completion of `ℚ` at `p`. -/ +-@[reducible] +-noncomputable def rationalPrimeFactorCompletionValuativeRel +- (p : Nat.Primes) : +- ValuativeRel +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion := +- rationalFinitePlaceBaseValuativeRel p +- +-/-- The canonical valuation on the completion of `ℚ` at `p` is nontrivial. -/ +-theorem rationalPrimeFactorCompletionValuationIsNontrivial +- (p : Nat.Primes) : +- (Valued.v : Valuation +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion ℝ≥0).IsNontrivial := +- rationalFinitePlaceBaseValuationIsNontrivial p +- +-/-- The canonical valuation on the completion of `ℚ` at `p` is compatible +-with its field structure. -/ +-theorem rationalPrimeFactorCompletionValuationCompatible +- (p : Nat.Primes) : +- (Valued.v : Valuation +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion ℝ≥0).Compatible := +- rationalFinitePlaceBaseValuationCompatible p +- +-/-- The canonical valuative relation on the completion at `p` is nontrivial. -/ +-theorem rationalPrimeFactorCompletionValuativeRelIsNontrivial +- (p : Nat.Primes) : +- ValuativeRel.IsNontrivial +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion := +- rationalFinitePlaceBaseValuativeRelIsNontrivial p +- +-/-- The completion topology at `p` is induced by its canonical valuation. -/ +-theorem rationalPrimeFactorCompletionIsValuativeTopology +- (p : Nat.Primes) : +- IsValuativeTopology +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion := +- rationalFinitePlaceBaseIsValuativeTopology p +- +-/-- The completion of `ℚ` at `p` is a nonarchimedean local field. -/ +-theorem rationalPrimeFactorCompletionIsNonarchimedeanLocalField +- (p : Nat.Primes) : +- IsNonarchimedeanLocalField +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion := +- rationalFinitePlaceBaseIsNonarchimedeanLocalField p +- +-/-- The positive conductor of the `n`-th ramified cyclotomic level at +-`p`. -/ +-def rationalCyclotomicPrincipalPrimeModulus +- (p : Nat.Primes) (n : ℕ) : ℕ+ := +- ⟨p.1 ^ (n + 1), pow_pos p.2.pos (n + 1)⟩ +- +-/-- The rational finite-place completion used at the prime `p`. -/ +-abbrev RationalCyclotomicPrincipalPrimeCompletion +- (p : Nat.Primes) := +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion +- +-/-- The chosen localized cyclotomic field at level `p ^ (n + 1)`. -/ +-abbrev RationalCyclotomicPrincipalPrimeLocalizedLevel +- (p : Nat.Primes) (n : ℕ) := +- rationalCyclotomicLocalizedCompletion +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p) +- +-/-- The standard multiplicative Lubin--Tate field at level `n`. -/ +-abbrev RationalCyclotomicPrincipalPrimePadicLevel +- (p : Nat.Primes) (n : ℕ) := +- standardLubinTateLevelField +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n +- +-/-- The valuation ring of the absolute-value completion at `q`, identified +-with the standard p-adic integer ring `ℤ_q`. -/ +-noncomputable def rationalFinitePlaceCompletionIntegerRingEquivPadicInt +- (q : Nat.Primes) : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion] ≃+* +- ℤ_[q.1] := by +- let v : HeightOneSpectrum (𝓞 ℚ) := +- RayClass.rationalPrime q +- let vQ := HeightOneSpectrum.adicAbv ℚ v +- let eConcreteIntegers : +- 𝒪[vQ.Completion] ≃+* +- v.adicCompletionIntegers ℚ := +- finitePlaceCompletionIntegerRingEquiv v +- exact +- eConcreteIntegers.trans +- (PadicInt.adicCompletionIntegersEquiv +- (𝓞 ℚ) q).symm.toRingEquiv +- +-/-- The absolute-value completion at the rational prime `q`, identified +-with the standard field `ℚ_q`. -/ +-noncomputable def rationalFinitePlaceCompletionRingEquivPadic +- (q : Nat.Primes) : +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion ≃+* +- ℚ_[q.1] := +- IsFractionRing.ringEquivOfRingEquiv +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) +- +-/-- The completion-to-`ℚ_q` equivalence respects the rational embedding. -/ +-theorem rationalFinitePlaceCompletionRingEquivPadic_algebraMap +- (q : Nat.Primes) (a : ℚ) : +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap ℚ +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion a) = +- algebraMap ℚ ℚ_[q.1] a := by +- exact +- (rationalFinitePlaceCompletionRingEquivPadic q).toRingHom.map_rat_algebraMap a +- +-/-- The completion field equivalence and its restriction to valuation +-rings commute with the natural inclusions into the fields. -/ +-theorem rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe +- (q : Nat.Primes) +- (a : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion]) : +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion] +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion a) = +- algebraMap ℤ_[q.1] ℚ_[q.1] +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q a) := by +- exact +- (IsFractionRing.ringEquivOfRingEquiv_algebraMap +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) a) +- +-/-- The canonical rational-completion equivalence preserves the canonical +-valuations. -/ +-theorem +- rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible +- (p : Nat.Primes) : +- SemilinearValuationCompatible +- (RationalCyclotomicPrincipalPrimeCompletion p) ℚ_[p.1] +- (rationalFinitePlaceCompletionRingEquivPadic p) := by +- let F := RationalCyclotomicPrincipalPrimeCompletion p +- let eK := rationalFinitePlaceCompletionRingEquivPadic p +- let : Algebra F ℚ_[p.1] := eK.toRingHom.toAlgebra +- change +- (ValuativeRel.valuation F).HasExtension +- (ValuativeRel.valuation ℚ_[p.1]) +- let eO := +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt p).trans +- (padicIntEquivValuationSubring p.1) +- have hChosen : +- (localCompleteDVF F).valuation.HasExtension +- (padicDVRValuation p.1) := by +- change +- (localCompleteDVF F).valuation.HasExtension +- (padicCompleteDVF p.1).valuation +- apply +- ValuationTheory.DiscreteValuationField.ValuedExtension.valuation_hasExtension_of_valuationSubring_equiv +- (localCompleteDVF F) +- (padicCompleteDVF p.1) +- eO +- intro z +- change +- algebraMap +- (padicDVRValuation p.1).valuationSubring ℚ_[p.1] +- (padicIntEquivValuationSubring p.1 +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt +- p z)) = +- rationalFinitePlaceCompletionRingEquivPadic p +- (algebraMap 𝒪[F] F z) +- symm +- calc +- rationalFinitePlaceCompletionRingEquivPadic p +- (algebraMap 𝒪[F] F z) = +- algebraMap ℤ_[p.1] ℚ_[p.1] +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt +- p z) := +- rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe +- p z +- _ = +- algebraMap +- (padicDVRValuation p.1).valuationSubring ℚ_[p.1] +- (padicIntEquivValuationSubring p.1 +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt +- p z)) := by +- rw [PadicInt.algebraMap_apply, +- ValuationSubring.algebraMap_apply] +- exact +- (padicIntEquivValuationSubring_coe p.1 +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt +- p z)).symm +- have hBase : +- (ValuativeRel.valuation F).HasExtension +- (padicDVRValuation p.1) := by +- rw [← localCompleteDVF_valuation_eq] +- exact hChosen +- refine +- { val_isEquiv_comap := ?_ } +- exact +- hBase.val_isEquiv_comap.trans +- ((padicDVRValuation_isEquiv_valuativeRelValuation +- p.1).comap (algebraMap F ℚ_[p.1])) +- +-/-- The rational prime, pulled back from `ℤ_q` to the valuation ring of +-the absolute-value completion at `q`. -/ +-noncomputable def rationalPrimeFinitePlaceInteger +- (q : Nat.Primes) : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion] := +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q).symm +- (q.1 : ℤ_[q.1]) +- +-/-- The pulled-back rational prime is irreducible in the completion +-valuation ring. -/ +-theorem rationalPrimeFinitePlaceInteger_irreducible +- (q : Nat.Primes) : +- Irreducible (rationalPrimeFinitePlaceInteger q) := by +- exact +- (MulEquiv.irreducible_iff +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt +- q).symm.toMulEquiv).2 +- ((PadicInt.prime_p : +- Prime (q.1 : ℤ_[q.1])).irreducible) +- +-/-- Coercing the pulled-back prime to the completion field gives the +-ordinary image of the rational number `q`. -/ +-theorem rationalPrimeFinitePlaceInteger_coe +- (q : Nat.Primes) : +- ((rationalPrimeFinitePlaceInteger q : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion]) : +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion) = +- algebraMap ℚ +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (q.1 : ℚ) := by +- apply +- (rationalFinitePlaceCompletionRingEquivPadic q).injective +- change +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion] +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeFinitePlaceInteger q)) = +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap ℚ +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (q.1 : ℚ)) +- calc +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion] +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeFinitePlaceInteger q)) = +- algebraMap ℤ_[q.1] ℚ_[q.1] +- ((rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) +- (rationalPrimeFinitePlaceInteger q)) := +- rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe +- q (rationalPrimeFinitePlaceInteger q) +- _ = (q.1 : ℚ_[q.1]) := by +- rw [rationalPrimeFinitePlaceInteger, +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt +- q).apply_symm_apply, +- PadicInt.algebraMap_apply, +- PadicInt.coe_natCast] +- _ = +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap ℚ +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (q.1 : ℚ)) := by +- rw [ +- rationalFinitePlaceCompletionRingEquivPadic_algebraMap] +- norm_num +- +-/-- The rational prime as a field unit of its absolute-value completion. -/ +-noncomputable def rationalPrimeFinitePlaceFieldUnit +- (q : Nat.Primes) : +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completionˣ := +- Units.mk0 +- (rationalPrimeFinitePlaceInteger q : +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion) +- (by +- intro hzero +- exact +- (rationalPrimeFinitePlaceInteger_irreducible q).ne_zero +- (Subtype.ext hzero)) +- +-/-- In the inverse-standard local reciprocity normalization, the rational +-prime itself has normalized additive value `-1`. -/ +-theorem rationalPrimeFinitePlaceFieldUnit_valuationMap +- (q : Nat.Primes) : +- IsNonarchimedeanLocalField.valuationMap +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (Additive.ofMul +- (rationalPrimeFinitePlaceFieldUnit q)) = +- -1 := by +- simpa [IsNonarchimedeanLocalField.valuationMap_apply] using +- (LocalFieldTheory.v_integerRingIrreducibleFieldUnit +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeFinitePlaceInteger q) +- (rationalPrimeFinitePlaceInteger_irreducible q) +- (rationalPrimeFinitePlaceFieldUnit q) rfl) +- +-/-- The rational `q`-unit part of `x`, pulled back from `ℤ_qˣ` to the +-valuation ring of the absolute-value completion. -/ +-noncomputable def rationalPrimeUnitFinitePlaceIntegerUnit +- (x : ℚˣ) (q : Nat.Primes) : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion]ˣ := +- Units.map +- (rationalFinitePlaceCompletionIntegerRingEquivPadicInt +- q).symm.toMonoidHom +- (padicIntUnitOfRat q +- (rationalPrimeUnit x q : ℚ) +- (rationalPrimeUnit x q).ne_zero +- (padicValRat_rationalPrimeUnit x q)) +- +-/-- Forgetting the integrality proof from the pulled-back `q`-unit gives +-the ordinary image of the rational `q`-unit in the completion field. -/ +-theorem rationalPrimeUnitFinitePlaceIntegerUnit_coe +- (x : ℚˣ) (q : Nat.Primes) : +- (((rationalPrimeUnitFinitePlaceIntegerUnit x q : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion]ˣ) : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion]) : +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion) = +- algebraMap ℚ +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeUnit x q : ℚ) := by +- apply +- (rationalFinitePlaceCompletionRingEquivPadic q).injective +- change +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion] +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeUnitFinitePlaceIntegerUnit x q : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion])) = +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap ℚ +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeUnit x q : ℚ)) +- calc +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion] +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeUnitFinitePlaceIntegerUnit x q : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion])) = +- algebraMap ℤ_[q.1] ℚ_[q.1] +- ((rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) +- (rationalPrimeUnitFinitePlaceIntegerUnit x q : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion])) := +- rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe q +- (rationalPrimeUnitFinitePlaceIntegerUnit x q : +- 𝒪[(HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion]) +- _ = +- ((padicIntUnitOfRat q +- (rationalPrimeUnit x q : ℚ) +- (rationalPrimeUnit x q).ne_zero +- (padicValRat_rationalPrimeUnit x q) : +- ℤ_[q.1]) : ℚ_[q.1]) := by +- rw [rationalPrimeUnitFinitePlaceIntegerUnit] +- simp [PadicInt.algebraMap_apply] +- _ = ((rationalPrimeUnit x q : ℚ) : ℚ_[q.1]) := by +- rw [padicIntUnitOfRat_coe] +- _ = +- rationalFinitePlaceCompletionRingEquivPadic q +- (algebraMap ℚ +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeUnit x q : ℚ)) := by +- rw [ +- rationalFinitePlaceCompletionRingEquivPadic_algebraMap] +- simp +- +-/-- The completion field unit underlying the pulled-back rational `q`-unit +-has normalized additive value zero. -/ +-theorem rationalPrimeUnitFinitePlaceField_valuationMap +- (x : ℚˣ) (q : Nat.Primes) : +- IsNonarchimedeanLocalField.valuationMap +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (Additive.ofMul +- (IsNonarchimedeanLocalField.integerUnitsToFieldUnits +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeUnitFinitePlaceIntegerUnit x q))) = +- 0 := by +- rw [IsNonarchimedeanLocalField.valuationMap_apply] +- exact +- IsNonarchimedeanLocalField.v_integerUnitsToFieldUnits +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (rationalPrimeUnitFinitePlaceIntegerUnit x q) +- +-/-- The rational prime `q`, regarded as a unit of `ℚ`. -/ +-def rationalPrimeGeneratorUnit (q : Nat.Primes) : ℚˣ := +- Units.mk0 (q.1 : ℚ) (by exact_mod_cast q.2.ne_zero) +- +-/-- The underlying rational number of the prime generator unit is `q`. -/ +-@[simp] +-theorem rationalPrimeGeneratorUnit_coe (q : Nat.Primes) : +- (rationalPrimeGeneratorUnit q : ℚ) = q.1 := +- rfl +- +-/-- Reattaching the removed `q`-power to the rational `q`-unit recovers +-the original rational field unit. -/ +-theorem rationalPrimeGeneratorUnit_zpow_mul_rationalPrimeUnit +- (x : ℚˣ) (q : Nat.Primes) : +- rationalPrimeGeneratorUnit q ^ +- padicValRat q.1 (x : ℚ) * +- rationalPrimeUnit x q = +- x := by +- rw [rationalPrimeGeneratorUnit, rationalPrimeUnit, +- ← mul_assoc, ← zpow_add] +- simp +- +-/-- The source unit in the absolute-value completion represented by the +-finite component of a rational principal idele. -/ +-noncomputable def rationalPrincipalFinitePlaceInput +- (x : ℚˣ) (q : Nat.Primes) : +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completionˣ := +- (finitePlaceCompletionUnitsContinuousMulEquiv +- (RayClass.rationalPrime q)).symm +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime q) +- (IdeleGroup.principalIdele ℚ x)) +- +-/-- The source unit represented by a principal finite component is the +-ordinary image of the rational field unit in the absolute-value +-completion. -/ +-theorem rationalPrincipalFinitePlaceInput_eq_algebraMap +- (x : ℚˣ) (q : Nat.Primes) : +- rationalPrincipalFinitePlaceInput x q = +- Units.map +- (algebraMap ℚ +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion).toMonoidHom +- x := by +- apply Units.ext +- let v : HeightOneSpectrum (𝓞 ℚ) := +- RayClass.rationalPrime q +- let vQ := HeightOneSpectrum.adicAbv ℚ v +- let component : (v.adicCompletion ℚ)ˣ := +- IdeleGroup.finiteComponent v +- (IdeleGroup.principalIdele ℚ x) +- apply (finitePlaceCompletionRingEquiv v).injective +- change +- finitePlaceCompletionRingEquiv v +- (rationalPrincipalFinitePlaceInput x q : vQ.Completion) = +- finitePlaceCompletionRingEquiv v +- (algebraMap ℚ vQ.Completion (x : ℚ)) +- have hCompletion : +- finitePlaceCompletionRingEquiv v +- (rationalPrincipalFinitePlaceInput x q : +- vQ.Completion) = +- (component : v.adicCompletion ℚ) := by +- have hUnits := +- congrArg Units.val +- ((finitePlaceCompletionUnitsContinuousMulEquiv v).apply_symm_apply +- component) +- exact hUnits +- have hComponent : +- (component : v.adicCompletion ℚ) = +- algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ) := by +- apply (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm.injective +- calc +- (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm +- (component : v.adicCompletion ℚ) = +- algebraMap ℚ ℚ_[q.1] (x : ℚ) := by +- dsimp only [component] +- rw [IdeleGroup.finiteComponent_principalIdele] +- exact +- (Padic.adicCompletionEquiv +- (𝓞 ℚ) q).symm.commutes (x : ℚ) +- _ = (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm +- (algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ)) := by +- symm +- exact +- (Padic.adicCompletionEquiv +- (𝓞 ℚ) q).symm.commutes (x : ℚ) +- calc +- finitePlaceCompletionRingEquiv v +- (rationalPrincipalFinitePlaceInput x q : +- vQ.Completion) = +- (component : v.adicCompletion ℚ) := hCompletion +- _ = algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ) := hComponent +- _ = finitePlaceCompletionRingEquiv v +- (algebraMap ℚ vQ.Completion (x : ℚ)) := by +- symm +- exact +- (finitePlaceCompletionAlgEquiv (K := ℚ) v).commutes (x : ℚ) +- +-/-- The normalized local exponent of a rational principal finite +-component is the negative of the usual `q`-adic exponent. The minus sign +-records the inverse-standard local reciprocity convention in which a +-prime element has normalized value `-1`. -/ +-theorem rationalPrincipalFiniteComponent_valuationMap +- (x : ℚˣ) (q : Nat.Primes) : +- IsNonarchimedeanLocalField.valuationMap +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (Additive.ofMul +- ((finitePlaceCompletionUnitsContinuousMulEquiv +- (RayClass.rationalPrime q)).symm +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime q) +- (IdeleGroup.principalIdele ℚ x)))) = +- -padicValRat q.1 (x : ℚ) := by +- let F := +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- let embed : ℚˣ →* Fˣ := +- Units.map (algebraMap ℚ F).toMonoidHom +- let primeUnit : Fˣ := +- rationalPrimeFinitePlaceFieldUnit q +- let integralUnit : 𝒪[F]ˣ := +- rationalPrimeUnitFinitePlaceIntegerUnit x q +- let unitPart : Fˣ := +- IsNonarchimedeanLocalField.integerUnitsToFieldUnits +- F integralUnit +- have hInput : +- rationalPrincipalFinitePlaceInput x q = +- embed x := by +- exact rationalPrincipalFinitePlaceInput_eq_algebraMap x q +- have hPrime : +- embed (rationalPrimeGeneratorUnit q) = +- primeUnit := by +- apply Units.ext +- exact +- (rationalPrimeFinitePlaceInteger_coe q).symm +- have hUnit : +- embed (rationalPrimeUnit x q) = +- unitPart := by +- apply Units.ext +- exact +- (rationalPrimeUnitFinitePlaceIntegerUnit_coe +- x q).symm +- change +- IsNonarchimedeanLocalField.valuationMap F +- (Additive.ofMul +- (rationalPrincipalFinitePlaceInput x q)) = +- -padicValRat q.1 (x : ℚ) +- rw [hInput] +- conv_lhs => +- rw [← rationalPrimeGeneratorUnit_zpow_mul_rationalPrimeUnit +- x q] +- rw [map_mul, map_zpow, hPrime, hUnit, +- IsNonarchimedeanLocalField.valuationMap_ofMul_mul, +- IsNonarchimedeanLocalField.valuationMap_ofMul_zpow, +- rationalPrimeFinitePlaceFieldUnit_valuationMap, +- rationalPrimeUnitFinitePlaceField_valuationMap] +- ring +- +-/-- The principal finite component of the rational prime itself has +-normalized local exponent `-1`. -/ +-theorem rationalPrimePrincipalFiniteComponent_valuationMap +- (q : Nat.Primes) : +- IsNonarchimedeanLocalField.valuationMap +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime q)).Completion +- (Additive.ofMul +- ((finitePlaceCompletionUnitsContinuousMulEquiv +- (RayClass.rationalPrime q)).symm +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime q) +- (IdeleGroup.principalIdele ℚ +- (rationalPrimeGeneratorUnit q))))) = +- -1 := by +- rw [rationalPrincipalFiniteComponent_valuationMap, +- rationalPrimeGeneratorUnit_coe, +- padicValRat.self q.2.one_lt] +- +-/-- A cyclotomic automorphism which raises the selected primitive root to +-the `q`-th power has cyclotomic character equal to the residue-prime unit. -/ +-private theorem rationalCyclotomicLevel_galEquivZMod_eq_unitOfCoprime +- (m : ℕ+) (q : Nat.Primes) +- (hq : ¬ q.1 ∣ (m : ℕ)) +- (σ : KummerTheory.rationalCyclotomicLevel m ≃ₐ[ℚ] +- KummerTheory.rationalCyclotomicLevel m) +- (hσ : +- σ (rationalCyclotomicLevelPrimitiveRoot m) = +- rationalCyclotomicLevelPrimitiveRoot m ^ q.1) : +- IsCyclotomicExtension.Rat.galEquivZMod +- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ = +- ZMod.unitOfCoprime q.1 +- (q.2.coprime_iff_not_dvd.mpr hq) := by +- let ζ := rationalCyclotomicLevelPrimitiveRoot m +- have hζ : IsPrimitiveRoot ζ (m : ℕ) := +- rationalCyclotomicLevelPrimitiveRoot_isPrimitiveRoot m +- have hCharacterRoot : +- σ ζ = +- ζ ^ +- (IsCyclotomicExtension.Rat.galEquivZMod +- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ).val.val := +- IsCyclotomicExtension.Rat.galEquivZMod_apply_of_pow_eq +- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ +- hζ.pow_eq_one +- have hPowers : +- ζ ^ +- (IsCyclotomicExtension.Rat.galEquivZMod +- (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ).val.val = +- ζ ^ q.1 := +- hCharacterRoot.symm.trans hσ +- rw [(hζ.isOfFinOrder m.ne_zero).pow_inj_mod, +- ← hζ.eq_orderOf, +- ← ZMod.natCast_eq_natCast_iff', +- ZMod.natCast_val] at hPowers +- apply Units.ext +- simpa using hPowers +- +-private abbrev rationalCyclotomicArtinPlace (q : Nat.Primes) : +- HeightOneSpectrum (𝓞 ℚ) := +- RayClass.rationalPrime q +- +-private abbrev rationalCyclotomicArtinBaseAbv (q : Nat.Primes) : +- AbsoluteValue ℚ ℝ := +- HeightOneSpectrum.adicAbv ℚ (rationalCyclotomicArtinPlace q) +- +-private abbrev rationalCyclotomicArtinLevel (m : ℕ+) := +- KummerTheory.rationalCyclotomicLevel m +- +-private abbrev rationalCyclotomicArtinExtension +- (m : ℕ+) (q : Nat.Primes) : +- AbsoluteValueExtension +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinLevel m) := +- chosenFinitePlaceExtension +- (L := rationalCyclotomicArtinLevel m) +- (rationalCyclotomicArtinPlace q) +- +-private abbrev rationalCyclotomicArtinLocalizedField +- (m : ℕ+) (q : Nat.Primes) := +- AlgebraicNumberTheory.Valuations.LocalizedCompletion +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q) +- +-@[reducible] +-noncomputable local instance rationalCyclotomicArtinExtensionAlgebra +- (m : ℕ+) (q : Nat.Primes) : +- Algebra ℚ +- (rationalCyclotomicArtinExtension m q).1.Completion := +- AbsoluteValue.extensionCompletionAlgebra +- (K := ℚ) (rationalCyclotomicArtinExtension m q).1 +- +-@[reducible] +-noncomputable local instance rationalCyclotomicArtinExtensionSMul +- (m : ℕ+) (q : Nat.Primes) : +- SMul ℚ +- (rationalCyclotomicArtinExtension m q).1.Completion := +- (rationalCyclotomicArtinExtensionAlgebra m q).toSMul +- +-@[reducible] +-noncomputable local instance +- rationalCyclotomicArtinCompletionAlgebra +- (m : ℕ+) (q : Nat.Primes) : +- Algebra (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinExtension m q).1.Completion := +- AbsoluteValue.completionAlgebra +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q).1 +- (rationalCyclotomicArtinExtension m q).2 +- +-@[reducible] +-noncomputable local instance rationalCyclotomicArtinLocalizedAlgebra +- (m : ℕ+) (q : Nat.Primes) : +- Algebra (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinLocalizedField m q) := +- finitePlaceLocalArtinLocalizedAlgebra +- (K := ℚ) (L := rationalCyclotomicArtinLevel m) +- (rationalCyclotomicArtinPlace q) +- (rationalCyclotomicArtinExtension m q) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedGlobalAlgebra +- (m : ℕ+) (q : Nat.Primes) : +- Algebra ℚ (rationalCyclotomicArtinLocalizedField m q) := +- LocalClassFieldTheory.localizedCompletionGlobalAlgebra +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedGlobalSMul +- (m : ℕ+) (q : Nat.Primes) : +- SMul ℚ (rationalCyclotomicArtinLocalizedField m q) := +- (rationalCyclotomicArtinLocalizedGlobalAlgebra m q).toSMul +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedScalarTower +- (m : ℕ+) (q : Nat.Primes) : +- IsScalarTower ℚ +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinLocalizedField m q) := by +- constructor +- intro r x y +- simp only [Algebra.smul_def, map_mul, eq_ratCast, +- map_ratCast, mul_assoc] +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedFiniteDimensional +- (m : ℕ+) (q : Nat.Primes) : +- FiniteDimensional +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinLocalizedField m q) := +- finitePlaceLocalArtinFiniteDimensional +- (K := ℚ) (L := rationalCyclotomicArtinLevel m) +- (rationalCyclotomicArtinPlace q) +- (rationalCyclotomicArtinExtension m q) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIsAbelianGalois +- (m : ℕ+) (q : Nat.Primes) : +- IsAbelianGalois +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinLocalizedField m q) := +- finitePlaceLocalArtinIsAbelianGalois +- (K := ℚ) (L := rationalCyclotomicArtinLevel m) +- (rationalCyclotomicArtinPlace q) +- (rationalCyclotomicArtinExtension m q) +- (inferInstance : +- FiniteDimensional ℚ (rationalCyclotomicArtinLevel m)) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIsSeparable +- (m : ℕ+) (q : Nat.Primes) : +- Algebra.IsSeparable +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinLocalizedField m q) := +- (rationalCyclotomicArtinLocalizedIsAbelianGalois m q).toIsGalois.to_isSeparable +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIsCyclotomic +- (m : ℕ+) (q : Nat.Primes) : +- IsCyclotomicExtension {(m : ℕ)} +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinLocalizedField m q) := +- rationalCyclotomicLevel_localizedCompletion_isCyclotomicExtension +- m (rationalCyclotomicArtinPlace q) +- +-noncomputable local instance +- rationalCyclotomicArtinExtensionFiniteDimensional +- (m : ℕ+) (q : Nat.Primes) : +- FiniteDimensional +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinExtension m q).1.Completion := +- completionModuleFinite +- (rationalCyclotomicArtinBaseAbv q) +- (RayClass.adicAbv_isNontrivial +- (rationalCyclotomicArtinPlace q)) +- (rationalCyclotomicArtinExtension m q) +- +-noncomputable local instance +- rationalCyclotomicArtinExtensionContinuousSMul +- (m : ℕ+) (q : Nat.Primes) : +- ContinuousSMul +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinExtension m q).1.Completion := +- continuousSMul_of_algebraMap _ _ +- (AbsoluteValue.completionMap_isometry +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q).1 +- (rationalCyclotomicArtinExtension m q).2).continuous +- +-noncomputable local instance +- rationalCyclotomicArtinExtensionLocallyCompact +- (m : ℕ+) (q : Nat.Primes) : +- LocallyCompactSpace +- (rationalCyclotomicArtinExtension m q).1.Completion := +- LocallyCompactSpace.of_finiteDimensional_of_complete +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinExtension m q).1.Completion +- +-private noncomputable def +- rationalCyclotomicArtinLocalizedEquivCompletion +- (m : ℕ+) (q : Nat.Primes) : +- rationalCyclotomicArtinLocalizedField m q ≃ᵢ +- (rationalCyclotomicArtinExtension m q).1.Completion := +- { toEquiv := +- (localizedCompletionEquivCompletion +- (rationalCyclotomicArtinBaseAbv q) +- (RayClass.adicAbv_isNontrivial +- (rationalCyclotomicArtinPlace q)) +- (rationalCyclotomicArtinExtension m q)).toEquiv +- isometry_toFun := +- Isometry.of_dist_eq fun _ _ => rfl } +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedLocallyCompact +- (m : ℕ+) (q : Nat.Primes) : +- LocallyCompactSpace +- (rationalCyclotomicArtinLocalizedField m q) := +- ((rationalCyclotomicArtinLocalizedEquivCompletion m q).toHomeomorph.locallyCompactSpace_iff).2 +- inferInstance +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIsUltrametricDist +- (m : ℕ+) (q : Nat.Primes) : +- IsUltrametricDist +- (rationalCyclotomicArtinLocalizedField m q) := +- localizedCompletionIsUltrametricDist +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q) +- (HeightOneSpectrum.isNonarchimedean_adicAbv +- ℚ (rationalCyclotomicArtinPlace q)) +- +-noncomputable local instance rationalCyclotomicArtinLocalizedValued +- (m : ℕ+) (q : Nat.Primes) : +- Valued (rationalCyclotomicArtinLocalizedField m q) ℝ≥0 := +- localizedCompletionFinitePlaceValued +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q) +- (HeightOneSpectrum.isNonarchimedean_adicAbv +- ℚ (rationalCyclotomicArtinPlace q)) +- +-@[reducible] +-noncomputable local instance +- rationalCyclotomicArtinLocalizedValuativeRel +- (m : ℕ+) (q : Nat.Primes) : +- ValuativeRel (rationalCyclotomicArtinLocalizedField m q) := +- localizedCompletionFinitePlaceValuativeRel +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q) +- (HeightOneSpectrum.isNonarchimedean_adicAbv +- ℚ (rationalCyclotomicArtinPlace q)) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedValuationCompatible +- (m : ℕ+) (q : Nat.Primes) : +- (Valued.v : Valuation +- (rationalCyclotomicArtinLocalizedField m q) ℝ≥0).Compatible := +- Valuation.Compatible.ofValuation _ +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedValuationHasExtension +- (m : ℕ+) (q : Nat.Primes) : +- Valuation.HasExtension +- (ValuativeRel.valuation +- (rationalCyclotomicArtinBaseAbv q).Completion) +- (ValuativeRel.valuation +- (rationalCyclotomicArtinLocalizedField m q)) := +- localizedCompletionValuationHasExtension +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q) +- (HeightOneSpectrum.isNonarchimedean_adicAbv +- ℚ (rationalCyclotomicArtinPlace q)) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedValuationIsNontrivial +- (m : ℕ+) (q : Nat.Primes) : +- (ValuativeRel.valuation +- (rationalCyclotomicArtinLocalizedField m q)).IsNontrivial := +- Valuation.IsNontrivial.of_hasExtension +- (ValuativeRel.valuation +- (rationalCyclotomicArtinBaseAbv q).Completion) +- (ValuativeRel.valuation +- (rationalCyclotomicArtinLocalizedField m q)) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial +- (m : ℕ+) (q : Nat.Primes) : +- ValuativeRel.IsNontrivial +- (rationalCyclotomicArtinLocalizedField m q) := +- (ValuativeRel.isNontrivial_iff_isNontrivial +- (ValuativeRel.valuation +- (rationalCyclotomicArtinLocalizedField m q))).2 inferInstance +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIsValuativeTopology +- (m : ℕ+) (q : Nat.Primes) : +- IsValuativeTopology +- (rationalCyclotomicArtinLocalizedField m q) := +- isValuativeTopology_of_valued_ofValuation +- (rationalCyclotomicArtinLocalizedField m q) ℝ≥0 +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField +- (m : ℕ+) (q : Nat.Primes) : +- IsNonarchimedeanLocalField +- (rationalCyclotomicArtinLocalizedField m q) := +- { toIsValuativeTopology := inferInstance +- toLocallyCompactSpace := inferInstance +- toIsNontrivial := inferInstance } +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIntegerAlgebra +- (m : ℕ+) (q : Nat.Primes) : +- Algebra +- 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] +- (rationalCyclotomicArtinLocalizedField m q) := +- Algebra.ofSubsemiring +- 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIsIntegralClosure +- (m : ℕ+) (q : Nat.Primes) : +- IsIntegralClosure +- 𝒪[rationalCyclotomicArtinLocalizedField m q] +- 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] +- (rationalCyclotomicArtinLocalizedField m q) := +- localizedCompletionIsIntegralClosureWithExtension +- (rationalCyclotomicArtinBaseAbv q) +- (rationalCyclotomicArtinExtension m q) +- (RayClass.adicAbv_isNontrivial +- (rationalCyclotomicArtinPlace q)) +- (HeightOneSpectrum.isNonarchimedean_adicAbv +- ℚ (rationalCyclotomicArtinPlace q)) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedIntegerModuleFinite +- (m : ℕ+) (q : Nat.Primes) : +- Module.Finite +- 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] +- 𝒪[rationalCyclotomicArtinLocalizedField m q] := +- integerRing_moduleFinite_of_isIntegralClosure +- (rationalCyclotomicArtinBaseAbv q).Completion +- (rationalCyclotomicArtinLocalizedField m q) +- +-section RationalCyclotomicPrincipalPrime +- +-/-! ## Ramified prime-power transport +- +-This section reuses the canonical finite-place Artin tower above. In +-particular, it introduces no parallel completion/localization instance tower. -/ +- +-noncomputable local instance +- rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension +- (p : Nat.Primes) (n : ℕ) : +- IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ +- (KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) := by +- change +- IsCyclotomicExtension +- {(rationalCyclotomicPrincipalPrimeModulus p n : ℕ)} ℚ +- (KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- exact +- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension +- (rationalCyclotomicPrincipalPrimeModulus p n) +- +-private abbrev rationalCyclotomicPrincipalPrimePlace +- (p : Nat.Primes) : HeightOneSpectrum (𝓞 ℚ) := +- rationalCyclotomicArtinPlace p +- +-private abbrev rationalCyclotomicPrincipalPrimeLevel +- (m : ℕ+) := +- rationalCyclotomicArtinLevel m +- +-private abbrev rationalCyclotomicPrincipalPrimeExtension +- (m : ℕ+) (p : Nat.Primes) := +- rationalCyclotomicArtinExtension m p +- +-/-- The `ℚ_[p]`-algebra structure on the localized cyclotomic completion, +-transported through the canonical comparison with the `p`-adic completion. -/ +-@[reducible] +-noncomputable def +- rationalCyclotomicPrincipalPrimeLocalizedPadicAlgebra +- (m : ℕ+) (p : Nat.Primes) : +- Algebra ℚ_[p.1] +- (rationalCyclotomicLocalizedCompletion m +- (RayClass.rationalPrime p)) := +- ((algebraMap +- (HeightOneSpectrum.adicAbv ℚ +- (RayClass.rationalPrime p)).Completion +- (rationalCyclotomicLocalizedCompletion m +- (RayClass.rationalPrime p))).comp +- (rationalFinitePlaceCompletionRingEquivPadic p).symm.toRingHom).toAlgebra +- +-@[reducible] +-noncomputable local instance +- rationalCyclotomicArtinLocalizedPadicAlgebra +- (m : ℕ+) (p : Nat.Primes) : +- Algebra ℚ_[p.1] (rationalCyclotomicArtinLocalizedField m p) := +- rationalCyclotomicPrincipalPrimeLocalizedPadicAlgebra m p +- +-private noncomputable def rationalFinitePlaceCompletionAlgEquivPadic +- (p : Nat.Primes) : +- (rationalCyclotomicArtinBaseAbv p).Completion ≃ₐ[ℚ] ℚ_[p.1] := +- AlgEquiv.ofRingEquiv +- (f := rationalFinitePlaceCompletionRingEquivPadic p) +- (rationalFinitePlaceCompletionRingEquivPadic_algebraMap p) +- +-noncomputable local instance +- rationalCyclotomicArtinLocalizedPadicScalarTower +- (m : ℕ+) (p : Nat.Primes) : +- IsScalarTower ℚ ℚ_[p.1] +- (rationalCyclotomicArtinLocalizedField m p) := by +- constructor +- intro r x y +- simp only [Algebra.smul_def, map_mul, eq_ratCast, +- map_ratCast, mul_assoc] +- +-private theorem rationalCyclotomicArtin_padic_algebraMap +- (m : ℕ+) (p : Nat.Primes) : +- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion +- (rationalCyclotomicArtinLocalizedField m p) = +- (algebraMap ℚ_[p.1] +- (rationalCyclotomicArtinLocalizedField m p)) ∘ +- (rationalFinitePlaceCompletionAlgEquivPadic p) := by +- funext a +- change +- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion +- (rationalCyclotomicArtinLocalizedField m p) a = +- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion +- (rationalCyclotomicArtinLocalizedField m p) +- ((rationalFinitePlaceCompletionRingEquivPadic p).symm +- (rationalFinitePlaceCompletionRingEquivPadic p a)) +- exact +- congrArg +- (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion +- (rationalCyclotomicArtinLocalizedField m p)) +- ((rationalFinitePlaceCompletionRingEquivPadic p).symm_apply_apply a).symm +- +-private theorem rationalCyclotomicArtin_algebraAdjoin_restrictScalars +- (m : ℕ+) (p : Nat.Primes) : +- (Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion +- ({rationalCyclotomicLocalizedPrimitiveRoot m +- (rationalCyclotomicArtinPlace p)} : +- Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = +- (Algebra.adjoin ℚ_[p.1] +- ({rationalCyclotomicLocalizedPrimitiveRoot m +- (rationalCyclotomicArtinPlace p)} : +- Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ := by +- exact +- Algebra.restrictScalars_adjoin_of_algEquiv +- (E := rationalCyclotomicArtinLocalizedField m p) +- (rationalFinitePlaceCompletionAlgEquivPadic p) +- (rationalCyclotomicArtin_padic_algebraMap m p) +- ({rationalCyclotomicLocalizedPrimitiveRoot m +- (rationalCyclotomicArtinPlace p)} : +- Set (rationalCyclotomicArtinLocalizedField m p)) +- +-private theorem +- rationalCyclotomicArtin_baseAlgebraAdjoin_restrict_eq_top +- (m : ℕ+) (p : Nat.Primes) : +- (Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion +- ({rationalCyclotomicLocalizedPrimitiveRoot m +- (rationalCyclotomicArtinPlace p)} : +- Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = +- (⊤ : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion +- (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := by +- have hRoot : IsPrimitiveRoot +- (show rationalCyclotomicArtinLocalizedField m p from +- rationalCyclotomicLocalizedPrimitiveRoot m +- (rationalCyclotomicArtinPlace p)) +- (m : ℕ) := +- rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot +- m (rationalCyclotomicArtinPlace p) +- have hTop : +- Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion +- ({rationalCyclotomicLocalizedPrimitiveRoot m +- (rationalCyclotomicArtinPlace p)} : +- Set (rationalCyclotomicArtinLocalizedField m p)) = ⊤ := +- IsCyclotomicExtension.adjoin_primitive_root_eq_top +- (A := (rationalCyclotomicArtinBaseAbv p).Completion) +- (B := rationalCyclotomicArtinLocalizedField m p) hRoot +- exact congrArg +- (fun A : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion +- (rationalCyclotomicArtinLocalizedField m p) => A.restrictScalars ℚ) +- hTop +- +-private theorem rationalCyclotomicArtin_restrictScalars_top_base_eq_padic +- (m : ℕ+) (p : Nat.Primes) : +- (⊤ : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion +- (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ = +- (⊤ : Subalgebra ℚ_[p.1] +- (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := +- (Subalgebra.restrictScalars_top ℚ).trans +- (Subalgebra.restrictScalars_top ℚ).symm +- +-private theorem +- rationalCyclotomicArtin_padicAlgebraAdjoin_restrict_eq_top +- (m : ℕ+) (p : Nat.Primes) : +- (Algebra.adjoin ℚ_[p.1] +- ({rationalCyclotomicLocalizedPrimitiveRoot m +- (rationalCyclotomicArtinPlace p)} : +- Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = +- (⊤ : Subalgebra ℚ_[p.1] +- (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := by +- exact +- (rationalCyclotomicArtin_algebraAdjoin_restrictScalars m p).symm.trans +- ((rationalCyclotomicArtin_baseAlgebraAdjoin_restrict_eq_top m p).trans +- (rationalCyclotomicArtin_restrictScalars_top_base_eq_padic m p)) ++noncomputable section + +-/-- The finite-dimensional instance for the standard multiplicative level, +-named once so all consumers use the same proof term. -/ +-theorem rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional +- (p : Nat.Primes) (n : ℕ) : +- FiniteDimensional ℚ_[p.1] +- (standardLubinTateLevelField +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) := +- standardLubinTateLevelField_finiteDimensional +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n ++namespace GlobalClassFieldTheory ++namespace Reciprocity + + attribute [local instance] +- rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional +- +-noncomputable local instance +- rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois +- (p : Nat.Primes) (n : ℕ) : +- IsAbelianGalois ℚ_[p.1] +- (RationalCyclotomicPrincipalPrimePadicLevel p n) := +- standardLubinTateLevelField_isAbelianGalois +- (padicLocalField p.1) +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n +- +-@[reducible] +-noncomputable local instance rationalPrimeFactorCompletionPadicAlgebra +- (p : Nat.Primes) : +- Algebra (RationalCyclotomicPrincipalPrimeCompletion p) ℚ_[p.1] := +- (rationalFinitePlaceCompletionRingEquivPadic p).toRingHom.toAlgebra +- +-/-- The genuine multiplicative Lubin--Tate level is generated by its +-primitive `p ^ (n + 1)`-st root of unity. -/ +-theorem padicMultiplicativePrimitiveRoot_adjoin_eq_top +- (p : ℕ) [Fact p.Prime] (n : ℕ) : +- let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p +- let T := standardLubinTateLevelField hπ n +- Algebra.adjoin ℚ_[p] +- ({padicMultiplicativePrimitiveRoot p n} : Set T) = +- ⊤ := by +- let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p +- let T := standardLubinTateLevelField hπ n +- let ζ : T := padicMultiplicativePrimitiveRoot p n +- let m := p ^ (n + 1) +- let : NeZero m := +- ⟨pow_ne_zero _ (Fact.out : Nat.Prime p).ne_zero⟩ +- let : FiniteDimensional ℚ_[p] T := +- standardLubinTateLevelField_finiteDimensional hπ n +- have hζ : IsPrimitiveRoot ζ m := by +- simpa only [ζ, m] using +- padicMultiplicativePrimitiveRoot_isPrimitiveRoot p n +- let A : IntermediateField ℚ_[p] T := +- IntermediateField.adjoin ℚ_[p] {ζ} +- let : IsCyclotomicExtension {m} ℚ_[p] A := +- hζ.intermediateField_adjoin_isCyclotomicExtension ℚ_[p] +- have hAfin : +- Module.finrank ℚ_[p] A = Nat.totient m := by +- exact +- IsCyclotomicExtension.finrank A +- (by +- simpa only [m] using +- padicCyclotomicPolynomial_irreducible_prime_pow_succ +- p n) +- have hTfin : +- Module.finrank ℚ_[p] T = Nat.totient m := by +- rw [standardLubinTateLevelField_finrank hπ n] +- have hcard : +- Nat.card (padicLocalField p).residueField = p := by +- simpa [padicLocalField] using +- padicCompleteDVF_residueField_card p +- rw [hcard, Nat.totient_prime_pow +- (Fact.out : Nat.Prime p) (Nat.succ_pos n)] +- simp [Nat.mul_comm] +- have hAeq : A = ⊤ := by +- apply IntermediateField.eq_of_le_of_finrank_eq le_top +- simpa using hAfin.trans hTfin.symm +- calc +- Algebra.adjoin ℚ_[p] {ζ} = A.toSubalgebra := by +- exact +- (IntermediateField.adjoin_toSubalgebra +- ({ζ} : Set T)).symm +- _ = (⊤ : IntermediateField ℚ_[p] T).toSubalgebra := +- congrArg IntermediateField.toSubalgebra hAeq +- _ = ⊤ := rfl +- +-/-- The standard multiplicative Lubin--Tate level is the actual +-`p ^ (n + 1)`-cyclotomic extension of `ℚ_p`. -/ +-theorem padicMultiplicativeLevel_isCyclotomicExtension +- (p : ℕ) [Fact p.Prime] (n : ℕ) : +- let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p +- let T := standardLubinTateLevelField hπ n +- IsCyclotomicExtension {p ^ (n + 1)} ℚ_[p] T := by +- let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p +- let T := standardLubinTateLevelField hπ n +- exact +- padic_isCyclotomicExtension_of_primitiveRoot_adjoin_eq_top +- (padicMultiplicativePrimitiveRoot p n) +- (padicMultiplicativePrimitiveRoot_isPrimitiveRoot p n) +- (padicMultiplicativePrimitiveRoot_adjoin_eq_top p n) +- +-private theorem +- rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_isPrimitiveRoot +- (p : Nat.Primes) (n : ℕ) : +- IsPrimitiveRoot +- (rationalCyclotomicLocalizedPrimitiveRoot +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p)) +- (p.1 ^ (n + 1)) := by +- change +- IsPrimitiveRoot +- (rationalCyclotomicLocalizedPrimitiveRoot +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p)) +- (rationalCyclotomicPrincipalPrimeModulus p n : ℕ) +- exact +- rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p) +- +-private theorem +- rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_adjoin_eq_top +- (p : Nat.Primes) (n : ℕ) : +- Algebra.adjoin ℚ_[p.1] +- ({rationalCyclotomicLocalizedPrimitiveRoot +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (rationalCyclotomicArtinPlace p)} : +- Set (rationalCyclotomicArtinLocalizedField +- (rationalCyclotomicPrincipalPrimeModulus p n) p)) = +- ⊤ := by +- exact +- (Subalgebra.restrictScalars_injective ℚ) +- (rationalCyclotomicArtin_padicAlgebraAdjoin_restrict_eq_top +- (rationalCyclotomicPrincipalPrimeModulus p n) p) +- +-private theorem +- rationalCyclotomicPrincipalPrimeLocalizedLevel_isCyclotomicExtension +- (p : Nat.Primes) (n : ℕ) : +- IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] +- (rationalCyclotomicArtinLocalizedField +- (rationalCyclotomicPrincipalPrimeModulus p n) p) := by +- exact +- padic_isCyclotomicExtension_of_primitiveRoot_adjoin_eq_top +- (rationalCyclotomicLocalizedPrimitiveRoot +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (rationalCyclotomicArtinPlace p)) +- (rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_isPrimitiveRoot +- p n) +- (rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_adjoin_eq_top +- p n) +- +-/-- The chosen localized global cyclotomic level, transported over the +-completion equivalence, is the standard multiplicative Lubin--Tate level. -/ +-noncomputable def rationalCyclotomicLocalizedCompletionPadicAlgEquiv +- (p : Nat.Primes) (n : ℕ) : +- rationalCyclotomicArtinLocalizedField +- (rationalCyclotomicPrincipalPrimeModulus p n) p ≃ₐ[ℚ_[p.1]] +- RationalCyclotomicPrincipalPrimePadicLevel p n := by +- letI : IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] +- (rationalCyclotomicArtinLocalizedField +- (rationalCyclotomicPrincipalPrimeModulus p n) p) := +- rationalCyclotomicPrincipalPrimeLocalizedLevel_isCyclotomicExtension p n +- letI : IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] +- (RationalCyclotomicPrincipalPrimePadicLevel p n) := +- padicMultiplicativeLevel_isCyclotomicExtension p.1 n +- exact +- IsCyclotomicExtension.algEquiv +- {p.1 ^ (n + 1)} ℚ_[p.1] +- (rationalCyclotomicArtinLocalizedField +- (rationalCyclotomicPrincipalPrimeModulus p n) p) +- (RationalCyclotomicPrincipalPrimePadicLevel p n) +- +-/-! ## The ramified principal finite-place factor -/ +- +-private theorem +- rationalCyclotomicPrincipalPrime_galEquivZMod_eq_of_action +- (p : Nat.Primes) (n : ℕ) +- (sigma : Gal( +- rationalCyclotomicPrincipalPrimeLevel +- (rationalCyclotomicPrincipalPrimeModulus p n) / ℚ)) +- (a : (ZMod (p.1 ^ (n + 1)))ˣ) +- (haction : +- sigma (rationalCyclotomicLevelPrimitiveRoot +- (rationalCyclotomicPrincipalPrimeModulus p n)) = +- rationalCyclotomicLevelPrimitiveRoot +- (rationalCyclotomicPrincipalPrimeModulus p n) ^ a.val.val) : +- IsCyclotomicExtension.Rat.galEquivZMod +- (p.1 ^ (n + 1)) +- (rationalCyclotomicPrincipalPrimeLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (hK := +- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension +- (rationalCyclotomicPrincipalPrimeModulus p n)) sigma = +- a := by +- let m := rationalCyclotomicPrincipalPrimeModulus p n +- let L := rationalCyclotomicPrincipalPrimeLevel m +- let zeta : L := rationalCyclotomicLevelPrimitiveRoot m +- have hzeta : IsPrimitiveRoot zeta (p.1 ^ (n + 1)) := by +- change +- IsPrimitiveRoot +- (rationalCyclotomicLevelPrimitiveRoot m) (m : ℕ) +- exact rationalCyclotomicLevelPrimitiveRoot_isPrimitiveRoot m +- change +- IsCyclotomicExtension.Rat.galEquivZMod +- (p.1 ^ (n + 1)) L +- (hK := +- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) +- sigma = a +- let c := +- IsCyclotomicExtension.Rat.galEquivZMod +- (p.1 ^ (n + 1)) L +- (hK := +- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) +- sigma +- have hc : +- sigma zeta = zeta ^ c.val.val := +- IsCyclotomicExtension.Rat.galEquivZMod_apply_of_pow_eq +- (hK := +- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) +- (p.1 ^ (n + 1)) L sigma hzeta.pow_eq_one +- have hpowers : +- zeta ^ c.val.val = zeta ^ a.val.val := +- hc.symm.trans haction +- rw [(hzeta.isOfFinOrder m.ne_zero).pow_inj_mod, +- ← hzeta.eq_orderOf, +- ← ZMod.natCast_eq_natCast_iff'] at hpowers +- change +- (c.val.val : ZMod (p.1 ^ (n + 1))) = +- (a.val.val : ZMod (p.1 ^ (n + 1))) at hpowers +- have hValues : c.val = a.val := by +- calc +- c.val = (c.val.val : ZMod (p.1 ^ (n + 1))) := +- (ZMod.natCast_zmod_val c.val).symm +- _ = (a.val.val : ZMod (p.1 ^ (n + 1))) := hpowers +- _ = a.val := ZMod.natCast_zmod_val a.val +- change c = a +- apply Units.ext +- exact hValues +- +-/-- The chosen finite-place Artin map factors through any extension identified +-with the chosen one. -/ +-theorem chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq +- {K L : Type} +- [Field K] [NumberField K] +- [Field L] [Algebra K L] +- [FiniteDimensional K L] [IsAbelianGalois K L] +- (v : HeightOneSpectrum (𝓞 K)) +- (w : AbsoluteValueExtension +- (HeightOneSpectrum.adicAbv K v) L) +- (hw : chosenFinitePlaceExtension (L := L) v = w) +- (x : (v.adicCompletion K)ˣ) : +- chosenFinitePlaceArtinMonoidHom +- (K := K) (L := L) v x = +- finitePlaceLocalToGlobalMonoidHom +- (K := K) (L := L) v w +- (finitePlaceLocalArtinMonoidHom +- (K := K) (L := L) v w x) := by +- subst w +- exact +- congrArg +- (fun f : (v.adicCompletion K)ˣ →* (L ≃ₐ[K] L) => f x) +- (finitePlaceArtinMonoidHomOfExtension_factor +- (K := K) (L := L) v +- (chosenFinitePlaceExtension (L := L) v)) +- +-private theorem +- chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq_at +- {K L : Type} +- [Field K] [NumberField K] +- [Field L] [Algebra K L] +- [FiniteDimensional K L] [IsAbelianGalois K L] +- (v : HeightOneSpectrum (𝓞 K)) +- (w : AbsoluteValueExtension +- (HeightOneSpectrum.adicAbv K v) L) +- (hw : chosenFinitePlaceExtension (L := L) v = w) +- (x : (v.adicCompletion K)ˣ) (z : L) : +- chosenFinitePlaceArtinMonoidHom +- (K := K) (L := L) v x z = +- finitePlaceLocalToGlobalMonoidHom +- (K := K) (L := L) v w +- (finitePlaceLocalArtinMonoidHom +- (K := K) (L := L) v w x) z := by +- exact +- congrArg (fun sigma : Gal(L / K) => sigma z) +- (chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq +- (K := K) (L := L) v w hw x) +- +-private theorem finitePlaceLocalToGlobalMonoidHom_apply_pow_of_localized_action +- {K L : Type} +- [Field K] [NumberField K] +- [Field L] [Algebra K L] +- [FiniteDimensional K L] [IsAbelianGalois K L] +- (v : HeightOneSpectrum (𝓞 K)) +- (w : AbsoluteValueExtension +- (HeightOneSpectrum.adicAbv K v) L) +- (sigma : +- let vK := HeightOneSpectrum.adicAbv K v +- let E := LocalizedCompletion vK w +- letI : Algebra vK.Completion E := +- finitePlaceLocalArtinLocalizedAlgebra v w +- Gal(E / vK.Completion)) +- (z : L) +- (zLocal : +- let vK := HeightOneSpectrum.adicAbv K v +- LocalizedCompletion vK w) +- (e : ℕ) +- (hLocalization : +- let vK := HeightOneSpectrum.adicAbv K v +- let E := LocalizedCompletion vK w +- letI : Algebra vK.Completion E := +- finitePlaceLocalArtinLocalizedAlgebra v w +- let eLoc : L →+* E := +- AbsoluteValue.toAlgebraicLocalization vK w.1 w.2 +- eLoc z = zLocal) +- (hlocal : sigma zLocal = zLocal ^ e) : +- finitePlaceLocalToGlobalMonoidHom +- (K := K) (L := L) v w sigma z = z ^ e := by +- let vK := HeightOneSpectrum.adicAbv K v +- let hvK : vK.IsNontrivial := RayClass.adicAbv_isNontrivial v +- let E := LocalizedCompletion vK w +- let : Algebra vK.Completion E := +- finitePlaceLocalArtinLocalizedAlgebra v w +- let eD : absoluteValueDecompositionGroup K w.1 ≃* Gal(E / vK.Completion) := +- decompositionGroupEquivAlgebraicLocalizationAut vK hvK w +- let eLoc : L →+* E := +- AbsoluteValue.toAlgebraicLocalization vK w.1 w.2 +- let delta : absoluteValueDecompositionGroup K w.1 := eD.symm sigma +- have hDecomposition : eD delta = sigma := eD.apply_symm_apply sigma +- apply eLoc.injective +- calc +- eLoc (finitePlaceLocalToGlobalMonoidHom +- (K := K) (L := L) v w sigma z) = +- eD delta (eLoc z) := +- (localizationRamificationGroups_decompositionGroupEquiv_toLocalization +- vK hvK w delta z).symm +- _ = sigma (eLoc z) := +- congrArg (fun tau : Gal(E / vK.Completion) => tau (eLoc z)) +- hDecomposition +- _ = sigma zLocal := +- congrArg (fun y : E => sigma y) hLocalization +- _ = zLocal ^ e := hlocal +- _ = (eLoc z) ^ e := +- congrArg (fun y : E => y ^ e) hLocalization.symm +- _ = eLoc (z ^ e) := (map_pow eLoc z e).symm +- +-private theorem map_primitiveRoot_eq_pow_of_eq_pow +- {M : Type} [CommRing M] [IsDomain M] +- (f : M →* M) (zeta rho : M) (order exponent : ℕ) +- [NeZero order] +- (hzeta : IsPrimitiveRoot zeta order) +- (hrho : IsPrimitiveRoot rho order) +- (hf : f zeta = zeta ^ exponent) : +- f rho = rho ^ exponent := by +- obtain ⟨j, -, hj⟩ := +- hzeta.eq_pow_of_pow_eq_one hrho.pow_eq_one +- calc +- f rho = f (zeta ^ j) := congrArg f hj.symm +- _ = (f zeta) ^ j := map_pow f zeta j +- _ = (zeta ^ exponent) ^ j := congrArg (fun z => z ^ j) hf +- _ = zeta ^ (exponent * j) := (pow_mul zeta exponent j).symm +- _ = zeta ^ (j * exponent) := +- congrArg (fun e : ℕ => zeta ^ e) (Nat.mul_comm exponent j) +- _ = (zeta ^ j) ^ exponent := pow_mul zeta j exponent +- _ = rho ^ exponent := congrArg (fun z => z ^ exponent) hj +- +-private theorem finitePlaceLocalArtinMonoidHom_apply_semilinear +- {K L K' L' : Type} +- [Field K] [NumberField K] +- [Field L] [Algebra K L] +- [hKLfinite : FiniteDimensional K L] [IsAbelianGalois K L] +- [Field K'] [ValuativeRel K'] [TopologicalSpace K'] +- [IsNonarchimedeanLocalField K'] +- [Field L'] [Algebra K' L'] +- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] +- (v : HeightOneSpectrum (𝓞 K)) +- (w : AbsoluteValueExtension +- (HeightOneSpectrum.adicAbv K v) L) +- (eK : (HeightOneSpectrum.adicAbv K v).Completion ≃+* K') +- (eL : LocalizedCompletion +- (HeightOneSpectrum.adicAbv K v) w ≃+* L') +- (hcomm : ∀ y : (HeightOneSpectrum.adicAbv K v).Completion, +- eL (@algebraMap +- (HeightOneSpectrum.adicAbv K v).Completion +- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) +- _ _ (finitePlaceLocalArtinLocalizedAlgebra v w) y) = +- algebraMap K' L' (eK y)) +- (hExt : SemilinearValuationCompatible +- (HeightOneSpectrum.adicAbv K v).Completion K' eK) +- (x : (v.adicCompletion K)ˣ) +- (z : LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) : +- eL (finitePlaceLocalArtinMonoidHom +- (K := K) (L := L) v w x z) = +- LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' +- (Units.map eK.toMonoidHom +- (finitePlaceLocalArtinInput v x)) (eL z) := by +- calc +- eL (finitePlaceLocalArtinMonoidHom +- (K := K) (L := L) v w x z) = +- eL ((@LocalClassFieldTheory.abelianLocalArtinMonoidHom +- (HeightOneSpectrum.adicAbv K v).Completion +- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) +- (inferInstance : Field +- (HeightOneSpectrum.adicAbv K v).Completion) +- (inferInstance : Field +- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) +- (finitePlaceLocalArtinLocalizedAlgebra v w) +- (finitePlaceLocalArtinCompletionValuativeRel v) +- (inferInstance : TopologicalSpace +- (HeightOneSpectrum.adicAbv K v).Completion) +- (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) +- (finitePlaceLocalArtinFiniteDimensional v w) +- (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) +- (finitePlaceLocalArtinInput v x)) z) := +- congrArg eL +- (finitePlaceLocalArtinMonoidHom_apply_normalized_at +- (K := K) (L := L) v w x z) +- _ = LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' +- (Units.map eK.toMonoidHom +- (finitePlaceLocalArtinInput v x)) (eL z) := +- @abelianLocalArtinMonoidHom_semilinear_action +- (HeightOneSpectrum.adicAbv K v).Completion K' +- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) L' +- (inferInstance : Field +- (HeightOneSpectrum.adicAbv K v).Completion) +- (finitePlaceLocalArtinCompletionValuativeRel v) +- (inferInstance : TopologicalSpace +- (HeightOneSpectrum.adicAbv K v).Completion) +- (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) +- (inferInstance : Field K') +- (inferInstance : ValuativeRel K') +- (inferInstance : TopologicalSpace K') +- (inferInstance : IsNonarchimedeanLocalField K') +- (inferInstance : Field +- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) +- (inferInstance : Field L') +- (finitePlaceLocalArtinLocalizedAlgebra v w) +- (inferInstance : Algebra K' L') +- (finitePlaceLocalArtinFiniteDimensional v w) +- (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) +- (inferInstance : FiniteDimensional K' L') +- (inferInstance : IsAbelianGalois K' L') +- eK eL hcomm hExt (finitePlaceLocalArtinInput v x) z +- +-/-- If a semilinearly identified target local Artin value is trivial, then the +-corresponding global finite-place Artin value is trivial. This generic bridge +-keeps concrete completion and localization instance towers out of downstream +-proof terms. -/ +-theorem finitePlaceArtinMonoidHomOfExtension_eq_one_of_semilinear +- {K L K' L' : Type} +- [Field K] [NumberField K] +- [Field L] [Algebra K L] +- [hKLfinite : FiniteDimensional K L] [IsAbelianGalois K L] +- [Field K'] [ValuativeRel K'] [TopologicalSpace K'] +- [IsNonarchimedeanLocalField K'] +- [Field L'] [Algebra K' L'] +- [FiniteDimensional K' L'] [IsAbelianGalois K' L'] +- (v : HeightOneSpectrum (𝓞 K)) +- (w : AbsoluteValueExtension +- (HeightOneSpectrum.adicAbv K v) L) +- (eK : (HeightOneSpectrum.adicAbv K v).Completion ≃+* K') +- (eL : LocalizedCompletion +- (HeightOneSpectrum.adicAbv K v) w ≃+* L') +- (hcomm : ∀ y : (HeightOneSpectrum.adicAbv K v).Completion, +- eL (@algebraMap +- (HeightOneSpectrum.adicAbv K v).Completion +- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) +- _ _ (finitePlaceLocalArtinLocalizedAlgebra v w) y) = +- algebraMap K' L' (eK y)) +- (hExt : SemilinearValuationCompatible +- (HeightOneSpectrum.adicAbv K v).Completion K' eK) +- (x : (v.adicCompletion K)ˣ) +- (htrivial : +- LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' +- (Units.map eK.toMonoidHom +- (finitePlaceLocalArtinInput v x)) = 1) : +- finitePlaceArtinMonoidHomOfExtension +- (K := K) (L := L) v w x = 1 := by +- rw [finitePlaceArtinMonoidHomOfExtension_factor, +- MonoidHom.comp_apply] +- have hlocal : +- finitePlaceLocalArtinMonoidHom +- (K := K) (L := L) v w x = 1 := by +- rw [finitePlaceLocalArtinMonoidHom_apply_normalized] +- exact +- @abelianLocalArtinMonoidHom_eq_one_of_semilinear +- (HeightOneSpectrum.adicAbv K v).Completion K' +- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) L' +- (inferInstance : Field +- (HeightOneSpectrum.adicAbv K v).Completion) +- (finitePlaceLocalArtinCompletionValuativeRel v) +- (inferInstance : TopologicalSpace +- (HeightOneSpectrum.adicAbv K v).Completion) +- (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) +- (inferInstance : Field K') +- (inferInstance : ValuativeRel K') +- (inferInstance : TopologicalSpace K') +- (inferInstance : IsNonarchimedeanLocalField K') +- (inferInstance : Field +- (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) +- (inferInstance : Field L') +- (finitePlaceLocalArtinLocalizedAlgebra v w) +- (inferInstance : Algebra K' L') +- (finitePlaceLocalArtinFiniteDimensional v w) +- (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) +- (inferInstance : FiniteDimensional K' L') +- (inferInstance : IsAbelianGalois K' L') +- eK eL hcomm hExt (finitePlaceLocalArtinInput v x) htrivial +- rw [hlocal, map_one] +- +-private noncomputable def rationalCyclotomicPrincipalPrimeLocalizedRoot +- (p : Nat.Primes) (n : ℕ) : +- rationalCyclotomicArtinLocalizedField +- (rationalCyclotomicPrincipalPrimeModulus p n) p := +- rationalCyclotomicLocalizedPrimitiveRoot +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p) +- +-private noncomputable def rationalCyclotomicPrincipalPrimeResidueUnit +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- (ZMod (p.1 ^ (n + 1)))ˣ := +- Units.map +- (PadicInt.toZModPow (p := p.1) (n + 1)).toMonoidHom +- (padicIntUnitOfRat p +- (rationalPrimeUnit x p : ℚ) +- (rationalPrimeUnit x p).ne_zero +- (padicValRat_rationalPrimeUnit x p)) +- +-private theorem rationalCyclotomicPrincipalPrime_localizedBase_commutes +- (p : Nat.Primes) (n : ℕ) +- (y : (rationalCyclotomicArtinBaseAbv p).Completion) : +- rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion +- (rationalCyclotomicArtinLocalizedField +- (rationalCyclotomicPrincipalPrimeModulus p n) p) y) = +- algebraMap ℚ_[p.1] +- (RationalCyclotomicPrincipalPrimePadicLevel p n) +- (rationalFinitePlaceCompletionRingEquivPadic p y) := by +- let m := rationalCyclotomicPrincipalPrimeModulus p n +- let E := rationalCyclotomicArtinLocalizedField m p +- let eL := rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- have hy : +- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y = +- algebraMap ℚ_[p.1] E +- (rationalFinitePlaceCompletionRingEquivPadic p y) := by +- change +- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y = +- algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E +- ((rationalFinitePlaceCompletionRingEquivPadic p).symm +- (rationalFinitePlaceCompletionRingEquivPadic p y)) +- exact +- (congrArg +- (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E) +- ((rationalFinitePlaceCompletionRingEquivPadic p).symm_apply_apply y)).symm +- calc +- eL (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y) = +- eL (algebraMap ℚ_[p.1] E +- (rationalFinitePlaceCompletionRingEquivPadic p y)) := +- congrArg eL hy +- _ = algebraMap ℚ_[p.1] +- (RationalCyclotomicPrincipalPrimePadicLevel p n) +- (rationalFinitePlaceCompletionRingEquivPadic p y) := +- eL.commutes (rationalFinitePlaceCompletionRingEquivPadic p y) +- +-/-- Specialized ramified-prime bridge from the standard `p`-adic Artin value +-to the canonical global finite-place Artin value. The localized completion +-and all of its dependent instances remain private to this provider. -/ +-theorem +- rationalCyclotomicPrincipalPrime_finitePlaceArtinOfExtension_eq_one_of_padic +- (p : Nat.Primes) (n : ℕ) +- (x : ((RayClass.rationalPrime p).adicCompletion ℚ)ˣ) +- (htrivial : +- abelianLocalArtinMonoidHom ℚ_[p.1] +- (RationalCyclotomicPrincipalPrimePadicLevel p n) +- (Units.map +- (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom +- (finitePlaceLocalArtinInput (RayClass.rationalPrime p) x)) = 1) : +- finitePlaceArtinMonoidHomOfExtension +- (K := ℚ) +- (L := KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (RayClass.rationalPrime p) +- (rationalCyclotomicChosenFinitePlaceExtension +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p)) x = 1 := by +- exact +- finitePlaceArtinMonoidHomOfExtension_eq_one_of_semilinear +- (K := ℚ) +- (L := KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (K' := ℚ_[p.1]) +- (L' := RationalCyclotomicPrincipalPrimePadicLevel p n) +- (RayClass.rationalPrime p) +- (rationalCyclotomicChosenFinitePlaceExtension +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p)) +- (rationalFinitePlaceCompletionRingEquivPadic p) +- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n).toRingEquiv +- (rationalCyclotomicPrincipalPrime_localizedBase_commutes p n) +- (rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible p) +- x htrivial +- +-private theorem +- padicMultiplicativePrimitiveRoot_rationalPrimeUnitParameterGaloisAction +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- standardLubinTateUnitParameterEquivGal +- (padicLocalField p.1) +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n +- (standardLubinTateUnitParameterClass +- (padicLocalField p.1) n +- (rationalPrimeUnitValuationSubringUnit x p)) +- (padicMultiplicativePrimitiveRoot p.1 n) = +- padicMultiplicativePrimitiveRoot p.1 n ^ +- (PadicInt.toZModPow (p := p.1) (n + 1) +- (padicIntUnitOfRat p +- (rationalPrimeUnit x p : ℚ) +- (rationalPrimeUnit x p).ne_zero +- (padicValRat_rationalPrimeUnit x p) : ℤ_[p.1])).val := by +- let uZ : ℤ_[p.1]ˣ := +- padicIntUnitOfRat p +- (rationalPrimeUnit x p : ℚ) +- (rationalPrimeUnit x p).ne_zero +- (padicValRat_rationalPrimeUnit x p) +- let u : (padicLocalField p.1).valuationSubringˣ := +- Units.map (padicIntEquivValuationSubring p.1).toMonoidHom uZ +- have huRational : +- rationalPrimeUnitValuationSubringUnit x p = u := by +- rfl +- have huPreimage : +- (padicIntEquivValuationSubring p.1).symm +- ((u : (padicLocalField p.1).valuationSubringˣ) : +- (padicLocalField p.1).valuationSubring) = +- (uZ : ℤ_[p.1]) := by +- change +- (padicIntEquivValuationSubring p.1).symm +- (padicIntEquivValuationSubring p.1 (uZ : ℤ_[p.1])) = +- (uZ : ℤ_[p.1]) +- exact +- (padicIntEquivValuationSubring p.1).symm_apply_apply +- (uZ : ℤ_[p.1]) +- have hAction := +- padicMultiplicativePrimitiveRoot_unitParameterGaloisAction +- p.1 n u +- rw [huPreimage] at hAction +- rw [huRational] +- exact hAction +- +-private noncomputable def rationalCyclotomicPrincipalPrimePadicTargetArtin +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- Gal(RationalCyclotomicPrincipalPrimePadicLevel p n / ℚ_[p.1]) := +- @LocalClassFieldTheory.abelianLocalArtinMonoidHom +- ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) +- (inferInstance : Field ℚ_[p.1]) +- (inferInstance : Field +- (RationalCyclotomicPrincipalPrimePadicLevel p n)) +- (inferInstance : Algebra ℚ_[p.1] +- (RationalCyclotomicPrincipalPrimePadicLevel p n)) +- (inferInstance : ValuativeRel ℚ_[p.1]) +- (inferInstance : TopologicalSpace ℚ_[p.1]) +- (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) +- (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) +- (standardLubinTateLevelField_isAbelianGalois +- (padicLocalField p.1) +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) +- (Units.map +- (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom +- (rationalPrincipalFinitePlaceInput x p)) +- +-private noncomputable def +- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- Gal(RationalCyclotomicPrincipalPrimePadicLevel p n / ℚ_[p.1]) := +- standardLubinTateUnitParameterEquivGal +- (padicLocalField p.1) +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n +- (standardLubinTateUnitParameterClass +- (padicLocalField p.1) n +- (rationalPrimeUnitValuationSubringUnit x p)) +- +-private theorem +- rationalCyclotomicPrincipalPrime_padicTargetArtin_eq_unitParameter +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- rationalCyclotomicPrincipalPrimePadicTargetArtin p n x = +- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x := by +- let T := RationalCyclotomicPrincipalPrimePadicLevel p n +- let eK := rationalFinitePlaceCompletionRingEquivPadic p +- let : FiniteDimensional ℚ_[p.1] T := +- rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n +- let hpi := padicMultiplicativeLubinTateSeries_isUniformizer p.1 +- let : IsAbelianGalois ℚ_[p.1] T := +- standardLubinTateLevelField_isAbelianGalois +- (padicLocalField p.1) hpi n +- have hsource : +- Units.map eK.toMonoidHom (rationalPrincipalFinitePlaceInput x p) = +- Units.map (algebraMap ℚ ℚ_[p.1]).toMonoidHom x := by +- rw [rationalPrincipalFinitePlaceInput_eq_algebraMap] +- apply Units.ext +- exact rationalFinitePlaceCompletionRingEquivPadic_algebraMap p (x : ℚ) +- change +- LocalClassFieldTheory.abelianLocalArtinMonoidHom ℚ_[p.1] T +- (Units.map eK.toMonoidHom +- (rationalPrincipalFinitePlaceInput x p)) = +- standardLubinTateUnitParameterEquivGal +- (padicLocalField p.1) hpi n +- (standardLubinTateUnitParameterClass +- (padicLocalField p.1) n +- (rationalPrimeUnitValuationSubringUnit x p)) +- rw [hsource] +- rw [ +- padicMultiplicativeAbelianLocalArtin_eq_uniformizerUnitPart, +- rationalPadicFieldUnit_uniformizerUnitPart, +- padicMultiplicativeAbelianLocalArtin_eq_unitParameter] +- +-private theorem +- rationalCyclotomicPrincipalPrime_padicArtin_action_eq_unitParameter +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- (@LocalClassFieldTheory.abelianLocalArtinMonoidHom +- ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) +- (inferInstance : Field ℚ_[p.1]) +- (inferInstance : Field +- (RationalCyclotomicPrincipalPrimePadicLevel p n)) +- (inferInstance : Algebra ℚ_[p.1] +- (RationalCyclotomicPrincipalPrimePadicLevel p n)) +- (inferInstance : ValuativeRel ℚ_[p.1]) +- (inferInstance : TopologicalSpace ℚ_[p.1]) +- (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) +- (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) +- (standardLubinTateLevelField_isAbelianGalois +- (padicLocalField p.1) +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) +- (Units.map +- (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom +- (finitePlaceLocalArtinInput +- (K := ℚ) (RayClass.rationalPrime p) +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime p) +- (IdeleGroup.principalIdele ℚ x))))) +- ((rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n).toRingEquiv +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) = +- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x +- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := by +- let eK := rationalFinitePlaceCompletionRingEquivPadic p +- have hInput : +- finitePlaceLocalArtinInput +- (K := ℚ) (RayClass.rationalPrime p) +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime p) +- (IdeleGroup.principalIdele ℚ x)) = +- rationalPrincipalFinitePlaceInput x p := by +- rfl +- have hMapped : +- Units.map eK.toMonoidHom +- (finitePlaceLocalArtinInput +- (K := ℚ) (RayClass.rationalPrime p) +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime p) +- (IdeleGroup.principalIdele ℚ x))) = +- Units.map eK.toMonoidHom +- (rationalPrincipalFinitePlaceInput x p) := +- congrArg (Units.map eK.toMonoidHom) hInput +- calc +- _ = rationalCyclotomicPrincipalPrimePadicTargetArtin p n x +- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := by +- exact congrArg +- (fun uQp => +- (@LocalClassFieldTheory.abelianLocalArtinMonoidHom +- ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) +- (inferInstance : Field ℚ_[p.1]) +- (inferInstance : Field +- (RationalCyclotomicPrincipalPrimePadicLevel p n)) +- (inferInstance : Algebra ℚ_[p.1] +- (RationalCyclotomicPrincipalPrimePadicLevel p n)) +- (inferInstance : ValuativeRel ℚ_[p.1]) +- (inferInstance : TopologicalSpace ℚ_[p.1]) +- (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) +- (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) +- (standardLubinTateLevelField_isAbelianGalois +- (padicLocalField p.1) +- (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) +- uQp) +- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n))) +- hMapped +- _ = rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x +- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := +- congrArg +- (fun tau => tau +- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n))) +- (rationalCyclotomicPrincipalPrime_padicTargetArtin_eq_unitParameter +- p n x) +- +-private theorem +- rationalCyclotomicPrincipalPrime_padicUnitParameterArtin_action +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x +- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) = +- (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) ^ +- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := by +- let m := rationalCyclotomicPrincipalPrimeModulus p n +- let E := rationalCyclotomicArtinLocalizedField m p +- let T := RationalCyclotomicPrincipalPrimePadicLevel p n +- let eL : E ≃ₐ[ℚ_[p.1]] T := +- rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- let zetaE : E := rationalCyclotomicPrincipalPrimeLocalizedRoot p n +- let tau : Gal(T / ℚ_[p.1]) := +- rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x +- let a := rationalCyclotomicPrincipalPrimeResidueUnit p n x +- let zetaT : T := padicMultiplicativePrimitiveRoot p.1 n +- have hzetaE : IsPrimitiveRoot zetaE (p.1 ^ (n + 1)) := by +- change +- IsPrimitiveRoot +- (rationalCyclotomicLocalizedPrimitiveRoot m +- (RayClass.rationalPrime p)) (m : ℕ) +- exact +- rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot +- m (RayClass.rationalPrime p) +- have hrho : IsPrimitiveRoot (eL zetaE) (p.1 ^ (n + 1)) := +- hzetaE.map_of_injective eL.injective +- have hzetaT : IsPrimitiveRoot zetaT (p.1 ^ (n + 1)) := +- padicMultiplicativePrimitiveRoot_isPrimitiveRoot p.1 n +- have htauZetaT : tau zetaT = zetaT ^ a.val.val := +- padicMultiplicativePrimitiveRoot_rationalPrimeUnitParameterGaloisAction +- p n x +- exact +- map_primitiveRoot_eq_pow_of_eq_pow +- tau.toMonoidHom zetaT (eL zetaE) +- (p.1 ^ (n + 1)) a.val.val hzetaT hrho htauZetaT +- +-private theorem rationalCyclotomicPrincipalPrime_localArtin_action +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- finitePlaceLocalArtinMonoidHom +- (K := ℚ) +- (L := KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (RayClass.rationalPrime p) +- (rationalCyclotomicChosenFinitePlaceExtension +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p)) +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime p) +- (IdeleGroup.principalIdele ℚ x)) +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) = +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ^ +- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := by +- let eL := rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n +- apply eL.injective +- calc +- _ = _ := +- finitePlaceLocalArtinMonoidHom_apply_semilinear +- (K := ℚ) +- (L := KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (K' := ℚ_[p.1]) +- (L' := RationalCyclotomicPrincipalPrimePadicLevel p n) +- (RayClass.rationalPrime p) +- (rationalCyclotomicChosenFinitePlaceExtension +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p)) +- (rationalFinitePlaceCompletionRingEquivPadic p) +- eL.toRingEquiv +- (rationalCyclotomicPrincipalPrime_localizedBase_commutes p n) +- (rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible +- p) +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime p) +- (IdeleGroup.principalIdele ℚ x)) +- (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) +- _ = rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x +- (eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := +- rationalCyclotomicPrincipalPrime_padicArtin_action_eq_unitParameter +- p n x +- _ = (eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) ^ +- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := +- rationalCyclotomicPrincipalPrime_padicUnitParameterArtin_action p n x +- _ = eL ((rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ^ +- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val) := +- (map_pow eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) +- (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val).symm +- +-/-- The finite-place Artin symbol at the ramified prime, in its canonical +-local-to-global factored form. Keeping this specialization opaque prevents its +-dependent local/global instance tower from being unfolded downstream. -/ +-noncomputable def rationalCyclotomicPrincipalPrimeChosenArtin +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n) ≃ₐ[ℚ] +- KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n) := +- finitePlaceLocalToGlobalMonoidHom +- (K := ℚ) +- (L := KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (RayClass.rationalPrime p) +- (rationalCyclotomicChosenFinitePlaceExtension +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p)) +- (finitePlaceLocalArtinMonoidHom +- (K := ℚ) +- (L := KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (RayClass.rationalPrime p) +- (rationalCyclotomicChosenFinitePlaceExtension +- (rationalCyclotomicPrincipalPrimeModulus p n) +- (RayClass.rationalPrime p)) +- (IdeleGroup.finiteComponent +- (RayClass.rationalPrime p) +- (IdeleGroup.principalIdele ℚ x))) +- +-/-- At the ramified prime, the cyclotomic character of the chosen finite-place +-Artin symbol is the direct reduction of the rational `p`-adic unit. -/ +-theorem galEquivZMod_chosenFinitePlaceArtinMonoidHom_principal_at_prime +- (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : +- IsCyclotomicExtension.Rat.galEquivZMod +- (p.1 ^ (n + 1)) +- (KummerTheory.rationalCyclotomicLevel +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (hK := +- KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension +- (rationalCyclotomicPrincipalPrimeModulus p n)) +- (rationalCyclotomicPrincipalPrimeChosenArtin p n x) = +- Units.map +- (PadicInt.toZModPow (p := p.1) (n + 1)).toMonoidHom +- (padicIntUnitOfRat p +- (rationalPrimeUnit x p : ℚ) +- (rationalPrimeUnit x p).ne_zero +- (padicValRat_rationalPrimeUnit x p)) := by +- change _ = rationalCyclotomicPrincipalPrimeResidueUnit p n x +- apply rationalCyclotomicPrincipalPrime_galEquivZMod_eq_of_action p n +- simp only [rationalCyclotomicPrincipalPrimeChosenArtin] +- apply finitePlaceLocalToGlobalMonoidHom_apply_pow_of_localized_action +- (zLocal := rationalCyclotomicPrincipalPrimeLocalizedRoot p n) +- · rfl +- · exact rationalCyclotomicPrincipalPrime_localArtin_action p n x +- +-end RationalCyclotomicPrincipalPrime ++ rationalFinitePlaceCompletionRatAlgebra ++ primeFact ++ levelNeZero ++ rationalCyclotomicLevelFiniteDimensional ++ rationalCyclotomicLevelIsAbelianGalois ++ rationalFinitePlaceBaseNontriviallyNormedField ++ rationalFinitePlaceBaseLocallyCompactSpace ++ rationalFinitePlaceBaseIsUltrametricDist ++ rationalFinitePlaceBaseValued ++ rationalFinitePlaceBaseValuativeRel ++ rationalFinitePlaceBaseValuationIsNontrivial ++ rationalFinitePlaceBaseValuationCompatible ++ rationalFinitePlaceBaseValuativeRelIsNontrivial ++ rationalFinitePlaceBaseIsValuativeTopology ++ rationalFinitePlaceBaseIsNonarchimedeanLocalField ++ rationalCyclotomicArtinExtensionAlgebra ++ rationalCyclotomicArtinExtensionSMul ++ rationalCyclotomicArtinCompletionAlgebra ++ rationalCyclotomicArtinLocalizedAlgebra ++ rationalCyclotomicArtinLocalizedGlobalAlgebra ++ rationalCyclotomicArtinLocalizedGlobalSMul ++ rationalCyclotomicArtinLocalizedScalarTower ++ rationalCyclotomicArtinLocalizedFiniteDimensional ++ rationalCyclotomicArtinLocalizedIsAbelianGalois ++ rationalCyclotomicArtinLocalizedIsSeparable ++ rationalCyclotomicArtinLocalizedIsCyclotomic ++ rationalCyclotomicArtinExtensionFiniteDimensional ++ rationalCyclotomicArtinExtensionContinuousSMul ++ rationalCyclotomicArtinExtensionLocallyCompact ++ rationalCyclotomicArtinLocalizedLocallyCompact ++ rationalCyclotomicArtinLocalizedIsUltrametricDist ++ rationalCyclotomicArtinLocalizedValued ++ rationalCyclotomicArtinLocalizedValuativeRel ++ rationalCyclotomicArtinLocalizedValuationCompatible ++ rationalCyclotomicArtinLocalizedValuationHasExtension ++ rationalCyclotomicArtinLocalizedValuationIsNontrivial ++ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial ++ rationalCyclotomicArtinLocalizedIsValuativeTopology ++ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField ++ rationalCyclotomicArtinLocalizedIntegerAlgebra ++ rationalCyclotomicArtinLocalizedIsIntegralClosure ++ rationalCyclotomicArtinLocalizedIntegerModuleFinite + + private theorem rationalCyclotomicArtinUnramified + (m : ℕ+) (q : Nat.Primes) +@@ -2440,8 +178,9 @@ noncomputable def rationalCyclotomicArtinLocalExponent + (rationalCyclotomicArtinBaseAbv q).Completion + (Additive.ofMul (rationalCyclotomicArtinLocalInput q x)) + +-/-- The chosen finite-place Artin value in a rational cyclotomic level, with +-the completion and Galois instance arguments frozen at the provider boundary. -/ ++ ++/-- The Galois automorphism of the rational cyclotomic extension at level `m` ++assigned to the nonzero `q`-adic input by the chosen finite-place Artin map. -/ + noncomputable def rationalCyclotomicChosenFinitePlaceArtinValue + (m : ℕ+) (q : Nat.Primes) + (x : ((RayClass.rationalPrime q).adicCompletion ℚ)ˣ) : +@@ -2484,7 +223,12 @@ private theorem rationalCyclotomicArtinLocalArtin_eq + (rationalCyclotomicArtinLevel m))) + (finitePlaceLocalArtinInput + (K := ℚ) (rationalCyclotomicArtinPlace q) x) := by +- rfl ++ unfold rationalCyclotomicArtinLocalArtin ++ have h := finitePlaceLocalArtinMonoidHom_apply_normalized ++ (K := ℚ) (L := rationalCyclotomicArtinLevel m) ++ (rationalCyclotomicArtinPlace q) ++ (rationalCyclotomicArtinExtension m q) x ++ with_reducible exact h + + private theorem rationalCyclotomicChosenArithmeticFrobenius_eq_lift + (m : ℕ+) (q : Nat.Primes) +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinAction.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinAction.lean +new file mode 100644 +index 0000000..fd14a9f +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinAction.lean +@@ -0,0 +1,438 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinTransport ++ ++ ++set_option autoImplicit false ++ ++open scoped Classical NNReal NumberField ValuativeRel ++open NumberField IsDedekindDomain ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open LocalClassFieldTheory ++open LocalFieldTheory ++open LocalFieldTheory.DiscreteValuationField ++open LocalFieldTheory.DiscreteValuationField.Examples.Qp ++open LubinTate ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++section RationalCyclotomicPrincipalPrime ++ ++attribute [local instance] ++ rationalFinitePlaceCompletionRatAlgebra ++ primeFact ++ levelNeZero ++ rationalCyclotomicLevelFiniteDimensional ++ rationalCyclotomicLevelIsAbelianGalois ++ rationalFinitePlaceBaseNontriviallyNormedField ++ rationalFinitePlaceBaseLocallyCompactSpace ++ rationalFinitePlaceBaseIsUltrametricDist ++ rationalFinitePlaceBaseValued ++ rationalFinitePlaceBaseValuativeRel ++ rationalFinitePlaceBaseValuationIsNontrivial ++ rationalFinitePlaceBaseValuationCompatible ++ rationalFinitePlaceBaseValuativeRelIsNontrivial ++ rationalFinitePlaceBaseIsValuativeTopology ++ rationalFinitePlaceBaseIsNonarchimedeanLocalField ++ rationalCyclotomicArtinExtensionAlgebra ++ rationalCyclotomicArtinExtensionSMul ++ rationalCyclotomicArtinCompletionAlgebra ++ rationalCyclotomicArtinLocalizedAlgebra ++ rationalCyclotomicArtinLocalizedGlobalAlgebra ++ rationalCyclotomicArtinLocalizedGlobalSMul ++ rationalCyclotomicArtinLocalizedScalarTower ++ rationalCyclotomicArtinLocalizedFiniteDimensional ++ rationalCyclotomicArtinLocalizedIsAbelianGalois ++ rationalCyclotomicArtinLocalizedIsSeparable ++ rationalCyclotomicArtinLocalizedIsCyclotomic ++ rationalCyclotomicArtinExtensionFiniteDimensional ++ rationalCyclotomicArtinExtensionContinuousSMul ++ rationalCyclotomicArtinExtensionLocallyCompact ++ rationalCyclotomicArtinLocalizedLocallyCompact ++ rationalCyclotomicArtinLocalizedIsUltrametricDist ++ rationalCyclotomicArtinLocalizedValued ++ rationalCyclotomicArtinLocalizedValuativeRel ++ rationalCyclotomicArtinLocalizedValuationCompatible ++ rationalCyclotomicArtinLocalizedValuationHasExtension ++ rationalCyclotomicArtinLocalizedValuationIsNontrivial ++ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial ++ rationalCyclotomicArtinLocalizedIsValuativeTopology ++ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField ++ rationalCyclotomicArtinLocalizedIntegerAlgebra ++ rationalCyclotomicArtinLocalizedIsIntegralClosure ++ rationalCyclotomicArtinLocalizedIntegerModuleFinite ++ rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension ++ rationalCyclotomicArtinLocalizedPadicAlgebra ++ rationalCyclotomicArtinLocalizedPadicScalarTower ++ rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois ++ rationalPrimeFactorCompletionPadicAlgebra ++ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional ++ ++/-- If a semilinearly identified target local Artin value is trivial, then the ++corresponding global finite-place Artin value is trivial. This generic bridge ++keeps concrete completion and localization instance towers out of downstream ++proof terms. -/ ++theorem finitePlaceArtinMonoidHomOfExtension_eq_one_of_semilinear ++ {K L K' L' : Type} ++ [Field K] [NumberField K] ++ [Field L] [Algebra K L] ++ [hKLfinite : FiniteDimensional K L] [IsAbelianGalois K L] ++ [Field K'] [ValuativeRel K'] [TopologicalSpace K'] ++ [IsNonarchimedeanLocalField K'] ++ [Field L'] [Algebra K' L'] ++ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] ++ (v : HeightOneSpectrum (𝓞 K)) ++ (w : AbsoluteValueExtension ++ (HeightOneSpectrum.adicAbv K v) L) ++ (eK : (HeightOneSpectrum.adicAbv K v).Completion ≃+* K') ++ (eL : LocalizedCompletion ++ (HeightOneSpectrum.adicAbv K v) w ≃+* L') ++ (hcomm : ∀ y : (HeightOneSpectrum.adicAbv K v).Completion, ++ eL (@algebraMap ++ (HeightOneSpectrum.adicAbv K v).Completion ++ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) ++ _ _ (finitePlaceLocalArtinLocalizedAlgebra v w) y) = ++ algebraMap K' L' (eK y)) ++ (hExt : SemilinearValuationCompatible ++ (HeightOneSpectrum.adicAbv K v).Completion K' eK) ++ (x : (v.adicCompletion K)ˣ) ++ (htrivial : ++ LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' ++ (Units.map eK.toMonoidHom ++ (finitePlaceLocalArtinInput v x)) = 1) : ++ finitePlaceArtinMonoidHomOfExtension ++ (K := K) (L := L) v w x = 1 := by ++ rw [finitePlaceArtinMonoidHomOfExtension_factor, ++ MonoidHom.comp_apply] ++ have hlocal : ++ finitePlaceLocalArtinMonoidHom ++ (K := K) (L := L) v w x = 1 := by ++ rw [finitePlaceLocalArtinMonoidHom_apply_normalized] ++ exact ++ @abelianLocalArtinMonoidHom_eq_one_of_semilinear ++ (HeightOneSpectrum.adicAbv K v).Completion K' ++ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) L' ++ (inferInstance : Field ++ (HeightOneSpectrum.adicAbv K v).Completion) ++ (finitePlaceLocalArtinCompletionValuativeRel v) ++ (inferInstance : TopologicalSpace ++ (HeightOneSpectrum.adicAbv K v).Completion) ++ (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) ++ (inferInstance : Field K') ++ (inferInstance : ValuativeRel K') ++ (inferInstance : TopologicalSpace K') ++ (inferInstance : IsNonarchimedeanLocalField K') ++ (inferInstance : Field ++ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) ++ (inferInstance : Field L') ++ (finitePlaceLocalArtinLocalizedAlgebra v w) ++ (inferInstance : Algebra K' L') ++ (finitePlaceLocalArtinFiniteDimensional v w) ++ (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) ++ (inferInstance : FiniteDimensional K' L') ++ (inferInstance : IsAbelianGalois K' L') ++ eK eL hcomm hExt (finitePlaceLocalArtinInput v x) htrivial ++ rw [hlocal, map_one] ++ ++/-- The chosen primitive cyclotomic root in the localized prime-power extension. -/ ++noncomputable def rationalCyclotomicPrincipalPrimeLocalizedRoot ++ (p : Nat.Primes) (n : ℕ) : ++ rationalCyclotomicArtinLocalizedField ++ (rationalCyclotomicPrincipalPrimeModulus p n) p := ++ rationalCyclotomicLocalizedPrimitiveRoot ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p) ++ ++/-- The residue modulo `p^(n+1)` of the `p`-adic unit part of a rational unit. -/ ++noncomputable def rationalCyclotomicPrincipalPrimeResidueUnit ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ (ZMod (p.1 ^ (n + 1)))ˣ := ++ Units.map ++ (PadicInt.toZModPow (p := p.1) (n + 1)).toMonoidHom ++ (padicIntUnitOfRat p ++ (rationalPrimeUnit x p : ℚ) ++ (rationalPrimeUnit x p).ne_zero ++ (padicValRat_rationalPrimeUnit x p)) ++ ++theorem rationalCyclotomicPrincipalPrime_localizedBase_commutes ++ (p : Nat.Primes) (n : ℕ) ++ (y : (rationalCyclotomicArtinBaseAbv p).Completion) : ++ rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion ++ (rationalCyclotomicArtinLocalizedField ++ (rationalCyclotomicPrincipalPrimeModulus p n) p) y) = ++ algebraMap ℚ_[p.1] ++ (RationalCyclotomicPrincipalPrimePadicLevel p n) ++ (rationalFinitePlaceCompletionRingEquivPadic p y) := by ++ let m := rationalCyclotomicPrincipalPrimeModulus p n ++ let E := rationalCyclotomicArtinLocalizedField m p ++ let eL := rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ have hy : ++ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y = ++ algebraMap ℚ_[p.1] E ++ (rationalFinitePlaceCompletionRingEquivPadic p y) := by ++ change ++ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y = ++ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E ++ ((rationalFinitePlaceCompletionRingEquivPadic p).symm ++ (rationalFinitePlaceCompletionRingEquivPadic p y)) ++ exact ++ (congrArg ++ (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E) ++ ((rationalFinitePlaceCompletionRingEquivPadic p).symm_apply_apply y)).symm ++ calc ++ eL (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion E y) = ++ eL (algebraMap ℚ_[p.1] E ++ (rationalFinitePlaceCompletionRingEquivPadic p y)) := ++ congrArg eL hy ++ _ = algebraMap ℚ_[p.1] ++ (RationalCyclotomicPrincipalPrimePadicLevel p n) ++ (rationalFinitePlaceCompletionRingEquivPadic p y) := ++ eL.commutes (rationalFinitePlaceCompletionRingEquivPadic p y) ++ ++/-- Specialized ramified-prime bridge from the standard `p`-adic Artin value ++to the canonical global finite-place Artin value. The localized completion ++and all of its dependent instances remain private to this provider. -/ ++theorem ++ rationalCyclotomicPrincipalPrime_finitePlaceArtinOfExtension_eq_one_of_padic ++ (p : Nat.Primes) (n : ℕ) ++ (x : ((RayClass.rationalPrime p).adicCompletion ℚ)ˣ) ++ (htrivial : ++ abelianLocalArtinMonoidHom ℚ_[p.1] ++ (RationalCyclotomicPrincipalPrimePadicLevel p n) ++ (Units.map ++ (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom ++ (finitePlaceLocalArtinInput (RayClass.rationalPrime p) x)) = 1) : ++ finitePlaceArtinMonoidHomOfExtension ++ (K := ℚ) ++ (L := KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (RayClass.rationalPrime p) ++ (rationalCyclotomicChosenFinitePlaceExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p)) x = 1 := by ++ exact ++ finitePlaceArtinMonoidHomOfExtension_eq_one_of_semilinear ++ (K := ℚ) ++ (L := KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (K' := ℚ_[p.1]) ++ (L' := RationalCyclotomicPrincipalPrimePadicLevel p n) ++ (RayClass.rationalPrime p) ++ (rationalCyclotomicChosenFinitePlaceExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p)) ++ (rationalFinitePlaceCompletionRingEquivPadic p) ++ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n).toRingEquiv ++ (rationalCyclotomicPrincipalPrime_localizedBase_commutes p n) ++ (rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible p) ++ x htrivial ++ ++theorem ++ padicMultiplicativePrimitiveRoot_rationalPrimeUnitParameterGaloisAction ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ standardLubinTateUnitParameterEquivGal ++ (padicLocalField p.1) ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n ++ (standardLubinTateUnitParameterClass ++ (padicLocalField p.1) n ++ (rationalPrimeUnitValuationSubringUnit x p)) ++ (padicMultiplicativePrimitiveRoot p.1 n) = ++ padicMultiplicativePrimitiveRoot p.1 n ^ ++ (PadicInt.toZModPow (p := p.1) (n + 1) ++ (padicIntUnitOfRat p ++ (rationalPrimeUnit x p : ℚ) ++ (rationalPrimeUnit x p).ne_zero ++ (padicValRat_rationalPrimeUnit x p) : ℤ_[p.1])).val := by ++ let uZ : ℤ_[p.1]ˣ := ++ padicIntUnitOfRat p ++ (rationalPrimeUnit x p : ℚ) ++ (rationalPrimeUnit x p).ne_zero ++ (padicValRat_rationalPrimeUnit x p) ++ let u : (padicLocalField p.1).valuationSubringˣ := ++ Units.map (padicIntEquivValuationSubring p.1).toMonoidHom uZ ++ have huRational : ++ rationalPrimeUnitValuationSubringUnit x p = u := by ++ rfl ++ have huPreimage : ++ (padicIntEquivValuationSubring p.1).symm ++ ((u : (padicLocalField p.1).valuationSubringˣ) : ++ (padicLocalField p.1).valuationSubring) = ++ (uZ : ℤ_[p.1]) := by ++ change ++ (padicIntEquivValuationSubring p.1).symm ++ (padicIntEquivValuationSubring p.1 (uZ : ℤ_[p.1])) = ++ (uZ : ℤ_[p.1]) ++ exact ++ (padicIntEquivValuationSubring p.1).symm_apply_apply ++ (uZ : ℤ_[p.1]) ++ have hAction := ++ padicMultiplicativePrimitiveRoot_unitParameterGaloisAction ++ p.1 n u ++ rw [huPreimage] at hAction ++ rw [huRational] ++ exact hAction ++ ++private noncomputable def rationalCyclotomicPrincipalPrimePadicTargetArtin ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ Gal(RationalCyclotomicPrincipalPrimePadicLevel p n / ℚ_[p.1]) := ++ @LocalClassFieldTheory.abelianLocalArtinMonoidHom ++ ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) ++ (inferInstance : Field ℚ_[p.1]) ++ (inferInstance : Field ++ (RationalCyclotomicPrincipalPrimePadicLevel p n)) ++ (inferInstance : Algebra ℚ_[p.1] ++ (RationalCyclotomicPrincipalPrimePadicLevel p n)) ++ (inferInstance : ValuativeRel ℚ_[p.1]) ++ (inferInstance : TopologicalSpace ℚ_[p.1]) ++ (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) ++ (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) ++ (standardLubinTateLevelField_isAbelianGalois ++ (padicLocalField p.1) ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) ++ (Units.map ++ (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom ++ (rationalPrincipalFinitePlaceInput x p)) ++ ++/-- The cyclotomic Galois automorphism corresponding to the unit parameter of `x` ++under the standard Lubin–Tate equivalence. -/ ++noncomputable def ++ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ Gal(RationalCyclotomicPrincipalPrimePadicLevel p n / ℚ_[p.1]) := ++ standardLubinTateUnitParameterEquivGal ++ (padicLocalField p.1) ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n ++ (standardLubinTateUnitParameterClass ++ (padicLocalField p.1) n ++ (rationalPrimeUnitValuationSubringUnit x p)) ++ ++private theorem ++ rationalCyclotomicPrincipalPrime_padicTargetArtin_eq_unitParameter ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ rationalCyclotomicPrincipalPrimePadicTargetArtin p n x = ++ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x := by ++ let T := RationalCyclotomicPrincipalPrimePadicLevel p n ++ let eK := rationalFinitePlaceCompletionRingEquivPadic p ++ let : FiniteDimensional ℚ_[p.1] T := ++ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n ++ let hpi := padicMultiplicativeLubinTateSeries_isUniformizer p.1 ++ let : IsAbelianGalois ℚ_[p.1] T := ++ standardLubinTateLevelField_isAbelianGalois ++ (padicLocalField p.1) hpi n ++ have hsource : ++ Units.map eK.toMonoidHom (rationalPrincipalFinitePlaceInput x p) = ++ Units.map (algebraMap ℚ ℚ_[p.1]).toMonoidHom x := by ++ rw [rationalPrincipalFinitePlaceInput_eq_algebraMap] ++ apply Units.ext ++ exact rationalFinitePlaceCompletionRingEquivPadic_algebraMap p (x : ℚ) ++ change ++ LocalClassFieldTheory.abelianLocalArtinMonoidHom ℚ_[p.1] T ++ (Units.map eK.toMonoidHom ++ (rationalPrincipalFinitePlaceInput x p)) = ++ standardLubinTateUnitParameterEquivGal ++ (padicLocalField p.1) hpi n ++ (standardLubinTateUnitParameterClass ++ (padicLocalField p.1) n ++ (rationalPrimeUnitValuationSubringUnit x p)) ++ rw [hsource] ++ rw [ ++ padicMultiplicativeAbelianLocalArtin_eq_uniformizerUnitPart, ++ rationalPadicFieldUnit_uniformizerUnitPart, ++ padicMultiplicativeAbelianLocalArtin_eq_unitParameter] ++ ++theorem ++ rationalCyclotomicPrincipalPrime_padicArtin_action_eq_unitParameter ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ (@LocalClassFieldTheory.abelianLocalArtinMonoidHom ++ ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) ++ (inferInstance : Field ℚ_[p.1]) ++ (inferInstance : Field ++ (RationalCyclotomicPrincipalPrimePadicLevel p n)) ++ (inferInstance : Algebra ℚ_[p.1] ++ (RationalCyclotomicPrincipalPrimePadicLevel p n)) ++ (inferInstance : ValuativeRel ℚ_[p.1]) ++ (inferInstance : TopologicalSpace ℚ_[p.1]) ++ (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) ++ (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) ++ (standardLubinTateLevelField_isAbelianGalois ++ (padicLocalField p.1) ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) ++ (Units.map ++ (rationalFinitePlaceCompletionRingEquivPadic p).toMonoidHom ++ (finitePlaceLocalArtinInput ++ (K := ℚ) (RayClass.rationalPrime p) ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime p) ++ (IdeleGroup.principalIdele ℚ x))))) ++ ((rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n).toRingEquiv ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) = ++ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x ++ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := by ++ let eK := rationalFinitePlaceCompletionRingEquivPadic p ++ have hInput : ++ finitePlaceLocalArtinInput ++ (K := ℚ) (RayClass.rationalPrime p) ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime p) ++ (IdeleGroup.principalIdele ℚ x)) = ++ rationalPrincipalFinitePlaceInput x p := by ++ rfl ++ have hMapped : ++ Units.map eK.toMonoidHom ++ (finitePlaceLocalArtinInput ++ (K := ℚ) (RayClass.rationalPrime p) ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime p) ++ (IdeleGroup.principalIdele ℚ x))) = ++ Units.map eK.toMonoidHom ++ (rationalPrincipalFinitePlaceInput x p) := ++ congrArg (Units.map eK.toMonoidHom) hInput ++ calc ++ _ = rationalCyclotomicPrincipalPrimePadicTargetArtin p n x ++ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := by ++ exact congrArg ++ (fun uQp => ++ (@LocalClassFieldTheory.abelianLocalArtinMonoidHom ++ ℚ_[p.1] (RationalCyclotomicPrincipalPrimePadicLevel p n) ++ (inferInstance : Field ℚ_[p.1]) ++ (inferInstance : Field ++ (RationalCyclotomicPrincipalPrimePadicLevel p n)) ++ (inferInstance : Algebra ℚ_[p.1] ++ (RationalCyclotomicPrincipalPrimePadicLevel p n)) ++ (inferInstance : ValuativeRel ℚ_[p.1]) ++ (inferInstance : TopologicalSpace ℚ_[p.1]) ++ (inferInstance : IsNonarchimedeanLocalField ℚ_[p.1]) ++ (rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional p n) ++ (standardLubinTateLevelField_isAbelianGalois ++ (padicLocalField p.1) ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) ++ uQp) ++ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n))) ++ hMapped ++ _ = rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x ++ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := ++ congrArg ++ (fun tau => tau ++ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n))) ++ (rationalCyclotomicPrincipalPrime_padicTargetArtin_eq_unitParameter ++ p n x) ++ ++ ++end RationalCyclotomicPrincipalPrime ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinBase.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinBase.lean +new file mode 100644 +index 0000000..3646afc +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinBase.lean +@@ -0,0 +1,924 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.CompletionToIdeal ++import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.IdealToCompletion ++import ClassFieldTheory.AlgebraicNumberTheory.Completion.UnramifiedComparison.LocalNorm ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.AlgEquiv ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.BaseChange ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.Core ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.NormComparison ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.NormalClosureNorm ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.Tower ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerAlgEquivNaturality ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.ClassGroup.TowerBaseChange ++import ClassFieldTheory.AlgebraicNumberTheory.Idele.Relative.FinitePlaceTensorNorm ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlace ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicLocalization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalPrimeFactorization ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalPrincipalLocalUnit ++import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.SemilinearNaturality ++import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.UnramifiedNormalization ++import ClassFieldTheory.LocalClassFieldTheory.LubinTateApplication.PadicMultiplicativeArtinComparison ++import ValuedFieldTheory.LocalField.DiscreteValuationField.PadicValuationComparison ++import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.UnramifiedFrobenius ++import ValuedFieldTheory.LocalField.Padic.Cyclotomic.TotallyRamified.EisensteinPolynomial ++import Mathlib.NumberTheory.NumberField.Cyclotomic.Galois ++ ++ ++set_option autoImplicit false ++ ++/-! ++# Finite-place Artin symbols in rational cyclotomic levels ++ ++At a rational prime away from the cyclotomic level, the chosen completed ++extension is unramified. Its normalized local Artin map is therefore the ++arithmetic Frobenius raised to the local valuation. The genuine primitive ++root in the localized cyclotomic level identifies the image of arithmetic ++Frobenius under the global cyclotomic character with the residue prime. ++-/ ++ ++open scoped Classical NNReal NumberField ValuativeRel ++open NumberField IsDedekindDomain ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++-- Specializing the generic finite-place comparison to `ℚ` must retain its ++-- `Algebra.id` owner rather than selecting the competing rational-field ++-- instance introduced after specialization. ++@[reducible] noncomputable local instance ++ rationalFinitePlaceCompletionRatAlgebra ++ (v : HeightOneSpectrum (𝓞 ℚ)) : ++ Algebra ℚ (HeightOneSpectrum.adicAbv ℚ v).Completion := by ++ letI : Algebra ℚ ℚ := Algebra.id ℚ ++ let hWith : Algebra ℚ ++ (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) := ++ WithAbs.instAlgebra _ ++ let hUniform : UniformContinuousConstSMul ℚ ++ (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) := ++ WithAbs.instUniformContinuousConstSMulReal _ ++ exact ++ @UniformSpace.Completion.algebra ++ (WithAbs (HeightOneSpectrum.adicAbv ℚ v)) _ _ _ _ ++ ℚ _ hWith hUniform ++ ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open LocalClassFieldTheory ++open LocalFieldTheory ++open LocalFieldTheory.DiscreteValuationField ++open LocalFieldTheory.DiscreteValuationField.Examples.Qp ++open LubinTate ++ ++theorem mappedAbelianLocalArtin_eq_frobenius_zpow ++ {F E G : Type} ++ [Field F] [ValuativeRel F] [TopologicalSpace F] ++ [IsNonarchimedeanLocalField F] ++ [Field E] [ValuativeRel E] [UniformSpace E] [IsUniformAddGroup E] ++ [IsNonarchimedeanLocalField E] ++ [Algebra F E] [FiniteDimensional F E] [IsAbelianGalois F E] ++ [Valuation.HasExtension ++ (ValuativeRel.valuation F) (ValuativeRel.valuation E)] ++ [IsNonarchimedeanLocalField.IsUnramifiedValuedExtension F E] ++ [Group G] ++ (f : (E ≃ₐ[F] E) →* G) (x : Fˣ) : ++ f (LocalClassFieldTheory.abelianLocalArtinMonoidHom F E x) = ++ (f (arithmeticFrobeniusOfUnramifiedValuation F E)) ^ ++ IsNonarchimedeanLocalField.valuationMap F ++ (Additive.ofMul x) := by ++ rw [LocalClassFieldTheory.abelianLocalArtinMonoidHom_eq_frobenius_zpow, ++ map_zpow] ++ ++local instance primeFact (q : Nat.Primes) : Fact q.1.Prime := ++ ⟨q.2⟩ ++ ++local instance levelNeZero (m : ℕ+) : NeZero (m : ℕ) := ++ ⟨m.ne_zero⟩ ++ ++noncomputable local instance ++ rationalCyclotomicLevelFiniteDimensional ++ (m : ℕ+) : ++ FiniteDimensional ℚ ++ (KummerTheory.rationalCyclotomicLevel m) := ++ IsCyclotomicExtension.finiteDimensional ++ {(m : ℕ)} ℚ (KummerTheory.rationalCyclotomicLevel m) ++ ++noncomputable local instance ++ rationalCyclotomicLevelIsAbelianGalois ++ (m : ℕ+) : ++ IsAbelianGalois ℚ ++ (KummerTheory.rationalCyclotomicLevel m) := by ++ have : IsGalois ℚ ++ (KummerTheory.rationalCyclotomicLevel m) := ++ inferInstance ++ let e := ++ IsCyclotomicExtension.Rat.galEquivZMod ++ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) ++ exact ++ { is_comm.comm σ τ := by ++ apply e.injective ++ simp only [map_mul] ++ exact mul_comm _ _ } ++ ++@[reducible] ++noncomputable local instance rationalFinitePlaceBaseNontriviallyNormedField ++ (q : Nat.Primes) : ++ NontriviallyNormedField ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion := ++ absoluteValueExtension_completionNontriviallyNormedField ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)) ++ (RayClass.adicAbv_isNontrivial ++ (RayClass.rationalPrime q)) ++ ++noncomputable local instance rationalFinitePlaceBaseLocallyCompactSpace ++ (q : Nat.Primes) : ++ LocallyCompactSpace ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion := ++ AbsoluteValue.Completion.locallyCompactSpace ++ (finitePlaceCompletionBaseMap_isometry ++ (RayClass.rationalPrime q)) ++ ++noncomputable local instance rationalFinitePlaceBaseIsUltrametricDist ++ (q : Nat.Primes) : ++ IsUltrametricDist ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion := ++ finitePlaceArtinCompletionIsUltrametricDist ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv ++ ℚ (RayClass.rationalPrime q)) ++ ++@[reducible] ++noncomputable local instance rationalFinitePlaceBaseValued ++ (q : Nat.Primes) : ++ Valued ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ℝ≥0 := ++ finitePlaceArtinCompletionValued ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv ++ ℚ (RayClass.rationalPrime q)) ++ ++@[reducible] ++noncomputable local instance rationalFinitePlaceBaseValuativeRel ++ (q : Nat.Primes) : ++ ValuativeRel ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion := ++ finitePlaceLocalArtinCompletionValuativeRel ++ (K := ℚ) (RayClass.rationalPrime q) ++ ++noncomputable local instance ++ rationalFinitePlaceBaseValuationIsNontrivial ++ (q : Nat.Primes) : ++ (Valued.v : ++ Valuation ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ ℝ≥0).IsNontrivial := ++ (inferInstance : ++ (NormedField.valuation ++ (K := ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion)).IsNontrivial) ++ ++noncomputable local instance rationalFinitePlaceBaseValuationCompatible ++ (q : Nat.Primes) : ++ (Valued.v : ++ Valuation ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ ℝ≥0).Compatible := ++ Valuation.Compatible.ofValuation _ ++ ++noncomputable local instance ++ rationalFinitePlaceBaseValuativeRelIsNontrivial ++ (q : Nat.Primes) : ++ ValuativeRel.IsNontrivial ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion := ++ (ValuativeRel.isNontrivial_iff_isNontrivial ++ (Valued.v : ++ Valuation ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ ℝ≥0)).2 inferInstance ++ ++noncomputable local instance rationalFinitePlaceBaseIsValuativeTopology ++ (q : Nat.Primes) : ++ IsValuativeTopology ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion := ++ isValuativeTopology_of_valued_ofValuation ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ℝ≥0 ++ ++noncomputable local instance ++ rationalFinitePlaceBaseIsNonarchimedeanLocalField ++ (q : Nat.Primes) : ++ IsNonarchimedeanLocalField ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion := ++ finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField ++ (K := ℚ) (RayClass.rationalPrime q) ++ ++ ++/-- Rational cyclotomic levels are finite-dimensional over `ℚ`. -/ ++theorem rationalCyclotomicPrincipalPrimeLevelFiniteDimensional ++ (m : ℕ+) : ++ FiniteDimensional ℚ (KummerTheory.rationalCyclotomicLevel m) := ++ rationalCyclotomicLevelFiniteDimensional m ++ ++/-- Rational cyclotomic levels are abelian Galois extensions of `ℚ`. -/ ++theorem rationalCyclotomicPrincipalPrimeLevelIsAbelianGalois ++ (m : ℕ+) : ++ IsAbelianGalois ℚ (KummerTheory.rationalCyclotomicLevel m) := ++ rationalCyclotomicLevelIsAbelianGalois m ++ ++/-- The canonical nontrivially normed field structure on the completion of ++`ℚ` at the rational prime `p`, exposed for principal-prime constructions. -/ ++@[reducible] ++noncomputable def rationalPrimeFactorCompletionNontriviallyNormedField ++ (p : Nat.Primes) : ++ NontriviallyNormedField ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion := ++ rationalFinitePlaceBaseNontriviallyNormedField p ++ ++/-- The completion of `ℚ` at `p` is locally compact. -/ ++theorem rationalPrimeFactorCompletionLocallyCompactSpace ++ (p : Nat.Primes) : ++ LocallyCompactSpace ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion := ++ rationalFinitePlaceBaseLocallyCompactSpace p ++ ++/-- The completion of `ℚ` at `p` carries its canonical ultrametric distance. -/ ++theorem rationalPrimeFactorCompletionIsUltrametricDist ++ (p : Nat.Primes) : ++ IsUltrametricDist ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion := ++ rationalFinitePlaceBaseIsUltrametricDist p ++ ++/-- The canonical `ℝ≥0`-valued structure on the completion of `ℚ` at `p`. -/ ++@[reducible] ++noncomputable def rationalPrimeFactorCompletionValued ++ (p : Nat.Primes) : ++ Valued ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion ℝ≥0 := ++ rationalFinitePlaceBaseValued p ++ ++/-- The valuative relation induced by the canonical valuation on the ++completion of `ℚ` at `p`. -/ ++@[reducible] ++noncomputable def rationalPrimeFactorCompletionValuativeRel ++ (p : Nat.Primes) : ++ ValuativeRel ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion := ++ rationalFinitePlaceBaseValuativeRel p ++ ++/-- The canonical valuation on the completion of `ℚ` at `p` is nontrivial. -/ ++theorem rationalPrimeFactorCompletionValuationIsNontrivial ++ (p : Nat.Primes) : ++ (Valued.v : Valuation ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion ℝ≥0).IsNontrivial := ++ rationalFinitePlaceBaseValuationIsNontrivial p ++ ++/-- The canonical valuation on the completion of `ℚ` at `p` is compatible ++with its field structure. -/ ++theorem rationalPrimeFactorCompletionValuationCompatible ++ (p : Nat.Primes) : ++ (Valued.v : Valuation ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion ℝ≥0).Compatible := ++ rationalFinitePlaceBaseValuationCompatible p ++ ++/-- The canonical valuative relation on the completion at `p` is nontrivial. -/ ++theorem rationalPrimeFactorCompletionValuativeRelIsNontrivial ++ (p : Nat.Primes) : ++ ValuativeRel.IsNontrivial ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion := ++ rationalFinitePlaceBaseValuativeRelIsNontrivial p ++ ++/-- The completion topology at `p` is induced by its canonical valuation. -/ ++theorem rationalPrimeFactorCompletionIsValuativeTopology ++ (p : Nat.Primes) : ++ IsValuativeTopology ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion := ++ rationalFinitePlaceBaseIsValuativeTopology p ++ ++/-- The completion of `ℚ` at `p` is a nonarchimedean local field. -/ ++theorem rationalPrimeFactorCompletionIsNonarchimedeanLocalField ++ (p : Nat.Primes) : ++ IsNonarchimedeanLocalField ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion := ++ rationalFinitePlaceBaseIsNonarchimedeanLocalField p ++ ++/-- The positive conductor of the `n`-th ramified cyclotomic level at ++`p`. -/ ++def rationalCyclotomicPrincipalPrimeModulus ++ (p : Nat.Primes) (n : ℕ) : ℕ+ := ++ ⟨p.1 ^ (n + 1), pow_pos p.2.pos (n + 1)⟩ ++ ++/-- The rational finite-place completion used at the prime `p`. -/ ++abbrev RationalCyclotomicPrincipalPrimeCompletion ++ (p : Nat.Primes) := ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion ++ ++/-- The chosen localized cyclotomic field at level `p ^ (n + 1)`. -/ ++abbrev RationalCyclotomicPrincipalPrimeLocalizedLevel ++ (p : Nat.Primes) (n : ℕ) := ++ rationalCyclotomicLocalizedCompletion ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p) ++ ++/-- The standard multiplicative Lubin--Tate field at level `n`. -/ ++abbrev RationalCyclotomicPrincipalPrimePadicLevel ++ (p : Nat.Primes) (n : ℕ) := ++ standardLubinTateLevelField ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n ++ ++/-- The valuation ring of the absolute-value completion at `q`, identified ++with the standard p-adic integer ring `ℤ_q`. -/ ++noncomputable def rationalFinitePlaceCompletionIntegerRingEquivPadicInt ++ (q : Nat.Primes) : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion] ≃+* ++ ℤ_[q.1] := by ++ let v : HeightOneSpectrum (𝓞 ℚ) := ++ RayClass.rationalPrime q ++ let vQ := HeightOneSpectrum.adicAbv ℚ v ++ let eConcreteIntegers : ++ 𝒪[vQ.Completion] ≃+* ++ v.adicCompletionIntegers ℚ := ++ finitePlaceCompletionIntegerRingEquiv v ++ exact ++ eConcreteIntegers.trans ++ (PadicInt.adicCompletionIntegersEquiv ++ (𝓞 ℚ) q).symm.toRingEquiv ++ ++/-- The absolute-value completion at the rational prime `q`, identified ++with the standard field `ℚ_q`. -/ ++noncomputable def rationalFinitePlaceCompletionRingEquivPadic ++ (q : Nat.Primes) : ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ≃+* ++ ℚ_[q.1] := ++ IsFractionRing.ringEquivOfRingEquiv ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) ++ ++/-- The completion-to-`ℚ_q` equivalence respects the rational embedding. -/ ++theorem rationalFinitePlaceCompletionRingEquivPadic_algebraMap ++ (q : Nat.Primes) (a : ℚ) : ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ℚ ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion a) = ++ algebraMap ℚ ℚ_[q.1] a := by ++ exact ++ (rationalFinitePlaceCompletionRingEquivPadic q).toRingHom.map_rat_algebraMap a ++ ++/-- The completion field equivalence and its restriction to valuation ++rings commute with the natural inclusions into the fields. -/ ++theorem rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe ++ (q : Nat.Primes) ++ (a : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion]) : ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion] ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion a) = ++ algebraMap ℤ_[q.1] ℚ_[q.1] ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q a) := by ++ exact ++ (IsFractionRing.ringEquivOfRingEquiv_algebraMap ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) a) ++ ++/-- The canonical rational-completion equivalence preserves the canonical ++valuations. -/ ++theorem ++ rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible ++ (p : Nat.Primes) : ++ SemilinearValuationCompatible ++ (RationalCyclotomicPrincipalPrimeCompletion p) ℚ_[p.1] ++ (rationalFinitePlaceCompletionRingEquivPadic p) := by ++ let F := RationalCyclotomicPrincipalPrimeCompletion p ++ let eK := rationalFinitePlaceCompletionRingEquivPadic p ++ let : Algebra F ℚ_[p.1] := eK.toRingHom.toAlgebra ++ change ++ (ValuativeRel.valuation F).HasExtension ++ (ValuativeRel.valuation ℚ_[p.1]) ++ let eO := ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt p).trans ++ (padicIntEquivValuationSubring p.1) ++ have hChosen : ++ (localCompleteDVF F).valuation.HasExtension ++ (padicDVRValuation p.1) := by ++ change ++ (localCompleteDVF F).valuation.HasExtension ++ (padicCompleteDVF p.1).valuation ++ apply ++ ValuationTheory.DiscreteValuationField.ValuedExtension.valuation_hasExtension_of_valuationSubring_equiv ++ (localCompleteDVF F) ++ (padicCompleteDVF p.1) ++ eO ++ intro z ++ change ++ algebraMap ++ (padicDVRValuation p.1).valuationSubring ℚ_[p.1] ++ (padicIntEquivValuationSubring p.1 ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt ++ p z)) = ++ rationalFinitePlaceCompletionRingEquivPadic p ++ (algebraMap 𝒪[F] F z) ++ symm ++ calc ++ rationalFinitePlaceCompletionRingEquivPadic p ++ (algebraMap 𝒪[F] F z) = ++ algebraMap ℤ_[p.1] ℚ_[p.1] ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt ++ p z) := ++ rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe ++ p z ++ _ = ++ algebraMap ++ (padicDVRValuation p.1).valuationSubring ℚ_[p.1] ++ (padicIntEquivValuationSubring p.1 ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt ++ p z)) := by ++ rw [PadicInt.algebraMap_apply, ++ ValuationSubring.algebraMap_apply] ++ exact ++ (padicIntEquivValuationSubring_coe p.1 ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt ++ p z)).symm ++ have hBase : ++ (ValuativeRel.valuation F).HasExtension ++ (padicDVRValuation p.1) := by ++ rw [← localCompleteDVF_valuation_eq] ++ exact hChosen ++ refine ++ { val_isEquiv_comap := ?_ } ++ exact ++ hBase.val_isEquiv_comap.trans ++ ((padicDVRValuation_isEquiv_valuativeRelValuation ++ p.1).comap (algebraMap F ℚ_[p.1])) ++ ++/-- The rational prime, pulled back from `ℤ_q` to the valuation ring of ++the absolute-value completion at `q`. -/ ++noncomputable def rationalPrimeFinitePlaceInteger ++ (q : Nat.Primes) : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion] := ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt q).symm ++ (q.1 : ℤ_[q.1]) ++ ++/-- The pulled-back rational prime is irreducible in the completion ++valuation ring. -/ ++theorem rationalPrimeFinitePlaceInteger_irreducible ++ (q : Nat.Primes) : ++ Irreducible (rationalPrimeFinitePlaceInteger q) := by ++ exact ++ (MulEquiv.irreducible_iff ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt ++ q).symm.toMulEquiv).2 ++ ((PadicInt.prime_p : ++ Prime (q.1 : ℤ_[q.1])).irreducible) ++ ++/-- Coercing the pulled-back prime to the completion field gives the ++ordinary image of the rational number `q`. -/ ++theorem rationalPrimeFinitePlaceInteger_coe ++ (q : Nat.Primes) : ++ ((rationalPrimeFinitePlaceInteger q : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion]) : ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion) = ++ algebraMap ℚ ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (q.1 : ℚ) := by ++ apply ++ (rationalFinitePlaceCompletionRingEquivPadic q).injective ++ change ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion] ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeFinitePlaceInteger q)) = ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ℚ ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (q.1 : ℚ)) ++ calc ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion] ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeFinitePlaceInteger q)) = ++ algebraMap ℤ_[q.1] ℚ_[q.1] ++ ((rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) ++ (rationalPrimeFinitePlaceInteger q)) := ++ rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe ++ q (rationalPrimeFinitePlaceInteger q) ++ _ = (q.1 : ℚ_[q.1]) := by ++ rw [rationalPrimeFinitePlaceInteger, ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt ++ q).apply_symm_apply, ++ PadicInt.algebraMap_apply, ++ PadicInt.coe_natCast] ++ _ = ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ℚ ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (q.1 : ℚ)) := by ++ rw [ ++ rationalFinitePlaceCompletionRingEquivPadic_algebraMap] ++ norm_num ++ ++/-- The rational prime as a field unit of its absolute-value completion. -/ ++noncomputable def rationalPrimeFinitePlaceFieldUnit ++ (q : Nat.Primes) : ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completionˣ := ++ Units.mk0 ++ (rationalPrimeFinitePlaceInteger q : ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion) ++ (by ++ intro hzero ++ exact ++ (rationalPrimeFinitePlaceInteger_irreducible q).ne_zero ++ (Subtype.ext hzero)) ++ ++/-- In the inverse-standard local reciprocity normalization, the rational ++prime itself has normalized additive value `-1`. -/ ++theorem rationalPrimeFinitePlaceFieldUnit_valuationMap ++ (q : Nat.Primes) : ++ IsNonarchimedeanLocalField.valuationMap ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (Additive.ofMul ++ (rationalPrimeFinitePlaceFieldUnit q)) = ++ -1 := by ++ simpa [IsNonarchimedeanLocalField.valuationMap_apply] using ++ (LocalFieldTheory.v_integerRingIrreducibleFieldUnit ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeFinitePlaceInteger q) ++ (rationalPrimeFinitePlaceInteger_irreducible q) ++ (rationalPrimeFinitePlaceFieldUnit q) rfl) ++ ++/-- The rational `q`-unit part of `x`, pulled back from `ℤ_qˣ` to the ++valuation ring of the absolute-value completion. -/ ++noncomputable def rationalPrimeUnitFinitePlaceIntegerUnit ++ (x : ℚˣ) (q : Nat.Primes) : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion]ˣ := ++ Units.map ++ (rationalFinitePlaceCompletionIntegerRingEquivPadicInt ++ q).symm.toMonoidHom ++ (padicIntUnitOfRat q ++ (rationalPrimeUnit x q : ℚ) ++ (rationalPrimeUnit x q).ne_zero ++ (padicValRat_rationalPrimeUnit x q)) ++ ++/-- Forgetting the integrality proof from the pulled-back `q`-unit gives ++the ordinary image of the rational `q`-unit in the completion field. -/ ++theorem rationalPrimeUnitFinitePlaceIntegerUnit_coe ++ (x : ℚˣ) (q : Nat.Primes) : ++ (((rationalPrimeUnitFinitePlaceIntegerUnit x q : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion]ˣ) : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion]) : ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion) = ++ algebraMap ℚ ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeUnit x q : ℚ) := by ++ apply ++ (rationalFinitePlaceCompletionRingEquivPadic q).injective ++ change ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion] ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeUnitFinitePlaceIntegerUnit x q : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion])) = ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ℚ ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeUnit x q : ℚ)) ++ calc ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion] ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeUnitFinitePlaceIntegerUnit x q : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion])) = ++ algebraMap ℤ_[q.1] ℚ_[q.1] ++ ((rationalFinitePlaceCompletionIntegerRingEquivPadicInt q) ++ (rationalPrimeUnitFinitePlaceIntegerUnit x q : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion])) := ++ rationalFinitePlaceCompletionIntegerRingEquivPadicInt_coe q ++ (rationalPrimeUnitFinitePlaceIntegerUnit x q : ++ 𝒪[(HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion]) ++ _ = ++ ((padicIntUnitOfRat q ++ (rationalPrimeUnit x q : ℚ) ++ (rationalPrimeUnit x q).ne_zero ++ (padicValRat_rationalPrimeUnit x q) : ++ ℤ_[q.1]) : ℚ_[q.1]) := by ++ rw [rationalPrimeUnitFinitePlaceIntegerUnit] ++ simp [PadicInt.algebraMap_apply] ++ _ = ((rationalPrimeUnit x q : ℚ) : ℚ_[q.1]) := by ++ rw [padicIntUnitOfRat_coe] ++ _ = ++ rationalFinitePlaceCompletionRingEquivPadic q ++ (algebraMap ℚ ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeUnit x q : ℚ)) := by ++ rw [ ++ rationalFinitePlaceCompletionRingEquivPadic_algebraMap] ++ simp ++ ++/-- The completion field unit underlying the pulled-back rational `q`-unit ++has normalized additive value zero. -/ ++theorem rationalPrimeUnitFinitePlaceField_valuationMap ++ (x : ℚˣ) (q : Nat.Primes) : ++ IsNonarchimedeanLocalField.valuationMap ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (Additive.ofMul ++ (IsNonarchimedeanLocalField.integerUnitsToFieldUnits ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeUnitFinitePlaceIntegerUnit x q))) = ++ 0 := by ++ rw [IsNonarchimedeanLocalField.valuationMap_apply] ++ exact ++ IsNonarchimedeanLocalField.v_integerUnitsToFieldUnits ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (rationalPrimeUnitFinitePlaceIntegerUnit x q) ++ ++/-- The rational prime `q`, regarded as a unit of `ℚ`. -/ ++def rationalPrimeGeneratorUnit (q : Nat.Primes) : ℚˣ := ++ Units.mk0 (q.1 : ℚ) (by exact_mod_cast q.2.ne_zero) ++ ++/-- The underlying rational number of the prime generator unit is `q`. -/ ++@[simp] ++theorem rationalPrimeGeneratorUnit_coe (q : Nat.Primes) : ++ (rationalPrimeGeneratorUnit q : ℚ) = q.1 := ++ rfl ++ ++/-- Reattaching the removed `q`-power to the rational `q`-unit recovers ++the original rational field unit. -/ ++theorem rationalPrimeGeneratorUnit_zpow_mul_rationalPrimeUnit ++ (x : ℚˣ) (q : Nat.Primes) : ++ rationalPrimeGeneratorUnit q ^ ++ padicValRat q.1 (x : ℚ) * ++ rationalPrimeUnit x q = ++ x := by ++ rw [rationalPrimeGeneratorUnit, rationalPrimeUnit, ++ ← mul_assoc, ← zpow_add] ++ simp ++ ++/-- The source unit in the absolute-value completion represented by the ++finite component of a rational principal idele. -/ ++noncomputable def rationalPrincipalFinitePlaceInput ++ (x : ℚˣ) (q : Nat.Primes) : ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completionˣ := ++ (finitePlaceCompletionUnitsContinuousMulEquiv ++ (RayClass.rationalPrime q)).symm ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime q) ++ (IdeleGroup.principalIdele ℚ x)) ++ ++/-- The source unit represented by a principal finite component is the ++ordinary image of the rational field unit in the absolute-value ++completion. -/ ++theorem rationalPrincipalFinitePlaceInput_eq_algebraMap ++ (x : ℚˣ) (q : Nat.Primes) : ++ rationalPrincipalFinitePlaceInput x q = ++ Units.map ++ (algebraMap ℚ ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion).toMonoidHom ++ x := by ++ apply Units.ext ++ let v : HeightOneSpectrum (𝓞 ℚ) := ++ RayClass.rationalPrime q ++ let vQ := HeightOneSpectrum.adicAbv ℚ v ++ let component : (v.adicCompletion ℚ)ˣ := ++ IdeleGroup.finiteComponent v ++ (IdeleGroup.principalIdele ℚ x) ++ apply (finitePlaceCompletionRingEquiv v).injective ++ change ++ finitePlaceCompletionRingEquiv v ++ (rationalPrincipalFinitePlaceInput x q : vQ.Completion) = ++ finitePlaceCompletionRingEquiv v ++ (algebraMap ℚ vQ.Completion (x : ℚ)) ++ have hCompletion : ++ finitePlaceCompletionRingEquiv v ++ (rationalPrincipalFinitePlaceInput x q : ++ vQ.Completion) = ++ (component : v.adicCompletion ℚ) := by ++ have hUnits := ++ congrArg Units.val ++ ((finitePlaceCompletionUnitsContinuousMulEquiv v).apply_symm_apply ++ component) ++ exact hUnits ++ have hComponent : ++ (component : v.adicCompletion ℚ) = ++ algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ) := by ++ apply (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm.injective ++ calc ++ (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm ++ (component : v.adicCompletion ℚ) = ++ algebraMap ℚ ℚ_[q.1] (x : ℚ) := by ++ dsimp only [component] ++ rw [IdeleGroup.finiteComponent_principalIdele] ++ exact ++ (Padic.adicCompletionEquiv ++ (𝓞 ℚ) q).symm.commutes (x : ℚ) ++ _ = (Padic.adicCompletionEquiv (𝓞 ℚ) q).symm ++ (algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ)) := by ++ symm ++ exact ++ (Padic.adicCompletionEquiv ++ (𝓞 ℚ) q).symm.commutes (x : ℚ) ++ calc ++ finitePlaceCompletionRingEquiv v ++ (rationalPrincipalFinitePlaceInput x q : ++ vQ.Completion) = ++ (component : v.adicCompletion ℚ) := hCompletion ++ _ = algebraMap ℚ (v.adicCompletion ℚ) (x : ℚ) := hComponent ++ _ = finitePlaceCompletionRingEquiv v ++ (algebraMap ℚ vQ.Completion (x : ℚ)) := by ++ symm ++ exact ++ (finitePlaceCompletionAlgEquiv (K := ℚ) v).commutes (x : ℚ) ++ ++/-- The normalized local exponent of a rational principal finite ++component is the negative of the usual `q`-adic exponent. The minus sign ++records the inverse-standard local reciprocity convention in which a ++prime element has normalized value `-1`. -/ ++theorem rationalPrincipalFiniteComponent_valuationMap ++ (x : ℚˣ) (q : Nat.Primes) : ++ IsNonarchimedeanLocalField.valuationMap ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (Additive.ofMul ++ ((finitePlaceCompletionUnitsContinuousMulEquiv ++ (RayClass.rationalPrime q)).symm ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime q) ++ (IdeleGroup.principalIdele ℚ x)))) = ++ -padicValRat q.1 (x : ℚ) := by ++ let F := ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ let embed : ℚˣ →* Fˣ := ++ Units.map (algebraMap ℚ F).toMonoidHom ++ let primeUnit : Fˣ := ++ rationalPrimeFinitePlaceFieldUnit q ++ let integralUnit : 𝒪[F]ˣ := ++ rationalPrimeUnitFinitePlaceIntegerUnit x q ++ let unitPart : Fˣ := ++ IsNonarchimedeanLocalField.integerUnitsToFieldUnits ++ F integralUnit ++ have hInput : ++ rationalPrincipalFinitePlaceInput x q = ++ embed x := by ++ exact rationalPrincipalFinitePlaceInput_eq_algebraMap x q ++ have hPrime : ++ embed (rationalPrimeGeneratorUnit q) = ++ primeUnit := by ++ apply Units.ext ++ exact ++ (rationalPrimeFinitePlaceInteger_coe q).symm ++ have hUnit : ++ embed (rationalPrimeUnit x q) = ++ unitPart := by ++ apply Units.ext ++ exact ++ (rationalPrimeUnitFinitePlaceIntegerUnit_coe ++ x q).symm ++ change ++ IsNonarchimedeanLocalField.valuationMap F ++ (Additive.ofMul ++ (rationalPrincipalFinitePlaceInput x q)) = ++ -padicValRat q.1 (x : ℚ) ++ rw [hInput] ++ conv_lhs => ++ rw [← rationalPrimeGeneratorUnit_zpow_mul_rationalPrimeUnit ++ x q] ++ rw [map_mul, map_zpow, hPrime, hUnit, ++ IsNonarchimedeanLocalField.valuationMap_ofMul_mul, ++ IsNonarchimedeanLocalField.valuationMap_ofMul_zpow, ++ rationalPrimeFinitePlaceFieldUnit_valuationMap, ++ rationalPrimeUnitFinitePlaceField_valuationMap] ++ ring ++ ++/-- The principal finite component of the rational prime itself has ++normalized local exponent `-1`. -/ ++theorem rationalPrimePrincipalFiniteComponent_valuationMap ++ (q : Nat.Primes) : ++ IsNonarchimedeanLocalField.valuationMap ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime q)).Completion ++ (Additive.ofMul ++ ((finitePlaceCompletionUnitsContinuousMulEquiv ++ (RayClass.rationalPrime q)).symm ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime q) ++ (IdeleGroup.principalIdele ℚ ++ (rationalPrimeGeneratorUnit q))))) = ++ -1 := by ++ rw [rationalPrincipalFiniteComponent_valuationMap, ++ rationalPrimeGeneratorUnit_coe, ++ padicValRat.self q.2.one_lt] ++ ++/-- A cyclotomic automorphism which raises the selected primitive root to ++the `q`-th power has cyclotomic character equal to the residue-prime unit. -/ ++theorem rationalCyclotomicLevel_galEquivZMod_eq_unitOfCoprime ++ (m : ℕ+) (q : Nat.Primes) ++ (hq : ¬ q.1 ∣ (m : ℕ)) ++ (σ : KummerTheory.rationalCyclotomicLevel m ≃ₐ[ℚ] ++ KummerTheory.rationalCyclotomicLevel m) ++ (hσ : ++ σ (rationalCyclotomicLevelPrimitiveRoot m) = ++ rationalCyclotomicLevelPrimitiveRoot m ^ q.1) : ++ IsCyclotomicExtension.Rat.galEquivZMod ++ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ = ++ ZMod.unitOfCoprime q.1 ++ (q.2.coprime_iff_not_dvd.mpr hq) := by ++ let ζ := rationalCyclotomicLevelPrimitiveRoot m ++ have hζ : IsPrimitiveRoot ζ (m : ℕ) := ++ rationalCyclotomicLevelPrimitiveRoot_isPrimitiveRoot m ++ have hCharacterRoot : ++ σ ζ = ++ ζ ^ ++ (IsCyclotomicExtension.Rat.galEquivZMod ++ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ).val.val := ++ IsCyclotomicExtension.Rat.galEquivZMod_apply_of_pow_eq ++ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ ++ hζ.pow_eq_one ++ have hPowers : ++ ζ ^ ++ (IsCyclotomicExtension.Rat.galEquivZMod ++ (m : ℕ) (KummerTheory.rationalCyclotomicLevel m) σ).val.val = ++ ζ ^ q.1 := ++ hCharacterRoot.symm.trans hσ ++ rw [(hζ.isOfFinOrder m.ne_zero).pow_inj_mod, ++ ← hζ.eq_orderOf, ++ ← ZMod.natCast_eq_natCast_iff', ++ ZMod.natCast_val] at hPowers ++ apply Units.ext ++ simpa using hPowers ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPadic.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPadic.lean +new file mode 100644 +index 0000000..b430bec +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPadic.lean +@@ -0,0 +1,389 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinTower ++ ++ ++set_option autoImplicit false ++ ++open scoped Classical NNReal NumberField ValuativeRel ++open NumberField IsDedekindDomain ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open LocalClassFieldTheory ++open LocalFieldTheory ++open LocalFieldTheory.DiscreteValuationField ++open LocalFieldTheory.DiscreteValuationField.Examples.Qp ++open LubinTate ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++attribute [local instance] ++ rationalFinitePlaceCompletionRatAlgebra ++ primeFact ++ levelNeZero ++ rationalCyclotomicLevelFiniteDimensional ++ rationalCyclotomicLevelIsAbelianGalois ++ rationalFinitePlaceBaseNontriviallyNormedField ++ rationalFinitePlaceBaseLocallyCompactSpace ++ rationalFinitePlaceBaseIsUltrametricDist ++ rationalFinitePlaceBaseValued ++ rationalFinitePlaceBaseValuativeRel ++ rationalFinitePlaceBaseValuationIsNontrivial ++ rationalFinitePlaceBaseValuationCompatible ++ rationalFinitePlaceBaseValuativeRelIsNontrivial ++ rationalFinitePlaceBaseIsValuativeTopology ++ rationalFinitePlaceBaseIsNonarchimedeanLocalField ++ rationalCyclotomicArtinExtensionAlgebra ++ rationalCyclotomicArtinExtensionSMul ++ rationalCyclotomicArtinCompletionAlgebra ++ rationalCyclotomicArtinLocalizedAlgebra ++ rationalCyclotomicArtinLocalizedGlobalAlgebra ++ rationalCyclotomicArtinLocalizedGlobalSMul ++ rationalCyclotomicArtinLocalizedScalarTower ++ rationalCyclotomicArtinLocalizedFiniteDimensional ++ rationalCyclotomicArtinLocalizedIsAbelianGalois ++ rationalCyclotomicArtinLocalizedIsSeparable ++ rationalCyclotomicArtinLocalizedIsCyclotomic ++ rationalCyclotomicArtinExtensionFiniteDimensional ++ rationalCyclotomicArtinExtensionContinuousSMul ++ rationalCyclotomicArtinExtensionLocallyCompact ++ rationalCyclotomicArtinLocalizedLocallyCompact ++ rationalCyclotomicArtinLocalizedIsUltrametricDist ++ rationalCyclotomicArtinLocalizedValued ++ rationalCyclotomicArtinLocalizedValuativeRel ++ rationalCyclotomicArtinLocalizedValuationCompatible ++ rationalCyclotomicArtinLocalizedValuationHasExtension ++ rationalCyclotomicArtinLocalizedValuationIsNontrivial ++ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial ++ rationalCyclotomicArtinLocalizedIsValuativeTopology ++ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField ++ rationalCyclotomicArtinLocalizedIntegerAlgebra ++ rationalCyclotomicArtinLocalizedIsIntegralClosure ++ rationalCyclotomicArtinLocalizedIntegerModuleFinite ++ ++section RationalCyclotomicPrincipalPrime ++ ++/-! ## Ramified prime-power transport ++ ++This section reuses the canonical finite-place Artin tower above. In ++particular, it introduces no parallel completion/localization instance tower. -/ ++ ++noncomputable local instance ++ rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension ++ (p : Nat.Primes) (n : ℕ) : ++ IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ ++ (KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) := by ++ change ++ IsCyclotomicExtension ++ {(rationalCyclotomicPrincipalPrimeModulus p n : ℕ)} ℚ ++ (KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ exact ++ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ ++private abbrev rationalCyclotomicPrincipalPrimePlace ++ (p : Nat.Primes) : HeightOneSpectrum (𝓞 ℚ) := ++ rationalCyclotomicArtinPlace p ++ ++/-- The cyclotomic extension of `ℚ` generated by roots of unity of the given positive level. -/ ++abbrev rationalCyclotomicPrincipalPrimeLevel ++ (m : ℕ+) := ++ rationalCyclotomicArtinLevel m ++ ++private abbrev rationalCyclotomicPrincipalPrimeExtension ++ (m : ℕ+) (p : Nat.Primes) := ++ rationalCyclotomicArtinExtension m p ++ ++/-- The `ℚ_[p]`-algebra structure on the localized cyclotomic completion, ++transported through the canonical comparison with the `p`-adic completion. -/ ++@[reducible] ++noncomputable def ++ rationalCyclotomicPrincipalPrimeLocalizedPadicAlgebra ++ (m : ℕ+) (p : Nat.Primes) : ++ Algebra ℚ_[p.1] ++ (rationalCyclotomicLocalizedCompletion m ++ (RayClass.rationalPrime p)) := ++ ((algebraMap ++ (HeightOneSpectrum.adicAbv ℚ ++ (RayClass.rationalPrime p)).Completion ++ (rationalCyclotomicLocalizedCompletion m ++ (RayClass.rationalPrime p))).comp ++ (rationalFinitePlaceCompletionRingEquivPadic p).symm.toRingHom).toAlgebra ++ ++@[reducible] ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedPadicAlgebra ++ (m : ℕ+) (p : Nat.Primes) : ++ Algebra ℚ_[p.1] (rationalCyclotomicArtinLocalizedField m p) := ++ rationalCyclotomicPrincipalPrimeLocalizedPadicAlgebra m p ++ ++private noncomputable def rationalFinitePlaceCompletionAlgEquivPadic ++ (p : Nat.Primes) : ++ (rationalCyclotomicArtinBaseAbv p).Completion ≃ₐ[ℚ] ℚ_[p.1] := ++ AlgEquiv.ofRingEquiv ++ (f := rationalFinitePlaceCompletionRingEquivPadic p) ++ (rationalFinitePlaceCompletionRingEquivPadic_algebraMap p) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedPadicScalarTower ++ (m : ℕ+) (p : Nat.Primes) : ++ IsScalarTower ℚ ℚ_[p.1] ++ (rationalCyclotomicArtinLocalizedField m p) := by ++ constructor ++ intro r x y ++ simp only [Algebra.smul_def, map_mul, eq_ratCast, ++ map_ratCast, mul_assoc] ++ ++private theorem rationalCyclotomicArtin_padic_algebraMap ++ (m : ℕ+) (p : Nat.Primes) : ++ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion ++ (rationalCyclotomicArtinLocalizedField m p) = ++ (algebraMap ℚ_[p.1] ++ (rationalCyclotomicArtinLocalizedField m p)) ∘ ++ (rationalFinitePlaceCompletionAlgEquivPadic p) := by ++ funext a ++ change ++ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion ++ (rationalCyclotomicArtinLocalizedField m p) a = ++ algebraMap (rationalCyclotomicArtinBaseAbv p).Completion ++ (rationalCyclotomicArtinLocalizedField m p) ++ ((rationalFinitePlaceCompletionRingEquivPadic p).symm ++ (rationalFinitePlaceCompletionRingEquivPadic p a)) ++ exact ++ congrArg ++ (algebraMap (rationalCyclotomicArtinBaseAbv p).Completion ++ (rationalCyclotomicArtinLocalizedField m p)) ++ ((rationalFinitePlaceCompletionRingEquivPadic p).symm_apply_apply a).symm ++ ++private theorem rationalCyclotomicArtin_algebraAdjoin_restrictScalars ++ (m : ℕ+) (p : Nat.Primes) : ++ (Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion ++ ({rationalCyclotomicLocalizedPrimitiveRoot m ++ (rationalCyclotomicArtinPlace p)} : ++ Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = ++ (Algebra.adjoin ℚ_[p.1] ++ ({rationalCyclotomicLocalizedPrimitiveRoot m ++ (rationalCyclotomicArtinPlace p)} : ++ Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ := by ++ exact ++ Algebra.restrictScalars_adjoin_of_algEquiv ++ (E := rationalCyclotomicArtinLocalizedField m p) ++ (rationalFinitePlaceCompletionAlgEquivPadic p) ++ (rationalCyclotomicArtin_padic_algebraMap m p) ++ ({rationalCyclotomicLocalizedPrimitiveRoot m ++ (rationalCyclotomicArtinPlace p)} : ++ Set (rationalCyclotomicArtinLocalizedField m p)) ++ ++private theorem ++ rationalCyclotomicArtin_baseAlgebraAdjoin_restrict_eq_top ++ (m : ℕ+) (p : Nat.Primes) : ++ (Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion ++ ({rationalCyclotomicLocalizedPrimitiveRoot m ++ (rationalCyclotomicArtinPlace p)} : ++ Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = ++ (⊤ : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion ++ (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := by ++ have hRoot : IsPrimitiveRoot ++ (show rationalCyclotomicArtinLocalizedField m p from ++ rationalCyclotomicLocalizedPrimitiveRoot m ++ (rationalCyclotomicArtinPlace p)) ++ (m : ℕ) := ++ rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot ++ m (rationalCyclotomicArtinPlace p) ++ have hTop : ++ Algebra.adjoin (rationalCyclotomicArtinBaseAbv p).Completion ++ ({rationalCyclotomicLocalizedPrimitiveRoot m ++ (rationalCyclotomicArtinPlace p)} : ++ Set (rationalCyclotomicArtinLocalizedField m p)) = ⊤ := ++ IsCyclotomicExtension.adjoin_primitive_root_eq_top ++ (A := (rationalCyclotomicArtinBaseAbv p).Completion) ++ (B := rationalCyclotomicArtinLocalizedField m p) hRoot ++ exact congrArg ++ (fun A : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion ++ (rationalCyclotomicArtinLocalizedField m p) => A.restrictScalars ℚ) ++ hTop ++ ++private theorem rationalCyclotomicArtin_restrictScalars_top_base_eq_padic ++ (m : ℕ+) (p : Nat.Primes) : ++ (⊤ : Subalgebra (rationalCyclotomicArtinBaseAbv p).Completion ++ (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ = ++ (⊤ : Subalgebra ℚ_[p.1] ++ (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := ++ (Subalgebra.restrictScalars_top ℚ).trans ++ (Subalgebra.restrictScalars_top ℚ).symm ++ ++private theorem ++ rationalCyclotomicArtin_padicAlgebraAdjoin_restrict_eq_top ++ (m : ℕ+) (p : Nat.Primes) : ++ (Algebra.adjoin ℚ_[p.1] ++ ({rationalCyclotomicLocalizedPrimitiveRoot m ++ (rationalCyclotomicArtinPlace p)} : ++ Set (rationalCyclotomicArtinLocalizedField m p))).restrictScalars ℚ = ++ (⊤ : Subalgebra ℚ_[p.1] ++ (rationalCyclotomicArtinLocalizedField m p)).restrictScalars ℚ := by ++ exact ++ (rationalCyclotomicArtin_algebraAdjoin_restrictScalars m p).symm.trans ++ ((rationalCyclotomicArtin_baseAlgebraAdjoin_restrict_eq_top m p).trans ++ (rationalCyclotomicArtin_restrictScalars_top_base_eq_padic m p)) ++ ++/-- The finite-dimensional instance for the standard multiplicative level, ++named once so all consumers use the same proof term. -/ ++theorem rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional ++ (p : Nat.Primes) (n : ℕ) : ++ FiniteDimensional ℚ_[p.1] ++ (standardLubinTateLevelField ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n) := ++ standardLubinTateLevelField_finiteDimensional ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n ++ ++attribute [local instance] ++ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional ++ ++noncomputable local instance ++ rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois ++ (p : Nat.Primes) (n : ℕ) : ++ IsAbelianGalois ℚ_[p.1] ++ (RationalCyclotomicPrincipalPrimePadicLevel p n) := ++ standardLubinTateLevelField_isAbelianGalois ++ (padicLocalField p.1) ++ (padicMultiplicativeLubinTateSeries_isUniformizer p.1) n ++ ++@[reducible] ++noncomputable local instance rationalPrimeFactorCompletionPadicAlgebra ++ (p : Nat.Primes) : ++ Algebra (RationalCyclotomicPrincipalPrimeCompletion p) ℚ_[p.1] := ++ (rationalFinitePlaceCompletionRingEquivPadic p).toRingHom.toAlgebra ++ ++/-- The genuine multiplicative Lubin--Tate level is generated by its ++primitive `p ^ (n + 1)`-st root of unity. -/ ++theorem padicMultiplicativePrimitiveRoot_adjoin_eq_top ++ (p : ℕ) [Fact p.Prime] (n : ℕ) : ++ let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p ++ let T := standardLubinTateLevelField hπ n ++ Algebra.adjoin ℚ_[p] ++ ({padicMultiplicativePrimitiveRoot p n} : Set T) = ++ ⊤ := by ++ let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p ++ let T := standardLubinTateLevelField hπ n ++ let ζ : T := padicMultiplicativePrimitiveRoot p n ++ let m := p ^ (n + 1) ++ let : NeZero m := ++ ⟨pow_ne_zero _ (Fact.out : Nat.Prime p).ne_zero⟩ ++ let : FiniteDimensional ℚ_[p] T := ++ standardLubinTateLevelField_finiteDimensional hπ n ++ have hζ : IsPrimitiveRoot ζ m := by ++ simpa only [ζ, m] using ++ padicMultiplicativePrimitiveRoot_isPrimitiveRoot p n ++ let A : IntermediateField ℚ_[p] T := ++ IntermediateField.adjoin ℚ_[p] {ζ} ++ let : IsCyclotomicExtension {m} ℚ_[p] A := ++ hζ.intermediateField_adjoin_isCyclotomicExtension ℚ_[p] ++ have hAfin : ++ Module.finrank ℚ_[p] A = Nat.totient m := by ++ exact ++ IsCyclotomicExtension.finrank A ++ (by ++ simpa only [m] using ++ padicCyclotomicPolynomial_irreducible_prime_pow_succ ++ p n) ++ have hTfin : ++ Module.finrank ℚ_[p] T = Nat.totient m := by ++ rw [standardLubinTateLevelField_finrank hπ n] ++ have hcard : ++ Nat.card (padicLocalField p).residueField = p := by ++ simpa [padicLocalField] using ++ padicCompleteDVF_residueField_card p ++ rw [hcard, Nat.totient_prime_pow ++ (Fact.out : Nat.Prime p) (Nat.succ_pos n)] ++ simp [Nat.mul_comm] ++ have hAeq : A = ⊤ := by ++ apply IntermediateField.eq_of_le_of_finrank_eq le_top ++ simpa using hAfin.trans hTfin.symm ++ calc ++ Algebra.adjoin ℚ_[p] {ζ} = A.toSubalgebra := by ++ exact ++ (IntermediateField.adjoin_toSubalgebra ++ ({ζ} : Set T)).symm ++ _ = (⊤ : IntermediateField ℚ_[p] T).toSubalgebra := ++ congrArg IntermediateField.toSubalgebra hAeq ++ _ = ⊤ := rfl ++ ++/-- The standard multiplicative Lubin--Tate level is the actual ++`p ^ (n + 1)`-cyclotomic extension of `ℚ_p`. -/ ++theorem padicMultiplicativeLevel_isCyclotomicExtension ++ (p : ℕ) [Fact p.Prime] (n : ℕ) : ++ let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p ++ let T := standardLubinTateLevelField hπ n ++ IsCyclotomicExtension {p ^ (n + 1)} ℚ_[p] T := by ++ let hπ := padicMultiplicativeLubinTateSeries_isUniformizer p ++ let T := standardLubinTateLevelField hπ n ++ exact ++ padic_isCyclotomicExtension_of_primitiveRoot_adjoin_eq_top ++ (padicMultiplicativePrimitiveRoot p n) ++ (padicMultiplicativePrimitiveRoot_isPrimitiveRoot p n) ++ (padicMultiplicativePrimitiveRoot_adjoin_eq_top p n) ++ ++private theorem ++ rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_isPrimitiveRoot ++ (p : Nat.Primes) (n : ℕ) : ++ IsPrimitiveRoot ++ (rationalCyclotomicLocalizedPrimitiveRoot ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p)) ++ (p.1 ^ (n + 1)) := by ++ change ++ IsPrimitiveRoot ++ (rationalCyclotomicLocalizedPrimitiveRoot ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p)) ++ (rationalCyclotomicPrincipalPrimeModulus p n : ℕ) ++ exact ++ rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p) ++ ++private theorem ++ rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_adjoin_eq_top ++ (p : Nat.Primes) (n : ℕ) : ++ Algebra.adjoin ℚ_[p.1] ++ ({rationalCyclotomicLocalizedPrimitiveRoot ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (rationalCyclotomicArtinPlace p)} : ++ Set (rationalCyclotomicArtinLocalizedField ++ (rationalCyclotomicPrincipalPrimeModulus p n) p)) = ++ ⊤ := by ++ exact ++ (Subalgebra.restrictScalars_injective ℚ) ++ (rationalCyclotomicArtin_padicAlgebraAdjoin_restrict_eq_top ++ (rationalCyclotomicPrincipalPrimeModulus p n) p) ++ ++theorem ++ rationalCyclotomicPrincipalPrimeLocalizedLevel_isCyclotomicExtension ++ (p : Nat.Primes) (n : ℕ) : ++ IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] ++ (rationalCyclotomicArtinLocalizedField ++ (rationalCyclotomicPrincipalPrimeModulus p n) p) := by ++ exact ++ padic_isCyclotomicExtension_of_primitiveRoot_adjoin_eq_top ++ (rationalCyclotomicLocalizedPrimitiveRoot ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (rationalCyclotomicArtinPlace p)) ++ (rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_isPrimitiveRoot ++ p n) ++ (rationalCyclotomicPrincipalPrimeLocalizedPrimitiveRoot_adjoin_eq_top ++ p n) ++ ++ ++end RationalCyclotomicPrincipalPrime ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPrincipal.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPrincipal.lean +new file mode 100644 +index 0000000..43c227c +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinPrincipal.lean +@@ -0,0 +1,228 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinAction ++ ++ ++set_option autoImplicit false ++ ++open scoped Classical NNReal NumberField ValuativeRel ++open NumberField IsDedekindDomain ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open LocalClassFieldTheory ++open LocalFieldTheory ++open LocalFieldTheory.DiscreteValuationField ++open LocalFieldTheory.DiscreteValuationField.Examples.Qp ++open LubinTate ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++section RationalCyclotomicPrincipalPrime ++ ++attribute [local instance] ++ rationalFinitePlaceCompletionRatAlgebra ++ primeFact ++ levelNeZero ++ rationalCyclotomicLevelFiniteDimensional ++ rationalCyclotomicLevelIsAbelianGalois ++ rationalFinitePlaceBaseNontriviallyNormedField ++ rationalFinitePlaceBaseLocallyCompactSpace ++ rationalFinitePlaceBaseIsUltrametricDist ++ rationalFinitePlaceBaseValued ++ rationalFinitePlaceBaseValuativeRel ++ rationalFinitePlaceBaseValuationIsNontrivial ++ rationalFinitePlaceBaseValuationCompatible ++ rationalFinitePlaceBaseValuativeRelIsNontrivial ++ rationalFinitePlaceBaseIsValuativeTopology ++ rationalFinitePlaceBaseIsNonarchimedeanLocalField ++ rationalCyclotomicArtinExtensionAlgebra ++ rationalCyclotomicArtinExtensionSMul ++ rationalCyclotomicArtinCompletionAlgebra ++ rationalCyclotomicArtinLocalizedAlgebra ++ rationalCyclotomicArtinLocalizedGlobalAlgebra ++ rationalCyclotomicArtinLocalizedGlobalSMul ++ rationalCyclotomicArtinLocalizedScalarTower ++ rationalCyclotomicArtinLocalizedFiniteDimensional ++ rationalCyclotomicArtinLocalizedIsAbelianGalois ++ rationalCyclotomicArtinLocalizedIsSeparable ++ rationalCyclotomicArtinLocalizedIsCyclotomic ++ rationalCyclotomicArtinExtensionFiniteDimensional ++ rationalCyclotomicArtinExtensionContinuousSMul ++ rationalCyclotomicArtinExtensionLocallyCompact ++ rationalCyclotomicArtinLocalizedLocallyCompact ++ rationalCyclotomicArtinLocalizedIsUltrametricDist ++ rationalCyclotomicArtinLocalizedValued ++ rationalCyclotomicArtinLocalizedValuativeRel ++ rationalCyclotomicArtinLocalizedValuationCompatible ++ rationalCyclotomicArtinLocalizedValuationHasExtension ++ rationalCyclotomicArtinLocalizedValuationIsNontrivial ++ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial ++ rationalCyclotomicArtinLocalizedIsValuativeTopology ++ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField ++ rationalCyclotomicArtinLocalizedIntegerAlgebra ++ rationalCyclotomicArtinLocalizedIsIntegralClosure ++ rationalCyclotomicArtinLocalizedIntegerModuleFinite ++ rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension ++ rationalCyclotomicArtinLocalizedPadicAlgebra ++ rationalCyclotomicArtinLocalizedPadicScalarTower ++ rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois ++ rationalPrimeFactorCompletionPadicAlgebra ++ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional ++ ++private theorem ++ rationalCyclotomicPrincipalPrime_padicUnitParameterArtin_action ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x ++ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) = ++ (rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) ^ ++ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := by ++ let m := rationalCyclotomicPrincipalPrimeModulus p n ++ let E := rationalCyclotomicArtinLocalizedField m p ++ let T := RationalCyclotomicPrincipalPrimePadicLevel p n ++ let eL : E ≃ₐ[ℚ_[p.1]] T := ++ rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ let zetaE : E := rationalCyclotomicPrincipalPrimeLocalizedRoot p n ++ let tau : Gal(T / ℚ_[p.1]) := ++ rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x ++ let a := rationalCyclotomicPrincipalPrimeResidueUnit p n x ++ let zetaT : T := padicMultiplicativePrimitiveRoot p.1 n ++ have hzetaE : IsPrimitiveRoot zetaE (p.1 ^ (n + 1)) := by ++ change ++ IsPrimitiveRoot ++ (rationalCyclotomicLocalizedPrimitiveRoot m ++ (RayClass.rationalPrime p)) (m : ℕ) ++ exact ++ rationalCyclotomicLocalizedPrimitiveRoot_isPrimitiveRoot ++ m (RayClass.rationalPrime p) ++ have hrho : IsPrimitiveRoot (eL zetaE) (p.1 ^ (n + 1)) := ++ hzetaE.map_of_injective eL.injective ++ have hzetaT : IsPrimitiveRoot zetaT (p.1 ^ (n + 1)) := ++ padicMultiplicativePrimitiveRoot_isPrimitiveRoot p.1 n ++ have htauZetaT : tau zetaT = zetaT ^ a.val.val := ++ padicMultiplicativePrimitiveRoot_rationalPrimeUnitParameterGaloisAction ++ p n x ++ exact ++ map_primitiveRoot_eq_pow_of_eq_pow ++ tau.toMonoidHom zetaT (eL zetaE) ++ (p.1 ^ (n + 1)) a.val.val hzetaT hrho htauZetaT ++ ++private theorem rationalCyclotomicPrincipalPrime_localArtin_action ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ finitePlaceLocalArtinMonoidHom ++ (K := ℚ) ++ (L := KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (RayClass.rationalPrime p) ++ (rationalCyclotomicChosenFinitePlaceExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p)) ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime p) ++ (IdeleGroup.principalIdele ℚ x)) ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) = ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ^ ++ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := by ++ let eL := rationalCyclotomicLocalizedCompletionPadicAlgEquiv p n ++ apply eL.injective ++ calc ++ _ = _ := ++ finitePlaceLocalArtinMonoidHom_apply_semilinear ++ (K := ℚ) ++ (L := KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (K' := ℚ_[p.1]) ++ (L' := RationalCyclotomicPrincipalPrimePadicLevel p n) ++ (RayClass.rationalPrime p) ++ (rationalCyclotomicChosenFinitePlaceExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p)) ++ (rationalFinitePlaceCompletionRingEquivPadic p) ++ eL.toRingEquiv ++ (rationalCyclotomicPrincipalPrime_localizedBase_commutes p n) ++ (rationalFinitePlaceCompletionRingEquivPadic_semilinearValuationCompatible ++ p) ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime p) ++ (IdeleGroup.principalIdele ℚ x)) ++ (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ++ _ = rationalCyclotomicPrincipalPrimePadicUnitParameterArtin p n x ++ (eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) := ++ rationalCyclotomicPrincipalPrime_padicArtin_action_eq_unitParameter ++ p n x ++ _ = (eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n)) ^ ++ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val := ++ rationalCyclotomicPrincipalPrime_padicUnitParameterArtin_action p n x ++ _ = eL ((rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ^ ++ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val) := ++ (map_pow eL (rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ++ (rationalCyclotomicPrincipalPrimeResidueUnit p n x).val.val).symm ++ ++/-- The finite-place Artin symbol at the ramified prime, in its canonical ++local-to-global factored form. Keeping this specialization opaque prevents its ++dependent local/global instance tower from being unfolded downstream. -/ ++noncomputable def rationalCyclotomicPrincipalPrimeChosenArtin ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n) ≃ₐ[ℚ] ++ KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n) := ++ finitePlaceLocalToGlobalMonoidHom ++ (K := ℚ) ++ (L := KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (RayClass.rationalPrime p) ++ (rationalCyclotomicChosenFinitePlaceExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p)) ++ (finitePlaceLocalArtinMonoidHom ++ (K := ℚ) ++ (L := KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (RayClass.rationalPrime p) ++ (rationalCyclotomicChosenFinitePlaceExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n) ++ (RayClass.rationalPrime p)) ++ (IdeleGroup.finiteComponent ++ (RayClass.rationalPrime p) ++ (IdeleGroup.principalIdele ℚ x))) ++ ++/-- At the ramified prime, the cyclotomic character of the chosen finite-place ++Artin symbol is the direct reduction of the rational `p`-adic unit. -/ ++theorem galEquivZMod_chosenFinitePlaceArtinMonoidHom_principal_at_prime ++ (p : Nat.Primes) (n : ℕ) (x : ℚˣ) : ++ IsCyclotomicExtension.Rat.galEquivZMod ++ (p.1 ^ (n + 1)) ++ (KummerTheory.rationalCyclotomicLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (hK := ++ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (rationalCyclotomicPrincipalPrimeChosenArtin p n x) = ++ Units.map ++ (PadicInt.toZModPow (p := p.1) (n + 1)).toMonoidHom ++ (padicIntUnitOfRat p ++ (rationalPrimeUnit x p : ℚ) ++ (rationalPrimeUnit x p).ne_zero ++ (padicValRat_rationalPrimeUnit x p)) := by ++ change _ = rationalCyclotomicPrincipalPrimeResidueUnit p n x ++ apply rationalCyclotomicPrincipalPrime_galEquivZMod_eq_of_action p n ++ simp only [rationalCyclotomicPrincipalPrimeChosenArtin] ++ apply finitePlaceLocalToGlobalMonoidHom_apply_pow_of_localized_action ++ (zLocal := rationalCyclotomicPrincipalPrimeLocalizedRoot p n) ++ · rfl ++ · exact rationalCyclotomicPrincipalPrime_localArtin_action p n x ++ ++end RationalCyclotomicPrincipalPrime ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTower.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTower.lean +new file mode 100644 +index 0000000..77efaa0 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTower.lean +@@ -0,0 +1,357 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinBase ++ ++ ++set_option autoImplicit false ++ ++open scoped Classical NNReal NumberField ValuativeRel ++open NumberField IsDedekindDomain ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open LocalClassFieldTheory ++open LocalFieldTheory ++open LocalFieldTheory.DiscreteValuationField ++open LocalFieldTheory.DiscreteValuationField.Examples.Qp ++open LubinTate ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++attribute [local instance] ++ rationalFinitePlaceCompletionRatAlgebra ++ primeFact ++ levelNeZero ++ rationalCyclotomicLevelFiniteDimensional ++ rationalCyclotomicLevelIsAbelianGalois ++ rationalFinitePlaceBaseNontriviallyNormedField ++ rationalFinitePlaceBaseLocallyCompactSpace ++ rationalFinitePlaceBaseIsUltrametricDist ++ rationalFinitePlaceBaseValued ++ rationalFinitePlaceBaseValuativeRel ++ rationalFinitePlaceBaseValuationIsNontrivial ++ rationalFinitePlaceBaseValuationCompatible ++ rationalFinitePlaceBaseValuativeRelIsNontrivial ++ rationalFinitePlaceBaseIsValuativeTopology ++ rationalFinitePlaceBaseIsNonarchimedeanLocalField ++ ++/-- The finite place of `ℚ` determined by the rational prime `q`. -/ ++abbrev rationalCyclotomicArtinPlace (q : Nat.Primes) : ++ HeightOneSpectrum (𝓞 ℚ) := ++ RayClass.rationalPrime q ++ ++/-- The `q`-adic absolute value on `ℚ` used for the finite-place Artin map. -/ ++abbrev rationalCyclotomicArtinBaseAbv (q : Nat.Primes) : ++ AbsoluteValue ℚ ℝ := ++ HeightOneSpectrum.adicAbv ℚ (rationalCyclotomicArtinPlace q) ++ ++/-- The rational cyclotomic extension at the positive level `m`. -/ ++abbrev rationalCyclotomicArtinLevel (m : ℕ+) := ++ KummerTheory.rationalCyclotomicLevel m ++ ++/-- A chosen extension of the `q`-adic absolute value to the cyclotomic field. -/ ++abbrev rationalCyclotomicArtinExtension ++ (m : ℕ+) (q : Nat.Primes) : ++ AbsoluteValueExtension ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinLevel m) := ++ chosenFinitePlaceExtension ++ (L := rationalCyclotomicArtinLevel m) ++ (rationalCyclotomicArtinPlace q) ++ ++/-- The local completion of the cyclotomic field at the chosen place above `q`. -/ ++abbrev rationalCyclotomicArtinLocalizedField ++ (m : ℕ+) (q : Nat.Primes) := ++ AlgebraicNumberTheory.Valuations.LocalizedCompletion ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q) ++ ++@[reducible] ++noncomputable local instance rationalCyclotomicArtinExtensionAlgebra ++ (m : ℕ+) (q : Nat.Primes) : ++ Algebra ℚ ++ (rationalCyclotomicArtinExtension m q).1.Completion := ++ AbsoluteValue.extensionCompletionAlgebra ++ (K := ℚ) (rationalCyclotomicArtinExtension m q).1 ++ ++@[reducible] ++noncomputable local instance rationalCyclotomicArtinExtensionSMul ++ (m : ℕ+) (q : Nat.Primes) : ++ SMul ℚ ++ (rationalCyclotomicArtinExtension m q).1.Completion := ++ (rationalCyclotomicArtinExtensionAlgebra m q).toSMul ++ ++@[reducible] ++noncomputable local instance ++ rationalCyclotomicArtinCompletionAlgebra ++ (m : ℕ+) (q : Nat.Primes) : ++ Algebra (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinExtension m q).1.Completion := ++ AbsoluteValue.completionAlgebra ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q).1 ++ (rationalCyclotomicArtinExtension m q).2 ++ ++@[reducible] ++noncomputable local instance rationalCyclotomicArtinLocalizedAlgebra ++ (m : ℕ+) (q : Nat.Primes) : ++ Algebra (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinLocalizedField m q) := ++ finitePlaceLocalArtinLocalizedAlgebra ++ (K := ℚ) (L := rationalCyclotomicArtinLevel m) ++ (rationalCyclotomicArtinPlace q) ++ (rationalCyclotomicArtinExtension m q) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedGlobalAlgebra ++ (m : ℕ+) (q : Nat.Primes) : ++ Algebra ℚ (rationalCyclotomicArtinLocalizedField m q) := ++ LocalClassFieldTheory.localizedCompletionGlobalAlgebra ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedGlobalSMul ++ (m : ℕ+) (q : Nat.Primes) : ++ SMul ℚ (rationalCyclotomicArtinLocalizedField m q) := ++ (rationalCyclotomicArtinLocalizedGlobalAlgebra m q).toSMul ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedScalarTower ++ (m : ℕ+) (q : Nat.Primes) : ++ IsScalarTower ℚ ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinLocalizedField m q) := by ++ constructor ++ intro r x y ++ simp only [Algebra.smul_def, map_mul, eq_ratCast, ++ map_ratCast, mul_assoc] ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedFiniteDimensional ++ (m : ℕ+) (q : Nat.Primes) : ++ FiniteDimensional ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinLocalizedField m q) := ++ finitePlaceLocalArtinFiniteDimensional ++ (K := ℚ) (L := rationalCyclotomicArtinLevel m) ++ (rationalCyclotomicArtinPlace q) ++ (rationalCyclotomicArtinExtension m q) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIsAbelianGalois ++ (m : ℕ+) (q : Nat.Primes) : ++ IsAbelianGalois ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinLocalizedField m q) := ++ finitePlaceLocalArtinIsAbelianGalois ++ (K := ℚ) (L := rationalCyclotomicArtinLevel m) ++ (rationalCyclotomicArtinPlace q) ++ (rationalCyclotomicArtinExtension m q) ++ (inferInstance : ++ FiniteDimensional ℚ (rationalCyclotomicArtinLevel m)) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIsSeparable ++ (m : ℕ+) (q : Nat.Primes) : ++ Algebra.IsSeparable ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinLocalizedField m q) := ++ (rationalCyclotomicArtinLocalizedIsAbelianGalois m q).toIsGalois.to_isSeparable ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIsCyclotomic ++ (m : ℕ+) (q : Nat.Primes) : ++ IsCyclotomicExtension {(m : ℕ)} ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinLocalizedField m q) := ++ rationalCyclotomicLevel_localizedCompletion_isCyclotomicExtension ++ m (rationalCyclotomicArtinPlace q) ++ ++noncomputable local instance ++ rationalCyclotomicArtinExtensionFiniteDimensional ++ (m : ℕ+) (q : Nat.Primes) : ++ FiniteDimensional ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinExtension m q).1.Completion := ++ completionModuleFinite ++ (rationalCyclotomicArtinBaseAbv q) ++ (RayClass.adicAbv_isNontrivial ++ (rationalCyclotomicArtinPlace q)) ++ (rationalCyclotomicArtinExtension m q) ++ ++noncomputable local instance ++ rationalCyclotomicArtinExtensionContinuousSMul ++ (m : ℕ+) (q : Nat.Primes) : ++ ContinuousSMul ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinExtension m q).1.Completion := ++ continuousSMul_of_algebraMap _ _ ++ (AbsoluteValue.completionMap_isometry ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q).1 ++ (rationalCyclotomicArtinExtension m q).2).continuous ++ ++noncomputable local instance ++ rationalCyclotomicArtinExtensionLocallyCompact ++ (m : ℕ+) (q : Nat.Primes) : ++ LocallyCompactSpace ++ (rationalCyclotomicArtinExtension m q).1.Completion := ++ LocallyCompactSpace.of_finiteDimensional_of_complete ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinExtension m q).1.Completion ++ ++private noncomputable def ++ rationalCyclotomicArtinLocalizedEquivCompletion ++ (m : ℕ+) (q : Nat.Primes) : ++ rationalCyclotomicArtinLocalizedField m q ≃ᵢ ++ (rationalCyclotomicArtinExtension m q).1.Completion := ++ { toEquiv := ++ (localizedCompletionEquivCompletion ++ (rationalCyclotomicArtinBaseAbv q) ++ (RayClass.adicAbv_isNontrivial ++ (rationalCyclotomicArtinPlace q)) ++ (rationalCyclotomicArtinExtension m q)).toEquiv ++ isometry_toFun := ++ Isometry.of_dist_eq fun _ _ => rfl } ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedLocallyCompact ++ (m : ℕ+) (q : Nat.Primes) : ++ LocallyCompactSpace ++ (rationalCyclotomicArtinLocalizedField m q) := ++ ((rationalCyclotomicArtinLocalizedEquivCompletion m q).toHomeomorph.locallyCompactSpace_iff).2 ++ inferInstance ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIsUltrametricDist ++ (m : ℕ+) (q : Nat.Primes) : ++ IsUltrametricDist ++ (rationalCyclotomicArtinLocalizedField m q) := ++ localizedCompletionIsUltrametricDist ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv ++ ℚ (rationalCyclotomicArtinPlace q)) ++ ++noncomputable local instance rationalCyclotomicArtinLocalizedValued ++ (m : ℕ+) (q : Nat.Primes) : ++ Valued (rationalCyclotomicArtinLocalizedField m q) ℝ≥0 := ++ localizedCompletionFinitePlaceValued ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv ++ ℚ (rationalCyclotomicArtinPlace q)) ++ ++@[reducible] ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedValuativeRel ++ (m : ℕ+) (q : Nat.Primes) : ++ ValuativeRel (rationalCyclotomicArtinLocalizedField m q) := ++ localizedCompletionFinitePlaceValuativeRel ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv ++ ℚ (rationalCyclotomicArtinPlace q)) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedValuationCompatible ++ (m : ℕ+) (q : Nat.Primes) : ++ (Valued.v : Valuation ++ (rationalCyclotomicArtinLocalizedField m q) ℝ≥0).Compatible := ++ Valuation.Compatible.ofValuation _ ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedValuationHasExtension ++ (m : ℕ+) (q : Nat.Primes) : ++ Valuation.HasExtension ++ (ValuativeRel.valuation ++ (rationalCyclotomicArtinBaseAbv q).Completion) ++ (ValuativeRel.valuation ++ (rationalCyclotomicArtinLocalizedField m q)) := ++ localizedCompletionValuationHasExtension ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv ++ ℚ (rationalCyclotomicArtinPlace q)) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedValuationIsNontrivial ++ (m : ℕ+) (q : Nat.Primes) : ++ (ValuativeRel.valuation ++ (rationalCyclotomicArtinLocalizedField m q)).IsNontrivial := ++ Valuation.IsNontrivial.of_hasExtension ++ (ValuativeRel.valuation ++ (rationalCyclotomicArtinBaseAbv q).Completion) ++ (ValuativeRel.valuation ++ (rationalCyclotomicArtinLocalizedField m q)) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial ++ (m : ℕ+) (q : Nat.Primes) : ++ ValuativeRel.IsNontrivial ++ (rationalCyclotomicArtinLocalizedField m q) := ++ (ValuativeRel.isNontrivial_iff_isNontrivial ++ (ValuativeRel.valuation ++ (rationalCyclotomicArtinLocalizedField m q))).2 inferInstance ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIsValuativeTopology ++ (m : ℕ+) (q : Nat.Primes) : ++ IsValuativeTopology ++ (rationalCyclotomicArtinLocalizedField m q) := ++ isValuativeTopology_of_valued_ofValuation ++ (rationalCyclotomicArtinLocalizedField m q) ℝ≥0 ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField ++ (m : ℕ+) (q : Nat.Primes) : ++ IsNonarchimedeanLocalField ++ (rationalCyclotomicArtinLocalizedField m q) := ++ { toIsValuativeTopology := inferInstance ++ toLocallyCompactSpace := inferInstance ++ toIsNontrivial := inferInstance } ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIntegerAlgebra ++ (m : ℕ+) (q : Nat.Primes) : ++ Algebra ++ 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] ++ (rationalCyclotomicArtinLocalizedField m q) := ++ Algebra.ofSubsemiring ++ 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIsIntegralClosure ++ (m : ℕ+) (q : Nat.Primes) : ++ IsIntegralClosure ++ 𝒪[rationalCyclotomicArtinLocalizedField m q] ++ 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] ++ (rationalCyclotomicArtinLocalizedField m q) := ++ localizedCompletionIsIntegralClosureWithExtension ++ (rationalCyclotomicArtinBaseAbv q) ++ (rationalCyclotomicArtinExtension m q) ++ (RayClass.adicAbv_isNontrivial ++ (rationalCyclotomicArtinPlace q)) ++ (HeightOneSpectrum.isNonarchimedean_adicAbv ++ ℚ (rationalCyclotomicArtinPlace q)) ++ ++noncomputable local instance ++ rationalCyclotomicArtinLocalizedIntegerModuleFinite ++ (m : ℕ+) (q : Nat.Primes) : ++ Module.Finite ++ 𝒪[(rationalCyclotomicArtinBaseAbv q).Completion] ++ 𝒪[rationalCyclotomicArtinLocalizedField m q] := ++ integerRing_moduleFinite_of_isIntegralClosure ++ (rationalCyclotomicArtinBaseAbv q).Completion ++ (rationalCyclotomicArtinLocalizedField m q) ++ ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTransport.lean b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTransport.lean +new file mode 100644 +index 0000000..666b029 +--- /dev/null ++++ b/Lean4/ClassFieldTheory/GlobalClassFieldTheory/Reciprocity/RationalCyclotomicFinitePlaceArtinTransport.lean +@@ -0,0 +1,375 @@ ++/- ++Copyright (c) 2026 Naganori Yamaguchi (https://github.com/n-yamaguchi-0729). All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Naganori Yamaguchi (assisted by OpenAI Codex) ++-/ ++ ++import ClassFieldTheory.GlobalClassFieldTheory.Reciprocity.RationalCyclotomicFinitePlaceArtinPadic ++ ++ ++set_option autoImplicit false ++ ++open scoped Classical NNReal NumberField ValuativeRel ++open NumberField IsDedekindDomain ++open AlgebraicNumberTheory.Valuations ++open HilbertRamification ++open LocalClassFieldTheory ++open LocalFieldTheory ++open LocalFieldTheory.DiscreteValuationField ++open LocalFieldTheory.DiscreteValuationField.Examples.Qp ++open LubinTate ++ ++noncomputable section ++ ++namespace GlobalClassFieldTheory ++namespace Reciprocity ++ ++section RationalCyclotomicPrincipalPrime ++ ++attribute [local instance] ++ rationalFinitePlaceCompletionRatAlgebra ++ primeFact ++ levelNeZero ++ rationalCyclotomicLevelFiniteDimensional ++ rationalCyclotomicLevelIsAbelianGalois ++ rationalFinitePlaceBaseNontriviallyNormedField ++ rationalFinitePlaceBaseLocallyCompactSpace ++ rationalFinitePlaceBaseIsUltrametricDist ++ rationalFinitePlaceBaseValued ++ rationalFinitePlaceBaseValuativeRel ++ rationalFinitePlaceBaseValuationIsNontrivial ++ rationalFinitePlaceBaseValuationCompatible ++ rationalFinitePlaceBaseValuativeRelIsNontrivial ++ rationalFinitePlaceBaseIsValuativeTopology ++ rationalFinitePlaceBaseIsNonarchimedeanLocalField ++ rationalCyclotomicArtinExtensionAlgebra ++ rationalCyclotomicArtinExtensionSMul ++ rationalCyclotomicArtinCompletionAlgebra ++ rationalCyclotomicArtinLocalizedAlgebra ++ rationalCyclotomicArtinLocalizedGlobalAlgebra ++ rationalCyclotomicArtinLocalizedGlobalSMul ++ rationalCyclotomicArtinLocalizedScalarTower ++ rationalCyclotomicArtinLocalizedFiniteDimensional ++ rationalCyclotomicArtinLocalizedIsAbelianGalois ++ rationalCyclotomicArtinLocalizedIsSeparable ++ rationalCyclotomicArtinLocalizedIsCyclotomic ++ rationalCyclotomicArtinExtensionFiniteDimensional ++ rationalCyclotomicArtinExtensionContinuousSMul ++ rationalCyclotomicArtinExtensionLocallyCompact ++ rationalCyclotomicArtinLocalizedLocallyCompact ++ rationalCyclotomicArtinLocalizedIsUltrametricDist ++ rationalCyclotomicArtinLocalizedValued ++ rationalCyclotomicArtinLocalizedValuativeRel ++ rationalCyclotomicArtinLocalizedValuationCompatible ++ rationalCyclotomicArtinLocalizedValuationHasExtension ++ rationalCyclotomicArtinLocalizedValuationIsNontrivial ++ rationalCyclotomicArtinLocalizedValuativeRelIsNontrivial ++ rationalCyclotomicArtinLocalizedIsValuativeTopology ++ rationalCyclotomicArtinLocalizedIsNonarchimedeanLocalField ++ rationalCyclotomicArtinLocalizedIntegerAlgebra ++ rationalCyclotomicArtinLocalizedIsIntegralClosure ++ rationalCyclotomicArtinLocalizedIntegerModuleFinite ++ rationalCyclotomicPrincipalPrimeLevelIsCyclotomicExtension ++ rationalCyclotomicArtinLocalizedPadicAlgebra ++ rationalCyclotomicArtinLocalizedPadicScalarTower ++ rationalCyclotomicPrincipalPrimePadicLevelIsAbelianGalois ++ rationalPrimeFactorCompletionPadicAlgebra ++ rationalCyclotomicPrincipalPrimePadicLevelFiniteDimensional ++ ++/-- The chosen localized global cyclotomic level, transported over the ++completion equivalence, is the standard multiplicative Lubin--Tate level. -/ ++noncomputable def rationalCyclotomicLocalizedCompletionPadicAlgEquiv ++ (p : Nat.Primes) (n : ℕ) : ++ rationalCyclotomicArtinLocalizedField ++ (rationalCyclotomicPrincipalPrimeModulus p n) p ≃ₐ[ℚ_[p.1]] ++ RationalCyclotomicPrincipalPrimePadicLevel p n := by ++ letI : IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] ++ (rationalCyclotomicArtinLocalizedField ++ (rationalCyclotomicPrincipalPrimeModulus p n) p) := ++ rationalCyclotomicPrincipalPrimeLocalizedLevel_isCyclotomicExtension p n ++ letI : IsCyclotomicExtension {p.1 ^ (n + 1)} ℚ_[p.1] ++ (RationalCyclotomicPrincipalPrimePadicLevel p n) := ++ padicMultiplicativeLevel_isCyclotomicExtension p.1 n ++ exact ++ IsCyclotomicExtension.algEquiv ++ {p.1 ^ (n + 1)} ℚ_[p.1] ++ (rationalCyclotomicArtinLocalizedField ++ (rationalCyclotomicPrincipalPrimeModulus p n) p) ++ (RationalCyclotomicPrincipalPrimePadicLevel p n) ++ ++/-! ## The ramified principal finite-place factor -/ ++ ++theorem ++ rationalCyclotomicPrincipalPrime_galEquivZMod_eq_of_action ++ (p : Nat.Primes) (n : ℕ) ++ (sigma : Gal( ++ rationalCyclotomicPrincipalPrimeLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n) / ℚ)) ++ (a : (ZMod (p.1 ^ (n + 1)))ˣ) ++ (haction : ++ sigma (rationalCyclotomicLevelPrimitiveRoot ++ (rationalCyclotomicPrincipalPrimeModulus p n)) = ++ rationalCyclotomicLevelPrimitiveRoot ++ (rationalCyclotomicPrincipalPrimeModulus p n) ^ a.val.val) : ++ IsCyclotomicExtension.Rat.galEquivZMod ++ (p.1 ^ (n + 1)) ++ (rationalCyclotomicPrincipalPrimeLevel ++ (rationalCyclotomicPrincipalPrimeModulus p n)) ++ (hK := ++ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension ++ (rationalCyclotomicPrincipalPrimeModulus p n)) sigma = ++ a := by ++ let m := rationalCyclotomicPrincipalPrimeModulus p n ++ let L := rationalCyclotomicPrincipalPrimeLevel m ++ let zeta : L := rationalCyclotomicLevelPrimitiveRoot m ++ have hzeta : IsPrimitiveRoot zeta (p.1 ^ (n + 1)) := by ++ change ++ IsPrimitiveRoot ++ (rationalCyclotomicLevelPrimitiveRoot m) (m : ℕ) ++ exact rationalCyclotomicLevelPrimitiveRoot_isPrimitiveRoot m ++ change ++ IsCyclotomicExtension.Rat.galEquivZMod ++ (p.1 ^ (n + 1)) L ++ (hK := ++ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) ++ sigma = a ++ let c := ++ IsCyclotomicExtension.Rat.galEquivZMod ++ (p.1 ^ (n + 1)) L ++ (hK := ++ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) ++ sigma ++ have hc : ++ sigma zeta = zeta ^ c.val.val := ++ IsCyclotomicExtension.Rat.galEquivZMod_apply_of_pow_eq ++ (hK := ++ KummerTheory.rationalCyclotomicLevel_isCyclotomicExtension m) ++ (p.1 ^ (n + 1)) L sigma hzeta.pow_eq_one ++ have hpowers : ++ zeta ^ c.val.val = zeta ^ a.val.val := ++ hc.symm.trans haction ++ rw [(hzeta.isOfFinOrder m.ne_zero).pow_inj_mod, ++ ← hzeta.eq_orderOf, ++ ← ZMod.natCast_eq_natCast_iff'] at hpowers ++ change ++ (c.val.val : ZMod (p.1 ^ (n + 1))) = ++ (a.val.val : ZMod (p.1 ^ (n + 1))) at hpowers ++ have hValues : c.val = a.val := by ++ calc ++ c.val = (c.val.val : ZMod (p.1 ^ (n + 1))) := ++ (ZMod.natCast_zmod_val c.val).symm ++ _ = (a.val.val : ZMod (p.1 ^ (n + 1))) := hpowers ++ _ = a.val := ZMod.natCast_zmod_val a.val ++ change c = a ++ apply Units.ext ++ exact hValues ++ ++/-- The chosen finite-place Artin map factors through any extension identified ++with the chosen one. -/ ++theorem chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq ++ {K L : Type} ++ [Field K] [NumberField K] ++ [Field L] [Algebra K L] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ (v : HeightOneSpectrum (𝓞 K)) ++ (w : AbsoluteValueExtension ++ (HeightOneSpectrum.adicAbv K v) L) ++ (hw : chosenFinitePlaceExtension (L := L) v = w) ++ (x : (v.adicCompletion K)ˣ) : ++ chosenFinitePlaceArtinMonoidHom ++ (K := K) (L := L) v x = ++ finitePlaceLocalToGlobalMonoidHom ++ (K := K) (L := L) v w ++ (finitePlaceLocalArtinMonoidHom ++ (K := K) (L := L) v w x) := by ++ subst w ++ exact ++ congrArg ++ (fun f : (v.adicCompletion K)ˣ →* (L ≃ₐ[K] L) => f x) ++ (finitePlaceArtinMonoidHomOfExtension_factor ++ (K := K) (L := L) v ++ (chosenFinitePlaceExtension (L := L) v)) ++ ++private theorem ++ chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq_at ++ {K L : Type} ++ [Field K] [NumberField K] ++ [Field L] [Algebra K L] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ (v : HeightOneSpectrum (𝓞 K)) ++ (w : AbsoluteValueExtension ++ (HeightOneSpectrum.adicAbv K v) L) ++ (hw : chosenFinitePlaceExtension (L := L) v = w) ++ (x : (v.adicCompletion K)ˣ) (z : L) : ++ chosenFinitePlaceArtinMonoidHom ++ (K := K) (L := L) v x z = ++ finitePlaceLocalToGlobalMonoidHom ++ (K := K) (L := L) v w ++ (finitePlaceLocalArtinMonoidHom ++ (K := K) (L := L) v w x) z := by ++ exact ++ congrArg (fun sigma : Gal(L / K) => sigma z) ++ (chosenFinitePlaceArtinMonoidHom_apply_factor_of_extension_eq ++ (K := K) (L := L) v w hw x) ++ ++theorem finitePlaceLocalToGlobalMonoidHom_apply_pow_of_localized_action ++ {K L : Type} ++ [Field K] [NumberField K] ++ [Field L] [Algebra K L] ++ [FiniteDimensional K L] [IsAbelianGalois K L] ++ (v : HeightOneSpectrum (𝓞 K)) ++ (w : AbsoluteValueExtension ++ (HeightOneSpectrum.adicAbv K v) L) ++ (sigma : ++ let vK := HeightOneSpectrum.adicAbv K v ++ let E := LocalizedCompletion vK w ++ letI : Algebra vK.Completion E := ++ finitePlaceLocalArtinLocalizedAlgebra v w ++ Gal(E / vK.Completion)) ++ (z : L) ++ (zLocal : ++ let vK := HeightOneSpectrum.adicAbv K v ++ LocalizedCompletion vK w) ++ (e : ℕ) ++ (hLocalization : ++ let vK := HeightOneSpectrum.adicAbv K v ++ let E := LocalizedCompletion vK w ++ letI : Algebra vK.Completion E := ++ finitePlaceLocalArtinLocalizedAlgebra v w ++ let eLoc : L →+* E := ++ AbsoluteValue.toAlgebraicLocalization vK w.1 w.2 ++ eLoc z = zLocal) ++ (hlocal : sigma zLocal = zLocal ^ e) : ++ finitePlaceLocalToGlobalMonoidHom ++ (K := K) (L := L) v w sigma z = z ^ e := by ++ let vK := HeightOneSpectrum.adicAbv K v ++ let hvK : vK.IsNontrivial := RayClass.adicAbv_isNontrivial v ++ let E := LocalizedCompletion vK w ++ let : Algebra vK.Completion E := ++ finitePlaceLocalArtinLocalizedAlgebra v w ++ let eD : absoluteValueDecompositionGroup K w.1 ≃* Gal(E / vK.Completion) := ++ decompositionGroupEquivAlgebraicLocalizationAut vK hvK w ++ let eLoc : L →+* E := ++ AbsoluteValue.toAlgebraicLocalization vK w.1 w.2 ++ let delta : absoluteValueDecompositionGroup K w.1 := eD.symm sigma ++ have hDecomposition : eD delta = sigma := eD.apply_symm_apply sigma ++ apply eLoc.injective ++ calc ++ eLoc (finitePlaceLocalToGlobalMonoidHom ++ (K := K) (L := L) v w sigma z) = ++ eD delta (eLoc z) := ++ (localizationRamificationGroups_decompositionGroupEquiv_toLocalization ++ vK hvK w delta z).symm ++ _ = sigma (eLoc z) := ++ congrArg (fun tau : Gal(E / vK.Completion) => tau (eLoc z)) ++ hDecomposition ++ _ = sigma zLocal := ++ congrArg (fun y : E => sigma y) hLocalization ++ _ = zLocal ^ e := hlocal ++ _ = (eLoc z) ^ e := ++ congrArg (fun y : E => y ^ e) hLocalization.symm ++ _ = eLoc (z ^ e) := (map_pow eLoc z e).symm ++ ++theorem map_primitiveRoot_eq_pow_of_eq_pow ++ {M : Type} [CommRing M] [IsDomain M] ++ (f : M →* M) (zeta rho : M) (order exponent : ℕ) ++ [NeZero order] ++ (hzeta : IsPrimitiveRoot zeta order) ++ (hrho : IsPrimitiveRoot rho order) ++ (hf : f zeta = zeta ^ exponent) : ++ f rho = rho ^ exponent := by ++ obtain ⟨j, -, hj⟩ := ++ hzeta.eq_pow_of_pow_eq_one hrho.pow_eq_one ++ calc ++ f rho = f (zeta ^ j) := congrArg f hj.symm ++ _ = (f zeta) ^ j := map_pow f zeta j ++ _ = (zeta ^ exponent) ^ j := congrArg (fun z => z ^ j) hf ++ _ = zeta ^ (exponent * j) := (pow_mul zeta exponent j).symm ++ _ = zeta ^ (j * exponent) := ++ congrArg (fun e : ℕ => zeta ^ e) (Nat.mul_comm exponent j) ++ _ = (zeta ^ j) ^ exponent := pow_mul zeta j exponent ++ _ = rho ^ exponent := congrArg (fun z => z ^ exponent) hj ++ ++theorem finitePlaceLocalArtinMonoidHom_apply_semilinear ++ {K L K' L' : Type} ++ [Field K] [NumberField K] ++ [Field L] [Algebra K L] ++ [hKLfinite : FiniteDimensional K L] [IsAbelianGalois K L] ++ [Field K'] [ValuativeRel K'] [TopologicalSpace K'] ++ [IsNonarchimedeanLocalField K'] ++ [Field L'] [Algebra K' L'] ++ [FiniteDimensional K' L'] [IsAbelianGalois K' L'] ++ (v : HeightOneSpectrum (𝓞 K)) ++ (w : AbsoluteValueExtension ++ (HeightOneSpectrum.adicAbv K v) L) ++ (eK : (HeightOneSpectrum.adicAbv K v).Completion ≃+* K') ++ (eL : LocalizedCompletion ++ (HeightOneSpectrum.adicAbv K v) w ≃+* L') ++ (hcomm : ∀ y : (HeightOneSpectrum.adicAbv K v).Completion, ++ eL (@algebraMap ++ (HeightOneSpectrum.adicAbv K v).Completion ++ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) ++ _ _ (finitePlaceLocalArtinLocalizedAlgebra v w) y) = ++ algebraMap K' L' (eK y)) ++ (hExt : SemilinearValuationCompatible ++ (HeightOneSpectrum.adicAbv K v).Completion K' eK) ++ (x : (v.adicCompletion K)ˣ) ++ (z : LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) : ++ eL (finitePlaceLocalArtinMonoidHom ++ (K := K) (L := L) v w x z) = ++ LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' ++ (Units.map eK.toMonoidHom ++ (finitePlaceLocalArtinInput v x)) (eL z) := by ++ calc ++ eL (finitePlaceLocalArtinMonoidHom ++ (K := K) (L := L) v w x z) = ++ eL ((@LocalClassFieldTheory.abelianLocalArtinMonoidHom ++ (HeightOneSpectrum.adicAbv K v).Completion ++ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) ++ (inferInstance : Field ++ (HeightOneSpectrum.adicAbv K v).Completion) ++ (inferInstance : Field ++ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) ++ (finitePlaceLocalArtinLocalizedAlgebra v w) ++ (finitePlaceLocalArtinCompletionValuativeRel v) ++ (inferInstance : TopologicalSpace ++ (HeightOneSpectrum.adicAbv K v).Completion) ++ (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) ++ (finitePlaceLocalArtinFiniteDimensional v w) ++ (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) ++ (finitePlaceLocalArtinInput v x)) z) := ++ congrArg eL ++ (finitePlaceLocalArtinMonoidHom_apply_normalized_at ++ (K := K) (L := L) v w x z) ++ _ = LocalClassFieldTheory.abelianLocalArtinMonoidHom K' L' ++ (Units.map eK.toMonoidHom ++ (finitePlaceLocalArtinInput v x)) (eL z) := ++ @abelianLocalArtinMonoidHom_semilinear_action ++ (HeightOneSpectrum.adicAbv K v).Completion K' ++ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w) L' ++ (inferInstance : Field ++ (HeightOneSpectrum.adicAbv K v).Completion) ++ (finitePlaceLocalArtinCompletionValuativeRel v) ++ (inferInstance : TopologicalSpace ++ (HeightOneSpectrum.adicAbv K v).Completion) ++ (finitePlaceLocalArtinCompletionIsNonarchimedeanLocalField v) ++ (inferInstance : Field K') ++ (inferInstance : ValuativeRel K') ++ (inferInstance : TopologicalSpace K') ++ (inferInstance : IsNonarchimedeanLocalField K') ++ (inferInstance : Field ++ (LocalizedCompletion (HeightOneSpectrum.adicAbv K v) w)) ++ (inferInstance : Field L') ++ (finitePlaceLocalArtinLocalizedAlgebra v w) ++ (inferInstance : Algebra K' L') ++ (finitePlaceLocalArtinFiniteDimensional v w) ++ (finitePlaceLocalArtinIsAbelianGalois v w hKLfinite) ++ (inferInstance : FiniteDimensional K' L') ++ (inferInstance : IsAbelianGalois K' L') ++ eK eL hcomm hExt (finitePlaceLocalArtinInput v x) z ++ ++ ++end RationalCyclotomicPrincipalPrime ++ ++end Reciprocity ++end GlobalClassFieldTheory +diff --git a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FiniteResidueFinrankTransfer.lean b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FiniteResidueFinrankTransfer.lean +index 1ff2c21..3705c23 100644 +--- a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FiniteResidueFinrankTransfer.lean ++++ b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FiniteResidueFinrankTransfer.lean +@@ -9,6 +9,7 @@ import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.FiniteResi + import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.ResidueExtension + import ValuedFieldTheory.Valuation.UniqueRing + ++ + set_option autoImplicit false + + namespace LocalClassFieldTheory +@@ -16,15 +17,6 @@ open CyclicCohomology RamificationTheory ClassFormation + + open LocalFieldTheory ValuationTheory + +-/-! +-# Finite local reciprocity: comparison of the two finite residue-field models +- +-The residue-action exact sequence presents the residue field of a +-finite fixed field intrinsically, inside the selected residue algebraic +-closure. The norm formula uses the literal residue field of the spectral +-valuation on that fixed field. This file compares those presentations by +-the uniqueness of the finite extension valuation. +--/ + + noncomputable section + +@@ -53,9 +45,27 @@ noncomputable def valuationSubringEquivDecompositionFieldOfEqTop + let eFZ : F ≃ₐ[F] Z := + (IntermediateField.botEquiv F Omega).symm.trans + (IntermediateField.equivOfEq hZ.symm) +- refine +- { toFun := fun x => ⟨eFZ (x : F), ?_⟩ +- invFun := fun z => ⟨eFZ.symm (z : Z), ?_⟩ ++ exact ++ { toFun := fun x => ⟨eFZ (x : F), by ++ change ((eFZ x : Z) : Omega) ∈ A ++ have he : ((eFZ x : Z) : Omega) = ++ algebraMap F Omega (x : F) := by ++ rfl ++ rw [he] ++ have hx : (x : F) ∈ A.comap (algebraMap F Omega) := by ++ rw [hC] ++ exact x.property ++ exact hx⟩ ++ invFun := fun z => ⟨eFZ.symm (z : Z), by ++ have hz : eFZ.symm (z : Z) ∈ A.comap (algebraMap F Omega) := by ++ change algebraMap F Omega (eFZ.symm (z : Z)) ∈ A ++ have he : algebraMap F Omega (eFZ.symm (z : Z)) = ++ ((z : Z) : Omega) := by ++ exact congrArg Subtype.val (eFZ.apply_symm_apply (z : Z)) ++ rw [he] ++ exact z.property ++ rw [hC] at hz ++ exact hz⟩ + left_inv := fun x => by + apply Subtype.ext + exact eFZ.symm_apply_apply (x : F) +@@ -68,24 +78,6 @@ noncomputable def valuationSubringEquivDecompositionFieldOfEqTop + map_mul' := fun x y => by + apply Subtype.ext + exact map_mul eFZ (x : F) (y : F) } +- · change ((eFZ x : Z) : Omega) ∈ A +- have he : ((eFZ x : Z) : Omega) = +- algebraMap F Omega (x : F) := by +- rfl +- rw [he] +- have hx : (x : F) ∈ A.comap (algebraMap F Omega) := by +- rw [hC] +- exact x.property +- exact hx +- · have hz : eFZ.symm (z : Z) ∈ A.comap (algebraMap F Omega) := by +- change algebraMap F Omega (eFZ.symm (z : Z)) ∈ A +- have he : algebraMap F Omega (eFZ.symm (z : Z)) = +- ((z : Z) : Omega) := by +- exact congrArg Subtype.val (eFZ.apply_symm_apply (z : Z)) +- rw [he] +- exact z.property +- rw [hC] at hz +- exact hz + + /-- The corresponding equivalence between literal and intrinsic residue + fields. -/ +diff --git a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FixedFieldNormResidueNaturality.lean b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FixedFieldNormResidueNaturality.lean +index 08eb9ea..dd20dc0 100644 +--- a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FixedFieldNormResidueNaturality.lean ++++ b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/FixedFieldNormResidueNaturality.lean +@@ -10,15 +10,9 @@ import ClassFieldTheory.LocalClassFieldTheory.Finite.LocalReciprocity.LocalHense + import ClassFieldTheory.AbstractClassFieldTheory.Reciprocity.Main + import Mathlib.FieldTheory.Galois.Notation + +-set_option autoImplicit false + +-/-! +-# Naturality of fixed-field norm-residue symbols ++set_option autoImplicit false + +-This file transports norm-restriction and transfer-inclusion naturality +-from the closed-subgroup class formation to actual fixed fields in a single +-Galois ambient field. +--/ + + noncomputable section + +@@ -521,7 +515,12 @@ theorem upperAbsoluteFinite + /-- The fixed-field norm-residue symbol for the lower horizontal extension, + induced by the canonical local class formation. -/ + noncomputable def lowerNormResidueSymbol +- (T : LocalFixedFieldNormRestrictionSquare k) := by ++ (T : LocalFixedFieldNormRestrictionSquare k) : ++ Additive (abstractFixedField k (SeparableClosure k) T.lowerBase)ˣ →+ ++ Additive (Abelianization ++ Gal(abstractRelativeFixedField k (SeparableClosure k) ++ T.lowerTop_le_lowerBase / ++ abstractFixedField k (SeparableClosure k) T.lowerBase)) := by + letI := T.lowerNormal + letI := T.lowerFinite + letI := T.lowerAbsoluteFinite +@@ -534,7 +533,12 @@ noncomputable def lowerNormResidueSymbol + /-- The fixed-field norm-residue symbol for the upper horizontal extension, + induced by the canonical local class formation. -/ + noncomputable def upperNormResidueSymbol +- (T : LocalFixedFieldNormRestrictionSquare k) := by ++ (T : LocalFixedFieldNormRestrictionSquare k) : ++ Additive (abstractFixedField k (SeparableClosure k) T.upperBase)ˣ →+ ++ Additive (Abelianization ++ Gal(abstractRelativeFixedField k (SeparableClosure k) ++ T.upperTop_le_upperBase / ++ abstractFixedField k (SeparableClosure k) T.upperBase)) := by + letI := T.upperNormal + letI := T.upperFinite + letI := upperAbsoluteFinite T +@@ -552,7 +556,15 @@ noncomputable def normUnits + + /-- Restriction between the abelianized actual relative Galois groups. -/ + noncomputable def abelianizedRestriction +- (T : LocalFixedFieldNormRestrictionSquare k) := by ++ (T : LocalFixedFieldNormRestrictionSquare k) : ++ Additive (Abelianization ++ Gal(abstractRelativeFixedField k (SeparableClosure k) ++ T.upperTop_le_upperBase / ++ abstractFixedField k (SeparableClosure k) T.upperBase)) →+ ++ Additive (Abelianization ++ Gal(abstractRelativeFixedField k (SeparableClosure k) ++ T.lowerTop_le_lowerBase / ++ abstractFixedField k (SeparableClosure k) T.lowerBase)) := by + letI := T.lowerNormal + letI := T.upperNormal + exact +@@ -681,7 +693,12 @@ theorem intermediateAbsoluteFinite + /-- The fixed-field norm-residue symbol for the total extension, induced by + the canonical local class formation. -/ + noncomputable def baseNormResidueSymbol +- (T : LocalFixedFieldTransferTower k) := by ++ (T : LocalFixedFieldTransferTower k) : ++ Additive (abstractFixedField k (SeparableClosure k) T.base)ˣ →+ ++ Additive (Abelianization ++ Gal(abstractRelativeFixedField k (SeparableClosure k) ++ (T.top_le_intermediate.trans T.intermediate_le_base) / ++ abstractFixedField k (SeparableClosure k) T.base)) := by + letI := T.totalNormal + letI := T.totalFinite + letI := T.baseAbsoluteFinite +@@ -695,7 +712,12 @@ noncomputable def baseNormResidueSymbol + /-- The fixed-field norm-residue symbol after changing the base to the + intermediate fixed field, induced by the canonical local class formation. -/ + noncomputable def intermediateNormResidueSymbol +- (T : LocalFixedFieldTransferTower k) := by ++ (T : LocalFixedFieldTransferTower k) : ++ Additive (abstractFixedField k (SeparableClosure k) T.intermediate)ˣ →+ ++ Additive (Abelianization ++ Gal(abstractRelativeFixedField k (SeparableClosure k) ++ T.top_le_intermediate / ++ abstractFixedField k (SeparableClosure k) T.intermediate)) := by + letI := intermediateNormal T + letI := intermediateFinite T + letI := intermediateAbsoluteFinite T +@@ -713,7 +735,15 @@ noncomputable def unitsInclusion + + /-- Transfer between the abelianized actual relative Galois groups. -/ + noncomputable def abelianizedTransfer +- (T : LocalFixedFieldTransferTower k) := by ++ (T : LocalFixedFieldTransferTower k) : ++ Additive (Abelianization ++ Gal(abstractRelativeFixedField k (SeparableClosure k) ++ (T.top_le_intermediate.trans T.intermediate_le_base) / ++ abstractFixedField k (SeparableClosure k) T.base)) →+ ++ Additive (Abelianization ++ Gal(abstractRelativeFixedField k (SeparableClosure k) ++ T.top_le_intermediate / ++ abstractFixedField k (SeparableClosure k) T.intermediate)) := by + letI := T.totalNormal + letI := T.totalFinite + exact +diff --git a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/LocalResidueDatum.lean b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/LocalResidueDatum.lean +index bc7a1de..9da0120 100644 +--- a/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/LocalResidueDatum.lean ++++ b/Lean4/ClassFieldTheory/LocalClassFieldTheory/Finite/LocalReciprocity/LocalResidueDatum.lean +@@ -9,6 +9,7 @@ import ValuedFieldTheory.Valuation.DiscreteValuationField.FiniteIntegralClosure + import ValuedFieldTheory.Ramification.GaloisValuation.AbsoluteGalois.FiniteExtensionCorrespondence + import ValuedFieldTheory.LocalField.NonarchimedeanLocalField.FiniteExtensionCompleteDVF + ++ + set_option autoImplicit false + + namespace LocalClassFieldTheory +@@ -17,24 +18,6 @@ open ClassFormation + + open ValuationTheory RamificationTheory LocalFieldTheory + +-/-! +-# Finite local reciprocity: the local residue degree datum +- +-For a nonarchimedean local field `K`, this file makes the choices implicit in +-the construction explicit. The canonical local valuation is packaged as a complete +-DVF, Chevalley's theorem chooses an extension to `AlgebraicClosure K`, and +-that valuation is pulled back to `SeparableClosure K`. Finite-separable +-uniqueness shows that its decomposition subgroup is the whole Galois group. +-The residue field of the decomposition field is then identified with the +-finite residue field of `K`. +- +-The remaining step is topological: the reduction action is shown continuous +-for the two Krull topologies and is composed with the intrinsic finite-field +-degree map from `ResidueAlgebraicClosureDegree`. The selected residue field +-is algebraically closed because its extension to the residue of +-`AlgebraicClosure K` is purely inseparable and the selected residue field is +-perfect over the finite base residue field. +--/ + + noncomputable section + +@@ -187,9 +170,23 @@ private noncomputable def localBaseValuationSubringEquivDecompositionField : + let eKZ : K ≃ₐ[K] Z := + (IntermediateField.botEquiv K (SeparableClosure K)).symm.trans + (IntermediateField.equivOfEq hZ.symm) +- refine +- { toFun := fun x => ⟨eKZ (x : K), ?_⟩ +- invFun := fun z => ⟨eKZ.symm (z : Z), ?_⟩ ++ exact ++ { toFun := fun x => ⟨eKZ (x : K), by ++ change ((eKZ x : Z) : SeparableClosure K) ∈ A ++ have he : ((eKZ x : Z) : SeparableClosure K) = ++ algebraMap K (SeparableClosure K) (x : K) := by ++ rfl ++ rw [he] ++ exact (localSeparableValuationSubring_pullback K (x : K)).2 x.property⟩ ++ invFun := fun z => ⟨eKZ.symm (z : Z), by ++ change eKZ.symm (z : Z) ∈ ++ (localCompleteDVF K).valuation.valuationSubring ++ apply (localSeparableValuationSubring_pullback K (eKZ.symm (z : Z))).1 ++ have he : algebraMap K (SeparableClosure K) (eKZ.symm (z : Z)) = ++ ((z : Z) : SeparableClosure K) := by ++ exact congrArg Subtype.val (eKZ.apply_symm_apply (z : Z)) ++ rw [he] ++ exact z.property⟩ + left_inv := fun x => by + apply Subtype.ext + exact eKZ.symm_apply_apply (x : K) +@@ -202,20 +199,6 @@ private noncomputable def localBaseValuationSubringEquivDecompositionField : + map_mul' := fun x y => by + apply Subtype.ext + exact map_mul eKZ (x : K) (y : K) } +- · change ((eKZ x : Z) : SeparableClosure K) ∈ A +- have he : ((eKZ x : Z) : SeparableClosure K) = +- algebraMap K (SeparableClosure K) (x : K) := by +- rfl +- rw [he] +- exact (localSeparableValuationSubring_pullback K (x : K)).2 x.property +- · change eKZ.symm (z : Z) ∈ +- (localCompleteDVF K).valuation.valuationSubring +- apply (localSeparableValuationSubring_pullback K (eKZ.symm (z : Z))).1 +- have he : algebraMap K (SeparableClosure K) (eKZ.symm (z : Z)) = +- ((z : Z) : SeparableClosure K) := by +- exact congrArg Subtype.val (eKZ.apply_symm_apply (z : Z)) +- rw [he] +- exact z.property + + /-- The residue field in the residue-action exact sequence is canonically the finite residue + field of the original local field. -/ +diff --git a/Lean4/ClassFieldTheory/LubinTate/Padic/CompletedChangedUniformizerFixedField.lean b/Lean4/ClassFieldTheory/LubinTate/Padic/CompletedChangedUniformizerFixedField.lean +index c747c98..aa28793 100644 +--- a/Lean4/ClassFieldTheory/LubinTate/Padic/CompletedChangedUniformizerFixedField.lean ++++ b/Lean4/ClassFieldTheory/LubinTate/Padic/CompletedChangedUniformizerFixedField.lean +@@ -9,6 +9,7 @@ import ClassFieldTheory.LubinTate.Padic.CompletedChangedUniformizerPrimitive + import ClassFieldTheory.LubinTate.Padic.CompletedChangedUniformizerThetaFixed + import ClassFieldTheory.LubinTate.Padic.CompletedUnramifiedFrobeniusFixed + ++ + set_option autoImplicit false + + /-! +@@ -42,7 +43,8 @@ noncomputable def padicCompletedChangedUniformizerFrobeniusAlgEquiv + (u : (padicLocalField p).valuationSubringˣ) (n : ℕ) : + padicCompletedLevelField p n ≃ₐ[ℚ_[p]] + padicCompletedLevelField p n := +- AlgEquiv.ofRingEquiv (by ++ AlgEquiv.ofRingEquiv ++ (f := padicCompletedUnitFrobeniusLiftEquiv p n u⁻¹) (by + intro b + change + padicCompletedUnitFrobeniusLiftEquiv p n u⁻¹ +diff --git a/Lean4/GaloisCohomology/Cyclic/Herbrand/HerbrandLowDegree/Basic.lean b/Lean4/GaloisCohomology/Cyclic/Herbrand/HerbrandLowDegree/Basic.lean +index ea6356d..eb19ced 100644 +--- a/Lean4/GaloisCohomology/Cyclic/Herbrand/HerbrandLowDegree/Basic.lean ++++ b/Lean4/GaloisCohomology/Cyclic/Herbrand/HerbrandLowDegree/Basic.lean +@@ -14,6 +14,7 @@ import Mathlib.GroupTheory.OrderOfElement + import Mathlib.GroupTheory.QuotientGroup.Basic + import Mathlib.GroupTheory.SpecificGroups.Cyclic + ++ + set_option autoImplicit false + + namespace CyclicCohomology +@@ -34,8 +35,7 @@ namespace Herbrand + + universe uG uA uB uC + +-/-- Herbrand-quotient theory: the finite-group norm `N_G a = ∏ g, g • a` +-for a multiplicative `G`-module. -/ ++ + def tateNorm (G : Type uG) (A : Type uA) [Group G] [Fintype G] [CommGroup A] + [MulDistribMulAction G A] (a : A) : A := + ∏ g : G, g • a +@@ -92,9 +92,8 @@ theorem fixed_of_forall_mem_zpowers_of_sigmaMinusOne_eq_one + omit [Group G] [Fintype G] [CommGroup A] [CommGroup B] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- First-isomorphism cardinality source for finite exactness calculations: +-the cardinality of the source of a group homomorphism is the product of the +-cardinalities of its kernel and range. -/ ++ ++ + theorem monoidHom_card_eq_card_ker_mul_card_range + {X : Type uA} {Y : Type uB} [Group X] [Group Y] [Finite X] (f : X →* Y) : + Nat.card X = Nat.card (MonoidHom.ker f) * Nat.card (MonoidHom.range f) := by +@@ -128,9 +127,8 @@ theorem card_subgroupOf_eq_card + omit [Fintype G] [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- The multiplicative induced module from the trivial subgroup, represented +-as functions on `G` with the right-regular action. This is the concrete model +-used in the low-degree Herbrand comparison. -/ ++ ++ + @[reducible] def rightRegularFunctionMulDistribMulAction : + MulDistribMulAction G (G → B) where + smul g f := fun x => f (x * g) +@@ -255,7 +253,7 @@ def tateNormSubgroup (G : Type uG) (A : Type uA) [Group G] [Fintype G] [CommGrou + [MulDistribMulAction G A] : Subgroup A := + MonoidHom.range (tateNormHom (G := G) (A := A)) + +-/-- Herbrand-quotient theory: the norm kernel `{a | N_G a = 1}`. -/ ++ + def normKernelSubgroup (G : Type uG) (A : Type uA) [Group G] [Fintype G] [CommGroup A] + [MulDistribMulAction G A] : Subgroup A := + MonoidHom.ker (tateNormHom (G := G) (A := A)) +@@ -267,7 +265,7 @@ def augmentationSubgroup (G : Type uG) (A : Type uA) [Group G] [CommGroup A] + + omit [Fintype G] [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- If `σ` generates `G`, the kernel of `a ↦ a^(σ-1)` is the fixed subgroup. -/ ++ + theorem sigmaMinusOneHom_ker_eq_fixedSubgroup + (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) : + MonoidHom.ker (sigmaMinusOneHom (G := G) (A := A) σ) = fixedSubgroup G A := by +@@ -282,8 +280,8 @@ theorem sigmaMinusOneHom_ker_eq_fixedSubgroup + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- Finite-module source: the norm homomorphism factors the cardinality of +-`A` into norm-kernel and norm-image cardinalities. -/ ++ ++ + theorem card_eq_card_normKernelSubgroup_mul_card_tateNormSubgroup [Finite A] : + Nat.card A = Nat.card (normKernelSubgroup G A) * Nat.card (tateNormSubgroup G A) := by + simpa [normKernelSubgroup, tateNormSubgroup] using +@@ -291,9 +289,8 @@ theorem card_eq_card_normKernelSubgroup_mul_card_tateNormSubgroup [Finite A] : + + omit [Fintype G] [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- Finite-module source: for a cyclic generator `σ`, the coboundary +-homomorphism factors the cardinality of `A` into fixed and augmentation +-cardinalities. -/ ++ ++ + theorem card_eq_card_fixedSubgroup_mul_card_augmentationSubgroup + (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) [Finite A] : + Nat.card A = Nat.card (fixedSubgroup G A) * Nat.card (augmentationSubgroup G A σ) := by +@@ -304,8 +301,8 @@ theorem card_eq_card_fixedSubgroup_mul_card_augmentationSubgroup + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- Finite-module cardinality balance behind `h(G,A)=1`: for a finite cyclic +-group action, the product `#A^G · #I_G A` equals `#ker N_G · #N_G A`. -/ ++ ++ + theorem herbrand_finite_module_cardinality_balance + (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) [Finite A] : + Nat.card (fixedSubgroup G A) * Nat.card (augmentationSubgroup G A σ) = +@@ -380,7 +377,7 @@ def HerbrandH0.mk : fixedSubgroup G A →* HerbrandH0 G A := by + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- Canonical projection from the norm kernel to `H⁻¹(G,A)`. -/ ++ + def HerbrandHMinusOne.mk (σ : G) : + normKernelSubgroup G A →* HerbrandHMinusOne G A σ := by + unfold HerbrandHMinusOne +@@ -422,7 +419,7 @@ theorem HerbrandH0.mk_surjective : + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- Every degree-minus-one Herbrand class has a norm-kernel representative. -/ ++ + theorem HerbrandHMinusOne.mk_surjective (σ : G) : + Function.Surjective (HerbrandHMinusOne.mk (G := G) (A := A) σ) := by + intro q +@@ -458,8 +455,8 @@ theorem HerbrandH0.mk_eq_one_iff (a : fixedSubgroup G A) : + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- A norm-kernel representative gives the trivial degree-minus-one class +-exactly when it is an augmentation. -/ ++ ++ + @[simp] + theorem HerbrandHMinusOne.mk_eq_one_iff (σ : G) + (a : normKernelSubgroup G A) : +@@ -573,8 +570,8 @@ protected theorem HerbrandH0.inductionOn + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- Eliminate a degree-minus-one Herbrand class through an arbitrary +-norm-kernel representative and the canonical class map. -/ ++ ++ + protected theorem HerbrandHMinusOne.inductionOn (σ : G) + {motive : HerbrandHMinusOne G A σ → Prop} + (q : HerbrandHMinusOne G A σ) +@@ -649,7 +646,7 @@ def HerbrandH0.lift {M : Type*} [Group M] + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- Descend a homomorphism on the norm kernel through `H⁻¹(G,A)`. -/ ++ + def HerbrandHMinusOne.lift {M : Type*} [Group M] (σ : G) + (f : normKernelSubgroup G A →* M) + (h : (augmentationSubgroup G A σ).subgroupOf (normKernelSubgroup G A) ≤ +@@ -703,7 +700,7 @@ noncomputable instance herbrandHMinusOneFiniteOfFinite (σ : G) [Finite A] : + omit [Fintype G] [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- Fixed subgroup of the right-regular multiplicative induced module. -/ ++ + abbrev rightRegularFunctionFixedSubgroup : Subgroup (G → B) := by + letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) + exact fixedSubgroup G (G → B) +@@ -711,7 +708,7 @@ abbrev rightRegularFunctionFixedSubgroup : Subgroup (G → B) := by + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- Norm image subgroup of the right-regular multiplicative induced module. -/ ++ + abbrev rightRegularFunctionTateNormSubgroup : Subgroup (G → B) := by + letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) + exact tateNormSubgroup G (G → B) +@@ -719,8 +716,8 @@ abbrev rightRegularFunctionTateNormSubgroup : Subgroup (G → B) := by + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- `H⁰` of the right-regular multiplicative induced module. -/ +-def rightRegularFunctionHerbrandH0 := by ++ ++def rightRegularFunctionHerbrandH0 : Type (max uG uB) := by + letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) + exact HerbrandH0 G (G → B) + +@@ -737,7 +734,7 @@ noncomputable instance rightRegularFunctionHerbrandH0CommGroup : + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- Norm-kernel subgroup of the right-regular multiplicative induced module. -/ ++ + abbrev rightRegularFunctionNormKernelSubgroup : Subgroup (G → B) := by + letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) + exact normKernelSubgroup G (G → B) +@@ -745,7 +742,7 @@ abbrev rightRegularFunctionNormKernelSubgroup : Subgroup (G → B) := by + omit [Fintype G] [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- Augmentation subgroup of the right-regular multiplicative induced module. -/ ++ + abbrev rightRegularFunctionAugmentationSubgroup (σ : G) : Subgroup (G → B) := by + letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) + exact augmentationSubgroup G (G → B) σ +@@ -753,8 +750,8 @@ abbrev rightRegularFunctionAugmentationSubgroup (σ : G) : Subgroup (G → B) := + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- `H^{-1}` of the right-regular multiplicative induced module. -/ +-def rightRegularFunctionHerbrandHMinusOne (σ : G) := by ++ ++def rightRegularFunctionHerbrandHMinusOne (σ : G) : Type (max uG uB) := by + letI := rightRegularFunctionMulDistribMulAction (G := G) (B := B) + exact HerbrandHMinusOne G (G → B) σ + +@@ -791,7 +788,7 @@ theorem tateNorm_sigmaMinusOne_eq_one (σ : G) (a : A) : + _ = 1 := by + rw [hshift, Finset.prod_inv_distrib, mul_inv_cancel] + +-/-- The augmentation image lies in the norm kernel. -/ ++ + theorem augmentationSubgroup_le_normKernelSubgroup (σ : G) : + augmentationSubgroup G A σ ≤ normKernelSubgroup G A := by + intro a ha +@@ -858,9 +855,8 @@ theorem herbrandH0_subsingleton_iff_fixed_le_tateNormSubgroup : + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- A quotient-level criterion for vanishing of `H^{-1}`: if every norm-kernel +-element is an augmentation element, then the low-degree Herbrand `H^{-1}` +-quotient is a subsingleton. -/ ++ ++ + theorem herbrandHMinusOne_subsingleton_of_normKernel_le_augmentationSubgroup + (σ : G) (h : normKernelSubgroup G A ≤ augmentationSubgroup G A σ) : + Subsingleton (HerbrandHMinusOne G A σ) := by +@@ -879,8 +875,7 @@ theorem herbrandHMinusOne_subsingleton_of_normKernel_le_augmentationSubgroup + exact h a.2 + rw [hq, hr] + +-/-- Degree-minus-one Herbrand cohomology is trivial exactly when every +-norm-kernel element is an augmentation element. -/ ++ + theorem herbrandHMinusOne_subsingleton_iff_normKernel_le_augmentationSubgroup + (σ : G) : + Subsingleton (HerbrandHMinusOne G A σ) ↔ +@@ -986,8 +981,8 @@ theorem herbrandHMinusOne_subsingleton_of_mulEquiv + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- Membership in the right-regular norm kernel is the single product +-condition `∏ g, f g = 1`. -/ ++ ++ + theorem rightRegularFunction_mem_normKernelSubgroup_iff (f : G → B) : + f ∈ rightRegularFunctionNormKernelSubgroup (G := G) (B := B) ↔ + (∏ g : G, f g) = 1 := by +@@ -1031,9 +1026,8 @@ theorem rightRegularFunction_mem_normKernelSubgroup_iff (f : G → B) : + omit [Fintype G] [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- The partial primitive along the cyclic powers of `σ`. This is the +-candidate used to solve `b (x * σ) * (b x)⁻¹ = f x` on the right-regular +-induced module. -/ ++ ++ + def rightRegularCyclicPartialProduct (σ : G) (f : G → B) (i : ℕ) : B := + (Finset.range i).prod (fun k => f (σ ^ k)) + +@@ -1266,8 +1260,8 @@ theorem rightRegularCyclicPrimitive_mul_sigma_mul_inv_of_partialProduct_eq_one + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- A right-regular norm-kernel element has product `1` along one full cyclic +-enumeration by a generator. -/ ++ ++ + theorem rightRegularFunction_prod_powers_eq_one_of_mem_normKernel + (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) + {f : G → B} +@@ -1325,8 +1319,8 @@ theorem rightRegularFunction_mem_augmentationSubgroup_iff + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- Concrete `H^{-1}` source for the right-regular multiplicative induced +-module: every norm-kernel element is an augmentation element. -/ ++ ++ + theorem rightRegularFunction_normKernel_le_augmentationSubgroup + (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) : + rightRegularFunctionNormKernelSubgroup (G := G) (B := B) ≤ +@@ -1348,8 +1342,8 @@ theorem rightRegularFunction_normKernel_le_augmentationSubgroup + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- The `H^{-1}` quotient of the right-regular multiplicative induced module +-is trivial for a cyclic group generated by `σ`. -/ ++ ++ + theorem rightRegularFunction_herbrandHMinusOne_subsingleton + (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) : + Subsingleton (rightRegularFunctionHerbrandHMinusOne (G := G) (B := B) σ) := by +@@ -1362,8 +1356,8 @@ theorem rightRegularFunction_herbrandHMinusOne_subsingleton + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- Concrete `H⁰` source for induced modules: for the right-regular +-multiplicative induced module `G → B`, every fixed point is a norm. -/ ++ ++ + theorem rightRegularFunction_fixed_le_tateNormSubgroup : + rightRegularFunctionFixedSubgroup (G := G) (B := B) ≤ + rightRegularFunctionTateNormSubgroup (G := G) (B := B) := by +@@ -1420,8 +1414,8 @@ theorem rightRegularFunction_fixed_le_tateNormSubgroup : + omit [CommGroup A] [CommGroup C] + [MulDistribMulAction G A] [MulDistribMulAction G B] + [MulDistribMulAction G C] in +-/-- The `H⁰` quotient of the right-regular multiplicative induced module is +-trivial. This is the degree-zero half of the low-degree Herbrand comparison. -/ ++ ++ + theorem rightRegularFunction_herbrandH0_subsingleton : + Subsingleton (rightRegularFunctionHerbrandH0 (G := G) (B := B)) := by + let := rightRegularFunctionMulDistribMulAction (G := G) (B := B) +@@ -1677,8 +1671,8 @@ theorem card_normKernelSubgroup_eq_card_herbrandHMinusOne_mul_card_augmentationS + + omit [CommGroup B] [CommGroup C] + [MulDistribMulAction G B] [MulDistribMulAction G C] in +-/-- The two low-degree Herbrand quotients of a finite cyclic module have equal +-cardinality, the finite-module source for Herbrand-quotient multiplicativity. -/ ++ ++ + theorem herbrand_finite_module_card_eq + (σ : G) (hgen : ∀ g : G, g ∈ Subgroup.zpowers σ) [Finite A] : + Nat.card (HerbrandH0 G A) = Nat.card (HerbrandHMinusOne G A σ) := by +diff --git a/Lean4/ValuedFieldTheory/LocalField/Padic/UnitDecomposition.lean b/Lean4/ValuedFieldTheory/LocalField/Padic/UnitDecomposition.lean +index c3ea784..4f582bb 100644 +--- a/Lean4/ValuedFieldTheory/LocalField/Padic/UnitDecomposition.lean ++++ b/Lean4/ValuedFieldTheory/LocalField/Padic/UnitDecomposition.lean +@@ -12,14 +12,9 @@ import Mathlib.NumberTheory.Padics.ValuativeRel + import Mathlib.NumberTheory.Padics.ProperSpace + import Mathlib.GroupTheory.Torsion + +-set_option autoImplicit false + +-/-! +-# Unit decomposition of the p-adic integers ++set_option autoImplicit false + +-This file constructs the reusable topological decomposition of +-`ℤ_[p]ˣ` into its finite factor and its principal `p`-adic factor. +--/ + + open scoped Topology + +@@ -457,7 +452,7 @@ noncomputable def padicPrincipalData + rfl + have htop : directTopology = standardTopology := + hdirect.trans (padicPrincipalUnitDirectTopology_eq_standard p) +- let P := fun T : TopologicalSpace U => by ++ let P : TopologicalSpace U → Type := fun T => by + letI : TopologicalSpace U := T + exact Σ a : ℕ, + Multiplicative +diff --git a/lakefile.toml b/lakefile.toml +index ed5e179..5e8b720 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -10,8 +10,8 @@ relaxedAutoImplicit = false + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "5ed2965256430c3649e86755f9576b54eca72435" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "ClassFieldTheory.All" +diff --git a/lean-toolchain b/lean-toolchain +index 12359f9..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.34.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/PrimeNumberTheoremAnd-lean4341.patch b/lean/patches/PrimeNumberTheoremAnd-lean4341.patch index 1e097c43b744be853859a0ba2aa2b5c533769c3e..924c5f6ec6fe88ba7788b420af4e3c3c7ac00abc 100644 --- a/lean/patches/PrimeNumberTheoremAnd-lean4341.patch +++ b/lean/patches/PrimeNumberTheoremAnd-lean4341.patch @@ -1,39904 +1,39904 @@ -diff --git a/PrimeNumberTheoremAnd/Catalan.lean b/PrimeNumberTheoremAnd/Catalan.lean -new file mode 100644 -index 0000000..0c4ccd6 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Catalan.lean -@@ -0,0 +1 @@ -+import PrimeNumberTheoremAnd.Catalan.Consequences -diff --git a/PrimeNumberTheoremAnd/Catalan/Consequences.lean b/PrimeNumberTheoremAnd/Catalan/Consequences.lean -new file mode 100644 -index 0000000..470ade9 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Catalan/Consequences.lean -@@ -0,0 +1,68 @@ -+import Mathlib.Analysis.Asymptotics.SpecificAsymptotics -+import Mathlib.Analysis.SpecialFunctions.Log.Basic -+import PrimeNumberTheoremAnd.Catalan.Wiener -+ -+namespace CatalanPNT -+ -+open ZetaFivePNT -+ -+open ArithmeticFunction hiding log -+open Nat hiding log -+open _root_.Finset -+open BigOperators _root_.Filter _root_.Real _root_.Asymptotics -+open scoped Chebyshev -+ -+theorem WeakPNT' : Tendsto (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) atTop (nhds 1) := by -+ have : (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) = -+ (fun N ↦ (∑ n ∈ range N, Λ n)/N + Λ N / N) := by -+ ext N -+ have : N ∈ Iic N := mem_Iic.mpr (le_refl _) -+ rw [← Finset.sum_erase_add _ _ this, ← Nat.Iio_eq_range, Iic_erase] -+ exact add_div _ _ _ -+ rw [this, ← add_zero 1] -+ apply Tendsto.add WeakPNT -+ convert squeeze_zero (f := fun N ↦ Λ N / N) (g := fun N ↦ log N / N) (t₀ := atTop) ?_ ?_ ?_ -+ · intro N -+ exact div_nonneg vonMangoldt_nonneg (cast_nonneg N) -+ · intro N -+ exact div_le_div_of_nonneg_right vonMangoldt_le_log (cast_nonneg N) -+ simpa only [Function.comp_def, pow_one, one_mul, add_zero] using -+ (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 one_ne_zero).comp -+ tendsto_natCast_atTop_atTop -+ -+theorem WeakPNT'' : ψ ~[atTop] (fun x ↦ x) := by -+ rw [(by rfl : ψ = (fun x ↦ ψ x))] -+ simp_rw [Chebyshev.psi_eq_sum_Icc] -+ apply IsEquivalent.trans (v := fun x ↦ (⌊x⌋₊:ℝ)) -+ · rw [isEquivalent_iff_tendsto_one] -+ · convert Tendsto.comp WeakPNT' (tendsto_nat_floor_atTop (α := ℝ)) using 1 -+ ext x -+ rfl -+ rw [eventually_iff] -+ simp only [ne_eq, cast_eq_zero, floor_eq_zero, not_lt, mem_atTop_sets, -+ Set.mem_ofPred_eq] -+ use 1 -+ simp only [imp_self, implies_true] -+ exact Asymptotics.isEquivalent_nat_floor -+ -+theorem isLittleO_sqrt_mul_log : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] _root_.id := by -+ have : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] fun x ↦ x := by -+ refine (isLittleO_mul_iff_isLittleO_div ?_).mpr ?_ -+ · filter_upwards [eventually_gt_atTop 0] with x hx; exact (sqrt_ne_zero hx.le).mpr hx.ne' -+ · convert isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2) using 2 with x -+ rw [div_sqrt, sqrt_eq_rpow] -+ exact this -+ -+theorem chebyshev_asymptotic : θ ~[atTop] id := by -+ rw [← sub_sub_self ψ θ] -+ refine WeakPNT''.sub_isLittleO -+ (IsBigO.trans_isLittleO (g := fun x ↦ 2 * x.sqrt * x.log) ?_ ?_) -+ · rw [isBigO_iff']; refine ⟨1, one_pos, ?_⟩ -+ simp only [one_mul, eventually_atTop] -+ exact ⟨2, fun x hx ↦ by -+ rw [Pi.sub_apply, norm_eq_abs, norm_eq_abs, abs_of_nonneg (by bound : 0 ≤ 2 * √x * log x)] -+ exact (abs_of_nonneg (sub_nonneg.mpr (Chebyshev.theta_le_psi x))).symm ▸ -+ Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log (by linarith : 1 ≤ x)⟩ -+ · convert isLittleO_sqrt_mul_log.const_mul_left 2 using 1 <;> first | rfl | (funext x; ring) -+ -+end CatalanPNT -diff --git a/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaContinuation.lean b/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaContinuation.lean -new file mode 100644 -index 0000000..723a0e3 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaContinuation.lean -@@ -0,0 +1,92 @@ -+import PrimeNumberTheoremAnd.Catalan.OrdinaryZetaZeroFree -+import Mathlib.Analysis.Complex.RemovableSingularity -+ -+namespace CatalanPNT -+ -+noncomputable section -+ -+open Complex Filter Set -+open scoped Topology -+ -+namespace CatalanOrdinaryZeta -+ -+noncomputable def regularizedZeta : ℂ → ℂ := -+ Function.update (fun s ↦ (s - 1) * riemannZeta s) 1 1 -+ -+@[simp] theorem regularizedZeta_one : regularizedZeta 1 = 1 := by -+ simp only [regularizedZeta, Function.update_self] -+ -+theorem regularizedZeta_of_ne_one {s : ℂ} (hs : s ≠ 1) : -+ regularizedZeta s = (s - 1) * riemannZeta s := by -+ exact Function.update_of_ne hs .. -+ -+theorem regularizedZeta_ne_zero_at_one : regularizedZeta 1 ≠ 0 := by -+ rw [regularizedZeta_one] -+ exact one_ne_zero -+ -+theorem differentiable_regularizedZeta : Differentiable ℂ regularizedZeta := by -+ rw [← differentiableOn_univ, -+ ← differentiableOn_compl_singleton_and_continuousAt_iff (c := 1) Filter.univ_mem] -+ constructor -+ · refine DifferentiableOn.congr (f := fun s ↦ (s - 1) * riemannZeta s) ?_ ?_ -+ · intro s hs -+ exact ((differentiableAt_id.sub_const 1).mul -+ (differentiableAt_riemannZeta (Set.mem_sdiff_singleton.mp hs).2)).differentiableWithinAt -+ · intro s hs -+ exact regularizedZeta_of_ne_one (Set.mem_sdiff_singleton.mp hs).2 -+ · simpa only [regularizedZeta, continuousAt_update_same] using riemannZeta_residue_one -+ -+theorem deriv_regularizedZeta_of_ne_one {s : ℂ} (hs : s ≠ 1) : -+ deriv regularizedZeta s = -+ (s - 1) * deriv riemannZeta s + riemannZeta s := by -+ have hderiv : deriv regularizedZeta s = -+ deriv (fun w ↦ (w - 1) * riemannZeta w) s := by -+ refine eventuallyEq_iff_exists_mem.mpr ?_ |>.deriv_eq -+ exact ⟨_, isOpen_ne.mem_nhds hs, -+ fun _ hw ↦ regularizedZeta_of_ne_one (Set.mem_ofPred.mp hw)⟩ -+ rw [hderiv, deriv_fun_mul (by fun_prop) (differentiableAt_riemannZeta hs), -+ deriv_sub_const, deriv_id'', one_mul, add_comm] -+ -+theorem regularizedZeta_ne_zero_of_one_le_re {s : ℂ} (hs : 1 ≤ s.re) : -+ regularizedZeta s ≠ 0 := by -+ rcases eq_or_ne s 1 with rfl | hs₁ -+ · exact regularizedZeta_ne_zero_at_one -+ · rw [regularizedZeta_of_ne_one hs₁] -+ exact mul_ne_zero (sub_ne_zero.mpr hs₁) -+ (riemannZeta_ne_zero_of_one_le_re_of_ne_one hs hs₁) -+ -+noncomputable def vonMangoldtAux (s : ℂ) : ℂ := -+ -deriv regularizedZeta s / regularizedZeta s -+ -+theorem continuousOn_vonMangoldtAux : -+ ContinuousOn vonMangoldtAux {s | 1 ≤ s.re} := by -+ change ContinuousOn (fun s ↦ -deriv regularizedZeta s / regularizedZeta s) -+ {s | 1 ≤ s.re} -+ simp_rw [neg_div] -+ have h := differentiable_regularizedZeta -+ exact ((h.contDiff.continuous_deriv le_rfl).continuousOn.div -+ h.continuous.continuousOn fun s hs ↦ regularizedZeta_ne_zero_of_one_le_re hs).neg -+ -+theorem eqOn_vonMangoldtAux : -+ Set.EqOn vonMangoldtAux -+ (fun s ↦ LSeries (fun n ↦ (ArithmeticFunction.vonMangoldt n : ℂ)) s - 1 / (s - 1)) -+ {s | 1 < s.re} := by -+ intro s hs -+ change vonMangoldtAux s = -+ LSeries (fun n ↦ (ArithmeticFunction.vonMangoldt n : ℂ)) s - 1 / (s - 1) -+ have hs' : 1 < s.re := hs -+ have hs₁ : s ≠ 1 := by -+ rintro rfl -+ norm_num at hs' -+ have hz : riemannZeta s ≠ 0 := riemannZeta_ne_zero_of_one_lt_re hs' -+ unfold vonMangoldtAux -+ rw [deriv_regularizedZeta_of_ne_one hs₁, regularizedZeta_of_ne_one hs₁, -+ ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div hs'] -+ field_simp [sub_ne_zero.mpr hs₁, hz] -+ ring -+ -+end CatalanOrdinaryZeta -+ -+end -+ -+end CatalanPNT -diff --git a/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaZeroFree.lean b/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaZeroFree.lean -new file mode 100644 -index 0000000..e0f363f ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaZeroFree.lean -@@ -0,0 +1,175 @@ -+import Mathlib.Analysis.SpecialFunctions.Complex.LogBounds -+import Mathlib.Analysis.Complex.Asymptotics -+import Mathlib.Analysis.Asymptotics.Lemmas -+import Mathlib.NumberTheory.EulerProduct.DirichletLSeries -+ -+namespace CatalanPNT -+ -+open Complex Asymptotics Filter -+open scoped Topology -+ -+namespace CatalanOrdinaryZeta -+ -+private lemma re_log_comb_nonneg' {a : ℝ} (ha₀ : 0 ≤ a) (ha₁ : a < 1) -+ {z : ℂ} (hz : ‖z‖ = 1) : -+ 0 ≤ 3 * (-log (1 - a)).re + 4 * (-log (1 - a * z)).re + -+ (-log (1 - a * z ^ 2)).re := by -+ have hac₀ : ‖(a : ℂ)‖ < 1 := by -+ simp only [Complex.norm_of_nonneg ha₀, ha₁] -+ have hac₁ : ‖a * z‖ < 1 := by rwa [norm_mul, hz, mul_one] -+ have hac₂ : ‖a * z ^ 2‖ < 1 := by rwa [norm_mul, norm_pow, hz, one_pow, mul_one] -+ rw [← ((hasSum_re <| hasSum_taylorSeries_neg_log hac₀).mul_left 3).add -+ ((hasSum_re <| hasSum_taylorSeries_neg_log hac₁).mul_left 4) |>.add -+ (hasSum_re <| hasSum_taylorSeries_neg_log hac₂) |>.tsum_eq] -+ refine tsum_nonneg fun n ↦ ?_ -+ simp only [← ofReal_pow, div_natCast_re, ofReal_re, mul_pow, mul_re, ofReal_im, -+ zero_mul, sub_zero] -+ rcases n.eq_zero_or_pos with rfl | hn -+ · simp -+ · simp only [← mul_div_assoc, ← add_div] -+ refine div_nonneg ?_ n.cast_nonneg -+ rw [← pow_mul, pow_mul', sq, mul_re, ← sq, ← sq, ← sq_norm_sub_sq_re, norm_pow, hz] -+ convert! (show 0 ≤ 2 * a ^ n * ((z ^ n).re + 1) ^ 2 by positivity) using 1 -+ ring -+ -+private lemma re_log_comb_nonneg {n : ℕ} (hn : 2 ≤ n) {x : ℝ} (hx : 1 < x) -+ (y : ℝ) : -+ 0 ≤ 3 * (-log (1 - (n : ℂ) ^ (-x : ℂ))).re + -+ 4 * (-log (1 - (n : ℂ) ^ (-(x + I * y)))).re + -+ (-log (1 - (n : ℂ) ^ (-(x + 2 * I * y)))).re := by -+ let a : ℝ := (n : ℝ) ^ (-x) -+ let z : ℂ := (n : ℂ) ^ (-(I * y)) -+ have hn₀ : (n : ℂ) ≠ 0 := by exact_mod_cast (show n ≠ 0 by omega) -+ have ha₀ : 0 ≤ a := by dsimp [a]; positivity -+ have ha₁ : a < 1 := by -+ dsimp [a] -+ rw [Real.rpow_neg (Nat.cast_nonneg n), inv_lt_one_iff₀] -+ exact .inr <| Real.one_lt_rpow (mod_cast one_lt_two.trans_le hn) <| zero_lt_one.trans hx -+ have hz : ‖z‖ = 1 := by -+ dsimp [z] -+ rw [← ofReal_natCast, norm_cpow_eq_rpow_re_of_pos (mod_cast by omega)] -+ simp only [neg_re, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, -+ mul_zero, sub_self, neg_zero, Real.rpow_zero] -+ have h₀ : (n : ℂ) ^ (-x : ℂ) = (a : ℂ) := by -+ dsimp [a] -+ simp only [ofReal_cpow n.cast_nonneg (-x), ofReal_natCast, ofReal_neg] -+ have h₁ : (n : ℂ) ^ (-(x + I * y)) = (a : ℂ) * z := by -+ dsimp [z] -+ rw [neg_add, cpow_add _ _ hn₀, h₀] -+ have h₂ : (n : ℂ) ^ (-(x + 2 * I * y)) = (a : ℂ) * z ^ 2 := by -+ dsimp [z] -+ rw [neg_add, cpow_add _ _ hn₀, h₀, -+ show -(2 * I * y) = (2 : ℕ) * -(I * y) by ring, cpow_nat_mul] -+ simpa only [h₀, h₁, h₂] using re_log_comb_nonneg' ha₀ ha₁ hz -+ -+private lemma summable_prime_log {s : ℂ} (hs : 1 < s.re) : -+ Summable (fun p : Nat.Primes ↦ -log (1 - (p : ℂ) ^ (-s))) := by -+ simpa only [riemannZetaSummandHom, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] using! -+ (summable_riemannZetaSummand hs).of_norm.clog_one_sub.neg.subtype Nat.Prime -+ -+private lemma one_lt_re_one_add {x : ℝ} (hx : 0 < x) (y : ℝ) : -+ 1 < (1 + x : ℂ).re ∧ 1 < (1 + x + I * y).re ∧ -+ 1 < (1 + x + 2 * I * y).re := by -+ simp only [add_re, one_re, ofReal_re, lt_add_iff_pos_right, hx, mul_re, I_re, -+ zero_mul, I_im, ofReal_im, mul_zero, sub_self, add_zero, re_ofNat, im_ofNat, -+ mul_one, mul_im, and_self] -+ -+theorem norm_riemannZeta_product_ge_one {x : ℝ} (hx : 0 < x) (y : ℝ) : -+ 1 ≤ ‖riemannZeta (1 + x) ^ 3 * riemannZeta (1 + x + I * y) ^ 4 * -+ riemannZeta (1 + x + 2 * I * y)‖ := by -+ have ⟨h₀, h₁, h₂⟩ := one_lt_re_one_add hx y -+ have H₀ := summable_prime_log h₀ -+ have H₁ := summable_prime_log h₁ -+ have H₂ := summable_prime_log h₂ -+ have hsum₀ := (hasSum_re H₀.hasSum).summable.mul_left 3 -+ have hsum₁ := (hasSum_re H₁.hasSum).summable.mul_left 4 -+ have hsum₂ := (hasSum_re H₂.hasSum).summable -+ rw [← riemannZeta_eulerProduct_exp_log h₀, ← riemannZeta_eulerProduct_exp_log h₁, -+ ← riemannZeta_eulerProduct_exp_log h₂] -+ simp only [← exp_nat_mul, Nat.cast_ofNat, ← exp_add, norm_exp, add_re, mul_re, -+ re_ofNat, im_ofNat, zero_mul, sub_zero, Real.one_le_exp_iff] -+ rw [re_tsum H₀, re_tsum H₁, re_tsum H₂, ← tsum_mul_left, ← tsum_mul_left, -+ ← hsum₀.tsum_add hsum₁, ← (hsum₀.add hsum₁).tsum_add hsum₂] -+ simpa only [neg_add_rev, neg_re, ge_iff_le, add_re, one_re, ofReal_re, -+ ofReal_add, ofReal_one] using -+ tsum_nonneg (fun p : Nat.Primes ↦ re_log_comb_nonneg p.prop.two_le -+ (show 1 < 1 + x by linarith) y) -+ -+private lemma riemannZeta_isBigO_near_one_horizontal : -+ (fun x : ℝ ↦ riemannZeta (1 + x)) =O[𝓝[>] 0] fun x ↦ (1 : ℂ) / x := by -+ have : (fun w : ℂ ↦ riemannZeta (1 + w)) =O[𝓝[≠] 0] (1 / ·) := by -+ have H : Tendsto (fun w : ℂ ↦ w * riemannZeta (1 + w)) (𝓝[≠] 0) (𝓝 1) := by -+ convert! riemannZeta_residue_one.comp (f := fun w ↦ 1 + w) ?_ using 1 -+ · simp only [Function.comp_def, add_sub_cancel_left] -+ · simpa only [tendsto_iff_comap, Homeomorph.coe_addLeft, add_zero, -+ map_le_iff_le_comap] using -+ ((Homeomorph.addLeft (1 : ℂ)).map_punctured_nhds_eq 0).le -+ exact (isBigO_mul_iff_isBigO_div eventually_mem_nhdsWithin).mp <| H.isBigO_one ℂ -+ exact (isBigO_comp_ofReal_nhds_ne this).mono <| nhdsGT_le_nhdsNE 0 -+ -+private lemma one_add_I_mul_ne_one {y : ℝ} (hy : y ≠ 0) : 1 + I * y ≠ 1 := by -+ simpa only [ne_eq, add_eq_left, mul_eq_zero, I_ne_zero, ofReal_eq_zero, false_or] using hy -+ -+private lemma riemannZeta_isBigO_horizontal {y : ℝ} (hy : y ≠ 0) : -+ (fun x : ℝ ↦ riemannZeta (1 + x + I * y)) =O[𝓝[>] 0] -+ fun _ ↦ (1 : ℂ) := by -+ refine IsBigO.mono ?_ nhdsWithin_le_nhds -+ simp_rw [add_comm (1 : ℂ), add_assoc] -+ have := (differentiableAt_riemannZeta (one_add_I_mul_ne_one hy)).continuousAt -+ rw [← zero_add (1 + _)] at this -+ exact this.comp (f := fun x : ℝ ↦ x + (1 + I * y)) (x := 0) (by fun_prop) -+ |>.tendsto.isBigO_one ℂ -+ -+private lemma riemannZeta_isBigO_horizontal_of_eq_zero {y : ℝ} (hy : y ≠ 0) -+ (h : riemannZeta (1 + I * y) = 0) : -+ (fun x : ℝ ↦ riemannZeta (1 + x + I * y)) =O[𝓝[>] 0] -+ fun x : ℝ ↦ (x : ℂ) := by -+ simp_rw [add_comm (1 : ℂ), add_assoc] -+ have := (differentiableAt_riemannZeta (one_add_I_mul_ne_one hy)).hasDerivAt -+ rw [← zero_add (1 + _)] at this -+ simpa only [zero_add, h, sub_zero] using -+ (Complex.isBigO_comp_ofReal_nhds -+ (this.comp_add_const 0 _).differentiableAt.isBigO_sub) |>.mono nhdsWithin_le_nhds -+ -+private lemma riemannZeta_ne_zero_one_add_I_mul {t : ℝ} (ht : t ≠ 0) : -+ riemannZeta (1 + I * t) ≠ 0 := by -+ intro Hz -+ have ht₂ : 2 * t ≠ 0 := mul_ne_zero two_ne_zero ht -+ have help (x : ℝ) : ((1 / x) ^ 3 * x ^ 4 * 1 : ℂ) = x := by -+ rcases eq_or_ne x 0 with rfl | h -+ · rw [ofReal_zero, zero_pow (by omega), mul_zero, mul_one] -+ · rw [one_div, inv_pow, pow_succ _ 3, ← mul_assoc, -+ inv_mul_cancel₀ <| pow_ne_zero 3 (ofReal_ne_zero.mpr h), one_mul, mul_one] -+ have H₀ : (fun _ : ℝ ↦ (1 : ℝ)) =O[𝓝[>] 0] -+ fun x ↦ riemannZeta (1 + x) ^ 3 * riemannZeta (1 + x + I * t) ^ 4 * -+ riemannZeta (1 + x + 2 * I * t) := -+ IsBigO.of_bound' <| eventually_nhdsWithin_of_forall -+ fun _ hx ↦ (norm_one (α := ℝ)).symm ▸ (norm_riemannZeta_product_ge_one hx t) -+ have H := riemannZeta_isBigO_near_one_horizontal.pow 3 |>.mul <| -+ (riemannZeta_isBigO_horizontal_of_eq_zero ht Hz).pow 4 |>.mul <| -+ riemannZeta_isBigO_horizontal ht₂ -+ simp only [ofReal_mul, ofReal_ofNat, mul_left_comm I, ← mul_assoc, help] at H -+ replace H := (H₀.trans H).norm_right -+ simp only [norm_real] at H -+ exact isLittleO_irrefl (.of_forall (fun _ ↦ one_ne_zero)) <| -+ H.of_norm_right.trans_isLittleO <| isLittleO_id_one.mono nhdsWithin_le_nhds -+ -+theorem riemannZeta_ne_zero_of_re_eq_one_of_ne_one {s : ℂ} (hs : s.re = 1) -+ (hs₁ : s ≠ 1) : riemannZeta s ≠ 0 := by -+ have hs' : s = 1 + I * s.im := by -+ conv_lhs => rw [← re_add_im s, hs, ofReal_one, mul_comm] -+ have him : s.im ≠ 0 := by -+ intro h -+ apply hs₁ -+ rw [hs', h, ofReal_zero, mul_zero, add_zero] -+ exact hs'.symm ▸ riemannZeta_ne_zero_one_add_I_mul him -+ -+theorem riemannZeta_ne_zero_of_one_le_re_of_ne_one {s : ℂ} (hs : 1 ≤ s.re) -+ (hs₁ : s ≠ 1) : riemannZeta s ≠ 0 := by -+ rcases hs.eq_or_lt with h | h -+ · exact riemannZeta_ne_zero_of_re_eq_one_of_ne_one h.symm hs₁ -+ · exact _root_.riemannZeta_ne_zero_of_one_lt_re h -+ -+end CatalanOrdinaryZeta -+ -+end CatalanPNT -diff --git a/PrimeNumberTheoremAnd/Catalan/Wiener.lean b/PrimeNumberTheoremAnd/Catalan/Wiener.lean -new file mode 100644 -index 0000000..0a6b505 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Catalan/Wiener.lean -@@ -0,0 +1,582 @@ -+import PrimeNumberTheoremAnd.Catalan.WienerBounds -+ -+namespace CatalanPNT -+ -+open ZetaFivePNT -+ -+open _root_.Real BigOperators ArithmeticFunction MeasureTheory _root_.Filter Set FourierTransform LSeries -+ _root_.Asymptotics SchwartzMap -+open Complex hiding log -+open scoped Topology -+open scoped ContDiff -+open scoped ComplexConjugate -+ -+variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} -+ [RCLike 𝕜] -+ -+attribute [local gcongr] norm_lt_norm_of_nonneg -+ -+theorem limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := -+ limiting_cor_W21 ψ hf hcheby hG hG' -+ -+theorem fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by -+ refine ⟨𝓕⁻ f, ?_⟩ -+ exact FourierTransform.fourier_fourierInv_eq f -+ -+noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) -+ (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) := -+ h2.toSchwartzMap h1 -+ -+@[simp] theorem toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl -+ -+theorem comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ ∀ᶠ x in 𝓝 0, Ψ x = 0 := -+ notMem_tsupport_iff_eventuallyEq.mp (fun h => lt_irrefl 0 <| mem_Ioi.mp (hplus h)) -+ -+theorem comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ ∀ᶠ x in atBot, Ψ (exp x) = 0 := -+ Real.tendsto_exp_atBot <| comp_exp_support0 hplus -+ -+theorem comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : -+ ∀ᶠ (x : ℝ) in atTop, (Ψ ∘ rexp) x = 0 := by -+ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, -+ cocompact_eq_atBot_atTop] at hsupp -+ exact Real.tendsto_exp_atTop hsupp.2 -+ -+theorem comp_exp_support {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : HasCompactSupport (Ψ ∘ rexp) := by -+ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, -+ cocompact_eq_atBot_atTop] -+ exact ⟨comp_exp_support1 hplus, comp_exp_support2 hsupp⟩ -+ -+theorem wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) (x : ℝ) (hx : 0 < x) : -+ ∫ (u : ℝ) in Ioi (-Real.log x), ↑(rexp u) * Ψ (rexp u) = ∫ (y : ℝ) in Ioi (1 / x), Ψ y := by -+ have l1 : ContinuousOn rexp (Ici (-Real.log x)) := by fun_prop -+ have l2 : Tendsto rexp atTop atTop := Real.tendsto_exp_atTop -+ have l3 t (_ : t ∈ Ioi (-log x)) : HasDerivWithinAt rexp (rexp t) (Ioi t) t := -+ (Real.hasDerivAt_exp t).hasDerivWithinAt -+ have l4 : ContinuousOn Ψ (rexp '' Ioi (-Real.log x)) := by fun_prop -+ have l5 : IntegrableOn Ψ (rexp '' Ici (-Real.log x)) volume := -+ (l0.integrable_of_hasCompactSupport hsupp).integrableOn -+ have l6 : IntegrableOn (fun x ↦ rexp x • (Ψ ∘ rexp) x) (Ici (-Real.log x)) volume := by -+ refine (Continuous.integrable_of_hasCompactSupport (by fun_prop) ?_).integrableOn -+ change HasCompactSupport (rexp • (Ψ ∘ rexp)) -+ exact (comp_exp_support hsupp hplus).smul_left -+ have := MeasureTheory.integral_deriv_smul_comp_Ioi l1 l2 l3 l4 l5 l6 -+ simpa [Real.exp_neg, Real.exp_log hx] using this -+ -+theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ Tendsto (fun x ↦ (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ obtain ⟨ε, hε, hh⟩ := Metric.eventually_nhds_iff.mp <| comp_exp_support0 hplus -+ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eventually_gt_atTop ε⁻¹] with x hxε -+ have l1 : Integrable (indicator (Ioi x⁻¹) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi -+ have l2 : Integrable (indicator (Ioi 0) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi -+ simp_rw [← MeasureTheory.integral_indicator measurableSet_Ioi, ← mul_sub, ← integral_sub l1 l2] -+ simp only [mul_eq_zero, ofReal_eq_zero] -+ right -+ apply MeasureTheory.integral_eq_zero_of_ae -+ apply Eventually.of_forall -+ intro t -+ simp only [Pi.zero_apply] -+ have hε' : 0 < ε⁻¹ := by positivity -+ have hx : 0 < x := by linarith -+ have hx' : 0 < x⁻¹ := by positivity -+ have hεx : x⁻¹ < ε := (inv_lt_comm₀ hε hx).mp hxε -+ have l3 : Ioi 0 = Ioc 0 x⁻¹ ∪ Ioi x⁻¹ := by -+ ext t ; simp only [mem_Ioi, mem_union, mem_Ioc] ; constructor <;> intro h -+ · simp [h, le_or_gt] -+ · cases h with -+ | inl h => exact h.1 -+ | inr h => exact hx'.trans h -+ have l4 : Disjoint (Ioc 0 x⁻¹) (Ioi x⁻¹) := by simp -+ have l5 := Set.indicator_union_of_disjoint l4 Ψ -+ rw [l3, l5] -+ simp only -+ rw [add_comm, sub_add_cancel_left] -+ by_cases ht : t ∈ Ioc 0 x⁻¹ -+ · simp only [ht, indicator_of_mem, neg_eq_zero] -+ apply hh ; simp only [mem_Ioc, dist_zero_right, norm_eq_abs] at ht ⊢ -+ apply hεx.trans_le' -+ rw [abs_le] ; constructor <;> linarith -+ simp [ht] -+ -+theorem wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x - A * ∫ y in Set.Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ let h (x : ℝ) : ℂ := rexp (2 * π * x) * Ψ (exp (2 * π * x)) -+ have h1 : ContDiff ℝ ∞ h := by -+ have : ContDiff ℝ ∞ (fun x : ℝ => (rexp (2 * π * x))) := (contDiff_const.mul contDiff_id).exp -+ exact (contDiff_ofReal.comp this).mul (hsmooth.comp this) -+ have h2 : HasCompactSupport h := by -+ have hπ : 2 * π ≠ 0 := by simp [pi_ne_zero] -+ have hh : HasCompactSupport (fun x : ℝ => Ψ (rexp (2 * π * x))) := by -+ simpa only [Function.comp_def, smul_eq_mul] using -+ (comp_exp_support hsupp hplus).comp_smul hπ -+ change HasCompactSupport -+ ((fun x : ℝ => (rexp (2 * π * x) : ℂ)) * fun x : ℝ => Ψ (rexp (2 * π * x))) -+ exact hh.mul_left -+ obtain ⟨g, hg⟩ := fourier_surjection_on_schwartz (toSchwartz h h1 h2) -+ have l1 {y} (hy : 0 < y) : y * Ψ y = 𝓕 g (1 / (2 * π) * Real.log y) := by -+ rw [hg] -+ change (y : ℂ) * Ψ y = h (1 / (2 * π) * Real.log y) -+ have harg : 2 * π * (1 / (2 * π) * Real.log y) = Real.log y := by -+ rw [← mul_assoc, mul_one_div_cancel (mul_ne_zero (by norm_num) pi_ne_zero), one_mul] -+ dsimp only [h] -+ rw [harg, Real.exp_log hy] -+ have key := limiting_cor_schwartz g hf hcheby hG hG' -+ have l2 : ∀ᶠ x in atTop, ∑' (n : ℕ), f n / ↑n * 𝓕 g (1 / (2 * π) * Real.log (↑n / x)) = -+ ∑' (n : ℕ), f n * Ψ (↑n / x) / x := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ congr ; ext n -+ by_cases hn : n = 0 -+ · simp [hn, (comp_exp_support0 hplus).self_of_nhds] -+ rw [← l1 (by positivity)] -+ have : (n : ℂ) ≠ 0 := by simpa using hn -+ have : (x : ℂ) ≠ 0 := by simpa using hx.ne.symm -+ simp only [ofReal_div, ofReal_natCast] -+ field_simp -+ have l3 : ∀ᶠ x in atTop, ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 g (u / (2 * π)) = -+ ↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ congr 1 -+ rw [hg] -+ change (∫ u in Ici (-Real.log x), h (u / (2 * π))) = ∫ y in Ioi x⁻¹, Ψ y -+ dsimp only [h] -+ have hscale : (2 : ℝ) * π ≠ 0 := mul_ne_zero (by norm_num) pi_ne_zero -+ have harg (u : ℝ) : 2 * π * (u / (2 * π)) = u := mul_div_cancel₀ u hscale -+ simp_rw [harg] -+ rw [MeasureTheory.integral_Ici_eq_integral_Ioi] -+ simpa only [one_div] using wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx -+ have l4 : Tendsto (fun x => (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ exact wiener_ikehara_smooth_sub (hsmooth.continuous.integrable_of_hasCompactSupport hsupp) hplus -+ simpa [tsum_div_const] using (key.congr' <| EventuallyEq.sub l2 l3) |>.add l4 -+ -+theorem wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := -+ tendsto_sub_nhds_zero_iff.mp <| wiener_ikehara_smooth hf hcheby hG hG' hsmooth hsupp hplus -+ -+local instance coeRealFunctionComplex {E : Type*} : Coe (E → ℝ) (E → ℂ) := -+ ⟨fun f n => f n⟩ -+ -+@[norm_cast] -+theorem set_integral_ofReal {f : ℝ → ℝ} {s : Set ℝ} : ∫ x in s, (f x : ℂ) = ∫ x in s, f x := -+ integral_ofReal -+ -+theorem wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := by -+ let Ψ' := ofReal ∘ Ψ -+ have l1 : ContDiff ℝ ∞ Ψ' := contDiff_ofReal.comp hsmooth -+ have l2 : HasCompactSupport Ψ' := hsupp.comp_left rfl -+ have l3 : closure (Function.support Ψ') ⊆ Ioi 0 := by rwa [Function.support_comp_eq] ; simp -+ have key := (continuous_re.tendsto _).comp -+ (@wiener_ikehara_smooth' A Ψ G f hf hcheby hG hG' l1 l2 l3) -+ simp at key ; norm_cast at key -+ -+theorem interval_approx_inf (ha : 0 < a) (hab : a < b) : -+ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ -+ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ -+ ψ ≤ indicator (Ico a b) 1 ∧ b - a - ε ≤ ∫ y in Ioi 0, ψ y := by -+ have l1 : Iio ((b - a) / 3) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds <| by -+ rw [← sub_pos] at hab -+ positivity -+ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < (b - a) / 3) -+ have l2 : a < a + ε / 2 := by simp [hε] -+ have l3 : b - ε / 2 < b := by simp [hε] -+ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 -+ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ -+ · simp [h5, hab.ne, Icc_subset_Ioi_iff hab.le, ha] -+ · exact h4.trans <| indicator_le_indicator_of_subset Ioo_subset_Ico_self (by simp) -+ · have l4 : 0 ≤ b - a - ε := by linarith -+ have l5 : Icc (a + ε / 2) (b - ε / 2) ⊆ Ioi 0 := by -+ intro t ht -+ simp only [mem_Icc, mem_Ioi] at ht ⊢ -+ exact ha.trans <| l2.trans_le <| ht.1 -+ have l6 : Icc (a + ε / 2) (b - ε / 2) ∩ Ioi 0 = Icc (a + ε / 2) (b - ε / 2) := -+ inter_eq_left.mpr l5 -+ have l7 : ∫ y in Ioi 0, indicator (Icc (a + ε / 2) (b - ε / 2)) 1 y = b - a - ε := by -+ simp only [measurableSet_Icc, integral_indicator_one, measureReal_restrict_apply, l6, -+ volume_real_Icc] -+ convert max_eq_left l4 using 1 ; ring_nf -+ have l8 : IntegrableOn ψ (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ rw [← l7] ; apply setIntegral_mono ?_ l8 h3 -+ rw [IntegrableOn, integrable_indicator_iff measurableSet_Icc] -+ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self -+ apply integrableOn_const <;> -+ simp -+ -+theorem interval_approx_sup (ha : 0 < a) (hab : a < b) : -+ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ -+ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ -+ indicator (Ico a b) 1 ≤ ψ ∧ ∫ y in Ioi 0, ψ y ≤ b - a + ε := by -+ have l1 : Iio (a / 2) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds (by linarith) -+ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < a / 2) -+ have l2 : a - ε / 2 < a := by linarith -+ have l3 : b < b + ε / 2 := by linarith -+ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 -+ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ -+ · have l4 : a - ε / 2 < b + ε / 2 := by linarith -+ have l5 : ε / 2 < a := by linarith -+ simp [h5, l4.ne, Icc_subset_Ioi_iff l4.le, l5] -+ · apply le_trans ?_ h3 -+ apply indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp) -+ · have l4 : 0 ≤ b - a + ε := by linarith -+ have l5 : Ioo (a - ε / 2) (b + ε / 2) ⊆ Ioi 0 := by intro t ht ; simp at ht ⊢ ; linarith -+ have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := -+ inter_eq_left.mpr l5 -+ have l7 : ∫ y in Ioi 0, indicator (Ioo (a - ε / 2) (b + ε / 2)) 1 y = b - a + ε := by -+ simp only [measurableSet_Ioo, integral_indicator_one, measureReal_restrict_apply, l6, -+ volume_real_Ioo] -+ convert max_eq_left l4 using 1 ; ring_nf -+ have l8 : IntegrableOn ψ (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ rw [← l7] -+ refine setIntegral_mono l8 ?_ h4 -+ rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo] -+ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self -+ apply integrableOn_const <;> -+ simp -+ -+theorem WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : -+ Summable (fun n => f n * g (n / x)) := by -+ obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure -+ apply summable_of_hasFiniteSupport -+ unfold Function.HasFiniteSupport -+ simp only [Function.support_mul] ; apply Finite.inter_of_right ; rw [finite_iff_bddAbove] -+ exact ⟨Nat.ceil (M * x), fun i hi => by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ -+ -+theorem WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) -+ (hg₁ : HasCompactSupport g₁) (hg₂ : HasCompactSupport g₂) : -+ (∑' n, f n * g₁ (n / x)) / x ≤ (∑' n, f n * g₂ (n / x)) / x := by -+ apply div_le_div_of_nonneg_right ?_ hx.le -+ exact Summable.tsum_le_tsum (fun n => mul_le_mul_of_nonneg_left (hg _) (hf _)) -+ (WI_summable hg₁ hx) (WI_summable hg₂ hx) -+ -+theorem WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hb : 0 < b) (hxb : 2 / b < x) : -+ (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by -+ have hb' : 0 < 2 / b := by positivity -+ have hx : 0 < x := by linarith -+ have hxb' : 2 < x * b := (div_lt_iff₀ hb).mp hxb -+ have l1 (i : ℕ) (hi : i ∉ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) = 0 := by -+ simp_all [le_div_iff₀ hx] -+ have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : -+ f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by -+ rw [abs_eq_self.mpr (hpos _)] -+ convert_to _ ≤ f i * 1 -+ · ring -+ apply mul_le_mul_of_nonneg_left ?_ (hpos _) -+ by_cases hi : (i / x) ∈ (Ico a b) <;> simp [hi] -+ rw [tsum_eq_sum l1, div_le_iff₀ hx, mul_assoc, mul_assoc] -+ apply Finset.sum_le_sum l2 |>.trans -+ have := hcheby ⌈b * x⌉₊ ; simp only [norm_real, norm_eq_abs] at this ; apply this.trans -+ have : 0 ≤ C := by have := hcheby 1 ; simp only [cumsum, Finset.range_one, norm_real, -+ Finset.sum_singleton, Nat.cast_one, mul_one] at this ; exact (abs_nonneg _).trans this -+ refine mul_le_mul_of_nonneg_left ?_ this -+ apply (Nat.ceil_lt_add_one (by positivity)).le.trans -+ linarith -+ -+theorem WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hb : 0 < b) : -+ ∀ᶠ x : ℝ in atTop, (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by -+ filter_upwards [eventually_gt_atTop (2 / b)] with x hx using WI_sum_Iab_le hpos hcheby hb hx -+ -+theorem le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by -+ exact ge_of_tendsto -+ (show Tendsto (fun c : ℝ => c) (𝓝[>] b) (𝓝 b) from nhdsWithin_le_nhds) h -+ -+theorem ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by -+ exact le_of_tendsto -+ (show Tendsto (fun c : ℝ => c) (𝓝[<] b) (𝓝 b) from nhdsWithin_le_nhds) h -+ -+theorem WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : -+ Tendsto (fun c => c / A - (b - a)) (𝓝[>] (A * (b - a))) (𝓝[>] 0) := by -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨A * ε, by positivity, ?_⟩ -+ intro x hx1 hx2 -+ constructor -+ · simpa [lt_div_iff₀' hA] -+ · simp only [Real.dist_eq, dist_zero_right, Real.norm_eq_abs] at hx2 ⊢ -+ have : |x / A - (b - a)| = |x - A * (b - a)| / A := by -+ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp -+ rwa [this, div_lt_iff₀' hA] -+ -+theorem WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : -+ Tendsto (fun c => (b - a) - c / A) (𝓝[<] (A * (b - a))) (𝓝[>] 0) := by -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨A * ε, by positivity, ?_⟩ -+ intro x hx1 hx2 -+ constructor -+ · simpa [div_lt_iff₀' hA] -+ · simp only [Real.dist_eq, dist_zero_right, norm_eq_abs] at hx2 ⊢ -+ have : |(b - a) - x / A| = |A * (b - a) - x| / A := by -+ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp -+ rwa [this, div_lt_iff₀' hA, ← neg_sub, abs_neg] -+ -+theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : -+ 0 ≤ A := by -+ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x -+ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by -+ filter_upwards [eventually_ge_atTop 0] with x hx -+ exact div_nonneg (tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _))) hx -+ obtain ⟨ε, ψ, h1, h2, h3, h4, -⟩ := (interval_approx_sup zero_lt_one one_lt_two).exists -+ have key := @wiener_ikehara_smooth_real A G f ψ hf hcheby hG hG' h1 h2 h3 -+ have l2 : 0 ≤ ψ := by apply le_trans _ h4 ; apply indicator_nonneg ; simp -+ have l1 : ∀ᶠ x in atTop, 0 ≤ S ψ x := hSnonneg l2 -+ have l3 : 0 ≤ A * ∫ (y : ℝ) in Ioi 0, ψ y := ge_of_tendsto key l1 -+ have l4 : 0 < ∫ (y : ℝ) in Ioi 0, ψ y := by -+ have r1 : 0 ≤ᵐ[Measure.restrict volume (Ioi 0)] ψ := Eventually.of_forall l2 -+ have r2 : IntegrableOn (fun y ↦ ψ y) (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ have r3 : Ico 1 2 ⊆ Function.support ψ := by -+ intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith -+ have r4 : Ico 1 2 ⊆ Function.support ψ ∩ Ioi 0 := by -+ simp only [subset_inter_iff, r3, -+ true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith -+ have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by -+ convert volume.mono r4 ; norm_num -+ simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using zero_lt_one.trans_le r5 -+ have := div_nonneg l3 l4.le ; field_simp at this ; exact this -+ -+theorem WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) -+ atTop (nhds (A * (b - a))) := by -+ -+ by_cases hab : a = b -+ · simp [hab] -+ replace hb : a < b := lt_of_le_of_ne hb hab ; clear hab -+ -+ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x -+ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by -+ filter_upwards [eventually_ge_atTop 0] with x hx -+ refine div_nonneg ?_ hx -+ refine tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _)) -+ have hA : 0 ≤ A := residue_nonneg hpos hf hcheby hG hG' -+ -+ let Iab : ℝ → ℝ := indicator (Ico a b) 1 -+ change Tendsto (S Iab) atTop (𝓝 (A * (b - a))) -+ have hIab : HasCompactSupport Iab := by -+ simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc -+ have Iab_nonneg : ∀ᶠ x : ℝ in atTop, 0 ≤ S Iab x := hSnonneg (indicator_nonneg (by simp)) -+ have Iab2 : IsBoundedUnder (· ≤ ·) atTop (S Iab) := by -+ obtain ⟨C, hC⟩ := hcheby ; exact ⟨C * 2 * b, WI_sum_Iab_le' hpos hC (by linarith)⟩ -+ have Iab3 : IsBoundedUnder (· ≥ ·) atTop (S Iab) := ⟨0, Iab_nonneg⟩ -+ have Iab0 : IsCoboundedUnder (· ≥ ·) atTop (S Iab) := Iab2.isCoboundedUnder_ge -+ have Iab1 : IsCoboundedUnder (· ≤ ·) atTop (S Iab) := Iab3.isCoboundedUnder_le -+ -+ have sup_le : limsup (S Iab) atTop ≤ A * (b - a) := by -+ have l_sup : ∀ᶠ ε in 𝓝[>] 0, limsup (S Iab) atTop ≤ A * (b - a + ε) := by -+ filter_upwards [interval_approx_sup ha hb] with ε happrox -+ rcases happrox with ⟨ψ, h1, h2, h3, h4, h6⟩ -+ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 -+ have l6 : S Iab ≤ᶠ[atTop] S ψ := by -+ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h4 hx hIab h2 -+ have l5 : IsBoundedUnder (· ≤ ·) atTop (S ψ) := l1.isBoundedUnder_le -+ have l3 : limsup (S Iab) atTop ≤ limsup (S ψ) atTop := limsup_le_limsup l6 Iab1 l5 -+ apply l3.trans ; rw [l1.limsup_eq] ; gcongr -+ obtain rfl | h := eq_or_ne A 0 -+ · simpa using l_sup -+ apply le_of_eventually_nhdsWithin -+ have key : 0 < A := lt_of_le_of_ne hA h.symm -+ filter_upwards [WI_tendsto_aux a b key l_sup] with x hx -+ simpa [mul_div_cancel₀ _ h] using hx -+ -+ have le_inf : A * (b - a) ≤ liminf (S Iab) atTop := by -+ have l_inf : ∀ᶠ ε in 𝓝[>] 0, A * (b - a - ε) ≤ liminf (S Iab) atTop := by -+ filter_upwards [interval_approx_inf ha hb] with ε happrox -+ rcases happrox with ⟨ψ, h1, h2, h3, h5, h6⟩ -+ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 -+ have l2 : S ψ ≤ᶠ[atTop] S Iab := by -+ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h5 hx h2 hIab -+ have l4 : IsBoundedUnder (· ≥ ·) atTop (S ψ) := l1.isBoundedUnder_ge -+ have l3 : liminf (S ψ) atTop ≤ liminf (S Iab) atTop := liminf_le_liminf l2 l4 Iab0 -+ apply le_trans ?_ l3 ; rw [l1.liminf_eq] ; gcongr -+ obtain rfl | h := eq_or_ne A 0 -+ · simpa using l_inf -+ apply ge_of_eventually_nhdsWithin -+ have key : 0 < A := lt_of_le_of_ne hA h.symm -+ filter_upwards [WI_tendsto_aux' a b key l_inf] with x hx -+ simpa [mul_div_cancel₀ _ h] using hx -+ -+ have : liminf (S Iab) atTop ≤ limsup (S Iab) atTop := liminf_le_limsup Iab2 Iab3 -+ refine tendsto_of_liminf_eq_limsup ?_ ?_ Iab2 Iab3 <;> linarith -+ -+theorem le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by -+ rw [div_le_iff₀ hx, Nat.le_floor_iff] ; positivity -+ -+theorem lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by -+ rw [div_lt_iff₀ hx, Nat.lt_ceil] -+ -+theorem ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by -+ rw [le_div_iff₀ hx, Nat.ceil_le] -+ -+theorem mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : -+ n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by -+ rw [Finset.mem_Icc, mem_Icc, ceil_mul_le_iff hx, le_floor_mul_iff hb hx] -+ -+theorem mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by -+ rw [Finset.mem_Ico, mem_Ico, ceil_mul_le_iff hx, lt_ceil_mul_iff hx] -+ -+theorem tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : -+ ∑' n, f n * (indicator (Ico a b) 1 (n / x)) = ∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n := by -+ have l1 : ∀ n ∉ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n * indicator (Ico a b) 1 (↑n / x) = 0 := by -+ simp [mem_Ico_iff_div hx] ; tauto -+ rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only -+ [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] -+ -+theorem WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) -+ atTop (nhds (A * (b - a))) := by -+ apply (WienerIkeharaInterval hpos hf hcheby hG hG' ha hb).congr' -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ rw [tsum_indicator hx] -+ -+theorem WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) -+ atTop (nhds (A * (b - a))) := -+ WienerIkeharaInterval_discrete hpos hf hcheby hG hG' ha hb |>.comp tendsto_natCast_atTop_atTop -+ -+theorem tendsto_mul_ceil_div : -+ Tendsto (fun (p : ℝ × ℕ) => ⌈p.1 * p.2⌉₊ / (p.2 : ℝ)) (𝓝[>] 0 ×ˢ atTop) (𝓝 0) := by -+ rw [Metric.tendsto_nhds] ; intro δ hδ -+ have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := -+ inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) -+ have l2 : ∀ᶠ N : ℕ in atTop, 1 ≤ δ / 2 * N := by -+ apply Tendsto.eventually_ge_atTop -+ exact tendsto_natCast_atTop_atTop.const_mul_atTop (by positivity) -+ filter_upwards [l1.prod_mk l2] with p hp -+ rcases p with ⟨ε, N⟩ -+ rcases hp with ⟨⟨hε, h1⟩, h2⟩ -+ dsimp only at * -+ have l3 : 0 < (N : ℝ) := by -+ simp only [Nat.cast_pos, Nat.pos_iff_ne_zero] ; rintro rfl ; simp [zero_lt_one.not_ge] at h2 -+ have l5 : 0 ≤ ε * ↑N := by positivity -+ have l6 : ε * N ≤ δ / 2 * N := mul_le_mul h1.le le_rfl (by positivity) (by positivity) -+ simp only [dist_zero_right, norm_div, RCLike.norm_natCast, div_lt_iff₀ l3, gt_iff_lt] -+ convert (Nat.ceil_lt_add_one l5).trans_le (add_le_add l6 h2) using 1 ; ring -+ -+noncomputable def S (f : ℕ → 𝕜) (ε : ℝ) (N : ℕ) : 𝕜 := (∑ n ∈ Finset.Ico ⌈ε * N⌉₊ N, f n) / N -+ -+theorem S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : -+ S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by -+ have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by -+ simp_rw [Finset.range_eq_Ico] -+ symm -+ apply Finset.Ico_union_Ico_eq_Ico (Nat.zero_le _) -+ simp only [Nat.ceil_le] -+ exact mul_le_of_le_one_left N.cast_nonneg hε -+ have r2 : Disjoint (Finset.range ⌈ε * N⌉₊) (Finset.Ico ⌈ε * N⌉₊ N) := by -+ rw [Finset.range_eq_Ico] ; apply Finset.Ico_disjoint_Ico_consecutive -+ simp [S, r1, Finset.sum_union r2, cumsum, add_div] -+ -+theorem tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ TendstoUniformlyOnFilter (S f) (S f 0) (𝓝[>] 0) atTop := by -+ rw [Metric.tendstoUniformlyOnFilter_iff] ; intro δ hδ -+ obtain ⟨C, hC⟩ := hcheby -+ have l1 : ∀ᶠ (p : ℝ × ℕ) in 𝓝[>] 0 ×ˢ atTop, C * ⌈p.1 * p.2⌉₊ / p.2 < δ := by -+ have r1 := tendsto_mul_ceil_div.const_mul C -+ simp only [mul_div_assoc', mul_zero] at r1 ; exact r1 (Iio_mem_nhds hδ) -+ have : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) -+ filter_upwards [l1, Eventually.prod_inl this _] with p h1 h2 -+ rcases p with ⟨ε, N⟩ -+ have l2 : ‖cumsum f ⌈ε * ↑N⌉₊ / ↑N‖ ≤ C * ⌈ε * N⌉₊ / N := by -+ have r1 := hC ⌈ε * N⌉₊ -+ have r2 : 0 ≤ cumsum f ⌈ε * N⌉₊ := by apply cumsum_nonneg hpos -+ simp only [norm_real, norm_of_nonneg (hpos _), norm_div, -+ norm_of_nonneg r2, Real.norm_natCast] at r1 ⊢ -+ apply div_le_div_of_nonneg_right r1 (by positivity) -+ simpa [dist_eq_norm, ← S_sub_S h2.2] using l2.trans_lt h1 -+ -+theorem WienerIkeharaTheorem' {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := by -+ convert_to Tendsto (S f 0) atTop (𝓝 A) ; · ext N ; simp [S, cumsum] -+ apply (tendsto_S_S_zero hpos hcheby).tendsto_of_eventually_tendsto -+ · have L0 : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) -+ apply eventually_of_mem L0 -+ · intro ε hε -+ convert WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 using 1 -+ funext N -+ simp only [S, one_mul, Nat.ceil_natCast] -+ · have : Tendsto (fun ε : ℝ => ε) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds -+ simpa using (this.const_sub 1).const_mul A -+ -+theorem vonMangoldt_cheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := by -+ use Real.log 4 + 4 -+ intro N -+ by_cases! h : N = 0 -+ · simp [h, cumsum] -+ simp only [cumsum, norm_real, norm_eq_abs] -+ rw [Nat.range_eq_Icc_zero_sub_one _ h, (by simp : N - 1 = ⌊(N : ℝ) - 1⌋₊)] -+ simp_rw [abs_of_nonneg vonMangoldt_nonneg] -+ rw [← Chebyshev.psi_eq_sum_Icc] -+ grw [Chebyshev.psi_le_const_mul_self <| sub_nonneg_of_le <| Nat.one_le_cast_iff_ne_zero.mpr h] -+ gcongr -+ linarith -+ -+theorem WeakPNT : Tendsto (fun N ↦ cumsum Λ N / N) atTop (𝓝 1) := by -+ let F : ℂ → ℂ := CatalanOrdinaryZeta.vonMangoldtAux -+ have l1 (n : ℕ) : 0 ≤ Λ n := vonMangoldt_nonneg -+ have l2 s (hs : 1 < s.re) : F s = LSeries Λ s - 1 / (s - 1) := by -+ exact CatalanOrdinaryZeta.eqOn_vonMangoldtAux hs -+ have l3 : ContinuousOn F {s | 1 ≤ s.re} := -+ CatalanOrdinaryZeta.continuousOn_vonMangoldtAux -+ have l4 : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := vonMangoldt_cheby -+ have l5 (σ' : ℝ) (hσ' : 1 < σ') : Summable (nterm Λ σ') := by -+ simpa only [← nterm_eq_norm_term] -+ using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm -+ apply WienerIkeharaTheorem' l1 l5 l4 l3 l2 -+ -+end CatalanPNT -diff --git a/PrimeNumberTheoremAnd/Catalan/WienerBounds.lean b/PrimeNumberTheoremAnd/Catalan/WienerBounds.lean -new file mode 100644 -index 0000000..06122cf ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Catalan/WienerBounds.lean -@@ -0,0 +1,582 @@ -+import PrimeNumberTheoremAnd.Catalan.WienerLimits -+ -+namespace CatalanPNT -+ -+open ZetaFivePNT -+ -+open _root_.Real BigOperators ArithmeticFunction MeasureTheory _root_.Filter Set FourierTransform LSeries -+ _root_.Asymptotics SchwartzMap -+open Complex hiding log -+open scoped Topology -+open scoped ContDiff -+open scoped ComplexConjugate -+ -+variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} -+ [RCLike 𝕜] -+ -+attribute [local gcongr] norm_lt_norm_of_nonneg -+ -+theorem smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, -+ (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ -+ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 := by -+ obtain ⟨ψ, l1, l2, l3, l4, -⟩ := smooth_urysohn_support_Ioo h1 h3 -+ refine ⟨ψ, l1, l2, l3, l4⟩ -+ -+noncomputable def compactTruncation : trunc := by -+ choose ψ h1 h2 h3 h4 using smooth_urysohn (-2) (-1) (1) (2) (by linarith) (by linarith) -+ exact ⟨⟨ψ, h1.of_le (by norm_cast), h2⟩, h3, h4⟩ -+ -+theorem one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by -+ cases n with -+ | zero => simp -+ | succ n => -+ cases n with -+ | zero => simp -+ | succ n => norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith -+ -+noncomputable def pp (a x : ℝ) : ℝ := a ^ 2 * (x + 1) ^ 2 + (1 - a) * (1 + a) -+ -+noncomputable def pp' (a x : ℝ) : ℝ := a ^ 2 * (2 * (x + 1)) -+ -+theorem pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by -+ simp only [pp] -+ have : 0 < 1 - a := by linarith [ha.2] -+ have : 0 < 1 + a := by linarith [ha.1] -+ positivity -+ -+theorem pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by -+ unfold pp pp' -+ simpa using hasDerivAt_id x |>.add_const 1 |>.pow 2 |>.const_mul _ -+ -+theorem pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by -+ ext x ; exact pp_deriv a x |>.deriv -+ -+theorem pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by -+ change HasDerivAt (fun y : ℝ => a ^ 2 * (2 * (y + 1))) (a ^ 2 * 2) x -+ convert hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) -+ using 1 <;> first | rfl | ring -+ -+theorem pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by -+ ext x ; exact pp'_deriv a x |>.deriv -+ -+noncomputable def hh (a t : ℝ) : ℝ := (t * (1 + (a * log t) ^ 2))⁻¹ -+ -+noncomputable def hh' (a t : ℝ) : ℝ := - pp a (log t) * hh a t ^ 2 -+ -+theorem hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity -+ -+theorem hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by -+ by_cases h0 : t = 0 -+ · simp [hh, h0] -+ replace ht : 0 < t := lt_of_le_of_ne ht (by tauto) -+ unfold hh -+ rw [abs_inv, inv_le_inv₀ (by positivity) ht, abs_mul, abs_eq_self.mpr ht.le] -+ convert_to t * 1 ≤ _ -+ · simp -+ apply mul_le_mul le_rfl ?_ zero_le_one ht.le -+ rw [abs_eq_self.mpr (by positivity)] -+ simp only [le_add_iff_nonneg_right] -+ positivity -+ -+theorem hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by -+ have e1 : t * (1 + (a * log t) ^ 2) ≠ 0 := mul_ne_zero ht (_root_.ne_of_lt (by positivity)).symm -+ have l5 : HasDerivAt (fun t : ℝ => log t) t⁻¹ t := Real.hasDerivAt_log ht -+ have l4 : HasDerivAt (fun t : ℝ => a * log t) (a * t⁻¹) t := l5.const_mul _ -+ have l3 : HasDerivAt (fun t : ℝ => (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := by -+ convert l4.pow 2 using 1 ; ring -+ have l2 : HasDerivAt (fun t : ℝ => 1 + (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := -+ l3.const_add _ -+ have l1 : HasDerivAt (fun t : ℝ => t * (1 + (a * log t) ^ 2)) -+ (1 + 2 * a ^ 2 * log t + a ^ 2 * log t ^ 2) t := by -+ convert (hasDerivAt_id' t).mul l2 using 1; field_simp; ring -+ apply (l1.inv e1).congr_deriv -+ dsimp only [hh', pp, hh] -+ simp only [div_eq_mul_inv, inv_pow] -+ ring -+ -+theorem hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := -+ fun t (ht : 0 < t) => (hh_deriv a ht.ne.symm).continuousAt.continuousWithinAt -+ -+theorem hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by -+ have := pp_pos ha (log x) -+ simp only [hh', neg_mul, Left.neg_nonpos_iff, ge_iff_le] -+ positivity -+ -+theorem hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by -+ have l1 x (hx : x ∈ interior (Ioi 0)) : -+ HasDerivWithinAt (hh a) (hh' a x) (interior (Ioi 0)) x := by -+ have : x ≠ 0 := by contrapose! hx ; simp [hx] -+ exact (hh_deriv a this).hasDerivWithinAt -+ apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) (hh_continuous _) l1 -+ (fun x _ => hh'_nonpos ha) -+ -+noncomputable def gg (x i : ℝ) : ℝ := 1 / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ -+ -+theorem gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by -+ simp only [gg, hh] -+ field_simp -+ -+theorem gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by -+ simp only [gg_of_hh hx.ne.symm, one_div, mul_inv_rev, abs_mul] -+ apply mul_le_mul le_rfl (hh_le _ _ (by positivity)) (by positivity) (by positivity) |>.trans -+ (le_of_eq ?_) -+ simp [abs_inv, abs_eq_self.mpr hx.le] ; field_simp -+ -+theorem gg_le_one (i : ℕ) : gg x i ≤ 1 := by -+ by_cases hi : i = 0 <;> simp only [gg, hi, CharP.cast_eq_zero, div_zero, one_div, mul_inv_rev, -+ zero_div, Real.log_zero, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, -+ add_zero, inv_one, mul_one, zero_le_one] -+ have l1 : 1 ≤ (i : ℝ) := by simp ; omega -+ have l2 : 1 ≤ 1 + (π⁻¹ * 2⁻¹ * Real.log (↑i / x)) ^ 2 := by -+ simp only [le_add_iff_nonneg_right] ; positivity -+ rw [← mul_inv] ; apply inv_le_one_of_one_le₀ ; simpa using mul_le_mul l1 l2 zero_le_one (by simp) -+ -+theorem one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by -+ constructor -+ · trans 0 -+ · linarith -+ · positivity -+ · rw [div_lt_iff₀ (by positivity)] -+ convert_to 1 * 1 < 2 * π -+ · simp -+ · simp -+ apply mul_lt_mul one_lt_two ?_ zero_lt_one zero_le_two -+ trans 2 -+ · exact one_le_two -+ · exact two_le_pi -+ -+theorem cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ ∑ i ∈ Finset.range n, f i * g i ≤ g (n - 1) * (C * n) + (C * (↑(n - 1 - 1) + 1) * g 0 -+ - C * (↑(n - 1 - 1) + 1) * g (n - 1) - -+ ((n - 1 - 1) • (C * g 0) - ∑ x ∈ Finset.range (n - 1 - 1), C * g (x + 1))) := by -+ have l1 (n : ℕ) : -+ (g n - g (n + 1)) * ∑ i ∈ Finset.range (n + 1), f i ≤ (g n - g (n + 1)) * (C * (n + 1)) := by -+ apply mul_le_mul le_rfl (by simpa only [cumsum, Nat.cast_add, Nat.cast_one] using hf' (n + 1)) -+ (Finset.sum_nonneg (fun i _ => hf i)) ?_ -+ simp only [sub_nonneg] ; apply hg' ; simp -+ have l2 (x : ℕ) : C * (↑(x + 1) + 1) - C * (↑x + 1) = C := by simp ; ring -+ have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun i _ => hf i) -+ convert_to ∑ i ∈ Finset.range n, (g i) • (f i) ≤ _ -+ · simp [mul_comm] -+ rw [Finset.sum_range_by_parts, sub_eq_add_neg, ← Finset.sum_neg_distrib] -+ simp_rw [← neg_smul, neg_sub, smul_eq_mul] -+ apply _root_.add_le_add -+ · exact mul_le_mul le_rfl (hf' n) (l3 n) (hg _) -+ · apply Finset.sum_le_sum (fun n _ => l1 n) |>.trans -+ convert_to ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ -+ · congr ; ext i ; simp ; ring -+ rw [Finset.sum_range_by_parts] -+ simp_rw [Finset.sum_range_sub', l2, smul_sub, smul_eq_mul, Finset.sum_sub_distrib, -+ Finset.sum_const, Finset.card_range] -+ apply le_of_eq ; ring_nf -+ -+theorem sum_range_succ (a : ℕ → ℝ) (n : ℕ) : -+ ∑ i ∈ Finset.range n, a (i + 1) = (∑ i ∈ Finset.range (n + 1), a i) - a 0 := by -+ have := Finset.sum_range_sub a n -+ rw [Finset.sum_sub_distrib, sub_eq_iff_eq_add] at this -+ rw [Finset.sum_range_succ, this] ; ring -+ -+theorem cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ ∑ i ∈ Finset.range n, f i * g i ≤ -+ C * n * g (n - 1) -+ + C * cumsum g (n - 1 - 1 + 1) -+ - C * (↑(n - 1 - 1) + 1) * g (n - 1) -+ := by -+ have := cancel_aux hf hg hf' hg' n -+ simp only [nsmul_eq_mul, ← Finset.mul_sum, sum_range_succ] at this -+ convert this using 1 ; unfold cumsum ; ring -+ -+theorem cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) (hn : 2 ≤ n) : -+ cumsum (f * g) n ≤ C * cumsum g n := by -+ change (∑ i ∈ Finset.range n, f i * g i) ≤ C * cumsum g n -+ refine (cancel_aux' hf hg hf' hg' n).trans_eq ?_ -+ have hindex : n - 1 - 1 + 1 = n - 1 := by omega -+ have hcast : (n : ℝ) = ↑(n - 1) + 1 := by -+ exact_mod_cast (show n = (n - 1) + 1 by omega) -+ have hcast' : (↑(n - 1 - 1) : ℝ) + 1 = ↑(n - 1) := by -+ exact_mod_cast hindex -+ have hsum : cumsum g n = cumsum g (n - 1) + g (n - 1) := by -+ conv_lhs => rw [show n = (n - 1) + 1 by omega] -+ exact cumsum_succ (n - 1) -+ rw [hindex, hcast', hcast, hsum] -+ ring -+ -+theorem cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ cumsum (f * g) n ≤ C * cumsum g n := by -+ cases n with -+ | zero => simp [cumsum] -+ | succ n => -+ cases n with -+ | zero => -+ have hC : 0 ≤ C := by simpa [cumsum, hf0] using hf' 1 -+ simpa [cumsum, hf0] using mul_nonneg hC (hg 0) -+ | succ n => exact cancel_main hf hg hf' hg' (n + 2) (by omega) -+ -+theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneOn f (Ioc x₀ (x₀ + n))) -+ (hfi : IntegrableOn f (Icc x₀ (x₀ + n))) : -+ (∑ i ∈ Finset.range n, f (x₀ + ↑(i + 1))) ≤ ∫ x in x₀..x₀ + n, f x := by -+ cases n with simp only [Nat.cast_add, Nat.cast_one, CharP.cast_eq_zero, add_zero, -+ lt_self_iff_false, not_false_eq_true, -+ Ioc_eq_empty, Finset.range_zero, Nat.cast_add, Nat.cast_one, Finset.sum_empty, -+ intervalIntegral.integral_same, le_refl] at hf ⊢ -+ | succ n => -+ have : Finset.range (n + 1) = {0} ∪ Finset.Ico 1 (n + 1) := by -+ ext i ; by_cases hi : i = 0 <;> simp [hi] ; omega -+ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, -+ lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, and_true, not_false_eq_true, -+ Finset.sum_insert, CharP.cast_eq_zero, zero_add, ge_iff_le] -+ have l4 : IntervalIntegrable f volume x₀ (x₀ + 1) := by -+ apply IntegrableOn.intervalIntegrable -+ simp only [le_add_iff_nonneg_right, zero_le_one, uIcc_of_le] -+ apply hfi.mono_set -+ apply Icc_subset_Icc le_rfl -+ simp -+ have l5 x (hx : x ∈ Ioc x₀ (x₀ + 1)) : (fun x ↦ f (x₀ + 1)) x ≤ f x := by -+ rcases hx with ⟨hx1, hx2⟩ -+ refine hf ⟨hx1, by linarith⟩ ⟨by linarith, by linarith⟩ hx2 -+ have l6 : ∫ x in x₀..x₀ + 1, f (x₀ + 1) = f (x₀ + 1) := by simp -+ have l1 : f (x₀ + 1) ≤ ∫ x in x₀..x₀ + 1, f x := by -+ rw [← l6] -+ apply intervalIntegral.integral_mono_on_of_le_Ioo (by linarith) (by simp) l4 -+ intro x hx -+ exact l5 x ⟨hx.1, hx.2.le⟩ -+ have l2 : AntitoneOn (fun x ↦ f (x₀ + x)) (Icc 1 ↑(n + 1)) := by -+ intro u hu v hv huv -+ have hu1 := hu.1 -+ have hv2 := hv.2 -+ push_cast at hv2 -+ refine hf ⟨?_, ?_⟩ ⟨?_, ?_⟩ ?_ <;> linarith -+ have l3 := @AntitoneOn.sum_le_integral_Ico 1 (n + 1) (fun x => f (x₀ + x)) (by simp) -+ (by simpa using l2) -+ simp only [Nat.cast_add, Nat.cast_one, intervalIntegral.integral_comp_add_left] at l3 -+ convert _root_.add_le_add l1 l3 -+ have := @intervalIntegral.integral_comp_mul_add ℝ _ _ 1 (n + 1) 1 f one_ne_zero x₀ -+ rw [intervalIntegral.integral_add_adjacent_intervals] -+ · exact l4 -+ · apply IntegrableOn.intervalIntegrable -+ simp only [add_le_add_iff_left, le_add_iff_nonneg_left, Nat.cast_nonneg, uIcc_of_le] -+ apply hfi.mono_set -+ apply Icc_subset_Icc -+ · linarith -+ · simp -+ -+theorem hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ (IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0)) ∧ -+ (∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π) := by -+ rw [integrableOn_Ici_iff_integrableOn_Ioi] -+ simp only [hh] -+ let g (x : ℝ) := (a * c / b) * Real.arctan (b * log (x / c)) -+ let g₀ (x : ℝ) := if x = 0 then ((a * c / b) * (- (π / 2))) else g x -+ let g' (x : ℝ) := a * (x / c * (1 + (b * Real.log (x / c)) ^ 2))⁻¹ -+ have l3 (x) (hx : 0 < x) : HasDerivAt Real.log x⁻¹ x := by apply Real.hasDerivAt_log (by linarith) -+ have l4 (x) : HasDerivAt (fun t => t / c) (1 / c) x := (hasDerivAt_id x).div_const c -+ have l2 (x) (hx : 0 < x) : HasDerivAt (fun t => log (t / c)) x⁻¹ x := by -+ have hcomp := (l3 (x / c) (by positivity)).comp x (l4 x) -+ convert hcomp using 1 -+ · rfl -+ · field_simp [hc.ne', hx.ne'] -+ have l5 (x) (hx : 0 < x) := (l2 x hx).const_mul b -+ have l1 (x) (hx : 0 < x) := (l5 x hx).arctan -+ have l6 (x) (hx : 0 < x) : HasDerivAt g (g' x) x := by -+ convert (l1 x hx).const_mul (a * c / b) using 1 -+ simp only [g'] -+ field_simp -+ have key (x) (hx : 0 < x) : HasDerivAt g₀ (g' x) x := by -+ apply (l6 x hx).congr_of_eventuallyEq -+ apply eventually_of_mem <| Ioi_mem_nhds hx -+ intro y (hy : 0 < y) -+ simp [g₀, hy.ne.symm] -+ have k1 : Tendsto g₀ atTop (𝓝 ((a * c / b) * (π / 2))) := by -+ have : g =ᶠ[atTop] g₀ := by -+ apply eventually_of_mem (Ioi_mem_atTop 0) -+ intro y (hy : 0 < y) -+ simp [g₀, hy.ne.symm] -+ apply Tendsto.congr' this -+ apply Tendsto.const_mul -+ apply (tendsto_arctan_atTop.mono_right nhdsWithin_le_nhds).comp -+ apply Tendsto.const_mul_atTop hb -+ apply tendsto_log_atTop.comp -+ apply Tendsto.atTop_div_const hc -+ apply tendsto_id -+ have k2 : Tendsto g₀ (𝓝[>] 0) (𝓝 (g₀ 0)) := by -+ have : g =ᶠ[𝓝[>] 0] g₀ := by -+ apply eventually_of_mem self_mem_nhdsWithin -+ intro x (hx : 0 < x) ; simp [g₀, hx.ne.symm] -+ simp only [g₀] -+ apply Tendsto.congr' this -+ apply Tendsto.const_mul -+ apply (tendsto_arctan_atBot.mono_right nhdsWithin_le_nhds).comp -+ apply Tendsto.const_mul_atBot hb -+ apply tendsto_log_nhdsGT_zero.comp -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨c * ε, by positivity, fun x hx1 hx2 => ⟨?_, ?_⟩⟩ -+ · simp only [mem_Ioi] at hx1 ⊢ ; positivity -+ · simp only [dist_zero_right, norm_eq_abs, norm_div, abs_eq_self.mpr hc.le] at hx2 ⊢ -+ rwa [div_lt_iff₀ hc, mul_comm] -+ have k3 : ContinuousWithinAt g₀ (Ici 0) 0 := by -+ rw [Metric.continuousWithinAt_iff] -+ rw [Metric.tendsto_nhdsWithin_nhds] at k2 -+ intro ε hε -+ obtain ⟨δ, hδ, hδx⟩ := k2 ε hε -+ refine ⟨δ, hδ, ?_⟩ -+ intro x hx hdist -+ change 0 ≤ x at hx -+ rcases lt_or_eq_of_le hx with hx | hx -+ · exact hδx hx hdist -+ · subst x -+ simpa only [dist_self] using hε -+ have k4 : ∀ x ∈ Ioi 0, 0 ≤ g' x := by -+ intro x (hx : 0 < x) ; simp only [mul_inv_rev, inv_div, g'] ; positivity -+ constructor -+ · convert_to IntegrableOn g' _ -+ exact integrableOn_Ioi_deriv_of_nonneg k3 key k4 k1 -+ · have := integral_Ioi_of_hasDerivAt_of_nonneg k3 key k4 k1 -+ simp only [mul_inv_rev, inv_div, mul_neg, ↓reduceIte, sub_neg_eq_add, g', g₀] at this ⊢ -+ convert this using 1 ; field_simp ; ring -+ -+theorem hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0) := -+ hh_integrable_aux ha hb hc |>.1 -+ -+theorem hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ ∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π := -+ hh_integrable_aux ha hb hc |>.2 -+ -+theorem hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by -+ have := hh_integral (a := 1) (b := 1 / (2 * π)) (c := 1) -+ (by positivity) (by positivity) (by positivity) -+ convert this using 1 <;> simp ; ring -+ -+theorem bound_sum_log {C : ℝ} (hf0 : f 0 = 0) -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ -+ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by -+ let ggg (i : ℕ) : ℝ := if i = 0 then 1 else gg x i -+ have l0 : x ≠ 0 := by linarith -+ have l1 i : 0 ≤ ggg i := by by_cases hi : i = 0 <;> simp only [gg, one_div, mul_inv_rev, hi, -+ ↓reduceIte, zero_le_one, ggg] ; positivity -+ have l2 : Antitone ggg := by -+ intro i j hij ; by_cases hi : i = 0 <;> by_cases hj : j = 0 <;> simp only [hj, ↓reduceIte, hi, -+ le_refl, ggg] -+ · exact gg_le_one _ -+ · omega -+ · simp only [gg_of_hh l0] -+ gcongr -+ apply hh_antitone one_div_two_pi_mem_Ioo -+ · simp only [mem_Ioi] ; positivity -+ · simp only [mem_Ioi] ; positivity -+ · gcongr -+ have l3 : 0 ≤ C := by simpa [cumsum, hf0] using hf 1 -+ have l4 : 0 ≤ ∫ (t : ℝ) in Ioi 0, hh (π⁻¹ * 2⁻¹) t := -+ setIntegral_nonneg measurableSet_Ioi (fun x hx => hh_nonneg _ (LT.lt.le hx)) -+ have l5 {n : ℕ} : AntitoneOn (fun t ↦ x⁻¹ * hh (1 / (2 * π)) (t / x)) (Ioc 0 n) := by -+ intro u hu v hv huv -+ have hu1 := hu.1 -+ have hv1 := hv.1 -+ simp only -+ apply mul_le_mul le_rfl ?_ (hh_nonneg _ (by positivity)) (by positivity) -+ apply hh_antitone one_div_two_pi_mem_Ioo (by simp only [mem_Ioi] ; positivity) -+ (by simp only [mem_Ioi] ; positivity) -+ apply (div_le_div_iff_of_pos_right (by positivity)).mpr huv -+ have l6 {n : ℕ} : IntegrableOn (fun t ↦ x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (Icc 0 n) volume := by -+ apply IntegrableOn.mono_set -+ (hh_integrable (by positivity) (by positivity) (by positivity)) Icc_subset_Ici_self -+ apply Real.tsum_le_of_sum_range_le (fun n => by positivity) ; intro n -+ convert_to ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ -+ · congr ; ext i -+ by_cases hi : i = 0 -+ · simp [hi, hf0] -+ · simp only [gg, hi, ↓reduceIte, ggg] -+ field_simp -+ apply cancel_main' (fun _ => norm_nonneg _) (by simp [hf0]) l1 hf l2 n |>.trans -+ gcongr ; simp only [cumsum, gg_of_hh l0, one_div, mul_inv_rev, ggg] -+ by_cases hn : n = 0 -+ · simp only [hn, Finset.range_zero, Finset.sum_empty] ; positivity -+ replace hn : 0 < n := by omega -+ have : Finset.range n = {0} ∪ Finset.Ico 1 n := by -+ ext i ; simp ; by_cases hi : i = 0 <;> simp [hi, hn] ; omega -+ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, -+ false_and, not_false_eq_true, Finset.sum_insert, ↓reduceIte, add_le_add_iff_left, ge_iff_le] -+ convert_to ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ -+ · apply Finset.sum_congr rfl (fun i hi => ?_) -+ simp at hi -+ have : i ≠ 0 := by omega -+ simp [this] -+ simp_rw [Finset.sum_Ico_eq_sum_range, add_comm 1] -+ have := @sum_le_integral 0 (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (n - 1) -+ (by simpa using l5) (by simpa using l6) -+ simp only [zero_add] at this -+ apply this.trans -+ rw [@intervalIntegral.integral_comp_div ℝ _ _ 0 ↑(n - 1) x (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t)) l0] -+ simp only [zero_div, intervalIntegral.integral_const_mul, smul_eq_mul, ← mul_assoc, -+ mul_inv_cancel₀ l0, one_mul] -+ have : (0 : ℝ) ≤ ↑(n - 1) / x := by positivity -+ rw [intervalIntegral.intervalIntegral_eq_integral_uIoc] -+ simp only [this, ↓reduceIte, uIoc_of_le, smul_eq_mul, one_mul, ge_iff_le] -+ apply integral_mono_measure -+ · apply Measure.restrict_mono Ioc_subset_Ioi_self le_rfl -+ · apply eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) -+ intro x (hx : 0 < x) -+ apply hh_nonneg _ hx.le -+ · have h := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) -+ have h' := h.mono_set Ioi_subset_Ici_self -+ unfold IntegrableOn at h' -+ apply h'.congr -+ exact Eventually.of_forall (fun t => by simp) -+ -+theorem bound_sum_log0 {C : ℝ} -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ -+ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by -+ let f0 i := if i = 0 then 0 else f i -+ have l1 : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f0 k : ℂ)‖) n ≤ C * n) := by -+ intro n ; refine Finset.sum_le_sum (fun i _ => ?_) |>.trans (hf n) -+ by_cases hi : i = 0 <;> simp [hi, f0] -+ have l2 i : ‖f i‖ / i = ‖f0 i‖ / i := by by_cases hi : i = 0 <;> simp [hi, f0] -+ simp_rw [l2] ; apply bound_sum_log rfl l1 hx -+ -+theorem bound_sum_log' {C : ℝ} -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + 2 * π ^ 2) := by -+ simpa only [hh_integral'] using bound_sum_log0 hf hx -+ -+variable (f x) in -+theorem summable_fourier_aux (ψ : W21) (i : ℕ) : -+ ‖f i / i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (i / x))‖ ≤ -+ W21.norm ψ * (‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹) := by -+ convert mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) -+ (norm_nonneg (f i / i)) using 1 -+ · simp -+ · change _ = _ * (W21.norm ψ * _) -+ simp only [W21.norm, mul_inv_rev, one_div, Complex.norm_div, RCLike.norm_natCast] -+ ring -+ -+theorem summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by -+ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by -+ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) -+ have l6 := summable_fourier_aux x f ψ -+ exact Summable.of_nonneg_of_le (fun _ => norm_nonneg _) l6 -+ (by simpa using l5.const_smul (W21.norm ψ)) -+ -+theorem bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ -+ W21.norm ψ • ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ := by -+ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by -+ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) -+ have l6 := summable_fourier_aux x f ψ -+ have l1 : Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by -+ exact summable_fourier x hx ψ hcheby -+ apply (norm_tsum_le_tsum_norm l1).trans -+ change (∑' i, ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) -+ (1 / (2 * π) * Real.log (↑i / x))‖) ≤ W21.norm ψ * _ -+ rw [← tsum_mul_left] -+ exact Summable.tsum_mono l1 (l5.mul_left (W21.norm ψ)) l6 -+ -+theorem bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ -+ W21.norm ψ * C * (1 + 2 * π ^ 2) := by -+ apply bound_I1 x (by linarith) ψ ⟨_, hcheby⟩ |>.trans -+ rw [smul_eq_mul, mul_assoc] -+ apply mul_le_mul le_rfl (bound_sum_log' hcheby hx) ?_ W21.norm_nonneg -+ apply tsum_nonneg (fun i => by positivity) -+ -+theorem bound_I2 (x : ℝ) (ψ : W21) : -+ ‖∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ W21.norm ψ * (2 * π ^ 2) := by -+ have key a : ‖𝓕 (ψ : ℝ → ℂ) (a / (2 * π))‖ ≤ W21.norm ψ * (1 + (a / (2 * π)) ^ 2)⁻¹ := -+ decay_bounds_key ψ _ -+ have twopi : 0 ≤ 2 * π := by simp [pi_nonneg] -+ have l3 : Integrable (fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹) := -+ integrable_inv_one_add_sq.comp_div (by norm_num [pi_ne_zero]) -+ have l2 : IntegrableOn (fun i ↦ W21.norm ψ * (1 + (i / (2 * π)) ^ 2)⁻¹) (Ici (-Real.log x)) := by -+ exact (l3.const_mul _).integrableOn -+ have l1 : IntegrableOn (fun i ↦ ‖𝓕 (ψ : ℝ → ℂ) (i / (2 * π))‖) (Ici (-Real.log x)) := by -+ refine ((l3.const_mul (W21.norm ψ)).mono' ?_ ?_).integrableOn -+ · apply Continuous.aestronglyMeasurable ; fun_prop -+ · simp only [norm_norm, key] ; simp -+ have l5 : 0 ≤ᵐ[volume] fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹ := by -+ apply Eventually.of_forall ; intro x ; positivity -+ refine (norm_integral_le_integral_norm _).trans <| (setIntegral_mono l1 l2 key).trans ?_ -+ rw [integral_const_mul] ; gcongr -+ · apply W21.norm_nonneg -+ refine (setIntegral_le_integral l3 l5).trans ?_ -+ rw [Measure.integral_comp_div (fun x => (1 + x ^ 2)⁻¹) (2 * π)] -+ simp [abs_eq_self.mpr twopi] ; ring_nf ; rfl -+ -+theorem bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ -+ W21.norm ψ * (C * (1 + 2 * π ^ 2) + ‖A‖ * (2 * π ^ 2)) := by -+ have l1 := bound_I1' x hx ψ hcheby -+ have l2 := mul_le_mul (le_refl ‖A‖) (bound_I2 x ψ) (by positivity) (by positivity) -+ apply norm_sub_le _ _ |>.trans ; rw [norm_mul] -+ convert _root_.add_le_add l1 l2 using 1 ; ring -+ -+theorem limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by -+ -+ let S1 x (ψ : ℝ → ℂ) := ∑' (n : ℕ), f n / ↑n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑n / x)) -+ let S2 x (ψ : ℝ → ℂ) := ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) -+ let S x ψ := S1 x ψ - S2 x ψ ; change Tendsto (fun x ↦ S x ψ) atTop (𝓝 0) -+ -+ obtain g := compactTruncation -+ let Ψ R := g.scale R * ψ -+ have key R : Tendsto (fun x ↦ S x (Ψ R)) atTop (𝓝 0) := limiting_cor (Ψ R) hf hcheby hG hG' -+ -+ obtain ⟨C, hcheby⟩ := hcheby -+ have hC : 0 ≤ C := by -+ have : ‖f 0‖ ≤ C := by simpa [cumsum] using hcheby 1 -+ have : 0 ≤ ‖f 0‖ := by positivity -+ linarith -+ have key2 : Tendsto (fun R ↦ W21.norm (ψ - Ψ R)) atTop (𝓝 0) := W21_approximation ψ g -+ simp_rw [Metric.tendsto_nhds] at key key2 ⊢ ; intro ε hε -+ let M := C * (1 + 2 * π ^ 2) + ‖(A : ℂ)‖ * (2 * π ^ 2) -+ obtain ⟨R, hRψ⟩ := (key2 ((ε / 2) / (1 + M)) (by positivity)).exists -+ simp only [dist_zero_right, Real.norm_eq_abs, abs_eq_self.mpr W21.norm_nonneg] at hRψ key -+ -+ filter_upwards [eventually_ge_atTop 1, key R (ε / 2) (by positivity)] with x hx key -+ -+ have key3 : ‖S x (ψ - Ψ R)‖ < ε / 2 := by -+ have hbound := @bound_main f C A x hx (ψ - Ψ R) hcheby -+ change ‖S x (⇑ψ - ⇑(Ψ R))‖ ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * M at hbound -+ apply hbound.trans_lt -+ calc -+ W21.norm (⇑ψ - ⇑(Ψ R)) * M ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * (1 + M) := -+ mul_le_mul_of_nonneg_left (by linarith) W21.norm_nonneg -+ _ < ε / 2 := (lt_div_iff₀ (show 0 < 1 + M by positivity)).mp hRψ -+ -+ have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := -+ F_sub ψ.hf (Ψ R : W21).hf x -+ have S1_sub : S1 x (ψ - Ψ R) = S1 x ψ - S1 x (Ψ R) := by -+ simp only [one_div, mul_inv_rev, S1_sub_1, mul_sub, S1] ; apply Summable.tsum_sub -+ · have := summable_fourier x (by positivity) ψ ⟨_, hcheby⟩ -+ rw [summable_norm_iff] at this -+ simpa using this -+ · have hsum := summable_fourier x (by positivity) (Ψ R : W21) ⟨_, hcheby⟩ -+ rw [summable_norm_iff] at hsum -+ simpa only [W21.ofCS2, one_div, mul_inv_rev] using hsum -+ have S2_sub : S2 x (ψ - Ψ R) = S2 x ψ - S2 x (Ψ R) := by -+ simp only [S1_sub_1, S2] ; rw [integral_sub] -+ · ring -+ · exact CatalanPNT.W21.integrable_fourier ψ (by positivity) |>.restrict -+ · exact CatalanPNT.W21.integrable_fourier (Ψ R : W21) (by positivity) |>.restrict -+ have S_sub : S x (ψ - Ψ R) = S x ψ - S x (Ψ R) := by simp [S, S1_sub, S2_sub] ; ring -+ simpa [S_sub, Ψ] using norm_add_le _ _ |>.trans_lt (_root_.add_lt_add key3 key) -+ -+end CatalanPNT -diff --git a/PrimeNumberTheoremAnd/Catalan/WienerFourier.lean b/PrimeNumberTheoremAnd/Catalan/WienerFourier.lean -new file mode 100644 -index 0000000..491332b ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Catalan/WienerFourier.lean -@@ -0,0 +1,332 @@ -+import Mathlib.Analysis.Fourier.RiemannLebesgueLemma -+import Mathlib.Analysis.Normed.Group.Tannery -+import Mathlib.Analysis.SumIntegralComparisons -+import Mathlib.NumberTheory.Chebyshev -+import PrimeNumberTheoremAnd.Catalan.OrdinaryZetaContinuation -+import Mathlib.NumberTheory.MulChar.Lemmas -+import PrimeNumberTheoremAnd.ZetaFive.Fourier -+import PrimeNumberTheoremAnd.ZetaFive.SmoothExistence -+import Mathlib.Analysis.Convolution -+import Mathlib.MeasureTheory.Group.Circle -+ -+namespace CatalanPNT -+ -+open ZetaFivePNT -+ -+open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries -+ Asymptotics SchwartzMap -+open Complex hiding log -+open scoped Topology -+open scoped ContDiff -+open scoped ComplexConjugate -+ -+variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} -+ [RCLike 𝕜] -+ -+noncomputable -+def nterm (f : ℕ → ℂ) (σ' : ℝ) (n : ℕ) : ℝ := if n = 0 then 0 else ‖f n‖ / n ^ σ' -+ -+theorem nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by -+ by_cases h : n = 0 <;> simp [nterm, term, h] -+ -+theorem norm_term_eq_nterm_re (s : ℂ) : -+ ‖term f s n‖ = nterm f (s.re) n := by -+ simpa only [nterm] using LSeries.norm_term_eq f s n -+ -+theorem hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : -+ ∑' i, (‖term f σ' i‖₊ : ENNReal) ≠ ⊤ := by -+ simp_rw [ENNReal.tsum_coe_ne_top_iff_summable_coe, ← norm_toNNReal] -+ norm_cast -+ apply Summable.toNNReal -+ convert hf σ' hσ with i -+ simp [nterm_eq_norm_term] -+ -+attribute [fun_prop] Real.continuous_fourierChar -+ -+theorem first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ -+ (‖fourierChar (-(u * ((1 : ℝ) / ((2 : ℝ) * π) * (n / x).log))) • ψ u‖ₑ : ENNReal) := by -+ fun_prop -+ -+theorem first_fourier_aux2a : -+ (2 : ℂ) * π * -(y * (1 / (2 * π) * Real.log ((n) / x))) = -(y * ((n) / x).log) := by -+ calc -+ _ = -(y * (((2 : ℂ) * π) / (2 * π) * Real.log ((n) / x))) := by ring -+ _ = _ := by rw [div_self (by norm_num), one_mul] -+ -+theorem first_fourier_aux2 (hx : 0 < x) (n : ℕ) : -+ term f σ' n * 𝐞 (-(y * (1 / (2 * π) * Real.log (n / x)))) • ψ y = -+ term f (σ' + y * I) n • (ψ y * x ^ (y * I)) := by -+ by_cases hn : n = 0 -+ · simp [term, hn] -+ simp only [term, hn, ↓reduceIte] -+ calc -+ _ = (f n * (cexp ((2 * π * -(y * (1 / (2 * π) * Real.log (n / x)))) * I) / -+ ↑((n : ℝ) ^ σ'))) • ψ y := by -+ rw [Circle.smul_def, fourierChar_apply, ofReal_cpow (by norm_num)] -+ simp only [one_div, mul_inv_rev, mul_neg, ofReal_neg, ofReal_mul, ofReal_ofNat, ofReal_inv, -+ neg_mul, smul_eq_mul, ofReal_natCast] -+ ring -+ _ = (f n * (x ^ (y * I) / n ^ (σ' + y * I))) • ψ y := by -+ congr 2 -+ have l1 : 0 < (n : ℝ) := by simpa using Nat.pos_iff_ne_zero.mpr hn -+ have l2 : (x : ℂ) ≠ 0 := by simp [hx.ne.symm] -+ have l3 : (n : ℂ) ≠ 0 := by simp [hn] -+ rw [Real.rpow_def_of_pos l1, Complex.cpow_def_of_ne_zero l2, Complex.cpow_def_of_ne_zero l3] -+ push_cast -+ simp_rw [← Complex.exp_sub] -+ congr 1 -+ rw [first_fourier_aux2a, Real.log_div l1.ne.symm hx.ne.symm] -+ push_cast -+ rw [Complex.ofReal_log hx.le] -+ ring -+ _ = _ := by simp ; group -+ -+theorem first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hsupp : Integrable ψ) (hx : 0 < x) (hσ : 1 < σ') : -+ ∑' n : ℕ, term f σ' n * (𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))) = -+ ∫ t : ℝ, LSeries f (σ' + t * I) * ψ t * x ^ (t * I) := by -+ calc -+ _ = ∑' n, term f σ' n * ∫ (v : ℝ), 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ simp only [Real.fourier_eq] -+ simp only [one_div, mul_inv_rev, RCLike.inner_apply', conj_trivial] -+ _ = ∑' n, ∫ (v : ℝ), term f σ' n * 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ simp [integral_const_mul] -+ _ = ∫ (v : ℝ), ∑' n, term f σ' n * 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ refine (integral_tsum ?_ ?_).symm -+ · refine fun _ ↦ AEMeasurable.aestronglyMeasurable ?_ -+ have := hsupp.aemeasurable -+ fun_prop -+ · simp only [enorm_mul] -+ simp_rw [lintegral_const_mul'' _ (first_fourier_aux1 hsupp.aemeasurable _)] -+ calc -+ _ = (∑' (i : ℕ), ‖term f σ' i‖ₑ) * ∫⁻ (a : ℝ), ‖ψ a‖ₑ ∂volume := by -+ simp [ENNReal.tsum_mul_right, enorm_eq_nnnorm] -+ _ ≠ ⊤ := ENNReal.mul_ne_top (hf_coe1 hf hσ) -+ (ne_top_of_lt hsupp.2) -+ _ = _ := by -+ congr 1; ext y -+ simp_rw [mul_assoc (LSeries _ _), ← smul_eq_mul (a := (LSeries _ _)), LSeries] -+ rw [← Summable.tsum_smul_const] -+ · simp_rw [first_fourier_aux2 hx] -+ · apply Summable.of_norm -+ convert hf σ' hσ with n -+ rw [norm_term_eq_nterm_re] -+ simp -+ -+@[continuity] -+theorem continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ -+ -+attribute [fun_prop] measurable_coe_nnreal_ennreal -+ -+theorem second_fourier_integrable_aux1a (hσ : 1 < σ') : -+ IntegrableOn (fun (x : ℝ) ↦ cexp (-((x : ℂ) * ((σ' : ℂ) - 1)))) (Ici (-Real.log x)) := by -+ norm_cast -+ suffices IntegrableOn (fun (x : ℝ) ↦ (rexp (-(x * (σ' - 1))))) (Ici (-x.log)) _ from this.ofReal -+ simp_rw [fun (a x : ℝ) ↦ (by ring : -(x * a) = -a * x)] -+ rw [integrableOn_Ici_iff_integrableOn_Ioi] -+ apply exp_neg_integrableOn_Ioi -+ linarith -+ -+theorem second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : -+ let ν : Measure (ℝ × ℝ) := (volume.restrict (Ici (-Real.log x))).prod volume -+ Integrable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • -+ (𝐞 (Multiplicative.ofAdd (-(a * (u / (2 * π))))) : ℂ) • ψ a) ν := by -+ intro ν -+ constructor -+ · apply Measurable.aestronglyMeasurable -+ change Measurable (fun p : ℝ × ℝ => -+ (rexp (-p.1 * (σ' - 1)) : ℂ) * -+ ((fourierChar (-(p.2 * (p.1 / (2 * π)))) : ℂ) * ψ p.2)) -+ fun_prop -+ · let f1 : ℝ → ENNReal := fun a1 ↦ ‖cexp (-(↑a1 * (↑σ' - 1)))‖ₑ -+ let f2 : ℝ → ENNReal := fun a2 ↦ ‖ψ a2‖ₑ -+ suffices ∫⁻ (a : ℝ × ℝ), f1 a.1 * f2 a.2 ∂ν < ⊤ by -+ simpa [hasFiniteIntegral_iff_enorm, enorm_eq_nnnorm, Function.uncurry] -+ refine (lintegral_prod_mul ?_ ?_).trans_lt ?_ <;> try fun_prop -+ exact ENNReal.mul_lt_top (second_fourier_integrable_aux1a hσ).2 hsupp.2 -+ -+theorem second_fourier_integrable_aux2 (hσ : 1 < σ') : -+ IntegrableOn (fun (u : ℝ) ↦ cexp ((1 - ↑σ' - ↑t * I) * ↑u)) (Ioi (-Real.log x)) := by -+ refine (integrable_norm_iff (Measurable.aestronglyMeasurable <| by fun_prop)).mp ?_ -+ suffices IntegrableOn (fun a ↦ rexp (-(σ' - 1) * a)) (Ioi (-x.log)) _ by simpa [Complex.norm_exp] -+ apply exp_neg_integrableOn_Ioi -+ linarith -+ -+theorem second_fourier_aux (hx : 0 < x) : -+ -(cexp (-((1 - ↑σ' - ↑t * I) * ↑(Real.log x))) / (1 - ↑σ' - ↑t * I)) = -+ ↑(x ^ (σ' - 1)) * (↑σ' + ↑t * I - 1)⁻¹ * ↑x ^ (↑t * I) := by -+ calc -+ _ = cexp (↑(Real.log x) * ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [← div_neg]; ring_nf -+ _ = (x ^ ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr (ne_of_gt hx)), Complex.ofReal_log hx.le] -+ _ = (x ^ ((σ' : ℂ) - 1)) * (x ^ (↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [Complex.cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt hx))] -+ _ = _ := by rw [ofReal_cpow hx.le]; push_cast; ring -+ -+theorem second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) -+ {x σ' : ℝ} (hx : 0 < x) (hσ : 1 < σ') : -+ ∫ u in Ici (-log x), Real.exp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -+ (x^(σ' - 1) : ℝ) * ∫ t, (1 / (σ' + t * I - 1)) * ψ t * x^(t * I) ∂ volume := by -+ conv in ↑(rexp _) * _ => { rw [Real.fourier_real_eq, ← smul_eq_mul, ← integral_smul] } -+ rw [MeasureTheory.integral_integral_swap] -+ swap -+ · exact second_fourier_integrable_aux1 hcont hsupp hσ -+ rw [← integral_const_mul] -+ congr 1; ext t -+ simp_rw [Circle.smul_def, smul_eq_mul, Real.fourierChar_apply, -+ ← mul_assoc, integral_mul_const] -+ rw [mul_right_comm _ (ψ t) _] -+ congr 1 -+ push_cast -+ simp_rw [← Complex.exp_add] -+ have (u : ℝ) : -+ -↑u * (↑σ' - 1) + 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I = (1 - σ' - t * I) * u := calc -+ _ = -↑u * (↑σ' - 1) + (2 * ↑π) / (2 * ↑π) * -(↑t * ↑u) * I := by ring -+ _ = -↑u * (↑σ' - 1) + 1 * -(↑t * ↑u) * I := by rw [div_self (by norm_num)] -+ _ = _ := by ring -+ simp_rw [this] -+ let c : ℂ := (1 - ↑σ' - ↑t * I) -+ have : c ≠ 0 := by simp [Complex.ext_iff, c, sub_ne_zero.mpr hσ.ne] -+ let f' (u : ℝ) := cexp (c * u) -+ let f := fun (u : ℝ) ↦ (f' u) / c -+ have hderiv : ∀ u ∈ Ici (-Real.log x), HasDerivAt f (f' u) u := by -+ intro u _ -+ rw [show f' u = cexp (c * u) * (c * 1) / c by simp only [f']; field_simp] -+ exact (hasDerivAt_id' u).ofReal_comp.const_mul c |>.cexp.div_const c -+ have hf : Tendsto f atTop (𝓝 0) := by -+ apply tendsto_zero_iff_norm_tendsto_zero.mpr -+ suffices Tendsto (fun (x : ℝ) ↦ ‖cexp (c * ↑x)‖ / ‖c‖) atTop (𝓝 (0 / ‖c‖)) by -+ simpa [f, f'] using this -+ apply Filter.Tendsto.div_const -+ suffices Tendsto (· * (1 - σ')) atTop atBot by simpa [Complex.norm_exp, mul_comm (1 - σ'), c] -+ exact Tendsto.atTop_mul_const_of_neg (by linarith) fun ⦃s⦄ h ↦ h -+ rw [integral_Ici_eq_integral_Ioi, -+ integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (second_fourier_integrable_aux2 hσ) hf] -+ simpa [f, f'] using second_fourier_aux hx -+ -+theorem one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) -+ -+theorem decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by -+ have l1 : 0 < 1 + u ^ 2 := one_add_sq_pos _ -+ have l2 : 1 + u ^ 2 = ‖(1 : ℂ) + u ^ 2‖ := by -+ norm_cast ; simp only [Real.norm_eq_abs, abs_eq_self.2 l1.le] -+ have l3 : ‖1 / ((4 : ℂ) * ↑π ^ 2)‖ ≤ (4 * π ^ 2)⁻¹ := by simp -+ have key := fourierIntegral_self_add_deriv_deriv f u -+ simp only [Function.iterate_succ _ 1, Function.iterate_one, Function.comp_apply] at key -+ rw [F_sub f.hf (f.hf''.const_mul (1 / (4 * ↑π ^ 2)))] at key -+ rw [← div_eq_mul_inv, le_div_iff₀ l1, mul_comm, l2, ← norm_mul, key, sub_eq_add_neg] -+ apply norm_add_le _ _ |>.trans -+ change _ ≤ W21.norm _ -+ rw [norm_neg, F_mul, norm_mul, W21.norm] -+ gcongr <;> apply VectorFourier.norm_fourierIntegral_le_integral_norm -+ -+theorem decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) -+ (h : ∀ t, ‖f t‖ ≤ A * (1 + t ^ 2)⁻¹) : -+ ∫ t, ‖f t‖ ≤ π * A := by -+ have l1 : Integrable (fun x ↦ A * (1 + x ^ 2)⁻¹) := integrable_inv_one_add_sq.const_mul A -+ simp_rw [← integral_univ_inv_one_add_sq, mul_comm, ← integral_const_mul] -+ exact integral_mono (l1.mono' hf (Eventually.of_forall h)).norm l1 h -+ -+theorem decay_bounds_W21 (f : W21) (hA : ∀ t, ‖f t‖ ≤ A / (1 + t ^ 2)) -+ (hA' : ∀ t, ‖deriv (deriv f) t‖ ≤ A / (1 + t ^ 2)) (u) : -+ ‖𝓕 (f : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by -+ have l0 : 1 * (4 * π)⁻¹ * A = (4 * π ^ 2)⁻¹ * (π * A) := by field_simp -+ have l1 : ∫ (v : ℝ), ‖f v‖ ≤ π * A := by -+ apply decay_bounds_aux f.continuous.aestronglyMeasurable -+ simp_rw [← div_eq_mul_inv] ; exact hA -+ have l2 : ∫ (v : ℝ), ‖deriv (deriv f) v‖ ≤ π * A := by -+ apply decay_bounds_aux f.deriv.deriv.continuous.aestronglyMeasurable -+ simp_rw [← div_eq_mul_inv] ; exact hA' -+ apply decay_bounds_key f u |>.trans -+ change W21.norm _ * _ ≤ _ -+ simp_rw [W21.norm, div_eq_mul_inv, add_mul, l0] ; gcongr -+ -+theorem decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) -+ (hA' : ∀ t, ‖deriv^[2] ψ t‖ ≤ A / (1 + t ^ 2)) : -+ ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by -+ exact decay_bounds_W21 ψ hA hA' u -+ -+theorem decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by -+ have l1 : HasCompactSupport (fun u : ℝ => ((1 + u ^ 2) : ℝ) * ψ u) := by exact ψ.h2.mul_left -+ have := ψ.h1.continuous -+ obtain ⟨C, hC⟩ := l1.exists_bound_of_continuous (by fun_prop) -+ refine ⟨C, fun u => ?_⟩ -+ specialize hC u -+ simp only [norm_mul, Complex.norm_real, norm_of_nonneg (one_add_sq_pos u).le] at hC -+ rwa [le_div_iff₀' (one_add_sq_pos _)] -+ -+theorem decay_bounds_cor (ψ : W21) : -+ ∃ C : ℝ, ∀ u, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by -+ simpa only [div_eq_mul_inv] using ⟨_, decay_bounds_key ψ⟩ -+ -+@[continuity, fun_prop] theorem continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := -+ VectorFourier.fourierIntegral_continuous continuous_fourierChar -+ (by simp only [innerₗ_apply_apply, RCLike.inner_apply', conj_trivial, continuous_mul]) -+ ψ.hf -+ -+theorem W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : -+ Integrable fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c) := by -+ have l1 (C) : Integrable (fun u ↦ C / (1 + (u / c) ^ 2)) volume := by -+ simpa only [div_eq_mul_inv] using (integrable_inv_one_add_sq.comp_div hc).const_mul C -+ have l2 : AEStronglyMeasurable (fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c)) volume := by -+ apply Continuous.aestronglyMeasurable ; fun_prop -+ obtain ⟨C, h⟩ := decay_bounds_cor ψ -+ apply @Integrable.mono' ℝ ℂ _ volume _ _ (fun u => C / (1 + (u / c) ^ 2)) (l1 C) l2 ?_ -+ apply Eventually.of_forall (fun x => h _) -+ -+theorem continuous_LSeries_aux (hf : Summable (nterm f σ')) : -+ Continuous fun x : ℝ => LSeries f (σ' + x * I) := by -+ have l1 i : Continuous fun x : ℝ ↦ term f (σ' + x * I) i := by -+ by_cases h : i = 0 -+ · simpa [h] using continuous_const -+ · simpa [h] using continuous_const.div₀ (continuous_const.cpow (by fun_prop) (by simp [h])) -+ (fun x => by simp [h]) -+ have l2 n (x : ℝ) : ‖term f (σ' + x * I) n‖ = nterm f σ' n := by -+ simpa using norm_term_eq_nterm_re (f := f) (n := n) (σ' + x * I) -+ exact continuous_tsum l1 hf (fun n x => le_of_eq (l2 n x)) -+ -+theorem limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) (σ' : ℝ) -+ (hσ' : 1 < σ') : -+ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) -+ (u / (2 * π)) = ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by -+ have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 -+ have l3 : 0 < x := zero_lt_one.trans_le hx -+ have l1 (σ') (hσ' : 1 < σ') := first_fourier hf hint l3 hσ' -+ have l2 (σ') (hσ' : 1 < σ') := second_fourier ψ.h1.continuous.measurable hint l3 hσ' -+ have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := -+ continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [l3]) -+ have l6 : Continuous fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by -+ apply ((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8 -+ have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by -+ exact l6.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right -+ have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := by -+ intro h ; have := congr_arg Complex.re h ; simp at this ; linarith -+ have l7 : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * -+ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -+ simp only [one_div, ← mul_assoc] -+ refine ((continuous_const.mul <| Continuous.inv₀ ?_ e2).mul ψ.h1.continuous).mul l8 -+ fun_prop -+ have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * -+ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -+ apply l7.integrable_of_hasCompactSupport -+ exact ψ.h2.mul_left.mul_right.mul_left.mul_left -+ simp_rw [l1 σ' hσ', l2 σ' hσ', ← integral_const_mul, ← integral_sub l4 l5] -+ apply integral_congr_ae -+ apply Eventually.of_forall -+ intro u -+ have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] -+ simp_rw [hG' e1, sub_mul, ← mul_assoc] -+ simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, -+ mul_eq_zero, I_ne_zero, or_false] -+ left ; left -+ field_simp [e2] -+ norm_cast -+ simp [mul_assoc, ← rpow_add l3] -+ -+end CatalanPNT -diff --git a/PrimeNumberTheoremAnd/Catalan/WienerLimits.lean b/PrimeNumberTheoremAnd/Catalan/WienerLimits.lean -new file mode 100644 -index 0000000..fa60fec ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Catalan/WienerLimits.lean -@@ -0,0 +1,620 @@ -+import PrimeNumberTheoremAnd.Catalan.WienerFourier -+ -+namespace CatalanPNT -+ -+open ZetaFivePNT -+ -+open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries -+ Asymptotics SchwartzMap -+open Complex hiding log -+open scoped Topology -+open scoped ContDiff -+open scoped ComplexConjugate -+ -+variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} -+ [RCLike 𝕜] -+ -+section nabla -+ -+variable {α E : Type*} [OfNat α 1] [Add α] [Sub α] {u : α → ℂ} -+ -+def cumsum [AddCommMonoid E] (u : ℕ → E) (n : ℕ) : E := ∑ i ∈ Finset.range n, u i -+ -+def nabla [Sub E] (u : α → E) (n : α) : E := u (n + 1) - u n -+ -+def nnabla [Sub E] (u : α → E) (n : α) : E := u n - u (n + 1) -+ -+def shift (u : α → E) (n : α) : E := u (n + 1) -+ -+@[simp] theorem cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] -+ -+theorem cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : -+ cumsum u (n + 1) = cumsum u n + u n := by -+ simp [cumsum, Finset.sum_range_succ] -+ -+@[simp] theorem nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by -+ ext n ; simp [nabla, cumsum, Finset.range_add_one] -+ -+theorem neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := -+ funext (fun n => by simp [cumsum]) -+ -+theorem cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := -+ fun _ => Finset.sum_nonneg (fun i _ => hu i) -+ -+omit [Sub α] in -+theorem neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] -+ -+omit [Sub α] in -+@[simp] theorem nabla_mul [Ring E] {u : α → E} {c : E} : -+ nabla (fun n => c * u n) = c • nabla u := by -+ ext n ; simp [nabla, mul_sub] -+ -+omit [Sub α] in -+@[simp] theorem nnabla_mul [Ring E] {u : α → E} {c : E} : -+ nnabla (fun n => c * u n) = c • nnabla u := by -+ ext n ; simp [nnabla, mul_sub] -+ -+theorem nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by -+ ext n ; simp [nnabla] -+ -+end nabla -+ -+theorem Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : -+ cumsum u (n + 1) = u 0 + cumsum (shift u) n := by -+ simp_rw [add_comm n, cumsum, _root_.Finset.sum_range_add, -+ _root_.Finset.sum_range_one, add_comm 1] ; rfl -+ -+theorem Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : -+ shift (cumsum u) = (fun _ => u 0) + cumsum (shift u) := by -+ ext n ; apply Finset.sum_shift_front -+ -+theorem Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : -+ cumsum u (n + 1) = cumsum u n + u n := by -+ simp [cumsum, Finset.range_add_one, add_comm] -+ -+theorem Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : -+ shift (cumsum u) = cumsum u + u := by -+ ext n ; apply Finset.sum_shift_back -+ -+theorem summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : -+ cumsum (a * b) (n + 1) = A (n + 1) * b n - A 0 * b 0 - -+ cumsum (shift A * fun i => (b (i + 1) - b i)) n := by -+ have l1 : ∑ x ∈ Finset.range (n + 1), A (x + 1) * b x = ∑ x ∈ Finset.range n, -+ A (x + 1) * b x + A (n + 1) * b n := -+ Finset.sum_shift_back -+ have l2 : ∑ x ∈ Finset.range (n + 1), A x * b x = A 0 * b 0 + ∑ x ∈ Finset.range n, -+ A (x + 1) * b (x + 1) := -+ Finset.sum_shift_front -+ simp only [cumsum, ha, Pi.mul_apply, nabla, sub_mul, Finset.sum_sub_distrib, l1, l2, shift, -+ mul_sub] -+ abel -+ -+theorem summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : -+ cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - cumsum (shift (cumsum a) * nabla b) n := by -+ change cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - -+ cumsum (shift (cumsum a) * (fun i : ℕ => b (i + 1) - b i)) n -+ simpa using summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) -+ -+theorem summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : -+ shift (cumsum (a * b)) = shift (cumsum a) * b - cumsum (shift (cumsum a) * nabla b) := by -+ ext n ; apply summation_by_parts' -+ -+theorem summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : -+ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by -+ have l1 : (cumsum u =O[atTop] 1) ↔ _ := isBigO_one_nat_atTop_iff -+ have l2 n : ‖cumsum u n‖ = cumsum u n := by simpa using cumsum_nonneg hu n -+ simp only [BoundedAtFilter, l1, l2] -+ constructor <;> intro h <;> rcases h with ⟨C, h1⟩ -+ · exact ⟨C, fun n => sum_le_hasSum _ (fun i _ => hu i) h1⟩ -+ · exact summable_of_sum_range_le hu h1 -+ -+theorem Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : -+ Summable u := -+ summable_of_isBigO_nat hu h.isBigO -+ -+theorem summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by -+ exact ⟨CatalanPNT.Filter.EventuallyEq.summable huv.symm, -+ CatalanPNT.Filter.EventuallyEq.summable huv⟩ -+ -+theorem BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : -+ BoundedAtFilter atTop (fun n => u n + c) ↔ BoundedAtFilter atTop u := by -+ have : u = fun n => (u n + c) + (-c) := by ext n ; ring -+ simp only [BoundedAtFilter] -+ constructor <;> intro h -+ on_goal 1 => rw [this] -+ all_goals { exact h.add (const_boundedAtFilter _ _) } -+ -+theorem BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : -+ BoundedAtFilter atTop (fun n => u (n + N)) ↔ BoundedAtFilter atTop u := by -+ simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, one_mem, -+ CStarRing.norm_of_mem_unitary, mul_one, eventually_atTop] -+ constructor <;> intro hbound <;> rcases hbound with ⟨C, n₀, h⟩ <;> use C -+ · refine ⟨n₀ + N, fun n hn => ?_⟩ -+ obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' (m := N) (n := n) (by grind) -+ exact h _ <| Nat.add_le_add_iff_right.mp hn -+ · exact ⟨n₀, fun n hn => h _ (by grind)⟩ -+ -+theorem summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : -+ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by -+ obtain ⟨N, hu⟩ := eventually_atTop.mp hu -+ have e2 : cumsum (fun i ↦ u (i + N)) = fun n => cumsum u (n + N) - cumsum u N := by -+ ext n ; simp_rw [cumsum, add_comm _ N, Finset.sum_range_add] ; ring -+ rw [← summable_nat_add_iff N, summable_iff_bounded (fun n => hu _ <| Nat.le_add_left N n), e2] -+ simp_rw [sub_eq_add_neg, BoundedAtFilter.add_const, BoundedAtFilter.comp_add] -+ -+theorem bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : -+ BoundedAtFilter atTop u := by -+ simp only [BoundedAtFilter, isBigO_iff, eventually_atTop] at h ⊢ -+ obtain ⟨C, N, hC⟩ := h -+ refine ⟨C, N + 1, fun n hn => ?_⟩ -+ simp only [shift] at hC -+ have r1 : n - 1 ≥ N := Nat.le_sub_one_of_lt hn -+ have r2 : n - 1 + 1 = n := Nat.sub_add_cancel (by omega) -+ simpa [r2] using hC (n - 1) r1 -+ -+theorem dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) -+ (hAb : BoundedAtFilter atTop (shift (cumsum a) * b)) (hbb : ∀ᶠ n in atTop, b (n + 1) ≤ b n) -+ (h : Summable (shift (cumsum a) * nnabla b)) : Summable (a * b) := by -+ have l1 : ∀ᶠ n in atTop, 0 ≤ (shift (cumsum a) * nnabla b) n := by -+ filter_upwards [hbb] with n hb -+ exact mul_nonneg (by simpa [shift] using cumsum_nonneg ha (n + 1)) (sub_nonneg.mpr hb) -+ rw [summable_iff_bounded (mul_nonneg ha hb)] -+ rw [summable_iff_bounded' l1] at h -+ apply bounded_of_shift -+ simpa only [summation_by_parts'', sub_eq_add_neg, neg_cumsum, ← mul_neg, neg_nabla] -+ using hAb.add h -+ -+theorem exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : -+ ∃ v : ℕ → ℝ, range v ⊆ range u ∧ Antitone v ∧ v =ᶠ[atTop] u := by -+ obtain ⟨N, hN⟩ := eventually_atTop.mp hu -+ let v (n : ℕ) := u (if n < N then N else n) -+ refine ⟨v, ?_, ?_, ?_⟩ -+ · intro x hx -+ rcases hx with ⟨n, hn⟩ -+ exact ⟨if n < N then N else n, hn⟩ -+ · refine antitone_nat_of_succ_le (fun n => ?_) -+ by_cases h : n < N -+ · by_cases h' : n + 1 < N <;> simp [v, h, h'] -+ have : n + 1 = N := by linarith -+ simp [this] -+ · have : ¬(n + 1 < N) := by linarith -+ simp only [this, ↓reduceIte, h, ge_iff_le, v] ; apply hN ; linarith -+ · have : ∀ᶠ n in atTop, ¬(n < N) := by simpa using ⟨N, fun b hb => by linarith⟩ -+ filter_upwards [this] with n hn ; simp [v, hn] -+ -+theorem summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by -+ let u (n : ℕ) := (n * (Real.log n) ^ 2)⁻¹ -+ have l7 : ∀ᶠ n : ℕ in atTop, 1 ≤ Real.log n := -+ tendsto_atTop.mp (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) 1 -+ have l8 : ∀ᶠ n : ℕ in atTop, 1 ≤ n := eventually_ge_atTop 1 -+ have l9 : ∀ᶠ n in atTop, u (n + 1) ≤ u n := by -+ filter_upwards [l7, l8] with n l2 l8; dsimp [u]; gcongr <;> simp -+ obtain ⟨v, l1, l2, l3⟩ := exists_antitone_of_eventually l9 -+ rw [summable_congr_ae l3.symm] -+ have l4 (n : ℕ) : 0 ≤ v n := by obtain ⟨k, hk⟩ := l1 ⟨n, rfl⟩ ; rw [← hk] ; positivity -+ apply (summable_condensed_iff_of_nonneg l4 (fun _ _ _ a ↦ l2 a)).mp -+ suffices this : ∀ᶠ k : ℕ in atTop, 2 ^ k * v (2 ^ k) = ((k : ℝ) ^ 2)⁻¹ * ((Real.log 2) ^ 2)⁻¹ by -+ exact (summable_congr_ae this).mpr <| (Real.summable_nat_pow_inv.mpr one_lt_two).mul_right _ -+ have l5 : ∀ᶠ k in atTop, v (2 ^ k) = u (2 ^ k) := -+ l3.comp_tendsto <| tendsto_pow_atTop_atTop_of_one_lt Nat.le.refl -+ filter_upwards [l5, l8] with k l5 l8 -+ simp only [l5, mul_inv_rev, Nat.cast_pow, Nat.cast_ofNat, log_pow, u] -+ field_simp -+ -+theorem tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ Tendsto (fun x => a * x + b) atTop atTop := -+ tendsto_atTop_add_const_right _ b (tendsto_id.const_mul_atTop ha) -+ -+theorem isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} -+ (hf : Tendsto f atTop atTop) : (fun _ => a) =o[atTop] f := by -+ simp [tendsto_norm_atTop_atTop.comp hf] -+ -+theorem isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by -+ apply IsLittleO.add -+ · apply IsLittleO.const_mul_left ; simpa using isLittleO_pow_pow_atTop_of_lt (𝕜 := ℝ) one_lt_two -+ · apply isLittleO_const_of_tendsto_atTop _ <| tendsto_pow_atTop (by linarith) -+ -+theorem log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ (fun x => Real.log (a * x + b)) =O[atTop] Real.log := by -+ apply IsBigO.of_bound (2 : ℕ) -+ have l2 : ∀ᶠ x : ℝ in atTop, 0 ≤ log x := tendsto_atTop.mp tendsto_log_atTop 0 -+ have l3 : ∀ᶠ x : ℝ in atTop, 0 ≤ log (a * x + b) := -+ tendsto_atTop.mp (tendsto_log_atTop.comp (tendsto_mul_add_atTop ha b)) 0 -+ have l5 : ∀ᶠ x : ℝ in atTop, 1 ≤ a * x + b := tendsto_atTop.mp (tendsto_mul_add_atTop ha b) 1 -+ have l1 : ∀ᶠ x : ℝ in atTop, a * x + b ≤ x ^ 2 := by -+ filter_upwards [(isLittleO_mul_add_sq a b).eventuallyLE, l5] with x r2 l5 -+ simpa [abs_eq_self.mpr (zero_le_one.trans l5)] using r2 -+ filter_upwards [l1, l2, l3, l5] with x l1 l2 l3 l5 -+ simpa [abs_eq_self.mpr l2, abs_eq_self.mpr l3, Real.log_pow] using -+ Real.log_le_log (by linarith) l1 -+ -+theorem isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ Real.log =O[atTop] (fun x => Real.log (a * x + b)) := by -+ convert (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto -+ (tendsto_mul_add_atTop (b := b) ha) using 1 -+ · ext x -+ simp only [Function.comp_apply] -+ congr -+ field_simp -+ simp -+ · rfl -+ -+theorem log_isbigo_log_div {d : ℝ} (hb : 0 < d) : -+ (fun n ↦ Real.log n) =O[atTop] (fun n ↦ Real.log (n / d)) := by -+ convert isBigO_log_mul_add (inv_pos.mpr hb) 0 using 1; simp only [add_zero]; field_simp -+ -+theorem Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : -+ f =O[atTop] (f + g) := by -+ exact h.right_isBigO_add' -+ -+theorem Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : -+ (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := -+ h.pow 2 -+ -+theorem log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : -+ (fun x ↦ Real.log x ^ 2) =O[atTop] (fun x ↦ a + Real.log (x / b) ^ 2) := by -+ apply (CatalanPNT.Asymptotics.IsBigO.sq (log_isbigo_log_div hb)).trans -+ simp_rw [add_comm a] -+ refine CatalanPNT.Asymptotics.IsBigO.add_isLittleO_right <| -+ isLittleO_const_of_tendsto_atTop _ ?_ -+ exact (tendsto_pow_atTop two_ne_zero).comp <| -+ tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb -+ -+theorem log_add_div_isBigO_log (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ (fun x ↦ Real.log ((x + a) / b)) =O[atTop] fun x ↦ Real.log x := by -+ convert log_mul_add_isBigO_log (inv_pos.mpr hb) (a / b) using 3 ; ring -+ -+theorem log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by -+ rw [nabla, ← Real.log_div (by linarith) hx.ne'] -+ calc -+ _ ≤ (x + 1) / x - 1 := Real.log_le_sub_one_of_pos (by positivity) -+ _ = x⁻¹ := by field_simp; ring -+ -+theorem nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by -+ apply IsBigO.of_bound 1 -+ filter_upwards [eventually_gt_atTop 0] with x l1 -+ have l2 : log x ≤ log (x + 1) := log_le_log l1 (by linarith) -+ simpa [nabla, abs_eq_self.mpr l1.le, abs_eq_self.mpr (sub_nonneg.mpr l2)] using -+ log_add_one_sub_log_le l1 -+ -+theorem nabla_log {b : ℝ} (hb : 0 < b) : -+ nabla (fun x => Real.log (x / b)) =O[atTop] (fun x => 1 / x) := by -+ refine EventuallyEq.trans_isBigO ?_ nabla_log_main -+ filter_upwards [eventually_gt_atTop 0] with x l2 -+ rw [nabla, log_div (by linarith) (by linarith), log_div l2.ne.symm (by linarith), nabla] ; ring -+ -+theorem nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ nabla (fun x => x * (a + Real.log (x / b) ^ 2)) =O[atTop] (fun x => Real.log x ^ 2) := by -+ have l1 : nabla (fun n => n * (a + Real.log (n / b) ^ 2)) = fun n => -+ a + Real.log ((n + 1) / b) ^ 2 + -+ (n * (Real.log ((n + 1) / b) ^ 2 - Real.log (n / b) ^ 2)) := by -+ ext n ; simp [nabla] ; ring -+ have l2 := (isLittleO_const_of_tendsto_atTop a -+ ((tendsto_pow_atTop two_ne_zero).comp tendsto_log_atTop)).isBigO -+ have l3 := CatalanPNT.Asymptotics.IsBigO.sq (log_add_div_isBigO_log 1 hb) -+ have l4 : (fun x => Real.log ((x + 1) / b) + Real.log (x / b)) =O[atTop] Real.log := by -+ simpa using (log_add_div_isBigO_log _ hb).add (log_add_div_isBigO_log 0 hb) -+ have e2 : (fun x : ℝ => x * (Real.log x * (1 / x))) =ᶠ[atTop] Real.log := by -+ filter_upwards [eventually_ge_atTop 1] with x hx using by field_simp -+ have l5 : (fun n ↦ n * (Real.log n * (1 / n))) =O[atTop] (fun n ↦ (Real.log n) ^ 2) := -+ e2.trans_isBigO -+ (by simpa [Function.comp_def] using -+ (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) -+ simp_rw [l1, _root_.sq_sub_sq] -+ exact ((l2.add l3).add (isBigO_refl (·) atTop |>.mul (l4.mul (nabla_log hb)) |>.trans l5)) -+ -+theorem nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ Tendsto (fun x => x * (a + Real.log (x / b) ^ 2)) atTop atTop := -+ tendsto_id.atTop_mul_atTop₀ <| tendsto_atTop_add_const_left _ _ <| -+ (tendsto_pow_atTop two_ne_zero).comp <| tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb -+ -+theorem nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ ∀ᶠ x in atTop, 0 < x * (a + Real.log (x / b) ^ 2) := -+ (nnabla_bound_aux1 a hb).eventually (eventually_gt_atTop 0) -+ -+theorem Real.log_eventually_gt_atTop (a : ℝ) : -+ ∀ᶠ x in atTop, a < Real.log x := -+ Real.tendsto_log_atTop.eventually (eventually_gt_atTop a) -+ -+@[local gcongr] -+theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : -+ ‖x‖ ≤ ‖y‖ := by -+ simp_rw [Real.norm_eq_abs] -+ apply abs_le_abs hxy -+ linarith -+ -+theorem nnabla_bound_aux {x : ℝ} (hx : 0 < x) : -+ nnabla (fun n ↦ 1 / (n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2))) =O[atTop] -+ (fun n ↦ 1 / (Real.log n ^ 2 * n ^ 2)) := by -+ let d n : ℝ := n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2) -+ change (fun x_1 ↦ nnabla (fun n ↦ 1 / d n) x_1) =O[atTop] _ -+ have l2 : ∀ᶠ n in atTop, 0 < d n := (nnabla_bound_aux2 ((2 * π) ^ 2) hx) -+ have l3 : ∀ᶠ n in atTop, 0 < d (n + 1) := -+ (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_id).eventually l2 -+ have l1 : ∀ᶠ n : ℝ in atTop, -+ nnabla (fun n ↦ 1 / d n) n = (d (n + 1) - d n) * (d n)⁻¹ * (d (n + 1))⁻¹ := by -+ filter_upwards [l2, l3] with n l2 l3 -+ rw [nnabla, one_div, one_div, inv_sub_inv l2.ne.symm l3.ne.symm, div_eq_mul_inv, mul_inv, -+ mul_assoc] -+ have l4 : (fun n => (d n)⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by -+ apply IsBigO.inv_rev -+ · refine (isBigO_refl _ _).mul <| (log_sq_isbigo_mul hx) -+ · filter_upwards [Real.log_eventually_gt_atTop 0, eventually_gt_atTop 0] with x hx hx' -+ rw [← not_imp_not] -+ intro _ -+ positivity -+ have l5 : (fun n => (d (n + 1))⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by -+ refine IsBigO.trans ?_ l4 -+ rw [isBigO_iff]; use 1 -+ have e3 : ∀ᶠ n in atTop, d n ≤ d (n + 1) := by -+ filter_upwards [eventually_ge_atTop x] with n hn -+ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn -+ have : 0 ≤ n := hx.le.trans hn -+ simp only [d] -+ gcongr <;> simp [Real.log_nonneg, *] -+ filter_upwards [l2, l3, e3] with n e1 e2 e3 -+ simp_rw [one_mul] -+ gcongr -+ have l6 : (fun n => d (n + 1) - d n) =O[atTop] (fun n => (Real.log n) ^ 2) := by -+ change nabla (fun n : ℝ => n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2)) -+ =O[atTop] (fun n => (Real.log n) ^ 2) -+ exact nnabla_mul_log_sq ((2 * π) ^ 2) hx -+ apply EventuallyEq.trans_isBigO l1 -+ apply ((l6.mul l4).mul l5).trans_eventuallyEq -+ filter_upwards [eventually_ge_atTop 2, Real.log_eventually_gt_atTop 0] with n hn hn' -+ field_simp -+ -+theorem nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : -+ nnabla (fun n => C / (1 + (Real.log (n / x) / (2 * π)) ^ 2) / n) =O[atTop] -+ (fun n => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by -+ field_simp -+ simp only [div_eq_mul_inv, mul_inv, nnabla_mul, one_mul] -+ apply IsBigO.const_mul_left -+ simpa [div_eq_mul_inv, mul_pow, mul_comm] using nnabla_bound_aux hx -+ -+theorem cheby.bigO (h : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by -+ have l1 : 0 ≤ cumsum (‖f ·‖) := cumsum_nonneg (fun _ => norm_nonneg _) -+ obtain ⟨C, hC⟩ := h -+ apply isBigO_of_le' (c := C) atTop -+ intro n -+ rw [Real.norm_eq_abs, abs_eq_self.mpr (l1 n)] -+ simpa using hC n -+ -+theorem limiting_fourier_lim1_aux -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : -+ Summable fun n ↦ ‖f n‖ / ↑n * (C / (1 + (1 / (2 * π) * Real.log (↑n / x)) ^ 2)) := by -+ let a (n : ℕ) := (C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2) / ↑n) -+ replace hcheby := cheby.bigO hcheby -+ have l1 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n : ℕ => (↑(n + 1) : ℝ)) := -+ hcheby.comp_tendsto <| tendsto_add_atTop_nat 1 -+ have l2 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n => (n : ℝ)) := -+ l1.trans -+ (by simpa using (isBigO_refl _ _).add <| isBigO_iff.mpr ⟨1, by simpa using ⟨1, by tauto⟩⟩) -+ have l5 : BoundedAtFilter atTop (fun n : ℕ => C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2)) := by -+ simp only [BoundedAtFilter] -+ field_simp -+ apply isBigO_of_le' (c := C) ; intro n -+ have : 0 ≤ 2 ^ 2 * π ^ 2 + Real.log (n / x) ^ 2 := by positivity -+ simp only [norm_div, norm_mul, norm_eq_abs, abs_eq_self.mpr hC, norm_pow, -+ abs_eq_self.mpr pi_nonneg, abs_eq_self.mpr this, Pi.one_apply, one_mem, -+ CStarRing.norm_of_mem_unitary, mul_one, ge_iff_le, Nat.abs_ofNat] -+ apply div_le_of_le_mul₀ this hC -+ rw [mul_add, ← mul_assoc] -+ apply le_add_of_le_of_nonneg le_rfl -+ positivity -+ have l3 : a =O[atTop] (fun n => 1 / (n : ℝ)) := by -+ convert IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) using 1 -+ · ext n -+ simp [a, div_eq_mul_inv] -+ · ext n -+ simp -+ have l4 : nnabla a =O[atTop] (fun n : ℕ => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by -+ convert (nnabla_bound C hx).natCast_atTop ; simp [nnabla, a] -+ simp_rw [div_mul_eq_mul_div, mul_div_assoc, one_mul] -+ apply dirichlet_test' -+ · intro n ; exact norm_nonneg _ -+ · intro n ; positivity -+ · apply (l2.mul l3).trans_eventuallyEq -+ apply eventually_of_mem (Ici_mem_atTop 1) -+ intro x (hx : 1 ≤ x) -+ have : x ≠ 0 := Nat.one_le_iff_ne_zero.mp hx -+ simp [this] -+ · have : ∀ᶠ n : ℕ in atTop, x ≤ n := by simpa using eventually_ge_atTop ⌈x⌉₊ -+ filter_upwards [this] with n hn -+ have e1 : 0 < (n : ℝ) := by linarith -+ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn -+ have e3 := Nat.le_succ n -+ gcongr -+ refine div_nonneg (Real.log_nonneg e2) (by norm_num [pi_nonneg]) -+ · apply summable_of_isBigO_nat summable_inv_mul_log_sq -+ apply (l2.mul l4).trans_eventuallyEq -+ apply eventually_of_mem (Ici_mem_atTop 2) -+ intro x (hx : 2 ≤ x) -+ have : (x : ℝ) ≠ 0 := by simp ; linarith -+ have : Real.log x ≠ 0 := by -+ have ll : 2 ≤ (x : ℝ) := by simp [hx] -+ simp -+ grind -+ field_simp -+ -+theorem limiting_fourier_lim1 -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (ψ : W21) (hx : 0 < x) : -+ Tendsto (fun σ' : ℝ ↦ -+ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x))) (𝓝[>] 1) -+ (𝓝 (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x)))) := by -+ obtain ⟨C, hC⟩ := decay_bounds_cor ψ -+ have : 0 ≤ C := by simpa using (norm_nonneg _).trans (hC 0) -+ refine tendsto_tsum_of_dominated_convergence -+ (limiting_fourier_lim1_aux hcheby hx C this) (fun n => ?_) ?_ -+ · apply Tendsto.mul_const -+ by_cases h : n = 0 <;> simp only [term, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, -+ tendsto_const_nhds_iff] -+ refine tendsto_const_nhds.div ?_ (by simp [h]) -+ simpa using ((continuous_ofReal.tendsto 1).mono_left nhdsWithin_le_nhds).const_cpow -+ · rw [eventually_nhdsWithin_iff] -+ apply Eventually.of_forall -+ intro σ' (hσ' : 1 < σ') n -+ rw [norm_mul, ← nterm_eq_norm_term] -+ refine mul_le_mul ?_ (hC _) (norm_nonneg _) (div_nonneg (norm_nonneg _) (Nat.cast_nonneg _)) -+ by_cases h : n = 0 <;> simp only [nterm, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, le_refl] -+ have : 1 ≤ (n : ℝ) := by exact_mod_cast (show 1 ≤ n by omega) -+ refine div_le_div₀ (norm_nonneg _) le_rfl (by simpa [Nat.pos_iff_ne_zero]) ?_ -+ simpa using Real.rpow_le_rpow_of_exponent_le this hσ'.le -+ -+theorem limiting_fourier_lim2_aux (x : ℝ) (C : ℝ) : -+ Integrable (fun t ↦ max |x| 1 * (C / (1 + (t / (2 * π)) ^ 2))) -+ (Measure.restrict volume (Ici (-Real.log x))) := by -+ simp_rw [div_eq_mul_inv C] -+ exact (((integrable_inv_one_add_sq.comp_div -+ (by simp [pi_ne_zero])).const_mul _).const_mul _).restrict -+ -+theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : -+ Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * -+ ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) -+ (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by -+ obtain ⟨C, hC⟩ := decay_bounds_cor ψ -+ apply Tendsto.mul -+ · suffices h : Tendsto (fun σ' : ℝ ↦ ofReal (x ^ (1 - σ'))) (𝓝[>] 1) (𝓝 1) by -+ simpa using h.const_mul ↑A -+ suffices h : Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) from -+ (continuous_ofReal.tendsto 1).comp h -+ have : Tendsto (fun σ' : ℝ ↦ σ') (𝓝 1) (𝓝 1) := fun _ a ↦ a -+ have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := -+ tendsto_nhdsWithin_of_tendsto_nhds (by simpa using this.const_sub 1) -+ simpa using tendsto_const_nhds.rpow this (Or.inl (zero_lt_one.trans_le hx).ne.symm) -+ · refine tendsto_integral_filter_of_dominated_convergence _ ?_ ?_ -+ (limiting_fourier_lim2_aux x C) ?_ -+ · apply Eventually.of_forall ; intro σ' -+ apply Continuous.aestronglyMeasurable -+ have := continuous_FourierIntegral ψ -+ continuity -+ · apply eventually_of_mem (U := Ioo 1 2) -+ · apply Ioo_mem_nhdsGT_of_mem ; simp -+ · intro σ' hσ -+ have h1 := hσ.1 -+ have h2 := hσ.2 -+ rw [ae_restrict_iff' measurableSet_Ici] -+ apply Eventually.of_forall -+ intro t (ht : - Real.log x ≤ t) -+ rw [norm_mul] -+ have hdom_nonneg : 0 ≤ max |x| 1 := by -+ exact (abs_nonneg x).trans (le_max_left _ _) -+ refine mul_le_mul ?_ (hC _) (norm_nonneg _) hdom_nonneg -+ simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, norm_exp, -+ neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, sub_self, mul_zero, -+ sub_zero] -+ have : -Real.log x * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht (by linarith) -+ have : -(t * (σ' - 1)) ≤ Real.log x * (σ' - 1) := by simpa using neg_le_neg this -+ have := Real.exp_monotone this -+ apply this.trans -+ have l1 : σ' - 1 ≤ 1 := by linarith -+ have : 0 ≤ Real.log x := Real.log_nonneg hx -+ have := mul_le_mul_of_nonneg_left l1 this -+ refine (Real.exp_monotone this).trans ?_ -+ have hxabs : |x| = x := abs_of_nonneg (zero_le_one.trans hx) -+ calc -+ Real.exp (Real.log x * 1) = |x| := by -+ simpa [mul_one, hxabs] using (Real.exp_log (zero_lt_one.trans_le hx)) -+ _ ≤ max |x| 1 := le_max_left _ _ -+ · apply Eventually.of_forall -+ intro x -+ suffices h : Tendsto (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by -+ simpa using h.mul_const _ -+ apply Tendsto.mono_left ?_ nhdsWithin_le_nhds -+ suffices h : Continuous (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) by simpa using h.tendsto 1 -+ continuity -+ -+theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : -+ Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) -+ (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by -+ by_cases hh : tsupport ψ = ∅ -+ · simp [tsupport_eq_empty_iff.mp hh] -+ obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh -+ let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) -+ have l1 : IsCompact S := by -+ refine Metric.isCompact_iff_isClosed_bounded.mpr ⟨?_, ?_⟩ -+ · exact isClosed_Icc.reProdIm (isClosed_tsupport ψ) -+ · exact (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded -+ have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 -+ have l3 : ContinuousOn (‖G ·‖) S := (hG.mono l2).norm -+ have l4 : S.Nonempty := ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ -+ obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn l4 l3 -+ let MG := ‖G z‖ -+ let bound (a : ℝ) : ℝ := MG * ‖ψ a‖ -+ apply tendsto_integral_filter_of_dominated_convergence (bound := bound) -+ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ; intro u hu -+ apply Continuous.aestronglyMeasurable -+ apply Continuous.mul -+ · exact (hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous -+ · apply Continuous.const_cpow (by fun_prop) ; simp ; linarith -+ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) -+ intro u hu -+ apply Eventually.of_forall ; intro v -+ by_cases h : v ∈ tsupport ψ -+ · have r1 : u + v * I ∈ S := by simp [S, mem_reProdIm, hu.1, hu.2, h] -+ have r2 := isMaxOn_iff.mp hmax _ r1 -+ have r4 : (x : ℂ) ≠ 0 := by simp ; linarith -+ have r5 : arg x = 0 := by simp [arg_eq_zero_iff] ; linarith -+ have r3 : ‖(x : ℂ) ^ (v * I)‖ = 1 := by simp [norm_cpow_of_ne_zero r4, r5] -+ simp_rw [norm_mul, r3, mul_one] -+ exact mul_le_mul_of_nonneg_right r2 (norm_nonneg _) -+ · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) -+ simp at this ; simp [this, bound] -+ · suffices h : Continuous bound by exact h.integrable_of_hasCompactSupport ψ.h2.norm.mul_left -+ have := ψ.h1.continuous ; fun_prop -+ · apply Eventually.of_forall ; intro t -+ apply Tendsto.mul_const -+ apply Tendsto.mul_const -+ refine (hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr ⟨?_, ?_⟩ -+ · exact ((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds -+ · exact eventually_nhdsWithin_of_forall (fun x (hx : 1 < x) => by simp [hx.le]) -+ -+theorem limiting_fourier (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : -+ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -+ ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by -+ have l1 := limiting_fourier_lim1 hcheby ψ (by linarith) -+ have l2 := limiting_fourier_lim2 A ψ hx -+ have l3 := limiting_fourier_lim3 hG ψ hx -+ apply tendsto_nhds_unique_of_eventuallyEq (l1.sub l2) l3 -+ simpa [eventuallyEq_nhdsWithin_iff, W21.ofCS2] using -+ Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) -+ -+theorem limiting_cor_aux {f : ℝ → ℂ} : -+ Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by -+ have l1 : ∀ᶠ x : ℝ in atTop, ∀ t : ℝ, x ^ (t * I) = exp (log x * t * I) := by -+ filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' t -+ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx'] ; ring_nf -+ have l2 : ∀ᶠ x : ℝ in atTop, ∫ t, f t * x ^ (t * I) = ∫ t, f t * exp (log x * t * I) := by -+ filter_upwards [l1] with x hx -+ refine integral_congr_ae (Eventually.of_forall (fun x => by simp [hx])) -+ simp_rw [tendsto_congr' l2] -+ convert_to Tendsto (fun x => 𝓕 f (-Real.log x / (2 * π))) atTop (𝓝 0) -+ · funext x -+ rw [Real.fourier_real_eq_integral_exp_smul] -+ apply integral_congr_ae -+ filter_upwards [] with t -+ have hphase : -2 * π * t * (-Real.log x / (2 * π)) = Real.log x * t := by -+ field_simp -+ rw [hphase, ofReal_mul, smul_eq_mul] -+ exact mul_comm _ _ -+ refine (Real.zero_at_infty_fourier f).comp <| Tendsto.mono_right ?_ _root_.atBot_le_cocompact -+ exact (tendsto_neg_atBot_iff.mpr tendsto_log_atTop).atBot_mul_const (inv_pos.mpr two_pi_pos) -+ -+theorem limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by -+ apply limiting_cor_aux.congr' -+ filter_upwards [eventually_ge_atTop 1] with x hx using -+ limiting_fourier hcheby hG hG' hf ψ hx |>.symm -+ -+end CatalanPNT -diff --git a/PrimeNumberTheoremAnd/Erdos970.lean b/PrimeNumberTheoremAnd/Erdos970.lean -new file mode 100644 -index 0000000..2137759 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970.lean -@@ -0,0 +1,19 @@ -+import PrimeNumberTheoremAnd.Erdos970.Auxiliary -+import PrimeNumberTheoremAnd.Erdos970.Consequences -+import PrimeNumberTheoremAnd.Erdos970.Defs -+import PrimeNumberTheoremAnd.Erdos970.EulerMaclaurin -+import PrimeNumberTheoremAnd.Erdos970.Fourier -+import PrimeNumberTheoremAnd.Erdos970.HadamardSupport -+import PrimeNumberTheoremAnd.Erdos970.Mathlib.Algebra.Notation.Support -+import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.Asymptotics.Asymptotics -+import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic -+import PrimeNumberTheoremAnd.Erdos970.MellinCalculus -+import PrimeNumberTheoremAnd.Erdos970.MertensClassical -+import PrimeNumberTheoremAnd.Erdos970.Rectangle -+import PrimeNumberTheoremAnd.Erdos970.ResidueCalcOnRectangles -+import PrimeNumberTheoremAnd.Erdos970.SmoothExistence -+import PrimeNumberTheoremAnd.Erdos970.Sobolev -+import PrimeNumberTheoremAnd.Erdos970.Tactic.AdditiveCombination -+import PrimeNumberTheoremAnd.Erdos970.Wiener -+import PrimeNumberTheoremAnd.Erdos970.ZetaBounds -+import PrimeNumberTheoremAnd.Erdos970.ZetaConj -diff --git a/PrimeNumberTheoremAnd/Erdos970/Auxiliary.lean b/PrimeNumberTheoremAnd/Erdos970/Auxiliary.lean -new file mode 100644 -index 0000000..0273e54 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Auxiliary.lean -@@ -0,0 +1,71 @@ -+import Mathlib.Analysis.Complex.RealDeriv -+import Mathlib.Analysis.InnerProductSpace.Basic -+ -+namespace Erdos970 -+ -+namespace Complex -+ -+open _root_.Complex -+ -+lemma hasDerivAt_ofReal (x : ℝ) : HasDerivAt ofReal 1 x := -+ HasDerivAt.ofReal_comp <| hasDerivAt_id x -+ -+lemma deriv_ofReal (x : ℝ) : deriv ofReal x = 1 := -+ (hasDerivAt_ofReal x).deriv -+ -+lemma differentiableAt_ofReal (x : ℝ) : DifferentiableAt ℝ ofReal x := -+ (hasDerivAt_ofReal x).differentiableAt -+ -+end Complex -+ -+lemma DifferentiableAt.comp_ofReal {e : ℂ → ℂ} {z : ℝ} (hf : DifferentiableAt ℂ e z) : -+ DifferentiableAt ℝ (fun x : ℝ ↦ e x) z := -+ hf.hasDerivAt.comp_ofReal.differentiableAt -+ -+lemma deriv.comp_ofReal {e : ℂ → ℂ} {z : ℝ} (hf : DifferentiableAt ℂ e z) : -+ deriv (fun x : ℝ ↦ e x) z = deriv e z := -+ hf.hasDerivAt.comp_ofReal.deriv -+ -+lemma Differentiable.comp_ofReal {e : ℂ → ℂ} (h : Differentiable ℂ e) : -+ Differentiable ℝ (fun x : ℝ ↦ e x) := -+ fun _ ↦ DifferentiableAt.comp_ofReal h.differentiableAt -+ -+lemma DifferentiableAt.ofReal_comp {z : ℝ} {f : ℝ → ℝ} (hf : DifferentiableAt ℝ f z) : -+ DifferentiableAt ℝ (fun (y : ℝ) ↦ (f y : ℂ)) z := -+ hf.hasDerivAt.ofReal_comp.differentiableAt -+ -+lemma Differentiable.ofReal_comp {f : ℝ → ℝ} (hf : Differentiable ℝ f) : -+ Differentiable ℝ (fun (y : ℝ) ↦ (f y : ℂ)) := -+ fun _ ↦ DifferentiableAt.ofReal_comp hf.differentiableAt -+ -+open _root_.Complex ContinuousLinearMap in -+lemma HasDerivAt.of_hasDerivAt_ofReal_comp {z : ℝ} {f : ℝ → ℝ} {u : ℂ} -+ (hf : HasDerivAt (fun y ↦ (f y : ℂ)) u z) : -+ ∃ u' : ℝ, u = u' ∧ HasDerivAt f u' z := by -+ lift u to ℝ -+ · have H := (imCLM.hasFDerivAt.comp z hf.hasFDerivAt).hasDerivAt.deriv -+ simp only [Function.comp_def, imCLM_apply, ofReal_im, deriv_const] at H -+ rwa [eq_comm, comp_apply, imCLM_apply, toSpanSingleton_apply_one] at H -+ refine ⟨u, rfl, ?_⟩ -+ convert! (reCLM.hasFDerivAt.comp z hf.hasFDerivAt).hasDerivAt -+ rw [comp_apply, toSpanSingleton_apply_one, reCLM_apply, ofReal_re] -+ -+lemma DifferentiableAt.ofReal_comp_iff {z : ℝ} {f : ℝ → ℝ} : -+ DifferentiableAt ℝ (fun (y : ℝ) ↦ (f y : ℂ)) z ↔ DifferentiableAt ℝ f z := by -+ refine ⟨fun H ↦ ?_, ofReal_comp⟩ -+ obtain ⟨u, _, hu₂⟩ := HasDerivAt.of_hasDerivAt_ofReal_comp H.hasDerivAt -+ exact HasDerivAt.differentiableAt hu₂ -+ -+lemma Differentiable.ofReal_comp_iff {f : ℝ → ℝ} : -+ Differentiable ℝ (fun (y : ℝ) ↦ (f y : ℂ)) ↔ Differentiable ℝ f := -+ forall_congr' fun _ ↦ DifferentiableAt.ofReal_comp_iff -+ -+lemma deriv.ofReal_comp {z : ℝ} {f : ℝ → ℝ} : -+ deriv (fun (y : ℝ) ↦ (f y : ℂ)) z = deriv f z := by -+ by_cases hf : DifferentiableAt ℝ f z -+ · exact hf.hasDerivAt.ofReal_comp.deriv -+ · have hf' := mt DifferentiableAt.ofReal_comp_iff.mp hf -+ rw [deriv_zero_of_not_differentiableAt hf, deriv_zero_of_not_differentiableAt hf', -+ Complex.ofReal_zero] -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Consequences.lean b/PrimeNumberTheoremAnd/Erdos970/Consequences.lean -new file mode 100644 -index 0000000..4a72e0e ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Consequences.lean -@@ -0,0 +1,2293 @@ -+import Mathlib.NumberTheory.Harmonic.Bounds -+import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic -+import PrimeNumberTheoremAnd.Erdos970.Defs -+import PrimeNumberTheoremAnd.Erdos970.Wiener -+ -+namespace Erdos970 -+ -+ -+open ArithmeticFunction hiding log -+open Nat hiding log -+open _root_.Finset _root_.Erdos970.Finset -+open BigOperators _root_.Filter _root_.Erdos970.Filter _root_.Real _root_.Erdos970.Real -+open Classical _root_.Asymptotics _root_.Erdos970.Asymptotics MeasureTheory intervalIntegral -+open scoped ArithmeticFunction.Moebius ArithmeticFunction.Omega Chebyshev -+ -+open _root_.Set in -+lemma Set.Ico_subset_Ico_of_Icc_subset_Icc {a b c d : ℝ} (h : Set.Icc a b ⊆ Set.Icc c d) : -+ Set.Ico a b ⊆ Set.Ico c d := by -+ intro z hz -+ have hz' := Set.Ico_subset_Icc_self.trans h hz -+ have hcd : c ≤ d := by -+ contrapose! hz' -+ rw [Icc_eq_empty_of_lt hz'] -+ exact notMem_empty _ -+ simp only [Set.mem_Ico, Set.mem_Icc] at * -+ refine ⟨hz'.1, hz'.2.eq_or_lt.resolve_left ?_⟩ -+ rintro rfl -+ apply hz.2.not_ge -+ have := h <| right_mem_Icc.mpr (hz.1.trans hz.2.le) -+ simp only [Set.mem_Icc] at this -+ exact this.2 -+ -+lemma th43_b (x : ℝ) (hx : 2 ≤ x) : -+ Nat.primeCounting ⌊x⌋₊ = -+ θ x / log x + ∫ t in Set.Icc 2 x, θ t / (t * (Real.log t) ^ 2) := by -+ rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hx] -+ exact Chebyshev.primeCounting_eq_theta_div_log_add_integral hx -+ -+lemma finsum_range_eq_sum_range {R : Type*} [AddCommMonoid R] {f : ArithmeticFunction R} (x : ℝ) : -+ ∑ᶠ (n : ℕ) (_: n < x), f n = ∑ n ∈ range ⌈x⌉₊, f n := by -+ apply finsum_cond_eq_sum_of_cond_iff f -+ intros -+ simp only [mem_range] -+ exact Iff.symm Nat.lt_ceil -+ -+lemma finsum_range_eq_sum_range' {R : Type*} [AddCommMonoid R] {f : ArithmeticFunction R} -+ (x : ℝ) : ∑ᶠ (n : ℕ) (_ : n ≤ x), f n = ∑ n ∈ Iic ⌊x⌋₊, f n := by -+ apply finsum_cond_eq_sum_of_cond_iff f -+ intro n h -+ simp only [mem_Iic] -+ exact Iff.symm <| Nat.le_floor_iff' -+ fun (hc : n = 0) ↦ (h : f n ≠ 0) <| (congrArg f hc).trans ArithmeticFunction.map_zero -+ -+lemma log2_pos : 0 < log 2 := by -+ rw [Real.log_pos_iff zero_le_two] -+ exact one_lt_two -+ -+theorem Asymptotics.IsEquivalent.add_isLittleO' {α : Type*} {β : Type*} [NormedAddCommGroup β] -+ {u : α → β} {v : α → β} {w : α → β} {l : Filter α} -+ (huv : Asymptotics.IsEquivalent l u v) (hwu : (w - u) =o[l] v) : -+ Asymptotics.IsEquivalent l w v := by -+ rw [← add_sub_cancel u w] -+ exact huv.add_isLittleO hwu -+ -+theorem Asymptotics.IsEquivalent.add_isLittleO'' {α : Type*} {β : Type*} [NormedAddCommGroup β] -+ {u : α → β} {v : α → β} {w : α → β} {l : Filter α} -+ (huv : Asymptotics.IsEquivalent l u v) (hwu : (u - w) =o[l] v) : -+ Asymptotics.IsEquivalent l w v := by -+ rw [← sub_sub_self u w] -+ exact huv.sub_isLittleO hwu -+ -+theorem WeakPNT' : Tendsto (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) atTop (nhds 1) := by -+ have : (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) = -+ (fun N ↦ (∑ n ∈ range N, Λ n)/N + Λ N / N) := by -+ ext N -+ have : N ∈ Iic N := mem_Iic.mpr (le_refl _) -+ rw [← Finset.sum_erase_add _ _ this, ← Nat.Iio_eq_range, Iic_erase] -+ exact add_div _ _ _ -+ -+ rw [this, ← add_zero 1] -+ apply Tendsto.add WeakPNT -+ convert squeeze_zero (f := fun N ↦ Λ N / N) (g := fun N ↦ log N / N) (t₀ := atTop) ?_ ?_ ?_ -+ · intro N -+ exact div_nonneg vonMangoldt_nonneg (cast_nonneg N) -+ · intro N -+ exact div_le_div_of_nonneg_right vonMangoldt_le_log (cast_nonneg N) -+ have := Real.tendsto_pow_log_div_pow_atTop 1 1 Real.zero_lt_one -+ simp only [rpow_one] at this -+ exact Tendsto.comp this tendsto_natCast_atTop_atTop -+ -+theorem WeakPNT'' : ψ ~[atTop] (fun x ↦ x) := by -+ rw [(by rfl : ψ = (fun x ↦ ψ x))] -+ simp_rw [Chebyshev.psi_eq_sum_Icc] -+ apply IsEquivalent.trans (v := fun x ↦ (⌊x⌋₊:ℝ)) -+ · rw [isEquivalent_iff_tendsto_one] -+ · convert! Tendsto.comp WeakPNT' tendsto_nat_floor_atTop -+ infer_instance -+ rw [eventually_iff] -+ simp only [ne_eq, cast_eq_zero, floor_eq_zero, not_lt, mem_atTop_sets, -+ Set.mem_ofPred_eq] -+ use 1 -+ simp only [imp_self, implies_true] -+ apply IsLittleO.isEquivalent -+ rw [← isLittleO_neg_left] -+ apply IsLittleO.of_bound -+ intro ε hε -+ simp only [Pi.sub_apply, neg_sub, norm_eq_abs, eventually_atTop] -+ use ε⁻¹ -+ intro b hb -+ have hb' : 0 ≤ b := le_of_lt (lt_of_lt_of_le (inv_pos_of_pos hε) hb) -+ rw [abs_of_nonneg, abs_of_nonneg hb'] -+ · apply LE.le.trans _ ((inv_le_iff_one_le_mul₀' hε).mp hb) -+ linarith [Nat.lt_floor_add_one b] -+ rw [sub_nonneg] -+ exact floor_le hb' -+ -+lemma isLittleO_sqrt_mul_log : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] _root_.id := by -+ have : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] fun x ↦ x := by -+ refine (isLittleO_mul_iff_isLittleO_div ?_).mpr ?_ -+ · filter_upwards [eventually_gt_atTop 0] with x hx; exact (sqrt_ne_zero hx.le).mpr hx.ne' -+ · convert! isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2) using 2 with x -+ rw [div_sqrt, sqrt_eq_rpow] -+ exact this -+ -+lemma tendsto_floor_add_one_div_self : Tendsto (fun x : ℝ ↦ (⌊x⌋₊ + 1 : ℝ) / x) atTop (nhds 1) := by -+ have h := Asymptotics.isEquivalent_nat_floor (R := ℝ) -+ have h' : IsEquivalent atTop (fun x : ℝ ↦ (⌊x⌋₊ : ℝ) + 1) _root_.id := -+ h.add_isLittleO (isLittleO_const_id_atTop 1) -+ rwa [isEquivalent_iff_tendsto_one -+ (by filter_upwards [eventually_gt_atTop 0] with x hx a; simp only [_root_.id] at a; linarith)] at h' -+ -+lemma isTheta_self_div_const {c : ℝ} (hc : c ≠ 0) : (fun x : ℝ ↦ x) =Θ[atTop] fun x ↦ x / c := by -+ have : (fun x : ℝ ↦ x / c) = fun x ↦ c⁻¹ * x := by ext x; ring -+ exact this ▸ (isTheta_const_mul_left (inv_ne_zero hc)).mpr (isTheta_refl ..) |>.symm -+ -+lemma filter_prime_Iic_eq_Icc (n : ℕ) : filter Prime (Iic n) = filter Prime (Icc 1 n) := by -+ ext p; simp only [mem_filter, mem_Iic, mem_Icc, and_congr_left_iff] -+ exact fun hp ↦ ⟨fun h ↦ ⟨hp.one_lt.le, h⟩, fun ⟨_, h⟩ ↦ h⟩ -+ -+lemma Icc_zero_eq_insert (n : ℕ) : Icc 0 n = insert 0 (Icc 1 n) := by -+ ext m; simp [mem_Icc]; omega -+ -+theorem chebyshev_asymptotic : θ ~[atTop] id := by -+ refine Asymptotics.IsEquivalent.add_isLittleO'' WeakPNT'' -+ (IsBigO.trans_isLittleO (g := fun x ↦ 2 * x.sqrt * x.log) ?_ ?_) -+ · rw [isBigO_iff']; refine ⟨1, one_pos, ?_⟩ -+ simp only [one_mul, eventually_atTop] -+ exact ⟨2, fun x hx ↦ by -+ rw [Pi.sub_apply, norm_eq_abs, norm_eq_abs, abs_of_nonneg (by bound : 0 ≤ 2 * √x * log x)] -+ exact (abs_of_nonneg (sub_nonneg.mpr (Chebyshev.theta_le_psi x))).symm ▸ -+ Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log (by linarith : 1 ≤ x)⟩ -+ · simpa only [mul_assoc] using! isLittleO_sqrt_mul_log.const_mul_left 2 -+ -+theorem chebyshev_asymptotic_finsum : -+ (fun x ↦ ∑ᶠ (p : ℕ) (_ : p ≤ x) (_ : Nat.Prime p), log p) ~[atTop] fun x ↦ x := by -+ have hReal : -+ (fun x : ℝ ↦ ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ)) ~[atTop] -+ fun x ↦ x := by -+ have h x : ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ) = θ x := by -+ rw [Chebyshev.theta_eq_sum_Icc] -+ have hfin : {p : ℕ | (p : ℝ) ≤ x ∧ p.Prime}.Finite := -+ (Iic ⌊x⌋₊).finite_toSet.subset fun p ⟨hpx, _⟩ ↦ mem_Iic.mpr (Nat.le_floor hpx) -+ calc ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ) -+ = ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x ∧ p.Prime), log (p : ℝ) := -+ finsum_congr fun p ↦ by by_cases hp : p.Prime <;> simp [hp] -+ _ = ∑ p ∈ hfin.toFinset, log (p : ℝ) := finsum_mem_eq_finite_toFinset_sum _ hfin -+ _ = _ := sum_congr (by ext p; simp only [Set.Finite.mem_toFinset, Set.mem_ofPred_eq, -+ mem_filter, mem_Icc, and_congr_left_iff]; exact fun hp ↦ -+ ⟨fun hpx ↦ ⟨Nat.zero_le _, Nat.le_floor hpx⟩, fun ⟨_, hpn⟩ ↦ -+ (le_or_gt 0 x).elim -+ (fun hx ↦ (Nat.floor_le hx).trans' (Nat.cast_le.mpr hpn)) fun hx ↦ -+ absurd (Nat.le_zero.mp (Nat.floor_eq_zero.mpr (hx.trans_le zero_le_one) ▸ hpn)) -+ hp.ne_zero⟩) (fun _ _ ↦ rfl) -+ have heq : -+ (fun x : ℝ ↦ ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ)) =ᶠ[atTop] θ := -+ Filter.Eventually.of_forall h -+ exact chebyshev_asymptotic.congr_left heq.symm -+ simp only [IsEquivalent, -+ show (fun n : ℕ ↦ ∑ᶠ (p : ℕ) (_ : p ≤ n) (_ : p.Prime), log (p : ℝ)) = -+ (fun x : ℝ ↦ ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ)) ∘ Nat.cast -+ from funext fun _ ↦ finsum_congr fun _ ↦ by simp] -+ exact hReal.isLittleO.comp_tendsto tendsto_natCast_atTop_atTop -+ -+theorem chebyshev_asymptotic' : -+ ∃ (f : ℝ → ℝ), -+ (∀ ε > (0 : ℝ), (f =o[atTop] fun t ↦ ε * t)) ∧ -+ (∀ (x : ℝ), 2 ≤ x → IntegrableOn f (Set.Icc 2 x)) ∧ -+ ∀ (x : ℝ), θ x = x + f x := by -+ have H := chebyshev_asymptotic -+ rw [IsEquivalent, isLittleO_iff] at H -+ let f := (fun x ↦ θ x - x) -+ have integrable (x : ℝ) (hx : 2 ≤ x) : IntegrableOn f (Set.Icc 2 x) := by -+ rw [IntegrableOn] -+ refine Integrable.sub ?_ (ContinuousOn.integrableOn_Icc (continuousOn_id' _)) -+ refine Chebyshev.integrableOn_theta_div_id_mul_log_sq x |>.mul_continuousOn (g' := fun t => t * log t ^ 2) -+ (ContinuousOn.mul (continuousOn_id' _) (ContinuousOn.pow (continuousOn_log |>.mono <| by -+ rintro t ⟨ht1, _⟩ -+ simp only [Set.mem_compl_iff, Set.mem_singleton_iff] -+ linarith) 2)) isCompact_Icc |>.congr_fun_ae ?_ -+ simp only [measurableSet_Icc, ae_restrict_eq, EventuallyEq, eventually_inf_principal] -+ refine .of_forall fun t ⟨ht1, _⟩ => ?_ -+ rw [div_mul_cancel₀] -+ simpa only [ne_eq, _root_.mul_eq_zero, OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff, -+ log_eq_zero, or_self_left, not_or] using ⟨by linarith, by linarith, by linarith⟩ -+ refine ⟨f, fun ε hε ↦ ?_, integrable, ?_⟩ -+ · rw [isLittleO_iff] -+ intro c hc -+ specialize @H (c * ε) (mul_pos hc hε) -+ simp only [Pi.sub_apply, norm_eq_abs, mul_assoc, eventually_atTop, norm_mul, -+ abs_of_pos hε, f] at H ⊢ -+ exact H -+ refine fun r => by simp [f] -+ -+theorem chebyshev_asymptotic'' : -+ ∃ (f : ℝ → ℝ), -+ (∀ ε > (0 : ℝ), (f =o[atTop] fun _ ↦ ε)) ∧ -+ (∀ (x : ℝ), 2 ≤ x → IntegrableOn f (Set.Icc 2 x)) ∧ -+ ∀ x > (0 : ℝ), θ x = x + x * (f x) := by -+ obtain ⟨f, hf1, inte, hf2⟩ := chebyshev_asymptotic' -+ refine ⟨fun t => f t / t, fun ε hε ↦ ?_, ?_, ?_⟩ -+ · simp only [isLittleO_iff, norm_eq_abs, norm_mul, eventually_atTop, -+ norm_div] at hf1 ⊢ -+ intro r hr -+ replace hf1 := hf1 ε hε -+ obtain ⟨N, hN⟩ := hf1 hr -+ use |N| + 1 -+ intro x hx -+ have hx' : |N| + 1 ≤ |x| := by rwa [abs_of_nonneg (a := x) (le_trans (by positivity) hx)] -+ rw [div_le_iff₀ (lt_of_lt_of_le (by positivity) hx'), mul_assoc] -+ exact hN x (le_trans (le_trans (le_abs_self N) (by linarith)) hx) -+ -+ · intro x hx -+ refine inte x hx |>.mul_continuousOn (g' := fun t : ℝ => t⁻¹) -+ (continuousOn_inv₀ |>.mono <| by -+ rintro t ⟨ht1, _⟩ -+ simp only [Set.mem_compl_iff, Set.mem_singleton_iff] -+ linarith) isCompact_Icc |>.congr_fun_ae <| .of_forall <| by simp [div_eq_mul_inv] -+ intro x hx -+ rw [hf2, mul_div_cancel₀] -+ linarith -+ -+theorem primorial_bounds : -+ ∃ E : ℝ → ℝ, E =o[atTop] (fun x ↦ x) ∧ -+ ∀ x : ℝ, ∏ p ∈ (Iic ⌊x⌋₊).filter Nat.Prime, p = exp (x + E x) := by -+ use (fun x ↦ ∑ p ∈ (filter Nat.Prime (Iic ⌊x⌋₊)), log p - x) -+ constructor -+ · exact Asymptotics.IsEquivalent.isLittleO chebyshev_asymptotic -+ intro x -+ simp only [cast_prod, add_sub_cancel, exp_sum] -+ apply Finset.prod_congr rfl -+ intros x hx -+ rw[Real.exp_log] -+ rw[Finset.mem_filter] at hx -+ norm_cast -+ exact Nat.Prime.pos hx.right -+ -+theorem primorial_bounds_finprod : -+ ∃ E : ℝ → ℝ, E =o[atTop] (fun x ↦ x) ∧ -+ ∀ x : ℝ, ∏ᶠ (p : ℕ) (_ : p ≤ x) (_ : Nat.Prime p), p = exp (x + E x) := by -+ obtain ⟨E, hE, hprod⟩ := primorial_bounds -+ refine ⟨E, hE, fun x ↦ ?_⟩ -+ have hfin : {p : ℕ | (p : ℝ) ≤ x ∧ p.Prime}.Finite := -+ (Iic ⌊x⌋₊).finite_toSet.subset fun p ⟨hpx, _⟩ ↦ mem_Iic.mpr <| le_floor hpx -+ have heq : ∏ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), p = -+ ∏ p ∈ (Iic ⌊x⌋₊).filter Prime, p := by -+ calc ∏ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), p -+ = ∏ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x ∧ p.Prime), p := -+ finprod_congr fun p ↦ by by_cases hp : p.Prime <;> simp [hp] -+ _ = ∏ p ∈ hfin.toFinset, p := finprod_mem_eq_finite_toFinset_prod _ hfin -+ _ = _ := prod_congr (by ext p; simp only [Set.Finite.mem_toFinset, Set.mem_ofPred_eq, -+ mem_filter, mem_Iic, and_congr_left_iff]; exact fun hp ↦ -+ ⟨le_floor, fun hpn ↦ (le_or_gt 0 x).elim -+ (fun hx ↦ (Nat.floor_le hx).trans' (cast_le.mpr hpn)) fun hx ↦ -+ absurd (le_zero.mp (floor_eq_zero.mpr (hx.trans_le zero_le_one) ▸ hpn)) -+ hp.ne_zero⟩) (fun _ _ ↦ rfl) -+ simp only [heq, hprod] -+ -+lemma continuousOn_log0 : -+ ContinuousOn (fun x ↦ -1 / (x * log x ^ 2)) {0, 1, -1}ᶜ := by -+ refine fun t ht ↦ ContinuousAt.continuousWithinAt ?_ -+ fun_prop (disch := simp_all) -+ -+lemma continuousOn_log1 : ContinuousOn (fun x ↦ (log x ^ 2)⁻¹ * x⁻¹) {0, 1, -1}ᶜ := by -+ refine fun t ht ↦ ContinuousAt.continuousWithinAt ?_ -+ fun_prop (disch := simp_all) -+ -+lemma integral_log_inv (a b : ℝ) (ha : 2 ≤ a) (hb : a ≤ b) : -+ ∫ t in a..b, (log t)⁻¹ = -+ ((log b)⁻¹ * b) - ((log a)⁻¹ * a) + -+ ∫ t in a..b, ((log t)^2)⁻¹ := by -+ rw [le_iff_lt_or_eq] at hb -+ rcases hb with hb | rfl; swap -+ · simp only [intervalIntegral.integral_same, sub_self, add_zero] -+ · have := intervalIntegral.integral_mul_deriv_eq_deriv_mul -+ (u := fun x => (log x)⁻¹) -+ (u' := fun x => -1 / (x * (log x)^2)) -+ (v := fun x => x) -+ (v' := fun _ => 1) (a := a) (b := b) -+ (fun x hx => by -+ rw [Set.uIcc_eq_union, Set.Icc_eq_empty (lt_iff_not_ge |>.1 hb), Set.union_empty] at hx -+ obtain ⟨hx1, _⟩ := hx -+ rw [show (-1 / (x * log x ^ 2)) = (-1 / log x ^ 2) * (x⁻¹) by -+ rw [mul_comm x]; field_simp] -+ apply HasDerivAt.comp -+ (h := fun t => log t) (h₂ := fun t => t⁻¹) (x := x) -+ · simpa using! HasDerivAt.inv (c := fun t : ℝ => t) (c' := 1) (x := log x) -+ (hasDerivAt_id' (log x)) -+ (by simp only [ne_eq, log_eq_zero, not_or]; refine ⟨?_, ?_, ?_⟩ <;> linarith) -+ · apply hasDerivAt_log; linarith) -+ (fun x _ => hasDerivAt_id' x) -+ (by -+ rw [intervalIntegrable_iff_integrableOn_Icc_of_le (le_of_lt hb)] -+ apply ContinuousOn.integrableOn_Icc -+ refine continuousOn_log0.mono fun x hx ↦ ?_ -+ simp only [Set.mem_Icc, Set.mem_compl_iff, Set.mem_insert_iff, Set.mem_singleton_iff, -+ not_or] at hx ⊢ -+ refine ⟨?_, ?_, ?_⟩ <;> linarith) -+ (by -+ constructor <;> -+ apply MeasureTheory.integrable_const) -+ simp only [mul_one] at this -+ rw [this] -+ simp_rw [neg_div, neg_mul] -+ rw [sub_eq_add_neg] -+ congr 1 -+ rw [intervalIntegral.integral_of_le (le_of_lt hb), -+ intervalIntegral.integral_of_le (le_of_lt hb), -+ ← MeasureTheory.integral_neg] -+ simp_rw [neg_neg] -+ refine integral_congr_ae ?_ -+ · rw [ae_restrict_eq, eventuallyEq_inf_principal_iff] -+ · refine .of_forall fun x hx => ?_ -+ simp only [Set.mem_Ioc, one_div, mul_inv_rev, mul_assoc] at hx ⊢ -+ rw [inv_mul_cancel₀, mul_one] -+ linarith -+ exact measurableSet_Ioc -+ -+lemma integral_log_inv' (a b : ℝ) (ha : 2 ≤ a) (hb : a ≤ b) : -+ ∫ t in Set.Icc a b, (log t)⁻¹ = -+ ((log b)⁻¹ * b) - ((log a)⁻¹ * a) + -+ ∫ t in Set.Icc a b, ((log t)^2)⁻¹ := by -+ have := integral_log_inv a b ha hb -+ simp only [intervalIntegral.intervalIntegral_eq_integral_uIoc, ite_eq_left hb, Set.uIoc_of_le hb, -+ smul_eq_mul, one_mul] at this -+ rw [integral_Icc_eq_integral_Ioc, integral_Icc_eq_integral_Ioc] -+ rw [this] -+ -+lemma integral_log_inv'' (a b : ℝ) (ha : 2 ≤ a) (hb : a ≤ b) : -+ (log a)⁻¹ * a + ∫ t in Set.Icc a b, (log t)⁻¹ = -+ ((log b)⁻¹ * b) + ∫ t in Set.Icc a b, ((log t)^2)⁻¹ := by -+ rw [integral_log_inv' a b ha hb] -+ group -+ -+lemma integral_log_inv_pos (x : ℝ) (hx : 2 < x) : -+ 0 < ∫ t in Set.Icc 2 x, (log t)⁻¹ := by -+ classical -+ rw [MeasureTheory.integral_pos_iff_support_of_nonneg_ae] -+ · simp only [Function.support_inv, measurableSet_Icc, Measure.restrict_apply'] -+ rw [show Function.support log ∩ Set.Icc 2 x = Set.Icc 2 x by -+ rw [Set.inter_eq_right] -+ intro t ht -+ simp only [Set.mem_Icc, Function.mem_support, ne_eq, log_eq_zero, not_or] at ht ⊢ -+ exact ⟨by linarith, by linarith, by linarith⟩] -+ simpa -+ · simp only [measurableSet_Icc, ae_restrict_eq, EventuallyLE, eventually_inf_principal] -+ refine .of_forall fun t (ht : _ ∧ _) => ?_ -+ simpa only [Pi.zero_apply, inv_nonneg] using log_nonneg (by linarith) -+ · apply ContinuousOn.integrableOn_Icc -+ apply ContinuousOn.inv₀ -+ · exact (continuousOn_log).mono <| by aesop -+ -+ · rintro t ⟨ht, -⟩ -+ simp only [ne_eq, log_eq_zero, not_or] -+ exact ⟨by linarith, by linarith, by linarith⟩ -+ -+lemma integral_log_inv_ne_zero (x : ℝ) (hx : 2 < x) : -+ ∫ t in Set.Icc 2 x, (log t)⁻¹ ≠ 0 := by -+ have := integral_log_inv_pos x hx -+ linarith -+ -+lemma pi_asymp_aux (x : ℝ) (hx : 2 ≤ x) : Nat.primeCounting ⌊x⌋₊ = -+ (log x)⁻¹ * θ x + ∫ t in Set.Icc 2 x, θ t * (t * log t ^ 2)⁻¹ := by -+ rw [th43_b _ hx] -+ simp_rw [div_eq_mul_inv, Chebyshev.theta_eq_sum_Icc] -+ ring_nf! -+ -+theorem pi_asymp'' : -+ (fun x => ((Nat.primeCounting ⌊x⌋₊ : ℝ) / ∫ t in Set.Icc 2 x, 1 / log t) - (1 : ℝ)) =o[atTop] -+ fun _ => (1 : ℝ) := by -+ obtain ⟨f, hf, f_int, hf'⟩ := chebyshev_asymptotic'' -+ have eq1 : ∀ᶠ (x : ℝ) in atTop, -+ ⌊x⌋₊.primeCounting = -+ (log x)⁻¹ * (x + x * f x) + -+ (∫ t in Set.Icc 2 x, -+ (t + t * f t) * (t * log t ^ 2)⁻¹) := by -+ filter_upwards [eventually_ge_atTop 2] with x hx -+ rw [pi_asymp_aux x hx, hf' x (by linarith)] -+ congr 1 -+ apply setIntegral_congr_fun measurableSet_Icc fun t ht ↦ ?_ -+ rw [hf' t (by grind)] -+ -+ replace eq1 : -+ ∀ᶠ (x : ℝ) in atTop, -+ ⌊x⌋₊.primeCounting = -+ (log x)⁻¹ * (x + x * f x) + -+ ((∫ t in Set.Icc 2 x, (log t ^ 2)⁻¹) + -+ (∫ t in Set.Icc 2 x, (f t) * (log t ^ 2)⁻¹)) := by -+ filter_upwards [eq1, eventually_ge_atTop 2] with x eq1 hx -+ rw [eq1] -+ congr -+ simp_rw [mul_inv_rev, add_mul] -+ rw [MeasureTheory.integral_add] -+ · congr 1 -+ all_goals -+ apply setIntegral_congr_fun measurableSet_Icc fun t ht ↦ ?_ -+ field [show t ≠ 0 by grind] -+ · apply IntegrableOn.mul_continuousOn -+ (hg := ContinuousOn.integrableOn_Icc <| continuousOn_id' _) -+ (hK := isCompact_Icc) -+ apply continuousOn_log1.mono ?_ -+ intro y h -+ simp only [Set.mem_Icc, Set.mem_compl_iff, Set.mem_insert_iff, -+ Set.mem_singleton_iff, not_or] at h ⊢ -+ exact ⟨by linarith, by linarith, by linarith⟩ -+ · rw [show (fun t ↦ t * f t * ((log t ^ 2)⁻¹ * t⁻¹)) = -+ fun t ↦ f t * (t * (log t ^ 2)⁻¹ * t⁻¹) by ext; ring] -+ apply IntegrableOn.mul_continuousOn (hK := isCompact_Icc) -+ · apply f_int x (by linarith) -+ · simp_rw [mul_assoc] -+ refine ContinuousOn.mul (continuousOn_id' (Set.Icc 2 x)) ?_ -+ apply continuousOn_log1.mono ?_ -+ intro y h -+ simp only [Set.mem_Icc, Set.mem_compl_iff, Set.mem_insert_iff, -+ Set.mem_singleton_iff, not_or] at h ⊢ -+ exact ⟨by linarith, by linarith, by linarith⟩ -+ -+ simp_rw [mul_add] at eq1 -+ simp_rw [show ∀ (x : ℝ), -+ (log x)⁻¹ * x + (log x)⁻¹ * (x * f x) + -+ ((∫ (t : ℝ) in Set.Icc 2 x, (log t ^ 2)⁻¹) + -+ ∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) = -+ ((log x)⁻¹ * x + (∫ (t : ℝ) in Set.Icc 2 x, (log t ^ 2)⁻¹)) + -+ ((log x)⁻¹ * (x * f x) + -+ ∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) -+ by intros; ring] at eq1 -+ -+ replace eq1 : -+ ∃ (C : ℝ), ∀ᶠ (x : ℝ) in atTop, -+ ⌊x⌋₊.primeCounting = -+ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ ((log x)⁻¹ * (x * f x) + -+ ∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) + -+ C := by -+ use ((log 2)⁻¹ * 2) -+ filter_upwards [eq1, eventually_ge_atTop 2] with x eq1 hx -+ rw [eq1, ← integral_log_inv'' _ _ (by rfl) hx] -+ ring -+ replace eq1 : -+ ∃ (C : ℝ), ∀ᶠ (x : ℝ) in atTop, -+ (⌊x⌋₊.primeCounting / ∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) - 1 = -+ ((log x)⁻¹ * (x * f x) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ (∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) / -+ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹)) + -+ C / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by -+ obtain ⟨C, hC⟩ := eq1 -+ use C -+ filter_upwards [hC, eventually_gt_atTop 2] with x hC hx -+ rw [hC] -+ field [integral_log_inv_ne_zero] -+ simp_rw [isLittleO_iff] at hf -+ choose C hC using eq1 -+ simp_rw [← one_div] at hC -+ apply isLittleO_congr hC (by rfl) |>.mpr -+ have ineq1 (ε : ℝ) (hε : 0 < ε) (c : ℝ) (hc : 0 < c) : ∀ᶠ(x : ℝ) in atTop, -+ (log x)⁻¹ * x * |f x| ≤ c * ε * ((log x)⁻¹ * x) := by -+ filter_upwards [eventually_ge_atTop 2, hf ε hε hc] with x hx hM -+ simp only [norm_eq_abs] at hM -+ rw [abs_of_pos hε] at hM -+ rw [mul_comm (c * ε)] -+ gcongr -+ bound -+ have int_flog {a b : ℝ} (ha: 2 ≤ a) (hb : 2 ≤ b) : -+ IntegrableOn (fun t ↦ |f t| * (log t ^ 2)⁻¹) (Set.Icc a b) volume := by -+ apply IntegrableOn.mul_continuousOn -+ · apply Integrable.abs <| f_int b hb |>.mono (Set.Icc_subset_Icc_left ha) (by rfl) -+ · refine ContinuousOn.inv₀ (ContinuousOn.pow (continuousOn_log |>.mono ?_) 2) ?_ -+ · simp -+ grind -+ · intro t ht -+ simp only [Set.mem_Icc, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, -+ pow_eq_zero_iff, log_eq_zero, not_or] at ht ⊢ -+ exact ⟨by linarith, by linarith, by linarith⟩ -+ · exact isCompact_Icc -+ have int_inv_log_sq {a b : ℝ} (ha : 2 ≤ a) (hb : 2 ≤ b) : -+ IntegrableOn (fun t ↦ (log t ^ 2)⁻¹) (Set.Icc a b) volume := by -+ refine ContinuousOn.integrableOn_Icc <| -+ ContinuousOn.inv₀ (ContinuousOn.pow (continuousOn_log |>.mono ?_) 2) ?_ -+ · grind -+ · intro t ht -+ simp only [Set.mem_Icc, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, -+ pow_eq_zero_iff, log_eq_zero, not_or] at ht ⊢ -+ exact ⟨by linarith, by linarith, by linarith⟩ -+ simp_rw [eventually_atTop] at hf -+ choose M hM using hf -+ have ineq2 (ε : ℝ) (hε : 0 < ε) (c : ℝ) (hc : 0 < c) : -+ ∃ (D : ℝ), -+ ∀ᶠ (x : ℝ) in atTop, -+ |∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹| ≤ -+ c * ε * ((∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) - (log x)⁻¹ * x) + D := by -+ use (((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), |f t| * (log t ^ 2)⁻¹) - -+ c * ε * ∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹) + -+ c * ε * ((log 2)⁻¹ * 2)) -+ filter_upwards [eventually_gt_atTop (max 2 (M ε hε hc))] with x hx -+ calc _ -+ _ ≤ ∫ (t : ℝ) in Set.Icc 2 x, |f t * (log t ^ 2)⁻¹| := -+ norm_integral_le_integral_norm fun a ↦ f a * (log a ^ 2)⁻¹ -+ _ = ∫ (t : ℝ) in Set.Icc 2 x, |f t| * (log t ^ 2)⁻¹ := by -+ apply setIntegral_congr_fun measurableSet_Icc fun t ht ↦ ?_ -+ rw [abs_mul, abs_of_nonneg (a := (log t ^ 2)⁻¹)] -+ norm_num -+ apply pow_nonneg -+ exact log_nonneg <| by grind -+ _ = (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), -+ |f t| * (log t ^ 2)⁻¹) + -+ (∫ (t : ℝ) in Set.Icc (max 2 (M ε hε hc)) x, -+ |f t| * (log t ^ 2)⁻¹) := by -+ rw [← setIntegral_union₀, Set.Icc_union_Icc_eq_Icc (le_max_left ..) hx.le] -+ · rw [AEDisjoint, Set.Icc_inter_Icc_eq_singleton (le_max_left ..) hx.le, volume_singleton] -+ · simp only [measurableSet_Icc, MeasurableSet.nullMeasurableSet] -+ · apply int_flog (by rfl) (le_max_left ..) -+ · apply int_flog (le_max_left ..) (le_trans (le_max_left ..) hx.le) -+ _ ≤ (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), -+ |f t| * (log t ^ 2)⁻¹) + -+ (∫ (t : ℝ) in Set.Icc (max 2 (M ε hε hc)) x, -+ (c * ε) * (log t ^ 2)⁻¹) := by -+ gcongr 1 -+ apply setIntegral_mono_on -+ · apply int_flog (le_max_left ..) (le_trans (le_max_left ..) hx.le) -+ · rw [IntegrableOn, integrable_const_mul_iff] -+ · apply int_inv_log_sq (le_max_left ..) (le_trans (le_max_left ..) hx.le) -+ · simp only [isUnit_iff_ne_zero, ne_eq, _root_.mul_eq_zero, not_or] -+ exact ⟨by linarith, by linarith⟩ -+ · exact measurableSet_Icc -+ · intro t ht -+ simp only [Set.mem_Icc, sup_le_iff] at ht -+ apply mul_le_mul_of_nonneg_right -+ · refine hM ε hε hc t ht.1.2 |>.trans ?_ -+ simp only [norm_eq_abs, abs_of_pos hε, le_refl] -+ · norm_num -+ refine pow_nonneg (log_nonneg <| by linarith) 2 -+ _ = (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), -+ |f t| * (log t ^ 2)⁻¹) + -+ ((c * ε) * ∫ (t : ℝ) in Set.Icc (max 2 (M ε hε hc)) x, (log t ^ 2)⁻¹) := by -+ congr 1 -+ exact integral_const_mul (c * ε) _ -+ _ = (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), -+ |f t| * (log t ^ 2)⁻¹) + -+ ((c * ε) * -+ ((∫ (t : ℝ) in Set.Icc (max 2 (M ε hε hc)) x, (log t ^ 2)⁻¹) + -+ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)) - -+ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)))) := by -+ ring -+ _ = (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), -+ |f t| * (log t ^ 2)⁻¹) + -+ ((c * ε) * -+ ((∫ (t : ℝ) in Set.Icc 2 x, (log t ^ 2)⁻¹) - -+ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)))) := by -+ congr 3 -+ rw [add_comm, ← setIntegral_union₀, Set.Icc_union_Icc_eq_Icc (le_max_left ..) hx.le] -+ · rw [AEDisjoint, Set.Icc_inter_Icc_eq_singleton (le_max_left ..) hx.le, -+ volume_singleton] -+ · simp only [measurableSet_Icc, MeasurableSet.nullMeasurableSet] -+ · apply int_inv_log_sq (by rfl) (le_max_left ..) -+ · apply int_inv_log_sq (le_max_left ..) (le_trans (le_max_left ..) hx.le) -+ _ = ((c * ε) * (∫ (t : ℝ) in Set.Icc 2 x, (log t ^ 2)⁻¹)) + -+ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), -+ |f t| * (log t ^ 2)⁻¹) - -+ (c * ε) * (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)) := by -+ ring -+ _ = ((c * ε) * ((∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ ((log 2)⁻¹ * 2) - ((log x)⁻¹ * x))) + -+ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), -+ |f t| * (log t ^ 2)⁻¹) - -+ (c * ε) * (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)) := by -+ congr 2 -+ rw [integral_log_inv' _ _ (by rfl)] -+ · ring -+ · simp only [max_lt_iff] at hx -+ linarith -+ _ = _ := by ring -+ choose D hD using ineq2 -+ -+ have ineq4 (const : ℝ) (ε : ℝ) (hε : 0 < ε) : -+ ∀ᶠ x in atTop, |const / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹)| ≤ 1/2 * ε := by -+ obtain rfl|hconst := eq_or_ne const 0 -+ · filter_upwards with x -+ simp[hε.le] -+ have ineq (x : ℝ) (hx : 2 < x) := -+ calc (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) -+ _ ≥ (∫ (_ : ℝ) in Set.Icc 2 x, (log x)⁻¹) := by -+ apply setIntegral_mono_on (integrable_const _) -+ · refine ContinuousOn.integrableOn_Icc <| -+ ContinuousOn.inv₀ (continuousOn_log |>.mono ?_) ?_ -+ · simp only [Set.subset_compl_singleton_iff, Set.mem_Icc, not_and, not_le, -+ isEmpty_Prop, ofNat_pos, IsEmpty.forall_iff] -+ · intro t ht -+ simp only [Set.mem_Icc, ne_eq, log_eq_zero, not_or] at ht ⊢ -+ exact ⟨by linarith, by linarith, by linarith⟩ -+ · exact measurableSet_Icc -+ · intro t ⟨ht1, ht2⟩ -+ gcongr -+ bound -+ _ = (x - 2) * (log x)⁻¹ := by -+ rw [MeasureTheory.integral_const] -+ simp only [MeasurableSet.univ, Measure.restrict_apply, Set.univ_inter, volume_Icc, -+ smul_eq_mul, mul_eq_mul_right_iff, ENNReal.toReal_ofReal_eq_iff, sub_nonneg, -+ inv_eq_zero, log_eq_zero, Measure.real] -+ refine Or.inl (le_of_lt hx) -+ -+ simp_rw [abs_div] -+ have ineq (x : ℝ) (hx : 2 < x) : -+ |const| / |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| ≤ -+ |const| / ((x - 2) * (log x)⁻¹) := by -+ apply div_le_div₀ (abs_nonneg _) (by rfl) -+ · apply mul_pos -+ · linarith -+ · norm_num -+ rw [Real.log_pos_iff] -+ · linarith -+ · linarith -+ · rw [abs_of_pos (integral_log_inv_pos _ hx)] -+ exact ineq x hx -+ have ineq (x : ℝ) (hx : 2 < x) : -+ |const| / |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| ≤ -+ |const| * (log x / ((x - 2))) := by -+ refine ineq x hx |>.trans <| le_of_eq ?_ -+ field_simp -+ have lim := Real.tendsto_pow_log_div_mul_add_atTop 1 (-2) 1 (by norm_num) -+ simp only [pow_one, one_mul, ← sub_eq_add_neg] at lim -+ rw [tendsto_atTop_nhds] at lim -+ specialize lim (Metric.ball 0 ((1/2) * ε / |const| : ℝ)) (by -+ simp only [Metric.mem_ball, dist_self] -+ apply _root_.div_pos -+ · linarith -+ · simpa only [abs_pos, ne_eq]) Metric.isOpen_ball -+ obtain ⟨M, hM⟩ := lim -+ rw [eventually_atTop] -+ refine ⟨max 3 M, ?_⟩ -+ intro x hx -+ simp only [Metric.mem_ball, dist_zero_right, max_le_iff, norm_eq_abs] at hM hx -+ refine ineq x (by linarith) |>.trans ?_ -+ specialize hM x hx.2 -+ rw [abs_of_nonneg (by -+ apply div_nonneg -+ · refine log_nonneg (by linarith) -+ · linarith)] at hM -+ have ineq' : |const| * (log x / (x - 2)) < |const| * ((1/2) * ε / |const|) := by -+ rw [mul_lt_mul_iff_right₀] -+ · exact hM -+ · simpa only [abs_pos, ne_eq] -+ rw [mul_div_cancel₀] at ineq' -+ · refine le_of_lt ineq' -+ · simpa only [ne_eq, abs_eq_zero] -+ rw [isLittleO_iff] -+ intro ε hε -+ specialize ineq4 (|D ε hε (1/2) (by linarith)| + |C|) ε hε -+ simp only [one_div, norm_eq_abs, norm_one, mul_one] -+ filter_upwards [eventually_gt_atTop 2, ineq4, ineq1 ε hε (1 / 2) (by norm_num), -+ hD ε hε (1 / 2) (by norm_num)] with x hx hB ineq1 hD -+ have := integral_log_inv_pos x (by linarith) |>.le -+ calc _ -+ _ ≤ |((log x)⁻¹ * (x * f x) / ∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹)| + -+ |(∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) / -+ ∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| + -+ |C / ∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| := by -+ apply abs_add_three -+ _ = |(log x)⁻¹ * (x * f x)| / |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| + -+ |(∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹)| / -+ |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| + -+ |C| / |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| := by -+ rw [abs_div, abs_div, abs_div] -+ _ = |(log x)⁻¹ * (x * f x)| / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ |(∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹)| / -+ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ |C| / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by -+ repeat rw [abs_of_pos <| integral_log_inv_pos _ (by linarith)] -+ _ = ((log x)⁻¹ * x * |f x|) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ |(∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹)| / -+ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ |C| / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by -+ congr -+ rw [abs_mul, abs_mul, abs_of_nonneg (by bound), abs_of_nonneg (by linarith), mul_assoc] -+ _ ≤ ((1/2) * ε * ((log x)⁻¹ * x)) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ ((1/2) * ε * ((∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) - (log x)⁻¹ * x) + -+ D ε hε (1/2) (by linarith)) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ |C| / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by -+ gcongr -+ _ = ((1/2) * ε * (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹)) / -+ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + -+ (D ε hε (1/2) (by linarith) + |C|) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by -+ ring -+ _ = (1/2) * ε + (D ε hε (1/2) (by linarith) + |C|) / -+ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by -+ congr 1 -+ rw [mul_div_assoc, div_self, mul_one] -+ apply integral_log_inv_ne_zero -+ linarith -+ _ ≤ (1/2) * ε + (|D ε hε (1/2) (by linarith)| + |C|) / -+ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by -+ gcongr -+ apply le_abs_self -+ _ ≤ (1/2) * ε + (1/2) * ε := by -+ rw [abs_div, abs_of_nonneg, abs_of_pos (a := ∫ _ in _, _)] at hB -+ · gcongr -+ · apply integral_log_inv_pos; linarith -+ · positivity -+ _ = ε := by -+ field -+ -+theorem pi_asymp : -+ ∃ c : ℝ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ -+ ∀ᶠ (x : ℝ) in atTop, -+ Nat.primeCounting ⌊x⌋₊ = (1 + c x) * ∫ t in (2 : ℝ)..x, 1 / (log t) := by -+ refine ⟨_, pi_asymp'', ?_⟩ -+ filter_upwards [eventually_ge_atTop 3] with x hx -+ rw [intervalIntegral.integral_of_le (by linarith), -+ ← MeasureTheory.integral_Icc_eq_integral_Ioc] -+ field [(integral_log_inv_pos x (by linarith)).ne'] -+ -+lemma inv_div_log_asy : ∃ c, ∀ᶠ (x : ℝ) in atTop, -+ ∫ (t : ℝ) in Set.Icc 2 x, 1 / log t ^ 2 ≤ c * (x / log x ^ 2) := by -+ have := Chebyshev.integral_one_div_log_sq_isBigO -+ rw [isBigO_iff] at this -+ obtain ⟨c, hc⟩ := this -+ use c -+ filter_upwards [hc, eventually_ge_atTop 2] with x hc hx -+ rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hx] -+ apply le_trans (by apply le_norm_self) -+ nth_rewrite 2 [norm_of_nonneg (by positivity)] at hc -+ exact hc -+ -+lemma integral_log_inv_pialt (x : ℝ) (hx : 4 ≤ x) : ∫ (t : ℝ) in Set.Icc 2 x, 1 / log t = -+ x / log x - 2 / log 2 + ∫ (t : ℝ) in Set.Icc 2 x, 1 / (log t) ^ 2 := by -+ have := integral_log_inv 2 x (by norm_num) (by linarith) -+ rw [MeasureTheory.integral_Icc_eq_integral_Ioc, -+ ← intervalIntegral.integral_of_le (by linarith [hx]), -+ MeasureTheory.integral_Icc_eq_integral_Ioc, -+ ← intervalIntegral.integral_of_le (by linarith [hx]), -+ ← mul_one_div, one_div, ← mul_one_div, one_div] -+ simp only [one_div, this, mul_comm] -+ -+lemma integral_div_log_asymptotic : ∃ c : ℝ → ℝ, c =o[atTop] (fun _ ↦ (1:ℝ)) ∧ -+ ∀ᶠ (x : ℝ) in atTop, ∫ t in Set.Icc 2 x, 1 / (log t) = (1 + c x) * x / (log x) := by -+ obtain ⟨c, hc⟩ := inv_div_log_asy -+ use fun x => ((∫ (t : ℝ) in Set.Icc 2 x, 1 / log t ^ 2) - 2 / log 2) * log x / x -+ constructor -+ · simp_rw [mul_div_assoc, mul_comm] -+ apply isLittleO_mul_iff_isLittleO_div _|>.mpr -+ · simp_rw [one_div_div] -+ apply IsLittleO.sub -+ · apply IsBigO.trans_isLittleO (g := (fun x ↦ x / log x ^ 2)) -+ · rw [isBigO_iff] -+ use c -+ filter_upwards [eventually_ge_atTop 2, hc] with x hx hc -+ simp only [norm_eq_abs] -+ rwa [abs_of_nonneg, abs_of_nonneg] -+ · bound -+ · apply setIntegral_nonneg measurableSet_Icc fun t ht ↦ (by bound) -+ apply isLittleO_of_tendsto -+ · simp -+ apply tendsto_log_atTop.inv_tendsto_atTop.congr' -+ filter_upwards [eventually_ne_atTop 0] with x hx -+ simp only [Pi.inv_apply] -+ field -+ apply isLittleO_mul_iff_isLittleO_div _|>.mp -+ · conv => arg 2; ext; rw [mul_comm] -+ apply IsLittleO.const_mul_left isLittleO_log_id_atTop -+ · filter_upwards [eventually_ge_atTop 2] with x hx -+ simp; grind -+ filter_upwards [eventually_ge_atTop 2] with x hx -+ simp -+ grind -+ · filter_upwards [eventually_ge_atTop 4] with x hx -+ rw [integral_log_inv_pialt x hx] -+ field [show log x ≠ 0 by simp; grind] -+ -+theorem pi_alt : ∃ c : ℝ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ -+ ∀ x : ℝ, Nat.primeCounting ⌊x⌋₊ = (1 + c x) * x / log x := by -+ obtain ⟨f, hf, h⟩ := pi_asymp -+ obtain ⟨f', hf', h'⟩ := integral_div_log_asymptotic -+ use (fun x => (log x / x) * ⌊x⌋₊.primeCounting - 1) -+ constructor -+ · apply IsLittleO.congr' (f₁ := (fun x ↦ f x + f x * f' x + f' x)) _ _ (by rfl) -+ · apply IsLittleO.add _ hf' -+ apply IsLittleO.add hf -+ convert! hf.mul hf' -+ ring -+ · filter_upwards [eventually_ge_atTop 2, h, h'] with x hx h h' -+ rw [h, intervalIntegral.integral_of_le hx, ← integral_Icc_eq_integral_Ioc, h'] -+ have : log x ≠ 0 := by simp; grind -+ field -+ · intro x -+ obtain rfl|hx := eq_or_ne x 0 -+ · simp -+ obtain rfl|hx := eq_or_ne x 1 -+ · simp -+ obtain rfl|hx := eq_or_ne x (-1 : ℝ) -+ · simp -+ norm_num -+ have : log x ≠ 0 := by simp_all -+ field -+ -+theorem pi_alt' : -+ (fun (x : ℝ) ↦ (primeCounting ⌊x⌋₊ : ℝ)) ~[atTop] (fun x ↦ x / log x) := by -+ obtain ⟨f, ⟨hf1, hf2⟩⟩ := pi_alt -+ simp_rw [hf2, IsEquivalent] -+ have : ((fun x ↦ (1 + f x) * x / log x) - fun x ↦ x / log x) = -+ (fun x ↦ f x * x / log x) := by -+ ext -+ simp -+ ring -+ rw [this] -+ convert hf1.mul_isBigO (f₂ := (fun x ↦ x / log x)) (g₂ := (fun x ↦ x /log x)) -+ (isBigO_refl ..) using 2 -+ all_goals ring -+ -+lemma pi_nth_prime (n : ℕ) : -+ primeCounting (nth_prime n) = n + 1 := by -+ rw [primeCounting, primeCounting', count_nth_succ_of_infinite infinite_setOfPred_prime] -+ -+lemma tendsto_nth_prime_atTop : Tendsto nth_prime atTop atTop := -+ nth_strictMono infinite_setOfPred_prime |>.tendsto_atTop -+ -+lemma pi_nth_prime_asymp : -+ (fun n ↦ (nth_prime n) / (log (nth_prime n))) ~[atTop] (fun (n : ℕ) ↦ (n : ℝ)) := by -+ trans (fun (n : ℕ) ↦ ( n + 1 : ℝ)) -+ · have : Tendsto (fun n ↦ ((nth_prime n) : ℝ)) atTop atTop := by -+ apply tendsto_natCast_atTop_iff.mpr tendsto_nth_prime_atTop -+ convert! pi_alt'.comp_tendsto this |>.symm -+ simp only [Function.comp_apply, floor_natCast] -+ rw [pi_nth_prime] -+ norm_cast -+ · apply IsEquivalent.add_isLittleO (by rfl) -+ exact isLittleO_const_id_atTop (1 : ℝ) |>.natCast_atTop -+ -+lemma log_nth_prime_asymp : (fun n ↦ log (nth_prime n)) ~[atTop] (fun n ↦ log n) := by -+ have := pi_nth_prime_asymp.log tendsto_natCast_atTop_atTop -+ · apply IsEquivalent.trans _ this -+ apply IsEquivalent.congr_right (v := (fun n ↦ log (nth_prime n) - log (log (nth_prime n)))) -+ swap -+ · filter_upwards with n -+ rw [log_div] -+ · exact_mod_cast prime_nth_prime n |>.ne_zero -+ · apply log_ne_zero.mpr ⟨?_, ?_, ?_⟩ -+ <;> norm_cast<;> linarith [prime_nth_prime n |>.two_le] -+ symm -+ apply IsEquivalent.sub_isLittleO (by rfl) -+ apply IsLittleO.comp_tendsto isLittleO_log_id_atTop -+ have : Tendsto (fun n ↦ ((nth_prime n) : ℝ)) atTop atTop := by -+ apply tendsto_natCast_atTop_iff.mpr tendsto_nth_prime_atTop -+ apply tendsto_log_atTop.comp this -+ -+lemma nth_prime_asymp : (fun n ↦ ((nth_prime n) : ℝ)) ~[atTop] (fun n ↦ n * log n) := by -+ have := pi_nth_prime_asymp.mul log_nth_prime_asymp -+ convert! this using 1 -+ ext n -+ simp only [Pi.mul_apply] -+ have : log (nth_prime n) ≠ 0 :=by -+ apply log_ne_zero.mpr ⟨?_, ?_, ?_⟩ -+ <;> norm_cast<;> linarith [prime_nth_prime n |>.two_le] -+ field -+ -+theorem pn_asymptotic : ∃ c : ℕ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ -+ ∀ n : ℕ, n > 1 → nth_prime n = (1 + c n) * n * log n := by -+ let c : ℕ → ℝ := fun n ↦ (nth_prime n) / (n * log n) - 1 -+ refine ⟨c, ?_, ?_⟩ -+ swap -+ · intro n hn -+ have : log n ≠ 0 := by rw [Real.log_ne_zero]; rify at hn; grind -+ simp [c] -+ field_simp -+ apply isLittleO_of_tendsto -+ · simp -+ simp only [div_one] -+ unfold c -+ have := isEquivalent_iff_tendsto_one ?_|>.mp nth_prime_asymp -+ swap -+ · filter_upwards [eventually_ge_atTop 2] with n hn -+ simp -+ norm_cast -+ grind -+ convert! this.add_const (-1 : ℝ) using 2 -+ norm_num -+ -+theorem pn_pn_plus_one : ∃ c : ℕ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ -+ ∀ n : ℕ, nth_prime (n + 1) - nth_prime n = (c n) * nth_prime n := by -+ use (fun n => (nth_prime (n+1) - nth_prime n) / nth_prime n) -+ refine ⟨?_, ?_⟩ -+ · obtain ⟨k, k_o1, p_n_eq⟩ := pn_asymptotic -+ simp only [isLittleO_one_iff] -+ rw [Filter.tendsto_congr' (f₂ := fun n ↦ -+ ((1 + k (n+1))*(n+1)*log (n+1) - (1 + k n)*n*log n) / ((1 + k n)*n*log n))] -+ swap -+ · simp only [EventuallyEq, eventually_atTop] -+ use 2; intro n hn -+ rw [p_n_eq n (by linarith), p_n_eq (n+1) (by linarith)] -+ grind -+ simp_rw [sub_div] -+ have zero_eq_minus: (0 : ℝ) = 1 - 1 := by -+ simp -+ rw [zero_eq_minus] -+ apply Filter.Tendsto.sub -+ · conv => -+ arg 1 -+ intro n -+ equals ((1 + k (n + 1)) / (1 + k n) ) * ((↑n + 1) * log (↑n + 1) / (↑n * log ↑n)) => -+ field_simp -+ nth_rw 6 [← (one_mul 1)] -+ apply Filter.Tendsto.mul -+ · have one_div: nhds 1 = nhds ((1: ℝ) / 1) := by simp -+ rw [one_div] -+ apply Filter.Tendsto.div -+ · nth_rw 3 [← (AddMonoid.add_zero 1)] -+ apply Filter.Tendsto.add -+ · simp -+ · rw [Filter.tendsto_add_atTop_iff_nat] -+ rw [Asymptotics.isLittleO_iff_tendsto] at k_o1 -+ · simp only [div_one] at k_o1 -+ exact k_o1 -+ · simp -+ · nth_rw 2 [← (AddMonoid.add_zero 1)] -+ apply Filter.Tendsto.add -+ · simp -+ · rw [Asymptotics.isLittleO_iff_tendsto] at k_o1 -+ · simp only [div_one] at k_o1 -+ exact k_o1 -+ · simp -+ -+ simp -+ · conv => -+ arg 1 -+ intro x -+ equals ((↑x + 1) / x) * (log (↑x + 1) / (log ↑x)) => -+ field_simp -+ nth_rw 3 [← (one_mul 1)] -+ apply Filter.Tendsto.mul -+ · simp_rw [add_div] -+ nth_rw 2 [← (AddMonoid.add_zero 1)] -+ apply Filter.Tendsto.add -+ · rw [← Filter.tendsto_add_atTop_iff_nat 1] -+ field_simp -+ simp -+ · simp only [one_div] -+ exact tendsto_inv_atTop_nhds_zero_nat -+ · have log_eq: ∀ (n: ℕ), log (↑n + 1) = log ↑n + log (1 + 1/n) := by -+ intro n -+ by_cases n_eq_zero: n = 0 -+ · simp [n_eq_zero] -+ · calc -+ _ = log (n * (1 + 1 / n)) := by field_simp -+ _ = log n + log (1 + 1/n) := by -+ rw [Real.log_mul] -+ · simpa -+ · simp only [one_div, ne_eq] -+ positivity -+ -+ simp_rw [log_eq] -+ simp_rw [add_div] -+ nth_rw 3 [← (AddMonoid.add_zero 1)] -+ apply Filter.Tendsto.add -+ · rw [← Filter.tendsto_add_atTop_iff_nat 2] -+ have log_not_zero: ∀ n: ℕ, log (n + 2) ≠ 0 := by -+ intro n -+ simp only [ne_eq, log_eq_zero, not_or] -+ refine ⟨?_, ?_, ?_⟩ -+ · norm_cast -+ · norm_cast -+ simp -+ · norm_cast -+ simp [log_not_zero] -+ · rw [← Filter.tendsto_add_atTop_iff_nat 2] -+ apply squeeze_zero (g := fun (n: ℕ) => (log 2 / log (n + 2))) -+ · intro n -+ have log_plus_nonzero: 0 ≤ log (1 + 1 / ↑(n + 2)) := by -+ apply log_nonneg -+ simp only [cast_add, cast_ofNat, one_div, le_add_iff_nonneg_right, inv_nonneg] -+ norm_cast -+ simp only [le_add_iff_nonneg_left, _root_.zero_le] -+ exact div_nonneg log_plus_nonzero (log_natCast_nonneg (n + 2)) -+ · intro n -+ norm_cast -+ have log_le_2: log (1 + 1 / ↑(n + 2)) ≤ log 2 := by -+ apply Real.log_le_log -+ · positivity -+ · have two_eq_one_plus_one: (2 : ℝ) = 1 + 1 := by -+ norm_num -+ rw [two_eq_one_plus_one] -+ simp only [cast_add, cast_ofNat, one_div, add_le_add_iff_left, ge_iff_le] -+ apply inv_le_one_of_one_le₀ -+ linarith -+ -+ rw [div_le_div_iff_of_pos_right] -+ · exact log_le_2 -+ · apply Real.log_pos -+ norm_cast -+ simp -+ · apply Filter.Tendsto.div_atTop (l := atTop) (a := log 2) -+ · simp -+ · norm_cast -+ have shift_fn := -+ Filter.tendsto_add_atTop_iff_nat (f := fun n => log (n)) (l := atTop) 2 -+ rw [shift_fn] -+ apply Filter.Tendsto.comp Real.tendsto_log_atTop -+ exact tendsto_natCast_atTop_atTop -+ -+ · have eventually_nonzero: ∃ t, t > 2 ∧ ∀ n, 1 + k (n + t) ≠ 0 := by -+ rw [Asymptotics.isLittleO_iff_tendsto] at k_o1 -+ · rw [NormedAddGroup.tendsto_nhds_zero] at k_o1 -+ specialize k_o1 ((1 : ℝ) / 2) -+ simp only [one_div, gt_iff_lt, inv_pos, ofNat_pos, div_one, norm_eq_abs, eventually_atTop, forall_const] at k_o1 -+ obtain ⟨a, ha⟩ := k_o1 -+ use (a + 3) -+ refine ⟨by simp, ?_⟩ -+ intro n -+ specialize ha (n + (a + 3)) -+ have a_le_plus: a ≤ n + (a + 3) := by omega -+ simp only [a_le_plus, forall_const] at ha -+ -+ by_contra! -+ rw [add_eq_zero_iff_eq_neg] at this -+ rw [← abs_neg] at ha -+ rw [← this] at ha -+ simp only [abs_one] at ha -+ have two_inv_lt := inv_lt_one_of_one_lt₀ (a := (2 : ℝ)) (by simp) -+ linarith -+ · simp -+ -+ obtain ⟨t, t_gt_2, ht⟩ := eventually_nonzero -+ rw [← Filter.tendsto_add_atTop_iff_nat t] -+ have denom_nonzero: ∀ n, ((1 + k (n + t)) * ↑(n + t) * log ↑(n + t)) ≠ 0 := by -+ intro n -+ simp only [cast_add, ne_eq, _root_.mul_eq_zero, log_eq_zero, not_or] -+ refine ⟨⟨?_, ?_⟩, ?_, ?_⟩ -+ · exact ht n -+ · norm_cast -+ omega -+ · norm_cast -+ omega -+ · refine ⟨?_, by norm_cast⟩ -+ norm_cast -+ omega -+ conv => -+ arg 1 -+ intro n -+ rw [div_self (denom_nonzero n)] -+ simp -+ · intro n -+ have nth_nonzero: nth_prime n ≠ 0 := by -+ exact Nat.Prime.ne_zero (prime_nth_prime n) -+ simp [nth_nonzero] -+ -+lemma prime_in_gap' (a b : ℕ) (h : a.primeCounting < b.primeCounting) -+ : ∃ (p : ℕ), p.Prime ∧ (a + 1) ≤ p ∧ p < (b + 1) := by -+ obtain ⟨p, hp, pp⟩ := exists_of_count_lt_count h -+ exact ⟨p, pp, hp.left, hp.right⟩ -+ -+lemma prime_in_gap (a b : ℝ) (ha : 0 < a) -+ (h : ⌊a⌋₊.primeCounting < ⌊b⌋₊.primeCounting) -+ : ∃(p : ℕ), p.Prime ∧ a < p ∧ p ≤ b := by -+ -+ have hab : ⌊a⌋₊ < ⌊b⌋₊ := Monotone.reflect_lt Nat.monotone_primeCounting h -+ obtain ⟨w, h, ha, hb⟩ := prime_in_gap' ⌊a⌋₊ ⌊b⌋₊ h -+ refine ⟨w, h, lt_of_floor_lt ha, ?_⟩ -+ have : a < b := by -+ by_contra h -+ cases lt_or_eq_of_le <| le_of_not_gt h with -+ | inl hh => linarith [floor_le_floor <| le_of_lt hh] -+ | inr hh => -+ rw [hh] at hab -+ rwa [←lt_self_iff_false ⌊a⌋₊] -+ by_contra h -+ have : ⌊b⌋₊ < w := floor_lt (by linarith) |>.mpr (lt_of_not_ge h) -+ have : ⌊b⌋₊ + 1 ≤ w := by linarith -+ linarith -+ -+lemma bound_f_second_term (f : ℝ → ℝ) (hf : Tendsto f atTop (nhds 0)) (δ : ℝ) (hδ : δ > 0) : -+ ∀ᶠ x : ℝ in atTop, (1 + f x) < (1 + δ) := by -+ have bound_one_plus_f: ∀ y: ℝ, ∀ z: ℝ, |f y| < z → 1 + (f y) < 1 + z := by -+ intro y z hf -+ by_cases f_pos: 0 < f y -+ · rw [abs_of_pos f_pos] at hf -+ linarith -+ · rw [not_lt] at f_pos -+ rw [abs_of_nonpos f_pos] at hf -+ linarith -+ -+ have f_small := NormedAddGroup.tendsto_nhds_zero.mp hf δ hδ -+ simp only [norm_eq_abs, eventually_atTop] at f_small -+ obtain ⟨p, hp⟩ := f_small -+ -+ let a := ((max 1 p) : ℝ) -+ have ha: ∀ b: ℝ, a ≤ b → |f b| < δ := by -+ intro b hb -+ have b_ge_p: p ≤ b := by -+ have a_ge_p: p ≤ a := by simp [a] -+ linarith -+ exact hp b b_ge_p -+ -+ rw [Filter.eventually_atTop] -+ -+ use a -+ intro b hb -+ exact bound_one_plus_f b δ (ha b (by linarith)) -+ -+lemma bound_f_first_term {ε : ℝ} (hε : 0 < ε) (f : ℝ → ℝ) -+ (hf : Tendsto f atTop (nhds 0)) (δ : ℝ) (hδ : δ > 0) : -+ ∀ᶠ x: ℝ in atTop, (1 + f ((1 + ε) * x)) > (1 - δ) := by -+ have bound_one_plus_f: ∀ y: ℝ, ∀ z: ℝ, |f y| < z → 1 + (f y) > 1 - z := by -+ intro y z hf -+ by_cases f_pos: 0 < f y -+ · rw [abs_of_pos f_pos] at hf -+ linarith -+ · rw [not_lt] at f_pos -+ rw [abs_of_nonpos f_pos] at hf -+ linarith -+ -+ have f_small := NormedAddGroup.tendsto_nhds_zero.mp hf δ hδ -+ simp only [norm_eq_abs, eventually_atTop] at f_small -+ obtain ⟨p, hp⟩ := f_small -+ -+ let a := ((max 1 p) : ℝ) -+ have ha: ∀ b: ℝ, a ≤ b → |f b| < δ := by -+ intro b hb -+ have b_ge_p: p ≤ b := by -+ have a_ge_p: p ≤ a := by simp [a] -+ linarith -+ exact hp b b_ge_p -+ -+ rw [Filter.eventually_atTop] -+ -+ use a -+ intro b hb -+ -+ have a_pos: 0 < a := by -+ simp [a] -+ -+ have pos_mul: ∀ x y z : ℝ, 0 < x → 0 < y → 1 < z → x ≤ y → x < y * z := by -+ intro x y z _ hy hz hlt -+ have y_lt: y < y * z := by -+ exact (lt_mul_iff_one_lt_right hy).mpr hz -+ linarith -+ -+ have mul_increase: a ≤ (1 + ε) * b := by -+ simp only [ a] at hb -+ have a_le := pos_mul a b (1 + ε) a_pos (by linarith) (by linarith) (by linarith) -+ linarith -+ -+ exact bound_one_plus_f ((1 + ε) * b) δ (ha ((1 + ε) * b) mul_increase) -+ -+lemma smaller_terms {ε : ℝ} (hε : 0 < ε) (f : ℝ → ℝ) (hf : Tendsto f atTop (nhds 0)) (δ : ℝ) -+ (hδ : δ > 0) : -+ ∀ᶠ x : ℝ in atTop, (1 - δ) * ((1 + ε) * x / (Real.log ((1 + ε) * x))) < -+ (1 + f ((1 + ε) * x)) * ((1 + ε) * x / (Real.log ((1 + ε) * x))) := by -+ have first_term := bound_f_first_term hε f hf δ hδ -+ simp only [gt_iff_lt, eventually_atTop] at first_term -+ obtain ⟨p, hp⟩ := first_term -+ simp only [eventually_atTop] -+ let a := max p 1 -+ have ha: ∀ (b : ℝ), a ≤ b → 1 - δ < 1 + f ((1 + ε) * b) := by -+ intro b hb -+ have a_ge_p: p ≤ a := by -+ simp [a] -+ specialize hp b (by linarith) -+ exact hp -+ use a -+ intro b hb -+ rw [mul_lt_mul_iff_left₀] -+ · exact ha b hb -+ · simp only [sup_le_iff, a] at hb -+ have b_ge_one: 1 ≤ b := hb.2 -+ have log_pos: Real.log ((1 + ε) *b) > 0 := by -+ have one_pplus_pos: 1 < (1 + ε) := by linarith -+ refine (Real.log_pos_iff ?_).mpr ?_ -+ · positivity -+ · exact one_lt_mul_of_lt_of_le one_pplus_pos b_ge_one -+ -+ positivity -+ -+lemma second_smaller_terms (f : ℝ → ℝ) (hf : Tendsto f atTop (nhds 0)) (δ : ℝ) (hδ : δ > 0) : -+ ∀ᶠ x : ℝ in atTop, -+ (1 + δ) * (x / Real.log x) > (1 + f x) * (x / Real.log x) := by -+ have first_term := bound_f_second_term f hf δ hδ -+ -+ simp only [_root_.add_lt_add_iff_left, eventually_atTop] at first_term -+ obtain ⟨p, hp⟩ := first_term -+ simp only [gt_iff_lt, eventually_atTop] -+ let a := max p 2 -+ have ha: ∀ (b : ℝ), a ≤ b → 1 + δ > 1 + f ( b) := by -+ intro b hb -+ have a_ge_p: p <= a := by simp [a] -+ specialize hp b (by linarith) -+ linarith -+ use a -+ intro b hb -+ specialize ha b hb -+ have rhs_nonzero: b / log ( b) > 0 := by -+ simp only [sup_le_iff, a] at hb -+ obtain ⟨_, hb2⟩ := hb -+ have log_pos: Real.log (b) > 0 := by -+ refine (Real.log_pos_iff ?_).mpr ?_ -+ · positivity -+ · linarith -+ positivity -+ rw [mul_lt_mul_iff_left₀] -+ · exact ha -+ · linarith -+ -+lemma x_log_x_atTop : Filter.Tendsto (fun x => x / Real.log x) Filter.atTop Filter.atTop := by -+ have inv_log_x_div := Filter.Tendsto.comp (f := fun x => Real.log x / x) (g := fun x => x⁻¹) -+ (x := Filter.atTop) (y := (nhdsWithin 0 (Set.Ioi 0))) (z := Filter.atTop) ?_ ?_ -+ · simp_rw [Function.comp_def, inv_div] at inv_log_x_div -+ exact inv_log_x_div -+ · exact tendsto_inv_nhdsGT_zero (𝕜 := ℝ) -+ · rw [tendsto_nhdsWithin_iff] -+ refine ⟨?_, ?_⟩ -+ · have log_div_x := Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 (by simp) -+ simp only [pow_one, one_mul, add_zero] at log_div_x -+ exact log_div_x -+ · simp only [Set.mem_Ioi, eventually_atTop] -+ use 2 -+ intro x hx -+ have log_pos: 0 < Real.log x := by -+ refine (Real.log_pos_iff ?_).mpr ?_ <;> linarith -+ positivity -+ -+lemma tendsto_by_squeeze (ε : ℝ) (hε : ε > 0) : -+ Tendsto (fun (x : ℝ) => (Nat.primeCounting ⌊(1 + ε) * x⌋₊ : ℝ) - -+ (Nat.primeCounting ⌊x⌋₊ : ℝ)) atTop atTop := by -+ obtain ⟨c, hc, pi_x_eq⟩ := pi_alt -+ rw [Asymptotics.isLittleO_iff_tendsto (by simp)] at hc -+ conv => -+ arg 1 -+ intro x -+ rw [pi_x_eq] -+ rw [pi_x_eq] -+ simp only [div_one] at hc -+ -+ let d: ℝ := ε/(2*(2 + ε)) -+ have hd: 0 < d := by positivity -+ have first_helper := smaller_terms hε c hc (d) hd -+ have second_helper := second_smaller_terms c hc d hd -+ -+ apply Filter.tendsto_atTop_mono' (f₁ := fun x => ( -+ ((1 - d) * ((1 + ε) * x / log ((1 + ε) * x))) -+ - -+ ((1 + d) * (x / log x))) -+ ) -+ · rw [Filter.EventuallyLE] -+ -+ simp only [eventually_atTop] at first_helper -+ simp only [gt_iff_lt, eventually_atTop] at second_helper -+ -+ obtain ⟨a1, ha1⟩ := first_helper -+ obtain ⟨a2, ha2⟩ := second_helper -+ -+ simp only [eventually_atTop] -+ -+ use (max a1 a2) -+ intro b hb -+ -+ have lt_compare: ∀ a b c d : ℝ, a < c ∧ b > d → a - b ≤ c - d := by -+ intro a b c d h_lt -+ obtain ⟨a_lt, b_gt⟩ := h_lt -+ linarith -+ -+ apply lt_compare -+ simp only [ sup_le_iff] at hb -+ specialize ha1 b hb.1 -+ specialize ha2 b hb.2 -+ field_simp -+ field_simp at ha1 ha2 -+ exact ⟨ha1, ha2⟩ -+ · rw [← Filter.tendsto_comp_val_Ioi_atTop (a := 1)] -+ have log_split: ∀ x: Set.Ioi 1, x.val / log ((1 + ε) * x.val) = -+ x.val / (log (1 + ε) + log (x.val)) := by -+ intro x -+ have x_ge_one: 1 < x.val := Set.mem_Ioi.mp x.property -+ rw [Real.log_mul (by linarith) (by linarith)] -+ -+ have log_factor: ∀ x: Set.Ioi 1, x.val / (log (1 + ε) + log (x.val)) = -+ x.val / ((1 + (log (1 + ε)/(log x.val))) * (log x.val)) := by -+ intro x -+ have : log (x.val) ≠ 0 := by -+ have pos := Real.log_pos x.property -+ linarith -+ field_simp -+ rw [add_comm] -+ -+ conv at log_factor => -+ intro x -+ rhs -+ rw [div_mul_eq_div_mul_one_div] -+ -+ conv => -+ arg 1 -+ intro x -+ lhs -+ rw [mul_div_assoc] -+ rw [log_split x] -+ -+ conv => -+ arg 1 -+ intro x -+ lhs -+ rw [log_factor] -+ -+ suffices Tendsto (fun x : Set.Ioi (1 : ℝ) ↦ (1 - d) * ((1 + ε) * x) / -+ ((1 + log (1 + ε) / log x) * log x) - (1 + d) * x / log x) atTop atTop by -+ field_simp at this ⊢ -+ exact this -+ conv => -+ arg 1 -+ intro x -+ rw [sub_eq_add_neg] -+ rw [← neg_div] -+ rw [div_add_div] -+ · skip -+ tactic => -+ simp only [ne_eq, _root_.mul_eq_zero, log_eq_zero, not_or] -+ have x_pos := x.property -+ simp_rw [Set.Ioi, Set.mem_ofPred_eq] at x_pos -+ refine ⟨?_, by linarith, by linarith, by linarith⟩ -+ have log_num_pos: 0 < log (1 + ε) := by -+ exact Real.log_pos (by linarith) -+ have log_denom_pos: 0 < log x := by -+ exact Real.log_pos x.property -+ positivity -+ tactic => -+ have pos := Real.log_pos (x.property) -+ linarith -+ -+ conv => -+ arg 1 -+ intro x -+ equals ↑x * (log ↑x * ((1 + ε) * (1 - d)) - -+ (1 + log (1 + ε) / log ↑x) * ((1 + d) * log ↑x)) / -+ (log ↑x * ((1 + log (1 + ε) / log ↑x) * log ↑x)) => -+ ring -+ -+ simp only [mul_div_mul_comm] -+ conv => -+ arg 1 -+ intro x -+ rw [mul_comm] -+ -+ apply Filter.Tendsto.pos_mul_atTop (C := (1 + ε) * (1 - d) - (1 + d)) -+ · simp only [d, sub_pos] -+ field_simp -+ ring_nf -+ rw [add_assoc] -+ rw [add_lt_add_iff_left] -+ apply lt_of_sub_pos -+ ring_nf -+ positivity -+ · conv => -+ arg 1 -+ intro x -+ lhs -+ rhs -+ equals (log x.val) * ((1 + log (1 + ε) / log ↑x) * ((1 + d))) => -+ ring -+ -+ simp_rw [← mul_sub] -+ conv => -+ arg 1 -+ intro x -+ rhs -+ rw [mul_comm] -+ -+ simp only [mul_div_mul_comm] -+ conv => -+ arg 1 -+ intro x -+ lhs -+ equals 1 => -+ have log_pos := Real.log_pos x.property -+ field_simp -+ -+ simp only [one_mul] -+ conv => -+ arg 3 -+ equals nhds (((1 + ε) * (1 - d) - (1 + d)) / 1) => simp -+ -+ apply Filter.Tendsto.div -+ · apply Filter.Tendsto.sub -+ · simp -+ · conv => -+ arg 3 -+ equals nhds (1 * (1 + d)) => simp -+ apply Filter.Tendsto.mul -+ · conv => -+ arg 3 -+ equals nhds (1 + 0) => simp -+ apply Filter.Tendsto.add -+ · simp -+ · apply Filter.Tendsto.div_atTop (a := log (1 + ε)) -+ · simp -+ · simp only [tendsto_comp_val_Ioi_atTop] -+ exact tendsto_log_atTop -+ · simp -+ · conv => -+ arg 3 -+ equals nhds (1 + 0) => simp -+ apply Filter.Tendsto.add -+ · simp -+ · apply Filter.Tendsto.div_atTop (a := log (1 + ε)) -+ · simp -+ · simp only [tendsto_comp_val_Ioi_atTop] -+ exact tendsto_log_atTop -+ · simp -+ · let x_div_log (x: ℝ) := x / Real.log x -+ conv => -+ arg 1 -+ equals (fun (x : Set.Ioi 1) => x_div_log x.val) => rfl -+ -+ rw [Filter.tendsto_comp_val_Ioi_atTop (a := 1)] -+ exact x_log_x_atTop -+ -+theorem prime_between {ε : ℝ} (hε : 0 < ε) : -+ ∀ᶠ x : ℝ in atTop, ∃ p : ℕ, Nat.Prime p ∧ x < p ∧ p < (1 + ε) * x := by -+ have squeeze := tendsto_by_squeeze (ε/2) (by linarith) -+ rw [Filter.tendsto_iff_forall_eventually_mem] at squeeze -+ specialize squeeze (Set.Ici 1) (by exact Ici_mem_atTop 1) -+ simp only [Set.mem_Ici, eventually_atTop] at squeeze -+ obtain ⟨a, ha⟩ := squeeze -+ rw [eventually_atTop] -+ use (max a 1) -+ intro b hb -+ rw [sup_le_iff] at hb -+ specialize ha b hb.1 -+ -+ have val_lt : (⌊b⌋₊.primeCounting : ℝ) < ⌊(1 + ε/2) * b⌋₊.primeCounting := by linarith -+ norm_cast at val_lt -+ -+ have jump := prime_in_gap b ((1 + ε/2) * b) (by linarith) val_lt -+ obtain ⟨p, hp, b_lt_p, p_le⟩ := jump -+ have p_lt: p < (1 + ε) * b := by -+ linarith -+ use p -+ -+theorem sum_mobius_div_self_le (N : ℕ) : |∑ n ∈ range N, μ n / (n : ℚ)| ≤ 1 := by -+ cases N with -+ | zero => simp only [range_zero, sum_empty, abs_zero, zero_le_one] -+ | succ N => -+ -+ obtain rfl | hN := N.eq_zero_or_pos -+ · simp -+ -+ have h_sum : 1 = (∑ d ∈ range (N + 1), (μ d / d : ℚ)) * N - ∑ d ∈ range (N + 1), -+ μ d * Int.fract (N / d : ℚ) := calc -+ (1 : ℚ) = ∑ m ∈ Ioc 0 N, ∑ d ∈ m.divisors, μ d := by -+ have (x : ℕ) (hx : x ∈ Ioc 0 N) : ∑ d ∈ divisors x, μ d = if x = 1 then 1 else 0 := by -+ rw [mem_Ioc] at hx -+ rw [← coe_mul_zeta_apply, moebius_mul_coe_zeta, one_apply] -+ rw [sum_congr rfl this] -+ simp [hN.ne'] -+ _ = ∑ d ∈ range (N + 1), μ d * (N / d : ℕ) := by -+ simp_rw [← coe_mul_zeta_apply, ArithmeticFunction.sum_Ioc_mul_zeta_eq_sum] -+ rw [range_eq_Ico, ← Finset.insert_Ico_add_one_left_eq_Ico (add_one_pos _), -+ sum_insert (by simp), Ico_add_one_add_one_eq_Ioc] -+ simp -+ _ = ∑ d ∈ range (N + 1), (μ d : ℚ) * ⌊(N / d : ℚ)⌋ := by -+ simp_rw [Rat.floor_natCast_div_natCast] -+ simp [← Int.natCast_ediv] -+ _ = (∑ d ∈ range (N + 1), (μ d / d : ℚ)) * N - ∑ d ∈ range (N + 1), -+ μ d * Int.fract (N / d : ℚ) := by -+ simp_rw [sum_mul, ← sum_sub_distrib, mul_comm_div, ← mul_sub, Int.self_sub_fract] -+ rw [eq_sub_iff_add_eq, eq_comm, ← eq_div_iff (by norm_num [Nat.pos_iff_ne_zero.mp hN])] at h_sum -+ -+ have hf' (d : ℕ) : |Int.fract ((N : ℚ) / d)| < 1 := by -+ rw [abs_of_nonneg (Int.fract_nonneg _)] -+ exact Int.fract_lt_one _ -+ have h_bound : |∑ d ∈ range (N + 1), μ d * Int.fract ((N : ℚ) / d)| ≤ N - 1 := by -+ -+ rw [range_eq_Ico, ← Finset.insert_Ico_add_one_left_eq_Ico (by simp), sum_insert (by simp), -+ ArithmeticFunction.map_zero, Int.cast_zero, zero_mul, zero_add, -+ Finset.Ico_add_one_right_eq_Icc, zero_add] -+ -+ rw [← Ico_insert_right hN, sum_insert (by simp), div_self (by simp; grind), Int.fract_one, -+ mul_zero, zero_add] -+ -+ have (d : ℕ) : |μ d * Int.fract ((N : ℚ) / d)| ≤ 1 := by -+ rw [abs_mul, ← one_mul 1] -+ refine mul_le_mul ?_ (hf' _).le (abs_nonneg _) zero_le_one -+ norm_cast -+ exact abs_moebius_le_one -+ apply (abs_sum_le_sum_abs _ _).trans -+ apply (sum_le_sum fun d _ ↦ this d).trans -+ simp [cast_sub (one_le_iff_ne_zero.mpr hN.ne')] -+ -+ rw [h_sum, abs_le] -+ rw [abs_le, neg_sub] at h_bound -+ constructor -+ <;> simp only [le_div_iff₀, div_le_iff₀, cast_pos.mpr hN] -+ <;> linarith [h_bound.left] -+ -+lemma sum_mobius_mul_floor (x : ℝ) (hx : 1 ≤ x) : -+ ∑ n ∈ Iic ⌊x⌋₊, (ArithmeticFunction.moebius n : ℝ) * (⌊x/n⌋ : ℝ) = 1 := by -+ norm_cast -+ convert ArithmeticFunction.sum_Ioc_mul_zeta_eq_sum μ ⌊x⌋₊ |>.symm using 1 -+ · rw [Iic_eq_Icc, bot_eq_zero, ← add_sum_Ioc_eq_sum_Icc (by simp)] -+ simp only [ArithmeticFunction.map_zero, CharP.cast_eq_zero, div_zero, Int.floor_zero, mul_zero, -+ zero_add, Int.natCast_ediv] -+ refine sum_congr rfl fun n hn ↦ ?_ -+ congr -+ norm_cast -+ rw [← floor_div_natCast, Int.natCast_floor_eq_floor] -+ positivity -+ · simpa [moebius_mul_coe_zeta, one_apply] -+ -+noncomputable def mu_log : ArithmeticFunction ℝ := -+ ⟨(fun n ↦ μ n * ArithmeticFunction.log n), (by simp)⟩ -+ -+lemma mu_log_apply (n : ℕ) : mu_log n = μ n * ArithmeticFunction.log n := by -+ rfl -+ -+lemma mu_log_mul_zeta : mu_log * ArithmeticFunction.zeta = -Λ := by -+ ext n -+ rw [coe_mul_zeta_apply] -+ simp_rw [mu_log_apply] -+ rw [sum_moebius_mul_log_eq] -+ rfl -+ -+lemma mu_log_eq_mu_mul_neg_lambda : mu_log = μ * -Λ := by -+ rw [← mu_log_mul_zeta, mul_comm, mul_assoc, coe_zeta_mul_coe_moebius, mul_one] -+ -+lemma sum_mu_Lambda (x : ℝ) : ∑ n ∈ Iic ⌊x⌋₊, (μ n : ℝ) * log n = - ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x/k) := by -+ rw [Iic_eq_Icc, bot_eq_zero, ← add_sum_Ioc_eq_sum_Icc (by simp), ← add_sum_Ioc_eq_sum_Icc (by simp)] -+ simp only [ArithmeticFunction.map_zero, Int.cast_zero, CharP.cast_eq_zero, log_zero, mul_zero, -+ zero_add, div_zero, zero_mul] -+ simp_rw [← log_apply, ← mu_log_apply, mu_log_eq_mu_mul_neg_lambda] -+ rw [sum_Ioc_mul_eq_sum_sum, ← sum_neg_distrib] -+ refine sum_congr rfl fun n hn ↦ ?_ -+ simp_rw [ArithmeticFunction.neg_apply, sum_neg_distrib] -+ ring_nf -+ congr 2 -+ unfold Psi -+ congr -+ rw [← floor_div_natCast] -+ rfl -+ -+lemma M_log_identity (x : ℝ) (hx : 1 ≤ x) : M x * log x = ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (log (x/k) - Psi (x/k)) := by -+ have h_log_identity : ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k) = (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ)) * Real.log x - ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k := by -+ rw [Finset.sum_mul _ _ _] -+ rw [← Finset.sum_sub_distrib] ; refine Finset.sum_congr rfl fun i hi => ?_ ; by_cases hi' : i = 0 <;> simp +decide [*, Real.log_div, ne_of_gt (zero_lt_one.trans_le hx)] ; ring -+ generalize_proofs at * -+ have h_log_identity' : ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k = -∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x / k) := by -+ convert sum_mu_Lambda x using 1 -+ have h_psi_identity : -+ (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x / k)) = -+ -∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k := by -+ simpa [neg_neg] using (congrArg Neg.neg h_log_identity').symm -+ unfold M -+ symm -+ calc -+ (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (Real.log (x / k) - Psi (x / k))) = -+ (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k)) - -+ ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x / k) := by -+ simp [mul_sub, Finset.sum_sub_distrib] -+ _ = ((∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ)) * Real.log x - -+ ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k) - -+ ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x / k) := by -+ simp [h_log_identity] -+ _ = ((∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ)) * Real.log x - -+ ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k) - -+ (-∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k) := by -+ simp [h_psi_identity] -+ _ = (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ)) * Real.log x := by ring -+ -+noncomputable def R (x : ℝ) : ℝ := Psi x - x -+ -+lemma R_isLittleO : R =o[atTop] id := by -+ have h_pnt : (fun x => Psi x - x) =o[atTop] (fun x => x) := by -+ have h_psi : (fun x => Psi x) ~[atTop] (fun x => x) := by -+ simpa [Psi] using! WeakPNT'' -+ exact h_psi -+ convert! h_pnt using 1 -+ -+lemma sum_mobius_div_isBigO : (fun x : ℝ => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (x / k)) =O[atTop] id := by -+ have h_abs : ∀ x : ℝ, 1 ≤ x → |∑ n ∈ Iic ⌊x⌋₊, (μ n : ℝ) / n| ≤ 1 := by -+ intros x hx -+ have h_sum : ∑ n ∈ Finset.Iic ⌊x⌋₊, (μ n : ℝ) / n = ∑ n ∈ Finset.range (⌊x⌋₊ + 1), (μ n : ℝ) / n := by -+ rw [Finset.range_eq_Ico] ; rfl -+ have := sum_mobius_div_self_le (⌊x⌋₊ + 1) ; simp_all +decide [Finset.sum_range_succ'] -+ norm_cast at * -+ rw [Asymptotics.isBigO_iff] -+ use 1; filter_upwards [Filter.eventually_ge_atTop 1] with x hx; simp_all +decide [div_eq_mul_inv, mul_assoc, mul_comm] -+ simpa only [← Finset.mul_sum _ _ _, abs_mul] using mul_le_of_le_one_right (abs_nonneg x) (h_abs x hx) -+ -+lemma sum_log_div_isBigO : (fun x : ℝ => ∑ k ∈ Iic ⌊x⌋₊, log (x / k)) =O[atTop] id := by -+ have h_sum_log : ∀ x : ℝ, 1 ≤ x → |∑ k ∈ Finset.Iic ⌊x⌋₊, Real.log (x / k)| ≤ 2 * x := by -+ have h_sum_log_le_x : ∀ x : ℝ, 1 ≤ x → ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, Real.log (x / k) ≤ x := by -+ intro x hx -+ have h_sum_log : ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, Real.log (x / (k : ℝ)) ≤ Real.log (x ^ ⌊x⌋₊ / Nat.factorial ⌊x⌋₊) := by -+ rw [← Real.log_prod] -+ · norm_num [Finset.prod_div_distrib] -+ erw [← Nat.cast_prod, Finset.prod_Ico_id_eq_factorial] -+ · exact fun n hn => div_ne_zero (by positivity) (Nat.cast_ne_zero.mpr <| by linarith [Finset.mem_Icc.mp hn]) -+ have h_exp_bound : x ^ ⌊x⌋₊ / Nat.factorial ⌊x⌋₊ ≤ Real.exp x := by -+ have h_term : x ^ ⌊x⌋₊ / (⌊x⌋₊! : ℝ) ≤ ∑' k : ℕ, x ^ k / (k ! : ℝ) := by -+ exact Summable.le_tsum (show Summable _ from Real.summable_pow_div_factorial x) ⌊x⌋₊ (fun _ _ => by positivity) -+ simpa [Real.exp_eq_exp_ℝ, NormedSpace.exp_eq_tsum_div] using h_term -+ exact h_sum_log.trans (Real.log_le_iff_le_exp (by positivity) |>.2 h_exp_bound) -+ intros x hx -+ have h_sum_eq : ∑ k ∈ Finset.Iic ⌊x⌋₊, Real.log (x / k) = ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, Real.log (x / k) := by -+ erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num -+ erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num -+ rw [abs_of_nonneg] <;> linarith [h_sum_log_le_x x hx, show 0 ≤ ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, Real.log (x / k) from Finset.sum_nonneg fun _ _ => Real.log_nonneg <| by rw [le_div_iff₀ <| Nat.cast_pos.mpr <| by linarith [Finset.mem_Icc.mp ‹_›]] ; linarith [Nat.floor_le <| show 0 ≤ x by linarith, show (↑‹ℕ› : ℝ) ≤ ⌊x⌋₊ by exact_mod_cast Finset.mem_Icc.mp ‹_› |>.2]] -+ rw [Asymptotics.isBigO_iff] -+ exact ⟨2, Filter.eventually_atTop.mpr ⟨1, fun x hx => le_trans (h_sum_log x hx) (by norm_num [abs_of_nonneg (by linarith : 0 ≤ x)])⟩⟩ -+ -+lemma R_locally_bounded (K : ℝ) (hK : 0 ≤ K) : ∃ C, ∀ y ∈ Set.Icc 0 K, |R y| ≤ C := by -+ have hR_bounded : BddAbove (Set.image (fun y => |R y|) (Set.Icc 0 K)) := by -+ have hR_bounded : ∀ y ∈ Set.Icc 0 K, |R y| ≤ ∑ p ∈ Iic ⌊K⌋₊, log p + K := by -+ intro y hy -+ simp only [R, Psi, Chebyshev.psi_eq_sum_Icc] -+ refine abs_sub_le_iff.mpr ⟨?_, ?_⟩ -+ · refine le_trans (sub_le_self _ hy.1) ?_ -+ refine le_trans (Finset.sum_le_sum_of_subset_of_nonneg (Finset.Iic_subset_Iic.mpr <| Nat.floor_mono hy.2) fun ?_ ?_ ?_ => ?_) ?_ -+ · exact vonMangoldt_nonneg -+ · refine le_add_of_le_of_nonneg (Finset.sum_le_sum fun i hi => ?_) hK -+ exact vonMangoldt_le_log -+ · refine le_trans ?_ (le_add_of_nonneg_left ?_) -+ · exact le_trans (sub_le_self _ <| Finset.sum_nonneg fun _ _ => by exact_mod_cast ArithmeticFunction.vonMangoldt_nonneg) hy.2 -+ · exact Finset.sum_nonneg fun _ _ => Real.log_natCast_nonneg _ -+ exact ⟨_, Set.forall_mem_image.2 hR_bounded⟩ -+ exact ⟨hR_bounded.choose, fun y hy => hR_bounded.choose_spec <| Set.mem_image_of_mem _ hy⟩ -+ -+lemma sum_bounded_of_linear_bound {f : ℝ → ℝ} {ε C : ℝ} (hε : 0 ≤ ε) (hC : 0 ≤ C) (h : ∀ y, 1 ≤ y → |f y| ≤ ε * y + C) (x : ℝ) (hx : 1 ≤ x) : -+ ∑ k ∈ Icc 1 ⌊x⌋₊, |f (x / k)| ≤ ε * x * (log x + 1) + C * x := by -+ have h_sum_bound : ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, |f (x / k)| ≤ ε * x * ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, (1 / (k : ℝ)) + C * ⌊x⌋₊ := by -+ have h_sum_bound : ∀ k ∈ Finset.Icc 1 ⌊x⌋₊, |f (x / k)| ≤ ε * x / k + C := by -+ exact fun k hk => by simpa only [mul_div_assoc] using! h (x / k) (by rw [le_div_iff₀ (Nat.cast_pos.mpr <| Finset.mem_Icc.mp hk |>.1)] ; nlinarith [Nat.floor_le (show 0 ≤ x by positivity), show (k : ℝ) ≤ ⌊x⌋₊ by exact_mod_cast Finset.mem_Icc.mp hk |>.2]) -+ convert! Finset.sum_le_sum h_sum_bound using 1 ; norm_num [div_eq_mul_inv, Finset.mul_sum _ _ _, Finset.sum_add_distrib, mul_comm] -+ have h_harmonic : ∀ n : ℕ, 1 ≤ n → ∑ k ∈ Finset.Icc 1 n, (1 / (k : ℝ)) ≤ Real.log n + 1 := by -+ intro n _hn -+ have h := harmonic_le_one_add_log n -+ simpa [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast, -+ one_div, add_comm, add_left_comm, add_assoc] using h -+ have h_harmonic_x : -+ ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, (1 / (k : ℝ)) ≤ Real.log x + 1 := by -+ refine (h_harmonic _ <| Nat.floor_pos.mpr hx).trans ?_ -+ have hlog : Real.log (⌊x⌋₊ : ℝ) ≤ Real.log x := by -+ refine Real.log_le_log (Nat.cast_pos.mpr <| Nat.floor_pos.mpr hx) ?_ -+ exact Nat.floor_le (by positivity) -+ simpa using add_le_add_right hlog 1 -+ have h_term1 : ε * x * (∑ k ∈ Finset.Icc 1 ⌊x⌋₊, (1 / (k : ℝ))) ≤ ε * x * (Real.log x + 1) := by -+ refine mul_le_mul_of_nonneg_left h_harmonic_x ?_ -+ exact mul_nonneg hε (by positivity) -+ have h_term2 : C * (⌊x⌋₊ : ℝ) ≤ C * x := by -+ refine mul_le_mul_of_nonneg_left ?_ hC -+ exact Nat.floor_le (by positivity) -+ exact h_sum_bound.trans (add_le_add h_term1 h_term2) -+ -+lemma sum_abs_R_isLittleO : (fun x : ℝ => ∑ k ∈ Iic ⌊x⌋₊, |R (x / k)|) =o[atTop] (fun x => x * log x) := by -+ have h_eps : ∀ ε > 0, ∃ x₀ : ℝ, ∀ x ≥ x₀, (∑ k ∈ Finset.Icc 1 ⌊x⌋₊, |R (x / k)|) ≤ ε * x * Real.log x := by -+ intro ε hε_pos -+ obtain ⟨A, hA⟩ : ∃ A : ℝ, 0 < A ∧ ∀ y ≥ A, |R y| ≤ (ε / 2) * y := by -+ have := R_isLittleO -+ rw [Asymptotics.isLittleO_iff] at this -+ norm_num at * -+ exact Exists.elim (this (half_pos hε_pos)) fun A hA => ⟨Max.max A 1, by positivity, fun y hy => by simpa only [abs_of_nonneg (by linarith [le_max_right A 1] : 0 ≤ y)] using hA y (le_trans (le_max_left A 1) hy)⟩ -+ obtain ⟨C_A, hC_A⟩ : ∃ C_A : ℝ, ∀ y ∈ Set.Icc 0 A, |R y| ≤ C_A := by -+ exact ⟨_, fun y hy => R_locally_bounded A hA.1.le |> Classical.choose_spec |> fun h => h y hy⟩ -+ have h_sum_bound : ∀ x ≥ max A 2, (∑ k ∈ Finset.Icc 1 ⌊x⌋₊, |R (x / k)|) ≤ (ε / 2) * x * (Real.log x + 1) + C_A * x := by -+ intros x hx -+ have h_sum_bound : ∀ y ≥ 1, |R y| ≤ (ε / 2) * y + C_A := by -+ intros y hy -+ by_cases hyA : y ≥ A -+ · exact le_add_of_le_of_nonneg (hA.right y hyA) (by -+ exact le_trans (abs_nonneg _) (hC_A 0 ⟨by norm_num, by linarith⟩)) -+ · exact le_add_of_nonneg_of_le (by -+ positivity) (hC_A y ⟨by -+ linarith, by -+ linarith⟩) -+ have := sum_bounded_of_linear_bound (show 0 ≤ ε / 2 by positivity) (show 0 ≤ C_A by exact le_trans (abs_nonneg _) (hC_A 0 ⟨by norm_num, by linarith⟩)) (fun y hy => h_sum_bound y hy) x (by linarith [le_max_right A 2]) ; aesop -+ obtain ⟨x₀, hx₀⟩ : ∃ x₀ : ℝ, ∀ x ≥ x₀, (ε / 2) * (Real.log x + 1) + C_A ≤ ε * Real.log x := by -+ exact ⟨Real.exp (2 * (C_A / ε + 1)), fun x hx => by nlinarith [Real.log_exp (2 * (C_A / ε + 1)), Real.log_le_log (by positivity) hx, mul_div_cancel₀ C_A hε_pos.ne']⟩ -+ exact ⟨Max.max x₀ (Max.max A 2), fun x hx => le_trans (h_sum_bound x (le_trans (le_max_right _ _) hx)) (by nlinarith [hx₀ x (le_trans (le_max_left _ _) hx), le_max_right x₀ (Max.max A 2), le_max_left x₀ (Max.max A 2), le_max_right A 2, le_max_left A 2, Real.log_nonneg (show x ≥ 1 by linarith [le_max_right x₀ (Max.max A 2), le_max_left x₀ (Max.max A 2), le_max_right A 2, le_max_left A 2])])⟩ -+ rw [Asymptotics.isLittleO_iff_tendsto'] -+ · have h_sum_eq : ∀ x : ℝ, x ≥ 1 → (∑ k ∈ Finset.Iic ⌊x⌋₊, |R (x / k)|) = (∑ k ∈ Finset.Icc 1 ⌊x⌋₊, |R (x / k)|) := by -+ intro x hx -+ have h0 : (0 : ℕ) ∈ Finset.Iic ⌊x⌋₊ := by simp [Finset.mem_Iic] -+ have hI : (Finset.Iic ⌊x⌋₊).erase 0 = Finset.Icc 1 ⌊x⌋₊ := by -+ ext n -+ simp [Finset.mem_Iic, Finset.mem_Icc, Nat.one_le_iff_ne_zero, and_comm] -+ rw [← Finset.sum_erase_add (Finset.Iic ⌊x⌋₊) (fun k => |R (x / k)|) h0] -+ simp [hI, R, Psi, Chebyshev.psi_eq_sum_Icc] -+ rw [Metric.tendsto_nhds] -+ simp +zetaDelta only [gt_iff_lt, ge_iff_le, dist_zero_right, norm_div, norm_eq_abs, norm_mul, -+ eventually_atTop] at * -+ intro ε hε; obtain ⟨x₀, hx₀⟩ := h_eps (ε / 2) (half_pos hε) ; use Max.max x₀ 2; intro x hx; rw [abs_of_nonneg (Finset.sum_nonneg fun _ _ => abs_nonneg _), abs_of_nonneg (by linarith [le_max_right x₀ 2]), abs_of_nonneg (Real.log_nonneg (by linarith [le_max_right x₀ 2]))] ; rw [div_lt_iff₀] <;> nlinarith [hx₀ x (le_trans (le_max_left x₀ 2) hx), Real.log_pos (by linarith [le_max_right x₀ 2] : 1 < x), mul_pos (by linarith [le_max_right x₀ 2] : 0 < x) (Real.log_pos (by linarith [le_max_right x₀ 2] : 1 < x)), h_sum_eq x (by linarith [le_max_right x₀ 2])] -+ · filter_upwards [Filter.eventually_gt_atTop 1] with x hx hx' using absurd hx' (by nlinarith [Real.log_pos hx]) -+ -+lemma R_linear_bound (ε : ℝ) (hε : 0 < ε) : ∃ C, 0 ≤ C ∧ ∀ y, 1 ≤ y → |R y| ≤ ε * y + C := by -+ obtain ⟨A, hA⟩ : ∃ A : ℝ, 0 < A ∧ ∀ y : ℝ, A ≤ y → |R y| ≤ ε * y := by -+ have := R_isLittleO.def hε -+ rw [Filter.eventually_atTop] at this; rcases this with ⟨A, hA⟩ ; exact ⟨Max.max A 1, by positivity, fun y hy => by simpa [abs_of_nonneg (show 0 ≤ y by linarith [le_max_right A 1])] using hA y (le_trans (le_max_left A 1) hy)⟩ -+ obtain ⟨CA, hCA⟩ : ∃ CA : ℝ, ∀ y ∈ Set.Icc 0 A, |R y| ≤ CA := by -+ exact R_locally_bounded A hA.1.le |> fun ⟨CA, hCA⟩ => ⟨CA, fun y hy => hCA y hy⟩ -+ exact ⟨Max.max CA 0, by positivity, fun y hy => if hy' : y ≤ A then le_trans (hCA y ⟨by linarith, by linarith⟩) (by linarith [le_max_left CA 0, le_max_right CA 0, show 0 ≤ ε * y by nlinarith]) else le_trans (hA.2 y (by linarith)) (by linarith [le_max_left CA 0, le_max_right CA 0, show 0 ≤ ε * y by nlinarith])⟩ -+ -+lemma sum_abs_R_isLittleO' : (fun x : ℝ => ∑ k ∈ Iic ⌊x⌋₊, |R (x / k)|) =o[atTop] (fun x => x * log x) := by -+ apply sum_abs_R_isLittleO -+ -+lemma M_isLittleO : M =o[atTop] id := by -+ have h_identity : ∀ x ≥ 1, M x * Real.log x = ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (Real.log (x / k) - Psi (x / k)) := by -+ exact fun x a => M_log_identity x a -+ have h_term1 : (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k)) =O[atTop] id := by -+ have h_abs : ∀ x ≥ 1, |∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k)| ≤ ∑ k ∈ Iic ⌊x⌋₊, Real.log (x / k) := by -+ intros x hx -+ have h_abs : ∀ k ∈ Iic ⌊x⌋₊, |(μ k : ℝ) * Real.log (x / k)| ≤ Real.log (x / k) := by -+ intros k hk -+ have h_abs : |(μ k : ℝ)| ≤ 1 := by -+ norm_num [ArithmeticFunction.moebius] -+ split_ifs <;> norm_num -+ by_cases hk0 : k = 0 -+ · rw [hk0] ; norm_num [ArithmeticFunction.map_zero, Nat.cast_zero, Real.log_zero, div_zero, abs_zero] -+ · have hx_pos : 0 < x := by positivity -+ have hk_pos : 0 < (k : ℝ) := by positivity -+ rw [Real.log_div hx_pos.ne' hk_pos.ne'] -+ simp only [abs_mul, ge_iff_le] -+ simp_all only [ge_iff_le, mem_Iic] -+ exact le_trans (mul_le_of_le_one_left (abs_nonneg _) h_abs) (by rw [abs_of_nonneg] ; exact sub_nonneg_of_le <| Real.log_le_log hk_pos (Nat.cast_le.mpr hk |>.trans (Nat.floor_le hx_pos.le))) -+ exact le_trans (Finset.abs_sum_le_sum_abs _ _) (Finset.sum_le_sum h_abs) -+ have h_sum_log : (fun x => ∑ k ∈ Iic ⌊x⌋₊, Real.log (x / k)) =O[atTop] id := by -+ convert sum_log_div_isBigO using 1 -+ rw [Asymptotics.isBigO_iff] at * -+ exact ⟨h_sum_log.choose, by filter_upwards [h_sum_log.choose_spec, Filter.eventually_ge_atTop 1] with x hx₁ hx₂ using le_trans (h_abs x hx₂) (le_trans (le_abs_self _) hx₁)⟩ -+ have h_term2 : (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (x / k)) =O[atTop] id := by -+ convert sum_mobius_div_isBigO using 1 -+ have h_term3 : (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * R (x / k)) =o[atTop] (fun x => x * Real.log x) := by -+ have h_abs : ∀ x ≥ 1, |∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * R (x / k)| ≤ ∑ k ∈ Iic ⌊x⌋₊, |R (x / k)| := by -+ intros x hx -+ have h_abs : ∀ k ∈ Iic ⌊x⌋₊, |(μ k : ℝ) * R (x / k)| ≤ |R (x / k)| := by -+ norm_num [abs_mul] -+ intro k hk; exact mul_le_of_le_one_left (abs_nonneg _) (mod_cast by exact abs_moebius_le_one) -+ exact le_trans (Finset.abs_sum_le_sum_abs _ _) (Finset.sum_le_sum h_abs) -+ have h_sum_abs_R : (fun x => ∑ k ∈ Iic ⌊x⌋₊, |R (x / k)|) =o[atTop] (fun x => x * Real.log x) := by -+ exact sum_abs_R_isLittleO -+ rw [Asymptotics.isLittleO_iff] at * -+ intro c hc; filter_upwards [h_sum_abs_R hc, Filter.eventually_ge_atTop 1] with x hx₁ hx₂; exact le_trans (h_abs x hx₂) (le_trans (le_abs_self _) hx₁) -+ have h_combined : (fun x => M x * Real.log x) =o[atTop] (fun x => x * Real.log x) := by -+ have h_combined : (fun x => M x * Real.log x) = (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k)) - (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (x / k)) - (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * R (x / k)) := by -+ ext x; by_cases hx : 1 ≤ x <;> simp_all +decide only [ge_iff_le, mul_sub, sum_sub_distrib, not_le, Pi.sub_apply] -+ · simp +decide [sub_sub, mul_sub, Finset.sum_sub_distrib, Psi, R] -+ · unfold M R; norm_num [Nat.floor_eq_zero.mpr hx] -+ norm_num [Finset.Iic_eq_Icc] -+ rw [h_combined] -+ refine Asymptotics.IsLittleO.sub ?_ h_term3 -+ refine Asymptotics.IsLittleO.sub ?_ ?_ -+ · refine h_term1.trans_isLittleO ?_ -+ rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num -+ · norm_num [← div_div] -+ exact le_trans (Filter.Tendsto.div_atTop (tendsto_const_nhds.congr' (by filter_upwards [Filter.eventually_ne_atTop 0] with x hx; aesop)) (Real.tendsto_log_atTop)) (by norm_num) -+ · exact ⟨2, by rintro x hx (rfl | rfl | rfl) <;> norm_num at hx⟩ -+ · refine h_term2.trans_isLittleO ?_ -+ rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num -+ · norm_num [← div_div] -+ exact le_trans (Filter.Tendsto.div_atTop (tendsto_const_nhds.congr' (by filter_upwards [Filter.eventually_ne_atTop 0] with x hx; aesop)) (Real.tendsto_log_atTop)) (by norm_num) -+ · exact ⟨2, by rintro x hx (rfl | rfl | rfl) <;> linarith⟩ -+ rw [Asymptotics.isLittleO_iff_tendsto'] at * -+ · refine h_combined.congr' (by filter_upwards [Filter.eventually_gt_atTop 1] with x hx using by rw [mul_div_mul_right _ _ (ne_of_gt <| Real.log_pos hx)] ; rfl) -+ · filter_upwards [Filter.eventually_gt_atTop 1] with x hx hx' using absurd hx' <| ne_of_gt <| mul_pos (by positivity) <| Real.log_pos hx -+ · filter_upwards [Filter.eventually_gt_atTop 1] with x hx hx' using by nlinarith [Real.log_pos hx] -+ · filter_upwards [Filter.eventually_gt_atTop 0] with x hx hx' using absurd hx' hx.ne' -+ -+lemma M_isLittleO' : M =o[atTop] id := by -+ exact M_isLittleO -+ -+theorem mu_pnt : (fun x : ℝ ↦ ∑ n ∈ range ⌊x⌋₊, μ n) =o[atTop] fun x ↦ x := by -+ have h_moebius_sum : (fun x : ℝ => ∑ n ∈ Finset.range ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x : ℝ => x) := by -+ have h_bound : (fun x : ℝ => ∑ n ∈ Finset.range ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x : ℝ => x) := by -+ have h_sum : (fun x : ℝ => ∑ n ∈ Finset.range (⌊x⌋₊ + 1), (μ n : ℝ)) =o[atTop] (fun x : ℝ => x) := by -+ have h_moebius_sum : (fun x : ℝ => ∑ n ∈ Finset.Iic ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x : ℝ => x) := by -+ convert! M_isLittleO using 1 -+ simpa only [Finset.range_eq_Ico] using! h_moebius_sum -+ have h_mu_floor : (fun x : ℝ => (μ ⌊x⌋₊ : ℝ)) =o[atTop] (fun x : ℝ => x) := by -+ rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num -+ · refine squeeze_zero_norm (a := fun x : ℝ => 1 / |x|) ?_ ?_ -+ · intro x; norm_num [abs_div] -+ exact mul_le_of_le_one_left (by positivity) (mod_cast by exact abs_moebius_le_one) -+ · exact tendsto_const_nhds.div_atTop (tendsto_norm_atTop_atTop) -+ · exact ⟨1, by intros; linarith⟩ -+ simpa [Finset.sum_range_succ] using h_sum.sub h_mu_floor -+ convert h_bound using 1 -+ rw [Asymptotics.isLittleO_iff] at * -+ simp_all +decide [Norm.norm] -+ -+lemma lambda_eq_sum_sq_dvd_mu (n : ℕ) (hn : n ≠ 0) : -+ ((-1 : ℝ) ^ (Ω n)) = ∑ d ∈ (Icc 1 n).filter (fun d => d^2 ∣ n), (μ (n / d^2) : ℝ) := by -+ set a : ℕ → ℕ := fun p => Nat.factorization n p with ha -+ have hn_factor : n = ∏ p ∈ Nat.primeFactors n, p ^ a p := by -+ exact Eq.symm ( Nat.prod_factorization_pow_eq_self hn ); -+ have h_sum_factor : (∑ d ∈ Finset.filter (fun d => d^2 ∣ n) (Finset.Icc 1 n), (μ (n / d^2) : ℝ)) = (∏ p ∈ Nat.primeFactors n, (∑ d ∈ Finset.range (a p / 2 + 1), (μ (p^(a p - 2 * d)) : ℝ))) := by -+ have h_mult : ∀ {m n : ℕ}, Nat.gcd m n = 1 → (∑ d ∈ Finset.filter (fun d => d^2 ∣ m * n) (Finset.Icc 1 (m * n)), (μ (m * n / d^2) : ℝ)) = (∑ d ∈ Finset.filter (fun d => d^2 ∣ m) (Finset.Icc 1 m), (μ (m / d^2) : ℝ)) * (∑ d ∈ Finset.filter (fun d => d^2 ∣ n) (Finset.Icc 1 n), (μ (n / d^2) : ℝ)) := by -+ intros m n h_coprime -+ have h_filter : Finset.filter (fun d => d^2 ∣ m * n) (Finset.Icc 1 (m * n)) = Finset.image (fun (d : ℕ × ℕ) => d.1 * d.2) (Finset.filter (fun d => d^2 ∣ m) (Finset.Icc 1 m) ×ˢ Finset.filter (fun d => d^2 ∣ n) (Finset.Icc 1 n)) := by -+ ext d -+ simp only [mem_filter, mem_Icc, mem_image, mem_product, Prod.exists] -+ constructor -+ · intro h -+ obtain ⟨d1, d2, hd1, hd2, hd⟩ : ∃ d1 d2 : ℕ, d1^2 ∣ m ∧ d2^2 ∣ n ∧ d = d1 * d2 := by -+ have h_factor : d^2 ∣ m * n → ∃ d1 d2 : ℕ, d1^2 ∣ m ∧ d2^2 ∣ n ∧ d = d1 * d2 := by -+ intro h_div -+ obtain ⟨d1, d2, hd1, hd2, hd⟩ : ∃ d1 d2 : ℕ, d1 ∣ m ∧ d2 ∣ n ∧ d = d1 * d2 := by -+ exact Exists.imp ( by tauto ) ( Nat.dvd_mul.mp ( dvd_of_mul_left_dvd h_div ) ); -+ refine ⟨ d1, d2, ?_, ?_, hd ⟩ -+ · apply Nat.Coprime.dvd_of_dvd_mul_right -+ · exact Nat.Coprime.pow_left 2 (Nat.Coprime.coprime_dvd_left hd1 h_coprime) -+ · exact dvd_trans (pow_dvd_pow_of_dvd (hd.symm ▸ dvd_mul_right _ _) 2) h_div -+ · subst hd -+ apply Nat.Coprime.dvd_of_dvd_mul_left -+ · exact Nat.Coprime.pow_left _ (Nat.Coprime.symm <| Nat.Coprime.coprime_dvd_right hd2 h_coprime) -+ · exact dvd_trans ⟨d1 ^ 2, by ring⟩ h_div -+ exact h_factor h.2; -+ refine ⟨ d1, d2, ?_, ?_ ⟩ <;> norm_num [ hd ] -+ exact ⟨ ⟨ ⟨ Nat.pos_of_ne_zero ( by rintro rfl; linarith ), Nat.le_of_dvd ( Nat.pos_of_ne_zero ( by rintro rfl; linarith ) ) ( dvd_of_mul_left_dvd hd1 ) ⟩, hd1 ⟩, ⟨ Nat.pos_of_ne_zero ( by rintro rfl; linarith ), Nat.le_of_dvd ( Nat.pos_of_ne_zero ( by rintro rfl; linarith ) ) ( dvd_of_mul_left_dvd hd2 ) ⟩, hd2 ⟩; -+ · intro h -+ rcases h with ⟨ a, b, ⟨ ⟨ ⟨ ha₁, ha₂ ⟩, ha₃ ⟩, ⟨ ⟨ hb₁, hb₂ ⟩, hb₃ ⟩ ⟩, rfl ⟩ ; exact ⟨ ⟨ by nlinarith, by nlinarith ⟩, by convert Nat.mul_dvd_mul ha₃ hb₃ using 1 ; ring ⟩ ; -+ rw [ h_filter, Finset.sum_image ]; -+ · rw [ Finset.sum_product, Finset.sum_mul ]; -+ simp +decide only [Finset.mul_sum _ _ _]; -+ refine Finset.sum_congr rfl fun x hx => Finset.sum_congr rfl fun y hy => ?_ -+ rw [show m * n / (x * y) ^ 2 = (m / x ^ 2) * (n / y ^ 2) by -+ have hx' : x ^ 2 ∣ m := by -+ simpa only [sq] using (Finset.mem_filter.mp hx).2 -+ have hy' : y ^ 2 ∣ n := by -+ simpa only [sq] using (Finset.mem_filter.mp hy).2 -+ simpa [mul_pow, mul_assoc, mul_left_comm, mul_comm] using -+ (Nat.div_mul_div_comm (a := m) (b := x ^ 2) (c := n) (d := y ^ 2) hx' hy').symm] -+ norm_cast -+ apply ArithmeticFunction.IsMultiplicative.map_mul_of_coprime; -+ · exact ArithmeticFunction.isMultiplicative_moebius; -+ · exact Nat.Coprime.coprime_dvd_left ( Nat.div_dvd_of_dvd <| Finset.mem_filter.mp hx |>.2 ) <| Nat.Coprime.coprime_dvd_right ( Nat.div_dvd_of_dvd <| Finset.mem_filter.mp hy |>.2 ) h_coprime; -+ · intros x hx y hy; simp +contextual only [ne_eq, coe_product, coe_filter, mem_Icc, Set.mem_prod, Set.mem_ofPred_eq] at *; -+ intro hxy -+ have h_eq1 : x.1 = y.1 := by -+ exact Nat.dvd_antisymm ( by exact Nat.Coprime.dvd_of_dvd_mul_right ( show Nat.Coprime ( x.1 ) ( y.2 ) from Nat.Coprime.coprime_dvd_left ( dvd_of_mul_left_dvd hx.1.2 ) <| Nat.Coprime.coprime_dvd_right ( dvd_of_mul_left_dvd hy.2.2 ) h_coprime ) <| hxy.symm ▸ dvd_mul_right _ _ ) ( by exact Nat.Coprime.dvd_of_dvd_mul_right ( show Nat.Coprime ( y.1 ) ( x.2 ) from Nat.Coprime.coprime_dvd_left ( dvd_of_mul_left_dvd hy.1.2 ) <| Nat.Coprime.coprime_dvd_right ( dvd_of_mul_left_dvd hx.2.2 ) h_coprime ) <| hxy.symm ▸ dvd_mul_right _ _ ) -+ have h_eq2 : x.2 = y.2 := by -+ nlinarith -+ exact Prod.ext h_eq1 h_eq2; -+ have h_prod : (∑ d ∈ Finset.filter (fun d => d^2 ∣ n) (Finset.Icc 1 n), (μ (n / d^2) : ℝ)) = (∏ p ∈ Nat.primeFactors n, (∑ d ∈ Finset.filter (fun d => d^2 ∣ p^(a p)) (Finset.Icc 1 (p^(a p))), (μ (p^(a p) / d^2) : ℝ))) := by -+ have h_prod : ∀ {S : Finset ℕ}, (∀ p ∈ S, Nat.Prime p) → (∑ d ∈ Finset.filter (fun d => d^2 ∣ ∏ p ∈ S, p^(a p)) (Finset.Icc 1 (∏ p ∈ S, p^(a p))), (μ ((∏ p ∈ S, p^(a p)) / d^2) : ℝ)) = (∏ p ∈ S, (∑ d ∈ Finset.filter (fun d => d^2 ∣ p^(a p)) (Finset.Icc 1 (p^(a p))), (μ (p^(a p) / d^2) : ℝ))) := by -+ intro S hS; induction S using Finset.induction <;> norm_num at *; -+ · norm_num [ Finset.sum_filter ]; -+ · rw [ Finset.prod_insert ‹_›, h_mult ]; -+ · rw [ Finset.prod_insert ‹_›, ‹ ( ∀ p ∈ _, Nat.Prime p ) → ∑ d ∈ Finset.Icc 1 ( ∏ p ∈ _, p ^ a p ) with d ^ 2 ∣ ∏ p ∈ _, p ^ a p, ( μ ( ( ∏ p ∈ _, p ^ a p ) / d ^ 2 ) : ℝ ) = ∏ p ∈ _, ∑ d ∈ Finset.Icc 1 ( p ^ a p ) with d ^ 2 ∣ p ^ a p, ( μ ( p ^ a p / d ^ 2 ) : ℝ ) › hS.2 ]; -+ · exact Nat.Coprime.prod_right fun p hp => Nat.coprime_pow_primes _ _ hS.1 ( hS.2 p hp ) <| by rintro rfl; exact ‹¬_› hp; -+ convert h_prod fun p hp => Nat.prime_of_mem_primeFactors hp; -+ have h_divisors : ∀ p ∈ Nat.primeFactors n, Finset.filter (fun d => d^2 ∣ p^(a p)) (Finset.Icc 1 (p^(a p))) = Finset.image (fun k => p^k) (Finset.Icc 0 (a p / 2)) := by -+ intro p hp -+ ext d -+ simp only [mem_filter, mem_Icc, mem_image, _root_.zero_le, true_and] -+ constructor; -+ · intro hd; -+ have : d ∣ p ^ a p := dvd_of_mul_left_dvd hd.2; ( rw [ Nat.dvd_prime_pow ( Nat.prime_of_mem_primeFactors hp ) ] at this; obtain ⟨ k, hk ⟩ := this; use k; simp +decide only [ hk, and_true ] at hd ⊢; ); -+ rw [ Nat.le_div_iff_mul_le zero_lt_two ] ; rw [ ← pow_mul ] at hd ; exact Nat.le_of_not_lt fun h => absurd ( Nat.le_of_dvd ( pow_pos ( Nat.pos_of_mem_primeFactors hp ) _ ) hd.2 ) ( by exact not_le_of_gt ( pow_lt_pow_right₀ ( Nat.Prime.one_lt ( Nat.prime_of_mem_primeFactors hp ) ) ( by linarith ) ) ) ; -+ · rintro ⟨ k, hk₁, rfl ⟩ ; exact ⟨ ⟨ Nat.one_le_pow _ _ ( Nat.pos_of_mem_primeFactors hp ), Nat.pow_le_pow_right ( Nat.pos_of_mem_primeFactors hp ) ( by omega ) ⟩, by rw [ ← pow_mul ] ; exact pow_dvd_pow _ ( by omega ) ⟩ ; -+ rw [ h_prod, Finset.prod_congr rfl ]; -+ intro p hp; rw [ show ( Finset.filter ( fun d => d ^ 2 ∣ p ^ a p ) ( Finset.Icc 1 ( p ^ a p ) ) ) = Finset.image ( fun k => p ^ k ) ( Finset.Icc 0 ( a p / 2 ) ) from h_divisors p hp ] ; rw [ Finset.sum_image ] <;> norm_num [ pow_mul', Nat.div_eq_of_lt ] ; -+ · rw [Finset.range_eq_Ico, ← Order.succ_eq_add_one, Finset.Ico_succ_right_eq_Icc] -+ refine Finset.sum_congr rfl ?_ -+ intro x hx -+ rw [← pow_mul', Nat.mul_comm] -+ have hx_pos : 0 < p ^ (x * 2) := pow_pos (Nat.pos_of_mem_primeFactors hp) _ -+ have hx_eq : p ^ a p = p ^ (a p - x * 2) * p ^ (x * 2) := by -+ rw [← pow_add, Nat.sub_add_cancel (by linarith [Finset.mem_Icc.mp hx, Nat.div_mul_le_self (a p) 2])] -+ rw [Nat.div_eq_of_eq_mul_left hx_pos hx_eq] -+ · exact fun x hx y hy hxy => Nat.pow_right_injective ( Nat.Prime.one_lt ( Nat.prime_of_mem_primeFactors hp ) ) hxy; -+ have h_inner_sum : ∀ p ∈ Nat.primeFactors n, (∑ d ∈ Finset.range (a p / 2 + 1), (μ (p^(a p - 2 * d)) : ℝ)) = (-1 : ℝ) ^ (a p) := by -+ intro p hp -+ have h_inner_sum_cases : ∀ d ∈ Finset.range (a p / 2 + 1), (μ (p^(a p - 2 * d)) : ℝ) = if a p - 2 * d = 0 then 1 else if a p - 2 * d = 1 then -1 else 0 := by -+ simp +zetaDelta only [ne_eq, mem_primeFactors, mem_range] at * -+ intro d hd -+ rcases k : (n.factorization p - 2 * d) with (_ | _ | k) -+ · simp +decide only [pow_zero, isUnit_iff_eq_one, IsUnit.squarefree, moebius_apply_of_squarefree, Int.reduceNeg, -+ cardFactors_one, Int.cast_one, ↓reduceIte] -+ · simp +decide only [zero_add, pow_one, ↓reduceIte] -+ norm_num [hp.1, ArithmeticFunction.moebius] -+ exact hp.1.squarefree -+ · simp +decide only [Nat.add_eq_zero_iff, and_false, and_self, ↓reduceIte, Nat.add_eq_right, Int.cast_eq_zero] -+ exact -+ ArithmeticFunction.moebius_eq_zero_of_not_squarefree -+ (by rw [Nat.squarefree_pow_iff] <;> norm_num [hp.1.ne_one, hp.1.ne_zero]) -+ rw [ Finset.sum_congr rfl h_inner_sum_cases ] ; norm_num [ Finset.sum_ite ] ; rcases Nat.even_or_odd' ( a p ) with ⟨ k, hk | hk ⟩ <;> norm_num [ hk, pow_add, pow_mul ] -+ · ring_nf -+ norm_num [ show ∀ x : ℕ, k * 2 - x * 2 = 0 ↔ x ≥ k by intro x; exact ⟨ fun hx => by contrapose! hx; exact Nat.ne_of_gt <| Nat.sub_pos_of_lt <| by linarith, fun hx => Nat.sub_eq_zero_of_le <| by linarith ⟩ ]; -+ have h_first : -+ Finset.filter (fun x => k ≤ x) (Finset.range (k + 1)) = {k} := by -+ ext x -+ simp -+ omega -+ have h_second : -+ Finset.filter (fun x => k * 2 - x * 2 = 1) -+ (Finset.filter (fun x => ¬2 * k - 2 * x = 0) (Finset.range (k + 1))) = ∅ := by -+ ext x -+ simp -+ omega -+ rw [h_first, h_second] -+ norm_num -+ · ring_nf -+ norm_num [ Nat.add_div ]; -+ rw [ Finset.card_eq_zero.mpr ] <;> norm_num; -+ · rw [ Finset.card_eq_one ] ; use k ; ext x ; norm_num ; omega; -+ · intros; omega; -+ rw [ h_sum_factor, Finset.prod_congr rfl h_inner_sum ]; -+ rw [ Finset.prod_pow_eq_pow_sum ]; -+ rw [ ArithmeticFunction.cardFactors_apply ]; -+ rw [ ← Multiset.coe_card, ← Multiset.toFinset_sum_count_eq ]; -+ norm_num +zetaDelta [Nat.primeFactorsList_count_eq] -+ -+lemma sum_lambda_eq_sum_mu_div_sq (N : ℕ) : -+ ∑ n ∈ Finset.Icc 1 N, ((-1 : ℝ) ^ (Ω n)) = -+ ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), ∑ k ∈ Finset.Icc 1 (N / d^2), (μ k : ℝ) := by -+ have h_sum_rewrite : ∑ n ∈ Finset.Icc 1 N, (-1 : ℝ) ^ (Ω n) = ∑ n ∈ Finset.Icc 1 N, ∑ d ∈ (Finset.Icc 1 N).filter (fun d => d^2 ∣ n), (μ (n / d^2) : ℝ) := by -+ have h_sum_rewrite : ∀ n ∈ Finset.Icc 1 N, (-1 : ℝ) ^ (Ω n) = ∑ d ∈ (Finset.Icc 1 N).filter (fun d => d^2 ∣ n), (μ (n / d^2) : ℝ) := by -+ intro n hn -+ have h_lambda_eq : ((-1 : ℝ) ^ (Ω n)) = ∑ d ∈ (Finset.Icc 1 n).filter (fun d => d^2 ∣ n), (μ (n / d^2) : ℝ) := by -+ convert lambda_eq_sum_sq_dvd_mu n ( by linarith [ Finset.mem_Icc.mp hn ] ) using 1; -+ rw [ h_lambda_eq, Finset.sum_subset ]; -+ · exact fun x hx => Finset.mem_filter.mpr ⟨ Finset.mem_Icc.mpr ⟨ Finset.mem_Icc.mp ( Finset.mem_filter.mp hx |>.1 ) |>.1, by linarith [ Finset.mem_Icc.mp ( Finset.mem_filter.mp hx |>.1 ) |>.2, Finset.mem_Icc.mp hn |>.2 ] ⟩, Finset.mem_filter.mp hx |>.2 ⟩; -+ · simp +zetaDelta only [mem_Icc, mem_filter, not_and, and_imp, Int.cast_eq_zero] at * -+ exact fun x hx₁ hx₂ hx₃ hx₄ => False.elim <| hx₄ hx₁ ( by nlinarith [ Nat.le_of_dvd ( by linarith ) hx₃ ] ) hx₃; -+ exact Finset.sum_congr rfl h_sum_rewrite; -+ rw [ h_sum_rewrite, Finset.sum_sigma' ]; -+ have h_reindex : ∑ x ∈ (Finset.Icc 1 N).sigma fun (n : ℕ) => {d ∈ Finset.Icc 1 N | d ^ 2 ∣ n}, (μ (x.fst / x.snd ^ 2) : ℝ) = ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), ∑ k ∈ Finset.Icc 1 (N / d ^ 2), (μ k : ℝ) := by -+ have : Finset.filter (fun x => x.snd ^ 2 ∣ x.fst) (Finset.Icc 1 N ×ˢ Finset.Icc 1 N) = Finset.biUnion (Finset.Icc 1 (Nat.sqrt N)) (fun d => Finset.image (fun k => (d ^ 2 * k, d)) (Finset.Icc 1 (N / d ^ 2))) := by -+ ext ⟨n, d⟩ -+ simp only [Finset.mem_filter, Finset.mem_product, Finset.mem_Icc, Finset.mem_biUnion, Finset.mem_image, Prod.mk.injEq] -+ constructor -+ · intro ⟨⟨⟨hn1, hn2⟩, hd1, hd2⟩, hdiv⟩ -+ exact ⟨d, ⟨hd1, by rw [Nat.le_sqrt]; nlinarith [Nat.le_of_dvd (by linarith) hdiv]⟩, n / d ^ 2, ⟨Nat.div_pos (Nat.le_of_dvd (by linarith) hdiv) (by nlinarith), Nat.div_le_div_right hn2⟩, Nat.mul_div_cancel' hdiv, rfl⟩ -+ · rintro ⟨a, ⟨ha₁, ha₂⟩, b, ⟨hb₁, hb₂⟩, hn, hd⟩ -+ rw [← hn, ← hd] -+ exact ⟨⟨⟨by nlinarith, by nlinarith [Nat.div_mul_le_self N (a ^ 2)]⟩, ha₁, by nlinarith [Nat.sqrt_le N]⟩, dvd_mul_right _ _⟩ -+ rw [ Finset.sum_sigma' ]; -+ apply Finset.sum_bij (fun x _ => ⟨x.snd, x.fst / x.snd ^ 2⟩); -+ · simp_all +decide only [Finset.ext_iff, mem_filter, mem_product, mem_Icc, mem_biUnion, mem_image, Prod.forall, -+ Prod.mk.injEq, ↓existsAndEq, and_true, exists_and_left, mem_sigma, true_and, and_imp] -+ exact fun x hx₁ hx₂ hx₃ hx₄ hx₅ => ⟨ by nlinarith [ Nat.le_of_dvd ( by linarith ) hx₅, Nat.lt_succ_sqrt N ], Nat.div_pos ( Nat.le_of_dvd ( by linarith ) hx₅ ) ( by positivity ), Nat.div_le_div_right hx₂ ⟩; -+ · simp +contextual [ Finset.mem_sigma, Finset.mem_filter ]; -+ aesop; -+ · simp +zetaDelta only [mem_sigma, mem_Icc, mem_filter, exists_prop, Sigma.exists, and_imp] at * -+ exact fun b hb₁ hb₂ hb₃ hb₄ => ⟨ b.fst ^ 2 * b.snd, b.fst, ⟨ ⟨ by nlinarith, by nlinarith [ Nat.div_mul_le_self N ( b.fst ^ 2 ) ] ⟩, ⟨ by nlinarith, by nlinarith [ Nat.div_mul_le_self N ( b.fst ^ 2 ) ] ⟩, by norm_num ⟩, by simp +decide [ Nat.mul_div_cancel_left _ ( by nlinarith : 0 < b.fst ^ 2 ) ] ⟩; -+ · aesop; -+ convert h_reindex using 1 -+ -+lemma sum_mu_div_sq_isLittleO : (fun N : ℕ ↦ ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), ∑ k ∈ Finset.Icc 1 (N / d^2), (μ k : ℝ)) =o[atTop] (fun N ↦ (N : ℝ)) := by -+ have h_sum_rewrite : ∀ N : ℕ, (∑ d ∈ Finset.Icc 1 (Nat.sqrt N), (∑ k ∈ Finset.Icc 1 (N / d^2), (μ k : ℝ))) = (∑ d ∈ Finset.Icc 1 (Nat.sqrt N), (M (N / d^2) : ℝ)) := by -+ intro N -+ simp only [M] -+ refine Finset.sum_congr rfl ?_ -+ intro x hx -+ erw [ Finset.sum_Ico_eq_sub _ ] <;> norm_num [ Finset.sum_range_succ' ]; -+ rw [ show ⌊ ( N : ℝ ) / x ^ 2⌋₊ = N / x ^ 2 from Nat.floor_eq_iff ( by positivity ) |>.2 ⟨ by rw [ le_div_iff₀ ( by norm_cast; nlinarith [ Finset.mem_Icc.mp hx ] ) ] ; norm_cast; linarith [ Nat.div_mul_le_self N ( x ^ 2 ) ], by rw [ div_lt_iff₀ ( by norm_cast; nlinarith [ Finset.mem_Icc.mp hx ] ) ] ; norm_cast; linarith [ Nat.div_add_mod N ( x ^ 2 ), Nat.mod_lt N ( show x ^ 2 > 0 by nlinarith [ Finset.mem_Icc.mp hx ] ) ] ⟩ ] ; erw [ Finset.sum_Ico_eq_sub _ ] <;> norm_num [ Finset.sum_range_succ' ] ; -+ have h_bound : ∀ ε > 0, ∃ N₀ : ℕ, ∀ N ≥ N₀, ∀ d ∈ Finset.Icc 1 (Nat.sqrt N), |M (N / d^2)| ≤ ε * (N / d^2) + N₀ := by -+ have h_bound : ∀ ε > 0, ∃ C : ℝ, ∀ x : ℝ, 1 ≤ x → |M x| ≤ ε * x + C := by -+ have h_bound : ∀ ε > 0, ∃ C : ℝ, ∀ x : ℝ, 1 ≤ x → |M x| ≤ ε * x + C := by -+ intro ε hε -+ have := M_isLittleO' -+ rw [ Asymptotics.isLittleO_iff ] at this; -+ norm_num +zetaDelta at *; -+ obtain ⟨ a, ha ⟩ := this hε; -+ obtain ⟨C, hC⟩ : ∃ C : ℝ, ∀ x ∈ Set.Icc 1 a, |M x| ≤ C := by -+ have h_bounded : BddAbove (Set.image (fun x => |M x|) (Set.Icc 1 a)) := by -+ have h_bounded : BddAbove (Set.image (fun x => |∑ n ∈ Finset.Iic ⌊x⌋₊, (μ n : ℝ)|) (Set.Icc 1 a)) := by -+ have h_finite : Set.Finite (Set.image (fun x => ⌊x⌋₊) (Set.Icc 1 a)) := by -+ exact Set.finite_iff_bddAbove.mpr ⟨ ⌊a⌋₊, Set.forall_mem_image.mpr fun x hx => Nat.floor_mono hx.2 ⟩ -+ have h_bounded : BddAbove (Set.image (fun n : ℕ => |∑ k ∈ Finset.Iic n, (μ k : ℝ)|) (Set.image (fun x => ⌊x⌋₊) (Set.Icc 1 a))) := by -+ exact Set.Finite.bddAbove <| h_finite.image _; -+ exact ⟨ h_bounded.choose, Set.forall_mem_image.2 fun x hx => h_bounded.choose_spec <| Set.mem_image_of_mem _ <| Set.mem_image_of_mem _ hx ⟩; -+ convert! h_bounded using 1; -+ exact ⟨ h_bounded.choose, fun x hx => h_bounded.choose_spec ⟨ x, hx, rfl ⟩ ⟩; -+ exact ⟨ Max.max C 0, fun x hx => if hx' : x ≤ a then le_trans ( hC x ⟨ hx, hx' ⟩ ) ( le_max_left _ _ ) |> le_trans <| le_add_of_nonneg_left <| by positivity else le_trans ( ha x <| le_of_not_ge hx' ) <| by rw [ abs_of_nonneg <| by linarith ] ; exact le_add_of_nonneg_right <| by positivity ⟩; -+ assumption; -+ intro ε hε -+ obtain ⟨C, hC⟩ := h_bound ε hε -+ refine ⟨⌈C⌉₊ + 1, ?_⟩ -+ intro N hN d hd -+ specialize hC (N / d ^ 2) -+ rcases eq_or_ne d 0 with rfl | hd0 -+ · simp_all +decide only [gt_iff_lt, ge_iff_le, mem_Icc, _root_.zero_le, and_true] -+ · simp_all +decide only [gt_iff_lt, ge_iff_le, mem_Icc, ne_eq, cast_add, cast_one] -+ exact -+ le_trans -+ (hC <| -+ by -+ rw [le_div_iff₀ <| by positivity] -+ nlinarith [show (d : ℝ) ^ 2 ≤ N by norm_cast; nlinarith [Nat.sqrt_le N]]) -+ (by linarith [Nat.le_ceil C]) -+ have h_sum_bound : ∀ ε > 0, ∃ N₀ : ℕ, ∀ N ≥ N₀, |∑ d ∈ Finset.Icc 1 (Nat.sqrt N), M (N / d^2)| ≤ ε * N * (∑' k : ℕ, (1 : ℝ) / (k^2)) + N₀ * Nat.sqrt N := by -+ intros ε hε_pos -+ obtain ⟨N₀, hN₀⟩ := h_bound ε hε_pos -+ use N₀ -+ intro N hN -+ have h_sum_bound : |∑ d ∈ Finset.Icc 1 (Nat.sqrt N), M (N / d^2)| ≤ ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), (ε * (N / d^2) + N₀) := by -+ exact le_trans ( Finset.abs_sum_le_sum_abs _ _ ) ( Finset.sum_le_sum fun x hx => hN₀ N hN x hx ); -+ refine le_trans h_sum_bound ?_; -+ norm_num [ Finset.sum_add_distrib, Finset.mul_sum _ _ _, mul_assoc, mul_comm, mul_left_comm, div_eq_mul_inv ]; -+ rw [ ← Finset.mul_sum _ _ _, ← Finset.mul_sum _ _ _ ]; -+ exact mul_le_mul_of_nonneg_left ( mul_le_mul_of_nonneg_left ( Summable.sum_le_tsum ( Finset.Icc 1 N.sqrt ) ( fun _ _ => by positivity ) ( by simp ) ) ( Nat.cast_nonneg _ ) ) hε_pos.le; -+ rw [ Asymptotics.isLittleO_iff ]; -+ intro c hc -+ obtain ⟨ε, hε_pos, hε⟩ : ∃ ε > 0, ε * (∑' k : ℕ, (1 : ℝ) / (k^2)) < c / 2 := by -+ exact ⟨ ( c / 2 ) / ( ∑' k : ℕ, 1 / ( k : ℝ ) ^ 2 + 1 ), div_pos ( half_pos hc ) ( add_pos_of_nonneg_of_pos ( tsum_nonneg fun _ => by positivity ) zero_lt_one ), by rw [ div_mul_eq_mul_div, div_lt_iff₀ ] <;> nlinarith [ show 0 ≤ ∑' k : ℕ, 1 / ( k : ℝ ) ^ 2 from tsum_nonneg fun _ => by positivity ] ⟩; -+ obtain ⟨ N₀, hN₀ ⟩ := h_sum_bound ε hε_pos; -+ obtain ⟨N₁, hN₁⟩ : ∃ N₁ : ℕ, ∀ N ≥ N₁, N₀ * Nat.sqrt N ≤ (c / 2) * N := by -+ have h_sqrt_growth : ∃ N₁ : ℕ, ∀ N ≥ N₁, (N₀ : ℝ) * Real.sqrt N ≤ (c / 2) * N := by -+ have h_sqrt_bound : Filter.Tendsto (fun N : ℕ => (N₀ : ℝ) * Real.sqrt N / N) Filter.atTop (nhds 0) := by -+ simpa [ mul_div_assoc, Real.sqrt_div_self ] using tendsto_const_nhds.mul ( tendsto_inv_atTop_nhds_zero_nat.sqrt ) -+ exact Filter.eventually_atTop.mp ( h_sqrt_bound.eventually ( gt_mem_nhds <| show 0 < c / 2 by positivity ) ) |> fun ⟨ N₁, hN₁ ⟩ ↦ ⟨ N₁ + 1, fun N hN ↦ by have := hN₁ N ( by linarith ) ; rw [ div_lt_iff₀ ] at this <;> nlinarith [ show ( N : ℝ ) ≥ N₁ + 1 by exact_mod_cast hN ] ⟩; -+ exact ⟨ h_sqrt_growth.choose, fun N hN => le_trans ( mul_le_mul_of_nonneg_left ( Real.le_sqrt_of_sq_le <| mod_cast Nat.sqrt_le' _ ) <| Nat.cast_nonneg _ ) <| h_sqrt_growth.choose_spec N hN ⟩; -+ filter_upwards [ Filter.eventually_ge_atTop N₀, Filter.eventually_ge_atTop N₁ ] with N hN₀' hN₁' using by rw [ Real.norm_of_nonneg ( Nat.cast_nonneg _ ) ] ; rw [ h_sum_rewrite ] ; exact le_trans ( hN₀ _ hN₀' ) ( by nlinarith [ hN₁ _ hN₁', show ( N : ℝ ) ≥ 0 by positivity ] ) ; -+ -+theorem lambda_pnt : (fun x : ℝ ↦ ∑ n ∈ range ⌊x⌋₊, (-1)^(Ω n)) =o[atTop] fun x ↦ x := by -+ have h_lambda_pnt : (fun N : ℕ => ∑ n ∈ Finset.range N, (-1 : ℝ) ^ (Nat.factorization n).sum (fun p k => k)) =o[Filter.atTop] (fun N : ℕ => (N : ℝ)) := by -+ have h_lambda_pnt : (fun N : ℕ => ∑ n ∈ Finset.Icc 1 N, (-1 : ℝ) ^ (Nat.factorization n).sum (fun p k => k)) =o[Filter.atTop] (fun N : ℕ => (N : ℝ)) := by -+ have h_lambda_pnt : (fun N : ℕ => ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), ∑ k ∈ Finset.Icc 1 (N / d^2), (μ k : ℝ)) =o[Filter.atTop] (fun N : ℕ => (N : ℝ)) := by -+ exact sum_mu_div_sq_isLittleO -+ convert h_lambda_pnt using 2; -+ convert sum_lambda_eq_sum_mu_div_sq _; -+ exact Eq.symm cardFactors_eq_sum_factorization -+ have h_lambda_pnt : (fun N : ℕ => ∑ n ∈ Finset.range (N + 1), (-1 : ℝ) ^ (Nat.factorization n).sum (fun p k => k)) =o[Filter.atTop] (fun N : ℕ => (N : ℝ)) := by -+ rw [ Asymptotics.isLittleO_iff_tendsto' ] at * <;> norm_num at *; -+ · convert h_lambda_pnt.add ( show Filter.Tendsto ( fun x : ℕ => ( 1 : ℝ ) / x ) Filter.atTop ( nhds 0 ) from tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop ) using 2 <;> norm_num [ Finset.sum_Ico_eq_sum_range ]; -+ erw [ Finset.sum_Ico_eq_sub _ _ ] <;> norm_num [ Finset.sum_range_succ' ] ; ring_nf; -+ · exact ⟨ 1, by aesop ⟩; -+ · exact ⟨ 1, by aesop ⟩; -+ simp_all +decide only [Finset.sum_range_succ] -+ have := h_lambda_pnt.sub ( show ( fun N : ℕ => ( -1 : ℝ ) ^ N.factorization.sum fun p k => k ) =o[Filter.atTop] fun N : ℕ => ( N : ℝ ) from ?_ ); -+ · aesop; -+ · rw [ Asymptotics.isLittleO_iff_tendsto' ] <;> norm_num; -+ · exact tendsto_zero_iff_norm_tendsto_zero.mpr ( by simpa using tendsto_inv_atTop_nhds_zero_nat ); -+ · exact ⟨ 1, fun n hn => by positivity ⟩; -+ have h_floor : (fun x : ℝ => ∑ n ∈ Finset.range ⌊x⌋₊, (-1 : ℝ) ^ (Nat.factorization n).sum (fun p k => k)) =o[Filter.atTop] (fun x : ℝ => (⌊x⌋₊ : ℝ)) := by -+ rw [ Asymptotics.isLittleO_iff_tendsto' ] at * <;> norm_num at *; -+ · exact h_lambda_pnt.comp <| tendsto_nat_floor_atTop; -+ · exact ⟨ 1, by aesop ⟩; -+ · exact ⟨ 1, by intros; linarith ⟩; -+ rw [ Asymptotics.isLittleO_iff ] at *; -+ intro c hc -+ filter_upwards [h_floor (half_pos hc), Filter.eventually_gt_atTop 1] with x hx₁ hx₂ -+ refine le_trans ?_ (le_trans hx₁ ?_) -+ · norm_num [ Norm.norm ]; -+ convert le_rfl using 2; -+ congr! 2; -+ exact Eq.symm cardFactors_eq_sum_factorization -+ · norm_num [ abs_of_nonneg, Nat.floor_le, hx₂.le ]; -+ rw [ abs_of_nonneg ( by positivity ) ] ; nlinarith [ Nat.floor_le ( by positivity : 0 ≤ x ) ] -+ -+lemma sum_mobius_floor (x : ℝ) (hx : 1 ≤ x) : ∑ n ∈ Icc 1 ⌊x⌋₊, (μ n : ℝ) * ⌊x / n⌋ = 1 := by -+ classical -+ have h := sum_mobius_mul_floor x hx -+ have h0 : (0 : ℕ) ∈ Iic ⌊x⌋₊ := by simp [Finset.mem_Iic] -+ have hI : (Iic ⌊x⌋₊).erase 0 = Icc 1 ⌊x⌋₊ := by -+ ext n -+ simp [Finset.mem_Iic, Finset.mem_Icc, Nat.one_le_iff_ne_zero, and_comm] -+ rw [← Finset.sum_erase_add (Iic ⌊x⌋₊) (fun n => (μ n : ℝ) * (⌊x / n⌋ : ℝ)) h0] at h -+ simpa [hI] using h -+ -+lemma sum_mobius_floor_tail_isLittleO (K : ℕ) (hK : 0 < K) : -+ (fun x : ℝ => ∑ n ∈ Finset.Ioc ⌊x/K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)) =o[atTop] fun x => x := by -+ have h_group : ∀ x : ℝ, x ≥ 1 → ∑ n ∈ Finset.Ioc ⌊x / (K : ℝ)⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x / n⌋ = ∑ k ∈ Finset.Ico 1 K, k * (∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) := by -+ intro x hx -+ have h_group : ∑ n ∈ Finset.Ioc ⌊x / (K : ℝ)⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x / n⌋ = ∑ k ∈ Finset.Ico 1 K, ∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ) * k := by -+ have h_group : Finset.Ioc ⌊x / (K : ℝ)⌋₊ ⌊x⌋₊ = Finset.biUnion (Finset.Ico 1 K) (fun k => Finset.Ioc (⌊x / (k + 1 : ℝ)⌋₊) (⌊x / (k : ℝ)⌋₊)) := by -+ ext n -+ simp only [mem_Ioc, mem_biUnion, mem_Ico] -+ constructor -+ · intro hn -+ refine ⟨⌊x / n⌋₊, ?_, ?_, ?_⟩ -+ all_goals generalize_proofs at * -+ · rw [Nat.floor_lt', div_lt_iff₀] <;> norm_num <;> try linarith [show (n : ℝ) ≥ 1 by norm_cast; linarith] -+ exact ⟨by rw [le_div_iff₀ (Nat.cast_pos.mpr <| by linarith)] ; nlinarith [Nat.floor_le (show 0 ≤ x by linarith), Nat.lt_floor_add_one x, show (n : ℝ) ≤ ⌊x⌋₊ by exact_mod_cast hn.2], by rw [Nat.floor_lt (by positivity)] at *; rw [div_lt_iff₀ (by positivity)] at *; norm_num at *; linarith⟩ -+ · rw [Nat.floor_lt', div_lt_iff₀] <;> norm_num <;> try linarith [Nat.lt_floor_add_one (x / n)] -+ nlinarith [Nat.lt_floor_add_one (x / n), show (n : ℝ) ≥ 1 by norm_cast; linarith, div_mul_cancel₀ x (show (n : ℝ) ≠ 0 by norm_cast; linarith)] -+ · refine Nat.le_floor ?_ -+ rw [le_div_iff₀] <;> norm_num -+ · exact le_trans (mul_le_mul_of_nonneg_left (Nat.floor_le (by positivity)) (Nat.cast_nonneg _)) (by rw [mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr <| by linarith)]) -+ · exact Nat.floor_pos.mpr (by rw [le_div_iff₀ (Nat.cast_pos.mpr <| pos_of_gt hn.1)] ; nlinarith [Nat.floor_le (show 0 ≤ x by positivity), Nat.lt_floor_add_one x, show (n : ℝ) ≤ ⌊x⌋₊ by exact_mod_cast hn.2, div_mul_cancel₀ x (show (K : ℝ) ≠ 0 by positivity)]) -+ · field_simp -+ rintro ⟨a, ⟨ha₁, ha₂⟩, ha₃, ha₄⟩ -+ refine ⟨lt_of_le_of_lt ?_ ha₃, ha₄.trans ?_⟩ -+ · gcongr ; norm_cast -+ · exact Nat.floor_mono <| div_le_self (by positivity) <| mod_cast ha₁ -+ rw [h_group, Finset.sum_biUnion] -+ · refine Finset.sum_congr rfl fun k hk => Finset.sum_congr rfl fun n hn => ?_ -+ simp +zetaDelta only [ge_iff_le, mem_Ico, mem_Ioc, mul_eq_mul_left_iff, Int.cast_eq_zero] at * -+ rw [Nat.floor_lt (by positivity), Nat.le_floor_iff (by positivity)] at * -+ exact Or.inl <| mod_cast Int.floor_eq_iff.mpr ⟨by rw [le_div_iff₀ <| Nat.cast_pos.mpr <| Nat.pos_of_ne_zero <| by rintro rfl; norm_num at hn; linarith [show x / (k + 1 : ℝ) > 0 by positivity]] ; norm_num; nlinarith [show (k : ℝ) ≥ 1 by norm_cast; linarith, div_mul_cancel₀ x (show (k : ℝ) ≠ 0 by norm_cast; linarith), div_mul_cancel₀ x (show (k + 1 : ℝ) ≠ 0 by positivity)], by rw [div_lt_iff₀ <| Nat.cast_pos.mpr <| Nat.pos_of_ne_zero <| by rintro rfl; norm_num at hn; linarith [show x / (k + 1 : ℝ) > 0 by positivity]] ; norm_num; nlinarith [show (k : ℝ) ≥ 1 by norm_cast; linarith, div_mul_cancel₀ x (show (k : ℝ) ≠ 0 by norm_cast; linarith), div_mul_cancel₀ x (show (k + 1 : ℝ) ≠ 0 by positivity)]⟩ -+ · intros k hk l hl hkl; simp_all +decide [Finset.disjoint_left] -+ field_simp -+ intro a ha₁ ha₂ ha₃; contrapose! hkl -+ rw [Nat.le_floor_iff (by positivity), Nat.floor_lt (by positivity)] at * -+ rw [div_lt_iff₀ (by positivity), le_div_iff₀ (by norm_cast; linarith)] at * -+ exact Nat.le_antisymm (Nat.le_of_lt_succ <| by { rw [← @Nat.cast_lt ℝ] ; push_cast; nlinarith }) (Nat.le_of_lt_succ <| by { rw [← @Nat.cast_lt ℝ] ; push_cast; nlinarith }) -+ simpa only [mul_comm, Finset.mul_sum _ _ _] using h_group -+ have h_M_x_over_k : ∀ k : ℕ, 1 ≤ k → k < K → (fun x : ℝ => ∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) =o[atTop] (fun x => x) := by -+ have h_M : (fun x : ℝ => ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x => x) := by -+ have h_M : (fun x : ℝ => ∑ n ∈ Finset.range ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x => x) := by -+ refine Asymptotics.IsLittleO.of_norm_left ?_ -+ simpa only [← Int.norm_cast_real, Int.cast_sum] using mu_pnt.norm_left -+ have h_M : (fun x : ℝ => ∑ n ∈ Finset.range (⌊x⌋₊ + 1), (μ n : ℝ)) =o[atTop] (fun x => x) := by -+ simp_all +decide only [ge_iff_le, Finset.sum_range_succ] -+ refine h_M.add ?_ -+ rw [Asymptotics.isLittleO_iff_tendsto] <;> norm_num -+ refine squeeze_zero_norm' (a := fun x : ℝ => 1 / |x|) ?_ ?_ -+ · norm_num [abs_div] -+ exact ⟨1, fun x hx => mul_le_of_le_one_left (by positivity) (mod_cast by exact abs_moebius_le_one)⟩ -+ · exact tendsto_const_nhds.div_atTop (tendsto_norm_atTop_atTop) -+ convert! h_M.sub (show (fun x : ℝ => (μ 0 : ℝ)) =o[Filter.atTop] fun x : ℝ => x from ?_) using 2 <;> norm_num [Finset.sum_range_succ'] -+ erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num [Finset.sum_range_succ'] -+ intros k hk_pos hk_lt_K -+ have h_M_x_over_k : (fun x : ℝ => ∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) = (fun x : ℝ => ∑ n ∈ Finset.Icc 1 ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) - (fun x : ℝ => ∑ n ∈ Finset.Icc 1 ⌊x / (k + 1 : ℝ)⌋₊, (μ n : ℝ)) := by -+ ext x -+ simp only [Pi.sub_apply] -+ rw [eq_sub_iff_add_eq'] -+ simp only [show Finset.Icc (1 : ℕ) (⌊x / (↑k + 1)⌋₊) = Finset.Ioc (0 : ℕ) (⌊x / (↑k + 1)⌋₊) by -+ simpa using (Finset.Icc_add_one_left_eq_Ioc (a := (0 : ℕ)) (b := ⌊x / (↑k + 1)⌋₊)), -+ show Finset.Icc (1 : ℕ) (⌊x / ↑k⌋₊) = Finset.Ioc (0 : ℕ) (⌊x / ↑k⌋₊) by -+ simpa using (Finset.Icc_add_one_left_eq_Ioc (a := (0 : ℕ)) (b := ⌊x / ↑k⌋₊))] -+ rw [Finset.sum_Ioc_consecutive] <;> norm_num -+ -+ by_cases hx : 0 ≤ x <;> simp_all +decide only [ge_iff_le, floor_div_natCast, not_le] -+ · rw [Nat.le_div_iff_mul_le (by positivity)] -+ exact Nat.le_floor <| by push_cast; nlinarith [Nat.floor_le (show 0 ≤ x / (k + 1) by positivity), Nat.lt_floor_add_one (x / (k + 1)), mul_div_cancel₀ x (by positivity : (k + 1 : ℝ) ≠ 0)] -+ · rw [Nat.floor_of_nonpos (div_nonpos_of_nonpos_of_nonneg hx.le (by positivity)), Nat.floor_of_nonpos hx.le] ; norm_num -+ rw [h_M_x_over_k] -+ refine Asymptotics.IsLittleO.sub ?_ ?_ -+ · field_simp -+ refine h_M.comp_tendsto (Filter.tendsto_id.atTop_mul_const (by positivity)) |> fun h => h.trans_isBigO ?_ -+ exact Asymptotics.isBigO_iff.mpr ⟨(k : ℝ) ⁻¹, Filter.eventually_atTop.mpr ⟨1, fun x hx => by simp +decide ; ring_nf; norm_num [show k ≠ 0 by linarith]⟩⟩ -+ · have := h_M.comp_tendsto (show Filter.Tendsto (fun x : ℝ => x / (k + 1)) Filter.atTop Filter.atTop from Filter.tendsto_id.atTop_div_const (by positivity)) -+ rw [Asymptotics.isLittleO_iff] at * -+ intro c hc; filter_upwards [this (show 0 < c * (k + 1) by positivity), Filter.eventually_gt_atTop 0] with x hx₁ hx₂; simp_all +decide only [ge_iff_le, norm_eq_abs, eventually_atTop, Function.comp_apply, norm_div, cast_nonneg, -+ zero_le_one, add_nonneg, abs_of_nonneg] -+ exact hx₁.trans (by rw [mul_assoc, mul_div_cancel₀ _ (by positivity)]) -+ have h_sum_o_x : (fun x : ℝ => ∑ k ∈ Finset.Ico 1 K, (k : ℝ) * (∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ))) =o[atTop] (fun x => x) := by -+ rw [Asymptotics.isLittleO_iff_tendsto'] -+ · have h_sum_little_o : ∀ k ∈ Finset.Ico 1 K, Filter.Tendsto (fun x : ℝ => (∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) / x) Filter.atTop (nhds 0) := by -+ intro k hk; specialize h_M_x_over_k k (Finset.mem_Ico.mp hk |>.1) (Finset.mem_Ico.mp hk |>.2) ; rw [Asymptotics.isLittleO_iff_tendsto'] at h_M_x_over_k <;> aesop -+ simpa [Finset.sum_div _ _ _, mul_div_assoc] using tendsto_finsetSum _ fun k hk => h_sum_little_o k hk |> Filter.Tendsto.const_mul _ -+ · filter_upwards [Filter.eventually_gt_atTop 0] with x hx hx' using absurd hx' hx.ne' -+ exact h_sum_o_x.congr' -+ (by filter_upwards [Filter.eventually_ge_atTop 1] with x hx using by rw [h_group x hx]) -+ (by norm_num) -+ -+lemma sum_mobius_div_approx (x : ℝ) (K : ℕ) (hK : 0 < K) (hx : 1 ≤ x) : -+ |x * (∑ n ∈ Icc 1 ⌊x/K⌋₊, (μ n : ℝ) / n) - 1| ≤ x/K + |∑ n ∈ Ioc ⌊x/K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| := by -+ have h_split : ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋ = (∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋) + (∑ n ∈ Finset.Ioc ⌊x / (K : ℝ)⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋) := by -+ erw [Finset.sum_Ioc_consecutive] <;> norm_num -+ · rfl -+ · exact Nat.floor_mono <| div_le_self (by positivity) <| mod_cast hK -+ have h_floor : ∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋ = x * ∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) / (n : ℝ) - ∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) * (x / (n : ℝ) - ⌊x / (n : ℝ)⌋) := by -+ rw [Finset.mul_sum _ _ _] ; rw [← Finset.sum_sub_distrib] ; exact Finset.sum_congr rfl fun _ _ => by ring -+ have h_bound : |∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) * (x / (n : ℝ) - ⌊x / (n : ℝ)⌋)| ≤ ⌊x / (K : ℝ)⌋₊ := by -+ have h_bound : ∀ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, |(μ n : ℝ) * (x / (n : ℝ) - ⌊x / (n : ℝ)⌋)| ≤ 1 := by -+ norm_num [abs_mul] -+ exact fun n hn₁ hn₂ => -+ (mul_le_of_le_one_left (abs_nonneg _) -+ (mod_cast by exact abs_moebius_le_one)).trans -+ (abs_le.mpr ⟨by linarith [Int.fract_nonneg (x / n)], -+ by linarith [Int.fract_lt_one (x / n)]⟩) -+ exact le_trans (Finset.abs_sum_le_sum_abs _ _) (le_trans (Finset.sum_le_sum h_bound) (by norm_num)) -+ have h_sum_floor : ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋ = 1 := by -+ convert sum_mobius_floor x hx using 1 -+ cases abs_cases (x * ∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ) ⌋₊, (μ n : ℝ) / n - 1) <;> cases abs_cases (∑ n ∈ Finset.Ioc ⌊x / (K : ℝ) ⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ) ⌋) <;> linarith [abs_le.mp h_bound, Nat.floor_le (show 0 ≤ x / (K : ℝ) by positivity), Nat.lt_floor_add_one (x / (K : ℝ))] -+ -+theorem mu_pnt_alt : (fun x : ℝ ↦ ∑ n ∈ range ⌊x⌋₊, (μ n : ℝ) / n) =o[atTop] fun _ ↦ (1 : ℝ) := by -+ rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num -+ have h_sum_zero : Filter.Tendsto (fun x : ℝ => ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (μ n : ℝ) / n) Filter.atTop (nhds 0) := by -+ set S : ℝ → ℝ := fun y => ∑ n ∈ Finset.Icc 1 ⌊y⌋₊, (μ n : ℝ) / n -+ have h_bound : ∀ K : ℕ, 0 < K → ∀ x : ℝ, 1 ≤ x → |S (x / K)| ≤ 1 / K + 1 / x + |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| / x := by -+ intros K hK x hx -+ have h_approx : |x * S (x / K) - 1| ≤ x / K + |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| := by -+ convert sum_mobius_div_approx x K hK hx using 1 -+ rw [abs_le] at * -+ ring_nf at * -+ constructor <;> nlinarith [inv_pos.2 (by positivity : 0 < x), mul_inv_cancel₀ (by positivity : x ≠ 0), abs_nonneg (∑ n ∈ Finset.Ioc ⌊ (K : ℝ) ⁻¹ * x⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x * (n : ℝ) ⁻¹⌋)] -+ have h_tail_zero : ∀ K : ℕ, 0 < K → Filter.Tendsto (fun x : ℝ => |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| / x) Filter.atTop (nhds 0) := by -+ intro K hK -+ have h_tail_zero : Filter.Tendsto (fun x : ℝ => |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| / x) Filter.atTop (nhds 0) := by -+ have := sum_mobius_floor_tail_isLittleO K hK -+ rw [Asymptotics.isLittleO_iff_tendsto'] at this -+ · simpa [abs_div] using this.abs.congr' (by filter_upwards [Filter.eventually_gt_atTop 0] with x hx using by rw [abs_div, abs_of_nonneg hx.le]) -+ · filter_upwards [Filter.eventually_gt_atTop 0] with x hx hx' using absurd hx' hx.ne' -+ convert h_tail_zero using 1 -+ have h_eps : ∀ ϵ > 0, ∃ Y : ℝ, ∀ y ≥ Y, |S y| < ϵ := by -+ intros ϵ hϵ_pos -+ obtain ⟨K, hK_pos, hK⟩ : ∃ K : ℕ, 0 < K ∧ 1 / (K : ℝ) < ϵ / 3 := by -+ exact ⟨⌊ϵ⁻¹ * 3⌋₊ + 1, Nat.succ_pos _, by rw [div_lt_iff₀] <;> push_cast <;> nlinarith [Nat.lt_floor_add_one (ϵ⁻¹ * 3), mul_inv_cancel₀ hϵ_pos.ne']⟩ -+ obtain ⟨Y, hY⟩ : ∃ Y : ℝ, ∀ x ≥ Y, |S (x / K)| < ϵ := by -+ have h_tail_zero : Filter.Tendsto (fun x : ℝ => 1 / (K : ℝ) + 1 / x + |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| / x) Filter.atTop (nhds (1 / (K : ℝ))) := by -+ simpa using Filter.Tendsto.add (tendsto_const_nhds.add (tendsto_inv_atTop_zero)) (h_tail_zero K hK_pos) -+ exact Filter.eventually_atTop.mp (h_tail_zero.eventually (gt_mem_nhds <| by linarith)) |> fun ⟨Y, hY⟩ ↦ ⟨Max.max Y 1, fun x hx ↦ lt_of_le_of_lt (h_bound K hK_pos x <| le_trans (le_max_right _ _) hx) <| hY x <| le_trans (le_max_left _ _) hx⟩ -+ use Y / K; intros y hy; specialize hY (y * K) (by nlinarith [show (K : ℝ) ≥ 1 by norm_cast, div_mul_cancel₀ Y (by positivity : (K : ℝ) ≠ 0)]) ; simp_all +decide [ne_of_gt] -+ exact Metric.tendsto_atTop.mpr fun ε hε => by simpa using h_eps ε hε -+ have h_sum_zero : Filter.Tendsto (fun x : ℝ => ∑ n ∈ Finset.range (⌊x⌋₊ + 1), (μ n : ℝ) / n) Filter.atTop (nhds 0) := by -+ convert h_sum_zero using 2 ; erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num [Finset.sum_range_succ'] -+ simpa [Finset.sum_range_succ] using h_sum_zero.sub (show Filter.Tendsto (fun x : ℝ => (μ ⌊x⌋₊ : ℝ) / ⌊x⌋₊) Filter.atTop (nhds 0) from tendsto_zero_iff_norm_tendsto_zero.mpr <| squeeze_zero (fun _ => by positivity) (fun x => by simpa using div_le_div_of_nonneg_right (show |(μ ⌊x⌋₊ : ℝ)| ≤ 1 from mod_cast by { unfold ArithmeticFunction.moebius; aesop }) <| Nat.cast_nonneg _) <| tendsto_inv_atTop_zero.comp <| tendsto_natCast_atTop_atTop.comp <| tendsto_nat_floor_atTop) -+ -+theorem chebyshev_asymptotic_pnt -+ {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : a.Coprime q) (ha' : a < q) : -+ (fun x ↦ ∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then log p else 0) ~[atTop] -+ fun x ↦ x / q.totient := by -+ let ψ_aq : ℝ → ℝ := fun x ↦ ∑ n ∈ Icc 1 ⌊x⌋₊, if n % q = a then Λ n else 0 -+ have htot_pos : (0 : ℝ) < q.totient := cast_pos.mpr (totient_pos.mpr hq) -+ have hψ_equiv : ψ_aq ~[atTop] fun x ↦ x / q.totient := by -+ have hW := WeakPNT_AP hq ha ha' -+ simp only [cumsum, ← Iio_eq_range] at hW -+ have hψ_eq x : ψ_aq x = ∑ n ∈ Iio (⌊x⌋₊ + 1), if n % q = a then Λ n else 0 := by -+ simp only [ψ_aq, show Icc 1 ⌊x⌋₊ = (Iio (⌊x⌋₊ + 1)).filter (1 ≤ ·) by -+ ext n; simp [mem_Icc, mem_filter]; tauto, sum_filter] -+ refine sum_congr rfl fun n _ ↦ ?_ -+ by_cases hn : 1 ≤ n <;> simp only [hn, ↓reduceIte] -+ push Not at hn; interval_cases n; simp -+ refine (isEquivalent_iff_tendsto_one ?_).mpr ?_ -+ · filter_upwards [eventually_ge_atTop 1] with x hx; exact div_ne_zero (by linarith) htot_pos.ne' -+ have hlim1 : Tendsto (fun x : ℝ ↦ (∑ n ∈ Iio (⌊x⌋₊ + 1), if n % q = a then Λ n else 0) / -+ (⌊x⌋₊ + 1 : ℝ)) atTop (nhds (1 / q.totient)) := by -+ have heq : (fun x : ℝ ↦ (∑ n ∈ Iio (⌊x⌋₊ + 1), if n % q = a then Λ n else 0) / -+ (⌊x⌋₊ + 1 : ℝ)) = (fun N ↦ (∑ n ∈ Iio N, if n % q = a then Λ n else 0) / N) ∘ -+ (fun x : ℝ ↦ ⌊x⌋₊ + 1) := by ext x; simp [Function.comp_apply] -+ exact heq ▸ hW.comp ((tendsto_add_atTop_nat 1).comp tendsto_nat_floor_atTop) -+ have hgoal_eq : (ψ_aq / fun x ↦ x / (q.totient : ℝ)) = -+ fun x ↦ ψ_aq x / x * q.totient := by ext x; simp only [Pi.div_apply, div_div_eq_mul_div]; ring -+ rw [hgoal_eq, show (1 : ℝ) = 1 / q.totient * 1 * q.totient by field_simp] -+ refine Tendsto.mul ?_ tendsto_const_nhds -+ have heq' : (fun x ↦ ψ_aq x / x) =ᶠ[atTop] -+ fun x ↦ (∑ n ∈ Iio (⌊x⌋₊ + 1), if n % q = a then Λ n else 0) / (⌊x⌋₊ + 1 : ℝ) * ((⌊x⌋₊ + 1 : ℝ) / x) := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ simp only [hψ_eq]; field_simp -+ exact Tendsto.congr' heq'.symm (hlim1.mul tendsto_floor_add_one_div_self) -+ refine Asymptotics.IsEquivalent.add_isLittleO'' hψ_equiv -+ (IsBigO.trans_isLittleO (g := fun x ↦ 2 * x.sqrt * x.log) ?_ ?_) -+ · rw [isBigO_iff']; refine ⟨1, one_pos, eventually_atTop.mpr ⟨2, fun x hx ↦ ?_⟩⟩ -+ simp only [Pi.sub_apply, norm_eq_abs, one_mul] -+ have hdiff_nonneg : 0 ≤ ψ_aq x - ∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then log p else 0 := by -+ simp only [ψ_aq, sub_nonneg] -+ calc (∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then log p else (0 : ℝ)) -+ ≤ ∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then Λ p else (0 : ℝ) := -+ sum_le_sum fun p hp ↦ by split_ifs <;> simp [vonMangoldt_apply_prime (mem_filter.mp hp).2] -+ _ ≤ ∑ n ∈ Icc 1 ⌊x⌋₊, if n % q = a then Λ n else (0 : ℝ) := -+ sum_le_sum_of_subset_of_nonneg -+ (fun p hp ↦ by simp only [mem_filter, mem_Iic, mem_Icc] at hp ⊢; exact ⟨hp.2.one_lt.le, hp.1⟩) -+ (fun n _ _ ↦ by split_ifs <;> [exact vonMangoldt_nonneg; rfl]) -+ have hdiff_le : ψ_aq x - (∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then log p else (0 : ℝ)) ≤ ψ x - θ x := by -+ simp only [ψ_aq, Chebyshev.psi_eq_sum_Icc, Chebyshev.theta_eq_sum_Icc] -+ conv_rhs => rw [Icc_zero_eq_insert, sum_insert (by simp : (0 : ℕ) ∉ Icc 1 ⌊x⌋₊), -+ show Λ 0 = 0 by simp only [ArithmeticFunction.map_zero], zero_add, -+ show filter Nat.Prime (insert 0 (Icc 1 ⌊x⌋₊)) = filter Nat.Prime (Icc 1 ⌊x⌋₊) by -+ simp [filter_insert, Nat.not_prime_zero]] -+ rw [filter_prime_Iic_eq_Icc, ← sum_filter_add_sum_filter_not (Icc 1 ⌊x⌋₊) Nat.Prime, -+ show (∑ p ∈ filter Nat.Prime (Icc 1 ⌊x⌋₊), if p % q = a then log p else (0 : ℝ)) = -+ ∑ p ∈ filter Nat.Prime (Icc 1 ⌊x⌋₊), if p % q = a then Λ p else (0 : ℝ) from -+ sum_congr rfl fun p hp ↦ by simp only [mem_filter] at hp; split_ifs <;> simp [vonMangoldt_apply_prime hp.2], -+ ← sum_filter_add_sum_filter_not (Icc 1 ⌊x⌋₊) Nat.Prime, -+ show (∑ p ∈ filter Nat.Prime (Icc 1 ⌊x⌋₊), Λ p) = ∑ p ∈ filter Nat.Prime (Icc 1 ⌊x⌋₊), log p from -+ sum_congr rfl fun p hp ↦ vonMangoldt_apply_prime (mem_filter.mp hp).2] -+ have h1 : (∑ n ∈ (Icc 1 ⌊x⌋₊).filter (¬Nat.Prime ·), if n % q = a then Λ n else (0 : ℝ)) ≤ -+ ∑ n ∈ (Icc 1 ⌊x⌋₊).filter (¬Nat.Prime ·), Λ n := -+ sum_le_sum fun n _ ↦ by split_ifs <;> [exact le_refl _; exact vonMangoldt_nonneg] -+ linarith -+ rw [abs_of_nonneg hdiff_nonneg, abs_of_nonneg (by bound)] -+ exact hdiff_le.trans ((le_abs_self _).trans (Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log (by linarith))) -+ · simpa only [mul_assoc] using -+ (isLittleO_sqrt_mul_log.const_mul_left 2).trans_isTheta (isTheta_self_div_const htot_pos.ne') -+ -+theorem dirichlet_thm {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) : -+ Infinite { p // p.Prime ∧ p % q = a } := by -+ have : {p | p.Prime ∧ p % q = a}.Infinite := by -+ have : {p | p.Prime ∧ p ≡ a [MOD q]}.Infinite := by -+ have := @infinite_setOfPred_prime_and_eq_mod -+ specialize @this q <| NeZero.of_pos hq -+ simp_all only [isUnit_iff_exists_inv, forall_exists_index, ← ZMod.natCast_eq_natCast_iff] -+ exact this (IsUnit.exists_right_inv (show IsUnit (a : ZMod q) from by -+ rwa [ZMod.isUnit_iff_coprime])).choose (IsUnit.exists_right_inv (show IsUnit (a : ZMod q) -+ from by rwa [ZMod.isUnit_iff_coprime])).choose_spec -+ exact this.mono fun p hp ↦ ⟨hp.1, by simpa [ModEq, mod_eq_of_lt ha'] using hp.2⟩ -+ exact Set.infinite_coe_iff.mpr this -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Defs.lean b/PrimeNumberTheoremAnd/Erdos970/Defs.lean -new file mode 100644 -index 0000000..e595955 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Defs.lean -@@ -0,0 +1,201 @@ -+import PrimeNumberTheoremAnd.Erdos970.Fourier -+import Mathlib.NumberTheory.Chebyshev -+ -+namespace Erdos970 -+ -+open ArithmeticFunction hiding log -+open Nat hiding log -+open Finset Topology -+open BigOperators Filter Real Classical Asymptotics -+open MeasureTheory intervalIntegral -+open scoped ArithmeticFunction.Moebius -+open scoped ArithmeticFunction.Omega Chebyshev -+ -+noncomputable abbrev nth_prime (n : ℕ) : ℕ := -+ Nat.nth Nat.Prime n -+ -+noncomputable abbrev nth_prime' (n : ℕ) : ℕ := -+ Nat.nth Nat.Prime (n - 1) -+ -+noncomputable abbrev Psi (x : ℝ) : ℝ := ψ x -+ -+noncomputable def M (x : ℝ) : ℝ := -+ ∑ n ∈ Iic ⌊x⌋₊, (μ n : ℝ) -+ -+noncomputable abbrev nth_prime_gap (n : ℕ) : ℕ := -+ nth_prime (n + 1) - nth_prime n -+ -+def prime_gap_record (p g : ℕ) : Prop := -+ ∃ n, nth_prime n = p ∧ nth_prime_gap n = g ∧ -+ ∀ k, nth_prime k < p → nth_prime_gap k < g -+ -+open Classical in -+ -+noncomputable def first_gap (g : ℕ) : ℕ := -+ if h : ∃ n, nth_prime_gap n = g then -+ nth_prime (Nat.find h) -+ else 0 -+ -+def first_gap_record (g P : ℕ) : Prop := -+ first_gap g = P ∧ -+ ∀ g' ∈ Finset.Ico 1 g, -+ Even g' ∨ g' = 1 → first_gap g' ∈ Set.Ico 1 P -+ -+def HasPrimeInInterval (x h : ℝ) : Prop := -+ ∃ p : ℕ, Nat.Prime p ∧ x < p ∧ p ≤ x + h -+ -+def HasPrimeInInterval.log_thm (X₀ : ℝ) (k : ℝ) := -+ ∀ x ≥ X₀, HasPrimeInInterval x (x / (log x) ^ k) -+ -+noncomputable def pi (x : ℝ) : ℝ := -+ Nat.primeCounting ⌊x⌋₊ -+ -+noncomputable def pi_star (x : ℝ) : ℝ := -+ ∑' (k : ℕ), pi (x ^ (1 / (k + 1 : ℝ))) / (k + 1 : ℝ) -+ -+noncomputable def li (x : ℝ) : ℝ := -+ lim ((𝓝[>] (0 : ℝ)).map (fun ε ↦ -+ ∫ t in Set.diff (Set.Ioc 0 x) (Set.Ioo (1 - ε) (1 + ε)), -+ 1 / log t)) -+ -+noncomputable def Li (x : ℝ) : ℝ := ∫ t in 2..x, 1 / log t -+ -+noncomputable def Eψ (x : ℝ) : ℝ := |ψ x - x| / x -+ -+noncomputable def admissible_bound (A B C R : ℝ) (x : ℝ) := -+ A * (log x / R) ^ B * exp (-C * (log x / R) ^ ((1 : ℝ) / (2 : ℝ))) -+ -+def Eψ.classicalBound (A B C R x₀ : ℝ) : Prop := -+ ∀ x ≥ x₀, Eψ x ≤ admissible_bound A B C R x -+ -+def Eψ.bound (ε x₀ : ℝ) : Prop := ∀ x ≥ x₀, Eψ x ≤ ε -+ -+def Eψ.numericalBound (x₀ : ℝ) (ε : ℝ → ℝ) : Prop := -+ Eψ.bound (ε x₀) x₀ -+ -+noncomputable def Eπ (x : ℝ) : ℝ := -+ |pi x - Li x| / (x / log x) -+ -+noncomputable def Eπ_star (x : ℝ) : ℝ := -+ |pi_star x - Li x| / (x / log x) -+ -+noncomputable def Eθ (x : ℝ) : ℝ := |θ x - x| / x -+ -+def Eθ.classicalBound (A B C R x₀ : ℝ) : Prop := -+ ∀ x ≥ x₀, Eθ x ≤ admissible_bound A B C R x -+ -+def Eθ.numericalBound (x₀ : ℝ) (ε : ℝ → ℝ) : Prop := -+ ∀ x ≥ x₀, Eθ x ≤ ε x₀ -+ -+def Eπ.classicalBound (A B C R x₀ : ℝ) : Prop := -+ ∀ x ≥ x₀, Eπ x ≤ admissible_bound A B C R x -+ -+def Eπ.bound (ε x₀ : ℝ) : Prop := ∀ x ≥ x₀, Eπ x ≤ ε -+ -+def Eπ.numericalBound (x₀ : ℝ) (ε : ℝ → ℝ) : Prop := -+ Eπ.bound (ε x₀) x₀ -+ -+def Eπ.vinogradovBound (A B C x₀ : ℝ) : Prop := -+ ∀ x ≥ x₀, Eπ x ≤ -+ A * (log x) ^ B * exp (-C * (log x) ^ ((3 : ℝ) / 5) / (log (log x)) ^ ((1 : ℝ) / 5)) -+ -+def Eπ_star.classicalBound (A B C R x₀ : ℝ) : Prop := -+ ∀ x ≥ x₀, Eπ_star x ≤ admissible_bound A B C R x -+ -+def Eπ_star.bound (ε x₀ : ℝ) : Prop := -+ ∀ x ≥ x₀, Eπ_star x ≤ ε -+ -+def Eπ_star.numericalBound (x₀ : ℝ) (ε : ℝ → ℝ) : Prop := -+ Eπ_star.bound (ε x₀) x₀ -+ -+def Eπ_star.vinogradovBound (A B C x₀ : ℝ) : Prop := -+ ∀ x ≥ x₀, Eπ_star x ≤ -+ A * (log x) ^ B * exp (-C * (log x) ^ ((3 : ℝ) / 5) / (log (log x)) ^ ((1 : ℝ) / 5)) -+ -+lemma admissible_bound.mono -+ (A B C R : ℝ) (hA : 0 < A) (hB : 0 < B) -+ (hC : 0 < C) (hR : 0 < R) : -+ AntitoneOn (admissible_bound A B C R) -+ (Set.Ici (exp (R * (2 * B / C) ^ 2))) := by -+ intro a ha b _ hab -+ simp only [admissible_bound, mul_assoc] -+ have hua : (2 * B / C) ^ 2 ≤ log a / R := by -+ rw [le_div_iff₀ hR, mul_comm ((2 * B / C) ^ 2), ← log_exp (R * (2 * B / C) ^ 2)] -+ exact log_le_log (exp_pos _) (Set.mem_Ici.mp ha) -+ have huab : log a / R ≤ log b / R := -+ div_le_div_of_nonneg_right -+ (log_le_log ((exp_pos _).trans_le (Set.mem_Ici.mp ha)) hab) hR.le -+ have hua₀ : 0 < log a / R := -+ lt_of_lt_of_le (by positivity) hua -+ apply mul_le_mul_of_nonneg_left _ hA.le -+ rw [rpow_def_of_pos (hua₀.trans_le huab), rpow_def_of_pos hua₀, -+ ← exp_add, ← exp_add, exp_le_exp] -+ let sa := (log a / R) ^ ((1 : ℝ) / 2) -+ let sb := (log b / R) ^ ((1 : ℝ) / 2) -+ rw [show log (log b / R) = 2 * log sb from by -+ grind [log_rpow (hua₀.trans_le huab) ((1 : ℝ) / 2)], -+ show log (log a / R) = 2 * log sa from by -+ grind [log_rpow hua₀ ((1 : ℝ) / 2)]] -+ have hsab : sa ≤ sb := -+ rpow_le_rpow (le_trans (by positivity) hua) huab (by positivity) -+ have : 2 * B / C ≤ sa := by -+ rw [show (2 * B / C : ℝ) = ((2 * B / C) ^ 2) ^ ((1 : ℝ) / 2) from by -+ rw [← rpow_natCast _ 2, ← rpow_mul (by positivity)] -+ norm_num [rpow_one]] -+ exact rpow_le_rpow (by positivity) hua (by positivity) -+ suffices h : AntitoneOn (fun t ↦ 2 * B * log t - C * t) (Set.Ici (2 * B / C)) by -+ grind [h (Set.mem_Ici.mpr this) (Set.mem_Ici.mpr (this.trans hsab)) hsab] -+ apply antitoneOn_of_deriv_nonpos (convex_Ici _) -+ · exact ((continuousOn_const.mul (continuousOn_log.mono fun t ht ↦ -+ ne_of_gt ((div_pos (by positivity) hC).trans_le ht))).sub -+ (continuousOn_const.mul continuousOn_id)) -+ · intro t ht -+ rw [interior_Ici] at ht -+ exact (((hasDerivAt_log ((div_pos (by positivity) hC).trans ht).ne').const_mul _).sub -+ ((hasDerivAt_id t).const_mul C)).differentiableAt.differentiableWithinAt -+ · intro t ht -+ rw [interior_Ici] at ht -+ have hdt : HasDerivAt (fun t ↦ 2 * B * log t - C * t) (2 * B * t⁻¹ - C * 1) t := -+ ((hasDerivAt_log ((div_pos (by positivity) hC).trans ht).ne').const_mul _).sub -+ ((hasDerivAt_id t).const_mul C) -+ rw [hdt.deriv, mul_one, sub_nonpos, ← div_eq_mul_inv, -+ div_le_iff₀ ((div_pos (by positivity) hC).trans ht)] -+ linarith [(div_lt_iff₀ hC).mp ht, mul_comm C t] -+ -+lemma Eψ.classicalBound.to_numericalBound -+ (A B C R x₀ x₁ : ℝ) (hA : 0 < A) (hB : 0 < B) -+ (hC : 0 < C) (hR : 0 < R) -+ (hEψ : Eψ.classicalBound A B C R x₀) -+ (hx₁ : x₁ ≥ max x₀ (Real.exp (R * (2 * B / C) ^ 2))) : -+ Eψ.numericalBound x₁ (fun x ↦ admissible_bound A B C R x) := -+ fun x hx ↦ -+ le_trans (hEψ x (le_trans (le_max_left ..) (le_trans hx₁ hx))) -+ (admissible_bound.mono A B C R hA hB hC hR -+ (Set.mem_Ici.mpr (le_trans (le_max_right ..) hx₁)) -+ (Set.mem_Ici.mpr (le_trans (le_max_right ..) (le_trans hx₁ hx))) hx) -+ -+lemma Eθ.classicalBound.to_numericalBound -+ (A B C R x₀ x₁ : ℝ) (hA : 0 < A) (hB : 0 < B) -+ (hC : 0 < C) (hR : 0 < R) -+ (hEθ : Eθ.classicalBound A B C R x₀) -+ (hx₁ : x₁ ≥ max x₀ (Real.exp (R * (2 * B / C) ^ 2))) : -+ Eθ.numericalBound x₁ (fun x ↦ admissible_bound A B C R x) := -+ fun x hx ↦ -+ le_trans (hEθ x (le_trans (le_max_left ..) (le_trans hx₁ hx))) -+ (admissible_bound.mono A B C R hA hB hC hR -+ (Set.mem_Ici.mpr (le_trans (le_max_right ..) hx₁)) -+ (Set.mem_Ici.mpr (le_trans (le_max_right ..) (le_trans hx₁ hx))) hx) -+ -+lemma Eπ.classicalBound.to_numericalBound -+ (A B C R x₀ x₁ : ℝ) (hA : 0 < A) (hB : 0 < B) -+ (hC : 0 < C) (hR : 0 < R) -+ (hEπ : Eπ.classicalBound A B C R x₀) -+ (hx₁ : x₁ ≥ max x₀ (Real.exp (R * (2 * B / C) ^ 2))) : -+ Eπ.numericalBound x₁ (fun x ↦ admissible_bound A B C R x) := -+ fun x hx ↦ -+ le_trans (hEπ x (le_trans (le_max_left ..) (le_trans hx₁ hx))) -+ (admissible_bound.mono A B C R hA hB hC hR -+ (Set.mem_Ici.mpr (le_trans (le_max_right ..) hx₁)) -+ (Set.mem_Ici.mpr (le_trans (le_max_right ..) (le_trans hx₁ hx))) hx) -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/EulerMaclaurin.lean b/PrimeNumberTheoremAnd/Erdos970/EulerMaclaurin.lean -new file mode 100644 -index 0000000..ecfb419 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/EulerMaclaurin.lean -@@ -0,0 +1,75 @@ -+import Mathlib.NumberTheory.AbelSummation -+ -+namespace Erdos970 -+ -+open Finset Interval MeasureTheory -+ -+variable {𝕜 : Type*} [RCLike 𝕜] {f : ℝ → 𝕜} {a b : ℝ} -+ -+noncomputable def B1 (x : ℝ) : ℝ := x - ⌊x⌋₊ - 1 / 2 -+ -+@[fun_prop] -+lemma aestronglyMeasurable_B1 : AEStronglyMeasurable B1 := by -+ unfold B1 -+ fun_prop -+ -+lemma abs_B1_le_half {x : ℝ} (hx : 0 ≤ x) : |B1 x| ≤ 1 / 2 := by -+ unfold B1 -+ refine abs_le.mpr ⟨?_, ?_⟩ -+ · grind [Nat.floor_le hx] -+ · grind [Nat.lt_succ_floor x] -+ -+lemma integral_deriv_mul_add_const (c : 𝕜) (hab : a ≤ b) (h_int : IntervalIntegrable (deriv f) volume a b) -+ (hf_diff : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) : -+ ∫ t in a..b, (t + c) * deriv f t = (b + c) * f b - (a + c) * f a - ∫ t in a..b, f t := by -+ rw [← Set.uIcc_of_le hab] at hf_diff -+ have : ∀ t ∈ [[a, b]], HasDerivAt (fun (t : ℝ) ↦ t + c) 1 t := by -+ intro t ht -+ simp only [hasDerivAt_add_const_iff] -+ convert! ContinuousLinearMap.hasDerivAt (RCLike.ofRealCLM (K := 𝕜)) using 1 -+ simp -+ replace hf_diff := fun t ht ↦ (hf_diff t ht).hasDerivAt -+ rw [intervalIntegral.integral_mul_deriv_eq_deriv_mul this hf_diff (by simp) h_int] -+ simp -+ -+lemma intervalIntegrable_deriv_mul_B1 (ha : 0 ≤ a) (hab : a ≤ b) (h_cont : ContinuousOn (deriv f) [[a, b]]) : -+ IntervalIntegrable (fun t ↦ deriv f t * B1 t) volume a b := by -+ refine IntervalIntegrable.continuousOn_mul ?_ h_cont -+ rw [intervalIntegrable_iff'] -+ apply MeasureTheory.Measure.integrableOn_of_bounded (by simp) (by fun_prop) (M := 1 / 2) -+ filter_upwards [self_mem_ae_restrict (by measurability)] with x hx -+ rw [Set.uIcc_of_le hab, Set.mem_Icc] at hx -+ norm_cast -+ exact abs_B1_le_half (by linarith) -+ -+lemma integral_deriv_mul_floor_add_one (ha : 0 ≤ a) (hab : a ≤ b) -+ (hf_diff : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) (h_cont : ContinuousOn (deriv f) [[a, b]]) : -+ ∫ t in a..b, deriv f t * (⌊t⌋₊ + 1) = (b + 1 / 2) * f b - (a + 1 / 2) * f a - (∫ t in a..b, f t) - ∫ t in a..b, deriv f t * B1 t := by -+ calc -+ _ = ∫ t in a..b, (deriv f t * (t + 1 / 2) -deriv f t * B1 t) := by -+ congr -+ ext -+ simp only [B1] -+ push_cast -+ ring -+ _ = (∫ t in a..b, deriv f t * (t + 1 / 2)) - ∫ t in a..b, deriv f t * B1 t := by -+ exact intervalIntegral.integral_sub (ContinuousOn.intervalIntegrable (by fun_prop)) (intervalIntegrable_deriv_mul_B1 ha hab h_cont) -+ _ = _ := by -+ conv => lhs; arg 1; arg 1; ext; rw [mul_comm] -+ rw [integral_deriv_mul_add_const _ hab h_cont.intervalIntegrable hf_diff] -+ -+theorem sum_eq_integral_add_integral_deriv (ha : 0 ≤ a) (hab : a ≤ b) -+ (hf_diff : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) -+ (h_cont : ContinuousOn (deriv f) [[a, b]]) : -+ ∑ k ∈ Ioc ⌊a⌋₊ ⌊b⌋₊, f k = -+ f a * B1 a - f b * B1 b + (∫ t in a..b, f t) + ∫ t in a..b, deriv f t * B1 t := by -+ have := sum_mul_eq_sub_sub_integral_mul (fun _ ↦ 1) ha hab hf_diff (Set.uIcc_of_le hab ▸ h_cont).integrableOn_Icc -+ simp only [mul_one, sum_const, Nat.card_Icc, tsub_zero, nsmul_eq_mul, Nat.cast_add, -+ Nat.cast_one] at this -+ rw [this, ← intervalIntegral.integral_of_le hab] -+ rw [integral_deriv_mul_floor_add_one ha hab hf_diff h_cont] -+ unfold B1 -+ push_cast -+ ring -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Fourier.lean b/PrimeNumberTheoremAnd/Erdos970/Fourier.lean -new file mode 100644 -index 0000000..32fe27c ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Fourier.lean -@@ -0,0 +1,181 @@ -+import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv -+import Mathlib.MeasureTheory.Integral.IntegralEqImproper -+import Mathlib.Topology.ContinuousMap.Bounded.Basic -+import Mathlib.Order.Filter.ZeroAndBoundedAtFilter -+import Mathlib.Analysis.Fourier.FourierTransformDeriv -+import PrimeNumberTheoremAnd.Erdos970.Sobolev -+ -+namespace Erdos970 -+ -+open FourierTransform Real Complex MeasureTheory Filter Topology BoundedContinuousFunction -+ SchwartzMap VectorFourier BigOperators -+ -+local instance {E : Type*} : Coe (E → ℝ) (E → ℂ) := ⟨fun f n => f n⟩ -+ -+section lemmas -+ -+@[simp] -+theorem nnnorm_eq_of_mem_circle (z : Circle) : ‖z.val‖₊ = 1 := NNReal.coe_eq_one.mp (by simp) -+ -+@[simp] -+theorem nnnorm_circle_smul (z : Circle) (s : ℂ) : ‖z • s‖₊ = ‖s‖₊ := by -+ simp [show z • s = z.val * s from rfl] -+ -+noncomputable def e (u : ℝ) : ℝ →ᵇ ℂ where -+ toFun v := 𝐞 (-v * u) -+ map_bounded' := -+ ⟨2, fun x y => (dist_le_norm_add_norm _ _).trans (by simp [one_add_one_eq_two])⟩ -+ -+@[simp] lemma e_apply (u : ℝ) (v : ℝ) : e u v = 𝐞 (-v * u) := rfl -+ -+theorem hasDerivAt_e {u x : ℝ} : HasDerivAt (e u) (-2 * π * u * I * e u x) x := by -+ have l2 : HasDerivAt (fun v => -v * u) (-u) x := by -+ simpa only [neg_mul_comm] using hasDerivAt_mul_const (-u) -+ convert! (hasDerivAt_fourierChar (-x * u)).scomp x l2 using 1 -+ change _ = ((-u : ℝ) : ℂ) * _ -+ simp ; ring -+ -+lemma fourierIntegral_deriv_aux2 (e : ℝ →ᵇ ℂ) {f : ℝ → ℂ} (hf : Integrable f) : -+ Integrable (⇑e * f) := -+ hf.bdd_mul e.continuous.aestronglyMeasurable (ae_of_all _ e.norm_coe_le_norm) -+ -+@[simp] lemma F_neg {f : ℝ → ℂ} {u : ℝ} : 𝓕 (fun x => -f x) u = - 𝓕 f u := by -+ simp [fourier_eq, integral_neg] -+ -+@[simp] lemma F_add {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : -+ 𝓕 (fun x => f x + g x) x = 𝓕 f x + 𝓕 g x := by -+ have : Continuous fun p : ℝ × ℝ ↦ ((innerₗ ℝ) p.1) p.2 := continuous_inner -+ have := fourierIntegral_add continuous_fourierChar this hf hg -+ exact congr_fun this x -+ -+@[simp] lemma F_sub {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : -+ 𝓕 (fun x => f x - g x) x = 𝓕 f x - 𝓕 g x := by -+ simpa [sub_eq_add_neg, Pi.neg_def] using F_add hf hg.neg x -+ -+@[simp] lemma F_mul {f : ℝ → ℂ} {c : ℂ} {u : ℝ} : -+ 𝓕 (fun x => c * f x) u = c * 𝓕 f u := by -+ exact congr_fun (VectorFourier.fourierIntegral_const_smul 𝐞 _ _ f c) u -+ -+end lemmas -+ -+theorem fourierIntegral_self_add_deriv_deriv (f : W21) (u : ℝ) : -+ (1 + u ^ 2) * 𝓕 (f : ℝ → ℂ) u = -+ 𝓕 (fun u : ℝ => (f u - (1 / (4 * π ^ 2)) * deriv^[2] f u : ℂ)) u := by -+ have l1 : Integrable (fun x => (((π : ℂ) ^ 2)⁻¹ * 4⁻¹) * deriv (deriv f) x) := by -+ apply Integrable.const_mul ; simpa [iteratedDeriv_succ] using f.integrable le_rfl -+ have l4 : Differentiable ℝ f := f.differentiable -+ have l5 : Differentiable ℝ (deriv f) := f.deriv.differentiable -+ simp [f.hf, l1, add_mul, Real.fourier_deriv f.hf' l5 f.hf'', Real.fourier_deriv f.hf l4 f.hf'] -+ field_simp [pi_ne_zero] ; ring_nf ; simp -+ -+@[simp] lemma deriv_ofReal : deriv ofReal = fun _ => 1 := by -+ ext x ; exact ((hasDerivAt_id x).ofReal_comp).deriv -+ -+lemma tendsto_intervalIntegral_zero_of_uniform_norm_bound -+ {f : ℝ → ℝ → ℂ} {lo hi : ℝ} {B : ℝ → ℝ} -+ (hB : Filter.Tendsto (fun T : ℝ => B T * |hi - lo|) Filter.atTop (nhds 0)) -+ (hf : ∀ᶠ T in Filter.atTop, ∀ x ∈ Set.uIoc lo hi, ‖f T x‖ ≤ B T) : -+ Filter.Tendsto (fun T : ℝ => ∫ x in lo..hi, f T x) Filter.atTop (nhds 0) := by -+ rw [tendsto_zero_iff_norm_tendsto_zero] -+ refine squeeze_zero' (Eventually.of_forall fun T => norm_nonneg _) ?_ hB -+ filter_upwards [hf] with T hT -+ exact intervalIntegral.norm_integral_le_of_norm_le_const (fun x hx => hT x hx) -+ -+lemma tendsto_const_mul_log_add_two_div_add_two_atTop (K : ℝ) : -+ Filter.Tendsto (fun T : ℝ => K * (Real.log (T + 2) / (T + 2))) -+ Filter.atTop (nhds 0) := by -+ have h0 : Filter.Tendsto (fun x : ℝ => Real.log x / x) Filter.atTop (nhds 0) := by -+ simpa using (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 (by norm_num : (1 : ℝ) ≠ 0)) -+ have hshift : Filter.Tendsto (fun T : ℝ => Real.log (T + 2) / (T + 2)) -+ Filter.atTop (nhds 0) := by -+ have := h0.comp (tendsto_atTop_add_const_right Filter.atTop 2 tendsto_id) -+ simpa [Function.comp_def] using this -+ simpa using hshift.const_mul K -+ -+lemma norm_fourier_le_integral_deriv_div -+ (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) -+ (hg' : Integrable (deriv g)) {w : ℝ} (hw : w ≠ 0) : -+ ‖𝓕 g w‖ ≤ (∫ x, ‖deriv g x‖ ∂volume) / ((2 * Real.pi) * |w|) := by -+ have hmul : -+ 𝓕 (deriv g) w = (2 * Real.pi * Complex.I * (w : ℂ)) * 𝓕 g w := by -+ have h := congrFun (Real.fourier_deriv hg hdiff hg') w -+ simpa [smul_eq_mul, mul_assoc] using h -+ have h_fourier : -+ ‖𝓕 (deriv g) w‖ ≤ ∫ x, ‖deriv g x‖ ∂volume := by -+ exact VectorFourier.norm_fourierIntegral_le_integral_norm 𝐞 volume (innerₗ ℝ) -+ (deriv g) w -+ have hleft : -+ ((2 * Real.pi) * |w|) * ‖𝓕 g w‖ = -+ ‖(2 * Real.pi * Complex.I * (w : ℂ)) * 𝓕 g w‖ := by -+ have htwopi : ‖(2 * ↑Real.pi : ℂ)‖ = 2 * Real.pi := by -+ rw [norm_mul, Complex.norm_two, Complex.norm_of_nonneg Real.pi_pos.le] -+ have hwc : ‖(w : ℂ)‖ = |w| := by rw [norm_real, Real.norm_eq_abs] -+ rw [norm_mul, norm_mul, norm_mul, htwopi, norm_I, hwc] -+ ring -+ have hmain : ((2 * Real.pi) * |w|) * ‖𝓕 g w‖ ≤ ∫ x, ‖deriv g x‖ ∂volume := by -+ rw [hleft, ← hmul] -+ exact h_fourier -+ have hpos : 0 < (2 * Real.pi) * |w| := by -+ positivity -+ exact (le_div_iff₀ hpos).mpr (by simpa [mul_comm, mul_left_comm, mul_assoc] using hmain) -+ -+lemma norm_oscillatory_integral_le_integral_deriv_div -+ (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) -+ (hg' : Integrable (deriv g)) {T : ℝ} (hT : 0 < T) : -+ ‖∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume‖ ≤ -+ (∫ x, ‖deriv g x‖ ∂volume) / T := by -+ have hw : -T / (2 * Real.pi) ≠ 0 := by -+ exact div_ne_zero (neg_ne_zero.mpr hT.ne') (mul_ne_zero two_ne_zero Real.pi_ne_zero) -+ have hfourier := norm_fourier_le_integral_deriv_div g hg hdiff hg' hw -+ have heq : -+ (∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume) = -+ 𝓕 g (-T / (2 * Real.pi)) := by -+ rw [Real.fourier_real_eq_integral_exp_smul] -+ apply integral_congr_ae -+ filter_upwards with y -+ rw [smul_eq_mul] -+ rw [mul_comm (g y)] -+ congr 1 -+ congr 1 -+ push_cast -+ field_simp [Real.pi_ne_zero] -+ rw [heq] -+ refine hfourier.trans_eq ?_ -+ congr 1 -+ have hden : (2 * Real.pi) * |-T / (2 * Real.pi)| = T := by -+ have htwopi_pos : 0 < 2 * Real.pi := by positivity -+ have hneg : -T / (2 * Real.pi) < 0 := div_neg_of_neg_of_pos (neg_neg_of_pos hT) htwopi_pos -+ rw [abs_of_neg hneg] -+ field_simp [Real.pi_ne_zero] -+ rw [hden] -+ -+lemma norm_oscillatory_integral_le_integral_deriv_div_abs -+ (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) -+ (hg' : Integrable (deriv g)) {T : ℝ} (hT : T ≠ 0) : -+ ‖∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume‖ ≤ -+ (∫ x, ‖deriv g x‖ ∂volume) / |T| := by -+ have hw : -T / (2 * Real.pi) ≠ 0 := by -+ exact div_ne_zero (neg_ne_zero.mpr hT) (mul_ne_zero two_ne_zero Real.pi_ne_zero) -+ have hfourier := norm_fourier_le_integral_deriv_div g hg hdiff hg' hw -+ have heq : -+ (∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume) = -+ 𝓕 g (-T / (2 * Real.pi)) := by -+ rw [Real.fourier_real_eq_integral_exp_smul] -+ apply integral_congr_ae -+ filter_upwards with y -+ rw [smul_eq_mul] -+ rw [mul_comm (g y)] -+ congr 1 -+ congr 1 -+ push_cast -+ field_simp [Real.pi_ne_zero] -+ rw [heq] -+ refine hfourier.trans_eq ?_ -+ congr 1 -+ have hden : (2 * Real.pi) * |-T / (2 * Real.pi)| = |T| := by -+ have htwopi_pos : 0 < 2 * Real.pi := by positivity -+ rw [abs_div, abs_neg, abs_of_pos htwopi_pos] -+ field_simp [Real.pi_ne_zero] -+ rw [hden] -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/HadamardSupport.lean b/PrimeNumberTheoremAnd/Erdos970/HadamardSupport.lean -new file mode 100644 -index 0000000..8c19850 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/HadamardSupport.lean -@@ -0,0 +1,6805 @@ -+import Mathlib -+ -+namespace Erdos970 -+ -+section HadamardAssemblyScope -+ -+section HadamardSourceScope00 -+ -+open scoped BigOperators -+ -+namespace Real -+ -+open _root_.Real -+ -+lemma pow_div_one_sub_le_two_mul {r : ℝ} (hr : 0 ≤ r) (hrhalf : r ≤ 1 / 2) (m : ℕ) : -+ r ^ (m + 1) / (1 - r) ≤ 2 * r ^ (m + 1) := by -+ have hpow : 0 ≤ r ^ (m + 1) := pow_nonneg hr _ -+ have hhalf' : (1 / 2 : ℝ) ≤ 1 - r := by linarith -+ calc -+ r ^ (m + 1) / (1 - r) ≤ r ^ (m + 1) / (1 / 2 : ℝ) := by -+ exact div_le_div_of_nonneg_left hpow (by positivity) hhalf' -+ _ = 2 * r ^ (m + 1) := by ring -+ -+end Real -+ -+namespace Complex -+ -+open _root_.Complex -+ -+open scoped BigOperators in -+ -+lemma neg_log_one_sub_eq_tsum {z : ℂ} (hz : ‖z‖ < 1) : -+ -log (1 - z) = ∑' n : ℕ, z ^ (n + 1) / (n + 1) := by -+ have h := hasSum_taylorSeries_neg_log hz -+ rw [← h.tsum_eq, h.summable.tsum_eq_zero_add] -+ simp only [pow_zero, Nat.cast_zero, div_zero, zero_add, Nat.cast_add, Nat.cast_one] -+ -+noncomputable -+def partialLogSum (m : ℕ) (z : ℂ) : ℂ := -+ -logTaylor (m + 1) (-z) -+ -+@[simp] -+lemma partialLogSum_zero (z : ℂ) : partialLogSum 0 z = 0 := by -+ simp [partialLogSum, logTaylor_succ, logTaylor_zero] -+ -+@[simp] -+lemma partialLogSum_at_zero (m : ℕ) : partialLogSum m 0 = 0 := by -+ simp [partialLogSum, logTaylor_at_zero] -+ -+lemma logTaylor_succ_neg (n : ℕ) (z : ℂ) : -+ logTaylor (n + 1) (-z) = logTaylor n (-z) - z ^ n / n := by -+ rw [logTaylor_succ, Pi.add_apply] -+ have hsign : (-1 : ℂ) ^ (n + 1) * (-z) ^ n = -z ^ n := by -+ have hzpow : (-z) ^ n = (((-1 : ℂ) * z) ^ n) := by simp -+ rw [hzpow, mul_pow, ← mul_assoc, ← pow_add] -+ have hpow : (-1 : ℂ) ^ (n + 1 + n) = (-1 : ℂ) := by -+ rw [show n + 1 + n = 2 * n + 1 by omega, pow_add, pow_mul] -+ norm_num -+ rw [hpow] -+ ring -+ rw [show (-1 : ℂ) ^ (n + 1) * (-z) ^ n / n = -(z ^ n / n) by -+ rw [hsign] -+ ring] -+ abel -+ -+lemma logTaylor_neg_eq_neg_sum (m : ℕ) (z : ℂ) : -+ logTaylor (m + 1) (-z) = -∑ k ∈ Finset.range m, z ^ (k + 1) / (k + 1) := by -+ induction m with -+ | zero => -+ simp [logTaylor_succ, logTaylor_zero] -+ | succ m hm => -+ rw [logTaylor_succ_neg, hm, Finset.sum_range_succ] -+ have hcast : ((m + 1 : ℕ) : ℂ) = (1 + (m : ℂ)) := by -+ simp [Nat.cast_add, Nat.cast_one, add_comm] -+ rw [hcast] -+ ring_nf -+ -+lemma partialLogSum_eq_sum (m : ℕ) (z : ℂ) : -+ partialLogSum m z = ∑ k ∈ Finset.range m, z ^ (k + 1) / (k + 1) := by -+ simpa [partialLogSum] using congrArg Neg.neg (logTaylor_neg_eq_neg_sum m z) -+ -+lemma hasDerivAt_partialLogSum (m : ℕ) (z : ℂ) : -+ HasDerivAt (partialLogSum m) (∑ j ∈ Finset.range m, z ^ j) z := by -+ cases m with -+ | zero => -+ have hzero : partialLogSum 0 = fun _ : ℂ ↦ (0 : ℂ) := by -+ funext w -+ exact partialLogSum_zero w -+ simpa [hzero] using (hasDerivAt_const z (c := (0 : ℂ))) -+ | succ m => -+ have hsum : -+ (∑ j ∈ Finset.range (m + 1), z ^ j) = -+ ∑ j ∈ Finset.range (m + 1), (-1) ^ j * (-z) ^ j := by -+ refine Finset.sum_congr rfl ?_ -+ intro j hj -+ symm -+ calc -+ (-1 : ℂ) ^ j * (-z) ^ j = (-1 : ℂ) ^ j * (((-1 : ℂ) * z) ^ j) := by simp -+ _ = ((-1 : ℂ) ^ j * (-1 : ℂ) ^ j) * z ^ j := by rw [mul_pow]; ring -+ _ = z ^ j := by -+ rw [← pow_add, show j + j = 2 * j by omega, pow_mul] -+ norm_num -+ rw [hsum] -+ simpa [partialLogSum] using! -+ (((hasDerivAt_logTaylor (m + 1) (-z)).comp z (hasDerivAt_neg z)).neg) -+ -+lemma differentiable_partialLogSum (m : ℕ) : -+ Differentiable ℂ (fun z : ℂ => partialLogSum m z) := by -+ intro z -+ exact (hasDerivAt_partialLogSum m z).differentiableAt -+ -+noncomputable -+def logTail (m : ℕ) (z : ℂ) : ℂ := -+ ∑' k, z ^ (m + 1 + k) / (m + 1 + k) -+ -+lemma summable_logTail {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : -+ Summable (fun k => z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)) := by -+ have h_geom : Summable (fun k : ℕ => ‖z‖ ^ k) := -+ summable_geometric_of_lt_one (norm_nonneg z) hz -+ refine Summable.of_norm_bounded (g := fun k => ‖z‖ ^ k) h_geom ?_ -+ intro k -+ rw [norm_div, norm_pow] -+ have h1 : (1 : ℝ) ≤ (m + 1 + k : ℝ) := by -+ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity -+ nlinarith -+ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (Complex.norm_natCast (m + 1 + k)) -+ rw [hnorm] -+ calc -+ ‖z‖ ^ (m + 1 + k) / (m + 1 + k : ℝ) ≤ ‖z‖ ^ (m + 1 + k) := by -+ exact div_le_self (pow_nonneg (norm_nonneg z) _) h1 -+ _ = ‖z‖ ^ (m + 1) * ‖z‖ ^ k := by rw [pow_add] -+ _ ≤ 1 * ‖z‖ ^ k := by -+ refine mul_le_mul_of_nonneg_right ?_ (pow_nonneg (norm_nonneg z) k) -+ exact pow_le_one₀ (norm_nonneg z) (le_of_lt hz) -+ _ = ‖z‖ ^ k := one_mul _ -+ -+lemma norm_logTail_le {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : -+ ‖logTail m z‖ ≤ ‖z‖ ^ (m + 1) / (1 - ‖z‖) := by -+ dsimp only [logTail] -+ have h_rhs_summable : Summable (fun k => ‖z‖ ^ (m + 1 + k)) := by -+ simpa [pow_add] using -+ (summable_geometric_of_lt_one (norm_nonneg z) hz).mul_left (‖z‖ ^ (m + 1)) -+ have h_norm_summable : Summable (fun k => ‖z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖) := by -+ refine Summable.of_nonneg_of_le (fun _ => norm_nonneg _) ?_ h_rhs_summable -+ intro k -+ rw [norm_div, norm_pow] -+ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (Complex.norm_natCast (m + 1 + k)) -+ rw [hnorm] -+ have hm : 1 ≤ (m + 1 + k : ℝ) := by -+ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity -+ nlinarith -+ exact div_le_self (pow_nonneg (norm_nonneg z) _) hm -+ calc -+ ‖∑' k, z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖ -+ ≤ ∑' k, ‖z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖ := -+ norm_tsum_le_tsum_norm h_norm_summable -+ _ ≤ ∑' k, ‖z‖ ^ (m + 1 + k) := by -+ refine h_norm_summable.tsum_le_tsum ?_ h_rhs_summable -+ intro k -+ rw [norm_div, norm_pow] -+ have hm : 1 ≤ (m + 1 + k : ℝ) := by -+ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity -+ nlinarith -+ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (Complex.norm_natCast (m + 1 + k)) -+ rw [hnorm] -+ exact div_le_self (pow_nonneg (norm_nonneg z) _) hm -+ _ = ‖z‖ ^ (m + 1) / (1 - ‖z‖) := by -+ have h_eq : -+ (fun k => ‖z‖ ^ (m + 1 + k)) = fun k => ‖z‖ ^ (m + 1) * ‖z‖ ^ k := by -+ ext k -+ rw [pow_add] -+ rw [h_eq, tsum_mul_left] -+ have h_geom := hasSum_geometric_of_lt_one (norm_nonneg z) hz -+ rw [h_geom.tsum_eq, div_eq_mul_inv] -+ -+lemma norm_logTail_le_two_mul_norm_pow {z : ℂ} (hz : ‖z‖ < 1) (hzhalf : ‖z‖ ≤ 1 / 2) (m : ℕ) : -+ ‖logTail m z‖ ≤ 2 * ‖z‖ ^ (m + 1) := -+ (norm_logTail_le hz m).trans (Real.pow_div_one_sub_le_two_mul (norm_nonneg z) hzhalf m) -+ -+lemma norm_partialLogSum_le_nat_mul_max_one_norm_pow (m : ℕ) (z : ℂ) : -+ ‖partialLogSum m z‖ ≤ (m : ℝ) * max 1 (‖z‖ ^ m) := by -+ have hsum : -+ ‖partialLogSum m z‖ ≤ ∑ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖ := by -+ rw [partialLogSum_eq_sum] -+ exact norm_sum_le _ _ -+ have hterm : ∀ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖ ≤ max 1 (‖z‖ ^ m) := by -+ intro k hk -+ rw [norm_div, norm_pow] -+ have hk1 : (1 : ℝ) ≤ (k : ℝ) + 1 := by -+ have hk1_nat : (1 : ℕ) ≤ k + 1 := Nat.succ_le_succ (Nat.zero_le k) -+ exact_mod_cast hk1_nat -+ have hdenom : ‖((k : ℂ) + 1)‖ = (k : ℝ) + 1 := by -+ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (Complex.norm_natCast (k + 1)) -+ have hk_le : k + 1 ≤ m := Nat.succ_le_iff.2 (Finset.mem_range.1 hk) -+ have hpow_le : ‖z‖ ^ (k + 1) ≤ max 1 (‖z‖ ^ m) := by -+ have hz0 : 0 ≤ ‖z‖ := norm_nonneg z -+ by_cases hz1 : ‖z‖ ≤ (1 : ℝ) -+ · have : ‖z‖ ^ (k + 1) ≤ 1 := by exact pow_le_one₀ hz0 hz1 -+ exact this.trans (le_max_left _ _) -+ · have hz1' : (1 : ℝ) ≤ ‖z‖ := le_of_lt (lt_of_not_ge hz1) -+ have : ‖z‖ ^ (k + 1) ≤ ‖z‖ ^ m := pow_le_pow_right₀ hz1' hk_le -+ exact this.trans (le_max_right _ _) -+ calc -+ ‖z‖ ^ (k + 1) / ‖((k : ℂ) + 1)‖ = ‖z‖ ^ (k + 1) / ((k : ℝ) + 1) := by simp [hdenom] -+ _ ≤ ‖z‖ ^ (k + 1) := by -+ exact div_le_self (pow_nonneg (norm_nonneg z) _) hk1 -+ _ ≤ max 1 (‖z‖ ^ m) := hpow_le -+ have hsum_le : -+ (∑ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖) ≤ -+ ∑ _k ∈ Finset.range m, max 1 (‖z‖ ^ m) := -+ Finset.sum_le_sum (fun k hk => hterm k hk) -+ have hcard : ∑ _k ∈ Finset.range m, max 1 (‖z‖ ^ m) = (m : ℝ) * max 1 (‖z‖ ^ m) := by -+ simp [Finset.sum_const] -+ exact hsum.trans (hsum_le.trans_eq hcard) -+ -+lemma neg_log_one_sub_eq_partialLogSum_add_logTail {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : -+ -log (1 - z) = partialLogSum m z + logTail m z := by -+ let f : ℕ → ℂ := fun k ↦ z ^ (k + 1) / ((k : ℂ) + 1) -+ have h_summable : Summable f := by -+ simpa [f, Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (summable_logTail hz 0) -+ have h_decomp := h_summable.sum_add_tsum_nat_add m -+ rw [neg_log_one_sub_eq_tsum hz, partialLogSum_eq_sum, ← h_decomp] -+ congr 1 -+ dsimp only [logTail] -+ refine tsum_congr fun k ↦ ?_ -+ simp only [f, Nat.cast_add] -+ ring_nf -+ -+end Complex -+end HadamardSourceScope00 -+ -+section HadamardSourceScope01 -+ -+noncomputable section -+ -+namespace Complex -+ -+open _root_.Complex -+ -+variable {z : ℂ} -+ -+@[bound] -+theorem neg_norm_le_re (z : ℂ) : -‖z‖ ≤ z.re := -+ neg_le_of_abs_le (abs_re_le_norm z) -+ -+lemma norm_inv_pow_le_one_of_one_le_norm (u : ℂ) (n : ℕ) (hu : (1 : ℝ) ≤ ‖u‖) : -+ ‖(u ^ n)⁻¹‖ ≤ 1 := by -+ have hge : (1 : ℝ) ≤ ‖u ^ n‖ := by -+ rw [Complex.norm_pow] -+ exact one_le_pow₀ hu -+ calc ‖(u ^ n)⁻¹‖ = ‖(1 : ℂ) / u ^ n‖ := by rw [inv_eq_one_div] -+ _ = 1 / ‖u ^ n‖ := by -+ have hone : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp -+ rw [Complex.norm_div, hone] -+ _ ≤ 1 := by simpa [one_div] using inv_le_one_of_one_le₀ hge -+ -+end Complex -+end -+end HadamardSourceScope01 -+ -+section HadamardSourceScope02 -+ -+noncomputable section -+ -+open scoped BigOperators -+open Set -+ -+namespace Complex -+ -+open _root_.Complex -+ -+def weierstrassFactor (m : ℕ) (z : ℂ) : ℂ := -+ (1 - z) * exp (partialLogSum m z) -+ -+lemma weierstrassFactor_def (m : ℕ) (z : ℂ) : -+ weierstrassFactor m z = (1 - z) * exp (partialLogSum m z) := by -+ simp [weierstrassFactor] -+ -+@[simp] -+lemma weierstrassFactor_at_zero (m : ℕ) : weierstrassFactor m 0 = 1 := by -+ simp [weierstrassFactor, partialLogSum_at_zero] -+ -+lemma weierstrassFactor_eq_zero_iff (m : ℕ) (z : ℂ) : -+ weierstrassFactor m z = 0 ↔ z = 1 := by -+ constructor -+ · intro hz -+ rw [weierstrassFactor] at hz -+ rcases mul_eq_zero.mp hz with h1 | h2 -+ · exact (sub_eq_zero.mp h1).symm -+ · exact absurd h2 (exp_ne_zero _) -+ · rintro rfl -+ simp [weierstrassFactor] -+ -+lemma weierstrassFactor_ne_zero_iff (m : ℕ) (z : ℂ) : -+ weierstrassFactor m z ≠ 0 ↔ z ≠ 1 := by -+ simpa [ne_eq] using (not_congr (weierstrassFactor_eq_zero_iff (m := m) (z := z))) -+ -+lemma weierstrassFactor_ne_zero_of_ne_one (m : ℕ) {z : ℂ} (hz : z ≠ 1) : -+ weierstrassFactor m z ≠ 0 := -+ (weierstrassFactor_ne_zero_iff (m := m) (z := z)).2 hz -+ -+lemma differentiable_weierstrassFactor (m : ℕ) : -+ Differentiable ℂ (fun z : ℂ => weierstrassFactor m z) := by -+ simpa [weierstrassFactor] using! -+ ((differentiable_const (c := (1 : ℂ))).sub differentiable_id).mul -+ (differentiable_exp.comp (differentiable_partialLogSum m)) -+ -+theorem analyticOrderAt_weierstrassFactor_div_self (m : ℕ) {a : ℂ} (ha : a ≠ 0) : -+ analyticOrderAt (fun z : ℂ => weierstrassFactor m (z / a)) a = (1 : ℕ∞) := by -+ set F : ℂ → ℂ := fun z => weierstrassFactor m (z / a) -+ have hF : AnalyticAt ℂ F a := by -+ have hdiv : Differentiable ℂ (fun z : ℂ => z / a) := by -+ simp [div_eq_mul_inv] -+ have hdiff : Differentiable ℂ F := (differentiable_weierstrassFactor m).comp hdiv -+ exact Differentiable.analyticAt (f := F) hdiff a -+ let g : ℂ → ℂ := fun z => (-a⁻¹) * Complex.exp (partialLogSum m (z / a)) -+ have hg : AnalyticAt ℂ g a := by -+ have hdiv : Differentiable ℂ (fun z : ℂ => z / a) := by -+ simp [div_eq_mul_inv] -+ have hpls : Differentiable ℂ (fun z : ℂ => partialLogSum m (z / a)) := -+ (differentiable_partialLogSum m).comp hdiv -+ have hexp : Differentiable ℂ (fun z : ℂ => Complex.exp (partialLogSum m (z / a))) := -+ (Complex.differentiable_exp).comp hpls -+ have hdiffg : Differentiable ℂ g := by -+ simpa [g] using hexp.const_mul (-a⁻¹ : ℂ) -+ exact Differentiable.analyticAt (f := g) hdiffg a -+ have hg0 : g a ≠ 0 := by -+ have hconst : (-a⁻¹ : ℂ) ≠ 0 := by simp [ha] -+ have hexp0 : Complex.exp (partialLogSum m (a / a)) ≠ 0 := -+ Complex.exp_ne_zero (partialLogSum m (a / a)) -+ simpa [g] using mul_ne_zero hconst hexp0 -+ refine (hF.analyticOrderAt_eq_natCast (n := 1)).2 ?_ -+ refine ⟨g, hg, hg0, ?_⟩ -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ have hlin : (1 - z / a) = (z - a) * (-a⁻¹) := by -+ have h1 : (1 : ℂ) = a * a⁻¹ := by simp [ha] -+ simp [div_eq_mul_inv, h1] -+ ring -+ simp only [F, g, pow_one, smul_eq_mul] -+ rw [weierstrassFactor_def] -+ simp [hlin, mul_assoc] -+ -+lemma weierstrassFactor_eq_exp_neg_tail (m : ℕ) {z : ℂ} (hz : ‖z‖ < 1) (hz1 : z ≠ 1) : -+ weierstrassFactor m z = exp (-logTail m z) := by -+ unfold weierstrassFactor -+ have hz_ne_1 : 1 - z ≠ 0 := sub_ne_zero.mpr hz1.symm -+ rw [← exp_log hz_ne_1, ← Complex.exp_add] -+ have hsum : log (1 - z) + partialLogSum m z = -logTail m z := by -+ have hdecomp := neg_log_one_sub_eq_partialLogSum_add_logTail hz m -+ calc -+ log (1 - z) + partialLogSum m z -+ = log (1 - z) + (partialLogSum m z + logTail m z) - logTail m z := by ring -+ _ = log (1 - z) + (-log (1 - z)) - logTail m z := by rw [hdecomp] -+ _ = -logTail m z := by ring -+ simp [hsum] -+ -+theorem weierstrassFactor_sub_one_pow_bound {m : ℕ} {z : ℂ} (hz : ‖z‖ ≤ 1 / 2) : -+ ‖weierstrassFactor m z - 1‖ ≤ 4 * ‖z‖ ^ (m + 1) := by -+ by_cases hm : m = 0 -+ · subst hm -+ have hmain : ‖(1 - z) - 1‖ ≤ 4 * ‖z‖ ^ 1 := by -+ have h : (1 - z) - 1 = -z := by ring -+ calc -+ ‖(1 - z) - 1‖ = ‖-z‖ := by simp [h] -+ _ = ‖z‖ := norm_neg z -+ _ = ‖z‖ ^ 1 := by simp -+ _ ≤ 4 * ‖z‖ ^ 1 := by nlinarith [pow_nonneg (norm_nonneg z) 1] -+ simpa [weierstrassFactor] using hmain -+ · have hz_lt : ‖z‖ < 1 := lt_of_le_of_lt hz (by norm_num) -+ by_cases hz1 : z = 1 -+ · exfalso; rw [hz1] at hz; norm_num at hz -+ have h_eq : weierstrassFactor m z = exp (-logTail m z) := -+ weierstrassFactor_eq_exp_neg_tail m hz_lt hz1 -+ rw [h_eq] -+ have h_tail_bound := norm_logTail_le_two_mul_norm_pow hz_lt hz m -+ have hw_le_one : ‖-logTail m z‖ ≤ 1 := by -+ simp only [norm_neg] -+ have : ‖logTail m z‖ ≤ 1 := by -+ have hm_pos : 0 < m := Nat.pos_of_ne_zero hm -+ have h2 : 2 ≤ m + 1 := by -+ exact Nat.succ_le_succ (Nat.succ_le_iff.2 hm_pos) -+ have hpow : (‖z‖ ^ (m + 1)) ≤ (‖z‖ ^ 2) := by -+ have hz1' : ‖z‖ ≤ 1 := by nlinarith [hz] -+ have hz0' : 0 ≤ ‖z‖ := norm_nonneg z -+ exact pow_le_pow_of_le_one hz0' hz1' h2 -+ have hmul : 2 * ‖z‖ ^ (m + 1) ≤ 2 * ‖z‖ ^ 2 := by gcongr -+ have hsq : 2 * ‖z‖ ^ 2 ≤ 1 := by -+ have hz0 : 0 ≤ ‖z‖ := norm_nonneg z -+ have hz_sq : ‖z‖ ^ 2 ≤ (1 / 2 : ℝ) ^ 2 := pow_le_pow_left₀ hz0 hz 2 -+ nlinarith -+ exact (h_tail_bound.trans hmul).trans hsq -+ linarith -+ have h_exp_sub_one : ‖exp (-logTail m z) - 1‖ ≤ 2 * ‖-logTail m z‖ := -+ Complex.norm_exp_sub_one_le hw_le_one -+ simp only [norm_neg] at h_exp_sub_one -+ calc -+ ‖exp (-logTail m z) - 1‖ ≤ 2 * ‖logTail m z‖ := h_exp_sub_one -+ _ ≤ 2 * (2 * ‖z‖ ^ (m + 1)) := by gcongr -+ _ = 4 * ‖z‖ ^ (m + 1) := by ring -+ -+lemma log_norm_weierstrassFactor_ge_log_norm_one_sub_sub (m : ℕ) (z : ℂ) : -+ Real.log ‖1 - z‖ - ‖partialLogSum m z‖ ≤ Real.log ‖weierstrassFactor m z‖ := by -+ by_cases hz1 : z = (1 : ℂ) -+ · subst hz1 -+ simp [weierstrassFactor] -+ set S : ℂ := partialLogSum m z -+ have hS : weierstrassFactor m z = (1 - z) * Complex.exp S := by -+ simp [weierstrassFactor, S] -+ have hnorm_pos : 0 < ‖(1 : ℂ) - z‖ := -+ norm_pos_iff.mpr (sub_ne_zero.mpr (Ne.symm hz1)) -+ have hlog : -+ Real.log ‖weierstrassFactor m z‖ = Real.log ‖1 - z‖ + S.re := by -+ have hne : ‖(1 : ℂ) - z‖ ≠ 0 := ne_of_gt hnorm_pos -+ calc -+ Real.log ‖weierstrassFactor m z‖ -+ = Real.log (‖(1 : ℂ) - z‖ * ‖Complex.exp S‖) := by -+ simp [hS] -+ _ = Real.log ‖(1 : ℂ) - z‖ + Real.log ‖Complex.exp S‖ := by -+ simpa using (Real.log_mul hne (ne_of_gt (by simp))) -+ _ = Real.log ‖(1 : ℂ) - z‖ + S.re := by -+ simp [Complex.norm_exp, Real.log_exp] -+ _ = Real.log ‖1 - z‖ + S.re := by simp [sub_eq_add_neg, add_comm] -+ have hre : S.re ≥ -‖S‖ := Complex.neg_norm_le_re S -+ have : Real.log ‖weierstrassFactor m z‖ ≥ Real.log ‖1 - z‖ - ‖S‖ := by -+ linarith [hlog, hre] -+ simpa [S] using this -+ -+lemma log_norm_weierstrassFactor_ge_neg_two_pow {m : ℕ} {z : ℂ} (hz : ‖z‖ ≤ (1 / 2 : ℝ)) : -+ (-2 : ℝ) * ‖z‖ ^ (m + 1) ≤ Real.log ‖weierstrassFactor m z‖ := by -+ have hz_lt : ‖z‖ < (1 : ℝ) := lt_of_le_of_lt hz (by norm_num) -+ have hz1 : z ≠ (1 : ℂ) := by -+ intro h -+ have : (1 : ℝ) ≤ (1 / 2 : ℝ) := by -+ simpa [h] using hz -+ norm_num at this -+ have hEq : weierstrassFactor m z = Complex.exp (-logTail m z) := -+ weierstrassFactor_eq_exp_neg_tail m hz_lt hz1 -+ have hlog : -+ Real.log ‖weierstrassFactor m z‖ = (-logTail m z).re := by -+ simp [hEq, Complex.norm_exp, Real.log_exp] -+ have hre : (-logTail m z).re ≥ -‖logTail m z‖ := by -+ simpa [norm_neg] using Complex.neg_norm_le_re (-logTail m z) -+ have htail := norm_logTail_le_two_mul_norm_pow hz_lt hz m -+ have : (-logTail m z).re ≥ (-2 : ℝ) * ‖z‖ ^ (m + 1) := by -+ calc -+ (-logTail m z).re ≥ -‖logTail m z‖ := hre -+ _ ≥ (-2 : ℝ) * ‖z‖ ^ (m + 1) := by -+ nlinarith [htail] -+ simpa [hlog, mul_assoc, mul_left_comm, mul_comm] using this -+ -+end Complex -+end -+end HadamardSourceScope02 -+ -+section HadamardSourceScope03 -+ -+noncomputable section -+ -+open Filter Topology -+ -+namespace Complex -+ -+open _root_.Complex -+ -+theorem logDeriv_weierstrassFactor_one_div {a z : ℂ} (ha : a ≠ 0) (hz : z ≠ a) : -+ logDeriv (fun w : ℂ => weierstrassFactor 1 (w / a)) z = -+ 1 / (z - a) + 1 / a := by -+ have hE : -+ (fun w : ℂ => weierstrassFactor 1 (w / a)) = -+ fun w : ℂ => (1 - w / a) * exp (w / a) := by -+ ext w -+ simp [weierstrassFactor_def, partialLogSum_eq_sum] -+ have hf : (1 - z / a) ≠ 0 := by -+ intro hzero -+ have hdiv : z / a = 1 := by -+ exact (sub_eq_zero.mp hzero).symm -+ exact hz ((div_eq_one_iff_eq ha).1 hdiv) -+ rw [hE, logDeriv_fun_mul z hf (exp_ne_zero (z / a)) (by fun_prop) (by fun_prop)] -+ have hleft : logDeriv (fun w : ℂ => 1 - w / a) z = 1 / (z - a) := by -+ rw [logDeriv_apply] -+ have hderiv : deriv (fun w : ℂ => 1 - w / a) z = -(1 / a) := by -+ simp [one_div] -+ rw [hderiv] -+ have haz : -z + a ≠ 0 := by -+ simpa [sub_eq_add_neg, add_comm] using sub_ne_zero.mpr (Ne.symm hz) -+ field_simp [ha, sub_ne_zero.mpr hz, haz] -+ have haz' : a - z ≠ 0 := sub_ne_zero.mpr (Ne.symm hz) -+ have hza : z - a = -(a - z) := by ring -+ rw [hza] -+ field_simp [haz'] -+ have hright : logDeriv (fun w : ℂ => exp (w / a)) z = 1 / a := by -+ rw [logDeriv_apply] -+ have hderiv : deriv (fun w : ℂ => exp (w / a)) z = -+ exp (z / a) * (1 / a) := by -+ simp [one_div] -+ rw [hderiv] -+ field_simp [exp_ne_zero (z / a)] -+ rw [hleft, hright] -+ -+end Complex -+end -+end HadamardSourceScope03 -+ -+section HadamardSourceScope04 -+ -+open Filter Topology Set -+ -+namespace MeromorphicOn -+ -+open _root_.MeromorphicOn -+ -+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {U K : Set 𝕜} {z : 𝕜} -+ {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] -+ -+lemma divisor_support_inter_compact_finite (f : 𝕜 → E) {U K : Set 𝕜} -+ (hK : IsCompact K) (hKU : K ⊆ U) : -+ (K ∩ (MeromorphicOn.divisor f U).support).Finite := by -+ classical -+ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U -+ have hloc : -+ ∀ x ∈ K, ∃ V : Set 𝕜, V ∈ 𝓝 x ∧ Set.Finite (V ∩ D.support) := by -+ intro x hxK -+ rcases D.supportLocallyFiniteWithinDomain x (hKU hxK) with ⟨V, hV, hfin⟩ -+ exact ⟨V, hV, hfin⟩ -+ choose V hVnhds hVfin using hloc -+ rcases hK.elim_nhds_subcover' (U := fun x hx => V x hx) (hU := fun x hx => hVnhds x hx) with -+ ⟨t, ht⟩ -+ have hsub : -+ K ∩ D.support ⊆ ⋃ x ∈ t, (V (x : 𝕜) x.2 ∩ D.support) := by -+ intro y hy -+ rcases hy with ⟨hyK, hyS⟩ -+ have hycov : y ∈ ⋃ x ∈ t, V (x : 𝕜) x.2 := ht hyK -+ rcases Set.mem_iUnion.1 hycov with ⟨x, hycov'⟩ -+ rcases Set.mem_iUnion.1 hycov' with ⟨hxT, hyV⟩ -+ refine Set.mem_iUnion.2 ⟨x, Set.mem_iUnion.2 ?_⟩ -+ exact ⟨hxT, ⟨hyV, hyS⟩⟩ -+ have hfinU : Set.Finite (⋃ x ∈ t, (V (x : 𝕜) x.2 ∩ D.support)) := by -+ classical -+ refine (t.finite_toSet).biUnion ?_ -+ intro x hx -+ simpa using (hVfin (x : 𝕜) x.2) -+ exact hfinU.subset hsub -+ -+end MeromorphicOn -+end HadamardSourceScope04 -+ -+section HadamardSourceScope05 -+ -+open Set -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+def divisorZeroIndex (f : ℂ → ℂ) (U : Set ℂ) : Type := -+ Σ z : ℂ, Fin (Int.toNat (MeromorphicOn.divisor f U z)) -+ -+abbrev divisorZeroIndex₀ (f : ℂ → ℂ) (U : Set ℂ) : Type := -+ {p : divisorZeroIndex f U // p.1 ≠ 0} -+ -+abbrev divisorZeroIndex₀Val {f : ℂ → ℂ} {U : Set ℂ} (p : divisorZeroIndex₀ f U) : ℂ := -+ p.1.1 -+ -+@[simp] -+lemma divisorZeroIndex₀Val_ne_zero {f : ℂ → ℂ} {U : Set ℂ} (p : divisorZeroIndex₀ f U) : -+ divisorZeroIndex₀Val p ≠ 0 := p.2 -+ -+@[simp] -+lemma divisorZeroIndex₀Val_mem_divisor_support {f : ℂ → ℂ} {U : Set ℂ} -+ (p : divisorZeroIndex₀ f U) : -+ MeromorphicOn.divisor f U (divisorZeroIndex₀Val p) ≠ 0 := by -+ have hn : -+ Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p)) ≠ 0 := by -+ intro h0 -+ have q0 : Fin 0 := by -+ simpa [divisorZeroIndex₀Val, h0] using p.1.2 -+ exact Fin.elim0 q0 -+ intro hdiv -+ have : Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p)) = 0 := by -+ simp [hdiv] -+ exact hn this -+ -+noncomputable def divisorCanonicalProduct (m : ℕ) (f : ℂ → ℂ) (U : Set ℂ) (z : ℂ) : ℂ := -+ ∏' p : divisorZeroIndex₀ f U, weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ -+@[simp] -+lemma divisorCanonicalProduct_zero (m : ℕ) (f : ℂ → ℂ) (U : Set ℂ) : -+ divisorCanonicalProduct m f U 0 = 1 := by -+ simp [divisorCanonicalProduct] -+ -+end Complex.Hadamard -+end HadamardSourceScope05 -+ -+section HadamardSourceScope06 -+ -+namespace Complex -+ -+open _root_.Complex -+ -+section UniformMul -+ -+theorem _root_.Erdos970.TendstoUniformlyOn.mul_left_bounded {ι : Type*} {p : Filter ι} {K : Set ℂ} -+ {F : ι → ℂ → ℂ} {f : ℂ → ℂ} {h : ℂ → ℂ} -+ (hF : TendstoUniformlyOn F f p K) (hh : ∃ C, ∀ z ∈ K, ‖h z‖ ≤ C) : -+ TendstoUniformlyOn (fun n z => h z * F n z) (fun z => h z * f z) p K := by -+ intro u hu -+ rcases Metric.mem_uniformity_dist.1 hu with ⟨ε, hεpos, hεu⟩ -+ rcases hh with ⟨C, hC⟩ -+ set C' : ℝ := max C 1 -+ have hC'pos : 0 < C' := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ have hC' : ∀ z ∈ K, ‖h z‖ ≤ C' := fun z hz => le_trans (hC z hz) (le_max_left _ _) -+ have hv : {p : ℂ × ℂ | dist p.1 p.2 < ε / C'} ∈ uniformity ℂ := -+ Metric.mem_uniformity_dist.2 ⟨ε / C', div_pos hεpos hC'pos, fun _ _ hab => hab⟩ -+ have hF' : ∀ᶠ n in p, ∀ z : ℂ, z ∈ K → dist (f z) (F n z) < ε / C' := hF _ hv -+ filter_upwards [hF'] with n hn z hzK -+ have hn' : ‖f z - F n z‖ < ε / C' := by simpa [dist_eq_norm] using hn z hzK -+ have hle : ‖h z‖ * ‖f z - F n z‖ ≤ C' * ‖f z - F n z‖ := -+ mul_le_mul_of_nonneg_right (hC' z hzK) (norm_nonneg _) -+ have hlt : C' * ‖f z - F n z‖ < C' * (ε / C') := mul_lt_mul_of_pos_left hn' hC'pos -+ have hnorm : -+ ‖h z * f z - h z * F n z‖ = ‖h z‖ * ‖f z - F n z‖ := by -+ calc -+ ‖h z * f z - h z * F n z‖ = ‖h z * (f z - F n z)‖ := by simp [mul_sub] -+ _ = ‖h z‖ * ‖f z - F n z‖ := by simp -+ have hdist : dist (h z * f z) (h z * F n z) < ε := by -+ rw [dist_eq_norm, hnorm] -+ have hlt' : ‖h z‖ * ‖f z - F n z‖ < ε := by -+ calc -+ ‖h z‖ * ‖f z - F n z‖ ≤ C' * ‖f z - F n z‖ := hle -+ _ < C' * (ε / C') := hlt -+ _ = ε := by field_simp [hC'pos.ne'] -+ exact hlt' -+ exact hεu hdist -+ -+end UniformMul -+ -+end Complex -+end HadamardSourceScope06 -+ -+section HadamardSourceScope07 -+ -+open Filter _root_.Function _root_.Complex _root_.Erdos970.Complex Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+lemma finite_divisorZeroIndex₀_subtype_norm_le {f : ℂ → ℂ} {U : Set ℂ} (B : ℝ) -+ (hBU : Metric.closedBall (0 : ℂ) B ⊆ U) : -+ Finite {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ B} := by -+ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U -+ have hK : IsCompact (Metric.closedBall (0 : ℂ) B) := isCompact_closedBall _ _ -+ have hpts0 : ((Metric.closedBall (0 : ℂ) B) ∩ D.support).Finite := -+ MeromorphicOn.divisor_support_inter_compact_finite (f := f) (U := U) -+ (K := Metric.closedBall (0 : ℂ) B) hK hBU -+ set pts : Set ℂ := ((Metric.closedBall (0 : ℂ) B) ∩ D.support) \ {0} -+ have hpts : pts.Finite := hpts0.sdiff -+ let : Fintype pts := hpts.fintype -+ let T : Type := Σ z : pts, Fin (Int.toNat (D z.1)) -+ have : Finite T := by infer_instance -+ let F : -+ {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ B} → T := fun p => -+ ⟨⟨divisorZeroIndex₀Val p.1, by -+ have hball : divisorZeroIndex₀Val p.1 ∈ Metric.closedBall (0 : ℂ) B := by -+ simpa [Metric.mem_closedBall, dist_zero_right] using p.2 -+ have hsupport : divisorZeroIndex₀Val p.1 ∈ D.support := by -+ have hne_toNat : -+ Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p.1)) ≠ 0 := by -+ intro h0 -+ have hpfin : -+ Fin (Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p.1))) := by -+ simpa [D] using p.1.1.2 -+ have : Fin 0 := by simpa [h0] using hpfin -+ exact Fin.elim0 this -+ have hne_D : D (divisorZeroIndex₀Val p.1) ≠ 0 := by -+ intro hD0 -+ apply hne_toNat -+ simp [D, hD0] -+ simp [D, Function.locallyFinsuppWithin.support, Function.support] -+ have hne0 : divisorZeroIndex₀Val p.1 ≠ 0 := divisorZeroIndex₀Val_ne_zero p.1 -+ exact ⟨⟨hball, hsupport⟩, by simp [Set.mem_singleton_iff]⟩⟩, -+ p.1.1.2⟩ -+ refine Finite.of_injective F ?_ -+ intro p q hpq -+ apply Subtype.ext -+ apply Subtype.ext -+ have h' := (Sigma.mk.inj_iff.1 hpq) -+ have hz : divisorZeroIndex₀Val p.1 = divisorZeroIndex₀Val q.1 := congrArg Subtype.val h'.1 -+ apply (Sigma.mk.inj_iff).2 -+ refine ⟨hz, ?_⟩ -+ exact h'.2 -+ -+lemma divisorZeroIndex₀_norm_le_finite {f : ℂ → ℂ} {U : Set ℂ} (B : ℝ) -+ (hBU : Metric.closedBall (0 : ℂ) B ⊆ U) : -+ ({p : divisorZeroIndex₀ f U | ‖divisorZeroIndex₀Val p‖ ≤ B} : Set _).Finite := by -+ let s : Set (divisorZeroIndex₀ f U) := {p | ‖divisorZeroIndex₀Val p‖ ≤ B} -+ have : Finite (↥s) := -+ finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := U) B hBU -+ exact Set.toFinite s -+ -+lemma norm_div_le_half_of_norm_le_of_two_mul_lt {z a : ℂ} {R : ℝ} -+ (hR : 0 < R) (hz : ‖z‖ ≤ R) (ha : (2 * R : ℝ) < ‖a‖) : -+ ‖z / a‖ ≤ (1 / 2 : ℝ) := by -+ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hR] -+ have hinv : ‖a‖⁻¹ < (2 * R)⁻¹ := by -+ simpa [one_div] using one_div_lt_one_div_of_lt h2R_pos ha -+ have hmul_le : ‖z‖ * ‖a‖⁻¹ ≤ R * ‖a‖⁻¹ := -+ mul_le_mul_of_nonneg_right hz (inv_nonneg.2 (norm_nonneg a)) -+ have hmul_lt : R * ‖a‖⁻¹ < R * (2 * R)⁻¹ := -+ mul_lt_mul_of_pos_left hinv hR -+ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by -+ have hRne : (R : ℝ) ≠ 0 := hR.ne' -+ rw [show R * (2 * R)⁻¹ = R / (2 * R) by simp [div_eq_mul_inv]] -+ field_simp [hRne] -+ have hnorm : ‖z / a‖ = ‖z‖ * ‖a‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ exact le_of_lt <| by -+ calc -+ ‖z / a‖ = ‖z‖ * ‖a‖⁻¹ := hnorm -+ _ ≤ R * ‖a‖⁻¹ := hmul_le -+ _ < R * (2 * R)⁻¹ := hmul_lt -+ _ = (1 / 2 : ℝ) := hRhalf -+ -+theorem summable_logDerivTerms_divisorZeroIndex₀_of_summable_inv_sq -+ {f : ℂ → ℂ} {z : ℂ} -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) -+ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ 1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by -+ let R : ℝ := max ‖z‖ 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ have hzle : ‖z‖ ≤ R := le_max_left _ _ -+ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (2 * R) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ)) -+ have hu : Summable u := h_sum.mul_left (2 * R) -+ refine hu.of_norm_bounded_eventually ?_ -+ have h_big : -+ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, -+ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ -+ 2 * R} : Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ exact divisorZeroIndex₀_norm_le_finite -+ (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this -+ have := hfin.eventually_cofinite_notMem -+ filter_upwards [this] with p hp -+ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp -+ exact lt_of_not_ge this -+ filter_upwards [h_big] with p hp -+ let a : ℂ := divisorZeroIndex₀Val p -+ have ha0 : a ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ have hza0 : z - a ≠ 0 := sub_ne_zero.mpr (hz p) -+ have hterm : 1 / (z - a) + 1 / a = z / (a * (z - a)) := by -+ field_simp [ha0, hza0] -+ ring -+ have htri : ‖a‖ ≤ ‖z‖ + ‖z - a‖ := by -+ have hraw : ‖a‖ ≤ ‖z‖ + ‖a - z‖ := by -+ have h := norm_add_le z (a - z) -+ simpa [a, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h -+ simpa [norm_sub_rev] using hraw -+ have hza_lower : ‖a‖ / 2 ≤ ‖z - a‖ := by -+ nlinarith [htri, hzle, hp] -+ have hnorm : ‖1 / (z - a) + 1 / a‖ ≤ (2 * R) * (‖a‖⁻¹ ^ (2 : ℕ)) := by -+ rw [hterm, norm_div, norm_mul] -+ have ha_norm_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha0 -+ have hza_norm_pos : 0 < ‖z - a‖ := norm_pos_iff.mpr hza0 -+ rw [div_eq_mul_inv] -+ calc -+ ‖z‖ * (‖a‖ * ‖z - a‖)⁻¹ -+ = ‖z‖ * ‖a‖⁻¹ * ‖z - a‖⁻¹ := by -+ field_simp [ha_norm_pos.ne', hza_norm_pos.ne'] -+ _ ≤ R * ‖a‖⁻¹ * ‖z - a‖⁻¹ := by -+ gcongr -+ _ ≤ R * ‖a‖⁻¹ * (2 * ‖a‖⁻¹) := by -+ gcongr -+ have hhalf_pos : 0 < ‖a‖ / 2 := by positivity -+ have hinv : ‖z - a‖⁻¹ ≤ (‖a‖ / 2)⁻¹ := by -+ simpa [one_div] using one_div_le_one_div_of_le hhalf_pos hza_lower -+ have hhalf_inv : (‖a‖ / 2)⁻¹ = 2 * ‖a‖⁻¹ := by field_simp [ha_norm_pos.ne'] -+ simpa [hhalf_inv] using hinv -+ _ = (2 * R) * (‖a‖⁻¹ ^ (2 : ℕ)) := by ring -+ simpa [u, a] using hnorm -+ -+theorem hasProdUniformlyOn_divisorCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) {K : Set ℂ} (hK : IsCompact K) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ HasProdUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) K := by -+ rcases (isBounded_iff_forall_norm_le.1 hK.isBounded) with ⟨R0, hR0⟩ -+ set R : ℝ := max R0 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ have hnormK : ∀ z ∈ K, ‖z‖ ≤ R := fun z hzK => le_trans (hR0 z hzK) (le_max_left _ _) -+ let g : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1 -+ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) -+ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) -+ have h_big : -+ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, -+ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 2 * R} : -+ Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this -+ have := hfin.eventually_cofinite_notMem -+ filter_upwards [this] with p hp -+ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp -+ exact lt_of_not_ge this -+ have hBound : -+ ∀ᶠ p in Filter.cofinite, ∀ z ∈ K, ‖g p z‖ ≤ u p := by -+ filter_upwards [h_big] with p hp z hzK -+ have hzle : ‖z‖ ≤ R := hnormK z hzK -+ have hz_div : ‖z / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by -+ exact norm_div_le_half_of_norm_le_of_two_mul_lt hRpos hzle hp -+ have hE : -+ ‖weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1‖ ≤ -+ 4 * ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) := -+ weierstrassFactor_sub_one_pow_bound (m := m) (z := z / divisorZeroIndex₀Val p) hz_div -+ have hz_pow : -+ ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ -+ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ have : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ rw [this] -+ have : (‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = -+ ‖z‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ simp [mul_pow] -+ rw [this] -+ have hzle_pow : ‖z‖ ^ (m + 1) ≤ R ^ (m + 1) := -+ pow_le_pow_left₀ (norm_nonneg z) hzle (m + 1) -+ gcongr -+ dsimp [g, u] -+ nlinarith [hE, hz_pow] -+ have hcts : ∀ p, ContinuousOn (g p) K := by -+ intro p -+ have hcontE : Continuous (fun z : ℂ => weierstrassFactor m z) := -+ (differentiable_weierstrassFactor m).continuous -+ have hdiv : Continuous fun z : ℂ => z / divisorZeroIndex₀Val p := by -+ simpa [div_eq_mul_inv] using! (continuous_id.mul continuous_const) -+ have hcont : Continuous fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) := -+ hcontE.comp hdiv -+ simpa only [g] using hcont.continuousOn.fun_sub continuous_const.continuousOn -+ have hprod : -+ HasProdUniformlyOn (fun p z ↦ 1 + g p z) (fun z ↦ ∏' p, (1 + g p z)) K := by -+ simpa using -+ Summable.hasProdUniformlyOn_one_add (f := g) (u := u) (K := K) hK hu hBound hcts -+ simpa [g, divisorCanonicalProduct, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] -+ using! hprod -+ -+theorem hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ (Set.univ : Set ℂ) := by -+ refine hasProdLocallyUniformlyOn_of_forall_compact -+ (f := fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (g := divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ (s := (Set.univ : Set ℂ)) isOpen_univ ?_ -+ intro K hKU hK -+ simpa using -+ (hasProdUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) (K := K) hK h_sum) -+ -+theorem differentiableOn_divisorCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ DifferentiableOn ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) (Set.univ : Set ℂ) := by -+ have hloc : -+ TendstoLocallyUniformlyOn -+ (fun (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) => -+ ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ Filter.atTop (Set.univ : Set ℂ) := by -+ simpa [HasProdLocallyUniformlyOn] using -+ (hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum) -+ have hF : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in Filter.atTop, -+ DifferentiableOn ℂ -+ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (Set.univ : Set ℂ) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro s -+ have hdiff : -+ Differentiable ℂ -+ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) := by -+ let F : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ have hF' : ∀ p ∈ s, Differentiable ℂ (F p) := by -+ intro p hp -+ have hdiv : Differentiable ℂ (fun z : ℂ => z / divisorZeroIndex₀Val p) := by -+ have : Differentiable ℂ (fun z : ℂ => z * ((divisorZeroIndex₀Val p)⁻¹)) := -+ (differentiable_id : Differentiable ℂ (fun z : ℂ => z)).mul_const -+ ((divisorZeroIndex₀Val p)⁻¹) -+ simp [div_eq_mul_inv] -+ exact (differentiable_weierstrassFactor m).comp hdiv -+ simpa [F] using (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := F) (u := s) hF') -+ simpa using hdiff.differentiableOn -+ have : (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))).NeBot := -+ Filter.atTop_neBot -+ exact hloc.differentiableOn hF isOpen_univ -+ -+theorem differentiableAt_divisorCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : -+ DifferentiableAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := -+ ((differentiableOn_divisorCanonicalProduct_univ m f h_sum) z (by simp)).differentiableAt -+ (by simp) -+ -+theorem logDeriv_divisorCanonicalProduct_one_eq_tsum -+ {f : ℂ → ℂ} {z : ℂ} -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) -+ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) -+ (hprod_ne : divisorCanonicalProduct 1 f (Set.univ : Set ℂ) z ≠ 0) : -+ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z = -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by -+ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p w => weierstrassFactor 1 (w / divisorZeroIndex₀Val p) -+ have hf : ∀ p, Φ p z ≠ 0 := by -+ intro p -+ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ refine weierstrassFactor_ne_zero_of_ne_one 1 ?_ -+ intro h -+ exact hz p ((div_eq_one_iff_eq hp0).1 h) -+ have hd : ∀ p, DifferentiableOn ℂ (Φ p) (Set.univ : Set ℂ) := by -+ intro p -+ have hdiv : Differentiable ℂ (fun w : ℂ => w / divisorZeroIndex₀Val p) := by -+ have : Differentiable ℂ (fun w : ℂ => w * ((divisorZeroIndex₀Val p)⁻¹)) := -+ (differentiable_id : Differentiable ℂ (fun w : ℂ => w)).mul_const -+ ((divisorZeroIndex₀Val p)⁻¹) -+ simp [div_eq_mul_inv] -+ exact ((differentiable_weierstrassFactor 1).comp hdiv).differentiableOn -+ have hm' : Summable fun p => logDeriv (Φ p) z := by -+ have hm : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ 1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := -+ summable_logDerivTerms_divisorZeroIndex₀_of_summable_inv_sq h_sum hz -+ refine hm.congr ?_ -+ intro p -+ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ simpa [Φ] using -+ (Complex.logDeriv_weierstrassFactor_one_div -+ (a := divisorZeroIndex₀Val p) (z := z) hp0 (hz p)).symm -+ have htend : MultipliableLocallyUniformlyOn Φ (Set.univ : Set ℂ) := by -+ have hprod := hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ -+ (m := 1) (f := f) h_sum -+ simpa [Φ, divisorCanonicalProduct] using hprod.multipliableLocallyUniformlyOn -+ have hnez : (∏' p, Φ p z) ≠ 0 := by -+ simpa [Φ, divisorCanonicalProduct] using hprod_ne -+ have hlog : logDeriv (∏' p, Φ p ·) z = ∑' p, logDeriv (Φ p) z := -+ logDeriv_tprod_eq_tsum (s := (Set.univ : Set ℂ)) isOpen_univ (by simp) -+ hf hd hm' htend hnez -+ calc -+ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z -+ = ∑' p, logDeriv (Φ p) z := by -+ simpa [Φ, divisorCanonicalProduct] using! hlog -+ _ = ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by -+ refine tsum_congr fun p => ?_ -+ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ simpa [Φ] using -+ Complex.logDeriv_weierstrassFactor_one_div -+ (a := divisorZeroIndex₀Val p) (z := z) hp0 (hz p) -+ -+end Complex.Hadamard -+end HadamardSourceScope07 -+ -+section HadamardSourceScope09 -+ -+noncomputable section -+ -+open Set -+open scoped Topology BigOperators -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+lemma divisor_univ_eq_analyticOrderNatAt_int {f : ℂ → ℂ} (hf : Differentiable ℂ f) (z : ℂ) : -+ MeromorphicOn.divisor f (Set.univ : Set ℂ) z = (analyticOrderNatAt f z : ℤ) := by -+ have hmero : MeromorphicOn f (Set.univ : Set ℂ) := by -+ intro w hw -+ exact (Differentiable.analyticAt (f := f) hf w).meromorphicAt -+ simp only -+ [MeromorphicOn.divisor_apply hmero (by simp : z ∈ (Set.univ : Set ℂ)), analyticOrderNatAt] -+ have han : AnalyticAt ℂ f z := Differentiable.analyticAt (f := f) hf z -+ cases h : analyticOrderAt f z with -+ | top => -+ simp [han.meromorphicOrderAt_eq, h] -+ | coe n => -+ simp [han.meromorphicOrderAt_eq, h] -+ -+theorem divisorZeroIndex₀_fiber_finite (f : ℂ → ℂ) (z₀ : ℂ) : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | divisorZeroIndex₀Val p = z₀} : -+ Set _).Finite := by -+ have hsub : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | divisorZeroIndex₀Val p = z₀} : Set _) -+ ⊆ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ‖z₀‖} : -+ Set _) := by -+ intro p hp -+ have : divisorZeroIndex₀Val p = z₀ := hp -+ simp [this] -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ‖z₀‖} : -+ Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) ‖z₀‖ ⊆ (Set.univ : Set ℂ) := by simp -+ simpa using (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) -+ (B := ‖z₀‖) this) -+ exact hfin.subset hsub -+ -+def divisorZeroIndex₀FiberFinset (f : ℂ → ℂ) (z₀ : ℂ) : -+ Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ (divisorZeroIndex₀_fiber_finite (f := f) z₀).toFinset -+ -+@[simp] -+lemma mem_divisorZeroIndex₀FiberFinset (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : -+ p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ↔ divisorZeroIndex₀Val p = z₀ := by -+ simp [divisorZeroIndex₀FiberFinset] -+ -+theorem eventually_atTop_subset_fiberFinset -+ (f : ℂ → ℂ) (z₀ : ℂ) : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), -+ divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s := by -+ refine (Filter.eventually_atTop.2 ?_) -+ refine ⟨divisorZeroIndex₀FiberFinset (f := f) z₀, ?_⟩ -+ intro s hs -+ exact hs -+ -+lemma divisorZeroIndex₀FiberFinset_card_eq_toNat_divisor (f : ℂ → ℂ) {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = -+ Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) := by -+ let S : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := {p | divisorZeroIndex₀Val p = z₀} -+ have hS : S.Finite := divisorZeroIndex₀_fiber_finite (f := f) z₀ -+ set n : ℕ := Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) -+ have hcard : Nat.card S = n := by -+ classical -+ have : Fintype S := hS.fintype -+ -+ let e : S ≃ Fin n := -+ { toFun := by -+ intro x -+ rcases x with ⟨p, hp⟩ -+ rcases p with ⟨⟨z, q⟩, hz⟩ -+ have hzEq : z = z₀ := by simpa [divisorZeroIndex₀Val] using! hp -+ subst hzEq -+ simpa [n] using q -+ invFun := by -+ intro q -+ refine ⟨⟨⟨z₀, ?_⟩, hz₀⟩, ?_⟩ -+ · simpa [n] using q -+ · simp [S, divisorZeroIndex₀Val] -+ left_inv := by -+ rintro ⟨p, hp⟩ -+ rcases p with ⟨⟨z, q⟩, hz⟩ -+ have hzEq : z = z₀ := by simpa [divisorZeroIndex₀Val] using! hp -+ subst hzEq -+ (ext; rfl) -+ right_inv := by -+ intro q -+ rfl } -+ have h := Nat.card_congr (α := S) (β := Fin n) e -+ simpa using (h.trans (by simp)) -+ have hSncard : S.ncard = n := by -+ simpa [Nat.card_coe_set_eq] using hcard -+ have hto : hS.toFinset = divisorZeroIndex₀FiberFinset (f := f) z₀ := by -+ rfl -+ have htoFinset : S.ncard = (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by -+ have h' : S.ncard = hS.toFinset.card := Set.ncard_eq_toFinset_card S hS -+ simpa [hto] using h' -+ exact htoFinset.symm.trans hSncard -+ -+lemma divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt -+ {f : ℂ → ℂ} (hf : Differentiable ℂ f) {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = analyticOrderNatAt f z₀ := by -+ have hdiv : -+ MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀ = (analyticOrderNatAt f z₀ : ℤ) := -+ divisor_univ_eq_analyticOrderNatAt_int (f := f) hf z₀ -+ have htoNat : Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) = -+ analyticOrderNatAt f z₀ := by -+ simp [hdiv] -+ exact (divisorZeroIndex₀FiberFinset_card_eq_toNat_divisor (f := f) (z₀ := z₀) hz₀).trans htoNat -+ -+lemma not_mem_divisorZeroIndex₀FiberFinset_iff_val_ne -+ {f : ℂ → ℂ} (z₀ : ℂ) (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : -+ p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀ ↔ divisorZeroIndex₀Val p ≠ z₀ := by -+ simp [mem_divisorZeroIndex₀FiberFinset] -+ -+end Complex.Hadamard -+end -+end HadamardSourceScope09 -+ -+section HadamardSourceScope10 -+ -+open Filter _root_.Function _root_.Complex _root_.Erdos970.Complex Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+noncomputable def divisorComplementFactor -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) : ℂ := by -+ classical -+ exact if p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ then (1 : ℂ) -+ else weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ -+@[simp] -+theorem divisorComplementFactor_eq_one_of_mem -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) -+ (hp : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀) : -+ divisorComplementFactor m f z₀ p z = 1 := by -+ classical -+ simp [divisorComplementFactor, hp] -+ -+@[simp] -+theorem divisorComplementFactor_eq_weierstrassFactor_of_not_mem -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) -+ (hp : p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀) : -+ divisorComplementFactor m f z₀ p z = -+ weierstrassFactor m (z / divisorZeroIndex₀Val p) := by -+ classical -+ simp [divisorComplementFactor, hp] -+ -+lemma divisorComplementFactor_def -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) : -+ divisorComplementFactor m f z₀ p z = -+ if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) -+ else weierstrassFactor m (z / divisorZeroIndex₀Val p) := by -+ classical -+ by_cases h : divisorZeroIndex₀Val p = z₀ -+ · have hp : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ := by -+ simpa [mem_divisorZeroIndex₀FiberFinset] using h -+ simp [divisorComplementFactor_eq_one_of_mem, hp, h] -+ · have hp : p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀ := by -+ intro hmem -+ exact h ((mem_divisorZeroIndex₀FiberFinset f z₀ p).1 hmem) -+ simp [divisorComplementFactor_eq_weierstrassFactor_of_not_mem, hp, h] -+ -+noncomputable def divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ℂ := -+ ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ -+theorem differentiable_weierstrassFactor_divisorZeroIndex₀ (m : ℕ) {f : ℂ → ℂ} -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : -+ Differentiable ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) := by -+ have hdiv : Differentiable ℂ (fun z : ℂ => z / divisorZeroIndex₀Val p) := by -+ simp [div_eq_mul_inv] -+ exact (differentiable_weierstrassFactor m).comp hdiv -+ -+theorem differentiable_divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : -+ Differentiable ℂ (divisorPartialProduct m f s) := by -+ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ have hΦ : ∀ p ∈ s, Differentiable ℂ (Φ p) := by -+ intro p _hp -+ exact differentiable_weierstrassFactor_divisorZeroIndex₀ m p -+ simpa [divisorPartialProduct, Φ] using! -+ (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := Φ) (u := s) hΦ) -+ -+theorem analyticAt_divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z₀ : ℂ) : -+ AnalyticAt ℂ (divisorPartialProduct m f s) z₀ := -+ (differentiable_divisorPartialProduct m f s).analyticAt z₀ -+ -+noncomputable def divisorComplementPartialProduct -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ℂ := -+ ∏ p ∈ s, divisorComplementFactor m f z₀ p z -+ -+@[simp] -+lemma divisorComplementPartialProduct_def -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : -+ divisorComplementPartialProduct m f z₀ s z = -+ ∏ p ∈ s, if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) -+ else weierstrassFactor m (z / divisorZeroIndex₀Val p) := by -+ simp [divisorComplementPartialProduct, divisorComplementFactor, -+ mem_divisorZeroIndex₀FiberFinset] -+ -+theorem differentiable_divisorComplementPartialProduct -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : -+ Differentiable ℂ (divisorComplementPartialProduct m f z₀ s) := by -+ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p z => divisorComplementFactor m f z₀ p z -+ have hΦ : ∀ p ∈ s, Differentiable ℂ (Φ p) := by -+ intro p _hp -+ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ · have hΦp : Φ p = fun _ => (1 : ℂ) := by -+ ext z -+ simp only [Φ, divisorComplementFactor_eq_one_of_mem m f z₀ p z hpF] -+ rw [hΦp] -+ exact differentiable_const (1 : ℂ) -+ · have hΦp : Φ p = fun z => weierstrassFactor m (z / divisorZeroIndex₀Val p) := by -+ ext z -+ simp only [Φ, divisorComplementFactor_eq_weierstrassFactor_of_not_mem m f z₀ p z hpF] -+ rw [hΦp] -+ exact differentiable_weierstrassFactor_divisorZeroIndex₀ m p -+ have hEq : (fun z : ℂ => ∏ p ∈ s, Φ p z) = -+ divisorComplementPartialProduct m f z₀ s := by -+ ext z -+ simp [Φ, divisorComplementPartialProduct] -+ have : Differentiable ℂ (fun z : ℂ => ∏ p ∈ s, Φ p z) := by -+ simpa using (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := Φ) (u := s) hΦ) -+ simpa [hEq] using this -+ -+noncomputable def divisorComplementCanonicalProduct -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) (z : ℂ) : ℂ := -+ ∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), divisorComplementFactor m f z₀ p z -+ -+theorem hasProdUniformlyOn_divisorComplementCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) {K : Set ℂ} (hK : IsCompact K) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ HasProdUniformlyOn (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ divisorComplementFactor m f z₀ p z) (divisorComplementCanonicalProduct m f z₀) -+ K := by -+ rcases (isBounded_iff_forall_norm_le.1 hK.isBounded) with ⟨R0, hR0⟩ -+ set R : ℝ := max R0 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ have hnormK : ∀ z ∈ K, ‖z‖ ≤ R := fun z hzK => le_trans (hR0 z hzK) (le_max_left _ _) -+ let term : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := fun p z => -+ divisorComplementFactor m f z₀ p z -+ let g : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := fun p z => term p z - 1 -+ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) -+ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) -+ have h_big : -+ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, -+ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 2 * R} : -+ Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this -+ have := hfin.eventually_cofinite_notMem -+ filter_upwards [this] with p hp -+ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp -+ exact lt_of_not_ge this -+ have hBound : -+ ∀ᶠ p in Filter.cofinite, ∀ z ∈ K, ‖g p z‖ ≤ u p := by -+ filter_upwards [h_big] with p hp z hzK -+ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ · have hval : divisorZeroIndex₀Val p = z₀ := -+ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hpF -+ have hu0 : 0 ≤ u p := by -+ dsimp [u] -+ refine mul_nonneg ?_ ?_ -+ · nlinarith [pow_nonneg (show 0 ≤ R from le_of_lt hRpos) (m + 1)] -+ · exact pow_nonneg (inv_nonneg.2 (norm_nonneg _)) (m + 1) -+ simp [g, term, divisorComplementFactor, hval, hu0, sub_eq_add_neg] -+ · have hzle : ‖z‖ ≤ R := hnormK z hzK -+ have hz_div : ‖z / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by -+ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hRpos] -+ have hinv : ‖divisorZeroIndex₀Val p‖⁻¹ < (2 * R)⁻¹ := by -+ simpa [one_div] using (one_div_lt_one_div_of_lt h2R_pos hp) -+ have hmul_le : ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ ≤ R * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ refine mul_le_mul_of_nonneg_right hzle ?_ -+ exact inv_nonneg.2 (norm_nonneg _) -+ have hmul_lt : R * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := -+ mul_lt_mul_of_pos_left hinv hRpos -+ have hlt : ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := -+ lt_of_le_of_lt hmul_le hmul_lt -+ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by -+ have hRne : (R : ℝ) ≠ 0 := hRpos.ne' -+ have : R * (2 * R)⁻¹ = R / (2 * R) := by simp [div_eq_mul_inv] -+ rw [this] -+ field_simp [hRne] -+ have hnorm : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ have hzlt : ‖z / divisorZeroIndex₀Val p‖ < (1 / 2 : ℝ) := by -+ calc -+ ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := hnorm -+ _ < R * (2 * R)⁻¹ := hlt -+ _ = (1 / 2 : ℝ) := hRhalf -+ exact le_of_lt hzlt -+ have hE : ‖weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1‖ ≤ -+ 4 * ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) := -+ weierstrassFactor_sub_one_pow_bound (m := m) (z := z / divisorZeroIndex₀Val p) hz_div -+ have hz_pow : ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ -+ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ have : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ rw [this] -+ have : (‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = -+ ‖z‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ simp [mul_pow] -+ rw [this] -+ have hzle_pow : ‖z‖ ^ (m + 1) ≤ R ^ (m + 1) := -+ pow_le_pow_left₀ (norm_nonneg z) hzle (m + 1) -+ gcongr -+ dsimp [g, term, u] -+ simp [divisorComplementFactor, hpF] at * -+ nlinarith [hE, hz_pow] -+ have hcts : ∀ p, ContinuousOn (g p) K := by -+ intro p -+ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ · have hval : divisorZeroIndex₀Val p = z₀ := -+ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hpF -+ simpa [g, term, divisorComplementFactor, hval, sub_eq_add_neg, add_assoc, add_left_comm, -+ add_comm] using -+ (continuousOn_const : ContinuousOn (fun _ : ℂ => (0 : ℂ)) K) -+ · have hvalne : divisorZeroIndex₀Val p ≠ z₀ := -+ (not_mem_divisorZeroIndex₀FiberFinset_iff_val_ne (f := f) z₀ p).1 hpF -+ have hcontE : Continuous (fun z : ℂ => weierstrassFactor m z) := -+ (differentiable_weierstrassFactor m).continuous -+ have hdiv : Continuous fun z : ℂ => z / divisorZeroIndex₀Val p := by -+ simpa [div_eq_mul_inv] using! (continuous_id.mul continuous_const) -+ have hcont : Continuous fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) := -+ hcontE.comp hdiv -+ have : ContinuousOn (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1) K := -+ (hcont.continuousOn.sub continuous_const.continuousOn) -+ simpa [g, term, divisorComplementFactor, mem_divisorZeroIndex₀FiberFinset, hvalne] using this -+ have hprod : -+ HasProdUniformlyOn (fun p z ↦ 1 + g p z) (fun z ↦ ∏' p, (1 + g p z)) K := by -+ simpa using -+ Summable.hasProdUniformlyOn_one_add (f := g) (u := u) (K := K) hK hu hBound hcts -+ have hterm : -+ HasProdUniformlyOn (fun p z ↦ term p z) (fun z ↦ ∏' p, term p z) K := by -+ simpa [g, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using hprod -+ refine hterm.congr_right ?_ -+ intro z hz -+ simp [term, divisorComplementCanonicalProduct, divisorComplementFactor] -+ -+theorem hasProdLocallyUniformlyOn_divisorComplementCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ divisorComplementFactor m f z₀ p z) -+ (divisorComplementCanonicalProduct m f z₀) -+ (Set.univ : Set ℂ) := by -+ refine hasProdLocallyUniformlyOn_of_forall_compact -+ (f := fun p z => divisorComplementFactor m f z₀ p z) -+ (g := divisorComplementCanonicalProduct m f z₀) (s := (Set.univ : Set ℂ)) -+ isOpen_univ ?_ -+ intro K hKU hK -+ simpa using -+ (hasProdUniformlyOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) -+ (K := K) hK h_sum) -+ -+theorem tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ divisorComplementPartialProduct m f z₀ s) -+ (divisorComplementCanonicalProduct m f z₀) -+ Filter.atTop -+ (Set.univ : Set ℂ) := by -+ have hprod : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ divisorComplementFactor m f z₀ p z) -+ (divisorComplementCanonicalProduct m f z₀) -+ (Set.univ : Set ℂ) := -+ hasProdLocallyUniformlyOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) -+ (z₀ := z₀) h_sum -+ have h : -+ TendstoLocallyUniformlyOn -+ (fun (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) => -+ ∏ p ∈ s, -+ if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) -+ else weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorComplementCanonicalProduct m f z₀) -+ Filter.atTop -+ (Set.univ : Set ℂ) := by -+ simpa [HasProdLocallyUniformlyOn, divisorComplementFactor, mem_divisorZeroIndex₀FiberFinset] -+ using hprod -+ refine h.congr (G := fun s z => divisorComplementPartialProduct m f z₀ s z) ?_ -+ intro s z hz -+ simp [divisorComplementPartialProduct_def] -+ -+theorem differentiableOn_divisorComplementCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) (Set.univ : Set ℂ) := by -+ have hloc : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ divisorComplementPartialProduct m f z₀ s) -+ (divisorComplementCanonicalProduct m f z₀) -+ Filter.atTop -+ (Set.univ : Set ℂ) := -+ tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ (m := m) (f := f) -+ (z₀ := z₀) h_sum -+ have hF : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in Filter.atTop, -+ DifferentiableOn ℂ (divisorComplementPartialProduct m f z₀ s) (Set.univ : Set ℂ) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro s -+ exact (differentiable_divisorComplementPartialProduct m f z₀ s).differentiableOn -+ have : (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))).NeBot := -+ Filter.atTop_neBot -+ exact hloc.differentiableOn hF isOpen_univ -+ -+lemma divisorPartialProduct_eq_fiber_mul_complement_of_subset -+ (m : ℕ) (f : ℂ → ℂ) (z₀ z : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : -+ divisorPartialProduct m f s z = -+ divisorPartialProduct m f (divisorZeroIndex₀FiberFinset (f := f) z₀) z * -+ divisorComplementPartialProduct m f z₀ s z := by -+ classical -+ let fiber : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ let P : divisorZeroIndex₀ f (Set.univ : Set ℂ) → Prop := fun p => p ∈ fiber -+ let term : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := -+ fun p => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ have hfilter : s.filter P = fiber := by -+ ext p -+ constructor -+ · intro hp -+ exact (Finset.mem_filter.mp hp).2 -+ · intro hp -+ exact Finset.mem_filter.mpr ⟨hs hp, hp⟩ -+ have hsplit : -+ (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) = ∏ p ∈ s, term p := by -+ simpa [term] using -+ (Finset.prod_filter_mul_prod_filter_not (s := s) (p := P) (f := term)) -+ have hP : (∏ p ∈ s with P p, term p) = divisorPartialProduct m f fiber z := by -+ have hg : ∀ x ∈ s \ fiber, (if x ∈ fiber then term x else (1 : ℂ)) = 1 := by -+ intro x hx -+ have hxnot : x ∉ fiber := (Finset.mem_sdiff.mp hx).2 -+ simp [hxnot] -+ have hfg : -+ ∀ x ∈ fiber, term x = (if x ∈ fiber then term x else (1 : ℂ)) := by -+ intro x hx -+ simp [hx] -+ have hsub := (Finset.prod_subset_one_on_sdiff (s₁ := fiber) (s₂ := s) -+ (f := term) (g := fun x => if x ∈ fiber then term x else (1 : ℂ)) hs hg hfg) -+ simpa [divisorPartialProduct, term, P, fiber, Finset.prod_filter] using hsub.symm -+ have hnotP : (∏ p ∈ s with ¬ P p, term p) = divisorComplementPartialProduct m f z₀ s z := by -+ simp [divisorComplementPartialProduct, divisorComplementFactor, term, P, fiber, -+ Finset.prod_filter, mem_divisorZeroIndex₀FiberFinset] -+ have hsplit' : ∏ p ∈ s, term p = (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) := -+ hsplit.symm -+ calc -+ divisorPartialProduct m f s z -+ = ∏ p ∈ s, term p := by simp [divisorPartialProduct, term] -+ _ = (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) := hsplit' -+ _ = divisorPartialProduct m f fiber z * divisorComplementPartialProduct m f z₀ s z := by -+ simp [hP, hnotP, fiber] -+ -+end Complex.Hadamard -+end HadamardSourceScope10 -+ -+section HadamardSourceScope11 -+ -+noncomputable section -+ -+open _root_.Complex _root_.Erdos970.Complex Filter _root_.Function Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+theorem analyticOrderAt_finset_prod_weierstrassFactor_divisorZeroIndex₀ -+ (m : ℕ) (f : ℂ → ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z₀ : ℂ) : -+ analyticOrderAt (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ z₀ = ((s.filter (fun p => divisorZeroIndex₀Val p = z₀)).card : ℕ∞) := by -+ classical -+ refine Finset.induction_on s ?base ?step -+ · simp [analyticOrderAt_eq_zero] -+ · intro p s hp hs -+ by_cases hEq : divisorZeroIndex₀Val p = z₀ -+ · have hp0 : divisorZeroIndex₀Val p ≠ 0 := p.property -+ have han_fac : -+ AnalyticAt ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) z₀ := by -+ exact (differentiable_weierstrassFactor_divisorZeroIndex₀ m p).analyticAt z₀ -+ have han_rest : AnalyticAt ℂ (fun z : ℂ => ∏ q ∈ s, weierstrassFactor m -+ (z / divisorZeroIndex₀Val q)) z₀ := by -+ simpa [divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ -+ let fac : ℂ → ℂ := fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ let rest : ℂ → ℂ := fun z : ℂ => ∏ q ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val q) -+ have hmul : -+ analyticOrderAt (fac * rest) z₀ = -+ analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := by -+ simpa [fac, rest] using (analyticOrderAt_mul (z₀ := z₀) han_fac han_rest) -+ have hcard : -+ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) (insert p s)).card = -+ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) s).card + 1 := by -+ simp [hEq, hp, Finset.filter_insert] -+ have hfac : analyticOrderAt fac z₀ = (1 : ℕ∞) := by -+ simpa [fac, hEq] using -+ (analyticOrderAt_weierstrassFactor_div_self (m := m) (a := divisorZeroIndex₀Val p) hp0) -+ have hrest : analyticOrderAt rest z₀ = ((s.filter -+ (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simpa [rest] using hs -+ have hcongr : -+ (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m (z / divisorZeroIndex₀Val q)) -+ =ᶠ[𝓝 z₀] (fac * rest) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ simp [fac, rest, Finset.prod_insert, hp, Pi.mul_apply] -+ calc -+ analyticOrderAt (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m -+ (z / divisorZeroIndex₀Val q)) z₀ = analyticOrderAt (fac * rest) z₀ := by -+ simpa using (analyticOrderAt_congr hcongr) -+ _ = analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := hmul -+ _ = (1 : ℕ∞) + ((s.filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simp [hfac, hrest] -+ _ = (((insert p s).filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simp [hcard, Nat.add_comm] -+ · have han_fac : -+ AnalyticAt ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) z₀ := by -+ exact (differentiable_weierstrassFactor_divisorZeroIndex₀ m p).analyticAt z₀ -+ have hfac0 : analyticOrderAt (fun z : ℂ => weierstrassFactor m -+ (z / divisorZeroIndex₀Val p)) z₀ = 0 := by -+ have hp0 : divisorZeroIndex₀Val p ≠ 0 := p.property -+ have hval : weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ≠ 0 := by -+ have : (z₀ / divisorZeroIndex₀Val p) ≠ 1 := by -+ intro h1 -+ have : z₀ = divisorZeroIndex₀Val p := by -+ have : z₀ = (z₀ / divisorZeroIndex₀Val p) * (divisorZeroIndex₀Val p) := by -+ simp [div_eq_mul_inv] -+ simpa [h1, div_eq_mul_inv, hp0] using this -+ exact hEq (this.symm) -+ exact (weierstrassFactor_ne_zero_iff m (z₀ / divisorZeroIndex₀Val p)).2 this -+ simpa using (han_fac.analyticOrderAt_eq_zero).2 (by simpa using hval) -+ have hcard : -+ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) (insert p s)).card = -+ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) s).card := by -+ simp [hEq, Finset.filter_insert] -+ have han_rest : AnalyticAt ℂ (fun z : ℂ => ∏ q ∈ s, weierstrassFactor m -+ (z / divisorZeroIndex₀Val q)) z₀ := by -+ simpa [divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ -+ let fac : ℂ → ℂ := fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ let rest : ℂ → ℂ := fun z : ℂ => ∏ q ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val q) -+ have hmul : -+ analyticOrderAt (fac * rest) z₀ = -+ analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := by -+ simpa [fac, rest] using (analyticOrderAt_mul (z₀ := z₀) han_fac han_rest) -+ have hcongr : -+ (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m (z / divisorZeroIndex₀Val q)) -+ =ᶠ[𝓝 z₀] (fac * rest) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ simp [fac, rest, Finset.prod_insert, hp, Pi.mul_apply] -+ calc -+ analyticOrderAt (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m -+ (z / divisorZeroIndex₀Val q)) z₀ -+ = analyticOrderAt (fac * rest) z₀ := by -+ simpa using (analyticOrderAt_congr hcongr) -+ _ = analyticOrderAt rest z₀ := by -+ calc -+ analyticOrderAt (fac * rest) z₀ = analyticOrderAt fac z₀ + -+ analyticOrderAt rest z₀ := hmul -+ _ = analyticOrderAt rest z₀ := by -+ have hfac0' : analyticOrderAt fac z₀ = 0 := by -+ simpa [fac] using hfac0 -+ simp [hfac0'] -+ _ = ((s.filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simpa [rest] using hs -+ _ = (((insert p s).filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simpa using congrArg (fun n : ℕ => (n : ℕ∞)) hcard.symm -+ -+theorem analyticOrderAt_partialProduct_eq_fiberCard_of_subset -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : -+ analyticOrderAt -+ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ z₀ = ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by -+ have h := -+ analyticOrderAt_finset_prod_weierstrassFactor_divisorZeroIndex₀ -+ (m := m) (f := f) (s := s) (z₀ := z₀) -+ have hfilter : -+ s.filter (fun p => divisorZeroIndex₀Val p = z₀) = -+ divisorZeroIndex₀FiberFinset (f := f) z₀ := by -+ ext p -+ constructor -+ · intro hp' -+ have hpv : divisorZeroIndex₀Val p = z₀ := (Finset.mem_filter.mp hp').2 -+ simpa [mem_divisorZeroIndex₀FiberFinset] using hpv -+ · intro hp_fiber -+ have hpv : divisorZeroIndex₀Val p = z₀ := -+ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hp_fiber -+ have hps : p ∈ s := hs (by simpa [mem_divisorZeroIndex₀FiberFinset] using hpv) -+ exact Finset.mem_filter.2 ⟨hps, hpv⟩ -+ simpa [hfilter] using h -+ -+theorem exists_analyticAt_eq_pow_smul_of_partialProduct_contains_fiber -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : -+ ∃ g : ℂ → ℂ, -+ AnalyticAt ℂ g z₀ ∧ g z₀ ≠ 0 ∧ -+ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ =ᶠ[𝓝 z₀] -+ fun z : ℂ => (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card • g z := by -+ let F : ℂ → ℂ := fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ have hF_ana : AnalyticAt ℂ F z₀ := by -+ simpa [F, divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ -+ have hOrder : -+ analyticOrderAt F z₀ = -+ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by -+ simpa [F] using -+ (analyticOrderAt_partialProduct_eq_fiberCard_of_subset (m := m) -+ (f := f) (z₀ := z₀) (s := s) hs) -+ refine (hF_ana.analyticOrderAt_eq_natCast (n := (divisorZeroIndex₀FiberFinset -+ (f := f) z₀).card)).1 ?_ -+ simp [hOrder] -+ -+end Complex.Hadamard -+end -+end HadamardSourceScope11 -+ -+section HadamardSourceScope12 -+ -+open Filter _root_.Function _root_.Complex _root_.Erdos970.Complex Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+theorem tendstoLocallyUniformlyOn_divisorPartialProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ Filter.atTop -+ (Set.univ : Set ℂ) := by -+ have hprod : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ (Set.univ : Set ℂ) := -+ hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ simpa [HasProdLocallyUniformlyOn, divisorPartialProduct] using! hprod -+ -+theorem tendstoUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) (k : ℕ) {K : Set ℂ} (hK : IsCompact K) (hKz : ∀ z ∈ K, z ≠ z₀) : -+ TendstoUniformlyOn -+ (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ k) -+ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) -+ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) -+ K := by -+ have hloc : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ Filter.atTop -+ K := -+ (tendstoLocallyUniformlyOn_divisorPartialProduct_univ (m := m) (f := f) h_sum).mono -+ (by intro z hz; simp) -+ have hunif : -+ TendstoUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ Filter.atTop -+ K := -+ (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact hK).1 hloc -+ let h : ℂ → ℂ := fun z => ((z - z₀) ^ k)⁻¹ -+ have hh : ∃ C, ∀ z ∈ K, ‖h z‖ ≤ C := by -+ have hcont : ContinuousOn h K := by -+ have hpow : ContinuousOn (fun z : ℂ => (z - z₀) ^ k) K := by -+ fun_prop -+ refine hpow.inv₀ ?_ -+ intro z hz -+ have hz0 : z - z₀ ≠ 0 := sub_ne_zero.mpr (hKz z hz) -+ exact pow_ne_zero k hz0 -+ have hKimg : IsCompact (h '' K) := hK.image_of_continuousOn hcont -+ rcases (isBounded_iff_forall_norm_le.1 hKimg.isBounded) with ⟨C, hC⟩ -+ refine ⟨C, ?_⟩ -+ intro z hz -+ exact hC (h z) ⟨z, hz, rfl⟩ -+ have hunif' := -+ (TendstoUniformlyOn.mul_left_bounded (p := (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f -+ (Set.univ : Set ℂ))))) -+ (K := K) -+ (F := fun s z => divisorPartialProduct m f s z) -+ (f := fun z => divisorCanonicalProduct m f (Set.univ : Set ℂ) z) -+ (h := h) -+ hunif hh) -+ simpa [h, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hunif' -+ -+theorem tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) (k : ℕ) : -+ TendstoLocallyUniformlyOn -+ (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ k) -+ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) -+ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) -+ ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hopen : IsOpen ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hset : ((Set.univ : Set ℂ) \ {z₀}) = ({z₀} : Set ℂ)ᶜ := by -+ ext z -+ simp -+ simp [hset] -+ refine (tendstoLocallyUniformlyOn_iff_forall_isCompact hopen).2 ?_ -+ intro K hKsub hK -+ have hKz : ∀ z ∈ K, z ≠ z₀ := by -+ intro z hzK -+ have : z ∈ (Set.univ : Set ℂ) \ {z₀} := hKsub hzK -+ exact by simpa [Set.mem_sdiff, Set.mem_singleton_iff] using this.2 -+ exact tendstoUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m := m) (f := f) h_sum (z₀ := z₀) (k := k) (hK := hK) hKz -+ -+open Filter -+ -+theorem exists_ball_eq_divisorCanonicalProduct_div_pow_eq -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : -+ ∃ ε > 0, ∃ u : ℂ → ℂ, AnalyticAt ℂ u z₀ ∧ -+ u z₀ ≠ 0 ∧ -+ ∀ z : ℂ, z ∈ Metric.ball z₀ ε → z ≠ z₀ → -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = -+ (divisorComplementCanonicalProduct m f z₀ z) * u z := by -+ let fiber : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ have hfib : ∃ u : ℂ → ℂ, AnalyticAt ℂ u z₀ ∧ u z₀ ≠ 0 ∧ -+ (fun z : ℂ => divisorPartialProduct m f fiber z) =ᶠ[𝓝 z₀] -+ fun z : ℂ => (z - z₀) ^ fiber.card • u z := by -+ simpa [fiber, divisorPartialProduct] using -+ (exists_analyticAt_eq_pow_smul_of_partialProduct_contains_fiber (m := m) (f := f) (z₀ := z₀) -+ (s := fiber) (by rfl : fiber ⊆ fiber)) -+ rcases hfib with ⟨u, huA, hu0, huEq⟩ -+ have hmem : {z : ℂ | divisorPartialProduct m f fiber z = -+ (z - z₀) ^ fiber.card • u z} ∈ 𝓝 z₀ := huEq -+ rcases Metric.mem_nhds_iff.1 hmem with ⟨ε, hε, hball⟩ -+ refine ⟨ε, hε, u, huA, hu0, ?_⟩ -+ have hq : -+ TendstoLocallyUniformlyOn (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) -+ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ fiber.card) -+ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) -+ ((Set.univ : Set ℂ) \ {z₀}) := -+ tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) (k := fiber.card) -+ have hcomp : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ divisorComplementPartialProduct m f z₀ s) -+ (divisorComplementCanonicalProduct m f z₀) -+ Filter.atTop -+ (Set.univ : Set ℂ) := -+ tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ (m := m) (f := f) -+ (z₀ := z₀) h_sum -+ intro z hz hzne -+ have hz' : z ∈ ((Set.univ : Set ℂ) \ {z₀}) := by -+ refine ⟨by simp, ?_⟩ -+ simpa [Set.mem_singleton_iff] using hzne -+ have hF : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) (Filter.atTop : Filter _) -+ (𝓝 ((divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ fiber.card)) := -+ hq.tendsto_at hz' -+ have hG0 : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ divisorComplementPartialProduct m f z₀ s z) (Filter.atTop : Filter _) -+ (𝓝 (divisorComplementCanonicalProduct m f z₀ z)) := -+ hcomp.tendsto_at (by simp : z ∈ (Set.univ : Set ℂ)) -+ have hG : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ (divisorComplementPartialProduct m f z₀ s z) * u z) (Filter.atTop : Filter _) -+ (𝓝 ((divisorComplementCanonicalProduct m f z₀ z) * u z)) := -+ (hG0.mul tendsto_const_nhds) -+ have hsub : ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), -+ fiber ⊆ s := eventually_atTop_subset_fiberFinset (f := f) z₀ -+ have heq_eventually : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), -+ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card -+ = (divisorComplementPartialProduct m f z₀ s z) * u z := by -+ filter_upwards [hsub] with s hs -+ have hsplit : -+ divisorPartialProduct m f s z = -+ divisorPartialProduct m f fiber z * divisorComplementPartialProduct m f z₀ s z := by -+ simpa [fiber] using -+ (divisorPartialProduct_eq_fiber_mul_complement_of_subset (m := m) (f := f) (z₀ := z₀) -+ (z := z) (s := s) hs) -+ have hfibz : -+ divisorPartialProduct m f fiber z = (z - z₀) ^ fiber.card • u z := by -+ exact hball hz -+ have hzpow : (z - z₀) ^ fiber.card ≠ 0 := -+ pow_ne_zero _ (sub_ne_zero.mpr hzne) -+ set a : ℂ := (z - z₀) ^ fiber.card -+ have ha : a ≠ 0 := by simpa [a] using hzpow -+ set c : ℂ := divisorComplementPartialProduct m f z₀ s z with hc -+ rw [hsplit, hfibz, smul_eq_mul] -+ calc -+ ((a * u z) * c) / a -+ = (a * (u z * c)) / a := by simp [mul_assoc] -+ _ = u z * c := by -+ simpa [mul_assoc] using (mul_div_cancel_left₀ (u z * c) ha) -+ _ = c * u z := by ac_rfl -+ _ = (divisorComplementPartialProduct m f z₀ s z) * u z := by -+ simp [c] -+ have hG' : -+ Tendsto -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) -+ (Filter.atTop : Filter _) -+ (𝓝 ((divisorComplementCanonicalProduct m f z₀ z) * u z)) := by -+ have heq' : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), -+ (divisorComplementPartialProduct m f z₀ s z) * u z -+ = (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card := by -+ filter_upwards [heq_eventually] with s hs -+ exact hs.symm -+ exact (hG.congr' heq') -+ exact tendsto_nhds_unique hF hG' -+ -+theorem bddAbove_norm_divisorCanonicalProduct_div_pow_puncturedBall -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : ∃ r > 0, BddAbove (norm ∘ (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) '' -+ ((Metric.ball z₀ r) \ {z₀})) := by -+ rcases exists_ball_eq_divisorCanonicalProduct_div_pow_eq (m := m) (f := f) (h_sum := h_sum) -+ (z₀ := z₀) with ⟨ε, hε, u, huA, hu0, hEq⟩ -+ have huC : ContinuousAt u z₀ := huA.continuousAt -+ have hpre : {z : ℂ | ‖u z - u z₀‖ < 1} ∈ 𝓝 z₀ := by -+ have : u ⁻¹' Metric.ball (u z₀) (1 : ℝ) ∈ 𝓝 z₀ := -+ huC.preimage_mem_nhds (Metric.ball_mem_nhds (u z₀) (by norm_num)) -+ simpa [Metric.ball, dist_eq_norm, Set.preimage] using this -+ rcases Metric.mem_nhds_iff.1 hpre with ⟨r0, hr0pos, hr0sub⟩ -+ set r : ℝ := min (ε / 2) r0 -+ have hrpos : 0 < r := lt_min (by nlinarith [hε]) hr0pos -+ have hr_lt_ε : r < ε := lt_of_le_of_lt (min_le_left _ _) (by nlinarith [hε]) -+ have huBound : ∀ z ∈ Metric.ball z₀ r, ‖u z‖ ≤ ‖u z₀‖ + 1 := by -+ intro z hz -+ have hz0 : z ∈ Metric.ball z₀ r0 := by -+ have : r ≤ r0 := min_le_right _ _ -+ exact Metric.ball_subset_ball this hz -+ have hdiff : ‖u z - u z₀‖ < 1 := hr0sub hz0 -+ have htri : ‖u z‖ ≤ ‖u z - u z₀‖ + ‖u z₀‖ := by -+ simpa [sub_eq_add_neg, add_assoc] using -+ (norm_add_le (u z - u z₀) (u z₀)) -+ have : ‖u z‖ ≤ 1 + ‖u z₀‖ := le_trans htri (by nlinarith [le_of_lt hdiff]) -+ nlinarith [this] -+ have hdiffC : -+ DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) (Set.univ : Set ℂ) := -+ differentiableOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) h_sum -+ have hcontC : ContinuousOn (divisorComplementCanonicalProduct m f z₀) (Metric.closedBall z₀ r) := -+ (hdiffC.continuousOn).mono (by intro z hz; simp) -+ have hK : IsCompact (Metric.closedBall z₀ r) := isCompact_closedBall _ _ -+ rcases (isBounded_iff_forall_norm_le.1 (hK.image_of_continuousOn hcontC).isBounded) with ⟨C, hC⟩ -+ refine ⟨r, hrpos, ⟨C * (‖u z₀‖ + 1), ?_⟩⟩ -+ rintro _ ⟨z, hzset, rfl⟩ -+ rcases hzset with ⟨hzr, hzne⟩ -+ have hz_in_ε : z ∈ Metric.ball z₀ ε := Metric.ball_subset_ball hr_lt_ε.le hzr -+ have hz_ne : z ≠ z₀ := by simpa [Set.mem_singleton_iff] using hzne -+ have hq : -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card -+ = divisorComplementCanonicalProduct m f z₀ z * u z := -+ hEq z hz_in_ε hz_ne -+ have hCz : ‖divisorComplementCanonicalProduct m f z₀ z‖ ≤ C := by -+ have hzK : z ∈ Metric.closedBall z₀ r := Metric.mem_closedBall.2 (le_of_lt hzr) -+ exact hC _ ⟨z, hzK, rfl⟩ -+ have huZ : ‖u z‖ ≤ ‖u z₀‖ + 1 := huBound z hzr -+ have hCnonneg : 0 ≤ C := le_trans (norm_nonneg _) hCz -+ have hmul : ‖divisorComplementCanonicalProduct m f z₀ z * u z‖ ≤ C * (‖u z₀‖ + 1) := by -+ calc -+ ‖divisorComplementCanonicalProduct m f z₀ z * u z‖ -+ = ‖divisorComplementCanonicalProduct m f z₀ z‖ * ‖u z‖ := by simp -+ _ ≤ C * (‖u z₀‖ + 1) := by -+ exact mul_le_mul hCz huZ (norm_nonneg _) hCnonneg -+ simpa [Function.comp, hq] using hmul -+ -+theorem divisorComplementCanonicalProduct_ne_zero_at -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ divisorComplementCanonicalProduct m f z₀ z₀ ≠ 0 := by -+ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := -+ fun p => if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) -+ else weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := fun p => Φ p - 1 -+ have hΦ_ne : ∀ p, Φ p ≠ 0 := by -+ intro p -+ by_cases hp : divisorZeroIndex₀Val p = z₀ -+ · simp [Φ, hp] -+ · have hval : divisorZeroIndex₀Val p ≠ z₀ := hp -+ have hz : z₀ / divisorZeroIndex₀Val p ≠ (1 : ℂ) := by -+ intro h -+ by_cases hp0 : divisorZeroIndex₀Val p = 0 -+ · have : z₀ / divisorZeroIndex₀Val p = (0 : ℂ) := by simp [hp0] -+ have h01 := h -+ rw [this] at h01 -+ exact (show False from (by simpa using (show (0 : ℂ) ≠ (1 : ℂ) from by simp) h01)) -+ · have : z₀ = divisorZeroIndex₀Val p := (div_eq_one_iff_eq hp0).1 h -+ exact hval this.symm -+ have hE : weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ≠ 0 := by -+ intro h0 -+ have : z₀ / divisorZeroIndex₀Val p = (1 : ℂ) := -+ (weierstrassFactor_eq_zero_iff (m := m) (z := z₀ / divisorZeroIndex₀Val p)).1 h0 -+ exact hz this -+ simp [Φ, hp, hE] -+ have hz0_le : ‖z₀‖ ≤ max ‖z₀‖ 1 := le_max_left _ _ -+ set R : ℝ := max ‖z₀‖ 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) -+ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) -+ have h_big : -+ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, -+ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by -+ have hfin : ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ -+ 2 * R} : Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this -+ have := hfin.eventually_cofinite_notMem -+ filter_upwards [this] with p hp -+ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp -+ exact lt_of_not_ge this -+ have hBound : -+ ∀ᶠ p in Filter.cofinite, ‖a p‖ ≤ u p := by -+ filter_upwards [h_big] with p hp -+ have ha_pos : 0 < ‖divisorZeroIndex₀Val p‖ := lt_trans (by nlinarith [hRpos]) hp -+ have hz_div : ‖z₀ / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by -+ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hRpos] -+ have hinv : ‖divisorZeroIndex₀Val p‖⁻¹ < (2 * R)⁻¹ := by -+ simpa [one_div] using (one_div_lt_one_div_of_lt h2R_pos hp) -+ have hmul_le : ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ ≤ R * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ refine mul_le_mul_of_nonneg_right ?_ (inv_nonneg.2 (norm_nonneg _)) -+ exact hz0_le -+ have hmul_lt : R * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := -+ mul_lt_mul_of_pos_left hinv hRpos -+ have hlt : ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := -+ lt_of_le_of_lt hmul_le hmul_lt -+ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by -+ have hRne : (R : ℝ) ≠ 0 := hRpos.ne' -+ have : R * (2 * R)⁻¹ = R / (2 * R) := by simp [div_eq_mul_inv] -+ rw [this] -+ field_simp [hRne] -+ have hnorm : ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ have hzlt : ‖z₀ / divisorZeroIndex₀Val p‖ < (1 / 2 : ℝ) := by -+ calc -+ ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := hnorm -+ _ < R * (2 * R)⁻¹ := hlt -+ _ = (1 / 2 : ℝ) := hRhalf -+ exact le_of_lt hzlt -+ have hE : -+ ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ ≤ -+ 4 * ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) := -+ weierstrassFactor_sub_one_pow_bound (m := m) (z := z₀ / divisorZeroIndex₀Val p) hz_div -+ have hz_pow : -+ ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ -+ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ have : ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ rw [this] -+ have : (‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = -+ ‖z₀‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ simp [mul_pow] -+ rw [this] -+ have hzle_pow : ‖z₀‖ ^ (m + 1) ≤ R ^ (m + 1) := -+ pow_le_pow_left₀ (norm_nonneg z₀) hz0_le (m + 1) -+ gcongr -+ have hp_ne : divisorZeroIndex₀Val p ≠ z₀ := by -+ intro h -+ have : ‖divisorZeroIndex₀Val p‖ ≤ R := by -+ simp [h, R] -+ exact (not_lt_of_ge this) (lt_trans (by nlinarith [hRpos]) hp) -+ have ha : ‖a p‖ = ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ := by -+ simp [a, Φ, hp_ne, sub_eq_add_neg] -+ calc -+ ‖a p‖ = ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ := ha -+ _ ≤ 4 * ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) := by -+ simpa [sub_eq_add_neg, add_comm] using hE -+ _ ≤ 4 * (R ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) := by -+ gcongr -+ _ = u p := by -+ simp [u, mul_assoc, mul_comm] -+ have hsum_norm : Summable (fun p => ‖a p‖) := by -+ refine (Summable.of_norm_bounded_eventually (E := ℝ) (f := fun p => ‖a p‖) (g := u) hu ?_) -+ filter_upwards [hBound] with p hp -+ simpa [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg (a p))] using hp -+ have htprod_ne : -+ (∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (1 + a p)) ≠ 0 := -+ tprod_one_add_ne_zero_of_summable (R := ℂ) (f := a) (hf := fun p => by -+ simpa [a, Φ, add_sub_cancel] using hΦ_ne p) hsum_norm -+ have : (∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (1 + a p)) = -+ divisorComplementCanonicalProduct m f z₀ z₀ := by -+ simp [a, Φ, divisorComplementCanonicalProduct, divisorComplementFactor_def] -+ exact by -+ intro h0 -+ exact htprod_ne (by simpa [this] using h0) -+ -+end Complex.Hadamard -+end HadamardSourceScope12 -+ -+section HadamardSourceScope13 -+ -+open Filter _root_.Function _root_.Complex _root_.Erdos970.Complex Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+theorem differentiableOn_divisorPartialProduct_div_pow_sub -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) (k : ℕ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : -+ DifferentiableOn ℂ (fun z : ℂ => (divisorPartialProduct m f s z) / (z - z₀) ^ k) -+ ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hdiff_prod : DifferentiableOn ℂ (divisorPartialProduct m f s) (Set.univ : Set ℂ) := by -+ exact (differentiable_divisorPartialProduct m f s).differentiableOn -+ have hdiff_den : DifferentiableOn ℂ (fun z : ℂ => (z - z₀) ^ k) ((Set.univ : Set ℂ) \ {z₀}) := by -+ have : Differentiable ℂ (fun z : ℂ => (z - z₀) ^ k) := by -+ fun_prop -+ exact this.differentiableOn -+ by_cases hk : k = 0 -+ · subst hk -+ simpa [pow_zero] using! (hdiff_prod.mono (by intro z hz; exact hz.1)) -+ · have hne : ∀ z ∈ ((Set.univ : Set ℂ) \ {z₀}), (fun z : ℂ => (z - z₀) ^ k) z ≠ 0 := by -+ intro z hz -+ have hz' : z ≠ z₀ := by -+ simpa [Set.mem_sdiff, Set.mem_singleton_iff] using hz.2 -+ exact pow_ne_zero _ (sub_ne_zero.mpr hz') -+ have hdiff_inv : -+ DifferentiableOn ℂ (fun z : ℂ => ((z - z₀) ^ k)⁻¹) ((Set.univ : Set ℂ) \ {z₀}) := -+ hdiff_den.inv hne -+ simpa [div_eq_mul_inv] using! (hdiff_prod.mono (by intro z hz; exact hz.1)).mul hdiff_inv -+ -+theorem differentiableOn_divisorCanonicalProduct_div_pow_sub -+ (m : ℕ) (f : ℂ → ℂ) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) (k : ℕ) : DifferentiableOn ℂ -+ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) -+ ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hopen : IsOpen ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hset : ((Set.univ : Set ℂ) \ {z₀}) = ({z₀} : Set ℂ)ᶜ := by -+ ext z; simp -+ simp [hset] -+ have hconv := -+ tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m := m) (f := f) h_sum (z₀ := z₀) (k := k) -+ refine hconv.differentiableOn ?_ hopen -+ refine Filter.Eventually.of_forall ?_ -+ intro s -+ exact differentiableOn_divisorPartialProduct_div_pow_sub (m := m) (f := f) (z₀ := z₀) (k := k) s -+ -+theorem differentiableOn_update_limUnder_divisorCanonicalProduct_div_pow -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : ∃ r > 0, DifferentiableOn ℂ (Function.update -+ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) z₀ -+ (limUnder (𝓝[≠] z₀) (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card))) -+ (Metric.ball z₀ r) := by -+ rcases bddAbove_norm_divisorCanonicalProduct_div_pow_puncturedBall (m := m) (f := f) -+ (h_sum := h_sum) (z₀ := z₀) with ⟨r, hrpos, hbdd⟩ -+ refine ⟨r, hrpos, ?_⟩ -+ have hnhds : Metric.ball z₀ r ∈ 𝓝 z₀ := Metric.ball_mem_nhds z₀ hrpos -+ have hdiff : DifferentiableOn ℂ (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ ((Metric.ball z₀ r) \ {z₀}) := by -+ have hglob := -+ differentiableOn_divisorCanonicalProduct_div_pow_sub -+ (m := m) (f := f) h_sum (z₀ := z₀) -+ (k := (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ refine hglob.mono ?_ -+ intro z hz -+ exact ⟨by simp, hz.2⟩ -+ have hb : BddAbove (norm ∘ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) '' -+ ((Metric.ball z₀ r) \ {z₀})) := hbdd -+ simpa using -+ (Complex.differentiableOn_update_limUnder_of_bddAbove (f := fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ (s := Metric.ball z₀ r) (c := z₀) hnhds hdiff hb) -+ -+theorem analyticAt_update_limUnder_divisorCanonicalProduct_div_pow -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : AnalyticAt ℂ (Function.update (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) z₀ -+ (limUnder (𝓝[≠] z₀) (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card))) -+ z₀ := by -+ rcases -+ differentiableOn_update_limUnder_divisorCanonicalProduct_div_pow -+ (m := m) (f := f) h_sum (z₀ := z₀) with ⟨r, hrpos, hdiff⟩ -+ let g : ℂ → ℂ := -+ Function.update -+ (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ z₀ -+ (limUnder (𝓝[≠] z₀) fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ have hcont : ContinuousAt g z₀ := -+ (hdiff.differentiableAt (Metric.ball_mem_nhds z₀ hrpos)).continuousAt -+ have hd : -+ ∀ᶠ z in 𝓝[≠] z₀, DifferentiableAt ℂ g z := by -+ have hballWithin : Metric.ball z₀ r ∈ 𝓝[≠] z₀ := by -+ refine mem_nhdsWithin_iff_exists_mem_nhds_inter.2 ?_ -+ refine ⟨Metric.ball z₀ r, Metric.ball_mem_nhds z₀ hrpos, ?_⟩ -+ intro z hz -+ exact hz.1 -+ filter_upwards [hballWithin] with z hz -+ exact (hdiff z hz).differentiableAt (Metric.isOpen_ball.mem_nhds hz) -+ simpa [g] using Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt hd hcont -+ -+theorem exists_analyticAt_divisorCanonicalProduct_quotient -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : -+ ∃ q : ℂ → ℂ, -+ AnalyticAt ℂ q z₀ ∧ -+ q z₀ = -+ limUnder (𝓝[≠] z₀) (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ∧ -+ ∀ z : ℂ, z ≠ z₀ → -+ q z = -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by -+ let q : ℂ → ℂ := -+ Function.update -+ (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ z₀ -+ (limUnder (𝓝[≠] z₀) fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ refine ⟨q, ?_, ?_, ?_⟩ -+ · simpa [q] using -+ analyticAt_update_limUnder_divisorCanonicalProduct_div_pow -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) -+ · simp [q] -+ · intro z hz -+ simp [q, Function.update_of_ne hz] -+ -+theorem analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by -+ set k : ℕ := (divisorZeroIndex₀FiberFinset (f := f) z₀).card -+ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) -+ let q0 : ℂ → ℂ := fun z => F z / (z - z₀) ^ k -+ rcases exists_analyticAt_divisorCanonicalProduct_quotient -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) with -+ ⟨q, hqA, hq_self, hq_ne⟩ -+ have hdiff_univ : DifferentiableOn ℂ F (Set.univ : Set ℂ) := -+ differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ have han : AnalyticAt ℂ F z₀ := by -+ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ have : DifferentiableWithinAt ℂ F (Set.univ : Set ℂ) z := hdiff_univ z (by simp) -+ exact this.differentiableAt (by simp) -+ rcases -+ exists_ball_eq_divisorCanonicalProduct_div_pow_eq (m := m) (f := f) (h_sum := h_sum) -+ (z₀ := z₀) -+ with ⟨ε, hε, u, huA, hu0, hEq⟩ -+ let g : ℂ → ℂ := fun z => (divisorComplementCanonicalProduct m f z₀ z) * u z -+ have hcompDiff : DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) -+ (Set.univ : Set ℂ) := -+ differentiableOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) h_sum -+ have hcompCont : ContinuousAt (divisorComplementCanonicalProduct m f z₀) z₀ := -+ (hcompDiff z₀ (by simp)).differentiableAt (by simp) |>.continuousAt -+ have hgCont : ContinuousAt g z₀ := (hcompCont.mul huA.continuousAt) -+ have hg0 : g z₀ ≠ 0 := by -+ have hcomp0 : divisorComplementCanonicalProduct m f z₀ z₀ ≠ 0 := -+ divisorComplementCanonicalProduct_ne_zero_at (m := m) (f := f) (z₀ := z₀) h_sum -+ exact mul_ne_zero hcomp0 hu0 -+ have hne_mem : ∀ᶠ z in 𝓝[≠] z₀, z ∈ (({z₀} : Set ℂ)ᶜ) := -+ Filter.eventually_of_mem -+ (self_mem_nhdsWithin : (({z₀} : Set ℂ)ᶜ) ∈ 𝓝[≠] z₀) (fun _ hz => hz) -+ have hne : ∀ᶠ z in 𝓝[≠] z₀, z ≠ z₀ := by -+ filter_upwards [hne_mem] with z hz -+ simpa [Set.mem_compl_singleton_iff] using hz -+ have ht_q0 : Tendsto q0 (𝓝[≠] z₀) (𝓝 (g z₀)) := by -+ have hball : ∀ᶠ z in 𝓝[≠] z₀, z ∈ Metric.ball z₀ ε := -+ Filter.eventually_of_mem -+ (mem_nhdsWithin_of_mem_nhds (Metric.ball_mem_nhds z₀ hε)) (fun _ hz => hz) -+ have heq : q0 =ᶠ[𝓝[≠] z₀] g := by -+ filter_upwards [hball, hne] with z hz hzne -+ have hq := hEq z hz hzne -+ simpa [q0, F, k, g, smul_eq_mul] using hq -+ exact (hgCont.continuousWithinAt.tendsto.congr' heq.symm) -+ have hlim : limUnder (𝓝[≠] z₀) q0 = g z₀ := ht_q0.limUnder_eq -+ have hq0 : q z₀ ≠ 0 := by -+ have hq_self' : q z₀ = limUnder (𝓝[≠] z₀) q0 := by -+ simpa [q0, F, k] using hq_self -+ have : q z₀ = g z₀ := hq_self'.trans hlim -+ exact this.symm ▸ hg0 -+ have heq_punct : (fun z : ℂ => F z) =ᶠ[𝓝[≠] z₀] fun z : ℂ => (z - z₀) ^ k • q z := by -+ filter_upwards [hne] with z hz -+ have hzpow : (z - z₀) ^ k ≠ 0 := pow_ne_zero _ (sub_ne_zero.mpr hz) -+ have hq : q z = q0 z := by simpa [q0, F, k] using hq_ne z hz -+ have hmul : (z - z₀) ^ k * q0 z = F z := by -+ calc -+ (z - z₀) ^ k * q0 z -+ = (((z - z₀) ^ k) * F z) / ((z - z₀) ^ k) := by -+ simp [q0, div_eq_mul_inv, mul_assoc] -+ _ = F z := by -+ simpa [mul_assoc] using (mul_div_cancel_left₀ (F z) hzpow) -+ have : F z = (z - z₀) ^ k * q z := by -+ calc -+ F z = (z - z₀) ^ k * q0 z := hmul.symm -+ _ = (z - z₀) ^ k * q z := by simp [hq] -+ simpa [smul_eq_mul] using this -+ have hcontF : ContinuousAt F z₀ := -+ (hdiff_univ z₀ (by simp)).differentiableAt (by simp) |>.continuousAt -+ have hcontq : ContinuousAt q z₀ := hqA.continuousAt -+ have h_at_z0 : F z₀ = (z₀ - z₀) ^ k • q z₀ := by -+ have ht1 : Tendsto F (𝓝[≠] z₀) (𝓝 (F z₀)) := hcontF.continuousWithinAt.tendsto -+ have hpow : -+ Tendsto (fun z : ℂ => (z - z₀) ^ k) (𝓝[≠] z₀) (𝓝 ((z₀ - z₀) ^ k)) := -+ ((continuousAt_id.sub continuousAt_const).pow k).continuousWithinAt.tendsto -+ have ht2 : -+ Tendsto (fun z : ℂ => (z - z₀) ^ k • q z) (𝓝[≠] z₀) -+ (𝓝 ((z₀ - z₀) ^ k • q z₀)) := -+ hpow.mul (hcontq.continuousWithinAt.tendsto) -+ have ht2' : Tendsto F (𝓝[≠] z₀) (𝓝 ((z₀ - z₀) ^ k • q z₀)) := -+ ht2.congr' heq_punct.symm -+ exact tendsto_nhds_unique ht1 ht2' -+ have hfac : ∀ᶠ z in 𝓝 z₀, F z = (z - z₀) ^ k • q z := by -+ have hball1 : Metric.ball z₀ 1 ∈ 𝓝 z₀ := Metric.ball_mem_nhds z₀ (by norm_num) -+ have hball1' : ∀ᶠ z in 𝓝 z₀, z ∈ Metric.ball z₀ 1 := -+ Filter.eventually_of_mem hball1 (fun _ hz => hz) -+ filter_upwards [hball1'] with z _hz -+ by_cases hz0 : z = z₀ -+ · subst hz0 -+ simpa using h_at_z0 -+ · have hzpow : (z - z₀) ^ k ≠ 0 := pow_ne_zero _ (sub_ne_zero.mpr hz0) -+ have hq : q z = q0 z := by simpa [q0, F, k] using hq_ne z hz0 -+ have hmul : (z - z₀) ^ k * q0 z = F z := by -+ calc -+ (z - z₀) ^ k * q0 z -+ = (((z - z₀) ^ k) * F z) / ((z - z₀) ^ k) := by -+ simp [q0, div_eq_mul_inv, mul_assoc] -+ _ = F z := by -+ simpa [mul_assoc] using (mul_div_cancel_left₀ (F z) hzpow) -+ have : F z = (z - z₀) ^ k * q z := by -+ calc -+ F z = (z - z₀) ^ k * q0 z := hmul.symm -+ _ = (z - z₀) ^ k * q z := by simp [hq] -+ simpa [smul_eq_mul] using this -+ have hk' : analyticOrderAt F z₀ = k := -+ (han.analyticOrderAt_eq_natCast (n := k)).2 ⟨q, hqA, hq0, hfac⟩ -+ have hkNat : analyticOrderNatAt F z₀ = k := by -+ simp [analyticOrderNatAt, hk'] -+ simpa [F, k] using hkNat -+ -+theorem analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = -+ analyticOrderNatAt f z₀ := by -+ have hcp : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := -+ analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card (m := m) (f := f) (h_sum := h_sum) -+ (z₀ := z₀) -+ have hfib : -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = analyticOrderNatAt f z₀ := -+ divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt (hf := hf) (z₀ := z₀) hz₀ -+ simpa [hfib] using hcp -+ -+end Complex.Hadamard -+end HadamardSourceScope13 -+ -+section HadamardSourceScope14 -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+open scoped Topology -+open Set -+ -+lemma analyticOrderAt_ne_top_of_exists_ne_zero {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (hnot : ∃ z : ℂ, f z ≠ 0) : -+ ∀ z : ℂ, analyticOrderAt f z ≠ ⊤ := by -+ rcases hnot with ⟨z1, hz1⟩ -+ have hf_an : AnalyticOnNhd ℂ f (Set.univ : Set ℂ) := by -+ intro z hz -+ exact (Differentiable.analyticAt (f := f) hf z) -+ have hz1_not_top : analyticOrderAt f z1 ≠ ⊤ := by -+ have : analyticOrderAt f z1 = 0 := -+ (hf.analyticAt z1).analyticOrderAt_eq_zero.2 hz1 -+ simp [this] -+ intro z -+ exact AnalyticOnNhd.analyticOrderAt_ne_top_of_isPreconnected (hf := hf_an) -+ (U := (Set.univ : Set ℂ)) (x := z1) (y := z) (by simpa using isPreconnected_univ) -+ (by simp) (by simp) hz1_not_top -+ -+lemma no_zero_on_sphere_of_forall_val_norm_ne -+ {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ {B r : ℝ} (hrpos : 0 < r) (hBr : r ≤ B) (hr_not : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖ ≤ B → r ≠ ‖divisorZeroIndex₀Val p‖) : -+ ∀ u : ℂ, ‖u‖ = r → f u ≠ 0 := by -+ intro u hur -+ have hu0 : u ≠ 0 := by -+ intro hu0 -+ subst hu0 -+ have : (0 : ℝ) = r := by simpa using hur -+ exact (ne_of_gt hrpos) this.symm -+ intro hfu0 -+ have hnotTop : analyticOrderAt f u ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) hf hnot u -+ have hord_ne0 : analyticOrderNatAt f u ≠ 0 := by -+ intro h0 -+ have hEN : (analyticOrderNatAt f u : ENat) = 0 := by simp [h0] -+ have hAt0 : analyticOrderAt f u = 0 := by -+ have hcast : (analyticOrderNatAt f u : ENat) = analyticOrderAt f u := -+ Nat.cast_analyticOrderNatAt (f := f) (z₀ := u) hnotTop -+ simpa [hcast] using hEN -+ have han : AnalyticAt ℂ f u := Differentiable.analyticAt (f := f) hf u -+ exact ((han.analyticOrderAt_eq_zero).1 hAt0) hfu0 -+ have hcard_pos : 0 < (divisorZeroIndex₀FiberFinset (f := f) u).card := by -+ have hcard := -+ divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt (hf := hf) (z₀ := u) hu0 -+ have : 0 < analyticOrderNatAt f u := Nat.pos_of_ne_zero hord_ne0 -+ simpa [hcard] using this -+ rcases Finset.card_pos.mp hcard_pos with ⟨p, hp⟩ -+ have hpval : divisorZeroIndex₀Val p = u := -+ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := u) p).1 hp -+ have hpB : ‖divisorZeroIndex₀Val p‖ ≤ B := by -+ have : ‖divisorZeroIndex₀Val p‖ = r := by simp [hpval, hur] -+ simpa [this] using hBr -+ have : r ≠ ‖divisorZeroIndex₀Val p‖ := hr_not p hpB -+ exact this (by simp [hpval, hur]) -+ -+theorem analyticOrderAt_divisorCanonicalProduct_eq_fiber_card -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = -+ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by -+ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) -+ have hNat : -+ analyticOrderNatAt F z₀ = (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by -+ simpa [F] using -+ (analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀)) -+ have hdiffOn : DifferentiableOn ℂ F (Set.univ : Set ℂ) := by -+ simpa [F] using differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ have hdiff : Differentiable ℂ F := by -+ intro z -+ exact (hdiffOn z (by simp)).differentiableAt (by simp) -+ have hnotTop : analyticOrderAt F z₀ ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hdiff) -+ ⟨0, by simp [F, divisorCanonicalProduct_zero]⟩ z₀ -+ have hcast : (analyticOrderNatAt F z₀ : ℕ∞) = analyticOrderAt F z₀ := -+ Nat.cast_analyticOrderNatAt (f := F) (z₀ := z₀) hnotTop -+ have hNatCast : -+ (analyticOrderNatAt F z₀ : ℕ∞) = -+ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by -+ simp [hNat] -+ simpa [F, hcast] using hNatCast -+ -+theorem divisorCanonicalProduct_ne_zero_of_forall_ne -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ {z : ℂ} (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) z ≠ 0 := by -+ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) -+ have hfiber_empty : divisorZeroIndex₀FiberFinset (f := f) z = ∅ := by -+ ext p -+ constructor -+ · intro hp -+ exact False.elim (hz p ((mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z) p).1 hp).symm) -+ · intro hp -+ simp at hp -+ have horder : -+ analyticOrderAt F z = (0 : ℕ∞) := by -+ have h := -+ analyticOrderAt_divisorCanonicalProduct_eq_fiber_card -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z) -+ simpa [F, hfiber_empty] using h -+ have han : AnalyticAt ℂ F z := by -+ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ -+ refine Filter.Eventually.of_forall ?_ -+ intro w -+ exact (((differentiableOn_divisorCanonicalProduct_univ m f h_sum) w -+ (by simp)).differentiableAt (by simp)) -+ exact (han.analyticOrderAt_eq_zero).1 horder -+ -+theorem logDeriv_divisorCanonicalProduct_one_eq_tsum_of_forall_ne -+ {f : ℂ → ℂ} {z : ℂ} -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) -+ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : -+ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z = -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := -+ logDeriv_divisorCanonicalProduct_one_eq_tsum h_sum hz -+ (divisorCanonicalProduct_ne_zero_of_forall_ne 1 f h_sum hz) -+ -+end Hadamard -+end Complex -+end HadamardSourceScope14 -+ -+section HadamardSourceScope16 -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+open Filter Topology Set _root_.Complex _root_.Erdos970.Complex -+ -+open scoped BigOperators Topology -+ -+noncomputable def hadamardDenom (m : ℕ) (f : ℂ → ℂ) (z : ℂ) : ℂ := -+ z ^ (analyticOrderNatAt f 0) * divisorCanonicalProduct m f (Set.univ : Set ℂ) z -+ -+theorem differentiable_divisorCanonicalProduct_univ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by -+ intro z -+ have hdiffOn : -+ DifferentiableOn ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) (Set.univ : Set ℂ) := -+ differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ exact (hdiffOn z (by simp)).differentiableAt (by simp) -+ -+theorem analyticAt_divisorCanonicalProduct_univ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : -+ AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := -+ (differentiable_divisorCanonicalProduct_univ m f h_sum).analyticAt z -+ -+theorem differentiable_hadamardDenom (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ Differentiable ℂ (hadamardDenom m f) := by -+ have hcprod : Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by -+ exact differentiable_divisorCanonicalProduct_univ m f h_sum -+ simpa [hadamardDenom] using! (differentiable_id.pow (analyticOrderNatAt f 0)).mul hcprod -+ -+theorem hadamardDenom_ne_zero_at {m : ℕ} {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (hnot : ∃ z : ℂ, f z ≠ 0) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) {z : ℂ} (hz : f z ≠ 0) : hadamardDenom m f z ≠ 0 := by -+ have hf_not_top : ∀ w : ℂ, analyticOrderAt f w ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hf) hnot -+ have han_f : AnalyticAt ℂ f z := hf.analyticAt z -+ have horder_f : analyticOrderNatAt f z = 0 := by -+ have : analyticOrderAt f z = 0 := (han_f.analyticOrderAt_eq_zero).2 hz -+ have hcast : (analyticOrderNatAt f z : ℕ∞) = analyticOrderAt f z := -+ Nat.cast_analyticOrderNatAt (f := f) (z₀ := z) (hf_not_top z) -+ have : (analyticOrderNatAt f z : ℕ∞) = 0 := by simp [hcast, this] -+ exact_mod_cast this -+ have han_cprod : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by -+ exact analyticAt_divisorCanonicalProduct_univ m f h_sum z -+ by_cases hz0 : z = 0 -+ · subst hz0 -+ have hord0 : analyticOrderNatAt f 0 = 0 := by simpa using horder_f -+ simp [hadamardDenom, hord0, divisorCanonicalProduct_zero] -+ · have hp : z ^ (analyticOrderNatAt f 0) ≠ 0 := pow_ne_zero _ hz0 -+ have hcprod_order : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = 0 := by -+ simpa [horder_f] using -+ (analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt (m := m) (hf := hf) -+ (h_sum := h_sum) (z₀ := z) hz0) -+ have hcprod_ne : divisorCanonicalProduct m f (Set.univ : Set ℂ) z ≠ 0 := by -+ have hcprod_entire : -+ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by -+ exact differentiable_divisorCanonicalProduct_univ m f h_sum -+ have hcprod_not_top : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hcprod_entire) -+ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ z -+ have hcprod_cast : -+ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z : ℕ∞) = -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := -+ Nat.cast_analyticOrderNatAt -+ (f := divisorCanonicalProduct m f (Set.univ : Set ℂ)) (z₀ := z) hcprod_not_top -+ have : analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = 0 := by -+ have : -+ (analyticOrderNatAt -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z : ℕ∞) = 0 := by -+ exact_mod_cast hcprod_order -+ simp [hcprod_cast] at this -+ simpa using this -+ exact (han_cprod.analyticOrderAt_eq_zero).1 this -+ exact mul_ne_zero hp hcprod_ne -+ -+lemma analyticOrderNatAt_divisorCanonicalProduct_zero -+ (m : ℕ) (f : ℂ → ℂ) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := by -+ have hcprod_entire : -+ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by -+ exact differentiable_divisorCanonicalProduct_univ m f h_sum -+ have hcprod_not_top : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hcprod_entire) -+ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ 0 -+ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := -+ hcprod_entire.analyticAt 0 -+ have hcprod0 : divisorCanonicalProduct m f (Set.univ : Set ℂ) 0 ≠ 0 := by -+ simp [divisorCanonicalProduct_zero] -+ have : analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := -+ (hcprodA.analyticOrderAt_eq_zero).2 hcprod0 -+ have hcast : -+ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 : ℕ∞) = -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := -+ Nat.cast_analyticOrderNatAt -+ (f := divisorCanonicalProduct m f (Set.univ : Set ℂ)) (z₀ := (0 : ℂ)) hcprod_not_top -+ have : -+ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 : ℕ∞) = -+ 0 := by -+ simp [hcast, this] -+ exact_mod_cast this -+ -+theorem analyticOrderNatAt_hadamardDenom_eq -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : -+ analyticOrderNatAt (hadamardDenom m f) z = analyticOrderNatAt f z := by -+ by_cases hz0 : z = 0 -+ · subst hz0 -+ have hpowA : AnalyticAt ℂ (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 := by -+ simpa using! (analyticAt_id.pow (analyticOrderNatAt f 0)) -+ have hpow_not_top : -+ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero -+ (hf := (differentiable_id.pow (analyticOrderNatAt f 0))) -+ ⟨1, by simp⟩ 0 -+ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := by -+ exact analyticAt_divisorCanonicalProduct_univ m f h_sum 0 -+ have hcprod0 : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := -+ analyticOrderNatAt_divisorCanonicalProduct_zero (m := m) (f := f) h_sum -+ have hid0 : analyticOrderNatAt (fun z : ℂ => z) 0 = 1 := by -+ have hid_entire : Differentiable ℂ (fun z : ℂ => z) := differentiable_id -+ have hdiv : -+ (MeromorphicOn.divisor (fun z : ℂ => z) (Set.univ : Set ℂ)) 0 = -+ (analyticOrderNatAt (fun z : ℂ => z) 0 : ℤ) := by -+ simpa using -+ (divisor_univ_eq_analyticOrderNatAt_int -+ (f := fun z : ℂ => z) hid_entire 0) -+ have hdiv1 : (MeromorphicOn.divisor (fun z : ℂ => z) (Set.univ : Set ℂ)) 0 = 1 := by -+ simpa using -+ (MeromorphicOn.divisor_sub_const_self (z₀ := (0 : ℂ)) -+ (U := (Set.univ : Set ℂ)) (by simp)) -+ have : (analyticOrderNatAt (fun z : ℂ => z) 0 : ℤ) = 1 := by -+ simpa [hdiv] using hdiv1 -+ exact_mod_cast this -+ have hpow0 : -+ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 = -+ analyticOrderNatAt f 0 := by -+ have hidA : AnalyticAt ℂ (fun z : ℂ => z) 0 := by -+ simpa [id] using! (analyticAt_id : AnalyticAt ℂ (id : ℂ → ℂ) 0) -+ simpa [hid0] using! (analyticOrderNatAt_pow (hf := hidA) (n := analyticOrderNatAt f 0)) -+ have hmul : -+ analyticOrderNatAt (hadamardDenom m f) 0 = -+ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 + -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := by -+ have hcprod_not_top' : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero -+ (hf := differentiable_divisorCanonicalProduct_univ m f h_sum) -+ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ 0 -+ simpa [hadamardDenom] using! -+ analyticOrderNatAt_mul (hf := hpowA) (hg := hcprodA) -+ (hf' := hpow_not_top) (hg' := hcprod_not_top') -+ simp [hmul, hpow0, hcprod0] -+ · have hpowA : AnalyticAt ℂ (fun z : ℂ => z ^ analyticOrderNatAt f 0) z := by -+ simpa using! (analyticAt_id.pow (analyticOrderNatAt f 0)) -+ have hpow_not_top : -+ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero -+ (hf := (differentiable_id.pow (analyticOrderNatAt f 0))) -+ ⟨1, by simp⟩ z -+ have hpow0 : analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z = 0 := by -+ have hz' : (fun z : ℂ => z ^ analyticOrderNatAt f 0) z ≠ 0 := by -+ simp [hz0] -+ have : analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z = 0 := -+ ((hpowA).analyticOrderAt_eq_zero).2 hz' -+ have hcast : (analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z : ℕ∞) = -+ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z := -+ Nat.cast_analyticOrderNatAt -+ (f := fun z : ℂ => z ^ analyticOrderNatAt f 0) (z₀ := z) hpow_not_top -+ have : (analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z : ℕ∞) = 0 := by -+ simp [hcast, this] -+ exact_mod_cast this -+ have hcprod_eq : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = -+ analyticOrderNatAt f z := -+ analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt -+ (m := m) (hf := hf) (h_sum := h_sum) (z₀ := z) hz0 -+ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by -+ exact analyticAt_divisorCanonicalProduct_univ m f h_sum z -+ have hcprod_not_top : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero -+ (hf := differentiable_divisorCanonicalProduct_univ m f h_sum) -+ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ z -+ have hmul : -+ analyticOrderNatAt (hadamardDenom m f) z = -+ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z + -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by -+ simpa [hadamardDenom] using! -+ analyticOrderNatAt_mul (hf := hpowA) (hg := hcprodA) -+ (hf' := hpow_not_top) (hg' := hcprod_not_top) -+ simp [hmul, hpow0, hcprod_eq] -+ -+theorem divisor_hadamardDenom_eq -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) = -+ MeromorphicOn.divisor f (Set.univ : Set ℂ) := by -+ ext z -+ have hden_entire : Differentiable ℂ (hadamardDenom m f) := -+ differentiable_hadamardDenom (m := m) f h_sum -+ have hf_entire : Differentiable ℂ f := hf -+ have hden : -+ (MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ)) z = -+ (analyticOrderNatAt (hadamardDenom m f) z : ℤ) := by -+ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := hadamardDenom m f) hden_entire z) -+ have hfz : -+ (MeromorphicOn.divisor f (Set.univ : Set ℂ)) z = -+ (analyticOrderNatAt f z : ℤ) := by -+ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := f) hf_entire z) -+ simp [hden, hfz, analyticOrderNatAt_hadamardDenom_eq (m := m) (hf := hf) (h_sum := h_sum) z] -+ -+theorem divisor_hadamardQuotient_eq_zero -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ MeromorphicOn.divisor (fun z : ℂ => f z / hadamardDenom m f z) (Set.univ : Set ℂ) = 0 := by -+ have hf_mero : MeromorphicOn f (Set.univ : Set ℂ) := by -+ intro z hz -+ exact (hf.analyticAt z).meromorphicAt -+ have hden_entire : Differentiable ℂ (hadamardDenom m f) := -+ differentiable_hadamardDenom (m := m) f h_sum -+ have hden_mero : MeromorphicOn (hadamardDenom m f) (Set.univ : Set ℂ) := by -+ intro z hz -+ exact (hden_entire.analyticAt z).meromorphicAt -+ rcases hnot with ⟨z1, hz1⟩ -+ have hden1 : hadamardDenom m f z1 ≠ 0 := -+ hadamardDenom_ne_zero_at (m := m) (f := f) hf ⟨z1, hz1⟩ h_sum hz1 -+ have hf_order_ne_top : ∀ z ∈ (Set.univ : Set ℂ), meromorphicOrderAt f z ≠ ⊤ := by -+ intro z hzU -+ have hz1_ne_top : meromorphicOrderAt f z1 ≠ ⊤ := by -+ have hfAt : MeromorphicAt f z1 := hf_mero z1 (by simp) -+ have hcont : ContinuousAt f z1 := (hf.differentiableAt).continuousAt -+ have hne_nhds : ∀ᶠ w in 𝓝 z1, f w ≠ 0 := -+ (hcont.ne_iff_eventually_ne continuousAt_const).1 hz1 -+ have hne_nhdsNE : ∀ᶠ w in 𝓝[≠] z1, f w ≠ 0 := -+ eventually_nhdsWithin_of_eventually_nhds hne_nhds -+ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hfAt)).2 hne_nhdsNE -+ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hf_mero) -+ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top -+ have hden_order_ne_top : -+ ∀ z ∈ (Set.univ : Set ℂ), meromorphicOrderAt (hadamardDenom m f) z ≠ ⊤ := by -+ intro z hzU -+ have hz1_ne_top : meromorphicOrderAt (hadamardDenom m f) z1 ≠ ⊤ := by -+ have hdenAt : MeromorphicAt (hadamardDenom m f) z1 := hden_mero z1 (by simp) -+ have hcont : ContinuousAt (hadamardDenom m f) z1 := -+ (hden_entire.differentiableAt).continuousAt -+ have hne_nhds : ∀ᶠ w in 𝓝 z1, hadamardDenom m f w ≠ 0 := -+ (hcont.ne_iff_eventually_ne continuousAt_const).1 hden1 -+ have hne_nhdsNE : ∀ᶠ w in 𝓝[≠] z1, hadamardDenom m f w ≠ 0 := -+ eventually_nhdsWithin_of_eventually_nhds hne_nhds -+ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hdenAt)).2 hne_nhdsNE -+ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hden_mero) -+ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top -+ have hinv_order_ne_top : -+ ∀ z ∈ (Set.univ : Set ℂ), -+ meromorphicOrderAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z ≠ ⊤ := by -+ intro z hzU -+ have hinv_mero : -+ MeromorphicOn (fun z : ℂ => (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := -+ hden_mero.inv -+ have hz1_ne_top : -+ meromorphicOrderAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 ≠ ⊤ := by -+ have hinvAt : MeromorphicAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 := -+ hinv_mero z1 (by simp) -+ have hcont_denom : ContinuousAt (hadamardDenom m f) z1 := -+ (hden_entire.differentiableAt).continuousAt -+ have hcont : ContinuousAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 := -+ hcont_denom.inv₀ hden1 -+ have hinv1 : (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 ≠ 0 := by -+ simpa using inv_ne_zero hden1 -+ have hne_nhds : -+ ∀ᶠ w in 𝓝 z1, (fun z : ℂ => (hadamardDenom m f z)⁻¹) w ≠ 0 := -+ (hcont.ne_iff_eventually_ne continuousAt_const).1 hinv1 -+ have hne_nhdsNE : -+ ∀ᶠ w in 𝓝[≠] z1, (fun z : ℂ => (hadamardDenom m f z)⁻¹) w ≠ 0 := -+ eventually_nhdsWithin_of_eventually_nhds hne_nhds -+ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hinvAt)).2 hne_nhdsNE -+ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hinv_mero) -+ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top -+ have hdiv_denom : MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) = -+ MeromorphicOn.divisor f (Set.univ : Set ℂ) := -+ divisor_hadamardDenom_eq (m := m) (hf := hf) (h_sum := h_sum) -+ calc -+ MeromorphicOn.divisor (fun z : ℂ => f z / hadamardDenom m f z) (Set.univ : Set ℂ) -+ = MeromorphicOn.divisor -+ (fun z : ℂ => f z * (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := by -+ simp [div_eq_mul_inv] -+ _ = MeromorphicOn.divisor f (Set.univ : Set ℂ) + -+ MeromorphicOn.divisor (fun z : ℂ => (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := by -+ simpa using (MeromorphicOn.divisor_fun_mul (U := (Set.univ : Set ℂ)) -+ (f₁ := f) (f₂ := fun z => (hadamardDenom m f z)⁻¹) hf_mero (hden_mero.inv) -+ hf_order_ne_top hinv_order_ne_top) -+ _ = MeromorphicOn.divisor f (Set.univ : Set ℂ) - -+ MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) := by -+ simp [sub_eq_add_neg] -+ _ = 0 := by -+ simp [hdiv_denom] -+ -+theorem exists_entire_nonzero_hadamardQuotient -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ ∃ H : ℂ → ℂ, Differentiable ℂ H ∧ (∀ z, H z ≠ 0) ∧ ∀ z : ℂ, f z = -+ H z * z ^ (analyticOrderNatAt f 0) * divisorCanonicalProduct m f (Set.univ : Set ℂ) z := by -+ let denom : ℂ → ℂ := hadamardDenom m f -+ let q : ℂ → ℂ := fun z => f z / denom z -+ have hden_entire : Differentiable ℂ denom := -+ differentiable_hadamardDenom (m := m) f h_sum -+ have hq_mero : MeromorphicOn q (Set.univ : Set ℂ) := by -+ intro z hzU -+ have hf_m : MeromorphicAt f z := (hf.analyticAt z).meromorphicAt -+ have hden_m : MeromorphicAt denom z := (hden_entire.analyticAt z).meromorphicAt -+ simpa [q, denom, div_eq_mul_inv] using! (hf_m.mul hden_m.inv) -+ let H : ℂ → ℂ := toMeromorphicNFOn q (Set.univ : Set ℂ) -+ have hNF : MeromorphicNFOn H (Set.univ : Set ℂ) := -+ meromorphicNFOn_toMeromorphicNFOn q (Set.univ : Set ℂ) -+ have hdivH : MeromorphicOn.divisor H (Set.univ : Set ℂ) = 0 := by -+ have hdivq : MeromorphicOn.divisor q (Set.univ : Set ℂ) = 0 := -+ divisor_hadamardQuotient_eq_zero (m := m) (f := f) (hf := hf) -+ (hnot := hnot) (h_sum := h_sum) -+ simpa [H, hdivq] using -+ (MeromorphicOn.divisor_of_toMeromorphicNFOn -+ (f := q) (U := (Set.univ : Set ℂ)) hq_mero) -+ have hA : AnalyticOnNhd ℂ H (Set.univ : Set ℂ) := by -+ have : -+ (0 : Function.locallyFinsuppWithin (Set.univ : Set ℂ) ℤ) ≤ -+ MeromorphicOn.divisor H (Set.univ : Set ℂ) := by -+ simp [hdivH] -+ exact (MeromorphicNFOn.divisor_nonneg_iff_analyticOnNhd (h₁f := hNF)).1 (by simp [hdivH]) -+ have hH_entire : Differentiable ℂ H := by -+ intro z -+ exact (hA z (by simp)).differentiableAt -+ rcases hnot with ⟨z1, hz1⟩ -+ have hden1 : denom z1 ≠ 0 := -+ hadamardDenom_ne_zero_at (m := m) (f := f) hf ⟨z1, hz1⟩ h_sum hz1 -+ have hqA1 : AnalyticAt ℂ q z1 := by -+ have hdenA1 : AnalyticAt ℂ denom z1 := hden_entire.analyticAt z1 -+ exact (hf.analyticAt z1).div hdenA1 hden1 -+ have hqNF1 : MeromorphicNFAt q z1 := hqA1.meromorphicNFAt -+ have htoEq : toMeromorphicNFAt q z1 = q := (toMeromorphicNFAt_eq_self (f := q) (x := z1)).2 hqNF1 -+ have hH1 : H z1 = q z1 := by -+ have hx : z1 ∈ (Set.univ : Set ℂ) := by simp -+ have : toMeromorphicNFOn q (Set.univ : Set ℂ) z1 = toMeromorphicNFAt q z1 z1 := -+ (toMeromorphicNFOn_eq_toMeromorphicNFAt (f := q) (U := (Set.univ : Set ℂ)) hq_mero hx) -+ simpa [H, htoEq] using this -+ have hH1_ne : H z1 ≠ 0 := by -+ have : q z1 ≠ 0 := div_ne_zero hz1 hden1 -+ simpa [hH1] using this -+ have hH_not_top : ∀ z : ℂ, analyticOrderAt H z ≠ ⊤ := by -+ exact analyticOrderAt_ne_top_of_exists_ne_zero (hf := hH_entire) ⟨z1, hH1_ne⟩ -+ have hH_orderNat_zero : ∀ z : ℂ, analyticOrderNatAt H z = 0 := by -+ intro z -+ have hzdiv : -+ (MeromorphicOn.divisor H (Set.univ : Set ℂ)) z = (analyticOrderNatAt H z : ℤ) := by -+ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := H) hH_entire z) -+ have : (MeromorphicOn.divisor H (Set.univ : Set ℂ)) z = 0 := by -+ simp [hdivH] -+ have : (analyticOrderNatAt H z : ℤ) = 0 := by simpa [hzdiv] using this -+ exact_mod_cast this -+ have hH_ne : ∀ z : ℂ, H z ≠ 0 := by -+ intro z -+ have hcast : (analyticOrderNatAt H z : ℕ∞) = analyticOrderAt H z := -+ Nat.cast_analyticOrderNatAt (f := H) (z₀ := z) (hH_not_top z) -+ have : analyticOrderAt H z = 0 := by -+ have : (analyticOrderNatAt H z : ℕ∞) = 0 := by exact_mod_cast (hH_orderNat_zero z) -+ simpa [hcast] using this -+ exact ((hA z (by simp)).analyticOrderAt_eq_zero).1 this -+ have hfA : AnalyticOnNhd ℂ f (Set.univ : Set ℂ) := fun z hzU => hf.analyticAt z -+ have hdenA : AnalyticOnNhd ℂ denom (Set.univ : Set ℂ) := fun z hzU => hden_entire.analyticAt z -+ have hprodA : AnalyticOnNhd ℂ (fun z => H z * denom z) (Set.univ : Set ℂ) := -+ (hA.mul hdenA) -+ have hlocal : f =ᶠ[𝓝 z1] fun z => H z * denom z := by -+ have hden_ne : ∀ᶠ z in 𝓝 z1, denom z ≠ 0 := -+ (hden_entire.differentiableAt.continuousAt.ne_iff_eventually_ne continuousAt_const).1 hden1 -+ have hH_eq_q : H =ᶠ[𝓝 z1] q := by -+ have hx : z1 ∈ (Set.univ : Set ℂ) := by simp -+ have hloc : -+ toMeromorphicNFOn q (Set.univ : Set ℂ) =ᶠ[𝓝 z1] toMeromorphicNFAt q z1 := by -+ simpa [H] using (toMeromorphicNFOn_eq_toMeromorphicNFAt_on_nhds (f := q) -+ (U := (Set.univ : Set ℂ)) hq_mero hx) -+ simpa [H, htoEq] using hloc -+ filter_upwards [hden_ne, hH_eq_q] with z hzden hHz -+ have hcancel : q z * denom z = f z := by -+ dsimp [q] -+ field_simp [hzden] -+ calc -+ f z = q z * denom z := hcancel.symm -+ _ = H z * denom z := by simp [hHz] -+ have hglob : f = fun z => H z * denom z := -+ AnalyticOnNhd.eq_of_eventuallyEq (hf := hfA) (hg := hprodA) hlocal -+ refine ⟨H, hH_entire, hH_ne, ?_⟩ -+ intro z -+ have hglobz : f z = H z * denom z := congrArg (fun g => g z) hglob -+ simpa [denom, hadamardDenom, mul_assoc, mul_left_comm, mul_comm] using hglobz -+ -+end Complex.Hadamard -+end HadamardSourceScope16 -+ -+section HadamardSourceScope17 -+ -+open Filter _root_.Function _root_.MeromorphicOn _root_.Erdos970.MeromorphicOn Metric -+ _root_.Real _root_.Erdos970.Real Set -+ -+namespace Function.locallyFinsuppWithin -+ -+open _root_.Function.locallyFinsuppWithin -+ -+variable {E : Type*} [NormedAddCommGroup E] -+ -+lemma norm_le_abs_of_mem_toClosedBall_support {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} -+ (hz : z ∈ (toClosedBall r D).support) : ‖z‖ ≤ |r| := by -+ have hz_ball : z ∈ closedBall (0 : E) |r| := (toClosedBall r D).supportWithinDomain hz -+ simpa [mem_closedBall, dist_zero_right] using hz_ball -+ -+lemma toClosedBall_eval_eq_of_norm_le_abs {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} -+ (hz : ‖z‖ ≤ |r|) : toClosedBall r D z = D z := by -+ have hz_ball : z ∈ closedBall (0 : E) |r| := by -+ simpa [mem_closedBall, dist_zero_right] using hz -+ simpa using toClosedBall_eval_within (f := D) hz_ball -+ -+lemma mem_toClosedBall_support_of_mem_support_of_norm_le_abs -+ {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} (hzD : z ∈ D.support) (hzR : ‖z‖ ≤ |r|) : -+ z ∈ (toClosedBall r D).support := by -+ rw [Function.mem_support] -+ rw [toClosedBall_eval_eq_of_norm_le_abs hzR] -+ rwa [Function.mem_support] at hzD -+ -+lemma mem_support_of_mem_toClosedBall_support {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} -+ (hz : z ∈ (toClosedBall r D).support) : z ∈ D.support := by -+ have hnorm : ‖z‖ ≤ |r| := norm_le_abs_of_mem_toClosedBall_support hz -+ rw [Function.mem_support] at hz ⊢ -+ rw [toClosedBall_eval_eq_of_norm_le_abs hnorm] at hz -+ exact hz -+ -+noncomputable def massClosedBall₀ {E : Type*} [NormedAddCommGroup E] [ProperSpace E] -+ (D : locallyFinsupp E ℤ) (R : ℝ) : ℝ := by -+ classical -+ exact -+ (((finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).toFinset).filter -+ (fun z => z ≠ (0 : E))).sum fun z => (D z : ℝ) -+ -+end Function.locallyFinsuppWithin -+ -+namespace Function.locallyFinsuppWithin -+ -+open _root_.Function.locallyFinsuppWithin -+ -+theorem logCounting_divisor_eq_circleAverage_sub_const_of_differentiable -+ {R : ℝ} {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hR : R ≠ 0) : -+ logCounting (divisor f ⊤) R = -+ circleAverage (log ‖f ·‖) 0 R - log ‖meromorphicTrailingCoeffAt f 0‖ := by -+ have hmero : Meromorphic f := fun z => (hf.analyticAt z).meromorphicAt -+ simpa [top_eq_univ] using -+ logCounting_divisor_eq_circleAverage_sub_const (f := f) hmero hR -+ -+end Function.locallyFinsuppWithin -+end HadamardSourceScope17 -+ -+section HadamardSourceScope18 -+ -+namespace Real -+ -+open _root_.Real -+ -+theorem log_one_add_exp_le_add_log_two {x : ℝ} (hx : 0 ≤ x) : -+ log (1 + exp x) ≤ x + log 2 := by -+ have hexp_one : (1 : ℝ) ≤ exp x := by -+ simpa using (one_le_exp_iff.2 hx) -+ have hadd : 1 + exp x ≤ 2 * exp x := by linarith -+ have hlog : log (1 + exp x) ≤ log (2 * exp x) := -+ log_le_log (by positivity) hadd -+ calc -+ log (1 + exp x) ≤ log (2 * exp x) := hlog -+ _ = log 2 + x := by simp [log_mul, add_comm] -+ _ = x + log 2 := by ring -+ -+theorem log_one_add_le_add_log_two_of_le_exp {x y : ℝ} (hy : 0 ≤ y) (hx : 0 ≤ x) -+ (hxy : y ≤ exp x) : -+ log (1 + y) ≤ x + log 2 := by -+ have hpos : 0 < (1 : ℝ) + y := by linarith -+ have hle : (1 : ℝ) + y ≤ 1 + exp x := by linarith -+ exact (log_le_log hpos hle).trans (log_one_add_exp_le_add_log_two hx) -+ -+theorem le_exp_of_log_one_add_le {x y : ℝ} (hy : 0 ≤ y) (hxy : log (1 + y) ≤ x) : -+ y ≤ exp x := by -+ have hpos : 0 < (1 : ℝ) + y := by linarith -+ have hone : 1 + y ≤ exp x := (log_le_iff_le_exp hpos).1 hxy -+ linarith -+ -+theorem neg_posLog_inv_le_log (x : ℝ) : -log⁺ x⁻¹ ≤ log x := by -+ linarith [posLog_sub_posLog_inv (x := x), posLog_nonneg (x := x)] -+ -+end Real -+end HadamardSourceScope18 -+ -+section HadamardSourceScope20 -+ -+namespace Real -+ -+open _root_.Real -+ -+variable {α E : Type*} [SeminormedAddCommGroup E] -+ -+theorem log_norm_le_log_one_add_norm (w : E) : -+ Real.log ‖w‖ ≤ Real.log (1 + ‖w‖) := by -+ by_cases h0 : ‖w‖ = 0 -+ · simp [h0] -+ · have hpos : 0 < ‖w‖ := lt_of_le_of_ne (norm_nonneg w) (Ne.symm h0) -+ exact Real.log_le_log hpos (by linarith [norm_nonneg w]) -+ -+variable {F : Type*} [NormedAddCommGroup F] -+ -+theorem log_nonneg_mul_inv_norm_of_norm_le {z : F} {r : ℝ} (hz : ‖z‖ ≤ r) : -+ 0 ≤ Real.log (r * ‖z‖⁻¹) := by -+ by_cases hz0 : z = 0 -+ · simp [hz0] -+ · have hzpos : 0 < ‖z‖ := norm_pos_iff.2 hz0 -+ have : (1 : ℝ) ≤ r * ‖z‖⁻¹ := by -+ have : (1 : ℝ) ≤ r / ‖z‖ := (one_le_div hzpos).2 hz -+ simpa [div_eq_mul_inv] using this -+ exact Real.log_nonneg this -+ -+theorem log_two_le_log_two_mul_mul_inv_norm_of_norm_le {z : F} {R : ℝ} (hz0 : z ≠ 0) -+ (hz : ‖z‖ ≤ R) : -+ Real.log 2 ≤ Real.log ((2 * R) * ‖z‖⁻¹) := by -+ have hzpos : 0 < ‖z‖ := norm_pos_iff.2 hz0 -+ have hRdiv : (1 : ℝ) ≤ R / ‖z‖ := (one_le_div hzpos).2 hz -+ have hle2 : (2 : ℝ) ≤ (2 * R) * ‖z‖⁻¹ := by -+ have : (2 : ℝ) ≤ 2 * (R / ‖z‖) := by nlinarith -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using this -+ exact Real.log_le_log (by norm_num) hle2 -+ -+theorem norm_le_exp_mul_rpow_of_exponent_le -+ {f : α → E} {r : α → ℝ} {C ρ τ : ℝ} (hC : 0 ≤ C) (hr : ∀ x, 1 ≤ r x) (hρτ : ρ ≤ τ) -+ (hbound : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ ρ)) : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ) := by -+ intro x -+ refine (hbound x).trans (Real.exp_le_exp.2 ?_) -+ exact mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le (hr x) hρτ) hC -+ -+theorem norm_le_exp_mul_rpow_of_log_growth -+ {f : α → E} {r : α → ℝ} {C ρ τ : ℝ} (hC : 0 ≤ C) (hr : ∀ x, 1 ≤ r x) (hρτ : ρ ≤ τ) -+ (hlog : ∀ x, Real.log (1 + ‖f x‖) ≤ C * (r x) ^ ρ) : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ) := by -+ intro x -+ have hpow : (r x) ^ ρ ≤ (r x) ^ τ := -+ Real.rpow_le_rpow_of_exponent_le (hr x) hρτ -+ have hlogτ : Real.log (1 + ‖f x‖) ≤ C * (r x) ^ τ := -+ (hlog x).trans (mul_le_mul_of_nonneg_left hpow hC) -+ exact Real.le_exp_of_log_one_add_le (norm_nonneg (f x)) hlogτ -+ -+theorem log_growth_of_norm_le_exp_mul_rpow -+ {f : α → E} {r : α → ℝ} {C τ : ℝ} (hC : 0 < C) (hτ : 0 ≤ τ) -+ (hr : ∀ x, 1 ≤ r x) (hbound : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ)) : -+ ∃ C' > 0, ∀ x, Real.log (1 + ‖f x‖) ≤ C' * (r x) ^ τ := by -+ refine ⟨C + Real.log 2, by -+ have hlog2 : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) -+ linarith, ?_⟩ -+ intro x -+ have hX : (1 : ℝ) ≤ (r x) ^ τ := Real.one_le_rpow (hr x) hτ -+ have hB : 0 ≤ C * (r x) ^ τ := -+ mul_nonneg hC.le (Real.rpow_nonneg (le_trans zero_le_one (hr x)) _) -+ have hlog : -+ Real.log (1 + ‖f x‖) ≤ C * (r x) ^ τ + Real.log 2 := -+ Real.log_one_add_le_add_log_two_of_le_exp (norm_nonneg _) hB (hbound x) -+ have hlog2_nonneg : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) -+ nlinarith [hlog, hX, hlog2_nonneg] -+ -+theorem exists_norm_le_exp_mul_pow_of_rpow_bound -+ {f : α → E} {r : α → ℝ} {τ : ℝ} {n : ℕ} (hr : ∀ x, 1 ≤ r x) (hτn : τ < (n : ℝ)) -+ (hbound : ∃ C > 0, ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ)) : -+ ∃ C > 0, ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ n) := by -+ rcases hbound with ⟨C, hCpos, hC⟩ -+ have hweak : -+ ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ (n : ℝ)) := -+ norm_le_exp_mul_rpow_of_exponent_le -+ (f := f) (r := r) hCpos.le hr (le_of_lt hτn) hC -+ refine ⟨C, hCpos, ?_⟩ -+ intro x -+ have hpow : (r x) ^ (n : ℝ) = (r x) ^ n := Real.rpow_natCast (r x) n -+ simpa [hpow] using hweak x -+ -+theorem one_add_le_three_mul_one_add_of_le_two_mul_max {x r : ℝ} (hx : 0 ≤ x) -+ (hr : r ≤ 2 * max x 1) : 1 + r ≤ 3 * (1 + x) := by -+ have hmax : max x 1 ≤ 1 + x := max_le_iff.2 ⟨by linarith, by linarith⟩ -+ nlinarith -+ -+theorem exp_mul_rpow_le_exp_mul_rpow_of_le_mul -+ {A B x y τ : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hy : 0 ≤ y) -+ (hτ : 0 ≤ τ) (hxy : x ≤ B * y) : Real.exp (A * x ^ τ) ≤ Real.exp ((A * B ^ τ) * y ^ τ) := by -+ refine Real.exp_le_exp.2 ?_ -+ have hpow : x ^ τ ≤ (B * y) ^ τ := Real.rpow_le_rpow hx hxy hτ -+ have hsplit : (B * y) ^ τ = B ^ τ * y ^ τ := by -+ simpa using (Real.mul_rpow (x := B) (y := y) (z := τ) hB hy) -+ simpa [mul_assoc] using mul_le_mul_of_nonneg_left (hpow.trans_eq hsplit) hA -+ -+theorem exists_between_self_and_floor_add_one_same_floor {ρ : ℝ} (hρ : 0 ≤ ρ) : -+ ∃ τ : ℝ, ρ < τ ∧ τ < (Nat.floor ρ + 1 : ℝ) ∧ 0 ≤ τ ∧ Nat.floor τ = Nat.floor ρ := by -+ set m : ℕ := Nat.floor ρ -+ set τ : ℝ := (ρ + (m + 1 : ℝ)) / 2 -+ have hm : ρ < (m + 1 : ℝ) := by simpa [m] using Nat.lt_floor_add_one (a := ρ) -+ have hτ : ρ < τ := by dsimp [τ]; linarith -+ have hτ_lt : τ < (m + 1 : ℝ) := by dsimp [τ]; linarith -+ have hτ_nonneg : 0 ≤ τ := le_trans hρ (le_of_lt hτ) -+ have hfloorτ : Nat.floor τ = m := by -+ have hm_le_τ : (m : ℝ) ≤ τ := le_trans (Nat.floor_le hρ) (le_of_lt hτ) -+ have hτ_lt_m1 : τ < (m : ℝ) + 1 := by simpa [add_assoc, add_comm, add_left_comm] using hτ_lt -+ exact (Nat.floor_eq_iff hτ_nonneg).2 ⟨hm_le_τ, hτ_lt_m1⟩ -+ exact ⟨τ, hτ, by simpa [m] using hτ_lt, hτ_nonneg, by simpa [m] using hfloorτ⟩ -+ -+open Metric _root_.Complex _root_.Erdos970.Complex -+ -+theorem log_norm_le_of_log_one_add_growth_on_sphere {f : ℂ → ℂ} {C ρ R : ℝ} -+ (hC : ∀ z : ℂ, _root_.Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {z : ℂ} -+ (hz : z ∈ sphere (0 : ℂ) |R|) : _root_.Real.log ‖f z‖ ≤ C * (1 + |R|) ^ ρ := by -+ have hz_norm : ‖z‖ = |R| := by -+ simpa [mem_sphere, dist_zero_right] using hz -+ simpa [hz_norm] using le_trans (log_norm_le_log_one_add_norm (f z)) (hC z) -+ -+end Real -+end HadamardSourceScope20 -+ -+section HadamardSourceScope21 -+ -+open Filter _root_.Function _root_.Erdos970.Function _root_.MeromorphicOn -+ _root_.Erdos970.MeromorphicOn Metric _root_.Real _root_.Erdos970.Real Set -+ -+namespace Function.locallyFinsuppWithin -+ -+open _root_.Function.locallyFinsuppWithin -+ -+theorem logCounting_divisor_le_of_log_growth {f : ℂ → ℂ} {ρ C : ℝ} (hf : Differentiable ℂ f) -+ (hC : ∀ z : ℂ, log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {R : ℝ} (hR0 : 0 < R) : -+ logCounting (divisor f (Set.univ : Set ℂ)) R -+ ≤ C * (1 + |R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ have hR : R ≠ 0 := ne_of_gt hR0 -+ have hEq := -+ logCounting_divisor_eq_circleAverage_sub_const_of_differentiable (f := f) hf hR -+ have hf_sphere : MeromorphicOn f (sphere (0 : ℂ) |R|) := by -+ intro z hz -+ exact (hf.analyticAt z).meromorphicAt -+ have hInt : CircleIntegrable (fun z : ℂ => log ‖f z‖) 0 R := -+ MeromorphicOn.circleIntegrable_log_norm hf_sphere -+ have hbound_circle : ∀ z ∈ sphere (0 : ℂ) |R|, -+ log ‖f z‖ ≤ C * (1 + |R|) ^ ρ := by -+ intro z hz -+ exact log_norm_le_of_log_one_add_growth_on_sphere hC hz -+ have hCircleAvg_le : -+ circleAverage (fun z : ℂ => log ‖f z‖) 0 R ≤ C * (1 + |R|) ^ ρ := -+ circleAverage_mono_on_of_le_circle (c := (0 : ℂ)) (R := R) -+ (f := fun z => log ‖f z‖) hInt hbound_circle -+ calc -+ logCounting (divisor f (Set.univ : Set ℂ)) R -+ = circleAverage (fun z : ℂ => log ‖f z‖) 0 R -+ - log ‖meromorphicTrailingCoeffAt f 0‖ := by -+ simpa [top_eq_univ] using hEq -+ _ ≤ circleAverage (fun z : ℂ => log ‖f z‖) 0 R -+ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ have : -+ -log ‖meromorphicTrailingCoeffAt f 0‖ -+ ≤ |log ‖meromorphicTrailingCoeffAt f 0‖| := -+ neg_le_abs (log ‖meromorphicTrailingCoeffAt f 0‖) -+ linarith -+ _ ≤ C * (1 + |R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ nlinarith [hCircleAvg_le] -+ -+variable {E : Type*} [NormedAddCommGroup E] [ProperSpace E] -+ -+theorem log_two_mul_massClosedBall₀_le_logCounting {D : locallyFinsupp E ℤ} (hDnonneg : 0 ≤ D) -+ {R : ℝ} (hR : 1 ≤ R) : -+ (log 2) * massClosedBall₀ D R ≤ logCounting D (2 * R) := by -+ classical -+ have hR0 : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR -+ set r : ℝ := 2 * R -+ have hrpos : 0 < r := by dsimp [r]; nlinarith -+ let Dr := toClosedBall r D -+ have hDr_fin : Set.Finite Dr.support := Dr.finiteSupport (isCompact_closedBall (0 : E) |r|) -+ let F : Finset E := hDr_fin.toFinset -+ let SR : Finset E := -+ (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).toFinset -+ let S : Finset E := SR.filter fun z => z ≠ (0 : E) -+ have hS_sub : S ⊆ F := by -+ intro z hzS -+ have hz_mem_SR : z ∈ SR := (Finset.mem_filter.1 hzS).1 -+ have hzR : z ∈ (toClosedBall R D).support := by -+ exact (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).mem_toFinset.1 -+ hz_mem_SR -+ have hz_norm_le_R : ‖z‖ ≤ R := by -+ have := norm_le_abs_of_mem_toClosedBall_support hzR -+ simpa [abs_of_pos hR0] using this -+ have hz_norm_le_r : ‖z‖ ≤ |r| := by -+ have : ‖z‖ ≤ r := le_trans hz_norm_le_R (by dsimp [r]; nlinarith) -+ simpa [abs_of_pos hrpos] using this -+ have hzD : z ∈ D.support := mem_support_of_mem_toClosedBall_support hzR -+ have : z ∈ Dr.support := by -+ simpa [Dr] using -+ mem_toClosedBall_support_of_mem_support_of_norm_le_abs (D := D) (r := r) hzD hz_norm_le_r -+ exact hDr_fin.mem_toFinset.2 this -+ have hlogCounting : -+ logCounting D r -+ = (F.sum fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) + (D 0 : ℝ) * log r := by -+ have hsupp : Function.support (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) ⊆ F := by -+ intro z hz -+ have : Dr z ≠ 0 := by -+ by_contra h0 -+ simp [Function.mem_support, h0] at hz -+ have : z ∈ Dr.support := by simpa [Function.mem_support] using this -+ exact hDr_fin.mem_toFinset.2 this -+ simp [logCounting, Dr, r, -+ finsum_eq_sum_of_support_subset (f := fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) (s := F) hsupp] -+ have hsum_le : -+ (log 2) * (S.sum fun z => (D z : ℝ)) -+ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := by -+ have hterm_nonneg : ∀ z ∈ F, 0 ≤ (Dr z : ℝ) * log (r * ‖z‖⁻¹) := by -+ intro z hzF -+ have hz_sup : z ∈ Dr.support := hDr_fin.mem_toFinset.1 hzF -+ have hDz : 0 ≤ Dr z := by -+ have hDz' : 0 ≤ D z := hDnonneg z -+ have hDrz : Dr z = D z := -+ toClosedBall_eval_eq_of_norm_le_abs (norm_le_abs_of_mem_toClosedBall_support hz_sup) -+ simpa [hDrz] using hDz' -+ have hlog : 0 ≤ log (r * ‖z‖⁻¹) := by -+ have hzle : ‖z‖ ≤ r := by -+ have hnorm := norm_le_abs_of_mem_toClosedBall_support hz_sup -+ simpa [abs_of_pos hrpos] using hnorm -+ exact log_nonneg_mul_inv_norm_of_norm_le hzle -+ exact mul_nonneg (by exact_mod_cast hDz) hlog -+ have hsumSF : -+ S.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) -+ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := -+ Finset.sum_le_sum_of_subset_of_nonneg hS_sub (by -+ intro z hzF _; exact hterm_nonneg z hzF) -+ have hterm_ge : ∀ z ∈ S, (log 2) * (D z : ℝ) ≤ (Dr z : ℝ) * log (r * ‖z‖⁻¹) := by -+ intro z hzS -+ have hz0 : z ≠ (0 : E) := (Finset.mem_filter.1 hzS).2 -+ have hz_norm_le_R : ‖z‖ ≤ R := by -+ have hz_mem_SR : z ∈ SR := (Finset.mem_filter.1 hzS).1 -+ have hzRsup : z ∈ (toClosedBall R D).support := by -+ exact (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).mem_toFinset.1 -+ hz_mem_SR -+ have hnorm := norm_le_abs_of_mem_toClosedBall_support hzRsup -+ simpa [abs_of_pos hR0] using hnorm -+ have hlog_le : log 2 ≤ log (r * ‖z‖⁻¹) := by -+ simpa [r] using log_two_le_log_two_mul_mul_inv_norm_of_norm_le hz0 hz_norm_le_R -+ have hDz_nonneg : 0 ≤ D z := hDnonneg z -+ have hz_in_ballr : z ∈ closedBall (0 : E) |r| := by -+ have : ‖z‖ ≤ r := le_trans hz_norm_le_R (by dsimp [r]; nlinarith) -+ simpa [mem_closedBall, dist_zero_right, abs_of_pos hrpos] using this -+ have hDrz : Dr z = D z := by -+ have hz_norm_le : ‖z‖ ≤ |r| := by -+ simpa [mem_closedBall, dist_zero_right] using hz_in_ballr -+ simpa [Dr] using toClosedBall_eval_eq_of_norm_le_abs (D := D) (r := r) (z := z) hz_norm_le -+ have : (log 2) * (D z : ℝ) ≤ (log (r * ‖z‖⁻¹)) * (D z : ℝ) := -+ mul_le_mul_of_nonneg_right hlog_le (by exact_mod_cast hDz_nonneg) -+ simpa [hDrz, mul_assoc, mul_left_comm, mul_comm] using this -+ calc -+ (log 2) * (S.sum fun z => (D z : ℝ)) -+ = S.sum (fun z => (log 2) * (D z : ℝ)) := by simp [Finset.mul_sum] -+ _ ≤ S.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := -+ Finset.sum_le_sum fun z hz => hterm_ge z hz -+ _ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := hsumSF -+ have hcenter_nonneg : 0 ≤ (D 0 : ℝ) * log r := by -+ have hD0 : 0 ≤ D 0 := hDnonneg 0 -+ have hlogr : 0 ≤ log r := log_nonneg (by nlinarith [hR]) -+ exact mul_nonneg (by exact_mod_cast hD0) hlogr -+ have : (log 2) * (S.sum fun z => (D z : ℝ)) ≤ logCounting D r := by -+ rw [hlogCounting] -+ nlinarith [hsum_le, hcenter_nonneg] -+ simpa [massClosedBall₀, r, S, SR] using this -+ -+theorem massClosedBall₀_divisor_le_of_log_growth {f : ℂ → ℂ} {ρ C : ℝ} -+ (hf : Differentiable ℂ f) -+ (hC : ∀ z : ℂ, log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {R : ℝ} (hR : 1 ≤ R) : -+ massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R -+ ≤ (C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖|) / log 2 := by -+ have hR0 : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR -+ have hlog2pos : 0 < log 2 := log_pos (by norm_num : (1 : ℝ) < 2) -+ have hlow : -+ (log 2) * massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R -+ ≤ logCounting (divisor f (Set.univ : Set ℂ)) (2 * R) := -+ log_two_mul_massClosedBall₀_le_logCounting -+ (D := divisor f (Set.univ : Set ℂ)) -+ (MeromorphicOn.AnalyticOnNhd.divisor_nonneg -+ (hf.differentiableOn.analyticOnNhd isOpen_univ)) hR -+ have hupp : -+ logCounting (divisor f (Set.univ : Set ℂ)) (2 * R) -+ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ have h2R0 : 0 < 2 * R := by nlinarith [hR0] -+ simpa using logCounting_divisor_le_of_log_growth (f := f) (ρ := ρ) (C := C) hf hC -+ (R := 2 * R) h2R0 -+ have hmul : -+ (log 2) * massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R -+ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := -+ hlow.trans hupp -+ have hmul' : -+ massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R * log 2 -+ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using hmul -+ exact (le_div_iff₀ hlog2pos).2 hmul' -+ -+end Function.locallyFinsuppWithin -+end HadamardSourceScope21 -+ -+section HadamardSourceScope22 -+ -+open Set -+ -+variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] -+ -+theorem Differentiable.divisor_nonneg {f : ℂ → E} (hf : Differentiable ℂ f) : -+ 0 ≤ MeromorphicOn.divisor f (univ : Set ℂ) := -+ MeromorphicOn.AnalyticOnNhd.divisor_nonneg (hf.differentiableOn.analyticOnNhd isOpen_univ) -+end HadamardSourceScope22 -+ -+section HadamardSourceScope23 -+ -+noncomputable section -+ -+open scoped BigOperators -+open Filter -+ -+namespace Real -+ -+open _root_.Real -+ -+lemma two_pow_floor_logb_le {x : ℝ} (hx : 1 ≤ x) : -+ (2 : ℝ) ^ (⌊Real.logb 2 x⌋₊ : ℝ) ≤ x := by -+ have hx0 : 0 < x := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hx -+ have hlog_nonneg : 0 ≤ Real.logb 2 x := -+ Real.logb_nonneg (b := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) hx -+ have hfloor_le : (⌊Real.logb 2 x⌋₊ : ℝ) ≤ Real.logb 2 x := by -+ simpa using (Nat.floor_le hlog_nonneg) -+ exact (Real.le_logb_iff_rpow_le (b := (2 : ℝ)) -+ (x := (⌊Real.logb 2 x⌋₊ : ℝ)) (y := x) -+ (by norm_num : (1 : ℝ) < 2) hx0).1 hfloor_le -+ -+lemma lt_two_pow_floor_logb_add_one {x : ℝ} (hx : 1 ≤ x) : -+ x < (2 : ℝ) ^ ((⌊Real.logb 2 x⌋₊ : ℝ) + 1) := by -+ have hx0 : 0 < x := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hx -+ have hlt : Real.logb 2 x < (⌊Real.logb 2 x⌋₊ : ℝ) + 1 := by -+ simpa using (Nat.lt_floor_add_one (Real.logb 2 x)) -+ exact (Real.logb_lt_iff_lt_rpow (b := (2 : ℝ)) (x := x) -+ (y := (⌊Real.logb 2 x⌋₊ : ℝ) + 1) -+ (by norm_num : (1 : ℝ) < 2) hx0).1 hlt -+ -+lemma dyadicShell_lower_bound {r0 x : ℝ} {k : ℕ} (hr0 : 0 < r0) (hx : r0 ≤ x) -+ (hk : ⌊Real.logb 2 (x / r0)⌋₊ = k) : -+ r0 * (2 : ℝ) ^ (k : ℝ) ≤ x := by -+ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 -+ have hx1 : (1 : ℝ) ≤ x / r0 := by -+ have : r0 / r0 ≤ x / r0 := div_le_div_of_nonneg_right hx hr0.le -+ simpa [hr0ne] using this -+ have hle : (2 : ℝ) ^ (k : ℝ) ≤ x / r0 := by -+ have := Real.two_pow_floor_logb_le (x := x / r0) hx1 -+ simpa [hk] using this -+ have := mul_le_mul_of_nonneg_left hle hr0.le -+ have hxEq : r0 * (x / r0) = x := by -+ field_simp [hr0ne] -+ simpa [mul_assoc, hxEq] using this -+ -+lemma dyadicShell_upper_bound {r0 x : ℝ} {k : ℕ} (hr0 : 0 < r0) (hx : r0 ≤ x) -+ (hk : ⌊Real.logb 2 (x / r0)⌋₊ = k) : -+ x ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1) := by -+ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 -+ have hx1 : (1 : ℝ) ≤ x / r0 := by -+ have : r0 / r0 ≤ x / r0 := div_le_div_of_nonneg_right hx hr0.le -+ simpa [hr0ne] using this -+ have hlt : x / r0 < (2 : ℝ) ^ ((k : ℝ) + 1) := by -+ have := Real.lt_two_pow_floor_logb_add_one (x := x / r0) hx1 -+ simpa [hk] using this -+ have := mul_lt_mul_of_pos_left hlt hr0 -+ have hxEq : r0 * (x / r0) = x := by -+ field_simp [hr0ne] -+ exact le_of_lt (by simpa [mul_assoc, hxEq] using this) -+ -+lemma exists_nat_le_two_pow (A : ℝ) : -+ ∃ k0 : ℕ, ∀ n ≥ k0, A ≤ (2 : ℝ) ^ n := by -+ have htend : Tendsto (fun n : ℕ => (2 : ℝ) ^ n) atTop atTop := -+ tendsto_pow_atTop_atTop_of_one_lt (r := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) -+ exact eventually_atTop.1 ((tendsto_atTop.1 htend) A) -+ -+lemma one_le_dyadicRadius_succ_of_inv_le_two_pow -+ {r0 : ℝ} {k0 kk : ℕ} (hr0 : 0 < r0) -+ (hk0 : ∀ n ≥ k0, (1 / r0 : ℝ) ≤ (2 : ℝ) ^ n) (hkk : k0 ≤ kk + 1) : -+ (1 : ℝ) ≤ r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) := by -+ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 -+ have hpow_nat : (1 / r0 : ℝ) ≤ (2 : ℝ) ^ (kk + 1) := hk0 (kk + 1) hkk -+ have hpow_rpow : (1 / r0 : ℝ) ≤ (2 : ℝ) ^ ((kk : ℝ) + 1) := by -+ have hcast : (2 : ℝ) ^ ((kk : ℝ) + 1) = (2 : ℝ) ^ (kk + 1) := by -+ calc -+ (2 : ℝ) ^ ((kk : ℝ) + 1) = (2 : ℝ) ^ ((kk + 1 : ℕ) : ℝ) := by -+ simp [Nat.cast_add, Nat.cast_one] -+ _ = (2 : ℝ) ^ (kk + 1) := by -+ simpa using (Real.rpow_natCast (2 : ℝ) (kk + 1)) -+ simpa [hcast] using hpow_nat -+ have : (r0 * (1 / r0) : ℝ) ≤ r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) := -+ mul_le_mul_of_nonneg_left hpow_rpow hr0.le -+ simpa [one_div, hr0ne, mul_assoc] using this -+ -+lemma one_add_abs_two_mul_dyadicRadius_rpow_le {r0 ρ : ℝ} (k : ℕ) -+ (hr0 : 0 < r0) (hρ : 0 ≤ ρ) : -+ (1 + |2 * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1))|) ^ ρ -+ ≤ (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by -+ let Rk : ℝ := r0 * (2 : ℝ) ^ ((k : ℝ) + 1) -+ have hRk' : |2 * Rk| = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by -+ have hnonneg : 0 ≤ (2 : ℝ) * Rk := by -+ have : 0 ≤ Rk := by -+ dsimp [Rk] -+ exact mul_nonneg hr0.le (le_of_lt (Real.rpow_pos_of_pos (by norm_num) _)) -+ nlinarith -+ have hmul : (2 : ℝ) * Rk = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by -+ dsimp [Rk] -+ calc -+ (2 : ℝ) * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) -+ = (2 * r0) * (2 : ℝ) ^ ((k : ℝ) + 1) := by ring -+ _ = (2 * r0) * ((2 : ℝ) ^ (k : ℝ) * (2 : ℝ) ^ (1 : ℝ)) := by -+ simp [Real.rpow_add, mul_assoc] -+ _ = (2 * r0) * ((2 : ℝ) ^ (k : ℝ) * 2) := by simp [Real.rpow_one] -+ _ = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by ring -+ calc -+ |2 * Rk| = 2 * Rk := abs_of_nonneg hnonneg -+ _ = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := hmul -+ have hbase : -+ (1 + |2 * Rk|) ≤ (1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ) := by -+ have h1 : (1 : ℝ) ≤ (2 : ℝ) ^ (k : ℝ) := by -+ have : (1 : ℝ) ≤ (2 : ℝ) ^ (k : ℕ) := by -+ simpa using (one_le_pow₀ (by norm_num : (1 : ℝ) ≤ (2 : ℝ))) -+ simpa [Real.rpow_natCast] using this -+ have habs : -+ 1 + |2 * Rk| ≤ (2 : ℝ) ^ (k : ℝ) + (4 * r0) * (2 : ℝ) ^ (k : ℝ) := by -+ rw [hRk'] -+ simpa [add_assoc, add_left_comm, add_comm, mul_assoc, mul_left_comm, mul_comm] using -+ (add_le_add_right h1 ((4 * r0) * (2 : ℝ) ^ (k : ℝ))) -+ have hfac : -+ (2 : ℝ) ^ (k : ℝ) + (4 * r0) * (2 : ℝ) ^ (k : ℝ) -+ = (1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ) := by -+ ring -+ exact habs.trans (le_of_eq hfac) -+ have hRnonneg : 0 ≤ (1 + |2 * Rk|) := by linarith [abs_nonneg (2 * Rk)] -+ have : -+ (1 + |2 * Rk|) ^ ρ ≤ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ := -+ Real.rpow_le_rpow hRnonneg hbase hρ -+ have hsplit : -+ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ -+ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ (k : ℝ)) ^ ρ := by -+ have h1 : 0 ≤ (1 + 4 * r0) := by nlinarith [hr0.le] -+ have h2 : 0 ≤ (2 : ℝ) ^ (k : ℝ) := -+ le_of_lt (Real.rpow_pos_of_pos (by norm_num) _) -+ simpa using (Real.mul_rpow h1 h2 (z := ρ)) -+ have hpow : ((2 : ℝ) ^ (k : ℝ)) ^ ρ = ((2 : ℝ) ^ ρ) ^ k := by -+ have h2nonneg : (0 : ℝ) ≤ 2 := by norm_num -+ calc -+ ((2 : ℝ) ^ (k : ℝ)) ^ ρ = (2 : ℝ) ^ ((k : ℝ) * ρ) := by -+ simp [Real.rpow_mul] -+ _ = ((2 : ℝ) ^ ρ) ^ (k : ℝ) := by -+ simpa [mul_comm] using -+ (Real.rpow_mul (x := (2 : ℝ)) (y := ρ) (z := (k : ℝ)) h2nonneg) -+ _ = ((2 : ℝ) ^ ρ) ^ k := by -+ simp [Real.rpow_natCast] -+ calc -+ (1 + |2 * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1))|) ^ ρ -+ = (1 + |2 * Rk|) ^ ρ := by rfl -+ _ ≤ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ := this -+ _ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ (k : ℝ)) ^ ρ := hsplit -+ _ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by -+ simpa [mul_assoc] using congrArg (fun t => (1 + 4 * r0) ^ ρ * t) hpow -+ -+lemma tsum_inv_rpow_le_card_mul_of_lower_bound {α : Type*} [Fintype α] {a : α → ℝ} -+ {R τ : ℝ} (hR : 0 < R) (hτ : 0 < τ) (ha_nonneg : ∀ x, 0 ≤ a x) -+ (ha_lower : ∀ x, R ≤ a x) : -+ (∑' x : α, (a x)⁻¹ ^ τ) ≤ (Fintype.card α : ℝ) * (R⁻¹ ^ τ) := by -+ have hsum_le : -+ (∑ x : α, (a x)⁻¹ ^ τ) ≤ ∑ _x : α, R⁻¹ ^ τ := by -+ refine Finset.sum_le_sum ?_ -+ intro x _hx -+ have hinv : (a x)⁻¹ ≤ R⁻¹ := by -+ simpa using (inv_anti₀ hR (ha_lower x)) -+ exact Real.rpow_le_rpow (inv_nonneg.2 (ha_nonneg x)) hinv hτ.le -+ simpa [tsum_fintype, Finset.sum_const, nsmul_eq_mul, mul_comm] using hsum_le -+ -+lemma inv_dyadicRadius_rpow_eq (r0 τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : -+ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = -+ (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by -+ have h2k_nonneg : 0 ≤ (2 : ℝ) ^ (k : ℝ) := -+ le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) -+ calc -+ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = -+ (r0 * (2 : ℝ) ^ (k : ℝ)) ^ (-τ) := by -+ simpa using (Real.rpow_neg_eq_inv_rpow (r0 * (2 : ℝ) ^ (k : ℝ)) τ).symm -+ _ = r0 ^ (-τ) * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) := by -+ simpa using (Real.mul_rpow hr0 h2k_nonneg (z := -τ)) -+ _ = (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by -+ have hr0' : r0 ^ (-τ) = (r0⁻¹ : ℝ) ^ τ := by -+ simp [Real.rpow_neg_eq_inv_rpow] -+ have h2' : ((2 : ℝ) ^ (k : ℝ)) ^ (-τ) = ((2 : ℝ) ^ (-τ)) ^ k := by -+ have h2nonneg : (0 : ℝ) ≤ (2 : ℝ) := by norm_num -+ calc -+ ((2 : ℝ) ^ (k : ℝ)) ^ (-τ) = (2 : ℝ) ^ ((k : ℝ) * (-τ)) := by -+ exact (Real.rpow_mul (x := (2 : ℝ)) (y := (k : ℝ)) (z := -τ) -+ h2nonneg).symm -+ _ = (2 : ℝ) ^ ((-τ) * (k : ℝ)) := by ring_nf -+ _ = ((2 : ℝ) ^ (-τ)) ^ (k : ℝ) := by -+ exact Real.rpow_mul (x := (2 : ℝ)) (y := -τ) (z := (k : ℝ)) h2nonneg -+ _ = ((2 : ℝ) ^ (-τ)) ^ k := by -+ simp [Real.rpow_natCast] -+ calc -+ r0 ^ (-τ) * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) -+ = (r0⁻¹ : ℝ) ^ τ * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) := by -+ rw [hr0'] -+ _ = (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by -+ rw [h2'] -+ -+lemma two_rpow_sub_eq_mul_neg (ρ τ : ℝ) : -+ (2 : ℝ) ^ (ρ - τ) = (2 : ℝ) ^ ρ * (2 : ℝ) ^ (-τ) := by -+ have h2pos : (0 : ℝ) < (2 : ℝ) := by norm_num -+ calc -+ (2 : ℝ) ^ (ρ - τ) = (2 : ℝ) ^ (ρ + (-τ)) := by ring_nf -+ _ = (2 : ℝ) ^ ρ * (2 : ℝ) ^ (-τ) := by -+ simp [Real.rpow_add h2pos] -+ -+lemma two_rpow_sub_pow_eq_mul_pow (ρ τ : ℝ) (k : ℕ) : -+ ((2 : ℝ) ^ (ρ - τ)) ^ k = -+ ((2 : ℝ) ^ ρ) ^ k * (((2 : ℝ) ^ (-τ)) ^ k) := by -+ simp [two_rpow_sub_eq_mul_neg, mul_pow] -+ -+lemma dyadic_growth_inv_term_eq (C L M r0 ρ τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : -+ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * -+ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ = (((C / L) * M) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (ρ - τ)) ^ k := by -+ have hrk_inv : -+ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = -+ (r0⁻¹ : ℝ) ^ τ * (((2 : ℝ) ^ (-τ)) ^ k) := -+ inv_dyadicRadius_rpow_eq r0 τ k hr0 -+ rw [hrk_inv, two_rpow_sub_pow_eq_mul_pow] -+ ac_rfl -+ -+lemma dyadic_trailing_inv_term_le (C L r0 τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : -+ (C / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ ≤ (((C / L) + 1) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (-τ)) ^ k := by -+ rw [inv_dyadicRadius_rpow_eq r0 τ k hr0] -+ have hcoeff : C / L ≤ C / L + 1 := by linarith -+ have hr0Inv_nonneg : 0 ≤ (r0⁻¹ : ℝ) ^ τ := -+ Real.rpow_nonneg (inv_nonneg.2 hr0) _ -+ have hmul : -+ (C / L) * ((r0⁻¹ : ℝ) ^ τ) -+ ≤ ((C / L) + 1) * ((r0⁻¹ : ℝ) ^ τ) := -+ mul_le_mul_of_nonneg_right hcoeff hr0Inv_nonneg -+ have hqpow_nonneg : 0 ≤ ((2 : ℝ) ^ (-τ)) ^ k := -+ pow_nonneg (le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _)) _ -+ have := mul_le_mul_of_nonneg_right hmul hqpow_nonneg -+ simpa [mul_assoc, mul_left_comm, mul_comm] using this -+ -+lemma dyadic_growth_mass_mul_inv_le_geometric {C L M X T Ctrail r0 ρ τ : ℝ} {k : ℕ} -+ (hL : 0 < L) (hC : 0 ≤ C) (hr0 : 0 ≤ r0) -+ (hX : X ≤ M * ((2 : ℝ) ^ ρ) ^ k) -+ (hT : T ≤ ((C * X + Ctrail) / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) : -+ T ≤ (((C / L) * M) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (ρ - τ)) ^ k -+ + (((Ctrail / L) + 1) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (-τ)) ^ k := by -+ have hmul : C * X ≤ C * (M * ((2 : ℝ) ^ ρ) ^ k) := -+ mul_le_mul_of_nonneg_left hX hC -+ have hnum : C * X + Ctrail ≤ C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail := -+ add_le_add hmul le_rfl -+ have hdiv : -+ (C * X + Ctrail) / L ≤ (C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L := -+ div_le_div_of_nonneg_right hnum hL.le -+ have h2k_nonneg : 0 ≤ (2 : ℝ) ^ (k : ℝ) := -+ le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) (k : ℝ)) -+ have hrk_nonneg : 0 ≤ r0 * (2 : ℝ) ^ (k : ℝ) := -+ mul_nonneg hr0 h2k_nonneg -+ have hfactor_nonneg : 0 ≤ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) := -+ Real.rpow_nonneg (inv_nonneg.2 hrk_nonneg) τ -+ have hmul' := -+ mul_le_mul_of_nonneg_right hdiv hfactor_nonneg -+ have hdecomp : -+ ((C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L) * -+ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ = -+ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * -+ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ + ((Ctrail / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) := by -+ let Y : ℝ := (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ -+ have : -+ ((C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L) * Y -+ = ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * Y -+ + ((Ctrail / L) * Y) := by -+ ring -+ simpa [Y] -+ have hpre : -+ T ≤ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * -+ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ + ((Ctrail / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) := -+ hT.trans (hmul'.trans_eq hdecomp) -+ have hA := le_of_eq (dyadic_growth_inv_term_eq C L M r0 ρ τ k hr0) -+ have hB := dyadic_trailing_inv_term_le Ctrail L r0 τ k hr0 -+ exact hpre.trans (by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using add_le_add hA hB) -+ -+lemma two_geometric_shift_add (A B q qσ : ℝ) (k k0 : ℕ) : -+ A * q ^ (k + k0) + B * qσ ^ (k + k0) -+ = (A * q ^ k0) * q ^ k + (B * qσ ^ k0) * qσ ^ k := by -+ rw [pow_add, pow_add] -+ ac_rfl -+ -+end Real -+end -+end HadamardSourceScope23 -+ -+section HadamardSourceScope24 -+ -+noncomputable section -+ -+open Filter Topology Set _root_.Complex _root_.Erdos970.Complex -+open scoped BigOperators Topology -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+open scoped _root_.Real -+ -+noncomputable def divisorMassClosedBall₀ (f : ℂ → ℂ) (R : ℝ) : ℝ := -+ Function.locallyFinsuppWithin.massClosedBall₀ (MeromorphicOn.divisor f (Set.univ : Set ℂ)) R -+ -+lemma divisorMassClosedBall₀_le_of_growth {f : ℂ → ℂ} {ρ C : ℝ} -+ (hf : Differentiable ℂ f) -+ (hC : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) -+ {R : ℝ} (hR : 1 ≤ R) : -+ divisorMassClosedBall₀ f R -+ ≤ (C * (1 + |2 * R|) ^ ρ + |Real.log ‖meromorphicTrailingCoeffAt f 0‖|) / -+ Real.log 2 := by -+ simpa [divisorMassClosedBall₀] using -+ (Function.locallyFinsuppWithin.massClosedBall₀_divisor_le_of_log_growth -+ (f := f) (ρ := ρ) (C := C) hf hC hR) -+ -+lemma exists_r0_le_norm_divisorZeroIndex₀Val {f : ℂ → ℂ} -+ (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) : -+ ∃ r0 : ℝ, 0 < r0 ∧ -+ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖ := by -+ classical -+ set U : Set ℂ := (Set.univ : Set ℂ) -+ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U -+ have hDnonneg : 0 ≤ D := by -+ simpa [D, U] using (Differentiable.divisor_nonneg (f := f) hf) -+ have hzero : ∀ p : divisorZeroIndex₀ f U, f (divisorZeroIndex₀Val p) = 0 := by -+ intro p -+ set z : ℂ := divisorZeroIndex₀Val p -+ have hneTop : meromorphicOrderAt f z ≠ ⊤ := by -+ have hzAnal : AnalyticAt ℂ f z := hf.analyticAt z -+ have hzA : analyticOrderAt f z ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) (hf := hf) hnot (z := z) -+ intro htop -+ have hm : meromorphicOrderAt f z = (analyticOrderAt f z).map (↑) := -+ hzAnal.meromorphicOrderAt_eq (𝕜 := ℂ) -+ cases h : analyticOrderAt f z with -+ | top => -+ exact hzA (by simp [h]) -+ | coe n => -+ have : (analyticOrderAt f z).map (↑) ≠ (⊤ : WithTop ℤ) := by -+ simp [h] -+ exact this (by simpa [hm] using htop) -+ have hmon : MeromorphicOn f U := by -+ intro w hw; exact (hf.analyticAt w).meromorphicAt -+ have hdiv : MeromorphicOn.divisor f U z = (meromorphicOrderAt f z).untop₀ := by -+ simpa [U] using (MeromorphicOn.divisor_apply (f := f) (U := U) (z := z) hmon (by aesop)) -+ have hDz : MeromorphicOn.divisor f U z ≠ 0 := by -+ have hzsup : z ∈ (MeromorphicOn.divisor f U).support := by -+ simp [z] -+ simpa [Function.mem_support] using hzsup -+ have hposZ : (0 : ℤ) < (meromorphicOrderAt f z).untop₀ := by -+ have hge0 : 0 ≤ (meromorphicOrderAt f z).untop₀ := by -+ have : 0 ≤ MeromorphicOn.divisor f U z := by -+ simpa [D, U, z] using hDnonneg z -+ simpa [hdiv] using this -+ have hne0 : (meromorphicOrderAt f z).untop₀ ≠ 0 := by -+ simpa [hdiv] using hDz -+ exact lt_of_le_of_ne hge0 (by simpa [eq_comm] using hne0) -+ have hpos : (0 : WithTop ℤ) < meromorphicOrderAt f z := by -+ have : (0 : WithTop ℤ) < ((meromorphicOrderAt f z).untop₀ : WithTop ℤ) := -+ WithTop.coe_lt_coe.2 hposZ -+ simpa [WithTop.coe_untop₀_of_ne_top hneTop] using this -+ have htend0 : Tendsto f (𝓝[≠] z) (𝓝 (0 : ℂ)) := -+ tendsto_zero_of_meromorphicOrderAt_pos (f := f) (x := z) hpos -+ have hcontz : ContinuousAt f z := (hf z).continuousAt -+ have htendz : Tendsto f (𝓝[≠] z) (𝓝 (f z)) := -+ (hcontz.tendsto.mono_left (nhdsWithin_le_nhds : 𝓝[≠] z ≤ 𝓝 z)) -+ exact tendsto_nhds_unique htendz htend0 -+ by_cases h0 : f 0 = 0 -+ · have hD0 : D 0 ≠ 0 := by -+ have hmero0 : MeromorphicAt f (0 : ℂ) := (hf.analyticAt 0).meromorphicAt -+ have hneTop0 : meromorphicOrderAt f (0 : ℂ) ≠ ⊤ := by -+ have hA0 : analyticOrderAt f (0 : ℂ) ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) (hf := hf) hnot (z := 0) -+ intro htop -+ have hm : meromorphicOrderAt f (0 : ℂ) = (analyticOrderAt f (0 : ℂ)).map (↑) := -+ (hf.analyticAt 0).meromorphicOrderAt_eq (𝕜 := ℂ) -+ cases h : analyticOrderAt f (0 : ℂ) with -+ | top => exact (hA0 h).elim -+ | coe n => -+ have : (analyticOrderAt f (0 : ℂ)).map (↑) ≠ (⊤ : WithTop ℤ) := by -+ simp [h] -+ exact this (by simpa [hm] using htop) -+ have htend0 : Tendsto f (𝓝[≠] (0 : ℂ)) (𝓝 (0 : ℂ)) := by -+ have hcont0 : ContinuousAt f (0 : ℂ) := (hf 0).continuousAt -+ have : Tendsto f (𝓝 (0 : ℂ)) (𝓝 (0 : ℂ)) := by simpa [h0] using hcont0.tendsto -+ exact this.mono_left (nhdsWithin_le_nhds : 𝓝[≠] (0 : ℂ) ≤ 𝓝 (0 : ℂ)) -+ have hpos0 : (0 : WithTop ℤ) < meromorphicOrderAt f (0 : ℂ) := -+ (tendsto_zero_iff_meromorphicOrderAt_pos hmero0).1 htend0 -+ have hpos0' : (0 : ℤ) < (meromorphicOrderAt f (0 : ℂ)).untop₀ := by -+ have : (0 : WithTop ℤ) < ((meromorphicOrderAt f (0 : ℂ)).untop₀ : WithTop ℤ) := by -+ simpa [WithTop.coe_untop₀_of_ne_top hneTop0] using hpos0 -+ simpa using (WithTop.coe_lt_coe.1 this) -+ have hdiv0 : D 0 = (meromorphicOrderAt f (0 : ℂ)).untop₀ := by -+ have hmon : MeromorphicOn f U := by -+ intro w hw; exact (hf.analyticAt w).meromorphicAt -+ simpa [D, U] using -+ (MeromorphicOn.divisor_apply (f := f) (U := U) (z := (0 : ℂ)) -+ hmon (by aesop)) -+ exact by -+ have : (meromorphicOrderAt f (0 : ℂ)).untop₀ ≠ 0 := ne_of_gt hpos0' -+ simpa [hdiv0] using this -+ have hmem0 : (0 : ℂ) ∈ D.support := by -+ simp [Function.mem_support, hD0] -+ have hdisc : IsDiscrete D.support := by -+ simpa [D] using (D.discreteSupport) -+ rcases Metric.exists_ball_inter_eq_singleton_of_mem_discrete hdisc hmem0 with ⟨r0, hr0pos, hr0⟩ -+ refine ⟨r0, hr0pos, ?_⟩ -+ intro p -+ have hp : divisorZeroIndex₀Val p ∈ D.support := by -+ simp [D, divisorZeroIndex₀Val_mem_divisor_support (f := f) (U := U) p] -+ have hnotBall : divisorZeroIndex₀Val p ∉ Metric.ball (0 : ℂ) r0 := by -+ intro hball -+ have : divisorZeroIndex₀Val p ∈ Metric.ball (0 : ℂ) r0 ∩ D.support := ⟨hball, hp⟩ -+ have : divisorZeroIndex₀Val p ∈ ({(0 : ℂ)} : Set ℂ) := by simp [hr0] at this -+ have : divisorZeroIndex₀Val p = 0 := by simp [Set.mem_singleton_iff] at this -+ exact (divisorZeroIndex₀Val_ne_zero p) this -+ have : r0 ≤ ‖divisorZeroIndex₀Val p‖ := by -+ have : ¬ ‖divisorZeroIndex₀Val p‖ < r0 := by -+ intro hlt -+ exact hnotBall (by simpa [Metric.mem_ball, dist_zero_right] using hlt) -+ exact le_of_not_gt this -+ exact this -+ · have hcont0 : ContinuousAt f (0 : ℂ) := (hf 0).continuousAt -+ have hne : ∀ᶠ z in 𝓝 (0 : ℂ), f z ≠ 0 := hcont0.eventually_ne h0 -+ rcases Metric.mem_nhds_iff.1 hne with ⟨r0, hr0pos, hr0⟩ -+ refine ⟨r0, hr0pos, ?_⟩ -+ intro p -+ have : ¬ ‖divisorZeroIndex₀Val p‖ < r0 := by -+ intro hlt -+ have hzball : divisorZeroIndex₀Val p ∈ Metric.ball (0 : ℂ) r0 := by -+ simpa [Metric.mem_ball, dist_zero_right] using hlt -+ have : f (divisorZeroIndex₀Val p) ≠ 0 := hr0 hzball -+ exact this (hzero p) -+ exact le_of_not_gt this -+ -+open scoped BigOperators -+ -+lemma card_ball_le_divisorMassClosedBall₀ -+ {f : ℂ → ℂ} (hf : Differentiable ℂ f) {R : ℝ} (hR : 0 < R) : -+ (Nat.card {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) -+ ≤ divisorMassClosedBall₀ f R := by -+ set U : Set ℂ := (Set.univ : Set ℂ) -+ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U -+ have : -+ Fintype {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} := by -+ have : Finite {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} := by -+ have : Metric.closedBall (0 : ℂ) R ⊆ U := by simp [U] -+ simpa using (finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := U) (B := R) this) -+ exact Fintype.ofFinite _ -+ have hDnonneg : 0 ≤ D := by -+ simpa [D, U] using (Differentiable.divisor_nonneg (f := f) hf) -+ let SR : Finset ℂ := -+ (Function.locallyFinsuppWithin.finiteSupport (Function.locallyFinsuppWithin.toClosedBall R D) -+ (isCompact_closedBall (0 : ℂ) |R|)).toFinset -+ let S : Finset ℂ := SR.filter fun z : ℂ => z ≠ 0 -+ let T : Type := -+ Σ z : S, Fin (Int.toNat (D z.1)) -+ let φ : -+ {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} → T := fun p => -+ let z0 : ℂ := divisorZeroIndex₀Val p.1 -+ have hz0_memSR : z0 ∈ SR := by -+ have hz0_norm : ‖z0‖ ≤ |R| := by -+ have : ‖z0‖ ≤ R := p.2 -+ simpa [abs_of_pos hR] using this -+ have hz0_support : z0 ∈ (Function.locallyFinsuppWithin.toClosedBall R D).support := by -+ have hz0_suppD : z0 ∈ D.support := by -+ simp [z0, D] -+ exact Function.locallyFinsuppWithin.mem_toClosedBall_support_of_mem_support_of_norm_le_abs -+ hz0_suppD hz0_norm -+ exact (Set.Finite.mem_toFinset -+ (Function.locallyFinsuppWithin.finiteSupport -+ (Function.locallyFinsuppWithin.toClosedBall R D) -+ (isCompact_closedBall (0 : ℂ) |R|))).2 hz0_support -+ have hz0_ne0 : z0 ≠ 0 := divisorZeroIndex₀Val_ne_zero p.1 -+ have hz0_memS : z0 ∈ S := Finset.mem_filter.2 ⟨hz0_memSR, hz0_ne0⟩ -+ ⟨⟨z0, hz0_memS⟩, by -+ simpa [z0, divisorZeroIndex₀Val, D] using p.1.1.2⟩ -+ have hφ_inj : Function.Injective φ := by -+ intro p q hpq -+ have hσ := (Sigma.mk.inj_iff).1 hpq -+ have hzS : (φ p).1 = (φ q).1 := hσ.1 -+ have hz : divisorZeroIndex₀Val p.1 = divisorZeroIndex₀Val q.1 := by -+ simpa [φ] using congrArg Subtype.val hzS -+ apply Subtype.ext -+ apply Subtype.ext -+ apply Sigma.ext -+ · exact hz -+ · simpa [φ] using hσ.2 -+ have hcard_le : -+ Fintype.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} ≤ Fintype.card T := -+ Fintype.card_le_of_injective φ hφ_inj -+ have hT_card : -+ (Fintype.card T : ℝ) = -+ (S.sum fun z : ℂ => (Int.toNat (D z) : ℝ)) := by -+ have hNat : -+ Fintype.card T = ∑ z : S, Int.toNat (D z.1) := by -+ have h1 : -+ Fintype.card T = ∑ z : S, Fintype.card (Fin (Int.toNat (D z.1))) := by -+ change Fintype.card (Sigma (fun z : S => Fin (Int.toNat (D z.1)))) -+ = ∑ z : S, Fintype.card (Fin (Int.toNat (D z.1))) -+ exact (Fintype.card_sigma (ι := S) (α := fun z : S => Fin (Int.toNat (D z.1)))) -+ simpa using h1 -+ have hR : -+ (Fintype.card T : ℝ) = ∑ z : S, (Int.toNat (D z.1) : ℝ) := by -+ exact_mod_cast hNat -+ have hR' : -+ (Fintype.card T : ℝ) = S.attach.sum (fun z : S => (Int.toNat (D z.1) : ℝ)) := by -+ simpa [Finset.univ_eq_attach] using hR -+ calc -+ (Fintype.card T : ℝ) = S.attach.sum (fun z : S => (Int.toNat (D z.1) : ℝ)) := hR' -+ _ = S.sum (fun z : ℂ => (Int.toNat (D z) : ℝ)) := by -+ simpa using (Finset.sum_attach (s := S) (f := fun z : ℂ => (Int.toNat (D z) : ℝ))) -+ have htoNat_le : ∀ z ∈ S, (Int.toNat (D z) : ℝ) ≤ (D z : ℝ) := by -+ intro z hz -+ have hDz_nonneg : 0 ≤ D z := by simpa [D] using hDnonneg z -+ have hEqZ : ((Int.toNat (D z) : ℕ) : ℤ) = D z := by -+ simpa using (Int.toNat_of_nonneg hDz_nonneg) -+ have hEqR : (Int.toNat (D z) : ℝ) = (D z : ℝ) := by -+ exact_mod_cast hEqZ -+ exact le_of_eq hEqR -+ calc -+ (Nat.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) -+ = (Fintype.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) := by -+ simp [Nat.card_eq_fintype_card] -+ _ ≤ (Fintype.card T : ℝ) := by exact_mod_cast hcard_le -+ _ = S.sum (fun z : ℂ => (Int.toNat (D z) : ℝ)) := hT_card -+ _ ≤ S.sum (fun z : ℂ => (D z : ℝ)) := by -+ refine Finset.sum_le_sum ?_ -+ intro z hz -+ exact htoNat_le z hz -+ _ = divisorMassClosedBall₀ f R := by -+ rfl -+ -+lemma card_subtype_le_divisorMassClosedBall₀_of_norm_le -+ {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ {s : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))} [Fintype s] -+ {R : ℝ} (hR : 0 < R) (hs : ∀ p : s, ‖divisorZeroIndex₀Val p.1‖ ≤ R) : -+ (Fintype.card s : ℝ) ≤ divisorMassClosedBall₀ f R := by -+ let Aball : Type := -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) // ‖divisorZeroIndex₀Val p‖ ≤ R} -+ have : Fintype Aball := by -+ have : Finite Aball := by -+ have : Metric.closedBall (0 : ℂ) R ⊆ (Set.univ : Set ℂ) := by simp -+ simpa [Aball] using -+ (finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := (Set.univ : Set ℂ)) -+ (B := R) this) -+ exact Fintype.ofFinite _ -+ have hinj : Function.Injective (fun p : s => (⟨p.1, hs p⟩ : Aball)) := by -+ intro p q hpq -+ apply Subtype.ext -+ exact congrArg (fun x : Aball => x.1) hpq -+ have hcard_le : Fintype.card s ≤ Fintype.card Aball := -+ Fintype.card_le_of_injective _ hinj -+ have hAball : (Nat.card Aball : ℝ) ≤ divisorMassClosedBall₀ f R := by -+ simpa [Aball] using card_ball_le_divisorMassClosedBall₀ (f := f) hf hR -+ calc -+ (Fintype.card s : ℝ) ≤ (Fintype.card Aball : ℝ) := by exact_mod_cast hcard_le -+ _ = (Nat.card Aball : ℝ) := by simp [Nat.card_eq_fintype_card] -+ _ ≤ divisorMassClosedBall₀ f R := hAball -+ -+lemma divisorZeroIndex₀_dyadicShell_upper_bound -+ {f : ℂ → ℂ} {r0 : ℝ} -+ (hr0pos : 0 < r0) -+ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) -+ {k : ℕ} {p : divisorZeroIndex₀ f (Set.univ : Set ℂ)} -+ (hp : ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k) : -+ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1) := by -+ exact Real.dyadicShell_upper_bound (r0 := r0) (x := ‖divisorZeroIndex₀Val p‖) -+ hr0pos (hr0 p) hp -+ -+lemma divisorZeroIndex₀_dyadicShell_lower_bound -+ {f : ℂ → ℂ} {r0 : ℝ} -+ (hr0pos : 0 < r0) -+ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) -+ {k : ℕ} {p : divisorZeroIndex₀ f (Set.univ : Set ℂ)} -+ (hp : ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k) : -+ r0 * (2 : ℝ) ^ (k : ℝ) ≤ ‖divisorZeroIndex₀Val p‖ := by -+ exact Real.dyadicShell_lower_bound (r0 := r0) (x := ‖divisorZeroIndex₀Val p‖) -+ hr0pos (hr0 p) hp -+ -+lemma finite_divisorZeroIndex₀_dyadicShell -+ {f : ℂ → ℂ} {r0 : ℝ} -+ (hr0pos : 0 < r0) -+ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) -+ (k : ℕ) : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k} : Set _).Finite := by -+ have hsub : -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k} ⊆ -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)} := by -+ intro p hp -+ exact divisorZeroIndex₀_dyadicShell_upper_bound hr0pos hr0 hp -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)} : Set _).Finite := by -+ have : -+ Metric.closedBall (0 : ℂ) (r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) ⊆ -+ (Set.univ : Set ℂ) := by -+ simp -+ simpa using -+ (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) -+ (B := r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) this) -+ exact hfin.subset hsub -+ -+lemma tsum_divisorZeroIndex₀_dyadicShell_inv_rpow_le_geometric_of_growth -+ {f : ℂ → ℂ} {ρ τ r0 Cgrow : ℝ} -+ (hρ : 0 ≤ ρ) (hτpos : 0 < τ) (hf : Differentiable ℂ f) -+ (hCgrow_pos : 0 < Cgrow) -+ (hCgrow : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ Cgrow * (1 + ‖z‖) ^ ρ) -+ (hr0pos : 0 < r0) -+ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ r0 ≤ ‖divisorZeroIndex₀Val p‖) -+ (k : ℕ) (hk_ge_one : 1 ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) : -+ let kfun : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℕ := -+ fun p => ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ -+ let S : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := {p | kfun p = k} -+ let Ctrail : ℝ := |Real.log ‖meromorphicTrailingCoeffAt f 0‖| -+ let A : ℝ := ((Cgrow / Real.log 2) * (1 + 4 * r0) ^ ρ) * (r0⁻¹) ^ τ -+ let B : ℝ := ((Ctrail / Real.log 2) + 1) * (r0⁻¹) ^ τ -+ let q : ℝ := (2 : ℝ) ^ (ρ - τ) -+ let qσ : ℝ := (2 : ℝ) ^ (-τ) -+ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ≤ A * q ^ k + B * qσ ^ k := by -+ classical -+ intro kfun S Ctrail A B q qσ -+ let rk : ℝ := r0 * (2 : ℝ) ^ (k : ℝ) -+ let Rk : ℝ := r0 * (2 : ℝ) ^ ((k : ℝ) + 1) -+ have hrk_pos : 0 < rk := mul_pos hr0pos (Real.rpow_pos_of_pos (by norm_num) _) -+ have hrk0 : 0 ≤ rk := le_of_lt hrk_pos -+ have : Finite S := by -+ simpa [S, kfun] using (finite_divisorZeroIndex₀_dyadicShell -+ (f := f) hr0pos hr0 k).to_subtype -+ have : Fintype S := Fintype.ofFinite S -+ have hk_upper : ∀ p : S, ‖divisorZeroIndex₀Val p.1‖ ≤ Rk := by -+ intro p -+ have hk' : kfun p.1 = k := p.2 -+ simpa [Rk, kfun] using -+ divisorZeroIndex₀_dyadicShell_upper_bound (f := f) hr0pos hr0 hk' -+ have hk_lower : ∀ p : S, rk ≤ ‖divisorZeroIndex₀Val p.1‖ := by -+ intro p -+ have hk' : kfun p.1 = k := p.2 -+ simpa [rk, kfun] using -+ divisorZeroIndex₀_dyadicShell_lower_bound (f := f) hr0pos hr0 hk' -+ have htsum_le : -+ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) -+ ≤ (Fintype.card S : ℝ) * (rk⁻¹ ^ τ) := by -+ exact Real.tsum_inv_rpow_le_card_mul_of_lower_bound -+ (a := fun p : S => ‖divisorZeroIndex₀Val p.1‖) -+ hrk_pos hτpos (fun _ => norm_nonneg _) hk_lower -+ have hmass_le_growth : -+ divisorMassClosedBall₀ f Rk -+ ≤ (Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2) := by -+ simpa [Ctrail, Rk] using -+ (divisorMassClosedBall₀_le_of_growth (f := f) (ρ := ρ) (C := Cgrow) hf hCgrow -+ (R := Rk) hk_ge_one) -+ have hcard_le_mass : -+ (Fintype.card S : ℝ) ≤ divisorMassClosedBall₀ f Rk := by -+ have hRk_pos : 0 < Rk := lt_of_lt_of_le (by norm_num) hk_ge_one -+ exact card_subtype_le_divisorMassClosedBall₀_of_norm_le (f := f) hf hRk_pos hk_upper -+ have htsum' : -+ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) -+ ≤ ((Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2)) * (rk⁻¹ ^ τ) := by -+ have hcard_le_growth : -+ (Fintype.card S : ℝ) ≤ -+ (Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2) := -+ le_trans hcard_le_mass hmass_le_growth -+ exact le_trans htsum_le <| -+ mul_le_mul_of_nonneg_right hcard_le_growth (Real.rpow_nonneg (inv_nonneg.2 hrk0) τ) -+ have hpow_bound : -+ (1 + |2 * Rk|) ^ ρ ≤ (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by -+ simpa [Rk] using -+ Real.one_add_abs_two_mul_dyadicRadius_rpow_le (r0 := r0) (ρ := ρ) k hr0pos hρ -+ have hlog2pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) -+ simpa [A, B, q, qσ, rk, Ctrail, mul_assoc, mul_left_comm, mul_comm] using -+ Real.dyadic_growth_mass_mul_inv_le_geometric -+ (C := Cgrow) (L := Real.log 2) (M := (1 + 4 * r0) ^ ρ) -+ (X := (1 + |2 * Rk|) ^ ρ) -+ (T := ∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) -+ (Ctrail := Ctrail) (r0 := r0) (ρ := ρ) (τ := τ) (k := k) -+ hlog2pos hCgrow_pos.le hr0pos.le hpow_bound -+ (by simpa [rk] using htsum') -+ -+theorem summable_norm_inv_rpow_divisorZeroIndex₀_of_growth {f : ℂ → ℂ} {ρ τ : ℝ} -+ (hρ : 0 ≤ ρ) (hτ : ρ < τ) (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by -+ rcases hgrowth with ⟨Cgrow, hCgrow_pos, hCgrow⟩ -+ have hτpos : 0 < τ := lt_of_le_of_lt hρ hτ -+ rcases exists_r0_le_norm_divisorZeroIndex₀Val (f := f) hf hnot with ⟨r0, hr0pos, hr0⟩ -+ have hr0ne : (r0 : ℝ) ≠ 0 := ne_of_gt hr0pos -+ let kfun : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℕ := -+ fun p => ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ -+ let S : ℕ → Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ fun k => {p | kfun p = k} -+ have hS : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ∃! k : ℕ, p ∈ S k := by -+ intro p -+ refine ⟨kfun p, ?_, ?_⟩ -+ · simp [S] -+ · intro k hk -+ simpa [S] using hk.symm -+ have hnonneg : 0 ≤ fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ intro p -+ exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ -+ have hSk_summable : ∀ k : ℕ, Summable fun p : S k => ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by -+ intro k -+ have : Finite (S k) := by -+ simpa [S, kfun] using (finite_divisorZeroIndex₀_dyadicShell -+ (f := f) hr0pos hr0 k).to_subtype -+ exact Summable.of_finite -+ have hshell_summable : -+ Summable fun k : ℕ => ∑' p : S k, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by -+ let q : ℝ := (2 : ℝ) ^ (ρ - τ) -+ let qσ : ℝ := (2 : ℝ) ^ (-τ) -+ have hq_nonneg : 0 ≤ q := le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) -+ have hq_lt_one : q < 1 := -+ Real.rpow_lt_one_of_one_lt_of_neg (x := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) -+ (sub_neg.2 hτ) -+ have hqσ_nonneg : 0 ≤ qσ := le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) -+ have hqσ_lt_one : qσ < 1 := -+ Real.rpow_lt_one_of_one_lt_of_neg (x := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) -+ (by simpa using (neg_neg_of_pos hτpos)) -+ have hgeom_q : Summable (fun k : ℕ => q ^ k) := -+ summable_geometric_of_lt_one hq_nonneg hq_lt_one -+ have hgeom_qσ : Summable (fun k : ℕ => qσ ^ k) := -+ summable_geometric_of_lt_one hqσ_nonneg hqσ_lt_one -+ let Ctrail : ℝ := |Real.log ‖meromorphicTrailingCoeffAt f 0‖| -+ let A : ℝ := ((Cgrow / Real.log 2) * (1 + 4 * r0) ^ ρ) * (r0⁻¹) ^ τ -+ let B : ℝ := ((Ctrail / Real.log 2) + 1) * (r0⁻¹) ^ τ -+ rcases Real.exists_nat_le_two_pow (1 / r0) with ⟨k0, hk0⟩ -+ let A0 : ℝ := A * q ^ k0 -+ let B0 : ℝ := B * qσ ^ k0 -+ have hmajor : Summable (fun k : ℕ => A0 * q ^ k + B0 * qσ ^ k) := -+ (hgeom_q.mul_left A0).add (hgeom_qσ.mul_left B0) -+ have hshell_summable_shift : -+ Summable fun k : ℕ => ∑' p : S (k + k0), ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by -+ refine hmajor.of_nonneg_of_le -+ (fun k => by -+ have : ∀ p : S (k + k0), 0 ≤ ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by -+ intro p; exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ -+ exact tsum_nonneg this) -+ (fun k => by -+ let kk : ℕ := k + k0 -+ let Rk : ℝ := r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) -+ have hRk_ge_one : (1 : ℝ) ≤ Rk := by -+ have hkk : k0 ≤ kk + 1 := by -+ simp [kk, Nat.add_assoc, Nat.add_comm] -+ simpa [Rk] using -+ Real.one_le_dyadicRadius_succ_of_inv_le_two_pow hr0pos hk0 hkk -+ have hmain : -+ (∑' p : S kk, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ≤ A * q ^ kk + B * qσ ^ kk := by -+ simpa [S, kfun, Ctrail, A, B, q, qσ] using -+ tsum_divisorZeroIndex₀_dyadicShell_inv_rpow_le_geometric_of_growth -+ (f := f) (ρ := ρ) (τ := τ) hρ hτpos hf hCgrow_pos hCgrow hr0pos hr0 kk hRk_ge_one -+ have : A * q ^ kk + B * qσ ^ kk = A0 * q ^ k + B0 * qσ ^ k := by -+ simpa [A0, B0, kk] using Real.two_geometric_shift_add A B q qσ k k0 -+ simpa [kk] using (hmain.trans_eq this) -+ ) -+ exact (summable_nat_add_iff k0).1 hshell_summable_shift -+ have hpart := -+ (summable_partition (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) hnonneg (s := S) hS) -+ exact (hpart.2 ⟨hSk_summable, hshell_summable⟩) -+ -+theorem summable_norm_inv_pow_divisorZeroIndex₀_of_growth {f : ℂ → ℂ} {ρ : ℝ} -+ (hρ : 0 ≤ ρ) (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (Nat.floor ρ + 1)) := by -+ have hτ : ρ < (Nat.floor ρ + 1 : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one] using (Nat.lt_floor_add_one (a := ρ)) -+ have hs := -+ summable_norm_inv_rpow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) -+ (τ := (Nat.floor ρ + 1 : ℝ)) hρ hτ hf hnot hgrowth -+ exact hs.congr fun p => by -+ have hcast : ((Nat.floor ρ : ℝ) + 1) = ((Nat.floor ρ + 1 : ℕ) : ℝ) := by -+ norm_num -+ rw [hcast, Real.rpow_natCast] -+ -+end Complex.Hadamard -+end -+end HadamardSourceScope24 -+ -+section HadamardSourceScope25 -+ -+namespace Complex -+ -+open _root_.Complex -+ -+variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F] -+ -+theorem norm_le_of_mem_ball_of_forall_sphere_norm_le {f : ℂ → F} {r C : ℝ} {z : ℂ} -+ (hd : Differentiable ℂ f) (hrpos : 0 < r) -+ (hz : z ∈ Metric.ball (0 : ℂ) r) (hsphere : ∀ u : ℂ, ‖u‖ = r → ‖f u‖ ≤ C) : -+ ‖f z‖ ≤ C := by -+ let U : Set ℂ := Metric.ball (0 : ℂ) r -+ have hfront : ∀ u ∈ frontier U, ‖f u‖ ≤ C := by -+ intro u hu -+ have hur : ‖u‖ = r := by -+ have hfront' : frontier (Metric.ball (0 : ℂ) r) = Metric.sphere (0 : ℂ) r := by -+ simpa using (frontier_ball (x := (0 : ℂ)) (r := r) (ne_of_gt hrpos)) -+ have : u ∈ Metric.sphere (0 : ℂ) r := by simpa [U, hfront'] using hu -+ simpa [Metric.mem_sphere, dist_zero_right] using this -+ exact hsphere u hur -+ exact norm_le_of_forall_mem_frontier_norm_le (f := f) (U := U) Metric.isBounded_ball -+ hd.diffContOnCl hfront (subset_closure hz) -+ -+end Complex -+end HadamardSourceScope25 -+ -+section HadamardSourceScope26 -+ -+namespace Complex -+ -+open _root_.Complex -+namespace CartanBound -+ -+open _root_.Real _root_.Erdos970.Real MeasureTheory intervalIntegral -+open scoped Topology ENNReal -+ -+private lemma neg_log_le_sqrt_two_div {x : ℝ} (hx : 0 < x) (hxle : x ≤ 1) : -+ -Real.log x ≤ Real.sqrt (2 / x) := by -+ have hx0 : 0 ≤ x := le_of_lt hx -+ have ht : 0 ≤ -Real.log x := by -+ have : Real.log x ≤ 0 := Real.log_nonpos hx0 hxle -+ linarith -+ have hsq_div_two_le_exp : ∀ {t : ℝ}, 0 ≤ t → t ^ 2 / 2 ≤ Real.exp t := by -+ intro t ht -+ let g : ℝ → ℝ := fun u => Real.exp u - u ^ 2 / 2 -+ have hg_cont : ContinuousOn g (Set.Ici (0 : ℝ)) := by -+ have : Continuous g := by fun_prop -+ simpa using this.continuousOn -+ have hg_diff : DifferentiableOn ℝ g (interior (Set.Ici (0 : ℝ))) := by -+ intro u hu -+ have : DifferentiableAt ℝ g u := by fun_prop -+ exact this.differentiableWithinAt -+ have hg'_nonneg : ∀ u ∈ interior (Set.Ici (0 : ℝ)), 0 ≤ deriv g u := by -+ intro u hu -+ have hu0 : 0 < u := by simpa [interior_Ici] using hu -+ have hderiv : deriv g u = Real.exp u - u := by -+ have hExp : HasDerivAt Real.exp (Real.exp u) u := Real.hasDerivAt_exp u -+ have hpow2 : HasDerivAt (fun z : ℝ => z ^ 2) (2 * u) u := by -+ simpa using! ((hasDerivAt_id u).pow 2) -+ have hpow2_div : HasDerivAt (fun z : ℝ => z ^ 2 / 2) u u := by -+ simpa using (hpow2.div_const (2 : ℝ)) -+ have hG : HasDerivAt g (Real.exp u - u) u := by -+ simpa [g] using! hExp.sub hpow2_div -+ exact hG.deriv -+ have hu_le : u ≤ Real.exp u := by -+ have h1 : u + 1 ≤ Real.exp u := Real.add_one_le_exp u -+ exact (le_trans (le_add_of_nonneg_right (by norm_num)) h1) -+ have : 0 ≤ Real.exp u - u := sub_nonneg.2 hu_le -+ simpa [hderiv] using this -+ have hg_mono : MonotoneOn g (Set.Ici (0 : ℝ)) := -+ monotoneOn_of_deriv_nonneg (D := Set.Ici (0 : ℝ)) (hD := convex_Ici 0) -+ hg_cont hg_diff hg'_nonneg -+ have hg0 : g 0 = 1 := by simp [g] -+ have hle : g 0 ≤ g t := hg_mono (by simp) (by simpa [Set.mem_Ici] using ht) ht -+ have : (1 : ℝ) ≤ Real.exp t - t ^ 2 / 2 := by simpa [g, hg0] using hle -+ linarith -+ have hmain : (-Real.log x) ^ 2 / 2 ≤ Real.exp (-Real.log x) := hsq_div_two_le_exp ht -+ have hexp : Real.exp (-Real.log x) = x⁻¹ := by simp [Real.exp_neg, Real.exp_log hx] -+ have hsq2 : (-Real.log x) ^ 2 ≤ 2 * Real.exp (-Real.log x) := by nlinarith [hmain] -+ have hsq' : (-Real.log x) ^ 2 ≤ 2 / x := by simpa [hexp, div_eq_mul_inv, mul_assoc] using hsq2 -+ have hy : 0 ≤ 2 / x := div_nonneg (by norm_num) (le_of_lt hx) -+ exact (Real.le_sqrt ht hy).2 hsq' -+ -+lemma posLog_log_one_div_abs_one_sub_le_sqrt {t : ℝ} : -+ Real.posLog (1 / |1 - t|) ≤ Real.sqrt (2 / |1 - t|) := by -+ by_cases ht : |1 - t| ≤ 1 -+ · by_cases h0 : |1 - t| = 0 -+ · have : t = 1 := by -+ have : 1 - t = 0 := by simpa [abs_eq_zero] using h0 -+ linarith -+ subst this -+ simp -+ · have hpos : 0 < |1 - t| := lt_of_le_of_ne (abs_nonneg _) (Ne.symm h0) -+ have hle : -Real.log |1 - t| ≤ Real.sqrt (2 / |1 - t|) := -+ neg_log_le_sqrt_two_div (x := |1 - t|) hpos ht -+ have hlog : Real.log (1 / |1 - t|) = -Real.log |1 - t| := by simp [Real.log_inv] -+ have hnonneg : 0 ≤ Real.log (1 / |1 - t|) := by -+ exact Real.log_nonneg ((one_le_div hpos).2 ht) -+ have hmax : Real.posLog (1 / |1 - t|) = Real.log (1 / |1 - t|) := -+ max_eq_right hnonneg -+ calc -+ Real.posLog (1 / |1 - t|) = Real.log (1 / |1 - t|) := hmax -+ _ = -Real.log |1 - t| := hlog -+ _ ≤ Real.sqrt (2 / |1 - t|) := hle -+ · have hlt : 1 < |1 - t| := lt_of_not_ge ht -+ have hle0 : Real.log (1 / |1 - t|) ≤ 0 := by -+ have hpos : 0 < |1 - t| := lt_trans (by norm_num) hlt -+ have : (1 / |1 - t| : ℝ) ≤ 1 := (div_le_one hpos).2 (le_of_lt hlt) -+ exact le_trans (Real.log_le_log (by positivity) this) (by simp) -+ have hmax : Real.posLog (1 / |1 - t|) = 0 := max_eq_left hle0 -+ have hrhs : 0 ≤ Real.sqrt (2 / |1 - t|) := by -+ exact Real.sqrt_nonneg _ -+ rw [hmax] -+ exact hrhs -+ -+noncomputable def φ (t : ℝ) : ℝ := -+ log⁺ (1 / |1 - t|) -+ -+lemma measurable_phi : Measurable φ := by -+ unfold φ -+ simpa [Real.posLog_def, Real.posLog] using -+ (by fun_prop : Measurable fun t : ℝ => max 0 (Real.log (1 / |1 - t|))) -+ -+lemma phi_le_log_two_of_le_half {t : ℝ} (ht : t ≤ (1 / 2 : ℝ)) : φ t ≤ Real.log 2 := by -+ have hnonneg : 0 ≤ (1 - t : ℝ) := by linarith -+ have hden : (1 / 2 : ℝ) ≤ |1 - t| := by -+ have : (1 / 2 : ℝ) ≤ (1 - t : ℝ) := by linarith -+ simpa [abs_of_nonneg hnonneg] using this -+ have hfrac : (1 / |1 - t| : ℝ) ≤ 2 := by -+ have hhalfpos : (0 : ℝ) < (1 / 2 : ℝ) := by norm_num -+ have := one_div_le_one_div_of_le hhalfpos hden -+ simpa [one_div, div_eq_mul_inv] using this -+ have hposLog : log⁺ (1 / |1 - t|) ≤ log⁺ (2 : ℝ) := -+ Real.posLog_le_posLog ((by trans (0 : ℝ); norm_num; positivity)) hfrac -+ have habs : (1 : ℝ) ≤ |(2 : ℝ)| := by -+ simp -+ have hposLog2 : (log⁺ (2 : ℝ)) = Real.log 2 := by -+ simpa using (Real.posLog_eq_log habs) -+ simpa [φ, hposLog2] using hposLog -+ -+lemma phi_eq_zero_of_one_le_abs_one_sub {t : ℝ} (ht : (1 : ℝ) ≤ |1 - t|) : φ t = 0 := by -+ have hpos : 0 < |1 - t| := lt_of_lt_of_le (by norm_num) ht -+ have hfrac : (1 / |1 - t| : ℝ) ≤ 1 := (div_le_one hpos).2 ht -+ have habs : |(1 / |1 - t| : ℝ)| ≤ 1 := by -+ have hnonneg : 0 ≤ (1 / |1 - t| : ℝ) := by positivity -+ simpa [abs_of_nonneg hnonneg] using hfrac -+ have : log⁺ (1 / |1 - t|) = 0 := (Real.posLog_eq_zero_iff _).2 habs -+ simpa [φ] using this -+ -+lemma φ_nonneg (t : ℝ) : 0 ≤ φ t := by -+ simpa [φ] using (Real.posLog_nonneg (x := (1 / |1 - t|))) -+ -+lemma φ_le_sqrt (t : ℝ) : φ t ≤ Real.sqrt (2 / |1 - t|) := by -+ simpa [φ, Real.posLog] using -+ posLog_log_one_div_abs_one_sub_le_sqrt (t := t) -+ -+lemma ae_restrict_norm_phi_le_of_forall_mem {A B : ℝ} (hAB : A ≤ B) {g : ℝ → ℝ} -+ (hg : ∀ t, 0 ≤ g t) (h : ∀ t ∈ Set.Icc A B, φ t ≤ g t) : -+ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A B))] fun t => ‖g t‖ := by -+ refine -+ MeasureTheory.ae_restrict_of_forall_mem (μ := (volume : MeasureTheory.Measure ℝ)) -+ (s := Set.uIoc A B) -+ (by simpa using (measurableSet_uIoc : MeasurableSet (Set.uIoc A B))) ?_ -+ intro t ht -+ have htIoc : t ∈ Set.Ioc A B := by -+ simpa [Set.uIoc_of_le hAB] using ht -+ have htIcc : t ∈ Set.Icc A B := ⟨le_of_lt htIoc.1, htIoc.2⟩ -+ have hle : φ t ≤ g t := h t htIcc -+ have hφ0 : 0 ≤ φ t := φ_nonneg t -+ have hg0 : 0 ≤ g t := hg t -+ simpa [Real.norm_eq_abs, abs_of_nonneg hφ0, abs_of_nonneg hg0] using hle -+ -+lemma log_norm_one_sub_div_ge_neg_phi {u a : ℂ} {r : ℝ} -+ (hur : ‖u‖ = r) (ha : a ≠ 0) (hr : r ≠ ‖a‖) : -+ Real.log ‖(1 : ℂ) - u / a‖ ≥ -φ (r / ‖a‖) := by -+ have ha_norm : 0 < ‖a‖ := norm_pos_iff.2 ha -+ have hnorm_eq : ‖(1 : ℂ) - u / a‖ = ‖a - u‖ / ‖a‖ := by -+ have : (1 : ℂ) - u / a = (a - u) / a := by -+ field_simp [ha] -+ calc -+ ‖(1 : ℂ) - u / a‖ = ‖(a - u) / a‖ := by simp [this] -+ _ = ‖a - u‖ / ‖a‖ := by simp -+ have hrev : |‖a‖ - ‖u‖| ≤ ‖a - u‖ := by -+ simpa using (abs_norm_sub_norm_le a u) -+ have hdiv : |‖a‖ - ‖u‖| / ‖a‖ ≤ ‖a - u‖ / ‖a‖ := -+ div_le_div_of_nonneg_right hrev (le_of_lt ha_norm) -+ have habs : |1 - (r / ‖a‖)| = |‖a‖ - ‖u‖| / ‖a‖ := by -+ have hu : ‖u‖ = r := hur -+ have ha0 : (‖a‖ : ℝ) ≠ 0 := ha_norm.ne' -+ have h1 : (1 : ℝ) - (r / ‖a‖) = (‖a‖ - r) / ‖a‖ := by -+ field_simp [ha0] -+ calc -+ |1 - (r / ‖a‖)| = |(‖a‖ - r) / ‖a‖| := by simp [h1] -+ _ = |‖a‖ - r| / ‖a‖ := by simp [abs_div, abs_of_pos ha_norm] -+ _ = |‖a‖ - ‖u‖| / ‖a‖ := by simp [hu] -+ have hnorm_ge : |1 - (r / ‖a‖)| ≤ ‖(1 : ℂ) - u / a‖ := by -+ have : |1 - (r / ‖a‖)| ≤ ‖a - u‖ / ‖a‖ := by -+ rw [habs] -+ exact hdiv -+ rwa [hnorm_eq] -+ have hx0 : 0 < |1 - (r / ‖a‖)| := by -+ have : (1 - (r / ‖a‖) : ℝ) ≠ 0 := by -+ intro h0 -+ have : r = ‖a‖ := by -+ have : r / ‖a‖ = (1 : ℝ) := by linarith -+ simpa using (div_eq_iff ha_norm.ne').1 this -+ exact hr this -+ have : |1 - (r / ‖a‖)| ≠ 0 := by -+ simpa [abs_eq_zero] using this -+ exact lt_of_le_of_ne (abs_nonneg _) (Ne.symm this) -+ have hlogx : -+ Real.log |1 - (r / ‖a‖)| ≥ -φ (r / ‖a‖) := by -+ have := Real.neg_posLog_inv_le_log (x := |1 - (r / ‖a‖)|) -+ simpa [φ, one_div, inv_inv, abs_sub_comm, sub_eq_add_neg] using this -+ have hlog_mono : -+ Real.log |1 - (r / ‖a‖)| ≤ Real.log ‖(1 : ℂ) - u / a‖ := -+ Real.log_le_log (by positivity) hnorm_ge -+ linarith [hlog_mono, hlogx] -+ -+noncomputable def K : ℝ := -+ ∫ (t : ℝ) in (1 / 4 : ℝ)..(4 : ℝ), Real.sqrt (2 / |1 - t|) ∂volume -+ -+lemma K_nonneg : 0 ≤ K := by -+ have hle : (1 / 4 : ℝ) ≤ (4 : ℝ) := by norm_num -+ have hnn : ∀ t ∈ Set.Icc (1 / 4 : ℝ) (4 : ℝ), 0 ≤ Real.sqrt (2 / |1 - t|) := by -+ intro _t _ht -+ exact Real.sqrt_nonneg _ -+ simpa [K] using (intervalIntegral.integral_nonneg -+ (μ := (volume : MeasureTheory.Measure ℝ)) hle hnn) -+ -+noncomputable def Cφ : ℝ := -+ Real.log 2 + 4 * K + 1 -+ -+lemma Cφ_pos : 0 < Cφ := by -+ have hlog : 0 < Real.log 2 := by -+ simpa using Real.log_pos (by norm_num : (1 : ℝ) < 2) -+ have hK : 0 ≤ K := K_nonneg -+ have : 0 < Real.log 2 + 4 * K := by nlinarith -+ have : 0 < Real.log 2 + 4 * K + 1 := by linarith -+ simpa [Cφ] using this -+ -+lemma intervalIntegrable_sqrt_two_div_abs_one_sub_Icc : -+ IntervalIntegrable -+ (fun t : ℝ => Real.sqrt (2 / |1 - t|)) -+ volume (1 / 4 : ℝ) (4 : ℝ) := by -+ let f : ℝ → ℝ := fun u => Real.sqrt (2 / |u|) -+ have hf0 : IntervalIntegrable f volume (0 : ℝ) (3 : ℝ) := by -+ have hpow : -+ IntervalIntegrable (fun u : ℝ => u ^ (- (2⁻¹ : ℝ))) volume (0 : ℝ) (3 : ℝ) := by -+ simpa using -+ (intervalIntegral.intervalIntegrable_rpow' (a := (0 : ℝ)) (b := (3 : ℝ)) -+ (r := (- (2⁻¹ : ℝ))) (by linarith : (-1 : ℝ) < - (2⁻¹ : ℝ))) -+ have hpow2 : -+ IntervalIntegrable (fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) volume (0 : ℝ) (3 : ℝ) := -+ hpow.const_mul (Real.sqrt 2) -+ have hEq : -+ Set.EqOn f (fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) (Set.uIoc (0 : ℝ) (3 : ℝ)) := by -+ intro u hu -+ have hu' : u ∈ Set.Ioc (0 : ℝ) (3 : ℝ) := by -+ simpa [Set.uIoc_of_le (show (0 : ℝ) ≤ 3 by norm_num)] using hu -+ have hu0 : 0 < u := hu'.1 -+ have hu0' : 0 ≤ u := le_of_lt hu0 -+ have habs : |u| = u := abs_of_nonneg hu0' -+ have : f u = Real.sqrt (2 / u) := by simp [f, habs] -+ calc -+ f u = Real.sqrt (2 / u) := this -+ _ = Real.sqrt 2 / Real.sqrt u := by simp -+ _ = Real.sqrt 2 * (Real.sqrt u)⁻¹ := by simp [div_eq_mul_inv] -+ _ = Real.sqrt 2 * (u ^ (2⁻¹ : ℝ))⁻¹ := by simp [Real.sqrt_eq_rpow] -+ _ = Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ)) := by -+ have h : (u ^ (2⁻¹ : ℝ))⁻¹ = u ^ (- (2⁻¹ : ℝ)) := by -+ simpa using (Real.rpow_neg hu0' (2⁻¹ : ℝ)).symm -+ simp [h] -+ exact -+ (IntervalIntegrable.congr (a := (0 : ℝ)) (b := (3 : ℝ)) -+ (μ := (volume : MeasureTheory.Measure ℝ)) -+ (f := fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) (g := f) hEq.symm) -+ hpow2 -+ have hf0' : IntervalIntegrable f volume (0 : ℝ) (3 / 4 : ℝ) := -+ hf0.mono_set (by -+ intro u hu -+ have hsub : Set.uIcc (0 : ℝ) (3 / 4 : ℝ) ⊆ Set.uIcc (0 : ℝ) (3 : ℝ) := by -+ refine Set.uIcc_subset_uIcc ?_ ?_ -+ · simp -+ · have h0 : (0 : ℝ) ≤ (3 / 4 : ℝ) := by nlinarith -+ have h1 : (3 / 4 : ℝ) ≤ (3 : ℝ) := by nlinarith -+ exact (Set.mem_uIcc).2 (Or.inl ⟨h0, h1⟩) -+ exact hsub hu) -+ have hleft : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume (1 / 4 : ℝ) (1 : ℝ) := by -+ have htmp : -+ IntervalIntegrable (fun t : ℝ => f (1 - t)) volume (1 : ℝ) ((1 : ℝ) - (3 / 4 : ℝ)) := by -+ simpa using (hf0'.comp_sub_left (c := (1 : ℝ))) -+ have htmp' : -+ IntervalIntegrable (fun t : ℝ => f (1 - t)) volume ((1 : ℝ) - (3 / 4 : ℝ)) (1 : ℝ) := -+ htmp.symm -+ have hsub : ((1 : ℝ) - (3 / 4 : ℝ)) = (1 / 4 : ℝ) := by norm_num -+ have htmp'' : IntervalIntegrable (fun t : ℝ => f (1 - t)) volume (1 / 4 : ℝ) (1 : ℝ) := by -+ simpa [hsub] using htmp' -+ simpa [f] using htmp'' -+ have hright : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume (1 : ℝ) (4 : ℝ) := by -+ have htmp : -+ IntervalIntegrable (fun t : ℝ => f (t - 1)) volume (1 : ℝ) ((3 : ℝ) + (1 : ℝ)) := by -+ simpa using (hf0.comp_sub_right (c := (1 : ℝ))) -+ have hsub : ((3 : ℝ) + (1 : ℝ)) = (4 : ℝ) := by norm_num -+ have htmp' : IntervalIntegrable (fun t : ℝ => f (t - 1)) volume (1 : ℝ) (4 : ℝ) := by -+ simpa [hsub] using htmp -+ have hcongr : -+ Set.EqOn (fun t : ℝ => f (t - 1)) (fun t : ℝ => Real.sqrt (2 / |1 - t|)) -+ (Set.uIoc (1 : ℝ) (4 : ℝ)) := by -+ intro t _ht -+ simp [f, abs_sub_comm] -+ exact -+ (IntervalIntegrable.congr (a := (1 : ℝ)) (b := (4 : ℝ)) -+ (μ := (volume : MeasureTheory.Measure ℝ)) -+ (f := fun t : ℝ => f (t - 1)) (g := fun t : ℝ => Real.sqrt (2 / |1 - t|)) hcongr) -+ htmp' -+ exact hleft.trans hright -+ -+lemma phi_le_log_two_on_dyadic_of_le_quarter {A t : ℝ} (hA : A ≤ (1 / 4 : ℝ)) -+ (ht : t ∈ Set.Icc A (2 * A)) : -+ φ t ≤ Real.log 2 := by -+ have ht_le : t ≤ (1 / 2 : ℝ) := by -+ exact ht.2.trans (by nlinarith [hA]) -+ exact phi_le_log_two_of_le_half ht_le -+ -+lemma phi_eq_zero_of_two_le {t : ℝ} (ht : (2 : ℝ) ≤ t) : φ t = 0 := by -+ have hden : (1 : ℝ) ≤ |1 - t| := by -+ have : (1 : ℝ) ≤ t - 1 := by linarith -+ have : (1 : ℝ) ≤ |t - 1| := by -+ simpa [abs_of_nonneg (by linarith : 0 ≤ t - 1)] using this -+ simpa [abs_sub_comm] using this -+ exact phi_eq_zero_of_one_le_abs_one_sub hden -+ -+lemma intervalIntegrable_phi_dyadic_small {A : ℝ} (hA0 : 0 ≤ A) -+ (hA : A ≤ (1 / 4 : ℝ)) : -+ IntervalIntegrable φ volume A (2 * A) := by -+ have hA_le : A ≤ 2 * A := by nlinarith -+ have hconst : IntervalIntegrable (fun _ : ℝ => (Real.log 2 : ℝ)) volume A (2 * A) := -+ intervalIntegrable_const -+ have hmeas : -+ AEStronglyMeasurable (fun t : ℝ => φ t) (volume.restrict (Set.uIoc A (2 * A))) := -+ (measurable_phi.aestronglyMeasurable : _) -+ have hdom : -+ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A (2 * A)))] -+ fun _ => ‖(Real.log 2 : ℝ)‖ := by -+ refine ae_restrict_norm_phi_le_of_forall_mem (A := A) (B := 2 * A) hA_le -+ (g := fun _ => (Real.log 2 : ℝ)) (hg := fun _ => ?_) ?_ -+ · simpa using (Real.log_nonneg (by norm_num : (1 : ℝ) ≤ 2)) -+ · intro t ht -+ exact phi_le_log_two_on_dyadic_of_le_quarter hA ht -+ exact IntervalIntegrable.mono_fun hconst hmeas hdom -+ -+lemma intervalIntegrable_phi_dyadic_large {A : ℝ} (hA : (2 : ℝ) ≤ A) : -+ IntervalIntegrable φ volume A (2 * A) := by -+ have hA_le : A ≤ 2 * A := by nlinarith -+ have hEq : Set.EqOn (fun t : ℝ => φ t) (fun _ => (0 : ℝ)) (Set.uIoc A (2 * A)) := by -+ intro t ht -+ have htIoc : t ∈ Set.Ioc A (2 * A) := by -+ simpa [Set.uIoc_of_le hA_le] using ht -+ exact phi_eq_zero_of_two_le (le_trans hA (le_of_lt htIoc.1)) -+ have hz : IntervalIntegrable (fun _ : ℝ => (0 : ℝ)) volume A (2 * A) := -+ intervalIntegrable_const -+ exact (IntervalIntegrable.congr (a := A) (b := (2 * A)) -+ (μ := (volume : MeasureTheory.Measure ℝ)) -+ (f := fun _ => (0 : ℝ)) (g := fun t => φ t) (by -+ intro t ht -+ simpa using (hEq (x := t) ht).symm)) hz -+ -+lemma intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle {A : ℝ} -+ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume A (2 * A) := by -+ have hsqrt_big : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) -+ (volume : MeasureTheory.Measure ℝ) (1 / 4 : ℝ) (4 : ℝ) := -+ intervalIntegrable_sqrt_two_div_abs_one_sub_Icc -+ refine hsqrt_big.mono_set ?_ -+ refine Set.uIcc_subset_uIcc ?_ ?_ -+ · exact (Set.mem_uIcc).2 (Or.inl ⟨hA_lower, by nlinarith [hA_upper]⟩) -+ · exact (Set.mem_uIcc).2 (Or.inl ⟨by nlinarith [hA_lower], by nlinarith [hA_upper]⟩) -+ -+lemma intervalIntegrable_phi_dyadic_middle {A : ℝ} -+ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : -+ IntervalIntegrable φ volume A (2 * A) := by -+ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] -+ have hsqrt : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume A (2 * A) := -+ intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle hA_lower hA_upper -+ have hmeas : -+ AEStronglyMeasurable (fun t : ℝ => φ t) (volume.restrict (Set.uIoc A (2 * A))) := -+ (measurable_phi.aestronglyMeasurable : _) -+ have hdom : -+ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A (2 * A)))] -+ fun t => ‖Real.sqrt (2 / |1 - t|)‖ := by -+ refine ae_restrict_norm_phi_le_of_forall_mem (A := A) (B := 2 * A) hA_le -+ (g := fun t => Real.sqrt (2 / |1 - t|)) (hg := fun _ => Real.sqrt_nonneg _) ?_ -+ intro t _ht -+ exact φ_le_sqrt t -+ exact IntervalIntegrable.mono_fun hsqrt hmeas hdom -+ -+lemma intervalIntegrable_phi_dyadic {A : ℝ} (hA : 0 ≤ A) : -+ IntervalIntegrable φ volume A (2 * A) := by -+ by_cases hA0 : A = 0 -+ · subst hA0 -+ simp -+ cases le_total A (1 / 4 : ℝ) with -+ | inl hsmall => -+ exact intervalIntegrable_phi_dyadic_small hA hsmall -+ | inr hge_quarter => -+ cases le_total (2 : ℝ) A with -+ | inl hbig => -+ exact intervalIntegrable_phi_dyadic_large hbig -+ | inr hA_le_two => -+ exact intervalIntegrable_phi_dyadic_middle hge_quarter hA_le_two -+ -+lemma intervalIntegrable_phi_div {a R : ℝ} (ha : 0 < a) (hR : 0 ≤ R) : -+ IntervalIntegrable (fun r : ℝ => φ (r / a)) volume R (2 * R) := by -+ have ha0 : a ≠ 0 := ne_of_gt ha -+ have hRa_nonneg : 0 ≤ R / a := by -+ exact div_nonneg hR (le_of_lt ha) -+ have hφ : IntervalIntegrable φ volume (R / a) (2 * (R / a)) := -+ intervalIntegrable_phi_dyadic (A := (R / a)) hRa_nonneg -+ have := (hφ.comp_mul_right (c := (a⁻¹ : ℝ))) -+ have hupper : a * (R * (a⁻¹ * 2)) = (2 * R) := by -+ field_simp [ha0] -+ simpa [div_eq_mul_inv, ha0, hupper, mul_assoc, mul_left_comm, mul_comm] using this -+ -+lemma log_two_le_Cφ : Real.log 2 ≤ Cφ := by -+ dsimp [Cφ] -+ have hK : 0 ≤ K := K_nonneg -+ linarith [hK] -+ -+lemma four_mul_K_add_one_le_Cφ : (4 * K + 1 : ℝ) ≤ Cφ := by -+ dsimp [Cφ] -+ have hlog_nonneg : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) -+ linarith [hlog_nonneg] -+ -+lemma integral_phi_le_Cφ_mul_small {A : ℝ} (hA0 : 0 ≤ A) (hA : A ≤ (1 / 4 : ℝ)) : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by -+ have hA_le : A ≤ 2 * A := by nlinarith -+ have hφ_int : IntervalIntegrable φ volume A (2 * A) := -+ intervalIntegrable_phi_dyadic_small hA0 hA -+ have hconst : IntervalIntegrable (fun _ : ℝ => (Real.log 2 : ℝ)) volume A (2 * A) := -+ intervalIntegrable_const -+ have hle_int : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) -+ ≤ ∫ (t : ℝ) in A..(2 * A), (Real.log 2 : ℝ) ∂volume := by -+ refine intervalIntegral.integral_mono_on (μ := (volume : MeasureTheory.Measure ℝ)) -+ hA_le hφ_int hconst ?_ -+ intro t ht -+ exact phi_le_log_two_on_dyadic_of_le_quarter hA ht -+ have hRHS : -+ (∫ (t : ℝ) in A..(2 * A), (Real.log 2 : ℝ) ∂volume) = A * Real.log 2 := by -+ simp [intervalIntegral.integral_const, sub_eq_add_neg, add_assoc, two_mul] -+ have hcoef : A * Real.log 2 ≤ Cφ * A := by -+ have := mul_le_mul_of_nonneg_left log_two_le_Cφ hA0 -+ simpa [mul_assoc, mul_left_comm, mul_comm] using this -+ exact le_trans (by simpa [hRHS] using hle_int) hcoef -+ -+lemma integral_phi_le_Cφ_mul_large {A : ℝ} (hA : (2 : ℝ) ≤ A) : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by -+ have hA_le : A ≤ 2 * A := by nlinarith -+ have hφ0 : Set.EqOn (fun t : ℝ => φ t) (fun _ => (0 : ℝ)) (Set.uIcc A (2 * A)) := by -+ intro t ht -+ have ht' : t ∈ Set.Icc A (2 * A) := by -+ simpa [Set.uIcc_of_le hA_le] using ht -+ exact phi_eq_zero_of_two_le (le_trans hA ht'.1) -+ have hzero : (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) = 0 := by -+ simpa using intervalIntegral.integral_congr (μ := (volume : MeasureTheory.Measure ℝ)) hφ0 -+ have hnonneg : (0 : ℝ) ≤ Cφ * A := mul_nonneg (le_of_lt Cφ_pos) (by linarith) -+ simpa [hzero] using hnonneg -+ -+lemma integral_sqrt_two_div_abs_one_sub_le_K_dyadic_middle {A : ℝ} -+ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : -+ (∫ (t : ℝ) in A..(2 * A), Real.sqrt (2 / |1 - t|) ∂volume) ≤ K := by -+ let s (t : ℝ) : ℝ := Real.sqrt (2 / |1 - t|) -+ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] -+ have hA_upper' : (2 * A : ℝ) ≤ 4 := by nlinarith [hA_upper] -+ have hsqrt_big : IntervalIntegrable s volume (1 / 4 : ℝ) (4 : ℝ) := by -+ simpa [s] using intervalIntegrable_sqrt_two_div_abs_one_sub_Icc -+ have hle_K : -+ (∫ (t : ℝ) in A..(2 * A), s t ∂volume) -+ ≤ ∫ (t : ℝ) in (1 / 4 : ℝ)..(4 : ℝ), s t ∂volume := by -+ refine intervalIntegral.integral_mono_interval (μ := (volume : MeasureTheory.Measure ℝ)) -+ (c := (1 / 4 : ℝ)) (d := (4 : ℝ)) (a := A) (b := (2 * A)) -+ hA_lower hA_le hA_upper' ?_ hsqrt_big -+ exact Filter.Eventually.of_forall (fun _t => Real.sqrt_nonneg _) -+ simpa [K, s] using hle_K -+ -+lemma K_le_four_mul_K_add_one_mul_of_quarter_le {A : ℝ} (hA : (1 / 4 : ℝ) ≤ A) : -+ K ≤ (4 * K + 1) * A := by -+ have hcoef : 1 ≤ 4 * A := by nlinarith [hA] -+ have hK : 0 ≤ K := K_nonneg -+ nlinarith [hK, hcoef] -+ -+lemma integral_phi_le_Cφ_mul_middle {A : ℝ} -+ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by -+ let s (t : ℝ) : ℝ := Real.sqrt (2 / |1 - t|) -+ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] -+ have hφ_int : IntervalIntegrable φ volume A (2 * A) := -+ intervalIntegrable_phi_dyadic_middle hA_lower hA_upper -+ have hsqrt : IntervalIntegrable s volume A (2 * A) := by -+ simpa [s] using -+ intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle hA_lower hA_upper -+ have hle_int : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) -+ ≤ ∫ (t : ℝ) in A..(2 * A), s t ∂volume := by -+ refine intervalIntegral.integral_mono_on -+ (μ := (volume : MeasureTheory.Measure ℝ)) hA_le hφ_int hsqrt ?_ -+ intro t _ht -+ exact φ_le_sqrt t -+ have hsqrt_le : (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ≤ (4 * K + 1) * A := by -+ have hK : (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ≤ K := by -+ simpa [s] using integral_sqrt_two_div_abs_one_sub_le_K_dyadic_middle hA_lower hA_upper -+ exact le_trans hK (K_le_four_mul_K_add_one_mul_of_quarter_le hA_lower) -+ have hcoef : (4 * K + 1 : ℝ) * A ≤ Cφ * A := -+ mul_le_mul_of_nonneg_right four_mul_K_add_one_le_Cφ (by nlinarith [hA_lower]) -+ exact le_trans hle_int (le_trans hsqrt_le hcoef) -+ -+lemma integral_phi_le_Cφ_mul {A : ℝ} (hA : 0 ≤ A) : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by -+ by_cases hA0 : A = 0 -+ · subst hA0 -+ simp [Cφ, φ, K] -+ cases le_total A (1 / 4 : ℝ) with -+ | inl hsmall => -+ exact integral_phi_le_Cφ_mul_small hA hsmall -+ | inr hge_quarter => -+ cases le_total (2 : ℝ) A with -+ | inl hbig => -+ exact integral_phi_le_Cφ_mul_large hbig -+ | inr hA_le_two => -+ exact integral_phi_le_Cφ_mul_middle hge_quarter hA_le_two -+ -+open scoped BigOperators -+ -+lemma volume_Ioc_two_mul_ne_zero {R : ℝ} (hR : 0 < R) : -+ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R)) ≠ 0 := by -+ have hpos : (0 : ℝ) < 2 * R - R := by nlinarith [hR] -+ simp [Real.volume_Ioc, ENNReal.ofReal_eq_zero, not_le_of_gt hpos] -+ -+lemma volume_Ioc_two_mul_diff_finset_ne_zero (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : -+ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by -+ have hbad_meas : (volume : MeasureTheory.Measure ℝ) (bad : Set ℝ) = 0 := by -+ simpa using (bad.measure_zero (μ := (volume : MeasureTheory.Measure ℝ))) -+ have hdiff : -+ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) -+ = (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R)) := by -+ simpa [Set.sdiff_eq, Set.inter_assoc, Set.inter_left_comm, Set.inter_comm] using -+ (MeasureTheory.measure_sdiff_null (s := Set.Ioc R (2 * R)) (t := (bad : Set ℝ)) -+ hbad_meas) -+ simpa [hdiff] using volume_Ioc_two_mul_ne_zero hR -+ -+lemma restrict_volume_Ioc_two_mul_diff_finset_ne_zero (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : -+ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by -+ have hsubset : Set.Ioc R (2 * R) \ (bad : Set ℝ) ⊆ Set.Ioc R (2 * R) := by -+ intro r hr -+ exact hr.1 -+ have hinter : -+ (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ∩ Set.Ioc R (2 * R) -+ = (Set.Ioc R (2 * R) \ (bad : Set ℝ)) := by -+ exact Set.inter_eq_left.mpr hsubset -+ simpa [MeasureTheory.Measure.restrict_apply, measurableSet_Ioc, hinter] using -+ volume_Ioc_two_mul_diff_finset_ne_zero bad hR -+ -+lemma integral_phi_div_le_Cφ_mul {a R : ℝ} (ha : 0 < a) (hR : 0 ≤ R) : -+ (∫ (r : ℝ) in R..(2 * R), φ (r / a) ∂volume) ≤ Cφ * R := by -+ have ha0 : a ≠ 0 := ne_of_gt ha -+ have hrew : -+ (∫ (r : ℝ) in R..(2 * R), φ (r / a) ∂volume) -+ = a * (∫ (t : ℝ) in (R / a)..(2 * R / a), φ t ∂volume) := by -+ simp [smul_eq_mul, mul_left_comm, mul_comm, div_eq_mul_inv, ha0] -+ rw [hrew] -+ have hA : 0 ≤ R / a := by -+ exact div_nonneg hR ha.le -+ have hle : (∫ (t : ℝ) in (R / a)..(2 * (R / a)), φ t ∂volume) ≤ Cφ * (R / a) := -+ integral_phi_le_Cφ_mul (A := R / a) hA -+ have hEq : (2 * R / a) = 2 * (R / a) := by ring -+ have hle' : -+ (∫ (t : ℝ) in (R / a)..(2 * R / a), φ t ∂volume) ≤ Cφ * (R / a) := by -+ simpa [hEq] using hle -+ have ha_nonneg : 0 ≤ a := ha.le -+ have := mul_le_mul_of_nonneg_left hle' ha_nonneg -+ have hRHS : a * (Cφ * (R / a)) = Cφ * R := by -+ field_simp [ha0] -+ simpa [hRHS, mul_assoc, mul_left_comm, mul_comm] using this -+ -+lemma intervalIntegrable_sum_mul_phi_div -+ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) -+ (ha : ∀ i ∈ s, 0 < a i) {R : ℝ} (hR : 0 ≤ R) : -+ IntervalIntegrable (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) -+ volume R (2 * R) := by -+ refine IntervalIntegrable.sum (μ := volume) (a := R) (b := 2 * R) -+ (s := s) (f := fun i : ι => fun r : ℝ => w i * φ (r / a i)) ?_ -+ intro i hi -+ have hφi : IntervalIntegrable (fun r : ℝ => φ (r / a i)) volume R (2 * R) := -+ intervalIntegrable_phi_div (a := a i) (R := R) (ha i hi) hR -+ simpa [mul_assoc] using hφi.const_mul (w i) -+ -+lemma integral_sum_mul_phi_div_le_Cφ_mul_sum -+ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) -+ (hw : ∀ i ∈ s, 0 ≤ w i) (ha : ∀ i ∈ s, 0 < a i) {R : ℝ} (hR : 0 ≤ R) : -+ (∫ r in R..(2 * R), (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) r ∂volume) -+ ≤ Cφ * (∑ i ∈ s, w i) * R := by -+ have hint : ∀ i ∈ s, IntervalIntegrable (fun r : ℝ => w i * φ (r / a i)) -+ volume R (2 * R) := by -+ intro i hi -+ have hφi : IntervalIntegrable (fun r : ℝ => φ (r / a i)) volume R (2 * R) := -+ intervalIntegrable_phi_div (a := a i) (R := R) (ha i hi) hR -+ simpa [mul_assoc] using hφi.const_mul (w i) -+ have hsum_int : -+ (∫ r in R..(2 * R), (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) r ∂volume) -+ = ∑ i ∈ s, ∫ r in R..(2 * R), (fun r : ℝ => w i * φ (r / a i)) r -+ ∂volume := by -+ simpa using -+ (intervalIntegral.integral_finsetSum (μ := volume) (a := R) (b := 2 * R) -+ (s := s) (f := fun i : ι => fun r : ℝ => w i * φ (r / a i)) hint) -+ rw [hsum_int] -+ have hsum_le : -+ (∑ i ∈ s, ∫ r in R..(2 * R), (fun r : ℝ => w i * φ (r / a i)) r ∂volume) -+ ≤ ∑ i ∈ s, w i * (Cφ * R) := by -+ refine Finset.sum_le_sum ?_ -+ intro i hi -+ have hphi : -+ (∫ r in R..(2 * R), φ (r / a i) ∂volume) ≤ Cφ * R := -+ integral_phi_div_le_Cφ_mul (a := a i) (R := R) (ha i hi) hR -+ have := mul_le_mul_of_nonneg_left hphi (hw i hi) -+ simpa [mul_assoc, mul_left_comm, mul_comm] using this -+ refine le_trans hsum_le ?_ -+ have : (∑ i ∈ s, w i * (Cφ * R)) = Cφ * (∑ i ∈ s, w i) * R := by -+ calc -+ (∑ i ∈ s, w i * (Cφ * R)) = (∑ i ∈ s, w i) * (Cφ * R) := by -+ simp [Finset.sum_mul] -+ _ = Cφ * (∑ i ∈ s, w i) * R := by -+ ac_rfl -+ exact le_of_eq this -+ -+lemma exists_radius_Ioc_sum_mul_phi_div_le_Cφ_mul_sum_avoid -+ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) -+ (hw : ∀ i ∈ s, 0 ≤ w i) (ha : ∀ i ∈ s, 0 < a i) -+ (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : -+ ∃ r ∈ Set.Ioc R (2 * R), r ∉ bad ∧ -+ (∑ i ∈ s, w i * φ (r / a i)) ≤ Cφ * (∑ i ∈ s, w i) := by -+ by_contra hbad -+ have hforall : -+ ∀ r ∈ Set.Ioc R (2 * R), r ∉ bad → -+ Cφ * (∑ i ∈ s, w i) < (∑ i ∈ s, w i * φ (r / a i)) := by -+ intro r hr hrbad -+ have : ¬(∑ i ∈ s, w i * φ (r / a i)) ≤ Cφ * (∑ i ∈ s, w i) := by -+ intro hle -+ exact hbad ⟨r, hr, hrbad, hle⟩ -+ exact lt_of_not_ge this -+ let g : ℝ → ℝ := ∑ i ∈ s, fun r : ℝ => w i * φ (r / a i) -+ have hg_int : IntervalIntegrable g volume R (2 * R) := by -+ simpa [g] using intervalIntegrable_sum_mul_phi_div s w a ha hR.le -+ have hconst_int : -+ IntervalIntegrable (fun _r : ℝ => Cφ * (∑ i ∈ s, w i)) volume R (2 * R) := -+ intervalIntegrable_const -+ have hlt_meas : -+ (volume.restrict (Set.Ioc R (2 * R))) -+ {r | Cφ * (∑ i ∈ s, w i) < g r} ≠ 0 := by -+ have hall : Set.Ioc R (2 * R) \ (bad : Set ℝ) ⊆ {r | Cφ * (∑ i ∈ s, w i) < g r} := by -+ intro r hr -+ have hrIoc : r ∈ Set.Ioc R (2 * R) := hr.1 -+ have hrbad : r ∉ bad := by simpa using hr.2 -+ simpa [g] using hforall r hrIoc hrbad -+ have hle : -+ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) -+ ≤ (volume.restrict (Set.Ioc R (2 * R))) {r | Cφ * (∑ i ∈ s, w i) < g r} := -+ MeasureTheory.measure_mono hall -+ have hpos' : -+ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by -+ exact restrict_volume_Ioc_two_mul_diff_finset_ne_zero bad hR -+ intro hzero -+ have : (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) = 0 := -+ le_antisymm (le_trans hle (le_of_eq hzero)) (by positivity) -+ exact hpos' this -+ have hlt_int : -+ (∫ r in R..(2 * R), (Cφ * (∑ i ∈ s, w i)) ∂volume) -+ < ∫ r in R..(2 * R), g r ∂volume := by -+ have hab : R ≤ 2 * R := by nlinarith [hR.le] -+ refine intervalIntegral.integral_lt_integral_of_ae_le_of_measure_setOfPred_lt_ne_zero (μ := volume) -+ (a := R) (b := 2 * R) (f := fun _ => (Cφ * (∑ i ∈ s, w i))) (g := g) -+ hab hconst_int hg_int ?_ hlt_meas -+ have hmem : ∀ᵐ r ∂ (volume.restrict (Set.Ioc R (2 * R))), r ∈ Set.Ioc R (2 * R) := -+ MeasureTheory.ae_restrict_mem (by simp) -+ have hnotBad : -+ ∀ᵐ r ∂ (volume.restrict (Set.Ioc R (2 * R))), r ∉ (bad : Set ℝ) := by -+ simpa using -+ (bad.finite_toSet.countable.ae_notMem (μ := (volume.restrict (Set.Ioc R (2 * R))))) -+ filter_upwards [hmem, hnotBad] with r hrIoc hrNotBad -+ have hrNotBad' : r ∉ bad := by simpa using hrNotBad -+ exact le_of_lt (by simpa [g] using hforall r hrIoc hrNotBad') -+ have hconst_eval : -+ (∫ r in R..(2 * R), (Cφ * (∑ i ∈ s, w i)) ∂volume) = Cφ * (∑ i ∈ s, w i) * R := by -+ simp [intervalIntegral.integral_const, sub_eq_add_neg, mul_comm] -+ ring -+ have hg_le : -+ (∫ r in R..(2 * R), g r ∂volume) ≤ Cφ * (∑ i ∈ s, w i) * R := by -+ simpa [g] using integral_sum_mul_phi_div_le_Cφ_mul_sum s w a hw ha hR.le -+ have : ¬(Cφ * (∑ i ∈ s, w i) * R < Cφ * (∑ i ∈ s, w i) * R) := lt_irrefl _ -+ have hcontra : Cφ * (∑ i ∈ s, w i) * R < Cφ * (∑ i ∈ s, w i) * R := by -+ have := hlt_int -+ simpa [hconst_eval] using (this.trans_le hg_le) -+ exact this hcontra -+ -+end CartanBound -+end Complex -+end HadamardSourceScope26 -+ -+section HadamardSourceScope27 -+ -+noncomputable section -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+open _root_.Complex _root_.Erdos970.Complex _root_.Real _root_.Erdos970.Real -+ -+lemma max_one_norm_div_pow_le_one_add_rpow -+ {m : ℕ} {τ r : ℝ} {u a : ℂ} -+ (hur : ‖u‖ = r) -+ (hmτ : (m : ℝ) ≤ τ) : -+ max 1 (‖u / a‖ ^ m) ≤ 1 + (r / ‖a‖) ^ τ := by -+ by_cases hx : ‖u / a‖ ≤ 1 -+ · have hpowm_le1 : ‖u / a‖ ^ m ≤ 1 := pow_le_one₀ (norm_nonneg (u / a)) hx -+ have hr0 : 0 ≤ r := by simpa [hur] using (norm_nonneg u) -+ have hbase : 0 ≤ r / ‖a‖ := div_nonneg hr0 (norm_nonneg a) -+ have hnonneg : 0 ≤ (r / ‖a‖) ^ τ := Real.rpow_nonneg hbase τ -+ have hle1 : (1 : ℝ) ≤ 1 + (r / ‖a‖) ^ τ := le_add_of_nonneg_right hnonneg -+ have hle2 : ‖u / a‖ ^ m ≤ 1 + (r / ‖a‖) ^ τ := hpowm_le1.trans hle1 -+ exact (max_le_iff).2 ⟨hle1, hle2⟩ -+ · have hx1 : 1 < ‖u / a‖ := lt_of_not_ge hx -+ have hpow : -+ (‖u / a‖ : ℝ) ^ (m : ℝ) ≤ (‖u / a‖ : ℝ) ^ τ := -+ Real.rpow_le_rpow_of_exponent_le (le_of_lt hx1) hmτ -+ have hpow' : ‖u / a‖ ^ m ≤ (‖u / a‖ : ℝ) ^ τ := by -+ simpa [Real.rpow_natCast] using hpow -+ have hmax_add : max 1 (‖u / a‖ ^ m) ≤ 1 + ‖u / a‖ ^ m := by -+ refine max_le (le_add_of_nonneg_right (by positivity)) (le_add_of_nonneg_left (by positivity)) -+ have : max 1 (‖u / a‖ ^ m) ≤ 1 + (‖u / a‖ : ℝ) ^ τ := -+ hmax_add.trans (by nlinarith [hpow']) -+ simpa [norm_div, hur] using this -+ -+lemma norm_inv_weierstrassFactor_le_exp_near -+ {m : ℕ} {τ r : ℝ} {u a : ℂ} -+ (hur : ‖u‖ = r) (ha : a ≠ 0) (hr : r ≠ ‖a‖) -+ (hmτ : (m : ℝ) ≤ τ) : -+ ‖(weierstrassFactor m (u / a))⁻¹‖ -+ ≤ Real.exp (CartanBound.φ (r / ‖a‖) + (m : ℝ) * (1 + (r / ‖a‖) ^ τ)) := by -+ have hlog_one : -+ Real.log ‖(1 : ℂ) - u / a‖ ≥ -CartanBound.φ (r / ‖a‖) := -+ CartanBound.log_norm_one_sub_div_ge_neg_phi (hur := hur) (ha := ha) (hr := hr) -+ have hbase := -+ log_norm_weierstrassFactor_ge_log_norm_one_sub_sub (m := m) (z := (u / a)) -+ have hlogE : -+ Real.log ‖weierstrassFactor m (u / a)‖ -+ ≥ -CartanBound.φ (r / ‖a‖) - (m : ℝ) * max 1 (‖u / a‖ ^ m) := by -+ have hpls := -+ norm_partialLogSum_le_nat_mul_max_one_norm_pow m (u / a) -+ linarith [hbase, hlog_one, hpls] -+ have hmax : -+ max 1 (‖u / a‖ ^ m) ≤ 1 + (r / ‖a‖) ^ τ := -+ max_one_norm_div_pow_le_one_add_rpow (m := m) (τ := τ) (r := r) (u := u) (a := a) hur hmτ -+ have hneglog : -+ -Real.log ‖weierstrassFactor m (u / a)‖ -+ ≤ CartanBound.φ (r / ‖a‖) + (m : ℝ) * (1 + (r / ‖a‖) ^ τ) := by -+ have : -Real.log ‖weierstrassFactor m (u / a)‖ -+ ≤ CartanBound.φ (r / ‖a‖) + (m : ℝ) * max 1 (‖u / a‖ ^ m) := by -+ linarith [hlogE] -+ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ exact this.trans (by nlinarith [mul_le_mul_of_nonneg_left hmax hm0]) -+ have hpos : 0 < ‖weierstrassFactor m (u / a)‖ := by -+ have : weierstrassFactor m (u / a) ≠ 0 := by -+ intro h0 -+ have : u / a = (1 : ℂ) := (weierstrassFactor_eq_zero_iff m (u / a)).1 h0 -+ have : u = a := (div_eq_one_iff_eq ha).1 this -+ have : r = ‖a‖ := by simpa [this] using hur.symm -+ exact (hr this).elim -+ exact norm_pos_iff.2 this -+ have hEq : -+ ‖(weierstrassFactor m (u / a))⁻¹‖ = -+ Real.exp (-Real.log ‖weierstrassFactor m (u / a)‖) := by -+ simp [norm_inv, Real.exp_neg, Real.exp_log hpos] -+ have := Real.exp_le_exp.2 hneglog -+ simpa [hEq] using this -+ -+lemma norm_inv_weierstrassFactor_le_exp_far -+ {m : ℕ} {τ r : ℝ} {u a : ℂ} -+ (hur : ‖u‖ = r) (ha : a ≠ 0) -+ (hz : ‖u / a‖ ≤ (1 / 2 : ℝ)) (hτ_le : τ ≤ (m + 1 : ℝ)) : -+ ‖(weierstrassFactor m (u / a))⁻¹‖ ≤ Real.exp ((2 : ℝ) * (r / ‖a‖) ^ τ) := by -+ by_cases hu : u = 0 -+ · subst hu -+ have hr0 : r = 0 := by simpa [hur] using (norm_zero : ‖(0 : ℂ)‖ = 0) -+ subst hr0 -+ have h0 : 0 ≤ ((0 : ℝ) / ‖a‖) ^ τ := by -+ exact Real.rpow_nonneg (by positivity : (0 : ℝ) ≤ 0 / ‖a‖) τ -+ have h0' : 0 ≤ (2 : ℝ) * ((0 : ℝ) / ‖a‖) ^ τ := mul_nonneg (by norm_num) h0 -+ have hexp : (1 : ℝ) ≤ Real.exp ((2 : ℝ) * ((0 : ℝ) / ‖a‖) ^ τ) := -+ (Real.one_le_exp_iff).2 h0' -+ simpa using hexp -+ have hlogE := -+ log_norm_weierstrassFactor_ge_neg_two_pow (m := m) (z := (u / a)) hz -+ have hneglog : -Real.log ‖weierstrassFactor m (u / a)‖ ≤ (2 : ℝ) * (r / ‖a‖) ^ τ := by -+ have h1 : -Real.log ‖weierstrassFactor m (u / a)‖ ≤ (2 : ℝ) * ‖u / a‖ ^ (m + 1) := by -+ linarith [hlogE] -+ set x : ℝ := ‖u / a‖ -+ have hx1 : x ≤ 1 := le_trans (by simpa [x] using hz) (by norm_num) -+ have hxpos : 0 < x := by -+ simpa [x] using (norm_pos_iff.2 (div_ne_zero hu ha)) -+ have hτ_le' : τ ≤ ((m + 1 : ℕ) : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one] using hτ_le -+ have hpow_rpow : x ^ ((m + 1 : ℕ) : ℝ) ≤ x ^ τ := -+ Real.rpow_le_rpow_of_exponent_ge hxpos hx1 hτ_le' -+ have hpow : x ^ (m + 1) ≤ x ^ τ := by -+ simpa [← Real.rpow_natCast] using hpow_rpow -+ have h2x : (2 : ℝ) * x ^ (m + 1) ≤ (2 : ℝ) * x ^ τ := -+ mul_le_mul_of_nonneg_left hpow (by positivity) -+ have h2 : (2 : ℝ) * ‖u / a‖ ^ (m + 1) ≤ (2 : ℝ) * (‖u / a‖ : ℝ) ^ τ := by -+ simpa [x] using h2x -+ have h3 : (‖u‖ / ‖a‖) ^ τ = (r / ‖a‖) ^ τ := by -+ simp [hur] -+ exact (h1.trans h2).trans_eq (by simp [h3]) -+ have hpos : 0 < ‖weierstrassFactor m (u / a)‖ := by -+ have : weierstrassFactor m (u / a) ≠ 0 := by -+ intro h0 -+ have : u / a = (1 : ℂ) := (weierstrassFactor_eq_zero_iff m (u / a)).1 h0 -+ have : u = a := (div_eq_one_iff_eq ha).1 this -+ have : (‖u / a‖ : ℝ) = 1 := by simpa [this] using (by simp [ha]) -+ linarith [hz, this] -+ exact norm_pos_iff.2 this -+ have hEq : -+ ‖(weierstrassFactor m (u / a))⁻¹‖ = -+ Real.exp (-Real.log ‖weierstrassFactor m (u / a)‖) := by -+ simp [norm_inv, Real.exp_neg, Real.exp_log hpos] -+ have := Real.exp_le_exp.2 hneglog -+ simpa [hEq] using this -+ -+end Complex.Hadamard -+end -+end HadamardSourceScope27 -+ -+section HadamardSourceScope28 -+ -+noncomputable section -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+open scoped BigOperators -+open Filter Finset _root_.Real _root_.Erdos970.Real Topology -+ -+section CartanFiniteSum -+ -+variable {α : Type*} -+ -+private lemma summable_ite_mem_finset [DecidableEq α] (s : Finset α) (u : α → ℝ) : -+ Summable (fun a => if a ∈ s then u a else 0) := -+ summable_of_ne_finset_zero (s := s) fun a ha => by simp [ite_eq_right ha] -+ -+private lemma tsum_ite_mem_finset [DecidableEq α] (s : Finset α) (u : α → ℝ) : -+ (∑' a, if a ∈ s then u a else 0) = ∑ a ∈ s, u a := by -+ classical -+ simpa [Finset.sum_ite] using -+ (hasSum_sum_of_ne_finset_zero (s := s) (f := fun a => if a ∈ s then u a else 0) -+ fun a ha => by simp [ite_eq_right ha]).tsum_eq -+ -+private lemma tsum_add_four (u₁ u₂ u₃ u₄ : α → ℝ) -+ (h₁ : Summable u₁) (h₂ : Summable u₂) (h₃ : Summable u₃) (h₄ : Summable u₄) : -+ tsum (fun a => ((u₁ a + u₂ a) + u₃ a) + u₄ a) -+ = tsum u₁ + tsum u₂ + tsum u₃ + tsum u₄ := by -+ calc -+ tsum (fun a => ((u₁ a + u₂ a) + u₃ a) + u₄ a) -+ = tsum (fun a => (u₁ a + u₂ a) + (u₃ a + u₄ a)) := by -+ simp [add_comm, add_left_comm] -+ _ = tsum (fun a => u₁ a + u₂ a) + tsum (fun a => u₃ a + u₄ a) := -+ Summable.tsum_add (h₁.add h₂) (h₃.add h₄) -+ _ = tsum u₁ + tsum u₂ + tsum u₃ + tsum u₄ := by -+ rw [Summable.tsum_add h₁ h₂, Summable.tsum_add h₃ h₄] -+ ring -+ -+end CartanFiniteSum -+ -+noncomputable def cartanProductConstant (m : ℕ) (τ Sτ : ℝ) : ℝ := -+ ((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 3) * (Sτ + 1) -+ -+lemma cartanProductConstant_nonneg {m : ℕ} {τ Sτ : ℝ} (hSτ : 0 ≤ Sτ) : -+ 0 ≤ cartanProductConstant m τ Sτ := by -+ have hS : 0 ≤ Sτ + 1 := by linarith -+ have hA : 0 ≤ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 3 := by -+ have hCφ : 0 ≤ CartanBound.Cφ := le_of_lt CartanBound.Cφ_pos -+ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ have h4τ : 0 ≤ (4 : ℝ) ^ τ := by positivity -+ nlinarith [hCφ, hm0, h4τ] -+ simpa [cartanProductConstant] using mul_nonneg hA hS -+ -+lemma rpow_div_norm_divisorZeroIndex₀_eq -+ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : -+ (r / ‖divisorZeroIndex₀Val p‖) ^ τ = -+ (r ^ τ) * ((‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) := by -+ have hp : 0 ≤ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) := by positivity -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using -+ (Real.mul_rpow (x := r) (y := (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ)) (z := τ) hr hp) -+ -+lemma tsum_rpow_div_norm_divisorZeroIndex₀_eq -+ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ = (r ^ τ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ calc -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ = ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by -+ refine tsum_congr ?_ -+ intro p -+ exact rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p -+ _ = (r ^ τ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ simp [tsum_mul_left] -+ -+lemma tsum_two_mul_rpow_div_norm_divisorZeroIndex₀_le -+ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) (hτ_nonneg : 0 ≤ τ) : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ ≤ (2 : ℝ) * ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) * (1 + r) ^ τ := by -+ set Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ have htsum : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ = (2 : ℝ) * (r ^ τ) * Sτ := by -+ calc -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ = (2 : ℝ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (r / ‖divisorZeroIndex₀Val p‖) ^ τ := by -+ simp [tsum_mul_left] -+ _ = (2 : ℝ) * ((r ^ τ) * Sτ) := by -+ rw [tsum_rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr] -+ _ = (2 : ℝ) * (r ^ τ) * Sτ := by ring -+ have hSτ_nonneg : 0 ≤ Sτ := -+ tsum_nonneg (fun _ => Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _) -+ have h1r : r ^ τ ≤ (1 + r) ^ τ := -+ Real.rpow_le_rpow (by positivity) (by linarith) hτ_nonneg -+ have hS : Sτ ≤ Sτ + 1 := by linarith -+ have hle : (r ^ τ) * Sτ ≤ (1 + r) ^ τ * (Sτ + 1) := -+ mul_le_mul h1r hS (by linarith) (by positivity) -+ rw [htsum] -+ have : (2 : ℝ) * (r ^ τ) * Sτ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by -+ nlinarith [hle] -+ simpa [Sτ, mul_assoc, mul_left_comm, mul_comm] using this -+ -+lemma sum_rpow_div_norm_divisorZeroIndex₀_le -+ {f : ℂ → ℂ} {r τ : ℝ} (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hr : 0 ≤ r) (hτ_nonneg : 0 ≤ τ) -+ (hsumτ : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : -+ (∑ p ∈ small, (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ ≤ ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) * (1 + r) ^ τ := by -+ set Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ have hsum_inv : -+ (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ≤ Sτ := by -+ have hnn : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ 0 ≤ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by -+ intro p -+ positivity -+ simpa [Sτ] using -+ (Summable.sum_le_tsum (s := small) -+ (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) -+ (fun p _ => hnn p) hsumτ) -+ have hsum_eq : -+ ∑ p ∈ small, (r / ‖divisorZeroIndex₀Val p‖) ^ τ = -+ (r ^ τ) * ∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by -+ simp [rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr, Finset.mul_sum] -+ have h1r : r ^ τ ≤ (1 + r) ^ τ := -+ Real.rpow_le_rpow (by positivity) (by linarith) hτ_nonneg -+ have hS : (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ≤ Sτ + 1 := by -+ linarith [hsum_inv] -+ have hle : -+ (r ^ τ) * (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) -+ ≤ (1 + r) ^ τ * (Sτ + 1) := -+ mul_le_mul h1r hS (by positivity) (by positivity) -+ simpa [Sτ, hsum_eq, mul_assoc, mul_left_comm, mul_comm] using hle -+ -+lemma add_four_le_add_two_mul_of_le {x₁ x₂ x₃ x₄ A B C : ℝ} -+ (h₁ : x₁ ≤ A) (h₂ : x₂ ≤ B) (h₃ : x₃ ≤ B) (h₄ : x₄ ≤ C) : -+ x₁ + x₂ + x₃ + x₄ ≤ A + 2 * B + C := by -+ nlinarith -+ -+lemma cartan_majorant_four_term_bound -+ {xφ x0 xm xt Cφ m q Y T : ℝ} -+ (hφ : xφ ≤ Cφ * q * Y * T) -+ (h0 : x0 ≤ m * q * Y * T) -+ (hm : xm ≤ m * q * Y * T) -+ (ht : xt ≤ (2 : ℝ) * Y * T) : -+ xφ + x0 + xm + xt ≤ (Cφ + (2 : ℝ) * m) * q * Y * T + (2 : ℝ) * Y * T := by -+ have h := -+ add_four_le_add_two_mul_of_le hφ h0 hm ht -+ have hring : -+ Cφ * (q * (Y * T)) + 2 * (m * (q * (Y * T))) + 2 * (Y * T) -+ = (Cφ + (2 : ℝ) * m) * (q * (Y * T)) + (2 : ℝ) * (Y * T) := by -+ ring -+ simpa [mul_assoc, hring] using h -+ -+lemma cartan_majorant_add_two_factor (A Y T : ℝ) : -+ A * Y * T + (2 : ℝ) * Y * T = ((A + 2) * Y) * T := by -+ ring -+ -+lemma cartan_majorant_pad_two_to_three {A S T : ℝ} (hS : 0 ≤ S + 1) (hT : 0 ≤ T) : -+ ((A + 2) * (S + 1)) * T ≤ ((A + 3) * (S + 1)) * T := by -+ have h : (A + 2) * (S + 1) ≤ (A + 3) * (S + 1) := by -+ nlinarith -+ exact mul_le_mul_of_nonneg_right h hT -+ -+lemma cartan_majorant_nonneg -+ {f : ℂ → ℂ} {m : ℕ} {τ r : ℝ} (hr : 0 ≤ r) -+ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : -+ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ ∀ p, 0 ≤ b p := by -+ classical -+ dsimp -+ intro p -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun q => ‖divisorZeroIndex₀Val q‖ -+ have hap : ap p = ‖divisorZeroIndex₀Val p‖ := rfl -+ by_cases hp : p ∈ small -+ · have hφ : 0 ≤ CartanBound.φ (r / ap p) := CartanBound.φ_nonneg (t := r / ap p) -+ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ have h1 : 0 ≤ (1 + (r / ap p) ^ τ) := by positivity -+ have : 0 ≤ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) := by -+ nlinarith [hφ, hm0, h1] -+ simpa [hap, hp, ap] using this -+ · have hbase : 0 ≤ r / ap p := div_nonneg hr (by positivity) -+ have hpow : 0 ≤ (r / ap p) ^ τ := Real.rpow_nonneg hbase τ -+ have : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := mul_nonneg (by norm_num) hpow -+ simpa [hap, hp, ap] using this -+ -+lemma cartan_majorant_summable -+ {f : ℂ → ℂ} {m : ℕ} {τ r : ℝ} (hr : 0 ≤ r) -+ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsumτ : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : -+ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ Summable b := by -+ classical -+ dsimp -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun q => ‖divisorZeroIndex₀Val q‖ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ have hb : Summable b := by -+ let b₁ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else 0 -+ let b₂ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => if p ∈ small then 0 else (2 : ℝ) * (r / ap p) ^ τ -+ have hb_decomp : b = fun p => b₁ p + b₂ p := by -+ funext p -+ by_cases hp : p ∈ small <;> simp [b, b₁, b₂, hp] -+ have hb₁ : Summable b₁ := by -+ simpa [b₁] using -+ summable_ite_mem_finset small -+ (fun p => CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ)) -+ have hb₂ : Summable b₂ := by -+ have hconst : -+ Summable (fun p => -+ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) := -+ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) -+ refine Summable.of_nonneg_of_le -+ (fun p => by -+ by_cases hp : p ∈ small -+ · simp [b₂, hp] -+ · have : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := by positivity -+ simpa [b₂, hp] using this) -+ (fun p => ?_) hconst -+ by_cases hp : p ∈ small -+ · have : 0 ≤ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by positivity -+ simpa [b₂, hp] using this -+ · have hrpow : (r / ap p) ^ τ = (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by -+ simpa [ap] using rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p -+ simp [b₂, hp, hrpow, mul_assoc, mul_left_comm, mul_comm] -+ simpa [hb_decomp] using hb₁.add hb₂ -+ refine hb.congr ?_ -+ intro p -+ by_cases hp : p ∈ small <;> simp [b, ap, hp] -+ -+lemma cartan_card_small_le -+ {f : ℂ → ℂ} {τ R : ℝ} (hRpos : 0 < R) (hτ_nonneg : 0 ≤ τ) -+ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsmall : ∀ p ∈ small, ‖divisorZeroIndex₀Val p‖ ≤ 4 * R) -+ (hsumτ : -+ Summable -+ (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : -+ (small.card : ℝ) -+ ≤ (4 * R) ^ τ -+ * ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) := by -+ classical -+ set Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ have hsum_le : (∑ p ∈ small, ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) ≤ Sτ := by -+ have hnn : -+ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ 0 ≤ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ intro p -+ exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ -+ simpa [Sτ] using -+ (Summable.sum_le_tsum (s := small) -+ (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) -+ (fun p _ => hnn p) hsumτ) -+ have hgeom_sum : -+ (small.card : ℝ) ≤ ∑ p ∈ small, (4 * R) ^ τ * ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ have hcard_eq : (small.card : ℝ) = ∑ p ∈ small, (1 : ℝ) := by simp -+ rw [hcard_eq] -+ refine Finset.sum_le_sum (fun p hp => ?_) -+ have hp_le : ‖divisorZeroIndex₀Val p‖ ≤ 4 * R := hsmall p hp -+ have hap : 0 < ‖divisorZeroIndex₀Val p‖ := -+ norm_pos_iff.2 (divisorZeroIndex₀Val_ne_zero p) -+ have hbase : (1 : ℝ) ≤ (4 * R) / ‖divisorZeroIndex₀Val p‖ := by -+ exact (le_div_iff₀ hap).2 (by simpa [mul_one] using hp_le) -+ have : (1 : ℝ) ≤ ((4 * R) / ‖divisorZeroIndex₀Val p‖) ^ τ := -+ Real.one_le_rpow hbase hτ_nonneg -+ have hdiv : -+ ((4 * R) / ‖divisorZeroIndex₀Val p‖) ^ τ = -+ (4 * R) ^ τ * (‖divisorZeroIndex₀Val p‖)⁻¹ ^ τ := by -+ have h4 : 0 ≤ (4 * R : ℝ) := by nlinarith [le_of_lt hRpos] -+ have ha : 0 ≤ (‖divisorZeroIndex₀Val p‖ : ℝ)⁻¹ := by positivity -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using -+ (Real.mul_rpow (x := (4 * R : ℝ)) -+ (y := (‖divisorZeroIndex₀Val p‖ : ℝ)⁻¹) (z := τ) h4 ha) -+ have : (1 : ℝ) ≤ (4 * R) ^ τ * ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ simpa [hdiv] using this -+ exact this -+ have hgeom : -+ (small.card : ℝ) ≤ (4 * R) ^ τ * (∑ p ∈ small, ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by -+ simpa [Finset.mul_sum] using hgeom_sum -+ have hsmall_le : (small.card : ℝ) ≤ (4 * R) ^ τ * Sτ := by -+ exact hgeom.trans (mul_le_mul_of_nonneg_left hsum_le (by positivity)) -+ have hS_le : (4 * R) ^ τ * Sτ ≤ (4 * R) ^ τ * (Sτ + 1) := by -+ refine mul_le_mul_of_nonneg_left ?_ (by positivity) -+ linarith -+ have : (small.card : ℝ) ≤ (4 * R) ^ τ * (Sτ + 1) := hsmall_le.trans hS_le -+ simpa [Sτ, add_comm, add_left_comm, add_assoc, mul_assoc] using this -+ -+lemma cartan_rpow_mul_le -+ {τ R r : ℝ} (hRpos : 0 < R) (hrpos : 0 < r) (hR_le_r : R ≤ r) (hτ_nonneg : 0 ≤ τ) : -+ (4 * R) ^ τ ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ := by -+ have hR_le_1r : R ≤ 1 + r := by linarith [hR_le_r, le_of_lt hrpos] -+ have hbase0 : 0 ≤ (4 * R : ℝ) := by nlinarith [le_of_lt hRpos] -+ have : (4 * R) ^ τ ≤ (4 * (1 + r)) ^ τ := by -+ refine Real.rpow_le_rpow hbase0 ?_ hτ_nonneg -+ nlinarith [hR_le_1r] -+ have hmul : (4 * (1 + r)) ^ τ = (4 : ℝ) ^ τ * (1 + r) ^ τ := by -+ have h4 : 0 ≤ (4 : ℝ) := by norm_num -+ have h1 : 0 ≤ (1 + r : ℝ) := by positivity -+ simpa [mul_assoc] using -+ (Real.mul_rpow (x := (4 : ℝ)) (y := (1 + r : ℝ)) (z := τ) h4 h1) -+ simpa [hmul] using this -+ -+open Classical in -+theorem cartan_sum_majorant_le -+ {f : ℂ → ℂ} {m : ℕ} {τ R r : ℝ} -+ (hRpos : 0 < R) -+ (hrpos : 0 < r) -+ (hR_le_r : R ≤ r) -+ (hτ_nonneg : 0 ≤ τ) -+ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsmall_fin : smallSet.Finite) -+ (hsmallSet : -+ smallSet = {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 4 * R}) -+ (hsumτ : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) -+ (hr_phi : -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ (∑ p ∈ small, CartanBound.φ (r / a p)) ≤ CartanBound.Cφ * (small.card : ℝ)) : -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ let Sτ : ℝ := ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ let Cprod : ℝ := cartanProductConstant m τ Sτ -+ ∀ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)), -+ (∑ p ∈ s, b p) ≤ Cprod * (1 + r) ^ τ := by -+ classical -+ intro small ap b Sτ Cprod s -+ have hr : 0 ≤ r := le_of_lt hrpos -+ have hSτ_nonneg : 0 ≤ Sτ := -+ tsum_nonneg (fun _ => Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _) -+ have hsmall_mem : ∀ p, p ∈ small ↔ p ∈ smallSet := by -+ intro p -+ simp [small, hsmall_fin.mem_toFinset] -+ have hphi_sum : -+ (∑ p ∈ small, CartanBound.φ (r / ap p)) ≤ CartanBound.Cφ * (small.card : ℝ) := by -+ simpa [small, ap] using hr_phi -+ have hb_nonneg : ∀ p, 0 ≤ b p := by -+ simpa [ap, b] using (cartan_majorant_nonneg (f := f) (m := m) (τ := τ) (r := r) hr small) -+ have hb_summable : Summable b := by -+ simpa [ap, b] using -+ (cartan_majorant_summable (f := f) (m := m) (τ := τ) (r := r) hr small hsumτ) -+ have hsmall_norm : ∀ p ∈ small, ‖divisorZeroIndex₀Val p‖ ≤ 4 * R := by -+ intro p hp -+ have : p ∈ smallSet := (hsmall_mem p).1 hp -+ simpa [hsmallSet] using this -+ have hcard_le : (small.card : ℝ) ≤ (4 * R) ^ τ * (Sτ + 1) := by -+ simpa [Sτ, mul_assoc, add_assoc, add_left_comm, add_comm] using -+ (cartan_card_small_le (f := f) (τ := τ) (R := R) hRpos hτ_nonneg small hsmall_norm hsumτ) -+ have hpowR : (4 * R) ^ τ ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ := -+ cartan_rpow_mul_le (τ := τ) (R := R) (r := r) hRpos hrpos hR_le_r hτ_nonneg -+ have hcard_le' : (small.card : ℝ) ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ * (Sτ + 1) := by -+ have : (4 * R) ^ τ * (Sτ + 1) ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ * (Sτ + 1) := by -+ exact mul_le_mul_of_nonneg_right hpowR (by linarith [hSτ_nonneg]) -+ exact le_trans hcard_le this -+ have hb_tsum_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) ≤ Cprod * (1 + r) ^ τ := by -+ let bφ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => if p ∈ small then CartanBound.φ (r / ap p) else 0 -+ let b0 : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => if p ∈ small then (m : ℝ) else 0 -+ let bmτ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => if p ∈ small then (m : ℝ) * (r / ap p) ^ τ else 0 -+ let bt : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (2 : ℝ) * (r / ap p) ^ τ -+ have hb_pointwise : ∀ p, b p ≤ bφ p + b0 p + bmτ p + bt p := by -+ intro p -+ by_cases hp : p ∈ small -+ · have hbase : 0 ≤ r / ap p := div_nonneg hr (by positivity) -+ have hx : 0 ≤ (r / ap p) ^ τ := Real.rpow_nonneg hbase τ -+ have hpos : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := mul_nonneg (by norm_num) hx -+ simp [b, bφ, b0, bmτ, bt, hp] -+ nlinarith -+ · simp [b, bφ, b0, bmτ, bt, hp] -+ have hmaj_summ : Summable (fun p => bφ p + b0 p + bmτ p + bt p) := by -+ have hbφ_summ : Summable bφ := by -+ simpa [bφ] using summable_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) -+ have hb0_summ : Summable b0 := by -+ simpa [b0] using summable_ite_mem_finset small (fun _ => (m : ℝ)) -+ have hbmτ_summ : Summable bmτ := by -+ simpa [bmτ] using summable_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) -+ have hbt_summ : Summable bt := by -+ have hconst : Summable (fun p => -+ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) := -+ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) -+ refine hconst.congr ?_ -+ intro p -+ simp [bt, ap, rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p, -+ mul_assoc, mul_left_comm, mul_comm] -+ have h' : Summable (fun p => bφ p + b0 p + (bmτ p + bt p)) := -+ (hbφ_summ.add hb0_summ).add (hbmτ_summ.add hbt_summ) -+ simpa [add_assoc] using h' -+ have htsum_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) -+ ≤ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p) := -+ (hasSum_le hb_pointwise hb_summable.hasSum hmaj_summ.hasSum) -+ have htsum_bφ : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) -+ = ∑ p ∈ small, CartanBound.φ (r / ap p) := by -+ classical -+ simpa [bφ] using tsum_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) -+ have htsum_b0 : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) -+ = (m : ℝ) * (small.card : ℝ) := by -+ classical -+ have : (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) = ∑ p ∈ small, (m : ℝ) := by -+ simpa [b0] using tsum_ite_mem_finset small (fun _ => (m : ℝ)) -+ simp [this, Finset.sum_const, nsmul_eq_mul, mul_comm] -+ have htsum_bmτ : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) -+ = (m : ℝ) * ∑ p ∈ small, (r / ap p) ^ τ := by -+ classical -+ have : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) -+ = ∑ p ∈ small, (m : ℝ) * (r / ap p) ^ τ := by -+ simpa [bmτ] using tsum_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) -+ simp [this, Finset.mul_sum] -+ have htsum_bt : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) -+ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by -+ simpa [bt, ap, Sτ] using -+ tsum_two_mul_rpow_div_norm_divisorZeroIndex₀_le (f := f) (τ := τ) hr hτ_nonneg -+ have hsum_small_rpow_le : -+ (∑ p ∈ small, (r / ap p) ^ τ) ≤ (Sτ + 1) * (1 + r) ^ τ := by -+ simpa [ap, Sτ] using -+ sum_rpow_div_norm_divisorZeroIndex₀_le (f := f) (τ := τ) small hr hτ_nonneg hsumτ -+ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ have hCφ : 0 ≤ CartanBound.Cφ := le_of_lt CartanBound.Cφ_pos -+ have hS : 0 ≤ Sτ + 1 := by linarith [hSτ_nonneg] -+ have htsum_majorant : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) -+ ≤ (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) -+ * (1 + r) ^ τ := by -+ have hφ_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) -+ ≤ CartanBound.Cφ * (small.card : ℝ) := by -+ simpa [htsum_bφ] using hphi_sum -+ have hb0_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) -+ ≤ (m : ℝ) * (small.card : ℝ) := by -+ simp [htsum_b0] -+ have hbmτ_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ≤ -+ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ have h0 : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) -+ ≤ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) := by -+ have hmul := mul_le_mul_of_nonneg_left hsum_small_rpow_le hm0 -+ -+ simpa [htsum_bmτ, mul_assoc, mul_left_comm, mul_comm] using hmul -+ have h1 : (1 : ℝ) ≤ (4 : ℝ) ^ τ := -+ Real.one_le_rpow (by norm_num) hτ_nonneg -+ have hscale : -+ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) -+ ≤ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ have hnonneg : 0 ≤ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) := by -+ have : 0 ≤ (Sτ + 1) * (1 + r) ^ τ := by positivity -+ exact mul_nonneg hm0 this -+ simpa [mul_assoc, mul_left_comm, mul_comm] using (mul_le_mul_of_nonneg_right h1 hnonneg) -+ exact h0.trans hscale -+ have hbt_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) -+ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using htsum_bt -+ have hsplit : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) -+ = (∑' p, bφ p) + (∑' p, b0 p) + (∑' p, bmτ p) + (∑' p, bt p) := by -+ classical -+ have hbφ_summ : Summable bφ := by -+ simpa [bφ] using summable_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) -+ have hb0_summ : Summable b0 := by -+ simpa [b0] using summable_ite_mem_finset small (fun _ => (m : ℝ)) -+ have hbmτ_summ : Summable bmτ := by -+ simpa [bmτ] using summable_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) -+ have hbt_summ : Summable bt := by -+ have hconst : -+ Summable -+ (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ (2 : ℝ) * (r ^ τ) * ((‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ)) := -+ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) -+ refine hconst.congr ?_ -+ intro p -+ simp [bt, ap, rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p, -+ mul_assoc, mul_left_comm, mul_comm] -+ exact tsum_add_four bφ b0 bmτ bt hbφ_summ hb0_summ hbmτ_summ hbt_summ -+ have hcard_le'' : -+ (small.card : ℝ) ≤ (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using hcard_le' -+ have hφ_le' : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ≤ -+ CartanBound.Cφ * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ have : CartanBound.Cφ * (small.card : ℝ) ≤ -+ CartanBound.Cφ * ((4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ) := -+ mul_le_mul_of_nonneg_left hcard_le'' hCφ -+ exact hφ_le.trans (by simpa [mul_assoc, mul_left_comm, mul_comm] using this) -+ have hb0_le' : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ≤ -+ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ have : (m : ℝ) * (small.card : ℝ) ≤ (m : ℝ) * ((4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ) := -+ mul_le_mul_of_nonneg_left hcard_le'' hm0 -+ exact hb0_le.trans (by simpa [mul_assoc, mul_left_comm, mul_comm] using this) -+ have htsum_majorant' : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) -+ ≤ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ -+ + (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by -+ rw [hsplit] -+ set Y : ℝ := Sτ + 1 with hY -+ set T : ℝ := (1 + r) ^ τ with hT -+ have hφ_leY : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) -+ ≤ CartanBound.Cφ * (4 : ℝ) ^ τ * Y * T := by -+ simpa [hY, hT, mul_assoc] using hφ_le' -+ have hb0_leY : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) -+ ≤ (m : ℝ) * (4 : ℝ) ^ τ * Y * T := by -+ simpa [hY, hT, mul_assoc] using hb0_le' -+ have hbmτ_leY : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) -+ ≤ (m : ℝ) * (4 : ℝ) ^ τ * Y * T := by -+ simpa [hY, hT, mul_assoc] using hbmτ_le -+ have hbt_leY : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) ≤ (2 : ℝ) * Y * T := by -+ simpa [hY, hT, mul_assoc] using hbt_le -+ have hmain := -+ cartan_majorant_four_term_bound -+ (q := (4 : ℝ) ^ τ) hφ_leY hb0_leY hbmτ_leY hbt_leY -+ simpa [Y, T, add_assoc] using hmain -+ have hring : -+ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ -+ + (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ -+ = (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) * (1 + r) ^ τ := by -+ exact cartan_majorant_add_two_factor -+ ((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ) (Sτ + 1) ((1 + r) ^ τ) -+ rw [← hring] -+ exact htsum_majorant' -+ have hCprod' : -+ (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) * (1 + r) ^ τ -+ ≤ Cprod * (1 + r) ^ τ := by -+ simpa [Cprod, cartanProductConstant, mul_assoc, mul_left_comm, mul_comm] using -+ cartan_majorant_pad_two_to_three -+ (A := (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ) -+ (S := Sτ) (T := (1 + r) ^ τ) hS (by positivity) -+ exact (le_trans (le_trans htsum_le htsum_majorant) hCprod') -+ have hsum_fin_le : -+ (∑ p ∈ s, b p) ≤ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) := by -+ simpa using -+ (Summable.sum_le_tsum (s := s) (f := b) (fun p _ => hb_nonneg p) hb_summable) -+ exact hsum_fin_le.trans hb_tsum_le -+ -+end Complex.Hadamard -+end -+end HadamardSourceScope28 -+ -+section HadamardSourceScope29 -+ -+noncomputable section -+ -+open scoped BigOperators -+open Filter Finset _root_.Real _root_.Erdos970.Real Topology -+ -+lemma Finset.prod_le_exp_sum {α : Type} (s : Finset α) (a : α → ℝ) (b : α → ℝ) -+ (ha : ∀ x ∈ s, 0 ≤ a x) (hab : ∀ x ∈ s, a x ≤ Real.exp (b x)) : -+ (∏ x ∈ s, a x) ≤ Real.exp (∑ x ∈ s, b x) := by -+ calc -+ (∏ x ∈ s, a x) ≤ ∏ x ∈ s, Real.exp (b x) := Finset.prod_le_prod₀ ha hab -+ _ = Real.exp (∑ x ∈ s, b x) := by -+ simpa using (Real.exp_sum (s := s) (f := b)).symm -+ -+lemma hasProd_le_of_prod_le_exp {α : Type} {f : α → ℝ} {a : ℝ} -+ (hf : HasProd f a (SummationFilter.unconditional α)) -+ {B : ℝ} (hB : ∀ s : Finset α, (∏ x ∈ s, f x) ≤ Real.exp B) : -+ a ≤ Real.exp B := -+ hasProd_le_of_prod_le (L := (SummationFilter.unconditional α)) hf hB -+ -+lemma hasProd_inv_unconditional {α : Type} {fac : α → ℂ} {F : ℂ} -+ (hfac : HasProd fac F (SummationFilter.unconditional α)) (hF : F ≠ 0) : -+ HasProd (fun x => (fac x)⁻¹) (F⁻¹) (SummationFilter.unconditional α) := by -+ change -+ Tendsto (fun s : Finset α => ∏ x ∈ s, (fac x)⁻¹) -+ (SummationFilter.unconditional α).filter (𝓝 (F⁻¹)) -+ have hprod : -+ Tendsto (fun s : Finset α => ∏ x ∈ s, fac x) -+ (SummationFilter.unconditional α).filter (𝓝 F) := by -+ simpa [HasProd] using hfac -+ have hinv : -+ Tendsto (fun s : Finset α => (∏ x ∈ s, fac x)⁻¹) -+ (SummationFilter.unconditional α).filter (𝓝 (F⁻¹)) := -+ hprod.inv₀ hF -+ refine hinv.congr' (Filter.Eventually.of_forall ?_) -+ intro s -+ simp [Finset.prod_inv_distrib] -+ -+lemma hasProd_norm_inv_unconditional {α : Type} {fac : α → ℂ} {F : ℂ} -+ (hfac : HasProd fac F (SummationFilter.unconditional α)) (hF : F ≠ 0) : -+ HasProd (fun x => ‖(fac x)⁻¹‖) ‖F⁻¹‖ (SummationFilter.unconditional α) := by -+ change -+ Tendsto (fun s : Finset α => ∏ x ∈ s, ‖(fac x)⁻¹‖) -+ (SummationFilter.unconditional α).filter (𝓝 ‖F⁻¹‖) -+ have hnorm := (hasProd_inv_unconditional hfac hF).norm -+ refine hnorm.congr' (Filter.Eventually.of_forall ?_) -+ intro s -+ simp [norm_inv, Finset.prod_inv_distrib] -+ -+lemma hasProd_norm_inv_le_exp_of_pointwise_le_exp {α : Type} {fac : α → ℂ} {F : ℂ} -+ (hfac : HasProd fac F (SummationFilter.unconditional α)) -+ (b : α → ℝ) (B : ℝ) -+ (hterm : ∀ x, ‖(fac x)⁻¹‖ ≤ Real.exp (b x)) -+ (hsum : ∀ s : Finset α, (∑ x ∈ s, b x) ≤ B) : -+ ‖F⁻¹‖ ≤ Real.exp B := by -+ by_cases hF : F = 0 -+ · subst hF -+ simpa using exp_nonneg B -+ have hnorm : -+ HasProd (fun x => ‖(fac x)⁻¹‖) ‖F⁻¹‖ (SummationFilter.unconditional α) := -+ hasProd_norm_inv_unconditional hfac hF -+ have hprod : ∀ s : Finset α, (∏ x ∈ s, ‖(fac x)⁻¹‖) ≤ Real.exp B := by -+ intro s -+ have h0 : ∀ x ∈ s, 0 ≤ ‖(fac x)⁻¹‖ := by intro _ _; positivity -+ have h1 : (∏ x ∈ s, ‖(fac x)⁻¹‖) ≤ Real.exp (∑ x ∈ s, b x) := by -+ refine Finset.prod_le_exp_sum s (a := fun x => ‖(fac x)⁻¹‖) (b := b) h0 ?_ -+ intro x hx -+ simpa using hterm x -+ have h2 : Real.exp (∑ x ∈ s, b x) ≤ Real.exp B := -+ Real.exp_le_exp.2 (hsum s) -+ exact h1.trans h2 -+ exact hasProd_le_of_prod_le_exp hnorm hprod -+end -+end HadamardSourceScope29 -+ -+section HadamardSourceScope30 -+ -+open Metric -+ -+namespace Complex -+ -+open _root_.Complex -+ -+theorem borelCaratheodory_zero_closedBall {f : ℂ → ℂ} {M r R : ℝ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ (hr : 0 < r) (hlt : r < R) (hM : 0 < M) (hf0 : f 0 = 0) -+ (hf_re : ∀ w, ‖w‖ ≤ R → (f w).re ≤ M) {z : ℂ} (hz : ‖z‖ ≤ r) : -+ ‖f z‖ ≤ 2 * M * r / (R - r) := by -+ have hR : 0 < R := lt_trans hr hlt -+ have hz_ball : z ∈ Metric.ball (0 : ℂ) R := by -+ rw [Metric.mem_ball, dist_zero_right] -+ exact hz.trans_lt hlt -+ have hf_diff : DifferentiableOn ℂ f (Metric.ball (0 : ℂ) R) := by -+ intro w hw -+ have hw' : w ∈ Metric.closedBall (0 : ℂ) R := ball_subset_closedBall hw -+ exact (hf w hw').differentiableAt.differentiableWithinAt -+ have hf_map : Set.MapsTo f (Metric.ball (0 : ℂ) R) {w | w.re ≤ M} := by -+ intro w hw -+ simp only [Set.mem_ofPred_eq] -+ have hw' : ‖w‖ < R := by simpa [Metric.mem_ball, dist_zero_right] using hw -+ exact hf_re w hw'.le -+ have hbc := -+ borelCaratheodory_zero hM hf_diff hf_map hR hz_ball hf0 -+ have hzR : ‖z‖ < R := by -+ rw [Metric.mem_ball, dist_zero_right] at hz_ball -+ exact hz_ball -+ have hmono : ‖z‖ / (R - ‖z‖) ≤ r / (R - r) := by -+ have hrden : 0 < R - r := sub_pos.mpr hlt -+ have hden : 0 < R - ‖z‖ := sub_pos.mpr hzR -+ rw [div_le_div_iff₀ hden hrden] -+ nlinarith [hz, norm_nonneg z] -+ have hM' : 0 ≤ 2 * M := mul_nonneg (by norm_num) (le_of_lt hM) -+ calc ‖f z‖ -+ ≤ 2 * M * ‖z‖ / (R - ‖z‖) := hbc -+ _ ≤ 2 * M * (r / (R - r)) := by -+ simpa [mul_div_assoc] using mul_le_mul_of_nonneg_left hmono hM' -+ _ = 2 * M * r / (R - r) := by ring -+ -+end Complex -+end HadamardSourceScope30 -+ -+section HadamardSourceScope31 -+ -+noncomputable section -+ -+namespace Complex -+ -+open _root_.Complex -+namespace Hadamard -+ -+open _root_.Complex _root_.Erdos970.Complex _root_.Real _root_.Erdos970.Real -+ BigOperators _root_.Finset Set Filter Topology Metric -+ -+open scoped Topology -+ -+theorem zero_free_polynomial_growth_is_exp_poly {H : ℂ → ℂ} {n : ℕ} -+ (hH : Differentiable ℂ H) -+ (h_nonzero : ∀ z, H z ≠ 0) -+ (h_bound : ∃ C > 0, ∀ z, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ n)) : -+ ∃ P : Polynomial ℂ, P.natDegree ≤ n ∧ ∀ z, H z = Complex.exp (Polynomial.eval z P) := by -+ classical -+ rcases h_bound with ⟨C, hCpos, hC⟩ -+ let L : ℂ → ℂ := fun z => deriv H z / H z -+ have hderivH : Differentiable ℂ (deriv H) := by -+ intro z -+ exact ((hH.analyticAt z).deriv).differentiableAt -+ have hL : Differentiable ℂ L := by -+ simpa [L] using! (hderivH.div hH h_nonzero) -+ let h : ℂ → ℂ := fun z => Complex.wedgeIntegral (0 : ℂ) z L -+ have hh_deriv : ∀ z, HasDerivAt h (L z) z := by -+ intro z -+ let r : ℝ := ‖z‖ + 1 -+ have hrpos : 0 < r := by -+ dsimp [r]; linarith [norm_nonneg z] -+ have hz_ball : z ∈ Metric.ball (0 : ℂ) r := by -+ have : dist z (0 : ℂ) < r := by simp [r, dist_zero_right] -+ simpa [Metric.mem_ball] using this -+ have hconserv : Complex.IsConservativeOn L (Metric.ball (0 : ℂ) r) := -+ (hL.differentiableOn).isConservativeOn -+ have hcont : ContinuousOn L (Metric.ball (0 : ℂ) r) := -+ hL.continuous.continuousOn -+ simpa [h, r] using hconserv.hasDerivAt_wedgeIntegral (f_cont := hcont) (hz := hz_ball) -+ have hh : Differentiable ℂ h := fun z => (hh_deriv z).differentiableAt -+ have hderiv_h : ∀ z, deriv h z = L z := fun z => (hh_deriv z).deriv -+ let k : ℂ → ℂ := fun z => h z + Complex.log (H 0) -+ have hk : Differentiable ℂ k := hh.add_const (Complex.log (H 0)) -+ have hk_exp : ∀ z, H z = Complex.exp (k z) := by -+ let F : ℂ → ℂ := fun z => Complex.exp (k z) / H z -+ have hF_deriv : ∀ z, deriv F z = 0 := by -+ intro z -+ have hH_has : HasDerivAt H (deriv H z) z := (hH z).hasDerivAt -+ have hk_has : HasDerivAt k (L z) z := by -+ have hh_has : HasDerivAt h (L z) z := hh_deriv z -+ simpa [k, L] using hh_has.add_const (Complex.log (H 0)) -+ have hExp : HasDerivAt (fun w => Complex.exp (k w)) (Complex.exp (k z) * L z) z := -+ (HasDerivAt.cexp hk_has) -+ have hDiv := (HasDerivAt.div hExp hH_has (h_nonzero z)) -+ have : -+ deriv F z = -+ ((Complex.exp (k z) * L z) * H z - Complex.exp (k z) * deriv H z) / (H z) ^ 2 := by -+ simpa [F] using! hDiv.deriv -+ rw [this] -+ have hnum : -+ (Complex.exp (k z) * L z) * H z - Complex.exp (k z) * deriv H z = 0 := by -+ dsimp [L] -+ field_simp [h_nonzero z] -+ ring -+ simp [hnum] -+ have hF_diff : Differentiable ℂ F := (hk.cexp).div hH h_nonzero -+ have hF_const : ∀ z, F z = F 0 := by -+ intro z -+ exact is_const_of_deriv_eq_zero hF_diff hF_deriv z 0 -+ have hF0 : F 0 = 1 := by -+ have hh0 : h 0 = 0 := by simp [h, Complex.wedgeIntegral] -+ have hk0 : k 0 = Complex.log (H 0) := by simp [k, hh0] -+ have hH0 : H 0 ≠ 0 := h_nonzero 0 -+ simp [F, hk0, Complex.exp_log hH0, hH0] -+ intro z -+ have : F z = 1 := by simpa [hF0] using (hF_const z) -+ have hHz : H z ≠ 0 := h_nonzero z -+ have : Complex.exp (k z) / H z = 1 := by simpa [F] using this -+ have : Complex.exp (k z) = H z := by -+ field_simp [hHz] at this -+ simpa using this -+ exact this.symm -+ have hk_re_bound : ∀ z, (k z).re ≤ C * (1 + ‖z‖) ^ n := by -+ intro z -+ have hHz : H z ≠ 0 := h_nonzero z -+ have hpos : 0 < ‖H z‖ := norm_pos_iff.mpr hHz -+ have hlog_le : Real.log ‖H z‖ ≤ C * (1 + ‖z‖) ^ n := by -+ have := Real.log_le_log hpos (hC z) -+ simpa [Real.log_exp] using this -+ have hlog_eq : Real.log ‖H z‖ = (k z).re := by -+ have : ‖H z‖ = Real.exp (k z).re := by -+ simpa [hk_exp z] using (Complex.norm_exp (k z)) -+ calc -+ Real.log ‖H z‖ = Real.log (Real.exp (k z).re) := by simp [this] -+ _ = (k z).re := by simp -+ simpa [hlog_eq] using hlog_le -+ have hk_iteratedDeriv_eq_zero : ∀ m : ℕ, n < m → iteratedDeriv m k 0 = 0 := by -+ intro m hm -+ have hm' : 0 < (m - n : ℕ) := Nat.sub_pos_of_lt hm -+ have hmne : m - n ≠ 0 := (Nat.pos_iff_ne_zero.1 hm') -+ let f : ℂ → ℂ := fun z => k z - k 0 -+ have hf : Differentiable ℂ f := hk.sub_const (k 0) -+ have hf0 : f 0 = 0 := by simp [f] -+ have hf_re_bound : ∀ R : ℝ, 0 < R → -+ ∀ z, ‖z‖ ≤ R → (f z).re ≤ C * (1 + R) ^ n + ‖k 0‖ := by -+ intro R hRpos z hzR -+ have hkz : (k z).re ≤ C * (1 + ‖z‖) ^ n := hk_re_bound z -+ have hkz' : (k z).re ≤ C * (1 + R) ^ n := by -+ have h1 : (1 + ‖z‖ : ℝ) ≤ 1 + R := by linarith -+ have hpow : (1 + ‖z‖ : ℝ) ^ n ≤ (1 + R) ^ n := -+ pow_le_pow_left₀ (by linarith [norm_nonneg z]) h1 n -+ exact hkz.trans (mul_le_mul_of_nonneg_left hpow (le_of_lt hCpos)) -+ have hRe0 : -(k 0).re ≤ ‖k 0‖ := by -+ have habs : |(k 0).re| ≤ ‖k 0‖ := Complex.abs_re_le_norm (k 0) -+ have hneg : -(k 0).re ≤ |(k 0).re| := by simpa using (neg_le_abs (k 0).re) -+ exact hneg.trans habs -+ have : (f z).re ≤ C * (1 + R) ^ n + ‖k 0‖ := by -+ have : (f z).re = (k z).re - (k 0).re := by simp [f, sub_eq_add_neg] -+ nlinarith [this, hkz', hRe0] -+ exact this -+ have hf_bound_on_ball : ∀ R : ℝ, 0 < R → -+ ∀ z, ‖z‖ ≤ R / 2 → ‖f z‖ ≤ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ intro R hRpos z hz -+ have hR2pos : 0 < R / 2 := by nlinarith -+ have hlt : R / 2 < R := by nlinarith -+ have hMpos : 0 < (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ have : 0 ≤ C * (1 + R) ^ n := by -+ refine mul_nonneg (le_of_lt hCpos) ?_ -+ exact pow_nonneg (by linarith) _ -+ nlinarith [this, norm_nonneg (k 0)] -+ have hf_anal : AnalyticOnNhd ℂ f (Metric.closedBall 0 R) := by -+ intro w _hw -+ exact (hf.analyticAt w) -+ have hf_re : ∀ w, ‖w‖ ≤ R → (f w).re ≤ (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ intro w hw -+ have := hf_re_bound R hRpos w hw -+ linarith -+ have hf_bc := -+ borelCaratheodory_zero_closedBall (f := f) (r := R / 2) (R := R) -+ (M := (C * (1 + R) ^ n + ‖k 0‖ + 1)) -+ hf_anal hR2pos hlt hMpos hf0 hf_re (z := z) hz -+ have hconst : -+ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) * (R / 2) / (R - R / 2) -+ = 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ field_simp [hRpos.ne'] ; ring -+ simpa [hconst] using hf_bc -+ have hCauchy : ∀ R : ℝ, 0 < R → -+ ‖iteratedDeriv m f 0‖ ≤ -+ (m.factorial : ℝ) * (2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) / (R / 2) ^ m := by -+ intro R hRpos -+ have hR2pos : 0 < R / 2 := by nlinarith -+ have hf_diffCont : DiffContOnCl ℂ f (Metric.ball (0 : ℂ) (R / 2)) := hf.diffContOnCl -+ have hbound_sphere : -+ ∀ z ∈ Metric.sphere (0 : ℂ) (R / 2), -+ ‖f z‖ ≤ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ intro z hz -+ have hz' : ‖z‖ ≤ R / 2 := by -+ simpa [Metric.mem_sphere, dist_zero_right] using (le_of_eq hz) -+ exact hf_bound_on_ball R hRpos z hz' -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using -+ (Complex.norm_iteratedDeriv_le_of_forall_mem_sphere_norm_le (n := m) (c := (0 : ℂ)) -+ (R := R / 2) (C := 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) -+ (hR := hR2pos) hf_diffCont hbound_sphere) -+ have hf_iter_eq : iteratedDeriv m f 0 = 0 := by -+ by_contra hne -+ have ha : 0 < ‖iteratedDeriv m f 0‖ := norm_pos_iff.2 hne -+ let RHS : ℝ → ℝ := fun R => -+ (m.factorial : ℝ) * (2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) / (R / 2) ^ m -+ have hle_RHS : ∀ R : ℝ, 0 < R → ‖iteratedDeriv m f 0‖ ≤ RHS R := by -+ intro R hRpos -+ simpa [RHS] using hCauchy R hRpos -+ have hRHS_tendsto : Tendsto RHS atTop (𝓝 0) := by -+ let K : ℝ := ‖k 0‖ + 1 -+ have hmpos : 0 < m := lt_of_le_of_lt (Nat.zero_le n) hm -+ have hm0 : m ≠ 0 := ne_of_gt hmpos -+ have hratio : Tendsto (fun R : ℝ => R ^ n / (R / 2) ^ m) atTop (𝓝 0) := by -+ have hident : -+ (fun R : ℝ => R ^ n / (R / 2) ^ m) = fun R : ℝ => (2 : ℝ) ^ m * (R ^ n / R ^ m) := by -+ funext R -+ simp [div_eq_mul_inv, mul_pow, mul_assoc, mul_comm] -+ have hmain : Tendsto (fun R : ℝ => R ^ n / R ^ m) atTop (𝓝 0) := by -+ have hp : m - n ≠ 0 := (Nat.pos_iff_ne_zero.1 (Nat.sub_pos_of_lt hm)) -+ have hmain' : Tendsto (fun R : ℝ => (R ^ (m - n))⁻¹) atTop (𝓝 0) := by -+ simpa using (tendsto_pow_neg_atTop (𝕜 := ℝ) (n := m - n) hp) -+ have hEq : (fun R : ℝ => (R ^ (m - n))⁻¹) =ᶠ[atTop] fun R : ℝ => R ^ n / R ^ m := by -+ have hEq' : (fun R : ℝ => R ^ n / R ^ m) =ᶠ[atTop] fun R : ℝ => (R ^ (m - n))⁻¹ := by -+ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR -+ have hle : n ≤ m := le_of_lt hm -+ have hm_eq : n + (m - n) = m := Nat.add_sub_of_le hle -+ have hn0 : R ^ n ≠ 0 := pow_ne_zero n hR -+ calc -+ R ^ n / R ^ m = R ^ n / R ^ (n + (m - n)) := by simp [hm_eq] -+ _ = R ^ n * ((R ^ (m - n))⁻¹ * (R ^ n)⁻¹) := by -+ simp [pow_add, div_eq_mul_inv, mul_comm] -+ _ = (R ^ (m - n))⁻¹ := by -+ ring_nf -+ simp [hn0] -+ exact hEq'.symm -+ exact Filter.Tendsto.congr' hEq hmain' -+ have : Tendsto (fun R : ℝ => (2 : ℝ) ^ m * (R ^ n / R ^ m)) atTop (𝓝 ((2 : ℝ) ^ m * 0)) := -+ tendsto_const_nhds.mul hmain -+ simpa [hident] using this -+ have hinv : Tendsto (fun R : ℝ => ((R / 2) ^ m)⁻¹) atTop (𝓝 0) := by -+ have hdiv : Tendsto (fun R : ℝ => R / 2) atTop atTop := -+ (tendsto_id.atTop_div_const (r := (2 : ℝ)) (by norm_num : (0 : ℝ) < 2)) -+ have hpow : Tendsto (fun R : ℝ => (R / 2) ^ m) atTop atTop := -+ (Filter.tendsto_pow_atTop (α := ℝ) (n := m) hm0).comp hdiv -+ simpa using! hpow.inv_tendsto_atTop -+ have hdiv : Tendsto (fun R : ℝ => (1 + R) / R) atTop (𝓝 (1 : ℝ)) := by -+ have hinv' : Tendsto (fun R : ℝ => (R : ℝ)⁻¹) atTop (𝓝 (0 : ℝ)) := tendsto_inv_atTop_zero -+ have hadd : Tendsto (fun R : ℝ => (1 : ℝ) + (R : ℝ)⁻¹) atTop (𝓝 (1 : ℝ)) := by -+ simpa using (tendsto_const_nhds.add hinv') -+ have hEq : (fun R : ℝ => (1 + R) / R) =ᶠ[atTop] fun R : ℝ => (1 : ℝ) + (R : ℝ)⁻¹ := by -+ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR -+ field_simp [hR]; ring -+ exact Filter.Tendsto.congr' hEq.symm hadd -+ have hdiv_pow : Tendsto (fun R : ℝ => ((1 + R) / R) ^ n) atTop (𝓝 (1 : ℝ)) := by -+ simpa using (hdiv.pow n) -+ have hone_add_ratio : -+ Tendsto (fun R : ℝ => (1 + R) ^ n / (R / 2) ^ m) atTop (𝓝 (0 : ℝ)) := by -+ have hEq : -+ (fun R : ℝ => (1 + R) ^ n / (R / 2) ^ m) -+ =ᶠ[atTop] fun R : ℝ => ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) := by -+ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR -+ have hRpow : (R ^ n : ℝ) ≠ 0 := pow_ne_zero n hR -+ have hident : -+ ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) = (1 + R) ^ n / (R / 2) ^ m := by -+ calc -+ ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) -+ = ((1 + R) ^ n / R ^ n) * (R ^ n / (R / 2) ^ m) := by -+ simp [div_pow] -+ _ = ((1 + R) ^ n * R ^ n) / (R ^ n * (R / 2) ^ m) := by -+ simp [div_mul_div_comm, mul_comm] -+ _ = ((1 + R) ^ n * R ^ n) / ((R / 2) ^ m * R ^ n) := by -+ simp [mul_comm] -+ _ = (1 + R) ^ n / (R / 2) ^ m := by -+ simpa [mul_assoc, mul_comm, mul_left_comm] using -+ (mul_div_mul_right (a := (1 + R) ^ n) (b := (R / 2) ^ m) hRpow) -+ exact hident.symm -+ have hmul : -+ Tendsto -+ (fun R : ℝ => ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m)) -+ atTop (𝓝 (0 : ℝ)) := by -+ simpa [mul_zero] using (hdiv_pow.mul hratio) -+ exact Filter.Tendsto.congr' hEq.symm hmul -+ have h1 : Tendsto (fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m)) atTop (𝓝 0) := by -+ simpa using (tendsto_const_nhds.mul hone_add_ratio) -+ have h2 : Tendsto (fun R : ℝ => K * ((R / 2) ^ m)⁻¹) atTop (𝓝 0) := by -+ simpa using (tendsto_const_nhds.mul hinv) -+ have hsum : -+ Tendsto -+ (fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m) + K * ((R / 2) ^ m)⁻¹) -+ atTop (𝓝 0) := by -+ simpa using (h1.add h2) -+ have hrew : -+ (fun R : ℝ => (C * (1 + R) ^ n + K) / (R / 2) ^ m) -+ = fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m) + K * ((R / 2) ^ m)⁻¹ := by -+ funext R -+ simp [div_eq_mul_inv, mul_add, mul_assoc, mul_comm] -+ have hbase : Tendsto (fun R : ℝ => (C * (1 + R) ^ n + K) / (R / 2) ^ m) atTop (𝓝 0) := by -+ simpa [hrew] using hsum -+ have hconst : -+ Tendsto (fun _ : ℝ => (m.factorial : ℝ) * (2 : ℝ)) atTop -+ (𝓝 ((m.factorial : ℝ) * (2 : ℝ))) := tendsto_const_nhds -+ have hmul : Tendsto (fun R : ℝ => ((m.factorial : ℝ) * (2 : ℝ)) * -+ ((C * (1 + R) ^ n + K) / (R / 2) ^ m)) atTop (𝓝 0) := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using (hconst.mul hbase) -+ have hRHS_rw : RHS = fun R : ℝ => ((m.factorial : ℝ) * (2 : ℝ)) * -+ ((C * (1 + R) ^ n + K) / (R / 2) ^ m) := by -+ funext R -+ dsimp [RHS, K] -+ ring_nf -+ simpa [hRHS_rw] using hmul -+ have hsmall : ∀ᶠ R in atTop, RHS R < ‖iteratedDeriv m f 0‖ / 2 := -+ (tendsto_order.1 hRHS_tendsto).2 _ (half_pos ha) -+ have hle_eventually : ∀ᶠ R in atTop, ‖iteratedDeriv m f 0‖ ≤ RHS R := by -+ filter_upwards [eventually_gt_atTop (0 : ℝ)] with R hRpos -+ exact hle_RHS R hRpos -+ rcases (hle_eventually.and hsmall).exists with ⟨R, hle, hlt⟩ -+ have : ‖iteratedDeriv m f 0‖ < ‖iteratedDeriv m f 0‖ := -+ (lt_of_le_of_lt hle hlt).trans (half_lt_self ha) -+ exact lt_irrefl _ this -+ have hmpos : 0 < m := lt_of_le_of_lt (Nat.zero_le n) hm -+ have hm0 : m ≠ 0 := ne_of_gt hmpos -+ have hkcd : ContDiffAt ℂ (↑m) k (0 : ℂ) := (hk.analyticAt 0).contDiffAt -+ have hccd : ContDiffAt ℂ (↑m) (fun _ : ℂ => k 0) (0 : ℂ) := contDiffAt_const -+ have hsub : -+ iteratedDeriv m f 0 = -+ iteratedDeriv m k 0 - iteratedDeriv m (fun _ : ℂ => k 0) 0 := by -+ simpa [f] using! (iteratedDeriv_sub (n := m) (x := (0 : ℂ)) hkcd hccd) -+ have hconst0 : iteratedDeriv m (fun _ : ℂ => k 0) 0 = 0 := by -+ simp [iteratedDeriv_const, hm0] -+ have hf_eq : iteratedDeriv m f 0 = iteratedDeriv m k 0 := by -+ simp [hsub, hconst0] -+ simpa [hf_eq] using hf_iter_eq -+ let P : Polynomial ℂ := -+ ∑ m ∈ Finset.range (n + 1), Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) -+ have hPdeg : P.natDegree ≤ n := by -+ have hnat : -+ P.natDegree ≤ -+ Finset.fold max 0 -+ (fun m : ℕ => -+ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) -+ (Finset.range (n + 1)) := by -+ simpa [P, Function.comp] using -+ (Polynomial.natDegree_sum_le (s := Finset.range (n + 1)) -+ (f := fun m : ℕ => -+ Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0))) -+ have hfold : -+ Finset.fold max 0 -+ (fun m : ℕ => -+ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) -+ (Finset.range (n + 1)) ≤ n := by -+ refine (Finset.fold_max_le (f := fun m : ℕ => -+ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) -+ (b := 0) (s := Finset.range (n + 1)) (c := n)).2 ?_ -+ refine ⟨Nat.zero_le n, ?_⟩ -+ intro m hm -+ have hmon : -+ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree ≤ m := -+ Polynomial.natDegree_monomial_le _ -+ have hm_le : m ≤ n := Nat.le_of_lt_succ (Finset.mem_range.1 hm) -+ exact hmon.trans hm_le -+ exact hnat.trans hfold -+ have hk_poly : ∀ z, k z = Polynomial.eval z P := by -+ intro z -+ have htaylor := Complex.taylorSeries_eq_of_entire' (c := (0 : ℂ)) (z := z) hk -+ have htail : ∀ m : ℕ, m ∉ Finset.range (n + 1) → -+ ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m) = 0 := by -+ intro m hm' -+ have hmgt : n < m := by -+ have : n + 1 ≤ m := Nat.le_of_not_lt (by simpa [Finset.mem_range] using hm') -+ exact Nat.lt_of_lt_of_le (Nat.lt_succ_self n) this -+ have hz : iteratedDeriv m k 0 = 0 := hk_iteratedDeriv_eq_zero m hmgt -+ simp [hz] -+ have htsum : -+ (∑' m : ℕ, (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m) -+ = ∑ m ∈ Finset.range (n + 1), (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * z ^ m := by -+ simpa [sub_zero] using (tsum_eq_sum (s := Finset.range (n + 1)) htail) -+ have hfinite : -+ k z = ∑ m ∈ Finset.range (n + 1), (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * z ^ m := by -+ calc -+ k z = ∑' m : ℕ, (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m := by -+ simpa using htaylor.symm -+ _ = _ := htsum -+ have hEval : -+ Polynomial.eval z P = -+ ∑ m ∈ Finset.range (n + 1), z ^ m * ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) := by -+ classical -+ change Polynomial.eval₂ (RingHom.id ℂ) z P = _ -+ let φ : Polynomial ℂ →+* ℂ := Polynomial.eval₂RingHom (RingHom.id ℂ) z -+ change φ P = _ -+ simp [P, φ, Polynomial.eval₂_monomial, mul_comm] -+ have hfinite' : -+ k z = ∑ m ∈ Finset.range (n + 1), z ^ m * ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) := by -+ simpa [mul_comm, mul_left_comm, mul_assoc] using hfinite -+ simpa [hEval] using hfinite' -+ refine ⟨P, hPdeg, ?_⟩ -+ intro z -+ have : H z = Complex.exp (k z) := by simp [hk_exp z] -+ simp [this, hk_poly z] -+ -+end Hadamard -+end Complex -+end -+end HadamardSourceScope31 -+ -+section HadamardSourceScope32 -+ -+noncomputable section -+ -+namespace Complex -+ -+open _root_.Complex -+namespace Hadamard -+ -+open _root_.Complex _root_.Erdos970.Complex _root_.Real _root_.Erdos970.Real -+ BigOperators _root_.Finset Set Filter Topology Metric -+ -+open scoped Topology -+ -+open Polynomial -+ -+private lemma exists_pow_eq_complex {n : ℕ} (hn : 0 < n) (w : ℂ) : ∃ z : ℂ, z ^ n = w := by -+ classical -+ by_cases hw : w = 0 -+ · subst hw -+ refine ⟨0, ?_⟩ -+ have hn0 : n ≠ 0 := Nat.ne_of_gt hn -+ simp [hn0] -+ · refine ⟨Complex.exp (Complex.log w / n), ?_⟩ -+ have hn0 : (n : ℂ) ≠ 0 := by -+ exact_mod_cast (Nat.ne_of_gt hn) -+ calc -+ (Complex.exp (Complex.log w / n)) ^ n -+ = Complex.exp ((n : ℂ) * (Complex.log w / n)) := by -+ simpa using (Complex.exp_nat_mul (Complex.log w / n) n).symm -+ _ = Complex.exp (Complex.log w) := by -+ have : (n : ℂ) * (Complex.log w / n) = Complex.log w := by -+ field_simp [hn0] -+ simp [this] -+ _ = w := by simpa using (Complex.exp_log hw) -+ -+private lemma mul_conj_div_norm (a : ℂ) (ha : a ≠ 0) : -+ a * ((starRingEnd ℂ) a / (‖a‖ : ℂ)) = (‖a‖ : ℂ) := by -+ have hnorm_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha -+ have hnorm_ne : (‖a‖ : ℂ) ≠ 0 := by -+ exact_mod_cast (ne_of_gt hnorm_pos) -+ have hmul : a * (starRingEnd ℂ) a = (Complex.normSq a : ℂ) := -+ Complex.mul_conj a -+ have hcast : (Complex.normSq a : ℂ) = ((‖a‖ ^ 2 : ℝ) : ℂ) := by -+ exact_mod_cast (Complex.normSq_eq_norm_sq a) -+ have hdiv : ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) = (‖a‖ : ℂ) := by -+ have : ((‖a‖ ^ 2 : ℝ) : ℂ) = (‖a‖ : ℂ) * (‖a‖ : ℂ) := by -+ simp [pow_two] -+ calc -+ ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) -+ = ((‖a‖ : ℂ) * (‖a‖ : ℂ)) / (‖a‖ : ℂ) := by simp [this] -+ _ = (‖a‖ : ℂ) := by -+ field_simp [hnorm_ne] -+ calc -+ a * ((starRingEnd ℂ) a / (‖a‖ : ℂ)) -+ = (a * (starRingEnd ℂ) a) / (‖a‖ : ℂ) := by -+ simp [div_eq_mul_inv, mul_assoc] -+ _ = (Complex.normSq a : ℂ) / (‖a‖ : ℂ) := by simp [hmul] -+ _ = ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) := by simp [hcast] -+ _ = (‖a‖ : ℂ) := hdiv -+ -+private lemma exists_z_norm_eq_re_eval_ge -+ (P : Polynomial ℂ) (hn : 0 < P.natDegree) : -+ ∃ R0 : ℝ, 0 < R0 ∧ -+ ∀ R : ℝ, R0 ≤ R → -+ ∃ z : ℂ, ‖z‖ = R ∧ -+ (‖P.leadingCoeff‖ / 2) * R ^ P.natDegree ≤ (P.eval z).re := by -+ classical -+ set n : ℕ := P.natDegree -+ have hn0 : 0 < n := hn -+ have hP0 : P ≠ 0 := by -+ intro h0 -+ simp [n, h0] at hn0 -+ have hLC : P.leadingCoeff ≠ 0 := Polynomial.leadingCoeff_ne_zero.mpr hP0 -+ set a : ℂ := P.leadingCoeff -+ have ha : a ≠ 0 := hLC -+ have hnorm_a_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha -+ set wtarget : ℂ := (starRingEnd ℂ) a / (‖a‖ : ℂ) -+ have hwtarget_norm : ‖wtarget‖ = (1 : ℝ) := by -+ calc -+ ‖wtarget‖ = ‖(starRingEnd ℂ) a‖ / ‖(‖a‖ : ℂ)‖ := by -+ simp [wtarget] -+ _ = ‖a‖ / ‖a‖ := by simp -+ _ = (1 : ℝ) := by -+ field_simp [hnorm_a_pos.ne'] -+ rcases exists_pow_eq_complex (n := n) hn0 (w := wtarget) with ⟨w, hw⟩ -+ have hw_norm : ‖w‖ = (1 : ℝ) := by -+ have hpow : (‖w‖ : ℝ) ^ n = 1 := by -+ have := congrArg (fun z : ℂ => ‖z‖) hw -+ simpa [norm_pow, hwtarget_norm] using this -+ have hn0' : n ≠ 0 := Nat.ne_of_gt hn0 -+ exact (pow_eq_one_iff_of_nonneg (norm_nonneg w) hn0').1 hpow -+ set S : ℝ := ∑ i ∈ Finset.range n, ‖P.coeff i‖ -+ set R0 : ℝ := max 1 (2 * S / ‖a‖) -+ refine ⟨R0, ?_, ?_⟩ -+ · have : (0 : ℝ) < (1 : ℝ) := by norm_num -+ exact lt_of_lt_of_le this (le_max_left _ _) -+ · intro R hR -+ have hR_ge1 : (1 : ℝ) ≤ R := by -+ exact le_trans (le_max_left _ _) hR -+ have hR_nonneg : 0 ≤ R := le_trans (by norm_num) hR_ge1 -+ set z : ℂ := (R : ℂ) * w -+ have hz_norm : ‖z‖ = R := by -+ have : ‖z‖ = |R| * ‖w‖ := by -+ simp [z] -+ simp [this, hw_norm, abs_of_nonneg hR_nonneg] -+ have h_eval : P.eval z = -+ (∑ i ∈ Finset.range n, P.coeff i * z ^ i) + P.coeff n * z ^ n := by -+ have hsum : P.eval z = ∑ i ∈ Finset.range (n + 1), P.coeff i * z ^ i := by -+ have : P.natDegree + 1 = n + 1 := by simp [n] -+ simpa [this] using (Polynomial.eval_eq_sum_range (p := P) z) -+ have hsplit : -+ (∑ i ∈ Finset.range (n + 1), P.coeff i * z ^ i) -+ = (∑ i ∈ Finset.range n, P.coeff i * z ^ i) + P.coeff n * z ^ n := by -+ simpa using (Finset.sum_range_succ (f := fun i => P.coeff i * z ^ i) n) -+ exact hsum.trans hsplit -+ have h_lower_norm : -+ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ S * R ^ (n - 1) := by -+ have h1 : -+ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ -+ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ := by -+ simpa using (norm_sum_le (Finset.range n) (fun i => P.coeff i * z ^ i)) -+ have hterm : ∀ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ ≤ ‖P.coeff i‖ * R ^ (n - 1) := by -+ intro i hi -+ have hi_lt : i < n := Finset.mem_range.mp hi -+ have hi_le : i ≤ n - 1 := Nat.le_pred_of_lt hi_lt -+ have hzpow : ‖z‖ ^ i ≤ R ^ (n - 1) := by -+ have hmono : ‖z‖ ^ i ≤ ‖z‖ ^ (n - 1) := -+ pow_le_pow_right₀ (by simpa [hz_norm] using hR_ge1) hi_le -+ simpa [hz_norm] using hmono -+ calc -+ ‖P.coeff i * z ^ i‖ = ‖P.coeff i‖ * ‖z‖ ^ i := by -+ simp [norm_pow] -+ _ ≤ ‖P.coeff i‖ * R ^ (n - 1) := by -+ exact mul_le_mul_of_nonneg_left hzpow (norm_nonneg _) -+ have h2 : -+ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ -+ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1) := by -+ exact Finset.sum_le_sum (fun i hi => hterm i hi) -+ have h3 : -+ (∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1)) -+ = (∑ i ∈ Finset.range n, ‖P.coeff i‖) * R ^ (n - 1) := by -+ simp [Finset.sum_mul] -+ have hsum_le : (∑ i ∈ Finset.range n, ‖P.coeff i‖) ≤ S := by -+ simp [S] -+ calc -+ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ -+ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ := h1 -+ _ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1) := h2 -+ _ = (∑ i ∈ Finset.range n, ‖P.coeff i‖) * R ^ (n - 1) := h3 -+ _ ≤ S * R ^ (n - 1) := by -+ exact mul_le_mul_of_nonneg_right hsum_le (pow_nonneg hR_nonneg _) -+ have h_lead_re : (P.coeff n * z ^ n).re = ‖a‖ * R ^ n := by -+ have hw_pow : w ^ n = wtarget := hw -+ have ha_mul : a * w ^ n = (‖a‖ : ℂ) := by -+ have : a * w ^ n = a * wtarget := by simp [hw_pow] -+ simpa [wtarget, a] using (this.trans (mul_conj_div_norm a ha)) -+ have hz_pow : z ^ n = ((R : ℂ) ^ n) * (w ^ n) := by -+ simp [z, mul_pow, mul_comm] -+ have hcoeffn : P.coeff n = a := by simp [a, n, Polynomial.coeff_natDegree] -+ have hreR : ∀ m : ℕ, (((R : ℂ) ^ m).re) = R ^ m := by -+ intro m -+ induction m with -+ | zero => simp -+ | succ m ih => -+ simp [pow_succ, ih, mul_re] -+ calc -+ (P.coeff n * z ^ n).re -+ = (a * z ^ n).re := by simp [hcoeffn] -+ _ = (a * (((R : ℂ) ^ n) * (w ^ n))).re := by simp [hz_pow] -+ _ = (((R : ℂ) ^ n) * (a * (w ^ n))).re := by -+ ring_nf -+ _ = (((R : ℂ) ^ n) * (‖a‖ : ℂ)).re := by simp [ha_mul] -+ _ = (((R : ℂ) ^ n).re) * ‖a‖ := by -+ simp [mul_re] -+ _ = (R ^ n) * ‖a‖ := by simp [hreR n] -+ _ = ‖a‖ * R ^ n := by ring -+ refine ⟨z, hz_norm, ?_⟩ -+ have hre_lower : (∑ i ∈ Finset.range n, P.coeff i * z ^ i).re -+ ≥ -‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := by -+ have habs : |(∑ i ∈ Finset.range n, P.coeff i * z ^ i).re| -+ ≤ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := -+ Complex.abs_re_le_norm _ -+ have := neg_le_of_abs_le habs -+ simpa using this -+ have hre_main : -+ (P.eval z).re ≥ (P.coeff n * z ^ n).re - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := by -+ have : (P.eval z).re = -+ (∑ i ∈ Finset.range n, P.coeff i * z ^ i).re + (P.coeff n * z ^ n).re := by -+ simp [h_eval, add_comm] -+ linarith [this, hre_lower] -+ have hR_ge_R0 : R0 ≤ R := hR -+ have hR_ge : 2 * S / ‖a‖ ≤ R := le_trans (le_max_right _ _) hR_ge_R0 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR_ge1 -+ have hR_nonneg' : 0 ≤ R := le_of_lt hRpos -+ have hn_ge1 : 1 ≤ n := Nat.succ_le_of_lt hn0 -+ have hlower_le : S * R ^ (n - 1) ≤ (‖a‖ / 2) * R ^ n := by -+ have ha_pos : 0 < ‖a‖ := hnorm_a_pos -+ have hS_le : S ≤ (‖a‖ / 2) * R := by -+ have : 2 * S ≤ ‖a‖ * R := by -+ have := (mul_le_mul_of_nonneg_left hR_ge (by linarith [ha_pos.le] : (0 : ℝ) ≤ ‖a‖)) -+ have hne : (‖a‖ : ℝ) ≠ 0 := ne_of_gt ha_pos -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm, hne] using this -+ have : S ≤ (‖a‖ * R) / 2 := by linarith -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using this -+ have : S * R ^ (n - 1) ≤ (‖a‖ / 2) * R * R ^ (n - 1) := by -+ have hpow_nonneg : 0 ≤ R ^ (n - 1) := pow_nonneg hR_nonneg' _ -+ exact mul_le_mul_of_nonneg_right hS_le hpow_nonneg -+ have hRR : R * R ^ (n - 1) = R ^ n := by -+ have : n = (n - 1) + 1 := by -+ exact (Nat.sub_add_cancel hn_ge1).symm -+ rw [this, pow_succ] -+ ring_nf; grind -+ simpa [mul_assoc, hRR] using this -+ have hfinal_re : -+ (‖a‖ / 2) * R ^ n ≤ (P.eval z).re := by -+ have hlower' : ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ (‖a‖ / 2) * R ^ n := by -+ exact h_lower_norm.trans hlower_le -+ have hlead : (P.coeff n * z ^ n).re = ‖a‖ * R ^ n := by simpa [a] using h_lead_re -+ have hre_main' : -+ (‖a‖ * R ^ n) - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ (P.eval z).re := by -+ simpa [hlead] using hre_main -+ have hsub : -+ (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n ≤ -+ (‖a‖ * R ^ n) - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := -+ sub_le_sub_left hlower' (‖a‖ * R ^ n) -+ have hsim : (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n = (‖a‖ / 2) * R ^ n := by ring -+ have : (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n ≤ (P.eval z).re := -+ hsub.trans hre_main' -+ simpa [hsim] using this -+ simpa [a, n] using hfinal_re -+ -+theorem natDegree_le_floor_of_growth_exp_eval -+ {ρ : ℝ} (hρ : 0 ≤ ρ) (P : Polynomial ℂ) -+ (hgrowth : -+ ∃ C > 0, ∀ z : ℂ, -+ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ ρ) : -+ P.natDegree ≤ Nat.floor ρ := by -+ classical -+ by_cases hdeg : P.natDegree = 0 -+ · simp [hdeg] -+ · have hnpos : 0 < P.natDegree := Nat.pos_of_ne_zero hdeg -+ rcases exists_z_norm_eq_re_eval_ge (P := P) hnpos with ⟨R0, hR0pos, hray⟩ -+ rcases hgrowth with ⟨C, hCpos, hC⟩ -+ have hLCpos : 0 < ‖P.leadingCoeff‖ := by -+ have hP0 : P ≠ 0 := by -+ intro h0 -+ simp [h0] at hdeg -+ have : P.leadingCoeff ≠ 0 := (Polynomial.leadingCoeff_ne_zero).2 hP0 -+ exact norm_pos_iff.2 this -+ let c : ℝ := ‖P.leadingCoeff‖ / 2 -+ have hcpos : 0 < c := by -+ have : (0 : ℝ) < (2 : ℝ) := by norm_num -+ exact (div_pos hLCpos this) -+ have hn_le_real : (P.natDegree : ℝ) ≤ ρ := by -+ by_contra hnlt -+ have hnlt' : ρ < (P.natDegree : ℝ) := lt_of_not_ge hnlt -+ let δ : ℝ := (P.natDegree : ℝ) - ρ -+ have hδ : 0 < δ := sub_pos.2 hnlt' -+ let K0 : ℝ := (C * (2 : ℝ) ^ ρ) / c -+ have hK0 : ∃ R1, ∀ R ≥ R1, K0 + 1 ≤ R ^ δ := by -+ have h : ∀ᶠ R in (atTop : Filter ℝ), K0 + 1 ≤ R ^ δ := -+ (tendsto_atTop.mp (tendsto_rpow_atTop hδ)) (K0 + 1) -+ rcases (eventually_atTop.1 h) with ⟨R1, hR1⟩ -+ exact ⟨R1, hR1⟩ -+ rcases hK0 with ⟨R1, hR1⟩ -+ set R : ℝ := max (max R0 1) R1 -+ have hR_ge_R0 : R0 ≤ R := le_trans (le_max_left _ _) (le_max_left _ _) -+ have hR_ge1 : (1 : ℝ) ≤ R := le_trans (le_max_right _ _) (le_max_left _ _) -+ have hR_ge_R1 : R1 ≤ R := le_max_right _ _ -+ have hR_pos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR_ge1 -+ have hRδ : K0 + 1 ≤ R ^ δ := hR1 R hR_ge_R1 -+ rcases hray R hR_ge_R0 with ⟨z, hz_norm, hz_re⟩ -+ have hlog_lower : -+ (P.eval z).re ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := by -+ have hpos : 0 < ‖Complex.exp (Polynomial.eval z P)‖ := by -+ simp -+ have hle : -+ ‖Complex.exp (Polynomial.eval z P)‖ ≤ -+ 1 + ‖Complex.exp (Polynomial.eval z P)‖ := by -+ linarith [norm_nonneg (Complex.exp (Polynomial.eval z P))] -+ have hlog_le : Real.log ‖Complex.exp (Polynomial.eval z P)‖ -+ ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := -+ Real.log_le_log hpos hle -+ have hlog_eq : Real.log ‖Complex.exp (Polynomial.eval z P)‖ = (P.eval z).re := by -+ simp [Complex.norm_exp] -+ simpa [hlog_eq] using hlog_le -+ have hlog_upper : -+ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ ρ := -+ hC z -+ have hmain : c * R ^ (P.natDegree : ℝ) ≤ C * (1 + R) ^ ρ := by -+ have hz_re' : c * R ^ P.natDegree ≤ (P.eval z).re := by -+ simpa [c] using hz_re -+ have hz_re'' : c * R ^ (P.natDegree : ℝ) ≤ (P.eval z).re := by -+ simpa [Real.rpow_natCast, c] using hz_re' -+ have : c * R ^ (P.natDegree : ℝ) ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := -+ hz_re''.trans hlog_lower -+ have : c * R ^ (P.natDegree : ℝ) ≤ C * (1 + ‖z‖) ^ ρ := -+ this.trans hlog_upper -+ simpa [hz_norm] using this -+ have h1R_le : (1 + R : ℝ) ≤ R * 2 := by linarith -+ have hpow1 : (1 + R : ℝ) ^ ρ ≤ (R * 2) ^ ρ := -+ Real.rpow_le_rpow (by linarith [hR_pos.le]) h1R_le hρ -+ have hR2 : (R * 2) ^ ρ = R ^ ρ * (2 : ℝ) ^ ρ := by -+ have hRnonneg : 0 ≤ R := le_of_lt hR_pos -+ have h2nonneg : 0 ≤ (2 : ℝ) := by norm_num -+ simpa [mul_assoc] using (Real.mul_rpow hRnonneg h2nonneg (z := ρ)) -+ have hmain' : c * R ^ (P.natDegree : ℝ) ≤ C * (R ^ ρ * (2 : ℝ) ^ ρ) := by -+ have := le_trans hmain (mul_le_mul_of_nonneg_left hpow1 (le_of_lt hCpos)) -+ simpa [hR2, mul_assoc, mul_left_comm, mul_comm] using this -+ have hRρ_pos : 0 < R ^ ρ := Real.rpow_pos_of_pos hR_pos _ -+ have hRρ_ne : (R ^ ρ : ℝ) ≠ 0 := ne_of_gt hRρ_pos -+ have hdiv : -+ (c * R ^ (P.natDegree : ℝ)) / (R ^ ρ) ≤ C * (2 : ℝ) ^ ρ := by -+ have h := -+ div_le_div_of_nonneg_right hmain' (le_of_lt hRρ_pos) -+ have hRhs : (C * (R ^ ρ * (2 : ℝ) ^ ρ)) / (R ^ ρ) = C * (2 : ℝ) ^ ρ := by -+ field_simp [hRρ_ne] -+ simpa [hRhs, mul_assoc, mul_left_comm, mul_comm] using h -+ have hRsub : R ^ δ = R ^ (P.natDegree : ℝ) / R ^ ρ := by -+ simpa [δ] using (Real.rpow_sub hR_pos (P.natDegree : ℝ) ρ) -+ have hRδ_le : c * (R ^ δ) ≤ C * (2 : ℝ) ^ ρ := by -+ have hLhs : c * (R ^ δ) = (c * R ^ (P.natDegree : ℝ)) / (R ^ ρ) := by -+ simp [hRsub, div_eq_mul_inv, mul_left_comm, mul_comm] -+ simpa [hLhs] using hdiv -+ have hRδ_le' : R ^ δ ≤ K0 := by -+ have : R ^ δ ≤ (C * (2 : ℝ) ^ ρ) / c := by -+ refine (le_div_iff₀ hcpos).2 ?_ -+ simpa [mul_assoc, mul_left_comm, mul_comm] using hRδ_le -+ simpa [K0] using this -+ have : K0 + 1 ≤ K0 := le_trans hRδ (le_trans hRδ_le' (le_rfl)) -+ exact (not_lt_of_ge this) (lt_add_of_pos_right _ (by norm_num : (0 : ℝ) < 1)) -+ exact (Nat.le_floor_iff hρ).2 hn_le_real -+ -+theorem natDegree_le_floor_of_exp_eval_norm_bound {τ : ℝ} (hτ : 0 ≤ τ) (P : Polynomial ℂ) -+ (hbound : -+ ∃ C > 0, ∀ z : ℂ, -+ ‖Complex.exp (Polynomial.eval z P)‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ)) : -+ P.natDegree ≤ Nat.floor τ := by -+ rcases hbound with ⟨C, hCpos, hC⟩ -+ have hlog_growth : -+ ∃ C > 0, ∀ z : ℂ, -+ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ τ := -+ Real.log_growth_of_norm_le_exp_mul_rpow -+ (f := fun z : ℂ => Complex.exp (Polynomial.eval z P)) -+ (r := fun z : ℂ => 1 + ‖z‖) hCpos hτ -+ (fun z => by linarith [norm_nonneg z]) hC -+ exact natDegree_le_floor_of_growth_exp_eval (ρ := τ) hτ P hlog_growth -+ -+end Hadamard -+end Complex -+end -+end HadamardSourceScope32 -+ -+section HadamardSourceScope33 -+ -+noncomputable section -+ -+open Set Filter Asymptotics -+open scoped Topology BigOperators -+ -+namespace Complex.Hadamard -+ -+open _root_.Complex -+ -+lemma no_zero_on_sphere_of_norm_image_avoid -+ {f : ℂ → ℂ} (hentire : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ {B r : ℝ} (hrpos : 0 < r) (hr_le_B : r ≤ B) -+ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (hsmall_fin : smallSet.Finite) -+ (hsmallSet : -+ smallSet = {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ B}) -+ (hr_not_bad : -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ r ∉ small.image a) : -+ ∀ u : ℂ, ‖u‖ = r → f u ≠ 0 := by -+ classical -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let bad : Finset ℝ := small.image a -+ have hr_not_bad' : r ∉ bad := by -+ simpa [bad, small, a] using hr_not_bad -+ have hr_not : -+ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖ ≤ B → r ≠ ‖divisorZeroIndex₀Val p‖ := by -+ intro p hpB hEq -+ have hp_small : p ∈ small := by -+ have hp_mem : p ∈ smallSet := by -+ simpa [hsmallSet] using hpB -+ simpa [small] using (hsmall_fin.mem_toFinset.2 hp_mem) -+ have : r ∈ bad := Finset.mem_image.2 ⟨p, hp_small, by simpa [a] using hEq.symm⟩ -+ exact (hr_not_bad' this).elim -+ exact no_zero_on_sphere_of_forall_val_norm_ne (f := f) hentire hnot -+ (B := B) (r := r) hrpos hr_le_B hr_not -+ -+theorem norm_inv_hadamardDenominator_le_exp_on_cartan_circle -+ {f : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} -+ (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) -+ (hτ_nonneg : 0 ≤ τ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (hsumτ : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : -+ let Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ let Cprod : ℝ := cartanProductConstant m τ Sτ -+ ∀ {R r : ℝ}, 0 < R → 1 ≤ R → R ≤ r → r ≤ 2 * R → -+ ∀ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsmall_fin : smallSet.Finite), -+ smallSet = -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} → -+ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => ‖divisorZeroIndex₀Val p‖ -+ r ∉ small.image a) → -+ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => ‖divisorZeroIndex₀Val p‖ -+ (∑ p ∈ small, (1 : ℝ) * CartanBound.φ (r / a p)) ≤ -+ CartanBound.Cφ * (small.card : ℝ)) → -+ ∀ u : ℂ, ‖u‖ = r → -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ ≤ Real.exp (Cprod * (1 + r) ^ τ) := by -+ classical -+ intro Sτ Cprod R r hRpos hRle hR_le_r hr_le_2R smallSet hsmall_fin -+ hsmallSet hr_not_bad hr_phi u hur -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let bad : Finset ℝ := small.image a -+ have hr_not_bad' : r ∉ bad := by -+ simpa [bad, small, a] using hr_not_bad -+ have hr1 : (1 : ℝ) ≤ r := le_trans hRle hR_le_r -+ have hpow_inv_le1 : ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ ≤ 1 := -+ Complex.norm_inv_pow_le_one_of_one_le_norm u (analyticOrderNatAt f 0) (by simpa [hur] using hr1) -+ let fac : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := -+ fun p => weierstrassFactor m (u / divisorZeroIndex₀Val p) -+ have hloc : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (w : ℂ) => -+ weierstrassFactor m (w / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ (Set.univ : Set ℂ) := -+ hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ have hprod : -+ HasProd fac (divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := -+ hloc.hasProd (by simp : u ∈ (Set.univ : Set ℂ)) -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ have : DecidablePred (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => p ∈ small) := -+ Classical.decPred _ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if hp : p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ have hterm : ∀ p, ‖(fac p)⁻¹‖ ≤ Real.exp (b p) := by -+ intro p -+ by_cases hp : p ∈ small -+ · have hval_ne : r ≠ ap p := by -+ intro hEq -+ have : r ∈ bad := by -+ refine Finset.mem_image.2 ⟨p, hp, ?_⟩ -+ simp [ap, a, hEq] -+ exact (hr_not_bad' this).elim -+ have hval0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ have hmτ : (m : ℝ) ≤ τ := le_trans hmρ (le_of_lt hτ) -+ have hnear : -+ ‖(weierstrassFactor m (u / divisorZeroIndex₀Val p))⁻¹‖ -+ ≤ Real.exp (CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ)) := by -+ simpa [ap] using -+ (norm_inv_weierstrassFactor_le_exp_near (m := m) (τ := τ) (r := r) -+ (u := u) (a := divisorZeroIndex₀Val p) -+ (hur := hur) (ha := hval0) (hr := by simpa [ap] using hval_ne) hmτ) -+ simpa [fac, b, hp] using hnear -+ · have hlarge : (4 * R : ℝ) < ap p := by -+ have : ¬ap p ≤ 4 * R := by -+ intro hle -+ have : p ∈ small := by -+ have hp_mem : p ∈ smallSet := by -+ simpa [hsmallSet, ap] using hle -+ simpa [small] using (hsmall_fin.mem_toFinset.2 hp_mem) -+ exact hp this -+ exact lt_of_not_ge this -+ have hz' : ‖u / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := -+ norm_div_le_half_of_norm_le_of_two_mul_lt (z := u) (a := divisorZeroIndex₀Val p) -+ (R := 2 * R) (by nlinarith [hRpos]) (by rw [hur]; exact hr_le_2R) -+ (by nlinarith [hlarge]) -+ have hτ_le : τ ≤ (m + 1 : ℝ) := le_of_lt hτ_lt -+ have hfar : -+ ‖(weierstrassFactor m (u / divisorZeroIndex₀Val p))⁻¹‖ ≤ -+ Real.exp ((2 : ℝ) * (r / ap p) ^ τ) := by -+ simpa [ap] using -+ (norm_inv_weierstrassFactor_le_exp_far (m := m) (τ := τ) (r := r) -+ (u := u) (a := divisorZeroIndex₀Val p) -+ (hur := hur) (ha := divisorZeroIndex₀Val_ne_zero p) (hz := hz') hτ_le) -+ simpa [fac, b, hp] using hfar -+ have hb_le : -+ ∀ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)), -+ (∑ p ∈ s, b p) ≤ Cprod * (1 + r) ^ τ := by -+ intro s -+ simpa [small, ap, b, Sτ, Cprod, a, hsmallSet] using -+ (Complex.Hadamard.cartan_sum_majorant_le (f := f) (m := m) (τ := τ) (R := R) (r := r) -+ (hRpos := hRpos) (hrpos := lt_of_lt_of_le hRpos hR_le_r) -+ (hR_le_r := hR_le_r) (hτ_nonneg := hτ_nonneg) -+ (smallSet := smallSet) (hsmall_fin := hsmall_fin) (hsmallSet := hsmallSet) -+ (hsumτ := hsumτ) -+ (hr_phi := by -+ simpa [small, a, one_mul] using hr_phi) -+ s) -+ have hcprod_inv : -+ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ≤ -+ Real.exp (Cprod * (1 + r) ^ τ) := by -+ refine hasProd_norm_inv_le_exp_of_pointwise_le_exp -+ (α := divisorZeroIndex₀ f (Set.univ : Set ℂ)) (fac := fac) -+ (F := divisorCanonicalProduct m f (Set.univ : Set ℂ) u) -+ hprod (b := b) (B := Cprod * (1 + r) ^ τ) ?_ ?_ -+ · exact hterm -+ · intro s -+ exact hb_le s -+ have hmul : -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ = -+ ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ * -+ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ := by -+ simp [mul_inv_rev, mul_comm] -+ rw [hmul] -+ have : -+ ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ * -+ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ ≤ 1 * Real.exp (Cprod * (1 + r) ^ τ) := -+ mul_le_mul hpow_inv_le1 hcprod_inv (by positivity) (by positivity) -+ simpa using this -+ -+theorem hadamardQuotient_norm_le_exp_on_cartan_circle -+ {f H : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} {Cf : ℝ} -+ (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) -+ (hτ_nonneg : 0 ≤ τ) (hentire : Differentiable ℂ f) -+ (hnot : ∃ z : ℂ, f z ≠ 0) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (hsumτ : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) -+ (hf_boundτ : ∀ z : ℂ, ‖f z‖ ≤ Real.exp (Cf * (1 + ‖z‖) ^ τ)) -+ (hfactor : ∀ z : ℂ, -+ f z = -+ H z * z ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) z) : -+ let Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ let Cprod : ℝ := cartanProductConstant m τ Sτ -+ ∀ {R r : ℝ}, 0 < R → 1 ≤ R → R ≤ r → r ≤ 2 * R → 0 < r → -+ ∀ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsmall_fin : smallSet.Finite), -+ smallSet = -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} → -+ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => ‖divisorZeroIndex₀Val p‖ -+ r ∉ small.image a) → -+ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => ‖divisorZeroIndex₀Val p‖ -+ (∑ p ∈ small, (1 : ℝ) * CartanBound.φ (r / a p)) ≤ -+ CartanBound.Cφ * (small.card : ℝ)) → -+ ∀ u : ℂ, ‖u‖ = r → ‖H u‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by -+ classical -+ intro Sτ Cprod R r hRpos hRle hR_le_r hr_le_2R hrpos smallSet hsmall_fin -+ hsmallSet hr_not_bad hr_phi u hur -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let bad : Finset ℝ := small.image a -+ have hr_not_bad' : r ∉ bad := by -+ simpa [bad, small, a] using hr_not_bad -+ have hden_eq : -+ f u = -+ H u * (u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using (hfactor u) -+ have hfu_ne : f u ≠ 0 := by -+ have hr_le_4R : r ≤ 4 * R := by nlinarith [hr_le_2R, hRpos] -+ exact no_zero_on_sphere_of_norm_image_avoid (f := f) hentire hnot -+ (B := 4 * R) (r := r) hrpos hr_le_4R smallSet hsmall_fin hsmallSet -+ (by simpa [small, a] using hr_not_bad) u hur -+ have hden_ne : -+ (u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) ≠ 0 := by -+ intro hden0 -+ have : f u = 0 := by simpa [hden0] using hden_eq -+ exact hfu_ne this -+ have hHu : -+ H u = -+ f u / (u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := by -+ exact eq_div_of_mul_eq hden_ne (Eq.symm hden_eq) -+ have hf_u : ‖f u‖ ≤ Real.exp (Cf * (1 + r) ^ τ) := by -+ simpa [hur] using hf_boundτ u -+ have hden_inv : -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ ≤ Real.exp (Cprod * (1 + r) ^ τ) := by -+ simpa [Sτ, Cprod] using -+ (norm_inv_hadamardDenominator_le_exp_on_cartan_circle -+ (f := f) (ρ := ρ) (τ := τ) (m := m) -+ hmρ hτ hτ_lt hτ_nonneg h_sum hsumτ -+ (R := R) (r := r) hRpos hRle hR_le_r hr_le_2R -+ smallSet hsmall_fin hsmallSet -+ (by simpa [small, a] using hr_not_bad) -+ (by simpa [small, a, one_mul] using hr_phi) -+ u hur) -+ have : -+ ‖H u‖ ≤ -+ ‖f u‖ * -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ := by -+ have : -+ ‖H u‖ = -+ ‖f u / -+ (u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)‖ := by -+ simp [hHu] -+ simp [div_eq_mul_inv, norm_inv, this] -+ have hmul : -+ ‖f u‖ * -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ ≤ Real.exp (Cf * (1 + r) ^ τ) * Real.exp (Cprod * (1 + r) ^ τ) := -+ mul_le_mul hf_u hden_inv (by positivity) (by positivity) -+ have hexp : -+ Real.exp (Cf * (1 + r) ^ τ) * Real.exp (Cprod * (1 + r) ^ τ) -+ = Real.exp ((Cf + Cprod) * (1 + r) ^ τ) := by -+ simp [Real.exp_add, add_mul, add_comm] -+ have : ‖H u‖ ≤ Real.exp ((Cf + Cprod) * (1 + r) ^ τ) := -+ (this.trans hmul).trans_eq hexp -+ have hslack : -+ Real.exp ((Cf + Cprod) * (1 + r) ^ τ) ≤ -+ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by -+ refine Real.exp_le_exp.2 ?_ -+ have hnn : 0 ≤ (1 + r) ^ τ := by positivity -+ nlinarith -+ exact this.trans hslack -+ -+theorem hadamardQuotient_norm_le_exp_rpow_of_growth {f H : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} -+ (hρ : 0 ≤ ρ) (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) -+ (hτ_nonneg : 0 ≤ τ) (hentire : Differentiable ℂ f) (hH_entire : Differentiable ℂ H) -+ (hnot : ∃ z : ℂ, f z ≠ 0) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) -+ (hfactor : ∀ z : ℂ, -+ f z = -+ H z * z ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) z) : -+ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := by -+ rcases hgrowth with ⟨Cf, hCfpos, hCf⟩ -+ have hsumτ : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := -+ summable_norm_inv_rpow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) (τ := τ) -+ hρ hτ hentire hnot ⟨Cf, hCfpos, hCf⟩ -+ let Sτ : ℝ := ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ have hSτ_nonneg : 0 ≤ Sτ := tsum_nonneg fun _ => -+ Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ -+ let Cprod : ℝ := cartanProductConstant m τ Sτ -+ have hCprod_nonneg : 0 ≤ Cprod := by -+ simpa [Cprod] using cartanProductConstant_nonneg (m := m) (τ := τ) hSτ_nonneg -+ have hf_boundτ : ∀ z : ℂ, ‖f z‖ ≤ Real.exp (Cf * (1 + ‖z‖) ^ τ) := -+ Real.norm_le_exp_mul_rpow_of_log_growth -+ (f := f) (r := fun z : ℂ => 1 + ‖z‖) (C := Cf) (ρ := ρ) (τ := τ) -+ hCfpos.le (fun z => by linarith [norm_nonneg z]) (le_of_lt hτ) hCf -+ refine ⟨(Cf + Cprod + 10) * (3 : ℝ) ^ τ, by -+ have h3τ : 0 < (3 : ℝ) ^ τ := by positivity -+ nlinarith [hCfpos, hCprod_nonneg, h3τ], ?_⟩ -+ intro z -+ let R : ℝ := max ‖z‖ 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num) (le_max_right _ _) -+ have hRle : (1 : ℝ) ≤ R := le_max_right _ _ -+ let smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ {p | ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} -+ have hsmall_fin : smallSet.Finite := by -+ have : Metric.closedBall (0 : ℂ) (4 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ simpa [smallSet] using -+ (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) -+ (B := 4 * R) this) -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ have ha_pos : ∀ p ∈ small, 0 < a p := by -+ intro p hp -+ exact norm_pos_iff.2 (divisorZeroIndex₀Val_ne_zero p) -+ let bad : Finset ℝ := small.image a -+ rcases CartanBound.exists_radius_Ioc_sum_mul_phi_div_le_Cφ_mul_sum_avoid -+ (s := small) (w := fun _ => (1 : ℝ)) (a := a) -+ (hw := by intro _ _; norm_num) (ha := ha_pos) (bad := bad) (R := R) hRpos with -+ ⟨r, hr_mem, hr_not_bad, hr_phi⟩ -+ have hR_le_r : R ≤ r := le_of_lt hr_mem.1 -+ have hr_le_2R : r ≤ 2 * R := hr_mem.2 -+ have hrpos : 0 < r := lt_of_lt_of_le hRpos hR_le_r -+ have hcircle : -+ ∀ u : ℂ, ‖u‖ = r → ‖H u‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by -+ simpa [Sτ, Cprod] using -+ (hadamardQuotient_norm_le_exp_on_cartan_circle -+ (f := f) (H := H) (ρ := ρ) (τ := τ) (m := m) (Cf := Cf) -+ hmρ hτ hτ_lt hτ_nonneg hentire hnot h_sum hsumτ hf_boundτ hfactor -+ (R := R) (r := r) hRpos hRle hR_le_r hr_le_2R hrpos -+ smallSet hsmall_fin (by rfl) -+ (by simpa [small, a, bad] using hr_not_bad) -+ (by simpa [small, a, one_mul, Finset.sum_const, nsmul_eq_mul] using hr_phi)) -+ have hz_ball : z ∈ Metric.ball (0 : ℂ) r := by -+ rw [Metric.mem_ball, dist_zero_right] -+ exact lt_of_le_of_lt (le_max_left _ _) hr_mem.1 -+ have hball : -+ ‖H z‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by -+ exact Complex.norm_le_of_mem_ball_of_forall_sphere_norm_le hH_entire hrpos hz_ball hcircle -+ have hr_le_3 : 1 + r ≤ 3 * (1 + ‖z‖) := by -+ exact Real.one_add_le_three_mul_one_add_of_le_two_mul_max (norm_nonneg z) -+ (by simpa [R] using hr_le_2R) -+ have hmain : -+ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) -+ ≤ Real.exp (((Cf + Cprod + 10) * (3 : ℝ) ^ τ) * (1 + ‖z‖) ^ τ) := by -+ have hnn : 0 ≤ (Cf + Cprod + 10) := by nlinarith [le_of_lt hCfpos, hCprod_nonneg] -+ exact Real.exp_mul_rpow_le_exp_mul_rpow_of_le_mul hnn (by norm_num) -+ (by linarith [le_of_lt hrpos]) (by positivity) hτ_nonneg hr_le_3 -+ simpa [mul_assoc] using hball.trans hmain -+ -+theorem hadamard_factorization_of_growth {f : ℂ → ℂ} {ρ : ℝ} (hρ : 0 ≤ ρ) -+ (hentire : Differentiable ℂ f) -+ (hnot : ∃ z : ℂ, f z ≠ 0) -+ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : -+ ∃ (P : Polynomial ℂ), -+ P.degree ≤ Nat.floor ρ ∧ -+ ∀ z : ℂ, -+ f z = -+ Complex.exp (Polynomial.eval z P) * -+ z ^ (analyticOrderNatAt f 0) * -+ divisorCanonicalProduct (Nat.floor ρ) f (Set.univ : Set ℂ) z := by -+ set m : ℕ := Nat.floor ρ -+ have h_sum : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ simpa [m] using -+ (summable_norm_inv_pow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) -+ hρ hentire hnot hgrowth) -+ rcases exists_entire_nonzero_hadamardQuotient (m := m) (f := f) hentire hnot h_sum with -+ ⟨H, hH_entire, hH_ne, hfactor⟩ -+ rcases Real.exists_between_self_and_floor_add_one_same_floor hρ with -+ ⟨τ, hτ, hτ_lt, hτ_nonneg, hfloorτ'⟩ -+ have hfloorτ : Nat.floor τ = m := by -+ simpa [m] using hfloorτ' -+ have hτ_lt_m : τ < (m + 1 : ℝ) := by -+ simpa [m] using hτ_lt -+ have hτ_lt_nat : τ < ((m + 1 : ℕ) : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one] using hτ_lt_m -+ have hmρ : (m : ℝ) ≤ ρ := by -+ have := Nat.floor_le hρ -+ simpa [m] using this -+ have hH_bound_rpow : -+ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := -+ hadamardQuotient_norm_le_exp_rpow_of_growth (f := f) (H := H) (ρ := ρ) (τ := τ) -+ (m := m) hρ hmρ hτ hτ_lt hτ_nonneg hentire hH_entire hnot h_sum hgrowth hfactor -+ have hH_growth_nat : -+ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ (m + 1)) := by -+ exact Real.exists_norm_le_exp_mul_pow_of_rpow_bound -+ (f := H) (r := fun z : ℂ => 1 + ‖z‖) -+ (fun z => by linarith [norm_nonneg z]) hτ_lt_nat hH_bound_rpow -+ rcases zero_free_polynomial_growth_is_exp_poly (H := H) (n := m + 1) -+ hH_entire hH_ne hH_growth_nat with -+ ⟨P, hPn, hHP⟩ -+ have hPnat : P.natDegree ≤ m := by -+ have hbound : -+ ∃ C > 0, ∀ z : ℂ, -+ ‖Complex.exp (Polynomial.eval z P)‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := by -+ rcases hH_bound_rpow with ⟨C, hCpos, hC⟩ -+ exact ⟨C, hCpos, fun z => by simpa [hHP z] using (hC z)⟩ -+ have := natDegree_le_floor_of_exp_eval_norm_bound hτ_nonneg P hbound -+ simpa [hfloorτ] using this -+ refine ⟨P, ?_, ?_⟩ -+ · have : P.degree ≤ m := Polynomial.degree_le_of_natDegree_le hPnat -+ simpa [m] using this -+ · intro z -+ have hH' : H z = Complex.exp (Polynomial.eval z P) := by simpa using (hHP z) -+ simpa [hH', mul_assoc, mul_left_comm, mul_comm, m] using (hfactor z) -+ -+end Complex.Hadamard -+end -+end HadamardSourceScope33 -+ -+end HadamardAssemblyScope -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Mathlib/Algebra/Notation/Support.lean b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Algebra/Notation/Support.lean -new file mode 100644 -index 0000000..39dd03b ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Algebra/Notation/Support.lean -@@ -0,0 +1,17 @@ -+import Mathlib.Algebra.Notation.Support -+ -+namespace Erdos970 -+ -+namespace Function -+ -+variable {α : Type*} [Zero α] -+ -+theorem support_id : _root_.Function.support (id : α → α) = {0}ᶜ := by -+ ext; simp -+ -+theorem support_id' {α : Type*} [Zero α] : _root_.Function.support (fun x : α ↦ x) = {0}ᶜ := -+ support_id -+ -+end Function -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/Asymptotics/Asymptotics.lean b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/Asymptotics/Asymptotics.lean -new file mode 100644 -index 0000000..1ef2299 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/Asymptotics/Asymptotics.lean -@@ -0,0 +1,42 @@ -+import Mathlib.Analysis.Asymptotics.Lemmas -+import Mathlib.Topology.Order.Compact -+ -+namespace Erdos970 -+ -+open Filter Topology -+ -+namespace Asymptotics -+ -+variable {α : Type*} {β : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*} -+ {F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {R : Type*} -+ {R' : Type*} {𝕜 : Type*} {𝕜' : Type*} -+ -+variable [Norm E] [Norm F] [Norm G] -+ -+variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G'] -+ [NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R] -+ [SeminormedRing R'] -+ -+theorem isLittleO_const_id_cocompact [ProperSpace F''] -+ (c : E'') : (fun _x : F'' => c) =o[cocompact F''] id := -+ _root_.Asymptotics.isLittleO_const_left.2 <| Or.inr tendsto_norm_cocompact_atTop -+ -+theorem isLittleO_const_id_atTop2 [LinearOrder F''] [NoMaxOrder F''] [ClosedIciTopology F''] -+ [ProperSpace F''] (c : E'') : (fun _x : F'' => c) =o[atTop] id := -+ (isLittleO_const_id_cocompact c).mono atTop_le_cocompact -+ -+theorem isLittleO_const_id_atBot2 [LinearOrder F''] [NoMinOrder F''] [ClosedIicTopology F''] -+ [ProperSpace F''] (c : E'') : (fun _x : F'' => c) =o[atBot] id := -+ (isLittleO_const_id_cocompact c).mono atBot_le_cocompact -+ -+theorem _root_.Erdos970.Filter.Eventually.natCast {f : ℝ → Prop} (hf : ∀ᶠ x in atTop, f x) : -+ ∀ᶠ n : ℕ in atTop, f n := -+ tendsto_natCast_atTop_atTop.eventually hf -+ -+theorem IsBigO.natCast {f g : ℝ → E} (h : f =O[atTop] g) : -+ (fun n : ℕ => f n) =O[atTop] fun n : ℕ => g n := -+ h.comp_tendsto tendsto_natCast_atTop_atTop -+ -+end Asymptotics -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean -new file mode 100644 -index 0000000..b8b7136 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean -@@ -0,0 +1,20 @@ -+import Mathlib.Algebra.Order.Floor.Defs -+import Mathlib.Algebra.Order.Floor.Ring -+import Mathlib.Algebra.Order.Floor.Semiring -+import Mathlib.Analysis.SpecialFunctions.Log.Basic -+import Mathlib.Analysis.SpecialFunctions.Pow.Continuity -+ -+namespace Erdos970 -+ -+open Filter Real -+ -+theorem Real.tendsto_pow_log_div_pow_atTop (a : ℝ) (b : ℝ) (ha : 0 < a) : -+ Filter.Tendsto (fun x ↦ log x ^ b / x^a) Filter.atTop (nhds 0) := by -+ apply Asymptotics.isLittleO_iff_tendsto' _|>.mp <| isLittleO_log_rpow_rpow_atTop _ ha -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ intro h -+ rw [rpow_eq_zero hx.le ha.ne.symm] at h -+ exfalso -+ linarith -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/MellinCalculus.lean b/PrimeNumberTheoremAnd/Erdos970/MellinCalculus.lean -new file mode 100644 -index 0000000..12adb34 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/MellinCalculus.lean -@@ -0,0 +1,1024 @@ -+import Batteries.Tactic.Lemma -+import Mathlib.Algebra.GroupWithZero.Units.Basic -+import Mathlib.Analysis.MellinTransform -+import Mathlib.MeasureTheory.Integral.IntegrableOn -+import Mathlib.Tactic.Bound -+import Mathlib.Tactic.GCongr -+import PrimeNumberTheoremAnd.Erdos970.Auxiliary -+ -+namespace Erdos970 -+ -+open scoped ContDiff -+ -+ -+open _root_.Complex _root_.Topology _root_.Filter _root_.Real _root_.MeasureTheory -+ _root_.Set _root_.Function -+ -+theorem MeasureTheory.setIntegral_integral_swap {α : Type*} {β : Type*} {E : Type*} -+ [MeasurableSpace α] [MeasurableSpace β] {μ : MeasureTheory.Measure α} -+ {ν : MeasureTheory.Measure β} [NormedAddCommGroup E] -+ [MeasureTheory.SigmaFinite ν] [NormedSpace ℝ E] [MeasureTheory.SigmaFinite μ] -+ (f : α → β → E) {s : Set α} {t : Set β} -+ (hf : IntegrableOn (f.uncurry) (s ×ˢ t) (μ.prod ν)) : -+ (∫ (x : α) in s, ∫ (y : β) in t, f x y ∂ν ∂μ) -+ = ∫ (y : β) in t, ∫ (x : α) in s, f x y ∂μ ∂ν := by -+ apply integral_integral_swap -+ convert hf.integrable -+ exact Measure.prod_restrict s t -+ -+open Erdos970.Complex Erdos970.MeasureTheory -+ -+variable {𝕂 : Type*} [RCLike 𝕂] -+ -+lemma MeasureTheory.integral_comp_mul_right_I0i_haar -+ (f : ℝ → 𝕂) {a : ℝ} (ha : 0 < a) : -+ ∫ (y : ℝ) in Ioi 0, f (y * a) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by -+ have := integral_comp_mul_right_Ioi (fun y ↦ f y / y) 0 ha -+ simp only [RCLike.ofReal_mul, zero_mul, eq_inv_smul_iff₀ (ne_of_gt ha)] at this -+ rw [← integral_smul] at this -+ rw [← this, setIntegral_congr_fun (by simp)] -+ intro _ _ -+ simp only [RCLike.real_smul_eq_coe_mul] -+ rw [mul_comm (a : 𝕂), div_mul, mul_div_assoc, div_self ?_, mul_one] -+ exact (RCLike.ofReal_ne_zero).mpr <| ne_of_gt ha -+ -+lemma MeasureTheory.integral_comp_mul_right_I0i_haar_real -+ (f : ℝ → ℝ) {a : ℝ} (ha : 0 < a) : -+ ∫ (y : ℝ) in Ioi 0, f (y * a) / y = ∫ (y : ℝ) in Ioi 0, f y / y := -+ MeasureTheory.integral_comp_mul_right_I0i_haar f ha -+ -+lemma MeasureTheory.integral_comp_mul_left_I0i_haar -+ (f : ℝ → 𝕂) {a : ℝ} (ha : 0 < a) : -+ ∫ (y : ℝ) in Ioi 0, f (a * y) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by -+ convert integral_comp_mul_right_I0i_haar f ha using 5; ring -+ -+lemma MeasureTheory.integral_comp_rpow_I0i_haar_real (f : ℝ → ℝ) {p : ℝ} (hp : p ≠ 0) : -+ ∫ (y : ℝ) in Ioi 0, |p| * f (y ^ p) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by -+ rw [← integral_comp_rpow_Ioi (fun y ↦ f y / y) hp, setIntegral_congr_fun (by simp)] -+ intro y hy -+ have ypos : 0 < y := mem_Ioi.mp hy -+ simp only [rpow_sub_one ypos.ne', smul_eq_mul] -+ field_simp -+ -+lemma MeasureTheory.integral_comp_inv_I0i_haar (f : ℝ → 𝕂) : -+ ∫ (y : ℝ) in Ioi 0, f (1 / y) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by -+ have := integral_comp_rpow_Ioi (fun y ↦ f y / y) (p := -1) (by simp) -+ rw [← this, setIntegral_congr_fun (by simp)] -+ intro y hy -+ have : (y : 𝕂) ≠ 0 := (RCLike.ofReal_ne_zero).mpr <| LT.lt.ne' hy -+ simp only [abs_neg, abs_one, rpow_neg_one, map_inv₀, div_inv_eq_mul, -+ RCLike.real_smul_eq_coe_mul, RCLike.algebraMap_eq_ofReal] -+ ring_nf -+ simp [field] -+ -+lemma MeasureTheory.integral_comp_div_I0i_haar -+ (f : ℝ → 𝕂) {a : ℝ} (ha : 0 < a) : -+ ∫ (y : ℝ) in Ioi 0, f (a / y) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by -+ calc -+ _ = ∫ (y : ℝ) in Ioi 0, f (a * y) / y := ?_ -+ _ = _ := integral_comp_mul_left_I0i_haar f ha -+ convert (integral_comp_inv_I0i_haar fun y ↦ f (a * (1 / y))).symm using 4 -+ · rw [mul_one_div] -+ · rw [one_div_one_div] -+ -+theorem Complex.ofReal_rpow {x : ℝ} (h : x > 0) (y : ℝ) : -+ (((x : ℝ) ^ (y : ℝ)) : ℝ) = (x : ℂ) ^ (y : ℂ) := by -+ rw [rpow_def_of_pos h, ofReal_exp, ofReal_mul, Complex.ofReal_log h.le, -+ Complex.cpow_def_of_ne_zero] -+ simp only [ne_eq, ofReal_eq_zero, ne_of_gt h, not_false_eq_true] -+ -+@[simp] -+lemma Function.support_abs {α : Type*} (f : α → 𝕂) : -+ (fun x ↦ ‖f x‖).support = f.support := by -+ simp only [support, ne_eq]; simp_rw [norm_ne_zero_iff] -+ -+@[simp] -+lemma Function.support_ofReal {f : ℝ → ℝ} : -+ (fun x ↦ ((f x) : ℂ)).support = f.support := by -+ apply Function.support_comp_eq (g := ofReal); simp -+ -+lemma Function.support_mul_subset_of_subset {s : Set ℝ} {f g : ℝ → 𝕂} -+ (fSupp : f.support ⊆ s) : (f * g).support ⊆ s := by -+ simp_rw [support_mul', inter_subset, subset_union_of_subset_right fSupp] -+ -+lemma Function.support_of_along_fiber_subset_subset {α β M : Type*} [Zero M] -+ {f : α × β → M} {s : Set α} {t : Set β} -+ (hx : ∀ (y : β), (fun x ↦ f (x, y)).support ⊆ s) -+ (hy : ∀ (x : α), (fun y ↦ f (x, y)).support ⊆ t) : -+ f.support ⊆ s ×ˢ t := by -+ intro ⟨x, y⟩ hxy -+ constructor -+ · exact hx y (by simp only [Function.mem_support, ne_eq] at hxy ⊢; exact hxy) -+ · exact hy x (by simp only [Function.mem_support, ne_eq] at hxy ⊢; exact hxy) -+ -+lemma Function.support_deriv_subset_Icc {a b : ℝ} {f : ℝ → 𝕂} -+ (fSupp : f.support ⊆ Set.Icc a b) : -+ (deriv f).support ⊆ Set.Icc a b := by -+ have := support_deriv_subset (f := fun x ↦ f x) -+ dsimp [tsupport] at this -+ have := subset_trans this <| closure_mono fSupp -+ rwa [closure_Icc] at this -+ -+lemma IntervalIntegral.integral_eq_integral_of_support_subset_Icc {a b : ℝ} {μ : Measure ℝ} -+ [NullSingletonClass μ] {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] -+ {f : ℝ → E} (h : f.support ⊆ Icc a b) : -+ ∫ x in a..b, f x ∂μ = ∫ x, f x ∂μ := by -+ rcases le_total a b with hab | hab -+ · rw [intervalIntegral.integral_of_le hab, ← integral_Icc_eq_integral_Ioc, -+ ← integral_indicator measurableSet_Icc, indicator_eq_self.2 h] -+ · by_cases hab2 : b = a -+ · rw [hab2] at h ⊢ -+ simp only [intervalIntegral.integral_same] -+ simp only [Icc_self] at h -+ have : ∫ (x : ℝ), f x ∂μ = ∫ (x : ℝ) in {a}, f x ∂μ := by -+ rw [ ← integral_indicator (by simp), indicator_eq_self.2 h] -+ rw [this, integral_singleton]; simp [Measure.real] -+ · rw [Icc_eq_empty_iff.mpr <| by exact fun x ↦ hab2 <| le_antisymm hab x, subset_empty_iff, -+ Function.support_eq_empty_iff] at h; simp [h] -+ -+lemma SetIntegral.integral_eq_integral_inter_of_support_subset {μ : Measure ℝ} -+ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] -+ {s t : Set ℝ} {f : ℝ → E} (h : f.support ⊆ t) (ht : MeasurableSet t) : -+ ∫ x in s, f x ∂μ = ∫ x in s ∩ t, f x ∂μ := by -+ rw [← setIntegral_indicator ht, indicator_eq_self.2 h] -+ -+lemma SetIntegral.integral_eq_integral_inter_of_support_subset_Icc {a b} {μ : Measure ℝ} -+ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] -+ {s : Set ℝ} {f : ℝ → E} (h : f.support ⊆ Icc a b) (hs : Icc a b ⊆ s) : -+ ∫ x in s, f x ∂μ = ∫ x in Icc a b, f x ∂μ := by -+ rw [SetIntegral.integral_eq_integral_inter_of_support_subset h measurableSet_Icc, -+ inter_eq_self_of_subset_right hs] -+ -+lemma intervalIntegral.norm_integral_le_of_norm_le_const' {a b C : ℝ} -+ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] -+ {f : ℝ → E} (hab : a ≤ b) (h : ∀ x ∈ (Icc a b), ‖f x‖ ≤ C) : -+ ‖∫ x in a..b, f x‖ ≤ C * |b - a| := by -+ apply intervalIntegral.norm_integral_le_of_norm_le_const -+ exact fun x hx ↦ h x <| mem_Icc_of_Ioc <| uIoc_of_le hab ▸ hx -+ -+lemma Filter.TendstoAtZero_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) (ha : 0 < a) -+ (fSupp : f.support ⊆ Set.Icc a b) : -+ Tendsto f (𝓝[>]0) (𝓝 0) := by -+ apply Tendsto.comp (tendsto_nhds_of_eventually_eq ?_) tendsto_id -+ filter_upwards [Ioo_mem_nhdsGT ha] with c hc; replace hc := (mem_Ioo.mp hc).2 -+ have h : c ∉ Icc a b := fun h ↦ by linarith [mem_Icc.mp h] -+ convert mt (Function.support_subset_iff.mp fSupp c) h; simp -+ -+lemma Filter.TendstoAtTop_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) -+ (fSupp : f.support ⊆ Set.Icc a b) : -+ Tendsto f atTop (𝓝 0) := by -+ apply Tendsto.comp (tendsto_nhds_of_eventually_eq ?_) tendsto_id -+ filter_upwards [Ioi_mem_atTop b] with c hc; rw [mem_Ioi] at hc -+ have h : c ∉ Icc a b := fun h ↦ by linarith [mem_Icc.mp h] -+ convert mt (Function.support_subset_iff.mp fSupp c) h; simp -+ -+lemma Filter.BigO_zero_atZero_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) (ha : 0 < a) -+ (fSupp : f.support ⊆ Set.Icc a b) : -+ f =O[𝓝[>] 0] fun _ ↦ (0 : ℝ) := by -+ refine Eventually.isBigO ?_ -+ filter_upwards [Ioo_mem_nhdsGT (by linarith : (0 : ℝ) < a)] with c hc -+ refine norm_le_zero_iff.mpr <| Function.support_subset_iff'.mp fSupp c ?_ -+ exact fun h ↦ by linarith [mem_Icc.mp h, (mem_Ioo.mp hc).2] -+ -+lemma Filter.BigO_zero_atTop_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) -+ (fSupp : f.support ⊆ Set.Icc a b) : -+ f =O[atTop] fun _ ↦ (0 : ℝ) := by -+ refine Eventually.isBigO ?_ -+ filter_upwards [Ioi_mem_atTop b] with c hc; replace hc := mem_Ioi.mp hc -+ refine norm_le_zero_iff.mpr <| Function.support_subset_iff'.mp fSupp c ?_ -+ exact fun h ↦ by linarith [mem_Icc.mp h] -+ -+open Erdos970.Filter -+ -+lemma deriv.ofReal_comp' {f : ℝ → ℝ} : -+ deriv (fun x : ℝ ↦ (f x : ℂ)) = (fun x ↦ ((deriv f) x : ℂ)) := -+ funext fun _ ↦ deriv.ofReal_comp -+ -+lemma deriv.comp_ofReal' {e : ℂ → ℂ} (hf : Differentiable ℂ e) : -+ deriv (fun x : ℝ ↦ e x) = fun (x : ℝ) ↦ deriv e x := -+ funext fun _ ↦ deriv.comp_ofReal (hf.differentiableAt) -+ -+lemma PartialIntegration (f g : ℝ → ℂ) -+ (fDiff : DifferentiableOn ℝ f (Ioi 0)) -+ (gDiff : DifferentiableOn ℝ g (Ioi 0)) -+ (fDerivgInt : IntegrableOn (f * deriv g) (Ioi 0)) -+ (gDerivfInt : IntegrableOn (deriv f * g) (Ioi 0)) -+ (lim_at_zero : Tendsto (f * g) (𝓝[>] 0) (𝓝 0)) -+ (lim_at_inf : Tendsto (f * g) atTop (𝓝 0)) : -+ ∫ x in Ioi 0, f x * deriv g x = -∫ x in Ioi 0, deriv f x * g x := by -+ simpa using integral_Ioi_mul_deriv_eq_deriv_mul -+ (fun x hx ↦ fDiff.hasDerivAt (Ioi_mem_nhds hx)) -+ (fun x hx ↦ gDiff.hasDerivAt (Ioi_mem_nhds hx)) -+ fDerivgInt gDerivfInt lim_at_zero lim_at_inf -+ -+lemma PartialIntegration_of_support_in_Icc {a b : ℝ} (f g : ℝ → ℂ) (ha : 0 < a) -+ (h : a ≤ b) -+ (fSupp : f.support ⊆ Set.Icc a b) -+ (fDiff : DifferentiableOn ℝ f (Ioi 0)) -+ (gDiff : DifferentiableOn ℝ g (Ioi 0)) -+ (fderivCont : ContinuousOn (deriv f) (Ioi 0)) -+ (gderivCont : ContinuousOn (deriv g) (Ioi 0)) : -+ ∫ x in Ioi 0, f x * deriv g x = -∫ x in Ioi 0, deriv f x * g x := by -+ have Icc_sub : Icc a b ⊆ Ioi 0 := (Icc_subset_Ioi_iff h).mpr ha -+ have fderivSupp := Function.support_deriv_subset_Icc fSupp -+ have fgSupp : (f * g).support ⊆ Icc a b := Function.support_mul_subset_of_subset fSupp -+ have fDerivgInt : IntegrableOn (f * deriv g) (Ioi 0) := by -+ apply (integrableOn_iff_integrable_of_support_subset <| -+ Function.support_mul_subset_of_subset fSupp).mp -+ exact fDiff.continuousOn.mono Icc_sub |>.mul (gderivCont.mono Icc_sub) |>.integrableOn_Icc -+ have gDerivfInt : IntegrableOn (deriv f * g) (Ioi 0) := by -+ apply (integrableOn_iff_integrable_of_support_subset <| -+ Function.support_mul_subset_of_subset fderivSupp).mp -+ exact fderivCont.mono Icc_sub |>.mul (gDiff.continuousOn.mono Icc_sub) |>.integrableOn_Icc -+ have lim_at_zero : Tendsto (f * g) (𝓝[>]0) (𝓝 0) := -+ TendstoAtZero_of_support_in_Icc (f * g) ha fgSupp -+ have lim_at_inf : Tendsto (f * g) atTop (𝓝 0) := TendstoAtTop_of_support_in_Icc (f * g) fgSupp -+ apply PartialIntegration f g fDiff gDiff fDerivgInt gDerivfInt lim_at_zero lim_at_inf -+ -+local notation (name := mellintransform) "𝓜" => mellin -+ -+noncomputable def MellinConvolution (f g : ℝ → 𝕂) (x : ℝ) : 𝕂 := -+ ∫ y in Ioi 0, f y * g (x / y) / y -+ -+lemma MellinConvolutionSymmetric (f g : ℝ → 𝕂) {x : ℝ} (xpos : 0 < x) : -+ MellinConvolution f g x = MellinConvolution g f x := by -+ unfold MellinConvolution -+ calc -+ _ = ∫ y in Ioi 0, f (y * x) * g (1 / y) / y := ?_ -+ _ = _ := ?_ -+ · rw [← integral_comp_mul_right_I0i_haar (fun y ↦ f y * g (x / y)) xpos] -+ simp [div_mul_cancel_right₀ <| ne_of_gt xpos] -+ · convert (integral_comp_inv_I0i_haar fun y ↦ f (y * x) * g (1 / y)).symm using 3 -+ rw [one_div_one_div, mul_comm, mul_comm_div, one_mul] -+ -+open Pointwise in -+lemma support_MellinConvolution_subsets {f g : ℝ → 𝕂} {A B : Set ℝ} (hf : f.support ⊆ A) -+ (hg : g.support ⊆ B) : (MellinConvolution f g).support ⊆ A * B := by -+ rw [Function.support_subset_iff'] at hf hg ⊢ -+ intro x hx -+ unfold MellinConvolution -+ simp only [Set.mem_mul, not_exists, not_and] at hx -+ apply MeasureTheory.integral_eq_zero_of_ae -+ filter_upwards [ae_restrict_mem (by measurability)] -+ intro y hy -+ simp only [mem_Ioi] at hy -+ simp only [Pi.zero_apply, div_eq_zero_iff, mul_eq_zero, map_eq_zero] -+ left -+ by_cases hyA : y ∈ A -+ · right -+ apply hg -+ intro hxyB -+ apply hx _ hyA _ hxyB -+ field_simp -+ · left -+ apply hf _ hyA -+ -+open Pointwise in -+lemma support_MellinConvolution (f g : ℝ → 𝕂) : -+ (MellinConvolution f g).support ⊆ f.support * g.support := -+ support_MellinConvolution_subsets subset_rfl subset_rfl -+ -+ -+lemma MellinConvolutionTransform (f g : ℝ → ℂ) (s : ℂ) -+ (hf : IntegrableOn (fun x y ↦ f y * g (x / y) / (y : ℂ) * (x : ℂ) ^ (s - 1)).uncurry -+ (Ioi 0 ×ˢ Ioi 0)) : -+ 𝓜 (MellinConvolution f g) s = 𝓜 f s * 𝓜 g s := by -+ dsimp [mellin, MellinConvolution] -+ set f₁ : ℝ × ℝ → ℂ := -+ fun ⟨x, y⟩ ↦ f y * g (x / y) / (y : ℂ) * (x : ℂ) ^ (s - 1) -+ calc -+ _ = ∫ (x : ℝ) in Ioi 0, ∫ (y : ℝ) in Ioi 0, f₁ (x, y) := ?_ -+ _ = ∫ (y : ℝ) in Ioi 0, ∫ (x : ℝ) in Ioi 0, f₁ (x, y) := -+ setIntegral_integral_swap _ hf -+ _ = ∫ (y : ℝ) in Ioi 0, ∫ (x : ℝ) in Ioi 0, -+ f y * g (x / y) / ↑y * ↑x ^ (s - 1) := rfl -+ _ = ∫ (y : ℝ) in Ioi 0, ∫ (x : ℝ) in Ioi 0, -+ f y * g (x * y / y) / ↑y * ↑(x * y) ^ (s - 1) * y := ?_ -+ _ = ∫ (y : ℝ) in Ioi 0, ∫ (x : ℝ) in Ioi 0, -+ f y * ↑y ^ (s - 1) * (g x * ↑x ^ (s - 1)) := ?_ -+ _ = ∫ (y : ℝ) in Ioi 0, -+ f y * ↑y ^ (s - 1) * ∫ (x : ℝ) in Ioi 0, g x * ↑x ^ (s - 1) := ?_ -+ _ = _ := integral_mul_const _ _ -+ <;> try (rw [setIntegral_congr_fun (by simp)]; intro y hy; simp only [ofReal_mul]) -+ · simp only [integral_mul_const, f₁, mul_comm] -+ · simp only [integral_mul_const] -+ have := integral_comp_mul_right_Ioi -+ (fun x ↦ f y * g (x / y) / (y : ℂ) * (x : ℂ) ^ (s - 1)) 0 hy -+ have y_ne_zeroℂ : (y : ℂ) ≠ 0 := slitPlane_ne_zero (Or.inl hy) -+ field_simp at this ⊢ -+ simp only [ofReal_mul, one_div, mul_zero, real_smul, ofReal_inv, field] at this ⊢ -+ rw [← this] -+ field_simp -+ congr with x -+ ring_nf -+ · rw [setIntegral_congr_fun (by simp)] -+ intro x hx -+ have y_ne_zeroℝ : y ≠ 0 := ne_of_gt (mem_Ioi.mp hy) -+ have y_ne_zeroℂ : (y : ℂ) ≠ 0 := by exact_mod_cast y_ne_zeroℝ -+ field_simp -+ rw [mul_cpow_ofReal_nonneg hy.le hx.le] -+ ring -+ · apply integral_const_mul -+ · congr <;> ext <;> ring -+ -+lemma mem_within_strip (σ₁ σ₂ : ℝ) : -+ {s : ℂ | σ₁ ≤ s.re ∧ s.re ≤ σ₂} ∈ -+ 𝓟 {s | σ₁ ≤ s.re ∧ s.re ≤ σ₂} := -+ mem_principal_self _ -+ -+lemma MellinOfPsi_aux {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) -+ (suppν : ν.support ⊆ Set.Icc (1 / 2) 2) -+ {s : ℂ} (hs : s ≠ 0) : -+ ∫ (x : ℝ) in Ioi 0, (ν x) * (x : ℂ) ^ (s - 1) = -+ - (1 / s) * ∫ (x : ℝ) in Ioi 0, (deriv ν x) * (x : ℂ) ^ s := by -+ let g (s : ℂ) := fun (x : ℝ) ↦ x ^ s / s -+ have gderiv {s : ℂ} (hs : s ≠ 0) {x: ℝ} (hx : x ∈ Ioi 0) : -+ deriv (g s) x = x ^ (s - 1) := by -+ have := HasDerivAt.cpow_const (c := s) (hasDerivAt_id (x : ℂ)) (Or.inl hx) -+ simp_rw [mul_one, id_eq] at this -+ rw [deriv_div_const, deriv.comp_ofReal (e := fun x ↦ x ^ s)] -+ · rw [this.deriv, mul_div_right_comm, div_self hs, one_mul] -+ · apply hasDerivAt_deriv_iff.mp -+ simp only [this.deriv, this] -+ calc -+ _ = ∫ (x : ℝ) in Ioi 0, ↑(ν x) * deriv (@g s) x := ?_ -+ _ = -∫ (x : ℝ) in Ioi 0, deriv (fun x ↦ ↑(ν x)) x * @g s x := ?_ -+ _ = -∫ (x : ℝ) in Ioi 0, deriv ν x * @g s x := ?_ -+ _ = -∫ (x : ℝ) in Ioi 0, deriv ν x * x ^ s / s := by simp only [mul_div, g] -+ _ = _ := ?_ -+ · rw [setIntegral_congr_fun (by simp)] -+ intro _ hx -+ simp only [gderiv hs hx] -+ · apply PartialIntegration_of_support_in_Icc (ν ·) (g s) -+ (a := 1 / 2) (b := 2) (by norm_num) (by norm_num) -+ · simpa only [Function.support_subset_iff, ne_eq, ofReal_eq_zero] -+ · exact (Differentiable.ofReal_comp_iff.mpr -+ (diffν.differentiable (by norm_num))).differentiableOn -+ · refine DifferentiableOn.div_const ?_ s -+ intro a ha -+ refine DifferentiableAt.comp_ofReal (e := fun x ↦ x ^ s) ?_ |>.differentiableWithinAt -+ apply differentiableAt_fun_id.cpow (differentiableAt_const s) <| by exact Or.inl ha -+ · simp only [deriv.ofReal_comp'] -+ exact continuous_ofReal.comp (diffν.continuous_deriv (by norm_num)) |>.continuousOn -+ · apply ContinuousOn.congr (f := fun (x : ℝ) ↦ (x : ℂ) ^ (s - 1)) ?_ -+ fun x hx ↦ gderiv hs hx -+ exact Continuous.continuousOn (by continuity) |>.cpow continuousOn_const (by simp) -+ · congr; funext; congr -+ apply (hasDerivAt_deriv_iff.mpr ?_).ofReal_comp.deriv -+ exact diffν.contDiffAt.differentiableAt (by norm_num) -+ · simp only [neg_mul, neg_inj] -+ conv => lhs; rhs; intro; rw [← mul_one_div, mul_comm] -+ rw [integral_const_mul] -+ -+lemma MellinOfPsi {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) -+ (suppν : ν.support ⊆ Set.Icc (1 / 2) 2) : -+ ∃ C > 0, ∀ (σ₁ : ℝ) (_ : 0 < σ₁) (s : ℂ) (_ : σ₁ ≤ s.re) (_ : s.re ≤ 2), -+ ‖𝓜 (fun x ↦ (ν x : ℂ)) s‖ ≤ C * ‖s‖⁻¹ := by -+ let f := fun (x : ℝ) ↦ ‖deriv ν x‖ -+ have cont : ContinuousOn f (Icc (1 / 2) 2) := -+ (Continuous.comp (by continuity) <| diffν.continuous_deriv (by norm_num)).continuousOn -+ obtain ⟨a, _, max⟩ := isCompact_Icc.exists_isMaxOn (f := f) (by norm_num) cont -+ let σ₂ : ℝ := 2 -+ let C : ℝ := f a * 2 ^ σ₂ * (3 / 2) -+ have mainBnd : ∀ (σ₁ : ℝ), 0 < σ₁ → ∀ (s : ℂ), σ₁ ≤ s.re → s.re ≤ 2 → -+ ‖𝓜 (fun x ↦ (ν x : ℂ)) s‖ ≤ C * ‖s‖⁻¹ := by -+ intro σ₁ σ₁pos s hs₁ hs₂ -+ have s_ne_zero: s ≠ 0 := fun h ↦ by linarith [zero_re ▸ h ▸ hs₁] -+ simp only [mellin, f, MellinOfPsi_aux diffν suppν s_ne_zero, norm_mul, smul_eq_mul, mul_comm] -+ gcongr -+ · simp -+ calc -+ _ ≤ ∫ (x : ℝ) in Ioi 0, ‖(deriv ν x * (x : ℂ) ^ s)‖ := ?_ -+ _ = ∫ (x : ℝ) in Icc (1 / 2) 2, ‖(deriv ν x * (x : ℂ) ^ s)‖ := ?_ -+ _ ≤ ‖∫ (x : ℝ) in Icc (1 / 2) 2, ‖(deriv ν x * (x : ℂ) ^ s)‖‖ := -+ le_abs_self _ -+ _ ≤ _ := ?_ -+ · simp_rw [norm_integral_le_integral_norm] -+ · apply SetIntegral.integral_eq_integral_inter_of_support_subset_Icc -+ · simp only [Function.support_abs, Function.support_mul, Function.support_ofReal] -+ apply subset_trans (by apply inter_subset_left) <| Function.support_deriv_subset_Icc suppν -+ · exact (Icc_subset_Ioi_iff (by norm_num)).mpr (by norm_num) -+ · have := intervalIntegral.norm_integral_le_of_norm_le_const' (C := f a * 2 ^ σ₂) -+ (f := fun x ↦ f x * ‖(x : ℂ) ^ s‖) (a := (1 / 2 : ℝ)) ( b := 2) (by norm_num) ?_ -+ · simp only [Real.norm_eq_abs, norm_real, norm_mul] at this ⊢ -+ rwa [(by norm_num: |(2 : ℝ) - 1 / 2| = 3 / 2), -+ intervalIntegral.integral_of_le (by norm_num), ← integral_Icc_eq_integral_Ioc] at this -+ · intro x hx; -+ have f_bound := isMaxOn_iff.mp max x hx -+ have pow_bound : ‖(x : ℂ) ^ s‖ ≤ 2 ^ σ₂ := by -+ rw [norm_cpow_eq_rpow_re_of_pos (by linarith [mem_Icc.mp hx])] -+ have xpos : 0 ≤ x := by linarith [(mem_Icc.mp hx).1] -+ have h := rpow_le_rpow xpos (mem_Icc.mp hx).2 (by linarith : 0 ≤ s.re) -+ exact le_trans h <| rpow_le_rpow_of_exponent_le (by norm_num) hs₂ -+ convert! mul_le_mul f_bound pow_bound (norm_nonneg _) ?_ using 1 <;> simp [f] -+ have Cnonneg : 0 ≤ C := by -+ have hh := mainBnd 1 (by norm_num) ((3 : ℂ) / 2) (by norm_num) (by norm_num) -+ have hhh : 0 ≤ ‖𝓜 (fun x ↦ (ν x : ℂ)) ((3 : ℂ) / 2)‖ := by positivity -+ have hhhh : 0 < ‖(3 : ℂ) / 2‖⁻¹ := by norm_num -+ have := hhh.trans hh -+ exact (mul_nonneg_iff_of_pos_right hhhh).mp this -+ by_cases CeqZero : C = 0 -+ · refine ⟨1, by linarith, ?_⟩ -+ intro ε εpos s hs₁ hs₂ -+ have := mainBnd ε εpos s hs₁ hs₂ -+ rw [CeqZero, zero_mul] at this -+ have : 0 ≤ 1 * ‖s‖⁻¹ := by positivity -+ linarith -+ · exact ⟨C, lt_of_le_of_ne Cnonneg fun a ↦ CeqZero (id (Eq.symm a)), mainBnd⟩ -+ -+noncomputable def DeltaSpike (ν : ℝ → ℝ) (ε : ℝ) : ℝ → ℝ := -+ fun x ↦ ν (x ^ (1 / ε)) / ε -+ -+lemma DeltaSpikeMass {ν : ℝ → ℝ} (mass_one : ∫ x in Ioi 0, ν x / x = 1) {ε : ℝ} -+ (εpos : 0 < ε) : ∫ x in Ioi 0, ((DeltaSpike ν ε) x) / x = 1 := -+ calc -+ _ = ∫ (x : ℝ) in Ioi 0, (|1/ε| * x ^ (1 / ε - 1)) • -+ ((fun z ↦ (ν z) / z) (x ^ (1 / ε))) := by -+ apply setIntegral_congr_ae measurableSet_Ioi -+ filter_upwards with x hx -+ simp only [smul_eq_mul, abs_of_pos (one_div_pos.mpr εpos)] -+ symm; calc -+ _ = (ν (x ^ (1 / ε)) / x ^ (1 / ε)) * x ^ (1 / ε - 1) * (1 / ε) := by ring -+ _ = _ := by rw [rpow_sub hx, rpow_one] -+ _ = (ν (x ^ (1 / ε)) / x ^ (1 / ε) * x ^ (1 / ε) / x) * (1/ ε) := by ring -+ _ = _ := by rw [div_mul_cancel₀ _ (ne_of_gt (rpow_pos_of_pos hx (1/ε)))] -+ _ = (ν (x ^ (1 / ε)) / ε / x) := by ring -+ _ = 1 := by -+ rw [integral_comp_rpow_Ioi (fun z ↦ (ν z) / z), ← mass_one] -+ simp only [ne_eq, div_eq_zero_iff, one_ne_zero, εpos.ne', or_self, not_false_eq_true] -+ -+lemma DeltaSpikeSupport_aux {ν : ℝ → ℝ} {ε : ℝ} (εpos : 0 < ε) -+ (suppν : ν.support ⊆ Icc (1 / 2) 2) : -+ (fun x ↦ if x < 0 then 0 else DeltaSpike ν ε x).support ⊆ Icc (2 ^ (-ε)) (2 ^ ε) := by -+ unfold DeltaSpike -+ simp only [one_div, Function.support_subset_iff, ne_eq, ite_eq_left_iff, not_lt, div_eq_zero_iff, -+ not_forall, exists_prop, mem_Icc, and_imp] -+ intro x hx h; push Not at h -+ have := suppν <| Function.mem_support.mpr h.1 -+ simp only [one_div, mem_Icc] at this -+ have hl := (le_rpow_inv_iff_of_pos (by norm_num) hx εpos).mp this.1 -+ rw [inv_rpow (by norm_num) ε, ← rpow_neg (by norm_num)] at hl -+ refine ⟨hl, (rpow_inv_le_iff_of_pos ?_ (by norm_num) εpos).mp this.2⟩ -+ linarith [(by apply rpow_nonneg (by norm_num) : 0 ≤ (2 : ℝ) ^ (-ε))] -+ -+lemma DeltaSpikeSupport' {ν : ℝ → ℝ} {ε x : ℝ} (εpos : 0 < ε) (xnonneg : 0 ≤ x) -+ (suppν : ν.support ⊆ Icc (1 / 2) 2) : -+ DeltaSpike ν ε x ≠ 0 → x ∈ Icc (2 ^ (-ε)) (2 ^ ε) := by -+ intro h -+ have : (fun x ↦ if x < 0 then 0 else DeltaSpike ν ε x) x = DeltaSpike ν ε x := by -+ simp [xnonneg] -+ rw [← this] at h -+ exact (Function.support_subset_iff.mp <| DeltaSpikeSupport_aux εpos suppν) _ h -+ -+lemma DeltaSpikeSupport {ν : ℝ → ℝ} {ε x : ℝ} (εpos : 0 < ε) (xnonneg : 0 ≤ x) -+ (suppν : ν.support ⊆ Icc (1 / 2) 2) : -+ x ∉ Icc (2 ^ (-ε)) (2 ^ ε) → DeltaSpike ν ε x = 0 := by -+ contrapose!; exact DeltaSpikeSupport' εpos xnonneg suppν -+ -+@[fun_prop] -+lemma DeltaSpikeContinuous {ν : ℝ → ℝ} {ε : ℝ} (εpos : 0 < ε) -+ (diffν : ContDiff ℝ 1 ν) : Continuous (fun x ↦ DeltaSpike ν ε x) := by -+ apply diffν.continuous.comp (g := ν) _ |>.div_const -+ exact continuous_id.rpow_const fun _ ↦ Or.inr <| div_nonneg (by norm_num) εpos.le -+ -+lemma DeltaSpikeOfRealContinuous {ν : ℝ → ℝ} {ε : ℝ} (εpos : 0 < ε) -+ (diffν : ContDiff ℝ 1 ν) : Continuous (fun x ↦ (DeltaSpike ν ε x : ℂ)) := -+ continuous_ofReal.comp <| DeltaSpikeContinuous εpos diffν -+ -+ -+theorem MellinOfDeltaSpike (ν : ℝ → ℝ) {ε : ℝ} (εpos : ε > 0) (s : ℂ) : -+ 𝓜 (fun x ↦ (DeltaSpike ν ε x : ℂ)) s = 𝓜 (fun x ↦ (ν x : ℂ)) (ε * s) := by -+ unfold DeltaSpike -+ push_cast -+ rw [mellin_div_const, mellin_comp_rpow (fun x ↦ (ν x : ℂ)), abs_of_nonneg (by positivity)] -+ simp only [one_div, inv_inv, ofReal_inv, div_inv_eq_mul, real_smul] -+ rw [mul_div_cancel_left₀ _ (ne_zero_of_re_pos εpos)] -+ ring_nf -+ -+lemma MellinOfDeltaSpikeAt1 (ν : ℝ → ℝ) {ε : ℝ} (εpos : ε > 0) : -+ 𝓜 (fun x ↦ (DeltaSpike ν ε x : ℂ)) 1 = 𝓜 (fun x ↦ (ν x : ℂ)) ε := by -+ convert MellinOfDeltaSpike ν εpos 1; simp [mul_one] -+ -+lemma MellinOfDeltaSpikeAt1_asymp {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) -+ (suppν : ν.support ⊆ Set.Icc (1 / 2) 2) -+ (mass_one : ∫ x in Set.Ioi 0, ν x / x = 1) : -+ (fun (ε : ℝ) ↦ (𝓜 (fun x ↦ (ν x : ℂ)) ε) - 1) =O[𝓝[>]0] id := by -+ have diff : DifferentiableWithinAt ℝ -+ (fun (ε : ℝ) ↦ 𝓜 (fun x ↦ (ν x : ℂ)) ε - 1) (Ioi 0) 0 := by -+ apply DifferentiableAt.differentiableWithinAt -+ simp only [(differentiableAt_const _).fun_sub_iff_left] -+ refine DifferentiableAt.comp_ofReal ?_ -+ refine mellin_differentiableAt_of_isBigO_rpow (a := 1) (b := -1) ?_ ?_ (by simp) ?_ (by simp) -+ · apply (Continuous.continuousOn ?_).locallyIntegrableOn (by simp) -+ have := diffν.continuous; continuity -+ · apply Asymptotics.IsBigO.trans_le (g' := fun _ ↦ (0 : ℝ)) ?_ (by simp) -+ apply BigO_zero_atTop_of_support_in_Icc (a := 1 / 2) (b := 2) -+ rwa [Erdos970.Function.support_ofReal (f := ν)] -+ · apply Asymptotics.IsBigO.trans_le (g' := fun _ ↦ (0 : ℝ)) ?_ (by simp) -+ apply BigO_zero_atZero_of_support_in_Icc (a := 1 / 2) (b := 2) (ha := (by norm_num)) -+ rwa [Erdos970.Function.support_ofReal (f := ν)] -+ have := ofReal_zero ▸ diff.isBigO_sub -+ simp only [sub_sub_sub_cancel_right, sub_zero] at this -+ convert! this using 1 -+ simp only [mellin, zero_sub, cpow_neg_one, smul_eq_mul] -+ funext ε -+ congr 1 -+ symm -+ calc (∫ (t : ℝ) in Ioi 0, (↑t)⁻¹ * ↑(ν t) : ℂ) -+ = ∫ (t : ℝ) in Ioi 0, ((ν t / t : ℝ) : ℂ) := -+ integral_congr_ae (Filter.Eventually.of_forall fun t => by push_cast; ring) -+ _ = ((∫ t in Ioi 0, ν t / t : ℝ) : ℂ) := integral_ofReal -+ _ = 1 := by rw [mass_one, ofReal_one] -+ -+lemma MellinOf1 (s : ℂ) (h : s.re > 0) : -+ 𝓜 ((fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0)) s = 1 / s := by -+ convert (hasMellin_one_Ioc h).right -+ congr -+ -+noncomputable def Smooth1 (ν : ℝ → ℝ) (ε : ℝ) : ℝ → ℝ := -+ MellinConvolution (fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0) (DeltaSpike ν ε) -+ -+lemma Smooth1_def_ite {ν : ℝ → ℝ} {ε x : ℝ} (xpos : 0 < x) : -+ Smooth1 ν ε x = MellinConvolution (fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0) -+ (fun x ↦ if x < 0 then 0 else DeltaSpike ν ε x) x := by -+ unfold Smooth1 -+ rw [MellinConvolutionSymmetric _ _ xpos] -+ conv => lhs; rw [MellinConvolutionSymmetric _ _ xpos] -+ unfold MellinConvolution -+ apply MeasureTheory.integral_congr_ae -+ filter_upwards [MeasureTheory.ae_restrict_mem measurableSet_Ioi] -+ simp +contextual only [mem_Ioi, true_and, ite_mul, one_mul, zero_mul, RCLike.ofReal_real_eq_id, -+ id_eq, mul_ite, mul_zero] -+ intro y ypos -+ rw [eq_comm, ite_eq_right (by push Not; positivity)] -+ -+lemma Smooth1Properties_estimate {ε : ℝ} (εpos : 0 < ε) : -+ (1 - 2 ^ (-ε)) / ε < Real.log 2 := by -+ apply (div_lt_iff₀' εpos).mpr -+ have : 1 - 1 / (2 : ℝ) ^ ε = ((2 : ℝ) ^ ε - 1) / (2 : ℝ) ^ ε := by -+ rw [sub_div, div_self (by positivity)] -+ rw [← Real.log_rpow (by norm_num), rpow_neg (by norm_num), inv_eq_one_div (2 ^ ε), this] -+ set c := (2 : ℝ) ^ ε -+ have hc : 1 < c := by -+ rw [← rpow_zero (2 : ℝ)] -+ apply Real.rpow_lt_rpow_of_exponent_lt (by norm_num) εpos -+ apply (div_lt_iff₀' (by positivity)).mpr <| lt_sub_iff_add_lt'.mp ?_ -+ let f := (fun x ↦ x * Real.log x - x) -+ rw [(by simp [f] : -1 = f 1), (by simp [f] : c * Real.log c - c = f c)] -+ have mono: StrictMonoOn f <| Ici 1 := by -+ refine strictMonoOn_of_deriv_pos (convex_Ici _) ?_ ?_ -+ · apply continuousOn_id.mul (continuousOn_id.log ?_) |>.sub continuousOn_id -+ intro x hx; simp only [mem_Ici] at hx; simp only [id_eq, ne_eq]; linarith -+ · intro x hx; simp only [nonempty_Iio, interior_Ici', mem_Ioi] at hx -+ dsimp only [f] -+ rw [deriv_fun_sub, deriv_fun_mul, Real.deriv_log, deriv_id'', one_mul, mul_inv_cancel₀] -+ · simp [log_pos hx] -+ · linarith -+ · simp only [differentiableAt_fun_id] -+ · simp only [differentiableAt_log_iff, ne_eq]; linarith -+ · exact differentiableAt_fun_id.mul <| differentiableAt_fun_id.log (by linarith) -+ · simp only [differentiableAt_fun_id] -+ exact mono (by rw [mem_Ici]) (mem_Ici.mpr <| le_of_lt hc) hc -+ -+lemma Smooth1Properties_below_aux {x ε : ℝ} (hx : x ≤ 1 - Real.log 2 * ε) (εpos : 0 < ε) : -+ x < 2 ^ (-ε) := by -+ calc -+ x ≤ 1 - Real.log 2 * ε := hx -+ _ < 2 ^ (-ε) := ?_ -+ rw [sub_lt_iff_lt_add, add_comm, ← sub_lt_iff_lt_add] -+ exact (div_lt_iff₀ εpos).mp <| Smooth1Properties_estimate εpos -+ -+lemma Smooth1Properties_below {ν : ℝ → ℝ} (suppν : ν.support ⊆ Icc (1 / 2) 2) -+ (mass_one : ∫ x in Ioi 0, ν x / x = 1) : -+ ∃ (c : ℝ), 0 < c ∧ c = Real.log 2 ∧ -+ ∀ (ε x) (_ : 0 < ε), 0 < x → x ≤ 1 - c * ε → Smooth1 ν ε x = 1 := by -+ set c := Real.log 2; use c -+ refine ⟨log_pos (by norm_num), rfl, ?_⟩ -+ intro ε x εpos xpos hx -+ have hx2 := Smooth1Properties_below_aux hx εpos -+ rewrite [← DeltaSpikeMass mass_one εpos] -+ unfold Smooth1 MellinConvolution -+ calc -+ _ = ∫ (y : ℝ) in Ioi 0, -+ indicator (Ioc 0 1) (fun y ↦ DeltaSpike ν ε (x / y) / ↑y) y := ?_ -+ _ = ∫ (y : ℝ) in Ioi 0, DeltaSpike ν ε (x / y) / y := ?_ -+ _ = _ := integral_comp_div_I0i_haar (fun y ↦ DeltaSpike ν ε y) xpos -+ · rw [setIntegral_congr_fun (by simp)] -+ intro y hy -+ by_cases h : y ≤ 1 <;> simp [indicator, mem_Ioi.mp hy, h] -+ · rw [setIntegral_congr_fun (by simp)] -+ intro y hy -+ have : y ≠ 0 := by -+ rintro rfl -+ simp at hy -+ simp only [indicator_apply_eq_self, mem_Ioc, not_and, not_le, div_eq_zero_iff, this, or_false] -+ intro hy2; replace hy2 := hy2 <| mem_Ioi.mp hy -+ apply DeltaSpikeSupport εpos ?_ suppν -+ · simp only [mem_Icc, not_and, not_le]; intro -+ linarith [(by apply (div_lt_iff₀ (by linarith)).mpr; nlinarith : x / y < 2 ^ (-ε))] -+ · rw [le_div_iff₀ (by linarith), zero_mul]; exact xpos.le -+ -+lemma Smooth1Properties_above_aux {x ε : ℝ} (hx : 1 + (2 * Real.log 2) * ε ≤ x) -+ (hε : ε ∈ Ioo 0 1) : -+ 2 ^ ε < x := by -+ calc -+ x ≥ 1 + (2 * Real.log 2) * ε := hx -+ _ > 2 ^ ε := ?_ -+ refine lt_add_of_sub_left_lt <| (div_lt_iff₀ hε.1).mp ?_ -+ calc -+ 2 * Real.log 2 > 2 * (1 - 2 ^ (-ε)) / ε := ?_ -+ _ > 2 ^ ε * (1 - 2 ^ (-ε)) / ε := ?_ -+ _ = (2 ^ ε - 1) / ε := ?_ -+ · field_simp -+ exact Smooth1Properties_estimate hε.1 -+ · have : (2 : ℝ) ^ ε < 2 := by -+ have h := rpow_lt_rpow_of_exponent_lt (x := 2) (by norm_num) hε.2 -+ rwa [Real.rpow_one] at h -+ have pos: 0 < (1 - 2 ^ (-ε)) / ε := by -+ refine div_pos ?_ hε.1 -+ rw [sub_pos] -+ have h := rpow_lt_rpow_of_exponent_lt (x := 2) (by norm_num) (neg_lt_zero.mpr hε.1) -+ rwa [Real.rpow_zero] at h -+ have := (mul_lt_mul_iff_left₀ pos).mpr this -+ ring_nf at this ⊢ -+ exact this -+ · have : (2 : ℝ) ^ ε * (2 : ℝ) ^ (-ε) = (2 : ℝ) ^ (ε - ε) := by -+ rw [← rpow_add (by norm_num), add_neg_cancel, sub_self] -+ conv => lhs; lhs; ring_nf; rhs; simp [this] -+ -+lemma Smooth1Properties_above_aux2 {x y ε : ℝ} (hε : ε ∈ Ioo 0 1) (hy : y ∈ Ioc 0 1) -+ (hx2 : 2 ^ ε < x) : -+ 2 < (x / y) ^ (1 / ε) := by -+ obtain ⟨εpos, ε1⟩ := hε -+ obtain ⟨ypos, y1⟩ := hy -+ calc -+ _ > (2 ^ ε / y) ^ (1 / ε) := ?_ -+ _ = 2 / y ^ (1 / ε) := ?_ -+ _ ≥ 2 / y := ?_ -+ _ ≥ 2 := ?_ -+ · rw [gt_iff_lt, div_rpow, div_rpow, lt_div_iff₀, mul_comm_div, div_self, mul_one] -+ <;> try positivity -+ · exact rpow_lt_rpow (by positivity) hx2 (by positivity) -+ · exact LT.lt.le <| lt_trans (by positivity) hx2 -+ · rw [div_rpow, ← rpow_mul, mul_div_cancel₀ 1 <| ne_of_gt εpos, rpow_one] <;> positivity -+ · have : y ^ (1 / ε) ≤ y := by -+ nth_rewrite 2 [← rpow_one y] -+ exact rpow_le_rpow_of_exponent_ge ypos y1 (by linarith [one_lt_one_div εpos ε1]) -+ have pos : 0 < y ^ (1 / ε) := rpow_pos_of_pos ypos _ -+ rw [ge_iff_le, div_le_iff₀, div_mul_eq_mul_div, le_div_iff₀', mul_comm] <;> try linarith -+ · rw [ge_iff_le, le_div_iff₀ <| ypos]; exact (mul_le_iff_le_one_right zero_lt_two).mpr y1 -+ -+lemma Smooth1Properties_above {ν : ℝ → ℝ} (suppν : ν.support ⊆ Icc (1 / 2) 2) : -+ ∃ (c : ℝ), 0 < c ∧ c = 2 * Real.log 2 ∧ -+ ∀ (ε x) (_ : ε ∈ Ioo 0 1), 1 + c * ε ≤ x → Smooth1 ν ε x = 0 := by -+ set c := 2 * Real.log 2; use c -+ constructor -+ · simp only [c, zero_lt_two, mul_pos_iff_of_pos_left]; exact log_pos (by norm_num) -+ constructor -+ · rfl -+ intro ε x hε hx -+ have hx2 := Smooth1Properties_above_aux hx hε -+ unfold Smooth1 MellinConvolution -+ simp only [ite_mul, one_mul, zero_mul, RCLike.ofReal_real_eq_id, id_eq] -+ apply setIntegral_eq_zero_of_forall_eq_zero -+ intro y hy -+ have ypos := mem_Ioi.mp hy -+ by_cases y1 : y ≤ 1 -+ swap -+ · simp [ypos, y1] -+ simp only [mem_Ioi.mp hy, y1, and_self, ↓reduceIte, div_eq_zero_iff]; left -+ apply DeltaSpikeSupport hε.1 ?_ suppν -+ on_goal 1 => -+ simp only [mem_Icc, not_and, not_le] -+ on_goal 2 => -+ suffices h : 2 ^ ε < x / y by -+ linarith [(by apply rpow_pos_of_pos (by norm_num) : 0 < (2 : ℝ) ^ ε)] -+ all_goals -+ try intro -+ have : x / y = ((x / y) ^ (1 / ε)) ^ ε := by -+ rw [← rpow_mul] -+ simp only [one_div, inv_mul_cancel₀ (ne_of_gt hε.1), rpow_one] -+ apply div_nonneg_iff.mpr; left; -+ exact ⟨(le_trans (rpow_pos_of_pos (by norm_num) ε).le) hx2.le, ypos.le⟩ -+ rw [this] -+ refine rpow_lt_rpow (by norm_num) ?_ hε.1 -+ exact Smooth1Properties_above_aux2 hε ⟨ypos, y1⟩ hx2 -+ -+lemma DeltaSpikeNonNeg_of_NonNeg {ν : ℝ → ℝ} (νnonneg : ∀ x > 0, 0 ≤ ν x) -+ {x ε : ℝ} (xpos : 0 < x) (εpos : 0 < ε) : -+ 0 ≤ DeltaSpike ν ε x := by -+ dsimp [DeltaSpike] -+ have : 0 < x ^ (1 / ε) := by positivity -+ have : 0 ≤ ν (x ^ (1 / ε)) := νnonneg _ this -+ positivity -+ -+lemma MellinConvNonNeg_of_NonNeg {f g : ℝ → ℝ} (f_nonneg : ∀ x > 0, 0 ≤ f x) -+ (g_nonneg : ∀ x > 0, 0 ≤ g x) {x : ℝ} (xpos : 0 < x) : -+ 0 ≤ MellinConvolution f g x := by -+ dsimp [MellinConvolution] -+ apply MeasureTheory.setIntegral_nonneg -+ · exact measurableSet_Ioi -+ · intro y ypos; simp only [mem_Ioi] at ypos -+ have : 0 ≤ f y := f_nonneg _ ypos -+ have : 0 < x / y := by positivity -+ have : 0 ≤ g (x / y) := g_nonneg _ this -+ positivity -+ -+lemma Smooth1Nonneg {ν : ℝ → ℝ} (νnonneg : ∀ x > 0, 0 ≤ ν x) {ε x : ℝ} -+ (xpos : 0 < x) (εpos : 0 < ε) : 0 ≤ Smooth1 ν ε x := by -+ dsimp [Smooth1] -+ apply MellinConvNonNeg_of_NonNeg ?_ ?_ xpos -+ · intro y hy; by_cases h : y ≤ 1 <;> simp [h, hy] -+ · intro y ypos; exact DeltaSpikeNonNeg_of_NonNeg νnonneg ypos εpos -+ -+lemma Smooth1LeOne_aux {x ε : ℝ} {ν : ℝ → ℝ} (xpos : 0 < x) (εpos : 0 < ε) -+ (mass_one : ∫ x in Ioi 0, ν x / x = 1) : -+ ∫ (y : ℝ) in Ioi 0, ν ((x / y) ^ (1 / ε)) / ε / y = 1 := by -+ calc -+ _ = ∫ (y : ℝ) in Ioi 0, (ν (y ^ (1 / ε)) / ε) / y := ?_ -+ _ = ∫ (y : ℝ) in Ioi 0, ν y / y := ?_ -+ _ = 1 := mass_one -+ · have := integral_comp_div_I0i_haar (fun y ↦ ν ((x / y) ^ (1 / ε)) / ε) xpos -+ convert! this.symm using 1 -+ congr; funext y; congr; field_simp [mul_comm] -+ · have := integral_comp_rpow_I0i_haar_real (fun y ↦ ν y) (one_div_ne_zero εpos.ne') -+ rw [← this, abs_of_pos <| one_div_pos.mpr εpos] -+ field_simp -+ -+lemma Smooth1LeOne {ν : ℝ → ℝ} (νnonneg : ∀ x > 0, 0 ≤ ν x) -+ (mass_one : ∫ x in Ioi 0, ν x / x = 1) {ε : ℝ} (εpos : 0 < ε) {x : ℝ} (xpos : 0 < x) : -+ Smooth1 ν ε x ≤ 1 := by -+ unfold Smooth1 MellinConvolution DeltaSpike -+ have := Smooth1LeOne_aux xpos εpos mass_one -+ calc -+ _ = ∫ (y : ℝ) in Ioi 0, -+ (fun y ↦ if y ∈ Ioc 0 1 then 1 else 0) y * (ν ((x / y) ^ (1 / ε)) / ε / y) := ?_ -+ _ ≤ ∫ (y : ℝ) in Ioi 0, (ν ((x / y) ^ (1 / ε)) / ε) / y := ?_ -+ _ = 1 := this -+ · rw [setIntegral_congr_fun (by simp)] -+ simp only [ite_mul, one_mul, zero_mul, RCLike.ofReal_real_eq_id, id_eq, mem_Ioc] -+ intro y hy; aesop -+ · refine setIntegral_mono_on ?_ (integrable_of_integral_eq_one this) (by simp) ?_ -+ · refine integrable_of_integral_eq_one this |>.bdd_mul ?_ -+ (ae_of_all _ <| by aesop) -+ have : (fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0) = -+ indicator (Ioc 0 1) (1 : ℝ → ℝ) := by -+ aesop -+ simp only [mem_Ioc, this, measurableSet_Ioc, aestronglyMeasurable_indicator_iff] -+ exact aestronglyMeasurable_one -+ · simp only [ite_mul, one_mul, zero_mul] -+ intro y hy -+ by_cases h : y ≤ 1 -+ · aesop -+ field_simp -+ simp only [mem_Ioc, h, and_false, ↓reduceIte, one_div, mul_zero] -+ simp only [mem_Ioi] at hy -+ apply div_nonneg -+ · apply νnonneg; exact rpow_pos_of_pos (div_pos xpos <| mem_Ioi.mp hy) _ -+ · positivity -+ -+lemma MellinOfSmooth1a {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) -+ (suppν : ν.support ⊆ Icc (1 / 2) 2) -+ {ε : ℝ} (εpos : 0 < ε) {s : ℂ} (hs : 0 < s.re) : -+ 𝓜 (fun x ↦ (Smooth1 ν ε x : ℂ)) s = -+ s⁻¹ * 𝓜 (fun x ↦ (ν x : ℂ)) (ε * s) := by -+ let f' : ℝ → ℂ := fun x ↦ DeltaSpike ν ε x -+ let f : ℝ → ℂ := fun x ↦ DeltaSpike ν ε x / x -+ let g : ℝ → ℂ := fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0 -+ let F : ℝ × ℝ → ℂ := Function.uncurry fun x y ↦ f y * g (x / y) * (x : ℂ) ^ (s - 1) -+ let S := {⟨x, y⟩ : ℝ × ℝ | 0 < x ∧ x ≤ y ∧ 2 ^ (-ε) ≤ y ∧ y ≤ 2 ^ ε} -+ let F' : ℝ × ℝ → ℂ := piecewise S (fun ⟨x, y⟩ ↦ f y * (x : ℂ) ^ (s - 1)) -+ (fun _ ↦ 0) -+ let Tx := Ioc 0 ((2 : ℝ) ^ ε) -+ let Ty := Icc ((2 : ℝ) ^ (-ε)) ((2 : ℝ) ^ ε) -+ -+ have Seq : S = (Tx ×ˢ Ty) ∩ {(x, y) : ℝ × ℝ | x ≤ y} := by -+ ext ⟨x, y⟩; constructor -+ · exact fun h ↦ ⟨⟨⟨h.1, le_trans h.2.1 h.2.2.2⟩, ⟨h.2.2.1, h.2.2.2⟩⟩, h.2.1⟩ -+ · exact fun h ↦ ⟨h.1.1.1, ⟨h.2, h.1.2.1, h.1.2.2⟩⟩ -+ have SsubI : S ⊆ Ioi 0 ×ˢ Ioi 0 := -+ fun z hz ↦ ⟨hz.1, lt_of_lt_of_le (by apply rpow_pos_of_pos; norm_num) hz.2.2.1⟩ -+ have SsubT: S ⊆ Tx ×ˢ Ty := by simp_rw [Seq, inter_subset_left] -+ have Smeas : MeasurableSet S := by -+ rw [Seq]; apply MeasurableSet.inter ?_ <| measurableSet_le measurable_fst measurable_snd -+ simp [measurableSet_prod, Tx, Ty] -+ -+ have int_F: IntegrableOn F (Ioi 0 ×ˢ Ioi 0) := by -+ apply IntegrableOn.congr_fun (f := F') ?_ ?_ (by simp [measurableSet_prod]); swap -+ · simp only [F, F', f, g, mul_ite, mul_one, mul_zero] -+ intro ⟨x, y⟩ hz -+ by_cases hS : ⟨x, y⟩ ∈ S <;> simp only [hS, piecewise] -+ <;> simp only [mem_prod, mem_Ioi, mem_ofPred_eq, not_and, not_le, S] at hz hS -+ · simp [div_pos hz.1 hz.2, (div_le_one hz.2).mpr hS.2.1] -+ · by_cases hxy : x / y ≤ 1 -+ swap -+ · simp [hxy] -+ have hy : y ∉ Icc (2 ^ (-ε)) (2 ^ ε) := by -+ simp only [mem_Icc, not_and, not_le]; exact hS hz.1 <| (div_le_one hz.2).mp hxy -+ simp [DeltaSpikeSupport εpos hz.2.le suppν hy] -+ · apply Integrable.piecewise Smeas ?_ integrableOn_zero -+ simp only [IntegrableOn, Measure.restrict_restrict_of_subset SsubI] -+ apply MeasureTheory.Integrable.mono_measure ?_ -+ · apply MeasureTheory.Measure.restrict_mono' SsubT.eventuallyLE le_rfl -+ change Integrable (fun x : ℝ × ℝ => f x.2 * (x.1 : ℂ) ^ (s - 1)) -+ (volume.restrict (Tx ×ˢ Ty)) -+ have : volume.restrict (Tx ×ˢ Ty) = (volume.restrict Tx).prod (volume.restrict Ty) := by -+ rw [Measure.prod_restrict, MeasureTheory.Measure.volume_eq_prod] -+ conv => rw [this]; lhs; intro; rw [mul_comm] -+ apply MeasureTheory.Integrable.mul_prod (f := fun x ↦ (x : ℂ) ^ (s - 1)) -+ (μ := Measure.restrict volume Tx) -+ · simp only [Tx] -+ rw [← IntegrableOn, integrableOn_Ioc_iff_integrableOn_Ioo, -+ intervalIntegral.integrableOn_Ioo_cpow_iff] -+ · simp [hs] -+ · apply rpow_pos_of_pos (by norm_num) -+ · apply (ContinuousOn.div ?_ ?_ ?_).integrableOn_compact isCompact_Icc -+ · exact (DeltaSpikeOfRealContinuous εpos diffν).continuousOn -+ · exact continuous_ofReal.continuousOn -+ · intro x hx; simp only [mem_Icc] at hx; simp only [ofReal_ne_zero] -+ linarith [(by apply rpow_pos_of_pos (by norm_num) : (0 : ℝ) < 2 ^ (-ε))] -+ -+ have : 𝓜 (MellinConvolution g f') s = 𝓜 g s * 𝓜 f' s := by -+ rw [mul_comm, ← MellinConvolutionTransform f' g s -+ (by convert int_F using 1; simp only [f', F, f]; field_simp)] -+ dsimp [mellin]; rw [setIntegral_congr_fun (by simp)] -+ intro x hx; simp_rw [MellinConvolutionSymmetric _ _ <| mem_Ioi.mp hx] -+ -+ convert! this using 1 -+ · congr; funext x; convert! integral_ofReal.symm -+ simp only [MellinConvolution, RCLike.ofReal_div, ite_mul, one_mul, zero_mul, @apply_ite ℝ ℂ, -+ algebraMap.coe_zero, g]; rfl -+ · rw [MellinOf1 s hs, MellinOfDeltaSpike ν εpos s] -+ simp -+ -+lemma MellinOfSmooth1b {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) -+ (suppν : ν.support ⊆ Set.Icc (1 / 2) 2) : -+ ∃ (C : ℝ) (_ : 0 < C), ∀ (σ₁ : ℝ) (_ : 0 < σ₁) -+ (s) (_ : σ₁ ≤ s.re) (_ : s.re ≤ 2) (ε : ℝ) (_ : 0 < ε) (_ : ε < 1), -+ ‖𝓜 (fun x ↦ (Smooth1 ν ε x : ℂ)) s‖ ≤ C * (ε * ‖s‖ ^ 2)⁻¹ := by -+ obtain ⟨C, Cpos, hC⟩ := MellinOfPsi diffν suppν -+ refine ⟨C, Cpos, ?_⟩ -+ intro σ₁ σ₁pos s hs1 hs2 ε εpos ε_lt_one -+ rw [MellinOfSmooth1a diffν suppν εpos <| lt_of_le_of_lt' hs1 σ₁pos] -+ have hh1 : ε * σ₁ ≤ (ε * s).re := by -+ simp only [mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] -+ nlinarith -+ have hh2 : (ε * s).re ≤ 2 := by -+ simp only [mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] -+ nlinarith -+ calc -+ ‖s⁻¹ * 𝓜 (fun x ↦ (ν x : ℂ)) (ε * s)‖ = -+ ‖s⁻¹‖ * ‖𝓜 (fun x ↦ (ν x : ℂ)) (ε * s)‖ := by simp -+ _ ≤ ‖s⁻¹‖ * (C * (ε * ‖s‖)⁻¹) := by -+ gcongr -+ convert! hC (ε * σ₁) (by positivity) (ε * s) hh1 hh2 -+ simp [abs_eq_self.mpr εpos.le] -+ _ = C * (ε * ‖s‖ ^ 2)⁻¹ := by -+ simp only [norm_inv, mul_inv_rev] -+ ring -+ -+lemma MellinOfSmooth1c {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) -+ (suppν : ν.support ⊆ Icc (1 / 2) 2) -+ (mass_one : ∫ x in Ioi 0, ν x / x = 1) : -+ (fun ε ↦ 𝓜 (fun x ↦ (Smooth1 ν ε x : ℂ)) 1 - 1) =O[𝓝[>]0] id := by -+ have h := MellinOfDeltaSpikeAt1_asymp diffν suppν mass_one -+ rw [Asymptotics.isBigO_iff] at h ⊢ -+ obtain ⟨c, hc⟩ := h -+ use c -+ filter_upwards [hc, Ioo_mem_nhdsGT (by linarith : (0 : ℝ) < 1)] with ε hε hε' -+ rw [MellinOfSmooth1a diffν suppν hε'.1 (s := 1) (by norm_num)] -+ simp only [inv_one, mul_one, one_mul, id_eq, Real.norm_eq_abs] -+ exact hε -+ -+lemma Smooth1ContinuousAt {SmoothingF : ℝ → ℝ} -+ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) -+ (suppSmoothingF : SmoothingF.support ⊆ Icc (1 / 2) 2) -+ {ε : ℝ} (εpos : 0 < ε) {y : ℝ} (ypos : 0 < y) : -+ ContinuousAt (fun x ↦ Smooth1 SmoothingF ε x) y := by -+ apply ContinuousAt.congr -+ (f := (fun x ↦ MellinConvolution (DeltaSpike SmoothingF ε) -+ (fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0) x)) _ -+ · filter_upwards [lt_mem_nhds ypos] with x hx -+ apply MellinConvolutionSymmetric _ _ hx -+ apply continuousAt_of_dominated (bound := (fun x ↦ 2 ^ ε * DeltaSpike SmoothingF ε x)) -+ · filter_upwards [lt_mem_nhds ypos] with x hx -+ apply Measurable.aestronglyMeasurable -+ apply Measurable.mul -+ · apply Measurable.mul -+ · exact Continuous.measurable <| DeltaSpikeContinuous εpos diffSmoothingF -+ · apply Measurable.ite _ (by fun_prop) (by fun_prop) -+ apply MeasurableSet.congr (s := Ici x) (by measurability) -+ ext a -+ constructor -+ · intro ha -+ have apos : 0 < a := lt_of_lt_of_le hx ha -+ constructor -+ · exact div_pos hx apos -+ · exact (div_le_one apos).mpr ha -+ · intro ha -+ have : 0 < a := (div_pos_iff_of_pos_left hx).mp ha.1 -+ exact (div_le_one this).mp ha.2 -+ · fun_prop -+ · filter_upwards [lt_mem_nhds ypos] with x hx -+ filter_upwards [ae_restrict_mem (by measurability)] with t ht -+ simp only [mul_ite, mul_one, mul_zero, RCLike.ofReal_real_eq_id, id_eq, norm_div, norm_eq_abs] -+ by_cases! h : DeltaSpike SmoothingF ε t = 0 -+ · simp [h] -+ have := DeltaSpikeSupport' εpos ht.le suppSmoothingF h -+ have dsnonneg : 0 ≤ DeltaSpike SmoothingF ε t := by -+ apply DeltaSpikeNonNeg_of_NonNeg <;> assumption -+ calc -+ _ ≤ |DeltaSpike SmoothingF ε t| / |t| := by -+ gcongr -+ · split_ifs with h -+ · apply le_refl -+ · exact dsnonneg -+ _ ≤ _ := by -+ rw [_root_.abs_of_nonneg dsnonneg, mul_comm, div_eq_mul_one_div, _root_.abs_of_pos ht] -+ gcongr -+ apply (one_div_le ht (by bound)).mpr -+ · convert this.1 using 1 -+ rw [div_eq_iff (by positivity), ← rpow_add (by norm_num), neg_add_cancel, rpow_zero] -+ · apply Integrable.const_mul -+ apply (integrable_indicator_iff (by measurability)).mp -+ apply (integrableOn_iff_integrable_of_support_subset (s := Icc (2 ^ (-ε)) (2 ^ ε)) _).mp -+ · apply ContinuousOn.integrableOn_compact isCompact_Icc -+ apply ContinuousOn.congr (f := DeltaSpike SmoothingF ε) -+ · apply Continuous.continuousOn -+ apply DeltaSpikeContinuous<;> assumption -+ · intro x hx -+ have : x ∈ Ioi 0 := by -+ apply mem_Ioi.mpr -+ apply lt_of_lt_of_le (by bound) hx.1 -+ rw [indicator, ite_eq_left this] -+ · unfold indicator -+ simp_rw [mem_Ioi] -+ apply Function.support_subset_iff.mpr -+ simp only [ne_eq, ite_eq_right_iff, Classical.not_imp, mem_Icc, and_imp] -+ intro x hx -+ apply DeltaSpikeSupport' εpos hx.le suppSmoothingF -+ · have : ∀ᵐ (a : ℝ) ∂volume.restrict (Ioi 0), a ≠ y := by -+ apply ae_iff.mpr -+ simp -+ filter_upwards [ae_restrict_mem (by measurability), this] with x hx hx2 -+ simp only [mem_Ioi] at hx -+ apply ContinuousAt.div_const -+ apply ContinuousAt.mul (by fun_prop) -+ have : (fun x_1 ↦ if 0 < x_1 / x ∧ x_1 / x ≤ 1 then 1 else 0) = -+ (Ioc 0 x).indicator (fun _ ↦ (1 : ℝ)) := by -+ ext t -+ unfold indicator -+ simp [div_pos_iff_of_pos_right, div_le_one₀, hx] -+ rw [this] -+ apply ContinuousOn.continuousAt_indicator (by fun_prop) -+ simp [frontier_Ioc hx, ypos.ne', hx2.symm] -+ -+lemma Smooth1MellinConvergent {Ψ : ℝ → ℝ} {ε : ℝ} (diffΨ : ContDiff ℝ 1 Ψ) -+ (suppΨ : Ψ.support ⊆ Icc (1 / 2) 2) (hε : ε ∈ Ioo 0 1) -+ (Ψnonneg : ∀ x > 0, 0 ≤ Ψ x) (mass_one : ∫ x in Ioi 0, Ψ x / x = 1) -+ {s : ℂ} (hs : 0 < s.re) : MellinConvergent (fun x ↦ (Smooth1 Ψ ε x : ℂ)) s := by -+ apply mellinConvergent_of_isBigO_rpow_exp zero_lt_one _ _ _ hs -+ · apply ContinuousOn.locallyIntegrableOn _ (by measurability) -+ apply continuousOn_of_forall_continuousAt -+ exact fun x hx ↦ Smooth1ContinuousAt diffΨ Ψnonneg suppΨ hε.1 hx |>.ofReal -+ · rw [Asymptotics.isBigO_iff] -+ use 1 -+ obtain ⟨c, cpos, ceq, hc⟩ := Smooth1Properties_above suppΨ -+ filter_upwards [eventually_ge_atTop (1 + c * ε)] with x hx -+ rw [hc _ _ hε hx] -+ simp only [ofReal_zero, norm_zero, neg_mul, one_mul, norm_eq_abs, abs_exp] -+ bound -+ · rw [Asymptotics.isBigO_iff] -+ use 1 -+ filter_upwards [eventually_mem_nhdsWithin] with x hx -+ simp only [norm_real, norm_eq_abs, neg_zero, rpow_zero, one_mem, CStarRing.norm_of_mem_unitary, -+ mul_one] -+ rw [_root_.abs_of_nonneg <| Smooth1Nonneg Ψnonneg hx hε.1] -+ exact Smooth1LeOne Ψnonneg mass_one hε.1 hx -+ -+lemma Smooth1MellinDifferentiable {Ψ : ℝ → ℝ} {ε : ℝ} (diffΨ : ContDiff ℝ 1 Ψ) -+ (suppΨ : Ψ.support ⊆ Icc (1 / 2) 2) (hε : ε ∈ Ioo 0 1) -+ (Ψnonneg : ∀ x > 0, 0 ≤ Ψ x) (mass_one : ∫ x in Ioi 0, Ψ x / x = 1) -+ {s : ℂ} (hs : 0 < s.re) : -+ DifferentiableAt ℂ (𝓜 (fun x ↦ (Smooth1 Ψ ε x : ℂ))) s := by -+ apply mellin_differentiableAt_of_isBigO_rpow_exp zero_lt_one _ _ _ hs -+ · apply ContinuousOn.locallyIntegrableOn _ (by measurability) -+ apply continuousOn_of_forall_continuousAt -+ exact fun x hx ↦ Smooth1ContinuousAt diffΨ Ψnonneg suppΨ hε.1 hx |>.ofReal -+ · rw [Asymptotics.isBigO_iff] -+ use 1 -+ obtain ⟨c, cpos, ceq, hc⟩ := Smooth1Properties_above suppΨ -+ filter_upwards [eventually_ge_atTop (1 + c * ε)] with x hx -+ rw [hc _ _ hε hx] -+ simp only [ofReal_zero, norm_zero, neg_mul, one_mul, norm_eq_abs, abs_exp] -+ bound -+ · rw [Asymptotics.isBigO_iff] -+ use 1 -+ filter_upwards [eventually_mem_nhdsWithin] with x hx -+ simp only [norm_real, norm_eq_abs, neg_zero, rpow_zero, one_mem, CStarRing.norm_of_mem_unitary, -+ mul_one] -+ rw [_root_.abs_of_nonneg <| Smooth1Nonneg Ψnonneg hx hε.1] -+ exact Smooth1LeOne Ψnonneg mass_one hε.1 hx -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/MertensClassical.lean b/PrimeNumberTheoremAnd/Erdos970/MertensClassical.lean -new file mode 100644 -index 0000000..8f3e823 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/MertensClassical.lean -@@ -0,0 +1,1982 @@ -+import Mathlib.Algebra.Order.Field.GeomSum -+import Mathlib.Analysis.SumIntegralComparisons -+import Mathlib.NumberTheory.Chebyshev -+import Mathlib.NumberTheory.Harmonic.EulerMascheroni -+import Mathlib.NumberTheory.LSeries.PrimesInAP -+import Mathlib.NumberTheory.LSeries.RiemannZeta -+import Mathlib.NumberTheory.Harmonic.GammaDeriv -+import Mathlib.Analysis.Asymptotics.Lemmas -+import Mathlib.Analysis.SpecialFunctions.Complex.Analytic -+import Mathlib.Analysis.SpecialFunctions.Integrability.LogMeromorphic -+import Mathlib.NumberTheory.EulerProduct.DirichletLSeries -+import Mathlib.NumberTheory.EulerProduct.ExpLog -+import Mathlib.Analysis.SpecialFunctions.Complex.LogBounds -+import Mathlib.Analysis.SpecialFunctions.Log.Summable -+import Mathlib.Algebra.Group.Submonoid.BigOperators -+import PrimeNumberTheoremAnd.Erdos970.EulerMaclaurin -+ -+namespace Erdos970 -+ -+theorem Filter.EventuallyEq.iff_eventually {α : Type _} {β : Type _} {l : Filter α} {f g : α → β} : f =ᶠ[l] g ↔ ∀ᶠ (x : α) in l, f x = g x := by rfl -+ -+namespace Real -+ -+open _root_.Real _root_.Filter _root_.Asymptotics -+ -+theorem inv_log_eq_o_one : (fun x ↦ 1 / log x) =o[atTop] (fun _ ↦ (1:ℝ)) := by -+ rw [isLittleO_one_iff] -+ convert tendsto_log_atTop.inv_tendsto_atTop using 1 -+ ext; simp -+ -+theorem one_eq_o_log_log : (fun _ ↦ (1:ℝ)) =o[atTop] (fun x ↦ log (log x)) := by -+ simp only [isLittleO_one_left_iff, norm_eq_abs] -+ exact tendsto_abs_atTop_atTop.comp (tendsto_log_atTop.comp tendsto_log_atTop) -+ -+end Real -+ -+section Issue1584 -+open _root_.MeasureTheory _root_.Set _root_.Filter _root_.Topology -+ -+private lemma integrableOn_log_mul_exp_neg : -+ IntegrableOn (fun v : ℝ => Real.log v * Real.exp (-v)) (Ioi 0) := by -+ rw [← Set.Ioc_union_Ioi_eq_Ioi (zero_le_one' ℝ), integrableOn_union] -+ constructor -+ · -+ have hlog : IntegrableOn (fun v : ℝ => Real.log v) (Ioc 0 1) volume := by -+ have := (intervalIntegral.intervalIntegrable_log' (a := 0) (b := 1)) -+ rwa [intervalIntegrable_iff_integrableOn_Ioc_of_le (zero_le_one' ℝ)] at this -+ apply Integrable.mono' hlog.norm -+ · apply (Measurable.aestronglyMeasurable ?_) -+ exact (Real.measurable_log.mul (Real.measurable_exp.comp measurable_neg)) -+ · filter_upwards [self_mem_ae_restrict measurableSet_Ioc] with v hv -+ rw [norm_mul, Real.norm_eq_abs, Real.norm_eq_abs] -+ have h1 : |Real.exp (-v)| = Real.exp (-v) := abs_of_pos (Real.exp_pos _) -+ have h2 : Real.exp (-v) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith [hv.1]) -+ rw [h1] -+ nlinarith [abs_nonneg (Real.log v), Real.exp_pos (-v)] -+ · -+ have hexp : IntegrableOn (fun v : ℝ => (2 : ℝ) * Real.exp ((-1/2) * v)) (Ioi 1) volume := by -+ exact (integrableOn_exp_mul_Ioi (by norm_num : (-1/2 : ℝ) < 0) 1).const_mul 2 -+ apply Integrable.mono' hexp -+ · apply (Measurable.aestronglyMeasurable ?_) -+ exact (Real.measurable_log.mul (Real.measurable_exp.comp measurable_neg)) -+ · filter_upwards [self_mem_ae_restrict measurableSet_Ioi] with v hv -+ have hv1 : (1 : ℝ) ≤ v := le_of_lt hv -+ have hvpos : (0 : ℝ) < v := by linarith -+ rw [norm_mul, Real.norm_eq_abs, Real.norm_eq_abs] -+ have hlogabs : |Real.log v| = Real.log v := -+ abs_of_nonneg (Real.log_nonneg hv1) -+ have hexpabs : |Real.exp (-v)| = Real.exp (-v) := abs_of_pos (Real.exp_pos _) -+ rw [hlogabs, hexpabs] -+ -+ have hlogv : Real.log v ≤ v := (Real.log_le_sub_one_of_pos hvpos).trans (by linarith) -+ -+ have hvexp : v ≤ 2 * Real.exp (v/2) := by -+ have := Real.add_one_le_exp (v/2) -+ nlinarith [Real.exp_pos (v/2)] -+ -+ have hstep : Real.log v * Real.exp (-v) ≤ 2 * Real.exp (v/2) * Real.exp (-v) := by -+ apply mul_le_mul_of_nonneg_right (hlogv.trans hvexp) (le_of_lt (Real.exp_pos _)) -+ have heq : 2 * Real.exp (v/2) * Real.exp (-v) = 2 * Real.exp ((-1/2) * v) := by -+ rw [mul_assoc, ← Real.exp_add] -+ ring_nf -+ rw [heq] at hstep -+ exact hstep -+ -+private lemma integral_log_mul_exp_neg_eq_deriv_Gamma : -+ ∫ t in Ioi (0:ℝ), Real.log t * Real.exp (-t) = deriv Real.Gamma 1 := by -+ set I : ℝ := ∫ t in Ioi (0:ℝ), Real.log t * Real.exp (-t) with hI -+ -+ have h1 := Complex.hasDerivAt_GammaIntegral (s := (1 : ℂ)) (by norm_num) -+ -+ have hval : (∫ t : ℝ in Ioi 0, (↑t : ℂ) ^ ((1 : ℂ) - 1) * (↑(Real.log t) * ↑(Real.exp (-t)))) -+ = (I : ℂ) := by -+ have key : ∀ t : ℝ, (↑t : ℂ) ^ ((1 : ℂ) - 1) * (↑(Real.log t) * ↑(Real.exp (-t))) -+ = ((Real.log t * Real.exp (-t) : ℝ) : ℂ) := by -+ intro t -+ rw [sub_self, Complex.cpow_zero, one_mul, Complex.ofReal_mul] -+ simp_rw [key] -+ rw [integral_complex_ofReal, hI] -+ rw [hval] at h1 -+ -+ have h2 : HasDerivAt Complex.Gamma (I : ℂ) 1 := by -+ apply h1.congr_of_eventuallyEq -+ filter_upwards [(isOpen_lt continuous_const Complex.continuous_re).mem_nhds -+ (show (0:ℝ) < (1:ℂ).re by norm_num)] with z hz -+ exact Complex.Gamma_eq_integral hz -+ -+ have h3 := h2.real_of_complex -+ have h4 : HasDerivAt Real.Gamma I 1 := by -+ have hcongr : (fun x : ℝ => (Complex.Gamma ↑x).re) = Real.Gamma := by -+ funext x -+ rw [Complex.Gamma_ofReal, Complex.ofReal_re] -+ rw [hcongr, Complex.ofReal_re] at h3 -+ exact h3 -+ rw [← h4.deriv] -+ -+private theorem mul_integ_log_log_eq_aux (s : ℝ) (hs : 1 < s) : -+ (s - 1) * ∫ x in Ioi (1:ℝ), Real.log (Real.log x) * x ^ (-s) = -+ - Real.log (s - 1) + deriv Real.Gamma 1 := by -+ have hs0 : 0 < s - 1 := by linarith -+ set f : ℝ → ℝ := fun x => (s - 1) * Real.log x with hf_def -+ set f' : ℝ → ℝ := fun x => (s - 1) / x with hf'_def -+ set g : ℝ → ℝ := fun u => (Real.log u - Real.log (s - 1)) * Real.exp (-u) with hg_def -+ -+ have hf1 : f 1 = 0 := by simp [hf_def] -+ -+ have hf_cont : ContinuousOn f (Ici 1) := by -+ apply ContinuousOn.mul continuousOn_const -+ apply Real.continuousOn_log.mono -+ intro x hx -+ simp only [mem_Ici] at hx -+ simp only [Set.mem_compl_iff, Set.mem_singleton_iff] -+ linarith -+ -+ have hft : Tendsto f atTop atTop := by -+ apply Filter.Tendsto.const_mul_atTop hs0 -+ exact Real.tendsto_log_atTop -+ -+ have hff' : ∀ x ∈ Ioi (1:ℝ), HasDerivWithinAt f (f' x) (Ioi x) x := by -+ intro x hx -+ simp only [mem_Ioi] at hx -+ have hxne : x ≠ 0 := by linarith -+ have := (Real.hasDerivAt_log hxne).const_mul (s - 1) -+ have h2 : HasDerivAt f ((s - 1) * x⁻¹) x := this -+ have : (s - 1) * x⁻¹ = f' x := by rw [hf'_def]; field_simp -+ rw [this] at h2 -+ exact h2.hasDerivWithinAt -+ -+ have hmono : StrictMonoOn f (Ici 1) := by -+ intro a ha b hb hab -+ simp only [mem_Ici] at ha hb -+ apply mul_lt_mul_of_pos_left _ hs0 -+ exact Real.log_lt_log (by linarith) hab -+ have himg_Ioi : f '' Ioi 1 = Ioi 0 := by -+ ext y -+ simp only [Set.mem_image, mem_Ioi] -+ constructor -+ · rintro ⟨x, hx, rfl⟩ -+ have : 0 < Real.log x := Real.log_pos hx -+ positivity -+ · intro hy -+ refine ⟨Real.exp (y / (s - 1)), ?_, ?_⟩ -+ · exact Real.one_lt_exp_iff.mpr (div_pos hy hs0) -+ · rw [hf_def] -+ simp only [Real.log_exp] -+ field_simp -+ have himg_Ici : f '' Ici 1 = Ici 0 := by -+ ext y -+ simp only [Set.mem_image, mem_Ici] -+ constructor -+ · rintro ⟨x, hx, rfl⟩ -+ have : 0 ≤ Real.log x := Real.log_nonneg hx -+ rw [hf_def]; positivity -+ · intro hy -+ refine ⟨Real.exp (y / (s - 1)), ?_, ?_⟩ -+ · exact Real.one_le_exp_iff.mpr (div_nonneg hy hs0.le) -+ · rw [hf_def] -+ simp only [Real.log_exp] -+ field_simp -+ -+ have hg_cont : ContinuousOn g (f '' Ioi 1) := by -+ rw [himg_Ioi] -+ apply ContinuousOn.mul -+ · apply ContinuousOn.sub _ continuousOn_const -+ apply Real.continuousOn_log.mono -+ intro u hu -+ simp only [mem_Ioi] at hu -+ simp only [Set.mem_compl_iff, Set.mem_singleton_iff] -+ linarith -+ · exact (Real.continuous_exp.comp continuous_neg).continuousOn -+ -+ have hg1 : IntegrableOn g (f '' Ici 1) := by -+ rw [himg_Ici, integrableOn_Ici_iff_integrableOn_Ioi] -+ have e1 : IntegrableOn (fun u => Real.log u * Real.exp (-u)) (Ioi 0) := -+ integrableOn_log_mul_exp_neg -+ have e2 : IntegrableOn (fun u => Real.log (s - 1) * Real.exp (-u)) (Ioi 0) := -+ (integrableOn_exp_neg_Ioi 0).const_mul _ -+ have : g = fun u => Real.log u * Real.exp (-u) - Real.log (s - 1) * Real.exp (-u) := by -+ funext u; rw [hg_def]; ring -+ rw [this] -+ exact e1.sub e2 -+ -+ have hg2 : IntegrableOn (fun x => (g ∘ f) x * f' x) (Ici 1) := by -+ -+ have hff'_Ici : ∀ x ∈ Ici (1:ℝ), HasDerivWithinAt f (f' x) (Ici 1) x := by -+ intro x hx -+ simp only [mem_Ici] at hx -+ have hxne : x ≠ 0 := by linarith -+ have hd : HasDerivAt f ((s - 1) * x⁻¹) x := (Real.hasDerivAt_log hxne).const_mul (s - 1) -+ have heq : (s - 1) * x⁻¹ = f' x := by rw [hf'_def]; field_simp -+ rw [heq] at hd -+ exact hd.hasDerivWithinAt -+ -+ have hinj : InjOn f (Ici 1) := hmono.injOn -+ -+ have hiff := integrableOn_image_iff_integrableOn_abs_deriv_smul -+ (s := Ici (1:ℝ)) (f := f) (f' := f') measurableSet_Ici hff'_Ici hinj g -+ rw [hiff] at hg1 -+ -+ apply hg1.congr -+ filter_upwards [self_mem_ae_restrict measurableSet_Ici] with x hx -+ simp only [mem_Ici] at hx -+ have hxpos : (0:ℝ) < x := by linarith -+ have hf'pos : 0 < f' x := by rw [hf'_def]; positivity -+ simp only [smul_eq_mul, Function.comp, abs_of_pos hf'pos] -+ ring -+ -+ have hcov := integral_comp_mul_deriv_Ioi hf_cont hft hff' hg_cont hg1 hg2 -+ rw [hf1] at hcov -+ -+ have hrhs : ∫ u in Ioi (0:ℝ), g u = deriv Real.Gamma 1 - Real.log (s - 1) := by -+ have e1 : IntegrableOn (fun u => Real.log u * Real.exp (-u)) (Ioi 0) := -+ integrableOn_log_mul_exp_neg -+ have e2 : IntegrableOn (fun u => Real.log (s - 1) * Real.exp (-u)) (Ioi 0) := -+ (integrableOn_exp_neg_Ioi 0).const_mul _ -+ have hsplit : (fun u => g u) -+ = fun u => Real.log u * Real.exp (-u) - Real.log (s - 1) * Real.exp (-u) := by -+ funext u; rw [hg_def]; ring -+ rw [show (∫ u in Ioi (0:ℝ), g u) -+ = ∫ u in Ioi (0:ℝ), (Real.log u * Real.exp (-u) - Real.log (s - 1) * Real.exp (-u)) -+ from by rw [hsplit]] -+ rw [integral_sub e1 e2, integral_log_mul_exp_neg_eq_deriv_Gamma] -+ rw [integral_const_mul, integral_exp_neg_Ioi_zero, mul_one] -+ -+ have hlhs : ∫ x in Ioi (1:ℝ), (g ∘ f) x * f' x -+ = (s - 1) * ∫ x in Ioi (1:ℝ), Real.log (Real.log x) * x ^ (-s) := by -+ have hpt : ∀ x ∈ Ioi (1:ℝ), (g ∘ f) x * f' x -+ = (s - 1) * (Real.log (Real.log x) * x ^ (-s)) := by -+ intro x hx -+ simp only [mem_Ioi] at hx -+ have hxpos : (0:ℝ) < x := by linarith -+ have hlogpos : 0 < Real.log x := Real.log_pos hx -+ have hlogne : Real.log x ≠ 0 := ne_of_gt hlogpos -+ have hs1ne : s - 1 ≠ 0 := ne_of_gt hs0 -+ simp only [Function.comp, hf_def, hg_def, hf'_def] -+ -+ rw [Real.log_mul hs1ne hlogne] -+ -+ have hexp : Real.exp (-((s - 1) * Real.log x)) = x ^ (-(s - 1)) := by -+ rw [Real.rpow_def_of_pos hxpos] -+ ring_nf -+ rw [hexp] -+ -+ have hx1 : x ^ (-(s - 1)) * ((s - 1) / x) = (s - 1) * x ^ (-s) := by -+ rw [div_eq_mul_inv, ← Real.rpow_neg_one x] -+ rw [show x ^ (-(s - 1)) * ((s - 1) * x ^ (-1 : ℝ)) -+ = (s - 1) * (x ^ (-(s - 1)) * x ^ (-1 : ℝ)) by ring] -+ rw [← Real.rpow_add hxpos] -+ ring_nf -+ rw [show (Real.log (s - 1) + Real.log (Real.log x) - Real.log (s - 1)) -+ = Real.log (Real.log x) by ring] -+ linear_combination Real.log (Real.log x) * hx1 -+ rw [setIntegral_congr_fun measurableSet_Ioi hpt, integral_const_mul] -+ rw [hlhs, hrhs] at hcov -+ rw [hcov] -+ ring -+ -+end Issue1584 -+ -+namespace Mertens -+ -+open _root_.Real Erdos970.Real _root_.Finset _root_.Filter _root_.Asymptotics _root_.Topology -+open ArithmeticFunction hiding log -+ -+lemma sum_Ioc_one_eq_sum_Ioc_zero {f : ℕ → ℝ} {x : ℕ} (hx : 1 ≤ x) (hf : f 1 = 0) : -+ ∑ n ∈ Ioc 1 x, f n = ∑ n ∈ Ioc 0 x, f n := by -+ rw [(by rfl : Ioc 0 x = Icc 1 x), ← add_sum_Ioc_eq_sum_Icc hx] -+ simpa -+ -+theorem sum_log_eq {x : ℝ} (hx : 1 ≤ x) : -+ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n = -+ x * log x - (x - ⌊x⌋₊ - 1 / 2) * log x - x + 1 + ∫ t in 1..x, (t - ⌊t⌋₊ - 1 / 2) / t := by -+ rw [← sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp)] -+ have : 1 = ⌊(1 : ℝ)⌋₊ := by simp -+ nth_rw 1 [this] -+ rw [sum_eq_integral_add_integral_deriv (by norm_num) hx (fun _ _ ↦ (by fun_prop (disch := grind)))] -+ · simp only [log_one, B1, Nat.floor_one, Nat.cast_one, sub_self, zero_sub, -+ RCLike.ofReal_real_eq_id, id_eq, mul_neg, zero_mul, neg_zero, integral_log, mul_zero, sub_zero, -+ deriv_log'] -+ ring_nf -+ congr -+ ext -+ ring -+ · simp only [deriv_log', Set.uIcc_of_le hx] -+ fun_prop (disch := grind) -+ -+theorem sum_log_le {x : ℝ} (hx : 1 ≤ x) : -+ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n ≤ x * log x := by -+ calc -+ _ ≤ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log x := by -+ refine sum_le_sum fun n hn ↦ ?_ -+ simp only [mem_Ioc] at hn -+ exact log_le_log (by exact_mod_cast hn.1) (Nat.le_floor_iff (by linarith)|>.mp hn.2) -+ _ = ⌊x⌋₊ * log x := by simp -+ _ ≤ _ := by -+ gcongr -+ · exact log_nonneg hx -+ · exact Nat.floor_le (by linarith) -+ -+lemma integral_log_le {a b : ℝ} (ha : 1 ≤ a) (hab : a ≤ b) : -+ ∫ t in a..b, log t ≤ log b * (b - a) := by -+ apply le_of_abs_le -+ have : ∀ t ∈ Set.uIoc a b, ‖log t‖ ≤ log b := by -+ intro t ht -+ rw [Set.uIoc_of_le hab, Set.mem_Ioc] at ht -+ rw [norm_of_nonneg <| log_nonneg (by linarith)] -+ gcongr <;> linarith -+ grw [← norm_eq_abs, intervalIntegral.norm_integral_le_of_norm_le_const this, -+ abs_of_nonneg (by linarith)] -+ -+theorem sum_log_ge {x : ℝ} (hx : 1 ≤ x) : -+ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n ≥ x * log x - 2 * x := by -+ have one_le_floor : 1 ≤ ⌊x⌋₊ := by simpa -+ calc -+ _ = ∑ n ∈ Icc 1 ⌊ x ⌋₊, log n := by rfl -+ _ = ∑ n ∈ Ico (1 + 1) (⌊ x ⌋₊ + 1), log n := by -+ rw [← add_sum_Ioc_eq_sum_Icc one_le_floor] -+ simp -+ rfl -+ _ = ∑ n ∈ Ico 1 ⌊ x ⌋₊, log ((n + 1 : ℕ)) := by -+ rw [← Finset.sum_Ico_add'] -+ _ ≥ ∫ t in 1..⌊x⌋₊, log t := by -+ convert MonotoneOn.integral_le_sum_Ico one_le_floor ?_|>.ge -+ · norm_cast -+ · exact StrictMonoOn.monotoneOn (strictMonoOn_log.mono fun y hy ↦ (by simp_all; linarith)) -+ _ = (∫ t in 1..x, log t) - ∫ t in ⌊x⌋₊..x, log t := by -+ nth_rw 3 [intervalIntegral.integral_symm] -+ rw [sub_neg_eq_add, intervalIntegral.integral_add_adjacent_intervals] <;> exact intervalIntegral.intervalIntegrable_log' -+ _ ≥ (∫ t in 1..x, log t) - log x := by -+ gcongr -+ grw [integral_log_le (by simpa) (Nat.floor_le (by linarith))] -+ nth_rw 2 [← mul_one (log x)] -+ gcongr -+ · exact log_nonneg hx -+ · linarith [Nat.lt_floor_add_one x] -+ _ ≥ x * log x - x - log x := by simp only [integral_log, log_one, mul_zero, sub_zero, ge_iff_le, -+ tsub_le_iff_right, sub_add_cancel, le_add_iff_nonneg_right, zero_le_one] -+ _ ≥ _ := by linarith [log_le_self (by linarith : 0 ≤ x)] -+ -+theorem sum_log_eq_log_factorial (x : ℝ) : -+ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n = log (Nat.floor x).factorial := by -+ rw [←prod_Ico_id_eq_factorial, ←log_prod, prod_natCast] -+ · congr -+ intro x hx -+ simp at hx ⊢; grind -+ -+theorem sum_log_eq_sum_mangoldt {x : ℝ} : -+ ∑ n ∈ Ioc 0 ⌊x⌋₊, log n = ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * ⌊x / d⌋₊ := by -+ have : ∀ n : ℕ, log n = (Λ * zeta) n := by simp [vonMangoldt_mul_zeta] -+ simp_rw [this, sum_Ioc_mul_zeta_eq_sum, ← Nat.floor_div_natCast] -+ -+noncomputable abbrev E₁Λ (x : ℝ) : ℝ := ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d - log x -+ -+theorem sum_mangoldt_div_eq (x : ℝ) : ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d = log x + E₁Λ x := by -+ grind -+ -+theorem E₁Λ.ge {x : ℝ} (hx : 1 ≤ x) : -+ E₁Λ x ≥ -2 := by -+ unfold E₁Λ -+ suffices x * ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d / d ≥ x * (log x - 2) by -+ linarith [le_of_mul_le_mul_left this (by linarith)] -+ calc -+ _ = ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * (x / d) := by -+ rw [Finset.mul_sum] -+ ring_nf -+ _ ≥ ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * ⌊x / d⌋₊ := by -+ gcongr -+ exact Nat.floor_le <| div_nonneg (by linarith) (by linarith) -+ _ ≥ x * log x - 2 * x := -+ sum_log_eq_sum_mangoldt ▸ sum_log_ge hx -+ _ = _ := by ring -+ -+theorem E₁Λ.le {x : ℝ} (hx : 1 ≤ x) : -+ E₁Λ x ≤ log 4 + 4 := by -+ unfold E₁Λ -+ suffices x * ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d / d ≤ x * (log x + log 4 + 4) by -+ linarith [le_of_mul_le_mul_left this (by linarith)] -+ calc -+ _ = ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * (x / d) := by -+ rw [Finset.mul_sum] -+ ring_nf -+ _ ≤ ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * (⌊x / d⌋₊ + 1) := by -+ gcongr -+ exact Nat.lt_floor_add_one _|>.le -+ _ = (∑ d ∈ Ioc 0 ⌊x⌋₊, log d) + ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d := by -+ simp_rw [mul_add, mul_one] -+ rw [Finset.sum_add_distrib, sum_log_eq_sum_mangoldt] -+ _ ≤ x * log x + (log 4 + 4) * x := by -+ gcongr -+ · exact sum_log_le hx -+ · exact Chebyshev.psi_le_const_mul_self (by linarith) -+ _ = _ := by ring -+ -+theorem sum_mangoldt_div_eq_log {x : ℝ} (hx : 1 ≤ x) : -+ |∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d - log x| ≤ log 4 + 4 := by -+ grind [E₁Λ.le hx, E₁Λ.ge hx, log_nonneg] -+ -+theorem E₁Λ.bounded' : ∃ c > 0, ∀ x ≥ 1, |E₁Λ x| ≤ c := by -+ exact ⟨log 4 + 4, (by positivity), fun x hx ↦ sum_mangoldt_div_eq_log hx⟩ -+ -+theorem E₁Λ.bounded : E₁Λ =O[atTop] (fun _ ↦ (1:ℝ)) := by -+ simp only [isBigO_iff, norm_eq_abs, norm_one, mul_one, -+ eventually_atTop] -+ exact ⟨log 4 + 4, 1, fun _ hx ↦ sum_mangoldt_div_eq_log hx⟩ -+ -+theorem one_eq_o_log : (fun _ ↦ (1:ℝ)) =o[atTop] (fun x ↦ log x) := by -+ simp only [isLittleO_one_left_iff, norm_eq_abs] -+ exact tendsto_abs_atTop_atTop.comp tendsto_log_atTop -+ -+theorem sum_mangoldt_div_eq_log' : -+ (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d) ~[atTop] (fun x ↦ log x) := by -+ apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log) -+ convert! E₁Λ.bounded using 1 -+ -+noncomputable abbrev E₁p (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p - log x -+ -+theorem sum_log_prime_div_eq (x : ℝ) : ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p = log x + E₁p x := by -+ grind -+ -+theorem E₁p.le_E₁Λ (x : ℝ) : -+ E₁p x ≤ E₁Λ x := by -+ unfold E₁p E₁Λ; rw [sum_filter] -+ gcongr with p _ -+ split_ifs with hp -+ · simp [vonMangoldt_apply_prime hp] -+ have : 0 ≤ Λ p := vonMangoldt_nonneg -+ positivity -+ -+theorem E₁p.le {x : ℝ} (hx : 1 ≤ x) : -+ E₁p x ≤ log 4 + 4 := by -+ linarith [E₁Λ.le hx, E₁p.le_E₁Λ x] -+ -+noncomputable abbrev E₁ : ℝ := ∑' p : ℕ, if p.Prime then (log p) / (p*(p-1)) else 0 -+ -+lemma E₁.summand_nonneg (p : ℕ) : 0 ≤ if p.Prime then (log p) / (p*(p-1)) else 0 := by -+ split_ifs with h -+ · refine div_nonneg (log_natCast_nonneg _) (mul_nonneg (Nat.cast_nonneg _) ?_) -+ suffices 1 ≤ (p : ℝ) by linarith -+ exact_mod_cast h.one_le -+ · rfl -+ -+theorem E₁.summable : Summable (fun p : ℕ ↦ if p.Prime then (log p) / (p*(p-1)) else 0) := by -+ refine (Real.summable_one_div_nat_rpow.mpr (by norm_num: 1 < (3 : ℝ) / 2)|>.const_div -+ 4).of_nonneg_of_le E₁.summand_nonneg fun n ↦ ?_ -+ split_ifs with h -+ · grw [Real.log_le_rpow_div (Nat.cast_nonneg _) (by norm_num : 0 < (1 : ℝ) / 2)] -+ · have denom : (n : ℝ) * ((n : ℝ) - 1) ≥ n ^ 2/ 2 := by -+ rw [sq, mul_div_assoc] -+ gcongr -+ suffices (n : ℝ) ≥ 2 by linarith -+ exact_mod_cast h.two_le -+ grw [denom] -+ · apply le_of_eq -+ rw [← Real.rpow_natCast] -+ field_simp -+ rw [mul_div_assoc, ← Real.rpow_sub (mod_cast h.pos)] -+ norm_num -+ rw [Real.rpow_neg (Nat.cast_nonneg _)] -+ field -+ · exact div_pos (pow_pos (mod_cast h.pos) _) (by norm_num) -+ · apply mul_nonneg (Nat.cast_nonneg _) -+ suffices 1 ≤ (n : ℝ) by linarith -+ exact_mod_cast h.one_le -+ · positivity -+ -+private lemma antitoneOn_log_div_sq : -+ AntitoneOn (fun t ↦ log (t + 2) / (t + 2) ^ 2) (Set.Ici 0) := by -+ apply antitoneOn_of_deriv_nonpos (convex_Ici 0) -+ · refine fun t ht ↦ ContinuousAt.continuousWithinAt ?_ -+ simp at ht -+ have : (t + 2) ≠ 0 := by simp; linarith -+ fun_prop (disch := grind) -+ · refine fun t ht ↦ DifferentiableAt.differentiableWithinAt ?_ -+ simp at ht -+ have : (t + 2) ^ 2 ≠ 0 := by simp; grind -+ fun_prop (disch := grind) -+ · intro t ht -+ simp at ht -+ rw [deriv_fun_div (by fun_prop (disch := grind)) (by fun_prop) (by simp; grind), deriv_comp_add_const, deriv_log] -+ simp -+ field_simp -+ simp only [mul_zero, tsub_le_iff_right, zero_add] -+ rw [← log_rpow (by linarith), ← log_exp 1, rpow_ofNat] -+ gcongr -+ nlinarith [exp_one_lt_three] -+ -+private lemma log_div_sq_nonneg : -+ ∀ t ∈ Set.Ioi 0, 0 ≤ log (t + 2) / (t + 2) ^ 2 := by -+ exact fun t ht ↦ div_nonneg (log_nonneg (by simp_all; linarith)) (by positivity) -+ -+private lemma log_div_sq_is_deriv : -+ ∀ x ∈ Set.Ici 0, HasDerivAt (fun t ↦ (-log (t + 2) - 1) / (t + 2)) (log (x + 2) / (x + 2) ^ 2) x := by -+ intro t ht -+ simp at ht -+ apply HasDerivAt.comp_add_const (f := (fun t ↦ (-log t - 1)/ t)) t 2 -+ convert! HasDerivAt.fun_div (c' := -1 / (t + 2)) (d' := (1 : ℝ)) _ _ _ using 1 -+ · field -+ · apply HasDerivAt.sub_const -+ convert! (hasDerivAt_log (by linarith : t + 2 ≠ 0)).neg using 1 -+ ring_nf -+ · exact hasDerivAt_id _ -+ · linarith -+ -+private lemma tendsto_antideriv_log_div_sq : -+ Tendsto (fun t ↦ (-log (t + 2) - 1) / (t + 2)) atTop (nhds 0) := by -+ have : Tendsto (fun (t : ℝ) ↦ t + 2) atTop atTop := by exact tendsto_atTop_add_const_right atTop 2 tendsto_id -+ apply Tendsto.comp (g := (fun t ↦ (-log t - 1) / t)) _ this -+ convert! Tendsto.sub (f := (fun t ↦ -log t / t)) (a := 0) _ tendsto_inv_atTop_zero using 1 -+ · ring_nf -+ · ring_nf -+ · convert! (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 (by linarith)).neg using 1 -+ · ext; ring -+ · simp -+ -+private lemma integrableOn_log_div_sq : -+ MeasureTheory.IntegrableOn (fun t ↦ log (t + 2) / (t + 2) ^ 2) (Set.Ioi 0) := by -+ exact MeasureTheory.integrableOn_Ioi_deriv_of_nonneg' log_div_sq_is_deriv log_div_sq_nonneg tendsto_antideriv_log_div_sq -+ -+private lemma integral_log_div_sq : -+ ∫ t in Set.Ioi 0, log (t + 2) / (t + 2) ^ 2 = (log 2 + 1) / 2 := by -+ rw [MeasureTheory.integral_Ioi_of_hasDerivAt_of_nonneg' log_div_sq_is_deriv log_div_sq_nonneg tendsto_antideriv_log_div_sq] -+ ring_nf -+ -+private lemma summable_log_div_sq : -+ Summable (fun (n : ℕ)↦ log (n + 3) / (n + 3) ^ 2) := by -+ let g : ℝ → ℝ := (fun n ↦ log (n + 2) / (n + 2) ^ 2) -+ suffices Summable (fun (n : ℕ) ↦ g n ) by -+ convert! summable_nat_add_iff 1|>.mpr this using 2 -+ unfold g -+ push_cast -+ ring_nf -+ exact antitoneOn_log_div_sq.summable_of_integrableOn_Ioi_zero integrableOn_log_div_sq log_div_sq_nonneg -+ -+private lemma sum_log_div_sq_le : -+ ∑' (n : ℕ), log (n + 3) / (n + 3) ^2 ≤ (log 2 + 1) / 2 := by -+ let g : ℝ → ℝ := (fun n ↦ log (n + 2) / (n + 2) ^ 2) -+ calc -+ _ = ∑' (n : ℕ), g (n + 1 : ℕ):= by -+ unfold g -+ congr -+ push_cast -+ ring_nf -+ _ ≤ ∫ x in Set.Ioi 0, g x := by -+ exact antitoneOn_log_div_sq.tsum_add_one_le_integral integrableOn_log_div_sq log_div_sq_nonneg -+ _ = _ := by -+ exact integral_log_div_sq -+ -+theorem E₁.le : E₁ ≤ (5 * log 2 + 3) / 4 := by -+ unfold E₁ -+ calc -+ _ = log 2 / 2 + ∑' (n : ℕ), if (n + 3).Prime then log (n + 3) / ((n + 3) * (n + 2)) else 0 := by -+ rw [← E₁.summable.sum_add_tsum_nat_add 3, (by rfl : range 3 = {0, 1, 2})] -+ simp [Nat.prime_two] -+ ring_nf -+ _ ≤ log 2 / 2 + ∑' (n : ℕ), (3 / 2) * (log (n + 3) / (n + 3) ^ 2) := by -+ gcongr with n -+ · convert! summable_nat_add_iff 3|>.mpr E₁.summable using 4 -+ · norm_cast -+ · push_cast; ring -+ · exact summable_log_div_sq.mul_left _ -+ · split_ifs with h -+ · grw [(by linarith : (n + 2 : ℝ) ≥ 2 * (n + 3) / 3)] -+ · field_simp -+ rfl -+ · exact log_nonneg (by grind) -+ · exact mul_nonneg (by norm_num) (div_nonneg (log_nonneg (by grind)) (by positivity)) -+ _ = log 2 / 2 + (3 / 2) * ∑' (n : ℕ), log (n + 3) / (n + 3) ^ 2 := by -+ rw [tsum_mul_left] -+ _ ≤ _ := by -+ grw [sum_log_div_sq_le] -+ ring_nf -+ rfl -+ -+theorem E₁.nonneg : E₁ ≥ 0 := -+ tsum_nonneg E₁.summand_nonneg -+ -+theorem E₁Λ.le_E₁p_add_E₁ {x : ℝ} (hx : 1 ≤ x) : -+ E₁Λ x ≤ E₁p x + E₁ := by -+ unfold E₁Λ E₁p -+ suffices ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d / d ≤ ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / p + E₁ by linarith -+ simp_rw [vonMangoldt_apply, ite_div, zero_div, ← sum_filter, Chebyshev.sum_PrimePow_eq_sum_sum _ (by linarith)] -+ calc -+ _ = ∑ k ∈ Icc 1 ⌊log x / log 2⌋₊, ∑ p ∈ Ioc 0 ⌊x ^ (1 / (k : ℝ))⌋₊ with Nat.Prime p, log p / (p ^ k : ℕ) := by -+ refine sum_congr rfl fun k hk ↦ sum_congr rfl fun p hp ↦ ?_ -+ rw [Nat.Prime.pow_minFac (by simp_all) (by simp_all; linarith)] -+ _ ≤ ∑ k ∈ Icc 1 ⌊log x / log 2⌋₊, ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / (p ^ k : ℕ) := by -+ gcongr with k hk -+ apply rpow_le_self_of_one_le hx -+ simp only [mem_Icc] at hk -+ exact div_le_one₀ (by norm_cast; linarith)|>.mpr (mod_cast hk.1) -+ _ ≤ ∑ k ∈ Icc 1 (max 1 ⌊log x / log 2⌋₊), ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / (p ^ k : ℕ) := by -+ apply sum_le_sum_of_subset_of_nonneg -+ · gcongr -+ exact le_max_right .. -+ · exact fun _ _ _ ↦ sum_nonneg fun _ _ ↦ (by positivity) -+ _ = ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, (log p / p) + ∑ k ∈ Ioc 1 (max 1 ⌊log x / log 2⌋₊), ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / (p ^ k : ℕ) := by -+ rw [← add_sum_Ioc_eq_sum_Icc (le_max_left ..)] -+ simp -+ _ ≤ _ := by -+ gcongr -+ rw [sum_comm] -+ conv => lhs; arg 2; ext p; arg 2; ext k; rw [← mul_one_div, Nat.cast_pow, ← one_div_pow] -+ simp_rw [← mul_sum] -+ calc -+ _ ≤ ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / (p * (p - 1)) := by -+ gcongr with p hp -+ simp only [mem_filter, mem_Ioc] at hp -+ conv => rhs; rw [← mul_one_div] -+ gcongr -+ rw [(by rfl : Ioc 1 (max 1 ⌊log x / log 2⌋₊) = Ico 2 (max 1 ⌊log x / log 2⌋₊ + 1))] -+ grw [geom_sum_Ico_le_of_lt_one (by simp)] -+ · apply le_of_eq -+ have : (p : ℝ) ≠ 0 := by exact_mod_cast hp.1.1.ne.symm -+ field -+ · simpa using inv_lt_one_of_one_lt₀ (mod_cast hp.2.one_lt) -+ _ ≤ _ := by -+ rw [sum_filter] -+ exact E₁.summable.sum_le_tsum _ fun p hp ↦ E₁.summand_nonneg p -+ -+theorem E₁p.ge {x : ℝ} (hx : 1 ≤ x) : -+ E₁p x ≥ -2 - E₁ := by -+ linarith [E₁Λ.le_E₁p_add_E₁ hx, E₁Λ.ge hx] -+ -+theorem sum_log_prime_div_eq_log {x : ℝ} (hx : 1 ≤ x) : -+ |∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p - log x| ≤ log 4 + 4 := by -+ rw [abs_le'] -+ refine ⟨ E₁p.le hx, ?_ ⟩ -+ have : log 2 > 0 := by apply log_pos; norm_num -+ have : log 4 = 2 * log 2 := by rw [←Real.log_rpow (by norm_num)]; norm_num -+ grind [E₁p.ge hx, E₁.le] -+ -+theorem E₁p.bounded : ∃ c > 0, ∀ x ≥ 1, |E₁p x| ≤ c := by -+ exact ⟨log 4 + 4, (by positivity), fun _ hx ↦ sum_log_prime_div_eq_log hx⟩ -+ -+theorem sum_log_prime_div_eq_log' : E₁p =O[atTop] (fun _ ↦ (1:ℝ)) := by -+ simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, -+ eventually_atTop, E₁p] -+ exact ⟨ log 4 + 4, 1, fun _ ↦ sum_log_prime_div_eq_log ⟩ -+ -+theorem sum_log_prime_div_eq_log'' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p) ~[atTop] (fun x ↦ log x) := by -+ apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log) -+ convert! sum_log_prime_div_eq_log' using 1 -+ -+noncomputable abbrev γ : ℝ := (∫ t in Set.Ioi 2, E₁Λ t / (t * log t^2)) + 1 - log (log 2) -+ -+noncomputable abbrev E₂Λ (x : ℝ) : ℝ := ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x) - γ -+ -+lemma sum_Ioc_one_eq_sum_Icc_zero {f : ℕ → ℝ} {x : ℕ} (hx : 1 ≤ x) (hf1 : f 1 = 0) (hf0 : f 0 = 0) : -+ ∑ n ∈ Ioc 1 x, f n = ∑ n ∈ Icc 0 x, f n := by -+ rw [sum_Ioc_one_eq_sum_Ioc_zero hx hf1, ← add_sum_Ioc_eq_sum_Icc (by linarith)] -+ simpa -+ -+private theorem sum_div_log_eq {x : ℝ} (hx : 2 ≤ x) (f : ℕ → ℝ) : -+ ∑ n ∈ Ioc 1 ⌊ x ⌋₊, f n / log n = -+ (∑ n ∈ Ioc 1 ⌊ x ⌋₊, f n) / log x + ∫ t in 2..x, (∑ n ∈ Ioc 1 ⌊ t ⌋₊, f n) / (t * log t^2) := by -+ let g : ℕ → ℝ := (fun n ↦ if n < 2 then 0 else f n) -+ trans ∑ n ∈ Icc 0 ⌊ x ⌋₊, (log n)⁻¹ * g n -+ · rw [← sum_Ioc_one_eq_sum_Icc_zero (Nat.le_floor (by grind)) (by simp) (by simp)] -+ refine sum_congr rfl fun n hn ↦ ?_ -+ have : ¬(n ≤ 1) := by simp_all -+ simp [g, this] -+ field -+ rw [sum_mul_eq_sub_integral_mul₁ g (f := (fun n ↦ (log n)⁻¹)) (by simp [g]) (by simp [g])] -+ · rw [intervalIntegral.integral_of_le hx, mul_comm, ← div_eq_mul_inv, ← sub_neg_eq_add] -+ simp_rw [deriv_inv_log] -+ congr 1 -+ · rw [← sum_Ioc_one_eq_sum_Icc_zero (Nat.le_floor (by grind)) (by simp [g]) (by simp [g])] -+ congr 1 -+ refine sum_congr rfl fun n hn ↦ ?_ -+ simp only [mem_Ioc] at hn -+ have : ¬(n ≤ 1) := by linarith -+ simp [g, this] -+ · rw [← MeasureTheory.integral_neg] -+ refine MeasureTheory.setIntegral_congr_fun (by measurability) fun t ht ↦ ?_ -+ simp only [Set.mem_Ioc] at ht -+ rw [← sum_Ioc_one_eq_sum_Icc_zero (Nat.le_floor (by grind)) (by simp [g]) (by simp [g])] -+ field_simp -+ congr 2 -+ refine sum_congr rfl fun n hn ↦ ?_ -+ simp only [mem_Ioc] at hn -+ have : ¬(n ≤ 1) := by linarith -+ simp [g, this] -+ · intro t ht -+ simp only [Set.mem_Icc] at ht -+ have : log t ≠ 0 := by simp; grind -+ fun_prop (disch := grind) -+ · refine ContinuousOn.integrableOn_Icc fun t ht ↦ ContinuousAt.continuousWithinAt ?_ -+ simp only [Set.mem_Icc] at ht -+ conv => arg 1; ext x; rw [deriv_inv_log] -+ have : log t ^2 ≠ 0 := by simp; grind -+ fun_prop (disch := grind) -+ -+private theorem integrable_const_div_mul_log_sq {x : ℝ} (c : ℝ) (hx : 2 ≤ x) : -+ MeasureTheory.IntegrableOn (fun x ↦ c / (x * log x ^ 2)) (Set.Ioi x) MeasureTheory.volume := by -+ conv => arg 1; ext t; rw [← mul_one_div] -+ apply MeasureTheory.Integrable.const_mul -+ refine MeasureTheory.integrableOn_Ioi_deriv_of_nonneg' ?_ ?_ tendsto_log_atTop.inv_tendsto_atTop.neg -+ · intro t ht -+ simp only [Set.mem_Ici] at ht -+ have : log t ≠ 0 := by simp; grind -+ have : DifferentiableAt ℝ (fun t ↦ -(log t)⁻¹) t := by -+ fun_prop (disch := grind) -+ convert! this.hasDerivAt using 1 -+ simp [deriv_inv_log] -+ field -+ · intro t ht -+ simp only [Set.mem_Ioi] at ht -+ exact one_div_nonneg.mpr <| mul_nonneg (by linarith) (sq_nonneg _) -+ -+attribute [fun_prop] measurable_from_top -+ -+private theorem integrable_E₁Λ_div_mul_log_sq {x : ℝ} (hx : 2 ≤ x) : -+ MeasureTheory.IntegrableOn (fun x ↦ E₁Λ x / (x * log x ^ 2)) (Set.Ioi x) MeasureTheory.volume := by -+ obtain ⟨c, hc1, hc2⟩ := E₁Λ.bounded' -+ apply MeasureTheory.Integrable.mono (integrable_const_div_mul_log_sq c hx) -+ · exact Measurable.aestronglyMeasurable (by fun_prop) -+ · filter_upwards [MeasureTheory.ae_restrict_mem (by measurability)] with t ht -+ simp only [Set.mem_Ioi] at ht -+ simp only [norm_div, norm_eq_abs, norm_mul, norm_pow, sq_abs, abs_of_pos hc1] -+ gcongr -+ exact hc2 t (by linarith) -+ -+private theorem integrable_E₁p_div_mul_log_sq {x : ℝ} (hx : 2 ≤ x) : -+ MeasureTheory.IntegrableOn (fun x ↦ E₁p x / (x * log x ^ 2)) (Set.Ioi x) MeasureTheory.volume := by -+ obtain ⟨c, hc1, hc2⟩ := E₁p.bounded -+ apply MeasureTheory.Integrable.mono (integrable_const_div_mul_log_sq c hx) -+ · exact Measurable.aestronglyMeasurable (by fun_prop) -+ · filter_upwards [MeasureTheory.ae_restrict_mem (by measurability)] with t ht -+ simp only [Set.mem_Ioi] at ht -+ simp only [norm_div, norm_eq_abs, norm_mul, norm_pow, sq_abs, abs_of_pos hc1] -+ gcongr -+ exact hc2 t (by linarith) -+ -+lemma deriv_log_log {x : ℝ} (hx : 1 < x) : -+ deriv (fun t ↦ log (log t)) x = 1 / (x * log x) := by -+ rw [deriv.log (differentiableAt_log (by linarith)) (by simp; grind), deriv_log] -+ field -+ -+lemma integral_one_div_mul_log {x : ℝ} (hx : 2 ≤ x) : -+ ∫ t in 2..x, 1 / (t * log t) = log (log x) - log (log 2) := by -+ rw [← intervalIntegral.integral_deriv_eq_sub (f := fun t ↦ log (log t))] -+ · refine intervalIntegral.integral_congr fun t ht ↦ ?_ -+ rw [deriv_log_log] -+ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht -+ linarith -+ · intro t ht -+ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht -+ have : log t ≠ 0 := by simp; grind -+ fun_prop (disch := grind) -+ · refine ContinuousOn.intervalIntegrable ?_ -+ apply ContinuousOn.congr (f := (fun t ↦ 1 / (t * log t))) -+ · refine fun t ht ↦ ContinuousAt.continuousWithinAt ?_ -+ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht -+ have : log t ≠ 0 := by simp; grind -+ fun_prop (disch := grind) -+ · intro t ht -+ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht -+ exact deriv_log_log (by linarith) -+ -+lemma intervalIntegrable_one_div_mul_log {x : ℝ} (hx : 2 ≤ x) : -+ IntervalIntegrable (fun t ↦ 1 / (t * log t)) MeasureTheory.volume 2 x := by -+ refine ContinuousOn.intervalIntegrable fun t ht ↦ ContinuousAt.continuousWithinAt ?_ -+ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht -+ have : log t ≠ 0 := by simp; grind -+ fun_prop (disch := grind) -+ -+theorem E₂Λ.eq {x : ℝ} (hx : 2 ≤ x) : -+ E₂Λ x = E₁Λ x / log x - ∫ t in Set.Ioi x, E₁Λ t / (t * log t^2) := by -+ unfold E₂Λ -+ rw [← sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp)] -+ conv => lhs; arg 1; arg 1; arg 2; ext n; rw [(by field : Λ n / (n * log n) = (Λ n / n) / log n)] -+ rw [sum_div_log_eq hx] -+ rw [sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp), sum_mangoldt_div_eq] -+ have : ∫ t in 2..x, (∑ n ∈ Ioc 1 ⌊t⌋₊, Λ n / n) / (t * log t ^ 2) = ∫ t in 2..x, (1 / (t * log t) + E₁Λ t / (t * log t ^ 2)) := by -+ refine intervalIntegral.integral_congr fun t ht ↦ ?_ -+ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht -+ rw [sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp), sum_mangoldt_div_eq] -+ field -+ rw [this, intervalIntegral.integral_add] -+ · rw [integral_one_div_mul_log hx, add_div, div_self (by simp; grind)] -+ unfold γ -+ calc -+ _ = E₁Λ x / log x + (∫ (x : ℝ) in 2..x, E₁Λ x / (x * log x ^ 2)) - -+ ((∫ (t : ℝ) in Set.Ioi 2, E₁Λ t / (t * log t ^ 2))) := by ring -+ _ = _ := by -+ rw [← intervalIntegral.integral_interval_add_Ioi (integrable_E₁Λ_div_mul_log_sq (by rfl)) (integrable_E₁Λ_div_mul_log_sq hx)] -+ ring -+ · exact intervalIntegrable_one_div_mul_log hx -+ · rw [intervalIntegrable_iff, Set.uIoc_of_le hx] -+ exact integrable_E₁Λ_div_mul_log_sq (x := 2) (by rfl)|>.mono (by grind) (by rfl) -+ -+private theorem integ_div_mul_log_sq {x : ℝ} (c : ℝ) (hx : 2 ≤ x) : -+ ∫ t in Set.Ioi x, c / (t * log t^2) = c / log x := by -+ convert! MeasureTheory.integral_Ioi_of_hasDerivAt_of_tendsto' (m := 0) (f := fun x ↦ - c / log x) ?_ -+ (integrable_const_div_mul_log_sq c hx) ?_ using 1 -+ · grind -+ · intro t ht; simp at ht -+ convert! HasDerivAt.fun_div (hasDerivAt_const _ (-c)) (hasDerivAt_log (by linarith)) ?_ using 1 -+ · grind -+ simp; grind -+ convert! tendsto_log_atTop.inv_tendsto_atTop.const_mul (-c) using 1 -+ simp -+ -+theorem E₂Λ.abs_le {x : ℝ} (hx : 2 ≤ x) : -+ |E₂Λ x| ≤ (log 4 + 6) / log x := by -+ have : 0 < log x := by apply log_pos; linarith -+ rw [E₂Λ.eq hx, abs_le'] -+ constructor -+ · grw [E₁Λ.le (by linarith)] -+ have : ∫ t in Set.Ioi x, E₁Λ t / (t * log t^2) ≥ - 2 / log x := calc -+ _ ≥ ∫ t in Set.Ioi x, (-2) / (t * log t^2) := by -+ apply MeasureTheory.setIntegral_mono_on (integrable_const_div_mul_log_sq (-2) hx) -+ (integrable_E₁Λ_div_mul_log_sq hx) (by measurability) -+ intro y hy; simp at hy -+ have : 1 < y := by linarith -+ have : 0 < log y := log_pos this -+ gcongr; exact E₁Λ.ge (by linarith) -+ _ = _ := integ_div_mul_log_sq (-2) hx -+ grw [this] -+ grind -+ grw [E₁Λ.ge (by linarith)] -+ have : ∫ t in Set.Ioi x, E₁Λ t / (t * log t^2) ≤ (log 4 + 4) / log x := calc -+ _ ≤ ∫ t in Set.Ioi x, (log 4 + 4) / (t * log t^2) := by -+ apply MeasureTheory.setIntegral_mono_on (integrable_E₁Λ_div_mul_log_sq hx) -+ (integrable_const_div_mul_log_sq (log 4 + 4) hx) (by measurability) -+ intro y hy; simp at hy -+ have : 1 < y := by linarith -+ have : 0 < log y := log_pos this -+ gcongr; exact E₁Λ.le (by linarith) -+ _ = _ := integ_div_mul_log_sq (log 4 + 4) hx -+ grw [this] -+ grind -+ -+theorem E₂Λ.bound : E₂Λ =O[atTop] (fun x ↦ 1 / log x) := by -+ simp only [one_div, isBigO_iff, norm_eq_abs, norm_inv, eventually_atTop] -+ use log 4 + 6, 2 -+ intro x hx -+ convert E₂Λ.abs_le hx using 1 -+ have : 0 < log x := by apply log_pos; linarith -+ grind [abs_of_pos this] -+ -+theorem E₂Λ.bound' : E₂Λ =o[atTop] (fun _ ↦ (1:ℝ)) := E₂Λ.bound.trans_isLittleO inv_log_eq_o_one -+ -+theorem log_zeta_eq_sum (s : ℝ) (hs : 1 < s) : -+ log (riemannZeta (s:ℂ)).re = ∑' n, Λ n / (n^s * log n) := by -+ have hsc : (1 : ℝ) < ((s : ℂ)).re := by simpa using hs -+ -+ have hep := riemannZeta_eulerProduct_exp_log (s := (s : ℂ)) hsc -+ set S : ℂ := ∑' p : Nat.Primes, -Complex.log (1 - (p : ℂ) ^ (-(s : ℂ))) with hS -+ -+ have hcpow : ∀ p : Nat.Primes, (p : ℂ) ^ (-(s : ℂ)) = (((p : ℝ) ^ (-s) : ℝ) : ℂ) := by -+ intro p -+ rw [Complex.ofReal_cpow (by positivity)] -+ push_cast; ring_nf -+ -+ set z : Nat.Primes → ℝ := fun p => (p : ℝ) ^ (-s) with hz -+ -+ have hz_pos : ∀ p : Nat.Primes, 0 < z p := fun p => by -+ have : (0 : ℝ) < (p : ℝ) := by exact_mod_cast p.prop.pos -+ positivity -+ have hz_lt_one : ∀ p : Nat.Primes, z p < 1 := by -+ intro p -+ have hp1 : (1 : ℝ) < (p : ℝ) := by exact_mod_cast p.prop.one_lt -+ change (p : ℝ) ^ (-s) < 1 -+ rw [Real.rpow_neg (by positivity), inv_lt_one_iff₀] -+ right -+ exact (Real.one_lt_rpow_iff_of_pos (by positivity)).mpr (Or.inl ⟨hp1, by linarith⟩) -+ -+ have hterm : ∀ p : Nat.Primes, -+ -Complex.log (1 - (p : ℂ) ^ (-(s : ℂ))) = ((-Real.log (1 - z p) : ℝ) : ℂ) := by -+ intro p -+ rw [hcpow p] -+ have h1z : (0 : ℝ) < 1 - z p := by have := hz_lt_one p; linarith -+ rw [show (1 : ℂ) - ((z p : ℝ) : ℂ) = (((1 - z p : ℝ)) : ℂ) by push_cast; ring] -+ rw [← Complex.ofReal_log h1z.le] -+ push_cast; ring -+ -+ set Sr : ℝ := ∑' p : Nat.Primes, -Real.log (1 - z p) with hSr -+ have hSeq : S = (Sr : ℂ) := by -+ rw [hS, hSr, Complex.ofReal_tsum] -+ exact tsum_congr hterm -+ have hSim : S.im = 0 := by rw [hSeq]; exact Complex.ofReal_im _ -+ have hSre : S.re = Sr := by rw [hSeq]; exact Complex.ofReal_re _ -+ -+ have hlog_zeta : Complex.log (riemannZeta (s : ℂ)) = S := by -+ rw [← hep, Complex.log_exp (by rw [hSim]; exact neg_lt_zero.mpr Real.pi_pos) -+ (by rw [hSim]; exact Real.pi_pos.le)] -+ -+ have hkey : Real.log (riemannZeta (s : ℂ)).re = Sr := by -+ have hζim : (riemannZeta (s : ℂ)).im = 0 := riemannZeta_im_eq_zero_of_one_lt hs -+ have hζeq : riemannZeta (s : ℂ) = ((riemannZeta (s : ℂ)).re : ℂ) := by -+ apply Complex.ext <;> simp [hζim] -+ have : Real.log (riemannZeta (s : ℂ)).re -+ = (Complex.log (riemannZeta (s : ℂ))).re := by -+ conv_rhs => rw [hζeq] -+ rw [Complex.log_ofReal_re] -+ rw [this, hlog_zeta, hSre] -+ rw [hkey] -+ -+ have habs : ∀ p : Nat.Primes, |z p| < 1 := by -+ intro p -+ rw [abs_of_pos (hz_pos p)]; exact hz_lt_one p -+ have htaylor : ∀ p : Nat.Primes, -+ HasSum (fun n : ℕ => (z p) ^ (n + 1) / (n + 1)) (-Real.log (1 - z p)) := -+ fun p => hasSum_pow_div_log_of_abs_lt_one (habs p) -+ have hSr_double : Sr = ∑' (p : Nat.Primes) (n : ℕ), (z p) ^ (n + 1) / (n + 1) := by -+ rw [hSr] -+ exact tsum_congr fun p => ((htaylor p).tsum_eq).symm -+ -+ have hsummable_z : Summable z := Nat.Primes.summable_rpow.mpr (by linarith) -+ -+ have hsummable_prime : Summable (fun p : Nat.Primes => -Real.log (1 - z p)) := by -+ have := Real.summable_log_one_add_of_summable hsummable_z.neg -+ convert! this.neg using 1 -+ -+ have hg_nonneg : ∀ pk : Nat.Primes × ℕ, 0 ≤ (z pk.1) ^ (pk.2 + 1) / (pk.2 + 1) := by -+ intro pk; positivity [hz_pos pk.1] -+ have hsummable_g : Summable (fun pk : Nat.Primes × ℕ => (z pk.1) ^ (pk.2 + 1) / (pk.2 + 1)) := by -+ rw [summable_prod_of_nonneg hg_nonneg] -+ refine ⟨fun p => (htaylor p).summable, ?_⟩ -+ refine hsummable_prime.congr (fun p => ?_) -+ exact ((htaylor p).tsum_eq).symm -+ -+ have hpoint : ∀ (p : Nat.Primes) (n : ℕ), -+ Λ ((p : ℕ) ^ (n + 1)) / -+ ((((p : ℕ) ^ (n + 1) : ℕ) : ℝ) ^ s * Real.log (((p : ℕ) ^ (n + 1) : ℕ) : ℝ)) -+ = (z p) ^ (n + 1) / (n + 1) := by -+ intro p n -+ have hp1 : (1 : ℝ) < (p : ℝ) := by exact_mod_cast p.prop.one_lt -+ have hlogp : 0 < Real.log (p : ℝ) := Real.log_pos hp1 -+ rw [vonMangoldt_apply_pow (Nat.succ_ne_zero n), vonMangoldt_apply_prime p.prop] -+ have hcast : (((p : ℕ) ^ (n + 1) : ℕ) : ℝ) = (p : ℝ) ^ (n + 1) := by push_cast; ring -+ rw [hcast, Real.log_pow] -+ rw [show (z p) ^ (n + 1) = ((p : ℝ) ^ (n + 1)) ^ (-s) by -+ rw [hz]; rw [← Real.rpow_natCast ((p : ℝ) ^ (-s)) (n + 1), -+ ← Real.rpow_natCast ((p : ℝ)) (n + 1), ← Real.rpow_mul (by positivity), -+ ← Real.rpow_mul (by positivity)]; ring_nf] -+ rw [Real.rpow_neg (by positivity)] -+ field_simp -+ push_cast -+ ring -+ -+ set F : ℕ → ℝ := fun n => Λ n / ((n : ℝ) ^ s * Real.log n) with hF -+ -+ have hsupp : Function.support F ⊆ {n : ℕ | IsPrimePow n} := by -+ intro n hn -+ rw [Function.mem_support] at hn -+ simp only [Set.mem_ofPred_eq] -+ by_contra hpp -+ apply hn -+ simp only [hF, vonMangoldt_eq_zero_iff.mpr hpp, zero_div] -+ -+ have hprod_eq : (∑' pk : Nat.Primes × ℕ, (z pk.1) ^ (pk.2 + 1) / (pk.2 + 1)) -+ = ∑' m : {n : ℕ // IsPrimePow n}, F m.val := by -+ rw [← Equiv.tsum_eq Nat.Primes.prodNatEquiv (fun m : {n : ℕ // IsPrimePow n} => F m.val)] -+ apply tsum_congr -+ intro pk -+ rw [Nat.Primes.coe_prodNatEquiv_apply, hF] -+ exact (hpoint pk.1 pk.2).symm -+ -+ rw [hSr_double, ← hsummable_g.tsum_prod' (fun p => (htaylor p).summable), hprod_eq] -+ exact tsum_subtype_eq_of_support_subset hsupp -+ -+section -+open MeasureTheory Set -+ -+namespace LogZetaInteg -+ -+private noncomputable def c (d : ℕ) : ℝ := Λ d / (d * Real.log d) -+ -+private noncomputable def f (s : ℝ) (d : ℕ) (x : ℝ) : ℝ := -+ c d * (Set.Ici (d:ℝ)).indicator (fun x => x ^ (-s)) x -+ -+@[simp] private lemma c_zero : c 0 = 0 := by simp [c] -+@[simp] private lemma c_one : c 1 = 0 := by simp [c, vonMangoldt_apply_one] -+ -+private lemma c_nonneg (d : ℕ) : 0 ≤ c d := by -+ unfold c -+ rcases Nat.eq_zero_or_pos d with hd | hd -+ · subst hd; simp -+ · apply div_nonneg vonMangoldt_nonneg -+ have : (0:ℝ) ≤ (d:ℝ) := Nat.cast_nonneg d -+ have hlog : 0 ≤ Real.log d := Real.log_natCast_nonneg d -+ positivity -+ -+private lemma summable_log_rpow_div_rpow (a : ℝ) {s : ℝ} (hs : 1 < s) : -+ Summable (fun n : ℕ => (Real.log n) ^ a / (n:ℝ) ^ s) := by -+ have hε : (0:ℝ) < (s - 1) / 2 := by linarith -+ refine summable_of_isBigO_nat (g := fun n : ℕ => (n:ℝ) ^ ((s - 1) / 2 - s)) ?_ ?_ -+ · rw [Real.summable_nat_rpow]; linarith -+ · have ho : (fun x : ℝ => (Real.log x) ^ a) =O[atTop] (fun x : ℝ => x ^ ((s - 1) / 2)) := -+ (isLittleO_log_rpow_rpow_atTop a hε).isBigO -+ have hmul : (fun x : ℝ => (Real.log x) ^ a / x ^ s) -+ =O[atTop] (fun x : ℝ => x ^ ((s - 1) / 2) / x ^ s) := by -+ simpa only [div_eq_mul_inv] using ho.mul (isBigO_refl (fun x : ℝ => (x ^ s)⁻¹) atTop) -+ have heq : (fun x : ℝ => x ^ ((s - 1) / 2) / x ^ s) -+ =ᶠ[atTop] (fun x : ℝ => x ^ ((s - 1) / 2 - s)) := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ rw [← Real.rpow_sub hx] -+ exact (hmul.trans_eventuallyEq heq).natCast_atTop -+ -+private lemma summable_vonMangoldt_div_rpow (s : ℝ) (hs : 1 < s) : -+ Summable (fun n : ℕ => (Λ n : ℝ) / (n:ℝ) ^ s) := by -+ refine Summable.of_nonneg_of_le (fun n => div_nonneg vonMangoldt_nonneg (by positivity)) ?_ -+ (summable_log_rpow_div_rpow 1 hs) -+ intro n -+ rw [Real.rpow_one] -+ gcongr -+ exact vonMangoldt_le_log -+ -+private lemma summable_c_term (s : ℝ) (hs : 1 < s) : -+ Summable (fun d : ℕ => c d * ((d:ℝ) ^ (1 - s) / (s - 1))) := by -+ have hs1 : (0:ℝ) < s - 1 := by linarith -+ have hlog2 : (0:ℝ) < Real.log 2 := Real.log_pos (by norm_num) -+ -+ refine Summable.of_nonneg_of_le (fun d => ?_) (fun d => ?_) -+ ((summable_vonMangoldt_div_rpow s hs).mul_left (1 / (Real.log 2 * (s - 1)))) -+ · -+ refine mul_nonneg (c_nonneg d) (div_nonneg ?_ hs1.le) -+ rcases eq_or_ne (d:ℝ) 0 with hd | hd -+ · rw [hd, Real.zero_rpow (by linarith : (1 - s) ≠ 0)] -+ · positivity -+ · -+ rcases lt_or_ge d 2 with hd | hd -+ · have hc : c d = 0 := by interval_cases d <;> simp -+ rw [hc, zero_mul] -+ exact mul_nonneg (by positivity) (div_nonneg vonMangoldt_nonneg (by positivity)) -+ · have hd2 : (2:ℝ) ≤ (d:ℝ) := by exact_mod_cast hd -+ have hd0 : (0:ℝ) < (d:ℝ) := by linarith -+ have hlogge : Real.log 2 ≤ Real.log d := Real.log_le_log (by norm_num) hd2 -+ have hds : (0:ℝ) < (d:ℝ) ^ s := Real.rpow_pos_of_pos hd0 s -+ have hkey : c d * ((d:ℝ) ^ (1 - s) / (s - 1)) = Λ d / ((d:ℝ) ^ s * Real.log d * (s - 1)) := by -+ unfold c -+ rw [show (1 - s : ℝ) = -s + 1 by ring, Real.rpow_add hd0, Real.rpow_one, Real.rpow_neg hd0.le] -+ field_simp -+ -+ have hcb : (d:ℝ) ^ s * Real.log 2 * (s - 1) ≤ (d:ℝ) ^ s * Real.log d * (s - 1) := -+ mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hlogge hds.le) hs1.le -+ rw [hkey, show (1 / (Real.log 2 * (s - 1))) * ((Λ d : ℝ) / (d:ℝ) ^ s) -+ = Λ d / ((d:ℝ) ^ s * Real.log 2 * (s - 1)) from by field_simp] -+ exact div_le_div_of_nonneg_left vonMangoldt_nonneg (by positivity) hcb -+ -+theorem log_zeta_eq_integ_aux (s : ℝ) (hs : 1 < s) : -+ Real.log (riemannZeta (s:ℂ)).re = -+ (s - 1) * ∫ x in Set.Ioi 1, (Real.log (Real.log x) + γ + E₂Λ x) * x ^ (-s) := by -+ rw [Mertens.log_zeta_eq_sum s hs] -+ symm -+ have hstep1 : ∀ x ∈ Set.Ioi (1:ℝ), -+ (Real.log (Real.log x) + γ + E₂Λ x) * x ^ (-s) -+ = (∑ d ∈ Finset.Ioc 0 ⌊x⌋₊, c d) * x ^ (-s) := by -+ intro x hx -+ simp only [Mertens.E₂Λ, c] -+ ring -+ have hstep2 : ∀ x ∈ Set.Ioi (1:ℝ), -+ (Real.log (Real.log x) + γ + E₂Λ x) * x ^ (-s) = ∑' d : ℕ, f s d x := by -+ intro x hx -+ rw [hstep1 x hx] -+ simp only [f] -+ rw [Finset.sum_mul] -+ have hx0 : (0:ℝ) ≤ x := by have := hx; simp only [Set.mem_Ioi] at this; linarith -+ rw [tsum_eq_sum (s := Finset.Ioc 0 ⌊x⌋₊) ?_] -+ · apply Finset.sum_congr rfl -+ intro d hd -+ simp only [Finset.mem_Ioc] at hd -+ have hdx : (d:ℝ) ≤ x := by -+ rw [← Nat.le_floor_iff hx0]; exact hd.2 -+ rw [Set.indicator_of_mem (by simpa using hdx)] -+ · intro d hd -+ simp only [Finset.mem_Ioc, not_and, not_le] at hd -+ rcases Nat.eq_zero_or_pos d with hd0 | hd0 -+ · subst hd0; simp -+ · have hfloor : ⌊x⌋₊ < d := hd hd0 -+ have hdx : x < (d:ℝ) := by -+ rw [← Nat.floor_lt hx0]; exact hfloor -+ rw [Set.indicator_of_notMem (by simpa using not_le.mpr hdx)] -+ ring -+ rw [MeasureTheory.setIntegral_congr_fun measurableSet_Ioi hstep2] -+ have hperterm : ∀ d : ℕ, ∫ x in Set.Ioi (1:ℝ), f s d x = c d * ((d:ℝ) ^ (1 - s) / (s - 1)) := by -+ intro d -+ rcases Nat.eq_zero_or_pos d with hd0 | hd0 -+ · subst hd0; simp [f] -+ simp only [f] -+ rw [MeasureTheory.integral_const_mul, MeasureTheory.setIntegral_indicator measurableSet_Ici] -+ congr 1 -+ have hdR : (1:ℝ) ≤ (d:ℝ) := by exact_mod_cast hd0 -+ have hdR0 : (0:ℝ) < (d:ℝ) := by exact_mod_cast hd0 -+ set A : Set ℝ := Set.Ioi (1:ℝ) ∩ Set.Ici (d:ℝ) with hA -+ have hae : A =ᵐ[volume] Set.Ioi (d:ℝ) := by -+ have h1 : A =ᵐ[volume] (Set.Ici (1:ℝ) ∩ Set.Ici (d:ℝ) : Set ℝ) := -+ MeasureTheory.ae_eq_set_inter MeasureTheory.Ioi_ae_eq_Ici (ae_eq_refl _) -+ rw [Set.Ici_inter_Ici, max_eq_right hdR] at h1 -+ exact h1.trans MeasureTheory.Ioi_ae_eq_Ici.symm -+ rw [MeasureTheory.setIntegral_congr_set hae] -+ rw [integral_Ioi_rpow_of_lt (by linarith : (-s:ℝ) < -1) hdR0, -+ show (-s + 1 : ℝ) = 1 - s by ring] -+ have hs1 : (1 - s) ≠ 0 := by linarith -+ have hs2 : (s - 1) ≠ 0 := by linarith -+ field_simp -+ ring -+ have hint : ∀ d : ℕ, MeasureTheory.IntegrableOn (f s d) (Set.Ioi (1:ℝ)) := by -+ intro d -+ unfold f -+ apply MeasureTheory.Integrable.const_mul -+ rw [show MeasureTheory.Integrable ((Set.Ici (d:ℝ)).indicator fun x => x ^ (-s)) -+ (volume.restrict (Set.Ioi (1:ℝ))) -+ ↔ MeasureTheory.IntegrableOn ((Set.Ici (d:ℝ)).indicator fun x => x ^ (-s)) -+ (Set.Ioi (1:ℝ)) volume from Iff.rfl, -+ MeasureTheory.integrableOn_indicator_iff measurableSet_Ici] -+ apply MeasureTheory.IntegrableOn.mono_set -+ (integrableOn_Ioi_rpow_of_lt (by linarith : (-s:ℝ) < -1) (by norm_num : (0:ℝ) < 1/2)) -+ intro x hx -+ simp only [Set.mem_inter_iff, Set.mem_Ici, Set.mem_Ioi] at hx ⊢ -+ linarith [hx.2] -+ have hnorm_int : ∀ d : ℕ, -+ ∫ x in Set.Ioi (1:ℝ), ‖f s d x‖ = c d * ((d:ℝ) ^ (1 - s) / (s - 1)) := by -+ intro d -+ rw [← hperterm d] -+ apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioi -+ intro x hx -+ simp only [Set.mem_Ioi] at hx -+ have hfnn : 0 ≤ f s d x := by -+ simp only [f] -+ apply mul_nonneg (c_nonneg d) -+ by_cases hxd : (d:ℝ) ≤ x -+ · rw [Set.indicator_of_mem (by simpa using hxd)] -+ exact le_of_lt (Real.rpow_pos_of_pos (by linarith) _) -+ · rw [Set.indicator_of_notMem (by simpa using hxd)] -+ change ‖f s d x‖ = f s d x -+ rw [Real.norm_eq_abs, abs_of_nonneg hfnn] -+ have hinterchange : ∫ x in Set.Ioi (1:ℝ), ∑' d : ℕ, f s d x -+ = ∑' d : ℕ, ∫ x in Set.Ioi (1:ℝ), f s d x := by -+ refine (MeasureTheory.integral_tsum_of_summable_integral_norm hint ?_).symm -+ apply (summable_c_term s hs).congr -+ intro d -+ exact (hnorm_int d).symm -+ rw [hinterchange] -+ simp_rw [hperterm] -+ rw [← tsum_mul_left] -+ apply tsum_congr -+ intro d -+ rcases Nat.eq_zero_or_pos d with hd0 | hd0 -+ · subst hd0; simp -+ · have hdR : (0:ℝ) < (d:ℝ) := by exact_mod_cast hd0 -+ have hsub : (d:ℝ) ^ (1 - s) = (d:ℝ) ^ (-s) * (d:ℝ) := by -+ rw [show (1 - s : ℝ) = -s + 1 by ring, Real.rpow_add hdR, Real.rpow_one] -+ have hs1 : s - 1 ≠ 0 := by linarith -+ have hneg : (d:ℝ) ^ (-s) = ((d:ℝ) ^ s)⁻¹ := by -+ rw [Real.rpow_neg (le_of_lt hdR)] -+ unfold c -+ rw [hsub, hneg] -+ field_simp -+ -+end LogZetaInteg -+end -+ -+private theorem log_zeta_eq_integ (s : ℝ) (hs : 1 < s) : -+ log (riemannZeta (s:ℂ)).re = (s - 1) * ∫ x in .Ioi 1, (log (log x) + γ + E₂Λ x) * x^(-s) := -+ LogZetaInteg.log_zeta_eq_integ_aux s hs -+ -+private theorem mul_integ_log_log_eq (s : ℝ) (hs : 1 < s) : -+ (s - 1) * ∫ x in .Ioi 1, log (log x) * x^(-s) = - log (s - 1) + deriv Gamma 1 := -+ mul_integ_log_log_eq_aux s hs -+ -+private theorem mul_integ_gamma_eq (s) (hs : 1 < s) : (s - 1) * ∫ x in .Ioi 1, γ * x^(-s) = γ := by -+ rw [MeasureTheory.integral_const_mul γ (· ^ (-s)), @integral_Ioi_rpow_of_lt (-s), one_rpow] <;> -+ grind -+ -+private theorem integrableOn_Ioi_mul_rpow_neg_of_abs_le -+ {c B a s : ℝ} (hc : 0 < c) (has : a + 1 < s) {f : ℝ → ℝ} (hf : Measurable f) -+ (hbound : ∀ x ∈ Set.Ioi c, |f x| ≤ B * x ^ a) : -+ MeasureTheory.IntegrableOn (fun x => f x * x ^ (-s)) (Set.Ioi c) := by -+ have hg : MeasureTheory.IntegrableOn (fun x => B * x ^ (a - s)) (Set.Ioi c) := -+ (integrableOn_Ioi_rpow_of_lt (by linarith : a - s < -1) hc).const_mul B -+ refine MeasureTheory.Integrable.mono' hg -+ (hf.mul (measurable_id.pow_const (-s))).aestronglyMeasurable ?_ -+ filter_upwards [MeasureTheory.ae_restrict_mem measurableSet_Ioi] with x hx -+ have hxpos : (0:ℝ) < x := hc.trans hx -+ have hxs : (0:ℝ) < x ^ (-s) := Real.rpow_pos_of_pos hxpos _ -+ rw [norm_mul, norm_eq_abs, norm_eq_abs, abs_of_pos hxs] -+ calc |f x| * x ^ (-s) ≤ B * x ^ a * x ^ (-s) := -+ mul_le_mul_of_nonneg_right (hbound x hx) hxs.le -+ _ = B * x ^ (a - s) := by rw [mul_assoc, ← Real.rpow_add hxpos, sub_eq_add_neg] -+ -+private theorem integrableOn_log_log_mul_rpow (s : ℝ) (hs : 1 < s) : -+ MeasureTheory.IntegrableOn (fun x => log (log x) * x ^ (-s)) (Set.Ioi 1) := by -+ rw [← Set.Ioc_union_Ioi_eq_Ioi (by norm_num : (1:ℝ) ≤ 2)] -+ apply MeasureTheory.IntegrableOn.union -+ · -+ have hll : MeasureTheory.IntegrableOn (fun x => log (log x)) (Set.Ioc 1 2) := by -+ have h : IntervalIntegrable (log ∘ log) MeasureTheory.volume 1 2 := by -+ apply MeromorphicOn.intervalIntegrable_log -+ intro x hx -+ rw [Set.uIcc_of_le (by norm_num : (1:ℝ) ≤ 2)] at hx -+ exact (analyticAt_log (by linarith [hx.1] : 0 < x)).meromorphicAt -+ exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (by norm_num)).mp h -+ have hmul : MeasureTheory.IntegrableOn (fun x => x ^ (-s) * log (log x)) (Set.Ioc 1 2) := by -+ apply hll.bdd_mul (c := 1) -+ · fun_prop -+ · filter_upwards [MeasureTheory.ae_restrict_mem measurableSet_Ioc] with x hx -+ rw [norm_eq_abs, abs_of_nonneg (Real.rpow_nonneg (by linarith [hx.1] : (0:ℝ) ≤ x) _)] -+ calc x ^ (-s) ≤ (1:ℝ) ^ (-s) := -+ Real.rpow_le_rpow_of_nonpos (by norm_num) hx.1.le (by linarith) -+ _ = 1 := Real.one_rpow _ -+ simpa [mul_comm] using hmul -+ · -+ set ε := (s - 1) / 2 with hε -+ have hεpos : 0 < ε := by rw [hε]; linarith -+ refine integrableOn_Ioi_mul_rpow_neg_of_abs_le (a := ε) (B := 1 / ε + |log (log 2)|) -+ (by norm_num) (by rw [hε]; linarith) (Real.measurable_log.comp Real.measurable_log) ?_ -+ intro x hx -+ simp only [Set.mem_Ioi] at hx -+ have hx1 : (1:ℝ) ≤ x ^ ε := Real.one_le_rpow (by linarith) hεpos.le -+ have hlogx : 0 < log x := Real.log_pos (by linarith) -+ have hlog2 : 0 < log 2 := Real.log_pos (by norm_num) -+ have hmono : log 2 ≤ log x := Real.log_le_log (by norm_num) (by linarith) -+ have hub : log (log x) ≤ x ^ ε / ε := -+ calc log (log x) ≤ log x := (Real.log_le_sub_one_of_pos hlogx).trans (by linarith) -+ _ ≤ x ^ ε / ε := Real.log_le_rpow_div (by linarith) hεpos -+ have hlb : log (log 2) ≤ log (log x) := Real.log_le_log hlog2 hmono -+ have hxε : 0 ≤ x ^ ε / ε := by positivity -+ calc |log (log x)| ≤ x ^ ε / ε + |log (log 2)| := by -+ rw [abs_le] -+ exact ⟨by linarith [neg_abs_le (log (log 2))], -+ by linarith [abs_nonneg (log (log 2))]⟩ -+ _ ≤ (1 / ε + |log (log 2)|) * x ^ ε := by -+ have h2 : |log (log 2)| ≤ |log (log 2)| * x ^ ε := le_mul_of_one_le_right (abs_nonneg _) hx1 -+ have h1 : x ^ ε / ε = 1 / ε * x ^ ε := by ring -+ rw [add_mul]; linarith -+ -+private theorem integrableOn_γ_mul_rpow (s : ℝ) (hs : 1 < s) : -+ MeasureTheory.IntegrableOn (fun x => γ * x ^ (-s)) (Set.Ioi 1) := by -+ exact (integrableOn_Ioi_rpow_of_lt (by linarith : -s < -1) one_pos).const_mul γ -+ -+private theorem integrableOn_E₂Λ_mul_rpow (s : ℝ) (hs : 1 < s) : -+ MeasureTheory.IntegrableOn (fun x => E₂Λ x * x ^ (-s)) (Set.Ioi 1) := by -+ rw [← Set.Ioo_union_Ici_eq_Ioi (by norm_num : (1:ℝ) < 2)] -+ apply MeasureTheory.IntegrableOn.union -+ · -+ have hsub : Set.Ioo (1:ℝ) 2 ⊆ Set.Ioi 1 := fun x hx => hx.1 -+ have h1 := (integrableOn_γ_mul_rpow s hs).mono_set hsub -+ have h2 := (integrableOn_log_log_mul_rpow s hs).mono_set hsub -+ have hb : MeasureTheory.IntegrableOn -+ (fun x => -(log (log x) * x ^ (-s)) - γ * x ^ (-s)) (Set.Ioo 1 2) := -+ h2.neg.sub h1 -+ apply hb.congr_fun _ measurableSet_Ioo -+ intro x hx -+ simp only [Set.mem_Ioo] at hx -+ have hfloor : ⌊ x ⌋₊ = 1 := by -+ rw [Nat.floor_eq_iff (by linarith)] -+ exact ⟨by push_cast; linarith [hx.1], by push_cast; linarith [hx.2]⟩ -+ have hsum : (∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / ((d:ℝ) * log d)) = 0 := by rw [hfloor]; norm_num -+ change -(log (log x) * x ^ (-s)) - γ * x ^ (-s) -+ = (∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x) - γ) * x ^ (-s) -+ rw [hsum]; ring -+ · -+ rw [integrableOn_Ici_iff_integrableOn_Ioi] -+ refine integrableOn_Ioi_mul_rpow_neg_of_abs_le (a := 0) (B := (log 4 + 6) / log 2) -+ (by norm_num) (by linarith) (by fun_prop) ?_ -+ intro x hx -+ simp only [Set.mem_Ioi] at hx -+ have hlog2 : 0 < log 2 := Real.log_pos (by norm_num) -+ have hc : 0 ≤ log 4 + 6 := by positivity -+ rw [Real.rpow_zero, mul_one] -+ have hb2 : (log 4 + 6) / log x ≤ (log 4 + 6) / log 2 := -+ div_le_div_of_nonneg_left hc hlog2 (Real.log_le_log (by norm_num) (le_of_lt hx)) -+ exact (E₂Λ.abs_le (le_of_lt hx)).trans hb2 -+ -+private theorem log_zeta_eq (s : ℝ) (hs : 1 < s) : -+ log (riemannZeta (s:ℂ)).re = - log (s - 1) + deriv Gamma 1 + γ + (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x^(-s) := by -+ -+ rw [log_zeta_eq_integ s hs] -+ -+ have key : (∫ x in Set.Ioi 1, (log (log x) + γ + E₂Λ x) * x ^ (-s)) -+ = (∫ x in Set.Ioi 1, log (log x) * x ^ (-s)) -+ + (∫ x in Set.Ioi 1, γ * x ^ (-s)) -+ + (∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)) := by -+ rw [← MeasureTheory.integral_add (integrableOn_log_log_mul_rpow s hs) -+ (integrableOn_γ_mul_rpow s hs)] -+ rw [← MeasureTheory.integral_add (f := fun x => log (log x) * x ^ (-s) + γ * x ^ (-s)) -+ (g := fun x => E₂Λ x * x ^ (-s)) -+ ((integrableOn_log_log_mul_rpow s hs).add (integrableOn_γ_mul_rpow s hs)) -+ (integrableOn_E₂Λ_mul_rpow s hs)] -+ apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioi -+ intro x _ -+ ring -+ -+ rw [key, mul_add, mul_add, mul_integ_log_log_eq s hs, mul_integ_gamma_eq s hs] -+ -+private lemma zeta_pole_mul_re_tendsto_one : -+ Filter.Tendsto (fun s : ℝ => (s - 1) * (riemannZeta (s : ℂ)).re) -+ (nhdsWithin 1 (Set.Ioi 1)) (nhds 1) := by -+ have hofReal : -+ Filter.Tendsto (fun s : ℝ => (s : ℂ)) (nhdsWithin 1 (Set.Ioi 1)) -+ (nhdsWithin (1 : ℂ) ({1} : Set ℂ)ᶜ) := by -+ refine tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ ?_ ?_ -+ · exact (Complex.continuous_ofReal.tendsto 1).mono_left nhdsWithin_le_nhds -+ · filter_upwards [self_mem_nhdsWithin] with s hs -+ exact Set.mem_compl_singleton_iff.mpr (by -+ norm_num -+ exact ne_of_gt (Set.mem_Ioi.mp hs)) -+ have hcomplex : -+ Filter.Tendsto (fun s : ℝ => ((s : ℂ) - 1) * riemannZeta (s : ℂ)) -+ (nhdsWithin 1 (Set.Ioi 1)) (nhds 1) := -+ riemannZeta_residue_one.comp hofReal -+ have hreal : -+ Filter.Tendsto -+ (fun s : ℝ => (((s : ℂ) - 1) * riemannZeta (s : ℂ)).re) -+ (nhdsWithin 1 (Set.Ioi 1)) (nhds (1 : ℝ)) := -+ (Complex.continuous_re.tendsto (1 : ℂ)).comp hcomplex -+ simpa [Complex.ofReal_sub, Complex.ofReal_mul] using hreal -+ -+private theorem log_zeta_limit : -+ Filter.Tendsto -+ (fun s : ℝ => Real.log (riemannZeta (s : ℂ)).re + Real.log (s - 1)) -+ (nhdsWithin 1 (Set.Ioi 1)) (nhds 0) := by -+ have hlog : -+ Filter.Tendsto -+ (fun s : ℝ => Real.log ((s - 1) * (riemannZeta (s : ℂ)).re)) -+ (nhdsWithin 1 (Set.Ioi 1)) (nhds (Real.log 1)) := -+ (Real.continuousAt_log (by norm_num : (1 : ℝ) ≠ 0)).tendsto.comp -+ zeta_pole_mul_re_tendsto_one -+ have hEq : -+ (fun s : ℝ => Real.log (riemannZeta (s : ℂ)).re + Real.log (s - 1)) -+ =ᶠ[nhdsWithin 1 (Set.Ioi 1)] -+ fun s : ℝ => Real.log ((s - 1) * (riemannZeta (s : ℂ)).re) := by -+ filter_upwards [self_mem_nhdsWithin] with s hs -+ have hspos : 0 < s - 1 := sub_pos.mpr (Set.mem_Ioi.mp hs) -+ have hzpos : 0 < (riemannZeta (s : ℂ)).re := -+ riemannZeta_re_pos_of_one_lt (Set.mem_Ioi.mp hs) -+ rw [Real.log_mul hspos.ne' hzpos.ne'] -+ ring -+ simpa using hlog.congr' (hEq.mono fun s hs => hs.symm) -+ -+section -+open MeasureTheory Set -+ -+private lemma measurable_E₂Λ : Measurable E₂Λ := by fun_prop -+ -+private lemma E₂Λ_eq_on_Ioo {x : ℝ} (hx : x ∈ Set.Ioo (1 : ℝ) 2) : -+ E₂Λ x = - log (log x) - γ := by -+ obtain ⟨h1, h2⟩ := hx -+ have hf : ⌊x⌋₊ = 1 := by -+ rw [Nat.floor_eq_iff (by linarith)] -+ exact ⟨by exact_mod_cast h1.le, by exact_mod_cast h2⟩ -+ unfold E₂Λ -+ rw [hf] -+ simp -+ -+private lemma abs_E₂Λ_le_on_Ioo {x : ℝ} (hx : x ∈ Set.Ioo (1 : ℝ) 2) : -+ |E₂Λ x| ≤ |log (x - 1)| + log 2 + |γ| := by -+ obtain ⟨hx1, hx2⟩ := hx -+ have hloglog : |log (log x)| ≤ |log (x - 1)| + log 2 := by -+ have hxpos : (0:ℝ) < x := by linarith -+ have hlogx_pos : 0 < log x := Real.log_pos hx1 -+ have hxm1 : 0 < x - 1 := by linarith -+ have hub : log x ≤ x - 1 := by have := Real.log_le_sub_one_of_pos hxpos; linarith -+ have hlb2 : (x - 1) / 2 ≤ log x := by -+ have h := Real.log_le_sub_one_of_pos (x := 1 / x) (by positivity) -+ rw [Real.log_div one_ne_zero (by positivity), Real.log_one] at h -+ simp only [zero_sub] at h -+ have h12 : (x - 1) / 2 ≤ 1 - 1 / x := by -+ rw [← sub_nonneg] -+ have e : (1 - 1 / x) - (x - 1) / 2 = (3 * x - 2 - x ^ 2) / (2 * x) := by field_simp; ring -+ rw [e]; exact div_nonneg (by nlinarith [hx1, hx2]) (by positivity) -+ linarith -+ have hupper : log (log x) ≤ log (x - 1) := Real.log_le_log hlogx_pos hub -+ have hlower : log (x - 1) - log 2 ≤ log (log x) := by -+ have := Real.log_le_log (show (0:ℝ) < (x - 1) / 2 by positivity) hlb2 -+ rwa [Real.log_div (by linarith) (by norm_num)] at this -+ have h2 : (0:ℝ) ≤ log 2 := Real.log_nonneg (by norm_num) -+ rw [abs_le] -+ exact ⟨by have := neg_abs_le (log (x - 1)); linarith, -+ by have := le_abs_self (log (x - 1)); linarith⟩ -+ rw [E₂Λ_eq_on_Ioo ⟨hx1, hx2⟩] -+ have htri : |(- log (log x) - γ)| ≤ |log (log x)| + |γ| := by -+ have h := abs_sub (-log (log x)) γ -+ rwa [abs_neg] at h -+ linarith -+ -+private lemma abs_E₂Λ_le_const {x : ℝ} (hx : 2 ≤ x) : -+ |E₂Λ x| ≤ (log 4 + 6) / log 2 := -+ (E₂Λ.abs_le hx).trans <| div_le_div_of_nonneg_left (by positivity) -+ (Real.log_pos (by norm_num)) (Real.log_le_log (by norm_num) hx) -+ -+private lemma integrableOn_log_sub_one_bound : -+ IntegrableOn (fun x => |log (x - 1)| + log 2 + |γ|) (Set.Ioo 1 2) volume := by -+ have hlog : IntegrableOn (fun x => |log (x - 1)|) (Set.Ioo 1 2) volume := by -+ have h0 : IntervalIntegrable (fun x => log x) volume 0 1 := -+ intervalIntegral.intervalIntegrable_log' -+ have h1 : IntervalIntegrable (fun x => log (x - 1)) volume (0 + 1) (1 + 1) := -+ h0.comp_sub_right 1 -+ norm_num at h1 -+ exact (h1.1.mono_set Set.Ioo_subset_Ioc_self).abs -+ have hc : IntegrableOn (fun _ : ℝ => log 2 + |γ|) (Set.Ioo (1 : ℝ) 2) volume := -+ integrableOn_const (measure_Ioo_lt_top).ne (by finiteness) -+ have hsum : IntegrableOn (fun x => |log (x - 1)| + (log 2 + |γ|)) (Set.Ioo 1 2) volume := -+ hlog.add hc -+ exact hsum.congr_fun (fun x _ => by ring) measurableSet_Ioo -+ -+private lemma integrableOn_E₂Λ_Ioo {X : ℝ} (_hX : 2 ≤ X) : -+ IntegrableOn E₂Λ (Set.Ioo 1 X) volume := by -+ have hsub : Set.Ioo (1 : ℝ) X ⊆ Set.Ioo 1 2 ∪ Set.Icc 2 X := by -+ intro x hx; simp only [Set.mem_Ioo, Set.mem_union, Set.mem_Icc] at * -+ rcases lt_or_ge x 2 with h | h -+ · exact Or.inl ⟨hx.1, h⟩ -+ · exact Or.inr ⟨h, hx.2.le⟩ -+ apply IntegrableOn.mono_set _ hsub -+ apply IntegrableOn.union -+ · have hg := integrableOn_log_sub_one_bound -+ refine Integrable.mono' hg measurable_E₂Λ.aestronglyMeasurable ?_ -+ filter_upwards [self_mem_ae_restrict measurableSet_Ioo] with x hx -+ rw [Real.norm_eq_abs]; exact abs_E₂Λ_le_on_Ioo hx -+ · refine Integrable.mono' (g := fun _ => (log 4 + 6) / log 2) ?_ -+ measurable_E₂Λ.aestronglyMeasurable ?_ -+ · exact integrableOn_const (by rw [Real.volume_Icc]; exact ENNReal.ofReal_ne_top) (by finiteness) -+ · filter_upwards [self_mem_ae_restrict measurableSet_Icc] with x hx -+ rw [Real.norm_eq_abs]; exact abs_E₂Λ_le_const hx.1 -+ -+private lemma sub_one_mul_integral_E₂Λ_tendsto : -+ Filter.Tendsto (fun s : ℝ => (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)) -+ (nhdsWithin 1 (Set.Ioi 1)) (nhds 0) := by -+ rw [Metric.tendsto_nhdsWithin_nhds] -+ intro ε hε -+ -+ obtain ⟨X₀, hX₀⟩ : ∃ X, ∀ x ≥ X, |E₂Λ x| ≤ ε / 2 := by -+ have := E₂Λ.bound'.def (by positivity : (0:ℝ) < ε / 2) -+ simp only [Real.norm_eq_abs, abs_one, mul_one] at this -+ rw [Filter.eventually_atTop] at this; exact this -+ set X := max X₀ 2 with hXdef -+ have hX2 : 2 ≤ X := le_max_right _ _ -+ have hXge : ∀ x ≥ X, |E₂Λ x| ≤ ε / 2 := fun x hx => hX₀ x (le_trans (le_max_left _ _) hx) -+ -+ set B := ∫ x in Set.Ioo 1 X, |E₂Λ x| with hBdef -+ have hB0 : 0 ≤ B := setIntegral_nonneg measurableSet_Ioo (fun x _ => abs_nonneg _) -+ refine ⟨min 1 (ε / 2 / (B + 1)), by positivity, ?_⟩ -+ intro s hs hdist -+ simp only [Set.mem_Ioi] at hs -+ rw [Real.dist_eq] at hdist -+ have hs1 : s - 1 < min 1 (ε / 2 / (B + 1)) := by -+ rw [abs_of_pos (by linarith)] at hdist; exact hdist -+ have hsm1 : 0 < s - 1 := by linarith -+ -+ have hintAbs : IntegrableOn (fun x => |E₂Λ x| * x ^ (-s)) (Set.Ioi 1) volume := by -+ have h2 : IntegrableOn (fun x => |E₂Λ x * x ^ (-s)|) (Set.Ioi 1) volume := -+ (integrableOn_E₂Λ_mul_rpow s hs).abs -+ refine h2.congr_fun ?_ measurableSet_Ioi -+ intro x hx; simp only [Set.mem_Ioi] at hx -+ change |E₂Λ x * x ^ (-s)| = |E₂Λ x| * x ^ (-s) -+ rw [abs_mul, abs_of_nonneg (Real.rpow_nonneg (by linarith) _)] -+ have hintAbsIoc : IntegrableOn (fun x => |E₂Λ x| * x ^ (-s)) (Set.Ioc 1 X) volume := -+ hintAbs.mono_set Set.Ioc_subset_Ioi_self -+ have hintAbsIoiX : IntegrableOn (fun x => |E₂Λ x| * x ^ (-s)) (Set.Ioi X) volume := -+ hintAbs.mono_set (Set.Ioi_subset_Ioi (by linarith)) -+ -+ have hsplit : ∫ x in Set.Ioi 1, |E₂Λ x| * x ^ (-s) = -+ (∫ x in Set.Ioc 1 X, |E₂Λ x| * x ^ (-s)) + ∫ x in Set.Ioi X, |E₂Λ x| * x ^ (-s) := by -+ have hu : Set.Ioi (1:ℝ) = Set.Ioc 1 X ∪ Set.Ioi X := -+ (Set.Ioc_union_Ioi_eq_Ioi (by linarith)).symm -+ rw [hu, setIntegral_union (Set.Ioc_disjoint_Ioi le_rfl) measurableSet_Ioi -+ (hintAbs.mono_set (by rw [hu]; exact Set.subset_union_left)) -+ (hintAbs.mono_set (by rw [hu]; exact Set.subset_union_right))] -+ -+ have hp1 : ∫ x in Set.Ioc 1 X, |E₂Λ x| * x ^ (-s) ≤ B := by -+ rw [hBdef] -+ have ha : IntegrableOn (fun x => |E₂Λ x|) (Set.Ioo 1 X) volume := (integrableOn_E₂Λ_Ioo hX2).abs -+ have habsIoc : IntegrableOn (fun x => |E₂Λ x|) (Set.Ioc 1 X) volume := -+ ha.congr_set_ae (Ioo_ae_eq_Ioc).symm -+ rw [← integral_Ioc_eq_integral_Ioo] -+ apply setIntegral_mono_on hintAbsIoc habsIoc measurableSet_Ioc -+ intro x hx -+ have hx1 : (1:ℝ) ≤ x := by have := hx.1; linarith -+ have hle1 : x ^ (-s) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos hx1 (by linarith) -+ calc |E₂Λ x| * x ^ (-s) ≤ |E₂Λ x| * 1 := by gcongr -+ _ = |E₂Λ x| := mul_one _ -+ -+ have hp2 : ∫ x in Set.Ioi X, |E₂Λ x| * x ^ (-s) ≤ (ε / 2) * (X ^ (1 - s) / (s - 1)) := by -+ have hrpow_int : IntegrableOn (fun x : ℝ => x ^ (-s)) (Set.Ioi X) volume := -+ integrableOn_Ioi_rpow_of_lt (by linarith) (by linarith : (0:ℝ) < X) -+ have hval : ∫ x in Set.Ioi X, x ^ (-s) = X ^ (1 - s) / (s - 1) := by -+ rw [integral_Ioi_rpow_of_lt (by linarith) (by linarith : (0:ℝ) < X), -+ show -s + 1 = 1 - s by ring, show (1:ℝ) - s = -(s - 1) by ring] -+ rw [div_neg, neg_div, neg_neg] -+ rw [← hval, ← integral_const_mul] -+ apply setIntegral_mono_on hintAbsIoiX (hrpow_int.const_mul (ε / 2)) measurableSet_Ioi -+ intro x hx -+ have hxpos : (0:ℝ) < x := by simp only [Set.mem_Ioi] at hx; linarith -+ have hnn : 0 ≤ x ^ (-s) := Real.rpow_nonneg hxpos.le _ -+ have hb : |E₂Λ x| ≤ ε / 2 := hXge x (by simp only [Set.mem_Ioi] at hx; linarith) -+ gcongr -+ have hXpow : X ^ (1 - s) ≤ 1 := -+ Real.rpow_le_one_of_one_le_of_nonpos (by linarith) (by linarith) -+ -+ have hbound : (s - 1) * ∫ x in Set.Ioi 1, |E₂Λ x| * x ^ (-s) ≤ (s - 1) * B + ε / 2 := by -+ rw [hsplit, mul_add] -+ have ht2 : (s - 1) * ∫ x in Set.Ioi X, |E₂Λ x| * x ^ (-s) ≤ ε / 2 := by -+ calc (s - 1) * ∫ x in Set.Ioi X, |E₂Λ x| * x ^ (-s) -+ ≤ (s - 1) * ((ε / 2) * (X ^ (1 - s) / (s - 1))) := -+ mul_le_mul_of_nonneg_left hp2 hsm1.le -+ _ = (ε / 2) * X ^ (1 - s) := by -+ have hne : s - 1 ≠ 0 := by linarith -+ field_simp -+ _ ≤ (ε / 2) * 1 := by gcongr -+ _ = ε / 2 := mul_one _ -+ have ht1 : (s - 1) * ∫ x in Set.Ioc 1 X, |E₂Λ x| * x ^ (-s) ≤ (s - 1) * B := -+ mul_le_mul_of_nonneg_left hp1 hsm1.le -+ linarith -+ -+ have habs_le : |(s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)| -+ ≤ (s - 1) * ∫ x in Set.Ioi 1, |E₂Λ x| * x ^ (-s) := by -+ rw [abs_mul, abs_of_pos hsm1] -+ gcongr -+ rw [← Real.norm_eq_abs] -+ refine (norm_integral_le_integral_norm _).trans_eq ?_ -+ refine setIntegral_congr_fun measurableSet_Ioi (fun x hx => ?_) -+ simp only [Set.mem_Ioi] at hx -+ change ‖E₂Λ x * x ^ (-s)‖ = |E₂Λ x| * x ^ (-s) -+ rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (Real.rpow_nonneg (by linarith) _)] -+ rw [Real.dist_eq, sub_zero] -+ -+ have hfin : (s - 1) * B + ε / 2 < ε := by -+ have hlt : s - 1 < ε / 2 / (B + 1) := lt_of_lt_of_le hs1 (min_le_right _ _) -+ have hBp : 0 < B + 1 := by linarith -+ have h1 : (s - 1) * B ≤ (s - 1) * (B + 1) := by nlinarith -+ have h2 : (s - 1) * (B + 1) < (ε / 2 / (B + 1)) * (B + 1) := mul_lt_mul_of_pos_right hlt hBp -+ have h3 : (ε / 2 / (B + 1)) * (B + 1) = ε / 2 := by field_simp -+ linarith -+ calc |(s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)| -+ ≤ (s - 1) * ∫ x in Set.Ioi 1, |E₂Λ x| * x ^ (-s) := habs_le -+ _ ≤ (s - 1) * B + ε / 2 := hbound -+ _ < ε := hfin -+ -+end -+ -+theorem deriv_gamma_add_γ_eq_zero : deriv Gamma 1 + γ = 0 := by -+ -+ have key : ∀ s : ℝ, 1 < s → -+ (Real.log (riemannZeta (s:ℂ)).re + Real.log (s - 1)) -+ - (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s) = deriv Gamma 1 + γ := by -+ intro s hs -+ have h := log_zeta_eq s hs -+ linarith -+ -+ have hconst : Filter.Tendsto -+ (fun s : ℝ => (Real.log (riemannZeta (s:ℂ)).re + Real.log (s - 1)) -+ - (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)) -+ (nhdsWithin 1 (Set.Ioi 1)) (nhds (deriv Gamma 1 + γ)) := by -+ refine Filter.Tendsto.congr' ?_ tendsto_const_nhds -+ filter_upwards [self_mem_nhdsWithin] with s hs -+ exact (key s hs).symm -+ -+ have hlim := log_zeta_limit.sub sub_one_mul_integral_E₂Λ_tendsto -+ rw [sub_zero] at hlim -+ exact tendsto_nhds_unique hconst hlim -+ -+theorem γ.eq_eulerMascheroni : γ = eulerMascheroniConstant := by -+ linarith [Real.eulerMascheroniConstant_eq_neg_deriv, deriv_gamma_add_γ_eq_zero] -+ -+theorem sum_mangoldt_div_log_eq (x : ℝ) : ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) = log (log x) + eulerMascheroniConstant + E₂Λ x := by -+ grind [γ.eq_eulerMascheroni] -+ -+theorem sum_mangoldt_div_log_eq_log_log : ∃ C, ∀ x, 2 ≤ x → -+ |∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x)| ≤ C := by -+ use (log 4 + 6)/log 2 + |eulerMascheroniConstant| -+ intro x hx -+ rw [sum_mangoldt_div_log_eq] -+ calc -+ _ = |E₂Λ x + eulerMascheroniConstant| := by ring_nf -+ _ ≤ (log 4 + 6)/log x + |eulerMascheroniConstant| := by grw [abs_add_le, E₂Λ.abs_le hx] -+ _ ≤ _ := by gcongr -+ -+theorem sum_mangoldt_div_log_eq_log_log' : (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x)) =O[atTop] (fun _ ↦ (1:ℝ)) := by -+ simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, -+ eventually_atTop] -+ obtain ⟨ C, _ ⟩ := sum_mangoldt_div_log_eq_log_log -+ use C, 2 -+ -+theorem sum_mangoldt_div_log_eq_log_log'' : (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d)) ~[atTop] (fun x ↦ log (log x)) := by -+ apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log_log) -+ convert! sum_mangoldt_div_log_eq_log_log' using 1 -+ -+noncomputable def M : ℝ := (∫ t in Set.Ioi 2, E₁p t / (t * log t^2)) + 1 - log (log 2) -+ -+theorem M.le : M ≤ (log 4 + 4) / log 2 + 1 - log (log 2) := calc -+ _ ≤ (∫ t in Set.Ioi 2, (log 4 + 4) / (t * log t^2)) + 1 - log (log 2) := by -+ unfold M; gcongr with x hx -+ · exact integrable_E₁p_div_mul_log_sq (by norm_num) -+ · exact integrable_const_div_mul_log_sq _ (by norm_num) -+ · measurability -+ · simp at hx; positivity -+ simp at hx; exact E₁p.le (by linarith) -+ _ = _ := by rw [integ_div_mul_log_sq _ (by norm_num)] -+ -+theorem M.ge : M ≥ (-2 - E₁) / log 2 + 1 - log (log 2) := calc -+ _ ≥ (∫ t in Set.Ioi 2, (-2 - E₁) / (t * log t^2)) + 1 - log (log 2) := by -+ unfold M; gcongr with x hx -+ · exact integrable_const_div_mul_log_sq _ (by norm_num) -+ · exact integrable_E₁p_div_mul_log_sq (by norm_num) -+ · measurability -+ · simp at hx; positivity -+ simp at hx; exact E₁p.ge (by linarith) -+ _ = _ := by rw [integ_div_mul_log_sq _ (by norm_num)] -+ -+noncomputable abbrev E₂p (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1:ℝ) / p - log (log x) - M -+ -+theorem sum_prime_div_eq (x : ℝ) : ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1:ℝ) / p = log (log x) + M + E₂p x := by -+ ring -+ -+theorem E₂p.eq {x : ℝ} (hx : 2 ≤ x) : -+ E₂p x = E₁p x / log x - ∫ t in Set.Ioi x, E₁p t / (t * log t^2) := by -+ unfold E₂p -+ rw [sum_filter, ← sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp [Nat.not_prime_one])] -+ have (n : ℕ) : (if Nat.Prime n then (1 : ℝ) / n else 0) = (if Nat.Prime n then log n / n else 0) / log n := by -+ split_ifs with h -+ · have : log n ≠ 0 := by simp; grind [h.two_le] -+ field -+ · simp -+ simp_rw [this] -+ rw [sum_div_log_eq hx, sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp), ← sum_filter] -+ rw [sum_log_prime_div_eq] -+ have : ∫ t in 2..x, (∑ n ∈ Ioc 1 ⌊t⌋₊, if Nat.Prime n then log ↑n / ↑n else 0) / (t * log t ^ 2) = ∫ t in 2..x, (1 / (t * log t) + E₁p t / (t * log t ^2)) := by -+ refine intervalIntegral.integral_congr fun t ht ↦ ?_ -+ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht -+ rw [sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp), ← sum_filter, sum_log_prime_div_eq] -+ field -+ rw [this, intervalIntegral.integral_add] -+ · rw [integral_one_div_mul_log hx, add_div, div_self (by simp; grind)] -+ unfold M -+ calc -+ _ = E₁p x / log x + (∫ (x : ℝ) in 2..x, E₁p x / (x * log x ^ 2)) - -+ ((∫ (t : ℝ) in Set.Ioi 2, E₁p t / (t * log t ^ 2))) := by ring -+ _ = _ := by -+ rw [← intervalIntegral.integral_interval_add_Ioi (integrable_E₁p_div_mul_log_sq (by rfl)) (integrable_E₁p_div_mul_log_sq hx)] -+ ring -+ · exact intervalIntegrable_one_div_mul_log hx -+ · rw [intervalIntegrable_iff, Set.uIoc_of_le hx] -+ exact integrable_E₁p_div_mul_log_sq (x := 2) (by rfl)|>.mono (by grind) (by rfl) -+ -+theorem E₂p.abs_le {x : ℝ} (hx : 2 ≤ x) : -+ |E₂p x| ≤ (log 4 + 6 + E₁) / log x := by -+ have : 0 < log x := by apply log_pos; linarith -+ rw [E₂p.eq hx, abs_le'] -+ constructor -+ · grw [E₁p.le (by linarith)] -+ have : ∫ t in Set.Ioi x, E₁p t / (t * log t^2) ≥ (- 2 - E₁) / log x := calc -+ _ ≥ ∫ t in Set.Ioi x, (-2 - E₁) / (t * log t^2) := by -+ apply MeasureTheory.setIntegral_mono_on (integrable_const_div_mul_log_sq (-2 - E₁) hx) -+ (integrable_E₁p_div_mul_log_sq hx) (by measurability) -+ intro y hy; simp at hy -+ have : 1 < y := by linarith -+ have : 0 < log y := log_pos this -+ gcongr; exact E₁p.ge (by linarith) -+ _ = _ := integ_div_mul_log_sq (-2 - E₁) hx -+ grw [this] -+ grind -+ grw [E₁p.ge (by linarith)] -+ have : ∫ t in Set.Ioi x, E₁p t / (t * log t^2) ≤ (log 4 + 4) / log x := calc -+ _ ≤ ∫ t in Set.Ioi x, (log 4 + 4) / (t * log t^2) := by -+ apply MeasureTheory.setIntegral_mono_on (integrable_E₁p_div_mul_log_sq hx) -+ (integrable_const_div_mul_log_sq (log 4 + 4) hx) (by measurability) -+ intro y hy; simp at hy -+ have : 1 < y := by linarith -+ have : 0 < log y := log_pos this -+ gcongr; exact E₁p.le (by linarith) -+ _ = _ := integ_div_mul_log_sq (log 4 + 4) hx -+ grw [this] -+ grind -+ -+theorem E₂p.bound : E₂p =O[atTop] (fun x ↦ 1 / log x) := by -+ simp only [one_div, isBigO_iff, norm_eq_abs, norm_inv, eventually_atTop] -+ use log 4 + 6 + E₁, 2 -+ intro x hx -+ convert E₂p.abs_le hx using 1 -+ have : 0 < log x := by apply log_pos; linarith -+ grind [abs_of_pos this] -+ -+theorem E₂p.bound' : E₂p =o[atTop] (fun _ ↦ (1:ℝ)) := E₂p.bound.trans_isLittleO inv_log_eq_o_one -+ -+theorem sum_prime_div_eq_log_log : ∃ C, ∀ x, 2 ≤ x → -+ |∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p - log (log x)| ≤ C := by -+ use |M| + (log 4 + 6 + E₁) / log 2 -+ intro x hx -+ rw [sum_prime_div_eq] -+ calc -+ _ = |M + E₂p x| := by ring_nf -+ _ ≤ |M| + (log 4 + 6 + E₁) / log x := by grw [abs_add_le, E₂p.abs_le hx] -+ _ ≤ _ := by -+ gcongr -+ have : 0 < log 4 := by apply log_pos; norm_num -+ linarith [E₁.nonneg] -+ -+theorem sum_prime_div_eq_log_log' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p - log (log x)) =O[atTop] (fun _ ↦ (1:ℝ)) := by -+ simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, -+ eventually_atTop] -+ obtain ⟨ C, hC ⟩ := sum_prime_div_eq_log_log -+ use C, 2 -+ -+theorem sum_prime_div_eq_log_log'' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p) ~[atTop] (fun x ↦ log (log x)) := by -+ apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log_log) -+ convert! sum_prime_div_eq_log_log' using 1 -+ -+lemma HasSum_log_one_sub_one_div_prime {p : ℕ} (hp : p.Prime) : -+ HasSum (fun n : ℕ ↦ (-1 : ℝ) / (( n + 1) * p ^ (n + 1))) (log (1 - 1 / p)) := by -+ convert! Real.hasSum_pow_div_log_of_abs_lt_one (x := 1 / p) _|>.neg using 1 -+ · ext -+ rw [div_pow, one_pow, div_div] -+ ring -+ · ring -+ · simp only [one_div, abs_inv, Nat.abs_cast] -+ exact inv_lt_one_of_one_lt₀ (mod_cast hp.one_lt) -+ -+lemma E₂Λ_sub_E₂p_tendsto : -+ Tendsto (E₂Λ - E₂p) atTop (nhds 0) := by -+ exact isLittleO_one_iff ℝ|>.mp <| E₂Λ.bound'.sub E₂p.bound' -+ -+noncomputable abbrev M_eq_f (n : ℕ) := -+ if ¬n.Prime then Λ n /(n * log n) else 0 -+ -+lemma E₂Λ_sub_E₂p_eq (x : ℝ) : -+ E₂Λ x - E₂p x = ∑ n ∈ Ioc 0 ⌊x⌋₊, M_eq_f n - (γ - M) := by -+ calc -+ _ = ∑ n ∈ Ioc 0 ⌊x⌋₊, Λ n / (n * log n) - ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1 : ℝ) / p - (γ - M) := by ring -+ _ = _ := by -+ rw [sum_filter, ← sum_sub_distrib] -+ congr -+ ext n -+ split_ifs with hn -+ · rw [vonMangoldt_apply_prime hn] -+ have : log n ≠ 0 := by simp; grind [hn.two_le] -+ field -+ · ring -+ -+lemma M_eq_f.sum_tendsto : -+ Tendsto (fun (x : ℝ) ↦ ∑ n ∈ Ioc 0 ⌊x⌋₊, M_eq_f n) atTop (nhds (γ - M)) := by -+ apply tendsto_sub_nhds_zero_iff.mp -+ convert E₂Λ_sub_E₂p_tendsto using 1 -+ ext -+ rw [← E₂Λ_sub_E₂p_eq] -+ simp -+ -+lemma M_eq_f.sum_tendsto' : -+ Tendsto (fun (N : ℕ) ↦ ∑ n ∈ range N, M_eq_f n) atTop (nhds (γ - M)) := by -+ have : Tendsto (fun (N : ℕ) ↦ (∑ n ∈ Ioc 0 ⌊(N : ℝ)⌋₊, M_eq_f n)) atTop (nhds (γ - M)) := M_eq_f.sum_tendsto.comp tendsto_natCast_atTop_atTop -+ simp_rw [Nat.floor_natCast] at this -+ apply (this.comp (tendsto_sub_atTop_nat 1)).congr' -+ filter_upwards [eventually_ge_atTop 1] with N hn -+ rw [Nat.range_eq_Icc_zero_sub_one, ← add_sum_Ioc_eq_sum_Icc] <;> grind -+ -+lemma M_eq_f.HasSum : -+ HasSum M_eq_f (γ - M) := by -+ refine hasSum_iff_tendsto_nat_of_nonneg (fun n ↦ ?_) _|>.mpr M_eq_f.sum_tendsto' -+ unfold M_eq_f -+ split_ifs with hn -+ · rfl -+ · exact div_nonneg vonMangoldt_nonneg (by positivity) -+ -+lemma M_eq_f.sum_primes : -+ ∑' (p : Nat.Primes), M_eq_f p = 0 := by -+ convert! tsum_zero with p -+ grind -+ -+lemma tsum_primes_eq_tsum_ite (f : ℕ → ℝ) : -+ ∑' (n : Nat.Primes), f n = ∑' (n : ℕ), if n.Prime then f n else 0 := by -+ convert! _root_.tsum_subtype Nat.Prime f using 2 -+ ext -+ simp [Set.indicator] -+ congr -+ -+lemma tsum_M_eq_f_eq_tsum : -+ -∑' (n : ℕ), M_eq_f n = ∑' p : ℕ, if p.Prime then log (1 - 1 / p) + 1 / p else 0 := by -+ rw [tsum_eq_tsum_primes_add_tsum_primes_of_support_subset_prime_powers M_eq_f.HasSum.summable -+ (fun n hn ↦ (by simp_all [vonMangoldt_ne_zero_iff])), M_eq_f.sum_primes, zero_add, -+ tsum_primes_eq_tsum_ite (fun p ↦ ∑' (k : ℕ), M_eq_f (p ^ (k + 2))), ← tsum_neg] -+ refine tsum_congr fun n ↦ ?_ -+ split_ifs with hn -+ · rw [← HasSum_log_one_sub_one_div_prime hn|>.tsum_eq, HasSum_log_one_sub_one_div_prime hn|>.summable.tsum_eq_zero_add] -+ simp only [ite_not, Nat.cast_pow, log_pow, Nat.cast_add, Nat.cast_ofNat, CharP.cast_eq_zero, -+ zero_add, pow_one, one_mul, Nat.cast_one, one_div] -+ trans -∑' (k : ℕ), (1 : ℝ) / ((k + 2) * n ^ (k + 2)) -+ · congr -+ ext k -+ have : ¬(Nat.Prime (n ^ (k + 2))) := by exact Nat.Prime.not_prime_pow (by grind) -+ simp only [this, ↓reduceIte, one_div, mul_inv_rev] -+ rw [vonMangoldt_apply_pow (by grind), vonMangoldt_apply_prime hn] -+ have : log n ≠ 0 := by simp; grind [hn.two_le] -+ field -+ · rw [← tsum_neg] -+ ring_nf -+ congr -+ ext -+ ring_nf -+ · ring -+ -+theorem M.eq : M = γ + ∑' p : ℕ, if p.Prime then log (1 - 1 / p) + 1 / p else 0 := by -+ rw [← tsum_M_eq_f_eq_tsum, M_eq_f.HasSum.tsum_eq] -+ ring -+ -+noncomputable def E₃ (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, log (1 - (1:ℝ) / p) + log (log x) + eulerMascheroniConstant -+ -+theorem prod_one_minus_div_prime_eq {x : ℝ} (hx : 1 < x) : -+ ∏ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1 - (1 : ℝ) / p) = -+ exp (-eulerMascheroniConstant) * exp (E₃ x) / log x := by -+ have hlog : 0 < log x := log_pos hx -+ have hpos : ∀ {p : ℕ}, p.Prime → (0 : ℝ) < 1 - 1 / p := fun {p} hp ↦ by -+ have : (2 : ℝ) ≤ p := mod_cast hp.two_le -+ grind [one_div_le_one_div_of_le two_pos this] -+ rw [E₃, exp_add, exp_add, exp_sum, exp_log hlog, exp_neg, -+ prod_congr rfl fun p hp ↦ exp_log (hpos (mem_filter.mp hp).2)] -+ field_simp -+ -+noncomputable abbrev M_eq_summand (p : ℕ) := if p.Prime then log (1 - 1 / p) + 1 / p else 0 -+ -+lemma M_eq_summand_bound (n : ℕ) : -+ |M_eq_summand n| ≤ 2 / n ^ 2 := by -+ unfold M_eq_summand -+ split_ifs with h -+ · trans 1 / n ^ 2 / (1 - 1 / n) -+ · convert abs_log_sub_add_sum_range_le (x := 1 / n) _ 1 using 1 -+ · rw [add_comm] -+ simp -+ · rw [abs_of_nonneg (by simp)] -+ ring -+ · simpa using inv_lt_one_of_one_lt₀ (mod_cast h.one_lt) -+ rw [(by ring : (2 : ℝ) / n ^ 2 = 1 / n ^ 2 / (1 / 2))] -+ gcongr -+ suffices (1 : ℝ) / n ≤ 1 / 2 by linarith -+ gcongr -+ exact_mod_cast h.two_le -+ · rw [abs_zero] -+ positivity -+ -+lemma M_eq_summable : Summable M_eq_summand := by -+ apply Summable.of_abs -+ exact Summable.of_nonneg_of_le (by simp) M_eq_summand_bound (Summable.const_div (by simp) _) -+ -+lemma tsum_M_eq_summand_eq : -+ ∑' (n : ℕ), M_eq_summand n = M - γ := by -+ rw [M.eq] -+ grind -+ -+lemma sum_one_div_sq_le {N : ℝ} (hN : 1 ≤ N) : -+ ∑' (n : ℕ), (1 : ℝ) / (n + N) ^ 2 ≤ 2 / N := by -+ grw [AntitoneOn.tsum_le_integral (f := (fun t ↦ 1 / (t + N) ^ 2))] -+ · have hd : ∀ x ∈ Set.Ici 0, HasDerivAt (fun t ↦ -1 / (t + N)) (1 / (x + N) ^ 2) x := by -+ intro t ht -+ convert! HasDerivAt.fun_div (d' := (1 : ℝ)) (hasDerivAt_const ..) _ _ using 1 -+ · ring -+ · simpa using hasDerivAt_id' t -+ · simp at ht -+ linarith -+ have lim : Tendsto (fun t ↦ -1 / (t + N)) atTop (nhds 0) := by -+ exact (tendsto_atTop_add_const_right atTop N tendsto_id).const_div_atTop _ -+ rw [MeasureTheory.integral_Ioi_of_hasDerivAt_of_nonneg' hd (fun _ _ ↦ (by positivity)) lim] -+ ring_nf -+ rw [mul_two] -+ gcongr -+ field_simp -+ exact hN -+ · unfold AntitoneOn -+ intro a ha b hb h -+ beta_reduce -+ simp at ha hb -+ gcongr -+ · convert! integrableOn_add_rpow_Ioi_of_lt (by norm_num : (-2 : ℝ) < -1) (by linarith : -N < 0) using 2 -+ simp -+ · exact fun _ _ ↦ (by positivity) -+ -+lemma sum_M_eq_summand_le {N : ℕ} (hN : 0 < N) : -+ |∑ n ∈ range N, M_eq_summand n - (M - γ)| ≤ 4 / N := by -+ rw [← tsum_M_eq_summand_eq, ← M_eq_summable.sum_add_tsum_nat_add N] -+ simp only [sub_add_cancel_left, abs_neg] -+ rw [← norm_eq_abs] -+ have summable := summable_nat_add_iff N|>.mpr M_eq_summable.norm -+ apply norm_tsum_le_tsum_norm summable|>.trans -+ apply Summable.tsum_le_tsum (fun _ ↦ M_eq_summand_bound _) summable _|>.trans -+ · conv => lhs; arg 1; ext; rw [← mul_one_div] -+ rw [tsum_mul_left] -+ push_cast -+ grw [sum_one_div_sq_le (mod_cast hN)] -+ ring_nf -+ rfl -+ · exact (summable_nat_add_iff N|>.mpr (summable_one_div_nat_pow.mpr one_lt_two))|>.const_div _ -+ -+lemma sum_M_eq_summand_le' {x : ℝ} (hx : 2 ≤ x) : -+ |∑ n ∈ Ioc 0 ⌊x⌋₊, M_eq_summand n - (M - γ)| ≤ 4 / x := by -+ have := sum_M_eq_summand_le (by grind : 0 < ⌊x⌋₊ + 1) -+ rw [Nat.range_eq_Icc_zero_sub_one _ (by grind), ← add_sum_Ioc_eq_sum_Icc (by grind), -+ (by simp : M_eq_summand 0 = 0), zero_add] at this -+ simp only [add_tsub_cancel_right, Nat.cast_add, Nat.cast_one] at this -+ grw [this] -+ gcongr -+ exact Nat.lt_floor_add_one _|>.le -+ -+theorem E₃.abs_le : ∃ C, ∀ x, 2 ≤ x → |E₃ x| ≤ C / log x := by -+ unfold E₃ -+ refine ⟨4 + (log 4 + 6 + E₁), fun x hx ↦ ?_⟩ -+ calc -+ _ = |(∑ n ∈ Ioc 0 ⌊x⌋₊, M_eq_summand n - (M - γ)) - E₂p x| := by -+ unfold E₂p -+ have (n : ℕ) : M_eq_summand n = (if n.Prime then log (1 - 1 / n) else 0) + (if n.Prime then (1 : ℝ) / n else 0) := by -+ unfold M_eq_summand -+ split_ifs -+ · rfl -+ · ring -+ simp_rw [this] -+ rw [sum_filter, sum_filter, sum_add_distrib, γ.eq_eulerMascheroni] -+ ring_nf -+ _ ≤ _ := by -+ grw [abs_sub, E₂p.abs_le hx, sum_M_eq_summand_le' hx] -+ have : 4 / x ≤ 4 / log x := by -+ gcongr -+ · exact log_pos (by linarith) -+ · exact log_le_self (by linarith) -+ grw [this] -+ rw [← add_div] -+ -+theorem E₃.bound : E₃ =O[atTop] (fun x ↦ 1 / log x) := by -+ simp only [isBigO_iff, norm_eq_abs, eventually_atTop] -+ obtain ⟨ C, hC ⟩ := E₃.abs_le -+ use C, 2 -+ convert hC using 3 with x hx -+ have : 0 < log x := by apply log_pos; linarith -+ have : 0 < 1 / log x := by positivity -+ grind [abs_of_pos this] -+ -+theorem E₃.bound' : E₃ =o[atTop] (fun _ ↦ (1:ℝ)) := E₃.bound.trans_isLittleO inv_log_eq_o_one -+ -+theorem E₃.bound'' : (fun x ↦ ∏ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1 - (1:ℝ) / p)) ~[atTop] (fun x ↦ exp (-eulerMascheroniConstant) / log x) := by -+ rw [isEquivalent_iff_tendsto_one] -+ · convert Tendsto.congr' ?_ (Tendsto.rexp ((isLittleO_one_iff ℝ).mp E₃.bound')) using 2 with x -+ · simp -+ simp only [Erdos970.Filter.EventuallyEq.iff_eventually, Pi.div_apply, eventually_atTop]; use 2; intro x hx -+ rw [prod_one_minus_div_prime_eq (by linarith)] -+ have : 0 < log x := by apply log_pos; linarith -+ field_simp -+ simp only [ne_eq, div_eq_zero_iff, exp_ne_zero, log_eq_zero, eventually_atTop]; use 2 -+ grind -+ -+theorem E₃.bound''' : (fun x ↦ ∏ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1 - (1:ℝ) / p) - exp (-eulerMascheroniConstant) / log x) =O[atTop] (fun x ↦ 1 / (log x)^2) := by -+ obtain ⟨c, hc⟩ := E₃.abs_le -+ rw [isBigO_iff] -+ refine ⟨exp (-eulerMascheroniConstant) * 2 * c, ?_⟩ -+ filter_upwards [eventually_ge_atTop 2, eventually_ge_atTop c.exp] with x hx hx2 -+ rw [prod_one_minus_div_prime_eq (by linarith)] -+ specialize hc x hx -+ rw [norm_eq_abs, norm_eq_abs] -+ calc -+ _ = |exp (-eulerMascheroniConstant) / log x * (exp (E₃ x) - 1)| := by ring_nf -+ _ = |exp (-eulerMascheroniConstant) / log x| * |exp (E₃ x) - 1| := by rw [abs_mul] -+ _ ≤ _ := by -+ have : |E₃ x| ≤ 1 := by -+ apply hc.trans -+ have := log_le_log (exp_pos _) hx2 -+ rw [log_exp] at this -+ apply div_le_one_iff.mpr <| Or.inl ⟨log_pos (by linarith), this⟩ -+ grw [abs_exp_sub_one_le this, hc] -+ apply le_of_eq -+ rw [abs_div, abs_div, abs_one, abs_of_nonneg (exp_nonneg _), abs_of_nonneg (log_nonneg (by linarith)), abs_of_nonneg (sq_nonneg _)] -+ ring -+ -+end Mertens -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Rectangle.lean b/PrimeNumberTheoremAnd/Erdos970/Rectangle.lean -new file mode 100644 -index 0000000..c87b920 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Rectangle.lean -@@ -0,0 +1,264 @@ -+import Mathlib.Analysis.Complex.Convex -+import Mathlib.Analysis.InnerProductSpace.Basic -+import Mathlib.Analysis.Normed.Order.Lattice -+import Mathlib.Order.Interval.Set.Monotone -+ -+namespace Erdos970 -+ -+open Complex Set Topology -+ -+open scoped Interval -+ -+variable {z w : ℂ} {c : ℝ} -+ -+namespace Rectangle -+ -+lemma symm : Rectangle z w = Rectangle w z := by -+ simp [Rectangle, uIcc_comm] -+ -+lemma symm_re : Rectangle (w.re + z.im * I) (z.re + w.im * I) = Rectangle z w := by -+ simp [Rectangle, uIcc_comm] -+ -+end Rectangle -+ -+def RectangleBorder (z w : ℂ) : Set ℂ := -+ [[z.re, w.re]] ×ℂ {z.im} ∪ {z.re} ×ℂ [[z.im, w.im]] ∪ -+ [[z.re, w.re]] ×ℂ {w.im} ∪ {w.re} ×ℂ [[z.im, w.im]] -+ -+def Square (p : ℂ) (c : ℝ) : Set ℂ := Rectangle (-c - c * I + p) (c + c * I + p) -+ -+lemma Square_apply (p : ℂ) (cpos : c > 0) : -+ Square p c = Icc (-c + p.re) (c + p.re) ×ℂ Icc (-c + p.im) (c + p.im) := by -+ rw [Square, Rectangle, uIcc_of_le (by simp; linarith), uIcc_of_le (by simp; linarith)] -+ simp -+ -+@[simp] -+theorem preimage_equivRealProdCLM_reProdIm (s t : Set ℝ) : -+ equivRealProdCLM.symm ⁻¹' (s ×ℂ t) = s ×ˢ t := -+ rfl -+ -+@[simp] -+theorem ContinuousLinearEquiv.coe_toLinearEquiv_symm {R : Type*} {S : Type*} [Semiring R] -+ [Semiring S] {σ : R →+* S} {σ' : S →+* R} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] -+ (M : Type*) [TopologicalSpace M] -+ [AddCommMonoid M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] -+ [Module S M₂] (e : M ≃SL[σ] M₂) : -+ ⇑e.toLinearEquiv.symm = e.symm := -+ rfl -+ -+lemma segment_reProdIm_segment_eq_convexHull (z w : ℂ) : -+ [[z.re, w.re]] ×ℂ [[z.im, w.im]] = -+ convexHull ℝ {z, z.re + w.im * I, w.re + z.im * I, w} := by -+ simp_rw [← segment_eq_uIcc, ← convexHull_pair, ← convexHull_reProdIm, reProdIm] -+ exact congrArg _ <| Set.ext <| by simpa [Complex.ext_iff] using by tauto -+ -+lemma rectangle_in_convex {U : Set ℂ} (U_convex : Convex ℝ U) {z w : ℂ} (hz : z ∈ U) -+ (hw : w ∈ U) (hzw : (z.re + w.im * I) ∈ U) (hwz : (w.re + z.im * I) ∈ U) : -+ Rectangle z w ⊆ U := by -+ rw [Rectangle, segment_reProdIm_segment_eq_convexHull] -+ exact convexHull_min (by simp_all [insert_subset_iff]) U_convex -+ -+lemma mem_Rect {z w : ℂ} (zRe_lt_wRe : z.re ≤ w.re) (zIm_lt_wIm : z.im ≤ w.im) (p : ℂ) : -+ p ∈ Rectangle z w ↔ -+ z.re ≤ p.re ∧ p.re ≤ w.re ∧ z.im ≤ p.im ∧ p.im ≤ w.im := by -+ rw [Rectangle, uIcc_of_le zRe_lt_wRe, uIcc_of_le zIm_lt_wIm] -+ exact and_assoc -+ -+lemma square_neg (p : ℂ) (c : ℝ) : Square p (-c) = Square p c := by -+ simpa [Square] using! Rectangle.symm -+ -+theorem Set.left_not_mem_uIoo {a b : ℝ} : a ∉ Set.uIoo a b := -+ fun ⟨h1, h2⟩ ↦ (left_lt_sup.mp h2) (le_of_not_ge (inf_lt_left.mp h1)) -+ -+theorem Set.right_not_mem_uIoo {a b : ℝ} : b ∉ Set.uIoo a b := -+ fun ⟨h1, h2⟩ ↦ (right_lt_sup.mp h2) (le_of_not_ge (inf_lt_right.mp h1)) -+ -+theorem Set.ne_left_of_mem_uIoo {a b c : ℝ} (hc : c ∈ Set.uIoo a b) : c ≠ a := -+ fun h ↦ Set.left_not_mem_uIoo (h ▸ hc) -+ -+theorem Set.ne_right_of_mem_uIoo {a b c : ℝ} (hc : c ∈ Set.uIoo a b) : c ≠ b := -+ fun h ↦ Set.right_not_mem_uIoo (h ▸ hc) -+ -+lemma left_mem_rect (z w : ℂ) : z ∈ Rectangle z w := ⟨left_mem_uIcc, left_mem_uIcc⟩ -+ -+lemma right_mem_rect (z w : ℂ) : w ∈ Rectangle z w := ⟨right_mem_uIcc, right_mem_uIcc⟩ -+ -+lemma rect_subset_iff {z w z' w' : ℂ} : -+ Rectangle z' w' ⊆ Rectangle z w ↔ z' ∈ Rectangle z w ∧ w' ∈ Rectangle z w := by -+ use fun h ↦ ⟨h (left_mem_rect z' w'), h (right_mem_rect z' w')⟩ -+ intro ⟨⟨⟨hz're_ge, hz're_le⟩, ⟨hz'im_ge, hz'im_le⟩⟩, -+ ⟨⟨hw're_ge, hw're_le⟩, ⟨hw'im_ge, hw'im_le⟩⟩⟩ x -+ ⟨⟨hxre_ge, hxre_le⟩, ⟨hxim_ge, hxim_le⟩⟩ -+ refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ -+ · exact (le_inf hz're_ge hw're_ge).trans hxre_ge -+ · exact (le_sup_iff.mp hxre_le).casesOn (fun h ↦ h.trans hz're_le) -+ (fun h ↦ h.trans hw're_le) -+ · exact (le_inf hz'im_ge hw'im_ge).trans hxim_ge -+ · exact (le_sup_iff.mp hxim_le).casesOn (fun h ↦ h.trans hz'im_le) -+ (fun h ↦ h.trans hw'im_le) -+ -+lemma RectSubRect {x₀ x₁ x₂ x₃ y₀ y₁ y₂ y₃ : ℝ} (x₀_le_x₁ : x₀ ≤ x₁) -+ (x₁_le_x₂ : x₁ ≤ x₂) (x₂_le_x₃ : x₂ ≤ x₃) (y₀_le_y₁ : y₀ ≤ y₁) -+ (y₁_le_y₂ : y₁ ≤ y₂) (y₂_le_y₃ : y₂ ≤ y₃) : -+ Rectangle (x₁ + y₁ * I) (x₂ + y₂ * I) ⊆ -+ Rectangle (x₀ + y₀ * I) (x₃ + y₃ * I) := by -+ rw [rect_subset_iff, mem_Rect, mem_Rect] -+ refine ⟨⟨?_, ?_, ?_, ?_⟩, ?_, ?_, ?_, ?_⟩ -+ all_goals simpa using by linarith -+ -+lemma RectSubRect' {z₀ z₁ z₂ z₃ : ℂ} (x₀_le_x₁ : z₀.re ≤ z₁.re) -+ (x₁_le_x₂ : z₁.re ≤ z₂.re) (x₂_le_x₃ : z₂.re ≤ z₃.re) -+ (y₀_le_y₁ : z₀.im ≤ z₁.im) (y₁_le_y₂ : z₁.im ≤ z₂.im) -+ (y₂_le_y₃ : z₂.im ≤ z₃.im) : -+ Rectangle z₁ z₂ ⊆ Rectangle z₀ z₃ := by -+ rw [← re_add_im z₀, ← re_add_im z₁, ← re_add_im z₂, ← re_add_im z₃] -+ exact RectSubRect x₀_le_x₁ x₁_le_x₂ x₂_le_x₃ y₀_le_y₁ y₁_le_y₂ y₂_le_y₃ -+ -+lemma rectangleBorder_subset_rectangle (z w : ℂ) : RectangleBorder z w ⊆ Rectangle z w := by -+ intro x hx -+ obtain ⟨⟨h | h⟩ | h⟩ | h := hx -+ · exact ⟨h.1, h.2 ▸ left_mem_uIcc⟩ -+ · exact ⟨h.1 ▸ left_mem_uIcc, h.2⟩ -+ · exact ⟨h.1, h.2 ▸ right_mem_uIcc⟩ -+ · exact ⟨h.1 ▸ right_mem_uIcc, h.2⟩ -+ -+lemma rectangle_disjoint_singleton {z w p : ℂ} -+ (h : (p.re < z.re ∧ p.re < w.re) ∨ (p.im < z.im ∧ p.im < w.im) ∨ -+ (z.re < p.re ∧ w.re < p.re) ∨ (z.im < p.im ∧ w.im < p.im)) : -+ Disjoint (Rectangle z w) {p} := by -+ refine disjoint_singleton_right.mpr (not_and_or.mpr ?_) -+ obtain h | h | h | h := h -+ · exact Or.inl (notMem_uIcc_of_lt h.1 h.2) -+ · exact Or.inr (notMem_uIcc_of_lt h.1 h.2) -+ · exact Or.inl (notMem_uIcc_of_gt h.1 h.2) -+ · exact Or.inr (notMem_uIcc_of_gt h.1 h.2) -+ -+lemma rectangleBorder_disjoint_singleton {z w p : ℂ} -+ (h : p.re ≠ z.re ∧ p.re ≠ w.re ∧ p.im ≠ z.im ∧ p.im ≠ w.im) : -+ Disjoint (RectangleBorder z w) {p} := by -+ refine disjoint_singleton_right.mpr ?_ -+ simp_rw [RectangleBorder, Set.mem_union, not_or] -+ exact ⟨⟨⟨fun hc ↦ h.2.2.1 hc.2, fun hc ↦ h.1 hc.1⟩, fun hc ↦ h.2.2.2 hc.2⟩, -+ fun hc ↦ h.2.1 hc.1⟩ -+ -+lemma rectangle_subset_punctured_rect {z₀ z₁ z₂ z₃ p : ℂ} -+ (hz : z₀.re ≤ z₁.re ∧ z₁.re ≤ z₂.re ∧ z₂.re ≤ z₃.re ∧ -+ z₀.im ≤ z₁.im ∧ z₁.im ≤ z₂.im ∧ z₂.im ≤ z₃.im) -+ (hp : (p.re < z₁.re ∧ p.re < z₂.re) ∨ (p.im < z₁.im ∧ p.im < z₂.im) ∨ -+ (z₁.re < p.re ∧ z₂.re < p.re) ∨ (z₁.im < p.im ∧ z₂.im < p.im)) : -+ Rectangle z₁ z₂ ⊆ Rectangle z₀ z₃ \ {p} := -+ Set.subset_sdiff.mpr ⟨by apply RectSubRect' <;> tauto, rectangle_disjoint_singleton hp⟩ -+ -+lemma rectangleBorder_subset_punctured_rect {z₀ z₁ z₂ z₃ p : ℂ} -+ (hz : z₀.re ≤ z₁.re ∧ z₁.re ≤ z₂.re ∧ z₂.re ≤ z₃.re ∧ -+ z₀.im ≤ z₁.im ∧ z₁.im ≤ z₂.im ∧ z₂.im ≤ z₃.im) -+ (hp : p.re ≠ z₁.re ∧ p.re ≠ z₂.re ∧ p.im ≠ z₁.im ∧ p.im ≠ z₂.im) : -+ RectangleBorder z₁ z₂ ⊆ Rectangle z₀ z₃ \ {p} := -+ Set.subset_sdiff.mpr ⟨ -+ (rectangleBorder_subset_rectangle _ _).trans (by apply RectSubRect' <;> tauto), -+ rectangleBorder_disjoint_singleton hp⟩ -+ -+lemma rectangle_mem_nhds_iff {z w p : ℂ} : -+ Rectangle z w ∈ 𝓝 p ↔ p ∈ (Set.uIoo z.re w.re) ×ℂ (Set.uIoo z.im w.im) := by -+ simp_rw [← mem_interior_iff_mem_nhds, Rectangle, Complex.interior_reProdIm, uIoo, uIcc, -+ interior_Icc] -+ -+lemma mapsTo_rectangle_left_re (z w : ℂ) : -+ MapsTo (fun (y : ℝ) => ↑z.re + ↑y * I) [[z.im, w.im]] (Rectangle z w) := -+ fun _ hx ↦ ⟨by simp, by simp [hx]⟩ -+ -+lemma mapsTo_rectangle_right_re (z w : ℂ) : -+ MapsTo (fun (y : ℝ) => ↑w.re + ↑y * I) [[z.im, w.im]] (Rectangle z w) := -+ fun _ hx ↦ ⟨by simp, by simp [hx]⟩ -+ -+lemma mapsTo_rectangle_left_im (z w : ℂ) : -+ MapsTo (fun (x : ℝ) => ↑x + z.im * I) [[z.re, w.re]] (Rectangle z w) := -+ fun _ hx ↦ ⟨by simp [hx], by simp⟩ -+ -+lemma mapsTo_rectangle_right_im (z w : ℂ) : -+ MapsTo (fun (x : ℝ) => ↑x + w.im * I) [[z.re, w.re]] (Rectangle z w) := -+ fun _ hx ↦ ⟨by simp [hx], by simp⟩ -+ -+lemma mapsTo_rectangleBorder_left_re (z w : ℂ) : -+ MapsTo (fun (y : ℝ) => ↑z.re + ↑y * I) [[z.im, w.im]] (RectangleBorder z w) := -+ (Set.mapsTo_image _ _).mono subset_rfl fun _ ↦ -+ by simp_all [verticalSegment_eq, RectangleBorder] -+ -+lemma mapsTo_rectangleBorder_right_re (z w : ℂ) : -+ MapsTo (fun (y : ℝ) => ↑w.re + ↑y * I) [[z.im, w.im]] (RectangleBorder z w) := -+ (Set.mapsTo_image _ _).mono subset_rfl fun _ ↦ -+ by simp_all [verticalSegment_eq, RectangleBorder] -+ -+lemma mapsTo_rectangleBorder_left_im (z w : ℂ) : -+ MapsTo (fun (x : ℝ) => ↑x + z.im * I) [[z.re, w.re]] (RectangleBorder z w) := -+ (Set.mapsTo_image _ _).mono subset_rfl fun _ ↦ -+ by simp_all [horizontalSegment_eq, RectangleBorder] -+ -+lemma mapsTo_rectangleBorder_right_im (z w : ℂ) : -+ MapsTo (fun (x : ℝ) => ↑x + w.im * I) [[z.re, w.re]] (RectangleBorder z w) := -+ (Set.mapsTo_image _ _).mono subset_rfl fun _ ↦ -+ by simp_all [horizontalSegment_eq, RectangleBorder] -+ -+lemma mapsTo_rectangle_left_re_NoP (z w : ℂ) {p : ℂ} -+ (pNotOnBorder : p ∉ RectangleBorder z w) : -+ MapsTo (fun (y : ℝ) => ↑z.re + ↑y * I) [[z.im, w.im]] (Rectangle z w \ {p}) := by -+ refine (mapsTo_rectangleBorder_left_re z w).mono_right (Set.subset_sdiff.mpr ?_) -+ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ -+ -+lemma mapsTo_rectangle_right_re_NoP (z w : ℂ) {p : ℂ} -+ (pNotOnBorder : p ∉ RectangleBorder z w) : -+ MapsTo (fun (y : ℝ) => ↑w.re + ↑y * I) [[z.im, w.im]] (Rectangle z w \ {p}) := by -+ refine (mapsTo_rectangleBorder_right_re z w).mono_right (Set.subset_sdiff.mpr ?_) -+ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ -+ -+lemma mapsTo_rectangle_left_im_NoP (z w : ℂ) {p : ℂ} -+ (pNotOnBorder : p ∉ RectangleBorder z w) : -+ MapsTo (fun (x : ℝ) => ↑x + z.im * I) [[z.re, w.re]] (Rectangle z w \ {p}) := by -+ refine (mapsTo_rectangleBorder_left_im z w).mono_right (Set.subset_sdiff.mpr ?_) -+ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ -+ -+lemma mapsTo_rectangle_right_im_NoP (z w : ℂ) {p : ℂ} -+ (pNotOnBorder : p ∉ RectangleBorder z w) : -+ MapsTo (fun (x : ℝ) => ↑x + w.im * I) [[z.re, w.re]] (Rectangle z w \ {p}) := by -+ refine (mapsTo_rectangleBorder_right_im z w).mono_right (Set.subset_sdiff.mpr ?_) -+ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ -+ -+theorem not_mem_rectangleBorder_of_rectangle_mem_nhds {z w p : ℂ} -+ (hp : Rectangle z w ∈ 𝓝 p) : -+ p ∉ RectangleBorder z w := by -+ refine Set.disjoint_right.mp (rectangleBorder_disjoint_singleton ?_) rfl -+ have h1 := rectangle_mem_nhds_iff.mp hp -+ exact ⟨Set.ne_left_of_mem_uIoo h1.1, Set.ne_right_of_mem_uIoo h1.1, -+ Set.ne_left_of_mem_uIoo h1.2, Set.ne_right_of_mem_uIoo h1.2⟩ -+ -+theorem Complex.nhds_hasBasis_square (p : ℂ) : (𝓝 p).HasBasis (0 < ·) (Square p ·) := by -+ suffices -+ (𝓝 p.re ×ˢ 𝓝 p.im).HasBasis (0 < ·) -+ (equivRealProdCLM.symm.toHomeomorph ⁻¹' Square p ·) -+ by simpa only [← nhds_prod_eq, Homeomorph.map_nhds_eq, Homeomorph.image_preimage] -+ using! this.map equivRealProdCLM.symm.toHomeomorph -+ apply ((nhds_basis_Icc_pos p.re).prod_same_index_mono (nhds_basis_Icc_pos p.im) ?_ ?_).congr -+ · intro; rfl -+ · intros -+ rw [← uIcc_of_lt (by linarith), ← uIcc_of_lt (by linarith)] -+ simpa [Square, Rectangle] using by ring_nf -+ all_goals exact (antitone_const_tsub.Icc (monotone_id.const_add _)).monotoneOn _ -+ -+lemma square_mem_nhds (p : ℂ) {c : ℝ} (hc : c ≠ 0) : -+ Square p c ∈ 𝓝 p := by -+ wlog hc_pos : 0 < c generalizing c with h -+ · rw [← square_neg] -+ exact h (neg_ne_zero.mpr hc) <| neg_pos.mpr <| hc.lt_of_le <| not_lt.mp hc_pos -+ exact (Complex.nhds_hasBasis_square p).mem_of_mem hc_pos -+ -+lemma square_subset_square {p : ℂ} {c₁ c₂ : ℝ} (hc₁ : 0 < c₁) (hc : c₁ ≤ c₂) : -+ Square p c₁ ⊆ Square p c₂ := by -+ apply RectSubRect' <;> simpa using by linarith -+ -+lemma SmallSquareInRectangle {z w p : ℂ} (pInRectInterior : Rectangle z w ∈ nhds p) : -+ ∀ᶠ (c : ℝ) in 𝓝[>]0, Square p c ⊆ Rectangle z w := by -+ obtain ⟨ε, hε0, hε⟩ := ((Complex.nhds_hasBasis_square p).1 _).mp pInRectInterior -+ filter_upwards [Ioo_mem_nhdsGT (hε0)] with _ ⟨hε'0, hε'⟩ -+ exact subset_trans (square_subset_square hε'0 hε'.le) hε -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/ResidueCalcOnRectangles.lean b/PrimeNumberTheoremAnd/Erdos970/ResidueCalcOnRectangles.lean -new file mode 100644 -index 0000000..b976da3 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/ResidueCalcOnRectangles.lean -@@ -0,0 +1,1074 @@ -+import Mathlib.Analysis.Complex.CauchyIntegral -+import Mathlib.Analysis.Complex.Convex -+import Mathlib.Analysis.Complex.RemovableSingularity -+import Mathlib.Analysis.SpecialFunctions.Integrals.Basic -+import Mathlib.Analysis.Meromorphic.NormalForm -+import PrimeNumberTheoremAnd.Erdos970.Rectangle -+import PrimeNumberTheoremAnd.Erdos970.Tactic.AdditiveCombination -+ -+namespace Erdos970 -+ -+open _root_.Complex BigOperators Nat Classical Real Topology Filter -+open _root_.Set MeasureTheory intervalIntegral Asymptotics -+ -+open scoped Interval -+ -+variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {f g : ℂ → E} {z w p c A : ℂ} -+ {x x₁ x₂ y y₁ y₂ σ : ℝ} -+ -+noncomputable def HIntegral (f : ℂ → E) (x₁ x₂ y : ℝ) : E := -+ ∫ x in x₁..x₂, f (x + y * I) -+ -+noncomputable def VIntegral (f : ℂ → E) (x y₁ y₂ : ℝ) : E := -+ I • ∫ y in y₁..y₂, f (x + y * I) -+ -+noncomputable def HIntegral' (f : ℂ → E) (x₁ x₂ y : ℝ) : E := -+ (1 / (2 * π * I)) • HIntegral f x₁ x₂ y -+ -+noncomputable def VIntegral' (f : ℂ → E) (x y₁ y₂ : ℝ) : E := -+ (1 / (2 * π * I)) • VIntegral f x y₁ y₂ -+ -+lemma HIntegral_symm : -+ HIntegral f x₁ x₂ y = -HIntegral f x₂ x₁ y := integral_symm _ _ -+ -+lemma VIntegral_symm : -+ VIntegral f x y₁ y₂ = -VIntegral f x y₂ y₁ := by -+ simp_rw [VIntegral, integral_symm y₁ y₂, smul_neg, neg_neg] -+ -+noncomputable def RectangleIntegral (f : ℂ → E) (z w : ℂ) : E := -+ HIntegral f z.re w.re z.im - HIntegral f z.re w.re w.im + -+ VIntegral f w.re z.im w.im - VIntegral f z.re z.im w.im -+ -+noncomputable abbrev RectangleIntegral' (f : ℂ → E) (z w : ℂ) : E := -+ (1 / (2 * π * I)) • RectangleIntegral f z w -+ -+noncomputable def UpperUIntegral (f : ℂ → E) (σ σ' T : ℝ) : E := -+ HIntegral f σ σ' T + -+ I • (∫ y : ℝ in Ici T, f (σ' + y * I)) - -+ I • (∫ y : ℝ in Ici T, f (σ + y * I)) -+ -+noncomputable def LowerUIntegral (f : ℂ → E) (σ σ' T : ℝ) : E := -+ HIntegral f σ σ' (-T) - -+ I • (∫ y : ℝ in Iic (-T), f (σ' + y * I)) + -+ I • (∫ y : ℝ in Iic (-T), f (σ + y * I)) -+ -+noncomputable def VerticalIntegral (f : ℂ → E) (σ : ℝ) : E := -+ I • ∫ t : ℝ, f (σ + t * I) -+ -+noncomputable abbrev VerticalIntegral' (f : ℂ → E) (σ : ℝ) : E := -+ (1 / (2 * π * I)) • VerticalIntegral f σ -+ -+lemma verticalIntegral_split_three (a b : ℝ) -+ (hf : Integrable (fun t : ℝ ↦ f (σ + t * I))) : -+ VerticalIntegral f σ = -+ I • (∫ t in Iic a, f (σ + t * I)) + VIntegral f σ a b + -+ I • ∫ t in Ici b, f (σ + t * I) := by -+ simp_rw [VerticalIntegral, VIntegral, ← smul_add] -+ congr -+ rw [← integral_Iic_sub_Iic hf.restrict hf.restrict, add_sub_cancel, -+ integral_Iic_eq_integral_Iio, integral_Iio_add_Ici hf.restrict hf.restrict] -+ -+lemma DiffVertRect_eq_UpperLowerUs {σ σ' T : ℝ} -+ (f_int_σ : Integrable (fun (t : ℝ) ↦ f (σ + t * I))) -+ (f_int_σ' : Integrable (fun (t : ℝ) ↦ f (σ' + t * I))) : -+ VerticalIntegral f σ' - VerticalIntegral f σ - -+ RectangleIntegral f (σ - I * T) (σ' + I * T) = -+ UpperUIntegral f σ σ' T - LowerUIntegral f σ σ' T := by -+ rw [verticalIntegral_split_three (-T) T f_int_σ, verticalIntegral_split_three (-T) T f_int_σ'] -+ simp only [RectangleIntegral, UpperUIntegral, LowerUIntegral] -+ simp only [sub_re, mul_re, I_re, add_re, ofReal_re, I_im, ofReal_im, sub_im, mul_im, add_im] -+ ring_nf -+ abel -+ -+abbrev HolomorphicOn (f : ℂ → E) (s : Set ℂ) : Prop := -+ DifferentiableOn ℂ f s -+ -+theorem existsDifferentiableOn_of_bddAbove [CompleteSpace E] -+ {s : Set ℂ} {c : ℂ} (hc : s ∈ nhds c) -+ (hd : HolomorphicOn f (s \ {c})) -+ (hb : BddAbove (norm ∘ f '' (s \ {c}))) : -+ ∃ (g : ℂ → E), -+ HolomorphicOn g s ∧ Set.EqOn f g (s \ {c}) := -+ ⟨Function.update f c (limUnder (𝓝[{c}ᶜ] c) f), -+ differentiableOn_update_limUnder_of_bddAbove hc hd hb, -+ fun z hz ↦ if h : z = c then (hz.2 h).elim -+ else by simp [h]⟩ -+ -+theorem HolomorphicOn.vanishesOnRectangle [CompleteSpace E] -+ {U : Set ℂ} (f_holo : HolomorphicOn f U) -+ (hU : Rectangle z w ⊆ U) : -+ RectangleIntegral f z w = 0 := -+ integral_boundary_rect_eq_zero_of_differentiableOn f z w -+ (f_holo.mono hU) -+ -+theorem RectangleIntegral_congr (h : Set.EqOn f g (RectangleBorder z w)) : -+ RectangleIntegral f z w = RectangleIntegral g z w := by -+ unfold RectangleIntegral VIntegral -+ congrm ?_ - ?_ + I • ?_ - I • ?_ -+ all_goals refine integral_congr fun _ _ ↦ h ?_ -+ · exact Or.inl <| Or.inl <| Or.inl ⟨by simpa, by simp⟩ -+ · exact Or.inl <| Or.inr ⟨by simpa, by simp⟩ -+ · exact Or.inr ⟨by simp, by simpa⟩ -+ · exact Or.inl <| Or.inl <| Or.inr ⟨by simp, by simpa⟩ -+ -+theorem RectangleIntegral'_congr (h : Set.EqOn f g (RectangleBorder z w)) : -+ RectangleIntegral' f z w = RectangleIntegral' g z w := by -+ rw [RectangleIntegral', RectangleIntegral_congr h] -+ -+theorem rectangleIntegral_symm (f : ℂ → E) (z w : ℂ) : -+ RectangleIntegral f z w = RectangleIntegral f w z := by -+ simp_rw [RectangleIntegral, HIntegral, VIntegral, intervalIntegral.integral_symm w.re, -+ intervalIntegral.integral_symm w.im, sub_neg_eq_add, smul_neg, sub_neg_eq_add, -+ ← sub_eq_add_neg, neg_add_eq_sub, sub_add_eq_add_sub] -+ -+theorem rectangleIntegral_symm_re (f : ℂ → E) (z w : ℂ) : -+ RectangleIntegral f (w.re + z.im * I) (z.re + w.im * I) = -RectangleIntegral f z w := by -+ simp only [RectangleIntegral, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, -+ mul_one, sub_self, add_zero, add_im, mul_im, zero_add, neg_sub, ← sub_eq_zero, sub_zero] -+ rw [HIntegral_symm (y := z.im), HIntegral_symm (y := w.im)] -+ abel -+ -+def RectangleBorderIntegrable (f : ℂ → E) (z w : ℂ) : Prop := -+ IntervalIntegrable (fun x => f (x + z.im * I)) volume z.re w.re ∧ -+ IntervalIntegrable (fun x => f (x + w.im * I)) volume z.re w.re ∧ -+ IntervalIntegrable (fun y => f (w.re + y * I)) volume z.im w.im ∧ -+ IntervalIntegrable (fun y => f (z.re + y * I)) volume z.im w.im -+ -+theorem RectangleBorderIntegrable.add {f g : ℂ → E} -+ (hf : RectangleBorderIntegrable f z w) (hg : RectangleBorderIntegrable g z w) : -+ RectangleIntegral (f + g) z w = RectangleIntegral f z w + RectangleIntegral g z w := by -+ dsimp [RectangleIntegral, HIntegral, VIntegral] -+ have h₁ := intervalIntegral.integral_add hf.1 hg.1 -+ have h₂ := intervalIntegral.integral_add hf.2.1 hg.2.1 -+ have h₃ := intervalIntegral.integral_add hf.2.2.1 hg.2.2.1 -+ have h₄ := intervalIntegral.integral_add hf.2.2.2 hg.2.2.2 -+ rw [h₁, h₂, h₃, h₄] -+ module -+ -+omit [NormedSpace ℂ E] in -+theorem ContinuousOn.rectangleBorder_integrable (hf : ContinuousOn f (RectangleBorder z w)) : -+ RectangleBorderIntegrable f z w := -+ ⟨(hf.comp (by fun_prop) (mapsTo_rectangleBorder_left_im z w)).intervalIntegrable, -+ (hf.comp (by fun_prop) (mapsTo_rectangleBorder_right_im z w)).intervalIntegrable, -+ (hf.comp (by fun_prop) (mapsTo_rectangleBorder_right_re z w)).intervalIntegrable, -+ (hf.comp (by fun_prop) (mapsTo_rectangleBorder_left_re z w)).intervalIntegrable⟩ -+ -+omit [NormedSpace ℂ E] in -+theorem ContinuousOn.rectangleBorderIntegrable (hf : ContinuousOn f (Rectangle z w)) : -+ RectangleBorderIntegrable f z w := -+ ContinuousOn.rectangleBorder_integrable (hf.mono (rectangleBorder_subset_rectangle z w)) -+ -+omit [NormedSpace ℂ E] in -+theorem ContinuousOn.rectangleBorderNoPIntegrable -+ (hf : ContinuousOn f (Rectangle z w \ {p})) (pNotOnBorder : p ∉ RectangleBorder z w) : -+ RectangleBorderIntegrable f z w := by -+ refine ContinuousOn.rectangleBorder_integrable (hf.mono (Set.subset_sdiff.mpr ?_)) -+ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ -+ -+theorem HolomorphicOn.rectangleBorderIntegrable' -+ (hf : HolomorphicOn f (Rectangle z w \ {p})) (hp : Rectangle z w ∈ nhds p) : -+ RectangleBorderIntegrable f z w := -+ ContinuousOn.rectangleBorderNoPIntegrable hf.continuousOn -+ (not_mem_rectangleBorder_of_rectangle_mem_nhds hp) -+ -+theorem HolomorphicOn.rectangleBorderIntegrable (hf : HolomorphicOn f (Rectangle z w)) : -+ RectangleBorderIntegrable f z w := ContinuousOn.rectangleBorderIntegrable hf.continuousOn -+ -+lemma RectangleIntegralHSplit {a x₀ x₁ y₀ y₁ : ℝ} -+ (f_int_x₀_a_bot : IntervalIntegrable (fun x => f (↑x + ↑y₀ * I)) volume x₀ a) -+ (f_int_a_x₁_bot : IntervalIntegrable (fun x => f (↑x + ↑y₀ * I)) volume a x₁) -+ (f_int_x₀_a_top : IntervalIntegrable (fun x => f (↑x + ↑y₁ * I)) volume x₀ a) -+ (f_int_a_x₁_top : IntervalIntegrable (fun x => f (↑x + ↑y₁ * I)) volume a x₁) : -+ RectangleIntegral f (x₀ + y₀ * I) (x₁ + y₁ * I) = -+ RectangleIntegral f (x₀ + y₀ * I) (a + y₁ * I) + -+ RectangleIntegral f (a + y₀ * I) (x₁ + y₁ * I) := by -+ dsimp [RectangleIntegral, HIntegral, VIntegral] -+ simp only [Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, -+ Complex.I_im, mul_one, mul_zero, add_zero, zero_add, sub_self] -+ have h₁ := integral_add_adjacent_intervals f_int_x₀_a_bot f_int_a_x₁_bot -+ have h₂ := integral_add_adjacent_intervals f_int_x₀_a_top f_int_a_x₁_top -+ have h₁' : -+ (∫ (x : ℝ) in x₀..a, f (↑x + ↑y₀ * I)) + -+ ∫ (x : ℝ) in a..x₁, f (↑y₀ * I + ↑x) = -+ ∫ (x : ℝ) in x₀..x₁, f (↑x + ↑y₀ * I) := by -+ simpa [add_comm] using h₁ -+ have h₂' : -+ (∫ (x : ℝ) in x₀..a, f (↑x + ↑y₁ * I)) + -+ ∫ (x : ℝ) in a..x₁, f (↑y₁ * I + ↑x) = -+ ∫ (x : ℝ) in x₀..x₁, f (↑x + ↑y₁ * I) := by -+ simpa [add_comm] using h₂ -+ rw [← h₁', ← h₂'] -+ have hcomm₁ : -+ ∫ (x : ℝ) in a..x₁, f (↑y₀ * I + ↑x) = -+ ∫ (x : ℝ) in a..x₁, f (↑x + ↑y₀ * I) := by -+ apply intervalIntegral.integral_congr -+ intro x _ -+ exact congrArg f (by ring) -+ have hcomm₂ : -+ ∫ (x : ℝ) in a..x₁, f (↑y₁ * I + ↑x) = -+ ∫ (x : ℝ) in a..x₁, f (↑x + ↑y₁ * I) := by -+ apply intervalIntegral.integral_congr -+ intro x _ -+ exact congrArg f (by ring) -+ rw [hcomm₁, hcomm₂] -+ abel -+ -+lemma RectangleIntegralHSplit' {a x₀ x₁ y₀ y₁ : ℝ} -+ (ha : a ∈ [[x₀, x₁]]) -+ (hf : RectangleBorderIntegrable f (↑x₀ + ↑y₀ * I) (↑x₁ + ↑y₁ * I)) : -+ RectangleIntegral f (x₀ + y₀ * I) (x₁ + y₁ * I) = -+ RectangleIntegral f (x₀ + y₀ * I) (a + y₁ * I) + -+ RectangleIntegral f (a + y₀ * I) (x₁ + y₁ * I) := -+ RectangleIntegralHSplit -+ (IntervalIntegrable.mono (by simpa using hf.1) (uIcc_subset_uIcc left_mem_uIcc ha) le_rfl) -+ (IntervalIntegrable.mono (by simpa using hf.1) (uIcc_subset_uIcc ha right_mem_uIcc) le_rfl) -+ (IntervalIntegrable.mono (by simpa using hf.2.1) (uIcc_subset_uIcc left_mem_uIcc ha) le_rfl) -+ (IntervalIntegrable.mono (by simpa using hf.2.1) (uIcc_subset_uIcc ha right_mem_uIcc) le_rfl) -+ -+lemma RectangleIntegralVSplit {b x₀ x₁ y₀ y₁ : ℝ} -+ (f_int_y₀_b_left : IntervalIntegrable (fun y => f (x₀ + y * I)) volume y₀ b) -+ (f_int_b_y₁_left : IntervalIntegrable (fun y => f (x₀ + y * I)) volume b y₁) -+ (f_int_y₀_b_right : IntervalIntegrable (fun y => f (x₁ + y * I)) volume y₀ b) -+ (f_int_b_y₁_right : IntervalIntegrable (fun y => f (x₁ + y * I)) volume b y₁) : -+ RectangleIntegral f (x₀ + y₀ * I) (x₁ + y₁ * I) = -+ RectangleIntegral f (x₀ + y₀ * I) (x₁ + b * I) + -+ RectangleIntegral f (x₀ + b * I) (x₁ + y₁ * I) := by -+ dsimp [RectangleIntegral, HIntegral, VIntegral] -+ simp only [Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, -+ Complex.I_im, mul_one, mul_zero, add_zero, zero_add, sub_self] -+ have h₁ := integral_add_adjacent_intervals f_int_y₀_b_left f_int_b_y₁_left -+ have h₂ := integral_add_adjacent_intervals f_int_y₀_b_right f_int_b_y₁_right -+ rw [← h₁, ← h₂] -+ module -+ -+lemma RectangleIntegralVSplit' {b x₀ x₁ y₀ y₁ : ℝ} -+ (hb : b ∈ [[y₀, y₁]]) -+ (hf : RectangleBorderIntegrable f (↑x₀ + ↑y₀ * I) (↑x₁ + ↑y₁ * I)) : -+ RectangleIntegral f (x₀ + y₀ * I) (x₁ + y₁ * I) = -+ RectangleIntegral f (x₀ + y₀ * I) (x₁ + b * I) + -+ RectangleIntegral f (x₀ + b * I) (x₁ + y₁ * I) := -+ RectangleIntegralVSplit -+ (IntervalIntegrable.mono (by simpa using hf.2.2.2) (uIcc_subset_uIcc left_mem_uIcc hb) le_rfl) -+ (IntervalIntegrable.mono (by simpa using hf.2.2.2) (uIcc_subset_uIcc hb right_mem_uIcc) le_rfl) -+ (IntervalIntegrable.mono (by simpa using hf.2.2.1) (uIcc_subset_uIcc left_mem_uIcc hb) le_rfl) -+ (IntervalIntegrable.mono (by simpa using hf.2.2.1) (uIcc_subset_uIcc hb right_mem_uIcc) le_rfl) -+ -+lemma RectanglePullToNhdOfPole' [CompleteSpace E] {z₀ z₁ z₂ z₃ p : ℂ} -+ (h_orientation : z₀.re ≤ z₃.re ∧ z₀.im ≤ z₃.im ∧ -+ z₁.re ≤ z₂.re ∧ z₁.im ≤ z₂.im) -+ (hp : Rectangle z₁ z₂ ∈ 𝓝 p) (hz : Rectangle z₁ z₂ ⊆ Rectangle z₀ z₃) -+ (fHolo : HolomorphicOn f (Rectangle z₀ z₃ \ {p})) : -+ RectangleIntegral f z₀ z₃ = RectangleIntegral f z₁ z₂ := by -+ obtain ⟨hz₀_re, hz₀_im, hz₁_re, hz₁_im⟩ := h_orientation -+ have := rect_subset_iff.mp hz -+ rw [Rectangle, uIcc_of_le hz₀_re, uIcc_of_le hz₀_im] at this -+ obtain ⟨⟨⟨_, _⟩, ⟨_, _⟩⟩, ⟨_, _⟩, ⟨_, _⟩⟩ := this -+ obtain ⟨⟨_, _⟩, ⟨_, _⟩⟩ := -+ (uIoo_of_le hz₁_re) ▸ (uIoo_of_le hz₁_im) ▸ rectangle_mem_nhds_iff.mp hp -+ obtain ⟨_, _, _, _⟩ := show -+ p.re < z₂.re ∧ p.re < z₃.re ∧ p.im < z₂.im ∧ p.im < z₃.im from -+ ⟨by linarith, by linarith, by linarith, by linarith⟩ -+ obtain ⟨_, _, _, _⟩ := show -+ z₀.re < p.re ∧ z₁.re < p.re ∧ z₀.im < p.im ∧ z₁.im < p.im from -+ ⟨by linarith, by linarith, by linarith, by linarith⟩ -+ have fCont := fHolo.continuousOn -+ have hbot : RectangleBorderIntegrable f (↑z₀.re + ↑z₀.im * I) -+ (↑z₃.re + ↑z₃.im * I) := ?_ -+ have htop : RectangleBorderIntegrable f (↑z₀.re + ↑z₁.im * I) -+ (↑z₃.re + ↑z₃.im * I) := ?_ -+ have hleft : RectangleBorderIntegrable f (↑z₀.re + ↑z₁.im * I) -+ (↑z₃.re + ↑z₂.im * I) := ?_ -+ have hright : RectangleBorderIntegrable f (↑z₁.re + ↑z₁.im * I) -+ (↑z₃.re + ↑z₂.im * I) := ?_ -+ all_goals try { -+ refine ContinuousOn.rectangleBorder_integrable -+ (fCont.mono (rectangleBorder_subset_punctured_rect ?_ ?_)) -+ · simp_all -+ · simpa using ⟨by linarith, by linarith, by linarith, by linarith⟩ -+ } -+ have hbot' : z₁.im ∈ [[z₀.im, z₃.im]] := ?_ -+ have htop' : z₂.im ∈ [[z₁.im, z₃.im]] := ?_ -+ have hleft' : z₁.re ∈ [[z₀.re, z₃.re]] := ?_ -+ have hright' : z₂.re ∈ [[z₁.re, z₃.re]] := ?_ -+ all_goals try { -+ rw [Set.uIcc_of_le] -+ constructor -+ all_goals assumption -+ } -+ have hbot'' : Rectangle (↑z₀.re + ↑z₀.im * I) (↑z₃.re + ↑z₁.im * I) ⊆ -+ Rectangle z₀ z₃ \ {p} := ?_ -+ have htop'' : Rectangle (↑z₀.re + ↑z₂.im * I) (↑z₃.re + ↑z₃.im * I) ⊆ -+ Rectangle z₀ z₃ \ {p} := ?_ -+ have hleft'' : Rectangle (↑z₀.re + ↑z₁.im * I) (↑z₁.re + ↑z₂.im * I) ⊆ -+ Rectangle z₀ z₃ \ {p} := ?_ -+ have hright'' : Rectangle (↑z₂.re + ↑z₁.im * I) (↑z₃.re + ↑z₂.im * I) ⊆ -+ Rectangle z₀ z₃ \ {p} := ?_ -+ all_goals try { apply rectangle_subset_punctured_rect <;> simp_all } -+ have h₁ := RectangleIntegralVSplit' hbot' hbot -+ have h₂ := fHolo.vanishesOnRectangle hbot'' -+ have h₃ := RectangleIntegralVSplit' htop' htop -+ have h₄ := fHolo.vanishesOnRectangle htop'' -+ have h₅ := RectangleIntegralHSplit' hleft' hleft -+ have h₆ := fHolo.vanishesOnRectangle hleft'' -+ have h₇ := RectangleIntegralHSplit' hright' hright -+ have h₈ := fHolo.vanishesOnRectangle hright'' -+ simp only [re_add_im] at * -+ additive_combination h₁ + h₂ + h₃ + h₄ + h₅ + h₆ + h₇ + h₈ -+ -+lemma RectanglePullToNhdOfPole [CompleteSpace E] {z w p : ℂ} -+ (zRe_lt_wRe : z.re ≤ w.re) (zIm_lt_wIm : z.im ≤ w.im) -+ (hp : Rectangle z w ∈ 𝓝 p) (fHolo : HolomorphicOn f (Rectangle z w \ {p})) : -+ ∀ᶠ (c : ℝ) in 𝓝[>]0, -+ RectangleIntegral f z w = RectangleIntegral f (-c - I * c + p) (c + I * c + p) := by -+ filter_upwards [Ioo_mem_nhdsGT zero_lt_one, SmallSquareInRectangle hp] -+ intro c ⟨cpos, _⟩ hc -+ simp_rw [mul_comm I] -+ exact RectanglePullToNhdOfPole' (by simp_all [cpos.le]) -+ (square_mem_nhds p (ne_of_gt cpos)) hc fHolo -+ -+lemma RectanglePullToNhdOfPole'' [CompleteSpace E] {z w p : ℂ} -+ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) -+ (pInRectInterior : Rectangle z w ∈ 𝓝 p) (fHolo : HolomorphicOn f (Rectangle z w \ {p})) : -+ ∀ᶠ (c : ℝ) in 𝓝[>]0, -+ RectangleIntegral' f z w = RectangleIntegral' f (-c - I * c + p) (c + I * c + p) := by -+ filter_upwards [RectanglePullToNhdOfPole zRe_le_wRe zIm_le_wIm pInRectInterior fHolo] with c h -+ simp_rw [RectangleIntegral', h] -+ -+theorem ResidueTheoremAtOrigin_aux1c (a b : ℝ) : -+ let f : ℝ → ℂ := fun y => (y + I)⁻¹ -+ IntervalIntegrable f volume a b := -+ (ContinuousOn.inv₀ (by fun_prop) -+ (by simp [Complex.ext_iff])).intervalIntegrable -+ -+theorem ResidueTheoremAtOrigin_aux1c' (a b : ℝ) : -+ let f : ℝ → ℂ := fun y => (y - I)⁻¹ -+ IntervalIntegrable f volume a b := -+ (ContinuousOn.inv₀ (by fun_prop) -+ (by simp [Complex.ext_iff])).intervalIntegrable -+ -+theorem ResidueTheoremAtOrigin_aux2c (a b : ℝ) : -+ let f : ℝ → ℂ := fun y => (1 + y * I)⁻¹ -+ IntervalIntegrable f volume a b := -+ (ContinuousOn.inv₀ (by fun_prop) -+ (by simp [Complex.ext_iff])).intervalIntegrable -+ -+theorem ResidueTheoremAtOrigin_aux2c' (a b : ℝ) : -+ let f : ℝ → ℂ := fun y => (-1 + y * I)⁻¹ -+ IntervalIntegrable f volume a b := -+ (ContinuousOn.inv₀ (by fun_prop) -+ (by simp [Complex.ext_iff])).intervalIntegrable -+ -+theorem RectangleIntegral.const_smul (f : ℂ → E) (z w c : ℂ) : -+ RectangleIntegral (fun s => c • f s) z w = c • RectangleIntegral f z w := by -+ simp [RectangleIntegral, HIntegral, VIntegral, smul_add, smul_sub, smul_smul, mul_comm] -+ -+theorem RectangleIntegral.const_mul' (f : ℂ → E) (z w c : ℂ) : -+ RectangleIntegral' (fun s => c • f s) z w = c • RectangleIntegral' f z w := by -+ simp [RectangleIntegral', RectangleIntegral.const_smul, smul_smul] -+ ring_nf -+ -+theorem RectangleIntegral.translate (f : ℂ → E) (z w p : ℂ) : -+ RectangleIntegral (fun s => f (s - p)) z w = RectangleIntegral f (z - p) (w - p) := by -+ simp_rw [RectangleIntegral, HIntegral, VIntegral, sub_re, sub_im, -+ ← intervalIntegral.integral_comp_sub_right] -+ congr <;> ext <;> congr 1 <;> simp [Complex.ext_iff] -+ -+theorem RectangleIntegral.translate' (f : ℂ → E) (z w p : ℂ) : -+ RectangleIntegral' (fun s => f (s - p)) z w = RectangleIntegral' f (z - p) (w - p) := by -+ simp_rw [RectangleIntegral', RectangleIntegral.translate] -+ -+lemma Complex.inv_re_add_im : (x + y * I)⁻¹ = (x - I * y) / (x ^ 2 + y ^ 2) := by -+ rw [Complex.inv_def, div_eq_mul_inv] -+ congr <;> simp [conj_ofReal, normSq] <;> ring -+ -+lemma sq_add_sq_ne_zero (hy : y ≠ 0) : x ^ 2 + y ^ 2 ≠ 0 := by -+ linarith [sq_nonneg x, sq_pos_iff.mpr hy] -+ -+lemma continuous_self_div_sq_add_sq (hy : y ≠ 0) : -+ Continuous fun x => x / (x ^ 2 + y ^ 2) := -+ continuous_id.div (continuous_id.pow 2 |>.add continuous_const) (fun _ => sq_add_sq_ne_zero hy) -+ -+lemma integral_self_div_sq_add_sq (hy : y ≠ 0) : -+ ∫ x in x₁..x₂, x / (x ^ 2 + y ^ 2) = -+ Real.log (x₂ ^ 2 + y ^ 2) / 2 - Real.log (x₁ ^ 2 + y ^ 2) / 2 := by -+ let f (x : ℝ) : ℝ := Real.log (x ^ 2 + y ^ 2) / 2 -+ have e1 {x} := HasDerivAt.add_const (y ^ 2) (by simpa using hasDerivAt_pow 2 x) -+ have e2 {x} : HasDerivAt f (x / (x ^ 2 + y ^ 2)) x := by -+ convert! (e1.log (sq_add_sq_ne_zero hy)).div_const 2 using 1 -+ field_simp -+ have e3 : deriv f = fun x => x / (x ^ 2 + y ^ 2) := funext (fun _ => e2.deriv) -+ have e4 : Continuous (deriv f) := by simpa only [e3] using continuous_self_div_sq_add_sq hy -+ simp_rw [← e2.deriv] -+ exact integral_deriv_eq_sub (fun _ _ => e2.differentiableAt) (e4.intervalIntegrable _ _) -+ -+lemma integral_const_div_sq_add_sq (hy : y ≠ 0) : -+ ∫ x in x₁..x₂, y / (x ^ 2 + y ^ 2) = arctan (x₂ / y) - arctan (x₁ / y) := by -+ nth_rewrite 1 [← div_mul_cancel₀ x₁ hy, ← div_mul_cancel₀ x₂ hy] -+ simp_rw [← mul_integral_comp_mul_right, ← intervalIntegral.integral_const_mul, -+ ← integral_one_div_one_add_sq] -+ exact integral_congr fun x _ => by -+ field_simp -+ ring -+ -+lemma integral_const_div_self_add_im (hy : y ≠ 0) : -+ ∫ x : ℝ in x₁..x₂, A / (x + y * I) = -+ A * (Real.log (x₂ ^ 2 + y ^ 2) / 2 - Real.log (x₁ ^ 2 + y ^ 2) / 2) - -+ A * I * (arctan (x₂ / y) - arctan (x₁ / y)) := by -+ have e1 {x : ℝ} : A / (x + y * I) = A * x / (x ^ 2 + y ^ 2) - A * I * y / (x ^ 2 + y ^ 2) := by -+ ring_nf -+ simp_rw [Complex.inv_re_add_im] -+ ring -+ have e2 : IntervalIntegrable (fun x ↦ A * x / (x ^ 2 + y ^ 2)) volume x₁ x₂ := by -+ apply Continuous.intervalIntegrable -+ simp_rw [mul_div_assoc] -+ norm_cast -+ exact continuous_const.mul (continuous_ofReal.comp (continuous_self_div_sq_add_sq hy)) -+ have e3 : IntervalIntegrable (fun x ↦ A * I * y / (x ^ 2 + y ^ 2)) volume x₁ x₂ := by -+ apply Continuous.intervalIntegrable -+ refine continuous_const.div (by fun_prop) (fun x => ?_) -+ norm_cast -+ exact sq_add_sq_ne_zero hy -+ simp_rw [integral_congr (fun _ _ => e1), integral_sub e2 e3, mul_div_assoc] -+ norm_cast -+ simp_rw [intervalIntegral.integral_const_mul, intervalIntegral.integral_ofReal, -+ integral_self_div_sq_add_sq hy, integral_const_div_sq_add_sq hy] -+ -+lemma integral_const_div_re_add_self (hx : x ≠ 0) : -+ ∫ y : ℝ in y₁..y₂, A / (x + y * I) = -+ A / I * (Real.log (y₂ ^ 2 + (-x) ^ 2) / 2 - Real.log (y₁ ^ 2 + (-x) ^ 2) / 2) - -+ A / I * I * (arctan (y₂ / -x) - arctan (y₁ / -x)) := by -+ have l1 {y : ℝ} : A / (x + y * I) = A / I / (y + ↑(-x) * I) := by -+ have e1 : x + y * I ≠ 0 := by -+ contrapose! hx -+ simpa using congr_arg re hx -+ have e2 : y + I * ↑(-x) ≠ 0 := by -+ contrapose! hx -+ simpa using congr_arg im hx -+ field_simp [*] -+ push_cast -+ ring_nf -+ simp -+ have l2 : -x ≠ 0 := by rwa [neg_ne_zero] -+ simp_rw [l1, integral_const_div_self_add_im l2] -+ -+lemma ResidueTheoremAtOrigin' {z w c : ℂ} -+ (h1 : z.re < 0) (h2 : z.im < 0) (h3 : 0 < w.re) (h4 : 0 < w.im) : -+ RectangleIntegral (fun s => c / s) z w = 2 * I * π * c := by -+ simp only [RectangleIntegral, HIntegral, VIntegral, smul_eq_mul] -+ rw [integral_const_div_re_add_self h1.ne, integral_const_div_re_add_self h3.ne.symm] -+ rw [integral_const_div_self_add_im h2.ne, integral_const_div_self_add_im h4.ne.symm] -+ have l1 : z.im * w.re⁻¹ = (w.re * z.im⁻¹)⁻¹ := by group -+ have l3 := arctan_inv_of_neg <| mul_neg_of_pos_of_neg h3 <| inv_lt_zero.mpr h2 -+ have l4 : w.im * z.re⁻¹ = (z.re * w.im⁻¹)⁻¹ := by group -+ have l6 := arctan_inv_of_neg <| mul_neg_of_neg_of_pos h1 <| inv_pos.mpr h4 -+ have r1 : z.im * z.re⁻¹ = (z.re * z.im⁻¹)⁻¹ := by group -+ have r3 := arctan_inv_of_pos <| mul_pos_of_neg_of_neg h1 <| inv_lt_zero.mpr h2 -+ have r4 : w.im * w.re⁻¹ = (w.re * w.im⁻¹)⁻¹ := by group -+ have r6 := arctan_inv_of_pos <| mul_pos h3 <| inv_pos.mpr h4 -+ ring_nf -+ simp only [one_div, inv_I, mul_neg, neg_mul, I_sq, neg_neg, arctan_neg, ofReal_neg, -+ sub_neg_eq_add] -+ rw [l1, l3, l4, l6, r1, r3, r4, r6] -+ ring_nf -+ simp only [I_sq, ofReal_sub, ofReal_mul, ofReal_ofNat, ofReal_div, ofReal_neg, ofReal_one] -+ ring_nf -+ -+theorem ResidueTheoremInRectangle -+ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) -+ (pInRectInterior : Rectangle z w ∈ 𝓝 p) : -+ RectangleIntegral' (fun s => c / (s - p)) z w = c := by -+ simp only [rectangle_mem_nhds_iff, uIoo_of_le zRe_le_wRe, uIoo_of_le zIm_le_wIm, -+ mem_reProdIm, mem_Ioo] at pInRectInterior -+ rw [RectangleIntegral.translate', RectangleIntegral'] -+ have : 1 / (2 * ↑π * I) * (2 * I * ↑π * c) = c := by -+ field_simp -+ rwa [ResidueTheoremAtOrigin'] -+ all_goals simp [*] -+ -+lemma ResidueTheoremAtOrigin : -+ RectangleIntegral' (fun s ↦ 1 / s) (-1 - I) (1 + I) = 1 := by -+ rw [RectangleIntegral', ResidueTheoremAtOrigin'] -+ all_goals simp [field] -+ -+lemma ResidueTheoremOnRectangleWithSimplePole {f g : ℂ → ℂ} {z w p A : ℂ} -+ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) -+ (pInRectInterior : Rectangle z w ∈ 𝓝 p) (gHolo : HolomorphicOn g (Rectangle z w)) -+ (principalPart : Set.EqOn (f - fun s ↦ A / (s - p)) g (Rectangle z w \ {p})) : -+ RectangleIntegral' f z w = A := by -+ have principalPart' : Set.EqOn f (g + (fun s ↦ A / (s - p))) (Rectangle z w \ {p}) := -+ fun s hs => by rw [Pi.add_apply, ← principalPart hs, Pi.sub_apply, sub_add_cancel] -+ have : Set.EqOn f (g + (fun s ↦ A / (s - p))) (RectangleBorder z w) := -+ principalPart'.mono <| Set.subset_sdiff.mpr -+ ⟨rectangleBorder_subset_rectangle z w, -+ disjoint_singleton_right.mpr -+ (not_mem_rectangleBorder_of_rectangle_mem_nhds pInRectInterior)⟩ -+ rw [RectangleIntegral'_congr this] -+ have t1 : RectangleBorderIntegrable g z w := -+ gHolo.rectangleBorderIntegrable -+ have t2 : HolomorphicOn (fun s ↦ A / (s - p)) (Rectangle z w \ {p}) := by -+ apply DifferentiableOn.mono (t := {p}ᶜ) -+ · apply DifferentiableOn.div -+ · exact differentiableOn_const _ -+ · exact DifferentiableOn.sub differentiableOn_id (differentiableOn_const _) -+ · exact fun x hx => by -+ rw [sub_ne_zero] -+ exact hx -+ · rintro s ⟨_, hs⟩ -+ exact hs -+ have t3 : RectangleBorderIntegrable (fun s ↦ A / (s - p)) z w := -+ HolomorphicOn.rectangleBorderIntegrable' t2 pInRectInterior -+ rw [RectangleIntegral', RectangleBorderIntegrable.add t1 t3, smul_add] -+ rw [gHolo.vanishesOnRectangle (by rfl), smul_zero, zero_add] -+ exact ResidueTheoremInRectangle zRe_le_wRe zIm_le_wIm pInRectInterior -+ -+lemma IsBigO_to_BddAbove {f : ℂ → ℂ} {p : ℂ} -+ (f_near_p : f =O[𝓝[≠] p] (1 : ℂ → ℂ)) : -+ ∃ U ∈ 𝓝 p, BddAbove (norm ∘ f '' (U \ {p})) := by -+ simp only [isBigO_iff, Pi.one_apply, one_mem, CStarRing.norm_of_mem_unitary, mul_one] at f_near_p -+ obtain ⟨c, hc⟩ := f_near_p -+ dsimp [Filter.Eventually, nhdsWithin] at hc -+ rw [mem_inf_principal'] at hc -+ obtain ⟨U, hU, ⟨U_is_open, p_in_U⟩⟩ := mem_nhds_iff.mp hc -+ use U -+ constructor -+ · exact IsOpen.mem_nhds U_is_open p_in_U -+ · refine bddAbove_def.mpr ?_ -+ use c -+ intro y hy -+ simp only [Function.comp_apply, mem_image, Set.mem_sdiff, mem_singleton_iff] at hy -+ obtain ⟨x, ⟨x_in_U, x_not_p⟩, fxy⟩ := hy -+ rw [← fxy] -+ simpa [x_not_p] using hU x_in_U -+ -+theorem BddAbove_on_rectangle_of_bdd_near {z w p : ℂ} {f : ℂ → ℂ} -+ (f_cont : ContinuousOn f (Rectangle z w \ {p})) -+ (f_near_p : f =O[𝓝[≠] p] (1 : ℂ → ℂ)) : -+ BddAbove (norm ∘ f '' (Rectangle z w \ {p})) := by -+ obtain ⟨V, V_in_nhds, V_prop⟩ := IsBigO_to_BddAbove f_near_p -+ rw [mem_nhds_iff] at V_in_nhds -+ obtain ⟨W, W_subset, W_open, p_in_W⟩ := V_in_nhds -+ set U := Rectangle z w -+ have : U \ {p} = (U \ W) ∪ ((U ∩ W) \ {p}) := by -+ ext x -+ simp only [Set.mem_sdiff, mem_singleton_iff, mem_union, mem_inter_iff] -+ constructor -+ · intro ⟨xu, x_not_p⟩ -+ tauto -+ · intro h -+ rcases h with ⟨h1, h2⟩ | ⟨⟨h1, h2⟩, h3⟩ -+ · refine ⟨h1, ?_⟩ -+ intro h -+ rw [← h] at p_in_W -+ exact h2 p_in_W -+ · tauto -+ rw [this, image_union] -+ apply BddAbove.union -+ · apply IsCompact.bddAbove_image -+ · apply IsCompact.diff _ W_open -+ exact IsCompact.reProdIm isCompact_uIcc isCompact_uIcc -+ · apply f_cont.norm.mono -+ apply Set.sdiff_subset_sdiff_right -+ simpa -+ · exact V_prop.mono -+ (image_mono <| Set.sdiff_subset_sdiff_left <| subset_trans inter_subset_right W_subset) -+ -+theorem ResidueTheoremOnRectangleWithSimplePole' {f : ℂ → ℂ} {z w p A : ℂ} -+ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) -+ (pInRectInterior : Rectangle z w ∈ 𝓝 p) (fHolo : HolomorphicOn f (Rectangle z w \ {p})) -+ (near_p : (f - (fun s ↦ A / (s - p))) =O[𝓝[≠] p] (1 : ℂ → ℂ)) : -+ RectangleIntegral' f z w = A := by -+ set g := f - (fun s ↦ A / (s - p)) -+ have gHolo : HolomorphicOn g (Rectangle z w \ {p}) := by -+ apply DifferentiableOn.sub fHolo -+ intro s hs -+ have : s - p ≠ 0 := sub_ne_zero.mpr hs.2 -+ exact DifferentiableWithinAt.div (by fun_prop) (by fun_prop) this -+ have := BddAbove_on_rectangle_of_bdd_near gHolo.continuousOn near_p -+ obtain ⟨h, ⟨hHolo, hEq⟩⟩ := existsDifferentiableOn_of_bddAbove pInRectInterior gHolo this -+ exact ResidueTheoremOnRectangleWithSimplePole zRe_le_wRe zIm_le_wIm pInRectInterior hHolo hEq -+ -+def HasSimplePolesOn (f : ℂ → ℂ) (s : Set ℂ) : Prop := -+ ∀ z ∈ s, (-1 : ℤ) ≤ meromorphicOrderAt f z -+ -+lemma HasSimplePolesOn.mono {f : ℂ → ℂ} {s t : Set ℂ} -+ (h : HasSimplePolesOn f t) (hst : s ⊆ t) : HasSimplePolesOn f s := by -+ intro z hz -+ exact h z (hst hz) -+ -+noncomputable def residue (f : ℂ → ℂ) (z₀ : ℂ) : ℂ := -+ Filter.limUnder (nhdsWithin z₀ {z₀}ᶜ) (fun z ↦ (z - z₀) * f z) -+ -+noncomputable def sumResiduesIn (f : ℂ → ℂ) (S : Set ℂ) : ℂ := -+ ∑' z : S, residue f z -+ -+lemma residue_eq_of_tendsto {f : ℂ → ℂ} {p c : ℂ} -+ (h : Filter.Tendsto (fun z ↦ (z - p) * f z) (nhdsWithin p {p}ᶜ) (nhds c)) : -+ residue f p = c := by -+ unfold residue -+ exact h.limUnder_eq -+ -+lemma residue_analyticAt_eq_zero {f : ℂ → ℂ} {p : ℂ} (hf : AnalyticAt ℂ f p) : -+ residue f p = 0 := by -+ apply residue_eq_of_tendsto -+ have hsub : Filter.Tendsto (fun z : ℂ ↦ z - p) (nhdsWithin p {p}ᶜ) (nhds 0) := -+ tendsto_sub_nhds_zero_iff.mpr (tendsto_id.mono_left nhdsWithin_le_nhds) -+ have hf' : Filter.Tendsto f (nhdsWithin p {p}ᶜ) (nhds (f p)) := -+ hf.continuousAt.continuousWithinAt.tendsto -+ simpa using hsub.mul hf' -+ -+lemma simplePole_sub_residue_isBigO_one {f : ℂ → ℂ} {p : ℂ} -+ (hf : MeromorphicAt f p) (hord : meromorphicOrderAt f p = (-1 : ℤ)) : -+ (f - (fun z ↦ residue f p / (z - p))) =O[nhdsWithin p {p}ᶜ] (1 : ℂ → ℂ) := by -+ obtain ⟨g, hg_analytic, hg_ne, hg_eq⟩ := (meromorphicOrderAt_eq_int_iff hf).1 hord -+ have hres : residue f p = g p := -+ residue_eq_of_tendsto (hg_analytic.continuousAt.continuousWithinAt.tendsto.congr' -+ (show (fun z ↦ (z - p) * f z) =ᶠ[nhdsWithin p {p}ᶜ] g from by -+ filter_upwards [hg_eq, self_mem_nhdsWithin] with z hz hz_ne -+ simp [hz, sub_ne_zero.mpr hz_ne]).symm) -+ have hdslope : (fun z ↦ (z - p)⁻¹ * (g z - g p)) =O[nhdsWithin p {p}ᶜ] (1 : ℂ → ℂ) := by -+ have hcont : ContinuousAt (dslope g p) p := -+ continuousAt_dslope_same.2 hg_analytic.differentiableAt -+ have hbig : dslope g p =O[nhds p] (1 : ℂ → ℂ) := -+ hcont.norm.isBoundedUnder_le.isBigO_one ℂ -+ have hbig_ne : dslope g p =O[nhdsWithin p {p}ᶜ] (1 : ℂ → ℂ) := -+ IsBigO.mono hbig inf_le_left -+ simpa [slope] using! hbig_ne.congr' (dslope_eventuallyEq_slope_nhdsNE (f := g) (a := p)) .rfl -+ refine hdslope.congr' ?_ .rfl -+ filter_upwards [hg_eq, self_mem_nhdsWithin] with z hz hz_ne -+ simp [hz, hres, div_eq_mul_inv, sub_eq_add_neg]; ring -+ -+private lemma intervalIntegral_congr_ae_of_codiscreteWithin_along_path -+ {f g : ℂ → ℂ} {R : Set ℂ} -+ (heq : {s : ℂ | f s = g s} ∈ Filter.codiscreteWithin R) -+ {a b : ℝ} {p : ℝ → ℂ} -+ (hp_an : AnalyticOnNhd ℝ p (Set.uIcc a b)) -+ (hp_nonconst : ∀ x ∈ Set.uIcc a b, ¬Filter.EventuallyConst p (nhds x)) -+ (hp_maps : Set.MapsTo p (Set.uIcc a b) R) : -+ ∫ x in a..b, f (p x) = ∫ x in a..b, g (p x) := by -+ refine intervalIntegral.integral_congr_ae_restrict (μ := volume) ?_ -+ apply ae_restrict_le_codiscreteWithin measurableSet_uIoc -+ change {x : ℝ | f (p x) = g (p x)} ∈ Filter.codiscreteWithin (Set.uIoc a b) -+ simpa [Set.preimage] using Filter.codiscreteWithin_mono Set.uIoc_subset_uIcc -+ (hp_an.preimage_mem_codiscreteWithin hp_nonconst -+ (Filter.codiscreteWithin_mono -+ (by intro s hs; rcases hs with ⟨x, hx, rfl⟩; exact hp_maps hx) heq)) -+ -+private lemma meromorphicOrderAt_eq_neg_one_of_simplePole -+ {f : ℂ → ℂ} {U : Set ℂ} {p : ℂ} -+ (hpU : p ∈ U) -+ (hf_simple : HasSimplePolesOn f U) -+ (hpneg : meromorphicOrderAt f p < 0) : -+ meromorphicOrderAt f p = (-1 : ℤ) := by -+ lift meromorphicOrderAt f p to ℤ using hpneg.ne_top with n hn -+ have hsimple : (-1 : ℤ) ≤ n := WithTop.coe_le_coe.mp (hn ▸ hf_simple p hpU) -+ have hneg : n < 0 := by exact_mod_cast hpneg -+ have hn1 : n = -1 := by omega -+ simp [hn1] -+ -+private lemma residue_toMeromorphicNFOn_eq_residue -+ {f : ℂ → ℂ} {U : Set ℂ} {p : ℂ} -+ (hpU : p ∈ U) -+ (hf_mero : MeromorphicOn f U) -+ (hf_simple : HasSimplePolesOn f U) -+ (hpneg : meromorphicOrderAt f p < 0) : -+ residue (toMeromorphicNFOn f U) p = residue f p := by -+ have hmero : MeromorphicAt f p := hf_mero p hpU -+ have h_exists : ∃ c, Filter.Tendsto (fun z : ℂ ↦ (z - p) * f z) (nhdsWithin p ({p}ᶜ)) (nhds c) := by -+ have hmul_mero : MeromorphicAt (fun z : ℂ ↦ (z - p) * f z) p := -+ (by fun_prop : MeromorphicAt (fun z : ℂ ↦ z - p) p).mul hmero -+ have hmul_nonneg : 0 ≤ meromorphicOrderAt (fun z : ℂ ↦ (z - p) * f z) p := by -+ change 0 ≤ meromorphicOrderAt ((fun z ↦ z - p) * f) p -+ rw [meromorphicOrderAt_mul (by fun_prop : MeromorphicAt (fun z : ℂ ↦ z - p) p) hmero, -+ meromorphicOrderAt_id_sub_const, -+ meromorphicOrderAt_eq_neg_one_of_simplePole hpU hf_simple hpneg] -+ norm_num -+ exact tendsto_nhds_of_meromorphicOrderAt_nonneg hmul_mero hmul_nonneg -+ have h_tendsto : Filter.Tendsto (fun z : ℂ ↦ (z - p) * f z) (nhdsWithin p ({p}ᶜ)) (nhds (residue f p)) := by -+ simpa [residue] using tendsto_nhds_limUnder h_exists -+ have h_eq : -+ (fun z ↦ (z - p) * toMeromorphicNFOn f U z) =ᶠ[nhdsWithin p ({p}ᶜ)] -+ (fun z ↦ (z - p) * f z) := by -+ filter_upwards [hf_mero.toMeromorphicNFOn_eq_self_on_nhdsNE hpU] with z hz -+ simp [hz] -+ exact residue_eq_of_tendsto -+ (h_tendsto.congr' h_eq.symm) -+ -+private lemma horizontalPath_not_eventuallyConst (h : ℝ) (x : ℝ) : -+ ¬Filter.EventuallyConst (fun r : ℝ ↦ (r : ℂ) + (h : ℂ) * Complex.I) (nhds x) := by -+ intro hc -+ obtain ⟨c, hc⟩ := Filter.eventuallyConst_iff_exists_eventuallyEq.1 hc -+ have hpath : HasDerivAt (fun r : ℝ ↦ (r : ℂ) + (h : ℂ) * Complex.I) 1 x := by -+ simpa using (Complex.ofRealCLM.hasDerivAt (x := x)).add_const ((h : ℂ) * Complex.I) -+ have hconst : HasDerivAt (fun r : ℝ ↦ (r : ℂ) + (h : ℂ) * Complex.I) 0 x := -+ (hasDerivAt_const x c).congr_of_eventuallyEq hc -+ exact one_ne_zero (hpath.unique hconst) -+ -+lemma verticalPath_not_eventuallyConst (r : ℝ) (x : ℝ) : -+ ¬Filter.EventuallyConst (fun y : ℝ ↦ (r : ℂ) + (y : ℂ) * Complex.I) (nhds x) := by -+ intro hc -+ obtain ⟨c, hc⟩ := Filter.eventuallyConst_iff_exists_eventuallyEq.1 hc -+ have hpath : HasDerivAt (fun y : ℝ ↦ (r : ℂ) + (y : ℂ) * Complex.I) Complex.I x := by -+ simpa using ((Complex.ofRealCLM.hasDerivAt (x := x)).mul_const Complex.I).const_add (r : ℂ) -+ have hconst : HasDerivAt (fun y : ℝ ↦ (r : ℂ) + (y : ℂ) * Complex.I) 0 x := -+ (hasDerivAt_const x c).congr_of_eventuallyEq hc -+ exact Complex.I_ne_zero (hpath.unique hconst) -+ -+private lemma HIntegral_congr_codiscreteWithin {f g : ℂ → ℂ} {R : Set ℂ} {a b c : ℝ} -+ (h_eq : {s : ℂ | f s = g s} ∈ Filter.codiscreteWithin R) -+ (hmaps : ∀ x ∈ Set.uIcc a b, (↑x + ↑c * Complex.I) ∈ R) : -+ HIntegral f a b c = HIntegral g a b c := by -+ unfold HIntegral -+ exact intervalIntegral_congr_ae_of_codiscreteWithin_along_path h_eq -+ (by intro x _; exact (Complex.ofRealCLM.analyticAt x).add analyticAt_const) -+ (fun x _ ↦ horizontalPath_not_eventuallyConst c x) hmaps -+ -+private lemma VIntegral_congr_codiscreteWithin {f g : ℂ → ℂ} {R : Set ℂ} {c a b : ℝ} -+ (h_eq : {s : ℂ | f s = g s} ∈ Filter.codiscreteWithin R) -+ (hmaps : ∀ y ∈ Set.uIcc a b, (↑c + ↑y * Complex.I) ∈ R) : -+ VIntegral f c a b = VIntegral g c a b := by -+ unfold VIntegral; simp only [smul_eq_mul]; congr 1 -+ exact intervalIntegral_congr_ae_of_codiscreteWithin_along_path h_eq -+ (by intro y _; exact analyticAt_const.add ((Complex.ofRealCLM.analyticAt y).mul analyticAt_const)) -+ (fun x _ ↦ verticalPath_not_eventuallyConst c x) hmaps -+ -+private lemma rectangleIntegral'_toMeromorphicNFOn_eq {f : ℂ → ℂ} {z w : ℂ} -+ (f_mero : MeromorphicOn f (Rectangle z w)) : -+ RectangleIntegral' f z w = RectangleIntegral' (toMeromorphicNFOn f (Rectangle z w)) z w := by -+ classical -+ let R : Set ℂ := Rectangle z w -+ let fNF : ℂ → ℂ := toMeromorphicNFOn f R -+ have h_eq : {s : ℂ | f s = fNF s} ∈ Filter.codiscreteWithin R := by -+ simpa [Filter.EventuallyEq, Filter.Eventually, fNF] using -+ (toMeromorphicNFOn_eqOn_codiscrete (f := f) (U := R) f_mero) -+ have hbot := HIntegral_congr_codiscreteWithin h_eq (by simpa [R] using! mapsTo_rectangle_left_im z w) -+ have htop := HIntegral_congr_codiscreteWithin h_eq (by simpa [R] using! mapsTo_rectangle_right_im z w) -+ have hright := VIntegral_congr_codiscreteWithin h_eq (by simpa [R] using! mapsTo_rectangle_right_re z w) -+ have hleft := VIntegral_congr_codiscreteWithin h_eq (by simpa [R] using! mapsTo_rectangle_left_re z w) -+ unfold RectangleIntegral'; congr 1; unfold RectangleIntegral -+ rw [hbot, htop, hright, hleft] -+ -+private lemma principalPart_meromorphicOn {R : Set ℂ} {polesFin : Finset ℂ} {c : ℂ → ℂ} : -+ MeromorphicOn (fun s ↦ ∑ p ∈ polesFin, c p / (s - p)) R := by -+ intro x _ -+ refine MeromorphicAt.fun_sum (G := fun p s ↦ c p / (s - p)) ?_ -+ intro p _ -+ exact (analyticAt_const.meromorphicAt.div -+ ((analyticAt_id.sub analyticAt_const).meromorphicAt)) -+ -+private lemma sub_principalPart_analyticAt_of_not_mem_poles -+ {f : ℂ → ℂ} {polesFin : Finset ℂ} {x : ℂ} -+ (h_nf : MeromorphicNFAt f x) -+ (hxnp : x ∉ polesFin) -+ (hxneg : 0 ≤ meromorphicOrderAt f x) : -+ AnalyticAt ℂ (f - fun s ↦ ∑ p ∈ polesFin, residue f p / (s - p)) x := by -+ have h_f_analytic : AnalyticAt ℂ f x := -+ h_nf.meromorphicOrderAt_nonneg_iff_analyticAt.1 hxneg -+ have h_principal_analytic : AnalyticAt ℂ (fun s ↦ ∑ p ∈ polesFin, residue f p / (s - p)) x := by -+ refine Finset.analyticAt_fun_sum polesFin ?_ -+ intro p hp -+ have hxp : x ≠ p := by -+ intro heq -+ subst heq -+ exact hxnp hp -+ have : AnalyticAt ℂ (fun z : ℂ ↦ residue f p / (z - p)) x := by -+ fun_prop (disch := exact sub_ne_zero.mpr hxp) -+ simpa using this -+ exact h_f_analytic.sub h_principal_analytic -+ -+private lemma meromorphicOrderAt_sub_principalPart_nonneg -+ {f : ℂ → ℂ} {polesFin : Finset ℂ} {p : ℂ} -+ (hpFin : p ∈ polesFin) -+ (h_mero : MeromorphicAt f p) -+ (h_ord : meromorphicOrderAt f p = -1) : -+ 0 ≤ meromorphicOrderAt (f - fun s ↦ ∑ q ∈ polesFin, residue f q / (s - q)) p := by -+ have hcore : (f - fun z ↦ residue f p / (z - p)) =O[nhdsWithin p ({p}ᶜ)] (1 : ℂ → ℂ) := by -+ exact simplePole_sub_residue_isBigO_one h_mero h_ord -+ let rest : ℂ → ℂ := fun z ↦ ∑ q ∈ polesFin.erase p, residue f q / (z - q) -+ have hrest_cont : ContinuousAt rest p := by -+ dsimp [rest] -+ refine tendsto_finsetSum _ (fun q hq ↦ ?_) -+ have hpq : p - q ≠ 0 := sub_ne_zero.mpr (Finset.mem_erase.mp hq).1.symm -+ have h_cont : ContinuousAt (fun z : ℂ ↦ residue f q / (z - q)) p := by -+ fun_prop (disch := exact hpq) -+ exact h_cont -+ have hrest : rest =O[nhdsWithin p ({p}ᶜ)] (1 : ℂ → ℂ) := by -+ have hbig : rest =O[nhds p] (1 : ℂ → ℂ) := -+ hrest_cont.norm.isBoundedUnder_le.isBigO_one ℂ -+ exact IsBigO.mono hbig inf_le_left -+ have hraw_big : (f - fun s ↦ ∑ q ∈ polesFin, residue f q / (s - q)) =O[nhdsWithin p ({p}ᶜ)] (1 : ℂ → ℂ) := by -+ have htmp : (fun z : ℂ ↦ (f z - residue f p / (z - p)) - rest z) =O[nhdsWithin p ({p}ᶜ)] (1 : ℂ → ℂ) := -+ hcore.sub hrest -+ have hdecomp : (f - fun s ↦ ∑ q ∈ polesFin, residue f q / (s - q)) = -+ (fun z : ℂ ↦ (f z - residue f p / (z - p)) - rest z) := by -+ funext z -+ dsimp [rest] -+ rw [← Finset.add_sum_erase (s := polesFin) (f := fun q ↦ residue f q / (z - q)) hpFin] -+ simp [sub_eq_add_neg, add_assoc, add_comm] -+ simpa [hdecomp, rest] using htmp -+ by_contra hneg -+ have hnorm : Filter.Tendsto (fun z : ℂ ↦ ‖(f - fun s ↦ ∑ q ∈ polesFin, residue f q / (s - q)) z‖) (nhdsWithin p ({p}ᶜ)) Filter.atTop := by -+ rw [tendsto_norm_atTop_iff_cobounded] -+ exact tendsto_cobounded_of_meromorphicOrderAt_neg (not_le.mp hneg) -+ exact (Filter.not_isBoundedUnder_of_tendsto_atTop hnorm) hraw_big.isBoundedUnder_le -+ -+private lemma holoPart_holomorphicOn {f : ℂ → ℂ} {z w : ℂ} -+ (f_mero : MeromorphicOn f (Rectangle z w)) -+ (f_simple_poles : HasSimplePolesOn f (Rectangle z w)) -+ (f_poles_finite : (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}).Finite) : -+ HolomorphicOn (toMeromorphicNFOn (toMeromorphicNFOn f (Rectangle z w) - -+ fun s ↦ ∑ p ∈ f_poles_finite.toFinset, residue (toMeromorphicNFOn f (Rectangle z w)) p / (s - p)) (Rectangle z w)) (Rectangle z w) := by -+ classical -+ let R := Rectangle z w -+ let poles := R ∩ {u | meromorphicOrderAt f u < 0} -+ let polesFin := f_poles_finite.toFinset -+ let fNF := toMeromorphicNFOn f R -+ let principalPart := fun s ↦ ∑ p ∈ polesFin, residue fNF p / (s - p) -+ let holoPart := toMeromorphicNFOn (fNF - principalPart) R -+ have h_fNF_mero : MeromorphicOn fNF R := by -+ simpa [fNF] using -+ (meromorphicNFOn_toMeromorphicNFOn (f := f) (U := R)).meromorphicOn -+ have h_principalPart_mero : MeromorphicOn principalPart R := principalPart_meromorphicOn -+ have h_raw_mero : MeromorphicOn (fNF - principalPart) R := h_fNF_mero.sub h_principalPart_mero -+ intro x hx -+ have h_raw_nonneg : 0 ≤ meromorphicOrderAt (fNF - principalPart) x := by -+ by_cases hxp : x ∈ poles -+ · have hpFin : x ∈ polesFin := by simpa [polesFin, poles] using hxp -+ have hord : meromorphicOrderAt f x = (-1 : ℤ) := -+ meromorphicOrderAt_eq_neg_one_of_simplePole hxp.1 f_simple_poles hxp.2 -+ have hordNF : meromorphicOrderAt fNF x = (-1 : ℤ) := by -+ rw [show meromorphicOrderAt fNF x = meromorphicOrderAt f x by -+ simpa [fNF] using -+ (meromorphicOrderAt_toMeromorphicNFOn (f := f) (U := R) f_mero hxp.1)] -+ exact hord -+ exact meromorphicOrderAt_sub_principalPart_nonneg hpFin (h_fNF_mero x hxp.1) hordNF -+ · have hxnp : x ∉ polesFin := by -+ intro h -+ exact hxp (by simpa [polesFin, poles] using h) -+ have h_fNF_nonneg : 0 ≤ meromorphicOrderAt fNF x := by -+ rw [show meromorphicOrderAt fNF x = meromorphicOrderAt f x by -+ simpa [fNF] using -+ (meromorphicOrderAt_toMeromorphicNFOn (f := f) (U := R) f_mero hx)] -+ exact le_of_not_gt fun hxneg => hxp ⟨hx, hxneg⟩ -+ have h_fNF_nf : MeromorphicNFAt fNF x := by -+ simpa [fNF] using -+ (meromorphicNFOn_toMeromorphicNFOn (f := f) (U := R) hx) -+ exact (sub_principalPart_analyticAt_of_not_mem_poles h_fNF_nf hxnp h_fNF_nonneg).meromorphicOrderAt_nonneg -+ have h_nf : MeromorphicNFAt holoPart x := by -+ simpa [holoPart] using -+ (meromorphicNFOn_toMeromorphicNFOn (f := fNF - principalPart) (U := R) hx) -+ have h_ord : -+ meromorphicOrderAt holoPart x = meromorphicOrderAt (fNF - principalPart) x := by -+ simpa [holoPart] using -+ (meromorphicOrderAt_toMeromorphicNFOn (f := fNF - principalPart) (U := R) h_raw_mero hx) -+ exact (h_nf.meromorphicOrderAt_nonneg_iff_analyticAt.1 (h_ord.symm ▸ h_raw_nonneg)).differentiableAt.differentiableWithinAt -+ -+private lemma principalPart_borderIntegrable {f : ℂ → ℂ} {z w : ℂ} -+ (f_no_poles_boundary : Disjoint (RectangleBorder z w) {z | meromorphicOrderAt f z < 0}) -+ (f_poles_finite : (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}).Finite) : -+ RectangleBorderIntegrable (fun s ↦ ∑ p ∈ f_poles_finite.toFinset, residue (toMeromorphicNFOn f (Rectangle z w)) p / (s - p)) z w := by -+ classical -+ let R := Rectangle z w -+ let poles := R ∩ {u | meromorphicOrderAt f u < 0} -+ let polesFin := f_poles_finite.toFinset -+ let fNF := toMeromorphicNFOn f R -+ let principalPart := fun s ↦ ∑ p ∈ polesFin, residue fNF p / (s - p) -+ refine ContinuousOn.rectangleBorder_integrable ?_ -+ refine continuousOn_finsetSum _ ?_ -+ intro p hp s hs -+ have hsp : s ≠ p := fun hsp => Set.disjoint_right.mp f_no_poles_boundary -+ ((by simpa [polesFin, poles] using hp : p ∈ poles).2) (hsp ▸ hs) -+ have : ContinuousAt (fun z : ℂ ↦ residue fNF p / (z - p)) s := by -+ fun_prop (disch := exact sub_ne_zero.mpr hsp) -+ exact this.continuousWithinAt -+ -+private lemma rectangle_mem_nhds_of_interior {z w p : ℂ} -+ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) -+ (hpR : p ∈ Rectangle z w) (hpnot : p ∉ RectangleBorder z w) : -+ Rectangle z w ∈ nhds p := by -+ rw [mem_Rect zRe_le_wRe zIm_le_wIm] at hpR -+ have hp_re_left : z.re < p.re := -+ lt_of_le_of_ne hpR.1 fun hEq => hpnot -+ (by simp [RectangleBorder, hEq, hpR.2.2.1, hpR.2.2.2, zIm_le_wIm, mem_reProdIm]) -+ have hp_re_right : p.re < w.re := -+ lt_of_le_of_ne hpR.2.1 fun hEq => hpnot -+ (by simp [RectangleBorder, hEq, hpR.2.2.1, hpR.2.2.2, zIm_le_wIm, mem_reProdIm]) -+ have hp_im_left : z.im < p.im := -+ lt_of_le_of_ne hpR.2.2.1 fun hEq => hpnot -+ (by simp [RectangleBorder, hEq, hpR.1, hpR.2.1, zRe_le_wRe, mem_reProdIm]) -+ have hp_im_right : p.im < w.im := -+ lt_of_le_of_ne hpR.2.2.2 fun hEq => hpnot -+ (by simp [RectangleBorder, hEq, hpR.1, hpR.2.1, zRe_le_wRe, mem_reProdIm]) -+ rw [rectangle_mem_nhds_iff, mem_reProdIm, Set.uIoo_of_le zRe_le_wRe, Set.uIoo_of_le zIm_le_wIm] -+ exact ⟨⟨hp_re_left, hp_re_right⟩, ⟨hp_im_left, hp_im_right⟩⟩ -+ -+private lemma sum_div_rectangleBorderIntegrable {z w : ℂ} {S : Finset ℂ} -+ (hS_disjoint : Disjoint (RectangleBorder z w) S) (c : ℂ → ℂ) : -+ RectangleBorderIntegrable (fun s ↦ ∑ p ∈ S, c p / (s - p)) z w := by -+ refine ContinuousOn.rectangleBorder_integrable ?_ -+ refine continuousOn_finsetSum _ ?_ -+ intro p hp s hs -+ have hsp : s ≠ p := fun hsp => Set.disjoint_right.mp hS_disjoint hp (hsp ▸ hs) -+ have : ContinuousAt (fun z : ℂ ↦ c p / (z - p)) s := by -+ fun_prop (disch := exact sub_ne_zero.mpr hsp) -+ exact this.continuousWithinAt -+ -+private lemma rectangleIntegral'_sum_div_sub {z w : ℂ} (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) -+ {S : Finset ℂ} (hS_subset : (S : Set ℂ) ⊆ Rectangle z w) -+ (hS_disjoint : Disjoint (RectangleBorder z w) S) -+ (c : ℂ → ℂ) : -+ RectangleIntegral' (fun s ↦ ∑ p ∈ S, c p / (s - p)) z w = ∑ p ∈ S, c p := by -+ classical -+ have h_partial_border : ∀ (S' : Finset ℂ), S' ⊆ S → RectangleBorderIntegrable (fun s ↦ ∑ p ∈ S', c p / (s - p)) z w := by -+ intro S' hS' -+ exact sum_div_rectangleBorderIntegrable (Disjoint.mono_right hS' hS_disjoint) c -+ have h_term_integral : ∀ {p : ℂ}, p ∈ S → RectangleIntegral' (fun s ↦ c p / (s - p)) z w = c p := -+ fun {p} hp => ResidueTheoremInRectangle zRe_le_wRe zIm_le_wIm -+ (rectangle_mem_nhds_of_interior zRe_le_wRe zIm_le_wIm -+ (hS_subset hp) (Set.disjoint_right.mp hS_disjoint hp)) -+ have h_partial_integral : -+ ∀ (S' : Finset ℂ), S' ⊆ S → -+ RectangleIntegral' (fun s ↦ ∑ p ∈ S', c p / (s - p)) z w = -+ ∑ p ∈ S', c p := by -+ intro S' hS' -+ revert hS' -+ refine Finset.induction_on S' ?_ ?_ -+ · intro _ -+ simp [RectangleIntegral', RectangleIntegral, HIntegral, VIntegral] -+ · intro a S' ha ih hS' -+ obtain ⟨haFin, hSsub⟩ := Finset.insert_subset_iff.mp hS' -+ have hterm_border : -+ RectangleBorderIntegrable (fun s ↦ c a / (s - a)) z w := -+ by simpa using h_partial_border ({a} : Finset ℂ) (Finset.singleton_subset_iff.mpr haFin) -+ have hfun : -+ (fun s ↦ ∑ p ∈ insert a S', c p / (s - p)) = -+ (fun s ↦ c a / (s - a)) + -+ (fun s ↦ ∑ p ∈ S', c p / (s - p)) := by -+ funext s; simp [Finset.sum_insert, ha] -+ have h_add_primed : -+ RectangleIntegral' ((fun s ↦ c a / (s - a)) + (fun s ↦ ∑ p ∈ S', c p / (s - p))) z w = -+ RectangleIntegral' (fun s ↦ c a / (s - a)) z w + -+ RectangleIntegral' (fun s ↦ ∑ p ∈ S', c p / (s - p)) z w := by -+ unfold RectangleIntegral' -+ rw [RectangleBorderIntegrable.add hterm_border (h_partial_border S' hSsub), smul_add] -+ rw [hfun, h_add_primed, h_term_integral haFin, ih hSsub, Finset.sum_insert ha] -+ exact h_partial_integral S (by intro p hp; exact hp) -+ -+private lemma toMeromorphicNFOn_add_integral {f : ℂ → ℂ} {z w : ℂ} -+ (f_mero : MeromorphicOn f (Rectangle z w)) -+ (f_no_poles_boundary : Disjoint (RectangleBorder z w) {z | meromorphicOrderAt f z < 0}) -+ (f_poles_finite : (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}).Finite) -+ (f_simple_poles : HasSimplePolesOn f (Rectangle z w)) : -+ RectangleIntegral' (toMeromorphicNFOn f (Rectangle z w)) z w = -+ RectangleIntegral' (toMeromorphicNFOn (toMeromorphicNFOn f (Rectangle z w) - -+ fun s ↦ ∑ p ∈ f_poles_finite.toFinset, residue (toMeromorphicNFOn f (Rectangle z w)) p / (s - p)) (Rectangle z w)) z w + -+ RectangleIntegral' (fun s ↦ ∑ p ∈ f_poles_finite.toFinset, residue (toMeromorphicNFOn f (Rectangle z w)) p / (s - p)) z w := by -+ let R : Set ℂ := Rectangle z w -+ let poles : Set ℂ := R ∩ {u | meromorphicOrderAt f u < 0} -+ let polesFin : Finset ℂ := f_poles_finite.toFinset -+ let fNF : ℂ → ℂ := toMeromorphicNFOn f R -+ let principalPart : ℂ → ℂ := fun s ↦ ∑ p ∈ polesFin, residue fNF p / (s - p) -+ let holoPart : ℂ → ℂ := toMeromorphicNFOn (fNF - principalPart) R -+ have h_holoPart_border : RectangleBorderIntegrable holoPart z w := -+ (holoPart_holomorphicOn f_mero f_simple_poles f_poles_finite).rectangleBorderIntegrable -+ have h_fNF_eq : -+ Set.EqOn fNF (holoPart + principalPart) (RectangleBorder z w) := by -+ intro s hs -+ have hsR : s ∈ R := rectangleBorder_subset_rectangle z w hs -+ have hsnp : s ∉ poles := fun hsp => Set.disjoint_right.mp f_no_poles_boundary hsp.2 hs -+ have hraw_analytic : AnalyticAt ℂ (fNF - principalPart) s := by -+ have h_fNF_nonneg : 0 ≤ meromorphicOrderAt fNF s := by -+ rw [show meromorphicOrderAt fNF s = meromorphicOrderAt f s by -+ simpa [fNF] using -+ (meromorphicOrderAt_toMeromorphicNFOn (f := f) (U := R) f_mero hsR)] -+ exact le_of_not_gt fun hsneg => hsnp ⟨hsR, hsneg⟩ -+ exact sub_principalPart_analyticAt_of_not_mem_poles -+ (by simpa [fNF] using meromorphicNFOn_toMeromorphicNFOn (f := f) (U := R) hsR) -+ (fun h => hsnp (by simpa [polesFin, poles] using h)) -+ h_fNF_nonneg -+ have hs_eq : holoPart s = (fNF - principalPart) s := by -+ rw [show holoPart = toMeromorphicNFOn (fNF - principalPart) R by rfl] -+ have h_fNF_mero : MeromorphicOn fNF R := by -+ simpa [fNF] using (meromorphicNFOn_toMeromorphicNFOn (f := f) (U := R)).meromorphicOn -+ have hf_sub_mero : MeromorphicOn (fNF - principalPart) R := -+ h_fNF_mero.sub principalPart_meromorphicOn -+ rw [toMeromorphicNFOn_eq_toMeromorphicNFAt (f := fNF - principalPart) (U := R) hf_sub_mero hsR] -+ exact congr_fun (toMeromorphicNFAt_eq_self.2 hraw_analytic.meromorphicNFAt) s -+ calc -+ fNF s = (fNF - principalPart) s + principalPart s := by simp -+ _ = holoPart s + principalPart s := by rw [← hs_eq] -+ rw [RectangleIntegral'_congr h_fNF_eq, RectangleIntegral', -+ RectangleBorderIntegrable.add h_holoPart_border -+ (principalPart_borderIntegrable f_no_poles_boundary f_poles_finite), smul_add] -+ -+lemma RectangleIntegral'_eq_sumResiduesIn {f : ℂ → ℂ} {z w : ℂ} -+ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) -+ (f_mero : MeromorphicOn f (Rectangle z w)) -+ (f_no_poles_boundary : Disjoint (RectangleBorder z w) {z | meromorphicOrderAt f z < 0}) -+ (f_poles_finite : (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}).Finite) -+ (f_simple_poles : HasSimplePolesOn f (Rectangle z w)) : -+ RectangleIntegral' f z w = sumResiduesIn f (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}) := by -+ let R : Set ℂ := Rectangle z w -+ let poles : Set ℂ := R ∩ {u | meromorphicOrderAt f u < 0} -+ let polesFin : Finset ℂ := f_poles_finite.toFinset -+ let fNF : ℂ → ℂ := toMeromorphicNFOn f R -+ let principalPart : ℂ → ℂ := fun s ↦ ∑ p ∈ polesFin, residue fNF p / (s - p) -+ let holoPart : ℂ → ℂ := toMeromorphicNFOn (fNF - principalPart) R -+ have h_residue_congr : sumResiduesIn f poles = sumResiduesIn fNF poles := by -+ rw [sumResiduesIn, sumResiduesIn] -+ apply tsum_congr -+ intro p -+ exact (residue_toMeromorphicNFOn_eq_residue p.2.1 f_mero f_simple_poles p.2.2).symm -+ have h_principalPart_integral : RectangleIntegral' principalPart z w = sumResiduesIn fNF poles := by -+ have h_sum : RectangleIntegral' principalPart z w = ∑ p ∈ polesFin, residue fNF p := by -+ apply rectangleIntegral'_sum_div_sub zRe_le_wRe zIm_le_wIm -+ · intro p hp -+ dsimp [polesFin, poles, R] at hp -+ simp only [Finset.mem_coe, Set.Finite.mem_toFinset] at hp -+ exact hp.1 -+ · exact Disjoint.mono_right (by rw [f_poles_finite.coe_toFinset]; exact Set.inter_subset_right) f_no_poles_boundary -+ rw [h_sum] -+ have h_eq_poles : poles = ↑polesFin := by -+ dsimp [poles, polesFin, R] -+ exact f_poles_finite.coe_toFinset.symm -+ rw [sumResiduesIn, h_eq_poles, -+ tsum_fintype (f := fun p : (polesFin : Set ℂ) => residue fNF p), -+ ← Finset.sum_coe_sort polesFin]; rfl -+ calc -+ RectangleIntegral' f z w = RectangleIntegral' fNF z w := rectangleIntegral'_toMeromorphicNFOn_eq f_mero -+ _ = RectangleIntegral' holoPart z w + RectangleIntegral' principalPart z w := -+ toMeromorphicNFOn_add_integral f_mero f_no_poles_boundary f_poles_finite f_simple_poles -+ _ = 0 + sumResiduesIn fNF poles := by -+ rw [h_principalPart_integral] -+ rw [RectangleIntegral', -+ (holoPart_holomorphicOn f_mero f_simple_poles f_poles_finite).vanishesOnRectangle subset_rfl] -+ simp -+ _ = sumResiduesIn fNF poles := by simp -+ _ = sumResiduesIn f poles := h_residue_congr.symm -+ -+lemma residue_eq_zero_of_not_pole_of_meromorphicAt {F : ℂ → ℂ} {s : ℂ} -+ (hs_mero : MeromorphicAt F s) (hs_not_pole : 0 ≤ meromorphicOrderAt F s) : -+ residue F s = 0 := by -+ apply residue_eq_of_tendsto -+ obtain ⟨c, hc⟩ := tendsto_nhds_of_meromorphicOrderAt_nonneg hs_mero hs_not_pole -+ have hsub : Filter.Tendsto (fun z : ℂ ↦ z - s) (nhdsWithin s {s}ᶜ) (nhds 0) := -+ tendsto_sub_nhds_zero_iff.mpr (tendsto_id.mono_left nhdsWithin_le_nhds) -+ simpa using hsub.mul hc -+ -+lemma sumResiduesIn_inter_eq_of_set_eq {F : ℂ → ℂ} {Rn S2 P : Set ℂ} -+ (h_set_eq : Rn ∩ P = S2 ∩ P) -+ (h_residue_zero : ∀ s ∈ S2, s ∉ P → residue F s = 0) : -+ sumResiduesIn F (Rn ∩ P) = sumResiduesIn F S2 := by -+ rw [sumResiduesIn, sumResiduesIn, tsum_subtype, tsum_subtype] -+ apply tsum_congr -+ intro s -+ by_cases hs_S2 : s ∈ S2 -+ · by_cases hs_pole : s ∈ P -+ · have hs_rect_pole : s ∈ Rn ∩ P := h_set_eq.symm ▸ ⟨hs_S2, hs_pole⟩ -+ simp [hs_S2, hs_rect_pole] -+ · have hs_not_rect_pole : s ∉ Rn ∩ P := fun hs => hs_pole hs.2 -+ have hres0 : residue F s = 0 := h_residue_zero s hs_S2 hs_pole -+ simp [hs_S2, hs_not_rect_pole, hres0] -+ · have hs_not_rect_pole : s ∉ Rn ∩ P := fun hs => hs_S2 (h_set_eq ▸ hs).1 -+ simp [hs_S2, hs_not_rect_pole] -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/SmoothExistence.lean b/PrimeNumberTheoremAnd/Erdos970/SmoothExistence.lean -new file mode 100644 -index 0000000..74e2172 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/SmoothExistence.lean -@@ -0,0 +1,94 @@ -+import Batteries.Tactic.Lemma -+import Mathlib.Geometry.Manifold.PartitionOfUnity -+import Mathlib.Tactic.Bound -+import PrimeNumberTheoremAnd.Erdos970.Mathlib.Algebra.Notation.Support -+ -+namespace Erdos970 -+ -+ -+open MeasureTheory Set Real -+open scoped ContDiff -+ -+lemma smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : -+ ∃ Ψ : ℝ → ℝ, (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ -+ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 ∧ -+ (Function.support Ψ = Set.Ioo a d) := by -+ have := exists_contMDiff_zero_iff_one_iff_of_isClosed (n := ⊤) -+ (modelWithCornersSelf ℝ ℝ) (s := Set.Iic a ∪ Set.Ici d) (t := Set.Icc b c) -+ (IsClosed.union isClosed_Iic isClosed_Ici) isClosed_Icc -+ (by -+ simp_rw [Set.disjoint_union_left, Set.disjoint_iff, Set.subset_def, -+ Set.mem_inter_iff, Set.mem_Iic, Set.mem_Icc, Set.mem_empty_iff_false, -+ and_imp, imp_false, not_le, Set.mem_Ici] -+ constructor <;> intros <;> linarith) -+ obtain ⟨Ψ, hΨSmooth, hΨrange, hΨ0, hΨ1⟩ := this -+ simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, Set.mem_Icc] at * -+ use Ψ -+ simp only [range_subset_iff, mem_Icc] at hΨrange -+ refine ⟨ContMDiff.contDiff hΨSmooth, ?_, ?_, ?_, ?_⟩ -+ · apply HasCompactSupport.of_support_subset_isCompact (K := Set.Icc a d) isCompact_Icc -+ simp only [Function.support_subset_iff, ne_eq, mem_Icc, ← hΨ0, not_or] -+ bound -+ · apply Set.indicator_le' -+ · intro x hx -+ rw [hΨ1 x |>.mp, Pi.one_apply] -+ simpa using hx -+ · exact fun x _ ↦ (hΨrange x).1 -+ · intro x -+ apply Set.le_indicator_apply -+ · exact fun _ ↦ (hΨrange x).2 -+ · intro hx -+ rw [← hΨ0 x |>.mp] -+ simpa [-not_and, mem_Ioo, not_and_or, not_lt] using hx -+ · ext x -+ simp only [Function.mem_support, ne_eq, mem_Ioo, ← hΨ0, not_or, not_le] -+ -+lemma SmoothExistence : -+ ∃ (ν : ℝ → ℝ), (ContDiff ℝ ∞ ν) ∧ (∀ x, 0 ≤ ν x) ∧ -+ ν.support ⊆ Icc (1 / 2) 2 ∧ ∫ x in Ici 0, ν x / x = 1 := by -+ suffices h : ∃ (ν : ℝ → ℝ), (ContDiff ℝ ∞ ν) ∧ (∀ x, 0 ≤ ν x) ∧ -+ ν.support ⊆ Set.Icc (1 / 2) 2 ∧ 0 < ∫ x in Set.Ici 0, ν x / x by -+ obtain ⟨ν, hν, hνnonneg, hνsupp, hνpos⟩ := h -+ let c := (∫ x in Ici 0, ν x / x) -+ use fun y ↦ ν y / c -+ refine ⟨hν.div_const c, fun y ↦ div_nonneg (hνnonneg y) (le_of_lt hνpos), ?_, ?_⟩ -+ · rw [Function.support_div, Function.support_const (ne_of_lt hνpos).symm, inter_univ] -+ convert hνsupp -+ · simp only [div_right_comm _ c _, integral_div c, div_self <| ne_of_gt hνpos, c] -+ have := smooth_urysohn_support_Ioo (a := 1 / 2) (b := 1) (c := 3 / 2) (d := 2) -+ (by linarith) (by linarith) -+ obtain ⟨ν, hνContDiff, _, hν0, hν1, hνSupport⟩ := this -+ use ν, hνContDiff -+ unfold indicator at hν0 hν1 -+ simp only [mem_Icc, Pi.one_apply, Pi.le_def, mem_Ioo] at hν0 hν1 -+ simp only [hνSupport, subset_def, mem_Ioo, mem_Icc, and_imp] -+ split_ands -+ · exact fun x ↦ le_trans (by simp [apply_ite]) (hν0 x) -+ · exact fun y hy hy' ↦ ⟨by linarith, by linarith⟩ -+ · rw [integral_pos_iff_support_of_nonneg] -+ · simp only [Function.support_div, measurableSet_Ici, Measure.restrict_apply', -+ hνSupport, Function.support_id'] -+ have : (Ioo (1 / 2 : ℝ) 2 ∩ {0}ᶜ ∩ Ici 0) = Ioo (1 / 2) 2 := by -+ ext x -+ simp only [one_div, mem_inter_iff, mem_Ioo, mem_compl_iff, mem_singleton_iff, mem_Ici] -+ bound -+ simp only [this, volume_Ioo, ENNReal.ofReal_pos, sub_pos, gt_iff_lt] -+ linarith -+ · simp_rw [Pi.le_def, Pi.zero_apply] -+ intro y -+ by_cases h : y ∈ Function.support ν -+ · apply div_nonneg <| le_trans (by simp [apply_ite]) (hν0 y) -+ rw [hνSupport, mem_Ioo] at h -+ linarith [h.left] -+ · simp only [Function.mem_support, ne_eq, not_not] at h -+ simp [h] -+ · have : (fun x ↦ ν x / x).support ⊆ Icc (1 / 2) 2 := by -+ rw [Function.support_div, hνSupport] -+ exact (inter_subset_left).trans Ioo_subset_Icc_self -+ apply (integrableOn_iff_integrable_of_support_subset this).mp -+ apply ContinuousOn.integrableOn_compact isCompact_Icc -+ apply hνContDiff.continuous.continuousOn.div continuousOn_id ?_ -+ simp only [mem_Icc, ne_eq, and_imp, id_eq] -+ intros; linarith -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Sobolev.lean b/PrimeNumberTheoremAnd/Erdos970/Sobolev.lean -new file mode 100644 -index 0000000..3e83353 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Sobolev.lean -@@ -0,0 +1,360 @@ -+import Mathlib.Analysis.Calculus.Deriv.Support -+import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv -+import Mathlib.Order.Filter.ZeroAndBoundedAtFilter -+ -+namespace Erdos970 -+ -+open Real Complex MeasureTheory Filter Topology BoundedContinuousFunction SchwartzMap BigOperators -+open scoped ContDiff -+ -+variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {n : ℕ} -+ -+@[ext] structure CS (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where -+ toFun : ℝ → E -+ h1 : ContDiff ℝ n toFun -+ h2 : HasCompactSupport toFun -+ -+structure trunc extends (CS 2 ℝ) where -+ h3 : (Set.Icc (-1) (1)).indicator 1 ≤ toFun -+ h4 : toFun ≤ Set.indicator (Set.Ioo (-2) (2)) 1 -+ -+structure W1 (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where -+ toFun : ℝ → E -+ smooth : ContDiff ℝ n toFun -+ integrable : ∀ ⦃k⦄, k ≤ n → Integrable (iteratedDeriv k toFun) -+ -+abbrev W21 := W1 2 ℂ -+ -+section lemmas -+ -+noncomputable def funscale {E : Type*} (g : ℝ → E) (R x : ℝ) : E := g (R⁻¹ • x) -+ -+lemma contDiff_ofReal : ContDiff ℝ ∞ ofReal := by -+ have key x : HasDerivAt ofReal 1 x := hasDerivAt_id x |>.ofReal_comp -+ have key' : deriv ofReal = fun _ => 1 := by ext x ; exact (key x).deriv -+ refine contDiff_infty_iff_deriv.mpr ⟨fun x => (key x).differentiableAt, ?_⟩ -+ simpa [key'] using contDiff_const -+ -+omit [NormedSpace ℝ E] in -+lemma tendsto_funscale {f : ℝ → E} (hf : ContinuousAt f 0) (x : ℝ) : -+ Tendsto (fun R => funscale f R x) atTop (𝓝 (f 0)) := -+ hf.tendsto.comp (by simpa using tendsto_inv_atTop_zero.mul_const x) -+ -+end lemmas -+ -+namespace CS -+ -+variable {f : CS n E} {R x v : ℝ} -+ -+instance : CoeFun (CS n E) (fun _ => ℝ → E) where coe := CS.toFun -+ -+instance : Coe (CS n ℝ) (CS n ℂ) where coe f := ⟨fun x => f x, -+ contDiff_ofReal.of_le (mod_cast le_top) |>.comp f.h1, f.h2.comp_left (g := ofReal) rfl⟩ -+ -+def neg (f : CS n E) : CS n E where -+ toFun := -f -+ h1 := f.h1.neg -+ h2 := by simpa [HasCompactSupport, tsupport] using f.h2 -+ -+instance : Neg (CS n E) where neg := neg -+ -+@[simp] lemma neg_apply {x : ℝ} : (-f) x = - (f x) := rfl -+ -+def smul (R : ℝ) (f : CS n E) : CS n E := ⟨R • f, f.h1.const_smul R, f.h2.smul_left⟩ -+ -+instance : HSMul ℝ (CS n E) (CS n E) where hSMul := smul -+ -+@[simp] lemma smul_apply : (R • f) x = R • f x := rfl -+ -+lemma continuous (f : CS n E) : Continuous f := f.h1.continuous -+ -+noncomputable def deriv (f : CS (n + 1) E) : CS n E where -+ toFun := _root_.deriv f -+ h1 := (contDiff_succ_iff_deriv.mp f.h1).2.2 -+ h2 := f.h2.deriv -+ -+lemma hasDerivAt (f : CS (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := -+ (f.h1.differentiable (by simp)).differentiableAt.hasDerivAt -+ -+lemma deriv_apply {f : CS (n + 1) E} {x : ℝ} : f.deriv x = _root_.deriv f x := rfl -+ -+lemma deriv_smul {f : CS (n + 1) E} : (R • f).deriv = R • f.deriv := by -+ ext x ; exact (f.hasDerivAt x |>.const_smul R).deriv -+ -+noncomputable def scale (g : CS n E) (R : ℝ) : CS n E := by -+ by_cases h : R = 0 -+ · exact ⟨0, contDiff_const, by simp [HasCompactSupport, tsupport]⟩ -+ · refine ⟨fun x => funscale g R x, ?_, ?_⟩ -+ · exact g.h1.comp (contDiff_const_smul R⁻¹) -+ · exact g.h2.comp_smul (inv_ne_zero h) -+ -+lemma deriv_scale {f : CS (n + 1) E} : (f.scale R).deriv = R⁻¹ • f.deriv.scale R := by -+ ext v ; by_cases hR : R = 0 -+ · simp [hR, scale, deriv] -+ · simp only [scale, hR, ↓reduceDIte, smul_apply] -+ exact ((f.hasDerivAt (R⁻¹ • v)).scomp v -+ (by simpa using! (hasDerivAt_id v).const_smul R⁻¹)).deriv -+ -+lemma deriv_scale' {f : CS (n + 1) E} : -+ (f.scale R).deriv v = R⁻¹ • f.deriv (R⁻¹ • v) := by -+ rw [deriv_scale, smul_apply] -+ by_cases hR : R = 0 <;> simp [hR, scale, funscale] -+ -+lemma hasDerivAt_scale (f : CS (n + 1) E) (R x : ℝ) : -+ HasDerivAt (f.scale R) (R⁻¹ • _root_.deriv f (R⁻¹ • x)) x := by -+ convert hasDerivAt (f.scale R) x ; rw [deriv_scale'] ; rfl -+ -+lemma tendsto_scale (f : CS n E) (x : ℝ) : Tendsto (fun R => f.scale R x) atTop (𝓝 (f 0)) := by -+ apply (tendsto_funscale f.continuous.continuousAt x).congr' -+ filter_upwards [eventually_ne_atTop 0] with R hR ; simp [scale, hR] -+ -+lemma bounded : ∃ C, ∀ v, ‖f v‖ ≤ C := by -+ obtain ⟨x, hx⟩ := -+ (continuous_norm.comp f.continuous).exists_forall_ge_of_hasCompactSupport f.h2.norm -+ exact ⟨_, hx⟩ -+ -+end CS -+ -+namespace trunc -+ -+instance : CoeFun trunc (fun _ => ℝ → ℝ) where coe f := f.toFun -+ -+instance : Coe trunc (CS 2 ℝ) where coe := trunc.toCS -+ -+lemma nonneg (g : trunc) (x : ℝ) : 0 ≤ g x := (Set.indicator_nonneg (by simp) x).trans (g.h3 x) -+ -+lemma le_one (g : trunc) (x : ℝ) : g x ≤ 1 := -+ (g.h4 x).trans <| Set.indicator_le_self' (by simp) x -+ -+lemma zero (g : trunc) : g =ᶠ[𝓝 0] 1 := by -+ have : Set.Icc (-1) 1 ∈ 𝓝 (0 : ℝ) := by apply Icc_mem_nhds <;> linarith -+ exact eventually_of_mem this (fun x hx => le_antisymm (g.le_one x) (by simpa [hx] using g.h3 x)) -+ -+@[simp] lemma zero_at {g : trunc} : g 0 = 1 := g.zero.eq_of_nhds -+ -+end trunc -+ -+namespace W1 -+ -+instance : CoeFun (W1 n E) (fun _ => ℝ → E) where coe := W1.toFun -+ -+lemma continuous (f : W1 n E) : Continuous f := f.smooth.continuous -+ -+lemma differentiable (f : W1 (n + 1) E) : Differentiable ℝ f := -+ f.smooth.differentiable (by simp) -+ -+lemma iteratedDeriv_sub {f g : ℝ → E} (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : -+ iteratedDeriv n (f - g) = iteratedDeriv n f - iteratedDeriv n g := by -+ induction n generalizing f g with -+ | zero => rfl -+ | succ n ih => -+ have hf' : ContDiff ℝ n (deriv f) := hf.iterate_deriv' n 1 -+ have hg' : ContDiff ℝ n (deriv g) := hg.iterate_deriv' n 1 -+ have hfg : deriv (f - g) = deriv f - deriv g := by -+ ext x ; apply deriv_sub -+ · exact (hf.differentiable (by simp)).differentiableAt -+ · exact (hg.differentiable (by simp)).differentiableAt -+ simp_rw [iteratedDeriv_succ', ← ih hf' hg', hfg] -+ -+noncomputable def deriv (f : W1 (n + 1) E) : W1 n E where -+ toFun := _root_.deriv f -+ smooth := contDiff_succ_iff_deriv.mp f.smooth |>.2.2 -+ integrable k hk := by -+ simpa [iteratedDeriv_succ'] using f.integrable (Nat.succ_le_succ hk) -+ -+lemma hasDerivAt (f : W1 (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := -+ f.differentiable.differentiableAt.hasDerivAt -+ -+def sub (f g : W1 n E) : W1 n E where -+ toFun := f - g -+ smooth := f.smooth.sub g.smooth -+ integrable k hk := by -+ have hf : ContDiff ℝ k f := f.smooth.of_le (by simp [hk]) -+ have hg : ContDiff ℝ k g := g.smooth.of_le (by simp [hk]) -+ simpa [iteratedDeriv_sub hf hg] using (f.integrable hk).sub (g.integrable hk) -+ -+instance : Sub (W1 n E) where sub := sub -+ -+lemma integrable_iteratedDeriv_Schwarz {f : 𝓢(ℝ, ℂ)} : Integrable (iteratedDeriv n f) := by -+ induction n generalizing f with -+ | zero => exact f.integrable -+ | succ n ih => simpa [iteratedDeriv_succ'] using! ih (f := SchwartzMap.derivCLM ℝ ℂ f) -+ -+noncomputable def of_Schwartz (f : 𝓢(ℝ, ℂ)) : W1 n ℂ where -+ toFun := f -+ smooth := f.smooth n -+ integrable _ _ := integrable_iteratedDeriv_Schwarz -+ -+end W1 -+ -+namespace W21 -+ -+variable {f : W21} -+ -+noncomputable def norm (f : ℝ → ℂ) : ℝ := -+ (∫ v, ‖f v‖) + (4 * π ^ 2)⁻¹ * (∫ v, ‖deriv (deriv f) v‖) -+ -+lemma norm_nonneg {f : ℝ → ℂ} : 0 ≤ norm f := -+ add_nonneg (integral_nonneg (fun t => by simp)) -+ (mul_nonneg (by positivity) (integral_nonneg (fun t => by simp))) -+ -+noncomputable instance : Norm W21 where norm := norm ∘ W1.toFun -+ -+noncomputable instance : Coe 𝓢(ℝ, ℂ) W21 where coe := W1.of_Schwartz -+ -+def ofCS2 (f : CS 2 ℂ) : W21 := by -+ refine ⟨f, f.h1, fun k hk => ?_⟩ ; match k with -+ | 0 => exact f.h1.continuous.integrable_of_hasCompactSupport f.h2 -+ | 1 => simpa using (f.h1.continuous_deriv one_le_two).integrable_of_hasCompactSupport f.h2.deriv -+ | 2 => simpa [iteratedDeriv_succ] using -+ (f.h1.iterate_deriv' 0 2).continuous.integrable_of_hasCompactSupport f.h2.deriv.deriv -+ -+instance : Coe (CS 2 ℂ) W21 where coe := ofCS2 -+ -+instance : HMul (CS 2 ℂ) W21 (CS 2 ℂ) where -+ hMul g f := ⟨g * f, g.h1.mul f.smooth, g.h2.mul_right⟩ -+ -+instance : HMul (CS 2 ℝ) W21 (CS 2 ℂ) where hMul g f := (g : CS 2 ℂ) * f -+ -+lemma hf (f : W21) : Integrable f := f.integrable zero_le_two -+ -+lemma hf' (f : W21) : Integrable (deriv f) := by -+ simpa [iteratedDeriv_succ] using f.integrable one_le_two -+ -+lemma hf'' (f : W21) : Integrable (deriv (deriv f)) := by -+ simpa [iteratedDeriv_succ] using f.integrable le_rfl -+ -+end W21 -+ -+theorem W21_approximation (f : W21) (g : trunc) : -+ Tendsto (fun R => ‖f - (g.scale R * f : W21)‖) atTop (𝓝 0) := by -+ -+ let f' := f.deriv -+ let f'' := f'.deriv -+ let g' := (g : CS 2 ℝ).deriv -+ let g'' := g'.deriv -+ let h R v := 1 - g.scale R v -+ let h' R := - (g.scale R).deriv -+ let h'' R := - (g.scale R).deriv.deriv -+ -+ have ch {R} : Continuous (fun v => (h R v : ℂ)) := -+ continuous_ofReal.comp <| continuous_const.sub (CS.continuous _) -+ have ch' {R} : Continuous (fun v => (h' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) -+ have ch'' {R} : Continuous (fun v => (h'' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) -+ have dh R v : HasDerivAt (h R) (h' R v) v := by -+ convert! CS.hasDerivAt_scale (g : CS 2 ℝ) R v |>.const_sub 1 using 1 -+ simp [h', CS.deriv_scale', show g.deriv.toFun = deriv g.toFun from rfl] -+ have dh' R v : HasDerivAt (h' R) (h'' R v) v := ((g.scale R).deriv.hasDerivAt v).neg -+ have hh1 R v : |h R v| ≤ 1 := by -+ by_cases hR : R = 0 <;> -+ simp only [CS.scale, funscale, smul_eq_mul, hR, ↓reduceDIte, Pi.zero_apply, sub_zero, -+ abs_one, le_refl, h] -+ rw [abs_le] ; constructor <;> -+ linarith [g.le_one (R⁻¹ * v), g.nonneg (R⁻¹ * v)] -+ have vR v : Tendsto (fun R : ℝ => v * R⁻¹) atTop (𝓝 0) := by -+ simpa using tendsto_inv_atTop_zero.const_mul v -+ -+ convert_to Tendsto (fun R => W21.norm (fun v => h R v * f v)) atTop (𝓝 0) -+ · ext R ; change W21.norm _ = _ ; congr ; ext v ; simp [h, sub_mul] ; rfl -+ rw [show (0 : ℝ) = 0 + ((4 * π ^ 2)⁻¹ : ℝ) * 0 by simp] -+ refine Tendsto.add ?_ (Tendsto.const_mul _ ?_) -+ -+ · let F R v := ‖h R v * f v‖ -+ have eh v : ∀ᶠ R in atTop, h R v = 0 := by -+ filter_upwards [(vR v).eventually g.zero, eventually_ne_atTop 0] with R hR hR' -+ simp [h, hR, CS.scale, hR', funscale, mul_comm R⁻¹] -+ have e1 : ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (F n) volume := by -+ apply Eventually.of_forall ; intro R -+ exact (ch.mul f.continuous).norm.aestronglyMeasurable -+ have e2 : ∀ᶠ (n : ℝ) in atTop, ∀ᵐ (a : ℝ), ‖F n a‖ ≤ ‖f a‖ := by -+ apply Eventually.of_forall ; intro R -+ apply Eventually.of_forall ; intro v -+ simpa [F] using mul_le_mul (hh1 R v) le_rfl (by simp) zero_le_one -+ have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by -+ apply Eventually.of_forall ; intro v -+ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eh v] with R hR ; simp [F, hR] -+ simpa [F] using tendsto_integral_filter_of_dominated_convergence _ e1 e2 f.hf.norm e4 -+ -+ · let F R v := ‖h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v‖ -+ convert_to Tendsto (fun R ↦ ∫ (v : ℝ), F R v) atTop (𝓝 0) -+ · have this R v : -+ deriv (deriv (fun v => h R v * f v)) v = -+ h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v := by -+ have df v : HasDerivAt f (f' v) v := f.hasDerivAt v -+ have df' v : HasDerivAt f' (f'' v) v := f'.hasDerivAt v -+ have l3 v : HasDerivAt (fun v => h R v * f v) (h' R v * f v + h R v * f' v) v := -+ (dh R v).ofReal_comp.mul (df v) -+ have l5 : HasDerivAt (fun v => h' R v * f v) (h'' R v * f v + h' R v * f' v) v := -+ (dh' R v).ofReal_comp.mul (df v) -+ have l7 : HasDerivAt (fun v => h R v * f' v) (h' R v * f' v + h R v * f'' v) v := -+ (dh R v).ofReal_comp.mul (df' v) -+ have d1 : deriv (fun v => h R v * f v) = fun v => h' R v * f v + h R v * f' v := -+ funext (fun v => (l3 v).deriv) -+ rw [d1] ; convert! (l5.add l7).deriv using 1 ; ring -+ simp_rw [this, F] -+ -+ obtain ⟨c1, mg'⟩ := g'.bounded -+ obtain ⟨c2, mg''⟩ := g''.bounded -+ let bound v := c2 * ‖f v‖ + 2 * c1 * ‖f' v‖ + ‖f'' v‖ -+ have e1 : ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (F n) volume := by -+ apply Eventually.of_forall ; intro R ; apply (Continuous.norm ?_).aestronglyMeasurable -+ exact ((ch''.mul f.continuous).add ((continuous_const.mul ch').mul f.deriv.continuous)).add -+ (ch.mul f.deriv.deriv.continuous) -+ have e2 : ∀ᶠ R in atTop, ∀ᵐ (a : ℝ), ‖F R a‖ ≤ bound a := by -+ have hc1 : ∀ᶠ R in atTop, ∀ v, |h' R v| ≤ c1 := by -+ filter_upwards [eventually_ge_atTop 1] with R hR v -+ have hR' : R ≠ 0 := by linarith -+ have : 0 ≤ R := by linarith -+ simp only [CS.deriv_scale, CS.neg_apply, CS.smul_apply, smul_eq_mul, abs_neg, abs_mul, -+ abs_inv, abs_eq_self.mpr this, ge_iff_le, h'] -+ simp only [CS.scale, hR', ↓reduceDIte, funscale, smul_eq_mul] -+ convert_to _ ≤ c1 * 1 -+ · simp -+ · rw [mul_comm] -+ apply mul_le_mul (mg' _) -+ (inv_le_of_inv_le₀ (by linarith) (by simpa using hR)) (by positivity) -+ exact (abs_nonneg _).trans (mg' 0) -+ have hc2 : ∀ᶠ R in atTop, ∀ v, |h'' R v| ≤ c2 := by -+ filter_upwards [eventually_ge_atTop 1] with R hR v -+ have e1 : 0 ≤ R := by linarith -+ have e2 : R⁻¹ ≤ 1 := inv_le_of_inv_le₀ (by linarith) (by simpa using hR) -+ have e3 : R ≠ 0 := by linarith -+ simp only [CS.deriv_scale, CS.deriv_smul, CS.neg_apply, CS.smul_apply, smul_eq_mul, abs_neg, -+ abs_mul, abs_inv, abs_eq_self.mpr e1, ge_iff_le, h''] -+ convert_to _ ≤ 1 * (1 * c2) -+ · simp -+ apply mul_le_mul e2 ?_ (by positivity) zero_le_one -+ apply mul_le_mul e2 ?_ (by positivity) zero_le_one -+ simp only [CS.scale, e3, ↓reduceDIte, funscale, smul_eq_mul] ; apply mg'' -+ filter_upwards [hc1, hc2] with R hc1 hc2 -+ apply Eventually.of_forall ; intro v ; specialize hc1 v ; specialize hc2 v -+ simp only [F, bound, norm_norm] -+ refine (norm_add_le _ _).trans ?_ ; apply add_le_add -+ · refine (norm_add_le _ _).trans ?_ ; apply add_le_add <;> simp only [Complex.norm_mul, -+ Complex.norm_ofNat, norm_real, norm_eq_abs] <;> gcongr -+ · simpa using mul_le_mul (hh1 R v) le_rfl (by simp) zero_le_one -+ have e3 : Integrable bound volume := -+ (((f.hf.norm).const_mul _).add ((f.hf'.norm).const_mul _)).add f.hf''.norm -+ have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by -+ apply Eventually.of_forall ; intro v -+ have evg' : g' =ᶠ[𝓝 0] 0 := by convert! ← g.zero.deriv ; exact deriv_const' _ -+ have evg'' : g'' =ᶠ[𝓝 0] 0 := by convert! ← evg'.deriv ; exact deriv_const' _ -+ refine tendsto_norm_zero.comp <| (ZeroAtFilter.add ?_ ?_).add ?_ -+ · have eh'' v : ∀ᶠ R in atTop, h'' R v = 0 := by -+ filter_upwards [(vR v).eventually evg'', eventually_ne_atTop 0] with R hR hR' -+ simp only [CS.deriv_scale, CS.deriv_smul, CS.neg_apply, CS.smul_apply, smul_eq_mul, -+ neg_eq_zero, mul_eq_zero, inv_eq_zero, hR', false_or, h''] -+ simp only [CS.scale, hR', ↓reduceDIte, funscale, smul_eq_mul, mul_comm R⁻¹] -+ exact hR -+ apply tendsto_nhds_of_eventually_eq -+ filter_upwards [eh'' v] with R hR ; simp [hR] -+ · have eh' v : ∀ᶠ R in atTop, h' R v = 0 := by -+ filter_upwards [(vR v).eventually evg'] with R hR -+ simp [g'] at hR -+ simp [h', CS.deriv_scale', mul_comm R⁻¹, hR] -+ apply tendsto_nhds_of_eventually_eq -+ filter_upwards [eh' v] with R hR ; simp [hR] -+ · simpa [h] using! ((g.tendsto_scale v).const_sub 1).ofReal.mul tendsto_const_nhds -+ simpa [F] using tendsto_integral_filter_of_dominated_convergence bound e1 e2 e3 e4 -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Tactic/AdditiveCombination.lean b/PrimeNumberTheoremAnd/Erdos970/Tactic/AdditiveCombination.lean -new file mode 100644 -index 0000000..f79890f ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Tactic/AdditiveCombination.lean -@@ -0,0 +1,90 @@ -+import Mathlib.Tactic.Abel -+import Mathlib.Tactic.LinearCombinationPrime -+ -+namespace Erdos970 -+ -+namespace Mathlib.Tactic.LinearCombinationPrime -+open _root_.Mathlib.Tactic.LinearCombinationPrime -+open Lean -+open Elab Meta Term -+ -+variable {α β : Type*} -+ -+theorem pf_smul_c [SMul α β] {a b : α} (p : a = b) (c : β) : a • c = b • c := p ▸ rfl -+theorem c_smul_pf [SMul α β] {b c : β} (p : b = c) (a : α) : a • b = a • c := p ▸ rfl -+theorem smul_pf [SMul α β] {a₁ b₁ : α} (p₁ : (a₁ : α) = b₁) {a₂ b₂ : β} (p₂ : a₂ = b₂) : -+ a₁ • a₂ = b₁ • b₂ := p₁ ▸ p₂ ▸ rfl -+ -+partial def expandAdditiveCombo (ty : Expr) (stx : Syntax.Term) : TermElabM Expanded := withRef stx do -+ match stx with -+ | `(($e)) => expandLinearCombo ty e -+ | `($e₁ + $e₂) => do -+ match ← expandAdditiveCombo ty e₁, ← expandAdditiveCombo ty e₂ with -+ | .const c₁, .const c₂ => .const <$> ``($c₁ + $c₂) -+ | .proof p₁, .const c₂ => .proof <$> ``(pf_add_c $p₁ $c₂) -+ | .const c₁, .proof p₂ => .proof <$> ``(c_add_pf $p₂ $c₁) -+ | .proof p₁, .proof p₂ => .proof <$> ``(add_pf $p₁ $p₂) -+ | `($e₁ - $e₂) => do -+ match ← expandAdditiveCombo ty e₁, ← expandAdditiveCombo ty e₂ with -+ | .const c₁, .const c₂ => .const <$> ``($c₁ - $c₂) -+ | .proof p₁, .const c₂ => .proof <$> ``(pf_sub_c $p₁ $c₂) -+ | .const c₁, .proof p₂ => .proof <$> ``(c_sub_pf $p₂ $c₁) -+ | .proof p₁, .proof p₂ => .proof <$> ``(sub_pf $p₁ $p₂) -+ | `(-$e) => do -+ match ← expandAdditiveCombo ty e with -+ | .const c => .const <$> `(-$c) -+ | .proof p => .proof <$> ``(neg_pf $p) -+ | `(← $e:term) => do -+ match ← expandAdditiveCombo ty e with -+ | .const c => return .const c -+ | .proof p => .proof <$> ``(Eq.symm $p) -+ | `($e₁ • $e₂) => do -+ match ← expandAdditiveCombo ty e₁, ← expandAdditiveCombo ty e₂ with -+ | .const c₁, .const c₂ => .const <$> ``($c₁ • $c₂) -+ | .proof p₁, .const c₂ => .proof <$> ``(pf_smul_c $p₁ $c₂) -+ | .const c₁, .proof p₂ => .proof <$> ``(c_smul_pf $p₂ $c₁) -+ | .proof p₁, .proof p₂ => .proof <$> ``(smul_pf $p₁ $p₂) -+ | e => -+ -+ withSynthesize do -+ -+ let c ← withSynthesizeLight <| Term.elabTerm e ty -+ if (← whnfR (← inferType c)).isEq then -+ .proof <$> c.toSyntax -+ else -+ .const <$> c.toSyntax -+ -+def elabAdditiveCombination (tk : Syntax) -+ (norm? : Option Syntax.Tactic) (exp? : Option Syntax.NumLit) (input : Option Syntax.Term) -+ (twoGoals := false) : Tactic.TacticM Unit := Tactic.withMainContext do -+ let some (ty, _) := (← (← Tactic.getMainGoal).getType').eq? | -+ throwError "'additive_combination' only proves equalities" -+ let p ← match input with -+ | none => `(Eq.refl 0) -+ | some e => -+ match ← expandAdditiveCombo ty e with -+ | .const c => `(Eq.refl $c) -+ | .proof p => pure p -+ let norm := norm?.getD (Unhygienic.run <| withRef tk `(tactic| ((try simp only [smul_add, smul_sub]); abel))) -+ Term.withoutErrToSorry <| Tactic.evalTactic <| ← withFreshMacroScope <| -+ if twoGoals then -+ `(tactic| ( -+ refine eq_trans₃ $p ?a ?b -+ case' a => $norm:tactic -+ case' b => $norm:tactic)) -+ else -+ match exp? with -+ | some n => -+ if n.getNat = 1 then `(tactic| (refine eq_of_add $p ?a; case' a => $norm:tactic)) -+ else `(tactic| (refine eq_of_add_pow $n $p ?a; case' a => $norm:tactic)) -+ | _ => `(tactic| (refine eq_of_add $p ?a; case' a => $norm:tactic)) -+ -+syntax (name := AdditiveCombination) "additive_combination" -+ (normStx)? (expStx)? (ppSpace colGt term)? : tactic -+elab_rules : tactic -+ | `(tactic| additive_combination%$tk $[(norm := $tac)]? $[(exp := $n)]? $(e)?) => -+ elabAdditiveCombination tk tac n e -+ -+end Mathlib.Tactic.LinearCombinationPrime -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/Wiener.lean b/PrimeNumberTheoremAnd/Erdos970/Wiener.lean -new file mode 100644 -index 0000000..3259e31 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/Wiener.lean -@@ -0,0 +1,3571 @@ -+import Mathlib.Analysis.Fourier.RiemannLebesgueLemma -+import Mathlib.Analysis.Normed.Group.Tannery -+import Mathlib.Analysis.SumIntegralComparisons -+import Mathlib.NumberTheory.Chebyshev -+import Mathlib.NumberTheory.LSeries.PrimesInAP -+import Mathlib.NumberTheory.MulChar.Lemmas -+import Mathlib.Topology.EMetricSpace.BoundedVariation -+import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.Asymptotics.Asymptotics -+import PrimeNumberTheoremAnd.Erdos970.Fourier -+import PrimeNumberTheoremAnd.Erdos970.SmoothExistence -+import Mathlib.Analysis.Convolution -+ -+namespace Erdos970 -+ -+ -+open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries -+ _root_.Asymptotics Erdos970.Asymptotics SchwartzMap -+open Complex hiding log -+open scoped Topology -+open scoped ContDiff -+open scoped ComplexConjugate -+ -+variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} -+ [RCLike 𝕜] -+ -+noncomputable -+def nterm (f : ℕ → ℂ) (σ' : ℝ) (n : ℕ) : ℝ := if n = 0 then 0 else ‖f n‖ / n ^ σ' -+ -+lemma nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by -+ by_cases h : n = 0 <;> simp [nterm, term, h] -+ -+theorem norm_term_eq_nterm_re (s : ℂ) : -+ ‖term f s n‖ = nterm f (s.re) n := by -+ simp only [nterm, term, apply_ite (‖·‖), norm_zero, norm_div] -+ apply ite_congr rfl (fun _ ↦ rfl) -+ intro h -+ congr -+ refine norm_natCast_cpow_of_pos (by omega) s -+ -+lemma hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : -+ ∑' i, (‖term f σ' i‖₊ : ENNReal) ≠ ⊤ := by -+ simp_rw [ENNReal.tsum_coe_ne_top_iff_summable_coe, ← norm_toNNReal] -+ norm_cast -+ apply Summable.toNNReal -+ convert hf σ' hσ with i -+ simp [nterm_eq_norm_term] -+ -+instance instMeasurableSpace : MeasurableSpace Circle := -+ inferInstanceAs <| MeasurableSpace <| Subtype _ -+instance instBorelSpace : BorelSpace Circle := -+ inferInstanceAs <| BorelSpace <| Subtype (· ∈ Metric.sphere (0 : ℂ) 1) -+ -+attribute [fun_prop] Real.continuous_fourierChar -+ -+lemma first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ -+ (‖fourierChar (-(u * ((1 : ℝ) / ((2 : ℝ) * π) * (n / x).log))) • ψ u‖ₑ : ENNReal) := by -+ fun_prop -+ -+lemma first_fourier_aux2a : -+ (2 : ℂ) * π * -(y * (1 / (2 * π) * Real.log ((n) / x))) = -(y * ((n) / x).log) := by -+ calc -+ _ = -(y * (((2 : ℂ) * π) / (2 * π) * Real.log ((n) / x))) := by ring -+ _ = _ := by rw [div_self (by norm_num), one_mul] -+ -+lemma first_fourier_aux2 (hx : 0 < x) (n : ℕ) : -+ term f σ' n * 𝐞 (-(y * (1 / (2 * π) * Real.log (n / x)))) • ψ y = -+ term f (σ' + y * I) n • (ψ y * x ^ (y * I)) := by -+ by_cases hn : n = 0 -+ · simp [term, hn] -+ simp only [term, hn, ↓reduceIte] -+ calc -+ _ = (f n * (cexp ((2 * π * -(y * (1 / (2 * π) * Real.log (n / x)))) * I) / -+ ↑((n : ℝ) ^ σ'))) • ψ y := by -+ rw [Circle.smul_def, fourierChar_apply, ofReal_cpow (by norm_num)] -+ simp only [one_div, mul_inv_rev, mul_neg, ofReal_neg, ofReal_mul, ofReal_ofNat, ofReal_inv, -+ neg_mul, smul_eq_mul, ofReal_natCast] -+ ring -+ _ = (f n * (x ^ (y * I) / n ^ (σ' + y * I))) • ψ y := by -+ congr 2 -+ have l1 : 0 < (n : ℝ) := by simpa using Nat.pos_iff_ne_zero.mpr hn -+ have l2 : (x : ℂ) ≠ 0 := by simp [hx.ne.symm] -+ have l3 : (n : ℂ) ≠ 0 := by simp [hn] -+ rw [Real.rpow_def_of_pos l1, Complex.cpow_def_of_ne_zero l2, Complex.cpow_def_of_ne_zero l3] -+ push_cast -+ simp_rw [← Complex.exp_sub] -+ congr 1 -+ rw [first_fourier_aux2a, Real.log_div l1.ne.symm hx.ne.symm] -+ push_cast -+ rw [Complex.ofReal_log hx.le] -+ ring -+ _ = _ := by simp ; group -+ -+ -+lemma first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hsupp : Integrable ψ) (hx : 0 < x) (hσ : 1 < σ') : -+ ∑' n : ℕ, term f σ' n * (𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))) = -+ ∫ t : ℝ, LSeries f (σ' + t * I) * ψ t * x ^ (t * I) := by -+ -+ calc -+ _ = ∑' n, term f σ' n * ∫ (v : ℝ), 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ simp only [Real.fourier_eq] -+ simp only [one_div, mul_inv_rev, RCLike.inner_apply', conj_trivial] -+ _ = ∑' n, ∫ (v : ℝ), term f σ' n * 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ simp [integral_const_mul] -+ _ = ∫ (v : ℝ), ∑' n, term f σ' n * 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ refine (integral_tsum ?_ ?_).symm -+ · refine fun _ ↦ AEMeasurable.aestronglyMeasurable ?_ -+ have := hsupp.aemeasurable -+ fun_prop -+ · simp only [enorm_mul] -+ simp_rw [lintegral_const_mul'' _ (first_fourier_aux1 hsupp.aemeasurable _)] -+ calc -+ _ = (∑' (i : ℕ), ‖term f σ' i‖ₑ) * ∫⁻ (a : ℝ), ‖ψ a‖ₑ ∂volume := by -+ simp [ENNReal.tsum_mul_right, enorm_eq_nnnorm] -+ _ ≠ ⊤ := ENNReal.mul_ne_top (hf_coe1 hf hσ) -+ (ne_top_of_lt hsupp.2) -+ _ = _ := by -+ congr 1; ext y -+ simp_rw [mul_assoc (LSeries _ _), ← smul_eq_mul (a := (LSeries _ _)), LSeries] -+ rw [← Summable.tsum_smul_const] -+ · simp_rw [first_fourier_aux2 hx] -+ · apply Summable.of_norm -+ convert hf σ' hσ with n -+ rw [norm_term_eq_nterm_re] -+ simp -+ -+@[continuity] -+lemma continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ -+ -+attribute [fun_prop] measurable_coe_nnreal_ennreal -+ -+lemma second_fourier_integrable_aux1a (hσ : 1 < σ') : -+ IntegrableOn (fun (x : ℝ) ↦ cexp (-((x : ℂ) * ((σ' : ℂ) - 1)))) (Ici (-Real.log x)) := by -+ norm_cast -+ suffices IntegrableOn (fun (x : ℝ) ↦ (rexp (-(x * (σ' - 1))))) (Ici (-x.log)) _ from this.ofReal -+ simp_rw [fun (a x : ℝ) ↦ (by ring : -(x * a) = -a * x)] -+ rw [integrableOn_Ici_iff_integrableOn_Ioi] -+ apply exp_neg_integrableOn_Ioi -+ linarith -+ -+lemma second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : -+ let ν : Measure (ℝ × ℝ) := (volume.restrict (Ici (-Real.log x))).prod volume -+ Integrable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • -+ (𝐞 (Multiplicative.ofAdd (-(a * (u / (2 * π))))) : ℂ) • ψ a) ν := by -+ intro ν -+ constructor -+ · apply Measurable.aestronglyMeasurable -+ -+ simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, -+ Multiplicative.ofAdd, smul_eq_mul] -+ change Measurable (fun v : ℝ × ℝ => -+ cexp (-((v.1 : ℂ) * ((σ' : ℂ) - 1))) * -+ ((𝐞 (-(v.2 * (v.1 / (2 * π)))) : ℂ) * ψ v.2)) -+ fun_prop -+ · let f1 : ℝ → ENNReal := fun a1 ↦ ‖cexp (-(↑a1 * (↑σ' - 1)))‖ₑ -+ let f2 : ℝ → ENNReal := fun a2 ↦ ‖ψ a2‖ₑ -+ suffices ∫⁻ (a : ℝ × ℝ), f1 a.1 * f2 a.2 ∂ν < ⊤ by -+ simpa [hasFiniteIntegral_iff_enorm, enorm_eq_nnnorm, Function.uncurry] -+ refine (lintegral_prod_mul ?_ ?_).trans_lt ?_ <;> try fun_prop -+ exact ENNReal.mul_lt_top (second_fourier_integrable_aux1a hσ).2 hsupp.2 -+ -+lemma second_fourier_integrable_aux2 (hσ : 1 < σ') : -+ IntegrableOn (fun (u : ℝ) ↦ cexp ((1 - ↑σ' - ↑t * I) * ↑u)) (Ioi (-Real.log x)) := by -+ refine (integrable_norm_iff (Measurable.aestronglyMeasurable <| by fun_prop)).mp ?_ -+ suffices IntegrableOn (fun a ↦ rexp (-(σ' - 1) * a)) (Ioi (-x.log)) _ by simpa [Complex.norm_exp] -+ apply exp_neg_integrableOn_Ioi -+ linarith -+ -+lemma second_fourier_aux (hx : 0 < x) : -+ -(cexp (-((1 - ↑σ' - ↑t * I) * ↑(Real.log x))) / (1 - ↑σ' - ↑t * I)) = -+ ↑(x ^ (σ' - 1)) * (↑σ' + ↑t * I - 1)⁻¹ * ↑x ^ (↑t * I) := by -+ calc -+ _ = cexp (↑(Real.log x) * ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [← div_neg]; ring_nf -+ _ = (x ^ ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr (ne_of_gt hx)), Complex.ofReal_log hx.le] -+ _ = (x ^ ((σ' : ℂ) - 1)) * (x ^ (↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [Complex.cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt hx))] -+ _ = _ := by rw [ofReal_cpow hx.le]; push_cast; ring -+ -+ -+lemma second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) -+ {x σ' : ℝ} (hx : 0 < x) (hσ : 1 < σ') : -+ ∫ u in Ici (-log x), Real.exp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -+ (x^(σ' - 1) : ℝ) * ∫ t, (1 / (σ' + t * I - 1)) * ψ t * x^(t * I) ∂ volume := by -+ -+ conv in ↑(rexp _) * _ => { rw [Real.fourier_real_eq, ← smul_eq_mul, ← integral_smul] } -+ rw [MeasureTheory.integral_integral_swap] -+ swap -+ · exact second_fourier_integrable_aux1 hcont hsupp hσ -+ rw [← integral_const_mul] -+ congr 1; ext t -+ dsimp -+ -+ simp_rw [mul_smul_comm, ← smul_mul_assoc, integral_mul_const] -+ rw [fun (a b d : ℂ) ↦ show a * (b * (ψ t) * d) = (a * b * d) * ψ t by ring] -+ congr 1 -+ conv => -+ lhs -+ enter [2] -+ ext a -+ rw [Circle.smul_def, smul_eq_mul] -+ simp only [Real.fourierChar, Circle.exp] -+ change cexp ((↑(2 * π * -(t * (a / (2 * π)))) : ℂ) * I) * -+ (rexp (-a * (σ' - 1)) : ℂ) -+ push_cast -+ simp_rw [← Complex.exp_add] -+ have (u : ℝ) : -+ 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I + -↑u * (↑σ' - 1) = (1 - σ' - t * I) * u := calc -+ _ = -↑u * (↑σ' - 1) + (2 * ↑π) / (2 * ↑π) * -(↑t * ↑u) * I := by ring -+ _ = -↑u * (↑σ' - 1) + 1 * -(↑t * ↑u) * I := by rw [div_self (by norm_num)] -+ _ = _ := by ring -+ simp_rw [this] -+ let c : ℂ := (1 - ↑σ' - ↑t * I) -+ have : c ≠ 0 := by simp [Complex.ext_iff, c, sub_ne_zero.mpr hσ.ne] -+ let f' (u : ℝ) := cexp (c * u) -+ let f := fun (u : ℝ) ↦ (f' u) / c -+ have hderiv : ∀ u ∈ Ici (-Real.log x), HasDerivAt f (f' u) u := by -+ intro u _ -+ rw [show f' u = cexp (c * u) * (c * 1) / c by simp only [f']; field_simp] -+ exact (hasDerivAt_id' u).ofReal_comp.const_mul c |>.cexp.div_const c -+ have hf : Tendsto f atTop (𝓝 0) := by -+ apply tendsto_zero_iff_norm_tendsto_zero.mpr -+ suffices Tendsto (fun (x : ℝ) ↦ ‖cexp (c * ↑x)‖ / ‖c‖) atTop (𝓝 (0 / ‖c‖)) by -+ simpa [f, f'] using this -+ apply Filter.Tendsto.div_const -+ suffices Tendsto (· * (1 - σ')) atTop atBot by simpa [Complex.norm_exp, mul_comm (1 - σ'), c] -+ exact Tendsto.atTop_mul_const_of_neg (by linarith) fun ⦃s⦄ h ↦ h -+ rw [integral_Ici_eq_integral_Ioi, -+ integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (second_fourier_integrable_aux2 hσ) hf] -+ simpa [f, f'] using second_fourier_aux hx -+ -+lemma one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) -+ -+theorem prelim_decay (ψ : ℝ → ℂ) (u : ℝ) : ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ ∫ t, ‖ψ t‖ := -+ VectorFourier.norm_fourierIntegral_le_integral_norm .. -+ -+lemma decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by -+ have l1 : 0 < 1 + u ^ 2 := one_add_sq_pos _ -+ have l2 : 1 + u ^ 2 = ‖(1 : ℂ) + u ^ 2‖ := by -+ norm_cast ; simp only [Real.norm_eq_abs, abs_eq_self.2 l1.le] -+ have l3 : ‖1 / ((4 : ℂ) * ↑π ^ 2)‖ ≤ (4 * π ^ 2)⁻¹ := by simp -+ have key := fourierIntegral_self_add_deriv_deriv f u -+ simp only [Function.iterate_succ _ 1, Function.iterate_one, Function.comp_apply] at key -+ rw [F_sub f.hf (f.hf''.const_mul (1 / (4 * ↑π ^ 2)))] at key -+ rw [← div_eq_mul_inv, le_div_iff₀ l1, mul_comm, l2, ← norm_mul, key, sub_eq_add_neg] -+ apply norm_add_le _ _ |>.trans -+ change _ ≤ W21.norm _ -+ rw [norm_neg, F_mul, norm_mul, W21.norm] -+ gcongr <;> apply VectorFourier.norm_fourierIntegral_le_integral_norm -+ -+lemma decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) -+ (h : ∀ t, ‖f t‖ ≤ A * (1 + t ^ 2)⁻¹) : -+ ∫ t, ‖f t‖ ≤ π * A := by -+ have l1 : Integrable (fun x ↦ A * (1 + x ^ 2)⁻¹) := integrable_inv_one_add_sq.const_mul A -+ simp_rw [← integral_univ_inv_one_add_sq, mul_comm, ← integral_const_mul] -+ exact integral_mono (l1.mono' hf (Eventually.of_forall h)).norm l1 h -+ -+theorem decay_bounds_W21 (f : W21) (hA : ∀ t, ‖f t‖ ≤ A / (1 + t ^ 2)) -+ (hA' : ∀ t, ‖deriv (deriv f) t‖ ≤ A / (1 + t ^ 2)) (u) : -+ ‖𝓕 (f : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by -+ have l0 : 1 * (4 * π)⁻¹ * A = (4 * π ^ 2)⁻¹ * (π * A) := by field_simp -+ have l1 : ∫ (v : ℝ), ‖f v‖ ≤ π * A := by -+ apply decay_bounds_aux f.continuous.aestronglyMeasurable -+ simp_rw [← div_eq_mul_inv] ; exact hA -+ have l2 : ∫ (v : ℝ), ‖deriv (deriv f) v‖ ≤ π * A := by -+ apply decay_bounds_aux f.deriv.deriv.continuous.aestronglyMeasurable -+ simp_rw [← div_eq_mul_inv] ; exact hA' -+ apply decay_bounds_key f u |>.trans -+ change W21.norm _ * _ ≤ _ -+ simp_rw [W21.norm, div_eq_mul_inv, add_mul, l0] ; gcongr -+ -+lemma decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) -+ (hA' : ∀ t, ‖deriv^[2] ψ t‖ ≤ A / (1 + t ^ 2)) : -+ ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by -+ exact decay_bounds_W21 ψ hA hA' u -+ -+lemma decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by -+ have l1 : HasCompactSupport (fun u : ℝ => ((1 + u ^ 2) : ℝ) * ψ u) := by exact ψ.h2.mul_left -+ have := ψ.h1.continuous -+ obtain ⟨C, hC⟩ := l1.exists_bound_of_continuous (by fun_prop) -+ refine ⟨C, fun u => ?_⟩ -+ specialize hC u -+ simp only [norm_mul, Complex.norm_real, norm_of_nonneg (one_add_sq_pos u).le] at hC -+ rwa [le_div_iff₀' (one_add_sq_pos _)] -+ -+lemma decay_bounds_cor (ψ : W21) : -+ ∃ C : ℝ, ∀ u, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by -+ simpa only [div_eq_mul_inv] using ⟨_, decay_bounds_key ψ⟩ -+ -+@[continuity, fun_prop] lemma continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := -+ VectorFourier.fourierIntegral_continuous continuous_fourierChar -+ (by simp only [innerₗ_apply_apply, RCLike.inner_apply', conj_trivial, continuous_mul]) -+ ψ.hf -+ -+lemma W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : -+ Integrable fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c) := by -+ have l1 (C) : Integrable (fun u ↦ C / (1 + (u / c) ^ 2)) volume := by -+ simpa using! (integrable_inv_one_add_sq.comp_div hc).const_mul C -+ have l2 : AEStronglyMeasurable (fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c)) volume := by -+ apply Continuous.aestronglyMeasurable ; fun_prop -+ obtain ⟨C, h⟩ := decay_bounds_cor ψ -+ apply @Integrable.mono' ℝ ℂ _ volume _ _ (fun u => C / (1 + (u / c) ^ 2)) (l1 C) l2 ?_ -+ apply Eventually.of_forall (fun x => h _) -+ -+lemma continuous_LSeries_aux (hf : Summable (nterm f σ')) : -+ Continuous fun x : ℝ => LSeries f (σ' + x * I) := by -+ -+ have l1 i : Continuous fun x : ℝ ↦ term f (σ' + x * I) i := by -+ by_cases h : i = 0 -+ · simpa [h] using continuous_const -+ · simpa [h] using! continuous_const.div (continuous_const.cpow (by fun_prop) (by simp [h])) -+ (fun x => by simp [h]) -+ have l2 n (x : ℝ) : ‖term f (σ' + x * I) n‖ = nterm f σ' n := by -+ by_cases h : n = 0 -+ · simp [h, nterm] -+ · simp [h, nterm, cpow_add _ _ (Nat.cast_ne_zero.mpr h), -+ Complex.norm_natCast_cpow_of_pos (Nat.pos_of_ne_zero h)] -+ exact continuous_tsum l1 hf (fun n x => le_of_eq (l2 n x)) -+ -+lemma limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) (σ' : ℝ) -+ (hσ' : 1 < σ') : -+ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) -+ (u / (2 * π)) = ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by -+ have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 -+ have l3 : 0 < x := zero_lt_one.trans_le hx -+ have l1 (σ') (hσ' : 1 < σ') := first_fourier hf hint l3 hσ' -+ have l2 (σ') (hσ' : 1 < σ') := second_fourier ψ.h1.continuous.measurable hint l3 hσ' -+ have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := -+ continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [l3]) -+ have l6 : Continuous fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by -+ apply ((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8 -+ have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by -+ exact l6.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right -+ have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := by -+ intro h ; have := congr_arg Complex.re h ; simp at this ; linarith -+ have l7 : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * -+ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -+ simp only [one_div, ← mul_assoc] -+ refine ((continuous_const.mul <| Continuous.inv₀ ?_ e2).mul ψ.h1.continuous).mul l8 -+ fun_prop -+ have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * -+ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -+ apply l7.integrable_of_hasCompactSupport -+ exact ψ.h2.mul_left.mul_right.mul_left.mul_left -+ -+ simp_rw [l1 σ' hσ', l2 σ' hσ', ← integral_const_mul, ← integral_sub l4 l5] -+ apply integral_congr_ae -+ apply Eventually.of_forall -+ intro u -+ have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] -+ simp_rw [hG' e1, sub_mul, ← mul_assoc] -+ simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, -+ mul_eq_zero, I_ne_zero, or_false] -+ left ; left -+ field_simp [e2] -+ norm_cast -+ simp [mul_assoc, ← rpow_add l3] -+ -+section nabla -+ -+variable {α E : Type*} [OfNat α 1] [Add α] [Sub α] {u : α → ℂ} -+ -+def cumsum [AddCommMonoid E] (u : ℕ → E) (n : ℕ) : E := ∑ i ∈ Finset.range n, u i -+ -+def nabla [Sub E] (u : α → E) (n : α) : E := u (n + 1) - u n -+ -+def nnabla [Sub E] (u : α → E) (n : α) : E := u n - u (n + 1) -+ -+def shift (u : α → E) (n : α) : E := u (n + 1) -+ -+@[simp] lemma cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] -+ -+lemma cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : -+ cumsum u (n + 1) = cumsum u n + u n := by -+ simp [cumsum, Finset.sum_range_succ] -+ -+@[simp] lemma nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by -+ ext n ; simp [nabla, cumsum, Finset.range_add_one] -+ -+lemma neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := -+ funext (fun n => by simp [cumsum]) -+ -+lemma cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := -+ fun _ => Finset.sum_nonneg (fun i _ => hu i) -+ -+omit [Sub α] in -+lemma neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] -+ -+omit [Sub α] in -+@[simp] lemma nabla_mul [Ring E] {u : α → E} {c : E} : nabla (fun n => c * u n) = c • nabla u := by -+ ext n ; simp [nabla, mul_sub] -+ -+omit [Sub α] in -+@[simp] lemma nnabla_mul [Ring E] {u : α → E} {c : E} : -+ nnabla (fun n => c * u n) = c • nnabla u := by -+ ext n ; simp [nnabla, mul_sub] -+ -+lemma nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by -+ ext n ; simp [nnabla] -+ -+end nabla -+ -+lemma Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : -+ cumsum u (n + 1) = u 0 + cumsum (shift u) n := by -+ simp_rw [add_comm n, cumsum, _root_.Finset.sum_range_add, -+ _root_.Finset.sum_range_one, add_comm 1] ; rfl -+ -+lemma Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : -+ shift (cumsum u) = (fun _ => u 0) + cumsum (shift u) := by -+ ext n ; apply Finset.sum_shift_front -+ -+lemma Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : -+ cumsum u (n + 1) = cumsum u n + u n := by -+ simp [cumsum, Finset.range_add_one, add_comm] -+ -+lemma Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : -+ shift (cumsum u) = cumsum u + u := by -+ ext n ; apply Finset.sum_shift_back -+ -+lemma summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : -+ cumsum (a * b) (n + 1) = A (n + 1) * b n - A 0 * b 0 - -+ cumsum (shift A * fun i => (b (i + 1) - b i)) n := by -+ have l1 : ∑ x ∈ Finset.range (n + 1), A (x + 1) * b x = ∑ x ∈ Finset.range n, -+ A (x + 1) * b x + A (n + 1) * b n := -+ Finset.sum_shift_back -+ have l2 : ∑ x ∈ Finset.range (n + 1), A x * b x = A 0 * b 0 + ∑ x ∈ Finset.range n, -+ A (x + 1) * b (x + 1) := -+ Finset.sum_shift_front -+ simp only [cumsum, ha, Pi.mul_apply, nabla, sub_mul, Finset.sum_sub_distrib, l1, l2, shift, -+ mul_sub] -+ abel -+ -+lemma summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : -+ cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - cumsum (shift (cumsum a) * nabla b) n := by -+ simpa using! summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) -+ -+lemma summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : -+ shift (cumsum (a * b)) = shift (cumsum a) * b - cumsum (shift (cumsum a) * nabla b) := by -+ ext n ; apply summation_by_parts' -+ -+lemma summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : -+ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by -+ have l1 : (cumsum u =O[atTop] 1) ↔ _ := isBigO_one_nat_atTop_iff -+ have l2 n : ‖cumsum u n‖ = cumsum u n := by simpa using cumsum_nonneg hu n -+ simp only [BoundedAtFilter, l1, l2] -+ constructor <;> intro ⟨C, h1⟩ -+ · exact ⟨C, fun n => sum_le_hasSum _ (fun i _ => hu i) h1⟩ -+ · exact summable_of_sum_range_le hu h1 -+ -+lemma Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : -+ Summable u := -+ summable_of_isBigO_nat hu h.isBigO -+ -+lemma summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by -+ exact ⟨Erdos970.Filter.EventuallyEq.summable huv.symm, -+ Erdos970.Filter.EventuallyEq.summable huv⟩ -+ -+lemma BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : -+ BoundedAtFilter atTop (fun n => u n + c) ↔ BoundedAtFilter atTop u := by -+ have : u = fun n => (u n + c) + (-c) := by ext n ; ring -+ simp only [BoundedAtFilter] -+ constructor <;> intro h -+ on_goal 1 => rw [this] -+ all_goals { exact h.add (const_boundedAtFilter _ _) } -+ -+lemma BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : -+ BoundedAtFilter atTop (fun n => u (n + N)) ↔ BoundedAtFilter atTop u := by -+ simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, -+ eventually_atTop] -+ constructor <;> intro ⟨C, n₀, h⟩ <;> use C -+ · refine ⟨n₀ + N, fun n hn => ?_⟩ -+ obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' (m := N) (n := n) (by grind) -+ exact h _ <| Nat.add_le_add_iff_right.mp hn -+ · exact ⟨n₀, fun n hn => h _ (by grind)⟩ -+ -+lemma summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : -+ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by -+ obtain ⟨N, hu⟩ := eventually_atTop.mp hu -+ have e2 : cumsum (fun i ↦ u (i + N)) = fun n => cumsum u (n + N) - cumsum u N := by -+ ext n ; simp_rw [cumsum, add_comm _ N, Finset.sum_range_add] ; ring -+ rw [← summable_nat_add_iff N, summable_iff_bounded (fun n => hu _ <| Nat.le_add_left N n), e2] -+ simp_rw [sub_eq_add_neg, BoundedAtFilter.add_const, BoundedAtFilter.comp_add] -+ -+lemma bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : -+ BoundedAtFilter atTop u := by -+ simp only [BoundedAtFilter, isBigO_iff, eventually_atTop] at h ⊢ -+ obtain ⟨C, N, hC⟩ := h -+ refine ⟨C, N + 1, fun n hn => ?_⟩ -+ simp only [shift] at hC -+ have r1 : n - 1 ≥ N := Nat.le_sub_one_of_lt hn -+ have r2 : n - 1 + 1 = n := Nat.sub_add_cancel (by omega) -+ simpa [r2] using hC (n - 1) r1 -+ -+lemma dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) -+ (hAb : BoundedAtFilter atTop (shift (cumsum a) * b)) (hbb : ∀ᶠ n in atTop, b (n + 1) ≤ b n) -+ (h : Summable (shift (cumsum a) * nnabla b)) : Summable (a * b) := by -+ have l1 : ∀ᶠ n in atTop, 0 ≤ (shift (cumsum a) * nnabla b) n := by -+ filter_upwards [hbb] with n hb -+ exact mul_nonneg (by -+ change 0 ≤ ∑ index ∈ Finset.range (n + 1), a index -+ exact Finset.sum_nonneg (fun index _ => ha index)) (sub_nonneg.mpr hb) -+ rw [summable_iff_bounded (mul_nonneg ha hb)] -+ rw [summable_iff_bounded' l1] at h -+ apply bounded_of_shift -+ simpa only [summation_by_parts'', sub_eq_add_neg, neg_cumsum, ← mul_neg, neg_nabla] -+ using hAb.add h -+ -+lemma exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : -+ ∃ v : ℕ → ℝ, range v ⊆ range u ∧ Antitone v ∧ v =ᶠ[atTop] u := by -+ obtain ⟨N, hN⟩ := eventually_atTop.mp hu -+ let v (n : ℕ) := u (if n < N then N else n) -+ refine ⟨v, ?_, ?_, ?_⟩ -+ · exact fun x ⟨n, hn⟩ => ⟨if n < N then N else n, hn⟩ -+ · refine antitone_nat_of_succ_le (fun n => ?_) -+ by_cases h : n < N -+ · by_cases h' : n + 1 < N <;> simp [v, h, h'] -+ have : n + 1 = N := by linarith -+ simp [this] -+ · have : ¬(n + 1 < N) := by linarith -+ simp only [this, ↓reduceIte, h, ge_iff_le, v] ; apply hN ; linarith -+ · have : ∀ᶠ n in atTop, ¬(n < N) := by simpa using ⟨N, fun b hb => by linarith⟩ -+ filter_upwards [this] with n hn ; simp [v, hn] -+ -+lemma summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by -+ let u (n : ℕ) := (n * (Real.log n) ^ 2)⁻¹ -+ have l7 : ∀ᶠ n : ℕ in atTop, 1 ≤ Real.log n := -+ tendsto_atTop.mp (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) 1 -+ have l8 : ∀ᶠ n : ℕ in atTop, 1 ≤ n := eventually_ge_atTop 1 -+ have l9 : ∀ᶠ n in atTop, u (n + 1) ≤ u n := by -+ filter_upwards [l7, l8] with n l2 l8; dsimp [u]; gcongr <;> simp -+ obtain ⟨v, l1, l2, l3⟩ := exists_antitone_of_eventually l9 -+ rw [summable_congr_ae l3.symm] -+ have l4 (n : ℕ) : 0 ≤ v n := by obtain ⟨k, hk⟩ := l1 ⟨n, rfl⟩ ; rw [← hk] ; positivity -+ apply (summable_condensed_iff_of_nonneg l4 (fun _ _ _ a ↦ l2 a)).mp -+ suffices this : ∀ᶠ k : ℕ in atTop, 2 ^ k * v (2 ^ k) = ((k : ℝ) ^ 2)⁻¹ * ((Real.log 2) ^ 2)⁻¹ by -+ exact (summable_congr_ae this).mpr <| (Real.summable_nat_pow_inv.mpr one_lt_two).mul_right _ -+ have l5 : ∀ᶠ k in atTop, v (2 ^ k) = u (2 ^ k) := -+ l3.comp_tendsto <| tendsto_pow_atTop_atTop_of_one_lt Nat.le.refl -+ filter_upwards [l5, l8] with k l5 l8 -+ simp only [l5, mul_inv_rev, Nat.cast_pow, Nat.cast_ofNat, log_pow, u] -+ field_simp -+ -+lemma tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ Tendsto (fun x => a * x + b) atTop atTop := -+ tendsto_atTop_add_const_right _ b (tendsto_id.const_mul_atTop ha) -+ -+lemma isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} -+ (hf : Tendsto f atTop atTop) : (fun _ => a) =o[atTop] f := by -+ simp [tendsto_norm_atTop_atTop.comp hf] -+ -+lemma isBigO_pow_pow_of_le {m n : ℕ} (h : m ≤ n) : -+ (fun x : ℝ => x ^ m) =O[atTop] (fun x : ℝ => x ^ n) := by -+ apply IsBigO.of_bound 1 -+ filter_upwards [eventually_ge_atTop 1] with x l1 -+ simpa [abs_eq_self.mpr (zero_le_one.trans l1)] using pow_le_pow_right₀ l1 h -+ -+lemma isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by -+ apply IsLittleO.add -+ · apply IsLittleO.const_mul_left ; simpa using isLittleO_pow_pow_atTop_of_lt (𝕜 := ℝ) one_lt_two -+ · apply isLittleO_const_of_tendsto_atTop _ <| tendsto_pow_atTop (by linarith) -+ -+lemma log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ (fun x => Real.log (a * x + b)) =O[atTop] Real.log := by -+ apply IsBigO.of_bound (2 : ℕ) -+ have l2 : ∀ᶠ x : ℝ in atTop, 0 ≤ log x := tendsto_atTop.mp tendsto_log_atTop 0 -+ have l3 : ∀ᶠ x : ℝ in atTop, 0 ≤ log (a * x + b) := -+ tendsto_atTop.mp (tendsto_log_atTop.comp (tendsto_mul_add_atTop ha b)) 0 -+ have l5 : ∀ᶠ x : ℝ in atTop, 1 ≤ a * x + b := tendsto_atTop.mp (tendsto_mul_add_atTop ha b) 1 -+ have l1 : ∀ᶠ x : ℝ in atTop, a * x + b ≤ x ^ 2 := by -+ filter_upwards [(isLittleO_mul_add_sq a b).eventuallyLE, l5] with x r2 l5 -+ simpa [abs_eq_self.mpr (zero_le_one.trans l5)] using r2 -+ filter_upwards [l1, l2, l3, l5] with x l1 l2 l3 l5 -+ simpa [abs_eq_self.mpr l2, abs_eq_self.mpr l3, Real.log_pow] using -+ Real.log_le_log (by linarith) l1 -+ -+lemma isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ Real.log =O[atTop] (fun x => Real.log (a * x + b)) := by -+ convert! (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto -+ (tendsto_mul_add_atTop (b := b) ha) using 1 -+ ext x -+ simp only [Function.comp_apply] -+ congr -+ field_simp -+ simp -+ -+lemma log_isbigo_log_div {d : ℝ} (hb : 0 < d) : -+ (fun n ↦ Real.log n) =O[atTop] (fun n ↦ Real.log (n / d)) := by -+ convert isBigO_log_mul_add (inv_pos.mpr hb) 0 using 1; simp only [add_zero]; field_simp -+ -+lemma Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : -+ f =O[atTop] (f + g) := by -+ rw [isLittleO_iff] at h ; specialize h (c := 2⁻¹) (by norm_num) -+ rw [isBigO_iff''] -+ refine ⟨2⁻¹, by norm_num, ?_⟩ -+ filter_upwards [h] with x h -+ simp only [norm_eq_abs, Pi.add_apply] at h ⊢ -+ calc _ = |f x| - 2⁻¹ * |f x| := by ring -+ _ ≤ |f x| - |g x| := by linarith -+ _ ≤ |(|f x| - |g x|)| := le_abs_self _ -+ _ ≤ _ := by rw [← sub_neg_eq_add, ← abs_neg (g x)] ; exact abs_abs_sub_abs_le (f x) (-g x) -+ -+lemma Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : -+ (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := by -+ simpa [pow_two] using h.mul h -+ -+lemma log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : -+ (fun x ↦ Real.log x ^ 2) =O[atTop] (fun x ↦ a + Real.log (x / b) ^ 2) := by -+ apply (Erdos970.Asymptotics.IsBigO.sq (log_isbigo_log_div hb)).trans -+ simp_rw [add_comm a] -+ refine IsBigO.add_isLittleO_right <| isLittleO_const_of_tendsto_atTop _ ?_ -+ exact (tendsto_pow_atTop two_ne_zero).comp <| -+ tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb -+ -+theorem log_add_div_isBigO_log (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ (fun x ↦ Real.log ((x + a) / b)) =O[atTop] fun x ↦ Real.log x := by -+ convert log_mul_add_isBigO_log (inv_pos.mpr hb) (a / b) using 3 ; ring -+ -+lemma log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by -+ have l1 : ContinuousOn Real.log (Icc x (x + 1)) := by -+ apply continuousOn_log.mono ; intro t ⟨h1, _⟩ ; simp ; linarith -+ have l2 t (ht : t ∈ Ioo x (x + 1)) : HasDerivAt Real.log t⁻¹ t := -+ Real.hasDerivAt_log (by linarith [ht.1]) -+ obtain ⟨t, ⟨ht1, _⟩, htx⟩ := exists_hasDerivAt_eq_slope Real.log (·⁻¹) (by linarith) l1 l2 -+ simp only [add_sub_cancel_left, div_one] at htx -+ rw [nabla, ← htx, inv_le_inv₀ (by linarith) hx] -+ exact ht1.le -+ -+lemma nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by -+ apply IsBigO.of_bound 1 -+ filter_upwards [eventually_gt_atTop 0] with x l1 -+ have l2 : log x ≤ log (x + 1) := log_le_log l1 (by linarith) -+ simpa [nabla, abs_eq_self.mpr l1.le, abs_eq_self.mpr (sub_nonneg.mpr l2)] using -+ log_add_one_sub_log_le l1 -+ -+lemma nabla_log {b : ℝ} (hb : 0 < b) : -+ nabla (fun x => Real.log (x / b)) =O[atTop] (fun x => 1 / x) := by -+ refine EventuallyEq.trans_isBigO ?_ nabla_log_main -+ filter_upwards [eventually_gt_atTop 0] with x l2 -+ rw [nabla, log_div (by linarith) (by linarith), log_div l2.ne.symm (by linarith), nabla] ; ring -+ -+lemma nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ nabla (fun x => x * (a + Real.log (x / b) ^ 2)) =O[atTop] (fun x => Real.log x ^ 2) := by -+ -+ have l1 : nabla (fun n => n * (a + Real.log (n / b) ^ 2)) = fun n => -+ a + Real.log ((n + 1) / b) ^ 2 + -+ (n * (Real.log ((n + 1) / b) ^ 2 - Real.log (n / b) ^ 2)) := by -+ ext n ; simp [nabla] ; ring -+ have l2 := (isLittleO_const_of_tendsto_atTop a -+ ((tendsto_pow_atTop two_ne_zero).comp tendsto_log_atTop)).isBigO -+ have l3 := Erdos970.Asymptotics.IsBigO.sq (log_add_div_isBigO_log 1 hb) -+ have l4 : (fun x => Real.log ((x + 1) / b) + Real.log (x / b)) =O[atTop] Real.log := by -+ simpa using (log_add_div_isBigO_log _ hb).add (log_add_div_isBigO_log 0 hb) -+ have e2 : (fun x : ℝ => x * (Real.log x * (1 / x))) =ᶠ[atTop] Real.log := by -+ filter_upwards [eventually_ge_atTop 1] with x hx using by field_simp -+ have l5 : (fun n ↦ n * (Real.log n * (1 / n))) =O[atTop] (fun n ↦ (Real.log n) ^ 2) := -+ e2.trans_isBigO -+ (by simpa using! (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) -+ -+ simp_rw [l1, _root_.sq_sub_sq] -+ exact ((l2.add l3).add (isBigO_refl (·) atTop |>.mul (l4.mul (nabla_log hb)) |>.trans l5)) -+ -+lemma nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ Tendsto (fun x => x * (a + Real.log (x / b) ^ 2)) atTop atTop := -+ tendsto_id.atTop_mul_atTop₀ <| tendsto_atTop_add_const_left _ _ <| -+ (tendsto_pow_atTop two_ne_zero).comp <| tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb -+ -+lemma nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ ∀ᶠ x in atTop, 0 < x * (a + Real.log (x / b) ^ 2) := -+ (nnabla_bound_aux1 a hb).eventually (eventually_gt_atTop 0) -+ -+lemma Real.log_eventually_gt_atTop (a : ℝ) : -+ ∀ᶠ x in atTop, a < Real.log x := -+ Real.tendsto_log_atTop.eventually (eventually_gt_atTop a) -+ -+@[local gcongr] -+theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : -+ ‖x‖ ≤ ‖y‖ := by -+ simp_rw [Real.norm_eq_abs] -+ apply abs_le_abs hxy -+ linarith -+ -+lemma nnabla_bound_aux {x : ℝ} (hx : 0 < x) : -+ nnabla (fun n ↦ 1 / (n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2))) =O[atTop] -+ (fun n ↦ 1 / (Real.log n ^ 2 * n ^ 2)) := by -+ -+ let d n : ℝ := n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2) -+ change (fun x_1 ↦ nnabla (fun n ↦ 1 / d n) x_1) =O[atTop] _ -+ -+ have l2 : ∀ᶠ n in atTop, 0 < d n := (nnabla_bound_aux2 ((2 * π) ^ 2) hx) -+ have l3 : ∀ᶠ n in atTop, 0 < d (n + 1) := -+ (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_id).eventually l2 -+ have l1 : ∀ᶠ n : ℝ in atTop, -+ nnabla (fun n ↦ 1 / d n) n = (d (n + 1) - d n) * (d n)⁻¹ * (d (n + 1))⁻¹ := by -+ filter_upwards [l2, l3] with n l2 l3 -+ rw [nnabla, one_div, one_div, inv_sub_inv l2.ne.symm l3.ne.symm, div_eq_mul_inv, mul_inv, -+ mul_assoc] -+ -+ have l4 : (fun n => (d n)⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by -+ apply IsBigO.inv_rev -+ · refine (isBigO_refl _ _).mul <| (log_sq_isbigo_mul hx) -+ · filter_upwards [Real.log_eventually_gt_atTop 0, eventually_gt_atTop 0] with x hx hx' -+ rw [← not_imp_not] -+ intro _ -+ positivity -+ have l5 : (fun n => (d (n + 1))⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by -+ refine IsBigO.trans ?_ l4 -+ rw [isBigO_iff]; use 1 -+ have e3 : ∀ᶠ n in atTop, d n ≤ d (n + 1) := by -+ filter_upwards [eventually_ge_atTop x] with n hn -+ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn -+ have : 0 ≤ n := hx.le.trans hn -+ simp only [d] -+ gcongr <;> simp [Real.log_nonneg, *] -+ filter_upwards [l2, l3, e3] with n e1 e2 e3 -+ simp_rw [one_mul] -+ gcongr -+ -+ have l6 : (fun n => d (n + 1) - d n) =O[atTop] (fun n => (Real.log n) ^ 2) := by -+ simpa [d, nabla] using! (nnabla_mul_log_sq ((2 * π) ^ 2) hx) -+ -+ apply EventuallyEq.trans_isBigO l1 -+ -+ apply ((l6.mul l4).mul l5).trans_eventuallyEq -+ filter_upwards [eventually_ge_atTop 2, Real.log_eventually_gt_atTop 0] with n hn hn' -+ field_simp -+ -+lemma nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : -+ nnabla (fun n => C / (1 + (Real.log (n / x) / (2 * π)) ^ 2) / n) =O[atTop] -+ (fun n => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by -+ field_simp -+ simp only [div_eq_mul_inv, mul_inv, nnabla_mul, one_mul] -+ apply IsBigO.const_mul_left -+ simpa [div_eq_mul_inv, mul_pow, mul_comm] using nnabla_bound_aux hx -+ -+def chebyWith (C : ℝ) (f : ℕ → ℂ) : Prop := ∀ n, cumsum (‖f ·‖) n ≤ C * n -+ -+def cheby (f : ℕ → ℂ) : Prop := ∃ C, chebyWith C f -+ -+lemma cheby.bigO (h : cheby f) : cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by -+ have l1 : 0 ≤ cumsum (‖f ·‖) := cumsum_nonneg (fun _ => norm_nonneg _) -+ obtain ⟨C, hC⟩ := h -+ apply isBigO_of_le' (c := C) atTop -+ intro n -+ rw [Real.norm_eq_abs, abs_eq_self.mpr (l1 n)] -+ simpa using hC n -+ -+lemma limiting_fourier_lim1_aux (hcheby : cheby f) (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : -+ Summable fun n ↦ ‖f n‖ / ↑n * (C / (1 + (1 / (2 * π) * Real.log (↑n / x)) ^ 2)) := by -+ -+ let a (n : ℕ) := (C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2) / ↑n) -+ replace hcheby := hcheby.bigO -+ -+ have l1 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n : ℕ => (↑(n + 1) : ℝ)) := -+ hcheby.comp_tendsto <| tendsto_add_atTop_nat 1 -+ have l2 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n => (n : ℝ)) := -+ l1.trans -+ (by simpa using (isBigO_refl _ _).add <| isBigO_iff.mpr ⟨1, by simpa using ⟨1, by tauto⟩⟩) -+ have l5 : BoundedAtFilter atTop (fun n : ℕ => C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2)) := by -+ simp only [BoundedAtFilter] -+ field_simp -+ apply isBigO_of_le' (c := C) ; intro n -+ have : 0 ≤ 2 ^ 2 * π ^ 2 + Real.log (n / x) ^ 2 := by positivity -+ simp only [norm_div, norm_mul, norm_eq_abs, abs_eq_self.mpr hC, norm_pow, -+ abs_eq_self.mpr pi_nonneg, abs_eq_self.mpr this, Pi.one_apply, one_mem, -+ CStarRing.norm_of_mem_unitary, mul_one, ge_iff_le, Nat.abs_ofNat] -+ apply div_le_of_le_mul₀ this hC -+ rw [mul_add, ← mul_assoc] -+ apply le_add_of_le_of_nonneg le_rfl -+ positivity -+ have l3 : a =O[atTop] (fun n => 1 / (n : ℝ)) := by -+ simpa [a] using! IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) -+ have l4 : nnabla a =O[atTop] (fun n : ℕ => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by -+ convert Erdos970.Asymptotics.IsBigO.natCast (nnabla_bound C hx) -+ simp [nnabla, a] -+ -+ simp_rw [div_mul_eq_mul_div, mul_div_assoc, one_mul] -+ apply dirichlet_test' -+ · intro n ; exact norm_nonneg _ -+ · intro n ; positivity -+ · apply (l2.mul l3).trans_eventuallyEq -+ apply eventually_of_mem (Ici_mem_atTop 1) -+ intro x (hx : 1 ≤ x) -+ have : x ≠ 0 := Nat.one_le_iff_ne_zero.mp hx -+ simp [this] -+ · have : ∀ᶠ n : ℕ in atTop, x ≤ n := by simpa using eventually_ge_atTop ⌈x⌉₊ -+ filter_upwards [this] with n hn -+ have e1 : 0 < (n : ℝ) := by linarith -+ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn -+ have e3 := Nat.le_succ n -+ gcongr -+ refine div_nonneg (Real.log_nonneg e2) (by norm_num [pi_nonneg]) -+ · apply summable_of_isBigO_nat summable_inv_mul_log_sq -+ apply (l2.mul l4).trans_eventuallyEq -+ apply eventually_of_mem (Ici_mem_atTop 2) -+ intro x (hx : 2 ≤ x) -+ have : (x : ℝ) ≠ 0 := by simp ; linarith -+ have : Real.log x ≠ 0 := by -+ have ll : 2 ≤ (x : ℝ) := by simp [hx] -+ simp -+ grind -+ field_simp -+ -+theorem limiting_fourier_lim1 (hcheby : cheby f) (ψ : W21) (hx : 0 < x) : -+ Tendsto (fun σ' : ℝ ↦ -+ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x))) (𝓝[>] 1) -+ (𝓝 (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x)))) := by -+ -+ obtain ⟨C, hC⟩ := decay_bounds_cor ψ -+ have : 0 ≤ C := by simpa using (norm_nonneg _).trans (hC 0) -+ refine tendsto_tsum_of_dominated_convergence -+ (limiting_fourier_lim1_aux hcheby hx C this) (fun n => ?_) ?_ -+ · apply Tendsto.mul_const -+ by_cases h : n = 0 <;> simp only [term, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, -+ tendsto_const_nhds_iff] -+ refine tendsto_const_nhds.div ?_ (by simp [h]) -+ simpa using ((continuous_ofReal.tendsto 1).mono_left nhdsWithin_le_nhds).const_cpow -+ · rw [eventually_nhdsWithin_iff] -+ apply Eventually.of_forall -+ intro σ' (hσ' : 1 < σ') n -+ rw [norm_mul, ← nterm_eq_norm_term] -+ refine mul_le_mul ?_ (hC _) (norm_nonneg _) (div_nonneg (norm_nonneg _) (Nat.cast_nonneg _)) -+ by_cases h : n = 0 <;> simp only [nterm, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, le_refl] -+ have : 1 ≤ (n : ℝ) := by simpa using! Nat.pos_iff_ne_zero.mpr h -+ refine div_le_div₀ (norm_nonneg _) le_rfl (by simpa [Nat.pos_iff_ne_zero]) ?_ -+ simpa using Real.rpow_le_rpow_of_exponent_le this hσ'.le -+ -+theorem limiting_fourier_lim2_aux (x : ℝ) (C : ℝ) : -+ Integrable (fun t ↦ max |x| 1 * (C / (1 + (t / (2 * π)) ^ 2))) -+ (Measure.restrict volume (Ici (-Real.log x))) := by -+ simp_rw [div_eq_mul_inv C] -+ exact (((integrable_inv_one_add_sq.comp_div -+ (by simp [pi_ne_zero])).const_mul _).const_mul _).restrict -+ -+theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : -+ Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * -+ ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) -+ (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by -+ -+ obtain ⟨C, hC⟩ := decay_bounds_cor ψ -+ apply Tendsto.mul -+ · suffices h : Tendsto (fun σ' : ℝ ↦ ofReal (x ^ (1 - σ'))) (𝓝[>] 1) (𝓝 1) by -+ simpa using h.const_mul ↑A -+ suffices h : Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) from -+ (continuous_ofReal.tendsto 1).comp h -+ have : Tendsto (fun σ' : ℝ ↦ σ') (𝓝 1) (𝓝 1) := fun _ a ↦ a -+ have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := -+ tendsto_nhdsWithin_of_tendsto_nhds (by simpa using this.const_sub 1) -+ simpa using tendsto_const_nhds.rpow this (Or.inl (zero_lt_one.trans_le hx).ne.symm) -+ · refine tendsto_integral_filter_of_dominated_convergence _ ?_ ?_ -+ (limiting_fourier_lim2_aux x C) ?_ -+ · apply Eventually.of_forall ; intro σ' -+ apply Continuous.aestronglyMeasurable -+ have := continuous_FourierIntegral ψ -+ continuity -+ · apply eventually_of_mem (U := Ioo 1 2) -+ · apply Ioo_mem_nhdsGT_of_mem ; simp -+ · intro σ' ⟨h1, h2⟩ -+ rw [ae_restrict_iff' measurableSet_Ici] -+ apply Eventually.of_forall -+ intro t (ht : - Real.log x ≤ t) -+ rw [norm_mul] -+ have hdom_nonneg : 0 ≤ max |x| 1 := by -+ exact (abs_nonneg x).trans (le_max_left _ _) -+ refine mul_le_mul ?_ (hC _) (norm_nonneg _) hdom_nonneg -+ simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, norm_exp, -+ neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, sub_self, mul_zero, -+ sub_zero] -+ have : -Real.log x * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht (by linarith) -+ have : -(t * (σ' - 1)) ≤ Real.log x * (σ' - 1) := by simpa using neg_le_neg this -+ have := Real.exp_monotone this -+ apply this.trans -+ have l1 : σ' - 1 ≤ 1 := by linarith -+ have : 0 ≤ Real.log x := Real.log_nonneg hx -+ have := mul_le_mul_of_nonneg_left l1 this -+ refine (Real.exp_monotone this).trans ?_ -+ have hxabs : |x| = x := abs_of_nonneg (zero_le_one.trans hx) -+ calc -+ Real.exp (Real.log x * 1) = |x| := by -+ simpa [mul_one, hxabs] using (Real.exp_log (zero_lt_one.trans_le hx)) -+ _ ≤ max |x| 1 := le_max_left _ _ -+ · apply Eventually.of_forall -+ intro x -+ suffices h : Tendsto (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by -+ simpa using h.mul_const _ -+ apply Tendsto.mono_left ?_ nhdsWithin_le_nhds -+ suffices h : Continuous (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) by simpa using h.tendsto 1 -+ continuity -+ -+theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : -+ Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) -+ (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by -+ -+ by_cases hh : tsupport ψ = ∅ -+ · simp [tsupport_eq_empty_iff.mp hh] -+ obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh -+ -+ let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) -+ have l1 : IsCompact S := by -+ refine Metric.isCompact_iff_isClosed_bounded.mpr ⟨?_, ?_⟩ -+ · exact isClosed_Icc.reProdIm (isClosed_tsupport ψ) -+ · exact (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded -+ have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 -+ have l3 : ContinuousOn (‖G ·‖) S := (hG.mono l2).norm -+ have l4 : S.Nonempty := ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ -+ obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn l4 l3 -+ let MG := ‖G z‖ -+ let bound (a : ℝ) : ℝ := MG * ‖ψ a‖ -+ -+ apply tendsto_integral_filter_of_dominated_convergence (bound := bound) -+ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ; intro u hu -+ apply Continuous.aestronglyMeasurable -+ apply Continuous.mul -+ · exact (hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous -+ · apply Continuous.const_cpow (by fun_prop) ; simp ; linarith -+ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) -+ intro u hu -+ apply Eventually.of_forall ; intro v -+ by_cases h : v ∈ tsupport ψ -+ · have r1 : u + v * I ∈ S := by simp [S, mem_reProdIm, hu.1, hu.2, h] -+ have r2 := isMaxOn_iff.mp hmax _ r1 -+ have r4 : (x : ℂ) ≠ 0 := by simp ; linarith -+ have r5 : arg x = 0 := by simp [arg_eq_zero_iff] ; linarith -+ have r3 : ‖(x : ℂ) ^ (v * I)‖ = 1 := by simp [norm_cpow_of_ne_zero r4, r5] -+ simp_rw [norm_mul, r3, mul_one] -+ exact mul_le_mul_of_nonneg_right r2 (norm_nonneg _) -+ · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) -+ simp at this ; simp [this, bound] -+ -+ · suffices h : Continuous bound by exact h.integrable_of_hasCompactSupport ψ.h2.norm.mul_left -+ have := ψ.h1.continuous ; fun_prop -+ · apply Eventually.of_forall ; intro t -+ apply Tendsto.mul_const -+ apply Tendsto.mul_const -+ refine (hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr ⟨?_, ?_⟩ -+ · exact ((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds -+ · exact eventually_nhdsWithin_of_forall (fun x (hx : 1 < x) => by simp [hx.le]) -+ -+lemma limiting_fourier (hcheby : cheby f) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : -+ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -+ ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by -+ -+ have l1 := limiting_fourier_lim1 hcheby ψ (by linarith) -+ have l2 := limiting_fourier_lim2 A ψ hx -+ have l3 := limiting_fourier_lim3 hG ψ hx -+ apply tendsto_nhds_unique_of_eventuallyEq (l1.sub l2) l3 -+ simpa [eventuallyEq_nhdsWithin_iff] using! Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) -+ -+lemma limiting_cor_aux {f : ℝ → ℂ} : Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by -+ -+ have l1 : ∀ᶠ x : ℝ in atTop, ∀ t : ℝ, x ^ (t * I) = exp (log x * t * I) := by -+ filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' t -+ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx'] ; ring_nf -+ -+ have l2 : ∀ᶠ x : ℝ in atTop, ∫ t, f t * x ^ (t * I) = ∫ t, f t * exp (log x * t * I) := by -+ filter_upwards [l1] with x hx -+ refine integral_congr_ae (Eventually.of_forall (fun x => by simp [hx])) -+ -+ simp_rw [tendsto_congr' l2] -+ have hFourier (x : ℝ) : (∫ t, f t * exp (log x * t * I)) = -+ 𝓕 f (-Real.log x / (2 * π)) := by -+ rw [Real.fourier_real_eq_integral_exp_smul] -+ apply integral_congr_ae -+ filter_upwards [] with t -+ rw [smul_eq_mul, mul_comm _ (f t)] -+ congr 1 -+ congr 1 -+ push_cast -+ field_simp -+ simp_rw [hFourier] -+ refine (Real.zero_at_infty_fourier f).comp <| Tendsto.mono_right ?_ _root_.atBot_le_cocompact -+ exact (tendsto_neg_atBot_iff.mpr tendsto_log_atTop).atBot_mul_const (inv_pos.mpr two_pi_pos) -+ -+lemma limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by -+ -+ apply limiting_cor_aux.congr' -+ filter_upwards [eventually_ge_atTop 1] with x hx using -+ limiting_fourier hcheby hG hG' hf ψ hx |>.symm -+ -+lemma smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, -+ (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ -+ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 := by -+ -+ obtain ⟨ψ, l1, l2, l3, l4, -⟩ := smooth_urysohn_support_Ioo h1 h3 -+ refine ⟨ψ, l1, l2, l3, l4⟩ -+ -+noncomputable def exists_trunc : trunc := by -+ choose ψ h1 h2 h3 h4 using smooth_urysohn (-2) (-1) (1) (2) (by linarith) (by linarith) -+ exact ⟨⟨ψ, h1.of_le (by norm_cast), h2⟩, h3, h4⟩ -+ -+lemma one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by -+ match n with -+ | 0 => simp -+ | 1 => simp -+ | n + 2 => { norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith } -+ -+lemma quadratic_pos (a b c x : ℝ) (ha : 0 < a) (hΔ : discrim a b c < 0) : -+ 0 < a * x ^ 2 + b * x + c := by -+ have l1 : a * x ^ 2 + b * x + c = a * (x + b / (2 * a)) ^ 2 - discrim a b c / (4 * a) := by -+ simp only [discrim]; field_simp; ring -+ have l2 : 0 < - discrim a b c := by linarith -+ rw [l1, sub_eq_add_neg, ← neg_div] ; positivity -+ -+noncomputable def pp (a x : ℝ) : ℝ := a ^ 2 * (x + 1) ^ 2 + (1 - a) * (1 + a) -+ -+noncomputable def pp' (a x : ℝ) : ℝ := a ^ 2 * (2 * (x + 1)) -+ -+lemma pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by -+ simp only [pp] -+ have : 0 < 1 - a := by linarith [ha.2] -+ have : 0 < 1 + a := by linarith [ha.1] -+ positivity -+ -+lemma pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by -+ unfold pp pp' -+ simpa using hasDerivAt_id x |>.add_const 1 |>.pow 2 |>.const_mul _ -+ -+lemma pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by -+ ext x ; exact pp_deriv a x |>.deriv -+ -+lemma pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by -+ simpa using! hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) -+ -+lemma pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by -+ ext x ; exact pp'_deriv a x |>.deriv -+ -+noncomputable def hh (a t : ℝ) : ℝ := (t * (1 + (a * log t) ^ 2))⁻¹ -+ -+noncomputable def hh' (a t : ℝ) : ℝ := - pp a (log t) * hh a t ^ 2 -+ -+lemma hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity -+ -+lemma hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by -+ by_cases h0 : t = 0 -+ · simp [hh, h0] -+ replace ht : 0 < t := lt_of_le_of_ne ht (by tauto) -+ unfold hh -+ rw [abs_inv, inv_le_inv₀ (by positivity) ht, abs_mul, abs_eq_self.mpr ht.le] -+ convert_to! t * 1 ≤ _ -+ · simp -+ apply mul_le_mul le_rfl ?_ zero_le_one ht.le -+ rw [abs_eq_self.mpr (by positivity)] -+ simp only [le_add_iff_nonneg_right] -+ positivity -+ -+lemma hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by -+ have e1 : t * (1 + (a * log t) ^ 2) ≠ 0 := mul_ne_zero ht (_root_.ne_of_lt (by positivity)).symm -+ have l5 : HasDerivAt (fun t : ℝ => log t) t⁻¹ t := Real.hasDerivAt_log ht -+ have l4 : HasDerivAt (fun t : ℝ => a * log t) (a * t⁻¹) t := l5.const_mul _ -+ have l3 : HasDerivAt (fun t : ℝ => (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := by -+ convert! l4.pow 2 using 1 ; ring -+ have l2 : HasDerivAt (fun t : ℝ => 1 + (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := -+ l3.const_add _ -+ have l1 : HasDerivAt (fun t : ℝ => t * (1 + (a * log t) ^ 2)) -+ (1 + 2 * a ^ 2 * log t + a ^ 2 * log t ^ 2) t := by -+ convert! (hasDerivAt_id' t).mul l2 using 1; field_simp; ring -+ convert! l1.inv e1 using 1; simp only [hh', pp, hh]; field_simp; ring -+ -+lemma hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := -+ fun t (ht : 0 < t) => (hh_deriv a ht.ne.symm).continuousAt.continuousWithinAt -+ -+lemma hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by -+ have := pp_pos ha (log x) -+ simp only [hh', neg_mul, Left.neg_nonpos_iff, ge_iff_le] -+ positivity -+ -+lemma hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by -+ have l1 x (hx : x ∈ interior (Ioi 0)) : -+ HasDerivWithinAt (hh a) (hh' a x) (interior (Ioi 0)) x := by -+ have : x ≠ 0 := by contrapose! hx ; simp [hx] -+ exact (hh_deriv a this).hasDerivWithinAt -+ apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) (hh_continuous _) l1 -+ (fun x _ => hh'_nonpos ha) -+ -+noncomputable def gg (x i : ℝ) : ℝ := 1 / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ -+ -+lemma gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by -+ simp only [gg, hh] -+ field_simp -+ -+lemma gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by -+ simp only [gg_of_hh hx.ne.symm, one_div, mul_inv_rev, abs_mul] -+ apply mul_le_mul le_rfl (hh_le _ _ (by positivity)) (by positivity) (by positivity) |>.trans -+ (le_of_eq ?_) -+ simp [abs_inv, abs_eq_self.mpr hx.le] ; field_simp -+ -+lemma gg_le_one (i : ℕ) : gg x i ≤ 1 := by -+ by_cases hi : i = 0 <;> simp only [gg, hi, CharP.cast_eq_zero, div_zero, one_div, mul_inv_rev, -+ zero_div, Real.log_zero, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, -+ add_zero, inv_one, mul_one, zero_le_one] -+ have l1 : 1 ≤ (i : ℝ) := by simp ; omega -+ have l2 : 1 ≤ 1 + (π⁻¹ * 2⁻¹ * Real.log (↑i / x)) ^ 2 := by -+ simp only [le_add_iff_nonneg_right] ; positivity -+ rw [← mul_inv] ; apply inv_le_one_of_one_le₀ ; simpa using mul_le_mul l1 l2 zero_le_one (by simp) -+ -+lemma one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by -+ constructor -+ · trans 0 -+ · linarith -+ · positivity -+ · rw [div_lt_iff₀ (by positivity)] -+ convert_to! 1 * 1 < 2 * π -+ · simp -+ · simp -+ apply mul_lt_mul one_lt_two ?_ zero_lt_one zero_le_two -+ trans 2 -+ · exact one_le_two -+ · exact two_le_pi -+ -+lemma sum_telescopic (a : ℕ → ℝ) (n : ℕ) : ∑ i ∈ Finset.range n, (a (i + 1) - a i) = a n - a 0 := by -+ apply Finset.sum_range_sub -+ -+lemma cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ ∑ i ∈ Finset.range n, f i * g i ≤ g (n - 1) * (C * n) + (C * (↑(n - 1 - 1) + 1) * g 0 -+ - C * (↑(n - 1 - 1) + 1) * g (n - 1) - -+ ((n - 1 - 1) • (C * g 0) - ∑ x ∈ Finset.range (n - 1 - 1), C * g (x + 1))) := by -+ -+ have l1 (n : ℕ) : -+ (g n - g (n + 1)) * ∑ i ∈ Finset.range (n + 1), f i ≤ (g n - g (n + 1)) * (C * (n + 1)) := by -+ apply mul_le_mul le_rfl (by simpa using! hf' (n + 1)) -+ (Finset.sum_nonneg (fun index _ => hf index)) ?_ -+ simp only [sub_nonneg] ; apply hg' ; simp -+ have l2 (x : ℕ) : C * (↑(x + 1) + 1) - C * (↑x + 1) = C := by simp ; ring -+ have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun index _ => hf index) -+ -+ convert_to ∑ i ∈ Finset.range n, (g i) • (f i) ≤ _ -+ · simp [mul_comm] -+ rw [Finset.sum_range_by_parts, sub_eq_add_neg, ← Finset.sum_neg_distrib] -+ simp_rw [← neg_smul, neg_sub, smul_eq_mul] -+ apply _root_.add_le_add -+ · exact mul_le_mul le_rfl (hf' n) (l3 n) (hg _) -+ · apply Finset.sum_le_sum (fun n _ => l1 n) |>.trans -+ convert_to! ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ -+ · congr ; ext i ; simp ; ring -+ rw [Finset.sum_range_by_parts] -+ simp_rw [Finset.sum_range_sub', l2, smul_sub, smul_eq_mul, Finset.sum_sub_distrib, -+ Finset.sum_const, Finset.card_range] -+ apply le_of_eq ; ring_nf -+ -+lemma sum_range_succ (a : ℕ → ℝ) (n : ℕ) : -+ ∑ i ∈ Finset.range n, a (i + 1) = (∑ i ∈ Finset.range (n + 1), a i) - a 0 := by -+ have := Finset.sum_range_sub a n -+ rw [Finset.sum_sub_distrib, sub_eq_iff_eq_add] at this -+ rw [Finset.sum_range_succ, this] ; ring -+ -+lemma cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ ∑ i ∈ Finset.range n, f i * g i ≤ -+ C * n * g (n - 1) -+ + C * cumsum g (n - 1 - 1 + 1) -+ - C * (↑(n - 1 - 1) + 1) * g (n - 1) -+ := by -+ have := cancel_aux hf hg hf' hg' n -+ simp only [nsmul_eq_mul, ← Finset.mul_sum, sum_range_succ] at this -+ convert this using 1 ; unfold cumsum ; ring -+ -+lemma cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) (hn : 2 ≤ n) : -+ cumsum (f * g) n ≤ C * cumsum g n := by -+ convert! cancel_aux' hf hg hf' hg' n using 1 -+ match n with -+ | n + 2 => simp only [cumsum_succ] ; push_cast ; ring -+ -+lemma cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ cumsum (f * g) n ≤ C * cumsum g n := by -+ match n with -+ | 0 => simp [cumsum] -+ | 1 => specialize hg 0 ; specialize hf' 1 ; simp only [cumsum, Finset.range_one, -+ Finset.sum_singleton, hf0, Nat.cast_one, mul_one, Pi.zero_apply, Pi.mul_apply, zero_mul, -+ ge_iff_le] at hf' hg ⊢ ; positivity -+ | n + 2 => convert! cancel_aux' hf hg hf' hg' (n + 2) using 1 ; simp [cumsum_succ] ; ring -+ -+theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneOn f (Ioc x₀ (x₀ + n))) -+ (hfi : IntegrableOn f (Icc x₀ (x₀ + n))) : -+ (∑ i ∈ Finset.range n, f (x₀ + ↑(i + 1))) ≤ ∫ x in x₀..x₀ + n, f x := by -+ -+ cases n with simp only [Nat.cast_add, Nat.cast_one, CharP.cast_eq_zero, add_zero, -+ lt_self_iff_false, not_false_eq_true, -+ Ioc_eq_empty, Finset.range_zero, Nat.cast_add, Nat.cast_one, Finset.sum_empty, -+ intervalIntegral.integral_same, le_refl] at hf ⊢ -+ | succ n => -+ have : Finset.range (n + 1) = {0} ∪ Finset.Ico 1 (n + 1) := by -+ ext i ; by_cases hi : i = 0 <;> simp [hi] ; omega -+ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, -+ lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, and_true, not_false_eq_true, -+ Finset.sum_insert, CharP.cast_eq_zero, zero_add, ge_iff_le] -+ -+ have l4 : IntervalIntegrable f volume x₀ (x₀ + 1) := by -+ apply IntegrableOn.intervalIntegrable -+ simp only [le_add_iff_nonneg_right, zero_le_one, uIcc_of_le] -+ apply hfi.mono_set -+ apply Icc_subset_Icc le_rfl -+ simp -+ have l5 x (hx : x ∈ Ioc x₀ (x₀ + 1)) : (fun x ↦ f (x₀ + 1)) x ≤ f x := by -+ rcases hx with ⟨hx1, hx2⟩ -+ refine hf ⟨hx1, by linarith⟩ ⟨by linarith, by linarith⟩ hx2 -+ have l6 : ∫ x in x₀..x₀ + 1, f (x₀ + 1) = f (x₀ + 1) := by simp -+ -+ have l1 : f (x₀ + 1) ≤ ∫ x in x₀..x₀ + 1, f x := by -+ rw [← l6] ; apply intervalIntegral.integral_mono_ae_restrict (by linarith) (by simp) l4 -+ apply eventually_of_mem _ l5 -+ have : (Ioc x₀ (x₀ + 1))ᶜ ∩ Icc x₀ (x₀ + 1) = {x₀} := by simp [← sdiff_eq_compl_inter] -+ simp only [mem_ae_iff, Measure.restrict_apply measurableSet_Ioc.compl, this, -+ measure_singleton] -+ -+ have l2 : AntitoneOn (fun x ↦ f (x₀ + x)) (Icc 1 ↑(n + 1)) := by -+ intro u ⟨hu1, _⟩ v ⟨_, hv2⟩ huv ; push_cast at hv2 -+ refine hf ⟨?_, ?_⟩ ⟨?_, ?_⟩ ?_ <;> linarith -+ -+ have l3 := @AntitoneOn.sum_le_integral_Ico 1 (n + 1) (fun x => f (x₀ + x)) (by simp) -+ (by simpa using l2) -+ -+ simp only [Nat.cast_add, Nat.cast_one, intervalIntegral.integral_comp_add_left] at l3 -+ convert! _root_.add_le_add l1 l3 -+ -+ have := @intervalIntegral.integral_comp_mul_add ℝ _ _ 1 (n + 1) 1 f one_ne_zero x₀ -+ rw [intervalIntegral.integral_add_adjacent_intervals] -+ · exact l4 -+ · apply IntegrableOn.intervalIntegrable -+ simp only [add_le_add_iff_left, le_add_iff_nonneg_left, Nat.cast_nonneg, uIcc_of_le] -+ apply hfi.mono_set -+ apply Icc_subset_Icc -+ · linarith -+ · simp -+ -+lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ (IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0)) ∧ -+ (∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π) := by -+ -+ rw [integrableOn_Ici_iff_integrableOn_Ioi] -+ simp only [hh] -+ -+ let g (x : ℝ) := (a * c / b) * Real.arctan (b * log (x / c)) -+ let g₀ (x : ℝ) := if x = 0 then ((a * c / b) * (- (π / 2))) else g x -+ let g' (x : ℝ) := a * (x / c * (1 + (b * Real.log (x / c)) ^ 2))⁻¹ -+ -+ have l3 (x) (hx : 0 < x) : HasDerivAt Real.log x⁻¹ x := by apply Real.hasDerivAt_log (by linarith) -+ have l4 (x) : HasDerivAt (fun t => t / c) (1 / c) x := (hasDerivAt_id x).div_const c -+ have l2 (x) (hx : 0 < x) : HasDerivAt (fun t => log (t / c)) x⁻¹ x := by -+ have := @HasDerivAt.comp _ _ _ _ _ _ (fun t => t / c) _ _ _ (l3 (x / c) (by positivity)) (l4 x) -+ convert! this using 1 ; field_simp -+ have l5 (x) (hx : 0 < x) := (l2 x hx).const_mul b -+ have l1 (x) (hx : 0 < x) := (l5 x hx).arctan -+ have l6 (x) (hx : 0 < x) : HasDerivAt g (g' x) x := by -+ convert! (l1 x hx).const_mul (a * c / b) using 1 -+ simp only [g'] -+ field_simp -+ have key (x) (hx : 0 < x) : HasDerivAt g₀ (g' x) x := by -+ apply (l6 x hx).congr_of_eventuallyEq -+ apply eventually_of_mem <| Ioi_mem_nhds hx -+ intro y (hy : 0 < y) -+ simp [g₀, hy.ne.symm] -+ -+ have k1 : Tendsto g₀ atTop (𝓝 ((a * c / b) * (π / 2))) := by -+ have : g =ᶠ[atTop] g₀ := by -+ apply eventually_of_mem (Ioi_mem_atTop 0) -+ intro y (hy : 0 < y) -+ simp [g₀, hy.ne.symm] -+ apply Tendsto.congr' this -+ apply Tendsto.const_mul -+ apply (tendsto_arctan_atTop.mono_right nhdsWithin_le_nhds).comp -+ apply Tendsto.const_mul_atTop hb -+ apply tendsto_log_atTop.comp -+ apply Tendsto.atTop_div_const hc -+ apply tendsto_id -+ -+ have k2 : Tendsto g₀ (𝓝[>] 0) (𝓝 (g₀ 0)) := by -+ have : g =ᶠ[𝓝[>] 0] g₀ := by -+ apply eventually_of_mem self_mem_nhdsWithin -+ intro x (hx : 0 < x) ; simp [g₀, hx.ne.symm] -+ simp only [g₀] -+ apply Tendsto.congr' this -+ apply Tendsto.const_mul -+ apply (tendsto_arctan_atBot.mono_right nhdsWithin_le_nhds).comp -+ apply Tendsto.const_mul_atBot hb -+ apply tendsto_log_nhdsGT_zero.comp -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨c * ε, by positivity, fun x hx1 hx2 => ⟨?_, ?_⟩⟩ -+ · simp only [mem_Ioi] at hx1 ⊢ ; positivity -+ · simp only [dist_zero_right, norm_eq_abs, norm_div, abs_eq_self.mpr hc.le] at hx2 ⊢ -+ rwa [div_lt_iff₀ hc, mul_comm] -+ -+ have k3 : ContinuousWithinAt g₀ (Ici 0) 0 := by -+ rw [Metric.continuousWithinAt_iff] -+ rw [Metric.tendsto_nhdsWithin_nhds] at k2 -+ intro epsilon hepsilon -+ obtain ⟨delta, hdelta, hbound⟩ := k2 epsilon hepsilon -+ refine ⟨delta, hdelta, ?_⟩ -+ intro point hpoint hdist -+ change 0 ≤ point at hpoint -+ rcases lt_or_eq_of_le hpoint with hpositive | hzero -+ · exact hbound hpositive hdist -+ · simp [g₀, hzero.symm, hepsilon] -+ -+ have k4 : ∀ x ∈ Ioi 0, 0 ≤ g' x := by -+ intro x (hx : 0 < x) ; simp only [mul_inv_rev, inv_div, g'] ; positivity -+ -+ constructor -+ · convert_to IntegrableOn g' _ -+ exact integrableOn_Ioi_deriv_of_nonneg k3 key k4 k1 -+ · have := integral_Ioi_of_hasDerivAt_of_nonneg k3 key k4 k1 -+ simp only [mul_inv_rev, inv_div, mul_neg, ↓reduceIte, sub_neg_eq_add, g', g₀] at this ⊢ -+ convert this using 1 ; field_simp ; ring -+ -+lemma hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0) := -+ hh_integrable_aux ha hb hc |>.1 -+ -+lemma hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ ∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π := -+ hh_integrable_aux ha hb hc |>.2 -+ -+lemma hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by -+ have := hh_integral (a := 1) (b := 1 / (2 * π)) (c := 1) -+ (by positivity) (by positivity) (by positivity) -+ convert this using 1 <;> simp ; ring -+ -+lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ -+ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by -+ -+ let ggg (i : ℕ) : ℝ := if i = 0 then 1 else gg x i -+ -+ have l0 : x ≠ 0 := by linarith -+ have l1 i : 0 ≤ ggg i := by by_cases hi : i = 0 <;> simp only [gg, one_div, mul_inv_rev, hi, -+ ↓reduceIte, zero_le_one, ggg] ; positivity -+ have l2 : Antitone ggg := by -+ intro i j hij ; by_cases hi : i = 0 <;> by_cases hj : j = 0 <;> simp only [hj, ↓reduceIte, hi, -+ le_refl, ggg] -+ · exact gg_le_one _ -+ · omega -+ · simp only [gg_of_hh l0] -+ gcongr -+ apply hh_antitone one_div_two_pi_mem_Ioo -+ · simp only [mem_Ioi] ; positivity -+ · simp only [mem_Ioi] ; positivity -+ · gcongr -+ have l3 : 0 ≤ C := by simpa [cumsum, hf0] using hf 1 -+ -+ have l4 : 0 ≤ ∫ (t : ℝ) in Ioi 0, hh (π⁻¹ * 2⁻¹) t := -+ setIntegral_nonneg measurableSet_Ioi (fun x hx => hh_nonneg _ (LT.lt.le hx)) -+ -+ have l5 {n : ℕ} : AntitoneOn (fun t ↦ x⁻¹ * hh (1 / (2 * π)) (t / x)) (Ioc 0 n) := by -+ intro u ⟨hu1, _⟩ v ⟨hv1, _⟩ huv -+ simp only -+ apply mul_le_mul le_rfl ?_ (hh_nonneg _ (by positivity)) (by positivity) -+ apply hh_antitone one_div_two_pi_mem_Ioo (by simp only [mem_Ioi] ; positivity) -+ (by simp only [mem_Ioi] ; positivity) -+ apply (div_le_div_iff_of_pos_right (by positivity)).mpr huv -+ -+ have l6 {n : ℕ} : IntegrableOn (fun t ↦ x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (Icc 0 n) volume := by -+ apply IntegrableOn.mono_set -+ (hh_integrable (by positivity) (by positivity) (by positivity)) Icc_subset_Ici_self -+ -+ apply Real.tsum_le_of_sum_range_le (fun n => by positivity) ; intro n -+ convert_to! ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ -+ · congr ; ext i -+ by_cases hi : i = 0 -+ · simp [hi, hf0] -+ · simp only [gg, hi, ↓reduceIte, ggg] -+ field_simp -+ -+ apply cancel_main' (fun _ => norm_nonneg _) (by simp [hf0]) l1 hf l2 n |>.trans -+ gcongr ; simp only [cumsum, gg_of_hh l0, one_div, mul_inv_rev, ggg] -+ -+ by_cases hn : n = 0 -+ · simp only [hn, Finset.range_zero, Finset.sum_empty] ; positivity -+ replace hn : 0 < n := by omega -+ have : Finset.range n = {0} ∪ Finset.Ico 1 n := by -+ ext i ; simp ; by_cases hi : i = 0 <;> simp [hi, hn] ; omega -+ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, -+ false_and, not_false_eq_true, Finset.sum_insert, ↓reduceIte, add_le_add_iff_left, ge_iff_le] -+ convert_to! ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ -+ · apply Finset.sum_congr rfl (fun i hi => ?_) -+ simp at hi -+ have : i ≠ 0 := by omega -+ simp [this] -+ simp_rw [Finset.sum_Ico_eq_sum_range, add_comm 1] -+ have := @sum_le_integral 0 (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (n - 1) -+ (by simpa using l5) (by simpa using l6) -+ simp only [zero_add] at this -+ apply this.trans -+ rw [@intervalIntegral.integral_comp_div ℝ _ _ 0 ↑(n - 1) x (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t)) l0] -+ simp only [zero_div, intervalIntegral.integral_const_mul, smul_eq_mul, ← mul_assoc, -+ mul_inv_cancel₀ l0, one_mul] -+ have : (0 : ℝ) ≤ ↑(n - 1) / x := by positivity -+ rw [intervalIntegral.intervalIntegral_eq_integral_uIoc] -+ simp only [this, ↓reduceIte, uIoc_of_le, smul_eq_mul, one_mul, ge_iff_le] -+ apply integral_mono_measure -+ · apply Measure.restrict_mono Ioc_subset_Ioi_self le_rfl -+ · apply eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) -+ intro x (hx : 0 < x) -+ apply hh_nonneg _ hx.le -+ · have := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) -+ simpa using! this.mono_set Ioi_subset_Ici_self -+ -+lemma bound_sum_log0 {C : ℝ} (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ -+ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by -+ -+ let f0 i := if i = 0 then 0 else f i -+ have l1 : chebyWith C f0 := by -+ intro n ; refine Finset.sum_le_sum (fun i _ => ?_) |>.trans (hf n) -+ by_cases hi : i = 0 <;> simp [hi, f0] -+ have l2 i : ‖f i‖ / i = ‖f0 i‖ / i := by by_cases hi : i = 0 <;> simp [hi, f0] -+ simp_rw [l2] ; apply bound_sum_log rfl l1 hx -+ -+lemma bound_sum_log' {C : ℝ} (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + 2 * π ^ 2) := by -+ simpa only [hh_integral'] using bound_sum_log0 hf hx -+ -+variable (f x) in -+lemma summable_fourier_aux (ψ : W21) (i : ℕ) : -+ ‖f i / i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (i / x))‖ ≤ -+ W21.norm ψ * (‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹) := by -+ convert! mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) -+ (norm_nonneg (f i / i)) using 1 -+ · simp -+ · change _ = _ * (W21.norm ψ * _) -+ simp only [W21.norm, mul_inv_rev, one_div, Complex.norm_div, RCLike.norm_natCast] -+ ring -+ -+lemma summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : -+ Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by -+ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by -+ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) -+ have l6 := summable_fourier_aux x f ψ -+ exact Summable.of_nonneg_of_le (fun _ => norm_nonneg _) l6 -+ (by simpa using l5.const_smul (W21.norm ψ)) -+ -+lemma bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ -+ W21.norm ψ • ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ := by -+ -+ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by -+ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) -+ have l6 := summable_fourier_aux x f ψ -+ have l1 : Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by -+ exact summable_fourier x hx ψ hcheby -+ apply (norm_tsum_le_tsum_norm l1).trans -+ simpa only [← Summable.tsum_const_smul _ l5] using! -+ Summable.tsum_mono l1 (by simpa using l5.const_smul (W21.norm ψ)) l6 -+ -+lemma bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) (hcheby : chebyWith C f) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ -+ W21.norm ψ * C * (1 + 2 * π ^ 2) := by -+ -+ apply bound_I1 x (by linarith) ψ ⟨_, hcheby⟩ |>.trans -+ rw [smul_eq_mul, mul_assoc] -+ apply mul_le_mul le_rfl (bound_sum_log' hcheby hx) ?_ W21.norm_nonneg -+ apply tsum_nonneg (fun i => by positivity) -+ -+lemma bound_I2 (x : ℝ) (ψ : W21) : -+ ‖∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ W21.norm ψ * (2 * π ^ 2) := by -+ -+ have key a : ‖𝓕 (ψ : ℝ → ℂ) (a / (2 * π))‖ ≤ W21.norm ψ * (1 + (a / (2 * π)) ^ 2)⁻¹ := -+ decay_bounds_key ψ _ -+ have twopi : 0 ≤ 2 * π := by simp [pi_nonneg] -+ have l3 : Integrable (fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹) := -+ integrable_inv_one_add_sq.comp_div (by norm_num [pi_ne_zero]) -+ have l2 : IntegrableOn (fun i ↦ W21.norm ψ * (1 + (i / (2 * π)) ^ 2)⁻¹) (Ici (-Real.log x)) := by -+ exact (l3.const_mul _).integrableOn -+ have l1 : IntegrableOn (fun i ↦ ‖𝓕 (ψ : ℝ → ℂ) (i / (2 * π))‖) (Ici (-Real.log x)) := by -+ refine ((l3.const_mul (W21.norm ψ)).mono' ?_ ?_).integrableOn -+ · apply Continuous.aestronglyMeasurable ; fun_prop -+ · simp only [norm_norm, key] ; simp -+ have l5 : 0 ≤ᵐ[volume] fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹ := by -+ apply Eventually.of_forall ; intro x ; positivity -+ refine (norm_integral_le_integral_norm _).trans <| (setIntegral_mono l1 l2 key).trans ?_ -+ rw [integral_const_mul] ; gcongr -+ · apply W21.norm_nonneg -+ refine (setIntegral_le_integral l3 l5).trans ?_ -+ rw [Measure.integral_comp_div (fun x => (1 + x ^ 2)⁻¹) (2 * π)] -+ simp [abs_eq_self.mpr twopi] ; ring_nf ; rfl -+ -+lemma bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) -+ (hcheby : chebyWith C f) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ -+ W21.norm ψ * (C * (1 + 2 * π ^ 2) + ‖A‖ * (2 * π ^ 2)) := by -+ -+ have l1 := bound_I1' x hx ψ hcheby -+ have l2 := mul_le_mul (le_refl ‖A‖) (bound_I2 x ψ) (by positivity) (by positivity) -+ apply norm_sub_le _ _ |>.trans ; rw [norm_mul] -+ convert _root_.add_le_add l1 l2 using 1 ; ring -+ -+lemma limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by -+ -+ let S1 x (ψ : ℝ → ℂ) := ∑' (n : ℕ), f n / ↑n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑n / x)) -+ let S2 x (ψ : ℝ → ℂ) := ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) -+ let S x ψ := S1 x ψ - S2 x ψ ; change Tendsto (fun x ↦ S x ψ) atTop (𝓝 0) -+ -+ obtain g := exists_trunc -+ let Ψ R := g.scale R * ψ -+ have key R : Tendsto (fun x ↦ S x (Ψ R)) atTop (𝓝 0) := limiting_cor (Ψ R) hf hcheby hG hG' -+ -+ obtain ⟨C, hcheby⟩ := hcheby -+ have hC : 0 ≤ C := by -+ have : ‖f 0‖ ≤ C := by simpa [cumsum] using hcheby 1 -+ have : 0 ≤ ‖f 0‖ := by positivity -+ linarith -+ have key2 : Tendsto (fun R ↦ W21.norm (ψ - Ψ R)) atTop (𝓝 0) := W21_approximation ψ g -+ simp_rw [Metric.tendsto_nhds] at key key2 ⊢ ; intro ε hε -+ let M := C * (1 + 2 * π ^ 2) + ‖(A : ℂ)‖ * (2 * π ^ 2) -+ obtain ⟨R, hRψ⟩ := (key2 ((ε / 2) / (1 + M)) (by positivity)).exists -+ simp only [dist_zero_right, Real.norm_eq_abs, abs_eq_self.mpr W21.norm_nonneg] at hRψ key -+ -+ filter_upwards [eventually_ge_atTop 1, key R (ε / 2) (by positivity)] with x hx key -+ -+ have key3 : ‖S x (ψ - Ψ R)‖ < ε / 2 := by -+ have : ‖S x _‖ ≤ _ * M := @bound_main f C A x hx (ψ - Ψ R) hcheby -+ apply this.trans_lt -+ apply (mul_le_mul (d := 1 + M) le_rfl (by simp) (by positivity) W21.norm_nonneg).trans_lt -+ have : 0 < 1 + M := by positivity -+ convert! (mul_lt_mul_iff_left₀ this).mpr hRψ using 1 ; field_simp -+ -+ have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := by -+ have l1 : AEStronglyMeasurable (fun x_1 : ℝ ↦ cexp (-(2 * ↑π * (↑x_1 * ↑x) * I))) volume := by -+ refine (Continuous.mul ?_ continuous_const).neg.cexp.aestronglyMeasurable -+ apply continuous_const.mul <| contDiff_ofReal.continuous.mul continuous_const -+ simp only [Real.fourier_eq', neg_mul, RCLike.inner_apply', conj_trivial, ofReal_neg, -+ ofReal_mul, ofReal_ofNat, Pi.sub_apply, smul_eq_mul, mul_sub] -+ apply integral_sub -+ · apply ψ.hf.bdd_mul (c := 1) l1 ; simp [Complex.norm_exp] -+ · apply (Ψ R : W21) |>.hf |>.bdd_mul (c := 1) l1 -+ simp [Complex.norm_exp] -+ -+ have S1_sub : S1 x (ψ - Ψ R) = S1 x ψ - S1 x (Ψ R) := by -+ simp only [one_div, mul_inv_rev, S1_sub_1, mul_sub, S1] ; apply Summable.tsum_sub -+ · have := summable_fourier x (by positivity) ψ ⟨_, hcheby⟩ -+ rw [summable_norm_iff] at this -+ simpa using this -+ · have := summable_fourier x (by positivity) (Ψ R) ⟨_, hcheby⟩ -+ rw [summable_norm_iff] at this -+ simpa using! this -+ -+ have S2_sub : S2 x (ψ - Ψ R) = S2 x ψ - S2 x (Ψ R) := by -+ simp only [S1_sub_1, S2] ; rw [integral_sub] -+ · ring -+ · exact ψ.integrable_fourier (by positivity) |>.restrict -+ · exact (Ψ R : W21).integrable_fourier (by positivity) |>.restrict -+ -+ have S_sub : S x (ψ - Ψ R) = S x ψ - S x (Ψ R) := by simp [S, S1_sub, S2_sub] ; ring -+ simpa [S_sub, Ψ] using norm_add_le _ _ |>.trans_lt (_root_.add_lt_add key3 key) -+ -+lemma limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := -+ limiting_cor_W21 ψ hf hcheby hG hG' -+ -+lemma fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by -+ refine ⟨𝓕⁻ f, ?_⟩ -+ exact FourierTransform.fourier_fourierInv_eq f -+ -+noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) -+ (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) where -+ toFun := f -+ smooth' := h1 -+ decay' k n := by -+ have l1 : Continuous (fun x => ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) := by -+ have : ContDiff ℝ ∞ (iteratedFDeriv ℝ n f) := h1.iteratedFDeriv_right (mod_cast le_top) -+ exact Continuous.mul (by continuity) this.continuous.norm -+ have l2 : HasCompactSupport (fun x ↦ ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) := -+ (h2.iteratedFDeriv _).norm.mul_left -+ simpa using l1.bounded_above_of_compact_support l2 -+ -+@[simp] lemma toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl -+ -+lemma comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ ∀ᶠ x in 𝓝 0, Ψ x = 0 := -+ notMem_tsupport_iff_eventuallyEq.mp (fun h => lt_irrefl 0 <| mem_Ioi.mp (hplus h)) -+ -+lemma comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ ∀ᶠ x in atBot, Ψ (exp x) = 0 := -+ Real.tendsto_exp_atBot <| comp_exp_support0 hplus -+ -+lemma comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : -+ ∀ᶠ (x : ℝ) in atTop, (Ψ ∘ rexp) x = 0 := by -+ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, -+ cocompact_eq_atBot_atTop] at hsupp -+ exact Real.tendsto_exp_atTop hsupp.2 -+ -+theorem comp_exp_support {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : HasCompactSupport (Ψ ∘ rexp) := by -+ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, -+ cocompact_eq_atBot_atTop] -+ exact ⟨comp_exp_support1 hplus, comp_exp_support2 hsupp⟩ -+ -+lemma wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) (x : ℝ) (hx : 0 < x) : -+ ∫ (u : ℝ) in Ioi (-Real.log x), ↑(rexp u) * Ψ (rexp u) = ∫ (y : ℝ) in Ioi (1 / x), Ψ y := by -+ -+ have l1 : ContinuousOn rexp (Ici (-Real.log x)) := by fun_prop -+ have l2 : Tendsto rexp atTop atTop := Real.tendsto_exp_atTop -+ have l3 t (_ : t ∈ Ioi (-log x)) : HasDerivWithinAt rexp (rexp t) (Ioi t) t := -+ (Real.hasDerivAt_exp t).hasDerivWithinAt -+ have l4 : ContinuousOn Ψ (rexp '' Ioi (-Real.log x)) := by fun_prop -+ have l5 : IntegrableOn Ψ (rexp '' Ici (-Real.log x)) volume := -+ (l0.integrable_of_hasCompactSupport hsupp).integrableOn -+ have l6 : IntegrableOn (fun x ↦ rexp x • (Ψ ∘ rexp) x) (Ici (-Real.log x)) volume := by -+ refine (Continuous.integrable_of_hasCompactSupport (by fun_prop) ?_).integrableOn -+ change HasCompactSupport (rexp • (Ψ ∘ rexp)) -+ exact (comp_exp_support hsupp hplus).smul_left -+ have := MeasureTheory.integral_deriv_smul_comp_Ioi l1 l2 l3 l4 l5 l6 -+ simpa [Real.exp_neg, Real.exp_log hx] using this -+ -+theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ Tendsto (fun x ↦ (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ -+ obtain ⟨ε, hε, hh⟩ := Metric.eventually_nhds_iff.mp <| comp_exp_support0 hplus -+ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eventually_gt_atTop ε⁻¹] with x hxε -+ -+ have l1 : Integrable (indicator (Ioi x⁻¹) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi -+ have l2 : Integrable (indicator (Ioi 0) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi -+ -+ simp_rw [← MeasureTheory.integral_indicator measurableSet_Ioi, ← mul_sub, ← integral_sub l1 l2] -+ simp only [mul_eq_zero, ofReal_eq_zero] -+ right -+ apply MeasureTheory.integral_eq_zero_of_ae -+ apply Eventually.of_forall -+ intro t -+ simp only [Pi.zero_apply] -+ -+ have hε' : 0 < ε⁻¹ := by positivity -+ have hx : 0 < x := by linarith -+ have hx' : 0 < x⁻¹ := by positivity -+ have hεx : x⁻¹ < ε := (inv_lt_comm₀ hε hx).mp hxε -+ -+ have l3 : Ioi 0 = Ioc 0 x⁻¹ ∪ Ioi x⁻¹ := by -+ ext t ; simp only [mem_Ioi, mem_union, mem_Ioc] ; constructor <;> intro h -+ · simp [h, le_or_gt] -+ · cases h with -+ | inl h => exact h.1 -+ | inr h => exact hx'.trans h -+ have l4 : Disjoint (Ioc 0 x⁻¹) (Ioi x⁻¹) := by simp -+ have l5 := Set.indicator_union_of_disjoint l4 Ψ -+ rw [l3, l5] -+ simp only -+ rw [add_comm, sub_add_cancel_left] -+ by_cases ht : t ∈ Ioc 0 x⁻¹ -+ · simp only [ht, indicator_of_mem, neg_eq_zero] -+ apply hh ; simp only [mem_Ioc, dist_zero_right, norm_eq_abs] at ht ⊢ -+ apply hεx.trans_le' -+ rw [abs_le] ; constructor <;> linarith -+ simp [ht] -+ -+lemma wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x - A * ∫ y in Set.Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ -+ let h (x : ℝ) : ℂ := rexp (2 * π * x) * Ψ (exp (2 * π * x)) -+ have h1 : ContDiff ℝ ∞ h := by -+ have : ContDiff ℝ ∞ (fun x : ℝ => (rexp (2 * π * x))) := (contDiff_const.mul contDiff_id).exp -+ exact (contDiff_ofReal.comp this).mul (hsmooth.comp this) -+ have h2 : HasCompactSupport h := by -+ have : 2 * π ≠ 0 := by simp [pi_ne_zero] -+ simpa using! (comp_exp_support hsupp hplus).comp_smul this |>.mul_left -+ obtain ⟨g, hg⟩ := fourier_surjection_on_schwartz (toSchwartz h h1 h2) -+ -+ have l1 {y} (hy : 0 < y) : y * Ψ y = 𝓕 g (1 / (2 * π) * Real.log y) := by -+ simp only [one_div, mul_inv_rev, hg, toSchwartz, ofReal_exp, ofReal_mul, ofReal_ofNat, -+ toSchwartz_apply, ofReal_inv, h] -+ field_simp -+ norm_cast -+ rw [Real.exp_log hy] -+ -+ have key := limiting_cor_schwartz g hf hcheby hG hG' -+ -+ have l2 : ∀ᶠ x in atTop, ∑' (n : ℕ), f n / ↑n * 𝓕 g (1 / (2 * π) * Real.log (↑n / x)) = -+ ∑' (n : ℕ), f n * Ψ (↑n / x) / x := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ congr ; ext n -+ by_cases hn : n = 0 -+ · simp [hn, (comp_exp_support0 hplus).self_of_nhds] -+ rw [← l1 (by positivity)] -+ have : (n : ℂ) ≠ 0 := by simpa using hn -+ have : (x : ℂ) ≠ 0 := by simpa using hx.ne.symm -+ simp only [ofReal_div, ofReal_natCast] -+ field_simp -+ -+ have l3 : ∀ᶠ x in atTop, ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 g (u / (2 * π)) = -+ ↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ congr 1 -+ simp only [hg, toSchwartz, ofReal_exp, ofReal_mul, ofReal_ofNat, toSchwartz_apply, -+ ofReal_div, h] -+ norm_cast ; field_simp; norm_cast -+ rw [MeasureTheory.integral_Ici_eq_integral_Ioi] -+ exact wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx -+ -+ have l4 : Tendsto (fun x => (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ exact wiener_ikehara_smooth_sub (hsmooth.continuous.integrable_of_hasCompactSupport hsupp) hplus -+ -+ simpa [tsum_div_const] using (key.congr' <| EventuallyEq.sub l2 l3) |>.add l4 -+ -+lemma wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := -+ tendsto_sub_nhds_zero_iff.mp <| wiener_ikehara_smooth hf hcheby hG hG' hsmooth hsupp hplus -+ -+local instance {E : Type*} : Coe (E → ℝ) (E → ℂ) := ⟨fun f n => f n⟩ -+ -+@[norm_cast] -+theorem set_integral_ofReal {f : ℝ → ℝ} {s : Set ℝ} : ∫ x in s, (f x : ℂ) = ∫ x in s, f x := -+ integral_ofReal -+ -+lemma wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := by -+ -+ let Ψ' := ofReal ∘ Ψ -+ have l1 : ContDiff ℝ ∞ Ψ' := contDiff_ofReal.comp hsmooth -+ have l2 : HasCompactSupport Ψ' := hsupp.comp_left rfl -+ have l3 : closure (Function.support Ψ') ⊆ Ioi 0 := by rwa [Function.support_comp_eq] ; simp -+ have key := (continuous_re.tendsto _).comp -+ (@wiener_ikehara_smooth' A Ψ G f hf hcheby hG hG' l1 l2 l3) -+ simp at key ; norm_cast at key -+ -+lemma interval_approx_inf (ha : 0 < a) (hab : a < b) : -+ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ -+ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ -+ ψ ≤ indicator (Ico a b) 1 ∧ b - a - ε ≤ ∫ y in Ioi 0, ψ y := by -+ -+ have l1 : Iio ((b - a) / 3) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds <| by -+ rw [← sub_pos] at hab -+ positivity -+ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < (b - a) / 3) -+ have l2 : a < a + ε / 2 := by simp [hε] -+ have l3 : b - ε / 2 < b := by simp [hε] -+ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 -+ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ -+ · simp [h5, hab.ne, Icc_subset_Ioi_iff hab.le, ha] -+ · exact h4.trans <| indicator_le_indicator_of_subset Ioo_subset_Ico_self (by simp) -+ · have l4 : 0 ≤ b - a - ε := by linarith -+ have l5 : Icc (a + ε / 2) (b - ε / 2) ⊆ Ioi 0 := by -+ intro t ht -+ simp only [mem_Icc, mem_Ioi] at ht ⊢ -+ exact ha.trans <| l2.trans_le <| ht.1 -+ have l6 : Icc (a + ε / 2) (b - ε / 2) ∩ Ioi 0 = Icc (a + ε / 2) (b - ε / 2) := -+ inter_eq_left.mpr l5 -+ have l7 : ∫ y in Ioi 0, indicator (Icc (a + ε / 2) (b - ε / 2)) 1 y = b - a - ε := by -+ simp only [measurableSet_Icc, integral_indicator_one, measureReal_restrict_apply, l6, -+ volume_real_Icc] -+ convert max_eq_left l4 using 1 ; ring_nf -+ have l8 : IntegrableOn ψ (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ rw [← l7] ; apply setIntegral_mono ?_ l8 h3 -+ rw [IntegrableOn, integrable_indicator_iff measurableSet_Icc] -+ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self -+ apply integrableOn_const <;> -+ simp -+ -+lemma interval_approx_sup (ha : 0 < a) (hab : a < b) : -+ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ -+ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ -+ indicator (Ico a b) 1 ≤ ψ ∧ ∫ y in Ioi 0, ψ y ≤ b - a + ε := by -+ -+ have l1 : Iio (a / 2) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds (by linarith) -+ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < a / 2) -+ have l2 : a - ε / 2 < a := by linarith -+ have l3 : b < b + ε / 2 := by linarith -+ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 -+ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ -+ · have l4 : a - ε / 2 < b + ε / 2 := by linarith -+ have l5 : ε / 2 < a := by linarith -+ simp [h5, l4.ne, Icc_subset_Ioi_iff l4.le, l5] -+ · apply le_trans ?_ h3 -+ apply indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp) -+ · have l4 : 0 ≤ b - a + ε := by linarith -+ have l5 : Ioo (a - ε / 2) (b + ε / 2) ⊆ Ioi 0 := by intro t ht ; simp at ht ⊢ ; linarith -+ have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := inter_eq_left.mpr l5 -+ have l7 : ∫ y in Ioi 0, indicator (Ioo (a - ε / 2) (b + ε / 2)) 1 y = b - a + ε := by -+ simp only [measurableSet_Ioo, integral_indicator_one, measureReal_restrict_apply, l6, -+ volume_real_Ioo] -+ convert max_eq_left l4 using 1 ; ring_nf -+ have l8 : IntegrableOn ψ (Ioi 0) volume := (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ rw [← l7] -+ refine setIntegral_mono l8 ?_ h4 -+ rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo] -+ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self -+ apply integrableOn_const <;> -+ simp -+ -+lemma WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : -+ Summable (fun n => f n * g (n / x)) := by -+ obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure -+ apply summable_of_hasFiniteSupport -+ unfold Function.HasFiniteSupport -+ simp only [Function.support_mul] ; apply Finite.inter_of_right ; rw [finite_iff_bddAbove] -+ exact ⟨Nat.ceil (M * x), fun i hi => by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ -+ -+lemma WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) -+ (hg₁ : HasCompactSupport g₁) (hg₂ : HasCompactSupport g₂) : -+ (∑' n, f n * g₁ (n / x)) / x ≤ (∑' n, f n * g₂ (n / x)) / x := by -+ apply div_le_div_of_nonneg_right ?_ hx.le -+ exact Summable.tsum_le_tsum (fun n => mul_le_mul_of_nonneg_left (hg _) (hf _)) -+ (WI_summable hg₁ hx) (WI_summable hg₂ hx) -+ -+lemma WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : chebyWith C f) (hb : 0 < b) (hxb : 2 / b < x) : -+ (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by -+ have hb' : 0 < 2 / b := by positivity -+ have hx : 0 < x := by linarith -+ have hxb' : 2 < x * b := (div_lt_iff₀ hb).mp hxb -+ have l1 (i : ℕ) (hi : i ∉ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) = 0 := by -+ simp_all [le_div_iff₀ hx] -+ have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by -+ rw [abs_eq_self.mpr (hpos _)] -+ convert_to _ ≤ f i * 1 -+ · ring -+ apply mul_le_mul_of_nonneg_left ?_ (hpos _) -+ by_cases hi : (i / x) ∈ (Ico a b) <;> simp [hi] -+ rw [tsum_eq_sum l1, div_le_iff₀ hx, mul_assoc, mul_assoc] -+ apply Finset.sum_le_sum l2 |>.trans -+ have := hcheby ⌈b * x⌉₊ ; simp only [norm_real, norm_eq_abs] at this ; apply this.trans -+ have : 0 ≤ C := by have := hcheby 1 ; simp only [cumsum, Finset.range_one, norm_real, -+ Finset.sum_singleton, Nat.cast_one, mul_one] at this ; exact (abs_nonneg _).trans this -+ refine mul_le_mul_of_nonneg_left ?_ this -+ apply (Nat.ceil_lt_add_one (by positivity)).le.trans -+ linarith -+ -+lemma WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : chebyWith C f) (hb : 0 < b) : -+ ∀ᶠ x : ℝ in atTop, (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by -+ filter_upwards [eventually_gt_atTop (2 / b)] with x hx using WI_sum_Iab_le hpos hcheby hb hx -+ -+lemma le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by -+ apply le_of_forall_gt ; intro d hd -+ have key : ∀ᶠ c in 𝓝[>] b, c < d := by -+ apply eventually_of_mem (U := Iio d) ?_ (fun x hx => hx) -+ rw [mem_nhdsWithin] -+ refine ⟨Iio d, isOpen_Iio, hd, inter_subset_left⟩ -+ obtain ⟨x, h1, h2⟩ := (h.and key).exists -+ linarith -+ -+lemma ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by -+ apply le_of_forall_lt ; intro d hd -+ have key : ∀ᶠ c in 𝓝[<] b, c > d := by -+ apply eventually_of_mem (U := Ioi d) ?_ (fun x hx => hx) -+ rw [mem_nhdsWithin] -+ refine ⟨Ioi d, isOpen_Ioi, hd, inter_subset_left⟩ -+ obtain ⟨x, h1, h2⟩ := (h.and key).exists -+ linarith -+ -+lemma WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : -+ Tendsto (fun c => c / A - (b - a)) (𝓝[>] (A * (b - a))) (𝓝[>] 0) := by -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨A * ε, by positivity, ?_⟩ -+ intro x hx1 hx2 -+ constructor -+ · simpa [lt_div_iff₀' hA] -+ · simp only [Real.dist_eq, dist_zero_right, Real.norm_eq_abs] at hx2 ⊢ -+ have : |x / A - (b - a)| = |x - A * (b - a)| / A := by -+ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp -+ rwa [this, div_lt_iff₀' hA] -+ -+lemma WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : -+ Tendsto (fun c => (b - a) - c / A) (𝓝[<] (A * (b - a))) (𝓝[>] 0) := by -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨A * ε, by positivity, ?_⟩ -+ intro x hx1 hx2 -+ constructor -+ · simpa [div_lt_iff₀' hA] -+ · simp only [Real.dist_eq, dist_zero_right, norm_eq_abs] at hx2 ⊢ -+ have : |(b - a) - x / A| = |A * (b - a) - x| / A := by -+ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp -+ rwa [this, div_lt_iff₀' hA, ← neg_sub, abs_neg] -+ -+theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) (hcheby : cheby fun n ↦ ↑(f n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : 0 ≤ A := by -+ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x -+ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by -+ filter_upwards [eventually_ge_atTop 0] with x hx -+ exact div_nonneg (tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _))) hx -+ obtain ⟨ε, ψ, h1, h2, h3, h4, -⟩ := (interval_approx_sup zero_lt_one one_lt_two).exists -+ have key := @wiener_ikehara_smooth_real A G f ψ hf hcheby hG hG' h1 h2 h3 -+ have l2 : 0 ≤ ψ := by apply le_trans _ h4 ; apply indicator_nonneg ; simp -+ have l1 : ∀ᶠ x in atTop, 0 ≤ S ψ x := hSnonneg l2 -+ have l3 : 0 ≤ A * ∫ (y : ℝ) in Ioi 0, ψ y := ge_of_tendsto key l1 -+ have l4 : 0 < ∫ (y : ℝ) in Ioi 0, ψ y := by -+ have r1 : 0 ≤ᵐ[Measure.restrict volume (Ioi 0)] ψ := Eventually.of_forall l2 -+ have r2 : IntegrableOn (fun y ↦ ψ y) (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ have r3 : Ico 1 2 ⊆ Function.support ψ := by intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith -+ have r4 : Ico 1 2 ⊆ Function.support ψ ∩ Ioi 0 := by -+ simp only [subset_inter_iff, r3, true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith -+ have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by convert! volume.mono r4 ; norm_num -+ simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using! zero_lt_one.trans_le r5 -+ have := div_nonneg l3 l4.le ; field_simp at this ; exact this -+ -+lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) atTop (nhds (A * (b - a))) := by -+ -+ by_cases hab : a = b -+ · simp [hab] -+ replace hb : a < b := lt_of_le_of_ne hb hab ; clear hab -+ -+ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x -+ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by -+ filter_upwards [eventually_ge_atTop 0] with x hx -+ refine div_nonneg ?_ hx -+ refine tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _)) -+ have hA : 0 ≤ A := residue_nonneg hpos hf hcheby hG hG' -+ -+ let Iab : ℝ → ℝ := indicator (Ico a b) 1 -+ change Tendsto (S Iab) atTop (𝓝 (A * (b - a))) -+ have hIab : HasCompactSupport Iab := by simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc -+ have Iab_nonneg : ∀ᶠ x : ℝ in atTop, 0 ≤ S Iab x := hSnonneg (indicator_nonneg (by simp)) -+ have Iab2 : IsBoundedUnder (· ≤ ·) atTop (S Iab) := by -+ obtain ⟨C, hC⟩ := hcheby ; exact ⟨C * 2 * b, WI_sum_Iab_le' hpos hC (by linarith)⟩ -+ have Iab3 : IsBoundedUnder (· ≥ ·) atTop (S Iab) := ⟨0, Iab_nonneg⟩ -+ have Iab0 : IsCoboundedUnder (· ≥ ·) atTop (S Iab) := Iab2.isCoboundedUnder_ge -+ have Iab1 : IsCoboundedUnder (· ≤ ·) atTop (S Iab) := Iab3.isCoboundedUnder_le -+ -+ have sup_le : limsup (S Iab) atTop ≤ A * (b - a) := by -+ have l_sup : ∀ᶠ ε in 𝓝[>] 0, limsup (S Iab) atTop ≤ A * (b - a + ε) := by -+ filter_upwards [interval_approx_sup ha hb] with ε ⟨ψ, h1, h2, h3, h4, h6⟩ -+ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 -+ have l6 : S Iab ≤ᶠ[atTop] S ψ := by -+ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h4 hx hIab h2 -+ have l5 : IsBoundedUnder (· ≤ ·) atTop (S ψ) := l1.isBoundedUnder_le -+ have l3 : limsup (S Iab) atTop ≤ limsup (S ψ) atTop := limsup_le_limsup l6 Iab1 l5 -+ apply l3.trans ; rw [l1.limsup_eq] ; gcongr -+ obtain rfl | h := eq_or_ne A 0 -+ · simpa using l_sup -+ apply le_of_eventually_nhdsWithin -+ have key : 0 < A := lt_of_le_of_ne hA h.symm -+ filter_upwards [WI_tendsto_aux a b key l_sup] with x hx -+ simpa [mul_div_cancel₀ _ h] using hx -+ -+ have le_inf : A * (b - a) ≤ liminf (S Iab) atTop := by -+ have l_inf : ∀ᶠ ε in 𝓝[>] 0, A * (b - a - ε) ≤ liminf (S Iab) atTop := by -+ filter_upwards [interval_approx_inf ha hb] with ε ⟨ψ, h1, h2, h3, h5, h6⟩ -+ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 -+ have l2 : S ψ ≤ᶠ[atTop] S Iab := by -+ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h5 hx h2 hIab -+ have l4 : IsBoundedUnder (· ≥ ·) atTop (S ψ) := l1.isBoundedUnder_ge -+ have l3 : liminf (S ψ) atTop ≤ liminf (S Iab) atTop := liminf_le_liminf l2 l4 Iab0 -+ apply le_trans ?_ l3 ; rw [l1.liminf_eq] ; gcongr -+ obtain rfl | h := eq_or_ne A 0 -+ · simpa using l_inf -+ apply ge_of_eventually_nhdsWithin -+ have key : 0 < A := lt_of_le_of_ne hA h.symm -+ filter_upwards [WI_tendsto_aux' a b key l_inf] with x hx -+ simpa [mul_div_cancel₀ _ h] using hx -+ -+ have : liminf (S Iab) atTop ≤ limsup (S Iab) atTop := liminf_le_limsup Iab2 Iab3 -+ refine tendsto_of_liminf_eq_limsup ?_ ?_ Iab2 Iab3 <;> linarith -+ -+lemma le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by -+ rw [div_le_iff₀ hx, Nat.le_floor_iff] ; positivity -+ -+lemma lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by -+ rw [div_lt_iff₀ hx, Nat.lt_ceil] -+ -+lemma ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by -+ rw [le_div_iff₀ hx, Nat.ceil_le] -+ -+lemma mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by -+ rw [Finset.mem_Icc, mem_Icc, ceil_mul_le_iff hx, le_floor_mul_iff hb hx] -+ -+lemma mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by -+ rw [Finset.mem_Ico, mem_Ico, ceil_mul_le_iff hx, lt_ceil_mul_iff hx] -+ -+lemma tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : -+ ∑' n, f n * (indicator (Ico a b) 1 (n / x)) = ∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n := by -+ have l1 : ∀ n ∉ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n * indicator (Ico a b) 1 (↑n / x) = 0 := by -+ simp [mem_Ico_iff_div hx] ; tauto -+ rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] -+ -+lemma WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) atTop (nhds (A * (b - a))) := by -+ apply (WienerIkeharaInterval hpos hf hcheby hG hG' ha hb).congr' -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ rw [tsum_indicator hx] -+ -+lemma WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) atTop (nhds (A * (b - a))) := -+ WienerIkeharaInterval_discrete hpos hf hcheby hG hG' ha hb |>.comp tendsto_natCast_atTop_atTop -+ -+lemma tendsto_mul_ceil_div : -+ Tendsto (fun (p : ℝ × ℕ) => ⌈p.1 * p.2⌉₊ / (p.2 : ℝ)) (𝓝[>] 0 ×ˢ atTop) (𝓝 0) := by -+ rw [Metric.tendsto_nhds] ; intro δ hδ -+ have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) -+ have l2 : ∀ᶠ N : ℕ in atTop, 1 ≤ δ / 2 * N := by -+ apply Tendsto.eventually_ge_atTop -+ exact tendsto_natCast_atTop_atTop.const_mul_atTop (by positivity) -+ filter_upwards [l1.prod_mk l2] with (ε, N) ⟨⟨hε, h1⟩, h2⟩ ; dsimp only at * -+ have l3 : 0 < (N : ℝ) := by -+ simp only [Nat.cast_pos, Nat.pos_iff_ne_zero] ; rintro rfl ; simp [zero_lt_one.not_ge] at h2 -+ have l5 : 0 ≤ ε * ↑N := by positivity -+ have l6 : ε * N ≤ δ / 2 * N := mul_le_mul h1.le le_rfl (by positivity) (by positivity) -+ simp only [dist_zero_right, norm_div, RCLike.norm_natCast, div_lt_iff₀ l3, gt_iff_lt] -+ convert (Nat.ceil_lt_add_one l5).trans_le (add_le_add l6 h2) using 1 ; ring -+ -+noncomputable def S (f : ℕ → 𝕜) (ε : ℝ) (N : ℕ) : 𝕜 := (∑ n ∈ Finset.Ico ⌈ε * N⌉₊ N, f n) / N -+ -+lemma S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by -+ have hceilN : ⌈ε * N⌉₊ ≤ N := by -+ simp only [Nat.ceil_le] -+ exact mul_le_of_le_one_left N.cast_nonneg hε -+ have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by -+ ext n -+ simp only [Finset.mem_range, Finset.mem_union, Finset.mem_Ico] -+ omega -+ have r2 : Disjoint (Finset.range ⌈ε * N⌉₊) (Finset.Ico ⌈ε * N⌉₊ N) := by -+ rw [Finset.range_eq_Ico] ; apply Finset.Ico_disjoint_Ico_consecutive -+ simp [S, r1, Finset.sum_union r2, cumsum, add_div] -+ -+lemma tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) (hcheby : cheby f) : -+ TendstoUniformlyOnFilter (S f) (S f 0) (𝓝[>] 0) atTop := by -+ rw [Metric.tendstoUniformlyOnFilter_iff] ; intro δ hδ -+ obtain ⟨C, hC⟩ := hcheby -+ have l1 : ∀ᶠ (p : ℝ × ℕ) in 𝓝[>] 0 ×ˢ atTop, C * ⌈p.1 * p.2⌉₊ / p.2 < δ := by -+ have r1 := tendsto_mul_ceil_div.const_mul C -+ simp only [mul_div_assoc', mul_zero] at r1 ; exact r1 (Iio_mem_nhds hδ) -+ have : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) -+ filter_upwards [l1, Eventually.prod_inl this _] with (ε, N) h1 h2 -+ have l2 : ‖cumsum f ⌈ε * ↑N⌉₊ / ↑N‖ ≤ C * ⌈ε * N⌉₊ / N := by -+ have r1 := hC ⌈ε * N⌉₊ -+ have r2 : 0 ≤ cumsum f ⌈ε * N⌉₊ := by apply cumsum_nonneg hpos -+ simp only [norm_real, norm_of_nonneg (hpos _), norm_div, -+ norm_of_nonneg r2, Real.norm_natCast] at r1 ⊢ -+ apply div_le_div_of_nonneg_right r1 (by positivity) -+ simpa [← S_sub_S h2.2] using! l2.trans_lt h1 -+ -+theorem WienerIkeharaTheorem' {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := by -+ -+ convert_to Tendsto (S f 0) atTop (𝓝 A) ; · ext N ; simp [S, cumsum] -+ apply (tendsto_S_S_zero hpos hcheby).tendsto_of_eventually_tendsto -+ · have L0 : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) -+ apply eventually_of_mem L0 -+ · intro ε hε -+ simpa using! WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 -+ · have : Tendsto (fun ε : ℝ => ε) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds -+ simpa using (this.const_sub 1).const_mul A -+ -+theorem vonMangoldt_cheby : cheby Λ := by -+ use Real.log 4 + 4 -+ intro N -+ by_cases! h : N = 0 -+ · simp [h, cumsum] -+ simp only [cumsum, norm_real, norm_eq_abs] -+ rw [Nat.range_eq_Icc_zero_sub_one _ h, (by simp : N - 1 = ⌊(N : ℝ) - 1⌋₊)] -+ simp_rw [abs_of_nonneg vonMangoldt_nonneg] -+ rw [← Chebyshev.psi_eq_sum_Icc] -+ grw [Chebyshev.psi_le_const_mul_self <| sub_nonneg_of_le <| Nat.one_le_cast_iff_ne_zero.mpr h] -+ gcongr -+ linarith -+ -+theorem WeakPNT : Tendsto (fun N ↦ cumsum Λ N / N) atTop (𝓝 1) := by -+ let F := vonMangoldt.LFunctionResidueClassAux (q := 1) 1 -+ have hnv := riemannZeta_ne_zero_of_one_le_re -+ have l1 (n : ℕ) : 0 ≤ Λ n := vonMangoldt_nonneg -+ have l2 s (hs : 1 < s.re) : F s = LSeries Λ s - 1 / (s - 1) := by -+ have := vonMangoldt.eqOn_LFunctionResidueClassAux (q := 1) isUnit_one hs -+ simp only [F, this, vonMangoldt.residueClass, Nat.totient_one, Nat.cast_one, inv_one, one_div, sub_left_inj] -+ apply LSeries_congr -+ intro n _ -+ simp only [ofReal_inj, indicator_apply_eq_self, mem_ofPred_eq] -+ exact fun hn ↦ absurd (Subsingleton.eq_one _) hn -+ have l3 : ContinuousOn F {s | 1 ≤ s.re} := vonMangoldt.continuousOn_LFunctionResidueClassAux 1 -+ have l4 : cheby Λ := vonMangoldt_cheby -+ have l5 (σ' : ℝ) (hσ' : 1 < σ') : Summable (nterm Λ σ') := by -+ simpa only [← nterm_eq_norm_term] using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm -+ apply WienerIkeharaTheorem' l1 l5 l4 l3 l2 -+ -+section auto_cheby -+ -+variable {f : ℕ → ℝ} -+ -+lemma norm_x_cpow_it (x t : ℝ) (hx : 0 < x) : ‖(x : ℂ) ^ (t * I)‖ = 1 := by -+ rw [cpow_def_of_ne_zero <| ofReal_ne_zero.mpr hx.ne', ← ofReal_log hx.le] -+ convert norm_exp_ofReal_mul_I (t * x.log) using 2 -+ push_cast; ring_nf -+ -+lemma limiting_fourier_aux_gt_zero (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 0 < x) (σ' : ℝ) (hσ' : 1 < σ') : -+ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -+ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by -+ have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 -+ have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := -+ continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [hx]) -+ have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := -+ (((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8).integrable_of_hasCompactSupport -+ ψ.h2.mul_left.mul_right -+ have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := fun h ↦ by -+ have := congrArg Complex.re (sub_eq_zero.mp h); simp at this; linarith -+ have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * -+ (↑(x ^ (σ' - 1)) * (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -+ have : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * -+ (↑(x ^ (σ' - 1)) * (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -+ simp only [one_div, ← mul_assoc] -+ exact ((continuous_const.mul (Continuous.inv₀ (by fun_prop) e2)).mul ψ.h1.continuous).mul l8 -+ exact this.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right.mul_left.mul_left -+ simp_rw [first_fourier hf hint hx hσ', second_fourier ψ.h1.continuous.measurable hint hx hσ', -+ ← integral_const_mul, ← integral_sub l4 l5] -+ refine integral_congr_ae (.of_forall fun u ↦ ?_) -+ have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] -+ simp_rw [hG' e1, sub_mul, ← mul_assoc] -+ simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, -+ mul_eq_zero, I_ne_zero, or_false] -+ field_simp [e2]; norm_cast; simp [mul_assoc, ← rpow_add hx] -+ -+theorem limiting_fourier_lim2_gt_zero (A : ℝ) (ψ : W21) (hx : 0 < x) : -+ Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * -+ ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) -+ (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by -+ obtain ⟨C, hC⟩ := decay_bounds_cor ψ -+ refine Tendsto.mul ?_ (tendsto_integral_filter_of_dominated_convergence _ -+ (.of_forall fun _ ↦ (by continuity : Continuous _).aestronglyMeasurable) ?_ -+ (limiting_fourier_lim2_aux x C) (.of_forall fun u ↦ ?_)) -+ · suffices Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) by -+ simpa using ((continuous_ofReal.tendsto 1).comp this).const_mul ↑A -+ have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := -+ tendsto_nhdsWithin_of_tendsto_nhds (by simpa using (continuous_id.tendsto (1 : ℝ)).const_sub 1) -+ simpa using tendsto_const_nhds.rpow this (Or.inl hx.ne') -+ · refine eventually_of_mem (Ioo_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun σ' hσ' ↦ ?_ -+ obtain ⟨h1, h2⟩ := hσ' -+ rw [ae_restrict_iff' measurableSet_Ici] -+ refine .of_forall fun t ht ↦ ?_ -+ simp only [norm_mul, neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, -+ norm_exp, neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, -+ sub_self, mul_zero, sub_zero] -+ refine mul_le_mul ?_ (hC _) (norm_nonneg _) ((abs_nonneg x).trans (le_max_left _ _)) -+ have hα0 : 0 ≤ σ' - 1 := by linarith -+ have hα1 : σ' - 1 ≤ 1 := by linarith -+ have hmul1 : (-x.log) * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht hα0 -+ calc Real.exp (-(t * (σ' - 1))) -+ ≤ Real.exp (x.log * (σ' - 1)) := Real.exp_monotone (by linarith) -+ _ ≤ max |x| 1 := by -+ by_cases hx1 : 1 ≤ x -+ · calc _ ≤ Real.exp x.log := -+ Real.exp_monotone (mul_le_of_le_one_right (Real.log_nonneg hx1) hα1) -+ _ = |x| := by rw [Real.exp_log hx, abs_of_pos hx] -+ _ ≤ _ := le_max_left _ _ -+ · calc _ ≤ 1 := (Real.exp_monotone (mul_nonpos_of_nonpos_of_nonneg -+ ((Real.log_neg_iff hx).2 (by linarith)).le hα0)).trans_eq Real.exp_zero -+ _ ≤ _ := le_max_right _ _ -+ · suffices Tendsto (fun n ↦ ((rexp (-u * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by simpa using this.mul_const _ -+ refine Tendsto.mono_left ?_ nhdsWithin_le_nhds -+ have : Continuous (fun n ↦ ((rexp (-u * (n - 1))) : ℂ)) := by continuity -+ simpa using this.tendsto 1 -+ -+theorem limiting_fourier_lim3_gt_zero -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 0 < x) : -+ Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) -+ (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by -+ by_cases hh : tsupport ψ = ∅ -+ · simp [tsupport_eq_empty_iff.mp hh] -+ obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh -+ let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) -+ have l1 : IsCompact S := Metric.isCompact_iff_isClosed_bounded.mpr -+ ⟨isClosed_Icc.reProdIm (isClosed_tsupport ψ), (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded⟩ -+ have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 -+ obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ (hG.mono l2).norm -+ have hxC : (x : ℂ) ≠ 0 := ofReal_ne_zero.mpr hx.ne' -+ refine tendsto_integral_filter_of_dominated_convergence (bound := fun a ↦ ‖G z‖ * ‖ψ a‖) -+ (eventually_of_mem (Icc_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun u hu ↦ -+ ((hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous).mul -+ (by simpa using Continuous.const_cpow (by fun_prop) (Or.inl hxC)) |>.aestronglyMeasurable) -+ (eventually_of_mem (Icc_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun u hu ↦ -+ .of_forall fun v ↦ ?_) -+ ((continuous_const.mul ψ.h1.continuous.norm).integrable_of_hasCompactSupport ψ.h2.norm.mul_left) -+ (.of_forall fun t ↦ ?_) -+ · by_cases h : v ∈ tsupport ψ -+ · simp_rw [norm_mul, norm_x_cpow_it x v hx, mul_one] -+ exact mul_le_mul_of_nonneg_right (isMaxOn_iff.mp hmax _ (by simp [S, mem_reProdIm, hu.1, hu.2, h])) (norm_nonneg _) -+ · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) -+ simp [Function.notMem_support.mp this] -+ · exact ((hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr -+ ⟨((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds, -+ eventually_nhdsWithin_of_forall fun _ hx' ↦ by simp [(Set.mem_Ioi.mp hx').le]⟩).mul_const _ |>.mul_const _ -+ -+lemma tendsto_tsum_of_monotone_convergence -+ {β : Type*} {f : ℕ → β → ENNReal} {g : β → ENNReal} -+ (hmono : ∀ k, Monotone (fun n => f n k)) -+ (hlim : ∀ k, Tendsto (fun n => f n k) atTop (𝓝 (g k))) : -+ Tendsto (fun n => ∑' k, f n k) atTop (𝓝 (∑' k, g k)) := by -+ let : MeasurableSpace β := ⊤ -+ let μ : Measure β := Measure.count -+ have hg_iSup (k : β) : (⨆ n : ℕ, f n k) = g k := iSup_eq_of_tendsto (hmono k) (hlim k) -+ have h_tend_lint : Tendsto (fun n => ∫⁻ k, f n k ∂μ) atTop (𝓝 (∫⁻ k, (⨆ n, f n k) ∂μ)) := by -+ have hmeas : ∀ n, Measurable fun k : β => f n k := fun _ _ _ ↦ trivial -+ have hmono_fn : Monotone (fun n => fun k : β => f n k) := fun _ _ hnm k ↦ hmono k hnm -+ simpa [lintegral_iSup hmeas hmono_fn] using -+ tendsto_atTop_iSup fun _ _ hmn ↦ lintegral_mono fun k ↦ hmono k hmn -+ simpa [μ, lintegral_count, hg_iSup] using h_tend_lint -+ -+lemma tendsto_tsum_of_monotone_convergence_nhdsGT_one -+ {F : ℝ → ℕ → ℝ} -+ (hF_nonneg : ∀ σ n, 0 ≤ F σ n) -+ (hF_antitone : ∀ n, AntitoneOn (fun σ : ℝ => F σ n) (Set.Ioi (1 : ℝ))) -+ (hF_tend : ∀ n, Tendsto (fun σ : ℝ => F σ n) (𝓝[>] (1 : ℝ)) (𝓝 (F 1 n))) -+ (hSumm : ∀ σ, 1 < σ → Summable (fun n : ℕ => F σ n)) -+ (hbounded : -+ BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ : ℝ => (∑' n : ℕ, F σ n))) : -+ Tendsto (fun σ : ℝ => ∑' n : ℕ, F σ n) (𝓝[>] (1 : ℝ)) (𝓝 (∑' n : ℕ, F 1 n)) := by -+ let T : ℝ → ℝ := fun σ => ∑' n : ℕ, F σ n -+ have hT_antitone : AntitoneOn T (Set.Ioi (1 : ℝ)) := fun a ha b hb hab ↦ -+ (hSumm b hb).tsum_le_tsum_of_inj (fun n ↦ n) (fun _ _ h ↦ h) (fun c hc ↦ (hc ⟨c, rfl⟩).elim) -+ (fun n ↦ hF_antitone n ha hb hab) (hSumm a ha) -+ have hT_bdd : BddAbove (T '' Set.Ioi (1 : ℝ)) := by -+ obtain ⟨C, hC⟩ := isBigO_iff.1 hbounded -+ have hC' : ∀ᶠ σ : ℝ in 𝓝[>] (1 : ℝ), T σ ≤ C := by -+ filter_upwards [hC] with σ hσ -+ calc T σ ≤ |T σ| := le_abs_self _ -+ _ = ‖T σ‖ := (Real.norm_eq_abs _).symm -+ _ ≤ C * ‖(1 : ℝ → ℝ) σ‖ := hσ -+ _ = C := by simp -+ obtain ⟨U, hU, V, hV, hUV⟩ := Filter.mem_inf_iff_superset.1 hC' -+ obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hU -+ have hIoi_sub : Set.Ioi (1 : ℝ) ⊆ V := Filter.mem_principal.mp hV -+ have hUsub : U ∩ Set.Ioi (1 : ℝ) ⊆ {σ : ℝ | T σ ≤ C} := fun σ hσ ↦ hUV ⟨hσ.1, hIoi_sub hσ.2⟩ -+ have hσ0_Ioi : 1 + ε / 2 ∈ Set.Ioi (1 : ℝ) := by simp [half_pos hε] -+ have hσ0_leC : T (1 + ε / 2) ≤ C := -+ hUsub ⟨hball (by simp only [Metric.mem_ball, Real.dist_eq, add_sub_cancel_left, -+ abs_of_pos (half_pos hε)]; exact half_lt_self hε), hσ0_Ioi⟩ -+ refine ⟨C, ?_⟩ -+ rintro _ ⟨σ, hσIoi, rfl⟩ -+ by_cases hσlt : σ < 1 + ε / 2 -+ · exact hUsub ⟨hball (by -+ simp only [Metric.mem_ball, Real.dist_eq] -+ rw [abs_of_pos (sub_pos.2 (Set.mem_Ioi.mp hσIoi))] -+ linarith [half_lt_self hε]), hσIoi⟩ -+ · exact (hT_antitone hσ0_Ioi hσIoi (le_of_not_gt hσlt)).trans hσ0_leC -+ have hT_tend_sup : Tendsto T (𝓝[>] (1 : ℝ)) (𝓝 (sSup (T '' Set.Ioi (1 : ℝ)))) := -+ hT_antitone.tendsto_nhdsGT hT_bdd -+ let σseq : ℕ → ℝ := fun k => 1 + 1 / (k + 1 : ℝ) -+ have hσseq_mem (k) : σseq k ∈ Set.Ioi (1 : ℝ) := by -+ simp only [σseq, Set.mem_Ioi, lt_add_iff_pos_right] -+ positivity -+ have hσseq_tend_nhds : Tendsto σseq atTop (𝓝 (1 : ℝ)) := by -+ have : Tendsto (fun k : ℕ => (1 : ℝ) + ((k + 1 : ℕ) : ℝ)⁻¹) atTop (𝓝 ((1 : ℝ) + 0)) := -+ tendsto_const_nhds.add (tendsto_inv_atTop_nhds_zero_nat.comp (tendsto_add_atTop_nat 1)) -+ simp only [add_zero] at this -+ convert this using 1; ext k; simp [σseq, one_div] -+ have hσseq_tend_nhdsWithin : Tendsto σseq atTop (𝓝[>] (1 : ℝ)) := -+ tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hσseq_tend_nhds -+ (.of_forall hσseq_mem) -+ have hσseq_antitone : Antitone σseq := fun k₁ k₂ hk ↦ by simp only [σseq]; gcongr -+ have hmono_seq (n) : Monotone (fun k => F (σseq k) n) := fun k₁ k₂ hk ↦ -+ hF_antitone n (hσseq_mem k₂) (hσseq_mem k₁) (hσseq_antitone hk) -+ have htend_seq (n) : Tendsto (fun k => F (σseq k) n) atTop (𝓝 (F 1 n)) := -+ (hF_tend n).comp hσseq_tend_nhdsWithin -+ have hTseq : Tendsto (fun k : ℕ => T (σseq k)) atTop (𝓝 (T 1)) := by -+ have hsum1 : Summable (fun n : ℕ => F (1 : ℝ) n) := by -+ obtain ⟨C, hC⟩ := hT_bdd -+ refine summable_of_sum_range_le (hF_nonneg 1) fun m ↦ le_of_tendsto -+ (tendsto_finsetSum _ fun i _ ↦ hF_tend i) -+ (eventually_of_mem self_mem_nhdsWithin fun σ hσ ↦ -+ ((hSumm σ hσ).sum_le_tsum _ (fun n _ ↦ hF_nonneg σ n)).trans (hC ⟨σ, hσ, rfl⟩)) -+ have hg_ne_top : (∑' n : ℕ, ENNReal.ofReal (F 1 n)) ≠ ⊤ := hsum1.tsum_ofReal_ne_top -+ have hENN : Tendsto (fun k => ∑' n, ENNReal.ofReal (F (σseq k) n)) atTop -+ (𝓝 (∑' n, ENNReal.ofReal (F 1 n))) := -+ tendsto_tsum_of_monotone_convergence (fun n _ _ hk ↦ ENNReal.ofReal_le_ofReal (hmono_seq n hk)) -+ (fun n ↦ ENNReal.tendsto_ofReal (htend_seq n)) -+ have hrew (σ) : (∑' n, ENNReal.ofReal (F σ n)).toReal = ∑' n, F σ n := by -+ rw [ENNReal.tsum_toReal_eq (fun n ↦ by simp)] -+ exact tsum_congr fun n ↦ by simp [hF_nonneg σ n] -+ simp only [T, ← hrew]; exact (ENNReal.tendsto_toReal hg_ne_top).comp hENN -+ have hsSup_eq : sSup (T '' Set.Ioi (1 : ℝ)) = T 1 := -+ tendsto_nhds_unique (hT_tend_sup.comp hσseq_tend_nhdsWithin) hTseq -+ simpa [T, hsSup_eq] using hT_tend_sup -+ -+lemma limiting_fourier_variant_lim1_aux -+ {f : ℕ → ℝ} {x : ℝ} (ψ : CS 2 ℂ) -+ (hpos : 0 ≤ f) -+ (hf : ∀ (σ : ℝ), 1 < σ → Summable (nterm f σ)) -+ (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) : -+ ∀ (σ : ℝ), 1 < σ → -+ Summable (fun n : ℕ => -+ (if n = 0 then 0 else f n / ((n : ℝ) ^ σ)) * -+ (𝓕 ψ.toFun (1 / (2 * π) * Real.log ((n : ℝ) / x))).re) := by -+ intro σ hσ -+ let y : ℕ → ℝ := fun n => (1 / (2 * π)) * Real.log ((n : ℝ) / x) -+ let W : ℕ → ℝ := fun n => (𝓕 ψ.toFun (y n)).re -+ let base : ℕ → ℝ := fun n => if n = 0 then 0 else f n / ((n : ℝ) ^ σ) -+ obtain ⟨C, hC⟩ := decay_bounds_cor (W21.ofCS2 ψ) -+ have hC_nonneg : 0 ≤ C := (norm_nonneg _).trans ((hC 0).trans (by simp)) -+ have hW_nonneg (n : ℕ) : 0 ≤ W n := (hψpos (y n)).1 -+ have hnorm_four (n : ℕ) : ‖𝓕 ψ.toFun (y n)‖ = W n := by -+ have him0 : (𝓕 ψ.toFun (y n)).im = 0 := (hψpos (y n)).2 -+ rw [show 𝓕 ψ.toFun (y n) = W n by exact Complex.ext rfl him0] -+ simp [abs_of_nonneg (hW_nonneg n)] -+ have hW_le_C (n : ℕ) : W n ≤ C := by -+ rw [← hnorm_four]; exact (hC (y n)).trans (div_le_self hC_nonneg (by nlinarith [sq_nonneg (y n)])) -+ have hbase_summ : Summable base := by -+ convert hf σ hσ using 1; ext n -+ by_cases hn : n = 0 <;> simp [nterm, base, hn, Real.norm_eq_abs, abs_of_nonneg (hpos n)] -+ refine (hbase_summ.mul_left C).of_norm_bounded fun n ↦ ?_ -+ by_cases hn : n = 0 -+ · simp [base, hn] -+ · have hnpos : 0 < (n : ℝ) := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn) -+ have hbase_nonneg : 0 ≤ base n := by -+ simp only [base, hn, ite_false] -+ exact div_nonneg (hpos n) (Real.rpow_pos_of_pos hnpos σ).le -+ calc |base n * W n| = base n * W n := abs_of_nonneg (mul_nonneg hbase_nonneg (hW_nonneg n)) -+ _ ≤ base n * C := mul_le_mul_of_nonneg_left (hW_le_C n) hbase_nonneg -+ _ = C * base n := mul_comm _ _ -+ -+theorem limiting_fourier_variant_lim1 -+ {f : ℕ → ℝ} {x : ℝ} {ψ : CS 2 ℂ} -+ (hpos : 0 ≤ f) -+ (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) -+ (S : ℝ → ℂ) -+ (hSdef : -+ ∀ σ' : ℝ, -+ S σ' = -+ ∑' n : ℕ, -+ term (fun n ↦ (f n : ℂ)) (σ' : ℝ) n * -+ 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x))) -+ (hbounded : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ' : ℝ => ‖S σ'‖)) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) : -+ Tendsto -+ (fun σ' : ℝ => -+ ∑' n : ℕ, -+ term (fun n ↦ (f n : ℂ)) (σ' : ℝ) n * -+ 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x))) -+ (𝓝[>] (1 : ℝ)) -+ (𝓝 -+ (∑' n : ℕ, -+ (f n : ℂ) / (n : ℂ) * -+ 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x)))) := by -+ -+ let y : ℕ → ℝ := fun n => (π⁻¹ * 2⁻¹) * Real.log ((n : ℝ) / x) -+ let w : ℕ → ℝ := fun n => (𝓕 ψ.toFun (y n)).re -+ -+ have hw_nonneg : ∀ n, 0 ≤ w n := by -+ intro n -+ exact (hψpos (y n)).1 -+ -+ have hFour_eq_ofReal : ∀ n, 𝓕 ψ.toFun (y n) = Complex.ofReal (w n) := by -+ intro n -+ have h := hψpos (y n) -+ refine Complex.ext ?_ ?_ -+ · simp [w] -+ · simp [w, h.2] -+ -+ let rterm : ℝ → ℕ → ℝ := -+ fun σ n => -+ if h0 : n = 0 then 0 else (f n) / ((n : ℝ) ^ σ) * (w n) -+ -+ have summand_eq_ofReal : -+ ∀ (σ : ℝ) (n : ℕ), -+ term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n) -+ = Complex.ofReal (rterm σ n) := by -+ intro σ n -+ by_cases hn : n = 0 -+ · subst hn -+ simp [rterm, y] -+ · have hnpos : (0 : ℝ) < (n : ℝ) := by -+ exact_mod_cast (Nat.pos_of_ne_zero hn) -+ have hn0 : 0 ≤ (n : ℝ) := le_of_lt hnpos -+ have hcpow : -+ ( (n : ℂ) ^ ((σ : ℝ) : ℂ) ) = ( ( (n : ℝ) ^ σ : ℝ) : ℂ ) := by -+ simpa using (Complex.ofReal_cpow hn0 σ).symm -+ have hpow_ne : ((n : ℝ) ^ σ) ≠ 0 := by -+ exact (ne_of_gt (Real.rpow_pos_of_pos hnpos σ)) -+ calc -+ term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n) -+ = -+ ((f n : ℂ) / ((n : ℂ) ^ ((σ : ℝ) : ℂ))) * ( (w n : ℝ) : ℂ ) := by -+ simp [term, LSeries.term, hn, hFour_eq_ofReal] -+ _ = -+ ((f n : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) * ((w n : ℝ) : ℂ) := by -+ simp [hcpow] -+ _ = -+ (( (f n : ℝ) : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) * ((w n : ℝ) : ℂ) := by -+ simp -+ _ = -+ ( ( (f n : ℝ) / ((n : ℝ) ^ σ) : ℝ) : ℂ ) * ((w n : ℝ) : ℂ) := by -+ simp [Complex.ofReal_div] -+ _ = -+ ( ( (f n : ℝ) / ((n : ℝ) ^ σ) * (w n) : ℝ ) : ℂ ) := by -+ simp [Complex.ofReal_mul] -+ _ = -+ Complex.ofReal (rterm σ n) := by -+ simp [rterm, hn] -+ -+ let T : ℝ → ℝ := fun σ => ∑' n, rterm σ n -+ -+ have tsum_eq_ofReal_T : ∀ σ : ℝ, -+ (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -+ = Complex.ofReal (T σ) := by -+ intro σ -+ have hcongr : -+ (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -+ = ∑' n : ℕ, (Complex.ofReal (rterm σ n)) := by -+ refine tsum_congr ?_ -+ intro n -+ simpa using (summand_eq_ofReal σ n) -+ -+ calc -+ (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -+ = ∑' n : ℕ, (Complex.ofReal (rterm σ n)) := hcongr -+ _ = Complex.ofReal (∑' n : ℕ, rterm σ n) := by -+ simpa using (Complex.ofReal_tsum (fun n : ℕ => rterm σ n)).symm -+ _ = Complex.ofReal (T σ) := by rfl -+ -+ have hS_ofReal_T : ∀ σ : ℝ, S σ = Complex.ofReal (T σ) := by -+ intro σ -+ simpa [hSdef σ, y] using (tsum_eq_ofReal_T σ) -+ -+ have rterm_nonneg : ∀ σ n, 0 ≤ rterm σ n := by -+ intro σ n -+ by_cases hn : n = 0 -+ · subst hn; simp [rterm] -+ · have hf : 0 ≤ f n := hpos n -+ have hw : 0 ≤ w n := hw_nonneg n -+ have hnpos : 0 < (n : ℝ) := by -+ exact_mod_cast (Nat.pos_of_ne_zero hn) -+ have hden : 0 < (n : ℝ) ^ σ := Real.rpow_pos_of_pos hnpos σ -+ have : 0 ≤ (f n) / ((n : ℝ) ^ σ) := div_nonneg hf (le_of_lt hden) -+ simp [rterm, hn, mul_nonneg this hw] -+ -+ have T_nonneg : ∀ σ, 0 ≤ T σ := by -+ intro σ -+ exact tsum_nonneg (fun n => rterm_nonneg σ n) -+ -+ have hT_eq_normS : ∀ σ, T σ = ‖S σ‖ := by -+ intro σ -+ have := hS_ofReal_T σ -+ calc -+ T σ = ‖Complex.ofReal (T σ)‖ := by simp [abs_of_nonneg (T_nonneg σ)] -+ _ = ‖S σ‖ := by simp [this] -+ -+ have hboundedT : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ : ℝ => T σ) := by -+ have : (fun σ : ℝ => T σ) = (fun σ : ℝ => ‖S σ‖) := by -+ funext σ; exact hT_eq_normS σ -+ simpa [this] using hbounded -+ -+ have rterm_antitone : ∀ n, AntitoneOn (fun σ => rterm σ n) (Set.Ioi 1) := by -+ intro n σ₁ hσ₁ σ₂ hσ₂ hσ₁₂ -+ by_cases hn : n = 0 -+ · subst hn; simp [rterm] -+ · have hf : 0 ≤ f n := hpos n -+ have hw : 0 ≤ w n := hw_nonneg n -+ have hnpos : 0 < (n : ℝ) := by exact_mod_cast (Nat.pos_of_ne_zero hn) -+ have hn1 : (1 : ℝ) ≤ (n : ℝ) := by -+ exact_mod_cast (Nat.one_le_iff_ne_zero.mpr hn) -+ have hpow : (n : ℝ) ^ σ₁ ≤ (n : ℝ) ^ σ₂ := -+ Real.rpow_le_rpow_of_exponent_le hn1 hσ₁₂ -+ have hinv : -+ (1 / ((n : ℝ) ^ σ₂)) ≤ (1 / ((n : ℝ) ^ σ₁)) := by -+ have hpos1 : 0 < (n : ℝ) ^ σ₁ := Real.rpow_pos_of_pos hnpos σ₁ -+ exact one_div_le_one_div_of_le hpos1 hpow -+ have hinv_inv : ((n : ℝ) ^ σ₂)⁻¹ ≤ ((n : ℝ) ^ σ₁)⁻¹ := by -+ simpa [one_div] using hinv -+ have hmul1 : -+ (f n) * (((n : ℝ) ^ σ₂)⁻¹) ≤ (f n) * (((n : ℝ) ^ σ₁)⁻¹) := -+ mul_le_mul_of_nonneg_left hinv_inv hf -+ have hmul2 : -+ ((f n) * (((n : ℝ) ^ σ₂)⁻¹)) * (w n) -+ ≤ ((f n) * (((n : ℝ) ^ σ₁)⁻¹)) * (w n) := -+ mul_le_mul_of_nonneg_right hmul1 hw -+ simpa [rterm, hn, div_eq_mul_inv, mul_assoc] using hmul2 -+ -+ have rterm_tend : ∀ n, Tendsto (fun σ : ℝ => rterm σ n) (𝓝[>] (1 : ℝ)) (𝓝 (rterm 1 n)) := by -+ intro n -+ have hterm : -+ Tendsto (fun σ : ℝ => term (fun n ↦ (f n : ℂ)) (σ : ℝ) n) -+ (𝓝[>] (1 : ℝ)) (𝓝 ((f n : ℂ) / (n : ℂ))) := by -+ by_cases hn : n = 0 -+ · subst hn -+ simp [term, LSeries.term] -+ · have hden : -+ Tendsto (fun σ : ℝ => ((n : ℂ) ^ ((σ : ℝ) : ℂ))) (𝓝[>] (1 : ℝ)) (𝓝 ((n : ℂ) ^ (1 : ℂ))) := by -+ simpa using ((continuous_ofReal.tendsto (1 : ℝ)).mono_left nhdsWithin_le_nhds).const_cpow -+ -+ have hden' : -+ Tendsto (fun σ : ℝ => ((n : ℂ) ^ ((σ : ℝ) : ℂ))) (𝓝[>] (1 : ℝ)) (𝓝 (n : ℂ)) := by -+ simpa using hden -+ -+ have hnC : (n : ℂ) ≠ 0 := by -+ exact_mod_cast hn -+ -+ have hterm : -+ Tendsto (fun σ : ℝ => term (fun n ↦ (f n : ℂ)) (σ : ℝ) n) -+ (𝓝[>] (1 : ℝ)) (𝓝 ((f n : ℂ) / (n : ℂ))) := by -+ have hnC : (n : ℂ) ≠ 0 := by -+ exact_mod_cast hn -+ simpa [term, LSeries.term, hn] using! -+ (tendsto_const_nhds.div hden' hnC) -+ exact hterm -+ -+ have hsummand : -+ Tendsto -+ (fun σ : ℝ => -+ term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -+ (𝓝[>] (1 : ℝ)) -+ (𝓝 (((f n : ℂ) / (n : ℂ)) * 𝓕 ψ.toFun (y n))) := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using (hterm.mul_const (𝓕 ψ.toFun (y n))) -+ -+ have hre : ∀ σ, rterm σ n = -+ (term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)).re := by -+ intro σ -+ have := congrArg Complex.re (summand_eq_ofReal σ n) -+ simpa [Complex.ofReal_re] using this.symm -+ -+ have hRe : Tendsto -+ (fun σ : ℝ => -+ (term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)).re) -+ (𝓝[>] (1 : ℝ)) -+ (𝓝 ((((f n : ℂ) / (n : ℂ)) * 𝓕 ψ.toFun (y n)).re)) := -+ (continuous_re.tendsto _).comp hsummand -+ -+ have hlimit_re : -+ (f n / (n : ℝ)) * (𝓕 ψ.toFun (y n)).re = rterm 1 n := by -+ have h0 : -+ (term (fun n ↦ (f n : ℂ)) (1 : ℝ) n * 𝓕 ψ.toFun (y n)).re = rterm 1 n := by -+ have := congrArg Complex.re (summand_eq_ofReal (σ := (1 : ℝ)) n) -+ simpa [Complex.ofReal_re] using this -+ -+ by_cases hn : n = 0 -+ · subst hn -+ simp [rterm, y] -+ · have h1 : -+ (term (fun n ↦ (f n : ℂ)) (1 : ℝ) n * 𝓕 ψ.toFun (y n)).re -+ = (f n / (n : ℝ)) * (𝓕 ψ.toFun (y n)).re := by -+ simp [Complex.mul_re, term, LSeries.term, hn, y, -+ (hψpos (y n)).2] -+ -+ exact (h1.symm.trans h0) -+ -+ simpa [hre, hlimit_re] using hRe -+ -+ have hSumm_rterm : ∀ σ : ℝ, 1 < σ → Summable (fun n : ℕ => rterm σ n) := by -+ simpa [rterm] using limiting_fourier_variant_lim1_aux (ψ := ψ) -+ (f := f) (x := x) hpos hf hψpos -+ -+ have hT_tend : -+ Tendsto T (𝓝[>] (1 : ℝ)) (𝓝 (T 1)) := by -+ have : -+ Tendsto (fun σ : ℝ => ∑' n : ℕ, rterm σ n) -+ (𝓝[>] (1 : ℝ)) -+ (𝓝 (∑' n : ℕ, rterm (1 : ℝ) n)) := by -+ refine tendsto_tsum_of_monotone_convergence_nhdsGT_one -+ (F := rterm) -+ (hF_nonneg := rterm_nonneg) -+ (hF_antitone := rterm_antitone) -+ (hF_tend := rterm_tend) -+ (hSumm := hSumm_rterm) -+ (hbounded := hboundedT) -+ -+ simpa [T] using this -+ -+ have hToReal : -+ Tendsto (fun σ => Complex.ofReal (T σ)) (𝓝[>] (1 : ℝ)) (𝓝 (Complex.ofReal (T 1))) := -+ (continuous_ofReal.tendsto _).comp hT_tend -+ -+ have hsource : -+ (fun σ : ℝ => -+ ∑' n : ℕ, -+ term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -+ = fun σ : ℝ => Complex.ofReal (T σ) := by -+ funext σ -+ exact (tsum_eq_ofReal_T σ) -+ -+ have hσ1 : -+ (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (↑(1:ℝ)) n * 𝓕 ψ.toFun (y n)) -+ = (↑(T 1) : ℂ) := -+ by simpa using (tsum_eq_ofReal_T (σ := (1:ℝ))) -+ have hterm1 : -+ ∀ n : ℕ, term (fun n ↦ (f n : ℂ)) (1 : ℂ) n = (f n : ℂ) / (n : ℂ) := by -+ intro n -+ by_cases hn : n = 0 -+ · subst hn -+ simp [term, LSeries.term] -+ · simp [term, LSeries.term, hn] -+ -+ have hrewrite : -+ (∑' n : ℕ, -+ term (fun n ↦ (f n : ℂ)) (1 : ℂ) n * 𝓕 ψ.toFun (y n)) -+ = -+ (∑' n : ℕ, -+ (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (y n)) := by -+ refine tsum_congr ?_ -+ intro n -+ simp [hterm1 n] -+ -+ have htarget : -+ (∑' n : ℕ, -+ (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (y n)) -+ = (↑(T 1) : ℂ) := by -+ exact (hrewrite.symm.trans hσ1) -+ -+ simpa [hsource, htarget, y] using hToReal -+ -+lemma limiting_fourier_variant -+ (hpos : 0 ≤ f) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (ψ : CS 2 ℂ) -+ (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) -+ (hx : 0 < x) : -+ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -+ ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by -+ -+ have l2 := limiting_fourier_lim2_gt_zero (A := A) (x := x) ψ hx -+ have l3 := limiting_fourier_lim3_gt_zero (G := G) (x := x) hG ψ hx -+ -+ let S : ℝ → ℂ := fun σ' => -+ ∑' n : ℕ, -+ term (fun n ↦ (f n : ℂ)) σ' n * -+ 𝓕 ψ.toFun (1 / (2 * π) * Real.log ((n : ℝ) / x)) -+ let Pole : ℝ → ℂ := fun σ' => -+ (A : ℂ) * ((x ^ (1 - σ') : ℝ) : ℂ) * -+ ∫ u in Set.Ici (-Real.log x), -+ (rexp (-u * (σ' - 1)) : ℂ) * -+ 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π)) -+ let RHS : ℝ → ℂ := fun σ' => -+ ∫ t : ℝ, G (σ' + t * I) * ψ.toFun t * (x : ℂ) ^ (t * I) -+ -+ have haux : -+ (fun σ' : ℝ ↦ -+ ∑' (n : ℕ), -+ term (fun n ↦ (f n : ℂ)) (σ' : ℂ) n * -+ 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x)) -+ - (A : ℂ) * ((x ^ (1 - σ') : ℝ) : ℂ) * -+ ∫ (u : ℝ) in Ici (-Real.log x), -+ cexp (-( (u : ℂ) * ((σ' : ℂ) - 1))) * -+ 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π))) -+ =ᶠ[𝓝[>] (1 : ℝ)] -+ (fun σ' : ℝ ↦ -+ ∫ (t : ℝ), G ((σ' : ℂ) + (t : ℂ) * I) * ψ.toFun t * (x : ℂ) ^ ((t : ℂ) * I)) := by -+ rw [Filter.EventuallyEq] -+ -+ refine eventually_nhdsWithin_of_forall ?_ -+ intro σ' hσ' -+ have hσ' : (1 : ℝ) < σ' := by -+ simpa [Set.mem_Ioi] using hσ' -+ simpa using! (limiting_fourier_aux_gt_zero (G := G) (f := f) (A := A) hG' hf ψ hx σ' hσ') -+ -+ have haux' : -+ (fun σ' : ℝ => S σ') =ᶠ[𝓝[>] (1 : ℝ)] (fun σ' : ℝ => RHS σ' + Pole σ') := by -+ rw [Filter.EventuallyEq] at haux ⊢ -+ filter_upwards [haux] with σ' hσ' -+ have hσ'' : S σ' - Pole σ' = RHS σ' := by -+ simpa [S, Pole, RHS] using hσ' -+ have hadd : (S σ' - Pole σ') + Pole σ' = RHS σ' + Pole σ' := -+ congrArg (fun z : ℂ => z + Pole σ') hσ'' -+ simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using hadd -+ -+ let Pole₁ : ℂ := (A : ℂ) * ∫ u in Set.Ici (-Real.log x), 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π)) -+ let RHS₁ : ℂ := ∫ t : ℝ, G (1 + (t : ℂ) * I) * ψ.toFun t * (x : ℂ) ^ ((t : ℂ) * I) -+ -+ have hRHS_le : -+ ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ‖RHS σ'‖ ≤ ‖RHS₁‖ + 1 := by -+ have hball : Metric.ball RHS₁ (1 : ℝ) ∈ 𝓝 RHS₁ := by -+ simpa using (Metric.ball_mem_nhds (x := RHS₁) (ε := (1 : ℝ)) (by norm_num)) -+ have hpre : {σ' : ℝ | RHS σ' ∈ Metric.ball RHS₁ (1 : ℝ)} ∈ (𝓝[>] (1 : ℝ)) := -+ l3 hball -+ filter_upwards [hpre] with σ' hmem -+ have hdist' : dist (RHS σ') RHS₁ < (1 : ℝ) := by -+ simpa [Metric.mem_ball] using hmem -+ have hdist : ‖RHS σ' - RHS₁‖ < (1 : ℝ) := by -+ simpa [dist_eq_norm] using hdist' -+ have htri : ‖RHS σ'‖ ≤ ‖RHS₁‖ + ‖RHS σ' - RHS₁‖ := by -+ have h := norm_add_le (RHS σ' - RHS₁) RHS₁ -+ simpa [sub_add_cancel, add_comm, add_left_comm, add_assoc] using h -+ have hle : ‖RHS₁‖ + ‖RHS σ' - RHS₁‖ ≤ ‖RHS₁‖ + (1 : ℝ) := by -+ exact add_le_add_right (le_of_lt hdist) ‖RHS₁‖ -+ exact htri.trans hle -+ -+ have hPole_le : -+ ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ‖Pole σ'‖ ≤ ‖Pole₁‖ + 1 := by -+ have hball : Metric.ball Pole₁ 1 ∈ 𝓝 Pole₁ := by -+ simpa using (Metric.ball_mem_nhds Pole₁ (by norm_num : (0 : ℝ) < 1)) -+ have hpre : {σ' : ℝ | Pole σ' ∈ Metric.ball Pole₁ 1} ∈ (𝓝[>] (1 : ℝ)) := l2 hball -+ filter_upwards [hpre] with σ' hmem -+ have hdist : ‖Pole σ' - Pole₁‖ < 1 := by -+ simpa [Metric.mem_ball, dist_eq_norm] using hmem -+ have htri : ‖Pole σ'‖ ≤ ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ := by -+ have hdecomp : Pole σ' = Pole₁ + (Pole σ' - Pole₁) := by abel -+ have hnorm_eq : ‖Pole σ'‖ = ‖Pole₁ + (Pole σ' - Pole₁)‖ := by -+ simp [congrArg (fun z : ℂ => ‖z‖) hdecomp] -+ calc -+ ‖Pole σ'‖ = ‖Pole₁ + (Pole σ' - Pole₁)‖ := hnorm_eq -+ _ ≤ ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ := norm_add_le _ _ -+ have hdist_le : ‖Pole σ' - Pole₁‖ ≤ 1 := le_of_lt hdist -+ have hsum : ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ ≤ ‖Pole₁‖ + 1 := by -+ simpa [add_comm, add_left_comm, add_assoc] using (add_le_add_left hdist_le ‖Pole₁‖) -+ exact htri.trans hsum -+ -+ have hS_le : -+ ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), -+ ‖S σ'‖ ≤ (‖RHS₁‖ + 1) + (‖Pole₁‖ + 1) := by -+ rw [Filter.EventuallyEq] at haux' -+ filter_upwards [haux', hRHS_le, hPole_le] with σ' hEq hR hP -+ calc -+ ‖S σ'‖ = ‖RHS σ' + Pole σ'‖ := by simp [hEq] -+ _ ≤ ‖RHS σ'‖ + ‖Pole σ'‖ := norm_add_le _ _ -+ _ ≤ (‖RHS₁‖ + 1) + (‖Pole₁‖ + 1) := by -+ exact add_le_add hR hP -+ -+ have hbounded : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ' : ℝ => ‖S σ'‖) := by -+ let C : ℝ := ‖RHS₁‖ + 1 + (‖Pole₁‖ + 1) -+ simp only [BoundedAtFilter, Asymptotics.IsBigO, Asymptotics.IsBigOWith] -+ refine ⟨C, ?_⟩ -+ filter_upwards [hS_le] with σ' hσ' -+ simpa [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg (S σ'))] using hσ' -+ -+ have hcoef : (1 / (2 * π) : ℝ) = (π⁻¹ * 2⁻¹ : ℝ) := by field_simp [pi_ne_zero] -+ -+ have l1 := -+ limiting_fourier_variant_lim1 -+ (f := f) (x := x) (ψ := ψ) -+ hpos hψpos -+ (S := S) -+ (hSdef := by -+ intro σ -+ simp [S, hcoef] ) -+ hbounded -+ hf -+ have l1S : -+ Tendsto S (𝓝[>] (1 : ℝ)) -+ (𝓝 (∑' n : ℕ, (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (1 / (2 * π) * Real.log (↑n / x)))) := by -+ simpa [S, hcoef] using l1 -+ -+ have l12 : Tendsto (fun σ' : ℝ => S σ' - Pole σ') (𝓝[>] (1 : ℝ)) -+ (𝓝 ((∑' n : ℕ, (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (1 / (2 * π) * Real.log (↑n / x))) - Pole₁)) := -+ l1S.sub l2 -+ -+ have hPole : (Pole : ℝ → ℂ) =ᶠ[𝓝[>] (1 : ℝ)] Pole := by simp -+ have haux_sub : -+ (fun σ' : ℝ => S σ' - Pole σ') =ᶠ[𝓝[>] (1 : ℝ)] RHS := by -+ filter_upwards [haux'] with σ' hσ' -+ calc -+ S σ' - Pole σ' -+ = (RHS σ' + Pole σ') - Pole σ' := by simp [hσ'] -+ _ = RHS σ' := by simp -+ have hlim := -+ tendsto_nhds_unique_of_eventuallyEq (l1S.sub l2) l3 haux_sub -+ -+ simpa [Pole₁, RHS₁] using! hlim -+ -+lemma norm_mul_integral_Ici_le_integral_norm -+ (A : ℂ) (F : ℝ → ℂ) (a : ℝ) -+ (hF : IntegrableOn F (Set.Ici a)) -+ (hnorm : Integrable (fun u : ℝ => ‖F u‖)) : -+ ‖A * (∫ u in Set.Ici a, F u)‖ ≤ ‖A‖ * (∫ u : ℝ, ‖F u‖) := by -+ have hmul : ‖A * (∫ u in Set.Ici a, F u)‖ = ‖A‖ * ‖∫ u in Set.Ici a, F u‖ := by -+ simp -+ have hnormI : -+ ‖∫ u in Set.Ici a, F u‖ ≤ ∫ u in Set.Ici a, ‖F u‖ := by -+ have _ : Integrable F (Measure.restrict volume (Set.Ici a)) := hF -+ have h : -+ ‖∫ u, F u ∂Measure.restrict volume (Set.Ici a)‖ -+ ≤ ∫ u, ‖F u‖ ∂Measure.restrict volume (Set.Ici a) := -+ norm_integral_le_integral_norm (μ := Measure.restrict volume (Set.Ici a)) (f := F) -+ simpa using h -+ -+ have hdom : -+ (∫ u in Set.Ici a, ‖F u‖) ≤ ∫ u : ℝ, ‖F u‖ := by -+ have hEq : -+ (∫ u in Set.Ici a, ‖F u‖) = -+ ∫ u : ℝ, Set.indicator (Set.Ici a) (fun u => ‖F u‖) u := by -+ have h := (integral_indicator (μ := (volume : Measure ℝ)) -+ (s := Set.Ici a) (f := fun u => ‖F u‖)) -+ have h' := h measurableSet_Ici -+ simpa using h'.symm -+ have hind_int : -+ Integrable (Set.indicator (Set.Ici a) (fun u => ‖F u‖)) := -+ hnorm.indicator measurableSet_Ici -+ have hpoint : -+ Set.indicator (Set.Ici a) (fun u => ‖F u‖) -+ ≤ᵐ[volume] (fun u : ℝ => ‖F u‖) := by -+ filter_upwards with u -+ by_cases hu : u ∈ Set.Ici a -+ · simp [Set.indicator_of_mem hu] -+ · simp [Set.indicator_of_notMem hu] -+ have hmono := -+ integral_mono_ae (μ := (volume : Measure ℝ)) -+ hind_int hnorm hpoint -+ simpa [hEq] using hmono -+ -+ calc -+ ‖A * (∫ u in Set.Ici a, F u)‖ -+ = ‖A‖ * ‖∫ u in Set.Ici a, F u‖ := hmul -+ _ ≤ ‖A‖ * (∫ u in Set.Ici a, ‖F u‖) := -+ mul_le_mul_of_nonneg_left hnormI (by simp) -+ _ ≤ ‖A‖ * (∫ u : ℝ, ‖F u‖) := -+ mul_le_mul_of_nonneg_left hdom (by simp) -+ -+lemma fourier_decay_of_CS2 -+ (ψ : CS 2 ℂ) : -+ ∃ C : ℝ, ∀ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by -+ let ψ' : W21 := (ψ : W21) -+ obtain ⟨C, hC⟩ : -+ ∃ C : ℝ, ∀ u : ℝ, ‖𝓕 (ψ' : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by -+ simpa using (decay_bounds_cor (ψ := ψ')) -+ refine ⟨C, ?_⟩ -+ intro u -+ simpa [ψ'] using! (hC u) -+ -+lemma integrable_norm_fourier_scaled_of_CS2 -+ (ψ : CS 2 ℂ) : -+ Integrable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by -+ obtain ⟨C, hdecay⟩ := fourier_decay_of_CS2 (ψ := ψ) -+ have hC_nonneg : 0 ≤ C := by -+ have h0 := hdecay 0 -+ have hnorm : 0 ≤ ‖𝓕 (ψ : ℝ → ℂ) 0‖ := norm_nonneg _ -+ have hC' : ‖𝓕 (ψ : ℝ → ℂ) 0‖ ≤ C := by simpa using h0 -+ exact hnorm.trans hC' -+ have hmaj_int : Integrable (fun u : ℝ => (C : ℝ) / (1 + (u / (2 * Real.pi))^2)) := by -+ have hbase : Integrable (fun u : ℝ => (1 + u ^ 2)⁻¹) := integrable_inv_one_add_sq -+ have hscale : -+ Integrable (fun u : ℝ => (1 + (u / (2 * Real.pi)) ^ 2)⁻¹) := -+ hbase.comp_div (by nlinarith [Real.pi_pos]) -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, pow_two] using -+ hscale.const_mul C -+ have hle : -+ (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) -+ ≤ᵐ[volume] -+ (fun u : ℝ => (C : ℝ) / (1 + (u / (2 * Real.pi))^2)) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro u -+ simpa using (hdecay (u / (2 * Real.pi))) -+ have hle_norm : -+ (fun u : ℝ => ‖‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖‖) -+ ≤ᵐ[volume] -+ (fun u : ℝ => ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖) := by -+ refine hle.mono ?_ -+ intro u hu -+ have hden_pos : 0 < 1 + (u / (2 * Real.pi)) ^ 2 := by nlinarith -+ have hnonneg : 0 ≤ (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := -+ div_nonneg hC_nonneg hden_pos.le -+ have hleft_nonneg : 0 ≤ ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖ := norm_nonneg _ -+ have hbound : ‖‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖‖ ≤ -+ (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := by -+ simpa [Real.norm_eq_abs, abs_of_nonneg hleft_nonneg] using hu -+ have hC_abs : |C| = C := abs_of_nonneg hC_nonneg -+ have hden_abs : |1 + (u / (2 * Real.pi))^2| = 1 + (u / (2 * Real.pi))^2 := by -+ have : 0 ≤ 1 + (u / (2 * Real.pi))^2 := by nlinarith -+ simpa using abs_of_nonneg this -+ have hnorm : -+ ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖ = -+ (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := by -+ have hrec : -+ ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖ = -+ |C| / |1 + (u / (2 * Real.pi))^2| := by -+ simp [Real.norm_eq_abs] -+ simp [hC_abs, hden_abs, hrec] -+ simpa [hnorm] using hbound -+ have hmaj_int_norm : -+ Integrable (fun u : ℝ => ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖) := -+ hmaj_int.norm -+ have hmeas : -+ AEStronglyMeasurable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by -+ have hcont : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) u := by -+ simpa using! continuous_FourierIntegral (ψ : W21) -+ have hcont_scaled : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) := -+ hcont.comp (by continuity) -+ exact hcont_scaled.aestronglyMeasurable.norm -+ exact hmaj_int_norm.mono' hmeas hle_norm -+ -+lemma exists_bound_norm_G_on_tsupport -+ (hG : ContinuousOn G {s : ℂ | 1 ≤ s.re}) -+ (ψ : CS 2 ℂ) : -+ ∃ K : ℝ, ∀ t : ℝ, t ∈ tsupport (ψ : ℝ → ℂ) → -+ ‖G (1 + t * Complex.I)‖ ≤ K := by -+ let s : Set ℝ := tsupport (ψ : ℝ → ℂ) -+ have hscompact : IsCompact s := by -+ simpa [s] using (ψ.h2.isCompact : IsCompact (tsupport (ψ : ℝ → ℂ))) -+ have hphi_cont : Continuous (fun t : ℝ => (1 : ℂ) + t * Complex.I) := by continuity -+ have hphi_maps : -+ Set.MapsTo (fun t : ℝ => (1 : ℂ) + t * Complex.I) s {z : ℂ | 1 ≤ z.re} := by -+ intro t ht -+ simp -+ have hGcomp : ContinuousOn (fun t : ℝ => G ((1 : ℂ) + t * Complex.I)) s := -+ hG.comp hphi_cont.continuousOn hphi_maps -+ have hnorm_contOn : ContinuousOn (fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) s := hGcomp.norm -+ have hbdd : BddAbove ((fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s) := -+ (hscompact.image_of_continuousOn hnorm_contOn).bddAbove -+ refine ⟨sSup ((fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s), ?_⟩ -+ intro t ht -+ have : ‖G ((1 : ℂ) + t * Complex.I)‖ ∈ -+ (fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s := ⟨t, ht, rfl⟩ -+ exact le_csSup hbdd this -+ -+lemma norm_integrand_le_K_mul_norm_psi -+ {x K : ℝ} -+ (hx : 0 < x) -+ (hK : ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K) : -+ ∀ t : ℝ, -+ ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ ≤ K * ‖ψ t‖ := by -+ intro t -+ by_cases ht : t ∈ Function.support ψ -+ · have hxnorm : ‖((x : ℂ) ^ (t * Complex.I))‖ = 1 := norm_x_cpow_it x t hx -+ calc -+ ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ -+ = ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ * ‖((x : ℂ) ^ (t * Complex.I))‖ := by -+ simp [mul_left_comm, mul_comm] -+ _ = ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ * 1 := by simp [hxnorm] -+ _ ≤ K * ‖ψ t‖ := by -+ have hGle : ‖G (1 + t * Complex.I)‖ ≤ K := hK t ht -+ have : ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ ≤ K * ‖ψ t‖ := -+ mul_le_mul_of_nonneg_right hGle (norm_nonneg _) -+ simpa [mul_assoc, mul_left_comm, mul_comm] using this -+ · have hψ0 : ψ t = 0 := by -+ by_contra hψ0 -+ exact ht (by simpa [Function.support] using hψ0) -+ simp [hψ0, mul_comm] -+ -+lemma norm_error_integral_le -+ (ψ : ℝ → ℂ) (x K : ℝ) -+ (hGline_meas : Measurable (fun t : ℝ => G (1 + t * I))) -+ (hψ_meas : AEStronglyMeasurable ψ) -+ (hx : 0 < x) -+ (hK : ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K) -+ (hψ : Integrable (fun t : ℝ => ‖ψ t‖) ) : -+ ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ -+ ≤ K * (∫ t : ℝ, ‖ψ t‖) := by -+ have h1 : ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ -+ ≤ ∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ := by -+ simpa using (norm_integral_le_integral_norm -+ (f := fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I)))) -+ have hmeas_main : AEStronglyMeasurable -+ (fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))) := by -+ have hG' : AEMeasurable fun t : ℝ => G (1 + t * Complex.I) := hGline_meas.aemeasurable -+ have hψ_meas' : AEMeasurable ψ := hψ_meas.aemeasurable -+ have hx_ne : (x : ℂ) ≠ 0 := by exact_mod_cast (ne_of_gt hx) -+ have hx_ne' : NeZero (x : ℂ) := ⟨hx_ne⟩ -+ have hxpow_meas : AEMeasurable fun t : ℝ => ((x : ℂ) ^ (t * Complex.I)) := by -+ have hcontℂ : Continuous fun z : ℂ => ((x : ℂ) ^ z) := -+ continuous_const_cpow (z := (x : ℂ)) -+ have hcont : Continuous fun t : ℝ => ((x : ℂ) ^ ((t : ℂ) * Complex.I)) := -+ hcontℂ.comp (by -+ have h : Continuous fun t : ℝ => (t : ℂ) * Complex.I := by -+ simpa using! (continuous_ofReal.mul continuous_const) -+ simpa [mul_comm] using h) -+ exact hcont.measurable.aemeasurable -+ have hGψ_meas : AEMeasurable fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) := hG'.mul hψ_meas' -+ have htotal : AEMeasurable (fun t : ℝ => -+ (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))) := -+ hGψ_meas.mul hxpow_meas -+ exact htotal.aestronglyMeasurable -+ have hpt : (fun t : ℝ => -+ ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) -+ ≤ᵐ[volume] (fun t : ℝ => K * ‖ψ t‖) := by -+ refine Eventually.of_forall ?_ -+ intro t -+ exact norm_integrand_le_K_mul_norm_psi (hx := hx) (hK := hK) t -+ have hR : Integrable (fun t : ℝ => K * ‖ψ t‖) := hψ.const_mul K -+ have hL : Integrable (fun t : ℝ => -+ ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) := by -+ have hpt_norm : -+ (fun t : ℝ => ‖‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖‖) -+ ≤ᵐ[volume] (fun t : ℝ => K * ‖ψ t‖) := hpt.mono (by -+ intro t ht -+ simpa [norm_mul, mul_comm, mul_left_comm, mul_assoc] using ht) -+ exact hR.mono' hmeas_main.norm hpt_norm -+ have h2 : (∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) -+ ≤ ∫ t : ℝ, K * ‖ψ t‖ := integral_mono_ae (μ := (volume : Measure ℝ)) hL hR hpt -+ have h3 : (∫ t : ℝ, K * ‖ψ t‖) = K * (∫ t : ℝ, ‖ψ t‖) := by -+ simp [integral_const_mul] -+ calc -+ ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ -+ ≤ ∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ := h1 -+ _ ≤ ∫ t : ℝ, K * ‖ψ t‖ := h2 -+ _ = K * (∫ t : ℝ, ‖ψ t‖) := h3 -+ -+lemma crude_upper_bound -+ (hpos : 0 ≤ f) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (ψ : CS 2 ℂ) -+ (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) : -+ ∃ B : ℝ, ∀ x : ℝ, 0 < x → ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ B := by -+ -+ have hψ_int : MeasureTheory.Integrable (ψ : ℝ → ℂ) := by -+ simpa using (ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2) -+ have hψ_norm_int : MeasureTheory.Integrable (fun t : ℝ => ‖(ψ : ℝ → ℂ) t‖) := -+ hψ_int.norm -+ have hψ_meas : MeasureTheory.AEStronglyMeasurable (ψ : ℝ → ℂ) := -+ hψ_int.aestronglyMeasurable -+ -+ rcases exists_bound_norm_G_on_tsupport (G := G) hG ψ with ⟨K, hK_ts⟩ -+ have hK_support : -+ ∀ t : ℝ, t ∈ Function.support (ψ : ℝ → ℂ) → ‖G (1 + t * Complex.I)‖ ≤ K := by -+ have hbnG (hKts : ∀ t : ℝ, t ∈ tsupport ψ → ‖G (1 + t * Complex.I)‖ ≤ K) : -+ ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K := by -+ intro t ht -+ exact hKts t ((subset_tsupport ψ) ht) -+ exact hbnG hK_ts -+ -+ have hGline_meas : Measurable (fun t : ℝ => G (1 + t * Complex.I)) := by -+ have hline_cont : Continuous (fun t : ℝ => (1 : ℂ) + t * Complex.I) := by -+ continuity -+ have hmem : ∀ t : ℝ, ((1 : ℂ) + t * Complex.I) ∈ {s : ℂ | 1 ≤ s.re} := by -+ intro t -+ simp -+ have hcont : Continuous (G ∘ fun t : ℝ => (1 : ℂ) + t * Complex.I) := -+ hG.comp_continuous hline_cont hmem -+ simpa [Function.comp] using! hcont.measurable -+ -+ have hF_norm_int : -+ MeasureTheory.Integrable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := -+ integrable_norm_fourier_scaled_of_CS2 ψ -+ have hF_meas : -+ MeasureTheory.AEStronglyMeasurable -+ (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := by -+ have hcont : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) u := by -+ simpa using! continuous_FourierIntegral (ψ : W21) -+ have hcont_scaled : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) := -+ hcont.comp (by continuity) -+ exact hcont_scaled.aestronglyMeasurable -+ have hF_int : -+ MeasureTheory.Integrable (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := -+ by -+ have hfin_norm : -+ MeasureTheory.HasFiniteIntegral -+ (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := -+ hF_norm_int.hasFiniteIntegral -+ have hfin : -+ MeasureTheory.HasFiniteIntegral -+ (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := by -+ simpa [MeasureTheory.hasFiniteIntegral_iff_norm] using hfin_norm -+ exact ⟨hF_meas, hfin⟩ -+ refine ⟨K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) -+ + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖), ?_⟩ -+ intro x hx -+ set I : ℂ := ∫ u in Set.Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) with hI -+ -+ have hlim := -+ limiting_fourier_variant (f := f) (A := A) (G := G) -+ hpos hG hG' hf ψ hψpos hx -+ have hlim' : -+ (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) -+ - A * I -+ = ∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I) := by -+ simpa [hI] using hlim -+ -+ have htsum : -+ (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) -+ = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := by -+ have h' : -+ (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) -+ = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := -+ eq_add_of_sub_eq hlim' -+ simpa [add_comm, mul_comm, mul_left_comm, mul_assoc] using h' -+ -+ have hRHS_bound : -+ ‖∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)‖ -+ ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) := -+ norm_error_integral_le (G := G) (ψ := (ψ : ℝ → ℂ)) (x := x) (K := K) -+ hGline_meas hψ_meas hx hK_support hψ_norm_int -+ -+ have hA_bound : -+ ‖A * I‖ ≤ ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by -+ have hF_on : MeasureTheory.IntegrableOn -+ (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) -+ (Set.Ici (-Real.log x)) := -+ hF_int.integrableOn -+ simpa [hI] using -+ norm_mul_integral_Ici_le_integral_norm (A := A) -+ (F := fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) -+ (a := -Real.log x) hF_on hF_norm_int -+ -+ have htsum_std : -+ (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))) -+ = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := by -+ simpa [one_div, mul_comm, mul_left_comm, mul_assoc] using htsum -+ -+ have hbound : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) -+ (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ -+ ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) -+ + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by -+ have hnorm : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) -+ (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ = -+ ‖(∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I‖ := -+ congrArg norm htsum_std -+ calc -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) -+ (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ -+ = ‖(∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I‖ := hnorm -+ _ ≤ ‖∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)‖ + ‖A * I‖ := -+ norm_add_le _ _ -+ _ ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) -+ + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := -+ add_le_add hRHS_bound hA_bound -+ exact hbound -+ -+lemma Real.fourierIntegral_convolution {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) : -+ 𝓕 (convolution f g (ContinuousLinearMap.mul ℂ ℂ) volume) = 𝓕 f * 𝓕 g := by -+ ext y -+ simp only [Pi.mul_apply, FourierTransform.fourier, MeasureTheory.convolution, -+ VectorFourier.fourierIntegral, ContinuousLinearMap.mul_apply'] -+ have h_int : Integrable (fun p : ℝ × ℝ ↦ 𝐞 (-(y * p.1)) • (f p.2 * g (p.1 - p.2))) := by -+ simp only [Circle.smul_def, smul_eq_mul] -+ refine (Integrable.convolution_integrand (ContinuousLinearMap.mul ℂ ℂ) hf hg).bdd_mul -+ (c := 1) ?_ ?_ -+ · exact (by continuity : Continuous _).aestronglyMeasurable -+ · filter_upwards with p; simp -+ calc ∫ v, 𝐞 (-(y * v)) • ∫ t, f t * g (v - t) -+ = ∫ v, ∫ t, 𝐞 (-(y * v)) • (f t * g (v - t)) := by -+ simp only [Circle.smul_def, smul_eq_mul, ← integral_const_mul] -+ _ = ∫ t, ∫ v, 𝐞 (-(y * v)) • (f t * g (v - t)) := integral_integral_swap h_int -+ _ = ∫ t, f t • ∫ v, 𝐞 (-(y * v)) • g (v - t) := by -+ simp only [Circle.smul_def, smul_eq_mul, mul_left_comm, integral_const_mul] -+ _ = ∫ t, f t • ∫ u, 𝐞 (-(y * (u + t))) • g u := by -+ congr 1; ext t -+ rw [← integral_add_right_eq_self (fun v ↦ 𝐞 (-(y * v)) • g (v - t)) t]; simp -+ _ = ∫ t, f t • ∫ u, (𝐞 (-(y * t)) * 𝐞 (-(y * u))) • g u := by -+ congr 2 with t; congr 1 -+ simp only [mul_add, neg_add, mul_comm, Real.fourierChar.map_add_eq_mul] -+ _ = ∫ t, 𝐞 (-(y * t)) • f t • ∫ u, 𝐞 (-(y * u)) • g u := by -+ congr 1; ext t -+ simp only [mul_smul, Circle.smul_def, smul_eq_mul, integral_const_mul]; ring -+ _ = (∫ t, 𝐞 (-(y * t)) • f t) * ∫ u, 𝐞 (-(y * u)) • g u := by -+ simp only [Circle.smul_def, smul_eq_mul, ← mul_assoc, integral_mul_const] -+ -+lemma Real.fourierIntegral_conj_neg {f : ℝ → ℂ} (y : ℝ) : -+ 𝓕 (fun x ↦ conj (f (-x))) y = conj (𝓕 f y) := by -+ simp only [fourier_real_eq] -+ have h_conj : ∀ x, 𝐞 (-(x * y)) • conj (f (-x)) = conj (𝐞 (x * y) • f (-x)) := fun x ↦ by -+ simp only [Circle.smul_def, Real.fourierChar_apply, map_mul, smul_eq_mul, neg_mul, -+ Complex.ofReal_neg, mul_neg] -+ congr 1 -+ rw [← Complex.exp_conj] -+ simp only [map_mul, Complex.conj_I, Complex.conj_ofReal, mul_neg] -+ calc ∫ x, 𝐞 (-(x * y)) • conj (f (-x)) -+ = ∫ x, conj (𝐞 (x * y) • f (-x)) := by congr 1; ext x; exact h_conj x -+ _ = conj (∫ x, 𝐞 (x * y) • f (-x)) := integral_conj -+ _ = conj (∫ x, 𝐞 (-(x * y)) • f x) := by -+ rw [← integral_neg_eq_self (fun x => 𝐞 (-(x * y)) • f x)] -+ congr 2 with x; ring_nf -+ -+lemma auto_cheby_exists_smooth_nonneg_fourier_kernel : -+ ∃ (ψ : ℝ → ℂ), ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ -+ (∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) ∧ 0 < (𝓕 ψ 0).re := by -+ obtain ⟨φ_real, hφSmooth, hφCompact, hφIcc, _, hφsupp⟩ := -+ smooth_urysohn_support_Ioo (a := 1/2) (b := 1) (c := 1) (d := 2) (by norm_num) (by norm_num) -+ let φ : ℝ → ℂ := Complex.ofReal ∘ φ_real -+ let φ_rev : ℝ → ℂ := fun x ↦ conj (φ (-x)) -+ let ψ_fun : ℝ → ℂ := convolution φ φ_rev (ContinuousLinearMap.mul ℂ ℂ) volume -+ have hφSmooth' : ContDiff ℝ ∞ φ := contDiff_ofReal.comp hφSmooth -+ have hφCompact' : HasCompactSupport φ := hφCompact.comp_left rfl -+ have hφRevSmooth : ContDiff ℝ ∞ φ_rev := Complex.conjCLE.contDiff.comp (hφSmooth'.comp contDiff_neg) -+ have hφRevCompact : HasCompactSupport φ_rev := (hφCompact'.comp_homeomorph (Homeomorph.neg ℝ)).comp_left (by simp) -+ have hφInt : Integrable φ := hφSmooth'.continuous.integrable_of_hasCompactSupport hφCompact' -+ have hφRevInt : Integrable φ_rev := hφRevSmooth.continuous.integrable_of_hasCompactSupport hφRevCompact -+ have hψSmooth : ContDiff ℝ ∞ ψ_fun := by -+ convert! hφRevCompact.contDiff_convolution_right (ContinuousLinearMap.mul ℝ ℂ) -+ (hφSmooth'.continuous.locallyIntegrable (μ := volume)) hφRevSmooth -+ have hψCompact : HasCompactSupport ψ_fun := -+ HasCompactSupport.convolution (ContinuousLinearMap.mul ℂ ℂ) hφCompact' hφRevCompact -+ refine ⟨ψ_fun, hψSmooth, hψCompact, fun y ↦ ?_, ?_⟩ -+ · rw [Real.fourierIntegral_convolution hφInt hφRevInt, Pi.mul_apply, -+ Real.fourierIntegral_conj_neg y, mul_comm, ← Complex.normSq_eq_conj_mul_self] -+ exact ⟨Complex.normSq_nonneg _, rfl⟩ -+ · have hφ_nonneg : ∀ x, 0 ≤ φ_real x := fun x ↦ by -+ have hx := hφIcc x; by_cases h : x ∈ Set.Icc (1:ℝ) 1 -+ · simp only [Set.indicator_of_mem h, Pi.one_apply] at hx; linarith -+ · simp only [Set.indicator_of_notMem h] at hx; exact hx -+ have hvol_supp : (1 : ENNReal) ≤ volume (Function.support φ_real) := by -+ have hsub : Set.Ico (1:ℝ) 2 ⊆ Function.support φ_real := fun x hx ↦ -+ hφsupp.symm ▸ Set.mem_Ioo.mpr ⟨by linarith [hx.1], hx.2⟩ -+ calc _ = volume (Set.Ico (1:ℝ) 2) := by simp [Real.volume_Ico]; norm_num -+ _ ≤ _ := volume.mono hsub -+ have hφint_pos : 0 < ∫ x, φ_real x := -+ (integral_pos_iff_support_of_nonneg_ae (.of_forall hφ_nonneg) -+ (hφSmooth.continuous.integrable_of_hasCompactSupport hφCompact)).2 -+ (lt_of_lt_of_le (by simp) hvol_supp) -+ have hFφ0_re : 0 < (𝓕 φ 0).re := by -+ simp only [φ, fourier_real_eq, mul_zero, neg_zero, AddChar.map_zero_eq_one, one_smul, -+ Function.comp_apply] -+ have hint : Integrable (fun x => (φ_real x : ℂ)) := -+ (hφSmooth.continuous.integrable_of_hasCompactSupport hφCompact).ofReal -+ calc (∫ x, (φ_real x : ℂ)).re = ∫ x, (φ_real x : ℂ).re := (integral_re hint).symm -+ _ = ∫ x, φ_real x := by simp only [Complex.ofReal_re] -+ _ > 0 := hφint_pos -+ rw [Real.fourierIntegral_convolution hφInt hφRevInt, Pi.mul_apply, -+ Real.fourierIntegral_conj_neg 0, mul_comm, ← Complex.normSq_eq_conj_mul_self] -+ exact Complex.normSq_pos.2 (fun h ↦ (ne_of_gt hFφ0_re) (by simp [h])) -+ -+lemma auto_cheby_fourier_summable (hpos : 0 ≤ f) (hf : ∀ σ', 1 < σ' → Summable (nterm f σ')) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ψ : ℝ → ℂ) (hψSmooth : ContDiff ℝ ∞ ψ) (hψCompact : HasCompactSupport ψ) -+ (hψpos : ∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) (x : ℝ) (hx : 1 ≤ x) : -+ Summable fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x)) := by -+ let ψCS : CS 2 ℂ := ⟨ψ, hψSmooth.of_le (by norm_cast), hψCompact⟩ -+ let S : ℝ → ℂ := fun σ' ↦ ∑' n, term (f · : ℕ → ℂ) σ' n * 𝓕 ψCS.toFun (1 / (2 * π) * Real.log (n / x)) -+ let Pole : ℝ → ℂ := fun σ' ↦ (A : ℂ) * (x ^ (1 - σ') : ℝ) * -+ ∫ u in Set.Ici (-Real.log x), (rexp (-u * (σ' - 1)) : ℂ) * 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π)) -+ let RHS : ℝ → ℂ := fun σ' ↦ ∫ t : ℝ, G (σ' + t * I) * ψCS.toFun t * (x : ℂ) ^ (t * I) -+ have l2 := limiting_fourier_lim2 (A := A) (x := x) ψCS hx -+ have l3 := limiting_fourier_lim3 (G := G) hG ψCS hx -+ have haux : (fun σ' ↦ S σ' - Pole σ') =ᶠ[𝓝[>] 1] RHS := eventually_nhdsWithin_of_forall fun σ' hσ' ↦ by -+ simpa [S, Pole, RHS] using! limiting_fourier_aux hG' hf ψCS hx σ' hσ' -+ have hS_tendsto : Tendsto S (𝓝[>] 1) (𝓝 (RHS 1 + A * ∫ u in Set.Ici (-Real.log x), -+ 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π)))) := by -+ convert! (l3.congr' haux.symm).add l2 using 1; ext σ'; simp [S, Pole] -+ have hbounded : BoundedAtFilter (𝓝[>] 1) (fun σ' ↦ ‖S σ'‖) := by -+ simp only [BoundedAtFilter] -+ let L := ‖RHS 1 + A * ∫ u in Set.Ici (-Real.log x), 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π))‖ -+ have : ∀ᶠ σ' in 𝓝[>] 1, ‖S σ'‖ < L + 1 := -+ hS_tendsto.norm.eventually_lt tendsto_const_nhds (lt_add_one L) -+ exact Asymptotics.IsBigO.of_bound (L + 1) (by filter_upwards [this] with σ h; simpa using h.le) -+ let y : ℕ → ℝ := fun n ↦ (1 / (2 * π)) * Real.log (n / x) -+ let w : ℕ → ℝ := fun n ↦ (𝓕 ψCS.toFun (y n)).re -+ have hw : ∀ n, 0 ≤ w n := fun n ↦ (hψpos (y n)).1 -+ let rt : ℝ → ℕ → ℝ := fun σ n ↦ if n = 0 then 0 else f n / (n : ℝ) ^ σ * w n -+ have rt_nn σ n : 0 ≤ rt σ n := by -+ simp only [rt]; split_ifs with hn -+ · rfl -+ · exact mul_nonneg (div_nonneg (hpos n) (Real.rpow_pos_of_pos (Nat.cast_pos.mpr -+ (Nat.pos_of_ne_zero hn)) σ).le) (hw n) -+ have hS_eq σ' (hσ' : 1 < σ') : S σ' = ↑(∑' n, rt σ' n) := by -+ rw [Complex.ofReal_tsum]; apply tsum_congr; intro n -+ simp only [rt, term, LSeries.term, y, w, one_div, mul_inv_rev] -+ split_ifs with hn <;> simp only [hn, CharP.cast_eq_zero, Complex.ofReal_zero, zero_mul, -+ Complex.ofReal_mul, Complex.ofReal_div] -+ rw [Complex.ofReal_cpow (Nat.cast_nonneg n)]; congr 1 -+ exact Complex.ext rfl (hψpos _).2 -+ have hMono n : AntitoneOn (fun σ ↦ rt σ n) (Set.Ioi 1) := fun σ₁ _ σ₂ _ h ↦ by -+ simp only [rt]; split_ifs with hn; · rfl -+ apply mul_le_mul_of_nonneg_right _ (hw n) -+ apply div_le_div_of_nonneg_left (hpos n) (Real.rpow_pos_of_pos (Nat.cast_pos.mpr -+ (Nat.pos_of_ne_zero hn)) σ₁) -+ exact Real.rpow_le_rpow_of_exponent_le (Nat.one_le_cast.mpr (Nat.pos_of_ne_zero hn)) h -+ have hT_bdd : BoundedAtFilter (𝓝[>] 1) fun σ ↦ ∑' n, rt σ n := by -+ rw [BoundedAtFilter, Asymptotics.isBigO_iff] at hbounded ⊢ -+ obtain ⟨C, hC⟩ := hbounded -+ refine ⟨C, ?_⟩ -+ filter_upwards [hC, self_mem_nhdsWithin] with σ hnorm hσ -+ rw [hS_eq σ hσ] at hnorm; simpa using hnorm -+ have hSumm σ (hσ : 1 < σ) : Summable (rt σ ·) := by -+ simpa [rt, w, y] using limiting_fourier_variant_lim1_aux ψCS hpos hf hψpos σ hσ -+ have hSumm_1 : Summable (rt 1 ·) := by -+ let σ_seq : ℕ → ℝ := fun k ↦ 1 + 1 / ((k : ℝ) + 1) -+ have hσ_gt k : 1 < σ_seq k := by simp only [σ_seq, lt_add_iff_pos_right, one_div]; positivity -+ have h_tendsto : Tendsto σ_seq atTop (𝓝[>] 1) := by -+ rw [tendsto_nhdsWithin_iff] -+ refine ⟨?_, by filter_upwards with k; exact hσ_gt k⟩ -+ have : Tendsto (fun k : ℕ ↦ 1 / ((k : ℝ) + 1)) atTop (𝓝 0) := by -+ simp only [one_div]; exact (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds).inv_tendsto_atTop -+ simpa [σ_seq] using tendsto_const_nhds.add this -+ have h_ptwise n : Tendsto (fun k ↦ rt (σ_seq k) n) atTop (𝓝 (rt 1 n)) := by -+ simp only [rt]; split_ifs with hn; · exact tendsto_const_nhds -+ refine ((tendsto_const_nhds.rpow (tendsto_nhdsWithin_iff.mp h_tendsto).1 (Or.inl ?_)).inv₀ -+ (by simp [hn])).const_mul (f n) |>.mul_const (w n) -+ exact (Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)).ne' -+ obtain ⟨C, hC⟩ := Asymptotics.isBigO_iff.mp (hT_bdd.comp_tendsto h_tendsto) -+ refine summable_of_sum_range_le (c := C) (rt_nn 1) fun m ↦ le_of_tendsto (tendsto_finsetSum _ -+ fun i _ ↦ h_ptwise i) ?_ -+ filter_upwards [h_tendsto.eventually self_mem_nhdsWithin, hC] with k hk hCk -+ calc ∑ i ∈ Finset.range m, rt (σ_seq k) i -+ ≤ ∑' n, rt (σ_seq k) n := (hSumm _ hk).sum_le_tsum _ fun n _ ↦ rt_nn _ n -+ _ ≤ |∑' n, rt (σ_seq k) n| := le_abs_self _ -+ _ ≤ C := by simpa using hCk -+ rw [show (fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x))) = -+ Complex.ofRealCLM ∘ (rt 1 ·) from ?_] -+ · exact hSumm_1.map Complex.ofRealCLM Complex.ofRealCLM.continuous -+ ext n; simp only [rt, Real.rpow_one, one_div, w, y, Function.comp_apply] -+ split_ifs with hn; · simp [hn] -+ have him0 : (𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x))).im = 0 := (hψpos _).2 -+ have hre_eq : 𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x)) = -+ Complex.ofReal ((𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x))).re) := by -+ rw [← Complex.re_add_im (𝓕 ψCS.toFun _), him0]; simp -+ conv_lhs => rw [show ψ = ψCS.toFun from rfl, hre_eq] -+ simp only [Complex.ofRealCLM_apply, Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_natCast] -+ -+lemma auto_cheby_short_interval_bound (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (B : ℝ) (ψ : ℝ → ℂ) (hψSmooth : ContDiff ℝ ∞ ψ) (hψCompact : HasCompactSupport ψ) -+ (hψpos : ∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) (hψ0 : 0 < (𝓕 ψ 0).re) -+ (hB_bound : ∀ x ≥ 1, ‖∑' n, f n / n * 𝓕 ψ (1 / (2 * Real.pi) * Real.log (n / x))‖ ≤ B) : -+ ∃ (ε : ℝ) (C : ℝ), ε > 0 ∧ ε < 1 ∧ C > 0 ∧ ∀ x ≥ 1, -+ ∑' n, (f n) * (Set.indicator (Set.Ioc ((1 - ε) * x) x) (fun _ ↦ 1) (n : ℝ)) ≤ C * x := by -+ have hF : Continuous (𝓕 ψ) := VectorFourier.fourierIntegral_continuous Real.continuous_fourierChar -+ (by continuity) (hψSmooth.continuous.integrable_of_hasCompactSupport hψCompact) -+ have hg : Continuous fun y ↦ (𝓕 ψ y).re := Complex.continuous_re.comp hF -+ obtain ⟨δ, hδpos, hball⟩ := Metric.mem_nhds_iff.1 <| -+ hg.continuousAt.preimage_mem_nhds (IsOpen.mem_nhds isOpen_Ioi (half_lt_self hψ0)) -+ let c := (𝓕 ψ 0).re / 2 -+ have hcpos : 0 < c := by dsimp only [c]; linarith -+ have h_psi_ge_c : ∀ y, |y| < δ → c ≤ (𝓕 ψ y).re := fun y hy ↦ (hball (mem_ball_zero_iff.mpr hy)).le -+ let ε := 1 - Real.exp (-2 * π * δ) -+ have hε : 0 < ε ∧ ε < 1 := by -+ have h1 : Real.exp (-2 * π * δ) < 1 := Real.exp_lt_one_iff.mpr (by nlinarith [Real.pi_pos]) -+ exact ⟨by simp only [ε]; linarith, by simp only [ε]; linarith [Real.exp_pos (-2 * π * δ)]⟩ -+ have hB_nonneg : 0 ≤ B := (norm_nonneg _).trans (hB_bound 1 le_rfl) -+ refine ⟨ε, B / c + 1, hε.1, hε.2, by positivity, fun x hx ↦ ?_⟩ -+ have h_summable : Summable fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x)) := -+ auto_cheby_fourier_summable hpos hf hG hG' ψ hψSmooth hψCompact hψpos x hx -+ have hx_pos : 0 < x := by linarith -+ have h_sum_lower : c / x * ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ) -+ ≤ ∑' n, f n / n * (𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re := by -+ rw [← tsum_mul_left] -+ refine Summable.tsum_le_tsum (fun n ↦ ?_) ?_ ?_ -+ · by_cases hn : (n : ℝ) ∈ Set.Ioc ((1 - ε) * x) x -+ · rw [Set.indicator_of_mem hn, Pi.one_apply, mul_one] -+ have hn_pos : 0 < (n : ℝ) := by nlinarith [hn.1, hε.2] -+ let y := (1 / (2 * π)) * Real.log (n / x) -+ have h_arg_small : |y| < δ := by -+ have h2pi : 0 < 2 * π := by linarith [Real.pi_pos] -+ simp only [y, abs_mul, abs_div, abs_one, abs_of_pos h2pi] -+ field_simp [ne_of_gt h2pi]; rw [mul_comm, abs_lt] -+ have h_log_lower : -2 * π * δ < Real.log (n / x) := by -+ rw [← Real.log_exp (-2 * π * δ), Real.log_lt_log_iff (Real.exp_pos _) (by positivity)] -+ have : Real.exp (-2 * π * δ) = 1 - ε := by simp only [ε]; ring -+ rw [this]; field_simp; exact hn.1 -+ have h_log_upper : Real.log (n / x) ≤ 0 := -+ Real.log_nonpos (by positivity) (div_le_one_of_le₀ hn.2 hx_pos.le) -+ constructor <;> nlinarith [Real.pi_pos] -+ have h1 : x⁻¹ ≤ (n : ℝ)⁻¹ := by rw [inv_le_inv₀ hx_pos hn_pos]; exact hn.2 -+ have h2 : c ≤ (𝓕 ψ y).re := h_psi_ge_c y h_arg_small -+ have hfn : 0 ≤ f n := hpos n -+ have hre : 0 ≤ (𝓕 ψ y).re := (hψpos y).1 -+ have hn_inv : 0 ≤ (n : ℝ)⁻¹ := inv_nonneg.mpr hn_pos.le -+ calc c / x * f n = c * x⁻¹ * f n := by rw [div_eq_mul_inv] -+ _ ≤ c * (n : ℝ)⁻¹ * f n := by gcongr -+ _ ≤ (𝓕 ψ y).re * (n : ℝ)⁻¹ * f n := by gcongr -+ _ = (n : ℝ)⁻¹ * (𝓕 ψ y).re * f n := by ring -+ _ = f n / n * (𝓕 ψ y).re := by ring -+ · rw [Set.indicator_of_notMem hn, mul_zero, mul_zero] -+ exact mul_nonneg (div_nonneg (hpos n) (Nat.cast_nonneg n)) (hψpos _).1 -+ · refine summable_of_hasFiniteSupport <| (Set.finite_le_nat ⌊x⌋₊).subset fun n hn ↦ ?_ -+ simp only [Function.mem_support, ne_eq, mul_eq_zero, not_or, Set.indicator_apply_ne_zero] at hn -+ exact Nat.le_floor hn.2.2.1.2 -+ · rw [← Complex.summable_ofReal]; convert h_summable using 1; ext n -+ rw [Complex.ofReal_mul, Complex.ofReal_div] -+ norm_cast -+ rw [Complex.ofReal_mul] -+ congr 1 -+ apply Complex.ext -+ · simp only [Complex.ofReal_re] -+ · simp only [Complex.ofReal_im]; exact (hψpos _).2.symm -+ have h_real_eq : ∑' n, f n / n * (𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re = -+ (∑' n, (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re := by -+ rw [Complex.re_tsum h_summable]; congr with n -+ rw [Complex.mul_re]; norm_cast; simp only [zero_mul, sub_zero] -+ calc ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ) -+ = x / c * (c / x * ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ)) := by -+ field_simp [ne_of_gt hcpos, ne_of_gt hx_pos] -+ _ ≤ x / c * B := by -+ gcongr; rw [h_real_eq] at h_sum_lower -+ exact h_sum_lower.trans ((Complex.re_le_norm _).trans (hB_bound x hx)) -+ _ = (B / c) * x := by field_simp [ne_of_gt hcpos] -+ _ ≤ (B / c + 1) * x := by nlinarith -+ -+lemma auto_cheby_bootstrap_induction (hpos : 0 ≤ f) -+ (h_short : ∃ (ε : ℝ) (C : ℝ), ε > 0 ∧ ε < 1 ∧ C > 0 ∧ ∀ x ≥ 1, -+ ∑' n, (f n) * (Set.indicator (Set.Ioc ((1 - ε) * x) x) (fun _ ↦ 1) (n : ℝ)) ≤ C * x) : -+ cheby f := by -+ obtain ⟨ε, C₀, hε, hε1, hC₀, h_bound⟩ := h_short -+ let C := C₀ / ε + f 0 + 1 -+ have hf0 : (0 : ℝ) ≤ f 0 := hpos 0 -+ have hdiv : 0 ≤ C₀ / ε := div_nonneg hC₀.le hε.le -+ have hC : 0 ≤ C := by linarith -+ refine ⟨C, fun n ↦ ?_⟩ -+ induction n using Nat.strong_induction_on with | h n ih => -+ rcases lt_or_ge n 2 with hn | hn -+ · interval_cases n -+ · simp [cumsum] -+ · simp only [cumsum, Finset.sum_range_one, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hf0, -+ Nat.cast_one, mul_one, C] -+ linarith -+ let x := (n : ℝ) - 1 -+ have hx : x ≥ 1 := by simp only [x, ge_iff_le, le_sub_iff_add_le]; norm_cast -+ let m := ⌊(1 - ε) * x⌋₊ + 1 -+ have hm_lt : m < n := by -+ simp only [m, x] -+ have h1 : (1 - ε) * (n - 1 : ℝ) < (n - 1 : ℕ) := by -+ calc (1 - ε) * (↑n - 1) < 1 * (↑n - 1) := by gcongr; linarith -+ _ = ↑n - 1 := by ring -+ _ = ↑(n - 1) := by simp [Nat.cast_sub (by omega : 1 ≤ n)] -+ have h2 : ⌊(1 - ε) * (n - 1 : ℝ)⌋₊ < n - 1 := -+ (Nat.floor_lt (mul_nonneg (by linarith) (by linarith : (0 : ℝ) ≤ n - 1))).mpr h1 -+ omega -+ have hm_gt : (m : ℝ) > (1 - ε) * x := by -+ simp only [m, Nat.cast_add, Nat.cast_one, gt_iff_lt] -+ exact Nat.lt_floor_add_one ((1 - ε) * x) -+ have h_decomp : cumsum (fun k ↦ ‖(f k : ℂ)‖) n = cumsum (fun k ↦ ‖(f k : ℂ)‖) m + ∑ k ∈ Finset.Ico m n, f k := by -+ simp only [cumsum, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hpos _), -+ Finset.sum_range_add_sum_Ico _ (by omega : m ≤ n)] -+ have h_Ico : ∑ k ∈ Finset.Ico m n, f k ≤ C₀ * x := by -+ calc ∑ k ∈ Finset.Ico m n, f k -+ = ∑ k ∈ Finset.Ico m n, f k * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (k : ℝ) := by -+ refine Finset.sum_congr rfl fun k hk ↦ ?_ -+ have ⟨hkm, hkn⟩ := Finset.mem_Ico.mp hk -+ have hk_gt : (k : ℝ) > (1 - ε) * x := by linarith [hm_gt, (Nat.cast_le (α := ℝ)).mpr hkm] -+ have hk_le : (k : ℝ) ≤ x := by -+ have h1 : k ≤ n - 1 := Nat.le_pred_of_lt hkn -+ have h2 : (k : ℝ) ≤ (n - 1 : ℕ) := by exact_mod_cast h1 -+ simp only [Nat.cast_sub (by omega : 1 ≤ n), Nat.cast_one, x] at h2 ⊢; exact h2 -+ simp only [Set.indicator_of_mem (Set.mem_Ioc.mpr ⟨hk_gt, hk_le⟩), Pi.one_apply, mul_one] -+ _ ≤ ∑' k, f k * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (k : ℝ) := by -+ refine Summable.sum_le_tsum _ (fun k _ ↦ mul_nonneg (hpos k) (Set.indicator_nonneg (by simp) _)) ?_ -+ refine summable_of_hasFiniteSupport <| (Set.finite_le_nat ⌊x⌋₊).subset fun k hk ↦ ?_ -+ simp only [Function.mem_support, ne_eq, mul_eq_zero, not_or, Set.indicator_apply_ne_zero] at hk -+ exact Nat.le_floor hk.2.1.2 -+ _ ≤ C₀ * x := h_bound x hx -+ have hm_le : (m : ℝ) ≤ (1 - ε) * x + 1 := by -+ have hpos' : 0 ≤ (1 - ε) * x := mul_nonneg (by linarith) (by linarith : (0 : ℝ) ≤ x) -+ simp only [m, Nat.cast_add, Nat.cast_one] -+ linarith [Nat.floor_le hpos'] -+ have hnorm : ∀ k, ‖(f k : ℂ)‖ = f k := fun k ↦ by simp [abs_of_nonneg (hpos k)] -+ simp only [hnorm] at h_decomp ih ⊢ -+ calc cumsum f n = cumsum f m + ∑ k ∈ Finset.Ico m n, f k := h_decomp -+ _ ≤ C * m + C₀ * x := by linarith [ih m hm_lt, h_Ico] -+ _ ≤ C * ((1 - ε) * x + 1) + C₀ * x := by nlinarith [hC] -+ _ = (C * (1 - ε) + C₀) * x + C := by ring -+ _ ≤ C * x + C := by -+ have : C₀ ≤ C * ε := by -+ calc C₀ = (C₀ / ε) * ε := by field_simp [ne_of_gt hε] -+ _ ≤ (C₀ / ε + f 0 + 1) * ε := by gcongr; linarith [hpos 0] -+ _ = C * ε := by simp only [C] -+ nlinarith [hε, hε1, hx] -+ _ ≤ C * n := by simp only [x]; ring_nf; linarith [hC] -+ -+lemma auto_cheby (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : cheby f := by -+ obtain ⟨ψ_fun, hψSmooth, hψCompact, hψpos, hψ0⟩ := auto_cheby_exists_smooth_nonneg_fourier_kernel -+ obtain ⟨B, hB⟩ := crude_upper_bound hpos hG hG' hf ⟨ψ_fun, hψSmooth.of_le ENat.LEInfty.out, hψCompact⟩ hψpos -+ exact auto_cheby_bootstrap_induction hpos <| auto_cheby_short_interval_bound hpos hf hG hG' B ψ_fun -+ hψSmooth hψCompact hψpos hψ0 fun x hx ↦ hB x (by linarith) -+ -+theorem WienerIkeharaTheorem'' (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := -+ WienerIkeharaTheorem' hpos hf (auto_cheby (f := f) (A := A) (G := G) hpos hf hG hG') hG hG' -+ -+end auto_cheby -+ -+theorem WeakPNT_character -+ {q a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) {s : ℂ} (hs : 1 < s.re) : -+ LSeries (fun n ↦ if n % q = a then Λ n else 0) s = -+ - (∑' χ : DirichletCharacter ℂ q, -+ ((starRingEnd ℂ) (χ a) * ((deriv (LSeries (fun n:ℕ ↦ χ n)) s)) / -+ (LSeries (fun n:ℕ ↦ χ n) s))) / (Nat.totient q : ℂ) := by -+ have : NeZero q := ⟨by omega⟩ -+ convert vonMangoldt.LSeries_residueClass_eq ((ZMod.isUnit_iff_coprime a q).mpr ha) hs using 1 -+ · congr with n -+ have : n % q = a ↔ (n : ZMod q) = a := by -+ rw [ZMod.natCast_eq_natCast_iff', Nat.mod_eq_of_lt ha'] -+ simp [this] -+ split_ifs <;> simp [*] -+ · rw [div_eq_inv_mul, neg_mul_comm, tsum_fintype] -+ congr 3 with χ -+ rw [DirichletCharacter.deriv_LFunction_eq_deriv_LSeries _ hs, -+ DirichletCharacter.LFunction_eq_LSeries _ hs, mul_div] -+ congr 2 -+ rw [starRingEnd_apply, MulChar.star_apply', MulChar.inv_apply_eq_inv', -+ ← ZMod.coe_unitOfCoprime a ha, ZMod.inv_coe_unit, map_units_inv] -+ -+theorem WeakPNT_AP_prelim {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) : -+ ∃ G: ℂ → ℂ, (ContinuousOn G {s | 1 ≤ s.re}) ∧ -+ (Set.EqOn G (fun s ↦ LSeries (fun n ↦ if n % q = a then Λ n else 0) s - 1 / -+ ((Nat.totient q) * (s - 1))) {s | 1 < s.re}) := by -+ have : NeZero q := NeZero.of_pos hq -+ have hG : ∃ G : ℂ → ℂ, ContinuousOn G {s | 1 ≤ s.re} ∧ Set.EqOn G -+ (fun s ↦ LSeries (fun n ↦ if (n : ZMod q) = a then Λ n else 0) s - (q.totient : ℂ)⁻¹ / (s - 1)) {s | 1 < s.re} := by -+ use vonMangoldt.LFunctionResidueClassAux (a : ZMod q), vonMangoldt.continuousOn_LFunctionResidueClassAux (q := q) (a := a) -+ have := vonMangoldt.eqOn_LFunctionResidueClassAux ((ZMod.isUnit_iff_coprime a q).mpr ha) -+ convert this using 6; split <;> simp_all -+ convert hG using 6 -+ · simp [ZMod.natCast_eq_natCast_iff', Nat.mod_eq_of_lt ha'] -+ · rw [inv_eq_one_div, div_div] -+ -+lemma summable_vonMangoldt_div_rpow {s : ℝ} (hs : 1 < s) : Summable (fun n ↦ Λ n / n ^ s) := by -+ have h_log_bound : ∀ n : ℕ, (Λ n : ℝ) ≤ Real.log n := fun n ↦ vonMangoldt_le_log -+ suffices h_log_sum : Summable fun n : ℕ ↦ Real.log n / (n : ℝ) ^ s by -+ exact .of_nonneg_of_le (fun n ↦ div_nonneg vonMangoldt_nonneg (by positivity)) -+ (fun n ↦ div_le_div_of_nonneg_right (h_log_bound n) (by positivity)) h_log_sum -+ have h_log_le_n_eps : ∀ ε > 0, ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n / (n : ℝ) ^ s ≤ C * (n : ℝ) ^ (ε - s) := by -+ intro ε hε_pos -+ obtain ⟨C, hC_pos, hC⟩ : ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n ≤ C * (n : ℝ) ^ ε := by -+ refine ⟨1 / ε, by positivity, fun n hn ↦ ?_⟩ -+ have := log_le_sub_one_of_pos (by positivity : 0 < (n : ℝ) ^ ε) -+ rw [log_rpow (by positivity)] at this -+ nlinarith [rpow_pos_of_pos (by positivity : 0 < (n : ℝ)) ε, mul_div_cancel₀ 1 hε_pos.ne'] -+ refine ⟨C, hC_pos, fun n hn ↦ ?_⟩ -+ rw [rpow_sub (by positivity)] -+ exact le_trans (div_le_div_of_nonneg_right (hC n hn) (by positivity)) (by rw [div_eq_mul_inv]; ring_nf; norm_num) -+ obtain ⟨C, _, hC⟩ : ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n / (n : ℝ) ^ s ≤ C * (n : ℝ) ^ ((s - 1) / 2 - s) := -+ h_log_le_n_eps ((s - 1) / 2) (by linarith) -+ rw [← summable_nat_add_iff 2] -+ exact Summable.of_nonneg_of_le (fun n ↦ div_nonneg (log_nonneg (by norm_cast; omega)) -+ (rpow_nonneg (by positivity) _)) (fun n ↦ hC _ (by omega)) (Summable.mul_left _ <| by -+ simpa using summable_nat_add_iff 2 |>.2 <| summable_nat_rpow.2 <| by linarith) -+ -+theorem WeakPNT_AP {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : a.Coprime q) (ha' : a < q) : -+ Tendsto (fun N ↦ cumsum (fun n ↦ if n % q = a then Λ n else 0) N / N) atTop (𝓝 (1 / q.totient)) := by -+ have h_summable : ∀ s : ℝ, 1 < s → Summable (fun n ↦ (if n % q = a then Λ n else 0) / n ^ s) := by -+ intro s hs -+ refine .of_nonneg_of_le (fun n ↦ ?_) (fun n ↦ ?_) (summable_vonMangoldt_div_rpow hs) -+ · split_ifs <;> positivity -+ · split_ifs <;> norm_num; exact div_nonneg vonMangoldt_nonneg (by positivity) -+ obtain ⟨G, hG₁, hG₂⟩ := WeakPNT_AP_prelim hq ha ha' -+ convert WienerIkeharaTheorem'' _ _ _ _ using 1 -+ · use G -+ · intro n -+ simp_all only [ge_iff_le, one_div, mul_inv_rev, Pi.ofNat_apply] -+ split -+ next h => subst h; simp_all only [vonMangoldt_nonneg] -+ next h => simp_all only [le_refl] -+ · intro σ' hσ' -+ specialize h_summable σ' hσ' -+ simp_all only [ge_iff_le, one_div, mul_inv_rev] -+ convert h_summable using 1 -+ ext -+ simp only [nterm, norm_real, norm_eq_abs] -+ ring_nf -+ split_ifs <;> simp [*, mul_comm] -+ · assumption -+ · convert hG₂ using 3 -+ · exact tsum_congr fun n ↦ by cases n <;> aesop -+ · norm_num [div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm] -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/ZetaBounds.lean b/PrimeNumberTheoremAnd/Erdos970/ZetaBounds.lean -new file mode 100644 -index 0000000..84113af ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/ZetaBounds.lean -@@ -0,0 +1,2982 @@ -+import Batteries.Tactic.Lemma -+import Mathlib.MeasureTheory.Function.Floor -+import Mathlib.MeasureTheory.Order.Group.Lattice -+import Mathlib.NumberTheory.Harmonic.Bounds -+import Mathlib.NumberTheory.LSeries.Nonvanishing -+import PrimeNumberTheoremAnd.Erdos970.Auxiliary -+import PrimeNumberTheoremAnd.Erdos970.Fourier -+import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic -+import PrimeNumberTheoremAnd.Erdos970.ResidueCalcOnRectangles -+import PrimeNumberTheoremAnd.Erdos970.EulerMaclaurin -+ -+namespace Erdos970 -+ -+ -+open _root_.Complex Topology Filter Interval _root_.Set Asymptotics -+ -+lemma div_cpow_eq_cpow_neg (a x s : ℂ) : a / x ^ s = a * x ^ (-s) := by -+ rw [div_eq_mul_inv, cpow_neg] -+ -+lemma one_div_cpow_eq_cpow_neg (x s : ℂ) : 1 / x ^ s = x ^ (-s) := by -+ convert div_cpow_eq_cpow_neg 1 x s using 1; simp -+ -+lemma div_rpow_eq_rpow_neg (a x s : ℝ) (hx : 0 ≤ x) : a / x ^ s = a * x ^ (-s) := by -+ rw [div_eq_mul_inv, Real.rpow_neg hx] -+ -+lemma div_rpow_neg_eq_rpow_div {x y s : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) : -+ x ^ (-s) / y ^ (-s) = (y / x) ^ s := by -+ rw [div_eq_mul_inv, Real.rpow_neg hx, Real.rpow_neg hy, Real.div_rpow hy hx]; field_simp -+ -+lemma div_rpow_eq_rpow_div_neg {x y s : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) : -+ x ^ s / y ^ s = (y / x) ^ (-s) := by -+ convert div_rpow_neg_eq_rpow_div (s := -s) hx hy using 1; simp only [neg_neg] -+ -+local notation (name := riemannzeta) "ζ" => riemannZeta -+local notation (name := derivriemannzeta) "ζ'" => deriv riemannZeta -+ -+theorem ResidueOfTendsTo {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} -+ (hU : U ∈ 𝓝 p) -+ (hf : HolomorphicOn f (U \ {p})) -+ {A : ℂ} -+ (h_limit : Tendsto (fun s ↦ (s - p) * f s) (𝓝[≠] p) (𝓝 A)) : -+ ∃ V ∈ 𝓝 p, -+ BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (V \ {p})) := by -+ -+ have h_event : ∀ᶠ s in 𝓝[≠] p, ‖(s - p) * f s - A‖ < 1 := by -+ simp_rw [← dist_eq_norm_sub] -+ exact h_limit.eventually (Metric.ball_mem_nhds _ (by norm_num)) -+ have h_event_nhds : -+ ∀ᶠ s in 𝓝 p, s ≠ p → ‖(s - p) * f s - A‖ < 1 := by -+ exact (eventually_nhdsWithin_iff).1 h_event -+ rcases (eventually_nhds_iff.1 h_event_nhds) with ⟨V₀, hV₀_mem, hV₀_prop⟩ -+ have h_bound : -+ ∀ s, s ∈ V₀ \ {p} → ‖(s - p) * f s‖ ≤ ‖A‖ + 1 := by -+ intro s hs -+ rcases hs with ⟨hV₀, hsne⟩ -+ calc ‖(s - p) * f s‖ = ‖((s - p) * f s - A) + A‖ := by -+ ring_nf -+ _ ≤ ‖(s - p) * f s - A‖ + ‖A‖ := norm_add_le ((s - p) * f s - A) A -+ _ ≤ 1 + ‖A‖ := add_le_add_left (le_of_lt (hV₀_mem s hV₀ hsne)) ‖A‖ -+ _ = ‖A‖ + 1 := add_comm 1 ‖A‖ -+ have h_bdd : -+ BddAbove (norm ∘ (fun s ↦ (s - p) * f s) '' (V₀ \ {p})) := by -+ refine ⟨‖A‖ + 1, ?_⟩ -+ rintro _ ⟨s, hs, rfl⟩ -+ exact h_bound s hs -+ -+ set W : Set ℂ := V₀ ∩ U with hW_def -+ have hW_mem : (W : Set ℂ) ∈ 𝓝 p := inter_mem (IsOpen.mem_nhds hV₀_prop.1 hV₀_prop.2) hU -+ have h_subset_V₀ : (W \ {p}) ⊆ (V₀ \ {p}) := by -+ intro z hz; exact ⟨hz.1.1, hz.2⟩ -+ have h_prod_holo : HolomorphicOn (fun z ↦ (z - p) * f z) (W \ {p}) := by -+ have h_id : HolomorphicOn (fun z : ℂ ↦ z - p) (W \ {p}) := -+ Differentiable.differentiableOn (Differentiable.sub_const differentiable_fun_id p) -+ have hfW : HolomorphicOn f (W \ {p}) := by -+ apply hf.mono -+ exact Set.sdiff_subset_sdiff_left inter_subset_right -+ simpa using! h_id.mul hfW -+ have h_bdd_W : BddAbove (norm ∘ (fun s ↦ (s - p) * f s) '' (W \ {p})) := -+ h_bdd.mono (image_mono h_subset_V₀) -+ -+ obtain ⟨g, hg_holo, hg_eq⟩ := -+ existsDifferentiableOn_of_bddAbove hW_mem h_prod_holo h_bdd_W -+ have h_event_eq : -+ (fun z ↦ g z) =ᶠ[𝓝[≠] p] fun z ↦ (z - p) * f z := by -+ have hW_diff_mem : (W \ {p} : Set ℂ) ∈ 𝓝[≠] p := -+ sdiff_mem_nhdsWithin_compl hW_mem {p} -+ exact (hg_eq.eventuallyEq_of_mem hW_diff_mem).symm -+ have h_tendsto_gA : Tendsto g (𝓝[≠] p) (𝓝 A) := -+ h_limit.congr' (id (EventuallyEq.symm h_event_eq)) -+ have hpW : p ∈ W := by -+ exact mem_of_mem_nhds hW_mem -+ have h_cont_g : ContinuousAt g p := by -+ apply (hg_holo.continuousOn.continuousWithinAt hpW).continuousAt hW_mem -+ have h_tendsto_gp : Tendsto g (𝓝[≠] p) (𝓝 (g p)) := -+ h_cont_g.tendsto.mono_left inf_le_left -+ have g_p_eq : g p = A := -+ tendsto_nhds_unique' (NormedField.nhdsNE_neBot p) h_tendsto_gp h_tendsto_gA -+ let q : ℂ → ℂ := fun z ↦ (g z - A) / (z - p) -+ have h_deriv : HasDerivAt g (deriv g p) p := by -+ exact DifferentiableOn.hasDerivAt hg_holo hW_mem -+ have h_q_limit : Tendsto q (𝓝[≠] p) (𝓝 (deriv g p)) := by -+ rw [hasDerivAt_iff_tendsto_slope] at h_deriv -+ unfold slope at h_deriv -+ simp only [vsub_eq_sub, smul_eq_mul, inv_mul_eq_div, g_p_eq] at h_deriv -+ exact h_deriv -+ have h_event_q : ∀ᶠ z in 𝓝[≠] p, ‖q z - deriv g p‖ < 1 := by -+ simp_rw [← dist_eq_norm_sub] -+ exact h_q_limit.eventually (Metric.ball_mem_nhds _ (by norm_num)) -+ have h_event_q_nhds : ∀ᶠ z in 𝓝 p, z ≠ p → ‖q z - deriv g p‖ < 1 := by -+ simpa using (eventually_nhdsWithin_iff).1 h_event_q -+ rcases (eventually_nhds_iff.1 h_event_q_nhds) with -+ ⟨V₁, hV₁_mem, hV₁_prop⟩ -+ have h_q_bound : -+ ∀ z, z ∈ V₁ \ {p} → ‖q z‖ ≤ ‖deriv g p‖ + 1 := by -+ intro z hz -+ rcases hz with ⟨hV₁, hz_ne⟩ -+ calc ‖q z‖ = ‖(q z - deriv g p) + (deriv g p)‖ := by -+ ring_nf -+ _ ≤ ‖q z - deriv g p‖ + ‖deriv g p‖ := norm_add_le (q z - deriv g p) (deriv g p) -+ _ ≤ 1 + ‖deriv g p‖ := add_le_add_left (le_of_lt (hV₁_mem z hV₁ hz_ne)) ‖deriv g p‖ -+ _ = ‖deriv g p‖ + 1 := add_comm 1 ‖deriv g p‖ -+ -+ have h_eq_diff : -+ EqOn (fun z ↦ f z - A * (z - p)⁻¹) q (W \ {p}) := by -+ intro z hz -+ simp only -+ have hz_ne : (z - p) ≠ 0 := sub_ne_zero.mpr hz.2 -+ have hgz : g z = (z - p) * f z := by -+ exact id (EqOn.symm hg_eq) hz -+ simp only [hgz, q] -+ field_simp -+ apply IsBigO_to_BddAbove -+ rw [isBigO_iff] -+ use ‖deriv g p‖ + 1 -+ apply eventually_nhdsWithin_iff.mpr -+ filter_upwards [IsOpen.mem_nhds hV₁_prop.1 hV₁_prop.2, hW_mem] with z hV₁ hW z_ne_p -+ specialize h_eq_diff ⟨ hW, z_ne_p⟩ -+ simp only [Pi.sub_apply, Pi.one_apply, one_mem, CStarRing.norm_of_mem_unitary, -+ mul_one] at h_eq_diff ⊢ -+ rw [h_eq_diff] -+ exact h_q_bound _ ⟨hV₁, z_ne_p⟩ -+ -+theorem analyticAt_riemannZeta {s : ℂ} (s_ne_one : s ≠ 1) : -+ AnalyticAt ℂ riemannZeta s := by -+ apply Complex.analyticAt_iff_eventually_differentiableAt.mpr -+ filter_upwards [eventually_ne_nhds s_ne_one] with z hz using differentiableAt_riemannZeta hz -+ -+theorem differentiableAt_deriv_riemannZeta {s : ℂ} (s_ne_one : s ≠ 1) : -+ DifferentiableAt ℂ ζ' s := by -+ exact (analyticAt_riemannZeta s_ne_one).deriv.differentiableAt -+ -+theorem riemannZetaResidue : -+ ∃ U ∈ 𝓝 1, BddAbove (norm ∘ (ζ - (fun s ↦ (s - 1)⁻¹)) '' (U \ {1})) := by -+ have zeta_holc : HolomorphicOn ζ (univ \ {1}) := by -+ intro y hy -+ exact DifferentiableAt.differentiableWithinAt <| differentiableAt_riemannZeta hy.2 -+ convert ResidueOfTendsTo univ_mem zeta_holc riemannZeta_residue_one using 6 -+ simp -+ -+theorem deriv_eqOn_of_eqOn_punctured (f g : ℂ → ℂ) (U : Set ℂ) (p : ℂ) -+ (hU_open : IsOpen U) -+ (h_eq : EqOn f g (U \ {p})) : -+ EqOn (deriv f) (deriv g) (U \ {p}) := by -+ intro x hx -+ apply EventuallyEq.deriv_eq -+ filter_upwards [IsOpen.mem_nhds (hU_open.sdiff isClosed_singleton) hx] with t ht using h_eq ht -+ -+theorem analytic_deriv_bounded_near_point -+ (f : ℂ → ℂ) {U : Set ℂ} {p : ℂ} (hU : IsOpen U) (hp : p ∈ U) (hf : HolomorphicOn f U) : -+ (deriv f) =O[𝓝[≠] p] (1 : ℂ → ℂ) := by -+ have U_in_filter : U ∈ 𝓝 p := by -+ exact IsOpen.mem_nhds hU hp -+ have T := (analyticOn_iff_differentiableOn hU).mpr hf -+ have T2 : ContDiffOn ℂ 1 f U := -+ DifferentiableOn.contDiffOn hf hU -+ have T3 : ContinuousOn (fun x ↦ ((deriv f) x)) U := by -+ apply T2.continuousOn_deriv_of_isOpen hU (by simp) -+ have T4 := T3.continuousAt U_in_filter -+ have T5 : (deriv f) =O[𝓝 p] (1 : ℂ → ℂ) := -+ T4.norm.isBoundedUnder_le.isBigO_one ℂ -+ exact Asymptotics.IsBigO.mono T5 inf_le_left -+ -+theorem derivative_const_plus_product {g : ℂ → ℂ} (A p x : ℂ) (hg : DifferentiableAt ℂ g x) : -+ deriv ((fun _ ↦ A) + g * fun s ↦ s - p) x = deriv g x * (x - p) + g x := by -+ rw [deriv_add (by fun_prop) (by fun_prop), deriv_const, deriv_mul hg (by fun_prop)] -+ simp -+ -+lemma deriv_inv_sub {x p : ℂ} (hp : x ≠ p) : -+ deriv (fun z => (z - p)⁻¹) x = -((x - p) ^ 2)⁻¹ := by -+ rw [deriv_fun_inv'' (by fun_prop) (by grind)] -+ simp -+ field -+ -+theorem deriv_f_minus_A_inv_sub_clean (f : ℂ → ℂ) (A x p : ℂ) -+ (hf : DifferentiableAt ℂ f x) (hp : x ≠ p) : -+ deriv (f - (fun z ↦ A * (z - p)⁻¹)) x = deriv f x + A * ((x - p) ^ 2)⁻¹ := by -+ have h1 : DifferentiableAt ℂ (fun z => (z - p)⁻¹) x := by -+ fun_prop (disch := grind) -+ rw [deriv_sub hf (h1.const_mul A), deriv_const_mul A h1, deriv_inv_sub hp] -+ ring -+ -+theorem nonZeroOfBddAbove {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} -+ (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} (A_ne_zero : A ≠ 0) -+ (f_near_p : BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (U \ {p}))) : -+ ∃ V ∈ 𝓝 p, IsOpen V ∧ ∀ s ∈ V \ {p}, f s ≠ 0 := by -+ -+ have h_decomp : ∀ s, f s = (f s - A * (s - p)⁻¹) + A * (s - p)⁻¹ := by -+ intro s -+ ring -+ -+ obtain ⟨M, hM⟩ := f_near_p -+ -+ have A_norm_pos : 0 < ‖A‖ := norm_pos_iff.mpr A_ne_zero -+ -+ let δ := ‖A‖ / (‖M‖ + 1) -+ have δ_pos : 0 < δ := by -+ refine div_pos A_norm_pos (add_pos_of_nonneg_of_pos (norm_nonneg M) one_pos) -+ -+ obtain ⟨V, hV_open, hV_mem, hV_sub⟩ : ∃ V, IsOpen V ∧ p ∈ V ∧ V ⊆ U ∩ Metric.ball p δ := by -+ -+ obtain ⟨W, hW_sub, hW_open, hW_mem⟩ := mem_nhds_iff.mp U_in_nhds -+ let V := W ∩ Metric.ball p δ -+ have VNp : V ∈ 𝓝 p := (𝓝 p).inter_mem (IsOpen.mem_nhds hW_open hW_mem) -+ (Metric.ball_mem_nhds p δ_pos) -+ exact ⟨V, IsOpen.inter hW_open Metric.isOpen_ball, mem_of_mem_nhds VNp, -+ inter_subset_inter_left _ hW_sub⟩ -+ use V, mem_nhds_iff.mpr ⟨V, subset_refl V, hV_open, hV_mem⟩, hV_open -+ -+ intro s hs -+ have hs_in_U : s ∈ U := hV_sub hs.1 |>.1 -+ have hs_near_p : dist s p < δ := hV_sub hs.1 |>.2 -+ have hs_ne_p : s ≠ p := hs.2 -+ -+ rw [h_decomp s] -+ -+ have bound_first : ‖f s - A * (s - p)⁻¹‖ ≤ M := by -+ apply hM -+ exact ⟨s, ⟨hs_in_U, hs_ne_p⟩, rfl⟩ -+ -+ have large_second : ‖M‖ + 1 < ‖A * (s - p)⁻¹‖ := by -+ rw [norm_mul, norm_inv, ← div_eq_mul_inv] -+ rw [lt_div_iff₀ (norm_pos_iff.mpr (sub_ne_zero.mpr hs_ne_p))] -+ rw [mul_comm, ← lt_div_iff₀ (add_pos_of_nonneg_of_pos (norm_nonneg M) one_pos)] -+ rw [dist_eq_norm_sub] at hs_near_p -+ exact hs_near_p -+ -+ by_contra h_zero -+ -+ rw [add_eq_zero_iff_eq_neg] at h_zero -+ rw [h_zero, norm_neg] at bound_first -+ -+ have : ‖M‖ + 1 < ‖M‖ := (lt_of_lt_of_le (lt_of_lt_of_le large_second bound_first) -+ (Real.le_norm_self M)) -+ norm_num at this -+ -+theorem logDerivResidue' {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} -+ (U_is_open : IsOpen U) -+ (non_zero : ∀ x ∈ U \ {p}, f x ≠ 0) -+ (holc : HolomorphicOn f (U \ {p})) -+ (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} (A_ne_zero : A ≠ 0) -+ (f_near_p : BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (U \ {p}))) : -+ (deriv f * f⁻¹ + (fun s ↦ (s - p)⁻¹)) =O[𝓝[≠] p] (1 : ℂ → ℂ) := by -+ -+ have simpleHolo : HolomorphicOn (fun s ↦ A / (s - p)) (U \ {p}) := by -+ apply DifferentiableOn.mono (t := {p}ᶜ) -+ · apply DifferentiableOn.div -+ · exact differentiableOn_const _ -+ · exact DifferentiableOn.sub differentiableOn_id (differentiableOn_const _) -+ · exact fun x hx => by rw [sub_ne_zero]; exact hx -+ · rintro s ⟨_, hs⟩ ; exact hs -+ -+ have f_minus_pole_is_holomorphic : HolomorphicOn (f - (fun s ↦ A * (s - p)⁻¹)) (U \ {p}) := by -+ exact (DifferentiableOn.sub_iff_right holc).mpr simpleHolo -+ -+ let ⟨g, ⟨g_is_holomorphic, g_is_f_minus_pole⟩⟩ := existsDifferentiableOn_of_bddAbove -+ U_in_nhds f_minus_pole_is_holomorphic f_near_p -+ -+ let h := (fun _ ↦ A) + g * (fun (s : ℂ) ↦ (s - p)) -+ -+ have linear_is_holomorphic : HolomorphicOn (fun (s : ℂ ) ↦ (s - p)) U := by -+ exact DifferentiableOn.sub_const differentiableOn_id p -+ -+ have h_is_holomorphic : HolomorphicOn h U := by -+ have T := DifferentiableOn.mul g_is_holomorphic linear_is_holomorphic -+ exact DifferentiableOn.const_add A T -+ -+ have h_continuous : ContinuousOn h U := -+ by exact DifferentiableOn.continuousOn h_is_holomorphic -+ -+ have deriv_h_identity : ∀x ∈ (U \ {p}), (deriv h) x = f x + (deriv f x) * (x - p) := by -+ intro x x_in_u_not_p -+ have x_in_u : x ∈ U := by exact Set.mem_of_mem_sdiff x_in_u_not_p -+ have x_not_p : x ≠ p := by -+ exact ((Set.mem_sdiff x).mp x_in_u_not_p).2 -+ -+ have weird : U ∈ 𝓝 x := by -+ exact IsOpen.mem_nhds (U_is_open) (x_in_u) -+ -+ rw [derivative_const_plus_product, ← g_is_f_minus_pole x_in_u_not_p, -+ ← deriv_eqOn_of_eqOn_punctured _ _ U p U_is_open g_is_f_minus_pole x_in_u_not_p, -+ deriv_f_minus_A_inv_sub_clean] -+ · simp only [Pi.sub_apply] -+ have := sub_ne_zero_of_ne x_not_p -+ field_simp -+ ring -+ · apply holc.differentiableAt -+ exact Filter.inter_mem weird <| compl_singleton_mem_nhds x_not_p -+ · exact x_not_p -+ · exact g_is_holomorphic.differentiableAt weird -+ have h_identity : ∀x ∈ (U \ {p}), h x = (f x) * (x - p) := by -+ intro x x_in_u_not_p -+ have hyp_x_not_p : x ≠ p := by -+ exact ((Set.mem_sdiff x).mp x_in_u_not_p).2 -+ simp only [h, Pi.add_apply, Pi.mul_apply] -+ rw [← g_is_f_minus_pole x_in_u_not_p] -+ simp only [Pi.sub_apply] -+ field [sub_ne_zero.mpr hyp_x_not_p] -+ have log_deriv_f_plus_pole_equal_log_deriv_h : -+ EqOn (deriv f * f⁻¹ + fun s ↦ (s - p)⁻¹) ((deriv h) * h⁻¹) (U \ {p}) := by -+ simp only [Set.mem_sdiff, mem_singleton_iff, ne_eq, and_imp, Function.comp_apply, Pi.sub_apply, -+ DifferentiableOn.sub_iff_right, differentiableOn_const, DifferentiableOn.fun_sub_iff_left, -+ holc] at * -+ intro x hyp_x -+ have x_not_p : x ≠ p := by -+ exact ((Set.mem_sdiff x).mp hyp_x).2 -+ have x_in_u : x ∈ U := by exact Set.mem_of_mem_sdiff hyp_x -+ simp only [Pi.add_apply, Pi.mul_apply, Pi.inv_apply] -+ rw [deriv_h_identity _ x_in_u x_not_p, h_identity _ x_in_u x_not_p] -+ -+ field [sub_ne_zero.mpr x_not_p, non_zero x (x_in_u) x_not_p] -+ have h_inv_bounded : -+ h⁻¹ =O[𝓝[≠] p] (1 : ℂ → ℂ) := by -+ have : ContinuousAt h⁻¹ p := by -+ apply ContinuousOn.continuousAt h_continuous U_in_nhds |>.inv₀ -+ simp [h, A_ne_zero] -+ exact Asymptotics.IsBigO.mono (this.norm.isBoundedUnder_le.isBigO_one ℂ) inf_le_left -+ -+ have h_deriv_bounded : -+ (deriv h) =O[𝓝[≠] p] (1 : ℂ → ℂ) := -+ analytic_deriv_bounded_near_point h U_is_open -+ (by exact mem_of_mem_nhds U_in_nhds) h_is_holomorphic -+ -+ have h_log_deriv_bounded : -+ ((deriv h) * h⁻¹) =O[𝓝[≠] p] (1 : ℂ → ℂ) := by -+ have T := Asymptotics.IsBigO.mul h_deriv_bounded h_inv_bounded -+ exact IsBigO.of_const_mul_right T -+ -+ have u_not_p_in_filter : U \ {p} ∈ 𝓝[≠] p := by -+ exact sdiff_mem_nhdsWithin_compl U_in_nhds {p} -+ have T := Set.EqOn.eventuallyEq_of_mem log_deriv_f_plus_pole_equal_log_deriv_h u_not_p_in_filter -+ exact EventuallyEq.trans_isBigO T h_log_deriv_bounded -+ -+theorem logDerivResidue {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} -+ (non_zero : ∀ x ∈ U \ {p}, f x ≠ 0) -+ (holc : HolomorphicOn f (U \ {p})) -+ (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} (A_ne_zero : A ≠ 0) -+ (f_near_p : BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (U \ {p}))) : -+ (deriv f * f⁻¹ + (fun s ↦ (s - p)⁻¹)) =O[𝓝[≠] p] (1 : ℂ → ℂ) := -+ by -+ let ⟨U', ⟨a,b,c⟩⟩ := mem_nhds_iff.mp U_in_nhds -+ have W : (U' \ {p}) ⊆ U' := by -+ exact Set.sdiff_subset -+ -+ have T : (U' \ {p}) ⊆ (U \ {p}) := by -+ exact Set.sdiff_subset_sdiff a (subset_refl _) -+ -+ refine logDerivResidue' b ?_ ?_ (IsOpen.mem_nhds b c) A_ne_zero ?_ -+ · intro x hyp_x -+ exact non_zero x <| T hyp_x -+ · exact DifferentiableOn.mono holc T -+ · exact (f_near_p.mono (image_mono (Set.sdiff_subset_sdiff a (subset_refl _)))) -+ -+lemma BddAbove_to_IsBigO {f : ℂ → ℂ} {p : ℂ} -+ {U : Set ℂ} (hU : U ∈ 𝓝 p) (bdd : BddAbove (norm ∘ f '' (U \ {p}))) : -+ f =O[𝓝[≠] p] (1 : ℂ → ℂ) := by -+ dsimp [BddAbove, upperBounds] at bdd -+ rcases bdd with ⟨C, hC⟩ -+ -+ have h : ∀ x ∈ U \ {p}, ‖f x‖ ≤ C := by -+ intro x hx -+ have fx_is_norm : ‖f x‖ ∈ norm ∘ f ''(U \ {p}) := by -+ exact ⟨x, hx, rfl⟩ -+ exact hC fx_is_norm -+ -+ rw [Asymptotics.isBigO_iff] -+ use C -+ rw [eventually_nhdsWithin_iff] -+ simp only [Set.mem_sdiff, mem_singleton_iff, and_imp, mem_compl_iff, Pi.one_apply, one_mem, -+ CStarRing.norm_of_mem_unitary, mul_one] at h ⊢ -+ filter_upwards [hU] using h -+ -+theorem logDerivResidue'' {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} -+ (non_zero : ∀ x ∈ U \ {p}, f x ≠ 0) -+ (holc : HolomorphicOn f (U \ {p})) -+ (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} (A_ne_zero : A ≠ 0) -+ (f_near_p : BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (U \ {p}))) : -+ ∃ V ∈ 𝓝 p, BddAbove (norm ∘ (deriv f * f⁻¹ + (fun s ↦ (s - p)⁻¹)) '' (V \ {p})) := by -+ apply IsBigO_to_BddAbove -+ exact logDerivResidue non_zero holc U_in_nhds A_ne_zero f_near_p -+ -+theorem ResidueMult {f g : ℂ → ℂ} {p : ℂ} {U : Set ℂ} -+ (g_holc : HolomorphicOn g U) (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} -+ (f_near_p : (f - (fun s ↦ A * (s - p)⁻¹)) =O[𝓝[≠] p] (1 : ℂ → ℂ)) : -+ (f * g - (fun s ↦ A * g p * (s - p)⁻¹)) =O[𝓝[≠] p] (1 : ℂ → ℂ) := by -+ -+ have : (f * g - fun s ↦ A * g p * (s - p)⁻¹) -+ = (f - A • fun s ↦ (s - p)⁻¹) * g + fun s ↦ (A * (g s - g p) / (s - p)) := by -+ ext; simp; ring -+ -+ rw[this] -+ have p_in_U : p ∈ U := mem_of_mem_nhds U_in_nhds -+ refine Asymptotics.IsBigO.add ?_ ?_ -+ · rw[← mul_one (1 : ℂ → ℂ)] -+ refine Asymptotics.IsBigO.mul f_near_p ?_ -+ -+ have g_cont : ContinuousAt g p := by -+ -+ exact (g_holc.continuousOn.continuousWithinAt p_in_U).continuousAt U_in_nhds -+ -+ have := g_cont.norm.isBoundedUnder_le.isBigO_one ℂ -+ exact IsBigO.mono this inf_le_left -+ · -+ -+ suffices (fun s ↦ A * ((s - p)⁻¹ * (g s - g p))) =O[𝓝[≠] p] 1 by -+ convert! this using 2 -+ rw[div_eq_mul_inv] -+ ring -+ apply Asymptotics.IsBigO.const_mul_left -+ -+ have g_diff : HasDerivAt g (deriv g p) p := -+ (DifferentiableOn.differentiableAt g_holc U_in_nhds).hasDerivAt -+ -+ rw [hasDerivAt_iff_isLittleO] at g_diff -+ apply Asymptotics.IsLittleO.isBigO at g_diff -+ have : (fun x' ↦ deriv g p * (x' - p)) =O[𝓝 p] fun x' ↦ x' - p := by -+ apply Asymptotics.IsBigO.const_mul_left -+ exact Asymptotics.isBigO_refl (fun x ↦ x - p) (𝓝 p) -+ have h1 := g_diff.add this -+ have h2 : (fun x ↦ g x - g p) =O[𝓝 p] fun x' ↦ x' - p := by -+ convert! h1 using 2 -+ simp -+ ring -+ refine (Asymptotics.isBigO_mul_iff_isBigO_div ?_).mpr ?_ -+ · filter_upwards [self_mem_nhdsWithin] with x hx -+ simp only [mem_compl_iff, mem_singleton_iff] at hx -+ exact inv_ne_zero (sub_ne_zero.mpr hx) -+ · simp only [div_inv_eq_mul] -+ refine Asymptotics.IsBigO.mono ?_ inf_le_left -+ simpa -+ -+theorem riemannZetaLogDerivResidue : -+ ∃ U ∈ 𝓝 1, BddAbove (norm ∘ (-(ζ' / ζ) - (fun s ↦ (s - 1)⁻¹)) '' (U \ {1})) := by -+ obtain ⟨U,U_in_nhds, hU⟩ := riemannZetaResidue -+ have hU' : BddAbove (norm ∘ (ζ - fun s ↦ 1 * (s - 1)⁻¹) '' (U \ {1})) := by -+ simp only [Function.comp_apply, Pi.sub_apply, one_mul] at hU ⊢ -+ exact hU -+ obtain ⟨V,V_in_nhds, V_is_open, hV⟩ := nonZeroOfBddAbove U_in_nhds one_ne_zero hU' -+ let W := V ∩ interior U -+ have hW : ∀ s ∈ W \ {1}, ζ s ≠ 0 := by -+ intro s hs -+ have s_in_V_diff : s ∈ V \ {1} := ⟨hs.1.1, hs.2⟩ -+ exact hV s s_in_V_diff -+ have ζ_holc: HolomorphicOn ζ (W \ {1}) := by -+ intro y hy -+ simp only [Set.mem_sdiff, mem_singleton_iff] at hy -+ refine DifferentiableAt.differentiableWithinAt ?_ -+ apply differentiableAt_riemannZeta hy.2 -+ have W_in_nhds : W ∈ 𝓝 1 := by -+ refine inter_mem V_in_nhds ?_ -+ exact interior_mem_nhds.mpr U_in_nhds -+ have := logDerivResidue'' hW ζ_holc W_in_nhds one_ne_zero -+ have HW : BddAbove (norm ∘ (ζ - fun s ↦ (s - 1)⁻¹) '' (W \ {1})) := by -+ obtain ⟨c, hc⟩ := bddAbove_def.mp hU -+ apply bddAbove_def.mpr -+ use c -+ rintro y ⟨x, x_in_W, fxy⟩ -+ apply hc -+ exact ⟨x, ⟨interior_subset x_in_W.1.2, x_in_W.2⟩, fxy⟩ -+ simp only [one_mul] at this -+ have aux: ∀ a, ‖-(deriv ζ a / ζ a) - (a - 1)⁻¹‖ = ‖(deriv ζ a / ζ a) + (a - 1)⁻¹‖ := by -+ intro a -+ calc ‖-(deriv ζ a / ζ a) - (a - 1)⁻¹‖ -+ = ‖-((deriv ζ a / ζ a) + (a - 1)⁻¹)‖ := by ring_nf -+ _ = ‖(deriv ζ a / ζ a) + (a - 1)⁻¹‖ := by rw [norm_neg] -+ simp only [Function.comp_apply, Pi.sub_apply] at hU -+ simp only [Function.comp_apply, Pi.sub_apply, Pi.neg_apply, Pi.div_apply, aux] -+ apply this HW -+ -+theorem riemannZetaLogDerivResidueBigO : -+ (-ζ' / ζ - fun z ↦ (z - 1)⁻¹) =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by -+ obtain ⟨U, hU, bdd⟩ := riemannZetaLogDerivResidue -+ convert BddAbove_to_IsBigO hU bdd using 2 -+ rw [neg_div] -+ -+noncomputable def riemannZeta0 (N : ℕ) (s : ℂ) : ℂ := -+ (∑ n ∈ Finset.range (N + 1), 1 / (n : ℂ) ^ s) + -+ (- N ^ (1 - s)) / (1 - s) + (- N ^ (-s)) / 2 -+ + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (s + 1) -+ -+local notation (name := riemannzeta0) "ζ₀" => riemannZeta0 -+ -+lemma riemannZeta0_apply (N : ℕ) (s : ℂ) : ζ₀ N s = -+ (∑ n ∈ Finset.range (N + 1), 1 / (n : ℂ) ^ s) + -+ ((- N ^ (1 - s)) / (1 - s) + (- N ^ (-s)) / 2 -+ + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1))) := by -+ simp_rw [riemannZeta0, div_cpow_eq_cpow_neg]; ring -+ -+lemma Real.differentiableAt_cpow_const_of_ne (s : ℂ) {x : ℝ} (xpos : 0 < x) : -+ DifferentiableAt ℝ (fun (x : ℝ) ↦ (x : ℂ) ^ s) x := by -+ apply DifferentiableAt.comp_ofReal (e := fun z ↦ z ^ s) -+ apply DifferentiableAt.cpow (by simp) (by simp) (by simp [xpos]) -+ -+lemma Complex.one_div_cpow_eq {s : ℂ} {x : ℝ} (x_ne : x ≠ 0) : -+ 1 / (x : ℂ) ^ s = (x : ℂ) ^ (-s) := by -+ refine (eq_one_div_of_mul_eq_one_left ?_).symm -+ rw [← cpow_add _ _ <| mod_cast x_ne, neg_add_cancel, cpow_zero] -+ -+lemma sum_eq_int_deriv {φ : ℝ → ℂ} {a b : ℝ} (apos : 0 ≤ a) (a_lt_b : a < b) -+ (φDiff : ∀ x ∈ [[a, b]], HasDerivAt φ (deriv φ x) x) -+ (derivφCont : ContinuousOn (deriv φ) [[a, b]]) : -+ ∑ n ∈ Finset.Ioc ⌊a⌋₊ ⌊b⌋₊, φ n = -+ (∫ x in a..b, φ x) + (⌊b⌋₊ + 1 / 2 - b) * φ b - (⌊a⌋₊ + 1 / 2 - a) * φ a -+ - ∫ x in a..b, (⌊x⌋ + 1 / 2 - x) * deriv φ x := by -+ rw [uIcc_of_le a_lt_b.le] at φDiff -+ convert sum_eq_integral_add_integral_deriv apos a_lt_b.le (fun t ht ↦ (φDiff t ht).differentiableAt) derivφCont using 1 -+ unfold B1 -+ push_cast -+ suffices ∫ (x : ℝ) in a..b, (↑⌊x⌋ + 1 / 2 - ↑x) * deriv φ x = -∫ (t : ℝ) in a..b, deriv φ t * (↑t - ↑⌊t⌋₊ - 1 / 2) by -+ rw [this] -+ ring_nf! -+ rw [← intervalIntegral.integral_neg] -+ refine intervalIntegral.integral_congr fun x hx ↦ ?_ -+ rw [uIcc_of_le a_lt_b.le, mem_Icc] at hx -+ rw [← Int.natCast_floor_eq_floor (by linarith)] -+ norm_cast -+ push_cast -+ ring -+ -+lemma xpos_of_uIcc {a b : ℕ} (ha : a ∈ Ioo 0 b) {x : ℝ} (x_in : x ∈ [[(a : ℝ), b]]) : -+ 0 < x := by -+ rw [uIcc_of_le (by exact_mod_cast ha.2.le), mem_Icc] at x_in -+ linarith [(by exact_mod_cast ha.1 : (0 : ℝ) < a)] -+ -+lemma ZetaSum_aux1₁ {a b : ℕ} {s : ℂ} (s_ne_one : s ≠ 1) (ha : a ∈ Ioo 0 b) : -+ (∫ (x : ℝ) in a..b, 1 / (x : ℂ) ^ s) = -+ (b ^ (1 - s) - a ^ (1 - s)) / (1 - s) := by -+ convert integral_cpow (a := a) (b := b) (r := -s) ?_ using 1 -+ · refine intervalIntegral.integral_congr fun x hx ↦ _root_.Erdos970.Complex.one_div_cpow_eq ?_ -+ exact (xpos_of_uIcc ha hx).ne' -+ · norm_cast; ring_nf -+ · right; refine ⟨(by grind), ?_⟩ -+ exact fun hx ↦ (lt_self_iff_false 0).mp <| xpos_of_uIcc ha hx -+ -+lemma ZetaSum_aux1φDiff {s : ℂ} {x : ℝ} (xpos : 0 < x) : -+ HasDerivAt (fun (t : ℝ) ↦ 1 / (t : ℂ) ^ s) (deriv (fun (t : ℝ) ↦ 1 / (t : ℂ) ^ s) x) x := by -+ exact hasDerivAt_deriv_iff.mpr <| -+ DifferentiableAt.div (differentiableAt_const _) -+ (Real.differentiableAt_cpow_const_of_ne s xpos) (by simp [cpow_eq_zero_iff, xpos.ne']) -+ -+lemma ZetaSum_aux1φderiv {s : ℂ} (s_ne_zero : s ≠ 0) {x : ℝ} (xpos : 0 < x) : -+ deriv (fun (t : ℝ) ↦ 1 / (t : ℂ) ^ s) x = (fun (x : ℝ) ↦ -s * (x : ℂ) ^ (-(s + 1))) x := by -+ let r := -s - 1 -+ have r_add1_ne_zero : r + 1 ≠ 0 := fun hr ↦ by simp [neg_ne_zero.mpr s_ne_zero, r] at hr -+ have r_ne_neg1 : r ≠ -1 := fun hr ↦ (hr ▸ r_add1_ne_zero) <| by norm_num -+ have hasDeriv := hasDerivAt_ofReal_cpow_const' xpos.ne' r_ne_neg1 -+ have := hasDeriv.deriv ▸ deriv_const_mul (-s) (hasDeriv).differentiableAt -+ convert! this using 2 -+ · ext y -+ by_cases y_zero : (y : ℂ) = 0 -+ · simp only [y_zero, ne_eq, s_ne_zero, not_false_eq_true, zero_cpow, div_zero, -+ r_add1_ne_zero, zero_div, mul_zero] -+ · have : (y : ℂ) ^ s ≠ 0 := fun hy ↦ y_zero ((cpow_eq_zero_iff _ _).mp hy).1 -+ simp only [one_div, sub_add_cancel, cpow_neg, neg_mul, r] -+ field_simp -+ · simp only [r] -+ ring_nf -+ -+lemma ZetaSum_aux1derivφCont {s : ℂ} (s_ne_zero : s ≠ 0) {a b : ℕ} (ha : a ∈ Ioo 0 b) : -+ ContinuousOn (deriv (fun (t : ℝ) ↦ 1 / (t : ℂ) ^ s)) [[a, b]] := by -+ have : EqOn _ (fun (t : ℝ) ↦ -s * (t : ℂ) ^ (-(s + 1))) [[a, b]] := -+ fun x hx ↦ ZetaSum_aux1φderiv s_ne_zero <| xpos_of_uIcc ha hx -+ refine continuous_ofReal.continuousOn.cpow_const ?_ |>.const_smul (c := -s) |>.congr this -+ exact fun x hx ↦ ofReal_mem_slitPlane.mpr <| xpos_of_uIcc ha hx -+ -+ -+lemma ZetaSum_aux1 {a b : ℕ} {s : ℂ} (s_ne_one : s ≠ 1) (s_ne_zero : s ≠ 0) (ha : a ∈ Ioo 0 b) : -+ ∑ n ∈ Finset.Ioc a b, 1 / (n : ℂ) ^ s = -+ (b ^ (1 - s) - a ^ (1 - s)) / (1 - s) + 1 / 2 * (1 / b ^ (s)) - 1 / 2 * (1 / a ^ s) -+ + s * ∫ x in a..b, (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1)) := by -+ let φ := fun (x : ℝ) ↦ 1 / (x : ℂ) ^ s -+ let φ' := fun (x : ℝ) ↦ -s * (x : ℂ) ^ (-(s + 1)) -+ have xpos : ∀ x ∈ [[(a : ℝ), b]], 0 < x := fun x hx ↦ xpos_of_uIcc ha hx -+ have φDiff : ∀ x ∈ [[(a : ℝ), b]], HasDerivAt φ (deriv φ x) x := -+ fun x hx ↦ ZetaSum_aux1φDiff (xpos x hx) -+ have φderiv : ∀ x ∈ [[(a : ℝ), b]], deriv φ x = φ' x := by -+ exact fun x hx ↦ ZetaSum_aux1φderiv s_ne_zero (xpos x hx) -+ have derivφCont : ContinuousOn (deriv φ) [[a, b]] := ZetaSum_aux1derivφCont s_ne_zero ha -+ convert sum_eq_int_deriv (by linarith) (by exact_mod_cast ha.2) φDiff derivφCont using 1 -+ · congr <;> simp only [Nat.floor_natCast] -+ · rw [Nat.floor_natCast, Nat.floor_natCast, ← intervalIntegral.integral_const_mul] -+ simp_rw [mul_div, ← mul_div, φ, ZetaSum_aux1₁ s_ne_one ha] -+ conv => rhs; rw [sub_eq_add_neg] -+ congr; any_goals norm_cast; simp only [one_div, add_sub_cancel_left] -+ rw [← intervalIntegral.integral_neg, intervalIntegral.integral_congr] -+ simp only [φ, one_div] at φderiv -+ intro x hx; simp_rw [φderiv x hx, φ']; ring_nf -+ -+lemma ZetaSum_aux1_1' {a b x : ℝ} (apos : 0 < a) (hx : x ∈ Icc a b) : 0 < x := -+ lt_of_lt_of_le apos hx.1 -+ -+lemma ZetaSum_aux1_1 {a b x : ℝ} (apos : 0 < a) (a_lt_b : a < b) (hx : x ∈ [[a, b]]) : 0 < x := -+ lt_of_lt_of_le apos (uIcc_of_le a_lt_b.le ▸ hx).1 -+ -+lemma ZetaSum_aux1_2 {a b : ℝ} {c : ℝ} (apos : 0 < a) (a_lt_b : a < b) -+ (h : c ≠ 0 ∧ 0 ∉ [[a, b]]) : -+ ∫ (x : ℝ) in a..b, 1 / x ^ (c+1) = (a ^ (-c) - b ^ (-c)) / c := by -+ rw [(by ring : (a ^ (-c) - b ^ (-c)) / c = (b ^ (-c) - a ^ (-c)) / (-c))] -+ have := integral_rpow (a := a) (b := b) (r := -c-1) (Or.inr ⟨by simp [h.1], h.2⟩) -+ simp only [sub_add_cancel] at this -+ rw [← this] -+ apply intervalIntegral.integral_congr -+ intro x hx -+ have : 0 ≤ x := (ZetaSum_aux1_1 apos a_lt_b hx).le -+ simp [div_rpow_eq_rpow_neg _ _ _ this, sub_eq_add_neg, add_comm] -+ -+lemma ZetaSum_aux1_3 (x : ℝ) : ‖(⌊x⌋ + 1/2 - x)‖ ≤ 1/2 := -+ abs_le.mpr ⟨(by linarith [Int.lt_floor_add_one x]), (by linarith [Int.floor_le x])⟩ -+ -+lemma ZetaSum_aux1_4' (x : ℝ) (hx : 0 < x) (s : ℂ) : -+ ‖(⌊x⌋ + 1 / 2 - (x : ℝ)) / (x : ℂ) ^ (s + 1)‖ = -+ ‖⌊x⌋ + 1 / 2 - x‖ / x ^ ((s + 1).re) := by -+ simp_rw [norm_div, Complex.norm_cpow_eq_rpow_re_of_pos hx, ← norm_real] -+ simp -+ -+lemma ZetaSum_aux1_4 {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} : -+ ∫ (x : ℝ) in a..b, ‖(↑⌊x⌋ + (1 : ℝ) / 2 - ↑x) / (x : ℂ) ^ (s + 1)‖ = -+ ∫ (x : ℝ) in a..b, |⌊x⌋ + 1 / 2 - x| / x ^ (s + 1).re := by -+ apply intervalIntegral.integral_congr -+ exact fun x hx ↦ ZetaSum_aux1_4' x (ZetaSum_aux1_1 apos a_lt_b hx) s -+ -+lemma ZetaSum_aux1_5a {a b : ℝ} (apos : 0 < a) {s : ℂ} (x : ℝ) -+ (h : x ∈ Icc a b) : |↑⌊x⌋ + 1 / 2 - x| / x ^ (s.re + 1) ≤ 1 / x ^ (s.re + 1) := by -+ apply div_le_div_of_nonneg_right _ _ -+ · exact le_trans (ZetaSum_aux1_3 x) (by norm_num) -+ · apply Real.rpow_nonneg <| le_of_lt (ZetaSum_aux1_1' apos h) -+ -+lemma ZetaSum_aux1_5b {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} (σpos : 0 < s.re) : -+ IntervalIntegrable (fun u ↦ 1 / u ^ (s.re + 1)) MeasureTheory.volume a b := by -+ refine continuousOn_const.div ?_ ?_ |>.intervalIntegrable_of_Icc (le_of_lt a_lt_b) -+ · exact continuousOn_id.rpow_const fun x hx ↦ Or.inl (ne_of_gt <| ZetaSum_aux1_1' apos hx) -+ · exact fun x hx h ↦ by rw [Real.rpow_eq_zero] at h <;> linarith [ZetaSum_aux1_1' apos hx] -+ -+open MeasureTheory in -+lemma measurable_floor_add_half_sub : Measurable fun (u : ℝ) ↦ ↑⌊u⌋ + 1 / 2 - u := by -+ refine Measurable.add ?_ measurable_const |>.sub measurable_id -+ exact Measurable.comp (by exact fun _ _ ↦ trivial) Int.measurable_floor -+ -+open MeasureTheory in -+lemma ZetaSum_aux1_5c {a b : ℝ} {s : ℂ} : -+ let g : ℝ → ℝ := fun u ↦ |↑⌊u⌋ + 1 / 2 - u| / u ^ (s.re + 1); -+ AEStronglyMeasurable g -+ (Measure.restrict volume (Ι a b)) := by -+ intro -+ refine (Measurable.div ?_ <| measurable_id.pow_const _).aestronglyMeasurable -+ exact _root_.continuous_abs.measurable.comp measurable_floor_add_half_sub -+ -+lemma ZetaSum_aux1_5d {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} (σpos : 0 < s.re) : -+ IntervalIntegrable (fun u ↦ |↑⌊u⌋ + 1 / 2 - u| / u ^ (s.re + 1)) MeasureTheory.volume a b := by -+ set g : ℝ → ℝ := (fun u ↦ |↑⌊u⌋ + 1 / 2 - u| / u ^ (s.re + 1)) -+ apply ZetaSum_aux1_5b apos a_lt_b σpos |>.mono_fun ZetaSum_aux1_5c ?_ -+ filter_upwards with x -+ simp only [Real.norm_eq_abs, one_div, norm_inv, abs_div, _root_.abs_abs] -+ conv => rw [div_eq_mul_inv, ← one_div]; rhs; rw [← one_mul |x ^ (s.re + 1)|⁻¹] -+ refine mul_le_mul ?_ (le_refl _) (by simp) <| by norm_num -+ exact le_trans (ZetaSum_aux1_3 x) <| by norm_num -+ -+lemma ZetaSum_aux1_5 {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} (σpos : 0 < s.re) : -+ ∫ (x : ℝ) in a..b, |⌊x⌋ + 1 / 2 - x| / x ^ (s.re + 1) ≤ -+ ∫ (x : ℝ) in a..b, 1 / x ^ (s.re + 1) := by -+ apply intervalIntegral.integral_mono_on (le_of_lt a_lt_b) ?_ ?_ -+ · exact ZetaSum_aux1_5a apos -+ · exact ZetaSum_aux1_5d apos a_lt_b σpos -+ · exact ZetaSum_aux1_5b apos a_lt_b σpos -+ -+lemma ZetaBnd_aux1a {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} (σpos : 0 < s.re) : -+ ∫ x in a..b, ‖(⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (s + 1)‖ ≤ -+ (a ^ (-s.re) - b ^ (-s.re)) / s.re := by -+ calc -+ _ = ∫ x in a..b, |(⌊x⌋ + 1 / 2 - x)| / x ^ (s+1).re := ZetaSum_aux1_4 apos a_lt_b -+ _ ≤ ∫ x in a..b, 1 / x ^ (s.re + 1) := ZetaSum_aux1_5 apos a_lt_b σpos -+ _ = (a ^ (-s.re) - b ^ (-s.re)) / s.re := ?_ -+ refine ZetaSum_aux1_2 (c := s.re) apos a_lt_b ⟨ne_of_gt σpos, ?_⟩ -+ exact fun h ↦ (lt_self_iff_false 0).mp <| ZetaSum_aux1_1 apos a_lt_b h -+ -+lemma Finset.Ioc_eq_Ico (M N : ℕ) : Finset.Ioc N M = Finset.Ico (N + 1) (M + 1) := by -+ ext a; simp only [Finset.mem_Ioc, Finset.mem_Ico]; constructor <;> intro ⟨h₁, h₂⟩ <;> omega -+ -+lemma Finset.Ioc_eq_Icc (M N : ℕ) : Finset.Ioc N M = Finset.Icc (N + 1) M := by -+ ext a; simp only [Finset.mem_Ioc, Finset.mem_Icc]; constructor <;> intro ⟨h₁, h₂⟩ <;> omega -+ -+lemma Finset.Icc_eq_Ico (M N : ℕ) : Finset.Icc N M = Finset.Ico N (M + 1) := by -+ ext a; simp only [Finset.mem_Icc, Finset.mem_Ico]; constructor <;> intro ⟨h₁, h₂⟩ <;> omega -+ -+lemma finsetSum_tendsto_tsum {N : ℕ} {f : ℕ → ℂ} (hf : Summable f) : -+ Tendsto (fun (k : ℕ) ↦ ∑ n ∈ Finset.Ico N k, f n) atTop (𝓝 (∑' (n : ℕ), f (n + N))) := by -+ have := Summable.hasSum_iff_tendsto_nat hf (m := ∑' (n : ℕ), f n) |>.mp hf.hasSum -+ have const := tendsto_const_nhds (α := ℕ) (x := ∑ i ∈ Finset.range N, f i) (f := atTop) -+ have := Filter.Tendsto.sub this const -+ rw [← hf.sum_add_tsum_nat_add N, add_comm, add_sub_cancel_right] at this -+ apply this.congr' -+ filter_upwards [Filter.mem_atTop (N + 1)] -+ intro M hM -+ rw [Finset.sum_Ico_eq_sub] -+ linarith -+ -+lemma Complex.cpow_tendsto {s : ℂ} (s_re_gt : 1 < s.re) : -+ Tendsto (fun (x : ℕ) ↦ (x : ℂ) ^ (1 - s)) atTop (𝓝 0) := by -+ have one_sub_s_re_ne : (1 - s).re ≠ 0 := by simp only [sub_re, one_re]; linarith -+ rw [tendsto_zero_iff_norm_tendsto_zero] -+ simp_rw [Complex.norm_natCast_cpow_of_re_ne_zero _ (one_sub_s_re_ne)] -+ rw [(by simp only [sub_re, one_re, neg_sub] : (1 - s).re = - (s - 1).re)] -+ apply (tendsto_rpow_neg_atTop _).comp tendsto_natCast_atTop_atTop; simp [s_re_gt] -+ -+lemma Complex.cpow_inv_tendsto {s : ℂ} (hs : 0 < s.re) : -+ Tendsto (fun (x : ℕ) ↦ ((x : ℂ) ^ s)⁻¹) atTop (𝓝 0) := by -+ rw [tendsto_zero_iff_norm_tendsto_zero] -+ simp_rw [norm_inv, Complex.norm_natCast_cpow_of_re_ne_zero _ <| ne_of_gt hs] -+ apply Filter.Tendsto.inv_tendsto_atTop -+ exact (tendsto_rpow_atTop hs).comp tendsto_natCast_atTop_atTop -+ -+lemma ZetaSum_aux2a : ∃ C, ∀ (x : ℝ), ‖⌊x⌋ + 1 / 2 - x‖ ≤ C := by -+ use 1 / 2; exact ZetaSum_aux1_3 -+ -+lemma ZetaSum_aux3 {N : ℕ} {s : ℂ} (s_re_gt : 1 < s.re) : -+ Tendsto (fun k ↦ ∑ n ∈ Finset.Ioc N k, 1 / (n : ℂ) ^ s) atTop -+ (𝓝 (∑' (n : ℕ), 1 / (n + N + 1 : ℂ) ^ s)) := by -+ let f := fun (n : ℕ) ↦ 1 / (n : ℂ) ^ s -+ have hf := summable_one_div_nat_cpow.mpr s_re_gt -+ simp_rw [Finset.Ioc_eq_Ico] -+ convert finsetSum_tendsto_tsum (f := fun n ↦ f (n + 1)) (N := N) ?_ using 1 -+ · ext k -+ rw [Finset.sum_Ico_add'] -+ · congr; ext n; simp only [one_div, Nat.cast_add, Nat.cast_one, f] -+ · rwa [summable_nat_add_iff (k := 1)] -+ -+lemma integrableOn_of_Zeta0_fun {N : ℕ} (N_pos : 0 < N) {s : ℂ} (s_re_gt : 0 < s.re) : -+ MeasureTheory.IntegrableOn (fun (x : ℝ) ↦ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1))) (Ioi N) -+ MeasureTheory.volume := by -+ obtain ⟨c, hc⟩ := ZetaSum_aux2a -+ apply MeasureTheory.Integrable.bdd_mul (c := c) ?_ ?_ -+ · apply MeasureTheory.ae_of_all -+ convert hc; simp only [← Complex.norm_real]; simp -+ · apply integrableOn_Ioi_cpow_iff (by positivity) |>.mpr (by simp [s_re_gt]) -+ · refine Measurable.add ?_ measurable_const |>.sub (by fun_prop) |>.aestronglyMeasurable -+ exact Measurable.comp (by exact fun _ _ ↦ trivial) Int.measurable_floor -+ -+lemma ZetaSum_aux2 {N : ℕ} (N_pos : 0 < N) {s : ℂ} (s_re_gt : 1 < s.re) : -+ ∑' (n : ℕ), 1 / (n + N + 1 : ℂ) ^ s = -+ (- N ^ (1 - s)) / (1 - s) - N ^ (-s) / 2 -+ + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1)) := by -+ have s_ne_zero : s ≠ 0 := fun hs ↦ by linarith [zero_re ▸ hs ▸ s_re_gt] -+ have s_ne_one : s ≠ 1 := fun hs ↦ (lt_self_iff_false _).mp <| one_re ▸ hs ▸ s_re_gt -+ apply tendsto_nhds_unique (X := ℂ) (Y := ℕ) (l := atTop) -+ (f := fun k ↦ ((k : ℂ) ^ (1 - s) - (N : ℂ) ^ (1 - s)) / (1 - s) + -+ 1 / 2 * (1 / ↑k ^ s) - 1 / 2 * (1 / ↑N ^ s) -+ + s * ∫ (x : ℝ) in (N : ℝ)..k, (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1))) -+ (b := (- N ^ (1 - s)) / (1 - s) - N ^ (-s) / 2 -+ + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1))) -+ · apply Filter.Tendsto.congr' -+ (f₁ := fun (k : ℕ) ↦ ∑ n ∈ Finset.Ioc N k, 1 / (n : ℂ) ^ s) (l₁ := atTop) -+ · apply Filter.eventually_atTop.mpr -+ use N + 1 -+ intro k hk -+ exact ZetaSum_aux1 (a := N) (b := k) s_ne_one s_ne_zero ⟨N_pos, hk⟩ -+ · exact ZetaSum_aux3 s_re_gt -+ · apply (Tendsto.sub ?_ ?_).add (Tendsto.const_mul _ ?_) -+ · rw [(by ring : -↑N ^ (1 - s) / (1 - s) = (0 - ↑N ^ (1 - s)) / (1 - s) + 0)] -+ apply _root_.Erdos970.Complex.cpow_tendsto s_re_gt |>.sub_const _ |>.div_const _ |>.add -+ simp_rw [mul_comm_div, one_mul, one_div, (by congr; ring : 𝓝 (0 : ℂ) = 𝓝 ((0 : ℂ) / 2))] -+ apply Tendsto.div_const <| _root_.Erdos970.Complex.cpow_inv_tendsto (by positivity) -+ · simp_rw [mul_comm_div, one_mul, one_div, cpow_neg]; exact tendsto_const_nhds -+ · exact MeasureTheory.intervalIntegral_tendsto_integral_Ioi (a := N) -+ (b := (fun (n : ℕ) ↦ (n : ℝ))) -+ (integrableOn_of_Zeta0_fun N_pos <| by positivity) tendsto_natCast_atTop_atTop -+ -+open MeasureTheory in -+ -+lemma ZetaBnd_aux1b (N : ℕ) (Npos : 1 ≤ N) {σ t : ℝ} (σpos : 0 < σ) : -+ ‖∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ ((σ + t * I) + 1)‖ -+ ≤ N ^ (-σ) / σ := by -+ apply le_trans (by apply norm_integral_le_integral_norm) -+ apply le_of_tendsto (x := atTop (α := ℝ)) (f := fun (t : ℝ) ↦ ∫ (x : ℝ) in N..t, -+ ‖(⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (σ + t * I + 1)‖) ?_ ?_ -+ · apply intervalIntegral_tendsto_integral_Ioi (μ := volume) (l := atTop) (b := id) -+ (f := fun (x : ℝ) ↦ ‖(⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (σ + t * I + 1)‖) N ?_ ?_ |>.congr' ?_ -+ · filter_upwards [Filter.mem_atTop ((N : ℝ))] -+ intro u hu -+ simp only [id_eq, intervalIntegral.integral_of_le hu, norm_div] -+ apply setIntegral_congr_fun (by simp) -+ intro x hx; beta_reduce -+ iterate 2 (rw [norm_cpow_eq_rpow_re_of_pos (by linarith [hx.1])]) -+ simp -+ · apply IntegrableOn.integrable ?_ |>.norm -+ convert! integrableOn_of_Zeta0_fun (s := σ + t * I) Npos (by simp [σpos]) using 1 -+ simp_rw [div_eq_mul_inv, cpow_neg] -+ · exact fun ⦃_⦄ a ↦ a -+ · filter_upwards [mem_atTop (N + 1 : ℝ)] with t ht -+ have : (N ^ (-σ) - t ^ (-σ)) / σ ≤ N ^ (-σ) / σ := -+ div_le_div_iff_of_pos_right σpos |>.mpr (by simp [Real.rpow_nonneg (by linarith)]) -+ apply le_trans ?_ this -+ convert! ZetaBnd_aux1a (a := N) (b := t) (by positivity) (by linarith) ?_ <;> simp [σpos] -+ -+lemma ZetaBnd_aux1 (N : ℕ) (Npos : 1 ≤ N) {σ t : ℝ} (hσ : σ ∈ Ioc 0 2) (ht : 2 ≤ |t|) : -+ ‖(σ + t * I) * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ ((σ + t * I) + 1)‖ -+ ≤ 2 * |t| * N ^ (-σ) / σ := by -+ rw [norm_mul, mul_div_assoc] -+ rw [Set.mem_Ioc] at hσ -+ apply mul_le_mul ?_ (ZetaBnd_aux1b N Npos hσ.1) (norm_nonneg _) (by positivity) -+ refine le_trans (by apply norm_add_le) ?_ -+ simp only [Complex.norm_of_nonneg hσ.1.le, Complex.norm_mul, norm_real, Real.norm_eq_abs, norm_I, -+ mul_one] -+ linarith [hσ.2] -+ -+lemma ZetaBnd_aux1p (N : ℕ) (Npos : 1 ≤ N) {σ : ℝ} (hσ : σ ∈ Ioc 0 2) : -+ (fun (t : ℝ) ↦ -+ ‖(σ + t * I) * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ ((σ + t * I) + 1)‖) -+ =O[Filter.principal {t | 2 ≤ |t|}] fun t ↦ |t| * N ^ (-σ) / σ := by -+ rw [Asymptotics.IsBigO_def] -+ use 2 -+ rw [Asymptotics.isBigOWith_principal] -+ intro t ht -+ simp only [mem_ofPred_eq] at ht -+ rw [norm_norm, norm_mul, mul_div_assoc, norm_mul] -+ have : 2 * (‖|t|‖ * ‖↑N ^ (-σ) / σ‖) = (2 * |t|) * ((N : ℝ) ^ (-σ) / σ) := by -+ simp only [Real.norm_eq_abs, _root_.abs_abs, norm_div] -+ have : σ ≠ 0 := by linarith [hσ.1] -+ field_simp -+ rw [abs_of_pos hσ.1] -+ have : 0 < (N : ℝ) ^ (-σ) := by -+ refine Real.rpow_pos_of_pos ?_ _ -+ positivity -+ rw [abs_of_pos this] -+ ring -+ rw [this] -+ apply mul_le_mul ?_ (ZetaBnd_aux1b N Npos hσ.1) (norm_nonneg _) (by positivity) -+ refine le_trans (by apply norm_add_le) ?_ -+ simp only [norm_real, norm_mul, norm_I, mul_one, Complex.norm_of_nonneg hσ.1.le, Real.norm_eq_abs] -+ linarith [hσ.2] -+ -+lemma isOpen_aux : IsOpen {z : ℂ | z ≠ 1 ∧ 0 < z.re} := by -+ refine IsOpen.inter isOpen_ne ?_ -+ exact isOpen_lt (g := fun (z : ℂ) ↦ z.re) (by continuity) (by continuity) -+ -+open MeasureTheory in -+lemma integrable_log_over_pow {r : ℝ} (rneg : r < 0) {N : ℕ} (Npos : 0 < N) : -+ IntegrableOn (fun (x : ℝ) ↦ ‖x ^ (r - 1)‖ * ‖Real.log x‖) <| Ioi N := by -+ apply IntegrableOn.mono_set (hst := Set.Ioi_subset_Ici <| le_refl (N : ℝ)) -+ apply LocallyIntegrableOn.integrableOn_of_isBigO_atTop (g := fun x ↦ x ^ (r / 2 - 1)) -+ · apply ContinuousOn.abs ?_ |>.mul ?_ |>.locallyIntegrableOn (by simp) -+ · apply ContinuousOn.rpow (by fun_prop) (by fun_prop) -+ intro x hx; left; contrapose! Npos with h; exact_mod_cast h ▸ mem_Ici.mp hx -+ · apply continuous_id.continuousOn.log ?_ |>.abs -+ intro x hx; simp only [id_eq]; contrapose! Npos with h; exact_mod_cast h ▸ mem_Ici.mp hx -+ · have := isLittleO_log_rpow_atTop (r := -r / 2) (by linarith) |>.isBigO -+ rw [Asymptotics.isBigO_iff_eventually, Filter.eventually_atTop] at this -+ obtain ⟨C, hC⟩ := this -+ have hh := hC C (by simp) -+ rw [Asymptotics.isBigO_atTop_iff_eventually_exists] -+ have := Filter.eventually_atTop.mp hh -+ obtain ⟨x₀, hx₀ ⟩ := this -+ filter_upwards [hh, Filter.mem_atTop x₀, Filter.mem_atTop 1] -+ intro x hx x_gt x_pos -+ use C -+ intro y hy -+ simp only [norm_mul, Real.norm_eq_abs, _root_.abs_abs] -+ simp only [Real.norm_eq_abs] at hx -+ have y_pos : 0 < y := by linarith -+ have : y ^ (r / 2 - 1) = y ^ (r - 1) * y ^ (-r / 2) := by -+ rw [← Real.rpow_add y_pos]; ring_nf -+ rw [this, abs_mul] -+ have y_gt : y ≥ x₀ := by linarith -+ have := hx₀ y y_gt -+ simp only [Real.norm_eq_abs] at this -+ rw [← mul_assoc, mul_comm C, mul_assoc] -+ exact mul_le_mul_of_nonneg_left (hbc := this) (a := |y ^ (r - 1)|) (ha := by simp) -+ · have := integrableOn_Ioi_rpow_iff (s := r / 2 - 1) (t := N) (by simp [Npos]) |>.mpr -+ (by linarith [rneg]) -+ exact integrableOn_Ioi_iff_integrableAtFilter_atTop_nhdsWithin.mp this |>.1 -+ -+open MeasureTheory in -+lemma integrableOn_of_Zeta0_fun_log {N : ℕ} (Npos : 0 < N) {s : ℂ} (s_re_gt : 0 < s.re) : -+ IntegrableOn (fun (x : ℝ) ↦ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1)) * (-Real.log x)) (Ioi N) -+ volume := by -+ simp_rw [mul_assoc] -+ obtain ⟨c, hc⟩ := ZetaSum_aux2a -+ apply Integrable.bdd_mul (c := c) ?_ ?_ ?_ -+ · simp only [neg_add_rev, mul_neg, add_comm, ← sub_eq_add_neg] -+ apply integrable_norm_iff ?_ |>.mp ?_ |>.neg -+ · apply ContinuousOn.mul ?_ ?_ |>.aestronglyMeasurable (by simp) -+ · intro x hx -+ apply ContinuousWithinAt.cpow ?_ continuous_const.continuousWithinAt ?_ -+ · exact RCLike.continuous_ofReal.continuousWithinAt -+ · simp only [ofReal_mem_slitPlane]; linarith [mem_Ioi.mp hx] -+ · apply RCLike.continuous_ofReal.continuousOn.comp ?_ (mapsTo_image _ _) -+ refine continuous_id.continuousOn.log ?_ -+ intro x hx; simp only [id_eq]; linarith [mem_Ioi.mp hx] -+ · simp only [norm_mul, norm_real] -+ have := integrable_log_over_pow (r := -s.re) (by linarith) Npos -+ apply IntegrableOn.congr_fun this ?_ (by simp) -+ intro x hx -+ simp only [mul_eq_mul_right_iff, norm_eq_zero, Real.log_eq_zero] -+ left -+ have xpos : 0 < x := by linarith [mem_Ioi.mp hx] -+ simp [norm_cpow_eq_rpow_re_of_pos xpos, Real.abs_rpow_of_nonneg xpos.le, -+ abs_eq_self.mpr xpos.le] -+ · apply Measurable.add ?_ measurable_const |>.sub (by fun_prop) |>.aestronglyMeasurable -+ exact Measurable.comp (fun _ _ ↦ trivial) Int.measurable_floor -+ · apply MeasureTheory.ae_of_all -+ convert hc with _ x; simp only [← Complex.norm_real]; simp -+ -+open MeasureTheory in -+lemma hasDerivAt_Zeta0Integral {N : ℕ} (Npos : 0 < N) {s : ℂ} (hs : s ∈ {s | 0 < s.re}) : -+ HasDerivAt (fun z ↦ ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-z - 1)) -+ (∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (- s - 1) * (- Real.log x)) s := by -+ simp only [mem_ofPred_eq] at hs -+ set f : ℝ → ℂ := fun x ↦ (⌊x⌋ : ℂ) + 1 / 2 - x -+ set F : ℂ → ℝ → ℂ := fun s x ↦ (x : ℂ) ^ (- s - 1) * f x -+ set F' : ℂ → ℝ → ℂ := fun s x ↦ (x : ℂ) ^ (- s - 1) * (- Real.log x) * f x -+ set ε := s.re / 2 -+ have ε_pos : 0 < ε := by aesop -+ set bound : ℝ → ℝ := fun x ↦ |x ^ (- s.re / 2 - 1)| * |Real.log x| -+ let μ : Measure ℝ := volume.restrict (Ioi (N : ℝ)) -+ have hF_meas : ∀ᶠ (z : ℂ) in 𝓝 s, AEStronglyMeasurable (F z) μ := by -+ have : {z : ℂ | 0 < z.re} ∈ 𝓝 s := by -+ rw [mem_nhds_iff] -+ refine ⟨{z | 0 < z.re}, fun ⦃a⦄ a ↦ a, isOpen_lt continuous_const Complex.continuous_re, hs⟩ -+ filter_upwards [this] with z hz -+ convert! integrableOn_of_Zeta0_fun Npos hz |>.aestronglyMeasurable using 1 -+ simp only [F, f]; ext x; ring_nf -+ have hF_int : Integrable (F s) μ := by -+ convert! integrableOn_of_Zeta0_fun Npos hs |>.integrable using 1 -+ simp only [F, f]; ext x; ring_nf -+ have hF'_meas : AEStronglyMeasurable (F' s) μ := by -+ convert! integrableOn_of_Zeta0_fun_log Npos hs |>.aestronglyMeasurable using 1 -+ simp only [F', f]; ext x; ring_nf -+ have IoiSubIoi1 : (Ioi (N : ℝ)) ⊆ {x | 1 < x} := -+ fun x hx ↦ lt_of_le_of_lt (by simp only [Nat.one_le_cast]; omega) <| mem_Ioi.mp hx -+ have measSetIoi1 : MeasurableSet {x : ℝ | 1 < x} := (isOpen_lt' 1).measurableSet -+ have h_bound1 : -+ ∀ᵐ (x : ℝ) ∂volume.restrict {x | 1 < x}, ∀ z ∈ Metric.ball s ε, ‖F' z x‖ ≤ bound x := by -+ filter_upwards [self_mem_ae_restrict measSetIoi1] with x hx -+ intro z hz -+ simp only [F', f, bound] -+ calc _ = ‖(x : ℂ) ^ (-z - 1)‖ * ‖-(Real.log x)‖ * ‖(⌊x⌋ + 1 / 2 - x)‖ := by -+ simp only [mul_neg, one_div, neg_mul, norm_neg, norm_mul, norm_real, Real.norm_eq_abs, -+ ← (by simp : (((⌊x⌋ + 2⁻¹ - x) : ℝ) : ℂ) = (⌊x⌋ : ℂ) + 2⁻¹ - ↑x), -+ Complex.norm_real] -+ _ = ‖x ^ (-z.re - 1)‖ * ‖-(Real.log x)‖ * ‖(⌊x⌋ + 1 / 2 - x)‖ := ?_ -+ _ = |x ^ (-z.re - 1)| * |(Real.log x)| * |(⌊x⌋ + 1 / 2 - x)| := by simp -+ _ ≤ _ := ?_ -+ · congr! 2 -+ simp only [Real.norm_eq_abs, norm_cpow_eq_rpow_re_of_pos (by linarith), -+ sub_re, neg_re, one_re] -+ apply abs_eq_self.mpr ?_ |>.symm -+ positivity -+ · rw [mul_comm, ← mul_assoc] -+ apply mul_le_mul_of_nonneg_right ?_ <| abs_nonneg _ -+ simp only [Metric.mem_ball, ε, Complex.dist_eq] at hz -+ apply le_trans (b := 1 * |x ^ (-z.re - 1)|) -+ · apply mul_le_mul_of_nonneg_right (le_trans (ZetaSum_aux1_3 _) (by norm_num)) <| abs_nonneg _ -+ · simp_rw [one_mul, Real.abs_rpow_of_nonneg (by linarith : 0 ≤ x)] -+ apply Real.rpow_le_rpow_of_exponent_le <| le_abs.mpr (by left; exact hx.le) -+ have := abs_le.mp <| le_trans (abs_re_le_norm (z-s)) hz.le -+ simp only [sub_re, neg_le_sub_iff_le_add, tsub_le_iff_right] at this -+ linarith [this.1] -+ have h_bound : ∀ᵐ x ∂μ, ∀ z ∈ Metric.ball s ε, ‖F' z x‖ ≤ bound x := by -+ apply ae_restrict_of_ae_restrict_of_subset IoiSubIoi1 -+ exact h_bound1 -+ have bound_integrable : Integrable bound μ := by -+ simp only [bound] -+ convert! integrable_log_over_pow (r := -s.re / 2) (by linarith) Npos using 0 -+ have h_diff : ∀ᵐ x ∂μ, ∀ z ∈ Metric.ball s ε, HasDerivAt (fun w ↦ F w x) (F' z x) z := by -+ simp only [F, F', f] -+ apply ae_restrict_of_ae_restrict_of_subset IoiSubIoi1 -+ filter_upwards [h_bound1, self_mem_ae_restrict measSetIoi1] with x _ one_lt_x -+ intro z hz -+ convert! HasDerivAt.mul_const (c := fun (w : ℂ) ↦ (x : ℂ) ^ (-w-1)) -+ (c' := (x : ℂ) ^ (-z-1) * -Real.log x) (d := (⌊x⌋ : ℝ) + 1 / 2 - x) ?_ using 1 -+ convert! HasDerivAt.comp (h := fun w ↦ -w-1) (h' := -1) (h₂ := fun w ↦ x ^ w) -+ (h₂' := x ^ (-z-1) * Real.log x) (x := z) ?_ ?_ using 0 -+ · simp only [mul_neg, mul_one]; congr! 2 -+ · convert! HasDerivAt.const_cpow (c := (x : ℂ)) (f := fun w ↦ w) (f' := 1) (x := -z-1) -+ (hasDerivAt_id _) ?_ using 1 -+ · simp only [mul_one, mul_eq_mul_left_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq] -+ left -+ rw [Complex.ofReal_log] -+ linarith -+ · right -+ intro h -+ simp only [Metric.mem_ball, ε, Complex.dist_eq, -+ neg_eq_iff_eq_neg.mp <| sub_eq_zero.mp h] at hz -+ have := (abs_le.mp <| le_trans (abs_re_le_norm (-1-s)) hz.le).1 -+ simp only [sub_re, neg_re, one_re, neg_le_sub_iff_le_add, le_neg_add_iff_add_le] at this -+ linarith -+ · apply hasDerivAt_id _ |>.neg |>.sub_const -+ convert! (hasDerivAt_integral_of_dominated_loc_of_deriv_le (F := F) (F' := F') (x₀ := s) -+ (s := Metric.ball s ε) (bound := bound) (μ := μ) (Metric.ball_mem_nhds s ε_pos) -+ hF_meas hF_int hF'_meas h_bound bound_integrable h_diff).2 using 3 -+ · ext a; simp only [one_div, F, f]; ring_nf -+ · simp only [one_div, mul_neg, neg_mul, neg_inj, F', f]; ring_nf -+ -+noncomputable def ζ₀' (N : ℕ) (s : ℂ) : ℂ := -+ ∑ n ∈ Finset.range (N + 1), -1 / (n : ℂ) ^ s * Real.log n + -+ (-N ^ (1 - s) / (1 - s) ^ 2 + Real.log N * N ^ (1 - s) / (1 - s)) + -+ Real.log N * N ^ (-s) / 2 + -+ (1 * (∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (- s - 1)) + -+ s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (- s - 1) * (- Real.log x)) -+ -+lemma HasDerivAt_neg_cpow_over2 {N : ℕ} (Npos : 0 < N) (s : ℂ) : -+ HasDerivAt (fun x : ℂ ↦ -(N : ℂ) ^ (-x) / 2) (-((- Real.log N) * (N : ℂ) ^ (-s)) / 2) s := by -+ convert! hasDerivAt_neg' s |>.const_cpow (c := N) (by aesop) |>.neg |>.div_const _ using 1 -+ simp [mul_comm] -+ -+lemma HasDerivAt_cpow_over_var (N : ℕ) {z : ℂ} (z_ne_zero : z ≠ 0) : -+ HasDerivAt (fun z ↦ -(N : ℂ) ^ z / z) -+ (((N : ℂ) ^ z / z ^ 2) - (Real.log N * N ^ z / z)) z := by -+ simp_rw [div_eq_mul_inv] -+ convert! HasDerivAt.mul (c := fun z ↦ - (N : ℂ) ^ z) (d := fun z ↦ z⁻¹) -+ (c' := - (N : ℂ) ^ z * Real.log N) -+ (d' := - (z ^ 2)⁻¹) ?_ ?_ using 1 -+ · simp only [natCast_log, neg_mul, mul_neg, neg_neg] -+ ring_nf -+ · simp only [natCast_log, neg_mul] -+ apply HasDerivAt.neg -+ convert! HasDerivAt.const_cpow (c := (N : ℂ)) (f := id) (f' := 1) (x := z) (hasDerivAt_id z) -+ (by simp [z_ne_zero]) using 1 -+ simp only [id_eq, mul_one] -+ · exact hasDerivAt_inv z_ne_zero -+ -+lemma HasDerivAtZeta0 {N : ℕ} (Npos : 0 < N) {s : ℂ} (reS_pos : 0 < s.re) (s_ne_one : s ≠ 1) : -+ HasDerivAt (ζ₀ N) (ζ₀' N s) s := by -+ unfold riemannZeta0 ζ₀' -+ apply HasDerivAt.fun_sum ?_ |>.add ?_ |>.add ?_ |>.add ?_ -+ · intro n _ -+ convert! hasDerivAt_neg' s |>.const_cpow (c := n) (by aesop) using 1 -+ all_goals (ring_nf; simp [cpow_neg]) -+ · convert! HasDerivAt.comp (h₂ := fun z ↦ -(N : ℂ) ^ z / z) (h := fun z ↦ 1 - z) (h' := -1) -+ (h₂' := ((N : ℂ) ^ (1 - s) / (1 - s) ^ 2 - Real.log (N : ℝ) * (N : ℂ) ^ (1 - s) / (1 - s))) -+ (x := s) ?_ ?_ using 1 -+ · ring_nf -+ · exact HasDerivAt_cpow_over_var N (by rw [sub_ne_zero]; exact s_ne_one.symm) -+ · convert! hasDerivAt_const s _ |>.sub (hasDerivAt_id _) using 1; simp -+ · convert! HasDerivAt_neg_cpow_over2 Npos s using 1; simp only [natCast_log, neg_mul, neg_neg] -+ · simp_rw [div_cpow_eq_cpow_neg, neg_add, ← sub_eq_add_neg] -+ convert! hasDerivAt_id s |>.mul <| hasDerivAt_Zeta0Integral Npos reS_pos using 1 -+ -+lemma HolomorphicOn_riemannZeta0 {N : ℕ} (N_pos : 0 < N) : -+ HolomorphicOn (ζ₀ N) {s : ℂ | s ≠ 1 ∧ 0 < s.re} := -+ fun _ ⟨hs₁, hs₂⟩ ↦ (HasDerivAtZeta0 N_pos hs₂ hs₁).differentiableAt.differentiableWithinAt -+ -+lemma HolomorphicOn_riemannZeta : -+ HolomorphicOn ζ {s : ℂ | s ≠ 1} := by -+ intro z hz -+ simp only [mem_ofPred_eq] at hz -+ exact (differentiableAt_riemannZeta hz).differentiableWithinAt -+ -+lemma isPathConnected_aux : IsPathConnected {z : ℂ | z ≠ 1 ∧ 0 < z.re} := by -+ use (2 : ℂ) -+ constructor -+ · simp -+ intro w hw; simp only [ne_eq, mem_ofPred_eq] at hw -+ by_cases w_im : w.im = 0 -+ · apply JoinedIn.trans (y := 1 + I) -+ · let f : ℝ → ℂ := fun t ↦ (1 + I) * t + 2 * (1 - t) -+ have cont : Continuous f := by continuity -+ apply JoinedIn.ofLine cont.continuousOn (by simp [f]) (by simp [f]) -+ simp only [unitInterval, ne_eq, image_subset_iff, preimage_ofPred_eq, add_re, mul_re, one_re, -+ I_re, add_zero, ofReal_re, one_mul, add_im, one_im, I_im, zero_add, ofReal_im, mul_zero, -+ sub_zero, re_ofNat, sub_re, im_ofNat, sub_im, sub_self, f] -+ intro x hx; simp only [mem_Icc] at hx -+ refine ⟨?_, by linarith⟩ -+ intro h -+ rw [Complex.ext_iff] at h; simp [(by apply And.right; simpa [w_im] using h : x = 0)] at h -+ · let f : ℝ → ℂ := fun t ↦ w * t + (1 + I) * (1 - t) -+ have cont : Continuous f := by continuity -+ apply JoinedIn.ofLine cont.continuousOn (by simp [f]) (by simp [f]) -+ simp only [unitInterval, ne_eq, image_subset_iff, preimage_ofPred_eq, add_re, mul_re, -+ ofReal_re, ofReal_im, mul_zero, sub_zero, one_re, I_re, add_zero, sub_re, one_mul, add_im, -+ one_im, I_im, zero_add, sub_im, sub_self, f] -+ intro x hx; simp only [mem_Icc] at hx -+ simp only [mem_ofPred_eq] -+ constructor -+ · intro h -+ refine hw.1 ?_ -+ rw [Complex.ext_iff] at h -+ have : x = 1 := by linarith [(by apply And.right; simpa [w_im] using h : 1 - x = 0)] -+ rw [Complex.ext_iff, one_re, one_im]; exact ⟨by simpa [this, w_im] using h, w_im⟩ -+ · by_cases hxx : x = 0 -+ · simp only [hxx]; linarith -+ · have : 0 < x := lt_of_le_of_ne hx.1 (Ne.symm hxx) -+ have : 0 ≤ 1 - x := by linarith -+ have := hw.2 -+ positivity -+ · let f : ℝ → ℂ := fun t ↦ w * t + 2 * (1 - t) -+ have cont : Continuous f := by continuity -+ apply JoinedIn.ofLine cont.continuousOn (by simp [f]) (by simp [f]) -+ simp only [unitInterval, ne_eq, image_subset_iff, preimage_ofPred_eq, add_re, mul_re, ofReal_re, -+ ofReal_im, mul_zero, sub_zero, re_ofNat, sub_re, one_re, im_ofNat, sub_im, one_im, sub_self, -+ f] -+ intro x hx; simp only [mem_Icc] at hx -+ constructor -+ · intro h -+ rw [Complex.ext_iff] at h; -+ simp [(by apply And.right; simpa [w_im] using h : x = 0)] at h -+ · by_cases hxx : x = 0 -+ · simp only [hxx]; linarith -+ · have : 0 < x := lt_of_le_of_ne hx.1 (Ne.symm hxx) -+ have : 0 ≤ 1 - x := by linarith -+ have := hw.2 -+ positivity -+ -+lemma Zeta0EqZeta {N : ℕ} (N_pos : 0 < N) {s : ℂ} (reS_pos : 0 < s.re) (s_ne_one : s ≠ 1) : -+ ζ₀ N s = riemannZeta s := by -+ let f := riemannZeta -+ let g := ζ₀ N -+ let U := {z : ℂ | z ≠ 1 ∧ 0 < z.re} -+ have f_an : AnalyticOnNhd ℂ f U := by -+ apply (HolomorphicOn_riemannZeta.analyticOnNhd isOpen_ne).mono -+ simp only [ne_eq, ofPred_subset_ofPred, and_imp, U] -+ exact fun a ha _ ↦ ha -+ have g_an : AnalyticOnNhd ℂ g U := (HolomorphicOn_riemannZeta0 N_pos).analyticOnNhd isOpen_aux -+ have preconU : IsPreconnected U := by -+ apply IsConnected.isPreconnected -+ apply (IsOpen.isConnected_iff_isPathConnected isOpen_aux).mpr isPathConnected_aux -+ have h2 : (2 : ℂ) ∈ U := by simp [U] -+ have s_mem : s ∈ U := by simp [U, reS_pos, s_ne_one] -+ convert (AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq f_an g_an preconU h2 ?_ s_mem).symm -+ have u_mem : {z : ℂ | 1 < z.re} ∈ 𝓝 (2 : ℂ) := by -+ apply mem_nhds_iff.mpr -+ use {z : ℂ | 1 < z.re} -+ simp only [ofPred_subset_ofPred, imp_self, forall_const, mem_ofPred_eq, re_ofNat, -+ Nat.one_lt_ofNat, and_true, true_and] -+ exact isOpen_lt (by continuity) (by continuity) -+ filter_upwards [u_mem] -+ intro z hz -+ simp only [f,g, zeta_eq_tsum_one_div_nat_cpow hz, riemannZeta0_apply] -+ nth_rewrite 2 [neg_div] -+ rw [← sub_eq_add_neg, ← ZetaSum_aux2 N_pos hz, -+ ← (summable_one_div_nat_cpow.mpr hz).sum_add_tsum_nat_add (N + 1)] -+ norm_cast -+ -+lemma DerivZeta0EqDerivZeta {N : ℕ} (N_pos : 0 < N) {s : ℂ} (reS_pos : 0 < s.re) -+ (s_ne_one : s ≠ 1) : -+ deriv (ζ₀ N) s = ζ' s := by -+ let U := {z : ℂ | z ≠ 1 ∧ 0 < z.re} -+ have {x : ℂ} (hx : x ∈ U) : ζ₀ N x = ζ x := by -+ simp only [mem_ofPred_eq, U] at hx; exact Zeta0EqZeta (N := N) N_pos hx.2 hx.1 -+ refine deriv_eqOn isOpen_aux ?_ (by simp [s_ne_one, reS_pos]) -+ intro x hx -+ have hζ := HolomorphicOn_riemannZeta.mono (by aesop)|>.hasDerivAt (s := U) <| -+ isOpen_aux.mem_nhds hx -+ exact hζ.hasDerivWithinAt.congr (fun y hy ↦ this hy) (this hx) -+ -+lemma le_trans₄ {α : Type*} [Preorder α] {a b c d : α} : a ≤ b → b ≤ c → c ≤ d → a ≤ d := -+ fun hab hbc hcd ↦ le_trans (le_trans hab hbc) hcd -+ -+lemma lt_trans₄ {α : Type*} [Preorder α] {a b c d : α} : a < b → b < c → c < d → a < d := -+ fun hab hbc hcd ↦ lt_trans (lt_trans hab hbc) hcd -+ -+lemma norm_add₅_le {E : Type*} [SeminormedAddGroup E] (a : E) (b : E) (c : E) (d : E) (e : E) : -+ ‖a + b + c + d + e‖ ≤ ‖a‖ + ‖b‖ + ‖c‖ + ‖d‖ + ‖e‖ := by -+ apply le_trans <| norm_add_le (a + b + c + d) e -+ simp only [add_le_add_iff_right]; apply norm_add₄_le -+ -+lemma norm_add₆_le {E : Type*} [SeminormedAddGroup E] (a : E) (b : E) (c : E) (d : E) (e : E) -+ (f : E) : -+ ‖a + b + c + d + e + f‖ ≤ ‖a‖ + ‖b‖ + ‖c‖ + ‖d‖ + ‖e‖ + ‖f‖ := by -+ apply le_trans <| norm_add_le (a + b + c + d + e) f -+ simp only [add_le_add_iff_right]; apply norm_add₅_le -+ -+lemma mul_le_mul₃ {α : Type*} {a b c d e f : α} [MulZeroClass α] [Preorder α] [PosMulMono α] -+ [MulPosMono α] (h₁ : a ≤ b) (h₂ : c ≤ d) (h₃ : e ≤ f) (c0 : 0 ≤ c) (b0 : 0 ≤ b) -+ (e0 : 0 ≤ e) : a * c * e ≤ b * d * f := by -+ apply mul_le_mul (mul_le_mul h₁ h₂ c0 b0) h₃ e0 <| mul_nonneg b0 <| le_trans c0 h₂ -+ -+lemma ZetaBnd_aux2 {n : ℕ} {t A σ : ℝ} (Apos : 0 < A) (σpos : 0 < σ) (n_le_t : n ≤ |t|) -+ (σ_ge : (1 : ℝ) - A / Real.log |t| ≤ σ) : -+ ‖(n : ℂ) ^ (-(σ + t * I))‖ ≤ (n : ℝ)⁻¹ * Real.exp A := by -+ set s := σ + t * I -+ by_cases n0 : n = 0 -+ · simp_rw [n0, CharP.cast_eq_zero, inv_zero, zero_mul] -+ rw [Complex.zero_cpow ?_] -+ · simp -+ · exact fun h ↦ σpos.ne' <| zero_eq_neg.mp <| zero_re ▸ h ▸ (by simp [s]) -+ have n_gt_0 : 0 < n := Nat.pos_of_ne_zero n0 -+ have n_gt_0' : (0 : ℝ) < (n : ℝ) := Nat.cast_pos.mpr n_gt_0 -+ have n_ge_1 : 1 ≤ (n : ℝ) := Nat.one_le_cast.mpr <| Nat.succ_le_of_lt n_gt_0 -+ calc -+ _ = |((n : ℝ) ^ (-σ))| := ?_ -+ _ ≤ Real.exp (Real.log n * -σ) := Real.abs_rpow_le_exp_log_mul (n : ℝ) (-σ) -+ _ ≤ Real.exp (Real.log n * -(1 - A / Real.log t)) := ?_ -+ _ ≤ Real.exp (- Real.log n + A) := Real.exp_le_exp_of_le ?_ -+ _ ≤ _ := by rw [Real.exp_add, Real.exp_neg, Real.exp_log n_gt_0'] -+ · have : ‖(n : ℂ) ^ (-s)‖ = n ^ (-s.re) := norm_cpow_eq_rpow_re_of_pos n_gt_0' (-s) -+ rw [this, abs_eq_self.mpr <| Real.rpow_nonneg n_gt_0'.le _]; simp [s] -+ · apply Real.exp_le_exp_of_le <| mul_le_mul_of_nonneg_left _ <| Real.log_nonneg n_ge_1 -+ rw [neg_sub, neg_le_sub_iff_le_add, add_comm, ← Real.log_abs]; linarith -+ · simp only [neg_sub, le_neg_add_iff_add_le] -+ ring_nf -+ conv => rw [mul_comm, ← mul_assoc, ← Real.log_abs]; rhs; rw [← one_mul A] -+ gcongr -+ by_cases ht1 : |t| = 1 -+ · simp [ht1] -+ apply (inv_mul_le_iff₀ ?_).mpr -+ · convert! Real.log_le_log n_gt_0' n_le_t using 1; rw [mul_one] -+ · exact Real.log_pos <| lt_of_le_of_ne (le_trans n_ge_1 n_le_t) <| fun t ↦ ht1 (t.symm) -+ -+lemma logt_gt_one {t : ℝ} (t_ge : 3 ≤ t) : 1 < Real.log t := -+ (Real.lt_log_iff_exp_lt (by linarith)).mpr (by linarith [Real.exp_one_lt_d9]) -+ -+lemma UpperBnd_aux {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < |t|) -+ (σ_ge : 1 - A / Real.log |t| ≤ σ) : -+ let N := ⌊|t|⌋₊; -+ 0 < N ∧ N ≤ |t| ∧ 1 < Real.log |t| ∧ 1 - A < σ ∧ 0 < σ ∧ σ + t * I ≠ 1 := by -+ intro N -+ have Npos : 0 < N := Nat.floor_pos.mpr (by linarith) -+ have N_le_t : N ≤ |t| := Nat.floor_le <| abs_nonneg _ -+ have logt_gt := logt_gt_one t_gt.le -+ have σ_gt : 1 - A < σ := by -+ apply lt_of_lt_of_le ((sub_lt_sub_iff_left (a := 1)).mpr ?_) σ_ge -+ exact (div_lt_iff₀ (by linarith)).mpr <| lt_mul_right hA.1 logt_gt -+ refine ⟨Npos, N_le_t, logt_gt, σ_gt, by linarith [hA.2], ?_⟩ -+ contrapose! t_gt -+ simp only [Complex.ext_iff, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, -+ sub_self, add_zero, one_re, add_im, mul_im, zero_add, one_im] at t_gt -+ norm_num [t_gt.2] -+ -+lemma UpperBnd_aux2 {A σ t : ℝ} (t_ge : 3 < |t|) (σ_ge : 1 - A / Real.log |t| ≤ σ) : -+ |t| ^ (1 - σ) ≤ Real.exp A := by -+ have : |t| ^ (1 - σ) ≤ |t| ^ (A / Real.log |t|) := -+ Real.rpow_le_rpow_of_exponent_le (by linarith) (by linarith) -+ apply le_trans this ?_ -+ conv => lhs; lhs; rw [← Real.exp_log (by linarith : 0 < |t|)] -+ rw [div_eq_mul_inv, Real.rpow_mul (by positivity), ← Real.exp_mul, ← Real.exp_mul, mul_comm, -+ ← mul_assoc, inv_mul_cancel₀, one_mul] -+ apply Real.log_ne_zero.mpr; split_ands <;> linarith -+ -+lemma riemannZeta0_zero_aux (N : ℕ) (Npos : 0 < N) : -+ ∑ x ∈ Finset.Ico 0 N, ((x : ℝ))⁻¹ = ∑ x ∈ Finset.Ico 1 N, ((x : ℝ))⁻¹ := by -+ have : Finset.Ico 1 N ⊆ Finset.Ico 0 N := by -+ intro x hx -+ simp only [Finset.mem_Ico, Nat.Ico_zero_eq_range, Finset.mem_range] at hx ⊢ -+ exact hx.2 -+ rw [← Finset.sum_sdiff (s₁ := Finset.Ico 1 N) (s₂ := Finset.Ico 0 N) this] -+ have : Finset.Ico 0 N \ Finset.Ico 1 N = Finset.range 1 := by -+ ext a -+ simp only [Nat.Ico_zero_eq_range, Finset.mem_sdiff, Finset.mem_range, Finset.mem_Ico, not_and, -+ not_lt, Finset.range_one, Finset.mem_singleton] -+ exact ⟨fun _ ↦ by omega, fun ha ↦ ⟨by simp [ha, Npos], by omega⟩⟩ -+ rw [this]; simp -+ -+lemma UpperBnd_aux3 {A C σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) -+ (σ_ge : 1 - A / Real.log |t| ≤ σ) (t_gt : 3 < |t|) (hC : 2 ≤ C) : let N := ⌊|t|⌋₊; -+ ‖∑ n ∈ Finset.range (N + 1), (n : ℂ) ^ (-(σ + t * I))‖ ≤ -+ Real.exp A * C * Real.log |t| := by -+ intro N -+ obtain ⟨Npos, N_le_t, _, _, σPos, _⟩ := UpperBnd_aux hA t_gt σ_ge -+ have logt_gt := logt_gt_one t_gt.le -+ have (n : ℕ) (hn : n ∈ Finset.range (N + 1)) := ZetaBnd_aux2 (n := n) hA.1 σPos ?_ σ_ge -+ · replace := norm_sum_le_of_le (Finset.range (N + 1)) this -+ rw [← Finset.sum_mul, mul_comm _ (Real.exp A)] at this -+ rw [mul_assoc] -+ apply le_trans this <| (mul_le_mul_iff_right₀ A.exp_pos).mpr ?_ -+ have : 1 + Real.log (N : ℝ) ≤ C * Real.log |t| := by -+ by_cases hN : N = 1 -+ · simp only [hN, Nat.cast_one, Real.log_one, add_zero] -+ have : 2 * 1 ≤ C * Real.log |t| := mul_le_mul hC logt_gt.le (by linarith) (by linarith) -+ linarith -+ · rw [(by ring : C * Real.log |t| = Real.log |t| + (C - 1) * Real.log |t|), -+ ← one_mul <| Real.log (N: ℝ)] -+ apply add_le_add logt_gt.le -+ refine mul_le_mul (by linarith) ?_ (by positivity) (by linarith) -+ exact Real.log_le_log (by positivity) N_le_t -+ refine le_trans ?_ this -+ convert! harmonic_eq_sum_Icc ▸ harmonic_le_one_add_log N -+ · simp only [Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast, Finset.range_eq_Ico] -+ rw [riemannZeta0_zero_aux (N + 1) (by linarith)]; congr! 1 -+ · simp only [Finset.mem_range] at hn -+ linarith [(by exact_mod_cast (by omega : n ≤ N) : (n : ℝ) ≤ N)] -+ -+lemma Nat.self_div_floor_bound {t : ℝ} (t_ge : 1 ≤ |t|) : let N := ⌊|t|⌋₊; -+ (|t| / N) ∈ Icc 1 2 := by -+ intro N -+ have Npos : 0 < N := Nat.floor_pos.mpr (by linarith) -+ have N_le_t : N ≤ |t| := Nat.floor_le <| abs_nonneg _ -+ constructor -+ · apply le_div_iff₀ (by simp [Npos]) |>.mpr; simp [N_le_t] -+ · apply div_le_iff₀ (by positivity) |>.mpr -+ suffices |t| < N + 1 by linarith [(by exact_mod_cast (by omega) : 1 ≤ (N : ℝ))] -+ apply Nat.lt_floor_add_one -+ -+lemma UpperBnd_aux5 {σ t : ℝ} (t_ge : 3 < |t|) (σ_le : σ ≤ 2) : (|t| / ⌊|t|⌋₊) ^ σ ≤ 4 := by -+ obtain ⟨h₁, h₂⟩ := Nat.self_div_floor_bound (by linarith) -+ calc _ ≤ ((|t| / ↑⌊|t|⌋₊) ^ (2 : ℝ)) := by gcongr -+ _ ≤ (2 : ℝ) ^ (2 : ℝ) := by gcongr -+ _ = 4 := by norm_num -+ -+lemma UpperBnd_aux6 {σ t : ℝ} (t_ge : 3 < |t|) (hσ : σ ∈ Ioc (1 / 2) 2) -+ (neOne : σ + t * I ≠ 1) (Npos : 0 < ⌊|t|⌋₊) (N_le_t : ⌊|t|⌋₊ ≤ |t|) : -+ ⌊|t|⌋₊ ^ (1 - σ) / ‖1 - (σ + t * I)‖ ≤ |t| ^ (1 - σ) * 2 ∧ -+ ⌊|t|⌋₊ ^ (-σ) / 2 ≤ |t| ^ (1 - σ) ∧ ⌊|t|⌋₊ ^ (-σ) / σ ≤ 8 * |t| ^ (-σ) := by -+ have bnd := UpperBnd_aux5 t_ge hσ.2 -+ have bnd' : (|t| / ⌊|t|⌋₊) ^ σ ≤ 2 * |t| := by linarith -+ split_ands -+ · apply (div_le_iff₀ <| norm_pos_iff.mpr <| sub_ne_zero_of_ne neOne.symm).mpr -+ conv => rw [mul_assoc]; rhs; rw [mul_comm] -+ apply (div_le_iff₀ <| Real.rpow_pos_of_pos (by linarith) _).mp -+ rw [div_rpow_eq_rpow_div_neg (by positivity) (by positivity), neg_sub] -+ refine le_trans₄ ?_ bnd' ?_ -+ · exact Real.rpow_le_rpow_of_exponent_le (one_le_div (by positivity) |>.mpr N_le_t) (by simp) -+ · apply (mul_le_mul_iff_right₀ (by norm_num)).mpr; simpa using abs_im_le_norm (1 - (σ + t * I)) -+ · apply div_le_iff₀ (by norm_num) |>.mpr -+ rw [Real.rpow_sub (by linarith), Real.rpow_one, div_mul_eq_mul_div, mul_comm] -+ apply div_le_iff₀ (by positivity) |>.mp -+ convert! bnd' using 1 -+ rw [← Real.rpow_neg (by linarith), div_rpow_neg_eq_rpow_div (by positivity) (by positivity)] -+ · apply div_le_iff₀ (by linarith [hσ.1]) |>.mpr -+ rw [mul_assoc, mul_comm, mul_assoc] -+ apply div_le_iff₀' (by positivity) |>.mp -+ apply le_trans ?_ (by linarith [hσ.1] : 4 ≤ σ * 8) -+ convert! bnd using 1; exact div_rpow_neg_eq_rpow_div (by positivity) (by positivity) -+ -+lemma ZetaUpperBnd' {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < |t|) -+ (hσ : σ ∈ Icc (1 - A / Real.log |t|) 2) : -+ let C := Real.exp A * (5 + 8 * 2); -+ let N := ⌊|t|⌋₊; -+ let s := σ + t * I; -+ ‖∑ n ∈ Finset.range (N + 1), 1 / (n : ℂ) ^ s‖ + ‖(N : ℂ) ^ (1 - s) / (1 - s)‖ -+ + ‖(N : ℂ) ^ (-s) / 2‖ -+ + ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (s + 1)‖ -+ ≤ C * Real.log |t| := by -+ intros C N s -+ obtain ⟨Npos, N_le_t, logt_gt, σ_gt, σPos, neOne⟩ := UpperBnd_aux hA t_gt hσ.1 -+ replace σ_gt : 1 / 2 < σ := by linarith [hA.2] -+ calc -+ _ ≤ Real.exp A * 2 * Real.log |t| + ‖N ^ (1 - s) / (1 - s)‖ + ‖(N : ℂ) ^ (-s) / 2‖ + -+ ‖s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (s + 1)‖ := ?_ -+ _ ≤ Real.exp A * 2 * Real.log |t| + ‖N ^ (1 - s) / (1 - s)‖ + ‖(N : ℂ) ^ (-s) / 2‖ + -+ 2 * |t| * N ^ (-σ) / σ := ?_ -+ _ = Real.exp A * 2 * Real.log |t| + N ^ (1 - σ) / ‖(1 - s)‖ + N ^ (-σ) / 2 + -+ 2 * |t| * N ^ (-σ) / σ := ?_ -+ _ ≤ Real.exp A * 2 * Real.log |t| + |t| ^ (1 - σ) * 2 + -+ |t| ^ (1 - σ) + 2 * |t| * (8 * |t| ^ (-σ)) := ?_ -+ _ = Real.exp A * 2 * Real.log |t| + (3 + 8 * 2) * |t| ^ (1 - σ) := ?_ -+ _ ≤ Real.exp A * 2 * Real.log |t| + (3 + 8 * 2) * Real.exp A * 1 := ?_ -+ _ ≤ Real.exp A * 2 * Real.log |t| + (3 + 8 * 2) * Real.exp A * Real.log |t| := ?_ -+ _ = _ := by ring -+ · simp only [add_le_add_iff_right, one_div_cpow_eq_cpow_neg] -+ convert UpperBnd_aux3 (C := 2) hA hσ.1 t_gt le_rfl using 1 -+ · simp only [add_le_add_iff_left]; exact ZetaBnd_aux1 N (by linarith) ⟨σPos, hσ.2⟩ (by linarith) -+ · simp only [norm_div, RCLike.norm_ofNat, s] -+ congr <;> (convert norm_natCast_cpow_of_pos Npos _; simp) -+ · have ⟨h₁, h₂, h₃⟩ := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t -+ gcongr -+ rw [mul_div_assoc] -+ gcongr -+ · ring_nf; conv => lhs; rhs; lhs; rw [mul_comm |t|] -+ rw [← Real.rpow_add_one (by positivity)]; ring_nf -+ · simp only [Real.log_abs, add_le_add_iff_left, mul_one] -+ exact mul_le_mul_iff_right₀ (by positivity) |>.mpr <| UpperBnd_aux2 t_gt hσ.1 -+ · simp only [add_le_add_iff_left] -+ apply mul_le_mul_iff_right₀ (by norm_num [Real.exp_pos]) |>.mpr <| logt_gt.le -+ -+lemma ZetaUpperBnd : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Icc (1 - A / Real.log |t|) 2), ‖ζ (σ + t * I)‖ ≤ C * Real.log |t| := by -+ let A := (1 / 2 : ℝ) -+ let C := Real.exp A * (5 + 8 * 2) -+ refine ⟨A, ⟨by norm_num, by norm_num⟩, C, (by positivity), ?_⟩ -+ intro σ t t_gt ⟨σ_ge, σ_le⟩ -+ obtain ⟨Npos, _, _, _, σPos, neOne⟩ := UpperBnd_aux ⟨by norm_num, by norm_num⟩ t_gt σ_ge -+ rw [← Zeta0EqZeta Npos (by simp [σPos]) neOne] -+ apply le_trans (by apply norm_add₄_le) ?_ -+ convert! ZetaUpperBnd' ⟨by norm_num, le_rfl⟩ t_gt ⟨σ_ge, σ_le⟩ using 1; simp -+ -+lemma norm_complex_log_ofNat (n : ℕ) : ‖(n : ℂ).log‖ = (n : ℝ).log := by -+ have := Complex.ofReal_log (x := (n : ℝ)) (Nat.cast_nonneg n) -+ rw [(by simp : ((n : ℝ) : ℂ) = (n : ℂ))] at this -+ rw [← this, Complex.norm_of_nonneg] -+ exact Real.log_natCast_nonneg n -+ -+lemma Real.log_natCast_monotone : Monotone (fun (n : ℕ) ↦ Real.log n) := by -+ intro n m hnm -+ cases n -+ · simp only [CharP.cast_eq_zero, Real.log_zero, Real.log_natCast_nonneg] -+ · apply Real.log_le_log <;> simp only [Nat.cast_add, Nat.cast_one] -+ · exact Nat.cast_add_one_pos _ -+ · exact_mod_cast hnm -+ -+lemma Finset.Icc0_eq (N : ℕ) : Finset.Icc 0 N = {0} ∪ Finset.Icc 1 N := by -+ refine Finset.ext_iff.mpr ?_ -+ intro a -+ cases a -+ · simp only [Finset.mem_Icc, le_refl, zero_le, and_self, Finset.mem_union, Finset.mem_singleton, -+ nonpos_iff_eq_zero, one_ne_zero, and_true, or_false] -+ · simp only [Finset.mem_Icc, le_add_iff_nonneg_left, zero_le, true_and, Finset.mem_union, -+ Finset.mem_singleton, add_eq_zero, one_ne_zero, and_false, false_or] -+ -+lemma harmonic_eq_sum_Icc0_aux (N : ℕ) : -+ ∑ i ∈ Finset.Icc 0 N, (i : ℝ)⁻¹ = ∑ i ∈ Finset.Icc 1 N, (i : ℝ)⁻¹ := by -+ rw [Finset.Icc0_eq, Finset.sum_union] -+ · simp only [Finset.sum_singleton, CharP.cast_eq_zero, inv_zero, zero_add] -+ · simp only [Finset.disjoint_singleton_left, Finset.mem_Icc, nonpos_iff_eq_zero, one_ne_zero, -+ zero_le, and_true, not_false_eq_true] -+ -+lemma harmonic_eq_sum_Icc0 (N : ℕ) : ∑ i ∈ Finset.Icc 0 N, (i : ℝ)⁻¹ = (harmonic N : ℝ) := by -+ rw [harmonic_eq_sum_Icc0_aux, harmonic_eq_sum_Icc] -+ simp only [Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast] -+ -+lemma DerivUpperBnd_aux1 {A C σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) -+ (σ_ge : 1 - A / Real.log |t| ≤ σ) (t_gt : 3 < |t|) (hC : 2 ≤ C) : let N := ⌊|t|⌋₊; -+ ‖∑ n ∈ Finset.range (N + 1), -1 / (n : ℂ) ^ (σ + t * I) * (Real.log n)‖ -+ ≤ Real.exp A * C * (Real.log |t|) ^ 2 := by -+ intro N -+ obtain ⟨Npos, N_le_t, _, _, σPos, _⟩ := UpperBnd_aux hA t_gt σ_ge -+ have logt_gt := logt_gt_one t_gt.le -+ have logN_pos : 0 ≤ Real.log N := Real.log_nonneg (by norm_cast) -+ have fact0 {n : ℕ} (hn : n ≤ N) : n ≤ |t| := by linarith [(by exact_mod_cast hn : (n : ℝ) ≤ N)] -+ have fact1 {n : ℕ} (hn : n ≤ N) : -+ ‖(n : ℂ) ^ (-(σ + t * I))‖ ≤ (n : ℝ)⁻¹ * A.exp := ZetaBnd_aux2 hA.1 σPos (fact0 hn) σ_ge -+ have fact2 {n : ℕ} (hn : n ≤ N) : Real.log n ≤ Real.log |t| := by -+ cases n -+ · simp only [CharP.cast_eq_zero, Real.log_zero]; linarith -+ · exact Real.log_le_log (by exact_mod_cast Nat.add_one_pos _) (fact0 hn) -+ have fact3 (n : ℕ) (hn : n ≤ N) : -+ ‖-1 / (n : ℂ) ^ (σ + t * I) * (Real.log n)‖ ≤ (n : ℝ)⁻¹ * Real.exp A * (Real.log |t|) := by -+ convert! mul_le_mul (fact1 hn) (fact2 hn) (Real.log_natCast_nonneg n) (by positivity) -+ simp only [norm_mul, norm_div, norm_neg, norm_one, one_div, natCast_log, ← norm_inv, cpow_neg] -+ congr; exact norm_complex_log_ofNat n -+ have := norm_sum_le_of_le (Finset.range (N + 1)) -+ (by simp only [Finset.mem_range, Nat.lt_succ_iff]; exact fact3) -+ rw [← Finset.sum_mul, ← Finset.sum_mul, mul_comm _ A.exp, mul_assoc] at this -+ rw [mul_assoc] -+ apply le_trans this <| (mul_le_mul_iff_right₀ A.exp_pos).mpr ?_ -+ rw [pow_two, ← mul_assoc, Finset.range_eq_Ico, ← Finset.Icc_eq_Ico, harmonic_eq_sum_Icc0] -+ apply le_trans (mul_le_mul (h₁ := harmonic_le_one_add_log (n := N)) (le_refl (Real.log |t|)) -+ (by linarith) (by linarith)) -+ apply (mul_le_mul_iff_left₀ (by linarith)).mpr -+ rw [(by ring : C * Real.log |t| = Real.log |t| + (C - 1) * Real.log |t|), -+ ← one_mul <| Real.log (N: ℝ)] -+ refine add_le_add logt_gt.le <| mul_le_mul (by linarith) ?_ (by positivity) (by linarith) -+ exact Real.log_le_log (by positivity) N_le_t -+ -+lemma DerivUpperBnd_aux2 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : -+ let N := ⌊|t|⌋₊; -+ let s := ↑σ + ↑t * I; -+ 0 < N → ↑N ≤ |t| → s ≠ 1 → -+ 1 / 2 < σ → ‖-↑N ^ (1 - s) / (1 - s) ^ 2‖ ≤ A.exp * 2 * (1 / 3) := by -+ intro N s Npos N_le_t neOne σ_gt -+ dsimp only [s] -+ simp_rw [norm_div, norm_neg, norm_pow, norm_natCast_cpow_of_pos Npos _, -+ sub_re, one_re, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, -+ mul_one, sub_self, add_zero] -+ have h := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t |>.1 -+ rw [(by ring_nf : N ^ (1 - σ) / ‖1 - (↑σ + ↑t * I)‖ ^ 2 = -+ N ^ (1 - σ) / ‖1 - (↑σ + ↑t * I)‖ * 1 / ‖1 - (↑σ + ↑t * I)‖)] -+ apply mul_le_mul ?_ ?_ (inv_nonneg.mpr <| norm_nonneg _) ?_ -+ · rw [mul_one]; exact le_trans h (by gcongr; exact UpperBnd_aux2 t_gt hσ.1) -+ · rw [inv_eq_one_div, div_le_iff₀ <| norm_pos_iff.mpr <| sub_ne_zero_of_ne neOne.symm, -+ mul_comm, ← mul_div_assoc, mul_one, le_div_iff₀ (by norm_num), one_mul] -+ apply le_trans t_gt.le ?_ -+ rw [← abs_neg]; convert! abs_im_le_norm (1 - (σ + t * I)); simp -+ · exact mul_nonneg (Real.exp_nonneg _) (by norm_num) -+ -+theorem DerivUpperBnd_aux3 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : -+ let N := ⌊|t|⌋₊; -+ let s := ↑σ + ↑t * I; -+ 0 < N → ↑N ≤ |t| → s ≠ 1 → 1 / 2 < σ → -+ ‖↑(N : ℝ).log * ↑N ^ (1 - s) / (1 - s)‖ ≤ A.exp * 2 * |t|.log := by -+ intro N s Npos N_le_t neOne σ_gt -+ rw [norm_div, norm_mul, mul_div_assoc, mul_comm] -+ apply mul_le_mul ?_ ?_ (by positivity) (by positivity) -+ · have h := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t |>.1 -+ convert le_trans h ?_ using 1 -+ · simp [s, norm_natCast_cpow_of_pos Npos _, N] -+ · gcongr; exact UpperBnd_aux2 t_gt hσ.1 -+ · rw [natCast_log, norm_complex_log_ofNat] -+ exact Real.log_le_log (by positivity) N_le_t -+ -+theorem DerivUpperBnd_aux4 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : -+ let N := ⌊|t|⌋₊; -+ let s := ↑σ + ↑t * I; -+ 0 < N → ↑N ≤ |t| → s ≠ 1 → 1 / 2 < σ → -+ ‖↑(N : ℝ).log * (N : ℂ) ^ (-s) / 2‖ ≤ A.exp * |t|.log := by -+ intro N s Npos N_le_t neOne σ_gt -+ rw [norm_div, norm_mul, mul_div_assoc, mul_comm, RCLike.norm_ofNat] -+ apply mul_le_mul ?_ ?_ (by positivity) (by positivity) -+ · have h := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t |>.2.1 -+ convert le_trans h (UpperBnd_aux2 t_gt hσ.1) using 1 -+ simp [s, norm_natCast_cpow_of_pos Npos _, N] -+ · rw [natCast_log, norm_complex_log_ofNat] -+ exact Real.log_le_log (by positivity) N_le_t -+ -+theorem DerivUpperBnd_aux5 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : -+ let N := ⌊|t|⌋₊; -+ let s := ↑σ + ↑t * I; -+ 0 < N → 1 / 2 < σ → -+ ‖1 * ∫ (x : ℝ) in Ioi (N : ℝ), (↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1)‖ ≤ -+ 1 / 3 * (2 * |t| * ↑N ^ (-σ) / σ) := by -+ intro N s Npos σ_gt -+ have neZero : s ≠ 0 := by -+ contrapose! σ_gt -+ simp only [Complex.ext_iff, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, -+ sub_self, add_zero, zero_re, add_im, mul_im, zero_add, zero_im, s] at σ_gt -+ linarith -+ have : 1 = 1 / s * s := by field_simp -+ nth_rewrite 1 [this] -+ rw [mul_assoc, norm_mul] -+ apply mul_le_mul ?_ ?_ (by positivity) (by positivity) -+ · simp only [s, norm_div, norm_one] -+ apply one_div_le_one_div (norm_pos_iff.mpr neZero) (by norm_num) |>.mpr -+ apply le_trans t_gt.le ?_ -+ convert! abs_im_le_norm (σ + t * I); simp -+ · have hσ : σ ∈ Ioc 0 2 := ⟨(by linarith), hσ.2⟩ -+ simp only [s] -+ have := ZetaBnd_aux1 N (by omega) hσ (by linarith) -+ simp only [div_cpow_eq_cpow_neg] at this -+ convert! this using 1; congr; funext x; ring_nf -+ -+theorem DerivUpperBnd_aux6 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : -+ let N := ⌊|t|⌋₊; -+ 0 < N → ↑N ≤ |t| → ↑σ + ↑t * I ≠ 1 → 1 / 2 < σ → -+ 2 * |t| * ↑N ^ (-σ) / σ ≤ 2 * (8 * A.exp) := by -+ intro N Npos N_le_t neOne σ_gt -+ rw [mul_div_assoc, mul_assoc] -+ apply mul_le_mul_iff_right₀ (by norm_num) |>.mpr -+ have h := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t |>.2.2 -+ apply le_trans (mul_le_mul_iff_right₀ (a := |t|) (by positivity) |>.mpr h) ?_ -+ rw [← mul_assoc, mul_comm _ 8, mul_assoc] -+ gcongr -+ convert! UpperBnd_aux2 t_gt hσ.1 using 1 -+ rw [mul_comm, ← Real.rpow_add_one (by positivity)]; ring_nf -+ -+lemma DerivUpperBnd_aux7_1 {x σ t : ℝ} (hx : 1 ≤ x) : -+ let s := ↑σ + ↑t * I; -+ ‖(↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1) * -↑x.log‖ = |(↑⌊x⌋ + 1 / 2 - x)| * x ^ (-σ - 1) * x.log := by -+ have xpos : 0 < x := lt_of_lt_of_le (by norm_num) hx -+ have : ‖(x.log : ℂ)‖ = x.log := Complex.norm_of_nonneg <| Real.log_nonneg hx -+ simp [← norm_real, this, Complex.norm_cpow_eq_rpow_re_of_pos xpos, ← Real.norm_eq_abs, ← ofReal_ofNat, -+ ← ofReal_inv, ← ofReal_add, ← ofReal_sub, ← ofReal_intCast, one_div] -+ -+lemma DerivUpperBnd_aux7_2 {x σ : ℝ} (hx : 1 ≤ x) : -+ |(↑⌊x⌋ + 1 / 2 - x)| * x ^ (-σ - 1) * x.log ≤ x ^ (-σ - 1) * x.log := by -+ rw [← one_mul (x ^ (-σ - 1) * Real.log x), mul_assoc] -+ apply mul_le_mul_of_nonneg_right _ (by bound) -+ exact le_trans (ZetaSum_aux1_3 x) (by norm_num) -+ -+lemma DerivUpperBnd_aux7_3 {x σ : ℝ} (xpos : 0 < x) (σnz : σ ≠ 0) : -+ HasDerivAt (fun t ↦ -(1 / σ ^ 2 * t ^ (-σ) + 1 / σ * t ^ (-σ) * Real.log t)) -+ (x ^ (-σ - 1) * Real.log x) x := by -+ have h1 := Real.hasDerivAt_rpow_const (p := -σ) (Or.inl xpos.ne.symm) -+ have h2 := h1.const_mul (1 / σ^2) -+ have cancel : 1 / σ^2 * σ = 1 / σ := by field_simp -+ rw [neg_mul, mul_neg, ← mul_assoc, cancel] at h2 -+ have h3 := Real.hasDerivAt_log xpos.ne.symm -+ have h4 := HasDerivAt.mul (h1.const_mul (1 / σ)) h3 -+ have cancel := Real.rpow_add xpos (-σ) (-1) -+ have : -σ + -1 = -σ - 1 := by rfl -+ rw [← Real.rpow_neg_one x, mul_assoc (1 / σ) (x ^ (-σ)), ← cancel, this] at h4 -+ convert! h2.add h4 |>.neg using 1 -+ field_simp; ring -+ -+lemma DerivUpperBnd_aux7_3' {a σ : ℝ} (apos : 0 < a) (σnz : σ ≠ 0) : -+ ∀ x ∈ Ici a, HasDerivAt (fun t ↦ -(1 / σ ^ 2 * t ^ (-σ) + 1 / σ * t ^ (-σ) * Real.log t)) -+ (x ^ (-σ - 1) * Real.log x) x := by -+ intro x hx -+ simp at hx -+ exact DerivUpperBnd_aux7_3 (by linarith) σnz -+ -+lemma DerivUpperBnd_aux7_nonneg {a σ : ℝ} (ha : 1 ≤ a) : -+ ∀ x ∈ Ioi a, 0 ≤ x ^ (-σ - 1) * Real.log x := by -+ intro x hx -+ simp at hx -+ bound -+ -+lemma DerivUpperBnd_aux7_tendsto {σ : ℝ} (σpos : 0 < σ) : -+ Tendsto (fun t ↦ -(1 / σ ^ 2 * t ^ (-σ) + 1 / σ * t ^ (-σ) * Real.log t)) atTop (nhds 0) := by -+ have h1 := tendsto_rpow_neg_atTop σpos -+ have h2 := h1.const_mul (1 / σ^2) -+ have h3 : Tendsto (fun t : ℝ ↦ t ^ (-σ) * Real.log t) atTop (nhds 0) := by -+ have := Real.tendsto_pow_log_div_pow_atTop σ 1 σpos -+ simp only [Real.rpow_one] at this -+ apply Tendsto.congr' _ this -+ filter_upwards [eventually_ge_atTop 0] with x hx -+ rw [mul_comm] -+ apply div_rpow_eq_rpow_neg _ _ _ hx -+ have h4 := h3.const_mul (1 / σ) -+ have h5 := (h2.add h4).neg -+ convert h5 using 1 -+ · ext; ring -+ simp -+ -+open MeasureTheory in -+lemma DerivUpperBnd_aux7_4 {a σ : ℝ} (σpos : 0 < σ) (ha : 1 ≤ a) : -+ IntegrableOn (fun x ↦ x ^ (-σ - 1) * Real.log x) (Ioi a) volume := by -+ apply integrableOn_Ioi_deriv_of_nonneg' (l := 0) -+ · exact DerivUpperBnd_aux7_3' (by linarith) (by linarith) -+ · exact DerivUpperBnd_aux7_nonneg ha -+ · exact DerivUpperBnd_aux7_tendsto σpos -+ -+open MeasureTheory in -+lemma DerivUpperBnd_aux7_5 {a σ : ℝ} (σpos : 0 < σ) (ha : 1 ≤ a) : -+ IntegrableOn (fun x ↦ |(↑⌊x⌋ + (1 : ℝ) / 2 - x)| * x ^ (-σ - 1) * Real.log x) -+ (Ioi a) volume := by -+ simp_rw [mul_assoc] -+ apply Integrable.bdd_mul (c := 1 / 2) <| DerivUpperBnd_aux7_4 σpos ha -+ · exact Measurable.aestronglyMeasurable <| Measurable.abs measurable_floor_add_half_sub -+ apply ae_of_all -+ intro x -+ simp only [Real.norm_eq_abs, _root_.abs_abs] -+ exact ZetaSum_aux1_3 x -+ -+open MeasureTheory in -+lemma DerivUpperBnd_aux7_integral_eq {a σ : ℝ} (ha : 1 ≤ a) (σpos : 0 < σ) : -+ ∫ (x : ℝ) in Ioi a, x ^ (-σ - 1) * Real.log x = -+ 1 / σ^2 * a ^ (-σ) + 1 / σ * a ^ (-σ) * Real.log a := by -+ convert integral_Ioi_of_hasDerivAt_of_nonneg' -+ (DerivUpperBnd_aux7_3' (by linarith) (by linarith)) -+ (DerivUpperBnd_aux7_nonneg ha) (DerivUpperBnd_aux7_tendsto σpos) using 1 -+ ring -+ -+open MeasureTheory in -+ -+theorem DerivUpperBnd_aux7 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : -+ let N := ⌊|t|⌋₊; -+ let s := ↑σ + ↑t * I; -+ 0 < N → ↑N ≤ |t| → s ≠ 1 → 1 / 2 < σ → -+ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), (↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1) * -↑x.log‖ ≤ -+ 6 * |t| * ↑N ^ (-σ) / σ * |t|.log := by -+ intro N s Npos N_le_t neOne σ_gt -+ have σpos : 0 < σ := lt_trans (by norm_num) σ_gt -+ rw [norm_mul, (by ring : 6 * |t| * ↑N ^ (-σ) / σ * Real.log |t| = (2 * |t|) * (3 * ↑N ^ (-σ) / σ * Real.log |t|))] -+ apply mul_le_mul _ _ (by positivity) (by positivity) -+ · apply le_trans (by apply norm_add_le) -+ simp [abs_of_pos σpos] -+ linarith [hσ.2] -+ apply le_trans (by apply norm_integral_le_integral_norm) -+ calc ∫ (x : ℝ) in Ioi (N : ℝ), ‖(↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1) * -↑x.log‖ -+ _ = ∫ (x : ℝ) in Ioi (N : ℝ), |(↑⌊x⌋ + 1 / 2 - x)| * x ^ (-σ - 1) * x.log := by -+ apply setIntegral_congr_fun (by measurability) -+ intro x hx -+ simp only [mem_Ioi] at hx -+ exact DerivUpperBnd_aux7_1 (lt_of_le_of_lt (mod_cast Npos) hx).le -+ _ ≤ ∫ (x : ℝ) in Ioi (N : ℝ), x ^ (-σ - 1) * x.log := by -+ apply setIntegral_mono_on _ _ (by measurability) -+ · intro x hx -+ exact DerivUpperBnd_aux7_2 (lt_of_le_of_lt (mod_cast Npos) hx).le -+ · apply DerivUpperBnd_aux7_5 σpos (mod_cast Npos) -+ apply DerivUpperBnd_aux7_4 σpos (mod_cast Npos) -+ _ = 1 / σ^2 * N ^ (-σ) + 1 / σ * N ^ (-σ) * Real.log N := -+ DerivUpperBnd_aux7_integral_eq (mod_cast Npos) σpos -+ _ ≤ 3 * ↑N ^ (-σ) / σ * |t|.log := by -+ have h2 : 1 / σ * ↑N ^ (-σ) * Real.log ↑N ≤ ↑N ^ (-σ) / σ * Real.log |t| := calc -+ _ = ↑N ^ (-σ) / σ * Real.log N := by ring -+ _ ≤ _ := by -+ apply mul_le_mul_of_nonneg_left _ (by positivity) -+ exact Real.log_le_log (mod_cast Npos) N_le_t -+ have : 2 ≤ 2 * Real.log |t| := by -+ nth_rewrite 1 [← mul_one 2] -+ apply mul_le_mul_of_nonneg_left _ (by norm_num) -+ exact logt_gt_one t_gt.le |>.le -+ have h1 : 1 / σ^2 * ↑N ^ (-σ) ≤ 2 * ↑N ^ (-σ) / σ * Real.log |t| := calc -+ 1 / σ^2 * ↑N ^ (-σ) = (↑N ^ (-σ) / σ) * (1 / σ) := by ring -+ _ ≤ ↑N ^ (-σ) / σ * (2 * Real.log |t|):= by -+ apply mul_le_mul_of_nonneg_left _ (by positivity) -+ apply le_trans _ this -+ exact (one_div_le σpos (by norm_num)).mpr σ_gt.le -+ _ = _ := by ring -+ convert! add_le_add h1 h2 using 1 -+ ring -+ -+lemma ZetaDerivUpperBnd' {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < |t|) -+ (hσ : σ ∈ Icc (1 - A / Real.log |t|) 2) : -+ let C := Real.exp A * 59; -+ let N := ⌊|t|⌋₊; -+ let s := σ + t * I; -+ ‖∑ n ∈ Finset.range (N + 1), -1 / (n : ℂ) ^ s * (Real.log n)‖ + -+ ‖-(N : ℂ) ^ (1 - s) / (1 - s) ^ 2‖ + -+ ‖(Real.log N) * (N : ℂ) ^ (1 - s) / (1 - s)‖ + -+ ‖(Real.log N) * (N : ℂ) ^ (-s) / 2‖ + -+ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + -+ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), -+ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ -+ ≤ C * Real.log |t| ^ 2 := by -+ intros C N s -+ obtain ⟨Npos, N_le_t, logt_gt, σ_gt, _, neOne⟩ := UpperBnd_aux hA t_gt hσ.1 -+ replace σ_gt : 1 / 2 < σ := by linarith [hA.2] -+ calc _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + -+ ‖-(N : ℂ) ^ (1 - s) / (1 - s) ^ 2‖ + -+ ‖(Real.log N) * (N : ℂ) ^ (1 - s) / (1 - s)‖ + -+ ‖(Real.log N) * (N : ℂ) ^ (-s) / 2‖ + -+ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + -+ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), -+ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by -+ gcongr; exact DerivUpperBnd_aux1 hA hσ.1 t_gt (by simp : (2 : ℝ) ≤ 2) -+ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + -+ Real.exp A * 2 * (1 / 3) + -+ ‖(Real.log N) * (N : ℂ) ^ (1 - s) / (1 - s)‖ + -+ ‖(Real.log N) * (N : ℂ) ^ (-s) / 2‖ + -+ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + -+ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), -+ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by -+ gcongr; exact DerivUpperBnd_aux2 t_gt hσ Npos N_le_t neOne σ_gt -+ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + -+ Real.exp A * 2 * (1 / 3) + -+ Real.exp A * 2 * (Real.log |t|) + -+ ‖(Real.log N) * (N : ℂ) ^ (-s) / 2‖ + -+ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + -+ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), -+ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by -+ gcongr; exact DerivUpperBnd_aux3 t_gt hσ Npos N_le_t neOne σ_gt -+ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + -+ Real.exp A * 2 * (1 / 3) + -+ Real.exp A * 2 * (Real.log |t|) + -+ Real.exp A * (Real.log |t|) + -+ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + -+ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), -+ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by -+ gcongr; exact DerivUpperBnd_aux4 t_gt hσ Npos N_le_t neOne σ_gt -+ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + -+ Real.exp A * 2 * (1 / 3) + -+ Real.exp A * 2 * (Real.log |t|) + -+ Real.exp A * (Real.log |t|) + -+ 1 / 3 * (2 * |t| * N ^ (-σ) / σ) + -+ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), -+ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by -+ gcongr; exact DerivUpperBnd_aux5 t_gt hσ Npos σ_gt -+ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + -+ Real.exp A * 2 * (1 / 3) + -+ Real.exp A * 2 * (Real.log |t|) + -+ Real.exp A * (Real.log |t|) + -+ 1 / 3 * (2 * (8 * Real.exp A)) + -+ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), -+ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by -+ gcongr; exact DerivUpperBnd_aux6 t_gt hσ Npos N_le_t neOne σ_gt -+ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + -+ Real.exp A * 2 * (1 / 3) + -+ Real.exp A * 2 * (Real.log |t|) + -+ Real.exp A * (Real.log |t|) + -+ 1 / 3 * (2 * (8 * Real.exp A)) + -+ (6 * |t| * N ^ (-σ) / σ) * (Real.log |t|) := by -+ gcongr; exact DerivUpperBnd_aux7 t_gt hσ Npos N_le_t neOne σ_gt -+ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + -+ Real.exp A * 2 * (1 / 3) + -+ Real.exp A * 2 * (Real.log |t|) + -+ Real.exp A * (Real.log |t|) + -+ 1 / 3 * (2 * (8 * Real.exp A)) + -+ (6 * (8 * Real.exp A)) * (Real.log |t|) := by -+ gcongr; convert mul_le_mul_of_nonneg_left (DerivUpperBnd_aux6 t_gt hσ Npos N_le_t neOne σ_gt) (by norm_num : (0 : ℝ) ≤ 3) using 1 <;> ring -+ _ ≤ _ := by -+ simp only [C] -+ ring_nf -+ rw [(by ring : A.exp * |t|.log ^ 2 * 59 = A.exp * |t|.log ^ 2 * 6 + A.exp * |t|.log ^ 2 * 51 + -+ A.exp * |t|.log ^ 2 * 2)] -+ nth_rewrite 1 [← mul_one A.exp] -+ gcongr -+ swap -+ · nth_rewrite 1 [← mul_one |t|.log, (by ring : |t|.log ^ 2 = |t|.log * |t|.log)] -+ gcongr -+ nlinarith -+ -+lemma ZetaDerivUpperBnd : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Icc (1 - A / Real.log |t|) 2), -+ ‖ζ' (σ + t * I)‖ ≤ C * Real.log |t| ^ 2 := by -+ obtain ⟨A, hA, _, _, _⟩ := ZetaUpperBnd -+ let C := Real.exp A * 59 -+ refine ⟨A, hA, C, by positivity, ?_⟩ -+ intro σ t t_gt ⟨σ_ge, σ_le⟩ -+ obtain ⟨Npos, N_le_t, _, _, σPos, neOne⟩ := UpperBnd_aux hA t_gt σ_ge -+ rw [← DerivZeta0EqDerivZeta Npos (by simp [σPos]) neOne] -+ set N : ℕ := ⌊|t|⌋₊ -+ rw [(HasDerivAtZeta0 Npos (s := σ + t * I) (by simp [σPos]) neOne).deriv] -+ dsimp only [ζ₀'] -+ rw [← add_assoc] -+ set aa := ∑ n ∈ Finset.range (N + 1), -1 / (n : ℂ) ^ (σ + t * I) * (Real.log n) -+ set bb := -(N : ℂ) ^ (1 - (σ + t * I)) / (1 - (σ + t * I)) ^ 2 -+ set cc := (Real.log N) * (N : ℂ) ^ (1 - (σ + t * I)) / (1 - (σ + t * I)) -+ set dd := (Real.log N) * (N : ℂ) ^ (-(σ + t * I)) / 2 -+ set ee := 1 * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(σ + t * I) - 1) -+ set ff := (σ + t * I) * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(σ + t * I) - 1) * -(Real.log x) -+ rw [(by ring : aa + (bb + cc) + dd + ee + ff = aa + bb + cc + dd + ee + ff)] -+ apply le_trans (by apply norm_add₆_le) ?_ -+ convert ZetaDerivUpperBnd' hA t_gt ⟨σ_ge, σ_le⟩ -+ -+lemma Tendsto_nhdsWithin_punctured_map_add {f : ℝ → ℝ} (a x : ℝ) -+ (f_mono : StrictMono f) (f_iso : Isometry f) : -+ Tendsto (fun y ↦ f y + a) (𝓝[>] x) (𝓝[>] (f x + a)) := by -+ refine tendsto_iff_forall_eventually_mem.mpr ?_ -+ intro v hv -+ simp only [mem_nhdsWithin] at hv -+ obtain ⟨u, hu, hu2, hu3⟩ := hv -+ let t := {x | f x + a ∈ u} -+ have : t ∩ Ioi x ∈ 𝓝[>] x := by -+ simp only [mem_nhdsWithin] -+ use t -+ simp only [subset_inter_iff, inter_subset_left, inter_subset_right, and_self, -+ and_true, t, mem_ofPred_eq] -+ refine ⟨?_, by simp [hu2]⟩ -+ simp only [Metric.isOpen_iff, gt_iff_lt, mem_ofPred_eq] at hu ⊢ -+ intro x hx -+ obtain ⟨ε, εpos, hε⟩ := hu (f x + a) hx -+ simp only [Metric.ball, ofPred_subset_ofPred] at hε ⊢ -+ exact ⟨ε, εpos, fun _ hy ↦ hε (by simp [isometry_iff_dist_eq.mp f_iso, hy])⟩ -+ filter_upwards [this] -+ intro b hb -+ simp only [mem_inter_iff, mem_ofPred_eq, mem_Ioi, t] at hb -+ refine hu3 ?_ -+ simp only [mem_inter_iff, mem_Ioi, add_lt_add_iff_right] -+ exact ⟨hb.1, f_mono hb.2⟩ -+ -+lemma Tendsto_nhdsWithin_punctured_add (a x : ℝ) : -+ Tendsto (fun y ↦ y + a) (𝓝[>] x) (𝓝[>] (x + a)) := -+ Tendsto_nhdsWithin_punctured_map_add a x strictMono_id isometry_id -+ -+lemma riemannZeta_isBigO_near_one_horizontal : -+ (fun x : ℝ ↦ ζ (1 + x)) =O[𝓝[>] 0] (fun x ↦ (1 : ℂ) / x) := by -+ have : (fun w : ℂ ↦ ζ (1 + w)) =O[𝓝[≠] 0] (1 / ·) := by -+ have H : Tendsto (fun w ↦ w * ζ (1 + w)) (𝓝[≠] 0) (𝓝 1) := by -+ convert Tendsto.comp (f := fun w ↦ 1 + w) riemannZeta_residue_one ?_ using 1 -+ · ext w -+ simp only [Function.comp_apply, add_sub_cancel_left] -+ · refine tendsto_iff_comap.mpr <| map_le_iff_le_comap.mp <| Eq.le ?_ -+ convert Homeomorph.map_punctured_nhds_eq (Homeomorph.addLeft (1 : ℂ)) 0 using 2 <;> simp -+ exact ((Asymptotics.isBigO_mul_iff_isBigO_div eventually_mem_nhdsWithin).mp <| -+ Tendsto.isBigO_one ℂ H).trans <| Asymptotics.isBigO_refl .. -+ exact (isBigO_comp_ofReal_nhds_ne this).mono <| nhdsGT_le_nhdsNE 0 -+ -+lemma ZetaNear1BndFilter : -+ (fun σ : ℝ ↦ ζ σ) =O[𝓝[>](1 : ℝ)] (fun σ ↦ (1 : ℂ) / (σ - 1)) := by -+ have := Tendsto_nhdsWithin_punctured_add (a := -1) (x := 1) -+ simp only [add_neg_cancel, ← sub_eq_add_neg] at this -+ have := riemannZeta_isBigO_near_one_horizontal.comp_tendsto this -+ convert this using 1 <;> {ext; simp} -+ -+lemma ZetaNear1BndExact : -+ ∃ (c : ℝ) (_ : 0 < c), ∀ (σ : ℝ) (_ : σ ∈ Ioc 1 2), ‖ζ σ‖ ≤ c / (σ - 1) := by -+ have := ZetaNear1BndFilter -+ rw [Asymptotics.isBigO_iff] at this -+ obtain ⟨c, U, hU, V, hV, h⟩ := this -+ obtain ⟨T, hT, T_open, h1T⟩ := mem_nhds_iff.mp hU -+ obtain ⟨ε, εpos, hε⟩ := Metric.isOpen_iff.mp T_open 1 h1T -+ simp only [Metric.ball] at hε -+ replace hε : Ico 1 (1 + ε) ⊆ U := by -+ refine subset_trans (subset_trans ?_ hε) hT -+ intro x hx -+ simp only [mem_Ico] at hx -+ simp only [dist, abs_lt] -+ exact ⟨by linarith, by linarith⟩ -+ let W := Icc (1 + ε) 2 -+ have W_compact : IsCompact {ofReal z | z ∈ W} := -+ IsCompact.image isCompact_Icc continuous_ofReal -+ have cont : ContinuousOn ζ {ofReal z | z ∈ W} := by -+ apply HasDerivAt.continuousOn (f' := ζ') -+ intro σ hσ -+ exact (differentiableAt_riemannZeta (by contrapose! hσ; simp [W, hσ, εpos])).hasDerivAt -+ obtain ⟨C, hC⟩ := IsCompact.exists_bound_of_continuousOn W_compact cont -+ let C' := max (C + 1) 1 -+ replace hC : ∀ (σ : ℝ), σ ∈ W → ‖ζ σ‖ < C' := by -+ intro σ hσ -+ simp only [lt_max_iff, C'] -+ have := hC σ -+ simp only [mem_ofPred_eq, ofReal_inj, exists_eq_right] at this -+ exact Or.inl <| lt_of_le_of_lt (this hσ) (by norm_num) -+ have Cpos : 0 < C' := by simp [C'] -+ use max (2 * C') c, (by simp [Cpos]) -+ intro σ ⟨σ_ge, σ_le⟩ -+ by_cases hσ : σ ∈ U ∩ V -+ · simp only [← h, mem_ofPred_eq] at hσ -+ apply le_trans hσ ?_ -+ norm_cast -+ have : 0 ≤ 1 / (σ - 1) := by apply one_div_nonneg.mpr; linarith -+ simp only [Real.norm_eq_abs, abs_eq_self.mpr this, mul_div, mul_one] -+ exact div_le_div₀ (by simp [Cpos.le]) (by simp) (by linarith) (by rfl) -+ · replace hσ : σ ∈ W := by -+ simp only [mem_inter_iff, hV σ_ge, and_true] at hσ -+ simp only [mem_Icc, σ_le, and_true, W] -+ contrapose! hσ; exact hε ⟨σ_ge.le, hσ⟩ -+ apply le_trans (hC σ hσ).le ((le_div_iff₀ (by linarith)).mpr ?_) -+ rw [le_max_iff, mul_comm 2]; exact Or.inl <| mul_le_mul_of_nonneg_left (by linarith) Cpos.le -+ -+lemma norm_zeta_product_ge_one {x : ℝ} (hx : 0 < x) (y : ℝ) : -+ ‖ζ (1 + x) ^ 3 * ζ (1 + x + I * y) ^ 4 * ζ (1 + x + 2 * I * y)‖ ≥ 1 := by -+ have h₀ : 1 < ( 1 + x : ℂ).re := by simp[hx] -+ have h₁ : 1 < (1 + x + I * y).re := by simp [hx] -+ have h₂ : 1 < (1 + x + 2 * I * y).re := by simp [hx] -+ simpa only [one_pow, norm_mul, norm_pow, DirichletCharacter.LSeries_modOne_eq, -+ LSeries_one_eq_riemannZeta, h₀, h₁, h₂] using -+ DirichletCharacter.norm_LSeries_product_ge_one (1 : DirichletCharacter ℂ 1) hx y -+ -+theorem ZetaLowerBound1_aux1 {σ t : ℝ} (this : 1 ≤ ‖ζ σ‖ ^ (3 : ℝ) * ‖ζ (σ + I * t)‖ ^ (4 : ℝ) * ‖ζ (σ + 2 * I * t)‖) : -+ ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) * ‖ζ (σ + t * I)‖ ≥ 1 := by -+ use (one_le_pow_iff_of_nonneg (by bound) four_ne_zero).1 (by_contra (this.not_gt ∘ ?_)) -+ simp_rw [mul_pow, ← Real.rpow_natCast, ← Real.rpow_mul (norm_nonneg _)] -+ norm_num [mul_right_comm, mul_comm (t : ℂ), mul_pow] -+ -+lemma ZetaLowerBound1 {σ t : ℝ} (σ_gt : 1 < σ) : -+ ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) * ‖ζ (σ + t * I)‖ ≥ 1 := by -+ -+ have := norm_zeta_product_ge_one (x := σ - 1) (by linarith) t -+ simp_rw [ge_iff_le, norm_mul, norm_pow, ofReal_sub, ofReal_one, add_sub_cancel, ← Real.rpow_natCast] -+ at this -+ apply ZetaLowerBound1_aux1 this -+ -+lemma ZetaLowerBound2 {σ t : ℝ} (σ_gt : 1 < σ) : -+ 1 / (‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4)) ≤ ‖ζ (σ + t * I)‖ := by -+ have := ZetaLowerBound1 (t := t) σ_gt -+ exact (div_le_iff₀' (pos_of_mul_pos_left (one_pos.trans_le this) (norm_nonneg _) ) ).mpr this -+ -+theorem ZetaLowerBound3_aux1 (A : ℝ) (ha : A ∈ Ioc 0 (1 / 2)) (t : ℝ) -+ (ht_2 : 3 < |2 * t|) : 0 < A / Real.log |2 * t| := by -+ exact div_pos ha.1 <| Real.log_pos (by linarith) -+ -+theorem ZetaLowerBound3_aux2 {C : ℝ} -+ {σ t : ℝ} -+ (ζ_2t_bound : ‖ζ (σ + (2 * t) * I)‖ ≤ C * Real.log |2 * t|) : -+ ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) ≤ (C * Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by -+ bound -+ -+theorem ZetaLowerBound3_aux3 (C : ℝ) (c_near : ℝ) {σ : ℝ} (t : ℝ) (σ_gt : 1 < σ) : -+ c_near ^ ((3 : ℝ) / 4) * ((-1 + σ) ^ ((3 : ℝ) / 4))⁻¹ * C ^ ((1 : ℝ) / 4) * Real.log |t * 2| ^ ((1 : ℝ) / 4) = -+ c_near ^ ((3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * Real.log |t * 2| ^ ((1 : ℝ) / 4) * (-1 + σ) ^ (-(3 : ℝ) / 4) := by -+ exact (symm) (.trans (by rw [neg_div, Real.rpow_neg (by linarith)]) (by ring)) -+ -+theorem ZetaLowerBound3_aux4 (C : ℝ) (hC : 0 < C) -+ (c_near : ℝ) (hc_near : 0 < c_near) {σ : ℝ} (t : ℝ) (ht : 3 < |t|) -+ (σ_gt : 1 < σ) -+ : -+ 0 < c_near ^ ((3 : ℝ) / 4) * (σ - 1) ^ (-(3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * Real.log |2 * t| ^ ((1 : ℝ) / 4) := by -+ match sub_pos.mpr σ_gt with | S => match Real.log_pos (by simp; linarith : abs (2 *t) > 1) with | S => positivity -+ -+theorem ZetaLowerBound3_aux5 -+ {σ : ℝ} (t : ℝ) -+ (this : ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) * ‖ζ (σ + t * I)‖ ≥ 1) : -+ 0 < ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) := -+ pos_of_mul_pos_left (this.trans_lt' zero_lt_one) (norm_nonneg _) -+ -+lemma ZetaLowerBound3 : -+ ∃ c > 0, ∀ {σ : ℝ} (_ : σ ∈ Ioc 1 2) (t : ℝ) (_ : 3 < |t|), -+ c * (σ - 1) ^ ((3 : ℝ) / 4) / (Real.log |t|) ^ ((1 : ℝ) / 4) ≤ ‖ζ (σ + t * I)‖ := by -+ obtain ⟨A, ha, C, hC, h_upper⟩ := ZetaUpperBnd -+ obtain ⟨c_near, hc_near, h_near⟩ := ZetaNear1BndExact -+ -+ use 1 / (c_near ^ ((3 : ℝ) / 4) * (2 * C) ^ ((1 : ℝ) / 4)), by positivity -+ intro σ hσ t ht -+ obtain ⟨σ_gt, σ_le⟩ := hσ -+ -+ have lower := ZetaLowerBound2 (t := t) σ_gt -+ apply le_trans _ lower -+ -+ have ζ_σ_bound : ‖ζ σ‖ ≤ c_near / (σ - 1) := by -+ exact h_near σ ⟨σ_gt, σ_le⟩ -+ -+ have ht_2 : 3 < |2 * t| := by simp only [abs_mul, Nat.abs_ofNat]; linarith -+ -+ have σ_in_range : σ ∈ Icc (1 - A / Real.log |2 * t|) 2 := by -+ constructor -+ · -+ have : 0 < A / Real.log |2 * t| := by -+ exact ZetaLowerBound3_aux1 A ha t ht_2 -+ nlinarith -+ · exact σ_le -+ -+ have ζ_2t_bound := h_upper σ (2 * t) ht_2 σ_in_range -+ -+ have denom_bound : ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) ≤ -+ (c_near / (σ - 1)) ^ ((3 : ℝ) / 4) * (C * Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by -+ apply mul_le_mul -+ · apply Real.rpow_le_rpow (norm_nonneg _) ζ_σ_bound (by norm_num) -+ · apply ZetaLowerBound3_aux2 -+ convert ζ_2t_bound -+ norm_cast -+ · apply Real.rpow_nonneg (norm_nonneg _) -+ · apply Real.rpow_nonneg (div_nonneg (by linarith) (by linarith)) -+ -+ have : (c_near / (σ - 1)) ^ ((3 : ℝ) / 4) * (C * Real.log |2 * t|) ^ ((1 : ℝ) / 4) = -+ c_near ^ ((3 : ℝ) / 4) * (σ - 1) ^ (-(3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * (Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by -+ rw [Real.div_rpow (by linarith) (by linarith), Real.mul_rpow (by linarith) (Real.log_nonneg (by linarith))] -+ ring_nf -+ exact ZetaLowerBound3_aux3 _ _ _ σ_gt -+ rw [this] at denom_bound -+ -+ have pos_left : 0 < c_near ^ ((3 : ℝ) / 4) * (σ - 1) ^ (-(3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * (Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by -+ apply ZetaLowerBound3_aux4 C hC c_near hc_near t ht σ_gt -+ -+ have pos_right : 0 < ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) := by -+ -+ apply ZetaLowerBound3_aux5 _ <| ZetaLowerBound1 (t := t) σ_gt -+ -+ use (div_le_div_of_nonneg_left zero_le_one pos_right denom_bound).trans' ?_ -+ simp_rw [abs_mul, abs_two, neg_div, Real.rpow_neg (sub_pos.2 σ_gt).le] at * -+ have hlog : 0 < Real.log |t| := Real.log_pos <| ht.trans' <| by norm_num -+ have : 0 < Real.log |t| ^ (1 / 4 : ℝ) := Real.rpow_pos_of_pos hlog _ -+ have hlog2 : 0 < Real.log (2 * |t|) := Real.log_pos <| ht_2.trans' <| by norm_num -+ have : 0 < Real.log (2 * |t|) ^ (1 / 4 : ℝ) := Real.rpow_pos_of_pos hlog2 (1 / 4) -+ field_simp -+ rw [Real.mul_rpow two_pos.le hC.le] -+ move_mul [C ^ (1 / 4)] -+ rw [mul_le_mul_iff_left₀] -+ swap -+ · positivity -+ rw [← Real.mul_rpow two_pos.le hlog.le] -+ apply Real.rpow_le_rpow hlog2.le ?_ (by norm_num) -+ rw [← Real.log_rpow (ht.trans' (by norm_num))] -+ apply Real.log_le_log (ht_2.trans' (by norm_num)) -+ rw [Real.rpow_two, sq] -+ gcongr -+ exact ht.trans' (by norm_num) |>.le -+ -+lemma ZetaInvBound1 {σ t : ℝ} (σ_gt : 1 < σ) : -+ 1 / ‖ζ (σ + t * I)‖ ≤ ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) := by -+ apply (div_le_iff₀ ?_).mpr -+ · apply (Real.rpow_le_rpow_iff (z := 4) (by norm_num) ?_ (by norm_num)).mp -+ · simp only [Real.one_rpow] -+ rw [Real.mul_rpow, Real.mul_rpow, ← Real.rpow_mul, ← Real.rpow_mul] -+ · simp only [isUnit_iff_ne_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, -+ IsUnit.div_mul_cancel, Real.rpow_one] -+ conv => rw [mul_assoc]; rhs; rhs; rw [mul_comm] -+ rw [← mul_assoc] -+ have := norm_zeta_product_ge_one (x := σ - 1) (by linarith) t -+ simp_rw [ge_iff_le, norm_mul, norm_pow, ofReal_sub, ofReal_one, add_sub_cancel, ← Real.rpow_natCast] at this -+ convert this using 3 <;> ring_nf -+ any_goals ring_nf -+ any_goals apply norm_nonneg -+ any_goals apply Real.rpow_nonneg <| norm_nonneg _ -+ apply mul_nonneg <;> apply Real.rpow_nonneg <| norm_nonneg _ -+ · refine mul_nonneg (mul_nonneg ?_ ?_) ?_ <;> simp [Real.rpow_nonneg] -+ · have s_ne_one : σ + t * I ≠ 1 := by -+ contrapose! σ_gt; apply le_of_eq; apply And.left; simpa [Complex.ext_iff] using σ_gt -+ simpa using riemannZeta_ne_zero_of_one_le_re (by simp [σ_gt.le]) -+ -+lemma Ioi_union_Iio_mem_cocompact {a : ℝ} (ha : 0 ≤ a) : Ioi (a : ℝ) ∪ Iio (-a : ℝ) ∈ cocompact ℝ := by -+ simp only [Filter.mem_cocompact] -+ use Icc (-a) a -+ constructor -+ · exact isCompact_Icc -+ · rw [@compl_subset_iff_union, ← union_assoc, Icc_union_Ioi_eq_Ici, union_comm, Iio_union_Ici] -+ linarith -+ -+lemma lt_abs_mem_cocompact {a : ℝ} (ha : 0 ≤ a) : {t | a < |t|} ∈ cocompact ℝ := by -+ convert Ioi_union_Iio_mem_cocompact ha using 1; ext t -+ simp only [mem_ofPred_eq, mem_union, mem_Ioi, mem_Iio, lt_abs, lt_neg] -+ -+lemma ZetaInvBound2 : -+ ∃ C > 0, ∀ {σ : ℝ} (_ : σ ∈ Ioc 1 2) (t : ℝ) (_ : 3 < |t|), -+ 1 / ‖ζ (σ + t * I)‖ ≤ C * (σ - 1) ^ (-(3 : ℝ) / 4) * (Real.log |t|) ^ ((1 : ℝ) / 4) := by -+ obtain ⟨A, ha, C, hC, h⟩ := ZetaUpperBnd -+ obtain ⟨c, hc, h_inv⟩ := ZetaNear1BndExact -+ refine ⟨(2 * C) ^ ((1 : ℝ)/ 4) * c ^ ((3 : ℝ)/ 4), by positivity, ?_⟩ -+ intro σ hσ t t_gt -+ obtain ⟨σ_gt, σ_le⟩ := hσ -+ have ht' : 3 < |2 * t| := by simp only [abs_mul, Nat.abs_ofNat]; linarith -+ have hnezero: ((σ - 1) / c) ^ (-3 / 4 : ℝ) ≠ 0 := by -+ have : (σ - 1) / c ≠ 0 := ne_of_gt <| div_pos (by linarith) hc -+ contrapose! this -+ rwa [Real.rpow_eq_zero (div_nonneg (by linarith) hc.le) (by norm_num)] at this -+ calc -+ _ ≤ ‖‖ζ σ‖ ^ (3 / 4 : ℝ) * ‖ζ (↑σ + 2 * ↑t * I)‖ ^ (1 / 4 : ℝ)‖ := ?_ -+ _ ≤ ‖((σ - 1) / c) ^ (-3 / 4 : ℝ) * ‖ζ (↑σ + 2 * ↑t * I)‖ ^ (1 / 4 : ℝ)‖ := ?_ -+ _ ≤ ‖((σ - 1) / c) ^ (-3 / 4 : ℝ) * C ^ (1 / 4 : ℝ) * (Real.log |2 * t|) ^ (1 / 4 : ℝ)‖ := ?_ -+ _ ≤ ‖((σ - 1) / c) ^ (-3 / 4 : ℝ) * C ^ (1 / 4 : ℝ) * (Real.log (|t| ^ 2)) ^ (1 / 4 : ℝ)‖ := ?_ -+ _ = ‖((σ - 1)) ^ (-3 / 4 : ℝ) * c ^ (3 / 4 : ℝ) * (C ^ (1 / 4 : ℝ) * (Real.log (|t| ^ 2)) ^ (1 / 4 : ℝ))‖ := ?_ -+ _ = ‖((σ - 1)) ^ (-3 / 4 : ℝ) * c ^ (3 / 4 : ℝ) * ((2 * C) ^ (1 / 4 : ℝ) * Real.log |t| ^ (1 / 4 : ℝ))‖ := ?_ -+ _ = _ := ?_ -+ · simp only [norm_mul] -+ convert ZetaInvBound1 σ_gt using 2 -+ <;> exact abs_eq_self.mpr <| Real.rpow_nonneg (norm_nonneg _) _ -+ · have bnd1: ‖ζ σ‖ ^ (3 / 4 : ℝ) ≤ ((σ - 1) / c) ^ (-(3 : ℝ) / 4) := by -+ have : ((σ - 1) / c) ^ (-(3 : ℝ) / 4) = (((σ - 1) / c) ^ (-1 : ℝ)) ^ (3 / 4 : ℝ) := by -+ rw [← Real.rpow_mul ?_] -+ · ring_nf -+ · exact div_nonneg (by linarith) hc.le -+ rw [this] -+ apply Real.rpow_le_rpow (by simp [norm_nonneg]) ?_ (by norm_num) -+ convert! h_inv σ ⟨σ_gt, σ_le⟩ using 1; simp [Real.rpow_neg_one, inv_div] -+ simp only [norm_mul] -+ apply (mul_le_mul_iff_left₀ ?_).mpr -+ · convert! bnd1 using 1 -+ · exact abs_eq_self.mpr <| Real.rpow_nonneg (norm_nonneg _) _ -+ · exact abs_eq_self.mpr <| Real.rpow_nonneg (div_nonneg (by linarith) hc.le) _ -+ · apply lt_iff_le_and_ne.mpr ⟨(by simp), ?_⟩ -+ have : ζ (↑σ + 2 * ↑t * I) ≠ 0 := by -+ apply riemannZeta_ne_zero_of_one_le_re (by simp [σ_gt.le]) -+ symm; exact fun h2 ↦ this (by simpa using h2) -+ · replace h := h σ (2 * t) (by simpa using ht') ⟨?_, σ_le⟩ -+ · have : 0 ≤ Real.log |2 * t| := Real.log_nonneg (by linarith) -+ conv => rhs; rw [mul_assoc, ← Real.mul_rpow hC.le this] -+ rw [norm_mul, norm_mul] -+ conv => rhs; rhs; rw [Real.norm_rpow_of_nonneg <| mul_nonneg hC.le this] -+ conv => lhs; rhs; rw [Real.norm_rpow_of_nonneg <| norm_nonneg _] -+ apply (mul_le_mul_iff_right₀ ?_).mpr -+ · apply Real.rpow_le_rpow (norm_nonneg _) ?_ (by norm_num) -+ convert h using 1 -+ · simp -+ · rw [Real.norm_eq_abs, abs_eq_self.mpr <| mul_nonneg hC.le this] -+ · simpa only [Real.norm_eq_abs, abs_pos] -+ · linarith [(div_nonneg ha.1.le (Real.log_nonneg (by linarith)) : 0 ≤ A / Real.log |2 * t|)] -+ · simp only [Real.log_abs, norm_mul] -+ apply (mul_le_mul_iff_right₀ ?_).mpr -+ · rw [← Real.log_abs, Real.norm_rpow_of_nonneg <| Real.log_nonneg (by linarith)] -+ have : 1 ≤ |(|t| ^ 2)| := by -+ simp only [_root_.sq_abs, _root_.abs_pow, one_le_sq_iff_one_le_abs] -+ linarith -+ conv => rhs; rw [← Real.log_abs, Real.norm_rpow_of_nonneg <| Real.log_nonneg this] -+ apply Real.rpow_le_rpow (abs_nonneg _) ?_ (by norm_num) -+ · rw [Real.norm_eq_abs, abs_eq_self.mpr <| Real.log_nonneg (by linarith)] -+ rw [abs_eq_self.mpr <| Real.log_nonneg this, abs_mul, Real.log_abs, Nat.abs_ofNat] -+ apply Real.log_le_log (mul_pos (by norm_num) (by linarith)) (by nlinarith) -+ · apply mul_pos (abs_pos.mpr hnezero) (abs_pos.mpr ?_) -+ have : C ≠ 0 := ne_of_gt hC -+ contrapose! this; rwa [Real.rpow_eq_zero (by linarith) (by norm_num)] at this -+ · have : (-3 : ℝ) / 4 = -((3 : ℝ)/ 4) := by norm_num -+ simp only [norm_mul, mul_eq_mul_right_iff, this, ← mul_assoc]; left; left -+ conv => lhs; rw [Real.div_rpow (by linarith) hc.le, Real.rpow_neg hc.le, div_inv_eq_mul, norm_mul] -+ · simp only [Real.log_pow, Nat.cast_ofNat, norm_mul, Real.norm_eq_abs] -+ congr! 1 -+ rw [Real.mul_rpow (by norm_num) hC.le, Real.mul_rpow (by norm_num) <| -+ Real.log_nonneg (by linarith), abs_mul, abs_mul, ← mul_assoc, mul_comm _ |2 ^ (1 / 4)|] -+ · simp only [norm_mul, Real.norm_eq_abs] -+ have : (2 * C) ^ ((1 : ℝ)/ 4) * c ^ ((3 : ℝ)/ 4) = -+ |(2 * C) ^ ((1 : ℝ)/ 4) * c ^ ((3 : ℝ)/ 4)| := by -+ rw [abs_eq_self.mpr (by apply mul_nonneg <;> (apply Real.rpow_nonneg; linarith))] -+ rw [this, abs_mul, abs_eq_self.mpr (by apply Real.rpow_nonneg; linarith), abs_eq_self.mpr (by positivity), -+ abs_eq_self.mpr (by positivity), abs_eq_self.mpr (by apply Real.rpow_nonneg (Real.log_nonneg (by linarith)))] -+ ring_nf -+ -+lemma deriv_fun_re {t : ℝ} {f : ℂ → ℂ} (diff : ∀ (σ : ℝ), DifferentiableAt ℂ f (↑σ + ↑t * I)) : -+ (deriv fun {σ₂ : ℝ} ↦ f (σ₂ + t * I)) = fun (σ : ℝ) ↦ deriv f (σ + t * I) := by -+ ext σ -+ have := deriv_comp (h := fun (σ : ℝ) ↦ σ + t * I) (h₂ := f) σ (diff σ) ?_ -+ · simp only [deriv_add_const', _root_.Erdos970.deriv_ofReal, mul_one] at this -+ exact this -+ · apply DifferentiableAt.add_const _ <| _root_.Erdos970.Complex.differentiableAt_ofReal σ -+ -+ -+lemma Zeta_eq_int_derivZeta {σ₁ σ₂ t : ℝ} (t_ne_zero : t ≠ 0) : -+ (∫ σ in σ₁..σ₂, ζ' (σ + t * I)) = ζ (σ₂ + t * I) - ζ (σ₁ + t * I) := by -+ have diff : ∀ (σ : ℝ), DifferentiableAt ℂ ζ (σ + t * I) := by -+ intro σ -+ refine differentiableAt_riemannZeta ?_ -+ contrapose! t_ne_zero; apply And.right; simpa [Complex.ext_iff] using t_ne_zero -+ apply intervalIntegral.integral_deriv_eq_sub' -+ · exact deriv_fun_re diff -+ · intro s _ -+ apply DifferentiableAt.comp -+ · exact (diff s).restrictScalars ℝ -+ · exact DifferentiableAt.add_const (c := t * I) <| _root_.Erdos970.Complex.differentiableAt_ofReal _ -+ · apply ContinuousOn.comp (g := ζ') ?_ ?_ (mapsTo_image _ _) -+ · apply HasDerivAt.continuousOn (f' := deriv <| ζ') -+ intro x hx -+ apply hasDerivAt_deriv_iff.mpr -+ replace hx : x ≠ 1 := by -+ contrapose! hx -+ simp only [hx, mem_image, Complex.ext_iff, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, -+ I_im, mul_one, sub_self, add_zero, one_re, add_im, mul_im, zero_add, one_im, not_exists, -+ not_and] -+ exact fun _ _ _ ↦ t_ne_zero -+ exact differentiableAt_deriv_riemannZeta hx -+ · exact continuous_ofReal.continuousOn.add continuousOn_const -+ -+lemma Zeta_diff_Bnd : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ₁ σ₂ : ℝ) (t : ℝ) (_ : 3 < |t|) -+ (_ : 1 - A / Real.log |t| ≤ σ₁) (_ : σ₂ ≤ 2) (_ : σ₁ < σ₂), -+ ‖ζ (σ₂ + t * I) - ζ (σ₁ + t * I)‖ ≤ C * Real.log |t| ^ 2 * (σ₂ - σ₁) := by -+ obtain ⟨A, hA, C, Cpos, hC⟩ := ZetaDerivUpperBnd -+ refine ⟨A, hA, C, Cpos, ?_⟩ -+ intro σ₁ σ₂ t t_gt σ₁_ge σ₂_le σ₁_lt_σ₂ -+ have t_ne_zero : t ≠ 0 := by contrapose! t_gt; simp only [t_gt, abs_zero, Nat.ofNat_nonneg] -+ rw [← Zeta_eq_int_derivZeta t_ne_zero] -+ convert intervalIntegral.norm_integral_le_of_norm_le_const ?_ using 1 -+ · congr; rw [_root_.abs_of_nonneg (by linarith)] -+ · intro σ hσ; rw [uIoc_of_le σ₁_lt_σ₂.le, mem_Ioc] at hσ -+ exact hC σ t t_gt ⟨le_trans σ₁_ge hσ.1.le, le_trans hσ.2 σ₂_le⟩ -+ -+lemma ZetaInvBnd_aux' {t : ℝ} (logt_gt_one : 1 < Real.log |t|) : Real.log |t| < Real.log |t| ^ 9 := by -+ nth_rewrite 1 [← Real.rpow_one <| Real.log |t|] -+ exact mod_cast Real.rpow_lt_rpow_left_iff (y := 1) (z := 9) logt_gt_one |>.mpr (by norm_num) -+ -+lemma ZetaInvBnd_aux {t : ℝ} (logt_gt_one : 1 < Real.log |t|) : Real.log |t| ≤ Real.log |t| ^ 9 := -+ ZetaInvBnd_aux' logt_gt_one |>.le -+ -+lemma ZetaInvBnd_aux2 {A C₁ C₂ : ℝ} (Apos : 0 < A) (C₁pos : 0 < C₁) (C₂pos : 0 < C₂) -+ (hA : A ≤ 1 / 2 * (C₁ / (C₂ * 2)) ^ (4 : ℝ)) : -+ 0 < (C₁ * A ^ (3 / 4 : ℝ) - C₂ * 2 * A)⁻¹ := by -+ simp only [inv_pos, sub_pos] -+ apply div_lt_iff₀ (by positivity) |>.mp -+ rw [div_eq_mul_inv, ← Real.rpow_neg (by positivity), mul_assoc] -+ apply lt_div_iff₀' (by positivity) |>.mp -+ nth_rewrite 1 [← Real.rpow_one A] -+ rw [← Real.rpow_add (by positivity)] -+ norm_num -+ apply Real.rpow_lt_rpow_iff (z := 4) (by positivity) (by positivity) (by positivity) |>.mp -+ rw [← Real.rpow_mul (by positivity)] -+ norm_num -+ apply lt_of_le_of_lt hA -+ rw [div_mul_comm, mul_one, Real.rpow_ofNat] -+ apply half_lt_self -+ positivity -+ -+lemma ZetaInvBnd : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Ico (1 - A / (Real.log |t|) ^ 9) (1 + A / (Real.log |t|) ^ 9)), -+ 1 / ‖ζ (σ + t * I)‖ ≤ C * (Real.log |t|) ^ (7 : ℝ) := by -+ obtain ⟨C', C'pos, hC₁⟩ := ZetaInvBound2 -+ obtain ⟨A', hA', C₂, C₂pos, hC₂⟩ := Zeta_diff_Bnd -+ set C₁ := 1 / C' -+ let A := min A' <| (1 / 2 : ℝ) * (C₁ / (C₂ * 2)) ^ (4 : ℝ) -+ have Apos : 0 < A := by have := hA'.1; positivity -+ have Ale : A ≤ 1 / 2 := by dsimp only [A]; apply min_le_iff.mpr; left; exact hA'.2 -+ set C := (C₁ * A ^ (3 / 4 : ℝ) - C₂ * 2 * A)⁻¹ -+ have Cpos : 0 < C := by -+ refine ZetaInvBnd_aux2 (by positivity) (by positivity) (by positivity) ?_ -+ apply min_le_right -+ refine ⟨A, ⟨Apos, by linarith [hA'.2]⟩ , C, Cpos, ?_⟩ -+ intro σ t t_gt hσ -+ have logt_gt_one := logt_gt_one t_gt.le -+ have σ_ge : 1 - A / Real.log |t| ≤ σ := by -+ apply le_trans ?_ hσ.1 -+ suffices A / Real.log |t| ^ 9 ≤ A / Real.log |t| by linarith -+ exact div_le_div₀ Apos.le (by rfl) (by positivity) <| ZetaInvBnd_aux logt_gt_one -+ obtain ⟨_, _, neOne⟩ := UpperBnd_aux ⟨Apos, Ale⟩ t_gt σ_ge -+ set σ' := 1 + A / Real.log |t| ^ 9 -+ have σ'_gt : 1 < σ' := by simp only [σ', lt_add_iff_pos_right]; positivity -+ have σ'_le : σ' ≤ 2 := by -+ simp only [σ'] -+ suffices A / Real.log |t| ^ 9 < 1 by linarith -+ apply div_lt_one (by positivity) |>.mpr -+ exact lt_trans₄ (by linarith) logt_gt_one <| ZetaInvBnd_aux' logt_gt_one -+ set s := σ + t * I -+ set s' := σ' + t * I -+ by_cases h0 : ‖ζ s‖ ≠ 0 -+ swap -+ · simp only [ne_eq, not_not] at h0; simp only [h0, div_zero]; positivity -+ apply div_le_iff₀ (by positivity) |>.mpr <| div_le_iff₀' (by positivity) |>.mp ?_ -+ have pos_aux : 0 < (σ' - 1) := by linarith -+ calc -+ _ ≥ ‖ζ s'‖ - ‖ζ s - ζ s'‖ := ?_ -+ _ ≥ C₁ * (σ' - 1) ^ ((3 : ℝ)/ 4) * Real.log |t| ^ ((-1 : ℝ)/ 4) - C₂ * Real.log |t| ^ 2 * (σ' - σ) := ?_ -+ _ ≥ C₁ * (A / Real.log |t| ^ (9 : ℝ)) ^ ((3 : ℝ)/ 4) * Real.log |t| ^ ((-1 : ℝ)/ 4) - C₂ * Real.log |t| ^ (2 : ℝ) * 2 * A / Real.log |t| ^ (9 : ℝ) := ?_ -+ _ ≥ C₁ * A ^ ((3 : ℝ)/ 4) * Real.log |t| ^ (-7 : ℝ) - C₂ * 2 * A * Real.log |t| ^ (-7 : ℝ) := ?_ -+ _ = (C₁ * A ^ ((3 : ℝ)/ 4) - C₂ * 2 * A) * Real.log |t| ^ (-7 : ℝ) := by ring -+ _ ≥ _ := ?_ -+ · apply ge_iff_le.mpr -+ convert norm_sub_norm_le (a := ζ s') (b := ζ s' - ζ s) using 1 -+ · rw [(by simp : ζ s' - ζ s = -(ζ s - ζ s'))]; simp only [norm_neg] -+ · simp -+ · apply sub_le_sub -+ · have := one_div_le ?_ (by positivity) |>.mp <| hC₁ ⟨σ'_gt, σ'_le⟩ t t_gt -+ · convert this using 1 -+ rw [one_div, mul_inv_rev, mul_comm, mul_inv_rev, mul_comm _ C'⁻¹] -+ simp only [one_div C', C₁] -+ congr <;> (rw [← Real.rpow_neg (by linarith), neg_div]); rw [neg_neg] -+ · apply norm_pos_iff.mpr <| riemannZeta_ne_zero_of_one_lt_re (by simp [σ'_gt]) -+ · rw [(by simp : ζ s - ζ s' = -(ζ s' - ζ s)), norm_neg] -+ refine hC₂ σ σ' t t_gt ?_ σ'_le <| by rw [Set.mem_Ico] at hσ; exact hσ.2 -+ apply le_trans ?_ hσ.1 -+ rw [tsub_le_iff_right, ← add_sub_right_comm, le_sub_iff_add_le, add_le_add_iff_left] -+ exact div_le_div₀ hA'.1.le (by simp [A]) (by positivity) <| ZetaInvBnd_aux logt_gt_one -+ · apply sub_le_sub (by simp only [add_sub_cancel_left, σ']; exact_mod_cast le_rfl) ?_ -+ rw [mul_div_assoc, mul_assoc _ 2 _] -+ apply mul_le_mul (by exact_mod_cast le_rfl) ?_ (by linarith [hσ.2]) (by positivity) -+ suffices h : σ' + (1 - A / Real.log |t| ^ 9) ≤ (1 + A / Real.log |t| ^ 9) + σ by -+ simp only [tsub_le_iff_right] -+ convert! le_sub_right_of_add_le h using 1; ring_nf; norm_cast; simp -+ exact add_le_add (by linarith) (by linarith [hσ.1]) -+ · simp_rw [tsub_le_iff_right, div_eq_mul_inv _ (Real.log |t| ^ (9 : ℝ))] -+ rw [← Real.rpow_neg (by positivity), Real.mul_rpow (by positivity) (by positivity)] -+ rw [← Real.rpow_mul (by positivity)] -+ ring_nf -+ conv => rhs; lhs; rw [mul_assoc, ← Real.rpow_add (by positivity)] -+ rw [(by ring : C₂ * Real.log |t| ^ (2 : ℝ) * A * Real.log |t| ^ (-9 : ℝ) * 2 = C₂ * (Real.log |t| ^ (2 : ℝ) * Real.log |t| ^ (-9 : ℝ) ) * A * 2)] -+ rw [← Real.rpow_add (by positivity)]; norm_num; group; exact le_rfl -+ · apply div_le_iff₀ (by positivity) |>.mpr -+ conv => rw [mul_assoc]; rhs; rhs; rw [mul_comm C, ← mul_assoc, ← Real.rpow_add (by positivity)] -+ have := inv_inv C ▸ mul_inv_cancel₀ (a := C⁻¹) (by positivity) |>.symm.le -+ simpa [C] using this -+ -+lemma ZetaLowerBnd : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (c : ℝ) (_ : 0 < c), -+ ∀ (σ : ℝ) -+ (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Ico (1 - A / (Real.log |t|) ^ 9) 1), -+ c / (Real.log |t|) ^ (7 : ℝ) ≤ ‖ζ (σ + t * I)‖ := by -+ obtain ⟨C₁, C₁pos, hC₁⟩ := ZetaLowerBound3 -+ obtain ⟨A', hA', C₂, C₂pos, hC₂⟩ := Zeta_diff_Bnd -+ -+ let A := min A' ((C₁ / (4 * C₂)) ^ 4) -+ have hA : A ∈ Ioc 0 (1 / 2) := -+ ⟨lt_min hA'.1 (by positivity), (min_le_left A' _).trans hA'.2⟩ -+ -+ let C := C₁ * A ^ ((3:ℝ) /4) - 2 * C₂ * A -+ have hc_pos : 0 < C := by -+ have:= A.rpow_le_rpow hA.1.le (min_le_right _ _) (inv_pos.mpr four_pos).le -+ erw [Real.pow_rpow_inv_natCast (div_pos C₁pos (mul_pos four_pos C₂pos)).le four_ne_zero, -+ le_div_iff₀ (mul_pos four_pos C₂pos)] at this -+ norm_num [mul_assoc, C, mul_left_comm, C₂pos, hA.1, -+ (mul_le_mul_of_nonneg_right this (A.rpow_nonneg hA.1.le _)).trans_lt', ←A.rpow_add] -+ -+ refine ⟨A, hA, C, hc_pos, fun σ t L ⟨σ_low_bound, σ_le_one⟩=>?_⟩ -+ -+ let σ' := 1 + A / Real.log |t| ^ (9 : ℝ) -+ -+ have triangular : ‖ζ (σ + t * I)‖ ≥ ‖ζ (σ' + t * I)‖ - ‖ζ (σ + t * I) - ζ (σ' + t * I)‖ := by -+ apply sub_le_iff_le_add.mpr.comp (sub_sub_self @_ (@_ : ℂ)▸norm_sub_le _ _).trans -+ (by rw [add_comm]) -+ -+ have one_leLogT : 1 ≤ Real.log |t| := (logt_gt_one L.le).le -+ have one_half_le_log_pow : 1 / 2 ≤ Real.log |t| ^ 9 := -+ one_half_lt_one.le.trans <| one_le_pow₀ one_leLogT -+ -+ have σ'_ge : 1 ≤ σ' := by -+ simp_all only [gt_iff_lt, mem_Ioc, Real.log_abs, one_div, and_imp, tsub_le_iff_right, -+ lt_inf_iff, div_pos_iff_of_pos_left, Nat.ofNat_pos, mul_pos_iff_of_pos_left, pow_pos, -+ and_self, inf_le_iff, true_or, sub_pos, mem_Ico, and_true, ofReal_add, ofReal_one, -+ ofReal_div, ge_iff_le, le_add_iff_nonneg_right, A, C, σ'] -+ apply div_nonneg -+ · apply le_min -+ · linarith -+ · have : (C₁ / (4 * C₂)) ^ 4 = ((C₁ / (4 * C₂)) ^ 2) ^ 2 := by ring -+ rw [this] -+ apply sq_nonneg -+ · positivity -+ -+ have right_sub : -‖ζ (σ + t * I) - ζ (σ' + t * I)‖ ≥ - C₂ * Real.log |t| ^ 2 * (σ' - σ) := by -+ change - C₂ * Real.log |t| ^ 2 * (σ' - σ) ≤ -‖ζ (σ + t * I) - ζ (σ' + t * I)‖ -+ have := hC₂ σ σ' t L ?_ ?_ ?_ -+ · convert! neg_le_neg this using 1 -+ · ring -+ · congr! 1 -+ have : ζ (↑σ + ↑t * I) - ζ (↑σ' + ↑t * I) = -+ - (ζ (↑σ' + ↑t * I) - ζ (↑σ + ↑t * I)) := by ring -+ rw [this, norm_neg] -+ · have : 1 - A' / Real.log |t| ≤ 1 - A / (Real.log |t|) ^ 9 := by -+ gcongr -+ · exact hA'.1.le -+ · bound -+ · bound -+ linarith -+ · have : σ' ≤ 1 + A := by -+ simp_all only [gt_iff_lt, mem_Ioc, Real.log_abs, one_div, and_imp, tsub_le_iff_right, -+ lt_inf_iff, div_pos_iff_of_pos_left, Nat.ofNat_pos, mul_pos_iff_of_pos_left, pow_pos, -+ and_self, inf_le_iff, true_or, sub_pos, mem_Ico, and_true, ofReal_add, ofReal_one, -+ ofReal_div, ge_iff_le, le_add_iff_nonneg_right, add_le_add_iff_left, le_inf_iff, -+ σ', A, C] -+ have : 1 ≤ Real.log t ^ (9 : ℕ) := by -+ bound -+ have : 1 ≤ Real.log t ^ (9 : ℝ) := by -+ exact_mod_cast this -+ refine ⟨?_, ?_⟩ -+ · rw [← min_div_div_right] -+ · rw [min_le_iff] -+ left -+ bound -+ · exact le_trans (zero_le_one) this -+ · rw [← min_div_div_right] -+ · rw [min_le_iff] -+ right -+ bound -+ · exact le_trans (zero_le_one) this -+ · bound [hA.2] -+ · linarith -+ -+ have right' : -‖ζ (σ + t * I) - ζ (σ' + t * I)‖ ≥ - C₂ * 2 * A / Real.log |t| ^ 7 := by -+ have := (abs t).log_pos (by bound) -+ refine right_sub.trans' ((div_le_iff₀ (pow_pos this 7)).2 @?_|>.trans -+ (mul_le_mul_of_nonpos_left (sub_le_sub_left σ_low_bound (1+_) ) -+ (by ·linear_combination C₂*this*(.log |t|)))) -+ exact (mod_cast (by linear_combination (2 *_* A) *div_self ↑(pow_pos this 09).ne')) -+ -+ have left_sub : ‖ζ (σ' + t * I)‖ ≥ C₁ * (σ' - 1) ^ ((3:ℝ) /4) / Real.log |t| ^ 4 := by -+ use (hC₁ ⟨lt_add_of_pos_right (1) (by bound[hA.1]), -+ add_le_of_le_sub_left ((div_le_iff₀ (by bound)).2 (hA.2.trans (?_)))⟩ t L).trans' ?_ -+ · norm_num only [one_mul, Real.rpow_ofNat, one_half_le_log_pow] -+ · simp_all only [gt_iff_lt, mem_Ioc, lt_inf_iff, div_pos_iff_of_pos_left, Nat.ofNat_pos, -+ mul_pos_iff_of_pos_left, pow_pos, and_self, inf_le_iff, true_or, sub_pos, mem_Ico, -+ ofReal_add, ofReal_one, ofReal_div, ge_iff_le, le_add_iff_nonneg_right, neg_mul, -+ neg_le_neg_iff, add_sub_cancel_left, σ', A, C] -+ gcongr -+ have : Real.log |t| ^ ((1 : ℝ) / 4) ≤ Real.log |t| ^ (4 : ℝ) := -+ Real.rpow_le_rpow_of_exponent_le one_leLogT (by norm_num) -+ exact_mod_cast this -+ -+ have left' : ‖ζ (σ' + t * I)‖ ≥ C₁ * A ^ ((3:ℝ) /4) / Real.log |t| ^ 7 := by -+ contrapose! hC₁ -+ use σ', ⟨lt_add_of_pos_right 1<|by bound[hA'.1], -+ add_le_of_le_sub_left ((div_le_iff₀ (by bound)).2 (hA.2.trans ?_))⟩, t, L, hC₁.trans_le ?_ -+ · norm_num only [one_mul, Real.rpow_ofNat, one_half_le_log_pow] -+ · norm_num only [σ', add_sub_cancel_left, A.div_rpow hA.1.le, mul_div, pow_pos, L.trans', -+ ←Real.rpow_natCast, ←Real.rpow_mul, le_of_lt, Real.log_pos, refl, div_div, ←Real.rpow_sub] -+ rw [Real.div_rpow hA.1.le, ← Real.rpow_mul (by linarith), ← mul_div_assoc, div_div, ← Real.rpow_add (by linarith)] -+ · norm_num -+ · apply Real.rpow_nonneg (by linarith) -+ have ineq : ‖ζ (σ + t * I)‖ ≥ (C₁ * A ^ ((3:ℝ) /4) - C₂ * 2 * A) / Real.log |t| ^ 7 := by -+ linear_combination left'+triangular+right' -+ -+ rw [mul_comm C₂] at ineq -+ exact_mod_cast ineq -+ -+lemma ZetaZeroFree : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)), -+ ∀ (σ : ℝ) -+ (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Ico (1 - A / (Real.log |t|) ^ 9) 1), -+ ζ (σ + t * I) ≠ 0 := by -+ obtain ⟨A, hA, c, hc, h_lower⟩ := ZetaLowerBnd -+ -+ refine ⟨A, hA, ?_⟩ -+ -+ intro σ t ht hσ h_zero -+ -+ have := h_lower σ t ht hσ -+ -+ rw [h_zero, norm_zero] at this -+ -+ have pos_bound : 0 < c / (Real.log |t|) ^ (7 : ℝ) := by -+ apply div_pos hc -+ apply Real.rpow_pos_of_pos -+ apply Real.log_pos -+ linarith -+ -+ linarith -+ -+lemma LogDerivZetaBnd : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Ico (1 - A / Real.log |t| ^ 9) (1 + A / Real.log |t| ^ 9)), ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ -+ C * Real.log |t| ^ 9 := by -+ obtain ⟨A, hA, C, hC, h⟩ := ZetaInvBnd -+ obtain ⟨A', hA', C', hC', h'⟩ := ZetaDerivUpperBnd -+ use min A A', ⟨lt_min hA.1 hA'.1, min_le_of_right_le hA'.2⟩, C * C', mul_pos hC hC' -+ intro σ t t_gt ⟨σ_ge, σ_lt⟩ -+ have logt_gt : (1 : ℝ) < Real.log |t| := logt_gt_one t_gt.le -+ have σ_ge' : 1 - A / Real.log |t| ^ 9 ≤ σ := by -+ apply le_trans (tsub_le_tsub_left ?_ 1) σ_ge -+ apply div_le_div_of_nonneg_right (min_le_left A A') -+ exact pow_nonneg (zero_le_one.trans logt_gt.le) _ -+ have σ_ge'' : 1 - A' / Real.log |t| ≤ σ := by -+ apply le_trans (tsub_le_tsub_left ?_ 1) σ_ge -+ apply div_le_div₀ hA'.1.le (min_le_right A A') (lt_trans (by norm_num) logt_gt) ?_ -+ exact le_self_pow₀ logt_gt.le (by norm_num) -+ replace h := h σ t t_gt ⟨σ_ge', by calc -+ σ < 1 + min A A' / Real.log |t| ^ 9 := σ_lt -+ _ ≤ 1 + A / Real.log |t| ^ 9 := by gcongr; simp⟩ -+ replace h' := h' σ t t_gt ⟨σ_ge'', by -+ calc -+ σ ≤ 1 + min A A' / Real.log |t| ^ 9 := by linarith [σ_lt] -+ -+ _ ≤ 1 + (1/2) / Real.log |t| ^ 9 := by gcongr; simp [Set.mem_Ioc] at hA' hA ⊢ ; simp [hA.2] -+ -+ _ ≤ 1 + (1/2) / 1 := by -+ gcongr -+ calc -+ 1 ≤ Real.log |t| := by linarith -+ _ ≤ (Real.log |t|)^9 := Real.self_le_rpow_of_one_le (by linarith) (by linarith) -+ norm_cast -+ -+ _ ≤ 2 := by linarith -+ ⟩ -+ simp only [norm_div] -+ convert! mul_le_mul h h' (by simp) ?_ using 1 <;> (norm_cast; ring_nf); positivity -+ -+lemma ZetaNoZerosOn1Line (t : ℝ) : ζ (1 + t * I) ≠ 0 := by -+ refine riemannZeta_ne_zero_of_one_le_re ?_ -+ simp -+ -+lemma ZetaCont : ContinuousOn ζ (univ \ {1}) := by -+ apply continuousOn_of_forall_continuousAt (fun x hx ↦ ?_) -+ apply DifferentiableAt.continuousAt (𝕜 := ℂ) -+ convert differentiableAt_riemannZeta ?_ -+ simp only [Set.mem_sdiff, mem_univ, mem_singleton_iff, true_and] at hx -+ exact hx -+ -+lemma ZetaNoZerosInBox (T : ℝ) : -+ ∃ (σ : ℝ) (_ : σ < 1), ∀ (t : ℝ) (_ : |t| ≤ T) -+ (σ' : ℝ) (_ : σ' ≥ σ), ζ (σ' + t * I) ≠ 0 := by -+ by_contra! h -+ have hn (n : ℕ) := h (1 - 1 / (n + 1)) (sub_lt_self _ (by positivity)) -+ -+ have : ∃ (tn : ℕ → ℝ) (σn : ℕ → ℝ), (∀ n, σn n ≤ 1) ∧ -+ (∀ n, (1 : ℝ) - 1 / (n + 1) ≤ σn n) ∧ (∀ n, |tn n| ≤ T) ∧ -+ (∀ n, ζ (σn n + tn n * I) = 0) := by -+ choose t ht σ' hσ' hζ using hn -+ refine ⟨t, σ', ?_, hσ', ht, hζ⟩ -+ intro n -+ by_contra! hσn -+ have := riemannZeta_ne_zero_of_one_lt_re (s := σ' n + t n * I) -+ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, -+ add_zero, ne_eq] at this -+ exact this hσn (hζ n) -+ -+ choose t σ' hσ'_le hσ'_ge ht hζ using this -+ -+ have σTo1 : Filter.Tendsto σ' Filter.atTop (𝓝 1) := by -+ use sub_zero (1: ℝ)▸tendsto_order.2 ⟨fun A B=>? _,fun A B=>?_⟩ -+ · apply (((tendsto_inv_atTop_nhds_zero_nat.comp -+ (Filter.tendsto_add_atTop_nat (1))).congr (by norm_num)).const_sub 1).eventually_const_lt -+ B|>.mono (hσ'_ge ·|>.trans_lt') -+ · norm_num[(hσ'_le _).trans_lt, B.trans_le'] -+ -+ have : ∃ (t₀ : ℝ) (subseq : ℕ → ℕ), -+ Filter.Tendsto (t ∘ subseq) Filter.atTop (𝓝 t₀) ∧ -+ Filter.Tendsto subseq Filter.atTop Filter.atTop := by -+ refine (isCompact_Icc.isSeqCompact fun and => abs_le.1 (ht and)).imp fun and ⟨x, A, B, _⟩ => ?_ -+ use A, by omega, B.tendsto_atTop -+ -+ obtain ⟨t₀, subseq, tTendsto, subseqTendsto⟩ := this -+ -+ have σTo1 : Filter.Tendsto (σ' ∘ subseq) Filter.atTop (𝓝 1) := -+ σTo1.comp subseqTendsto -+ -+ have (n : ℕ) : ζ (σ' (subseq n) + I * (t (subseq n))) = 0 := by -+ convert hζ (subseq n) using 3 -+ ring -+ -+ have ToOneT0 : Filter.Tendsto (fun n ↦ (σ' (subseq n) : ℂ) + Complex.I * (t (subseq n))) Filter.atTop -+ (𝓝[≠]((1 : ℂ) + I * t₀)) := by -+ simp_rw [tendsto_nhdsWithin_iff, Function.comp_def] at tTendsto ⊢ -+ constructor -+ · exact (σTo1.ofReal.add (tTendsto.ofReal.const_mul _)).trans (by simp) -+ · filter_upwards with n -+ apply ne_of_apply_ne ζ -+ rw [this] -+ apply Ne.symm -+ apply riemannZeta_ne_zero_of_one_le_re -+ simp only [add_re, one_re, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, -+ sub_self, add_zero, le_refl] -+ -+ by_cases ht₀ : t₀ = 0 -+ · have ZetaBlowsUp : ∀ᶠ s in 𝓝[≠](1 : ℂ), ‖ζ s‖ ≥ 1 := by -+ simp_all only [ge_iff_le, one_div, tsub_le_iff_right, Function.comp_def, ofReal_zero, -+ mul_zero, add_zero, norm_eq_sqrt_real_inner, Complex.inner, mul_re, conj_re, conj_im, -+ mul_neg, sub_neg_eq_add, Real.one_le_sqrt, eventually_nhdsWithin_iff, mem_compl_iff, -+ mem_singleton_iff] -+ contrapose! h -+ simp_all only [ne_eq] -+ delta abs at* -+ exfalso -+ simp_rw [Metric.nhds_basis_ball.frequently_iff]at* -+ choose! I A B using h -+ choose a s using exists_seq_strictAnti_tendsto (0: ℝ) -+ apply ((isCompact_closedBall _ _).isSeqCompact -+ fun and=>(A _ (s.2.1 and)).le.trans (s.2.2.bddAbove_range.some_mem ⟨and, rfl⟩)).elim -+ simp only [Metric.mem_ball, dist_eq_norm_sub] at A -+ refine fun and ⟨a, H, S, M⟩=> ?_ -+ refine absurd (tendsto_nhds_unique M (tendsto_sub_nhds_zero_iff.1 -+ (( squeeze_zero_norm fun and=>le_of_lt (A _ (s.2.1 _) ) ) -+ (s.2.2.comp S.tendsto_atTop)))) fun and=>?_ -+ norm_num[*,Function.comp_def] at M -+ have:=@riemannZeta_residue_one -+ use one_ne_zero (tendsto_nhds_unique (this.comp (tendsto_nhdsWithin_iff.2 -+ ⟨ M,.of_forall (by norm_num[*])⟩)) ( squeeze_zero_norm ?_ -+ ((M.sub_const 1).norm.trans (by rw [sub_self,norm_zero])))) -+ use fun and =>.trans (norm_mul_le_of_le ↑(le_rfl) (Complex.norm_def _▸Real.sqrt_le_one.mpr -+ (B ↑_ (s.2.1 ↑_)).right.le)) (by rw [mul_one]) -+ -+ have ZetaNonZ : ∀ᶠ s in 𝓝[≠](1 : ℂ), ζ s ≠ 0 := by -+ filter_upwards [ZetaBlowsUp] -+ intro s hs hfalse -+ rw [hfalse] at hs -+ simp only [norm_zero, ge_iff_le] at hs -+ linarith -+ -+ rw [ht₀] at ToOneT0 -+ simp only [ofReal_zero, mul_zero, add_zero] at ToOneT0 -+ rcases (ToOneT0.eventually ZetaNonZ).exists with ⟨n, hn⟩ -+ exact hn (this n) -+ -+ · have zetaIsZero : ζ (1 + Complex.I * t₀) = 0 := by -+ have cont := @ZetaCont -+ use isClosed_singleton.isSeqClosed -+ this -+ (.comp -+ (cont.continuousAt.comp (eventually_ne_nhds (by field_simp; simp [ht₀])).mono -+ fun and=>.intro ⟨⟩) -+ (ToOneT0.trans (inf_le_left))) -+ -+ exact riemannZeta_ne_zero_of_one_le_re (s := 1 + I * t₀) (by simp) zetaIsZero -+ -+lemma LogDerivZetaHoloOn {S : Set ℂ} (s_ne_one : 1 ∉ S) -+ (nonzero : ∀ s ∈ S, ζ s ≠ 0) : -+ HolomorphicOn (fun s ↦ ζ' s / ζ s) S := by -+ apply DifferentiableOn.div _ _ nonzero <;> intro s hs <;> apply DifferentiableAt.differentiableWithinAt -+ · apply differentiableAt_deriv_riemannZeta -+ exact ne_of_mem_of_not_mem hs s_ne_one -+ · apply differentiableAt_riemannZeta -+ exact ne_of_mem_of_not_mem hs s_ne_one -+ -+theorem LogDerivZetaHolcSmallT : -+ ∃ (σ₂ : ℝ) (_ : σ₂ < 1), HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) -+ (( [[ σ₂, 2 ]] ×ℂ [[ -3, 3 ]]) \ {1}) := by -+ obtain ⟨σ₂, hσ₂_lt_one, hζ_ne_zero⟩ := ZetaNoZerosInBox 3 -+ refine ⟨σ₂, hσ₂_lt_one, ?_⟩ -+ let U := ([[σ₂, 2]] ×ℂ [[-3, 3]]) \ {1} -+ have s_in_U_im_le3 : ∀ s ∈ U, |s.im| ≤ 3 := by -+ intro s hs -+ rw [Set.mem_sdiff_singleton] at hs -+ rcases hs with ⟨hbox, _hne⟩ -+ rcases hbox with ⟨hre, him⟩ -+ simp only [Set.mem_preimage] at him -+ obtain ⟨him_lower, him_upper⟩ := him -+ apply abs_le.2 -+ simp only [neg_le_self_iff, Nat.ofNat_nonneg, inf_of_le_left] at him_lower -+ simp only [neg_le_self_iff, Nat.ofNat_nonneg, sup_of_le_right] at him_upper -+ exact ⟨him_lower, him_upper⟩ -+ -+ have s_in_U_re_ges2 : ∀ s ∈ U, σ₂ ≤ s.re := by -+ intro s hs -+ rw [Set.mem_sdiff_singleton] at hs -+ rcases hs with ⟨hbox, _hne⟩ -+ rcases hbox with ⟨hre, _him⟩ -+ simp only [Set.mem_preimage] at hre -+ obtain ⟨hre_lower, hre_upper⟩ := hre -+ have : min σ₂ 2 = σ₂ := by -+ apply min_eq_left -+ linarith [hσ₂_lt_one] -+ rwa [← this] -+ -+ apply LogDerivZetaHoloOn -+ · exact Set.notMem_sdiff_of_mem rfl -+ · intro s hs -+ rw[← re_add_im s] -+ apply hζ_ne_zero -+ · apply s_in_U_im_le3 _ hs -+ · apply s_in_U_re_ges2 _ hs -+ -+theorem LogDerivZetaHolcLargeT : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)), ∀ (T : ℝ) (_ : 3 ≤ T), -+ HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) -+ (( (Icc ((1 : ℝ) - A / Real.log T ^ 9) 2) ×ℂ (Icc (-T) T) ) \ {1}) := by -+ obtain ⟨A, A_inter, restOfZetaZeroFree⟩ := ZetaZeroFree -+ obtain ⟨σ₁, σ₁_lt_one, noZerosInBox⟩ := ZetaNoZerosInBox 3 -+ let A₀ := min A ((1 - σ₁) * Real.log 3 ^ 9) -+ refine ⟨A₀, ?_, ?_⟩ -+ · constructor -+ · apply lt_min A_inter.1 -+ bound -+ · exact le_trans (min_le_left _ _) A_inter.2 -+ intro T hT -+ apply LogDerivZetaHoloOn -+ · exact Set.notMem_sdiff_of_mem rfl -+ intro s hs -+ rcases le_or_gt 1 s.re with one_le|lt_one -+ · exact riemannZeta_ne_zero_of_one_le_re one_le -+ rw [← re_add_im s] -+ have := Complex.mem_reProdIm.mp hs.1 -+ rcases lt_or_ge 3 |s.im| with gt3|le3 -+ · apply restOfZetaZeroFree _ _ gt3 -+ refine ⟨?_, lt_one⟩ -+ calc -+ _ ≤ 1 - A₀ / Real.log T ^ 9 := by -+ gcongr -+ · exact A_inter.1.le -+ · bound -+ · bound -+ · bound -+ · exact abs_le.mpr ⟨this.2.1, this.2.2⟩ -+ _ ≤ _:= by exact this.1.1 -+ -+ · apply noZerosInBox _ le3 -+ calc -+ _ ≥ 1 - A₀ / Real.log T ^ 9 := by exact this.1.1 -+ _ ≥ 1 - A₀ / Real.log 3 ^ 9 := by -+ gcongr -+ apply le_min A_inter.1.le -+ bound -+ _ ≥ 1 - (((1 - σ₁) * Real.log 3 ^ 9)) / Real.log 3 ^ 9:= by -+ gcongr -+ apply min_le_right -+ _ = _ := by field_simp; simp -+ -+theorem summable_complex_then_summable_real_part (f : ℕ → ℂ) -+ (h : Summable f) : Summable (fun n ↦ (f n).re) := by -+ rcases h with ⟨s, hs⟩ -+ exact ⟨s.re, hasSum_re hs⟩ -+ -+open ArithmeticFunction (vonMangoldt) -+local notation "Λ" => vonMangoldt -+ -+open scoped ComplexOrder in -+theorem dlog_riemannZeta_bdd_on_vertical_lines_generalized -+ (σ₀ σ₁ t : ℝ) (σ₀_gt_one : 1 < σ₀) (σ₀_lt_σ₁ : σ₀ ≤ σ₁) : -+ ‖(- ζ' (σ₁ + t * I) / ζ (σ₁ + t * I))‖ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by -+ let s₁ := σ₁ + t * I -+ have s₁_re_eq_sigma : s₁.re = σ₁ := by -+ rw [add_re, ofReal_re, mul_I_re, ofReal_im] -+ ring -+ -+ have s₀_re_eq_sigma : (↑σ₀ : ℂ).re = σ₀ := by -+ rw [ofReal_re] -+ -+ let s₀ := σ₀ -+ -+ have σ₁_gt_one : 1 < σ₁ := by exact lt_of_le_of_lt' σ₀_lt_σ₁ σ₀_gt_one -+ have s₀_gt_one : 1 < (↑σ₀ : ℂ).re := by exact σ₀_gt_one -+ -+ have s₁_re_geq_one : 1 < s₁.re := by exact lt_of_lt_of_eq σ₁_gt_one (id (Eq.symm s₁_re_eq_sigma)) -+ rw [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₁_re_geq_one)] -+ unfold LSeries -+ -+ have summable_von_mangoldt_at_σ₀ : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i) := by -+ exact ArithmeticFunction.LSeriesSummable_vonMangoldt σ₀_gt_one -+ -+ have summable_re_von_mangoldt_at_σ₀ : -+ Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i).re) := by -+ exact summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) σ₀) -+ summable_von_mangoldt_at_σ₀ -+ -+ have summable_abs_value : Summable (fun i ↦ ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ i‖) := by -+ rw [summable_norm_iff] -+ exact ArithmeticFunction.LSeriesSummable_vonMangoldt s₁_re_geq_one -+ apply le_trans <| norm_tsum_le_tsum_norm summable_abs_value -+ rw [← norm_neg, ← neg_div, ← ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₀_gt_one] -+ unfold LSeries -+ rw [← re_eq_norm.mpr, re_tsum summable_von_mangoldt_at_σ₀] -+ · apply Summable.tsum_mono summable_abs_value summable_re_von_mangoldt_at_σ₀ -+ intro n -+ beta_reduce -+ apply le_trans <| LSeries.norm_term_le_of_re_le_re (s := σ₀) _ _ _ -+ · rw [re_eq_norm.mpr] -+ apply LSeries.term_nonneg -+ exact_mod_cast ArithmeticFunction.vonMangoldt_nonneg -+ · rwa [s₁_re_eq_sigma, s₀_re_eq_sigma] -+ · apply tsum_nonneg -+ intro n -+ apply LSeries.term_nonneg -+ exact_mod_cast ArithmeticFunction.vonMangoldt_nonneg -+ -+theorem triv_bound_zeta : ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → -+ ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ (σ₀ - 1)⁻¹ + C := by -+ let ⟨U, ⟨U_in_nhds, zeta_residue_on_U⟩⟩ := riemannZetaLogDerivResidue -+ let ⟨open_in_U, ⟨open_in_U_subs_U, open_in_U_is_open, one_in_open_U⟩⟩ := -+ mem_nhds_iff.mp U_in_nhds -+ let ⟨ε₀, ⟨ε_pos, metric_ball_around_1_is_in_U'⟩⟩ := -+ EMetric.isOpen_iff.mp open_in_U_is_open (1 : ℂ) one_in_open_U -+ -+ let ε := if ε₀ = ⊤ then ENNReal.ofReal 1 else ε₀ -+ have O1 : ε ≠ ⊤ := by -+ unfold ε -+ by_cases h : ε₀ = ⊤ <;> simp [*] -+ -+ have metric_ball_around_1_is_in_U : -+ Metric.eball (1 : ℂ) ε ⊆ U := by -+ unfold ε -+ by_cases h : ε₀ = ⊤ -+ · simp only [↓reduceIte, ENNReal.ofReal_one, h] -+ have T : Metric.eball (1 : ℂ) 1 ⊆ Metric.eball 1 ε₀ := by -+ simp [*] -+ exact subset_trans (subset_trans T metric_ball_around_1_is_in_U') open_in_U_subs_U -+ -+ · simp only [h, ↓reduceIte] -+ exact subset_trans metric_ball_around_1_is_in_U' open_in_U_subs_U -+ -+ have O2 : ε ≠ 0 := by -+ unfold ε -+ by_cases h : ε₀ = ⊤ -+ · simp [*] -+ · simp only [↓reduceIte, ne_eq, h] -+ exact pos_iff_ne_zero.mp ε_pos -+ -+ let metric_ball_around_1 := Metric.eball (1 : ℂ) ε -+ let ε_div_two := ε / 2 -+ let boundary := ENNReal.toReal (1 + ε_div_two) -+ -+ let ⟨bound, ⟨bound_pos, bound_prop⟩⟩ := -+ BddAbove.exists_ge zeta_residue_on_U 0 -+ -+ have boundary_geq_one : 1 < boundary := by -+ unfold boundary -+ have Z : (1 : ENNReal).toReal = 1 := by rfl -+ rw [←Z] -+ have U : ε_div_two ≠ ⊤ := by -+ refine ENNReal.div_ne_top O1 ?_ -+ simp -+ simp only [ENNReal.toReal_one, ne_eq, ENNReal.one_ne_top, not_false_eq_true, -+ ENNReal.toReal_add _ U, lt_add_iff_pos_right, gt_iff_lt] -+ refine ENNReal.toReal_pos ?_ ?_ -+ · unfold ε_div_two -+ simp [*] -+ · exact U -+ -+ let const : ℝ := bound -+ let final_const : ℝ := (boundary - 1)⁻¹ + const -+ have final_const_pos : final_const ≥ 0 := by bound -+ have const_le_final_const : const ≤ final_const := by bound -+ -+ refine ⟨final_const, final_const_pos, fun σ₀ t σ₀_gt ↦ ?_⟩ -+ have U4 : ENNReal.ofReal 1 ≠ ⊤ := by exact ENNReal.ofReal_ne_top -+ have Z0 : ε_div_two.toReal < ε.toReal := by -+ exact ENNReal.toReal_strict_mono O1 <| ENNReal.half_lt_self O2 O1 -+ -+ by_cases! h : σ₀ ≤ boundary -+ · have σ₀_in_ball : (↑σ₀ : ℂ) ∈ metric_ball_around_1 := by -+ unfold metric_ball_around_1 -+ unfold Metric.eball -+ simp only [mem_ofPred_eq] -+ rw [edist_dist, dist_eq_norm] -+ norm_cast -+ have U : 0 ≤ σ₀ - 1 := by linarith -+ simp only [Real.norm_of_nonneg U, gt_iff_lt] -+ simp only [ENNReal.ofReal_lt_iff_lt_toReal U O1] -+ calc -+ _ ≤ boundary - 1 := by linarith -+ _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl -+ _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp -+ _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 -+ _ = ENNReal.toReal (ε_div_two) := by -+ simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, -+ ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] -+ _ < ε.toReal := Z0 -+ -+ have σ₀_in_U : (↑σ₀ : ℂ) ∈ (U \ {1}) := by -+ refine Set.mem_sdiff_singleton.mpr ?_ -+ constructor -+ · exact metric_ball_around_1_is_in_U σ₀_in_ball -+ · by_contra a -+ have U : σ₀ = 1 := by exact ofReal_eq_one.mp a -+ rw [U] at σ₀_gt -+ linarith -+ -+ have bdd := Set.forall_mem_image.mp bound_prop (σ₀_in_U) -+ simp only [Function.comp_apply, Pi.sub_apply, Pi.neg_apply, Pi.div_apply] at bdd -+ -+ calc -+ _ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by -+ exact dlog_riemannZeta_bdd_on_vertical_lines_generalized σ₀ σ₀ t (σ₀_gt) (by simp) -+ _ = ‖- ζ' σ₀ / ζ σ₀‖ := by simp only [Complex.norm_div, norm_neg] -+ _ = ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) + (σ₀ - 1)⁻¹‖ := by -+ simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] -+ _ ≤ ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹)‖ + ‖(σ₀ - 1)⁻¹‖ := by -+ have Z := norm_add_le (- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) ((σ₀ - 1)⁻¹) -+ norm_cast at Z -+ _ ≤ const + ‖(σ₀ - 1)⁻¹‖ := by -+ have U := add_le_add_left bdd ‖(σ₀ - 1)⁻¹‖ -+ ring_nf at U -+ ring_nf -+ norm_cast at U -+ norm_cast -+ _ ≤ const + (σ₀ - 1)⁻¹ := by -+ simp [norm_inv] -+ have pos : 0 ≤ σ₀ - 1 := by -+ linarith -+ simp [abs_of_nonneg pos] -+ _ = (σ₀ - 1)⁻¹ + const := by -+ rw [add_comm] -+ _ ≤ (σ₀ - 1)⁻¹ + final_const := by -+ simp [const_le_final_const] -+ -+ · have boundary_in_ball : (↑boundary : ℂ) ∈ metric_ball_around_1 := by -+ unfold metric_ball_around_1 -+ unfold Metric.eball -+ simp only [mem_ofPred_eq] -+ rw [edist_dist, dist_eq_norm] -+ norm_cast -+ have U : 0 ≤ boundary - 1 := by linarith -+ simp only [Real.norm_of_nonneg U, gt_iff_lt] -+ simp only [ENNReal.ofReal_lt_iff_lt_toReal U O1] -+ calc -+ _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl -+ _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp -+ _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 -+ _ = ENNReal.toReal (ε_div_two) := by -+ simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, -+ ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] -+ _ < ε.toReal := Z0 -+ -+ have boundary_in_U : (↑boundary : ℂ) ∈ U \ {1} := by -+ refine Set.mem_sdiff_singleton.mpr ?_ -+ constructor -+ · exact metric_ball_around_1_is_in_U boundary_in_ball -+ · by_contra a -+ norm_cast at a -+ norm_cast at boundary_geq_one -+ simp [←a] at boundary_geq_one -+ -+ have bdd := Set.forall_mem_image.mp bound_prop (boundary_in_U) -+ -+ calc -+ _ ≤ ‖ζ' boundary / ζ boundary‖ := by -+ exact dlog_riemannZeta_bdd_on_vertical_lines_generalized boundary σ₀ t -+ (boundary_geq_one) (by linarith) -+ _ = ‖- ζ' boundary / ζ boundary‖ := by simp only [Complex.norm_div, norm_neg] -+ _ = ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) + (boundary - 1)⁻¹‖ := by -+ simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] -+ _ ≤ ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹)‖ + ‖(boundary - 1)⁻¹‖ := by -+ have Z := norm_add_le (- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) ((boundary - 1)⁻¹) -+ norm_cast at Z -+ _ ≤ const + ‖(boundary - 1)⁻¹‖ := by -+ have U9 := add_le_add_left bdd ‖(boundary - 1)⁻¹‖ -+ ring_nf at U9 -+ ring_nf -+ norm_cast at U9 -+ norm_cast -+ simpa [*] using! U9 -+ _ ≤ const + (boundary - 1)⁻¹ := by -+ simp [norm_inv] -+ have pos : 0 ≤ boundary - 1 := by -+ linarith -+ simp [abs_of_nonneg pos] -+ _ = (boundary - 1)⁻¹ + const := by -+ rw [add_comm] -+ _ = final_const := by rfl -+ _ ≤ _ := by bound -+ -+lemma LogDerivZetaBndUnif : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Ici (1 - A / Real.log |t| ^ 9)), ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ -+ C * Real.log |t| ^ 9 := by -+ let ⟨A, pf_A, C, C_pos, ζbd_in⟩ := LogDerivZetaBnd -+ let ⟨C_triv, ⟨pf_C_triv, ζbd_out⟩⟩ := triv_bound_zeta -+ have T0 : A > 0 := pf_A.1 -+ -+ have ha : 1 ≤ A⁻¹ := by -+ simp only [one_div, mem_Ioc, true_and, T0] at pf_A -+ have U := (inv_le_inv₀ (by positivity) (by positivity)).mpr pf_A -+ simp only [inv_inv] at U -+ linarith -+ -+ refine ⟨A, pf_A, ((1 + C + C_triv) * A⁻¹), (by positivity), fun σ t hyp_t hyp_σ ↦ ?_⟩ -+ have logt_gt' : (1 : ℝ) < Real.log |t| ^ 9 := by -+ calc -+ 1 < Real.log |t| := logt_gt_one hyp_t.le -+ _ ≤ (Real.log |t|) ^ 9 := ZetaInvBnd_aux (logt_gt_one hyp_t.le) -+ -+ have logt_gt'' : (1 : ℝ) < 1 + A / Real.log |t| ^ 9 := by -+ simp only [lt_add_iff_pos_right, div_pos_iff_of_pos_left, T0] -+ positivity -+ -+ have T1 : ∀⦃σ : ℝ⦄, 1 + A / Real.log |t| ^ 9 ≤ σ → 1 < σ := by -+ intros -+ linarith -+ -+ have T2 : ∀⦃σ : ℝ⦄, 1 + A / Real.log |t| ^ 9 ≤ σ → A / Real.log |t| ^ 9 ≤ σ - 1 := by -+ intro σ' hyp_σ' -+ calc -+ A / Real.log |t| ^ 9 = (1 + A / Real.log |t| ^ 9) - 1 := by ring_nf -+ _ ≤ σ' - 1 := by gcongr -+ -+ by_cases h : σ ∈ Ico (1 - A / Real.log |t| ^ 9) (1 + A / Real.log |t| ^ 9) -+ · calc -+ ‖ζ' (↑σ + ↑t * I) / ζ (↑σ + ↑t * I)‖ ≤ C * Real.log |t| ^ 9 := ζbd_in σ t hyp_t h -+ _ ≤ ((1 + C + C_triv) * A⁻¹) * Real.log |t| ^ 9 := by -+ gcongr -+ · calc -+ C ≤ 1 + C := by simp only [le_add_iff_nonneg_left, zero_le_one] -+ _ ≤ (1 + C + C_triv) * 1 := by simp only [mul_one, le_add_iff_nonneg_right]; positivity -+ _ ≤ (1 + C + C_triv) * A⁻¹ := by gcongr -+ -+ · simp only [mem_Ico, tsub_le_iff_right, not_and, not_lt, mem_Ici] at h hyp_σ -+ replace h := h hyp_σ -+ calc -+ ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ = ‖-ζ' (σ + t * I) / ζ (σ + t * I)‖ := by simp only [Complex.norm_div, -+ norm_neg] -+ -+ _ ≤ (σ - 1)⁻¹ + C_triv := ζbd_out σ t (by exact T1 h) -+ -+ _ ≤ (A / Real.log |t| ^ 9)⁻¹ + C_triv := by -+ gcongr -+ · exact T2 h -+ -+ _ ≤ (A / Real.log |t| ^ 9)⁻¹ + C_triv * A⁻¹ := by -+ gcongr -+ exact le_mul_of_one_le_right pf_C_triv ha -+ -+ _ ≤ (1 + C_triv) * A⁻¹ * Real.log |t| ^ 9 := by -+ simp only [inv_div] -+ ring_nf -+ gcongr -+ · simp only [inv_pos, le_mul_iff_one_le_left, T0] -+ linarith -+ -+ _ ≤ (1 + C + C_triv) * A⁻¹ * Real.log |t| ^ 9 := by gcongr; simp only [le_add_iff_nonneg_right]; positivity -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Erdos970/ZetaConj.lean b/PrimeNumberTheoremAnd/Erdos970/ZetaConj.lean -new file mode 100644 -index 0000000..79c01fe ---- /dev/null -+++ b/PrimeNumberTheoremAnd/Erdos970/ZetaConj.lean -@@ -0,0 +1,32 @@ -+import Mathlib.Analysis.Calculus.Deriv.Star -+import Mathlib.Analysis.Normed.Module.Connected -+import Mathlib.NumberTheory.Harmonic.ZetaAsymp -+ -+namespace Erdos970 -+ -+open scoped Complex ComplexConjugate -+ -+theorem deriv_conj_conj' (f : ℂ → ℂ) (p : ℂ) : -+ deriv (fun z ↦ conj (f (conj z))) (conj p) = conj (deriv f p) := by -+ trans deriv (conj ∘ f ∘ conj) (conj p) -+ · rfl -+ simp -+ -+theorem deriv_riemannZeta_conj (s : ℂ) : -+ deriv riemannZeta (conj s) = conj (deriv riemannZeta s) := by -+ simp [← deriv_conj_conj'] -+ -+theorem logDerivZeta_conj (s : ℂ) : -+ (deriv riemannZeta / riemannZeta) (conj s) = conj ((deriv riemannZeta / riemannZeta) s) := by -+ simp [deriv_riemannZeta_conj, riemannZeta_conj] -+ -+theorem logDerivZeta_conj' (s : ℂ) : -+ (logDeriv riemannZeta) (conj s) = conj (logDeriv riemannZeta s) := logDerivZeta_conj s -+ -+ -+theorem intervalIntegral_conj {f : ℝ → ℂ} {a b : ℝ} : -+ ∫ (x : ℝ) in a..b, conj (f x) = conj (∫ (x : ℝ) in a..b, f x) := by -+ rw [intervalIntegral.intervalIntegral_eq_integral_uIoc, integral_conj, ← RCLike.conj_smul, -+ ← intervalIntegral.intervalIntegral_eq_integral_uIoc] -+ -+end Erdos970 -diff --git a/PrimeNumberTheoremAnd/Fourier.lean b/PrimeNumberTheoremAnd/Fourier.lean -index 99e15a0..1a8cf07 100644 ---- a/PrimeNumberTheoremAnd/Fourier.lean -+++ b/PrimeNumberTheoremAnd/Fourier.lean -@@ -1,57 +1,29 @@ --import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv --import Mathlib.MeasureTheory.Integral.IntegralEqImproper -+/- -+Adapted from PrimeNumberTheoremAnd by Alex Kontorovich and contributors. -+Licensed under the Apache License, Version 2.0; see the upstream LICENSE. -+This compatibility port retains the proven declarations used by this project. -+-/ - import Mathlib.Topology.ContinuousMap.Bounded.Basic --import Mathlib.Order.Filter.ZeroAndBoundedAtFilter - import Mathlib.Analysis.Fourier.FourierTransformDeriv - import PrimeNumberTheoremAnd.Sobolev - - open FourierTransform Real Complex MeasureTheory Filter Topology BoundedContinuousFunction - SchwartzMap VectorFourier BigOperators - --local instance {E : Type*} : Coe (E → ℝ) (E → ℂ) := ⟨fun f n => f n⟩ -- - section lemmas - --@[simp] --theorem nnnorm_eq_of_mem_circle (z : Circle) : ‖z.val‖₊ = 1 := -- NNReal.coe_eq_one.mp (by simp) -- --@[simp] --theorem nnnorm_circle_smul (z : Circle) (s : ℂ) : ‖z • s‖₊ = ‖s‖₊ := by -- simp [show z • s = z.val * s from rfl] -- --noncomputable def e (u : ℝ) : ℝ →ᵇ ℂ where -- toFun v := 𝐞 (-v * u) -- map_bounded' := -- ⟨2, fun x y => (dist_le_norm_add_norm _ _).trans (by simp [Circle.norm_coe, one_add_one_eq_two])⟩ -- --@[simp] lemma e_apply (u : ℝ) (v : ℝ) : e u v = 𝐞 (-v * u) := rfl -- --theorem hasDerivAt_e {u x : ℝ} : HasDerivAt (e u) (-2 * π * u * I * e u x) x := by -- have l2 : HasDerivAt (fun v => -v * u) (-u) x := by -- simpa only [neg_mul_comm] using hasDerivAt_mul_const (-u) -- convert! (hasDerivAt_fourierChar (-x * u)).scomp x l2 using 1 -- change _ = ((-u : ℝ) : ℂ) * _ -- `scomp` introduces ℝ-smul on ℂ, which we undo -- simp ; ring -- --lemma fourierIntegral_deriv_aux2 (e : ℝ →ᵇ ℂ) {f : ℝ → ℂ} (hf : Integrable f) : -- Integrable (⇑e * f) := -- hf.bdd_mul e.continuous.aestronglyMeasurable (ae_of_all _ e.norm_coe_le_norm) -- --@[simp] lemma F_neg {f : ℝ → ℂ} {u : ℝ} : 𝓕 (fun x => -f x) u = - 𝓕 f u := by -+@[simp] theorem F_neg {f : ℝ → ℂ} {u : ℝ} : 𝓕 (fun x => -f x) u = - 𝓕 f u := by - simp [fourier_eq, integral_neg] - --@[simp] lemma F_add {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : -+@[simp] theorem F_add {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : - 𝓕 (fun x => f x + g x) x = 𝓕 f x + 𝓕 g x := by -- have : Continuous fun p : ℝ × ℝ ↦ ((innerₗ ℝ) p.1) p.2 := continuous_inner -- have := fourierIntegral_add continuous_fourierChar this hf hg -- exact congr_fun this x -+ exact congr_fun (fourierIntegral_add continuous_fourierChar continuous_inner hf hg) x - --@[simp] lemma F_sub {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : -+@[simp] theorem F_sub {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : - 𝓕 (fun x => f x - g x) x = 𝓕 f x - 𝓕 g x := by - simpa [sub_eq_add_neg, Pi.neg_def] using F_add hf hg.neg x - --@[simp] lemma F_mul {f : ℝ → ℂ} {c : ℂ} {u : ℝ} : -+@[simp] theorem F_mul {f : ℝ → ℂ} {c : ℂ} {u : ℝ} : - 𝓕 (fun x => c * f x) u = c * 𝓕 f u := by - exact congr_fun (VectorFourier.fourierIntegral_const_smul 𝐞 _ _ f c) u - -@@ -67,121 +39,5 @@ theorem fourierIntegral_self_add_deriv_deriv (f : W21) (u : ℝ) : - simp [f.hf, l1, add_mul, Real.fourier_deriv f.hf' l5 f.hf'', Real.fourier_deriv f.hf l4 f.hf'] - field_simp [pi_ne_zero] ; ring_nf ; simp - --@[simp] lemma deriv_ofReal : deriv ofReal = fun _ => 1 := by -+@[simp] theorem deriv_ofReal : deriv ofReal = fun _ => 1 := by - ext x ; exact ((hasDerivAt_id x).ofReal_comp).deriv -- --/-- If, eventually in `T`, the integrand `f T` is bounded on `uIoc lo hi` by `B T` --and `B T * |hi - lo| → 0`, then the interval integral `∫ x in lo..hi, f T x → 0`. -/ --lemma tendsto_intervalIntegral_zero_of_uniform_norm_bound -- {f : ℝ → ℝ → ℂ} {lo hi : ℝ} {B : ℝ → ℝ} -- (hB : Filter.Tendsto (fun T : ℝ => B T * |hi - lo|) Filter.atTop (nhds 0)) -- (hf : ∀ᶠ T in Filter.atTop, ∀ x ∈ Set.uIoc lo hi, ‖f T x‖ ≤ B T) : -- Filter.Tendsto (fun T : ℝ => ∫ x in lo..hi, f T x) Filter.atTop (nhds 0) := by -- rw [tendsto_zero_iff_norm_tendsto_zero] -- refine squeeze_zero' (Eventually.of_forall fun T => norm_nonneg _) ?_ hB -- filter_upwards [hf] with T hT -- exact intervalIntegral.norm_integral_le_of_norm_le_const (fun x hx => hT x hx) -- --/-- The decay `K * (log (T + 2) / (T + 2)) → 0` as `T → ∞`, for any constant `K`. -/ --lemma tendsto_const_mul_log_add_two_div_add_two_atTop (K : ℝ) : -- Filter.Tendsto (fun T : ℝ => K * (Real.log (T + 2) / (T + 2))) -- Filter.atTop (nhds 0) := by -- have h0 : Filter.Tendsto (fun x : ℝ => Real.log x / x) Filter.atTop (nhds 0) := by -- simpa using (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 (by norm_num : (1 : ℝ) ≠ 0)) -- have hshift : Filter.Tendsto (fun T : ℝ => Real.log (T + 2) / (T + 2)) -- Filter.atTop (nhds 0) := by -- have := h0.comp (tendsto_atTop_add_const_right Filter.atTop 2 tendsto_id) -- simpa [Function.comp_def] using this -- simpa using hshift.const_mul K -- --/-- Fourier-transform decay from an integrable derivative: for integrable, --differentiable `g` with integrable derivative, `‖𝓕 g w‖ ≤ (∫ ‖deriv g x‖) / (2π·|w|)`. -/ --lemma norm_fourier_le_integral_deriv_div -- (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) -- (hg' : Integrable (deriv g)) {w : ℝ} (hw : w ≠ 0) : -- ‖𝓕 g w‖ ≤ (∫ x, ‖deriv g x‖ ∂volume) / ((2 * Real.pi) * |w|) := by -- have hmul : -- 𝓕 (deriv g) w = (2 * Real.pi * Complex.I * (w : ℂ)) * 𝓕 g w := by -- have h := congrFun (Real.fourier_deriv hg hdiff hg') w -- simpa [smul_eq_mul, mul_assoc] using h -- have h_fourier : -- ‖𝓕 (deriv g) w‖ ≤ ∫ x, ‖deriv g x‖ ∂volume := by -- exact VectorFourier.norm_fourierIntegral_le_integral_norm 𝐞 volume (innerₗ ℝ) -- (deriv g) w -- have hleft : -- ((2 * Real.pi) * |w|) * ‖𝓕 g w‖ = -- ‖(2 * Real.pi * Complex.I * (w : ℂ)) * 𝓕 g w‖ := by -- have htwopi : ‖(2 * ↑Real.pi : ℂ)‖ = 2 * Real.pi := by -- rw [norm_mul, Complex.norm_two, Complex.norm_of_nonneg Real.pi_pos.le] -- have hwc : ‖(w : ℂ)‖ = |w| := by rw [norm_real, Real.norm_eq_abs] -- rw [norm_mul, norm_mul, norm_mul, htwopi, norm_I, hwc] -- ring -- have hmain : ((2 * Real.pi) * |w|) * ‖𝓕 g w‖ ≤ ∫ x, ‖deriv g x‖ ∂volume := by -- rw [hleft, ← hmul] -- exact h_fourier -- have hpos : 0 < (2 * Real.pi) * |w| := by -- positivity -- exact (le_div_iff₀ hpos).mpr (by simpa [mul_comm, mul_left_comm, mul_assoc] using hmain) -- --/-- The oscillatory-integral form of the decay bound: for `0 < T`, --`‖∫ g y · exp(T·i·y)‖ ≤ (∫ ‖deriv g x‖) / T`. -/ --lemma norm_oscillatory_integral_le_integral_deriv_div -- (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) -- (hg' : Integrable (deriv g)) {T : ℝ} (hT : 0 < T) : -- ‖∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume‖ ≤ -- (∫ x, ‖deriv g x‖ ∂volume) / T := by -- have hw : -T / (2 * Real.pi) ≠ 0 := by -- exact div_ne_zero (neg_ne_zero.mpr hT.ne') (mul_ne_zero two_ne_zero Real.pi_ne_zero) -- have hfourier := norm_fourier_le_integral_deriv_div g hg hdiff hg' hw -- have heq : -- (∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume) = -- 𝓕 g (-T / (2 * Real.pi)) := by -- rw [Real.fourier_real_eq_integral_exp_smul] -- apply integral_congr_ae -- filter_upwards with y -- rw [smul_eq_mul] -- rw [mul_comm (g y)] -- congr 1 -- congr 1 -- push_cast -- field_simp [Real.pi_ne_zero] -- rw [heq] -- refine hfourier.trans_eq ?_ -- congr 1 -- have hden : (2 * Real.pi) * |-T / (2 * Real.pi)| = T := by -- have htwopi_pos : 0 < 2 * Real.pi := by positivity -- have hneg : -T / (2 * Real.pi) < 0 := div_neg_of_neg_of_pos (neg_neg_of_pos hT) htwopi_pos -- rw [abs_of_neg hneg] -- field_simp [Real.pi_ne_zero] -- rw [hden] -- --/-- The `|T|` variant of the oscillatory-integral decay bound: for `T ≠ 0`, --`‖∫ g y · exp(T·i·y)‖ ≤ (∫ ‖deriv g x‖) / |T|`. -/ --lemma norm_oscillatory_integral_le_integral_deriv_div_abs -- (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) -- (hg' : Integrable (deriv g)) {T : ℝ} (hT : T ≠ 0) : -- ‖∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume‖ ≤ -- (∫ x, ‖deriv g x‖ ∂volume) / |T| := by -- have hw : -T / (2 * Real.pi) ≠ 0 := by -- exact div_ne_zero (neg_ne_zero.mpr hT) (mul_ne_zero two_ne_zero Real.pi_ne_zero) -- have hfourier := norm_fourier_le_integral_deriv_div g hg hdiff hg' hw -- have heq : -- (∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume) = -- 𝓕 g (-T / (2 * Real.pi)) := by -- rw [Real.fourier_real_eq_integral_exp_smul] -- apply integral_congr_ae -- filter_upwards with y -- rw [smul_eq_mul] -- rw [mul_comm (g y)] -- congr 1 -- congr 1 -- push_cast -- field_simp [Real.pi_ne_zero] -- rw [heq] -- refine hfourier.trans_eq ?_ -- congr 1 -- have hden : (2 * Real.pi) * |-T / (2 * Real.pi)| = |T| := by -- have htwopi_pos : 0 < 2 * Real.pi := by positivity -- rw [abs_div, abs_neg, abs_of_pos htwopi_pos] -- field_simp [Real.pi_ne_zero] -- rw [hden] -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/CartanBounds.lean b/PrimeNumberTheoremAnd/SiegelZeros/CartanBounds.lean -new file mode 100644 -index 0000000..f378d4b ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/CartanBounds.lean -@@ -0,0 +1,843 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.Products -+import PrimeNumberTheoremAnd.SiegelZeros.Counting -+ -+namespace SiegelZeros -+ -+section -+namespace Complex -+ -+variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F] -+ -+theorem norm_le_of_mem_ball_of_forall_sphere_norm_le {f : ℂ → F} {r C : ℝ} {z : ℂ} -+ (hd : Differentiable ℂ f) (hrpos : 0 < r) -+ (hz : z ∈ Metric.ball (0 : ℂ) r) (hsphere : ∀ u : ℂ, ‖u‖ = r → ‖f u‖ ≤ C) : -+ ‖f z‖ ≤ C := by -+ let U : Set ℂ := Metric.ball (0 : ℂ) r -+ have hfront : ∀ u ∈ frontier U, ‖f u‖ ≤ C := by -+ intro u hu -+ have hur : ‖u‖ = r := by -+ have hfront' : frontier (Metric.ball (0 : ℂ) r) = Metric.sphere (0 : ℂ) r := by -+ simpa using (frontier_ball (x := (0 : ℂ)) (r := r) (ne_of_gt hrpos)) -+ have : u ∈ Metric.sphere (0 : ℂ) r := by simpa [U, hfront'] using hu -+ simpa [Metric.mem_sphere, dist_zero_right] using this -+ exact hsphere u hur -+ exact _root_.Complex.norm_le_of_forall_mem_frontier_norm_le (f := f) (U := U) Metric.isBounded_ball -+ hd.diffContOnCl hfront (subset_closure hz) -+ -+end Complex -+end -+section -+namespace Complex -+namespace CartanBound -+ -+open _root_.Real _root_.SiegelZeros.Real MeasureTheory intervalIntegral -+open scoped Topology ENNReal -+ -+private lemma neg_log_le_sqrt_two_div {x : ℝ} (hx : 0 < x) (hxle : x ≤ 1) : -+ -Real.log x ≤ Real.sqrt (2 / x) := by -+ have hx0 : 0 ≤ x := le_of_lt hx -+ have ht : 0 ≤ -Real.log x := by -+ have : Real.log x ≤ 0 := Real.log_nonpos hx0 hxle -+ linarith -+ have hsq_div_two_le_exp : ∀ {t : ℝ}, 0 ≤ t → t ^ 2 / 2 ≤ Real.exp t := by -+ intro t ht -+ let g : ℝ → ℝ := fun u => Real.exp u - u ^ 2 / 2 -+ have hg_cont : ContinuousOn g (Set.Ici (0 : ℝ)) := by -+ have : Continuous g := by fun_prop -+ simpa using this.continuousOn -+ have hg_diff : DifferentiableOn ℝ g (interior (Set.Ici (0 : ℝ))) := by -+ intro u hu -+ have : DifferentiableAt ℝ g u := by fun_prop -+ exact this.differentiableWithinAt -+ have hg'_nonneg : ∀ u ∈ interior (Set.Ici (0 : ℝ)), 0 ≤ deriv g u := by -+ intro u hu -+ have hu0 : 0 < u := by simpa [interior_Ici] using hu -+ have hderiv : deriv g u = Real.exp u - u := by -+ have hExp : HasDerivAt Real.exp (Real.exp u) u := Real.hasDerivAt_exp u -+ have hpow2 : HasDerivAt (fun z : ℝ => z ^ 2) (2 * u) u := by -+ simpa using! ((hasDerivAt_id u).pow 2) -+ have hpow2_div : HasDerivAt (fun z : ℝ => z ^ 2 / 2) u u := by -+ simpa using (hpow2.div_const (2 : ℝ)) -+ have hG : HasDerivAt g (Real.exp u - u) u := by -+ simpa [g] using! hExp.sub hpow2_div -+ exact hG.deriv -+ have hu_le : u ≤ Real.exp u := by -+ have h1 : u + 1 ≤ Real.exp u := Real.add_one_le_exp u -+ exact (le_trans (le_add_of_nonneg_right (by norm_num)) h1) -+ have : 0 ≤ Real.exp u - u := sub_nonneg.2 hu_le -+ simpa [hderiv] using this -+ have hg_mono : MonotoneOn g (Set.Ici (0 : ℝ)) := -+ monotoneOn_of_deriv_nonneg (D := Set.Ici (0 : ℝ)) (hD := convex_Ici 0) -+ hg_cont hg_diff hg'_nonneg -+ have hg0 : g 0 = 1 := by simp [g] -+ have hle : g 0 ≤ g t := hg_mono (by simp) (by simpa [Set.mem_Ici] using ht) ht -+ have : (1 : ℝ) ≤ Real.exp t - t ^ 2 / 2 := by simpa [g, hg0] using hle -+ linarith -+ have hmain : (-Real.log x) ^ 2 / 2 ≤ Real.exp (-Real.log x) := hsq_div_two_le_exp ht -+ have hexp : Real.exp (-Real.log x) = x⁻¹ := by simp [Real.exp_neg, Real.exp_log hx] -+ have hsq2 : (-Real.log x) ^ 2 ≤ 2 * Real.exp (-Real.log x) := by nlinarith [hmain] -+ have hsq' : (-Real.log x) ^ 2 ≤ 2 / x := by simpa [hexp, div_eq_mul_inv, mul_assoc] using hsq2 -+ have hy : 0 ≤ 2 / x := div_nonneg (by norm_num) (le_of_lt hx) -+ exact (Real.le_sqrt ht hy).2 hsq' -+ -+lemma posLog_log_one_div_abs_one_sub_le_sqrt {t : ℝ} : -+ Real.posLog (1 / |1 - t|) ≤ Real.sqrt (2 / |1 - t|) := by -+ by_cases ht : |1 - t| ≤ 1 -+ · by_cases h0 : |1 - t| = 0 -+ · have : t = 1 := by -+ have : 1 - t = 0 := by simpa [abs_eq_zero] using h0 -+ linarith -+ subst this -+ simp -+ · have hpos : 0 < |1 - t| := lt_of_le_of_ne (abs_nonneg _) (Ne.symm h0) -+ have hle : -Real.log |1 - t| ≤ Real.sqrt (2 / |1 - t|) := -+ neg_log_le_sqrt_two_div (x := |1 - t|) hpos ht -+ have hlog : Real.log (1 / |1 - t|) = -Real.log |1 - t| := by simp [Real.log_inv] -+ have hnonneg : 0 ≤ Real.log (1 / |1 - t|) := by -+ exact Real.log_nonneg ((one_le_div hpos).2 ht) -+ have hmax : Real.posLog (1 / |1 - t|) = Real.log (1 / |1 - t|) := -+ max_eq_right hnonneg -+ calc -+ Real.posLog (1 / |1 - t|) = Real.log (1 / |1 - t|) := hmax -+ _ = -Real.log |1 - t| := hlog -+ _ ≤ Real.sqrt (2 / |1 - t|) := hle -+ · have hlt : 1 < |1 - t| := lt_of_not_ge ht -+ have hle0 : Real.log (1 / |1 - t|) ≤ 0 := by -+ have hpos : 0 < |1 - t| := lt_trans (by norm_num) hlt -+ have : (1 / |1 - t| : ℝ) ≤ 1 := (div_le_one hpos).2 (le_of_lt hlt) -+ exact le_trans (Real.log_le_log (by positivity) this) (by simp) -+ have hmax : Real.posLog (1 / |1 - t|) = 0 := max_eq_left hle0 -+ have hrhs : 0 ≤ Real.sqrt (2 / |1 - t|) := by -+ exact Real.sqrt_nonneg _ -+ rw [hmax] -+ exact hrhs -+ -+noncomputable def φ (t : ℝ) : ℝ := -+ log⁺ (1 / |1 - t|) -+ -+lemma measurable_phi : Measurable φ := by -+ unfold φ -+ simpa [Real.posLog_def, Real.posLog] using -+ (by fun_prop : Measurable fun t : ℝ => max 0 (Real.log (1 / |1 - t|))) -+ -+lemma phi_le_log_two_of_le_half {t : ℝ} (ht : t ≤ (1 / 2 : ℝ)) : φ t ≤ Real.log 2 := by -+ have hnonneg : 0 ≤ (1 - t : ℝ) := by linarith -+ have hden : (1 / 2 : ℝ) ≤ |1 - t| := by -+ have : (1 / 2 : ℝ) ≤ (1 - t : ℝ) := by linarith -+ simpa [abs_of_nonneg hnonneg] using this -+ have hfrac : (1 / |1 - t| : ℝ) ≤ 2 := by -+ have hhalfpos : (0 : ℝ) < (1 / 2 : ℝ) := by norm_num -+ have := one_div_le_one_div_of_le hhalfpos hden -+ simpa [one_div, div_eq_mul_inv] using this -+ have hposLog : log⁺ (1 / |1 - t|) ≤ log⁺ (2 : ℝ) := -+ Real.posLog_le_posLog ((by trans (0 : ℝ); norm_num; positivity)) hfrac -+ have habs : (1 : ℝ) ≤ |(2 : ℝ)| := by -+ simp -+ have hposLog2 : (log⁺ (2 : ℝ)) = Real.log 2 := by -+ simpa using (Real.posLog_eq_log habs) -+ simpa [φ, hposLog2] using hposLog -+ -+lemma phi_eq_zero_of_one_le_abs_one_sub {t : ℝ} (ht : (1 : ℝ) ≤ |1 - t|) : φ t = 0 := by -+ have hpos : 0 < |1 - t| := lt_of_lt_of_le (by norm_num) ht -+ have hfrac : (1 / |1 - t| : ℝ) ≤ 1 := (div_le_one hpos).2 ht -+ have habs : |(1 / |1 - t| : ℝ)| ≤ 1 := by -+ have hnonneg : 0 ≤ (1 / |1 - t| : ℝ) := by positivity -+ simpa [abs_of_nonneg hnonneg] using hfrac -+ have : log⁺ (1 / |1 - t|) = 0 := (Real.posLog_eq_zero_iff _).2 habs -+ simpa [φ] using this -+ -+lemma φ_nonneg (t : ℝ) : 0 ≤ φ t := by -+ simpa [φ] using (Real.posLog_nonneg (x := (1 / |1 - t|))) -+ -+lemma φ_le_sqrt (t : ℝ) : φ t ≤ Real.sqrt (2 / |1 - t|) := by -+ simpa [φ, Real.posLog] using -+ posLog_log_one_div_abs_one_sub_le_sqrt (t := t) -+ -+lemma ae_restrict_norm_phi_le_of_forall_mem {A B : ℝ} (hAB : A ≤ B) {g : ℝ → ℝ} -+ (hg : ∀ t, 0 ≤ g t) (h : ∀ t ∈ Set.Icc A B, φ t ≤ g t) : -+ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A B))] fun t => ‖g t‖ := by -+ refine -+ MeasureTheory.ae_restrict_of_forall_mem (μ := (volume : MeasureTheory.Measure ℝ)) -+ (s := Set.uIoc A B) -+ (by simpa using (measurableSet_uIoc : MeasurableSet (Set.uIoc A B))) ?_ -+ intro t ht -+ have htIoc : t ∈ Set.Ioc A B := by -+ simpa [Set.uIoc_of_le hAB] using ht -+ have htIcc : t ∈ Set.Icc A B := ⟨le_of_lt htIoc.1, htIoc.2⟩ -+ have hle : φ t ≤ g t := h t htIcc -+ have hφ0 : 0 ≤ φ t := φ_nonneg t -+ have hg0 : 0 ≤ g t := hg t -+ simpa [Real.norm_eq_abs, abs_of_nonneg hφ0, abs_of_nonneg hg0] using hle -+ -+lemma log_norm_one_sub_div_ge_neg_phi {u a : ℂ} {r : ℝ} -+ (hur : ‖u‖ = r) (ha : a ≠ 0) (hr : r ≠ ‖a‖) : -+ Real.log ‖(1 : ℂ) - u / a‖ ≥ -φ (r / ‖a‖) := by -+ have ha_norm : 0 < ‖a‖ := norm_pos_iff.2 ha -+ have hnorm_eq : ‖(1 : ℂ) - u / a‖ = ‖a - u‖ / ‖a‖ := by -+ have : (1 : ℂ) - u / a = (a - u) / a := by -+ field_simp [ha] -+ calc -+ ‖(1 : ℂ) - u / a‖ = ‖(a - u) / a‖ := by simp [this] -+ _ = ‖a - u‖ / ‖a‖ := by simp -+ have hrev : |‖a‖ - ‖u‖| ≤ ‖a - u‖ := by -+ simpa using (abs_norm_sub_norm_le a u) -+ have hdiv : |‖a‖ - ‖u‖| / ‖a‖ ≤ ‖a - u‖ / ‖a‖ := -+ div_le_div_of_nonneg_right hrev (le_of_lt ha_norm) -+ have habs : |1 - (r / ‖a‖)| = |‖a‖ - ‖u‖| / ‖a‖ := by -+ have hu : ‖u‖ = r := hur -+ have ha0 : (‖a‖ : ℝ) ≠ 0 := ha_norm.ne' -+ have h1 : (1 : ℝ) - (r / ‖a‖) = (‖a‖ - r) / ‖a‖ := by -+ field_simp [ha0] -+ calc -+ |1 - (r / ‖a‖)| = |(‖a‖ - r) / ‖a‖| := by simp [h1] -+ _ = |‖a‖ - r| / ‖a‖ := by simp [abs_div, abs_of_pos ha_norm] -+ _ = |‖a‖ - ‖u‖| / ‖a‖ := by simp [hu] -+ have hnorm_ge : |1 - (r / ‖a‖)| ≤ ‖(1 : ℂ) - u / a‖ := by -+ have : |1 - (r / ‖a‖)| ≤ ‖a - u‖ / ‖a‖ := by -+ rw [habs] -+ exact hdiv -+ rwa [hnorm_eq] -+ have hx0 : 0 < |1 - (r / ‖a‖)| := by -+ have : (1 - (r / ‖a‖) : ℝ) ≠ 0 := by -+ intro h0 -+ have : r = ‖a‖ := by -+ have : r / ‖a‖ = (1 : ℝ) := by linarith -+ simpa using (div_eq_iff ha_norm.ne').1 this -+ exact hr this -+ have : |1 - (r / ‖a‖)| ≠ 0 := by -+ simpa [abs_eq_zero] using this -+ exact lt_of_le_of_ne (abs_nonneg _) (Ne.symm this) -+ have hlogx : -+ Real.log |1 - (r / ‖a‖)| ≥ -φ (r / ‖a‖) := by -+ have := Real.neg_posLog_inv_le_log (x := |1 - (r / ‖a‖)|) -+ simpa [φ, one_div, inv_inv, abs_sub_comm, sub_eq_add_neg] using this -+ have hlog_mono : -+ Real.log |1 - (r / ‖a‖)| ≤ Real.log ‖(1 : ℂ) - u / a‖ := -+ Real.log_le_log (by positivity) hnorm_ge -+ linarith [hlog_mono, hlogx] -+ -+noncomputable def K : ℝ := -+ ∫ (t : ℝ) in (1 / 4 : ℝ)..(4 : ℝ), Real.sqrt (2 / |1 - t|) ∂volume -+ -+lemma K_nonneg : 0 ≤ K := by -+ have hle : (1 / 4 : ℝ) ≤ (4 : ℝ) := by norm_num -+ have hnn : ∀ t ∈ Set.Icc (1 / 4 : ℝ) (4 : ℝ), 0 ≤ Real.sqrt (2 / |1 - t|) := by -+ intro _t _ht -+ exact Real.sqrt_nonneg _ -+ simpa [K] using (intervalIntegral.integral_nonneg -+ (μ := (volume : MeasureTheory.Measure ℝ)) hle hnn) -+ -+noncomputable def Cφ : ℝ := -+ Real.log 2 + 4 * K + 1 -+ -+lemma Cφ_pos : 0 < Cφ := by -+ have hlog : 0 < Real.log 2 := by -+ simpa using Real.log_pos (by norm_num : (1 : ℝ) < 2) -+ have hK : 0 ≤ K := K_nonneg -+ have : 0 < Real.log 2 + 4 * K := by nlinarith -+ have : 0 < Real.log 2 + 4 * K + 1 := by linarith -+ simpa [Cφ] using this -+ -+lemma intervalIntegrable_sqrt_two_div_abs_one_sub_Icc : -+ IntervalIntegrable -+ (fun t : ℝ => Real.sqrt (2 / |1 - t|)) -+ volume (1 / 4 : ℝ) (4 : ℝ) := by -+ let f : ℝ → ℝ := fun u => Real.sqrt (2 / |u|) -+ have hf0 : IntervalIntegrable f volume (0 : ℝ) (3 : ℝ) := by -+ have hpow : -+ IntervalIntegrable (fun u : ℝ => u ^ (- (2⁻¹ : ℝ))) volume (0 : ℝ) (3 : ℝ) := by -+ simpa using -+ (intervalIntegral.intervalIntegrable_rpow' (a := (0 : ℝ)) (b := (3 : ℝ)) -+ (r := (- (2⁻¹ : ℝ))) (by linarith : (-1 : ℝ) < - (2⁻¹ : ℝ))) -+ have hpow2 : -+ IntervalIntegrable (fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) volume (0 : ℝ) (3 : ℝ) := -+ hpow.const_mul (Real.sqrt 2) -+ have hEq : -+ Set.EqOn f (fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) (Set.uIoc (0 : ℝ) (3 : ℝ)) := by -+ intro u hu -+ have hu' : u ∈ Set.Ioc (0 : ℝ) (3 : ℝ) := by -+ simpa [Set.uIoc_of_le (show (0 : ℝ) ≤ 3 by norm_num)] using hu -+ have hu0 : 0 < u := hu'.1 -+ have hu0' : 0 ≤ u := le_of_lt hu0 -+ have habs : |u| = u := abs_of_nonneg hu0' -+ have : f u = Real.sqrt (2 / u) := by simp [f, habs] -+ calc -+ f u = Real.sqrt (2 / u) := this -+ _ = Real.sqrt 2 / Real.sqrt u := by simp -+ _ = Real.sqrt 2 * (Real.sqrt u)⁻¹ := by simp [div_eq_mul_inv] -+ _ = Real.sqrt 2 * (u ^ (2⁻¹ : ℝ))⁻¹ := by simp [Real.sqrt_eq_rpow] -+ _ = Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ)) := by -+ have h : (u ^ (2⁻¹ : ℝ))⁻¹ = u ^ (- (2⁻¹ : ℝ)) := by -+ simpa using (Real.rpow_neg hu0' (2⁻¹ : ℝ)).symm -+ simp [h] -+ exact -+ (IntervalIntegrable.congr (a := (0 : ℝ)) (b := (3 : ℝ)) -+ (μ := (volume : MeasureTheory.Measure ℝ)) -+ (f := fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) (g := f) hEq.symm) -+ hpow2 -+ have hf0' : IntervalIntegrable f volume (0 : ℝ) (3 / 4 : ℝ) := -+ hf0.mono_set (by -+ intro u hu -+ have hsub : Set.uIcc (0 : ℝ) (3 / 4 : ℝ) ⊆ Set.uIcc (0 : ℝ) (3 : ℝ) := by -+ refine Set.uIcc_subset_uIcc ?_ ?_ -+ · simp -+ · have h0 : (0 : ℝ) ≤ (3 / 4 : ℝ) := by nlinarith -+ have h1 : (3 / 4 : ℝ) ≤ (3 : ℝ) := by nlinarith -+ exact (Set.mem_uIcc).2 (Or.inl ⟨h0, h1⟩) -+ exact hsub hu) -+ have hleft : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume (1 / 4 : ℝ) (1 : ℝ) := by -+ have htmp : -+ IntervalIntegrable (fun t : ℝ => f (1 - t)) volume (1 : ℝ) ((1 : ℝ) - (3 / 4 : ℝ)) := by -+ simpa using (hf0'.comp_sub_left (c := (1 : ℝ))) -+ have htmp' : -+ IntervalIntegrable (fun t : ℝ => f (1 - t)) volume ((1 : ℝ) - (3 / 4 : ℝ)) (1 : ℝ) := -+ htmp.symm -+ have hsub : ((1 : ℝ) - (3 / 4 : ℝ)) = (1 / 4 : ℝ) := by norm_num -+ have htmp'' : IntervalIntegrable (fun t : ℝ => f (1 - t)) volume (1 / 4 : ℝ) (1 : ℝ) := by -+ simpa [hsub] using htmp' -+ simpa [f] using htmp'' -+ have hright : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume (1 : ℝ) (4 : ℝ) := by -+ have htmp : -+ IntervalIntegrable (fun t : ℝ => f (t - 1)) volume (1 : ℝ) ((3 : ℝ) + (1 : ℝ)) := by -+ simpa using (hf0.comp_sub_right (c := (1 : ℝ))) -+ have hsub : ((3 : ℝ) + (1 : ℝ)) = (4 : ℝ) := by norm_num -+ have htmp' : IntervalIntegrable (fun t : ℝ => f (t - 1)) volume (1 : ℝ) (4 : ℝ) := by -+ simpa [hsub] using htmp -+ have hcongr : -+ Set.EqOn (fun t : ℝ => f (t - 1)) (fun t : ℝ => Real.sqrt (2 / |1 - t|)) -+ (Set.uIoc (1 : ℝ) (4 : ℝ)) := by -+ intro t _ht -+ simp [f, abs_sub_comm] -+ exact -+ (IntervalIntegrable.congr (a := (1 : ℝ)) (b := (4 : ℝ)) -+ (μ := (volume : MeasureTheory.Measure ℝ)) -+ (f := fun t : ℝ => f (t - 1)) (g := fun t : ℝ => Real.sqrt (2 / |1 - t|)) hcongr) -+ htmp' -+ exact hleft.trans hright -+ -+lemma phi_le_log_two_on_dyadic_of_le_quarter {A t : ℝ} (hA : A ≤ (1 / 4 : ℝ)) -+ (ht : t ∈ Set.Icc A (2 * A)) : -+ φ t ≤ Real.log 2 := by -+ have ht_le : t ≤ (1 / 2 : ℝ) := by -+ exact ht.2.trans (by nlinarith [hA]) -+ exact phi_le_log_two_of_le_half ht_le -+ -+lemma phi_eq_zero_of_two_le {t : ℝ} (ht : (2 : ℝ) ≤ t) : φ t = 0 := by -+ have hden : (1 : ℝ) ≤ |1 - t| := by -+ have : (1 : ℝ) ≤ t - 1 := by linarith -+ have : (1 : ℝ) ≤ |t - 1| := by -+ simpa [abs_of_nonneg (by linarith : 0 ≤ t - 1)] using this -+ simpa [abs_sub_comm] using this -+ exact phi_eq_zero_of_one_le_abs_one_sub hden -+ -+lemma intervalIntegrable_phi_dyadic_small {A : ℝ} (hA0 : 0 ≤ A) -+ (hA : A ≤ (1 / 4 : ℝ)) : -+ IntervalIntegrable φ volume A (2 * A) := by -+ have hA_le : A ≤ 2 * A := by nlinarith -+ have hconst : IntervalIntegrable (fun _ : ℝ => (Real.log 2 : ℝ)) volume A (2 * A) := -+ intervalIntegrable_const -+ have hmeas : -+ AEStronglyMeasurable (fun t : ℝ => φ t) (volume.restrict (Set.uIoc A (2 * A))) := -+ (measurable_phi.aestronglyMeasurable : _) -+ have hdom : -+ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A (2 * A)))] -+ fun _ => ‖(Real.log 2 : ℝ)‖ := by -+ refine ae_restrict_norm_phi_le_of_forall_mem (A := A) (B := 2 * A) hA_le -+ (g := fun _ => (Real.log 2 : ℝ)) (hg := fun _ => ?_) ?_ -+ · simpa using (Real.log_nonneg (by norm_num : (1 : ℝ) ≤ 2)) -+ · intro t ht -+ exact phi_le_log_two_on_dyadic_of_le_quarter hA ht -+ exact IntervalIntegrable.mono_fun hconst hmeas hdom -+ -+lemma intervalIntegrable_phi_dyadic_large {A : ℝ} (hA : (2 : ℝ) ≤ A) : -+ IntervalIntegrable φ volume A (2 * A) := by -+ have hA_le : A ≤ 2 * A := by nlinarith -+ have hEq : Set.EqOn (fun t : ℝ => φ t) (fun _ => (0 : ℝ)) (Set.uIoc A (2 * A)) := by -+ intro t ht -+ have htIoc : t ∈ Set.Ioc A (2 * A) := by -+ simpa [Set.uIoc_of_le hA_le] using ht -+ exact phi_eq_zero_of_two_le (le_trans hA (le_of_lt htIoc.1)) -+ have hz : IntervalIntegrable (fun _ : ℝ => (0 : ℝ)) volume A (2 * A) := -+ intervalIntegrable_const -+ exact (IntervalIntegrable.congr (a := A) (b := (2 * A)) -+ (μ := (volume : MeasureTheory.Measure ℝ)) -+ (f := fun _ => (0 : ℝ)) (g := fun t => φ t) (by -+ intro t ht -+ simpa using (hEq (x := t) ht).symm)) hz -+ -+lemma intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle {A : ℝ} -+ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume A (2 * A) := by -+ have hsqrt_big : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) -+ (volume : MeasureTheory.Measure ℝ) (1 / 4 : ℝ) (4 : ℝ) := -+ intervalIntegrable_sqrt_two_div_abs_one_sub_Icc -+ refine hsqrt_big.mono_set ?_ -+ refine Set.uIcc_subset_uIcc ?_ ?_ -+ · exact (Set.mem_uIcc).2 (Or.inl ⟨hA_lower, by nlinarith [hA_upper]⟩) -+ · exact (Set.mem_uIcc).2 (Or.inl ⟨by nlinarith [hA_lower], by nlinarith [hA_upper]⟩) -+ -+lemma intervalIntegrable_phi_dyadic_middle {A : ℝ} -+ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : -+ IntervalIntegrable φ volume A (2 * A) := by -+ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] -+ have hsqrt : -+ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume A (2 * A) := -+ intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle hA_lower hA_upper -+ have hmeas : -+ AEStronglyMeasurable (fun t : ℝ => φ t) (volume.restrict (Set.uIoc A (2 * A))) := -+ (measurable_phi.aestronglyMeasurable : _) -+ have hdom : -+ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A (2 * A)))] -+ fun t => ‖Real.sqrt (2 / |1 - t|)‖ := by -+ refine ae_restrict_norm_phi_le_of_forall_mem (A := A) (B := 2 * A) hA_le -+ (g := fun t => Real.sqrt (2 / |1 - t|)) (hg := fun _ => Real.sqrt_nonneg _) ?_ -+ intro t _ht -+ exact φ_le_sqrt t -+ exact IntervalIntegrable.mono_fun hsqrt hmeas hdom -+ -+lemma intervalIntegrable_phi_dyadic {A : ℝ} (hA : 0 ≤ A) : -+ IntervalIntegrable φ volume A (2 * A) := by -+ by_cases hA0 : A = 0 -+ · subst hA0 -+ simp -+ cases le_total A (1 / 4 : ℝ) with -+ | inl hsmall => -+ exact intervalIntegrable_phi_dyadic_small hA hsmall -+ | inr hge_quarter => -+ cases le_total (2 : ℝ) A with -+ | inl hbig => -+ exact intervalIntegrable_phi_dyadic_large hbig -+ | inr hA_le_two => -+ exact intervalIntegrable_phi_dyadic_middle hge_quarter hA_le_two -+ -+lemma intervalIntegrable_phi_div {a R : ℝ} (ha : 0 < a) (hR : 0 ≤ R) : -+ IntervalIntegrable (fun r : ℝ => φ (r / a)) volume R (2 * R) := by -+ have ha0 : a ≠ 0 := ne_of_gt ha -+ have hRa_nonneg : 0 ≤ R / a := by -+ exact div_nonneg hR (le_of_lt ha) -+ have hφ : IntervalIntegrable φ volume (R / a) (2 * (R / a)) := -+ intervalIntegrable_phi_dyadic (A := (R / a)) hRa_nonneg -+ have := (hφ.comp_mul_right (c := (a⁻¹ : ℝ))) -+ have hupper : a * (R * (a⁻¹ * 2)) = (2 * R) := by -+ field_simp [ha0] -+ simpa [div_eq_mul_inv, ha0, hupper, mul_assoc, mul_left_comm, mul_comm] using this -+ -+lemma log_two_le_Cφ : Real.log 2 ≤ Cφ := by -+ dsimp [Cφ] -+ have hK : 0 ≤ K := K_nonneg -+ linarith [hK] -+ -+lemma four_mul_K_add_one_le_Cφ : (4 * K + 1 : ℝ) ≤ Cφ := by -+ dsimp [Cφ] -+ have hlog_nonneg : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) -+ linarith [hlog_nonneg] -+ -+lemma integral_phi_le_Cφ_mul_small {A : ℝ} (hA0 : 0 ≤ A) (hA : A ≤ (1 / 4 : ℝ)) : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by -+ have hA_le : A ≤ 2 * A := by nlinarith -+ have hφ_int : IntervalIntegrable φ volume A (2 * A) := -+ intervalIntegrable_phi_dyadic_small hA0 hA -+ have hconst : IntervalIntegrable (fun _ : ℝ => (Real.log 2 : ℝ)) volume A (2 * A) := -+ intervalIntegrable_const -+ have hle_int : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) -+ ≤ ∫ (t : ℝ) in A..(2 * A), (Real.log 2 : ℝ) ∂volume := by -+ refine intervalIntegral.integral_mono_on (μ := (volume : MeasureTheory.Measure ℝ)) -+ hA_le hφ_int hconst ?_ -+ intro t ht -+ exact phi_le_log_two_on_dyadic_of_le_quarter hA ht -+ have hRHS : -+ (∫ (t : ℝ) in A..(2 * A), (Real.log 2 : ℝ) ∂volume) = A * Real.log 2 := by -+ simp [intervalIntegral.integral_const, sub_eq_add_neg, add_assoc, two_mul] -+ have hcoef : A * Real.log 2 ≤ Cφ * A := by -+ have := mul_le_mul_of_nonneg_left log_two_le_Cφ hA0 -+ simpa [mul_assoc, mul_left_comm, mul_comm] using this -+ exact le_trans (by simpa [hRHS] using hle_int) hcoef -+ -+lemma integral_phi_le_Cφ_mul_large {A : ℝ} (hA : (2 : ℝ) ≤ A) : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by -+ have hA_le : A ≤ 2 * A := by nlinarith -+ have hφ0 : Set.EqOn (fun t : ℝ => φ t) (fun _ => (0 : ℝ)) (Set.uIcc A (2 * A)) := by -+ intro t ht -+ have ht' : t ∈ Set.Icc A (2 * A) := by -+ simpa [Set.uIcc_of_le hA_le] using ht -+ exact phi_eq_zero_of_two_le (le_trans hA ht'.1) -+ have hzero : (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) = 0 := by -+ simpa using intervalIntegral.integral_congr (μ := (volume : MeasureTheory.Measure ℝ)) hφ0 -+ have hnonneg : (0 : ℝ) ≤ Cφ * A := mul_nonneg (le_of_lt Cφ_pos) (by linarith) -+ simpa [hzero] using hnonneg -+ -+lemma integral_sqrt_two_div_abs_one_sub_le_K_dyadic_middle {A : ℝ} -+ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : -+ (∫ (t : ℝ) in A..(2 * A), Real.sqrt (2 / |1 - t|) ∂volume) ≤ K := by -+ let s (t : ℝ) : ℝ := Real.sqrt (2 / |1 - t|) -+ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] -+ have hA_upper' : (2 * A : ℝ) ≤ 4 := by nlinarith [hA_upper] -+ have hsqrt_big : IntervalIntegrable s volume (1 / 4 : ℝ) (4 : ℝ) := by -+ simpa [s] using intervalIntegrable_sqrt_two_div_abs_one_sub_Icc -+ have hle_K : -+ (∫ (t : ℝ) in A..(2 * A), s t ∂volume) -+ ≤ ∫ (t : ℝ) in (1 / 4 : ℝ)..(4 : ℝ), s t ∂volume := by -+ refine intervalIntegral.integral_mono_interval (μ := (volume : MeasureTheory.Measure ℝ)) -+ (c := (1 / 4 : ℝ)) (d := (4 : ℝ)) (a := A) (b := (2 * A)) -+ hA_lower hA_le hA_upper' ?_ hsqrt_big -+ exact Filter.Eventually.of_forall (fun _t => Real.sqrt_nonneg _) -+ simpa [K, s] using hle_K -+ -+lemma K_le_four_mul_K_add_one_mul_of_quarter_le {A : ℝ} (hA : (1 / 4 : ℝ) ≤ A) : -+ K ≤ (4 * K + 1) * A := by -+ have hcoef : 1 ≤ 4 * A := by nlinarith [hA] -+ have hK : 0 ≤ K := K_nonneg -+ nlinarith [hK, hcoef] -+ -+lemma integral_phi_le_Cφ_mul_middle {A : ℝ} -+ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by -+ let s (t : ℝ) : ℝ := Real.sqrt (2 / |1 - t|) -+ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] -+ have hφ_int : IntervalIntegrable φ volume A (2 * A) := -+ intervalIntegrable_phi_dyadic_middle hA_lower hA_upper -+ have hsqrt : IntervalIntegrable s volume A (2 * A) := by -+ simpa [s] using -+ intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle hA_lower hA_upper -+ have hle_int : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) -+ ≤ ∫ (t : ℝ) in A..(2 * A), s t ∂volume := by -+ refine intervalIntegral.integral_mono_on -+ (μ := (volume : MeasureTheory.Measure ℝ)) hA_le hφ_int hsqrt ?_ -+ intro t _ht -+ exact φ_le_sqrt t -+ have hsqrt_le : (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ≤ (4 * K + 1) * A := by -+ have hK : (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ≤ K := by -+ simpa [s] using integral_sqrt_two_div_abs_one_sub_le_K_dyadic_middle hA_lower hA_upper -+ exact le_trans hK (K_le_four_mul_K_add_one_mul_of_quarter_le hA_lower) -+ have hcoef : (4 * K + 1 : ℝ) * A ≤ Cφ * A := -+ mul_le_mul_of_nonneg_right four_mul_K_add_one_le_Cφ (by nlinarith [hA_lower]) -+ exact le_trans hle_int (le_trans hsqrt_le hcoef) -+ -+lemma integral_phi_le_Cφ_mul {A : ℝ} (hA : 0 ≤ A) : -+ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by -+ by_cases hA0 : A = 0 -+ · subst hA0 -+ simp [Cφ, φ, K] -+ cases le_total A (1 / 4 : ℝ) with -+ | inl hsmall => -+ exact integral_phi_le_Cφ_mul_small hA hsmall -+ | inr hge_quarter => -+ cases le_total (2 : ℝ) A with -+ | inl hbig => -+ exact integral_phi_le_Cφ_mul_large hbig -+ | inr hA_le_two => -+ exact integral_phi_le_Cφ_mul_middle hge_quarter hA_le_two -+ -+open scoped BigOperators -+ -+lemma volume_Ioc_two_mul_ne_zero {R : ℝ} (hR : 0 < R) : -+ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R)) ≠ 0 := by -+ have hpos : (0 : ℝ) < 2 * R - R := by nlinarith [hR] -+ simp [Real.volume_Ioc, ENNReal.ofReal_eq_zero, not_le_of_gt hpos] -+ -+lemma volume_Ioc_two_mul_diff_finset_ne_zero (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : -+ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by -+ have hbad_meas : (volume : MeasureTheory.Measure ℝ) (bad : Set ℝ) = 0 := by -+ simpa using (bad.measure_zero (μ := (volume : MeasureTheory.Measure ℝ))) -+ have hdiff : -+ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) -+ = (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R)) := by -+ simpa [Set.sdiff_eq, Set.inter_assoc, Set.inter_left_comm, Set.inter_comm] using -+ (MeasureTheory.measure_sdiff_null (s := Set.Ioc R (2 * R)) (t := (bad : Set ℝ)) -+ hbad_meas) -+ simpa [hdiff] using volume_Ioc_two_mul_ne_zero hR -+ -+lemma restrict_volume_Ioc_two_mul_diff_finset_ne_zero (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : -+ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by -+ have hsubset : Set.Ioc R (2 * R) \ (bad : Set ℝ) ⊆ Set.Ioc R (2 * R) := by -+ intro r hr -+ exact hr.1 -+ have hinter : -+ (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ∩ Set.Ioc R (2 * R) -+ = (Set.Ioc R (2 * R) \ (bad : Set ℝ)) := by -+ exact Set.inter_eq_left.mpr hsubset -+ simpa [MeasureTheory.Measure.restrict_apply, measurableSet_Ioc, hinter] using -+ volume_Ioc_two_mul_diff_finset_ne_zero bad hR -+ -+lemma integral_phi_div_le_Cφ_mul {a R : ℝ} (ha : 0 < a) (hR : 0 ≤ R) : -+ (∫ (r : ℝ) in R..(2 * R), φ (r / a) ∂volume) ≤ Cφ * R := by -+ have ha0 : a ≠ 0 := ne_of_gt ha -+ have hrew : -+ (∫ (r : ℝ) in R..(2 * R), φ (r / a) ∂volume) -+ = a * (∫ (t : ℝ) in (R / a)..(2 * R / a), φ t ∂volume) := by -+ simp [smul_eq_mul, mul_left_comm, mul_comm, div_eq_mul_inv, ha0] -+ rw [hrew] -+ have hA : 0 ≤ R / a := by -+ exact div_nonneg hR ha.le -+ have hle : (∫ (t : ℝ) in (R / a)..(2 * (R / a)), φ t ∂volume) ≤ Cφ * (R / a) := -+ integral_phi_le_Cφ_mul (A := R / a) hA -+ have hEq : (2 * R / a) = 2 * (R / a) := by ring -+ have hle' : -+ (∫ (t : ℝ) in (R / a)..(2 * R / a), φ t ∂volume) ≤ Cφ * (R / a) := by -+ simpa [hEq] using hle -+ have ha_nonneg : 0 ≤ a := ha.le -+ have := mul_le_mul_of_nonneg_left hle' ha_nonneg -+ have hRHS : a * (Cφ * (R / a)) = Cφ * R := by -+ field_simp [ha0] -+ simpa [hRHS, mul_assoc, mul_left_comm, mul_comm] using this -+ -+lemma intervalIntegrable_sum_mul_phi_div -+ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) -+ (ha : ∀ i ∈ s, 0 < a i) {R : ℝ} (hR : 0 ≤ R) : -+ IntervalIntegrable (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) -+ volume R (2 * R) := by -+ refine IntervalIntegrable.sum (μ := volume) (a := R) (b := 2 * R) -+ (s := s) (f := fun i : ι => fun r : ℝ => w i * φ (r / a i)) ?_ -+ intro i hi -+ have hφi : IntervalIntegrable (fun r : ℝ => φ (r / a i)) volume R (2 * R) := -+ intervalIntegrable_phi_div (a := a i) (R := R) (ha i hi) hR -+ simpa [mul_assoc] using hφi.const_mul (w i) -+ -+lemma integral_sum_mul_phi_div_le_Cφ_mul_sum -+ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) -+ (hw : ∀ i ∈ s, 0 ≤ w i) (ha : ∀ i ∈ s, 0 < a i) {R : ℝ} (hR : 0 ≤ R) : -+ (∫ r in R..(2 * R), (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) r ∂volume) -+ ≤ Cφ * (∑ i ∈ s, w i) * R := by -+ have hint : ∀ i ∈ s, IntervalIntegrable (fun r : ℝ => w i * φ (r / a i)) -+ volume R (2 * R) := by -+ intro i hi -+ have hφi : IntervalIntegrable (fun r : ℝ => φ (r / a i)) volume R (2 * R) := -+ intervalIntegrable_phi_div (a := a i) (R := R) (ha i hi) hR -+ simpa [mul_assoc] using hφi.const_mul (w i) -+ have hsum_int : -+ (∫ r in R..(2 * R), (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) r ∂volume) -+ = ∑ i ∈ s, ∫ r in R..(2 * R), (fun r : ℝ => w i * φ (r / a i)) r -+ ∂volume := by -+ simpa using -+ (intervalIntegral.integral_finsetSum (μ := volume) (a := R) (b := 2 * R) -+ (s := s) (f := fun i : ι => fun r : ℝ => w i * φ (r / a i)) hint) -+ rw [hsum_int] -+ have hsum_le : -+ (∑ i ∈ s, ∫ r in R..(2 * R), (fun r : ℝ => w i * φ (r / a i)) r ∂volume) -+ ≤ ∑ i ∈ s, w i * (Cφ * R) := by -+ refine Finset.sum_le_sum ?_ -+ intro i hi -+ have hphi : -+ (∫ r in R..(2 * R), φ (r / a i) ∂volume) ≤ Cφ * R := -+ integral_phi_div_le_Cφ_mul (a := a i) (R := R) (ha i hi) hR -+ have := mul_le_mul_of_nonneg_left hphi (hw i hi) -+ simpa [mul_assoc, mul_left_comm, mul_comm] using this -+ refine le_trans hsum_le ?_ -+ have : (∑ i ∈ s, w i * (Cφ * R)) = Cφ * (∑ i ∈ s, w i) * R := by -+ calc -+ (∑ i ∈ s, w i * (Cφ * R)) = (∑ i ∈ s, w i) * (Cφ * R) := by -+ simp [Finset.sum_mul] -+ _ = Cφ * (∑ i ∈ s, w i) * R := by -+ ac_rfl -+ exact le_of_eq this -+ -+lemma exists_radius_Ioc_sum_mul_phi_div_le_Cφ_mul_sum_avoid -+ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) -+ (hw : ∀ i ∈ s, 0 ≤ w i) (ha : ∀ i ∈ s, 0 < a i) -+ (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : -+ ∃ r ∈ Set.Ioc R (2 * R), r ∉ bad ∧ -+ (∑ i ∈ s, w i * φ (r / a i)) ≤ Cφ * (∑ i ∈ s, w i) := by -+ by_contra hbad -+ have hforall : -+ ∀ r ∈ Set.Ioc R (2 * R), r ∉ bad → -+ Cφ * (∑ i ∈ s, w i) < (∑ i ∈ s, w i * φ (r / a i)) := by -+ intro r hr hrbad -+ have : ¬(∑ i ∈ s, w i * φ (r / a i)) ≤ Cφ * (∑ i ∈ s, w i) := by -+ intro hle -+ exact hbad ⟨r, hr, hrbad, hle⟩ -+ exact lt_of_not_ge this -+ let g : ℝ → ℝ := ∑ i ∈ s, fun r : ℝ => w i * φ (r / a i) -+ have hg_int : IntervalIntegrable g volume R (2 * R) := by -+ simpa [g] using intervalIntegrable_sum_mul_phi_div s w a ha hR.le -+ have hconst_int : -+ IntervalIntegrable (fun _r : ℝ => Cφ * (∑ i ∈ s, w i)) volume R (2 * R) := -+ intervalIntegrable_const -+ have hlt_meas : -+ (volume.restrict (Set.Ioc R (2 * R))) -+ {r | Cφ * (∑ i ∈ s, w i) < g r} ≠ 0 := by -+ have hall : Set.Ioc R (2 * R) \ (bad : Set ℝ) ⊆ {r | Cφ * (∑ i ∈ s, w i) < g r} := by -+ intro r hr -+ have hrIoc : r ∈ Set.Ioc R (2 * R) := hr.1 -+ have hrbad : r ∉ bad := by simpa using hr.2 -+ simpa [g] using hforall r hrIoc hrbad -+ have hle : -+ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) -+ ≤ (volume.restrict (Set.Ioc R (2 * R))) {r | Cφ * (∑ i ∈ s, w i) < g r} := -+ MeasureTheory.measure_mono hall -+ have hpos' : -+ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by -+ exact restrict_volume_Ioc_two_mul_diff_finset_ne_zero bad hR -+ intro hzero -+ have : (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) = 0 := -+ le_antisymm (le_trans hle (le_of_eq hzero)) (by positivity) -+ exact hpos' this -+ have hlt_int : -+ (∫ r in R..(2 * R), (Cφ * (∑ i ∈ s, w i)) ∂volume) -+ < ∫ r in R..(2 * R), g r ∂volume := by -+ have hab : R ≤ 2 * R := by nlinarith [hR.le] -+ refine intervalIntegral.integral_lt_integral_of_ae_le_of_measure_setOfPred_lt_ne_zero (μ := volume) -+ (a := R) (b := 2 * R) (f := fun _ => (Cφ * (∑ i ∈ s, w i))) (g := g) -+ hab hconst_int hg_int ?_ hlt_meas -+ have hmem : ∀ᵐ r ∂ (volume.restrict (Set.Ioc R (2 * R))), r ∈ Set.Ioc R (2 * R) := -+ MeasureTheory.ae_restrict_mem (by simp) -+ have hnotBad : -+ ∀ᵐ r ∂ (volume.restrict (Set.Ioc R (2 * R))), r ∉ (bad : Set ℝ) := by -+ simpa using -+ (bad.finite_toSet.countable.ae_notMem (μ := (volume.restrict (Set.Ioc R (2 * R))))) -+ filter_upwards [hmem, hnotBad] with r hrIoc hrNotBad -+ have hrNotBad' : r ∉ bad := by simpa using hrNotBad -+ exact le_of_lt (by simpa [g] using hforall r hrIoc hrNotBad') -+ have hconst_eval : -+ (∫ r in R..(2 * R), (Cφ * (∑ i ∈ s, w i)) ∂volume) = Cφ * (∑ i ∈ s, w i) * R := by -+ simp [intervalIntegral.integral_const, sub_eq_add_neg, mul_comm] -+ ring -+ have hg_le : -+ (∫ r in R..(2 * R), g r ∂volume) ≤ Cφ * (∑ i ∈ s, w i) * R := by -+ simpa [g] using integral_sum_mul_phi_div_le_Cφ_mul_sum s w a hw ha hR.le -+ have : ¬(Cφ * (∑ i ∈ s, w i) * R < Cφ * (∑ i ∈ s, w i) * R) := lt_irrefl _ -+ have hcontra : Cφ * (∑ i ∈ s, w i) * R < Cφ * (∑ i ∈ s, w i) * R := by -+ have := hlt_int -+ simpa [hconst_eval] using (this.trans_le hg_le) -+ exact this hcontra -+ -+end CartanBound -+end Complex -+end -+section -+noncomputable section -+ -+namespace Complex.Hadamard -+ -+open _root_.SiegelZeros.Complex _root_.Real _root_.SiegelZeros.Real -+ -+lemma max_one_norm_div_pow_le_one_add_rpow -+ {m : ℕ} {τ r : ℝ} {u a : ℂ} -+ (hur : ‖u‖ = r) -+ (hmτ : (m : ℝ) ≤ τ) : -+ max 1 (‖u / a‖ ^ m) ≤ 1 + (r / ‖a‖) ^ τ := by -+ by_cases hx : ‖u / a‖ ≤ 1 -+ · have hpowm_le1 : ‖u / a‖ ^ m ≤ 1 := pow_le_one₀ (norm_nonneg (u / a)) hx -+ have hr0 : 0 ≤ r := by simpa [hur] using (norm_nonneg u) -+ have hbase : 0 ≤ r / ‖a‖ := div_nonneg hr0 (norm_nonneg a) -+ have hnonneg : 0 ≤ (r / ‖a‖) ^ τ := Real.rpow_nonneg hbase τ -+ have hle1 : (1 : ℝ) ≤ 1 + (r / ‖a‖) ^ τ := le_add_of_nonneg_right hnonneg -+ have hle2 : ‖u / a‖ ^ m ≤ 1 + (r / ‖a‖) ^ τ := hpowm_le1.trans hle1 -+ exact (max_le_iff).2 ⟨hle1, hle2⟩ -+ · have hx1 : 1 < ‖u / a‖ := lt_of_not_ge hx -+ have hpow : -+ (‖u / a‖ : ℝ) ^ (m : ℝ) ≤ (‖u / a‖ : ℝ) ^ τ := -+ Real.rpow_le_rpow_of_exponent_le (le_of_lt hx1) hmτ -+ have hpow' : ‖u / a‖ ^ m ≤ (‖u / a‖ : ℝ) ^ τ := by -+ simpa [Real.rpow_natCast] using hpow -+ have hmax_add : max 1 (‖u / a‖ ^ m) ≤ 1 + ‖u / a‖ ^ m := by -+ refine max_le (le_add_of_nonneg_right (by positivity)) (le_add_of_nonneg_left (by positivity)) -+ have : max 1 (‖u / a‖ ^ m) ≤ 1 + (‖u / a‖ : ℝ) ^ τ := -+ hmax_add.trans (by nlinarith [hpow']) -+ simpa [norm_div, hur] using this -+ -+lemma norm_inv_weierstrassFactor_le_exp_near -+ {m : ℕ} {τ r : ℝ} {u a : ℂ} -+ (hur : ‖u‖ = r) (ha : a ≠ 0) (hr : r ≠ ‖a‖) -+ (hmτ : (m : ℝ) ≤ τ) : -+ ‖(weierstrassFactor m (u / a))⁻¹‖ -+ ≤ Real.exp (CartanBound.φ (r / ‖a‖) + (m : ℝ) * (1 + (r / ‖a‖) ^ τ)) := by -+ have hlog_one : -+ Real.log ‖(1 : ℂ) - u / a‖ ≥ -CartanBound.φ (r / ‖a‖) := -+ CartanBound.log_norm_one_sub_div_ge_neg_phi (hur := hur) (ha := ha) (hr := hr) -+ have hbase := -+ log_norm_weierstrassFactor_ge_log_norm_one_sub_sub (m := m) (z := (u / a)) -+ have hlogE : -+ Real.log ‖weierstrassFactor m (u / a)‖ -+ ≥ -CartanBound.φ (r / ‖a‖) - (m : ℝ) * max 1 (‖u / a‖ ^ m) := by -+ have hpls := -+ norm_partialLogSum_le_nat_mul_max_one_norm_pow m (u / a) -+ linarith [hbase, hlog_one, hpls] -+ have hmax : -+ max 1 (‖u / a‖ ^ m) ≤ 1 + (r / ‖a‖) ^ τ := -+ max_one_norm_div_pow_le_one_add_rpow (m := m) (τ := τ) (r := r) (u := u) (a := a) hur hmτ -+ have hneglog : -+ -Real.log ‖weierstrassFactor m (u / a)‖ -+ ≤ CartanBound.φ (r / ‖a‖) + (m : ℝ) * (1 + (r / ‖a‖) ^ τ) := by -+ have : -Real.log ‖weierstrassFactor m (u / a)‖ -+ ≤ CartanBound.φ (r / ‖a‖) + (m : ℝ) * max 1 (‖u / a‖ ^ m) := by -+ linarith [hlogE] -+ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ exact this.trans (by nlinarith [mul_le_mul_of_nonneg_left hmax hm0]) -+ have hpos : 0 < ‖weierstrassFactor m (u / a)‖ := by -+ have : weierstrassFactor m (u / a) ≠ 0 := by -+ intro h0 -+ have : u / a = (1 : ℂ) := (weierstrassFactor_eq_zero_iff m (u / a)).1 h0 -+ have : u = a := (div_eq_one_iff_eq ha).1 this -+ have : r = ‖a‖ := by simpa [this] using hur.symm -+ exact (hr this).elim -+ exact norm_pos_iff.2 this -+ have hEq : -+ ‖(weierstrassFactor m (u / a))⁻¹‖ = -+ Real.exp (-Real.log ‖weierstrassFactor m (u / a)‖) := by -+ simp [norm_inv, Real.exp_neg, Real.exp_log hpos] -+ have := Real.exp_le_exp.2 hneglog -+ simpa [hEq] using this -+ -+lemma norm_inv_weierstrassFactor_le_exp_far -+ {m : ℕ} {τ r : ℝ} {u a : ℂ} -+ (hur : ‖u‖ = r) (ha : a ≠ 0) -+ (hz : ‖u / a‖ ≤ (1 / 2 : ℝ)) (hτ_le : τ ≤ (m + 1 : ℝ)) : -+ ‖(weierstrassFactor m (u / a))⁻¹‖ ≤ Real.exp ((2 : ℝ) * (r / ‖a‖) ^ τ) := by -+ by_cases hu : u = 0 -+ · subst hu -+ have hr0 : r = 0 := by simpa [hur] using (norm_zero : ‖(0 : ℂ)‖ = 0) -+ subst hr0 -+ have h0 : 0 ≤ ((0 : ℝ) / ‖a‖) ^ τ := by -+ exact Real.rpow_nonneg (by positivity : (0 : ℝ) ≤ 0 / ‖a‖) τ -+ have h0' : 0 ≤ (2 : ℝ) * ((0 : ℝ) / ‖a‖) ^ τ := mul_nonneg (by norm_num) h0 -+ have hexp : (1 : ℝ) ≤ Real.exp ((2 : ℝ) * ((0 : ℝ) / ‖a‖) ^ τ) := -+ (Real.one_le_exp_iff).2 h0' -+ simpa using hexp -+ have hlogE := -+ log_norm_weierstrassFactor_ge_neg_two_pow (m := m) (z := (u / a)) hz -+ have hneglog : -Real.log ‖weierstrassFactor m (u / a)‖ ≤ (2 : ℝ) * (r / ‖a‖) ^ τ := by -+ have h1 : -Real.log ‖weierstrassFactor m (u / a)‖ ≤ (2 : ℝ) * ‖u / a‖ ^ (m + 1) := by -+ linarith [hlogE] -+ set x : ℝ := ‖u / a‖ -+ have hx1 : x ≤ 1 := le_trans (by simpa [x] using hz) (by norm_num) -+ have hxpos : 0 < x := by -+ simpa [x] using (norm_pos_iff.2 (div_ne_zero hu ha)) -+ have hτ_le' : τ ≤ ((m + 1 : ℕ) : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one] using hτ_le -+ have hpow_rpow : x ^ ((m + 1 : ℕ) : ℝ) ≤ x ^ τ := -+ Real.rpow_le_rpow_of_exponent_ge hxpos hx1 hτ_le' -+ have hpow : x ^ (m + 1) ≤ x ^ τ := by -+ simpa [← Real.rpow_natCast] using hpow_rpow -+ have h2x : (2 : ℝ) * x ^ (m + 1) ≤ (2 : ℝ) * x ^ τ := -+ mul_le_mul_of_nonneg_left hpow (by positivity) -+ have h2 : (2 : ℝ) * ‖u / a‖ ^ (m + 1) ≤ (2 : ℝ) * (‖u / a‖ : ℝ) ^ τ := by -+ simpa [x] using h2x -+ have h3 : (‖u‖ / ‖a‖) ^ τ = (r / ‖a‖) ^ τ := by -+ simp [hur] -+ exact (h1.trans h2).trans_eq (by simp [h3]) -+ have hpos : 0 < ‖weierstrassFactor m (u / a)‖ := by -+ have : weierstrassFactor m (u / a) ≠ 0 := by -+ intro h0 -+ have : u / a = (1 : ℂ) := (weierstrassFactor_eq_zero_iff m (u / a)).1 h0 -+ have : u = a := (div_eq_one_iff_eq ha).1 this -+ have : (‖u / a‖ : ℝ) = 1 := by simpa [this] using (by simp [ha]) -+ linarith [hz, this] -+ exact norm_pos_iff.2 this -+ have hEq : -+ ‖(weierstrassFactor m (u / a))⁻¹‖ = -+ Real.exp (-Real.log ‖weierstrassFactor m (u / a)‖) := by -+ simp [norm_inv, Real.exp_neg, Real.exp_log hpos] -+ have := Real.exp_le_exp.2 hneglog -+ simpa [hEq] using this -+ -+end Complex.Hadamard -+end -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Counting.lean b/PrimeNumberTheoremAnd/SiegelZeros/Counting.lean -new file mode 100644 -index 0000000..cc47f9c ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/Counting.lean -@@ -0,0 +1,689 @@ -+import Mathlib -+ -+namespace SiegelZeros -+ -+open _root_.Real _root_.Function _root_.Function.locallyFinsuppWithin -+ -+section -+open Filter Function MeromorphicOn Metric Real Set -+ -+namespace Function.locallyFinsuppWithin -+ -+variable {E : Type*} [NormedAddCommGroup E] -+ -+lemma norm_le_abs_of_mem_toClosedBall_support {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} -+ (hz : z ∈ (toClosedBall r D).support) : ‖z‖ ≤ |r| := by -+ have hz_ball : z ∈ closedBall (0 : E) |r| := (toClosedBall r D).supportWithinDomain hz -+ simpa [mem_closedBall, dist_zero_right] using hz_ball -+ -+lemma toClosedBall_eval_eq_of_norm_le_abs {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} -+ (hz : ‖z‖ ≤ |r|) : toClosedBall r D z = D z := by -+ have hz_ball : z ∈ closedBall (0 : E) |r| := by -+ simpa [mem_closedBall, dist_zero_right] using hz -+ simpa using toClosedBall_eval_within (f := D) hz_ball -+ -+lemma mem_toClosedBall_support_of_mem_support_of_norm_le_abs -+ {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} (hzD : z ∈ D.support) (hzR : ‖z‖ ≤ |r|) : -+ z ∈ (toClosedBall r D).support := by -+ rw [Function.mem_support] -+ rw [toClosedBall_eval_eq_of_norm_le_abs hzR] -+ rwa [Function.mem_support] at hzD -+ -+lemma mem_support_of_mem_toClosedBall_support {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} -+ (hz : z ∈ (toClosedBall r D).support) : z ∈ D.support := by -+ have hnorm : ‖z‖ ≤ |r| := norm_le_abs_of_mem_toClosedBall_support hz -+ rw [Function.mem_support] at hz ⊢ -+ rw [toClosedBall_eval_eq_of_norm_le_abs hnorm] at hz -+ exact hz -+ -+noncomputable def massClosedBall₀ {E : Type*} [NormedAddCommGroup E] [ProperSpace E] -+ (D : locallyFinsupp E ℤ) (R : ℝ) : ℝ := by -+ classical -+ exact -+ (((finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).toFinset).filter -+ (fun z => z ≠ (0 : E))).sum fun z => (D z : ℝ) -+ -+end Function.locallyFinsuppWithin -+ -+namespace Function.locallyFinsuppWithin -+ -+theorem logCounting_divisor_eq_circleAverage_sub_const_of_differentiable -+ {R : ℝ} {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hR : R ≠ 0) : -+ logCounting (divisor f ⊤) R = -+ circleAverage (log ‖f ·‖) 0 R - log ‖meromorphicTrailingCoeffAt f 0‖ := by -+ have hmero : Meromorphic f := fun z => (hf.analyticAt z).meromorphicAt -+ simpa [top_eq_univ] using -+ logCounting_divisor_eq_circleAverage_sub_const (f := f) hmero hR -+ -+end Function.locallyFinsuppWithin -+end -+section -+namespace Real -+ -+theorem log_one_add_exp_le_add_log_two {x : ℝ} (hx : 0 ≤ x) : -+ log (1 + exp x) ≤ x + log 2 := by -+ have hexp_one : (1 : ℝ) ≤ exp x := by -+ simpa using (one_le_exp_iff.2 hx) -+ have hadd : 1 + exp x ≤ 2 * exp x := by linarith -+ have hlog : log (1 + exp x) ≤ log (2 * exp x) := -+ log_le_log (by positivity) hadd -+ calc -+ log (1 + exp x) ≤ log (2 * exp x) := hlog -+ _ = log 2 + x := by simp [log_mul, add_comm] -+ _ = x + log 2 := by ring -+ -+theorem log_one_add_le_add_log_two_of_le_exp {x y : ℝ} (hy : 0 ≤ y) (hx : 0 ≤ x) -+ (hxy : y ≤ exp x) : -+ log (1 + y) ≤ x + log 2 := by -+ have hpos : 0 < (1 : ℝ) + y := by linarith -+ have hle : (1 : ℝ) + y ≤ 1 + exp x := by linarith -+ exact (log_le_log hpos hle).trans (log_one_add_exp_le_add_log_two hx) -+ -+theorem le_exp_of_log_one_add_le {x y : ℝ} (hy : 0 ≤ y) (hxy : log (1 + y) ≤ x) : -+ y ≤ exp x := by -+ have hpos : 0 < (1 : ℝ) + y := by linarith -+ have hone : 1 + y ≤ exp x := (log_le_iff_le_exp hpos).1 hxy -+ linarith -+ -+theorem neg_posLog_inv_le_log (x : ℝ) : -log⁺ x⁻¹ ≤ log x := by -+ linarith [posLog_sub_posLog_inv (x := x), posLog_nonneg (x := x)] -+ -+end Real -+end -+section -+namespace Real -+ -+variable {α E : Type*} [SeminormedAddCommGroup E] -+ -+theorem log_norm_le_log_one_add_norm (w : E) : -+ Real.log ‖w‖ ≤ Real.log (1 + ‖w‖) := by -+ by_cases h0 : ‖w‖ = 0 -+ · simp [h0] -+ · have hpos : 0 < ‖w‖ := lt_of_le_of_ne (norm_nonneg w) (Ne.symm h0) -+ exact Real.log_le_log hpos (by linarith [norm_nonneg w]) -+ -+variable {F : Type*} [NormedAddCommGroup F] -+ -+theorem log_nonneg_mul_inv_norm_of_norm_le {z : F} {r : ℝ} (hz : ‖z‖ ≤ r) : -+ 0 ≤ Real.log (r * ‖z‖⁻¹) := by -+ by_cases hz0 : z = 0 -+ · simp [hz0] -+ · have hzpos : 0 < ‖z‖ := norm_pos_iff.2 hz0 -+ have : (1 : ℝ) ≤ r * ‖z‖⁻¹ := by -+ have : (1 : ℝ) ≤ r / ‖z‖ := (one_le_div hzpos).2 hz -+ simpa [div_eq_mul_inv] using this -+ exact Real.log_nonneg this -+ -+theorem log_two_le_log_two_mul_mul_inv_norm_of_norm_le {z : F} {R : ℝ} (hz0 : z ≠ 0) -+ (hz : ‖z‖ ≤ R) : -+ Real.log 2 ≤ Real.log ((2 * R) * ‖z‖⁻¹) := by -+ have hzpos : 0 < ‖z‖ := norm_pos_iff.2 hz0 -+ have hRdiv : (1 : ℝ) ≤ R / ‖z‖ := (one_le_div hzpos).2 hz -+ have hle2 : (2 : ℝ) ≤ (2 * R) * ‖z‖⁻¹ := by -+ have : (2 : ℝ) ≤ 2 * (R / ‖z‖) := by nlinarith -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using this -+ exact Real.log_le_log (by norm_num) hle2 -+ -+theorem norm_le_exp_mul_rpow_of_exponent_le -+ {f : α → E} {r : α → ℝ} {C ρ τ : ℝ} (hC : 0 ≤ C) (hr : ∀ x, 1 ≤ r x) (hρτ : ρ ≤ τ) -+ (hbound : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ ρ)) : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ) := by -+ intro x -+ refine (hbound x).trans (Real.exp_le_exp.2 ?_) -+ exact mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le (hr x) hρτ) hC -+ -+theorem norm_le_exp_mul_rpow_of_log_growth -+ {f : α → E} {r : α → ℝ} {C ρ τ : ℝ} (hC : 0 ≤ C) (hr : ∀ x, 1 ≤ r x) (hρτ : ρ ≤ τ) -+ (hlog : ∀ x, Real.log (1 + ‖f x‖) ≤ C * (r x) ^ ρ) : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ) := by -+ intro x -+ have hpow : (r x) ^ ρ ≤ (r x) ^ τ := -+ Real.rpow_le_rpow_of_exponent_le (hr x) hρτ -+ have hlogτ : Real.log (1 + ‖f x‖) ≤ C * (r x) ^ τ := -+ (hlog x).trans (mul_le_mul_of_nonneg_left hpow hC) -+ exact Real.le_exp_of_log_one_add_le (norm_nonneg (f x)) hlogτ -+ -+theorem log_growth_of_norm_le_exp_mul_rpow -+ {f : α → E} {r : α → ℝ} {C τ : ℝ} (hC : 0 < C) (hτ : 0 ≤ τ) -+ (hr : ∀ x, 1 ≤ r x) (hbound : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ)) : -+ ∃ C' > 0, ∀ x, Real.log (1 + ‖f x‖) ≤ C' * (r x) ^ τ := by -+ refine ⟨C + Real.log 2, by -+ have hlog2 : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) -+ linarith, ?_⟩ -+ intro x -+ have hX : (1 : ℝ) ≤ (r x) ^ τ := Real.one_le_rpow (hr x) hτ -+ have hB : 0 ≤ C * (r x) ^ τ := -+ mul_nonneg hC.le (Real.rpow_nonneg (le_trans zero_le_one (hr x)) _) -+ have hlog : -+ Real.log (1 + ‖f x‖) ≤ C * (r x) ^ τ + Real.log 2 := -+ Real.log_one_add_le_add_log_two_of_le_exp (norm_nonneg _) hB (hbound x) -+ have hlog2_nonneg : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) -+ nlinarith [hlog, hX, hlog2_nonneg] -+ -+theorem exists_norm_le_exp_mul_pow_of_rpow_bound -+ {f : α → E} {r : α → ℝ} {τ : ℝ} {n : ℕ} (hr : ∀ x, 1 ≤ r x) (hτn : τ < (n : ℝ)) -+ (hbound : ∃ C > 0, ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ)) : -+ ∃ C > 0, ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ n) := by -+ rcases hbound with ⟨C, hCpos, hC⟩ -+ have hweak : -+ ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ (n : ℝ)) := -+ norm_le_exp_mul_rpow_of_exponent_le -+ (f := f) (r := r) hCpos.le hr (le_of_lt hτn) hC -+ refine ⟨C, hCpos, ?_⟩ -+ intro x -+ have hpow : (r x) ^ (n : ℝ) = (r x) ^ n := Real.rpow_natCast (r x) n -+ simpa [hpow] using hweak x -+ -+theorem one_add_le_three_mul_one_add_of_le_two_mul_max {x r : ℝ} (hx : 0 ≤ x) -+ (hr : r ≤ 2 * max x 1) : 1 + r ≤ 3 * (1 + x) := by -+ have hmax : max x 1 ≤ 1 + x := max_le_iff.2 ⟨by linarith, by linarith⟩ -+ nlinarith -+ -+theorem exp_mul_rpow_le_exp_mul_rpow_of_le_mul -+ {A B x y τ : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hy : 0 ≤ y) -+ (hτ : 0 ≤ τ) (hxy : x ≤ B * y) : Real.exp (A * x ^ τ) ≤ Real.exp ((A * B ^ τ) * y ^ τ) := by -+ refine Real.exp_le_exp.2 ?_ -+ have hpow : x ^ τ ≤ (B * y) ^ τ := Real.rpow_le_rpow hx hxy hτ -+ have hsplit : (B * y) ^ τ = B ^ τ * y ^ τ := by -+ simpa using (Real.mul_rpow (x := B) (y := y) (z := τ) hB hy) -+ simpa [mul_assoc] using mul_le_mul_of_nonneg_left (hpow.trans_eq hsplit) hA -+ -+theorem exists_between_self_and_floor_add_one_same_floor {ρ : ℝ} (hρ : 0 ≤ ρ) : -+ ∃ τ : ℝ, ρ < τ ∧ τ < (Nat.floor ρ + 1 : ℝ) ∧ 0 ≤ τ ∧ Nat.floor τ = Nat.floor ρ := by -+ set m : ℕ := Nat.floor ρ -+ set τ : ℝ := (ρ + (m + 1 : ℝ)) / 2 -+ have hm : ρ < (m + 1 : ℝ) := by simpa [m] using Nat.lt_floor_add_one (a := ρ) -+ have hτ : ρ < τ := by dsimp [τ]; linarith -+ have hτ_lt : τ < (m + 1 : ℝ) := by dsimp [τ]; linarith -+ have hτ_nonneg : 0 ≤ τ := le_trans hρ (le_of_lt hτ) -+ have hfloorτ : Nat.floor τ = m := by -+ have hm_le_τ : (m : ℝ) ≤ τ := le_trans (Nat.floor_le hρ) (le_of_lt hτ) -+ have hτ_lt_m1 : τ < (m : ℝ) + 1 := by simpa [add_assoc, add_comm, add_left_comm] using hτ_lt -+ exact (Nat.floor_eq_iff hτ_nonneg).2 ⟨hm_le_τ, hτ_lt_m1⟩ -+ exact ⟨τ, hτ, by simpa [m] using hτ_lt, hτ_nonneg, by simpa [m] using hfloorτ⟩ -+ -+open Metric Complex -+ -+theorem log_norm_le_of_log_one_add_growth_on_sphere {f : ℂ → ℂ} {C ρ R : ℝ} -+ (hC : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {z : ℂ} -+ (hz : z ∈ sphere (0 : ℂ) |R|) : Real.log ‖f z‖ ≤ C * (1 + |R|) ^ ρ := by -+ have hz_norm : ‖z‖ = |R| := by -+ simpa [mem_sphere, dist_zero_right] using hz -+ simpa [hz_norm] using le_trans (log_norm_le_log_one_add_norm (f z)) (hC z) -+ -+end Real -+end -+section -+open Filter _root_.SiegelZeros.Function MeromorphicOn Metric Real Set -+ -+namespace Function.locallyFinsuppWithin -+ -+theorem logCounting_divisor_le_of_log_growth {f : ℂ → ℂ} {ρ C : ℝ} (hf : Differentiable ℂ f) -+ (hC : ∀ z : ℂ, log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {R : ℝ} (hR0 : 0 < R) : -+ logCounting (divisor f (Set.univ : Set ℂ)) R -+ ≤ C * (1 + |R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ have hR : R ≠ 0 := ne_of_gt hR0 -+ have hEq := -+ logCounting_divisor_eq_circleAverage_sub_const_of_differentiable (f := f) hf hR -+ have hf_sphere : MeromorphicOn f (sphere (0 : ℂ) |R|) := by -+ intro z hz -+ exact (hf.analyticAt z).meromorphicAt -+ have hInt : CircleIntegrable (fun z : ℂ => log ‖f z‖) 0 R := -+ MeromorphicOn.circleIntegrable_log_norm hf_sphere -+ have hbound_circle : ∀ z ∈ sphere (0 : ℂ) |R|, -+ log ‖f z‖ ≤ C * (1 + |R|) ^ ρ := by -+ intro z hz -+ exact log_norm_le_of_log_one_add_growth_on_sphere hC hz -+ have hCircleAvg_le : -+ circleAverage (fun z : ℂ => log ‖f z‖) 0 R ≤ C * (1 + |R|) ^ ρ := -+ circleAverage_mono_on_of_le_circle (c := (0 : ℂ)) (R := R) -+ (f := fun z => log ‖f z‖) hInt hbound_circle -+ calc -+ logCounting (divisor f (Set.univ : Set ℂ)) R -+ = circleAverage (fun z : ℂ => log ‖f z‖) 0 R -+ - log ‖meromorphicTrailingCoeffAt f 0‖ := by -+ simpa [top_eq_univ] using hEq -+ _ ≤ circleAverage (fun z : ℂ => log ‖f z‖) 0 R -+ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ have : -+ -log ‖meromorphicTrailingCoeffAt f 0‖ -+ ≤ |log ‖meromorphicTrailingCoeffAt f 0‖| := -+ neg_le_abs (log ‖meromorphicTrailingCoeffAt f 0‖) -+ linarith -+ _ ≤ C * (1 + |R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ nlinarith [hCircleAvg_le] -+ -+variable {E : Type*} [NormedAddCommGroup E] [ProperSpace E] -+ -+theorem log_two_mul_massClosedBall₀_le_logCounting {D : locallyFinsupp E ℤ} (hDnonneg : 0 ≤ D) -+ {R : ℝ} (hR : 1 ≤ R) : -+ (log 2) * massClosedBall₀ D R ≤ logCounting D (2 * R) := by -+ classical -+ have hR0 : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR -+ set r : ℝ := 2 * R -+ have hrpos : 0 < r := by dsimp [r]; nlinarith -+ let Dr := toClosedBall r D -+ have hDr_fin : Set.Finite Dr.support := Dr.finiteSupport (isCompact_closedBall (0 : E) |r|) -+ let F : Finset E := hDr_fin.toFinset -+ let SR : Finset E := -+ (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).toFinset -+ let S : Finset E := SR.filter fun z => z ≠ (0 : E) -+ have hS_sub : S ⊆ F := by -+ intro z hzS -+ have hz_mem_SR : z ∈ SR := (Finset.mem_filter.1 hzS).1 -+ have hzR : z ∈ (toClosedBall R D).support := by -+ exact (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).mem_toFinset.1 -+ hz_mem_SR -+ have hz_norm_le_R : ‖z‖ ≤ R := by -+ have := norm_le_abs_of_mem_toClosedBall_support hzR -+ simpa [abs_of_pos hR0] using this -+ have hz_norm_le_r : ‖z‖ ≤ |r| := by -+ have : ‖z‖ ≤ r := le_trans hz_norm_le_R (by dsimp [r]; nlinarith) -+ simpa [abs_of_pos hrpos] using this -+ have hzD : z ∈ D.support := mem_support_of_mem_toClosedBall_support hzR -+ have : z ∈ Dr.support := by -+ simpa [Dr] using -+ mem_toClosedBall_support_of_mem_support_of_norm_le_abs (D := D) (r := r) hzD hz_norm_le_r -+ exact hDr_fin.mem_toFinset.2 this -+ have hlogCounting : -+ logCounting D r -+ = (F.sum fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) + (D 0 : ℝ) * log r := by -+ have hsupp : Function.support (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) ⊆ F := by -+ intro z hz -+ have : Dr z ≠ 0 := by -+ by_contra h0 -+ simp [Function.mem_support, h0] at hz -+ have : z ∈ Dr.support := by simpa [Function.mem_support] using this -+ exact hDr_fin.mem_toFinset.2 this -+ simp [logCounting, Dr, r, -+ finsum_eq_sum_of_support_subset (f := fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) (s := F) hsupp] -+ have hsum_le : -+ (log 2) * (S.sum fun z => (D z : ℝ)) -+ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := by -+ have hterm_nonneg : ∀ z ∈ F, 0 ≤ (Dr z : ℝ) * log (r * ‖z‖⁻¹) := by -+ intro z hzF -+ have hz_sup : z ∈ Dr.support := hDr_fin.mem_toFinset.1 hzF -+ have hDz : 0 ≤ Dr z := by -+ have hDz' : 0 ≤ D z := hDnonneg z -+ have hDrz : Dr z = D z := -+ toClosedBall_eval_eq_of_norm_le_abs (norm_le_abs_of_mem_toClosedBall_support hz_sup) -+ simpa [hDrz] using hDz' -+ have hlog : 0 ≤ log (r * ‖z‖⁻¹) := by -+ have hzle : ‖z‖ ≤ r := by -+ have hnorm := norm_le_abs_of_mem_toClosedBall_support hz_sup -+ simpa [abs_of_pos hrpos] using hnorm -+ exact log_nonneg_mul_inv_norm_of_norm_le hzle -+ exact mul_nonneg (by exact_mod_cast hDz) hlog -+ have hsumSF : -+ S.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) -+ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := -+ Finset.sum_le_sum_of_subset_of_nonneg hS_sub (by -+ intro z hzF _; exact hterm_nonneg z hzF) -+ have hterm_ge : ∀ z ∈ S, (log 2) * (D z : ℝ) ≤ (Dr z : ℝ) * log (r * ‖z‖⁻¹) := by -+ intro z hzS -+ have hz0 : z ≠ (0 : E) := (Finset.mem_filter.1 hzS).2 -+ have hz_norm_le_R : ‖z‖ ≤ R := by -+ have hz_mem_SR : z ∈ SR := (Finset.mem_filter.1 hzS).1 -+ have hzRsup : z ∈ (toClosedBall R D).support := by -+ exact (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).mem_toFinset.1 -+ hz_mem_SR -+ have hnorm := norm_le_abs_of_mem_toClosedBall_support hzRsup -+ simpa [abs_of_pos hR0] using hnorm -+ have hlog_le : log 2 ≤ log (r * ‖z‖⁻¹) := by -+ simpa [r] using log_two_le_log_two_mul_mul_inv_norm_of_norm_le hz0 hz_norm_le_R -+ have hDz_nonneg : 0 ≤ D z := hDnonneg z -+ have hz_in_ballr : z ∈ closedBall (0 : E) |r| := by -+ have : ‖z‖ ≤ r := le_trans hz_norm_le_R (by dsimp [r]; nlinarith) -+ simpa [mem_closedBall, dist_zero_right, abs_of_pos hrpos] using this -+ have hDrz : Dr z = D z := by -+ have hz_norm_le : ‖z‖ ≤ |r| := by -+ simpa [mem_closedBall, dist_zero_right] using hz_in_ballr -+ simpa [Dr] using toClosedBall_eval_eq_of_norm_le_abs (D := D) (r := r) (z := z) hz_norm_le -+ have : (log 2) * (D z : ℝ) ≤ (log (r * ‖z‖⁻¹)) * (D z : ℝ) := -+ mul_le_mul_of_nonneg_right hlog_le (by exact_mod_cast hDz_nonneg) -+ simpa [hDrz, mul_assoc, mul_left_comm, mul_comm] using this -+ calc -+ (log 2) * (S.sum fun z => (D z : ℝ)) -+ = S.sum (fun z => (log 2) * (D z : ℝ)) := by simp [Finset.mul_sum] -+ _ ≤ S.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := -+ Finset.sum_le_sum fun z hz => hterm_ge z hz -+ _ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := hsumSF -+ have hcenter_nonneg : 0 ≤ (D 0 : ℝ) * log r := by -+ have hD0 : 0 ≤ D 0 := hDnonneg 0 -+ have hlogr : 0 ≤ log r := log_nonneg (by nlinarith [hR]) -+ exact mul_nonneg (by exact_mod_cast hD0) hlogr -+ have : (log 2) * (S.sum fun z => (D z : ℝ)) ≤ logCounting D r := by -+ rw [hlogCounting] -+ nlinarith [hsum_le, hcenter_nonneg] -+ simpa [massClosedBall₀, r, S, SR] using this -+ -+theorem massClosedBall₀_divisor_le_of_log_growth {f : ℂ → ℂ} {ρ C : ℝ} -+ (hf : Differentiable ℂ f) -+ (hC : ∀ z : ℂ, log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {R : ℝ} (hR : 1 ≤ R) : -+ massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R -+ ≤ (C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖|) / log 2 := by -+ have hR0 : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR -+ have hlog2pos : 0 < log 2 := log_pos (by norm_num : (1 : ℝ) < 2) -+ have hlow : -+ (log 2) * massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R -+ ≤ logCounting (divisor f (Set.univ : Set ℂ)) (2 * R) := -+ log_two_mul_massClosedBall₀_le_logCounting -+ (D := divisor f (Set.univ : Set ℂ)) -+ (MeromorphicOn.AnalyticOnNhd.divisor_nonneg -+ (hf.differentiableOn.analyticOnNhd isOpen_univ)) hR -+ have hupp : -+ logCounting (divisor f (Set.univ : Set ℂ)) (2 * R) -+ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ have h2R0 : 0 < 2 * R := by nlinarith [hR0] -+ simpa using logCounting_divisor_le_of_log_growth (f := f) (ρ := ρ) (C := C) hf hC -+ (R := 2 * R) h2R0 -+ have hmul : -+ (log 2) * massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R -+ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := -+ hlow.trans hupp -+ have hmul' : -+ massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R * log 2 -+ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using hmul -+ exact (le_div_iff₀ hlog2pos).2 hmul' -+ -+end Function.locallyFinsuppWithin -+end -+section -+open Set -+ -+variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] -+ -+theorem Differentiable.divisor_nonneg {f : ℂ → E} (hf : Differentiable ℂ f) : -+ 0 ≤ MeromorphicOn.divisor f (univ : Set ℂ) := -+ MeromorphicOn.AnalyticOnNhd.divisor_nonneg (hf.differentiableOn.analyticOnNhd isOpen_univ) -+end -+section -+noncomputable section -+ -+open scoped BigOperators -+open Filter -+ -+namespace Real -+ -+lemma two_pow_floor_logb_le {x : ℝ} (hx : 1 ≤ x) : -+ (2 : ℝ) ^ (⌊Real.logb 2 x⌋₊ : ℝ) ≤ x := by -+ have hx0 : 0 < x := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hx -+ have hlog_nonneg : 0 ≤ Real.logb 2 x := -+ Real.logb_nonneg (b := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) hx -+ have hfloor_le : (⌊Real.logb 2 x⌋₊ : ℝ) ≤ Real.logb 2 x := by -+ simpa using (Nat.floor_le hlog_nonneg) -+ exact (Real.le_logb_iff_rpow_le (b := (2 : ℝ)) -+ (x := (⌊Real.logb 2 x⌋₊ : ℝ)) (y := x) -+ (by norm_num : (1 : ℝ) < 2) hx0).1 hfloor_le -+ -+lemma lt_two_pow_floor_logb_add_one {x : ℝ} (hx : 1 ≤ x) : -+ x < (2 : ℝ) ^ ((⌊Real.logb 2 x⌋₊ : ℝ) + 1) := by -+ have hx0 : 0 < x := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hx -+ have hlt : Real.logb 2 x < (⌊Real.logb 2 x⌋₊ : ℝ) + 1 := by -+ simpa using (Nat.lt_floor_add_one (Real.logb 2 x)) -+ exact (Real.logb_lt_iff_lt_rpow (b := (2 : ℝ)) (x := x) -+ (y := (⌊Real.logb 2 x⌋₊ : ℝ) + 1) -+ (by norm_num : (1 : ℝ) < 2) hx0).1 hlt -+ -+lemma dyadicShell_lower_bound {r0 x : ℝ} {k : ℕ} (hr0 : 0 < r0) (hx : r0 ≤ x) -+ (hk : ⌊Real.logb 2 (x / r0)⌋₊ = k) : -+ r0 * (2 : ℝ) ^ (k : ℝ) ≤ x := by -+ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 -+ have hx1 : (1 : ℝ) ≤ x / r0 := by -+ have : r0 / r0 ≤ x / r0 := div_le_div_of_nonneg_right hx hr0.le -+ simpa [hr0ne] using this -+ have hle : (2 : ℝ) ^ (k : ℝ) ≤ x / r0 := by -+ have := Real.two_pow_floor_logb_le (x := x / r0) hx1 -+ simpa [hk] using this -+ have := mul_le_mul_of_nonneg_left hle hr0.le -+ have hxEq : r0 * (x / r0) = x := by -+ field_simp [hr0ne] -+ simpa [mul_assoc, hxEq] using this -+ -+lemma dyadicShell_upper_bound {r0 x : ℝ} {k : ℕ} (hr0 : 0 < r0) (hx : r0 ≤ x) -+ (hk : ⌊Real.logb 2 (x / r0)⌋₊ = k) : -+ x ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1) := by -+ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 -+ have hx1 : (1 : ℝ) ≤ x / r0 := by -+ have : r0 / r0 ≤ x / r0 := div_le_div_of_nonneg_right hx hr0.le -+ simpa [hr0ne] using this -+ have hlt : x / r0 < (2 : ℝ) ^ ((k : ℝ) + 1) := by -+ have := Real.lt_two_pow_floor_logb_add_one (x := x / r0) hx1 -+ simpa [hk] using this -+ have := mul_lt_mul_of_pos_left hlt hr0 -+ have hxEq : r0 * (x / r0) = x := by -+ field_simp [hr0ne] -+ exact le_of_lt (by simpa [mul_assoc, hxEq] using this) -+ -+lemma exists_nat_le_two_pow (A : ℝ) : -+ ∃ k0 : ℕ, ∀ n ≥ k0, A ≤ (2 : ℝ) ^ n := by -+ have htend : Tendsto (fun n : ℕ => (2 : ℝ) ^ n) atTop atTop := -+ tendsto_pow_atTop_atTop_of_one_lt (r := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) -+ exact eventually_atTop.1 ((tendsto_atTop.1 htend) A) -+ -+lemma one_le_dyadicRadius_succ_of_inv_le_two_pow -+ {r0 : ℝ} {k0 kk : ℕ} (hr0 : 0 < r0) -+ (hk0 : ∀ n ≥ k0, (1 / r0 : ℝ) ≤ (2 : ℝ) ^ n) (hkk : k0 ≤ kk + 1) : -+ (1 : ℝ) ≤ r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) := by -+ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 -+ have hpow_nat : (1 / r0 : ℝ) ≤ (2 : ℝ) ^ (kk + 1) := hk0 (kk + 1) hkk -+ have hpow_rpow : (1 / r0 : ℝ) ≤ (2 : ℝ) ^ ((kk : ℝ) + 1) := by -+ have hcast : (2 : ℝ) ^ ((kk : ℝ) + 1) = (2 : ℝ) ^ (kk + 1) := by -+ calc -+ (2 : ℝ) ^ ((kk : ℝ) + 1) = (2 : ℝ) ^ ((kk + 1 : ℕ) : ℝ) := by -+ simp [Nat.cast_add, Nat.cast_one] -+ _ = (2 : ℝ) ^ (kk + 1) := by -+ simpa using (Real.rpow_natCast (2 : ℝ) (kk + 1)) -+ simpa [hcast] using hpow_nat -+ have : (r0 * (1 / r0) : ℝ) ≤ r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) := -+ mul_le_mul_of_nonneg_left hpow_rpow hr0.le -+ simpa [one_div, hr0ne, mul_assoc] using this -+ -+lemma one_add_abs_two_mul_dyadicRadius_rpow_le {r0 ρ : ℝ} (k : ℕ) -+ (hr0 : 0 < r0) (hρ : 0 ≤ ρ) : -+ (1 + |2 * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1))|) ^ ρ -+ ≤ (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by -+ let Rk : ℝ := r0 * (2 : ℝ) ^ ((k : ℝ) + 1) -+ have hRk' : |2 * Rk| = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by -+ have hnonneg : 0 ≤ (2 : ℝ) * Rk := by -+ have : 0 ≤ Rk := by -+ dsimp [Rk] -+ exact mul_nonneg hr0.le (le_of_lt (Real.rpow_pos_of_pos (by norm_num) _)) -+ nlinarith -+ have hmul : (2 : ℝ) * Rk = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by -+ dsimp [Rk] -+ calc -+ (2 : ℝ) * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) -+ = (2 * r0) * (2 : ℝ) ^ ((k : ℝ) + 1) := by ring -+ _ = (2 * r0) * ((2 : ℝ) ^ (k : ℝ) * (2 : ℝ) ^ (1 : ℝ)) := by -+ simp [Real.rpow_add, mul_assoc] -+ _ = (2 * r0) * ((2 : ℝ) ^ (k : ℝ) * 2) := by simp [Real.rpow_one] -+ _ = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by ring -+ calc -+ |2 * Rk| = 2 * Rk := abs_of_nonneg hnonneg -+ _ = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := hmul -+ have hbase : -+ (1 + |2 * Rk|) ≤ (1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ) := by -+ have h1 : (1 : ℝ) ≤ (2 : ℝ) ^ (k : ℝ) := by -+ have : (1 : ℝ) ≤ (2 : ℝ) ^ (k : ℕ) := by -+ simpa using (one_le_pow₀ (by norm_num : (1 : ℝ) ≤ (2 : ℝ))) -+ simpa [Real.rpow_natCast] using this -+ have habs : -+ 1 + |2 * Rk| ≤ (2 : ℝ) ^ (k : ℝ) + (4 * r0) * (2 : ℝ) ^ (k : ℝ) := by -+ rw [hRk'] -+ simpa [add_assoc, add_left_comm, add_comm, mul_assoc, mul_left_comm, mul_comm] using -+ (add_le_add_right h1 ((4 * r0) * (2 : ℝ) ^ (k : ℝ))) -+ have hfac : -+ (2 : ℝ) ^ (k : ℝ) + (4 * r0) * (2 : ℝ) ^ (k : ℝ) -+ = (1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ) := by -+ ring -+ exact habs.trans (le_of_eq hfac) -+ have hRnonneg : 0 ≤ (1 + |2 * Rk|) := by linarith [abs_nonneg (2 * Rk)] -+ have : -+ (1 + |2 * Rk|) ^ ρ ≤ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ := -+ Real.rpow_le_rpow hRnonneg hbase hρ -+ have hsplit : -+ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ -+ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ (k : ℝ)) ^ ρ := by -+ have h1 : 0 ≤ (1 + 4 * r0) := by nlinarith [hr0.le] -+ have h2 : 0 ≤ (2 : ℝ) ^ (k : ℝ) := -+ le_of_lt (Real.rpow_pos_of_pos (by norm_num) _) -+ simpa using (Real.mul_rpow h1 h2 (z := ρ)) -+ have hpow : ((2 : ℝ) ^ (k : ℝ)) ^ ρ = ((2 : ℝ) ^ ρ) ^ k := by -+ have h2nonneg : (0 : ℝ) ≤ 2 := by norm_num -+ calc -+ ((2 : ℝ) ^ (k : ℝ)) ^ ρ = (2 : ℝ) ^ ((k : ℝ) * ρ) := by -+ simp [Real.rpow_mul] -+ _ = ((2 : ℝ) ^ ρ) ^ (k : ℝ) := by -+ simpa [mul_comm] using -+ (Real.rpow_mul (x := (2 : ℝ)) (y := ρ) (z := (k : ℝ)) h2nonneg) -+ _ = ((2 : ℝ) ^ ρ) ^ k := by -+ simp [Real.rpow_natCast] -+ calc -+ (1 + |2 * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1))|) ^ ρ -+ = (1 + |2 * Rk|) ^ ρ := by rfl -+ _ ≤ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ := this -+ _ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ (k : ℝ)) ^ ρ := hsplit -+ _ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by -+ simpa [mul_assoc] using congrArg (fun t => (1 + 4 * r0) ^ ρ * t) hpow -+ -+lemma tsum_inv_rpow_le_card_mul_of_lower_bound {α : Type*} [Fintype α] {a : α → ℝ} -+ {R τ : ℝ} (hR : 0 < R) (hτ : 0 < τ) (ha_nonneg : ∀ x, 0 ≤ a x) -+ (ha_lower : ∀ x, R ≤ a x) : -+ (∑' x : α, (a x)⁻¹ ^ τ) ≤ (Fintype.card α : ℝ) * (R⁻¹ ^ τ) := by -+ have hsum_le : -+ (∑ x : α, (a x)⁻¹ ^ τ) ≤ ∑ _x : α, R⁻¹ ^ τ := by -+ refine Finset.sum_le_sum ?_ -+ intro x _hx -+ have hinv : (a x)⁻¹ ≤ R⁻¹ := by -+ simpa using (inv_anti₀ hR (ha_lower x)) -+ exact Real.rpow_le_rpow (inv_nonneg.2 (ha_nonneg x)) hinv hτ.le -+ simpa [tsum_fintype, Finset.sum_const, nsmul_eq_mul, mul_comm] using hsum_le -+ -+lemma inv_dyadicRadius_rpow_eq (r0 τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : -+ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = -+ (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by -+ have h2k_nonneg : 0 ≤ (2 : ℝ) ^ (k : ℝ) := -+ le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) -+ calc -+ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = -+ (r0 * (2 : ℝ) ^ (k : ℝ)) ^ (-τ) := by -+ simpa using (Real.rpow_neg_eq_inv_rpow (r0 * (2 : ℝ) ^ (k : ℝ)) τ).symm -+ _ = r0 ^ (-τ) * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) := by -+ simpa using (Real.mul_rpow hr0 h2k_nonneg (z := -τ)) -+ _ = (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by -+ have hr0' : r0 ^ (-τ) = (r0⁻¹ : ℝ) ^ τ := by -+ simp [Real.rpow_neg_eq_inv_rpow] -+ have h2' : ((2 : ℝ) ^ (k : ℝ)) ^ (-τ) = ((2 : ℝ) ^ (-τ)) ^ k := by -+ have h2nonneg : (0 : ℝ) ≤ (2 : ℝ) := by norm_num -+ calc -+ ((2 : ℝ) ^ (k : ℝ)) ^ (-τ) = (2 : ℝ) ^ ((k : ℝ) * (-τ)) := by -+ exact (Real.rpow_mul (x := (2 : ℝ)) (y := (k : ℝ)) (z := -τ) -+ h2nonneg).symm -+ _ = (2 : ℝ) ^ ((-τ) * (k : ℝ)) := by ring_nf -+ _ = ((2 : ℝ) ^ (-τ)) ^ (k : ℝ) := by -+ exact Real.rpow_mul (x := (2 : ℝ)) (y := -τ) (z := (k : ℝ)) h2nonneg -+ _ = ((2 : ℝ) ^ (-τ)) ^ k := by -+ simp [Real.rpow_natCast] -+ calc -+ r0 ^ (-τ) * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) -+ = (r0⁻¹ : ℝ) ^ τ * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) := by -+ rw [hr0'] -+ _ = (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by -+ rw [h2'] -+ -+lemma two_rpow_sub_eq_mul_neg (ρ τ : ℝ) : -+ (2 : ℝ) ^ (ρ - τ) = (2 : ℝ) ^ ρ * (2 : ℝ) ^ (-τ) := by -+ have h2pos : (0 : ℝ) < (2 : ℝ) := by norm_num -+ calc -+ (2 : ℝ) ^ (ρ - τ) = (2 : ℝ) ^ (ρ + (-τ)) := by ring_nf -+ _ = (2 : ℝ) ^ ρ * (2 : ℝ) ^ (-τ) := by -+ simp [Real.rpow_add h2pos] -+ -+lemma two_rpow_sub_pow_eq_mul_pow (ρ τ : ℝ) (k : ℕ) : -+ ((2 : ℝ) ^ (ρ - τ)) ^ k = -+ ((2 : ℝ) ^ ρ) ^ k * (((2 : ℝ) ^ (-τ)) ^ k) := by -+ simp [two_rpow_sub_eq_mul_neg, mul_pow] -+ -+lemma dyadic_growth_inv_term_eq (C L M r0 ρ τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : -+ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * -+ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ = (((C / L) * M) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (ρ - τ)) ^ k := by -+ have hrk_inv : -+ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = -+ (r0⁻¹ : ℝ) ^ τ * (((2 : ℝ) ^ (-τ)) ^ k) := -+ inv_dyadicRadius_rpow_eq r0 τ k hr0 -+ rw [hrk_inv, two_rpow_sub_pow_eq_mul_pow] -+ ac_rfl -+ -+lemma dyadic_trailing_inv_term_le (C L r0 τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : -+ (C / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ ≤ (((C / L) + 1) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (-τ)) ^ k := by -+ rw [inv_dyadicRadius_rpow_eq r0 τ k hr0] -+ have hcoeff : C / L ≤ C / L + 1 := by linarith -+ have hr0Inv_nonneg : 0 ≤ (r0⁻¹ : ℝ) ^ τ := -+ Real.rpow_nonneg (inv_nonneg.2 hr0) _ -+ have hmul : -+ (C / L) * ((r0⁻¹ : ℝ) ^ τ) -+ ≤ ((C / L) + 1) * ((r0⁻¹ : ℝ) ^ τ) := -+ mul_le_mul_of_nonneg_right hcoeff hr0Inv_nonneg -+ have hqpow_nonneg : 0 ≤ ((2 : ℝ) ^ (-τ)) ^ k := -+ pow_nonneg (le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _)) _ -+ have := mul_le_mul_of_nonneg_right hmul hqpow_nonneg -+ simpa [mul_assoc, mul_left_comm, mul_comm] using this -+ -+lemma dyadic_growth_mass_mul_inv_le_geometric {C L M X T Ctrail r0 ρ τ : ℝ} {k : ℕ} -+ (hL : 0 < L) (hC : 0 ≤ C) (hr0 : 0 ≤ r0) -+ (hX : X ≤ M * ((2 : ℝ) ^ ρ) ^ k) -+ (hT : T ≤ ((C * X + Ctrail) / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) : -+ T ≤ (((C / L) * M) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (ρ - τ)) ^ k -+ + (((Ctrail / L) + 1) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (-τ)) ^ k := by -+ have hmul : C * X ≤ C * (M * ((2 : ℝ) ^ ρ) ^ k) := -+ mul_le_mul_of_nonneg_left hX hC -+ have hnum : C * X + Ctrail ≤ C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail := -+ add_le_add hmul le_rfl -+ have hdiv : -+ (C * X + Ctrail) / L ≤ (C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L := -+ div_le_div_of_nonneg_right hnum hL.le -+ have h2k_nonneg : 0 ≤ (2 : ℝ) ^ (k : ℝ) := -+ le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) (k : ℝ)) -+ have hrk_nonneg : 0 ≤ r0 * (2 : ℝ) ^ (k : ℝ) := -+ mul_nonneg hr0 h2k_nonneg -+ have hfactor_nonneg : 0 ≤ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) := -+ Real.rpow_nonneg (inv_nonneg.2 hrk_nonneg) τ -+ have hmul' := -+ mul_le_mul_of_nonneg_right hdiv hfactor_nonneg -+ have hdecomp : -+ ((C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L) * -+ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ = -+ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * -+ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ + ((Ctrail / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) := by -+ let Y : ℝ := (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ -+ have : -+ ((C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L) * Y -+ = ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * Y -+ + ((Ctrail / L) * Y) := by -+ ring -+ simpa [Y] -+ have hpre : -+ T ≤ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * -+ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) -+ + ((Ctrail / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) := -+ hT.trans (hmul'.trans_eq hdecomp) -+ have hA := le_of_eq (dyadic_growth_inv_term_eq C L M r0 ρ τ k hr0) -+ have hB := dyadic_trailing_inv_term_le Ctrail L r0 τ k hr0 -+ exact hpre.trans (by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using add_le_add hA hB) -+ -+lemma two_geometric_shift_add (A B q qσ : ℝ) (k k0 : ℕ) : -+ A * q ^ (k + k0) + B * qσ ^ (k + k0) -+ = (A * q ^ k0) * q ^ k + (B * qσ ^ k0) * qσ ^ k := by -+ rw [pow_add, pow_add] -+ ac_rfl -+ -+end Real -+end -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/DivisorBasics.lean b/PrimeNumberTheoremAnd/SiegelZeros/DivisorBasics.lean -new file mode 100644 -index 0000000..e5a553a ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/DivisorBasics.lean -@@ -0,0 +1,590 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.Products -+ -+namespace SiegelZeros -+ -+section -+open Filter Topology Set -+ -+namespace MeromorphicOn -+ -+variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {U K : Set 𝕜} {z : 𝕜} -+ {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] -+ -+lemma divisor_support_inter_compact_finite (f : 𝕜 → E) {U K : Set 𝕜} -+ (hK : IsCompact K) (hKU : K ⊆ U) : -+ (K ∩ (MeromorphicOn.divisor f U).support).Finite := by -+ classical -+ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U -+ have hloc : -+ ∀ x ∈ K, ∃ V : Set 𝕜, V ∈ 𝓝 x ∧ Set.Finite (V ∩ D.support) := by -+ intro x hxK -+ rcases D.supportLocallyFiniteWithinDomain x (hKU hxK) with ⟨V, hV, hfin⟩ -+ exact ⟨V, hV, hfin⟩ -+ choose V hVnhds hVfin using hloc -+ rcases hK.elim_nhds_subcover' (U := fun x hx => V x hx) (hU := fun x hx => hVnhds x hx) with -+ ⟨t, ht⟩ -+ have hsub : -+ K ∩ D.support ⊆ ⋃ x ∈ t, (V (x : 𝕜) x.2 ∩ D.support) := by -+ intro y hy -+ rcases hy with ⟨hyK, hyS⟩ -+ have hycov : y ∈ ⋃ x ∈ t, V (x : 𝕜) x.2 := ht hyK -+ rcases Set.mem_iUnion.1 hycov with ⟨x, hycov'⟩ -+ rcases Set.mem_iUnion.1 hycov' with ⟨hxT, hyV⟩ -+ refine Set.mem_iUnion.2 ⟨x, Set.mem_iUnion.2 ?_⟩ -+ exact ⟨hxT, ⟨hyV, hyS⟩⟩ -+ have hfinU : Set.Finite (⋃ x ∈ t, (V (x : 𝕜) x.2 ∩ D.support)) := by -+ classical -+ refine (t.finite_toSet).biUnion ?_ -+ intro x hx -+ simpa using (hVfin (x : 𝕜) x.2) -+ exact hfinU.subset hsub -+ -+end MeromorphicOn -+end -+section -+open Set -+ -+namespace Complex.Hadamard -+ -+def divisorZeroIndex (f : ℂ → ℂ) (U : Set ℂ) : Type := -+ Σ z : ℂ, Fin (Int.toNat (MeromorphicOn.divisor f U z)) -+ -+abbrev divisorZeroIndex₀ (f : ℂ → ℂ) (U : Set ℂ) : Type := -+ {p : divisorZeroIndex f U // p.1 ≠ 0} -+ -+abbrev divisorZeroIndex₀Val {f : ℂ → ℂ} {U : Set ℂ} (p : divisorZeroIndex₀ f U) : ℂ := -+ p.1.1 -+ -+@[simp] -+lemma divisorZeroIndex₀Val_ne_zero {f : ℂ → ℂ} {U : Set ℂ} (p : divisorZeroIndex₀ f U) : -+ divisorZeroIndex₀Val p ≠ 0 := p.2 -+ -+@[simp] -+lemma divisorZeroIndex₀Val_mem_divisor_support {f : ℂ → ℂ} {U : Set ℂ} -+ (p : divisorZeroIndex₀ f U) : -+ MeromorphicOn.divisor f U (divisorZeroIndex₀Val p) ≠ 0 := by -+ have hn : -+ Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p)) ≠ 0 := by -+ intro h0 -+ have q0 : Fin 0 := by -+ simpa [divisorZeroIndex₀Val, h0] using p.1.2 -+ exact Fin.elim0 q0 -+ intro hdiv -+ have : Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p)) = 0 := by -+ simp [hdiv] -+ exact hn this -+ -+noncomputable def divisorCanonicalProduct (m : ℕ) (f : ℂ → ℂ) (U : Set ℂ) (z : ℂ) : ℂ := -+ ∏' p : divisorZeroIndex₀ f U, weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ -+@[simp] -+lemma divisorCanonicalProduct_zero (m : ℕ) (f : ℂ → ℂ) (U : Set ℂ) : -+ divisorCanonicalProduct m f U 0 = 1 := by -+ simp [divisorCanonicalProduct] -+ -+end Complex.Hadamard -+end -+section -+namespace Complex -+ -+section UniformMul -+ -+theorem _root_.SiegelZeros.TendstoUniformlyOn.mul_left_bounded {ι : Type*} {p : Filter ι} {K : Set ℂ} -+ {F : ι → ℂ → ℂ} {f : ℂ → ℂ} {h : ℂ → ℂ} -+ (hF : TendstoUniformlyOn F f p K) (hh : ∃ C, ∀ z ∈ K, ‖h z‖ ≤ C) : -+ TendstoUniformlyOn (fun n z => h z * F n z) (fun z => h z * f z) p K := by -+ intro u hu -+ rcases Metric.mem_uniformity_dist.1 hu with ⟨ε, hεpos, hεu⟩ -+ rcases hh with ⟨C, hC⟩ -+ set C' : ℝ := max C 1 -+ have hC'pos : 0 < C' := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ have hC' : ∀ z ∈ K, ‖h z‖ ≤ C' := fun z hz => le_trans (hC z hz) (le_max_left _ _) -+ have hv : {p : ℂ × ℂ | dist p.1 p.2 < ε / C'} ∈ uniformity ℂ := -+ Metric.mem_uniformity_dist.2 ⟨ε / C', div_pos hεpos hC'pos, fun _ _ hab => hab⟩ -+ have hF' : ∀ᶠ n in p, ∀ z : ℂ, z ∈ K → dist (f z) (F n z) < ε / C' := hF _ hv -+ filter_upwards [hF'] with n hn z hzK -+ have hn' : ‖f z - F n z‖ < ε / C' := by simpa [dist_eq_norm] using hn z hzK -+ have hle : ‖h z‖ * ‖f z - F n z‖ ≤ C' * ‖f z - F n z‖ := -+ mul_le_mul_of_nonneg_right (hC' z hzK) (norm_nonneg _) -+ have hlt : C' * ‖f z - F n z‖ < C' * (ε / C') := mul_lt_mul_of_pos_left hn' hC'pos -+ have hnorm : -+ ‖h z * f z - h z * F n z‖ = ‖h z‖ * ‖f z - F n z‖ := by -+ calc -+ ‖h z * f z - h z * F n z‖ = ‖h z * (f z - F n z)‖ := by simp [mul_sub] -+ _ = ‖h z‖ * ‖f z - F n z‖ := by simp -+ have hdist : dist (h z * f z) (h z * F n z) < ε := by -+ rw [dist_eq_norm, hnorm] -+ have hlt' : ‖h z‖ * ‖f z - F n z‖ < ε := by -+ calc -+ ‖h z‖ * ‖f z - F n z‖ ≤ C' * ‖f z - F n z‖ := hle -+ _ < C' * (ε / C') := hlt -+ _ = ε := by field_simp [hC'pos.ne'] -+ exact hlt' -+ exact hεu hdist -+ -+end UniformMul -+ -+end Complex -+end -+section -+open Filter Function _root_.SiegelZeros.Complex _root_.Function.Complex Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+lemma finite_divisorZeroIndex₀_subtype_norm_le {f : ℂ → ℂ} {U : Set ℂ} (B : ℝ) -+ (hBU : Metric.closedBall (0 : ℂ) B ⊆ U) : -+ Finite {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ B} := by -+ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U -+ have hK : IsCompact (Metric.closedBall (0 : ℂ) B) := isCompact_closedBall _ _ -+ have hpts0 : ((Metric.closedBall (0 : ℂ) B) ∩ D.support).Finite := -+ MeromorphicOn.divisor_support_inter_compact_finite (f := f) (U := U) -+ (K := Metric.closedBall (0 : ℂ) B) hK hBU -+ set pts : Set ℂ := ((Metric.closedBall (0 : ℂ) B) ∩ D.support) \ {0} -+ have hpts : pts.Finite := hpts0.sdiff -+ let : Fintype pts := hpts.fintype -+ let T : Type := Σ z : pts, Fin (Int.toNat (D z.1)) -+ have : Finite T := by infer_instance -+ let F : -+ {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ B} → T := fun p => -+ ⟨⟨divisorZeroIndex₀Val p.1, by -+ have hball : divisorZeroIndex₀Val p.1 ∈ Metric.closedBall (0 : ℂ) B := by -+ simpa [Metric.mem_closedBall, dist_zero_right] using p.2 -+ have hsupport : divisorZeroIndex₀Val p.1 ∈ D.support := by -+ have hne_toNat : -+ Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p.1)) ≠ 0 := by -+ intro h0 -+ have hpfin : -+ Fin (Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p.1))) := by -+ simpa [D] using p.1.1.2 -+ have : Fin 0 := by simpa [h0] using hpfin -+ exact Fin.elim0 this -+ have hne_D : D (divisorZeroIndex₀Val p.1) ≠ 0 := by -+ intro hD0 -+ apply hne_toNat -+ simp [D, hD0] -+ simp [D, Function.locallyFinsuppWithin.support, Function.support] -+ have hne0 : divisorZeroIndex₀Val p.1 ≠ 0 := divisorZeroIndex₀Val_ne_zero p.1 -+ exact ⟨⟨hball, hsupport⟩, by simp [Set.mem_singleton_iff]⟩⟩, -+ p.1.1.2⟩ -+ refine Finite.of_injective F ?_ -+ intro p q hpq -+ apply Subtype.ext -+ apply Subtype.ext -+ have h' := (Sigma.mk.inj_iff.1 hpq) -+ have hz : divisorZeroIndex₀Val p.1 = divisorZeroIndex₀Val q.1 := congrArg Subtype.val h'.1 -+ apply (Sigma.mk.inj_iff).2 -+ refine ⟨hz, ?_⟩ -+ exact h'.2 -+ -+lemma divisorZeroIndex₀_norm_le_finite {f : ℂ → ℂ} {U : Set ℂ} (B : ℝ) -+ (hBU : Metric.closedBall (0 : ℂ) B ⊆ U) : -+ ({p : divisorZeroIndex₀ f U | ‖divisorZeroIndex₀Val p‖ ≤ B} : Set _).Finite := by -+ let s : Set (divisorZeroIndex₀ f U) := {p | ‖divisorZeroIndex₀Val p‖ ≤ B} -+ have : Finite (↥s) := -+ finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := U) B hBU -+ exact Set.toFinite s -+ -+lemma norm_div_le_half_of_norm_le_of_two_mul_lt {z a : ℂ} {R : ℝ} -+ (hR : 0 < R) (hz : ‖z‖ ≤ R) (ha : (2 * R : ℝ) < ‖a‖) : -+ ‖z / a‖ ≤ (1 / 2 : ℝ) := by -+ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hR] -+ have hinv : ‖a‖⁻¹ < (2 * R)⁻¹ := by -+ simpa [one_div] using one_div_lt_one_div_of_lt h2R_pos ha -+ have hmul_le : ‖z‖ * ‖a‖⁻¹ ≤ R * ‖a‖⁻¹ := -+ mul_le_mul_of_nonneg_right hz (inv_nonneg.2 (norm_nonneg a)) -+ have hmul_lt : R * ‖a‖⁻¹ < R * (2 * R)⁻¹ := -+ mul_lt_mul_of_pos_left hinv hR -+ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by -+ have hRne : (R : ℝ) ≠ 0 := hR.ne' -+ rw [show R * (2 * R)⁻¹ = R / (2 * R) by simp [div_eq_mul_inv]] -+ field_simp [hRne] -+ have hnorm : ‖z / a‖ = ‖z‖ * ‖a‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ exact le_of_lt <| by -+ calc -+ ‖z / a‖ = ‖z‖ * ‖a‖⁻¹ := hnorm -+ _ ≤ R * ‖a‖⁻¹ := hmul_le -+ _ < R * (2 * R)⁻¹ := hmul_lt -+ _ = (1 / 2 : ℝ) := hRhalf -+ -+theorem summable_logDerivTerms_divisorZeroIndex₀_of_summable_inv_sq -+ {f : ℂ → ℂ} {z : ℂ} -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) -+ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ 1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by -+ let R : ℝ := max ‖z‖ 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ have hzle : ‖z‖ ≤ R := le_max_left _ _ -+ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (2 * R) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ)) -+ have hu : Summable u := h_sum.mul_left (2 * R) -+ refine hu.of_norm_bounded_eventually ?_ -+ have h_big : -+ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, -+ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ -+ 2 * R} : Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ exact divisorZeroIndex₀_norm_le_finite -+ (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this -+ have := hfin.eventually_cofinite_notMem -+ filter_upwards [this] with p hp -+ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp -+ exact lt_of_not_ge this -+ filter_upwards [h_big] with p hp -+ let a : ℂ := divisorZeroIndex₀Val p -+ have ha0 : a ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ have hza0 : z - a ≠ 0 := sub_ne_zero.mpr (hz p) -+ have hterm : 1 / (z - a) + 1 / a = z / (a * (z - a)) := by -+ field_simp [ha0, hza0] -+ ring -+ have htri : ‖a‖ ≤ ‖z‖ + ‖z - a‖ := by -+ have hraw : ‖a‖ ≤ ‖z‖ + ‖a - z‖ := by -+ have h := norm_add_le z (a - z) -+ simpa [a, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h -+ simpa [norm_sub_rev] using hraw -+ have hza_lower : ‖a‖ / 2 ≤ ‖z - a‖ := by -+ nlinarith [htri, hzle, hp] -+ have hnorm : ‖1 / (z - a) + 1 / a‖ ≤ (2 * R) * (‖a‖⁻¹ ^ (2 : ℕ)) := by -+ rw [hterm, norm_div, norm_mul] -+ have ha_norm_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha0 -+ have hza_norm_pos : 0 < ‖z - a‖ := norm_pos_iff.mpr hza0 -+ rw [div_eq_mul_inv] -+ calc -+ ‖z‖ * (‖a‖ * ‖z - a‖)⁻¹ -+ = ‖z‖ * ‖a‖⁻¹ * ‖z - a‖⁻¹ := by -+ field_simp [ha_norm_pos.ne', hza_norm_pos.ne'] -+ _ ≤ R * ‖a‖⁻¹ * ‖z - a‖⁻¹ := by -+ gcongr -+ _ ≤ R * ‖a‖⁻¹ * (2 * ‖a‖⁻¹) := by -+ gcongr -+ have hhalf_pos : 0 < ‖a‖ / 2 := by positivity -+ have hinv : ‖z - a‖⁻¹ ≤ (‖a‖ / 2)⁻¹ := by -+ simpa [one_div] using one_div_le_one_div_of_le hhalf_pos hza_lower -+ have hhalf_inv : (‖a‖ / 2)⁻¹ = 2 * ‖a‖⁻¹ := by field_simp [ha_norm_pos.ne'] -+ simpa [hhalf_inv] using hinv -+ _ = (2 * R) * (‖a‖⁻¹ ^ (2 : ℕ)) := by ring -+ simpa [u, a] using hnorm -+ -+theorem hasProdUniformlyOn_divisorCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) {K : Set ℂ} (hK : IsCompact K) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ HasProdUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) K := by -+ rcases (isBounded_iff_forall_norm_le.1 hK.isBounded) with ⟨R0, hR0⟩ -+ set R : ℝ := max R0 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ have hnormK : ∀ z ∈ K, ‖z‖ ≤ R := fun z hzK => le_trans (hR0 z hzK) (le_max_left _ _) -+ let g : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1 -+ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) -+ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) -+ have h_big : -+ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, -+ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 2 * R} : -+ Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this -+ have := hfin.eventually_cofinite_notMem -+ filter_upwards [this] with p hp -+ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp -+ exact lt_of_not_ge this -+ have hBound : -+ ∀ᶠ p in Filter.cofinite, ∀ z ∈ K, ‖g p z‖ ≤ u p := by -+ filter_upwards [h_big] with p hp z hzK -+ have hzle : ‖z‖ ≤ R := hnormK z hzK -+ have hz_div : ‖z / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by -+ exact norm_div_le_half_of_norm_le_of_two_mul_lt hRpos hzle hp -+ have hE : -+ ‖weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1‖ ≤ -+ 4 * ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) := -+ weierstrassFactor_sub_one_pow_bound (m := m) (z := z / divisorZeroIndex₀Val p) hz_div -+ have hz_pow : -+ ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ -+ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ have : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ rw [this] -+ have : (‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = -+ ‖z‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ simp [mul_pow] -+ rw [this] -+ have hzle_pow : ‖z‖ ^ (m + 1) ≤ R ^ (m + 1) := -+ pow_le_pow_left₀ (norm_nonneg z) hzle (m + 1) -+ gcongr -+ dsimp [g, u] -+ nlinarith [hE, hz_pow] -+ have hcts : ∀ p, ContinuousOn (g p) K := by -+ intro p -+ have hcontE : Continuous (fun z : ℂ => weierstrassFactor m z) := -+ (differentiable_weierstrassFactor m).continuous -+ have hdiv : Continuous fun z : ℂ => z / divisorZeroIndex₀Val p := by -+ simpa [div_eq_mul_inv] using! (continuous_id.mul continuous_const) -+ have hcont : Continuous fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) := -+ hcontE.comp hdiv -+ simpa only [g] using hcont.continuousOn.fun_sub continuous_const.continuousOn -+ have hprod : -+ HasProdUniformlyOn (fun p z ↦ 1 + g p z) (fun z ↦ ∏' p, (1 + g p z)) K := by -+ simpa using -+ Summable.hasProdUniformlyOn_one_add (f := g) (u := u) (K := K) hK hu hBound hcts -+ simpa [g, divisorCanonicalProduct, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] -+ using! hprod -+ -+theorem hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ (Set.univ : Set ℂ) := by -+ refine hasProdLocallyUniformlyOn_of_forall_compact -+ (f := fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (g := divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ (s := (Set.univ : Set ℂ)) isOpen_univ ?_ -+ intro K hKU hK -+ simpa using -+ (hasProdUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) (K := K) hK h_sum) -+ -+theorem differentiableOn_divisorCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ DifferentiableOn ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) (Set.univ : Set ℂ) := by -+ have hloc : -+ TendstoLocallyUniformlyOn -+ (fun (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) => -+ ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ Filter.atTop (Set.univ : Set ℂ) := by -+ simpa [HasProdLocallyUniformlyOn] using -+ (hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum) -+ have hF : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in Filter.atTop, -+ DifferentiableOn ℂ -+ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (Set.univ : Set ℂ) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro s -+ have hdiff : -+ Differentiable ℂ -+ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) := by -+ let F : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ have hF' : ∀ p ∈ s, Differentiable ℂ (F p) := by -+ intro p hp -+ have hdiv : Differentiable ℂ (fun z : ℂ => z / divisorZeroIndex₀Val p) := by -+ have : Differentiable ℂ (fun z : ℂ => z * ((divisorZeroIndex₀Val p)⁻¹)) := -+ (differentiable_id : Differentiable ℂ (fun z : ℂ => z)).mul_const -+ ((divisorZeroIndex₀Val p)⁻¹) -+ simp [div_eq_mul_inv] -+ exact (differentiable_weierstrassFactor m).comp hdiv -+ simpa [F] using (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := F) (u := s) hF') -+ simpa using hdiff.differentiableOn -+ have : (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))).NeBot := -+ Filter.atTop_neBot -+ exact hloc.differentiableOn hF isOpen_univ -+ -+theorem differentiableAt_divisorCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : -+ DifferentiableAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := -+ ((differentiableOn_divisorCanonicalProduct_univ m f h_sum) z (by simp)).differentiableAt -+ (by simp) -+ -+theorem logDeriv_divisorCanonicalProduct_one_eq_tsum -+ {f : ℂ → ℂ} {z : ℂ} -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) -+ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) -+ (hprod_ne : divisorCanonicalProduct 1 f (Set.univ : Set ℂ) z ≠ 0) : -+ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z = -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by -+ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p w => weierstrassFactor 1 (w / divisorZeroIndex₀Val p) -+ have hf : ∀ p, Φ p z ≠ 0 := by -+ intro p -+ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ refine weierstrassFactor_ne_zero_of_ne_one 1 ?_ -+ intro h -+ exact hz p ((div_eq_one_iff_eq hp0).1 h) -+ have hd : ∀ p, DifferentiableOn ℂ (Φ p) (Set.univ : Set ℂ) := by -+ intro p -+ have hdiv : Differentiable ℂ (fun w : ℂ => w / divisorZeroIndex₀Val p) := by -+ have : Differentiable ℂ (fun w : ℂ => w * ((divisorZeroIndex₀Val p)⁻¹)) := -+ (differentiable_id : Differentiable ℂ (fun w : ℂ => w)).mul_const -+ ((divisorZeroIndex₀Val p)⁻¹) -+ simp [div_eq_mul_inv] -+ exact ((differentiable_weierstrassFactor 1).comp hdiv).differentiableOn -+ have hm' : Summable fun p => logDeriv (Φ p) z := by -+ have hm : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ 1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := -+ summable_logDerivTerms_divisorZeroIndex₀_of_summable_inv_sq h_sum hz -+ refine hm.congr ?_ -+ intro p -+ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ simpa [Φ] using -+ (Complex.logDeriv_weierstrassFactor_one_div -+ (a := divisorZeroIndex₀Val p) (z := z) hp0 (hz p)).symm -+ have htend : MultipliableLocallyUniformlyOn Φ (Set.univ : Set ℂ) := by -+ have hprod := hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ -+ (m := 1) (f := f) h_sum -+ simpa [Φ, divisorCanonicalProduct] using hprod.multipliableLocallyUniformlyOn -+ have hnez : (∏' p, Φ p z) ≠ 0 := by -+ simpa [Φ, divisorCanonicalProduct] using hprod_ne -+ have hlog : logDeriv (∏' p, Φ p ·) z = ∑' p, logDeriv (Φ p) z := -+ logDeriv_tprod_eq_tsum (s := (Set.univ : Set ℂ)) isOpen_univ (by simp) -+ hf hd hm' htend hnez -+ calc -+ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z -+ = ∑' p, logDeriv (Φ p) z := by -+ simpa [Φ, divisorCanonicalProduct] using! hlog -+ _ = ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by -+ refine tsum_congr fun p => ?_ -+ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ simpa [Φ] using -+ Complex.logDeriv_weierstrassFactor_one_div -+ (a := divisorZeroIndex₀Val p) (z := z) hp0 (hz p) -+ -+end Complex.Hadamard -+end -+section -+noncomputable section -+ -+open Set -+open scoped Topology BigOperators -+ -+namespace Complex.Hadamard -+ -+lemma divisor_univ_eq_analyticOrderNatAt_int {f : ℂ → ℂ} (hf : Differentiable ℂ f) (z : ℂ) : -+ MeromorphicOn.divisor f (Set.univ : Set ℂ) z = (analyticOrderNatAt f z : ℤ) := by -+ have hmero : MeromorphicOn f (Set.univ : Set ℂ) := by -+ intro w hw -+ exact (Differentiable.analyticAt (f := f) hf w).meromorphicAt -+ simp only -+ [MeromorphicOn.divisor_apply hmero (by simp : z ∈ (Set.univ : Set ℂ)), analyticOrderNatAt] -+ have han : AnalyticAt ℂ f z := Differentiable.analyticAt (f := f) hf z -+ cases h : analyticOrderAt f z with -+ | top => -+ simp [han.meromorphicOrderAt_eq, h] -+ | coe n => -+ simp [han.meromorphicOrderAt_eq, h] -+ -+theorem divisorZeroIndex₀_fiber_finite (f : ℂ → ℂ) (z₀ : ℂ) : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | divisorZeroIndex₀Val p = z₀} : -+ Set _).Finite := by -+ have hsub : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | divisorZeroIndex₀Val p = z₀} : Set _) -+ ⊆ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ‖z₀‖} : -+ Set _) := by -+ intro p hp -+ have : divisorZeroIndex₀Val p = z₀ := hp -+ simp [this] -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ‖z₀‖} : -+ Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) ‖z₀‖ ⊆ (Set.univ : Set ℂ) := by simp -+ simpa using (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) -+ (B := ‖z₀‖) this) -+ exact hfin.subset hsub -+ -+def divisorZeroIndex₀FiberFinset (f : ℂ → ℂ) (z₀ : ℂ) : -+ Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ (divisorZeroIndex₀_fiber_finite (f := f) z₀).toFinset -+ -+@[simp] -+lemma mem_divisorZeroIndex₀FiberFinset (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : -+ p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ↔ divisorZeroIndex₀Val p = z₀ := by -+ simp [divisorZeroIndex₀FiberFinset] -+ -+theorem eventually_atTop_subset_fiberFinset -+ (f : ℂ → ℂ) (z₀ : ℂ) : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), -+ divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s := by -+ refine (Filter.eventually_atTop.2 ?_) -+ refine ⟨divisorZeroIndex₀FiberFinset (f := f) z₀, ?_⟩ -+ intro s hs -+ exact hs -+ -+lemma divisorZeroIndex₀FiberFinset_card_eq_toNat_divisor (f : ℂ → ℂ) {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = -+ Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) := by -+ let S : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := {p | divisorZeroIndex₀Val p = z₀} -+ have hS : S.Finite := divisorZeroIndex₀_fiber_finite (f := f) z₀ -+ set n : ℕ := Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) -+ have hcard : Nat.card S = n := by -+ classical -+ have : Fintype S := hS.fintype -+ -+ let e : S ≃ Fin n := -+ { toFun := by -+ intro x -+ rcases x with ⟨p, hp⟩ -+ rcases p with ⟨⟨z, q⟩, hz⟩ -+ have hzEq : z = z₀ := by simpa [divisorZeroIndex₀Val] using! hp -+ subst hzEq -+ simpa [n] using q -+ invFun := by -+ intro q -+ refine ⟨⟨⟨z₀, ?_⟩, hz₀⟩, ?_⟩ -+ · simpa [n] using q -+ · simp [S, divisorZeroIndex₀Val] -+ left_inv := by -+ rintro ⟨p, hp⟩ -+ rcases p with ⟨⟨z, q⟩, hz⟩ -+ have hzEq : z = z₀ := by simpa [divisorZeroIndex₀Val] using! hp -+ subst hzEq -+ (ext; rfl) -+ right_inv := by -+ intro q -+ rfl } -+ have h := Nat.card_congr (α := S) (β := Fin n) e -+ simpa using (h.trans (by simp)) -+ have hSncard : S.ncard = n := by -+ simpa [Nat.card_coe_set_eq] using hcard -+ have hto : hS.toFinset = divisorZeroIndex₀FiberFinset (f := f) z₀ := by -+ rfl -+ have htoFinset : S.ncard = (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by -+ have h' : S.ncard = hS.toFinset.card := Set.ncard_eq_toFinset_card S hS -+ simpa [hto] using h' -+ exact htoFinset.symm.trans hSncard -+ -+lemma divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt -+ {f : ℂ → ℂ} (hf : Differentiable ℂ f) {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = analyticOrderNatAt f z₀ := by -+ have hdiv : -+ MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀ = (analyticOrderNatAt f z₀ : ℤ) := -+ divisor_univ_eq_analyticOrderNatAt_int (f := f) hf z₀ -+ have htoNat : Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) = -+ analyticOrderNatAt f z₀ := by -+ simp [hdiv] -+ exact (divisorZeroIndex₀FiberFinset_card_eq_toNat_divisor (f := f) (z₀ := z₀) hz₀).trans htoNat -+ -+lemma not_mem_divisorZeroIndex₀FiberFinset_iff_val_ne -+ {f : ℂ → ℂ} (z₀ : ℂ) (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : -+ p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀ ↔ divisorZeroIndex₀Val p ≠ z₀ := by -+ simp [mem_divisorZeroIndex₀FiberFinset] -+ -+end Complex.Hadamard -+end -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/DivisorLimits.lean b/PrimeNumberTheoremAnd/SiegelZeros/DivisorLimits.lean -new file mode 100644 -index 0000000..4325f1f ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/DivisorLimits.lean -@@ -0,0 +1,422 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.DivisorProducts -+ -+namespace SiegelZeros -+ -+section -+open Filter Function _root_.SiegelZeros.Complex _root_.Function.Complex Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+theorem differentiableOn_divisorPartialProduct_div_pow_sub -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) (k : ℕ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : -+ DifferentiableOn ℂ (fun z : ℂ => (divisorPartialProduct m f s z) / (z - z₀) ^ k) -+ ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hdiff_prod : DifferentiableOn ℂ (divisorPartialProduct m f s) (Set.univ : Set ℂ) := by -+ exact (differentiable_divisorPartialProduct m f s).differentiableOn -+ have hdiff_den : DifferentiableOn ℂ (fun z : ℂ => (z - z₀) ^ k) ((Set.univ : Set ℂ) \ {z₀}) := by -+ have : Differentiable ℂ (fun z : ℂ => (z - z₀) ^ k) := by -+ fun_prop -+ exact this.differentiableOn -+ by_cases hk : k = 0 -+ · subst hk -+ simpa [pow_zero] using! (hdiff_prod.mono (by intro z hz; exact hz.1)) -+ · have hne : ∀ z ∈ ((Set.univ : Set ℂ) \ {z₀}), (fun z : ℂ => (z - z₀) ^ k) z ≠ 0 := by -+ intro z hz -+ have hz' : z ≠ z₀ := by -+ simpa [Set.mem_sdiff, Set.mem_singleton_iff] using hz.2 -+ exact pow_ne_zero _ (sub_ne_zero.mpr hz') -+ have hdiff_inv : -+ DifferentiableOn ℂ (fun z : ℂ => ((z - z₀) ^ k)⁻¹) ((Set.univ : Set ℂ) \ {z₀}) := -+ hdiff_den.inv hne -+ simpa [div_eq_mul_inv] using! (hdiff_prod.mono (by intro z hz; exact hz.1)).mul hdiff_inv -+ -+theorem differentiableOn_divisorCanonicalProduct_div_pow_sub -+ (m : ℕ) (f : ℂ → ℂ) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) (k : ℕ) : DifferentiableOn ℂ -+ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) -+ ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hopen : IsOpen ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hset : ((Set.univ : Set ℂ) \ {z₀}) = ({z₀} : Set ℂ)ᶜ := by -+ ext z; simp -+ simp [hset] -+ have hconv := -+ tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m := m) (f := f) h_sum (z₀ := z₀) (k := k) -+ refine hconv.differentiableOn ?_ hopen -+ refine Filter.Eventually.of_forall ?_ -+ intro s -+ exact differentiableOn_divisorPartialProduct_div_pow_sub (m := m) (f := f) (z₀ := z₀) (k := k) s -+ -+theorem differentiableOn_update_limUnder_divisorCanonicalProduct_div_pow -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : ∃ r > 0, DifferentiableOn ℂ (Function.update -+ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) z₀ -+ (limUnder (𝓝[≠] z₀) (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card))) -+ (Metric.ball z₀ r) := by -+ rcases bddAbove_norm_divisorCanonicalProduct_div_pow_puncturedBall (m := m) (f := f) -+ (h_sum := h_sum) (z₀ := z₀) with ⟨r, hrpos, hbdd⟩ -+ refine ⟨r, hrpos, ?_⟩ -+ have hnhds : Metric.ball z₀ r ∈ 𝓝 z₀ := Metric.ball_mem_nhds z₀ hrpos -+ have hdiff : DifferentiableOn ℂ (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ ((Metric.ball z₀ r) \ {z₀}) := by -+ have hglob := -+ differentiableOn_divisorCanonicalProduct_div_pow_sub -+ (m := m) (f := f) h_sum (z₀ := z₀) -+ (k := (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ refine hglob.mono ?_ -+ intro z hz -+ exact ⟨by simp, hz.2⟩ -+ have hb : BddAbove (norm ∘ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) '' -+ ((Metric.ball z₀ r) \ {z₀})) := hbdd -+ simpa using -+ (Complex.differentiableOn_update_limUnder_of_bddAbove (f := fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ (s := Metric.ball z₀ r) (c := z₀) hnhds hdiff hb) -+ -+theorem analyticAt_update_limUnder_divisorCanonicalProduct_div_pow -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : AnalyticAt ℂ (Function.update (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) z₀ -+ (limUnder (𝓝[≠] z₀) (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card))) -+ z₀ := by -+ rcases -+ differentiableOn_update_limUnder_divisorCanonicalProduct_div_pow -+ (m := m) (f := f) h_sum (z₀ := z₀) with ⟨r, hrpos, hdiff⟩ -+ let g : ℂ → ℂ := -+ Function.update -+ (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ z₀ -+ (limUnder (𝓝[≠] z₀) fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ have hcont : ContinuousAt g z₀ := -+ (hdiff.differentiableAt (Metric.ball_mem_nhds z₀ hrpos)).continuousAt -+ have hd : -+ ∀ᶠ z in 𝓝[≠] z₀, DifferentiableAt ℂ g z := by -+ have hballWithin : Metric.ball z₀ r ∈ 𝓝[≠] z₀ := by -+ refine mem_nhdsWithin_iff_exists_mem_nhds_inter.2 ?_ -+ refine ⟨Metric.ball z₀ r, Metric.ball_mem_nhds z₀ hrpos, ?_⟩ -+ intro z hz -+ exact hz.1 -+ filter_upwards [hballWithin] with z hz -+ exact (hdiff z hz).differentiableAt (Metric.isOpen_ball.mem_nhds hz) -+ simpa [g] using Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt hd hcont -+ -+theorem exists_analyticAt_divisorCanonicalProduct_quotient -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : -+ ∃ q : ℂ → ℂ, -+ AnalyticAt ℂ q z₀ ∧ -+ q z₀ = -+ limUnder (𝓝[≠] z₀) (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ∧ -+ ∀ z : ℂ, z ≠ z₀ → -+ q z = -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by -+ let q : ℂ → ℂ := -+ Function.update -+ (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ z₀ -+ (limUnder (𝓝[≠] z₀) fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) -+ refine ⟨q, ?_, ?_, ?_⟩ -+ · simpa [q] using -+ analyticAt_update_limUnder_divisorCanonicalProduct_div_pow -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) -+ · simp [q] -+ · intro z hz -+ simp [q, Function.update_of_ne hz] -+ -+theorem analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by -+ set k : ℕ := (divisorZeroIndex₀FiberFinset (f := f) z₀).card -+ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) -+ let q0 : ℂ → ℂ := fun z => F z / (z - z₀) ^ k -+ rcases exists_analyticAt_divisorCanonicalProduct_quotient -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) with -+ ⟨q, hqA, hq_self, hq_ne⟩ -+ have hdiff_univ : DifferentiableOn ℂ F (Set.univ : Set ℂ) := -+ differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ have han : AnalyticAt ℂ F z₀ := by -+ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ have : DifferentiableWithinAt ℂ F (Set.univ : Set ℂ) z := hdiff_univ z (by simp) -+ exact this.differentiableAt (by simp) -+ rcases -+ exists_ball_eq_divisorCanonicalProduct_div_pow_eq (m := m) (f := f) (h_sum := h_sum) -+ (z₀ := z₀) -+ with ⟨ε, hε, u, huA, hu0, hEq⟩ -+ let g : ℂ → ℂ := fun z => (divisorComplementCanonicalProduct m f z₀ z) * u z -+ have hcompDiff : DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) -+ (Set.univ : Set ℂ) := -+ differentiableOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) h_sum -+ have hcompCont : ContinuousAt (divisorComplementCanonicalProduct m f z₀) z₀ := -+ (hcompDiff z₀ (by simp)).differentiableAt (by simp) |>.continuousAt -+ have hgCont : ContinuousAt g z₀ := (hcompCont.mul huA.continuousAt) -+ have hg0 : g z₀ ≠ 0 := by -+ have hcomp0 : divisorComplementCanonicalProduct m f z₀ z₀ ≠ 0 := -+ divisorComplementCanonicalProduct_ne_zero_at (m := m) (f := f) (z₀ := z₀) h_sum -+ exact mul_ne_zero hcomp0 hu0 -+ have hne_mem : ∀ᶠ z in 𝓝[≠] z₀, z ∈ (({z₀} : Set ℂ)ᶜ) := -+ Filter.eventually_of_mem -+ (self_mem_nhdsWithin : (({z₀} : Set ℂ)ᶜ) ∈ 𝓝[≠] z₀) (fun _ hz => hz) -+ have hne : ∀ᶠ z in 𝓝[≠] z₀, z ≠ z₀ := by -+ filter_upwards [hne_mem] with z hz -+ simpa [Set.mem_compl_singleton_iff] using hz -+ have ht_q0 : Tendsto q0 (𝓝[≠] z₀) (𝓝 (g z₀)) := by -+ have hball : ∀ᶠ z in 𝓝[≠] z₀, z ∈ Metric.ball z₀ ε := -+ Filter.eventually_of_mem -+ (mem_nhdsWithin_of_mem_nhds (Metric.ball_mem_nhds z₀ hε)) (fun _ hz => hz) -+ have heq : q0 =ᶠ[𝓝[≠] z₀] g := by -+ filter_upwards [hball, hne] with z hz hzne -+ have hq := hEq z hz hzne -+ simpa [q0, F, k, g, smul_eq_mul] using hq -+ exact (hgCont.continuousWithinAt.tendsto.congr' heq.symm) -+ have hlim : limUnder (𝓝[≠] z₀) q0 = g z₀ := ht_q0.limUnder_eq -+ have hq0 : q z₀ ≠ 0 := by -+ have hq_self' : q z₀ = limUnder (𝓝[≠] z₀) q0 := by -+ simpa [q0, F, k] using hq_self -+ have : q z₀ = g z₀ := hq_self'.trans hlim -+ exact this.symm ▸ hg0 -+ have heq_punct : (fun z : ℂ => F z) =ᶠ[𝓝[≠] z₀] fun z : ℂ => (z - z₀) ^ k • q z := by -+ filter_upwards [hne] with z hz -+ have hzpow : (z - z₀) ^ k ≠ 0 := pow_ne_zero _ (sub_ne_zero.mpr hz) -+ have hq : q z = q0 z := by simpa [q0, F, k] using hq_ne z hz -+ have hmul : (z - z₀) ^ k * q0 z = F z := by -+ calc -+ (z - z₀) ^ k * q0 z -+ = (((z - z₀) ^ k) * F z) / ((z - z₀) ^ k) := by -+ simp [q0, div_eq_mul_inv, mul_assoc] -+ _ = F z := by -+ simpa [mul_assoc] using (mul_div_cancel_left₀ (F z) hzpow) -+ have : F z = (z - z₀) ^ k * q z := by -+ calc -+ F z = (z - z₀) ^ k * q0 z := hmul.symm -+ _ = (z - z₀) ^ k * q z := by simp [hq] -+ simpa [smul_eq_mul] using this -+ have hcontF : ContinuousAt F z₀ := -+ (hdiff_univ z₀ (by simp)).differentiableAt (by simp) |>.continuousAt -+ have hcontq : ContinuousAt q z₀ := hqA.continuousAt -+ have h_at_z0 : F z₀ = (z₀ - z₀) ^ k • q z₀ := by -+ have ht1 : Tendsto F (𝓝[≠] z₀) (𝓝 (F z₀)) := hcontF.continuousWithinAt.tendsto -+ have hpow : -+ Tendsto (fun z : ℂ => (z - z₀) ^ k) (𝓝[≠] z₀) (𝓝 ((z₀ - z₀) ^ k)) := -+ ((continuousAt_id.sub continuousAt_const).pow k).continuousWithinAt.tendsto -+ have ht2 : -+ Tendsto (fun z : ℂ => (z - z₀) ^ k • q z) (𝓝[≠] z₀) -+ (𝓝 ((z₀ - z₀) ^ k • q z₀)) := -+ hpow.mul (hcontq.continuousWithinAt.tendsto) -+ have ht2' : Tendsto F (𝓝[≠] z₀) (𝓝 ((z₀ - z₀) ^ k • q z₀)) := -+ ht2.congr' heq_punct.symm -+ exact tendsto_nhds_unique ht1 ht2' -+ have hfac : ∀ᶠ z in 𝓝 z₀, F z = (z - z₀) ^ k • q z := by -+ have hball1 : Metric.ball z₀ 1 ∈ 𝓝 z₀ := Metric.ball_mem_nhds z₀ (by norm_num) -+ have hball1' : ∀ᶠ z in 𝓝 z₀, z ∈ Metric.ball z₀ 1 := -+ Filter.eventually_of_mem hball1 (fun _ hz => hz) -+ filter_upwards [hball1'] with z _hz -+ by_cases hz0 : z = z₀ -+ · subst hz0 -+ simpa using h_at_z0 -+ · have hzpow : (z - z₀) ^ k ≠ 0 := pow_ne_zero _ (sub_ne_zero.mpr hz0) -+ have hq : q z = q0 z := by simpa [q0, F, k] using hq_ne z hz0 -+ have hmul : (z - z₀) ^ k * q0 z = F z := by -+ calc -+ (z - z₀) ^ k * q0 z -+ = (((z - z₀) ^ k) * F z) / ((z - z₀) ^ k) := by -+ simp [q0, div_eq_mul_inv, mul_assoc] -+ _ = F z := by -+ simpa [mul_assoc] using (mul_div_cancel_left₀ (F z) hzpow) -+ have : F z = (z - z₀) ^ k * q z := by -+ calc -+ F z = (z - z₀) ^ k * q0 z := hmul.symm -+ _ = (z - z₀) ^ k * q z := by simp [hq] -+ simpa [smul_eq_mul] using this -+ have hk' : analyticOrderAt F z₀ = k := -+ (han.analyticOrderAt_eq_natCast (n := k)).2 ⟨q, hqA, hq0, hfac⟩ -+ have hkNat : analyticOrderNatAt F z₀ = k := by -+ simp [analyticOrderNatAt, hk'] -+ simpa [F, k] using hkNat -+ -+theorem analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = -+ analyticOrderNatAt f z₀ := by -+ have hcp : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := -+ analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card (m := m) (f := f) (h_sum := h_sum) -+ (z₀ := z₀) -+ have hfib : -+ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = analyticOrderNatAt f z₀ := -+ divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt (hf := hf) (z₀ := z₀) hz₀ -+ simpa [hfib] using hcp -+ -+end Complex.Hadamard -+end -+section -+namespace Complex.Hadamard -+ -+open scoped Topology -+open Set -+ -+lemma analyticOrderAt_ne_top_of_exists_ne_zero {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (hnot : ∃ z : ℂ, f z ≠ 0) : -+ ∀ z : ℂ, analyticOrderAt f z ≠ ⊤ := by -+ rcases hnot with ⟨z1, hz1⟩ -+ have hf_an : AnalyticOnNhd ℂ f (Set.univ : Set ℂ) := by -+ intro z hz -+ exact (Differentiable.analyticAt (f := f) hf z) -+ have hz1_not_top : analyticOrderAt f z1 ≠ ⊤ := by -+ have : analyticOrderAt f z1 = 0 := -+ (hf.analyticAt z1).analyticOrderAt_eq_zero.2 hz1 -+ simp [this] -+ intro z -+ exact AnalyticOnNhd.analyticOrderAt_ne_top_of_isPreconnected (hf := hf_an) -+ (U := (Set.univ : Set ℂ)) (x := z1) (y := z) (by simpa using isPreconnected_univ) -+ (by simp) (by simp) hz1_not_top -+ -+lemma no_zero_on_sphere_of_forall_val_norm_ne -+ {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ {B r : ℝ} (hrpos : 0 < r) (hBr : r ≤ B) (hr_not : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖ ≤ B → r ≠ ‖divisorZeroIndex₀Val p‖) : -+ ∀ u : ℂ, ‖u‖ = r → f u ≠ 0 := by -+ intro u hur -+ have hu0 : u ≠ 0 := by -+ intro hu0 -+ subst hu0 -+ have : (0 : ℝ) = r := by simpa using hur -+ exact (ne_of_gt hrpos) this.symm -+ intro hfu0 -+ have hnotTop : analyticOrderAt f u ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) hf hnot u -+ have hord_ne0 : analyticOrderNatAt f u ≠ 0 := by -+ intro h0 -+ have hEN : (analyticOrderNatAt f u : ENat) = 0 := by simp [h0] -+ have hAt0 : analyticOrderAt f u = 0 := by -+ have hcast : (analyticOrderNatAt f u : ENat) = analyticOrderAt f u := -+ Nat.cast_analyticOrderNatAt (f := f) (z₀ := u) hnotTop -+ simpa [hcast] using hEN -+ have han : AnalyticAt ℂ f u := Differentiable.analyticAt (f := f) hf u -+ exact ((han.analyticOrderAt_eq_zero).1 hAt0) hfu0 -+ have hcard_pos : 0 < (divisorZeroIndex₀FiberFinset (f := f) u).card := by -+ have hcard := -+ divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt (hf := hf) (z₀ := u) hu0 -+ have : 0 < analyticOrderNatAt f u := Nat.pos_of_ne_zero hord_ne0 -+ simpa [hcard] using this -+ rcases Finset.card_pos.mp hcard_pos with ⟨p, hp⟩ -+ have hpval : divisorZeroIndex₀Val p = u := -+ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := u) p).1 hp -+ have hpB : ‖divisorZeroIndex₀Val p‖ ≤ B := by -+ have : ‖divisorZeroIndex₀Val p‖ = r := by simp [hpval, hur] -+ simpa [this] using hBr -+ have : r ≠ ‖divisorZeroIndex₀Val p‖ := hr_not p hpB -+ exact this (by simp [hpval, hur]) -+ -+theorem analyticOrderAt_divisorCanonicalProduct_eq_fiber_card -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = -+ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by -+ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) -+ have hNat : -+ analyticOrderNatAt F z₀ = (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by -+ simpa [F] using -+ (analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀)) -+ have hdiffOn : DifferentiableOn ℂ F (Set.univ : Set ℂ) := by -+ simpa [F] using differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ have hdiff : Differentiable ℂ F := by -+ intro z -+ exact (hdiffOn z (by simp)).differentiableAt (by simp) -+ have hnotTop : analyticOrderAt F z₀ ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hdiff) -+ ⟨0, by simp [F, divisorCanonicalProduct_zero]⟩ z₀ -+ have hcast : (analyticOrderNatAt F z₀ : ℕ∞) = analyticOrderAt F z₀ := -+ Nat.cast_analyticOrderNatAt (f := F) (z₀ := z₀) hnotTop -+ have hNatCast : -+ (analyticOrderNatAt F z₀ : ℕ∞) = -+ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by -+ simp [hNat] -+ simpa [F, hcast] using hNatCast -+ -+theorem divisorCanonicalProduct_ne_zero_of_forall_ne -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ {z : ℂ} (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) z ≠ 0 := by -+ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) -+ have hfiber_empty : divisorZeroIndex₀FiberFinset (f := f) z = ∅ := by -+ ext p -+ constructor -+ · intro hp -+ exact False.elim (hz p ((mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z) p).1 hp).symm) -+ · intro hp -+ simp at hp -+ have horder : -+ analyticOrderAt F z = (0 : ℕ∞) := by -+ have h := -+ analyticOrderAt_divisorCanonicalProduct_eq_fiber_card -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z) -+ simpa [F, hfiber_empty] using h -+ have han : AnalyticAt ℂ F z := by -+ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ -+ refine Filter.Eventually.of_forall ?_ -+ intro w -+ exact (((differentiableOn_divisorCanonicalProduct_univ m f h_sum) w -+ (by simp)).differentiableAt (by simp)) -+ exact (han.analyticOrderAt_eq_zero).1 horder -+ -+theorem logDeriv_divisorCanonicalProduct_one_eq_tsum_of_forall_ne -+ {f : ℂ → ℂ} {z : ℂ} -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) -+ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : -+ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z = -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := -+ logDeriv_divisorCanonicalProduct_one_eq_tsum h_sum hz -+ (divisorCanonicalProduct_ne_zero_of_forall_ne 1 f h_sum hz) -+ -+end Hadamard -+end Complex -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/DivisorProducts.lean b/PrimeNumberTheoremAnd/SiegelZeros/DivisorProducts.lean -new file mode 100644 -index 0000000..5ca9514 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/DivisorProducts.lean -@@ -0,0 +1,912 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.DivisorBasics -+ -+namespace SiegelZeros -+ -+section -+open Filter Function _root_.SiegelZeros.Complex _root_.Function.Complex Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+noncomputable def divisorComplementFactor -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) : ℂ := by -+ classical -+ exact if p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ then (1 : ℂ) -+ else weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ -+@[simp] -+theorem divisorComplementFactor_eq_one_of_mem -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) -+ (hp : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀) : -+ divisorComplementFactor m f z₀ p z = 1 := by -+ classical -+ simp [divisorComplementFactor, hp] -+ -+@[simp] -+theorem divisorComplementFactor_eq_weierstrassFactor_of_not_mem -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) -+ (hp : p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀) : -+ divisorComplementFactor m f z₀ p z = -+ weierstrassFactor m (z / divisorZeroIndex₀Val p) := by -+ classical -+ simp [divisorComplementFactor, hp] -+ -+lemma divisorComplementFactor_def -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) : -+ divisorComplementFactor m f z₀ p z = -+ if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) -+ else weierstrassFactor m (z / divisorZeroIndex₀Val p) := by -+ classical -+ by_cases h : divisorZeroIndex₀Val p = z₀ -+ · have hp : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ := by -+ simpa [mem_divisorZeroIndex₀FiberFinset] using h -+ simp [divisorComplementFactor_eq_one_of_mem, hp, h] -+ · have hp : p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀ := by -+ intro hmem -+ exact h ((mem_divisorZeroIndex₀FiberFinset f z₀ p).1 hmem) -+ simp [divisorComplementFactor_eq_weierstrassFactor_of_not_mem, hp, h] -+ -+noncomputable def divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ℂ := -+ ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ -+theorem differentiable_weierstrassFactor_divisorZeroIndex₀ (m : ℕ) {f : ℂ → ℂ} -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : -+ Differentiable ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) := by -+ have hdiv : Differentiable ℂ (fun z : ℂ => z / divisorZeroIndex₀Val p) := by -+ simp [div_eq_mul_inv] -+ exact (differentiable_weierstrassFactor m).comp hdiv -+ -+theorem differentiable_divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : -+ Differentiable ℂ (divisorPartialProduct m f s) := by -+ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ have hΦ : ∀ p ∈ s, Differentiable ℂ (Φ p) := by -+ intro p _hp -+ exact differentiable_weierstrassFactor_divisorZeroIndex₀ m p -+ simpa [divisorPartialProduct, Φ] using! -+ (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := Φ) (u := s) hΦ) -+ -+theorem analyticAt_divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z₀ : ℂ) : -+ AnalyticAt ℂ (divisorPartialProduct m f s) z₀ := -+ (differentiable_divisorPartialProduct m f s).analyticAt z₀ -+ -+noncomputable def divisorComplementPartialProduct -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ℂ := -+ ∏ p ∈ s, divisorComplementFactor m f z₀ p z -+ -+@[simp] -+lemma divisorComplementPartialProduct_def -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : -+ divisorComplementPartialProduct m f z₀ s z = -+ ∏ p ∈ s, if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) -+ else weierstrassFactor m (z / divisorZeroIndex₀Val p) := by -+ simp [divisorComplementPartialProduct, divisorComplementFactor, -+ mem_divisorZeroIndex₀FiberFinset] -+ -+theorem differentiable_divisorComplementPartialProduct -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : -+ Differentiable ℂ (divisorComplementPartialProduct m f z₀ s) := by -+ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := -+ fun p z => divisorComplementFactor m f z₀ p z -+ have hΦ : ∀ p ∈ s, Differentiable ℂ (Φ p) := by -+ intro p _hp -+ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ · have hΦp : Φ p = fun _ => (1 : ℂ) := by -+ ext z -+ simp only [Φ, divisorComplementFactor_eq_one_of_mem m f z₀ p z hpF] -+ rw [hΦp] -+ exact differentiable_const (1 : ℂ) -+ · have hΦp : Φ p = fun z => weierstrassFactor m (z / divisorZeroIndex₀Val p) := by -+ ext z -+ simp only [Φ, divisorComplementFactor_eq_weierstrassFactor_of_not_mem m f z₀ p z hpF] -+ rw [hΦp] -+ exact differentiable_weierstrassFactor_divisorZeroIndex₀ m p -+ have hEq : (fun z : ℂ => ∏ p ∈ s, Φ p z) = -+ divisorComplementPartialProduct m f z₀ s := by -+ ext z -+ simp [Φ, divisorComplementPartialProduct] -+ have : Differentiable ℂ (fun z : ℂ => ∏ p ∈ s, Φ p z) := by -+ simpa using (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := Φ) (u := s) hΦ) -+ simpa [hEq] using this -+ -+noncomputable def divisorComplementCanonicalProduct -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) (z : ℂ) : ℂ := -+ ∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), divisorComplementFactor m f z₀ p z -+ -+theorem hasProdUniformlyOn_divisorComplementCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) {K : Set ℂ} (hK : IsCompact K) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ HasProdUniformlyOn (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ divisorComplementFactor m f z₀ p z) (divisorComplementCanonicalProduct m f z₀) -+ K := by -+ rcases (isBounded_iff_forall_norm_le.1 hK.isBounded) with ⟨R0, hR0⟩ -+ set R : ℝ := max R0 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ have hnormK : ∀ z ∈ K, ‖z‖ ≤ R := fun z hzK => le_trans (hR0 z hzK) (le_max_left _ _) -+ let term : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := fun p z => -+ divisorComplementFactor m f z₀ p z -+ let g : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := fun p z => term p z - 1 -+ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) -+ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) -+ have h_big : -+ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, -+ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 2 * R} : -+ Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this -+ have := hfin.eventually_cofinite_notMem -+ filter_upwards [this] with p hp -+ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp -+ exact lt_of_not_ge this -+ have hBound : -+ ∀ᶠ p in Filter.cofinite, ∀ z ∈ K, ‖g p z‖ ≤ u p := by -+ filter_upwards [h_big] with p hp z hzK -+ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ · have hval : divisorZeroIndex₀Val p = z₀ := -+ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hpF -+ have hu0 : 0 ≤ u p := by -+ dsimp [u] -+ refine mul_nonneg ?_ ?_ -+ · nlinarith [pow_nonneg (show 0 ≤ R from le_of_lt hRpos) (m + 1)] -+ · exact pow_nonneg (inv_nonneg.2 (norm_nonneg _)) (m + 1) -+ simp [g, term, divisorComplementFactor, hval, hu0, sub_eq_add_neg] -+ · have hzle : ‖z‖ ≤ R := hnormK z hzK -+ have hz_div : ‖z / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by -+ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hRpos] -+ have hinv : ‖divisorZeroIndex₀Val p‖⁻¹ < (2 * R)⁻¹ := by -+ simpa [one_div] using (one_div_lt_one_div_of_lt h2R_pos hp) -+ have hmul_le : ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ ≤ R * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ refine mul_le_mul_of_nonneg_right hzle ?_ -+ exact inv_nonneg.2 (norm_nonneg _) -+ have hmul_lt : R * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := -+ mul_lt_mul_of_pos_left hinv hRpos -+ have hlt : ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := -+ lt_of_le_of_lt hmul_le hmul_lt -+ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by -+ have hRne : (R : ℝ) ≠ 0 := hRpos.ne' -+ have : R * (2 * R)⁻¹ = R / (2 * R) := by simp [div_eq_mul_inv] -+ rw [this] -+ field_simp [hRne] -+ have hnorm : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ have hzlt : ‖z / divisorZeroIndex₀Val p‖ < (1 / 2 : ℝ) := by -+ calc -+ ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := hnorm -+ _ < R * (2 * R)⁻¹ := hlt -+ _ = (1 / 2 : ℝ) := hRhalf -+ exact le_of_lt hzlt -+ have hE : ‖weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1‖ ≤ -+ 4 * ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) := -+ weierstrassFactor_sub_one_pow_bound (m := m) (z := z / divisorZeroIndex₀Val p) hz_div -+ have hz_pow : ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ -+ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ have : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ rw [this] -+ have : (‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = -+ ‖z‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ simp [mul_pow] -+ rw [this] -+ have hzle_pow : ‖z‖ ^ (m + 1) ≤ R ^ (m + 1) := -+ pow_le_pow_left₀ (norm_nonneg z) hzle (m + 1) -+ gcongr -+ dsimp [g, term, u] -+ simp [divisorComplementFactor, hpF] at * -+ nlinarith [hE, hz_pow] -+ have hcts : ∀ p, ContinuousOn (g p) K := by -+ intro p -+ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ · have hval : divisorZeroIndex₀Val p = z₀ := -+ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hpF -+ simpa [g, term, divisorComplementFactor, hval, sub_eq_add_neg, add_assoc, add_left_comm, -+ add_comm] using -+ (continuousOn_const : ContinuousOn (fun _ : ℂ => (0 : ℂ)) K) -+ · have hvalne : divisorZeroIndex₀Val p ≠ z₀ := -+ (not_mem_divisorZeroIndex₀FiberFinset_iff_val_ne (f := f) z₀ p).1 hpF -+ have hcontE : Continuous (fun z : ℂ => weierstrassFactor m z) := -+ (differentiable_weierstrassFactor m).continuous -+ have hdiv : Continuous fun z : ℂ => z / divisorZeroIndex₀Val p := by -+ simpa [div_eq_mul_inv] using! (continuous_id.mul continuous_const) -+ have hcont : Continuous fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) := -+ hcontE.comp hdiv -+ have : ContinuousOn (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1) K := -+ (hcont.continuousOn.sub continuous_const.continuousOn) -+ simpa [g, term, divisorComplementFactor, mem_divisorZeroIndex₀FiberFinset, hvalne] using this -+ have hprod : -+ HasProdUniformlyOn (fun p z ↦ 1 + g p z) (fun z ↦ ∏' p, (1 + g p z)) K := by -+ simpa using -+ Summable.hasProdUniformlyOn_one_add (f := g) (u := u) (K := K) hK hu hBound hcts -+ have hterm : -+ HasProdUniformlyOn (fun p z ↦ term p z) (fun z ↦ ∏' p, term p z) K := by -+ simpa [g, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using hprod -+ refine hterm.congr_right ?_ -+ intro z hz -+ simp [term, divisorComplementCanonicalProduct, divisorComplementFactor] -+ -+theorem hasProdLocallyUniformlyOn_divisorComplementCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ divisorComplementFactor m f z₀ p z) -+ (divisorComplementCanonicalProduct m f z₀) -+ (Set.univ : Set ℂ) := by -+ refine hasProdLocallyUniformlyOn_of_forall_compact -+ (f := fun p z => divisorComplementFactor m f z₀ p z) -+ (g := divisorComplementCanonicalProduct m f z₀) (s := (Set.univ : Set ℂ)) -+ isOpen_univ ?_ -+ intro K hKU hK -+ simpa using -+ (hasProdUniformlyOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) -+ (K := K) hK h_sum) -+ -+theorem tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ divisorComplementPartialProduct m f z₀ s) -+ (divisorComplementCanonicalProduct m f z₀) -+ Filter.atTop -+ (Set.univ : Set ℂ) := by -+ have hprod : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ divisorComplementFactor m f z₀ p z) -+ (divisorComplementCanonicalProduct m f z₀) -+ (Set.univ : Set ℂ) := -+ hasProdLocallyUniformlyOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) -+ (z₀ := z₀) h_sum -+ have h : -+ TendstoLocallyUniformlyOn -+ (fun (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) => -+ ∏ p ∈ s, -+ if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) -+ else weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorComplementCanonicalProduct m f z₀) -+ Filter.atTop -+ (Set.univ : Set ℂ) := by -+ simpa [HasProdLocallyUniformlyOn, divisorComplementFactor, mem_divisorZeroIndex₀FiberFinset] -+ using hprod -+ refine h.congr (G := fun s z => divisorComplementPartialProduct m f z₀ s z) ?_ -+ intro s z hz -+ simp [divisorComplementPartialProduct_def] -+ -+theorem differentiableOn_divisorComplementCanonicalProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) (Set.univ : Set ℂ) := by -+ have hloc : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ divisorComplementPartialProduct m f z₀ s) -+ (divisorComplementCanonicalProduct m f z₀) -+ Filter.atTop -+ (Set.univ : Set ℂ) := -+ tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ (m := m) (f := f) -+ (z₀ := z₀) h_sum -+ have hF : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in Filter.atTop, -+ DifferentiableOn ℂ (divisorComplementPartialProduct m f z₀ s) (Set.univ : Set ℂ) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro s -+ exact (differentiable_divisorComplementPartialProduct m f z₀ s).differentiableOn -+ have : (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))).NeBot := -+ Filter.atTop_neBot -+ exact hloc.differentiableOn hF isOpen_univ -+ -+lemma divisorPartialProduct_eq_fiber_mul_complement_of_subset -+ (m : ℕ) (f : ℂ → ℂ) (z₀ z : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : -+ divisorPartialProduct m f s z = -+ divisorPartialProduct m f (divisorZeroIndex₀FiberFinset (f := f) z₀) z * -+ divisorComplementPartialProduct m f z₀ s z := by -+ classical -+ let fiber : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ let P : divisorZeroIndex₀ f (Set.univ : Set ℂ) → Prop := fun p => p ∈ fiber -+ let term : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := -+ fun p => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ have hfilter : s.filter P = fiber := by -+ ext p -+ constructor -+ · intro hp -+ exact (Finset.mem_filter.mp hp).2 -+ · intro hp -+ exact Finset.mem_filter.mpr ⟨hs hp, hp⟩ -+ have hsplit : -+ (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) = ∏ p ∈ s, term p := by -+ simpa [term] using -+ (Finset.prod_filter_mul_prod_filter_not (s := s) (p := P) (f := term)) -+ have hP : (∏ p ∈ s with P p, term p) = divisorPartialProduct m f fiber z := by -+ have hg : ∀ x ∈ s \ fiber, (if x ∈ fiber then term x else (1 : ℂ)) = 1 := by -+ intro x hx -+ have hxnot : x ∉ fiber := (Finset.mem_sdiff.mp hx).2 -+ simp [hxnot] -+ have hfg : -+ ∀ x ∈ fiber, term x = (if x ∈ fiber then term x else (1 : ℂ)) := by -+ intro x hx -+ simp [hx] -+ have hsub := (Finset.prod_subset_one_on_sdiff (s₁ := fiber) (s₂ := s) -+ (f := term) (g := fun x => if x ∈ fiber then term x else (1 : ℂ)) hs hg hfg) -+ simpa [divisorPartialProduct, term, P, fiber, Finset.prod_filter] using hsub.symm -+ have hnotP : (∏ p ∈ s with ¬ P p, term p) = divisorComplementPartialProduct m f z₀ s z := by -+ simp [divisorComplementPartialProduct, divisorComplementFactor, term, P, fiber, -+ Finset.prod_filter, mem_divisorZeroIndex₀FiberFinset] -+ have hsplit' : ∏ p ∈ s, term p = (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) := -+ hsplit.symm -+ calc -+ divisorPartialProduct m f s z -+ = ∏ p ∈ s, term p := by simp [divisorPartialProduct, term] -+ _ = (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) := hsplit' -+ _ = divisorPartialProduct m f fiber z * divisorComplementPartialProduct m f z₀ s z := by -+ simp [hP, hnotP, fiber] -+ -+end Complex.Hadamard -+end -+section -+noncomputable section -+ -+open _root_.SiegelZeros.Complex Filter Function Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+theorem analyticOrderAt_finset_prod_weierstrassFactor_divisorZeroIndex₀ -+ (m : ℕ) (f : ℂ → ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z₀ : ℂ) : -+ analyticOrderAt (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ z₀ = ((s.filter (fun p => divisorZeroIndex₀Val p = z₀)).card : ℕ∞) := by -+ classical -+ refine Finset.induction_on s ?base ?step -+ · simp [analyticOrderAt_eq_zero] -+ · intro p s hp hs -+ by_cases hEq : divisorZeroIndex₀Val p = z₀ -+ · have hp0 : divisorZeroIndex₀Val p ≠ 0 := p.property -+ have han_fac : -+ AnalyticAt ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) z₀ := by -+ exact (differentiable_weierstrassFactor_divisorZeroIndex₀ m p).analyticAt z₀ -+ have han_rest : AnalyticAt ℂ (fun z : ℂ => ∏ q ∈ s, weierstrassFactor m -+ (z / divisorZeroIndex₀Val q)) z₀ := by -+ simpa [divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ -+ let fac : ℂ → ℂ := fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ let rest : ℂ → ℂ := fun z : ℂ => ∏ q ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val q) -+ have hmul : -+ analyticOrderAt (fac * rest) z₀ = -+ analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := by -+ simpa [fac, rest] using (analyticOrderAt_mul (z₀ := z₀) han_fac han_rest) -+ have hcard : -+ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) (insert p s)).card = -+ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) s).card + 1 := by -+ simp [hEq, hp, Finset.filter_insert] -+ have hfac : analyticOrderAt fac z₀ = (1 : ℕ∞) := by -+ simpa [fac, hEq] using -+ (analyticOrderAt_weierstrassFactor_div_self (m := m) (a := divisorZeroIndex₀Val p) hp0) -+ have hrest : analyticOrderAt rest z₀ = ((s.filter -+ (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simpa [rest] using hs -+ have hcongr : -+ (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m (z / divisorZeroIndex₀Val q)) -+ =ᶠ[𝓝 z₀] (fac * rest) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ simp [fac, rest, Finset.prod_insert, hp, Pi.mul_apply] -+ calc -+ analyticOrderAt (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m -+ (z / divisorZeroIndex₀Val q)) z₀ = analyticOrderAt (fac * rest) z₀ := by -+ simpa using (analyticOrderAt_congr hcongr) -+ _ = analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := hmul -+ _ = (1 : ℕ∞) + ((s.filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simp [hfac, hrest] -+ _ = (((insert p s).filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simp [hcard, Nat.add_comm] -+ · have han_fac : -+ AnalyticAt ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) z₀ := by -+ exact (differentiable_weierstrassFactor_divisorZeroIndex₀ m p).analyticAt z₀ -+ have hfac0 : analyticOrderAt (fun z : ℂ => weierstrassFactor m -+ (z / divisorZeroIndex₀Val p)) z₀ = 0 := by -+ have hp0 : divisorZeroIndex₀Val p ≠ 0 := p.property -+ have hval : weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ≠ 0 := by -+ have : (z₀ / divisorZeroIndex₀Val p) ≠ 1 := by -+ intro h1 -+ have : z₀ = divisorZeroIndex₀Val p := by -+ have : z₀ = (z₀ / divisorZeroIndex₀Val p) * (divisorZeroIndex₀Val p) := by -+ simp [div_eq_mul_inv] -+ simpa [h1, div_eq_mul_inv, hp0] using this -+ exact hEq (this.symm) -+ exact (weierstrassFactor_ne_zero_iff m (z₀ / divisorZeroIndex₀Val p)).2 this -+ simpa using (han_fac.analyticOrderAt_eq_zero).2 (by simpa using hval) -+ have hcard : -+ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) (insert p s)).card = -+ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) s).card := by -+ simp [hEq, Finset.filter_insert] -+ have han_rest : AnalyticAt ℂ (fun z : ℂ => ∏ q ∈ s, weierstrassFactor m -+ (z / divisorZeroIndex₀Val q)) z₀ := by -+ simpa [divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ -+ let fac : ℂ → ℂ := fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ let rest : ℂ → ℂ := fun z : ℂ => ∏ q ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val q) -+ have hmul : -+ analyticOrderAt (fac * rest) z₀ = -+ analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := by -+ simpa [fac, rest] using (analyticOrderAt_mul (z₀ := z₀) han_fac han_rest) -+ have hcongr : -+ (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m (z / divisorZeroIndex₀Val q)) -+ =ᶠ[𝓝 z₀] (fac * rest) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ simp [fac, rest, Finset.prod_insert, hp, Pi.mul_apply] -+ calc -+ analyticOrderAt (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m -+ (z / divisorZeroIndex₀Val q)) z₀ -+ = analyticOrderAt (fac * rest) z₀ := by -+ simpa using (analyticOrderAt_congr hcongr) -+ _ = analyticOrderAt rest z₀ := by -+ calc -+ analyticOrderAt (fac * rest) z₀ = analyticOrderAt fac z₀ + -+ analyticOrderAt rest z₀ := hmul -+ _ = analyticOrderAt rest z₀ := by -+ have hfac0' : analyticOrderAt fac z₀ = 0 := by -+ simpa [fac] using hfac0 -+ simp [hfac0'] -+ _ = ((s.filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simpa [rest] using hs -+ _ = (((insert p s).filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by -+ simpa using congrArg (fun n : ℕ => (n : ℕ∞)) hcard.symm -+ -+theorem analyticOrderAt_partialProduct_eq_fiberCard_of_subset -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : -+ analyticOrderAt -+ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ z₀ = ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by -+ have h := -+ analyticOrderAt_finset_prod_weierstrassFactor_divisorZeroIndex₀ -+ (m := m) (f := f) (s := s) (z₀ := z₀) -+ have hfilter : -+ s.filter (fun p => divisorZeroIndex₀Val p = z₀) = -+ divisorZeroIndex₀FiberFinset (f := f) z₀ := by -+ ext p -+ constructor -+ · intro hp' -+ have hpv : divisorZeroIndex₀Val p = z₀ := (Finset.mem_filter.mp hp').2 -+ simpa [mem_divisorZeroIndex₀FiberFinset] using hpv -+ · intro hp_fiber -+ have hpv : divisorZeroIndex₀Val p = z₀ := -+ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hp_fiber -+ have hps : p ∈ s := hs (by simpa [mem_divisorZeroIndex₀FiberFinset] using hpv) -+ exact Finset.mem_filter.2 ⟨hps, hpv⟩ -+ simpa [hfilter] using h -+ -+theorem exists_analyticAt_eq_pow_smul_of_partialProduct_contains_fiber -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : -+ ∃ g : ℂ → ℂ, -+ AnalyticAt ℂ g z₀ ∧ g z₀ ≠ 0 ∧ -+ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ =ᶠ[𝓝 z₀] -+ fun z : ℂ => (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card • g z := by -+ let F : ℂ → ℂ := fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p) -+ have hF_ana : AnalyticAt ℂ F z₀ := by -+ simpa [F, divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ -+ have hOrder : -+ analyticOrderAt F z₀ = -+ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by -+ simpa [F] using -+ (analyticOrderAt_partialProduct_eq_fiberCard_of_subset (m := m) -+ (f := f) (z₀ := z₀) (s := s) hs) -+ refine (hF_ana.analyticOrderAt_eq_natCast (n := (divisorZeroIndex₀FiberFinset -+ (f := f) z₀).card)).1 ?_ -+ simp [hOrder] -+ -+end Complex.Hadamard -+end -+end -+section -+open Filter Function _root_.SiegelZeros.Complex _root_.Function.Complex Finset Topology -+open scoped Topology BigOperators -+open Set -+ -+namespace Complex.Hadamard -+ -+theorem tendstoLocallyUniformlyOn_divisorPartialProduct_univ -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ Filter.atTop -+ (Set.univ : Set ℂ) := by -+ have hprod : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => -+ weierstrassFactor m (z / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ (Set.univ : Set ℂ) := -+ hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ simpa [HasProdLocallyUniformlyOn, divisorPartialProduct] using! hprod -+ -+theorem tendstoUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) (k : ℕ) {K : Set ℂ} (hK : IsCompact K) (hKz : ∀ z ∈ K, z ≠ z₀) : -+ TendstoUniformlyOn -+ (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ k) -+ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) -+ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) -+ K := by -+ have hloc : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ Filter.atTop -+ K := -+ (tendstoLocallyUniformlyOn_divisorPartialProduct_univ (m := m) (f := f) h_sum).mono -+ (by intro z hz; simp) -+ have hunif : -+ TendstoUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ Filter.atTop -+ K := -+ (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact hK).1 hloc -+ let h : ℂ → ℂ := fun z => ((z - z₀) ^ k)⁻¹ -+ have hh : ∃ C, ∀ z ∈ K, ‖h z‖ ≤ C := by -+ have hcont : ContinuousOn h K := by -+ have hpow : ContinuousOn (fun z : ℂ => (z - z₀) ^ k) K := by -+ fun_prop -+ refine hpow.inv₀ ?_ -+ intro z hz -+ have hz0 : z - z₀ ≠ 0 := sub_ne_zero.mpr (hKz z hz) -+ exact pow_ne_zero k hz0 -+ have hKimg : IsCompact (h '' K) := hK.image_of_continuousOn hcont -+ rcases (isBounded_iff_forall_norm_le.1 hKimg.isBounded) with ⟨C, hC⟩ -+ refine ⟨C, ?_⟩ -+ intro z hz -+ exact hC (h z) ⟨z, hz, rfl⟩ -+ have hunif' := -+ (TendstoUniformlyOn.mul_left_bounded (p := (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f -+ (Set.univ : Set ℂ))))) -+ (K := K) -+ (F := fun s z => divisorPartialProduct m f s z) -+ (f := fun z => divisorCanonicalProduct m f (Set.univ : Set ℂ) z) -+ (h := h) -+ hunif hh) -+ simpa [h, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hunif' -+ -+theorem tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) (k : ℕ) : -+ TendstoLocallyUniformlyOn -+ (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ k) -+ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) -+ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) -+ ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hopen : IsOpen ((Set.univ : Set ℂ) \ {z₀}) := by -+ have hset : ((Set.univ : Set ℂ) \ {z₀}) = ({z₀} : Set ℂ)ᶜ := by -+ ext z -+ simp -+ simp [hset] -+ refine (tendstoLocallyUniformlyOn_iff_forall_isCompact hopen).2 ?_ -+ intro K hKsub hK -+ have hKz : ∀ z ∈ K, z ≠ z₀ := by -+ intro z hzK -+ have : z ∈ (Set.univ : Set ℂ) \ {z₀} := hKsub hzK -+ exact by simpa [Set.mem_sdiff, Set.mem_singleton_iff] using this.2 -+ exact tendstoUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m := m) (f := f) h_sum (z₀ := z₀) (k := k) (hK := hK) hKz -+ -+open Filter -+ -+theorem exists_ball_eq_divisorCanonicalProduct_div_pow_eq -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : -+ ∃ ε > 0, ∃ u : ℂ → ℂ, AnalyticAt ℂ u z₀ ∧ -+ u z₀ ≠ 0 ∧ -+ ∀ z : ℂ, z ∈ Metric.ball z₀ ε → z ≠ z₀ → -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = -+ (divisorComplementCanonicalProduct m f z₀ z) * u z := by -+ let fiber : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ divisorZeroIndex₀FiberFinset (f := f) z₀ -+ have hfib : ∃ u : ℂ → ℂ, AnalyticAt ℂ u z₀ ∧ u z₀ ≠ 0 ∧ -+ (fun z : ℂ => divisorPartialProduct m f fiber z) =ᶠ[𝓝 z₀] -+ fun z : ℂ => (z - z₀) ^ fiber.card • u z := by -+ simpa [fiber, divisorPartialProduct] using -+ (exists_analyticAt_eq_pow_smul_of_partialProduct_contains_fiber (m := m) (f := f) (z₀ := z₀) -+ (s := fiber) (by rfl : fiber ⊆ fiber)) -+ rcases hfib with ⟨u, huA, hu0, huEq⟩ -+ have hmem : {z : ℂ | divisorPartialProduct m f fiber z = -+ (z - z₀) ^ fiber.card • u z} ∈ 𝓝 z₀ := huEq -+ rcases Metric.mem_nhds_iff.1 hmem with ⟨ε, hε, hball⟩ -+ refine ⟨ε, hε, u, huA, hu0, ?_⟩ -+ have hq : -+ TendstoLocallyUniformlyOn (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) -+ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ fiber.card) -+ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) -+ ((Set.univ : Set ℂ) \ {z₀}) := -+ tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub -+ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) (k := fiber.card) -+ have hcomp : -+ TendstoLocallyUniformlyOn -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ divisorComplementPartialProduct m f z₀ s) -+ (divisorComplementCanonicalProduct m f z₀) -+ Filter.atTop -+ (Set.univ : Set ℂ) := -+ tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ (m := m) (f := f) -+ (z₀ := z₀) h_sum -+ intro z hz hzne -+ have hz' : z ∈ ((Set.univ : Set ℂ) \ {z₀}) := by -+ refine ⟨by simp, ?_⟩ -+ simpa [Set.mem_singleton_iff] using hzne -+ have hF : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) (Filter.atTop : Filter _) -+ (𝓝 ((divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ fiber.card)) := -+ hq.tendsto_at hz' -+ have hG0 : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ divisorComplementPartialProduct m f z₀ s z) (Filter.atTop : Filter _) -+ (𝓝 (divisorComplementCanonicalProduct m f z₀ z)) := -+ hcomp.tendsto_at (by simp : z ∈ (Set.univ : Set ℂ)) -+ have hG : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ (divisorComplementPartialProduct m f z₀ s z) * u z) (Filter.atTop : Filter _) -+ (𝓝 ((divisorComplementCanonicalProduct m f z₀ z) * u z)) := -+ (hG0.mul tendsto_const_nhds) -+ have hsub : ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), -+ fiber ⊆ s := eventually_atTop_subset_fiberFinset (f := f) z₀ -+ have heq_eventually : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), -+ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card -+ = (divisorComplementPartialProduct m f z₀ s z) * u z := by -+ filter_upwards [hsub] with s hs -+ have hsplit : -+ divisorPartialProduct m f s z = -+ divisorPartialProduct m f fiber z * divisorComplementPartialProduct m f z₀ s z := by -+ simpa [fiber] using -+ (divisorPartialProduct_eq_fiber_mul_complement_of_subset (m := m) (f := f) (z₀ := z₀) -+ (z := z) (s := s) hs) -+ have hfibz : -+ divisorPartialProduct m f fiber z = (z - z₀) ^ fiber.card • u z := by -+ exact hball hz -+ have hzpow : (z - z₀) ^ fiber.card ≠ 0 := -+ pow_ne_zero _ (sub_ne_zero.mpr hzne) -+ set a : ℂ := (z - z₀) ^ fiber.card -+ have ha : a ≠ 0 := by simpa [a] using hzpow -+ set c : ℂ := divisorComplementPartialProduct m f z₀ s z with hc -+ rw [hsplit, hfibz, smul_eq_mul] -+ calc -+ ((a * u z) * c) / a -+ = (a * (u z * c)) / a := by simp [mul_assoc] -+ _ = u z * c := by -+ simpa [mul_assoc] using (mul_div_cancel_left₀ (u z * c) ha) -+ _ = c * u z := by ac_rfl -+ _ = (divisorComplementPartialProduct m f z₀ s z) * u z := by -+ simp [c] -+ have hG' : -+ Tendsto -+ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => -+ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) -+ (Filter.atTop : Filter _) -+ (𝓝 ((divisorComplementCanonicalProduct m f z₀ z) * u z)) := by -+ have heq' : -+ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), -+ (divisorComplementPartialProduct m f z₀ s z) * u z -+ = (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card := by -+ filter_upwards [heq_eventually] with s hs -+ exact hs.symm -+ exact (hG.congr' heq') -+ exact tendsto_nhds_unique hF hG' -+ -+theorem bddAbove_norm_divisorCanonicalProduct_div_pow_puncturedBall -+ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (z₀ : ℂ) : ∃ r > 0, BddAbove (norm ∘ (fun z : ℂ => -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) '' -+ ((Metric.ball z₀ r) \ {z₀})) := by -+ rcases exists_ball_eq_divisorCanonicalProduct_div_pow_eq (m := m) (f := f) (h_sum := h_sum) -+ (z₀ := z₀) with ⟨ε, hε, u, huA, hu0, hEq⟩ -+ have huC : ContinuousAt u z₀ := huA.continuousAt -+ have hpre : {z : ℂ | ‖u z - u z₀‖ < 1} ∈ 𝓝 z₀ := by -+ have : u ⁻¹' Metric.ball (u z₀) (1 : ℝ) ∈ 𝓝 z₀ := -+ huC.preimage_mem_nhds (Metric.ball_mem_nhds (u z₀) (by norm_num)) -+ simpa [Metric.ball, dist_eq_norm, Set.preimage] using this -+ rcases Metric.mem_nhds_iff.1 hpre with ⟨r0, hr0pos, hr0sub⟩ -+ set r : ℝ := min (ε / 2) r0 -+ have hrpos : 0 < r := lt_min (by nlinarith [hε]) hr0pos -+ have hr_lt_ε : r < ε := lt_of_le_of_lt (min_le_left _ _) (by nlinarith [hε]) -+ have huBound : ∀ z ∈ Metric.ball z₀ r, ‖u z‖ ≤ ‖u z₀‖ + 1 := by -+ intro z hz -+ have hz0 : z ∈ Metric.ball z₀ r0 := by -+ have : r ≤ r0 := min_le_right _ _ -+ exact Metric.ball_subset_ball this hz -+ have hdiff : ‖u z - u z₀‖ < 1 := hr0sub hz0 -+ have htri : ‖u z‖ ≤ ‖u z - u z₀‖ + ‖u z₀‖ := by -+ simpa [sub_eq_add_neg, add_assoc] using -+ (norm_add_le (u z - u z₀) (u z₀)) -+ have : ‖u z‖ ≤ 1 + ‖u z₀‖ := le_trans htri (by nlinarith [le_of_lt hdiff]) -+ nlinarith [this] -+ have hdiffC : -+ DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) (Set.univ : Set ℂ) := -+ differentiableOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) h_sum -+ have hcontC : ContinuousOn (divisorComplementCanonicalProduct m f z₀) (Metric.closedBall z₀ r) := -+ (hdiffC.continuousOn).mono (by intro z hz; simp) -+ have hK : IsCompact (Metric.closedBall z₀ r) := isCompact_closedBall _ _ -+ rcases (isBounded_iff_forall_norm_le.1 (hK.image_of_continuousOn hcontC).isBounded) with ⟨C, hC⟩ -+ refine ⟨r, hrpos, ⟨C * (‖u z₀‖ + 1), ?_⟩⟩ -+ rintro _ ⟨z, hzset, rfl⟩ -+ rcases hzset with ⟨hzr, hzne⟩ -+ have hz_in_ε : z ∈ Metric.ball z₀ ε := Metric.ball_subset_ball hr_lt_ε.le hzr -+ have hz_ne : z ≠ z₀ := by simpa [Set.mem_singleton_iff] using hzne -+ have hq : -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / -+ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card -+ = divisorComplementCanonicalProduct m f z₀ z * u z := -+ hEq z hz_in_ε hz_ne -+ have hCz : ‖divisorComplementCanonicalProduct m f z₀ z‖ ≤ C := by -+ have hzK : z ∈ Metric.closedBall z₀ r := Metric.mem_closedBall.2 (le_of_lt hzr) -+ exact hC _ ⟨z, hzK, rfl⟩ -+ have huZ : ‖u z‖ ≤ ‖u z₀‖ + 1 := huBound z hzr -+ have hCnonneg : 0 ≤ C := le_trans (norm_nonneg _) hCz -+ have hmul : ‖divisorComplementCanonicalProduct m f z₀ z * u z‖ ≤ C * (‖u z₀‖ + 1) := by -+ calc -+ ‖divisorComplementCanonicalProduct m f z₀ z * u z‖ -+ = ‖divisorComplementCanonicalProduct m f z₀ z‖ * ‖u z‖ := by simp -+ _ ≤ C * (‖u z₀‖ + 1) := by -+ exact mul_le_mul hCz huZ (norm_nonneg _) hCnonneg -+ simpa [Function.comp, hq] using hmul -+ -+theorem divisorComplementCanonicalProduct_ne_zero_at -+ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ divisorComplementCanonicalProduct m f z₀ z₀ ≠ 0 := by -+ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := -+ fun p => if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) -+ else weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := fun p => Φ p - 1 -+ have hΦ_ne : ∀ p, Φ p ≠ 0 := by -+ intro p -+ by_cases hp : divisorZeroIndex₀Val p = z₀ -+ · simp [Φ, hp] -+ · have hval : divisorZeroIndex₀Val p ≠ z₀ := hp -+ have hz : z₀ / divisorZeroIndex₀Val p ≠ (1 : ℂ) := by -+ intro h -+ by_cases hp0 : divisorZeroIndex₀Val p = 0 -+ · have : z₀ / divisorZeroIndex₀Val p = (0 : ℂ) := by simp [hp0] -+ have h01 := h -+ rw [this] at h01 -+ exact (show False from (by simpa using (show (0 : ℂ) ≠ (1 : ℂ) from by simp) h01)) -+ · have : z₀ = divisorZeroIndex₀Val p := (div_eq_one_iff_eq hp0).1 h -+ exact hval this.symm -+ have hE : weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ≠ 0 := by -+ intro h0 -+ have : z₀ / divisorZeroIndex₀Val p = (1 : ℂ) := -+ (weierstrassFactor_eq_zero_iff (m := m) (z := z₀ / divisorZeroIndex₀Val p)).1 h0 -+ exact hz this -+ simp [Φ, hp, hE] -+ have hz0_le : ‖z₀‖ ≤ max ‖z₀‖ 1 := le_max_left _ _ -+ set R : ℝ := max ‖z₀‖ 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) -+ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) -+ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) -+ have h_big : -+ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, -+ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by -+ have hfin : ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ -+ 2 * R} : Set _).Finite := by -+ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this -+ have := hfin.eventually_cofinite_notMem -+ filter_upwards [this] with p hp -+ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp -+ exact lt_of_not_ge this -+ have hBound : -+ ∀ᶠ p in Filter.cofinite, ‖a p‖ ≤ u p := by -+ filter_upwards [h_big] with p hp -+ have ha_pos : 0 < ‖divisorZeroIndex₀Val p‖ := lt_trans (by nlinarith [hRpos]) hp -+ have hz_div : ‖z₀ / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by -+ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hRpos] -+ have hinv : ‖divisorZeroIndex₀Val p‖⁻¹ < (2 * R)⁻¹ := by -+ simpa [one_div] using (one_div_lt_one_div_of_lt h2R_pos hp) -+ have hmul_le : ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ ≤ R * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ refine mul_le_mul_of_nonneg_right ?_ (inv_nonneg.2 (norm_nonneg _)) -+ exact hz0_le -+ have hmul_lt : R * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := -+ mul_lt_mul_of_pos_left hinv hRpos -+ have hlt : ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := -+ lt_of_le_of_lt hmul_le hmul_lt -+ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by -+ have hRne : (R : ℝ) ≠ 0 := hRpos.ne' -+ have : R * (2 * R)⁻¹ = R / (2 * R) := by simp [div_eq_mul_inv] -+ rw [this] -+ field_simp [hRne] -+ have hnorm : ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ have hzlt : ‖z₀ / divisorZeroIndex₀Val p‖ < (1 / 2 : ℝ) := by -+ calc -+ ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := hnorm -+ _ < R * (2 * R)⁻¹ := hlt -+ _ = (1 / 2 : ℝ) := hRhalf -+ exact le_of_lt hzlt -+ have hE : -+ ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ ≤ -+ 4 * ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) := -+ weierstrassFactor_sub_one_pow_bound (m := m) (z := z₀ / divisorZeroIndex₀Val p) hz_div -+ have hz_pow : -+ ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ -+ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ have : ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by -+ simp [div_eq_mul_inv] -+ rw [this] -+ have : (‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = -+ ‖z₀‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ simp [mul_pow] -+ rw [this] -+ have hzle_pow : ‖z₀‖ ^ (m + 1) ≤ R ^ (m + 1) := -+ pow_le_pow_left₀ (norm_nonneg z₀) hz0_le (m + 1) -+ gcongr -+ have hp_ne : divisorZeroIndex₀Val p ≠ z₀ := by -+ intro h -+ have : ‖divisorZeroIndex₀Val p‖ ≤ R := by -+ simp [h, R] -+ exact (not_lt_of_ge this) (lt_trans (by nlinarith [hRpos]) hp) -+ have ha : ‖a p‖ = ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ := by -+ simp [a, Φ, hp_ne, sub_eq_add_neg] -+ calc -+ ‖a p‖ = ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ := ha -+ _ ≤ 4 * ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) := by -+ simpa [sub_eq_add_neg, add_comm] using hE -+ _ ≤ 4 * (R ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) := by -+ gcongr -+ _ = u p := by -+ simp [u, mul_assoc, mul_comm] -+ have hsum_norm : Summable (fun p => ‖a p‖) := by -+ refine (Summable.of_norm_bounded_eventually (E := ℝ) (f := fun p => ‖a p‖) (g := u) hu ?_) -+ filter_upwards [hBound] with p hp -+ simpa [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg (a p))] using hp -+ have htprod_ne : -+ (∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (1 + a p)) ≠ 0 := -+ tprod_one_add_ne_zero_of_summable (R := ℂ) (f := a) (hf := fun p => by -+ simpa [a, Φ, add_sub_cancel] using hΦ_ne p) hsum_norm -+ have : (∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (1 + a p)) = -+ divisorComplementCanonicalProduct m f z₀ z₀ := by -+ simp [a, Φ, divisorComplementCanonicalProduct, divisorComplementFactor_def] -+ exact by -+ intro h0 -+ exact htprod_ne (by simpa [this] using h0) -+ -+end Complex.Hadamard -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Exponential.lean b/PrimeNumberTheoremAnd/SiegelZeros/Exponential.lean -new file mode 100644 -index 0000000..082148e ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/Exponential.lean -@@ -0,0 +1,722 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.ProductBounds -+ -+namespace SiegelZeros -+ -+section -+noncomputable section -+ -+namespace Complex -+namespace Hadamard -+ -+open _root_.SiegelZeros.Complex _root_.SiegelZeros.Real BigOperators -+ _root_.SiegelZeros.Finset Set Filter Topology Metric -+ -+open scoped Topology -+ -+theorem zero_free_polynomial_growth_is_exp_poly {H : ℂ → ℂ} {n : ℕ} -+ (hH : Differentiable ℂ H) -+ (h_nonzero : ∀ z, H z ≠ 0) -+ (h_bound : ∃ C > 0, ∀ z, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ n)) : -+ ∃ P : Polynomial ℂ, P.natDegree ≤ n ∧ ∀ z, H z = Complex.exp (Polynomial.eval z P) := by -+ classical -+ rcases h_bound with ⟨C, hCpos, hC⟩ -+ let L : ℂ → ℂ := fun z => deriv H z / H z -+ have hderivH : Differentiable ℂ (deriv H) := by -+ intro z -+ exact ((hH.analyticAt z).deriv).differentiableAt -+ have hL : Differentiable ℂ L := by -+ simpa [L] using! (hderivH.div hH h_nonzero) -+ let h : ℂ → ℂ := fun z => Complex.wedgeIntegral (0 : ℂ) z L -+ have hh_deriv : ∀ z, HasDerivAt h (L z) z := by -+ intro z -+ let r : ℝ := ‖z‖ + 1 -+ have hrpos : 0 < r := by -+ dsimp [r]; linarith [norm_nonneg z] -+ have hz_ball : z ∈ Metric.ball (0 : ℂ) r := by -+ have : dist z (0 : ℂ) < r := by simp [r, dist_zero_right] -+ simpa [Metric.mem_ball] using this -+ have hconserv : Complex.IsConservativeOn L (Metric.ball (0 : ℂ) r) := -+ (hL.differentiableOn).isConservativeOn -+ have hcont : ContinuousOn L (Metric.ball (0 : ℂ) r) := -+ hL.continuous.continuousOn -+ simpa [h, r] using hconserv.hasDerivAt_wedgeIntegral (f_cont := hcont) (hz := hz_ball) -+ have hh : Differentiable ℂ h := fun z => (hh_deriv z).differentiableAt -+ have hderiv_h : ∀ z, deriv h z = L z := fun z => (hh_deriv z).deriv -+ let k : ℂ → ℂ := fun z => h z + Complex.log (H 0) -+ have hk : Differentiable ℂ k := hh.add_const (Complex.log (H 0)) -+ have hk_exp : ∀ z, H z = Complex.exp (k z) := by -+ let F : ℂ → ℂ := fun z => Complex.exp (k z) / H z -+ have hF_deriv : ∀ z, deriv F z = 0 := by -+ intro z -+ have hH_has : HasDerivAt H (deriv H z) z := (hH z).hasDerivAt -+ have hk_has : HasDerivAt k (L z) z := by -+ have hh_has : HasDerivAt h (L z) z := hh_deriv z -+ simpa [k, L] using hh_has.add_const (Complex.log (H 0)) -+ have hExp : HasDerivAt (fun w => Complex.exp (k w)) (Complex.exp (k z) * L z) z := -+ (HasDerivAt.cexp hk_has) -+ have hDiv := (HasDerivAt.div hExp hH_has (h_nonzero z)) -+ have : -+ deriv F z = -+ ((Complex.exp (k z) * L z) * H z - Complex.exp (k z) * deriv H z) / (H z) ^ 2 := by -+ simpa [F] using! hDiv.deriv -+ rw [this] -+ have hnum : -+ (Complex.exp (k z) * L z) * H z - Complex.exp (k z) * deriv H z = 0 := by -+ dsimp [L] -+ field_simp [h_nonzero z] -+ ring -+ simp [hnum] -+ have hF_diff : Differentiable ℂ F := (hk.cexp).div hH h_nonzero -+ have hF_const : ∀ z, F z = F 0 := by -+ intro z -+ exact is_const_of_deriv_eq_zero hF_diff hF_deriv z 0 -+ have hF0 : F 0 = 1 := by -+ have hh0 : h 0 = 0 := by simp [h, Complex.wedgeIntegral] -+ have hk0 : k 0 = Complex.log (H 0) := by simp [k, hh0] -+ have hH0 : H 0 ≠ 0 := h_nonzero 0 -+ simp [F, hk0, Complex.exp_log hH0, hH0] -+ intro z -+ have : F z = 1 := by simpa [hF0] using (hF_const z) -+ have hHz : H z ≠ 0 := h_nonzero z -+ have : Complex.exp (k z) / H z = 1 := by simpa [F] using this -+ have : Complex.exp (k z) = H z := by -+ field_simp [hHz] at this -+ simpa using this -+ exact this.symm -+ have hk_re_bound : ∀ z, (k z).re ≤ C * (1 + ‖z‖) ^ n := by -+ intro z -+ have hHz : H z ≠ 0 := h_nonzero z -+ have hpos : 0 < ‖H z‖ := norm_pos_iff.mpr hHz -+ have hlog_le : Real.log ‖H z‖ ≤ C * (1 + ‖z‖) ^ n := by -+ have := Real.log_le_log hpos (hC z) -+ simpa [Real.log_exp] using this -+ have hlog_eq : Real.log ‖H z‖ = (k z).re := by -+ have : ‖H z‖ = Real.exp (k z).re := by -+ simpa [hk_exp z] using (Complex.norm_exp (k z)) -+ calc -+ Real.log ‖H z‖ = Real.log (Real.exp (k z).re) := by simp [this] -+ _ = (k z).re := by simp -+ simpa [hlog_eq] using hlog_le -+ have hk_iteratedDeriv_eq_zero : ∀ m : ℕ, n < m → iteratedDeriv m k 0 = 0 := by -+ intro m hm -+ have hm' : 0 < (m - n : ℕ) := Nat.sub_pos_of_lt hm -+ have hmne : m - n ≠ 0 := (Nat.pos_iff_ne_zero.1 hm') -+ let f : ℂ → ℂ := fun z => k z - k 0 -+ have hf : Differentiable ℂ f := hk.sub_const (k 0) -+ have hf0 : f 0 = 0 := by simp [f] -+ have hf_re_bound : ∀ R : ℝ, 0 < R → -+ ∀ z, ‖z‖ ≤ R → (f z).re ≤ C * (1 + R) ^ n + ‖k 0‖ := by -+ intro R hRpos z hzR -+ have hkz : (k z).re ≤ C * (1 + ‖z‖) ^ n := hk_re_bound z -+ have hkz' : (k z).re ≤ C * (1 + R) ^ n := by -+ have h1 : (1 + ‖z‖ : ℝ) ≤ 1 + R := by linarith -+ have hpow : (1 + ‖z‖ : ℝ) ^ n ≤ (1 + R) ^ n := -+ pow_le_pow_left₀ (by linarith [norm_nonneg z]) h1 n -+ exact hkz.trans (mul_le_mul_of_nonneg_left hpow (le_of_lt hCpos)) -+ have hRe0 : -(k 0).re ≤ ‖k 0‖ := by -+ have habs : |(k 0).re| ≤ ‖k 0‖ := Complex.abs_re_le_norm (k 0) -+ have hneg : -(k 0).re ≤ |(k 0).re| := by simpa using (neg_le_abs (k 0).re) -+ exact hneg.trans habs -+ have : (f z).re ≤ C * (1 + R) ^ n + ‖k 0‖ := by -+ have : (f z).re = (k z).re - (k 0).re := by simp [f, sub_eq_add_neg] -+ nlinarith [this, hkz', hRe0] -+ exact this -+ have hf_bound_on_ball : ∀ R : ℝ, 0 < R → -+ ∀ z, ‖z‖ ≤ R / 2 → ‖f z‖ ≤ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ intro R hRpos z hz -+ have hR2pos : 0 < R / 2 := by nlinarith -+ have hlt : R / 2 < R := by nlinarith -+ have hMpos : 0 < (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ have : 0 ≤ C * (1 + R) ^ n := by -+ refine mul_nonneg (le_of_lt hCpos) ?_ -+ exact pow_nonneg (by linarith) _ -+ nlinarith [this, norm_nonneg (k 0)] -+ have hf_anal : AnalyticOnNhd ℂ f (Metric.closedBall 0 R) := by -+ intro w _hw -+ exact (hf.analyticAt w) -+ have hf_re : ∀ w, ‖w‖ ≤ R → (f w).re ≤ (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ intro w hw -+ have := hf_re_bound R hRpos w hw -+ linarith -+ have hf_bc := -+ borelCaratheodory_zero_closedBall (f := f) (r := R / 2) (R := R) -+ (M := (C * (1 + R) ^ n + ‖k 0‖ + 1)) -+ hf_anal hR2pos hlt hMpos hf0 hf_re (z := z) hz -+ have hconst : -+ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) * (R / 2) / (R - R / 2) -+ = 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ field_simp [hRpos.ne'] ; ring -+ simpa [hconst] using hf_bc -+ have hCauchy : ∀ R : ℝ, 0 < R → -+ ‖iteratedDeriv m f 0‖ ≤ -+ (m.factorial : ℝ) * (2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) / (R / 2) ^ m := by -+ intro R hRpos -+ have hR2pos : 0 < R / 2 := by nlinarith -+ have hf_diffCont : DiffContOnCl ℂ f (Metric.ball (0 : ℂ) (R / 2)) := hf.diffContOnCl -+ have hbound_sphere : -+ ∀ z ∈ Metric.sphere (0 : ℂ) (R / 2), -+ ‖f z‖ ≤ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by -+ intro z hz -+ have hz' : ‖z‖ ≤ R / 2 := by -+ simpa [Metric.mem_sphere, dist_zero_right] using (le_of_eq hz) -+ exact hf_bound_on_ball R hRpos z hz' -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using -+ (Complex.norm_iteratedDeriv_le_of_forall_mem_sphere_norm_le (n := m) (c := (0 : ℂ)) -+ (R := R / 2) (C := 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) -+ (hR := hR2pos) hf_diffCont hbound_sphere) -+ have hf_iter_eq : iteratedDeriv m f 0 = 0 := by -+ by_contra hne -+ have ha : 0 < ‖iteratedDeriv m f 0‖ := norm_pos_iff.2 hne -+ let RHS : ℝ → ℝ := fun R => -+ (m.factorial : ℝ) * (2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) / (R / 2) ^ m -+ have hle_RHS : ∀ R : ℝ, 0 < R → ‖iteratedDeriv m f 0‖ ≤ RHS R := by -+ intro R hRpos -+ simpa [RHS] using hCauchy R hRpos -+ have hRHS_tendsto : Tendsto RHS atTop (𝓝 0) := by -+ let K : ℝ := ‖k 0‖ + 1 -+ have hmpos : 0 < m := lt_of_le_of_lt (Nat.zero_le n) hm -+ have hm0 : m ≠ 0 := ne_of_gt hmpos -+ have hratio : Tendsto (fun R : ℝ => R ^ n / (R / 2) ^ m) atTop (𝓝 0) := by -+ have hident : -+ (fun R : ℝ => R ^ n / (R / 2) ^ m) = fun R : ℝ => (2 : ℝ) ^ m * (R ^ n / R ^ m) := by -+ funext R -+ simp [div_eq_mul_inv, mul_pow, mul_assoc, mul_comm] -+ have hmain : Tendsto (fun R : ℝ => R ^ n / R ^ m) atTop (𝓝 0) := by -+ have hp : m - n ≠ 0 := (Nat.pos_iff_ne_zero.1 (Nat.sub_pos_of_lt hm)) -+ have hmain' : Tendsto (fun R : ℝ => (R ^ (m - n))⁻¹) atTop (𝓝 0) := by -+ simpa using (tendsto_pow_neg_atTop (𝕜 := ℝ) (n := m - n) hp) -+ have hEq : (fun R : ℝ => (R ^ (m - n))⁻¹) =ᶠ[atTop] fun R : ℝ => R ^ n / R ^ m := by -+ have hEq' : (fun R : ℝ => R ^ n / R ^ m) =ᶠ[atTop] fun R : ℝ => (R ^ (m - n))⁻¹ := by -+ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR -+ have hle : n ≤ m := le_of_lt hm -+ have hm_eq : n + (m - n) = m := Nat.add_sub_of_le hle -+ have hn0 : R ^ n ≠ 0 := pow_ne_zero n hR -+ calc -+ R ^ n / R ^ m = R ^ n / R ^ (n + (m - n)) := by simp [hm_eq] -+ _ = R ^ n * ((R ^ (m - n))⁻¹ * (R ^ n)⁻¹) := by -+ simp [pow_add, div_eq_mul_inv, mul_comm] -+ _ = (R ^ (m - n))⁻¹ := by -+ ring_nf -+ simp [hn0] -+ exact hEq'.symm -+ exact Filter.Tendsto.congr' hEq hmain' -+ have : Tendsto (fun R : ℝ => (2 : ℝ) ^ m * (R ^ n / R ^ m)) atTop (𝓝 ((2 : ℝ) ^ m * 0)) := -+ tendsto_const_nhds.mul hmain -+ simpa [hident] using this -+ have hinv : Tendsto (fun R : ℝ => ((R / 2) ^ m)⁻¹) atTop (𝓝 0) := by -+ have hdiv : Tendsto (fun R : ℝ => R / 2) atTop atTop := -+ (tendsto_id.atTop_div_const (r := (2 : ℝ)) (by norm_num : (0 : ℝ) < 2)) -+ have hpow : Tendsto (fun R : ℝ => (R / 2) ^ m) atTop atTop := -+ (Filter.tendsto_pow_atTop (α := ℝ) (n := m) hm0).comp hdiv -+ simpa using! hpow.inv_tendsto_atTop -+ have hdiv : Tendsto (fun R : ℝ => (1 + R) / R) atTop (𝓝 (1 : ℝ)) := by -+ have hinv' : Tendsto (fun R : ℝ => (R : ℝ)⁻¹) atTop (𝓝 (0 : ℝ)) := tendsto_inv_atTop_zero -+ have hadd : Tendsto (fun R : ℝ => (1 : ℝ) + (R : ℝ)⁻¹) atTop (𝓝 (1 : ℝ)) := by -+ simpa using (tendsto_const_nhds.add hinv') -+ have hEq : (fun R : ℝ => (1 + R) / R) =ᶠ[atTop] fun R : ℝ => (1 : ℝ) + (R : ℝ)⁻¹ := by -+ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR -+ field_simp [hR]; ring -+ exact Filter.Tendsto.congr' hEq.symm hadd -+ have hdiv_pow : Tendsto (fun R : ℝ => ((1 + R) / R) ^ n) atTop (𝓝 (1 : ℝ)) := by -+ simpa using (hdiv.pow n) -+ have hone_add_ratio : -+ Tendsto (fun R : ℝ => (1 + R) ^ n / (R / 2) ^ m) atTop (𝓝 (0 : ℝ)) := by -+ have hEq : -+ (fun R : ℝ => (1 + R) ^ n / (R / 2) ^ m) -+ =ᶠ[atTop] fun R : ℝ => ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) := by -+ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR -+ have hRpow : (R ^ n : ℝ) ≠ 0 := pow_ne_zero n hR -+ have hident : -+ ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) = (1 + R) ^ n / (R / 2) ^ m := by -+ calc -+ ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) -+ = ((1 + R) ^ n / R ^ n) * (R ^ n / (R / 2) ^ m) := by -+ simp [div_pow] -+ _ = ((1 + R) ^ n * R ^ n) / (R ^ n * (R / 2) ^ m) := by -+ simp [div_mul_div_comm, mul_comm] -+ _ = ((1 + R) ^ n * R ^ n) / ((R / 2) ^ m * R ^ n) := by -+ simp [mul_comm] -+ _ = (1 + R) ^ n / (R / 2) ^ m := by -+ simpa [mul_assoc, mul_comm, mul_left_comm] using -+ (mul_div_mul_right (a := (1 + R) ^ n) (b := (R / 2) ^ m) hRpow) -+ exact hident.symm -+ have hmul : -+ Tendsto -+ (fun R : ℝ => ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m)) -+ atTop (𝓝 (0 : ℝ)) := by -+ simpa [mul_zero] using (hdiv_pow.mul hratio) -+ exact Filter.Tendsto.congr' hEq.symm hmul -+ have h1 : Tendsto (fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m)) atTop (𝓝 0) := by -+ simpa using (tendsto_const_nhds.mul hone_add_ratio) -+ have h2 : Tendsto (fun R : ℝ => K * ((R / 2) ^ m)⁻¹) atTop (𝓝 0) := by -+ simpa using (tendsto_const_nhds.mul hinv) -+ have hsum : -+ Tendsto -+ (fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m) + K * ((R / 2) ^ m)⁻¹) -+ atTop (𝓝 0) := by -+ simpa using (h1.add h2) -+ have hrew : -+ (fun R : ℝ => (C * (1 + R) ^ n + K) / (R / 2) ^ m) -+ = fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m) + K * ((R / 2) ^ m)⁻¹ := by -+ funext R -+ simp [div_eq_mul_inv, mul_add, mul_assoc, mul_comm] -+ have hbase : Tendsto (fun R : ℝ => (C * (1 + R) ^ n + K) / (R / 2) ^ m) atTop (𝓝 0) := by -+ simpa [hrew] using hsum -+ have hconst : -+ Tendsto (fun _ : ℝ => (m.factorial : ℝ) * (2 : ℝ)) atTop -+ (𝓝 ((m.factorial : ℝ) * (2 : ℝ))) := tendsto_const_nhds -+ have hmul : Tendsto (fun R : ℝ => ((m.factorial : ℝ) * (2 : ℝ)) * -+ ((C * (1 + R) ^ n + K) / (R / 2) ^ m)) atTop (𝓝 0) := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using (hconst.mul hbase) -+ have hRHS_rw : RHS = fun R : ℝ => ((m.factorial : ℝ) * (2 : ℝ)) * -+ ((C * (1 + R) ^ n + K) / (R / 2) ^ m) := by -+ funext R -+ dsimp [RHS, K] -+ ring_nf -+ simpa [hRHS_rw] using hmul -+ have hsmall : ∀ᶠ R in atTop, RHS R < ‖iteratedDeriv m f 0‖ / 2 := -+ (tendsto_order.1 hRHS_tendsto).2 _ (half_pos ha) -+ have hle_eventually : ∀ᶠ R in atTop, ‖iteratedDeriv m f 0‖ ≤ RHS R := by -+ filter_upwards [eventually_gt_atTop (0 : ℝ)] with R hRpos -+ exact hle_RHS R hRpos -+ rcases (hle_eventually.and hsmall).exists with ⟨R, hle, hlt⟩ -+ have : ‖iteratedDeriv m f 0‖ < ‖iteratedDeriv m f 0‖ := -+ (lt_of_le_of_lt hle hlt).trans (half_lt_self ha) -+ exact lt_irrefl _ this -+ have hmpos : 0 < m := lt_of_le_of_lt (Nat.zero_le n) hm -+ have hm0 : m ≠ 0 := ne_of_gt hmpos -+ have hkcd : ContDiffAt ℂ (↑m) k (0 : ℂ) := (hk.analyticAt 0).contDiffAt -+ have hccd : ContDiffAt ℂ (↑m) (fun _ : ℂ => k 0) (0 : ℂ) := contDiffAt_const -+ have hsub : -+ iteratedDeriv m f 0 = -+ iteratedDeriv m k 0 - iteratedDeriv m (fun _ : ℂ => k 0) 0 := by -+ simpa [f] using! (iteratedDeriv_sub (n := m) (x := (0 : ℂ)) hkcd hccd) -+ have hconst0 : iteratedDeriv m (fun _ : ℂ => k 0) 0 = 0 := by -+ simp [iteratedDeriv_const, hm0] -+ have hf_eq : iteratedDeriv m f 0 = iteratedDeriv m k 0 := by -+ simp [hsub, hconst0] -+ simpa [hf_eq] using hf_iter_eq -+ let P : Polynomial ℂ := -+ ∑ m ∈ Finset.range (n + 1), Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) -+ have hPdeg : P.natDegree ≤ n := by -+ have hnat : -+ P.natDegree ≤ -+ Finset.fold max 0 -+ (fun m : ℕ => -+ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) -+ (Finset.range (n + 1)) := by -+ simpa [P, Function.comp] using -+ (Polynomial.natDegree_sum_le (s := Finset.range (n + 1)) -+ (f := fun m : ℕ => -+ Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0))) -+ have hfold : -+ Finset.fold max 0 -+ (fun m : ℕ => -+ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) -+ (Finset.range (n + 1)) ≤ n := by -+ refine (Finset.fold_max_le (f := fun m : ℕ => -+ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) -+ (b := 0) (s := Finset.range (n + 1)) (c := n)).2 ?_ -+ refine ⟨Nat.zero_le n, ?_⟩ -+ intro m hm -+ have hmon : -+ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree ≤ m := -+ Polynomial.natDegree_monomial_le _ -+ have hm_le : m ≤ n := Nat.le_of_lt_succ (Finset.mem_range.1 hm) -+ exact hmon.trans hm_le -+ exact hnat.trans hfold -+ have hk_poly : ∀ z, k z = Polynomial.eval z P := by -+ intro z -+ have htaylor := Complex.taylorSeries_eq_of_entire' (c := (0 : ℂ)) (z := z) hk -+ have htail : ∀ m : ℕ, m ∉ Finset.range (n + 1) → -+ ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m) = 0 := by -+ intro m hm' -+ have hmgt : n < m := by -+ have : n + 1 ≤ m := Nat.le_of_not_lt (by simpa [Finset.mem_range] using hm') -+ exact Nat.lt_of_lt_of_le (Nat.lt_succ_self n) this -+ have hz : iteratedDeriv m k 0 = 0 := hk_iteratedDeriv_eq_zero m hmgt -+ simp [hz] -+ have htsum : -+ (∑' m : ℕ, (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m) -+ = ∑ m ∈ Finset.range (n + 1), (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * z ^ m := by -+ simpa [sub_zero] using (tsum_eq_sum (s := Finset.range (n + 1)) htail) -+ have hfinite : -+ k z = ∑ m ∈ Finset.range (n + 1), (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * z ^ m := by -+ calc -+ k z = ∑' m : ℕ, (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m := by -+ simpa using htaylor.symm -+ _ = _ := htsum -+ have hEval : -+ Polynomial.eval z P = -+ ∑ m ∈ Finset.range (n + 1), z ^ m * ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) := by -+ classical -+ change Polynomial.eval₂ (RingHom.id ℂ) z P = _ -+ let φ : Polynomial ℂ →+* ℂ := Polynomial.eval₂RingHom (RingHom.id ℂ) z -+ change φ P = _ -+ simp [P, φ, Polynomial.eval₂_monomial, mul_comm] -+ have hfinite' : -+ k z = ∑ m ∈ Finset.range (n + 1), z ^ m * ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) := by -+ simpa [mul_comm, mul_left_comm, mul_assoc] using hfinite -+ simpa [hEval] using hfinite' -+ refine ⟨P, hPdeg, ?_⟩ -+ intro z -+ have : H z = Complex.exp (k z) := by simp [hk_exp z] -+ simp [this, hk_poly z] -+ -+end Hadamard -+end Complex -+end -+end -+section -+noncomputable section -+ -+namespace Complex -+namespace Hadamard -+ -+open _root_.SiegelZeros.Complex _root_.SiegelZeros.Real BigOperators -+ _root_.SiegelZeros.Finset Set Filter Topology Metric -+ -+open scoped Topology -+ -+open Polynomial -+ -+private lemma exists_pow_eq_complex {n : ℕ} (hn : 0 < n) (w : ℂ) : ∃ z : ℂ, z ^ n = w := by -+ classical -+ by_cases hw : w = 0 -+ · subst hw -+ refine ⟨0, ?_⟩ -+ have hn0 : n ≠ 0 := Nat.ne_of_gt hn -+ simp [hn0] -+ · refine ⟨Complex.exp (Complex.log w / n), ?_⟩ -+ have hn0 : (n : ℂ) ≠ 0 := by -+ exact_mod_cast (Nat.ne_of_gt hn) -+ calc -+ (Complex.exp (Complex.log w / n)) ^ n -+ = Complex.exp ((n : ℂ) * (Complex.log w / n)) := by -+ simpa using (Complex.exp_nat_mul (Complex.log w / n) n).symm -+ _ = Complex.exp (Complex.log w) := by -+ have : (n : ℂ) * (Complex.log w / n) = Complex.log w := by -+ field_simp [hn0] -+ simp [this] -+ _ = w := by simpa using (Complex.exp_log hw) -+ -+private lemma mul_conj_div_norm (a : ℂ) (ha : a ≠ 0) : -+ a * ((starRingEnd ℂ) a / (‖a‖ : ℂ)) = (‖a‖ : ℂ) := by -+ have hnorm_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha -+ have hnorm_ne : (‖a‖ : ℂ) ≠ 0 := by -+ exact_mod_cast (ne_of_gt hnorm_pos) -+ have hmul : a * (starRingEnd ℂ) a = (Complex.normSq a : ℂ) := -+ Complex.mul_conj a -+ have hcast : (Complex.normSq a : ℂ) = ((‖a‖ ^ 2 : ℝ) : ℂ) := by -+ exact_mod_cast (Complex.normSq_eq_norm_sq a) -+ have hdiv : ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) = (‖a‖ : ℂ) := by -+ have : ((‖a‖ ^ 2 : ℝ) : ℂ) = (‖a‖ : ℂ) * (‖a‖ : ℂ) := by -+ simp [pow_two] -+ calc -+ ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) -+ = ((‖a‖ : ℂ) * (‖a‖ : ℂ)) / (‖a‖ : ℂ) := by simp [this] -+ _ = (‖a‖ : ℂ) := by -+ field_simp [hnorm_ne] -+ calc -+ a * ((starRingEnd ℂ) a / (‖a‖ : ℂ)) -+ = (a * (starRingEnd ℂ) a) / (‖a‖ : ℂ) := by -+ simp [div_eq_mul_inv, mul_assoc] -+ _ = (Complex.normSq a : ℂ) / (‖a‖ : ℂ) := by simp [hmul] -+ _ = ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) := by simp [hcast] -+ _ = (‖a‖ : ℂ) := hdiv -+ -+private lemma exists_z_norm_eq_re_eval_ge -+ (P : Polynomial ℂ) (hn : 0 < P.natDegree) : -+ ∃ R0 : ℝ, 0 < R0 ∧ -+ ∀ R : ℝ, R0 ≤ R → -+ ∃ z : ℂ, ‖z‖ = R ∧ -+ (‖P.leadingCoeff‖ / 2) * R ^ P.natDegree ≤ (P.eval z).re := by -+ classical -+ set n : ℕ := P.natDegree -+ have hn0 : 0 < n := hn -+ have hP0 : P ≠ 0 := by -+ intro h0 -+ simp [n, h0] at hn0 -+ have hLC : P.leadingCoeff ≠ 0 := Polynomial.leadingCoeff_ne_zero.mpr hP0 -+ set a : ℂ := P.leadingCoeff -+ have ha : a ≠ 0 := hLC -+ have hnorm_a_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha -+ set wtarget : ℂ := (starRingEnd ℂ) a / (‖a‖ : ℂ) -+ have hwtarget_norm : ‖wtarget‖ = (1 : ℝ) := by -+ calc -+ ‖wtarget‖ = ‖(starRingEnd ℂ) a‖ / ‖(‖a‖ : ℂ)‖ := by -+ simp [wtarget] -+ _ = ‖a‖ / ‖a‖ := by simp -+ _ = (1 : ℝ) := by -+ field_simp [hnorm_a_pos.ne'] -+ rcases exists_pow_eq_complex (n := n) hn0 (w := wtarget) with ⟨w, hw⟩ -+ have hw_norm : ‖w‖ = (1 : ℝ) := by -+ have hpow : (‖w‖ : ℝ) ^ n = 1 := by -+ have := congrArg (fun z : ℂ => ‖z‖) hw -+ simpa [norm_pow, hwtarget_norm] using this -+ have hn0' : n ≠ 0 := Nat.ne_of_gt hn0 -+ exact (pow_eq_one_iff_of_nonneg (norm_nonneg w) hn0').1 hpow -+ set S : ℝ := ∑ i ∈ Finset.range n, ‖P.coeff i‖ -+ set R0 : ℝ := max 1 (2 * S / ‖a‖) -+ refine ⟨R0, ?_, ?_⟩ -+ · have : (0 : ℝ) < (1 : ℝ) := by norm_num -+ exact lt_of_lt_of_le this (le_max_left _ _) -+ · intro R hR -+ have hR_ge1 : (1 : ℝ) ≤ R := by -+ exact le_trans (le_max_left _ _) hR -+ have hR_nonneg : 0 ≤ R := le_trans (by norm_num) hR_ge1 -+ set z : ℂ := (R : ℂ) * w -+ have hz_norm : ‖z‖ = R := by -+ have : ‖z‖ = |R| * ‖w‖ := by -+ simp [z] -+ simp [this, hw_norm, abs_of_nonneg hR_nonneg] -+ have h_eval : P.eval z = -+ (∑ i ∈ Finset.range n, P.coeff i * z ^ i) + P.coeff n * z ^ n := by -+ have hsum : P.eval z = ∑ i ∈ Finset.range (n + 1), P.coeff i * z ^ i := by -+ have : P.natDegree + 1 = n + 1 := by simp [n] -+ simpa [this] using (Polynomial.eval_eq_sum_range (p := P) z) -+ have hsplit : -+ (∑ i ∈ Finset.range (n + 1), P.coeff i * z ^ i) -+ = (∑ i ∈ Finset.range n, P.coeff i * z ^ i) + P.coeff n * z ^ n := by -+ simpa using (Finset.sum_range_succ (f := fun i => P.coeff i * z ^ i) n) -+ exact hsum.trans hsplit -+ have h_lower_norm : -+ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ S * R ^ (n - 1) := by -+ have h1 : -+ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ -+ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ := by -+ simpa using (norm_sum_le (Finset.range n) (fun i => P.coeff i * z ^ i)) -+ have hterm : ∀ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ ≤ ‖P.coeff i‖ * R ^ (n - 1) := by -+ intro i hi -+ have hi_lt : i < n := Finset.mem_range.mp hi -+ have hi_le : i ≤ n - 1 := Nat.le_pred_of_lt hi_lt -+ have hzpow : ‖z‖ ^ i ≤ R ^ (n - 1) := by -+ have hmono : ‖z‖ ^ i ≤ ‖z‖ ^ (n - 1) := -+ pow_le_pow_right₀ (by simpa [hz_norm] using hR_ge1) hi_le -+ simpa [hz_norm] using hmono -+ calc -+ ‖P.coeff i * z ^ i‖ = ‖P.coeff i‖ * ‖z‖ ^ i := by -+ simp [norm_pow] -+ _ ≤ ‖P.coeff i‖ * R ^ (n - 1) := by -+ exact mul_le_mul_of_nonneg_left hzpow (norm_nonneg _) -+ have h2 : -+ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ -+ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1) := by -+ exact Finset.sum_le_sum (fun i hi => hterm i hi) -+ have h3 : -+ (∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1)) -+ = (∑ i ∈ Finset.range n, ‖P.coeff i‖) * R ^ (n - 1) := by -+ simp [Finset.sum_mul] -+ have hsum_le : (∑ i ∈ Finset.range n, ‖P.coeff i‖) ≤ S := by -+ simp [S] -+ calc -+ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ -+ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ := h1 -+ _ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1) := h2 -+ _ = (∑ i ∈ Finset.range n, ‖P.coeff i‖) * R ^ (n - 1) := h3 -+ _ ≤ S * R ^ (n - 1) := by -+ exact mul_le_mul_of_nonneg_right hsum_le (pow_nonneg hR_nonneg _) -+ have h_lead_re : (P.coeff n * z ^ n).re = ‖a‖ * R ^ n := by -+ have hw_pow : w ^ n = wtarget := hw -+ have ha_mul : a * w ^ n = (‖a‖ : ℂ) := by -+ have : a * w ^ n = a * wtarget := by simp [hw_pow] -+ simpa [wtarget, a] using (this.trans (mul_conj_div_norm a ha)) -+ have hz_pow : z ^ n = ((R : ℂ) ^ n) * (w ^ n) := by -+ simp [z, mul_pow, mul_comm] -+ have hcoeffn : P.coeff n = a := by simp [a, n, Polynomial.coeff_natDegree] -+ have hreR : ∀ m : ℕ, (((R : ℂ) ^ m).re) = R ^ m := by -+ intro m -+ induction m with -+ | zero => simp -+ | succ m ih => -+ simp [pow_succ, ih, Complex.mul_re] -+ calc -+ (P.coeff n * z ^ n).re -+ = (a * z ^ n).re := by simp [hcoeffn] -+ _ = (a * (((R : ℂ) ^ n) * (w ^ n))).re := by simp [hz_pow] -+ _ = (((R : ℂ) ^ n) * (a * (w ^ n))).re := by -+ ring_nf -+ _ = (((R : ℂ) ^ n) * (‖a‖ : ℂ)).re := by simp [ha_mul] -+ _ = (((R : ℂ) ^ n).re) * ‖a‖ := by -+ simp [Complex.mul_re] -+ _ = (R ^ n) * ‖a‖ := by simp [hreR n] -+ _ = ‖a‖ * R ^ n := by ring -+ refine ⟨z, hz_norm, ?_⟩ -+ have hre_lower : (∑ i ∈ Finset.range n, P.coeff i * z ^ i).re -+ ≥ -‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := by -+ have habs : |(∑ i ∈ Finset.range n, P.coeff i * z ^ i).re| -+ ≤ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := -+ Complex.abs_re_le_norm _ -+ have := neg_le_of_abs_le habs -+ simpa using this -+ have hre_main : -+ (P.eval z).re ≥ (P.coeff n * z ^ n).re - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := by -+ have : (P.eval z).re = -+ (∑ i ∈ Finset.range n, P.coeff i * z ^ i).re + (P.coeff n * z ^ n).re := by -+ simp [h_eval, add_comm] -+ linarith [this, hre_lower] -+ have hR_ge_R0 : R0 ≤ R := hR -+ have hR_ge : 2 * S / ‖a‖ ≤ R := le_trans (le_max_right _ _) hR_ge_R0 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR_ge1 -+ have hR_nonneg' : 0 ≤ R := le_of_lt hRpos -+ have hn_ge1 : 1 ≤ n := Nat.succ_le_of_lt hn0 -+ have hlower_le : S * R ^ (n - 1) ≤ (‖a‖ / 2) * R ^ n := by -+ have ha_pos : 0 < ‖a‖ := hnorm_a_pos -+ have hS_le : S ≤ (‖a‖ / 2) * R := by -+ have : 2 * S ≤ ‖a‖ * R := by -+ have := (mul_le_mul_of_nonneg_left hR_ge (by linarith [ha_pos.le] : (0 : ℝ) ≤ ‖a‖)) -+ have hne : (‖a‖ : ℝ) ≠ 0 := ne_of_gt ha_pos -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm, hne] using this -+ have : S ≤ (‖a‖ * R) / 2 := by linarith -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using this -+ have : S * R ^ (n - 1) ≤ (‖a‖ / 2) * R * R ^ (n - 1) := by -+ have hpow_nonneg : 0 ≤ R ^ (n - 1) := pow_nonneg hR_nonneg' _ -+ exact mul_le_mul_of_nonneg_right hS_le hpow_nonneg -+ have hRR : R * R ^ (n - 1) = R ^ n := by -+ have : n = (n - 1) + 1 := by -+ exact (Nat.sub_add_cancel hn_ge1).symm -+ rw [this, pow_succ] -+ ring_nf; grind -+ simpa [mul_assoc, hRR] using this -+ have hfinal_re : -+ (‖a‖ / 2) * R ^ n ≤ (P.eval z).re := by -+ have hlower' : ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ (‖a‖ / 2) * R ^ n := by -+ exact h_lower_norm.trans hlower_le -+ have hlead : (P.coeff n * z ^ n).re = ‖a‖ * R ^ n := by simpa [a] using h_lead_re -+ have hre_main' : -+ (‖a‖ * R ^ n) - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ (P.eval z).re := by -+ simpa [hlead] using hre_main -+ have hsub : -+ (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n ≤ -+ (‖a‖ * R ^ n) - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := -+ sub_le_sub_left hlower' (‖a‖ * R ^ n) -+ have hsim : (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n = (‖a‖ / 2) * R ^ n := by ring -+ have : (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n ≤ (P.eval z).re := -+ hsub.trans hre_main' -+ simpa [hsim] using this -+ simpa [a, n] using hfinal_re -+ -+theorem natDegree_le_floor_of_growth_exp_eval -+ {ρ : ℝ} (hρ : 0 ≤ ρ) (P : Polynomial ℂ) -+ (hgrowth : -+ ∃ C > 0, ∀ z : ℂ, -+ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ ρ) : -+ P.natDegree ≤ Nat.floor ρ := by -+ classical -+ by_cases hdeg : P.natDegree = 0 -+ · simp [hdeg] -+ · have hnpos : 0 < P.natDegree := Nat.pos_of_ne_zero hdeg -+ rcases exists_z_norm_eq_re_eval_ge (P := P) hnpos with ⟨R0, hR0pos, hray⟩ -+ rcases hgrowth with ⟨C, hCpos, hC⟩ -+ have hLCpos : 0 < ‖P.leadingCoeff‖ := by -+ have hP0 : P ≠ 0 := by -+ intro h0 -+ simp [h0] at hdeg -+ have : P.leadingCoeff ≠ 0 := (Polynomial.leadingCoeff_ne_zero).2 hP0 -+ exact norm_pos_iff.2 this -+ let c : ℝ := ‖P.leadingCoeff‖ / 2 -+ have hcpos : 0 < c := by -+ have : (0 : ℝ) < (2 : ℝ) := by norm_num -+ exact (div_pos hLCpos this) -+ have hn_le_real : (P.natDegree : ℝ) ≤ ρ := by -+ by_contra hnlt -+ have hnlt' : ρ < (P.natDegree : ℝ) := lt_of_not_ge hnlt -+ let δ : ℝ := (P.natDegree : ℝ) - ρ -+ have hδ : 0 < δ := sub_pos.2 hnlt' -+ let K0 : ℝ := (C * (2 : ℝ) ^ ρ) / c -+ have hK0 : ∃ R1, ∀ R ≥ R1, K0 + 1 ≤ R ^ δ := by -+ have h : ∀ᶠ R in (atTop : Filter ℝ), K0 + 1 ≤ R ^ δ := -+ (tendsto_atTop.mp (tendsto_rpow_atTop hδ)) (K0 + 1) -+ rcases (eventually_atTop.1 h) with ⟨R1, hR1⟩ -+ exact ⟨R1, hR1⟩ -+ rcases hK0 with ⟨R1, hR1⟩ -+ set R : ℝ := max (max R0 1) R1 -+ have hR_ge_R0 : R0 ≤ R := le_trans (le_max_left _ _) (le_max_left _ _) -+ have hR_ge1 : (1 : ℝ) ≤ R := le_trans (le_max_right _ _) (le_max_left _ _) -+ have hR_ge_R1 : R1 ≤ R := le_max_right _ _ -+ have hR_pos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR_ge1 -+ have hRδ : K0 + 1 ≤ R ^ δ := hR1 R hR_ge_R1 -+ rcases hray R hR_ge_R0 with ⟨z, hz_norm, hz_re⟩ -+ have hlog_lower : -+ (P.eval z).re ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := by -+ have hpos : 0 < ‖Complex.exp (Polynomial.eval z P)‖ := by -+ simp -+ have hle : -+ ‖Complex.exp (Polynomial.eval z P)‖ ≤ -+ 1 + ‖Complex.exp (Polynomial.eval z P)‖ := by -+ linarith [norm_nonneg (Complex.exp (Polynomial.eval z P))] -+ have hlog_le : Real.log ‖Complex.exp (Polynomial.eval z P)‖ -+ ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := -+ Real.log_le_log hpos hle -+ have hlog_eq : Real.log ‖Complex.exp (Polynomial.eval z P)‖ = (P.eval z).re := by -+ simp [Complex.norm_exp] -+ simpa [hlog_eq] using hlog_le -+ have hlog_upper : -+ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ ρ := -+ hC z -+ have hmain : c * R ^ (P.natDegree : ℝ) ≤ C * (1 + R) ^ ρ := by -+ have hz_re' : c * R ^ P.natDegree ≤ (P.eval z).re := by -+ simpa [c] using hz_re -+ have hz_re'' : c * R ^ (P.natDegree : ℝ) ≤ (P.eval z).re := by -+ simpa [Real.rpow_natCast, c] using hz_re' -+ have : c * R ^ (P.natDegree : ℝ) ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := -+ hz_re''.trans hlog_lower -+ have : c * R ^ (P.natDegree : ℝ) ≤ C * (1 + ‖z‖) ^ ρ := -+ this.trans hlog_upper -+ simpa [hz_norm] using this -+ have h1R_le : (1 + R : ℝ) ≤ R * 2 := by linarith -+ have hpow1 : (1 + R : ℝ) ^ ρ ≤ (R * 2) ^ ρ := -+ Real.rpow_le_rpow (by linarith [hR_pos.le]) h1R_le hρ -+ have hR2 : (R * 2) ^ ρ = R ^ ρ * (2 : ℝ) ^ ρ := by -+ have hRnonneg : 0 ≤ R := le_of_lt hR_pos -+ have h2nonneg : 0 ≤ (2 : ℝ) := by norm_num -+ simpa [mul_assoc] using (Real.mul_rpow hRnonneg h2nonneg (z := ρ)) -+ have hmain' : c * R ^ (P.natDegree : ℝ) ≤ C * (R ^ ρ * (2 : ℝ) ^ ρ) := by -+ have := le_trans hmain (mul_le_mul_of_nonneg_left hpow1 (le_of_lt hCpos)) -+ simpa [hR2, mul_assoc, mul_left_comm, mul_comm] using this -+ have hRρ_pos : 0 < R ^ ρ := Real.rpow_pos_of_pos hR_pos _ -+ have hRρ_ne : (R ^ ρ : ℝ) ≠ 0 := ne_of_gt hRρ_pos -+ have hdiv : -+ (c * R ^ (P.natDegree : ℝ)) / (R ^ ρ) ≤ C * (2 : ℝ) ^ ρ := by -+ have h := -+ div_le_div_of_nonneg_right hmain' (le_of_lt hRρ_pos) -+ have hRhs : (C * (R ^ ρ * (2 : ℝ) ^ ρ)) / (R ^ ρ) = C * (2 : ℝ) ^ ρ := by -+ field_simp [hRρ_ne] -+ simpa [hRhs, mul_assoc, mul_left_comm, mul_comm] using h -+ have hRsub : R ^ δ = R ^ (P.natDegree : ℝ) / R ^ ρ := by -+ simpa [δ] using (Real.rpow_sub hR_pos (P.natDegree : ℝ) ρ) -+ have hRδ_le : c * (R ^ δ) ≤ C * (2 : ℝ) ^ ρ := by -+ have hLhs : c * (R ^ δ) = (c * R ^ (P.natDegree : ℝ)) / (R ^ ρ) := by -+ simp [hRsub, div_eq_mul_inv, mul_left_comm, mul_comm] -+ simpa [hLhs] using hdiv -+ have hRδ_le' : R ^ δ ≤ K0 := by -+ have : R ^ δ ≤ (C * (2 : ℝ) ^ ρ) / c := by -+ refine (le_div_iff₀ hcpos).2 ?_ -+ simpa [mul_assoc, mul_left_comm, mul_comm] using hRδ_le -+ simpa [K0] using this -+ have : K0 + 1 ≤ K0 := le_trans hRδ (le_trans hRδ_le' (le_rfl)) -+ exact (not_lt_of_ge this) (lt_add_of_pos_right _ (by norm_num : (0 : ℝ) < 1)) -+ exact (Nat.le_floor_iff hρ).2 hn_le_real -+ -+theorem natDegree_le_floor_of_exp_eval_norm_bound {τ : ℝ} (hτ : 0 ≤ τ) (P : Polynomial ℂ) -+ (hbound : -+ ∃ C > 0, ∀ z : ℂ, -+ ‖Complex.exp (Polynomial.eval z P)‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ)) : -+ P.natDegree ≤ Nat.floor τ := by -+ rcases hbound with ⟨C, hCpos, hC⟩ -+ have hlog_growth : -+ ∃ C > 0, ∀ z : ℂ, -+ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ τ := -+ Real.log_growth_of_norm_le_exp_mul_rpow -+ (f := fun z : ℂ => Complex.exp (Polynomial.eval z P)) -+ (r := fun z : ℂ => 1 + ‖z‖) hCpos hτ -+ (fun z => by linarith [norm_nonneg z]) hC -+ exact natDegree_le_floor_of_growth_exp_eval (ρ := τ) hτ P hlog_growth -+ -+end Hadamard -+end Complex -+end -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Factorization.lean b/PrimeNumberTheoremAnd/SiegelZeros/Factorization.lean -new file mode 100644 -index 0000000..8fb7d8e ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/Factorization.lean -@@ -0,0 +1,415 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.DivisorLimits -+ -+namespace SiegelZeros -+ -+section -+namespace Complex.Hadamard -+ -+open Filter Topology Set _root_.SiegelZeros.Complex -+ -+open scoped BigOperators Topology -+ -+noncomputable def hadamardDenom (m : ℕ) (f : ℂ → ℂ) (z : ℂ) : ℂ := -+ z ^ (analyticOrderNatAt f 0) * divisorCanonicalProduct m f (Set.univ : Set ℂ) z -+ -+theorem differentiable_divisorCanonicalProduct_univ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by -+ intro z -+ have hdiffOn : -+ DifferentiableOn ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) (Set.univ : Set ℂ) := -+ differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ exact (hdiffOn z (by simp)).differentiableAt (by simp) -+ -+theorem analyticAt_divisorCanonicalProduct_univ (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : -+ AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := -+ (differentiable_divisorCanonicalProduct_univ m f h_sum).analyticAt z -+ -+theorem differentiable_hadamardDenom (m : ℕ) (f : ℂ → ℂ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ Differentiable ℂ (hadamardDenom m f) := by -+ have hcprod : Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by -+ exact differentiable_divisorCanonicalProduct_univ m f h_sum -+ simpa [hadamardDenom] using! (differentiable_id.pow (analyticOrderNatAt f 0)).mul hcprod -+ -+theorem hadamardDenom_ne_zero_at {m : ℕ} {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (hnot : ∃ z : ℂ, f z ≠ 0) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) {z : ℂ} (hz : f z ≠ 0) : hadamardDenom m f z ≠ 0 := by -+ have hf_not_top : ∀ w : ℂ, analyticOrderAt f w ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hf) hnot -+ have han_f : AnalyticAt ℂ f z := hf.analyticAt z -+ have horder_f : analyticOrderNatAt f z = 0 := by -+ have : analyticOrderAt f z = 0 := (han_f.analyticOrderAt_eq_zero).2 hz -+ have hcast : (analyticOrderNatAt f z : ℕ∞) = analyticOrderAt f z := -+ Nat.cast_analyticOrderNatAt (f := f) (z₀ := z) (hf_not_top z) -+ have : (analyticOrderNatAt f z : ℕ∞) = 0 := by simp [hcast, this] -+ exact_mod_cast this -+ have han_cprod : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by -+ exact analyticAt_divisorCanonicalProduct_univ m f h_sum z -+ by_cases hz0 : z = 0 -+ · subst hz0 -+ have hord0 : analyticOrderNatAt f 0 = 0 := by simpa using horder_f -+ simp [hadamardDenom, hord0, divisorCanonicalProduct_zero] -+ · have hp : z ^ (analyticOrderNatAt f 0) ≠ 0 := pow_ne_zero _ hz0 -+ have hcprod_order : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = 0 := by -+ simpa [horder_f] using -+ (analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt (m := m) (hf := hf) -+ (h_sum := h_sum) (z₀ := z) hz0) -+ have hcprod_ne : divisorCanonicalProduct m f (Set.univ : Set ℂ) z ≠ 0 := by -+ have hcprod_entire : -+ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by -+ exact differentiable_divisorCanonicalProduct_univ m f h_sum -+ have hcprod_not_top : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hcprod_entire) -+ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ z -+ have hcprod_cast : -+ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z : ℕ∞) = -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := -+ Nat.cast_analyticOrderNatAt -+ (f := divisorCanonicalProduct m f (Set.univ : Set ℂ)) (z₀ := z) hcprod_not_top -+ have : analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = 0 := by -+ have : -+ (analyticOrderNatAt -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z : ℕ∞) = 0 := by -+ exact_mod_cast hcprod_order -+ simp [hcprod_cast] at this -+ simpa using this -+ exact (han_cprod.analyticOrderAt_eq_zero).1 this -+ exact mul_ne_zero hp hcprod_ne -+ -+lemma analyticOrderNatAt_divisorCanonicalProduct_zero -+ (m : ℕ) (f : ℂ → ℂ) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := by -+ have hcprod_entire : -+ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by -+ exact differentiable_divisorCanonicalProduct_univ m f h_sum -+ have hcprod_not_top : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hcprod_entire) -+ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ 0 -+ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := -+ hcprod_entire.analyticAt 0 -+ have hcprod0 : divisorCanonicalProduct m f (Set.univ : Set ℂ) 0 ≠ 0 := by -+ simp [divisorCanonicalProduct_zero] -+ have : analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := -+ (hcprodA.analyticOrderAt_eq_zero).2 hcprod0 -+ have hcast : -+ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 : ℕ∞) = -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := -+ Nat.cast_analyticOrderNatAt -+ (f := divisorCanonicalProduct m f (Set.univ : Set ℂ)) (z₀ := (0 : ℂ)) hcprod_not_top -+ have : -+ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 : ℕ∞) = -+ 0 := by -+ simp [hcast, this] -+ exact_mod_cast this -+ -+theorem analyticOrderNatAt_hadamardDenom_eq -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : -+ analyticOrderNatAt (hadamardDenom m f) z = analyticOrderNatAt f z := by -+ by_cases hz0 : z = 0 -+ · subst hz0 -+ have hpowA : AnalyticAt ℂ (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 := by -+ simpa using! (analyticAt_id.pow (analyticOrderNatAt f 0)) -+ have hpow_not_top : -+ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero -+ (hf := (differentiable_id.pow (analyticOrderNatAt f 0))) -+ ⟨1, by simp⟩ 0 -+ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := by -+ exact analyticAt_divisorCanonicalProduct_univ m f h_sum 0 -+ have hcprod0 : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := -+ analyticOrderNatAt_divisorCanonicalProduct_zero (m := m) (f := f) h_sum -+ have hid0 : analyticOrderNatAt (fun z : ℂ => z) 0 = 1 := by -+ have hid_entire : Differentiable ℂ (fun z : ℂ => z) := differentiable_id -+ have hdiv : -+ (MeromorphicOn.divisor (fun z : ℂ => z) (Set.univ : Set ℂ)) 0 = -+ (analyticOrderNatAt (fun z : ℂ => z) 0 : ℤ) := by -+ simpa using -+ (divisor_univ_eq_analyticOrderNatAt_int -+ (f := fun z : ℂ => z) hid_entire 0) -+ have hdiv1 : (MeromorphicOn.divisor (fun z : ℂ => z) (Set.univ : Set ℂ)) 0 = 1 := by -+ simpa using -+ (MeromorphicOn.divisor_sub_const_self (z₀ := (0 : ℂ)) -+ (U := (Set.univ : Set ℂ)) (by simp)) -+ have : (analyticOrderNatAt (fun z : ℂ => z) 0 : ℤ) = 1 := by -+ simpa [hdiv] using hdiv1 -+ exact_mod_cast this -+ have hpow0 : -+ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 = -+ analyticOrderNatAt f 0 := by -+ have hidA : AnalyticAt ℂ (fun z : ℂ => z) 0 := by -+ simpa [id] using! (analyticAt_id : AnalyticAt ℂ (id : ℂ → ℂ) 0) -+ simpa [hid0] using! (analyticOrderNatAt_pow (hf := hidA) (n := analyticOrderNatAt f 0)) -+ have hmul : -+ analyticOrderNatAt (hadamardDenom m f) 0 = -+ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 + -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := by -+ have hcprod_not_top' : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero -+ (hf := differentiable_divisorCanonicalProduct_univ m f h_sum) -+ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ 0 -+ simpa [hadamardDenom] using! -+ analyticOrderNatAt_mul (hf := hpowA) (hg := hcprodA) -+ (hf' := hpow_not_top) (hg' := hcprod_not_top') -+ simp [hmul, hpow0, hcprod0] -+ · have hpowA : AnalyticAt ℂ (fun z : ℂ => z ^ analyticOrderNatAt f 0) z := by -+ simpa using! (analyticAt_id.pow (analyticOrderNatAt f 0)) -+ have hpow_not_top : -+ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero -+ (hf := (differentiable_id.pow (analyticOrderNatAt f 0))) -+ ⟨1, by simp⟩ z -+ have hpow0 : analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z = 0 := by -+ have hz' : (fun z : ℂ => z ^ analyticOrderNatAt f 0) z ≠ 0 := by -+ simp [hz0] -+ have : analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z = 0 := -+ ((hpowA).analyticOrderAt_eq_zero).2 hz' -+ have hcast : (analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z : ℕ∞) = -+ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z := -+ Nat.cast_analyticOrderNatAt -+ (f := fun z : ℂ => z ^ analyticOrderNatAt f 0) (z₀ := z) hpow_not_top -+ have : (analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z : ℕ∞) = 0 := by -+ simp [hcast, this] -+ exact_mod_cast this -+ have hcprod_eq : -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = -+ analyticOrderNatAt f z := -+ analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt -+ (m := m) (hf := hf) (h_sum := h_sum) (z₀ := z) hz0 -+ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by -+ exact analyticAt_divisorCanonicalProduct_univ m f h_sum z -+ have hcprod_not_top : -+ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero -+ (hf := differentiable_divisorCanonicalProduct_univ m f h_sum) -+ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ z -+ have hmul : -+ analyticOrderNatAt (hadamardDenom m f) z = -+ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z + -+ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by -+ simpa [hadamardDenom] using! -+ analyticOrderNatAt_mul (hf := hpowA) (hg := hcprodA) -+ (hf' := hpow_not_top) (hg' := hcprod_not_top) -+ simp [hmul, hpow0, hcprod_eq] -+ -+theorem divisor_hadamardDenom_eq -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) = -+ MeromorphicOn.divisor f (Set.univ : Set ℂ) := by -+ ext z -+ have hden_entire : Differentiable ℂ (hadamardDenom m f) := -+ differentiable_hadamardDenom (m := m) f h_sum -+ have hf_entire : Differentiable ℂ f := hf -+ have hden : -+ (MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ)) z = -+ (analyticOrderNatAt (hadamardDenom m f) z : ℤ) := by -+ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := hadamardDenom m f) hden_entire z) -+ have hfz : -+ (MeromorphicOn.divisor f (Set.univ : Set ℂ)) z = -+ (analyticOrderNatAt f z : ℤ) := by -+ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := f) hf_entire z) -+ simp [hden, hfz, analyticOrderNatAt_hadamardDenom_eq (m := m) (hf := hf) (h_sum := h_sum) z] -+ -+theorem divisor_hadamardQuotient_eq_zero -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ MeromorphicOn.divisor (fun z : ℂ => f z / hadamardDenom m f z) (Set.univ : Set ℂ) = 0 := by -+ have hf_mero : MeromorphicOn f (Set.univ : Set ℂ) := by -+ intro z hz -+ exact (hf.analyticAt z).meromorphicAt -+ have hden_entire : Differentiable ℂ (hadamardDenom m f) := -+ differentiable_hadamardDenom (m := m) f h_sum -+ have hden_mero : MeromorphicOn (hadamardDenom m f) (Set.univ : Set ℂ) := by -+ intro z hz -+ exact (hden_entire.analyticAt z).meromorphicAt -+ rcases hnot with ⟨z1, hz1⟩ -+ have hden1 : hadamardDenom m f z1 ≠ 0 := -+ hadamardDenom_ne_zero_at (m := m) (f := f) hf ⟨z1, hz1⟩ h_sum hz1 -+ have hf_order_ne_top : ∀ z ∈ (Set.univ : Set ℂ), meromorphicOrderAt f z ≠ ⊤ := by -+ intro z hzU -+ have hz1_ne_top : meromorphicOrderAt f z1 ≠ ⊤ := by -+ have hfAt : MeromorphicAt f z1 := hf_mero z1 (by simp) -+ have hcont : ContinuousAt f z1 := (hf.differentiableAt).continuousAt -+ have hne_nhds : ∀ᶠ w in 𝓝 z1, f w ≠ 0 := -+ (hcont.ne_iff_eventually_ne continuousAt_const).1 hz1 -+ have hne_nhdsNE : ∀ᶠ w in 𝓝[≠] z1, f w ≠ 0 := -+ eventually_nhdsWithin_of_eventually_nhds hne_nhds -+ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hfAt)).2 hne_nhdsNE -+ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hf_mero) -+ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top -+ have hden_order_ne_top : -+ ∀ z ∈ (Set.univ : Set ℂ), meromorphicOrderAt (hadamardDenom m f) z ≠ ⊤ := by -+ intro z hzU -+ have hz1_ne_top : meromorphicOrderAt (hadamardDenom m f) z1 ≠ ⊤ := by -+ have hdenAt : MeromorphicAt (hadamardDenom m f) z1 := hden_mero z1 (by simp) -+ have hcont : ContinuousAt (hadamardDenom m f) z1 := -+ (hden_entire.differentiableAt).continuousAt -+ have hne_nhds : ∀ᶠ w in 𝓝 z1, hadamardDenom m f w ≠ 0 := -+ (hcont.ne_iff_eventually_ne continuousAt_const).1 hden1 -+ have hne_nhdsNE : ∀ᶠ w in 𝓝[≠] z1, hadamardDenom m f w ≠ 0 := -+ eventually_nhdsWithin_of_eventually_nhds hne_nhds -+ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hdenAt)).2 hne_nhdsNE -+ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hden_mero) -+ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top -+ have hinv_order_ne_top : -+ ∀ z ∈ (Set.univ : Set ℂ), -+ meromorphicOrderAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z ≠ ⊤ := by -+ intro z hzU -+ have hinv_mero : -+ MeromorphicOn (fun z : ℂ => (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := -+ hden_mero.inv -+ have hz1_ne_top : -+ meromorphicOrderAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 ≠ ⊤ := by -+ have hinvAt : MeromorphicAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 := -+ hinv_mero z1 (by simp) -+ have hcont_denom : ContinuousAt (hadamardDenom m f) z1 := -+ (hden_entire.differentiableAt).continuousAt -+ have hcont : ContinuousAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 := -+ hcont_denom.inv₀ hden1 -+ have hinv1 : (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 ≠ 0 := by -+ simpa using inv_ne_zero hden1 -+ have hne_nhds : -+ ∀ᶠ w in 𝓝 z1, (fun z : ℂ => (hadamardDenom m f z)⁻¹) w ≠ 0 := -+ (hcont.ne_iff_eventually_ne continuousAt_const).1 hinv1 -+ have hne_nhdsNE : -+ ∀ᶠ w in 𝓝[≠] z1, (fun z : ℂ => (hadamardDenom m f z)⁻¹) w ≠ 0 := -+ eventually_nhdsWithin_of_eventually_nhds hne_nhds -+ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hinvAt)).2 hne_nhdsNE -+ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hinv_mero) -+ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top -+ have hdiv_denom : MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) = -+ MeromorphicOn.divisor f (Set.univ : Set ℂ) := -+ divisor_hadamardDenom_eq (m := m) (hf := hf) (h_sum := h_sum) -+ calc -+ MeromorphicOn.divisor (fun z : ℂ => f z / hadamardDenom m f z) (Set.univ : Set ℂ) -+ = MeromorphicOn.divisor -+ (fun z : ℂ => f z * (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := by -+ simp [div_eq_mul_inv] -+ _ = MeromorphicOn.divisor f (Set.univ : Set ℂ) + -+ MeromorphicOn.divisor (fun z : ℂ => (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := by -+ simpa using (MeromorphicOn.divisor_fun_mul (U := (Set.univ : Set ℂ)) -+ (f₁ := f) (f₂ := fun z => (hadamardDenom m f z)⁻¹) hf_mero (hden_mero.inv) -+ hf_order_ne_top hinv_order_ne_top) -+ _ = MeromorphicOn.divisor f (Set.univ : Set ℂ) - -+ MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) := by -+ simp [sub_eq_add_neg] -+ _ = 0 := by -+ simp [hdiv_denom] -+ -+theorem exists_entire_nonzero_hadamardQuotient -+ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : -+ ∃ H : ℂ → ℂ, Differentiable ℂ H ∧ (∀ z, H z ≠ 0) ∧ ∀ z : ℂ, f z = -+ H z * z ^ (analyticOrderNatAt f 0) * divisorCanonicalProduct m f (Set.univ : Set ℂ) z := by -+ let denom : ℂ → ℂ := hadamardDenom m f -+ let q : ℂ → ℂ := fun z => f z / denom z -+ have hden_entire : Differentiable ℂ denom := -+ differentiable_hadamardDenom (m := m) f h_sum -+ have hq_mero : MeromorphicOn q (Set.univ : Set ℂ) := by -+ intro z hzU -+ have hf_m : MeromorphicAt f z := (hf.analyticAt z).meromorphicAt -+ have hden_m : MeromorphicAt denom z := (hden_entire.analyticAt z).meromorphicAt -+ simpa [q, denom, div_eq_mul_inv] using! (hf_m.mul hden_m.inv) -+ let H : ℂ → ℂ := toMeromorphicNFOn q (Set.univ : Set ℂ) -+ have hNF : MeromorphicNFOn H (Set.univ : Set ℂ) := -+ meromorphicNFOn_toMeromorphicNFOn q (Set.univ : Set ℂ) -+ have hdivH : MeromorphicOn.divisor H (Set.univ : Set ℂ) = 0 := by -+ have hdivq : MeromorphicOn.divisor q (Set.univ : Set ℂ) = 0 := -+ divisor_hadamardQuotient_eq_zero (m := m) (f := f) (hf := hf) -+ (hnot := hnot) (h_sum := h_sum) -+ simpa [H, hdivq] using -+ (MeromorphicOn.divisor_of_toMeromorphicNFOn -+ (f := q) (U := (Set.univ : Set ℂ)) hq_mero) -+ have hA : AnalyticOnNhd ℂ H (Set.univ : Set ℂ) := by -+ have : -+ (0 : Function.locallyFinsuppWithin (Set.univ : Set ℂ) ℤ) ≤ -+ MeromorphicOn.divisor H (Set.univ : Set ℂ) := by -+ simp [hdivH] -+ exact (MeromorphicNFOn.divisor_nonneg_iff_analyticOnNhd (h₁f := hNF)).1 (by simp [hdivH]) -+ have hH_entire : Differentiable ℂ H := by -+ intro z -+ exact (hA z (by simp)).differentiableAt -+ rcases hnot with ⟨z1, hz1⟩ -+ have hden1 : denom z1 ≠ 0 := -+ hadamardDenom_ne_zero_at (m := m) (f := f) hf ⟨z1, hz1⟩ h_sum hz1 -+ have hqA1 : AnalyticAt ℂ q z1 := by -+ have hdenA1 : AnalyticAt ℂ denom z1 := hden_entire.analyticAt z1 -+ exact (hf.analyticAt z1).div hdenA1 hden1 -+ have hqNF1 : MeromorphicNFAt q z1 := hqA1.meromorphicNFAt -+ have htoEq : toMeromorphicNFAt q z1 = q := (toMeromorphicNFAt_eq_self (f := q) (x := z1)).2 hqNF1 -+ have hH1 : H z1 = q z1 := by -+ have hx : z1 ∈ (Set.univ : Set ℂ) := by simp -+ have : toMeromorphicNFOn q (Set.univ : Set ℂ) z1 = toMeromorphicNFAt q z1 z1 := -+ (toMeromorphicNFOn_eq_toMeromorphicNFAt (f := q) (U := (Set.univ : Set ℂ)) hq_mero hx) -+ simpa [H, htoEq] using this -+ have hH1_ne : H z1 ≠ 0 := by -+ have : q z1 ≠ 0 := div_ne_zero hz1 hden1 -+ simpa [hH1] using this -+ have hH_not_top : ∀ z : ℂ, analyticOrderAt H z ≠ ⊤ := by -+ exact analyticOrderAt_ne_top_of_exists_ne_zero (hf := hH_entire) ⟨z1, hH1_ne⟩ -+ have hH_orderNat_zero : ∀ z : ℂ, analyticOrderNatAt H z = 0 := by -+ intro z -+ have hzdiv : -+ (MeromorphicOn.divisor H (Set.univ : Set ℂ)) z = (analyticOrderNatAt H z : ℤ) := by -+ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := H) hH_entire z) -+ have : (MeromorphicOn.divisor H (Set.univ : Set ℂ)) z = 0 := by -+ simp [hdivH] -+ have : (analyticOrderNatAt H z : ℤ) = 0 := by simpa [hzdiv] using this -+ exact_mod_cast this -+ have hH_ne : ∀ z : ℂ, H z ≠ 0 := by -+ intro z -+ have hcast : (analyticOrderNatAt H z : ℕ∞) = analyticOrderAt H z := -+ Nat.cast_analyticOrderNatAt (f := H) (z₀ := z) (hH_not_top z) -+ have : analyticOrderAt H z = 0 := by -+ have : (analyticOrderNatAt H z : ℕ∞) = 0 := by exact_mod_cast (hH_orderNat_zero z) -+ simpa [hcast] using this -+ exact ((hA z (by simp)).analyticOrderAt_eq_zero).1 this -+ have hfA : AnalyticOnNhd ℂ f (Set.univ : Set ℂ) := fun z hzU => hf.analyticAt z -+ have hdenA : AnalyticOnNhd ℂ denom (Set.univ : Set ℂ) := fun z hzU => hden_entire.analyticAt z -+ have hprodA : AnalyticOnNhd ℂ (fun z => H z * denom z) (Set.univ : Set ℂ) := -+ (hA.mul hdenA) -+ have hlocal : f =ᶠ[𝓝 z1] fun z => H z * denom z := by -+ have hden_ne : ∀ᶠ z in 𝓝 z1, denom z ≠ 0 := -+ (hden_entire.differentiableAt.continuousAt.ne_iff_eventually_ne continuousAt_const).1 hden1 -+ have hH_eq_q : H =ᶠ[𝓝 z1] q := by -+ have hx : z1 ∈ (Set.univ : Set ℂ) := by simp -+ have hloc : -+ toMeromorphicNFOn q (Set.univ : Set ℂ) =ᶠ[𝓝 z1] toMeromorphicNFAt q z1 := by -+ simpa [H] using (toMeromorphicNFOn_eq_toMeromorphicNFAt_on_nhds (f := q) -+ (U := (Set.univ : Set ℂ)) hq_mero hx) -+ simpa [H, htoEq] using hloc -+ filter_upwards [hden_ne, hH_eq_q] with z hzden hHz -+ have hcancel : q z * denom z = f z := by -+ dsimp [q] -+ field_simp [hzden] -+ calc -+ f z = q z * denom z := hcancel.symm -+ _ = H z * denom z := by simp [hHz] -+ have hglob : f = fun z => H z * denom z := -+ AnalyticOnNhd.eq_of_eventuallyEq (hf := hfA) (hg := hprodA) hlocal -+ refine ⟨H, hH_entire, hH_ne, ?_⟩ -+ intro z -+ have hglobz : f z = H z * denom z := congrArg (fun g => g z) hglob -+ simpa [denom, hadamardDenom, mul_assoc, mul_left_comm, mul_comm] using hglobz -+ -+end Complex.Hadamard -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Growth.lean b/PrimeNumberTheoremAnd/SiegelZeros/Growth.lean -new file mode 100644 -index 0000000..99df501 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/Growth.lean -@@ -0,0 +1,439 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.Summability -+import PrimeNumberTheoremAnd.SiegelZeros.Exponential -+ -+namespace SiegelZeros -+ -+section -+noncomputable section -+ -+open Set Filter Asymptotics -+open scoped Topology BigOperators -+ -+namespace Complex.Hadamard -+ -+lemma no_zero_on_sphere_of_norm_image_avoid -+ {f : ℂ → ℂ} (hentire : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ {B r : ℝ} (hrpos : 0 < r) (hr_le_B : r ≤ B) -+ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (hsmall_fin : smallSet.Finite) -+ (hsmallSet : -+ smallSet = {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ B}) -+ (hr_not_bad : -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ r ∉ small.image a) : -+ ∀ u : ℂ, ‖u‖ = r → f u ≠ 0 := by -+ classical -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let bad : Finset ℝ := small.image a -+ have hr_not_bad' : r ∉ bad := by -+ simpa [bad, small, a] using hr_not_bad -+ have hr_not : -+ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖ ≤ B → r ≠ ‖divisorZeroIndex₀Val p‖ := by -+ intro p hpB hEq -+ have hp_small : p ∈ small := by -+ have hp_mem : p ∈ smallSet := by -+ simpa [hsmallSet] using hpB -+ simpa [small] using (hsmall_fin.mem_toFinset.2 hp_mem) -+ have : r ∈ bad := Finset.mem_image.2 ⟨p, hp_small, by simpa [a] using hEq.symm⟩ -+ exact (hr_not_bad' this).elim -+ exact no_zero_on_sphere_of_forall_val_norm_ne (f := f) hentire hnot -+ (B := B) (r := r) hrpos hr_le_B hr_not -+ -+theorem norm_inv_hadamardDenominator_le_exp_on_cartan_circle -+ {f : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} -+ (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) -+ (hτ_nonneg : 0 ≤ τ) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (hsumτ : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : -+ let Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ let Cprod : ℝ := cartanProductConstant m τ Sτ -+ ∀ {R r : ℝ}, 0 < R → 1 ≤ R → R ≤ r → r ≤ 2 * R → -+ ∀ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsmall_fin : smallSet.Finite), -+ smallSet = -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} → -+ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => ‖divisorZeroIndex₀Val p‖ -+ r ∉ small.image a) → -+ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => ‖divisorZeroIndex₀Val p‖ -+ (∑ p ∈ small, (1 : ℝ) * CartanBound.φ (r / a p)) ≤ -+ CartanBound.Cφ * (small.card : ℝ)) → -+ ∀ u : ℂ, ‖u‖ = r → -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ ≤ Real.exp (Cprod * (1 + r) ^ τ) := by -+ classical -+ intro Sτ Cprod R r hRpos hRle hR_le_r hr_le_2R smallSet hsmall_fin -+ hsmallSet hr_not_bad hr_phi u hur -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let bad : Finset ℝ := small.image a -+ have hr_not_bad' : r ∉ bad := by -+ simpa [bad, small, a] using hr_not_bad -+ have hr1 : (1 : ℝ) ≤ r := le_trans hRle hR_le_r -+ have hpow_inv_le1 : ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ ≤ 1 := -+ Complex.norm_inv_pow_le_one_of_one_le_norm u (analyticOrderNatAt f 0) (by simpa [hur] using hr1) -+ let fac : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := -+ fun p => weierstrassFactor m (u / divisorZeroIndex₀Val p) -+ have hloc : -+ HasProdLocallyUniformlyOn -+ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (w : ℂ) => -+ weierstrassFactor m (w / divisorZeroIndex₀Val p)) -+ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) -+ (Set.univ : Set ℂ) := -+ hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum -+ have hprod : -+ HasProd fac (divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := -+ hloc.hasProd (by simp : u ∈ (Set.univ : Set ℂ)) -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ have : DecidablePred (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => p ∈ small) := -+ Classical.decPred _ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if hp : p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ have hterm : ∀ p, ‖(fac p)⁻¹‖ ≤ Real.exp (b p) := by -+ intro p -+ by_cases hp : p ∈ small -+ · have hval_ne : r ≠ ap p := by -+ intro hEq -+ have : r ∈ bad := by -+ refine Finset.mem_image.2 ⟨p, hp, ?_⟩ -+ simp [ap, a, hEq] -+ exact (hr_not_bad' this).elim -+ have hval0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p -+ have hmτ : (m : ℝ) ≤ τ := le_trans hmρ (le_of_lt hτ) -+ have hnear : -+ ‖(weierstrassFactor m (u / divisorZeroIndex₀Val p))⁻¹‖ -+ ≤ Real.exp (CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ)) := by -+ simpa [ap] using -+ (norm_inv_weierstrassFactor_le_exp_near (m := m) (τ := τ) (r := r) -+ (u := u) (a := divisorZeroIndex₀Val p) -+ (hur := hur) (ha := hval0) (hr := by simpa [ap] using hval_ne) hmτ) -+ simpa [fac, b, hp] using hnear -+ · have hlarge : (4 * R : ℝ) < ap p := by -+ have : ¬ap p ≤ 4 * R := by -+ intro hle -+ have : p ∈ small := by -+ have hp_mem : p ∈ smallSet := by -+ simpa [hsmallSet, ap] using hle -+ simpa [small] using (hsmall_fin.mem_toFinset.2 hp_mem) -+ exact hp this -+ exact lt_of_not_ge this -+ have hz' : ‖u / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := -+ norm_div_le_half_of_norm_le_of_two_mul_lt (z := u) (a := divisorZeroIndex₀Val p) -+ (R := 2 * R) (by nlinarith [hRpos]) (by rw [hur]; exact hr_le_2R) -+ (by nlinarith [hlarge]) -+ have hτ_le : τ ≤ (m + 1 : ℝ) := le_of_lt hτ_lt -+ have hfar : -+ ‖(weierstrassFactor m (u / divisorZeroIndex₀Val p))⁻¹‖ ≤ -+ Real.exp ((2 : ℝ) * (r / ap p) ^ τ) := by -+ simpa [ap] using -+ (norm_inv_weierstrassFactor_le_exp_far (m := m) (τ := τ) (r := r) -+ (u := u) (a := divisorZeroIndex₀Val p) -+ (hur := hur) (ha := divisorZeroIndex₀Val_ne_zero p) (hz := hz') hτ_le) -+ simpa [fac, b, hp] using hfar -+ have hb_le : -+ ∀ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)), -+ (∑ p ∈ s, b p) ≤ Cprod * (1 + r) ^ τ := by -+ intro s -+ simpa [small, ap, b, Sτ, Cprod, a, hsmallSet] using -+ (Complex.Hadamard.cartan_sum_majorant_le (f := f) (m := m) (τ := τ) (R := R) (r := r) -+ (hRpos := hRpos) (hrpos := lt_of_lt_of_le hRpos hR_le_r) -+ (hR_le_r := hR_le_r) (hτ_nonneg := hτ_nonneg) -+ (smallSet := smallSet) (hsmall_fin := hsmall_fin) (hsmallSet := hsmallSet) -+ (hsumτ := hsumτ) -+ (hr_phi := by -+ simpa [small, a, one_mul] using hr_phi) -+ s) -+ have hcprod_inv : -+ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ≤ -+ Real.exp (Cprod * (1 + r) ^ τ) := by -+ refine hasProd_norm_inv_le_exp_of_pointwise_le_exp -+ (α := divisorZeroIndex₀ f (Set.univ : Set ℂ)) (fac := fac) -+ (F := divisorCanonicalProduct m f (Set.univ : Set ℂ) u) -+ hprod (b := b) (B := Cprod * (1 + r) ^ τ) ?_ ?_ -+ · exact hterm -+ · intro s -+ exact hb_le s -+ have hmul : -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ = -+ ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ * -+ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ := by -+ simp [mul_inv_rev, mul_comm] -+ rw [hmul] -+ have : -+ ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ * -+ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ ≤ 1 * Real.exp (Cprod * (1 + r) ^ τ) := -+ mul_le_mul hpow_inv_le1 hcprod_inv (by positivity) (by positivity) -+ simpa using this -+ -+theorem hadamardQuotient_norm_le_exp_on_cartan_circle -+ {f H : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} {Cf : ℝ} -+ (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) -+ (hτ_nonneg : 0 ≤ τ) (hentire : Differentiable ℂ f) -+ (hnot : ∃ z : ℂ, f z ≠ 0) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (hsumτ : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) -+ (hf_boundτ : ∀ z : ℂ, ‖f z‖ ≤ Real.exp (Cf * (1 + ‖z‖) ^ τ)) -+ (hfactor : ∀ z : ℂ, -+ f z = -+ H z * z ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) z) : -+ let Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ let Cprod : ℝ := cartanProductConstant m τ Sτ -+ ∀ {R r : ℝ}, 0 < R → 1 ≤ R → R ≤ r → r ≤ 2 * R → 0 < r → -+ ∀ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsmall_fin : smallSet.Finite), -+ smallSet = -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} → -+ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => ‖divisorZeroIndex₀Val p‖ -+ r ∉ small.image a) → -+ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => ‖divisorZeroIndex₀Val p‖ -+ (∑ p ∈ small, (1 : ℝ) * CartanBound.φ (r / a p)) ≤ -+ CartanBound.Cφ * (small.card : ℝ)) → -+ ∀ u : ℂ, ‖u‖ = r → ‖H u‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by -+ classical -+ intro Sτ Cprod R r hRpos hRle hR_le_r hr_le_2R hrpos smallSet hsmall_fin -+ hsmallSet hr_not_bad hr_phi u hur -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let bad : Finset ℝ := small.image a -+ have hr_not_bad' : r ∉ bad := by -+ simpa [bad, small, a] using hr_not_bad -+ have hden_eq : -+ f u = -+ H u * (u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using (hfactor u) -+ have hfu_ne : f u ≠ 0 := by -+ have hr_le_4R : r ≤ 4 * R := by nlinarith [hr_le_2R, hRpos] -+ exact no_zero_on_sphere_of_norm_image_avoid (f := f) hentire hnot -+ (B := 4 * R) (r := r) hrpos hr_le_4R smallSet hsmall_fin hsmallSet -+ (by simpa [small, a] using hr_not_bad) u hur -+ have hden_ne : -+ (u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) ≠ 0 := by -+ intro hden0 -+ have : f u = 0 := by simpa [hden0] using hden_eq -+ exact hfu_ne this -+ have hHu : -+ H u = -+ f u / (u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := by -+ exact eq_div_of_mul_eq hden_ne (Eq.symm hden_eq) -+ have hf_u : ‖f u‖ ≤ Real.exp (Cf * (1 + r) ^ τ) := by -+ simpa [hur] using hf_boundτ u -+ have hden_inv : -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ ≤ Real.exp (Cprod * (1 + r) ^ τ) := by -+ simpa [Sτ, Cprod] using -+ (norm_inv_hadamardDenominator_le_exp_on_cartan_circle -+ (f := f) (ρ := ρ) (τ := τ) (m := m) -+ hmρ hτ hτ_lt hτ_nonneg h_sum hsumτ -+ (R := R) (r := r) hRpos hRle hR_le_r hr_le_2R -+ smallSet hsmall_fin hsmallSet -+ (by simpa [small, a] using hr_not_bad) -+ (by simpa [small, a, one_mul] using hr_phi) -+ u hur) -+ have : -+ ‖H u‖ ≤ -+ ‖f u‖ * -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ := by -+ have : -+ ‖H u‖ = -+ ‖f u / -+ (u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)‖ := by -+ simp [hHu] -+ simp [div_eq_mul_inv, norm_inv, this] -+ have hmul : -+ ‖f u‖ * -+ ‖(u ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ -+ ≤ Real.exp (Cf * (1 + r) ^ τ) * Real.exp (Cprod * (1 + r) ^ τ) := -+ mul_le_mul hf_u hden_inv (by positivity) (by positivity) -+ have hexp : -+ Real.exp (Cf * (1 + r) ^ τ) * Real.exp (Cprod * (1 + r) ^ τ) -+ = Real.exp ((Cf + Cprod) * (1 + r) ^ τ) := by -+ simp [Real.exp_add, add_mul, add_comm] -+ have : ‖H u‖ ≤ Real.exp ((Cf + Cprod) * (1 + r) ^ τ) := -+ (this.trans hmul).trans_eq hexp -+ have hslack : -+ Real.exp ((Cf + Cprod) * (1 + r) ^ τ) ≤ -+ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by -+ refine Real.exp_le_exp.2 ?_ -+ have hnn : 0 ≤ (1 + r) ^ τ := by positivity -+ nlinarith -+ exact this.trans hslack -+ -+theorem hadamardQuotient_norm_le_exp_rpow_of_growth {f H : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} -+ (hρ : 0 ≤ ρ) (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) -+ (hτ_nonneg : 0 ≤ τ) (hentire : Differentiable ℂ f) (hH_entire : Differentiable ℂ H) -+ (hnot : ∃ z : ℂ, f z ≠ 0) -+ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) -+ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) -+ (hfactor : ∀ z : ℂ, -+ f z = -+ H z * z ^ analyticOrderNatAt f 0 * -+ divisorCanonicalProduct m f (Set.univ : Set ℂ) z) : -+ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := by -+ rcases hgrowth with ⟨Cf, hCfpos, hCf⟩ -+ have hsumτ : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := -+ summable_norm_inv_rpow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) (τ := τ) -+ hρ hτ hentire hnot ⟨Cf, hCfpos, hCf⟩ -+ let Sτ : ℝ := ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ have hSτ_nonneg : 0 ≤ Sτ := tsum_nonneg fun _ => -+ Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ -+ let Cprod : ℝ := cartanProductConstant m τ Sτ -+ have hCprod_nonneg : 0 ≤ Cprod := by -+ simpa [Cprod] using cartanProductConstant_nonneg (m := m) (τ := τ) hSτ_nonneg -+ have hf_boundτ : ∀ z : ℂ, ‖f z‖ ≤ Real.exp (Cf * (1 + ‖z‖) ^ τ) := -+ Real.norm_le_exp_mul_rpow_of_log_growth -+ (f := f) (r := fun z : ℂ => 1 + ‖z‖) (C := Cf) (ρ := ρ) (τ := τ) -+ hCfpos.le (fun z => by linarith [norm_nonneg z]) (le_of_lt hτ) hCf -+ refine ⟨(Cf + Cprod + 10) * (3 : ℝ) ^ τ, by -+ have h3τ : 0 < (3 : ℝ) ^ τ := by positivity -+ nlinarith [hCfpos, hCprod_nonneg, h3τ], ?_⟩ -+ intro z -+ let R : ℝ := max ‖z‖ 1 -+ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num) (le_max_right _ _) -+ have hRle : (1 : ℝ) ≤ R := le_max_right _ _ -+ let smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ {p | ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} -+ have hsmall_fin : smallSet.Finite := by -+ have : Metric.closedBall (0 : ℂ) (4 * R) ⊆ (Set.univ : Set ℂ) := by simp -+ simpa [smallSet] using -+ (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) -+ (B := 4 * R) this) -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ have ha_pos : ∀ p ∈ small, 0 < a p := by -+ intro p hp -+ exact norm_pos_iff.2 (divisorZeroIndex₀Val_ne_zero p) -+ let bad : Finset ℝ := small.image a -+ rcases CartanBound.exists_radius_Ioc_sum_mul_phi_div_le_Cφ_mul_sum_avoid -+ (s := small) (w := fun _ => (1 : ℝ)) (a := a) -+ (hw := by intro _ _; norm_num) (ha := ha_pos) (bad := bad) (R := R) hRpos with -+ ⟨r, hr_mem, hr_not_bad, hr_phi⟩ -+ have hR_le_r : R ≤ r := le_of_lt hr_mem.1 -+ have hr_le_2R : r ≤ 2 * R := hr_mem.2 -+ have hrpos : 0 < r := lt_of_lt_of_le hRpos hR_le_r -+ have hcircle : -+ ∀ u : ℂ, ‖u‖ = r → ‖H u‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by -+ simpa [Sτ, Cprod] using -+ (hadamardQuotient_norm_le_exp_on_cartan_circle -+ (f := f) (H := H) (ρ := ρ) (τ := τ) (m := m) (Cf := Cf) -+ hmρ hτ hτ_lt hτ_nonneg hentire hnot h_sum hsumτ hf_boundτ hfactor -+ (R := R) (r := r) hRpos hRle hR_le_r hr_le_2R hrpos -+ smallSet hsmall_fin (by rfl) -+ (by simpa [small, a, bad] using hr_not_bad) -+ (by simpa [small, a, one_mul, Finset.sum_const, nsmul_eq_mul] using hr_phi)) -+ have hz_ball : z ∈ Metric.ball (0 : ℂ) r := by -+ rw [Metric.mem_ball, dist_zero_right] -+ exact lt_of_le_of_lt (le_max_left _ _) hr_mem.1 -+ have hball : -+ ‖H z‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by -+ exact Complex.norm_le_of_mem_ball_of_forall_sphere_norm_le hH_entire hrpos hz_ball hcircle -+ have hr_le_3 : 1 + r ≤ 3 * (1 + ‖z‖) := by -+ exact Real.one_add_le_three_mul_one_add_of_le_two_mul_max (norm_nonneg z) -+ (by simpa [R] using hr_le_2R) -+ have hmain : -+ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) -+ ≤ Real.exp (((Cf + Cprod + 10) * (3 : ℝ) ^ τ) * (1 + ‖z‖) ^ τ) := by -+ have hnn : 0 ≤ (Cf + Cprod + 10) := by nlinarith [le_of_lt hCfpos, hCprod_nonneg] -+ exact Real.exp_mul_rpow_le_exp_mul_rpow_of_le_mul hnn (by norm_num) -+ (by linarith [le_of_lt hrpos]) (by positivity) hτ_nonneg hr_le_3 -+ simpa [mul_assoc] using hball.trans hmain -+ -+theorem hadamard_factorization_of_growth {f : ℂ → ℂ} {ρ : ℝ} (hρ : 0 ≤ ρ) -+ (hentire : Differentiable ℂ f) -+ (hnot : ∃ z : ℂ, f z ≠ 0) -+ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : -+ ∃ (P : Polynomial ℂ), -+ P.degree ≤ Nat.floor ρ ∧ -+ ∀ z : ℂ, -+ f z = -+ Complex.exp (Polynomial.eval z P) * -+ z ^ (analyticOrderNatAt f 0) * -+ divisorCanonicalProduct (Nat.floor ρ) f (Set.univ : Set ℂ) z := by -+ set m : ℕ := Nat.floor ρ -+ have h_sum : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by -+ simpa [m] using -+ (summable_norm_inv_pow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) -+ hρ hentire hnot hgrowth) -+ rcases exists_entire_nonzero_hadamardQuotient (m := m) (f := f) hentire hnot h_sum with -+ ⟨H, hH_entire, hH_ne, hfactor⟩ -+ rcases Real.exists_between_self_and_floor_add_one_same_floor hρ with -+ ⟨τ, hτ, hτ_lt, hτ_nonneg, hfloorτ'⟩ -+ have hfloorτ : Nat.floor τ = m := by -+ simpa [m] using hfloorτ' -+ have hτ_lt_m : τ < (m + 1 : ℝ) := by -+ simpa [m] using hτ_lt -+ have hτ_lt_nat : τ < ((m + 1 : ℕ) : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one] using hτ_lt_m -+ have hmρ : (m : ℝ) ≤ ρ := by -+ have := Nat.floor_le hρ -+ simpa [m] using this -+ have hH_bound_rpow : -+ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := -+ hadamardQuotient_norm_le_exp_rpow_of_growth (f := f) (H := H) (ρ := ρ) (τ := τ) -+ (m := m) hρ hmρ hτ hτ_lt hτ_nonneg hentire hH_entire hnot h_sum hgrowth hfactor -+ have hH_growth_nat : -+ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ (m + 1)) := by -+ exact Real.exists_norm_le_exp_mul_pow_of_rpow_bound -+ (f := H) (r := fun z : ℂ => 1 + ‖z‖) -+ (fun z => by linarith [norm_nonneg z]) hτ_lt_nat hH_bound_rpow -+ rcases zero_free_polynomial_growth_is_exp_poly (H := H) (n := m + 1) -+ hH_entire hH_ne hH_growth_nat with -+ ⟨P, hPn, hHP⟩ -+ have hPnat : P.natDegree ≤ m := by -+ have hbound : -+ ∃ C > 0, ∀ z : ℂ, -+ ‖Complex.exp (Polynomial.eval z P)‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := by -+ rcases hH_bound_rpow with ⟨C, hCpos, hC⟩ -+ exact ⟨C, hCpos, fun z => by simpa [hHP z] using (hC z)⟩ -+ have := natDegree_le_floor_of_exp_eval_norm_bound hτ_nonneg P hbound -+ simpa [hfloorτ] using this -+ refine ⟨P, ?_, ?_⟩ -+ · have : P.degree ≤ m := Polynomial.degree_le_of_natDegree_le hPnat -+ simpa [m] using this -+ · intro z -+ have hH' : H z = Complex.exp (Polynomial.eval z P) := by simpa using (hHP z) -+ simpa [hH', mul_assoc, mul_left_comm, mul_comm, m] using (hfactor z) -+ -+end Complex.Hadamard -+end -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/HadamardSupport.lean b/PrimeNumberTheoremAnd/SiegelZeros/HadamardSupport.lean -new file mode 100644 -index 0000000..7ec52e3 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/HadamardSupport.lean -@@ -0,0 +1 @@ -+import PrimeNumberTheoremAnd.SiegelZeros.Growth -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/NOTICE.md b/PrimeNumberTheoremAnd/SiegelZeros/NOTICE.md -new file mode 100644 -index 0000000..a3e10f6 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/NOTICE.md -@@ -0,0 +1,15 @@ -+# Captured support notices -+ -+The mathematical support is derived from PrimeNumberTheoremAnd. Its existing repository license remains applicable. Original retained notices follow. -+ -+/- -+Copyright (c) 2026 Matteo Cipollina. All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Matteo Cipollina -+-/ -+ -+/- -+Copyright (c) 2025 Stefan Kebekus. All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Stefan Kebekus, Matteo Cipollina -+-/ -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/ProductBounds.lean b/PrimeNumberTheoremAnd/SiegelZeros/ProductBounds.lean -new file mode 100644 -index 0000000..6a2985a ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/ProductBounds.lean -@@ -0,0 +1,724 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.DivisorLimits -+import PrimeNumberTheoremAnd.SiegelZeros.CartanBounds -+ -+namespace SiegelZeros -+ -+section -+noncomputable section -+ -+namespace Complex.Hadamard -+ -+open scoped BigOperators -+open Filter Finset _root_.Real _root_.SiegelZeros.Real Topology -+ -+section CartanFiniteSum -+ -+variable {α : Type*} -+ -+private lemma summable_ite_mem_finset [DecidableEq α] (s : Finset α) (u : α → ℝ) : -+ Summable (fun a => if a ∈ s then u a else 0) := -+ summable_of_ne_finset_zero (s := s) fun a ha => by simp [ite_eq_right ha] -+ -+private lemma tsum_ite_mem_finset [DecidableEq α] (s : Finset α) (u : α → ℝ) : -+ (∑' a, if a ∈ s then u a else 0) = ∑ a ∈ s, u a := by -+ classical -+ simpa [Finset.sum_ite] using -+ (hasSum_sum_of_ne_finset_zero (s := s) (f := fun a => if a ∈ s then u a else 0) -+ fun a ha => by simp [ite_eq_right ha]).tsum_eq -+ -+private lemma tsum_add_four (u₁ u₂ u₃ u₄ : α → ℝ) -+ (h₁ : Summable u₁) (h₂ : Summable u₂) (h₃ : Summable u₃) (h₄ : Summable u₄) : -+ tsum (fun a => ((u₁ a + u₂ a) + u₃ a) + u₄ a) -+ = tsum u₁ + tsum u₂ + tsum u₃ + tsum u₄ := by -+ calc -+ tsum (fun a => ((u₁ a + u₂ a) + u₃ a) + u₄ a) -+ = tsum (fun a => (u₁ a + u₂ a) + (u₃ a + u₄ a)) := by -+ simp [add_comm, add_left_comm] -+ _ = tsum (fun a => u₁ a + u₂ a) + tsum (fun a => u₃ a + u₄ a) := -+ Summable.tsum_add (h₁.add h₂) (h₃.add h₄) -+ _ = tsum u₁ + tsum u₂ + tsum u₃ + tsum u₄ := by -+ rw [Summable.tsum_add h₁ h₂, Summable.tsum_add h₃ h₄] -+ ring -+ -+end CartanFiniteSum -+ -+noncomputable def cartanProductConstant (m : ℕ) (τ Sτ : ℝ) : ℝ := -+ ((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 3) * (Sτ + 1) -+ -+lemma cartanProductConstant_nonneg {m : ℕ} {τ Sτ : ℝ} (hSτ : 0 ≤ Sτ) : -+ 0 ≤ cartanProductConstant m τ Sτ := by -+ have hS : 0 ≤ Sτ + 1 := by linarith -+ have hA : 0 ≤ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 3 := by -+ have hCφ : 0 ≤ CartanBound.Cφ := le_of_lt CartanBound.Cφ_pos -+ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ have h4τ : 0 ≤ (4 : ℝ) ^ τ := by positivity -+ nlinarith [hCφ, hm0, h4τ] -+ simpa [cartanProductConstant] using mul_nonneg hA hS -+ -+lemma rpow_div_norm_divisorZeroIndex₀_eq -+ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) -+ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : -+ (r / ‖divisorZeroIndex₀Val p‖) ^ τ = -+ (r ^ τ) * ((‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) := by -+ have hp : 0 ≤ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) := by positivity -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using -+ (Real.mul_rpow (x := r) (y := (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ)) (z := τ) hr hp) -+ -+lemma tsum_rpow_div_norm_divisorZeroIndex₀_eq -+ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ = (r ^ τ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ calc -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ = ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by -+ refine tsum_congr ?_ -+ intro p -+ exact rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p -+ _ = (r ^ τ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ simp [tsum_mul_left] -+ -+lemma tsum_two_mul_rpow_div_norm_divisorZeroIndex₀_le -+ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) (hτ_nonneg : 0 ≤ τ) : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ ≤ (2 : ℝ) * ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) * (1 + r) ^ τ := by -+ set Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ have htsum : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ = (2 : ℝ) * (r ^ τ) * Sτ := by -+ calc -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ = (2 : ℝ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ (r / ‖divisorZeroIndex₀Val p‖) ^ τ := by -+ simp [tsum_mul_left] -+ _ = (2 : ℝ) * ((r ^ τ) * Sτ) := by -+ rw [tsum_rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr] -+ _ = (2 : ℝ) * (r ^ τ) * Sτ := by ring -+ have hSτ_nonneg : 0 ≤ Sτ := -+ tsum_nonneg (fun _ => Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _) -+ have h1r : r ^ τ ≤ (1 + r) ^ τ := -+ Real.rpow_le_rpow (by positivity) (by linarith) hτ_nonneg -+ have hS : Sτ ≤ Sτ + 1 := by linarith -+ have hle : (r ^ τ) * Sτ ≤ (1 + r) ^ τ * (Sτ + 1) := -+ mul_le_mul h1r hS (by linarith) (by positivity) -+ rw [htsum] -+ have : (2 : ℝ) * (r ^ τ) * Sτ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by -+ nlinarith [hle] -+ simpa [Sτ, mul_assoc, mul_left_comm, mul_comm] using this -+ -+lemma sum_rpow_div_norm_divisorZeroIndex₀_le -+ {f : ℂ → ℂ} {r τ : ℝ} (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hr : 0 ≤ r) (hτ_nonneg : 0 ≤ τ) -+ (hsumτ : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : -+ (∑ p ∈ small, (r / ‖divisorZeroIndex₀Val p‖) ^ τ) -+ ≤ ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) * (1 + r) ^ τ := by -+ set Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ have hsum_inv : -+ (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ≤ Sτ := by -+ have hnn : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ 0 ≤ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by -+ intro p -+ positivity -+ simpa [Sτ] using -+ (Summable.sum_le_tsum (s := small) -+ (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) -+ (fun p _ => hnn p) hsumτ) -+ have hsum_eq : -+ ∑ p ∈ small, (r / ‖divisorZeroIndex₀Val p‖) ^ τ = -+ (r ^ τ) * ∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by -+ simp [rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr, Finset.mul_sum] -+ have h1r : r ^ τ ≤ (1 + r) ^ τ := -+ Real.rpow_le_rpow (by positivity) (by linarith) hτ_nonneg -+ have hS : (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ≤ Sτ + 1 := by -+ linarith [hsum_inv] -+ have hle : -+ (r ^ τ) * (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) -+ ≤ (1 + r) ^ τ * (Sτ + 1) := -+ mul_le_mul h1r hS (by positivity) (by positivity) -+ simpa [Sτ, hsum_eq, mul_assoc, mul_left_comm, mul_comm] using hle -+ -+lemma add_four_le_add_two_mul_of_le {x₁ x₂ x₃ x₄ A B C : ℝ} -+ (h₁ : x₁ ≤ A) (h₂ : x₂ ≤ B) (h₃ : x₃ ≤ B) (h₄ : x₄ ≤ C) : -+ x₁ + x₂ + x₃ + x₄ ≤ A + 2 * B + C := by -+ nlinarith -+ -+lemma cartan_majorant_four_term_bound -+ {xφ x0 xm xt Cφ m q Y T : ℝ} -+ (hφ : xφ ≤ Cφ * q * Y * T) -+ (h0 : x0 ≤ m * q * Y * T) -+ (hm : xm ≤ m * q * Y * T) -+ (ht : xt ≤ (2 : ℝ) * Y * T) : -+ xφ + x0 + xm + xt ≤ (Cφ + (2 : ℝ) * m) * q * Y * T + (2 : ℝ) * Y * T := by -+ have h := -+ add_four_le_add_two_mul_of_le hφ h0 hm ht -+ have hring : -+ Cφ * (q * (Y * T)) + 2 * (m * (q * (Y * T))) + 2 * (Y * T) -+ = (Cφ + (2 : ℝ) * m) * (q * (Y * T)) + (2 : ℝ) * (Y * T) := by -+ ring -+ simpa [mul_assoc, hring] using h -+ -+lemma cartan_majorant_add_two_factor (A Y T : ℝ) : -+ A * Y * T + (2 : ℝ) * Y * T = ((A + 2) * Y) * T := by -+ ring -+ -+lemma cartan_majorant_pad_two_to_three {A S T : ℝ} (hS : 0 ≤ S + 1) (hT : 0 ≤ T) : -+ ((A + 2) * (S + 1)) * T ≤ ((A + 3) * (S + 1)) * T := by -+ have h : (A + 2) * (S + 1) ≤ (A + 3) * (S + 1) := by -+ nlinarith -+ exact mul_le_mul_of_nonneg_right h hT -+ -+lemma cartan_majorant_nonneg -+ {f : ℂ → ℂ} {m : ℕ} {τ r : ℝ} (hr : 0 ≤ r) -+ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : -+ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ ∀ p, 0 ≤ b p := by -+ classical -+ dsimp -+ intro p -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun q => ‖divisorZeroIndex₀Val q‖ -+ have hap : ap p = ‖divisorZeroIndex₀Val p‖ := rfl -+ by_cases hp : p ∈ small -+ · have hφ : 0 ≤ CartanBound.φ (r / ap p) := CartanBound.φ_nonneg (t := r / ap p) -+ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ have h1 : 0 ≤ (1 + (r / ap p) ^ τ) := by positivity -+ have : 0 ≤ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) := by -+ nlinarith [hφ, hm0, h1] -+ simpa [hap, hp, ap] using this -+ · have hbase : 0 ≤ r / ap p := div_nonneg hr (by positivity) -+ have hpow : 0 ≤ (r / ap p) ^ τ := Real.rpow_nonneg hbase τ -+ have : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := mul_nonneg (by norm_num) hpow -+ simpa [hap, hp, ap] using this -+ -+lemma cartan_majorant_summable -+ {f : ℂ → ℂ} {m : ℕ} {τ r : ℝ} (hr : 0 ≤ r) -+ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsumτ : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : -+ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ Summable b := by -+ classical -+ dsimp -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun q => ‖divisorZeroIndex₀Val q‖ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ have hb : Summable b := by -+ let b₁ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else 0 -+ let b₂ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => if p ∈ small then 0 else (2 : ℝ) * (r / ap p) ^ τ -+ have hb_decomp : b = fun p => b₁ p + b₂ p := by -+ funext p -+ by_cases hp : p ∈ small <;> simp [b, b₁, b₂, hp] -+ have hb₁ : Summable b₁ := by -+ simpa [b₁] using -+ summable_ite_mem_finset small -+ (fun p => CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ)) -+ have hb₂ : Summable b₂ := by -+ have hconst : -+ Summable (fun p => -+ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) := -+ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) -+ refine Summable.of_nonneg_of_le -+ (fun p => by -+ by_cases hp : p ∈ small -+ · simp [b₂, hp] -+ · have : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := by positivity -+ simpa [b₂, hp] using this) -+ (fun p => ?_) hconst -+ by_cases hp : p ∈ small -+ · have : 0 ≤ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by positivity -+ simpa [b₂, hp] using this -+ · have hrpow : (r / ap p) ^ τ = (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by -+ simpa [ap] using rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p -+ simp [b₂, hp, hrpow, mul_assoc, mul_left_comm, mul_comm] -+ simpa [hb_decomp] using hb₁.add hb₂ -+ refine hb.congr ?_ -+ intro p -+ by_cases hp : p ∈ small <;> simp [b, ap, hp] -+ -+lemma cartan_card_small_le -+ {f : ℂ → ℂ} {τ R : ℝ} (hRpos : 0 < R) (hτ_nonneg : 0 ≤ τ) -+ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsmall : ∀ p ∈ small, ‖divisorZeroIndex₀Val p‖ ≤ 4 * R) -+ (hsumτ : -+ Summable -+ (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : -+ (small.card : ℝ) -+ ≤ (4 * R) ^ τ -+ * ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) := by -+ classical -+ set Sτ : ℝ := -+ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ have hsum_le : (∑ p ∈ small, ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) ≤ Sτ := by -+ have hnn : -+ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ 0 ≤ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ intro p -+ exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ -+ simpa [Sτ] using -+ (Summable.sum_le_tsum (s := small) -+ (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) -+ (fun p _ => hnn p) hsumτ) -+ have hgeom_sum : -+ (small.card : ℝ) ≤ ∑ p ∈ small, (4 * R) ^ τ * ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ have hcard_eq : (small.card : ℝ) = ∑ p ∈ small, (1 : ℝ) := by simp -+ rw [hcard_eq] -+ refine Finset.sum_le_sum (fun p hp => ?_) -+ have hp_le : ‖divisorZeroIndex₀Val p‖ ≤ 4 * R := hsmall p hp -+ have hap : 0 < ‖divisorZeroIndex₀Val p‖ := -+ norm_pos_iff.2 (divisorZeroIndex₀Val_ne_zero p) -+ have hbase : (1 : ℝ) ≤ (4 * R) / ‖divisorZeroIndex₀Val p‖ := by -+ exact (le_div_iff₀ hap).2 (by simpa [mul_one] using hp_le) -+ have : (1 : ℝ) ≤ ((4 * R) / ‖divisorZeroIndex₀Val p‖) ^ τ := -+ Real.one_le_rpow hbase hτ_nonneg -+ have hdiv : -+ ((4 * R) / ‖divisorZeroIndex₀Val p‖) ^ τ = -+ (4 * R) ^ τ * (‖divisorZeroIndex₀Val p‖)⁻¹ ^ τ := by -+ have h4 : 0 ≤ (4 * R : ℝ) := by nlinarith [le_of_lt hRpos] -+ have ha : 0 ≤ (‖divisorZeroIndex₀Val p‖ : ℝ)⁻¹ := by positivity -+ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using -+ (Real.mul_rpow (x := (4 * R : ℝ)) -+ (y := (‖divisorZeroIndex₀Val p‖ : ℝ)⁻¹) (z := τ) h4 ha) -+ have : (1 : ℝ) ≤ (4 * R) ^ τ * ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ simpa [hdiv] using this -+ exact this -+ have hgeom : -+ (small.card : ℝ) ≤ (4 * R) ^ τ * (∑ p ∈ small, ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by -+ simpa [Finset.mul_sum] using hgeom_sum -+ have hsmall_le : (small.card : ℝ) ≤ (4 * R) ^ τ * Sτ := by -+ exact hgeom.trans (mul_le_mul_of_nonneg_left hsum_le (by positivity)) -+ have hS_le : (4 * R) ^ τ * Sτ ≤ (4 * R) ^ τ * (Sτ + 1) := by -+ refine mul_le_mul_of_nonneg_left ?_ (by positivity) -+ linarith -+ have : (small.card : ℝ) ≤ (4 * R) ^ τ * (Sτ + 1) := hsmall_le.trans hS_le -+ simpa [Sτ, add_comm, add_left_comm, add_assoc, mul_assoc] using this -+ -+lemma cartan_rpow_mul_le -+ {τ R r : ℝ} (hRpos : 0 < R) (hrpos : 0 < r) (hR_le_r : R ≤ r) (hτ_nonneg : 0 ≤ τ) : -+ (4 * R) ^ τ ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ := by -+ have hR_le_1r : R ≤ 1 + r := by linarith [hR_le_r, le_of_lt hrpos] -+ have hbase0 : 0 ≤ (4 * R : ℝ) := by nlinarith [le_of_lt hRpos] -+ have : (4 * R) ^ τ ≤ (4 * (1 + r)) ^ τ := by -+ refine Real.rpow_le_rpow hbase0 ?_ hτ_nonneg -+ nlinarith [hR_le_1r] -+ have hmul : (4 * (1 + r)) ^ τ = (4 : ℝ) ^ τ * (1 + r) ^ τ := by -+ have h4 : 0 ≤ (4 : ℝ) := by norm_num -+ have h1 : 0 ≤ (1 + r : ℝ) := by positivity -+ simpa [mul_assoc] using -+ (Real.mul_rpow (x := (4 : ℝ)) (y := (1 + r : ℝ)) (z := τ) h4 h1) -+ simpa [hmul] using this -+ -+open Classical in -+theorem cartan_sum_majorant_le -+ {f : ℂ → ℂ} {m : ℕ} {τ R r : ℝ} -+ (hRpos : 0 < R) -+ (hrpos : 0 < r) -+ (hR_le_r : R ≤ r) -+ (hτ_nonneg : 0 ≤ τ) -+ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) -+ (hsmall_fin : smallSet.Finite) -+ (hsmallSet : -+ smallSet = {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 4 * R}) -+ (hsumτ : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) -+ (hr_phi : -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ (∑ p ∈ small, CartanBound.φ (r / a p)) ≤ CartanBound.Cφ * (small.card : ℝ)) : -+ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset -+ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ -+ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ -+ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => -+ if p ∈ small then -+ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) -+ else -+ (2 : ℝ) * (r / ap p) ^ τ -+ let Sτ : ℝ := ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ -+ let Cprod : ℝ := cartanProductConstant m τ Sτ -+ ∀ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)), -+ (∑ p ∈ s, b p) ≤ Cprod * (1 + r) ^ τ := by -+ classical -+ intro small ap b Sτ Cprod s -+ have hr : 0 ≤ r := le_of_lt hrpos -+ have hSτ_nonneg : 0 ≤ Sτ := -+ tsum_nonneg (fun _ => Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _) -+ have hsmall_mem : ∀ p, p ∈ small ↔ p ∈ smallSet := by -+ intro p -+ simp [small, hsmall_fin.mem_toFinset] -+ have hphi_sum : -+ (∑ p ∈ small, CartanBound.φ (r / ap p)) ≤ CartanBound.Cφ * (small.card : ℝ) := by -+ simpa [small, ap] using hr_phi -+ have hb_nonneg : ∀ p, 0 ≤ b p := by -+ simpa [ap, b] using (cartan_majorant_nonneg (f := f) (m := m) (τ := τ) (r := r) hr small) -+ have hb_summable : Summable b := by -+ simpa [ap, b] using -+ (cartan_majorant_summable (f := f) (m := m) (τ := τ) (r := r) hr small hsumτ) -+ have hsmall_norm : ∀ p ∈ small, ‖divisorZeroIndex₀Val p‖ ≤ 4 * R := by -+ intro p hp -+ have : p ∈ smallSet := (hsmall_mem p).1 hp -+ simpa [hsmallSet] using this -+ have hcard_le : (small.card : ℝ) ≤ (4 * R) ^ τ * (Sτ + 1) := by -+ simpa [Sτ, mul_assoc, add_assoc, add_left_comm, add_comm] using -+ (cartan_card_small_le (f := f) (τ := τ) (R := R) hRpos hτ_nonneg small hsmall_norm hsumτ) -+ have hpowR : (4 * R) ^ τ ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ := -+ cartan_rpow_mul_le (τ := τ) (R := R) (r := r) hRpos hrpos hR_le_r hτ_nonneg -+ have hcard_le' : (small.card : ℝ) ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ * (Sτ + 1) := by -+ have : (4 * R) ^ τ * (Sτ + 1) ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ * (Sτ + 1) := by -+ exact mul_le_mul_of_nonneg_right hpowR (by linarith [hSτ_nonneg]) -+ exact le_trans hcard_le this -+ have hb_tsum_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) ≤ Cprod * (1 + r) ^ τ := by -+ let bφ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => if p ∈ small then CartanBound.φ (r / ap p) else 0 -+ let b0 : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => if p ∈ small then (m : ℝ) else 0 -+ let bmτ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => if p ∈ small then (m : ℝ) * (r / ap p) ^ τ else 0 -+ let bt : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := -+ fun p => (2 : ℝ) * (r / ap p) ^ τ -+ have hb_pointwise : ∀ p, b p ≤ bφ p + b0 p + bmτ p + bt p := by -+ intro p -+ by_cases hp : p ∈ small -+ · have hbase : 0 ≤ r / ap p := div_nonneg hr (by positivity) -+ have hx : 0 ≤ (r / ap p) ^ τ := Real.rpow_nonneg hbase τ -+ have hpos : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := mul_nonneg (by norm_num) hx -+ simp [b, bφ, b0, bmτ, bt, hp] -+ nlinarith -+ · simp [b, bφ, b0, bmτ, bt, hp] -+ have hmaj_summ : Summable (fun p => bφ p + b0 p + bmτ p + bt p) := by -+ have hbφ_summ : Summable bφ := by -+ simpa [bφ] using summable_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) -+ have hb0_summ : Summable b0 := by -+ simpa [b0] using summable_ite_mem_finset small (fun _ => (m : ℝ)) -+ have hbmτ_summ : Summable bmτ := by -+ simpa [bmτ] using summable_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) -+ have hbt_summ : Summable bt := by -+ have hconst : Summable (fun p => -+ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) := -+ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) -+ refine hconst.congr ?_ -+ intro p -+ simp [bt, ap, rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p, -+ mul_assoc, mul_left_comm, mul_comm] -+ have h' : Summable (fun p => bφ p + b0 p + (bmτ p + bt p)) := -+ (hbφ_summ.add hb0_summ).add (hbmτ_summ.add hbt_summ) -+ simpa [add_assoc] using h' -+ have htsum_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) -+ ≤ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p) := -+ (hasSum_le hb_pointwise hb_summable.hasSum hmaj_summ.hasSum) -+ have htsum_bφ : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) -+ = ∑ p ∈ small, CartanBound.φ (r / ap p) := by -+ classical -+ simpa [bφ] using tsum_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) -+ have htsum_b0 : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) -+ = (m : ℝ) * (small.card : ℝ) := by -+ classical -+ have : (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) = ∑ p ∈ small, (m : ℝ) := by -+ simpa [b0] using tsum_ite_mem_finset small (fun _ => (m : ℝ)) -+ simp [this, Finset.sum_const, nsmul_eq_mul, mul_comm] -+ have htsum_bmτ : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) -+ = (m : ℝ) * ∑ p ∈ small, (r / ap p) ^ τ := by -+ classical -+ have : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) -+ = ∑ p ∈ small, (m : ℝ) * (r / ap p) ^ τ := by -+ simpa [bmτ] using tsum_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) -+ simp [this, Finset.mul_sum] -+ have htsum_bt : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) -+ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by -+ simpa [bt, ap, Sτ] using -+ tsum_two_mul_rpow_div_norm_divisorZeroIndex₀_le (f := f) (τ := τ) hr hτ_nonneg -+ have hsum_small_rpow_le : -+ (∑ p ∈ small, (r / ap p) ^ τ) ≤ (Sτ + 1) * (1 + r) ^ τ := by -+ simpa [ap, Sτ] using -+ sum_rpow_div_norm_divisorZeroIndex₀_le (f := f) (τ := τ) small hr hτ_nonneg hsumτ -+ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ have hCφ : 0 ≤ CartanBound.Cφ := le_of_lt CartanBound.Cφ_pos -+ have hS : 0 ≤ Sτ + 1 := by linarith [hSτ_nonneg] -+ have htsum_majorant : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) -+ ≤ (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) -+ * (1 + r) ^ τ := by -+ have hφ_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) -+ ≤ CartanBound.Cφ * (small.card : ℝ) := by -+ simpa [htsum_bφ] using hphi_sum -+ have hb0_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) -+ ≤ (m : ℝ) * (small.card : ℝ) := by -+ simp [htsum_b0] -+ have hbmτ_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ≤ -+ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ have h0 : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) -+ ≤ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) := by -+ have hmul := mul_le_mul_of_nonneg_left hsum_small_rpow_le hm0 -+ -+ simpa [htsum_bmτ, mul_assoc, mul_left_comm, mul_comm] using hmul -+ have h1 : (1 : ℝ) ≤ (4 : ℝ) ^ τ := -+ Real.one_le_rpow (by norm_num) hτ_nonneg -+ have hscale : -+ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) -+ ≤ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ have hnonneg : 0 ≤ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) := by -+ have : 0 ≤ (Sτ + 1) * (1 + r) ^ τ := by positivity -+ exact mul_nonneg hm0 this -+ simpa [mul_assoc, mul_left_comm, mul_comm] using (mul_le_mul_of_nonneg_right h1 hnonneg) -+ exact h0.trans hscale -+ have hbt_le : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) -+ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using htsum_bt -+ have hsplit : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) -+ = (∑' p, bφ p) + (∑' p, b0 p) + (∑' p, bmτ p) + (∑' p, bt p) := by -+ classical -+ have hbφ_summ : Summable bφ := by -+ simpa [bφ] using summable_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) -+ have hb0_summ : Summable b0 := by -+ simpa [b0] using summable_ite_mem_finset small (fun _ => (m : ℝ)) -+ have hbmτ_summ : Summable bmτ := by -+ simpa [bmτ] using summable_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) -+ have hbt_summ : Summable bt := by -+ have hconst : -+ Summable -+ (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ (2 : ℝ) * (r ^ τ) * ((‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ)) := -+ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) -+ refine hconst.congr ?_ -+ intro p -+ simp [bt, ap, rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p, -+ mul_assoc, mul_left_comm, mul_comm] -+ exact tsum_add_four bφ b0 bmτ bt hbφ_summ hb0_summ hbmτ_summ hbt_summ -+ have hcard_le'' : -+ (small.card : ℝ) ≤ (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ simpa [mul_assoc, mul_left_comm, mul_comm] using hcard_le' -+ have hφ_le' : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ≤ -+ CartanBound.Cφ * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ have : CartanBound.Cφ * (small.card : ℝ) ≤ -+ CartanBound.Cφ * ((4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ) := -+ mul_le_mul_of_nonneg_left hcard_le'' hCφ -+ exact hφ_le.trans (by simpa [mul_assoc, mul_left_comm, mul_comm] using this) -+ have hb0_le' : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ≤ -+ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by -+ have : (m : ℝ) * (small.card : ℝ) ≤ (m : ℝ) * ((4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ) := -+ mul_le_mul_of_nonneg_left hcard_le'' hm0 -+ exact hb0_le.trans (by simpa [mul_assoc, mul_left_comm, mul_comm] using this) -+ have htsum_majorant' : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) -+ ≤ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ -+ + (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by -+ rw [hsplit] -+ set Y : ℝ := Sτ + 1 with hY -+ set T : ℝ := (1 + r) ^ τ with hT -+ have hφ_leY : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) -+ ≤ CartanBound.Cφ * (4 : ℝ) ^ τ * Y * T := by -+ simpa [hY, hT, mul_assoc] using hφ_le' -+ have hb0_leY : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) -+ ≤ (m : ℝ) * (4 : ℝ) ^ τ * Y * T := by -+ simpa [hY, hT, mul_assoc] using hb0_le' -+ have hbmτ_leY : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) -+ ≤ (m : ℝ) * (4 : ℝ) ^ τ * Y * T := by -+ simpa [hY, hT, mul_assoc] using hbmτ_le -+ have hbt_leY : -+ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) ≤ (2 : ℝ) * Y * T := by -+ simpa [hY, hT, mul_assoc] using hbt_le -+ have hmain := -+ cartan_majorant_four_term_bound -+ (q := (4 : ℝ) ^ τ) hφ_leY hb0_leY hbmτ_leY hbt_leY -+ simpa [Y, T, add_assoc] using hmain -+ have hring : -+ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ -+ + (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ -+ = (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) * (1 + r) ^ τ := by -+ exact cartan_majorant_add_two_factor -+ ((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ) (Sτ + 1) ((1 + r) ^ τ) -+ rw [← hring] -+ exact htsum_majorant' -+ have hCprod' : -+ (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) * (1 + r) ^ τ -+ ≤ Cprod * (1 + r) ^ τ := by -+ simpa [Cprod, cartanProductConstant, mul_assoc, mul_left_comm, mul_comm] using -+ cartan_majorant_pad_two_to_three -+ (A := (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ) -+ (S := Sτ) (T := (1 + r) ^ τ) hS (by positivity) -+ exact (le_trans (le_trans htsum_le htsum_majorant) hCprod') -+ have hsum_fin_le : -+ (∑ p ∈ s, b p) ≤ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) := by -+ simpa using -+ (Summable.sum_le_tsum (s := s) (f := b) (fun p _ => hb_nonneg p) hb_summable) -+ exact hsum_fin_le.trans hb_tsum_le -+ -+end Complex.Hadamard -+end -+end -+section -+noncomputable section -+ -+open scoped BigOperators -+open Filter Finset _root_.Real _root_.SiegelZeros.Real Topology -+ -+lemma Finset.prod_le_exp_sum {α : Type} (s : Finset α) (a : α → ℝ) (b : α → ℝ) -+ (ha : ∀ x ∈ s, 0 ≤ a x) (hab : ∀ x ∈ s, a x ≤ Real.exp (b x)) : -+ (∏ x ∈ s, a x) ≤ Real.exp (∑ x ∈ s, b x) := by -+ calc -+ (∏ x ∈ s, a x) ≤ ∏ x ∈ s, Real.exp (b x) := Finset.prod_le_prod₀ ha hab -+ _ = Real.exp (∑ x ∈ s, b x) := by -+ simpa using (Real.exp_sum (s := s) (f := b)).symm -+ -+lemma hasProd_le_of_prod_le_exp {α : Type} {f : α → ℝ} {a : ℝ} -+ (hf : HasProd f a (SummationFilter.unconditional α)) -+ {B : ℝ} (hB : ∀ s : Finset α, (∏ x ∈ s, f x) ≤ Real.exp B) : -+ a ≤ Real.exp B := -+ hasProd_le_of_prod_le (L := (SummationFilter.unconditional α)) hf hB -+ -+lemma hasProd_inv_unconditional {α : Type} {fac : α → ℂ} {F : ℂ} -+ (hfac : HasProd fac F (SummationFilter.unconditional α)) (hF : F ≠ 0) : -+ HasProd (fun x => (fac x)⁻¹) (F⁻¹) (SummationFilter.unconditional α) := by -+ change -+ Tendsto (fun s : Finset α => ∏ x ∈ s, (fac x)⁻¹) -+ (SummationFilter.unconditional α).filter (𝓝 (F⁻¹)) -+ have hprod : -+ Tendsto (fun s : Finset α => ∏ x ∈ s, fac x) -+ (SummationFilter.unconditional α).filter (𝓝 F) := by -+ simpa [HasProd] using hfac -+ have hinv : -+ Tendsto (fun s : Finset α => (∏ x ∈ s, fac x)⁻¹) -+ (SummationFilter.unconditional α).filter (𝓝 (F⁻¹)) := -+ hprod.inv₀ hF -+ refine hinv.congr' (Filter.Eventually.of_forall ?_) -+ intro s -+ simp [Finset.prod_inv_distrib] -+ -+lemma hasProd_norm_inv_unconditional {α : Type} {fac : α → ℂ} {F : ℂ} -+ (hfac : HasProd fac F (SummationFilter.unconditional α)) (hF : F ≠ 0) : -+ HasProd (fun x => ‖(fac x)⁻¹‖) ‖F⁻¹‖ (SummationFilter.unconditional α) := by -+ change -+ Tendsto (fun s : Finset α => ∏ x ∈ s, ‖(fac x)⁻¹‖) -+ (SummationFilter.unconditional α).filter (𝓝 ‖F⁻¹‖) -+ have hnorm := (hasProd_inv_unconditional hfac hF).norm -+ refine hnorm.congr' (Filter.Eventually.of_forall ?_) -+ intro s -+ simp [norm_inv, Finset.prod_inv_distrib] -+ -+lemma hasProd_norm_inv_le_exp_of_pointwise_le_exp {α : Type} {fac : α → ℂ} {F : ℂ} -+ (hfac : HasProd fac F (SummationFilter.unconditional α)) -+ (b : α → ℝ) (B : ℝ) -+ (hterm : ∀ x, ‖(fac x)⁻¹‖ ≤ Real.exp (b x)) -+ (hsum : ∀ s : Finset α, (∑ x ∈ s, b x) ≤ B) : -+ ‖F⁻¹‖ ≤ Real.exp B := by -+ by_cases hF : F = 0 -+ · subst hF -+ simpa using exp_nonneg B -+ have hnorm : -+ HasProd (fun x => ‖(fac x)⁻¹‖) ‖F⁻¹‖ (SummationFilter.unconditional α) := -+ hasProd_norm_inv_unconditional hfac hF -+ have hprod : ∀ s : Finset α, (∏ x ∈ s, ‖(fac x)⁻¹‖) ≤ Real.exp B := by -+ intro s -+ have h0 : ∀ x ∈ s, 0 ≤ ‖(fac x)⁻¹‖ := by intro _ _; positivity -+ have h1 : (∏ x ∈ s, ‖(fac x)⁻¹‖) ≤ Real.exp (∑ x ∈ s, b x) := by -+ refine Finset.prod_le_exp_sum s (a := fun x => ‖(fac x)⁻¹‖) (b := b) h0 ?_ -+ intro x hx -+ simpa using hterm x -+ have h2 : Real.exp (∑ x ∈ s, b x) ≤ Real.exp B := -+ Real.exp_le_exp.2 (hsum s) -+ exact h1.trans h2 -+ exact hasProd_le_of_prod_le_exp hnorm hprod -+end -+end -+section -+open Metric -+ -+namespace Complex -+ -+theorem borelCaratheodory_zero_closedBall {f : ℂ → ℂ} {M r R : ℝ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ (hr : 0 < r) (hlt : r < R) (hM : 0 < M) (hf0 : f 0 = 0) -+ (hf_re : ∀ w, ‖w‖ ≤ R → (f w).re ≤ M) {z : ℂ} (hz : ‖z‖ ≤ r) : -+ ‖f z‖ ≤ 2 * M * r / (R - r) := by -+ have hR : 0 < R := lt_trans hr hlt -+ have hz_ball : z ∈ Metric.ball (0 : ℂ) R := by -+ rw [Metric.mem_ball, dist_zero_right] -+ exact hz.trans_lt hlt -+ have hf_diff : DifferentiableOn ℂ f (Metric.ball (0 : ℂ) R) := by -+ intro w hw -+ have hw' : w ∈ Metric.closedBall (0 : ℂ) R := ball_subset_closedBall hw -+ exact (hf w hw').differentiableAt.differentiableWithinAt -+ have hf_map : Set.MapsTo f (Metric.ball (0 : ℂ) R) {w | w.re ≤ M} := by -+ intro w hw -+ simp only [Set.mem_ofPred_eq] -+ have hw' : ‖w‖ < R := by simpa [Metric.mem_ball, dist_zero_right] using hw -+ exact hf_re w hw'.le -+ have hbc := -+ _root_.Complex.borelCaratheodory_zero hM hf_diff hf_map hR hz_ball hf0 -+ have hzR : ‖z‖ < R := by -+ rw [Metric.mem_ball, dist_zero_right] at hz_ball -+ exact hz_ball -+ have hmono : ‖z‖ / (R - ‖z‖) ≤ r / (R - r) := by -+ have hrden : 0 < R - r := sub_pos.mpr hlt -+ have hden : 0 < R - ‖z‖ := sub_pos.mpr hzR -+ rw [div_le_div_iff₀ hden hrden] -+ nlinarith [hz, norm_nonneg z] -+ have hM' : 0 ≤ 2 * M := mul_nonneg (by norm_num) (le_of_lt hM) -+ calc ‖f z‖ -+ ≤ 2 * M * ‖z‖ / (R - ‖z‖) := hbc -+ _ ≤ 2 * M * (r / (R - r)) := by -+ simpa [mul_div_assoc] using mul_le_mul_of_nonneg_left hmono hM' -+ _ = 2 * M * r / (R - r) := by ring -+ -+end Complex -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Products.lean b/PrimeNumberTheoremAnd/SiegelZeros/Products.lean -new file mode 100644 -index 0000000..db0daa8 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/Products.lean -@@ -0,0 +1,496 @@ -+import Mathlib -+ -+namespace SiegelZeros -+ -+open _root_.Complex -+ -+section -+open scoped BigOperators -+ -+namespace Real -+ -+lemma pow_div_one_sub_le_two_mul {r : ℝ} (hr : 0 ≤ r) (hrhalf : r ≤ 1 / 2) (m : ℕ) : -+ r ^ (m + 1) / (1 - r) ≤ 2 * r ^ (m + 1) := by -+ have hpow : 0 ≤ r ^ (m + 1) := pow_nonneg hr _ -+ have hhalf' : (1 / 2 : ℝ) ≤ 1 - r := by linarith -+ calc -+ r ^ (m + 1) / (1 - r) ≤ r ^ (m + 1) / (1 / 2 : ℝ) := by -+ exact div_le_div_of_nonneg_left hpow (by positivity) hhalf' -+ _ = 2 * r ^ (m + 1) := by ring -+ -+end Real -+ -+namespace Complex -+ -+open scoped BigOperators in -+ -+lemma neg_log_one_sub_eq_tsum {z : ℂ} (hz : ‖z‖ < 1) : -+ -log (1 - z) = ∑' n : ℕ, z ^ (n + 1) / (n + 1) := by -+ have h := hasSum_taylorSeries_neg_log hz -+ rw [← h.tsum_eq, h.summable.tsum_eq_zero_add] -+ simp only [pow_zero, Nat.cast_zero, div_zero, zero_add, Nat.cast_add, Nat.cast_one] -+ -+noncomputable -+def partialLogSum (m : ℕ) (z : ℂ) : ℂ := -+ -logTaylor (m + 1) (-z) -+ -+@[simp] -+lemma partialLogSum_zero (z : ℂ) : partialLogSum 0 z = 0 := by -+ simp [partialLogSum, logTaylor_succ, logTaylor_zero] -+ -+@[simp] -+lemma partialLogSum_at_zero (m : ℕ) : partialLogSum m 0 = 0 := by -+ simp [partialLogSum, logTaylor_at_zero] -+ -+lemma logTaylor_succ_neg (n : ℕ) (z : ℂ) : -+ logTaylor (n + 1) (-z) = logTaylor n (-z) - z ^ n / n := by -+ rw [logTaylor_succ, Pi.add_apply] -+ have hsign : (-1 : ℂ) ^ (n + 1) * (-z) ^ n = -z ^ n := by -+ have hzpow : (-z) ^ n = (((-1 : ℂ) * z) ^ n) := by simp -+ rw [hzpow, mul_pow, ← mul_assoc, ← pow_add] -+ have hpow : (-1 : ℂ) ^ (n + 1 + n) = (-1 : ℂ) := by -+ rw [show n + 1 + n = 2 * n + 1 by omega, pow_add, pow_mul] -+ norm_num -+ rw [hpow] -+ ring -+ rw [show (-1 : ℂ) ^ (n + 1) * (-z) ^ n / n = -(z ^ n / n) by -+ rw [hsign] -+ ring] -+ abel -+ -+lemma logTaylor_neg_eq_neg_sum (m : ℕ) (z : ℂ) : -+ logTaylor (m + 1) (-z) = -∑ k ∈ Finset.range m, z ^ (k + 1) / (k + 1) := by -+ induction m with -+ | zero => -+ simp [logTaylor_succ, logTaylor_zero] -+ | succ m hm => -+ rw [logTaylor_succ_neg, hm, Finset.sum_range_succ] -+ have hcast : ((m + 1 : ℕ) : ℂ) = (1 + (m : ℂ)) := by -+ simp [Nat.cast_add, Nat.cast_one, add_comm] -+ rw [hcast] -+ ring_nf -+ -+lemma partialLogSum_eq_sum (m : ℕ) (z : ℂ) : -+ partialLogSum m z = ∑ k ∈ Finset.range m, z ^ (k + 1) / (k + 1) := by -+ simpa [partialLogSum] using congrArg Neg.neg (logTaylor_neg_eq_neg_sum m z) -+ -+lemma hasDerivAt_partialLogSum (m : ℕ) (z : ℂ) : -+ HasDerivAt (partialLogSum m) (∑ j ∈ Finset.range m, z ^ j) z := by -+ cases m with -+ | zero => -+ have hzero : partialLogSum 0 = fun _ : ℂ ↦ (0 : ℂ) := by -+ funext w -+ exact partialLogSum_zero w -+ simpa [hzero] using (hasDerivAt_const z (c := (0 : ℂ))) -+ | succ m => -+ have hsum : -+ (∑ j ∈ Finset.range (m + 1), z ^ j) = -+ ∑ j ∈ Finset.range (m + 1), (-1) ^ j * (-z) ^ j := by -+ refine Finset.sum_congr rfl ?_ -+ intro j hj -+ symm -+ calc -+ (-1 : ℂ) ^ j * (-z) ^ j = (-1 : ℂ) ^ j * (((-1 : ℂ) * z) ^ j) := by simp -+ _ = ((-1 : ℂ) ^ j * (-1 : ℂ) ^ j) * z ^ j := by rw [mul_pow]; ring -+ _ = z ^ j := by -+ rw [← pow_add, show j + j = 2 * j by omega, pow_mul] -+ norm_num -+ rw [hsum] -+ simpa [partialLogSum] using! -+ (((hasDerivAt_logTaylor (m + 1) (-z)).comp z (hasDerivAt_neg z)).neg) -+ -+lemma differentiable_partialLogSum (m : ℕ) : -+ Differentiable ℂ (fun z : ℂ => partialLogSum m z) := by -+ intro z -+ exact (hasDerivAt_partialLogSum m z).differentiableAt -+ -+noncomputable -+def logTail (m : ℕ) (z : ℂ) : ℂ := -+ ∑' k, z ^ (m + 1 + k) / (m + 1 + k) -+ -+lemma summable_logTail {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : -+ Summable (fun k => z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)) := by -+ have h_geom : Summable (fun k : ℕ => ‖z‖ ^ k) := -+ summable_geometric_of_lt_one (norm_nonneg z) hz -+ refine Summable.of_norm_bounded (g := fun k => ‖z‖ ^ k) h_geom ?_ -+ intro k -+ rw [norm_div, norm_pow] -+ have h1 : (1 : ℝ) ≤ (m + 1 + k : ℝ) := by -+ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity -+ nlinarith -+ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (Complex.norm_natCast (m + 1 + k)) -+ rw [hnorm] -+ calc -+ ‖z‖ ^ (m + 1 + k) / (m + 1 + k : ℝ) ≤ ‖z‖ ^ (m + 1 + k) := by -+ exact div_le_self (pow_nonneg (norm_nonneg z) _) h1 -+ _ = ‖z‖ ^ (m + 1) * ‖z‖ ^ k := by rw [pow_add] -+ _ ≤ 1 * ‖z‖ ^ k := by -+ refine mul_le_mul_of_nonneg_right ?_ (pow_nonneg (norm_nonneg z) k) -+ exact pow_le_one₀ (norm_nonneg z) (le_of_lt hz) -+ _ = ‖z‖ ^ k := one_mul _ -+ -+lemma norm_logTail_le {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : -+ ‖logTail m z‖ ≤ ‖z‖ ^ (m + 1) / (1 - ‖z‖) := by -+ dsimp only [logTail] -+ have h_rhs_summable : Summable (fun k => ‖z‖ ^ (m + 1 + k)) := by -+ simpa [pow_add] using -+ (summable_geometric_of_lt_one (norm_nonneg z) hz).mul_left (‖z‖ ^ (m + 1)) -+ have h_norm_summable : Summable (fun k => ‖z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖) := by -+ refine Summable.of_nonneg_of_le (fun _ => norm_nonneg _) ?_ h_rhs_summable -+ intro k -+ rw [norm_div, norm_pow] -+ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (Complex.norm_natCast (m + 1 + k)) -+ rw [hnorm] -+ have hm : 1 ≤ (m + 1 + k : ℝ) := by -+ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity -+ nlinarith -+ exact div_le_self (pow_nonneg (norm_nonneg z) _) hm -+ calc -+ ‖∑' k, z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖ -+ ≤ ∑' k, ‖z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖ := -+ norm_tsum_le_tsum_norm h_norm_summable -+ _ ≤ ∑' k, ‖z‖ ^ (m + 1 + k) := by -+ refine h_norm_summable.tsum_le_tsum ?_ h_rhs_summable -+ intro k -+ rw [norm_div, norm_pow] -+ have hm : 1 ≤ (m + 1 + k : ℝ) := by -+ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity -+ nlinarith -+ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (Complex.norm_natCast (m + 1 + k)) -+ rw [hnorm] -+ exact div_le_self (pow_nonneg (norm_nonneg z) _) hm -+ _ = ‖z‖ ^ (m + 1) / (1 - ‖z‖) := by -+ have h_eq : -+ (fun k => ‖z‖ ^ (m + 1 + k)) = fun k => ‖z‖ ^ (m + 1) * ‖z‖ ^ k := by -+ ext k -+ rw [pow_add] -+ rw [h_eq, tsum_mul_left] -+ have h_geom := hasSum_geometric_of_lt_one (norm_nonneg z) hz -+ rw [h_geom.tsum_eq, div_eq_mul_inv] -+ -+lemma norm_logTail_le_two_mul_norm_pow {z : ℂ} (hz : ‖z‖ < 1) (hzhalf : ‖z‖ ≤ 1 / 2) (m : ℕ) : -+ ‖logTail m z‖ ≤ 2 * ‖z‖ ^ (m + 1) := -+ (norm_logTail_le hz m).trans (Real.pow_div_one_sub_le_two_mul (norm_nonneg z) hzhalf m) -+ -+lemma norm_partialLogSum_le_nat_mul_max_one_norm_pow (m : ℕ) (z : ℂ) : -+ ‖partialLogSum m z‖ ≤ (m : ℝ) * max 1 (‖z‖ ^ m) := by -+ have hsum : -+ ‖partialLogSum m z‖ ≤ ∑ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖ := by -+ rw [partialLogSum_eq_sum] -+ exact norm_sum_le _ _ -+ have hterm : ∀ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖ ≤ max 1 (‖z‖ ^ m) := by -+ intro k hk -+ rw [norm_div, norm_pow] -+ have hk1 : (1 : ℝ) ≤ (k : ℝ) + 1 := by -+ have hk1_nat : (1 : ℕ) ≤ k + 1 := Nat.succ_le_succ (Nat.zero_le k) -+ exact_mod_cast hk1_nat -+ have hdenom : ‖((k : ℂ) + 1)‖ = (k : ℝ) + 1 := by -+ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (Complex.norm_natCast (k + 1)) -+ have hk_le : k + 1 ≤ m := Nat.succ_le_iff.2 (Finset.mem_range.1 hk) -+ have hpow_le : ‖z‖ ^ (k + 1) ≤ max 1 (‖z‖ ^ m) := by -+ have hz0 : 0 ≤ ‖z‖ := norm_nonneg z -+ by_cases hz1 : ‖z‖ ≤ (1 : ℝ) -+ · have : ‖z‖ ^ (k + 1) ≤ 1 := by exact pow_le_one₀ hz0 hz1 -+ exact this.trans (le_max_left _ _) -+ · have hz1' : (1 : ℝ) ≤ ‖z‖ := le_of_lt (lt_of_not_ge hz1) -+ have : ‖z‖ ^ (k + 1) ≤ ‖z‖ ^ m := pow_le_pow_right₀ hz1' hk_le -+ exact this.trans (le_max_right _ _) -+ calc -+ ‖z‖ ^ (k + 1) / ‖((k : ℂ) + 1)‖ = ‖z‖ ^ (k + 1) / ((k : ℝ) + 1) := by simp [hdenom] -+ _ ≤ ‖z‖ ^ (k + 1) := by -+ exact div_le_self (pow_nonneg (norm_nonneg z) _) hk1 -+ _ ≤ max 1 (‖z‖ ^ m) := hpow_le -+ have hsum_le : -+ (∑ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖) ≤ -+ ∑ _k ∈ Finset.range m, max 1 (‖z‖ ^ m) := -+ Finset.sum_le_sum (fun k hk => hterm k hk) -+ have hcard : ∑ _k ∈ Finset.range m, max 1 (‖z‖ ^ m) = (m : ℝ) * max 1 (‖z‖ ^ m) := by -+ simp [Finset.sum_const] -+ exact hsum.trans (hsum_le.trans_eq hcard) -+ -+lemma neg_log_one_sub_eq_partialLogSum_add_logTail {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : -+ -log (1 - z) = partialLogSum m z + logTail m z := by -+ let f : ℕ → ℂ := fun k ↦ z ^ (k + 1) / ((k : ℂ) + 1) -+ have h_summable : Summable f := by -+ simpa [f, Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using -+ (summable_logTail hz 0) -+ have h_decomp := h_summable.sum_add_tsum_nat_add m -+ rw [neg_log_one_sub_eq_tsum hz, partialLogSum_eq_sum, ← h_decomp] -+ congr 1 -+ dsimp only [logTail] -+ refine tsum_congr fun k ↦ ?_ -+ simp only [f, Nat.cast_add] -+ ring_nf -+ -+end Complex -+end -+section -+noncomputable section -+ -+namespace Complex -+ -+variable {z : ℂ} -+ -+@[bound] -+theorem neg_norm_le_re (z : ℂ) : -‖z‖ ≤ z.re := -+ neg_le_of_abs_le (abs_re_le_norm z) -+ -+lemma norm_inv_pow_le_one_of_one_le_norm (u : ℂ) (n : ℕ) (hu : (1 : ℝ) ≤ ‖u‖) : -+ ‖(u ^ n)⁻¹‖ ≤ 1 := by -+ have hge : (1 : ℝ) ≤ ‖u ^ n‖ := by -+ rw [Complex.norm_pow] -+ exact one_le_pow₀ hu -+ calc ‖(u ^ n)⁻¹‖ = ‖(1 : ℂ) / u ^ n‖ := by rw [inv_eq_one_div] -+ _ = 1 / ‖u ^ n‖ := by -+ have hone : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp -+ rw [Complex.norm_div, hone] -+ _ ≤ 1 := by simpa [one_div] using inv_le_one_of_one_le₀ hge -+ -+end Complex -+end -+end -+section -+noncomputable section -+ -+open scoped BigOperators -+open Set -+ -+namespace Complex -+ -+def weierstrassFactor (m : ℕ) (z : ℂ) : ℂ := -+ (1 - z) * exp (partialLogSum m z) -+ -+lemma weierstrassFactor_def (m : ℕ) (z : ℂ) : -+ weierstrassFactor m z = (1 - z) * exp (partialLogSum m z) := by -+ simp [weierstrassFactor] -+ -+@[simp] -+lemma weierstrassFactor_at_zero (m : ℕ) : weierstrassFactor m 0 = 1 := by -+ simp [weierstrassFactor, partialLogSum_at_zero] -+ -+lemma weierstrassFactor_eq_zero_iff (m : ℕ) (z : ℂ) : -+ weierstrassFactor m z = 0 ↔ z = 1 := by -+ constructor -+ · intro hz -+ rw [weierstrassFactor] at hz -+ rcases mul_eq_zero.mp hz with h1 | h2 -+ · exact (sub_eq_zero.mp h1).symm -+ · exact absurd h2 (exp_ne_zero _) -+ · rintro rfl -+ simp [weierstrassFactor] -+ -+lemma weierstrassFactor_ne_zero_iff (m : ℕ) (z : ℂ) : -+ weierstrassFactor m z ≠ 0 ↔ z ≠ 1 := by -+ simpa [ne_eq] using (not_congr (weierstrassFactor_eq_zero_iff (m := m) (z := z))) -+ -+lemma weierstrassFactor_ne_zero_of_ne_one (m : ℕ) {z : ℂ} (hz : z ≠ 1) : -+ weierstrassFactor m z ≠ 0 := -+ (weierstrassFactor_ne_zero_iff (m := m) (z := z)).2 hz -+ -+lemma differentiable_weierstrassFactor (m : ℕ) : -+ Differentiable ℂ (fun z : ℂ => weierstrassFactor m z) := by -+ simpa [weierstrassFactor] using! -+ ((differentiable_const (c := (1 : ℂ))).sub differentiable_id).mul -+ (differentiable_exp.comp (differentiable_partialLogSum m)) -+ -+theorem analyticOrderAt_weierstrassFactor_div_self (m : ℕ) {a : ℂ} (ha : a ≠ 0) : -+ analyticOrderAt (fun z : ℂ => weierstrassFactor m (z / a)) a = (1 : ℕ∞) := by -+ set F : ℂ → ℂ := fun z => weierstrassFactor m (z / a) -+ have hF : AnalyticAt ℂ F a := by -+ have hdiv : Differentiable ℂ (fun z : ℂ => z / a) := by -+ simp [div_eq_mul_inv] -+ have hdiff : Differentiable ℂ F := (differentiable_weierstrassFactor m).comp hdiv -+ exact Differentiable.analyticAt (f := F) hdiff a -+ let g : ℂ → ℂ := fun z => (-a⁻¹) * Complex.exp (partialLogSum m (z / a)) -+ have hg : AnalyticAt ℂ g a := by -+ have hdiv : Differentiable ℂ (fun z : ℂ => z / a) := by -+ simp [div_eq_mul_inv] -+ have hpls : Differentiable ℂ (fun z : ℂ => partialLogSum m (z / a)) := -+ (differentiable_partialLogSum m).comp hdiv -+ have hexp : Differentiable ℂ (fun z : ℂ => Complex.exp (partialLogSum m (z / a))) := -+ (Complex.differentiable_exp).comp hpls -+ have hdiffg : Differentiable ℂ g := by -+ simpa [g] using hexp.const_mul (-a⁻¹ : ℂ) -+ exact Differentiable.analyticAt (f := g) hdiffg a -+ have hg0 : g a ≠ 0 := by -+ have hconst : (-a⁻¹ : ℂ) ≠ 0 := by simp [ha] -+ have hexp0 : Complex.exp (partialLogSum m (a / a)) ≠ 0 := -+ Complex.exp_ne_zero (partialLogSum m (a / a)) -+ simpa [g] using mul_ne_zero hconst hexp0 -+ refine (hF.analyticOrderAt_eq_natCast (n := 1)).2 ?_ -+ refine ⟨g, hg, hg0, ?_⟩ -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ have hlin : (1 - z / a) = (z - a) * (-a⁻¹) := by -+ have h1 : (1 : ℂ) = a * a⁻¹ := by simp [ha] -+ simp [div_eq_mul_inv, h1] -+ ring -+ simp only [F, g, pow_one, smul_eq_mul] -+ rw [weierstrassFactor_def] -+ simp [hlin, mul_assoc] -+ -+lemma weierstrassFactor_eq_exp_neg_tail (m : ℕ) {z : ℂ} (hz : ‖z‖ < 1) (hz1 : z ≠ 1) : -+ weierstrassFactor m z = exp (-logTail m z) := by -+ unfold weierstrassFactor -+ have hz_ne_1 : 1 - z ≠ 0 := sub_ne_zero.mpr hz1.symm -+ rw [← exp_log hz_ne_1, ← Complex.exp_add] -+ have hsum : log (1 - z) + partialLogSum m z = -logTail m z := by -+ have hdecomp := neg_log_one_sub_eq_partialLogSum_add_logTail hz m -+ calc -+ log (1 - z) + partialLogSum m z -+ = log (1 - z) + (partialLogSum m z + logTail m z) - logTail m z := by ring -+ _ = log (1 - z) + (-log (1 - z)) - logTail m z := by rw [hdecomp] -+ _ = -logTail m z := by ring -+ simp [hsum] -+ -+theorem weierstrassFactor_sub_one_pow_bound {m : ℕ} {z : ℂ} (hz : ‖z‖ ≤ 1 / 2) : -+ ‖weierstrassFactor m z - 1‖ ≤ 4 * ‖z‖ ^ (m + 1) := by -+ by_cases hm : m = 0 -+ · subst hm -+ have hmain : ‖(1 - z) - 1‖ ≤ 4 * ‖z‖ ^ 1 := by -+ have h : (1 - z) - 1 = -z := by ring -+ calc -+ ‖(1 - z) - 1‖ = ‖-z‖ := by simp [h] -+ _ = ‖z‖ := norm_neg z -+ _ = ‖z‖ ^ 1 := by simp -+ _ ≤ 4 * ‖z‖ ^ 1 := by nlinarith [pow_nonneg (norm_nonneg z) 1] -+ simpa [weierstrassFactor] using hmain -+ · have hz_lt : ‖z‖ < 1 := lt_of_le_of_lt hz (by norm_num) -+ by_cases hz1 : z = 1 -+ · exfalso; rw [hz1] at hz; norm_num at hz -+ have h_eq : weierstrassFactor m z = exp (-logTail m z) := -+ weierstrassFactor_eq_exp_neg_tail m hz_lt hz1 -+ rw [h_eq] -+ have h_tail_bound := norm_logTail_le_two_mul_norm_pow hz_lt hz m -+ have hw_le_one : ‖-logTail m z‖ ≤ 1 := by -+ simp only [norm_neg] -+ have : ‖logTail m z‖ ≤ 1 := by -+ have hm_pos : 0 < m := Nat.pos_of_ne_zero hm -+ have h2 : 2 ≤ m + 1 := by -+ exact Nat.succ_le_succ (Nat.succ_le_iff.2 hm_pos) -+ have hpow : (‖z‖ ^ (m + 1)) ≤ (‖z‖ ^ 2) := by -+ have hz1' : ‖z‖ ≤ 1 := by nlinarith [hz] -+ have hz0' : 0 ≤ ‖z‖ := norm_nonneg z -+ exact pow_le_pow_of_le_one hz0' hz1' h2 -+ have hmul : 2 * ‖z‖ ^ (m + 1) ≤ 2 * ‖z‖ ^ 2 := by gcongr -+ have hsq : 2 * ‖z‖ ^ 2 ≤ 1 := by -+ have hz0 : 0 ≤ ‖z‖ := norm_nonneg z -+ have hz_sq : ‖z‖ ^ 2 ≤ (1 / 2 : ℝ) ^ 2 := pow_le_pow_left₀ hz0 hz 2 -+ nlinarith -+ exact (h_tail_bound.trans hmul).trans hsq -+ linarith -+ have h_exp_sub_one : ‖exp (-logTail m z) - 1‖ ≤ 2 * ‖-logTail m z‖ := -+ Complex.norm_exp_sub_one_le hw_le_one -+ simp only [norm_neg] at h_exp_sub_one -+ calc -+ ‖exp (-logTail m z) - 1‖ ≤ 2 * ‖logTail m z‖ := h_exp_sub_one -+ _ ≤ 2 * (2 * ‖z‖ ^ (m + 1)) := by gcongr -+ _ = 4 * ‖z‖ ^ (m + 1) := by ring -+ -+lemma log_norm_weierstrassFactor_ge_log_norm_one_sub_sub (m : ℕ) (z : ℂ) : -+ Real.log ‖1 - z‖ - ‖partialLogSum m z‖ ≤ Real.log ‖weierstrassFactor m z‖ := by -+ by_cases hz1 : z = (1 : ℂ) -+ · subst hz1 -+ simp [weierstrassFactor] -+ set S : ℂ := partialLogSum m z -+ have hS : weierstrassFactor m z = (1 - z) * Complex.exp S := by -+ simp [weierstrassFactor, S] -+ have hnorm_pos : 0 < ‖(1 : ℂ) - z‖ := -+ norm_pos_iff.mpr (sub_ne_zero.mpr (Ne.symm hz1)) -+ have hlog : -+ Real.log ‖weierstrassFactor m z‖ = Real.log ‖1 - z‖ + S.re := by -+ have hne : ‖(1 : ℂ) - z‖ ≠ 0 := ne_of_gt hnorm_pos -+ calc -+ Real.log ‖weierstrassFactor m z‖ -+ = Real.log (‖(1 : ℂ) - z‖ * ‖Complex.exp S‖) := by -+ simp [hS] -+ _ = Real.log ‖(1 : ℂ) - z‖ + Real.log ‖Complex.exp S‖ := by -+ simpa using (Real.log_mul hne (ne_of_gt (by simp))) -+ _ = Real.log ‖(1 : ℂ) - z‖ + S.re := by -+ simp [Complex.norm_exp, Real.log_exp] -+ _ = Real.log ‖1 - z‖ + S.re := by simp [sub_eq_add_neg, add_comm] -+ have hre : S.re ≥ -‖S‖ := Complex.neg_norm_le_re S -+ have : Real.log ‖weierstrassFactor m z‖ ≥ Real.log ‖1 - z‖ - ‖S‖ := by -+ linarith [hlog, hre] -+ simpa [S] using this -+ -+lemma log_norm_weierstrassFactor_ge_neg_two_pow {m : ℕ} {z : ℂ} (hz : ‖z‖ ≤ (1 / 2 : ℝ)) : -+ (-2 : ℝ) * ‖z‖ ^ (m + 1) ≤ Real.log ‖weierstrassFactor m z‖ := by -+ have hz_lt : ‖z‖ < (1 : ℝ) := lt_of_le_of_lt hz (by norm_num) -+ have hz1 : z ≠ (1 : ℂ) := by -+ intro h -+ have : (1 : ℝ) ≤ (1 / 2 : ℝ) := by -+ simpa [h] using hz -+ norm_num at this -+ have hEq : weierstrassFactor m z = Complex.exp (-logTail m z) := -+ weierstrassFactor_eq_exp_neg_tail m hz_lt hz1 -+ have hlog : -+ Real.log ‖weierstrassFactor m z‖ = (-logTail m z).re := by -+ simp [hEq, Complex.norm_exp, Real.log_exp] -+ have hre : (-logTail m z).re ≥ -‖logTail m z‖ := by -+ simpa [norm_neg] using Complex.neg_norm_le_re (-logTail m z) -+ have htail := norm_logTail_le_two_mul_norm_pow hz_lt hz m -+ have : (-logTail m z).re ≥ (-2 : ℝ) * ‖z‖ ^ (m + 1) := by -+ calc -+ (-logTail m z).re ≥ -‖logTail m z‖ := hre -+ _ ≥ (-2 : ℝ) * ‖z‖ ^ (m + 1) := by -+ nlinarith [htail] -+ simpa [hlog, mul_assoc, mul_left_comm, mul_comm] using this -+ -+end Complex -+end -+end -+section -+noncomputable section -+ -+open Filter Topology -+ -+namespace Complex -+ -+theorem logDeriv_weierstrassFactor_one_div {a z : ℂ} (ha : a ≠ 0) (hz : z ≠ a) : -+ logDeriv (fun w : ℂ => weierstrassFactor 1 (w / a)) z = -+ 1 / (z - a) + 1 / a := by -+ have hE : -+ (fun w : ℂ => weierstrassFactor 1 (w / a)) = -+ fun w : ℂ => (1 - w / a) * exp (w / a) := by -+ ext w -+ simp [weierstrassFactor_def, partialLogSum_eq_sum] -+ have hf : (1 - z / a) ≠ 0 := by -+ intro hzero -+ have hdiv : z / a = 1 := by -+ exact (sub_eq_zero.mp hzero).symm -+ exact hz ((div_eq_one_iff_eq ha).1 hdiv) -+ rw [hE, logDeriv_fun_mul z hf (exp_ne_zero (z / a)) (by fun_prop) (by fun_prop)] -+ have hleft : logDeriv (fun w : ℂ => 1 - w / a) z = 1 / (z - a) := by -+ rw [logDeriv_apply] -+ have hderiv : deriv (fun w : ℂ => 1 - w / a) z = -(1 / a) := by -+ simp [one_div] -+ rw [hderiv] -+ have haz : -z + a ≠ 0 := by -+ simpa [sub_eq_add_neg, add_comm] using sub_ne_zero.mpr (Ne.symm hz) -+ field_simp [ha, sub_ne_zero.mpr hz, haz] -+ have haz' : a - z ≠ 0 := sub_ne_zero.mpr (Ne.symm hz) -+ have hza : z - a = -(a - z) := by ring -+ rw [hza] -+ field_simp [haz'] -+ have hright : logDeriv (fun w : ℂ => exp (w / a)) z = 1 / a := by -+ rw [logDeriv_apply] -+ have hderiv : deriv (fun w : ℂ => exp (w / a)) z = -+ exp (z / a) * (1 / a) := by -+ simp [one_div] -+ rw [hderiv] -+ field_simp [exp_ne_zero (z / a)] -+ rw [hleft, hright] -+ -+end Complex -+end -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Summability.lean b/PrimeNumberTheoremAnd/SiegelZeros/Summability.lean -new file mode 100644 -index 0000000..0a11558 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/SiegelZeros/Summability.lean -@@ -0,0 +1,501 @@ -+import Mathlib -+import PrimeNumberTheoremAnd.SiegelZeros.Factorization -+import PrimeNumberTheoremAnd.SiegelZeros.Counting -+ -+namespace SiegelZeros -+ -+section -+noncomputable section -+ -+open Filter Topology Set _root_.SiegelZeros.Complex -+open scoped BigOperators Topology -+ -+namespace Complex.Hadamard -+ -+open scoped _root_.Real -+ -+noncomputable def divisorMassClosedBall₀ (f : ℂ → ℂ) (R : ℝ) : ℝ := -+ Function.locallyFinsuppWithin.massClosedBall₀ (MeromorphicOn.divisor f (Set.univ : Set ℂ)) R -+ -+lemma divisorMassClosedBall₀_le_of_growth {f : ℂ → ℂ} {ρ C : ℝ} -+ (hf : Differentiable ℂ f) -+ (hC : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) -+ {R : ℝ} (hR : 1 ≤ R) : -+ divisorMassClosedBall₀ f R -+ ≤ (C * (1 + |2 * R|) ^ ρ + |Real.log ‖meromorphicTrailingCoeffAt f 0‖|) / -+ Real.log 2 := by -+ simpa [divisorMassClosedBall₀] using -+ (Function.locallyFinsuppWithin.massClosedBall₀_divisor_le_of_log_growth -+ (f := f) (ρ := ρ) (C := C) hf hC hR) -+ -+lemma exists_r0_le_norm_divisorZeroIndex₀Val {f : ℂ → ℂ} -+ (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) : -+ ∃ r0 : ℝ, 0 < r0 ∧ -+ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖ := by -+ classical -+ set U : Set ℂ := (Set.univ : Set ℂ) -+ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U -+ have hDnonneg : 0 ≤ D := by -+ simpa [D, U] using (Differentiable.divisor_nonneg (f := f) hf) -+ have hzero : ∀ p : divisorZeroIndex₀ f U, f (divisorZeroIndex₀Val p) = 0 := by -+ intro p -+ set z : ℂ := divisorZeroIndex₀Val p -+ have hneTop : meromorphicOrderAt f z ≠ ⊤ := by -+ have hzAnal : AnalyticAt ℂ f z := hf.analyticAt z -+ have hzA : analyticOrderAt f z ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) (hf := hf) hnot (z := z) -+ intro htop -+ have hm : meromorphicOrderAt f z = (analyticOrderAt f z).map (↑) := -+ hzAnal.meromorphicOrderAt_eq (𝕜 := ℂ) -+ cases h : analyticOrderAt f z with -+ | top => -+ exact hzA (by simp [h]) -+ | coe n => -+ have : (analyticOrderAt f z).map (↑) ≠ (⊤ : WithTop ℤ) := by -+ simp [h] -+ exact this (by simpa [hm] using htop) -+ have hmon : MeromorphicOn f U := by -+ intro w hw; exact (hf.analyticAt w).meromorphicAt -+ have hdiv : MeromorphicOn.divisor f U z = (meromorphicOrderAt f z).untop₀ := by -+ simpa [U] using (MeromorphicOn.divisor_apply (f := f) (U := U) (z := z) hmon (by aesop)) -+ have hDz : MeromorphicOn.divisor f U z ≠ 0 := by -+ have hzsup : z ∈ (MeromorphicOn.divisor f U).support := by -+ simp [z] -+ simpa [Function.mem_support] using hzsup -+ have hposZ : (0 : ℤ) < (meromorphicOrderAt f z).untop₀ := by -+ have hge0 : 0 ≤ (meromorphicOrderAt f z).untop₀ := by -+ have : 0 ≤ MeromorphicOn.divisor f U z := by -+ simpa [D, U, z] using hDnonneg z -+ simpa [hdiv] using this -+ have hne0 : (meromorphicOrderAt f z).untop₀ ≠ 0 := by -+ simpa [hdiv] using hDz -+ exact lt_of_le_of_ne hge0 (by simpa [eq_comm] using hne0) -+ have hpos : (0 : WithTop ℤ) < meromorphicOrderAt f z := by -+ have : (0 : WithTop ℤ) < ((meromorphicOrderAt f z).untop₀ : WithTop ℤ) := -+ WithTop.coe_lt_coe.2 hposZ -+ simpa [WithTop.coe_untop₀_of_ne_top hneTop] using this -+ have htend0 : Tendsto f (𝓝[≠] z) (𝓝 (0 : ℂ)) := -+ tendsto_zero_of_meromorphicOrderAt_pos (f := f) (x := z) hpos -+ have hcontz : ContinuousAt f z := (hf z).continuousAt -+ have htendz : Tendsto f (𝓝[≠] z) (𝓝 (f z)) := -+ (hcontz.tendsto.mono_left (nhdsWithin_le_nhds : 𝓝[≠] z ≤ 𝓝 z)) -+ exact tendsto_nhds_unique htendz htend0 -+ by_cases h0 : f 0 = 0 -+ · have hD0 : D 0 ≠ 0 := by -+ have hmero0 : MeromorphicAt f (0 : ℂ) := (hf.analyticAt 0).meromorphicAt -+ have hneTop0 : meromorphicOrderAt f (0 : ℂ) ≠ ⊤ := by -+ have hA0 : analyticOrderAt f (0 : ℂ) ≠ ⊤ := -+ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) (hf := hf) hnot (z := 0) -+ intro htop -+ have hm : meromorphicOrderAt f (0 : ℂ) = (analyticOrderAt f (0 : ℂ)).map (↑) := -+ (hf.analyticAt 0).meromorphicOrderAt_eq (𝕜 := ℂ) -+ cases h : analyticOrderAt f (0 : ℂ) with -+ | top => exact (hA0 h).elim -+ | coe n => -+ have : (analyticOrderAt f (0 : ℂ)).map (↑) ≠ (⊤ : WithTop ℤ) := by -+ simp [h] -+ exact this (by simpa [hm] using htop) -+ have htend0 : Tendsto f (𝓝[≠] (0 : ℂ)) (𝓝 (0 : ℂ)) := by -+ have hcont0 : ContinuousAt f (0 : ℂ) := (hf 0).continuousAt -+ have : Tendsto f (𝓝 (0 : ℂ)) (𝓝 (0 : ℂ)) := by simpa [h0] using hcont0.tendsto -+ exact this.mono_left (nhdsWithin_le_nhds : 𝓝[≠] (0 : ℂ) ≤ 𝓝 (0 : ℂ)) -+ have hpos0 : (0 : WithTop ℤ) < meromorphicOrderAt f (0 : ℂ) := -+ (tendsto_zero_iff_meromorphicOrderAt_pos hmero0).1 htend0 -+ have hpos0' : (0 : ℤ) < (meromorphicOrderAt f (0 : ℂ)).untop₀ := by -+ have : (0 : WithTop ℤ) < ((meromorphicOrderAt f (0 : ℂ)).untop₀ : WithTop ℤ) := by -+ simpa [WithTop.coe_untop₀_of_ne_top hneTop0] using hpos0 -+ simpa using (WithTop.coe_lt_coe.1 this) -+ have hdiv0 : D 0 = (meromorphicOrderAt f (0 : ℂ)).untop₀ := by -+ have hmon : MeromorphicOn f U := by -+ intro w hw; exact (hf.analyticAt w).meromorphicAt -+ simpa [D, U] using -+ (MeromorphicOn.divisor_apply (f := f) (U := U) (z := (0 : ℂ)) -+ hmon (by aesop)) -+ exact by -+ have : (meromorphicOrderAt f (0 : ℂ)).untop₀ ≠ 0 := ne_of_gt hpos0' -+ simpa [hdiv0] using this -+ have hmem0 : (0 : ℂ) ∈ D.support := by -+ simp [Function.mem_support, hD0] -+ have hdisc : IsDiscrete D.support := by -+ simpa [D] using (D.discreteSupport) -+ rcases Metric.exists_ball_inter_eq_singleton_of_mem_discrete hdisc hmem0 with ⟨r0, hr0pos, hr0⟩ -+ refine ⟨r0, hr0pos, ?_⟩ -+ intro p -+ have hp : divisorZeroIndex₀Val p ∈ D.support := by -+ simp [D, divisorZeroIndex₀Val_mem_divisor_support (f := f) (U := U) p] -+ have hnotBall : divisorZeroIndex₀Val p ∉ Metric.ball (0 : ℂ) r0 := by -+ intro hball -+ have : divisorZeroIndex₀Val p ∈ Metric.ball (0 : ℂ) r0 ∩ D.support := ⟨hball, hp⟩ -+ have : divisorZeroIndex₀Val p ∈ ({(0 : ℂ)} : Set ℂ) := by simp [hr0] at this -+ have : divisorZeroIndex₀Val p = 0 := by simp [Set.mem_singleton_iff] at this -+ exact (divisorZeroIndex₀Val_ne_zero p) this -+ have : r0 ≤ ‖divisorZeroIndex₀Val p‖ := by -+ have : ¬ ‖divisorZeroIndex₀Val p‖ < r0 := by -+ intro hlt -+ exact hnotBall (by simpa [Metric.mem_ball, dist_zero_right] using hlt) -+ exact le_of_not_gt this -+ exact this -+ · have hcont0 : ContinuousAt f (0 : ℂ) := (hf 0).continuousAt -+ have hne : ∀ᶠ z in 𝓝 (0 : ℂ), f z ≠ 0 := hcont0.eventually_ne h0 -+ rcases Metric.mem_nhds_iff.1 hne with ⟨r0, hr0pos, hr0⟩ -+ refine ⟨r0, hr0pos, ?_⟩ -+ intro p -+ have : ¬ ‖divisorZeroIndex₀Val p‖ < r0 := by -+ intro hlt -+ have hzball : divisorZeroIndex₀Val p ∈ Metric.ball (0 : ℂ) r0 := by -+ simpa [Metric.mem_ball, dist_zero_right] using hlt -+ have : f (divisorZeroIndex₀Val p) ≠ 0 := hr0 hzball -+ exact this (hzero p) -+ exact le_of_not_gt this -+ -+open scoped BigOperators -+ -+lemma card_ball_le_divisorMassClosedBall₀ -+ {f : ℂ → ℂ} (hf : Differentiable ℂ f) {R : ℝ} (hR : 0 < R) : -+ (Nat.card {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) -+ ≤ divisorMassClosedBall₀ f R := by -+ set U : Set ℂ := (Set.univ : Set ℂ) -+ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U -+ have : -+ Fintype {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} := by -+ have : Finite {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} := by -+ have : Metric.closedBall (0 : ℂ) R ⊆ U := by simp [U] -+ simpa using (finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := U) (B := R) this) -+ exact Fintype.ofFinite _ -+ have hDnonneg : 0 ≤ D := by -+ simpa [D, U] using (Differentiable.divisor_nonneg (f := f) hf) -+ let SR : Finset ℂ := -+ (Function.locallyFinsuppWithin.finiteSupport (Function.locallyFinsuppWithin.toClosedBall R D) -+ (isCompact_closedBall (0 : ℂ) |R|)).toFinset -+ let S : Finset ℂ := SR.filter fun z : ℂ => z ≠ 0 -+ let T : Type := -+ Σ z : S, Fin (Int.toNat (D z.1)) -+ let φ : -+ {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} → T := fun p => -+ let z0 : ℂ := divisorZeroIndex₀Val p.1 -+ have hz0_memSR : z0 ∈ SR := by -+ have hz0_norm : ‖z0‖ ≤ |R| := by -+ have : ‖z0‖ ≤ R := p.2 -+ simpa [abs_of_pos hR] using this -+ have hz0_support : z0 ∈ (Function.locallyFinsuppWithin.toClosedBall R D).support := by -+ have hz0_suppD : z0 ∈ D.support := by -+ simp [z0, D] -+ exact Function.locallyFinsuppWithin.mem_toClosedBall_support_of_mem_support_of_norm_le_abs -+ hz0_suppD hz0_norm -+ exact (Set.Finite.mem_toFinset -+ (Function.locallyFinsuppWithin.finiteSupport -+ (Function.locallyFinsuppWithin.toClosedBall R D) -+ (isCompact_closedBall (0 : ℂ) |R|))).2 hz0_support -+ have hz0_ne0 : z0 ≠ 0 := divisorZeroIndex₀Val_ne_zero p.1 -+ have hz0_memS : z0 ∈ S := Finset.mem_filter.2 ⟨hz0_memSR, hz0_ne0⟩ -+ ⟨⟨z0, hz0_memS⟩, by -+ simpa [z0, divisorZeroIndex₀Val, D] using p.1.1.2⟩ -+ have hφ_inj : Function.Injective φ := by -+ intro p q hpq -+ have hσ := (Sigma.mk.inj_iff).1 hpq -+ have hzS : (φ p).1 = (φ q).1 := hσ.1 -+ have hz : divisorZeroIndex₀Val p.1 = divisorZeroIndex₀Val q.1 := by -+ simpa [φ] using congrArg Subtype.val hzS -+ apply Subtype.ext -+ apply Subtype.ext -+ apply Sigma.ext -+ · exact hz -+ · simpa [φ] using hσ.2 -+ have hcard_le : -+ Fintype.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} ≤ Fintype.card T := -+ Fintype.card_le_of_injective φ hφ_inj -+ have hT_card : -+ (Fintype.card T : ℝ) = -+ (S.sum fun z : ℂ => (Int.toNat (D z) : ℝ)) := by -+ have hNat : -+ Fintype.card T = ∑ z : S, Int.toNat (D z.1) := by -+ have h1 : -+ Fintype.card T = ∑ z : S, Fintype.card (Fin (Int.toNat (D z.1))) := by -+ change Fintype.card (Sigma (fun z : S => Fin (Int.toNat (D z.1)))) -+ = ∑ z : S, Fintype.card (Fin (Int.toNat (D z.1))) -+ exact (Fintype.card_sigma (ι := S) (α := fun z : S => Fin (Int.toNat (D z.1)))) -+ simpa using h1 -+ have hR : -+ (Fintype.card T : ℝ) = ∑ z : S, (Int.toNat (D z.1) : ℝ) := by -+ exact_mod_cast hNat -+ have hR' : -+ (Fintype.card T : ℝ) = S.attach.sum (fun z : S => (Int.toNat (D z.1) : ℝ)) := by -+ simpa [Finset.univ_eq_attach] using hR -+ calc -+ (Fintype.card T : ℝ) = S.attach.sum (fun z : S => (Int.toNat (D z.1) : ℝ)) := hR' -+ _ = S.sum (fun z : ℂ => (Int.toNat (D z) : ℝ)) := by -+ simpa using (Finset.sum_attach (s := S) (f := fun z : ℂ => (Int.toNat (D z) : ℝ))) -+ have htoNat_le : ∀ z ∈ S, (Int.toNat (D z) : ℝ) ≤ (D z : ℝ) := by -+ intro z hz -+ have hDz_nonneg : 0 ≤ D z := by simpa [D] using hDnonneg z -+ have hEqZ : ((Int.toNat (D z) : ℕ) : ℤ) = D z := by -+ simpa using (Int.toNat_of_nonneg hDz_nonneg) -+ have hEqR : (Int.toNat (D z) : ℝ) = (D z : ℝ) := by -+ exact_mod_cast hEqZ -+ exact le_of_eq hEqR -+ calc -+ (Nat.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) -+ = (Fintype.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) := by -+ simp [Nat.card_eq_fintype_card] -+ _ ≤ (Fintype.card T : ℝ) := by exact_mod_cast hcard_le -+ _ = S.sum (fun z : ℂ => (Int.toNat (D z) : ℝ)) := hT_card -+ _ ≤ S.sum (fun z : ℂ => (D z : ℝ)) := by -+ refine Finset.sum_le_sum ?_ -+ intro z hz -+ exact htoNat_le z hz -+ _ = divisorMassClosedBall₀ f R := by -+ rfl -+ -+lemma card_subtype_le_divisorMassClosedBall₀_of_norm_le -+ {f : ℂ → ℂ} (hf : Differentiable ℂ f) -+ {s : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))} [Fintype s] -+ {R : ℝ} (hR : 0 < R) (hs : ∀ p : s, ‖divisorZeroIndex₀Val p.1‖ ≤ R) : -+ (Fintype.card s : ℝ) ≤ divisorMassClosedBall₀ f R := by -+ let Aball : Type := -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) // ‖divisorZeroIndex₀Val p‖ ≤ R} -+ have : Fintype Aball := by -+ have : Finite Aball := by -+ have : Metric.closedBall (0 : ℂ) R ⊆ (Set.univ : Set ℂ) := by simp -+ simpa [Aball] using -+ (finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := (Set.univ : Set ℂ)) -+ (B := R) this) -+ exact Fintype.ofFinite _ -+ have hinj : Function.Injective (fun p : s => (⟨p.1, hs p⟩ : Aball)) := by -+ intro p q hpq -+ apply Subtype.ext -+ exact congrArg (fun x : Aball => x.1) hpq -+ have hcard_le : Fintype.card s ≤ Fintype.card Aball := -+ Fintype.card_le_of_injective _ hinj -+ have hAball : (Nat.card Aball : ℝ) ≤ divisorMassClosedBall₀ f R := by -+ simpa [Aball] using card_ball_le_divisorMassClosedBall₀ (f := f) hf hR -+ calc -+ (Fintype.card s : ℝ) ≤ (Fintype.card Aball : ℝ) := by exact_mod_cast hcard_le -+ _ = (Nat.card Aball : ℝ) := by simp [Nat.card_eq_fintype_card] -+ _ ≤ divisorMassClosedBall₀ f R := hAball -+ -+lemma divisorZeroIndex₀_dyadicShell_upper_bound -+ {f : ℂ → ℂ} {r0 : ℝ} -+ (hr0pos : 0 < r0) -+ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) -+ {k : ℕ} {p : divisorZeroIndex₀ f (Set.univ : Set ℂ)} -+ (hp : ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k) : -+ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1) := by -+ exact Real.dyadicShell_upper_bound (r0 := r0) (x := ‖divisorZeroIndex₀Val p‖) -+ hr0pos (hr0 p) hp -+ -+lemma divisorZeroIndex₀_dyadicShell_lower_bound -+ {f : ℂ → ℂ} {r0 : ℝ} -+ (hr0pos : 0 < r0) -+ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) -+ {k : ℕ} {p : divisorZeroIndex₀ f (Set.univ : Set ℂ)} -+ (hp : ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k) : -+ r0 * (2 : ℝ) ^ (k : ℝ) ≤ ‖divisorZeroIndex₀Val p‖ := by -+ exact Real.dyadicShell_lower_bound (r0 := r0) (x := ‖divisorZeroIndex₀Val p‖) -+ hr0pos (hr0 p) hp -+ -+lemma finite_divisorZeroIndex₀_dyadicShell -+ {f : ℂ → ℂ} {r0 : ℝ} -+ (hr0pos : 0 < r0) -+ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) -+ (k : ℕ) : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k} : Set _).Finite := by -+ have hsub : -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k} ⊆ -+ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)} := by -+ intro p hp -+ exact divisorZeroIndex₀_dyadicShell_upper_bound hr0pos hr0 hp -+ have hfin : -+ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | -+ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)} : Set _).Finite := by -+ have : -+ Metric.closedBall (0 : ℂ) (r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) ⊆ -+ (Set.univ : Set ℂ) := by -+ simp -+ simpa using -+ (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) -+ (B := r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) this) -+ exact hfin.subset hsub -+ -+lemma tsum_divisorZeroIndex₀_dyadicShell_inv_rpow_le_geometric_of_growth -+ {f : ℂ → ℂ} {ρ τ r0 Cgrow : ℝ} -+ (hρ : 0 ≤ ρ) (hτpos : 0 < τ) (hf : Differentiable ℂ f) -+ (hCgrow_pos : 0 < Cgrow) -+ (hCgrow : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ Cgrow * (1 + ‖z‖) ^ ρ) -+ (hr0pos : 0 < r0) -+ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), -+ r0 ≤ ‖divisorZeroIndex₀Val p‖) -+ (k : ℕ) (hk_ge_one : 1 ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) : -+ let kfun : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℕ := -+ fun p => ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ -+ let S : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := {p | kfun p = k} -+ let Ctrail : ℝ := |Real.log ‖meromorphicTrailingCoeffAt f 0‖| -+ let A : ℝ := ((Cgrow / Real.log 2) * (1 + 4 * r0) ^ ρ) * (r0⁻¹) ^ τ -+ let B : ℝ := ((Ctrail / Real.log 2) + 1) * (r0⁻¹) ^ τ -+ let q : ℝ := (2 : ℝ) ^ (ρ - τ) -+ let qσ : ℝ := (2 : ℝ) ^ (-τ) -+ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ≤ A * q ^ k + B * qσ ^ k := by -+ classical -+ intro kfun S Ctrail A B q qσ -+ let rk : ℝ := r0 * (2 : ℝ) ^ (k : ℝ) -+ let Rk : ℝ := r0 * (2 : ℝ) ^ ((k : ℝ) + 1) -+ have hrk_pos : 0 < rk := mul_pos hr0pos (Real.rpow_pos_of_pos (by norm_num) _) -+ have hrk0 : 0 ≤ rk := le_of_lt hrk_pos -+ have : Finite S := by -+ simpa [S, kfun] using (finite_divisorZeroIndex₀_dyadicShell -+ (f := f) hr0pos hr0 k).to_subtype -+ have : Fintype S := Fintype.ofFinite S -+ have hk_upper : ∀ p : S, ‖divisorZeroIndex₀Val p.1‖ ≤ Rk := by -+ intro p -+ have hk' : kfun p.1 = k := p.2 -+ simpa [Rk, kfun] using -+ divisorZeroIndex₀_dyadicShell_upper_bound (f := f) hr0pos hr0 hk' -+ have hk_lower : ∀ p : S, rk ≤ ‖divisorZeroIndex₀Val p.1‖ := by -+ intro p -+ have hk' : kfun p.1 = k := p.2 -+ simpa [rk, kfun] using -+ divisorZeroIndex₀_dyadicShell_lower_bound (f := f) hr0pos hr0 hk' -+ have htsum_le : -+ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) -+ ≤ (Fintype.card S : ℝ) * (rk⁻¹ ^ τ) := by -+ exact Real.tsum_inv_rpow_le_card_mul_of_lower_bound -+ (a := fun p : S => ‖divisorZeroIndex₀Val p.1‖) -+ hrk_pos hτpos (fun _ => norm_nonneg _) hk_lower -+ have hmass_le_growth : -+ divisorMassClosedBall₀ f Rk -+ ≤ (Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2) := by -+ simpa [Ctrail, Rk] using -+ (divisorMassClosedBall₀_le_of_growth (f := f) (ρ := ρ) (C := Cgrow) hf hCgrow -+ (R := Rk) hk_ge_one) -+ have hcard_le_mass : -+ (Fintype.card S : ℝ) ≤ divisorMassClosedBall₀ f Rk := by -+ have hRk_pos : 0 < Rk := lt_of_lt_of_le (by norm_num) hk_ge_one -+ exact card_subtype_le_divisorMassClosedBall₀_of_norm_le (f := f) hf hRk_pos hk_upper -+ have htsum' : -+ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) -+ ≤ ((Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2)) * (rk⁻¹ ^ τ) := by -+ have hcard_le_growth : -+ (Fintype.card S : ℝ) ≤ -+ (Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2) := -+ le_trans hcard_le_mass hmass_le_growth -+ exact le_trans htsum_le <| -+ mul_le_mul_of_nonneg_right hcard_le_growth (Real.rpow_nonneg (inv_nonneg.2 hrk0) τ) -+ have hpow_bound : -+ (1 + |2 * Rk|) ^ ρ ≤ (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by -+ simpa [Rk] using -+ Real.one_add_abs_two_mul_dyadicRadius_rpow_le (r0 := r0) (ρ := ρ) k hr0pos hρ -+ have hlog2pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) -+ simpa [A, B, q, qσ, rk, Ctrail, mul_assoc, mul_left_comm, mul_comm] using -+ Real.dyadic_growth_mass_mul_inv_le_geometric -+ (C := Cgrow) (L := Real.log 2) (M := (1 + 4 * r0) ^ ρ) -+ (X := (1 + |2 * Rk|) ^ ρ) -+ (T := ∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) -+ (Ctrail := Ctrail) (r0 := r0) (ρ := ρ) (τ := τ) (k := k) -+ hlog2pos hCgrow_pos.le hr0pos.le hpow_bound -+ (by simpa [rk] using htsum') -+ -+theorem summable_norm_inv_rpow_divisorZeroIndex₀_of_growth {f : ℂ → ℂ} {ρ τ : ℝ} -+ (hρ : 0 ≤ ρ) (hτ : ρ < τ) (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by -+ rcases hgrowth with ⟨Cgrow, hCgrow_pos, hCgrow⟩ -+ have hτpos : 0 < τ := lt_of_le_of_lt hρ hτ -+ rcases exists_r0_le_norm_divisorZeroIndex₀Val (f := f) hf hnot with ⟨r0, hr0pos, hr0⟩ -+ have hr0ne : (r0 : ℝ) ≠ 0 := ne_of_gt hr0pos -+ let kfun : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℕ := -+ fun p => ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ -+ let S : ℕ → Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := -+ fun k => {p | kfun p = k} -+ have hS : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ∃! k : ℕ, p ∈ S k := by -+ intro p -+ refine ⟨kfun p, ?_, ?_⟩ -+ · simp [S] -+ · intro k hk -+ simpa [S] using hk.symm -+ have hnonneg : 0 ≤ fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by -+ intro p -+ exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ -+ have hSk_summable : ∀ k : ℕ, Summable fun p : S k => ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by -+ intro k -+ have : Finite (S k) := by -+ simpa [S, kfun] using (finite_divisorZeroIndex₀_dyadicShell -+ (f := f) hr0pos hr0 k).to_subtype -+ exact Summable.of_finite -+ have hshell_summable : -+ Summable fun k : ℕ => ∑' p : S k, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by -+ let q : ℝ := (2 : ℝ) ^ (ρ - τ) -+ let qσ : ℝ := (2 : ℝ) ^ (-τ) -+ have hq_nonneg : 0 ≤ q := le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) -+ have hq_lt_one : q < 1 := -+ Real.rpow_lt_one_of_one_lt_of_neg (x := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) -+ (sub_neg.2 hτ) -+ have hqσ_nonneg : 0 ≤ qσ := le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) -+ have hqσ_lt_one : qσ < 1 := -+ Real.rpow_lt_one_of_one_lt_of_neg (x := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) -+ (by simpa using (neg_neg_of_pos hτpos)) -+ have hgeom_q : Summable (fun k : ℕ => q ^ k) := -+ summable_geometric_of_lt_one hq_nonneg hq_lt_one -+ have hgeom_qσ : Summable (fun k : ℕ => qσ ^ k) := -+ summable_geometric_of_lt_one hqσ_nonneg hqσ_lt_one -+ let Ctrail : ℝ := |Real.log ‖meromorphicTrailingCoeffAt f 0‖| -+ let A : ℝ := ((Cgrow / Real.log 2) * (1 + 4 * r0) ^ ρ) * (r0⁻¹) ^ τ -+ let B : ℝ := ((Ctrail / Real.log 2) + 1) * (r0⁻¹) ^ τ -+ rcases Real.exists_nat_le_two_pow (1 / r0) with ⟨k0, hk0⟩ -+ let A0 : ℝ := A * q ^ k0 -+ let B0 : ℝ := B * qσ ^ k0 -+ have hmajor : Summable (fun k : ℕ => A0 * q ^ k + B0 * qσ ^ k) := -+ (hgeom_q.mul_left A0).add (hgeom_qσ.mul_left B0) -+ have hshell_summable_shift : -+ Summable fun k : ℕ => ∑' p : S (k + k0), ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by -+ refine hmajor.of_nonneg_of_le -+ (fun k => by -+ have : ∀ p : S (k + k0), 0 ≤ ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by -+ intro p; exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ -+ exact tsum_nonneg this) -+ (fun k => by -+ let kk : ℕ := k + k0 -+ let Rk : ℝ := r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) -+ have hRk_ge_one : (1 : ℝ) ≤ Rk := by -+ have hkk : k0 ≤ kk + 1 := by -+ simp [kk, Nat.add_assoc, Nat.add_comm] -+ simpa [Rk] using -+ Real.one_le_dyadicRadius_succ_of_inv_le_two_pow hr0pos hk0 hkk -+ have hmain : -+ (∑' p : S kk, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ≤ A * q ^ kk + B * qσ ^ kk := by -+ simpa [S, kfun, Ctrail, A, B, q, qσ] using -+ tsum_divisorZeroIndex₀_dyadicShell_inv_rpow_le_geometric_of_growth -+ (f := f) (ρ := ρ) (τ := τ) hρ hτpos hf hCgrow_pos hCgrow hr0pos hr0 kk hRk_ge_one -+ have : A * q ^ kk + B * qσ ^ kk = A0 * q ^ k + B0 * qσ ^ k := by -+ simpa [A0, B0, kk] using Real.two_geometric_shift_add A B q qσ k k0 -+ simpa [kk] using (hmain.trans_eq this) -+ ) -+ exact (summable_nat_add_iff k0).1 hshell_summable_shift -+ have hpart := -+ (summable_partition (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) hnonneg (s := S) hS) -+ exact (hpart.2 ⟨hSk_summable, hshell_summable⟩) -+ -+theorem summable_norm_inv_pow_divisorZeroIndex₀_of_growth {f : ℂ → ℂ} {ρ : ℝ} -+ (hρ : 0 ≤ ρ) (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) -+ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : -+ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => -+ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (Nat.floor ρ + 1)) := by -+ have hτ : ρ < (Nat.floor ρ + 1 : ℝ) := by -+ simpa [Nat.cast_add, Nat.cast_one] using (Nat.lt_floor_add_one (a := ρ)) -+ have hs := -+ summable_norm_inv_rpow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) -+ (τ := (Nat.floor ρ + 1 : ℝ)) hρ hτ hf hnot hgrowth -+ exact hs.congr fun p => by -+ have hcast : ((Nat.floor ρ : ℝ) + 1) = ((Nat.floor ρ + 1 : ℕ) : ℝ) := by -+ norm_num -+ rw [hcast, Real.rpow_natCast] -+ -+end Complex.Hadamard -+end -+end -+ -+end SiegelZeros -diff --git a/PrimeNumberTheoremAnd/SmoothExistence.lean b/PrimeNumberTheoremAnd/SmoothExistence.lean -index b33edf8..2513738 100644 ---- a/PrimeNumberTheoremAnd/SmoothExistence.lean -+++ b/PrimeNumberTheoremAnd/SmoothExistence.lean -@@ -1,20 +1,20 @@ --import Architect --import Batteries.Tactic.Lemma -+/- -+Adapted from PrimeNumberTheoremAnd by Alex Kontorovich and contributors. -+Licensed under the Apache License, Version 2.0; see the upstream LICENSE. -+This compatibility port retains the proven declarations used by this project. -+-/ - import Mathlib.Geometry.Manifold.PartitionOfUnity - import Mathlib.Tactic.Bound --import PrimeNumberTheoremAnd.Mathlib.Algebra.Notation.Support -- --set_option lang.lemmaCmd true - - open MeasureTheory Set Real - open scoped ContDiff - --lemma smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : -+theorem smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : - ∃ Ψ : ℝ → ℝ, (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ - Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 ∧ - (Function.support Ψ = Set.Ioo a d) := by -- have := exists_contMDiff_zero_iff_one_iff_of_isClosed (n := ⊤) -- (modelWithCornersSelf ℝ ℝ) (s := Set.Iic a ∪ Set.Ici d) (t := Set.Icc b c) -+ have := exists_contDiff_zero_iff_one_iff_of_isClosed (n := ⊤) -+ (s := Set.Iic a ∪ Set.Ici d) (t := Set.Icc b c) - (IsClosed.union isClosed_Iic isClosed_Ici) isClosed_Icc - (by - simp_rw [Set.disjoint_union_left, Set.disjoint_iff, Set.subset_def, -@@ -25,7 +25,7 @@ lemma smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : - simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, Set.mem_Icc] at * - use Ψ - simp only [range_subset_iff, mem_Icc] at hΨrange -- refine ⟨ContMDiff.contDiff hΨSmooth, ?_, ?_, ?_, ?_⟩ -+ refine ⟨hΨSmooth, ?_, ?_, ?_, ?_⟩ - · apply HasCompactSupport.of_support_subset_isCompact (K := Set.Icc a d) isCompact_Icc - simp only [Function.support_subset_iff, ne_eq, mem_Icc, ← hΨ0, not_or] - bound -@@ -42,66 +42,3 @@ lemma smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : - simpa [-not_and, mem_Ioo, not_and_or, not_lt] using hx - · ext x - simp only [Function.mem_support, ne_eq, mem_Ioo, ← hΨ0, not_or, not_le] -- --blueprint_comment /-- --Let $\nu$ be a bumpfunction. ---/ -- --@[blueprint -- (title := "SmoothExistence") -- (statement := /-- -- There exists a smooth (once differentiable would be enough), -- nonnegative ``bumpfunction'' $\nu$, -- supported in $[1/2,2]$ with total mass one: -- $$ -- \int_0^\infty \nu(x)\frac{dx}{x} = 1. -- $$ -- -/) -- (proof := /-- Same idea as Urysohn-type argument. -/)] --lemma SmoothExistence : -- ∃ (ν : ℝ → ℝ), (ContDiff ℝ ∞ ν) ∧ (∀ x, 0 ≤ ν x) ∧ -- ν.support ⊆ Icc (1 / 2) 2 ∧ ∫ x in Ici 0, ν x / x = 1 := by -- suffices h : ∃ (ν : ℝ → ℝ), (ContDiff ℝ ∞ ν) ∧ (∀ x, 0 ≤ ν x) ∧ -- ν.support ⊆ Set.Icc (1 / 2) 2 ∧ 0 < ∫ x in Set.Ici 0, ν x / x by -- obtain ⟨ν, hν, hνnonneg, hνsupp, hνpos⟩ := h -- let c := (∫ x in Ici 0, ν x / x) -- use fun y ↦ ν y / c -- refine ⟨hν.div_const c, fun y ↦ div_nonneg (hνnonneg y) (le_of_lt hνpos), ?_, ?_⟩ -- · rw [Function.support_div, Function.support_const (ne_of_lt hνpos).symm, inter_univ] -- convert hνsupp -- · simp only [div_right_comm _ c _, integral_div c, div_self <| ne_of_gt hνpos, c] -- have := smooth_urysohn_support_Ioo (a := 1 / 2) (b := 1) (c := 3 / 2) (d := 2) -- (by linarith) (by linarith) -- obtain ⟨ν, hνContDiff, _, hν0, hν1, hνSupport⟩ := this -- use ν, hνContDiff -- unfold indicator at hν0 hν1 -- simp only [mem_Icc, Pi.one_apply, Pi.le_def, mem_Ioo] at hν0 hν1 -- simp only [hνSupport, subset_def, mem_Ioo, mem_Icc, and_imp] -- split_ands -- · exact fun x ↦ le_trans (by simp [apply_ite]) (hν0 x) -- · exact fun y hy hy' ↦ ⟨by linarith, by linarith⟩ -- · rw [integral_pos_iff_support_of_nonneg] -- · simp only [Function.support_div, measurableSet_Ici, Measure.restrict_apply', -- hνSupport, Function.support_id'] -- have : (Ioo (1 / 2 : ℝ) 2 ∩ {0}ᶜ ∩ Ici 0) = Ioo (1 / 2) 2 := by -- ext x -- simp only [one_div, mem_inter_iff, mem_Ioo, mem_compl_iff, mem_singleton_iff, mem_Ici] -- bound -- simp only [this, volume_Ioo, ENNReal.ofReal_pos, sub_pos, gt_iff_lt] -- linarith -- · simp_rw [Pi.le_def, Pi.zero_apply] -- intro y -- by_cases h : y ∈ Function.support ν -- · apply div_nonneg <| le_trans (by simp [apply_ite]) (hν0 y) -- rw [hνSupport, mem_Ioo] at h -- linarith [h.left] -- · simp only [Function.mem_support, ne_eq, not_not] at h -- simp [h] -- · have : (fun x ↦ ν x / x).support ⊆ Icc (1 / 2) 2 := by -- rw [Function.support_div, hνSupport] -- exact (inter_subset_left).trans Ioo_subset_Icc_self -- apply (integrableOn_iff_integrable_of_support_subset this).mp -- apply ContinuousOn.integrableOn_compact isCompact_Icc -- apply hνContDiff.continuous.continuousOn.div continuousOn_id ?_ -- simp only [mem_Icc, ne_eq, and_imp, id_eq] -- intros; linarith -diff --git a/PrimeNumberTheoremAnd/Sobolev.lean b/PrimeNumberTheoremAnd/Sobolev.lean -index 1f98bcb..c069633 100644 ---- a/PrimeNumberTheoremAnd/Sobolev.lean -+++ b/PrimeNumberTheoremAnd/Sobolev.lean -@@ -1,4 +1,10 @@ -+/- -+Adapted from PrimeNumberTheoremAnd by Alex Kontorovich and contributors. -+Licensed under the Apache License, Version 2.0; see the upstream LICENSE. -+This compatibility port retains the proven declarations used by this project. -+-/ - import Mathlib.Analysis.Calculus.Deriv.Support -+import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas - import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv - import Mathlib.Order.Filter.ZeroAndBoundedAtFilter - -@@ -7,16 +13,26 @@ open scoped ContDiff - - variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {n : ℕ} - --@[ext] structure CS (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where -+structure CS (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where -+ - toFun : ℝ → E - h1 : ContDiff ℝ n toFun - h2 : HasCompactSupport toFun - -+@[ext] protected theorem CS.ext {n : ℕ} {E : Type*} -+ [NormedAddCommGroup E] [NormedSpace ℝ E] {x y : CS n E} -+ (h : x.toFun = y.toFun) : x = y := by -+ cases x -+ cases y -+ cases h -+ rfl -+ - structure trunc extends (CS 2 ℝ) where - h3 : (Set.Icc (-1) (1)).indicator 1 ≤ toFun - h4 : toFun ≤ Set.indicator (Set.Ioo (-2) (2)) 1 - - structure W1 (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where -+ - toFun : ℝ → E - smooth : ContDiff ℝ n toFun - integrable : ∀ ⦃k⦄, k ≤ n → Integrable (iteratedDeriv k toFun) -@@ -27,14 +43,10 @@ section lemmas - - noncomputable def funscale {E : Type*} (g : ℝ → E) (R x : ℝ) : E := g (R⁻¹ • x) - --lemma contDiff_ofReal : ContDiff ℝ ∞ ofReal := by -- have key x : HasDerivAt ofReal 1 x := hasDerivAt_id x |>.ofReal_comp -- have key' : deriv ofReal = fun _ => 1 := by ext x ; exact (key x).deriv -- refine contDiff_infty_iff_deriv.mpr ⟨fun x => (key x).differentiableAt, ?_⟩ -- simpa [key'] using contDiff_const -+theorem contDiff_ofReal : ContDiff ℝ ∞ ofReal := Complex.ofRealCLM.contDiff - - omit [NormedSpace ℝ E] in --lemma tendsto_funscale {f : ℝ → E} (hf : ContinuousAt f 0) (x : ℝ) : -+theorem tendsto_funscale {f : ℝ → E} (hf : ContinuousAt f 0) (x : ℝ) : - Tendsto (fun R => funscale f R x) atTop (𝓝 (f 0)) := - hf.tendsto.comp (by simpa using tendsto_inv_atTop_zero.mul_const x) - -@@ -52,31 +64,31 @@ instance : Coe (CS n ℝ) (CS n ℂ) where coe f := ⟨fun x => f x, - def neg (f : CS n E) : CS n E where - toFun := -f - h1 := f.h1.neg -- h2 := by simpa [HasCompactSupport, tsupport] using f.h2 -+ h2 := f.h2.neg - - instance : Neg (CS n E) where neg := neg - --@[simp] lemma neg_apply {x : ℝ} : (-f) x = - (f x) := rfl -+@[simp] theorem neg_apply {x : ℝ} : (-f) x = - (f x) := rfl - - def smul (R : ℝ) (f : CS n E) : CS n E := ⟨R • f, f.h1.const_smul R, f.h2.smul_left⟩ - - instance : HSMul ℝ (CS n E) (CS n E) where hSMul := smul - --@[simp] lemma smul_apply : (R • f) x = R • f x := rfl -+@[simp] theorem smul_apply : (R • f) x = R • f x := rfl - --lemma continuous (f : CS n E) : Continuous f := f.h1.continuous -+theorem continuous (f : CS n E) : Continuous f := f.h1.continuous - - noncomputable def deriv (f : CS (n + 1) E) : CS n E where - toFun := _root_.deriv f - h1 := (contDiff_succ_iff_deriv.mp f.h1).2.2 - h2 := f.h2.deriv - --lemma hasDerivAt (f : CS (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := -+theorem hasDerivAt (f : CS (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := - (f.h1.differentiable (by simp)).differentiableAt.hasDerivAt - --lemma deriv_apply {f : CS (n + 1) E} {x : ℝ} : f.deriv x = _root_.deriv f x := rfl -+theorem deriv_apply {f : CS (n + 1) E} {x : ℝ} : f.deriv x = _root_.deriv f x := rfl - --lemma deriv_smul {f : CS (n + 1) E} : (R • f).deriv = R • f.deriv := by -+theorem deriv_smul {f : CS (n + 1) E} : (R • f).deriv = R • f.deriv := by - ext x ; exact (f.hasDerivAt x |>.const_smul R).deriv - - noncomputable def scale (g : CS n E) (R : ℝ) : CS n E := by -@@ -86,27 +98,27 @@ noncomputable def scale (g : CS n E) (R : ℝ) : CS n E := by - · exact g.h1.comp (contDiff_const_smul R⁻¹) - · exact g.h2.comp_smul (inv_ne_zero h) - --lemma deriv_scale {f : CS (n + 1) E} : (f.scale R).deriv = R⁻¹ • f.deriv.scale R := by -+theorem deriv_scale {f : CS (n + 1) E} : (f.scale R).deriv = R⁻¹ • f.deriv.scale R := by - ext v ; by_cases hR : R = 0 - · simp [hR, scale, deriv] - · simp only [scale, hR, ↓reduceDIte, smul_apply] - exact ((f.hasDerivAt (R⁻¹ • v)).scomp v -- (by simpa using! (hasDerivAt_id v).const_smul R⁻¹)).deriv -+ (by convert (hasDerivAt_const_mul (x := v) R⁻¹) using 1)).deriv - --lemma deriv_scale' {f : CS (n + 1) E} : -+theorem deriv_scale' {f : CS (n + 1) E} : - (f.scale R).deriv v = R⁻¹ • f.deriv (R⁻¹ • v) := by - rw [deriv_scale, smul_apply] - by_cases hR : R = 0 <;> simp [hR, scale, funscale] - --lemma hasDerivAt_scale (f : CS (n + 1) E) (R x : ℝ) : -+theorem hasDerivAt_scale (f : CS (n + 1) E) (R x : ℝ) : - HasDerivAt (f.scale R) (R⁻¹ • _root_.deriv f (R⁻¹ • x)) x := by - convert hasDerivAt (f.scale R) x ; rw [deriv_scale'] ; rfl - --lemma tendsto_scale (f : CS n E) (x : ℝ) : Tendsto (fun R => f.scale R x) atTop (𝓝 (f 0)) := by -+theorem tendsto_scale (f : CS n E) (x : ℝ) : Tendsto (fun R => f.scale R x) atTop (𝓝 (f 0)) := by - apply (tendsto_funscale f.continuous.continuousAt x).congr' - filter_upwards [eventually_ne_atTop 0] with R hR ; simp [scale, hR] - --lemma bounded : ∃ C, ∀ v, ‖f v‖ ≤ C := by -+theorem bounded : ∃ C, ∀ v, ‖f v‖ ≤ C := by - obtain ⟨x, hx⟩ := - (continuous_norm.comp f.continuous).exists_forall_ge_of_hasCompactSupport f.h2.norm - exact ⟨_, hx⟩ -@@ -119,16 +131,16 @@ instance : CoeFun trunc (fun _ => ℝ → ℝ) where coe f := f.toFun - - instance : Coe trunc (CS 2 ℝ) where coe := trunc.toCS - --lemma nonneg (g : trunc) (x : ℝ) : 0 ≤ g x := (Set.indicator_nonneg (by simp) x).trans (g.h3 x) -+theorem nonneg (g : trunc) (x : ℝ) : 0 ≤ g x := (Set.indicator_nonneg (by simp) x).trans (g.h3 x) - --lemma le_one (g : trunc) (x : ℝ) : g x ≤ 1 := -+theorem le_one (g : trunc) (x : ℝ) : g x ≤ 1 := - (g.h4 x).trans <| Set.indicator_le_self' (by simp) x - --lemma zero (g : trunc) : g =ᶠ[𝓝 0] 1 := by -+theorem zero (g : trunc) : g =ᶠ[𝓝 0] 1 := by - have : Set.Icc (-1) 1 ∈ 𝓝 (0 : ℝ) := by apply Icc_mem_nhds <;> linarith - exact eventually_of_mem this (fun x hx => le_antisymm (g.le_one x) (by simpa [hx] using g.h3 x)) - --@[simp] lemma zero_at {g : trunc} : g 0 = 1 := g.zero.eq_of_nhds -+@[simp] theorem zero_at {g : trunc} : g 0 = 1 := g.zero.eq_of_nhds - - end trunc - -@@ -136,23 +148,15 @@ namespace W1 - - instance : CoeFun (W1 n E) (fun _ => ℝ → E) where coe := W1.toFun - --lemma continuous (f : W1 n E) : Continuous f := f.smooth.continuous -+theorem continuous (f : W1 n E) : Continuous f := f.smooth.continuous - --lemma differentiable (f : W1 (n + 1) E) : Differentiable ℝ f := -+theorem differentiable (f : W1 (n + 1) E) : Differentiable ℝ f := - f.smooth.differentiable (by simp) - --lemma iteratedDeriv_sub {f g : ℝ → E} (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : -+theorem iteratedDeriv_sub {f g : ℝ → E} (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : - iteratedDeriv n (f - g) = iteratedDeriv n f - iteratedDeriv n g := by -- induction n generalizing f g with -- | zero => rfl -- | succ n ih => -- have hf' : ContDiff ℝ n (deriv f) := hf.iterate_deriv' n 1 -- have hg' : ContDiff ℝ n (deriv g) := hg.iterate_deriv' n 1 -- have hfg : deriv (f - g) = deriv f - deriv g := by -- ext x ; apply deriv_sub -- · exact (hf.differentiable (by simp)).differentiableAt -- · exact (hg.differentiable (by simp)).differentiableAt -- simp_rw [iteratedDeriv_succ', ← ih hf' hg', hfg] -+ funext x -+ exact _root_.iteratedDeriv_sub hf.contDiffAt hg.contDiffAt - - noncomputable def deriv (f : W1 (n + 1) E) : W1 n E where - toFun := _root_.deriv f -@@ -160,7 +164,7 @@ noncomputable def deriv (f : W1 (n + 1) E) : W1 n E where - integrable k hk := by - simpa [iteratedDeriv_succ'] using f.integrable (Nat.succ_le_succ hk) - --lemma hasDerivAt (f : W1 (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := -+theorem hasDerivAt (f : W1 (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := - f.differentiable.differentiableAt.hasDerivAt - - def sub (f g : W1 n E) : W1 n E where -@@ -173,12 +177,18 @@ def sub (f g : W1 n E) : W1 n E where - - instance : Sub (W1 n E) where sub := sub - --lemma integrable_iteratedDeriv_Schwarz {f : 𝓢(ℝ, ℂ)} : Integrable (iteratedDeriv n f) := by -+theorem integrable_iteratedDeriv_Schwarz {f : 𝓢(ℝ, ℂ)} : Integrable (iteratedDeriv n f) := by - induction n generalizing f with - | zero => exact f.integrable -- | succ n ih => simpa [iteratedDeriv_succ'] using! ih (f := SchwartzMap.derivCLM ℝ ℂ f) -- --noncomputable def of_Schwartz (f : 𝓢(ℝ, ℂ)) : W1 n ℂ where -+ | succ n ih => -+ rw [iteratedDeriv_succ'] -+ have hd : (SchwartzMap.derivCLM ℝ ℂ f : ℝ → ℂ) = _root_.deriv f := by -+ funext x -+ exact SchwartzMap.derivCLM_apply ℝ f x -+ rw [← hd] -+ exact ih (f := SchwartzMap.derivCLM ℝ ℂ f) -+ -+noncomputable def ofSchwartz (f : 𝓢(ℝ, ℂ)) : W1 n ℂ where - toFun := f - smooth := f.smooth n - integrable _ _ := integrable_iteratedDeriv_Schwarz -@@ -192,20 +202,29 @@ variable {f : W21} - noncomputable def norm (f : ℝ → ℂ) : ℝ := - (∫ v, ‖f v‖) + (4 * π ^ 2)⁻¹ * (∫ v, ‖deriv (deriv f) v‖) - --lemma norm_nonneg {f : ℝ → ℂ} : 0 ≤ norm f := -+theorem norm_nonneg {f : ℝ → ℂ} : 0 ≤ norm f := - add_nonneg (integral_nonneg (fun t => by simp)) - (mul_nonneg (by positivity) (integral_nonneg (fun t => by simp))) - - noncomputable instance : Norm W21 where norm := norm ∘ W1.toFun - --noncomputable instance : Coe 𝓢(ℝ, ℂ) W21 where coe := W1.of_Schwartz -+noncomputable instance : Coe 𝓢(ℝ, ℂ) W21 where coe := W1.ofSchwartz - - def ofCS2 (f : CS 2 ℂ) : W21 := by -- refine ⟨f, f.h1, fun k hk => ?_⟩ ; match k with -- | 0 => exact f.h1.continuous.integrable_of_hasCompactSupport f.h2 -- | 1 => simpa using (f.h1.continuous_deriv one_le_two).integrable_of_hasCompactSupport f.h2.deriv -- | 2 => simpa [iteratedDeriv_succ] using -- (f.h1.iterate_deriv' 0 2).continuous.integrable_of_hasCompactSupport f.h2.deriv.deriv -+ refine ⟨f, f.h1, ?_⟩ -+ intro k hk -+ cases k with -+ | zero => exact f.h1.continuous.integrable_of_hasCompactSupport f.h2 -+ | succ k => -+ cases k with -+ | zero => -+ simpa using (f.h1.continuous_deriv one_le_two).integrable_of_hasCompactSupport f.h2.deriv -+ | succ k => -+ have hk0 : k = 0 := -+ Nat.eq_zero_of_le_zero (Nat.le_of_succ_le_succ (Nat.le_of_succ_le_succ hk)) -+ subst k -+ simpa [iteratedDeriv_succ] using -+ (f.h1.iterate_deriv' 0 2).continuous.integrable_of_hasCompactSupport f.h2.deriv.deriv - - instance : Coe (CS 2 ℂ) W21 where coe := ofCS2 - -@@ -214,12 +233,12 @@ instance : HMul (CS 2 ℂ) W21 (CS 2 ℂ) where - - instance : HMul (CS 2 ℝ) W21 (CS 2 ℂ) where hMul g f := (g : CS 2 ℂ) * f - --lemma hf (f : W21) : Integrable f := f.integrable zero_le_two -+theorem hf (f : W21) : Integrable f := f.integrable zero_le_two - --lemma hf' (f : W21) : Integrable (deriv f) := by -+theorem hf' (f : W21) : Integrable (deriv f) := by - simpa [iteratedDeriv_succ] using f.integrable one_le_two - --lemma hf'' (f : W21) : Integrable (deriv (deriv f)) := by -+theorem hf'' (f : W21) : Integrable (deriv (deriv f)) := by - simpa [iteratedDeriv_succ] using f.integrable le_rfl - - end W21 -@@ -227,7 +246,6 @@ end W21 - theorem W21_approximation (f : W21) (g : trunc) : - Tendsto (fun R => ‖f - (g.scale R * f : W21)‖) atTop (𝓝 0) := by - -- -- Definitions - let f' := f.deriv - let f'' := f'.deriv - let g' := (g : CS 2 ℝ).deriv -@@ -236,13 +254,12 @@ theorem W21_approximation (f : W21) (g : trunc) : - let h' R := - (g.scale R).deriv - let h'' R := - (g.scale R).deriv.deriv - -- -- Properties of h - have ch {R} : Continuous (fun v => (h R v : ℂ)) := - continuous_ofReal.comp <| continuous_const.sub (CS.continuous _) - have ch' {R} : Continuous (fun v => (h' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) - have ch'' {R} : Continuous (fun v => (h'' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) - have dh R v : HasDerivAt (h R) (h' R v) v := by -- convert! CS.hasDerivAt_scale (g : CS 2 ℝ) R v |>.const_sub 1 using 1 -+ convert CS.hasDerivAt_scale (g : CS 2 ℝ) R v |>.const_sub 1 using 1 - simp [h', CS.deriv_scale', show g.deriv.toFun = deriv g.toFun from rfl] - have dh' R v : HasDerivAt (h' R) (h'' R v) v := ((g.scale R).deriv.hasDerivAt v).neg - have hh1 R v : |h R v| ≤ 1 := by -@@ -254,12 +271,10 @@ theorem W21_approximation (f : W21) (g : trunc) : - have vR v : Tendsto (fun R : ℝ => v * R⁻¹) atTop (𝓝 0) := by - simpa using tendsto_inv_atTop_zero.const_mul v - -- -- Proof - convert_to Tendsto (fun R => W21.norm (fun v => h R v * f v)) atTop (𝓝 0) - · ext R ; change W21.norm _ = _ ; congr ; ext v ; simp [h, sub_mul] ; rfl - rw [show (0 : ℝ) = 0 + ((4 * π ^ 2)⁻¹ : ℝ) * 0 by simp] - refine Tendsto.add ?_ (Tendsto.const_mul _ ?_) -- - · let F R v := ‖h R v * f v‖ - have eh v : ∀ᶠ R in atTop, h R v = 0 := by - filter_upwards [(vR v).eventually g.zero, eventually_ne_atTop 0] with R hR hR' -@@ -275,7 +290,6 @@ theorem W21_approximation (f : W21) (g : trunc) : - apply Eventually.of_forall ; intro v - apply tendsto_nhds_of_eventually_eq ; filter_upwards [eh v] with R hR ; simp [F, hR] - simpa [F] using tendsto_integral_filter_of_dominated_convergence _ e1 e2 f.hf.norm e4 -- - · let F R v := ‖h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v‖ - convert_to Tendsto (fun R ↦ ∫ (v : ℝ), F R v) atTop (𝓝 0) - · have this R v : -@@ -291,9 +305,8 @@ theorem W21_approximation (f : W21) (g : trunc) : - (dh R v).ofReal_comp.mul (df' v) - have d1 : deriv (fun v => h R v * f v) = fun v => h' R v * f v + h R v * f' v := - funext (fun v => (l3 v).deriv) -- rw [d1] ; convert! (l5.add l7).deriv using 1 ; ring -+ rw [d1] ; convert (l5.add l7).deriv using 1 ; ring - simp_rw [this, F] -- - obtain ⟨c1, mg'⟩ := g'.bounded - obtain ⟨c2, mg''⟩ := g''.bounded - let bound v := c2 * ‖f v‖ + 2 * c1 * ‖f' v‖ + ‖f'' v‖ -@@ -338,8 +351,13 @@ theorem W21_approximation (f : W21) (g : trunc) : - (((f.hf.norm).const_mul _).add ((f.hf'.norm).const_mul _)).add f.hf''.norm - have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by - apply Eventually.of_forall ; intro v -- have evg' : g' =ᶠ[𝓝 0] 0 := by convert! ← g.zero.deriv ; exact deriv_const' _ -- have evg'' : g'' =ᶠ[𝓝 0] 0 := by convert! ← evg'.deriv ; exact deriv_const' _ -+ have evg' : (g' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) := by -+ have hzero : (g : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 1) := g.zero -+ change _root_.deriv (g : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) -+ simpa only [deriv_const'] using hzero.deriv -+ have evg'' : (g'' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) := by -+ change _root_.deriv (g' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) -+ simpa only [deriv_const'] using evg'.deriv - refine tendsto_norm_zero.comp <| (ZeroAtFilter.add ?_ ?_).add ?_ - · have eh'' v : ∀ᶠ R in atTop, h'' R v = 0 := by - filter_upwards [(vR v).eventually evg'', eventually_ne_atTop 0] with R hR hR' -@@ -355,5 +373,6 @@ theorem W21_approximation (f : W21) (g : trunc) : - simp [h', CS.deriv_scale', mul_comm R⁻¹, hR] - apply tendsto_nhds_of_eventually_eq - filter_upwards [eh' v] with R hR ; simp [hR] -- · simpa [h] using! ((g.tendsto_scale v).const_sub 1).ofReal.mul tendsto_const_nhds -+ · simpa [h, Filter.ZeroAtFilter] using -+ ((g.tendsto_scale v).const_sub 1).ofReal.mul tendsto_const_nhds - simpa [F] using tendsto_integral_filter_of_dominated_convergence bound e1 e2 e3 e4 -diff --git a/PrimeNumberTheoremAnd/Wiener.lean b/PrimeNumberTheoremAnd/Wiener.lean -index 59fd506..d69b893 100644 ---- a/PrimeNumberTheoremAnd/Wiener.lean -+++ b/PrimeNumberTheoremAnd/Wiener.lean -@@ -1,22 +1,18 @@ --import Architect -+/- -+Adapted from PrimeNumberTheoremAnd by Alex Kontorovich and contributors. -+Licensed under the Apache License, Version 2.0; see the upstream LICENSE. -+This compatibility port retains the proven declarations used by this project. -+-/ - import Mathlib.Analysis.Fourier.RiemannLebesgueLemma - import Mathlib.Analysis.Normed.Group.Tannery - import Mathlib.Analysis.SumIntegralComparisons - import Mathlib.NumberTheory.Chebyshev - import Mathlib.NumberTheory.LSeries.PrimesInAP - import Mathlib.NumberTheory.MulChar.Lemmas --import Mathlib.Topology.EMetricSpace.BoundedVariation --import PrimeNumberTheoremAnd.Mathlib.Analysis.Asymptotics.Asymptotics - import PrimeNumberTheoremAnd.Fourier - import PrimeNumberTheoremAnd.SmoothExistence - import Mathlib.Analysis.Convolution -- --set_option lang.lemmaCmd true --set_option linter.style.header false -- ---- note: the opening of ArithmeticFunction introduces a notation σ that seems ---- impossible to hide, and hence parameters that are traditionally called σ will ---- have to be called σ' instead in this file. -+import Mathlib.MeasureTheory.Group.Circle - - open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries - Asymptotics SchwartzMap -@@ -28,31 +24,17 @@ open scoped ComplexConjugate - variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} - [RCLike 𝕜] - --blueprint_comment /-- --The Fourier transform of an absolutely integrable function $\psi: \R \to \C$ is defined by the --formula $$ \hat \psi(u) := \int_\R e(-tu) \psi(t)\ dt$$ where $e(\theta) := e^{2\pi i \theta}$. -- --Let $f: \N \to \C$ be an arithmetic function such that $\sum_{n=1}^\infty \frac{|f(n)|}{n^\sigma} < --\infty$ for all $\sigma>1$. Then the Dirichlet series --$$ F(s) := \sum_{n=1}^\infty \frac{f(n)}{n^s}$$ --is absolutely convergent for $\sigma>1$. ---/ -- - noncomputable - def nterm (f : ℕ → ℂ) (σ' : ℝ) (n : ℕ) : ℝ := if n = 0 then 0 else ‖f n‖ / n ^ σ' - --lemma nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by -+theorem nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by - by_cases h : n = 0 <;> simp [nterm, term, h] - - theorem norm_term_eq_nterm_re (s : ℂ) : - ‖term f s n‖ = nterm f (s.re) n := by -- simp only [nterm, term, apply_ite (‖·‖), norm_zero, norm_div] -- apply ite_congr rfl (fun _ ↦ rfl) -- intro h -- congr -- refine norm_natCast_cpow_of_pos (by omega) s -+ simpa only [nterm] using LSeries.norm_term_eq f s n - --lemma hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : -+theorem hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : - ∑' i, (‖term f σ' i‖₊ : ENNReal) ≠ ⊤ := by - simp_rw [ENNReal.tsum_coe_ne_top_iff_summable_coe, ← norm_toNNReal] - norm_cast -@@ -60,25 +42,19 @@ lemma hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : - convert hf σ' hσ with i - simp [nterm_eq_norm_term] - --instance instMeasurableSpace : MeasurableSpace Circle := -- inferInstanceAs <| MeasurableSpace <| Subtype _ --instance instBorelSpace : BorelSpace Circle := -- inferInstanceAs <| BorelSpace <| Subtype (· ∈ Metric.sphere (0 : ℂ) 1) -- ---- TODO - add to mathlib - attribute [fun_prop] Real.continuous_fourierChar - --lemma first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ -+theorem first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ - (‖fourierChar (-(u * ((1 : ℝ) / ((2 : ℝ) * π) * (n / x).log))) • ψ u‖ₑ : ENNReal) := by - fun_prop - --lemma first_fourier_aux2a : -+theorem first_fourier_aux2a : - (2 : ℂ) * π * -(y * (1 / (2 * π) * Real.log ((n) / x))) = -(y * ((n) / x).log) := by - calc - _ = -(y * (((2 : ℂ) * π) / (2 * π) * Real.log ((n) / x))) := by ring - _ = _ := by rw [div_self (by norm_num), one_mul] - --lemma first_fourier_aux2 (hx : 0 < x) (n : ℕ) : -+theorem first_fourier_aux2 (hx : 0 < x) (n : ℕ) : - term f σ' n * 𝐞 (-(y * (1 / (2 * π) * Real.log (n / x)))) • ψ y = - term f (σ' + y * I) n • (ψ y * x ^ (y * I)) := by - by_cases hn : n = 0 -@@ -106,31 +82,10 @@ lemma first_fourier_aux2 (hx : 0 < x) (n : ℕ) : - ring - _ = _ := by simp ; group - --set_option backward.isDefEq.respectTransparency false in --@[blueprint "first-fourier" -- (title := "first-fourier") -- (statement := /-- -- If $\psi: \R \to \C$ is integrable and $x > 0$, then for any $\sigma>1$ -- $$ \sum_{n=1}^\infty \frac{f(n)}{n^\sigma} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) = -- \int_\R F(\sigma + it) \psi(t) x^{it}\ dt.$$ -- -/) -- (proof := /-- -- By the definition of the Fourier transform, the left-hand side expands as -- $$ \sum_{n=1}^\infty \int_\R \frac{f(n)}{n^\sigma} \psi(t) e( - \frac{1}{2\pi} t \log -- \frac{n}{x})\ dt$$ -- while the right-hand side expands as -- $$ \int_\R \sum_{n=1}^\infty \frac{f(n)}{n^{\sigma+it}} \psi(t) x^{it}\ dt.$$ -- Since -- $$\frac{f(n)}{n^\sigma} \psi(t) e( - \frac{1}{2\pi} t \log \frac{n}{x}) = -- \frac{f(n)}{n^{\sigma+it}} \psi(t) x^{it}$$ -- the claim then follows from Fubini's theorem. -- -/) -- (latexEnv := "lemma")] --lemma first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+theorem first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) - (hsupp : Integrable ψ) (hx : 0 < x) (hσ : 1 < σ') : - ∑' n : ℕ, term f σ' n * (𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))) = - ∫ t : ℝ, LSeries f (σ' + t * I) * ψ t * x ^ (t * I) := by -- - calc - _ = ∑' n, term f σ' n * ∫ (v : ℝ), 𝐞 (-(v * ((1 : ℝ) / - ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -@@ -162,14 +117,12 @@ lemma first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) - rw [norm_term_eq_nterm_re] - simp - -- -- - @[continuity] --lemma continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ -+theorem continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ - - attribute [fun_prop] measurable_coe_nnreal_ennreal - --lemma second_fourier_integrable_aux1a (hσ : 1 < σ') : -+theorem second_fourier_integrable_aux1a (hσ : 1 < σ') : - IntegrableOn (fun (x : ℝ) ↦ cexp (-((x : ℂ) * ((σ' : ℂ) - 1)))) (Ici (-Real.log x)) := by - norm_cast - suffices IntegrableOn (fun (x : ℝ) ↦ (rexp (-(x * (σ' - 1))))) (Ici (-x.log)) _ from this.ofReal -@@ -178,18 +131,16 @@ lemma second_fourier_integrable_aux1a (hσ : 1 < σ') : - apply exp_neg_integrableOn_Ioi - linarith - --lemma second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : -+theorem second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : - let ν : Measure (ℝ × ℝ) := (volume.restrict (Ici (-Real.log x))).prod volume - Integrable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • - (𝐞 (Multiplicative.ofAdd (-(a * (u / (2 * π))))) : ℂ) • ψ a) ν := by - intro ν - constructor - · apply Measurable.aestronglyMeasurable -- -- `Multiplicative.ofAdd x` is definitionally `x`; unfold it by `change` since `fun_prop` -- -- does not see through it. -- change Measurable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • -- (𝐞 (-(a * (u / (2 * π)))) : ℂ) • ψ a) -- simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, smul_eq_mul] -+ change Measurable (fun p : ℝ × ℝ => -+ (rexp (-p.1 * (σ' - 1)) : ℂ) * -+ ((fourierChar (-(p.2 * (p.1 / (2 * π)))) : ℂ) * ψ p.2)) - fun_prop - · let f1 : ℝ → ENNReal := fun a1 ↦ ‖cexp (-(↑a1 * (↑σ' - 1)))‖ₑ - let f2 : ℝ → ENNReal := fun a2 ↦ ‖ψ a2‖ₑ -@@ -198,14 +149,14 @@ lemma second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable - refine (lintegral_prod_mul ?_ ?_).trans_lt ?_ <;> try fun_prop - exact ENNReal.mul_lt_top (second_fourier_integrable_aux1a hσ).2 hsupp.2 - --lemma second_fourier_integrable_aux2 (hσ : 1 < σ') : -+theorem second_fourier_integrable_aux2 (hσ : 1 < σ') : - IntegrableOn (fun (u : ℝ) ↦ cexp ((1 - ↑σ' - ↑t * I) * ↑u)) (Ioi (-Real.log x)) := by - refine (integrable_norm_iff (Measurable.aestronglyMeasurable <| by fun_prop)).mp ?_ - suffices IntegrableOn (fun a ↦ rexp (-(σ' - 1) * a)) (Ioi (-x.log)) _ by simpa [Complex.norm_exp] - apply exp_neg_integrableOn_Ioi - linarith - --lemma second_fourier_aux (hx : 0 < x) : -+theorem second_fourier_aux (hx : 0 < x) : - -(cexp (-((1 - ↑σ' - ↑t * I) * ↑(Real.log x))) / (1 - ↑σ' - ↑t * I)) = - ↑(x ^ (σ' - 1)) * (↑σ' + ↑t * I - 1)⁻¹ * ↑x ^ (↑t * I) := by - calc -@@ -217,51 +168,24 @@ lemma second_fourier_aux (hx : 0 < x) : - rw [Complex.cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt hx))] - _ = _ := by rw [ofReal_cpow hx.le]; push_cast; ring - --set_option backward.isDefEq.respectTransparency false in --@[blueprint "second-fourier" -- (title := "second-fourier") -- (statement := /-- -- If $\psi: \R \to \C$ is absolutely integrable and $x > 0$, then for any $\sigma>1$ -- $$ \int_{-\log x}^\infty e^{-u(\sigma-1)} \hat \psi(\frac{u}{2\pi})\ du = -- x^{\sigma - 1} \int_\R \frac{1}{\sigma+it-1} \psi(t) x^{it}\ dt.$$ -- -/) -- (proof := /-- -- The left-hand side expands as -- $$ \int_{-\log x}^\infty \int_\R e^{-u(\sigma-1)} \psi(t) e(-\frac{tu}{2\pi})\ dt\ du$$ -- so by Fubini's theorem it suffices to verify the identity -- \begin{align*} -- \int_{-\log x}^\infty e^{-u(\sigma-1)} e(-\frac{tu}{2\pi})\ du -- &= \int_{-\log x}^\infty e^{(it - \sigma + 1)u}\ du \\ -- &= \frac{1}{it - \sigma + 1} e^{(it - \sigma + 1)u}\ \Big|_{-\log x}^\infty \\ -- &= x^{\sigma - 1} \frac{1}{\sigma+it-1} x^{it} -- \end{align*} -- -/) -- (latexEnv := "lemma")] --lemma second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) -+theorem second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) - {x σ' : ℝ} (hx : 0 < x) (hσ : 1 < σ') : - ∫ u in Ici (-log x), Real.exp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = - (x^(σ' - 1) : ℝ) * ∫ t, (1 / (σ' + t * I - 1)) * ψ t * x^(t * I) ∂ volume := by -- - conv in ↑(rexp _) * _ => { rw [Real.fourier_real_eq, ← smul_eq_mul, ← integral_smul] } - rw [MeasureTheory.integral_integral_swap] - swap - · exact second_fourier_integrable_aux1 hcont hsupp hσ - rw [← integral_const_mul] - congr 1; ext t -- dsimp [Real.fourierChar, Circle.exp] -- -- simp_rw [mul_smul_comm, ← smul_mul_assoc, integral_mul_const] -- rw [fun (a b d : ℂ) ↦ show a * (b * (ψ t) * d) = (a * b * d) * ψ t by ring] -+ simp_rw [Circle.smul_def, smul_eq_mul, Real.fourierChar_apply, -+ ← mul_assoc, integral_mul_const] -+ rw [mul_right_comm _ (ψ t) _] - congr 1 -- conv => -- lhs -- enter [2] -- ext a -- rw [AddChar.coe_mk, Submonoid.mk_smul, smul_eq_mul] - push_cast - simp_rw [← Complex.exp_add] - have (u : ℝ) : -- 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I + -↑u * (↑σ' - 1) = (1 - σ' - t * I) * u := calc -+ -↑u * (↑σ' - 1) + 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I = (1 - σ' - t * I) * u := calc - _ = -↑u * (↑σ' - 1) + (2 * ↑π) / (2 * ↑π) * -(↑t * ↑u) * I := by ring - _ = -↑u * (↑σ' - 1) + 1 * -(↑t * ↑u) * I := by rw [div_self (by norm_num)] - _ = _ := by ring -@@ -285,107 +209,12 @@ lemma second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) - integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (second_fourier_integrable_aux2 hσ) hf] - simpa [f, f'] using second_fourier_aux hx - --blueprint_comment /-- --Now let $A \in \C$, and suppose that there is a continuous function $G(s)$ defined on --$\mathrm{Re} s \geq 1$ such that $G(s) = F(s) - \frac{A}{s-1}$ whenever $\mathrm{Re} s > 1$. --We also make the Chebyshev-type hypothesis --\begin{equation}\label{cheby} --\sum_{n \leq x} |f(n)| \ll x --\end{equation} --for all $x \geq 1$ (this hypothesis is not strictly necessary, but simplifies the arguments and --can be obtained fairly easily in applications). ---/ -+theorem one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) - --lemma one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) -- --@[blueprint "prelim-decay" -- (title := "Preliminary decay bound I") -- (statement := /-- -- If $\psi:\R \to \C$ is absolutely integrable then $$ |\hat \psi(u)| \leq \| \psi \|_1 $$ -- for all $u \in \R$. where $C$ is an absolute constant. -- -/) -- (proof := /-- Immediate from the triangle inequality. -/) -- (latexEnv := "lemma") -- (discussion := 561)] - theorem prelim_decay (ψ : ℝ → ℂ) (u : ℝ) : ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ ∫ t, ‖ψ t‖ := - VectorFourier.norm_fourierIntegral_le_integral_norm .. - --@[blueprint "prelim-decay-2" -- (title := "Preliminary decay bound II") -- (statement := /-- --If $\psi:\R \to \C$ is absolutely integrable and of bounded variation, then --$$ |\hat \psi(u)| \leq \| \psi \|_{TV} / 2\pi |u| $$ --for all non-zero $u \in \R$. -- -/) -- (proof := /-- By Lebesgue--Stiejtes integration by parts we have --$$ 2\pi i u \hat \psi(u) = \int _\R e(-tu) d\psi(t)$$ --and the claim then follows from the triangle inequality. -/) -- (latexEnv := "lemma") -- (discussion := 562)] --theorem prelim_decay_2 (ψ : ℝ → ℂ) (hψ : Integrable ψ) (hvar : BoundedVariationOn ψ Set.univ) -- (u : ℝ) (hu : u ≠ 0) : -- ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (eVariationOn ψ Set.univ).toReal / (2 * π * ‖u‖) := by sorry -- --noncomputable def AbsolutelyContinuous (f : ℝ → ℂ) : Prop := (∀ᵐ x, DifferentiableAt ℝ f x) ∧ -- ∀ a b : ℝ, f b - f a = ∫ t in a..b, deriv f t -- --@[blueprint "prelim-decay-3" -- (title := "Preliminary decay bound III") -- (statement := /-- --If $\psi:\R \to \C$ is absolutely integrable, absolutely continuous, and $\psi'$ is of bounded --variation, then --$$ |\hat \psi(u)| \leq \| \psi' \|_{TV} / (2\pi |u|)^2$$ --for all non-zero $u \in \R$. -- -/) -- (proof := /-- Should follow from previous lemma. -/) -- (proofUses := ["prelim-decay-2"]) -- (latexEnv := "lemma") -- (discussion := 563)] --theorem prelim_decay_3 (ψ : ℝ → ℂ) (hψ : Integrable ψ) -- (habscont : AbsolutelyContinuous ψ) -- (hvar : BoundedVariationOn (deriv ψ) Set.univ) (u : ℝ) (hu : u ≠ 0) : -- ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π * ‖u‖) ^ 2 := by sorry -- --@[blueprint "decay-alt" -- (title := "Decay bound, alternate form") -- (statement := /-- --If $\psi:\R \to \C$ is absolutely --integrable, absolutely continuous, and $\psi'$ is of bounded variation, then --$$ |\hat \psi(u)| \leq ( \|\psi\|_1 + \| \psi' \|_{TV} / (2\pi)^2) / (1+|u|^2)$$ --for all $u \in \R$. -/) -- (proof := /-- Should follow from previous lemmas. -/) -- (proofUses := ["prelim-decay", "prelim-decay-3", "decay"]) -- (latexEnv := "lemma") -- (discussion := 564)] --theorem decay_alt (ψ : ℝ → ℂ) (hψ : Integrable ψ) (habscont : AbsolutelyContinuous ψ) -- (hvar : BoundedVariationOn (deriv ψ) Set.univ) (u : ℝ) : -- ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ -- ((∫ t, ‖ψ t‖) + (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π) ^ 2) / -- (1 + ‖u‖ ^ 2) := by -- rw [le_div_iff₀' <| one_add_sq_pos ‖u‖] -- by_cases hu : u = 0 -- · subst hu -- simp only [norm_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, add_zero, -- one_mul] -- calc ‖𝓕 ψ 0‖ ≤ ∫ t, ‖ψ t‖ := prelim_decay ψ 0 -- _ ≤ (∫ t, ‖ψ t‖) + (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π) ^ 2 := by -- have : 0 ≤ (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π) ^ 2 := by positivity -- linarith -- · have bound1 : ‖𝓕 ψ u‖ ≤ ∫ t, ‖ψ t‖ := prelim_decay ψ u -- have bound2 : ‖𝓕 ψ u‖ ≤ (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π * ‖u‖) ^ 2 := -- prelim_decay_3 ψ hψ habscont hvar u hu -- have : (2 * π * ‖u‖) ^ 2 = (2 * π) ^ 2 * ‖u‖ ^ 2 := by ring -- calc (1 + ‖u‖ ^ 2) * ‖𝓕 ψ u‖ -- = ‖𝓕 ψ u‖ * 1 + ‖𝓕 ψ u‖ * ‖u‖ ^ 2 := by ring -- _ ≤ (∫ t, ‖ψ t‖) * 1 + -- (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π * ‖u‖) ^ 2 * ‖u‖ ^ 2 := by -- gcongr -- _ = (∫ t, ‖ψ t‖) + (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π) ^ 2 := by -- rw [mul_one, this, div_mul_eq_div_div] -- congr 1 -- rw [div_mul_eq_mul_div, div_eq_iff (pow_ne_zero 2 <| norm_ne_zero_iff.mpr hu)] -- --lemma decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by -+theorem decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by - have l1 : 0 < 1 + u ^ 2 := one_add_sq_pos _ - have l2 : 1 + u ^ 2 = ‖(1 : ℂ) + u ^ 2‖ := by - norm_cast ; simp only [Real.norm_eq_abs, abs_eq_self.2 l1.le] -@@ -399,7 +228,7 @@ lemma decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ - rw [norm_neg, F_mul, norm_mul, W21.norm] - gcongr <;> apply VectorFourier.norm_fourierIntegral_le_integral_norm - --lemma decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) -+theorem decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) - (h : ∀ t, ‖f t‖ ≤ A * (1 + t ^ 2)⁻¹) : - ∫ t, ‖f t‖ ≤ π * A := by - have l1 : Integrable (fun x ↦ A * (1 + x ^ 2)⁻¹) := integrable_inv_one_add_sq.const_mul A -@@ -420,29 +249,12 @@ theorem decay_bounds_W21 (f : W21) (hA : ∀ t, ‖f t‖ ≤ A / (1 + t ^ 2)) - change W21.norm _ * _ ≤ _ - simp_rw [W21.norm, div_eq_mul_inv, add_mul, l0] ; gcongr - --@[blueprint -- "decay" -- (title := "Decay bounds") -- (statement := /-- -- If $\psi:\R \to \C$ is $C^2$ and obeys the bounds -- $$ |\psi(t)|, |\psi''(t)| \leq A / (1 + |t|^2)$$ -- for all $t \in \R$, then -- $$ |\hat \psi(u)| \leq C A / (1+|u|^2)$$ -- for all $u \in \R$, where $C$ is an absolute constant. -- -/) -- (proof := /-- -- From two integration by parts we obtain the identity -- $$ (1+u^2) \hat \psi(u) = \int_{\bf R} (\psi(t) - \frac{u}{4\pi^2} \psi''(t)) e(-tu)\ dt.$$ -- Now apply the triangle inequality and the identity $\int_{\bf R} \frac{dt}{1+t^2}\ dt = \pi$ to -- obtain the claim with $C = \pi + 1 / 4 \pi$. -- -/) -- (latexEnv := "lemma")] --lemma decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) -+theorem decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) - (hA' : ∀ t, ‖deriv^[2] ψ t‖ ≤ A / (1 + t ^ 2)) : - ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by - exact decay_bounds_W21 ψ hA hA' u - --lemma decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by -+theorem decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by - have l1 : HasCompactSupport (fun u : ℝ => ((1 + u ^ 2) : ℝ) * ψ u) := by exact ψ.h2.mul_left - have := ψ.h1.continuous - obtain ⟨C, hC⟩ := l1.exists_bound_of_continuous (by fun_prop) -@@ -451,48 +263,37 @@ lemma decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ - simp only [norm_mul, Complex.norm_real, norm_of_nonneg (one_add_sq_pos u).le] at hC - rwa [le_div_iff₀' (one_add_sq_pos _)] - --lemma decay_bounds_cor (ψ : W21) : -+theorem decay_bounds_cor (ψ : W21) : - ∃ C : ℝ, ∀ u, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by - simpa only [div_eq_mul_inv] using ⟨_, decay_bounds_key ψ⟩ - --set_option backward.isDefEq.respectTransparency false in --@[continuity, fun_prop] lemma continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := -+@[continuity, fun_prop] theorem continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := - VectorFourier.fourierIntegral_continuous continuous_fourierChar - (by simp only [innerₗ_apply_apply, RCLike.inner_apply', conj_trivial, continuous_mul]) - ψ.hf - --lemma W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : -+theorem W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : - Integrable fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c) := by - have l1 (C) : Integrable (fun u ↦ C / (1 + (u / c) ^ 2)) volume := by -- simpa using! (integrable_inv_one_add_sq.comp_div hc).const_mul C -+ simpa only [div_eq_mul_inv] using (integrable_inv_one_add_sq.comp_div hc).const_mul C - have l2 : AEStronglyMeasurable (fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c)) volume := by - apply Continuous.aestronglyMeasurable ; fun_prop - obtain ⟨C, h⟩ := decay_bounds_cor ψ - apply @Integrable.mono' ℝ ℂ _ volume _ _ (fun u => C / (1 + (u / c) ^ 2)) (l1 C) l2 ?_ - apply Eventually.of_forall (fun x => h _) - -- -- -- -- --lemma continuous_LSeries_aux (hf : Summable (nterm f σ')) : -+theorem continuous_LSeries_aux (hf : Summable (nterm f σ')) : - Continuous fun x : ℝ => LSeries f (σ' + x * I) := by -- - have l1 i : Continuous fun x : ℝ ↦ term f (σ' + x * I) i := by - by_cases h : i = 0 - · simpa [h] using continuous_const -- · simpa [h] using! continuous_const.div (continuous_const.cpow (by fun_prop) (by simp [h])) -+ · simpa [h] using continuous_const.div₀ (continuous_const.cpow (by fun_prop) (by simp [h])) - (fun x => by simp [h]) - have l2 n (x : ℝ) : ‖term f (σ' + x * I) n‖ = nterm f σ' n := by -- by_cases h : n = 0 -- · simp [h, nterm] -- · simp [h, nterm, cpow_add _ _ (Nat.cast_ne_zero.mpr h), -- Complex.norm_natCast_cpow_of_pos (Nat.pos_of_ne_zero h)] -+ simpa using norm_term_eq_nterm_re (f := f) (n := n) (σ' + x * I) - exact continuous_tsum l1 hf (fun n x => le_of_eq (l2 n x)) - ---- Here compact support is used but perhaps it is not necessary --set_option backward.isDefEq.respectTransparency false in --lemma limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+theorem limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) - (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) (σ' : ℝ) - (hσ' : 1 < σ') : - ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -@@ -519,7 +320,6 @@ lemma limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1 - (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by - apply l7.integrable_of_hasCompactSupport - exact ψ.h2.mul_left.mul_right.mul_left.mul_left -- - simp_rw [l1 σ' hσ', l2 σ' hσ', ← integral_const_mul, ← integral_sub l4 l5] - apply integral_congr_ae - apply Eventually.of_forall -@@ -541,61 +341,60 @@ def cumsum [AddCommMonoid E] (u : ℕ → E) (n : ℕ) : E := ∑ i ∈ Finset.r - - def nabla [Sub E] (u : α → E) (n : α) : E := u (n + 1) - u n - --/- `nnabla` is the backward difference `u n - u (n+1)`; kept alongside `nabla` -- for summation-by-parts identities that prefer that orientation. -/ - def nnabla [Sub E] (u : α → E) (n : α) : E := u n - u (n + 1) - - def shift (u : α → E) (n : α) : E := u (n + 1) - --@[simp] lemma cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] -+@[simp] theorem cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] - --lemma cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : -+theorem cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : - cumsum u (n + 1) = cumsum u n + u n := by - simp [cumsum, Finset.sum_range_succ] - --@[simp] lemma nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by -+@[simp] theorem nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by - ext n ; simp [nabla, cumsum, Finset.range_add_one] - --lemma neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := -+theorem neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := - funext (fun n => by simp [cumsum]) - --lemma cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := -+theorem cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := - fun _ => Finset.sum_nonneg (fun i _ => hu i) - - omit [Sub α] in --lemma neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] -+theorem neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] - - omit [Sub α] in --@[simp] lemma nabla_mul [Ring E] {u : α → E} {c : E} : nabla (fun n => c * u n) = c • nabla u := by -+@[simp] theorem nabla_mul [Ring E] {u : α → E} {c : E} : -+ nabla (fun n => c * u n) = c • nabla u := by - ext n ; simp [nabla, mul_sub] - - omit [Sub α] in --@[simp] lemma nnabla_mul [Ring E] {u : α → E} {c : E} : -+@[simp] theorem nnabla_mul [Ring E] {u : α → E} {c : E} : - nnabla (fun n => c * u n) = c • nnabla u := by - ext n ; simp [nnabla, mul_sub] - --lemma nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by -+theorem nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by - ext n ; simp [nnabla] - - end nabla - --lemma Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : -+theorem Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : - cumsum u (n + 1) = u 0 + cumsum (shift u) n := by - simp_rw [add_comm n, cumsum, sum_range_add, sum_range_one, add_comm 1] ; rfl - --lemma Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : -+theorem Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : - shift (cumsum u) = (fun _ => u 0) + cumsum (shift u) := by - ext n ; apply Finset.sum_shift_front - --lemma Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : -+theorem Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : - cumsum u (n + 1) = cumsum u n + u n := by - simp [cumsum, Finset.range_add_one, add_comm] - --lemma Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : -+theorem Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : - shift (cumsum u) = cumsum u + u := by - ext n ; apply Finset.sum_shift_back - --lemma summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : -+theorem summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : - cumsum (a * b) (n + 1) = A (n + 1) * b n - A 0 * b 0 - - cumsum (shift A * fun i => (b (i + 1) - b i)) n := by - have l1 : ∑ x ∈ Finset.range (n + 1), A (x + 1) * b x = ∑ x ∈ Finset.range n, -@@ -608,31 +407,33 @@ lemma summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabl - mul_sub] - abel - --lemma summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : -+theorem summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : - cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - cumsum (shift (cumsum a) * nabla b) n := by -- simpa using! summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) -+ change cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - -+ cumsum (shift (cumsum a) * (fun i : ℕ => b (i + 1) - b i)) n -+ simpa using summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) - --lemma summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : -+theorem summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : - shift (cumsum (a * b)) = shift (cumsum a) * b - cumsum (shift (cumsum a) * nabla b) := by - ext n ; apply summation_by_parts' - --lemma summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : -+theorem summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : - Summable u ↔ BoundedAtFilter atTop (cumsum u) := by - have l1 : (cumsum u =O[atTop] 1) ↔ _ := isBigO_one_nat_atTop_iff - have l2 n : ‖cumsum u n‖ = cumsum u n := by simpa using cumsum_nonneg hu n - simp only [BoundedAtFilter, l1, l2] -- constructor <;> intro ⟨C, h1⟩ -+ constructor <;> intro h <;> rcases h with ⟨C, h1⟩ - · exact ⟨C, fun n => sum_le_hasSum _ (fun i _ => hu i) h1⟩ - · exact summable_of_sum_range_le hu h1 - --lemma Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : -+theorem Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : - Summable u := - summable_of_isBigO_nat hu h.isBigO - --lemma summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by -+theorem summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by - constructor <;> intro h <;> simp [huv.summable, huv.symm.summable, h] - --lemma BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : -+theorem BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : - BoundedAtFilter atTop (fun n => u n + c) ↔ BoundedAtFilter atTop u := by - have : u = fun n => (u n + c) + (-c) := by ext n ; ring - simp only [BoundedAtFilter] -@@ -640,17 +441,17 @@ lemma BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : - on_goal 1 => rw [this] - all_goals { exact h.add (const_boundedAtFilter _ _) } - --lemma BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : -+theorem BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : - BoundedAtFilter atTop (fun n => u (n + N)) ↔ BoundedAtFilter atTop u := by -- simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, -- eventually_atTop] -- constructor <;> intro ⟨C, n₀, h⟩ <;> use C -+ simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, one_mem, -+ CStarRing.norm_of_mem_unitary, mul_one, eventually_atTop] -+ constructor <;> intro hbound <;> rcases hbound with ⟨C, n₀, h⟩ <;> use C - · refine ⟨n₀ + N, fun n hn => ?_⟩ - obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' (m := N) (n := n) (by grind) - exact h _ <| Nat.add_le_add_iff_right.mp hn - · exact ⟨n₀, fun n hn => h _ (by grind)⟩ - --lemma summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : -+theorem summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : - Summable u ↔ BoundedAtFilter atTop (cumsum u) := by - obtain ⟨N, hu⟩ := eventually_atTop.mp hu - have e2 : cumsum (fun i ↦ u (i + N)) = fun n => cumsum u (n + N) - cumsum u N := by -@@ -658,7 +459,7 @@ lemma summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n - rw [← summable_nat_add_iff N, summable_iff_bounded (fun n => hu _ <| Nat.le_add_left N n), e2] - simp_rw [sub_eq_add_neg, BoundedAtFilter.add_const, BoundedAtFilter.comp_add] - --lemma bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : -+theorem bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : - BoundedAtFilter atTop u := by - simp only [BoundedAtFilter, isBigO_iff, eventually_atTop] at h ⊢ - obtain ⟨C, N, hC⟩ := h -@@ -668,24 +469,26 @@ lemma bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : - have r2 : n - 1 + 1 = n := Nat.sub_add_cancel (by omega) - simpa [r2] using hC (n - 1) r1 - --lemma dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) -+theorem dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) - (hAb : BoundedAtFilter atTop (shift (cumsum a) * b)) (hbb : ∀ᶠ n in atTop, b (n + 1) ≤ b n) - (h : Summable (shift (cumsum a) * nnabla b)) : Summable (a * b) := by - have l1 : ∀ᶠ n in atTop, 0 ≤ (shift (cumsum a) * nnabla b) n := by - filter_upwards [hbb] with n hb -- exact mul_nonneg (by simpa [shift] using! Finset.sum_nonneg (fun n _ ↦ ha n)) (sub_nonneg.mpr hb) -+ exact mul_nonneg (by simpa [shift] using cumsum_nonneg ha (n + 1)) (sub_nonneg.mpr hb) - rw [summable_iff_bounded (mul_nonneg ha hb)] - rw [summable_iff_bounded' l1] at h - apply bounded_of_shift - simpa only [summation_by_parts'', sub_eq_add_neg, neg_cumsum, ← mul_neg, neg_nabla] - using hAb.add h - --lemma exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : -+theorem exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : - ∃ v : ℕ → ℝ, range v ⊆ range u ∧ Antitone v ∧ v =ᶠ[atTop] u := by - obtain ⟨N, hN⟩ := eventually_atTop.mp hu - let v (n : ℕ) := u (if n < N then N else n) - refine ⟨v, ?_, ?_, ?_⟩ -- · exact fun x ⟨n, hn⟩ => ⟨if n < N then N else n, hn⟩ -+ · intro x hx -+ rcases hx with ⟨n, hn⟩ -+ exact ⟨if n < N then N else n, hn⟩ - · refine antitone_nat_of_succ_le (fun n => ?_) - by_cases h : n < N - · by_cases h' : n + 1 < N <;> simp [v, h, h'] -@@ -696,7 +499,7 @@ lemma exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u - · have : ∀ᶠ n in atTop, ¬(n < N) := by simpa using ⟨N, fun b hb => by linarith⟩ - filter_upwards [this] with n hn ; simp [v, hn] - --lemma summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by -+theorem summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by - let u (n : ℕ) := (n * (Real.log n) ^ 2)⁻¹ - have l7 : ∀ᶠ n : ℕ in atTop, 1 ≤ Real.log n := - tendsto_atTop.mp (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) 1 -@@ -715,26 +518,26 @@ lemma summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2) - simp only [l5, mul_inv_rev, Nat.cast_pow, Nat.cast_ofNat, log_pow, u] - field_simp - --lemma tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : -+theorem tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : - Tendsto (fun x => a * x + b) atTop atTop := - tendsto_atTop_add_const_right _ b (tendsto_id.const_mul_atTop ha) - --lemma isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} -+theorem isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} - (hf : Tendsto f atTop atTop) : (fun _ => a) =o[atTop] f := by - simp [tendsto_norm_atTop_atTop.comp hf] - --lemma isBigO_pow_pow_of_le {m n : ℕ} (h : m ≤ n) : -+theorem isBigO_pow_pow_of_le {m n : ℕ} (h : m ≤ n) : - (fun x : ℝ => x ^ m) =O[atTop] (fun x : ℝ => x ^ n) := by - apply IsBigO.of_bound 1 - filter_upwards [eventually_ge_atTop 1] with x l1 - simpa [abs_eq_self.mpr (zero_le_one.trans l1)] using pow_le_pow_right₀ l1 h - --lemma isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by -+theorem isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by - apply IsLittleO.add - · apply IsLittleO.const_mul_left ; simpa using isLittleO_pow_pow_atTop_of_lt (𝕜 := ℝ) one_lt_two - · apply isLittleO_const_of_tendsto_atTop _ <| tendsto_pow_atTop (by linarith) - --lemma log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : -+theorem log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : - (fun x => Real.log (a * x + b)) =O[atTop] Real.log := by - apply IsBigO.of_bound (2 : ℕ) - have l2 : ∀ᶠ x : ℝ in atTop, 0 ≤ log x := tendsto_atTop.mp tendsto_log_atTop 0 -@@ -748,21 +551,22 @@ lemma log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : - simpa [abs_eq_self.mpr l2, abs_eq_self.mpr l3, Real.log_pow] using - Real.log_le_log (by linarith) l1 - --lemma isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : -+theorem isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : - Real.log =O[atTop] (fun x => Real.log (a * x + b)) := by -- convert! (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto -+ convert (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto - (tendsto_mul_add_atTop (b := b) ha) using 1 -- ext x -- simp only [Function.comp_apply] -- congr -- field_simp -- simp -+ · ext x -+ simp only [Function.comp_apply] -+ congr -+ field_simp -+ simp -+ · rfl - --lemma log_isbigo_log_div {d : ℝ} (hb : 0 < d) : -+theorem log_isbigo_log_div {d : ℝ} (hb : 0 < d) : - (fun n ↦ Real.log n) =O[atTop] (fun n ↦ Real.log (n / d)) := by - convert isBigO_log_mul_add (inv_pos.mpr hb) 0 using 1; simp only [add_zero]; field_simp - --lemma Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : -+theorem Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : - f =O[atTop] (f + g) := by - rw [isLittleO_iff] at h ; specialize h (c := 2⁻¹) (by norm_num) - rw [isBigO_iff''] -@@ -774,11 +578,11 @@ lemma Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop - _ ≤ |(|f x| - |g x|)| := le_abs_self _ - _ ≤ _ := by rw [← sub_neg_eq_add, ← abs_neg (g x)] ; exact abs_abs_sub_abs_le (f x) (-g x) - --lemma Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : -- (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := by -- simpa [pow_two] using h.mul h -+theorem Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : -+ (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := -+ h.pow 2 - --lemma log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : -+theorem log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : - (fun x ↦ Real.log x ^ 2) =O[atTop] (fun x ↦ a + Real.log (x / b) ^ 2) := by - apply (log_isbigo_log_div hb).sq.trans ; simp_rw [add_comm a] - refine IsBigO.add_isLittleO_right <| isLittleO_const_of_tendsto_atTop _ ?_ -@@ -789,9 +593,13 @@ theorem log_add_div_isBigO_log (a : ℝ) {b : ℝ} (hb : 0 < b) : - (fun x ↦ Real.log ((x + a) / b)) =O[atTop] fun x ↦ Real.log x := by - convert log_mul_add_isBigO_log (inv_pos.mpr hb) (a / b) using 3 ; ring - --lemma log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by -+theorem log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by - have l1 : ContinuousOn Real.log (Icc x (x + 1)) := by -- apply continuousOn_log.mono ; intro t ⟨h1, _⟩ ; simp ; linarith -+ apply continuousOn_log.mono -+ intro t ht -+ have h1 := ht.1 -+ simp -+ linarith - have l2 t (ht : t ∈ Ioo x (x + 1)) : HasDerivAt Real.log t⁻¹ t := - Real.hasDerivAt_log (by linarith [ht.1]) - obtain ⟨t, ⟨ht1, _⟩, htx⟩ := exists_hasDerivAt_eq_slope Real.log (·⁻¹) (by linarith) l1 l2 -@@ -799,22 +607,21 @@ lemma log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻ - rw [nabla, ← htx, inv_le_inv₀ (by linarith) hx] - exact ht1.le - --lemma nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by -+theorem nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by - apply IsBigO.of_bound 1 - filter_upwards [eventually_gt_atTop 0] with x l1 - have l2 : log x ≤ log (x + 1) := log_le_log l1 (by linarith) - simpa [nabla, abs_eq_self.mpr l1.le, abs_eq_self.mpr (sub_nonneg.mpr l2)] using - log_add_one_sub_log_le l1 - --lemma nabla_log {b : ℝ} (hb : 0 < b) : -+theorem nabla_log {b : ℝ} (hb : 0 < b) : - nabla (fun x => Real.log (x / b)) =O[atTop] (fun x => 1 / x) := by - refine EventuallyEq.trans_isBigO ?_ nabla_log_main - filter_upwards [eventually_gt_atTop 0] with x l2 - rw [nabla, log_div (by linarith) (by linarith), log_div l2.ne.symm (by linarith), nabla] ; ring - --lemma nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : -+theorem nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : - nabla (fun x => x * (a + Real.log (x / b) ^ 2)) =O[atTop] (fun x => Real.log x ^ 2) := by -- - have l1 : nabla (fun n => n * (a + Real.log (n / b) ^ 2)) = fun n => - a + Real.log ((n + 1) / b) ^ 2 + - (n * (Real.log ((n + 1) / b) ^ 2 - Real.log (n / b) ^ 2)) := by -@@ -828,25 +635,24 @@ lemma nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : - filter_upwards [eventually_ge_atTop 1] with x hx using by field_simp - have l5 : (fun n ↦ n * (Real.log n * (1 / n))) =O[atTop] (fun n ↦ (Real.log n) ^ 2) := - e2.trans_isBigO -- (by simpa using! (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) -- -+ (by simpa [Function.comp_def] using -+ (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) - simp_rw [l1, _root_.sq_sub_sq] - exact ((l2.add l3).add (isBigO_refl (·) atTop |>.mul (l4.mul (nabla_log hb)) |>.trans l5)) - --lemma nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : -+theorem nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : - Tendsto (fun x => x * (a + Real.log (x / b) ^ 2)) atTop atTop := - tendsto_id.atTop_mul_atTop₀ <| tendsto_atTop_add_const_left _ _ <| - (tendsto_pow_atTop two_ne_zero).comp <| tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb - --lemma nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : -+theorem nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : - ∀ᶠ x in atTop, 0 < x * (a + Real.log (x / b) ^ 2) := - (nnabla_bound_aux1 a hb).eventually (eventually_gt_atTop 0) - --lemma Real.log_eventually_gt_atTop (a : ℝ) : -+theorem Real.log_eventually_gt_atTop (a : ℝ) : - ∀ᶠ x in atTop, a < Real.log x := - Real.tendsto_log_atTop.eventually (eventually_gt_atTop a) - --/-- Should this be a gcongr lemma? -/ - @[local gcongr] - theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : - ‖x‖ ≤ ‖y‖ := by -@@ -854,13 +660,11 @@ theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : - apply abs_le_abs hxy - linarith - --lemma nnabla_bound_aux {x : ℝ} (hx : 0 < x) : -+theorem nnabla_bound_aux {x : ℝ} (hx : 0 < x) : - nnabla (fun n ↦ 1 / (n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2))) =O[atTop] - (fun n ↦ 1 / (Real.log n ^ 2 * n ^ 2)) := by -- - let d n : ℝ := n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2) - change (fun x_1 ↦ nnabla (fun n ↦ 1 / d n) x_1) =O[atTop] _ -- - have l2 : ∀ᶠ n in atTop, 0 < d n := (nnabla_bound_aux2 ((2 * π) ^ 2) hx) - have l3 : ∀ᶠ n in atTop, 0 < d (n + 1) := - (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_id).eventually l2 -@@ -869,7 +673,6 @@ lemma nnabla_bound_aux {x : ℝ} (hx : 0 < x) : - filter_upwards [l2, l3] with n l2 l3 - rw [nnabla, one_div, one_div, inv_sub_inv l2.ne.symm l3.ne.symm, div_eq_mul_inv, mul_inv, - mul_assoc] -- - have l4 : (fun n => (d n)⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by - apply IsBigO.inv_rev - · refine (isBigO_refl _ _).mul <| (log_sq_isbigo_mul hx) -@@ -889,17 +692,16 @@ lemma nnabla_bound_aux {x : ℝ} (hx : 0 < x) : - filter_upwards [l2, l3, e3] with n e1 e2 e3 - simp_rw [one_mul] - gcongr -- - have l6 : (fun n => d (n + 1) - d n) =O[atTop] (fun n => (Real.log n) ^ 2) := by -- simpa [d, nabla] using! (nnabla_mul_log_sq ((2 * π) ^ 2) hx) -- -+ change nabla (fun n : ℝ => n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2)) -+ =O[atTop] (fun n => (Real.log n) ^ 2) -+ exact nnabla_mul_log_sq ((2 * π) ^ 2) hx - apply EventuallyEq.trans_isBigO l1 -- - apply ((l6.mul l4).mul l5).trans_eventuallyEq - filter_upwards [eventually_ge_atTop 2, Real.log_eventually_gt_atTop 0] with n hn hn' - field_simp - --lemma nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : -+theorem nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : - nnabla (fun n => C / (1 + (Real.log (n / x) / (2 * π)) ^ 2) / n) =O[atTop] - (fun n => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by - field_simp -@@ -907,11 +709,8 @@ lemma nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : - apply IsBigO.const_mul_left - simpa [div_eq_mul_inv, mul_pow, mul_comm] using nnabla_bound_aux hx - --def chebyWith (C : ℝ) (f : ℕ → ℂ) : Prop := ∀ n, cumsum (‖f ·‖) n ≤ C * n -- --def cheby (f : ℕ → ℂ) : Prop := ∃ C, chebyWith C f -- --lemma cheby.bigO (h : cheby f) : cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by -+theorem cheby.bigO (h : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by - have l1 : 0 ≤ cumsum (‖f ·‖) := cumsum_nonneg (fun _ => norm_nonneg _) - obtain ⟨C, hC⟩ := h - apply isBigO_of_le' (c := C) atTop -@@ -919,12 +718,12 @@ lemma cheby.bigO (h : cheby f) : cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → - rw [Real.norm_eq_abs, abs_eq_self.mpr (l1 n)] - simpa using hC n - --lemma limiting_fourier_lim1_aux (hcheby : cheby f) (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : -+theorem limiting_fourier_lim1_aux -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : - Summable fun n ↦ ‖f n‖ / ↑n * (C / (1 + (1 / (2 * π) * Real.log (↑n / x)) ^ 2)) := by -- - let a (n : ℕ) := (C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2) / ↑n) -- replace hcheby := hcheby.bigO -- -+ replace hcheby := cheby.bigO hcheby - have l1 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n : ℕ => (↑(n + 1) : ℝ)) := - hcheby.comp_tendsto <| tendsto_add_atTop_nat 1 - have l2 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n => (n : ℝ)) := -@@ -943,10 +742,13 @@ lemma limiting_fourier_lim1_aux (hcheby : cheby f) (hx : 0 < x) (C : ℝ) (hC : - apply le_add_of_le_of_nonneg le_rfl - positivity - have l3 : a =O[atTop] (fun n => 1 / (n : ℝ)) := by -- simpa [a] using! IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) -+ convert IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) using 1 -+ · ext n -+ simp [a, div_eq_mul_inv] -+ · ext n -+ simp - have l4 : nnabla a =O[atTop] (fun n : ℕ => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by -- convert (nnabla_bound C hx).natCast ; simp [nnabla, a] -- -+ convert (nnabla_bound C hx).natCast_atTop ; simp [nnabla, a] - simp_rw [div_mul_eq_mul_div, mul_div_assoc, one_mul] - apply dirichlet_test' - · intro n ; exact norm_nonneg _ -@@ -974,11 +776,12 @@ lemma limiting_fourier_lim1_aux (hcheby : cheby f) (hx : 0 < x) (C : ℝ) (hC : - grind - field_simp - --theorem limiting_fourier_lim1 (hcheby : cheby f) (ψ : W21) (hx : 0 < x) : -+theorem limiting_fourier_lim1 -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (ψ : W21) (hx : 0 < x) : - Tendsto (fun σ' : ℝ ↦ - ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x))) (𝓝[>] 1) - (𝓝 (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x)))) := by -- - obtain ⟨C, hC⟩ := decay_bounds_cor ψ - have : 0 ≤ C := by simpa using (norm_nonneg _).trans (hC 0) - refine tendsto_tsum_of_dominated_convergence -@@ -994,7 +797,7 @@ theorem limiting_fourier_lim1 (hcheby : cheby f) (ψ : W21) (hx : 0 < x) : - rw [norm_mul, ← nterm_eq_norm_term] - refine mul_le_mul ?_ (hC _) (norm_nonneg _) (div_nonneg (norm_nonneg _) (Nat.cast_nonneg _)) - by_cases h : n = 0 <;> simp only [nterm, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, le_refl] -- have : 1 ≤ (n : ℝ) := by simpa using! Nat.pos_iff_ne_zero.mpr h -+ have : 1 ≤ (n : ℝ) := by exact_mod_cast (show 1 ≤ n by omega) - refine div_le_div₀ (norm_nonneg _) le_rfl (by simpa [Nat.pos_iff_ne_zero]) ?_ - simpa using Real.rpow_le_rpow_of_exponent_le this hσ'.le - -@@ -1009,7 +812,6 @@ theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : - Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * - ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) - (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by -- - obtain ⟨C, hC⟩ := decay_bounds_cor ψ - apply Tendsto.mul - · suffices h : Tendsto (fun σ' : ℝ ↦ ofReal (x ^ (1 - σ'))) (𝓝[>] 1) (𝓝 1) by -@@ -1028,7 +830,9 @@ theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : - continuity - · apply eventually_of_mem (U := Ioo 1 2) - · apply Ioo_mem_nhdsGT_of_mem ; simp -- · intro σ' ⟨h1, h2⟩ -+ · intro σ' hσ -+ have h1 := hσ.1 -+ have h2 := hσ.2 - rw [ae_restrict_iff' measurableSet_Ici] - apply Eventually.of_forall - intro t (ht : - Real.log x ≤ t) -@@ -1063,11 +867,9 @@ theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : - theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : - Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) - (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by -- - by_cases hh : tsupport ψ = ∅ - · simp [tsupport_eq_empty_iff.mp hh] - obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh -- - let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) - have l1 : IsCompact S := by - refine Metric.isCompact_iff_isClosed_bounded.mpr ⟨?_, ?_⟩ -@@ -1079,7 +881,6 @@ theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 - obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn l4 l3 - let MG := ‖G z‖ - let bound (a : ℝ) : ℝ := MG * ‖ψ a‖ -- - apply tendsto_integral_filter_of_dominated_convergence (bound := bound) - · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ; intro u hu - apply Continuous.aestronglyMeasurable -@@ -1099,7 +900,6 @@ theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 - exact mul_le_mul_of_nonneg_right r2 (norm_nonneg _) - · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) - simp at this ; simp [this, bound] -- - · suffices h : Continuous bound by exact h.integrable_of_hasCompactSupport ψ.h2.norm.mul_left - have := ψ.h1.continuous ; fun_prop - · apply Eventually.of_forall ; intro t -@@ -1109,125 +909,70 @@ theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 - · exact ((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds - · exact eventually_nhdsWithin_of_forall (fun x (hx : 1 < x) => by simp [hx.le]) - --@[blueprint -- "limiting" -- (title := "Limiting Fourier identity") -- (statement := /-- -- If $\psi: \R \to \C$ is $C^2$ and compactly supported and $x \geq 1$, then -- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) -- - A \int_{-\log x}^\infty \hat \psi(\frac{u}{2\pi})\ du -- = \int_\R G(1+it) \psi(t) x^{it}\ dt.$$ -- -/) -- (proof := /-- -- By Lemma \ref{first-fourier} and Lemma \ref{second-fourier}, we know that for any $\sigma>1$, -- we have -- $$ \sum_{n=1}^\infty \frac{f(n)}{n^\sigma} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) -- - A x^{1-\sigma} \int_{-\log x}^\infty e^{-u(\sigma-1)} \hat \psi(\frac{u}{2\pi})\ du -- = \int_\R G(\sigma+it) \psi(t) x^{it}\ dt.$$ -- Now take limits as $\sigma \to 1$ using dominated convergence together with \eqref{cheby} -- and Lemma \ref{decay} to obtain the result. -- -/) -- (latexEnv := "lemma")] --lemma limiting_fourier (hcheby : cheby f) -+theorem limiting_fourier (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) - (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) - (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : - ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - - A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = - ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by -- - have l1 := limiting_fourier_lim1 hcheby ψ (by linarith) - have l2 := limiting_fourier_lim2 A ψ hx - have l3 := limiting_fourier_lim3 hG ψ hx - apply tendsto_nhds_unique_of_eventuallyEq (l1.sub l2) l3 -- simpa [eventuallyEq_nhdsWithin_iff] using! Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) -- -- -- -- --set_option backward.isDefEq.respectTransparency false in --lemma limiting_cor_aux {f : ℝ → ℂ} : Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by -+ simpa [eventuallyEq_nhdsWithin_iff, W21.ofCS2] using -+ Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) - -+theorem limiting_cor_aux {f : ℝ → ℂ} : -+ Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by - have l1 : ∀ᶠ x : ℝ in atTop, ∀ t : ℝ, x ^ (t * I) = exp (log x * t * I) := by - filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' t - rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx'] ; ring_nf -- - have l2 : ∀ᶠ x : ℝ in atTop, ∫ t, f t * x ^ (t * I) = ∫ t, f t * exp (log x * t * I) := by - filter_upwards [l1] with x hx - refine integral_congr_ae (Eventually.of_forall (fun x => by simp [hx])) -- - simp_rw [tendsto_congr' l2] - convert_to Tendsto (fun x => 𝓕 f (-Real.log x / (2 * π))) atTop (𝓝 0) -- · ext ; congr ; ext -- simp only [← ofReal_mul, mul_comm (f _), fourierChar, Circle.exp, ContinuousMap.coe_mk, -- innerₗ_apply_apply, RCLike.inner_apply, conj_trivial, AddChar.coe_mk, mul_neg, ofReal_neg, -- neg_mul] -- congr -- rw [← neg_mul] ; congr ; norm_cast ; field_simp -+ · funext x -+ rw [Real.fourier_real_eq_integral_exp_smul] -+ apply integral_congr_ae -+ filter_upwards [] with t -+ have hphase : -2 * π * t * (-Real.log x / (2 * π)) = Real.log x * t := by -+ field_simp -+ rw [hphase, ofReal_mul, smul_eq_mul] -+ exact mul_comm _ _ - refine (Real.zero_at_infty_fourier f).comp <| Tendsto.mono_right ?_ _root_.atBot_le_cocompact - exact (tendsto_neg_atBot_iff.mpr tendsto_log_atTop).atBot_mul_const (inv_pos.mpr two_pi_pos) - --@[blueprint -- "limiting-cor" -- (title := "Corollary of limiting identity") -- (statement := /-- -- With the hypotheses as above, we have -- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) -- = A \int_{-\infty}^\infty \hat \psi(\frac{u}{2\pi})\ du + o(1)$$ -- as $x \to \infty$. -- -/) -- (proof := /-- -- Immediate from the Riemann-Lebesgue lemma, and also noting that -- $\int_{-\infty}^{-\log x} \hat \psi(\frac{u}{2\pi})\ du = o(1)$. -- -/) -- (latexEnv := "corollary")] --lemma limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) -+theorem limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) - (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : - Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - - A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by -- - apply limiting_cor_aux.congr' - filter_upwards [eventually_ge_atTop 1] with x hx using - limiting_fourier hcheby hG hG' hf ψ hx |>.symm - -- -- -- -- --@[blueprint -- "smooth-ury" -- (title := "Smooth Urysohn lemma") -- (statement := /-- -- If $I$ is a closed interval contained in an open interval $J$, then there exists a smooth -- function $\Psi: \R \to \R$ with $1_I \leq \Psi \leq 1_J$. -- -/) -- (proof := /-- -- A standard analysis lemma, which can be proven by convolving $1_K$ with a smooth approximation -- to the identity for some interval $K$ between $I$ and $J$. Note that we have -- ``SmoothBumpFunction''s on smooth manifolds in Mathlib, so this shouldn't be too hard... -- -/) -- (latexEnv := "lemma")] --lemma smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, -+theorem smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, - (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ - Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 := by -- - obtain ⟨ψ, l1, l2, l3, l4, -⟩ := smooth_urysohn_support_Ioo h1 h3 - refine ⟨ψ, l1, l2, l3, l4⟩ - -- -- - noncomputable def exists_trunc : trunc := by - choose ψ h1 h2 h3 h4 using smooth_urysohn (-2) (-1) (1) (2) (by linarith) (by linarith) - exact ⟨⟨ψ, h1.of_le (by norm_cast), h2⟩, h3, h4⟩ - --lemma one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by -- match n with -- | 0 => simp -- | 1 => simp -- | n + 2 => { norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith } -+theorem one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by -+ cases n with -+ | zero => simp -+ | succ n => -+ cases n with -+ | zero => simp -+ | succ n => norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith - --lemma quadratic_pos (a b c x : ℝ) (ha : 0 < a) (hΔ : discrim a b c < 0) : -+theorem quadratic_pos (a b c x : ℝ) (ha : 0 < a) (hΔ : discrim a b c < 0) : - 0 < a * x ^ 2 + b * x + c := by - have l1 : a * x ^ 2 + b * x + c = a * (x + b / (2 * a)) ^ 2 - discrim a b c / (4 * a) := by - simp only [discrim]; field_simp; ring -@@ -1238,66 +983,71 @@ noncomputable def pp (a x : ℝ) : ℝ := a ^ 2 * (x + 1) ^ 2 + (1 - a) * (1 + a - - noncomputable def pp' (a x : ℝ) : ℝ := a ^ 2 * (2 * (x + 1)) - --lemma pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by -+theorem pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by - simp only [pp] - have : 0 < 1 - a := by linarith [ha.2] - have : 0 < 1 + a := by linarith [ha.1] - positivity - --lemma pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by -+theorem pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by - unfold pp pp' - simpa using hasDerivAt_id x |>.add_const 1 |>.pow 2 |>.const_mul _ - --lemma pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by -+theorem pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by - ext x ; exact pp_deriv a x |>.deriv - --lemma pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by -- simpa using! hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) -+theorem pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by -+ change HasDerivAt (fun y : ℝ => a ^ 2 * (2 * (y + 1))) (a ^ 2 * 2) x -+ convert hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) -+ using 1 <;> first | rfl | ring - --lemma pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by -+theorem pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by - ext x ; exact pp'_deriv a x |>.deriv - - noncomputable def hh (a t : ℝ) : ℝ := (t * (1 + (a * log t) ^ 2))⁻¹ - - noncomputable def hh' (a t : ℝ) : ℝ := - pp a (log t) * hh a t ^ 2 - --lemma hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity -+theorem hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity - --lemma hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by -+theorem hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by - by_cases h0 : t = 0 - · simp [hh, h0] - replace ht : 0 < t := lt_of_le_of_ne ht (by tauto) - unfold hh - rw [abs_inv, inv_le_inv₀ (by positivity) ht, abs_mul, abs_eq_self.mpr ht.le] -- convert_to! t * 1 ≤ _ -+ convert_to t * 1 ≤ _ - · simp - apply mul_le_mul le_rfl ?_ zero_le_one ht.le - rw [abs_eq_self.mpr (by positivity)] - simp only [le_add_iff_nonneg_right] - positivity - --lemma hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by -+theorem hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by - have e1 : t * (1 + (a * log t) ^ 2) ≠ 0 := mul_ne_zero ht (_root_.ne_of_lt (by positivity)).symm - have l5 : HasDerivAt (fun t : ℝ => log t) t⁻¹ t := Real.hasDerivAt_log ht - have l4 : HasDerivAt (fun t : ℝ => a * log t) (a * t⁻¹) t := l5.const_mul _ - have l3 : HasDerivAt (fun t : ℝ => (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := by -- convert! l4.pow 2 using 1 ; ring -+ convert l4.pow 2 using 1 ; ring - have l2 : HasDerivAt (fun t : ℝ => 1 + (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := - l3.const_add _ - have l1 : HasDerivAt (fun t : ℝ => t * (1 + (a * log t) ^ 2)) - (1 + 2 * a ^ 2 * log t + a ^ 2 * log t ^ 2) t := by -- convert! (hasDerivAt_id' t).mul l2 using 1; field_simp; ring -- convert! l1.inv e1 using 1; simp only [hh', pp, hh]; field_simp; ring -+ convert (hasDerivAt_id' t).mul l2 using 1; field_simp; ring -+ apply (l1.inv e1).congr_deriv -+ dsimp only [hh', pp, hh] -+ simp only [div_eq_mul_inv, inv_pow] -+ ring - --lemma hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := -+theorem hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := - fun t (ht : 0 < t) => (hh_deriv a ht.ne.symm).continuousAt.continuousWithinAt - --lemma hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by -+theorem hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by - have := pp_pos ha (log x) - simp only [hh', neg_mul, Left.neg_nonpos_iff, ge_iff_le] - positivity - --lemma hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by -+theorem hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by - have l1 x (hx : x ∈ interior (Ioi 0)) : - HasDerivWithinAt (hh a) (hh' a x) (interior (Ioi 0)) x := by - have : x ≠ 0 := by contrapose! hx ; simp [hx] -@@ -1307,17 +1057,17 @@ lemma hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) - - noncomputable def gg (x i : ℝ) : ℝ := 1 / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ - --lemma gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by -+theorem gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by - simp only [gg, hh] - field_simp - --lemma gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by -+theorem gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by - simp only [gg_of_hh hx.ne.symm, one_div, mul_inv_rev, abs_mul] - apply mul_le_mul le_rfl (hh_le _ _ (by positivity)) (by positivity) (by positivity) |>.trans - (le_of_eq ?_) - simp [abs_inv, abs_eq_self.mpr hx.le] ; field_simp - --lemma gg_le_one (i : ℕ) : gg x i ≤ 1 := by -+theorem gg_le_one (i : ℕ) : gg x i ≤ 1 := by - by_cases hi : i = 0 <;> simp only [gg, hi, CharP.cast_eq_zero, div_zero, one_div, mul_inv_rev, - zero_div, Real.log_zero, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, - add_zero, inv_one, mul_one, zero_le_one] -@@ -1326,13 +1076,13 @@ lemma gg_le_one (i : ℕ) : gg x i ≤ 1 := by - simp only [le_add_iff_nonneg_right] ; positivity - rw [← mul_inv] ; apply inv_le_one_of_one_le₀ ; simpa using mul_le_mul l1 l2 zero_le_one (by simp) - --lemma one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by -+theorem one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by - constructor - · trans 0 - · linarith - · positivity - · rw [div_lt_iff₀ (by positivity)] -- convert_to! 1 * 1 < 2 * π -+ convert_to 1 * 1 < 2 * π - · simp - · simp - apply mul_lt_mul one_lt_two ?_ zero_lt_one zero_le_two -@@ -1340,22 +1090,22 @@ lemma one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by - · exact one_le_two - · exact two_le_pi - --lemma sum_telescopic (a : ℕ → ℝ) (n : ℕ) : ∑ i ∈ Finset.range n, (a (i + 1) - a i) = a n - a 0 := by -+theorem sum_telescopic (a : ℕ → ℝ) (n : ℕ) : -+ ∑ i ∈ Finset.range n, (a (i + 1) - a i) = a n - a 0 := by - apply Finset.sum_range_sub - --lemma cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+theorem cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) - (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : - ∑ i ∈ Finset.range n, f i * g i ≤ g (n - 1) * (C * n) + (C * (↑(n - 1 - 1) + 1) * g 0 - - C * (↑(n - 1 - 1) + 1) * g (n - 1) - - ((n - 1 - 1) • (C * g 0) - ∑ x ∈ Finset.range (n - 1 - 1), C * g (x + 1))) := by -- - have l1 (n : ℕ) : - (g n - g (n + 1)) * ∑ i ∈ Finset.range (n + 1), f i ≤ (g n - g (n + 1)) * (C * (n + 1)) := by -- apply mul_le_mul le_rfl (by simpa using! hf' (n + 1)) (Finset.sum_nonneg (fun n _ ↦ hf n)) ?_ -+ apply mul_le_mul le_rfl (by simpa only [cumsum, Nat.cast_add, Nat.cast_one] using hf' (n + 1)) -+ (Finset.sum_nonneg (fun i _ => hf i)) ?_ - simp only [sub_nonneg] ; apply hg' ; simp - have l2 (x : ℕ) : C * (↑(x + 1) + 1) - C * (↑x + 1) = C := by simp ; ring -- have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun n _ ↦ hf n) -- -+ have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun i _ => hf i) - convert_to ∑ i ∈ Finset.range n, (g i) • (f i) ≤ _ - · simp [mul_comm] - rw [Finset.sum_range_by_parts, sub_eq_add_neg, ← Finset.sum_neg_distrib] -@@ -1363,20 +1113,20 @@ lemma cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) - apply _root_.add_le_add - · exact mul_le_mul le_rfl (hf' n) (l3 n) (hg _) - · apply Finset.sum_le_sum (fun n _ => l1 n) |>.trans -- convert_to! ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ -+ convert_to ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ - · congr ; ext i ; simp ; ring - rw [Finset.sum_range_by_parts] - simp_rw [Finset.sum_range_sub', l2, smul_sub, smul_eq_mul, Finset.sum_sub_distrib, - Finset.sum_const, Finset.card_range] - apply le_of_eq ; ring_nf - --lemma sum_range_succ (a : ℕ → ℝ) (n : ℕ) : -+theorem sum_range_succ (a : ℕ → ℝ) (n : ℕ) : - ∑ i ∈ Finset.range n, a (i + 1) = (∑ i ∈ Finset.range (n + 1), a i) - a 0 := by - have := Finset.sum_range_sub a n - rw [Finset.sum_sub_distrib, sub_eq_iff_eq_add] at this - rw [Finset.sum_range_succ, this] ; ring - --lemma cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+theorem cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) - (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : - ∑ i ∈ Finset.range n, f i * g i ≤ - C * n * g (n - 1) -@@ -1387,27 +1137,37 @@ lemma cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) - simp only [nsmul_eq_mul, ← Finset.mul_sum, sum_range_succ] at this - convert this using 1 ; unfold cumsum ; ring - --lemma cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+theorem cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) - (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) (hn : 2 ≤ n) : - cumsum (f * g) n ≤ C * cumsum g n := by -- convert! cancel_aux' hf hg hf' hg' n using 1 -- match n with -- | n + 2 => simp only [cumsum_succ] ; push_cast ; ring -- --lemma cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) -+ change (∑ i ∈ Finset.range n, f i * g i) ≤ C * cumsum g n -+ refine (cancel_aux' hf hg hf' hg' n).trans_eq ?_ -+ have hindex : n - 1 - 1 + 1 = n - 1 := by omega -+ have hcast : (n : ℝ) = ↑(n - 1) + 1 := by -+ exact_mod_cast (show n = (n - 1) + 1 by omega) -+ have hcast' : (↑(n - 1 - 1) : ℝ) + 1 = ↑(n - 1) := by -+ exact_mod_cast hindex -+ have hsum : cumsum g n = cumsum g (n - 1) + g (n - 1) := by -+ conv_lhs => rw [show n = (n - 1) + 1 by omega] -+ exact cumsum_succ (n - 1) -+ rw [hindex, hcast', hcast, hsum] -+ ring -+ -+theorem cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) - (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : - cumsum (f * g) n ≤ C * cumsum g n := by -- match n with -- | 0 => simp [cumsum] -- | 1 => specialize hg 0 ; specialize hf' 1 ; simp only [cumsum, Finset.range_one, -- Finset.sum_singleton, hf0, Nat.cast_one, mul_one, Pi.zero_apply, Pi.mul_apply, zero_mul, -- ge_iff_le] at hf' hg ⊢ ; positivity -- | n + 2 => convert! cancel_aux' hf hg hf' hg' (n + 2) using 1 ; simp [cumsum_succ] ; ring -+ cases n with -+ | zero => simp [cumsum] -+ | succ n => -+ cases n with -+ | zero => -+ have hC : 0 ≤ C := by simpa [cumsum, hf0] using hf' 1 -+ simpa [cumsum, hf0] using mul_nonneg hC (hg 0) -+ | succ n => exact cancel_main hf hg hf' hg' (n + 2) (by omega) - - theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneOn f (Ioc x₀ (x₀ + n))) - (hfi : IntegrableOn f (Icc x₀ (x₀ + n))) : - (∑ i ∈ Finset.range n, f (x₀ + ↑(i + 1))) ≤ ∫ x in x₀..x₀ + n, f x := by -- - cases n with simp only [Nat.cast_add, Nat.cast_one, CharP.cast_eq_zero, add_zero, - lt_self_iff_false, not_false_eq_true, - Ioc_eq_empty, Finset.range_zero, Nat.cast_add, Nat.cast_one, Finset.sum_empty, -@@ -1418,7 +1178,6 @@ theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneO - simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, - lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, and_true, not_false_eq_true, - Finset.sum_insert, CharP.cast_eq_zero, zero_add, ge_iff_le] -- - have l4 : IntervalIntegrable f volume x₀ (x₀ + 1) := by - apply IntegrableOn.intervalIntegrable - simp only [le_add_iff_nonneg_right, zero_le_one, uIcc_of_le] -@@ -1429,24 +1188,21 @@ theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneO - rcases hx with ⟨hx1, hx2⟩ - refine hf ⟨hx1, by linarith⟩ ⟨by linarith, by linarith⟩ hx2 - have l6 : ∫ x in x₀..x₀ + 1, f (x₀ + 1) = f (x₀ + 1) := by simp -- - have l1 : f (x₀ + 1) ≤ ∫ x in x₀..x₀ + 1, f x := by -- rw [← l6] ; apply intervalIntegral.integral_mono_ae_restrict (by linarith) (by simp) l4 -- apply eventually_of_mem _ l5 -- have : (Ioc x₀ (x₀ + 1))ᶜ ∩ Icc x₀ (x₀ + 1) = {x₀} := by simp [← sdiff_eq_compl_inter] -- rw [mem_ae_iff, Measure.restrict_apply measurableSet_Ioc.compl, this] -- simp -- -+ rw [← l6] -+ apply intervalIntegral.integral_mono_on_of_le_Ioo (by linarith) (by simp) l4 -+ intro x hx -+ exact l5 x ⟨hx.1, hx.2.le⟩ - have l2 : AntitoneOn (fun x ↦ f (x₀ + x)) (Icc 1 ↑(n + 1)) := by -- intro u ⟨hu1, _⟩ v ⟨_, hv2⟩ huv ; push_cast at hv2 -+ intro u hu v hv huv -+ have hu1 := hu.1 -+ have hv2 := hv.2 -+ push_cast at hv2 - refine hf ⟨?_, ?_⟩ ⟨?_, ?_⟩ ?_ <;> linarith -- - have l3 := @AntitoneOn.sum_le_integral_Ico 1 (n + 1) (fun x => f (x₀ + x)) (by simp) - (by simpa using l2) -- - simp only [Nat.cast_add, Nat.cast_one, intervalIntegral.integral_comp_add_left] at l3 -- convert! _root_.add_le_add l1 l3 -- -+ convert _root_.add_le_add l1 l3 - have := @intervalIntegral.integral_comp_mul_add ℝ _ _ 1 (n + 1) 1 f one_ne_zero x₀ - rw [intervalIntegral.integral_add_adjacent_intervals] - · exact l4 -@@ -1457,26 +1213,25 @@ theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneO - · linarith - · simp - --lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+theorem hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : - (IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0)) ∧ - (∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π) := by -- - rw [integrableOn_Ici_iff_integrableOn_Ioi] - simp only [hh] -- - let g (x : ℝ) := (a * c / b) * Real.arctan (b * log (x / c)) - let g₀ (x : ℝ) := if x = 0 then ((a * c / b) * (- (π / 2))) else g x - let g' (x : ℝ) := a * (x / c * (1 + (b * Real.log (x / c)) ^ 2))⁻¹ -- - have l3 (x) (hx : 0 < x) : HasDerivAt Real.log x⁻¹ x := by apply Real.hasDerivAt_log (by linarith) - have l4 (x) : HasDerivAt (fun t => t / c) (1 / c) x := (hasDerivAt_id x).div_const c - have l2 (x) (hx : 0 < x) : HasDerivAt (fun t => log (t / c)) x⁻¹ x := by -- have := @HasDerivAt.comp _ _ _ _ _ _ (fun t => t / c) _ _ _ (l3 (x / c) (by positivity)) (l4 x) -- convert! this using 1 ; field_simp -+ have hcomp := (l3 (x / c) (by positivity)).comp x (l4 x) -+ convert hcomp using 1 -+ · rfl -+ · field_simp [hc.ne', hx.ne'] - have l5 (x) (hx : 0 < x) := (l2 x hx).const_mul b - have l1 (x) (hx : 0 < x) := (l5 x hx).arctan - have l6 (x) (hx : 0 < x) : HasDerivAt g (g' x) x := by -- convert! (l1 x hx).const_mul (a * c / b) using 1 -+ convert (l1 x hx).const_mul (a * c / b) using 1 - simp only [g'] - field_simp - have key (x) (hx : 0 < x) : HasDerivAt g₀ (g' x) x := by -@@ -1484,7 +1239,6 @@ lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : - apply eventually_of_mem <| Ioi_mem_nhds hx - intro y (hy : 0 < y) - simp [g₀, hy.ne.symm] -- - have k1 : Tendsto g₀ atTop (𝓝 ((a * c / b) * (π / 2))) := by - have : g =ᶠ[atTop] g₀ := by - apply eventually_of_mem (Ioi_mem_atTop 0) -@@ -1497,7 +1251,6 @@ lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : - apply tendsto_log_atTop.comp - apply Tendsto.atTop_div_const hc - apply tendsto_id -- - have k2 : Tendsto g₀ (𝓝[>] 0) (𝓝 (g₀ 0)) := by - have : g =ᶠ[𝓝[>] 0] g₀ := by - apply eventually_of_mem self_mem_nhdsWithin -@@ -1514,20 +1267,20 @@ lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : - · simp only [mem_Ioi] at hx1 ⊢ ; positivity - · simp only [dist_zero_right, norm_eq_abs, norm_div, abs_eq_self.mpr hc.le] at hx2 ⊢ - rwa [div_lt_iff₀ hc, mul_comm] -- - have k3 : ContinuousWithinAt g₀ (Ici 0) 0 := by - rw [Metric.continuousWithinAt_iff] - rw [Metric.tendsto_nhdsWithin_nhds] at k2 -- gconvert k2 using 5 with ε hε δ hδ x h -- intro (hx : 0 ≤ x) -- have := le_iff_lt_or_eq.mp hx -- cases this with -- | inl hx => exact h hx -- | inr hx => simp [g₀, hx.symm, hε] -- -+ intro ε hε -+ obtain ⟨δ, hδ, hδx⟩ := k2 ε hε -+ refine ⟨δ, hδ, ?_⟩ -+ intro x hx hdist -+ change 0 ≤ x at hx -+ rcases lt_or_eq_of_le hx with hx | hx -+ · exact hδx hx hdist -+ · subst x -+ simpa only [dist_self] using hε - have k4 : ∀ x ∈ Ioi 0, 0 ≤ g' x := by - intro x (hx : 0 < x) ; simp only [mul_inv_rev, inv_div, g'] ; positivity -- - constructor - · convert_to IntegrableOn g' _ - exact integrableOn_Ioi_deriv_of_nonneg k3 key k4 k1 -@@ -1535,25 +1288,25 @@ lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : - simp only [mul_inv_rev, inv_div, mul_neg, ↓reduceIte, sub_neg_eq_add, g', g₀] at this ⊢ - convert this using 1 ; field_simp ; ring - --lemma hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+theorem hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : - IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0) := - hh_integrable_aux ha hb hc |>.1 - --lemma hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+theorem hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : - ∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π := - hh_integrable_aux ha hb hc |>.2 - --lemma hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by -+theorem hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by - have := hh_integral (a := 1) (b := 1 / (2 * π)) (c := 1) - (by positivity) (by positivity) (by positivity) - convert this using 1 <;> simp ; ring - --lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : -+theorem bound_sum_log {C : ℝ} (hf0 : f 0 = 0) -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : - ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ - C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by -- - let ggg (i : ℕ) : ℝ := if i = 0 then 1 else gg x i -- - have l0 : x ≠ 0 := by linarith - have l1 i : 0 ≤ ggg i := by by_cases hi : i = 0 <;> simp only [gg, one_div, mul_inv_rev, hi, - ↓reduceIte, zero_le_one, ggg] ; positivity -@@ -1569,33 +1322,29 @@ lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx - · simp only [mem_Ioi] ; positivity - · gcongr - have l3 : 0 ≤ C := by simpa [cumsum, hf0] using hf 1 -- - have l4 : 0 ≤ ∫ (t : ℝ) in Ioi 0, hh (π⁻¹ * 2⁻¹) t := - setIntegral_nonneg measurableSet_Ioi (fun x hx => hh_nonneg _ (LT.lt.le hx)) -- - have l5 {n : ℕ} : AntitoneOn (fun t ↦ x⁻¹ * hh (1 / (2 * π)) (t / x)) (Ioc 0 n) := by -- intro u ⟨hu1, _⟩ v ⟨hv1, _⟩ huv -+ intro u hu v hv huv -+ have hu1 := hu.1 -+ have hv1 := hv.1 - simp only - apply mul_le_mul le_rfl ?_ (hh_nonneg _ (by positivity)) (by positivity) - apply hh_antitone one_div_two_pi_mem_Ioo (by simp only [mem_Ioi] ; positivity) - (by simp only [mem_Ioi] ; positivity) - apply (div_le_div_iff_of_pos_right (by positivity)).mpr huv -- - have l6 {n : ℕ} : IntegrableOn (fun t ↦ x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (Icc 0 n) volume := by - apply IntegrableOn.mono_set - (hh_integrable (by positivity) (by positivity) (by positivity)) Icc_subset_Ici_self -- - apply Real.tsum_le_of_sum_range_le (fun n => by positivity) ; intro n -- convert_to! ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ -+ convert_to ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ - · congr ; ext i - by_cases hi : i = 0 - · simp [hi, hf0] - · simp only [gg, hi, ↓reduceIte, ggg] - field_simp -- - apply cancel_main' (fun _ => norm_nonneg _) (by simp [hf0]) l1 hf l2 n |>.trans - gcongr ; simp only [cumsum, gg_of_hh l0, one_div, mul_inv_rev, ggg] -- - by_cases hn : n = 0 - · simp only [hn, Finset.range_zero, Finset.sum_empty] ; positivity - replace hn : 0 < n := by omega -@@ -1603,7 +1352,7 @@ lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx - ext i ; simp ; by_cases hi : i = 0 <;> simp [hi, hn] ; omega - simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, - false_and, not_false_eq_true, Finset.sum_insert, ↓reduceIte, add_le_add_iff_left, ge_iff_le] -- convert_to! ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ -+ convert_to ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ - · apply Finset.sum_congr rfl (fun i hi => ?_) - simp at hi - have : i ≠ 0 := by omega -@@ -1624,36 +1373,43 @@ lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx - · apply eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) - intro x (hx : 0 < x) - apply hh_nonneg _ hx.le -- · have := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) -- simpa using! this.mono_set Ioi_subset_Ici_self -- --lemma bound_sum_log0 {C : ℝ} (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : -+ · have h := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) -+ have h' := h.mono_set Ioi_subset_Ici_self -+ unfold IntegrableOn at h' -+ apply h'.congr -+ exact Eventually.of_forall (fun t => by simp) -+ -+theorem bound_sum_log0 {C : ℝ} -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : - ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ - C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by -- - let f0 i := if i = 0 then 0 else f i -- have l1 : chebyWith C f0 := by -+ have l1 : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f0 k : ℂ)‖) n ≤ C * n) := by - intro n ; refine Finset.sum_le_sum (fun i _ => ?_) |>.trans (hf n) - by_cases hi : i = 0 <;> simp [hi, f0] - have l2 i : ‖f i‖ / i = ‖f0 i‖ / i := by by_cases hi : i = 0 <;> simp [hi, f0] - simp_rw [l2] ; apply bound_sum_log rfl l1 hx - --lemma bound_sum_log' {C : ℝ} (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : -+theorem bound_sum_log' {C : ℝ} -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : - ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + 2 * π ^ 2) := by - simpa only [hh_integral'] using bound_sum_log0 hf hx - - variable (f x) in --lemma summable_fourier_aux (ψ : W21) (i : ℕ) : -+theorem summable_fourier_aux (ψ : W21) (i : ℕ) : - ‖f i / i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (i / x))‖ ≤ - W21.norm ψ * (‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹) := by -- convert! mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) -+ convert mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) - (norm_nonneg (f i / i)) using 1 - · simp - · change _ = _ * (W21.norm ψ * _) - simp only [W21.norm, mul_inv_rev, one_div, Complex.norm_div, RCLike.norm_natCast] - ring - --lemma summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : -+theorem summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : - Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by - have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by - simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) -@@ -1661,31 +1417,32 @@ lemma summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : - exact Summable.of_nonneg_of_le (fun _ => norm_nonneg _) l6 - (by simpa using l5.const_smul (W21.norm ψ)) - --lemma bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : -+theorem bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : - ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ - W21.norm ψ • ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ := by -- - have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by - simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) - have l6 := summable_fourier_aux x f ψ - have l1 : Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by - exact summable_fourier x hx ψ hcheby - apply (norm_tsum_le_tsum_norm l1).trans -- simpa only [← Summable.tsum_const_smul _ l5] using! -- Summable.tsum_mono l1 (by simpa using l5.const_smul (W21.norm ψ)) l6 -+ change (∑' i, ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) -+ (1 / (2 * π) * Real.log (↑i / x))‖) ≤ W21.norm ψ * _ -+ rw [← tsum_mul_left] -+ exact Summable.tsum_mono l1 (l5.mul_left (W21.norm ψ)) l6 - --lemma bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) (hcheby : chebyWith C f) : -+theorem bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : - ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ - W21.norm ψ * C * (1 + 2 * π ^ 2) := by -- - apply bound_I1 x (by linarith) ψ ⟨_, hcheby⟩ |>.trans - rw [smul_eq_mul, mul_assoc] - apply mul_le_mul le_rfl (bound_sum_log' hcheby hx) ?_ W21.norm_nonneg - apply tsum_nonneg (fun i => by positivity) - --lemma bound_I2 (x : ℝ) (ψ : W21) : -+theorem bound_I2 (x : ℝ) (ψ : W21) : - ‖∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ W21.norm ψ * (2 * π ^ 2) := by -- - have key a : ‖𝓕 (ψ : ℝ → ℂ) (a / (2 * π))‖ ≤ W21.norm ψ * (1 + (a / (2 * π)) ^ 2)⁻¹ := - decay_bounds_key ψ _ - have twopi : 0 ≤ 2 * π := by simp [pi_nonneg] -@@ -1706,36 +1463,31 @@ lemma bound_I2 (x : ℝ) (ψ : W21) : - rw [Measure.integral_comp_div (fun x => (1 + x ^ 2)⁻¹) (2 * π)] - simp [abs_eq_self.mpr twopi] ; ring_nf ; rfl - --lemma bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) -- (hcheby : chebyWith C f) : -+theorem bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : - ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - - A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ - W21.norm ψ * (C * (1 + 2 * π ^ 2) + ‖A‖ * (2 * π ^ 2)) := by -- - have l1 := bound_I1' x hx ψ hcheby - have l2 := mul_le_mul (le_refl ‖A‖) (bound_I2 x ψ) (by positivity) (by positivity) - apply norm_sub_le _ _ |>.trans ; rw [norm_mul] - convert _root_.add_le_add l1 l2 using 1 ; ring - -- --set_option backward.isDefEq.respectTransparency false in --lemma limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+theorem limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : - Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - - A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by - -- -- Shorter notation for clarity - let S1 x (ψ : ℝ → ℂ) := ∑' (n : ℕ), f n / ↑n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑n / x)) - let S2 x (ψ : ℝ → ℂ) := ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) - let S x ψ := S1 x ψ - S2 x ψ ; change Tendsto (fun x ↦ S x ψ) atTop (𝓝 0) - -- -- Build the truncation - obtain g := exists_trunc - let Ψ R := g.scale R * ψ - have key R : Tendsto (fun x ↦ S x (Ψ R)) atTop (𝓝 0) := limiting_cor (Ψ R) hf hcheby hG hG' - -- -- Choose the truncation radius - obtain ⟨C, hcheby⟩ := hcheby - have hC : 0 ≤ C := by - have : ‖f 0‖ ≤ C := by simpa [cumsum] using hcheby 1 -@@ -1747,130 +1499,62 @@ lemma limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (n - obtain ⟨R, hRψ⟩ := (key2 ((ε / 2) / (1 + M)) (by positivity)).exists - simp only [dist_zero_right, Real.norm_eq_abs, abs_eq_self.mpr W21.norm_nonneg] at hRψ key - -- -- Apply the compact support case - filter_upwards [eventually_ge_atTop 1, key R (ε / 2) (by positivity)] with x hx key - -- -- Control the tail term - have key3 : ‖S x (ψ - Ψ R)‖ < ε / 2 := by -- have : ‖S x _‖ ≤ _ * M := @bound_main f C A x hx (ψ - Ψ R) hcheby -- apply this.trans_lt -- apply (mul_le_mul (d := 1 + M) le_rfl (by simp) (by positivity) W21.norm_nonneg).trans_lt -- have : 0 < 1 + M := by positivity -- convert! (mul_lt_mul_iff_left₀ this).mpr hRψ using 1 ; field_simp -- -- -- Conclude the proof -- have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := by -- have l1 : AEStronglyMeasurable (fun x_1 : ℝ ↦ cexp (-(2 * ↑π * (↑x_1 * ↑x) * I))) volume := by -- refine (Continuous.mul ?_ continuous_const).neg.cexp.aestronglyMeasurable -- apply continuous_const.mul <| contDiff_ofReal.continuous.mul continuous_const -- simp only [Real.fourier_eq', neg_mul, RCLike.inner_apply', conj_trivial, ofReal_neg, -- ofReal_mul, ofReal_ofNat, Pi.sub_apply, smul_eq_mul, mul_sub] -- apply integral_sub -- · apply ψ.hf.bdd_mul (c := 1) l1 ; simp [Complex.norm_exp] -- · apply (Ψ R : W21) |>.hf |>.bdd_mul (c := 1) l1 -- simp [Complex.norm_exp] -+ have hbound := @bound_main f C A x hx (ψ - Ψ R) hcheby -+ change ‖S x (⇑ψ - ⇑(Ψ R))‖ ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * M at hbound -+ apply hbound.trans_lt -+ calc -+ W21.norm (⇑ψ - ⇑(Ψ R)) * M ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * (1 + M) := -+ mul_le_mul_of_nonneg_left (by linarith) W21.norm_nonneg -+ _ < ε / 2 := (lt_div_iff₀ (show 0 < 1 + M by positivity)).mp hRψ - -+ have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := -+ F_sub ψ.hf (Ψ R : W21).hf x - have S1_sub : S1 x (ψ - Ψ R) = S1 x ψ - S1 x (Ψ R) := by - simp only [one_div, mul_inv_rev, S1_sub_1, mul_sub, S1] ; apply Summable.tsum_sub - · have := summable_fourier x (by positivity) ψ ⟨_, hcheby⟩ - rw [summable_norm_iff] at this - simpa using this -- · have := summable_fourier x (by positivity) (Ψ R) ⟨_, hcheby⟩ -- rw [summable_norm_iff] at this -- simpa using! this -- -+ · have hsum := summable_fourier x (by positivity) (Ψ R : W21) ⟨_, hcheby⟩ -+ rw [summable_norm_iff] at hsum -+ simpa only [W21.ofCS2, one_div, mul_inv_rev] using hsum - have S2_sub : S2 x (ψ - Ψ R) = S2 x ψ - S2 x (Ψ R) := by - simp only [S1_sub_1, S2] ; rw [integral_sub] - · ring - · exact ψ.integrable_fourier (by positivity) |>.restrict - · exact (Ψ R : W21).integrable_fourier (by positivity) |>.restrict -- - have S_sub : S x (ψ - Ψ R) = S x ψ - S x (Ψ R) := by simp [S, S1_sub, S2_sub] ; ring - simpa [S_sub, Ψ] using norm_add_le _ _ |>.trans_lt (_root_.add_lt_add key3 key) - --@[blueprint -- "schwarz-id" -- (title := "Limiting identity for Schwartz functions") -- (statement := /-- -- The previous corollary also holds for functions $\psi$ that are assumed to be in the Schwartz -- class, as opposed to being $C^2$ and compactly supported. -- -/) -- (proof := /-- -- For any $R>1$, one can use a smooth cutoff function (provided by Lemma \ref{smooth-ury} to write -- $\psi = \psi_{\leq R} + \psi_{>R}$, where $\psi_{\leq R}$ is $C^2$ (in fact smooth) and compactly -- supported (on $[-R,R]$), and $\psi_{>R}$ obeys bounds of the form -- $$ |\psi_{>R}(t)|, |\psi''_{>R}(t)| \ll R^{-1} / (1 + |t|^2) $$ -- where the implied constants depend on $\psi$. By Lemma \ref{decay} we then have -- $$ \hat \psi_{>R}(u) \ll R^{-1} / (1+|u|^2).$$ -- Using this and \eqref{cheby} one can show that -- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi_{>R}( \frac{1}{2\pi} \log \frac{n}{x} ), -- A \int_{-\infty}^\infty \hat \psi_{>R} (\frac{u}{2\pi})\ du \ll R^{-1} $$ -- (with implied constants also depending on $A$), while from Lemma \ref{limiting-cor} one has -- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi_{\leq R}( \frac{1}{2\pi} \log \frac{n}{x} ) -- = A \int_{-\infty}^\infty \hat \psi_{\leq R} (\frac{u}{2\pi})\ du + o(1).$$ -- Combining the two estimates and letting $R$ be large, we obtain the claim. -- -/) -- (latexEnv := "lemma")] --lemma limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+theorem limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : - Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - - A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := - limiting_cor_W21 ψ hf hcheby hG hG' - -- -- -- -- ---- just the surjectivity is stated here, as this is all that is needed for the current ---- application, but perhaps one should state and prove bijectivity instead -- --@[blueprint -- "bij" -- (title := "Bijectivity of Fourier transform") -- (statement := /-- -- The Fourier transform is a bijection on the Schwartz class. [Note: only surjectivity is -- actually used.] -- -/) -- (proof := /-- -- This is a standard result in Fourier analysis. -- It can be proved here by appealing to Mellin inversion, Theorem \ref{MellinInversion}. -- In particular, given $f$ in the Schwartz class, let -- $F : \R_+ \to \C : x \mapsto f(\log x)$ be a function in the ``Mellin space''; then the -- Mellin transform of $F$ on the imaginary axis $s=it$ is the Fourier transform of $f$. -- The Mellin inversion theorem gives Fourier inversion. -- -/) -- (latexEnv := "lemma")] --lemma fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by -+theorem fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by - refine ⟨𝓕⁻ f, ?_⟩ - exact FourierTransform.fourier_fourierInv_eq f - -+noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) -+ (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) := -+ h2.toSchwartzMap h1 - -+@[simp] theorem toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl - -- --noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) -- (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) where -- toFun := f -- smooth' := h1 -- decay' k n := by -- have l1 : Continuous (fun x => ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) := by -- have : ContDiff ℝ ∞ (iteratedFDeriv ℝ n f) := h1.iteratedFDeriv_right (mod_cast le_top) -- exact Continuous.mul (by continuity) this.continuous.norm -- have l2 : HasCompactSupport (fun x ↦ ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) := -- (h2.iteratedFDeriv _).norm.mul_left -- simpa using l1.bounded_above_of_compact_support l2 -- --@[simp] lemma toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl -- --lemma comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+theorem comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : - ∀ᶠ x in 𝓝 0, Ψ x = 0 := - notMem_tsupport_iff_eventuallyEq.mp (fun h => lt_irrefl 0 <| mem_Ioi.mp (hplus h)) - --lemma comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+theorem comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : - ∀ᶠ x in atBot, Ψ (exp x) = 0 := - Real.tendsto_exp_atBot <| comp_exp_support0 hplus - --lemma comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : -+theorem comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : - ∀ᶠ (x : ℝ) in atTop, (Ψ ∘ rexp) x = 0 := by - simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, - cocompact_eq_atBot_atTop] at hsupp -@@ -1882,11 +1566,9 @@ theorem comp_exp_support {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) - cocompact_eq_atBot_atTop] - exact ⟨comp_exp_support1 hplus, comp_exp_support2 hsupp⟩ - --set_option backward.isDefEq.respectTransparency false in --lemma wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) -+theorem wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) - (hplus : closure (Function.support Ψ) ⊆ Ioi 0) (x : ℝ) (hx : 0 < x) : - ∫ (u : ℝ) in Ioi (-Real.log x), ↑(rexp u) * Ψ (rexp u) = ∫ (y : ℝ) in Ioi (1 / x), Ψ y := by -- - have l1 : ContinuousOn rexp (Ici (-Real.log x)) := by fun_prop - have l2 : Tendsto rexp atTop atTop := Real.tendsto_exp_atTop - have l3 t (_ : t ∈ Ioi (-log x)) : HasDerivWithinAt rexp (rexp t) (Ioi t) t := -@@ -1905,13 +1587,10 @@ theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) - (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : - Tendsto (fun x ↦ (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) - atTop (𝓝 0) := by -- - obtain ⟨ε, hε, hh⟩ := Metric.eventually_nhds_iff.mp <| comp_exp_support0 hplus - apply tendsto_nhds_of_eventually_eq ; filter_upwards [eventually_gt_atTop ε⁻¹] with x hxε -- - have l1 : Integrable (indicator (Ioi x⁻¹) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi - have l2 : Integrable (indicator (Ioi 0) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi -- - simp_rw [← MeasureTheory.integral_indicator measurableSet_Ioi, ← mul_sub, ← integral_sub l1 l2] - simp only [mul_eq_zero, ofReal_eq_zero] - right -@@ -1919,12 +1598,10 @@ theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) - apply Eventually.of_forall - intro t - simp only [Pi.zero_apply] -- - have hε' : 0 < ε⁻¹ := by positivity - have hx : 0 < x := by linarith - have hx' : 0 < x⁻¹ := by positivity - have hεx : x⁻¹ < ε := (inv_lt_comm₀ hε hx).mp hxε -- - have l3 : Ioi 0 = Ioc 0 x⁻¹ ∪ Ioi x⁻¹ := by - ext t ; simp only [mem_Ioi, mem_union, mem_Ioc] ; constructor <;> intro h - · simp [h, le_or_gt] -@@ -1943,52 +1620,35 @@ theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) - rw [abs_le] ; constructor <;> linarith - simp [ht] - -- -- --@[blueprint -- "WienerIkeharaSmooth" -- (title := "Smoothed Wiener-Ikehara") -- (statement := /-- -- If $\Psi: (0,\infty) \to \C$ is smooth and compactly supported away from the origin, then, -- $$ \sum_{n=1}^\infty f(n) \Psi( \frac{n}{x} ) = A x \int_0^\infty \Psi(y)\ dy + o(x)$$ -- as $x \to \infty$. -- -/) -- (proof := /-- -- By Lemma \ref{bij}, we can write -- $$ y \Psi(y) = \hat \psi( \frac{1}{2\pi} \log y )$$ -- for all $y>0$ and some Schwartz function $\psi$. Making this substitution, the claim is then -- equivalent after standard manipulations to -- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) -- = A \int_{-\infty}^\infty \hat \psi(\frac{u}{2\pi})\ du + o(1)$$ -- and the claim follows from Lemma \ref{schwarz-id}. -- -/) -- (latexEnv := "corollary")] --lemma wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) -+theorem wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) - (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) - (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) - (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : - Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x - A * ∫ y in Set.Ioi 0, Ψ y) - atTop (𝓝 0) := by -- - let h (x : ℝ) : ℂ := rexp (2 * π * x) * Ψ (exp (2 * π * x)) - have h1 : ContDiff ℝ ∞ h := by - have : ContDiff ℝ ∞ (fun x : ℝ => (rexp (2 * π * x))) := (contDiff_const.mul contDiff_id).exp - exact (contDiff_ofReal.comp this).mul (hsmooth.comp this) - have h2 : HasCompactSupport h := by -- have : 2 * π ≠ 0 := by simp [pi_ne_zero] -- simpa using! (comp_exp_support hsupp hplus).comp_smul this |>.mul_left -+ have hπ : 2 * π ≠ 0 := by simp [pi_ne_zero] -+ have hh : HasCompactSupport (fun x : ℝ => Ψ (rexp (2 * π * x))) := by -+ simpa only [Function.comp_def, smul_eq_mul] using -+ (comp_exp_support hsupp hplus).comp_smul hπ -+ change HasCompactSupport -+ ((fun x : ℝ => (rexp (2 * π * x) : ℂ)) * fun x : ℝ => Ψ (rexp (2 * π * x))) -+ exact hh.mul_left - obtain ⟨g, hg⟩ := fourier_surjection_on_schwartz (toSchwartz h h1 h2) -- - have l1 {y} (hy : 0 < y) : y * Ψ y = 𝓕 g (1 / (2 * π) * Real.log y) := by -- simp only [one_div, mul_inv_rev, hg, toSchwartz, ofReal_exp, ofReal_mul, ofReal_ofNat, -- toSchwartz_apply, ofReal_inv, h] -- field_simp -- norm_cast -- rw [Real.exp_log hy] -- -+ rw [hg] -+ change (y : ℂ) * Ψ y = h (1 / (2 * π) * Real.log y) -+ have harg : 2 * π * (1 / (2 * π) * Real.log y) = Real.log y := by -+ rw [← mul_assoc, mul_one_div_cancel (mul_ne_zero (by norm_num) pi_ne_zero), one_mul] -+ dsimp only [h] -+ rw [harg, Real.exp_log hy] - have key := limiting_cor_schwartz g hf hcheby hG hG' -- - have l2 : ∀ᶠ x in atTop, ∑' (n : ℕ), f n / ↑n * 𝓕 g (1 / (2 * π) * Real.log (↑n / x)) = - ∑' (n : ℕ), f n * Ψ (↑n / x) / x := by - filter_upwards [eventually_gt_atTop 0] with x hx -@@ -2000,26 +1660,25 @@ lemma wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f - have : (x : ℂ) ≠ 0 := by simpa using hx.ne.symm - simp only [ofReal_div, ofReal_natCast] - field_simp -- - have l3 : ∀ᶠ x in atTop, ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 g (u / (2 * π)) = - ↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y := by - filter_upwards [eventually_gt_atTop 0] with x hx - congr 1 -- simp only [hg, toSchwartz, ofReal_exp, ofReal_mul, ofReal_ofNat, toSchwartz_apply, -- ofReal_div, h] -- norm_cast ; field_simp; norm_cast -+ rw [hg] -+ change (∫ u in Ici (-Real.log x), h (u / (2 * π))) = ∫ y in Ioi x⁻¹, Ψ y -+ dsimp only [h] -+ have hscale : (2 : ℝ) * π ≠ 0 := mul_ne_zero (by norm_num) pi_ne_zero -+ have harg (u : ℝ) : 2 * π * (u / (2 * π)) = u := mul_div_cancel₀ u hscale -+ simp_rw [harg] - rw [MeasureTheory.integral_Ici_eq_integral_Ioi] -- exact wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx -- -+ simpa only [one_div] using wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx - have l4 : Tendsto (fun x => (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) - atTop (𝓝 0) := by - exact wiener_ikehara_smooth_sub (hsmooth.continuous.integrable_of_hasCompactSupport hsupp) hplus -- - simpa [tsum_div_const] using (key.congr' <| EventuallyEq.sub l2 l3) |>.add l4 - -- -- --lemma wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) -+theorem wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) - (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) - (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -@@ -2033,14 +1692,14 @@ local instance {E : Type*} : Coe (E → ℝ) (E → ℂ) := ⟨fun f n => f n⟩ - theorem set_integral_ofReal {f : ℝ → ℝ} {s : Set ℝ} : ∫ x in s, (f x : ℂ) = ∫ x in s, f x := - integral_ofReal - --lemma wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} -+theorem wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} - (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) - (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) - (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : - Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := by -- - let Ψ' := ofReal ∘ Ψ - have l1 : ContDiff ℝ ∞ Ψ' := contDiff_ofReal.comp hsmooth - have l2 : HasCompactSupport Ψ' := hsupp.comp_left rfl -@@ -2049,11 +1708,10 @@ lemma wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} - (@wiener_ikehara_smooth' A Ψ G f hf hcheby hG hG' l1 l2 l3) - simp at key ; norm_cast at key - --lemma interval_approx_inf (ha : 0 < a) (hab : a < b) : -+theorem interval_approx_inf (ha : 0 < a) (hab : a < b) : - ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ - closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ - ψ ≤ indicator (Ico a b) 1 ∧ b - a - ε ≤ ∫ y in Ioi 0, ψ y := by -- - have l1 : Iio ((b - a) / 3) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds <| by - rw [← sub_pos] at hab - positivity -@@ -2083,11 +1741,10 @@ lemma interval_approx_inf (ha : 0 < a) (hab : a < b) : - apply integrableOn_const <;> - simp - --lemma interval_approx_sup (ha : 0 < a) (hab : a < b) : -+theorem interval_approx_sup (ha : 0 < a) (hab : a < b) : - ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ - closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ - indicator (Ico a b) 1 ≤ ψ ∧ ∫ y in Ioi 0, ψ y ≤ b - a + ε := by -- - have l1 : Iio (a / 2) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds (by linarith) - filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < a / 2) - have l2 : a - ε / 2 < a := by linarith -@@ -2101,12 +1758,14 @@ lemma interval_approx_sup (ha : 0 < a) (hab : a < b) : - apply indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp) - · have l4 : 0 ≤ b - a + ε := by linarith - have l5 : Ioo (a - ε / 2) (b + ε / 2) ⊆ Ioi 0 := by intro t ht ; simp at ht ⊢ ; linarith -- have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := inter_eq_left.mpr l5 -+ have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := -+ inter_eq_left.mpr l5 - have l7 : ∫ y in Ioi 0, indicator (Ioo (a - ε / 2) (b + ε / 2)) 1 y = b - a + ε := by - simp only [measurableSet_Ioo, integral_indicator_one, measureReal_restrict_apply, l6, - volume_real_Ioo] - convert max_eq_left l4 using 1 ; ring_nf -- have l8 : IntegrableOn ψ (Ioi 0) volume := (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ have l8 : IntegrableOn ψ (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn - rw [← l7] - refine setIntegral_mono l8 ?_ h4 - rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo] -@@ -2114,7 +1773,7 @@ lemma interval_approx_sup (ha : 0 < a) (hab : a < b) : - apply integrableOn_const <;> - simp - --lemma WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : -+theorem WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : - Summable (fun n => f n * g (n / x)) := by - obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure - apply summable_of_hasFiniteSupport -@@ -2122,21 +1781,24 @@ lemma WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) - simp only [Function.support_mul] ; apply Finite.inter_of_right ; rw [finite_iff_bddAbove] - exact ⟨Nat.ceil (M * x), fun i hi => by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ - --lemma WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) -+theorem WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) - (hg₁ : HasCompactSupport g₁) (hg₂ : HasCompactSupport g₂) : - (∑' n, f n * g₁ (n / x)) / x ≤ (∑' n, f n * g₂ (n / x)) / x := by - apply div_le_div_of_nonneg_right ?_ hx.le - exact Summable.tsum_le_tsum (fun n => mul_le_mul_of_nonneg_left (hg _) (hf _)) - (WI_summable hg₁ hx) (WI_summable hg₂ hx) - --lemma WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : chebyWith C f) (hb : 0 < b) (hxb : 2 / b < x) : -+theorem WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hb : 0 < b) (hxb : 2 / b < x) : - (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by - have hb' : 0 < 2 / b := by positivity - have hx : 0 < x := by linarith - have hxb' : 2 < x * b := (div_lt_iff₀ hb).mp hxb - have l1 (i : ℕ) (hi : i ∉ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) = 0 := by - simp_all [le_div_iff₀ hx] -- have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by -+ have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : -+ f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by - rw [abs_eq_self.mpr (hpos _)] - convert_to _ ≤ f i * 1 - · ring -@@ -2151,29 +1813,21 @@ lemma WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : cheby - apply (Nat.ceil_lt_add_one (by positivity)).le.trans - linarith - --lemma WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : chebyWith C f) (hb : 0 < b) : -+theorem WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hb : 0 < b) : - ∀ᶠ x : ℝ in atTop, (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by - filter_upwards [eventually_gt_atTop (2 / b)] with x hx using WI_sum_Iab_le hpos hcheby hb hx - --lemma le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by -- apply le_of_forall_gt ; intro d hd -- have key : ∀ᶠ c in 𝓝[>] b, c < d := by -- apply eventually_of_mem (U := Iio d) ?_ (fun x hx => hx) -- rw [mem_nhdsWithin] -- refine ⟨Iio d, isOpen_Iio, hd, inter_subset_left⟩ -- obtain ⟨x, h1, h2⟩ := (h.and key).exists -- linarith -+theorem le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by -+ exact ge_of_tendsto -+ (show Tendsto (fun c : ℝ => c) (𝓝[>] b) (𝓝 b) from nhdsWithin_le_nhds) h - --lemma ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by -- apply le_of_forall_lt ; intro d hd -- have key : ∀ᶠ c in 𝓝[<] b, c > d := by -- apply eventually_of_mem (U := Ioi d) ?_ (fun x hx => hx) -- rw [mem_nhdsWithin] -- refine ⟨Ioi d, isOpen_Ioi, hd, inter_subset_left⟩ -- obtain ⟨x, h1, h2⟩ := (h.and key).exists -- linarith -+theorem ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by -+ exact le_of_tendsto -+ (show Tendsto (fun c : ℝ => c) (𝓝[<] b) (𝓝 b) from nhdsWithin_le_nhds) h - --lemma WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : -+theorem WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : - Tendsto (fun c => c / A - (b - a)) (𝓝[>] (A * (b - a))) (𝓝[>] 0) := by - rw [Metric.tendsto_nhdsWithin_nhdsWithin] - intro ε hε -@@ -2186,7 +1840,7 @@ lemma WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : - rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp - rwa [this, div_lt_iff₀' hA] - --lemma WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : -+theorem WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : - Tendsto (fun c => (b - a) - c / A) (𝓝[<] (A * (b - a))) (𝓝[>] 0) := by - rw [Metric.tendsto_nhdsWithin_nhdsWithin] - intro ε hε -@@ -2200,8 +1854,11 @@ lemma WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : - rwa [this, div_lt_iff₀' hA, ← neg_sub, abs_neg] - - theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) -- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) (hcheby : cheby fun n ↦ ↑(f n)) -- (hG : ContinuousOn G {s | 1 ≤ s.re}) (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : 0 ≤ A := by -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : -+ 0 ≤ A := by - let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x - have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by - filter_upwards [eventually_ge_atTop 0] with x hx -@@ -2215,37 +1872,29 @@ theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) - have r1 : 0 ≤ᵐ[Measure.restrict volume (Ioi 0)] ψ := Eventually.of_forall l2 - have r2 : IntegrableOn (fun y ↦ ψ y) (Ioi 0) volume := - (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -- have r3 : Ico 1 2 ⊆ Function.support ψ := by intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith -+ have r3 : Ico 1 2 ⊆ Function.support ψ := by -+ intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith - have r4 : Ico 1 2 ⊆ Function.support ψ ∩ Ioi 0 := by -- simp only [subset_inter_iff, r3, true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith -- have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by convert! volume.mono r4 ; norm_num -- simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using! zero_lt_one.trans_le r5 -+ simp only [subset_inter_iff, r3, -+ true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith -+ have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by -+ convert volume.mono r4 ; norm_num -+ simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using zero_lt_one.trans_le r5 - have := div_nonneg l3 l4.le ; field_simp at this ; exact this - --blueprint_comment /-- --Now we add the hypothesis that $f(n) \geq 0$ for all $n$. -- ---/ -+theorem WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) -+ atTop (nhds (A * (b - a))) := by - --@[blueprint -- (title := "Wiener-Ikehara in an interval") -- (statement := /-- -- For any closed interval $I \subset (0,+\infty)$, we have -- $$ \sum_{n=1}^\infty f(n) 1_I( \frac{n}{x} ) = A x |I| + o(x).$$ -- -/) -- (proof := /-- Use Lemma \ref{smooth-ury} to bound $1_I$ above and below by smooth compactly supported functions whose integral is close to the measure of $|I|$, and use the non-negativity of $f$. -/) -- (latexEnv := "proposition")] --lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : -- Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) atTop (nhds (A * (b - a))) := by -- -- -- Take care of the trivial case `a = b` - by_cases hab : a = b - · simp [hab] - replace hb : a < b := lt_of_le_of_ne hb hab ; clear hab - -- -- Notation to make the proof more readable - let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x - have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by - filter_upwards [eventually_ge_atTop 0] with x hx -@@ -2253,10 +1902,10 @@ lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : - refine tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _)) - have hA : 0 ≤ A := residue_nonneg hpos hf hcheby hG hG' - -- -- A few facts about the indicator function of `Icc a b` - let Iab : ℝ → ℝ := indicator (Ico a b) 1 - change Tendsto (S Iab) atTop (𝓝 (A * (b - a))) -- have hIab : HasCompactSupport Iab := by simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc -+ have hIab : HasCompactSupport Iab := by -+ simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc - have Iab_nonneg : ∀ᶠ x : ℝ in atTop, 0 ≤ S Iab x := hSnonneg (indicator_nonneg (by simp)) - have Iab2 : IsBoundedUnder (· ≤ ·) atTop (S Iab) := by - obtain ⟨C, hC⟩ := hcheby ; exact ⟨C * 2 * b, WI_sum_Iab_le' hpos hC (by linarith)⟩ -@@ -2264,10 +1913,10 @@ lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : - have Iab0 : IsCoboundedUnder (· ≥ ·) atTop (S Iab) := Iab2.isCoboundedUnder_ge - have Iab1 : IsCoboundedUnder (· ≤ ·) atTop (S Iab) := Iab3.isCoboundedUnder_le - -- -- Bound from above by a smooth function - have sup_le : limsup (S Iab) atTop ≤ A * (b - a) := by - have l_sup : ∀ᶠ ε in 𝓝[>] 0, limsup (S Iab) atTop ≤ A * (b - a + ε) := by -- filter_upwards [interval_approx_sup ha hb] with ε ⟨ψ, h1, h2, h3, h4, h6⟩ -+ filter_upwards [interval_approx_sup ha hb] with ε happrox -+ rcases happrox with ⟨ψ, h1, h2, h3, h4, h6⟩ - have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 - have l6 : S Iab ≤ᶠ[atTop] S ψ := by - filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h4 hx hIab h2 -@@ -2281,10 +1930,10 @@ lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : - filter_upwards [WI_tendsto_aux a b key l_sup] with x hx - simpa [mul_div_cancel₀ _ h] using hx - -- -- Bound from below by a smooth function - have le_inf : A * (b - a) ≤ liminf (S Iab) atTop := by - have l_inf : ∀ᶠ ε in 𝓝[>] 0, A * (b - a - ε) ≤ liminf (S Iab) atTop := by -- filter_upwards [interval_approx_inf ha hb] with ε ⟨ψ, h1, h2, h3, h5, h6⟩ -+ filter_upwards [interval_approx_inf ha hb] with ε happrox -+ rcases happrox with ⟨ψ, h1, h2, h3, h5, h6⟩ - have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 - have l2 : S ψ ≤ᶠ[atTop] S Iab := by - filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h5 hx h2 hIab -@@ -2298,63 +1947,66 @@ lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : - filter_upwards [WI_tendsto_aux' a b key l_inf] with x hx - simpa [mul_div_cancel₀ _ h] using hx - -- -- Combine the two bounds - have : liminf (S Iab) atTop ≤ limsup (S Iab) atTop := liminf_le_limsup Iab2 Iab3 - refine tendsto_of_liminf_eq_limsup ?_ ?_ Iab2 Iab3 <;> linarith - -- -- --lemma le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by -+theorem le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by - rw [div_le_iff₀ hx, Nat.le_floor_iff] ; positivity - --lemma lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by -+theorem lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by - rw [div_lt_iff₀ hx, Nat.lt_ceil] - --lemma ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by -+theorem ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by - rw [le_div_iff₀ hx, Nat.ceil_le] - --lemma mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by -+theorem mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : -+ n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by - rw [Finset.mem_Icc, mem_Icc, ceil_mul_le_iff hx, le_floor_mul_iff hb hx] - --lemma mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by -+theorem mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by - rw [Finset.mem_Ico, mem_Ico, ceil_mul_le_iff hx, lt_ceil_mul_iff hx] - --lemma tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : -+theorem tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : - ∑' n, f n * (indicator (Ico a b) 1 (n / x)) = ∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n := by - have l1 : ∀ n ∉ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n * indicator (Ico a b) 1 (↑n / x) = 0 := by - simp [mem_Ico_iff_div hx] ; tauto -- rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] -+ rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only -+ [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] - --lemma WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : -- Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) atTop (nhds (A * (b - a))) := by -+theorem WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) -+ atTop (nhds (A * (b - a))) := by - apply (WienerIkeharaInterval hpos hf hcheby hG hG' ha hb).congr' - filter_upwards [eventually_gt_atTop 0] with x hx - rw [tsum_indicator hx] - --lemma WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : -- Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) atTop (nhds (A * (b - a))) := -+theorem WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) -+ atTop (nhds (A * (b - a))) := - WienerIkeharaInterval_discrete hpos hf hcheby hG hG' ha hb |>.comp tendsto_natCast_atTop_atTop - ---- TODO with `Ico` -- -- -- --/-- A version of the *Wiener-Ikehara Tauberian Theorem*: If `f` is a nonnegative arithmetic --function whose L-series has a simple pole at `s = 1` with residue `A` and otherwise extends --continuously to the closed half-plane `re s ≥ 1`, then `∑ n < N, f n` is asymptotic to `A*N`. -/ -- --lemma tendsto_mul_ceil_div : -+theorem tendsto_mul_ceil_div : - Tendsto (fun (p : ℝ × ℕ) => ⌈p.1 * p.2⌉₊ / (p.2 : ℝ)) (𝓝[>] 0 ×ˢ atTop) (𝓝 0) := by - rw [Metric.tendsto_nhds] ; intro δ hδ -- have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) -+ have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := -+ inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) - have l2 : ∀ᶠ N : ℕ in atTop, 1 ≤ δ / 2 * N := by - apply Tendsto.eventually_ge_atTop - exact tendsto_natCast_atTop_atTop.const_mul_atTop (by positivity) -- filter_upwards [l1.prod_mk l2] with (ε, N) ⟨⟨hε, h1⟩, h2⟩ ; dsimp only at * -+ filter_upwards [l1.prod_mk l2] with p hp -+ rcases p with ⟨ε, N⟩ -+ rcases hp with ⟨⟨hε, h1⟩, h2⟩ -+ dsimp only at * - have l3 : 0 < (N : ℝ) := by - simp only [Nat.cast_pos, Nat.pos_iff_ne_zero] ; rintro rfl ; simp [zero_lt_one.not_ge] at h2 - have l5 : 0 ≤ ε * ↑N := by positivity -@@ -2364,19 +2016,20 @@ lemma tendsto_mul_ceil_div : - - noncomputable def S (f : ℕ → 𝕜) (ε : ℝ) (N : ℕ) : 𝕜 := (∑ n ∈ Finset.Ico ⌈ε * N⌉₊ N, f n) / N - --lemma S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by -- have hceilN : ⌈ε * N⌉₊ ≤ N := by -+theorem S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : -+ S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by -+ have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by -+ simp_rw [Finset.range_eq_Ico] -+ symm -+ apply Finset.Ico_union_Ico_eq_Ico (Nat.zero_le _) - simp only [Nat.ceil_le] - exact mul_le_of_le_one_left N.cast_nonneg hε -- have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by -- ext n -- simp only [Finset.mem_range, Finset.mem_union, Finset.mem_Ico] -- omega - have r2 : Disjoint (Finset.range ⌈ε * N⌉₊) (Finset.Ico ⌈ε * N⌉₊ N) := by - rw [Finset.range_eq_Ico] ; apply Finset.Ico_disjoint_Ico_consecutive - simp [S, r1, Finset.sum_union r2, cumsum, add_div] - --lemma tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) (hcheby : cheby f) : -+theorem tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : - TendstoUniformlyOnFilter (S f) (S f 0) (𝓝[>] 0) atTop := by - rw [Metric.tendstoUniformlyOnFilter_iff] ; intro δ hδ - obtain ⟨C, hC⟩ := hcheby -@@ -2384,40 +2037,34 @@ lemma tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) (hcheby : cheby f) : - have r1 := tendsto_mul_ceil_div.const_mul C - simp only [mul_div_assoc', mul_zero] at r1 ; exact r1 (Iio_mem_nhds hδ) - have : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) -- filter_upwards [l1, Eventually.prod_inl this _] with (ε, N) h1 h2 -+ filter_upwards [l1, Eventually.prod_inl this _] with p h1 h2 -+ rcases p with ⟨ε, N⟩ - have l2 : ‖cumsum f ⌈ε * ↑N⌉₊ / ↑N‖ ≤ C * ⌈ε * N⌉₊ / N := by - have r1 := hC ⌈ε * N⌉₊ - have r2 : 0 ≤ cumsum f ⌈ε * N⌉₊ := by apply cumsum_nonneg hpos - simp only [norm_real, norm_of_nonneg (hpos _), norm_div, - norm_of_nonneg r2, Real.norm_natCast] at r1 ⊢ - apply div_le_div_of_nonneg_right r1 (by positivity) -- simpa [← S_sub_S h2.2] using! l2.trans_lt h1 -- --@[blueprint "WienerIkehara" -- (title := "Wiener-Ikehara Theorem (1)") -- (statement := /-- -- We have -- $$ \sum_{n\leq x} f(n) = A x + o(x).$$ -- -/) -- (proof := /-- Apply the preceding proposition with $I = [\varepsilon,1]$ and then send -- $\varepsilon$ to zero (using \eqref{cheby} to control the error). -/) -- (latexEnv := "corollary")] -+ simpa [dist_eq_norm, ← S_sub_S h2.2] using l2.trans_lt h1 -+ - theorem WienerIkeharaTheorem' {f : ℕ → ℝ} (hpos : 0 ≤ f) - (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) - (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : - Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := by -- - convert_to Tendsto (S f 0) atTop (𝓝 A) ; · ext N ; simp [S, cumsum] - apply (tendsto_S_S_zero hpos hcheby).tendsto_of_eventually_tendsto - · have L0 : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) - apply eventually_of_mem L0 - · intro ε hε -- simpa using! WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 -+ convert WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 using 1 -+ funext N -+ simp only [S, one_mul, Nat.ceil_natCast] - · have : Tendsto (fun ε : ℝ => ε) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds - simpa using (this.const_sub 1).const_mul A - --theorem vonMangoldt_cheby : cheby Λ := by -+theorem vonMangoldt_cheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := by - use Real.log 4 + 4 - intro N - by_cases! h : N = 0 -@@ -2430,1956 +2077,20 @@ theorem vonMangoldt_cheby : cheby Λ := by - gcongr - linarith - --blueprint_comment /-- --\section{Weak PNT} -- ---/ -- ---- Proof extracted from the `EulerProducts` project so we can adapt it to the ---- version of the Wiener-Ikehara theorem proved above (with the `cheby` ---- hypothesis) -- --@[blueprint -- (title := "WeakPNT") -- (statement := /-- -- We have -- $$ \sum_{n \leq x} \Lambda(n) = x + o(x).$$ -- -/) -- (proof := /-- Already done by Stoll, assuming Wiener-Ikehara. -/)] - theorem WeakPNT : Tendsto (fun N ↦ cumsum Λ N / N) atTop (𝓝 1) := by - let F := vonMangoldt.LFunctionResidueClassAux (q := 1) 1 -- have hnv := riemannZeta_ne_zero_of_one_le_re - have l1 (n : ℕ) : 0 ≤ Λ n := vonMangoldt_nonneg - have l2 s (hs : 1 < s.re) : F s = LSeries Λ s - 1 / (s - 1) := by - have := vonMangoldt.eqOn_LFunctionResidueClassAux (q := 1) isUnit_one hs -- simp only [F, this, vonMangoldt.residueClass, Nat.totient_one, Nat.cast_one, inv_one, one_div, sub_left_inj] -+ simp only [F, this, vonMangoldt.residueClass, Nat.totient_one, Nat.cast_one, -+ inv_one, one_div, sub_left_inj] - apply LSeries_congr - intro n _ -- simp only [ofReal_inj, indicator_apply_eq_self, mem_ofPred_eq] -+ simp only [ofReal_inj, indicator_apply_eq_self, Set.mem_ofPred_eq] - exact fun hn ↦ absurd (Subsingleton.eq_one _) hn - have l3 : ContinuousOn F {s | 1 ≤ s.re} := vonMangoldt.continuousOn_LFunctionResidueClassAux 1 -- have l4 : cheby Λ := vonMangoldt_cheby -+ have l4 : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := vonMangoldt_cheby - have l5 (σ' : ℝ) (hσ' : 1 < σ') : Summable (nterm Λ σ') := by -- simpa only [← nterm_eq_norm_term] using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm -+ simpa only [← nterm_eq_norm_term] -+ using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm - apply WienerIkeharaTheorem' l1 l5 l4 l3 l2 -- ---- #print axioms WeakPNT -- --section auto_cheby -- --variable {f : ℕ → ℝ} -- --lemma norm_x_cpow_it (x t : ℝ) (hx : 0 < x) : ‖(x : ℂ) ^ (t * I)‖ = 1 := by -- rw [cpow_def_of_ne_zero <| ofReal_ne_zero.mpr hx.ne', ← ofReal_log hx.le] -- convert norm_exp_ofReal_mul_I (t * x.log) using 2 -- push_cast; ring_nf -- --set_option backward.isDefEq.respectTransparency false in --lemma limiting_fourier_aux_gt_zero (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 0 < x) (σ' : ℝ) (hσ' : 1 < σ') : -- ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -- A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -- ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by -- have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 -- have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := -- continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [hx]) -- have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := -- (((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8).integrable_of_hasCompactSupport -- ψ.h2.mul_left.mul_right -- have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := fun h ↦ by -- have := congrArg Complex.re (sub_eq_zero.mp h); simp at this; linarith -- have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * -- (↑(x ^ (σ' - 1)) * (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -- have : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * -- (↑(x ^ (σ' - 1)) * (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -- simp only [one_div, ← mul_assoc] -- exact ((continuous_const.mul (Continuous.inv₀ (by fun_prop) e2)).mul ψ.h1.continuous).mul l8 -- exact this.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right.mul_left.mul_left -- simp_rw [first_fourier hf hint hx hσ', second_fourier ψ.h1.continuous.measurable hint hx hσ', -- ← integral_const_mul, ← integral_sub l4 l5] -- refine integral_congr_ae (.of_forall fun u ↦ ?_) -- have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] -- simp_rw [hG' e1, sub_mul, ← mul_assoc] -- simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, -- mul_eq_zero, I_ne_zero, or_false] -- field_simp [e2]; norm_cast; simp [mul_assoc, ← rpow_add hx] -- --theorem limiting_fourier_lim2_gt_zero (A : ℝ) (ψ : W21) (hx : 0 < x) : -- Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * -- ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) -- (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by -- obtain ⟨C, hC⟩ := decay_bounds_cor ψ -- refine Tendsto.mul ?_ (tendsto_integral_filter_of_dominated_convergence _ -- (.of_forall fun _ ↦ (by continuity : Continuous _).aestronglyMeasurable) ?_ -- (limiting_fourier_lim2_aux x C) (.of_forall fun u ↦ ?_)) -- · suffices Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) by -- simpa using ((continuous_ofReal.tendsto 1).comp this).const_mul ↑A -- have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := -- tendsto_nhdsWithin_of_tendsto_nhds (by simpa using (continuous_id.tendsto (1 : ℝ)).const_sub 1) -- simpa using tendsto_const_nhds.rpow this (Or.inl hx.ne') -- · refine eventually_of_mem (Ioo_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun σ' hσ' ↦ ?_ -- obtain ⟨h1, h2⟩ := hσ' -- rw [ae_restrict_iff' measurableSet_Ici] -- refine .of_forall fun t ht ↦ ?_ -- simp only [norm_mul, neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, -- norm_exp, neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, -- sub_self, mul_zero, sub_zero] -- refine mul_le_mul ?_ (hC _) (norm_nonneg _) ((abs_nonneg x).trans (le_max_left _ _)) -- have hα0 : 0 ≤ σ' - 1 := by linarith -- have hα1 : σ' - 1 ≤ 1 := by linarith -- have hmul1 : (-x.log) * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht hα0 -- calc Real.exp (-(t * (σ' - 1))) -- ≤ Real.exp (x.log * (σ' - 1)) := Real.exp_monotone (by linarith) -- _ ≤ max |x| 1 := by -- by_cases hx1 : 1 ≤ x -- · calc _ ≤ Real.exp x.log := -- Real.exp_monotone (mul_le_of_le_one_right (Real.log_nonneg hx1) hα1) -- _ = |x| := by rw [Real.exp_log hx, abs_of_pos hx] -- _ ≤ _ := le_max_left _ _ -- · calc _ ≤ 1 := (Real.exp_monotone (mul_nonpos_of_nonpos_of_nonneg -- ((Real.log_neg_iff hx).2 (by linarith)).le hα0)).trans_eq Real.exp_zero -- _ ≤ _ := le_max_right _ _ -- · suffices Tendsto (fun n ↦ ((rexp (-u * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by simpa using this.mul_const _ -- refine Tendsto.mono_left ?_ nhdsWithin_le_nhds -- have : Continuous (fun n ↦ ((rexp (-u * (n - 1))) : ℂ)) := by continuity -- simpa using this.tendsto 1 -- --theorem limiting_fourier_lim3_gt_zero -- (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 0 < x) : -- Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) -- (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by -- by_cases hh : tsupport ψ = ∅ -- · simp [tsupport_eq_empty_iff.mp hh] -- obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh -- let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) -- have l1 : IsCompact S := Metric.isCompact_iff_isClosed_bounded.mpr -- ⟨isClosed_Icc.reProdIm (isClosed_tsupport ψ), (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded⟩ -- have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 -- obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ (hG.mono l2).norm -- have hxC : (x : ℂ) ≠ 0 := ofReal_ne_zero.mpr hx.ne' -- refine tendsto_integral_filter_of_dominated_convergence (bound := fun a ↦ ‖G z‖ * ‖ψ a‖) -- (eventually_of_mem (Icc_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun u hu ↦ -- ((hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous).mul -- (by simpa using Continuous.const_cpow (by fun_prop) (Or.inl hxC)) |>.aestronglyMeasurable) -- (eventually_of_mem (Icc_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun u hu ↦ -- .of_forall fun v ↦ ?_) -- ((continuous_const.mul ψ.h1.continuous.norm).integrable_of_hasCompactSupport ψ.h2.norm.mul_left) -- (.of_forall fun t ↦ ?_) -- · by_cases h : v ∈ tsupport ψ -- · simp_rw [norm_mul, norm_x_cpow_it x v hx, mul_one] -- exact mul_le_mul_of_nonneg_right (isMaxOn_iff.mp hmax _ (by simp [S, mem_reProdIm, hu.1, hu.2, h])) (norm_nonneg _) -- · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) -- simp [Function.notMem_support.mp this] -- · exact ((hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr -- ⟨((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds, -- eventually_nhdsWithin_of_forall fun _ hx' ↦ by simp [(Set.mem_Ioi.mp hx').le]⟩).mul_const _ |>.mul_const _ -- --lemma tendsto_tsum_of_monotone_convergence -- {β : Type*} {f : ℕ → β → ENNReal} {g : β → ENNReal} -- (hmono : ∀ k, Monotone (fun n => f n k)) -- (hlim : ∀ k, Tendsto (fun n => f n k) atTop (𝓝 (g k))) : -- Tendsto (fun n => ∑' k, f n k) atTop (𝓝 (∑' k, g k)) := by -- let : MeasurableSpace β := ⊤ -- let μ : Measure β := Measure.count -- have hg_iSup (k : β) : (⨆ n : ℕ, f n k) = g k := iSup_eq_of_tendsto (hmono k) (hlim k) -- have h_tend_lint : Tendsto (fun n => ∫⁻ k, f n k ∂μ) atTop (𝓝 (∫⁻ k, (⨆ n, f n k) ∂μ)) := by -- have hmeas : ∀ n, Measurable fun k : β => f n k := fun _ _ _ ↦ trivial -- have hmono_fn : Monotone (fun n => fun k : β => f n k) := fun _ _ hnm k ↦ hmono k hnm -- simpa [lintegral_iSup hmeas hmono_fn] using -- tendsto_atTop_iSup fun _ _ hmn ↦ lintegral_mono fun k ↦ hmono k hmn -- simpa [μ, lintegral_count, hg_iSup] using h_tend_lint -- --lemma tendsto_tsum_of_monotone_convergence_nhdsGT_one -- {F : ℝ → ℕ → ℝ} -- (hF_nonneg : ∀ σ n, 0 ≤ F σ n) -- (hF_antitone : ∀ n, AntitoneOn (fun σ : ℝ => F σ n) (Set.Ioi (1 : ℝ))) -- (hF_tend : ∀ n, Tendsto (fun σ : ℝ => F σ n) (𝓝[>] (1 : ℝ)) (𝓝 (F 1 n))) -- (hSumm : ∀ σ, 1 < σ → Summable (fun n : ℕ => F σ n)) -- (hbounded : -- BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ : ℝ => (∑' n : ℕ, F σ n))) : -- Tendsto (fun σ : ℝ => ∑' n : ℕ, F σ n) (𝓝[>] (1 : ℝ)) (𝓝 (∑' n : ℕ, F 1 n)) := by -- let T : ℝ → ℝ := fun σ => ∑' n : ℕ, F σ n -- have hT_antitone : AntitoneOn T (Set.Ioi (1 : ℝ)) := fun a ha b hb hab ↦ -- (hSumm b hb).tsum_le_tsum_of_inj (fun n ↦ n) (fun _ _ h ↦ h) (fun c hc ↦ (hc ⟨c, rfl⟩).elim) -- (fun n ↦ hF_antitone n ha hb hab) (hSumm a ha) -- have hT_bdd : BddAbove (T '' Set.Ioi (1 : ℝ)) := by -- obtain ⟨C, hC⟩ := isBigO_iff.1 hbounded -- have hC' : ∀ᶠ σ : ℝ in 𝓝[>] (1 : ℝ), T σ ≤ C := by -- filter_upwards [hC] with σ hσ -- calc T σ ≤ |T σ| := le_abs_self _ -- _ = ‖T σ‖ := (Real.norm_eq_abs _).symm -- _ ≤ C * ‖(1 : ℝ → ℝ) σ‖ := hσ -- _ = C := by simp -- obtain ⟨U, hU, V, hV, hUV⟩ := Filter.mem_inf_iff_superset.1 hC' -- obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hU -- have hIoi_sub : Set.Ioi (1 : ℝ) ⊆ V := Filter.mem_principal.mp hV -- have hUsub : U ∩ Set.Ioi (1 : ℝ) ⊆ {σ : ℝ | T σ ≤ C} := fun σ hσ ↦ hUV ⟨hσ.1, hIoi_sub hσ.2⟩ -- have hσ0_Ioi : 1 + ε / 2 ∈ Set.Ioi (1 : ℝ) := by simp [half_pos hε] -- have hσ0_leC : T (1 + ε / 2) ≤ C := -- hUsub ⟨hball (by simp only [Metric.mem_ball, Real.dist_eq, add_sub_cancel_left, -- abs_of_pos (half_pos hε)]; exact half_lt_self hε), hσ0_Ioi⟩ -- refine ⟨C, ?_⟩ -- rintro _ ⟨σ, hσIoi, rfl⟩ -- by_cases hσlt : σ < 1 + ε / 2 -- · exact hUsub ⟨hball (by -- simp only [Metric.mem_ball, Real.dist_eq] -- rw [abs_of_pos (sub_pos.2 (Set.mem_Ioi.mp hσIoi))] -- linarith [half_lt_self hε]), hσIoi⟩ -- · exact (hT_antitone hσ0_Ioi hσIoi (le_of_not_gt hσlt)).trans hσ0_leC -- have hT_tend_sup : Tendsto T (𝓝[>] (1 : ℝ)) (𝓝 (sSup (T '' Set.Ioi (1 : ℝ)))) := -- hT_antitone.tendsto_nhdsGT hT_bdd -- let σseq : ℕ → ℝ := fun k => 1 + 1 / (k + 1 : ℝ) -- have hσseq_mem (k) : σseq k ∈ Set.Ioi (1 : ℝ) := by -- simp only [σseq, Set.mem_Ioi, lt_add_iff_pos_right] -- positivity -- have hσseq_tend_nhds : Tendsto σseq atTop (𝓝 (1 : ℝ)) := by -- have : Tendsto (fun k : ℕ => (1 : ℝ) + ((k + 1 : ℕ) : ℝ)⁻¹) atTop (𝓝 ((1 : ℝ) + 0)) := -- tendsto_const_nhds.add (tendsto_inv_atTop_nhds_zero_nat.comp (tendsto_add_atTop_nat 1)) -- simp only [add_zero] at this -- convert this using 1; ext k; simp [σseq, one_div] -- have hσseq_tend_nhdsWithin : Tendsto σseq atTop (𝓝[>] (1 : ℝ)) := -- tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hσseq_tend_nhds -- (.of_forall hσseq_mem) -- have hσseq_antitone : Antitone σseq := fun k₁ k₂ hk ↦ by simp only [σseq]; gcongr -- have hmono_seq (n) : Monotone (fun k => F (σseq k) n) := fun k₁ k₂ hk ↦ -- hF_antitone n (hσseq_mem k₂) (hσseq_mem k₁) (hσseq_antitone hk) -- have htend_seq (n) : Tendsto (fun k => F (σseq k) n) atTop (𝓝 (F 1 n)) := -- (hF_tend n).comp hσseq_tend_nhdsWithin -- have hTseq : Tendsto (fun k : ℕ => T (σseq k)) atTop (𝓝 (T 1)) := by -- have hsum1 : Summable (fun n : ℕ => F (1 : ℝ) n) := by -- obtain ⟨C, hC⟩ := hT_bdd -- refine summable_of_sum_range_le (hF_nonneg 1) fun m ↦ le_of_tendsto -- (tendsto_finsetSum _ fun i _ ↦ hF_tend i) -- (eventually_of_mem self_mem_nhdsWithin fun σ hσ ↦ -- ((hSumm σ hσ).sum_le_tsum _ (fun n _ ↦ hF_nonneg σ n)).trans (hC ⟨σ, hσ, rfl⟩)) -- have hg_ne_top : (∑' n : ℕ, ENNReal.ofReal (F 1 n)) ≠ ⊤ := hsum1.tsum_ofReal_ne_top -- have hENN : Tendsto (fun k => ∑' n, ENNReal.ofReal (F (σseq k) n)) atTop -- (𝓝 (∑' n, ENNReal.ofReal (F 1 n))) := -- tendsto_tsum_of_monotone_convergence (fun n _ _ hk ↦ ENNReal.ofReal_le_ofReal (hmono_seq n hk)) -- (fun n ↦ ENNReal.tendsto_ofReal (htend_seq n)) -- have hrew (σ) : (∑' n, ENNReal.ofReal (F σ n)).toReal = ∑' n, F σ n := by -- rw [ENNReal.tsum_toReal_eq (fun n ↦ by simp)] -- exact tsum_congr fun n ↦ by simp [hF_nonneg σ n] -- simp only [T, ← hrew]; exact (ENNReal.tendsto_toReal hg_ne_top).comp hENN -- have hsSup_eq : sSup (T '' Set.Ioi (1 : ℝ)) = T 1 := -- tendsto_nhds_unique (hT_tend_sup.comp hσseq_tend_nhdsWithin) hTseq -- simpa [T, hsSup_eq] using hT_tend_sup -- --lemma limiting_fourier_variant_lim1_aux -- {f : ℕ → ℝ} {x : ℝ} (ψ : CS 2 ℂ) -- (hpos : 0 ≤ f) -- (hf : ∀ (σ : ℝ), 1 < σ → Summable (nterm f σ)) -- (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) : -- ∀ (σ : ℝ), 1 < σ → -- Summable (fun n : ℕ => -- (if n = 0 then 0 else f n / ((n : ℝ) ^ σ)) * -- (𝓕 ψ.toFun (1 / (2 * π) * Real.log ((n : ℝ) / x))).re) := by -- intro σ hσ -- let y : ℕ → ℝ := fun n => (1 / (2 * π)) * Real.log ((n : ℝ) / x) -- let W : ℕ → ℝ := fun n => (𝓕 ψ.toFun (y n)).re -- let base : ℕ → ℝ := fun n => if n = 0 then 0 else f n / ((n : ℝ) ^ σ) -- obtain ⟨C, hC⟩ := decay_bounds_cor (W21.ofCS2 ψ) -- have hC_nonneg : 0 ≤ C := (norm_nonneg _).trans ((hC 0).trans (by simp)) -- have hW_nonneg (n : ℕ) : 0 ≤ W n := (hψpos (y n)).1 -- have hnorm_four (n : ℕ) : ‖𝓕 ψ.toFun (y n)‖ = W n := by -- have him0 : (𝓕 ψ.toFun (y n)).im = 0 := (hψpos (y n)).2 -- rw [show 𝓕 ψ.toFun (y n) = W n by exact Complex.ext rfl him0] -- simp [abs_of_nonneg (hW_nonneg n)] -- have hW_le_C (n : ℕ) : W n ≤ C := by -- rw [← hnorm_four]; exact (hC (y n)).trans (div_le_self hC_nonneg (by nlinarith [sq_nonneg (y n)])) -- have hbase_summ : Summable base := by -- convert hf σ hσ using 1; ext n -- by_cases hn : n = 0 <;> simp [nterm, base, hn, Real.norm_eq_abs, abs_of_nonneg (hpos n)] -- refine (hbase_summ.mul_left C).of_norm_bounded fun n ↦ ?_ -- by_cases hn : n = 0 -- · simp [base, hn] -- · have hnpos : 0 < (n : ℝ) := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn) -- have hbase_nonneg : 0 ≤ base n := by -- simp only [base, hn, ite_false] -- exact div_nonneg (hpos n) (Real.rpow_pos_of_pos hnpos σ).le -- calc |base n * W n| = base n * W n := abs_of_nonneg (mul_nonneg hbase_nonneg (hW_nonneg n)) -- _ ≤ base n * C := mul_le_mul_of_nonneg_left (hW_le_C n) hbase_nonneg -- _ = C * base n := mul_comm _ _ -- -- --theorem limiting_fourier_variant_lim1 -- {f : ℕ → ℝ} {x : ℝ} {ψ : CS 2 ℂ} -- (hpos : 0 ≤ f) -- (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) -- (S : ℝ → ℂ) -- (hSdef : -- ∀ σ' : ℝ, -- S σ' = -- ∑' n : ℕ, -- term (fun n ↦ (f n : ℂ)) (σ' : ℝ) n * -- 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x))) -- (hbounded : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ' : ℝ => ‖S σ'‖)) -- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) : -- Tendsto -- (fun σ' : ℝ => -- ∑' n : ℕ, -- term (fun n ↦ (f n : ℂ)) (σ' : ℝ) n * -- 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x))) -- (𝓝[>] (1 : ℝ)) -- (𝓝 -- (∑' n : ℕ, -- (f n : ℂ) / (n : ℂ) * -- 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x)))) := by -- -- let y : ℕ → ℝ := fun n => (π⁻¹ * 2⁻¹) * Real.log ((n : ℝ) / x) -- let w : ℕ → ℝ := fun n => (𝓕 ψ.toFun (y n)).re -- -- have hw_nonneg : ∀ n, 0 ≤ w n := by -- intro n -- exact (hψpos (y n)).1 -- -- have hFour_eq_ofReal : ∀ n, 𝓕 ψ.toFun (y n) = Complex.ofReal (w n) := by -- intro n -- have h := hψpos (y n) -- refine Complex.ext ?_ ?_ -- · simp [w] -- · simp [w, h.2] -- -- let rterm : ℝ → ℕ → ℝ := -- fun σ n => -- if h0 : n = 0 then 0 else (f n) / ((n : ℝ) ^ σ) * (w n) -- -- have summand_eq_ofReal : -- ∀ (σ : ℝ) (n : ℕ), -- term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n) -- = Complex.ofReal (rterm σ n) := by -- intro σ n -- by_cases hn : n = 0 -- · subst hn -- simp [rterm, y] -- · have hnpos : (0 : ℝ) < (n : ℝ) := by -- exact_mod_cast (Nat.pos_of_ne_zero hn) -- have hn0 : 0 ≤ (n : ℝ) := le_of_lt hnpos -- have hcpow : -- ( (n : ℂ) ^ ((σ : ℝ) : ℂ) ) = ( ( (n : ℝ) ^ σ : ℝ) : ℂ ) := by -- simpa using (Complex.ofReal_cpow hn0 σ).symm -- have hpow_ne : ((n : ℝ) ^ σ) ≠ 0 := by -- exact (ne_of_gt (Real.rpow_pos_of_pos hnpos σ)) -- calc -- term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n) -- = -- ((f n : ℂ) / ((n : ℂ) ^ ((σ : ℝ) : ℂ))) * ( (w n : ℝ) : ℂ ) := by -- simp [term, LSeries.term, hn, hFour_eq_ofReal] -- _ = -- ((f n : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) * ((w n : ℝ) : ℂ) := by -- simp [hcpow] -- _ = -- (( (f n : ℝ) : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) * ((w n : ℝ) : ℂ) := by -- simp -- _ = -- ( ( (f n : ℝ) / ((n : ℝ) ^ σ) : ℝ) : ℂ ) * ((w n : ℝ) : ℂ) := by -- simp [Complex.ofReal_div] -- _ = -- ( ( (f n : ℝ) / ((n : ℝ) ^ σ) * (w n) : ℝ ) : ℂ ) := by -- simp [Complex.ofReal_mul] -- _ = -- Complex.ofReal (rterm σ n) := by -- simp [rterm, hn] -- -- let T : ℝ → ℝ := fun σ => ∑' n, rterm σ n -- -- have tsum_eq_ofReal_T : ∀ σ : ℝ, -- (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -- = Complex.ofReal (T σ) := by -- intro σ -- have hcongr : -- (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -- = ∑' n : ℕ, (Complex.ofReal (rterm σ n)) := by -- refine tsum_congr ?_ -- intro n -- simpa using (summand_eq_ofReal σ n) -- -- calc -- (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -- = ∑' n : ℕ, (Complex.ofReal (rterm σ n)) := hcongr -- _ = Complex.ofReal (∑' n : ℕ, rterm σ n) := by -- simpa using (Complex.ofReal_tsum (fun n : ℕ => rterm σ n)).symm -- _ = Complex.ofReal (T σ) := by rfl -- -- have hS_ofReal_T : ∀ σ : ℝ, S σ = Complex.ofReal (T σ) := by -- intro σ -- simpa [hSdef σ, y] using (tsum_eq_ofReal_T σ) -- -- have rterm_nonneg : ∀ σ n, 0 ≤ rterm σ n := by -- intro σ n -- by_cases hn : n = 0 -- · subst hn; simp [rterm] -- · have hf : 0 ≤ f n := hpos n -- have hw : 0 ≤ w n := hw_nonneg n -- have hnpos : 0 < (n : ℝ) := by -- exact_mod_cast (Nat.pos_of_ne_zero hn) -- have hden : 0 < (n : ℝ) ^ σ := Real.rpow_pos_of_pos hnpos σ -- have : 0 ≤ (f n) / ((n : ℝ) ^ σ) := div_nonneg hf (le_of_lt hden) -- simp [rterm, hn, mul_nonneg this hw] -- -- have T_nonneg : ∀ σ, 0 ≤ T σ := by -- intro σ -- exact tsum_nonneg (fun n => rterm_nonneg σ n) -- -- have hT_eq_normS : ∀ σ, T σ = ‖S σ‖ := by -- intro σ -- have := hS_ofReal_T σ -- calc -- T σ = ‖Complex.ofReal (T σ)‖ := by simp [abs_of_nonneg (T_nonneg σ)] -- _ = ‖S σ‖ := by simp [this] -- -- have hboundedT : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ : ℝ => T σ) := by -- have : (fun σ : ℝ => T σ) = (fun σ : ℝ => ‖S σ‖) := by -- funext σ; exact hT_eq_normS σ -- simpa [this] using hbounded -- -- have rterm_antitone : ∀ n, AntitoneOn (fun σ => rterm σ n) (Set.Ioi 1) := by -- intro n σ₁ hσ₁ σ₂ hσ₂ hσ₁₂ -- by_cases hn : n = 0 -- · subst hn; simp [rterm] -- · have hf : 0 ≤ f n := hpos n -- have hw : 0 ≤ w n := hw_nonneg n -- have hnpos : 0 < (n : ℝ) := by exact_mod_cast (Nat.pos_of_ne_zero hn) -- have hn1 : (1 : ℝ) ≤ (n : ℝ) := by -- exact_mod_cast (Nat.one_le_iff_ne_zero.mpr hn) -- have hpow : (n : ℝ) ^ σ₁ ≤ (n : ℝ) ^ σ₂ := -- Real.rpow_le_rpow_of_exponent_le hn1 hσ₁₂ -- have hinv : -- (1 / ((n : ℝ) ^ σ₂)) ≤ (1 / ((n : ℝ) ^ σ₁)) := by -- have hpos1 : 0 < (n : ℝ) ^ σ₁ := Real.rpow_pos_of_pos hnpos σ₁ -- exact one_div_le_one_div_of_le hpos1 hpow -- have hinv_inv : ((n : ℝ) ^ σ₂)⁻¹ ≤ ((n : ℝ) ^ σ₁)⁻¹ := by -- simpa [one_div] using hinv -- have hmul1 : -- (f n) * (((n : ℝ) ^ σ₂)⁻¹) ≤ (f n) * (((n : ℝ) ^ σ₁)⁻¹) := -- mul_le_mul_of_nonneg_left hinv_inv hf -- have hmul2 : -- ((f n) * (((n : ℝ) ^ σ₂)⁻¹)) * (w n) -- ≤ ((f n) * (((n : ℝ) ^ σ₁)⁻¹)) * (w n) := -- mul_le_mul_of_nonneg_right hmul1 hw -- simpa [rterm, hn, div_eq_mul_inv, mul_assoc] using hmul2 -- -- have rterm_tend : ∀ n, Tendsto (fun σ : ℝ => rterm σ n) (𝓝[>] (1 : ℝ)) (𝓝 (rterm 1 n)) := by -- intro n -- have hterm : -- Tendsto (fun σ : ℝ => term (fun n ↦ (f n : ℂ)) (σ : ℝ) n) -- (𝓝[>] (1 : ℝ)) (𝓝 ((f n : ℂ) / (n : ℂ))) := by -- by_cases hn : n = 0 -- · subst hn -- simp [term, LSeries.term] -- · have hden : -- Tendsto (fun σ : ℝ => ((n : ℂ) ^ ((σ : ℝ) : ℂ))) (𝓝[>] (1 : ℝ)) (𝓝 ((n : ℂ) ^ (1 : ℂ))) := by -- simpa using ((continuous_ofReal.tendsto (1 : ℝ)).mono_left nhdsWithin_le_nhds).const_cpow -- -- have hden' : -- Tendsto (fun σ : ℝ => ((n : ℂ) ^ ((σ : ℝ) : ℂ))) (𝓝[>] (1 : ℝ)) (𝓝 (n : ℂ)) := by -- simpa using hden -- -- have hnC : (n : ℂ) ≠ 0 := by -- exact_mod_cast hn -- -- have hterm : -- Tendsto (fun σ : ℝ => term (fun n ↦ (f n : ℂ)) (σ : ℝ) n) -- (𝓝[>] (1 : ℝ)) (𝓝 ((f n : ℂ) / (n : ℂ))) := by -- have hnC : (n : ℂ) ≠ 0 := by -- exact_mod_cast hn -- simpa [term, LSeries.term, hn] using! -- (tendsto_const_nhds.div hden' hnC) -- exact hterm -- -- have hsummand : -- Tendsto -- (fun σ : ℝ => -- term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -- (𝓝[>] (1 : ℝ)) -- (𝓝 (((f n : ℂ) / (n : ℂ)) * 𝓕 ψ.toFun (y n))) := by -- simpa [mul_assoc, mul_left_comm, mul_comm] using (hterm.mul_const (𝓕 ψ.toFun (y n))) -- -- have hre : ∀ σ, rterm σ n = -- (term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)).re := by -- intro σ -- have := congrArg Complex.re (summand_eq_ofReal σ n) -- simpa [Complex.ofReal_re] using this.symm -- -- have hRe : Tendsto -- (fun σ : ℝ => -- (term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)).re) -- (𝓝[>] (1 : ℝ)) -- (𝓝 ((((f n : ℂ) / (n : ℂ)) * 𝓕 ψ.toFun (y n)).re)) := -- (continuous_re.tendsto _).comp hsummand -- -- have hlimit_re : -- (f n / (n : ℝ)) * (𝓕 ψ.toFun (y n)).re = rterm 1 n := by -- have h0 : -- (term (fun n ↦ (f n : ℂ)) (1 : ℝ) n * 𝓕 ψ.toFun (y n)).re = rterm 1 n := by -- have := congrArg Complex.re (summand_eq_ofReal (σ := (1 : ℝ)) n) -- simpa [Complex.ofReal_re] using this -- -- by_cases hn : n = 0 -- · subst hn -- simp [rterm, y] -- · have h1 : -- (term (fun n ↦ (f n : ℂ)) (1 : ℝ) n * 𝓕 ψ.toFun (y n)).re -- = (f n / (n : ℝ)) * (𝓕 ψ.toFun (y n)).re := by -- simp [Complex.mul_re, term, LSeries.term, hn, y, -- (hψpos (y n)).2] -- -- exact (h1.symm.trans h0) -- -- simpa [hre, hlimit_re] using hRe -- -- have hSumm_rterm : ∀ σ : ℝ, 1 < σ → Summable (fun n : ℕ => rterm σ n) := by -- simpa [rterm] using limiting_fourier_variant_lim1_aux (ψ := ψ) -- (f := f) (x := x) hpos hf hψpos -- -- have hT_tend : -- Tendsto T (𝓝[>] (1 : ℝ)) (𝓝 (T 1)) := by -- have : -- Tendsto (fun σ : ℝ => ∑' n : ℕ, rterm σ n) -- (𝓝[>] (1 : ℝ)) -- (𝓝 (∑' n : ℕ, rterm (1 : ℝ) n)) := by -- refine tendsto_tsum_of_monotone_convergence_nhdsGT_one -- (F := rterm) -- (hF_nonneg := rterm_nonneg) -- (hF_antitone := rterm_antitone) -- (hF_tend := rterm_tend) -- (hSumm := hSumm_rterm) -- (hbounded := hboundedT) -- -- simpa [T] using this -- -- have hToReal : -- Tendsto (fun σ => Complex.ofReal (T σ)) (𝓝[>] (1 : ℝ)) (𝓝 (Complex.ofReal (T 1))) := -- (continuous_ofReal.tendsto _).comp hT_tend -- -- have hsource : -- (fun σ : ℝ => -- ∑' n : ℕ, -- term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) -- = fun σ : ℝ => Complex.ofReal (T σ) := by -- funext σ -- exact (tsum_eq_ofReal_T σ) -- -- have hσ1 : -- (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (↑(1:ℝ)) n * 𝓕 ψ.toFun (y n)) -- = (↑(T 1) : ℂ) := -- by simpa using (tsum_eq_ofReal_T (σ := (1:ℝ))) -- have hterm1 : -- ∀ n : ℕ, term (fun n ↦ (f n : ℂ)) (1 : ℂ) n = (f n : ℂ) / (n : ℂ) := by -- intro n -- by_cases hn : n = 0 -- · subst hn -- simp [term, LSeries.term] -- · simp [term, LSeries.term, hn] -- -- have hrewrite : -- (∑' n : ℕ, -- term (fun n ↦ (f n : ℂ)) (1 : ℂ) n * 𝓕 ψ.toFun (y n)) -- = -- (∑' n : ℕ, -- (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (y n)) := by -- refine tsum_congr ?_ -- intro n -- simp [hterm1 n] -- -- have htarget : -- (∑' n : ℕ, -- (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (y n)) -- = (↑(T 1) : ℂ) := by -- exact (hrewrite.symm.trans hσ1) -- -- simpa [hsource, htarget, y] using hToReal -- -- -- -- --blueprint_comment /-- --\section{Removing the Chebyshev hypothesis} -- --In this section we do *not* assume the bound \eqref{cheby}, but instead derive it from the other hypotheses. -- ---/ -- --@[blueprint "limiting-fourier-variant" -- (title := "limiting-fourier-variant") -- (statement := /-- -- If $\psi: \R \to \C$ is $C^2$ and compactly supported with $f$ and $\hat \psi$ non-negative, and $0 < x$, then -- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) - A \int_{-\log x}^\infty \hat \psi(\frac{u}{2\pi})\ du = \int_\R G(1+it) \psi(t) x^{it}\ dt.$$ -- -/) -- (proof := /-- Repeat the proof of Lemma \ref{limiting-fourier-variant}, but use monotone convergence instead of dominated convergence. (The proof should be simpler, as one no longer needs to establish domination for the sum.) -/) -- (proofUses := ["decay", "second-fourier", "first-fourier"]) -- (latexEnv := "lemma")] --lemma limiting_fourier_variant -- (hpos : 0 ≤ f) -- (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (ψ : CS 2 ℂ) -- (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) -- (hx : 0 < x) : -- ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -- A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -- ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by -- -- have l2 := limiting_fourier_lim2_gt_zero (A := A) (x := x) ψ hx -- have l3 := limiting_fourier_lim3_gt_zero (G := G) (x := x) hG ψ hx -- -- let S : ℝ → ℂ := fun σ' => -- ∑' n : ℕ, -- term (fun n ↦ (f n : ℂ)) σ' n * -- 𝓕 ψ.toFun (1 / (2 * π) * Real.log ((n : ℝ) / x)) -- let Pole : ℝ → ℂ := fun σ' => -- (A : ℂ) * ((x ^ (1 - σ') : ℝ) : ℂ) * -- ∫ u in Set.Ici (-Real.log x), -- (rexp (-u * (σ' - 1)) : ℂ) * -- 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π)) -- let RHS : ℝ → ℂ := fun σ' => -- ∫ t : ℝ, G (σ' + t * I) * ψ.toFun t * (x : ℂ) ^ (t * I) -- -- -- have haux : -- (fun (σ' : ℝ) ↦ -- ∑' (n : ℕ), -- term (fun n ↦ (f n : ℂ)) (σ' : ℂ) n * -- 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x)) -- - (A : ℂ) * ((x ^ (1 - σ') : ℝ) : ℂ) * -- ∫ (u : ℝ) in Ici (-Real.log x), -- cexp (-( (u : ℂ) * ((σ' : ℂ) - 1))) * -- 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π))) -- =ᶠ[𝓝[>] (1 : ℝ)] -- (fun σ' ↦ -- ∫ (t : ℝ), G ((σ' : ℂ) + (t : ℂ) * I) * ψ.toFun t * (x : ℂ) ^ ((t : ℂ) * I)) := by -- rw [Filter.EventuallyEq] -- -- refine eventually_nhdsWithin_of_forall ?_ -- intro σ' hσ' -- have hσ' : (1 : ℝ) < σ' := by -- simpa [Set.mem_Ioi] using hσ' -- simpa using! (limiting_fourier_aux_gt_zero (G := G) (f := f) (A := A) hG' hf ψ hx σ' hσ') -- -- have haux' : -- (fun σ' : ℝ => S σ') =ᶠ[𝓝[>] (1 : ℝ)] (fun σ' : ℝ => RHS σ' + Pole σ') := by -- rw [Filter.EventuallyEq] at haux ⊢ -- filter_upwards [haux] with σ' hσ' -- have hσ'' : S σ' - Pole σ' = RHS σ' := by -- simpa [S, Pole, RHS] using hσ' -- have hadd : (S σ' - Pole σ') + Pole σ' = RHS σ' + Pole σ' := -- congrArg (fun z : ℂ => z + Pole σ') hσ'' -- simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using hadd -- -- let Pole₁ : ℂ := (A : ℂ) * ∫ u in Set.Ici (-Real.log x), 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π)) -- let RHS₁ : ℂ := ∫ t : ℝ, G (1 + (t : ℂ) * I) * ψ.toFun t * (x : ℂ) ^ ((t : ℂ) * I) -- -- have hRHS_le : -- ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ‖RHS σ'‖ ≤ ‖RHS₁‖ + 1 := by -- have hball : Metric.ball RHS₁ (1 : ℝ) ∈ 𝓝 RHS₁ := by -- simpa using (Metric.ball_mem_nhds (x := RHS₁) (ε := (1 : ℝ)) (by norm_num)) -- have hpre : {σ' : ℝ | RHS σ' ∈ Metric.ball RHS₁ (1 : ℝ)} ∈ (𝓝[>] (1 : ℝ)) := -- l3 hball -- filter_upwards [hpre] with σ' hmem -- have hdist' : dist (RHS σ') RHS₁ < (1 : ℝ) := by -- simpa [Metric.mem_ball] using hmem -- have hdist : ‖RHS σ' - RHS₁‖ < (1 : ℝ) := by -- simpa [dist_eq_norm] using hdist' -- have htri : ‖RHS σ'‖ ≤ ‖RHS₁‖ + ‖RHS σ' - RHS₁‖ := by -- have h := norm_add_le (RHS σ' - RHS₁) RHS₁ -- simpa [sub_add_cancel, add_comm, add_left_comm, add_assoc] using h -- have hle : ‖RHS₁‖ + ‖RHS σ' - RHS₁‖ ≤ ‖RHS₁‖ + (1 : ℝ) := by -- exact add_le_add_right (le_of_lt hdist) ‖RHS₁‖ -- exact htri.trans hle -- -- have hPole_le : -- ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ‖Pole σ'‖ ≤ ‖Pole₁‖ + 1 := by -- have hball : Metric.ball Pole₁ 1 ∈ 𝓝 Pole₁ := by -- simpa using (Metric.ball_mem_nhds Pole₁ (by norm_num : (0 : ℝ) < 1)) -- have hpre : {σ' : ℝ | Pole σ' ∈ Metric.ball Pole₁ 1} ∈ (𝓝[>] (1 : ℝ)) := l2 hball -- filter_upwards [hpre] with σ' hmem -- have hdist : ‖Pole σ' - Pole₁‖ < 1 := by -- simpa [Metric.mem_ball, dist_eq_norm] using hmem -- have htri : ‖Pole σ'‖ ≤ ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ := by -- have hdecomp : Pole σ' = Pole₁ + (Pole σ' - Pole₁) := by abel -- have hnorm_eq : ‖Pole σ'‖ = ‖Pole₁ + (Pole σ' - Pole₁)‖ := by -- simp [congrArg (fun z : ℂ => ‖z‖) hdecomp] -- calc -- ‖Pole σ'‖ = ‖Pole₁ + (Pole σ' - Pole₁)‖ := hnorm_eq -- _ ≤ ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ := norm_add_le _ _ -- have hdist_le : ‖Pole σ' - Pole₁‖ ≤ 1 := le_of_lt hdist -- have hsum : ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ ≤ ‖Pole₁‖ + 1 := by -- simpa [add_comm, add_left_comm, add_assoc] using (add_le_add_left hdist_le ‖Pole₁‖) -- exact htri.trans hsum -- -- have hS_le : -- ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), -- ‖S σ'‖ ≤ (‖RHS₁‖ + 1) + (‖Pole₁‖ + 1) := by -- rw [Filter.EventuallyEq] at haux' -- filter_upwards [haux', hRHS_le, hPole_le] with σ' hEq hR hP -- calc -- ‖S σ'‖ = ‖RHS σ' + Pole σ'‖ := by simp [hEq] -- _ ≤ ‖RHS σ'‖ + ‖Pole σ'‖ := norm_add_le _ _ -- _ ≤ (‖RHS₁‖ + 1) + (‖Pole₁‖ + 1) := by -- exact add_le_add hR hP -- -- have hbounded : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ' : ℝ => ‖S σ'‖) := by -- let C : ℝ := ‖RHS₁‖ + 1 + (‖Pole₁‖ + 1) -- simp only [BoundedAtFilter, Asymptotics.IsBigO, Asymptotics.IsBigOWith] -- refine ⟨C, ?_⟩ -- filter_upwards [hS_le] with σ' hσ' -- simpa [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg (S σ'))] using hσ' -- -- have hcoef : (1 / (2 * π) : ℝ) = (π⁻¹ * 2⁻¹ : ℝ) := by field_simp [pi_ne_zero] -- -- have l1 := -- limiting_fourier_variant_lim1 -- (f := f) (x := x) (ψ := ψ) -- hpos hψpos -- (S := S) -- (hSdef := by -- intro σ -- simp [S, hcoef] ) -- hbounded -- hf -- have l1S : -- Tendsto S (𝓝[>] (1 : ℝ)) -- (𝓝 (∑' n : ℕ, (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (1 / (2 * π) * Real.log (↑n / x)))) := by -- simpa [S, hcoef] using l1 -- -- have l12 : Tendsto (fun σ' : ℝ => S σ' - Pole σ') (𝓝[>] (1 : ℝ)) -- (𝓝 ((∑' n : ℕ, (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (1 / (2 * π) * Real.log (↑n / x))) - Pole₁)) := -- l1S.sub l2 -- -- have hPole : (Pole : ℝ → ℂ) =ᶠ[𝓝[>] (1 : ℝ)] Pole := by simp -- have haux_sub : -- (fun σ' : ℝ => S σ' - Pole σ') =ᶠ[𝓝[>] (1 : ℝ)] RHS := by -- filter_upwards [haux'] with σ' hσ' -- calc -- S σ' - Pole σ' -- = (RHS σ' + Pole σ') - Pole σ' := by simp [hσ'] -- _ = RHS σ' := by simp -- have hlim := -- tendsto_nhds_unique_of_eventuallyEq (l1S.sub l2) l3 haux_sub -- -- simpa [Pole₁, RHS₁] using! hlim -- -- --lemma norm_mul_integral_Ici_le_integral_norm -- (A : ℂ) (F : ℝ → ℂ) (a : ℝ) -- (hF : IntegrableOn F (Set.Ici a)) -- (hnorm : Integrable (fun u : ℝ => ‖F u‖)) : -- ‖A * (∫ u in Set.Ici a, F u)‖ ≤ ‖A‖ * (∫ u : ℝ, ‖F u‖) := by -- have hmul : ‖A * (∫ u in Set.Ici a, F u)‖ = ‖A‖ * ‖∫ u in Set.Ici a, F u‖ := by -- simp -- have hnormI : -- ‖∫ u in Set.Ici a, F u‖ ≤ ∫ u in Set.Ici a, ‖F u‖ := by -- have _ : Integrable F (Measure.restrict volume (Set.Ici a)) := hF -- have h : -- ‖∫ u, F u ∂Measure.restrict volume (Set.Ici a)‖ -- ≤ ∫ u, ‖F u‖ ∂Measure.restrict volume (Set.Ici a) := -- norm_integral_le_integral_norm (μ := Measure.restrict volume (Set.Ici a)) (f := F) -- simpa using h -- -- have hdom : -- (∫ u in Set.Ici a, ‖F u‖) ≤ ∫ u : ℝ, ‖F u‖ := by -- have hEq : -- (∫ u in Set.Ici a, ‖F u‖) = -- ∫ u : ℝ, Set.indicator (Set.Ici a) (fun u => ‖F u‖) u := by -- have h := (integral_indicator (μ := (volume : Measure ℝ)) -- (s := Set.Ici a) (f := fun u => ‖F u‖)) -- have h' := h measurableSet_Ici -- simpa using h'.symm -- have hind_int : -- Integrable (Set.indicator (Set.Ici a) (fun u => ‖F u‖)) := -- hnorm.indicator measurableSet_Ici -- have hpoint : -- Set.indicator (Set.Ici a) (fun u => ‖F u‖) -- ≤ᵐ[volume] (fun u : ℝ => ‖F u‖) := by -- filter_upwards with u -- by_cases hu : u ∈ Set.Ici a -- · simp [Set.indicator_of_mem hu] -- · simp [Set.indicator_of_notMem hu] -- have hmono := -- integral_mono_ae (μ := (volume : Measure ℝ)) -- hind_int hnorm hpoint -- simpa [hEq] using hmono -- -- calc -- ‖A * (∫ u in Set.Ici a, F u)‖ -- = ‖A‖ * ‖∫ u in Set.Ici a, F u‖ := hmul -- _ ≤ ‖A‖ * (∫ u in Set.Ici a, ‖F u‖) := -- mul_le_mul_of_nonneg_left hnormI (by simp) -- _ ≤ ‖A‖ * (∫ u : ℝ, ‖F u‖) := -- mul_le_mul_of_nonneg_left hdom (by simp) -- --lemma fourier_decay_of_CS2 -- (ψ : CS 2 ℂ) : -- ∃ C : ℝ, ∀ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by -- let ψ' : W21 := (ψ : W21) -- obtain ⟨C, hC⟩ : -- ∃ C : ℝ, ∀ u : ℝ, ‖𝓕 (ψ' : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by -- simpa using (decay_bounds_cor (ψ := ψ')) -- refine ⟨C, ?_⟩ -- intro u -- simpa [ψ'] using! (hC u) -- --lemma integrable_norm_fourier_scaled_of_CS2 -- (ψ : CS 2 ℂ) : -- Integrable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by -- obtain ⟨C, hdecay⟩ := fourier_decay_of_CS2 (ψ := ψ) -- have hC_nonneg : 0 ≤ C := by -- have h0 := hdecay 0 -- have hnorm : 0 ≤ ‖𝓕 (ψ : ℝ → ℂ) 0‖ := norm_nonneg _ -- have hC' : ‖𝓕 (ψ : ℝ → ℂ) 0‖ ≤ C := by simpa using h0 -- exact hnorm.trans hC' -- have hmaj_int : Integrable (fun u : ℝ => (C : ℝ) / (1 + (u / (2 * Real.pi))^2)) := by -- have hbase : Integrable (fun u : ℝ => (1 + u ^ 2)⁻¹) := integrable_inv_one_add_sq -- have hscale : -- Integrable (fun u : ℝ => (1 + (u / (2 * Real.pi)) ^ 2)⁻¹) := -- hbase.comp_div (by nlinarith [Real.pi_pos]) -- simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, pow_two] using -- hscale.const_mul C -- have hle : -- (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) -- ≤ᵐ[volume] -- (fun u : ℝ => (C : ℝ) / (1 + (u / (2 * Real.pi))^2)) := by -- refine Filter.Eventually.of_forall ?_ -- intro u -- simpa using (hdecay (u / (2 * Real.pi))) -- have hle_norm : -- (fun u : ℝ => ‖‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖‖) -- ≤ᵐ[volume] -- (fun u : ℝ => ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖) := by -- refine hle.mono ?_ -- intro u hu -- have hden_pos : 0 < 1 + (u / (2 * Real.pi)) ^ 2 := by nlinarith -- have hnonneg : 0 ≤ (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := -- div_nonneg hC_nonneg hden_pos.le -- have hleft_nonneg : 0 ≤ ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖ := norm_nonneg _ -- have hbound : ‖‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖‖ ≤ -- (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := by -- simpa [Real.norm_eq_abs, abs_of_nonneg hleft_nonneg] using hu -- have hC_abs : |C| = C := abs_of_nonneg hC_nonneg -- have hden_abs : |1 + (u / (2 * Real.pi))^2| = 1 + (u / (2 * Real.pi))^2 := by -- have : 0 ≤ 1 + (u / (2 * Real.pi))^2 := by nlinarith -- simpa using abs_of_nonneg this -- have hnorm : -- ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖ = -- (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := by -- have hrec : -- ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖ = -- |C| / |1 + (u / (2 * Real.pi))^2| := by -- simp [Real.norm_eq_abs] -- simp [hC_abs, hden_abs, hrec] -- simpa [hnorm] using hbound -- have hmaj_int_norm : -- Integrable (fun u : ℝ => ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖) := -- hmaj_int.norm -- have hmeas : -- AEStronglyMeasurable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by -- have hcont : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) u := by -- simpa using! continuous_FourierIntegral (ψ : W21) -- have hcont_scaled : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) := -- hcont.comp (by continuity) -- exact hcont_scaled.aestronglyMeasurable.norm -- exact hmaj_int_norm.mono' hmeas hle_norm -- --lemma exists_bound_norm_G_on_tsupport -- (hG : ContinuousOn G {s : ℂ | 1 ≤ s.re}) -- (ψ : CS 2 ℂ) : -- ∃ K : ℝ, ∀ t : ℝ, t ∈ tsupport (ψ : ℝ → ℂ) → -- ‖G (1 + t * Complex.I)‖ ≤ K := by -- let s : Set ℝ := tsupport (ψ : ℝ → ℂ) -- have hscompact : IsCompact s := by -- simpa [s] using (ψ.h2.isCompact : IsCompact (tsupport (ψ : ℝ → ℂ))) -- have hphi_cont : Continuous (fun t : ℝ => (1 : ℂ) + t * Complex.I) := by continuity -- have hphi_maps : -- Set.MapsTo (fun t : ℝ => (1 : ℂ) + t * Complex.I) s {z : ℂ | 1 ≤ z.re} := by -- intro t ht -- simp -- have hGcomp : ContinuousOn (fun t : ℝ => G ((1 : ℂ) + t * Complex.I)) s := -- hG.comp hphi_cont.continuousOn hphi_maps -- have hnorm_contOn : ContinuousOn (fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) s := hGcomp.norm -- have hbdd : BddAbove ((fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s) := -- (hscompact.image_of_continuousOn hnorm_contOn).bddAbove -- refine ⟨sSup ((fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s), ?_⟩ -- intro t ht -- have : ‖G ((1 : ℂ) + t * Complex.I)‖ ∈ -- (fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s := ⟨t, ht, rfl⟩ -- exact le_csSup hbdd this -- --lemma norm_integrand_le_K_mul_norm_psi -- {x K : ℝ} -- (hx : 0 < x) -- (hK : ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K) : -- ∀ t : ℝ, -- ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ ≤ K * ‖ψ t‖ := by -- intro t -- by_cases ht : t ∈ Function.support ψ -- · have hxnorm : ‖((x : ℂ) ^ (t * Complex.I))‖ = 1 := norm_x_cpow_it x t hx -- calc -- ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ -- = ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ * ‖((x : ℂ) ^ (t * Complex.I))‖ := by -- simp [mul_left_comm, mul_comm] -- _ = ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ * 1 := by simp [hxnorm] -- _ ≤ K * ‖ψ t‖ := by -- have hGle : ‖G (1 + t * Complex.I)‖ ≤ K := hK t ht -- have : ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ ≤ K * ‖ψ t‖ := -- mul_le_mul_of_nonneg_right hGle (norm_nonneg _) -- simpa [mul_assoc, mul_left_comm, mul_comm] using this -- · have hψ0 : ψ t = 0 := by -- by_contra hψ0 -- exact ht (by simpa [Function.support] using hψ0) -- simp [hψ0, mul_comm] -- -- --lemma norm_error_integral_le -- (ψ : ℝ → ℂ) (x K : ℝ) -- (hGline_meas : Measurable (fun t : ℝ => G (1 + t * I))) -- (hψ_meas : AEStronglyMeasurable ψ) -- (hx : 0 < x) -- (hK : ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K) -- (hψ : Integrable (fun t : ℝ => ‖ψ t‖) ) : -- ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ -- ≤ K * (∫ t : ℝ, ‖ψ t‖) := by -- have h1 : ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ -- ≤ ∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ := by -- simpa using (norm_integral_le_integral_norm -- (f := fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I)))) -- have hmeas_main : AEStronglyMeasurable -- (fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))) := by -- have hG' : AEMeasurable fun t : ℝ => G (1 + t * Complex.I) := hGline_meas.aemeasurable -- have hψ_meas' : AEMeasurable ψ := hψ_meas.aemeasurable -- have hx_ne : (x : ℂ) ≠ 0 := by exact_mod_cast (ne_of_gt hx) -- have hx_ne' : NeZero (x : ℂ) := ⟨hx_ne⟩ -- have hxpow_meas : AEMeasurable fun t : ℝ => ((x : ℂ) ^ (t * Complex.I)) := by -- have hcontℂ : Continuous fun z : ℂ => ((x : ℂ) ^ z) := -- continuous_const_cpow (z := (x : ℂ)) -- have hcont : Continuous fun t : ℝ => ((x : ℂ) ^ ((t : ℂ) * Complex.I)) := -- hcontℂ.comp (by -- have h : Continuous fun t : ℝ => (t : ℂ) * Complex.I := by -- simpa using! (continuous_ofReal.mul continuous_const) -- simpa [mul_comm] using h) -- exact hcont.measurable.aemeasurable -- have hGψ_meas : AEMeasurable fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) := hG'.mul hψ_meas' -- have htotal : AEMeasurable (fun t : ℝ => -- (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))) := -- hGψ_meas.mul hxpow_meas -- exact htotal.aestronglyMeasurable -- have hpt : (fun t : ℝ => -- ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) -- ≤ᵐ[volume] (fun t : ℝ => K * ‖ψ t‖) := by -- refine Eventually.of_forall ?_ -- intro t -- exact norm_integrand_le_K_mul_norm_psi (hx := hx) (hK := hK) t -- have hR : Integrable (fun t : ℝ => K * ‖ψ t‖) := hψ.const_mul K -- have hL : Integrable (fun t : ℝ => -- ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) := by -- have hpt_norm : -- (fun t : ℝ => ‖‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖‖) -- ≤ᵐ[volume] (fun t : ℝ => K * ‖ψ t‖) := hpt.mono (by -- intro t ht -- simpa [norm_mul, mul_comm, mul_left_comm, mul_assoc] using ht) -- exact hR.mono' hmeas_main.norm hpt_norm -- have h2 : (∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) -- ≤ ∫ t : ℝ, K * ‖ψ t‖ := integral_mono_ae (μ := (volume : Measure ℝ)) hL hR hpt -- have h3 : (∫ t : ℝ, K * ‖ψ t‖) = K * (∫ t : ℝ, ‖ψ t‖) := by -- simp [integral_const_mul] -- calc -- ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ -- ≤ ∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ := h1 -- _ ≤ ∫ t : ℝ, K * ‖ψ t‖ := h2 -- _ = K * (∫ t : ℝ, ‖ψ t‖) := h3 -- -- -- --@[blueprint "crude-upper-bound" -- (title := "crude-upper-bound") -- (statement := /-- -- If $\psi: \R \to \C$ is $C^2$ and compactly supported with $f$ and $\hat \psi$ non-negative, then there exists a constant $B$ such that -- $$ |\sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} )| \leq B$$ -- for all $x > 0$. -- -/) -- (proof := /-- This readily follows from the previous lemma and the triangle inequality. -/) -- (proofUses := ["limiting-fourier-variant"]) -- (latexEnv := "corollary")] --lemma crude_upper_bound -- (hpos : 0 ≤ f) -- (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (ψ : CS 2 ℂ) -- (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) : -- ∃ B : ℝ, ∀ x : ℝ, 0 < x → ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ B := by -- -- -- Integrability of ψ -- have hψ_int : MeasureTheory.Integrable (ψ : ℝ → ℂ) := by -- simpa using (ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2) -- have hψ_norm_int : MeasureTheory.Integrable (fun t : ℝ => ‖(ψ : ℝ → ℂ) t‖) := -- hψ_int.norm -- have hψ_meas : MeasureTheory.AEStronglyMeasurable (ψ : ℝ → ℂ) := -- hψ_int.aestronglyMeasurable -- -- -- Uniform bound K for ‖G(1+it)‖ on support ψ -- rcases exists_bound_norm_G_on_tsupport (G := G) hG ψ with ⟨K, hK_ts⟩ -- have hK_support : -- ∀ t : ℝ, t ∈ Function.support (ψ : ℝ → ℂ) → ‖G (1 + t * Complex.I)‖ ≤ K := by -- have hbnG (hKts : ∀ t : ℝ, t ∈ tsupport ψ → ‖G (1 + t * Complex.I)‖ ≤ K) : -- ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K := by -- intro t ht -- exact hKts t ((subset_tsupport ψ) ht) -- exact hbnG hK_ts -- -- -- Measurability of the line restriction t ↦ G(1 + t I) from continuity-on -- have hGline_meas : Measurable (fun t : ℝ => G (1 + t * Complex.I)) := by -- have hline_cont : Continuous (fun t : ℝ => (1 : ℂ) + t * Complex.I) := by -- continuity -- have hmem : ∀ t : ℝ, ((1 : ℂ) + t * Complex.I) ∈ {s : ℂ | 1 ≤ s.re} := by -- intro t -- simp -- have hcont : Continuous (G ∘ fun t : ℝ => (1 : ℂ) + t * Complex.I) := -- hG.comp_continuous hline_cont hmem -- simpa [Function.comp] using! hcont.measurable -- -- -- L¹ bound for the scaled Fourier transform norm -- have hF_norm_int : -- MeasureTheory.Integrable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := -- integrable_norm_fourier_scaled_of_CS2 ψ -- have hF_meas : -- MeasureTheory.AEStronglyMeasurable -- (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := by -- have hcont : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) u := by -- simpa using! continuous_FourierIntegral (ψ : W21) -- have hcont_scaled : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) := -- hcont.comp (by continuity) -- exact hcont_scaled.aestronglyMeasurable -- have hF_int : -- MeasureTheory.Integrable (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := -- by -- have hfin_norm : -- MeasureTheory.HasFiniteIntegral -- (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := -- hF_norm_int.hasFiniteIntegral -- have hfin : -- MeasureTheory.HasFiniteIntegral -- (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := by -- simpa [MeasureTheory.hasFiniteIntegral_iff_norm] using hfin_norm -- exact ⟨hF_meas, hfin⟩ -- refine ⟨K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) -- + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖), ?_⟩ -- intro x hx -- set I : ℂ := ∫ u in Set.Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) with hI -- -- -- Lemma 12 -- have hlim := -- limiting_fourier_variant (f := f) (A := A) (G := G) -- hpos hG hG' hf ψ hψpos hx -- have hlim' : -- (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) -- - A * I -- = ∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I) := by -- simpa [hI] using hlim -- -- -- express the tsum as RHS + A*I -- have htsum : -- (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) -- = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := by -- have h' : -- (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) -- = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := -- eq_add_of_sub_eq hlim' -- simpa [add_comm, mul_comm, mul_left_comm, mul_assoc] using h' -- -- -- bound the RHS integral -- have hRHS_bound : -- ‖∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)‖ -- ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) := -- norm_error_integral_le (G := G) (ψ := (ψ : ℝ → ℂ)) (x := x) (K := K) -- hGline_meas hψ_meas hx hK_support hψ_norm_int -- -- -- bound the A * I term -- have hA_bound : -- ‖A * I‖ ≤ ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by -- have hF_on : MeasureTheory.IntegrableOn -- (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) -- (Set.Ici (-Real.log x)) := -- hF_int.integrableOn -- simpa [hI] using -- norm_mul_integral_Ici_le_integral_norm (A := A) -- (F := fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) -- (a := -Real.log x) hF_on hF_norm_int -- -- -- combine bounds -- have htsum_std : -- (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))) -- = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := by -- simpa [one_div, mul_comm, mul_left_comm, mul_assoc] using htsum -- -- -- bound in the normalized form -- have hbound : -- ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) -- (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ -- ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) -- + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by -- have hnorm : -- ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) -- (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ = -- ‖(∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I‖ := -- congrArg norm htsum_std -- calc -- ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) -- (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ -- = ‖(∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I‖ := hnorm -- _ ≤ ‖∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)‖ + ‖A * I‖ := -- norm_add_le _ _ -- _ ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) -- + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := -- add_le_add hRHS_bound hA_bound -- exact hbound -- --set_option backward.isDefEq.respectTransparency false in --lemma Real.fourierIntegral_convolution {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) : -- 𝓕 (convolution f g (ContinuousLinearMap.mul ℂ ℂ) volume) = 𝓕 f * 𝓕 g := by -- ext y -- simp only [Pi.mul_apply, FourierTransform.fourier, MeasureTheory.convolution, -- VectorFourier.fourierIntegral, ContinuousLinearMap.mul_apply'] -- have h_int : Integrable (fun p : ℝ × ℝ ↦ 𝐞 (-(y * p.1)) • (f p.2 * g (p.1 - p.2))) := by -- simp only [Circle.smul_def, smul_eq_mul] -- refine (Integrable.convolution_integrand (ContinuousLinearMap.mul ℂ ℂ) hf hg).bdd_mul -- (c := 1) ?_ ?_ -- · exact (by continuity : Continuous _).aestronglyMeasurable -- · filter_upwards with p; simp -- calc ∫ v, 𝐞 (-(y * v)) • ∫ t, f t * g (v - t) -- = ∫ v, ∫ t, 𝐞 (-(y * v)) • (f t * g (v - t)) := by -- simp only [Circle.smul_def, smul_eq_mul, ← integral_const_mul] -- _ = ∫ t, ∫ v, 𝐞 (-(y * v)) • (f t * g (v - t)) := integral_integral_swap h_int -- _ = ∫ t, f t • ∫ v, 𝐞 (-(y * v)) • g (v - t) := by -- simp only [Circle.smul_def, smul_eq_mul, mul_left_comm, integral_const_mul] -- _ = ∫ t, f t • ∫ u, 𝐞 (-(y * (u + t))) • g u := by -- congr 1; ext t -- rw [← integral_add_right_eq_self (fun v ↦ 𝐞 (-(y * v)) • g (v - t)) t]; simp -- _ = ∫ t, f t • ∫ u, (𝐞 (-(y * t)) * 𝐞 (-(y * u))) • g u := by -- congr 2 with t; congr 1 -- simp only [mul_add, neg_add, mul_comm, Real.fourierChar.map_add_eq_mul] -- _ = ∫ t, 𝐞 (-(y * t)) • f t • ∫ u, 𝐞 (-(y * u)) • g u := by -- congr 1; ext t -- simp only [mul_smul, Circle.smul_def, smul_eq_mul, integral_const_mul]; ring -- _ = (∫ t, 𝐞 (-(y * t)) • f t) * ∫ u, 𝐞 (-(y * u)) • g u := by -- simp only [Circle.smul_def, smul_eq_mul, ← mul_assoc, integral_mul_const] -- --lemma Real.fourierIntegral_conj_neg {f : ℝ → ℂ} (y : ℝ) : -- 𝓕 (fun x ↦ conj (f (-x))) y = conj (𝓕 f y) := by -- simp only [fourier_real_eq] -- have h_conj : ∀ x, 𝐞 (-(x * y)) • conj (f (-x)) = conj (𝐞 (x * y) • f (-x)) := fun x ↦ by -- simp only [Circle.smul_def, Real.fourierChar_apply, map_mul, smul_eq_mul, neg_mul, -- Complex.ofReal_neg, mul_neg] -- congr 1 -- rw [← Complex.exp_conj] -- simp only [map_mul, Complex.conj_I, Complex.conj_ofReal, mul_neg] -- calc ∫ x, 𝐞 (-(x * y)) • conj (f (-x)) -- = ∫ x, conj (𝐞 (x * y) • f (-x)) := by congr 1; ext x; exact h_conj x -- _ = conj (∫ x, 𝐞 (x * y) • f (-x)) := integral_conj -- _ = conj (∫ x, 𝐞 (-(x * y)) • f x) := by -- rw [← integral_neg_eq_self (fun x => 𝐞 (-(x * y)) • f x)] -- congr 2 with x; ring_nf -- --/-- Smooth compactly supported function with non-negative Fourier transform via self-convolution. -/ --lemma auto_cheby_exists_smooth_nonneg_fourier_kernel : -- ∃ (ψ : ℝ → ℂ), ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ -- (∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) ∧ 0 < (𝓕 ψ 0).re := by -- obtain ⟨φ_real, hφSmooth, hφCompact, hφIcc, _, hφsupp⟩ := -- smooth_urysohn_support_Ioo (a := 1/2) (b := 1) (c := 1) (d := 2) (by norm_num) (by norm_num) -- let φ : ℝ → ℂ := Complex.ofReal ∘ φ_real -- let φ_rev : ℝ → ℂ := fun x ↦ conj (φ (-x)) -- let ψ_fun : ℝ → ℂ := convolution φ φ_rev (ContinuousLinearMap.mul ℂ ℂ) volume -- have hφSmooth' : ContDiff ℝ ∞ φ := contDiff_ofReal.comp hφSmooth -- have hφCompact' : HasCompactSupport φ := hφCompact.comp_left rfl -- have hφRevSmooth : ContDiff ℝ ∞ φ_rev := Complex.conjCLE.contDiff.comp (hφSmooth'.comp contDiff_neg) -- have hφRevCompact : HasCompactSupport φ_rev := (hφCompact'.comp_homeomorph (Homeomorph.neg ℝ)).comp_left (by simp) -- have hφInt : Integrable φ := hφSmooth'.continuous.integrable_of_hasCompactSupport hφCompact' -- have hφRevInt : Integrable φ_rev := hφRevSmooth.continuous.integrable_of_hasCompactSupport hφRevCompact -- have hψSmooth : ContDiff ℝ ∞ ψ_fun := by -- convert! hφRevCompact.contDiff_convolution_right (ContinuousLinearMap.mul ℝ ℂ) -- (hφSmooth'.continuous.locallyIntegrable (μ := volume)) hφRevSmooth -- have hψCompact : HasCompactSupport ψ_fun := -- HasCompactSupport.convolution (ContinuousLinearMap.mul ℂ ℂ) hφCompact' hφRevCompact -- refine ⟨ψ_fun, hψSmooth, hψCompact, fun y ↦ ?_, ?_⟩ -- · rw [Real.fourierIntegral_convolution hφInt hφRevInt, Pi.mul_apply, -- Real.fourierIntegral_conj_neg y, mul_comm, ← Complex.normSq_eq_conj_mul_self] -- exact ⟨Complex.normSq_nonneg _, rfl⟩ -- · have hφ_nonneg : ∀ x, 0 ≤ φ_real x := fun x ↦ by -- have hx := hφIcc x; by_cases h : x ∈ Set.Icc (1:ℝ) 1 -- · simp only [Set.indicator_of_mem h, Pi.one_apply] at hx; linarith -- · simp only [Set.indicator_of_notMem h] at hx; exact hx -- have hvol_supp : (1 : ENNReal) ≤ volume (Function.support φ_real) := by -- have hsub : Set.Ico (1:ℝ) 2 ⊆ Function.support φ_real := fun x hx ↦ -- hφsupp.symm ▸ Set.mem_Ioo.mpr ⟨by linarith [hx.1], hx.2⟩ -- calc _ = volume (Set.Ico (1:ℝ) 2) := by simp [Real.volume_Ico]; norm_num -- _ ≤ _ := volume.mono hsub -- have hφint_pos : 0 < ∫ x, φ_real x := -- (integral_pos_iff_support_of_nonneg_ae (.of_forall hφ_nonneg) -- (hφSmooth.continuous.integrable_of_hasCompactSupport hφCompact)).2 -- (lt_of_lt_of_le (by simp) hvol_supp) -- have hFφ0_re : 0 < (𝓕 φ 0).re := by -- simp only [φ, fourier_real_eq, mul_zero, neg_zero, AddChar.map_zero_eq_one, one_smul, -- Function.comp_apply] -- have hint : Integrable (fun x => (φ_real x : ℂ)) := -- (hφSmooth.continuous.integrable_of_hasCompactSupport hφCompact).ofReal -- calc (∫ x, (φ_real x : ℂ)).re = ∫ x, (φ_real x : ℂ).re := (integral_re hint).symm -- _ = ∫ x, φ_real x := by simp only [Complex.ofReal_re] -- _ > 0 := hφint_pos -- rw [Real.fourierIntegral_convolution hφInt hφRevInt, Pi.mul_apply, -- Real.fourierIntegral_conj_neg 0, mul_comm, ← Complex.normSq_eq_conj_mul_self] -- exact Complex.normSq_pos.2 (fun h ↦ (ne_of_gt hFφ0_re) (by simp [h])) -- -- --/-- The series `∑ f(n)/n · 𝓕ψ(log(n/x)/(2π))` is summable for `x ≥ 1`. -/ --lemma auto_cheby_fourier_summable (hpos : 0 ≤ f) (hf : ∀ σ', 1 < σ' → Summable (nterm f σ')) -- (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -- (ψ : ℝ → ℂ) (hψSmooth : ContDiff ℝ ∞ ψ) (hψCompact : HasCompactSupport ψ) -- (hψpos : ∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) (x : ℝ) (hx : 1 ≤ x) : -- Summable fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x)) := by -- let ψCS : CS 2 ℂ := ⟨ψ, hψSmooth.of_le (by norm_cast), hψCompact⟩ -- let S : ℝ → ℂ := fun σ' ↦ ∑' n, term (f · : ℕ → ℂ) σ' n * 𝓕 ψCS.toFun (1 / (2 * π) * Real.log (n / x)) -- let Pole : ℝ → ℂ := fun σ' ↦ (A : ℂ) * (x ^ (1 - σ') : ℝ) * -- ∫ u in Set.Ici (-Real.log x), (rexp (-u * (σ' - 1)) : ℂ) * 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π)) -- let RHS : ℝ → ℂ := fun σ' ↦ ∫ t : ℝ, G (σ' + t * I) * ψCS.toFun t * (x : ℂ) ^ (t * I) -- have l2 := limiting_fourier_lim2 (A := A) (x := x) ψCS hx -- have l3 := limiting_fourier_lim3 (G := G) hG ψCS hx -- have haux : (fun σ' ↦ S σ' - Pole σ') =ᶠ[𝓝[>] 1] RHS := eventually_nhdsWithin_of_forall fun σ' hσ' ↦ by -- simpa [S, Pole, RHS] using! limiting_fourier_aux hG' hf ψCS hx σ' hσ' -- have hS_tendsto : Tendsto S (𝓝[>] 1) (𝓝 (RHS 1 + A * ∫ u in Set.Ici (-Real.log x), -- 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π)))) := by -- convert! (l3.congr' haux.symm).add l2 using 1; ext σ'; simp [S, Pole] -- have hbounded : BoundedAtFilter (𝓝[>] 1) (fun σ' ↦ ‖S σ'‖) := by -- simp only [BoundedAtFilter] -- let L := ‖RHS 1 + A * ∫ u in Set.Ici (-Real.log x), 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π))‖ -- have : ∀ᶠ σ' in 𝓝[>] 1, ‖S σ'‖ < L + 1 := -- hS_tendsto.norm.eventually_lt tendsto_const_nhds (lt_add_one L) -- exact Asymptotics.IsBigO.of_bound (L + 1) (by filter_upwards [this] with σ h; simpa using h.le) -- let y : ℕ → ℝ := fun n ↦ (1 / (2 * π)) * Real.log (n / x) -- let w : ℕ → ℝ := fun n ↦ (𝓕 ψCS.toFun (y n)).re -- have hw : ∀ n, 0 ≤ w n := fun n ↦ (hψpos (y n)).1 -- let rt : ℝ → ℕ → ℝ := fun σ n ↦ if n = 0 then 0 else f n / (n : ℝ) ^ σ * w n -- have rt_nn σ n : 0 ≤ rt σ n := by -- simp only [rt]; split_ifs with hn -- · rfl -- · exact mul_nonneg (div_nonneg (hpos n) (Real.rpow_pos_of_pos (Nat.cast_pos.mpr -- (Nat.pos_of_ne_zero hn)) σ).le) (hw n) -- have hS_eq σ' (hσ' : 1 < σ') : S σ' = ↑(∑' n, rt σ' n) := by -- rw [Complex.ofReal_tsum]; apply tsum_congr; intro n -- simp only [rt, term, LSeries.term, y, w, one_div, mul_inv_rev] -- split_ifs with hn <;> simp only [hn, CharP.cast_eq_zero, Complex.ofReal_zero, zero_mul, -- Complex.ofReal_mul, Complex.ofReal_div] -- rw [Complex.ofReal_cpow (Nat.cast_nonneg n)]; congr 1 -- exact Complex.ext rfl (hψpos _).2 -- have hMono n : AntitoneOn (fun σ ↦ rt σ n) (Set.Ioi 1) := fun σ₁ _ σ₂ _ h ↦ by -- simp only [rt]; split_ifs with hn; · rfl -- apply mul_le_mul_of_nonneg_right _ (hw n) -- apply div_le_div_of_nonneg_left (hpos n) (Real.rpow_pos_of_pos (Nat.cast_pos.mpr -- (Nat.pos_of_ne_zero hn)) σ₁) -- exact Real.rpow_le_rpow_of_exponent_le (Nat.one_le_cast.mpr (Nat.pos_of_ne_zero hn)) h -- have hT_bdd : BoundedAtFilter (𝓝[>] 1) fun σ ↦ ∑' n, rt σ n := by -- rw [BoundedAtFilter, Asymptotics.isBigO_iff] at hbounded ⊢ -- obtain ⟨C, hC⟩ := hbounded -- refine ⟨C, ?_⟩ -- filter_upwards [hC, self_mem_nhdsWithin] with σ hnorm hσ -- rw [hS_eq σ hσ] at hnorm; simpa using hnorm -- have hSumm σ (hσ : 1 < σ) : Summable (rt σ ·) := by -- simpa [rt, w, y] using limiting_fourier_variant_lim1_aux ψCS hpos hf hψpos σ hσ -- have hSumm_1 : Summable (rt 1 ·) := by -- let σ_seq : ℕ → ℝ := fun k ↦ 1 + 1 / ((k : ℝ) + 1) -- have hσ_gt k : 1 < σ_seq k := by simp only [σ_seq, lt_add_iff_pos_right, one_div]; positivity -- have h_tendsto : Tendsto σ_seq atTop (𝓝[>] 1) := by -- rw [tendsto_nhdsWithin_iff] -- refine ⟨?_, by filter_upwards with k; exact hσ_gt k⟩ -- have : Tendsto (fun k : ℕ ↦ 1 / ((k : ℝ) + 1)) atTop (𝓝 0) := by -- simp only [one_div]; exact (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds).inv_tendsto_atTop -- simpa [σ_seq] using tendsto_const_nhds.add this -- have h_ptwise n : Tendsto (fun k ↦ rt (σ_seq k) n) atTop (𝓝 (rt 1 n)) := by -- simp only [rt]; split_ifs with hn; · exact tendsto_const_nhds -- refine ((tendsto_const_nhds.rpow (tendsto_nhdsWithin_iff.mp h_tendsto).1 (Or.inl ?_)).inv₀ -- (by simp [hn])).const_mul (f n) |>.mul_const (w n) -- exact (Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)).ne' -- obtain ⟨C, hC⟩ := Asymptotics.isBigO_iff.mp (hT_bdd.comp_tendsto h_tendsto) -- refine summable_of_sum_range_le (c := C) (rt_nn 1) fun m ↦ le_of_tendsto (tendsto_finsetSum _ -- fun i _ ↦ h_ptwise i) ?_ -- filter_upwards [h_tendsto.eventually self_mem_nhdsWithin, hC] with k hk hCk -- calc ∑ i ∈ Finset.range m, rt (σ_seq k) i -- ≤ ∑' n, rt (σ_seq k) n := (hSumm _ hk).sum_le_tsum _ fun n _ ↦ rt_nn _ n -- _ ≤ |∑' n, rt (σ_seq k) n| := le_abs_self _ -- _ ≤ C := by simpa using hCk -- rw [show (fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x))) = -- Complex.ofRealCLM ∘ (rt 1 ·) from ?_] -- · exact hSumm_1.map Complex.ofRealCLM Complex.ofRealCLM.continuous -- ext n; simp only [rt, Real.rpow_one, one_div, w, y, Function.comp_apply] -- split_ifs with hn; · simp [hn] -- have him0 : (𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x))).im = 0 := (hψpos _).2 -- have hre_eq : 𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x)) = -- Complex.ofReal ((𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x))).re) := by -- rw [← Complex.re_add_im (𝓕 ψCS.toFun _), him0]; simp -- conv_lhs => rw [show ψ = ψCS.toFun from rfl, hre_eq] -- simp only [Complex.ofRealCLM_apply, Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_natCast] -- --/-- Short interval bound from global filtered bound: if `∑ f(n)/n · 𝓕ψ(log(n/x)) ≤ B`, --then `∑_{(1-ε)x < n ≤ x} f(n) ≤ Cx` for some `ε, C > 0`. -/ --lemma auto_cheby_short_interval_bound (hpos : 0 ≤ f) -- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -- (B : ℝ) (ψ : ℝ → ℂ) (hψSmooth : ContDiff ℝ ∞ ψ) (hψCompact : HasCompactSupport ψ) -- (hψpos : ∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) (hψ0 : 0 < (𝓕 ψ 0).re) -- (hB_bound : ∀ x ≥ 1, ‖∑' n, f n / n * 𝓕 ψ (1 / (2 * Real.pi) * Real.log (n / x))‖ ≤ B) : -- ∃ (ε : ℝ) (C : ℝ), ε > 0 ∧ ε < 1 ∧ C > 0 ∧ ∀ x ≥ 1, -- ∑' n, (f n) * (Set.indicator (Set.Ioc ((1 - ε) * x) x) (fun _ ↦ 1) (n : ℝ)) ≤ C * x := by -- have hF : Continuous (𝓕 ψ) := VectorFourier.fourierIntegral_continuous Real.continuous_fourierChar -- (by continuity) (hψSmooth.continuous.integrable_of_hasCompactSupport hψCompact) -- have hg : Continuous fun y ↦ (𝓕 ψ y).re := Complex.continuous_re.comp hF -- obtain ⟨δ, hδpos, hball⟩ := Metric.mem_nhds_iff.1 <| -- hg.continuousAt.preimage_mem_nhds (IsOpen.mem_nhds isOpen_Ioi (half_lt_self hψ0)) -- let c := (𝓕 ψ 0).re / 2 -- have hcpos : 0 < c := by dsimp only [c]; linarith -- have h_psi_ge_c : ∀ y, |y| < δ → c ≤ (𝓕 ψ y).re := fun y hy ↦ (hball (mem_ball_zero_iff.mpr hy)).le -- let ε := 1 - Real.exp (-2 * π * δ) -- have hε : 0 < ε ∧ ε < 1 := by -- have h1 : Real.exp (-2 * π * δ) < 1 := Real.exp_lt_one_iff.mpr (by nlinarith [Real.pi_pos]) -- exact ⟨by simp only [ε]; linarith, by simp only [ε]; linarith [Real.exp_pos (-2 * π * δ)]⟩ -- have hB_nonneg : 0 ≤ B := (norm_nonneg _).trans (hB_bound 1 le_rfl) -- refine ⟨ε, B / c + 1, hε.1, hε.2, by positivity, fun x hx ↦ ?_⟩ -- have h_summable : Summable fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x)) := -- auto_cheby_fourier_summable hpos hf hG hG' ψ hψSmooth hψCompact hψpos x hx -- have hx_pos : 0 < x := by linarith -- have h_sum_lower : c / x * ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ) -- ≤ ∑' n, f n / n * (𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re := by -- rw [← tsum_mul_left] -- refine Summable.tsum_le_tsum (fun n ↦ ?_) ?_ ?_ -- · by_cases hn : (n : ℝ) ∈ Set.Ioc ((1 - ε) * x) x -- · rw [Set.indicator_of_mem hn, Pi.one_apply, mul_one] -- have hn_pos : 0 < (n : ℝ) := by nlinarith [hn.1, hε.2] -- let y := (1 / (2 * π)) * Real.log (n / x) -- have h_arg_small : |y| < δ := by -- have h2pi : 0 < 2 * π := by linarith [Real.pi_pos] -- simp only [y, abs_mul, abs_div, abs_one, abs_of_pos h2pi] -- field_simp [ne_of_gt h2pi]; rw [mul_comm, abs_lt] -- have h_log_lower : -2 * π * δ < Real.log (n / x) := by -- rw [← Real.log_exp (-2 * π * δ), Real.log_lt_log_iff (Real.exp_pos _) (by positivity)] -- have : Real.exp (-2 * π * δ) = 1 - ε := by simp only [ε]; ring -- rw [this]; field_simp; exact hn.1 -- have h_log_upper : Real.log (n / x) ≤ 0 := -- Real.log_nonpos (by positivity) (div_le_one_of_le₀ hn.2 hx_pos.le) -- constructor <;> nlinarith [Real.pi_pos] -- have h1 : x⁻¹ ≤ (n : ℝ)⁻¹ := by rw [inv_le_inv₀ hx_pos hn_pos]; exact hn.2 -- have h2 : c ≤ (𝓕 ψ y).re := h_psi_ge_c y h_arg_small -- have hfn : 0 ≤ f n := hpos n -- have hre : 0 ≤ (𝓕 ψ y).re := (hψpos y).1 -- have hn_inv : 0 ≤ (n : ℝ)⁻¹ := inv_nonneg.mpr hn_pos.le -- calc c / x * f n = c * x⁻¹ * f n := by rw [div_eq_mul_inv] -- _ ≤ c * (n : ℝ)⁻¹ * f n := by gcongr -- _ ≤ (𝓕 ψ y).re * (n : ℝ)⁻¹ * f n := by gcongr -- _ = (n : ℝ)⁻¹ * (𝓕 ψ y).re * f n := by ring -- _ = f n / n * (𝓕 ψ y).re := by ring -- · rw [Set.indicator_of_notMem hn, mul_zero, mul_zero] -- exact mul_nonneg (div_nonneg (hpos n) (Nat.cast_nonneg n)) (hψpos _).1 -- · refine summable_of_hasFiniteSupport <| (Set.finite_le_nat ⌊x⌋₊).subset fun n hn ↦ ?_ -- simp only [Function.mem_support, ne_eq, mul_eq_zero, not_or, Set.indicator_apply_ne_zero] at hn -- exact Nat.le_floor hn.2.2.1.2 -- · rw [← Complex.summable_ofReal]; convert h_summable using 1; ext n -- rw [Complex.ofReal_mul, Complex.ofReal_div] -- norm_cast -- rw [Complex.ofReal_mul] -- congr 1 -- apply Complex.ext -- · simp only [Complex.ofReal_re] -- · simp only [Complex.ofReal_im]; exact (hψpos _).2.symm -- have h_real_eq : ∑' n, f n / n * (𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re = -- (∑' n, (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re := by -- rw [Complex.re_tsum h_summable]; congr with n -- rw [Complex.mul_re]; norm_cast; simp only [zero_mul, sub_zero] -- calc ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ) -- = x / c * (c / x * ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ)) := by -- field_simp [ne_of_gt hcpos, ne_of_gt hx_pos] -- _ ≤ x / c * B := by -- gcongr; rw [h_real_eq] at h_sum_lower -- exact h_sum_lower.trans ((Complex.re_le_norm _).trans (hB_bound x hx)) -- _ = (B / c) * x := by field_simp [ne_of_gt hcpos] -- _ ≤ (B / c + 1) * x := by nlinarith -- --/-- Bootstraps short interval bounds to global Chebyshev bound via strong induction. --If `∑_{(1-ε)x < n ≤ x} f(n) ≤ Cx` for all `x ≥ 1`, then `∑_{n ≤ x} f(n) = O(x)`. -/ --lemma auto_cheby_bootstrap_induction (hpos : 0 ≤ f) -- (h_short : ∃ (ε : ℝ) (C : ℝ), ε > 0 ∧ ε < 1 ∧ C > 0 ∧ ∀ x ≥ 1, -- ∑' n, (f n) * (Set.indicator (Set.Ioc ((1 - ε) * x) x) (fun _ ↦ 1) (n : ℝ)) ≤ C * x) : -- cheby f := by -- obtain ⟨ε, C₀, hε, hε1, hC₀, h_bound⟩ := h_short -- let C := C₀ / ε + f 0 + 1 -- have hf0 : (0 : ℝ) ≤ f 0 := hpos 0 -- have hdiv : 0 ≤ C₀ / ε := div_nonneg hC₀.le hε.le -- have hC : 0 ≤ C := by linarith -- refine ⟨C, fun n ↦ ?_⟩ -- induction n using Nat.strong_induction_on with | h n ih => -- rcases lt_or_ge n 2 with hn | hn -- · interval_cases n -- · simp [cumsum] -- · simp only [cumsum, Finset.sum_range_one, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hf0, -- Nat.cast_one, mul_one, C] -- linarith -- let x := (n : ℝ) - 1 -- have hx : x ≥ 1 := by simp only [x, ge_iff_le, le_sub_iff_add_le]; norm_cast -- let m := ⌊(1 - ε) * x⌋₊ + 1 -- have hm_lt : m < n := by -- simp only [m, x] -- have h1 : (1 - ε) * (n - 1 : ℝ) < (n - 1 : ℕ) := by -- calc (1 - ε) * (↑n - 1) < 1 * (↑n - 1) := by gcongr; linarith -- _ = ↑n - 1 := by ring -- _ = ↑(n - 1) := by simp [Nat.cast_sub (by omega : 1 ≤ n)] -- have h2 : ⌊(1 - ε) * (n - 1 : ℝ)⌋₊ < n - 1 := -- (Nat.floor_lt (mul_nonneg (by linarith) (by linarith : (0 : ℝ) ≤ n - 1))).mpr h1 -- omega -- have hm_gt : (m : ℝ) > (1 - ε) * x := by -- simp only [m, Nat.cast_add, Nat.cast_one, gt_iff_lt] -- exact Nat.lt_floor_add_one ((1 - ε) * x) -- have h_decomp : cumsum (fun k ↦ ‖(f k : ℂ)‖) n = cumsum (fun k ↦ ‖(f k : ℂ)‖) m + ∑ k ∈ Finset.Ico m n, f k := by -- simp only [cumsum, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hpos _), -- Finset.sum_range_add_sum_Ico _ (by omega : m ≤ n)] -- have h_Ico : ∑ k ∈ Finset.Ico m n, f k ≤ C₀ * x := by -- calc ∑ k ∈ Finset.Ico m n, f k -- = ∑ k ∈ Finset.Ico m n, f k * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (k : ℝ) := by -- refine Finset.sum_congr rfl fun k hk ↦ ?_ -- have ⟨hkm, hkn⟩ := Finset.mem_Ico.mp hk -- have hk_gt : (k : ℝ) > (1 - ε) * x := by linarith [hm_gt, (Nat.cast_le (α := ℝ)).mpr hkm] -- have hk_le : (k : ℝ) ≤ x := by -- have h1 : k ≤ n - 1 := Nat.le_pred_of_lt hkn -- have h2 : (k : ℝ) ≤ (n - 1 : ℕ) := by exact_mod_cast h1 -- simp only [Nat.cast_sub (by omega : 1 ≤ n), Nat.cast_one, x] at h2 ⊢; exact h2 -- simp only [Set.indicator_of_mem (Set.mem_Ioc.mpr ⟨hk_gt, hk_le⟩), Pi.one_apply, mul_one] -- _ ≤ ∑' k, f k * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (k : ℝ) := by -- refine Summable.sum_le_tsum _ (fun k _ ↦ mul_nonneg (hpos k) (Set.indicator_nonneg (by simp) _)) ?_ -- refine summable_of_hasFiniteSupport <| (Set.finite_le_nat ⌊x⌋₊).subset fun k hk ↦ ?_ -- simp only [Function.mem_support, ne_eq, mul_eq_zero, not_or, Set.indicator_apply_ne_zero] at hk -- exact Nat.le_floor hk.2.1.2 -- _ ≤ C₀ * x := h_bound x hx -- have hm_le : (m : ℝ) ≤ (1 - ε) * x + 1 := by -- have hpos' : 0 ≤ (1 - ε) * x := mul_nonneg (by linarith) (by linarith : (0 : ℝ) ≤ x) -- simp only [m, Nat.cast_add, Nat.cast_one] -- linarith [Nat.floor_le hpos'] -- have hnorm : ∀ k, ‖(f k : ℂ)‖ = f k := fun k ↦ by simp [abs_of_nonneg (hpos k)] -- simp only [hnorm] at h_decomp ih ⊢ -- calc cumsum f n = cumsum f m + ∑ k ∈ Finset.Ico m n, f k := h_decomp -- _ ≤ C * m + C₀ * x := by linarith [ih m hm_lt, h_Ico] -- _ ≤ C * ((1 - ε) * x + 1) + C₀ * x := by nlinarith [hC] -- _ = (C * (1 - ε) + C₀) * x + C := by ring -- _ ≤ C * x + C := by -- have : C₀ ≤ C * ε := by -- calc C₀ = (C₀ / ε) * ε := by field_simp [ne_of_gt hε] -- _ ≤ (C₀ / ε + f 0 + 1) * ε := by gcongr; linarith [hpos 0] -- _ = C * ε := by simp only [C] -- nlinarith [hε, hε1, hx] -- _ ≤ C * n := by simp only [x]; ring_nf; linarith [hC] -- --@[blueprint "auto-cheby" -- (title := "auto-cheby") -- (statement := /-- One has $$ \sum_{n \leq x} f(n) = O(x)$$ for all $x \geq 1$. -/) -- (proof := /-- -- By applying Corollary \ref{crude-upper-bound} for a specific compactly supported function $\psi$, -- one can obtain a bound of the form $\sum_{(1-\varepsilon)x < n \leq x} f(n) = O(x)$ for all $x$ -- and some absolute constant $\varepsilon$ (which can be made explicit). -- -- If $C$ is a sufficiently large constant, the claim $|\sum_{n \leq x} f(n)| \leq Cx$ can now be -- proven by strong induction on $x$, as the claim for $(1-\varepsilon)x$ implies the claim for $x$ -- by the triangle inequality (and the claim is trivial for $x < 1$). -- -/) -- (proofUses := ["crude-upper-bound", "WienerIkehara"]) -- (latexEnv := "corollary")] --lemma auto_cheby (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : cheby f := by -- obtain ⟨ψ_fun, hψSmooth, hψCompact, hψpos, hψ0⟩ := auto_cheby_exists_smooth_nonneg_fourier_kernel -- obtain ⟨B, hB⟩ := crude_upper_bound hpos hG hG' hf ⟨ψ_fun, hψSmooth.of_le ENat.LEInfty.out, hψCompact⟩ hψpos -- exact auto_cheby_bootstrap_induction hpos <| auto_cheby_short_interval_bound hpos hf hG hG' B ψ_fun -- hψSmooth hψCompact hψpos hψ0 fun x hx ↦ hB x (by linarith) -- --@[blueprint "WienerIkehara2" -- (title := "Wiener-Ikehara Theorem (2)") -- (statement := /-- We have $$ \sum_{n\leq x} f(n) = A x + o(x).$$ -/) -- (proof := /-- Use Corollary \ref{auto-cheby} to remove the Chebyshev hypothesis in Theorem \ref{WienerIkehara}. -/) -- (latexEnv := "theorem")] --theorem WienerIkeharaTheorem'' (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -- (hG : ContinuousOn G {s | 1 ≤ s.re}) -- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -- Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := -- WienerIkeharaTheorem' hpos hf (auto_cheby (f := f) (A := A) (G := G) hpos hf hG hG') hG hG' -- --end auto_cheby -- --blueprint_comment /-- --\section{The prime number theorem in arithmetic progressions} ---/ -- --@[blueprint "WeakPNT-character" -- (title := "WeakPNT-character") -- (statement := /-- -- If $q ≥ 1$ and $a$ is coprime to $q$, and $\mathrm{Re} s > 1$, we have -- $$ -- \sum_{n: n = a\ (q)} \frac{\Lambda(n)}{n^s} = - \frac{1}{\varphi(q)} \sum_{\chi\ (q)} -- \overline{\chi(a)} \frac{L'(s,\chi)}{L(s,\chi)}.$$ -- -/) -- (proof := /-- -- From the Fourier inversion formula on the multiplicative group $(\Z/q\Z)^\times$, we have -- $$ 1_{n=a\ (q)} = \frac{\varphi(q)}{q} \sum_{\chi\ (q)} \overline{\chi(a)} \chi(n).$$ -- On the other hand, from standard facts about L-series we have for each character $\chi$ that -- $$ -- \sum_{n} \frac{\Lambda(n) \chi(n)}{n^s} = - \frac{L'(s,\chi)}{L(s,\chi)}.$$ -- Combining these two facts, we obtain the claim. -- -/) -- (latexEnv := "lemma")] --theorem WeakPNT_character -- {q a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) {s : ℂ} (hs : 1 < s.re) : -- LSeries (fun n ↦ if n % q = a then Λ n else 0) s = -- - (∑' χ : DirichletCharacter ℂ q, -- ((starRingEnd ℂ) (χ a) * ((deriv (LSeries (fun n:ℕ ↦ χ n)) s)) / -- (LSeries (fun n:ℕ ↦ χ n) s))) / (Nat.totient q : ℂ) := by -- have : NeZero q := ⟨by omega⟩ -- convert vonMangoldt.LSeries_residueClass_eq ((ZMod.isUnit_iff_coprime a q).mpr ha) hs using 1 -- · congr with n -- have : n % q = a ↔ (n : ZMod q) = a := by -- rw [ZMod.natCast_eq_natCast_iff', Nat.mod_eq_of_lt ha'] -- simp [this] -- split_ifs <;> simp [*] -- · rw [div_eq_inv_mul, neg_mul_comm, tsum_fintype] -- congr 3 with χ -- rw [DirichletCharacter.deriv_LFunction_eq_deriv_LSeries _ hs, -- DirichletCharacter.LFunction_eq_LSeries _ hs, mul_div] -- congr 2 -- rw [starRingEnd_apply, MulChar.star_apply', MulChar.inv_apply_eq_inv', -- ← ZMod.coe_unitOfCoprime a ha, ZMod.inv_coe_unit, map_units_inv] -- -- --@[blueprint "WeakPNT-AP-prelim" -- (title := "WeakPNT-AP-prelim") -- (statement := /-- -- If $q ≥ 1$ and $a$ is coprime to $q$, the Dirichlet series -- $\sum_{n \leq x: n = a\ (q)} \frac{\Lambda(n)}{n^s}$ converges for $\mathrm{Re}(s) > 1$ to -- $\frac{1}{\varphi(q)} \frac{1}{s-1} + G(s)$ where $G$ has a continuous extension to -- $\mathrm{Re}(s)=1$. -- -/) -- (proof := /-- -- We expand out the left-hand side using Lemma \ref{WeakPNT-character}. The contribution of the -- non-principal characters $\chi$ extend continuously to $\mathrm{Re}(s) = 1$ thanks to the -- non-vanishing of $L(s,\chi)$ on this line (which should follow from another component of -- this project), so it suffices to show that for the principal character $\chi_0$, that -- $$ -\frac{L'(s,\chi_0)}{L(s,\chi_0)} - \frac{1}{s-1}$$ -- also extends continuously here. But we already know that -- $$ -\frac{\zeta'(s)}{\zeta(s)} - \frac{1}{s-1}$$ -- extends, and from Euler product machinery one has the identity -- $$ \frac{L'(s,\chi_0)}{L(s,\chi_0)} -- = \frac{\zeta'(s)}{\zeta(s)} + \sum_{p|q} \frac{\log p}{p^s-1}.$$ -- Since there are only finitely many primes dividing $q$, and each summand $\frac{\log p}{p^s-1}$ -- extends continuously, the claim follows. -- -/) -- (proofUses := ["ChebyshevPsi", "WeakPNT-character"]) -- (latexEnv := "proposition")] --theorem WeakPNT_AP_prelim {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) : -- ∃ G: ℂ → ℂ, (ContinuousOn G {s | 1 ≤ s.re}) ∧ -- (Set.EqOn G (fun s ↦ LSeries (fun n ↦ if n % q = a then Λ n else 0) s - 1 / -- ((Nat.totient q) * (s - 1))) {s | 1 < s.re}) := by -- have : NeZero q := NeZero.of_pos hq -- have hG : ∃ G : ℂ → ℂ, ContinuousOn G {s | 1 ≤ s.re} ∧ Set.EqOn G -- (fun s ↦ LSeries (fun n ↦ if (n : ZMod q) = a then Λ n else 0) s - (q.totient : ℂ)⁻¹ / (s - 1)) {s | 1 < s.re} := by -- use vonMangoldt.LFunctionResidueClassAux (a : ZMod q), vonMangoldt.continuousOn_LFunctionResidueClassAux (q := q) (a := a) -- have := vonMangoldt.eqOn_LFunctionResidueClassAux ((ZMod.isUnit_iff_coprime a q).mpr ha) -- convert this using 6; split <;> simp_all -- convert hG using 6 -- · simp [ZMod.natCast_eq_natCast_iff', Nat.mod_eq_of_lt ha'] -- · rw [inv_eq_one_div, div_div] -- --/-- The von Mangoldt function divided by `n ^ s` is summable for `s > 1`. -/ --lemma summable_vonMangoldt_div_rpow {s : ℝ} (hs : 1 < s) : Summable (fun n ↦ Λ n / n ^ s) := by -- have h_log_bound : ∀ n : ℕ, (Λ n : ℝ) ≤ Real.log n := fun n ↦ vonMangoldt_le_log -- suffices h_log_sum : Summable fun n : ℕ ↦ Real.log n / (n : ℝ) ^ s by -- exact .of_nonneg_of_le (fun n ↦ div_nonneg vonMangoldt_nonneg (by positivity)) -- (fun n ↦ div_le_div_of_nonneg_right (h_log_bound n) (by positivity)) h_log_sum -- have h_log_le_n_eps : ∀ ε > 0, ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n / (n : ℝ) ^ s ≤ C * (n : ℝ) ^ (ε - s) := by -- intro ε hε_pos -- obtain ⟨C, hC_pos, hC⟩ : ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n ≤ C * (n : ℝ) ^ ε := by -- refine ⟨1 / ε, by positivity, fun n hn ↦ ?_⟩ -- have := log_le_sub_one_of_pos (by positivity : 0 < (n : ℝ) ^ ε) -- rw [log_rpow (by positivity)] at this -- nlinarith [rpow_pos_of_pos (by positivity : 0 < (n : ℝ)) ε, mul_div_cancel₀ 1 hε_pos.ne'] -- refine ⟨C, hC_pos, fun n hn ↦ ?_⟩ -- rw [rpow_sub (by positivity)] -- exact le_trans (div_le_div_of_nonneg_right (hC n hn) (by positivity)) (by rw [div_eq_mul_inv]; ring_nf; norm_num) -- obtain ⟨C, _, hC⟩ : ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n / (n : ℝ) ^ s ≤ C * (n : ℝ) ^ ((s - 1) / 2 - s) := -- h_log_le_n_eps ((s - 1) / 2) (by linarith) -- rw [← summable_nat_add_iff 2] -- exact Summable.of_nonneg_of_le (fun n ↦ div_nonneg (log_nonneg (by norm_cast; omega)) -- (rpow_nonneg (by positivity) _)) (fun n ↦ hC _ (by omega)) (Summable.mul_left _ <| by -- simpa using summable_nat_add_iff 2 |>.2 <| summable_nat_rpow.2 <| by linarith) -- --@[blueprint "WeakPNT-AP" -- (title := "WeakPNT-AP") -- (statement := /-- -- If $q ≥ 1$ and $a$ is coprime to $q$, we have -- $$ \sum_{n \leq x: n = a\ (q)} \Lambda(n) = \frac{x}{\varphi(q)} + o(x).$$ -- -/) -- (proof := /-- Apply Theorem \ref{WienerIkehara} (or Theorem \ref{WienerIkehara2} to avoid -- checking the Chebyshev condition) using Proposition \ref{WeakPNT-AP-prelim}.-/) -- (proofUses := ["WienerIkehara", "WeakPNT-AP-prelim"])] --theorem WeakPNT_AP {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : a.Coprime q) (ha' : a < q) : -- Tendsto (fun N ↦ cumsum (fun n ↦ if n % q = a then Λ n else 0) N / N) atTop (𝓝 (1 / q.totient)) := by -- have h_summable : ∀ s : ℝ, 1 < s → Summable (fun n ↦ (if n % q = a then Λ n else 0) / n ^ s) := by -- intro s hs -- refine .of_nonneg_of_le (fun n ↦ ?_) (fun n ↦ ?_) (summable_vonMangoldt_div_rpow hs) -- · split_ifs <;> positivity -- · split_ifs <;> norm_num; exact div_nonneg vonMangoldt_nonneg (by positivity) -- obtain ⟨G, hG₁, hG₂⟩ := WeakPNT_AP_prelim hq ha ha' -- convert WienerIkeharaTheorem'' _ _ _ _ using 1 -- · use G -- · intro n -- simp_all only [ge_iff_le, one_div, mul_inv_rev, Pi.ofNat_apply] -- split -- next h => subst h; simp_all only [vonMangoldt_nonneg] -- next h => simp_all only [le_refl] -- · intro σ' hσ' -- specialize h_summable σ' hσ' -- simp_all only [ge_iff_le, one_div, mul_inv_rev] -- convert h_summable using 1 -- ext -- simp only [nterm, norm_real, norm_eq_abs] -- ring_nf -- split_ifs <;> simp [*, mul_comm] -- · assumption -- · convert hG₂ using 3 -- · exact tsum_congr fun n ↦ by cases n <;> aesop -- · norm_num [div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm] -- -- --blueprint_comment /-- --\section{The Chebotarev density theorem: the case of cyclotomic extensions} -- --Throughout this section, $K$ is a number field, $m \geq 1$ is a fixed integer, --$L = K(\mu_m)$, and $G = \mathrm{Gal}(L/K)$. (In particular $G$ is abelian, and for --$K=\mathbb{Q}$ one recovers $G \cong (\mathbb{Z}/m\mathbb{Z})^\times$.) --Write $\zeta_K$ and $\zeta_L$ for the Dedekind zeta functions of $K$ and $L$, and for --an abelian character $\chi : G \to \mathbb{C}^\times$ write $L(\chi,s)$ for the associated --Artin $L$-function (equivalently, the Hecke $L$-function of the ideal character attached to --$\chi$; cf.\ Notation~7.1.17 and Proposition~7.1.18 of --\url{https://www.math.ucla.edu/~sharifi/algnum.pdf}). -- --The goal of this section is to prove the Chebotarev density theorem in the cyclotomic case --(Proposition~\ref{Chebotarev-cyclotomic-density} below), following the classical argument via --Artin $L$-functions as in Sharifi, Propositions~7.1.16--7.1.19 and Proposition~7.2.1. The --abelian and general cases are then reduced to this one in the subsequent sections. ---/ -- --blueprint_comment /-- --\begin{lemma}[Artin $L$-function as Euler product]\label{Artin-L-euler} --Let $\chi : G \to \mathbb{C}^\times$ be an abelian character. For $\Re(s) > 1$ one has --\[ --L(\chi,s) \;=\; \prod_{\mathfrak{p}} \bigl(1 - \chi(\mathfrak{p})\, N\mathfrak{p}^{-s}\bigr)^{-1} --\;=\; \sum_{\mathfrak{a} \subseteq \mathcal{O}_K} \chi(\mathfrak{a})\, N\mathfrak{a}^{-s}, --\] --where the product runs over nonzero prime ideals of $\mathcal{O}_K$, with the convention --$\chi(\mathfrak{p}) = 0$ if $\mathfrak{p}$ ramifies in the fixed field of $\ker\chi$. --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof} --This is the specialisation of the Artin Euler product (Definition~7.1.15 of Sharifi) to --abelian characters; see Proposition~7.1.18 of --\url{https://www.math.ucla.edu/~sharifi/algnum.pdf}. Absolute convergence for $\Re(s)>1$ --follows from comparison with $\zeta_K(s)$. --\end{proof} ---/ -- --blueprint_comment /-- --\begin{lemma}[Dedekind-factor]\label{Dedekind-factor} --For $\Re(s) > 1$ one has --\[ --\zeta_L(s) \;=\; \prod_{\chi : G \to \mathbb{C}^\times} L(\chi,s), --\] --where the product runs over all (necessarily one-dimensional) irreducible characters of $G$. --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof}\uses{Artin-L-euler} --In general, for a Galois extension $L/K$ and characters $\chi$ of irreducible representations of --$\mathrm{Gal}(L/K)$, Proposition~7.1.16 of --\url{https://www.math.ucla.edu/~sharifi/algnum.pdf} gives --$\zeta_L(s) = \prod_\chi L(\chi,s)^{\chi(1)}$ for $\Re(s)>1$. In the present abelian --(cyclotomic) setting every irreducible character is one-dimensional, so $\chi(1)=1$ and the --exponents disappear. Alternatively, comparing Euler factors at an unramified prime --$\mathfrak{p}$: the primes of $L$ above $\mathfrak{p}$ contribute the factor --$(1 - N\mathfrak{p}^{-fs})^{-g}$ to $\zeta_L$, while the Artin factors multiply to the same --quantity by the usual identity $\prod_\chi (1 - \chi(\varphi_{\mathfrak{p}}) X) = 1 - X^f$ --(with $X = N\mathfrak{p}^{-s}$ and $f$ the residue degree). --\end{proof} ---/ -- --blueprint_comment /-- --\begin{lemma}[Simple pole]\label{Dedekind-pole} --The Dedekind zeta function $\zeta_L$ admits a meromorphic continuation to a neighbourhood of --the line $\Re(s)=1$ with a single simple pole at $s=1$ (and is otherwise holomorphic and --nonvanishing on that line after removing the pole). In particular --$\log \zeta_L(s) \sim \log(s-1)^{-1}$ as $s \to 1^+$. --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof} --This is the standard analytic continuation of Dedekind zeta (Theorem~7.1.12 of --\url{https://www.math.ucla.edu/~sharifi/algnum.pdf}): absolute convergence of the ideal --Dirichlet series and Euler product for $\Re(s)>1$, meromorphic continuation across --$\Re(s)>1-[L:\mathbb{Q}]^{-1}$, and a simple pole at $s=1$. The logarithmic asymptotic is --immediate from the simple pole. --\end{proof} ---/ -- --blueprint_comment /-- --\begin{lemma}[Continuation of nontrivial Artin $L$-functions]\label{Artin-L-continuation} --Let $\chi : G \to \mathbb{C}^\times$ be a nontrivial character. Then $L(\chi,s)$ extends to an --analytic function on the half-plane $\Re(s) > 1 - [K:\mathbb{Q}]^{-1}$, and in particular is --holomorphic at $s=1$. --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof} --Following Proposition~7.1.19 of \url{https://www.math.ucla.edu/~sharifi/algnum.pdf}: let $n$ --be the order of $\chi$. Geometry of numbers supplies the estimate that, for each $n$th root of --unity $\zeta$, the number of ideals $\mathfrak{a}$ with $N\mathfrak{a} \leq N$ and --$\chi(\mathfrak{a})=\zeta$ is $CN + O\bigl(N^{1-[K:\mathbb{Q}]^{-1}}\bigr)$ with $C$ independent of --$\zeta$. Summing against $\zeta$ cancels the main terms, so --$\sum_{N\mathfrak{a}\leq N} \chi(\mathfrak{a}) = O\bigl(N^{1-[K:\mathbb{Q}]^{-1}}\bigr)$. --Lemma~7.1.5 of Sharifi then yields absolute uniform convergence of --$\sum_{\mathfrak{a}} \chi(\mathfrak{a})\, N\mathfrak{a}^{-s}$ on compact subsets of --$\Re(s) > 1 - [K:\mathbb{Q}]^{-1}$. --\end{proof} ---/ -- --blueprint_comment /-- --\begin{lemma}[Dedekind-nonvanishing]\label{Dedekind-nonvanishing} --For any nontrivial character $\chi$ of $G = \mathrm{Gal}(L/K)$, one has $L(\chi,1) \neq 0$. --Moreover $L(\chi,s)$ does not vanish for $\Re(s)=1$. --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof}\uses{Dedekind-factor, Dedekind-pole, Artin-L-continuation} --For the value at $s=1$: write $\log\zeta_L(t) = \sum_\chi \log L(\chi,t)$ for real $t>1$. --As $t\to 1^+$, the left side is $\sim \log(t-1)^{-1}$ by Lemma~\ref{Dedekind-pole}. If some --nontrivial $L(\chi,\cdot)$ had a zero of order $m_\chi \geq 1$ at $s=1$, the right side would --behave like $\bigl(1 - \sum_\chi m_\chi\bigr)\log(t-1)^{-1}$ up to a bounded error --(the trivial character contributes the pole of $\zeta_K$, absorbed into the factorisation), --forcing $1-\sum m_\chi \leq 0$, a contradiction. Hence $L(\chi,1)\neq 0$ for all nontrivial --$\chi$ (Sharifi, Proposition~7.1.19). -- --For the rest of the line $\Re(s)=1$, $s\neq 1$: adapt the classical nonvanishing argument for --Dirichlet $L$-functions (comparison of $\zeta_L(s)$, $\zeta_L(s)^3\,|L(\chi,s)|^4$, or the --$3+4\operatorname{Re}$ inequality) using the Euler product of Lemma~\ref{Artin-L-euler} and the --absence of poles of nontrivial $L(\chi,\cdot)$ on $\Re(s)=1$ from --Lemma~\ref{Artin-L-continuation}. --\end{proof} ---/ -- --blueprint_comment /-- --\begin{lemma}[Orthogonality for Frobenius classes]\label{Chebotarev-orthogonality} --Fix $\sigma \in G$. For every prime ideal $\mathfrak{p}$ of $\mathcal{O}_K$ unramified in $L$, --\[ --\sum_{\chi : G \to \mathbb{C}^\times} \chi(\sigma)^{-1}\,\chi(\varphi_{\mathfrak{p}}) --\;=\; --\begin{cases} --|G| & \text{if }\varphi_{\mathfrak{p}} = \sigma,\\ --0 & \text{otherwise.} --\end{cases} --\] --Equivalently, if $\sigma(\zeta_m) = \zeta_m^a$ with $\gcd(a,m)=1$, the sum equals $|G|$ --precisely when $N\mathfrak{p} \equiv a \pmod{m}$. --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof} --Standard character orthogonality on the finite abelian group $G$. The reformulation in terms --of $N\mathfrak{p} \bmod m$ uses that $\varphi_{\mathfrak{p}}(\zeta_m) = \zeta_m^{N\mathfrak{p}}$ --for the cyclotomic character. --\end{proof} ---/ -- --blueprint_comment /-- --\begin{proposition}[Cyclotomic Chebotarev density]\label{Chebotarev-cyclotomic-density} --For every $\sigma \in G$, the set of prime ideals $\mathfrak{p}$ of $K$ unramified in $L$ with --Frobenius $\varphi_{\mathfrak{p}} = \sigma$ has Dirichlet density $1/|G|$. --\end{proposition} ---/ -- --blueprint_comment /-- --\begin{proof}\uses{Dedekind-factor, Dedekind-pole, Dedekind-nonvanishing, Artin-L-euler, --Chebotarev-orthogonality} --This is Proposition~7.2.1 of \url{https://www.math.ucla.edu/~sharifi/algnum.pdf}. For --$\Re(s)>1$ one has $\log L(\chi,s) \sim \sum_{\mathfrak{p}} \chi(\mathfrak{p})\, N\mathfrak{p}^{-s}$. --Summing against $\chi(\sigma)^{-1}$ and applying Lemma~\ref{Chebotarev-orthogonality} yields --\[ --\sum_{\chi} \chi(\sigma)^{-1} \log L(\chi,s) --\;\sim\; --|G| \sum_{\varphi_{\mathfrak{p}}=\sigma} N\mathfrak{p}^{-s}. --\] --On the other hand, by Lemmas~\ref{Dedekind-factor} and~\ref{Dedekind-nonvanishing} the left --side is $\sim \log\zeta_K(s) \sim \log(s-1)^{-1}$ as $s\to 1^+$ (only the trivial character --contributes a pole). Comparing the two asymptotics gives the asserted Dirichlet density. --\end{proof} ---/ -- --blueprint_comment /-- --\begin{lemma}[PNT for one character]\label{Dedekind-PNT} --For any nontrivial character $\chi$ of $G$, --\[ --\sum_{N\mathfrak{p} \leq x} \chi(\mathfrak{p})\, \log N\mathfrak{p} \;=\; o(x) --\qquad(x\to\infty). --\] --(Equivalently, writing $\Lambda_\chi$ for the von Mangoldt-type coefficients of $-\frac{L'}{L}(\chi,s)$, --one has $\sum_{n\leq x} \Lambda_\chi(n) = o(x)$.) --\end{lemma} -- --\emph{Remark on prime powers.} --Expanding $-\frac{L'}{L}(\chi,s)$ as a Dirichlet series selects coefficients supported on --prime powers $\mathfrak{p}^j$ with weight $\chi(\varphi_{\mathfrak{p}})^j\log N\mathfrak{p}$. --Thus an \emph{exact} identity expressing $-\sum_\chi \chi(\sigma)^{-1}\frac{L'}{L}(\chi,s)$ as a --sum over primes with Frobenius $\sigma$ should use the condition $\varphi_{\mathfrak{p}}^j=\sigma$ --rather than $\varphi_{\mathfrak{p}}=\sigma$. For the density statement in --Proposition~\ref{Chebotarev-cyclotomic-density} this distinction is immaterial: the $j=1$ terms --agree with the Frobenius condition, while the $j\geq 2$ terms converge absolutely for --$\Re(s)>1/2$ and do not affect the residue at $s=1$. ---/ -- --blueprint_comment /-- --\begin{proof}\uses{Dedekind-nonvanishing, Artin-L-continuation} --By Lemmas~\ref{Artin-L-continuation} and~\ref{Dedekind-nonvanishing}, $L(\chi,s)$ is holomorphic --and nonvanishing on $\Re(s)\geq 1$, so $-\frac{L'}{L}(\chi,s)$ extends continuously to --$\Re(s)\geq 1$. The claimed prime-sum estimate then follows by the same Wiener--Ikehara / --Ingham contour argument used for Dirichlet $L$-functions in the prime-number theorem in --arithmetic progressions (cf.\ the material already formalised for Dirichlet $L$-functions --earlier in this file). Passing through $\Lambda_\chi$ (rather than the bare prime sum) makes --the $j\geq 2$ prime-power contributions explicit and shows they are $O(x^{1/2}\log x)$, --hence absorbable in the $o(x)$ error; cf.\ the remark after the statement. --\end{proof} ---/ -- --blueprint_comment /-- --\section{The Chebotarev density theorem: the case of abelian extensions} -- --Now let $L/K$ be an arbitrary finite abelian extension with Galois group $G$, and fix --$\sigma \in G$. The goal is to show that the primes of $K$ with Frobenius $\sigma$ still have --Dirichlet density $1/|G|$, by reducing to the cyclotomic case already treated. --(Cf.\ Theorem~7.2.2, Step~2, of \url{https://www.math.ucla.edu/~sharifi/algnum.pdf}; cyclic --extensions already suffice for the later reduction to the general case.) ---/ -- --blueprint_comment /-- --\begin{lemma}[Cyclotomic crossing]\label{Chebotarev-abelian-crossing} --Choose an integer $m\geq 1$ not dividing the discriminant of $L/K$, large enough that --$H := \mathrm{Gal}(L(\mu_m)/L) \cong (\mathbb{Z}/m\mathbb{Z})^\times$ via the cyclotomic character --and $\mathrm{Gal}(L(\mu_m)/K) \cong G \times H$. For $\sigma\in G$ and $\tau\in H$ write --$S_{\sigma,\tau}$ for the set of primes of $K$ unramified in $L(\mu_m)$ with Frobenius --$(\sigma,\tau)\in G\times H$, and $S_\sigma$ for the set of primes of $K$ unramified in $L$ --with Frobenius $\sigma$ in $G$. Then --\[ --\delta_{\mathrm{inf}}(S_\sigma) \;=\; \sum_{\tau\in H} \delta_{\mathrm{inf}}(S_{\sigma,\tau}). --\] --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof} --Every prime counted in $S_\sigma$ lifts to primes in the various $S_{\sigma,\tau}$ according to --the Frobenius in the cyclotomic layer; the identity of lower densities is the usual additivity --of Dirichlet densities over a finite partition (up to the finitely many ramified primes). --\end{proof} ---/ -- --blueprint_comment /-- --\begin{lemma}[Density after cyclotomic crossing]\label{Chebotarev-abelian-density} --In the notation of Lemma~\ref{Chebotarev-abelian-crossing}, if the order of $\tau\in H$ is --divisible by $|G|$, then $\langle(\sigma,\tau)\rangle \cap (G\times\{1\}) = \{1\}$, so --$L(\mu_m)$ is obtained by adjoining $\mu_m$ to the fixed field --$F := L(\mu_m)^{\langle(\sigma,\tau)\rangle}$. Applying Proposition~\ref{Chebotarev-cyclotomic-density} --to the cyclotomic extension $F(\mu_m)/F$ and transporting densities as in the reduction step --of Theorem~7.2.2 yields $\delta(S_{\sigma,\tau}) = 1/(|G|\,|H|)$. --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof}\uses{Chebotarev-cyclotomic-density, Chebotarev-abelian-crossing} --See Sharifi, Theorem~7.2.2, Step~2 (display after ``Now suppose that $|G|$ divides the order of --$\tau$''). --\end{proof} ---/ -- --blueprint_comment /-- --\begin{proposition}[Abelian Chebotarev]\label{Chebotarev-abelian} --Let $L/K$ be finite abelian with Galois group $G$. For every $\sigma\in G$, the Dirichlet --density of primes of $K$ with Frobenius $\sigma$ exists and equals $1/|G|$. --\end{proposition} ---/ -- --blueprint_comment /-- --\begin{proof}\uses{Chebotarev-abelian-crossing, Chebotarev-abelian-density, --Chebotarev-cyclotomic-density} --Let $H_n \subset H$ be the set of elements whose order is divisible by $n$. Summing the --densities of Lemma~\ref{Chebotarev-abelian-density} over $\tau\in H_n$ gives --$\delta_{\mathrm{inf}}(S_\sigma) \geq |H_n|/(|G|\,|H|)$. Choosing $m$ so that $|H_n|/|H|$ is --arbitrarily close to $1$ (possible since there are primes $m\equiv 1\pmod{n^j}$ by the --cyclotomic case already proved, and $|H_n|/|H|$ tends to $1$ as $j\to\infty$), one obtains --$\delta_{\mathrm{inf}}(S_\sigma) \geq 1/|G|$. Summing over $\sigma\in G$ forces equality --throughout, so each density exists and equals $1/|G|$. --\end{proof} ---/ -- --blueprint_comment /-- --\section{The Chebotarev density theorem: the general case} -- --Finally let $L/K$ be an arbitrary finite Galois extension with group $G$, and let $C\subset G$ --be a conjugacy class. The theorem reduces to the abelian (indeed cyclic) case already proved, --by passing to the fixed field of an element of $C$. ---/ -- --blueprint_comment /-- --\begin{lemma}[Reduction to a cyclic subextension]\label{Chebotarev-reduction} --Fix $\sigma\in C$ and let $E$ be the fixed field of $\langle\sigma\rangle$, so $L/E$ is cyclic of --degree $f = |\langle\sigma\rangle|$. Write $S$ for the set of primes of $K$ unramified in $L$ --whose Frobenius class equals $C$, and $T_\sigma$ for the set of primes $\mathfrak{P}$ of $E$ --unramified in $L$ (and lying over $K$) with Frobenius equal to $\sigma$. Then --\[ --\delta(S) \;=\; \frac{f\,|C|}{|G|}\,\delta(T_\sigma), --\] --whenever either density exists. In particular, the Chebotarev statement for $L/K$ and $C$ --follows from the abelian statement for the cyclic extension $L/E$ and the element $\sigma$. --\end{lemma} ---/ -- --blueprint_comment /-- --\begin{proof} --If $\mathfrak{P}\in T_\sigma$, then $\varphi_{\mathfrak{P}}=\sigma$ fixes $E$, so $\mathfrak{P}$ has --residue degree one over $K$. There are exactly $|G|/f$ primes of $L$ over $\mathfrak{P}\cap K$, --and their Frobenii are equidistributed among the $|C|$ elements of the conjugacy class $C$; --exactly $|G|/(f\,|C|)$ of them have Frobenius $\sigma$. Comparing the Dirichlet series --$\sum N\mathfrak{p}^{-s}$ over $S$ with $\sum N\mathfrak{P}^{-s}$ over $T_\sigma$ (and using --$\sum_{\mathfrak{p}} N\mathfrak{p}^{-s} \sim \sum_{\mathfrak{P}} N\mathfrak{P}^{-s}$) yields the --displayed identity. See Sharifi, Theorem~7.2.2, Step~1. --\end{proof} ---/ -- --blueprint_comment /-- --\begin{theorem}[Chebotarev density theorem]\label{Chebotarev-general} --Let $L/K$ be a finite Galois extension of number fields with Galois group $G$, and let --$C\subset G$ be a conjugacy class. The set of prime ideals $\mathfrak{p}$ of $K$ unramified in --$L$ whose Frobenius conjugacy class equals $C$ has Dirichlet density $|C|/|G|$. --\end{theorem} ---/ -- --blueprint_comment /-- --\begin{proof}\uses{Chebotarev-reduction, Chebotarev-abelian} --Combine Lemma~\ref{Chebotarev-reduction} with Proposition~\ref{Chebotarev-abelian} applied to --the cyclic extension $L/E$: the latter gives $\delta(T_\sigma) = 1/f$, whence --$\delta(S) = |C|/|G|$. --\end{proof} ---/ -diff --git a/PrimeNumberTheoremAnd/ZetaFive.lean b/PrimeNumberTheoremAnd/ZetaFive.lean -new file mode 100644 -index 0000000..6e3d2a8 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/ZetaFive.lean -@@ -0,0 +1,5 @@ -+import PrimeNumberTheoremAnd.ZetaFive.Sobolev -+import PrimeNumberTheoremAnd.ZetaFive.Fourier -+import PrimeNumberTheoremAnd.ZetaFive.SmoothExistence -+import PrimeNumberTheoremAnd.ZetaFive.Wiener -+import PrimeNumberTheoremAnd.ZetaFive.Consequences -diff --git a/PrimeNumberTheoremAnd/ZetaFive/Consequences.lean b/PrimeNumberTheoremAnd/ZetaFive/Consequences.lean -new file mode 100644 -index 0000000..aa7c25c ---- /dev/null -+++ b/PrimeNumberTheoremAnd/ZetaFive/Consequences.lean -@@ -0,0 +1,66 @@ -+import Mathlib.Analysis.Asymptotics.SpecificAsymptotics -+import Mathlib.Analysis.SpecialFunctions.Log.Basic -+import PrimeNumberTheoremAnd.ZetaFive.Wiener -+ -+namespace ZetaFivePNT -+ -+open ArithmeticFunction hiding log -+open Nat hiding log -+open _root_.Finset -+open BigOperators _root_.Filter _root_.Real _root_.Asymptotics -+open scoped Chebyshev -+ -+theorem WeakPNT' : Tendsto (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) atTop (nhds 1) := by -+ have : (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) = -+ (fun N ↦ (∑ n ∈ range N, Λ n)/N + Λ N / N) := by -+ ext N -+ have : N ∈ Iic N := mem_Iic.mpr (le_refl _) -+ rw [← Finset.sum_erase_add _ _ this, ← Nat.Iio_eq_range, Iic_erase] -+ exact add_div _ _ _ -+ rw [this, ← add_zero 1] -+ apply Tendsto.add WeakPNT -+ convert squeeze_zero (f := fun N ↦ Λ N / N) (g := fun N ↦ log N / N) (t₀ := atTop) ?_ ?_ ?_ -+ · intro N -+ exact div_nonneg vonMangoldt_nonneg (cast_nonneg N) -+ · intro N -+ exact div_le_div_of_nonneg_right vonMangoldt_le_log (cast_nonneg N) -+ simpa only [Function.comp_def, pow_one, one_mul, add_zero] using -+ (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 one_ne_zero).comp -+ tendsto_natCast_atTop_atTop -+ -+theorem WeakPNT'' : ψ ~[atTop] (fun x ↦ x) := by -+ rw [(by rfl : ψ = (fun x ↦ ψ x))] -+ simp_rw [Chebyshev.psi_eq_sum_Icc] -+ apply IsEquivalent.trans (v := fun x ↦ (⌊x⌋₊:ℝ)) -+ · rw [isEquivalent_iff_tendsto_one] -+ · convert Tendsto.comp WeakPNT' (tendsto_nat_floor_atTop (α := ℝ)) using 1 -+ ext x -+ rfl -+ rw [eventually_iff] -+ simp only [ne_eq, cast_eq_zero, floor_eq_zero, not_lt, mem_atTop_sets, -+ Set.mem_ofPred_eq] -+ use 1 -+ simp only [imp_self, implies_true] -+ exact Asymptotics.isEquivalent_nat_floor -+ -+theorem isLittleO_sqrt_mul_log : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] _root_.id := by -+ have : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] fun x ↦ x := by -+ refine (isLittleO_mul_iff_isLittleO_div ?_).mpr ?_ -+ · filter_upwards [eventually_gt_atTop 0] with x hx; exact (sqrt_ne_zero hx.le).mpr hx.ne' -+ · convert isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2) using 2 with x -+ rw [div_sqrt, sqrt_eq_rpow] -+ exact this -+ -+theorem chebyshev_asymptotic : θ ~[atTop] id := by -+ rw [← sub_sub_self ψ θ] -+ refine WeakPNT''.sub_isLittleO -+ (IsBigO.trans_isLittleO (g := fun x ↦ 2 * x.sqrt * x.log) ?_ ?_) -+ · rw [isBigO_iff']; refine ⟨1, one_pos, ?_⟩ -+ simp only [one_mul, eventually_atTop] -+ exact ⟨2, fun x hx ↦ by -+ rw [Pi.sub_apply, norm_eq_abs, norm_eq_abs, abs_of_nonneg (by bound : 0 ≤ 2 * √x * log x)] -+ exact (abs_of_nonneg (sub_nonneg.mpr (Chebyshev.theta_le_psi x))).symm ▸ -+ Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log (by linarith : 1 ≤ x)⟩ -+ · convert isLittleO_sqrt_mul_log.const_mul_left 2 using 1 <;> first | rfl | (funext x; ring) -+ -+end ZetaFivePNT -diff --git a/PrimeNumberTheoremAnd/ZetaFive/Fourier.lean b/PrimeNumberTheoremAnd/ZetaFive/Fourier.lean -new file mode 100644 -index 0000000..95d8904 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/ZetaFive/Fourier.lean -@@ -0,0 +1,42 @@ -+import Mathlib.Topology.ContinuousMap.Bounded.Basic -+import Mathlib.Analysis.Fourier.FourierTransformDeriv -+import PrimeNumberTheoremAnd.ZetaFive.Sobolev -+ -+namespace ZetaFivePNT -+ -+open FourierTransform Real Complex MeasureTheory Filter Topology BoundedContinuousFunction -+ SchwartzMap VectorFourier BigOperators -+ -+section lemmas -+ -+@[simp] theorem F_neg {f : ℝ → ℂ} {u : ℝ} : 𝓕 (fun x => -f x) u = - 𝓕 f u := by -+ simp [fourier_eq, integral_neg] -+ -+@[simp] theorem F_add {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : -+ 𝓕 (fun x => f x + g x) x = 𝓕 f x + 𝓕 g x := by -+ exact congr_fun (fourierIntegral_add continuous_fourierChar continuous_inner hf hg) x -+ -+@[simp] theorem F_sub {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : -+ 𝓕 (fun x => f x - g x) x = 𝓕 f x - 𝓕 g x := by -+ simpa [sub_eq_add_neg, Pi.neg_def] using F_add hf hg.neg x -+ -+@[simp] theorem F_mul {f : ℝ → ℂ} {c : ℂ} {u : ℝ} : -+ 𝓕 (fun x => c * f x) u = c * 𝓕 f u := by -+ exact congr_fun (VectorFourier.fourierIntegral_const_smul 𝐞 _ _ f c) u -+ -+end lemmas -+ -+theorem fourierIntegral_self_add_deriv_deriv (f : W21) (u : ℝ) : -+ (1 + u ^ 2) * 𝓕 (f : ℝ → ℂ) u = -+ 𝓕 (fun u : ℝ => (f u - (1 / (4 * π ^ 2)) * deriv^[2] f u : ℂ)) u := by -+ have l1 : Integrable (fun x => (((π : ℂ) ^ 2)⁻¹ * 4⁻¹) * deriv (deriv f) x) := by -+ apply Integrable.const_mul ; simpa [iteratedDeriv_succ] using f.integrable le_rfl -+ have l4 : Differentiable ℝ f := f.differentiable -+ have l5 : Differentiable ℝ (deriv f) := f.deriv.differentiable -+ simp [f.hf, l1, add_mul, Real.fourier_deriv f.hf' l5 f.hf'', Real.fourier_deriv f.hf l4 f.hf'] -+ field_simp [pi_ne_zero] ; ring_nf ; simp -+ -+@[simp] theorem deriv_ofReal : deriv ofReal = fun _ => 1 := by -+ ext x ; exact ((hasDerivAt_id x).ofReal_comp).deriv -+ -+end ZetaFivePNT -diff --git a/PrimeNumberTheoremAnd/ZetaFive/SmoothExistence.lean b/PrimeNumberTheoremAnd/ZetaFive/SmoothExistence.lean -new file mode 100644 -index 0000000..6dad927 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/ZetaFive/SmoothExistence.lean -@@ -0,0 +1,43 @@ -+import Mathlib.Geometry.Manifold.PartitionOfUnity -+import Mathlib.Tactic.Bound -+ -+namespace ZetaFivePNT -+ -+open MeasureTheory Set Real -+open scoped ContDiff -+ -+theorem smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : -+ ∃ Ψ : ℝ → ℝ, (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ -+ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 ∧ -+ (Function.support Ψ = Set.Ioo a d) := by -+ have := exists_contDiff_zero_iff_one_iff_of_isClosed (n := ⊤) -+ (s := Set.Iic a ∪ Set.Ici d) (t := Set.Icc b c) -+ (IsClosed.union isClosed_Iic isClosed_Ici) isClosed_Icc -+ (by -+ simp_rw [Set.disjoint_union_left, Set.disjoint_iff, Set.subset_def, -+ Set.mem_inter_iff, Set.mem_Iic, Set.mem_Icc, Set.mem_empty_iff_false, -+ and_imp, imp_false, not_le, Set.mem_Ici] -+ constructor <;> intros <;> linarith) -+ obtain ⟨Ψ, hΨSmooth, hΨrange, hΨ0, hΨ1⟩ := this -+ simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, Set.mem_Icc] at * -+ use Ψ -+ simp only [range_subset_iff, mem_Icc] at hΨrange -+ refine ⟨hΨSmooth, ?_, ?_, ?_, ?_⟩ -+ · apply HasCompactSupport.of_support_subset_isCompact (K := Set.Icc a d) isCompact_Icc -+ simp only [Function.support_subset_iff, ne_eq, mem_Icc, ← hΨ0, not_or] -+ bound -+ · apply Set.indicator_le' -+ · intro x hx -+ rw [hΨ1 x |>.mp, Pi.one_apply] -+ simpa using hx -+ · exact fun x _ ↦ (hΨrange x).1 -+ · intro x -+ apply Set.le_indicator_apply -+ · exact fun _ ↦ (hΨrange x).2 -+ · intro hx -+ rw [← hΨ0 x |>.mp] -+ simpa [-not_and, mem_Ioo, not_and_or, not_lt] using hx -+ · ext x -+ simp only [Function.mem_support, ne_eq, mem_Ioo, ← hΨ0, not_or, not_le] -+ -+end ZetaFivePNT -diff --git a/PrimeNumberTheoremAnd/ZetaFive/Sobolev.lean b/PrimeNumberTheoremAnd/ZetaFive/Sobolev.lean -new file mode 100644 -index 0000000..10b6035 ---- /dev/null -+++ b/PrimeNumberTheoremAnd/ZetaFive/Sobolev.lean -@@ -0,0 +1,401 @@ -+import Mathlib.Analysis.Calculus.Deriv.Support -+import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas -+import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv -+import Mathlib.Order.Filter.ZeroAndBoundedAtFilter -+ -+namespace ZetaFivePNT -+ -+open Real Complex MeasureTheory Filter Topology BoundedContinuousFunction SchwartzMap BigOperators -+open scoped ContDiff -+ -+variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {n : ℕ} -+ -+ -+ -+structure CS (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where -+ -+ toFun : ℝ → E -+ h1 : ContDiff ℝ n toFun -+ h2 : HasCompactSupport toFun -+ -+@[ext] protected theorem CS.ext {n : ℕ} {E : Type*} -+ [NormedAddCommGroup E] [NormedSpace ℝ E] {x y : CS n E} -+ (h : x.toFun = y.toFun) : x = y := by -+ cases x -+ cases y -+ cases h -+ rfl -+ -+ -+ -+structure trunc extends (CS 2 ℝ) where -+ h3 : (Set.Icc (-1) (1)).indicator 1 ≤ toFun -+ h4 : toFun ≤ Set.indicator (Set.Ioo (-2) (2)) 1 -+ -+ -+ -+structure W1 (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where -+ -+ toFun : ℝ → E -+ smooth : ContDiff ℝ n toFun -+ integrable : ∀ ⦃k⦄, k ≤ n → Integrable (iteratedDeriv k toFun) -+ -+ -+ -+abbrev W21 := W1 2 ℂ -+ -+section lemmas -+ -+ -+noncomputable def funscale {E : Type*} (g : ℝ → E) (R x : ℝ) : E := g (R⁻¹ • x) -+ -+theorem contDiff_ofReal : ContDiff ℝ ∞ ofReal := Complex.ofRealCLM.contDiff -+ -+omit [NormedSpace ℝ E] in -+theorem tendsto_funscale {f : ℝ → E} (hf : ContinuousAt f 0) (x : ℝ) : -+ Tendsto (fun R => funscale f R x) atTop (𝓝 (f 0)) := -+ hf.tendsto.comp (by simpa using tendsto_inv_atTop_zero.mul_const x) -+ -+end lemmas -+ -+namespace CS -+ -+variable {f : CS n E} {R x v : ℝ} -+ -+instance : CoeFun (CS n E) (fun _ => ℝ → E) where coe := CS.toFun -+ -+instance : Coe (CS n ℝ) (CS n ℂ) where coe f := ⟨fun x => f x, -+ contDiff_ofReal.of_le (mod_cast le_top) |>.comp f.h1, f.h2.comp_left (g := ofReal) rfl⟩ -+ -+ -+def neg (f : CS n E) : CS n E where -+ toFun := -f -+ h1 := f.h1.neg -+ h2 := f.h2.neg -+ -+instance : Neg (CS n E) where neg := neg -+ -+@[simp] theorem neg_apply {x : ℝ} : (-f) x = - (f x) := rfl -+ -+ -+def smul (R : ℝ) (f : CS n E) : CS n E := ⟨R • f, f.h1.const_smul R, f.h2.smul_left⟩ -+ -+instance : HSMul ℝ (CS n E) (CS n E) where hSMul := smul -+ -+@[simp] theorem smul_apply : (R • f) x = R • f x := rfl -+ -+theorem continuous (f : CS n E) : Continuous f := f.h1.continuous -+ -+ -+ -+noncomputable def deriv (f : CS (n + 1) E) : CS n E where -+ toFun := _root_.deriv f -+ h1 := (contDiff_succ_iff_deriv.mp f.h1).2.2 -+ h2 := f.h2.deriv -+ -+theorem hasDerivAt (f : CS (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := -+ (f.h1.differentiable (by simp)).differentiableAt.hasDerivAt -+ -+theorem deriv_apply {f : CS (n + 1) E} {x : ℝ} : f.deriv x = _root_.deriv f x := rfl -+ -+theorem deriv_smul {f : CS (n + 1) E} : (R • f).deriv = R • f.deriv := by -+ ext x ; exact (f.hasDerivAt x |>.const_smul R).deriv -+ -+ -+ -+noncomputable def scale (g : CS n E) (R : ℝ) : CS n E := by -+ by_cases h : R = 0 -+ · exact ⟨0, contDiff_const, by simp [HasCompactSupport, tsupport]⟩ -+ · refine ⟨fun x => funscale g R x, ?_, ?_⟩ -+ · exact g.h1.comp (contDiff_const_smul R⁻¹) -+ · exact g.h2.comp_smul (inv_ne_zero h) -+ -+theorem deriv_scale {f : CS (n + 1) E} : (f.scale R).deriv = R⁻¹ • f.deriv.scale R := by -+ ext v ; by_cases hR : R = 0 -+ · simp [hR, scale, deriv] -+ · simp only [scale, hR, ↓reduceDIte, smul_apply] -+ exact ((f.hasDerivAt (R⁻¹ • v)).scomp v -+ (by convert (hasDerivAt_const_mul (x := v) R⁻¹) using 1)).deriv -+ -+theorem deriv_scale' {f : CS (n + 1) E} : -+ (f.scale R).deriv v = R⁻¹ • f.deriv (R⁻¹ • v) := by -+ rw [deriv_scale, smul_apply] -+ by_cases hR : R = 0 <;> simp [hR, scale, funscale] -+ -+theorem hasDerivAt_scale (f : CS (n + 1) E) (R x : ℝ) : -+ HasDerivAt (f.scale R) (R⁻¹ • _root_.deriv f (R⁻¹ • x)) x := by -+ convert hasDerivAt (f.scale R) x ; rw [deriv_scale'] ; rfl -+ -+theorem tendsto_scale (f : CS n E) (x : ℝ) : Tendsto (fun R => f.scale R x) atTop (𝓝 (f 0)) := by -+ apply (tendsto_funscale f.continuous.continuousAt x).congr' -+ filter_upwards [eventually_ne_atTop 0] with R hR ; simp [scale, hR] -+ -+theorem bounded : ∃ C, ∀ v, ‖f v‖ ≤ C := by -+ obtain ⟨x, hx⟩ := -+ (continuous_norm.comp f.continuous).exists_forall_ge_of_hasCompactSupport f.h2.norm -+ exact ⟨_, hx⟩ -+ -+end CS -+ -+namespace trunc -+ -+instance : CoeFun trunc (fun _ => ℝ → ℝ) where coe f := f.toFun -+ -+instance : Coe trunc (CS 2 ℝ) where coe := trunc.toCS -+ -+theorem nonneg (g : trunc) (x : ℝ) : 0 ≤ g x := (Set.indicator_nonneg (by simp) x).trans (g.h3 x) -+ -+theorem le_one (g : trunc) (x : ℝ) : g x ≤ 1 := -+ (g.h4 x).trans <| Set.indicator_le_self' (by simp) x -+ -+theorem zero (g : trunc) : g =ᶠ[𝓝 0] 1 := by -+ have : Set.Icc (-1) 1 ∈ 𝓝 (0 : ℝ) := by apply Icc_mem_nhds <;> linarith -+ exact eventually_of_mem this (fun x hx => le_antisymm (g.le_one x) (by simpa [hx] using g.h3 x)) -+ -+@[simp] theorem zero_at {g : trunc} : g 0 = 1 := g.zero.eq_of_nhds -+ -+end trunc -+ -+namespace W1 -+ -+instance : CoeFun (W1 n E) (fun _ => ℝ → E) where coe := W1.toFun -+ -+theorem continuous (f : W1 n E) : Continuous f := f.smooth.continuous -+ -+theorem differentiable (f : W1 (n + 1) E) : Differentiable ℝ f := -+ f.smooth.differentiable (by simp) -+ -+theorem iteratedDeriv_sub {f g : ℝ → E} (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : -+ iteratedDeriv n (f - g) = iteratedDeriv n f - iteratedDeriv n g := by -+ funext x -+ exact _root_.iteratedDeriv_sub hf.contDiffAt hg.contDiffAt -+ -+ -+ -+noncomputable def deriv (f : W1 (n + 1) E) : W1 n E where -+ toFun := _root_.deriv f -+ smooth := contDiff_succ_iff_deriv.mp f.smooth |>.2.2 -+ integrable k hk := by -+ simpa [iteratedDeriv_succ'] using f.integrable (Nat.succ_le_succ hk) -+ -+theorem hasDerivAt (f : W1 (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := -+ f.differentiable.differentiableAt.hasDerivAt -+ -+ -+ -+def sub (f g : W1 n E) : W1 n E where -+ toFun := f - g -+ smooth := f.smooth.sub g.smooth -+ integrable k hk := by -+ have hf : ContDiff ℝ k f := f.smooth.of_le (by simp [hk]) -+ have hg : ContDiff ℝ k g := g.smooth.of_le (by simp [hk]) -+ simpa [iteratedDeriv_sub hf hg] using (f.integrable hk).sub (g.integrable hk) -+ -+instance : Sub (W1 n E) where sub := sub -+ -+theorem integrable_iteratedDeriv_Schwarz {f : 𝓢(ℝ, ℂ)} : Integrable (iteratedDeriv n f) := by -+ induction n generalizing f with -+ | zero => exact f.integrable -+ | succ n ih => -+ rw [iteratedDeriv_succ'] -+ have hd : (SchwartzMap.derivCLM ℝ ℂ f : ℝ → ℂ) = _root_.deriv f := by -+ funext x -+ exact SchwartzMap.derivCLM_apply ℝ f x -+ rw [← hd] -+ exact ih (f := SchwartzMap.derivCLM ℝ ℂ f) -+ -+ -+ -+noncomputable def ofSchwartz (f : 𝓢(ℝ, ℂ)) : W1 n ℂ where -+ toFun := f -+ smooth := f.smooth n -+ integrable _ _ := integrable_iteratedDeriv_Schwarz -+ -+end W1 -+ -+namespace W21 -+ -+variable {f : W21} -+ -+ -+ -+noncomputable def norm (f : ℝ → ℂ) : ℝ := -+ (∫ v, ‖f v‖) + (4 * π ^ 2)⁻¹ * (∫ v, ‖deriv (deriv f) v‖) -+ -+theorem norm_nonneg {f : ℝ → ℂ} : 0 ≤ norm f := -+ add_nonneg (integral_nonneg (fun t => by simp)) -+ (mul_nonneg (by positivity) (integral_nonneg (fun t => by simp))) -+ -+noncomputable instance : Norm W21 where norm := norm ∘ W1.toFun -+ -+noncomputable instance : Coe 𝓢(ℝ, ℂ) W21 where coe := W1.ofSchwartz -+ -+ -+def ofCS2 (f : CS 2 ℂ) : W21 := by -+ refine ⟨f, f.h1, ?_⟩ -+ intro k hk -+ cases k with -+ | zero => exact f.h1.continuous.integrable_of_hasCompactSupport f.h2 -+ | succ k => -+ cases k with -+ | zero => -+ simpa using (f.h1.continuous_deriv one_le_two).integrable_of_hasCompactSupport f.h2.deriv -+ | succ k => -+ have hk0 : k = 0 := -+ Nat.eq_zero_of_le_zero (Nat.le_of_succ_le_succ (Nat.le_of_succ_le_succ hk)) -+ subst k -+ simpa [iteratedDeriv_succ] using -+ (f.h1.iterate_deriv' 0 2).continuous.integrable_of_hasCompactSupport f.h2.deriv.deriv -+ -+instance : Coe (CS 2 ℂ) W21 where coe := ofCS2 -+ -+instance : HMul (CS 2 ℂ) W21 (CS 2 ℂ) where -+ hMul g f := ⟨g * f, g.h1.mul f.smooth, g.h2.mul_right⟩ -+ -+instance : HMul (CS 2 ℝ) W21 (CS 2 ℂ) where hMul g f := (g : CS 2 ℂ) * f -+ -+theorem hf (f : W21) : Integrable f := f.integrable zero_le_two -+ -+theorem hf' (f : W21) : Integrable (deriv f) := by -+ simpa [iteratedDeriv_succ] using f.integrable one_le_two -+ -+theorem hf'' (f : W21) : Integrable (deriv (deriv f)) := by -+ simpa [iteratedDeriv_succ] using f.integrable le_rfl -+ -+end W21 -+ -+theorem W21_approximation (f : W21) (g : trunc) : -+ Tendsto (fun R => ‖f - (g.scale R * f : W21)‖) atTop (𝓝 0) := by -+ -+ let f' := f.deriv -+ let f'' := f'.deriv -+ let g' := (g : CS 2 ℝ).deriv -+ let g'' := g'.deriv -+ let h R v := 1 - g.scale R v -+ let h' R := - (g.scale R).deriv -+ let h'' R := - (g.scale R).deriv.deriv -+ -+ have ch {R} : Continuous (fun v => (h R v : ℂ)) := -+ continuous_ofReal.comp <| continuous_const.sub (CS.continuous _) -+ have ch' {R} : Continuous (fun v => (h' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) -+ have ch'' {R} : Continuous (fun v => (h'' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) -+ have dh R v : HasDerivAt (h R) (h' R v) v := by -+ convert CS.hasDerivAt_scale (g : CS 2 ℝ) R v |>.const_sub 1 using 1 -+ simp [h', CS.deriv_scale', show g.deriv.toFun = deriv g.toFun from rfl] -+ have dh' R v : HasDerivAt (h' R) (h'' R v) v := ((g.scale R).deriv.hasDerivAt v).neg -+ have hh1 R v : |h R v| ≤ 1 := by -+ by_cases hR : R = 0 <;> -+ simp only [CS.scale, funscale, smul_eq_mul, hR, ↓reduceDIte, Pi.zero_apply, sub_zero, -+ abs_one, le_refl, h] -+ rw [abs_le] ; constructor <;> -+ linarith [g.le_one (R⁻¹ * v), g.nonneg (R⁻¹ * v)] -+ have vR v : Tendsto (fun R : ℝ => v * R⁻¹) atTop (𝓝 0) := by -+ simpa using tendsto_inv_atTop_zero.const_mul v -+ -+ convert_to Tendsto (fun R => W21.norm (fun v => h R v * f v)) atTop (𝓝 0) -+ · ext R ; change W21.norm _ = _ ; congr ; ext v ; simp [h, sub_mul] ; rfl -+ rw [show (0 : ℝ) = 0 + ((4 * π ^ 2)⁻¹ : ℝ) * 0 by simp] -+ refine Tendsto.add ?_ (Tendsto.const_mul _ ?_) -+ · let F R v := ‖h R v * f v‖ -+ have eh v : ∀ᶠ R in atTop, h R v = 0 := by -+ filter_upwards [(vR v).eventually g.zero, eventually_ne_atTop 0] with R hR hR' -+ simp [h, hR, CS.scale, hR', funscale, mul_comm R⁻¹] -+ have e1 : ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (F n) volume := by -+ apply Eventually.of_forall ; intro R -+ exact (ch.mul f.continuous).norm.aestronglyMeasurable -+ have e2 : ∀ᶠ (n : ℝ) in atTop, ∀ᵐ (a : ℝ), ‖F n a‖ ≤ ‖f a‖ := by -+ apply Eventually.of_forall ; intro R -+ apply Eventually.of_forall ; intro v -+ simpa [F] using mul_le_mul (hh1 R v) le_rfl (by simp) zero_le_one -+ have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by -+ apply Eventually.of_forall ; intro v -+ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eh v] with R hR ; simp [F, hR] -+ simpa [F] using tendsto_integral_filter_of_dominated_convergence _ e1 e2 f.hf.norm e4 -+ · let F R v := ‖h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v‖ -+ convert_to Tendsto (fun R ↦ ∫ (v : ℝ), F R v) atTop (𝓝 0) -+ · have this R v : -+ deriv (deriv (fun v => h R v * f v)) v = -+ h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v := by -+ have df v : HasDerivAt f (f' v) v := f.hasDerivAt v -+ have df' v : HasDerivAt f' (f'' v) v := f'.hasDerivAt v -+ have l3 v : HasDerivAt (fun v => h R v * f v) (h' R v * f v + h R v * f' v) v := -+ (dh R v).ofReal_comp.mul (df v) -+ have l5 : HasDerivAt (fun v => h' R v * f v) (h'' R v * f v + h' R v * f' v) v := -+ (dh' R v).ofReal_comp.mul (df v) -+ have l7 : HasDerivAt (fun v => h R v * f' v) (h' R v * f' v + h R v * f'' v) v := -+ (dh R v).ofReal_comp.mul (df' v) -+ have d1 : deriv (fun v => h R v * f v) = fun v => h' R v * f v + h R v * f' v := -+ funext (fun v => (l3 v).deriv) -+ rw [d1] ; convert (l5.add l7).deriv using 1 ; ring -+ simp_rw [this, F] -+ obtain ⟨c1, mg'⟩ := g'.bounded -+ obtain ⟨c2, mg''⟩ := g''.bounded -+ let bound v := c2 * ‖f v‖ + 2 * c1 * ‖f' v‖ + ‖f'' v‖ -+ have e1 : ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (F n) volume := by -+ apply Eventually.of_forall ; intro R ; apply (Continuous.norm ?_).aestronglyMeasurable -+ exact ((ch''.mul f.continuous).add ((continuous_const.mul ch').mul f.deriv.continuous)).add -+ (ch.mul f.deriv.deriv.continuous) -+ have e2 : ∀ᶠ R in atTop, ∀ᵐ (a : ℝ), ‖F R a‖ ≤ bound a := by -+ have hc1 : ∀ᶠ R in atTop, ∀ v, |h' R v| ≤ c1 := by -+ filter_upwards [eventually_ge_atTop 1] with R hR v -+ have hR' : R ≠ 0 := by linarith -+ have : 0 ≤ R := by linarith -+ simp only [CS.deriv_scale, CS.neg_apply, CS.smul_apply, smul_eq_mul, abs_neg, abs_mul, -+ abs_inv, abs_eq_self.mpr this, ge_iff_le, h'] -+ simp only [CS.scale, hR', ↓reduceDIte, funscale, smul_eq_mul] -+ convert_to _ ≤ c1 * 1 -+ · simp -+ · rw [mul_comm] -+ apply mul_le_mul (mg' _) -+ (inv_le_of_inv_le₀ (by linarith) (by simpa using hR)) (by positivity) -+ exact (abs_nonneg _).trans (mg' 0) -+ have hc2 : ∀ᶠ R in atTop, ∀ v, |h'' R v| ≤ c2 := by -+ filter_upwards [eventually_ge_atTop 1] with R hR v -+ have e1 : 0 ≤ R := by linarith -+ have e2 : R⁻¹ ≤ 1 := inv_le_of_inv_le₀ (by linarith) (by simpa using hR) -+ have e3 : R ≠ 0 := by linarith -+ simp only [CS.deriv_scale, CS.deriv_smul, CS.neg_apply, CS.smul_apply, smul_eq_mul, abs_neg, -+ abs_mul, abs_inv, abs_eq_self.mpr e1, ge_iff_le, h''] -+ convert_to _ ≤ 1 * (1 * c2) -+ · simp -+ apply mul_le_mul e2 ?_ (by positivity) zero_le_one -+ apply mul_le_mul e2 ?_ (by positivity) zero_le_one -+ simp only [CS.scale, e3, ↓reduceDIte, funscale, smul_eq_mul] ; apply mg'' -+ filter_upwards [hc1, hc2] with R hc1 hc2 -+ apply Eventually.of_forall ; intro v ; specialize hc1 v ; specialize hc2 v -+ simp only [F, bound, norm_norm] -+ refine (norm_add_le _ _).trans ?_ ; apply add_le_add -+ · refine (norm_add_le _ _).trans ?_ ; apply add_le_add <;> simp only [Complex.norm_mul, -+ Complex.norm_ofNat, norm_real, norm_eq_abs] <;> gcongr -+ · simpa using mul_le_mul (hh1 R v) le_rfl (by simp) zero_le_one -+ have e3 : Integrable bound volume := -+ (((f.hf.norm).const_mul _).add ((f.hf'.norm).const_mul _)).add f.hf''.norm -+ have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by -+ apply Eventually.of_forall ; intro v -+ have evg' : (g' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) := by -+ have hzero : (g : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 1) := g.zero -+ change _root_.deriv (g : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) -+ simpa only [deriv_const'] using hzero.deriv -+ have evg'' : (g'' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) := by -+ change _root_.deriv (g' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) -+ simpa only [deriv_const'] using evg'.deriv -+ refine tendsto_norm_zero.comp <| (ZeroAtFilter.add ?_ ?_).add ?_ -+ · have eh'' v : ∀ᶠ R in atTop, h'' R v = 0 := by -+ filter_upwards [(vR v).eventually evg'', eventually_ne_atTop 0] with R hR hR' -+ simp only [CS.deriv_scale, CS.deriv_smul, CS.neg_apply, CS.smul_apply, smul_eq_mul, -+ neg_eq_zero, mul_eq_zero, inv_eq_zero, hR', false_or, h''] -+ simp only [CS.scale, hR', ↓reduceDIte, funscale, smul_eq_mul, mul_comm R⁻¹] -+ exact hR -+ apply tendsto_nhds_of_eventually_eq -+ filter_upwards [eh'' v] with R hR ; simp [hR] -+ · have eh' v : ∀ᶠ R in atTop, h' R v = 0 := by -+ filter_upwards [(vR v).eventually evg'] with R hR -+ simp [g'] at hR -+ simp [h', CS.deriv_scale', mul_comm R⁻¹, hR] -+ apply tendsto_nhds_of_eventually_eq -+ filter_upwards [eh' v] with R hR ; simp [hR] -+ · simpa [h, Filter.ZeroAtFilter] using -+ ((g.tendsto_scale v).const_sub 1).ofReal.mul tendsto_const_nhds -+ simpa [F] using tendsto_integral_filter_of_dominated_convergence bound e1 e2 e3 e4 -+ -+end ZetaFivePNT -diff --git a/PrimeNumberTheoremAnd/ZetaFive/Wiener.lean b/PrimeNumberTheoremAnd/ZetaFive/Wiener.lean -new file mode 100644 -index 0000000..18c58cb ---- /dev/null -+++ b/PrimeNumberTheoremAnd/ZetaFive/Wiener.lean -@@ -0,0 +1,2358 @@ -+import Mathlib.Analysis.Fourier.RiemannLebesgueLemma -+import Mathlib.Analysis.Normed.Group.Tannery -+import Mathlib.Analysis.SumIntegralComparisons -+import Mathlib.NumberTheory.Chebyshev -+import Mathlib.NumberTheory.LSeries.PrimesInAP -+import Mathlib.NumberTheory.MulChar.Lemmas -+import PrimeNumberTheoremAnd.ZetaFive.Fourier -+import PrimeNumberTheoremAnd.ZetaFive.SmoothExistence -+import Mathlib.Analysis.Convolution -+import Mathlib.MeasureTheory.Group.Circle -+ -+namespace ZetaFivePNT -+ -+open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries -+ Asymptotics SchwartzMap -+open Complex hiding log -+open scoped Topology -+open scoped ContDiff -+open scoped ComplexConjugate -+ -+variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} -+ [RCLike 𝕜] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+noncomputable -+def nterm (f : ℕ → ℂ) (σ' : ℝ) (n : ℕ) : ℝ := if n = 0 then 0 else ‖f n‖ / n ^ σ' -+ -+theorem nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by -+ by_cases h : n = 0 <;> simp [nterm, term, h] -+ -+theorem norm_term_eq_nterm_re (s : ℂ) : -+ ‖term f s n‖ = nterm f (s.re) n := by -+ simpa only [nterm] using LSeries.norm_term_eq f s n -+ -+theorem hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : -+ ∑' i, (‖term f σ' i‖₊ : ENNReal) ≠ ⊤ := by -+ simp_rw [ENNReal.tsum_coe_ne_top_iff_summable_coe, ← norm_toNNReal] -+ norm_cast -+ apply Summable.toNNReal -+ convert hf σ' hσ with i -+ simp [nterm_eq_norm_term] -+ -+ -+attribute [fun_prop] Real.continuous_fourierChar -+ -+theorem first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ -+ (‖fourierChar (-(u * ((1 : ℝ) / ((2 : ℝ) * π) * (n / x).log))) • ψ u‖ₑ : ENNReal) := by -+ fun_prop -+ -+theorem first_fourier_aux2a : -+ (2 : ℂ) * π * -(y * (1 / (2 * π) * Real.log ((n) / x))) = -(y * ((n) / x).log) := by -+ calc -+ _ = -(y * (((2 : ℂ) * π) / (2 * π) * Real.log ((n) / x))) := by ring -+ _ = _ := by rw [div_self (by norm_num), one_mul] -+ -+theorem first_fourier_aux2 (hx : 0 < x) (n : ℕ) : -+ term f σ' n * 𝐞 (-(y * (1 / (2 * π) * Real.log (n / x)))) • ψ y = -+ term f (σ' + y * I) n • (ψ y * x ^ (y * I)) := by -+ by_cases hn : n = 0 -+ · simp [term, hn] -+ simp only [term, hn, ↓reduceIte] -+ calc -+ _ = (f n * (cexp ((2 * π * -(y * (1 / (2 * π) * Real.log (n / x)))) * I) / -+ ↑((n : ℝ) ^ σ'))) • ψ y := by -+ rw [Circle.smul_def, fourierChar_apply, ofReal_cpow (by norm_num)] -+ simp only [one_div, mul_inv_rev, mul_neg, ofReal_neg, ofReal_mul, ofReal_ofNat, ofReal_inv, -+ neg_mul, smul_eq_mul, ofReal_natCast] -+ ring -+ _ = (f n * (x ^ (y * I) / n ^ (σ' + y * I))) • ψ y := by -+ congr 2 -+ have l1 : 0 < (n : ℝ) := by simpa using Nat.pos_iff_ne_zero.mpr hn -+ have l2 : (x : ℂ) ≠ 0 := by simp [hx.ne.symm] -+ have l3 : (n : ℂ) ≠ 0 := by simp [hn] -+ rw [Real.rpow_def_of_pos l1, Complex.cpow_def_of_ne_zero l2, Complex.cpow_def_of_ne_zero l3] -+ push_cast -+ simp_rw [← Complex.exp_sub] -+ congr 1 -+ rw [first_fourier_aux2a, Real.log_div l1.ne.symm hx.ne.symm] -+ push_cast -+ rw [Complex.ofReal_log hx.le] -+ ring -+ _ = _ := by simp ; group -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hsupp : Integrable ψ) (hx : 0 < x) (hσ : 1 < σ') : -+ ∑' n : ℕ, term f σ' n * (𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))) = -+ ∫ t : ℝ, LSeries f (σ' + t * I) * ψ t * x ^ (t * I) := by -+ calc -+ _ = ∑' n, term f σ' n * ∫ (v : ℝ), 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ simp only [Real.fourier_eq] -+ simp only [one_div, mul_inv_rev, RCLike.inner_apply', conj_trivial] -+ _ = ∑' n, ∫ (v : ℝ), term f σ' n * 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ simp [integral_const_mul] -+ _ = ∫ (v : ℝ), ∑' n, term f σ' n * 𝐞 (-(v * ((1 : ℝ) / -+ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by -+ refine (integral_tsum ?_ ?_).symm -+ · refine fun _ ↦ AEMeasurable.aestronglyMeasurable ?_ -+ have := hsupp.aemeasurable -+ fun_prop -+ · simp only [enorm_mul] -+ simp_rw [lintegral_const_mul'' _ (first_fourier_aux1 hsupp.aemeasurable _)] -+ calc -+ _ = (∑' (i : ℕ), ‖term f σ' i‖ₑ) * ∫⁻ (a : ℝ), ‖ψ a‖ₑ ∂volume := by -+ simp [ENNReal.tsum_mul_right, enorm_eq_nnnorm] -+ _ ≠ ⊤ := ENNReal.mul_ne_top (hf_coe1 hf hσ) -+ (ne_top_of_lt hsupp.2) -+ _ = _ := by -+ congr 1; ext y -+ simp_rw [mul_assoc (LSeries _ _), ← smul_eq_mul (a := (LSeries _ _)), LSeries] -+ rw [← Summable.tsum_smul_const] -+ · simp_rw [first_fourier_aux2 hx] -+ · apply Summable.of_norm -+ convert hf σ' hσ with n -+ rw [norm_term_eq_nterm_re] -+ simp -+ -+ -+ -+@[continuity] -+theorem continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ -+ -+attribute [fun_prop] measurable_coe_nnreal_ennreal -+ -+theorem second_fourier_integrable_aux1a (hσ : 1 < σ') : -+ IntegrableOn (fun (x : ℝ) ↦ cexp (-((x : ℂ) * ((σ' : ℂ) - 1)))) (Ici (-Real.log x)) := by -+ norm_cast -+ suffices IntegrableOn (fun (x : ℝ) ↦ (rexp (-(x * (σ' - 1))))) (Ici (-x.log)) _ from this.ofReal -+ simp_rw [fun (a x : ℝ) ↦ (by ring : -(x * a) = -a * x)] -+ rw [integrableOn_Ici_iff_integrableOn_Ioi] -+ apply exp_neg_integrableOn_Ioi -+ linarith -+ -+theorem second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : -+ let ν : Measure (ℝ × ℝ) := (volume.restrict (Ici (-Real.log x))).prod volume -+ Integrable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • -+ (𝐞 (Multiplicative.ofAdd (-(a * (u / (2 * π))))) : ℂ) • ψ a) ν := by -+ intro ν -+ constructor -+ · apply Measurable.aestronglyMeasurable -+ change Measurable (fun p : ℝ × ℝ => -+ (rexp (-p.1 * (σ' - 1)) : ℂ) * -+ ((fourierChar (-(p.2 * (p.1 / (2 * π)))) : ℂ) * ψ p.2)) -+ fun_prop -+ · let f1 : ℝ → ENNReal := fun a1 ↦ ‖cexp (-(↑a1 * (↑σ' - 1)))‖ₑ -+ let f2 : ℝ → ENNReal := fun a2 ↦ ‖ψ a2‖ₑ -+ suffices ∫⁻ (a : ℝ × ℝ), f1 a.1 * f2 a.2 ∂ν < ⊤ by -+ simpa [hasFiniteIntegral_iff_enorm, enorm_eq_nnnorm, Function.uncurry] -+ refine (lintegral_prod_mul ?_ ?_).trans_lt ?_ <;> try fun_prop -+ exact ENNReal.mul_lt_top (second_fourier_integrable_aux1a hσ).2 hsupp.2 -+ -+theorem second_fourier_integrable_aux2 (hσ : 1 < σ') : -+ IntegrableOn (fun (u : ℝ) ↦ cexp ((1 - ↑σ' - ↑t * I) * ↑u)) (Ioi (-Real.log x)) := by -+ refine (integrable_norm_iff (Measurable.aestronglyMeasurable <| by fun_prop)).mp ?_ -+ suffices IntegrableOn (fun a ↦ rexp (-(σ' - 1) * a)) (Ioi (-x.log)) _ by simpa [Complex.norm_exp] -+ apply exp_neg_integrableOn_Ioi -+ linarith -+ -+theorem second_fourier_aux (hx : 0 < x) : -+ -(cexp (-((1 - ↑σ' - ↑t * I) * ↑(Real.log x))) / (1 - ↑σ' - ↑t * I)) = -+ ↑(x ^ (σ' - 1)) * (↑σ' + ↑t * I - 1)⁻¹ * ↑x ^ (↑t * I) := by -+ calc -+ _ = cexp (↑(Real.log x) * ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [← div_neg]; ring_nf -+ _ = (x ^ ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr (ne_of_gt hx)), Complex.ofReal_log hx.le] -+ _ = (x ^ ((σ' : ℂ) - 1)) * (x ^ (↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by -+ rw [Complex.cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt hx))] -+ _ = _ := by rw [ofReal_cpow hx.le]; push_cast; ring -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) -+ {x σ' : ℝ} (hx : 0 < x) (hσ : 1 < σ') : -+ ∫ u in Ici (-log x), Real.exp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -+ (x^(σ' - 1) : ℝ) * ∫ t, (1 / (σ' + t * I - 1)) * ψ t * x^(t * I) ∂ volume := by -+ conv in ↑(rexp _) * _ => { rw [Real.fourier_real_eq, ← smul_eq_mul, ← integral_smul] } -+ rw [MeasureTheory.integral_integral_swap] -+ swap -+ · exact second_fourier_integrable_aux1 hcont hsupp hσ -+ rw [← integral_const_mul] -+ congr 1; ext t -+ simp_rw [Circle.smul_def, smul_eq_mul, Real.fourierChar_apply, -+ ← mul_assoc, integral_mul_const] -+ rw [mul_right_comm _ (ψ t) _] -+ congr 1 -+ push_cast -+ simp_rw [← Complex.exp_add] -+ have (u : ℝ) : -+ -↑u * (↑σ' - 1) + 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I = (1 - σ' - t * I) * u := calc -+ _ = -↑u * (↑σ' - 1) + (2 * ↑π) / (2 * ↑π) * -(↑t * ↑u) * I := by ring -+ _ = -↑u * (↑σ' - 1) + 1 * -(↑t * ↑u) * I := by rw [div_self (by norm_num)] -+ _ = _ := by ring -+ simp_rw [this] -+ let c : ℂ := (1 - ↑σ' - ↑t * I) -+ have : c ≠ 0 := by simp [Complex.ext_iff, c, sub_ne_zero.mpr hσ.ne] -+ let f' (u : ℝ) := cexp (c * u) -+ let f := fun (u : ℝ) ↦ (f' u) / c -+ have hderiv : ∀ u ∈ Ici (-Real.log x), HasDerivAt f (f' u) u := by -+ intro u _ -+ rw [show f' u = cexp (c * u) * (c * 1) / c by simp only [f']; field_simp] -+ exact (hasDerivAt_id' u).ofReal_comp.const_mul c |>.cexp.div_const c -+ have hf : Tendsto f atTop (𝓝 0) := by -+ apply tendsto_zero_iff_norm_tendsto_zero.mpr -+ suffices Tendsto (fun (x : ℝ) ↦ ‖cexp (c * ↑x)‖ / ‖c‖) atTop (𝓝 (0 / ‖c‖)) by -+ simpa [f, f'] using this -+ apply Filter.Tendsto.div_const -+ suffices Tendsto (· * (1 - σ')) atTop atBot by simpa [Complex.norm_exp, mul_comm (1 - σ'), c] -+ exact Tendsto.atTop_mul_const_of_neg (by linarith) fun ⦃s⦄ h ↦ h -+ rw [integral_Ici_eq_integral_Ioi, -+ integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (second_fourier_integrable_aux2 hσ) hf] -+ simpa [f, f'] using second_fourier_aux hx -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by -+ have l1 : 0 < 1 + u ^ 2 := one_add_sq_pos _ -+ have l2 : 1 + u ^ 2 = ‖(1 : ℂ) + u ^ 2‖ := by -+ norm_cast ; simp only [Real.norm_eq_abs, abs_eq_self.2 l1.le] -+ have l3 : ‖1 / ((4 : ℂ) * ↑π ^ 2)‖ ≤ (4 * π ^ 2)⁻¹ := by simp -+ have key := fourierIntegral_self_add_deriv_deriv f u -+ simp only [Function.iterate_succ _ 1, Function.iterate_one, Function.comp_apply] at key -+ rw [F_sub f.hf (f.hf''.const_mul (1 / (4 * ↑π ^ 2)))] at key -+ rw [← div_eq_mul_inv, le_div_iff₀ l1, mul_comm, l2, ← norm_mul, key, sub_eq_add_neg] -+ apply norm_add_le _ _ |>.trans -+ change _ ≤ W21.norm _ -+ rw [norm_neg, F_mul, norm_mul, W21.norm] -+ gcongr <;> apply VectorFourier.norm_fourierIntegral_le_integral_norm -+ -+theorem decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) -+ (h : ∀ t, ‖f t‖ ≤ A * (1 + t ^ 2)⁻¹) : -+ ∫ t, ‖f t‖ ≤ π * A := by -+ have l1 : Integrable (fun x ↦ A * (1 + x ^ 2)⁻¹) := integrable_inv_one_add_sq.const_mul A -+ simp_rw [← integral_univ_inv_one_add_sq, mul_comm, ← integral_const_mul] -+ exact integral_mono (l1.mono' hf (Eventually.of_forall h)).norm l1 h -+ -+theorem decay_bounds_W21 (f : W21) (hA : ∀ t, ‖f t‖ ≤ A / (1 + t ^ 2)) -+ (hA' : ∀ t, ‖deriv (deriv f) t‖ ≤ A / (1 + t ^ 2)) (u) : -+ ‖𝓕 (f : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by -+ have l0 : 1 * (4 * π)⁻¹ * A = (4 * π ^ 2)⁻¹ * (π * A) := by field_simp -+ have l1 : ∫ (v : ℝ), ‖f v‖ ≤ π * A := by -+ apply decay_bounds_aux f.continuous.aestronglyMeasurable -+ simp_rw [← div_eq_mul_inv] ; exact hA -+ have l2 : ∫ (v : ℝ), ‖deriv (deriv f) v‖ ≤ π * A := by -+ apply decay_bounds_aux f.deriv.deriv.continuous.aestronglyMeasurable -+ simp_rw [← div_eq_mul_inv] ; exact hA' -+ apply decay_bounds_key f u |>.trans -+ change W21.norm _ * _ ≤ _ -+ simp_rw [W21.norm, div_eq_mul_inv, add_mul, l0] ; gcongr -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) -+ (hA' : ∀ t, ‖deriv^[2] ψ t‖ ≤ A / (1 + t ^ 2)) : -+ ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by -+ exact decay_bounds_W21 ψ hA hA' u -+ -+theorem decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by -+ have l1 : HasCompactSupport (fun u : ℝ => ((1 + u ^ 2) : ℝ) * ψ u) := by exact ψ.h2.mul_left -+ have := ψ.h1.continuous -+ obtain ⟨C, hC⟩ := l1.exists_bound_of_continuous (by fun_prop) -+ refine ⟨C, fun u => ?_⟩ -+ specialize hC u -+ simp only [norm_mul, Complex.norm_real, norm_of_nonneg (one_add_sq_pos u).le] at hC -+ rwa [le_div_iff₀' (one_add_sq_pos _)] -+ -+theorem decay_bounds_cor (ψ : W21) : -+ ∃ C : ℝ, ∀ u, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by -+ simpa only [div_eq_mul_inv] using ⟨_, decay_bounds_key ψ⟩ -+ -+@[continuity, fun_prop] theorem continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := -+ VectorFourier.fourierIntegral_continuous continuous_fourierChar -+ (by simp only [innerₗ_apply_apply, RCLike.inner_apply', conj_trivial, continuous_mul]) -+ ψ.hf -+ -+theorem W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : -+ Integrable fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c) := by -+ have l1 (C) : Integrable (fun u ↦ C / (1 + (u / c) ^ 2)) volume := by -+ simpa only [div_eq_mul_inv] using (integrable_inv_one_add_sq.comp_div hc).const_mul C -+ have l2 : AEStronglyMeasurable (fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c)) volume := by -+ apply Continuous.aestronglyMeasurable ; fun_prop -+ obtain ⟨C, h⟩ := decay_bounds_cor ψ -+ apply @Integrable.mono' ℝ ℂ _ volume _ _ (fun u => C / (1 + (u / c) ^ 2)) (l1 C) l2 ?_ -+ apply Eventually.of_forall (fun x => h _) -+ -+ -+ -+ -+ -+theorem continuous_LSeries_aux (hf : Summable (nterm f σ')) : -+ Continuous fun x : ℝ => LSeries f (σ' + x * I) := by -+ have l1 i : Continuous fun x : ℝ ↦ term f (σ' + x * I) i := by -+ by_cases h : i = 0 -+ · simpa [h] using continuous_const -+ · simpa [h] using continuous_const.div₀ (continuous_const.cpow (by fun_prop) (by simp [h])) -+ (fun x => by simp [h]) -+ have l2 n (x : ℝ) : ‖term f (σ' + x * I) n‖ = nterm f σ' n := by -+ simpa using norm_term_eq_nterm_re (f := f) (n := n) (σ' + x * I) -+ exact continuous_tsum l1 hf (fun n x => le_of_eq (l2 n x)) -+ -+ -+theorem limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) (σ' : ℝ) -+ (hσ' : 1 < σ') : -+ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) -+ (u / (2 * π)) = ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by -+ have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 -+ have l3 : 0 < x := zero_lt_one.trans_le hx -+ have l1 (σ') (hσ' : 1 < σ') := first_fourier hf hint l3 hσ' -+ have l2 (σ') (hσ' : 1 < σ') := second_fourier ψ.h1.continuous.measurable hint l3 hσ' -+ have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := -+ continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [l3]) -+ have l6 : Continuous fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by -+ apply ((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8 -+ have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by -+ exact l6.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right -+ have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := by -+ intro h ; have := congr_arg Complex.re h ; simp at this ; linarith -+ have l7 : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * -+ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -+ simp only [one_div, ← mul_assoc] -+ refine ((continuous_const.mul <| Continuous.inv₀ ?_ e2).mul ψ.h1.continuous).mul l8 -+ fun_prop -+ have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * -+ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by -+ apply l7.integrable_of_hasCompactSupport -+ exact ψ.h2.mul_left.mul_right.mul_left.mul_left -+ simp_rw [l1 σ' hσ', l2 σ' hσ', ← integral_const_mul, ← integral_sub l4 l5] -+ apply integral_congr_ae -+ apply Eventually.of_forall -+ intro u -+ have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] -+ simp_rw [hG' e1, sub_mul, ← mul_assoc] -+ simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, -+ mul_eq_zero, I_ne_zero, or_false] -+ left ; left -+ field_simp [e2] -+ norm_cast -+ simp [mul_assoc, ← rpow_add l3] -+ -+section nabla -+ -+variable {α E : Type*} [OfNat α 1] [Add α] [Sub α] {u : α → ℂ} -+ -+ -+def cumsum [AddCommMonoid E] (u : ℕ → E) (n : ℕ) : E := ∑ i ∈ Finset.range n, u i -+ -+ -+def nabla [Sub E] (u : α → E) (n : α) : E := u (n + 1) - u n -+ -+ -+ -+def nnabla [Sub E] (u : α → E) (n : α) : E := u n - u (n + 1) -+ -+ -+def shift (u : α → E) (n : α) : E := u (n + 1) -+ -+@[simp] theorem cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] -+ -+theorem cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : -+ cumsum u (n + 1) = cumsum u n + u n := by -+ simp [cumsum, Finset.sum_range_succ] -+ -+@[simp] theorem nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by -+ ext n ; simp [nabla, cumsum, Finset.range_add_one] -+ -+theorem neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := -+ funext (fun n => by simp [cumsum]) -+ -+theorem cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := -+ fun _ => Finset.sum_nonneg (fun i _ => hu i) -+ -+omit [Sub α] in -+theorem neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] -+ -+omit [Sub α] in -+@[simp] theorem nabla_mul [Ring E] {u : α → E} {c : E} : -+ nabla (fun n => c * u n) = c • nabla u := by -+ ext n ; simp [nabla, mul_sub] -+ -+omit [Sub α] in -+@[simp] theorem nnabla_mul [Ring E] {u : α → E} {c : E} : -+ nnabla (fun n => c * u n) = c • nnabla u := by -+ ext n ; simp [nnabla, mul_sub] -+ -+theorem nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by -+ ext n ; simp [nnabla] -+ -+end nabla -+ -+theorem Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : -+ cumsum u (n + 1) = u 0 + cumsum (shift u) n := by -+ simp_rw [add_comm n, cumsum, _root_.Finset.sum_range_add, -+ _root_.Finset.sum_range_one, add_comm 1] ; rfl -+ -+theorem Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : -+ shift (cumsum u) = (fun _ => u 0) + cumsum (shift u) := by -+ ext n ; apply Finset.sum_shift_front -+ -+theorem Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : -+ cumsum u (n + 1) = cumsum u n + u n := by -+ simp [cumsum, Finset.range_add_one, add_comm] -+ -+theorem Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : -+ shift (cumsum u) = cumsum u + u := by -+ ext n ; apply Finset.sum_shift_back -+ -+theorem summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : -+ cumsum (a * b) (n + 1) = A (n + 1) * b n - A 0 * b 0 - -+ cumsum (shift A * fun i => (b (i + 1) - b i)) n := by -+ have l1 : ∑ x ∈ Finset.range (n + 1), A (x + 1) * b x = ∑ x ∈ Finset.range n, -+ A (x + 1) * b x + A (n + 1) * b n := -+ Finset.sum_shift_back -+ have l2 : ∑ x ∈ Finset.range (n + 1), A x * b x = A 0 * b 0 + ∑ x ∈ Finset.range n, -+ A (x + 1) * b (x + 1) := -+ Finset.sum_shift_front -+ simp only [cumsum, ha, Pi.mul_apply, nabla, sub_mul, Finset.sum_sub_distrib, l1, l2, shift, -+ mul_sub] -+ abel -+ -+theorem summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : -+ cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - cumsum (shift (cumsum a) * nabla b) n := by -+ change cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - -+ cumsum (shift (cumsum a) * (fun i : ℕ => b (i + 1) - b i)) n -+ simpa using summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) -+ -+theorem summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : -+ shift (cumsum (a * b)) = shift (cumsum a) * b - cumsum (shift (cumsum a) * nabla b) := by -+ ext n ; apply summation_by_parts' -+ -+theorem summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : -+ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by -+ have l1 : (cumsum u =O[atTop] 1) ↔ _ := isBigO_one_nat_atTop_iff -+ have l2 n : ‖cumsum u n‖ = cumsum u n := by simpa using cumsum_nonneg hu n -+ simp only [BoundedAtFilter, l1, l2] -+ constructor <;> intro h <;> rcases h with ⟨C, h1⟩ -+ · exact ⟨C, fun n => sum_le_hasSum _ (fun i _ => hu i) h1⟩ -+ · exact summable_of_sum_range_le hu h1 -+ -+theorem Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : -+ Summable u := -+ summable_of_isBigO_nat hu h.isBigO -+ -+theorem summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by -+ exact ⟨ZetaFivePNT.Filter.EventuallyEq.summable huv.symm, -+ ZetaFivePNT.Filter.EventuallyEq.summable huv⟩ -+ -+theorem BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : -+ BoundedAtFilter atTop (fun n => u n + c) ↔ BoundedAtFilter atTop u := by -+ have : u = fun n => (u n + c) + (-c) := by ext n ; ring -+ simp only [BoundedAtFilter] -+ constructor <;> intro h -+ on_goal 1 => rw [this] -+ all_goals { exact h.add (const_boundedAtFilter _ _) } -+ -+theorem BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : -+ BoundedAtFilter atTop (fun n => u (n + N)) ↔ BoundedAtFilter atTop u := by -+ simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, one_mem, -+ CStarRing.norm_of_mem_unitary, mul_one, eventually_atTop] -+ constructor <;> intro hbound <;> rcases hbound with ⟨C, n₀, h⟩ <;> use C -+ · refine ⟨n₀ + N, fun n hn => ?_⟩ -+ obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' (m := N) (n := n) (by grind) -+ exact h _ <| Nat.add_le_add_iff_right.mp hn -+ · exact ⟨n₀, fun n hn => h _ (by grind)⟩ -+ -+theorem summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : -+ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by -+ obtain ⟨N, hu⟩ := eventually_atTop.mp hu -+ have e2 : cumsum (fun i ↦ u (i + N)) = fun n => cumsum u (n + N) - cumsum u N := by -+ ext n ; simp_rw [cumsum, add_comm _ N, Finset.sum_range_add] ; ring -+ rw [← summable_nat_add_iff N, summable_iff_bounded (fun n => hu _ <| Nat.le_add_left N n), e2] -+ simp_rw [sub_eq_add_neg, BoundedAtFilter.add_const, BoundedAtFilter.comp_add] -+ -+theorem bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : -+ BoundedAtFilter atTop u := by -+ simp only [BoundedAtFilter, isBigO_iff, eventually_atTop] at h ⊢ -+ obtain ⟨C, N, hC⟩ := h -+ refine ⟨C, N + 1, fun n hn => ?_⟩ -+ simp only [shift] at hC -+ have r1 : n - 1 ≥ N := Nat.le_sub_one_of_lt hn -+ have r2 : n - 1 + 1 = n := Nat.sub_add_cancel (by omega) -+ simpa [r2] using hC (n - 1) r1 -+ -+theorem dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) -+ (hAb : BoundedAtFilter atTop (shift (cumsum a) * b)) (hbb : ∀ᶠ n in atTop, b (n + 1) ≤ b n) -+ (h : Summable (shift (cumsum a) * nnabla b)) : Summable (a * b) := by -+ have l1 : ∀ᶠ n in atTop, 0 ≤ (shift (cumsum a) * nnabla b) n := by -+ filter_upwards [hbb] with n hb -+ exact mul_nonneg (by simpa [shift] using cumsum_nonneg ha (n + 1)) (sub_nonneg.mpr hb) -+ rw [summable_iff_bounded (mul_nonneg ha hb)] -+ rw [summable_iff_bounded' l1] at h -+ apply bounded_of_shift -+ simpa only [summation_by_parts'', sub_eq_add_neg, neg_cumsum, ← mul_neg, neg_nabla] -+ using hAb.add h -+ -+theorem exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : -+ ∃ v : ℕ → ℝ, range v ⊆ range u ∧ Antitone v ∧ v =ᶠ[atTop] u := by -+ obtain ⟨N, hN⟩ := eventually_atTop.mp hu -+ let v (n : ℕ) := u (if n < N then N else n) -+ refine ⟨v, ?_, ?_, ?_⟩ -+ · intro x hx -+ rcases hx with ⟨n, hn⟩ -+ exact ⟨if n < N then N else n, hn⟩ -+ · refine antitone_nat_of_succ_le (fun n => ?_) -+ by_cases h : n < N -+ · by_cases h' : n + 1 < N <;> simp [v, h, h'] -+ have : n + 1 = N := by linarith -+ simp [this] -+ · have : ¬(n + 1 < N) := by linarith -+ simp only [this, ↓reduceIte, h, ge_iff_le, v] ; apply hN ; linarith -+ · have : ∀ᶠ n in atTop, ¬(n < N) := by simpa using ⟨N, fun b hb => by linarith⟩ -+ filter_upwards [this] with n hn ; simp [v, hn] -+ -+theorem summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by -+ let u (n : ℕ) := (n * (Real.log n) ^ 2)⁻¹ -+ have l7 : ∀ᶠ n : ℕ in atTop, 1 ≤ Real.log n := -+ tendsto_atTop.mp (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) 1 -+ have l8 : ∀ᶠ n : ℕ in atTop, 1 ≤ n := eventually_ge_atTop 1 -+ have l9 : ∀ᶠ n in atTop, u (n + 1) ≤ u n := by -+ filter_upwards [l7, l8] with n l2 l8; dsimp [u]; gcongr <;> simp -+ obtain ⟨v, l1, l2, l3⟩ := exists_antitone_of_eventually l9 -+ rw [summable_congr_ae l3.symm] -+ have l4 (n : ℕ) : 0 ≤ v n := by obtain ⟨k, hk⟩ := l1 ⟨n, rfl⟩ ; rw [← hk] ; positivity -+ apply (summable_condensed_iff_of_nonneg l4 (fun _ _ _ a ↦ l2 a)).mp -+ suffices this : ∀ᶠ k : ℕ in atTop, 2 ^ k * v (2 ^ k) = ((k : ℝ) ^ 2)⁻¹ * ((Real.log 2) ^ 2)⁻¹ by -+ exact (summable_congr_ae this).mpr <| (Real.summable_nat_pow_inv.mpr one_lt_two).mul_right _ -+ have l5 : ∀ᶠ k in atTop, v (2 ^ k) = u (2 ^ k) := -+ l3.comp_tendsto <| tendsto_pow_atTop_atTop_of_one_lt Nat.le.refl -+ filter_upwards [l5, l8] with k l5 l8 -+ simp only [l5, mul_inv_rev, Nat.cast_pow, Nat.cast_ofNat, log_pow, u] -+ field_simp -+ -+theorem tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ Tendsto (fun x => a * x + b) atTop atTop := -+ tendsto_atTop_add_const_right _ b (tendsto_id.const_mul_atTop ha) -+ -+theorem isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} -+ (hf : Tendsto f atTop atTop) : (fun _ => a) =o[atTop] f := by -+ simp [tendsto_norm_atTop_atTop.comp hf] -+ -+theorem isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by -+ apply IsLittleO.add -+ · apply IsLittleO.const_mul_left ; simpa using isLittleO_pow_pow_atTop_of_lt (𝕜 := ℝ) one_lt_two -+ · apply isLittleO_const_of_tendsto_atTop _ <| tendsto_pow_atTop (by linarith) -+ -+theorem log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ (fun x => Real.log (a * x + b)) =O[atTop] Real.log := by -+ apply IsBigO.of_bound (2 : ℕ) -+ have l2 : ∀ᶠ x : ℝ in atTop, 0 ≤ log x := tendsto_atTop.mp tendsto_log_atTop 0 -+ have l3 : ∀ᶠ x : ℝ in atTop, 0 ≤ log (a * x + b) := -+ tendsto_atTop.mp (tendsto_log_atTop.comp (tendsto_mul_add_atTop ha b)) 0 -+ have l5 : ∀ᶠ x : ℝ in atTop, 1 ≤ a * x + b := tendsto_atTop.mp (tendsto_mul_add_atTop ha b) 1 -+ have l1 : ∀ᶠ x : ℝ in atTop, a * x + b ≤ x ^ 2 := by -+ filter_upwards [(isLittleO_mul_add_sq a b).eventuallyLE, l5] with x r2 l5 -+ simpa [abs_eq_self.mpr (zero_le_one.trans l5)] using r2 -+ filter_upwards [l1, l2, l3, l5] with x l1 l2 l3 l5 -+ simpa [abs_eq_self.mpr l2, abs_eq_self.mpr l3, Real.log_pow] using -+ Real.log_le_log (by linarith) l1 -+ -+theorem isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : -+ Real.log =O[atTop] (fun x => Real.log (a * x + b)) := by -+ convert (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto -+ (tendsto_mul_add_atTop (b := b) ha) using 1 -+ · ext x -+ simp only [Function.comp_apply] -+ congr -+ field_simp -+ simp -+ · rfl -+ -+theorem log_isbigo_log_div {d : ℝ} (hb : 0 < d) : -+ (fun n ↦ Real.log n) =O[atTop] (fun n ↦ Real.log (n / d)) := by -+ convert isBigO_log_mul_add (inv_pos.mpr hb) 0 using 1; simp only [add_zero]; field_simp -+ -+theorem Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : -+ f =O[atTop] (f + g) := by -+ exact h.right_isBigO_add' -+ -+theorem Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : -+ (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := -+ h.pow 2 -+ -+theorem log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : -+ (fun x ↦ Real.log x ^ 2) =O[atTop] (fun x ↦ a + Real.log (x / b) ^ 2) := by -+ apply (ZetaFivePNT.Asymptotics.IsBigO.sq (log_isbigo_log_div hb)).trans -+ simp_rw [add_comm a] -+ refine ZetaFivePNT.Asymptotics.IsBigO.add_isLittleO_right <| -+ isLittleO_const_of_tendsto_atTop _ ?_ -+ exact (tendsto_pow_atTop two_ne_zero).comp <| -+ tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb -+ -+theorem log_add_div_isBigO_log (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ (fun x ↦ Real.log ((x + a) / b)) =O[atTop] fun x ↦ Real.log x := by -+ convert log_mul_add_isBigO_log (inv_pos.mpr hb) (a / b) using 3 ; ring -+ -+theorem log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by -+ rw [nabla, ← Real.log_div (by linarith) hx.ne'] -+ calc -+ _ ≤ (x + 1) / x - 1 := Real.log_le_sub_one_of_pos (by positivity) -+ _ = x⁻¹ := by field_simp; ring -+ -+theorem nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by -+ apply IsBigO.of_bound 1 -+ filter_upwards [eventually_gt_atTop 0] with x l1 -+ have l2 : log x ≤ log (x + 1) := log_le_log l1 (by linarith) -+ simpa [nabla, abs_eq_self.mpr l1.le, abs_eq_self.mpr (sub_nonneg.mpr l2)] using -+ log_add_one_sub_log_le l1 -+ -+theorem nabla_log {b : ℝ} (hb : 0 < b) : -+ nabla (fun x => Real.log (x / b)) =O[atTop] (fun x => 1 / x) := by -+ refine EventuallyEq.trans_isBigO ?_ nabla_log_main -+ filter_upwards [eventually_gt_atTop 0] with x l2 -+ rw [nabla, log_div (by linarith) (by linarith), log_div l2.ne.symm (by linarith), nabla] ; ring -+ -+theorem nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ nabla (fun x => x * (a + Real.log (x / b) ^ 2)) =O[atTop] (fun x => Real.log x ^ 2) := by -+ have l1 : nabla (fun n => n * (a + Real.log (n / b) ^ 2)) = fun n => -+ a + Real.log ((n + 1) / b) ^ 2 + -+ (n * (Real.log ((n + 1) / b) ^ 2 - Real.log (n / b) ^ 2)) := by -+ ext n ; simp [nabla] ; ring -+ have l2 := (isLittleO_const_of_tendsto_atTop a -+ ((tendsto_pow_atTop two_ne_zero).comp tendsto_log_atTop)).isBigO -+ have l3 := ZetaFivePNT.Asymptotics.IsBigO.sq (log_add_div_isBigO_log 1 hb) -+ have l4 : (fun x => Real.log ((x + 1) / b) + Real.log (x / b)) =O[atTop] Real.log := by -+ simpa using (log_add_div_isBigO_log _ hb).add (log_add_div_isBigO_log 0 hb) -+ have e2 : (fun x : ℝ => x * (Real.log x * (1 / x))) =ᶠ[atTop] Real.log := by -+ filter_upwards [eventually_ge_atTop 1] with x hx using by field_simp -+ have l5 : (fun n ↦ n * (Real.log n * (1 / n))) =O[atTop] (fun n ↦ (Real.log n) ^ 2) := -+ e2.trans_isBigO -+ (by simpa [Function.comp_def] using -+ (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) -+ simp_rw [l1, _root_.sq_sub_sq] -+ exact ((l2.add l3).add (isBigO_refl (·) atTop |>.mul (l4.mul (nabla_log hb)) |>.trans l5)) -+ -+theorem nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ Tendsto (fun x => x * (a + Real.log (x / b) ^ 2)) atTop atTop := -+ tendsto_id.atTop_mul_atTop₀ <| tendsto_atTop_add_const_left _ _ <| -+ (tendsto_pow_atTop two_ne_zero).comp <| tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb -+ -+theorem nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : -+ ∀ᶠ x in atTop, 0 < x * (a + Real.log (x / b) ^ 2) := -+ (nnabla_bound_aux1 a hb).eventually (eventually_gt_atTop 0) -+ -+theorem Real.log_eventually_gt_atTop (a : ℝ) : -+ ∀ᶠ x in atTop, a < Real.log x := -+ Real.tendsto_log_atTop.eventually (eventually_gt_atTop a) -+ -+ -+@[local gcongr] -+theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : -+ ‖x‖ ≤ ‖y‖ := by -+ simp_rw [Real.norm_eq_abs] -+ apply abs_le_abs hxy -+ linarith -+ -+theorem nnabla_bound_aux {x : ℝ} (hx : 0 < x) : -+ nnabla (fun n ↦ 1 / (n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2))) =O[atTop] -+ (fun n ↦ 1 / (Real.log n ^ 2 * n ^ 2)) := by -+ let d n : ℝ := n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2) -+ change (fun x_1 ↦ nnabla (fun n ↦ 1 / d n) x_1) =O[atTop] _ -+ have l2 : ∀ᶠ n in atTop, 0 < d n := (nnabla_bound_aux2 ((2 * π) ^ 2) hx) -+ have l3 : ∀ᶠ n in atTop, 0 < d (n + 1) := -+ (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_id).eventually l2 -+ have l1 : ∀ᶠ n : ℝ in atTop, -+ nnabla (fun n ↦ 1 / d n) n = (d (n + 1) - d n) * (d n)⁻¹ * (d (n + 1))⁻¹ := by -+ filter_upwards [l2, l3] with n l2 l3 -+ rw [nnabla, one_div, one_div, inv_sub_inv l2.ne.symm l3.ne.symm, div_eq_mul_inv, mul_inv, -+ mul_assoc] -+ have l4 : (fun n => (d n)⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by -+ apply IsBigO.inv_rev -+ · refine (isBigO_refl _ _).mul <| (log_sq_isbigo_mul hx) -+ · filter_upwards [Real.log_eventually_gt_atTop 0, eventually_gt_atTop 0] with x hx hx' -+ rw [← not_imp_not] -+ intro _ -+ positivity -+ have l5 : (fun n => (d (n + 1))⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by -+ refine IsBigO.trans ?_ l4 -+ rw [isBigO_iff]; use 1 -+ have e3 : ∀ᶠ n in atTop, d n ≤ d (n + 1) := by -+ filter_upwards [eventually_ge_atTop x] with n hn -+ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn -+ have : 0 ≤ n := hx.le.trans hn -+ simp only [d] -+ gcongr <;> simp [Real.log_nonneg, *] -+ filter_upwards [l2, l3, e3] with n e1 e2 e3 -+ simp_rw [one_mul] -+ gcongr -+ have l6 : (fun n => d (n + 1) - d n) =O[atTop] (fun n => (Real.log n) ^ 2) := by -+ change nabla (fun n : ℝ => n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2)) -+ =O[atTop] (fun n => (Real.log n) ^ 2) -+ exact nnabla_mul_log_sq ((2 * π) ^ 2) hx -+ apply EventuallyEq.trans_isBigO l1 -+ apply ((l6.mul l4).mul l5).trans_eventuallyEq -+ filter_upwards [eventually_ge_atTop 2, Real.log_eventually_gt_atTop 0] with n hn hn' -+ field_simp -+ -+theorem nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : -+ nnabla (fun n => C / (1 + (Real.log (n / x) / (2 * π)) ^ 2) / n) =O[atTop] -+ (fun n => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by -+ field_simp -+ simp only [div_eq_mul_inv, mul_inv, nnabla_mul, one_mul] -+ apply IsBigO.const_mul_left -+ simpa [div_eq_mul_inv, mul_pow, mul_comm] using nnabla_bound_aux hx -+ -+ -+theorem cheby.bigO (h : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by -+ have l1 : 0 ≤ cumsum (‖f ·‖) := cumsum_nonneg (fun _ => norm_nonneg _) -+ obtain ⟨C, hC⟩ := h -+ apply isBigO_of_le' (c := C) atTop -+ intro n -+ rw [Real.norm_eq_abs, abs_eq_self.mpr (l1 n)] -+ simpa using hC n -+ -+theorem limiting_fourier_lim1_aux -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : -+ Summable fun n ↦ ‖f n‖ / ↑n * (C / (1 + (1 / (2 * π) * Real.log (↑n / x)) ^ 2)) := by -+ let a (n : ℕ) := (C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2) / ↑n) -+ replace hcheby := cheby.bigO hcheby -+ have l1 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n : ℕ => (↑(n + 1) : ℝ)) := -+ hcheby.comp_tendsto <| tendsto_add_atTop_nat 1 -+ have l2 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n => (n : ℝ)) := -+ l1.trans -+ (by simpa using (isBigO_refl _ _).add <| isBigO_iff.mpr ⟨1, by simpa using ⟨1, by tauto⟩⟩) -+ have l5 : BoundedAtFilter atTop (fun n : ℕ => C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2)) := by -+ simp only [BoundedAtFilter] -+ field_simp -+ apply isBigO_of_le' (c := C) ; intro n -+ have : 0 ≤ 2 ^ 2 * π ^ 2 + Real.log (n / x) ^ 2 := by positivity -+ simp only [norm_div, norm_mul, norm_eq_abs, abs_eq_self.mpr hC, norm_pow, -+ abs_eq_self.mpr pi_nonneg, abs_eq_self.mpr this, Pi.one_apply, one_mem, -+ CStarRing.norm_of_mem_unitary, mul_one, ge_iff_le, Nat.abs_ofNat] -+ apply div_le_of_le_mul₀ this hC -+ rw [mul_add, ← mul_assoc] -+ apply le_add_of_le_of_nonneg le_rfl -+ positivity -+ have l3 : a =O[atTop] (fun n => 1 / (n : ℝ)) := by -+ convert IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) using 1 -+ · ext n -+ simp [a, div_eq_mul_inv] -+ · ext n -+ simp -+ have l4 : nnabla a =O[atTop] (fun n : ℕ => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by -+ convert (nnabla_bound C hx).natCast_atTop ; simp [nnabla, a] -+ simp_rw [div_mul_eq_mul_div, mul_div_assoc, one_mul] -+ apply dirichlet_test' -+ · intro n ; exact norm_nonneg _ -+ · intro n ; positivity -+ · apply (l2.mul l3).trans_eventuallyEq -+ apply eventually_of_mem (Ici_mem_atTop 1) -+ intro x (hx : 1 ≤ x) -+ have : x ≠ 0 := Nat.one_le_iff_ne_zero.mp hx -+ simp [this] -+ · have : ∀ᶠ n : ℕ in atTop, x ≤ n := by simpa using eventually_ge_atTop ⌈x⌉₊ -+ filter_upwards [this] with n hn -+ have e1 : 0 < (n : ℝ) := by linarith -+ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn -+ have e3 := Nat.le_succ n -+ gcongr -+ refine div_nonneg (Real.log_nonneg e2) (by norm_num [pi_nonneg]) -+ · apply summable_of_isBigO_nat summable_inv_mul_log_sq -+ apply (l2.mul l4).trans_eventuallyEq -+ apply eventually_of_mem (Ici_mem_atTop 2) -+ intro x (hx : 2 ≤ x) -+ have : (x : ℝ) ≠ 0 := by simp ; linarith -+ have : Real.log x ≠ 0 := by -+ have ll : 2 ≤ (x : ℝ) := by simp [hx] -+ simp -+ grind -+ field_simp -+ -+theorem limiting_fourier_lim1 -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (ψ : W21) (hx : 0 < x) : -+ Tendsto (fun σ' : ℝ ↦ -+ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x))) (𝓝[>] 1) -+ (𝓝 (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x)))) := by -+ obtain ⟨C, hC⟩ := decay_bounds_cor ψ -+ have : 0 ≤ C := by simpa using (norm_nonneg _).trans (hC 0) -+ refine tendsto_tsum_of_dominated_convergence -+ (limiting_fourier_lim1_aux hcheby hx C this) (fun n => ?_) ?_ -+ · apply Tendsto.mul_const -+ by_cases h : n = 0 <;> simp only [term, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, -+ tendsto_const_nhds_iff] -+ refine tendsto_const_nhds.div ?_ (by simp [h]) -+ simpa using ((continuous_ofReal.tendsto 1).mono_left nhdsWithin_le_nhds).const_cpow -+ · rw [eventually_nhdsWithin_iff] -+ apply Eventually.of_forall -+ intro σ' (hσ' : 1 < σ') n -+ rw [norm_mul, ← nterm_eq_norm_term] -+ refine mul_le_mul ?_ (hC _) (norm_nonneg _) (div_nonneg (norm_nonneg _) (Nat.cast_nonneg _)) -+ by_cases h : n = 0 <;> simp only [nterm, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, le_refl] -+ have : 1 ≤ (n : ℝ) := by exact_mod_cast (show 1 ≤ n by omega) -+ refine div_le_div₀ (norm_nonneg _) le_rfl (by simpa [Nat.pos_iff_ne_zero]) ?_ -+ simpa using Real.rpow_le_rpow_of_exponent_le this hσ'.le -+ -+theorem limiting_fourier_lim2_aux (x : ℝ) (C : ℝ) : -+ Integrable (fun t ↦ max |x| 1 * (C / (1 + (t / (2 * π)) ^ 2))) -+ (Measure.restrict volume (Ici (-Real.log x))) := by -+ simp_rw [div_eq_mul_inv C] -+ exact (((integrable_inv_one_add_sq.comp_div -+ (by simp [pi_ne_zero])).const_mul _).const_mul _).restrict -+ -+theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : -+ Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * -+ ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) -+ (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by -+ obtain ⟨C, hC⟩ := decay_bounds_cor ψ -+ apply Tendsto.mul -+ · suffices h : Tendsto (fun σ' : ℝ ↦ ofReal (x ^ (1 - σ'))) (𝓝[>] 1) (𝓝 1) by -+ simpa using h.const_mul ↑A -+ suffices h : Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) from -+ (continuous_ofReal.tendsto 1).comp h -+ have : Tendsto (fun σ' : ℝ ↦ σ') (𝓝 1) (𝓝 1) := fun _ a ↦ a -+ have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := -+ tendsto_nhdsWithin_of_tendsto_nhds (by simpa using this.const_sub 1) -+ simpa using tendsto_const_nhds.rpow this (Or.inl (zero_lt_one.trans_le hx).ne.symm) -+ · refine tendsto_integral_filter_of_dominated_convergence _ ?_ ?_ -+ (limiting_fourier_lim2_aux x C) ?_ -+ · apply Eventually.of_forall ; intro σ' -+ apply Continuous.aestronglyMeasurable -+ have := continuous_FourierIntegral ψ -+ continuity -+ · apply eventually_of_mem (U := Ioo 1 2) -+ · apply Ioo_mem_nhdsGT_of_mem ; simp -+ · intro σ' hσ -+ have h1 := hσ.1 -+ have h2 := hσ.2 -+ rw [ae_restrict_iff' measurableSet_Ici] -+ apply Eventually.of_forall -+ intro t (ht : - Real.log x ≤ t) -+ rw [norm_mul] -+ have hdom_nonneg : 0 ≤ max |x| 1 := by -+ exact (abs_nonneg x).trans (le_max_left _ _) -+ refine mul_le_mul ?_ (hC _) (norm_nonneg _) hdom_nonneg -+ simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, norm_exp, -+ neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, sub_self, mul_zero, -+ sub_zero] -+ have : -Real.log x * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht (by linarith) -+ have : -(t * (σ' - 1)) ≤ Real.log x * (σ' - 1) := by simpa using neg_le_neg this -+ have := Real.exp_monotone this -+ apply this.trans -+ have l1 : σ' - 1 ≤ 1 := by linarith -+ have : 0 ≤ Real.log x := Real.log_nonneg hx -+ have := mul_le_mul_of_nonneg_left l1 this -+ refine (Real.exp_monotone this).trans ?_ -+ have hxabs : |x| = x := abs_of_nonneg (zero_le_one.trans hx) -+ calc -+ Real.exp (Real.log x * 1) = |x| := by -+ simpa [mul_one, hxabs] using (Real.exp_log (zero_lt_one.trans_le hx)) -+ _ ≤ max |x| 1 := le_max_left _ _ -+ · apply Eventually.of_forall -+ intro x -+ suffices h : Tendsto (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by -+ simpa using h.mul_const _ -+ apply Tendsto.mono_left ?_ nhdsWithin_le_nhds -+ suffices h : Continuous (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) by simpa using h.tendsto 1 -+ continuity -+ -+theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : -+ Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) -+ (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by -+ by_cases hh : tsupport ψ = ∅ -+ · simp [tsupport_eq_empty_iff.mp hh] -+ obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh -+ let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) -+ have l1 : IsCompact S := by -+ refine Metric.isCompact_iff_isClosed_bounded.mpr ⟨?_, ?_⟩ -+ · exact isClosed_Icc.reProdIm (isClosed_tsupport ψ) -+ · exact (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded -+ have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 -+ have l3 : ContinuousOn (‖G ·‖) S := (hG.mono l2).norm -+ have l4 : S.Nonempty := ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ -+ obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn l4 l3 -+ let MG := ‖G z‖ -+ let bound (a : ℝ) : ℝ := MG * ‖ψ a‖ -+ apply tendsto_integral_filter_of_dominated_convergence (bound := bound) -+ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ; intro u hu -+ apply Continuous.aestronglyMeasurable -+ apply Continuous.mul -+ · exact (hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous -+ · apply Continuous.const_cpow (by fun_prop) ; simp ; linarith -+ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) -+ intro u hu -+ apply Eventually.of_forall ; intro v -+ by_cases h : v ∈ tsupport ψ -+ · have r1 : u + v * I ∈ S := by simp [S, mem_reProdIm, hu.1, hu.2, h] -+ have r2 := isMaxOn_iff.mp hmax _ r1 -+ have r4 : (x : ℂ) ≠ 0 := by simp ; linarith -+ have r5 : arg x = 0 := by simp [arg_eq_zero_iff] ; linarith -+ have r3 : ‖(x : ℂ) ^ (v * I)‖ = 1 := by simp [norm_cpow_of_ne_zero r4, r5] -+ simp_rw [norm_mul, r3, mul_one] -+ exact mul_le_mul_of_nonneg_right r2 (norm_nonneg _) -+ · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) -+ simp at this ; simp [this, bound] -+ · suffices h : Continuous bound by exact h.integrable_of_hasCompactSupport ψ.h2.norm.mul_left -+ have := ψ.h1.continuous ; fun_prop -+ · apply Eventually.of_forall ; intro t -+ apply Tendsto.mul_const -+ apply Tendsto.mul_const -+ refine (hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr ⟨?_, ?_⟩ -+ · exact ((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds -+ · exact eventually_nhdsWithin_of_forall (fun x (hx : 1 < x) => by simp [hx.le]) -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem limiting_fourier (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : -+ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = -+ ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by -+ have l1 := limiting_fourier_lim1 hcheby ψ (by linarith) -+ have l2 := limiting_fourier_lim2 A ψ hx -+ have l3 := limiting_fourier_lim3 hG ψ hx -+ apply tendsto_nhds_unique_of_eventuallyEq (l1.sub l2) l3 -+ simpa [eventuallyEq_nhdsWithin_iff, W21.ofCS2] using -+ Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) -+ -+ -+ -+ -+theorem limiting_cor_aux {f : ℝ → ℂ} : -+ Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by -+ have l1 : ∀ᶠ x : ℝ in atTop, ∀ t : ℝ, x ^ (t * I) = exp (log x * t * I) := by -+ filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' t -+ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx'] ; ring_nf -+ have l2 : ∀ᶠ x : ℝ in atTop, ∫ t, f t * x ^ (t * I) = ∫ t, f t * exp (log x * t * I) := by -+ filter_upwards [l1] with x hx -+ refine integral_congr_ae (Eventually.of_forall (fun x => by simp [hx])) -+ simp_rw [tendsto_congr' l2] -+ convert_to Tendsto (fun x => 𝓕 f (-Real.log x / (2 * π))) atTop (𝓝 0) -+ · funext x -+ rw [Real.fourier_real_eq_integral_exp_smul] -+ apply integral_congr_ae -+ filter_upwards [] with t -+ have hphase : -2 * π * t * (-Real.log x / (2 * π)) = Real.log x * t := by -+ field_simp -+ rw [hphase, ofReal_mul, smul_eq_mul] -+ exact mul_comm _ _ -+ refine (Real.zero_at_infty_fourier f).comp <| Tendsto.mono_right ?_ _root_.atBot_le_cocompact -+ exact (tendsto_neg_atBot_iff.mpr tendsto_log_atTop).atBot_mul_const (inv_pos.mpr two_pi_pos) -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by -+ apply limiting_cor_aux.congr' -+ filter_upwards [eventually_ge_atTop 1] with x hx using -+ limiting_fourier hcheby hG hG' hf ψ hx |>.symm -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, -+ (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ -+ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 := by -+ obtain ⟨ψ, l1, l2, l3, l4, -⟩ := smooth_urysohn_support_Ioo h1 h3 -+ refine ⟨ψ, l1, l2, l3, l4⟩ -+ -+ -+ -+ -+ -+noncomputable def compactTruncation : trunc := by -+ choose ψ h1 h2 h3 h4 using smooth_urysohn (-2) (-1) (1) (2) (by linarith) (by linarith) -+ exact ⟨⟨ψ, h1.of_le (by norm_cast), h2⟩, h3, h4⟩ -+ -+theorem one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by -+ cases n with -+ | zero => simp -+ | succ n => -+ cases n with -+ | zero => simp -+ | succ n => norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith -+ -+ -+ -+noncomputable def pp (a x : ℝ) : ℝ := a ^ 2 * (x + 1) ^ 2 + (1 - a) * (1 + a) -+ -+ -+ -+noncomputable def pp' (a x : ℝ) : ℝ := a ^ 2 * (2 * (x + 1)) -+ -+theorem pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by -+ simp only [pp] -+ have : 0 < 1 - a := by linarith [ha.2] -+ have : 0 < 1 + a := by linarith [ha.1] -+ positivity -+ -+theorem pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by -+ unfold pp pp' -+ simpa using hasDerivAt_id x |>.add_const 1 |>.pow 2 |>.const_mul _ -+ -+theorem pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by -+ ext x ; exact pp_deriv a x |>.deriv -+ -+theorem pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by -+ change HasDerivAt (fun y : ℝ => a ^ 2 * (2 * (y + 1))) (a ^ 2 * 2) x -+ convert hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) -+ using 1 <;> first | rfl | ring -+ -+theorem pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by -+ ext x ; exact pp'_deriv a x |>.deriv -+ -+ -+ -+noncomputable def hh (a t : ℝ) : ℝ := (t * (1 + (a * log t) ^ 2))⁻¹ -+ -+ -+ -+noncomputable def hh' (a t : ℝ) : ℝ := - pp a (log t) * hh a t ^ 2 -+ -+theorem hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity -+ -+theorem hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by -+ by_cases h0 : t = 0 -+ · simp [hh, h0] -+ replace ht : 0 < t := lt_of_le_of_ne ht (by tauto) -+ unfold hh -+ rw [abs_inv, inv_le_inv₀ (by positivity) ht, abs_mul, abs_eq_self.mpr ht.le] -+ convert_to t * 1 ≤ _ -+ · simp -+ apply mul_le_mul le_rfl ?_ zero_le_one ht.le -+ rw [abs_eq_self.mpr (by positivity)] -+ simp only [le_add_iff_nonneg_right] -+ positivity -+ -+theorem hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by -+ have e1 : t * (1 + (a * log t) ^ 2) ≠ 0 := mul_ne_zero ht (_root_.ne_of_lt (by positivity)).symm -+ have l5 : HasDerivAt (fun t : ℝ => log t) t⁻¹ t := Real.hasDerivAt_log ht -+ have l4 : HasDerivAt (fun t : ℝ => a * log t) (a * t⁻¹) t := l5.const_mul _ -+ have l3 : HasDerivAt (fun t : ℝ => (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := by -+ convert l4.pow 2 using 1 ; ring -+ have l2 : HasDerivAt (fun t : ℝ => 1 + (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := -+ l3.const_add _ -+ have l1 : HasDerivAt (fun t : ℝ => t * (1 + (a * log t) ^ 2)) -+ (1 + 2 * a ^ 2 * log t + a ^ 2 * log t ^ 2) t := by -+ convert (hasDerivAt_id' t).mul l2 using 1; field_simp; ring -+ apply (l1.inv e1).congr_deriv -+ dsimp only [hh', pp, hh] -+ simp only [div_eq_mul_inv, inv_pow] -+ ring -+ -+theorem hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := -+ fun t (ht : 0 < t) => (hh_deriv a ht.ne.symm).continuousAt.continuousWithinAt -+ -+theorem hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by -+ have := pp_pos ha (log x) -+ simp only [hh', neg_mul, Left.neg_nonpos_iff, ge_iff_le] -+ positivity -+ -+theorem hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by -+ have l1 x (hx : x ∈ interior (Ioi 0)) : -+ HasDerivWithinAt (hh a) (hh' a x) (interior (Ioi 0)) x := by -+ have : x ≠ 0 := by contrapose! hx ; simp [hx] -+ exact (hh_deriv a this).hasDerivWithinAt -+ apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) (hh_continuous _) l1 -+ (fun x _ => hh'_nonpos ha) -+ -+ -+ -+noncomputable def gg (x i : ℝ) : ℝ := 1 / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ -+ -+theorem gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by -+ simp only [gg, hh] -+ field_simp -+ -+theorem gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by -+ simp only [gg_of_hh hx.ne.symm, one_div, mul_inv_rev, abs_mul] -+ apply mul_le_mul le_rfl (hh_le _ _ (by positivity)) (by positivity) (by positivity) |>.trans -+ (le_of_eq ?_) -+ simp [abs_inv, abs_eq_self.mpr hx.le] ; field_simp -+ -+theorem gg_le_one (i : ℕ) : gg x i ≤ 1 := by -+ by_cases hi : i = 0 <;> simp only [gg, hi, CharP.cast_eq_zero, div_zero, one_div, mul_inv_rev, -+ zero_div, Real.log_zero, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, -+ add_zero, inv_one, mul_one, zero_le_one] -+ have l1 : 1 ≤ (i : ℝ) := by simp ; omega -+ have l2 : 1 ≤ 1 + (π⁻¹ * 2⁻¹ * Real.log (↑i / x)) ^ 2 := by -+ simp only [le_add_iff_nonneg_right] ; positivity -+ rw [← mul_inv] ; apply inv_le_one_of_one_le₀ ; simpa using mul_le_mul l1 l2 zero_le_one (by simp) -+ -+theorem one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by -+ constructor -+ · trans 0 -+ · linarith -+ · positivity -+ · rw [div_lt_iff₀ (by positivity)] -+ convert_to 1 * 1 < 2 * π -+ · simp -+ · simp -+ apply mul_lt_mul one_lt_two ?_ zero_lt_one zero_le_two -+ trans 2 -+ · exact one_le_two -+ · exact two_le_pi -+ -+theorem cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ ∑ i ∈ Finset.range n, f i * g i ≤ g (n - 1) * (C * n) + (C * (↑(n - 1 - 1) + 1) * g 0 -+ - C * (↑(n - 1 - 1) + 1) * g (n - 1) - -+ ((n - 1 - 1) • (C * g 0) - ∑ x ∈ Finset.range (n - 1 - 1), C * g (x + 1))) := by -+ have l1 (n : ℕ) : -+ (g n - g (n + 1)) * ∑ i ∈ Finset.range (n + 1), f i ≤ (g n - g (n + 1)) * (C * (n + 1)) := by -+ apply mul_le_mul le_rfl (by simpa only [cumsum, Nat.cast_add, Nat.cast_one] using hf' (n + 1)) -+ (Finset.sum_nonneg (fun i _ => hf i)) ?_ -+ simp only [sub_nonneg] ; apply hg' ; simp -+ have l2 (x : ℕ) : C * (↑(x + 1) + 1) - C * (↑x + 1) = C := by simp ; ring -+ have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun i _ => hf i) -+ convert_to ∑ i ∈ Finset.range n, (g i) • (f i) ≤ _ -+ · simp [mul_comm] -+ rw [Finset.sum_range_by_parts, sub_eq_add_neg, ← Finset.sum_neg_distrib] -+ simp_rw [← neg_smul, neg_sub, smul_eq_mul] -+ apply _root_.add_le_add -+ · exact mul_le_mul le_rfl (hf' n) (l3 n) (hg _) -+ · apply Finset.sum_le_sum (fun n _ => l1 n) |>.trans -+ convert_to ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ -+ · congr ; ext i ; simp ; ring -+ rw [Finset.sum_range_by_parts] -+ simp_rw [Finset.sum_range_sub', l2, smul_sub, smul_eq_mul, Finset.sum_sub_distrib, -+ Finset.sum_const, Finset.card_range] -+ apply le_of_eq ; ring_nf -+ -+theorem sum_range_succ (a : ℕ → ℝ) (n : ℕ) : -+ ∑ i ∈ Finset.range n, a (i + 1) = (∑ i ∈ Finset.range (n + 1), a i) - a 0 := by -+ have := Finset.sum_range_sub a n -+ rw [Finset.sum_sub_distrib, sub_eq_iff_eq_add] at this -+ rw [Finset.sum_range_succ, this] ; ring -+ -+theorem cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ ∑ i ∈ Finset.range n, f i * g i ≤ -+ C * n * g (n - 1) -+ + C * cumsum g (n - 1 - 1 + 1) -+ - C * (↑(n - 1 - 1) + 1) * g (n - 1) -+ := by -+ have := cancel_aux hf hg hf' hg' n -+ simp only [nsmul_eq_mul, ← Finset.mul_sum, sum_range_succ] at this -+ convert this using 1 ; unfold cumsum ; ring -+ -+theorem cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) (hn : 2 ≤ n) : -+ cumsum (f * g) n ≤ C * cumsum g n := by -+ change (∑ i ∈ Finset.range n, f i * g i) ≤ C * cumsum g n -+ refine (cancel_aux' hf hg hf' hg' n).trans_eq ?_ -+ have hindex : n - 1 - 1 + 1 = n - 1 := by omega -+ have hcast : (n : ℝ) = ↑(n - 1) + 1 := by -+ exact_mod_cast (show n = (n - 1) + 1 by omega) -+ have hcast' : (↑(n - 1 - 1) : ℝ) + 1 = ↑(n - 1) := by -+ exact_mod_cast hindex -+ have hsum : cumsum g n = cumsum g (n - 1) + g (n - 1) := by -+ conv_lhs => rw [show n = (n - 1) + 1 by omega] -+ exact cumsum_succ (n - 1) -+ rw [hindex, hcast', hcast, hsum] -+ ring -+ -+theorem cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) -+ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : -+ cumsum (f * g) n ≤ C * cumsum g n := by -+ cases n with -+ | zero => simp [cumsum] -+ | succ n => -+ cases n with -+ | zero => -+ have hC : 0 ≤ C := by simpa [cumsum, hf0] using hf' 1 -+ simpa [cumsum, hf0] using mul_nonneg hC (hg 0) -+ | succ n => exact cancel_main hf hg hf' hg' (n + 2) (by omega) -+ -+theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneOn f (Ioc x₀ (x₀ + n))) -+ (hfi : IntegrableOn f (Icc x₀ (x₀ + n))) : -+ (∑ i ∈ Finset.range n, f (x₀ + ↑(i + 1))) ≤ ∫ x in x₀..x₀ + n, f x := by -+ cases n with simp only [Nat.cast_add, Nat.cast_one, CharP.cast_eq_zero, add_zero, -+ lt_self_iff_false, not_false_eq_true, -+ Ioc_eq_empty, Finset.range_zero, Nat.cast_add, Nat.cast_one, Finset.sum_empty, -+ intervalIntegral.integral_same, le_refl] at hf ⊢ -+ | succ n => -+ have : Finset.range (n + 1) = {0} ∪ Finset.Ico 1 (n + 1) := by -+ ext i ; by_cases hi : i = 0 <;> simp [hi] ; omega -+ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, -+ lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, and_true, not_false_eq_true, -+ Finset.sum_insert, CharP.cast_eq_zero, zero_add, ge_iff_le] -+ have l4 : IntervalIntegrable f volume x₀ (x₀ + 1) := by -+ apply IntegrableOn.intervalIntegrable -+ simp only [le_add_iff_nonneg_right, zero_le_one, uIcc_of_le] -+ apply hfi.mono_set -+ apply Icc_subset_Icc le_rfl -+ simp -+ have l5 x (hx : x ∈ Ioc x₀ (x₀ + 1)) : (fun x ↦ f (x₀ + 1)) x ≤ f x := by -+ rcases hx with ⟨hx1, hx2⟩ -+ refine hf ⟨hx1, by linarith⟩ ⟨by linarith, by linarith⟩ hx2 -+ have l6 : ∫ x in x₀..x₀ + 1, f (x₀ + 1) = f (x₀ + 1) := by simp -+ have l1 : f (x₀ + 1) ≤ ∫ x in x₀..x₀ + 1, f x := by -+ rw [← l6] -+ apply intervalIntegral.integral_mono_on_of_le_Ioo (by linarith) (by simp) l4 -+ intro x hx -+ exact l5 x ⟨hx.1, hx.2.le⟩ -+ have l2 : AntitoneOn (fun x ↦ f (x₀ + x)) (Icc 1 ↑(n + 1)) := by -+ intro u hu v hv huv -+ have hu1 := hu.1 -+ have hv2 := hv.2 -+ push_cast at hv2 -+ refine hf ⟨?_, ?_⟩ ⟨?_, ?_⟩ ?_ <;> linarith -+ have l3 := @AntitoneOn.sum_le_integral_Ico 1 (n + 1) (fun x => f (x₀ + x)) (by simp) -+ (by simpa using l2) -+ simp only [Nat.cast_add, Nat.cast_one, intervalIntegral.integral_comp_add_left] at l3 -+ convert _root_.add_le_add l1 l3 -+ have := @intervalIntegral.integral_comp_mul_add ℝ _ _ 1 (n + 1) 1 f one_ne_zero x₀ -+ rw [intervalIntegral.integral_add_adjacent_intervals] -+ · exact l4 -+ · apply IntegrableOn.intervalIntegrable -+ simp only [add_le_add_iff_left, le_add_iff_nonneg_left, Nat.cast_nonneg, uIcc_of_le] -+ apply hfi.mono_set -+ apply Icc_subset_Icc -+ · linarith -+ · simp -+ -+theorem hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ (IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0)) ∧ -+ (∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π) := by -+ rw [integrableOn_Ici_iff_integrableOn_Ioi] -+ simp only [hh] -+ let g (x : ℝ) := (a * c / b) * Real.arctan (b * log (x / c)) -+ let g₀ (x : ℝ) := if x = 0 then ((a * c / b) * (- (π / 2))) else g x -+ let g' (x : ℝ) := a * (x / c * (1 + (b * Real.log (x / c)) ^ 2))⁻¹ -+ have l3 (x) (hx : 0 < x) : HasDerivAt Real.log x⁻¹ x := by apply Real.hasDerivAt_log (by linarith) -+ have l4 (x) : HasDerivAt (fun t => t / c) (1 / c) x := (hasDerivAt_id x).div_const c -+ have l2 (x) (hx : 0 < x) : HasDerivAt (fun t => log (t / c)) x⁻¹ x := by -+ have hcomp := (l3 (x / c) (by positivity)).comp x (l4 x) -+ convert hcomp using 1 -+ · rfl -+ · field_simp [hc.ne', hx.ne'] -+ have l5 (x) (hx : 0 < x) := (l2 x hx).const_mul b -+ have l1 (x) (hx : 0 < x) := (l5 x hx).arctan -+ have l6 (x) (hx : 0 < x) : HasDerivAt g (g' x) x := by -+ convert (l1 x hx).const_mul (a * c / b) using 1 -+ simp only [g'] -+ field_simp -+ have key (x) (hx : 0 < x) : HasDerivAt g₀ (g' x) x := by -+ apply (l6 x hx).congr_of_eventuallyEq -+ apply eventually_of_mem <| Ioi_mem_nhds hx -+ intro y (hy : 0 < y) -+ simp [g₀, hy.ne.symm] -+ have k1 : Tendsto g₀ atTop (𝓝 ((a * c / b) * (π / 2))) := by -+ have : g =ᶠ[atTop] g₀ := by -+ apply eventually_of_mem (Ioi_mem_atTop 0) -+ intro y (hy : 0 < y) -+ simp [g₀, hy.ne.symm] -+ apply Tendsto.congr' this -+ apply Tendsto.const_mul -+ apply (tendsto_arctan_atTop.mono_right nhdsWithin_le_nhds).comp -+ apply Tendsto.const_mul_atTop hb -+ apply tendsto_log_atTop.comp -+ apply Tendsto.atTop_div_const hc -+ apply tendsto_id -+ have k2 : Tendsto g₀ (𝓝[>] 0) (𝓝 (g₀ 0)) := by -+ have : g =ᶠ[𝓝[>] 0] g₀ := by -+ apply eventually_of_mem self_mem_nhdsWithin -+ intro x (hx : 0 < x) ; simp [g₀, hx.ne.symm] -+ simp only [g₀] -+ apply Tendsto.congr' this -+ apply Tendsto.const_mul -+ apply (tendsto_arctan_atBot.mono_right nhdsWithin_le_nhds).comp -+ apply Tendsto.const_mul_atBot hb -+ apply tendsto_log_nhdsGT_zero.comp -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨c * ε, by positivity, fun x hx1 hx2 => ⟨?_, ?_⟩⟩ -+ · simp only [mem_Ioi] at hx1 ⊢ ; positivity -+ · simp only [dist_zero_right, norm_eq_abs, norm_div, abs_eq_self.mpr hc.le] at hx2 ⊢ -+ rwa [div_lt_iff₀ hc, mul_comm] -+ have k3 : ContinuousWithinAt g₀ (Ici 0) 0 := by -+ rw [Metric.continuousWithinAt_iff] -+ rw [Metric.tendsto_nhdsWithin_nhds] at k2 -+ intro ε hε -+ obtain ⟨δ, hδ, hδx⟩ := k2 ε hε -+ refine ⟨δ, hδ, ?_⟩ -+ intro x hx hdist -+ change 0 ≤ x at hx -+ rcases lt_or_eq_of_le hx with hx | hx -+ · exact hδx hx hdist -+ · subst x -+ simpa only [dist_self] using hε -+ have k4 : ∀ x ∈ Ioi 0, 0 ≤ g' x := by -+ intro x (hx : 0 < x) ; simp only [mul_inv_rev, inv_div, g'] ; positivity -+ constructor -+ · convert_to IntegrableOn g' _ -+ exact integrableOn_Ioi_deriv_of_nonneg k3 key k4 k1 -+ · have := integral_Ioi_of_hasDerivAt_of_nonneg k3 key k4 k1 -+ simp only [mul_inv_rev, inv_div, mul_neg, ↓reduceIte, sub_neg_eq_add, g', g₀] at this ⊢ -+ convert this using 1 ; field_simp ; ring -+ -+theorem hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0) := -+ hh_integrable_aux ha hb hc |>.1 -+ -+theorem hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : -+ ∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π := -+ hh_integrable_aux ha hb hc |>.2 -+ -+theorem hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by -+ have := hh_integral (a := 1) (b := 1 / (2 * π)) (c := 1) -+ (by positivity) (by positivity) (by positivity) -+ convert this using 1 <;> simp ; ring -+ -+theorem bound_sum_log {C : ℝ} (hf0 : f 0 = 0) -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ -+ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by -+ let ggg (i : ℕ) : ℝ := if i = 0 then 1 else gg x i -+ have l0 : x ≠ 0 := by linarith -+ have l1 i : 0 ≤ ggg i := by by_cases hi : i = 0 <;> simp only [gg, one_div, mul_inv_rev, hi, -+ ↓reduceIte, zero_le_one, ggg] ; positivity -+ have l2 : Antitone ggg := by -+ intro i j hij ; by_cases hi : i = 0 <;> by_cases hj : j = 0 <;> simp only [hj, ↓reduceIte, hi, -+ le_refl, ggg] -+ · exact gg_le_one _ -+ · omega -+ · simp only [gg_of_hh l0] -+ gcongr -+ apply hh_antitone one_div_two_pi_mem_Ioo -+ · simp only [mem_Ioi] ; positivity -+ · simp only [mem_Ioi] ; positivity -+ · gcongr -+ have l3 : 0 ≤ C := by simpa [cumsum, hf0] using hf 1 -+ have l4 : 0 ≤ ∫ (t : ℝ) in Ioi 0, hh (π⁻¹ * 2⁻¹) t := -+ setIntegral_nonneg measurableSet_Ioi (fun x hx => hh_nonneg _ (LT.lt.le hx)) -+ have l5 {n : ℕ} : AntitoneOn (fun t ↦ x⁻¹ * hh (1 / (2 * π)) (t / x)) (Ioc 0 n) := by -+ intro u hu v hv huv -+ have hu1 := hu.1 -+ have hv1 := hv.1 -+ simp only -+ apply mul_le_mul le_rfl ?_ (hh_nonneg _ (by positivity)) (by positivity) -+ apply hh_antitone one_div_two_pi_mem_Ioo (by simp only [mem_Ioi] ; positivity) -+ (by simp only [mem_Ioi] ; positivity) -+ apply (div_le_div_iff_of_pos_right (by positivity)).mpr huv -+ have l6 {n : ℕ} : IntegrableOn (fun t ↦ x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (Icc 0 n) volume := by -+ apply IntegrableOn.mono_set -+ (hh_integrable (by positivity) (by positivity) (by positivity)) Icc_subset_Ici_self -+ apply Real.tsum_le_of_sum_range_le (fun n => by positivity) ; intro n -+ convert_to ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ -+ · congr ; ext i -+ by_cases hi : i = 0 -+ · simp [hi, hf0] -+ · simp only [gg, hi, ↓reduceIte, ggg] -+ field_simp -+ apply cancel_main' (fun _ => norm_nonneg _) (by simp [hf0]) l1 hf l2 n |>.trans -+ gcongr ; simp only [cumsum, gg_of_hh l0, one_div, mul_inv_rev, ggg] -+ by_cases hn : n = 0 -+ · simp only [hn, Finset.range_zero, Finset.sum_empty] ; positivity -+ replace hn : 0 < n := by omega -+ have : Finset.range n = {0} ∪ Finset.Ico 1 n := by -+ ext i ; simp ; by_cases hi : i = 0 <;> simp [hi, hn] ; omega -+ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, -+ false_and, not_false_eq_true, Finset.sum_insert, ↓reduceIte, add_le_add_iff_left, ge_iff_le] -+ convert_to ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ -+ · apply Finset.sum_congr rfl (fun i hi => ?_) -+ simp at hi -+ have : i ≠ 0 := by omega -+ simp [this] -+ simp_rw [Finset.sum_Ico_eq_sum_range, add_comm 1] -+ have := @sum_le_integral 0 (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (n - 1) -+ (by simpa using l5) (by simpa using l6) -+ simp only [zero_add] at this -+ apply this.trans -+ rw [@intervalIntegral.integral_comp_div ℝ _ _ 0 ↑(n - 1) x (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t)) l0] -+ simp only [zero_div, intervalIntegral.integral_const_mul, smul_eq_mul, ← mul_assoc, -+ mul_inv_cancel₀ l0, one_mul] -+ have : (0 : ℝ) ≤ ↑(n - 1) / x := by positivity -+ rw [intervalIntegral.intervalIntegral_eq_integral_uIoc] -+ simp only [this, ↓reduceIte, uIoc_of_le, smul_eq_mul, one_mul, ge_iff_le] -+ apply integral_mono_measure -+ · apply Measure.restrict_mono Ioc_subset_Ioi_self le_rfl -+ · apply eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) -+ intro x (hx : 0 < x) -+ apply hh_nonneg _ hx.le -+ · have h := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) -+ have h' := h.mono_set Ioi_subset_Ici_self -+ unfold IntegrableOn at h' -+ apply h'.congr -+ exact Eventually.of_forall (fun t => by simp) -+ -+theorem bound_sum_log0 {C : ℝ} -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ -+ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by -+ let f0 i := if i = 0 then 0 else f i -+ have l1 : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f0 k : ℂ)‖) n ≤ C * n) := by -+ intro n ; refine Finset.sum_le_sum (fun i _ => ?_) |>.trans (hf n) -+ by_cases hi : i = 0 <;> simp [hi, f0] -+ have l2 i : ‖f i‖ / i = ‖f0 i‖ / i := by by_cases hi : i = 0 <;> simp [hi, f0] -+ simp_rw [l2] ; apply bound_sum_log rfl l1 hx -+ -+theorem bound_sum_log' {C : ℝ} -+ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ {x : ℝ} (hx : 1 ≤ x) : -+ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + 2 * π ^ 2) := by -+ simpa only [hh_integral'] using bound_sum_log0 hf hx -+ -+variable (f x) in -+theorem summable_fourier_aux (ψ : W21) (i : ℕ) : -+ ‖f i / i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (i / x))‖ ≤ -+ W21.norm ψ * (‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹) := by -+ convert mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) -+ (norm_nonneg (f i / i)) using 1 -+ · simp -+ · change _ = _ * (W21.norm ψ * _) -+ simp only [W21.norm, mul_inv_rev, one_div, Complex.norm_div, RCLike.norm_natCast] -+ ring -+ -+theorem summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by -+ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by -+ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) -+ have l6 := summable_fourier_aux x f ψ -+ exact Summable.of_nonneg_of_le (fun _ => norm_nonneg _) l6 -+ (by simpa using l5.const_smul (W21.norm ψ)) -+ -+theorem bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ -+ W21.norm ψ • ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ := by -+ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by -+ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) -+ have l6 := summable_fourier_aux x f ψ -+ have l1 : Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by -+ exact summable_fourier x hx ψ hcheby -+ apply (norm_tsum_le_tsum_norm l1).trans -+ change (∑' i, ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) -+ (1 / (2 * π) * Real.log (↑i / x))‖) ≤ W21.norm ψ * _ -+ rw [← tsum_mul_left] -+ exact Summable.tsum_mono l1 (l5.mul_left (W21.norm ψ)) l6 -+ -+theorem bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ -+ W21.norm ψ * C * (1 + 2 * π ^ 2) := by -+ apply bound_I1 x (by linarith) ψ ⟨_, hcheby⟩ |>.trans -+ rw [smul_eq_mul, mul_assoc] -+ apply mul_le_mul le_rfl (bound_sum_log' hcheby hx) ?_ W21.norm_nonneg -+ apply tsum_nonneg (fun i => by positivity) -+ -+theorem bound_I2 (x : ℝ) (ψ : W21) : -+ ‖∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ W21.norm ψ * (2 * π ^ 2) := by -+ have key a : ‖𝓕 (ψ : ℝ → ℂ) (a / (2 * π))‖ ≤ W21.norm ψ * (1 + (a / (2 * π)) ^ 2)⁻¹ := -+ decay_bounds_key ψ _ -+ have twopi : 0 ≤ 2 * π := by simp [pi_nonneg] -+ have l3 : Integrable (fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹) := -+ integrable_inv_one_add_sq.comp_div (by norm_num [pi_ne_zero]) -+ have l2 : IntegrableOn (fun i ↦ W21.norm ψ * (1 + (i / (2 * π)) ^ 2)⁻¹) (Ici (-Real.log x)) := by -+ exact (l3.const_mul _).integrableOn -+ have l1 : IntegrableOn (fun i ↦ ‖𝓕 (ψ : ℝ → ℂ) (i / (2 * π))‖) (Ici (-Real.log x)) := by -+ refine ((l3.const_mul (W21.norm ψ)).mono' ?_ ?_).integrableOn -+ · apply Continuous.aestronglyMeasurable ; fun_prop -+ · simp only [norm_norm, key] ; simp -+ have l5 : 0 ≤ᵐ[volume] fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹ := by -+ apply Eventually.of_forall ; intro x ; positivity -+ refine (norm_integral_le_integral_norm _).trans <| (setIntegral_mono l1 l2 key).trans ?_ -+ rw [integral_const_mul] ; gcongr -+ · apply W21.norm_nonneg -+ refine (setIntegral_le_integral l3 l5).trans ?_ -+ rw [Measure.integral_comp_div (fun x => (1 + x ^ 2)⁻¹) (2 * π)] -+ simp [abs_eq_self.mpr twopi] ; ring_nf ; rfl -+ -+theorem bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ -+ W21.norm ψ * (C * (1 + 2 * π ^ 2) + ‖A‖ * (2 * π ^ 2)) := by -+ have l1 := bound_I1' x hx ψ hcheby -+ have l2 := mul_le_mul (le_refl ‖A‖) (bound_I2 x ψ) (by positivity) (by positivity) -+ apply norm_sub_le _ _ |>.trans ; rw [norm_mul] -+ convert _root_.add_le_add l1 l2 using 1 ; ring -+ -+ -+theorem limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by -+ -+ let S1 x (ψ : ℝ → ℂ) := ∑' (n : ℕ), f n / ↑n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑n / x)) -+ let S2 x (ψ : ℝ → ℂ) := ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) -+ let S x ψ := S1 x ψ - S2 x ψ ; change Tendsto (fun x ↦ S x ψ) atTop (𝓝 0) -+ -+ obtain g := compactTruncation -+ let Ψ R := g.scale R * ψ -+ have key R : Tendsto (fun x ↦ S x (Ψ R)) atTop (𝓝 0) := limiting_cor (Ψ R) hf hcheby hG hG' -+ -+ obtain ⟨C, hcheby⟩ := hcheby -+ have hC : 0 ≤ C := by -+ have : ‖f 0‖ ≤ C := by simpa [cumsum] using hcheby 1 -+ have : 0 ≤ ‖f 0‖ := by positivity -+ linarith -+ have key2 : Tendsto (fun R ↦ W21.norm (ψ - Ψ R)) atTop (𝓝 0) := W21_approximation ψ g -+ simp_rw [Metric.tendsto_nhds] at key key2 ⊢ ; intro ε hε -+ let M := C * (1 + 2 * π ^ 2) + ‖(A : ℂ)‖ * (2 * π ^ 2) -+ obtain ⟨R, hRψ⟩ := (key2 ((ε / 2) / (1 + M)) (by positivity)).exists -+ simp only [dist_zero_right, Real.norm_eq_abs, abs_eq_self.mpr W21.norm_nonneg] at hRψ key -+ -+ filter_upwards [eventually_ge_atTop 1, key R (ε / 2) (by positivity)] with x hx key -+ -+ have key3 : ‖S x (ψ - Ψ R)‖ < ε / 2 := by -+ have hbound := @bound_main f C A x hx (ψ - Ψ R) hcheby -+ change ‖S x (⇑ψ - ⇑(Ψ R))‖ ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * M at hbound -+ apply hbound.trans_lt -+ calc -+ W21.norm (⇑ψ - ⇑(Ψ R)) * M ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * (1 + M) := -+ mul_le_mul_of_nonneg_left (by linarith) W21.norm_nonneg -+ _ < ε / 2 := (lt_div_iff₀ (show 0 < 1 + M by positivity)).mp hRψ -+ -+ have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := -+ F_sub ψ.hf (Ψ R : W21).hf x -+ have S1_sub : S1 x (ψ - Ψ R) = S1 x ψ - S1 x (Ψ R) := by -+ simp only [one_div, mul_inv_rev, S1_sub_1, mul_sub, S1] ; apply Summable.tsum_sub -+ · have := summable_fourier x (by positivity) ψ ⟨_, hcheby⟩ -+ rw [summable_norm_iff] at this -+ simpa using this -+ · have hsum := summable_fourier x (by positivity) (Ψ R : W21) ⟨_, hcheby⟩ -+ rw [summable_norm_iff] at hsum -+ simpa only [W21.ofCS2, one_div, mul_inv_rev] using hsum -+ have S2_sub : S2 x (ψ - Ψ R) = S2 x ψ - S2 x (Ψ R) := by -+ simp only [S1_sub_1, S2] ; rw [integral_sub] -+ · ring -+ · exact ψ.integrable_fourier (by positivity) |>.restrict -+ · exact (Ψ R : W21).integrable_fourier (by positivity) |>.restrict -+ have S_sub : S x (ψ - Ψ R) = S x ψ - S x (Ψ R) := by simp [S, S1_sub, S2_sub] ; ring -+ simpa [S_sub, Ψ] using norm_add_le _ _ |>.trans_lt (_root_.add_lt_add key3 key) -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - -+ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := -+ limiting_cor_W21 ψ hf hcheby hG hG' -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by -+ refine ⟨𝓕⁻ f, ?_⟩ -+ exact FourierTransform.fourier_fourierInv_eq f -+ -+ -+ -+ -+ -+ -+noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) -+ (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) := -+ h2.toSchwartzMap h1 -+ -+@[simp] theorem toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl -+ -+theorem comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ ∀ᶠ x in 𝓝 0, Ψ x = 0 := -+ notMem_tsupport_iff_eventuallyEq.mp (fun h => lt_irrefl 0 <| mem_Ioi.mp (hplus h)) -+ -+theorem comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ ∀ᶠ x in atBot, Ψ (exp x) = 0 := -+ Real.tendsto_exp_atBot <| comp_exp_support0 hplus -+ -+theorem comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : -+ ∀ᶠ (x : ℝ) in atTop, (Ψ ∘ rexp) x = 0 := by -+ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, -+ cocompact_eq_atBot_atTop] at hsupp -+ exact Real.tendsto_exp_atTop hsupp.2 -+ -+theorem comp_exp_support {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : HasCompactSupport (Ψ ∘ rexp) := by -+ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, -+ cocompact_eq_atBot_atTop] -+ exact ⟨comp_exp_support1 hplus, comp_exp_support2 hsupp⟩ -+ -+theorem wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) (x : ℝ) (hx : 0 < x) : -+ ∫ (u : ℝ) in Ioi (-Real.log x), ↑(rexp u) * Ψ (rexp u) = ∫ (y : ℝ) in Ioi (1 / x), Ψ y := by -+ have l1 : ContinuousOn rexp (Ici (-Real.log x)) := by fun_prop -+ have l2 : Tendsto rexp atTop atTop := Real.tendsto_exp_atTop -+ have l3 t (_ : t ∈ Ioi (-log x)) : HasDerivWithinAt rexp (rexp t) (Ioi t) t := -+ (Real.hasDerivAt_exp t).hasDerivWithinAt -+ have l4 : ContinuousOn Ψ (rexp '' Ioi (-Real.log x)) := by fun_prop -+ have l5 : IntegrableOn Ψ (rexp '' Ici (-Real.log x)) volume := -+ (l0.integrable_of_hasCompactSupport hsupp).integrableOn -+ have l6 : IntegrableOn (fun x ↦ rexp x • (Ψ ∘ rexp) x) (Ici (-Real.log x)) volume := by -+ refine (Continuous.integrable_of_hasCompactSupport (by fun_prop) ?_).integrableOn -+ change HasCompactSupport (rexp • (Ψ ∘ rexp)) -+ exact (comp_exp_support hsupp hplus).smul_left -+ have := MeasureTheory.integral_deriv_smul_comp_Ioi l1 l2 l3 l4 l5 l6 -+ simpa [Real.exp_neg, Real.exp_log hx] using this -+ -+theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : -+ Tendsto (fun x ↦ (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ obtain ⟨ε, hε, hh⟩ := Metric.eventually_nhds_iff.mp <| comp_exp_support0 hplus -+ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eventually_gt_atTop ε⁻¹] with x hxε -+ have l1 : Integrable (indicator (Ioi x⁻¹) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi -+ have l2 : Integrable (indicator (Ioi 0) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi -+ simp_rw [← MeasureTheory.integral_indicator measurableSet_Ioi, ← mul_sub, ← integral_sub l1 l2] -+ simp only [mul_eq_zero, ofReal_eq_zero] -+ right -+ apply MeasureTheory.integral_eq_zero_of_ae -+ apply Eventually.of_forall -+ intro t -+ simp only [Pi.zero_apply] -+ have hε' : 0 < ε⁻¹ := by positivity -+ have hx : 0 < x := by linarith -+ have hx' : 0 < x⁻¹ := by positivity -+ have hεx : x⁻¹ < ε := (inv_lt_comm₀ hε hx).mp hxε -+ have l3 : Ioi 0 = Ioc 0 x⁻¹ ∪ Ioi x⁻¹ := by -+ ext t ; simp only [mem_Ioi, mem_union, mem_Ioc] ; constructor <;> intro h -+ · simp [h, le_or_gt] -+ · cases h with -+ | inl h => exact h.1 -+ | inr h => exact hx'.trans h -+ have l4 : Disjoint (Ioc 0 x⁻¹) (Ioi x⁻¹) := by simp -+ have l5 := Set.indicator_union_of_disjoint l4 Ψ -+ rw [l3, l5] -+ simp only -+ rw [add_comm, sub_add_cancel_left] -+ by_cases ht : t ∈ Ioc 0 x⁻¹ -+ · simp only [ht, indicator_of_mem, neg_eq_zero] -+ apply hh ; simp only [mem_Ioc, dist_zero_right, norm_eq_abs] at ht ⊢ -+ apply hεx.trans_le' -+ rw [abs_le] ; constructor <;> linarith -+ simp [ht] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x - A * ∫ y in Set.Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ let h (x : ℝ) : ℂ := rexp (2 * π * x) * Ψ (exp (2 * π * x)) -+ have h1 : ContDiff ℝ ∞ h := by -+ have : ContDiff ℝ ∞ (fun x : ℝ => (rexp (2 * π * x))) := (contDiff_const.mul contDiff_id).exp -+ exact (contDiff_ofReal.comp this).mul (hsmooth.comp this) -+ have h2 : HasCompactSupport h := by -+ have hπ : 2 * π ≠ 0 := by simp [pi_ne_zero] -+ have hh : HasCompactSupport (fun x : ℝ => Ψ (rexp (2 * π * x))) := by -+ simpa only [Function.comp_def, smul_eq_mul] using -+ (comp_exp_support hsupp hplus).comp_smul hπ -+ change HasCompactSupport -+ ((fun x : ℝ => (rexp (2 * π * x) : ℂ)) * fun x : ℝ => Ψ (rexp (2 * π * x))) -+ exact hh.mul_left -+ obtain ⟨g, hg⟩ := fourier_surjection_on_schwartz (toSchwartz h h1 h2) -+ have l1 {y} (hy : 0 < y) : y * Ψ y = 𝓕 g (1 / (2 * π) * Real.log y) := by -+ rw [hg] -+ change (y : ℂ) * Ψ y = h (1 / (2 * π) * Real.log y) -+ have harg : 2 * π * (1 / (2 * π) * Real.log y) = Real.log y := by -+ rw [← mul_assoc, mul_one_div_cancel (mul_ne_zero (by norm_num) pi_ne_zero), one_mul] -+ dsimp only [h] -+ rw [harg, Real.exp_log hy] -+ have key := limiting_cor_schwartz g hf hcheby hG hG' -+ have l2 : ∀ᶠ x in atTop, ∑' (n : ℕ), f n / ↑n * 𝓕 g (1 / (2 * π) * Real.log (↑n / x)) = -+ ∑' (n : ℕ), f n * Ψ (↑n / x) / x := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ congr ; ext n -+ by_cases hn : n = 0 -+ · simp [hn, (comp_exp_support0 hplus).self_of_nhds] -+ rw [← l1 (by positivity)] -+ have : (n : ℂ) ≠ 0 := by simpa using hn -+ have : (x : ℂ) ≠ 0 := by simpa using hx.ne.symm -+ simp only [ofReal_div, ofReal_natCast] -+ field_simp -+ have l3 : ∀ᶠ x in atTop, ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 g (u / (2 * π)) = -+ ↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ congr 1 -+ rw [hg] -+ change (∫ u in Ici (-Real.log x), h (u / (2 * π))) = ∫ y in Ioi x⁻¹, Ψ y -+ dsimp only [h] -+ have hscale : (2 : ℝ) * π ≠ 0 := mul_ne_zero (by norm_num) pi_ne_zero -+ have harg (u : ℝ) : 2 * π * (u / (2 * π)) = u := mul_div_cancel₀ u hscale -+ simp_rw [harg] -+ rw [MeasureTheory.integral_Ici_eq_integral_Ioi] -+ simpa only [one_div] using wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx -+ have l4 : Tendsto (fun x => (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) -+ atTop (𝓝 0) := by -+ exact wiener_ikehara_smooth_sub (hsmooth.continuous.integrable_of_hasCompactSupport hsupp) hplus -+ simpa [tsum_div_const] using (key.congr' <| EventuallyEq.sub l2 l3) |>.add l4 -+ -+ -+ -+theorem wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := -+ tendsto_sub_nhds_zero_iff.mp <| wiener_ikehara_smooth hf hcheby hG hG' hsmooth hsupp hplus -+ -+ -+local instance coeRealFunctionComplex {E : Type*} : Coe (E → ℝ) (E → ℂ) := -+ ⟨fun f n => f n⟩ -+ -+@[norm_cast] -+theorem set_integral_ofReal {f : ℝ → ℝ} {s : Set ℝ} : ∫ x in s, (f x : ℂ) = ∫ x in s, f x := -+ integral_ofReal -+ -+theorem wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) -+ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := by -+ let Ψ' := ofReal ∘ Ψ -+ have l1 : ContDiff ℝ ∞ Ψ' := contDiff_ofReal.comp hsmooth -+ have l2 : HasCompactSupport Ψ' := hsupp.comp_left rfl -+ have l3 : closure (Function.support Ψ') ⊆ Ioi 0 := by rwa [Function.support_comp_eq] ; simp -+ have key := (continuous_re.tendsto _).comp -+ (@wiener_ikehara_smooth' A Ψ G f hf hcheby hG hG' l1 l2 l3) -+ simp at key ; norm_cast at key -+ -+theorem interval_approx_inf (ha : 0 < a) (hab : a < b) : -+ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ -+ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ -+ ψ ≤ indicator (Ico a b) 1 ∧ b - a - ε ≤ ∫ y in Ioi 0, ψ y := by -+ have l1 : Iio ((b - a) / 3) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds <| by -+ rw [← sub_pos] at hab -+ positivity -+ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < (b - a) / 3) -+ have l2 : a < a + ε / 2 := by simp [hε] -+ have l3 : b - ε / 2 < b := by simp [hε] -+ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 -+ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ -+ · simp [h5, hab.ne, Icc_subset_Ioi_iff hab.le, ha] -+ · exact h4.trans <| indicator_le_indicator_of_subset Ioo_subset_Ico_self (by simp) -+ · have l4 : 0 ≤ b - a - ε := by linarith -+ have l5 : Icc (a + ε / 2) (b - ε / 2) ⊆ Ioi 0 := by -+ intro t ht -+ simp only [mem_Icc, mem_Ioi] at ht ⊢ -+ exact ha.trans <| l2.trans_le <| ht.1 -+ have l6 : Icc (a + ε / 2) (b - ε / 2) ∩ Ioi 0 = Icc (a + ε / 2) (b - ε / 2) := -+ inter_eq_left.mpr l5 -+ have l7 : ∫ y in Ioi 0, indicator (Icc (a + ε / 2) (b - ε / 2)) 1 y = b - a - ε := by -+ simp only [measurableSet_Icc, integral_indicator_one, measureReal_restrict_apply, l6, -+ volume_real_Icc] -+ convert max_eq_left l4 using 1 ; ring_nf -+ have l8 : IntegrableOn ψ (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ rw [← l7] ; apply setIntegral_mono ?_ l8 h3 -+ rw [IntegrableOn, integrable_indicator_iff measurableSet_Icc] -+ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self -+ apply integrableOn_const <;> -+ simp -+ -+theorem interval_approx_sup (ha : 0 < a) (hab : a < b) : -+ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ -+ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ -+ indicator (Ico a b) 1 ≤ ψ ∧ ∫ y in Ioi 0, ψ y ≤ b - a + ε := by -+ have l1 : Iio (a / 2) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds (by linarith) -+ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < a / 2) -+ have l2 : a - ε / 2 < a := by linarith -+ have l3 : b < b + ε / 2 := by linarith -+ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 -+ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ -+ · have l4 : a - ε / 2 < b + ε / 2 := by linarith -+ have l5 : ε / 2 < a := by linarith -+ simp [h5, l4.ne, Icc_subset_Ioi_iff l4.le, l5] -+ · apply le_trans ?_ h3 -+ apply indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp) -+ · have l4 : 0 ≤ b - a + ε := by linarith -+ have l5 : Ioo (a - ε / 2) (b + ε / 2) ⊆ Ioi 0 := by intro t ht ; simp at ht ⊢ ; linarith -+ have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := -+ inter_eq_left.mpr l5 -+ have l7 : ∫ y in Ioi 0, indicator (Ioo (a - ε / 2) (b + ε / 2)) 1 y = b - a + ε := by -+ simp only [measurableSet_Ioo, integral_indicator_one, measureReal_restrict_apply, l6, -+ volume_real_Ioo] -+ convert max_eq_left l4 using 1 ; ring_nf -+ have l8 : IntegrableOn ψ (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ rw [← l7] -+ refine setIntegral_mono l8 ?_ h4 -+ rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo] -+ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self -+ apply integrableOn_const <;> -+ simp -+ -+theorem WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : -+ Summable (fun n => f n * g (n / x)) := by -+ obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure -+ apply summable_of_hasFiniteSupport -+ unfold Function.HasFiniteSupport -+ simp only [Function.support_mul] ; apply Finite.inter_of_right ; rw [finite_iff_bddAbove] -+ exact ⟨Nat.ceil (M * x), fun i hi => by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ -+ -+theorem WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) -+ (hg₁ : HasCompactSupport g₁) (hg₂ : HasCompactSupport g₂) : -+ (∑' n, f n * g₁ (n / x)) / x ≤ (∑' n, f n * g₂ (n / x)) / x := by -+ apply div_le_div_of_nonneg_right ?_ hx.le -+ exact Summable.tsum_le_tsum (fun n => mul_le_mul_of_nonneg_left (hg _) (hf _)) -+ (WI_summable hg₁ hx) (WI_summable hg₂ hx) -+ -+theorem WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hb : 0 < b) (hxb : 2 / b < x) : -+ (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by -+ have hb' : 0 < 2 / b := by positivity -+ have hx : 0 < x := by linarith -+ have hxb' : 2 < x * b := (div_lt_iff₀ hb).mp hxb -+ have l1 (i : ℕ) (hi : i ∉ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) = 0 := by -+ simp_all [le_div_iff₀ hx] -+ have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : -+ f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by -+ rw [abs_eq_self.mpr (hpos _)] -+ convert_to _ ≤ f i * 1 -+ · ring -+ apply mul_le_mul_of_nonneg_left ?_ (hpos _) -+ by_cases hi : (i / x) ∈ (Ico a b) <;> simp [hi] -+ rw [tsum_eq_sum l1, div_le_iff₀ hx, mul_assoc, mul_assoc] -+ apply Finset.sum_le_sum l2 |>.trans -+ have := hcheby ⌈b * x⌉₊ ; simp only [norm_real, norm_eq_abs] at this ; apply this.trans -+ have : 0 ≤ C := by have := hcheby 1 ; simp only [cumsum, Finset.range_one, norm_real, -+ Finset.sum_singleton, Nat.cast_one, mul_one] at this ; exact (abs_nonneg _).trans this -+ refine mul_le_mul_of_nonneg_left ?_ this -+ apply (Nat.ceil_lt_add_one (by positivity)).le.trans -+ linarith -+ -+theorem WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} -+ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hb : 0 < b) : -+ ∀ᶠ x : ℝ in atTop, (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by -+ filter_upwards [eventually_gt_atTop (2 / b)] with x hx using WI_sum_Iab_le hpos hcheby hb hx -+ -+theorem le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by -+ exact ge_of_tendsto -+ (show Tendsto (fun c : ℝ => c) (𝓝[>] b) (𝓝 b) from nhdsWithin_le_nhds) h -+ -+theorem ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by -+ exact le_of_tendsto -+ (show Tendsto (fun c : ℝ => c) (𝓝[<] b) (𝓝 b) from nhdsWithin_le_nhds) h -+ -+theorem WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : -+ Tendsto (fun c => c / A - (b - a)) (𝓝[>] (A * (b - a))) (𝓝[>] 0) := by -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨A * ε, by positivity, ?_⟩ -+ intro x hx1 hx2 -+ constructor -+ · simpa [lt_div_iff₀' hA] -+ · simp only [Real.dist_eq, dist_zero_right, Real.norm_eq_abs] at hx2 ⊢ -+ have : |x / A - (b - a)| = |x - A * (b - a)| / A := by -+ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp -+ rwa [this, div_lt_iff₀' hA] -+ -+theorem WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : -+ Tendsto (fun c => (b - a) - c / A) (𝓝[<] (A * (b - a))) (𝓝[>] 0) := by -+ rw [Metric.tendsto_nhdsWithin_nhdsWithin] -+ intro ε hε -+ refine ⟨A * ε, by positivity, ?_⟩ -+ intro x hx1 hx2 -+ constructor -+ · simpa [div_lt_iff₀' hA] -+ · simp only [Real.dist_eq, dist_zero_right, norm_eq_abs] at hx2 ⊢ -+ have : |(b - a) - x / A| = |A * (b - a) - x| / A := by -+ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp -+ rwa [this, div_lt_iff₀' hA, ← neg_sub, abs_neg] -+ -+theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : -+ 0 ≤ A := by -+ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x -+ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by -+ filter_upwards [eventually_ge_atTop 0] with x hx -+ exact div_nonneg (tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _))) hx -+ obtain ⟨ε, ψ, h1, h2, h3, h4, -⟩ := (interval_approx_sup zero_lt_one one_lt_two).exists -+ have key := @wiener_ikehara_smooth_real A G f ψ hf hcheby hG hG' h1 h2 h3 -+ have l2 : 0 ≤ ψ := by apply le_trans _ h4 ; apply indicator_nonneg ; simp -+ have l1 : ∀ᶠ x in atTop, 0 ≤ S ψ x := hSnonneg l2 -+ have l3 : 0 ≤ A * ∫ (y : ℝ) in Ioi 0, ψ y := ge_of_tendsto key l1 -+ have l4 : 0 < ∫ (y : ℝ) in Ioi 0, ψ y := by -+ have r1 : 0 ≤ᵐ[Measure.restrict volume (Ioi 0)] ψ := Eventually.of_forall l2 -+ have r2 : IntegrableOn (fun y ↦ ψ y) (Ioi 0) volume := -+ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn -+ have r3 : Ico 1 2 ⊆ Function.support ψ := by -+ intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith -+ have r4 : Ico 1 2 ⊆ Function.support ψ ∩ Ioi 0 := by -+ simp only [subset_inter_iff, r3, -+ true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith -+ have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by -+ convert volume.mono r4 ; norm_num -+ simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using zero_lt_one.trans_le r5 -+ have := div_nonneg l3 l4.le ; field_simp at this ; exact this -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) -+ atTop (nhds (A * (b - a))) := by -+ -+ by_cases hab : a = b -+ · simp [hab] -+ replace hb : a < b := lt_of_le_of_ne hb hab ; clear hab -+ -+ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x -+ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by -+ filter_upwards [eventually_ge_atTop 0] with x hx -+ refine div_nonneg ?_ hx -+ refine tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _)) -+ have hA : 0 ≤ A := residue_nonneg hpos hf hcheby hG hG' -+ -+ let Iab : ℝ → ℝ := indicator (Ico a b) 1 -+ change Tendsto (S Iab) atTop (𝓝 (A * (b - a))) -+ have hIab : HasCompactSupport Iab := by -+ simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc -+ have Iab_nonneg : ∀ᶠ x : ℝ in atTop, 0 ≤ S Iab x := hSnonneg (indicator_nonneg (by simp)) -+ have Iab2 : IsBoundedUnder (· ≤ ·) atTop (S Iab) := by -+ obtain ⟨C, hC⟩ := hcheby ; exact ⟨C * 2 * b, WI_sum_Iab_le' hpos hC (by linarith)⟩ -+ have Iab3 : IsBoundedUnder (· ≥ ·) atTop (S Iab) := ⟨0, Iab_nonneg⟩ -+ have Iab0 : IsCoboundedUnder (· ≥ ·) atTop (S Iab) := Iab2.isCoboundedUnder_ge -+ have Iab1 : IsCoboundedUnder (· ≤ ·) atTop (S Iab) := Iab3.isCoboundedUnder_le -+ -+ have sup_le : limsup (S Iab) atTop ≤ A * (b - a) := by -+ have l_sup : ∀ᶠ ε in 𝓝[>] 0, limsup (S Iab) atTop ≤ A * (b - a + ε) := by -+ filter_upwards [interval_approx_sup ha hb] with ε happrox -+ rcases happrox with ⟨ψ, h1, h2, h3, h4, h6⟩ -+ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 -+ have l6 : S Iab ≤ᶠ[atTop] S ψ := by -+ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h4 hx hIab h2 -+ have l5 : IsBoundedUnder (· ≤ ·) atTop (S ψ) := l1.isBoundedUnder_le -+ have l3 : limsup (S Iab) atTop ≤ limsup (S ψ) atTop := limsup_le_limsup l6 Iab1 l5 -+ apply l3.trans ; rw [l1.limsup_eq] ; gcongr -+ obtain rfl | h := eq_or_ne A 0 -+ · simpa using l_sup -+ apply le_of_eventually_nhdsWithin -+ have key : 0 < A := lt_of_le_of_ne hA h.symm -+ filter_upwards [WI_tendsto_aux a b key l_sup] with x hx -+ simpa [mul_div_cancel₀ _ h] using hx -+ -+ have le_inf : A * (b - a) ≤ liminf (S Iab) atTop := by -+ have l_inf : ∀ᶠ ε in 𝓝[>] 0, A * (b - a - ε) ≤ liminf (S Iab) atTop := by -+ filter_upwards [interval_approx_inf ha hb] with ε happrox -+ rcases happrox with ⟨ψ, h1, h2, h3, h5, h6⟩ -+ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 -+ have l2 : S ψ ≤ᶠ[atTop] S Iab := by -+ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h5 hx h2 hIab -+ have l4 : IsBoundedUnder (· ≥ ·) atTop (S ψ) := l1.isBoundedUnder_ge -+ have l3 : liminf (S ψ) atTop ≤ liminf (S Iab) atTop := liminf_le_liminf l2 l4 Iab0 -+ apply le_trans ?_ l3 ; rw [l1.liminf_eq] ; gcongr -+ obtain rfl | h := eq_or_ne A 0 -+ · simpa using l_inf -+ apply ge_of_eventually_nhdsWithin -+ have key : 0 < A := lt_of_le_of_ne hA h.symm -+ filter_upwards [WI_tendsto_aux' a b key l_inf] with x hx -+ simpa [mul_div_cancel₀ _ h] using hx -+ -+ have : liminf (S Iab) atTop ≤ limsup (S Iab) atTop := liminf_le_limsup Iab2 Iab3 -+ refine tendsto_of_liminf_eq_limsup ?_ ?_ Iab2 Iab3 <;> linarith -+ -+ -+ -+theorem le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by -+ rw [div_le_iff₀ hx, Nat.le_floor_iff] ; positivity -+ -+theorem lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by -+ rw [div_lt_iff₀ hx, Nat.lt_ceil] -+ -+theorem ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by -+ rw [le_div_iff₀ hx, Nat.ceil_le] -+ -+theorem mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : -+ n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by -+ rw [Finset.mem_Icc, mem_Icc, ceil_mul_le_iff hx, le_floor_mul_iff hb hx] -+ -+theorem mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by -+ rw [Finset.mem_Ico, mem_Ico, ceil_mul_le_iff hx, lt_ceil_mul_iff hx] -+ -+theorem tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : -+ ∑' n, f n * (indicator (Ico a b) 1 (n / x)) = ∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n := by -+ have l1 : ∀ n ∉ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n * indicator (Ico a b) 1 (↑n / x) = 0 := by -+ simp [mem_Ico_iff_div hx] ; tauto -+ rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only -+ [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] -+ -+theorem WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) -+ atTop (nhds (A * (b - a))) := by -+ apply (WienerIkeharaInterval hpos hf hcheby hG hG' ha hb).congr' -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ rw [tsum_indicator hx] -+ -+theorem WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) -+ (ha : 0 < a) (hb : a ≤ b) : -+ Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) -+ atTop (nhds (A * (b - a))) := -+ WienerIkeharaInterval_discrete hpos hf hcheby hG hG' ha hb |>.comp tendsto_natCast_atTop_atTop -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem tendsto_mul_ceil_div : -+ Tendsto (fun (p : ℝ × ℕ) => ⌈p.1 * p.2⌉₊ / (p.2 : ℝ)) (𝓝[>] 0 ×ˢ atTop) (𝓝 0) := by -+ rw [Metric.tendsto_nhds] ; intro δ hδ -+ have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := -+ inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) -+ have l2 : ∀ᶠ N : ℕ in atTop, 1 ≤ δ / 2 * N := by -+ apply Tendsto.eventually_ge_atTop -+ exact tendsto_natCast_atTop_atTop.const_mul_atTop (by positivity) -+ filter_upwards [l1.prod_mk l2] with p hp -+ rcases p with ⟨ε, N⟩ -+ rcases hp with ⟨⟨hε, h1⟩, h2⟩ -+ dsimp only at * -+ have l3 : 0 < (N : ℝ) := by -+ simp only [Nat.cast_pos, Nat.pos_iff_ne_zero] ; rintro rfl ; simp [zero_lt_one.not_ge] at h2 -+ have l5 : 0 ≤ ε * ↑N := by positivity -+ have l6 : ε * N ≤ δ / 2 * N := mul_le_mul h1.le le_rfl (by positivity) (by positivity) -+ simp only [dist_zero_right, norm_div, RCLike.norm_natCast, div_lt_iff₀ l3, gt_iff_lt] -+ convert (Nat.ceil_lt_add_one l5).trans_le (add_le_add l6 h2) using 1 ; ring -+ -+ -+ -+noncomputable def S (f : ℕ → 𝕜) (ε : ℝ) (N : ℕ) : 𝕜 := (∑ n ∈ Finset.Ico ⌈ε * N⌉₊ N, f n) / N -+ -+theorem S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : -+ S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by -+ have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by -+ simp_rw [Finset.range_eq_Ico] -+ symm -+ apply Finset.Ico_union_Ico_eq_Ico (Nat.zero_le _) -+ simp only [Nat.ceil_le] -+ exact mul_le_of_le_one_left N.cast_nonneg hε -+ have r2 : Disjoint (Finset.range ⌈ε * N⌉₊) (Finset.Ico ⌈ε * N⌉₊ N) := by -+ rw [Finset.range_eq_Ico] ; apply Finset.Ico_disjoint_Ico_consecutive -+ simp [S, r1, Finset.sum_union r2, cumsum, add_div] -+ -+theorem tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : -+ TendstoUniformlyOnFilter (S f) (S f 0) (𝓝[>] 0) atTop := by -+ rw [Metric.tendstoUniformlyOnFilter_iff] ; intro δ hδ -+ obtain ⟨C, hC⟩ := hcheby -+ have l1 : ∀ᶠ (p : ℝ × ℕ) in 𝓝[>] 0 ×ˢ atTop, C * ⌈p.1 * p.2⌉₊ / p.2 < δ := by -+ have r1 := tendsto_mul_ceil_div.const_mul C -+ simp only [mul_div_assoc', mul_zero] at r1 ; exact r1 (Iio_mem_nhds hδ) -+ have : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) -+ filter_upwards [l1, Eventually.prod_inl this _] with p h1 h2 -+ rcases p with ⟨ε, N⟩ -+ have l2 : ‖cumsum f ⌈ε * ↑N⌉₊ / ↑N‖ ≤ C * ⌈ε * N⌉₊ / N := by -+ have r1 := hC ⌈ε * N⌉₊ -+ have r2 : 0 ≤ cumsum f ⌈ε * N⌉₊ := by apply cumsum_nonneg hpos -+ simp only [norm_real, norm_of_nonneg (hpos _), norm_div, -+ norm_of_nonneg r2, Real.norm_natCast] at r1 ⊢ -+ apply div_le_div_of_nonneg_right r1 (by positivity) -+ simpa [dist_eq_norm, ← S_sub_S h2.2] using l2.trans_lt h1 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem WienerIkeharaTheorem' {f : ℕ → ℝ} (hpos : 0 ≤ f) -+ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) -+ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) -+ (hG : ContinuousOn G {s | 1 ≤ s.re}) -+ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : -+ Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := by -+ convert_to Tendsto (S f 0) atTop (𝓝 A) ; · ext N ; simp [S, cumsum] -+ apply (tendsto_S_S_zero hpos hcheby).tendsto_of_eventually_tendsto -+ · have L0 : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) -+ apply eventually_of_mem L0 -+ · intro ε hε -+ convert WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 using 1 -+ funext N -+ simp only [S, one_mul, Nat.ceil_natCast] -+ · have : Tendsto (fun ε : ℝ => ε) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds -+ simpa using (this.const_sub 1).const_mul A -+ -+theorem vonMangoldt_cheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := by -+ use Real.log 4 + 4 -+ intro N -+ by_cases! h : N = 0 -+ · simp [h, cumsum] -+ simp only [cumsum, norm_real, norm_eq_abs] -+ rw [Nat.range_eq_Icc_zero_sub_one _ h, (by simp : N - 1 = ⌊(N : ℝ) - 1⌋₊)] -+ simp_rw [abs_of_nonneg vonMangoldt_nonneg] -+ rw [← Chebyshev.psi_eq_sum_Icc] -+ grw [Chebyshev.psi_le_const_mul_self <| sub_nonneg_of_le <| Nat.one_le_cast_iff_ne_zero.mpr h] -+ gcongr -+ linarith -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+theorem WeakPNT : Tendsto (fun N ↦ cumsum Λ N / N) atTop (𝓝 1) := by -+ let F := vonMangoldt.LFunctionResidueClassAux (q := 1) 1 -+ have l1 (n : ℕ) : 0 ≤ Λ n := vonMangoldt_nonneg -+ have l2 s (hs : 1 < s.re) : F s = LSeries Λ s - 1 / (s - 1) := by -+ have := vonMangoldt.eqOn_LFunctionResidueClassAux (q := 1) isUnit_one hs -+ simp only [F, this, vonMangoldt.residueClass, Nat.totient_one, Nat.cast_one, -+ inv_one, one_div, sub_left_inj] -+ apply LSeries_congr -+ intro n _ -+ simp only [ofReal_inj, indicator_apply_eq_self, Set.mem_ofPred_eq] -+ exact fun hn ↦ absurd (Subsingleton.eq_one _) hn -+ have l3 : ContinuousOn F {s | 1 ≤ s.re} := vonMangoldt.continuousOn_LFunctionResidueClassAux 1 -+ have l4 : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := vonMangoldt_cheby -+ have l5 (σ' : ℝ) (hσ' : 1 < σ') : Summable (nterm Λ σ') := by -+ simpa only [← nterm_eq_norm_term] -+ using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm -+ apply WienerIkeharaTheorem' l1 l5 l4 l3 l2 -+ -+end ZetaFivePNT -diff --git a/lakefile.toml b/lakefile.toml -index 2f3660d..71d9c89 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -1,17 +1,5 @@ - name = "PrimeNumberTheoremAnd" --defaultTargets = ["PrimeNumberTheoremAnd"] -- --[leanOptions] --pp.unicode.fun = true --pp.proofs.withType = false --autoImplicit = false --relaxedAutoImplicit = false --linter.mathlibStandardSet = true --linter.style.header = false --linter.style.openClassical = false --linter.style.longLine = false --linter.style.emptyLine = false --linter.flexible = true -+defaultTargets = ["PrimeNumberTheoremAnd.Wiener", "PrimeNumberTheoremAndZetaFive"] - - [[require]] - name = "LeanArchitect" -@@ -39,3 +27,24 @@ rev = "v4.34.0" - - [[lean_lib]] - name = "PrimeNumberTheoremAnd" -+leanOptions = { autoImplicit = false } -+ -+[[lean_lib]] -+name = "PrimeNumberTheoremAndZetaFive" -+roots = ["PrimeNumberTheoremAnd.ZetaFive"] -+globs = ["PrimeNumberTheoremAnd.ZetaFive.*"] -+ -+[[lean_lib]] -+name = "PrimeNumberTheoremAndCatalan" -+roots = ["PrimeNumberTheoremAnd.Catalan"] -+globs = ["PrimeNumberTheoremAnd.Catalan.*"] -+ -+[[lean_lib]] -+name = "PrimeNumberTheoremAndSiegelZeros" -+roots = ["PrimeNumberTheoremAnd.SiegelZeros.HadamardSupport"] -+globs = ["PrimeNumberTheoremAnd.SiegelZeros.*"] -+ -+[[lean_lib]] -+name = "PrimeNumberTheoremAndErdos970" -+roots = ["PrimeNumberTheoremAnd.Erdos970"] -+globs = ["PrimeNumberTheoremAnd.Erdos970.*"] -diff --git a/lean-toolchain b/lean-toolchain -index 664e12d..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.34.0 -\ No newline at end of file -+leanprover/lean4:v4.34.1 -diff --git a/PrimeNumberTheoremAnd/IEANTN/Mertens.lean b/PrimeNumberTheoremAnd/IEANTN/Mertens.lean ---- a/PrimeNumberTheoremAnd/IEANTN/Mertens.lean -+++ b/PrimeNumberTheoremAnd/IEANTN/Mertens.lean -@@ -14,7 +14,7 @@ - import Mathlib.Analysis.SpecialFunctions.Log.Summable - import Mathlib.Algebra.Group.Submonoid.BigOperators - import PrimeNumberTheoremAnd.EulerMaclaurin --import Architect -+ - - - theorem Filter.EventuallyEq.iff_eventually {α : Type _} {β : Type _} {l : Filter α} {f g : α → β} : f =ᶠ[l] g ↔ ∀ᶠ (x : α) in l, f x = g x := by rfl -@@ -284,23 +284,23 @@ - - namespace Mertens - --blueprint_comment /-- --\section{Mertens' theorems} -- --In this section we give explicit versions of Mertens' theorems: --\begin{itemize} --\item Mertens' first theorem (von Mangoldt form): $\sum_{n \leq x} \frac{\Lambda(n)}{n} = \log x + O(1)$. --\item Mertens' first theorem (prime form): $\sum_{p \leq x} \frac{\log p}{p} = \log x + O(1)$. --\item Mertens' second theorem (von Mangoldt form): $\sum_{n \leq x} \frac{\Lambda(n)}{n \log n} = \log \log x + \gamma + O(1/\log x)$. --\item Mertens' second theorem (prime form): $\sum_{p \leq x} \frac{1}{p} = \log \log x + M + O(1/\log x)$, where $M$ is the Meissel-Mertens constant. --\item Mertens' third theorem: $\prod_{p \leq x} (1 - \frac{1}{p}) = e^{-\gamma}/\log x + O(1/\log^2 x)$. --\end{itemize} --We aim to upstreaming these results to Mathlib. In particular, the arguments here should be self-contained and written for efficiency, coherency, and clarity. As such, extensive use of AI tools is \emph{strongly discouraged} in this section. -- --The arguments here are drawn from Leo Goldmakher's ``A quick proof of Mertens' theorem'' from https://web.williams.edu/Mathematics/lg5/mertens.pdf -- --The unfinished formalization of Mertens' theorems by Arend Mellendijk in https://github.com/FLDutchmann/Analytic/blob/main/Analytic/Mertens.lean may also be relevant here. ---/ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - open Real Finset Filter Asymptotics Topology -@@ -311,17 +311,17 @@ - rw [(by rfl : Ioc 0 x = Icc 1 x), ← add_sum_Ioc_eq_sum_Icc hx] - simpa - --@[blueprint -- "Mertens-sum-log" -- (title := "Partial sum of logarithm identity") -- (statement := /-- For any $x \geq 1$, one has --$$ \sum_{n \leq x} \log n = x \log x - (\{ x \}-1/2) \log x - x + 1 + \int_1^x (\{ t \}-1/2) \frac{dt}{t} $$ --(NOTE: this identity is not actually needed in the proof of Mertens' theorems, but may be worth recording nevertheless.) -- -/) -- (proof := /-- Apply the Euler-Maclaurin formula. -- -/) -- (latexEnv := "lemma") -- (discussion := 1303)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_log_eq {x : ℝ} (hx : 1 ≤ x) : - ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n = - x * log x - (x - ⌊x⌋₊ - 1 / 2) * log x - x + 1 + ∫ t in 1..x, (t - ⌊t⌋₊ - 1 / 2) / t := by -@@ -339,16 +339,16 @@ - · simp only [deriv_log', Set.uIcc_of_le hx] - fun_prop (disch := grind) - --@[blueprint -- "Mertens-sum-log-le" -- (title := "Partial sum of logarithm upper bound") -- (statement := /-- For any $x \geq 1$, one has --$$ \sum_{n \leq x} \log n \leq x \log x.$$ -- -/) -- (proof := /-- Trivial since $\log n \leq \log x$. -- -/) -- (latexEnv := "lemma") -- (discussion := 1304)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_log_le {x : ℝ} (hx : 1 ≤ x) : - ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n ≤ x * log x := by - calc -@@ -374,25 +374,25 @@ - grw [← norm_eq_abs, intervalIntegral.norm_integral_le_of_norm_le_const this, - abs_of_nonneg (by linarith)] - --@[blueprint -- "Mertens-sum-log-ge" -- (title := "Partial sum of logarithm lower bound") -- (statement := /-- For any $x \geq 1$, one has --$$ \sum_{n \leq x} \log n \geq x \log x - 2 x.$$ -- -/) -- (proof := /-- We have -- \begin{align*} -- \sum_{n \leq x} \log n &= \sum_{2 \leq n \leq \lfloor x \rfloor} \log n \\ -- &\geq \sum_{2 \leq n \leq \lfloor x \rfloor} \int_{n-1}^n \log t \, dt \\ -- &= \int_1^{\lfloor x \rfloor} \log t \, dt \\ -- &\geq \int_1^x \log t\ dt - \log x \\ -- &= x \log x - x - \log x \\ -- &\geq x \log x - 2 x. --\end{align*} --Here we use the monotonicity of $\log n$ (and its vanishing at $n=1$) and the crude bound $\log x \leq x$. Note: the tools at Mathlib.Analysis.SumIntegralComparisons may be useful. -- -/) -- (latexEnv := "corollary") -- (discussion := 1305)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_log_ge {x : ℝ} (hx : 1 ≤ x) : - ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n ≥ x * log x - 2 * x := by - have one_le_floor : 1 ≤ ⌊x⌋₊ := by simpa -@@ -422,16 +422,16 @@ - tsub_le_iff_right, sub_add_cancel, le_add_iff_nonneg_right, zero_le_one] - _ ≥ _ := by linarith [log_le_self (by linarith : 0 ≤ x)] - --@[blueprint -- "Mertens-sum-log-eq-log-factorial" -- (title := "Partial sum of logarithm as logarithm of factorial") -- (statement := /-- For any $x \geq 1$, one has --$$ \sum_{n \leq x} \log n = \log(\lfloor x \rfloor!). $$ -- -/) -- (proof := /-- Follows from the definition of the factorial function. Is not needed for the Mertens theorems, but is a natural fact to have. -- -/) -- (latexEnv := "proposition") -- (discussion := 1315)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_log_eq_log_factorial (x : ℝ) : - ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n = log (Nat.floor x).factorial := by - rw [←prod_Ico_id_eq_factorial, ←log_prod, prod_natCast] -@@ -439,47 +439,47 @@ - intro x hx - simp at hx ⊢; grind - --@[blueprint -- "Mertens-sum-log-eq-sum-mangoldt" -- (title := "Partial sum of logarithm as sum of $\\Lambda(d)/d$") -- (statement := /-- For any real $x$, one has --$$ \sum_{n \leq x} \log n = \sum_{d \leq x} \Lambda(d) \lfloor \frac{x}{d} \rfloor.$$ ---/) -- (proof := /-- We have --\begin{align*} --\sum_{n \leq x} \log n --&= \sum_{n \leq x} \sum_{d \mid n} \Lambda(d) --= \sum_{d \leq x} \Lambda(d) \sum_{n \leq x, d \mid n} 1 --= \sum_{d \leq x} \Lambda(d) \left\lfloor \frac{x}{d} \right\rfloor. --\end{align*} -- -/) -- (latexEnv := "lemma") -- (discussion := 1306)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_log_eq_sum_mangoldt {x : ℝ} : - ∑ n ∈ Ioc 0 ⌊x⌋₊, log n = ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * ⌊x / d⌋₊ := by - have : ∀ n : ℕ, log n = (Λ * zeta) n := by simp [vonMangoldt_mul_zeta] - simp_rw [this, sum_Ioc_mul_zeta_eq_sum, ← Nat.floor_div_natCast] - --@[blueprint -- "Mertens-first-error-mangoldt" -- (title := "The remainder term in Mertens first theorem (von Mangoldt form)") -- (statement := /-- We define $E_{1,\Lambda}(x) := \sum_{d \leq x} \frac{\Lambda(d)}{d} - \log x$. ---/)] -+ -+ -+ -+ -+ - noncomputable abbrev E₁Λ (x : ℝ) : ℝ := ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d - log x - - theorem sum_mangoldt_div_eq (x : ℝ) : ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d = log x + E₁Λ x := by - grind - --@[blueprint -- "Mertens-first-error-mangoldt-ge" -- (title := "Partial sum of $\\Lambda(d)/d$ lower bound") -- (statement := /-- For any $x \geq 1$, one has --$$ E_{1,\Lambda}(x) \geq - 2.$$ ---/) -- (proof := /-- Insert Lemma \ref{Mertens-sum-log-eq-sum-mangoldt} into Lemma \ref{Mertens-sum-log-ge} and lower bound $x/d$ by $\lfloor x/d \rfloor$. -- -/) -- (latexEnv := "corollary") -- (discussion := 1307)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₁Λ.ge {x : ℝ} (hx : 1 ≤ x) : - E₁Λ x ≥ -2 := by - unfold E₁Λ -@@ -498,16 +498,16 @@ - - - --@[blueprint -- "Mertens-first-error-mangoldt-le" -- (title := "Partial sum of $\\Lambda(d)/d$ upper bound") -- (statement := /-- For any $x \geq 1$, one has --$$ E_{1,\Lambda}(x) \leq \log 4 + 4.$$ ---/) -- (proof := /-- Insert Lemma \ref{Mertens-sum-log-eq-sum-mangoldt} into Lemma \ref{Mertens-sum-log-le} and upper bound $x/d$ by $\lfloor x/d \rfloor + 1$, and use the Mathlib bound $\psi(x) \leq (\log 4 + 4) x$. -- -/) -- (latexEnv := "corollary") -- (discussion := 1308)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₁Λ.le {x : ℝ} (hx : 1 ≤ x) : - E₁Λ x ≤ log 4 + 4 := by - unfold E₁Λ -@@ -529,16 +529,16 @@ - · exact Chebyshev.psi_le_const_mul_self (by linarith) - _ = _ := by ring - --@[blueprint -- "Mertens-first-theorem-mangoldt" -- (title := "Mertens' first theorem (von Mangoldt form)") -- (statement := /-- For any $x \geq 1$, one has --$$ \sum_{n \leq x} \frac{\Lambda(n)}{n} = \log x + O(1). $$ ---/) -- (proof := /-- Immediate from previous two corollaries. -- -/) -- (latexEnv := "corollary") -- (discussion := 1309)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_mangoldt_div_eq_log {x : ℝ} (hx : 1 ≤ x) : - |∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d - log x| ≤ log 4 + 4 := by - grind [E₁Λ.le hx, E₁Λ.ge hx, log_nonneg] -@@ -548,9 +548,9 @@ - - - --@[blueprint -- "Mertens-first-error-mangoldt" -- (discussion := 1309)] -+ -+ -+ - theorem E₁Λ.bounded : E₁Λ =O[atTop] (fun _ ↦ (1:ℝ)) := by - simp only [isBigO_iff, norm_eq_abs, norm_one, mul_one, - eventually_atTop] -@@ -560,34 +560,34 @@ - simp only [isLittleO_one_left_iff, norm_eq_abs] - exact tendsto_abs_atTop_atTop.comp tendsto_log_atTop - --@[blueprint -- "Mertens-first-error-mangoldt" -- (discussion := 1309)] -+ -+ -+ - theorem sum_mangoldt_div_eq_log' : - (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d) ~[atTop] (fun x ↦ log x) := by - apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log) - convert! E₁Λ.bounded using 1 - --@[blueprint -- "Mertens-first-error-prime" -- (title := "The remainder term in Mertens first theorem (prime form)") -- (statement := /-- We define $E_{1,p}(x) := \sum_{p \leq x} \frac{\log p}{p} - \log x$. ---/)] -+ -+ -+ -+ -+ - noncomputable abbrev E₁p (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p - log x - - theorem sum_log_prime_div_eq (x : ℝ) : ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p = log x + E₁p x := by - grind - --@[blueprint -- "Mertens-first-error-prime-le-mangoldt" -- (title := "Prime error for Mertens first theorem bounded by von Mangoldt error") -- (statement := /-- For any $x \geq 1$, one has --$$ E_{1,p}(x) \leq E_{1,\Lambda}(x). $$ ---/) -- (proof := /-- Drop all terms in Lemma \ref{Mertens-sum-log-eq-sum-mangoldt} arising from prime powers. -- -/) -- (latexEnv := "corollary") -- (discussion := 1311)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₁p.le_E₁Λ (x : ℝ) : - E₁p x ≤ E₁Λ x := by - unfold E₁p E₁Λ; rw [sum_filter] -@@ -597,15 +597,15 @@ - have : 0 ≤ Λ p := vonMangoldt_nonneg - positivity - --@[blueprint -- "Mertens-first-error-prime-le" -- (title := "Partial sum of $\\frac{\\log p}{p}$ upper bound") -- (statement := /-- For any $x \geq 1$, one has --$$ E_{1,p}(x) \leq \log 4 + 4.$$ ---/) -- (proof := /-- Drop all terms in Lemma \ref{Mertens-sum-mangoldt-div-le} arising from prime powers. -- -/) -- (latexEnv := "corollary")] -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₁p.le {x : ℝ} (hx : 1 ≤ x) : - E₁p x ≤ log 4 + 4 := by - linarith [E₁Λ.le hx, E₁p.le_E₁Λ x] -@@ -619,14 +619,14 @@ - exact_mod_cast h.one_le - · rfl - --@[blueprint -- "E1_summable" -- (title := "$E_1$ summable") -- (statement := /-- The series $E_1 := \sum_p \frac{\log p}{p(p-1)}$ converges. -/) -- (proof := /-- We have $\sum_{n=2}^\infty \frac{\log n}{n(n-1)}$ converges by comparison with $\sum_{n=2}^\infty \frac{2\log n}{n^2}$, which converges by the integral test. By a further application of comparison test we can conclude that $E_1$ converges as well. -- Alternatively bound $\log n$ by $2\sqrt n$ and use the existing Mathlib API for $\sum n^{-3/2}$.-/) -- (latexEnv := "proposition") -- (discussion := 1352)] -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₁.summable : Summable (fun p : ℕ ↦ if p.Prime then (log p) / (p*(p-1)) else 0) := by - refine (Real.summable_one_div_nat_rpow.mpr (by norm_num: 1 < (3 : ℝ) / 2)|>.const_div - 4).of_nonneg_of_le E₁.summand_nonneg fun n ↦ ?_ -@@ -733,13 +733,13 @@ - _ = _ := by - exact integral_log_div_sq - --@[blueprint -- "E1_bound" -- (title := "Upper bound on $E_1$") -- (statement := /-- One has $E_1 \leq \frac{5 \log 2 + 3}{4}$-/) -- (proof := /-- We can bound $E_1 \leq \sum_{n=2}^\infty \frac{\log n}{n(n-1)} \leq \frac{\log 2}{2} + \frac{3}{2} \sum_{n=3}^\infty \frac{\log n}{n^2}$. Calculus shows that $\log x / x^2$ is decreasing for $x \geq 2 > e^{1/2}$, so we can bound $\sum_{n=3}^\infty \frac{\log n}{n^2} \leq \int_2^\infty \frac{\log t}{t^2}\ dt = \frac{\log 2+1}{2}$.-/) -- (latexEnv := "proposition") -- (discussion := 1316)] -+ -+ -+ -+ -+ -+ -+ - theorem E₁.le : E₁ ≤ (5 * log 2 + 3) / 4 := by - unfold E₁ - calc -@@ -769,20 +769,20 @@ - theorem E₁.nonneg : E₁ ≥ 0 := - tsum_nonneg E₁.summand_nonneg - --@[blueprint -- "Mertens-first-error-prime-ge" -- (title := "Partial sum of $\\frac{\\log p}{p}$ lower bound") -- (statement := /-- For any $x \geq 1$, one has --$$ E_{1,\Lambda}(x) \leq E_{1,p}(x) + E_1$$ --and thus --$$ E_{1,p}(x) \geq -2 - E_1$$ --where --$$ E_1 := \sum_{p} \frac{\log p}{p(p-1)}. $$ ---/) -- (proof := /-- Use the triangle inequality and the geometric series formula to estimate in Lemma \ref{Mertens-sum-mangoldt-div-le} arising from prime powers. -- -/) -- (latexEnv := "corollary") -- (discussion := 1312)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₁Λ.le_E₁p_add_E₁ {x : ℝ} (hx : 1 ≤ x) : - E₁Λ x ≤ E₁p x + E₁ := by - unfold E₁Λ E₁p -@@ -831,15 +831,15 @@ - linarith [E₁Λ.le_E₁p_add_E₁ hx, E₁Λ.ge hx] - - --@[blueprint -- "Mertens-first-theorem-prime-bounded" -- (title := "Error term in Mertens' first theorem bounded (prime form)") -- (statement := /-- For any $x \geq 1$, one has --$$ \sum_{p \leq x} \frac{\log p}{p} = \log x + O(1). $$ ---/) -- (proof := /-- Immediate from previous two corollaries. -- -/) -- (discussion := 1313)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_log_prime_div_eq_log {x : ℝ} (hx : 1 ≤ x) : - |∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p - log x| ≤ log 4 + 4 := by - rw [abs_le'] -@@ -851,31 +851,31 @@ - theorem E₁p.bounded : ∃ c > 0, ∀ x ≥ 1, |E₁p x| ≤ c := by - exact ⟨log 4 + 4, (by positivity), fun _ hx ↦ sum_log_prime_div_eq_log hx⟩ - --@[blueprint -- "Mertens-first-theorem-prime-bounded"] -+ -+ - theorem sum_log_prime_div_eq_log' : E₁p =O[atTop] (fun _ ↦ (1:ℝ)) := by - simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, - eventually_atTop, E₁p] - exact ⟨ log 4 + 4, 1, fun _ ↦ sum_log_prime_div_eq_log ⟩ - --@[blueprint -- "Mertens-first-theorem-prime-bounded"] -+ -+ - theorem sum_log_prime_div_eq_log'' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p) ~[atTop] (fun x ↦ log x) := by - apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log) - convert! sum_log_prime_div_eq_log' using 1 - --@[blueprint -- "Euler-Mascheroni-const-alt" -- (title := "Alternate Formula for Euler-Mascheroni constant") -- (statement := /-- We set $\gamma := \int_2^\infty \frac{E_{1,\Lambda}(t)}{t \log^2 t} \, dt + 1 - \log \log 2$. ---/)] -+ -+ -+ -+ -+ - noncomputable abbrev γ : ℝ := (∫ t in Set.Ioi 2, E₁Λ t / (t * log t^2)) + 1 - log (log 2) - --@[blueprint -- "Mertens-second-error-mangoldt" -- (title := "The remainder term in Mertens second theorem (von Mangoldt form)") -- (statement := /-- We define $E_{2,\Lambda}(x) := \sum_{d \leq x} \frac{\Lambda(d)}{d \log d} - \log \log x - \gamma$. ---/)] -+ -+ -+ -+ -+ - noncomputable abbrev E₂Λ (x : ℝ) : ℝ := ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x) - γ - - lemma sum_Ioc_one_eq_sum_Icc_zero {f : ℕ → ℝ} {x : ℕ} (hx : 1 ≤ x) (hf1 : f 1 = 0) (hf0 : f 0 = 0) : -@@ -883,17 +883,17 @@ - rw [sum_Ioc_one_eq_sum_Ioc_zero hx hf1, ← add_sum_Ioc_eq_sum_Icc (by linarith)] - simpa - --@[blueprint -- "Mertens-integral-ident" -- (title := "Integral identity involving inverse log weight") -- (statement := /-- For any $x \geq 2$ and any $f : {\mathbb N} \mapsto {\mathbb R}$, one has --$$ \sum_{2 \leq n \leq x} \frac{f(n)}{\log n} = \frac{1}{\log x} \sum_{2 \leq n \leq x} f(n) + \int_2^x \frac{1}{t \log^2 t} \sum_{2 \leq n \leq t} f(n) \, dt$$-/) -- (proof := /-- Establish the identity -- $$ \frac{1}{\log n} = \frac{1}{\log x} + \int_2^x \frac{1}{t \log^2 t} 1_{t \geq n}\ dt$$ -- for $2 \leq n \leq x$,multiply by $f(n)$, then sum. -- -- -/) -- (latexEnv := "sublemma")] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - private theorem sum_div_log_eq {x : ℝ} (hx : 2 ≤ x) (f : ℕ → ℝ) : - ∑ n ∈ Ioc 1 ⌊ x ⌋₊, f n / log n = - (∑ n ∈ Ioc 1 ⌊ x ⌋₊, f n) / log x + ∫ t in 2..x, (∑ n ∈ Ioc 1 ⌊ t ⌋₊, f n) / (t * log t^2) := by -@@ -1008,19 +1008,19 @@ - have : log t ≠ 0 := by simp; grind - fun_prop (disch := grind) - --@[blueprint -- "Mertens-second-error-mangoldt-eq" -- (title := "Integral form for second error (von Mangoldt form)") -- (statement := /-- For any $x \geq 2$, one has --$$ E_{2,\Lambda}(x) = \frac{E_{1,\Lambda}(x)}{\log x} - \int_x^\infty \frac{E_{1,\Lambda}(t)}{t \log^2 t}\ dt$$ ---/) -- (proof := /-- --From Lemma \ref{Mertens-integral-ident} one has --$$ \sum_{n \leq x} \frac{\Lambda(n)}{n \log n} = \frac{1}{\log x} \sum_{n \leq x} \frac{\Lambda(n)}{n} + \int_2^x \frac{1}{t \log^2 t} \sum_{n \leq t} \frac{\Lambda(n)}{n} \, dt.$$ --Now substitute the definitions of $E_{1,\Lambda}$, $E_{2,\Lambda}$, $\gamma$ and simplify. -- -/) -- (latexEnv := "corollary") -- (discussion := 1317)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₂Λ.eq {x : ℝ} (hx : 2 ≤ x) : - E₂Λ x = E₁Λ x / log x - ∫ t in Set.Ioi x, E₁Λ t / (t * log t^2) := by - unfold E₂Λ -@@ -1058,17 +1058,17 @@ - convert! tendsto_log_atTop.inv_tendsto_atTop.const_mul (-c) using 1 - simp - --@[blueprint -- "Mertens-second-error-mangoldt-bound" -- (title := "Bound for second Mertens error (von Mangoldt form)") -- (statement := /-- For any $x \geq 2$, one has --$$ |E_{2,\Lambda}(x)| \leq \frac{\log 4 + 6}{\log x}.$$ ---/) -- (proof := /-- -- Insert Lemma \ref{Mertens-first-error-mangoldt-le} and Lemma \ref{Mertens-first-error-mangoldt-ge} into Lemma \ref{Mertens-second-error-mangoldt-eq} and use the triangle inequality to obtain the required upper and lower bounds. -- -/) -- (latexEnv := "corollary") -- (discussion := 1318)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₂Λ.abs_le {x : ℝ} (hx : 2 ≤ x) : - |E₂Λ x| ≤ (log 4 + 6) / log x := by - have : 0 < log x := by apply log_pos; linarith -@@ -1100,8 +1100,8 @@ - grind - - --@[blueprint -- "Mertens-second-error-mangoldt-bound"] -+ -+ - theorem E₂Λ.bound : E₂Λ =O[atTop] (fun x ↦ 1 / log x) := by - simp only [one_div, isBigO_iff, norm_eq_abs, norm_inv, eventually_atTop] - use log 4 + 6, 2 -@@ -1110,22 +1110,22 @@ - have : 0 < log x := by apply log_pos; linarith - grind [abs_of_pos this] - --@[blueprint -- "Mertens-second-error-mangoldt-bound"] -+ -+ - theorem E₂Λ.bound' : E₂Λ =o[atTop] (fun _ ↦ (1:ℝ)) := E₂Λ.bound.trans_isLittleO inv_log_eq_o_one - --@[blueprint -- "log-zeta-eq-1" -- (title := "Dirichlet series for $\\log \\zeta(s)$") -- (statement := /-- If $s > 1$ then $\log\zeta(s) = - \log (s-1) + \Gamma'(1) + \gamma + (s-1) \int_1^\infty E_{2,\Lambda}(x) x^{-s}\ ds$. ---/) -- (proof := /-- First use the fundamental theorem of calculus and decay of $\log \zeta(s)$ to write -- $$ \log \zeta(s) = \int_s^\infty -\frac{\zeta'(u)}{\zeta(u)}\ du.$$ -- Then substitute in the known identity -- $-\frac{\zeta'(u)}{\zeta(u)} = \sum_n \frac{\Lambda(n)}{n^u}$ and integrate term by term. -- -/) -- (latexEnv := "sublemma") -- (discussion := 1582)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem log_zeta_eq_sum (s : ℝ) (hs : 1 < s) : - log (riemannZeta (s:ℂ)).re = ∑' n, Λ n / (n^s * log n) := by - have hsc : (1 : ℝ) < ((s : ℂ)).re := by simpa using hs -@@ -1449,41 +1449,41 @@ - end LogZetaInteg - end - --@[blueprint -- "log-zeta-eq-2" -- (title := "Integration by parts identity for $\\log \\zeta(s)$") -- (statement := /-- If $s > 1$ then $\log\zeta(s) = (s-1) \int_1^\infty (\log \log x + \gamma + E_{2,\Lambda}(x)) x^{-s})\ dx$. ---/) -- (proof := /-- Apply the preceding identity then integrate by parts. -- -/) -- (latexEnv := "sublemma") -- (discussion := 1583)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - private theorem log_zeta_eq_integ (s : ℝ) (hs : 1 < s) : - log (riemannZeta (s:ℂ)).re = (s - 1) * ∫ x in .Ioi 1, (log (log x) + γ + E₂Λ x) * x^(-s) := - LogZetaInteg.log_zeta_eq_integ_aux s hs - --@[blueprint -- "log-zeta-eq-3" -- (title := "First integral identity") -- (statement := /-- If $s > 1$ then $(s-1) \int_1^\infty \log \log x \cdot x^{-s}\ dx = -\log (s-1) + \Gamma'(1)$. ---/) -- (proof := /-- Writing $t = \log x$, the LHS is $(s-1) \int_0^\infty \log t e^{-(s-1) t}\ dt$. Now differentiate $\Gamma(z) = (s-1)^z \int_0^\infty t^{z-1} e^{-(s-1)t}\ dt$ in $z$ at $z=1$. -- -/) -- (latexEnv := "sublemma") -- (discussion := 1584)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - private theorem mul_integ_log_log_eq (s : ℝ) (hs : 1 < s) : - (s - 1) * ∫ x in .Ioi 1, log (log x) * x^(-s) = - log (s - 1) + deriv Gamma 1 := - mul_integ_log_log_eq_aux s hs - --@[blueprint -- "log-zeta-eq-4" -- (title := "Second integral identity") -- (statement := /-- If $s > 1$ then $(s-1) \int_1^\infty \gamma \cdot x^{-s}\ dx = \gamma$. ---/) -- (proof := /-- Apply the fundamental theorem of calculus. -- -/) -- (latexEnv := "sublemma") -- (discussion := 1585)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - private theorem mul_integ_gamma_eq (s) (hs : 1 < s) : (s - 1) * ∫ x in .Ioi 1, γ * x^(-s) = γ := by - rw [MeasureTheory.integral_const_mul γ (· ^ (-s)), @integral_Ioi_rpow_of_lt (-s), one_rpow] <;> - grind -@@ -1600,14 +1600,14 @@ - div_le_div_of_nonneg_left hc hlog2 (Real.log_le_log (by norm_num) (le_of_lt hx)) - exact (E₂Λ.abs_le (le_of_lt hx)).trans hb2 - --@[blueprint -- "log-zeta-eq" -- (title := "An identity for $\\log \\zeta(s)$") -- (statement := /-- If $s > 1$ then $\log\zeta(s) = - \log (s-1) + \Gamma'(1) + \gamma + (s-1) \int_1^\infty E_{2,\Lambda}(x) x^{-s}\ ds$. ---/) -- (proof := /-- Combine the previous four sublemmas.-/) -- (latexEnv := "theorem") -- (discussion := 1319)] -+ -+ -+ -+ -+ -+ -+ -+ - private theorem log_zeta_eq (s : ℝ) (hs : 1 < s) : - log (riemannZeta (s:ℂ)).re = - log (s - 1) + deriv Gamma 1 + γ + (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x^(-s) := by - -- Start from the integration-by-parts identity (#1583). -@@ -1652,15 +1652,15 @@ - (Complex.continuous_re.tendsto (1 : ℂ)).comp hcomplex - simpa [Complex.ofReal_sub, Complex.ofReal_mul] using hreal - --@[blueprint -- "log-zeta-limit" -- (title := "limiting behavior of log zeta") -- (statement := /-- One has $\log \zeta(s) = - \log(s-1) + o(1)$ as $s \to 1^+$. ---/) -- (proof := /-- Start with the asymptotic $\zeta(s) = \frac{1}{s-1} + O(1)$ and take logarithms. -- -/) -- (latexEnv := "sublemma") -- (discussion := 1586)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - private theorem log_zeta_limit : - Filter.Tendsto - (fun s : ℝ => Real.log (riemannZeta (s : ℂ)).re + Real.log (s - 1)) -@@ -1895,14 +1895,14 @@ - - end - --@[blueprint -- "Euler-Mascheroni-eq" -- (title := "Compatibility with Mathlib Euler-Mascheroni constant") -- (statement := /-- $\gamma$ is the Euler--Mascheroni constant. ---/) -- (proof := /-- Take limits as $s \to 1$ in the previous asymptotic using known asymptotics for $\zeta(s)$, and using that $- \Gamma'(1)$ is the Euler--Mascheroni constant. -/) -- (latexEnv := "theorem") -- (discussion := 1320)] -+ -+ -+ -+ -+ -+ -+ -+ - theorem deriv_gamma_add_γ_eq_zero : deriv Gamma 1 + γ = 0 := by - -- For `s > 1`, `log_zeta_eq` rearranges to a constant identity. - have key : ∀ s : ℝ, 1 < s → -@@ -1930,15 +1930,15 @@ - theorem sum_mangoldt_div_log_eq (x : ℝ) : ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) = log (log x) + eulerMascheroniConstant + E₂Λ x := by - grind [γ.eq_eulerMascheroni] - --@[blueprint -- "Mertens-second-theorem-mangoldt-weak" -- (title := "Mertens' second theorem (weak von Mangoldt form)") -- (statement := /-- For any $x \geq 2$, one has --$$ \sum_{n \leq x} \frac{\Lambda(n)}{n \log n} = \log \log x + O(1). $$ ---/) -- (proof := /-- Immediate from previous two corollaries. -- -/) -- (discussion := 1321)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_mangoldt_div_log_eq_log_log : ∃ C, ∀ x, 2 ≤ x → - |∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x)| ≤ C := by - use (log 4 + 6)/log 2 + |eulerMascheroniConstant| -@@ -1949,8 +1949,8 @@ - _ ≤ (log 4 + 6)/log x + |eulerMascheroniConstant| := by grw [abs_add_le, E₂Λ.abs_le hx] - _ ≤ _ := by gcongr - --@[blueprint -- "Mertens-second-theorem-mangoldt-weak"] -+ -+ - theorem sum_mangoldt_div_log_eq_log_log' : (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x)) =O[atTop] (fun _ ↦ (1:ℝ)) := by - simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, - eventually_atTop] -@@ -1958,27 +1958,27 @@ - use C, 2 - - --@[blueprint -- "Mertens-second-theorem-mangoldt-weak"] -+ -+ - theorem sum_mangoldt_div_log_eq_log_log'' : (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d)) ~[atTop] (fun x ↦ log (log x)) := by - apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log_log) - convert! sum_mangoldt_div_log_eq_log_log' using 1 - --@[blueprint -- "Meissel-Mertens-constant" -- (title := "The Meissel-Mertens constant") -- (statement := /-- We define $M := \int_2^\infty \frac{E_{1,p}(t)}{t \log^2 t} \, dt + 1 - \log \log 2$.-/)] -+ -+ -+ -+ - noncomputable def M : ℝ := (∫ t in Set.Ioi 2, E₁p t / (t * log t^2)) + 1 - log (log 2) - --@[blueprint -- "Mertens-second-constant-prime-le" -- (title := "Upper bound for $M$") -- (statement := /-- One has $M \leq \frac{\log 4 + 4}{\log 2} + 1 - \log \log 2$. ---/) -- (proof := /-- Insert Lemma \ref{Mertens-first-error-prime-le} into the definition of $M$ and use the fact that $\int_2^\infty \frac{dt}{t \log^2 t} = 1/\log 2$. -- -/) -- (latexEnv := "corollary") -- (discussion := 1323)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem M.le : M ≤ (log 4 + 4) / log 2 + 1 - log (log 2) := calc - _ ≤ (∫ t in Set.Ioi 2, (log 4 + 4) / (t * log t^2)) + 1 - log (log 2) := by - unfold M; gcongr with x hx -@@ -1989,15 +1989,15 @@ - simp at hx; exact E₁p.le (by linarith) - _ = _ := by rw [integ_div_mul_log_sq _ (by norm_num)] - --@[blueprint -- "Mertens-second-constant-prime-ge" -- (title := "Lower bound for $M$") -- (statement := /-- One has $M \geq -\frac{2 + E_1}{\log 2} + 1 - \log \log 2$. ---/) -- (proof := /-- Insert Lemma \ref{Mertens-first-error-prime-ge} into the definition of $M$ and use the fact that $\int_2^\infty \frac{dt}{t \log^2 t} = 1/\log 2$. -- -/) -- (latexEnv := "corollary") -- (discussion := 1324)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem M.ge : M ≥ (-2 - E₁) / log 2 + 1 - log (log 2) := calc - _ ≥ (∫ t in Set.Ioi 2, (-2 - E₁) / (t * log t^2)) + 1 - log (log 2) := by - unfold M; gcongr with x hx -@@ -2008,29 +2008,29 @@ - simp at hx; exact E₁p.ge (by linarith) - _ = _ := by rw [integ_div_mul_log_sq _ (by norm_num)] - --@[blueprint -- "Mertens-second-error-mangoldt" -- (title := "The remainder term in Mertens second theorem (von Mangoldt form)") -- (statement := /-- We define $E_{2,p}(x) := \sum_{p \leq x} \frac{1}{p} - \log \log x - M$. ---/)] -+ -+ -+ -+ -+ - noncomputable abbrev E₂p (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1:ℝ) / p - log (log x) - M - - theorem sum_prime_div_eq (x : ℝ) : ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1:ℝ) / p = log (log x) + M + E₂p x := by - ring - --@[blueprint -- "Mertens-second-error-prime-eq" -- (title := "Integral form for second error (prime form)") -- (statement := /-- For any $x \geq 2$, one has --$$ E_{2,p}(x) = \frac{E_{1,p}(x)}{\log x} - \int_x^\infty \frac{E_{1,p}(t)}{t \log^2 t}\ dt$$ ---/) -- (proof := /-- --From Lemma \ref{Mertens-integral-ident} one has --$$ \sum_{p \leq x} \frac{1}{p} = \frac{1}{\log x} \sum_{p \leq x} \frac{\log p}{p} + \int_2^x \frac{1}{t \log^2 t} \sum_{p \leq t} \frac{\log p}{p} \, dt.$$ --Now substitute the definitions of $E_{1,p}$, $E_{2,p}$, $M$ and simplify. -- -/) -- (latexEnv := "corollary") -- (discussion := 1325)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₂p.eq {x : ℝ} (hx : 2 ≤ x) : - E₂p x = E₁p x / log x - ∫ t in Set.Ioi x, E₁p t / (t * log t^2) := by - unfold E₂p -@@ -2061,16 +2061,16 @@ - · rw [intervalIntegrable_iff, Set.uIoc_of_le hx] - exact integrable_E₁p_div_mul_log_sq (x := 2) (by rfl)|>.mono (by grind) (by rfl) - --@[blueprint -- "Mertens-second-error-prime-abs-le" -- (title := "Bound for second error (prime form)") -- (statement := /-- For any $x \geq 2$, one has --$$ |E_{2,p}(x)| \leq \frac{\log 4 + 6 + E_1}{\log x}.$$ ---/) -- (proof := /-- Similar to Lemma \ref{Mertens-second-error-prime-eq}. -- -/) -- (latexEnv := "corollary") -- (discussion := 1326)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₂p.abs_le {x : ℝ} (hx : 2 ≤ x) : - |E₂p x| ≤ (log 4 + 6 + E₁) / log x := by - have : 0 < log x := by apply log_pos; linarith -@@ -2101,8 +2101,8 @@ - grw [this] - grind - --@[blueprint -- "Mertens-second-error-prime-abs-le"] -+ -+ - theorem E₂p.bound : E₂p =O[atTop] (fun x ↦ 1 / log x) := by - simp only [one_div, isBigO_iff, norm_eq_abs, norm_inv, eventually_atTop] - use log 4 + 6 + E₁, 2 -@@ -2111,19 +2111,19 @@ - have : 0 < log x := by apply log_pos; linarith - grind [abs_of_pos this] - --@[blueprint -- "Mertens-second-error-prime-abs-le"] -+ -+ - theorem E₂p.bound' : E₂p =o[atTop] (fun _ ↦ (1:ℝ)) := E₂p.bound.trans_isLittleO inv_log_eq_o_one - --@[blueprint -- "Mertens-second-theorem-prime-weak" -- (title := "Mertens' second theorem (weak prime form)") -- (statement := /-- For any $x \geq 2$, one has --$$ \sum_{p \leq x} \frac{1}{p} = \log \log x + O(1). $$ ---/) -- (proof := /-- Immediate from previous two corollaries. -- -/) -- (discussion := 1327)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem sum_prime_div_eq_log_log : ∃ C, ∀ x, 2 ≤ x → - |∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p - log (log x)| ≤ C := by - use |M| + (log 4 + 6 + E₁) / log 2 -@@ -2137,16 +2137,16 @@ - have : 0 < log 4 := by apply log_pos; norm_num - linarith [E₁.nonneg] - --@[blueprint -- "Mertens-second-theorem-prime-weak"] -+ -+ - theorem sum_prime_div_eq_log_log' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p - log (log x)) =O[atTop] (fun _ ↦ (1:ℝ)) := by - simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, - eventually_atTop] - obtain ⟨ C, hC ⟩ := sum_prime_div_eq_log_log - use C, 2 - --@[blueprint -- "Mertens-second-theorem-prime-weak"] -+ -+ - theorem sum_prime_div_eq_log_log'' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p) ~[atTop] (fun x ↦ log (log x)) := by - apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log_log) - convert! sum_prime_div_eq_log_log' using 1 -@@ -2244,33 +2244,33 @@ - ring_nf - · ring - --@[blueprint -- "Meissel-Mertens-eq" -- (title := "Formula for Meissel-Mertens constant") -- (statement := /-- One has $M = \gamma + \sum_p \log(1-\frac{1}{p}) + \frac{1}{p}$. ---/) -- (proof := /-- The RHS can be Taylor expanded as $\sum_{j=2}^\infty \sum_p \frac{1}{jp^j}$. Meanwhile, the difference between $\sum_{n \leq x} \frac{\Lambda(n)}{n \log n}$ and $\sum_{p \leq x} \frac{1}{p}$ is equal to $\sum_{j=2}^\infty \sum_{p: p^j \leq x} \frac{1}{j p^j}$. Applying the monotone convergence theorem, Lemma \ref{Mertens-second-error-prime-abs-le}, and Lemma \ref{Mertens-second-error-mangoldt-bound} gives the claim. -/) -- (discussion := 1328)] -+ -+ -+ -+ -+ -+ -+ - theorem M.eq : M = γ + ∑' p : ℕ, if p.Prime then log (1 - 1 / p) + 1 / p else 0 := by - rw [← tsum_M_eq_f_eq_tsum, M_eq_f.HasSum.tsum_eq] - ring - --@[blueprint -- "Mertens-third-error" -- (title := "The remainder term in Mertens third theorem ") -- (statement := /-- We define $E_3(x) := \sum_{p \leq x} \log (1 - \frac{1}{p}) + \log\log x + \gamma$. ---/)] -+ -+ -+ -+ -+ - noncomputable def E₃ (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, log (1 - (1:ℝ) / p) + log (log x) + eulerMascheroniConstant - --@[blueprint -- "Mertens-third-theorem-error" -- (title := "Mertens' third theorem error term") -- (statement := /-- For any $x \geq 2$, one has --$$ \prod_{p \leq x} \left(1 - \frac{1}{p}\right) = \frac{e^{-\gamma}}{\log x} \exp(E_3(x)). $$ ---/) -- (proof := /-- Immediate from definition -- -/) -- (discussion := 1329)] -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem prod_one_minus_div_prime_eq {x : ℝ} (hx : 1 < x) : - ∏ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1 - (1 : ℝ) / p) = - exp (-eulerMascheroniConstant) * exp (E₃ x) / log x := by -@@ -2365,17 +2365,17 @@ - gcongr - exact Nat.lt_floor_add_one _|>.le - --@[blueprint -- "Mertens-third-theorem-error-le" -- (title := "Mertens' third theorem error bound") -- (statement := /-- For any $x \geq 2$, one has --$$ E_3(x) = O\left(\frac{1}{\log x}\right) $$ ---/) -- (proof := /--Estimating the error in \ref{Meissel-Mertens-eq} using the first order Taylor expansion of log one gets --$$\sum_{p \le x}(\log (1-1/p)+1/p) = (M - \gamma) + O(1/x).$$ --The result follows by combining with \ref{Mertens-second-error-prime-abs-le}. -- -/) -- (discussion := 1330)] -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - theorem E₃.abs_le : ∃ C, ∀ x, 2 ≤ x → |E₃ x| ≤ C / log x := by - unfold E₃ - refine ⟨4 + (log 4 + 6 + E₁), fun x hx ↦ ?_⟩ -@@ -2399,8 +2399,8 @@ - grw [this] - rw [← add_div] - --@[blueprint -- "Mertens-third-theorem-error-le"] -+ -+ - theorem E₃.bound : E₃ =O[atTop] (fun x ↦ 1 / log x) := by - simp only [isBigO_iff, norm_eq_abs, eventually_atTop] - obtain ⟨ C, hC ⟩ := E₃.abs_le -@@ -2410,12 +2410,12 @@ - have : 0 < 1 / log x := by positivity - grind [abs_of_pos this] - --@[blueprint -- "Mertens-third-theorem-error-le"] -+ -+ - theorem E₃.bound' : E₃ =o[atTop] (fun _ ↦ (1:ℝ)) := E₃.bound.trans_isLittleO inv_log_eq_o_one - --@[blueprint -- "Mertens-third-theorem-error-le"] -+ -+ - theorem E₃.bound'' : (fun x ↦ ∏ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1 - (1:ℝ) / p)) ~[atTop] (fun x ↦ exp (-eulerMascheroniConstant) / log x) := by - rw [isEquivalent_iff_tendsto_one] - · convert Tendsto.congr' ?_ (Tendsto.rexp ((isLittleO_one_iff ℝ).mp E₃.bound')) using 2 with x -@@ -2427,8 +2427,8 @@ - simp only [ne_eq, div_eq_zero_iff, exp_ne_zero, log_eq_zero, eventually_atTop]; use 2 - grind - --@[blueprint -- "Mertens-third-theorem-error-le"] -+ -+ - theorem E₃.bound''' : (fun x ↦ ∏ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1 - (1:ℝ) / p) - exp (-eulerMascheroniConstant) / log x) =O[atTop] (fun x ↦ 1 / (log x)^2) := by - obtain ⟨c, hc⟩ := E₃.abs_le - rw [isBigO_iff] -diff --git a/PrimeNumberTheoremAnd/PerronFormula.lean b/PrimeNumberTheoremAnd/PerronFormula.lean ---- a/PrimeNumberTheoremAnd/PerronFormula.lean -+++ b/PrimeNumberTheoremAnd/PerronFormula.lean -@@ -6,5 +6,3 @@ - import PrimeNumberTheoremAnd.Wiener -- --set_option lang.lemmaCmd true -- -+ - open Asymptotics Complex ComplexConjugate Topology Filter Real MeasureTheory Set +diff --git a/PrimeNumberTheoremAnd/Catalan.lean b/PrimeNumberTheoremAnd/Catalan.lean +new file mode 100644 +index 0000000..0c4ccd6 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Catalan.lean +@@ -0,0 +1 @@ ++import PrimeNumberTheoremAnd.Catalan.Consequences +diff --git a/PrimeNumberTheoremAnd/Catalan/Consequences.lean b/PrimeNumberTheoremAnd/Catalan/Consequences.lean +new file mode 100644 +index 0000000..470ade9 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Catalan/Consequences.lean +@@ -0,0 +1,68 @@ ++import Mathlib.Analysis.Asymptotics.SpecificAsymptotics ++import Mathlib.Analysis.SpecialFunctions.Log.Basic ++import PrimeNumberTheoremAnd.Catalan.Wiener ++ ++namespace CatalanPNT ++ ++open ZetaFivePNT ++ ++open ArithmeticFunction hiding log ++open Nat hiding log ++open _root_.Finset ++open BigOperators _root_.Filter _root_.Real _root_.Asymptotics ++open scoped Chebyshev ++ ++theorem WeakPNT' : Tendsto (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) atTop (nhds 1) := by ++ have : (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) = ++ (fun N ↦ (∑ n ∈ range N, Λ n)/N + Λ N / N) := by ++ ext N ++ have : N ∈ Iic N := mem_Iic.mpr (le_refl _) ++ rw [← Finset.sum_erase_add _ _ this, ← Nat.Iio_eq_range, Iic_erase] ++ exact add_div _ _ _ ++ rw [this, ← add_zero 1] ++ apply Tendsto.add WeakPNT ++ convert squeeze_zero (f := fun N ↦ Λ N / N) (g := fun N ↦ log N / N) (t₀ := atTop) ?_ ?_ ?_ ++ · intro N ++ exact div_nonneg vonMangoldt_nonneg (cast_nonneg N) ++ · intro N ++ exact div_le_div_of_nonneg_right vonMangoldt_le_log (cast_nonneg N) ++ simpa only [Function.comp_def, pow_one, one_mul, add_zero] using ++ (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 one_ne_zero).comp ++ tendsto_natCast_atTop_atTop ++ ++theorem WeakPNT'' : ψ ~[atTop] (fun x ↦ x) := by ++ rw [(by rfl : ψ = (fun x ↦ ψ x))] ++ simp_rw [Chebyshev.psi_eq_sum_Icc] ++ apply IsEquivalent.trans (v := fun x ↦ (⌊x⌋₊:ℝ)) ++ · rw [isEquivalent_iff_tendsto_one] ++ · convert Tendsto.comp WeakPNT' (tendsto_nat_floor_atTop (α := ℝ)) using 1 ++ ext x ++ rfl ++ rw [eventually_iff] ++ simp only [ne_eq, cast_eq_zero, floor_eq_zero, not_lt, mem_atTop_sets, ++ Set.mem_ofPred_eq] ++ use 1 ++ simp only [imp_self, implies_true] ++ exact Asymptotics.isEquivalent_nat_floor ++ ++theorem isLittleO_sqrt_mul_log : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] _root_.id := by ++ have : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] fun x ↦ x := by ++ refine (isLittleO_mul_iff_isLittleO_div ?_).mpr ?_ ++ · filter_upwards [eventually_gt_atTop 0] with x hx; exact (sqrt_ne_zero hx.le).mpr hx.ne' ++ · convert isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2) using 2 with x ++ rw [div_sqrt, sqrt_eq_rpow] ++ exact this ++ ++theorem chebyshev_asymptotic : θ ~[atTop] id := by ++ rw [← sub_sub_self ψ θ] ++ refine WeakPNT''.sub_isLittleO ++ (IsBigO.trans_isLittleO (g := fun x ↦ 2 * x.sqrt * x.log) ?_ ?_) ++ · rw [isBigO_iff']; refine ⟨1, one_pos, ?_⟩ ++ simp only [one_mul, eventually_atTop] ++ exact ⟨2, fun x hx ↦ by ++ rw [Pi.sub_apply, norm_eq_abs, norm_eq_abs, abs_of_nonneg (by bound : 0 ≤ 2 * √x * log x)] ++ exact (abs_of_nonneg (sub_nonneg.mpr (Chebyshev.theta_le_psi x))).symm ▸ ++ Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log (by linarith : 1 ≤ x)⟩ ++ · convert isLittleO_sqrt_mul_log.const_mul_left 2 using 1 <;> first | rfl | (funext x; ring) ++ ++end CatalanPNT +diff --git a/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaContinuation.lean b/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaContinuation.lean +new file mode 100644 +index 0000000..723a0e3 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaContinuation.lean +@@ -0,0 +1,92 @@ ++import PrimeNumberTheoremAnd.Catalan.OrdinaryZetaZeroFree ++import Mathlib.Analysis.Complex.RemovableSingularity ++ ++namespace CatalanPNT ++ ++noncomputable section ++ ++open Complex Filter Set ++open scoped Topology ++ ++namespace CatalanOrdinaryZeta ++ ++noncomputable def regularizedZeta : ℂ → ℂ := ++ Function.update (fun s ↦ (s - 1) * riemannZeta s) 1 1 ++ ++@[simp] theorem regularizedZeta_one : regularizedZeta 1 = 1 := by ++ simp only [regularizedZeta, Function.update_self] ++ ++theorem regularizedZeta_of_ne_one {s : ℂ} (hs : s ≠ 1) : ++ regularizedZeta s = (s - 1) * riemannZeta s := by ++ exact Function.update_of_ne hs .. ++ ++theorem regularizedZeta_ne_zero_at_one : regularizedZeta 1 ≠ 0 := by ++ rw [regularizedZeta_one] ++ exact one_ne_zero ++ ++theorem differentiable_regularizedZeta : Differentiable ℂ regularizedZeta := by ++ rw [← differentiableOn_univ, ++ ← differentiableOn_compl_singleton_and_continuousAt_iff (c := 1) Filter.univ_mem] ++ constructor ++ · refine DifferentiableOn.congr (f := fun s ↦ (s - 1) * riemannZeta s) ?_ ?_ ++ · intro s hs ++ exact ((differentiableAt_id.sub_const 1).mul ++ (differentiableAt_riemannZeta (Set.mem_sdiff_singleton.mp hs).2)).differentiableWithinAt ++ · intro s hs ++ exact regularizedZeta_of_ne_one (Set.mem_sdiff_singleton.mp hs).2 ++ · simpa only [regularizedZeta, continuousAt_update_same] using riemannZeta_residue_one ++ ++theorem deriv_regularizedZeta_of_ne_one {s : ℂ} (hs : s ≠ 1) : ++ deriv regularizedZeta s = ++ (s - 1) * deriv riemannZeta s + riemannZeta s := by ++ have hderiv : deriv regularizedZeta s = ++ deriv (fun w ↦ (w - 1) * riemannZeta w) s := by ++ refine eventuallyEq_iff_exists_mem.mpr ?_ |>.deriv_eq ++ exact ⟨_, isOpen_ne.mem_nhds hs, ++ fun _ hw ↦ regularizedZeta_of_ne_one (Set.mem_ofPred.mp hw)⟩ ++ rw [hderiv, deriv_fun_mul (by fun_prop) (differentiableAt_riemannZeta hs), ++ deriv_sub_const, deriv_id'', one_mul, add_comm] ++ ++theorem regularizedZeta_ne_zero_of_one_le_re {s : ℂ} (hs : 1 ≤ s.re) : ++ regularizedZeta s ≠ 0 := by ++ rcases eq_or_ne s 1 with rfl | hs₁ ++ · exact regularizedZeta_ne_zero_at_one ++ · rw [regularizedZeta_of_ne_one hs₁] ++ exact mul_ne_zero (sub_ne_zero.mpr hs₁) ++ (riemannZeta_ne_zero_of_one_le_re_of_ne_one hs hs₁) ++ ++noncomputable def vonMangoldtAux (s : ℂ) : ℂ := ++ -deriv regularizedZeta s / regularizedZeta s ++ ++theorem continuousOn_vonMangoldtAux : ++ ContinuousOn vonMangoldtAux {s | 1 ≤ s.re} := by ++ change ContinuousOn (fun s ↦ -deriv regularizedZeta s / regularizedZeta s) ++ {s | 1 ≤ s.re} ++ simp_rw [neg_div] ++ have h := differentiable_regularizedZeta ++ exact ((h.contDiff.continuous_deriv le_rfl).continuousOn.div ++ h.continuous.continuousOn fun s hs ↦ regularizedZeta_ne_zero_of_one_le_re hs).neg ++ ++theorem eqOn_vonMangoldtAux : ++ Set.EqOn vonMangoldtAux ++ (fun s ↦ LSeries (fun n ↦ (ArithmeticFunction.vonMangoldt n : ℂ)) s - 1 / (s - 1)) ++ {s | 1 < s.re} := by ++ intro s hs ++ change vonMangoldtAux s = ++ LSeries (fun n ↦ (ArithmeticFunction.vonMangoldt n : ℂ)) s - 1 / (s - 1) ++ have hs' : 1 < s.re := hs ++ have hs₁ : s ≠ 1 := by ++ rintro rfl ++ norm_num at hs' ++ have hz : riemannZeta s ≠ 0 := riemannZeta_ne_zero_of_one_lt_re hs' ++ unfold vonMangoldtAux ++ rw [deriv_regularizedZeta_of_ne_one hs₁, regularizedZeta_of_ne_one hs₁, ++ ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div hs'] ++ field_simp [sub_ne_zero.mpr hs₁, hz] ++ ring ++ ++end CatalanOrdinaryZeta ++ ++end ++ ++end CatalanPNT +diff --git a/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaZeroFree.lean b/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaZeroFree.lean +new file mode 100644 +index 0000000..e0f363f +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Catalan/OrdinaryZetaZeroFree.lean +@@ -0,0 +1,175 @@ ++import Mathlib.Analysis.SpecialFunctions.Complex.LogBounds ++import Mathlib.Analysis.Complex.Asymptotics ++import Mathlib.Analysis.Asymptotics.Lemmas ++import Mathlib.NumberTheory.EulerProduct.DirichletLSeries ++ ++namespace CatalanPNT ++ ++open Complex Asymptotics Filter ++open scoped Topology ++ ++namespace CatalanOrdinaryZeta ++ ++private lemma re_log_comb_nonneg' {a : ℝ} (ha₀ : 0 ≤ a) (ha₁ : a < 1) ++ {z : ℂ} (hz : ‖z‖ = 1) : ++ 0 ≤ 3 * (-log (1 - a)).re + 4 * (-log (1 - a * z)).re + ++ (-log (1 - a * z ^ 2)).re := by ++ have hac₀ : ‖(a : ℂ)‖ < 1 := by ++ simp only [Complex.norm_of_nonneg ha₀, ha₁] ++ have hac₁ : ‖a * z‖ < 1 := by rwa [norm_mul, hz, mul_one] ++ have hac₂ : ‖a * z ^ 2‖ < 1 := by rwa [norm_mul, norm_pow, hz, one_pow, mul_one] ++ rw [← ((hasSum_re <| hasSum_taylorSeries_neg_log hac₀).mul_left 3).add ++ ((hasSum_re <| hasSum_taylorSeries_neg_log hac₁).mul_left 4) |>.add ++ (hasSum_re <| hasSum_taylorSeries_neg_log hac₂) |>.tsum_eq] ++ refine tsum_nonneg fun n ↦ ?_ ++ simp only [← ofReal_pow, div_natCast_re, ofReal_re, mul_pow, mul_re, ofReal_im, ++ zero_mul, sub_zero] ++ rcases n.eq_zero_or_pos with rfl | hn ++ · simp ++ · simp only [← mul_div_assoc, ← add_div] ++ refine div_nonneg ?_ n.cast_nonneg ++ rw [← pow_mul, pow_mul', sq, mul_re, ← sq, ← sq, ← sq_norm_sub_sq_re, norm_pow, hz] ++ convert! (show 0 ≤ 2 * a ^ n * ((z ^ n).re + 1) ^ 2 by positivity) using 1 ++ ring ++ ++private lemma re_log_comb_nonneg {n : ℕ} (hn : 2 ≤ n) {x : ℝ} (hx : 1 < x) ++ (y : ℝ) : ++ 0 ≤ 3 * (-log (1 - (n : ℂ) ^ (-x : ℂ))).re + ++ 4 * (-log (1 - (n : ℂ) ^ (-(x + I * y)))).re + ++ (-log (1 - (n : ℂ) ^ (-(x + 2 * I * y)))).re := by ++ let a : ℝ := (n : ℝ) ^ (-x) ++ let z : ℂ := (n : ℂ) ^ (-(I * y)) ++ have hn₀ : (n : ℂ) ≠ 0 := by exact_mod_cast (show n ≠ 0 by omega) ++ have ha₀ : 0 ≤ a := by dsimp [a]; positivity ++ have ha₁ : a < 1 := by ++ dsimp [a] ++ rw [Real.rpow_neg (Nat.cast_nonneg n), inv_lt_one_iff₀] ++ exact .inr <| Real.one_lt_rpow (mod_cast one_lt_two.trans_le hn) <| zero_lt_one.trans hx ++ have hz : ‖z‖ = 1 := by ++ dsimp [z] ++ rw [← ofReal_natCast, norm_cpow_eq_rpow_re_of_pos (mod_cast by omega)] ++ simp only [neg_re, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, ++ mul_zero, sub_self, neg_zero, Real.rpow_zero] ++ have h₀ : (n : ℂ) ^ (-x : ℂ) = (a : ℂ) := by ++ dsimp [a] ++ simp only [ofReal_cpow n.cast_nonneg (-x), ofReal_natCast, ofReal_neg] ++ have h₁ : (n : ℂ) ^ (-(x + I * y)) = (a : ℂ) * z := by ++ dsimp [z] ++ rw [neg_add, cpow_add _ _ hn₀, h₀] ++ have h₂ : (n : ℂ) ^ (-(x + 2 * I * y)) = (a : ℂ) * z ^ 2 := by ++ dsimp [z] ++ rw [neg_add, cpow_add _ _ hn₀, h₀, ++ show -(2 * I * y) = (2 : ℕ) * -(I * y) by ring, cpow_nat_mul] ++ simpa only [h₀, h₁, h₂] using re_log_comb_nonneg' ha₀ ha₁ hz ++ ++private lemma summable_prime_log {s : ℂ} (hs : 1 < s.re) : ++ Summable (fun p : Nat.Primes ↦ -log (1 - (p : ℂ) ^ (-s))) := by ++ simpa only [riemannZetaSummandHom, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk] using! ++ (summable_riemannZetaSummand hs).of_norm.clog_one_sub.neg.subtype Nat.Prime ++ ++private lemma one_lt_re_one_add {x : ℝ} (hx : 0 < x) (y : ℝ) : ++ 1 < (1 + x : ℂ).re ∧ 1 < (1 + x + I * y).re ∧ ++ 1 < (1 + x + 2 * I * y).re := by ++ simp only [add_re, one_re, ofReal_re, lt_add_iff_pos_right, hx, mul_re, I_re, ++ zero_mul, I_im, ofReal_im, mul_zero, sub_self, add_zero, re_ofNat, im_ofNat, ++ mul_one, mul_im, and_self] ++ ++theorem norm_riemannZeta_product_ge_one {x : ℝ} (hx : 0 < x) (y : ℝ) : ++ 1 ≤ ‖riemannZeta (1 + x) ^ 3 * riemannZeta (1 + x + I * y) ^ 4 * ++ riemannZeta (1 + x + 2 * I * y)‖ := by ++ have ⟨h₀, h₁, h₂⟩ := one_lt_re_one_add hx y ++ have H₀ := summable_prime_log h₀ ++ have H₁ := summable_prime_log h₁ ++ have H₂ := summable_prime_log h₂ ++ have hsum₀ := (hasSum_re H₀.hasSum).summable.mul_left 3 ++ have hsum₁ := (hasSum_re H₁.hasSum).summable.mul_left 4 ++ have hsum₂ := (hasSum_re H₂.hasSum).summable ++ rw [← riemannZeta_eulerProduct_exp_log h₀, ← riemannZeta_eulerProduct_exp_log h₁, ++ ← riemannZeta_eulerProduct_exp_log h₂] ++ simp only [← exp_nat_mul, Nat.cast_ofNat, ← exp_add, norm_exp, add_re, mul_re, ++ re_ofNat, im_ofNat, zero_mul, sub_zero, Real.one_le_exp_iff] ++ rw [re_tsum H₀, re_tsum H₁, re_tsum H₂, ← tsum_mul_left, ← tsum_mul_left, ++ ← hsum₀.tsum_add hsum₁, ← (hsum₀.add hsum₁).tsum_add hsum₂] ++ simpa only [neg_add_rev, neg_re, ge_iff_le, add_re, one_re, ofReal_re, ++ ofReal_add, ofReal_one] using ++ tsum_nonneg (fun p : Nat.Primes ↦ re_log_comb_nonneg p.prop.two_le ++ (show 1 < 1 + x by linarith) y) ++ ++private lemma riemannZeta_isBigO_near_one_horizontal : ++ (fun x : ℝ ↦ riemannZeta (1 + x)) =O[𝓝[>] 0] fun x ↦ (1 : ℂ) / x := by ++ have : (fun w : ℂ ↦ riemannZeta (1 + w)) =O[𝓝[≠] 0] (1 / ·) := by ++ have H : Tendsto (fun w : ℂ ↦ w * riemannZeta (1 + w)) (𝓝[≠] 0) (𝓝 1) := by ++ convert! riemannZeta_residue_one.comp (f := fun w ↦ 1 + w) ?_ using 1 ++ · simp only [Function.comp_def, add_sub_cancel_left] ++ · simpa only [tendsto_iff_comap, Homeomorph.coe_addLeft, add_zero, ++ map_le_iff_le_comap] using ++ ((Homeomorph.addLeft (1 : ℂ)).map_punctured_nhds_eq 0).le ++ exact (isBigO_mul_iff_isBigO_div eventually_mem_nhdsWithin).mp <| H.isBigO_one ℂ ++ exact (isBigO_comp_ofReal_nhds_ne this).mono <| nhdsGT_le_nhdsNE 0 ++ ++private lemma one_add_I_mul_ne_one {y : ℝ} (hy : y ≠ 0) : 1 + I * y ≠ 1 := by ++ simpa only [ne_eq, add_eq_left, mul_eq_zero, I_ne_zero, ofReal_eq_zero, false_or] using hy ++ ++private lemma riemannZeta_isBigO_horizontal {y : ℝ} (hy : y ≠ 0) : ++ (fun x : ℝ ↦ riemannZeta (1 + x + I * y)) =O[𝓝[>] 0] ++ fun _ ↦ (1 : ℂ) := by ++ refine IsBigO.mono ?_ nhdsWithin_le_nhds ++ simp_rw [add_comm (1 : ℂ), add_assoc] ++ have := (differentiableAt_riemannZeta (one_add_I_mul_ne_one hy)).continuousAt ++ rw [← zero_add (1 + _)] at this ++ exact this.comp (f := fun x : ℝ ↦ x + (1 + I * y)) (x := 0) (by fun_prop) ++ |>.tendsto.isBigO_one ℂ ++ ++private lemma riemannZeta_isBigO_horizontal_of_eq_zero {y : ℝ} (hy : y ≠ 0) ++ (h : riemannZeta (1 + I * y) = 0) : ++ (fun x : ℝ ↦ riemannZeta (1 + x + I * y)) =O[𝓝[>] 0] ++ fun x : ℝ ↦ (x : ℂ) := by ++ simp_rw [add_comm (1 : ℂ), add_assoc] ++ have := (differentiableAt_riemannZeta (one_add_I_mul_ne_one hy)).hasDerivAt ++ rw [← zero_add (1 + _)] at this ++ simpa only [zero_add, h, sub_zero] using ++ (Complex.isBigO_comp_ofReal_nhds ++ (this.comp_add_const 0 _).differentiableAt.isBigO_sub) |>.mono nhdsWithin_le_nhds ++ ++private lemma riemannZeta_ne_zero_one_add_I_mul {t : ℝ} (ht : t ≠ 0) : ++ riemannZeta (1 + I * t) ≠ 0 := by ++ intro Hz ++ have ht₂ : 2 * t ≠ 0 := mul_ne_zero two_ne_zero ht ++ have help (x : ℝ) : ((1 / x) ^ 3 * x ^ 4 * 1 : ℂ) = x := by ++ rcases eq_or_ne x 0 with rfl | h ++ · rw [ofReal_zero, zero_pow (by omega), mul_zero, mul_one] ++ · rw [one_div, inv_pow, pow_succ _ 3, ← mul_assoc, ++ inv_mul_cancel₀ <| pow_ne_zero 3 (ofReal_ne_zero.mpr h), one_mul, mul_one] ++ have H₀ : (fun _ : ℝ ↦ (1 : ℝ)) =O[𝓝[>] 0] ++ fun x ↦ riemannZeta (1 + x) ^ 3 * riemannZeta (1 + x + I * t) ^ 4 * ++ riemannZeta (1 + x + 2 * I * t) := ++ IsBigO.of_bound' <| eventually_nhdsWithin_of_forall ++ fun _ hx ↦ (norm_one (α := ℝ)).symm ▸ (norm_riemannZeta_product_ge_one hx t) ++ have H := riemannZeta_isBigO_near_one_horizontal.pow 3 |>.mul <| ++ (riemannZeta_isBigO_horizontal_of_eq_zero ht Hz).pow 4 |>.mul <| ++ riemannZeta_isBigO_horizontal ht₂ ++ simp only [ofReal_mul, ofReal_ofNat, mul_left_comm I, ← mul_assoc, help] at H ++ replace H := (H₀.trans H).norm_right ++ simp only [norm_real] at H ++ exact isLittleO_irrefl (.of_forall (fun _ ↦ one_ne_zero)) <| ++ H.of_norm_right.trans_isLittleO <| isLittleO_id_one.mono nhdsWithin_le_nhds ++ ++theorem riemannZeta_ne_zero_of_re_eq_one_of_ne_one {s : ℂ} (hs : s.re = 1) ++ (hs₁ : s ≠ 1) : riemannZeta s ≠ 0 := by ++ have hs' : s = 1 + I * s.im := by ++ conv_lhs => rw [← re_add_im s, hs, ofReal_one, mul_comm] ++ have him : s.im ≠ 0 := by ++ intro h ++ apply hs₁ ++ rw [hs', h, ofReal_zero, mul_zero, add_zero] ++ exact hs'.symm ▸ riemannZeta_ne_zero_one_add_I_mul him ++ ++theorem riemannZeta_ne_zero_of_one_le_re_of_ne_one {s : ℂ} (hs : 1 ≤ s.re) ++ (hs₁ : s ≠ 1) : riemannZeta s ≠ 0 := by ++ rcases hs.eq_or_lt with h | h ++ · exact riemannZeta_ne_zero_of_re_eq_one_of_ne_one h.symm hs₁ ++ · exact _root_.riemannZeta_ne_zero_of_one_lt_re h ++ ++end CatalanOrdinaryZeta ++ ++end CatalanPNT +diff --git a/PrimeNumberTheoremAnd/Catalan/Wiener.lean b/PrimeNumberTheoremAnd/Catalan/Wiener.lean +new file mode 100644 +index 0000000..0a6b505 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Catalan/Wiener.lean +@@ -0,0 +1,582 @@ ++import PrimeNumberTheoremAnd.Catalan.WienerBounds ++ ++namespace CatalanPNT ++ ++open ZetaFivePNT ++ ++open _root_.Real BigOperators ArithmeticFunction MeasureTheory _root_.Filter Set FourierTransform LSeries ++ _root_.Asymptotics SchwartzMap ++open Complex hiding log ++open scoped Topology ++open scoped ContDiff ++open scoped ComplexConjugate ++ ++variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} ++ [RCLike 𝕜] ++ ++attribute [local gcongr] norm_lt_norm_of_nonneg ++ ++theorem limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := ++ limiting_cor_W21 ψ hf hcheby hG hG' ++ ++theorem fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by ++ refine ⟨𝓕⁻ f, ?_⟩ ++ exact FourierTransform.fourier_fourierInv_eq f ++ ++noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) ++ (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) := ++ h2.toSchwartzMap h1 ++ ++@[simp] theorem toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl ++ ++theorem comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ ∀ᶠ x in 𝓝 0, Ψ x = 0 := ++ notMem_tsupport_iff_eventuallyEq.mp (fun h => lt_irrefl 0 <| mem_Ioi.mp (hplus h)) ++ ++theorem comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ ∀ᶠ x in atBot, Ψ (exp x) = 0 := ++ Real.tendsto_exp_atBot <| comp_exp_support0 hplus ++ ++theorem comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : ++ ∀ᶠ (x : ℝ) in atTop, (Ψ ∘ rexp) x = 0 := by ++ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, ++ cocompact_eq_atBot_atTop] at hsupp ++ exact Real.tendsto_exp_atTop hsupp.2 ++ ++theorem comp_exp_support {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : HasCompactSupport (Ψ ∘ rexp) := by ++ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, ++ cocompact_eq_atBot_atTop] ++ exact ⟨comp_exp_support1 hplus, comp_exp_support2 hsupp⟩ ++ ++theorem wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) (x : ℝ) (hx : 0 < x) : ++ ∫ (u : ℝ) in Ioi (-Real.log x), ↑(rexp u) * Ψ (rexp u) = ∫ (y : ℝ) in Ioi (1 / x), Ψ y := by ++ have l1 : ContinuousOn rexp (Ici (-Real.log x)) := by fun_prop ++ have l2 : Tendsto rexp atTop atTop := Real.tendsto_exp_atTop ++ have l3 t (_ : t ∈ Ioi (-log x)) : HasDerivWithinAt rexp (rexp t) (Ioi t) t := ++ (Real.hasDerivAt_exp t).hasDerivWithinAt ++ have l4 : ContinuousOn Ψ (rexp '' Ioi (-Real.log x)) := by fun_prop ++ have l5 : IntegrableOn Ψ (rexp '' Ici (-Real.log x)) volume := ++ (l0.integrable_of_hasCompactSupport hsupp).integrableOn ++ have l6 : IntegrableOn (fun x ↦ rexp x • (Ψ ∘ rexp) x) (Ici (-Real.log x)) volume := by ++ refine (Continuous.integrable_of_hasCompactSupport (by fun_prop) ?_).integrableOn ++ change HasCompactSupport (rexp • (Ψ ∘ rexp)) ++ exact (comp_exp_support hsupp hplus).smul_left ++ have := MeasureTheory.integral_deriv_smul_comp_Ioi l1 l2 l3 l4 l5 l6 ++ simpa [Real.exp_neg, Real.exp_log hx] using this ++ ++theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ Tendsto (fun x ↦ (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ obtain ⟨ε, hε, hh⟩ := Metric.eventually_nhds_iff.mp <| comp_exp_support0 hplus ++ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eventually_gt_atTop ε⁻¹] with x hxε ++ have l1 : Integrable (indicator (Ioi x⁻¹) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi ++ have l2 : Integrable (indicator (Ioi 0) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi ++ simp_rw [← MeasureTheory.integral_indicator measurableSet_Ioi, ← mul_sub, ← integral_sub l1 l2] ++ simp only [mul_eq_zero, ofReal_eq_zero] ++ right ++ apply MeasureTheory.integral_eq_zero_of_ae ++ apply Eventually.of_forall ++ intro t ++ simp only [Pi.zero_apply] ++ have hε' : 0 < ε⁻¹ := by positivity ++ have hx : 0 < x := by linarith ++ have hx' : 0 < x⁻¹ := by positivity ++ have hεx : x⁻¹ < ε := (inv_lt_comm₀ hε hx).mp hxε ++ have l3 : Ioi 0 = Ioc 0 x⁻¹ ∪ Ioi x⁻¹ := by ++ ext t ; simp only [mem_Ioi, mem_union, mem_Ioc] ; constructor <;> intro h ++ · simp [h, le_or_gt] ++ · cases h with ++ | inl h => exact h.1 ++ | inr h => exact hx'.trans h ++ have l4 : Disjoint (Ioc 0 x⁻¹) (Ioi x⁻¹) := by simp ++ have l5 := Set.indicator_union_of_disjoint l4 Ψ ++ rw [l3, l5] ++ simp only ++ rw [add_comm, sub_add_cancel_left] ++ by_cases ht : t ∈ Ioc 0 x⁻¹ ++ · simp only [ht, indicator_of_mem, neg_eq_zero] ++ apply hh ; simp only [mem_Ioc, dist_zero_right, norm_eq_abs] at ht ⊢ ++ apply hεx.trans_le' ++ rw [abs_le] ; constructor <;> linarith ++ simp [ht] ++ ++theorem wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x - A * ∫ y in Set.Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ let h (x : ℝ) : ℂ := rexp (2 * π * x) * Ψ (exp (2 * π * x)) ++ have h1 : ContDiff ℝ ∞ h := by ++ have : ContDiff ℝ ∞ (fun x : ℝ => (rexp (2 * π * x))) := (contDiff_const.mul contDiff_id).exp ++ exact (contDiff_ofReal.comp this).mul (hsmooth.comp this) ++ have h2 : HasCompactSupport h := by ++ have hπ : 2 * π ≠ 0 := by simp [pi_ne_zero] ++ have hh : HasCompactSupport (fun x : ℝ => Ψ (rexp (2 * π * x))) := by ++ simpa only [Function.comp_def, smul_eq_mul] using ++ (comp_exp_support hsupp hplus).comp_smul hπ ++ change HasCompactSupport ++ ((fun x : ℝ => (rexp (2 * π * x) : ℂ)) * fun x : ℝ => Ψ (rexp (2 * π * x))) ++ exact hh.mul_left ++ obtain ⟨g, hg⟩ := fourier_surjection_on_schwartz (toSchwartz h h1 h2) ++ have l1 {y} (hy : 0 < y) : y * Ψ y = 𝓕 g (1 / (2 * π) * Real.log y) := by ++ rw [hg] ++ change (y : ℂ) * Ψ y = h (1 / (2 * π) * Real.log y) ++ have harg : 2 * π * (1 / (2 * π) * Real.log y) = Real.log y := by ++ rw [← mul_assoc, mul_one_div_cancel (mul_ne_zero (by norm_num) pi_ne_zero), one_mul] ++ dsimp only [h] ++ rw [harg, Real.exp_log hy] ++ have key := limiting_cor_schwartz g hf hcheby hG hG' ++ have l2 : ∀ᶠ x in atTop, ∑' (n : ℕ), f n / ↑n * 𝓕 g (1 / (2 * π) * Real.log (↑n / x)) = ++ ∑' (n : ℕ), f n * Ψ (↑n / x) / x := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ congr ; ext n ++ by_cases hn : n = 0 ++ · simp [hn, (comp_exp_support0 hplus).self_of_nhds] ++ rw [← l1 (by positivity)] ++ have : (n : ℂ) ≠ 0 := by simpa using hn ++ have : (x : ℂ) ≠ 0 := by simpa using hx.ne.symm ++ simp only [ofReal_div, ofReal_natCast] ++ field_simp ++ have l3 : ∀ᶠ x in atTop, ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 g (u / (2 * π)) = ++ ↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ congr 1 ++ rw [hg] ++ change (∫ u in Ici (-Real.log x), h (u / (2 * π))) = ∫ y in Ioi x⁻¹, Ψ y ++ dsimp only [h] ++ have hscale : (2 : ℝ) * π ≠ 0 := mul_ne_zero (by norm_num) pi_ne_zero ++ have harg (u : ℝ) : 2 * π * (u / (2 * π)) = u := mul_div_cancel₀ u hscale ++ simp_rw [harg] ++ rw [MeasureTheory.integral_Ici_eq_integral_Ioi] ++ simpa only [one_div] using wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx ++ have l4 : Tendsto (fun x => (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ exact wiener_ikehara_smooth_sub (hsmooth.continuous.integrable_of_hasCompactSupport hsupp) hplus ++ simpa [tsum_div_const] using (key.congr' <| EventuallyEq.sub l2 l3) |>.add l4 ++ ++theorem wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := ++ tendsto_sub_nhds_zero_iff.mp <| wiener_ikehara_smooth hf hcheby hG hG' hsmooth hsupp hplus ++ ++local instance coeRealFunctionComplex {E : Type*} : Coe (E → ℝ) (E → ℂ) := ++ ⟨fun f n => f n⟩ ++ ++@[norm_cast] ++theorem set_integral_ofReal {f : ℝ → ℝ} {s : Set ℝ} : ∫ x in s, (f x : ℂ) = ∫ x in s, f x := ++ integral_ofReal ++ ++theorem wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := by ++ let Ψ' := ofReal ∘ Ψ ++ have l1 : ContDiff ℝ ∞ Ψ' := contDiff_ofReal.comp hsmooth ++ have l2 : HasCompactSupport Ψ' := hsupp.comp_left rfl ++ have l3 : closure (Function.support Ψ') ⊆ Ioi 0 := by rwa [Function.support_comp_eq] ; simp ++ have key := (continuous_re.tendsto _).comp ++ (@wiener_ikehara_smooth' A Ψ G f hf hcheby hG hG' l1 l2 l3) ++ simp at key ; norm_cast at key ++ ++theorem interval_approx_inf (ha : 0 < a) (hab : a < b) : ++ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ ++ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ ++ ψ ≤ indicator (Ico a b) 1 ∧ b - a - ε ≤ ∫ y in Ioi 0, ψ y := by ++ have l1 : Iio ((b - a) / 3) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds <| by ++ rw [← sub_pos] at hab ++ positivity ++ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < (b - a) / 3) ++ have l2 : a < a + ε / 2 := by simp [hε] ++ have l3 : b - ε / 2 < b := by simp [hε] ++ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 ++ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ ++ · simp [h5, hab.ne, Icc_subset_Ioi_iff hab.le, ha] ++ · exact h4.trans <| indicator_le_indicator_of_subset Ioo_subset_Ico_self (by simp) ++ · have l4 : 0 ≤ b - a - ε := by linarith ++ have l5 : Icc (a + ε / 2) (b - ε / 2) ⊆ Ioi 0 := by ++ intro t ht ++ simp only [mem_Icc, mem_Ioi] at ht ⊢ ++ exact ha.trans <| l2.trans_le <| ht.1 ++ have l6 : Icc (a + ε / 2) (b - ε / 2) ∩ Ioi 0 = Icc (a + ε / 2) (b - ε / 2) := ++ inter_eq_left.mpr l5 ++ have l7 : ∫ y in Ioi 0, indicator (Icc (a + ε / 2) (b - ε / 2)) 1 y = b - a - ε := by ++ simp only [measurableSet_Icc, integral_indicator_one, measureReal_restrict_apply, l6, ++ volume_real_Icc] ++ convert max_eq_left l4 using 1 ; ring_nf ++ have l8 : IntegrableOn ψ (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ rw [← l7] ; apply setIntegral_mono ?_ l8 h3 ++ rw [IntegrableOn, integrable_indicator_iff measurableSet_Icc] ++ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self ++ apply integrableOn_const <;> ++ simp ++ ++theorem interval_approx_sup (ha : 0 < a) (hab : a < b) : ++ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ ++ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ ++ indicator (Ico a b) 1 ≤ ψ ∧ ∫ y in Ioi 0, ψ y ≤ b - a + ε := by ++ have l1 : Iio (a / 2) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds (by linarith) ++ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < a / 2) ++ have l2 : a - ε / 2 < a := by linarith ++ have l3 : b < b + ε / 2 := by linarith ++ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 ++ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ ++ · have l4 : a - ε / 2 < b + ε / 2 := by linarith ++ have l5 : ε / 2 < a := by linarith ++ simp [h5, l4.ne, Icc_subset_Ioi_iff l4.le, l5] ++ · apply le_trans ?_ h3 ++ apply indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp) ++ · have l4 : 0 ≤ b - a + ε := by linarith ++ have l5 : Ioo (a - ε / 2) (b + ε / 2) ⊆ Ioi 0 := by intro t ht ; simp at ht ⊢ ; linarith ++ have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := ++ inter_eq_left.mpr l5 ++ have l7 : ∫ y in Ioi 0, indicator (Ioo (a - ε / 2) (b + ε / 2)) 1 y = b - a + ε := by ++ simp only [measurableSet_Ioo, integral_indicator_one, measureReal_restrict_apply, l6, ++ volume_real_Ioo] ++ convert max_eq_left l4 using 1 ; ring_nf ++ have l8 : IntegrableOn ψ (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ rw [← l7] ++ refine setIntegral_mono l8 ?_ h4 ++ rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo] ++ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self ++ apply integrableOn_const <;> ++ simp ++ ++theorem WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : ++ Summable (fun n => f n * g (n / x)) := by ++ obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure ++ apply summable_of_hasFiniteSupport ++ unfold Function.HasFiniteSupport ++ simp only [Function.support_mul] ; apply Finite.inter_of_right ; rw [finite_iff_bddAbove] ++ exact ⟨Nat.ceil (M * x), fun i hi => by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ ++ ++theorem WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) ++ (hg₁ : HasCompactSupport g₁) (hg₂ : HasCompactSupport g₂) : ++ (∑' n, f n * g₁ (n / x)) / x ≤ (∑' n, f n * g₂ (n / x)) / x := by ++ apply div_le_div_of_nonneg_right ?_ hx.le ++ exact Summable.tsum_le_tsum (fun n => mul_le_mul_of_nonneg_left (hg _) (hf _)) ++ (WI_summable hg₁ hx) (WI_summable hg₂ hx) ++ ++theorem WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hb : 0 < b) (hxb : 2 / b < x) : ++ (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by ++ have hb' : 0 < 2 / b := by positivity ++ have hx : 0 < x := by linarith ++ have hxb' : 2 < x * b := (div_lt_iff₀ hb).mp hxb ++ have l1 (i : ℕ) (hi : i ∉ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) = 0 := by ++ simp_all [le_div_iff₀ hx] ++ have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : ++ f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by ++ rw [abs_eq_self.mpr (hpos _)] ++ convert_to _ ≤ f i * 1 ++ · ring ++ apply mul_le_mul_of_nonneg_left ?_ (hpos _) ++ by_cases hi : (i / x) ∈ (Ico a b) <;> simp [hi] ++ rw [tsum_eq_sum l1, div_le_iff₀ hx, mul_assoc, mul_assoc] ++ apply Finset.sum_le_sum l2 |>.trans ++ have := hcheby ⌈b * x⌉₊ ; simp only [norm_real, norm_eq_abs] at this ; apply this.trans ++ have : 0 ≤ C := by have := hcheby 1 ; simp only [cumsum, Finset.range_one, norm_real, ++ Finset.sum_singleton, Nat.cast_one, mul_one] at this ; exact (abs_nonneg _).trans this ++ refine mul_le_mul_of_nonneg_left ?_ this ++ apply (Nat.ceil_lt_add_one (by positivity)).le.trans ++ linarith ++ ++theorem WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hb : 0 < b) : ++ ∀ᶠ x : ℝ in atTop, (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by ++ filter_upwards [eventually_gt_atTop (2 / b)] with x hx using WI_sum_Iab_le hpos hcheby hb hx ++ ++theorem le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by ++ exact ge_of_tendsto ++ (show Tendsto (fun c : ℝ => c) (𝓝[>] b) (𝓝 b) from nhdsWithin_le_nhds) h ++ ++theorem ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by ++ exact le_of_tendsto ++ (show Tendsto (fun c : ℝ => c) (𝓝[<] b) (𝓝 b) from nhdsWithin_le_nhds) h ++ ++theorem WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : ++ Tendsto (fun c => c / A - (b - a)) (𝓝[>] (A * (b - a))) (𝓝[>] 0) := by ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨A * ε, by positivity, ?_⟩ ++ intro x hx1 hx2 ++ constructor ++ · simpa [lt_div_iff₀' hA] ++ · simp only [Real.dist_eq, dist_zero_right, Real.norm_eq_abs] at hx2 ⊢ ++ have : |x / A - (b - a)| = |x - A * (b - a)| / A := by ++ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp ++ rwa [this, div_lt_iff₀' hA] ++ ++theorem WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : ++ Tendsto (fun c => (b - a) - c / A) (𝓝[<] (A * (b - a))) (𝓝[>] 0) := by ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨A * ε, by positivity, ?_⟩ ++ intro x hx1 hx2 ++ constructor ++ · simpa [div_lt_iff₀' hA] ++ · simp only [Real.dist_eq, dist_zero_right, norm_eq_abs] at hx2 ⊢ ++ have : |(b - a) - x / A| = |A * (b - a) - x| / A := by ++ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp ++ rwa [this, div_lt_iff₀' hA, ← neg_sub, abs_neg] ++ ++theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : ++ 0 ≤ A := by ++ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x ++ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by ++ filter_upwards [eventually_ge_atTop 0] with x hx ++ exact div_nonneg (tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _))) hx ++ obtain ⟨ε, ψ, h1, h2, h3, h4, -⟩ := (interval_approx_sup zero_lt_one one_lt_two).exists ++ have key := @wiener_ikehara_smooth_real A G f ψ hf hcheby hG hG' h1 h2 h3 ++ have l2 : 0 ≤ ψ := by apply le_trans _ h4 ; apply indicator_nonneg ; simp ++ have l1 : ∀ᶠ x in atTop, 0 ≤ S ψ x := hSnonneg l2 ++ have l3 : 0 ≤ A * ∫ (y : ℝ) in Ioi 0, ψ y := ge_of_tendsto key l1 ++ have l4 : 0 < ∫ (y : ℝ) in Ioi 0, ψ y := by ++ have r1 : 0 ≤ᵐ[Measure.restrict volume (Ioi 0)] ψ := Eventually.of_forall l2 ++ have r2 : IntegrableOn (fun y ↦ ψ y) (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ have r3 : Ico 1 2 ⊆ Function.support ψ := by ++ intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith ++ have r4 : Ico 1 2 ⊆ Function.support ψ ∩ Ioi 0 := by ++ simp only [subset_inter_iff, r3, ++ true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith ++ have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by ++ convert volume.mono r4 ; norm_num ++ simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using zero_lt_one.trans_le r5 ++ have := div_nonneg l3 l4.le ; field_simp at this ; exact this ++ ++theorem WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) ++ atTop (nhds (A * (b - a))) := by ++ ++ by_cases hab : a = b ++ · simp [hab] ++ replace hb : a < b := lt_of_le_of_ne hb hab ; clear hab ++ ++ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x ++ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by ++ filter_upwards [eventually_ge_atTop 0] with x hx ++ refine div_nonneg ?_ hx ++ refine tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _)) ++ have hA : 0 ≤ A := residue_nonneg hpos hf hcheby hG hG' ++ ++ let Iab : ℝ → ℝ := indicator (Ico a b) 1 ++ change Tendsto (S Iab) atTop (𝓝 (A * (b - a))) ++ have hIab : HasCompactSupport Iab := by ++ simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc ++ have Iab_nonneg : ∀ᶠ x : ℝ in atTop, 0 ≤ S Iab x := hSnonneg (indicator_nonneg (by simp)) ++ have Iab2 : IsBoundedUnder (· ≤ ·) atTop (S Iab) := by ++ obtain ⟨C, hC⟩ := hcheby ; exact ⟨C * 2 * b, WI_sum_Iab_le' hpos hC (by linarith)⟩ ++ have Iab3 : IsBoundedUnder (· ≥ ·) atTop (S Iab) := ⟨0, Iab_nonneg⟩ ++ have Iab0 : IsCoboundedUnder (· ≥ ·) atTop (S Iab) := Iab2.isCoboundedUnder_ge ++ have Iab1 : IsCoboundedUnder (· ≤ ·) atTop (S Iab) := Iab3.isCoboundedUnder_le ++ ++ have sup_le : limsup (S Iab) atTop ≤ A * (b - a) := by ++ have l_sup : ∀ᶠ ε in 𝓝[>] 0, limsup (S Iab) atTop ≤ A * (b - a + ε) := by ++ filter_upwards [interval_approx_sup ha hb] with ε happrox ++ rcases happrox with ⟨ψ, h1, h2, h3, h4, h6⟩ ++ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 ++ have l6 : S Iab ≤ᶠ[atTop] S ψ := by ++ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h4 hx hIab h2 ++ have l5 : IsBoundedUnder (· ≤ ·) atTop (S ψ) := l1.isBoundedUnder_le ++ have l3 : limsup (S Iab) atTop ≤ limsup (S ψ) atTop := limsup_le_limsup l6 Iab1 l5 ++ apply l3.trans ; rw [l1.limsup_eq] ; gcongr ++ obtain rfl | h := eq_or_ne A 0 ++ · simpa using l_sup ++ apply le_of_eventually_nhdsWithin ++ have key : 0 < A := lt_of_le_of_ne hA h.symm ++ filter_upwards [WI_tendsto_aux a b key l_sup] with x hx ++ simpa [mul_div_cancel₀ _ h] using hx ++ ++ have le_inf : A * (b - a) ≤ liminf (S Iab) atTop := by ++ have l_inf : ∀ᶠ ε in 𝓝[>] 0, A * (b - a - ε) ≤ liminf (S Iab) atTop := by ++ filter_upwards [interval_approx_inf ha hb] with ε happrox ++ rcases happrox with ⟨ψ, h1, h2, h3, h5, h6⟩ ++ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 ++ have l2 : S ψ ≤ᶠ[atTop] S Iab := by ++ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h5 hx h2 hIab ++ have l4 : IsBoundedUnder (· ≥ ·) atTop (S ψ) := l1.isBoundedUnder_ge ++ have l3 : liminf (S ψ) atTop ≤ liminf (S Iab) atTop := liminf_le_liminf l2 l4 Iab0 ++ apply le_trans ?_ l3 ; rw [l1.liminf_eq] ; gcongr ++ obtain rfl | h := eq_or_ne A 0 ++ · simpa using l_inf ++ apply ge_of_eventually_nhdsWithin ++ have key : 0 < A := lt_of_le_of_ne hA h.symm ++ filter_upwards [WI_tendsto_aux' a b key l_inf] with x hx ++ simpa [mul_div_cancel₀ _ h] using hx ++ ++ have : liminf (S Iab) atTop ≤ limsup (S Iab) atTop := liminf_le_limsup Iab2 Iab3 ++ refine tendsto_of_liminf_eq_limsup ?_ ?_ Iab2 Iab3 <;> linarith ++ ++theorem le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by ++ rw [div_le_iff₀ hx, Nat.le_floor_iff] ; positivity ++ ++theorem lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by ++ rw [div_lt_iff₀ hx, Nat.lt_ceil] ++ ++theorem ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by ++ rw [le_div_iff₀ hx, Nat.ceil_le] ++ ++theorem mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : ++ n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by ++ rw [Finset.mem_Icc, mem_Icc, ceil_mul_le_iff hx, le_floor_mul_iff hb hx] ++ ++theorem mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by ++ rw [Finset.mem_Ico, mem_Ico, ceil_mul_le_iff hx, lt_ceil_mul_iff hx] ++ ++theorem tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : ++ ∑' n, f n * (indicator (Ico a b) 1 (n / x)) = ∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n := by ++ have l1 : ∀ n ∉ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n * indicator (Ico a b) 1 (↑n / x) = 0 := by ++ simp [mem_Ico_iff_div hx] ; tauto ++ rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only ++ [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] ++ ++theorem WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) ++ atTop (nhds (A * (b - a))) := by ++ apply (WienerIkeharaInterval hpos hf hcheby hG hG' ha hb).congr' ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ rw [tsum_indicator hx] ++ ++theorem WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) ++ atTop (nhds (A * (b - a))) := ++ WienerIkeharaInterval_discrete hpos hf hcheby hG hG' ha hb |>.comp tendsto_natCast_atTop_atTop ++ ++theorem tendsto_mul_ceil_div : ++ Tendsto (fun (p : ℝ × ℕ) => ⌈p.1 * p.2⌉₊ / (p.2 : ℝ)) (𝓝[>] 0 ×ˢ atTop) (𝓝 0) := by ++ rw [Metric.tendsto_nhds] ; intro δ hδ ++ have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := ++ inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) ++ have l2 : ∀ᶠ N : ℕ in atTop, 1 ≤ δ / 2 * N := by ++ apply Tendsto.eventually_ge_atTop ++ exact tendsto_natCast_atTop_atTop.const_mul_atTop (by positivity) ++ filter_upwards [l1.prod_mk l2] with p hp ++ rcases p with ⟨ε, N⟩ ++ rcases hp with ⟨⟨hε, h1⟩, h2⟩ ++ dsimp only at * ++ have l3 : 0 < (N : ℝ) := by ++ simp only [Nat.cast_pos, Nat.pos_iff_ne_zero] ; rintro rfl ; simp [zero_lt_one.not_ge] at h2 ++ have l5 : 0 ≤ ε * ↑N := by positivity ++ have l6 : ε * N ≤ δ / 2 * N := mul_le_mul h1.le le_rfl (by positivity) (by positivity) ++ simp only [dist_zero_right, norm_div, RCLike.norm_natCast, div_lt_iff₀ l3, gt_iff_lt] ++ convert (Nat.ceil_lt_add_one l5).trans_le (add_le_add l6 h2) using 1 ; ring ++ ++noncomputable def S (f : ℕ → 𝕜) (ε : ℝ) (N : ℕ) : 𝕜 := (∑ n ∈ Finset.Ico ⌈ε * N⌉₊ N, f n) / N ++ ++theorem S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : ++ S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by ++ have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by ++ simp_rw [Finset.range_eq_Ico] ++ symm ++ apply Finset.Ico_union_Ico_eq_Ico (Nat.zero_le _) ++ simp only [Nat.ceil_le] ++ exact mul_le_of_le_one_left N.cast_nonneg hε ++ have r2 : Disjoint (Finset.range ⌈ε * N⌉₊) (Finset.Ico ⌈ε * N⌉₊ N) := by ++ rw [Finset.range_eq_Ico] ; apply Finset.Ico_disjoint_Ico_consecutive ++ simp [S, r1, Finset.sum_union r2, cumsum, add_div] ++ ++theorem tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ TendstoUniformlyOnFilter (S f) (S f 0) (𝓝[>] 0) atTop := by ++ rw [Metric.tendstoUniformlyOnFilter_iff] ; intro δ hδ ++ obtain ⟨C, hC⟩ := hcheby ++ have l1 : ∀ᶠ (p : ℝ × ℕ) in 𝓝[>] 0 ×ˢ atTop, C * ⌈p.1 * p.2⌉₊ / p.2 < δ := by ++ have r1 := tendsto_mul_ceil_div.const_mul C ++ simp only [mul_div_assoc', mul_zero] at r1 ; exact r1 (Iio_mem_nhds hδ) ++ have : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) ++ filter_upwards [l1, Eventually.prod_inl this _] with p h1 h2 ++ rcases p with ⟨ε, N⟩ ++ have l2 : ‖cumsum f ⌈ε * ↑N⌉₊ / ↑N‖ ≤ C * ⌈ε * N⌉₊ / N := by ++ have r1 := hC ⌈ε * N⌉₊ ++ have r2 : 0 ≤ cumsum f ⌈ε * N⌉₊ := by apply cumsum_nonneg hpos ++ simp only [norm_real, norm_of_nonneg (hpos _), norm_div, ++ norm_of_nonneg r2, Real.norm_natCast] at r1 ⊢ ++ apply div_le_div_of_nonneg_right r1 (by positivity) ++ simpa [dist_eq_norm, ← S_sub_S h2.2] using l2.trans_lt h1 ++ ++theorem WienerIkeharaTheorem' {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := by ++ convert_to Tendsto (S f 0) atTop (𝓝 A) ; · ext N ; simp [S, cumsum] ++ apply (tendsto_S_S_zero hpos hcheby).tendsto_of_eventually_tendsto ++ · have L0 : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) ++ apply eventually_of_mem L0 ++ · intro ε hε ++ convert WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 using 1 ++ funext N ++ simp only [S, one_mul, Nat.ceil_natCast] ++ · have : Tendsto (fun ε : ℝ => ε) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds ++ simpa using (this.const_sub 1).const_mul A ++ ++theorem vonMangoldt_cheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := by ++ use Real.log 4 + 4 ++ intro N ++ by_cases! h : N = 0 ++ · simp [h, cumsum] ++ simp only [cumsum, norm_real, norm_eq_abs] ++ rw [Nat.range_eq_Icc_zero_sub_one _ h, (by simp : N - 1 = ⌊(N : ℝ) - 1⌋₊)] ++ simp_rw [abs_of_nonneg vonMangoldt_nonneg] ++ rw [← Chebyshev.psi_eq_sum_Icc] ++ grw [Chebyshev.psi_le_const_mul_self <| sub_nonneg_of_le <| Nat.one_le_cast_iff_ne_zero.mpr h] ++ gcongr ++ linarith ++ ++theorem WeakPNT : Tendsto (fun N ↦ cumsum Λ N / N) atTop (𝓝 1) := by ++ let F : ℂ → ℂ := CatalanOrdinaryZeta.vonMangoldtAux ++ have l1 (n : ℕ) : 0 ≤ Λ n := vonMangoldt_nonneg ++ have l2 s (hs : 1 < s.re) : F s = LSeries Λ s - 1 / (s - 1) := by ++ exact CatalanOrdinaryZeta.eqOn_vonMangoldtAux hs ++ have l3 : ContinuousOn F {s | 1 ≤ s.re} := ++ CatalanOrdinaryZeta.continuousOn_vonMangoldtAux ++ have l4 : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := vonMangoldt_cheby ++ have l5 (σ' : ℝ) (hσ' : 1 < σ') : Summable (nterm Λ σ') := by ++ simpa only [← nterm_eq_norm_term] ++ using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm ++ apply WienerIkeharaTheorem' l1 l5 l4 l3 l2 ++ ++end CatalanPNT +diff --git a/PrimeNumberTheoremAnd/Catalan/WienerBounds.lean b/PrimeNumberTheoremAnd/Catalan/WienerBounds.lean +new file mode 100644 +index 0000000..06122cf +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Catalan/WienerBounds.lean +@@ -0,0 +1,582 @@ ++import PrimeNumberTheoremAnd.Catalan.WienerLimits ++ ++namespace CatalanPNT ++ ++open ZetaFivePNT ++ ++open _root_.Real BigOperators ArithmeticFunction MeasureTheory _root_.Filter Set FourierTransform LSeries ++ _root_.Asymptotics SchwartzMap ++open Complex hiding log ++open scoped Topology ++open scoped ContDiff ++open scoped ComplexConjugate ++ ++variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} ++ [RCLike 𝕜] ++ ++attribute [local gcongr] norm_lt_norm_of_nonneg ++ ++theorem smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, ++ (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ ++ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 := by ++ obtain ⟨ψ, l1, l2, l3, l4, -⟩ := smooth_urysohn_support_Ioo h1 h3 ++ refine ⟨ψ, l1, l2, l3, l4⟩ ++ ++noncomputable def compactTruncation : trunc := by ++ choose ψ h1 h2 h3 h4 using smooth_urysohn (-2) (-1) (1) (2) (by linarith) (by linarith) ++ exact ⟨⟨ψ, h1.of_le (by norm_cast), h2⟩, h3, h4⟩ ++ ++theorem one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by ++ cases n with ++ | zero => simp ++ | succ n => ++ cases n with ++ | zero => simp ++ | succ n => norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith ++ ++noncomputable def pp (a x : ℝ) : ℝ := a ^ 2 * (x + 1) ^ 2 + (1 - a) * (1 + a) ++ ++noncomputable def pp' (a x : ℝ) : ℝ := a ^ 2 * (2 * (x + 1)) ++ ++theorem pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by ++ simp only [pp] ++ have : 0 < 1 - a := by linarith [ha.2] ++ have : 0 < 1 + a := by linarith [ha.1] ++ positivity ++ ++theorem pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by ++ unfold pp pp' ++ simpa using hasDerivAt_id x |>.add_const 1 |>.pow 2 |>.const_mul _ ++ ++theorem pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by ++ ext x ; exact pp_deriv a x |>.deriv ++ ++theorem pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by ++ change HasDerivAt (fun y : ℝ => a ^ 2 * (2 * (y + 1))) (a ^ 2 * 2) x ++ convert hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) ++ using 1 <;> first | rfl | ring ++ ++theorem pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by ++ ext x ; exact pp'_deriv a x |>.deriv ++ ++noncomputable def hh (a t : ℝ) : ℝ := (t * (1 + (a * log t) ^ 2))⁻¹ ++ ++noncomputable def hh' (a t : ℝ) : ℝ := - pp a (log t) * hh a t ^ 2 ++ ++theorem hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity ++ ++theorem hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by ++ by_cases h0 : t = 0 ++ · simp [hh, h0] ++ replace ht : 0 < t := lt_of_le_of_ne ht (by tauto) ++ unfold hh ++ rw [abs_inv, inv_le_inv₀ (by positivity) ht, abs_mul, abs_eq_self.mpr ht.le] ++ convert_to t * 1 ≤ _ ++ · simp ++ apply mul_le_mul le_rfl ?_ zero_le_one ht.le ++ rw [abs_eq_self.mpr (by positivity)] ++ simp only [le_add_iff_nonneg_right] ++ positivity ++ ++theorem hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by ++ have e1 : t * (1 + (a * log t) ^ 2) ≠ 0 := mul_ne_zero ht (_root_.ne_of_lt (by positivity)).symm ++ have l5 : HasDerivAt (fun t : ℝ => log t) t⁻¹ t := Real.hasDerivAt_log ht ++ have l4 : HasDerivAt (fun t : ℝ => a * log t) (a * t⁻¹) t := l5.const_mul _ ++ have l3 : HasDerivAt (fun t : ℝ => (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := by ++ convert l4.pow 2 using 1 ; ring ++ have l2 : HasDerivAt (fun t : ℝ => 1 + (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := ++ l3.const_add _ ++ have l1 : HasDerivAt (fun t : ℝ => t * (1 + (a * log t) ^ 2)) ++ (1 + 2 * a ^ 2 * log t + a ^ 2 * log t ^ 2) t := by ++ convert (hasDerivAt_id' t).mul l2 using 1; field_simp; ring ++ apply (l1.inv e1).congr_deriv ++ dsimp only [hh', pp, hh] ++ simp only [div_eq_mul_inv, inv_pow] ++ ring ++ ++theorem hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := ++ fun t (ht : 0 < t) => (hh_deriv a ht.ne.symm).continuousAt.continuousWithinAt ++ ++theorem hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by ++ have := pp_pos ha (log x) ++ simp only [hh', neg_mul, Left.neg_nonpos_iff, ge_iff_le] ++ positivity ++ ++theorem hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by ++ have l1 x (hx : x ∈ interior (Ioi 0)) : ++ HasDerivWithinAt (hh a) (hh' a x) (interior (Ioi 0)) x := by ++ have : x ≠ 0 := by contrapose! hx ; simp [hx] ++ exact (hh_deriv a this).hasDerivWithinAt ++ apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) (hh_continuous _) l1 ++ (fun x _ => hh'_nonpos ha) ++ ++noncomputable def gg (x i : ℝ) : ℝ := 1 / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ++ ++theorem gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by ++ simp only [gg, hh] ++ field_simp ++ ++theorem gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by ++ simp only [gg_of_hh hx.ne.symm, one_div, mul_inv_rev, abs_mul] ++ apply mul_le_mul le_rfl (hh_le _ _ (by positivity)) (by positivity) (by positivity) |>.trans ++ (le_of_eq ?_) ++ simp [abs_inv, abs_eq_self.mpr hx.le] ; field_simp ++ ++theorem gg_le_one (i : ℕ) : gg x i ≤ 1 := by ++ by_cases hi : i = 0 <;> simp only [gg, hi, CharP.cast_eq_zero, div_zero, one_div, mul_inv_rev, ++ zero_div, Real.log_zero, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, ++ add_zero, inv_one, mul_one, zero_le_one] ++ have l1 : 1 ≤ (i : ℝ) := by simp ; omega ++ have l2 : 1 ≤ 1 + (π⁻¹ * 2⁻¹ * Real.log (↑i / x)) ^ 2 := by ++ simp only [le_add_iff_nonneg_right] ; positivity ++ rw [← mul_inv] ; apply inv_le_one_of_one_le₀ ; simpa using mul_le_mul l1 l2 zero_le_one (by simp) ++ ++theorem one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by ++ constructor ++ · trans 0 ++ · linarith ++ · positivity ++ · rw [div_lt_iff₀ (by positivity)] ++ convert_to 1 * 1 < 2 * π ++ · simp ++ · simp ++ apply mul_lt_mul one_lt_two ?_ zero_lt_one zero_le_two ++ trans 2 ++ · exact one_le_two ++ · exact two_le_pi ++ ++theorem cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ ∑ i ∈ Finset.range n, f i * g i ≤ g (n - 1) * (C * n) + (C * (↑(n - 1 - 1) + 1) * g 0 ++ - C * (↑(n - 1 - 1) + 1) * g (n - 1) - ++ ((n - 1 - 1) • (C * g 0) - ∑ x ∈ Finset.range (n - 1 - 1), C * g (x + 1))) := by ++ have l1 (n : ℕ) : ++ (g n - g (n + 1)) * ∑ i ∈ Finset.range (n + 1), f i ≤ (g n - g (n + 1)) * (C * (n + 1)) := by ++ apply mul_le_mul le_rfl (by simpa only [cumsum, Nat.cast_add, Nat.cast_one] using hf' (n + 1)) ++ (Finset.sum_nonneg (fun i _ => hf i)) ?_ ++ simp only [sub_nonneg] ; apply hg' ; simp ++ have l2 (x : ℕ) : C * (↑(x + 1) + 1) - C * (↑x + 1) = C := by simp ; ring ++ have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun i _ => hf i) ++ convert_to ∑ i ∈ Finset.range n, (g i) • (f i) ≤ _ ++ · simp [mul_comm] ++ rw [Finset.sum_range_by_parts, sub_eq_add_neg, ← Finset.sum_neg_distrib] ++ simp_rw [← neg_smul, neg_sub, smul_eq_mul] ++ apply _root_.add_le_add ++ · exact mul_le_mul le_rfl (hf' n) (l3 n) (hg _) ++ · apply Finset.sum_le_sum (fun n _ => l1 n) |>.trans ++ convert_to ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ ++ · congr ; ext i ; simp ; ring ++ rw [Finset.sum_range_by_parts] ++ simp_rw [Finset.sum_range_sub', l2, smul_sub, smul_eq_mul, Finset.sum_sub_distrib, ++ Finset.sum_const, Finset.card_range] ++ apply le_of_eq ; ring_nf ++ ++theorem sum_range_succ (a : ℕ → ℝ) (n : ℕ) : ++ ∑ i ∈ Finset.range n, a (i + 1) = (∑ i ∈ Finset.range (n + 1), a i) - a 0 := by ++ have := Finset.sum_range_sub a n ++ rw [Finset.sum_sub_distrib, sub_eq_iff_eq_add] at this ++ rw [Finset.sum_range_succ, this] ; ring ++ ++theorem cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ ∑ i ∈ Finset.range n, f i * g i ≤ ++ C * n * g (n - 1) ++ + C * cumsum g (n - 1 - 1 + 1) ++ - C * (↑(n - 1 - 1) + 1) * g (n - 1) ++ := by ++ have := cancel_aux hf hg hf' hg' n ++ simp only [nsmul_eq_mul, ← Finset.mul_sum, sum_range_succ] at this ++ convert this using 1 ; unfold cumsum ; ring ++ ++theorem cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) (hn : 2 ≤ n) : ++ cumsum (f * g) n ≤ C * cumsum g n := by ++ change (∑ i ∈ Finset.range n, f i * g i) ≤ C * cumsum g n ++ refine (cancel_aux' hf hg hf' hg' n).trans_eq ?_ ++ have hindex : n - 1 - 1 + 1 = n - 1 := by omega ++ have hcast : (n : ℝ) = ↑(n - 1) + 1 := by ++ exact_mod_cast (show n = (n - 1) + 1 by omega) ++ have hcast' : (↑(n - 1 - 1) : ℝ) + 1 = ↑(n - 1) := by ++ exact_mod_cast hindex ++ have hsum : cumsum g n = cumsum g (n - 1) + g (n - 1) := by ++ conv_lhs => rw [show n = (n - 1) + 1 by omega] ++ exact cumsum_succ (n - 1) ++ rw [hindex, hcast', hcast, hsum] ++ ring ++ ++theorem cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ cumsum (f * g) n ≤ C * cumsum g n := by ++ cases n with ++ | zero => simp [cumsum] ++ | succ n => ++ cases n with ++ | zero => ++ have hC : 0 ≤ C := by simpa [cumsum, hf0] using hf' 1 ++ simpa [cumsum, hf0] using mul_nonneg hC (hg 0) ++ | succ n => exact cancel_main hf hg hf' hg' (n + 2) (by omega) ++ ++theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneOn f (Ioc x₀ (x₀ + n))) ++ (hfi : IntegrableOn f (Icc x₀ (x₀ + n))) : ++ (∑ i ∈ Finset.range n, f (x₀ + ↑(i + 1))) ≤ ∫ x in x₀..x₀ + n, f x := by ++ cases n with simp only [Nat.cast_add, Nat.cast_one, CharP.cast_eq_zero, add_zero, ++ lt_self_iff_false, not_false_eq_true, ++ Ioc_eq_empty, Finset.range_zero, Nat.cast_add, Nat.cast_one, Finset.sum_empty, ++ intervalIntegral.integral_same, le_refl] at hf ⊢ ++ | succ n => ++ have : Finset.range (n + 1) = {0} ∪ Finset.Ico 1 (n + 1) := by ++ ext i ; by_cases hi : i = 0 <;> simp [hi] ; omega ++ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, ++ lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, and_true, not_false_eq_true, ++ Finset.sum_insert, CharP.cast_eq_zero, zero_add, ge_iff_le] ++ have l4 : IntervalIntegrable f volume x₀ (x₀ + 1) := by ++ apply IntegrableOn.intervalIntegrable ++ simp only [le_add_iff_nonneg_right, zero_le_one, uIcc_of_le] ++ apply hfi.mono_set ++ apply Icc_subset_Icc le_rfl ++ simp ++ have l5 x (hx : x ∈ Ioc x₀ (x₀ + 1)) : (fun x ↦ f (x₀ + 1)) x ≤ f x := by ++ rcases hx with ⟨hx1, hx2⟩ ++ refine hf ⟨hx1, by linarith⟩ ⟨by linarith, by linarith⟩ hx2 ++ have l6 : ∫ x in x₀..x₀ + 1, f (x₀ + 1) = f (x₀ + 1) := by simp ++ have l1 : f (x₀ + 1) ≤ ∫ x in x₀..x₀ + 1, f x := by ++ rw [← l6] ++ apply intervalIntegral.integral_mono_on_of_le_Ioo (by linarith) (by simp) l4 ++ intro x hx ++ exact l5 x ⟨hx.1, hx.2.le⟩ ++ have l2 : AntitoneOn (fun x ↦ f (x₀ + x)) (Icc 1 ↑(n + 1)) := by ++ intro u hu v hv huv ++ have hu1 := hu.1 ++ have hv2 := hv.2 ++ push_cast at hv2 ++ refine hf ⟨?_, ?_⟩ ⟨?_, ?_⟩ ?_ <;> linarith ++ have l3 := @AntitoneOn.sum_le_integral_Ico 1 (n + 1) (fun x => f (x₀ + x)) (by simp) ++ (by simpa using l2) ++ simp only [Nat.cast_add, Nat.cast_one, intervalIntegral.integral_comp_add_left] at l3 ++ convert _root_.add_le_add l1 l3 ++ have := @intervalIntegral.integral_comp_mul_add ℝ _ _ 1 (n + 1) 1 f one_ne_zero x₀ ++ rw [intervalIntegral.integral_add_adjacent_intervals] ++ · exact l4 ++ · apply IntegrableOn.intervalIntegrable ++ simp only [add_le_add_iff_left, le_add_iff_nonneg_left, Nat.cast_nonneg, uIcc_of_le] ++ apply hfi.mono_set ++ apply Icc_subset_Icc ++ · linarith ++ · simp ++ ++theorem hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ (IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0)) ∧ ++ (∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π) := by ++ rw [integrableOn_Ici_iff_integrableOn_Ioi] ++ simp only [hh] ++ let g (x : ℝ) := (a * c / b) * Real.arctan (b * log (x / c)) ++ let g₀ (x : ℝ) := if x = 0 then ((a * c / b) * (- (π / 2))) else g x ++ let g' (x : ℝ) := a * (x / c * (1 + (b * Real.log (x / c)) ^ 2))⁻¹ ++ have l3 (x) (hx : 0 < x) : HasDerivAt Real.log x⁻¹ x := by apply Real.hasDerivAt_log (by linarith) ++ have l4 (x) : HasDerivAt (fun t => t / c) (1 / c) x := (hasDerivAt_id x).div_const c ++ have l2 (x) (hx : 0 < x) : HasDerivAt (fun t => log (t / c)) x⁻¹ x := by ++ have hcomp := (l3 (x / c) (by positivity)).comp x (l4 x) ++ convert hcomp using 1 ++ · rfl ++ · field_simp [hc.ne', hx.ne'] ++ have l5 (x) (hx : 0 < x) := (l2 x hx).const_mul b ++ have l1 (x) (hx : 0 < x) := (l5 x hx).arctan ++ have l6 (x) (hx : 0 < x) : HasDerivAt g (g' x) x := by ++ convert (l1 x hx).const_mul (a * c / b) using 1 ++ simp only [g'] ++ field_simp ++ have key (x) (hx : 0 < x) : HasDerivAt g₀ (g' x) x := by ++ apply (l6 x hx).congr_of_eventuallyEq ++ apply eventually_of_mem <| Ioi_mem_nhds hx ++ intro y (hy : 0 < y) ++ simp [g₀, hy.ne.symm] ++ have k1 : Tendsto g₀ atTop (𝓝 ((a * c / b) * (π / 2))) := by ++ have : g =ᶠ[atTop] g₀ := by ++ apply eventually_of_mem (Ioi_mem_atTop 0) ++ intro y (hy : 0 < y) ++ simp [g₀, hy.ne.symm] ++ apply Tendsto.congr' this ++ apply Tendsto.const_mul ++ apply (tendsto_arctan_atTop.mono_right nhdsWithin_le_nhds).comp ++ apply Tendsto.const_mul_atTop hb ++ apply tendsto_log_atTop.comp ++ apply Tendsto.atTop_div_const hc ++ apply tendsto_id ++ have k2 : Tendsto g₀ (𝓝[>] 0) (𝓝 (g₀ 0)) := by ++ have : g =ᶠ[𝓝[>] 0] g₀ := by ++ apply eventually_of_mem self_mem_nhdsWithin ++ intro x (hx : 0 < x) ; simp [g₀, hx.ne.symm] ++ simp only [g₀] ++ apply Tendsto.congr' this ++ apply Tendsto.const_mul ++ apply (tendsto_arctan_atBot.mono_right nhdsWithin_le_nhds).comp ++ apply Tendsto.const_mul_atBot hb ++ apply tendsto_log_nhdsGT_zero.comp ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨c * ε, by positivity, fun x hx1 hx2 => ⟨?_, ?_⟩⟩ ++ · simp only [mem_Ioi] at hx1 ⊢ ; positivity ++ · simp only [dist_zero_right, norm_eq_abs, norm_div, abs_eq_self.mpr hc.le] at hx2 ⊢ ++ rwa [div_lt_iff₀ hc, mul_comm] ++ have k3 : ContinuousWithinAt g₀ (Ici 0) 0 := by ++ rw [Metric.continuousWithinAt_iff] ++ rw [Metric.tendsto_nhdsWithin_nhds] at k2 ++ intro ε hε ++ obtain ⟨δ, hδ, hδx⟩ := k2 ε hε ++ refine ⟨δ, hδ, ?_⟩ ++ intro x hx hdist ++ change 0 ≤ x at hx ++ rcases lt_or_eq_of_le hx with hx | hx ++ · exact hδx hx hdist ++ · subst x ++ simpa only [dist_self] using hε ++ have k4 : ∀ x ∈ Ioi 0, 0 ≤ g' x := by ++ intro x (hx : 0 < x) ; simp only [mul_inv_rev, inv_div, g'] ; positivity ++ constructor ++ · convert_to IntegrableOn g' _ ++ exact integrableOn_Ioi_deriv_of_nonneg k3 key k4 k1 ++ · have := integral_Ioi_of_hasDerivAt_of_nonneg k3 key k4 k1 ++ simp only [mul_inv_rev, inv_div, mul_neg, ↓reduceIte, sub_neg_eq_add, g', g₀] at this ⊢ ++ convert this using 1 ; field_simp ; ring ++ ++theorem hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0) := ++ hh_integrable_aux ha hb hc |>.1 ++ ++theorem hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ ∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π := ++ hh_integrable_aux ha hb hc |>.2 ++ ++theorem hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by ++ have := hh_integral (a := 1) (b := 1 / (2 * π)) (c := 1) ++ (by positivity) (by positivity) (by positivity) ++ convert this using 1 <;> simp ; ring ++ ++theorem bound_sum_log {C : ℝ} (hf0 : f 0 = 0) ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ ++ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by ++ let ggg (i : ℕ) : ℝ := if i = 0 then 1 else gg x i ++ have l0 : x ≠ 0 := by linarith ++ have l1 i : 0 ≤ ggg i := by by_cases hi : i = 0 <;> simp only [gg, one_div, mul_inv_rev, hi, ++ ↓reduceIte, zero_le_one, ggg] ; positivity ++ have l2 : Antitone ggg := by ++ intro i j hij ; by_cases hi : i = 0 <;> by_cases hj : j = 0 <;> simp only [hj, ↓reduceIte, hi, ++ le_refl, ggg] ++ · exact gg_le_one _ ++ · omega ++ · simp only [gg_of_hh l0] ++ gcongr ++ apply hh_antitone one_div_two_pi_mem_Ioo ++ · simp only [mem_Ioi] ; positivity ++ · simp only [mem_Ioi] ; positivity ++ · gcongr ++ have l3 : 0 ≤ C := by simpa [cumsum, hf0] using hf 1 ++ have l4 : 0 ≤ ∫ (t : ℝ) in Ioi 0, hh (π⁻¹ * 2⁻¹) t := ++ setIntegral_nonneg measurableSet_Ioi (fun x hx => hh_nonneg _ (LT.lt.le hx)) ++ have l5 {n : ℕ} : AntitoneOn (fun t ↦ x⁻¹ * hh (1 / (2 * π)) (t / x)) (Ioc 0 n) := by ++ intro u hu v hv huv ++ have hu1 := hu.1 ++ have hv1 := hv.1 ++ simp only ++ apply mul_le_mul le_rfl ?_ (hh_nonneg _ (by positivity)) (by positivity) ++ apply hh_antitone one_div_two_pi_mem_Ioo (by simp only [mem_Ioi] ; positivity) ++ (by simp only [mem_Ioi] ; positivity) ++ apply (div_le_div_iff_of_pos_right (by positivity)).mpr huv ++ have l6 {n : ℕ} : IntegrableOn (fun t ↦ x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (Icc 0 n) volume := by ++ apply IntegrableOn.mono_set ++ (hh_integrable (by positivity) (by positivity) (by positivity)) Icc_subset_Ici_self ++ apply Real.tsum_le_of_sum_range_le (fun n => by positivity) ; intro n ++ convert_to ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ ++ · congr ; ext i ++ by_cases hi : i = 0 ++ · simp [hi, hf0] ++ · simp only [gg, hi, ↓reduceIte, ggg] ++ field_simp ++ apply cancel_main' (fun _ => norm_nonneg _) (by simp [hf0]) l1 hf l2 n |>.trans ++ gcongr ; simp only [cumsum, gg_of_hh l0, one_div, mul_inv_rev, ggg] ++ by_cases hn : n = 0 ++ · simp only [hn, Finset.range_zero, Finset.sum_empty] ; positivity ++ replace hn : 0 < n := by omega ++ have : Finset.range n = {0} ∪ Finset.Ico 1 n := by ++ ext i ; simp ; by_cases hi : i = 0 <;> simp [hi, hn] ; omega ++ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, ++ false_and, not_false_eq_true, Finset.sum_insert, ↓reduceIte, add_le_add_iff_left, ge_iff_le] ++ convert_to ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ ++ · apply Finset.sum_congr rfl (fun i hi => ?_) ++ simp at hi ++ have : i ≠ 0 := by omega ++ simp [this] ++ simp_rw [Finset.sum_Ico_eq_sum_range, add_comm 1] ++ have := @sum_le_integral 0 (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (n - 1) ++ (by simpa using l5) (by simpa using l6) ++ simp only [zero_add] at this ++ apply this.trans ++ rw [@intervalIntegral.integral_comp_div ℝ _ _ 0 ↑(n - 1) x (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t)) l0] ++ simp only [zero_div, intervalIntegral.integral_const_mul, smul_eq_mul, ← mul_assoc, ++ mul_inv_cancel₀ l0, one_mul] ++ have : (0 : ℝ) ≤ ↑(n - 1) / x := by positivity ++ rw [intervalIntegral.intervalIntegral_eq_integral_uIoc] ++ simp only [this, ↓reduceIte, uIoc_of_le, smul_eq_mul, one_mul, ge_iff_le] ++ apply integral_mono_measure ++ · apply Measure.restrict_mono Ioc_subset_Ioi_self le_rfl ++ · apply eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) ++ intro x (hx : 0 < x) ++ apply hh_nonneg _ hx.le ++ · have h := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) ++ have h' := h.mono_set Ioi_subset_Ici_self ++ unfold IntegrableOn at h' ++ apply h'.congr ++ exact Eventually.of_forall (fun t => by simp) ++ ++theorem bound_sum_log0 {C : ℝ} ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ ++ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by ++ let f0 i := if i = 0 then 0 else f i ++ have l1 : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f0 k : ℂ)‖) n ≤ C * n) := by ++ intro n ; refine Finset.sum_le_sum (fun i _ => ?_) |>.trans (hf n) ++ by_cases hi : i = 0 <;> simp [hi, f0] ++ have l2 i : ‖f i‖ / i = ‖f0 i‖ / i := by by_cases hi : i = 0 <;> simp [hi, f0] ++ simp_rw [l2] ; apply bound_sum_log rfl l1 hx ++ ++theorem bound_sum_log' {C : ℝ} ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + 2 * π ^ 2) := by ++ simpa only [hh_integral'] using bound_sum_log0 hf hx ++ ++variable (f x) in ++theorem summable_fourier_aux (ψ : W21) (i : ℕ) : ++ ‖f i / i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (i / x))‖ ≤ ++ W21.norm ψ * (‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹) := by ++ convert mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) ++ (norm_nonneg (f i / i)) using 1 ++ · simp ++ · change _ = _ * (W21.norm ψ * _) ++ simp only [W21.norm, mul_inv_rev, one_div, Complex.norm_div, RCLike.norm_natCast] ++ ring ++ ++theorem summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by ++ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by ++ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) ++ have l6 := summable_fourier_aux x f ψ ++ exact Summable.of_nonneg_of_le (fun _ => norm_nonneg _) l6 ++ (by simpa using l5.const_smul (W21.norm ψ)) ++ ++theorem bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ ++ W21.norm ψ • ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ := by ++ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by ++ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) ++ have l6 := summable_fourier_aux x f ψ ++ have l1 : Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by ++ exact summable_fourier x hx ψ hcheby ++ apply (norm_tsum_le_tsum_norm l1).trans ++ change (∑' i, ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) ++ (1 / (2 * π) * Real.log (↑i / x))‖) ≤ W21.norm ψ * _ ++ rw [← tsum_mul_left] ++ exact Summable.tsum_mono l1 (l5.mul_left (W21.norm ψ)) l6 ++ ++theorem bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ ++ W21.norm ψ * C * (1 + 2 * π ^ 2) := by ++ apply bound_I1 x (by linarith) ψ ⟨_, hcheby⟩ |>.trans ++ rw [smul_eq_mul, mul_assoc] ++ apply mul_le_mul le_rfl (bound_sum_log' hcheby hx) ?_ W21.norm_nonneg ++ apply tsum_nonneg (fun i => by positivity) ++ ++theorem bound_I2 (x : ℝ) (ψ : W21) : ++ ‖∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ W21.norm ψ * (2 * π ^ 2) := by ++ have key a : ‖𝓕 (ψ : ℝ → ℂ) (a / (2 * π))‖ ≤ W21.norm ψ * (1 + (a / (2 * π)) ^ 2)⁻¹ := ++ decay_bounds_key ψ _ ++ have twopi : 0 ≤ 2 * π := by simp [pi_nonneg] ++ have l3 : Integrable (fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹) := ++ integrable_inv_one_add_sq.comp_div (by norm_num [pi_ne_zero]) ++ have l2 : IntegrableOn (fun i ↦ W21.norm ψ * (1 + (i / (2 * π)) ^ 2)⁻¹) (Ici (-Real.log x)) := by ++ exact (l3.const_mul _).integrableOn ++ have l1 : IntegrableOn (fun i ↦ ‖𝓕 (ψ : ℝ → ℂ) (i / (2 * π))‖) (Ici (-Real.log x)) := by ++ refine ((l3.const_mul (W21.norm ψ)).mono' ?_ ?_).integrableOn ++ · apply Continuous.aestronglyMeasurable ; fun_prop ++ · simp only [norm_norm, key] ; simp ++ have l5 : 0 ≤ᵐ[volume] fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹ := by ++ apply Eventually.of_forall ; intro x ; positivity ++ refine (norm_integral_le_integral_norm _).trans <| (setIntegral_mono l1 l2 key).trans ?_ ++ rw [integral_const_mul] ; gcongr ++ · apply W21.norm_nonneg ++ refine (setIntegral_le_integral l3 l5).trans ?_ ++ rw [Measure.integral_comp_div (fun x => (1 + x ^ 2)⁻¹) (2 * π)] ++ simp [abs_eq_self.mpr twopi] ; ring_nf ; rfl ++ ++theorem bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ ++ W21.norm ψ * (C * (1 + 2 * π ^ 2) + ‖A‖ * (2 * π ^ 2)) := by ++ have l1 := bound_I1' x hx ψ hcheby ++ have l2 := mul_le_mul (le_refl ‖A‖) (bound_I2 x ψ) (by positivity) (by positivity) ++ apply norm_sub_le _ _ |>.trans ; rw [norm_mul] ++ convert _root_.add_le_add l1 l2 using 1 ; ring ++ ++theorem limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by ++ ++ let S1 x (ψ : ℝ → ℂ) := ∑' (n : ℕ), f n / ↑n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑n / x)) ++ let S2 x (ψ : ℝ → ℂ) := ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) ++ let S x ψ := S1 x ψ - S2 x ψ ; change Tendsto (fun x ↦ S x ψ) atTop (𝓝 0) ++ ++ obtain g := compactTruncation ++ let Ψ R := g.scale R * ψ ++ have key R : Tendsto (fun x ↦ S x (Ψ R)) atTop (𝓝 0) := limiting_cor (Ψ R) hf hcheby hG hG' ++ ++ obtain ⟨C, hcheby⟩ := hcheby ++ have hC : 0 ≤ C := by ++ have : ‖f 0‖ ≤ C := by simpa [cumsum] using hcheby 1 ++ have : 0 ≤ ‖f 0‖ := by positivity ++ linarith ++ have key2 : Tendsto (fun R ↦ W21.norm (ψ - Ψ R)) atTop (𝓝 0) := W21_approximation ψ g ++ simp_rw [Metric.tendsto_nhds] at key key2 ⊢ ; intro ε hε ++ let M := C * (1 + 2 * π ^ 2) + ‖(A : ℂ)‖ * (2 * π ^ 2) ++ obtain ⟨R, hRψ⟩ := (key2 ((ε / 2) / (1 + M)) (by positivity)).exists ++ simp only [dist_zero_right, Real.norm_eq_abs, abs_eq_self.mpr W21.norm_nonneg] at hRψ key ++ ++ filter_upwards [eventually_ge_atTop 1, key R (ε / 2) (by positivity)] with x hx key ++ ++ have key3 : ‖S x (ψ - Ψ R)‖ < ε / 2 := by ++ have hbound := @bound_main f C A x hx (ψ - Ψ R) hcheby ++ change ‖S x (⇑ψ - ⇑(Ψ R))‖ ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * M at hbound ++ apply hbound.trans_lt ++ calc ++ W21.norm (⇑ψ - ⇑(Ψ R)) * M ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * (1 + M) := ++ mul_le_mul_of_nonneg_left (by linarith) W21.norm_nonneg ++ _ < ε / 2 := (lt_div_iff₀ (show 0 < 1 + M by positivity)).mp hRψ ++ ++ have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := ++ F_sub ψ.hf (Ψ R : W21).hf x ++ have S1_sub : S1 x (ψ - Ψ R) = S1 x ψ - S1 x (Ψ R) := by ++ simp only [one_div, mul_inv_rev, S1_sub_1, mul_sub, S1] ; apply Summable.tsum_sub ++ · have := summable_fourier x (by positivity) ψ ⟨_, hcheby⟩ ++ rw [summable_norm_iff] at this ++ simpa using this ++ · have hsum := summable_fourier x (by positivity) (Ψ R : W21) ⟨_, hcheby⟩ ++ rw [summable_norm_iff] at hsum ++ simpa only [W21.ofCS2, one_div, mul_inv_rev] using hsum ++ have S2_sub : S2 x (ψ - Ψ R) = S2 x ψ - S2 x (Ψ R) := by ++ simp only [S1_sub_1, S2] ; rw [integral_sub] ++ · ring ++ · exact CatalanPNT.W21.integrable_fourier ψ (by positivity) |>.restrict ++ · exact CatalanPNT.W21.integrable_fourier (Ψ R : W21) (by positivity) |>.restrict ++ have S_sub : S x (ψ - Ψ R) = S x ψ - S x (Ψ R) := by simp [S, S1_sub, S2_sub] ; ring ++ simpa [S_sub, Ψ] using norm_add_le _ _ |>.trans_lt (_root_.add_lt_add key3 key) ++ ++end CatalanPNT +diff --git a/PrimeNumberTheoremAnd/Catalan/WienerFourier.lean b/PrimeNumberTheoremAnd/Catalan/WienerFourier.lean +new file mode 100644 +index 0000000..491332b +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Catalan/WienerFourier.lean +@@ -0,0 +1,332 @@ ++import Mathlib.Analysis.Fourier.RiemannLebesgueLemma ++import Mathlib.Analysis.Normed.Group.Tannery ++import Mathlib.Analysis.SumIntegralComparisons ++import Mathlib.NumberTheory.Chebyshev ++import PrimeNumberTheoremAnd.Catalan.OrdinaryZetaContinuation ++import Mathlib.NumberTheory.MulChar.Lemmas ++import PrimeNumberTheoremAnd.ZetaFive.Fourier ++import PrimeNumberTheoremAnd.ZetaFive.SmoothExistence ++import Mathlib.Analysis.Convolution ++import Mathlib.MeasureTheory.Group.Circle ++ ++namespace CatalanPNT ++ ++open ZetaFivePNT ++ ++open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries ++ Asymptotics SchwartzMap ++open Complex hiding log ++open scoped Topology ++open scoped ContDiff ++open scoped ComplexConjugate ++ ++variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} ++ [RCLike 𝕜] ++ ++noncomputable ++def nterm (f : ℕ → ℂ) (σ' : ℝ) (n : ℕ) : ℝ := if n = 0 then 0 else ‖f n‖ / n ^ σ' ++ ++theorem nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by ++ by_cases h : n = 0 <;> simp [nterm, term, h] ++ ++theorem norm_term_eq_nterm_re (s : ℂ) : ++ ‖term f s n‖ = nterm f (s.re) n := by ++ simpa only [nterm] using LSeries.norm_term_eq f s n ++ ++theorem hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : ++ ∑' i, (‖term f σ' i‖₊ : ENNReal) ≠ ⊤ := by ++ simp_rw [ENNReal.tsum_coe_ne_top_iff_summable_coe, ← norm_toNNReal] ++ norm_cast ++ apply Summable.toNNReal ++ convert hf σ' hσ with i ++ simp [nterm_eq_norm_term] ++ ++attribute [fun_prop] Real.continuous_fourierChar ++ ++theorem first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ ++ (‖fourierChar (-(u * ((1 : ℝ) / ((2 : ℝ) * π) * (n / x).log))) • ψ u‖ₑ : ENNReal) := by ++ fun_prop ++ ++theorem first_fourier_aux2a : ++ (2 : ℂ) * π * -(y * (1 / (2 * π) * Real.log ((n) / x))) = -(y * ((n) / x).log) := by ++ calc ++ _ = -(y * (((2 : ℂ) * π) / (2 * π) * Real.log ((n) / x))) := by ring ++ _ = _ := by rw [div_self (by norm_num), one_mul] ++ ++theorem first_fourier_aux2 (hx : 0 < x) (n : ℕ) : ++ term f σ' n * 𝐞 (-(y * (1 / (2 * π) * Real.log (n / x)))) • ψ y = ++ term f (σ' + y * I) n • (ψ y * x ^ (y * I)) := by ++ by_cases hn : n = 0 ++ · simp [term, hn] ++ simp only [term, hn, ↓reduceIte] ++ calc ++ _ = (f n * (cexp ((2 * π * -(y * (1 / (2 * π) * Real.log (n / x)))) * I) / ++ ↑((n : ℝ) ^ σ'))) • ψ y := by ++ rw [Circle.smul_def, fourierChar_apply, ofReal_cpow (by norm_num)] ++ simp only [one_div, mul_inv_rev, mul_neg, ofReal_neg, ofReal_mul, ofReal_ofNat, ofReal_inv, ++ neg_mul, smul_eq_mul, ofReal_natCast] ++ ring ++ _ = (f n * (x ^ (y * I) / n ^ (σ' + y * I))) • ψ y := by ++ congr 2 ++ have l1 : 0 < (n : ℝ) := by simpa using Nat.pos_iff_ne_zero.mpr hn ++ have l2 : (x : ℂ) ≠ 0 := by simp [hx.ne.symm] ++ have l3 : (n : ℂ) ≠ 0 := by simp [hn] ++ rw [Real.rpow_def_of_pos l1, Complex.cpow_def_of_ne_zero l2, Complex.cpow_def_of_ne_zero l3] ++ push_cast ++ simp_rw [← Complex.exp_sub] ++ congr 1 ++ rw [first_fourier_aux2a, Real.log_div l1.ne.symm hx.ne.symm] ++ push_cast ++ rw [Complex.ofReal_log hx.le] ++ ring ++ _ = _ := by simp ; group ++ ++theorem first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hsupp : Integrable ψ) (hx : 0 < x) (hσ : 1 < σ') : ++ ∑' n : ℕ, term f σ' n * (𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))) = ++ ∫ t : ℝ, LSeries f (σ' + t * I) * ψ t * x ^ (t * I) := by ++ calc ++ _ = ∑' n, term f σ' n * ∫ (v : ℝ), 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ simp only [Real.fourier_eq] ++ simp only [one_div, mul_inv_rev, RCLike.inner_apply', conj_trivial] ++ _ = ∑' n, ∫ (v : ℝ), term f σ' n * 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ simp [integral_const_mul] ++ _ = ∫ (v : ℝ), ∑' n, term f σ' n * 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ refine (integral_tsum ?_ ?_).symm ++ · refine fun _ ↦ AEMeasurable.aestronglyMeasurable ?_ ++ have := hsupp.aemeasurable ++ fun_prop ++ · simp only [enorm_mul] ++ simp_rw [lintegral_const_mul'' _ (first_fourier_aux1 hsupp.aemeasurable _)] ++ calc ++ _ = (∑' (i : ℕ), ‖term f σ' i‖ₑ) * ∫⁻ (a : ℝ), ‖ψ a‖ₑ ∂volume := by ++ simp [ENNReal.tsum_mul_right, enorm_eq_nnnorm] ++ _ ≠ ⊤ := ENNReal.mul_ne_top (hf_coe1 hf hσ) ++ (ne_top_of_lt hsupp.2) ++ _ = _ := by ++ congr 1; ext y ++ simp_rw [mul_assoc (LSeries _ _), ← smul_eq_mul (a := (LSeries _ _)), LSeries] ++ rw [← Summable.tsum_smul_const] ++ · simp_rw [first_fourier_aux2 hx] ++ · apply Summable.of_norm ++ convert hf σ' hσ with n ++ rw [norm_term_eq_nterm_re] ++ simp ++ ++@[continuity] ++theorem continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ ++ ++attribute [fun_prop] measurable_coe_nnreal_ennreal ++ ++theorem second_fourier_integrable_aux1a (hσ : 1 < σ') : ++ IntegrableOn (fun (x : ℝ) ↦ cexp (-((x : ℂ) * ((σ' : ℂ) - 1)))) (Ici (-Real.log x)) := by ++ norm_cast ++ suffices IntegrableOn (fun (x : ℝ) ↦ (rexp (-(x * (σ' - 1))))) (Ici (-x.log)) _ from this.ofReal ++ simp_rw [fun (a x : ℝ) ↦ (by ring : -(x * a) = -a * x)] ++ rw [integrableOn_Ici_iff_integrableOn_Ioi] ++ apply exp_neg_integrableOn_Ioi ++ linarith ++ ++theorem second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : ++ let ν : Measure (ℝ × ℝ) := (volume.restrict (Ici (-Real.log x))).prod volume ++ Integrable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • ++ (𝐞 (Multiplicative.ofAdd (-(a * (u / (2 * π))))) : ℂ) • ψ a) ν := by ++ intro ν ++ constructor ++ · apply Measurable.aestronglyMeasurable ++ change Measurable (fun p : ℝ × ℝ => ++ (rexp (-p.1 * (σ' - 1)) : ℂ) * ++ ((fourierChar (-(p.2 * (p.1 / (2 * π)))) : ℂ) * ψ p.2)) ++ fun_prop ++ · let f1 : ℝ → ENNReal := fun a1 ↦ ‖cexp (-(↑a1 * (↑σ' - 1)))‖ₑ ++ let f2 : ℝ → ENNReal := fun a2 ↦ ‖ψ a2‖ₑ ++ suffices ∫⁻ (a : ℝ × ℝ), f1 a.1 * f2 a.2 ∂ν < ⊤ by ++ simpa [hasFiniteIntegral_iff_enorm, enorm_eq_nnnorm, Function.uncurry] ++ refine (lintegral_prod_mul ?_ ?_).trans_lt ?_ <;> try fun_prop ++ exact ENNReal.mul_lt_top (second_fourier_integrable_aux1a hσ).2 hsupp.2 ++ ++theorem second_fourier_integrable_aux2 (hσ : 1 < σ') : ++ IntegrableOn (fun (u : ℝ) ↦ cexp ((1 - ↑σ' - ↑t * I) * ↑u)) (Ioi (-Real.log x)) := by ++ refine (integrable_norm_iff (Measurable.aestronglyMeasurable <| by fun_prop)).mp ?_ ++ suffices IntegrableOn (fun a ↦ rexp (-(σ' - 1) * a)) (Ioi (-x.log)) _ by simpa [Complex.norm_exp] ++ apply exp_neg_integrableOn_Ioi ++ linarith ++ ++theorem second_fourier_aux (hx : 0 < x) : ++ -(cexp (-((1 - ↑σ' - ↑t * I) * ↑(Real.log x))) / (1 - ↑σ' - ↑t * I)) = ++ ↑(x ^ (σ' - 1)) * (↑σ' + ↑t * I - 1)⁻¹ * ↑x ^ (↑t * I) := by ++ calc ++ _ = cexp (↑(Real.log x) * ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [← div_neg]; ring_nf ++ _ = (x ^ ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr (ne_of_gt hx)), Complex.ofReal_log hx.le] ++ _ = (x ^ ((σ' : ℂ) - 1)) * (x ^ (↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [Complex.cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt hx))] ++ _ = _ := by rw [ofReal_cpow hx.le]; push_cast; ring ++ ++theorem second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) ++ {x σ' : ℝ} (hx : 0 < x) (hσ : 1 < σ') : ++ ∫ u in Ici (-log x), Real.exp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = ++ (x^(σ' - 1) : ℝ) * ∫ t, (1 / (σ' + t * I - 1)) * ψ t * x^(t * I) ∂ volume := by ++ conv in ↑(rexp _) * _ => { rw [Real.fourier_real_eq, ← smul_eq_mul, ← integral_smul] } ++ rw [MeasureTheory.integral_integral_swap] ++ swap ++ · exact second_fourier_integrable_aux1 hcont hsupp hσ ++ rw [← integral_const_mul] ++ congr 1; ext t ++ simp_rw [Circle.smul_def, smul_eq_mul, Real.fourierChar_apply, ++ ← mul_assoc, integral_mul_const] ++ rw [mul_right_comm _ (ψ t) _] ++ congr 1 ++ push_cast ++ simp_rw [← Complex.exp_add] ++ have (u : ℝ) : ++ -↑u * (↑σ' - 1) + 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I = (1 - σ' - t * I) * u := calc ++ _ = -↑u * (↑σ' - 1) + (2 * ↑π) / (2 * ↑π) * -(↑t * ↑u) * I := by ring ++ _ = -↑u * (↑σ' - 1) + 1 * -(↑t * ↑u) * I := by rw [div_self (by norm_num)] ++ _ = _ := by ring ++ simp_rw [this] ++ let c : ℂ := (1 - ↑σ' - ↑t * I) ++ have : c ≠ 0 := by simp [Complex.ext_iff, c, sub_ne_zero.mpr hσ.ne] ++ let f' (u : ℝ) := cexp (c * u) ++ let f := fun (u : ℝ) ↦ (f' u) / c ++ have hderiv : ∀ u ∈ Ici (-Real.log x), HasDerivAt f (f' u) u := by ++ intro u _ ++ rw [show f' u = cexp (c * u) * (c * 1) / c by simp only [f']; field_simp] ++ exact (hasDerivAt_id' u).ofReal_comp.const_mul c |>.cexp.div_const c ++ have hf : Tendsto f atTop (𝓝 0) := by ++ apply tendsto_zero_iff_norm_tendsto_zero.mpr ++ suffices Tendsto (fun (x : ℝ) ↦ ‖cexp (c * ↑x)‖ / ‖c‖) atTop (𝓝 (0 / ‖c‖)) by ++ simpa [f, f'] using this ++ apply Filter.Tendsto.div_const ++ suffices Tendsto (· * (1 - σ')) atTop atBot by simpa [Complex.norm_exp, mul_comm (1 - σ'), c] ++ exact Tendsto.atTop_mul_const_of_neg (by linarith) fun ⦃s⦄ h ↦ h ++ rw [integral_Ici_eq_integral_Ioi, ++ integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (second_fourier_integrable_aux2 hσ) hf] ++ simpa [f, f'] using second_fourier_aux hx ++ ++theorem one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) ++ ++theorem decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by ++ have l1 : 0 < 1 + u ^ 2 := one_add_sq_pos _ ++ have l2 : 1 + u ^ 2 = ‖(1 : ℂ) + u ^ 2‖ := by ++ norm_cast ; simp only [Real.norm_eq_abs, abs_eq_self.2 l1.le] ++ have l3 : ‖1 / ((4 : ℂ) * ↑π ^ 2)‖ ≤ (4 * π ^ 2)⁻¹ := by simp ++ have key := fourierIntegral_self_add_deriv_deriv f u ++ simp only [Function.iterate_succ _ 1, Function.iterate_one, Function.comp_apply] at key ++ rw [F_sub f.hf (f.hf''.const_mul (1 / (4 * ↑π ^ 2)))] at key ++ rw [← div_eq_mul_inv, le_div_iff₀ l1, mul_comm, l2, ← norm_mul, key, sub_eq_add_neg] ++ apply norm_add_le _ _ |>.trans ++ change _ ≤ W21.norm _ ++ rw [norm_neg, F_mul, norm_mul, W21.norm] ++ gcongr <;> apply VectorFourier.norm_fourierIntegral_le_integral_norm ++ ++theorem decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) ++ (h : ∀ t, ‖f t‖ ≤ A * (1 + t ^ 2)⁻¹) : ++ ∫ t, ‖f t‖ ≤ π * A := by ++ have l1 : Integrable (fun x ↦ A * (1 + x ^ 2)⁻¹) := integrable_inv_one_add_sq.const_mul A ++ simp_rw [← integral_univ_inv_one_add_sq, mul_comm, ← integral_const_mul] ++ exact integral_mono (l1.mono' hf (Eventually.of_forall h)).norm l1 h ++ ++theorem decay_bounds_W21 (f : W21) (hA : ∀ t, ‖f t‖ ≤ A / (1 + t ^ 2)) ++ (hA' : ∀ t, ‖deriv (deriv f) t‖ ≤ A / (1 + t ^ 2)) (u) : ++ ‖𝓕 (f : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by ++ have l0 : 1 * (4 * π)⁻¹ * A = (4 * π ^ 2)⁻¹ * (π * A) := by field_simp ++ have l1 : ∫ (v : ℝ), ‖f v‖ ≤ π * A := by ++ apply decay_bounds_aux f.continuous.aestronglyMeasurable ++ simp_rw [← div_eq_mul_inv] ; exact hA ++ have l2 : ∫ (v : ℝ), ‖deriv (deriv f) v‖ ≤ π * A := by ++ apply decay_bounds_aux f.deriv.deriv.continuous.aestronglyMeasurable ++ simp_rw [← div_eq_mul_inv] ; exact hA' ++ apply decay_bounds_key f u |>.trans ++ change W21.norm _ * _ ≤ _ ++ simp_rw [W21.norm, div_eq_mul_inv, add_mul, l0] ; gcongr ++ ++theorem decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) ++ (hA' : ∀ t, ‖deriv^[2] ψ t‖ ≤ A / (1 + t ^ 2)) : ++ ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by ++ exact decay_bounds_W21 ψ hA hA' u ++ ++theorem decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by ++ have l1 : HasCompactSupport (fun u : ℝ => ((1 + u ^ 2) : ℝ) * ψ u) := by exact ψ.h2.mul_left ++ have := ψ.h1.continuous ++ obtain ⟨C, hC⟩ := l1.exists_bound_of_continuous (by fun_prop) ++ refine ⟨C, fun u => ?_⟩ ++ specialize hC u ++ simp only [norm_mul, Complex.norm_real, norm_of_nonneg (one_add_sq_pos u).le] at hC ++ rwa [le_div_iff₀' (one_add_sq_pos _)] ++ ++theorem decay_bounds_cor (ψ : W21) : ++ ∃ C : ℝ, ∀ u, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by ++ simpa only [div_eq_mul_inv] using ⟨_, decay_bounds_key ψ⟩ ++ ++@[continuity, fun_prop] theorem continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := ++ VectorFourier.fourierIntegral_continuous continuous_fourierChar ++ (by simp only [innerₗ_apply_apply, RCLike.inner_apply', conj_trivial, continuous_mul]) ++ ψ.hf ++ ++theorem W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : ++ Integrable fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c) := by ++ have l1 (C) : Integrable (fun u ↦ C / (1 + (u / c) ^ 2)) volume := by ++ simpa only [div_eq_mul_inv] using (integrable_inv_one_add_sq.comp_div hc).const_mul C ++ have l2 : AEStronglyMeasurable (fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c)) volume := by ++ apply Continuous.aestronglyMeasurable ; fun_prop ++ obtain ⟨C, h⟩ := decay_bounds_cor ψ ++ apply @Integrable.mono' ℝ ℂ _ volume _ _ (fun u => C / (1 + (u / c) ^ 2)) (l1 C) l2 ?_ ++ apply Eventually.of_forall (fun x => h _) ++ ++theorem continuous_LSeries_aux (hf : Summable (nterm f σ')) : ++ Continuous fun x : ℝ => LSeries f (σ' + x * I) := by ++ have l1 i : Continuous fun x : ℝ ↦ term f (σ' + x * I) i := by ++ by_cases h : i = 0 ++ · simpa [h] using continuous_const ++ · simpa [h] using continuous_const.div₀ (continuous_const.cpow (by fun_prop) (by simp [h])) ++ (fun x => by simp [h]) ++ have l2 n (x : ℝ) : ‖term f (σ' + x * I) n‖ = nterm f σ' n := by ++ simpa using norm_term_eq_nterm_re (f := f) (n := n) (σ' + x * I) ++ exact continuous_tsum l1 hf (fun n x => le_of_eq (l2 n x)) ++ ++theorem limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) (σ' : ℝ) ++ (hσ' : 1 < σ') : ++ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) ++ (u / (2 * π)) = ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by ++ have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 ++ have l3 : 0 < x := zero_lt_one.trans_le hx ++ have l1 (σ') (hσ' : 1 < σ') := first_fourier hf hint l3 hσ' ++ have l2 (σ') (hσ' : 1 < σ') := second_fourier ψ.h1.continuous.measurable hint l3 hσ' ++ have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := ++ continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [l3]) ++ have l6 : Continuous fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by ++ apply ((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8 ++ have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by ++ exact l6.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right ++ have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := by ++ intro h ; have := congr_arg Complex.re h ; simp at this ; linarith ++ have l7 : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * ++ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by ++ simp only [one_div, ← mul_assoc] ++ refine ((continuous_const.mul <| Continuous.inv₀ ?_ e2).mul ψ.h1.continuous).mul l8 ++ fun_prop ++ have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * ++ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by ++ apply l7.integrable_of_hasCompactSupport ++ exact ψ.h2.mul_left.mul_right.mul_left.mul_left ++ simp_rw [l1 σ' hσ', l2 σ' hσ', ← integral_const_mul, ← integral_sub l4 l5] ++ apply integral_congr_ae ++ apply Eventually.of_forall ++ intro u ++ have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] ++ simp_rw [hG' e1, sub_mul, ← mul_assoc] ++ simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, ++ mul_eq_zero, I_ne_zero, or_false] ++ left ; left ++ field_simp [e2] ++ norm_cast ++ simp [mul_assoc, ← rpow_add l3] ++ ++end CatalanPNT +diff --git a/PrimeNumberTheoremAnd/Catalan/WienerLimits.lean b/PrimeNumberTheoremAnd/Catalan/WienerLimits.lean +new file mode 100644 +index 0000000..fa60fec +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Catalan/WienerLimits.lean +@@ -0,0 +1,620 @@ ++import PrimeNumberTheoremAnd.Catalan.WienerFourier ++ ++namespace CatalanPNT ++ ++open ZetaFivePNT ++ ++open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries ++ Asymptotics SchwartzMap ++open Complex hiding log ++open scoped Topology ++open scoped ContDiff ++open scoped ComplexConjugate ++ ++variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} ++ [RCLike 𝕜] ++ ++section nabla ++ ++variable {α E : Type*} [OfNat α 1] [Add α] [Sub α] {u : α → ℂ} ++ ++def cumsum [AddCommMonoid E] (u : ℕ → E) (n : ℕ) : E := ∑ i ∈ Finset.range n, u i ++ ++def nabla [Sub E] (u : α → E) (n : α) : E := u (n + 1) - u n ++ ++def nnabla [Sub E] (u : α → E) (n : α) : E := u n - u (n + 1) ++ ++def shift (u : α → E) (n : α) : E := u (n + 1) ++ ++@[simp] theorem cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] ++ ++theorem cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : ++ cumsum u (n + 1) = cumsum u n + u n := by ++ simp [cumsum, Finset.sum_range_succ] ++ ++@[simp] theorem nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by ++ ext n ; simp [nabla, cumsum, Finset.range_add_one] ++ ++theorem neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := ++ funext (fun n => by simp [cumsum]) ++ ++theorem cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := ++ fun _ => Finset.sum_nonneg (fun i _ => hu i) ++ ++omit [Sub α] in ++theorem neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] ++ ++omit [Sub α] in ++@[simp] theorem nabla_mul [Ring E] {u : α → E} {c : E} : ++ nabla (fun n => c * u n) = c • nabla u := by ++ ext n ; simp [nabla, mul_sub] ++ ++omit [Sub α] in ++@[simp] theorem nnabla_mul [Ring E] {u : α → E} {c : E} : ++ nnabla (fun n => c * u n) = c • nnabla u := by ++ ext n ; simp [nnabla, mul_sub] ++ ++theorem nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by ++ ext n ; simp [nnabla] ++ ++end nabla ++ ++theorem Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : ++ cumsum u (n + 1) = u 0 + cumsum (shift u) n := by ++ simp_rw [add_comm n, cumsum, _root_.Finset.sum_range_add, ++ _root_.Finset.sum_range_one, add_comm 1] ; rfl ++ ++theorem Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : ++ shift (cumsum u) = (fun _ => u 0) + cumsum (shift u) := by ++ ext n ; apply Finset.sum_shift_front ++ ++theorem Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : ++ cumsum u (n + 1) = cumsum u n + u n := by ++ simp [cumsum, Finset.range_add_one, add_comm] ++ ++theorem Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : ++ shift (cumsum u) = cumsum u + u := by ++ ext n ; apply Finset.sum_shift_back ++ ++theorem summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : ++ cumsum (a * b) (n + 1) = A (n + 1) * b n - A 0 * b 0 - ++ cumsum (shift A * fun i => (b (i + 1) - b i)) n := by ++ have l1 : ∑ x ∈ Finset.range (n + 1), A (x + 1) * b x = ∑ x ∈ Finset.range n, ++ A (x + 1) * b x + A (n + 1) * b n := ++ Finset.sum_shift_back ++ have l2 : ∑ x ∈ Finset.range (n + 1), A x * b x = A 0 * b 0 + ∑ x ∈ Finset.range n, ++ A (x + 1) * b (x + 1) := ++ Finset.sum_shift_front ++ simp only [cumsum, ha, Pi.mul_apply, nabla, sub_mul, Finset.sum_sub_distrib, l1, l2, shift, ++ mul_sub] ++ abel ++ ++theorem summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : ++ cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - cumsum (shift (cumsum a) * nabla b) n := by ++ change cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - ++ cumsum (shift (cumsum a) * (fun i : ℕ => b (i + 1) - b i)) n ++ simpa using summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) ++ ++theorem summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : ++ shift (cumsum (a * b)) = shift (cumsum a) * b - cumsum (shift (cumsum a) * nabla b) := by ++ ext n ; apply summation_by_parts' ++ ++theorem summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : ++ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by ++ have l1 : (cumsum u =O[atTop] 1) ↔ _ := isBigO_one_nat_atTop_iff ++ have l2 n : ‖cumsum u n‖ = cumsum u n := by simpa using cumsum_nonneg hu n ++ simp only [BoundedAtFilter, l1, l2] ++ constructor <;> intro h <;> rcases h with ⟨C, h1⟩ ++ · exact ⟨C, fun n => sum_le_hasSum _ (fun i _ => hu i) h1⟩ ++ · exact summable_of_sum_range_le hu h1 ++ ++theorem Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : ++ Summable u := ++ summable_of_isBigO_nat hu h.isBigO ++ ++theorem summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by ++ exact ⟨CatalanPNT.Filter.EventuallyEq.summable huv.symm, ++ CatalanPNT.Filter.EventuallyEq.summable huv⟩ ++ ++theorem BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : ++ BoundedAtFilter atTop (fun n => u n + c) ↔ BoundedAtFilter atTop u := by ++ have : u = fun n => (u n + c) + (-c) := by ext n ; ring ++ simp only [BoundedAtFilter] ++ constructor <;> intro h ++ on_goal 1 => rw [this] ++ all_goals { exact h.add (const_boundedAtFilter _ _) } ++ ++theorem BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : ++ BoundedAtFilter atTop (fun n => u (n + N)) ↔ BoundedAtFilter atTop u := by ++ simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, one_mem, ++ CStarRing.norm_of_mem_unitary, mul_one, eventually_atTop] ++ constructor <;> intro hbound <;> rcases hbound with ⟨C, n₀, h⟩ <;> use C ++ · refine ⟨n₀ + N, fun n hn => ?_⟩ ++ obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' (m := N) (n := n) (by grind) ++ exact h _ <| Nat.add_le_add_iff_right.mp hn ++ · exact ⟨n₀, fun n hn => h _ (by grind)⟩ ++ ++theorem summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : ++ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by ++ obtain ⟨N, hu⟩ := eventually_atTop.mp hu ++ have e2 : cumsum (fun i ↦ u (i + N)) = fun n => cumsum u (n + N) - cumsum u N := by ++ ext n ; simp_rw [cumsum, add_comm _ N, Finset.sum_range_add] ; ring ++ rw [← summable_nat_add_iff N, summable_iff_bounded (fun n => hu _ <| Nat.le_add_left N n), e2] ++ simp_rw [sub_eq_add_neg, BoundedAtFilter.add_const, BoundedAtFilter.comp_add] ++ ++theorem bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : ++ BoundedAtFilter atTop u := by ++ simp only [BoundedAtFilter, isBigO_iff, eventually_atTop] at h ⊢ ++ obtain ⟨C, N, hC⟩ := h ++ refine ⟨C, N + 1, fun n hn => ?_⟩ ++ simp only [shift] at hC ++ have r1 : n - 1 ≥ N := Nat.le_sub_one_of_lt hn ++ have r2 : n - 1 + 1 = n := Nat.sub_add_cancel (by omega) ++ simpa [r2] using hC (n - 1) r1 ++ ++theorem dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) ++ (hAb : BoundedAtFilter atTop (shift (cumsum a) * b)) (hbb : ∀ᶠ n in atTop, b (n + 1) ≤ b n) ++ (h : Summable (shift (cumsum a) * nnabla b)) : Summable (a * b) := by ++ have l1 : ∀ᶠ n in atTop, 0 ≤ (shift (cumsum a) * nnabla b) n := by ++ filter_upwards [hbb] with n hb ++ exact mul_nonneg (by simpa [shift] using cumsum_nonneg ha (n + 1)) (sub_nonneg.mpr hb) ++ rw [summable_iff_bounded (mul_nonneg ha hb)] ++ rw [summable_iff_bounded' l1] at h ++ apply bounded_of_shift ++ simpa only [summation_by_parts'', sub_eq_add_neg, neg_cumsum, ← mul_neg, neg_nabla] ++ using hAb.add h ++ ++theorem exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : ++ ∃ v : ℕ → ℝ, range v ⊆ range u ∧ Antitone v ∧ v =ᶠ[atTop] u := by ++ obtain ⟨N, hN⟩ := eventually_atTop.mp hu ++ let v (n : ℕ) := u (if n < N then N else n) ++ refine ⟨v, ?_, ?_, ?_⟩ ++ · intro x hx ++ rcases hx with ⟨n, hn⟩ ++ exact ⟨if n < N then N else n, hn⟩ ++ · refine antitone_nat_of_succ_le (fun n => ?_) ++ by_cases h : n < N ++ · by_cases h' : n + 1 < N <;> simp [v, h, h'] ++ have : n + 1 = N := by linarith ++ simp [this] ++ · have : ¬(n + 1 < N) := by linarith ++ simp only [this, ↓reduceIte, h, ge_iff_le, v] ; apply hN ; linarith ++ · have : ∀ᶠ n in atTop, ¬(n < N) := by simpa using ⟨N, fun b hb => by linarith⟩ ++ filter_upwards [this] with n hn ; simp [v, hn] ++ ++theorem summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by ++ let u (n : ℕ) := (n * (Real.log n) ^ 2)⁻¹ ++ have l7 : ∀ᶠ n : ℕ in atTop, 1 ≤ Real.log n := ++ tendsto_atTop.mp (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) 1 ++ have l8 : ∀ᶠ n : ℕ in atTop, 1 ≤ n := eventually_ge_atTop 1 ++ have l9 : ∀ᶠ n in atTop, u (n + 1) ≤ u n := by ++ filter_upwards [l7, l8] with n l2 l8; dsimp [u]; gcongr <;> simp ++ obtain ⟨v, l1, l2, l3⟩ := exists_antitone_of_eventually l9 ++ rw [summable_congr_ae l3.symm] ++ have l4 (n : ℕ) : 0 ≤ v n := by obtain ⟨k, hk⟩ := l1 ⟨n, rfl⟩ ; rw [← hk] ; positivity ++ apply (summable_condensed_iff_of_nonneg l4 (fun _ _ _ a ↦ l2 a)).mp ++ suffices this : ∀ᶠ k : ℕ in atTop, 2 ^ k * v (2 ^ k) = ((k : ℝ) ^ 2)⁻¹ * ((Real.log 2) ^ 2)⁻¹ by ++ exact (summable_congr_ae this).mpr <| (Real.summable_nat_pow_inv.mpr one_lt_two).mul_right _ ++ have l5 : ∀ᶠ k in atTop, v (2 ^ k) = u (2 ^ k) := ++ l3.comp_tendsto <| tendsto_pow_atTop_atTop_of_one_lt Nat.le.refl ++ filter_upwards [l5, l8] with k l5 l8 ++ simp only [l5, mul_inv_rev, Nat.cast_pow, Nat.cast_ofNat, log_pow, u] ++ field_simp ++ ++theorem tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ Tendsto (fun x => a * x + b) atTop atTop := ++ tendsto_atTop_add_const_right _ b (tendsto_id.const_mul_atTop ha) ++ ++theorem isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} ++ (hf : Tendsto f atTop atTop) : (fun _ => a) =o[atTop] f := by ++ simp [tendsto_norm_atTop_atTop.comp hf] ++ ++theorem isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by ++ apply IsLittleO.add ++ · apply IsLittleO.const_mul_left ; simpa using isLittleO_pow_pow_atTop_of_lt (𝕜 := ℝ) one_lt_two ++ · apply isLittleO_const_of_tendsto_atTop _ <| tendsto_pow_atTop (by linarith) ++ ++theorem log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ (fun x => Real.log (a * x + b)) =O[atTop] Real.log := by ++ apply IsBigO.of_bound (2 : ℕ) ++ have l2 : ∀ᶠ x : ℝ in atTop, 0 ≤ log x := tendsto_atTop.mp tendsto_log_atTop 0 ++ have l3 : ∀ᶠ x : ℝ in atTop, 0 ≤ log (a * x + b) := ++ tendsto_atTop.mp (tendsto_log_atTop.comp (tendsto_mul_add_atTop ha b)) 0 ++ have l5 : ∀ᶠ x : ℝ in atTop, 1 ≤ a * x + b := tendsto_atTop.mp (tendsto_mul_add_atTop ha b) 1 ++ have l1 : ∀ᶠ x : ℝ in atTop, a * x + b ≤ x ^ 2 := by ++ filter_upwards [(isLittleO_mul_add_sq a b).eventuallyLE, l5] with x r2 l5 ++ simpa [abs_eq_self.mpr (zero_le_one.trans l5)] using r2 ++ filter_upwards [l1, l2, l3, l5] with x l1 l2 l3 l5 ++ simpa [abs_eq_self.mpr l2, abs_eq_self.mpr l3, Real.log_pow] using ++ Real.log_le_log (by linarith) l1 ++ ++theorem isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ Real.log =O[atTop] (fun x => Real.log (a * x + b)) := by ++ convert (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto ++ (tendsto_mul_add_atTop (b := b) ha) using 1 ++ · ext x ++ simp only [Function.comp_apply] ++ congr ++ field_simp ++ simp ++ · rfl ++ ++theorem log_isbigo_log_div {d : ℝ} (hb : 0 < d) : ++ (fun n ↦ Real.log n) =O[atTop] (fun n ↦ Real.log (n / d)) := by ++ convert isBigO_log_mul_add (inv_pos.mpr hb) 0 using 1; simp only [add_zero]; field_simp ++ ++theorem Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : ++ f =O[atTop] (f + g) := by ++ exact h.right_isBigO_add' ++ ++theorem Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : ++ (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := ++ h.pow 2 ++ ++theorem log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : ++ (fun x ↦ Real.log x ^ 2) =O[atTop] (fun x ↦ a + Real.log (x / b) ^ 2) := by ++ apply (CatalanPNT.Asymptotics.IsBigO.sq (log_isbigo_log_div hb)).trans ++ simp_rw [add_comm a] ++ refine CatalanPNT.Asymptotics.IsBigO.add_isLittleO_right <| ++ isLittleO_const_of_tendsto_atTop _ ?_ ++ exact (tendsto_pow_atTop two_ne_zero).comp <| ++ tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb ++ ++theorem log_add_div_isBigO_log (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ (fun x ↦ Real.log ((x + a) / b)) =O[atTop] fun x ↦ Real.log x := by ++ convert log_mul_add_isBigO_log (inv_pos.mpr hb) (a / b) using 3 ; ring ++ ++theorem log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by ++ rw [nabla, ← Real.log_div (by linarith) hx.ne'] ++ calc ++ _ ≤ (x + 1) / x - 1 := Real.log_le_sub_one_of_pos (by positivity) ++ _ = x⁻¹ := by field_simp; ring ++ ++theorem nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by ++ apply IsBigO.of_bound 1 ++ filter_upwards [eventually_gt_atTop 0] with x l1 ++ have l2 : log x ≤ log (x + 1) := log_le_log l1 (by linarith) ++ simpa [nabla, abs_eq_self.mpr l1.le, abs_eq_self.mpr (sub_nonneg.mpr l2)] using ++ log_add_one_sub_log_le l1 ++ ++theorem nabla_log {b : ℝ} (hb : 0 < b) : ++ nabla (fun x => Real.log (x / b)) =O[atTop] (fun x => 1 / x) := by ++ refine EventuallyEq.trans_isBigO ?_ nabla_log_main ++ filter_upwards [eventually_gt_atTop 0] with x l2 ++ rw [nabla, log_div (by linarith) (by linarith), log_div l2.ne.symm (by linarith), nabla] ; ring ++ ++theorem nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ nabla (fun x => x * (a + Real.log (x / b) ^ 2)) =O[atTop] (fun x => Real.log x ^ 2) := by ++ have l1 : nabla (fun n => n * (a + Real.log (n / b) ^ 2)) = fun n => ++ a + Real.log ((n + 1) / b) ^ 2 + ++ (n * (Real.log ((n + 1) / b) ^ 2 - Real.log (n / b) ^ 2)) := by ++ ext n ; simp [nabla] ; ring ++ have l2 := (isLittleO_const_of_tendsto_atTop a ++ ((tendsto_pow_atTop two_ne_zero).comp tendsto_log_atTop)).isBigO ++ have l3 := CatalanPNT.Asymptotics.IsBigO.sq (log_add_div_isBigO_log 1 hb) ++ have l4 : (fun x => Real.log ((x + 1) / b) + Real.log (x / b)) =O[atTop] Real.log := by ++ simpa using (log_add_div_isBigO_log _ hb).add (log_add_div_isBigO_log 0 hb) ++ have e2 : (fun x : ℝ => x * (Real.log x * (1 / x))) =ᶠ[atTop] Real.log := by ++ filter_upwards [eventually_ge_atTop 1] with x hx using by field_simp ++ have l5 : (fun n ↦ n * (Real.log n * (1 / n))) =O[atTop] (fun n ↦ (Real.log n) ^ 2) := ++ e2.trans_isBigO ++ (by simpa [Function.comp_def] using ++ (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) ++ simp_rw [l1, _root_.sq_sub_sq] ++ exact ((l2.add l3).add (isBigO_refl (·) atTop |>.mul (l4.mul (nabla_log hb)) |>.trans l5)) ++ ++theorem nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ Tendsto (fun x => x * (a + Real.log (x / b) ^ 2)) atTop atTop := ++ tendsto_id.atTop_mul_atTop₀ <| tendsto_atTop_add_const_left _ _ <| ++ (tendsto_pow_atTop two_ne_zero).comp <| tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb ++ ++theorem nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ ∀ᶠ x in atTop, 0 < x * (a + Real.log (x / b) ^ 2) := ++ (nnabla_bound_aux1 a hb).eventually (eventually_gt_atTop 0) ++ ++theorem Real.log_eventually_gt_atTop (a : ℝ) : ++ ∀ᶠ x in atTop, a < Real.log x := ++ Real.tendsto_log_atTop.eventually (eventually_gt_atTop a) ++ ++@[local gcongr] ++theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : ++ ‖x‖ ≤ ‖y‖ := by ++ simp_rw [Real.norm_eq_abs] ++ apply abs_le_abs hxy ++ linarith ++ ++theorem nnabla_bound_aux {x : ℝ} (hx : 0 < x) : ++ nnabla (fun n ↦ 1 / (n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2))) =O[atTop] ++ (fun n ↦ 1 / (Real.log n ^ 2 * n ^ 2)) := by ++ let d n : ℝ := n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2) ++ change (fun x_1 ↦ nnabla (fun n ↦ 1 / d n) x_1) =O[atTop] _ ++ have l2 : ∀ᶠ n in atTop, 0 < d n := (nnabla_bound_aux2 ((2 * π) ^ 2) hx) ++ have l3 : ∀ᶠ n in atTop, 0 < d (n + 1) := ++ (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_id).eventually l2 ++ have l1 : ∀ᶠ n : ℝ in atTop, ++ nnabla (fun n ↦ 1 / d n) n = (d (n + 1) - d n) * (d n)⁻¹ * (d (n + 1))⁻¹ := by ++ filter_upwards [l2, l3] with n l2 l3 ++ rw [nnabla, one_div, one_div, inv_sub_inv l2.ne.symm l3.ne.symm, div_eq_mul_inv, mul_inv, ++ mul_assoc] ++ have l4 : (fun n => (d n)⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by ++ apply IsBigO.inv_rev ++ · refine (isBigO_refl _ _).mul <| (log_sq_isbigo_mul hx) ++ · filter_upwards [Real.log_eventually_gt_atTop 0, eventually_gt_atTop 0] with x hx hx' ++ rw [← not_imp_not] ++ intro _ ++ positivity ++ have l5 : (fun n => (d (n + 1))⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by ++ refine IsBigO.trans ?_ l4 ++ rw [isBigO_iff]; use 1 ++ have e3 : ∀ᶠ n in atTop, d n ≤ d (n + 1) := by ++ filter_upwards [eventually_ge_atTop x] with n hn ++ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn ++ have : 0 ≤ n := hx.le.trans hn ++ simp only [d] ++ gcongr <;> simp [Real.log_nonneg, *] ++ filter_upwards [l2, l3, e3] with n e1 e2 e3 ++ simp_rw [one_mul] ++ gcongr ++ have l6 : (fun n => d (n + 1) - d n) =O[atTop] (fun n => (Real.log n) ^ 2) := by ++ change nabla (fun n : ℝ => n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2)) ++ =O[atTop] (fun n => (Real.log n) ^ 2) ++ exact nnabla_mul_log_sq ((2 * π) ^ 2) hx ++ apply EventuallyEq.trans_isBigO l1 ++ apply ((l6.mul l4).mul l5).trans_eventuallyEq ++ filter_upwards [eventually_ge_atTop 2, Real.log_eventually_gt_atTop 0] with n hn hn' ++ field_simp ++ ++theorem nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : ++ nnabla (fun n => C / (1 + (Real.log (n / x) / (2 * π)) ^ 2) / n) =O[atTop] ++ (fun n => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by ++ field_simp ++ simp only [div_eq_mul_inv, mul_inv, nnabla_mul, one_mul] ++ apply IsBigO.const_mul_left ++ simpa [div_eq_mul_inv, mul_pow, mul_comm] using nnabla_bound_aux hx ++ ++theorem cheby.bigO (h : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by ++ have l1 : 0 ≤ cumsum (‖f ·‖) := cumsum_nonneg (fun _ => norm_nonneg _) ++ obtain ⟨C, hC⟩ := h ++ apply isBigO_of_le' (c := C) atTop ++ intro n ++ rw [Real.norm_eq_abs, abs_eq_self.mpr (l1 n)] ++ simpa using hC n ++ ++theorem limiting_fourier_lim1_aux ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : ++ Summable fun n ↦ ‖f n‖ / ↑n * (C / (1 + (1 / (2 * π) * Real.log (↑n / x)) ^ 2)) := by ++ let a (n : ℕ) := (C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2) / ↑n) ++ replace hcheby := cheby.bigO hcheby ++ have l1 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n : ℕ => (↑(n + 1) : ℝ)) := ++ hcheby.comp_tendsto <| tendsto_add_atTop_nat 1 ++ have l2 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n => (n : ℝ)) := ++ l1.trans ++ (by simpa using (isBigO_refl _ _).add <| isBigO_iff.mpr ⟨1, by simpa using ⟨1, by tauto⟩⟩) ++ have l5 : BoundedAtFilter atTop (fun n : ℕ => C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2)) := by ++ simp only [BoundedAtFilter] ++ field_simp ++ apply isBigO_of_le' (c := C) ; intro n ++ have : 0 ≤ 2 ^ 2 * π ^ 2 + Real.log (n / x) ^ 2 := by positivity ++ simp only [norm_div, norm_mul, norm_eq_abs, abs_eq_self.mpr hC, norm_pow, ++ abs_eq_self.mpr pi_nonneg, abs_eq_self.mpr this, Pi.one_apply, one_mem, ++ CStarRing.norm_of_mem_unitary, mul_one, ge_iff_le, Nat.abs_ofNat] ++ apply div_le_of_le_mul₀ this hC ++ rw [mul_add, ← mul_assoc] ++ apply le_add_of_le_of_nonneg le_rfl ++ positivity ++ have l3 : a =O[atTop] (fun n => 1 / (n : ℝ)) := by ++ convert IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) using 1 ++ · ext n ++ simp [a, div_eq_mul_inv] ++ · ext n ++ simp ++ have l4 : nnabla a =O[atTop] (fun n : ℕ => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by ++ convert (nnabla_bound C hx).natCast_atTop ; simp [nnabla, a] ++ simp_rw [div_mul_eq_mul_div, mul_div_assoc, one_mul] ++ apply dirichlet_test' ++ · intro n ; exact norm_nonneg _ ++ · intro n ; positivity ++ · apply (l2.mul l3).trans_eventuallyEq ++ apply eventually_of_mem (Ici_mem_atTop 1) ++ intro x (hx : 1 ≤ x) ++ have : x ≠ 0 := Nat.one_le_iff_ne_zero.mp hx ++ simp [this] ++ · have : ∀ᶠ n : ℕ in atTop, x ≤ n := by simpa using eventually_ge_atTop ⌈x⌉₊ ++ filter_upwards [this] with n hn ++ have e1 : 0 < (n : ℝ) := by linarith ++ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn ++ have e3 := Nat.le_succ n ++ gcongr ++ refine div_nonneg (Real.log_nonneg e2) (by norm_num [pi_nonneg]) ++ · apply summable_of_isBigO_nat summable_inv_mul_log_sq ++ apply (l2.mul l4).trans_eventuallyEq ++ apply eventually_of_mem (Ici_mem_atTop 2) ++ intro x (hx : 2 ≤ x) ++ have : (x : ℝ) ≠ 0 := by simp ; linarith ++ have : Real.log x ≠ 0 := by ++ have ll : 2 ≤ (x : ℝ) := by simp [hx] ++ simp ++ grind ++ field_simp ++ ++theorem limiting_fourier_lim1 ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (ψ : W21) (hx : 0 < x) : ++ Tendsto (fun σ' : ℝ ↦ ++ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x))) (𝓝[>] 1) ++ (𝓝 (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x)))) := by ++ obtain ⟨C, hC⟩ := decay_bounds_cor ψ ++ have : 0 ≤ C := by simpa using (norm_nonneg _).trans (hC 0) ++ refine tendsto_tsum_of_dominated_convergence ++ (limiting_fourier_lim1_aux hcheby hx C this) (fun n => ?_) ?_ ++ · apply Tendsto.mul_const ++ by_cases h : n = 0 <;> simp only [term, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, ++ tendsto_const_nhds_iff] ++ refine tendsto_const_nhds.div ?_ (by simp [h]) ++ simpa using ((continuous_ofReal.tendsto 1).mono_left nhdsWithin_le_nhds).const_cpow ++ · rw [eventually_nhdsWithin_iff] ++ apply Eventually.of_forall ++ intro σ' (hσ' : 1 < σ') n ++ rw [norm_mul, ← nterm_eq_norm_term] ++ refine mul_le_mul ?_ (hC _) (norm_nonneg _) (div_nonneg (norm_nonneg _) (Nat.cast_nonneg _)) ++ by_cases h : n = 0 <;> simp only [nterm, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, le_refl] ++ have : 1 ≤ (n : ℝ) := by exact_mod_cast (show 1 ≤ n by omega) ++ refine div_le_div₀ (norm_nonneg _) le_rfl (by simpa [Nat.pos_iff_ne_zero]) ?_ ++ simpa using Real.rpow_le_rpow_of_exponent_le this hσ'.le ++ ++theorem limiting_fourier_lim2_aux (x : ℝ) (C : ℝ) : ++ Integrable (fun t ↦ max |x| 1 * (C / (1 + (t / (2 * π)) ^ 2))) ++ (Measure.restrict volume (Ici (-Real.log x))) := by ++ simp_rw [div_eq_mul_inv C] ++ exact (((integrable_inv_one_add_sq.comp_div ++ (by simp [pi_ne_zero])).const_mul _).const_mul _).restrict ++ ++theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : ++ Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * ++ ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) ++ (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by ++ obtain ⟨C, hC⟩ := decay_bounds_cor ψ ++ apply Tendsto.mul ++ · suffices h : Tendsto (fun σ' : ℝ ↦ ofReal (x ^ (1 - σ'))) (𝓝[>] 1) (𝓝 1) by ++ simpa using h.const_mul ↑A ++ suffices h : Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) from ++ (continuous_ofReal.tendsto 1).comp h ++ have : Tendsto (fun σ' : ℝ ↦ σ') (𝓝 1) (𝓝 1) := fun _ a ↦ a ++ have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := ++ tendsto_nhdsWithin_of_tendsto_nhds (by simpa using this.const_sub 1) ++ simpa using tendsto_const_nhds.rpow this (Or.inl (zero_lt_one.trans_le hx).ne.symm) ++ · refine tendsto_integral_filter_of_dominated_convergence _ ?_ ?_ ++ (limiting_fourier_lim2_aux x C) ?_ ++ · apply Eventually.of_forall ; intro σ' ++ apply Continuous.aestronglyMeasurable ++ have := continuous_FourierIntegral ψ ++ continuity ++ · apply eventually_of_mem (U := Ioo 1 2) ++ · apply Ioo_mem_nhdsGT_of_mem ; simp ++ · intro σ' hσ ++ have h1 := hσ.1 ++ have h2 := hσ.2 ++ rw [ae_restrict_iff' measurableSet_Ici] ++ apply Eventually.of_forall ++ intro t (ht : - Real.log x ≤ t) ++ rw [norm_mul] ++ have hdom_nonneg : 0 ≤ max |x| 1 := by ++ exact (abs_nonneg x).trans (le_max_left _ _) ++ refine mul_le_mul ?_ (hC _) (norm_nonneg _) hdom_nonneg ++ simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, norm_exp, ++ neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, sub_self, mul_zero, ++ sub_zero] ++ have : -Real.log x * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht (by linarith) ++ have : -(t * (σ' - 1)) ≤ Real.log x * (σ' - 1) := by simpa using neg_le_neg this ++ have := Real.exp_monotone this ++ apply this.trans ++ have l1 : σ' - 1 ≤ 1 := by linarith ++ have : 0 ≤ Real.log x := Real.log_nonneg hx ++ have := mul_le_mul_of_nonneg_left l1 this ++ refine (Real.exp_monotone this).trans ?_ ++ have hxabs : |x| = x := abs_of_nonneg (zero_le_one.trans hx) ++ calc ++ Real.exp (Real.log x * 1) = |x| := by ++ simpa [mul_one, hxabs] using (Real.exp_log (zero_lt_one.trans_le hx)) ++ _ ≤ max |x| 1 := le_max_left _ _ ++ · apply Eventually.of_forall ++ intro x ++ suffices h : Tendsto (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by ++ simpa using h.mul_const _ ++ apply Tendsto.mono_left ?_ nhdsWithin_le_nhds ++ suffices h : Continuous (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) by simpa using h.tendsto 1 ++ continuity ++ ++theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : ++ Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) ++ (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by ++ by_cases hh : tsupport ψ = ∅ ++ · simp [tsupport_eq_empty_iff.mp hh] ++ obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh ++ let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) ++ have l1 : IsCompact S := by ++ refine Metric.isCompact_iff_isClosed_bounded.mpr ⟨?_, ?_⟩ ++ · exact isClosed_Icc.reProdIm (isClosed_tsupport ψ) ++ · exact (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded ++ have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 ++ have l3 : ContinuousOn (‖G ·‖) S := (hG.mono l2).norm ++ have l4 : S.Nonempty := ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ ++ obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn l4 l3 ++ let MG := ‖G z‖ ++ let bound (a : ℝ) : ℝ := MG * ‖ψ a‖ ++ apply tendsto_integral_filter_of_dominated_convergence (bound := bound) ++ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ; intro u hu ++ apply Continuous.aestronglyMeasurable ++ apply Continuous.mul ++ · exact (hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous ++ · apply Continuous.const_cpow (by fun_prop) ; simp ; linarith ++ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ++ intro u hu ++ apply Eventually.of_forall ; intro v ++ by_cases h : v ∈ tsupport ψ ++ · have r1 : u + v * I ∈ S := by simp [S, mem_reProdIm, hu.1, hu.2, h] ++ have r2 := isMaxOn_iff.mp hmax _ r1 ++ have r4 : (x : ℂ) ≠ 0 := by simp ; linarith ++ have r5 : arg x = 0 := by simp [arg_eq_zero_iff] ; linarith ++ have r3 : ‖(x : ℂ) ^ (v * I)‖ = 1 := by simp [norm_cpow_of_ne_zero r4, r5] ++ simp_rw [norm_mul, r3, mul_one] ++ exact mul_le_mul_of_nonneg_right r2 (norm_nonneg _) ++ · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) ++ simp at this ; simp [this, bound] ++ · suffices h : Continuous bound by exact h.integrable_of_hasCompactSupport ψ.h2.norm.mul_left ++ have := ψ.h1.continuous ; fun_prop ++ · apply Eventually.of_forall ; intro t ++ apply Tendsto.mul_const ++ apply Tendsto.mul_const ++ refine (hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr ⟨?_, ?_⟩ ++ · exact ((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds ++ · exact eventually_nhdsWithin_of_forall (fun x (hx : 1 < x) => by simp [hx.le]) ++ ++theorem limiting_fourier (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : ++ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = ++ ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by ++ have l1 := limiting_fourier_lim1 hcheby ψ (by linarith) ++ have l2 := limiting_fourier_lim2 A ψ hx ++ have l3 := limiting_fourier_lim3 hG ψ hx ++ apply tendsto_nhds_unique_of_eventuallyEq (l1.sub l2) l3 ++ simpa [eventuallyEq_nhdsWithin_iff, W21.ofCS2] using ++ Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) ++ ++theorem limiting_cor_aux {f : ℝ → ℂ} : ++ Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by ++ have l1 : ∀ᶠ x : ℝ in atTop, ∀ t : ℝ, x ^ (t * I) = exp (log x * t * I) := by ++ filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' t ++ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx'] ; ring_nf ++ have l2 : ∀ᶠ x : ℝ in atTop, ∫ t, f t * x ^ (t * I) = ∫ t, f t * exp (log x * t * I) := by ++ filter_upwards [l1] with x hx ++ refine integral_congr_ae (Eventually.of_forall (fun x => by simp [hx])) ++ simp_rw [tendsto_congr' l2] ++ convert_to Tendsto (fun x => 𝓕 f (-Real.log x / (2 * π))) atTop (𝓝 0) ++ · funext x ++ rw [Real.fourier_real_eq_integral_exp_smul] ++ apply integral_congr_ae ++ filter_upwards [] with t ++ have hphase : -2 * π * t * (-Real.log x / (2 * π)) = Real.log x * t := by ++ field_simp ++ rw [hphase, ofReal_mul, smul_eq_mul] ++ exact mul_comm _ _ ++ refine (Real.zero_at_infty_fourier f).comp <| Tendsto.mono_right ?_ _root_.atBot_le_cocompact ++ exact (tendsto_neg_atBot_iff.mpr tendsto_log_atTop).atBot_mul_const (inv_pos.mpr two_pi_pos) ++ ++theorem limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by ++ apply limiting_cor_aux.congr' ++ filter_upwards [eventually_ge_atTop 1] with x hx using ++ limiting_fourier hcheby hG hG' hf ψ hx |>.symm ++ ++end CatalanPNT +diff --git a/PrimeNumberTheoremAnd/Erdos970.lean b/PrimeNumberTheoremAnd/Erdos970.lean +new file mode 100644 +index 0000000..2137759 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970.lean +@@ -0,0 +1,19 @@ ++import PrimeNumberTheoremAnd.Erdos970.Auxiliary ++import PrimeNumberTheoremAnd.Erdos970.Consequences ++import PrimeNumberTheoremAnd.Erdos970.Defs ++import PrimeNumberTheoremAnd.Erdos970.EulerMaclaurin ++import PrimeNumberTheoremAnd.Erdos970.Fourier ++import PrimeNumberTheoremAnd.Erdos970.HadamardSupport ++import PrimeNumberTheoremAnd.Erdos970.Mathlib.Algebra.Notation.Support ++import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.Asymptotics.Asymptotics ++import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic ++import PrimeNumberTheoremAnd.Erdos970.MellinCalculus ++import PrimeNumberTheoremAnd.Erdos970.MertensClassical ++import PrimeNumberTheoremAnd.Erdos970.Rectangle ++import PrimeNumberTheoremAnd.Erdos970.ResidueCalcOnRectangles ++import PrimeNumberTheoremAnd.Erdos970.SmoothExistence ++import PrimeNumberTheoremAnd.Erdos970.Sobolev ++import PrimeNumberTheoremAnd.Erdos970.Tactic.AdditiveCombination ++import PrimeNumberTheoremAnd.Erdos970.Wiener ++import PrimeNumberTheoremAnd.Erdos970.ZetaBounds ++import PrimeNumberTheoremAnd.Erdos970.ZetaConj +diff --git a/PrimeNumberTheoremAnd/Erdos970/Auxiliary.lean b/PrimeNumberTheoremAnd/Erdos970/Auxiliary.lean +new file mode 100644 +index 0000000..0273e54 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Auxiliary.lean +@@ -0,0 +1,71 @@ ++import Mathlib.Analysis.Complex.RealDeriv ++import Mathlib.Analysis.InnerProductSpace.Basic ++ ++namespace Erdos970 ++ ++namespace Complex ++ ++open _root_.Complex ++ ++lemma hasDerivAt_ofReal (x : ℝ) : HasDerivAt ofReal 1 x := ++ HasDerivAt.ofReal_comp <| hasDerivAt_id x ++ ++lemma deriv_ofReal (x : ℝ) : deriv ofReal x = 1 := ++ (hasDerivAt_ofReal x).deriv ++ ++lemma differentiableAt_ofReal (x : ℝ) : DifferentiableAt ℝ ofReal x := ++ (hasDerivAt_ofReal x).differentiableAt ++ ++end Complex ++ ++lemma DifferentiableAt.comp_ofReal {e : ℂ → ℂ} {z : ℝ} (hf : DifferentiableAt ℂ e z) : ++ DifferentiableAt ℝ (fun x : ℝ ↦ e x) z := ++ hf.hasDerivAt.comp_ofReal.differentiableAt ++ ++lemma deriv.comp_ofReal {e : ℂ → ℂ} {z : ℝ} (hf : DifferentiableAt ℂ e z) : ++ deriv (fun x : ℝ ↦ e x) z = deriv e z := ++ hf.hasDerivAt.comp_ofReal.deriv ++ ++lemma Differentiable.comp_ofReal {e : ℂ → ℂ} (h : Differentiable ℂ e) : ++ Differentiable ℝ (fun x : ℝ ↦ e x) := ++ fun _ ↦ DifferentiableAt.comp_ofReal h.differentiableAt ++ ++lemma DifferentiableAt.ofReal_comp {z : ℝ} {f : ℝ → ℝ} (hf : DifferentiableAt ℝ f z) : ++ DifferentiableAt ℝ (fun (y : ℝ) ↦ (f y : ℂ)) z := ++ hf.hasDerivAt.ofReal_comp.differentiableAt ++ ++lemma Differentiable.ofReal_comp {f : ℝ → ℝ} (hf : Differentiable ℝ f) : ++ Differentiable ℝ (fun (y : ℝ) ↦ (f y : ℂ)) := ++ fun _ ↦ DifferentiableAt.ofReal_comp hf.differentiableAt ++ ++open _root_.Complex ContinuousLinearMap in ++lemma HasDerivAt.of_hasDerivAt_ofReal_comp {z : ℝ} {f : ℝ → ℝ} {u : ℂ} ++ (hf : HasDerivAt (fun y ↦ (f y : ℂ)) u z) : ++ ∃ u' : ℝ, u = u' ∧ HasDerivAt f u' z := by ++ lift u to ℝ ++ · have H := (imCLM.hasFDerivAt.comp z hf.hasFDerivAt).hasDerivAt.deriv ++ simp only [Function.comp_def, imCLM_apply, ofReal_im, deriv_const] at H ++ rwa [eq_comm, comp_apply, imCLM_apply, toSpanSingleton_apply_one] at H ++ refine ⟨u, rfl, ?_⟩ ++ convert! (reCLM.hasFDerivAt.comp z hf.hasFDerivAt).hasDerivAt ++ rw [comp_apply, toSpanSingleton_apply_one, reCLM_apply, ofReal_re] ++ ++lemma DifferentiableAt.ofReal_comp_iff {z : ℝ} {f : ℝ → ℝ} : ++ DifferentiableAt ℝ (fun (y : ℝ) ↦ (f y : ℂ)) z ↔ DifferentiableAt ℝ f z := by ++ refine ⟨fun H ↦ ?_, ofReal_comp⟩ ++ obtain ⟨u, _, hu₂⟩ := HasDerivAt.of_hasDerivAt_ofReal_comp H.hasDerivAt ++ exact HasDerivAt.differentiableAt hu₂ ++ ++lemma Differentiable.ofReal_comp_iff {f : ℝ → ℝ} : ++ Differentiable ℝ (fun (y : ℝ) ↦ (f y : ℂ)) ↔ Differentiable ℝ f := ++ forall_congr' fun _ ↦ DifferentiableAt.ofReal_comp_iff ++ ++lemma deriv.ofReal_comp {z : ℝ} {f : ℝ → ℝ} : ++ deriv (fun (y : ℝ) ↦ (f y : ℂ)) z = deriv f z := by ++ by_cases hf : DifferentiableAt ℝ f z ++ · exact hf.hasDerivAt.ofReal_comp.deriv ++ · have hf' := mt DifferentiableAt.ofReal_comp_iff.mp hf ++ rw [deriv_zero_of_not_differentiableAt hf, deriv_zero_of_not_differentiableAt hf', ++ Complex.ofReal_zero] ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Consequences.lean b/PrimeNumberTheoremAnd/Erdos970/Consequences.lean +new file mode 100644 +index 0000000..4a72e0e +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Consequences.lean +@@ -0,0 +1,2293 @@ ++import Mathlib.NumberTheory.Harmonic.Bounds ++import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic ++import PrimeNumberTheoremAnd.Erdos970.Defs ++import PrimeNumberTheoremAnd.Erdos970.Wiener ++ ++namespace Erdos970 ++ ++ ++open ArithmeticFunction hiding log ++open Nat hiding log ++open _root_.Finset _root_.Erdos970.Finset ++open BigOperators _root_.Filter _root_.Erdos970.Filter _root_.Real _root_.Erdos970.Real ++open Classical _root_.Asymptotics _root_.Erdos970.Asymptotics MeasureTheory intervalIntegral ++open scoped ArithmeticFunction.Moebius ArithmeticFunction.Omega Chebyshev ++ ++open _root_.Set in ++lemma Set.Ico_subset_Ico_of_Icc_subset_Icc {a b c d : ℝ} (h : Set.Icc a b ⊆ Set.Icc c d) : ++ Set.Ico a b ⊆ Set.Ico c d := by ++ intro z hz ++ have hz' := Set.Ico_subset_Icc_self.trans h hz ++ have hcd : c ≤ d := by ++ contrapose! hz' ++ rw [Icc_eq_empty_of_lt hz'] ++ exact notMem_empty _ ++ simp only [Set.mem_Ico, Set.mem_Icc] at * ++ refine ⟨hz'.1, hz'.2.eq_or_lt.resolve_left ?_⟩ ++ rintro rfl ++ apply hz.2.not_ge ++ have := h <| right_mem_Icc.mpr (hz.1.trans hz.2.le) ++ simp only [Set.mem_Icc] at this ++ exact this.2 ++ ++lemma th43_b (x : ℝ) (hx : 2 ≤ x) : ++ Nat.primeCounting ⌊x⌋₊ = ++ θ x / log x + ∫ t in Set.Icc 2 x, θ t / (t * (Real.log t) ^ 2) := by ++ rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hx] ++ exact Chebyshev.primeCounting_eq_theta_div_log_add_integral hx ++ ++lemma finsum_range_eq_sum_range {R : Type*} [AddCommMonoid R] {f : ArithmeticFunction R} (x : ℝ) : ++ ∑ᶠ (n : ℕ) (_: n < x), f n = ∑ n ∈ range ⌈x⌉₊, f n := by ++ apply finsum_cond_eq_sum_of_cond_iff f ++ intros ++ simp only [mem_range] ++ exact Iff.symm Nat.lt_ceil ++ ++lemma finsum_range_eq_sum_range' {R : Type*} [AddCommMonoid R] {f : ArithmeticFunction R} ++ (x : ℝ) : ∑ᶠ (n : ℕ) (_ : n ≤ x), f n = ∑ n ∈ Iic ⌊x⌋₊, f n := by ++ apply finsum_cond_eq_sum_of_cond_iff f ++ intro n h ++ simp only [mem_Iic] ++ exact Iff.symm <| Nat.le_floor_iff' ++ fun (hc : n = 0) ↦ (h : f n ≠ 0) <| (congrArg f hc).trans ArithmeticFunction.map_zero ++ ++lemma log2_pos : 0 < log 2 := by ++ rw [Real.log_pos_iff zero_le_two] ++ exact one_lt_two ++ ++theorem Asymptotics.IsEquivalent.add_isLittleO' {α : Type*} {β : Type*} [NormedAddCommGroup β] ++ {u : α → β} {v : α → β} {w : α → β} {l : Filter α} ++ (huv : Asymptotics.IsEquivalent l u v) (hwu : (w - u) =o[l] v) : ++ Asymptotics.IsEquivalent l w v := by ++ rw [← add_sub_cancel u w] ++ exact huv.add_isLittleO hwu ++ ++theorem Asymptotics.IsEquivalent.add_isLittleO'' {α : Type*} {β : Type*} [NormedAddCommGroup β] ++ {u : α → β} {v : α → β} {w : α → β} {l : Filter α} ++ (huv : Asymptotics.IsEquivalent l u v) (hwu : (u - w) =o[l] v) : ++ Asymptotics.IsEquivalent l w v := by ++ rw [← sub_sub_self u w] ++ exact huv.sub_isLittleO hwu ++ ++theorem WeakPNT' : Tendsto (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) atTop (nhds 1) := by ++ have : (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) = ++ (fun N ↦ (∑ n ∈ range N, Λ n)/N + Λ N / N) := by ++ ext N ++ have : N ∈ Iic N := mem_Iic.mpr (le_refl _) ++ rw [← Finset.sum_erase_add _ _ this, ← Nat.Iio_eq_range, Iic_erase] ++ exact add_div _ _ _ ++ ++ rw [this, ← add_zero 1] ++ apply Tendsto.add WeakPNT ++ convert squeeze_zero (f := fun N ↦ Λ N / N) (g := fun N ↦ log N / N) (t₀ := atTop) ?_ ?_ ?_ ++ · intro N ++ exact div_nonneg vonMangoldt_nonneg (cast_nonneg N) ++ · intro N ++ exact div_le_div_of_nonneg_right vonMangoldt_le_log (cast_nonneg N) ++ have := Real.tendsto_pow_log_div_pow_atTop 1 1 Real.zero_lt_one ++ simp only [rpow_one] at this ++ exact Tendsto.comp this tendsto_natCast_atTop_atTop ++ ++theorem WeakPNT'' : ψ ~[atTop] (fun x ↦ x) := by ++ rw [(by rfl : ψ = (fun x ↦ ψ x))] ++ simp_rw [Chebyshev.psi_eq_sum_Icc] ++ apply IsEquivalent.trans (v := fun x ↦ (⌊x⌋₊:ℝ)) ++ · rw [isEquivalent_iff_tendsto_one] ++ · convert! Tendsto.comp WeakPNT' tendsto_nat_floor_atTop ++ infer_instance ++ rw [eventually_iff] ++ simp only [ne_eq, cast_eq_zero, floor_eq_zero, not_lt, mem_atTop_sets, ++ Set.mem_ofPred_eq] ++ use 1 ++ simp only [imp_self, implies_true] ++ apply IsLittleO.isEquivalent ++ rw [← isLittleO_neg_left] ++ apply IsLittleO.of_bound ++ intro ε hε ++ simp only [Pi.sub_apply, neg_sub, norm_eq_abs, eventually_atTop] ++ use ε⁻¹ ++ intro b hb ++ have hb' : 0 ≤ b := le_of_lt (lt_of_lt_of_le (inv_pos_of_pos hε) hb) ++ rw [abs_of_nonneg, abs_of_nonneg hb'] ++ · apply LE.le.trans _ ((inv_le_iff_one_le_mul₀' hε).mp hb) ++ linarith [Nat.lt_floor_add_one b] ++ rw [sub_nonneg] ++ exact floor_le hb' ++ ++lemma isLittleO_sqrt_mul_log : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] _root_.id := by ++ have : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] fun x ↦ x := by ++ refine (isLittleO_mul_iff_isLittleO_div ?_).mpr ?_ ++ · filter_upwards [eventually_gt_atTop 0] with x hx; exact (sqrt_ne_zero hx.le).mpr hx.ne' ++ · convert! isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2) using 2 with x ++ rw [div_sqrt, sqrt_eq_rpow] ++ exact this ++ ++lemma tendsto_floor_add_one_div_self : Tendsto (fun x : ℝ ↦ (⌊x⌋₊ + 1 : ℝ) / x) atTop (nhds 1) := by ++ have h := Asymptotics.isEquivalent_nat_floor (R := ℝ) ++ have h' : IsEquivalent atTop (fun x : ℝ ↦ (⌊x⌋₊ : ℝ) + 1) _root_.id := ++ h.add_isLittleO (isLittleO_const_id_atTop 1) ++ rwa [isEquivalent_iff_tendsto_one ++ (by filter_upwards [eventually_gt_atTop 0] with x hx a; simp only [_root_.id] at a; linarith)] at h' ++ ++lemma isTheta_self_div_const {c : ℝ} (hc : c ≠ 0) : (fun x : ℝ ↦ x) =Θ[atTop] fun x ↦ x / c := by ++ have : (fun x : ℝ ↦ x / c) = fun x ↦ c⁻¹ * x := by ext x; ring ++ exact this ▸ (isTheta_const_mul_left (inv_ne_zero hc)).mpr (isTheta_refl ..) |>.symm ++ ++lemma filter_prime_Iic_eq_Icc (n : ℕ) : filter Prime (Iic n) = filter Prime (Icc 1 n) := by ++ ext p; simp only [mem_filter, mem_Iic, mem_Icc, and_congr_left_iff] ++ exact fun hp ↦ ⟨fun h ↦ ⟨hp.one_lt.le, h⟩, fun ⟨_, h⟩ ↦ h⟩ ++ ++lemma Icc_zero_eq_insert (n : ℕ) : Icc 0 n = insert 0 (Icc 1 n) := by ++ ext m; simp [mem_Icc]; omega ++ ++theorem chebyshev_asymptotic : θ ~[atTop] id := by ++ refine Asymptotics.IsEquivalent.add_isLittleO'' WeakPNT'' ++ (IsBigO.trans_isLittleO (g := fun x ↦ 2 * x.sqrt * x.log) ?_ ?_) ++ · rw [isBigO_iff']; refine ⟨1, one_pos, ?_⟩ ++ simp only [one_mul, eventually_atTop] ++ exact ⟨2, fun x hx ↦ by ++ rw [Pi.sub_apply, norm_eq_abs, norm_eq_abs, abs_of_nonneg (by bound : 0 ≤ 2 * √x * log x)] ++ exact (abs_of_nonneg (sub_nonneg.mpr (Chebyshev.theta_le_psi x))).symm ▸ ++ Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log (by linarith : 1 ≤ x)⟩ ++ · simpa only [mul_assoc] using! isLittleO_sqrt_mul_log.const_mul_left 2 ++ ++theorem chebyshev_asymptotic_finsum : ++ (fun x ↦ ∑ᶠ (p : ℕ) (_ : p ≤ x) (_ : Nat.Prime p), log p) ~[atTop] fun x ↦ x := by ++ have hReal : ++ (fun x : ℝ ↦ ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ)) ~[atTop] ++ fun x ↦ x := by ++ have h x : ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ) = θ x := by ++ rw [Chebyshev.theta_eq_sum_Icc] ++ have hfin : {p : ℕ | (p : ℝ) ≤ x ∧ p.Prime}.Finite := ++ (Iic ⌊x⌋₊).finite_toSet.subset fun p ⟨hpx, _⟩ ↦ mem_Iic.mpr (Nat.le_floor hpx) ++ calc ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ) ++ = ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x ∧ p.Prime), log (p : ℝ) := ++ finsum_congr fun p ↦ by by_cases hp : p.Prime <;> simp [hp] ++ _ = ∑ p ∈ hfin.toFinset, log (p : ℝ) := finsum_mem_eq_finite_toFinset_sum _ hfin ++ _ = _ := sum_congr (by ext p; simp only [Set.Finite.mem_toFinset, Set.mem_ofPred_eq, ++ mem_filter, mem_Icc, and_congr_left_iff]; exact fun hp ↦ ++ ⟨fun hpx ↦ ⟨Nat.zero_le _, Nat.le_floor hpx⟩, fun ⟨_, hpn⟩ ↦ ++ (le_or_gt 0 x).elim ++ (fun hx ↦ (Nat.floor_le hx).trans' (Nat.cast_le.mpr hpn)) fun hx ↦ ++ absurd (Nat.le_zero.mp (Nat.floor_eq_zero.mpr (hx.trans_le zero_le_one) ▸ hpn)) ++ hp.ne_zero⟩) (fun _ _ ↦ rfl) ++ have heq : ++ (fun x : ℝ ↦ ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ)) =ᶠ[atTop] θ := ++ Filter.Eventually.of_forall h ++ exact chebyshev_asymptotic.congr_left heq.symm ++ simp only [IsEquivalent, ++ show (fun n : ℕ ↦ ∑ᶠ (p : ℕ) (_ : p ≤ n) (_ : p.Prime), log (p : ℝ)) = ++ (fun x : ℝ ↦ ∑ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), log (p : ℝ)) ∘ Nat.cast ++ from funext fun _ ↦ finsum_congr fun _ ↦ by simp] ++ exact hReal.isLittleO.comp_tendsto tendsto_natCast_atTop_atTop ++ ++theorem chebyshev_asymptotic' : ++ ∃ (f : ℝ → ℝ), ++ (∀ ε > (0 : ℝ), (f =o[atTop] fun t ↦ ε * t)) ∧ ++ (∀ (x : ℝ), 2 ≤ x → IntegrableOn f (Set.Icc 2 x)) ∧ ++ ∀ (x : ℝ), θ x = x + f x := by ++ have H := chebyshev_asymptotic ++ rw [IsEquivalent, isLittleO_iff] at H ++ let f := (fun x ↦ θ x - x) ++ have integrable (x : ℝ) (hx : 2 ≤ x) : IntegrableOn f (Set.Icc 2 x) := by ++ rw [IntegrableOn] ++ refine Integrable.sub ?_ (ContinuousOn.integrableOn_Icc (continuousOn_id' _)) ++ refine Chebyshev.integrableOn_theta_div_id_mul_log_sq x |>.mul_continuousOn (g' := fun t => t * log t ^ 2) ++ (ContinuousOn.mul (continuousOn_id' _) (ContinuousOn.pow (continuousOn_log |>.mono <| by ++ rintro t ⟨ht1, _⟩ ++ simp only [Set.mem_compl_iff, Set.mem_singleton_iff] ++ linarith) 2)) isCompact_Icc |>.congr_fun_ae ?_ ++ simp only [measurableSet_Icc, ae_restrict_eq, EventuallyEq, eventually_inf_principal] ++ refine .of_forall fun t ⟨ht1, _⟩ => ?_ ++ rw [div_mul_cancel₀] ++ simpa only [ne_eq, _root_.mul_eq_zero, OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff, ++ log_eq_zero, or_self_left, not_or] using ⟨by linarith, by linarith, by linarith⟩ ++ refine ⟨f, fun ε hε ↦ ?_, integrable, ?_⟩ ++ · rw [isLittleO_iff] ++ intro c hc ++ specialize @H (c * ε) (mul_pos hc hε) ++ simp only [Pi.sub_apply, norm_eq_abs, mul_assoc, eventually_atTop, norm_mul, ++ abs_of_pos hε, f] at H ⊢ ++ exact H ++ refine fun r => by simp [f] ++ ++theorem chebyshev_asymptotic'' : ++ ∃ (f : ℝ → ℝ), ++ (∀ ε > (0 : ℝ), (f =o[atTop] fun _ ↦ ε)) ∧ ++ (∀ (x : ℝ), 2 ≤ x → IntegrableOn f (Set.Icc 2 x)) ∧ ++ ∀ x > (0 : ℝ), θ x = x + x * (f x) := by ++ obtain ⟨f, hf1, inte, hf2⟩ := chebyshev_asymptotic' ++ refine ⟨fun t => f t / t, fun ε hε ↦ ?_, ?_, ?_⟩ ++ · simp only [isLittleO_iff, norm_eq_abs, norm_mul, eventually_atTop, ++ norm_div] at hf1 ⊢ ++ intro r hr ++ replace hf1 := hf1 ε hε ++ obtain ⟨N, hN⟩ := hf1 hr ++ use |N| + 1 ++ intro x hx ++ have hx' : |N| + 1 ≤ |x| := by rwa [abs_of_nonneg (a := x) (le_trans (by positivity) hx)] ++ rw [div_le_iff₀ (lt_of_lt_of_le (by positivity) hx'), mul_assoc] ++ exact hN x (le_trans (le_trans (le_abs_self N) (by linarith)) hx) ++ ++ · intro x hx ++ refine inte x hx |>.mul_continuousOn (g' := fun t : ℝ => t⁻¹) ++ (continuousOn_inv₀ |>.mono <| by ++ rintro t ⟨ht1, _⟩ ++ simp only [Set.mem_compl_iff, Set.mem_singleton_iff] ++ linarith) isCompact_Icc |>.congr_fun_ae <| .of_forall <| by simp [div_eq_mul_inv] ++ intro x hx ++ rw [hf2, mul_div_cancel₀] ++ linarith ++ ++theorem primorial_bounds : ++ ∃ E : ℝ → ℝ, E =o[atTop] (fun x ↦ x) ∧ ++ ∀ x : ℝ, ∏ p ∈ (Iic ⌊x⌋₊).filter Nat.Prime, p = exp (x + E x) := by ++ use (fun x ↦ ∑ p ∈ (filter Nat.Prime (Iic ⌊x⌋₊)), log p - x) ++ constructor ++ · exact Asymptotics.IsEquivalent.isLittleO chebyshev_asymptotic ++ intro x ++ simp only [cast_prod, add_sub_cancel, exp_sum] ++ apply Finset.prod_congr rfl ++ intros x hx ++ rw[Real.exp_log] ++ rw[Finset.mem_filter] at hx ++ norm_cast ++ exact Nat.Prime.pos hx.right ++ ++theorem primorial_bounds_finprod : ++ ∃ E : ℝ → ℝ, E =o[atTop] (fun x ↦ x) ∧ ++ ∀ x : ℝ, ∏ᶠ (p : ℕ) (_ : p ≤ x) (_ : Nat.Prime p), p = exp (x + E x) := by ++ obtain ⟨E, hE, hprod⟩ := primorial_bounds ++ refine ⟨E, hE, fun x ↦ ?_⟩ ++ have hfin : {p : ℕ | (p : ℝ) ≤ x ∧ p.Prime}.Finite := ++ (Iic ⌊x⌋₊).finite_toSet.subset fun p ⟨hpx, _⟩ ↦ mem_Iic.mpr <| le_floor hpx ++ have heq : ∏ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), p = ++ ∏ p ∈ (Iic ⌊x⌋₊).filter Prime, p := by ++ calc ∏ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x) (_ : p.Prime), p ++ = ∏ᶠ (p : ℕ) (_ : (p : ℝ) ≤ x ∧ p.Prime), p := ++ finprod_congr fun p ↦ by by_cases hp : p.Prime <;> simp [hp] ++ _ = ∏ p ∈ hfin.toFinset, p := finprod_mem_eq_finite_toFinset_prod _ hfin ++ _ = _ := prod_congr (by ext p; simp only [Set.Finite.mem_toFinset, Set.mem_ofPred_eq, ++ mem_filter, mem_Iic, and_congr_left_iff]; exact fun hp ↦ ++ ⟨le_floor, fun hpn ↦ (le_or_gt 0 x).elim ++ (fun hx ↦ (Nat.floor_le hx).trans' (cast_le.mpr hpn)) fun hx ↦ ++ absurd (le_zero.mp (floor_eq_zero.mpr (hx.trans_le zero_le_one) ▸ hpn)) ++ hp.ne_zero⟩) (fun _ _ ↦ rfl) ++ simp only [heq, hprod] ++ ++lemma continuousOn_log0 : ++ ContinuousOn (fun x ↦ -1 / (x * log x ^ 2)) {0, 1, -1}ᶜ := by ++ refine fun t ht ↦ ContinuousAt.continuousWithinAt ?_ ++ fun_prop (disch := simp_all) ++ ++lemma continuousOn_log1 : ContinuousOn (fun x ↦ (log x ^ 2)⁻¹ * x⁻¹) {0, 1, -1}ᶜ := by ++ refine fun t ht ↦ ContinuousAt.continuousWithinAt ?_ ++ fun_prop (disch := simp_all) ++ ++lemma integral_log_inv (a b : ℝ) (ha : 2 ≤ a) (hb : a ≤ b) : ++ ∫ t in a..b, (log t)⁻¹ = ++ ((log b)⁻¹ * b) - ((log a)⁻¹ * a) + ++ ∫ t in a..b, ((log t)^2)⁻¹ := by ++ rw [le_iff_lt_or_eq] at hb ++ rcases hb with hb | rfl; swap ++ · simp only [intervalIntegral.integral_same, sub_self, add_zero] ++ · have := intervalIntegral.integral_mul_deriv_eq_deriv_mul ++ (u := fun x => (log x)⁻¹) ++ (u' := fun x => -1 / (x * (log x)^2)) ++ (v := fun x => x) ++ (v' := fun _ => 1) (a := a) (b := b) ++ (fun x hx => by ++ rw [Set.uIcc_eq_union, Set.Icc_eq_empty (lt_iff_not_ge |>.1 hb), Set.union_empty] at hx ++ obtain ⟨hx1, _⟩ := hx ++ rw [show (-1 / (x * log x ^ 2)) = (-1 / log x ^ 2) * (x⁻¹) by ++ rw [mul_comm x]; field_simp] ++ apply HasDerivAt.comp ++ (h := fun t => log t) (h₂ := fun t => t⁻¹) (x := x) ++ · simpa using! HasDerivAt.inv (c := fun t : ℝ => t) (c' := 1) (x := log x) ++ (hasDerivAt_id' (log x)) ++ (by simp only [ne_eq, log_eq_zero, not_or]; refine ⟨?_, ?_, ?_⟩ <;> linarith) ++ · apply hasDerivAt_log; linarith) ++ (fun x _ => hasDerivAt_id' x) ++ (by ++ rw [intervalIntegrable_iff_integrableOn_Icc_of_le (le_of_lt hb)] ++ apply ContinuousOn.integrableOn_Icc ++ refine continuousOn_log0.mono fun x hx ↦ ?_ ++ simp only [Set.mem_Icc, Set.mem_compl_iff, Set.mem_insert_iff, Set.mem_singleton_iff, ++ not_or] at hx ⊢ ++ refine ⟨?_, ?_, ?_⟩ <;> linarith) ++ (by ++ constructor <;> ++ apply MeasureTheory.integrable_const) ++ simp only [mul_one] at this ++ rw [this] ++ simp_rw [neg_div, neg_mul] ++ rw [sub_eq_add_neg] ++ congr 1 ++ rw [intervalIntegral.integral_of_le (le_of_lt hb), ++ intervalIntegral.integral_of_le (le_of_lt hb), ++ ← MeasureTheory.integral_neg] ++ simp_rw [neg_neg] ++ refine integral_congr_ae ?_ ++ · rw [ae_restrict_eq, eventuallyEq_inf_principal_iff] ++ · refine .of_forall fun x hx => ?_ ++ simp only [Set.mem_Ioc, one_div, mul_inv_rev, mul_assoc] at hx ⊢ ++ rw [inv_mul_cancel₀, mul_one] ++ linarith ++ exact measurableSet_Ioc ++ ++lemma integral_log_inv' (a b : ℝ) (ha : 2 ≤ a) (hb : a ≤ b) : ++ ∫ t in Set.Icc a b, (log t)⁻¹ = ++ ((log b)⁻¹ * b) - ((log a)⁻¹ * a) + ++ ∫ t in Set.Icc a b, ((log t)^2)⁻¹ := by ++ have := integral_log_inv a b ha hb ++ simp only [intervalIntegral.intervalIntegral_eq_integral_uIoc, ite_eq_left hb, Set.uIoc_of_le hb, ++ smul_eq_mul, one_mul] at this ++ rw [integral_Icc_eq_integral_Ioc, integral_Icc_eq_integral_Ioc] ++ rw [this] ++ ++lemma integral_log_inv'' (a b : ℝ) (ha : 2 ≤ a) (hb : a ≤ b) : ++ (log a)⁻¹ * a + ∫ t in Set.Icc a b, (log t)⁻¹ = ++ ((log b)⁻¹ * b) + ∫ t in Set.Icc a b, ((log t)^2)⁻¹ := by ++ rw [integral_log_inv' a b ha hb] ++ group ++ ++lemma integral_log_inv_pos (x : ℝ) (hx : 2 < x) : ++ 0 < ∫ t in Set.Icc 2 x, (log t)⁻¹ := by ++ classical ++ rw [MeasureTheory.integral_pos_iff_support_of_nonneg_ae] ++ · simp only [Function.support_inv, measurableSet_Icc, Measure.restrict_apply'] ++ rw [show Function.support log ∩ Set.Icc 2 x = Set.Icc 2 x by ++ rw [Set.inter_eq_right] ++ intro t ht ++ simp only [Set.mem_Icc, Function.mem_support, ne_eq, log_eq_zero, not_or] at ht ⊢ ++ exact ⟨by linarith, by linarith, by linarith⟩] ++ simpa ++ · simp only [measurableSet_Icc, ae_restrict_eq, EventuallyLE, eventually_inf_principal] ++ refine .of_forall fun t (ht : _ ∧ _) => ?_ ++ simpa only [Pi.zero_apply, inv_nonneg] using log_nonneg (by linarith) ++ · apply ContinuousOn.integrableOn_Icc ++ apply ContinuousOn.inv₀ ++ · exact (continuousOn_log).mono <| by aesop ++ ++ · rintro t ⟨ht, -⟩ ++ simp only [ne_eq, log_eq_zero, not_or] ++ exact ⟨by linarith, by linarith, by linarith⟩ ++ ++lemma integral_log_inv_ne_zero (x : ℝ) (hx : 2 < x) : ++ ∫ t in Set.Icc 2 x, (log t)⁻¹ ≠ 0 := by ++ have := integral_log_inv_pos x hx ++ linarith ++ ++lemma pi_asymp_aux (x : ℝ) (hx : 2 ≤ x) : Nat.primeCounting ⌊x⌋₊ = ++ (log x)⁻¹ * θ x + ∫ t in Set.Icc 2 x, θ t * (t * log t ^ 2)⁻¹ := by ++ rw [th43_b _ hx] ++ simp_rw [div_eq_mul_inv, Chebyshev.theta_eq_sum_Icc] ++ ring_nf! ++ ++theorem pi_asymp'' : ++ (fun x => ((Nat.primeCounting ⌊x⌋₊ : ℝ) / ∫ t in Set.Icc 2 x, 1 / log t) - (1 : ℝ)) =o[atTop] ++ fun _ => (1 : ℝ) := by ++ obtain ⟨f, hf, f_int, hf'⟩ := chebyshev_asymptotic'' ++ have eq1 : ∀ᶠ (x : ℝ) in atTop, ++ ⌊x⌋₊.primeCounting = ++ (log x)⁻¹ * (x + x * f x) + ++ (∫ t in Set.Icc 2 x, ++ (t + t * f t) * (t * log t ^ 2)⁻¹) := by ++ filter_upwards [eventually_ge_atTop 2] with x hx ++ rw [pi_asymp_aux x hx, hf' x (by linarith)] ++ congr 1 ++ apply setIntegral_congr_fun measurableSet_Icc fun t ht ↦ ?_ ++ rw [hf' t (by grind)] ++ ++ replace eq1 : ++ ∀ᶠ (x : ℝ) in atTop, ++ ⌊x⌋₊.primeCounting = ++ (log x)⁻¹ * (x + x * f x) + ++ ((∫ t in Set.Icc 2 x, (log t ^ 2)⁻¹) + ++ (∫ t in Set.Icc 2 x, (f t) * (log t ^ 2)⁻¹)) := by ++ filter_upwards [eq1, eventually_ge_atTop 2] with x eq1 hx ++ rw [eq1] ++ congr ++ simp_rw [mul_inv_rev, add_mul] ++ rw [MeasureTheory.integral_add] ++ · congr 1 ++ all_goals ++ apply setIntegral_congr_fun measurableSet_Icc fun t ht ↦ ?_ ++ field [show t ≠ 0 by grind] ++ · apply IntegrableOn.mul_continuousOn ++ (hg := ContinuousOn.integrableOn_Icc <| continuousOn_id' _) ++ (hK := isCompact_Icc) ++ apply continuousOn_log1.mono ?_ ++ intro y h ++ simp only [Set.mem_Icc, Set.mem_compl_iff, Set.mem_insert_iff, ++ Set.mem_singleton_iff, not_or] at h ⊢ ++ exact ⟨by linarith, by linarith, by linarith⟩ ++ · rw [show (fun t ↦ t * f t * ((log t ^ 2)⁻¹ * t⁻¹)) = ++ fun t ↦ f t * (t * (log t ^ 2)⁻¹ * t⁻¹) by ext; ring] ++ apply IntegrableOn.mul_continuousOn (hK := isCompact_Icc) ++ · apply f_int x (by linarith) ++ · simp_rw [mul_assoc] ++ refine ContinuousOn.mul (continuousOn_id' (Set.Icc 2 x)) ?_ ++ apply continuousOn_log1.mono ?_ ++ intro y h ++ simp only [Set.mem_Icc, Set.mem_compl_iff, Set.mem_insert_iff, ++ Set.mem_singleton_iff, not_or] at h ⊢ ++ exact ⟨by linarith, by linarith, by linarith⟩ ++ ++ simp_rw [mul_add] at eq1 ++ simp_rw [show ∀ (x : ℝ), ++ (log x)⁻¹ * x + (log x)⁻¹ * (x * f x) + ++ ((∫ (t : ℝ) in Set.Icc 2 x, (log t ^ 2)⁻¹) + ++ ∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) = ++ ((log x)⁻¹ * x + (∫ (t : ℝ) in Set.Icc 2 x, (log t ^ 2)⁻¹)) + ++ ((log x)⁻¹ * (x * f x) + ++ ∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) ++ by intros; ring] at eq1 ++ ++ replace eq1 : ++ ∃ (C : ℝ), ∀ᶠ (x : ℝ) in atTop, ++ ⌊x⌋₊.primeCounting = ++ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ ((log x)⁻¹ * (x * f x) + ++ ∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) + ++ C := by ++ use ((log 2)⁻¹ * 2) ++ filter_upwards [eq1, eventually_ge_atTop 2] with x eq1 hx ++ rw [eq1, ← integral_log_inv'' _ _ (by rfl) hx] ++ ring ++ replace eq1 : ++ ∃ (C : ℝ), ∀ᶠ (x : ℝ) in atTop, ++ (⌊x⌋₊.primeCounting / ∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) - 1 = ++ ((log x)⁻¹ * (x * f x) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ (∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) / ++ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹)) + ++ C / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by ++ obtain ⟨C, hC⟩ := eq1 ++ use C ++ filter_upwards [hC, eventually_gt_atTop 2] with x hC hx ++ rw [hC] ++ field [integral_log_inv_ne_zero] ++ simp_rw [isLittleO_iff] at hf ++ choose C hC using eq1 ++ simp_rw [← one_div] at hC ++ apply isLittleO_congr hC (by rfl) |>.mpr ++ have ineq1 (ε : ℝ) (hε : 0 < ε) (c : ℝ) (hc : 0 < c) : ∀ᶠ(x : ℝ) in atTop, ++ (log x)⁻¹ * x * |f x| ≤ c * ε * ((log x)⁻¹ * x) := by ++ filter_upwards [eventually_ge_atTop 2, hf ε hε hc] with x hx hM ++ simp only [norm_eq_abs] at hM ++ rw [abs_of_pos hε] at hM ++ rw [mul_comm (c * ε)] ++ gcongr ++ bound ++ have int_flog {a b : ℝ} (ha: 2 ≤ a) (hb : 2 ≤ b) : ++ IntegrableOn (fun t ↦ |f t| * (log t ^ 2)⁻¹) (Set.Icc a b) volume := by ++ apply IntegrableOn.mul_continuousOn ++ · apply Integrable.abs <| f_int b hb |>.mono (Set.Icc_subset_Icc_left ha) (by rfl) ++ · refine ContinuousOn.inv₀ (ContinuousOn.pow (continuousOn_log |>.mono ?_) 2) ?_ ++ · simp ++ grind ++ · intro t ht ++ simp only [Set.mem_Icc, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, ++ pow_eq_zero_iff, log_eq_zero, not_or] at ht ⊢ ++ exact ⟨by linarith, by linarith, by linarith⟩ ++ · exact isCompact_Icc ++ have int_inv_log_sq {a b : ℝ} (ha : 2 ≤ a) (hb : 2 ≤ b) : ++ IntegrableOn (fun t ↦ (log t ^ 2)⁻¹) (Set.Icc a b) volume := by ++ refine ContinuousOn.integrableOn_Icc <| ++ ContinuousOn.inv₀ (ContinuousOn.pow (continuousOn_log |>.mono ?_) 2) ?_ ++ · grind ++ · intro t ht ++ simp only [Set.mem_Icc, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, ++ pow_eq_zero_iff, log_eq_zero, not_or] at ht ⊢ ++ exact ⟨by linarith, by linarith, by linarith⟩ ++ simp_rw [eventually_atTop] at hf ++ choose M hM using hf ++ have ineq2 (ε : ℝ) (hε : 0 < ε) (c : ℝ) (hc : 0 < c) : ++ ∃ (D : ℝ), ++ ∀ᶠ (x : ℝ) in atTop, ++ |∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹| ≤ ++ c * ε * ((∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) - (log x)⁻¹ * x) + D := by ++ use (((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), |f t| * (log t ^ 2)⁻¹) - ++ c * ε * ∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹) + ++ c * ε * ((log 2)⁻¹ * 2)) ++ filter_upwards [eventually_gt_atTop (max 2 (M ε hε hc))] with x hx ++ calc _ ++ _ ≤ ∫ (t : ℝ) in Set.Icc 2 x, |f t * (log t ^ 2)⁻¹| := ++ norm_integral_le_integral_norm fun a ↦ f a * (log a ^ 2)⁻¹ ++ _ = ∫ (t : ℝ) in Set.Icc 2 x, |f t| * (log t ^ 2)⁻¹ := by ++ apply setIntegral_congr_fun measurableSet_Icc fun t ht ↦ ?_ ++ rw [abs_mul, abs_of_nonneg (a := (log t ^ 2)⁻¹)] ++ norm_num ++ apply pow_nonneg ++ exact log_nonneg <| by grind ++ _ = (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), ++ |f t| * (log t ^ 2)⁻¹) + ++ (∫ (t : ℝ) in Set.Icc (max 2 (M ε hε hc)) x, ++ |f t| * (log t ^ 2)⁻¹) := by ++ rw [← setIntegral_union₀, Set.Icc_union_Icc_eq_Icc (le_max_left ..) hx.le] ++ · rw [AEDisjoint, Set.Icc_inter_Icc_eq_singleton (le_max_left ..) hx.le, volume_singleton] ++ · simp only [measurableSet_Icc, MeasurableSet.nullMeasurableSet] ++ · apply int_flog (by rfl) (le_max_left ..) ++ · apply int_flog (le_max_left ..) (le_trans (le_max_left ..) hx.le) ++ _ ≤ (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), ++ |f t| * (log t ^ 2)⁻¹) + ++ (∫ (t : ℝ) in Set.Icc (max 2 (M ε hε hc)) x, ++ (c * ε) * (log t ^ 2)⁻¹) := by ++ gcongr 1 ++ apply setIntegral_mono_on ++ · apply int_flog (le_max_left ..) (le_trans (le_max_left ..) hx.le) ++ · rw [IntegrableOn, integrable_const_mul_iff] ++ · apply int_inv_log_sq (le_max_left ..) (le_trans (le_max_left ..) hx.le) ++ · simp only [isUnit_iff_ne_zero, ne_eq, _root_.mul_eq_zero, not_or] ++ exact ⟨by linarith, by linarith⟩ ++ · exact measurableSet_Icc ++ · intro t ht ++ simp only [Set.mem_Icc, sup_le_iff] at ht ++ apply mul_le_mul_of_nonneg_right ++ · refine hM ε hε hc t ht.1.2 |>.trans ?_ ++ simp only [norm_eq_abs, abs_of_pos hε, le_refl] ++ · norm_num ++ refine pow_nonneg (log_nonneg <| by linarith) 2 ++ _ = (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), ++ |f t| * (log t ^ 2)⁻¹) + ++ ((c * ε) * ∫ (t : ℝ) in Set.Icc (max 2 (M ε hε hc)) x, (log t ^ 2)⁻¹) := by ++ congr 1 ++ exact integral_const_mul (c * ε) _ ++ _ = (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), ++ |f t| * (log t ^ 2)⁻¹) + ++ ((c * ε) * ++ ((∫ (t : ℝ) in Set.Icc (max 2 (M ε hε hc)) x, (log t ^ 2)⁻¹) + ++ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)) - ++ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)))) := by ++ ring ++ _ = (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), ++ |f t| * (log t ^ 2)⁻¹) + ++ ((c * ε) * ++ ((∫ (t : ℝ) in Set.Icc 2 x, (log t ^ 2)⁻¹) - ++ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)))) := by ++ congr 3 ++ rw [add_comm, ← setIntegral_union₀, Set.Icc_union_Icc_eq_Icc (le_max_left ..) hx.le] ++ · rw [AEDisjoint, Set.Icc_inter_Icc_eq_singleton (le_max_left ..) hx.le, ++ volume_singleton] ++ · simp only [measurableSet_Icc, MeasurableSet.nullMeasurableSet] ++ · apply int_inv_log_sq (by rfl) (le_max_left ..) ++ · apply int_inv_log_sq (le_max_left ..) (le_trans (le_max_left ..) hx.le) ++ _ = ((c * ε) * (∫ (t : ℝ) in Set.Icc 2 x, (log t ^ 2)⁻¹)) + ++ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), ++ |f t| * (log t ^ 2)⁻¹) - ++ (c * ε) * (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)) := by ++ ring ++ _ = ((c * ε) * ((∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ ((log 2)⁻¹ * 2) - ((log x)⁻¹ * x))) + ++ ((∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), ++ |f t| * (log t ^ 2)⁻¹) - ++ (c * ε) * (∫ (t : ℝ) in Set.Icc 2 (max 2 (M ε hε hc)), (log t ^ 2)⁻¹)) := by ++ congr 2 ++ rw [integral_log_inv' _ _ (by rfl)] ++ · ring ++ · simp only [max_lt_iff] at hx ++ linarith ++ _ = _ := by ring ++ choose D hD using ineq2 ++ ++ have ineq4 (const : ℝ) (ε : ℝ) (hε : 0 < ε) : ++ ∀ᶠ x in atTop, |const / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹)| ≤ 1/2 * ε := by ++ obtain rfl|hconst := eq_or_ne const 0 ++ · filter_upwards with x ++ simp[hε.le] ++ have ineq (x : ℝ) (hx : 2 < x) := ++ calc (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) ++ _ ≥ (∫ (_ : ℝ) in Set.Icc 2 x, (log x)⁻¹) := by ++ apply setIntegral_mono_on (integrable_const _) ++ · refine ContinuousOn.integrableOn_Icc <| ++ ContinuousOn.inv₀ (continuousOn_log |>.mono ?_) ?_ ++ · simp only [Set.subset_compl_singleton_iff, Set.mem_Icc, not_and, not_le, ++ isEmpty_Prop, ofNat_pos, IsEmpty.forall_iff] ++ · intro t ht ++ simp only [Set.mem_Icc, ne_eq, log_eq_zero, not_or] at ht ⊢ ++ exact ⟨by linarith, by linarith, by linarith⟩ ++ · exact measurableSet_Icc ++ · intro t ⟨ht1, ht2⟩ ++ gcongr ++ bound ++ _ = (x - 2) * (log x)⁻¹ := by ++ rw [MeasureTheory.integral_const] ++ simp only [MeasurableSet.univ, Measure.restrict_apply, Set.univ_inter, volume_Icc, ++ smul_eq_mul, mul_eq_mul_right_iff, ENNReal.toReal_ofReal_eq_iff, sub_nonneg, ++ inv_eq_zero, log_eq_zero, Measure.real] ++ refine Or.inl (le_of_lt hx) ++ ++ simp_rw [abs_div] ++ have ineq (x : ℝ) (hx : 2 < x) : ++ |const| / |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| ≤ ++ |const| / ((x - 2) * (log x)⁻¹) := by ++ apply div_le_div₀ (abs_nonneg _) (by rfl) ++ · apply mul_pos ++ · linarith ++ · norm_num ++ rw [Real.log_pos_iff] ++ · linarith ++ · linarith ++ · rw [abs_of_pos (integral_log_inv_pos _ hx)] ++ exact ineq x hx ++ have ineq (x : ℝ) (hx : 2 < x) : ++ |const| / |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| ≤ ++ |const| * (log x / ((x - 2))) := by ++ refine ineq x hx |>.trans <| le_of_eq ?_ ++ field_simp ++ have lim := Real.tendsto_pow_log_div_mul_add_atTop 1 (-2) 1 (by norm_num) ++ simp only [pow_one, one_mul, ← sub_eq_add_neg] at lim ++ rw [tendsto_atTop_nhds] at lim ++ specialize lim (Metric.ball 0 ((1/2) * ε / |const| : ℝ)) (by ++ simp only [Metric.mem_ball, dist_self] ++ apply _root_.div_pos ++ · linarith ++ · simpa only [abs_pos, ne_eq]) Metric.isOpen_ball ++ obtain ⟨M, hM⟩ := lim ++ rw [eventually_atTop] ++ refine ⟨max 3 M, ?_⟩ ++ intro x hx ++ simp only [Metric.mem_ball, dist_zero_right, max_le_iff, norm_eq_abs] at hM hx ++ refine ineq x (by linarith) |>.trans ?_ ++ specialize hM x hx.2 ++ rw [abs_of_nonneg (by ++ apply div_nonneg ++ · refine log_nonneg (by linarith) ++ · linarith)] at hM ++ have ineq' : |const| * (log x / (x - 2)) < |const| * ((1/2) * ε / |const|) := by ++ rw [mul_lt_mul_iff_right₀] ++ · exact hM ++ · simpa only [abs_pos, ne_eq] ++ rw [mul_div_cancel₀] at ineq' ++ · refine le_of_lt ineq' ++ · simpa only [ne_eq, abs_eq_zero] ++ rw [isLittleO_iff] ++ intro ε hε ++ specialize ineq4 (|D ε hε (1/2) (by linarith)| + |C|) ε hε ++ simp only [one_div, norm_eq_abs, norm_one, mul_one] ++ filter_upwards [eventually_gt_atTop 2, ineq4, ineq1 ε hε (1 / 2) (by norm_num), ++ hD ε hε (1 / 2) (by norm_num)] with x hx hB ineq1 hD ++ have := integral_log_inv_pos x (by linarith) |>.le ++ calc _ ++ _ ≤ |((log x)⁻¹ * (x * f x) / ∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹)| + ++ |(∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹) / ++ ∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| + ++ |C / ∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| := by ++ apply abs_add_three ++ _ = |(log x)⁻¹ * (x * f x)| / |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| + ++ |(∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹)| / ++ |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| + ++ |C| / |∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹| := by ++ rw [abs_div, abs_div, abs_div] ++ _ = |(log x)⁻¹ * (x * f x)| / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ |(∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹)| / ++ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ |C| / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by ++ repeat rw [abs_of_pos <| integral_log_inv_pos _ (by linarith)] ++ _ = ((log x)⁻¹ * x * |f x|) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ |(∫ (t : ℝ) in Set.Icc 2 x, f t * (log t ^ 2)⁻¹)| / ++ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ |C| / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by ++ congr ++ rw [abs_mul, abs_mul, abs_of_nonneg (by bound), abs_of_nonneg (by linarith), mul_assoc] ++ _ ≤ ((1/2) * ε * ((log x)⁻¹ * x)) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ ((1/2) * ε * ((∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) - (log x)⁻¹ * x) + ++ D ε hε (1/2) (by linarith)) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ |C| / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by ++ gcongr ++ _ = ((1/2) * ε * (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹)) / ++ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) + ++ (D ε hε (1/2) (by linarith) + |C|) / (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by ++ ring ++ _ = (1/2) * ε + (D ε hε (1/2) (by linarith) + |C|) / ++ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by ++ congr 1 ++ rw [mul_div_assoc, div_self, mul_one] ++ apply integral_log_inv_ne_zero ++ linarith ++ _ ≤ (1/2) * ε + (|D ε hε (1/2) (by linarith)| + |C|) / ++ (∫ (t : ℝ) in Set.Icc 2 x, (log t)⁻¹) := by ++ gcongr ++ apply le_abs_self ++ _ ≤ (1/2) * ε + (1/2) * ε := by ++ rw [abs_div, abs_of_nonneg, abs_of_pos (a := ∫ _ in _, _)] at hB ++ · gcongr ++ · apply integral_log_inv_pos; linarith ++ · positivity ++ _ = ε := by ++ field ++ ++theorem pi_asymp : ++ ∃ c : ℝ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ ++ ∀ᶠ (x : ℝ) in atTop, ++ Nat.primeCounting ⌊x⌋₊ = (1 + c x) * ∫ t in (2 : ℝ)..x, 1 / (log t) := by ++ refine ⟨_, pi_asymp'', ?_⟩ ++ filter_upwards [eventually_ge_atTop 3] with x hx ++ rw [intervalIntegral.integral_of_le (by linarith), ++ ← MeasureTheory.integral_Icc_eq_integral_Ioc] ++ field [(integral_log_inv_pos x (by linarith)).ne'] ++ ++lemma inv_div_log_asy : ∃ c, ∀ᶠ (x : ℝ) in atTop, ++ ∫ (t : ℝ) in Set.Icc 2 x, 1 / log t ^ 2 ≤ c * (x / log x ^ 2) := by ++ have := Chebyshev.integral_one_div_log_sq_isBigO ++ rw [isBigO_iff] at this ++ obtain ⟨c, hc⟩ := this ++ use c ++ filter_upwards [hc, eventually_ge_atTop 2] with x hc hx ++ rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hx] ++ apply le_trans (by apply le_norm_self) ++ nth_rewrite 2 [norm_of_nonneg (by positivity)] at hc ++ exact hc ++ ++lemma integral_log_inv_pialt (x : ℝ) (hx : 4 ≤ x) : ∫ (t : ℝ) in Set.Icc 2 x, 1 / log t = ++ x / log x - 2 / log 2 + ∫ (t : ℝ) in Set.Icc 2 x, 1 / (log t) ^ 2 := by ++ have := integral_log_inv 2 x (by norm_num) (by linarith) ++ rw [MeasureTheory.integral_Icc_eq_integral_Ioc, ++ ← intervalIntegral.integral_of_le (by linarith [hx]), ++ MeasureTheory.integral_Icc_eq_integral_Ioc, ++ ← intervalIntegral.integral_of_le (by linarith [hx]), ++ ← mul_one_div, one_div, ← mul_one_div, one_div] ++ simp only [one_div, this, mul_comm] ++ ++lemma integral_div_log_asymptotic : ∃ c : ℝ → ℝ, c =o[atTop] (fun _ ↦ (1:ℝ)) ∧ ++ ∀ᶠ (x : ℝ) in atTop, ∫ t in Set.Icc 2 x, 1 / (log t) = (1 + c x) * x / (log x) := by ++ obtain ⟨c, hc⟩ := inv_div_log_asy ++ use fun x => ((∫ (t : ℝ) in Set.Icc 2 x, 1 / log t ^ 2) - 2 / log 2) * log x / x ++ constructor ++ · simp_rw [mul_div_assoc, mul_comm] ++ apply isLittleO_mul_iff_isLittleO_div _|>.mpr ++ · simp_rw [one_div_div] ++ apply IsLittleO.sub ++ · apply IsBigO.trans_isLittleO (g := (fun x ↦ x / log x ^ 2)) ++ · rw [isBigO_iff] ++ use c ++ filter_upwards [eventually_ge_atTop 2, hc] with x hx hc ++ simp only [norm_eq_abs] ++ rwa [abs_of_nonneg, abs_of_nonneg] ++ · bound ++ · apply setIntegral_nonneg measurableSet_Icc fun t ht ↦ (by bound) ++ apply isLittleO_of_tendsto ++ · simp ++ apply tendsto_log_atTop.inv_tendsto_atTop.congr' ++ filter_upwards [eventually_ne_atTop 0] with x hx ++ simp only [Pi.inv_apply] ++ field ++ apply isLittleO_mul_iff_isLittleO_div _|>.mp ++ · conv => arg 2; ext; rw [mul_comm] ++ apply IsLittleO.const_mul_left isLittleO_log_id_atTop ++ · filter_upwards [eventually_ge_atTop 2] with x hx ++ simp; grind ++ filter_upwards [eventually_ge_atTop 2] with x hx ++ simp ++ grind ++ · filter_upwards [eventually_ge_atTop 4] with x hx ++ rw [integral_log_inv_pialt x hx] ++ field [show log x ≠ 0 by simp; grind] ++ ++theorem pi_alt : ∃ c : ℝ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ ++ ∀ x : ℝ, Nat.primeCounting ⌊x⌋₊ = (1 + c x) * x / log x := by ++ obtain ⟨f, hf, h⟩ := pi_asymp ++ obtain ⟨f', hf', h'⟩ := integral_div_log_asymptotic ++ use (fun x => (log x / x) * ⌊x⌋₊.primeCounting - 1) ++ constructor ++ · apply IsLittleO.congr' (f₁ := (fun x ↦ f x + f x * f' x + f' x)) _ _ (by rfl) ++ · apply IsLittleO.add _ hf' ++ apply IsLittleO.add hf ++ convert! hf.mul hf' ++ ring ++ · filter_upwards [eventually_ge_atTop 2, h, h'] with x hx h h' ++ rw [h, intervalIntegral.integral_of_le hx, ← integral_Icc_eq_integral_Ioc, h'] ++ have : log x ≠ 0 := by simp; grind ++ field ++ · intro x ++ obtain rfl|hx := eq_or_ne x 0 ++ · simp ++ obtain rfl|hx := eq_or_ne x 1 ++ · simp ++ obtain rfl|hx := eq_or_ne x (-1 : ℝ) ++ · simp ++ norm_num ++ have : log x ≠ 0 := by simp_all ++ field ++ ++theorem pi_alt' : ++ (fun (x : ℝ) ↦ (primeCounting ⌊x⌋₊ : ℝ)) ~[atTop] (fun x ↦ x / log x) := by ++ obtain ⟨f, ⟨hf1, hf2⟩⟩ := pi_alt ++ simp_rw [hf2, IsEquivalent] ++ have : ((fun x ↦ (1 + f x) * x / log x) - fun x ↦ x / log x) = ++ (fun x ↦ f x * x / log x) := by ++ ext ++ simp ++ ring ++ rw [this] ++ convert hf1.mul_isBigO (f₂ := (fun x ↦ x / log x)) (g₂ := (fun x ↦ x /log x)) ++ (isBigO_refl ..) using 2 ++ all_goals ring ++ ++lemma pi_nth_prime (n : ℕ) : ++ primeCounting (nth_prime n) = n + 1 := by ++ rw [primeCounting, primeCounting', count_nth_succ_of_infinite infinite_setOfPred_prime] ++ ++lemma tendsto_nth_prime_atTop : Tendsto nth_prime atTop atTop := ++ nth_strictMono infinite_setOfPred_prime |>.tendsto_atTop ++ ++lemma pi_nth_prime_asymp : ++ (fun n ↦ (nth_prime n) / (log (nth_prime n))) ~[atTop] (fun (n : ℕ) ↦ (n : ℝ)) := by ++ trans (fun (n : ℕ) ↦ ( n + 1 : ℝ)) ++ · have : Tendsto (fun n ↦ ((nth_prime n) : ℝ)) atTop atTop := by ++ apply tendsto_natCast_atTop_iff.mpr tendsto_nth_prime_atTop ++ convert! pi_alt'.comp_tendsto this |>.symm ++ simp only [Function.comp_apply, floor_natCast] ++ rw [pi_nth_prime] ++ norm_cast ++ · apply IsEquivalent.add_isLittleO (by rfl) ++ exact isLittleO_const_id_atTop (1 : ℝ) |>.natCast_atTop ++ ++lemma log_nth_prime_asymp : (fun n ↦ log (nth_prime n)) ~[atTop] (fun n ↦ log n) := by ++ have := pi_nth_prime_asymp.log tendsto_natCast_atTop_atTop ++ · apply IsEquivalent.trans _ this ++ apply IsEquivalent.congr_right (v := (fun n ↦ log (nth_prime n) - log (log (nth_prime n)))) ++ swap ++ · filter_upwards with n ++ rw [log_div] ++ · exact_mod_cast prime_nth_prime n |>.ne_zero ++ · apply log_ne_zero.mpr ⟨?_, ?_, ?_⟩ ++ <;> norm_cast<;> linarith [prime_nth_prime n |>.two_le] ++ symm ++ apply IsEquivalent.sub_isLittleO (by rfl) ++ apply IsLittleO.comp_tendsto isLittleO_log_id_atTop ++ have : Tendsto (fun n ↦ ((nth_prime n) : ℝ)) atTop atTop := by ++ apply tendsto_natCast_atTop_iff.mpr tendsto_nth_prime_atTop ++ apply tendsto_log_atTop.comp this ++ ++lemma nth_prime_asymp : (fun n ↦ ((nth_prime n) : ℝ)) ~[atTop] (fun n ↦ n * log n) := by ++ have := pi_nth_prime_asymp.mul log_nth_prime_asymp ++ convert! this using 1 ++ ext n ++ simp only [Pi.mul_apply] ++ have : log (nth_prime n) ≠ 0 :=by ++ apply log_ne_zero.mpr ⟨?_, ?_, ?_⟩ ++ <;> norm_cast<;> linarith [prime_nth_prime n |>.two_le] ++ field ++ ++theorem pn_asymptotic : ∃ c : ℕ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ ++ ∀ n : ℕ, n > 1 → nth_prime n = (1 + c n) * n * log n := by ++ let c : ℕ → ℝ := fun n ↦ (nth_prime n) / (n * log n) - 1 ++ refine ⟨c, ?_, ?_⟩ ++ swap ++ · intro n hn ++ have : log n ≠ 0 := by rw [Real.log_ne_zero]; rify at hn; grind ++ simp [c] ++ field_simp ++ apply isLittleO_of_tendsto ++ · simp ++ simp only [div_one] ++ unfold c ++ have := isEquivalent_iff_tendsto_one ?_|>.mp nth_prime_asymp ++ swap ++ · filter_upwards [eventually_ge_atTop 2] with n hn ++ simp ++ norm_cast ++ grind ++ convert! this.add_const (-1 : ℝ) using 2 ++ norm_num ++ ++theorem pn_pn_plus_one : ∃ c : ℕ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ ++ ∀ n : ℕ, nth_prime (n + 1) - nth_prime n = (c n) * nth_prime n := by ++ use (fun n => (nth_prime (n+1) - nth_prime n) / nth_prime n) ++ refine ⟨?_, ?_⟩ ++ · obtain ⟨k, k_o1, p_n_eq⟩ := pn_asymptotic ++ simp only [isLittleO_one_iff] ++ rw [Filter.tendsto_congr' (f₂ := fun n ↦ ++ ((1 + k (n+1))*(n+1)*log (n+1) - (1 + k n)*n*log n) / ((1 + k n)*n*log n))] ++ swap ++ · simp only [EventuallyEq, eventually_atTop] ++ use 2; intro n hn ++ rw [p_n_eq n (by linarith), p_n_eq (n+1) (by linarith)] ++ grind ++ simp_rw [sub_div] ++ have zero_eq_minus: (0 : ℝ) = 1 - 1 := by ++ simp ++ rw [zero_eq_minus] ++ apply Filter.Tendsto.sub ++ · conv => ++ arg 1 ++ intro n ++ equals ((1 + k (n + 1)) / (1 + k n) ) * ((↑n + 1) * log (↑n + 1) / (↑n * log ↑n)) => ++ field_simp ++ nth_rw 6 [← (one_mul 1)] ++ apply Filter.Tendsto.mul ++ · have one_div: nhds 1 = nhds ((1: ℝ) / 1) := by simp ++ rw [one_div] ++ apply Filter.Tendsto.div ++ · nth_rw 3 [← (AddMonoid.add_zero 1)] ++ apply Filter.Tendsto.add ++ · simp ++ · rw [Filter.tendsto_add_atTop_iff_nat] ++ rw [Asymptotics.isLittleO_iff_tendsto] at k_o1 ++ · simp only [div_one] at k_o1 ++ exact k_o1 ++ · simp ++ · nth_rw 2 [← (AddMonoid.add_zero 1)] ++ apply Filter.Tendsto.add ++ · simp ++ · rw [Asymptotics.isLittleO_iff_tendsto] at k_o1 ++ · simp only [div_one] at k_o1 ++ exact k_o1 ++ · simp ++ ++ simp ++ · conv => ++ arg 1 ++ intro x ++ equals ((↑x + 1) / x) * (log (↑x + 1) / (log ↑x)) => ++ field_simp ++ nth_rw 3 [← (one_mul 1)] ++ apply Filter.Tendsto.mul ++ · simp_rw [add_div] ++ nth_rw 2 [← (AddMonoid.add_zero 1)] ++ apply Filter.Tendsto.add ++ · rw [← Filter.tendsto_add_atTop_iff_nat 1] ++ field_simp ++ simp ++ · simp only [one_div] ++ exact tendsto_inv_atTop_nhds_zero_nat ++ · have log_eq: ∀ (n: ℕ), log (↑n + 1) = log ↑n + log (1 + 1/n) := by ++ intro n ++ by_cases n_eq_zero: n = 0 ++ · simp [n_eq_zero] ++ · calc ++ _ = log (n * (1 + 1 / n)) := by field_simp ++ _ = log n + log (1 + 1/n) := by ++ rw [Real.log_mul] ++ · simpa ++ · simp only [one_div, ne_eq] ++ positivity ++ ++ simp_rw [log_eq] ++ simp_rw [add_div] ++ nth_rw 3 [← (AddMonoid.add_zero 1)] ++ apply Filter.Tendsto.add ++ · rw [← Filter.tendsto_add_atTop_iff_nat 2] ++ have log_not_zero: ∀ n: ℕ, log (n + 2) ≠ 0 := by ++ intro n ++ simp only [ne_eq, log_eq_zero, not_or] ++ refine ⟨?_, ?_, ?_⟩ ++ · norm_cast ++ · norm_cast ++ simp ++ · norm_cast ++ simp [log_not_zero] ++ · rw [← Filter.tendsto_add_atTop_iff_nat 2] ++ apply squeeze_zero (g := fun (n: ℕ) => (log 2 / log (n + 2))) ++ · intro n ++ have log_plus_nonzero: 0 ≤ log (1 + 1 / ↑(n + 2)) := by ++ apply log_nonneg ++ simp only [cast_add, cast_ofNat, one_div, le_add_iff_nonneg_right, inv_nonneg] ++ norm_cast ++ simp only [le_add_iff_nonneg_left, _root_.zero_le] ++ exact div_nonneg log_plus_nonzero (log_natCast_nonneg (n + 2)) ++ · intro n ++ norm_cast ++ have log_le_2: log (1 + 1 / ↑(n + 2)) ≤ log 2 := by ++ apply Real.log_le_log ++ · positivity ++ · have two_eq_one_plus_one: (2 : ℝ) = 1 + 1 := by ++ norm_num ++ rw [two_eq_one_plus_one] ++ simp only [cast_add, cast_ofNat, one_div, add_le_add_iff_left, ge_iff_le] ++ apply inv_le_one_of_one_le₀ ++ linarith ++ ++ rw [div_le_div_iff_of_pos_right] ++ · exact log_le_2 ++ · apply Real.log_pos ++ norm_cast ++ simp ++ · apply Filter.Tendsto.div_atTop (l := atTop) (a := log 2) ++ · simp ++ · norm_cast ++ have shift_fn := ++ Filter.tendsto_add_atTop_iff_nat (f := fun n => log (n)) (l := atTop) 2 ++ rw [shift_fn] ++ apply Filter.Tendsto.comp Real.tendsto_log_atTop ++ exact tendsto_natCast_atTop_atTop ++ ++ · have eventually_nonzero: ∃ t, t > 2 ∧ ∀ n, 1 + k (n + t) ≠ 0 := by ++ rw [Asymptotics.isLittleO_iff_tendsto] at k_o1 ++ · rw [NormedAddGroup.tendsto_nhds_zero] at k_o1 ++ specialize k_o1 ((1 : ℝ) / 2) ++ simp only [one_div, gt_iff_lt, inv_pos, ofNat_pos, div_one, norm_eq_abs, eventually_atTop, forall_const] at k_o1 ++ obtain ⟨a, ha⟩ := k_o1 ++ use (a + 3) ++ refine ⟨by simp, ?_⟩ ++ intro n ++ specialize ha (n + (a + 3)) ++ have a_le_plus: a ≤ n + (a + 3) := by omega ++ simp only [a_le_plus, forall_const] at ha ++ ++ by_contra! ++ rw [add_eq_zero_iff_eq_neg] at this ++ rw [← abs_neg] at ha ++ rw [← this] at ha ++ simp only [abs_one] at ha ++ have two_inv_lt := inv_lt_one_of_one_lt₀ (a := (2 : ℝ)) (by simp) ++ linarith ++ · simp ++ ++ obtain ⟨t, t_gt_2, ht⟩ := eventually_nonzero ++ rw [← Filter.tendsto_add_atTop_iff_nat t] ++ have denom_nonzero: ∀ n, ((1 + k (n + t)) * ↑(n + t) * log ↑(n + t)) ≠ 0 := by ++ intro n ++ simp only [cast_add, ne_eq, _root_.mul_eq_zero, log_eq_zero, not_or] ++ refine ⟨⟨?_, ?_⟩, ?_, ?_⟩ ++ · exact ht n ++ · norm_cast ++ omega ++ · norm_cast ++ omega ++ · refine ⟨?_, by norm_cast⟩ ++ norm_cast ++ omega ++ conv => ++ arg 1 ++ intro n ++ rw [div_self (denom_nonzero n)] ++ simp ++ · intro n ++ have nth_nonzero: nth_prime n ≠ 0 := by ++ exact Nat.Prime.ne_zero (prime_nth_prime n) ++ simp [nth_nonzero] ++ ++lemma prime_in_gap' (a b : ℕ) (h : a.primeCounting < b.primeCounting) ++ : ∃ (p : ℕ), p.Prime ∧ (a + 1) ≤ p ∧ p < (b + 1) := by ++ obtain ⟨p, hp, pp⟩ := exists_of_count_lt_count h ++ exact ⟨p, pp, hp.left, hp.right⟩ ++ ++lemma prime_in_gap (a b : ℝ) (ha : 0 < a) ++ (h : ⌊a⌋₊.primeCounting < ⌊b⌋₊.primeCounting) ++ : ∃(p : ℕ), p.Prime ∧ a < p ∧ p ≤ b := by ++ ++ have hab : ⌊a⌋₊ < ⌊b⌋₊ := Monotone.reflect_lt Nat.monotone_primeCounting h ++ obtain ⟨w, h, ha, hb⟩ := prime_in_gap' ⌊a⌋₊ ⌊b⌋₊ h ++ refine ⟨w, h, lt_of_floor_lt ha, ?_⟩ ++ have : a < b := by ++ by_contra h ++ cases lt_or_eq_of_le <| le_of_not_gt h with ++ | inl hh => linarith [floor_le_floor <| le_of_lt hh] ++ | inr hh => ++ rw [hh] at hab ++ rwa [←lt_self_iff_false ⌊a⌋₊] ++ by_contra h ++ have : ⌊b⌋₊ < w := floor_lt (by linarith) |>.mpr (lt_of_not_ge h) ++ have : ⌊b⌋₊ + 1 ≤ w := by linarith ++ linarith ++ ++lemma bound_f_second_term (f : ℝ → ℝ) (hf : Tendsto f atTop (nhds 0)) (δ : ℝ) (hδ : δ > 0) : ++ ∀ᶠ x : ℝ in atTop, (1 + f x) < (1 + δ) := by ++ have bound_one_plus_f: ∀ y: ℝ, ∀ z: ℝ, |f y| < z → 1 + (f y) < 1 + z := by ++ intro y z hf ++ by_cases f_pos: 0 < f y ++ · rw [abs_of_pos f_pos] at hf ++ linarith ++ · rw [not_lt] at f_pos ++ rw [abs_of_nonpos f_pos] at hf ++ linarith ++ ++ have f_small := NormedAddGroup.tendsto_nhds_zero.mp hf δ hδ ++ simp only [norm_eq_abs, eventually_atTop] at f_small ++ obtain ⟨p, hp⟩ := f_small ++ ++ let a := ((max 1 p) : ℝ) ++ have ha: ∀ b: ℝ, a ≤ b → |f b| < δ := by ++ intro b hb ++ have b_ge_p: p ≤ b := by ++ have a_ge_p: p ≤ a := by simp [a] ++ linarith ++ exact hp b b_ge_p ++ ++ rw [Filter.eventually_atTop] ++ ++ use a ++ intro b hb ++ exact bound_one_plus_f b δ (ha b (by linarith)) ++ ++lemma bound_f_first_term {ε : ℝ} (hε : 0 < ε) (f : ℝ → ℝ) ++ (hf : Tendsto f atTop (nhds 0)) (δ : ℝ) (hδ : δ > 0) : ++ ∀ᶠ x: ℝ in atTop, (1 + f ((1 + ε) * x)) > (1 - δ) := by ++ have bound_one_plus_f: ∀ y: ℝ, ∀ z: ℝ, |f y| < z → 1 + (f y) > 1 - z := by ++ intro y z hf ++ by_cases f_pos: 0 < f y ++ · rw [abs_of_pos f_pos] at hf ++ linarith ++ · rw [not_lt] at f_pos ++ rw [abs_of_nonpos f_pos] at hf ++ linarith ++ ++ have f_small := NormedAddGroup.tendsto_nhds_zero.mp hf δ hδ ++ simp only [norm_eq_abs, eventually_atTop] at f_small ++ obtain ⟨p, hp⟩ := f_small ++ ++ let a := ((max 1 p) : ℝ) ++ have ha: ∀ b: ℝ, a ≤ b → |f b| < δ := by ++ intro b hb ++ have b_ge_p: p ≤ b := by ++ have a_ge_p: p ≤ a := by simp [a] ++ linarith ++ exact hp b b_ge_p ++ ++ rw [Filter.eventually_atTop] ++ ++ use a ++ intro b hb ++ ++ have a_pos: 0 < a := by ++ simp [a] ++ ++ have pos_mul: ∀ x y z : ℝ, 0 < x → 0 < y → 1 < z → x ≤ y → x < y * z := by ++ intro x y z _ hy hz hlt ++ have y_lt: y < y * z := by ++ exact (lt_mul_iff_one_lt_right hy).mpr hz ++ linarith ++ ++ have mul_increase: a ≤ (1 + ε) * b := by ++ simp only [ a] at hb ++ have a_le := pos_mul a b (1 + ε) a_pos (by linarith) (by linarith) (by linarith) ++ linarith ++ ++ exact bound_one_plus_f ((1 + ε) * b) δ (ha ((1 + ε) * b) mul_increase) ++ ++lemma smaller_terms {ε : ℝ} (hε : 0 < ε) (f : ℝ → ℝ) (hf : Tendsto f atTop (nhds 0)) (δ : ℝ) ++ (hδ : δ > 0) : ++ ∀ᶠ x : ℝ in atTop, (1 - δ) * ((1 + ε) * x / (Real.log ((1 + ε) * x))) < ++ (1 + f ((1 + ε) * x)) * ((1 + ε) * x / (Real.log ((1 + ε) * x))) := by ++ have first_term := bound_f_first_term hε f hf δ hδ ++ simp only [gt_iff_lt, eventually_atTop] at first_term ++ obtain ⟨p, hp⟩ := first_term ++ simp only [eventually_atTop] ++ let a := max p 1 ++ have ha: ∀ (b : ℝ), a ≤ b → 1 - δ < 1 + f ((1 + ε) * b) := by ++ intro b hb ++ have a_ge_p: p ≤ a := by ++ simp [a] ++ specialize hp b (by linarith) ++ exact hp ++ use a ++ intro b hb ++ rw [mul_lt_mul_iff_left₀] ++ · exact ha b hb ++ · simp only [sup_le_iff, a] at hb ++ have b_ge_one: 1 ≤ b := hb.2 ++ have log_pos: Real.log ((1 + ε) *b) > 0 := by ++ have one_pplus_pos: 1 < (1 + ε) := by linarith ++ refine (Real.log_pos_iff ?_).mpr ?_ ++ · positivity ++ · exact one_lt_mul_of_lt_of_le one_pplus_pos b_ge_one ++ ++ positivity ++ ++lemma second_smaller_terms (f : ℝ → ℝ) (hf : Tendsto f atTop (nhds 0)) (δ : ℝ) (hδ : δ > 0) : ++ ∀ᶠ x : ℝ in atTop, ++ (1 + δ) * (x / Real.log x) > (1 + f x) * (x / Real.log x) := by ++ have first_term := bound_f_second_term f hf δ hδ ++ ++ simp only [_root_.add_lt_add_iff_left, eventually_atTop] at first_term ++ obtain ⟨p, hp⟩ := first_term ++ simp only [gt_iff_lt, eventually_atTop] ++ let a := max p 2 ++ have ha: ∀ (b : ℝ), a ≤ b → 1 + δ > 1 + f ( b) := by ++ intro b hb ++ have a_ge_p: p <= a := by simp [a] ++ specialize hp b (by linarith) ++ linarith ++ use a ++ intro b hb ++ specialize ha b hb ++ have rhs_nonzero: b / log ( b) > 0 := by ++ simp only [sup_le_iff, a] at hb ++ obtain ⟨_, hb2⟩ := hb ++ have log_pos: Real.log (b) > 0 := by ++ refine (Real.log_pos_iff ?_).mpr ?_ ++ · positivity ++ · linarith ++ positivity ++ rw [mul_lt_mul_iff_left₀] ++ · exact ha ++ · linarith ++ ++lemma x_log_x_atTop : Filter.Tendsto (fun x => x / Real.log x) Filter.atTop Filter.atTop := by ++ have inv_log_x_div := Filter.Tendsto.comp (f := fun x => Real.log x / x) (g := fun x => x⁻¹) ++ (x := Filter.atTop) (y := (nhdsWithin 0 (Set.Ioi 0))) (z := Filter.atTop) ?_ ?_ ++ · simp_rw [Function.comp_def, inv_div] at inv_log_x_div ++ exact inv_log_x_div ++ · exact tendsto_inv_nhdsGT_zero (𝕜 := ℝ) ++ · rw [tendsto_nhdsWithin_iff] ++ refine ⟨?_, ?_⟩ ++ · have log_div_x := Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 (by simp) ++ simp only [pow_one, one_mul, add_zero] at log_div_x ++ exact log_div_x ++ · simp only [Set.mem_Ioi, eventually_atTop] ++ use 2 ++ intro x hx ++ have log_pos: 0 < Real.log x := by ++ refine (Real.log_pos_iff ?_).mpr ?_ <;> linarith ++ positivity ++ ++lemma tendsto_by_squeeze (ε : ℝ) (hε : ε > 0) : ++ Tendsto (fun (x : ℝ) => (Nat.primeCounting ⌊(1 + ε) * x⌋₊ : ℝ) - ++ (Nat.primeCounting ⌊x⌋₊ : ℝ)) atTop atTop := by ++ obtain ⟨c, hc, pi_x_eq⟩ := pi_alt ++ rw [Asymptotics.isLittleO_iff_tendsto (by simp)] at hc ++ conv => ++ arg 1 ++ intro x ++ rw [pi_x_eq] ++ rw [pi_x_eq] ++ simp only [div_one] at hc ++ ++ let d: ℝ := ε/(2*(2 + ε)) ++ have hd: 0 < d := by positivity ++ have first_helper := smaller_terms hε c hc (d) hd ++ have second_helper := second_smaller_terms c hc d hd ++ ++ apply Filter.tendsto_atTop_mono' (f₁ := fun x => ( ++ ((1 - d) * ((1 + ε) * x / log ((1 + ε) * x))) ++ - ++ ((1 + d) * (x / log x))) ++ ) ++ · rw [Filter.EventuallyLE] ++ ++ simp only [eventually_atTop] at first_helper ++ simp only [gt_iff_lt, eventually_atTop] at second_helper ++ ++ obtain ⟨a1, ha1⟩ := first_helper ++ obtain ⟨a2, ha2⟩ := second_helper ++ ++ simp only [eventually_atTop] ++ ++ use (max a1 a2) ++ intro b hb ++ ++ have lt_compare: ∀ a b c d : ℝ, a < c ∧ b > d → a - b ≤ c - d := by ++ intro a b c d h_lt ++ obtain ⟨a_lt, b_gt⟩ := h_lt ++ linarith ++ ++ apply lt_compare ++ simp only [ sup_le_iff] at hb ++ specialize ha1 b hb.1 ++ specialize ha2 b hb.2 ++ field_simp ++ field_simp at ha1 ha2 ++ exact ⟨ha1, ha2⟩ ++ · rw [← Filter.tendsto_comp_val_Ioi_atTop (a := 1)] ++ have log_split: ∀ x: Set.Ioi 1, x.val / log ((1 + ε) * x.val) = ++ x.val / (log (1 + ε) + log (x.val)) := by ++ intro x ++ have x_ge_one: 1 < x.val := Set.mem_Ioi.mp x.property ++ rw [Real.log_mul (by linarith) (by linarith)] ++ ++ have log_factor: ∀ x: Set.Ioi 1, x.val / (log (1 + ε) + log (x.val)) = ++ x.val / ((1 + (log (1 + ε)/(log x.val))) * (log x.val)) := by ++ intro x ++ have : log (x.val) ≠ 0 := by ++ have pos := Real.log_pos x.property ++ linarith ++ field_simp ++ rw [add_comm] ++ ++ conv at log_factor => ++ intro x ++ rhs ++ rw [div_mul_eq_div_mul_one_div] ++ ++ conv => ++ arg 1 ++ intro x ++ lhs ++ rw [mul_div_assoc] ++ rw [log_split x] ++ ++ conv => ++ arg 1 ++ intro x ++ lhs ++ rw [log_factor] ++ ++ suffices Tendsto (fun x : Set.Ioi (1 : ℝ) ↦ (1 - d) * ((1 + ε) * x) / ++ ((1 + log (1 + ε) / log x) * log x) - (1 + d) * x / log x) atTop atTop by ++ field_simp at this ⊢ ++ exact this ++ conv => ++ arg 1 ++ intro x ++ rw [sub_eq_add_neg] ++ rw [← neg_div] ++ rw [div_add_div] ++ · skip ++ tactic => ++ simp only [ne_eq, _root_.mul_eq_zero, log_eq_zero, not_or] ++ have x_pos := x.property ++ simp_rw [Set.Ioi, Set.mem_ofPred_eq] at x_pos ++ refine ⟨?_, by linarith, by linarith, by linarith⟩ ++ have log_num_pos: 0 < log (1 + ε) := by ++ exact Real.log_pos (by linarith) ++ have log_denom_pos: 0 < log x := by ++ exact Real.log_pos x.property ++ positivity ++ tactic => ++ have pos := Real.log_pos (x.property) ++ linarith ++ ++ conv => ++ arg 1 ++ intro x ++ equals ↑x * (log ↑x * ((1 + ε) * (1 - d)) - ++ (1 + log (1 + ε) / log ↑x) * ((1 + d) * log ↑x)) / ++ (log ↑x * ((1 + log (1 + ε) / log ↑x) * log ↑x)) => ++ ring ++ ++ simp only [mul_div_mul_comm] ++ conv => ++ arg 1 ++ intro x ++ rw [mul_comm] ++ ++ apply Filter.Tendsto.pos_mul_atTop (C := (1 + ε) * (1 - d) - (1 + d)) ++ · simp only [d, sub_pos] ++ field_simp ++ ring_nf ++ rw [add_assoc] ++ rw [add_lt_add_iff_left] ++ apply lt_of_sub_pos ++ ring_nf ++ positivity ++ · conv => ++ arg 1 ++ intro x ++ lhs ++ rhs ++ equals (log x.val) * ((1 + log (1 + ε) / log ↑x) * ((1 + d))) => ++ ring ++ ++ simp_rw [← mul_sub] ++ conv => ++ arg 1 ++ intro x ++ rhs ++ rw [mul_comm] ++ ++ simp only [mul_div_mul_comm] ++ conv => ++ arg 1 ++ intro x ++ lhs ++ equals 1 => ++ have log_pos := Real.log_pos x.property ++ field_simp ++ ++ simp only [one_mul] ++ conv => ++ arg 3 ++ equals nhds (((1 + ε) * (1 - d) - (1 + d)) / 1) => simp ++ ++ apply Filter.Tendsto.div ++ · apply Filter.Tendsto.sub ++ · simp ++ · conv => ++ arg 3 ++ equals nhds (1 * (1 + d)) => simp ++ apply Filter.Tendsto.mul ++ · conv => ++ arg 3 ++ equals nhds (1 + 0) => simp ++ apply Filter.Tendsto.add ++ · simp ++ · apply Filter.Tendsto.div_atTop (a := log (1 + ε)) ++ · simp ++ · simp only [tendsto_comp_val_Ioi_atTop] ++ exact tendsto_log_atTop ++ · simp ++ · conv => ++ arg 3 ++ equals nhds (1 + 0) => simp ++ apply Filter.Tendsto.add ++ · simp ++ · apply Filter.Tendsto.div_atTop (a := log (1 + ε)) ++ · simp ++ · simp only [tendsto_comp_val_Ioi_atTop] ++ exact tendsto_log_atTop ++ · simp ++ · let x_div_log (x: ℝ) := x / Real.log x ++ conv => ++ arg 1 ++ equals (fun (x : Set.Ioi 1) => x_div_log x.val) => rfl ++ ++ rw [Filter.tendsto_comp_val_Ioi_atTop (a := 1)] ++ exact x_log_x_atTop ++ ++theorem prime_between {ε : ℝ} (hε : 0 < ε) : ++ ∀ᶠ x : ℝ in atTop, ∃ p : ℕ, Nat.Prime p ∧ x < p ∧ p < (1 + ε) * x := by ++ have squeeze := tendsto_by_squeeze (ε/2) (by linarith) ++ rw [Filter.tendsto_iff_forall_eventually_mem] at squeeze ++ specialize squeeze (Set.Ici 1) (by exact Ici_mem_atTop 1) ++ simp only [Set.mem_Ici, eventually_atTop] at squeeze ++ obtain ⟨a, ha⟩ := squeeze ++ rw [eventually_atTop] ++ use (max a 1) ++ intro b hb ++ rw [sup_le_iff] at hb ++ specialize ha b hb.1 ++ ++ have val_lt : (⌊b⌋₊.primeCounting : ℝ) < ⌊(1 + ε/2) * b⌋₊.primeCounting := by linarith ++ norm_cast at val_lt ++ ++ have jump := prime_in_gap b ((1 + ε/2) * b) (by linarith) val_lt ++ obtain ⟨p, hp, b_lt_p, p_le⟩ := jump ++ have p_lt: p < (1 + ε) * b := by ++ linarith ++ use p ++ ++theorem sum_mobius_div_self_le (N : ℕ) : |∑ n ∈ range N, μ n / (n : ℚ)| ≤ 1 := by ++ cases N with ++ | zero => simp only [range_zero, sum_empty, abs_zero, zero_le_one] ++ | succ N => ++ ++ obtain rfl | hN := N.eq_zero_or_pos ++ · simp ++ ++ have h_sum : 1 = (∑ d ∈ range (N + 1), (μ d / d : ℚ)) * N - ∑ d ∈ range (N + 1), ++ μ d * Int.fract (N / d : ℚ) := calc ++ (1 : ℚ) = ∑ m ∈ Ioc 0 N, ∑ d ∈ m.divisors, μ d := by ++ have (x : ℕ) (hx : x ∈ Ioc 0 N) : ∑ d ∈ divisors x, μ d = if x = 1 then 1 else 0 := by ++ rw [mem_Ioc] at hx ++ rw [← coe_mul_zeta_apply, moebius_mul_coe_zeta, one_apply] ++ rw [sum_congr rfl this] ++ simp [hN.ne'] ++ _ = ∑ d ∈ range (N + 1), μ d * (N / d : ℕ) := by ++ simp_rw [← coe_mul_zeta_apply, ArithmeticFunction.sum_Ioc_mul_zeta_eq_sum] ++ rw [range_eq_Ico, ← Finset.insert_Ico_add_one_left_eq_Ico (add_one_pos _), ++ sum_insert (by simp), Ico_add_one_add_one_eq_Ioc] ++ simp ++ _ = ∑ d ∈ range (N + 1), (μ d : ℚ) * ⌊(N / d : ℚ)⌋ := by ++ simp_rw [Rat.floor_natCast_div_natCast] ++ simp [← Int.natCast_ediv] ++ _ = (∑ d ∈ range (N + 1), (μ d / d : ℚ)) * N - ∑ d ∈ range (N + 1), ++ μ d * Int.fract (N / d : ℚ) := by ++ simp_rw [sum_mul, ← sum_sub_distrib, mul_comm_div, ← mul_sub, Int.self_sub_fract] ++ rw [eq_sub_iff_add_eq, eq_comm, ← eq_div_iff (by norm_num [Nat.pos_iff_ne_zero.mp hN])] at h_sum ++ ++ have hf' (d : ℕ) : |Int.fract ((N : ℚ) / d)| < 1 := by ++ rw [abs_of_nonneg (Int.fract_nonneg _)] ++ exact Int.fract_lt_one _ ++ have h_bound : |∑ d ∈ range (N + 1), μ d * Int.fract ((N : ℚ) / d)| ≤ N - 1 := by ++ ++ rw [range_eq_Ico, ← Finset.insert_Ico_add_one_left_eq_Ico (by simp), sum_insert (by simp), ++ ArithmeticFunction.map_zero, Int.cast_zero, zero_mul, zero_add, ++ Finset.Ico_add_one_right_eq_Icc, zero_add] ++ ++ rw [← Ico_insert_right hN, sum_insert (by simp), div_self (by simp; grind), Int.fract_one, ++ mul_zero, zero_add] ++ ++ have (d : ℕ) : |μ d * Int.fract ((N : ℚ) / d)| ≤ 1 := by ++ rw [abs_mul, ← one_mul 1] ++ refine mul_le_mul ?_ (hf' _).le (abs_nonneg _) zero_le_one ++ norm_cast ++ exact abs_moebius_le_one ++ apply (abs_sum_le_sum_abs _ _).trans ++ apply (sum_le_sum fun d _ ↦ this d).trans ++ simp [cast_sub (one_le_iff_ne_zero.mpr hN.ne')] ++ ++ rw [h_sum, abs_le] ++ rw [abs_le, neg_sub] at h_bound ++ constructor ++ <;> simp only [le_div_iff₀, div_le_iff₀, cast_pos.mpr hN] ++ <;> linarith [h_bound.left] ++ ++lemma sum_mobius_mul_floor (x : ℝ) (hx : 1 ≤ x) : ++ ∑ n ∈ Iic ⌊x⌋₊, (ArithmeticFunction.moebius n : ℝ) * (⌊x/n⌋ : ℝ) = 1 := by ++ norm_cast ++ convert ArithmeticFunction.sum_Ioc_mul_zeta_eq_sum μ ⌊x⌋₊ |>.symm using 1 ++ · rw [Iic_eq_Icc, bot_eq_zero, ← add_sum_Ioc_eq_sum_Icc (by simp)] ++ simp only [ArithmeticFunction.map_zero, CharP.cast_eq_zero, div_zero, Int.floor_zero, mul_zero, ++ zero_add, Int.natCast_ediv] ++ refine sum_congr rfl fun n hn ↦ ?_ ++ congr ++ norm_cast ++ rw [← floor_div_natCast, Int.natCast_floor_eq_floor] ++ positivity ++ · simpa [moebius_mul_coe_zeta, one_apply] ++ ++noncomputable def mu_log : ArithmeticFunction ℝ := ++ ⟨(fun n ↦ μ n * ArithmeticFunction.log n), (by simp)⟩ ++ ++lemma mu_log_apply (n : ℕ) : mu_log n = μ n * ArithmeticFunction.log n := by ++ rfl ++ ++lemma mu_log_mul_zeta : mu_log * ArithmeticFunction.zeta = -Λ := by ++ ext n ++ rw [coe_mul_zeta_apply] ++ simp_rw [mu_log_apply] ++ rw [sum_moebius_mul_log_eq] ++ rfl ++ ++lemma mu_log_eq_mu_mul_neg_lambda : mu_log = μ * -Λ := by ++ rw [← mu_log_mul_zeta, mul_comm, mul_assoc, coe_zeta_mul_coe_moebius, mul_one] ++ ++lemma sum_mu_Lambda (x : ℝ) : ∑ n ∈ Iic ⌊x⌋₊, (μ n : ℝ) * log n = - ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x/k) := by ++ rw [Iic_eq_Icc, bot_eq_zero, ← add_sum_Ioc_eq_sum_Icc (by simp), ← add_sum_Ioc_eq_sum_Icc (by simp)] ++ simp only [ArithmeticFunction.map_zero, Int.cast_zero, CharP.cast_eq_zero, log_zero, mul_zero, ++ zero_add, div_zero, zero_mul] ++ simp_rw [← log_apply, ← mu_log_apply, mu_log_eq_mu_mul_neg_lambda] ++ rw [sum_Ioc_mul_eq_sum_sum, ← sum_neg_distrib] ++ refine sum_congr rfl fun n hn ↦ ?_ ++ simp_rw [ArithmeticFunction.neg_apply, sum_neg_distrib] ++ ring_nf ++ congr 2 ++ unfold Psi ++ congr ++ rw [← floor_div_natCast] ++ rfl ++ ++lemma M_log_identity (x : ℝ) (hx : 1 ≤ x) : M x * log x = ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (log (x/k) - Psi (x/k)) := by ++ have h_log_identity : ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k) = (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ)) * Real.log x - ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k := by ++ rw [Finset.sum_mul _ _ _] ++ rw [← Finset.sum_sub_distrib] ; refine Finset.sum_congr rfl fun i hi => ?_ ; by_cases hi' : i = 0 <;> simp +decide [*, Real.log_div, ne_of_gt (zero_lt_one.trans_le hx)] ; ring ++ generalize_proofs at * ++ have h_log_identity' : ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k = -∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x / k) := by ++ convert sum_mu_Lambda x using 1 ++ have h_psi_identity : ++ (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x / k)) = ++ -∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k := by ++ simpa [neg_neg] using (congrArg Neg.neg h_log_identity').symm ++ unfold M ++ symm ++ calc ++ (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (Real.log (x / k) - Psi (x / k))) = ++ (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k)) - ++ ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x / k) := by ++ simp [mul_sub, Finset.sum_sub_distrib] ++ _ = ((∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ)) * Real.log x - ++ ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k) - ++ ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Psi (x / k) := by ++ simp [h_log_identity] ++ _ = ((∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ)) * Real.log x - ++ ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k) - ++ (-∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log k) := by ++ simp [h_psi_identity] ++ _ = (∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ)) * Real.log x := by ring ++ ++noncomputable def R (x : ℝ) : ℝ := Psi x - x ++ ++lemma R_isLittleO : R =o[atTop] id := by ++ have h_pnt : (fun x => Psi x - x) =o[atTop] (fun x => x) := by ++ have h_psi : (fun x => Psi x) ~[atTop] (fun x => x) := by ++ simpa [Psi] using! WeakPNT'' ++ exact h_psi ++ convert! h_pnt using 1 ++ ++lemma sum_mobius_div_isBigO : (fun x : ℝ => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (x / k)) =O[atTop] id := by ++ have h_abs : ∀ x : ℝ, 1 ≤ x → |∑ n ∈ Iic ⌊x⌋₊, (μ n : ℝ) / n| ≤ 1 := by ++ intros x hx ++ have h_sum : ∑ n ∈ Finset.Iic ⌊x⌋₊, (μ n : ℝ) / n = ∑ n ∈ Finset.range (⌊x⌋₊ + 1), (μ n : ℝ) / n := by ++ rw [Finset.range_eq_Ico] ; rfl ++ have := sum_mobius_div_self_le (⌊x⌋₊ + 1) ; simp_all +decide [Finset.sum_range_succ'] ++ norm_cast at * ++ rw [Asymptotics.isBigO_iff] ++ use 1; filter_upwards [Filter.eventually_ge_atTop 1] with x hx; simp_all +decide [div_eq_mul_inv, mul_assoc, mul_comm] ++ simpa only [← Finset.mul_sum _ _ _, abs_mul] using mul_le_of_le_one_right (abs_nonneg x) (h_abs x hx) ++ ++lemma sum_log_div_isBigO : (fun x : ℝ => ∑ k ∈ Iic ⌊x⌋₊, log (x / k)) =O[atTop] id := by ++ have h_sum_log : ∀ x : ℝ, 1 ≤ x → |∑ k ∈ Finset.Iic ⌊x⌋₊, Real.log (x / k)| ≤ 2 * x := by ++ have h_sum_log_le_x : ∀ x : ℝ, 1 ≤ x → ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, Real.log (x / k) ≤ x := by ++ intro x hx ++ have h_sum_log : ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, Real.log (x / (k : ℝ)) ≤ Real.log (x ^ ⌊x⌋₊ / Nat.factorial ⌊x⌋₊) := by ++ rw [← Real.log_prod] ++ · norm_num [Finset.prod_div_distrib] ++ erw [← Nat.cast_prod, Finset.prod_Ico_id_eq_factorial] ++ · exact fun n hn => div_ne_zero (by positivity) (Nat.cast_ne_zero.mpr <| by linarith [Finset.mem_Icc.mp hn]) ++ have h_exp_bound : x ^ ⌊x⌋₊ / Nat.factorial ⌊x⌋₊ ≤ Real.exp x := by ++ have h_term : x ^ ⌊x⌋₊ / (⌊x⌋₊! : ℝ) ≤ ∑' k : ℕ, x ^ k / (k ! : ℝ) := by ++ exact Summable.le_tsum (show Summable _ from Real.summable_pow_div_factorial x) ⌊x⌋₊ (fun _ _ => by positivity) ++ simpa [Real.exp_eq_exp_ℝ, NormedSpace.exp_eq_tsum_div] using h_term ++ exact h_sum_log.trans (Real.log_le_iff_le_exp (by positivity) |>.2 h_exp_bound) ++ intros x hx ++ have h_sum_eq : ∑ k ∈ Finset.Iic ⌊x⌋₊, Real.log (x / k) = ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, Real.log (x / k) := by ++ erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num ++ erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num ++ rw [abs_of_nonneg] <;> linarith [h_sum_log_le_x x hx, show 0 ≤ ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, Real.log (x / k) from Finset.sum_nonneg fun _ _ => Real.log_nonneg <| by rw [le_div_iff₀ <| Nat.cast_pos.mpr <| by linarith [Finset.mem_Icc.mp ‹_›]] ; linarith [Nat.floor_le <| show 0 ≤ x by linarith, show (↑‹ℕ› : ℝ) ≤ ⌊x⌋₊ by exact_mod_cast Finset.mem_Icc.mp ‹_› |>.2]] ++ rw [Asymptotics.isBigO_iff] ++ exact ⟨2, Filter.eventually_atTop.mpr ⟨1, fun x hx => le_trans (h_sum_log x hx) (by norm_num [abs_of_nonneg (by linarith : 0 ≤ x)])⟩⟩ ++ ++lemma R_locally_bounded (K : ℝ) (hK : 0 ≤ K) : ∃ C, ∀ y ∈ Set.Icc 0 K, |R y| ≤ C := by ++ have hR_bounded : BddAbove (Set.image (fun y => |R y|) (Set.Icc 0 K)) := by ++ have hR_bounded : ∀ y ∈ Set.Icc 0 K, |R y| ≤ ∑ p ∈ Iic ⌊K⌋₊, log p + K := by ++ intro y hy ++ simp only [R, Psi, Chebyshev.psi_eq_sum_Icc] ++ refine abs_sub_le_iff.mpr ⟨?_, ?_⟩ ++ · refine le_trans (sub_le_self _ hy.1) ?_ ++ refine le_trans (Finset.sum_le_sum_of_subset_of_nonneg (Finset.Iic_subset_Iic.mpr <| Nat.floor_mono hy.2) fun ?_ ?_ ?_ => ?_) ?_ ++ · exact vonMangoldt_nonneg ++ · refine le_add_of_le_of_nonneg (Finset.sum_le_sum fun i hi => ?_) hK ++ exact vonMangoldt_le_log ++ · refine le_trans ?_ (le_add_of_nonneg_left ?_) ++ · exact le_trans (sub_le_self _ <| Finset.sum_nonneg fun _ _ => by exact_mod_cast ArithmeticFunction.vonMangoldt_nonneg) hy.2 ++ · exact Finset.sum_nonneg fun _ _ => Real.log_natCast_nonneg _ ++ exact ⟨_, Set.forall_mem_image.2 hR_bounded⟩ ++ exact ⟨hR_bounded.choose, fun y hy => hR_bounded.choose_spec <| Set.mem_image_of_mem _ hy⟩ ++ ++lemma sum_bounded_of_linear_bound {f : ℝ → ℝ} {ε C : ℝ} (hε : 0 ≤ ε) (hC : 0 ≤ C) (h : ∀ y, 1 ≤ y → |f y| ≤ ε * y + C) (x : ℝ) (hx : 1 ≤ x) : ++ ∑ k ∈ Icc 1 ⌊x⌋₊, |f (x / k)| ≤ ε * x * (log x + 1) + C * x := by ++ have h_sum_bound : ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, |f (x / k)| ≤ ε * x * ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, (1 / (k : ℝ)) + C * ⌊x⌋₊ := by ++ have h_sum_bound : ∀ k ∈ Finset.Icc 1 ⌊x⌋₊, |f (x / k)| ≤ ε * x / k + C := by ++ exact fun k hk => by simpa only [mul_div_assoc] using! h (x / k) (by rw [le_div_iff₀ (Nat.cast_pos.mpr <| Finset.mem_Icc.mp hk |>.1)] ; nlinarith [Nat.floor_le (show 0 ≤ x by positivity), show (k : ℝ) ≤ ⌊x⌋₊ by exact_mod_cast Finset.mem_Icc.mp hk |>.2]) ++ convert! Finset.sum_le_sum h_sum_bound using 1 ; norm_num [div_eq_mul_inv, Finset.mul_sum _ _ _, Finset.sum_add_distrib, mul_comm] ++ have h_harmonic : ∀ n : ℕ, 1 ≤ n → ∑ k ∈ Finset.Icc 1 n, (1 / (k : ℝ)) ≤ Real.log n + 1 := by ++ intro n _hn ++ have h := harmonic_le_one_add_log n ++ simpa [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast, ++ one_div, add_comm, add_left_comm, add_assoc] using h ++ have h_harmonic_x : ++ ∑ k ∈ Finset.Icc 1 ⌊x⌋₊, (1 / (k : ℝ)) ≤ Real.log x + 1 := by ++ refine (h_harmonic _ <| Nat.floor_pos.mpr hx).trans ?_ ++ have hlog : Real.log (⌊x⌋₊ : ℝ) ≤ Real.log x := by ++ refine Real.log_le_log (Nat.cast_pos.mpr <| Nat.floor_pos.mpr hx) ?_ ++ exact Nat.floor_le (by positivity) ++ simpa using add_le_add_right hlog 1 ++ have h_term1 : ε * x * (∑ k ∈ Finset.Icc 1 ⌊x⌋₊, (1 / (k : ℝ))) ≤ ε * x * (Real.log x + 1) := by ++ refine mul_le_mul_of_nonneg_left h_harmonic_x ?_ ++ exact mul_nonneg hε (by positivity) ++ have h_term2 : C * (⌊x⌋₊ : ℝ) ≤ C * x := by ++ refine mul_le_mul_of_nonneg_left ?_ hC ++ exact Nat.floor_le (by positivity) ++ exact h_sum_bound.trans (add_le_add h_term1 h_term2) ++ ++lemma sum_abs_R_isLittleO : (fun x : ℝ => ∑ k ∈ Iic ⌊x⌋₊, |R (x / k)|) =o[atTop] (fun x => x * log x) := by ++ have h_eps : ∀ ε > 0, ∃ x₀ : ℝ, ∀ x ≥ x₀, (∑ k ∈ Finset.Icc 1 ⌊x⌋₊, |R (x / k)|) ≤ ε * x * Real.log x := by ++ intro ε hε_pos ++ obtain ⟨A, hA⟩ : ∃ A : ℝ, 0 < A ∧ ∀ y ≥ A, |R y| ≤ (ε / 2) * y := by ++ have := R_isLittleO ++ rw [Asymptotics.isLittleO_iff] at this ++ norm_num at * ++ exact Exists.elim (this (half_pos hε_pos)) fun A hA => ⟨Max.max A 1, by positivity, fun y hy => by simpa only [abs_of_nonneg (by linarith [le_max_right A 1] : 0 ≤ y)] using hA y (le_trans (le_max_left A 1) hy)⟩ ++ obtain ⟨C_A, hC_A⟩ : ∃ C_A : ℝ, ∀ y ∈ Set.Icc 0 A, |R y| ≤ C_A := by ++ exact ⟨_, fun y hy => R_locally_bounded A hA.1.le |> Classical.choose_spec |> fun h => h y hy⟩ ++ have h_sum_bound : ∀ x ≥ max A 2, (∑ k ∈ Finset.Icc 1 ⌊x⌋₊, |R (x / k)|) ≤ (ε / 2) * x * (Real.log x + 1) + C_A * x := by ++ intros x hx ++ have h_sum_bound : ∀ y ≥ 1, |R y| ≤ (ε / 2) * y + C_A := by ++ intros y hy ++ by_cases hyA : y ≥ A ++ · exact le_add_of_le_of_nonneg (hA.right y hyA) (by ++ exact le_trans (abs_nonneg _) (hC_A 0 ⟨by norm_num, by linarith⟩)) ++ · exact le_add_of_nonneg_of_le (by ++ positivity) (hC_A y ⟨by ++ linarith, by ++ linarith⟩) ++ have := sum_bounded_of_linear_bound (show 0 ≤ ε / 2 by positivity) (show 0 ≤ C_A by exact le_trans (abs_nonneg _) (hC_A 0 ⟨by norm_num, by linarith⟩)) (fun y hy => h_sum_bound y hy) x (by linarith [le_max_right A 2]) ; aesop ++ obtain ⟨x₀, hx₀⟩ : ∃ x₀ : ℝ, ∀ x ≥ x₀, (ε / 2) * (Real.log x + 1) + C_A ≤ ε * Real.log x := by ++ exact ⟨Real.exp (2 * (C_A / ε + 1)), fun x hx => by nlinarith [Real.log_exp (2 * (C_A / ε + 1)), Real.log_le_log (by positivity) hx, mul_div_cancel₀ C_A hε_pos.ne']⟩ ++ exact ⟨Max.max x₀ (Max.max A 2), fun x hx => le_trans (h_sum_bound x (le_trans (le_max_right _ _) hx)) (by nlinarith [hx₀ x (le_trans (le_max_left _ _) hx), le_max_right x₀ (Max.max A 2), le_max_left x₀ (Max.max A 2), le_max_right A 2, le_max_left A 2, Real.log_nonneg (show x ≥ 1 by linarith [le_max_right x₀ (Max.max A 2), le_max_left x₀ (Max.max A 2), le_max_right A 2, le_max_left A 2])])⟩ ++ rw [Asymptotics.isLittleO_iff_tendsto'] ++ · have h_sum_eq : ∀ x : ℝ, x ≥ 1 → (∑ k ∈ Finset.Iic ⌊x⌋₊, |R (x / k)|) = (∑ k ∈ Finset.Icc 1 ⌊x⌋₊, |R (x / k)|) := by ++ intro x hx ++ have h0 : (0 : ℕ) ∈ Finset.Iic ⌊x⌋₊ := by simp [Finset.mem_Iic] ++ have hI : (Finset.Iic ⌊x⌋₊).erase 0 = Finset.Icc 1 ⌊x⌋₊ := by ++ ext n ++ simp [Finset.mem_Iic, Finset.mem_Icc, Nat.one_le_iff_ne_zero, and_comm] ++ rw [← Finset.sum_erase_add (Finset.Iic ⌊x⌋₊) (fun k => |R (x / k)|) h0] ++ simp [hI, R, Psi, Chebyshev.psi_eq_sum_Icc] ++ rw [Metric.tendsto_nhds] ++ simp +zetaDelta only [gt_iff_lt, ge_iff_le, dist_zero_right, norm_div, norm_eq_abs, norm_mul, ++ eventually_atTop] at * ++ intro ε hε; obtain ⟨x₀, hx₀⟩ := h_eps (ε / 2) (half_pos hε) ; use Max.max x₀ 2; intro x hx; rw [abs_of_nonneg (Finset.sum_nonneg fun _ _ => abs_nonneg _), abs_of_nonneg (by linarith [le_max_right x₀ 2]), abs_of_nonneg (Real.log_nonneg (by linarith [le_max_right x₀ 2]))] ; rw [div_lt_iff₀] <;> nlinarith [hx₀ x (le_trans (le_max_left x₀ 2) hx), Real.log_pos (by linarith [le_max_right x₀ 2] : 1 < x), mul_pos (by linarith [le_max_right x₀ 2] : 0 < x) (Real.log_pos (by linarith [le_max_right x₀ 2] : 1 < x)), h_sum_eq x (by linarith [le_max_right x₀ 2])] ++ · filter_upwards [Filter.eventually_gt_atTop 1] with x hx hx' using absurd hx' (by nlinarith [Real.log_pos hx]) ++ ++lemma R_linear_bound (ε : ℝ) (hε : 0 < ε) : ∃ C, 0 ≤ C ∧ ∀ y, 1 ≤ y → |R y| ≤ ε * y + C := by ++ obtain ⟨A, hA⟩ : ∃ A : ℝ, 0 < A ∧ ∀ y : ℝ, A ≤ y → |R y| ≤ ε * y := by ++ have := R_isLittleO.def hε ++ rw [Filter.eventually_atTop] at this; rcases this with ⟨A, hA⟩ ; exact ⟨Max.max A 1, by positivity, fun y hy => by simpa [abs_of_nonneg (show 0 ≤ y by linarith [le_max_right A 1])] using hA y (le_trans (le_max_left A 1) hy)⟩ ++ obtain ⟨CA, hCA⟩ : ∃ CA : ℝ, ∀ y ∈ Set.Icc 0 A, |R y| ≤ CA := by ++ exact R_locally_bounded A hA.1.le |> fun ⟨CA, hCA⟩ => ⟨CA, fun y hy => hCA y hy⟩ ++ exact ⟨Max.max CA 0, by positivity, fun y hy => if hy' : y ≤ A then le_trans (hCA y ⟨by linarith, by linarith⟩) (by linarith [le_max_left CA 0, le_max_right CA 0, show 0 ≤ ε * y by nlinarith]) else le_trans (hA.2 y (by linarith)) (by linarith [le_max_left CA 0, le_max_right CA 0, show 0 ≤ ε * y by nlinarith])⟩ ++ ++lemma sum_abs_R_isLittleO' : (fun x : ℝ => ∑ k ∈ Iic ⌊x⌋₊, |R (x / k)|) =o[atTop] (fun x => x * log x) := by ++ apply sum_abs_R_isLittleO ++ ++lemma M_isLittleO : M =o[atTop] id := by ++ have h_identity : ∀ x ≥ 1, M x * Real.log x = ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (Real.log (x / k) - Psi (x / k)) := by ++ exact fun x a => M_log_identity x a ++ have h_term1 : (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k)) =O[atTop] id := by ++ have h_abs : ∀ x ≥ 1, |∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k)| ≤ ∑ k ∈ Iic ⌊x⌋₊, Real.log (x / k) := by ++ intros x hx ++ have h_abs : ∀ k ∈ Iic ⌊x⌋₊, |(μ k : ℝ) * Real.log (x / k)| ≤ Real.log (x / k) := by ++ intros k hk ++ have h_abs : |(μ k : ℝ)| ≤ 1 := by ++ norm_num [ArithmeticFunction.moebius] ++ split_ifs <;> norm_num ++ by_cases hk0 : k = 0 ++ · rw [hk0] ; norm_num [ArithmeticFunction.map_zero, Nat.cast_zero, Real.log_zero, div_zero, abs_zero] ++ · have hx_pos : 0 < x := by positivity ++ have hk_pos : 0 < (k : ℝ) := by positivity ++ rw [Real.log_div hx_pos.ne' hk_pos.ne'] ++ simp only [abs_mul, ge_iff_le] ++ simp_all only [ge_iff_le, mem_Iic] ++ exact le_trans (mul_le_of_le_one_left (abs_nonneg _) h_abs) (by rw [abs_of_nonneg] ; exact sub_nonneg_of_le <| Real.log_le_log hk_pos (Nat.cast_le.mpr hk |>.trans (Nat.floor_le hx_pos.le))) ++ exact le_trans (Finset.abs_sum_le_sum_abs _ _) (Finset.sum_le_sum h_abs) ++ have h_sum_log : (fun x => ∑ k ∈ Iic ⌊x⌋₊, Real.log (x / k)) =O[atTop] id := by ++ convert sum_log_div_isBigO using 1 ++ rw [Asymptotics.isBigO_iff] at * ++ exact ⟨h_sum_log.choose, by filter_upwards [h_sum_log.choose_spec, Filter.eventually_ge_atTop 1] with x hx₁ hx₂ using le_trans (h_abs x hx₂) (le_trans (le_abs_self _) hx₁)⟩ ++ have h_term2 : (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (x / k)) =O[atTop] id := by ++ convert sum_mobius_div_isBigO using 1 ++ have h_term3 : (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * R (x / k)) =o[atTop] (fun x => x * Real.log x) := by ++ have h_abs : ∀ x ≥ 1, |∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * R (x / k)| ≤ ∑ k ∈ Iic ⌊x⌋₊, |R (x / k)| := by ++ intros x hx ++ have h_abs : ∀ k ∈ Iic ⌊x⌋₊, |(μ k : ℝ) * R (x / k)| ≤ |R (x / k)| := by ++ norm_num [abs_mul] ++ intro k hk; exact mul_le_of_le_one_left (abs_nonneg _) (mod_cast by exact abs_moebius_le_one) ++ exact le_trans (Finset.abs_sum_le_sum_abs _ _) (Finset.sum_le_sum h_abs) ++ have h_sum_abs_R : (fun x => ∑ k ∈ Iic ⌊x⌋₊, |R (x / k)|) =o[atTop] (fun x => x * Real.log x) := by ++ exact sum_abs_R_isLittleO ++ rw [Asymptotics.isLittleO_iff] at * ++ intro c hc; filter_upwards [h_sum_abs_R hc, Filter.eventually_ge_atTop 1] with x hx₁ hx₂; exact le_trans (h_abs x hx₂) (le_trans (le_abs_self _) hx₁) ++ have h_combined : (fun x => M x * Real.log x) =o[atTop] (fun x => x * Real.log x) := by ++ have h_combined : (fun x => M x * Real.log x) = (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * Real.log (x / k)) - (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * (x / k)) - (fun x => ∑ k ∈ Iic ⌊x⌋₊, (μ k : ℝ) * R (x / k)) := by ++ ext x; by_cases hx : 1 ≤ x <;> simp_all +decide only [ge_iff_le, mul_sub, sum_sub_distrib, not_le, Pi.sub_apply] ++ · simp +decide [sub_sub, mul_sub, Finset.sum_sub_distrib, Psi, R] ++ · unfold M R; norm_num [Nat.floor_eq_zero.mpr hx] ++ norm_num [Finset.Iic_eq_Icc] ++ rw [h_combined] ++ refine Asymptotics.IsLittleO.sub ?_ h_term3 ++ refine Asymptotics.IsLittleO.sub ?_ ?_ ++ · refine h_term1.trans_isLittleO ?_ ++ rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num ++ · norm_num [← div_div] ++ exact le_trans (Filter.Tendsto.div_atTop (tendsto_const_nhds.congr' (by filter_upwards [Filter.eventually_ne_atTop 0] with x hx; aesop)) (Real.tendsto_log_atTop)) (by norm_num) ++ · exact ⟨2, by rintro x hx (rfl | rfl | rfl) <;> norm_num at hx⟩ ++ · refine h_term2.trans_isLittleO ?_ ++ rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num ++ · norm_num [← div_div] ++ exact le_trans (Filter.Tendsto.div_atTop (tendsto_const_nhds.congr' (by filter_upwards [Filter.eventually_ne_atTop 0] with x hx; aesop)) (Real.tendsto_log_atTop)) (by norm_num) ++ · exact ⟨2, by rintro x hx (rfl | rfl | rfl) <;> linarith⟩ ++ rw [Asymptotics.isLittleO_iff_tendsto'] at * ++ · refine h_combined.congr' (by filter_upwards [Filter.eventually_gt_atTop 1] with x hx using by rw [mul_div_mul_right _ _ (ne_of_gt <| Real.log_pos hx)] ; rfl) ++ · filter_upwards [Filter.eventually_gt_atTop 1] with x hx hx' using absurd hx' <| ne_of_gt <| mul_pos (by positivity) <| Real.log_pos hx ++ · filter_upwards [Filter.eventually_gt_atTop 1] with x hx hx' using by nlinarith [Real.log_pos hx] ++ · filter_upwards [Filter.eventually_gt_atTop 0] with x hx hx' using absurd hx' hx.ne' ++ ++lemma M_isLittleO' : M =o[atTop] id := by ++ exact M_isLittleO ++ ++theorem mu_pnt : (fun x : ℝ ↦ ∑ n ∈ range ⌊x⌋₊, μ n) =o[atTop] fun x ↦ x := by ++ have h_moebius_sum : (fun x : ℝ => ∑ n ∈ Finset.range ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x : ℝ => x) := by ++ have h_bound : (fun x : ℝ => ∑ n ∈ Finset.range ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x : ℝ => x) := by ++ have h_sum : (fun x : ℝ => ∑ n ∈ Finset.range (⌊x⌋₊ + 1), (μ n : ℝ)) =o[atTop] (fun x : ℝ => x) := by ++ have h_moebius_sum : (fun x : ℝ => ∑ n ∈ Finset.Iic ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x : ℝ => x) := by ++ convert! M_isLittleO using 1 ++ simpa only [Finset.range_eq_Ico] using! h_moebius_sum ++ have h_mu_floor : (fun x : ℝ => (μ ⌊x⌋₊ : ℝ)) =o[atTop] (fun x : ℝ => x) := by ++ rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num ++ · refine squeeze_zero_norm (a := fun x : ℝ => 1 / |x|) ?_ ?_ ++ · intro x; norm_num [abs_div] ++ exact mul_le_of_le_one_left (by positivity) (mod_cast by exact abs_moebius_le_one) ++ · exact tendsto_const_nhds.div_atTop (tendsto_norm_atTop_atTop) ++ · exact ⟨1, by intros; linarith⟩ ++ simpa [Finset.sum_range_succ] using h_sum.sub h_mu_floor ++ convert h_bound using 1 ++ rw [Asymptotics.isLittleO_iff] at * ++ simp_all +decide [Norm.norm] ++ ++lemma lambda_eq_sum_sq_dvd_mu (n : ℕ) (hn : n ≠ 0) : ++ ((-1 : ℝ) ^ (Ω n)) = ∑ d ∈ (Icc 1 n).filter (fun d => d^2 ∣ n), (μ (n / d^2) : ℝ) := by ++ set a : ℕ → ℕ := fun p => Nat.factorization n p with ha ++ have hn_factor : n = ∏ p ∈ Nat.primeFactors n, p ^ a p := by ++ exact Eq.symm ( Nat.prod_factorization_pow_eq_self hn ); ++ have h_sum_factor : (∑ d ∈ Finset.filter (fun d => d^2 ∣ n) (Finset.Icc 1 n), (μ (n / d^2) : ℝ)) = (∏ p ∈ Nat.primeFactors n, (∑ d ∈ Finset.range (a p / 2 + 1), (μ (p^(a p - 2 * d)) : ℝ))) := by ++ have h_mult : ∀ {m n : ℕ}, Nat.gcd m n = 1 → (∑ d ∈ Finset.filter (fun d => d^2 ∣ m * n) (Finset.Icc 1 (m * n)), (μ (m * n / d^2) : ℝ)) = (∑ d ∈ Finset.filter (fun d => d^2 ∣ m) (Finset.Icc 1 m), (μ (m / d^2) : ℝ)) * (∑ d ∈ Finset.filter (fun d => d^2 ∣ n) (Finset.Icc 1 n), (μ (n / d^2) : ℝ)) := by ++ intros m n h_coprime ++ have h_filter : Finset.filter (fun d => d^2 ∣ m * n) (Finset.Icc 1 (m * n)) = Finset.image (fun (d : ℕ × ℕ) => d.1 * d.2) (Finset.filter (fun d => d^2 ∣ m) (Finset.Icc 1 m) ×ˢ Finset.filter (fun d => d^2 ∣ n) (Finset.Icc 1 n)) := by ++ ext d ++ simp only [mem_filter, mem_Icc, mem_image, mem_product, Prod.exists] ++ constructor ++ · intro h ++ obtain ⟨d1, d2, hd1, hd2, hd⟩ : ∃ d1 d2 : ℕ, d1^2 ∣ m ∧ d2^2 ∣ n ∧ d = d1 * d2 := by ++ have h_factor : d^2 ∣ m * n → ∃ d1 d2 : ℕ, d1^2 ∣ m ∧ d2^2 ∣ n ∧ d = d1 * d2 := by ++ intro h_div ++ obtain ⟨d1, d2, hd1, hd2, hd⟩ : ∃ d1 d2 : ℕ, d1 ∣ m ∧ d2 ∣ n ∧ d = d1 * d2 := by ++ exact Exists.imp ( by tauto ) ( Nat.dvd_mul.mp ( dvd_of_mul_left_dvd h_div ) ); ++ refine ⟨ d1, d2, ?_, ?_, hd ⟩ ++ · apply Nat.Coprime.dvd_of_dvd_mul_right ++ · exact Nat.Coprime.pow_left 2 (Nat.Coprime.coprime_dvd_left hd1 h_coprime) ++ · exact dvd_trans (pow_dvd_pow_of_dvd (hd.symm ▸ dvd_mul_right _ _) 2) h_div ++ · subst hd ++ apply Nat.Coprime.dvd_of_dvd_mul_left ++ · exact Nat.Coprime.pow_left _ (Nat.Coprime.symm <| Nat.Coprime.coprime_dvd_right hd2 h_coprime) ++ · exact dvd_trans ⟨d1 ^ 2, by ring⟩ h_div ++ exact h_factor h.2; ++ refine ⟨ d1, d2, ?_, ?_ ⟩ <;> norm_num [ hd ] ++ exact ⟨ ⟨ ⟨ Nat.pos_of_ne_zero ( by rintro rfl; linarith ), Nat.le_of_dvd ( Nat.pos_of_ne_zero ( by rintro rfl; linarith ) ) ( dvd_of_mul_left_dvd hd1 ) ⟩, hd1 ⟩, ⟨ Nat.pos_of_ne_zero ( by rintro rfl; linarith ), Nat.le_of_dvd ( Nat.pos_of_ne_zero ( by rintro rfl; linarith ) ) ( dvd_of_mul_left_dvd hd2 ) ⟩, hd2 ⟩; ++ · intro h ++ rcases h with ⟨ a, b, ⟨ ⟨ ⟨ ha₁, ha₂ ⟩, ha₃ ⟩, ⟨ ⟨ hb₁, hb₂ ⟩, hb₃ ⟩ ⟩, rfl ⟩ ; exact ⟨ ⟨ by nlinarith, by nlinarith ⟩, by convert Nat.mul_dvd_mul ha₃ hb₃ using 1 ; ring ⟩ ; ++ rw [ h_filter, Finset.sum_image ]; ++ · rw [ Finset.sum_product, Finset.sum_mul ]; ++ simp +decide only [Finset.mul_sum _ _ _]; ++ refine Finset.sum_congr rfl fun x hx => Finset.sum_congr rfl fun y hy => ?_ ++ rw [show m * n / (x * y) ^ 2 = (m / x ^ 2) * (n / y ^ 2) by ++ have hx' : x ^ 2 ∣ m := by ++ simpa only [sq] using (Finset.mem_filter.mp hx).2 ++ have hy' : y ^ 2 ∣ n := by ++ simpa only [sq] using (Finset.mem_filter.mp hy).2 ++ simpa [mul_pow, mul_assoc, mul_left_comm, mul_comm] using ++ (Nat.div_mul_div_comm (a := m) (b := x ^ 2) (c := n) (d := y ^ 2) hx' hy').symm] ++ norm_cast ++ apply ArithmeticFunction.IsMultiplicative.map_mul_of_coprime; ++ · exact ArithmeticFunction.isMultiplicative_moebius; ++ · exact Nat.Coprime.coprime_dvd_left ( Nat.div_dvd_of_dvd <| Finset.mem_filter.mp hx |>.2 ) <| Nat.Coprime.coprime_dvd_right ( Nat.div_dvd_of_dvd <| Finset.mem_filter.mp hy |>.2 ) h_coprime; ++ · intros x hx y hy; simp +contextual only [ne_eq, coe_product, coe_filter, mem_Icc, Set.mem_prod, Set.mem_ofPred_eq] at *; ++ intro hxy ++ have h_eq1 : x.1 = y.1 := by ++ exact Nat.dvd_antisymm ( by exact Nat.Coprime.dvd_of_dvd_mul_right ( show Nat.Coprime ( x.1 ) ( y.2 ) from Nat.Coprime.coprime_dvd_left ( dvd_of_mul_left_dvd hx.1.2 ) <| Nat.Coprime.coprime_dvd_right ( dvd_of_mul_left_dvd hy.2.2 ) h_coprime ) <| hxy.symm ▸ dvd_mul_right _ _ ) ( by exact Nat.Coprime.dvd_of_dvd_mul_right ( show Nat.Coprime ( y.1 ) ( x.2 ) from Nat.Coprime.coprime_dvd_left ( dvd_of_mul_left_dvd hy.1.2 ) <| Nat.Coprime.coprime_dvd_right ( dvd_of_mul_left_dvd hx.2.2 ) h_coprime ) <| hxy.symm ▸ dvd_mul_right _ _ ) ++ have h_eq2 : x.2 = y.2 := by ++ nlinarith ++ exact Prod.ext h_eq1 h_eq2; ++ have h_prod : (∑ d ∈ Finset.filter (fun d => d^2 ∣ n) (Finset.Icc 1 n), (μ (n / d^2) : ℝ)) = (∏ p ∈ Nat.primeFactors n, (∑ d ∈ Finset.filter (fun d => d^2 ∣ p^(a p)) (Finset.Icc 1 (p^(a p))), (μ (p^(a p) / d^2) : ℝ))) := by ++ have h_prod : ∀ {S : Finset ℕ}, (∀ p ∈ S, Nat.Prime p) → (∑ d ∈ Finset.filter (fun d => d^2 ∣ ∏ p ∈ S, p^(a p)) (Finset.Icc 1 (∏ p ∈ S, p^(a p))), (μ ((∏ p ∈ S, p^(a p)) / d^2) : ℝ)) = (∏ p ∈ S, (∑ d ∈ Finset.filter (fun d => d^2 ∣ p^(a p)) (Finset.Icc 1 (p^(a p))), (μ (p^(a p) / d^2) : ℝ))) := by ++ intro S hS; induction S using Finset.induction <;> norm_num at *; ++ · norm_num [ Finset.sum_filter ]; ++ · rw [ Finset.prod_insert ‹_›, h_mult ]; ++ · rw [ Finset.prod_insert ‹_›, ‹ ( ∀ p ∈ _, Nat.Prime p ) → ∑ d ∈ Finset.Icc 1 ( ∏ p ∈ _, p ^ a p ) with d ^ 2 ∣ ∏ p ∈ _, p ^ a p, ( μ ( ( ∏ p ∈ _, p ^ a p ) / d ^ 2 ) : ℝ ) = ∏ p ∈ _, ∑ d ∈ Finset.Icc 1 ( p ^ a p ) with d ^ 2 ∣ p ^ a p, ( μ ( p ^ a p / d ^ 2 ) : ℝ ) › hS.2 ]; ++ · exact Nat.Coprime.prod_right fun p hp => Nat.coprime_pow_primes _ _ hS.1 ( hS.2 p hp ) <| by rintro rfl; exact ‹¬_› hp; ++ convert h_prod fun p hp => Nat.prime_of_mem_primeFactors hp; ++ have h_divisors : ∀ p ∈ Nat.primeFactors n, Finset.filter (fun d => d^2 ∣ p^(a p)) (Finset.Icc 1 (p^(a p))) = Finset.image (fun k => p^k) (Finset.Icc 0 (a p / 2)) := by ++ intro p hp ++ ext d ++ simp only [mem_filter, mem_Icc, mem_image, _root_.zero_le, true_and] ++ constructor; ++ · intro hd; ++ have : d ∣ p ^ a p := dvd_of_mul_left_dvd hd.2; ( rw [ Nat.dvd_prime_pow ( Nat.prime_of_mem_primeFactors hp ) ] at this; obtain ⟨ k, hk ⟩ := this; use k; simp +decide only [ hk, and_true ] at hd ⊢; ); ++ rw [ Nat.le_div_iff_mul_le zero_lt_two ] ; rw [ ← pow_mul ] at hd ; exact Nat.le_of_not_lt fun h => absurd ( Nat.le_of_dvd ( pow_pos ( Nat.pos_of_mem_primeFactors hp ) _ ) hd.2 ) ( by exact not_le_of_gt ( pow_lt_pow_right₀ ( Nat.Prime.one_lt ( Nat.prime_of_mem_primeFactors hp ) ) ( by linarith ) ) ) ; ++ · rintro ⟨ k, hk₁, rfl ⟩ ; exact ⟨ ⟨ Nat.one_le_pow _ _ ( Nat.pos_of_mem_primeFactors hp ), Nat.pow_le_pow_right ( Nat.pos_of_mem_primeFactors hp ) ( by omega ) ⟩, by rw [ ← pow_mul ] ; exact pow_dvd_pow _ ( by omega ) ⟩ ; ++ rw [ h_prod, Finset.prod_congr rfl ]; ++ intro p hp; rw [ show ( Finset.filter ( fun d => d ^ 2 ∣ p ^ a p ) ( Finset.Icc 1 ( p ^ a p ) ) ) = Finset.image ( fun k => p ^ k ) ( Finset.Icc 0 ( a p / 2 ) ) from h_divisors p hp ] ; rw [ Finset.sum_image ] <;> norm_num [ pow_mul', Nat.div_eq_of_lt ] ; ++ · rw [Finset.range_eq_Ico, ← Order.succ_eq_add_one, Finset.Ico_succ_right_eq_Icc] ++ refine Finset.sum_congr rfl ?_ ++ intro x hx ++ rw [← pow_mul', Nat.mul_comm] ++ have hx_pos : 0 < p ^ (x * 2) := pow_pos (Nat.pos_of_mem_primeFactors hp) _ ++ have hx_eq : p ^ a p = p ^ (a p - x * 2) * p ^ (x * 2) := by ++ rw [← pow_add, Nat.sub_add_cancel (by linarith [Finset.mem_Icc.mp hx, Nat.div_mul_le_self (a p) 2])] ++ rw [Nat.div_eq_of_eq_mul_left hx_pos hx_eq] ++ · exact fun x hx y hy hxy => Nat.pow_right_injective ( Nat.Prime.one_lt ( Nat.prime_of_mem_primeFactors hp ) ) hxy; ++ have h_inner_sum : ∀ p ∈ Nat.primeFactors n, (∑ d ∈ Finset.range (a p / 2 + 1), (μ (p^(a p - 2 * d)) : ℝ)) = (-1 : ℝ) ^ (a p) := by ++ intro p hp ++ have h_inner_sum_cases : ∀ d ∈ Finset.range (a p / 2 + 1), (μ (p^(a p - 2 * d)) : ℝ) = if a p - 2 * d = 0 then 1 else if a p - 2 * d = 1 then -1 else 0 := by ++ simp +zetaDelta only [ne_eq, mem_primeFactors, mem_range] at * ++ intro d hd ++ rcases k : (n.factorization p - 2 * d) with (_ | _ | k) ++ · simp +decide only [pow_zero, isUnit_iff_eq_one, IsUnit.squarefree, moebius_apply_of_squarefree, Int.reduceNeg, ++ cardFactors_one, Int.cast_one, ↓reduceIte] ++ · simp +decide only [zero_add, pow_one, ↓reduceIte] ++ norm_num [hp.1, ArithmeticFunction.moebius] ++ exact hp.1.squarefree ++ · simp +decide only [Nat.add_eq_zero_iff, and_false, and_self, ↓reduceIte, Nat.add_eq_right, Int.cast_eq_zero] ++ exact ++ ArithmeticFunction.moebius_eq_zero_of_not_squarefree ++ (by rw [Nat.squarefree_pow_iff] <;> norm_num [hp.1.ne_one, hp.1.ne_zero]) ++ rw [ Finset.sum_congr rfl h_inner_sum_cases ] ; norm_num [ Finset.sum_ite ] ; rcases Nat.even_or_odd' ( a p ) with ⟨ k, hk | hk ⟩ <;> norm_num [ hk, pow_add, pow_mul ] ++ · ring_nf ++ norm_num [ show ∀ x : ℕ, k * 2 - x * 2 = 0 ↔ x ≥ k by intro x; exact ⟨ fun hx => by contrapose! hx; exact Nat.ne_of_gt <| Nat.sub_pos_of_lt <| by linarith, fun hx => Nat.sub_eq_zero_of_le <| by linarith ⟩ ]; ++ have h_first : ++ Finset.filter (fun x => k ≤ x) (Finset.range (k + 1)) = {k} := by ++ ext x ++ simp ++ omega ++ have h_second : ++ Finset.filter (fun x => k * 2 - x * 2 = 1) ++ (Finset.filter (fun x => ¬2 * k - 2 * x = 0) (Finset.range (k + 1))) = ∅ := by ++ ext x ++ simp ++ omega ++ rw [h_first, h_second] ++ norm_num ++ · ring_nf ++ norm_num [ Nat.add_div ]; ++ rw [ Finset.card_eq_zero.mpr ] <;> norm_num; ++ · rw [ Finset.card_eq_one ] ; use k ; ext x ; norm_num ; omega; ++ · intros; omega; ++ rw [ h_sum_factor, Finset.prod_congr rfl h_inner_sum ]; ++ rw [ Finset.prod_pow_eq_pow_sum ]; ++ rw [ ArithmeticFunction.cardFactors_apply ]; ++ rw [ ← Multiset.coe_card, ← Multiset.toFinset_sum_count_eq ]; ++ norm_num +zetaDelta [Nat.primeFactorsList_count_eq] ++ ++lemma sum_lambda_eq_sum_mu_div_sq (N : ℕ) : ++ ∑ n ∈ Finset.Icc 1 N, ((-1 : ℝ) ^ (Ω n)) = ++ ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), ∑ k ∈ Finset.Icc 1 (N / d^2), (μ k : ℝ) := by ++ have h_sum_rewrite : ∑ n ∈ Finset.Icc 1 N, (-1 : ℝ) ^ (Ω n) = ∑ n ∈ Finset.Icc 1 N, ∑ d ∈ (Finset.Icc 1 N).filter (fun d => d^2 ∣ n), (μ (n / d^2) : ℝ) := by ++ have h_sum_rewrite : ∀ n ∈ Finset.Icc 1 N, (-1 : ℝ) ^ (Ω n) = ∑ d ∈ (Finset.Icc 1 N).filter (fun d => d^2 ∣ n), (μ (n / d^2) : ℝ) := by ++ intro n hn ++ have h_lambda_eq : ((-1 : ℝ) ^ (Ω n)) = ∑ d ∈ (Finset.Icc 1 n).filter (fun d => d^2 ∣ n), (μ (n / d^2) : ℝ) := by ++ convert lambda_eq_sum_sq_dvd_mu n ( by linarith [ Finset.mem_Icc.mp hn ] ) using 1; ++ rw [ h_lambda_eq, Finset.sum_subset ]; ++ · exact fun x hx => Finset.mem_filter.mpr ⟨ Finset.mem_Icc.mpr ⟨ Finset.mem_Icc.mp ( Finset.mem_filter.mp hx |>.1 ) |>.1, by linarith [ Finset.mem_Icc.mp ( Finset.mem_filter.mp hx |>.1 ) |>.2, Finset.mem_Icc.mp hn |>.2 ] ⟩, Finset.mem_filter.mp hx |>.2 ⟩; ++ · simp +zetaDelta only [mem_Icc, mem_filter, not_and, and_imp, Int.cast_eq_zero] at * ++ exact fun x hx₁ hx₂ hx₃ hx₄ => False.elim <| hx₄ hx₁ ( by nlinarith [ Nat.le_of_dvd ( by linarith ) hx₃ ] ) hx₃; ++ exact Finset.sum_congr rfl h_sum_rewrite; ++ rw [ h_sum_rewrite, Finset.sum_sigma' ]; ++ have h_reindex : ∑ x ∈ (Finset.Icc 1 N).sigma fun (n : ℕ) => {d ∈ Finset.Icc 1 N | d ^ 2 ∣ n}, (μ (x.fst / x.snd ^ 2) : ℝ) = ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), ∑ k ∈ Finset.Icc 1 (N / d ^ 2), (μ k : ℝ) := by ++ have : Finset.filter (fun x => x.snd ^ 2 ∣ x.fst) (Finset.Icc 1 N ×ˢ Finset.Icc 1 N) = Finset.biUnion (Finset.Icc 1 (Nat.sqrt N)) (fun d => Finset.image (fun k => (d ^ 2 * k, d)) (Finset.Icc 1 (N / d ^ 2))) := by ++ ext ⟨n, d⟩ ++ simp only [Finset.mem_filter, Finset.mem_product, Finset.mem_Icc, Finset.mem_biUnion, Finset.mem_image, Prod.mk.injEq] ++ constructor ++ · intro ⟨⟨⟨hn1, hn2⟩, hd1, hd2⟩, hdiv⟩ ++ exact ⟨d, ⟨hd1, by rw [Nat.le_sqrt]; nlinarith [Nat.le_of_dvd (by linarith) hdiv]⟩, n / d ^ 2, ⟨Nat.div_pos (Nat.le_of_dvd (by linarith) hdiv) (by nlinarith), Nat.div_le_div_right hn2⟩, Nat.mul_div_cancel' hdiv, rfl⟩ ++ · rintro ⟨a, ⟨ha₁, ha₂⟩, b, ⟨hb₁, hb₂⟩, hn, hd⟩ ++ rw [← hn, ← hd] ++ exact ⟨⟨⟨by nlinarith, by nlinarith [Nat.div_mul_le_self N (a ^ 2)]⟩, ha₁, by nlinarith [Nat.sqrt_le N]⟩, dvd_mul_right _ _⟩ ++ rw [ Finset.sum_sigma' ]; ++ apply Finset.sum_bij (fun x _ => ⟨x.snd, x.fst / x.snd ^ 2⟩); ++ · simp_all +decide only [Finset.ext_iff, mem_filter, mem_product, mem_Icc, mem_biUnion, mem_image, Prod.forall, ++ Prod.mk.injEq, ↓existsAndEq, and_true, exists_and_left, mem_sigma, true_and, and_imp] ++ exact fun x hx₁ hx₂ hx₃ hx₄ hx₅ => ⟨ by nlinarith [ Nat.le_of_dvd ( by linarith ) hx₅, Nat.lt_succ_sqrt N ], Nat.div_pos ( Nat.le_of_dvd ( by linarith ) hx₅ ) ( by positivity ), Nat.div_le_div_right hx₂ ⟩; ++ · simp +contextual [ Finset.mem_sigma, Finset.mem_filter ]; ++ aesop; ++ · simp +zetaDelta only [mem_sigma, mem_Icc, mem_filter, exists_prop, Sigma.exists, and_imp] at * ++ exact fun b hb₁ hb₂ hb₃ hb₄ => ⟨ b.fst ^ 2 * b.snd, b.fst, ⟨ ⟨ by nlinarith, by nlinarith [ Nat.div_mul_le_self N ( b.fst ^ 2 ) ] ⟩, ⟨ by nlinarith, by nlinarith [ Nat.div_mul_le_self N ( b.fst ^ 2 ) ] ⟩, by norm_num ⟩, by simp +decide [ Nat.mul_div_cancel_left _ ( by nlinarith : 0 < b.fst ^ 2 ) ] ⟩; ++ · aesop; ++ convert h_reindex using 1 ++ ++lemma sum_mu_div_sq_isLittleO : (fun N : ℕ ↦ ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), ∑ k ∈ Finset.Icc 1 (N / d^2), (μ k : ℝ)) =o[atTop] (fun N ↦ (N : ℝ)) := by ++ have h_sum_rewrite : ∀ N : ℕ, (∑ d ∈ Finset.Icc 1 (Nat.sqrt N), (∑ k ∈ Finset.Icc 1 (N / d^2), (μ k : ℝ))) = (∑ d ∈ Finset.Icc 1 (Nat.sqrt N), (M (N / d^2) : ℝ)) := by ++ intro N ++ simp only [M] ++ refine Finset.sum_congr rfl ?_ ++ intro x hx ++ erw [ Finset.sum_Ico_eq_sub _ ] <;> norm_num [ Finset.sum_range_succ' ]; ++ rw [ show ⌊ ( N : ℝ ) / x ^ 2⌋₊ = N / x ^ 2 from Nat.floor_eq_iff ( by positivity ) |>.2 ⟨ by rw [ le_div_iff₀ ( by norm_cast; nlinarith [ Finset.mem_Icc.mp hx ] ) ] ; norm_cast; linarith [ Nat.div_mul_le_self N ( x ^ 2 ) ], by rw [ div_lt_iff₀ ( by norm_cast; nlinarith [ Finset.mem_Icc.mp hx ] ) ] ; norm_cast; linarith [ Nat.div_add_mod N ( x ^ 2 ), Nat.mod_lt N ( show x ^ 2 > 0 by nlinarith [ Finset.mem_Icc.mp hx ] ) ] ⟩ ] ; erw [ Finset.sum_Ico_eq_sub _ ] <;> norm_num [ Finset.sum_range_succ' ] ; ++ have h_bound : ∀ ε > 0, ∃ N₀ : ℕ, ∀ N ≥ N₀, ∀ d ∈ Finset.Icc 1 (Nat.sqrt N), |M (N / d^2)| ≤ ε * (N / d^2) + N₀ := by ++ have h_bound : ∀ ε > 0, ∃ C : ℝ, ∀ x : ℝ, 1 ≤ x → |M x| ≤ ε * x + C := by ++ have h_bound : ∀ ε > 0, ∃ C : ℝ, ∀ x : ℝ, 1 ≤ x → |M x| ≤ ε * x + C := by ++ intro ε hε ++ have := M_isLittleO' ++ rw [ Asymptotics.isLittleO_iff ] at this; ++ norm_num +zetaDelta at *; ++ obtain ⟨ a, ha ⟩ := this hε; ++ obtain ⟨C, hC⟩ : ∃ C : ℝ, ∀ x ∈ Set.Icc 1 a, |M x| ≤ C := by ++ have h_bounded : BddAbove (Set.image (fun x => |M x|) (Set.Icc 1 a)) := by ++ have h_bounded : BddAbove (Set.image (fun x => |∑ n ∈ Finset.Iic ⌊x⌋₊, (μ n : ℝ)|) (Set.Icc 1 a)) := by ++ have h_finite : Set.Finite (Set.image (fun x => ⌊x⌋₊) (Set.Icc 1 a)) := by ++ exact Set.finite_iff_bddAbove.mpr ⟨ ⌊a⌋₊, Set.forall_mem_image.mpr fun x hx => Nat.floor_mono hx.2 ⟩ ++ have h_bounded : BddAbove (Set.image (fun n : ℕ => |∑ k ∈ Finset.Iic n, (μ k : ℝ)|) (Set.image (fun x => ⌊x⌋₊) (Set.Icc 1 a))) := by ++ exact Set.Finite.bddAbove <| h_finite.image _; ++ exact ⟨ h_bounded.choose, Set.forall_mem_image.2 fun x hx => h_bounded.choose_spec <| Set.mem_image_of_mem _ <| Set.mem_image_of_mem _ hx ⟩; ++ convert! h_bounded using 1; ++ exact ⟨ h_bounded.choose, fun x hx => h_bounded.choose_spec ⟨ x, hx, rfl ⟩ ⟩; ++ exact ⟨ Max.max C 0, fun x hx => if hx' : x ≤ a then le_trans ( hC x ⟨ hx, hx' ⟩ ) ( le_max_left _ _ ) |> le_trans <| le_add_of_nonneg_left <| by positivity else le_trans ( ha x <| le_of_not_ge hx' ) <| by rw [ abs_of_nonneg <| by linarith ] ; exact le_add_of_nonneg_right <| by positivity ⟩; ++ assumption; ++ intro ε hε ++ obtain ⟨C, hC⟩ := h_bound ε hε ++ refine ⟨⌈C⌉₊ + 1, ?_⟩ ++ intro N hN d hd ++ specialize hC (N / d ^ 2) ++ rcases eq_or_ne d 0 with rfl | hd0 ++ · simp_all +decide only [gt_iff_lt, ge_iff_le, mem_Icc, _root_.zero_le, and_true] ++ · simp_all +decide only [gt_iff_lt, ge_iff_le, mem_Icc, ne_eq, cast_add, cast_one] ++ exact ++ le_trans ++ (hC <| ++ by ++ rw [le_div_iff₀ <| by positivity] ++ nlinarith [show (d : ℝ) ^ 2 ≤ N by norm_cast; nlinarith [Nat.sqrt_le N]]) ++ (by linarith [Nat.le_ceil C]) ++ have h_sum_bound : ∀ ε > 0, ∃ N₀ : ℕ, ∀ N ≥ N₀, |∑ d ∈ Finset.Icc 1 (Nat.sqrt N), M (N / d^2)| ≤ ε * N * (∑' k : ℕ, (1 : ℝ) / (k^2)) + N₀ * Nat.sqrt N := by ++ intros ε hε_pos ++ obtain ⟨N₀, hN₀⟩ := h_bound ε hε_pos ++ use N₀ ++ intro N hN ++ have h_sum_bound : |∑ d ∈ Finset.Icc 1 (Nat.sqrt N), M (N / d^2)| ≤ ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), (ε * (N / d^2) + N₀) := by ++ exact le_trans ( Finset.abs_sum_le_sum_abs _ _ ) ( Finset.sum_le_sum fun x hx => hN₀ N hN x hx ); ++ refine le_trans h_sum_bound ?_; ++ norm_num [ Finset.sum_add_distrib, Finset.mul_sum _ _ _, mul_assoc, mul_comm, mul_left_comm, div_eq_mul_inv ]; ++ rw [ ← Finset.mul_sum _ _ _, ← Finset.mul_sum _ _ _ ]; ++ exact mul_le_mul_of_nonneg_left ( mul_le_mul_of_nonneg_left ( Summable.sum_le_tsum ( Finset.Icc 1 N.sqrt ) ( fun _ _ => by positivity ) ( by simp ) ) ( Nat.cast_nonneg _ ) ) hε_pos.le; ++ rw [ Asymptotics.isLittleO_iff ]; ++ intro c hc ++ obtain ⟨ε, hε_pos, hε⟩ : ∃ ε > 0, ε * (∑' k : ℕ, (1 : ℝ) / (k^2)) < c / 2 := by ++ exact ⟨ ( c / 2 ) / ( ∑' k : ℕ, 1 / ( k : ℝ ) ^ 2 + 1 ), div_pos ( half_pos hc ) ( add_pos_of_nonneg_of_pos ( tsum_nonneg fun _ => by positivity ) zero_lt_one ), by rw [ div_mul_eq_mul_div, div_lt_iff₀ ] <;> nlinarith [ show 0 ≤ ∑' k : ℕ, 1 / ( k : ℝ ) ^ 2 from tsum_nonneg fun _ => by positivity ] ⟩; ++ obtain ⟨ N₀, hN₀ ⟩ := h_sum_bound ε hε_pos; ++ obtain ⟨N₁, hN₁⟩ : ∃ N₁ : ℕ, ∀ N ≥ N₁, N₀ * Nat.sqrt N ≤ (c / 2) * N := by ++ have h_sqrt_growth : ∃ N₁ : ℕ, ∀ N ≥ N₁, (N₀ : ℝ) * Real.sqrt N ≤ (c / 2) * N := by ++ have h_sqrt_bound : Filter.Tendsto (fun N : ℕ => (N₀ : ℝ) * Real.sqrt N / N) Filter.atTop (nhds 0) := by ++ simpa [ mul_div_assoc, Real.sqrt_div_self ] using tendsto_const_nhds.mul ( tendsto_inv_atTop_nhds_zero_nat.sqrt ) ++ exact Filter.eventually_atTop.mp ( h_sqrt_bound.eventually ( gt_mem_nhds <| show 0 < c / 2 by positivity ) ) |> fun ⟨ N₁, hN₁ ⟩ ↦ ⟨ N₁ + 1, fun N hN ↦ by have := hN₁ N ( by linarith ) ; rw [ div_lt_iff₀ ] at this <;> nlinarith [ show ( N : ℝ ) ≥ N₁ + 1 by exact_mod_cast hN ] ⟩; ++ exact ⟨ h_sqrt_growth.choose, fun N hN => le_trans ( mul_le_mul_of_nonneg_left ( Real.le_sqrt_of_sq_le <| mod_cast Nat.sqrt_le' _ ) <| Nat.cast_nonneg _ ) <| h_sqrt_growth.choose_spec N hN ⟩; ++ filter_upwards [ Filter.eventually_ge_atTop N₀, Filter.eventually_ge_atTop N₁ ] with N hN₀' hN₁' using by rw [ Real.norm_of_nonneg ( Nat.cast_nonneg _ ) ] ; rw [ h_sum_rewrite ] ; exact le_trans ( hN₀ _ hN₀' ) ( by nlinarith [ hN₁ _ hN₁', show ( N : ℝ ) ≥ 0 by positivity ] ) ; ++ ++theorem lambda_pnt : (fun x : ℝ ↦ ∑ n ∈ range ⌊x⌋₊, (-1)^(Ω n)) =o[atTop] fun x ↦ x := by ++ have h_lambda_pnt : (fun N : ℕ => ∑ n ∈ Finset.range N, (-1 : ℝ) ^ (Nat.factorization n).sum (fun p k => k)) =o[Filter.atTop] (fun N : ℕ => (N : ℝ)) := by ++ have h_lambda_pnt : (fun N : ℕ => ∑ n ∈ Finset.Icc 1 N, (-1 : ℝ) ^ (Nat.factorization n).sum (fun p k => k)) =o[Filter.atTop] (fun N : ℕ => (N : ℝ)) := by ++ have h_lambda_pnt : (fun N : ℕ => ∑ d ∈ Finset.Icc 1 (Nat.sqrt N), ∑ k ∈ Finset.Icc 1 (N / d^2), (μ k : ℝ)) =o[Filter.atTop] (fun N : ℕ => (N : ℝ)) := by ++ exact sum_mu_div_sq_isLittleO ++ convert h_lambda_pnt using 2; ++ convert sum_lambda_eq_sum_mu_div_sq _; ++ exact Eq.symm cardFactors_eq_sum_factorization ++ have h_lambda_pnt : (fun N : ℕ => ∑ n ∈ Finset.range (N + 1), (-1 : ℝ) ^ (Nat.factorization n).sum (fun p k => k)) =o[Filter.atTop] (fun N : ℕ => (N : ℝ)) := by ++ rw [ Asymptotics.isLittleO_iff_tendsto' ] at * <;> norm_num at *; ++ · convert h_lambda_pnt.add ( show Filter.Tendsto ( fun x : ℕ => ( 1 : ℝ ) / x ) Filter.atTop ( nhds 0 ) from tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop ) using 2 <;> norm_num [ Finset.sum_Ico_eq_sum_range ]; ++ erw [ Finset.sum_Ico_eq_sub _ _ ] <;> norm_num [ Finset.sum_range_succ' ] ; ring_nf; ++ · exact ⟨ 1, by aesop ⟩; ++ · exact ⟨ 1, by aesop ⟩; ++ simp_all +decide only [Finset.sum_range_succ] ++ have := h_lambda_pnt.sub ( show ( fun N : ℕ => ( -1 : ℝ ) ^ N.factorization.sum fun p k => k ) =o[Filter.atTop] fun N : ℕ => ( N : ℝ ) from ?_ ); ++ · aesop; ++ · rw [ Asymptotics.isLittleO_iff_tendsto' ] <;> norm_num; ++ · exact tendsto_zero_iff_norm_tendsto_zero.mpr ( by simpa using tendsto_inv_atTop_nhds_zero_nat ); ++ · exact ⟨ 1, fun n hn => by positivity ⟩; ++ have h_floor : (fun x : ℝ => ∑ n ∈ Finset.range ⌊x⌋₊, (-1 : ℝ) ^ (Nat.factorization n).sum (fun p k => k)) =o[Filter.atTop] (fun x : ℝ => (⌊x⌋₊ : ℝ)) := by ++ rw [ Asymptotics.isLittleO_iff_tendsto' ] at * <;> norm_num at *; ++ · exact h_lambda_pnt.comp <| tendsto_nat_floor_atTop; ++ · exact ⟨ 1, by aesop ⟩; ++ · exact ⟨ 1, by intros; linarith ⟩; ++ rw [ Asymptotics.isLittleO_iff ] at *; ++ intro c hc ++ filter_upwards [h_floor (half_pos hc), Filter.eventually_gt_atTop 1] with x hx₁ hx₂ ++ refine le_trans ?_ (le_trans hx₁ ?_) ++ · norm_num [ Norm.norm ]; ++ convert le_rfl using 2; ++ congr! 2; ++ exact Eq.symm cardFactors_eq_sum_factorization ++ · norm_num [ abs_of_nonneg, Nat.floor_le, hx₂.le ]; ++ rw [ abs_of_nonneg ( by positivity ) ] ; nlinarith [ Nat.floor_le ( by positivity : 0 ≤ x ) ] ++ ++lemma sum_mobius_floor (x : ℝ) (hx : 1 ≤ x) : ∑ n ∈ Icc 1 ⌊x⌋₊, (μ n : ℝ) * ⌊x / n⌋ = 1 := by ++ classical ++ have h := sum_mobius_mul_floor x hx ++ have h0 : (0 : ℕ) ∈ Iic ⌊x⌋₊ := by simp [Finset.mem_Iic] ++ have hI : (Iic ⌊x⌋₊).erase 0 = Icc 1 ⌊x⌋₊ := by ++ ext n ++ simp [Finset.mem_Iic, Finset.mem_Icc, Nat.one_le_iff_ne_zero, and_comm] ++ rw [← Finset.sum_erase_add (Iic ⌊x⌋₊) (fun n => (μ n : ℝ) * (⌊x / n⌋ : ℝ)) h0] at h ++ simpa [hI] using h ++ ++lemma sum_mobius_floor_tail_isLittleO (K : ℕ) (hK : 0 < K) : ++ (fun x : ℝ => ∑ n ∈ Finset.Ioc ⌊x/K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)) =o[atTop] fun x => x := by ++ have h_group : ∀ x : ℝ, x ≥ 1 → ∑ n ∈ Finset.Ioc ⌊x / (K : ℝ)⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x / n⌋ = ∑ k ∈ Finset.Ico 1 K, k * (∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) := by ++ intro x hx ++ have h_group : ∑ n ∈ Finset.Ioc ⌊x / (K : ℝ)⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x / n⌋ = ∑ k ∈ Finset.Ico 1 K, ∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ) * k := by ++ have h_group : Finset.Ioc ⌊x / (K : ℝ)⌋₊ ⌊x⌋₊ = Finset.biUnion (Finset.Ico 1 K) (fun k => Finset.Ioc (⌊x / (k + 1 : ℝ)⌋₊) (⌊x / (k : ℝ)⌋₊)) := by ++ ext n ++ simp only [mem_Ioc, mem_biUnion, mem_Ico] ++ constructor ++ · intro hn ++ refine ⟨⌊x / n⌋₊, ?_, ?_, ?_⟩ ++ all_goals generalize_proofs at * ++ · rw [Nat.floor_lt', div_lt_iff₀] <;> norm_num <;> try linarith [show (n : ℝ) ≥ 1 by norm_cast; linarith] ++ exact ⟨by rw [le_div_iff₀ (Nat.cast_pos.mpr <| by linarith)] ; nlinarith [Nat.floor_le (show 0 ≤ x by linarith), Nat.lt_floor_add_one x, show (n : ℝ) ≤ ⌊x⌋₊ by exact_mod_cast hn.2], by rw [Nat.floor_lt (by positivity)] at *; rw [div_lt_iff₀ (by positivity)] at *; norm_num at *; linarith⟩ ++ · rw [Nat.floor_lt', div_lt_iff₀] <;> norm_num <;> try linarith [Nat.lt_floor_add_one (x / n)] ++ nlinarith [Nat.lt_floor_add_one (x / n), show (n : ℝ) ≥ 1 by norm_cast; linarith, div_mul_cancel₀ x (show (n : ℝ) ≠ 0 by norm_cast; linarith)] ++ · refine Nat.le_floor ?_ ++ rw [le_div_iff₀] <;> norm_num ++ · exact le_trans (mul_le_mul_of_nonneg_left (Nat.floor_le (by positivity)) (Nat.cast_nonneg _)) (by rw [mul_div_cancel₀ _ (Nat.cast_ne_zero.mpr <| by linarith)]) ++ · exact Nat.floor_pos.mpr (by rw [le_div_iff₀ (Nat.cast_pos.mpr <| pos_of_gt hn.1)] ; nlinarith [Nat.floor_le (show 0 ≤ x by positivity), Nat.lt_floor_add_one x, show (n : ℝ) ≤ ⌊x⌋₊ by exact_mod_cast hn.2, div_mul_cancel₀ x (show (K : ℝ) ≠ 0 by positivity)]) ++ · field_simp ++ rintro ⟨a, ⟨ha₁, ha₂⟩, ha₃, ha₄⟩ ++ refine ⟨lt_of_le_of_lt ?_ ha₃, ha₄.trans ?_⟩ ++ · gcongr ; norm_cast ++ · exact Nat.floor_mono <| div_le_self (by positivity) <| mod_cast ha₁ ++ rw [h_group, Finset.sum_biUnion] ++ · refine Finset.sum_congr rfl fun k hk => Finset.sum_congr rfl fun n hn => ?_ ++ simp +zetaDelta only [ge_iff_le, mem_Ico, mem_Ioc, mul_eq_mul_left_iff, Int.cast_eq_zero] at * ++ rw [Nat.floor_lt (by positivity), Nat.le_floor_iff (by positivity)] at * ++ exact Or.inl <| mod_cast Int.floor_eq_iff.mpr ⟨by rw [le_div_iff₀ <| Nat.cast_pos.mpr <| Nat.pos_of_ne_zero <| by rintro rfl; norm_num at hn; linarith [show x / (k + 1 : ℝ) > 0 by positivity]] ; norm_num; nlinarith [show (k : ℝ) ≥ 1 by norm_cast; linarith, div_mul_cancel₀ x (show (k : ℝ) ≠ 0 by norm_cast; linarith), div_mul_cancel₀ x (show (k + 1 : ℝ) ≠ 0 by positivity)], by rw [div_lt_iff₀ <| Nat.cast_pos.mpr <| Nat.pos_of_ne_zero <| by rintro rfl; norm_num at hn; linarith [show x / (k + 1 : ℝ) > 0 by positivity]] ; norm_num; nlinarith [show (k : ℝ) ≥ 1 by norm_cast; linarith, div_mul_cancel₀ x (show (k : ℝ) ≠ 0 by norm_cast; linarith), div_mul_cancel₀ x (show (k + 1 : ℝ) ≠ 0 by positivity)]⟩ ++ · intros k hk l hl hkl; simp_all +decide [Finset.disjoint_left] ++ field_simp ++ intro a ha₁ ha₂ ha₃; contrapose! hkl ++ rw [Nat.le_floor_iff (by positivity), Nat.floor_lt (by positivity)] at * ++ rw [div_lt_iff₀ (by positivity), le_div_iff₀ (by norm_cast; linarith)] at * ++ exact Nat.le_antisymm (Nat.le_of_lt_succ <| by { rw [← @Nat.cast_lt ℝ] ; push_cast; nlinarith }) (Nat.le_of_lt_succ <| by { rw [← @Nat.cast_lt ℝ] ; push_cast; nlinarith }) ++ simpa only [mul_comm, Finset.mul_sum _ _ _] using h_group ++ have h_M_x_over_k : ∀ k : ℕ, 1 ≤ k → k < K → (fun x : ℝ => ∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) =o[atTop] (fun x => x) := by ++ have h_M : (fun x : ℝ => ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x => x) := by ++ have h_M : (fun x : ℝ => ∑ n ∈ Finset.range ⌊x⌋₊, (μ n : ℝ)) =o[atTop] (fun x => x) := by ++ refine Asymptotics.IsLittleO.of_norm_left ?_ ++ simpa only [← Int.norm_cast_real, Int.cast_sum] using mu_pnt.norm_left ++ have h_M : (fun x : ℝ => ∑ n ∈ Finset.range (⌊x⌋₊ + 1), (μ n : ℝ)) =o[atTop] (fun x => x) := by ++ simp_all +decide only [ge_iff_le, Finset.sum_range_succ] ++ refine h_M.add ?_ ++ rw [Asymptotics.isLittleO_iff_tendsto] <;> norm_num ++ refine squeeze_zero_norm' (a := fun x : ℝ => 1 / |x|) ?_ ?_ ++ · norm_num [abs_div] ++ exact ⟨1, fun x hx => mul_le_of_le_one_left (by positivity) (mod_cast by exact abs_moebius_le_one)⟩ ++ · exact tendsto_const_nhds.div_atTop (tendsto_norm_atTop_atTop) ++ convert! h_M.sub (show (fun x : ℝ => (μ 0 : ℝ)) =o[Filter.atTop] fun x : ℝ => x from ?_) using 2 <;> norm_num [Finset.sum_range_succ'] ++ erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num [Finset.sum_range_succ'] ++ intros k hk_pos hk_lt_K ++ have h_M_x_over_k : (fun x : ℝ => ∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) = (fun x : ℝ => ∑ n ∈ Finset.Icc 1 ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) - (fun x : ℝ => ∑ n ∈ Finset.Icc 1 ⌊x / (k + 1 : ℝ)⌋₊, (μ n : ℝ)) := by ++ ext x ++ simp only [Pi.sub_apply] ++ rw [eq_sub_iff_add_eq'] ++ simp only [show Finset.Icc (1 : ℕ) (⌊x / (↑k + 1)⌋₊) = Finset.Ioc (0 : ℕ) (⌊x / (↑k + 1)⌋₊) by ++ simpa using (Finset.Icc_add_one_left_eq_Ioc (a := (0 : ℕ)) (b := ⌊x / (↑k + 1)⌋₊)), ++ show Finset.Icc (1 : ℕ) (⌊x / ↑k⌋₊) = Finset.Ioc (0 : ℕ) (⌊x / ↑k⌋₊) by ++ simpa using (Finset.Icc_add_one_left_eq_Ioc (a := (0 : ℕ)) (b := ⌊x / ↑k⌋₊))] ++ rw [Finset.sum_Ioc_consecutive] <;> norm_num ++ ++ by_cases hx : 0 ≤ x <;> simp_all +decide only [ge_iff_le, floor_div_natCast, not_le] ++ · rw [Nat.le_div_iff_mul_le (by positivity)] ++ exact Nat.le_floor <| by push_cast; nlinarith [Nat.floor_le (show 0 ≤ x / (k + 1) by positivity), Nat.lt_floor_add_one (x / (k + 1)), mul_div_cancel₀ x (by positivity : (k + 1 : ℝ) ≠ 0)] ++ · rw [Nat.floor_of_nonpos (div_nonpos_of_nonpos_of_nonneg hx.le (by positivity)), Nat.floor_of_nonpos hx.le] ; norm_num ++ rw [h_M_x_over_k] ++ refine Asymptotics.IsLittleO.sub ?_ ?_ ++ · field_simp ++ refine h_M.comp_tendsto (Filter.tendsto_id.atTop_mul_const (by positivity)) |> fun h => h.trans_isBigO ?_ ++ exact Asymptotics.isBigO_iff.mpr ⟨(k : ℝ) ⁻¹, Filter.eventually_atTop.mpr ⟨1, fun x hx => by simp +decide ; ring_nf; norm_num [show k ≠ 0 by linarith]⟩⟩ ++ · have := h_M.comp_tendsto (show Filter.Tendsto (fun x : ℝ => x / (k + 1)) Filter.atTop Filter.atTop from Filter.tendsto_id.atTop_div_const (by positivity)) ++ rw [Asymptotics.isLittleO_iff] at * ++ intro c hc; filter_upwards [this (show 0 < c * (k + 1) by positivity), Filter.eventually_gt_atTop 0] with x hx₁ hx₂; simp_all +decide only [ge_iff_le, norm_eq_abs, eventually_atTop, Function.comp_apply, norm_div, cast_nonneg, ++ zero_le_one, add_nonneg, abs_of_nonneg] ++ exact hx₁.trans (by rw [mul_assoc, mul_div_cancel₀ _ (by positivity)]) ++ have h_sum_o_x : (fun x : ℝ => ∑ k ∈ Finset.Ico 1 K, (k : ℝ) * (∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ))) =o[atTop] (fun x => x) := by ++ rw [Asymptotics.isLittleO_iff_tendsto'] ++ · have h_sum_little_o : ∀ k ∈ Finset.Ico 1 K, Filter.Tendsto (fun x : ℝ => (∑ n ∈ Finset.Ioc ⌊x / (k + 1 : ℝ)⌋₊ ⌊x / (k : ℝ)⌋₊, (μ n : ℝ)) / x) Filter.atTop (nhds 0) := by ++ intro k hk; specialize h_M_x_over_k k (Finset.mem_Ico.mp hk |>.1) (Finset.mem_Ico.mp hk |>.2) ; rw [Asymptotics.isLittleO_iff_tendsto'] at h_M_x_over_k <;> aesop ++ simpa [Finset.sum_div _ _ _, mul_div_assoc] using tendsto_finsetSum _ fun k hk => h_sum_little_o k hk |> Filter.Tendsto.const_mul _ ++ · filter_upwards [Filter.eventually_gt_atTop 0] with x hx hx' using absurd hx' hx.ne' ++ exact h_sum_o_x.congr' ++ (by filter_upwards [Filter.eventually_ge_atTop 1] with x hx using by rw [h_group x hx]) ++ (by norm_num) ++ ++lemma sum_mobius_div_approx (x : ℝ) (K : ℕ) (hK : 0 < K) (hx : 1 ≤ x) : ++ |x * (∑ n ∈ Icc 1 ⌊x/K⌋₊, (μ n : ℝ) / n) - 1| ≤ x/K + |∑ n ∈ Ioc ⌊x/K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| := by ++ have h_split : ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋ = (∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋) + (∑ n ∈ Finset.Ioc ⌊x / (K : ℝ)⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋) := by ++ erw [Finset.sum_Ioc_consecutive] <;> norm_num ++ · rfl ++ · exact Nat.floor_mono <| div_le_self (by positivity) <| mod_cast hK ++ have h_floor : ∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋ = x * ∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) / (n : ℝ) - ∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) * (x / (n : ℝ) - ⌊x / (n : ℝ)⌋) := by ++ rw [Finset.mul_sum _ _ _] ; rw [← Finset.sum_sub_distrib] ; exact Finset.sum_congr rfl fun _ _ => by ring ++ have h_bound : |∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, (μ n : ℝ) * (x / (n : ℝ) - ⌊x / (n : ℝ)⌋)| ≤ ⌊x / (K : ℝ)⌋₊ := by ++ have h_bound : ∀ n ∈ Finset.Icc 1 ⌊x / (K : ℝ)⌋₊, |(μ n : ℝ) * (x / (n : ℝ) - ⌊x / (n : ℝ)⌋)| ≤ 1 := by ++ norm_num [abs_mul] ++ exact fun n hn₁ hn₂ => ++ (mul_le_of_le_one_left (abs_nonneg _) ++ (mod_cast by exact abs_moebius_le_one)).trans ++ (abs_le.mpr ⟨by linarith [Int.fract_nonneg (x / n)], ++ by linarith [Int.fract_lt_one (x / n)]⟩) ++ exact le_trans (Finset.abs_sum_le_sum_abs _ _) (le_trans (Finset.sum_le_sum h_bound) (by norm_num)) ++ have h_sum_floor : ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ)⌋ = 1 := by ++ convert sum_mobius_floor x hx using 1 ++ cases abs_cases (x * ∑ n ∈ Finset.Icc 1 ⌊x / (K : ℝ) ⌋₊, (μ n : ℝ) / n - 1) <;> cases abs_cases (∑ n ∈ Finset.Ioc ⌊x / (K : ℝ) ⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x / (n : ℝ) ⌋) <;> linarith [abs_le.mp h_bound, Nat.floor_le (show 0 ≤ x / (K : ℝ) by positivity), Nat.lt_floor_add_one (x / (K : ℝ))] ++ ++theorem mu_pnt_alt : (fun x : ℝ ↦ ∑ n ∈ range ⌊x⌋₊, (μ n : ℝ) / n) =o[atTop] fun _ ↦ (1 : ℝ) := by ++ rw [Asymptotics.isLittleO_iff_tendsto'] <;> norm_num ++ have h_sum_zero : Filter.Tendsto (fun x : ℝ => ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, (μ n : ℝ) / n) Filter.atTop (nhds 0) := by ++ set S : ℝ → ℝ := fun y => ∑ n ∈ Finset.Icc 1 ⌊y⌋₊, (μ n : ℝ) / n ++ have h_bound : ∀ K : ℕ, 0 < K → ∀ x : ℝ, 1 ≤ x → |S (x / K)| ≤ 1 / K + 1 / x + |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| / x := by ++ intros K hK x hx ++ have h_approx : |x * S (x / K) - 1| ≤ x / K + |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| := by ++ convert sum_mobius_div_approx x K hK hx using 1 ++ rw [abs_le] at * ++ ring_nf at * ++ constructor <;> nlinarith [inv_pos.2 (by positivity : 0 < x), mul_inv_cancel₀ (by positivity : x ≠ 0), abs_nonneg (∑ n ∈ Finset.Ioc ⌊ (K : ℝ) ⁻¹ * x⌋₊ ⌊x⌋₊, (μ n : ℝ) * ⌊x * (n : ℝ) ⁻¹⌋)] ++ have h_tail_zero : ∀ K : ℕ, 0 < K → Filter.Tendsto (fun x : ℝ => |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| / x) Filter.atTop (nhds 0) := by ++ intro K hK ++ have h_tail_zero : Filter.Tendsto (fun x : ℝ => |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| / x) Filter.atTop (nhds 0) := by ++ have := sum_mobius_floor_tail_isLittleO K hK ++ rw [Asymptotics.isLittleO_iff_tendsto'] at this ++ · simpa [abs_div] using this.abs.congr' (by filter_upwards [Filter.eventually_gt_atTop 0] with x hx using by rw [abs_div, abs_of_nonneg hx.le]) ++ · filter_upwards [Filter.eventually_gt_atTop 0] with x hx hx' using absurd hx' hx.ne' ++ convert h_tail_zero using 1 ++ have h_eps : ∀ ϵ > 0, ∃ Y : ℝ, ∀ y ≥ Y, |S y| < ϵ := by ++ intros ϵ hϵ_pos ++ obtain ⟨K, hK_pos, hK⟩ : ∃ K : ℕ, 0 < K ∧ 1 / (K : ℝ) < ϵ / 3 := by ++ exact ⟨⌊ϵ⁻¹ * 3⌋₊ + 1, Nat.succ_pos _, by rw [div_lt_iff₀] <;> push_cast <;> nlinarith [Nat.lt_floor_add_one (ϵ⁻¹ * 3), mul_inv_cancel₀ hϵ_pos.ne']⟩ ++ obtain ⟨Y, hY⟩ : ∃ Y : ℝ, ∀ x ≥ Y, |S (x / K)| < ϵ := by ++ have h_tail_zero : Filter.Tendsto (fun x : ℝ => 1 / (K : ℝ) + 1 / x + |∑ n ∈ Finset.Ioc ⌊x / K⌋₊ ⌊x⌋₊, (μ n : ℝ) * (⌊x / (n : ℝ)⌋ : ℝ)| / x) Filter.atTop (nhds (1 / (K : ℝ))) := by ++ simpa using Filter.Tendsto.add (tendsto_const_nhds.add (tendsto_inv_atTop_zero)) (h_tail_zero K hK_pos) ++ exact Filter.eventually_atTop.mp (h_tail_zero.eventually (gt_mem_nhds <| by linarith)) |> fun ⟨Y, hY⟩ ↦ ⟨Max.max Y 1, fun x hx ↦ lt_of_le_of_lt (h_bound K hK_pos x <| le_trans (le_max_right _ _) hx) <| hY x <| le_trans (le_max_left _ _) hx⟩ ++ use Y / K; intros y hy; specialize hY (y * K) (by nlinarith [show (K : ℝ) ≥ 1 by norm_cast, div_mul_cancel₀ Y (by positivity : (K : ℝ) ≠ 0)]) ; simp_all +decide [ne_of_gt] ++ exact Metric.tendsto_atTop.mpr fun ε hε => by simpa using h_eps ε hε ++ have h_sum_zero : Filter.Tendsto (fun x : ℝ => ∑ n ∈ Finset.range (⌊x⌋₊ + 1), (μ n : ℝ) / n) Filter.atTop (nhds 0) := by ++ convert h_sum_zero using 2 ; erw [Finset.sum_Ico_eq_sub _ _] <;> norm_num [Finset.sum_range_succ'] ++ simpa [Finset.sum_range_succ] using h_sum_zero.sub (show Filter.Tendsto (fun x : ℝ => (μ ⌊x⌋₊ : ℝ) / ⌊x⌋₊) Filter.atTop (nhds 0) from tendsto_zero_iff_norm_tendsto_zero.mpr <| squeeze_zero (fun _ => by positivity) (fun x => by simpa using div_le_div_of_nonneg_right (show |(μ ⌊x⌋₊ : ℝ)| ≤ 1 from mod_cast by { unfold ArithmeticFunction.moebius; aesop }) <| Nat.cast_nonneg _) <| tendsto_inv_atTop_zero.comp <| tendsto_natCast_atTop_atTop.comp <| tendsto_nat_floor_atTop) ++ ++theorem chebyshev_asymptotic_pnt ++ {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : a.Coprime q) (ha' : a < q) : ++ (fun x ↦ ∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then log p else 0) ~[atTop] ++ fun x ↦ x / q.totient := by ++ let ψ_aq : ℝ → ℝ := fun x ↦ ∑ n ∈ Icc 1 ⌊x⌋₊, if n % q = a then Λ n else 0 ++ have htot_pos : (0 : ℝ) < q.totient := cast_pos.mpr (totient_pos.mpr hq) ++ have hψ_equiv : ψ_aq ~[atTop] fun x ↦ x / q.totient := by ++ have hW := WeakPNT_AP hq ha ha' ++ simp only [cumsum, ← Iio_eq_range] at hW ++ have hψ_eq x : ψ_aq x = ∑ n ∈ Iio (⌊x⌋₊ + 1), if n % q = a then Λ n else 0 := by ++ simp only [ψ_aq, show Icc 1 ⌊x⌋₊ = (Iio (⌊x⌋₊ + 1)).filter (1 ≤ ·) by ++ ext n; simp [mem_Icc, mem_filter]; tauto, sum_filter] ++ refine sum_congr rfl fun n _ ↦ ?_ ++ by_cases hn : 1 ≤ n <;> simp only [hn, ↓reduceIte] ++ push Not at hn; interval_cases n; simp ++ refine (isEquivalent_iff_tendsto_one ?_).mpr ?_ ++ · filter_upwards [eventually_ge_atTop 1] with x hx; exact div_ne_zero (by linarith) htot_pos.ne' ++ have hlim1 : Tendsto (fun x : ℝ ↦ (∑ n ∈ Iio (⌊x⌋₊ + 1), if n % q = a then Λ n else 0) / ++ (⌊x⌋₊ + 1 : ℝ)) atTop (nhds (1 / q.totient)) := by ++ have heq : (fun x : ℝ ↦ (∑ n ∈ Iio (⌊x⌋₊ + 1), if n % q = a then Λ n else 0) / ++ (⌊x⌋₊ + 1 : ℝ)) = (fun N ↦ (∑ n ∈ Iio N, if n % q = a then Λ n else 0) / N) ∘ ++ (fun x : ℝ ↦ ⌊x⌋₊ + 1) := by ext x; simp [Function.comp_apply] ++ exact heq ▸ hW.comp ((tendsto_add_atTop_nat 1).comp tendsto_nat_floor_atTop) ++ have hgoal_eq : (ψ_aq / fun x ↦ x / (q.totient : ℝ)) = ++ fun x ↦ ψ_aq x / x * q.totient := by ext x; simp only [Pi.div_apply, div_div_eq_mul_div]; ring ++ rw [hgoal_eq, show (1 : ℝ) = 1 / q.totient * 1 * q.totient by field_simp] ++ refine Tendsto.mul ?_ tendsto_const_nhds ++ have heq' : (fun x ↦ ψ_aq x / x) =ᶠ[atTop] ++ fun x ↦ (∑ n ∈ Iio (⌊x⌋₊ + 1), if n % q = a then Λ n else 0) / (⌊x⌋₊ + 1 : ℝ) * ((⌊x⌋₊ + 1 : ℝ) / x) := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ simp only [hψ_eq]; field_simp ++ exact Tendsto.congr' heq'.symm (hlim1.mul tendsto_floor_add_one_div_self) ++ refine Asymptotics.IsEquivalent.add_isLittleO'' hψ_equiv ++ (IsBigO.trans_isLittleO (g := fun x ↦ 2 * x.sqrt * x.log) ?_ ?_) ++ · rw [isBigO_iff']; refine ⟨1, one_pos, eventually_atTop.mpr ⟨2, fun x hx ↦ ?_⟩⟩ ++ simp only [Pi.sub_apply, norm_eq_abs, one_mul] ++ have hdiff_nonneg : 0 ≤ ψ_aq x - ∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then log p else 0 := by ++ simp only [ψ_aq, sub_nonneg] ++ calc (∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then log p else (0 : ℝ)) ++ ≤ ∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then Λ p else (0 : ℝ) := ++ sum_le_sum fun p hp ↦ by split_ifs <;> simp [vonMangoldt_apply_prime (mem_filter.mp hp).2] ++ _ ≤ ∑ n ∈ Icc 1 ⌊x⌋₊, if n % q = a then Λ n else (0 : ℝ) := ++ sum_le_sum_of_subset_of_nonneg ++ (fun p hp ↦ by simp only [mem_filter, mem_Iic, mem_Icc] at hp ⊢; exact ⟨hp.2.one_lt.le, hp.1⟩) ++ (fun n _ _ ↦ by split_ifs <;> [exact vonMangoldt_nonneg; rfl]) ++ have hdiff_le : ψ_aq x - (∑ p ∈ filter Nat.Prime (Iic ⌊x⌋₊), if p % q = a then log p else (0 : ℝ)) ≤ ψ x - θ x := by ++ simp only [ψ_aq, Chebyshev.psi_eq_sum_Icc, Chebyshev.theta_eq_sum_Icc] ++ conv_rhs => rw [Icc_zero_eq_insert, sum_insert (by simp : (0 : ℕ) ∉ Icc 1 ⌊x⌋₊), ++ show Λ 0 = 0 by simp only [ArithmeticFunction.map_zero], zero_add, ++ show filter Nat.Prime (insert 0 (Icc 1 ⌊x⌋₊)) = filter Nat.Prime (Icc 1 ⌊x⌋₊) by ++ simp [filter_insert, Nat.not_prime_zero]] ++ rw [filter_prime_Iic_eq_Icc, ← sum_filter_add_sum_filter_not (Icc 1 ⌊x⌋₊) Nat.Prime, ++ show (∑ p ∈ filter Nat.Prime (Icc 1 ⌊x⌋₊), if p % q = a then log p else (0 : ℝ)) = ++ ∑ p ∈ filter Nat.Prime (Icc 1 ⌊x⌋₊), if p % q = a then Λ p else (0 : ℝ) from ++ sum_congr rfl fun p hp ↦ by simp only [mem_filter] at hp; split_ifs <;> simp [vonMangoldt_apply_prime hp.2], ++ ← sum_filter_add_sum_filter_not (Icc 1 ⌊x⌋₊) Nat.Prime, ++ show (∑ p ∈ filter Nat.Prime (Icc 1 ⌊x⌋₊), Λ p) = ∑ p ∈ filter Nat.Prime (Icc 1 ⌊x⌋₊), log p from ++ sum_congr rfl fun p hp ↦ vonMangoldt_apply_prime (mem_filter.mp hp).2] ++ have h1 : (∑ n ∈ (Icc 1 ⌊x⌋₊).filter (¬Nat.Prime ·), if n % q = a then Λ n else (0 : ℝ)) ≤ ++ ∑ n ∈ (Icc 1 ⌊x⌋₊).filter (¬Nat.Prime ·), Λ n := ++ sum_le_sum fun n _ ↦ by split_ifs <;> [exact le_refl _; exact vonMangoldt_nonneg] ++ linarith ++ rw [abs_of_nonneg hdiff_nonneg, abs_of_nonneg (by bound)] ++ exact hdiff_le.trans ((le_abs_self _).trans (Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log (by linarith))) ++ · simpa only [mul_assoc] using ++ (isLittleO_sqrt_mul_log.const_mul_left 2).trans_isTheta (isTheta_self_div_const htot_pos.ne') ++ ++theorem dirichlet_thm {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) : ++ Infinite { p // p.Prime ∧ p % q = a } := by ++ have : {p | p.Prime ∧ p % q = a}.Infinite := by ++ have : {p | p.Prime ∧ p ≡ a [MOD q]}.Infinite := by ++ have := @infinite_setOfPred_prime_and_eq_mod ++ specialize @this q <| NeZero.of_pos hq ++ simp_all only [isUnit_iff_exists_inv, forall_exists_index, ← ZMod.natCast_eq_natCast_iff] ++ exact this (IsUnit.exists_right_inv (show IsUnit (a : ZMod q) from by ++ rwa [ZMod.isUnit_iff_coprime])).choose (IsUnit.exists_right_inv (show IsUnit (a : ZMod q) ++ from by rwa [ZMod.isUnit_iff_coprime])).choose_spec ++ exact this.mono fun p hp ↦ ⟨hp.1, by simpa [ModEq, mod_eq_of_lt ha'] using hp.2⟩ ++ exact Set.infinite_coe_iff.mpr this ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Defs.lean b/PrimeNumberTheoremAnd/Erdos970/Defs.lean +new file mode 100644 +index 0000000..e595955 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Defs.lean +@@ -0,0 +1,201 @@ ++import PrimeNumberTheoremAnd.Erdos970.Fourier ++import Mathlib.NumberTheory.Chebyshev ++ ++namespace Erdos970 ++ ++open ArithmeticFunction hiding log ++open Nat hiding log ++open Finset Topology ++open BigOperators Filter Real Classical Asymptotics ++open MeasureTheory intervalIntegral ++open scoped ArithmeticFunction.Moebius ++open scoped ArithmeticFunction.Omega Chebyshev ++ ++noncomputable abbrev nth_prime (n : ℕ) : ℕ := ++ Nat.nth Nat.Prime n ++ ++noncomputable abbrev nth_prime' (n : ℕ) : ℕ := ++ Nat.nth Nat.Prime (n - 1) ++ ++noncomputable abbrev Psi (x : ℝ) : ℝ := ψ x ++ ++noncomputable def M (x : ℝ) : ℝ := ++ ∑ n ∈ Iic ⌊x⌋₊, (μ n : ℝ) ++ ++noncomputable abbrev nth_prime_gap (n : ℕ) : ℕ := ++ nth_prime (n + 1) - nth_prime n ++ ++def prime_gap_record (p g : ℕ) : Prop := ++ ∃ n, nth_prime n = p ∧ nth_prime_gap n = g ∧ ++ ∀ k, nth_prime k < p → nth_prime_gap k < g ++ ++open Classical in ++ ++noncomputable def first_gap (g : ℕ) : ℕ := ++ if h : ∃ n, nth_prime_gap n = g then ++ nth_prime (Nat.find h) ++ else 0 ++ ++def first_gap_record (g P : ℕ) : Prop := ++ first_gap g = P ∧ ++ ∀ g' ∈ Finset.Ico 1 g, ++ Even g' ∨ g' = 1 → first_gap g' ∈ Set.Ico 1 P ++ ++def HasPrimeInInterval (x h : ℝ) : Prop := ++ ∃ p : ℕ, Nat.Prime p ∧ x < p ∧ p ≤ x + h ++ ++def HasPrimeInInterval.log_thm (X₀ : ℝ) (k : ℝ) := ++ ∀ x ≥ X₀, HasPrimeInInterval x (x / (log x) ^ k) ++ ++noncomputable def pi (x : ℝ) : ℝ := ++ Nat.primeCounting ⌊x⌋₊ ++ ++noncomputable def pi_star (x : ℝ) : ℝ := ++ ∑' (k : ℕ), pi (x ^ (1 / (k + 1 : ℝ))) / (k + 1 : ℝ) ++ ++noncomputable def li (x : ℝ) : ℝ := ++ lim ((𝓝[>] (0 : ℝ)).map (fun ε ↦ ++ ∫ t in Set.diff (Set.Ioc 0 x) (Set.Ioo (1 - ε) (1 + ε)), ++ 1 / log t)) ++ ++noncomputable def Li (x : ℝ) : ℝ := ∫ t in 2..x, 1 / log t ++ ++noncomputable def Eψ (x : ℝ) : ℝ := |ψ x - x| / x ++ ++noncomputable def admissible_bound (A B C R : ℝ) (x : ℝ) := ++ A * (log x / R) ^ B * exp (-C * (log x / R) ^ ((1 : ℝ) / (2 : ℝ))) ++ ++def Eψ.classicalBound (A B C R x₀ : ℝ) : Prop := ++ ∀ x ≥ x₀, Eψ x ≤ admissible_bound A B C R x ++ ++def Eψ.bound (ε x₀ : ℝ) : Prop := ∀ x ≥ x₀, Eψ x ≤ ε ++ ++def Eψ.numericalBound (x₀ : ℝ) (ε : ℝ → ℝ) : Prop := ++ Eψ.bound (ε x₀) x₀ ++ ++noncomputable def Eπ (x : ℝ) : ℝ := ++ |pi x - Li x| / (x / log x) ++ ++noncomputable def Eπ_star (x : ℝ) : ℝ := ++ |pi_star x - Li x| / (x / log x) ++ ++noncomputable def Eθ (x : ℝ) : ℝ := |θ x - x| / x ++ ++def Eθ.classicalBound (A B C R x₀ : ℝ) : Prop := ++ ∀ x ≥ x₀, Eθ x ≤ admissible_bound A B C R x ++ ++def Eθ.numericalBound (x₀ : ℝ) (ε : ℝ → ℝ) : Prop := ++ ∀ x ≥ x₀, Eθ x ≤ ε x₀ ++ ++def Eπ.classicalBound (A B C R x₀ : ℝ) : Prop := ++ ∀ x ≥ x₀, Eπ x ≤ admissible_bound A B C R x ++ ++def Eπ.bound (ε x₀ : ℝ) : Prop := ∀ x ≥ x₀, Eπ x ≤ ε ++ ++def Eπ.numericalBound (x₀ : ℝ) (ε : ℝ → ℝ) : Prop := ++ Eπ.bound (ε x₀) x₀ ++ ++def Eπ.vinogradovBound (A B C x₀ : ℝ) : Prop := ++ ∀ x ≥ x₀, Eπ x ≤ ++ A * (log x) ^ B * exp (-C * (log x) ^ ((3 : ℝ) / 5) / (log (log x)) ^ ((1 : ℝ) / 5)) ++ ++def Eπ_star.classicalBound (A B C R x₀ : ℝ) : Prop := ++ ∀ x ≥ x₀, Eπ_star x ≤ admissible_bound A B C R x ++ ++def Eπ_star.bound (ε x₀ : ℝ) : Prop := ++ ∀ x ≥ x₀, Eπ_star x ≤ ε ++ ++def Eπ_star.numericalBound (x₀ : ℝ) (ε : ℝ → ℝ) : Prop := ++ Eπ_star.bound (ε x₀) x₀ ++ ++def Eπ_star.vinogradovBound (A B C x₀ : ℝ) : Prop := ++ ∀ x ≥ x₀, Eπ_star x ≤ ++ A * (log x) ^ B * exp (-C * (log x) ^ ((3 : ℝ) / 5) / (log (log x)) ^ ((1 : ℝ) / 5)) ++ ++lemma admissible_bound.mono ++ (A B C R : ℝ) (hA : 0 < A) (hB : 0 < B) ++ (hC : 0 < C) (hR : 0 < R) : ++ AntitoneOn (admissible_bound A B C R) ++ (Set.Ici (exp (R * (2 * B / C) ^ 2))) := by ++ intro a ha b _ hab ++ simp only [admissible_bound, mul_assoc] ++ have hua : (2 * B / C) ^ 2 ≤ log a / R := by ++ rw [le_div_iff₀ hR, mul_comm ((2 * B / C) ^ 2), ← log_exp (R * (2 * B / C) ^ 2)] ++ exact log_le_log (exp_pos _) (Set.mem_Ici.mp ha) ++ have huab : log a / R ≤ log b / R := ++ div_le_div_of_nonneg_right ++ (log_le_log ((exp_pos _).trans_le (Set.mem_Ici.mp ha)) hab) hR.le ++ have hua₀ : 0 < log a / R := ++ lt_of_lt_of_le (by positivity) hua ++ apply mul_le_mul_of_nonneg_left _ hA.le ++ rw [rpow_def_of_pos (hua₀.trans_le huab), rpow_def_of_pos hua₀, ++ ← exp_add, ← exp_add, exp_le_exp] ++ let sa := (log a / R) ^ ((1 : ℝ) / 2) ++ let sb := (log b / R) ^ ((1 : ℝ) / 2) ++ rw [show log (log b / R) = 2 * log sb from by ++ grind [log_rpow (hua₀.trans_le huab) ((1 : ℝ) / 2)], ++ show log (log a / R) = 2 * log sa from by ++ grind [log_rpow hua₀ ((1 : ℝ) / 2)]] ++ have hsab : sa ≤ sb := ++ rpow_le_rpow (le_trans (by positivity) hua) huab (by positivity) ++ have : 2 * B / C ≤ sa := by ++ rw [show (2 * B / C : ℝ) = ((2 * B / C) ^ 2) ^ ((1 : ℝ) / 2) from by ++ rw [← rpow_natCast _ 2, ← rpow_mul (by positivity)] ++ norm_num [rpow_one]] ++ exact rpow_le_rpow (by positivity) hua (by positivity) ++ suffices h : AntitoneOn (fun t ↦ 2 * B * log t - C * t) (Set.Ici (2 * B / C)) by ++ grind [h (Set.mem_Ici.mpr this) (Set.mem_Ici.mpr (this.trans hsab)) hsab] ++ apply antitoneOn_of_deriv_nonpos (convex_Ici _) ++ · exact ((continuousOn_const.mul (continuousOn_log.mono fun t ht ↦ ++ ne_of_gt ((div_pos (by positivity) hC).trans_le ht))).sub ++ (continuousOn_const.mul continuousOn_id)) ++ · intro t ht ++ rw [interior_Ici] at ht ++ exact (((hasDerivAt_log ((div_pos (by positivity) hC).trans ht).ne').const_mul _).sub ++ ((hasDerivAt_id t).const_mul C)).differentiableAt.differentiableWithinAt ++ · intro t ht ++ rw [interior_Ici] at ht ++ have hdt : HasDerivAt (fun t ↦ 2 * B * log t - C * t) (2 * B * t⁻¹ - C * 1) t := ++ ((hasDerivAt_log ((div_pos (by positivity) hC).trans ht).ne').const_mul _).sub ++ ((hasDerivAt_id t).const_mul C) ++ rw [hdt.deriv, mul_one, sub_nonpos, ← div_eq_mul_inv, ++ div_le_iff₀ ((div_pos (by positivity) hC).trans ht)] ++ linarith [(div_lt_iff₀ hC).mp ht, mul_comm C t] ++ ++lemma Eψ.classicalBound.to_numericalBound ++ (A B C R x₀ x₁ : ℝ) (hA : 0 < A) (hB : 0 < B) ++ (hC : 0 < C) (hR : 0 < R) ++ (hEψ : Eψ.classicalBound A B C R x₀) ++ (hx₁ : x₁ ≥ max x₀ (Real.exp (R * (2 * B / C) ^ 2))) : ++ Eψ.numericalBound x₁ (fun x ↦ admissible_bound A B C R x) := ++ fun x hx ↦ ++ le_trans (hEψ x (le_trans (le_max_left ..) (le_trans hx₁ hx))) ++ (admissible_bound.mono A B C R hA hB hC hR ++ (Set.mem_Ici.mpr (le_trans (le_max_right ..) hx₁)) ++ (Set.mem_Ici.mpr (le_trans (le_max_right ..) (le_trans hx₁ hx))) hx) ++ ++lemma Eθ.classicalBound.to_numericalBound ++ (A B C R x₀ x₁ : ℝ) (hA : 0 < A) (hB : 0 < B) ++ (hC : 0 < C) (hR : 0 < R) ++ (hEθ : Eθ.classicalBound A B C R x₀) ++ (hx₁ : x₁ ≥ max x₀ (Real.exp (R * (2 * B / C) ^ 2))) : ++ Eθ.numericalBound x₁ (fun x ↦ admissible_bound A B C R x) := ++ fun x hx ↦ ++ le_trans (hEθ x (le_trans (le_max_left ..) (le_trans hx₁ hx))) ++ (admissible_bound.mono A B C R hA hB hC hR ++ (Set.mem_Ici.mpr (le_trans (le_max_right ..) hx₁)) ++ (Set.mem_Ici.mpr (le_trans (le_max_right ..) (le_trans hx₁ hx))) hx) ++ ++lemma Eπ.classicalBound.to_numericalBound ++ (A B C R x₀ x₁ : ℝ) (hA : 0 < A) (hB : 0 < B) ++ (hC : 0 < C) (hR : 0 < R) ++ (hEπ : Eπ.classicalBound A B C R x₀) ++ (hx₁ : x₁ ≥ max x₀ (Real.exp (R * (2 * B / C) ^ 2))) : ++ Eπ.numericalBound x₁ (fun x ↦ admissible_bound A B C R x) := ++ fun x hx ↦ ++ le_trans (hEπ x (le_trans (le_max_left ..) (le_trans hx₁ hx))) ++ (admissible_bound.mono A B C R hA hB hC hR ++ (Set.mem_Ici.mpr (le_trans (le_max_right ..) hx₁)) ++ (Set.mem_Ici.mpr (le_trans (le_max_right ..) (le_trans hx₁ hx))) hx) ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/EulerMaclaurin.lean b/PrimeNumberTheoremAnd/Erdos970/EulerMaclaurin.lean +new file mode 100644 +index 0000000..ecfb419 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/EulerMaclaurin.lean +@@ -0,0 +1,75 @@ ++import Mathlib.NumberTheory.AbelSummation ++ ++namespace Erdos970 ++ ++open Finset Interval MeasureTheory ++ ++variable {𝕜 : Type*} [RCLike 𝕜] {f : ℝ → 𝕜} {a b : ℝ} ++ ++noncomputable def B1 (x : ℝ) : ℝ := x - ⌊x⌋₊ - 1 / 2 ++ ++@[fun_prop] ++lemma aestronglyMeasurable_B1 : AEStronglyMeasurable B1 := by ++ unfold B1 ++ fun_prop ++ ++lemma abs_B1_le_half {x : ℝ} (hx : 0 ≤ x) : |B1 x| ≤ 1 / 2 := by ++ unfold B1 ++ refine abs_le.mpr ⟨?_, ?_⟩ ++ · grind [Nat.floor_le hx] ++ · grind [Nat.lt_succ_floor x] ++ ++lemma integral_deriv_mul_add_const (c : 𝕜) (hab : a ≤ b) (h_int : IntervalIntegrable (deriv f) volume a b) ++ (hf_diff : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) : ++ ∫ t in a..b, (t + c) * deriv f t = (b + c) * f b - (a + c) * f a - ∫ t in a..b, f t := by ++ rw [← Set.uIcc_of_le hab] at hf_diff ++ have : ∀ t ∈ [[a, b]], HasDerivAt (fun (t : ℝ) ↦ t + c) 1 t := by ++ intro t ht ++ simp only [hasDerivAt_add_const_iff] ++ convert! ContinuousLinearMap.hasDerivAt (RCLike.ofRealCLM (K := 𝕜)) using 1 ++ simp ++ replace hf_diff := fun t ht ↦ (hf_diff t ht).hasDerivAt ++ rw [intervalIntegral.integral_mul_deriv_eq_deriv_mul this hf_diff (by simp) h_int] ++ simp ++ ++lemma intervalIntegrable_deriv_mul_B1 (ha : 0 ≤ a) (hab : a ≤ b) (h_cont : ContinuousOn (deriv f) [[a, b]]) : ++ IntervalIntegrable (fun t ↦ deriv f t * B1 t) volume a b := by ++ refine IntervalIntegrable.continuousOn_mul ?_ h_cont ++ rw [intervalIntegrable_iff'] ++ apply MeasureTheory.Measure.integrableOn_of_bounded (by simp) (by fun_prop) (M := 1 / 2) ++ filter_upwards [self_mem_ae_restrict (by measurability)] with x hx ++ rw [Set.uIcc_of_le hab, Set.mem_Icc] at hx ++ norm_cast ++ exact abs_B1_le_half (by linarith) ++ ++lemma integral_deriv_mul_floor_add_one (ha : 0 ≤ a) (hab : a ≤ b) ++ (hf_diff : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) (h_cont : ContinuousOn (deriv f) [[a, b]]) : ++ ∫ t in a..b, deriv f t * (⌊t⌋₊ + 1) = (b + 1 / 2) * f b - (a + 1 / 2) * f a - (∫ t in a..b, f t) - ∫ t in a..b, deriv f t * B1 t := by ++ calc ++ _ = ∫ t in a..b, (deriv f t * (t + 1 / 2) -deriv f t * B1 t) := by ++ congr ++ ext ++ simp only [B1] ++ push_cast ++ ring ++ _ = (∫ t in a..b, deriv f t * (t + 1 / 2)) - ∫ t in a..b, deriv f t * B1 t := by ++ exact intervalIntegral.integral_sub (ContinuousOn.intervalIntegrable (by fun_prop)) (intervalIntegrable_deriv_mul_B1 ha hab h_cont) ++ _ = _ := by ++ conv => lhs; arg 1; arg 1; ext; rw [mul_comm] ++ rw [integral_deriv_mul_add_const _ hab h_cont.intervalIntegrable hf_diff] ++ ++theorem sum_eq_integral_add_integral_deriv (ha : 0 ≤ a) (hab : a ≤ b) ++ (hf_diff : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) ++ (h_cont : ContinuousOn (deriv f) [[a, b]]) : ++ ∑ k ∈ Ioc ⌊a⌋₊ ⌊b⌋₊, f k = ++ f a * B1 a - f b * B1 b + (∫ t in a..b, f t) + ∫ t in a..b, deriv f t * B1 t := by ++ have := sum_mul_eq_sub_sub_integral_mul (fun _ ↦ 1) ha hab hf_diff (Set.uIcc_of_le hab ▸ h_cont).integrableOn_Icc ++ simp only [mul_one, sum_const, Nat.card_Icc, tsub_zero, nsmul_eq_mul, Nat.cast_add, ++ Nat.cast_one] at this ++ rw [this, ← intervalIntegral.integral_of_le hab] ++ rw [integral_deriv_mul_floor_add_one ha hab hf_diff h_cont] ++ unfold B1 ++ push_cast ++ ring ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Fourier.lean b/PrimeNumberTheoremAnd/Erdos970/Fourier.lean +new file mode 100644 +index 0000000..32fe27c +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Fourier.lean +@@ -0,0 +1,181 @@ ++import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv ++import Mathlib.MeasureTheory.Integral.IntegralEqImproper ++import Mathlib.Topology.ContinuousMap.Bounded.Basic ++import Mathlib.Order.Filter.ZeroAndBoundedAtFilter ++import Mathlib.Analysis.Fourier.FourierTransformDeriv ++import PrimeNumberTheoremAnd.Erdos970.Sobolev ++ ++namespace Erdos970 ++ ++open FourierTransform Real Complex MeasureTheory Filter Topology BoundedContinuousFunction ++ SchwartzMap VectorFourier BigOperators ++ ++local instance {E : Type*} : Coe (E → ℝ) (E → ℂ) := ⟨fun f n => f n⟩ ++ ++section lemmas ++ ++@[simp] ++theorem nnnorm_eq_of_mem_circle (z : Circle) : ‖z.val‖₊ = 1 := NNReal.coe_eq_one.mp (by simp) ++ ++@[simp] ++theorem nnnorm_circle_smul (z : Circle) (s : ℂ) : ‖z • s‖₊ = ‖s‖₊ := by ++ simp [show z • s = z.val * s from rfl] ++ ++noncomputable def e (u : ℝ) : ℝ →ᵇ ℂ where ++ toFun v := 𝐞 (-v * u) ++ map_bounded' := ++ ⟨2, fun x y => (dist_le_norm_add_norm _ _).trans (by simp [one_add_one_eq_two])⟩ ++ ++@[simp] lemma e_apply (u : ℝ) (v : ℝ) : e u v = 𝐞 (-v * u) := rfl ++ ++theorem hasDerivAt_e {u x : ℝ} : HasDerivAt (e u) (-2 * π * u * I * e u x) x := by ++ have l2 : HasDerivAt (fun v => -v * u) (-u) x := by ++ simpa only [neg_mul_comm] using hasDerivAt_mul_const (-u) ++ convert! (hasDerivAt_fourierChar (-x * u)).scomp x l2 using 1 ++ change _ = ((-u : ℝ) : ℂ) * _ ++ simp ; ring ++ ++lemma fourierIntegral_deriv_aux2 (e : ℝ →ᵇ ℂ) {f : ℝ → ℂ} (hf : Integrable f) : ++ Integrable (⇑e * f) := ++ hf.bdd_mul e.continuous.aestronglyMeasurable (ae_of_all _ e.norm_coe_le_norm) ++ ++@[simp] lemma F_neg {f : ℝ → ℂ} {u : ℝ} : 𝓕 (fun x => -f x) u = - 𝓕 f u := by ++ simp [fourier_eq, integral_neg] ++ ++@[simp] lemma F_add {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : ++ 𝓕 (fun x => f x + g x) x = 𝓕 f x + 𝓕 g x := by ++ have : Continuous fun p : ℝ × ℝ ↦ ((innerₗ ℝ) p.1) p.2 := continuous_inner ++ have := fourierIntegral_add continuous_fourierChar this hf hg ++ exact congr_fun this x ++ ++@[simp] lemma F_sub {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : ++ 𝓕 (fun x => f x - g x) x = 𝓕 f x - 𝓕 g x := by ++ simpa [sub_eq_add_neg, Pi.neg_def] using F_add hf hg.neg x ++ ++@[simp] lemma F_mul {f : ℝ → ℂ} {c : ℂ} {u : ℝ} : ++ 𝓕 (fun x => c * f x) u = c * 𝓕 f u := by ++ exact congr_fun (VectorFourier.fourierIntegral_const_smul 𝐞 _ _ f c) u ++ ++end lemmas ++ ++theorem fourierIntegral_self_add_deriv_deriv (f : W21) (u : ℝ) : ++ (1 + u ^ 2) * 𝓕 (f : ℝ → ℂ) u = ++ 𝓕 (fun u : ℝ => (f u - (1 / (4 * π ^ 2)) * deriv^[2] f u : ℂ)) u := by ++ have l1 : Integrable (fun x => (((π : ℂ) ^ 2)⁻¹ * 4⁻¹) * deriv (deriv f) x) := by ++ apply Integrable.const_mul ; simpa [iteratedDeriv_succ] using f.integrable le_rfl ++ have l4 : Differentiable ℝ f := f.differentiable ++ have l5 : Differentiable ℝ (deriv f) := f.deriv.differentiable ++ simp [f.hf, l1, add_mul, Real.fourier_deriv f.hf' l5 f.hf'', Real.fourier_deriv f.hf l4 f.hf'] ++ field_simp [pi_ne_zero] ; ring_nf ; simp ++ ++@[simp] lemma deriv_ofReal : deriv ofReal = fun _ => 1 := by ++ ext x ; exact ((hasDerivAt_id x).ofReal_comp).deriv ++ ++lemma tendsto_intervalIntegral_zero_of_uniform_norm_bound ++ {f : ℝ → ℝ → ℂ} {lo hi : ℝ} {B : ℝ → ℝ} ++ (hB : Filter.Tendsto (fun T : ℝ => B T * |hi - lo|) Filter.atTop (nhds 0)) ++ (hf : ∀ᶠ T in Filter.atTop, ∀ x ∈ Set.uIoc lo hi, ‖f T x‖ ≤ B T) : ++ Filter.Tendsto (fun T : ℝ => ∫ x in lo..hi, f T x) Filter.atTop (nhds 0) := by ++ rw [tendsto_zero_iff_norm_tendsto_zero] ++ refine squeeze_zero' (Eventually.of_forall fun T => norm_nonneg _) ?_ hB ++ filter_upwards [hf] with T hT ++ exact intervalIntegral.norm_integral_le_of_norm_le_const (fun x hx => hT x hx) ++ ++lemma tendsto_const_mul_log_add_two_div_add_two_atTop (K : ℝ) : ++ Filter.Tendsto (fun T : ℝ => K * (Real.log (T + 2) / (T + 2))) ++ Filter.atTop (nhds 0) := by ++ have h0 : Filter.Tendsto (fun x : ℝ => Real.log x / x) Filter.atTop (nhds 0) := by ++ simpa using (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 (by norm_num : (1 : ℝ) ≠ 0)) ++ have hshift : Filter.Tendsto (fun T : ℝ => Real.log (T + 2) / (T + 2)) ++ Filter.atTop (nhds 0) := by ++ have := h0.comp (tendsto_atTop_add_const_right Filter.atTop 2 tendsto_id) ++ simpa [Function.comp_def] using this ++ simpa using hshift.const_mul K ++ ++lemma norm_fourier_le_integral_deriv_div ++ (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) ++ (hg' : Integrable (deriv g)) {w : ℝ} (hw : w ≠ 0) : ++ ‖𝓕 g w‖ ≤ (∫ x, ‖deriv g x‖ ∂volume) / ((2 * Real.pi) * |w|) := by ++ have hmul : ++ 𝓕 (deriv g) w = (2 * Real.pi * Complex.I * (w : ℂ)) * 𝓕 g w := by ++ have h := congrFun (Real.fourier_deriv hg hdiff hg') w ++ simpa [smul_eq_mul, mul_assoc] using h ++ have h_fourier : ++ ‖𝓕 (deriv g) w‖ ≤ ∫ x, ‖deriv g x‖ ∂volume := by ++ exact VectorFourier.norm_fourierIntegral_le_integral_norm 𝐞 volume (innerₗ ℝ) ++ (deriv g) w ++ have hleft : ++ ((2 * Real.pi) * |w|) * ‖𝓕 g w‖ = ++ ‖(2 * Real.pi * Complex.I * (w : ℂ)) * 𝓕 g w‖ := by ++ have htwopi : ‖(2 * ↑Real.pi : ℂ)‖ = 2 * Real.pi := by ++ rw [norm_mul, Complex.norm_two, Complex.norm_of_nonneg Real.pi_pos.le] ++ have hwc : ‖(w : ℂ)‖ = |w| := by rw [norm_real, Real.norm_eq_abs] ++ rw [norm_mul, norm_mul, norm_mul, htwopi, norm_I, hwc] ++ ring ++ have hmain : ((2 * Real.pi) * |w|) * ‖𝓕 g w‖ ≤ ∫ x, ‖deriv g x‖ ∂volume := by ++ rw [hleft, ← hmul] ++ exact h_fourier ++ have hpos : 0 < (2 * Real.pi) * |w| := by ++ positivity ++ exact (le_div_iff₀ hpos).mpr (by simpa [mul_comm, mul_left_comm, mul_assoc] using hmain) ++ ++lemma norm_oscillatory_integral_le_integral_deriv_div ++ (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) ++ (hg' : Integrable (deriv g)) {T : ℝ} (hT : 0 < T) : ++ ‖∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume‖ ≤ ++ (∫ x, ‖deriv g x‖ ∂volume) / T := by ++ have hw : -T / (2 * Real.pi) ≠ 0 := by ++ exact div_ne_zero (neg_ne_zero.mpr hT.ne') (mul_ne_zero two_ne_zero Real.pi_ne_zero) ++ have hfourier := norm_fourier_le_integral_deriv_div g hg hdiff hg' hw ++ have heq : ++ (∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume) = ++ 𝓕 g (-T / (2 * Real.pi)) := by ++ rw [Real.fourier_real_eq_integral_exp_smul] ++ apply integral_congr_ae ++ filter_upwards with y ++ rw [smul_eq_mul] ++ rw [mul_comm (g y)] ++ congr 1 ++ congr 1 ++ push_cast ++ field_simp [Real.pi_ne_zero] ++ rw [heq] ++ refine hfourier.trans_eq ?_ ++ congr 1 ++ have hden : (2 * Real.pi) * |-T / (2 * Real.pi)| = T := by ++ have htwopi_pos : 0 < 2 * Real.pi := by positivity ++ have hneg : -T / (2 * Real.pi) < 0 := div_neg_of_neg_of_pos (neg_neg_of_pos hT) htwopi_pos ++ rw [abs_of_neg hneg] ++ field_simp [Real.pi_ne_zero] ++ rw [hden] ++ ++lemma norm_oscillatory_integral_le_integral_deriv_div_abs ++ (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) ++ (hg' : Integrable (deriv g)) {T : ℝ} (hT : T ≠ 0) : ++ ‖∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume‖ ≤ ++ (∫ x, ‖deriv g x‖ ∂volume) / |T| := by ++ have hw : -T / (2 * Real.pi) ≠ 0 := by ++ exact div_ne_zero (neg_ne_zero.mpr hT) (mul_ne_zero two_ne_zero Real.pi_ne_zero) ++ have hfourier := norm_fourier_le_integral_deriv_div g hg hdiff hg' hw ++ have heq : ++ (∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume) = ++ 𝓕 g (-T / (2 * Real.pi)) := by ++ rw [Real.fourier_real_eq_integral_exp_smul] ++ apply integral_congr_ae ++ filter_upwards with y ++ rw [smul_eq_mul] ++ rw [mul_comm (g y)] ++ congr 1 ++ congr 1 ++ push_cast ++ field_simp [Real.pi_ne_zero] ++ rw [heq] ++ refine hfourier.trans_eq ?_ ++ congr 1 ++ have hden : (2 * Real.pi) * |-T / (2 * Real.pi)| = |T| := by ++ have htwopi_pos : 0 < 2 * Real.pi := by positivity ++ rw [abs_div, abs_neg, abs_of_pos htwopi_pos] ++ field_simp [Real.pi_ne_zero] ++ rw [hden] ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/HadamardSupport.lean b/PrimeNumberTheoremAnd/Erdos970/HadamardSupport.lean +new file mode 100644 +index 0000000..8c19850 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/HadamardSupport.lean +@@ -0,0 +1,6805 @@ ++import Mathlib ++ ++namespace Erdos970 ++ ++section HadamardAssemblyScope ++ ++section HadamardSourceScope00 ++ ++open scoped BigOperators ++ ++namespace Real ++ ++open _root_.Real ++ ++lemma pow_div_one_sub_le_two_mul {r : ℝ} (hr : 0 ≤ r) (hrhalf : r ≤ 1 / 2) (m : ℕ) : ++ r ^ (m + 1) / (1 - r) ≤ 2 * r ^ (m + 1) := by ++ have hpow : 0 ≤ r ^ (m + 1) := pow_nonneg hr _ ++ have hhalf' : (1 / 2 : ℝ) ≤ 1 - r := by linarith ++ calc ++ r ^ (m + 1) / (1 - r) ≤ r ^ (m + 1) / (1 / 2 : ℝ) := by ++ exact div_le_div_of_nonneg_left hpow (by positivity) hhalf' ++ _ = 2 * r ^ (m + 1) := by ring ++ ++end Real ++ ++namespace Complex ++ ++open _root_.Complex ++ ++open scoped BigOperators in ++ ++lemma neg_log_one_sub_eq_tsum {z : ℂ} (hz : ‖z‖ < 1) : ++ -log (1 - z) = ∑' n : ℕ, z ^ (n + 1) / (n + 1) := by ++ have h := hasSum_taylorSeries_neg_log hz ++ rw [← h.tsum_eq, h.summable.tsum_eq_zero_add] ++ simp only [pow_zero, Nat.cast_zero, div_zero, zero_add, Nat.cast_add, Nat.cast_one] ++ ++noncomputable ++def partialLogSum (m : ℕ) (z : ℂ) : ℂ := ++ -logTaylor (m + 1) (-z) ++ ++@[simp] ++lemma partialLogSum_zero (z : ℂ) : partialLogSum 0 z = 0 := by ++ simp [partialLogSum, logTaylor_succ, logTaylor_zero] ++ ++@[simp] ++lemma partialLogSum_at_zero (m : ℕ) : partialLogSum m 0 = 0 := by ++ simp [partialLogSum, logTaylor_at_zero] ++ ++lemma logTaylor_succ_neg (n : ℕ) (z : ℂ) : ++ logTaylor (n + 1) (-z) = logTaylor n (-z) - z ^ n / n := by ++ rw [logTaylor_succ, Pi.add_apply] ++ have hsign : (-1 : ℂ) ^ (n + 1) * (-z) ^ n = -z ^ n := by ++ have hzpow : (-z) ^ n = (((-1 : ℂ) * z) ^ n) := by simp ++ rw [hzpow, mul_pow, ← mul_assoc, ← pow_add] ++ have hpow : (-1 : ℂ) ^ (n + 1 + n) = (-1 : ℂ) := by ++ rw [show n + 1 + n = 2 * n + 1 by omega, pow_add, pow_mul] ++ norm_num ++ rw [hpow] ++ ring ++ rw [show (-1 : ℂ) ^ (n + 1) * (-z) ^ n / n = -(z ^ n / n) by ++ rw [hsign] ++ ring] ++ abel ++ ++lemma logTaylor_neg_eq_neg_sum (m : ℕ) (z : ℂ) : ++ logTaylor (m + 1) (-z) = -∑ k ∈ Finset.range m, z ^ (k + 1) / (k + 1) := by ++ induction m with ++ | zero => ++ simp [logTaylor_succ, logTaylor_zero] ++ | succ m hm => ++ rw [logTaylor_succ_neg, hm, Finset.sum_range_succ] ++ have hcast : ((m + 1 : ℕ) : ℂ) = (1 + (m : ℂ)) := by ++ simp [Nat.cast_add, Nat.cast_one, add_comm] ++ rw [hcast] ++ ring_nf ++ ++lemma partialLogSum_eq_sum (m : ℕ) (z : ℂ) : ++ partialLogSum m z = ∑ k ∈ Finset.range m, z ^ (k + 1) / (k + 1) := by ++ simpa [partialLogSum] using congrArg Neg.neg (logTaylor_neg_eq_neg_sum m z) ++ ++lemma hasDerivAt_partialLogSum (m : ℕ) (z : ℂ) : ++ HasDerivAt (partialLogSum m) (∑ j ∈ Finset.range m, z ^ j) z := by ++ cases m with ++ | zero => ++ have hzero : partialLogSum 0 = fun _ : ℂ ↦ (0 : ℂ) := by ++ funext w ++ exact partialLogSum_zero w ++ simpa [hzero] using (hasDerivAt_const z (c := (0 : ℂ))) ++ | succ m => ++ have hsum : ++ (∑ j ∈ Finset.range (m + 1), z ^ j) = ++ ∑ j ∈ Finset.range (m + 1), (-1) ^ j * (-z) ^ j := by ++ refine Finset.sum_congr rfl ?_ ++ intro j hj ++ symm ++ calc ++ (-1 : ℂ) ^ j * (-z) ^ j = (-1 : ℂ) ^ j * (((-1 : ℂ) * z) ^ j) := by simp ++ _ = ((-1 : ℂ) ^ j * (-1 : ℂ) ^ j) * z ^ j := by rw [mul_pow]; ring ++ _ = z ^ j := by ++ rw [← pow_add, show j + j = 2 * j by omega, pow_mul] ++ norm_num ++ rw [hsum] ++ simpa [partialLogSum] using! ++ (((hasDerivAt_logTaylor (m + 1) (-z)).comp z (hasDerivAt_neg z)).neg) ++ ++lemma differentiable_partialLogSum (m : ℕ) : ++ Differentiable ℂ (fun z : ℂ => partialLogSum m z) := by ++ intro z ++ exact (hasDerivAt_partialLogSum m z).differentiableAt ++ ++noncomputable ++def logTail (m : ℕ) (z : ℂ) : ℂ := ++ ∑' k, z ^ (m + 1 + k) / (m + 1 + k) ++ ++lemma summable_logTail {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : ++ Summable (fun k => z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)) := by ++ have h_geom : Summable (fun k : ℕ => ‖z‖ ^ k) := ++ summable_geometric_of_lt_one (norm_nonneg z) hz ++ refine Summable.of_norm_bounded (g := fun k => ‖z‖ ^ k) h_geom ?_ ++ intro k ++ rw [norm_div, norm_pow] ++ have h1 : (1 : ℝ) ≤ (m + 1 + k : ℝ) := by ++ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity ++ nlinarith ++ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (Complex.norm_natCast (m + 1 + k)) ++ rw [hnorm] ++ calc ++ ‖z‖ ^ (m + 1 + k) / (m + 1 + k : ℝ) ≤ ‖z‖ ^ (m + 1 + k) := by ++ exact div_le_self (pow_nonneg (norm_nonneg z) _) h1 ++ _ = ‖z‖ ^ (m + 1) * ‖z‖ ^ k := by rw [pow_add] ++ _ ≤ 1 * ‖z‖ ^ k := by ++ refine mul_le_mul_of_nonneg_right ?_ (pow_nonneg (norm_nonneg z) k) ++ exact pow_le_one₀ (norm_nonneg z) (le_of_lt hz) ++ _ = ‖z‖ ^ k := one_mul _ ++ ++lemma norm_logTail_le {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : ++ ‖logTail m z‖ ≤ ‖z‖ ^ (m + 1) / (1 - ‖z‖) := by ++ dsimp only [logTail] ++ have h_rhs_summable : Summable (fun k => ‖z‖ ^ (m + 1 + k)) := by ++ simpa [pow_add] using ++ (summable_geometric_of_lt_one (norm_nonneg z) hz).mul_left (‖z‖ ^ (m + 1)) ++ have h_norm_summable : Summable (fun k => ‖z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖) := by ++ refine Summable.of_nonneg_of_le (fun _ => norm_nonneg _) ?_ h_rhs_summable ++ intro k ++ rw [norm_div, norm_pow] ++ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (Complex.norm_natCast (m + 1 + k)) ++ rw [hnorm] ++ have hm : 1 ≤ (m + 1 + k : ℝ) := by ++ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity ++ nlinarith ++ exact div_le_self (pow_nonneg (norm_nonneg z) _) hm ++ calc ++ ‖∑' k, z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖ ++ ≤ ∑' k, ‖z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖ := ++ norm_tsum_le_tsum_norm h_norm_summable ++ _ ≤ ∑' k, ‖z‖ ^ (m + 1 + k) := by ++ refine h_norm_summable.tsum_le_tsum ?_ h_rhs_summable ++ intro k ++ rw [norm_div, norm_pow] ++ have hm : 1 ≤ (m + 1 + k : ℝ) := by ++ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity ++ nlinarith ++ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (Complex.norm_natCast (m + 1 + k)) ++ rw [hnorm] ++ exact div_le_self (pow_nonneg (norm_nonneg z) _) hm ++ _ = ‖z‖ ^ (m + 1) / (1 - ‖z‖) := by ++ have h_eq : ++ (fun k => ‖z‖ ^ (m + 1 + k)) = fun k => ‖z‖ ^ (m + 1) * ‖z‖ ^ k := by ++ ext k ++ rw [pow_add] ++ rw [h_eq, tsum_mul_left] ++ have h_geom := hasSum_geometric_of_lt_one (norm_nonneg z) hz ++ rw [h_geom.tsum_eq, div_eq_mul_inv] ++ ++lemma norm_logTail_le_two_mul_norm_pow {z : ℂ} (hz : ‖z‖ < 1) (hzhalf : ‖z‖ ≤ 1 / 2) (m : ℕ) : ++ ‖logTail m z‖ ≤ 2 * ‖z‖ ^ (m + 1) := ++ (norm_logTail_le hz m).trans (Real.pow_div_one_sub_le_two_mul (norm_nonneg z) hzhalf m) ++ ++lemma norm_partialLogSum_le_nat_mul_max_one_norm_pow (m : ℕ) (z : ℂ) : ++ ‖partialLogSum m z‖ ≤ (m : ℝ) * max 1 (‖z‖ ^ m) := by ++ have hsum : ++ ‖partialLogSum m z‖ ≤ ∑ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖ := by ++ rw [partialLogSum_eq_sum] ++ exact norm_sum_le _ _ ++ have hterm : ∀ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖ ≤ max 1 (‖z‖ ^ m) := by ++ intro k hk ++ rw [norm_div, norm_pow] ++ have hk1 : (1 : ℝ) ≤ (k : ℝ) + 1 := by ++ have hk1_nat : (1 : ℕ) ≤ k + 1 := Nat.succ_le_succ (Nat.zero_le k) ++ exact_mod_cast hk1_nat ++ have hdenom : ‖((k : ℂ) + 1)‖ = (k : ℝ) + 1 := by ++ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (Complex.norm_natCast (k + 1)) ++ have hk_le : k + 1 ≤ m := Nat.succ_le_iff.2 (Finset.mem_range.1 hk) ++ have hpow_le : ‖z‖ ^ (k + 1) ≤ max 1 (‖z‖ ^ m) := by ++ have hz0 : 0 ≤ ‖z‖ := norm_nonneg z ++ by_cases hz1 : ‖z‖ ≤ (1 : ℝ) ++ · have : ‖z‖ ^ (k + 1) ≤ 1 := by exact pow_le_one₀ hz0 hz1 ++ exact this.trans (le_max_left _ _) ++ · have hz1' : (1 : ℝ) ≤ ‖z‖ := le_of_lt (lt_of_not_ge hz1) ++ have : ‖z‖ ^ (k + 1) ≤ ‖z‖ ^ m := pow_le_pow_right₀ hz1' hk_le ++ exact this.trans (le_max_right _ _) ++ calc ++ ‖z‖ ^ (k + 1) / ‖((k : ℂ) + 1)‖ = ‖z‖ ^ (k + 1) / ((k : ℝ) + 1) := by simp [hdenom] ++ _ ≤ ‖z‖ ^ (k + 1) := by ++ exact div_le_self (pow_nonneg (norm_nonneg z) _) hk1 ++ _ ≤ max 1 (‖z‖ ^ m) := hpow_le ++ have hsum_le : ++ (∑ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖) ≤ ++ ∑ _k ∈ Finset.range m, max 1 (‖z‖ ^ m) := ++ Finset.sum_le_sum (fun k hk => hterm k hk) ++ have hcard : ∑ _k ∈ Finset.range m, max 1 (‖z‖ ^ m) = (m : ℝ) * max 1 (‖z‖ ^ m) := by ++ simp [Finset.sum_const] ++ exact hsum.trans (hsum_le.trans_eq hcard) ++ ++lemma neg_log_one_sub_eq_partialLogSum_add_logTail {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : ++ -log (1 - z) = partialLogSum m z + logTail m z := by ++ let f : ℕ → ℂ := fun k ↦ z ^ (k + 1) / ((k : ℂ) + 1) ++ have h_summable : Summable f := by ++ simpa [f, Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (summable_logTail hz 0) ++ have h_decomp := h_summable.sum_add_tsum_nat_add m ++ rw [neg_log_one_sub_eq_tsum hz, partialLogSum_eq_sum, ← h_decomp] ++ congr 1 ++ dsimp only [logTail] ++ refine tsum_congr fun k ↦ ?_ ++ simp only [f, Nat.cast_add] ++ ring_nf ++ ++end Complex ++end HadamardSourceScope00 ++ ++section HadamardSourceScope01 ++ ++noncomputable section ++ ++namespace Complex ++ ++open _root_.Complex ++ ++variable {z : ℂ} ++ ++@[bound] ++theorem neg_norm_le_re (z : ℂ) : -‖z‖ ≤ z.re := ++ neg_le_of_abs_le (abs_re_le_norm z) ++ ++lemma norm_inv_pow_le_one_of_one_le_norm (u : ℂ) (n : ℕ) (hu : (1 : ℝ) ≤ ‖u‖) : ++ ‖(u ^ n)⁻¹‖ ≤ 1 := by ++ have hge : (1 : ℝ) ≤ ‖u ^ n‖ := by ++ rw [Complex.norm_pow] ++ exact one_le_pow₀ hu ++ calc ‖(u ^ n)⁻¹‖ = ‖(1 : ℂ) / u ^ n‖ := by rw [inv_eq_one_div] ++ _ = 1 / ‖u ^ n‖ := by ++ have hone : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp ++ rw [Complex.norm_div, hone] ++ _ ≤ 1 := by simpa [one_div] using inv_le_one_of_one_le₀ hge ++ ++end Complex ++end ++end HadamardSourceScope01 ++ ++section HadamardSourceScope02 ++ ++noncomputable section ++ ++open scoped BigOperators ++open Set ++ ++namespace Complex ++ ++open _root_.Complex ++ ++def weierstrassFactor (m : ℕ) (z : ℂ) : ℂ := ++ (1 - z) * exp (partialLogSum m z) ++ ++lemma weierstrassFactor_def (m : ℕ) (z : ℂ) : ++ weierstrassFactor m z = (1 - z) * exp (partialLogSum m z) := by ++ simp [weierstrassFactor] ++ ++@[simp] ++lemma weierstrassFactor_at_zero (m : ℕ) : weierstrassFactor m 0 = 1 := by ++ simp [weierstrassFactor, partialLogSum_at_zero] ++ ++lemma weierstrassFactor_eq_zero_iff (m : ℕ) (z : ℂ) : ++ weierstrassFactor m z = 0 ↔ z = 1 := by ++ constructor ++ · intro hz ++ rw [weierstrassFactor] at hz ++ rcases mul_eq_zero.mp hz with h1 | h2 ++ · exact (sub_eq_zero.mp h1).symm ++ · exact absurd h2 (exp_ne_zero _) ++ · rintro rfl ++ simp [weierstrassFactor] ++ ++lemma weierstrassFactor_ne_zero_iff (m : ℕ) (z : ℂ) : ++ weierstrassFactor m z ≠ 0 ↔ z ≠ 1 := by ++ simpa [ne_eq] using (not_congr (weierstrassFactor_eq_zero_iff (m := m) (z := z))) ++ ++lemma weierstrassFactor_ne_zero_of_ne_one (m : ℕ) {z : ℂ} (hz : z ≠ 1) : ++ weierstrassFactor m z ≠ 0 := ++ (weierstrassFactor_ne_zero_iff (m := m) (z := z)).2 hz ++ ++lemma differentiable_weierstrassFactor (m : ℕ) : ++ Differentiable ℂ (fun z : ℂ => weierstrassFactor m z) := by ++ simpa [weierstrassFactor] using! ++ ((differentiable_const (c := (1 : ℂ))).sub differentiable_id).mul ++ (differentiable_exp.comp (differentiable_partialLogSum m)) ++ ++theorem analyticOrderAt_weierstrassFactor_div_self (m : ℕ) {a : ℂ} (ha : a ≠ 0) : ++ analyticOrderAt (fun z : ℂ => weierstrassFactor m (z / a)) a = (1 : ℕ∞) := by ++ set F : ℂ → ℂ := fun z => weierstrassFactor m (z / a) ++ have hF : AnalyticAt ℂ F a := by ++ have hdiv : Differentiable ℂ (fun z : ℂ => z / a) := by ++ simp [div_eq_mul_inv] ++ have hdiff : Differentiable ℂ F := (differentiable_weierstrassFactor m).comp hdiv ++ exact Differentiable.analyticAt (f := F) hdiff a ++ let g : ℂ → ℂ := fun z => (-a⁻¹) * Complex.exp (partialLogSum m (z / a)) ++ have hg : AnalyticAt ℂ g a := by ++ have hdiv : Differentiable ℂ (fun z : ℂ => z / a) := by ++ simp [div_eq_mul_inv] ++ have hpls : Differentiable ℂ (fun z : ℂ => partialLogSum m (z / a)) := ++ (differentiable_partialLogSum m).comp hdiv ++ have hexp : Differentiable ℂ (fun z : ℂ => Complex.exp (partialLogSum m (z / a))) := ++ (Complex.differentiable_exp).comp hpls ++ have hdiffg : Differentiable ℂ g := by ++ simpa [g] using hexp.const_mul (-a⁻¹ : ℂ) ++ exact Differentiable.analyticAt (f := g) hdiffg a ++ have hg0 : g a ≠ 0 := by ++ have hconst : (-a⁻¹ : ℂ) ≠ 0 := by simp [ha] ++ have hexp0 : Complex.exp (partialLogSum m (a / a)) ≠ 0 := ++ Complex.exp_ne_zero (partialLogSum m (a / a)) ++ simpa [g] using mul_ne_zero hconst hexp0 ++ refine (hF.analyticOrderAt_eq_natCast (n := 1)).2 ?_ ++ refine ⟨g, hg, hg0, ?_⟩ ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ have hlin : (1 - z / a) = (z - a) * (-a⁻¹) := by ++ have h1 : (1 : ℂ) = a * a⁻¹ := by simp [ha] ++ simp [div_eq_mul_inv, h1] ++ ring ++ simp only [F, g, pow_one, smul_eq_mul] ++ rw [weierstrassFactor_def] ++ simp [hlin, mul_assoc] ++ ++lemma weierstrassFactor_eq_exp_neg_tail (m : ℕ) {z : ℂ} (hz : ‖z‖ < 1) (hz1 : z ≠ 1) : ++ weierstrassFactor m z = exp (-logTail m z) := by ++ unfold weierstrassFactor ++ have hz_ne_1 : 1 - z ≠ 0 := sub_ne_zero.mpr hz1.symm ++ rw [← exp_log hz_ne_1, ← Complex.exp_add] ++ have hsum : log (1 - z) + partialLogSum m z = -logTail m z := by ++ have hdecomp := neg_log_one_sub_eq_partialLogSum_add_logTail hz m ++ calc ++ log (1 - z) + partialLogSum m z ++ = log (1 - z) + (partialLogSum m z + logTail m z) - logTail m z := by ring ++ _ = log (1 - z) + (-log (1 - z)) - logTail m z := by rw [hdecomp] ++ _ = -logTail m z := by ring ++ simp [hsum] ++ ++theorem weierstrassFactor_sub_one_pow_bound {m : ℕ} {z : ℂ} (hz : ‖z‖ ≤ 1 / 2) : ++ ‖weierstrassFactor m z - 1‖ ≤ 4 * ‖z‖ ^ (m + 1) := by ++ by_cases hm : m = 0 ++ · subst hm ++ have hmain : ‖(1 - z) - 1‖ ≤ 4 * ‖z‖ ^ 1 := by ++ have h : (1 - z) - 1 = -z := by ring ++ calc ++ ‖(1 - z) - 1‖ = ‖-z‖ := by simp [h] ++ _ = ‖z‖ := norm_neg z ++ _ = ‖z‖ ^ 1 := by simp ++ _ ≤ 4 * ‖z‖ ^ 1 := by nlinarith [pow_nonneg (norm_nonneg z) 1] ++ simpa [weierstrassFactor] using hmain ++ · have hz_lt : ‖z‖ < 1 := lt_of_le_of_lt hz (by norm_num) ++ by_cases hz1 : z = 1 ++ · exfalso; rw [hz1] at hz; norm_num at hz ++ have h_eq : weierstrassFactor m z = exp (-logTail m z) := ++ weierstrassFactor_eq_exp_neg_tail m hz_lt hz1 ++ rw [h_eq] ++ have h_tail_bound := norm_logTail_le_two_mul_norm_pow hz_lt hz m ++ have hw_le_one : ‖-logTail m z‖ ≤ 1 := by ++ simp only [norm_neg] ++ have : ‖logTail m z‖ ≤ 1 := by ++ have hm_pos : 0 < m := Nat.pos_of_ne_zero hm ++ have h2 : 2 ≤ m + 1 := by ++ exact Nat.succ_le_succ (Nat.succ_le_iff.2 hm_pos) ++ have hpow : (‖z‖ ^ (m + 1)) ≤ (‖z‖ ^ 2) := by ++ have hz1' : ‖z‖ ≤ 1 := by nlinarith [hz] ++ have hz0' : 0 ≤ ‖z‖ := norm_nonneg z ++ exact pow_le_pow_of_le_one hz0' hz1' h2 ++ have hmul : 2 * ‖z‖ ^ (m + 1) ≤ 2 * ‖z‖ ^ 2 := by gcongr ++ have hsq : 2 * ‖z‖ ^ 2 ≤ 1 := by ++ have hz0 : 0 ≤ ‖z‖ := norm_nonneg z ++ have hz_sq : ‖z‖ ^ 2 ≤ (1 / 2 : ℝ) ^ 2 := pow_le_pow_left₀ hz0 hz 2 ++ nlinarith ++ exact (h_tail_bound.trans hmul).trans hsq ++ linarith ++ have h_exp_sub_one : ‖exp (-logTail m z) - 1‖ ≤ 2 * ‖-logTail m z‖ := ++ Complex.norm_exp_sub_one_le hw_le_one ++ simp only [norm_neg] at h_exp_sub_one ++ calc ++ ‖exp (-logTail m z) - 1‖ ≤ 2 * ‖logTail m z‖ := h_exp_sub_one ++ _ ≤ 2 * (2 * ‖z‖ ^ (m + 1)) := by gcongr ++ _ = 4 * ‖z‖ ^ (m + 1) := by ring ++ ++lemma log_norm_weierstrassFactor_ge_log_norm_one_sub_sub (m : ℕ) (z : ℂ) : ++ Real.log ‖1 - z‖ - ‖partialLogSum m z‖ ≤ Real.log ‖weierstrassFactor m z‖ := by ++ by_cases hz1 : z = (1 : ℂ) ++ · subst hz1 ++ simp [weierstrassFactor] ++ set S : ℂ := partialLogSum m z ++ have hS : weierstrassFactor m z = (1 - z) * Complex.exp S := by ++ simp [weierstrassFactor, S] ++ have hnorm_pos : 0 < ‖(1 : ℂ) - z‖ := ++ norm_pos_iff.mpr (sub_ne_zero.mpr (Ne.symm hz1)) ++ have hlog : ++ Real.log ‖weierstrassFactor m z‖ = Real.log ‖1 - z‖ + S.re := by ++ have hne : ‖(1 : ℂ) - z‖ ≠ 0 := ne_of_gt hnorm_pos ++ calc ++ Real.log ‖weierstrassFactor m z‖ ++ = Real.log (‖(1 : ℂ) - z‖ * ‖Complex.exp S‖) := by ++ simp [hS] ++ _ = Real.log ‖(1 : ℂ) - z‖ + Real.log ‖Complex.exp S‖ := by ++ simpa using (Real.log_mul hne (ne_of_gt (by simp))) ++ _ = Real.log ‖(1 : ℂ) - z‖ + S.re := by ++ simp [Complex.norm_exp, Real.log_exp] ++ _ = Real.log ‖1 - z‖ + S.re := by simp [sub_eq_add_neg, add_comm] ++ have hre : S.re ≥ -‖S‖ := Complex.neg_norm_le_re S ++ have : Real.log ‖weierstrassFactor m z‖ ≥ Real.log ‖1 - z‖ - ‖S‖ := by ++ linarith [hlog, hre] ++ simpa [S] using this ++ ++lemma log_norm_weierstrassFactor_ge_neg_two_pow {m : ℕ} {z : ℂ} (hz : ‖z‖ ≤ (1 / 2 : ℝ)) : ++ (-2 : ℝ) * ‖z‖ ^ (m + 1) ≤ Real.log ‖weierstrassFactor m z‖ := by ++ have hz_lt : ‖z‖ < (1 : ℝ) := lt_of_le_of_lt hz (by norm_num) ++ have hz1 : z ≠ (1 : ℂ) := by ++ intro h ++ have : (1 : ℝ) ≤ (1 / 2 : ℝ) := by ++ simpa [h] using hz ++ norm_num at this ++ have hEq : weierstrassFactor m z = Complex.exp (-logTail m z) := ++ weierstrassFactor_eq_exp_neg_tail m hz_lt hz1 ++ have hlog : ++ Real.log ‖weierstrassFactor m z‖ = (-logTail m z).re := by ++ simp [hEq, Complex.norm_exp, Real.log_exp] ++ have hre : (-logTail m z).re ≥ -‖logTail m z‖ := by ++ simpa [norm_neg] using Complex.neg_norm_le_re (-logTail m z) ++ have htail := norm_logTail_le_two_mul_norm_pow hz_lt hz m ++ have : (-logTail m z).re ≥ (-2 : ℝ) * ‖z‖ ^ (m + 1) := by ++ calc ++ (-logTail m z).re ≥ -‖logTail m z‖ := hre ++ _ ≥ (-2 : ℝ) * ‖z‖ ^ (m + 1) := by ++ nlinarith [htail] ++ simpa [hlog, mul_assoc, mul_left_comm, mul_comm] using this ++ ++end Complex ++end ++end HadamardSourceScope02 ++ ++section HadamardSourceScope03 ++ ++noncomputable section ++ ++open Filter Topology ++ ++namespace Complex ++ ++open _root_.Complex ++ ++theorem logDeriv_weierstrassFactor_one_div {a z : ℂ} (ha : a ≠ 0) (hz : z ≠ a) : ++ logDeriv (fun w : ℂ => weierstrassFactor 1 (w / a)) z = ++ 1 / (z - a) + 1 / a := by ++ have hE : ++ (fun w : ℂ => weierstrassFactor 1 (w / a)) = ++ fun w : ℂ => (1 - w / a) * exp (w / a) := by ++ ext w ++ simp [weierstrassFactor_def, partialLogSum_eq_sum] ++ have hf : (1 - z / a) ≠ 0 := by ++ intro hzero ++ have hdiv : z / a = 1 := by ++ exact (sub_eq_zero.mp hzero).symm ++ exact hz ((div_eq_one_iff_eq ha).1 hdiv) ++ rw [hE, logDeriv_fun_mul z hf (exp_ne_zero (z / a)) (by fun_prop) (by fun_prop)] ++ have hleft : logDeriv (fun w : ℂ => 1 - w / a) z = 1 / (z - a) := by ++ rw [logDeriv_apply] ++ have hderiv : deriv (fun w : ℂ => 1 - w / a) z = -(1 / a) := by ++ simp [one_div] ++ rw [hderiv] ++ have haz : -z + a ≠ 0 := by ++ simpa [sub_eq_add_neg, add_comm] using sub_ne_zero.mpr (Ne.symm hz) ++ field_simp [ha, sub_ne_zero.mpr hz, haz] ++ have haz' : a - z ≠ 0 := sub_ne_zero.mpr (Ne.symm hz) ++ have hza : z - a = -(a - z) := by ring ++ rw [hza] ++ field_simp [haz'] ++ have hright : logDeriv (fun w : ℂ => exp (w / a)) z = 1 / a := by ++ rw [logDeriv_apply] ++ have hderiv : deriv (fun w : ℂ => exp (w / a)) z = ++ exp (z / a) * (1 / a) := by ++ simp [one_div] ++ rw [hderiv] ++ field_simp [exp_ne_zero (z / a)] ++ rw [hleft, hright] ++ ++end Complex ++end ++end HadamardSourceScope03 ++ ++section HadamardSourceScope04 ++ ++open Filter Topology Set ++ ++namespace MeromorphicOn ++ ++open _root_.MeromorphicOn ++ ++variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {U K : Set 𝕜} {z : 𝕜} ++ {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] ++ ++lemma divisor_support_inter_compact_finite (f : 𝕜 → E) {U K : Set 𝕜} ++ (hK : IsCompact K) (hKU : K ⊆ U) : ++ (K ∩ (MeromorphicOn.divisor f U).support).Finite := by ++ classical ++ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U ++ have hloc : ++ ∀ x ∈ K, ∃ V : Set 𝕜, V ∈ 𝓝 x ∧ Set.Finite (V ∩ D.support) := by ++ intro x hxK ++ rcases D.supportLocallyFiniteWithinDomain x (hKU hxK) with ⟨V, hV, hfin⟩ ++ exact ⟨V, hV, hfin⟩ ++ choose V hVnhds hVfin using hloc ++ rcases hK.elim_nhds_subcover' (U := fun x hx => V x hx) (hU := fun x hx => hVnhds x hx) with ++ ⟨t, ht⟩ ++ have hsub : ++ K ∩ D.support ⊆ ⋃ x ∈ t, (V (x : 𝕜) x.2 ∩ D.support) := by ++ intro y hy ++ rcases hy with ⟨hyK, hyS⟩ ++ have hycov : y ∈ ⋃ x ∈ t, V (x : 𝕜) x.2 := ht hyK ++ rcases Set.mem_iUnion.1 hycov with ⟨x, hycov'⟩ ++ rcases Set.mem_iUnion.1 hycov' with ⟨hxT, hyV⟩ ++ refine Set.mem_iUnion.2 ⟨x, Set.mem_iUnion.2 ?_⟩ ++ exact ⟨hxT, ⟨hyV, hyS⟩⟩ ++ have hfinU : Set.Finite (⋃ x ∈ t, (V (x : 𝕜) x.2 ∩ D.support)) := by ++ classical ++ refine (t.finite_toSet).biUnion ?_ ++ intro x hx ++ simpa using (hVfin (x : 𝕜) x.2) ++ exact hfinU.subset hsub ++ ++end MeromorphicOn ++end HadamardSourceScope04 ++ ++section HadamardSourceScope05 ++ ++open Set ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++def divisorZeroIndex (f : ℂ → ℂ) (U : Set ℂ) : Type := ++ Σ z : ℂ, Fin (Int.toNat (MeromorphicOn.divisor f U z)) ++ ++abbrev divisorZeroIndex₀ (f : ℂ → ℂ) (U : Set ℂ) : Type := ++ {p : divisorZeroIndex f U // p.1 ≠ 0} ++ ++abbrev divisorZeroIndex₀Val {f : ℂ → ℂ} {U : Set ℂ} (p : divisorZeroIndex₀ f U) : ℂ := ++ p.1.1 ++ ++@[simp] ++lemma divisorZeroIndex₀Val_ne_zero {f : ℂ → ℂ} {U : Set ℂ} (p : divisorZeroIndex₀ f U) : ++ divisorZeroIndex₀Val p ≠ 0 := p.2 ++ ++@[simp] ++lemma divisorZeroIndex₀Val_mem_divisor_support {f : ℂ → ℂ} {U : Set ℂ} ++ (p : divisorZeroIndex₀ f U) : ++ MeromorphicOn.divisor f U (divisorZeroIndex₀Val p) ≠ 0 := by ++ have hn : ++ Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p)) ≠ 0 := by ++ intro h0 ++ have q0 : Fin 0 := by ++ simpa [divisorZeroIndex₀Val, h0] using p.1.2 ++ exact Fin.elim0 q0 ++ intro hdiv ++ have : Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p)) = 0 := by ++ simp [hdiv] ++ exact hn this ++ ++noncomputable def divisorCanonicalProduct (m : ℕ) (f : ℂ → ℂ) (U : Set ℂ) (z : ℂ) : ℂ := ++ ∏' p : divisorZeroIndex₀ f U, weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ ++@[simp] ++lemma divisorCanonicalProduct_zero (m : ℕ) (f : ℂ → ℂ) (U : Set ℂ) : ++ divisorCanonicalProduct m f U 0 = 1 := by ++ simp [divisorCanonicalProduct] ++ ++end Complex.Hadamard ++end HadamardSourceScope05 ++ ++section HadamardSourceScope06 ++ ++namespace Complex ++ ++open _root_.Complex ++ ++section UniformMul ++ ++theorem _root_.Erdos970.TendstoUniformlyOn.mul_left_bounded {ι : Type*} {p : Filter ι} {K : Set ℂ} ++ {F : ι → ℂ → ℂ} {f : ℂ → ℂ} {h : ℂ → ℂ} ++ (hF : TendstoUniformlyOn F f p K) (hh : ∃ C, ∀ z ∈ K, ‖h z‖ ≤ C) : ++ TendstoUniformlyOn (fun n z => h z * F n z) (fun z => h z * f z) p K := by ++ intro u hu ++ rcases Metric.mem_uniformity_dist.1 hu with ⟨ε, hεpos, hεu⟩ ++ rcases hh with ⟨C, hC⟩ ++ set C' : ℝ := max C 1 ++ have hC'pos : 0 < C' := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ have hC' : ∀ z ∈ K, ‖h z‖ ≤ C' := fun z hz => le_trans (hC z hz) (le_max_left _ _) ++ have hv : {p : ℂ × ℂ | dist p.1 p.2 < ε / C'} ∈ uniformity ℂ := ++ Metric.mem_uniformity_dist.2 ⟨ε / C', div_pos hεpos hC'pos, fun _ _ hab => hab⟩ ++ have hF' : ∀ᶠ n in p, ∀ z : ℂ, z ∈ K → dist (f z) (F n z) < ε / C' := hF _ hv ++ filter_upwards [hF'] with n hn z hzK ++ have hn' : ‖f z - F n z‖ < ε / C' := by simpa [dist_eq_norm] using hn z hzK ++ have hle : ‖h z‖ * ‖f z - F n z‖ ≤ C' * ‖f z - F n z‖ := ++ mul_le_mul_of_nonneg_right (hC' z hzK) (norm_nonneg _) ++ have hlt : C' * ‖f z - F n z‖ < C' * (ε / C') := mul_lt_mul_of_pos_left hn' hC'pos ++ have hnorm : ++ ‖h z * f z - h z * F n z‖ = ‖h z‖ * ‖f z - F n z‖ := by ++ calc ++ ‖h z * f z - h z * F n z‖ = ‖h z * (f z - F n z)‖ := by simp [mul_sub] ++ _ = ‖h z‖ * ‖f z - F n z‖ := by simp ++ have hdist : dist (h z * f z) (h z * F n z) < ε := by ++ rw [dist_eq_norm, hnorm] ++ have hlt' : ‖h z‖ * ‖f z - F n z‖ < ε := by ++ calc ++ ‖h z‖ * ‖f z - F n z‖ ≤ C' * ‖f z - F n z‖ := hle ++ _ < C' * (ε / C') := hlt ++ _ = ε := by field_simp [hC'pos.ne'] ++ exact hlt' ++ exact hεu hdist ++ ++end UniformMul ++ ++end Complex ++end HadamardSourceScope06 ++ ++section HadamardSourceScope07 ++ ++open Filter _root_.Function _root_.Complex _root_.Erdos970.Complex Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++lemma finite_divisorZeroIndex₀_subtype_norm_le {f : ℂ → ℂ} {U : Set ℂ} (B : ℝ) ++ (hBU : Metric.closedBall (0 : ℂ) B ⊆ U) : ++ Finite {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ B} := by ++ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U ++ have hK : IsCompact (Metric.closedBall (0 : ℂ) B) := isCompact_closedBall _ _ ++ have hpts0 : ((Metric.closedBall (0 : ℂ) B) ∩ D.support).Finite := ++ MeromorphicOn.divisor_support_inter_compact_finite (f := f) (U := U) ++ (K := Metric.closedBall (0 : ℂ) B) hK hBU ++ set pts : Set ℂ := ((Metric.closedBall (0 : ℂ) B) ∩ D.support) \ {0} ++ have hpts : pts.Finite := hpts0.sdiff ++ let : Fintype pts := hpts.fintype ++ let T : Type := Σ z : pts, Fin (Int.toNat (D z.1)) ++ have : Finite T := by infer_instance ++ let F : ++ {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ B} → T := fun p => ++ ⟨⟨divisorZeroIndex₀Val p.1, by ++ have hball : divisorZeroIndex₀Val p.1 ∈ Metric.closedBall (0 : ℂ) B := by ++ simpa [Metric.mem_closedBall, dist_zero_right] using p.2 ++ have hsupport : divisorZeroIndex₀Val p.1 ∈ D.support := by ++ have hne_toNat : ++ Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p.1)) ≠ 0 := by ++ intro h0 ++ have hpfin : ++ Fin (Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p.1))) := by ++ simpa [D] using p.1.1.2 ++ have : Fin 0 := by simpa [h0] using hpfin ++ exact Fin.elim0 this ++ have hne_D : D (divisorZeroIndex₀Val p.1) ≠ 0 := by ++ intro hD0 ++ apply hne_toNat ++ simp [D, hD0] ++ simp [D, Function.locallyFinsuppWithin.support, Function.support] ++ have hne0 : divisorZeroIndex₀Val p.1 ≠ 0 := divisorZeroIndex₀Val_ne_zero p.1 ++ exact ⟨⟨hball, hsupport⟩, by simp [Set.mem_singleton_iff]⟩⟩, ++ p.1.1.2⟩ ++ refine Finite.of_injective F ?_ ++ intro p q hpq ++ apply Subtype.ext ++ apply Subtype.ext ++ have h' := (Sigma.mk.inj_iff.1 hpq) ++ have hz : divisorZeroIndex₀Val p.1 = divisorZeroIndex₀Val q.1 := congrArg Subtype.val h'.1 ++ apply (Sigma.mk.inj_iff).2 ++ refine ⟨hz, ?_⟩ ++ exact h'.2 ++ ++lemma divisorZeroIndex₀_norm_le_finite {f : ℂ → ℂ} {U : Set ℂ} (B : ℝ) ++ (hBU : Metric.closedBall (0 : ℂ) B ⊆ U) : ++ ({p : divisorZeroIndex₀ f U | ‖divisorZeroIndex₀Val p‖ ≤ B} : Set _).Finite := by ++ let s : Set (divisorZeroIndex₀ f U) := {p | ‖divisorZeroIndex₀Val p‖ ≤ B} ++ have : Finite (↥s) := ++ finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := U) B hBU ++ exact Set.toFinite s ++ ++lemma norm_div_le_half_of_norm_le_of_two_mul_lt {z a : ℂ} {R : ℝ} ++ (hR : 0 < R) (hz : ‖z‖ ≤ R) (ha : (2 * R : ℝ) < ‖a‖) : ++ ‖z / a‖ ≤ (1 / 2 : ℝ) := by ++ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hR] ++ have hinv : ‖a‖⁻¹ < (2 * R)⁻¹ := by ++ simpa [one_div] using one_div_lt_one_div_of_lt h2R_pos ha ++ have hmul_le : ‖z‖ * ‖a‖⁻¹ ≤ R * ‖a‖⁻¹ := ++ mul_le_mul_of_nonneg_right hz (inv_nonneg.2 (norm_nonneg a)) ++ have hmul_lt : R * ‖a‖⁻¹ < R * (2 * R)⁻¹ := ++ mul_lt_mul_of_pos_left hinv hR ++ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by ++ have hRne : (R : ℝ) ≠ 0 := hR.ne' ++ rw [show R * (2 * R)⁻¹ = R / (2 * R) by simp [div_eq_mul_inv]] ++ field_simp [hRne] ++ have hnorm : ‖z / a‖ = ‖z‖ * ‖a‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ exact le_of_lt <| by ++ calc ++ ‖z / a‖ = ‖z‖ * ‖a‖⁻¹ := hnorm ++ _ ≤ R * ‖a‖⁻¹ := hmul_le ++ _ < R * (2 * R)⁻¹ := hmul_lt ++ _ = (1 / 2 : ℝ) := hRhalf ++ ++theorem summable_logDerivTerms_divisorZeroIndex₀_of_summable_inv_sq ++ {f : ℂ → ℂ} {z : ℂ} ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) ++ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ 1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by ++ let R : ℝ := max ‖z‖ 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ have hzle : ‖z‖ ≤ R := le_max_left _ _ ++ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (2 * R) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ)) ++ have hu : Summable u := h_sum.mul_left (2 * R) ++ refine hu.of_norm_bounded_eventually ?_ ++ have h_big : ++ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, ++ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ++ 2 * R} : Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ exact divisorZeroIndex₀_norm_le_finite ++ (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this ++ have := hfin.eventually_cofinite_notMem ++ filter_upwards [this] with p hp ++ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp ++ exact lt_of_not_ge this ++ filter_upwards [h_big] with p hp ++ let a : ℂ := divisorZeroIndex₀Val p ++ have ha0 : a ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ have hza0 : z - a ≠ 0 := sub_ne_zero.mpr (hz p) ++ have hterm : 1 / (z - a) + 1 / a = z / (a * (z - a)) := by ++ field_simp [ha0, hza0] ++ ring ++ have htri : ‖a‖ ≤ ‖z‖ + ‖z - a‖ := by ++ have hraw : ‖a‖ ≤ ‖z‖ + ‖a - z‖ := by ++ have h := norm_add_le z (a - z) ++ simpa [a, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h ++ simpa [norm_sub_rev] using hraw ++ have hza_lower : ‖a‖ / 2 ≤ ‖z - a‖ := by ++ nlinarith [htri, hzle, hp] ++ have hnorm : ‖1 / (z - a) + 1 / a‖ ≤ (2 * R) * (‖a‖⁻¹ ^ (2 : ℕ)) := by ++ rw [hterm, norm_div, norm_mul] ++ have ha_norm_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha0 ++ have hza_norm_pos : 0 < ‖z - a‖ := norm_pos_iff.mpr hza0 ++ rw [div_eq_mul_inv] ++ calc ++ ‖z‖ * (‖a‖ * ‖z - a‖)⁻¹ ++ = ‖z‖ * ‖a‖⁻¹ * ‖z - a‖⁻¹ := by ++ field_simp [ha_norm_pos.ne', hza_norm_pos.ne'] ++ _ ≤ R * ‖a‖⁻¹ * ‖z - a‖⁻¹ := by ++ gcongr ++ _ ≤ R * ‖a‖⁻¹ * (2 * ‖a‖⁻¹) := by ++ gcongr ++ have hhalf_pos : 0 < ‖a‖ / 2 := by positivity ++ have hinv : ‖z - a‖⁻¹ ≤ (‖a‖ / 2)⁻¹ := by ++ simpa [one_div] using one_div_le_one_div_of_le hhalf_pos hza_lower ++ have hhalf_inv : (‖a‖ / 2)⁻¹ = 2 * ‖a‖⁻¹ := by field_simp [ha_norm_pos.ne'] ++ simpa [hhalf_inv] using hinv ++ _ = (2 * R) * (‖a‖⁻¹ ^ (2 : ℕ)) := by ring ++ simpa [u, a] using hnorm ++ ++theorem hasProdUniformlyOn_divisorCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) {K : Set ℂ} (hK : IsCompact K) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ HasProdUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) K := by ++ rcases (isBounded_iff_forall_norm_le.1 hK.isBounded) with ⟨R0, hR0⟩ ++ set R : ℝ := max R0 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ have hnormK : ∀ z ∈ K, ‖z‖ ≤ R := fun z hzK => le_trans (hR0 z hzK) (le_max_left _ _) ++ let g : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1 ++ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) ++ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) ++ have h_big : ++ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, ++ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 2 * R} : ++ Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this ++ have := hfin.eventually_cofinite_notMem ++ filter_upwards [this] with p hp ++ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp ++ exact lt_of_not_ge this ++ have hBound : ++ ∀ᶠ p in Filter.cofinite, ∀ z ∈ K, ‖g p z‖ ≤ u p := by ++ filter_upwards [h_big] with p hp z hzK ++ have hzle : ‖z‖ ≤ R := hnormK z hzK ++ have hz_div : ‖z / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by ++ exact norm_div_le_half_of_norm_le_of_two_mul_lt hRpos hzle hp ++ have hE : ++ ‖weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1‖ ≤ ++ 4 * ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) := ++ weierstrassFactor_sub_one_pow_bound (m := m) (z := z / divisorZeroIndex₀Val p) hz_div ++ have hz_pow : ++ ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ ++ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ have : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ rw [this] ++ have : (‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = ++ ‖z‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ simp [mul_pow] ++ rw [this] ++ have hzle_pow : ‖z‖ ^ (m + 1) ≤ R ^ (m + 1) := ++ pow_le_pow_left₀ (norm_nonneg z) hzle (m + 1) ++ gcongr ++ dsimp [g, u] ++ nlinarith [hE, hz_pow] ++ have hcts : ∀ p, ContinuousOn (g p) K := by ++ intro p ++ have hcontE : Continuous (fun z : ℂ => weierstrassFactor m z) := ++ (differentiable_weierstrassFactor m).continuous ++ have hdiv : Continuous fun z : ℂ => z / divisorZeroIndex₀Val p := by ++ simpa [div_eq_mul_inv] using! (continuous_id.mul continuous_const) ++ have hcont : Continuous fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) := ++ hcontE.comp hdiv ++ simpa only [g] using hcont.continuousOn.fun_sub continuous_const.continuousOn ++ have hprod : ++ HasProdUniformlyOn (fun p z ↦ 1 + g p z) (fun z ↦ ∏' p, (1 + g p z)) K := by ++ simpa using ++ Summable.hasProdUniformlyOn_one_add (f := g) (u := u) (K := K) hK hu hBound hcts ++ simpa [g, divisorCanonicalProduct, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] ++ using! hprod ++ ++theorem hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ (Set.univ : Set ℂ) := by ++ refine hasProdLocallyUniformlyOn_of_forall_compact ++ (f := fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (g := divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ (s := (Set.univ : Set ℂ)) isOpen_univ ?_ ++ intro K hKU hK ++ simpa using ++ (hasProdUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) (K := K) hK h_sum) ++ ++theorem differentiableOn_divisorCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ DifferentiableOn ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) (Set.univ : Set ℂ) := by ++ have hloc : ++ TendstoLocallyUniformlyOn ++ (fun (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) => ++ ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ Filter.atTop (Set.univ : Set ℂ) := by ++ simpa [HasProdLocallyUniformlyOn] using ++ (hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum) ++ have hF : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in Filter.atTop, ++ DifferentiableOn ℂ ++ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (Set.univ : Set ℂ) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro s ++ have hdiff : ++ Differentiable ℂ ++ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) := by ++ let F : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ have hF' : ∀ p ∈ s, Differentiable ℂ (F p) := by ++ intro p hp ++ have hdiv : Differentiable ℂ (fun z : ℂ => z / divisorZeroIndex₀Val p) := by ++ have : Differentiable ℂ (fun z : ℂ => z * ((divisorZeroIndex₀Val p)⁻¹)) := ++ (differentiable_id : Differentiable ℂ (fun z : ℂ => z)).mul_const ++ ((divisorZeroIndex₀Val p)⁻¹) ++ simp [div_eq_mul_inv] ++ exact (differentiable_weierstrassFactor m).comp hdiv ++ simpa [F] using (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := F) (u := s) hF') ++ simpa using hdiff.differentiableOn ++ have : (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))).NeBot := ++ Filter.atTop_neBot ++ exact hloc.differentiableOn hF isOpen_univ ++ ++theorem differentiableAt_divisorCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : ++ DifferentiableAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := ++ ((differentiableOn_divisorCanonicalProduct_univ m f h_sum) z (by simp)).differentiableAt ++ (by simp) ++ ++theorem logDeriv_divisorCanonicalProduct_one_eq_tsum ++ {f : ℂ → ℂ} {z : ℂ} ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) ++ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) ++ (hprod_ne : divisorCanonicalProduct 1 f (Set.univ : Set ℂ) z ≠ 0) : ++ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z = ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by ++ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p w => weierstrassFactor 1 (w / divisorZeroIndex₀Val p) ++ have hf : ∀ p, Φ p z ≠ 0 := by ++ intro p ++ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ refine weierstrassFactor_ne_zero_of_ne_one 1 ?_ ++ intro h ++ exact hz p ((div_eq_one_iff_eq hp0).1 h) ++ have hd : ∀ p, DifferentiableOn ℂ (Φ p) (Set.univ : Set ℂ) := by ++ intro p ++ have hdiv : Differentiable ℂ (fun w : ℂ => w / divisorZeroIndex₀Val p) := by ++ have : Differentiable ℂ (fun w : ℂ => w * ((divisorZeroIndex₀Val p)⁻¹)) := ++ (differentiable_id : Differentiable ℂ (fun w : ℂ => w)).mul_const ++ ((divisorZeroIndex₀Val p)⁻¹) ++ simp [div_eq_mul_inv] ++ exact ((differentiable_weierstrassFactor 1).comp hdiv).differentiableOn ++ have hm' : Summable fun p => logDeriv (Φ p) z := by ++ have hm : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ 1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := ++ summable_logDerivTerms_divisorZeroIndex₀_of_summable_inv_sq h_sum hz ++ refine hm.congr ?_ ++ intro p ++ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ simpa [Φ] using ++ (Complex.logDeriv_weierstrassFactor_one_div ++ (a := divisorZeroIndex₀Val p) (z := z) hp0 (hz p)).symm ++ have htend : MultipliableLocallyUniformlyOn Φ (Set.univ : Set ℂ) := by ++ have hprod := hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ ++ (m := 1) (f := f) h_sum ++ simpa [Φ, divisorCanonicalProduct] using hprod.multipliableLocallyUniformlyOn ++ have hnez : (∏' p, Φ p z) ≠ 0 := by ++ simpa [Φ, divisorCanonicalProduct] using hprod_ne ++ have hlog : logDeriv (∏' p, Φ p ·) z = ∑' p, logDeriv (Φ p) z := ++ logDeriv_tprod_eq_tsum (s := (Set.univ : Set ℂ)) isOpen_univ (by simp) ++ hf hd hm' htend hnez ++ calc ++ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z ++ = ∑' p, logDeriv (Φ p) z := by ++ simpa [Φ, divisorCanonicalProduct] using! hlog ++ _ = ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by ++ refine tsum_congr fun p => ?_ ++ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ simpa [Φ] using ++ Complex.logDeriv_weierstrassFactor_one_div ++ (a := divisorZeroIndex₀Val p) (z := z) hp0 (hz p) ++ ++end Complex.Hadamard ++end HadamardSourceScope07 ++ ++section HadamardSourceScope09 ++ ++noncomputable section ++ ++open Set ++open scoped Topology BigOperators ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++lemma divisor_univ_eq_analyticOrderNatAt_int {f : ℂ → ℂ} (hf : Differentiable ℂ f) (z : ℂ) : ++ MeromorphicOn.divisor f (Set.univ : Set ℂ) z = (analyticOrderNatAt f z : ℤ) := by ++ have hmero : MeromorphicOn f (Set.univ : Set ℂ) := by ++ intro w hw ++ exact (Differentiable.analyticAt (f := f) hf w).meromorphicAt ++ simp only ++ [MeromorphicOn.divisor_apply hmero (by simp : z ∈ (Set.univ : Set ℂ)), analyticOrderNatAt] ++ have han : AnalyticAt ℂ f z := Differentiable.analyticAt (f := f) hf z ++ cases h : analyticOrderAt f z with ++ | top => ++ simp [han.meromorphicOrderAt_eq, h] ++ | coe n => ++ simp [han.meromorphicOrderAt_eq, h] ++ ++theorem divisorZeroIndex₀_fiber_finite (f : ℂ → ℂ) (z₀ : ℂ) : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | divisorZeroIndex₀Val p = z₀} : ++ Set _).Finite := by ++ have hsub : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | divisorZeroIndex₀Val p = z₀} : Set _) ++ ⊆ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ‖z₀‖} : ++ Set _) := by ++ intro p hp ++ have : divisorZeroIndex₀Val p = z₀ := hp ++ simp [this] ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ‖z₀‖} : ++ Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) ‖z₀‖ ⊆ (Set.univ : Set ℂ) := by simp ++ simpa using (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) ++ (B := ‖z₀‖) this) ++ exact hfin.subset hsub ++ ++def divisorZeroIndex₀FiberFinset (f : ℂ → ℂ) (z₀ : ℂ) : ++ Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ (divisorZeroIndex₀_fiber_finite (f := f) z₀).toFinset ++ ++@[simp] ++lemma mem_divisorZeroIndex₀FiberFinset (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : ++ p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ↔ divisorZeroIndex₀Val p = z₀ := by ++ simp [divisorZeroIndex₀FiberFinset] ++ ++theorem eventually_atTop_subset_fiberFinset ++ (f : ℂ → ℂ) (z₀ : ℂ) : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), ++ divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s := by ++ refine (Filter.eventually_atTop.2 ?_) ++ refine ⟨divisorZeroIndex₀FiberFinset (f := f) z₀, ?_⟩ ++ intro s hs ++ exact hs ++ ++lemma divisorZeroIndex₀FiberFinset_card_eq_toNat_divisor (f : ℂ → ℂ) {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = ++ Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) := by ++ let S : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := {p | divisorZeroIndex₀Val p = z₀} ++ have hS : S.Finite := divisorZeroIndex₀_fiber_finite (f := f) z₀ ++ set n : ℕ := Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) ++ have hcard : Nat.card S = n := by ++ classical ++ have : Fintype S := hS.fintype ++ ++ let e : S ≃ Fin n := ++ { toFun := by ++ intro x ++ rcases x with ⟨p, hp⟩ ++ rcases p with ⟨⟨z, q⟩, hz⟩ ++ have hzEq : z = z₀ := by simpa [divisorZeroIndex₀Val] using! hp ++ subst hzEq ++ simpa [n] using q ++ invFun := by ++ intro q ++ refine ⟨⟨⟨z₀, ?_⟩, hz₀⟩, ?_⟩ ++ · simpa [n] using q ++ · simp [S, divisorZeroIndex₀Val] ++ left_inv := by ++ rintro ⟨p, hp⟩ ++ rcases p with ⟨⟨z, q⟩, hz⟩ ++ have hzEq : z = z₀ := by simpa [divisorZeroIndex₀Val] using! hp ++ subst hzEq ++ (ext; rfl) ++ right_inv := by ++ intro q ++ rfl } ++ have h := Nat.card_congr (α := S) (β := Fin n) e ++ simpa using (h.trans (by simp)) ++ have hSncard : S.ncard = n := by ++ simpa [Nat.card_coe_set_eq] using hcard ++ have hto : hS.toFinset = divisorZeroIndex₀FiberFinset (f := f) z₀ := by ++ rfl ++ have htoFinset : S.ncard = (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by ++ have h' : S.ncard = hS.toFinset.card := Set.ncard_eq_toFinset_card S hS ++ simpa [hto] using h' ++ exact htoFinset.symm.trans hSncard ++ ++lemma divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt ++ {f : ℂ → ℂ} (hf : Differentiable ℂ f) {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = analyticOrderNatAt f z₀ := by ++ have hdiv : ++ MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀ = (analyticOrderNatAt f z₀ : ℤ) := ++ divisor_univ_eq_analyticOrderNatAt_int (f := f) hf z₀ ++ have htoNat : Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) = ++ analyticOrderNatAt f z₀ := by ++ simp [hdiv] ++ exact (divisorZeroIndex₀FiberFinset_card_eq_toNat_divisor (f := f) (z₀ := z₀) hz₀).trans htoNat ++ ++lemma not_mem_divisorZeroIndex₀FiberFinset_iff_val_ne ++ {f : ℂ → ℂ} (z₀ : ℂ) (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : ++ p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀ ↔ divisorZeroIndex₀Val p ≠ z₀ := by ++ simp [mem_divisorZeroIndex₀FiberFinset] ++ ++end Complex.Hadamard ++end ++end HadamardSourceScope09 ++ ++section HadamardSourceScope10 ++ ++open Filter _root_.Function _root_.Complex _root_.Erdos970.Complex Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++noncomputable def divisorComplementFactor ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) : ℂ := by ++ classical ++ exact if p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ then (1 : ℂ) ++ else weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ ++@[simp] ++theorem divisorComplementFactor_eq_one_of_mem ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) ++ (hp : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀) : ++ divisorComplementFactor m f z₀ p z = 1 := by ++ classical ++ simp [divisorComplementFactor, hp] ++ ++@[simp] ++theorem divisorComplementFactor_eq_weierstrassFactor_of_not_mem ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) ++ (hp : p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀) : ++ divisorComplementFactor m f z₀ p z = ++ weierstrassFactor m (z / divisorZeroIndex₀Val p) := by ++ classical ++ simp [divisorComplementFactor, hp] ++ ++lemma divisorComplementFactor_def ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) : ++ divisorComplementFactor m f z₀ p z = ++ if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) ++ else weierstrassFactor m (z / divisorZeroIndex₀Val p) := by ++ classical ++ by_cases h : divisorZeroIndex₀Val p = z₀ ++ · have hp : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ := by ++ simpa [mem_divisorZeroIndex₀FiberFinset] using h ++ simp [divisorComplementFactor_eq_one_of_mem, hp, h] ++ · have hp : p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀ := by ++ intro hmem ++ exact h ((mem_divisorZeroIndex₀FiberFinset f z₀ p).1 hmem) ++ simp [divisorComplementFactor_eq_weierstrassFactor_of_not_mem, hp, h] ++ ++noncomputable def divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ℂ := ++ ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ ++theorem differentiable_weierstrassFactor_divisorZeroIndex₀ (m : ℕ) {f : ℂ → ℂ} ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : ++ Differentiable ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) := by ++ have hdiv : Differentiable ℂ (fun z : ℂ => z / divisorZeroIndex₀Val p) := by ++ simp [div_eq_mul_inv] ++ exact (differentiable_weierstrassFactor m).comp hdiv ++ ++theorem differentiable_divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : ++ Differentiable ℂ (divisorPartialProduct m f s) := by ++ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ have hΦ : ∀ p ∈ s, Differentiable ℂ (Φ p) := by ++ intro p _hp ++ exact differentiable_weierstrassFactor_divisorZeroIndex₀ m p ++ simpa [divisorPartialProduct, Φ] using! ++ (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := Φ) (u := s) hΦ) ++ ++theorem analyticAt_divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z₀ : ℂ) : ++ AnalyticAt ℂ (divisorPartialProduct m f s) z₀ := ++ (differentiable_divisorPartialProduct m f s).analyticAt z₀ ++ ++noncomputable def divisorComplementPartialProduct ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ℂ := ++ ∏ p ∈ s, divisorComplementFactor m f z₀ p z ++ ++@[simp] ++lemma divisorComplementPartialProduct_def ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ++ divisorComplementPartialProduct m f z₀ s z = ++ ∏ p ∈ s, if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) ++ else weierstrassFactor m (z / divisorZeroIndex₀Val p) := by ++ simp [divisorComplementPartialProduct, divisorComplementFactor, ++ mem_divisorZeroIndex₀FiberFinset] ++ ++theorem differentiable_divisorComplementPartialProduct ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : ++ Differentiable ℂ (divisorComplementPartialProduct m f z₀ s) := by ++ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p z => divisorComplementFactor m f z₀ p z ++ have hΦ : ∀ p ∈ s, Differentiable ℂ (Φ p) := by ++ intro p _hp ++ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ · have hΦp : Φ p = fun _ => (1 : ℂ) := by ++ ext z ++ simp only [Φ, divisorComplementFactor_eq_one_of_mem m f z₀ p z hpF] ++ rw [hΦp] ++ exact differentiable_const (1 : ℂ) ++ · have hΦp : Φ p = fun z => weierstrassFactor m (z / divisorZeroIndex₀Val p) := by ++ ext z ++ simp only [Φ, divisorComplementFactor_eq_weierstrassFactor_of_not_mem m f z₀ p z hpF] ++ rw [hΦp] ++ exact differentiable_weierstrassFactor_divisorZeroIndex₀ m p ++ have hEq : (fun z : ℂ => ∏ p ∈ s, Φ p z) = ++ divisorComplementPartialProduct m f z₀ s := by ++ ext z ++ simp [Φ, divisorComplementPartialProduct] ++ have : Differentiable ℂ (fun z : ℂ => ∏ p ∈ s, Φ p z) := by ++ simpa using (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := Φ) (u := s) hΦ) ++ simpa [hEq] using this ++ ++noncomputable def divisorComplementCanonicalProduct ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) (z : ℂ) : ℂ := ++ ∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), divisorComplementFactor m f z₀ p z ++ ++theorem hasProdUniformlyOn_divisorComplementCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) {K : Set ℂ} (hK : IsCompact K) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ HasProdUniformlyOn (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ divisorComplementFactor m f z₀ p z) (divisorComplementCanonicalProduct m f z₀) ++ K := by ++ rcases (isBounded_iff_forall_norm_le.1 hK.isBounded) with ⟨R0, hR0⟩ ++ set R : ℝ := max R0 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ have hnormK : ∀ z ∈ K, ‖z‖ ≤ R := fun z hzK => le_trans (hR0 z hzK) (le_max_left _ _) ++ let term : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := fun p z => ++ divisorComplementFactor m f z₀ p z ++ let g : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := fun p z => term p z - 1 ++ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) ++ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) ++ have h_big : ++ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, ++ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 2 * R} : ++ Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this ++ have := hfin.eventually_cofinite_notMem ++ filter_upwards [this] with p hp ++ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp ++ exact lt_of_not_ge this ++ have hBound : ++ ∀ᶠ p in Filter.cofinite, ∀ z ∈ K, ‖g p z‖ ≤ u p := by ++ filter_upwards [h_big] with p hp z hzK ++ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ · have hval : divisorZeroIndex₀Val p = z₀ := ++ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hpF ++ have hu0 : 0 ≤ u p := by ++ dsimp [u] ++ refine mul_nonneg ?_ ?_ ++ · nlinarith [pow_nonneg (show 0 ≤ R from le_of_lt hRpos) (m + 1)] ++ · exact pow_nonneg (inv_nonneg.2 (norm_nonneg _)) (m + 1) ++ simp [g, term, divisorComplementFactor, hval, hu0, sub_eq_add_neg] ++ · have hzle : ‖z‖ ≤ R := hnormK z hzK ++ have hz_div : ‖z / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by ++ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hRpos] ++ have hinv : ‖divisorZeroIndex₀Val p‖⁻¹ < (2 * R)⁻¹ := by ++ simpa [one_div] using (one_div_lt_one_div_of_lt h2R_pos hp) ++ have hmul_le : ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ ≤ R * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ refine mul_le_mul_of_nonneg_right hzle ?_ ++ exact inv_nonneg.2 (norm_nonneg _) ++ have hmul_lt : R * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := ++ mul_lt_mul_of_pos_left hinv hRpos ++ have hlt : ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := ++ lt_of_le_of_lt hmul_le hmul_lt ++ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by ++ have hRne : (R : ℝ) ≠ 0 := hRpos.ne' ++ have : R * (2 * R)⁻¹ = R / (2 * R) := by simp [div_eq_mul_inv] ++ rw [this] ++ field_simp [hRne] ++ have hnorm : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ have hzlt : ‖z / divisorZeroIndex₀Val p‖ < (1 / 2 : ℝ) := by ++ calc ++ ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := hnorm ++ _ < R * (2 * R)⁻¹ := hlt ++ _ = (1 / 2 : ℝ) := hRhalf ++ exact le_of_lt hzlt ++ have hE : ‖weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1‖ ≤ ++ 4 * ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) := ++ weierstrassFactor_sub_one_pow_bound (m := m) (z := z / divisorZeroIndex₀Val p) hz_div ++ have hz_pow : ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ ++ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ have : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ rw [this] ++ have : (‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = ++ ‖z‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ simp [mul_pow] ++ rw [this] ++ have hzle_pow : ‖z‖ ^ (m + 1) ≤ R ^ (m + 1) := ++ pow_le_pow_left₀ (norm_nonneg z) hzle (m + 1) ++ gcongr ++ dsimp [g, term, u] ++ simp [divisorComplementFactor, hpF] at * ++ nlinarith [hE, hz_pow] ++ have hcts : ∀ p, ContinuousOn (g p) K := by ++ intro p ++ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ · have hval : divisorZeroIndex₀Val p = z₀ := ++ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hpF ++ simpa [g, term, divisorComplementFactor, hval, sub_eq_add_neg, add_assoc, add_left_comm, ++ add_comm] using ++ (continuousOn_const : ContinuousOn (fun _ : ℂ => (0 : ℂ)) K) ++ · have hvalne : divisorZeroIndex₀Val p ≠ z₀ := ++ (not_mem_divisorZeroIndex₀FiberFinset_iff_val_ne (f := f) z₀ p).1 hpF ++ have hcontE : Continuous (fun z : ℂ => weierstrassFactor m z) := ++ (differentiable_weierstrassFactor m).continuous ++ have hdiv : Continuous fun z : ℂ => z / divisorZeroIndex₀Val p := by ++ simpa [div_eq_mul_inv] using! (continuous_id.mul continuous_const) ++ have hcont : Continuous fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) := ++ hcontE.comp hdiv ++ have : ContinuousOn (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1) K := ++ (hcont.continuousOn.sub continuous_const.continuousOn) ++ simpa [g, term, divisorComplementFactor, mem_divisorZeroIndex₀FiberFinset, hvalne] using this ++ have hprod : ++ HasProdUniformlyOn (fun p z ↦ 1 + g p z) (fun z ↦ ∏' p, (1 + g p z)) K := by ++ simpa using ++ Summable.hasProdUniformlyOn_one_add (f := g) (u := u) (K := K) hK hu hBound hcts ++ have hterm : ++ HasProdUniformlyOn (fun p z ↦ term p z) (fun z ↦ ∏' p, term p z) K := by ++ simpa [g, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using hprod ++ refine hterm.congr_right ?_ ++ intro z hz ++ simp [term, divisorComplementCanonicalProduct, divisorComplementFactor] ++ ++theorem hasProdLocallyUniformlyOn_divisorComplementCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ divisorComplementFactor m f z₀ p z) ++ (divisorComplementCanonicalProduct m f z₀) ++ (Set.univ : Set ℂ) := by ++ refine hasProdLocallyUniformlyOn_of_forall_compact ++ (f := fun p z => divisorComplementFactor m f z₀ p z) ++ (g := divisorComplementCanonicalProduct m f z₀) (s := (Set.univ : Set ℂ)) ++ isOpen_univ ?_ ++ intro K hKU hK ++ simpa using ++ (hasProdUniformlyOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) ++ (K := K) hK h_sum) ++ ++theorem tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ divisorComplementPartialProduct m f z₀ s) ++ (divisorComplementCanonicalProduct m f z₀) ++ Filter.atTop ++ (Set.univ : Set ℂ) := by ++ have hprod : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ divisorComplementFactor m f z₀ p z) ++ (divisorComplementCanonicalProduct m f z₀) ++ (Set.univ : Set ℂ) := ++ hasProdLocallyUniformlyOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) ++ (z₀ := z₀) h_sum ++ have h : ++ TendstoLocallyUniformlyOn ++ (fun (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) => ++ ∏ p ∈ s, ++ if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) ++ else weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorComplementCanonicalProduct m f z₀) ++ Filter.atTop ++ (Set.univ : Set ℂ) := by ++ simpa [HasProdLocallyUniformlyOn, divisorComplementFactor, mem_divisorZeroIndex₀FiberFinset] ++ using hprod ++ refine h.congr (G := fun s z => divisorComplementPartialProduct m f z₀ s z) ?_ ++ intro s z hz ++ simp [divisorComplementPartialProduct_def] ++ ++theorem differentiableOn_divisorComplementCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) (Set.univ : Set ℂ) := by ++ have hloc : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ divisorComplementPartialProduct m f z₀ s) ++ (divisorComplementCanonicalProduct m f z₀) ++ Filter.atTop ++ (Set.univ : Set ℂ) := ++ tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ (m := m) (f := f) ++ (z₀ := z₀) h_sum ++ have hF : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in Filter.atTop, ++ DifferentiableOn ℂ (divisorComplementPartialProduct m f z₀ s) (Set.univ : Set ℂ) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro s ++ exact (differentiable_divisorComplementPartialProduct m f z₀ s).differentiableOn ++ have : (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))).NeBot := ++ Filter.atTop_neBot ++ exact hloc.differentiableOn hF isOpen_univ ++ ++lemma divisorPartialProduct_eq_fiber_mul_complement_of_subset ++ (m : ℕ) (f : ℂ → ℂ) (z₀ z : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : ++ divisorPartialProduct m f s z = ++ divisorPartialProduct m f (divisorZeroIndex₀FiberFinset (f := f) z₀) z * ++ divisorComplementPartialProduct m f z₀ s z := by ++ classical ++ let fiber : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ let P : divisorZeroIndex₀ f (Set.univ : Set ℂ) → Prop := fun p => p ∈ fiber ++ let term : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := ++ fun p => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ have hfilter : s.filter P = fiber := by ++ ext p ++ constructor ++ · intro hp ++ exact (Finset.mem_filter.mp hp).2 ++ · intro hp ++ exact Finset.mem_filter.mpr ⟨hs hp, hp⟩ ++ have hsplit : ++ (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) = ∏ p ∈ s, term p := by ++ simpa [term] using ++ (Finset.prod_filter_mul_prod_filter_not (s := s) (p := P) (f := term)) ++ have hP : (∏ p ∈ s with P p, term p) = divisorPartialProduct m f fiber z := by ++ have hg : ∀ x ∈ s \ fiber, (if x ∈ fiber then term x else (1 : ℂ)) = 1 := by ++ intro x hx ++ have hxnot : x ∉ fiber := (Finset.mem_sdiff.mp hx).2 ++ simp [hxnot] ++ have hfg : ++ ∀ x ∈ fiber, term x = (if x ∈ fiber then term x else (1 : ℂ)) := by ++ intro x hx ++ simp [hx] ++ have hsub := (Finset.prod_subset_one_on_sdiff (s₁ := fiber) (s₂ := s) ++ (f := term) (g := fun x => if x ∈ fiber then term x else (1 : ℂ)) hs hg hfg) ++ simpa [divisorPartialProduct, term, P, fiber, Finset.prod_filter] using hsub.symm ++ have hnotP : (∏ p ∈ s with ¬ P p, term p) = divisorComplementPartialProduct m f z₀ s z := by ++ simp [divisorComplementPartialProduct, divisorComplementFactor, term, P, fiber, ++ Finset.prod_filter, mem_divisorZeroIndex₀FiberFinset] ++ have hsplit' : ∏ p ∈ s, term p = (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) := ++ hsplit.symm ++ calc ++ divisorPartialProduct m f s z ++ = ∏ p ∈ s, term p := by simp [divisorPartialProduct, term] ++ _ = (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) := hsplit' ++ _ = divisorPartialProduct m f fiber z * divisorComplementPartialProduct m f z₀ s z := by ++ simp [hP, hnotP, fiber] ++ ++end Complex.Hadamard ++end HadamardSourceScope10 ++ ++section HadamardSourceScope11 ++ ++noncomputable section ++ ++open _root_.Complex _root_.Erdos970.Complex Filter _root_.Function Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++theorem analyticOrderAt_finset_prod_weierstrassFactor_divisorZeroIndex₀ ++ (m : ℕ) (f : ℂ → ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z₀ : ℂ) : ++ analyticOrderAt (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ z₀ = ((s.filter (fun p => divisorZeroIndex₀Val p = z₀)).card : ℕ∞) := by ++ classical ++ refine Finset.induction_on s ?base ?step ++ · simp [analyticOrderAt_eq_zero] ++ · intro p s hp hs ++ by_cases hEq : divisorZeroIndex₀Val p = z₀ ++ · have hp0 : divisorZeroIndex₀Val p ≠ 0 := p.property ++ have han_fac : ++ AnalyticAt ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) z₀ := by ++ exact (differentiable_weierstrassFactor_divisorZeroIndex₀ m p).analyticAt z₀ ++ have han_rest : AnalyticAt ℂ (fun z : ℂ => ∏ q ∈ s, weierstrassFactor m ++ (z / divisorZeroIndex₀Val q)) z₀ := by ++ simpa [divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ ++ let fac : ℂ → ℂ := fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ let rest : ℂ → ℂ := fun z : ℂ => ∏ q ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val q) ++ have hmul : ++ analyticOrderAt (fac * rest) z₀ = ++ analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := by ++ simpa [fac, rest] using (analyticOrderAt_mul (z₀ := z₀) han_fac han_rest) ++ have hcard : ++ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) (insert p s)).card = ++ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) s).card + 1 := by ++ simp [hEq, hp, Finset.filter_insert] ++ have hfac : analyticOrderAt fac z₀ = (1 : ℕ∞) := by ++ simpa [fac, hEq] using ++ (analyticOrderAt_weierstrassFactor_div_self (m := m) (a := divisorZeroIndex₀Val p) hp0) ++ have hrest : analyticOrderAt rest z₀ = ((s.filter ++ (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simpa [rest] using hs ++ have hcongr : ++ (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m (z / divisorZeroIndex₀Val q)) ++ =ᶠ[𝓝 z₀] (fac * rest) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ simp [fac, rest, Finset.prod_insert, hp, Pi.mul_apply] ++ calc ++ analyticOrderAt (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m ++ (z / divisorZeroIndex₀Val q)) z₀ = analyticOrderAt (fac * rest) z₀ := by ++ simpa using (analyticOrderAt_congr hcongr) ++ _ = analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := hmul ++ _ = (1 : ℕ∞) + ((s.filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simp [hfac, hrest] ++ _ = (((insert p s).filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simp [hcard, Nat.add_comm] ++ · have han_fac : ++ AnalyticAt ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) z₀ := by ++ exact (differentiable_weierstrassFactor_divisorZeroIndex₀ m p).analyticAt z₀ ++ have hfac0 : analyticOrderAt (fun z : ℂ => weierstrassFactor m ++ (z / divisorZeroIndex₀Val p)) z₀ = 0 := by ++ have hp0 : divisorZeroIndex₀Val p ≠ 0 := p.property ++ have hval : weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ≠ 0 := by ++ have : (z₀ / divisorZeroIndex₀Val p) ≠ 1 := by ++ intro h1 ++ have : z₀ = divisorZeroIndex₀Val p := by ++ have : z₀ = (z₀ / divisorZeroIndex₀Val p) * (divisorZeroIndex₀Val p) := by ++ simp [div_eq_mul_inv] ++ simpa [h1, div_eq_mul_inv, hp0] using this ++ exact hEq (this.symm) ++ exact (weierstrassFactor_ne_zero_iff m (z₀ / divisorZeroIndex₀Val p)).2 this ++ simpa using (han_fac.analyticOrderAt_eq_zero).2 (by simpa using hval) ++ have hcard : ++ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) (insert p s)).card = ++ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) s).card := by ++ simp [hEq, Finset.filter_insert] ++ have han_rest : AnalyticAt ℂ (fun z : ℂ => ∏ q ∈ s, weierstrassFactor m ++ (z / divisorZeroIndex₀Val q)) z₀ := by ++ simpa [divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ ++ let fac : ℂ → ℂ := fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ let rest : ℂ → ℂ := fun z : ℂ => ∏ q ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val q) ++ have hmul : ++ analyticOrderAt (fac * rest) z₀ = ++ analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := by ++ simpa [fac, rest] using (analyticOrderAt_mul (z₀ := z₀) han_fac han_rest) ++ have hcongr : ++ (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m (z / divisorZeroIndex₀Val q)) ++ =ᶠ[𝓝 z₀] (fac * rest) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ simp [fac, rest, Finset.prod_insert, hp, Pi.mul_apply] ++ calc ++ analyticOrderAt (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m ++ (z / divisorZeroIndex₀Val q)) z₀ ++ = analyticOrderAt (fac * rest) z₀ := by ++ simpa using (analyticOrderAt_congr hcongr) ++ _ = analyticOrderAt rest z₀ := by ++ calc ++ analyticOrderAt (fac * rest) z₀ = analyticOrderAt fac z₀ + ++ analyticOrderAt rest z₀ := hmul ++ _ = analyticOrderAt rest z₀ := by ++ have hfac0' : analyticOrderAt fac z₀ = 0 := by ++ simpa [fac] using hfac0 ++ simp [hfac0'] ++ _ = ((s.filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simpa [rest] using hs ++ _ = (((insert p s).filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simpa using congrArg (fun n : ℕ => (n : ℕ∞)) hcard.symm ++ ++theorem analyticOrderAt_partialProduct_eq_fiberCard_of_subset ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : ++ analyticOrderAt ++ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ z₀ = ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by ++ have h := ++ analyticOrderAt_finset_prod_weierstrassFactor_divisorZeroIndex₀ ++ (m := m) (f := f) (s := s) (z₀ := z₀) ++ have hfilter : ++ s.filter (fun p => divisorZeroIndex₀Val p = z₀) = ++ divisorZeroIndex₀FiberFinset (f := f) z₀ := by ++ ext p ++ constructor ++ · intro hp' ++ have hpv : divisorZeroIndex₀Val p = z₀ := (Finset.mem_filter.mp hp').2 ++ simpa [mem_divisorZeroIndex₀FiberFinset] using hpv ++ · intro hp_fiber ++ have hpv : divisorZeroIndex₀Val p = z₀ := ++ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hp_fiber ++ have hps : p ∈ s := hs (by simpa [mem_divisorZeroIndex₀FiberFinset] using hpv) ++ exact Finset.mem_filter.2 ⟨hps, hpv⟩ ++ simpa [hfilter] using h ++ ++theorem exists_analyticAt_eq_pow_smul_of_partialProduct_contains_fiber ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : ++ ∃ g : ℂ → ℂ, ++ AnalyticAt ℂ g z₀ ∧ g z₀ ≠ 0 ∧ ++ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ =ᶠ[𝓝 z₀] ++ fun z : ℂ => (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card • g z := by ++ let F : ℂ → ℂ := fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ have hF_ana : AnalyticAt ℂ F z₀ := by ++ simpa [F, divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ ++ have hOrder : ++ analyticOrderAt F z₀ = ++ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by ++ simpa [F] using ++ (analyticOrderAt_partialProduct_eq_fiberCard_of_subset (m := m) ++ (f := f) (z₀ := z₀) (s := s) hs) ++ refine (hF_ana.analyticOrderAt_eq_natCast (n := (divisorZeroIndex₀FiberFinset ++ (f := f) z₀).card)).1 ?_ ++ simp [hOrder] ++ ++end Complex.Hadamard ++end ++end HadamardSourceScope11 ++ ++section HadamardSourceScope12 ++ ++open Filter _root_.Function _root_.Complex _root_.Erdos970.Complex Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++theorem tendstoLocallyUniformlyOn_divisorPartialProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ Filter.atTop ++ (Set.univ : Set ℂ) := by ++ have hprod : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ (Set.univ : Set ℂ) := ++ hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ simpa [HasProdLocallyUniformlyOn, divisorPartialProduct] using! hprod ++ ++theorem tendstoUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) (k : ℕ) {K : Set ℂ} (hK : IsCompact K) (hKz : ∀ z ∈ K, z ≠ z₀) : ++ TendstoUniformlyOn ++ (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ k) ++ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) ++ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) ++ K := by ++ have hloc : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ Filter.atTop ++ K := ++ (tendstoLocallyUniformlyOn_divisorPartialProduct_univ (m := m) (f := f) h_sum).mono ++ (by intro z hz; simp) ++ have hunif : ++ TendstoUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ Filter.atTop ++ K := ++ (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact hK).1 hloc ++ let h : ℂ → ℂ := fun z => ((z - z₀) ^ k)⁻¹ ++ have hh : ∃ C, ∀ z ∈ K, ‖h z‖ ≤ C := by ++ have hcont : ContinuousOn h K := by ++ have hpow : ContinuousOn (fun z : ℂ => (z - z₀) ^ k) K := by ++ fun_prop ++ refine hpow.inv₀ ?_ ++ intro z hz ++ have hz0 : z - z₀ ≠ 0 := sub_ne_zero.mpr (hKz z hz) ++ exact pow_ne_zero k hz0 ++ have hKimg : IsCompact (h '' K) := hK.image_of_continuousOn hcont ++ rcases (isBounded_iff_forall_norm_le.1 hKimg.isBounded) with ⟨C, hC⟩ ++ refine ⟨C, ?_⟩ ++ intro z hz ++ exact hC (h z) ⟨z, hz, rfl⟩ ++ have hunif' := ++ (TendstoUniformlyOn.mul_left_bounded (p := (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f ++ (Set.univ : Set ℂ))))) ++ (K := K) ++ (F := fun s z => divisorPartialProduct m f s z) ++ (f := fun z => divisorCanonicalProduct m f (Set.univ : Set ℂ) z) ++ (h := h) ++ hunif hh) ++ simpa [h, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hunif' ++ ++theorem tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) (k : ℕ) : ++ TendstoLocallyUniformlyOn ++ (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ k) ++ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) ++ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) ++ ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hopen : IsOpen ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hset : ((Set.univ : Set ℂ) \ {z₀}) = ({z₀} : Set ℂ)ᶜ := by ++ ext z ++ simp ++ simp [hset] ++ refine (tendstoLocallyUniformlyOn_iff_forall_isCompact hopen).2 ?_ ++ intro K hKsub hK ++ have hKz : ∀ z ∈ K, z ≠ z₀ := by ++ intro z hzK ++ have : z ∈ (Set.univ : Set ℂ) \ {z₀} := hKsub hzK ++ exact by simpa [Set.mem_sdiff, Set.mem_singleton_iff] using this.2 ++ exact tendstoUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m := m) (f := f) h_sum (z₀ := z₀) (k := k) (hK := hK) hKz ++ ++open Filter ++ ++theorem exists_ball_eq_divisorCanonicalProduct_div_pow_eq ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ++ ∃ ε > 0, ∃ u : ℂ → ℂ, AnalyticAt ℂ u z₀ ∧ ++ u z₀ ≠ 0 ∧ ++ ∀ z : ℂ, z ∈ Metric.ball z₀ ε → z ≠ z₀ → ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = ++ (divisorComplementCanonicalProduct m f z₀ z) * u z := by ++ let fiber : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ have hfib : ∃ u : ℂ → ℂ, AnalyticAt ℂ u z₀ ∧ u z₀ ≠ 0 ∧ ++ (fun z : ℂ => divisorPartialProduct m f fiber z) =ᶠ[𝓝 z₀] ++ fun z : ℂ => (z - z₀) ^ fiber.card • u z := by ++ simpa [fiber, divisorPartialProduct] using ++ (exists_analyticAt_eq_pow_smul_of_partialProduct_contains_fiber (m := m) (f := f) (z₀ := z₀) ++ (s := fiber) (by rfl : fiber ⊆ fiber)) ++ rcases hfib with ⟨u, huA, hu0, huEq⟩ ++ have hmem : {z : ℂ | divisorPartialProduct m f fiber z = ++ (z - z₀) ^ fiber.card • u z} ∈ 𝓝 z₀ := huEq ++ rcases Metric.mem_nhds_iff.1 hmem with ⟨ε, hε, hball⟩ ++ refine ⟨ε, hε, u, huA, hu0, ?_⟩ ++ have hq : ++ TendstoLocallyUniformlyOn (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) ++ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ fiber.card) ++ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) ++ ((Set.univ : Set ℂ) \ {z₀}) := ++ tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) (k := fiber.card) ++ have hcomp : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ divisorComplementPartialProduct m f z₀ s) ++ (divisorComplementCanonicalProduct m f z₀) ++ Filter.atTop ++ (Set.univ : Set ℂ) := ++ tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ (m := m) (f := f) ++ (z₀ := z₀) h_sum ++ intro z hz hzne ++ have hz' : z ∈ ((Set.univ : Set ℂ) \ {z₀}) := by ++ refine ⟨by simp, ?_⟩ ++ simpa [Set.mem_singleton_iff] using hzne ++ have hF : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) (Filter.atTop : Filter _) ++ (𝓝 ((divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ fiber.card)) := ++ hq.tendsto_at hz' ++ have hG0 : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ divisorComplementPartialProduct m f z₀ s z) (Filter.atTop : Filter _) ++ (𝓝 (divisorComplementCanonicalProduct m f z₀ z)) := ++ hcomp.tendsto_at (by simp : z ∈ (Set.univ : Set ℂ)) ++ have hG : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ (divisorComplementPartialProduct m f z₀ s z) * u z) (Filter.atTop : Filter _) ++ (𝓝 ((divisorComplementCanonicalProduct m f z₀ z) * u z)) := ++ (hG0.mul tendsto_const_nhds) ++ have hsub : ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), ++ fiber ⊆ s := eventually_atTop_subset_fiberFinset (f := f) z₀ ++ have heq_eventually : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), ++ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card ++ = (divisorComplementPartialProduct m f z₀ s z) * u z := by ++ filter_upwards [hsub] with s hs ++ have hsplit : ++ divisorPartialProduct m f s z = ++ divisorPartialProduct m f fiber z * divisorComplementPartialProduct m f z₀ s z := by ++ simpa [fiber] using ++ (divisorPartialProduct_eq_fiber_mul_complement_of_subset (m := m) (f := f) (z₀ := z₀) ++ (z := z) (s := s) hs) ++ have hfibz : ++ divisorPartialProduct m f fiber z = (z - z₀) ^ fiber.card • u z := by ++ exact hball hz ++ have hzpow : (z - z₀) ^ fiber.card ≠ 0 := ++ pow_ne_zero _ (sub_ne_zero.mpr hzne) ++ set a : ℂ := (z - z₀) ^ fiber.card ++ have ha : a ≠ 0 := by simpa [a] using hzpow ++ set c : ℂ := divisorComplementPartialProduct m f z₀ s z with hc ++ rw [hsplit, hfibz, smul_eq_mul] ++ calc ++ ((a * u z) * c) / a ++ = (a * (u z * c)) / a := by simp [mul_assoc] ++ _ = u z * c := by ++ simpa [mul_assoc] using (mul_div_cancel_left₀ (u z * c) ha) ++ _ = c * u z := by ac_rfl ++ _ = (divisorComplementPartialProduct m f z₀ s z) * u z := by ++ simp [c] ++ have hG' : ++ Tendsto ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) ++ (Filter.atTop : Filter _) ++ (𝓝 ((divisorComplementCanonicalProduct m f z₀ z) * u z)) := by ++ have heq' : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), ++ (divisorComplementPartialProduct m f z₀ s z) * u z ++ = (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card := by ++ filter_upwards [heq_eventually] with s hs ++ exact hs.symm ++ exact (hG.congr' heq') ++ exact tendsto_nhds_unique hF hG' ++ ++theorem bddAbove_norm_divisorCanonicalProduct_div_pow_puncturedBall ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ∃ r > 0, BddAbove (norm ∘ (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) '' ++ ((Metric.ball z₀ r) \ {z₀})) := by ++ rcases exists_ball_eq_divisorCanonicalProduct_div_pow_eq (m := m) (f := f) (h_sum := h_sum) ++ (z₀ := z₀) with ⟨ε, hε, u, huA, hu0, hEq⟩ ++ have huC : ContinuousAt u z₀ := huA.continuousAt ++ have hpre : {z : ℂ | ‖u z - u z₀‖ < 1} ∈ 𝓝 z₀ := by ++ have : u ⁻¹' Metric.ball (u z₀) (1 : ℝ) ∈ 𝓝 z₀ := ++ huC.preimage_mem_nhds (Metric.ball_mem_nhds (u z₀) (by norm_num)) ++ simpa [Metric.ball, dist_eq_norm, Set.preimage] using this ++ rcases Metric.mem_nhds_iff.1 hpre with ⟨r0, hr0pos, hr0sub⟩ ++ set r : ℝ := min (ε / 2) r0 ++ have hrpos : 0 < r := lt_min (by nlinarith [hε]) hr0pos ++ have hr_lt_ε : r < ε := lt_of_le_of_lt (min_le_left _ _) (by nlinarith [hε]) ++ have huBound : ∀ z ∈ Metric.ball z₀ r, ‖u z‖ ≤ ‖u z₀‖ + 1 := by ++ intro z hz ++ have hz0 : z ∈ Metric.ball z₀ r0 := by ++ have : r ≤ r0 := min_le_right _ _ ++ exact Metric.ball_subset_ball this hz ++ have hdiff : ‖u z - u z₀‖ < 1 := hr0sub hz0 ++ have htri : ‖u z‖ ≤ ‖u z - u z₀‖ + ‖u z₀‖ := by ++ simpa [sub_eq_add_neg, add_assoc] using ++ (norm_add_le (u z - u z₀) (u z₀)) ++ have : ‖u z‖ ≤ 1 + ‖u z₀‖ := le_trans htri (by nlinarith [le_of_lt hdiff]) ++ nlinarith [this] ++ have hdiffC : ++ DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) (Set.univ : Set ℂ) := ++ differentiableOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) h_sum ++ have hcontC : ContinuousOn (divisorComplementCanonicalProduct m f z₀) (Metric.closedBall z₀ r) := ++ (hdiffC.continuousOn).mono (by intro z hz; simp) ++ have hK : IsCompact (Metric.closedBall z₀ r) := isCompact_closedBall _ _ ++ rcases (isBounded_iff_forall_norm_le.1 (hK.image_of_continuousOn hcontC).isBounded) with ⟨C, hC⟩ ++ refine ⟨r, hrpos, ⟨C * (‖u z₀‖ + 1), ?_⟩⟩ ++ rintro _ ⟨z, hzset, rfl⟩ ++ rcases hzset with ⟨hzr, hzne⟩ ++ have hz_in_ε : z ∈ Metric.ball z₀ ε := Metric.ball_subset_ball hr_lt_ε.le hzr ++ have hz_ne : z ≠ z₀ := by simpa [Set.mem_singleton_iff] using hzne ++ have hq : ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card ++ = divisorComplementCanonicalProduct m f z₀ z * u z := ++ hEq z hz_in_ε hz_ne ++ have hCz : ‖divisorComplementCanonicalProduct m f z₀ z‖ ≤ C := by ++ have hzK : z ∈ Metric.closedBall z₀ r := Metric.mem_closedBall.2 (le_of_lt hzr) ++ exact hC _ ⟨z, hzK, rfl⟩ ++ have huZ : ‖u z‖ ≤ ‖u z₀‖ + 1 := huBound z hzr ++ have hCnonneg : 0 ≤ C := le_trans (norm_nonneg _) hCz ++ have hmul : ‖divisorComplementCanonicalProduct m f z₀ z * u z‖ ≤ C * (‖u z₀‖ + 1) := by ++ calc ++ ‖divisorComplementCanonicalProduct m f z₀ z * u z‖ ++ = ‖divisorComplementCanonicalProduct m f z₀ z‖ * ‖u z‖ := by simp ++ _ ≤ C * (‖u z₀‖ + 1) := by ++ exact mul_le_mul hCz huZ (norm_nonneg _) hCnonneg ++ simpa [Function.comp, hq] using hmul ++ ++theorem divisorComplementCanonicalProduct_ne_zero_at ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ divisorComplementCanonicalProduct m f z₀ z₀ ≠ 0 := by ++ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := ++ fun p => if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) ++ else weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := fun p => Φ p - 1 ++ have hΦ_ne : ∀ p, Φ p ≠ 0 := by ++ intro p ++ by_cases hp : divisorZeroIndex₀Val p = z₀ ++ · simp [Φ, hp] ++ · have hval : divisorZeroIndex₀Val p ≠ z₀ := hp ++ have hz : z₀ / divisorZeroIndex₀Val p ≠ (1 : ℂ) := by ++ intro h ++ by_cases hp0 : divisorZeroIndex₀Val p = 0 ++ · have : z₀ / divisorZeroIndex₀Val p = (0 : ℂ) := by simp [hp0] ++ have h01 := h ++ rw [this] at h01 ++ exact (show False from (by simpa using (show (0 : ℂ) ≠ (1 : ℂ) from by simp) h01)) ++ · have : z₀ = divisorZeroIndex₀Val p := (div_eq_one_iff_eq hp0).1 h ++ exact hval this.symm ++ have hE : weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ≠ 0 := by ++ intro h0 ++ have : z₀ / divisorZeroIndex₀Val p = (1 : ℂ) := ++ (weierstrassFactor_eq_zero_iff (m := m) (z := z₀ / divisorZeroIndex₀Val p)).1 h0 ++ exact hz this ++ simp [Φ, hp, hE] ++ have hz0_le : ‖z₀‖ ≤ max ‖z₀‖ 1 := le_max_left _ _ ++ set R : ℝ := max ‖z₀‖ 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) ++ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) ++ have h_big : ++ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, ++ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by ++ have hfin : ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ++ 2 * R} : Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this ++ have := hfin.eventually_cofinite_notMem ++ filter_upwards [this] with p hp ++ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp ++ exact lt_of_not_ge this ++ have hBound : ++ ∀ᶠ p in Filter.cofinite, ‖a p‖ ≤ u p := by ++ filter_upwards [h_big] with p hp ++ have ha_pos : 0 < ‖divisorZeroIndex₀Val p‖ := lt_trans (by nlinarith [hRpos]) hp ++ have hz_div : ‖z₀ / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by ++ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hRpos] ++ have hinv : ‖divisorZeroIndex₀Val p‖⁻¹ < (2 * R)⁻¹ := by ++ simpa [one_div] using (one_div_lt_one_div_of_lt h2R_pos hp) ++ have hmul_le : ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ ≤ R * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ refine mul_le_mul_of_nonneg_right ?_ (inv_nonneg.2 (norm_nonneg _)) ++ exact hz0_le ++ have hmul_lt : R * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := ++ mul_lt_mul_of_pos_left hinv hRpos ++ have hlt : ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := ++ lt_of_le_of_lt hmul_le hmul_lt ++ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by ++ have hRne : (R : ℝ) ≠ 0 := hRpos.ne' ++ have : R * (2 * R)⁻¹ = R / (2 * R) := by simp [div_eq_mul_inv] ++ rw [this] ++ field_simp [hRne] ++ have hnorm : ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ have hzlt : ‖z₀ / divisorZeroIndex₀Val p‖ < (1 / 2 : ℝ) := by ++ calc ++ ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := hnorm ++ _ < R * (2 * R)⁻¹ := hlt ++ _ = (1 / 2 : ℝ) := hRhalf ++ exact le_of_lt hzlt ++ have hE : ++ ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ ≤ ++ 4 * ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) := ++ weierstrassFactor_sub_one_pow_bound (m := m) (z := z₀ / divisorZeroIndex₀Val p) hz_div ++ have hz_pow : ++ ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ ++ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ have : ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ rw [this] ++ have : (‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = ++ ‖z₀‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ simp [mul_pow] ++ rw [this] ++ have hzle_pow : ‖z₀‖ ^ (m + 1) ≤ R ^ (m + 1) := ++ pow_le_pow_left₀ (norm_nonneg z₀) hz0_le (m + 1) ++ gcongr ++ have hp_ne : divisorZeroIndex₀Val p ≠ z₀ := by ++ intro h ++ have : ‖divisorZeroIndex₀Val p‖ ≤ R := by ++ simp [h, R] ++ exact (not_lt_of_ge this) (lt_trans (by nlinarith [hRpos]) hp) ++ have ha : ‖a p‖ = ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ := by ++ simp [a, Φ, hp_ne, sub_eq_add_neg] ++ calc ++ ‖a p‖ = ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ := ha ++ _ ≤ 4 * ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) := by ++ simpa [sub_eq_add_neg, add_comm] using hE ++ _ ≤ 4 * (R ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) := by ++ gcongr ++ _ = u p := by ++ simp [u, mul_assoc, mul_comm] ++ have hsum_norm : Summable (fun p => ‖a p‖) := by ++ refine (Summable.of_norm_bounded_eventually (E := ℝ) (f := fun p => ‖a p‖) (g := u) hu ?_) ++ filter_upwards [hBound] with p hp ++ simpa [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg (a p))] using hp ++ have htprod_ne : ++ (∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (1 + a p)) ≠ 0 := ++ tprod_one_add_ne_zero_of_summable (R := ℂ) (f := a) (hf := fun p => by ++ simpa [a, Φ, add_sub_cancel] using hΦ_ne p) hsum_norm ++ have : (∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (1 + a p)) = ++ divisorComplementCanonicalProduct m f z₀ z₀ := by ++ simp [a, Φ, divisorComplementCanonicalProduct, divisorComplementFactor_def] ++ exact by ++ intro h0 ++ exact htprod_ne (by simpa [this] using h0) ++ ++end Complex.Hadamard ++end HadamardSourceScope12 ++ ++section HadamardSourceScope13 ++ ++open Filter _root_.Function _root_.Complex _root_.Erdos970.Complex Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++theorem differentiableOn_divisorPartialProduct_div_pow_sub ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) (k : ℕ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : ++ DifferentiableOn ℂ (fun z : ℂ => (divisorPartialProduct m f s z) / (z - z₀) ^ k) ++ ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hdiff_prod : DifferentiableOn ℂ (divisorPartialProduct m f s) (Set.univ : Set ℂ) := by ++ exact (differentiable_divisorPartialProduct m f s).differentiableOn ++ have hdiff_den : DifferentiableOn ℂ (fun z : ℂ => (z - z₀) ^ k) ((Set.univ : Set ℂ) \ {z₀}) := by ++ have : Differentiable ℂ (fun z : ℂ => (z - z₀) ^ k) := by ++ fun_prop ++ exact this.differentiableOn ++ by_cases hk : k = 0 ++ · subst hk ++ simpa [pow_zero] using! (hdiff_prod.mono (by intro z hz; exact hz.1)) ++ · have hne : ∀ z ∈ ((Set.univ : Set ℂ) \ {z₀}), (fun z : ℂ => (z - z₀) ^ k) z ≠ 0 := by ++ intro z hz ++ have hz' : z ≠ z₀ := by ++ simpa [Set.mem_sdiff, Set.mem_singleton_iff] using hz.2 ++ exact pow_ne_zero _ (sub_ne_zero.mpr hz') ++ have hdiff_inv : ++ DifferentiableOn ℂ (fun z : ℂ => ((z - z₀) ^ k)⁻¹) ((Set.univ : Set ℂ) \ {z₀}) := ++ hdiff_den.inv hne ++ simpa [div_eq_mul_inv] using! (hdiff_prod.mono (by intro z hz; exact hz.1)).mul hdiff_inv ++ ++theorem differentiableOn_divisorCanonicalProduct_div_pow_sub ++ (m : ℕ) (f : ℂ → ℂ) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) (k : ℕ) : DifferentiableOn ℂ ++ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) ++ ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hopen : IsOpen ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hset : ((Set.univ : Set ℂ) \ {z₀}) = ({z₀} : Set ℂ)ᶜ := by ++ ext z; simp ++ simp [hset] ++ have hconv := ++ tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m := m) (f := f) h_sum (z₀ := z₀) (k := k) ++ refine hconv.differentiableOn ?_ hopen ++ refine Filter.Eventually.of_forall ?_ ++ intro s ++ exact differentiableOn_divisorPartialProduct_div_pow_sub (m := m) (f := f) (z₀ := z₀) (k := k) s ++ ++theorem differentiableOn_update_limUnder_divisorCanonicalProduct_div_pow ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ∃ r > 0, DifferentiableOn ℂ (Function.update ++ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) z₀ ++ (limUnder (𝓝[≠] z₀) (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card))) ++ (Metric.ball z₀ r) := by ++ rcases bddAbove_norm_divisorCanonicalProduct_div_pow_puncturedBall (m := m) (f := f) ++ (h_sum := h_sum) (z₀ := z₀) with ⟨r, hrpos, hbdd⟩ ++ refine ⟨r, hrpos, ?_⟩ ++ have hnhds : Metric.ball z₀ r ∈ 𝓝 z₀ := Metric.ball_mem_nhds z₀ hrpos ++ have hdiff : DifferentiableOn ℂ (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ ((Metric.ball z₀ r) \ {z₀}) := by ++ have hglob := ++ differentiableOn_divisorCanonicalProduct_div_pow_sub ++ (m := m) (f := f) h_sum (z₀ := z₀) ++ (k := (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ refine hglob.mono ?_ ++ intro z hz ++ exact ⟨by simp, hz.2⟩ ++ have hb : BddAbove (norm ∘ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) '' ++ ((Metric.ball z₀ r) \ {z₀})) := hbdd ++ simpa using ++ (Complex.differentiableOn_update_limUnder_of_bddAbove (f := fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ (s := Metric.ball z₀ r) (c := z₀) hnhds hdiff hb) ++ ++theorem analyticAt_update_limUnder_divisorCanonicalProduct_div_pow ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : AnalyticAt ℂ (Function.update (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) z₀ ++ (limUnder (𝓝[≠] z₀) (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card))) ++ z₀ := by ++ rcases ++ differentiableOn_update_limUnder_divisorCanonicalProduct_div_pow ++ (m := m) (f := f) h_sum (z₀ := z₀) with ⟨r, hrpos, hdiff⟩ ++ let g : ℂ → ℂ := ++ Function.update ++ (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ z₀ ++ (limUnder (𝓝[≠] z₀) fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ have hcont : ContinuousAt g z₀ := ++ (hdiff.differentiableAt (Metric.ball_mem_nhds z₀ hrpos)).continuousAt ++ have hd : ++ ∀ᶠ z in 𝓝[≠] z₀, DifferentiableAt ℂ g z := by ++ have hballWithin : Metric.ball z₀ r ∈ 𝓝[≠] z₀ := by ++ refine mem_nhdsWithin_iff_exists_mem_nhds_inter.2 ?_ ++ refine ⟨Metric.ball z₀ r, Metric.ball_mem_nhds z₀ hrpos, ?_⟩ ++ intro z hz ++ exact hz.1 ++ filter_upwards [hballWithin] with z hz ++ exact (hdiff z hz).differentiableAt (Metric.isOpen_ball.mem_nhds hz) ++ simpa [g] using Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt hd hcont ++ ++theorem exists_analyticAt_divisorCanonicalProduct_quotient ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ++ ∃ q : ℂ → ℂ, ++ AnalyticAt ℂ q z₀ ∧ ++ q z₀ = ++ limUnder (𝓝[≠] z₀) (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ∧ ++ ∀ z : ℂ, z ≠ z₀ → ++ q z = ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by ++ let q : ℂ → ℂ := ++ Function.update ++ (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ z₀ ++ (limUnder (𝓝[≠] z₀) fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ refine ⟨q, ?_, ?_, ?_⟩ ++ · simpa [q] using ++ analyticAt_update_limUnder_divisorCanonicalProduct_div_pow ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) ++ · simp [q] ++ · intro z hz ++ simp [q, Function.update_of_ne hz] ++ ++theorem analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by ++ set k : ℕ := (divisorZeroIndex₀FiberFinset (f := f) z₀).card ++ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) ++ let q0 : ℂ → ℂ := fun z => F z / (z - z₀) ^ k ++ rcases exists_analyticAt_divisorCanonicalProduct_quotient ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) with ++ ⟨q, hqA, hq_self, hq_ne⟩ ++ have hdiff_univ : DifferentiableOn ℂ F (Set.univ : Set ℂ) := ++ differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ have han : AnalyticAt ℂ F z₀ := by ++ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ have : DifferentiableWithinAt ℂ F (Set.univ : Set ℂ) z := hdiff_univ z (by simp) ++ exact this.differentiableAt (by simp) ++ rcases ++ exists_ball_eq_divisorCanonicalProduct_div_pow_eq (m := m) (f := f) (h_sum := h_sum) ++ (z₀ := z₀) ++ with ⟨ε, hε, u, huA, hu0, hEq⟩ ++ let g : ℂ → ℂ := fun z => (divisorComplementCanonicalProduct m f z₀ z) * u z ++ have hcompDiff : DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) ++ (Set.univ : Set ℂ) := ++ differentiableOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) h_sum ++ have hcompCont : ContinuousAt (divisorComplementCanonicalProduct m f z₀) z₀ := ++ (hcompDiff z₀ (by simp)).differentiableAt (by simp) |>.continuousAt ++ have hgCont : ContinuousAt g z₀ := (hcompCont.mul huA.continuousAt) ++ have hg0 : g z₀ ≠ 0 := by ++ have hcomp0 : divisorComplementCanonicalProduct m f z₀ z₀ ≠ 0 := ++ divisorComplementCanonicalProduct_ne_zero_at (m := m) (f := f) (z₀ := z₀) h_sum ++ exact mul_ne_zero hcomp0 hu0 ++ have hne_mem : ∀ᶠ z in 𝓝[≠] z₀, z ∈ (({z₀} : Set ℂ)ᶜ) := ++ Filter.eventually_of_mem ++ (self_mem_nhdsWithin : (({z₀} : Set ℂ)ᶜ) ∈ 𝓝[≠] z₀) (fun _ hz => hz) ++ have hne : ∀ᶠ z in 𝓝[≠] z₀, z ≠ z₀ := by ++ filter_upwards [hne_mem] with z hz ++ simpa [Set.mem_compl_singleton_iff] using hz ++ have ht_q0 : Tendsto q0 (𝓝[≠] z₀) (𝓝 (g z₀)) := by ++ have hball : ∀ᶠ z in 𝓝[≠] z₀, z ∈ Metric.ball z₀ ε := ++ Filter.eventually_of_mem ++ (mem_nhdsWithin_of_mem_nhds (Metric.ball_mem_nhds z₀ hε)) (fun _ hz => hz) ++ have heq : q0 =ᶠ[𝓝[≠] z₀] g := by ++ filter_upwards [hball, hne] with z hz hzne ++ have hq := hEq z hz hzne ++ simpa [q0, F, k, g, smul_eq_mul] using hq ++ exact (hgCont.continuousWithinAt.tendsto.congr' heq.symm) ++ have hlim : limUnder (𝓝[≠] z₀) q0 = g z₀ := ht_q0.limUnder_eq ++ have hq0 : q z₀ ≠ 0 := by ++ have hq_self' : q z₀ = limUnder (𝓝[≠] z₀) q0 := by ++ simpa [q0, F, k] using hq_self ++ have : q z₀ = g z₀ := hq_self'.trans hlim ++ exact this.symm ▸ hg0 ++ have heq_punct : (fun z : ℂ => F z) =ᶠ[𝓝[≠] z₀] fun z : ℂ => (z - z₀) ^ k • q z := by ++ filter_upwards [hne] with z hz ++ have hzpow : (z - z₀) ^ k ≠ 0 := pow_ne_zero _ (sub_ne_zero.mpr hz) ++ have hq : q z = q0 z := by simpa [q0, F, k] using hq_ne z hz ++ have hmul : (z - z₀) ^ k * q0 z = F z := by ++ calc ++ (z - z₀) ^ k * q0 z ++ = (((z - z₀) ^ k) * F z) / ((z - z₀) ^ k) := by ++ simp [q0, div_eq_mul_inv, mul_assoc] ++ _ = F z := by ++ simpa [mul_assoc] using (mul_div_cancel_left₀ (F z) hzpow) ++ have : F z = (z - z₀) ^ k * q z := by ++ calc ++ F z = (z - z₀) ^ k * q0 z := hmul.symm ++ _ = (z - z₀) ^ k * q z := by simp [hq] ++ simpa [smul_eq_mul] using this ++ have hcontF : ContinuousAt F z₀ := ++ (hdiff_univ z₀ (by simp)).differentiableAt (by simp) |>.continuousAt ++ have hcontq : ContinuousAt q z₀ := hqA.continuousAt ++ have h_at_z0 : F z₀ = (z₀ - z₀) ^ k • q z₀ := by ++ have ht1 : Tendsto F (𝓝[≠] z₀) (𝓝 (F z₀)) := hcontF.continuousWithinAt.tendsto ++ have hpow : ++ Tendsto (fun z : ℂ => (z - z₀) ^ k) (𝓝[≠] z₀) (𝓝 ((z₀ - z₀) ^ k)) := ++ ((continuousAt_id.sub continuousAt_const).pow k).continuousWithinAt.tendsto ++ have ht2 : ++ Tendsto (fun z : ℂ => (z - z₀) ^ k • q z) (𝓝[≠] z₀) ++ (𝓝 ((z₀ - z₀) ^ k • q z₀)) := ++ hpow.mul (hcontq.continuousWithinAt.tendsto) ++ have ht2' : Tendsto F (𝓝[≠] z₀) (𝓝 ((z₀ - z₀) ^ k • q z₀)) := ++ ht2.congr' heq_punct.symm ++ exact tendsto_nhds_unique ht1 ht2' ++ have hfac : ∀ᶠ z in 𝓝 z₀, F z = (z - z₀) ^ k • q z := by ++ have hball1 : Metric.ball z₀ 1 ∈ 𝓝 z₀ := Metric.ball_mem_nhds z₀ (by norm_num) ++ have hball1' : ∀ᶠ z in 𝓝 z₀, z ∈ Metric.ball z₀ 1 := ++ Filter.eventually_of_mem hball1 (fun _ hz => hz) ++ filter_upwards [hball1'] with z _hz ++ by_cases hz0 : z = z₀ ++ · subst hz0 ++ simpa using h_at_z0 ++ · have hzpow : (z - z₀) ^ k ≠ 0 := pow_ne_zero _ (sub_ne_zero.mpr hz0) ++ have hq : q z = q0 z := by simpa [q0, F, k] using hq_ne z hz0 ++ have hmul : (z - z₀) ^ k * q0 z = F z := by ++ calc ++ (z - z₀) ^ k * q0 z ++ = (((z - z₀) ^ k) * F z) / ((z - z₀) ^ k) := by ++ simp [q0, div_eq_mul_inv, mul_assoc] ++ _ = F z := by ++ simpa [mul_assoc] using (mul_div_cancel_left₀ (F z) hzpow) ++ have : F z = (z - z₀) ^ k * q z := by ++ calc ++ F z = (z - z₀) ^ k * q0 z := hmul.symm ++ _ = (z - z₀) ^ k * q z := by simp [hq] ++ simpa [smul_eq_mul] using this ++ have hk' : analyticOrderAt F z₀ = k := ++ (han.analyticOrderAt_eq_natCast (n := k)).2 ⟨q, hqA, hq0, hfac⟩ ++ have hkNat : analyticOrderNatAt F z₀ = k := by ++ simp [analyticOrderNatAt, hk'] ++ simpa [F, k] using hkNat ++ ++theorem analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = ++ analyticOrderNatAt f z₀ := by ++ have hcp : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := ++ analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card (m := m) (f := f) (h_sum := h_sum) ++ (z₀ := z₀) ++ have hfib : ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = analyticOrderNatAt f z₀ := ++ divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt (hf := hf) (z₀ := z₀) hz₀ ++ simpa [hfib] using hcp ++ ++end Complex.Hadamard ++end HadamardSourceScope13 ++ ++section HadamardSourceScope14 ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++open scoped Topology ++open Set ++ ++lemma analyticOrderAt_ne_top_of_exists_ne_zero {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (hnot : ∃ z : ℂ, f z ≠ 0) : ++ ∀ z : ℂ, analyticOrderAt f z ≠ ⊤ := by ++ rcases hnot with ⟨z1, hz1⟩ ++ have hf_an : AnalyticOnNhd ℂ f (Set.univ : Set ℂ) := by ++ intro z hz ++ exact (Differentiable.analyticAt (f := f) hf z) ++ have hz1_not_top : analyticOrderAt f z1 ≠ ⊤ := by ++ have : analyticOrderAt f z1 = 0 := ++ (hf.analyticAt z1).analyticOrderAt_eq_zero.2 hz1 ++ simp [this] ++ intro z ++ exact AnalyticOnNhd.analyticOrderAt_ne_top_of_isPreconnected (hf := hf_an) ++ (U := (Set.univ : Set ℂ)) (x := z1) (y := z) (by simpa using isPreconnected_univ) ++ (by simp) (by simp) hz1_not_top ++ ++lemma no_zero_on_sphere_of_forall_val_norm_ne ++ {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ {B r : ℝ} (hrpos : 0 < r) (hBr : r ≤ B) (hr_not : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖ ≤ B → r ≠ ‖divisorZeroIndex₀Val p‖) : ++ ∀ u : ℂ, ‖u‖ = r → f u ≠ 0 := by ++ intro u hur ++ have hu0 : u ≠ 0 := by ++ intro hu0 ++ subst hu0 ++ have : (0 : ℝ) = r := by simpa using hur ++ exact (ne_of_gt hrpos) this.symm ++ intro hfu0 ++ have hnotTop : analyticOrderAt f u ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) hf hnot u ++ have hord_ne0 : analyticOrderNatAt f u ≠ 0 := by ++ intro h0 ++ have hEN : (analyticOrderNatAt f u : ENat) = 0 := by simp [h0] ++ have hAt0 : analyticOrderAt f u = 0 := by ++ have hcast : (analyticOrderNatAt f u : ENat) = analyticOrderAt f u := ++ Nat.cast_analyticOrderNatAt (f := f) (z₀ := u) hnotTop ++ simpa [hcast] using hEN ++ have han : AnalyticAt ℂ f u := Differentiable.analyticAt (f := f) hf u ++ exact ((han.analyticOrderAt_eq_zero).1 hAt0) hfu0 ++ have hcard_pos : 0 < (divisorZeroIndex₀FiberFinset (f := f) u).card := by ++ have hcard := ++ divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt (hf := hf) (z₀ := u) hu0 ++ have : 0 < analyticOrderNatAt f u := Nat.pos_of_ne_zero hord_ne0 ++ simpa [hcard] using this ++ rcases Finset.card_pos.mp hcard_pos with ⟨p, hp⟩ ++ have hpval : divisorZeroIndex₀Val p = u := ++ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := u) p).1 hp ++ have hpB : ‖divisorZeroIndex₀Val p‖ ≤ B := by ++ have : ‖divisorZeroIndex₀Val p‖ = r := by simp [hpval, hur] ++ simpa [this] using hBr ++ have : r ≠ ‖divisorZeroIndex₀Val p‖ := hr_not p hpB ++ exact this (by simp [hpval, hur]) ++ ++theorem analyticOrderAt_divisorCanonicalProduct_eq_fiber_card ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = ++ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by ++ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) ++ have hNat : ++ analyticOrderNatAt F z₀ = (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by ++ simpa [F] using ++ (analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀)) ++ have hdiffOn : DifferentiableOn ℂ F (Set.univ : Set ℂ) := by ++ simpa [F] using differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ have hdiff : Differentiable ℂ F := by ++ intro z ++ exact (hdiffOn z (by simp)).differentiableAt (by simp) ++ have hnotTop : analyticOrderAt F z₀ ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hdiff) ++ ⟨0, by simp [F, divisorCanonicalProduct_zero]⟩ z₀ ++ have hcast : (analyticOrderNatAt F z₀ : ℕ∞) = analyticOrderAt F z₀ := ++ Nat.cast_analyticOrderNatAt (f := F) (z₀ := z₀) hnotTop ++ have hNatCast : ++ (analyticOrderNatAt F z₀ : ℕ∞) = ++ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by ++ simp [hNat] ++ simpa [F, hcast] using hNatCast ++ ++theorem divisorCanonicalProduct_ne_zero_of_forall_ne ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ {z : ℂ} (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) z ≠ 0 := by ++ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) ++ have hfiber_empty : divisorZeroIndex₀FiberFinset (f := f) z = ∅ := by ++ ext p ++ constructor ++ · intro hp ++ exact False.elim (hz p ((mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z) p).1 hp).symm) ++ · intro hp ++ simp at hp ++ have horder : ++ analyticOrderAt F z = (0 : ℕ∞) := by ++ have h := ++ analyticOrderAt_divisorCanonicalProduct_eq_fiber_card ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z) ++ simpa [F, hfiber_empty] using h ++ have han : AnalyticAt ℂ F z := by ++ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ ++ refine Filter.Eventually.of_forall ?_ ++ intro w ++ exact (((differentiableOn_divisorCanonicalProduct_univ m f h_sum) w ++ (by simp)).differentiableAt (by simp)) ++ exact (han.analyticOrderAt_eq_zero).1 horder ++ ++theorem logDeriv_divisorCanonicalProduct_one_eq_tsum_of_forall_ne ++ {f : ℂ → ℂ} {z : ℂ} ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) ++ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : ++ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z = ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := ++ logDeriv_divisorCanonicalProduct_one_eq_tsum h_sum hz ++ (divisorCanonicalProduct_ne_zero_of_forall_ne 1 f h_sum hz) ++ ++end Hadamard ++end Complex ++end HadamardSourceScope14 ++ ++section HadamardSourceScope16 ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++open Filter Topology Set _root_.Complex _root_.Erdos970.Complex ++ ++open scoped BigOperators Topology ++ ++noncomputable def hadamardDenom (m : ℕ) (f : ℂ → ℂ) (z : ℂ) : ℂ := ++ z ^ (analyticOrderNatAt f 0) * divisorCanonicalProduct m f (Set.univ : Set ℂ) z ++ ++theorem differentiable_divisorCanonicalProduct_univ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by ++ intro z ++ have hdiffOn : ++ DifferentiableOn ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) (Set.univ : Set ℂ) := ++ differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ exact (hdiffOn z (by simp)).differentiableAt (by simp) ++ ++theorem analyticAt_divisorCanonicalProduct_univ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : ++ AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := ++ (differentiable_divisorCanonicalProduct_univ m f h_sum).analyticAt z ++ ++theorem differentiable_hadamardDenom (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ Differentiable ℂ (hadamardDenom m f) := by ++ have hcprod : Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by ++ exact differentiable_divisorCanonicalProduct_univ m f h_sum ++ simpa [hadamardDenom] using! (differentiable_id.pow (analyticOrderNatAt f 0)).mul hcprod ++ ++theorem hadamardDenom_ne_zero_at {m : ℕ} {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (hnot : ∃ z : ℂ, f z ≠ 0) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) {z : ℂ} (hz : f z ≠ 0) : hadamardDenom m f z ≠ 0 := by ++ have hf_not_top : ∀ w : ℂ, analyticOrderAt f w ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hf) hnot ++ have han_f : AnalyticAt ℂ f z := hf.analyticAt z ++ have horder_f : analyticOrderNatAt f z = 0 := by ++ have : analyticOrderAt f z = 0 := (han_f.analyticOrderAt_eq_zero).2 hz ++ have hcast : (analyticOrderNatAt f z : ℕ∞) = analyticOrderAt f z := ++ Nat.cast_analyticOrderNatAt (f := f) (z₀ := z) (hf_not_top z) ++ have : (analyticOrderNatAt f z : ℕ∞) = 0 := by simp [hcast, this] ++ exact_mod_cast this ++ have han_cprod : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by ++ exact analyticAt_divisorCanonicalProduct_univ m f h_sum z ++ by_cases hz0 : z = 0 ++ · subst hz0 ++ have hord0 : analyticOrderNatAt f 0 = 0 := by simpa using horder_f ++ simp [hadamardDenom, hord0, divisorCanonicalProduct_zero] ++ · have hp : z ^ (analyticOrderNatAt f 0) ≠ 0 := pow_ne_zero _ hz0 ++ have hcprod_order : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = 0 := by ++ simpa [horder_f] using ++ (analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt (m := m) (hf := hf) ++ (h_sum := h_sum) (z₀ := z) hz0) ++ have hcprod_ne : divisorCanonicalProduct m f (Set.univ : Set ℂ) z ≠ 0 := by ++ have hcprod_entire : ++ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by ++ exact differentiable_divisorCanonicalProduct_univ m f h_sum ++ have hcprod_not_top : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hcprod_entire) ++ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ z ++ have hcprod_cast : ++ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z : ℕ∞) = ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := ++ Nat.cast_analyticOrderNatAt ++ (f := divisorCanonicalProduct m f (Set.univ : Set ℂ)) (z₀ := z) hcprod_not_top ++ have : analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = 0 := by ++ have : ++ (analyticOrderNatAt ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z : ℕ∞) = 0 := by ++ exact_mod_cast hcprod_order ++ simp [hcprod_cast] at this ++ simpa using this ++ exact (han_cprod.analyticOrderAt_eq_zero).1 this ++ exact mul_ne_zero hp hcprod_ne ++ ++lemma analyticOrderNatAt_divisorCanonicalProduct_zero ++ (m : ℕ) (f : ℂ → ℂ) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := by ++ have hcprod_entire : ++ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by ++ exact differentiable_divisorCanonicalProduct_univ m f h_sum ++ have hcprod_not_top : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hcprod_entire) ++ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ 0 ++ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := ++ hcprod_entire.analyticAt 0 ++ have hcprod0 : divisorCanonicalProduct m f (Set.univ : Set ℂ) 0 ≠ 0 := by ++ simp [divisorCanonicalProduct_zero] ++ have : analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := ++ (hcprodA.analyticOrderAt_eq_zero).2 hcprod0 ++ have hcast : ++ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 : ℕ∞) = ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := ++ Nat.cast_analyticOrderNatAt ++ (f := divisorCanonicalProduct m f (Set.univ : Set ℂ)) (z₀ := (0 : ℂ)) hcprod_not_top ++ have : ++ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 : ℕ∞) = ++ 0 := by ++ simp [hcast, this] ++ exact_mod_cast this ++ ++theorem analyticOrderNatAt_hadamardDenom_eq ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : ++ analyticOrderNatAt (hadamardDenom m f) z = analyticOrderNatAt f z := by ++ by_cases hz0 : z = 0 ++ · subst hz0 ++ have hpowA : AnalyticAt ℂ (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 := by ++ simpa using! (analyticAt_id.pow (analyticOrderNatAt f 0)) ++ have hpow_not_top : ++ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero ++ (hf := (differentiable_id.pow (analyticOrderNatAt f 0))) ++ ⟨1, by simp⟩ 0 ++ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := by ++ exact analyticAt_divisorCanonicalProduct_univ m f h_sum 0 ++ have hcprod0 : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := ++ analyticOrderNatAt_divisorCanonicalProduct_zero (m := m) (f := f) h_sum ++ have hid0 : analyticOrderNatAt (fun z : ℂ => z) 0 = 1 := by ++ have hid_entire : Differentiable ℂ (fun z : ℂ => z) := differentiable_id ++ have hdiv : ++ (MeromorphicOn.divisor (fun z : ℂ => z) (Set.univ : Set ℂ)) 0 = ++ (analyticOrderNatAt (fun z : ℂ => z) 0 : ℤ) := by ++ simpa using ++ (divisor_univ_eq_analyticOrderNatAt_int ++ (f := fun z : ℂ => z) hid_entire 0) ++ have hdiv1 : (MeromorphicOn.divisor (fun z : ℂ => z) (Set.univ : Set ℂ)) 0 = 1 := by ++ simpa using ++ (MeromorphicOn.divisor_sub_const_self (z₀ := (0 : ℂ)) ++ (U := (Set.univ : Set ℂ)) (by simp)) ++ have : (analyticOrderNatAt (fun z : ℂ => z) 0 : ℤ) = 1 := by ++ simpa [hdiv] using hdiv1 ++ exact_mod_cast this ++ have hpow0 : ++ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 = ++ analyticOrderNatAt f 0 := by ++ have hidA : AnalyticAt ℂ (fun z : ℂ => z) 0 := by ++ simpa [id] using! (analyticAt_id : AnalyticAt ℂ (id : ℂ → ℂ) 0) ++ simpa [hid0] using! (analyticOrderNatAt_pow (hf := hidA) (n := analyticOrderNatAt f 0)) ++ have hmul : ++ analyticOrderNatAt (hadamardDenom m f) 0 = ++ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 + ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := by ++ have hcprod_not_top' : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero ++ (hf := differentiable_divisorCanonicalProduct_univ m f h_sum) ++ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ 0 ++ simpa [hadamardDenom] using! ++ analyticOrderNatAt_mul (hf := hpowA) (hg := hcprodA) ++ (hf' := hpow_not_top) (hg' := hcprod_not_top') ++ simp [hmul, hpow0, hcprod0] ++ · have hpowA : AnalyticAt ℂ (fun z : ℂ => z ^ analyticOrderNatAt f 0) z := by ++ simpa using! (analyticAt_id.pow (analyticOrderNatAt f 0)) ++ have hpow_not_top : ++ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero ++ (hf := (differentiable_id.pow (analyticOrderNatAt f 0))) ++ ⟨1, by simp⟩ z ++ have hpow0 : analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z = 0 := by ++ have hz' : (fun z : ℂ => z ^ analyticOrderNatAt f 0) z ≠ 0 := by ++ simp [hz0] ++ have : analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z = 0 := ++ ((hpowA).analyticOrderAt_eq_zero).2 hz' ++ have hcast : (analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z : ℕ∞) = ++ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z := ++ Nat.cast_analyticOrderNatAt ++ (f := fun z : ℂ => z ^ analyticOrderNatAt f 0) (z₀ := z) hpow_not_top ++ have : (analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z : ℕ∞) = 0 := by ++ simp [hcast, this] ++ exact_mod_cast this ++ have hcprod_eq : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = ++ analyticOrderNatAt f z := ++ analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt ++ (m := m) (hf := hf) (h_sum := h_sum) (z₀ := z) hz0 ++ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by ++ exact analyticAt_divisorCanonicalProduct_univ m f h_sum z ++ have hcprod_not_top : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero ++ (hf := differentiable_divisorCanonicalProduct_univ m f h_sum) ++ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ z ++ have hmul : ++ analyticOrderNatAt (hadamardDenom m f) z = ++ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z + ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by ++ simpa [hadamardDenom] using! ++ analyticOrderNatAt_mul (hf := hpowA) (hg := hcprodA) ++ (hf' := hpow_not_top) (hg' := hcprod_not_top) ++ simp [hmul, hpow0, hcprod_eq] ++ ++theorem divisor_hadamardDenom_eq ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) = ++ MeromorphicOn.divisor f (Set.univ : Set ℂ) := by ++ ext z ++ have hden_entire : Differentiable ℂ (hadamardDenom m f) := ++ differentiable_hadamardDenom (m := m) f h_sum ++ have hf_entire : Differentiable ℂ f := hf ++ have hden : ++ (MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ)) z = ++ (analyticOrderNatAt (hadamardDenom m f) z : ℤ) := by ++ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := hadamardDenom m f) hden_entire z) ++ have hfz : ++ (MeromorphicOn.divisor f (Set.univ : Set ℂ)) z = ++ (analyticOrderNatAt f z : ℤ) := by ++ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := f) hf_entire z) ++ simp [hden, hfz, analyticOrderNatAt_hadamardDenom_eq (m := m) (hf := hf) (h_sum := h_sum) z] ++ ++theorem divisor_hadamardQuotient_eq_zero ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ MeromorphicOn.divisor (fun z : ℂ => f z / hadamardDenom m f z) (Set.univ : Set ℂ) = 0 := by ++ have hf_mero : MeromorphicOn f (Set.univ : Set ℂ) := by ++ intro z hz ++ exact (hf.analyticAt z).meromorphicAt ++ have hden_entire : Differentiable ℂ (hadamardDenom m f) := ++ differentiable_hadamardDenom (m := m) f h_sum ++ have hden_mero : MeromorphicOn (hadamardDenom m f) (Set.univ : Set ℂ) := by ++ intro z hz ++ exact (hden_entire.analyticAt z).meromorphicAt ++ rcases hnot with ⟨z1, hz1⟩ ++ have hden1 : hadamardDenom m f z1 ≠ 0 := ++ hadamardDenom_ne_zero_at (m := m) (f := f) hf ⟨z1, hz1⟩ h_sum hz1 ++ have hf_order_ne_top : ∀ z ∈ (Set.univ : Set ℂ), meromorphicOrderAt f z ≠ ⊤ := by ++ intro z hzU ++ have hz1_ne_top : meromorphicOrderAt f z1 ≠ ⊤ := by ++ have hfAt : MeromorphicAt f z1 := hf_mero z1 (by simp) ++ have hcont : ContinuousAt f z1 := (hf.differentiableAt).continuousAt ++ have hne_nhds : ∀ᶠ w in 𝓝 z1, f w ≠ 0 := ++ (hcont.ne_iff_eventually_ne continuousAt_const).1 hz1 ++ have hne_nhdsNE : ∀ᶠ w in 𝓝[≠] z1, f w ≠ 0 := ++ eventually_nhdsWithin_of_eventually_nhds hne_nhds ++ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hfAt)).2 hne_nhdsNE ++ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hf_mero) ++ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top ++ have hden_order_ne_top : ++ ∀ z ∈ (Set.univ : Set ℂ), meromorphicOrderAt (hadamardDenom m f) z ≠ ⊤ := by ++ intro z hzU ++ have hz1_ne_top : meromorphicOrderAt (hadamardDenom m f) z1 ≠ ⊤ := by ++ have hdenAt : MeromorphicAt (hadamardDenom m f) z1 := hden_mero z1 (by simp) ++ have hcont : ContinuousAt (hadamardDenom m f) z1 := ++ (hden_entire.differentiableAt).continuousAt ++ have hne_nhds : ∀ᶠ w in 𝓝 z1, hadamardDenom m f w ≠ 0 := ++ (hcont.ne_iff_eventually_ne continuousAt_const).1 hden1 ++ have hne_nhdsNE : ∀ᶠ w in 𝓝[≠] z1, hadamardDenom m f w ≠ 0 := ++ eventually_nhdsWithin_of_eventually_nhds hne_nhds ++ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hdenAt)).2 hne_nhdsNE ++ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hden_mero) ++ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top ++ have hinv_order_ne_top : ++ ∀ z ∈ (Set.univ : Set ℂ), ++ meromorphicOrderAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z ≠ ⊤ := by ++ intro z hzU ++ have hinv_mero : ++ MeromorphicOn (fun z : ℂ => (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := ++ hden_mero.inv ++ have hz1_ne_top : ++ meromorphicOrderAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 ≠ ⊤ := by ++ have hinvAt : MeromorphicAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 := ++ hinv_mero z1 (by simp) ++ have hcont_denom : ContinuousAt (hadamardDenom m f) z1 := ++ (hden_entire.differentiableAt).continuousAt ++ have hcont : ContinuousAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 := ++ hcont_denom.inv₀ hden1 ++ have hinv1 : (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 ≠ 0 := by ++ simpa using inv_ne_zero hden1 ++ have hne_nhds : ++ ∀ᶠ w in 𝓝 z1, (fun z : ℂ => (hadamardDenom m f z)⁻¹) w ≠ 0 := ++ (hcont.ne_iff_eventually_ne continuousAt_const).1 hinv1 ++ have hne_nhdsNE : ++ ∀ᶠ w in 𝓝[≠] z1, (fun z : ℂ => (hadamardDenom m f z)⁻¹) w ≠ 0 := ++ eventually_nhdsWithin_of_eventually_nhds hne_nhds ++ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hinvAt)).2 hne_nhdsNE ++ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hinv_mero) ++ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top ++ have hdiv_denom : MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) = ++ MeromorphicOn.divisor f (Set.univ : Set ℂ) := ++ divisor_hadamardDenom_eq (m := m) (hf := hf) (h_sum := h_sum) ++ calc ++ MeromorphicOn.divisor (fun z : ℂ => f z / hadamardDenom m f z) (Set.univ : Set ℂ) ++ = MeromorphicOn.divisor ++ (fun z : ℂ => f z * (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := by ++ simp [div_eq_mul_inv] ++ _ = MeromorphicOn.divisor f (Set.univ : Set ℂ) + ++ MeromorphicOn.divisor (fun z : ℂ => (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := by ++ simpa using (MeromorphicOn.divisor_fun_mul (U := (Set.univ : Set ℂ)) ++ (f₁ := f) (f₂ := fun z => (hadamardDenom m f z)⁻¹) hf_mero (hden_mero.inv) ++ hf_order_ne_top hinv_order_ne_top) ++ _ = MeromorphicOn.divisor f (Set.univ : Set ℂ) - ++ MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) := by ++ simp [sub_eq_add_neg] ++ _ = 0 := by ++ simp [hdiv_denom] ++ ++theorem exists_entire_nonzero_hadamardQuotient ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ ∃ H : ℂ → ℂ, Differentiable ℂ H ∧ (∀ z, H z ≠ 0) ∧ ∀ z : ℂ, f z = ++ H z * z ^ (analyticOrderNatAt f 0) * divisorCanonicalProduct m f (Set.univ : Set ℂ) z := by ++ let denom : ℂ → ℂ := hadamardDenom m f ++ let q : ℂ → ℂ := fun z => f z / denom z ++ have hden_entire : Differentiable ℂ denom := ++ differentiable_hadamardDenom (m := m) f h_sum ++ have hq_mero : MeromorphicOn q (Set.univ : Set ℂ) := by ++ intro z hzU ++ have hf_m : MeromorphicAt f z := (hf.analyticAt z).meromorphicAt ++ have hden_m : MeromorphicAt denom z := (hden_entire.analyticAt z).meromorphicAt ++ simpa [q, denom, div_eq_mul_inv] using! (hf_m.mul hden_m.inv) ++ let H : ℂ → ℂ := toMeromorphicNFOn q (Set.univ : Set ℂ) ++ have hNF : MeromorphicNFOn H (Set.univ : Set ℂ) := ++ meromorphicNFOn_toMeromorphicNFOn q (Set.univ : Set ℂ) ++ have hdivH : MeromorphicOn.divisor H (Set.univ : Set ℂ) = 0 := by ++ have hdivq : MeromorphicOn.divisor q (Set.univ : Set ℂ) = 0 := ++ divisor_hadamardQuotient_eq_zero (m := m) (f := f) (hf := hf) ++ (hnot := hnot) (h_sum := h_sum) ++ simpa [H, hdivq] using ++ (MeromorphicOn.divisor_of_toMeromorphicNFOn ++ (f := q) (U := (Set.univ : Set ℂ)) hq_mero) ++ have hA : AnalyticOnNhd ℂ H (Set.univ : Set ℂ) := by ++ have : ++ (0 : Function.locallyFinsuppWithin (Set.univ : Set ℂ) ℤ) ≤ ++ MeromorphicOn.divisor H (Set.univ : Set ℂ) := by ++ simp [hdivH] ++ exact (MeromorphicNFOn.divisor_nonneg_iff_analyticOnNhd (h₁f := hNF)).1 (by simp [hdivH]) ++ have hH_entire : Differentiable ℂ H := by ++ intro z ++ exact (hA z (by simp)).differentiableAt ++ rcases hnot with ⟨z1, hz1⟩ ++ have hden1 : denom z1 ≠ 0 := ++ hadamardDenom_ne_zero_at (m := m) (f := f) hf ⟨z1, hz1⟩ h_sum hz1 ++ have hqA1 : AnalyticAt ℂ q z1 := by ++ have hdenA1 : AnalyticAt ℂ denom z1 := hden_entire.analyticAt z1 ++ exact (hf.analyticAt z1).div hdenA1 hden1 ++ have hqNF1 : MeromorphicNFAt q z1 := hqA1.meromorphicNFAt ++ have htoEq : toMeromorphicNFAt q z1 = q := (toMeromorphicNFAt_eq_self (f := q) (x := z1)).2 hqNF1 ++ have hH1 : H z1 = q z1 := by ++ have hx : z1 ∈ (Set.univ : Set ℂ) := by simp ++ have : toMeromorphicNFOn q (Set.univ : Set ℂ) z1 = toMeromorphicNFAt q z1 z1 := ++ (toMeromorphicNFOn_eq_toMeromorphicNFAt (f := q) (U := (Set.univ : Set ℂ)) hq_mero hx) ++ simpa [H, htoEq] using this ++ have hH1_ne : H z1 ≠ 0 := by ++ have : q z1 ≠ 0 := div_ne_zero hz1 hden1 ++ simpa [hH1] using this ++ have hH_not_top : ∀ z : ℂ, analyticOrderAt H z ≠ ⊤ := by ++ exact analyticOrderAt_ne_top_of_exists_ne_zero (hf := hH_entire) ⟨z1, hH1_ne⟩ ++ have hH_orderNat_zero : ∀ z : ℂ, analyticOrderNatAt H z = 0 := by ++ intro z ++ have hzdiv : ++ (MeromorphicOn.divisor H (Set.univ : Set ℂ)) z = (analyticOrderNatAt H z : ℤ) := by ++ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := H) hH_entire z) ++ have : (MeromorphicOn.divisor H (Set.univ : Set ℂ)) z = 0 := by ++ simp [hdivH] ++ have : (analyticOrderNatAt H z : ℤ) = 0 := by simpa [hzdiv] using this ++ exact_mod_cast this ++ have hH_ne : ∀ z : ℂ, H z ≠ 0 := by ++ intro z ++ have hcast : (analyticOrderNatAt H z : ℕ∞) = analyticOrderAt H z := ++ Nat.cast_analyticOrderNatAt (f := H) (z₀ := z) (hH_not_top z) ++ have : analyticOrderAt H z = 0 := by ++ have : (analyticOrderNatAt H z : ℕ∞) = 0 := by exact_mod_cast (hH_orderNat_zero z) ++ simpa [hcast] using this ++ exact ((hA z (by simp)).analyticOrderAt_eq_zero).1 this ++ have hfA : AnalyticOnNhd ℂ f (Set.univ : Set ℂ) := fun z hzU => hf.analyticAt z ++ have hdenA : AnalyticOnNhd ℂ denom (Set.univ : Set ℂ) := fun z hzU => hden_entire.analyticAt z ++ have hprodA : AnalyticOnNhd ℂ (fun z => H z * denom z) (Set.univ : Set ℂ) := ++ (hA.mul hdenA) ++ have hlocal : f =ᶠ[𝓝 z1] fun z => H z * denom z := by ++ have hden_ne : ∀ᶠ z in 𝓝 z1, denom z ≠ 0 := ++ (hden_entire.differentiableAt.continuousAt.ne_iff_eventually_ne continuousAt_const).1 hden1 ++ have hH_eq_q : H =ᶠ[𝓝 z1] q := by ++ have hx : z1 ∈ (Set.univ : Set ℂ) := by simp ++ have hloc : ++ toMeromorphicNFOn q (Set.univ : Set ℂ) =ᶠ[𝓝 z1] toMeromorphicNFAt q z1 := by ++ simpa [H] using (toMeromorphicNFOn_eq_toMeromorphicNFAt_on_nhds (f := q) ++ (U := (Set.univ : Set ℂ)) hq_mero hx) ++ simpa [H, htoEq] using hloc ++ filter_upwards [hden_ne, hH_eq_q] with z hzden hHz ++ have hcancel : q z * denom z = f z := by ++ dsimp [q] ++ field_simp [hzden] ++ calc ++ f z = q z * denom z := hcancel.symm ++ _ = H z * denom z := by simp [hHz] ++ have hglob : f = fun z => H z * denom z := ++ AnalyticOnNhd.eq_of_eventuallyEq (hf := hfA) (hg := hprodA) hlocal ++ refine ⟨H, hH_entire, hH_ne, ?_⟩ ++ intro z ++ have hglobz : f z = H z * denom z := congrArg (fun g => g z) hglob ++ simpa [denom, hadamardDenom, mul_assoc, mul_left_comm, mul_comm] using hglobz ++ ++end Complex.Hadamard ++end HadamardSourceScope16 ++ ++section HadamardSourceScope17 ++ ++open Filter _root_.Function _root_.MeromorphicOn _root_.Erdos970.MeromorphicOn Metric ++ _root_.Real _root_.Erdos970.Real Set ++ ++namespace Function.locallyFinsuppWithin ++ ++open _root_.Function.locallyFinsuppWithin ++ ++variable {E : Type*} [NormedAddCommGroup E] ++ ++lemma norm_le_abs_of_mem_toClosedBall_support {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} ++ (hz : z ∈ (toClosedBall r D).support) : ‖z‖ ≤ |r| := by ++ have hz_ball : z ∈ closedBall (0 : E) |r| := (toClosedBall r D).supportWithinDomain hz ++ simpa [mem_closedBall, dist_zero_right] using hz_ball ++ ++lemma toClosedBall_eval_eq_of_norm_le_abs {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} ++ (hz : ‖z‖ ≤ |r|) : toClosedBall r D z = D z := by ++ have hz_ball : z ∈ closedBall (0 : E) |r| := by ++ simpa [mem_closedBall, dist_zero_right] using hz ++ simpa using toClosedBall_eval_within (f := D) hz_ball ++ ++lemma mem_toClosedBall_support_of_mem_support_of_norm_le_abs ++ {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} (hzD : z ∈ D.support) (hzR : ‖z‖ ≤ |r|) : ++ z ∈ (toClosedBall r D).support := by ++ rw [Function.mem_support] ++ rw [toClosedBall_eval_eq_of_norm_le_abs hzR] ++ rwa [Function.mem_support] at hzD ++ ++lemma mem_support_of_mem_toClosedBall_support {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} ++ (hz : z ∈ (toClosedBall r D).support) : z ∈ D.support := by ++ have hnorm : ‖z‖ ≤ |r| := norm_le_abs_of_mem_toClosedBall_support hz ++ rw [Function.mem_support] at hz ⊢ ++ rw [toClosedBall_eval_eq_of_norm_le_abs hnorm] at hz ++ exact hz ++ ++noncomputable def massClosedBall₀ {E : Type*} [NormedAddCommGroup E] [ProperSpace E] ++ (D : locallyFinsupp E ℤ) (R : ℝ) : ℝ := by ++ classical ++ exact ++ (((finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).toFinset).filter ++ (fun z => z ≠ (0 : E))).sum fun z => (D z : ℝ) ++ ++end Function.locallyFinsuppWithin ++ ++namespace Function.locallyFinsuppWithin ++ ++open _root_.Function.locallyFinsuppWithin ++ ++theorem logCounting_divisor_eq_circleAverage_sub_const_of_differentiable ++ {R : ℝ} {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hR : R ≠ 0) : ++ logCounting (divisor f ⊤) R = ++ circleAverage (log ‖f ·‖) 0 R - log ‖meromorphicTrailingCoeffAt f 0‖ := by ++ have hmero : Meromorphic f := fun z => (hf.analyticAt z).meromorphicAt ++ simpa [top_eq_univ] using ++ logCounting_divisor_eq_circleAverage_sub_const (f := f) hmero hR ++ ++end Function.locallyFinsuppWithin ++end HadamardSourceScope17 ++ ++section HadamardSourceScope18 ++ ++namespace Real ++ ++open _root_.Real ++ ++theorem log_one_add_exp_le_add_log_two {x : ℝ} (hx : 0 ≤ x) : ++ log (1 + exp x) ≤ x + log 2 := by ++ have hexp_one : (1 : ℝ) ≤ exp x := by ++ simpa using (one_le_exp_iff.2 hx) ++ have hadd : 1 + exp x ≤ 2 * exp x := by linarith ++ have hlog : log (1 + exp x) ≤ log (2 * exp x) := ++ log_le_log (by positivity) hadd ++ calc ++ log (1 + exp x) ≤ log (2 * exp x) := hlog ++ _ = log 2 + x := by simp [log_mul, add_comm] ++ _ = x + log 2 := by ring ++ ++theorem log_one_add_le_add_log_two_of_le_exp {x y : ℝ} (hy : 0 ≤ y) (hx : 0 ≤ x) ++ (hxy : y ≤ exp x) : ++ log (1 + y) ≤ x + log 2 := by ++ have hpos : 0 < (1 : ℝ) + y := by linarith ++ have hle : (1 : ℝ) + y ≤ 1 + exp x := by linarith ++ exact (log_le_log hpos hle).trans (log_one_add_exp_le_add_log_two hx) ++ ++theorem le_exp_of_log_one_add_le {x y : ℝ} (hy : 0 ≤ y) (hxy : log (1 + y) ≤ x) : ++ y ≤ exp x := by ++ have hpos : 0 < (1 : ℝ) + y := by linarith ++ have hone : 1 + y ≤ exp x := (log_le_iff_le_exp hpos).1 hxy ++ linarith ++ ++theorem neg_posLog_inv_le_log (x : ℝ) : -log⁺ x⁻¹ ≤ log x := by ++ linarith [posLog_sub_posLog_inv (x := x), posLog_nonneg (x := x)] ++ ++end Real ++end HadamardSourceScope18 ++ ++section HadamardSourceScope20 ++ ++namespace Real ++ ++open _root_.Real ++ ++variable {α E : Type*} [SeminormedAddCommGroup E] ++ ++theorem log_norm_le_log_one_add_norm (w : E) : ++ Real.log ‖w‖ ≤ Real.log (1 + ‖w‖) := by ++ by_cases h0 : ‖w‖ = 0 ++ · simp [h0] ++ · have hpos : 0 < ‖w‖ := lt_of_le_of_ne (norm_nonneg w) (Ne.symm h0) ++ exact Real.log_le_log hpos (by linarith [norm_nonneg w]) ++ ++variable {F : Type*} [NormedAddCommGroup F] ++ ++theorem log_nonneg_mul_inv_norm_of_norm_le {z : F} {r : ℝ} (hz : ‖z‖ ≤ r) : ++ 0 ≤ Real.log (r * ‖z‖⁻¹) := by ++ by_cases hz0 : z = 0 ++ · simp [hz0] ++ · have hzpos : 0 < ‖z‖ := norm_pos_iff.2 hz0 ++ have : (1 : ℝ) ≤ r * ‖z‖⁻¹ := by ++ have : (1 : ℝ) ≤ r / ‖z‖ := (one_le_div hzpos).2 hz ++ simpa [div_eq_mul_inv] using this ++ exact Real.log_nonneg this ++ ++theorem log_two_le_log_two_mul_mul_inv_norm_of_norm_le {z : F} {R : ℝ} (hz0 : z ≠ 0) ++ (hz : ‖z‖ ≤ R) : ++ Real.log 2 ≤ Real.log ((2 * R) * ‖z‖⁻¹) := by ++ have hzpos : 0 < ‖z‖ := norm_pos_iff.2 hz0 ++ have hRdiv : (1 : ℝ) ≤ R / ‖z‖ := (one_le_div hzpos).2 hz ++ have hle2 : (2 : ℝ) ≤ (2 * R) * ‖z‖⁻¹ := by ++ have : (2 : ℝ) ≤ 2 * (R / ‖z‖) := by nlinarith ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using this ++ exact Real.log_le_log (by norm_num) hle2 ++ ++theorem norm_le_exp_mul_rpow_of_exponent_le ++ {f : α → E} {r : α → ℝ} {C ρ τ : ℝ} (hC : 0 ≤ C) (hr : ∀ x, 1 ≤ r x) (hρτ : ρ ≤ τ) ++ (hbound : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ ρ)) : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ) := by ++ intro x ++ refine (hbound x).trans (Real.exp_le_exp.2 ?_) ++ exact mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le (hr x) hρτ) hC ++ ++theorem norm_le_exp_mul_rpow_of_log_growth ++ {f : α → E} {r : α → ℝ} {C ρ τ : ℝ} (hC : 0 ≤ C) (hr : ∀ x, 1 ≤ r x) (hρτ : ρ ≤ τ) ++ (hlog : ∀ x, Real.log (1 + ‖f x‖) ≤ C * (r x) ^ ρ) : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ) := by ++ intro x ++ have hpow : (r x) ^ ρ ≤ (r x) ^ τ := ++ Real.rpow_le_rpow_of_exponent_le (hr x) hρτ ++ have hlogτ : Real.log (1 + ‖f x‖) ≤ C * (r x) ^ τ := ++ (hlog x).trans (mul_le_mul_of_nonneg_left hpow hC) ++ exact Real.le_exp_of_log_one_add_le (norm_nonneg (f x)) hlogτ ++ ++theorem log_growth_of_norm_le_exp_mul_rpow ++ {f : α → E} {r : α → ℝ} {C τ : ℝ} (hC : 0 < C) (hτ : 0 ≤ τ) ++ (hr : ∀ x, 1 ≤ r x) (hbound : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ)) : ++ ∃ C' > 0, ∀ x, Real.log (1 + ‖f x‖) ≤ C' * (r x) ^ τ := by ++ refine ⟨C + Real.log 2, by ++ have hlog2 : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) ++ linarith, ?_⟩ ++ intro x ++ have hX : (1 : ℝ) ≤ (r x) ^ τ := Real.one_le_rpow (hr x) hτ ++ have hB : 0 ≤ C * (r x) ^ τ := ++ mul_nonneg hC.le (Real.rpow_nonneg (le_trans zero_le_one (hr x)) _) ++ have hlog : ++ Real.log (1 + ‖f x‖) ≤ C * (r x) ^ τ + Real.log 2 := ++ Real.log_one_add_le_add_log_two_of_le_exp (norm_nonneg _) hB (hbound x) ++ have hlog2_nonneg : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) ++ nlinarith [hlog, hX, hlog2_nonneg] ++ ++theorem exists_norm_le_exp_mul_pow_of_rpow_bound ++ {f : α → E} {r : α → ℝ} {τ : ℝ} {n : ℕ} (hr : ∀ x, 1 ≤ r x) (hτn : τ < (n : ℝ)) ++ (hbound : ∃ C > 0, ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ)) : ++ ∃ C > 0, ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ n) := by ++ rcases hbound with ⟨C, hCpos, hC⟩ ++ have hweak : ++ ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ (n : ℝ)) := ++ norm_le_exp_mul_rpow_of_exponent_le ++ (f := f) (r := r) hCpos.le hr (le_of_lt hτn) hC ++ refine ⟨C, hCpos, ?_⟩ ++ intro x ++ have hpow : (r x) ^ (n : ℝ) = (r x) ^ n := Real.rpow_natCast (r x) n ++ simpa [hpow] using hweak x ++ ++theorem one_add_le_three_mul_one_add_of_le_two_mul_max {x r : ℝ} (hx : 0 ≤ x) ++ (hr : r ≤ 2 * max x 1) : 1 + r ≤ 3 * (1 + x) := by ++ have hmax : max x 1 ≤ 1 + x := max_le_iff.2 ⟨by linarith, by linarith⟩ ++ nlinarith ++ ++theorem exp_mul_rpow_le_exp_mul_rpow_of_le_mul ++ {A B x y τ : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hy : 0 ≤ y) ++ (hτ : 0 ≤ τ) (hxy : x ≤ B * y) : Real.exp (A * x ^ τ) ≤ Real.exp ((A * B ^ τ) * y ^ τ) := by ++ refine Real.exp_le_exp.2 ?_ ++ have hpow : x ^ τ ≤ (B * y) ^ τ := Real.rpow_le_rpow hx hxy hτ ++ have hsplit : (B * y) ^ τ = B ^ τ * y ^ τ := by ++ simpa using (Real.mul_rpow (x := B) (y := y) (z := τ) hB hy) ++ simpa [mul_assoc] using mul_le_mul_of_nonneg_left (hpow.trans_eq hsplit) hA ++ ++theorem exists_between_self_and_floor_add_one_same_floor {ρ : ℝ} (hρ : 0 ≤ ρ) : ++ ∃ τ : ℝ, ρ < τ ∧ τ < (Nat.floor ρ + 1 : ℝ) ∧ 0 ≤ τ ∧ Nat.floor τ = Nat.floor ρ := by ++ set m : ℕ := Nat.floor ρ ++ set τ : ℝ := (ρ + (m + 1 : ℝ)) / 2 ++ have hm : ρ < (m + 1 : ℝ) := by simpa [m] using Nat.lt_floor_add_one (a := ρ) ++ have hτ : ρ < τ := by dsimp [τ]; linarith ++ have hτ_lt : τ < (m + 1 : ℝ) := by dsimp [τ]; linarith ++ have hτ_nonneg : 0 ≤ τ := le_trans hρ (le_of_lt hτ) ++ have hfloorτ : Nat.floor τ = m := by ++ have hm_le_τ : (m : ℝ) ≤ τ := le_trans (Nat.floor_le hρ) (le_of_lt hτ) ++ have hτ_lt_m1 : τ < (m : ℝ) + 1 := by simpa [add_assoc, add_comm, add_left_comm] using hτ_lt ++ exact (Nat.floor_eq_iff hτ_nonneg).2 ⟨hm_le_τ, hτ_lt_m1⟩ ++ exact ⟨τ, hτ, by simpa [m] using hτ_lt, hτ_nonneg, by simpa [m] using hfloorτ⟩ ++ ++open Metric _root_.Complex _root_.Erdos970.Complex ++ ++theorem log_norm_le_of_log_one_add_growth_on_sphere {f : ℂ → ℂ} {C ρ R : ℝ} ++ (hC : ∀ z : ℂ, _root_.Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {z : ℂ} ++ (hz : z ∈ sphere (0 : ℂ) |R|) : _root_.Real.log ‖f z‖ ≤ C * (1 + |R|) ^ ρ := by ++ have hz_norm : ‖z‖ = |R| := by ++ simpa [mem_sphere, dist_zero_right] using hz ++ simpa [hz_norm] using le_trans (log_norm_le_log_one_add_norm (f z)) (hC z) ++ ++end Real ++end HadamardSourceScope20 ++ ++section HadamardSourceScope21 ++ ++open Filter _root_.Function _root_.Erdos970.Function _root_.MeromorphicOn ++ _root_.Erdos970.MeromorphicOn Metric _root_.Real _root_.Erdos970.Real Set ++ ++namespace Function.locallyFinsuppWithin ++ ++open _root_.Function.locallyFinsuppWithin ++ ++theorem logCounting_divisor_le_of_log_growth {f : ℂ → ℂ} {ρ C : ℝ} (hf : Differentiable ℂ f) ++ (hC : ∀ z : ℂ, log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {R : ℝ} (hR0 : 0 < R) : ++ logCounting (divisor f (Set.univ : Set ℂ)) R ++ ≤ C * (1 + |R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ have hR : R ≠ 0 := ne_of_gt hR0 ++ have hEq := ++ logCounting_divisor_eq_circleAverage_sub_const_of_differentiable (f := f) hf hR ++ have hf_sphere : MeromorphicOn f (sphere (0 : ℂ) |R|) := by ++ intro z hz ++ exact (hf.analyticAt z).meromorphicAt ++ have hInt : CircleIntegrable (fun z : ℂ => log ‖f z‖) 0 R := ++ MeromorphicOn.circleIntegrable_log_norm hf_sphere ++ have hbound_circle : ∀ z ∈ sphere (0 : ℂ) |R|, ++ log ‖f z‖ ≤ C * (1 + |R|) ^ ρ := by ++ intro z hz ++ exact log_norm_le_of_log_one_add_growth_on_sphere hC hz ++ have hCircleAvg_le : ++ circleAverage (fun z : ℂ => log ‖f z‖) 0 R ≤ C * (1 + |R|) ^ ρ := ++ circleAverage_mono_on_of_le_circle (c := (0 : ℂ)) (R := R) ++ (f := fun z => log ‖f z‖) hInt hbound_circle ++ calc ++ logCounting (divisor f (Set.univ : Set ℂ)) R ++ = circleAverage (fun z : ℂ => log ‖f z‖) 0 R ++ - log ‖meromorphicTrailingCoeffAt f 0‖ := by ++ simpa [top_eq_univ] using hEq ++ _ ≤ circleAverage (fun z : ℂ => log ‖f z‖) 0 R ++ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ have : ++ -log ‖meromorphicTrailingCoeffAt f 0‖ ++ ≤ |log ‖meromorphicTrailingCoeffAt f 0‖| := ++ neg_le_abs (log ‖meromorphicTrailingCoeffAt f 0‖) ++ linarith ++ _ ≤ C * (1 + |R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ nlinarith [hCircleAvg_le] ++ ++variable {E : Type*} [NormedAddCommGroup E] [ProperSpace E] ++ ++theorem log_two_mul_massClosedBall₀_le_logCounting {D : locallyFinsupp E ℤ} (hDnonneg : 0 ≤ D) ++ {R : ℝ} (hR : 1 ≤ R) : ++ (log 2) * massClosedBall₀ D R ≤ logCounting D (2 * R) := by ++ classical ++ have hR0 : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR ++ set r : ℝ := 2 * R ++ have hrpos : 0 < r := by dsimp [r]; nlinarith ++ let Dr := toClosedBall r D ++ have hDr_fin : Set.Finite Dr.support := Dr.finiteSupport (isCompact_closedBall (0 : E) |r|) ++ let F : Finset E := hDr_fin.toFinset ++ let SR : Finset E := ++ (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).toFinset ++ let S : Finset E := SR.filter fun z => z ≠ (0 : E) ++ have hS_sub : S ⊆ F := by ++ intro z hzS ++ have hz_mem_SR : z ∈ SR := (Finset.mem_filter.1 hzS).1 ++ have hzR : z ∈ (toClosedBall R D).support := by ++ exact (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).mem_toFinset.1 ++ hz_mem_SR ++ have hz_norm_le_R : ‖z‖ ≤ R := by ++ have := norm_le_abs_of_mem_toClosedBall_support hzR ++ simpa [abs_of_pos hR0] using this ++ have hz_norm_le_r : ‖z‖ ≤ |r| := by ++ have : ‖z‖ ≤ r := le_trans hz_norm_le_R (by dsimp [r]; nlinarith) ++ simpa [abs_of_pos hrpos] using this ++ have hzD : z ∈ D.support := mem_support_of_mem_toClosedBall_support hzR ++ have : z ∈ Dr.support := by ++ simpa [Dr] using ++ mem_toClosedBall_support_of_mem_support_of_norm_le_abs (D := D) (r := r) hzD hz_norm_le_r ++ exact hDr_fin.mem_toFinset.2 this ++ have hlogCounting : ++ logCounting D r ++ = (F.sum fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) + (D 0 : ℝ) * log r := by ++ have hsupp : Function.support (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) ⊆ F := by ++ intro z hz ++ have : Dr z ≠ 0 := by ++ by_contra h0 ++ simp [Function.mem_support, h0] at hz ++ have : z ∈ Dr.support := by simpa [Function.mem_support] using this ++ exact hDr_fin.mem_toFinset.2 this ++ simp [logCounting, Dr, r, ++ finsum_eq_sum_of_support_subset (f := fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) (s := F) hsupp] ++ have hsum_le : ++ (log 2) * (S.sum fun z => (D z : ℝ)) ++ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := by ++ have hterm_nonneg : ∀ z ∈ F, 0 ≤ (Dr z : ℝ) * log (r * ‖z‖⁻¹) := by ++ intro z hzF ++ have hz_sup : z ∈ Dr.support := hDr_fin.mem_toFinset.1 hzF ++ have hDz : 0 ≤ Dr z := by ++ have hDz' : 0 ≤ D z := hDnonneg z ++ have hDrz : Dr z = D z := ++ toClosedBall_eval_eq_of_norm_le_abs (norm_le_abs_of_mem_toClosedBall_support hz_sup) ++ simpa [hDrz] using hDz' ++ have hlog : 0 ≤ log (r * ‖z‖⁻¹) := by ++ have hzle : ‖z‖ ≤ r := by ++ have hnorm := norm_le_abs_of_mem_toClosedBall_support hz_sup ++ simpa [abs_of_pos hrpos] using hnorm ++ exact log_nonneg_mul_inv_norm_of_norm_le hzle ++ exact mul_nonneg (by exact_mod_cast hDz) hlog ++ have hsumSF : ++ S.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) ++ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := ++ Finset.sum_le_sum_of_subset_of_nonneg hS_sub (by ++ intro z hzF _; exact hterm_nonneg z hzF) ++ have hterm_ge : ∀ z ∈ S, (log 2) * (D z : ℝ) ≤ (Dr z : ℝ) * log (r * ‖z‖⁻¹) := by ++ intro z hzS ++ have hz0 : z ≠ (0 : E) := (Finset.mem_filter.1 hzS).2 ++ have hz_norm_le_R : ‖z‖ ≤ R := by ++ have hz_mem_SR : z ∈ SR := (Finset.mem_filter.1 hzS).1 ++ have hzRsup : z ∈ (toClosedBall R D).support := by ++ exact (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).mem_toFinset.1 ++ hz_mem_SR ++ have hnorm := norm_le_abs_of_mem_toClosedBall_support hzRsup ++ simpa [abs_of_pos hR0] using hnorm ++ have hlog_le : log 2 ≤ log (r * ‖z‖⁻¹) := by ++ simpa [r] using log_two_le_log_two_mul_mul_inv_norm_of_norm_le hz0 hz_norm_le_R ++ have hDz_nonneg : 0 ≤ D z := hDnonneg z ++ have hz_in_ballr : z ∈ closedBall (0 : E) |r| := by ++ have : ‖z‖ ≤ r := le_trans hz_norm_le_R (by dsimp [r]; nlinarith) ++ simpa [mem_closedBall, dist_zero_right, abs_of_pos hrpos] using this ++ have hDrz : Dr z = D z := by ++ have hz_norm_le : ‖z‖ ≤ |r| := by ++ simpa [mem_closedBall, dist_zero_right] using hz_in_ballr ++ simpa [Dr] using toClosedBall_eval_eq_of_norm_le_abs (D := D) (r := r) (z := z) hz_norm_le ++ have : (log 2) * (D z : ℝ) ≤ (log (r * ‖z‖⁻¹)) * (D z : ℝ) := ++ mul_le_mul_of_nonneg_right hlog_le (by exact_mod_cast hDz_nonneg) ++ simpa [hDrz, mul_assoc, mul_left_comm, mul_comm] using this ++ calc ++ (log 2) * (S.sum fun z => (D z : ℝ)) ++ = S.sum (fun z => (log 2) * (D z : ℝ)) := by simp [Finset.mul_sum] ++ _ ≤ S.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := ++ Finset.sum_le_sum fun z hz => hterm_ge z hz ++ _ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := hsumSF ++ have hcenter_nonneg : 0 ≤ (D 0 : ℝ) * log r := by ++ have hD0 : 0 ≤ D 0 := hDnonneg 0 ++ have hlogr : 0 ≤ log r := log_nonneg (by nlinarith [hR]) ++ exact mul_nonneg (by exact_mod_cast hD0) hlogr ++ have : (log 2) * (S.sum fun z => (D z : ℝ)) ≤ logCounting D r := by ++ rw [hlogCounting] ++ nlinarith [hsum_le, hcenter_nonneg] ++ simpa [massClosedBall₀, r, S, SR] using this ++ ++theorem massClosedBall₀_divisor_le_of_log_growth {f : ℂ → ℂ} {ρ C : ℝ} ++ (hf : Differentiable ℂ f) ++ (hC : ∀ z : ℂ, log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {R : ℝ} (hR : 1 ≤ R) : ++ massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R ++ ≤ (C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖|) / log 2 := by ++ have hR0 : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR ++ have hlog2pos : 0 < log 2 := log_pos (by norm_num : (1 : ℝ) < 2) ++ have hlow : ++ (log 2) * massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R ++ ≤ logCounting (divisor f (Set.univ : Set ℂ)) (2 * R) := ++ log_two_mul_massClosedBall₀_le_logCounting ++ (D := divisor f (Set.univ : Set ℂ)) ++ (MeromorphicOn.AnalyticOnNhd.divisor_nonneg ++ (hf.differentiableOn.analyticOnNhd isOpen_univ)) hR ++ have hupp : ++ logCounting (divisor f (Set.univ : Set ℂ)) (2 * R) ++ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ have h2R0 : 0 < 2 * R := by nlinarith [hR0] ++ simpa using logCounting_divisor_le_of_log_growth (f := f) (ρ := ρ) (C := C) hf hC ++ (R := 2 * R) h2R0 ++ have hmul : ++ (log 2) * massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R ++ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := ++ hlow.trans hupp ++ have hmul' : ++ massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R * log 2 ++ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using hmul ++ exact (le_div_iff₀ hlog2pos).2 hmul' ++ ++end Function.locallyFinsuppWithin ++end HadamardSourceScope21 ++ ++section HadamardSourceScope22 ++ ++open Set ++ ++variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] ++ ++theorem Differentiable.divisor_nonneg {f : ℂ → E} (hf : Differentiable ℂ f) : ++ 0 ≤ MeromorphicOn.divisor f (univ : Set ℂ) := ++ MeromorphicOn.AnalyticOnNhd.divisor_nonneg (hf.differentiableOn.analyticOnNhd isOpen_univ) ++end HadamardSourceScope22 ++ ++section HadamardSourceScope23 ++ ++noncomputable section ++ ++open scoped BigOperators ++open Filter ++ ++namespace Real ++ ++open _root_.Real ++ ++lemma two_pow_floor_logb_le {x : ℝ} (hx : 1 ≤ x) : ++ (2 : ℝ) ^ (⌊Real.logb 2 x⌋₊ : ℝ) ≤ x := by ++ have hx0 : 0 < x := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hx ++ have hlog_nonneg : 0 ≤ Real.logb 2 x := ++ Real.logb_nonneg (b := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) hx ++ have hfloor_le : (⌊Real.logb 2 x⌋₊ : ℝ) ≤ Real.logb 2 x := by ++ simpa using (Nat.floor_le hlog_nonneg) ++ exact (Real.le_logb_iff_rpow_le (b := (2 : ℝ)) ++ (x := (⌊Real.logb 2 x⌋₊ : ℝ)) (y := x) ++ (by norm_num : (1 : ℝ) < 2) hx0).1 hfloor_le ++ ++lemma lt_two_pow_floor_logb_add_one {x : ℝ} (hx : 1 ≤ x) : ++ x < (2 : ℝ) ^ ((⌊Real.logb 2 x⌋₊ : ℝ) + 1) := by ++ have hx0 : 0 < x := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hx ++ have hlt : Real.logb 2 x < (⌊Real.logb 2 x⌋₊ : ℝ) + 1 := by ++ simpa using (Nat.lt_floor_add_one (Real.logb 2 x)) ++ exact (Real.logb_lt_iff_lt_rpow (b := (2 : ℝ)) (x := x) ++ (y := (⌊Real.logb 2 x⌋₊ : ℝ) + 1) ++ (by norm_num : (1 : ℝ) < 2) hx0).1 hlt ++ ++lemma dyadicShell_lower_bound {r0 x : ℝ} {k : ℕ} (hr0 : 0 < r0) (hx : r0 ≤ x) ++ (hk : ⌊Real.logb 2 (x / r0)⌋₊ = k) : ++ r0 * (2 : ℝ) ^ (k : ℝ) ≤ x := by ++ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 ++ have hx1 : (1 : ℝ) ≤ x / r0 := by ++ have : r0 / r0 ≤ x / r0 := div_le_div_of_nonneg_right hx hr0.le ++ simpa [hr0ne] using this ++ have hle : (2 : ℝ) ^ (k : ℝ) ≤ x / r0 := by ++ have := Real.two_pow_floor_logb_le (x := x / r0) hx1 ++ simpa [hk] using this ++ have := mul_le_mul_of_nonneg_left hle hr0.le ++ have hxEq : r0 * (x / r0) = x := by ++ field_simp [hr0ne] ++ simpa [mul_assoc, hxEq] using this ++ ++lemma dyadicShell_upper_bound {r0 x : ℝ} {k : ℕ} (hr0 : 0 < r0) (hx : r0 ≤ x) ++ (hk : ⌊Real.logb 2 (x / r0)⌋₊ = k) : ++ x ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1) := by ++ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 ++ have hx1 : (1 : ℝ) ≤ x / r0 := by ++ have : r0 / r0 ≤ x / r0 := div_le_div_of_nonneg_right hx hr0.le ++ simpa [hr0ne] using this ++ have hlt : x / r0 < (2 : ℝ) ^ ((k : ℝ) + 1) := by ++ have := Real.lt_two_pow_floor_logb_add_one (x := x / r0) hx1 ++ simpa [hk] using this ++ have := mul_lt_mul_of_pos_left hlt hr0 ++ have hxEq : r0 * (x / r0) = x := by ++ field_simp [hr0ne] ++ exact le_of_lt (by simpa [mul_assoc, hxEq] using this) ++ ++lemma exists_nat_le_two_pow (A : ℝ) : ++ ∃ k0 : ℕ, ∀ n ≥ k0, A ≤ (2 : ℝ) ^ n := by ++ have htend : Tendsto (fun n : ℕ => (2 : ℝ) ^ n) atTop atTop := ++ tendsto_pow_atTop_atTop_of_one_lt (r := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) ++ exact eventually_atTop.1 ((tendsto_atTop.1 htend) A) ++ ++lemma one_le_dyadicRadius_succ_of_inv_le_two_pow ++ {r0 : ℝ} {k0 kk : ℕ} (hr0 : 0 < r0) ++ (hk0 : ∀ n ≥ k0, (1 / r0 : ℝ) ≤ (2 : ℝ) ^ n) (hkk : k0 ≤ kk + 1) : ++ (1 : ℝ) ≤ r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) := by ++ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 ++ have hpow_nat : (1 / r0 : ℝ) ≤ (2 : ℝ) ^ (kk + 1) := hk0 (kk + 1) hkk ++ have hpow_rpow : (1 / r0 : ℝ) ≤ (2 : ℝ) ^ ((kk : ℝ) + 1) := by ++ have hcast : (2 : ℝ) ^ ((kk : ℝ) + 1) = (2 : ℝ) ^ (kk + 1) := by ++ calc ++ (2 : ℝ) ^ ((kk : ℝ) + 1) = (2 : ℝ) ^ ((kk + 1 : ℕ) : ℝ) := by ++ simp [Nat.cast_add, Nat.cast_one] ++ _ = (2 : ℝ) ^ (kk + 1) := by ++ simpa using (Real.rpow_natCast (2 : ℝ) (kk + 1)) ++ simpa [hcast] using hpow_nat ++ have : (r0 * (1 / r0) : ℝ) ≤ r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) := ++ mul_le_mul_of_nonneg_left hpow_rpow hr0.le ++ simpa [one_div, hr0ne, mul_assoc] using this ++ ++lemma one_add_abs_two_mul_dyadicRadius_rpow_le {r0 ρ : ℝ} (k : ℕ) ++ (hr0 : 0 < r0) (hρ : 0 ≤ ρ) : ++ (1 + |2 * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1))|) ^ ρ ++ ≤ (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by ++ let Rk : ℝ := r0 * (2 : ℝ) ^ ((k : ℝ) + 1) ++ have hRk' : |2 * Rk| = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by ++ have hnonneg : 0 ≤ (2 : ℝ) * Rk := by ++ have : 0 ≤ Rk := by ++ dsimp [Rk] ++ exact mul_nonneg hr0.le (le_of_lt (Real.rpow_pos_of_pos (by norm_num) _)) ++ nlinarith ++ have hmul : (2 : ℝ) * Rk = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by ++ dsimp [Rk] ++ calc ++ (2 : ℝ) * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) ++ = (2 * r0) * (2 : ℝ) ^ ((k : ℝ) + 1) := by ring ++ _ = (2 * r0) * ((2 : ℝ) ^ (k : ℝ) * (2 : ℝ) ^ (1 : ℝ)) := by ++ simp [Real.rpow_add, mul_assoc] ++ _ = (2 * r0) * ((2 : ℝ) ^ (k : ℝ) * 2) := by simp [Real.rpow_one] ++ _ = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by ring ++ calc ++ |2 * Rk| = 2 * Rk := abs_of_nonneg hnonneg ++ _ = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := hmul ++ have hbase : ++ (1 + |2 * Rk|) ≤ (1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ) := by ++ have h1 : (1 : ℝ) ≤ (2 : ℝ) ^ (k : ℝ) := by ++ have : (1 : ℝ) ≤ (2 : ℝ) ^ (k : ℕ) := by ++ simpa using (one_le_pow₀ (by norm_num : (1 : ℝ) ≤ (2 : ℝ))) ++ simpa [Real.rpow_natCast] using this ++ have habs : ++ 1 + |2 * Rk| ≤ (2 : ℝ) ^ (k : ℝ) + (4 * r0) * (2 : ℝ) ^ (k : ℝ) := by ++ rw [hRk'] ++ simpa [add_assoc, add_left_comm, add_comm, mul_assoc, mul_left_comm, mul_comm] using ++ (add_le_add_right h1 ((4 * r0) * (2 : ℝ) ^ (k : ℝ))) ++ have hfac : ++ (2 : ℝ) ^ (k : ℝ) + (4 * r0) * (2 : ℝ) ^ (k : ℝ) ++ = (1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ) := by ++ ring ++ exact habs.trans (le_of_eq hfac) ++ have hRnonneg : 0 ≤ (1 + |2 * Rk|) := by linarith [abs_nonneg (2 * Rk)] ++ have : ++ (1 + |2 * Rk|) ^ ρ ≤ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ := ++ Real.rpow_le_rpow hRnonneg hbase hρ ++ have hsplit : ++ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ ++ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ (k : ℝ)) ^ ρ := by ++ have h1 : 0 ≤ (1 + 4 * r0) := by nlinarith [hr0.le] ++ have h2 : 0 ≤ (2 : ℝ) ^ (k : ℝ) := ++ le_of_lt (Real.rpow_pos_of_pos (by norm_num) _) ++ simpa using (Real.mul_rpow h1 h2 (z := ρ)) ++ have hpow : ((2 : ℝ) ^ (k : ℝ)) ^ ρ = ((2 : ℝ) ^ ρ) ^ k := by ++ have h2nonneg : (0 : ℝ) ≤ 2 := by norm_num ++ calc ++ ((2 : ℝ) ^ (k : ℝ)) ^ ρ = (2 : ℝ) ^ ((k : ℝ) * ρ) := by ++ simp [Real.rpow_mul] ++ _ = ((2 : ℝ) ^ ρ) ^ (k : ℝ) := by ++ simpa [mul_comm] using ++ (Real.rpow_mul (x := (2 : ℝ)) (y := ρ) (z := (k : ℝ)) h2nonneg) ++ _ = ((2 : ℝ) ^ ρ) ^ k := by ++ simp [Real.rpow_natCast] ++ calc ++ (1 + |2 * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1))|) ^ ρ ++ = (1 + |2 * Rk|) ^ ρ := by rfl ++ _ ≤ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ := this ++ _ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ (k : ℝ)) ^ ρ := hsplit ++ _ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by ++ simpa [mul_assoc] using congrArg (fun t => (1 + 4 * r0) ^ ρ * t) hpow ++ ++lemma tsum_inv_rpow_le_card_mul_of_lower_bound {α : Type*} [Fintype α] {a : α → ℝ} ++ {R τ : ℝ} (hR : 0 < R) (hτ : 0 < τ) (ha_nonneg : ∀ x, 0 ≤ a x) ++ (ha_lower : ∀ x, R ≤ a x) : ++ (∑' x : α, (a x)⁻¹ ^ τ) ≤ (Fintype.card α : ℝ) * (R⁻¹ ^ τ) := by ++ have hsum_le : ++ (∑ x : α, (a x)⁻¹ ^ τ) ≤ ∑ _x : α, R⁻¹ ^ τ := by ++ refine Finset.sum_le_sum ?_ ++ intro x _hx ++ have hinv : (a x)⁻¹ ≤ R⁻¹ := by ++ simpa using (inv_anti₀ hR (ha_lower x)) ++ exact Real.rpow_le_rpow (inv_nonneg.2 (ha_nonneg x)) hinv hτ.le ++ simpa [tsum_fintype, Finset.sum_const, nsmul_eq_mul, mul_comm] using hsum_le ++ ++lemma inv_dyadicRadius_rpow_eq (r0 τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : ++ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = ++ (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by ++ have h2k_nonneg : 0 ≤ (2 : ℝ) ^ (k : ℝ) := ++ le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) ++ calc ++ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = ++ (r0 * (2 : ℝ) ^ (k : ℝ)) ^ (-τ) := by ++ simpa using (Real.rpow_neg_eq_inv_rpow (r0 * (2 : ℝ) ^ (k : ℝ)) τ).symm ++ _ = r0 ^ (-τ) * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) := by ++ simpa using (Real.mul_rpow hr0 h2k_nonneg (z := -τ)) ++ _ = (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by ++ have hr0' : r0 ^ (-τ) = (r0⁻¹ : ℝ) ^ τ := by ++ simp [Real.rpow_neg_eq_inv_rpow] ++ have h2' : ((2 : ℝ) ^ (k : ℝ)) ^ (-τ) = ((2 : ℝ) ^ (-τ)) ^ k := by ++ have h2nonneg : (0 : ℝ) ≤ (2 : ℝ) := by norm_num ++ calc ++ ((2 : ℝ) ^ (k : ℝ)) ^ (-τ) = (2 : ℝ) ^ ((k : ℝ) * (-τ)) := by ++ exact (Real.rpow_mul (x := (2 : ℝ)) (y := (k : ℝ)) (z := -τ) ++ h2nonneg).symm ++ _ = (2 : ℝ) ^ ((-τ) * (k : ℝ)) := by ring_nf ++ _ = ((2 : ℝ) ^ (-τ)) ^ (k : ℝ) := by ++ exact Real.rpow_mul (x := (2 : ℝ)) (y := -τ) (z := (k : ℝ)) h2nonneg ++ _ = ((2 : ℝ) ^ (-τ)) ^ k := by ++ simp [Real.rpow_natCast] ++ calc ++ r0 ^ (-τ) * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) ++ = (r0⁻¹ : ℝ) ^ τ * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) := by ++ rw [hr0'] ++ _ = (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by ++ rw [h2'] ++ ++lemma two_rpow_sub_eq_mul_neg (ρ τ : ℝ) : ++ (2 : ℝ) ^ (ρ - τ) = (2 : ℝ) ^ ρ * (2 : ℝ) ^ (-τ) := by ++ have h2pos : (0 : ℝ) < (2 : ℝ) := by norm_num ++ calc ++ (2 : ℝ) ^ (ρ - τ) = (2 : ℝ) ^ (ρ + (-τ)) := by ring_nf ++ _ = (2 : ℝ) ^ ρ * (2 : ℝ) ^ (-τ) := by ++ simp [Real.rpow_add h2pos] ++ ++lemma two_rpow_sub_pow_eq_mul_pow (ρ τ : ℝ) (k : ℕ) : ++ ((2 : ℝ) ^ (ρ - τ)) ^ k = ++ ((2 : ℝ) ^ ρ) ^ k * (((2 : ℝ) ^ (-τ)) ^ k) := by ++ simp [two_rpow_sub_eq_mul_neg, mul_pow] ++ ++lemma dyadic_growth_inv_term_eq (C L M r0 ρ τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : ++ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * ++ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ = (((C / L) * M) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (ρ - τ)) ^ k := by ++ have hrk_inv : ++ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = ++ (r0⁻¹ : ℝ) ^ τ * (((2 : ℝ) ^ (-τ)) ^ k) := ++ inv_dyadicRadius_rpow_eq r0 τ k hr0 ++ rw [hrk_inv, two_rpow_sub_pow_eq_mul_pow] ++ ac_rfl ++ ++lemma dyadic_trailing_inv_term_le (C L r0 τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : ++ (C / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ ≤ (((C / L) + 1) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (-τ)) ^ k := by ++ rw [inv_dyadicRadius_rpow_eq r0 τ k hr0] ++ have hcoeff : C / L ≤ C / L + 1 := by linarith ++ have hr0Inv_nonneg : 0 ≤ (r0⁻¹ : ℝ) ^ τ := ++ Real.rpow_nonneg (inv_nonneg.2 hr0) _ ++ have hmul : ++ (C / L) * ((r0⁻¹ : ℝ) ^ τ) ++ ≤ ((C / L) + 1) * ((r0⁻¹ : ℝ) ^ τ) := ++ mul_le_mul_of_nonneg_right hcoeff hr0Inv_nonneg ++ have hqpow_nonneg : 0 ≤ ((2 : ℝ) ^ (-τ)) ^ k := ++ pow_nonneg (le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _)) _ ++ have := mul_le_mul_of_nonneg_right hmul hqpow_nonneg ++ simpa [mul_assoc, mul_left_comm, mul_comm] using this ++ ++lemma dyadic_growth_mass_mul_inv_le_geometric {C L M X T Ctrail r0 ρ τ : ℝ} {k : ℕ} ++ (hL : 0 < L) (hC : 0 ≤ C) (hr0 : 0 ≤ r0) ++ (hX : X ≤ M * ((2 : ℝ) ^ ρ) ^ k) ++ (hT : T ≤ ((C * X + Ctrail) / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) : ++ T ≤ (((C / L) * M) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (ρ - τ)) ^ k ++ + (((Ctrail / L) + 1) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (-τ)) ^ k := by ++ have hmul : C * X ≤ C * (M * ((2 : ℝ) ^ ρ) ^ k) := ++ mul_le_mul_of_nonneg_left hX hC ++ have hnum : C * X + Ctrail ≤ C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail := ++ add_le_add hmul le_rfl ++ have hdiv : ++ (C * X + Ctrail) / L ≤ (C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L := ++ div_le_div_of_nonneg_right hnum hL.le ++ have h2k_nonneg : 0 ≤ (2 : ℝ) ^ (k : ℝ) := ++ le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) (k : ℝ)) ++ have hrk_nonneg : 0 ≤ r0 * (2 : ℝ) ^ (k : ℝ) := ++ mul_nonneg hr0 h2k_nonneg ++ have hfactor_nonneg : 0 ≤ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) := ++ Real.rpow_nonneg (inv_nonneg.2 hrk_nonneg) τ ++ have hmul' := ++ mul_le_mul_of_nonneg_right hdiv hfactor_nonneg ++ have hdecomp : ++ ((C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L) * ++ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ = ++ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * ++ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ + ((Ctrail / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) := by ++ let Y : ℝ := (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ ++ have : ++ ((C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L) * Y ++ = ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * Y ++ + ((Ctrail / L) * Y) := by ++ ring ++ simpa [Y] ++ have hpre : ++ T ≤ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * ++ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ + ((Ctrail / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) := ++ hT.trans (hmul'.trans_eq hdecomp) ++ have hA := le_of_eq (dyadic_growth_inv_term_eq C L M r0 ρ τ k hr0) ++ have hB := dyadic_trailing_inv_term_le Ctrail L r0 τ k hr0 ++ exact hpre.trans (by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using add_le_add hA hB) ++ ++lemma two_geometric_shift_add (A B q qσ : ℝ) (k k0 : ℕ) : ++ A * q ^ (k + k0) + B * qσ ^ (k + k0) ++ = (A * q ^ k0) * q ^ k + (B * qσ ^ k0) * qσ ^ k := by ++ rw [pow_add, pow_add] ++ ac_rfl ++ ++end Real ++end ++end HadamardSourceScope23 ++ ++section HadamardSourceScope24 ++ ++noncomputable section ++ ++open Filter Topology Set _root_.Complex _root_.Erdos970.Complex ++open scoped BigOperators Topology ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++open scoped _root_.Real ++ ++noncomputable def divisorMassClosedBall₀ (f : ℂ → ℂ) (R : ℝ) : ℝ := ++ Function.locallyFinsuppWithin.massClosedBall₀ (MeromorphicOn.divisor f (Set.univ : Set ℂ)) R ++ ++lemma divisorMassClosedBall₀_le_of_growth {f : ℂ → ℂ} {ρ C : ℝ} ++ (hf : Differentiable ℂ f) ++ (hC : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) ++ {R : ℝ} (hR : 1 ≤ R) : ++ divisorMassClosedBall₀ f R ++ ≤ (C * (1 + |2 * R|) ^ ρ + |Real.log ‖meromorphicTrailingCoeffAt f 0‖|) / ++ Real.log 2 := by ++ simpa [divisorMassClosedBall₀] using ++ (Function.locallyFinsuppWithin.massClosedBall₀_divisor_le_of_log_growth ++ (f := f) (ρ := ρ) (C := C) hf hC hR) ++ ++lemma exists_r0_le_norm_divisorZeroIndex₀Val {f : ℂ → ℂ} ++ (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) : ++ ∃ r0 : ℝ, 0 < r0 ∧ ++ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖ := by ++ classical ++ set U : Set ℂ := (Set.univ : Set ℂ) ++ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U ++ have hDnonneg : 0 ≤ D := by ++ simpa [D, U] using (Differentiable.divisor_nonneg (f := f) hf) ++ have hzero : ∀ p : divisorZeroIndex₀ f U, f (divisorZeroIndex₀Val p) = 0 := by ++ intro p ++ set z : ℂ := divisorZeroIndex₀Val p ++ have hneTop : meromorphicOrderAt f z ≠ ⊤ := by ++ have hzAnal : AnalyticAt ℂ f z := hf.analyticAt z ++ have hzA : analyticOrderAt f z ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) (hf := hf) hnot (z := z) ++ intro htop ++ have hm : meromorphicOrderAt f z = (analyticOrderAt f z).map (↑) := ++ hzAnal.meromorphicOrderAt_eq (𝕜 := ℂ) ++ cases h : analyticOrderAt f z with ++ | top => ++ exact hzA (by simp [h]) ++ | coe n => ++ have : (analyticOrderAt f z).map (↑) ≠ (⊤ : WithTop ℤ) := by ++ simp [h] ++ exact this (by simpa [hm] using htop) ++ have hmon : MeromorphicOn f U := by ++ intro w hw; exact (hf.analyticAt w).meromorphicAt ++ have hdiv : MeromorphicOn.divisor f U z = (meromorphicOrderAt f z).untop₀ := by ++ simpa [U] using (MeromorphicOn.divisor_apply (f := f) (U := U) (z := z) hmon (by aesop)) ++ have hDz : MeromorphicOn.divisor f U z ≠ 0 := by ++ have hzsup : z ∈ (MeromorphicOn.divisor f U).support := by ++ simp [z] ++ simpa [Function.mem_support] using hzsup ++ have hposZ : (0 : ℤ) < (meromorphicOrderAt f z).untop₀ := by ++ have hge0 : 0 ≤ (meromorphicOrderAt f z).untop₀ := by ++ have : 0 ≤ MeromorphicOn.divisor f U z := by ++ simpa [D, U, z] using hDnonneg z ++ simpa [hdiv] using this ++ have hne0 : (meromorphicOrderAt f z).untop₀ ≠ 0 := by ++ simpa [hdiv] using hDz ++ exact lt_of_le_of_ne hge0 (by simpa [eq_comm] using hne0) ++ have hpos : (0 : WithTop ℤ) < meromorphicOrderAt f z := by ++ have : (0 : WithTop ℤ) < ((meromorphicOrderAt f z).untop₀ : WithTop ℤ) := ++ WithTop.coe_lt_coe.2 hposZ ++ simpa [WithTop.coe_untop₀_of_ne_top hneTop] using this ++ have htend0 : Tendsto f (𝓝[≠] z) (𝓝 (0 : ℂ)) := ++ tendsto_zero_of_meromorphicOrderAt_pos (f := f) (x := z) hpos ++ have hcontz : ContinuousAt f z := (hf z).continuousAt ++ have htendz : Tendsto f (𝓝[≠] z) (𝓝 (f z)) := ++ (hcontz.tendsto.mono_left (nhdsWithin_le_nhds : 𝓝[≠] z ≤ 𝓝 z)) ++ exact tendsto_nhds_unique htendz htend0 ++ by_cases h0 : f 0 = 0 ++ · have hD0 : D 0 ≠ 0 := by ++ have hmero0 : MeromorphicAt f (0 : ℂ) := (hf.analyticAt 0).meromorphicAt ++ have hneTop0 : meromorphicOrderAt f (0 : ℂ) ≠ ⊤ := by ++ have hA0 : analyticOrderAt f (0 : ℂ) ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) (hf := hf) hnot (z := 0) ++ intro htop ++ have hm : meromorphicOrderAt f (0 : ℂ) = (analyticOrderAt f (0 : ℂ)).map (↑) := ++ (hf.analyticAt 0).meromorphicOrderAt_eq (𝕜 := ℂ) ++ cases h : analyticOrderAt f (0 : ℂ) with ++ | top => exact (hA0 h).elim ++ | coe n => ++ have : (analyticOrderAt f (0 : ℂ)).map (↑) ≠ (⊤ : WithTop ℤ) := by ++ simp [h] ++ exact this (by simpa [hm] using htop) ++ have htend0 : Tendsto f (𝓝[≠] (0 : ℂ)) (𝓝 (0 : ℂ)) := by ++ have hcont0 : ContinuousAt f (0 : ℂ) := (hf 0).continuousAt ++ have : Tendsto f (𝓝 (0 : ℂ)) (𝓝 (0 : ℂ)) := by simpa [h0] using hcont0.tendsto ++ exact this.mono_left (nhdsWithin_le_nhds : 𝓝[≠] (0 : ℂ) ≤ 𝓝 (0 : ℂ)) ++ have hpos0 : (0 : WithTop ℤ) < meromorphicOrderAt f (0 : ℂ) := ++ (tendsto_zero_iff_meromorphicOrderAt_pos hmero0).1 htend0 ++ have hpos0' : (0 : ℤ) < (meromorphicOrderAt f (0 : ℂ)).untop₀ := by ++ have : (0 : WithTop ℤ) < ((meromorphicOrderAt f (0 : ℂ)).untop₀ : WithTop ℤ) := by ++ simpa [WithTop.coe_untop₀_of_ne_top hneTop0] using hpos0 ++ simpa using (WithTop.coe_lt_coe.1 this) ++ have hdiv0 : D 0 = (meromorphicOrderAt f (0 : ℂ)).untop₀ := by ++ have hmon : MeromorphicOn f U := by ++ intro w hw; exact (hf.analyticAt w).meromorphicAt ++ simpa [D, U] using ++ (MeromorphicOn.divisor_apply (f := f) (U := U) (z := (0 : ℂ)) ++ hmon (by aesop)) ++ exact by ++ have : (meromorphicOrderAt f (0 : ℂ)).untop₀ ≠ 0 := ne_of_gt hpos0' ++ simpa [hdiv0] using this ++ have hmem0 : (0 : ℂ) ∈ D.support := by ++ simp [Function.mem_support, hD0] ++ have hdisc : IsDiscrete D.support := by ++ simpa [D] using (D.discreteSupport) ++ rcases Metric.exists_ball_inter_eq_singleton_of_mem_discrete hdisc hmem0 with ⟨r0, hr0pos, hr0⟩ ++ refine ⟨r0, hr0pos, ?_⟩ ++ intro p ++ have hp : divisorZeroIndex₀Val p ∈ D.support := by ++ simp [D, divisorZeroIndex₀Val_mem_divisor_support (f := f) (U := U) p] ++ have hnotBall : divisorZeroIndex₀Val p ∉ Metric.ball (0 : ℂ) r0 := by ++ intro hball ++ have : divisorZeroIndex₀Val p ∈ Metric.ball (0 : ℂ) r0 ∩ D.support := ⟨hball, hp⟩ ++ have : divisorZeroIndex₀Val p ∈ ({(0 : ℂ)} : Set ℂ) := by simp [hr0] at this ++ have : divisorZeroIndex₀Val p = 0 := by simp [Set.mem_singleton_iff] at this ++ exact (divisorZeroIndex₀Val_ne_zero p) this ++ have : r0 ≤ ‖divisorZeroIndex₀Val p‖ := by ++ have : ¬ ‖divisorZeroIndex₀Val p‖ < r0 := by ++ intro hlt ++ exact hnotBall (by simpa [Metric.mem_ball, dist_zero_right] using hlt) ++ exact le_of_not_gt this ++ exact this ++ · have hcont0 : ContinuousAt f (0 : ℂ) := (hf 0).continuousAt ++ have hne : ∀ᶠ z in 𝓝 (0 : ℂ), f z ≠ 0 := hcont0.eventually_ne h0 ++ rcases Metric.mem_nhds_iff.1 hne with ⟨r0, hr0pos, hr0⟩ ++ refine ⟨r0, hr0pos, ?_⟩ ++ intro p ++ have : ¬ ‖divisorZeroIndex₀Val p‖ < r0 := by ++ intro hlt ++ have hzball : divisorZeroIndex₀Val p ∈ Metric.ball (0 : ℂ) r0 := by ++ simpa [Metric.mem_ball, dist_zero_right] using hlt ++ have : f (divisorZeroIndex₀Val p) ≠ 0 := hr0 hzball ++ exact this (hzero p) ++ exact le_of_not_gt this ++ ++open scoped BigOperators ++ ++lemma card_ball_le_divisorMassClosedBall₀ ++ {f : ℂ → ℂ} (hf : Differentiable ℂ f) {R : ℝ} (hR : 0 < R) : ++ (Nat.card {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) ++ ≤ divisorMassClosedBall₀ f R := by ++ set U : Set ℂ := (Set.univ : Set ℂ) ++ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U ++ have : ++ Fintype {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} := by ++ have : Finite {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} := by ++ have : Metric.closedBall (0 : ℂ) R ⊆ U := by simp [U] ++ simpa using (finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := U) (B := R) this) ++ exact Fintype.ofFinite _ ++ have hDnonneg : 0 ≤ D := by ++ simpa [D, U] using (Differentiable.divisor_nonneg (f := f) hf) ++ let SR : Finset ℂ := ++ (Function.locallyFinsuppWithin.finiteSupport (Function.locallyFinsuppWithin.toClosedBall R D) ++ (isCompact_closedBall (0 : ℂ) |R|)).toFinset ++ let S : Finset ℂ := SR.filter fun z : ℂ => z ≠ 0 ++ let T : Type := ++ Σ z : S, Fin (Int.toNat (D z.1)) ++ let φ : ++ {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} → T := fun p => ++ let z0 : ℂ := divisorZeroIndex₀Val p.1 ++ have hz0_memSR : z0 ∈ SR := by ++ have hz0_norm : ‖z0‖ ≤ |R| := by ++ have : ‖z0‖ ≤ R := p.2 ++ simpa [abs_of_pos hR] using this ++ have hz0_support : z0 ∈ (Function.locallyFinsuppWithin.toClosedBall R D).support := by ++ have hz0_suppD : z0 ∈ D.support := by ++ simp [z0, D] ++ exact Function.locallyFinsuppWithin.mem_toClosedBall_support_of_mem_support_of_norm_le_abs ++ hz0_suppD hz0_norm ++ exact (Set.Finite.mem_toFinset ++ (Function.locallyFinsuppWithin.finiteSupport ++ (Function.locallyFinsuppWithin.toClosedBall R D) ++ (isCompact_closedBall (0 : ℂ) |R|))).2 hz0_support ++ have hz0_ne0 : z0 ≠ 0 := divisorZeroIndex₀Val_ne_zero p.1 ++ have hz0_memS : z0 ∈ S := Finset.mem_filter.2 ⟨hz0_memSR, hz0_ne0⟩ ++ ⟨⟨z0, hz0_memS⟩, by ++ simpa [z0, divisorZeroIndex₀Val, D] using p.1.1.2⟩ ++ have hφ_inj : Function.Injective φ := by ++ intro p q hpq ++ have hσ := (Sigma.mk.inj_iff).1 hpq ++ have hzS : (φ p).1 = (φ q).1 := hσ.1 ++ have hz : divisorZeroIndex₀Val p.1 = divisorZeroIndex₀Val q.1 := by ++ simpa [φ] using congrArg Subtype.val hzS ++ apply Subtype.ext ++ apply Subtype.ext ++ apply Sigma.ext ++ · exact hz ++ · simpa [φ] using hσ.2 ++ have hcard_le : ++ Fintype.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} ≤ Fintype.card T := ++ Fintype.card_le_of_injective φ hφ_inj ++ have hT_card : ++ (Fintype.card T : ℝ) = ++ (S.sum fun z : ℂ => (Int.toNat (D z) : ℝ)) := by ++ have hNat : ++ Fintype.card T = ∑ z : S, Int.toNat (D z.1) := by ++ have h1 : ++ Fintype.card T = ∑ z : S, Fintype.card (Fin (Int.toNat (D z.1))) := by ++ change Fintype.card (Sigma (fun z : S => Fin (Int.toNat (D z.1)))) ++ = ∑ z : S, Fintype.card (Fin (Int.toNat (D z.1))) ++ exact (Fintype.card_sigma (ι := S) (α := fun z : S => Fin (Int.toNat (D z.1)))) ++ simpa using h1 ++ have hR : ++ (Fintype.card T : ℝ) = ∑ z : S, (Int.toNat (D z.1) : ℝ) := by ++ exact_mod_cast hNat ++ have hR' : ++ (Fintype.card T : ℝ) = S.attach.sum (fun z : S => (Int.toNat (D z.1) : ℝ)) := by ++ simpa [Finset.univ_eq_attach] using hR ++ calc ++ (Fintype.card T : ℝ) = S.attach.sum (fun z : S => (Int.toNat (D z.1) : ℝ)) := hR' ++ _ = S.sum (fun z : ℂ => (Int.toNat (D z) : ℝ)) := by ++ simpa using (Finset.sum_attach (s := S) (f := fun z : ℂ => (Int.toNat (D z) : ℝ))) ++ have htoNat_le : ∀ z ∈ S, (Int.toNat (D z) : ℝ) ≤ (D z : ℝ) := by ++ intro z hz ++ have hDz_nonneg : 0 ≤ D z := by simpa [D] using hDnonneg z ++ have hEqZ : ((Int.toNat (D z) : ℕ) : ℤ) = D z := by ++ simpa using (Int.toNat_of_nonneg hDz_nonneg) ++ have hEqR : (Int.toNat (D z) : ℝ) = (D z : ℝ) := by ++ exact_mod_cast hEqZ ++ exact le_of_eq hEqR ++ calc ++ (Nat.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) ++ = (Fintype.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) := by ++ simp [Nat.card_eq_fintype_card] ++ _ ≤ (Fintype.card T : ℝ) := by exact_mod_cast hcard_le ++ _ = S.sum (fun z : ℂ => (Int.toNat (D z) : ℝ)) := hT_card ++ _ ≤ S.sum (fun z : ℂ => (D z : ℝ)) := by ++ refine Finset.sum_le_sum ?_ ++ intro z hz ++ exact htoNat_le z hz ++ _ = divisorMassClosedBall₀ f R := by ++ rfl ++ ++lemma card_subtype_le_divisorMassClosedBall₀_of_norm_le ++ {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ {s : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))} [Fintype s] ++ {R : ℝ} (hR : 0 < R) (hs : ∀ p : s, ‖divisorZeroIndex₀Val p.1‖ ≤ R) : ++ (Fintype.card s : ℝ) ≤ divisorMassClosedBall₀ f R := by ++ let Aball : Type := ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) // ‖divisorZeroIndex₀Val p‖ ≤ R} ++ have : Fintype Aball := by ++ have : Finite Aball := by ++ have : Metric.closedBall (0 : ℂ) R ⊆ (Set.univ : Set ℂ) := by simp ++ simpa [Aball] using ++ (finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := (Set.univ : Set ℂ)) ++ (B := R) this) ++ exact Fintype.ofFinite _ ++ have hinj : Function.Injective (fun p : s => (⟨p.1, hs p⟩ : Aball)) := by ++ intro p q hpq ++ apply Subtype.ext ++ exact congrArg (fun x : Aball => x.1) hpq ++ have hcard_le : Fintype.card s ≤ Fintype.card Aball := ++ Fintype.card_le_of_injective _ hinj ++ have hAball : (Nat.card Aball : ℝ) ≤ divisorMassClosedBall₀ f R := by ++ simpa [Aball] using card_ball_le_divisorMassClosedBall₀ (f := f) hf hR ++ calc ++ (Fintype.card s : ℝ) ≤ (Fintype.card Aball : ℝ) := by exact_mod_cast hcard_le ++ _ = (Nat.card Aball : ℝ) := by simp [Nat.card_eq_fintype_card] ++ _ ≤ divisorMassClosedBall₀ f R := hAball ++ ++lemma divisorZeroIndex₀_dyadicShell_upper_bound ++ {f : ℂ → ℂ} {r0 : ℝ} ++ (hr0pos : 0 < r0) ++ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) ++ {k : ℕ} {p : divisorZeroIndex₀ f (Set.univ : Set ℂ)} ++ (hp : ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k) : ++ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1) := by ++ exact Real.dyadicShell_upper_bound (r0 := r0) (x := ‖divisorZeroIndex₀Val p‖) ++ hr0pos (hr0 p) hp ++ ++lemma divisorZeroIndex₀_dyadicShell_lower_bound ++ {f : ℂ → ℂ} {r0 : ℝ} ++ (hr0pos : 0 < r0) ++ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) ++ {k : ℕ} {p : divisorZeroIndex₀ f (Set.univ : Set ℂ)} ++ (hp : ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k) : ++ r0 * (2 : ℝ) ^ (k : ℝ) ≤ ‖divisorZeroIndex₀Val p‖ := by ++ exact Real.dyadicShell_lower_bound (r0 := r0) (x := ‖divisorZeroIndex₀Val p‖) ++ hr0pos (hr0 p) hp ++ ++lemma finite_divisorZeroIndex₀_dyadicShell ++ {f : ℂ → ℂ} {r0 : ℝ} ++ (hr0pos : 0 < r0) ++ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) ++ (k : ℕ) : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k} : Set _).Finite := by ++ have hsub : ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k} ⊆ ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)} := by ++ intro p hp ++ exact divisorZeroIndex₀_dyadicShell_upper_bound hr0pos hr0 hp ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)} : Set _).Finite := by ++ have : ++ Metric.closedBall (0 : ℂ) (r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) ⊆ ++ (Set.univ : Set ℂ) := by ++ simp ++ simpa using ++ (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) ++ (B := r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) this) ++ exact hfin.subset hsub ++ ++lemma tsum_divisorZeroIndex₀_dyadicShell_inv_rpow_le_geometric_of_growth ++ {f : ℂ → ℂ} {ρ τ r0 Cgrow : ℝ} ++ (hρ : 0 ≤ ρ) (hτpos : 0 < τ) (hf : Differentiable ℂ f) ++ (hCgrow_pos : 0 < Cgrow) ++ (hCgrow : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ Cgrow * (1 + ‖z‖) ^ ρ) ++ (hr0pos : 0 < r0) ++ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ r0 ≤ ‖divisorZeroIndex₀Val p‖) ++ (k : ℕ) (hk_ge_one : 1 ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) : ++ let kfun : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℕ := ++ fun p => ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ ++ let S : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := {p | kfun p = k} ++ let Ctrail : ℝ := |Real.log ‖meromorphicTrailingCoeffAt f 0‖| ++ let A : ℝ := ((Cgrow / Real.log 2) * (1 + 4 * r0) ^ ρ) * (r0⁻¹) ^ τ ++ let B : ℝ := ((Ctrail / Real.log 2) + 1) * (r0⁻¹) ^ τ ++ let q : ℝ := (2 : ℝ) ^ (ρ - τ) ++ let qσ : ℝ := (2 : ℝ) ^ (-τ) ++ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ≤ A * q ^ k + B * qσ ^ k := by ++ classical ++ intro kfun S Ctrail A B q qσ ++ let rk : ℝ := r0 * (2 : ℝ) ^ (k : ℝ) ++ let Rk : ℝ := r0 * (2 : ℝ) ^ ((k : ℝ) + 1) ++ have hrk_pos : 0 < rk := mul_pos hr0pos (Real.rpow_pos_of_pos (by norm_num) _) ++ have hrk0 : 0 ≤ rk := le_of_lt hrk_pos ++ have : Finite S := by ++ simpa [S, kfun] using (finite_divisorZeroIndex₀_dyadicShell ++ (f := f) hr0pos hr0 k).to_subtype ++ have : Fintype S := Fintype.ofFinite S ++ have hk_upper : ∀ p : S, ‖divisorZeroIndex₀Val p.1‖ ≤ Rk := by ++ intro p ++ have hk' : kfun p.1 = k := p.2 ++ simpa [Rk, kfun] using ++ divisorZeroIndex₀_dyadicShell_upper_bound (f := f) hr0pos hr0 hk' ++ have hk_lower : ∀ p : S, rk ≤ ‖divisorZeroIndex₀Val p.1‖ := by ++ intro p ++ have hk' : kfun p.1 = k := p.2 ++ simpa [rk, kfun] using ++ divisorZeroIndex₀_dyadicShell_lower_bound (f := f) hr0pos hr0 hk' ++ have htsum_le : ++ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ++ ≤ (Fintype.card S : ℝ) * (rk⁻¹ ^ τ) := by ++ exact Real.tsum_inv_rpow_le_card_mul_of_lower_bound ++ (a := fun p : S => ‖divisorZeroIndex₀Val p.1‖) ++ hrk_pos hτpos (fun _ => norm_nonneg _) hk_lower ++ have hmass_le_growth : ++ divisorMassClosedBall₀ f Rk ++ ≤ (Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2) := by ++ simpa [Ctrail, Rk] using ++ (divisorMassClosedBall₀_le_of_growth (f := f) (ρ := ρ) (C := Cgrow) hf hCgrow ++ (R := Rk) hk_ge_one) ++ have hcard_le_mass : ++ (Fintype.card S : ℝ) ≤ divisorMassClosedBall₀ f Rk := by ++ have hRk_pos : 0 < Rk := lt_of_lt_of_le (by norm_num) hk_ge_one ++ exact card_subtype_le_divisorMassClosedBall₀_of_norm_le (f := f) hf hRk_pos hk_upper ++ have htsum' : ++ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ++ ≤ ((Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2)) * (rk⁻¹ ^ τ) := by ++ have hcard_le_growth : ++ (Fintype.card S : ℝ) ≤ ++ (Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2) := ++ le_trans hcard_le_mass hmass_le_growth ++ exact le_trans htsum_le <| ++ mul_le_mul_of_nonneg_right hcard_le_growth (Real.rpow_nonneg (inv_nonneg.2 hrk0) τ) ++ have hpow_bound : ++ (1 + |2 * Rk|) ^ ρ ≤ (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by ++ simpa [Rk] using ++ Real.one_add_abs_two_mul_dyadicRadius_rpow_le (r0 := r0) (ρ := ρ) k hr0pos hρ ++ have hlog2pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) ++ simpa [A, B, q, qσ, rk, Ctrail, mul_assoc, mul_left_comm, mul_comm] using ++ Real.dyadic_growth_mass_mul_inv_le_geometric ++ (C := Cgrow) (L := Real.log 2) (M := (1 + 4 * r0) ^ ρ) ++ (X := (1 + |2 * Rk|) ^ ρ) ++ (T := ∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ++ (Ctrail := Ctrail) (r0 := r0) (ρ := ρ) (τ := τ) (k := k) ++ hlog2pos hCgrow_pos.le hr0pos.le hpow_bound ++ (by simpa [rk] using htsum') ++ ++theorem summable_norm_inv_rpow_divisorZeroIndex₀_of_growth {f : ℂ → ℂ} {ρ τ : ℝ} ++ (hρ : 0 ≤ ρ) (hτ : ρ < τ) (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by ++ rcases hgrowth with ⟨Cgrow, hCgrow_pos, hCgrow⟩ ++ have hτpos : 0 < τ := lt_of_le_of_lt hρ hτ ++ rcases exists_r0_le_norm_divisorZeroIndex₀Val (f := f) hf hnot with ⟨r0, hr0pos, hr0⟩ ++ have hr0ne : (r0 : ℝ) ≠ 0 := ne_of_gt hr0pos ++ let kfun : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℕ := ++ fun p => ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ ++ let S : ℕ → Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ fun k => {p | kfun p = k} ++ have hS : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ∃! k : ℕ, p ∈ S k := by ++ intro p ++ refine ⟨kfun p, ?_, ?_⟩ ++ · simp [S] ++ · intro k hk ++ simpa [S] using hk.symm ++ have hnonneg : 0 ≤ fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ intro p ++ exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ ++ have hSk_summable : ∀ k : ℕ, Summable fun p : S k => ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by ++ intro k ++ have : Finite (S k) := by ++ simpa [S, kfun] using (finite_divisorZeroIndex₀_dyadicShell ++ (f := f) hr0pos hr0 k).to_subtype ++ exact Summable.of_finite ++ have hshell_summable : ++ Summable fun k : ℕ => ∑' p : S k, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by ++ let q : ℝ := (2 : ℝ) ^ (ρ - τ) ++ let qσ : ℝ := (2 : ℝ) ^ (-τ) ++ have hq_nonneg : 0 ≤ q := le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) ++ have hq_lt_one : q < 1 := ++ Real.rpow_lt_one_of_one_lt_of_neg (x := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) ++ (sub_neg.2 hτ) ++ have hqσ_nonneg : 0 ≤ qσ := le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) ++ have hqσ_lt_one : qσ < 1 := ++ Real.rpow_lt_one_of_one_lt_of_neg (x := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) ++ (by simpa using (neg_neg_of_pos hτpos)) ++ have hgeom_q : Summable (fun k : ℕ => q ^ k) := ++ summable_geometric_of_lt_one hq_nonneg hq_lt_one ++ have hgeom_qσ : Summable (fun k : ℕ => qσ ^ k) := ++ summable_geometric_of_lt_one hqσ_nonneg hqσ_lt_one ++ let Ctrail : ℝ := |Real.log ‖meromorphicTrailingCoeffAt f 0‖| ++ let A : ℝ := ((Cgrow / Real.log 2) * (1 + 4 * r0) ^ ρ) * (r0⁻¹) ^ τ ++ let B : ℝ := ((Ctrail / Real.log 2) + 1) * (r0⁻¹) ^ τ ++ rcases Real.exists_nat_le_two_pow (1 / r0) with ⟨k0, hk0⟩ ++ let A0 : ℝ := A * q ^ k0 ++ let B0 : ℝ := B * qσ ^ k0 ++ have hmajor : Summable (fun k : ℕ => A0 * q ^ k + B0 * qσ ^ k) := ++ (hgeom_q.mul_left A0).add (hgeom_qσ.mul_left B0) ++ have hshell_summable_shift : ++ Summable fun k : ℕ => ∑' p : S (k + k0), ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by ++ refine hmajor.of_nonneg_of_le ++ (fun k => by ++ have : ∀ p : S (k + k0), 0 ≤ ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by ++ intro p; exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ ++ exact tsum_nonneg this) ++ (fun k => by ++ let kk : ℕ := k + k0 ++ let Rk : ℝ := r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) ++ have hRk_ge_one : (1 : ℝ) ≤ Rk := by ++ have hkk : k0 ≤ kk + 1 := by ++ simp [kk, Nat.add_assoc, Nat.add_comm] ++ simpa [Rk] using ++ Real.one_le_dyadicRadius_succ_of_inv_le_two_pow hr0pos hk0 hkk ++ have hmain : ++ (∑' p : S kk, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ≤ A * q ^ kk + B * qσ ^ kk := by ++ simpa [S, kfun, Ctrail, A, B, q, qσ] using ++ tsum_divisorZeroIndex₀_dyadicShell_inv_rpow_le_geometric_of_growth ++ (f := f) (ρ := ρ) (τ := τ) hρ hτpos hf hCgrow_pos hCgrow hr0pos hr0 kk hRk_ge_one ++ have : A * q ^ kk + B * qσ ^ kk = A0 * q ^ k + B0 * qσ ^ k := by ++ simpa [A0, B0, kk] using Real.two_geometric_shift_add A B q qσ k k0 ++ simpa [kk] using (hmain.trans_eq this) ++ ) ++ exact (summable_nat_add_iff k0).1 hshell_summable_shift ++ have hpart := ++ (summable_partition (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) hnonneg (s := S) hS) ++ exact (hpart.2 ⟨hSk_summable, hshell_summable⟩) ++ ++theorem summable_norm_inv_pow_divisorZeroIndex₀_of_growth {f : ℂ → ℂ} {ρ : ℝ} ++ (hρ : 0 ≤ ρ) (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (Nat.floor ρ + 1)) := by ++ have hτ : ρ < (Nat.floor ρ + 1 : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one] using (Nat.lt_floor_add_one (a := ρ)) ++ have hs := ++ summable_norm_inv_rpow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) ++ (τ := (Nat.floor ρ + 1 : ℝ)) hρ hτ hf hnot hgrowth ++ exact hs.congr fun p => by ++ have hcast : ((Nat.floor ρ : ℝ) + 1) = ((Nat.floor ρ + 1 : ℕ) : ℝ) := by ++ norm_num ++ rw [hcast, Real.rpow_natCast] ++ ++end Complex.Hadamard ++end ++end HadamardSourceScope24 ++ ++section HadamardSourceScope25 ++ ++namespace Complex ++ ++open _root_.Complex ++ ++variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F] ++ ++theorem norm_le_of_mem_ball_of_forall_sphere_norm_le {f : ℂ → F} {r C : ℝ} {z : ℂ} ++ (hd : Differentiable ℂ f) (hrpos : 0 < r) ++ (hz : z ∈ Metric.ball (0 : ℂ) r) (hsphere : ∀ u : ℂ, ‖u‖ = r → ‖f u‖ ≤ C) : ++ ‖f z‖ ≤ C := by ++ let U : Set ℂ := Metric.ball (0 : ℂ) r ++ have hfront : ∀ u ∈ frontier U, ‖f u‖ ≤ C := by ++ intro u hu ++ have hur : ‖u‖ = r := by ++ have hfront' : frontier (Metric.ball (0 : ℂ) r) = Metric.sphere (0 : ℂ) r := by ++ simpa using (frontier_ball (x := (0 : ℂ)) (r := r) (ne_of_gt hrpos)) ++ have : u ∈ Metric.sphere (0 : ℂ) r := by simpa [U, hfront'] using hu ++ simpa [Metric.mem_sphere, dist_zero_right] using this ++ exact hsphere u hur ++ exact norm_le_of_forall_mem_frontier_norm_le (f := f) (U := U) Metric.isBounded_ball ++ hd.diffContOnCl hfront (subset_closure hz) ++ ++end Complex ++end HadamardSourceScope25 ++ ++section HadamardSourceScope26 ++ ++namespace Complex ++ ++open _root_.Complex ++namespace CartanBound ++ ++open _root_.Real _root_.Erdos970.Real MeasureTheory intervalIntegral ++open scoped Topology ENNReal ++ ++private lemma neg_log_le_sqrt_two_div {x : ℝ} (hx : 0 < x) (hxle : x ≤ 1) : ++ -Real.log x ≤ Real.sqrt (2 / x) := by ++ have hx0 : 0 ≤ x := le_of_lt hx ++ have ht : 0 ≤ -Real.log x := by ++ have : Real.log x ≤ 0 := Real.log_nonpos hx0 hxle ++ linarith ++ have hsq_div_two_le_exp : ∀ {t : ℝ}, 0 ≤ t → t ^ 2 / 2 ≤ Real.exp t := by ++ intro t ht ++ let g : ℝ → ℝ := fun u => Real.exp u - u ^ 2 / 2 ++ have hg_cont : ContinuousOn g (Set.Ici (0 : ℝ)) := by ++ have : Continuous g := by fun_prop ++ simpa using this.continuousOn ++ have hg_diff : DifferentiableOn ℝ g (interior (Set.Ici (0 : ℝ))) := by ++ intro u hu ++ have : DifferentiableAt ℝ g u := by fun_prop ++ exact this.differentiableWithinAt ++ have hg'_nonneg : ∀ u ∈ interior (Set.Ici (0 : ℝ)), 0 ≤ deriv g u := by ++ intro u hu ++ have hu0 : 0 < u := by simpa [interior_Ici] using hu ++ have hderiv : deriv g u = Real.exp u - u := by ++ have hExp : HasDerivAt Real.exp (Real.exp u) u := Real.hasDerivAt_exp u ++ have hpow2 : HasDerivAt (fun z : ℝ => z ^ 2) (2 * u) u := by ++ simpa using! ((hasDerivAt_id u).pow 2) ++ have hpow2_div : HasDerivAt (fun z : ℝ => z ^ 2 / 2) u u := by ++ simpa using (hpow2.div_const (2 : ℝ)) ++ have hG : HasDerivAt g (Real.exp u - u) u := by ++ simpa [g] using! hExp.sub hpow2_div ++ exact hG.deriv ++ have hu_le : u ≤ Real.exp u := by ++ have h1 : u + 1 ≤ Real.exp u := Real.add_one_le_exp u ++ exact (le_trans (le_add_of_nonneg_right (by norm_num)) h1) ++ have : 0 ≤ Real.exp u - u := sub_nonneg.2 hu_le ++ simpa [hderiv] using this ++ have hg_mono : MonotoneOn g (Set.Ici (0 : ℝ)) := ++ monotoneOn_of_deriv_nonneg (D := Set.Ici (0 : ℝ)) (hD := convex_Ici 0) ++ hg_cont hg_diff hg'_nonneg ++ have hg0 : g 0 = 1 := by simp [g] ++ have hle : g 0 ≤ g t := hg_mono (by simp) (by simpa [Set.mem_Ici] using ht) ht ++ have : (1 : ℝ) ≤ Real.exp t - t ^ 2 / 2 := by simpa [g, hg0] using hle ++ linarith ++ have hmain : (-Real.log x) ^ 2 / 2 ≤ Real.exp (-Real.log x) := hsq_div_two_le_exp ht ++ have hexp : Real.exp (-Real.log x) = x⁻¹ := by simp [Real.exp_neg, Real.exp_log hx] ++ have hsq2 : (-Real.log x) ^ 2 ≤ 2 * Real.exp (-Real.log x) := by nlinarith [hmain] ++ have hsq' : (-Real.log x) ^ 2 ≤ 2 / x := by simpa [hexp, div_eq_mul_inv, mul_assoc] using hsq2 ++ have hy : 0 ≤ 2 / x := div_nonneg (by norm_num) (le_of_lt hx) ++ exact (Real.le_sqrt ht hy).2 hsq' ++ ++lemma posLog_log_one_div_abs_one_sub_le_sqrt {t : ℝ} : ++ Real.posLog (1 / |1 - t|) ≤ Real.sqrt (2 / |1 - t|) := by ++ by_cases ht : |1 - t| ≤ 1 ++ · by_cases h0 : |1 - t| = 0 ++ · have : t = 1 := by ++ have : 1 - t = 0 := by simpa [abs_eq_zero] using h0 ++ linarith ++ subst this ++ simp ++ · have hpos : 0 < |1 - t| := lt_of_le_of_ne (abs_nonneg _) (Ne.symm h0) ++ have hle : -Real.log |1 - t| ≤ Real.sqrt (2 / |1 - t|) := ++ neg_log_le_sqrt_two_div (x := |1 - t|) hpos ht ++ have hlog : Real.log (1 / |1 - t|) = -Real.log |1 - t| := by simp [Real.log_inv] ++ have hnonneg : 0 ≤ Real.log (1 / |1 - t|) := by ++ exact Real.log_nonneg ((one_le_div hpos).2 ht) ++ have hmax : Real.posLog (1 / |1 - t|) = Real.log (1 / |1 - t|) := ++ max_eq_right hnonneg ++ calc ++ Real.posLog (1 / |1 - t|) = Real.log (1 / |1 - t|) := hmax ++ _ = -Real.log |1 - t| := hlog ++ _ ≤ Real.sqrt (2 / |1 - t|) := hle ++ · have hlt : 1 < |1 - t| := lt_of_not_ge ht ++ have hle0 : Real.log (1 / |1 - t|) ≤ 0 := by ++ have hpos : 0 < |1 - t| := lt_trans (by norm_num) hlt ++ have : (1 / |1 - t| : ℝ) ≤ 1 := (div_le_one hpos).2 (le_of_lt hlt) ++ exact le_trans (Real.log_le_log (by positivity) this) (by simp) ++ have hmax : Real.posLog (1 / |1 - t|) = 0 := max_eq_left hle0 ++ have hrhs : 0 ≤ Real.sqrt (2 / |1 - t|) := by ++ exact Real.sqrt_nonneg _ ++ rw [hmax] ++ exact hrhs ++ ++noncomputable def φ (t : ℝ) : ℝ := ++ log⁺ (1 / |1 - t|) ++ ++lemma measurable_phi : Measurable φ := by ++ unfold φ ++ simpa [Real.posLog_def, Real.posLog] using ++ (by fun_prop : Measurable fun t : ℝ => max 0 (Real.log (1 / |1 - t|))) ++ ++lemma phi_le_log_two_of_le_half {t : ℝ} (ht : t ≤ (1 / 2 : ℝ)) : φ t ≤ Real.log 2 := by ++ have hnonneg : 0 ≤ (1 - t : ℝ) := by linarith ++ have hden : (1 / 2 : ℝ) ≤ |1 - t| := by ++ have : (1 / 2 : ℝ) ≤ (1 - t : ℝ) := by linarith ++ simpa [abs_of_nonneg hnonneg] using this ++ have hfrac : (1 / |1 - t| : ℝ) ≤ 2 := by ++ have hhalfpos : (0 : ℝ) < (1 / 2 : ℝ) := by norm_num ++ have := one_div_le_one_div_of_le hhalfpos hden ++ simpa [one_div, div_eq_mul_inv] using this ++ have hposLog : log⁺ (1 / |1 - t|) ≤ log⁺ (2 : ℝ) := ++ Real.posLog_le_posLog ((by trans (0 : ℝ); norm_num; positivity)) hfrac ++ have habs : (1 : ℝ) ≤ |(2 : ℝ)| := by ++ simp ++ have hposLog2 : (log⁺ (2 : ℝ)) = Real.log 2 := by ++ simpa using (Real.posLog_eq_log habs) ++ simpa [φ, hposLog2] using hposLog ++ ++lemma phi_eq_zero_of_one_le_abs_one_sub {t : ℝ} (ht : (1 : ℝ) ≤ |1 - t|) : φ t = 0 := by ++ have hpos : 0 < |1 - t| := lt_of_lt_of_le (by norm_num) ht ++ have hfrac : (1 / |1 - t| : ℝ) ≤ 1 := (div_le_one hpos).2 ht ++ have habs : |(1 / |1 - t| : ℝ)| ≤ 1 := by ++ have hnonneg : 0 ≤ (1 / |1 - t| : ℝ) := by positivity ++ simpa [abs_of_nonneg hnonneg] using hfrac ++ have : log⁺ (1 / |1 - t|) = 0 := (Real.posLog_eq_zero_iff _).2 habs ++ simpa [φ] using this ++ ++lemma φ_nonneg (t : ℝ) : 0 ≤ φ t := by ++ simpa [φ] using (Real.posLog_nonneg (x := (1 / |1 - t|))) ++ ++lemma φ_le_sqrt (t : ℝ) : φ t ≤ Real.sqrt (2 / |1 - t|) := by ++ simpa [φ, Real.posLog] using ++ posLog_log_one_div_abs_one_sub_le_sqrt (t := t) ++ ++lemma ae_restrict_norm_phi_le_of_forall_mem {A B : ℝ} (hAB : A ≤ B) {g : ℝ → ℝ} ++ (hg : ∀ t, 0 ≤ g t) (h : ∀ t ∈ Set.Icc A B, φ t ≤ g t) : ++ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A B))] fun t => ‖g t‖ := by ++ refine ++ MeasureTheory.ae_restrict_of_forall_mem (μ := (volume : MeasureTheory.Measure ℝ)) ++ (s := Set.uIoc A B) ++ (by simpa using (measurableSet_uIoc : MeasurableSet (Set.uIoc A B))) ?_ ++ intro t ht ++ have htIoc : t ∈ Set.Ioc A B := by ++ simpa [Set.uIoc_of_le hAB] using ht ++ have htIcc : t ∈ Set.Icc A B := ⟨le_of_lt htIoc.1, htIoc.2⟩ ++ have hle : φ t ≤ g t := h t htIcc ++ have hφ0 : 0 ≤ φ t := φ_nonneg t ++ have hg0 : 0 ≤ g t := hg t ++ simpa [Real.norm_eq_abs, abs_of_nonneg hφ0, abs_of_nonneg hg0] using hle ++ ++lemma log_norm_one_sub_div_ge_neg_phi {u a : ℂ} {r : ℝ} ++ (hur : ‖u‖ = r) (ha : a ≠ 0) (hr : r ≠ ‖a‖) : ++ Real.log ‖(1 : ℂ) - u / a‖ ≥ -φ (r / ‖a‖) := by ++ have ha_norm : 0 < ‖a‖ := norm_pos_iff.2 ha ++ have hnorm_eq : ‖(1 : ℂ) - u / a‖ = ‖a - u‖ / ‖a‖ := by ++ have : (1 : ℂ) - u / a = (a - u) / a := by ++ field_simp [ha] ++ calc ++ ‖(1 : ℂ) - u / a‖ = ‖(a - u) / a‖ := by simp [this] ++ _ = ‖a - u‖ / ‖a‖ := by simp ++ have hrev : |‖a‖ - ‖u‖| ≤ ‖a - u‖ := by ++ simpa using (abs_norm_sub_norm_le a u) ++ have hdiv : |‖a‖ - ‖u‖| / ‖a‖ ≤ ‖a - u‖ / ‖a‖ := ++ div_le_div_of_nonneg_right hrev (le_of_lt ha_norm) ++ have habs : |1 - (r / ‖a‖)| = |‖a‖ - ‖u‖| / ‖a‖ := by ++ have hu : ‖u‖ = r := hur ++ have ha0 : (‖a‖ : ℝ) ≠ 0 := ha_norm.ne' ++ have h1 : (1 : ℝ) - (r / ‖a‖) = (‖a‖ - r) / ‖a‖ := by ++ field_simp [ha0] ++ calc ++ |1 - (r / ‖a‖)| = |(‖a‖ - r) / ‖a‖| := by simp [h1] ++ _ = |‖a‖ - r| / ‖a‖ := by simp [abs_div, abs_of_pos ha_norm] ++ _ = |‖a‖ - ‖u‖| / ‖a‖ := by simp [hu] ++ have hnorm_ge : |1 - (r / ‖a‖)| ≤ ‖(1 : ℂ) - u / a‖ := by ++ have : |1 - (r / ‖a‖)| ≤ ‖a - u‖ / ‖a‖ := by ++ rw [habs] ++ exact hdiv ++ rwa [hnorm_eq] ++ have hx0 : 0 < |1 - (r / ‖a‖)| := by ++ have : (1 - (r / ‖a‖) : ℝ) ≠ 0 := by ++ intro h0 ++ have : r = ‖a‖ := by ++ have : r / ‖a‖ = (1 : ℝ) := by linarith ++ simpa using (div_eq_iff ha_norm.ne').1 this ++ exact hr this ++ have : |1 - (r / ‖a‖)| ≠ 0 := by ++ simpa [abs_eq_zero] using this ++ exact lt_of_le_of_ne (abs_nonneg _) (Ne.symm this) ++ have hlogx : ++ Real.log |1 - (r / ‖a‖)| ≥ -φ (r / ‖a‖) := by ++ have := Real.neg_posLog_inv_le_log (x := |1 - (r / ‖a‖)|) ++ simpa [φ, one_div, inv_inv, abs_sub_comm, sub_eq_add_neg] using this ++ have hlog_mono : ++ Real.log |1 - (r / ‖a‖)| ≤ Real.log ‖(1 : ℂ) - u / a‖ := ++ Real.log_le_log (by positivity) hnorm_ge ++ linarith [hlog_mono, hlogx] ++ ++noncomputable def K : ℝ := ++ ∫ (t : ℝ) in (1 / 4 : ℝ)..(4 : ℝ), Real.sqrt (2 / |1 - t|) ∂volume ++ ++lemma K_nonneg : 0 ≤ K := by ++ have hle : (1 / 4 : ℝ) ≤ (4 : ℝ) := by norm_num ++ have hnn : ∀ t ∈ Set.Icc (1 / 4 : ℝ) (4 : ℝ), 0 ≤ Real.sqrt (2 / |1 - t|) := by ++ intro _t _ht ++ exact Real.sqrt_nonneg _ ++ simpa [K] using (intervalIntegral.integral_nonneg ++ (μ := (volume : MeasureTheory.Measure ℝ)) hle hnn) ++ ++noncomputable def Cφ : ℝ := ++ Real.log 2 + 4 * K + 1 ++ ++lemma Cφ_pos : 0 < Cφ := by ++ have hlog : 0 < Real.log 2 := by ++ simpa using Real.log_pos (by norm_num : (1 : ℝ) < 2) ++ have hK : 0 ≤ K := K_nonneg ++ have : 0 < Real.log 2 + 4 * K := by nlinarith ++ have : 0 < Real.log 2 + 4 * K + 1 := by linarith ++ simpa [Cφ] using this ++ ++lemma intervalIntegrable_sqrt_two_div_abs_one_sub_Icc : ++ IntervalIntegrable ++ (fun t : ℝ => Real.sqrt (2 / |1 - t|)) ++ volume (1 / 4 : ℝ) (4 : ℝ) := by ++ let f : ℝ → ℝ := fun u => Real.sqrt (2 / |u|) ++ have hf0 : IntervalIntegrable f volume (0 : ℝ) (3 : ℝ) := by ++ have hpow : ++ IntervalIntegrable (fun u : ℝ => u ^ (- (2⁻¹ : ℝ))) volume (0 : ℝ) (3 : ℝ) := by ++ simpa using ++ (intervalIntegral.intervalIntegrable_rpow' (a := (0 : ℝ)) (b := (3 : ℝ)) ++ (r := (- (2⁻¹ : ℝ))) (by linarith : (-1 : ℝ) < - (2⁻¹ : ℝ))) ++ have hpow2 : ++ IntervalIntegrable (fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) volume (0 : ℝ) (3 : ℝ) := ++ hpow.const_mul (Real.sqrt 2) ++ have hEq : ++ Set.EqOn f (fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) (Set.uIoc (0 : ℝ) (3 : ℝ)) := by ++ intro u hu ++ have hu' : u ∈ Set.Ioc (0 : ℝ) (3 : ℝ) := by ++ simpa [Set.uIoc_of_le (show (0 : ℝ) ≤ 3 by norm_num)] using hu ++ have hu0 : 0 < u := hu'.1 ++ have hu0' : 0 ≤ u := le_of_lt hu0 ++ have habs : |u| = u := abs_of_nonneg hu0' ++ have : f u = Real.sqrt (2 / u) := by simp [f, habs] ++ calc ++ f u = Real.sqrt (2 / u) := this ++ _ = Real.sqrt 2 / Real.sqrt u := by simp ++ _ = Real.sqrt 2 * (Real.sqrt u)⁻¹ := by simp [div_eq_mul_inv] ++ _ = Real.sqrt 2 * (u ^ (2⁻¹ : ℝ))⁻¹ := by simp [Real.sqrt_eq_rpow] ++ _ = Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ)) := by ++ have h : (u ^ (2⁻¹ : ℝ))⁻¹ = u ^ (- (2⁻¹ : ℝ)) := by ++ simpa using (Real.rpow_neg hu0' (2⁻¹ : ℝ)).symm ++ simp [h] ++ exact ++ (IntervalIntegrable.congr (a := (0 : ℝ)) (b := (3 : ℝ)) ++ (μ := (volume : MeasureTheory.Measure ℝ)) ++ (f := fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) (g := f) hEq.symm) ++ hpow2 ++ have hf0' : IntervalIntegrable f volume (0 : ℝ) (3 / 4 : ℝ) := ++ hf0.mono_set (by ++ intro u hu ++ have hsub : Set.uIcc (0 : ℝ) (3 / 4 : ℝ) ⊆ Set.uIcc (0 : ℝ) (3 : ℝ) := by ++ refine Set.uIcc_subset_uIcc ?_ ?_ ++ · simp ++ · have h0 : (0 : ℝ) ≤ (3 / 4 : ℝ) := by nlinarith ++ have h1 : (3 / 4 : ℝ) ≤ (3 : ℝ) := by nlinarith ++ exact (Set.mem_uIcc).2 (Or.inl ⟨h0, h1⟩) ++ exact hsub hu) ++ have hleft : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume (1 / 4 : ℝ) (1 : ℝ) := by ++ have htmp : ++ IntervalIntegrable (fun t : ℝ => f (1 - t)) volume (1 : ℝ) ((1 : ℝ) - (3 / 4 : ℝ)) := by ++ simpa using (hf0'.comp_sub_left (c := (1 : ℝ))) ++ have htmp' : ++ IntervalIntegrable (fun t : ℝ => f (1 - t)) volume ((1 : ℝ) - (3 / 4 : ℝ)) (1 : ℝ) := ++ htmp.symm ++ have hsub : ((1 : ℝ) - (3 / 4 : ℝ)) = (1 / 4 : ℝ) := by norm_num ++ have htmp'' : IntervalIntegrable (fun t : ℝ => f (1 - t)) volume (1 / 4 : ℝ) (1 : ℝ) := by ++ simpa [hsub] using htmp' ++ simpa [f] using htmp'' ++ have hright : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume (1 : ℝ) (4 : ℝ) := by ++ have htmp : ++ IntervalIntegrable (fun t : ℝ => f (t - 1)) volume (1 : ℝ) ((3 : ℝ) + (1 : ℝ)) := by ++ simpa using (hf0.comp_sub_right (c := (1 : ℝ))) ++ have hsub : ((3 : ℝ) + (1 : ℝ)) = (4 : ℝ) := by norm_num ++ have htmp' : IntervalIntegrable (fun t : ℝ => f (t - 1)) volume (1 : ℝ) (4 : ℝ) := by ++ simpa [hsub] using htmp ++ have hcongr : ++ Set.EqOn (fun t : ℝ => f (t - 1)) (fun t : ℝ => Real.sqrt (2 / |1 - t|)) ++ (Set.uIoc (1 : ℝ) (4 : ℝ)) := by ++ intro t _ht ++ simp [f, abs_sub_comm] ++ exact ++ (IntervalIntegrable.congr (a := (1 : ℝ)) (b := (4 : ℝ)) ++ (μ := (volume : MeasureTheory.Measure ℝ)) ++ (f := fun t : ℝ => f (t - 1)) (g := fun t : ℝ => Real.sqrt (2 / |1 - t|)) hcongr) ++ htmp' ++ exact hleft.trans hright ++ ++lemma phi_le_log_two_on_dyadic_of_le_quarter {A t : ℝ} (hA : A ≤ (1 / 4 : ℝ)) ++ (ht : t ∈ Set.Icc A (2 * A)) : ++ φ t ≤ Real.log 2 := by ++ have ht_le : t ≤ (1 / 2 : ℝ) := by ++ exact ht.2.trans (by nlinarith [hA]) ++ exact phi_le_log_two_of_le_half ht_le ++ ++lemma phi_eq_zero_of_two_le {t : ℝ} (ht : (2 : ℝ) ≤ t) : φ t = 0 := by ++ have hden : (1 : ℝ) ≤ |1 - t| := by ++ have : (1 : ℝ) ≤ t - 1 := by linarith ++ have : (1 : ℝ) ≤ |t - 1| := by ++ simpa [abs_of_nonneg (by linarith : 0 ≤ t - 1)] using this ++ simpa [abs_sub_comm] using this ++ exact phi_eq_zero_of_one_le_abs_one_sub hden ++ ++lemma intervalIntegrable_phi_dyadic_small {A : ℝ} (hA0 : 0 ≤ A) ++ (hA : A ≤ (1 / 4 : ℝ)) : ++ IntervalIntegrable φ volume A (2 * A) := by ++ have hA_le : A ≤ 2 * A := by nlinarith ++ have hconst : IntervalIntegrable (fun _ : ℝ => (Real.log 2 : ℝ)) volume A (2 * A) := ++ intervalIntegrable_const ++ have hmeas : ++ AEStronglyMeasurable (fun t : ℝ => φ t) (volume.restrict (Set.uIoc A (2 * A))) := ++ (measurable_phi.aestronglyMeasurable : _) ++ have hdom : ++ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A (2 * A)))] ++ fun _ => ‖(Real.log 2 : ℝ)‖ := by ++ refine ae_restrict_norm_phi_le_of_forall_mem (A := A) (B := 2 * A) hA_le ++ (g := fun _ => (Real.log 2 : ℝ)) (hg := fun _ => ?_) ?_ ++ · simpa using (Real.log_nonneg (by norm_num : (1 : ℝ) ≤ 2)) ++ · intro t ht ++ exact phi_le_log_two_on_dyadic_of_le_quarter hA ht ++ exact IntervalIntegrable.mono_fun hconst hmeas hdom ++ ++lemma intervalIntegrable_phi_dyadic_large {A : ℝ} (hA : (2 : ℝ) ≤ A) : ++ IntervalIntegrable φ volume A (2 * A) := by ++ have hA_le : A ≤ 2 * A := by nlinarith ++ have hEq : Set.EqOn (fun t : ℝ => φ t) (fun _ => (0 : ℝ)) (Set.uIoc A (2 * A)) := by ++ intro t ht ++ have htIoc : t ∈ Set.Ioc A (2 * A) := by ++ simpa [Set.uIoc_of_le hA_le] using ht ++ exact phi_eq_zero_of_two_le (le_trans hA (le_of_lt htIoc.1)) ++ have hz : IntervalIntegrable (fun _ : ℝ => (0 : ℝ)) volume A (2 * A) := ++ intervalIntegrable_const ++ exact (IntervalIntegrable.congr (a := A) (b := (2 * A)) ++ (μ := (volume : MeasureTheory.Measure ℝ)) ++ (f := fun _ => (0 : ℝ)) (g := fun t => φ t) (by ++ intro t ht ++ simpa using (hEq (x := t) ht).symm)) hz ++ ++lemma intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle {A : ℝ} ++ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume A (2 * A) := by ++ have hsqrt_big : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) ++ (volume : MeasureTheory.Measure ℝ) (1 / 4 : ℝ) (4 : ℝ) := ++ intervalIntegrable_sqrt_two_div_abs_one_sub_Icc ++ refine hsqrt_big.mono_set ?_ ++ refine Set.uIcc_subset_uIcc ?_ ?_ ++ · exact (Set.mem_uIcc).2 (Or.inl ⟨hA_lower, by nlinarith [hA_upper]⟩) ++ · exact (Set.mem_uIcc).2 (Or.inl ⟨by nlinarith [hA_lower], by nlinarith [hA_upper]⟩) ++ ++lemma intervalIntegrable_phi_dyadic_middle {A : ℝ} ++ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : ++ IntervalIntegrable φ volume A (2 * A) := by ++ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] ++ have hsqrt : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume A (2 * A) := ++ intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle hA_lower hA_upper ++ have hmeas : ++ AEStronglyMeasurable (fun t : ℝ => φ t) (volume.restrict (Set.uIoc A (2 * A))) := ++ (measurable_phi.aestronglyMeasurable : _) ++ have hdom : ++ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A (2 * A)))] ++ fun t => ‖Real.sqrt (2 / |1 - t|)‖ := by ++ refine ae_restrict_norm_phi_le_of_forall_mem (A := A) (B := 2 * A) hA_le ++ (g := fun t => Real.sqrt (2 / |1 - t|)) (hg := fun _ => Real.sqrt_nonneg _) ?_ ++ intro t _ht ++ exact φ_le_sqrt t ++ exact IntervalIntegrable.mono_fun hsqrt hmeas hdom ++ ++lemma intervalIntegrable_phi_dyadic {A : ℝ} (hA : 0 ≤ A) : ++ IntervalIntegrable φ volume A (2 * A) := by ++ by_cases hA0 : A = 0 ++ · subst hA0 ++ simp ++ cases le_total A (1 / 4 : ℝ) with ++ | inl hsmall => ++ exact intervalIntegrable_phi_dyadic_small hA hsmall ++ | inr hge_quarter => ++ cases le_total (2 : ℝ) A with ++ | inl hbig => ++ exact intervalIntegrable_phi_dyadic_large hbig ++ | inr hA_le_two => ++ exact intervalIntegrable_phi_dyadic_middle hge_quarter hA_le_two ++ ++lemma intervalIntegrable_phi_div {a R : ℝ} (ha : 0 < a) (hR : 0 ≤ R) : ++ IntervalIntegrable (fun r : ℝ => φ (r / a)) volume R (2 * R) := by ++ have ha0 : a ≠ 0 := ne_of_gt ha ++ have hRa_nonneg : 0 ≤ R / a := by ++ exact div_nonneg hR (le_of_lt ha) ++ have hφ : IntervalIntegrable φ volume (R / a) (2 * (R / a)) := ++ intervalIntegrable_phi_dyadic (A := (R / a)) hRa_nonneg ++ have := (hφ.comp_mul_right (c := (a⁻¹ : ℝ))) ++ have hupper : a * (R * (a⁻¹ * 2)) = (2 * R) := by ++ field_simp [ha0] ++ simpa [div_eq_mul_inv, ha0, hupper, mul_assoc, mul_left_comm, mul_comm] using this ++ ++lemma log_two_le_Cφ : Real.log 2 ≤ Cφ := by ++ dsimp [Cφ] ++ have hK : 0 ≤ K := K_nonneg ++ linarith [hK] ++ ++lemma four_mul_K_add_one_le_Cφ : (4 * K + 1 : ℝ) ≤ Cφ := by ++ dsimp [Cφ] ++ have hlog_nonneg : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) ++ linarith [hlog_nonneg] ++ ++lemma integral_phi_le_Cφ_mul_small {A : ℝ} (hA0 : 0 ≤ A) (hA : A ≤ (1 / 4 : ℝ)) : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by ++ have hA_le : A ≤ 2 * A := by nlinarith ++ have hφ_int : IntervalIntegrable φ volume A (2 * A) := ++ intervalIntegrable_phi_dyadic_small hA0 hA ++ have hconst : IntervalIntegrable (fun _ : ℝ => (Real.log 2 : ℝ)) volume A (2 * A) := ++ intervalIntegrable_const ++ have hle_int : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ++ ≤ ∫ (t : ℝ) in A..(2 * A), (Real.log 2 : ℝ) ∂volume := by ++ refine intervalIntegral.integral_mono_on (μ := (volume : MeasureTheory.Measure ℝ)) ++ hA_le hφ_int hconst ?_ ++ intro t ht ++ exact phi_le_log_two_on_dyadic_of_le_quarter hA ht ++ have hRHS : ++ (∫ (t : ℝ) in A..(2 * A), (Real.log 2 : ℝ) ∂volume) = A * Real.log 2 := by ++ simp [intervalIntegral.integral_const, sub_eq_add_neg, add_assoc, two_mul] ++ have hcoef : A * Real.log 2 ≤ Cφ * A := by ++ have := mul_le_mul_of_nonneg_left log_two_le_Cφ hA0 ++ simpa [mul_assoc, mul_left_comm, mul_comm] using this ++ exact le_trans (by simpa [hRHS] using hle_int) hcoef ++ ++lemma integral_phi_le_Cφ_mul_large {A : ℝ} (hA : (2 : ℝ) ≤ A) : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by ++ have hA_le : A ≤ 2 * A := by nlinarith ++ have hφ0 : Set.EqOn (fun t : ℝ => φ t) (fun _ => (0 : ℝ)) (Set.uIcc A (2 * A)) := by ++ intro t ht ++ have ht' : t ∈ Set.Icc A (2 * A) := by ++ simpa [Set.uIcc_of_le hA_le] using ht ++ exact phi_eq_zero_of_two_le (le_trans hA ht'.1) ++ have hzero : (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) = 0 := by ++ simpa using intervalIntegral.integral_congr (μ := (volume : MeasureTheory.Measure ℝ)) hφ0 ++ have hnonneg : (0 : ℝ) ≤ Cφ * A := mul_nonneg (le_of_lt Cφ_pos) (by linarith) ++ simpa [hzero] using hnonneg ++ ++lemma integral_sqrt_two_div_abs_one_sub_le_K_dyadic_middle {A : ℝ} ++ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : ++ (∫ (t : ℝ) in A..(2 * A), Real.sqrt (2 / |1 - t|) ∂volume) ≤ K := by ++ let s (t : ℝ) : ℝ := Real.sqrt (2 / |1 - t|) ++ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] ++ have hA_upper' : (2 * A : ℝ) ≤ 4 := by nlinarith [hA_upper] ++ have hsqrt_big : IntervalIntegrable s volume (1 / 4 : ℝ) (4 : ℝ) := by ++ simpa [s] using intervalIntegrable_sqrt_two_div_abs_one_sub_Icc ++ have hle_K : ++ (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ++ ≤ ∫ (t : ℝ) in (1 / 4 : ℝ)..(4 : ℝ), s t ∂volume := by ++ refine intervalIntegral.integral_mono_interval (μ := (volume : MeasureTheory.Measure ℝ)) ++ (c := (1 / 4 : ℝ)) (d := (4 : ℝ)) (a := A) (b := (2 * A)) ++ hA_lower hA_le hA_upper' ?_ hsqrt_big ++ exact Filter.Eventually.of_forall (fun _t => Real.sqrt_nonneg _) ++ simpa [K, s] using hle_K ++ ++lemma K_le_four_mul_K_add_one_mul_of_quarter_le {A : ℝ} (hA : (1 / 4 : ℝ) ≤ A) : ++ K ≤ (4 * K + 1) * A := by ++ have hcoef : 1 ≤ 4 * A := by nlinarith [hA] ++ have hK : 0 ≤ K := K_nonneg ++ nlinarith [hK, hcoef] ++ ++lemma integral_phi_le_Cφ_mul_middle {A : ℝ} ++ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by ++ let s (t : ℝ) : ℝ := Real.sqrt (2 / |1 - t|) ++ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] ++ have hφ_int : IntervalIntegrable φ volume A (2 * A) := ++ intervalIntegrable_phi_dyadic_middle hA_lower hA_upper ++ have hsqrt : IntervalIntegrable s volume A (2 * A) := by ++ simpa [s] using ++ intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle hA_lower hA_upper ++ have hle_int : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ++ ≤ ∫ (t : ℝ) in A..(2 * A), s t ∂volume := by ++ refine intervalIntegral.integral_mono_on ++ (μ := (volume : MeasureTheory.Measure ℝ)) hA_le hφ_int hsqrt ?_ ++ intro t _ht ++ exact φ_le_sqrt t ++ have hsqrt_le : (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ≤ (4 * K + 1) * A := by ++ have hK : (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ≤ K := by ++ simpa [s] using integral_sqrt_two_div_abs_one_sub_le_K_dyadic_middle hA_lower hA_upper ++ exact le_trans hK (K_le_four_mul_K_add_one_mul_of_quarter_le hA_lower) ++ have hcoef : (4 * K + 1 : ℝ) * A ≤ Cφ * A := ++ mul_le_mul_of_nonneg_right four_mul_K_add_one_le_Cφ (by nlinarith [hA_lower]) ++ exact le_trans hle_int (le_trans hsqrt_le hcoef) ++ ++lemma integral_phi_le_Cφ_mul {A : ℝ} (hA : 0 ≤ A) : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by ++ by_cases hA0 : A = 0 ++ · subst hA0 ++ simp [Cφ, φ, K] ++ cases le_total A (1 / 4 : ℝ) with ++ | inl hsmall => ++ exact integral_phi_le_Cφ_mul_small hA hsmall ++ | inr hge_quarter => ++ cases le_total (2 : ℝ) A with ++ | inl hbig => ++ exact integral_phi_le_Cφ_mul_large hbig ++ | inr hA_le_two => ++ exact integral_phi_le_Cφ_mul_middle hge_quarter hA_le_two ++ ++open scoped BigOperators ++ ++lemma volume_Ioc_two_mul_ne_zero {R : ℝ} (hR : 0 < R) : ++ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R)) ≠ 0 := by ++ have hpos : (0 : ℝ) < 2 * R - R := by nlinarith [hR] ++ simp [Real.volume_Ioc, ENNReal.ofReal_eq_zero, not_le_of_gt hpos] ++ ++lemma volume_Ioc_two_mul_diff_finset_ne_zero (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : ++ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by ++ have hbad_meas : (volume : MeasureTheory.Measure ℝ) (bad : Set ℝ) = 0 := by ++ simpa using (bad.measure_zero (μ := (volume : MeasureTheory.Measure ℝ))) ++ have hdiff : ++ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ++ = (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R)) := by ++ simpa [Set.sdiff_eq, Set.inter_assoc, Set.inter_left_comm, Set.inter_comm] using ++ (MeasureTheory.measure_sdiff_null (s := Set.Ioc R (2 * R)) (t := (bad : Set ℝ)) ++ hbad_meas) ++ simpa [hdiff] using volume_Ioc_two_mul_ne_zero hR ++ ++lemma restrict_volume_Ioc_two_mul_diff_finset_ne_zero (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : ++ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by ++ have hsubset : Set.Ioc R (2 * R) \ (bad : Set ℝ) ⊆ Set.Ioc R (2 * R) := by ++ intro r hr ++ exact hr.1 ++ have hinter : ++ (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ∩ Set.Ioc R (2 * R) ++ = (Set.Ioc R (2 * R) \ (bad : Set ℝ)) := by ++ exact Set.inter_eq_left.mpr hsubset ++ simpa [MeasureTheory.Measure.restrict_apply, measurableSet_Ioc, hinter] using ++ volume_Ioc_two_mul_diff_finset_ne_zero bad hR ++ ++lemma integral_phi_div_le_Cφ_mul {a R : ℝ} (ha : 0 < a) (hR : 0 ≤ R) : ++ (∫ (r : ℝ) in R..(2 * R), φ (r / a) ∂volume) ≤ Cφ * R := by ++ have ha0 : a ≠ 0 := ne_of_gt ha ++ have hrew : ++ (∫ (r : ℝ) in R..(2 * R), φ (r / a) ∂volume) ++ = a * (∫ (t : ℝ) in (R / a)..(2 * R / a), φ t ∂volume) := by ++ simp [smul_eq_mul, mul_left_comm, mul_comm, div_eq_mul_inv, ha0] ++ rw [hrew] ++ have hA : 0 ≤ R / a := by ++ exact div_nonneg hR ha.le ++ have hle : (∫ (t : ℝ) in (R / a)..(2 * (R / a)), φ t ∂volume) ≤ Cφ * (R / a) := ++ integral_phi_le_Cφ_mul (A := R / a) hA ++ have hEq : (2 * R / a) = 2 * (R / a) := by ring ++ have hle' : ++ (∫ (t : ℝ) in (R / a)..(2 * R / a), φ t ∂volume) ≤ Cφ * (R / a) := by ++ simpa [hEq] using hle ++ have ha_nonneg : 0 ≤ a := ha.le ++ have := mul_le_mul_of_nonneg_left hle' ha_nonneg ++ have hRHS : a * (Cφ * (R / a)) = Cφ * R := by ++ field_simp [ha0] ++ simpa [hRHS, mul_assoc, mul_left_comm, mul_comm] using this ++ ++lemma intervalIntegrable_sum_mul_phi_div ++ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) ++ (ha : ∀ i ∈ s, 0 < a i) {R : ℝ} (hR : 0 ≤ R) : ++ IntervalIntegrable (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) ++ volume R (2 * R) := by ++ refine IntervalIntegrable.sum (μ := volume) (a := R) (b := 2 * R) ++ (s := s) (f := fun i : ι => fun r : ℝ => w i * φ (r / a i)) ?_ ++ intro i hi ++ have hφi : IntervalIntegrable (fun r : ℝ => φ (r / a i)) volume R (2 * R) := ++ intervalIntegrable_phi_div (a := a i) (R := R) (ha i hi) hR ++ simpa [mul_assoc] using hφi.const_mul (w i) ++ ++lemma integral_sum_mul_phi_div_le_Cφ_mul_sum ++ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) ++ (hw : ∀ i ∈ s, 0 ≤ w i) (ha : ∀ i ∈ s, 0 < a i) {R : ℝ} (hR : 0 ≤ R) : ++ (∫ r in R..(2 * R), (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) r ∂volume) ++ ≤ Cφ * (∑ i ∈ s, w i) * R := by ++ have hint : ∀ i ∈ s, IntervalIntegrable (fun r : ℝ => w i * φ (r / a i)) ++ volume R (2 * R) := by ++ intro i hi ++ have hφi : IntervalIntegrable (fun r : ℝ => φ (r / a i)) volume R (2 * R) := ++ intervalIntegrable_phi_div (a := a i) (R := R) (ha i hi) hR ++ simpa [mul_assoc] using hφi.const_mul (w i) ++ have hsum_int : ++ (∫ r in R..(2 * R), (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) r ∂volume) ++ = ∑ i ∈ s, ∫ r in R..(2 * R), (fun r : ℝ => w i * φ (r / a i)) r ++ ∂volume := by ++ simpa using ++ (intervalIntegral.integral_finsetSum (μ := volume) (a := R) (b := 2 * R) ++ (s := s) (f := fun i : ι => fun r : ℝ => w i * φ (r / a i)) hint) ++ rw [hsum_int] ++ have hsum_le : ++ (∑ i ∈ s, ∫ r in R..(2 * R), (fun r : ℝ => w i * φ (r / a i)) r ∂volume) ++ ≤ ∑ i ∈ s, w i * (Cφ * R) := by ++ refine Finset.sum_le_sum ?_ ++ intro i hi ++ have hphi : ++ (∫ r in R..(2 * R), φ (r / a i) ∂volume) ≤ Cφ * R := ++ integral_phi_div_le_Cφ_mul (a := a i) (R := R) (ha i hi) hR ++ have := mul_le_mul_of_nonneg_left hphi (hw i hi) ++ simpa [mul_assoc, mul_left_comm, mul_comm] using this ++ refine le_trans hsum_le ?_ ++ have : (∑ i ∈ s, w i * (Cφ * R)) = Cφ * (∑ i ∈ s, w i) * R := by ++ calc ++ (∑ i ∈ s, w i * (Cφ * R)) = (∑ i ∈ s, w i) * (Cφ * R) := by ++ simp [Finset.sum_mul] ++ _ = Cφ * (∑ i ∈ s, w i) * R := by ++ ac_rfl ++ exact le_of_eq this ++ ++lemma exists_radius_Ioc_sum_mul_phi_div_le_Cφ_mul_sum_avoid ++ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) ++ (hw : ∀ i ∈ s, 0 ≤ w i) (ha : ∀ i ∈ s, 0 < a i) ++ (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : ++ ∃ r ∈ Set.Ioc R (2 * R), r ∉ bad ∧ ++ (∑ i ∈ s, w i * φ (r / a i)) ≤ Cφ * (∑ i ∈ s, w i) := by ++ by_contra hbad ++ have hforall : ++ ∀ r ∈ Set.Ioc R (2 * R), r ∉ bad → ++ Cφ * (∑ i ∈ s, w i) < (∑ i ∈ s, w i * φ (r / a i)) := by ++ intro r hr hrbad ++ have : ¬(∑ i ∈ s, w i * φ (r / a i)) ≤ Cφ * (∑ i ∈ s, w i) := by ++ intro hle ++ exact hbad ⟨r, hr, hrbad, hle⟩ ++ exact lt_of_not_ge this ++ let g : ℝ → ℝ := ∑ i ∈ s, fun r : ℝ => w i * φ (r / a i) ++ have hg_int : IntervalIntegrable g volume R (2 * R) := by ++ simpa [g] using intervalIntegrable_sum_mul_phi_div s w a ha hR.le ++ have hconst_int : ++ IntervalIntegrable (fun _r : ℝ => Cφ * (∑ i ∈ s, w i)) volume R (2 * R) := ++ intervalIntegrable_const ++ have hlt_meas : ++ (volume.restrict (Set.Ioc R (2 * R))) ++ {r | Cφ * (∑ i ∈ s, w i) < g r} ≠ 0 := by ++ have hall : Set.Ioc R (2 * R) \ (bad : Set ℝ) ⊆ {r | Cφ * (∑ i ∈ s, w i) < g r} := by ++ intro r hr ++ have hrIoc : r ∈ Set.Ioc R (2 * R) := hr.1 ++ have hrbad : r ∉ bad := by simpa using hr.2 ++ simpa [g] using hforall r hrIoc hrbad ++ have hle : ++ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ++ ≤ (volume.restrict (Set.Ioc R (2 * R))) {r | Cφ * (∑ i ∈ s, w i) < g r} := ++ MeasureTheory.measure_mono hall ++ have hpos' : ++ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by ++ exact restrict_volume_Ioc_two_mul_diff_finset_ne_zero bad hR ++ intro hzero ++ have : (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) = 0 := ++ le_antisymm (le_trans hle (le_of_eq hzero)) (by positivity) ++ exact hpos' this ++ have hlt_int : ++ (∫ r in R..(2 * R), (Cφ * (∑ i ∈ s, w i)) ∂volume) ++ < ∫ r in R..(2 * R), g r ∂volume := by ++ have hab : R ≤ 2 * R := by nlinarith [hR.le] ++ refine intervalIntegral.integral_lt_integral_of_ae_le_of_measure_setOfPred_lt_ne_zero (μ := volume) ++ (a := R) (b := 2 * R) (f := fun _ => (Cφ * (∑ i ∈ s, w i))) (g := g) ++ hab hconst_int hg_int ?_ hlt_meas ++ have hmem : ∀ᵐ r ∂ (volume.restrict (Set.Ioc R (2 * R))), r ∈ Set.Ioc R (2 * R) := ++ MeasureTheory.ae_restrict_mem (by simp) ++ have hnotBad : ++ ∀ᵐ r ∂ (volume.restrict (Set.Ioc R (2 * R))), r ∉ (bad : Set ℝ) := by ++ simpa using ++ (bad.finite_toSet.countable.ae_notMem (μ := (volume.restrict (Set.Ioc R (2 * R))))) ++ filter_upwards [hmem, hnotBad] with r hrIoc hrNotBad ++ have hrNotBad' : r ∉ bad := by simpa using hrNotBad ++ exact le_of_lt (by simpa [g] using hforall r hrIoc hrNotBad') ++ have hconst_eval : ++ (∫ r in R..(2 * R), (Cφ * (∑ i ∈ s, w i)) ∂volume) = Cφ * (∑ i ∈ s, w i) * R := by ++ simp [intervalIntegral.integral_const, sub_eq_add_neg, mul_comm] ++ ring ++ have hg_le : ++ (∫ r in R..(2 * R), g r ∂volume) ≤ Cφ * (∑ i ∈ s, w i) * R := by ++ simpa [g] using integral_sum_mul_phi_div_le_Cφ_mul_sum s w a hw ha hR.le ++ have : ¬(Cφ * (∑ i ∈ s, w i) * R < Cφ * (∑ i ∈ s, w i) * R) := lt_irrefl _ ++ have hcontra : Cφ * (∑ i ∈ s, w i) * R < Cφ * (∑ i ∈ s, w i) * R := by ++ have := hlt_int ++ simpa [hconst_eval] using (this.trans_le hg_le) ++ exact this hcontra ++ ++end CartanBound ++end Complex ++end HadamardSourceScope26 ++ ++section HadamardSourceScope27 ++ ++noncomputable section ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++open _root_.Complex _root_.Erdos970.Complex _root_.Real _root_.Erdos970.Real ++ ++lemma max_one_norm_div_pow_le_one_add_rpow ++ {m : ℕ} {τ r : ℝ} {u a : ℂ} ++ (hur : ‖u‖ = r) ++ (hmτ : (m : ℝ) ≤ τ) : ++ max 1 (‖u / a‖ ^ m) ≤ 1 + (r / ‖a‖) ^ τ := by ++ by_cases hx : ‖u / a‖ ≤ 1 ++ · have hpowm_le1 : ‖u / a‖ ^ m ≤ 1 := pow_le_one₀ (norm_nonneg (u / a)) hx ++ have hr0 : 0 ≤ r := by simpa [hur] using (norm_nonneg u) ++ have hbase : 0 ≤ r / ‖a‖ := div_nonneg hr0 (norm_nonneg a) ++ have hnonneg : 0 ≤ (r / ‖a‖) ^ τ := Real.rpow_nonneg hbase τ ++ have hle1 : (1 : ℝ) ≤ 1 + (r / ‖a‖) ^ τ := le_add_of_nonneg_right hnonneg ++ have hle2 : ‖u / a‖ ^ m ≤ 1 + (r / ‖a‖) ^ τ := hpowm_le1.trans hle1 ++ exact (max_le_iff).2 ⟨hle1, hle2⟩ ++ · have hx1 : 1 < ‖u / a‖ := lt_of_not_ge hx ++ have hpow : ++ (‖u / a‖ : ℝ) ^ (m : ℝ) ≤ (‖u / a‖ : ℝ) ^ τ := ++ Real.rpow_le_rpow_of_exponent_le (le_of_lt hx1) hmτ ++ have hpow' : ‖u / a‖ ^ m ≤ (‖u / a‖ : ℝ) ^ τ := by ++ simpa [Real.rpow_natCast] using hpow ++ have hmax_add : max 1 (‖u / a‖ ^ m) ≤ 1 + ‖u / a‖ ^ m := by ++ refine max_le (le_add_of_nonneg_right (by positivity)) (le_add_of_nonneg_left (by positivity)) ++ have : max 1 (‖u / a‖ ^ m) ≤ 1 + (‖u / a‖ : ℝ) ^ τ := ++ hmax_add.trans (by nlinarith [hpow']) ++ simpa [norm_div, hur] using this ++ ++lemma norm_inv_weierstrassFactor_le_exp_near ++ {m : ℕ} {τ r : ℝ} {u a : ℂ} ++ (hur : ‖u‖ = r) (ha : a ≠ 0) (hr : r ≠ ‖a‖) ++ (hmτ : (m : ℝ) ≤ τ) : ++ ‖(weierstrassFactor m (u / a))⁻¹‖ ++ ≤ Real.exp (CartanBound.φ (r / ‖a‖) + (m : ℝ) * (1 + (r / ‖a‖) ^ τ)) := by ++ have hlog_one : ++ Real.log ‖(1 : ℂ) - u / a‖ ≥ -CartanBound.φ (r / ‖a‖) := ++ CartanBound.log_norm_one_sub_div_ge_neg_phi (hur := hur) (ha := ha) (hr := hr) ++ have hbase := ++ log_norm_weierstrassFactor_ge_log_norm_one_sub_sub (m := m) (z := (u / a)) ++ have hlogE : ++ Real.log ‖weierstrassFactor m (u / a)‖ ++ ≥ -CartanBound.φ (r / ‖a‖) - (m : ℝ) * max 1 (‖u / a‖ ^ m) := by ++ have hpls := ++ norm_partialLogSum_le_nat_mul_max_one_norm_pow m (u / a) ++ linarith [hbase, hlog_one, hpls] ++ have hmax : ++ max 1 (‖u / a‖ ^ m) ≤ 1 + (r / ‖a‖) ^ τ := ++ max_one_norm_div_pow_le_one_add_rpow (m := m) (τ := τ) (r := r) (u := u) (a := a) hur hmτ ++ have hneglog : ++ -Real.log ‖weierstrassFactor m (u / a)‖ ++ ≤ CartanBound.φ (r / ‖a‖) + (m : ℝ) * (1 + (r / ‖a‖) ^ τ) := by ++ have : -Real.log ‖weierstrassFactor m (u / a)‖ ++ ≤ CartanBound.φ (r / ‖a‖) + (m : ℝ) * max 1 (‖u / a‖ ^ m) := by ++ linarith [hlogE] ++ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ exact this.trans (by nlinarith [mul_le_mul_of_nonneg_left hmax hm0]) ++ have hpos : 0 < ‖weierstrassFactor m (u / a)‖ := by ++ have : weierstrassFactor m (u / a) ≠ 0 := by ++ intro h0 ++ have : u / a = (1 : ℂ) := (weierstrassFactor_eq_zero_iff m (u / a)).1 h0 ++ have : u = a := (div_eq_one_iff_eq ha).1 this ++ have : r = ‖a‖ := by simpa [this] using hur.symm ++ exact (hr this).elim ++ exact norm_pos_iff.2 this ++ have hEq : ++ ‖(weierstrassFactor m (u / a))⁻¹‖ = ++ Real.exp (-Real.log ‖weierstrassFactor m (u / a)‖) := by ++ simp [norm_inv, Real.exp_neg, Real.exp_log hpos] ++ have := Real.exp_le_exp.2 hneglog ++ simpa [hEq] using this ++ ++lemma norm_inv_weierstrassFactor_le_exp_far ++ {m : ℕ} {τ r : ℝ} {u a : ℂ} ++ (hur : ‖u‖ = r) (ha : a ≠ 0) ++ (hz : ‖u / a‖ ≤ (1 / 2 : ℝ)) (hτ_le : τ ≤ (m + 1 : ℝ)) : ++ ‖(weierstrassFactor m (u / a))⁻¹‖ ≤ Real.exp ((2 : ℝ) * (r / ‖a‖) ^ τ) := by ++ by_cases hu : u = 0 ++ · subst hu ++ have hr0 : r = 0 := by simpa [hur] using (norm_zero : ‖(0 : ℂ)‖ = 0) ++ subst hr0 ++ have h0 : 0 ≤ ((0 : ℝ) / ‖a‖) ^ τ := by ++ exact Real.rpow_nonneg (by positivity : (0 : ℝ) ≤ 0 / ‖a‖) τ ++ have h0' : 0 ≤ (2 : ℝ) * ((0 : ℝ) / ‖a‖) ^ τ := mul_nonneg (by norm_num) h0 ++ have hexp : (1 : ℝ) ≤ Real.exp ((2 : ℝ) * ((0 : ℝ) / ‖a‖) ^ τ) := ++ (Real.one_le_exp_iff).2 h0' ++ simpa using hexp ++ have hlogE := ++ log_norm_weierstrassFactor_ge_neg_two_pow (m := m) (z := (u / a)) hz ++ have hneglog : -Real.log ‖weierstrassFactor m (u / a)‖ ≤ (2 : ℝ) * (r / ‖a‖) ^ τ := by ++ have h1 : -Real.log ‖weierstrassFactor m (u / a)‖ ≤ (2 : ℝ) * ‖u / a‖ ^ (m + 1) := by ++ linarith [hlogE] ++ set x : ℝ := ‖u / a‖ ++ have hx1 : x ≤ 1 := le_trans (by simpa [x] using hz) (by norm_num) ++ have hxpos : 0 < x := by ++ simpa [x] using (norm_pos_iff.2 (div_ne_zero hu ha)) ++ have hτ_le' : τ ≤ ((m + 1 : ℕ) : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one] using hτ_le ++ have hpow_rpow : x ^ ((m + 1 : ℕ) : ℝ) ≤ x ^ τ := ++ Real.rpow_le_rpow_of_exponent_ge hxpos hx1 hτ_le' ++ have hpow : x ^ (m + 1) ≤ x ^ τ := by ++ simpa [← Real.rpow_natCast] using hpow_rpow ++ have h2x : (2 : ℝ) * x ^ (m + 1) ≤ (2 : ℝ) * x ^ τ := ++ mul_le_mul_of_nonneg_left hpow (by positivity) ++ have h2 : (2 : ℝ) * ‖u / a‖ ^ (m + 1) ≤ (2 : ℝ) * (‖u / a‖ : ℝ) ^ τ := by ++ simpa [x] using h2x ++ have h3 : (‖u‖ / ‖a‖) ^ τ = (r / ‖a‖) ^ τ := by ++ simp [hur] ++ exact (h1.trans h2).trans_eq (by simp [h3]) ++ have hpos : 0 < ‖weierstrassFactor m (u / a)‖ := by ++ have : weierstrassFactor m (u / a) ≠ 0 := by ++ intro h0 ++ have : u / a = (1 : ℂ) := (weierstrassFactor_eq_zero_iff m (u / a)).1 h0 ++ have : u = a := (div_eq_one_iff_eq ha).1 this ++ have : (‖u / a‖ : ℝ) = 1 := by simpa [this] using (by simp [ha]) ++ linarith [hz, this] ++ exact norm_pos_iff.2 this ++ have hEq : ++ ‖(weierstrassFactor m (u / a))⁻¹‖ = ++ Real.exp (-Real.log ‖weierstrassFactor m (u / a)‖) := by ++ simp [norm_inv, Real.exp_neg, Real.exp_log hpos] ++ have := Real.exp_le_exp.2 hneglog ++ simpa [hEq] using this ++ ++end Complex.Hadamard ++end ++end HadamardSourceScope27 ++ ++section HadamardSourceScope28 ++ ++noncomputable section ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++open scoped BigOperators ++open Filter Finset _root_.Real _root_.Erdos970.Real Topology ++ ++section CartanFiniteSum ++ ++variable {α : Type*} ++ ++private lemma summable_ite_mem_finset [DecidableEq α] (s : Finset α) (u : α → ℝ) : ++ Summable (fun a => if a ∈ s then u a else 0) := ++ summable_of_ne_finset_zero (s := s) fun a ha => by simp [ite_eq_right ha] ++ ++private lemma tsum_ite_mem_finset [DecidableEq α] (s : Finset α) (u : α → ℝ) : ++ (∑' a, if a ∈ s then u a else 0) = ∑ a ∈ s, u a := by ++ classical ++ simpa [Finset.sum_ite] using ++ (hasSum_sum_of_ne_finset_zero (s := s) (f := fun a => if a ∈ s then u a else 0) ++ fun a ha => by simp [ite_eq_right ha]).tsum_eq ++ ++private lemma tsum_add_four (u₁ u₂ u₃ u₄ : α → ℝ) ++ (h₁ : Summable u₁) (h₂ : Summable u₂) (h₃ : Summable u₃) (h₄ : Summable u₄) : ++ tsum (fun a => ((u₁ a + u₂ a) + u₃ a) + u₄ a) ++ = tsum u₁ + tsum u₂ + tsum u₃ + tsum u₄ := by ++ calc ++ tsum (fun a => ((u₁ a + u₂ a) + u₃ a) + u₄ a) ++ = tsum (fun a => (u₁ a + u₂ a) + (u₃ a + u₄ a)) := by ++ simp [add_comm, add_left_comm] ++ _ = tsum (fun a => u₁ a + u₂ a) + tsum (fun a => u₃ a + u₄ a) := ++ Summable.tsum_add (h₁.add h₂) (h₃.add h₄) ++ _ = tsum u₁ + tsum u₂ + tsum u₃ + tsum u₄ := by ++ rw [Summable.tsum_add h₁ h₂, Summable.tsum_add h₃ h₄] ++ ring ++ ++end CartanFiniteSum ++ ++noncomputable def cartanProductConstant (m : ℕ) (τ Sτ : ℝ) : ℝ := ++ ((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 3) * (Sτ + 1) ++ ++lemma cartanProductConstant_nonneg {m : ℕ} {τ Sτ : ℝ} (hSτ : 0 ≤ Sτ) : ++ 0 ≤ cartanProductConstant m τ Sτ := by ++ have hS : 0 ≤ Sτ + 1 := by linarith ++ have hA : 0 ≤ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 3 := by ++ have hCφ : 0 ≤ CartanBound.Cφ := le_of_lt CartanBound.Cφ_pos ++ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ have h4τ : 0 ≤ (4 : ℝ) ^ τ := by positivity ++ nlinarith [hCφ, hm0, h4τ] ++ simpa [cartanProductConstant] using mul_nonneg hA hS ++ ++lemma rpow_div_norm_divisorZeroIndex₀_eq ++ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : ++ (r / ‖divisorZeroIndex₀Val p‖) ^ τ = ++ (r ^ τ) * ((‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) := by ++ have hp : 0 ≤ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) := by positivity ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using ++ (Real.mul_rpow (x := r) (y := (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ)) (z := τ) hr hp) ++ ++lemma tsum_rpow_div_norm_divisorZeroIndex₀_eq ++ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ = (r ^ τ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ calc ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ = ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by ++ refine tsum_congr ?_ ++ intro p ++ exact rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p ++ _ = (r ^ τ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ simp [tsum_mul_left] ++ ++lemma tsum_two_mul_rpow_div_norm_divisorZeroIndex₀_le ++ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) (hτ_nonneg : 0 ≤ τ) : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ ≤ (2 : ℝ) * ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) * (1 + r) ^ τ := by ++ set Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ have htsum : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ = (2 : ℝ) * (r ^ τ) * Sτ := by ++ calc ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ = (2 : ℝ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (r / ‖divisorZeroIndex₀Val p‖) ^ τ := by ++ simp [tsum_mul_left] ++ _ = (2 : ℝ) * ((r ^ τ) * Sτ) := by ++ rw [tsum_rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr] ++ _ = (2 : ℝ) * (r ^ τ) * Sτ := by ring ++ have hSτ_nonneg : 0 ≤ Sτ := ++ tsum_nonneg (fun _ => Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _) ++ have h1r : r ^ τ ≤ (1 + r) ^ τ := ++ Real.rpow_le_rpow (by positivity) (by linarith) hτ_nonneg ++ have hS : Sτ ≤ Sτ + 1 := by linarith ++ have hle : (r ^ τ) * Sτ ≤ (1 + r) ^ τ * (Sτ + 1) := ++ mul_le_mul h1r hS (by linarith) (by positivity) ++ rw [htsum] ++ have : (2 : ℝ) * (r ^ τ) * Sτ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by ++ nlinarith [hle] ++ simpa [Sτ, mul_assoc, mul_left_comm, mul_comm] using this ++ ++lemma sum_rpow_div_norm_divisorZeroIndex₀_le ++ {f : ℂ → ℂ} {r τ : ℝ} (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hr : 0 ≤ r) (hτ_nonneg : 0 ≤ τ) ++ (hsumτ : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : ++ (∑ p ∈ small, (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ ≤ ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) * (1 + r) ^ τ := by ++ set Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ have hsum_inv : ++ (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ≤ Sτ := by ++ have hnn : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ 0 ≤ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by ++ intro p ++ positivity ++ simpa [Sτ] using ++ (Summable.sum_le_tsum (s := small) ++ (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ++ (fun p _ => hnn p) hsumτ) ++ have hsum_eq : ++ ∑ p ∈ small, (r / ‖divisorZeroIndex₀Val p‖) ^ τ = ++ (r ^ τ) * ∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by ++ simp [rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr, Finset.mul_sum] ++ have h1r : r ^ τ ≤ (1 + r) ^ τ := ++ Real.rpow_le_rpow (by positivity) (by linarith) hτ_nonneg ++ have hS : (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ≤ Sτ + 1 := by ++ linarith [hsum_inv] ++ have hle : ++ (r ^ τ) * (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ++ ≤ (1 + r) ^ τ * (Sτ + 1) := ++ mul_le_mul h1r hS (by positivity) (by positivity) ++ simpa [Sτ, hsum_eq, mul_assoc, mul_left_comm, mul_comm] using hle ++ ++lemma add_four_le_add_two_mul_of_le {x₁ x₂ x₃ x₄ A B C : ℝ} ++ (h₁ : x₁ ≤ A) (h₂ : x₂ ≤ B) (h₃ : x₃ ≤ B) (h₄ : x₄ ≤ C) : ++ x₁ + x₂ + x₃ + x₄ ≤ A + 2 * B + C := by ++ nlinarith ++ ++lemma cartan_majorant_four_term_bound ++ {xφ x0 xm xt Cφ m q Y T : ℝ} ++ (hφ : xφ ≤ Cφ * q * Y * T) ++ (h0 : x0 ≤ m * q * Y * T) ++ (hm : xm ≤ m * q * Y * T) ++ (ht : xt ≤ (2 : ℝ) * Y * T) : ++ xφ + x0 + xm + xt ≤ (Cφ + (2 : ℝ) * m) * q * Y * T + (2 : ℝ) * Y * T := by ++ have h := ++ add_four_le_add_two_mul_of_le hφ h0 hm ht ++ have hring : ++ Cφ * (q * (Y * T)) + 2 * (m * (q * (Y * T))) + 2 * (Y * T) ++ = (Cφ + (2 : ℝ) * m) * (q * (Y * T)) + (2 : ℝ) * (Y * T) := by ++ ring ++ simpa [mul_assoc, hring] using h ++ ++lemma cartan_majorant_add_two_factor (A Y T : ℝ) : ++ A * Y * T + (2 : ℝ) * Y * T = ((A + 2) * Y) * T := by ++ ring ++ ++lemma cartan_majorant_pad_two_to_three {A S T : ℝ} (hS : 0 ≤ S + 1) (hT : 0 ≤ T) : ++ ((A + 2) * (S + 1)) * T ≤ ((A + 3) * (S + 1)) * T := by ++ have h : (A + 2) * (S + 1) ≤ (A + 3) * (S + 1) := by ++ nlinarith ++ exact mul_le_mul_of_nonneg_right h hT ++ ++lemma cartan_majorant_nonneg ++ {f : ℂ → ℂ} {m : ℕ} {τ r : ℝ} (hr : 0 ≤ r) ++ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : ++ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ ∀ p, 0 ≤ b p := by ++ classical ++ dsimp ++ intro p ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun q => ‖divisorZeroIndex₀Val q‖ ++ have hap : ap p = ‖divisorZeroIndex₀Val p‖ := rfl ++ by_cases hp : p ∈ small ++ · have hφ : 0 ≤ CartanBound.φ (r / ap p) := CartanBound.φ_nonneg (t := r / ap p) ++ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ have h1 : 0 ≤ (1 + (r / ap p) ^ τ) := by positivity ++ have : 0 ≤ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) := by ++ nlinarith [hφ, hm0, h1] ++ simpa [hap, hp, ap] using this ++ · have hbase : 0 ≤ r / ap p := div_nonneg hr (by positivity) ++ have hpow : 0 ≤ (r / ap p) ^ τ := Real.rpow_nonneg hbase τ ++ have : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := mul_nonneg (by norm_num) hpow ++ simpa [hap, hp, ap] using this ++ ++lemma cartan_majorant_summable ++ {f : ℂ → ℂ} {m : ℕ} {τ r : ℝ} (hr : 0 ≤ r) ++ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsumτ : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : ++ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ Summable b := by ++ classical ++ dsimp ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun q => ‖divisorZeroIndex₀Val q‖ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ have hb : Summable b := by ++ let b₁ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else 0 ++ let b₂ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => if p ∈ small then 0 else (2 : ℝ) * (r / ap p) ^ τ ++ have hb_decomp : b = fun p => b₁ p + b₂ p := by ++ funext p ++ by_cases hp : p ∈ small <;> simp [b, b₁, b₂, hp] ++ have hb₁ : Summable b₁ := by ++ simpa [b₁] using ++ summable_ite_mem_finset small ++ (fun p => CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ)) ++ have hb₂ : Summable b₂ := by ++ have hconst : ++ Summable (fun p => ++ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) := ++ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) ++ refine Summable.of_nonneg_of_le ++ (fun p => by ++ by_cases hp : p ∈ small ++ · simp [b₂, hp] ++ · have : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := by positivity ++ simpa [b₂, hp] using this) ++ (fun p => ?_) hconst ++ by_cases hp : p ∈ small ++ · have : 0 ≤ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by positivity ++ simpa [b₂, hp] using this ++ · have hrpow : (r / ap p) ^ τ = (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by ++ simpa [ap] using rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p ++ simp [b₂, hp, hrpow, mul_assoc, mul_left_comm, mul_comm] ++ simpa [hb_decomp] using hb₁.add hb₂ ++ refine hb.congr ?_ ++ intro p ++ by_cases hp : p ∈ small <;> simp [b, ap, hp] ++ ++lemma cartan_card_small_le ++ {f : ℂ → ℂ} {τ R : ℝ} (hRpos : 0 < R) (hτ_nonneg : 0 ≤ τ) ++ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsmall : ∀ p ∈ small, ‖divisorZeroIndex₀Val p‖ ≤ 4 * R) ++ (hsumτ : ++ Summable ++ (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : ++ (small.card : ℝ) ++ ≤ (4 * R) ^ τ ++ * ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) := by ++ classical ++ set Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ have hsum_le : (∑ p ∈ small, ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) ≤ Sτ := by ++ have hnn : ++ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ 0 ≤ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ intro p ++ exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ ++ simpa [Sτ] using ++ (Summable.sum_le_tsum (s := small) ++ (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) ++ (fun p _ => hnn p) hsumτ) ++ have hgeom_sum : ++ (small.card : ℝ) ≤ ∑ p ∈ small, (4 * R) ^ τ * ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ have hcard_eq : (small.card : ℝ) = ∑ p ∈ small, (1 : ℝ) := by simp ++ rw [hcard_eq] ++ refine Finset.sum_le_sum (fun p hp => ?_) ++ have hp_le : ‖divisorZeroIndex₀Val p‖ ≤ 4 * R := hsmall p hp ++ have hap : 0 < ‖divisorZeroIndex₀Val p‖ := ++ norm_pos_iff.2 (divisorZeroIndex₀Val_ne_zero p) ++ have hbase : (1 : ℝ) ≤ (4 * R) / ‖divisorZeroIndex₀Val p‖ := by ++ exact (le_div_iff₀ hap).2 (by simpa [mul_one] using hp_le) ++ have : (1 : ℝ) ≤ ((4 * R) / ‖divisorZeroIndex₀Val p‖) ^ τ := ++ Real.one_le_rpow hbase hτ_nonneg ++ have hdiv : ++ ((4 * R) / ‖divisorZeroIndex₀Val p‖) ^ τ = ++ (4 * R) ^ τ * (‖divisorZeroIndex₀Val p‖)⁻¹ ^ τ := by ++ have h4 : 0 ≤ (4 * R : ℝ) := by nlinarith [le_of_lt hRpos] ++ have ha : 0 ≤ (‖divisorZeroIndex₀Val p‖ : ℝ)⁻¹ := by positivity ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using ++ (Real.mul_rpow (x := (4 * R : ℝ)) ++ (y := (‖divisorZeroIndex₀Val p‖ : ℝ)⁻¹) (z := τ) h4 ha) ++ have : (1 : ℝ) ≤ (4 * R) ^ τ * ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ simpa [hdiv] using this ++ exact this ++ have hgeom : ++ (small.card : ℝ) ≤ (4 * R) ^ τ * (∑ p ∈ small, ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by ++ simpa [Finset.mul_sum] using hgeom_sum ++ have hsmall_le : (small.card : ℝ) ≤ (4 * R) ^ τ * Sτ := by ++ exact hgeom.trans (mul_le_mul_of_nonneg_left hsum_le (by positivity)) ++ have hS_le : (4 * R) ^ τ * Sτ ≤ (4 * R) ^ τ * (Sτ + 1) := by ++ refine mul_le_mul_of_nonneg_left ?_ (by positivity) ++ linarith ++ have : (small.card : ℝ) ≤ (4 * R) ^ τ * (Sτ + 1) := hsmall_le.trans hS_le ++ simpa [Sτ, add_comm, add_left_comm, add_assoc, mul_assoc] using this ++ ++lemma cartan_rpow_mul_le ++ {τ R r : ℝ} (hRpos : 0 < R) (hrpos : 0 < r) (hR_le_r : R ≤ r) (hτ_nonneg : 0 ≤ τ) : ++ (4 * R) ^ τ ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ := by ++ have hR_le_1r : R ≤ 1 + r := by linarith [hR_le_r, le_of_lt hrpos] ++ have hbase0 : 0 ≤ (4 * R : ℝ) := by nlinarith [le_of_lt hRpos] ++ have : (4 * R) ^ τ ≤ (4 * (1 + r)) ^ τ := by ++ refine Real.rpow_le_rpow hbase0 ?_ hτ_nonneg ++ nlinarith [hR_le_1r] ++ have hmul : (4 * (1 + r)) ^ τ = (4 : ℝ) ^ τ * (1 + r) ^ τ := by ++ have h4 : 0 ≤ (4 : ℝ) := by norm_num ++ have h1 : 0 ≤ (1 + r : ℝ) := by positivity ++ simpa [mul_assoc] using ++ (Real.mul_rpow (x := (4 : ℝ)) (y := (1 + r : ℝ)) (z := τ) h4 h1) ++ simpa [hmul] using this ++ ++open Classical in ++theorem cartan_sum_majorant_le ++ {f : ℂ → ℂ} {m : ℕ} {τ R r : ℝ} ++ (hRpos : 0 < R) ++ (hrpos : 0 < r) ++ (hR_le_r : R ≤ r) ++ (hτ_nonneg : 0 ≤ τ) ++ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsmall_fin : smallSet.Finite) ++ (hsmallSet : ++ smallSet = {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 4 * R}) ++ (hsumτ : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) ++ (hr_phi : ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ (∑ p ∈ small, CartanBound.φ (r / a p)) ≤ CartanBound.Cφ * (small.card : ℝ)) : ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ let Sτ : ℝ := ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ let Cprod : ℝ := cartanProductConstant m τ Sτ ++ ∀ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)), ++ (∑ p ∈ s, b p) ≤ Cprod * (1 + r) ^ τ := by ++ classical ++ intro small ap b Sτ Cprod s ++ have hr : 0 ≤ r := le_of_lt hrpos ++ have hSτ_nonneg : 0 ≤ Sτ := ++ tsum_nonneg (fun _ => Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _) ++ have hsmall_mem : ∀ p, p ∈ small ↔ p ∈ smallSet := by ++ intro p ++ simp [small, hsmall_fin.mem_toFinset] ++ have hphi_sum : ++ (∑ p ∈ small, CartanBound.φ (r / ap p)) ≤ CartanBound.Cφ * (small.card : ℝ) := by ++ simpa [small, ap] using hr_phi ++ have hb_nonneg : ∀ p, 0 ≤ b p := by ++ simpa [ap, b] using (cartan_majorant_nonneg (f := f) (m := m) (τ := τ) (r := r) hr small) ++ have hb_summable : Summable b := by ++ simpa [ap, b] using ++ (cartan_majorant_summable (f := f) (m := m) (τ := τ) (r := r) hr small hsumτ) ++ have hsmall_norm : ∀ p ∈ small, ‖divisorZeroIndex₀Val p‖ ≤ 4 * R := by ++ intro p hp ++ have : p ∈ smallSet := (hsmall_mem p).1 hp ++ simpa [hsmallSet] using this ++ have hcard_le : (small.card : ℝ) ≤ (4 * R) ^ τ * (Sτ + 1) := by ++ simpa [Sτ, mul_assoc, add_assoc, add_left_comm, add_comm] using ++ (cartan_card_small_le (f := f) (τ := τ) (R := R) hRpos hτ_nonneg small hsmall_norm hsumτ) ++ have hpowR : (4 * R) ^ τ ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ := ++ cartan_rpow_mul_le (τ := τ) (R := R) (r := r) hRpos hrpos hR_le_r hτ_nonneg ++ have hcard_le' : (small.card : ℝ) ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ * (Sτ + 1) := by ++ have : (4 * R) ^ τ * (Sτ + 1) ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ * (Sτ + 1) := by ++ exact mul_le_mul_of_nonneg_right hpowR (by linarith [hSτ_nonneg]) ++ exact le_trans hcard_le this ++ have hb_tsum_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) ≤ Cprod * (1 + r) ^ τ := by ++ let bφ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => if p ∈ small then CartanBound.φ (r / ap p) else 0 ++ let b0 : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => if p ∈ small then (m : ℝ) else 0 ++ let bmτ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => if p ∈ small then (m : ℝ) * (r / ap p) ^ τ else 0 ++ let bt : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (2 : ℝ) * (r / ap p) ^ τ ++ have hb_pointwise : ∀ p, b p ≤ bφ p + b0 p + bmτ p + bt p := by ++ intro p ++ by_cases hp : p ∈ small ++ · have hbase : 0 ≤ r / ap p := div_nonneg hr (by positivity) ++ have hx : 0 ≤ (r / ap p) ^ τ := Real.rpow_nonneg hbase τ ++ have hpos : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := mul_nonneg (by norm_num) hx ++ simp [b, bφ, b0, bmτ, bt, hp] ++ nlinarith ++ · simp [b, bφ, b0, bmτ, bt, hp] ++ have hmaj_summ : Summable (fun p => bφ p + b0 p + bmτ p + bt p) := by ++ have hbφ_summ : Summable bφ := by ++ simpa [bφ] using summable_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) ++ have hb0_summ : Summable b0 := by ++ simpa [b0] using summable_ite_mem_finset small (fun _ => (m : ℝ)) ++ have hbmτ_summ : Summable bmτ := by ++ simpa [bmτ] using summable_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) ++ have hbt_summ : Summable bt := by ++ have hconst : Summable (fun p => ++ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) := ++ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) ++ refine hconst.congr ?_ ++ intro p ++ simp [bt, ap, rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p, ++ mul_assoc, mul_left_comm, mul_comm] ++ have h' : Summable (fun p => bφ p + b0 p + (bmτ p + bt p)) := ++ (hbφ_summ.add hb0_summ).add (hbmτ_summ.add hbt_summ) ++ simpa [add_assoc] using h' ++ have htsum_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) ++ ≤ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p) := ++ (hasSum_le hb_pointwise hb_summable.hasSum hmaj_summ.hasSum) ++ have htsum_bφ : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ++ = ∑ p ∈ small, CartanBound.φ (r / ap p) := by ++ classical ++ simpa [bφ] using tsum_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) ++ have htsum_b0 : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ++ = (m : ℝ) * (small.card : ℝ) := by ++ classical ++ have : (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) = ∑ p ∈ small, (m : ℝ) := by ++ simpa [b0] using tsum_ite_mem_finset small (fun _ => (m : ℝ)) ++ simp [this, Finset.sum_const, nsmul_eq_mul, mul_comm] ++ have htsum_bmτ : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ++ = (m : ℝ) * ∑ p ∈ small, (r / ap p) ^ τ := by ++ classical ++ have : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ++ = ∑ p ∈ small, (m : ℝ) * (r / ap p) ^ τ := by ++ simpa [bmτ] using tsum_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) ++ simp [this, Finset.mul_sum] ++ have htsum_bt : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) ++ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by ++ simpa [bt, ap, Sτ] using ++ tsum_two_mul_rpow_div_norm_divisorZeroIndex₀_le (f := f) (τ := τ) hr hτ_nonneg ++ have hsum_small_rpow_le : ++ (∑ p ∈ small, (r / ap p) ^ τ) ≤ (Sτ + 1) * (1 + r) ^ τ := by ++ simpa [ap, Sτ] using ++ sum_rpow_div_norm_divisorZeroIndex₀_le (f := f) (τ := τ) small hr hτ_nonneg hsumτ ++ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ have hCφ : 0 ≤ CartanBound.Cφ := le_of_lt CartanBound.Cφ_pos ++ have hS : 0 ≤ Sτ + 1 := by linarith [hSτ_nonneg] ++ have htsum_majorant : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) ++ ≤ (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) ++ * (1 + r) ^ τ := by ++ have hφ_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ++ ≤ CartanBound.Cφ * (small.card : ℝ) := by ++ simpa [htsum_bφ] using hphi_sum ++ have hb0_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ++ ≤ (m : ℝ) * (small.card : ℝ) := by ++ simp [htsum_b0] ++ have hbmτ_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ≤ ++ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ have h0 : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ++ ≤ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) := by ++ have hmul := mul_le_mul_of_nonneg_left hsum_small_rpow_le hm0 ++ ++ simpa [htsum_bmτ, mul_assoc, mul_left_comm, mul_comm] using hmul ++ have h1 : (1 : ℝ) ≤ (4 : ℝ) ^ τ := ++ Real.one_le_rpow (by norm_num) hτ_nonneg ++ have hscale : ++ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) ++ ≤ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ have hnonneg : 0 ≤ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) := by ++ have : 0 ≤ (Sτ + 1) * (1 + r) ^ τ := by positivity ++ exact mul_nonneg hm0 this ++ simpa [mul_assoc, mul_left_comm, mul_comm] using (mul_le_mul_of_nonneg_right h1 hnonneg) ++ exact h0.trans hscale ++ have hbt_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) ++ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using htsum_bt ++ have hsplit : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) ++ = (∑' p, bφ p) + (∑' p, b0 p) + (∑' p, bmτ p) + (∑' p, bt p) := by ++ classical ++ have hbφ_summ : Summable bφ := by ++ simpa [bφ] using summable_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) ++ have hb0_summ : Summable b0 := by ++ simpa [b0] using summable_ite_mem_finset small (fun _ => (m : ℝ)) ++ have hbmτ_summ : Summable bmτ := by ++ simpa [bmτ] using summable_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) ++ have hbt_summ : Summable bt := by ++ have hconst : ++ Summable ++ (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ (2 : ℝ) * (r ^ τ) * ((‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ)) := ++ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) ++ refine hconst.congr ?_ ++ intro p ++ simp [bt, ap, rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p, ++ mul_assoc, mul_left_comm, mul_comm] ++ exact tsum_add_four bφ b0 bmτ bt hbφ_summ hb0_summ hbmτ_summ hbt_summ ++ have hcard_le'' : ++ (small.card : ℝ) ≤ (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using hcard_le' ++ have hφ_le' : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ≤ ++ CartanBound.Cφ * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ have : CartanBound.Cφ * (small.card : ℝ) ≤ ++ CartanBound.Cφ * ((4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ) := ++ mul_le_mul_of_nonneg_left hcard_le'' hCφ ++ exact hφ_le.trans (by simpa [mul_assoc, mul_left_comm, mul_comm] using this) ++ have hb0_le' : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ≤ ++ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ have : (m : ℝ) * (small.card : ℝ) ≤ (m : ℝ) * ((4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ) := ++ mul_le_mul_of_nonneg_left hcard_le'' hm0 ++ exact hb0_le.trans (by simpa [mul_assoc, mul_left_comm, mul_comm] using this) ++ have htsum_majorant' : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) ++ ≤ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ ++ + (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by ++ rw [hsplit] ++ set Y : ℝ := Sτ + 1 with hY ++ set T : ℝ := (1 + r) ^ τ with hT ++ have hφ_leY : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ++ ≤ CartanBound.Cφ * (4 : ℝ) ^ τ * Y * T := by ++ simpa [hY, hT, mul_assoc] using hφ_le' ++ have hb0_leY : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ++ ≤ (m : ℝ) * (4 : ℝ) ^ τ * Y * T := by ++ simpa [hY, hT, mul_assoc] using hb0_le' ++ have hbmτ_leY : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ++ ≤ (m : ℝ) * (4 : ℝ) ^ τ * Y * T := by ++ simpa [hY, hT, mul_assoc] using hbmτ_le ++ have hbt_leY : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) ≤ (2 : ℝ) * Y * T := by ++ simpa [hY, hT, mul_assoc] using hbt_le ++ have hmain := ++ cartan_majorant_four_term_bound ++ (q := (4 : ℝ) ^ τ) hφ_leY hb0_leY hbmτ_leY hbt_leY ++ simpa [Y, T, add_assoc] using hmain ++ have hring : ++ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ ++ + (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ ++ = (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) * (1 + r) ^ τ := by ++ exact cartan_majorant_add_two_factor ++ ((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ) (Sτ + 1) ((1 + r) ^ τ) ++ rw [← hring] ++ exact htsum_majorant' ++ have hCprod' : ++ (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) * (1 + r) ^ τ ++ ≤ Cprod * (1 + r) ^ τ := by ++ simpa [Cprod, cartanProductConstant, mul_assoc, mul_left_comm, mul_comm] using ++ cartan_majorant_pad_two_to_three ++ (A := (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ) ++ (S := Sτ) (T := (1 + r) ^ τ) hS (by positivity) ++ exact (le_trans (le_trans htsum_le htsum_majorant) hCprod') ++ have hsum_fin_le : ++ (∑ p ∈ s, b p) ≤ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) := by ++ simpa using ++ (Summable.sum_le_tsum (s := s) (f := b) (fun p _ => hb_nonneg p) hb_summable) ++ exact hsum_fin_le.trans hb_tsum_le ++ ++end Complex.Hadamard ++end ++end HadamardSourceScope28 ++ ++section HadamardSourceScope29 ++ ++noncomputable section ++ ++open scoped BigOperators ++open Filter Finset _root_.Real _root_.Erdos970.Real Topology ++ ++lemma Finset.prod_le_exp_sum {α : Type} (s : Finset α) (a : α → ℝ) (b : α → ℝ) ++ (ha : ∀ x ∈ s, 0 ≤ a x) (hab : ∀ x ∈ s, a x ≤ Real.exp (b x)) : ++ (∏ x ∈ s, a x) ≤ Real.exp (∑ x ∈ s, b x) := by ++ calc ++ (∏ x ∈ s, a x) ≤ ∏ x ∈ s, Real.exp (b x) := Finset.prod_le_prod₀ ha hab ++ _ = Real.exp (∑ x ∈ s, b x) := by ++ simpa using (Real.exp_sum (s := s) (f := b)).symm ++ ++lemma hasProd_le_of_prod_le_exp {α : Type} {f : α → ℝ} {a : ℝ} ++ (hf : HasProd f a (SummationFilter.unconditional α)) ++ {B : ℝ} (hB : ∀ s : Finset α, (∏ x ∈ s, f x) ≤ Real.exp B) : ++ a ≤ Real.exp B := ++ hasProd_le_of_prod_le (L := (SummationFilter.unconditional α)) hf hB ++ ++lemma hasProd_inv_unconditional {α : Type} {fac : α → ℂ} {F : ℂ} ++ (hfac : HasProd fac F (SummationFilter.unconditional α)) (hF : F ≠ 0) : ++ HasProd (fun x => (fac x)⁻¹) (F⁻¹) (SummationFilter.unconditional α) := by ++ change ++ Tendsto (fun s : Finset α => ∏ x ∈ s, (fac x)⁻¹) ++ (SummationFilter.unconditional α).filter (𝓝 (F⁻¹)) ++ have hprod : ++ Tendsto (fun s : Finset α => ∏ x ∈ s, fac x) ++ (SummationFilter.unconditional α).filter (𝓝 F) := by ++ simpa [HasProd] using hfac ++ have hinv : ++ Tendsto (fun s : Finset α => (∏ x ∈ s, fac x)⁻¹) ++ (SummationFilter.unconditional α).filter (𝓝 (F⁻¹)) := ++ hprod.inv₀ hF ++ refine hinv.congr' (Filter.Eventually.of_forall ?_) ++ intro s ++ simp [Finset.prod_inv_distrib] ++ ++lemma hasProd_norm_inv_unconditional {α : Type} {fac : α → ℂ} {F : ℂ} ++ (hfac : HasProd fac F (SummationFilter.unconditional α)) (hF : F ≠ 0) : ++ HasProd (fun x => ‖(fac x)⁻¹‖) ‖F⁻¹‖ (SummationFilter.unconditional α) := by ++ change ++ Tendsto (fun s : Finset α => ∏ x ∈ s, ‖(fac x)⁻¹‖) ++ (SummationFilter.unconditional α).filter (𝓝 ‖F⁻¹‖) ++ have hnorm := (hasProd_inv_unconditional hfac hF).norm ++ refine hnorm.congr' (Filter.Eventually.of_forall ?_) ++ intro s ++ simp [norm_inv, Finset.prod_inv_distrib] ++ ++lemma hasProd_norm_inv_le_exp_of_pointwise_le_exp {α : Type} {fac : α → ℂ} {F : ℂ} ++ (hfac : HasProd fac F (SummationFilter.unconditional α)) ++ (b : α → ℝ) (B : ℝ) ++ (hterm : ∀ x, ‖(fac x)⁻¹‖ ≤ Real.exp (b x)) ++ (hsum : ∀ s : Finset α, (∑ x ∈ s, b x) ≤ B) : ++ ‖F⁻¹‖ ≤ Real.exp B := by ++ by_cases hF : F = 0 ++ · subst hF ++ simpa using exp_nonneg B ++ have hnorm : ++ HasProd (fun x => ‖(fac x)⁻¹‖) ‖F⁻¹‖ (SummationFilter.unconditional α) := ++ hasProd_norm_inv_unconditional hfac hF ++ have hprod : ∀ s : Finset α, (∏ x ∈ s, ‖(fac x)⁻¹‖) ≤ Real.exp B := by ++ intro s ++ have h0 : ∀ x ∈ s, 0 ≤ ‖(fac x)⁻¹‖ := by intro _ _; positivity ++ have h1 : (∏ x ∈ s, ‖(fac x)⁻¹‖) ≤ Real.exp (∑ x ∈ s, b x) := by ++ refine Finset.prod_le_exp_sum s (a := fun x => ‖(fac x)⁻¹‖) (b := b) h0 ?_ ++ intro x hx ++ simpa using hterm x ++ have h2 : Real.exp (∑ x ∈ s, b x) ≤ Real.exp B := ++ Real.exp_le_exp.2 (hsum s) ++ exact h1.trans h2 ++ exact hasProd_le_of_prod_le_exp hnorm hprod ++end ++end HadamardSourceScope29 ++ ++section HadamardSourceScope30 ++ ++open Metric ++ ++namespace Complex ++ ++open _root_.Complex ++ ++theorem borelCaratheodory_zero_closedBall {f : ℂ → ℂ} {M r R : ℝ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ (hr : 0 < r) (hlt : r < R) (hM : 0 < M) (hf0 : f 0 = 0) ++ (hf_re : ∀ w, ‖w‖ ≤ R → (f w).re ≤ M) {z : ℂ} (hz : ‖z‖ ≤ r) : ++ ‖f z‖ ≤ 2 * M * r / (R - r) := by ++ have hR : 0 < R := lt_trans hr hlt ++ have hz_ball : z ∈ Metric.ball (0 : ℂ) R := by ++ rw [Metric.mem_ball, dist_zero_right] ++ exact hz.trans_lt hlt ++ have hf_diff : DifferentiableOn ℂ f (Metric.ball (0 : ℂ) R) := by ++ intro w hw ++ have hw' : w ∈ Metric.closedBall (0 : ℂ) R := ball_subset_closedBall hw ++ exact (hf w hw').differentiableAt.differentiableWithinAt ++ have hf_map : Set.MapsTo f (Metric.ball (0 : ℂ) R) {w | w.re ≤ M} := by ++ intro w hw ++ simp only [Set.mem_ofPred_eq] ++ have hw' : ‖w‖ < R := by simpa [Metric.mem_ball, dist_zero_right] using hw ++ exact hf_re w hw'.le ++ have hbc := ++ borelCaratheodory_zero hM hf_diff hf_map hR hz_ball hf0 ++ have hzR : ‖z‖ < R := by ++ rw [Metric.mem_ball, dist_zero_right] at hz_ball ++ exact hz_ball ++ have hmono : ‖z‖ / (R - ‖z‖) ≤ r / (R - r) := by ++ have hrden : 0 < R - r := sub_pos.mpr hlt ++ have hden : 0 < R - ‖z‖ := sub_pos.mpr hzR ++ rw [div_le_div_iff₀ hden hrden] ++ nlinarith [hz, norm_nonneg z] ++ have hM' : 0 ≤ 2 * M := mul_nonneg (by norm_num) (le_of_lt hM) ++ calc ‖f z‖ ++ ≤ 2 * M * ‖z‖ / (R - ‖z‖) := hbc ++ _ ≤ 2 * M * (r / (R - r)) := by ++ simpa [mul_div_assoc] using mul_le_mul_of_nonneg_left hmono hM' ++ _ = 2 * M * r / (R - r) := by ring ++ ++end Complex ++end HadamardSourceScope30 ++ ++section HadamardSourceScope31 ++ ++noncomputable section ++ ++namespace Complex ++ ++open _root_.Complex ++namespace Hadamard ++ ++open _root_.Complex _root_.Erdos970.Complex _root_.Real _root_.Erdos970.Real ++ BigOperators _root_.Finset Set Filter Topology Metric ++ ++open scoped Topology ++ ++theorem zero_free_polynomial_growth_is_exp_poly {H : ℂ → ℂ} {n : ℕ} ++ (hH : Differentiable ℂ H) ++ (h_nonzero : ∀ z, H z ≠ 0) ++ (h_bound : ∃ C > 0, ∀ z, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ n)) : ++ ∃ P : Polynomial ℂ, P.natDegree ≤ n ∧ ∀ z, H z = Complex.exp (Polynomial.eval z P) := by ++ classical ++ rcases h_bound with ⟨C, hCpos, hC⟩ ++ let L : ℂ → ℂ := fun z => deriv H z / H z ++ have hderivH : Differentiable ℂ (deriv H) := by ++ intro z ++ exact ((hH.analyticAt z).deriv).differentiableAt ++ have hL : Differentiable ℂ L := by ++ simpa [L] using! (hderivH.div hH h_nonzero) ++ let h : ℂ → ℂ := fun z => Complex.wedgeIntegral (0 : ℂ) z L ++ have hh_deriv : ∀ z, HasDerivAt h (L z) z := by ++ intro z ++ let r : ℝ := ‖z‖ + 1 ++ have hrpos : 0 < r := by ++ dsimp [r]; linarith [norm_nonneg z] ++ have hz_ball : z ∈ Metric.ball (0 : ℂ) r := by ++ have : dist z (0 : ℂ) < r := by simp [r, dist_zero_right] ++ simpa [Metric.mem_ball] using this ++ have hconserv : Complex.IsConservativeOn L (Metric.ball (0 : ℂ) r) := ++ (hL.differentiableOn).isConservativeOn ++ have hcont : ContinuousOn L (Metric.ball (0 : ℂ) r) := ++ hL.continuous.continuousOn ++ simpa [h, r] using hconserv.hasDerivAt_wedgeIntegral (f_cont := hcont) (hz := hz_ball) ++ have hh : Differentiable ℂ h := fun z => (hh_deriv z).differentiableAt ++ have hderiv_h : ∀ z, deriv h z = L z := fun z => (hh_deriv z).deriv ++ let k : ℂ → ℂ := fun z => h z + Complex.log (H 0) ++ have hk : Differentiable ℂ k := hh.add_const (Complex.log (H 0)) ++ have hk_exp : ∀ z, H z = Complex.exp (k z) := by ++ let F : ℂ → ℂ := fun z => Complex.exp (k z) / H z ++ have hF_deriv : ∀ z, deriv F z = 0 := by ++ intro z ++ have hH_has : HasDerivAt H (deriv H z) z := (hH z).hasDerivAt ++ have hk_has : HasDerivAt k (L z) z := by ++ have hh_has : HasDerivAt h (L z) z := hh_deriv z ++ simpa [k, L] using hh_has.add_const (Complex.log (H 0)) ++ have hExp : HasDerivAt (fun w => Complex.exp (k w)) (Complex.exp (k z) * L z) z := ++ (HasDerivAt.cexp hk_has) ++ have hDiv := (HasDerivAt.div hExp hH_has (h_nonzero z)) ++ have : ++ deriv F z = ++ ((Complex.exp (k z) * L z) * H z - Complex.exp (k z) * deriv H z) / (H z) ^ 2 := by ++ simpa [F] using! hDiv.deriv ++ rw [this] ++ have hnum : ++ (Complex.exp (k z) * L z) * H z - Complex.exp (k z) * deriv H z = 0 := by ++ dsimp [L] ++ field_simp [h_nonzero z] ++ ring ++ simp [hnum] ++ have hF_diff : Differentiable ℂ F := (hk.cexp).div hH h_nonzero ++ have hF_const : ∀ z, F z = F 0 := by ++ intro z ++ exact is_const_of_deriv_eq_zero hF_diff hF_deriv z 0 ++ have hF0 : F 0 = 1 := by ++ have hh0 : h 0 = 0 := by simp [h, Complex.wedgeIntegral] ++ have hk0 : k 0 = Complex.log (H 0) := by simp [k, hh0] ++ have hH0 : H 0 ≠ 0 := h_nonzero 0 ++ simp [F, hk0, Complex.exp_log hH0, hH0] ++ intro z ++ have : F z = 1 := by simpa [hF0] using (hF_const z) ++ have hHz : H z ≠ 0 := h_nonzero z ++ have : Complex.exp (k z) / H z = 1 := by simpa [F] using this ++ have : Complex.exp (k z) = H z := by ++ field_simp [hHz] at this ++ simpa using this ++ exact this.symm ++ have hk_re_bound : ∀ z, (k z).re ≤ C * (1 + ‖z‖) ^ n := by ++ intro z ++ have hHz : H z ≠ 0 := h_nonzero z ++ have hpos : 0 < ‖H z‖ := norm_pos_iff.mpr hHz ++ have hlog_le : Real.log ‖H z‖ ≤ C * (1 + ‖z‖) ^ n := by ++ have := Real.log_le_log hpos (hC z) ++ simpa [Real.log_exp] using this ++ have hlog_eq : Real.log ‖H z‖ = (k z).re := by ++ have : ‖H z‖ = Real.exp (k z).re := by ++ simpa [hk_exp z] using (Complex.norm_exp (k z)) ++ calc ++ Real.log ‖H z‖ = Real.log (Real.exp (k z).re) := by simp [this] ++ _ = (k z).re := by simp ++ simpa [hlog_eq] using hlog_le ++ have hk_iteratedDeriv_eq_zero : ∀ m : ℕ, n < m → iteratedDeriv m k 0 = 0 := by ++ intro m hm ++ have hm' : 0 < (m - n : ℕ) := Nat.sub_pos_of_lt hm ++ have hmne : m - n ≠ 0 := (Nat.pos_iff_ne_zero.1 hm') ++ let f : ℂ → ℂ := fun z => k z - k 0 ++ have hf : Differentiable ℂ f := hk.sub_const (k 0) ++ have hf0 : f 0 = 0 := by simp [f] ++ have hf_re_bound : ∀ R : ℝ, 0 < R → ++ ∀ z, ‖z‖ ≤ R → (f z).re ≤ C * (1 + R) ^ n + ‖k 0‖ := by ++ intro R hRpos z hzR ++ have hkz : (k z).re ≤ C * (1 + ‖z‖) ^ n := hk_re_bound z ++ have hkz' : (k z).re ≤ C * (1 + R) ^ n := by ++ have h1 : (1 + ‖z‖ : ℝ) ≤ 1 + R := by linarith ++ have hpow : (1 + ‖z‖ : ℝ) ^ n ≤ (1 + R) ^ n := ++ pow_le_pow_left₀ (by linarith [norm_nonneg z]) h1 n ++ exact hkz.trans (mul_le_mul_of_nonneg_left hpow (le_of_lt hCpos)) ++ have hRe0 : -(k 0).re ≤ ‖k 0‖ := by ++ have habs : |(k 0).re| ≤ ‖k 0‖ := Complex.abs_re_le_norm (k 0) ++ have hneg : -(k 0).re ≤ |(k 0).re| := by simpa using (neg_le_abs (k 0).re) ++ exact hneg.trans habs ++ have : (f z).re ≤ C * (1 + R) ^ n + ‖k 0‖ := by ++ have : (f z).re = (k z).re - (k 0).re := by simp [f, sub_eq_add_neg] ++ nlinarith [this, hkz', hRe0] ++ exact this ++ have hf_bound_on_ball : ∀ R : ℝ, 0 < R → ++ ∀ z, ‖z‖ ≤ R / 2 → ‖f z‖ ≤ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ intro R hRpos z hz ++ have hR2pos : 0 < R / 2 := by nlinarith ++ have hlt : R / 2 < R := by nlinarith ++ have hMpos : 0 < (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ have : 0 ≤ C * (1 + R) ^ n := by ++ refine mul_nonneg (le_of_lt hCpos) ?_ ++ exact pow_nonneg (by linarith) _ ++ nlinarith [this, norm_nonneg (k 0)] ++ have hf_anal : AnalyticOnNhd ℂ f (Metric.closedBall 0 R) := by ++ intro w _hw ++ exact (hf.analyticAt w) ++ have hf_re : ∀ w, ‖w‖ ≤ R → (f w).re ≤ (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ intro w hw ++ have := hf_re_bound R hRpos w hw ++ linarith ++ have hf_bc := ++ borelCaratheodory_zero_closedBall (f := f) (r := R / 2) (R := R) ++ (M := (C * (1 + R) ^ n + ‖k 0‖ + 1)) ++ hf_anal hR2pos hlt hMpos hf0 hf_re (z := z) hz ++ have hconst : ++ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) * (R / 2) / (R - R / 2) ++ = 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ field_simp [hRpos.ne'] ; ring ++ simpa [hconst] using hf_bc ++ have hCauchy : ∀ R : ℝ, 0 < R → ++ ‖iteratedDeriv m f 0‖ ≤ ++ (m.factorial : ℝ) * (2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) / (R / 2) ^ m := by ++ intro R hRpos ++ have hR2pos : 0 < R / 2 := by nlinarith ++ have hf_diffCont : DiffContOnCl ℂ f (Metric.ball (0 : ℂ) (R / 2)) := hf.diffContOnCl ++ have hbound_sphere : ++ ∀ z ∈ Metric.sphere (0 : ℂ) (R / 2), ++ ‖f z‖ ≤ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ intro z hz ++ have hz' : ‖z‖ ≤ R / 2 := by ++ simpa [Metric.mem_sphere, dist_zero_right] using (le_of_eq hz) ++ exact hf_bound_on_ball R hRpos z hz' ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using ++ (Complex.norm_iteratedDeriv_le_of_forall_mem_sphere_norm_le (n := m) (c := (0 : ℂ)) ++ (R := R / 2) (C := 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) ++ (hR := hR2pos) hf_diffCont hbound_sphere) ++ have hf_iter_eq : iteratedDeriv m f 0 = 0 := by ++ by_contra hne ++ have ha : 0 < ‖iteratedDeriv m f 0‖ := norm_pos_iff.2 hne ++ let RHS : ℝ → ℝ := fun R => ++ (m.factorial : ℝ) * (2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) / (R / 2) ^ m ++ have hle_RHS : ∀ R : ℝ, 0 < R → ‖iteratedDeriv m f 0‖ ≤ RHS R := by ++ intro R hRpos ++ simpa [RHS] using hCauchy R hRpos ++ have hRHS_tendsto : Tendsto RHS atTop (𝓝 0) := by ++ let K : ℝ := ‖k 0‖ + 1 ++ have hmpos : 0 < m := lt_of_le_of_lt (Nat.zero_le n) hm ++ have hm0 : m ≠ 0 := ne_of_gt hmpos ++ have hratio : Tendsto (fun R : ℝ => R ^ n / (R / 2) ^ m) atTop (𝓝 0) := by ++ have hident : ++ (fun R : ℝ => R ^ n / (R / 2) ^ m) = fun R : ℝ => (2 : ℝ) ^ m * (R ^ n / R ^ m) := by ++ funext R ++ simp [div_eq_mul_inv, mul_pow, mul_assoc, mul_comm] ++ have hmain : Tendsto (fun R : ℝ => R ^ n / R ^ m) atTop (𝓝 0) := by ++ have hp : m - n ≠ 0 := (Nat.pos_iff_ne_zero.1 (Nat.sub_pos_of_lt hm)) ++ have hmain' : Tendsto (fun R : ℝ => (R ^ (m - n))⁻¹) atTop (𝓝 0) := by ++ simpa using (tendsto_pow_neg_atTop (𝕜 := ℝ) (n := m - n) hp) ++ have hEq : (fun R : ℝ => (R ^ (m - n))⁻¹) =ᶠ[atTop] fun R : ℝ => R ^ n / R ^ m := by ++ have hEq' : (fun R : ℝ => R ^ n / R ^ m) =ᶠ[atTop] fun R : ℝ => (R ^ (m - n))⁻¹ := by ++ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR ++ have hle : n ≤ m := le_of_lt hm ++ have hm_eq : n + (m - n) = m := Nat.add_sub_of_le hle ++ have hn0 : R ^ n ≠ 0 := pow_ne_zero n hR ++ calc ++ R ^ n / R ^ m = R ^ n / R ^ (n + (m - n)) := by simp [hm_eq] ++ _ = R ^ n * ((R ^ (m - n))⁻¹ * (R ^ n)⁻¹) := by ++ simp [pow_add, div_eq_mul_inv, mul_comm] ++ _ = (R ^ (m - n))⁻¹ := by ++ ring_nf ++ simp [hn0] ++ exact hEq'.symm ++ exact Filter.Tendsto.congr' hEq hmain' ++ have : Tendsto (fun R : ℝ => (2 : ℝ) ^ m * (R ^ n / R ^ m)) atTop (𝓝 ((2 : ℝ) ^ m * 0)) := ++ tendsto_const_nhds.mul hmain ++ simpa [hident] using this ++ have hinv : Tendsto (fun R : ℝ => ((R / 2) ^ m)⁻¹) atTop (𝓝 0) := by ++ have hdiv : Tendsto (fun R : ℝ => R / 2) atTop atTop := ++ (tendsto_id.atTop_div_const (r := (2 : ℝ)) (by norm_num : (0 : ℝ) < 2)) ++ have hpow : Tendsto (fun R : ℝ => (R / 2) ^ m) atTop atTop := ++ (Filter.tendsto_pow_atTop (α := ℝ) (n := m) hm0).comp hdiv ++ simpa using! hpow.inv_tendsto_atTop ++ have hdiv : Tendsto (fun R : ℝ => (1 + R) / R) atTop (𝓝 (1 : ℝ)) := by ++ have hinv' : Tendsto (fun R : ℝ => (R : ℝ)⁻¹) atTop (𝓝 (0 : ℝ)) := tendsto_inv_atTop_zero ++ have hadd : Tendsto (fun R : ℝ => (1 : ℝ) + (R : ℝ)⁻¹) atTop (𝓝 (1 : ℝ)) := by ++ simpa using (tendsto_const_nhds.add hinv') ++ have hEq : (fun R : ℝ => (1 + R) / R) =ᶠ[atTop] fun R : ℝ => (1 : ℝ) + (R : ℝ)⁻¹ := by ++ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR ++ field_simp [hR]; ring ++ exact Filter.Tendsto.congr' hEq.symm hadd ++ have hdiv_pow : Tendsto (fun R : ℝ => ((1 + R) / R) ^ n) atTop (𝓝 (1 : ℝ)) := by ++ simpa using (hdiv.pow n) ++ have hone_add_ratio : ++ Tendsto (fun R : ℝ => (1 + R) ^ n / (R / 2) ^ m) atTop (𝓝 (0 : ℝ)) := by ++ have hEq : ++ (fun R : ℝ => (1 + R) ^ n / (R / 2) ^ m) ++ =ᶠ[atTop] fun R : ℝ => ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) := by ++ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR ++ have hRpow : (R ^ n : ℝ) ≠ 0 := pow_ne_zero n hR ++ have hident : ++ ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) = (1 + R) ^ n / (R / 2) ^ m := by ++ calc ++ ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) ++ = ((1 + R) ^ n / R ^ n) * (R ^ n / (R / 2) ^ m) := by ++ simp [div_pow] ++ _ = ((1 + R) ^ n * R ^ n) / (R ^ n * (R / 2) ^ m) := by ++ simp [div_mul_div_comm, mul_comm] ++ _ = ((1 + R) ^ n * R ^ n) / ((R / 2) ^ m * R ^ n) := by ++ simp [mul_comm] ++ _ = (1 + R) ^ n / (R / 2) ^ m := by ++ simpa [mul_assoc, mul_comm, mul_left_comm] using ++ (mul_div_mul_right (a := (1 + R) ^ n) (b := (R / 2) ^ m) hRpow) ++ exact hident.symm ++ have hmul : ++ Tendsto ++ (fun R : ℝ => ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m)) ++ atTop (𝓝 (0 : ℝ)) := by ++ simpa [mul_zero] using (hdiv_pow.mul hratio) ++ exact Filter.Tendsto.congr' hEq.symm hmul ++ have h1 : Tendsto (fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m)) atTop (𝓝 0) := by ++ simpa using (tendsto_const_nhds.mul hone_add_ratio) ++ have h2 : Tendsto (fun R : ℝ => K * ((R / 2) ^ m)⁻¹) atTop (𝓝 0) := by ++ simpa using (tendsto_const_nhds.mul hinv) ++ have hsum : ++ Tendsto ++ (fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m) + K * ((R / 2) ^ m)⁻¹) ++ atTop (𝓝 0) := by ++ simpa using (h1.add h2) ++ have hrew : ++ (fun R : ℝ => (C * (1 + R) ^ n + K) / (R / 2) ^ m) ++ = fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m) + K * ((R / 2) ^ m)⁻¹ := by ++ funext R ++ simp [div_eq_mul_inv, mul_add, mul_assoc, mul_comm] ++ have hbase : Tendsto (fun R : ℝ => (C * (1 + R) ^ n + K) / (R / 2) ^ m) atTop (𝓝 0) := by ++ simpa [hrew] using hsum ++ have hconst : ++ Tendsto (fun _ : ℝ => (m.factorial : ℝ) * (2 : ℝ)) atTop ++ (𝓝 ((m.factorial : ℝ) * (2 : ℝ))) := tendsto_const_nhds ++ have hmul : Tendsto (fun R : ℝ => ((m.factorial : ℝ) * (2 : ℝ)) * ++ ((C * (1 + R) ^ n + K) / (R / 2) ^ m)) atTop (𝓝 0) := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using (hconst.mul hbase) ++ have hRHS_rw : RHS = fun R : ℝ => ((m.factorial : ℝ) * (2 : ℝ)) * ++ ((C * (1 + R) ^ n + K) / (R / 2) ^ m) := by ++ funext R ++ dsimp [RHS, K] ++ ring_nf ++ simpa [hRHS_rw] using hmul ++ have hsmall : ∀ᶠ R in atTop, RHS R < ‖iteratedDeriv m f 0‖ / 2 := ++ (tendsto_order.1 hRHS_tendsto).2 _ (half_pos ha) ++ have hle_eventually : ∀ᶠ R in atTop, ‖iteratedDeriv m f 0‖ ≤ RHS R := by ++ filter_upwards [eventually_gt_atTop (0 : ℝ)] with R hRpos ++ exact hle_RHS R hRpos ++ rcases (hle_eventually.and hsmall).exists with ⟨R, hle, hlt⟩ ++ have : ‖iteratedDeriv m f 0‖ < ‖iteratedDeriv m f 0‖ := ++ (lt_of_le_of_lt hle hlt).trans (half_lt_self ha) ++ exact lt_irrefl _ this ++ have hmpos : 0 < m := lt_of_le_of_lt (Nat.zero_le n) hm ++ have hm0 : m ≠ 0 := ne_of_gt hmpos ++ have hkcd : ContDiffAt ℂ (↑m) k (0 : ℂ) := (hk.analyticAt 0).contDiffAt ++ have hccd : ContDiffAt ℂ (↑m) (fun _ : ℂ => k 0) (0 : ℂ) := contDiffAt_const ++ have hsub : ++ iteratedDeriv m f 0 = ++ iteratedDeriv m k 0 - iteratedDeriv m (fun _ : ℂ => k 0) 0 := by ++ simpa [f] using! (iteratedDeriv_sub (n := m) (x := (0 : ℂ)) hkcd hccd) ++ have hconst0 : iteratedDeriv m (fun _ : ℂ => k 0) 0 = 0 := by ++ simp [iteratedDeriv_const, hm0] ++ have hf_eq : iteratedDeriv m f 0 = iteratedDeriv m k 0 := by ++ simp [hsub, hconst0] ++ simpa [hf_eq] using hf_iter_eq ++ let P : Polynomial ℂ := ++ ∑ m ∈ Finset.range (n + 1), Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) ++ have hPdeg : P.natDegree ≤ n := by ++ have hnat : ++ P.natDegree ≤ ++ Finset.fold max 0 ++ (fun m : ℕ => ++ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) ++ (Finset.range (n + 1)) := by ++ simpa [P, Function.comp] using ++ (Polynomial.natDegree_sum_le (s := Finset.range (n + 1)) ++ (f := fun m : ℕ => ++ Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0))) ++ have hfold : ++ Finset.fold max 0 ++ (fun m : ℕ => ++ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) ++ (Finset.range (n + 1)) ≤ n := by ++ refine (Finset.fold_max_le (f := fun m : ℕ => ++ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) ++ (b := 0) (s := Finset.range (n + 1)) (c := n)).2 ?_ ++ refine ⟨Nat.zero_le n, ?_⟩ ++ intro m hm ++ have hmon : ++ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree ≤ m := ++ Polynomial.natDegree_monomial_le _ ++ have hm_le : m ≤ n := Nat.le_of_lt_succ (Finset.mem_range.1 hm) ++ exact hmon.trans hm_le ++ exact hnat.trans hfold ++ have hk_poly : ∀ z, k z = Polynomial.eval z P := by ++ intro z ++ have htaylor := Complex.taylorSeries_eq_of_entire' (c := (0 : ℂ)) (z := z) hk ++ have htail : ∀ m : ℕ, m ∉ Finset.range (n + 1) → ++ ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m) = 0 := by ++ intro m hm' ++ have hmgt : n < m := by ++ have : n + 1 ≤ m := Nat.le_of_not_lt (by simpa [Finset.mem_range] using hm') ++ exact Nat.lt_of_lt_of_le (Nat.lt_succ_self n) this ++ have hz : iteratedDeriv m k 0 = 0 := hk_iteratedDeriv_eq_zero m hmgt ++ simp [hz] ++ have htsum : ++ (∑' m : ℕ, (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m) ++ = ∑ m ∈ Finset.range (n + 1), (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * z ^ m := by ++ simpa [sub_zero] using (tsum_eq_sum (s := Finset.range (n + 1)) htail) ++ have hfinite : ++ k z = ∑ m ∈ Finset.range (n + 1), (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * z ^ m := by ++ calc ++ k z = ∑' m : ℕ, (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m := by ++ simpa using htaylor.symm ++ _ = _ := htsum ++ have hEval : ++ Polynomial.eval z P = ++ ∑ m ∈ Finset.range (n + 1), z ^ m * ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) := by ++ classical ++ change Polynomial.eval₂ (RingHom.id ℂ) z P = _ ++ let φ : Polynomial ℂ →+* ℂ := Polynomial.eval₂RingHom (RingHom.id ℂ) z ++ change φ P = _ ++ simp [P, φ, Polynomial.eval₂_monomial, mul_comm] ++ have hfinite' : ++ k z = ∑ m ∈ Finset.range (n + 1), z ^ m * ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) := by ++ simpa [mul_comm, mul_left_comm, mul_assoc] using hfinite ++ simpa [hEval] using hfinite' ++ refine ⟨P, hPdeg, ?_⟩ ++ intro z ++ have : H z = Complex.exp (k z) := by simp [hk_exp z] ++ simp [this, hk_poly z] ++ ++end Hadamard ++end Complex ++end ++end HadamardSourceScope31 ++ ++section HadamardSourceScope32 ++ ++noncomputable section ++ ++namespace Complex ++ ++open _root_.Complex ++namespace Hadamard ++ ++open _root_.Complex _root_.Erdos970.Complex _root_.Real _root_.Erdos970.Real ++ BigOperators _root_.Finset Set Filter Topology Metric ++ ++open scoped Topology ++ ++open Polynomial ++ ++private lemma exists_pow_eq_complex {n : ℕ} (hn : 0 < n) (w : ℂ) : ∃ z : ℂ, z ^ n = w := by ++ classical ++ by_cases hw : w = 0 ++ · subst hw ++ refine ⟨0, ?_⟩ ++ have hn0 : n ≠ 0 := Nat.ne_of_gt hn ++ simp [hn0] ++ · refine ⟨Complex.exp (Complex.log w / n), ?_⟩ ++ have hn0 : (n : ℂ) ≠ 0 := by ++ exact_mod_cast (Nat.ne_of_gt hn) ++ calc ++ (Complex.exp (Complex.log w / n)) ^ n ++ = Complex.exp ((n : ℂ) * (Complex.log w / n)) := by ++ simpa using (Complex.exp_nat_mul (Complex.log w / n) n).symm ++ _ = Complex.exp (Complex.log w) := by ++ have : (n : ℂ) * (Complex.log w / n) = Complex.log w := by ++ field_simp [hn0] ++ simp [this] ++ _ = w := by simpa using (Complex.exp_log hw) ++ ++private lemma mul_conj_div_norm (a : ℂ) (ha : a ≠ 0) : ++ a * ((starRingEnd ℂ) a / (‖a‖ : ℂ)) = (‖a‖ : ℂ) := by ++ have hnorm_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha ++ have hnorm_ne : (‖a‖ : ℂ) ≠ 0 := by ++ exact_mod_cast (ne_of_gt hnorm_pos) ++ have hmul : a * (starRingEnd ℂ) a = (Complex.normSq a : ℂ) := ++ Complex.mul_conj a ++ have hcast : (Complex.normSq a : ℂ) = ((‖a‖ ^ 2 : ℝ) : ℂ) := by ++ exact_mod_cast (Complex.normSq_eq_norm_sq a) ++ have hdiv : ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) = (‖a‖ : ℂ) := by ++ have : ((‖a‖ ^ 2 : ℝ) : ℂ) = (‖a‖ : ℂ) * (‖a‖ : ℂ) := by ++ simp [pow_two] ++ calc ++ ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) ++ = ((‖a‖ : ℂ) * (‖a‖ : ℂ)) / (‖a‖ : ℂ) := by simp [this] ++ _ = (‖a‖ : ℂ) := by ++ field_simp [hnorm_ne] ++ calc ++ a * ((starRingEnd ℂ) a / (‖a‖ : ℂ)) ++ = (a * (starRingEnd ℂ) a) / (‖a‖ : ℂ) := by ++ simp [div_eq_mul_inv, mul_assoc] ++ _ = (Complex.normSq a : ℂ) / (‖a‖ : ℂ) := by simp [hmul] ++ _ = ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) := by simp [hcast] ++ _ = (‖a‖ : ℂ) := hdiv ++ ++private lemma exists_z_norm_eq_re_eval_ge ++ (P : Polynomial ℂ) (hn : 0 < P.natDegree) : ++ ∃ R0 : ℝ, 0 < R0 ∧ ++ ∀ R : ℝ, R0 ≤ R → ++ ∃ z : ℂ, ‖z‖ = R ∧ ++ (‖P.leadingCoeff‖ / 2) * R ^ P.natDegree ≤ (P.eval z).re := by ++ classical ++ set n : ℕ := P.natDegree ++ have hn0 : 0 < n := hn ++ have hP0 : P ≠ 0 := by ++ intro h0 ++ simp [n, h0] at hn0 ++ have hLC : P.leadingCoeff ≠ 0 := Polynomial.leadingCoeff_ne_zero.mpr hP0 ++ set a : ℂ := P.leadingCoeff ++ have ha : a ≠ 0 := hLC ++ have hnorm_a_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha ++ set wtarget : ℂ := (starRingEnd ℂ) a / (‖a‖ : ℂ) ++ have hwtarget_norm : ‖wtarget‖ = (1 : ℝ) := by ++ calc ++ ‖wtarget‖ = ‖(starRingEnd ℂ) a‖ / ‖(‖a‖ : ℂ)‖ := by ++ simp [wtarget] ++ _ = ‖a‖ / ‖a‖ := by simp ++ _ = (1 : ℝ) := by ++ field_simp [hnorm_a_pos.ne'] ++ rcases exists_pow_eq_complex (n := n) hn0 (w := wtarget) with ⟨w, hw⟩ ++ have hw_norm : ‖w‖ = (1 : ℝ) := by ++ have hpow : (‖w‖ : ℝ) ^ n = 1 := by ++ have := congrArg (fun z : ℂ => ‖z‖) hw ++ simpa [norm_pow, hwtarget_norm] using this ++ have hn0' : n ≠ 0 := Nat.ne_of_gt hn0 ++ exact (pow_eq_one_iff_of_nonneg (norm_nonneg w) hn0').1 hpow ++ set S : ℝ := ∑ i ∈ Finset.range n, ‖P.coeff i‖ ++ set R0 : ℝ := max 1 (2 * S / ‖a‖) ++ refine ⟨R0, ?_, ?_⟩ ++ · have : (0 : ℝ) < (1 : ℝ) := by norm_num ++ exact lt_of_lt_of_le this (le_max_left _ _) ++ · intro R hR ++ have hR_ge1 : (1 : ℝ) ≤ R := by ++ exact le_trans (le_max_left _ _) hR ++ have hR_nonneg : 0 ≤ R := le_trans (by norm_num) hR_ge1 ++ set z : ℂ := (R : ℂ) * w ++ have hz_norm : ‖z‖ = R := by ++ have : ‖z‖ = |R| * ‖w‖ := by ++ simp [z] ++ simp [this, hw_norm, abs_of_nonneg hR_nonneg] ++ have h_eval : P.eval z = ++ (∑ i ∈ Finset.range n, P.coeff i * z ^ i) + P.coeff n * z ^ n := by ++ have hsum : P.eval z = ∑ i ∈ Finset.range (n + 1), P.coeff i * z ^ i := by ++ have : P.natDegree + 1 = n + 1 := by simp [n] ++ simpa [this] using (Polynomial.eval_eq_sum_range (p := P) z) ++ have hsplit : ++ (∑ i ∈ Finset.range (n + 1), P.coeff i * z ^ i) ++ = (∑ i ∈ Finset.range n, P.coeff i * z ^ i) + P.coeff n * z ^ n := by ++ simpa using (Finset.sum_range_succ (f := fun i => P.coeff i * z ^ i) n) ++ exact hsum.trans hsplit ++ have h_lower_norm : ++ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ S * R ^ (n - 1) := by ++ have h1 : ++ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ++ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ := by ++ simpa using (norm_sum_le (Finset.range n) (fun i => P.coeff i * z ^ i)) ++ have hterm : ∀ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ ≤ ‖P.coeff i‖ * R ^ (n - 1) := by ++ intro i hi ++ have hi_lt : i < n := Finset.mem_range.mp hi ++ have hi_le : i ≤ n - 1 := Nat.le_pred_of_lt hi_lt ++ have hzpow : ‖z‖ ^ i ≤ R ^ (n - 1) := by ++ have hmono : ‖z‖ ^ i ≤ ‖z‖ ^ (n - 1) := ++ pow_le_pow_right₀ (by simpa [hz_norm] using hR_ge1) hi_le ++ simpa [hz_norm] using hmono ++ calc ++ ‖P.coeff i * z ^ i‖ = ‖P.coeff i‖ * ‖z‖ ^ i := by ++ simp [norm_pow] ++ _ ≤ ‖P.coeff i‖ * R ^ (n - 1) := by ++ exact mul_le_mul_of_nonneg_left hzpow (norm_nonneg _) ++ have h2 : ++ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ ++ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1) := by ++ exact Finset.sum_le_sum (fun i hi => hterm i hi) ++ have h3 : ++ (∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1)) ++ = (∑ i ∈ Finset.range n, ‖P.coeff i‖) * R ^ (n - 1) := by ++ simp [Finset.sum_mul] ++ have hsum_le : (∑ i ∈ Finset.range n, ‖P.coeff i‖) ≤ S := by ++ simp [S] ++ calc ++ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ++ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ := h1 ++ _ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1) := h2 ++ _ = (∑ i ∈ Finset.range n, ‖P.coeff i‖) * R ^ (n - 1) := h3 ++ _ ≤ S * R ^ (n - 1) := by ++ exact mul_le_mul_of_nonneg_right hsum_le (pow_nonneg hR_nonneg _) ++ have h_lead_re : (P.coeff n * z ^ n).re = ‖a‖ * R ^ n := by ++ have hw_pow : w ^ n = wtarget := hw ++ have ha_mul : a * w ^ n = (‖a‖ : ℂ) := by ++ have : a * w ^ n = a * wtarget := by simp [hw_pow] ++ simpa [wtarget, a] using (this.trans (mul_conj_div_norm a ha)) ++ have hz_pow : z ^ n = ((R : ℂ) ^ n) * (w ^ n) := by ++ simp [z, mul_pow, mul_comm] ++ have hcoeffn : P.coeff n = a := by simp [a, n, Polynomial.coeff_natDegree] ++ have hreR : ∀ m : ℕ, (((R : ℂ) ^ m).re) = R ^ m := by ++ intro m ++ induction m with ++ | zero => simp ++ | succ m ih => ++ simp [pow_succ, ih, mul_re] ++ calc ++ (P.coeff n * z ^ n).re ++ = (a * z ^ n).re := by simp [hcoeffn] ++ _ = (a * (((R : ℂ) ^ n) * (w ^ n))).re := by simp [hz_pow] ++ _ = (((R : ℂ) ^ n) * (a * (w ^ n))).re := by ++ ring_nf ++ _ = (((R : ℂ) ^ n) * (‖a‖ : ℂ)).re := by simp [ha_mul] ++ _ = (((R : ℂ) ^ n).re) * ‖a‖ := by ++ simp [mul_re] ++ _ = (R ^ n) * ‖a‖ := by simp [hreR n] ++ _ = ‖a‖ * R ^ n := by ring ++ refine ⟨z, hz_norm, ?_⟩ ++ have hre_lower : (∑ i ∈ Finset.range n, P.coeff i * z ^ i).re ++ ≥ -‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := by ++ have habs : |(∑ i ∈ Finset.range n, P.coeff i * z ^ i).re| ++ ≤ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := ++ Complex.abs_re_le_norm _ ++ have := neg_le_of_abs_le habs ++ simpa using this ++ have hre_main : ++ (P.eval z).re ≥ (P.coeff n * z ^ n).re - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := by ++ have : (P.eval z).re = ++ (∑ i ∈ Finset.range n, P.coeff i * z ^ i).re + (P.coeff n * z ^ n).re := by ++ simp [h_eval, add_comm] ++ linarith [this, hre_lower] ++ have hR_ge_R0 : R0 ≤ R := hR ++ have hR_ge : 2 * S / ‖a‖ ≤ R := le_trans (le_max_right _ _) hR_ge_R0 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR_ge1 ++ have hR_nonneg' : 0 ≤ R := le_of_lt hRpos ++ have hn_ge1 : 1 ≤ n := Nat.succ_le_of_lt hn0 ++ have hlower_le : S * R ^ (n - 1) ≤ (‖a‖ / 2) * R ^ n := by ++ have ha_pos : 0 < ‖a‖ := hnorm_a_pos ++ have hS_le : S ≤ (‖a‖ / 2) * R := by ++ have : 2 * S ≤ ‖a‖ * R := by ++ have := (mul_le_mul_of_nonneg_left hR_ge (by linarith [ha_pos.le] : (0 : ℝ) ≤ ‖a‖)) ++ have hne : (‖a‖ : ℝ) ≠ 0 := ne_of_gt ha_pos ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm, hne] using this ++ have : S ≤ (‖a‖ * R) / 2 := by linarith ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using this ++ have : S * R ^ (n - 1) ≤ (‖a‖ / 2) * R * R ^ (n - 1) := by ++ have hpow_nonneg : 0 ≤ R ^ (n - 1) := pow_nonneg hR_nonneg' _ ++ exact mul_le_mul_of_nonneg_right hS_le hpow_nonneg ++ have hRR : R * R ^ (n - 1) = R ^ n := by ++ have : n = (n - 1) + 1 := by ++ exact (Nat.sub_add_cancel hn_ge1).symm ++ rw [this, pow_succ] ++ ring_nf; grind ++ simpa [mul_assoc, hRR] using this ++ have hfinal_re : ++ (‖a‖ / 2) * R ^ n ≤ (P.eval z).re := by ++ have hlower' : ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ (‖a‖ / 2) * R ^ n := by ++ exact h_lower_norm.trans hlower_le ++ have hlead : (P.coeff n * z ^ n).re = ‖a‖ * R ^ n := by simpa [a] using h_lead_re ++ have hre_main' : ++ (‖a‖ * R ^ n) - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ (P.eval z).re := by ++ simpa [hlead] using hre_main ++ have hsub : ++ (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n ≤ ++ (‖a‖ * R ^ n) - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := ++ sub_le_sub_left hlower' (‖a‖ * R ^ n) ++ have hsim : (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n = (‖a‖ / 2) * R ^ n := by ring ++ have : (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n ≤ (P.eval z).re := ++ hsub.trans hre_main' ++ simpa [hsim] using this ++ simpa [a, n] using hfinal_re ++ ++theorem natDegree_le_floor_of_growth_exp_eval ++ {ρ : ℝ} (hρ : 0 ≤ ρ) (P : Polynomial ℂ) ++ (hgrowth : ++ ∃ C > 0, ∀ z : ℂ, ++ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ ρ) : ++ P.natDegree ≤ Nat.floor ρ := by ++ classical ++ by_cases hdeg : P.natDegree = 0 ++ · simp [hdeg] ++ · have hnpos : 0 < P.natDegree := Nat.pos_of_ne_zero hdeg ++ rcases exists_z_norm_eq_re_eval_ge (P := P) hnpos with ⟨R0, hR0pos, hray⟩ ++ rcases hgrowth with ⟨C, hCpos, hC⟩ ++ have hLCpos : 0 < ‖P.leadingCoeff‖ := by ++ have hP0 : P ≠ 0 := by ++ intro h0 ++ simp [h0] at hdeg ++ have : P.leadingCoeff ≠ 0 := (Polynomial.leadingCoeff_ne_zero).2 hP0 ++ exact norm_pos_iff.2 this ++ let c : ℝ := ‖P.leadingCoeff‖ / 2 ++ have hcpos : 0 < c := by ++ have : (0 : ℝ) < (2 : ℝ) := by norm_num ++ exact (div_pos hLCpos this) ++ have hn_le_real : (P.natDegree : ℝ) ≤ ρ := by ++ by_contra hnlt ++ have hnlt' : ρ < (P.natDegree : ℝ) := lt_of_not_ge hnlt ++ let δ : ℝ := (P.natDegree : ℝ) - ρ ++ have hδ : 0 < δ := sub_pos.2 hnlt' ++ let K0 : ℝ := (C * (2 : ℝ) ^ ρ) / c ++ have hK0 : ∃ R1, ∀ R ≥ R1, K0 + 1 ≤ R ^ δ := by ++ have h : ∀ᶠ R in (atTop : Filter ℝ), K0 + 1 ≤ R ^ δ := ++ (tendsto_atTop.mp (tendsto_rpow_atTop hδ)) (K0 + 1) ++ rcases (eventually_atTop.1 h) with ⟨R1, hR1⟩ ++ exact ⟨R1, hR1⟩ ++ rcases hK0 with ⟨R1, hR1⟩ ++ set R : ℝ := max (max R0 1) R1 ++ have hR_ge_R0 : R0 ≤ R := le_trans (le_max_left _ _) (le_max_left _ _) ++ have hR_ge1 : (1 : ℝ) ≤ R := le_trans (le_max_right _ _) (le_max_left _ _) ++ have hR_ge_R1 : R1 ≤ R := le_max_right _ _ ++ have hR_pos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR_ge1 ++ have hRδ : K0 + 1 ≤ R ^ δ := hR1 R hR_ge_R1 ++ rcases hray R hR_ge_R0 with ⟨z, hz_norm, hz_re⟩ ++ have hlog_lower : ++ (P.eval z).re ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := by ++ have hpos : 0 < ‖Complex.exp (Polynomial.eval z P)‖ := by ++ simp ++ have hle : ++ ‖Complex.exp (Polynomial.eval z P)‖ ≤ ++ 1 + ‖Complex.exp (Polynomial.eval z P)‖ := by ++ linarith [norm_nonneg (Complex.exp (Polynomial.eval z P))] ++ have hlog_le : Real.log ‖Complex.exp (Polynomial.eval z P)‖ ++ ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := ++ Real.log_le_log hpos hle ++ have hlog_eq : Real.log ‖Complex.exp (Polynomial.eval z P)‖ = (P.eval z).re := by ++ simp [Complex.norm_exp] ++ simpa [hlog_eq] using hlog_le ++ have hlog_upper : ++ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ ρ := ++ hC z ++ have hmain : c * R ^ (P.natDegree : ℝ) ≤ C * (1 + R) ^ ρ := by ++ have hz_re' : c * R ^ P.natDegree ≤ (P.eval z).re := by ++ simpa [c] using hz_re ++ have hz_re'' : c * R ^ (P.natDegree : ℝ) ≤ (P.eval z).re := by ++ simpa [Real.rpow_natCast, c] using hz_re' ++ have : c * R ^ (P.natDegree : ℝ) ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := ++ hz_re''.trans hlog_lower ++ have : c * R ^ (P.natDegree : ℝ) ≤ C * (1 + ‖z‖) ^ ρ := ++ this.trans hlog_upper ++ simpa [hz_norm] using this ++ have h1R_le : (1 + R : ℝ) ≤ R * 2 := by linarith ++ have hpow1 : (1 + R : ℝ) ^ ρ ≤ (R * 2) ^ ρ := ++ Real.rpow_le_rpow (by linarith [hR_pos.le]) h1R_le hρ ++ have hR2 : (R * 2) ^ ρ = R ^ ρ * (2 : ℝ) ^ ρ := by ++ have hRnonneg : 0 ≤ R := le_of_lt hR_pos ++ have h2nonneg : 0 ≤ (2 : ℝ) := by norm_num ++ simpa [mul_assoc] using (Real.mul_rpow hRnonneg h2nonneg (z := ρ)) ++ have hmain' : c * R ^ (P.natDegree : ℝ) ≤ C * (R ^ ρ * (2 : ℝ) ^ ρ) := by ++ have := le_trans hmain (mul_le_mul_of_nonneg_left hpow1 (le_of_lt hCpos)) ++ simpa [hR2, mul_assoc, mul_left_comm, mul_comm] using this ++ have hRρ_pos : 0 < R ^ ρ := Real.rpow_pos_of_pos hR_pos _ ++ have hRρ_ne : (R ^ ρ : ℝ) ≠ 0 := ne_of_gt hRρ_pos ++ have hdiv : ++ (c * R ^ (P.natDegree : ℝ)) / (R ^ ρ) ≤ C * (2 : ℝ) ^ ρ := by ++ have h := ++ div_le_div_of_nonneg_right hmain' (le_of_lt hRρ_pos) ++ have hRhs : (C * (R ^ ρ * (2 : ℝ) ^ ρ)) / (R ^ ρ) = C * (2 : ℝ) ^ ρ := by ++ field_simp [hRρ_ne] ++ simpa [hRhs, mul_assoc, mul_left_comm, mul_comm] using h ++ have hRsub : R ^ δ = R ^ (P.natDegree : ℝ) / R ^ ρ := by ++ simpa [δ] using (Real.rpow_sub hR_pos (P.natDegree : ℝ) ρ) ++ have hRδ_le : c * (R ^ δ) ≤ C * (2 : ℝ) ^ ρ := by ++ have hLhs : c * (R ^ δ) = (c * R ^ (P.natDegree : ℝ)) / (R ^ ρ) := by ++ simp [hRsub, div_eq_mul_inv, mul_left_comm, mul_comm] ++ simpa [hLhs] using hdiv ++ have hRδ_le' : R ^ δ ≤ K0 := by ++ have : R ^ δ ≤ (C * (2 : ℝ) ^ ρ) / c := by ++ refine (le_div_iff₀ hcpos).2 ?_ ++ simpa [mul_assoc, mul_left_comm, mul_comm] using hRδ_le ++ simpa [K0] using this ++ have : K0 + 1 ≤ K0 := le_trans hRδ (le_trans hRδ_le' (le_rfl)) ++ exact (not_lt_of_ge this) (lt_add_of_pos_right _ (by norm_num : (0 : ℝ) < 1)) ++ exact (Nat.le_floor_iff hρ).2 hn_le_real ++ ++theorem natDegree_le_floor_of_exp_eval_norm_bound {τ : ℝ} (hτ : 0 ≤ τ) (P : Polynomial ℂ) ++ (hbound : ++ ∃ C > 0, ∀ z : ℂ, ++ ‖Complex.exp (Polynomial.eval z P)‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ)) : ++ P.natDegree ≤ Nat.floor τ := by ++ rcases hbound with ⟨C, hCpos, hC⟩ ++ have hlog_growth : ++ ∃ C > 0, ∀ z : ℂ, ++ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ τ := ++ Real.log_growth_of_norm_le_exp_mul_rpow ++ (f := fun z : ℂ => Complex.exp (Polynomial.eval z P)) ++ (r := fun z : ℂ => 1 + ‖z‖) hCpos hτ ++ (fun z => by linarith [norm_nonneg z]) hC ++ exact natDegree_le_floor_of_growth_exp_eval (ρ := τ) hτ P hlog_growth ++ ++end Hadamard ++end Complex ++end ++end HadamardSourceScope32 ++ ++section HadamardSourceScope33 ++ ++noncomputable section ++ ++open Set Filter Asymptotics ++open scoped Topology BigOperators ++ ++namespace Complex.Hadamard ++ ++open _root_.Complex ++ ++lemma no_zero_on_sphere_of_norm_image_avoid ++ {f : ℂ → ℂ} (hentire : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ {B r : ℝ} (hrpos : 0 < r) (hr_le_B : r ≤ B) ++ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (hsmall_fin : smallSet.Finite) ++ (hsmallSet : ++ smallSet = {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ B}) ++ (hr_not_bad : ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ r ∉ small.image a) : ++ ∀ u : ℂ, ‖u‖ = r → f u ≠ 0 := by ++ classical ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let bad : Finset ℝ := small.image a ++ have hr_not_bad' : r ∉ bad := by ++ simpa [bad, small, a] using hr_not_bad ++ have hr_not : ++ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖ ≤ B → r ≠ ‖divisorZeroIndex₀Val p‖ := by ++ intro p hpB hEq ++ have hp_small : p ∈ small := by ++ have hp_mem : p ∈ smallSet := by ++ simpa [hsmallSet] using hpB ++ simpa [small] using (hsmall_fin.mem_toFinset.2 hp_mem) ++ have : r ∈ bad := Finset.mem_image.2 ⟨p, hp_small, by simpa [a] using hEq.symm⟩ ++ exact (hr_not_bad' this).elim ++ exact no_zero_on_sphere_of_forall_val_norm_ne (f := f) hentire hnot ++ (B := B) (r := r) hrpos hr_le_B hr_not ++ ++theorem norm_inv_hadamardDenominator_le_exp_on_cartan_circle ++ {f : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} ++ (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) ++ (hτ_nonneg : 0 ≤ τ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (hsumτ : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : ++ let Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ let Cprod : ℝ := cartanProductConstant m τ Sτ ++ ∀ {R r : ℝ}, 0 < R → 1 ≤ R → R ≤ r → r ≤ 2 * R → ++ ∀ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsmall_fin : smallSet.Finite), ++ smallSet = ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} → ++ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ‖divisorZeroIndex₀Val p‖ ++ r ∉ small.image a) → ++ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ‖divisorZeroIndex₀Val p‖ ++ (∑ p ∈ small, (1 : ℝ) * CartanBound.φ (r / a p)) ≤ ++ CartanBound.Cφ * (small.card : ℝ)) → ++ ∀ u : ℂ, ‖u‖ = r → ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ ≤ Real.exp (Cprod * (1 + r) ^ τ) := by ++ classical ++ intro Sτ Cprod R r hRpos hRle hR_le_r hr_le_2R smallSet hsmall_fin ++ hsmallSet hr_not_bad hr_phi u hur ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let bad : Finset ℝ := small.image a ++ have hr_not_bad' : r ∉ bad := by ++ simpa [bad, small, a] using hr_not_bad ++ have hr1 : (1 : ℝ) ≤ r := le_trans hRle hR_le_r ++ have hpow_inv_le1 : ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ ≤ 1 := ++ Complex.norm_inv_pow_le_one_of_one_le_norm u (analyticOrderNatAt f 0) (by simpa [hur] using hr1) ++ let fac : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := ++ fun p => weierstrassFactor m (u / divisorZeroIndex₀Val p) ++ have hloc : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (w : ℂ) => ++ weierstrassFactor m (w / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ (Set.univ : Set ℂ) := ++ hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ have hprod : ++ HasProd fac (divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := ++ hloc.hasProd (by simp : u ∈ (Set.univ : Set ℂ)) ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ have : DecidablePred (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => p ∈ small) := ++ Classical.decPred _ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if hp : p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ have hterm : ∀ p, ‖(fac p)⁻¹‖ ≤ Real.exp (b p) := by ++ intro p ++ by_cases hp : p ∈ small ++ · have hval_ne : r ≠ ap p := by ++ intro hEq ++ have : r ∈ bad := by ++ refine Finset.mem_image.2 ⟨p, hp, ?_⟩ ++ simp [ap, a, hEq] ++ exact (hr_not_bad' this).elim ++ have hval0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ have hmτ : (m : ℝ) ≤ τ := le_trans hmρ (le_of_lt hτ) ++ have hnear : ++ ‖(weierstrassFactor m (u / divisorZeroIndex₀Val p))⁻¹‖ ++ ≤ Real.exp (CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ)) := by ++ simpa [ap] using ++ (norm_inv_weierstrassFactor_le_exp_near (m := m) (τ := τ) (r := r) ++ (u := u) (a := divisorZeroIndex₀Val p) ++ (hur := hur) (ha := hval0) (hr := by simpa [ap] using hval_ne) hmτ) ++ simpa [fac, b, hp] using hnear ++ · have hlarge : (4 * R : ℝ) < ap p := by ++ have : ¬ap p ≤ 4 * R := by ++ intro hle ++ have : p ∈ small := by ++ have hp_mem : p ∈ smallSet := by ++ simpa [hsmallSet, ap] using hle ++ simpa [small] using (hsmall_fin.mem_toFinset.2 hp_mem) ++ exact hp this ++ exact lt_of_not_ge this ++ have hz' : ‖u / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := ++ norm_div_le_half_of_norm_le_of_two_mul_lt (z := u) (a := divisorZeroIndex₀Val p) ++ (R := 2 * R) (by nlinarith [hRpos]) (by rw [hur]; exact hr_le_2R) ++ (by nlinarith [hlarge]) ++ have hτ_le : τ ≤ (m + 1 : ℝ) := le_of_lt hτ_lt ++ have hfar : ++ ‖(weierstrassFactor m (u / divisorZeroIndex₀Val p))⁻¹‖ ≤ ++ Real.exp ((2 : ℝ) * (r / ap p) ^ τ) := by ++ simpa [ap] using ++ (norm_inv_weierstrassFactor_le_exp_far (m := m) (τ := τ) (r := r) ++ (u := u) (a := divisorZeroIndex₀Val p) ++ (hur := hur) (ha := divisorZeroIndex₀Val_ne_zero p) (hz := hz') hτ_le) ++ simpa [fac, b, hp] using hfar ++ have hb_le : ++ ∀ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)), ++ (∑ p ∈ s, b p) ≤ Cprod * (1 + r) ^ τ := by ++ intro s ++ simpa [small, ap, b, Sτ, Cprod, a, hsmallSet] using ++ (Complex.Hadamard.cartan_sum_majorant_le (f := f) (m := m) (τ := τ) (R := R) (r := r) ++ (hRpos := hRpos) (hrpos := lt_of_lt_of_le hRpos hR_le_r) ++ (hR_le_r := hR_le_r) (hτ_nonneg := hτ_nonneg) ++ (smallSet := smallSet) (hsmall_fin := hsmall_fin) (hsmallSet := hsmallSet) ++ (hsumτ := hsumτ) ++ (hr_phi := by ++ simpa [small, a, one_mul] using hr_phi) ++ s) ++ have hcprod_inv : ++ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ≤ ++ Real.exp (Cprod * (1 + r) ^ τ) := by ++ refine hasProd_norm_inv_le_exp_of_pointwise_le_exp ++ (α := divisorZeroIndex₀ f (Set.univ : Set ℂ)) (fac := fac) ++ (F := divisorCanonicalProduct m f (Set.univ : Set ℂ) u) ++ hprod (b := b) (B := Cprod * (1 + r) ^ τ) ?_ ?_ ++ · exact hterm ++ · intro s ++ exact hb_le s ++ have hmul : ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ = ++ ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ * ++ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ := by ++ simp [mul_inv_rev, mul_comm] ++ rw [hmul] ++ have : ++ ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ * ++ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ ≤ 1 * Real.exp (Cprod * (1 + r) ^ τ) := ++ mul_le_mul hpow_inv_le1 hcprod_inv (by positivity) (by positivity) ++ simpa using this ++ ++theorem hadamardQuotient_norm_le_exp_on_cartan_circle ++ {f H : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} {Cf : ℝ} ++ (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) ++ (hτ_nonneg : 0 ≤ τ) (hentire : Differentiable ℂ f) ++ (hnot : ∃ z : ℂ, f z ≠ 0) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (hsumτ : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) ++ (hf_boundτ : ∀ z : ℂ, ‖f z‖ ≤ Real.exp (Cf * (1 + ‖z‖) ^ τ)) ++ (hfactor : ∀ z : ℂ, ++ f z = ++ H z * z ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) z) : ++ let Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ let Cprod : ℝ := cartanProductConstant m τ Sτ ++ ∀ {R r : ℝ}, 0 < R → 1 ≤ R → R ≤ r → r ≤ 2 * R → 0 < r → ++ ∀ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsmall_fin : smallSet.Finite), ++ smallSet = ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} → ++ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ‖divisorZeroIndex₀Val p‖ ++ r ∉ small.image a) → ++ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ‖divisorZeroIndex₀Val p‖ ++ (∑ p ∈ small, (1 : ℝ) * CartanBound.φ (r / a p)) ≤ ++ CartanBound.Cφ * (small.card : ℝ)) → ++ ∀ u : ℂ, ‖u‖ = r → ‖H u‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by ++ classical ++ intro Sτ Cprod R r hRpos hRle hR_le_r hr_le_2R hrpos smallSet hsmall_fin ++ hsmallSet hr_not_bad hr_phi u hur ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let bad : Finset ℝ := small.image a ++ have hr_not_bad' : r ∉ bad := by ++ simpa [bad, small, a] using hr_not_bad ++ have hden_eq : ++ f u = ++ H u * (u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using (hfactor u) ++ have hfu_ne : f u ≠ 0 := by ++ have hr_le_4R : r ≤ 4 * R := by nlinarith [hr_le_2R, hRpos] ++ exact no_zero_on_sphere_of_norm_image_avoid (f := f) hentire hnot ++ (B := 4 * R) (r := r) hrpos hr_le_4R smallSet hsmall_fin hsmallSet ++ (by simpa [small, a] using hr_not_bad) u hur ++ have hden_ne : ++ (u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) ≠ 0 := by ++ intro hden0 ++ have : f u = 0 := by simpa [hden0] using hden_eq ++ exact hfu_ne this ++ have hHu : ++ H u = ++ f u / (u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := by ++ exact eq_div_of_mul_eq hden_ne (Eq.symm hden_eq) ++ have hf_u : ‖f u‖ ≤ Real.exp (Cf * (1 + r) ^ τ) := by ++ simpa [hur] using hf_boundτ u ++ have hden_inv : ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ ≤ Real.exp (Cprod * (1 + r) ^ τ) := by ++ simpa [Sτ, Cprod] using ++ (norm_inv_hadamardDenominator_le_exp_on_cartan_circle ++ (f := f) (ρ := ρ) (τ := τ) (m := m) ++ hmρ hτ hτ_lt hτ_nonneg h_sum hsumτ ++ (R := R) (r := r) hRpos hRle hR_le_r hr_le_2R ++ smallSet hsmall_fin hsmallSet ++ (by simpa [small, a] using hr_not_bad) ++ (by simpa [small, a, one_mul] using hr_phi) ++ u hur) ++ have : ++ ‖H u‖ ≤ ++ ‖f u‖ * ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ := by ++ have : ++ ‖H u‖ = ++ ‖f u / ++ (u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)‖ := by ++ simp [hHu] ++ simp [div_eq_mul_inv, norm_inv, this] ++ have hmul : ++ ‖f u‖ * ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ ≤ Real.exp (Cf * (1 + r) ^ τ) * Real.exp (Cprod * (1 + r) ^ τ) := ++ mul_le_mul hf_u hden_inv (by positivity) (by positivity) ++ have hexp : ++ Real.exp (Cf * (1 + r) ^ τ) * Real.exp (Cprod * (1 + r) ^ τ) ++ = Real.exp ((Cf + Cprod) * (1 + r) ^ τ) := by ++ simp [Real.exp_add, add_mul, add_comm] ++ have : ‖H u‖ ≤ Real.exp ((Cf + Cprod) * (1 + r) ^ τ) := ++ (this.trans hmul).trans_eq hexp ++ have hslack : ++ Real.exp ((Cf + Cprod) * (1 + r) ^ τ) ≤ ++ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by ++ refine Real.exp_le_exp.2 ?_ ++ have hnn : 0 ≤ (1 + r) ^ τ := by positivity ++ nlinarith ++ exact this.trans hslack ++ ++theorem hadamardQuotient_norm_le_exp_rpow_of_growth {f H : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} ++ (hρ : 0 ≤ ρ) (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) ++ (hτ_nonneg : 0 ≤ τ) (hentire : Differentiable ℂ f) (hH_entire : Differentiable ℂ H) ++ (hnot : ∃ z : ℂ, f z ≠ 0) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) ++ (hfactor : ∀ z : ℂ, ++ f z = ++ H z * z ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) z) : ++ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := by ++ rcases hgrowth with ⟨Cf, hCfpos, hCf⟩ ++ have hsumτ : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := ++ summable_norm_inv_rpow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) (τ := τ) ++ hρ hτ hentire hnot ⟨Cf, hCfpos, hCf⟩ ++ let Sτ : ℝ := ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ have hSτ_nonneg : 0 ≤ Sτ := tsum_nonneg fun _ => ++ Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ ++ let Cprod : ℝ := cartanProductConstant m τ Sτ ++ have hCprod_nonneg : 0 ≤ Cprod := by ++ simpa [Cprod] using cartanProductConstant_nonneg (m := m) (τ := τ) hSτ_nonneg ++ have hf_boundτ : ∀ z : ℂ, ‖f z‖ ≤ Real.exp (Cf * (1 + ‖z‖) ^ τ) := ++ Real.norm_le_exp_mul_rpow_of_log_growth ++ (f := f) (r := fun z : ℂ => 1 + ‖z‖) (C := Cf) (ρ := ρ) (τ := τ) ++ hCfpos.le (fun z => by linarith [norm_nonneg z]) (le_of_lt hτ) hCf ++ refine ⟨(Cf + Cprod + 10) * (3 : ℝ) ^ τ, by ++ have h3τ : 0 < (3 : ℝ) ^ τ := by positivity ++ nlinarith [hCfpos, hCprod_nonneg, h3τ], ?_⟩ ++ intro z ++ let R : ℝ := max ‖z‖ 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num) (le_max_right _ _) ++ have hRle : (1 : ℝ) ≤ R := le_max_right _ _ ++ let smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ {p | ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} ++ have hsmall_fin : smallSet.Finite := by ++ have : Metric.closedBall (0 : ℂ) (4 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ simpa [smallSet] using ++ (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) ++ (B := 4 * R) this) ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ have ha_pos : ∀ p ∈ small, 0 < a p := by ++ intro p hp ++ exact norm_pos_iff.2 (divisorZeroIndex₀Val_ne_zero p) ++ let bad : Finset ℝ := small.image a ++ rcases CartanBound.exists_radius_Ioc_sum_mul_phi_div_le_Cφ_mul_sum_avoid ++ (s := small) (w := fun _ => (1 : ℝ)) (a := a) ++ (hw := by intro _ _; norm_num) (ha := ha_pos) (bad := bad) (R := R) hRpos with ++ ⟨r, hr_mem, hr_not_bad, hr_phi⟩ ++ have hR_le_r : R ≤ r := le_of_lt hr_mem.1 ++ have hr_le_2R : r ≤ 2 * R := hr_mem.2 ++ have hrpos : 0 < r := lt_of_lt_of_le hRpos hR_le_r ++ have hcircle : ++ ∀ u : ℂ, ‖u‖ = r → ‖H u‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by ++ simpa [Sτ, Cprod] using ++ (hadamardQuotient_norm_le_exp_on_cartan_circle ++ (f := f) (H := H) (ρ := ρ) (τ := τ) (m := m) (Cf := Cf) ++ hmρ hτ hτ_lt hτ_nonneg hentire hnot h_sum hsumτ hf_boundτ hfactor ++ (R := R) (r := r) hRpos hRle hR_le_r hr_le_2R hrpos ++ smallSet hsmall_fin (by rfl) ++ (by simpa [small, a, bad] using hr_not_bad) ++ (by simpa [small, a, one_mul, Finset.sum_const, nsmul_eq_mul] using hr_phi)) ++ have hz_ball : z ∈ Metric.ball (0 : ℂ) r := by ++ rw [Metric.mem_ball, dist_zero_right] ++ exact lt_of_le_of_lt (le_max_left _ _) hr_mem.1 ++ have hball : ++ ‖H z‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by ++ exact Complex.norm_le_of_mem_ball_of_forall_sphere_norm_le hH_entire hrpos hz_ball hcircle ++ have hr_le_3 : 1 + r ≤ 3 * (1 + ‖z‖) := by ++ exact Real.one_add_le_three_mul_one_add_of_le_two_mul_max (norm_nonneg z) ++ (by simpa [R] using hr_le_2R) ++ have hmain : ++ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) ++ ≤ Real.exp (((Cf + Cprod + 10) * (3 : ℝ) ^ τ) * (1 + ‖z‖) ^ τ) := by ++ have hnn : 0 ≤ (Cf + Cprod + 10) := by nlinarith [le_of_lt hCfpos, hCprod_nonneg] ++ exact Real.exp_mul_rpow_le_exp_mul_rpow_of_le_mul hnn (by norm_num) ++ (by linarith [le_of_lt hrpos]) (by positivity) hτ_nonneg hr_le_3 ++ simpa [mul_assoc] using hball.trans hmain ++ ++theorem hadamard_factorization_of_growth {f : ℂ → ℂ} {ρ : ℝ} (hρ : 0 ≤ ρ) ++ (hentire : Differentiable ℂ f) ++ (hnot : ∃ z : ℂ, f z ≠ 0) ++ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : ++ ∃ (P : Polynomial ℂ), ++ P.degree ≤ Nat.floor ρ ∧ ++ ∀ z : ℂ, ++ f z = ++ Complex.exp (Polynomial.eval z P) * ++ z ^ (analyticOrderNatAt f 0) * ++ divisorCanonicalProduct (Nat.floor ρ) f (Set.univ : Set ℂ) z := by ++ set m : ℕ := Nat.floor ρ ++ have h_sum : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ simpa [m] using ++ (summable_norm_inv_pow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) ++ hρ hentire hnot hgrowth) ++ rcases exists_entire_nonzero_hadamardQuotient (m := m) (f := f) hentire hnot h_sum with ++ ⟨H, hH_entire, hH_ne, hfactor⟩ ++ rcases Real.exists_between_self_and_floor_add_one_same_floor hρ with ++ ⟨τ, hτ, hτ_lt, hτ_nonneg, hfloorτ'⟩ ++ have hfloorτ : Nat.floor τ = m := by ++ simpa [m] using hfloorτ' ++ have hτ_lt_m : τ < (m + 1 : ℝ) := by ++ simpa [m] using hτ_lt ++ have hτ_lt_nat : τ < ((m + 1 : ℕ) : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one] using hτ_lt_m ++ have hmρ : (m : ℝ) ≤ ρ := by ++ have := Nat.floor_le hρ ++ simpa [m] using this ++ have hH_bound_rpow : ++ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := ++ hadamardQuotient_norm_le_exp_rpow_of_growth (f := f) (H := H) (ρ := ρ) (τ := τ) ++ (m := m) hρ hmρ hτ hτ_lt hτ_nonneg hentire hH_entire hnot h_sum hgrowth hfactor ++ have hH_growth_nat : ++ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ (m + 1)) := by ++ exact Real.exists_norm_le_exp_mul_pow_of_rpow_bound ++ (f := H) (r := fun z : ℂ => 1 + ‖z‖) ++ (fun z => by linarith [norm_nonneg z]) hτ_lt_nat hH_bound_rpow ++ rcases zero_free_polynomial_growth_is_exp_poly (H := H) (n := m + 1) ++ hH_entire hH_ne hH_growth_nat with ++ ⟨P, hPn, hHP⟩ ++ have hPnat : P.natDegree ≤ m := by ++ have hbound : ++ ∃ C > 0, ∀ z : ℂ, ++ ‖Complex.exp (Polynomial.eval z P)‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := by ++ rcases hH_bound_rpow with ⟨C, hCpos, hC⟩ ++ exact ⟨C, hCpos, fun z => by simpa [hHP z] using (hC z)⟩ ++ have := natDegree_le_floor_of_exp_eval_norm_bound hτ_nonneg P hbound ++ simpa [hfloorτ] using this ++ refine ⟨P, ?_, ?_⟩ ++ · have : P.degree ≤ m := Polynomial.degree_le_of_natDegree_le hPnat ++ simpa [m] using this ++ · intro z ++ have hH' : H z = Complex.exp (Polynomial.eval z P) := by simpa using (hHP z) ++ simpa [hH', mul_assoc, mul_left_comm, mul_comm, m] using (hfactor z) ++ ++end Complex.Hadamard ++end ++end HadamardSourceScope33 ++ ++end HadamardAssemblyScope ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Mathlib/Algebra/Notation/Support.lean b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Algebra/Notation/Support.lean +new file mode 100644 +index 0000000..39dd03b +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Algebra/Notation/Support.lean +@@ -0,0 +1,17 @@ ++import Mathlib.Algebra.Notation.Support ++ ++namespace Erdos970 ++ ++namespace Function ++ ++variable {α : Type*} [Zero α] ++ ++theorem support_id : _root_.Function.support (id : α → α) = {0}ᶜ := by ++ ext; simp ++ ++theorem support_id' {α : Type*} [Zero α] : _root_.Function.support (fun x : α ↦ x) = {0}ᶜ := ++ support_id ++ ++end Function ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/Asymptotics/Asymptotics.lean b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/Asymptotics/Asymptotics.lean +new file mode 100644 +index 0000000..1ef2299 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/Asymptotics/Asymptotics.lean +@@ -0,0 +1,42 @@ ++import Mathlib.Analysis.Asymptotics.Lemmas ++import Mathlib.Topology.Order.Compact ++ ++namespace Erdos970 ++ ++open Filter Topology ++ ++namespace Asymptotics ++ ++variable {α : Type*} {β : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*} ++ {F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {R : Type*} ++ {R' : Type*} {𝕜 : Type*} {𝕜' : Type*} ++ ++variable [Norm E] [Norm F] [Norm G] ++ ++variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G'] ++ [NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R] ++ [SeminormedRing R'] ++ ++theorem isLittleO_const_id_cocompact [ProperSpace F''] ++ (c : E'') : (fun _x : F'' => c) =o[cocompact F''] id := ++ _root_.Asymptotics.isLittleO_const_left.2 <| Or.inr tendsto_norm_cocompact_atTop ++ ++theorem isLittleO_const_id_atTop2 [LinearOrder F''] [NoMaxOrder F''] [ClosedIciTopology F''] ++ [ProperSpace F''] (c : E'') : (fun _x : F'' => c) =o[atTop] id := ++ (isLittleO_const_id_cocompact c).mono atTop_le_cocompact ++ ++theorem isLittleO_const_id_atBot2 [LinearOrder F''] [NoMinOrder F''] [ClosedIicTopology F''] ++ [ProperSpace F''] (c : E'') : (fun _x : F'' => c) =o[atBot] id := ++ (isLittleO_const_id_cocompact c).mono atBot_le_cocompact ++ ++theorem _root_.Erdos970.Filter.Eventually.natCast {f : ℝ → Prop} (hf : ∀ᶠ x in atTop, f x) : ++ ∀ᶠ n : ℕ in atTop, f n := ++ tendsto_natCast_atTop_atTop.eventually hf ++ ++theorem IsBigO.natCast {f g : ℝ → E} (h : f =O[atTop] g) : ++ (fun n : ℕ => f n) =O[atTop] fun n : ℕ => g n := ++ h.comp_tendsto tendsto_natCast_atTop_atTop ++ ++end Asymptotics ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean +new file mode 100644 +index 0000000..b8b7136 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Mathlib/Analysis/SpecialFunctions/Log/Basic.lean +@@ -0,0 +1,20 @@ ++import Mathlib.Algebra.Order.Floor.Defs ++import Mathlib.Algebra.Order.Floor.Ring ++import Mathlib.Algebra.Order.Floor.Semiring ++import Mathlib.Analysis.SpecialFunctions.Log.Basic ++import Mathlib.Analysis.SpecialFunctions.Pow.Continuity ++ ++namespace Erdos970 ++ ++open Filter Real ++ ++theorem Real.tendsto_pow_log_div_pow_atTop (a : ℝ) (b : ℝ) (ha : 0 < a) : ++ Filter.Tendsto (fun x ↦ log x ^ b / x^a) Filter.atTop (nhds 0) := by ++ apply Asymptotics.isLittleO_iff_tendsto' _|>.mp <| isLittleO_log_rpow_rpow_atTop _ ha ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ intro h ++ rw [rpow_eq_zero hx.le ha.ne.symm] at h ++ exfalso ++ linarith ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/MellinCalculus.lean b/PrimeNumberTheoremAnd/Erdos970/MellinCalculus.lean +new file mode 100644 +index 0000000..12adb34 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/MellinCalculus.lean +@@ -0,0 +1,1024 @@ ++import Batteries.Tactic.Lemma ++import Mathlib.Algebra.GroupWithZero.Units.Basic ++import Mathlib.Analysis.MellinTransform ++import Mathlib.MeasureTheory.Integral.IntegrableOn ++import Mathlib.Tactic.Bound ++import Mathlib.Tactic.GCongr ++import PrimeNumberTheoremAnd.Erdos970.Auxiliary ++ ++namespace Erdos970 ++ ++open scoped ContDiff ++ ++ ++open _root_.Complex _root_.Topology _root_.Filter _root_.Real _root_.MeasureTheory ++ _root_.Set _root_.Function ++ ++theorem MeasureTheory.setIntegral_integral_swap {α : Type*} {β : Type*} {E : Type*} ++ [MeasurableSpace α] [MeasurableSpace β] {μ : MeasureTheory.Measure α} ++ {ν : MeasureTheory.Measure β} [NormedAddCommGroup E] ++ [MeasureTheory.SigmaFinite ν] [NormedSpace ℝ E] [MeasureTheory.SigmaFinite μ] ++ (f : α → β → E) {s : Set α} {t : Set β} ++ (hf : IntegrableOn (f.uncurry) (s ×ˢ t) (μ.prod ν)) : ++ (∫ (x : α) in s, ∫ (y : β) in t, f x y ∂ν ∂μ) ++ = ∫ (y : β) in t, ∫ (x : α) in s, f x y ∂μ ∂ν := by ++ apply integral_integral_swap ++ convert hf.integrable ++ exact Measure.prod_restrict s t ++ ++open Erdos970.Complex Erdos970.MeasureTheory ++ ++variable {𝕂 : Type*} [RCLike 𝕂] ++ ++lemma MeasureTheory.integral_comp_mul_right_I0i_haar ++ (f : ℝ → 𝕂) {a : ℝ} (ha : 0 < a) : ++ ∫ (y : ℝ) in Ioi 0, f (y * a) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by ++ have := integral_comp_mul_right_Ioi (fun y ↦ f y / y) 0 ha ++ simp only [RCLike.ofReal_mul, zero_mul, eq_inv_smul_iff₀ (ne_of_gt ha)] at this ++ rw [← integral_smul] at this ++ rw [← this, setIntegral_congr_fun (by simp)] ++ intro _ _ ++ simp only [RCLike.real_smul_eq_coe_mul] ++ rw [mul_comm (a : 𝕂), div_mul, mul_div_assoc, div_self ?_, mul_one] ++ exact (RCLike.ofReal_ne_zero).mpr <| ne_of_gt ha ++ ++lemma MeasureTheory.integral_comp_mul_right_I0i_haar_real ++ (f : ℝ → ℝ) {a : ℝ} (ha : 0 < a) : ++ ∫ (y : ℝ) in Ioi 0, f (y * a) / y = ∫ (y : ℝ) in Ioi 0, f y / y := ++ MeasureTheory.integral_comp_mul_right_I0i_haar f ha ++ ++lemma MeasureTheory.integral_comp_mul_left_I0i_haar ++ (f : ℝ → 𝕂) {a : ℝ} (ha : 0 < a) : ++ ∫ (y : ℝ) in Ioi 0, f (a * y) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by ++ convert integral_comp_mul_right_I0i_haar f ha using 5; ring ++ ++lemma MeasureTheory.integral_comp_rpow_I0i_haar_real (f : ℝ → ℝ) {p : ℝ} (hp : p ≠ 0) : ++ ∫ (y : ℝ) in Ioi 0, |p| * f (y ^ p) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by ++ rw [← integral_comp_rpow_Ioi (fun y ↦ f y / y) hp, setIntegral_congr_fun (by simp)] ++ intro y hy ++ have ypos : 0 < y := mem_Ioi.mp hy ++ simp only [rpow_sub_one ypos.ne', smul_eq_mul] ++ field_simp ++ ++lemma MeasureTheory.integral_comp_inv_I0i_haar (f : ℝ → 𝕂) : ++ ∫ (y : ℝ) in Ioi 0, f (1 / y) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by ++ have := integral_comp_rpow_Ioi (fun y ↦ f y / y) (p := -1) (by simp) ++ rw [← this, setIntegral_congr_fun (by simp)] ++ intro y hy ++ have : (y : 𝕂) ≠ 0 := (RCLike.ofReal_ne_zero).mpr <| LT.lt.ne' hy ++ simp only [abs_neg, abs_one, rpow_neg_one, map_inv₀, div_inv_eq_mul, ++ RCLike.real_smul_eq_coe_mul, RCLike.algebraMap_eq_ofReal] ++ ring_nf ++ simp [field] ++ ++lemma MeasureTheory.integral_comp_div_I0i_haar ++ (f : ℝ → 𝕂) {a : ℝ} (ha : 0 < a) : ++ ∫ (y : ℝ) in Ioi 0, f (a / y) / y = ∫ (y : ℝ) in Ioi 0, f y / y := by ++ calc ++ _ = ∫ (y : ℝ) in Ioi 0, f (a * y) / y := ?_ ++ _ = _ := integral_comp_mul_left_I0i_haar f ha ++ convert (integral_comp_inv_I0i_haar fun y ↦ f (a * (1 / y))).symm using 4 ++ · rw [mul_one_div] ++ · rw [one_div_one_div] ++ ++theorem Complex.ofReal_rpow {x : ℝ} (h : x > 0) (y : ℝ) : ++ (((x : ℝ) ^ (y : ℝ)) : ℝ) = (x : ℂ) ^ (y : ℂ) := by ++ rw [rpow_def_of_pos h, ofReal_exp, ofReal_mul, Complex.ofReal_log h.le, ++ Complex.cpow_def_of_ne_zero] ++ simp only [ne_eq, ofReal_eq_zero, ne_of_gt h, not_false_eq_true] ++ ++@[simp] ++lemma Function.support_abs {α : Type*} (f : α → 𝕂) : ++ (fun x ↦ ‖f x‖).support = f.support := by ++ simp only [support, ne_eq]; simp_rw [norm_ne_zero_iff] ++ ++@[simp] ++lemma Function.support_ofReal {f : ℝ → ℝ} : ++ (fun x ↦ ((f x) : ℂ)).support = f.support := by ++ apply Function.support_comp_eq (g := ofReal); simp ++ ++lemma Function.support_mul_subset_of_subset {s : Set ℝ} {f g : ℝ → 𝕂} ++ (fSupp : f.support ⊆ s) : (f * g).support ⊆ s := by ++ simp_rw [support_mul', inter_subset, subset_union_of_subset_right fSupp] ++ ++lemma Function.support_of_along_fiber_subset_subset {α β M : Type*} [Zero M] ++ {f : α × β → M} {s : Set α} {t : Set β} ++ (hx : ∀ (y : β), (fun x ↦ f (x, y)).support ⊆ s) ++ (hy : ∀ (x : α), (fun y ↦ f (x, y)).support ⊆ t) : ++ f.support ⊆ s ×ˢ t := by ++ intro ⟨x, y⟩ hxy ++ constructor ++ · exact hx y (by simp only [Function.mem_support, ne_eq] at hxy ⊢; exact hxy) ++ · exact hy x (by simp only [Function.mem_support, ne_eq] at hxy ⊢; exact hxy) ++ ++lemma Function.support_deriv_subset_Icc {a b : ℝ} {f : ℝ → 𝕂} ++ (fSupp : f.support ⊆ Set.Icc a b) : ++ (deriv f).support ⊆ Set.Icc a b := by ++ have := support_deriv_subset (f := fun x ↦ f x) ++ dsimp [tsupport] at this ++ have := subset_trans this <| closure_mono fSupp ++ rwa [closure_Icc] at this ++ ++lemma IntervalIntegral.integral_eq_integral_of_support_subset_Icc {a b : ℝ} {μ : Measure ℝ} ++ [NullSingletonClass μ] {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] ++ {f : ℝ → E} (h : f.support ⊆ Icc a b) : ++ ∫ x in a..b, f x ∂μ = ∫ x, f x ∂μ := by ++ rcases le_total a b with hab | hab ++ · rw [intervalIntegral.integral_of_le hab, ← integral_Icc_eq_integral_Ioc, ++ ← integral_indicator measurableSet_Icc, indicator_eq_self.2 h] ++ · by_cases hab2 : b = a ++ · rw [hab2] at h ⊢ ++ simp only [intervalIntegral.integral_same] ++ simp only [Icc_self] at h ++ have : ∫ (x : ℝ), f x ∂μ = ∫ (x : ℝ) in {a}, f x ∂μ := by ++ rw [ ← integral_indicator (by simp), indicator_eq_self.2 h] ++ rw [this, integral_singleton]; simp [Measure.real] ++ · rw [Icc_eq_empty_iff.mpr <| by exact fun x ↦ hab2 <| le_antisymm hab x, subset_empty_iff, ++ Function.support_eq_empty_iff] at h; simp [h] ++ ++lemma SetIntegral.integral_eq_integral_inter_of_support_subset {μ : Measure ℝ} ++ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] ++ {s t : Set ℝ} {f : ℝ → E} (h : f.support ⊆ t) (ht : MeasurableSet t) : ++ ∫ x in s, f x ∂μ = ∫ x in s ∩ t, f x ∂μ := by ++ rw [← setIntegral_indicator ht, indicator_eq_self.2 h] ++ ++lemma SetIntegral.integral_eq_integral_inter_of_support_subset_Icc {a b} {μ : Measure ℝ} ++ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] ++ {s : Set ℝ} {f : ℝ → E} (h : f.support ⊆ Icc a b) (hs : Icc a b ⊆ s) : ++ ∫ x in s, f x ∂μ = ∫ x in Icc a b, f x ∂μ := by ++ rw [SetIntegral.integral_eq_integral_inter_of_support_subset h measurableSet_Icc, ++ inter_eq_self_of_subset_right hs] ++ ++lemma intervalIntegral.norm_integral_le_of_norm_le_const' {a b C : ℝ} ++ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] ++ {f : ℝ → E} (hab : a ≤ b) (h : ∀ x ∈ (Icc a b), ‖f x‖ ≤ C) : ++ ‖∫ x in a..b, f x‖ ≤ C * |b - a| := by ++ apply intervalIntegral.norm_integral_le_of_norm_le_const ++ exact fun x hx ↦ h x <| mem_Icc_of_Ioc <| uIoc_of_le hab ▸ hx ++ ++lemma Filter.TendstoAtZero_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) (ha : 0 < a) ++ (fSupp : f.support ⊆ Set.Icc a b) : ++ Tendsto f (𝓝[>]0) (𝓝 0) := by ++ apply Tendsto.comp (tendsto_nhds_of_eventually_eq ?_) tendsto_id ++ filter_upwards [Ioo_mem_nhdsGT ha] with c hc; replace hc := (mem_Ioo.mp hc).2 ++ have h : c ∉ Icc a b := fun h ↦ by linarith [mem_Icc.mp h] ++ convert mt (Function.support_subset_iff.mp fSupp c) h; simp ++ ++lemma Filter.TendstoAtTop_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) ++ (fSupp : f.support ⊆ Set.Icc a b) : ++ Tendsto f atTop (𝓝 0) := by ++ apply Tendsto.comp (tendsto_nhds_of_eventually_eq ?_) tendsto_id ++ filter_upwards [Ioi_mem_atTop b] with c hc; rw [mem_Ioi] at hc ++ have h : c ∉ Icc a b := fun h ↦ by linarith [mem_Icc.mp h] ++ convert mt (Function.support_subset_iff.mp fSupp c) h; simp ++ ++lemma Filter.BigO_zero_atZero_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) (ha : 0 < a) ++ (fSupp : f.support ⊆ Set.Icc a b) : ++ f =O[𝓝[>] 0] fun _ ↦ (0 : ℝ) := by ++ refine Eventually.isBigO ?_ ++ filter_upwards [Ioo_mem_nhdsGT (by linarith : (0 : ℝ) < a)] with c hc ++ refine norm_le_zero_iff.mpr <| Function.support_subset_iff'.mp fSupp c ?_ ++ exact fun h ↦ by linarith [mem_Icc.mp h, (mem_Ioo.mp hc).2] ++ ++lemma Filter.BigO_zero_atTop_of_support_in_Icc {a b : ℝ} (f : ℝ → 𝕂) ++ (fSupp : f.support ⊆ Set.Icc a b) : ++ f =O[atTop] fun _ ↦ (0 : ℝ) := by ++ refine Eventually.isBigO ?_ ++ filter_upwards [Ioi_mem_atTop b] with c hc; replace hc := mem_Ioi.mp hc ++ refine norm_le_zero_iff.mpr <| Function.support_subset_iff'.mp fSupp c ?_ ++ exact fun h ↦ by linarith [mem_Icc.mp h] ++ ++open Erdos970.Filter ++ ++lemma deriv.ofReal_comp' {f : ℝ → ℝ} : ++ deriv (fun x : ℝ ↦ (f x : ℂ)) = (fun x ↦ ((deriv f) x : ℂ)) := ++ funext fun _ ↦ deriv.ofReal_comp ++ ++lemma deriv.comp_ofReal' {e : ℂ → ℂ} (hf : Differentiable ℂ e) : ++ deriv (fun x : ℝ ↦ e x) = fun (x : ℝ) ↦ deriv e x := ++ funext fun _ ↦ deriv.comp_ofReal (hf.differentiableAt) ++ ++lemma PartialIntegration (f g : ℝ → ℂ) ++ (fDiff : DifferentiableOn ℝ f (Ioi 0)) ++ (gDiff : DifferentiableOn ℝ g (Ioi 0)) ++ (fDerivgInt : IntegrableOn (f * deriv g) (Ioi 0)) ++ (gDerivfInt : IntegrableOn (deriv f * g) (Ioi 0)) ++ (lim_at_zero : Tendsto (f * g) (𝓝[>] 0) (𝓝 0)) ++ (lim_at_inf : Tendsto (f * g) atTop (𝓝 0)) : ++ ∫ x in Ioi 0, f x * deriv g x = -∫ x in Ioi 0, deriv f x * g x := by ++ simpa using integral_Ioi_mul_deriv_eq_deriv_mul ++ (fun x hx ↦ fDiff.hasDerivAt (Ioi_mem_nhds hx)) ++ (fun x hx ↦ gDiff.hasDerivAt (Ioi_mem_nhds hx)) ++ fDerivgInt gDerivfInt lim_at_zero lim_at_inf ++ ++lemma PartialIntegration_of_support_in_Icc {a b : ℝ} (f g : ℝ → ℂ) (ha : 0 < a) ++ (h : a ≤ b) ++ (fSupp : f.support ⊆ Set.Icc a b) ++ (fDiff : DifferentiableOn ℝ f (Ioi 0)) ++ (gDiff : DifferentiableOn ℝ g (Ioi 0)) ++ (fderivCont : ContinuousOn (deriv f) (Ioi 0)) ++ (gderivCont : ContinuousOn (deriv g) (Ioi 0)) : ++ ∫ x in Ioi 0, f x * deriv g x = -∫ x in Ioi 0, deriv f x * g x := by ++ have Icc_sub : Icc a b ⊆ Ioi 0 := (Icc_subset_Ioi_iff h).mpr ha ++ have fderivSupp := Function.support_deriv_subset_Icc fSupp ++ have fgSupp : (f * g).support ⊆ Icc a b := Function.support_mul_subset_of_subset fSupp ++ have fDerivgInt : IntegrableOn (f * deriv g) (Ioi 0) := by ++ apply (integrableOn_iff_integrable_of_support_subset <| ++ Function.support_mul_subset_of_subset fSupp).mp ++ exact fDiff.continuousOn.mono Icc_sub |>.mul (gderivCont.mono Icc_sub) |>.integrableOn_Icc ++ have gDerivfInt : IntegrableOn (deriv f * g) (Ioi 0) := by ++ apply (integrableOn_iff_integrable_of_support_subset <| ++ Function.support_mul_subset_of_subset fderivSupp).mp ++ exact fderivCont.mono Icc_sub |>.mul (gDiff.continuousOn.mono Icc_sub) |>.integrableOn_Icc ++ have lim_at_zero : Tendsto (f * g) (𝓝[>]0) (𝓝 0) := ++ TendstoAtZero_of_support_in_Icc (f * g) ha fgSupp ++ have lim_at_inf : Tendsto (f * g) atTop (𝓝 0) := TendstoAtTop_of_support_in_Icc (f * g) fgSupp ++ apply PartialIntegration f g fDiff gDiff fDerivgInt gDerivfInt lim_at_zero lim_at_inf ++ ++local notation (name := mellintransform) "𝓜" => mellin ++ ++noncomputable def MellinConvolution (f g : ℝ → 𝕂) (x : ℝ) : 𝕂 := ++ ∫ y in Ioi 0, f y * g (x / y) / y ++ ++lemma MellinConvolutionSymmetric (f g : ℝ → 𝕂) {x : ℝ} (xpos : 0 < x) : ++ MellinConvolution f g x = MellinConvolution g f x := by ++ unfold MellinConvolution ++ calc ++ _ = ∫ y in Ioi 0, f (y * x) * g (1 / y) / y := ?_ ++ _ = _ := ?_ ++ · rw [← integral_comp_mul_right_I0i_haar (fun y ↦ f y * g (x / y)) xpos] ++ simp [div_mul_cancel_right₀ <| ne_of_gt xpos] ++ · convert (integral_comp_inv_I0i_haar fun y ↦ f (y * x) * g (1 / y)).symm using 3 ++ rw [one_div_one_div, mul_comm, mul_comm_div, one_mul] ++ ++open Pointwise in ++lemma support_MellinConvolution_subsets {f g : ℝ → 𝕂} {A B : Set ℝ} (hf : f.support ⊆ A) ++ (hg : g.support ⊆ B) : (MellinConvolution f g).support ⊆ A * B := by ++ rw [Function.support_subset_iff'] at hf hg ⊢ ++ intro x hx ++ unfold MellinConvolution ++ simp only [Set.mem_mul, not_exists, not_and] at hx ++ apply MeasureTheory.integral_eq_zero_of_ae ++ filter_upwards [ae_restrict_mem (by measurability)] ++ intro y hy ++ simp only [mem_Ioi] at hy ++ simp only [Pi.zero_apply, div_eq_zero_iff, mul_eq_zero, map_eq_zero] ++ left ++ by_cases hyA : y ∈ A ++ · right ++ apply hg ++ intro hxyB ++ apply hx _ hyA _ hxyB ++ field_simp ++ · left ++ apply hf _ hyA ++ ++open Pointwise in ++lemma support_MellinConvolution (f g : ℝ → 𝕂) : ++ (MellinConvolution f g).support ⊆ f.support * g.support := ++ support_MellinConvolution_subsets subset_rfl subset_rfl ++ ++ ++lemma MellinConvolutionTransform (f g : ℝ → ℂ) (s : ℂ) ++ (hf : IntegrableOn (fun x y ↦ f y * g (x / y) / (y : ℂ) * (x : ℂ) ^ (s - 1)).uncurry ++ (Ioi 0 ×ˢ Ioi 0)) : ++ 𝓜 (MellinConvolution f g) s = 𝓜 f s * 𝓜 g s := by ++ dsimp [mellin, MellinConvolution] ++ set f₁ : ℝ × ℝ → ℂ := ++ fun ⟨x, y⟩ ↦ f y * g (x / y) / (y : ℂ) * (x : ℂ) ^ (s - 1) ++ calc ++ _ = ∫ (x : ℝ) in Ioi 0, ∫ (y : ℝ) in Ioi 0, f₁ (x, y) := ?_ ++ _ = ∫ (y : ℝ) in Ioi 0, ∫ (x : ℝ) in Ioi 0, f₁ (x, y) := ++ setIntegral_integral_swap _ hf ++ _ = ∫ (y : ℝ) in Ioi 0, ∫ (x : ℝ) in Ioi 0, ++ f y * g (x / y) / ↑y * ↑x ^ (s - 1) := rfl ++ _ = ∫ (y : ℝ) in Ioi 0, ∫ (x : ℝ) in Ioi 0, ++ f y * g (x * y / y) / ↑y * ↑(x * y) ^ (s - 1) * y := ?_ ++ _ = ∫ (y : ℝ) in Ioi 0, ∫ (x : ℝ) in Ioi 0, ++ f y * ↑y ^ (s - 1) * (g x * ↑x ^ (s - 1)) := ?_ ++ _ = ∫ (y : ℝ) in Ioi 0, ++ f y * ↑y ^ (s - 1) * ∫ (x : ℝ) in Ioi 0, g x * ↑x ^ (s - 1) := ?_ ++ _ = _ := integral_mul_const _ _ ++ <;> try (rw [setIntegral_congr_fun (by simp)]; intro y hy; simp only [ofReal_mul]) ++ · simp only [integral_mul_const, f₁, mul_comm] ++ · simp only [integral_mul_const] ++ have := integral_comp_mul_right_Ioi ++ (fun x ↦ f y * g (x / y) / (y : ℂ) * (x : ℂ) ^ (s - 1)) 0 hy ++ have y_ne_zeroℂ : (y : ℂ) ≠ 0 := slitPlane_ne_zero (Or.inl hy) ++ field_simp at this ⊢ ++ simp only [ofReal_mul, one_div, mul_zero, real_smul, ofReal_inv, field] at this ⊢ ++ rw [← this] ++ field_simp ++ congr with x ++ ring_nf ++ · rw [setIntegral_congr_fun (by simp)] ++ intro x hx ++ have y_ne_zeroℝ : y ≠ 0 := ne_of_gt (mem_Ioi.mp hy) ++ have y_ne_zeroℂ : (y : ℂ) ≠ 0 := by exact_mod_cast y_ne_zeroℝ ++ field_simp ++ rw [mul_cpow_ofReal_nonneg hy.le hx.le] ++ ring ++ · apply integral_const_mul ++ · congr <;> ext <;> ring ++ ++lemma mem_within_strip (σ₁ σ₂ : ℝ) : ++ {s : ℂ | σ₁ ≤ s.re ∧ s.re ≤ σ₂} ∈ ++ 𝓟 {s | σ₁ ≤ s.re ∧ s.re ≤ σ₂} := ++ mem_principal_self _ ++ ++lemma MellinOfPsi_aux {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) ++ (suppν : ν.support ⊆ Set.Icc (1 / 2) 2) ++ {s : ℂ} (hs : s ≠ 0) : ++ ∫ (x : ℝ) in Ioi 0, (ν x) * (x : ℂ) ^ (s - 1) = ++ - (1 / s) * ∫ (x : ℝ) in Ioi 0, (deriv ν x) * (x : ℂ) ^ s := by ++ let g (s : ℂ) := fun (x : ℝ) ↦ x ^ s / s ++ have gderiv {s : ℂ} (hs : s ≠ 0) {x: ℝ} (hx : x ∈ Ioi 0) : ++ deriv (g s) x = x ^ (s - 1) := by ++ have := HasDerivAt.cpow_const (c := s) (hasDerivAt_id (x : ℂ)) (Or.inl hx) ++ simp_rw [mul_one, id_eq] at this ++ rw [deriv_div_const, deriv.comp_ofReal (e := fun x ↦ x ^ s)] ++ · rw [this.deriv, mul_div_right_comm, div_self hs, one_mul] ++ · apply hasDerivAt_deriv_iff.mp ++ simp only [this.deriv, this] ++ calc ++ _ = ∫ (x : ℝ) in Ioi 0, ↑(ν x) * deriv (@g s) x := ?_ ++ _ = -∫ (x : ℝ) in Ioi 0, deriv (fun x ↦ ↑(ν x)) x * @g s x := ?_ ++ _ = -∫ (x : ℝ) in Ioi 0, deriv ν x * @g s x := ?_ ++ _ = -∫ (x : ℝ) in Ioi 0, deriv ν x * x ^ s / s := by simp only [mul_div, g] ++ _ = _ := ?_ ++ · rw [setIntegral_congr_fun (by simp)] ++ intro _ hx ++ simp only [gderiv hs hx] ++ · apply PartialIntegration_of_support_in_Icc (ν ·) (g s) ++ (a := 1 / 2) (b := 2) (by norm_num) (by norm_num) ++ · simpa only [Function.support_subset_iff, ne_eq, ofReal_eq_zero] ++ · exact (Differentiable.ofReal_comp_iff.mpr ++ (diffν.differentiable (by norm_num))).differentiableOn ++ · refine DifferentiableOn.div_const ?_ s ++ intro a ha ++ refine DifferentiableAt.comp_ofReal (e := fun x ↦ x ^ s) ?_ |>.differentiableWithinAt ++ apply differentiableAt_fun_id.cpow (differentiableAt_const s) <| by exact Or.inl ha ++ · simp only [deriv.ofReal_comp'] ++ exact continuous_ofReal.comp (diffν.continuous_deriv (by norm_num)) |>.continuousOn ++ · apply ContinuousOn.congr (f := fun (x : ℝ) ↦ (x : ℂ) ^ (s - 1)) ?_ ++ fun x hx ↦ gderiv hs hx ++ exact Continuous.continuousOn (by continuity) |>.cpow continuousOn_const (by simp) ++ · congr; funext; congr ++ apply (hasDerivAt_deriv_iff.mpr ?_).ofReal_comp.deriv ++ exact diffν.contDiffAt.differentiableAt (by norm_num) ++ · simp only [neg_mul, neg_inj] ++ conv => lhs; rhs; intro; rw [← mul_one_div, mul_comm] ++ rw [integral_const_mul] ++ ++lemma MellinOfPsi {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) ++ (suppν : ν.support ⊆ Set.Icc (1 / 2) 2) : ++ ∃ C > 0, ∀ (σ₁ : ℝ) (_ : 0 < σ₁) (s : ℂ) (_ : σ₁ ≤ s.re) (_ : s.re ≤ 2), ++ ‖𝓜 (fun x ↦ (ν x : ℂ)) s‖ ≤ C * ‖s‖⁻¹ := by ++ let f := fun (x : ℝ) ↦ ‖deriv ν x‖ ++ have cont : ContinuousOn f (Icc (1 / 2) 2) := ++ (Continuous.comp (by continuity) <| diffν.continuous_deriv (by norm_num)).continuousOn ++ obtain ⟨a, _, max⟩ := isCompact_Icc.exists_isMaxOn (f := f) (by norm_num) cont ++ let σ₂ : ℝ := 2 ++ let C : ℝ := f a * 2 ^ σ₂ * (3 / 2) ++ have mainBnd : ∀ (σ₁ : ℝ), 0 < σ₁ → ∀ (s : ℂ), σ₁ ≤ s.re → s.re ≤ 2 → ++ ‖𝓜 (fun x ↦ (ν x : ℂ)) s‖ ≤ C * ‖s‖⁻¹ := by ++ intro σ₁ σ₁pos s hs₁ hs₂ ++ have s_ne_zero: s ≠ 0 := fun h ↦ by linarith [zero_re ▸ h ▸ hs₁] ++ simp only [mellin, f, MellinOfPsi_aux diffν suppν s_ne_zero, norm_mul, smul_eq_mul, mul_comm] ++ gcongr ++ · simp ++ calc ++ _ ≤ ∫ (x : ℝ) in Ioi 0, ‖(deriv ν x * (x : ℂ) ^ s)‖ := ?_ ++ _ = ∫ (x : ℝ) in Icc (1 / 2) 2, ‖(deriv ν x * (x : ℂ) ^ s)‖ := ?_ ++ _ ≤ ‖∫ (x : ℝ) in Icc (1 / 2) 2, ‖(deriv ν x * (x : ℂ) ^ s)‖‖ := ++ le_abs_self _ ++ _ ≤ _ := ?_ ++ · simp_rw [norm_integral_le_integral_norm] ++ · apply SetIntegral.integral_eq_integral_inter_of_support_subset_Icc ++ · simp only [Function.support_abs, Function.support_mul, Function.support_ofReal] ++ apply subset_trans (by apply inter_subset_left) <| Function.support_deriv_subset_Icc suppν ++ · exact (Icc_subset_Ioi_iff (by norm_num)).mpr (by norm_num) ++ · have := intervalIntegral.norm_integral_le_of_norm_le_const' (C := f a * 2 ^ σ₂) ++ (f := fun x ↦ f x * ‖(x : ℂ) ^ s‖) (a := (1 / 2 : ℝ)) ( b := 2) (by norm_num) ?_ ++ · simp only [Real.norm_eq_abs, norm_real, norm_mul] at this ⊢ ++ rwa [(by norm_num: |(2 : ℝ) - 1 / 2| = 3 / 2), ++ intervalIntegral.integral_of_le (by norm_num), ← integral_Icc_eq_integral_Ioc] at this ++ · intro x hx; ++ have f_bound := isMaxOn_iff.mp max x hx ++ have pow_bound : ‖(x : ℂ) ^ s‖ ≤ 2 ^ σ₂ := by ++ rw [norm_cpow_eq_rpow_re_of_pos (by linarith [mem_Icc.mp hx])] ++ have xpos : 0 ≤ x := by linarith [(mem_Icc.mp hx).1] ++ have h := rpow_le_rpow xpos (mem_Icc.mp hx).2 (by linarith : 0 ≤ s.re) ++ exact le_trans h <| rpow_le_rpow_of_exponent_le (by norm_num) hs₂ ++ convert! mul_le_mul f_bound pow_bound (norm_nonneg _) ?_ using 1 <;> simp [f] ++ have Cnonneg : 0 ≤ C := by ++ have hh := mainBnd 1 (by norm_num) ((3 : ℂ) / 2) (by norm_num) (by norm_num) ++ have hhh : 0 ≤ ‖𝓜 (fun x ↦ (ν x : ℂ)) ((3 : ℂ) / 2)‖ := by positivity ++ have hhhh : 0 < ‖(3 : ℂ) / 2‖⁻¹ := by norm_num ++ have := hhh.trans hh ++ exact (mul_nonneg_iff_of_pos_right hhhh).mp this ++ by_cases CeqZero : C = 0 ++ · refine ⟨1, by linarith, ?_⟩ ++ intro ε εpos s hs₁ hs₂ ++ have := mainBnd ε εpos s hs₁ hs₂ ++ rw [CeqZero, zero_mul] at this ++ have : 0 ≤ 1 * ‖s‖⁻¹ := by positivity ++ linarith ++ · exact ⟨C, lt_of_le_of_ne Cnonneg fun a ↦ CeqZero (id (Eq.symm a)), mainBnd⟩ ++ ++noncomputable def DeltaSpike (ν : ℝ → ℝ) (ε : ℝ) : ℝ → ℝ := ++ fun x ↦ ν (x ^ (1 / ε)) / ε ++ ++lemma DeltaSpikeMass {ν : ℝ → ℝ} (mass_one : ∫ x in Ioi 0, ν x / x = 1) {ε : ℝ} ++ (εpos : 0 < ε) : ∫ x in Ioi 0, ((DeltaSpike ν ε) x) / x = 1 := ++ calc ++ _ = ∫ (x : ℝ) in Ioi 0, (|1/ε| * x ^ (1 / ε - 1)) • ++ ((fun z ↦ (ν z) / z) (x ^ (1 / ε))) := by ++ apply setIntegral_congr_ae measurableSet_Ioi ++ filter_upwards with x hx ++ simp only [smul_eq_mul, abs_of_pos (one_div_pos.mpr εpos)] ++ symm; calc ++ _ = (ν (x ^ (1 / ε)) / x ^ (1 / ε)) * x ^ (1 / ε - 1) * (1 / ε) := by ring ++ _ = _ := by rw [rpow_sub hx, rpow_one] ++ _ = (ν (x ^ (1 / ε)) / x ^ (1 / ε) * x ^ (1 / ε) / x) * (1/ ε) := by ring ++ _ = _ := by rw [div_mul_cancel₀ _ (ne_of_gt (rpow_pos_of_pos hx (1/ε)))] ++ _ = (ν (x ^ (1 / ε)) / ε / x) := by ring ++ _ = 1 := by ++ rw [integral_comp_rpow_Ioi (fun z ↦ (ν z) / z), ← mass_one] ++ simp only [ne_eq, div_eq_zero_iff, one_ne_zero, εpos.ne', or_self, not_false_eq_true] ++ ++lemma DeltaSpikeSupport_aux {ν : ℝ → ℝ} {ε : ℝ} (εpos : 0 < ε) ++ (suppν : ν.support ⊆ Icc (1 / 2) 2) : ++ (fun x ↦ if x < 0 then 0 else DeltaSpike ν ε x).support ⊆ Icc (2 ^ (-ε)) (2 ^ ε) := by ++ unfold DeltaSpike ++ simp only [one_div, Function.support_subset_iff, ne_eq, ite_eq_left_iff, not_lt, div_eq_zero_iff, ++ not_forall, exists_prop, mem_Icc, and_imp] ++ intro x hx h; push Not at h ++ have := suppν <| Function.mem_support.mpr h.1 ++ simp only [one_div, mem_Icc] at this ++ have hl := (le_rpow_inv_iff_of_pos (by norm_num) hx εpos).mp this.1 ++ rw [inv_rpow (by norm_num) ε, ← rpow_neg (by norm_num)] at hl ++ refine ⟨hl, (rpow_inv_le_iff_of_pos ?_ (by norm_num) εpos).mp this.2⟩ ++ linarith [(by apply rpow_nonneg (by norm_num) : 0 ≤ (2 : ℝ) ^ (-ε))] ++ ++lemma DeltaSpikeSupport' {ν : ℝ → ℝ} {ε x : ℝ} (εpos : 0 < ε) (xnonneg : 0 ≤ x) ++ (suppν : ν.support ⊆ Icc (1 / 2) 2) : ++ DeltaSpike ν ε x ≠ 0 → x ∈ Icc (2 ^ (-ε)) (2 ^ ε) := by ++ intro h ++ have : (fun x ↦ if x < 0 then 0 else DeltaSpike ν ε x) x = DeltaSpike ν ε x := by ++ simp [xnonneg] ++ rw [← this] at h ++ exact (Function.support_subset_iff.mp <| DeltaSpikeSupport_aux εpos suppν) _ h ++ ++lemma DeltaSpikeSupport {ν : ℝ → ℝ} {ε x : ℝ} (εpos : 0 < ε) (xnonneg : 0 ≤ x) ++ (suppν : ν.support ⊆ Icc (1 / 2) 2) : ++ x ∉ Icc (2 ^ (-ε)) (2 ^ ε) → DeltaSpike ν ε x = 0 := by ++ contrapose!; exact DeltaSpikeSupport' εpos xnonneg suppν ++ ++@[fun_prop] ++lemma DeltaSpikeContinuous {ν : ℝ → ℝ} {ε : ℝ} (εpos : 0 < ε) ++ (diffν : ContDiff ℝ 1 ν) : Continuous (fun x ↦ DeltaSpike ν ε x) := by ++ apply diffν.continuous.comp (g := ν) _ |>.div_const ++ exact continuous_id.rpow_const fun _ ↦ Or.inr <| div_nonneg (by norm_num) εpos.le ++ ++lemma DeltaSpikeOfRealContinuous {ν : ℝ → ℝ} {ε : ℝ} (εpos : 0 < ε) ++ (diffν : ContDiff ℝ 1 ν) : Continuous (fun x ↦ (DeltaSpike ν ε x : ℂ)) := ++ continuous_ofReal.comp <| DeltaSpikeContinuous εpos diffν ++ ++ ++theorem MellinOfDeltaSpike (ν : ℝ → ℝ) {ε : ℝ} (εpos : ε > 0) (s : ℂ) : ++ 𝓜 (fun x ↦ (DeltaSpike ν ε x : ℂ)) s = 𝓜 (fun x ↦ (ν x : ℂ)) (ε * s) := by ++ unfold DeltaSpike ++ push_cast ++ rw [mellin_div_const, mellin_comp_rpow (fun x ↦ (ν x : ℂ)), abs_of_nonneg (by positivity)] ++ simp only [one_div, inv_inv, ofReal_inv, div_inv_eq_mul, real_smul] ++ rw [mul_div_cancel_left₀ _ (ne_zero_of_re_pos εpos)] ++ ring_nf ++ ++lemma MellinOfDeltaSpikeAt1 (ν : ℝ → ℝ) {ε : ℝ} (εpos : ε > 0) : ++ 𝓜 (fun x ↦ (DeltaSpike ν ε x : ℂ)) 1 = 𝓜 (fun x ↦ (ν x : ℂ)) ε := by ++ convert MellinOfDeltaSpike ν εpos 1; simp [mul_one] ++ ++lemma MellinOfDeltaSpikeAt1_asymp {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) ++ (suppν : ν.support ⊆ Set.Icc (1 / 2) 2) ++ (mass_one : ∫ x in Set.Ioi 0, ν x / x = 1) : ++ (fun (ε : ℝ) ↦ (𝓜 (fun x ↦ (ν x : ℂ)) ε) - 1) =O[𝓝[>]0] id := by ++ have diff : DifferentiableWithinAt ℝ ++ (fun (ε : ℝ) ↦ 𝓜 (fun x ↦ (ν x : ℂ)) ε - 1) (Ioi 0) 0 := by ++ apply DifferentiableAt.differentiableWithinAt ++ simp only [(differentiableAt_const _).fun_sub_iff_left] ++ refine DifferentiableAt.comp_ofReal ?_ ++ refine mellin_differentiableAt_of_isBigO_rpow (a := 1) (b := -1) ?_ ?_ (by simp) ?_ (by simp) ++ · apply (Continuous.continuousOn ?_).locallyIntegrableOn (by simp) ++ have := diffν.continuous; continuity ++ · apply Asymptotics.IsBigO.trans_le (g' := fun _ ↦ (0 : ℝ)) ?_ (by simp) ++ apply BigO_zero_atTop_of_support_in_Icc (a := 1 / 2) (b := 2) ++ rwa [Erdos970.Function.support_ofReal (f := ν)] ++ · apply Asymptotics.IsBigO.trans_le (g' := fun _ ↦ (0 : ℝ)) ?_ (by simp) ++ apply BigO_zero_atZero_of_support_in_Icc (a := 1 / 2) (b := 2) (ha := (by norm_num)) ++ rwa [Erdos970.Function.support_ofReal (f := ν)] ++ have := ofReal_zero ▸ diff.isBigO_sub ++ simp only [sub_sub_sub_cancel_right, sub_zero] at this ++ convert! this using 1 ++ simp only [mellin, zero_sub, cpow_neg_one, smul_eq_mul] ++ funext ε ++ congr 1 ++ symm ++ calc (∫ (t : ℝ) in Ioi 0, (↑t)⁻¹ * ↑(ν t) : ℂ) ++ = ∫ (t : ℝ) in Ioi 0, ((ν t / t : ℝ) : ℂ) := ++ integral_congr_ae (Filter.Eventually.of_forall fun t => by push_cast; ring) ++ _ = ((∫ t in Ioi 0, ν t / t : ℝ) : ℂ) := integral_ofReal ++ _ = 1 := by rw [mass_one, ofReal_one] ++ ++lemma MellinOf1 (s : ℂ) (h : s.re > 0) : ++ 𝓜 ((fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0)) s = 1 / s := by ++ convert (hasMellin_one_Ioc h).right ++ congr ++ ++noncomputable def Smooth1 (ν : ℝ → ℝ) (ε : ℝ) : ℝ → ℝ := ++ MellinConvolution (fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0) (DeltaSpike ν ε) ++ ++lemma Smooth1_def_ite {ν : ℝ → ℝ} {ε x : ℝ} (xpos : 0 < x) : ++ Smooth1 ν ε x = MellinConvolution (fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0) ++ (fun x ↦ if x < 0 then 0 else DeltaSpike ν ε x) x := by ++ unfold Smooth1 ++ rw [MellinConvolutionSymmetric _ _ xpos] ++ conv => lhs; rw [MellinConvolutionSymmetric _ _ xpos] ++ unfold MellinConvolution ++ apply MeasureTheory.integral_congr_ae ++ filter_upwards [MeasureTheory.ae_restrict_mem measurableSet_Ioi] ++ simp +contextual only [mem_Ioi, true_and, ite_mul, one_mul, zero_mul, RCLike.ofReal_real_eq_id, ++ id_eq, mul_ite, mul_zero] ++ intro y ypos ++ rw [eq_comm, ite_eq_right (by push Not; positivity)] ++ ++lemma Smooth1Properties_estimate {ε : ℝ} (εpos : 0 < ε) : ++ (1 - 2 ^ (-ε)) / ε < Real.log 2 := by ++ apply (div_lt_iff₀' εpos).mpr ++ have : 1 - 1 / (2 : ℝ) ^ ε = ((2 : ℝ) ^ ε - 1) / (2 : ℝ) ^ ε := by ++ rw [sub_div, div_self (by positivity)] ++ rw [← Real.log_rpow (by norm_num), rpow_neg (by norm_num), inv_eq_one_div (2 ^ ε), this] ++ set c := (2 : ℝ) ^ ε ++ have hc : 1 < c := by ++ rw [← rpow_zero (2 : ℝ)] ++ apply Real.rpow_lt_rpow_of_exponent_lt (by norm_num) εpos ++ apply (div_lt_iff₀' (by positivity)).mpr <| lt_sub_iff_add_lt'.mp ?_ ++ let f := (fun x ↦ x * Real.log x - x) ++ rw [(by simp [f] : -1 = f 1), (by simp [f] : c * Real.log c - c = f c)] ++ have mono: StrictMonoOn f <| Ici 1 := by ++ refine strictMonoOn_of_deriv_pos (convex_Ici _) ?_ ?_ ++ · apply continuousOn_id.mul (continuousOn_id.log ?_) |>.sub continuousOn_id ++ intro x hx; simp only [mem_Ici] at hx; simp only [id_eq, ne_eq]; linarith ++ · intro x hx; simp only [nonempty_Iio, interior_Ici', mem_Ioi] at hx ++ dsimp only [f] ++ rw [deriv_fun_sub, deriv_fun_mul, Real.deriv_log, deriv_id'', one_mul, mul_inv_cancel₀] ++ · simp [log_pos hx] ++ · linarith ++ · simp only [differentiableAt_fun_id] ++ · simp only [differentiableAt_log_iff, ne_eq]; linarith ++ · exact differentiableAt_fun_id.mul <| differentiableAt_fun_id.log (by linarith) ++ · simp only [differentiableAt_fun_id] ++ exact mono (by rw [mem_Ici]) (mem_Ici.mpr <| le_of_lt hc) hc ++ ++lemma Smooth1Properties_below_aux {x ε : ℝ} (hx : x ≤ 1 - Real.log 2 * ε) (εpos : 0 < ε) : ++ x < 2 ^ (-ε) := by ++ calc ++ x ≤ 1 - Real.log 2 * ε := hx ++ _ < 2 ^ (-ε) := ?_ ++ rw [sub_lt_iff_lt_add, add_comm, ← sub_lt_iff_lt_add] ++ exact (div_lt_iff₀ εpos).mp <| Smooth1Properties_estimate εpos ++ ++lemma Smooth1Properties_below {ν : ℝ → ℝ} (suppν : ν.support ⊆ Icc (1 / 2) 2) ++ (mass_one : ∫ x in Ioi 0, ν x / x = 1) : ++ ∃ (c : ℝ), 0 < c ∧ c = Real.log 2 ∧ ++ ∀ (ε x) (_ : 0 < ε), 0 < x → x ≤ 1 - c * ε → Smooth1 ν ε x = 1 := by ++ set c := Real.log 2; use c ++ refine ⟨log_pos (by norm_num), rfl, ?_⟩ ++ intro ε x εpos xpos hx ++ have hx2 := Smooth1Properties_below_aux hx εpos ++ rewrite [← DeltaSpikeMass mass_one εpos] ++ unfold Smooth1 MellinConvolution ++ calc ++ _ = ∫ (y : ℝ) in Ioi 0, ++ indicator (Ioc 0 1) (fun y ↦ DeltaSpike ν ε (x / y) / ↑y) y := ?_ ++ _ = ∫ (y : ℝ) in Ioi 0, DeltaSpike ν ε (x / y) / y := ?_ ++ _ = _ := integral_comp_div_I0i_haar (fun y ↦ DeltaSpike ν ε y) xpos ++ · rw [setIntegral_congr_fun (by simp)] ++ intro y hy ++ by_cases h : y ≤ 1 <;> simp [indicator, mem_Ioi.mp hy, h] ++ · rw [setIntegral_congr_fun (by simp)] ++ intro y hy ++ have : y ≠ 0 := by ++ rintro rfl ++ simp at hy ++ simp only [indicator_apply_eq_self, mem_Ioc, not_and, not_le, div_eq_zero_iff, this, or_false] ++ intro hy2; replace hy2 := hy2 <| mem_Ioi.mp hy ++ apply DeltaSpikeSupport εpos ?_ suppν ++ · simp only [mem_Icc, not_and, not_le]; intro ++ linarith [(by apply (div_lt_iff₀ (by linarith)).mpr; nlinarith : x / y < 2 ^ (-ε))] ++ · rw [le_div_iff₀ (by linarith), zero_mul]; exact xpos.le ++ ++lemma Smooth1Properties_above_aux {x ε : ℝ} (hx : 1 + (2 * Real.log 2) * ε ≤ x) ++ (hε : ε ∈ Ioo 0 1) : ++ 2 ^ ε < x := by ++ calc ++ x ≥ 1 + (2 * Real.log 2) * ε := hx ++ _ > 2 ^ ε := ?_ ++ refine lt_add_of_sub_left_lt <| (div_lt_iff₀ hε.1).mp ?_ ++ calc ++ 2 * Real.log 2 > 2 * (1 - 2 ^ (-ε)) / ε := ?_ ++ _ > 2 ^ ε * (1 - 2 ^ (-ε)) / ε := ?_ ++ _ = (2 ^ ε - 1) / ε := ?_ ++ · field_simp ++ exact Smooth1Properties_estimate hε.1 ++ · have : (2 : ℝ) ^ ε < 2 := by ++ have h := rpow_lt_rpow_of_exponent_lt (x := 2) (by norm_num) hε.2 ++ rwa [Real.rpow_one] at h ++ have pos: 0 < (1 - 2 ^ (-ε)) / ε := by ++ refine div_pos ?_ hε.1 ++ rw [sub_pos] ++ have h := rpow_lt_rpow_of_exponent_lt (x := 2) (by norm_num) (neg_lt_zero.mpr hε.1) ++ rwa [Real.rpow_zero] at h ++ have := (mul_lt_mul_iff_left₀ pos).mpr this ++ ring_nf at this ⊢ ++ exact this ++ · have : (2 : ℝ) ^ ε * (2 : ℝ) ^ (-ε) = (2 : ℝ) ^ (ε - ε) := by ++ rw [← rpow_add (by norm_num), add_neg_cancel, sub_self] ++ conv => lhs; lhs; ring_nf; rhs; simp [this] ++ ++lemma Smooth1Properties_above_aux2 {x y ε : ℝ} (hε : ε ∈ Ioo 0 1) (hy : y ∈ Ioc 0 1) ++ (hx2 : 2 ^ ε < x) : ++ 2 < (x / y) ^ (1 / ε) := by ++ obtain ⟨εpos, ε1⟩ := hε ++ obtain ⟨ypos, y1⟩ := hy ++ calc ++ _ > (2 ^ ε / y) ^ (1 / ε) := ?_ ++ _ = 2 / y ^ (1 / ε) := ?_ ++ _ ≥ 2 / y := ?_ ++ _ ≥ 2 := ?_ ++ · rw [gt_iff_lt, div_rpow, div_rpow, lt_div_iff₀, mul_comm_div, div_self, mul_one] ++ <;> try positivity ++ · exact rpow_lt_rpow (by positivity) hx2 (by positivity) ++ · exact LT.lt.le <| lt_trans (by positivity) hx2 ++ · rw [div_rpow, ← rpow_mul, mul_div_cancel₀ 1 <| ne_of_gt εpos, rpow_one] <;> positivity ++ · have : y ^ (1 / ε) ≤ y := by ++ nth_rewrite 2 [← rpow_one y] ++ exact rpow_le_rpow_of_exponent_ge ypos y1 (by linarith [one_lt_one_div εpos ε1]) ++ have pos : 0 < y ^ (1 / ε) := rpow_pos_of_pos ypos _ ++ rw [ge_iff_le, div_le_iff₀, div_mul_eq_mul_div, le_div_iff₀', mul_comm] <;> try linarith ++ · rw [ge_iff_le, le_div_iff₀ <| ypos]; exact (mul_le_iff_le_one_right zero_lt_two).mpr y1 ++ ++lemma Smooth1Properties_above {ν : ℝ → ℝ} (suppν : ν.support ⊆ Icc (1 / 2) 2) : ++ ∃ (c : ℝ), 0 < c ∧ c = 2 * Real.log 2 ∧ ++ ∀ (ε x) (_ : ε ∈ Ioo 0 1), 1 + c * ε ≤ x → Smooth1 ν ε x = 0 := by ++ set c := 2 * Real.log 2; use c ++ constructor ++ · simp only [c, zero_lt_two, mul_pos_iff_of_pos_left]; exact log_pos (by norm_num) ++ constructor ++ · rfl ++ intro ε x hε hx ++ have hx2 := Smooth1Properties_above_aux hx hε ++ unfold Smooth1 MellinConvolution ++ simp only [ite_mul, one_mul, zero_mul, RCLike.ofReal_real_eq_id, id_eq] ++ apply setIntegral_eq_zero_of_forall_eq_zero ++ intro y hy ++ have ypos := mem_Ioi.mp hy ++ by_cases y1 : y ≤ 1 ++ swap ++ · simp [ypos, y1] ++ simp only [mem_Ioi.mp hy, y1, and_self, ↓reduceIte, div_eq_zero_iff]; left ++ apply DeltaSpikeSupport hε.1 ?_ suppν ++ on_goal 1 => ++ simp only [mem_Icc, not_and, not_le] ++ on_goal 2 => ++ suffices h : 2 ^ ε < x / y by ++ linarith [(by apply rpow_pos_of_pos (by norm_num) : 0 < (2 : ℝ) ^ ε)] ++ all_goals ++ try intro ++ have : x / y = ((x / y) ^ (1 / ε)) ^ ε := by ++ rw [← rpow_mul] ++ simp only [one_div, inv_mul_cancel₀ (ne_of_gt hε.1), rpow_one] ++ apply div_nonneg_iff.mpr; left; ++ exact ⟨(le_trans (rpow_pos_of_pos (by norm_num) ε).le) hx2.le, ypos.le⟩ ++ rw [this] ++ refine rpow_lt_rpow (by norm_num) ?_ hε.1 ++ exact Smooth1Properties_above_aux2 hε ⟨ypos, y1⟩ hx2 ++ ++lemma DeltaSpikeNonNeg_of_NonNeg {ν : ℝ → ℝ} (νnonneg : ∀ x > 0, 0 ≤ ν x) ++ {x ε : ℝ} (xpos : 0 < x) (εpos : 0 < ε) : ++ 0 ≤ DeltaSpike ν ε x := by ++ dsimp [DeltaSpike] ++ have : 0 < x ^ (1 / ε) := by positivity ++ have : 0 ≤ ν (x ^ (1 / ε)) := νnonneg _ this ++ positivity ++ ++lemma MellinConvNonNeg_of_NonNeg {f g : ℝ → ℝ} (f_nonneg : ∀ x > 0, 0 ≤ f x) ++ (g_nonneg : ∀ x > 0, 0 ≤ g x) {x : ℝ} (xpos : 0 < x) : ++ 0 ≤ MellinConvolution f g x := by ++ dsimp [MellinConvolution] ++ apply MeasureTheory.setIntegral_nonneg ++ · exact measurableSet_Ioi ++ · intro y ypos; simp only [mem_Ioi] at ypos ++ have : 0 ≤ f y := f_nonneg _ ypos ++ have : 0 < x / y := by positivity ++ have : 0 ≤ g (x / y) := g_nonneg _ this ++ positivity ++ ++lemma Smooth1Nonneg {ν : ℝ → ℝ} (νnonneg : ∀ x > 0, 0 ≤ ν x) {ε x : ℝ} ++ (xpos : 0 < x) (εpos : 0 < ε) : 0 ≤ Smooth1 ν ε x := by ++ dsimp [Smooth1] ++ apply MellinConvNonNeg_of_NonNeg ?_ ?_ xpos ++ · intro y hy; by_cases h : y ≤ 1 <;> simp [h, hy] ++ · intro y ypos; exact DeltaSpikeNonNeg_of_NonNeg νnonneg ypos εpos ++ ++lemma Smooth1LeOne_aux {x ε : ℝ} {ν : ℝ → ℝ} (xpos : 0 < x) (εpos : 0 < ε) ++ (mass_one : ∫ x in Ioi 0, ν x / x = 1) : ++ ∫ (y : ℝ) in Ioi 0, ν ((x / y) ^ (1 / ε)) / ε / y = 1 := by ++ calc ++ _ = ∫ (y : ℝ) in Ioi 0, (ν (y ^ (1 / ε)) / ε) / y := ?_ ++ _ = ∫ (y : ℝ) in Ioi 0, ν y / y := ?_ ++ _ = 1 := mass_one ++ · have := integral_comp_div_I0i_haar (fun y ↦ ν ((x / y) ^ (1 / ε)) / ε) xpos ++ convert! this.symm using 1 ++ congr; funext y; congr; field_simp [mul_comm] ++ · have := integral_comp_rpow_I0i_haar_real (fun y ↦ ν y) (one_div_ne_zero εpos.ne') ++ rw [← this, abs_of_pos <| one_div_pos.mpr εpos] ++ field_simp ++ ++lemma Smooth1LeOne {ν : ℝ → ℝ} (νnonneg : ∀ x > 0, 0 ≤ ν x) ++ (mass_one : ∫ x in Ioi 0, ν x / x = 1) {ε : ℝ} (εpos : 0 < ε) {x : ℝ} (xpos : 0 < x) : ++ Smooth1 ν ε x ≤ 1 := by ++ unfold Smooth1 MellinConvolution DeltaSpike ++ have := Smooth1LeOne_aux xpos εpos mass_one ++ calc ++ _ = ∫ (y : ℝ) in Ioi 0, ++ (fun y ↦ if y ∈ Ioc 0 1 then 1 else 0) y * (ν ((x / y) ^ (1 / ε)) / ε / y) := ?_ ++ _ ≤ ∫ (y : ℝ) in Ioi 0, (ν ((x / y) ^ (1 / ε)) / ε) / y := ?_ ++ _ = 1 := this ++ · rw [setIntegral_congr_fun (by simp)] ++ simp only [ite_mul, one_mul, zero_mul, RCLike.ofReal_real_eq_id, id_eq, mem_Ioc] ++ intro y hy; aesop ++ · refine setIntegral_mono_on ?_ (integrable_of_integral_eq_one this) (by simp) ?_ ++ · refine integrable_of_integral_eq_one this |>.bdd_mul ?_ ++ (ae_of_all _ <| by aesop) ++ have : (fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0) = ++ indicator (Ioc 0 1) (1 : ℝ → ℝ) := by ++ aesop ++ simp only [mem_Ioc, this, measurableSet_Ioc, aestronglyMeasurable_indicator_iff] ++ exact aestronglyMeasurable_one ++ · simp only [ite_mul, one_mul, zero_mul] ++ intro y hy ++ by_cases h : y ≤ 1 ++ · aesop ++ field_simp ++ simp only [mem_Ioc, h, and_false, ↓reduceIte, one_div, mul_zero] ++ simp only [mem_Ioi] at hy ++ apply div_nonneg ++ · apply νnonneg; exact rpow_pos_of_pos (div_pos xpos <| mem_Ioi.mp hy) _ ++ · positivity ++ ++lemma MellinOfSmooth1a {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) ++ (suppν : ν.support ⊆ Icc (1 / 2) 2) ++ {ε : ℝ} (εpos : 0 < ε) {s : ℂ} (hs : 0 < s.re) : ++ 𝓜 (fun x ↦ (Smooth1 ν ε x : ℂ)) s = ++ s⁻¹ * 𝓜 (fun x ↦ (ν x : ℂ)) (ε * s) := by ++ let f' : ℝ → ℂ := fun x ↦ DeltaSpike ν ε x ++ let f : ℝ → ℂ := fun x ↦ DeltaSpike ν ε x / x ++ let g : ℝ → ℂ := fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0 ++ let F : ℝ × ℝ → ℂ := Function.uncurry fun x y ↦ f y * g (x / y) * (x : ℂ) ^ (s - 1) ++ let S := {⟨x, y⟩ : ℝ × ℝ | 0 < x ∧ x ≤ y ∧ 2 ^ (-ε) ≤ y ∧ y ≤ 2 ^ ε} ++ let F' : ℝ × ℝ → ℂ := piecewise S (fun ⟨x, y⟩ ↦ f y * (x : ℂ) ^ (s - 1)) ++ (fun _ ↦ 0) ++ let Tx := Ioc 0 ((2 : ℝ) ^ ε) ++ let Ty := Icc ((2 : ℝ) ^ (-ε)) ((2 : ℝ) ^ ε) ++ ++ have Seq : S = (Tx ×ˢ Ty) ∩ {(x, y) : ℝ × ℝ | x ≤ y} := by ++ ext ⟨x, y⟩; constructor ++ · exact fun h ↦ ⟨⟨⟨h.1, le_trans h.2.1 h.2.2.2⟩, ⟨h.2.2.1, h.2.2.2⟩⟩, h.2.1⟩ ++ · exact fun h ↦ ⟨h.1.1.1, ⟨h.2, h.1.2.1, h.1.2.2⟩⟩ ++ have SsubI : S ⊆ Ioi 0 ×ˢ Ioi 0 := ++ fun z hz ↦ ⟨hz.1, lt_of_lt_of_le (by apply rpow_pos_of_pos; norm_num) hz.2.2.1⟩ ++ have SsubT: S ⊆ Tx ×ˢ Ty := by simp_rw [Seq, inter_subset_left] ++ have Smeas : MeasurableSet S := by ++ rw [Seq]; apply MeasurableSet.inter ?_ <| measurableSet_le measurable_fst measurable_snd ++ simp [measurableSet_prod, Tx, Ty] ++ ++ have int_F: IntegrableOn F (Ioi 0 ×ˢ Ioi 0) := by ++ apply IntegrableOn.congr_fun (f := F') ?_ ?_ (by simp [measurableSet_prod]); swap ++ · simp only [F, F', f, g, mul_ite, mul_one, mul_zero] ++ intro ⟨x, y⟩ hz ++ by_cases hS : ⟨x, y⟩ ∈ S <;> simp only [hS, piecewise] ++ <;> simp only [mem_prod, mem_Ioi, mem_ofPred_eq, not_and, not_le, S] at hz hS ++ · simp [div_pos hz.1 hz.2, (div_le_one hz.2).mpr hS.2.1] ++ · by_cases hxy : x / y ≤ 1 ++ swap ++ · simp [hxy] ++ have hy : y ∉ Icc (2 ^ (-ε)) (2 ^ ε) := by ++ simp only [mem_Icc, not_and, not_le]; exact hS hz.1 <| (div_le_one hz.2).mp hxy ++ simp [DeltaSpikeSupport εpos hz.2.le suppν hy] ++ · apply Integrable.piecewise Smeas ?_ integrableOn_zero ++ simp only [IntegrableOn, Measure.restrict_restrict_of_subset SsubI] ++ apply MeasureTheory.Integrable.mono_measure ?_ ++ · apply MeasureTheory.Measure.restrict_mono' SsubT.eventuallyLE le_rfl ++ change Integrable (fun x : ℝ × ℝ => f x.2 * (x.1 : ℂ) ^ (s - 1)) ++ (volume.restrict (Tx ×ˢ Ty)) ++ have : volume.restrict (Tx ×ˢ Ty) = (volume.restrict Tx).prod (volume.restrict Ty) := by ++ rw [Measure.prod_restrict, MeasureTheory.Measure.volume_eq_prod] ++ conv => rw [this]; lhs; intro; rw [mul_comm] ++ apply MeasureTheory.Integrable.mul_prod (f := fun x ↦ (x : ℂ) ^ (s - 1)) ++ (μ := Measure.restrict volume Tx) ++ · simp only [Tx] ++ rw [← IntegrableOn, integrableOn_Ioc_iff_integrableOn_Ioo, ++ intervalIntegral.integrableOn_Ioo_cpow_iff] ++ · simp [hs] ++ · apply rpow_pos_of_pos (by norm_num) ++ · apply (ContinuousOn.div ?_ ?_ ?_).integrableOn_compact isCompact_Icc ++ · exact (DeltaSpikeOfRealContinuous εpos diffν).continuousOn ++ · exact continuous_ofReal.continuousOn ++ · intro x hx; simp only [mem_Icc] at hx; simp only [ofReal_ne_zero] ++ linarith [(by apply rpow_pos_of_pos (by norm_num) : (0 : ℝ) < 2 ^ (-ε))] ++ ++ have : 𝓜 (MellinConvolution g f') s = 𝓜 g s * 𝓜 f' s := by ++ rw [mul_comm, ← MellinConvolutionTransform f' g s ++ (by convert int_F using 1; simp only [f', F, f]; field_simp)] ++ dsimp [mellin]; rw [setIntegral_congr_fun (by simp)] ++ intro x hx; simp_rw [MellinConvolutionSymmetric _ _ <| mem_Ioi.mp hx] ++ ++ convert! this using 1 ++ · congr; funext x; convert! integral_ofReal.symm ++ simp only [MellinConvolution, RCLike.ofReal_div, ite_mul, one_mul, zero_mul, @apply_ite ℝ ℂ, ++ algebraMap.coe_zero, g]; rfl ++ · rw [MellinOf1 s hs, MellinOfDeltaSpike ν εpos s] ++ simp ++ ++lemma MellinOfSmooth1b {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) ++ (suppν : ν.support ⊆ Set.Icc (1 / 2) 2) : ++ ∃ (C : ℝ) (_ : 0 < C), ∀ (σ₁ : ℝ) (_ : 0 < σ₁) ++ (s) (_ : σ₁ ≤ s.re) (_ : s.re ≤ 2) (ε : ℝ) (_ : 0 < ε) (_ : ε < 1), ++ ‖𝓜 (fun x ↦ (Smooth1 ν ε x : ℂ)) s‖ ≤ C * (ε * ‖s‖ ^ 2)⁻¹ := by ++ obtain ⟨C, Cpos, hC⟩ := MellinOfPsi diffν suppν ++ refine ⟨C, Cpos, ?_⟩ ++ intro σ₁ σ₁pos s hs1 hs2 ε εpos ε_lt_one ++ rw [MellinOfSmooth1a diffν suppν εpos <| lt_of_le_of_lt' hs1 σ₁pos] ++ have hh1 : ε * σ₁ ≤ (ε * s).re := by ++ simp only [mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] ++ nlinarith ++ have hh2 : (ε * s).re ≤ 2 := by ++ simp only [mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero] ++ nlinarith ++ calc ++ ‖s⁻¹ * 𝓜 (fun x ↦ (ν x : ℂ)) (ε * s)‖ = ++ ‖s⁻¹‖ * ‖𝓜 (fun x ↦ (ν x : ℂ)) (ε * s)‖ := by simp ++ _ ≤ ‖s⁻¹‖ * (C * (ε * ‖s‖)⁻¹) := by ++ gcongr ++ convert! hC (ε * σ₁) (by positivity) (ε * s) hh1 hh2 ++ simp [abs_eq_self.mpr εpos.le] ++ _ = C * (ε * ‖s‖ ^ 2)⁻¹ := by ++ simp only [norm_inv, mul_inv_rev] ++ ring ++ ++lemma MellinOfSmooth1c {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) ++ (suppν : ν.support ⊆ Icc (1 / 2) 2) ++ (mass_one : ∫ x in Ioi 0, ν x / x = 1) : ++ (fun ε ↦ 𝓜 (fun x ↦ (Smooth1 ν ε x : ℂ)) 1 - 1) =O[𝓝[>]0] id := by ++ have h := MellinOfDeltaSpikeAt1_asymp diffν suppν mass_one ++ rw [Asymptotics.isBigO_iff] at h ⊢ ++ obtain ⟨c, hc⟩ := h ++ use c ++ filter_upwards [hc, Ioo_mem_nhdsGT (by linarith : (0 : ℝ) < 1)] with ε hε hε' ++ rw [MellinOfSmooth1a diffν suppν hε'.1 (s := 1) (by norm_num)] ++ simp only [inv_one, mul_one, one_mul, id_eq, Real.norm_eq_abs] ++ exact hε ++ ++lemma Smooth1ContinuousAt {SmoothingF : ℝ → ℝ} ++ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) ++ (suppSmoothingF : SmoothingF.support ⊆ Icc (1 / 2) 2) ++ {ε : ℝ} (εpos : 0 < ε) {y : ℝ} (ypos : 0 < y) : ++ ContinuousAt (fun x ↦ Smooth1 SmoothingF ε x) y := by ++ apply ContinuousAt.congr ++ (f := (fun x ↦ MellinConvolution (DeltaSpike SmoothingF ε) ++ (fun x ↦ if 0 < x ∧ x ≤ 1 then 1 else 0) x)) _ ++ · filter_upwards [lt_mem_nhds ypos] with x hx ++ apply MellinConvolutionSymmetric _ _ hx ++ apply continuousAt_of_dominated (bound := (fun x ↦ 2 ^ ε * DeltaSpike SmoothingF ε x)) ++ · filter_upwards [lt_mem_nhds ypos] with x hx ++ apply Measurable.aestronglyMeasurable ++ apply Measurable.mul ++ · apply Measurable.mul ++ · exact Continuous.measurable <| DeltaSpikeContinuous εpos diffSmoothingF ++ · apply Measurable.ite _ (by fun_prop) (by fun_prop) ++ apply MeasurableSet.congr (s := Ici x) (by measurability) ++ ext a ++ constructor ++ · intro ha ++ have apos : 0 < a := lt_of_lt_of_le hx ha ++ constructor ++ · exact div_pos hx apos ++ · exact (div_le_one apos).mpr ha ++ · intro ha ++ have : 0 < a := (div_pos_iff_of_pos_left hx).mp ha.1 ++ exact (div_le_one this).mp ha.2 ++ · fun_prop ++ · filter_upwards [lt_mem_nhds ypos] with x hx ++ filter_upwards [ae_restrict_mem (by measurability)] with t ht ++ simp only [mul_ite, mul_one, mul_zero, RCLike.ofReal_real_eq_id, id_eq, norm_div, norm_eq_abs] ++ by_cases! h : DeltaSpike SmoothingF ε t = 0 ++ · simp [h] ++ have := DeltaSpikeSupport' εpos ht.le suppSmoothingF h ++ have dsnonneg : 0 ≤ DeltaSpike SmoothingF ε t := by ++ apply DeltaSpikeNonNeg_of_NonNeg <;> assumption ++ calc ++ _ ≤ |DeltaSpike SmoothingF ε t| / |t| := by ++ gcongr ++ · split_ifs with h ++ · apply le_refl ++ · exact dsnonneg ++ _ ≤ _ := by ++ rw [_root_.abs_of_nonneg dsnonneg, mul_comm, div_eq_mul_one_div, _root_.abs_of_pos ht] ++ gcongr ++ apply (one_div_le ht (by bound)).mpr ++ · convert this.1 using 1 ++ rw [div_eq_iff (by positivity), ← rpow_add (by norm_num), neg_add_cancel, rpow_zero] ++ · apply Integrable.const_mul ++ apply (integrable_indicator_iff (by measurability)).mp ++ apply (integrableOn_iff_integrable_of_support_subset (s := Icc (2 ^ (-ε)) (2 ^ ε)) _).mp ++ · apply ContinuousOn.integrableOn_compact isCompact_Icc ++ apply ContinuousOn.congr (f := DeltaSpike SmoothingF ε) ++ · apply Continuous.continuousOn ++ apply DeltaSpikeContinuous<;> assumption ++ · intro x hx ++ have : x ∈ Ioi 0 := by ++ apply mem_Ioi.mpr ++ apply lt_of_lt_of_le (by bound) hx.1 ++ rw [indicator, ite_eq_left this] ++ · unfold indicator ++ simp_rw [mem_Ioi] ++ apply Function.support_subset_iff.mpr ++ simp only [ne_eq, ite_eq_right_iff, Classical.not_imp, mem_Icc, and_imp] ++ intro x hx ++ apply DeltaSpikeSupport' εpos hx.le suppSmoothingF ++ · have : ∀ᵐ (a : ℝ) ∂volume.restrict (Ioi 0), a ≠ y := by ++ apply ae_iff.mpr ++ simp ++ filter_upwards [ae_restrict_mem (by measurability), this] with x hx hx2 ++ simp only [mem_Ioi] at hx ++ apply ContinuousAt.div_const ++ apply ContinuousAt.mul (by fun_prop) ++ have : (fun x_1 ↦ if 0 < x_1 / x ∧ x_1 / x ≤ 1 then 1 else 0) = ++ (Ioc 0 x).indicator (fun _ ↦ (1 : ℝ)) := by ++ ext t ++ unfold indicator ++ simp [div_pos_iff_of_pos_right, div_le_one₀, hx] ++ rw [this] ++ apply ContinuousOn.continuousAt_indicator (by fun_prop) ++ simp [frontier_Ioc hx, ypos.ne', hx2.symm] ++ ++lemma Smooth1MellinConvergent {Ψ : ℝ → ℝ} {ε : ℝ} (diffΨ : ContDiff ℝ 1 Ψ) ++ (suppΨ : Ψ.support ⊆ Icc (1 / 2) 2) (hε : ε ∈ Ioo 0 1) ++ (Ψnonneg : ∀ x > 0, 0 ≤ Ψ x) (mass_one : ∫ x in Ioi 0, Ψ x / x = 1) ++ {s : ℂ} (hs : 0 < s.re) : MellinConvergent (fun x ↦ (Smooth1 Ψ ε x : ℂ)) s := by ++ apply mellinConvergent_of_isBigO_rpow_exp zero_lt_one _ _ _ hs ++ · apply ContinuousOn.locallyIntegrableOn _ (by measurability) ++ apply continuousOn_of_forall_continuousAt ++ exact fun x hx ↦ Smooth1ContinuousAt diffΨ Ψnonneg suppΨ hε.1 hx |>.ofReal ++ · rw [Asymptotics.isBigO_iff] ++ use 1 ++ obtain ⟨c, cpos, ceq, hc⟩ := Smooth1Properties_above suppΨ ++ filter_upwards [eventually_ge_atTop (1 + c * ε)] with x hx ++ rw [hc _ _ hε hx] ++ simp only [ofReal_zero, norm_zero, neg_mul, one_mul, norm_eq_abs, abs_exp] ++ bound ++ · rw [Asymptotics.isBigO_iff] ++ use 1 ++ filter_upwards [eventually_mem_nhdsWithin] with x hx ++ simp only [norm_real, norm_eq_abs, neg_zero, rpow_zero, one_mem, CStarRing.norm_of_mem_unitary, ++ mul_one] ++ rw [_root_.abs_of_nonneg <| Smooth1Nonneg Ψnonneg hx hε.1] ++ exact Smooth1LeOne Ψnonneg mass_one hε.1 hx ++ ++lemma Smooth1MellinDifferentiable {Ψ : ℝ → ℝ} {ε : ℝ} (diffΨ : ContDiff ℝ 1 Ψ) ++ (suppΨ : Ψ.support ⊆ Icc (1 / 2) 2) (hε : ε ∈ Ioo 0 1) ++ (Ψnonneg : ∀ x > 0, 0 ≤ Ψ x) (mass_one : ∫ x in Ioi 0, Ψ x / x = 1) ++ {s : ℂ} (hs : 0 < s.re) : ++ DifferentiableAt ℂ (𝓜 (fun x ↦ (Smooth1 Ψ ε x : ℂ))) s := by ++ apply mellin_differentiableAt_of_isBigO_rpow_exp zero_lt_one _ _ _ hs ++ · apply ContinuousOn.locallyIntegrableOn _ (by measurability) ++ apply continuousOn_of_forall_continuousAt ++ exact fun x hx ↦ Smooth1ContinuousAt diffΨ Ψnonneg suppΨ hε.1 hx |>.ofReal ++ · rw [Asymptotics.isBigO_iff] ++ use 1 ++ obtain ⟨c, cpos, ceq, hc⟩ := Smooth1Properties_above suppΨ ++ filter_upwards [eventually_ge_atTop (1 + c * ε)] with x hx ++ rw [hc _ _ hε hx] ++ simp only [ofReal_zero, norm_zero, neg_mul, one_mul, norm_eq_abs, abs_exp] ++ bound ++ · rw [Asymptotics.isBigO_iff] ++ use 1 ++ filter_upwards [eventually_mem_nhdsWithin] with x hx ++ simp only [norm_real, norm_eq_abs, neg_zero, rpow_zero, one_mem, CStarRing.norm_of_mem_unitary, ++ mul_one] ++ rw [_root_.abs_of_nonneg <| Smooth1Nonneg Ψnonneg hx hε.1] ++ exact Smooth1LeOne Ψnonneg mass_one hε.1 hx ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/MertensClassical.lean b/PrimeNumberTheoremAnd/Erdos970/MertensClassical.lean +new file mode 100644 +index 0000000..8f3e823 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/MertensClassical.lean +@@ -0,0 +1,1982 @@ ++import Mathlib.Algebra.Order.Field.GeomSum ++import Mathlib.Analysis.SumIntegralComparisons ++import Mathlib.NumberTheory.Chebyshev ++import Mathlib.NumberTheory.Harmonic.EulerMascheroni ++import Mathlib.NumberTheory.LSeries.PrimesInAP ++import Mathlib.NumberTheory.LSeries.RiemannZeta ++import Mathlib.NumberTheory.Harmonic.GammaDeriv ++import Mathlib.Analysis.Asymptotics.Lemmas ++import Mathlib.Analysis.SpecialFunctions.Complex.Analytic ++import Mathlib.Analysis.SpecialFunctions.Integrability.LogMeromorphic ++import Mathlib.NumberTheory.EulerProduct.DirichletLSeries ++import Mathlib.NumberTheory.EulerProduct.ExpLog ++import Mathlib.Analysis.SpecialFunctions.Complex.LogBounds ++import Mathlib.Analysis.SpecialFunctions.Log.Summable ++import Mathlib.Algebra.Group.Submonoid.BigOperators ++import PrimeNumberTheoremAnd.Erdos970.EulerMaclaurin ++ ++namespace Erdos970 ++ ++theorem Filter.EventuallyEq.iff_eventually {α : Type _} {β : Type _} {l : Filter α} {f g : α → β} : f =ᶠ[l] g ↔ ∀ᶠ (x : α) in l, f x = g x := by rfl ++ ++namespace Real ++ ++open _root_.Real _root_.Filter _root_.Asymptotics ++ ++theorem inv_log_eq_o_one : (fun x ↦ 1 / log x) =o[atTop] (fun _ ↦ (1:ℝ)) := by ++ rw [isLittleO_one_iff] ++ convert tendsto_log_atTop.inv_tendsto_atTop using 1 ++ ext; simp ++ ++theorem one_eq_o_log_log : (fun _ ↦ (1:ℝ)) =o[atTop] (fun x ↦ log (log x)) := by ++ simp only [isLittleO_one_left_iff, norm_eq_abs] ++ exact tendsto_abs_atTop_atTop.comp (tendsto_log_atTop.comp tendsto_log_atTop) ++ ++end Real ++ ++section Issue1584 ++open _root_.MeasureTheory _root_.Set _root_.Filter _root_.Topology ++ ++private lemma integrableOn_log_mul_exp_neg : ++ IntegrableOn (fun v : ℝ => Real.log v * Real.exp (-v)) (Ioi 0) := by ++ rw [← Set.Ioc_union_Ioi_eq_Ioi (zero_le_one' ℝ), integrableOn_union] ++ constructor ++ · ++ have hlog : IntegrableOn (fun v : ℝ => Real.log v) (Ioc 0 1) volume := by ++ have := (intervalIntegral.intervalIntegrable_log' (a := 0) (b := 1)) ++ rwa [intervalIntegrable_iff_integrableOn_Ioc_of_le (zero_le_one' ℝ)] at this ++ apply Integrable.mono' hlog.norm ++ · apply (Measurable.aestronglyMeasurable ?_) ++ exact (Real.measurable_log.mul (Real.measurable_exp.comp measurable_neg)) ++ · filter_upwards [self_mem_ae_restrict measurableSet_Ioc] with v hv ++ rw [norm_mul, Real.norm_eq_abs, Real.norm_eq_abs] ++ have h1 : |Real.exp (-v)| = Real.exp (-v) := abs_of_pos (Real.exp_pos _) ++ have h2 : Real.exp (-v) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith [hv.1]) ++ rw [h1] ++ nlinarith [abs_nonneg (Real.log v), Real.exp_pos (-v)] ++ · ++ have hexp : IntegrableOn (fun v : ℝ => (2 : ℝ) * Real.exp ((-1/2) * v)) (Ioi 1) volume := by ++ exact (integrableOn_exp_mul_Ioi (by norm_num : (-1/2 : ℝ) < 0) 1).const_mul 2 ++ apply Integrable.mono' hexp ++ · apply (Measurable.aestronglyMeasurable ?_) ++ exact (Real.measurable_log.mul (Real.measurable_exp.comp measurable_neg)) ++ · filter_upwards [self_mem_ae_restrict measurableSet_Ioi] with v hv ++ have hv1 : (1 : ℝ) ≤ v := le_of_lt hv ++ have hvpos : (0 : ℝ) < v := by linarith ++ rw [norm_mul, Real.norm_eq_abs, Real.norm_eq_abs] ++ have hlogabs : |Real.log v| = Real.log v := ++ abs_of_nonneg (Real.log_nonneg hv1) ++ have hexpabs : |Real.exp (-v)| = Real.exp (-v) := abs_of_pos (Real.exp_pos _) ++ rw [hlogabs, hexpabs] ++ ++ have hlogv : Real.log v ≤ v := (Real.log_le_sub_one_of_pos hvpos).trans (by linarith) ++ ++ have hvexp : v ≤ 2 * Real.exp (v/2) := by ++ have := Real.add_one_le_exp (v/2) ++ nlinarith [Real.exp_pos (v/2)] ++ ++ have hstep : Real.log v * Real.exp (-v) ≤ 2 * Real.exp (v/2) * Real.exp (-v) := by ++ apply mul_le_mul_of_nonneg_right (hlogv.trans hvexp) (le_of_lt (Real.exp_pos _)) ++ have heq : 2 * Real.exp (v/2) * Real.exp (-v) = 2 * Real.exp ((-1/2) * v) := by ++ rw [mul_assoc, ← Real.exp_add] ++ ring_nf ++ rw [heq] at hstep ++ exact hstep ++ ++private lemma integral_log_mul_exp_neg_eq_deriv_Gamma : ++ ∫ t in Ioi (0:ℝ), Real.log t * Real.exp (-t) = deriv Real.Gamma 1 := by ++ set I : ℝ := ∫ t in Ioi (0:ℝ), Real.log t * Real.exp (-t) with hI ++ ++ have h1 := Complex.hasDerivAt_GammaIntegral (s := (1 : ℂ)) (by norm_num) ++ ++ have hval : (∫ t : ℝ in Ioi 0, (↑t : ℂ) ^ ((1 : ℂ) - 1) * (↑(Real.log t) * ↑(Real.exp (-t)))) ++ = (I : ℂ) := by ++ have key : ∀ t : ℝ, (↑t : ℂ) ^ ((1 : ℂ) - 1) * (↑(Real.log t) * ↑(Real.exp (-t))) ++ = ((Real.log t * Real.exp (-t) : ℝ) : ℂ) := by ++ intro t ++ rw [sub_self, Complex.cpow_zero, one_mul, Complex.ofReal_mul] ++ simp_rw [key] ++ rw [integral_complex_ofReal, hI] ++ rw [hval] at h1 ++ ++ have h2 : HasDerivAt Complex.Gamma (I : ℂ) 1 := by ++ apply h1.congr_of_eventuallyEq ++ filter_upwards [(isOpen_lt continuous_const Complex.continuous_re).mem_nhds ++ (show (0:ℝ) < (1:ℂ).re by norm_num)] with z hz ++ exact Complex.Gamma_eq_integral hz ++ ++ have h3 := h2.real_of_complex ++ have h4 : HasDerivAt Real.Gamma I 1 := by ++ have hcongr : (fun x : ℝ => (Complex.Gamma ↑x).re) = Real.Gamma := by ++ funext x ++ rw [Complex.Gamma_ofReal, Complex.ofReal_re] ++ rw [hcongr, Complex.ofReal_re] at h3 ++ exact h3 ++ rw [← h4.deriv] ++ ++private theorem mul_integ_log_log_eq_aux (s : ℝ) (hs : 1 < s) : ++ (s - 1) * ∫ x in Ioi (1:ℝ), Real.log (Real.log x) * x ^ (-s) = ++ - Real.log (s - 1) + deriv Real.Gamma 1 := by ++ have hs0 : 0 < s - 1 := by linarith ++ set f : ℝ → ℝ := fun x => (s - 1) * Real.log x with hf_def ++ set f' : ℝ → ℝ := fun x => (s - 1) / x with hf'_def ++ set g : ℝ → ℝ := fun u => (Real.log u - Real.log (s - 1)) * Real.exp (-u) with hg_def ++ ++ have hf1 : f 1 = 0 := by simp [hf_def] ++ ++ have hf_cont : ContinuousOn f (Ici 1) := by ++ apply ContinuousOn.mul continuousOn_const ++ apply Real.continuousOn_log.mono ++ intro x hx ++ simp only [mem_Ici] at hx ++ simp only [Set.mem_compl_iff, Set.mem_singleton_iff] ++ linarith ++ ++ have hft : Tendsto f atTop atTop := by ++ apply Filter.Tendsto.const_mul_atTop hs0 ++ exact Real.tendsto_log_atTop ++ ++ have hff' : ∀ x ∈ Ioi (1:ℝ), HasDerivWithinAt f (f' x) (Ioi x) x := by ++ intro x hx ++ simp only [mem_Ioi] at hx ++ have hxne : x ≠ 0 := by linarith ++ have := (Real.hasDerivAt_log hxne).const_mul (s - 1) ++ have h2 : HasDerivAt f ((s - 1) * x⁻¹) x := this ++ have : (s - 1) * x⁻¹ = f' x := by rw [hf'_def]; field_simp ++ rw [this] at h2 ++ exact h2.hasDerivWithinAt ++ ++ have hmono : StrictMonoOn f (Ici 1) := by ++ intro a ha b hb hab ++ simp only [mem_Ici] at ha hb ++ apply mul_lt_mul_of_pos_left _ hs0 ++ exact Real.log_lt_log (by linarith) hab ++ have himg_Ioi : f '' Ioi 1 = Ioi 0 := by ++ ext y ++ simp only [Set.mem_image, mem_Ioi] ++ constructor ++ · rintro ⟨x, hx, rfl⟩ ++ have : 0 < Real.log x := Real.log_pos hx ++ positivity ++ · intro hy ++ refine ⟨Real.exp (y / (s - 1)), ?_, ?_⟩ ++ · exact Real.one_lt_exp_iff.mpr (div_pos hy hs0) ++ · rw [hf_def] ++ simp only [Real.log_exp] ++ field_simp ++ have himg_Ici : f '' Ici 1 = Ici 0 := by ++ ext y ++ simp only [Set.mem_image, mem_Ici] ++ constructor ++ · rintro ⟨x, hx, rfl⟩ ++ have : 0 ≤ Real.log x := Real.log_nonneg hx ++ rw [hf_def]; positivity ++ · intro hy ++ refine ⟨Real.exp (y / (s - 1)), ?_, ?_⟩ ++ · exact Real.one_le_exp_iff.mpr (div_nonneg hy hs0.le) ++ · rw [hf_def] ++ simp only [Real.log_exp] ++ field_simp ++ ++ have hg_cont : ContinuousOn g (f '' Ioi 1) := by ++ rw [himg_Ioi] ++ apply ContinuousOn.mul ++ · apply ContinuousOn.sub _ continuousOn_const ++ apply Real.continuousOn_log.mono ++ intro u hu ++ simp only [mem_Ioi] at hu ++ simp only [Set.mem_compl_iff, Set.mem_singleton_iff] ++ linarith ++ · exact (Real.continuous_exp.comp continuous_neg).continuousOn ++ ++ have hg1 : IntegrableOn g (f '' Ici 1) := by ++ rw [himg_Ici, integrableOn_Ici_iff_integrableOn_Ioi] ++ have e1 : IntegrableOn (fun u => Real.log u * Real.exp (-u)) (Ioi 0) := ++ integrableOn_log_mul_exp_neg ++ have e2 : IntegrableOn (fun u => Real.log (s - 1) * Real.exp (-u)) (Ioi 0) := ++ (integrableOn_exp_neg_Ioi 0).const_mul _ ++ have : g = fun u => Real.log u * Real.exp (-u) - Real.log (s - 1) * Real.exp (-u) := by ++ funext u; rw [hg_def]; ring ++ rw [this] ++ exact e1.sub e2 ++ ++ have hg2 : IntegrableOn (fun x => (g ∘ f) x * f' x) (Ici 1) := by ++ ++ have hff'_Ici : ∀ x ∈ Ici (1:ℝ), HasDerivWithinAt f (f' x) (Ici 1) x := by ++ intro x hx ++ simp only [mem_Ici] at hx ++ have hxne : x ≠ 0 := by linarith ++ have hd : HasDerivAt f ((s - 1) * x⁻¹) x := (Real.hasDerivAt_log hxne).const_mul (s - 1) ++ have heq : (s - 1) * x⁻¹ = f' x := by rw [hf'_def]; field_simp ++ rw [heq] at hd ++ exact hd.hasDerivWithinAt ++ ++ have hinj : InjOn f (Ici 1) := hmono.injOn ++ ++ have hiff := integrableOn_image_iff_integrableOn_abs_deriv_smul ++ (s := Ici (1:ℝ)) (f := f) (f' := f') measurableSet_Ici hff'_Ici hinj g ++ rw [hiff] at hg1 ++ ++ apply hg1.congr ++ filter_upwards [self_mem_ae_restrict measurableSet_Ici] with x hx ++ simp only [mem_Ici] at hx ++ have hxpos : (0:ℝ) < x := by linarith ++ have hf'pos : 0 < f' x := by rw [hf'_def]; positivity ++ simp only [smul_eq_mul, Function.comp, abs_of_pos hf'pos] ++ ring ++ ++ have hcov := integral_comp_mul_deriv_Ioi hf_cont hft hff' hg_cont hg1 hg2 ++ rw [hf1] at hcov ++ ++ have hrhs : ∫ u in Ioi (0:ℝ), g u = deriv Real.Gamma 1 - Real.log (s - 1) := by ++ have e1 : IntegrableOn (fun u => Real.log u * Real.exp (-u)) (Ioi 0) := ++ integrableOn_log_mul_exp_neg ++ have e2 : IntegrableOn (fun u => Real.log (s - 1) * Real.exp (-u)) (Ioi 0) := ++ (integrableOn_exp_neg_Ioi 0).const_mul _ ++ have hsplit : (fun u => g u) ++ = fun u => Real.log u * Real.exp (-u) - Real.log (s - 1) * Real.exp (-u) := by ++ funext u; rw [hg_def]; ring ++ rw [show (∫ u in Ioi (0:ℝ), g u) ++ = ∫ u in Ioi (0:ℝ), (Real.log u * Real.exp (-u) - Real.log (s - 1) * Real.exp (-u)) ++ from by rw [hsplit]] ++ rw [integral_sub e1 e2, integral_log_mul_exp_neg_eq_deriv_Gamma] ++ rw [integral_const_mul, integral_exp_neg_Ioi_zero, mul_one] ++ ++ have hlhs : ∫ x in Ioi (1:ℝ), (g ∘ f) x * f' x ++ = (s - 1) * ∫ x in Ioi (1:ℝ), Real.log (Real.log x) * x ^ (-s) := by ++ have hpt : ∀ x ∈ Ioi (1:ℝ), (g ∘ f) x * f' x ++ = (s - 1) * (Real.log (Real.log x) * x ^ (-s)) := by ++ intro x hx ++ simp only [mem_Ioi] at hx ++ have hxpos : (0:ℝ) < x := by linarith ++ have hlogpos : 0 < Real.log x := Real.log_pos hx ++ have hlogne : Real.log x ≠ 0 := ne_of_gt hlogpos ++ have hs1ne : s - 1 ≠ 0 := ne_of_gt hs0 ++ simp only [Function.comp, hf_def, hg_def, hf'_def] ++ ++ rw [Real.log_mul hs1ne hlogne] ++ ++ have hexp : Real.exp (-((s - 1) * Real.log x)) = x ^ (-(s - 1)) := by ++ rw [Real.rpow_def_of_pos hxpos] ++ ring_nf ++ rw [hexp] ++ ++ have hx1 : x ^ (-(s - 1)) * ((s - 1) / x) = (s - 1) * x ^ (-s) := by ++ rw [div_eq_mul_inv, ← Real.rpow_neg_one x] ++ rw [show x ^ (-(s - 1)) * ((s - 1) * x ^ (-1 : ℝ)) ++ = (s - 1) * (x ^ (-(s - 1)) * x ^ (-1 : ℝ)) by ring] ++ rw [← Real.rpow_add hxpos] ++ ring_nf ++ rw [show (Real.log (s - 1) + Real.log (Real.log x) - Real.log (s - 1)) ++ = Real.log (Real.log x) by ring] ++ linear_combination Real.log (Real.log x) * hx1 ++ rw [setIntegral_congr_fun measurableSet_Ioi hpt, integral_const_mul] ++ rw [hlhs, hrhs] at hcov ++ rw [hcov] ++ ring ++ ++end Issue1584 ++ ++namespace Mertens ++ ++open _root_.Real Erdos970.Real _root_.Finset _root_.Filter _root_.Asymptotics _root_.Topology ++open ArithmeticFunction hiding log ++ ++lemma sum_Ioc_one_eq_sum_Ioc_zero {f : ℕ → ℝ} {x : ℕ} (hx : 1 ≤ x) (hf : f 1 = 0) : ++ ∑ n ∈ Ioc 1 x, f n = ∑ n ∈ Ioc 0 x, f n := by ++ rw [(by rfl : Ioc 0 x = Icc 1 x), ← add_sum_Ioc_eq_sum_Icc hx] ++ simpa ++ ++theorem sum_log_eq {x : ℝ} (hx : 1 ≤ x) : ++ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n = ++ x * log x - (x - ⌊x⌋₊ - 1 / 2) * log x - x + 1 + ∫ t in 1..x, (t - ⌊t⌋₊ - 1 / 2) / t := by ++ rw [← sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp)] ++ have : 1 = ⌊(1 : ℝ)⌋₊ := by simp ++ nth_rw 1 [this] ++ rw [sum_eq_integral_add_integral_deriv (by norm_num) hx (fun _ _ ↦ (by fun_prop (disch := grind)))] ++ · simp only [log_one, B1, Nat.floor_one, Nat.cast_one, sub_self, zero_sub, ++ RCLike.ofReal_real_eq_id, id_eq, mul_neg, zero_mul, neg_zero, integral_log, mul_zero, sub_zero, ++ deriv_log'] ++ ring_nf ++ congr ++ ext ++ ring ++ · simp only [deriv_log', Set.uIcc_of_le hx] ++ fun_prop (disch := grind) ++ ++theorem sum_log_le {x : ℝ} (hx : 1 ≤ x) : ++ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n ≤ x * log x := by ++ calc ++ _ ≤ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log x := by ++ refine sum_le_sum fun n hn ↦ ?_ ++ simp only [mem_Ioc] at hn ++ exact log_le_log (by exact_mod_cast hn.1) (Nat.le_floor_iff (by linarith)|>.mp hn.2) ++ _ = ⌊x⌋₊ * log x := by simp ++ _ ≤ _ := by ++ gcongr ++ · exact log_nonneg hx ++ · exact Nat.floor_le (by linarith) ++ ++lemma integral_log_le {a b : ℝ} (ha : 1 ≤ a) (hab : a ≤ b) : ++ ∫ t in a..b, log t ≤ log b * (b - a) := by ++ apply le_of_abs_le ++ have : ∀ t ∈ Set.uIoc a b, ‖log t‖ ≤ log b := by ++ intro t ht ++ rw [Set.uIoc_of_le hab, Set.mem_Ioc] at ht ++ rw [norm_of_nonneg <| log_nonneg (by linarith)] ++ gcongr <;> linarith ++ grw [← norm_eq_abs, intervalIntegral.norm_integral_le_of_norm_le_const this, ++ abs_of_nonneg (by linarith)] ++ ++theorem sum_log_ge {x : ℝ} (hx : 1 ≤ x) : ++ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n ≥ x * log x - 2 * x := by ++ have one_le_floor : 1 ≤ ⌊x⌋₊ := by simpa ++ calc ++ _ = ∑ n ∈ Icc 1 ⌊ x ⌋₊, log n := by rfl ++ _ = ∑ n ∈ Ico (1 + 1) (⌊ x ⌋₊ + 1), log n := by ++ rw [← add_sum_Ioc_eq_sum_Icc one_le_floor] ++ simp ++ rfl ++ _ = ∑ n ∈ Ico 1 ⌊ x ⌋₊, log ((n + 1 : ℕ)) := by ++ rw [← Finset.sum_Ico_add'] ++ _ ≥ ∫ t in 1..⌊x⌋₊, log t := by ++ convert MonotoneOn.integral_le_sum_Ico one_le_floor ?_|>.ge ++ · norm_cast ++ · exact StrictMonoOn.monotoneOn (strictMonoOn_log.mono fun y hy ↦ (by simp_all; linarith)) ++ _ = (∫ t in 1..x, log t) - ∫ t in ⌊x⌋₊..x, log t := by ++ nth_rw 3 [intervalIntegral.integral_symm] ++ rw [sub_neg_eq_add, intervalIntegral.integral_add_adjacent_intervals] <;> exact intervalIntegral.intervalIntegrable_log' ++ _ ≥ (∫ t in 1..x, log t) - log x := by ++ gcongr ++ grw [integral_log_le (by simpa) (Nat.floor_le (by linarith))] ++ nth_rw 2 [← mul_one (log x)] ++ gcongr ++ · exact log_nonneg hx ++ · linarith [Nat.lt_floor_add_one x] ++ _ ≥ x * log x - x - log x := by simp only [integral_log, log_one, mul_zero, sub_zero, ge_iff_le, ++ tsub_le_iff_right, sub_add_cancel, le_add_iff_nonneg_right, zero_le_one] ++ _ ≥ _ := by linarith [log_le_self (by linarith : 0 ≤ x)] ++ ++theorem sum_log_eq_log_factorial (x : ℝ) : ++ ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n = log (Nat.floor x).factorial := by ++ rw [←prod_Ico_id_eq_factorial, ←log_prod, prod_natCast] ++ · congr ++ intro x hx ++ simp at hx ⊢; grind ++ ++theorem sum_log_eq_sum_mangoldt {x : ℝ} : ++ ∑ n ∈ Ioc 0 ⌊x⌋₊, log n = ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * ⌊x / d⌋₊ := by ++ have : ∀ n : ℕ, log n = (Λ * zeta) n := by simp [vonMangoldt_mul_zeta] ++ simp_rw [this, sum_Ioc_mul_zeta_eq_sum, ← Nat.floor_div_natCast] ++ ++noncomputable abbrev E₁Λ (x : ℝ) : ℝ := ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d - log x ++ ++theorem sum_mangoldt_div_eq (x : ℝ) : ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d = log x + E₁Λ x := by ++ grind ++ ++theorem E₁Λ.ge {x : ℝ} (hx : 1 ≤ x) : ++ E₁Λ x ≥ -2 := by ++ unfold E₁Λ ++ suffices x * ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d / d ≥ x * (log x - 2) by ++ linarith [le_of_mul_le_mul_left this (by linarith)] ++ calc ++ _ = ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * (x / d) := by ++ rw [Finset.mul_sum] ++ ring_nf ++ _ ≥ ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * ⌊x / d⌋₊ := by ++ gcongr ++ exact Nat.floor_le <| div_nonneg (by linarith) (by linarith) ++ _ ≥ x * log x - 2 * x := ++ sum_log_eq_sum_mangoldt ▸ sum_log_ge hx ++ _ = _ := by ring ++ ++theorem E₁Λ.le {x : ℝ} (hx : 1 ≤ x) : ++ E₁Λ x ≤ log 4 + 4 := by ++ unfold E₁Λ ++ suffices x * ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d / d ≤ x * (log x + log 4 + 4) by ++ linarith [le_of_mul_le_mul_left this (by linarith)] ++ calc ++ _ = ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * (x / d) := by ++ rw [Finset.mul_sum] ++ ring_nf ++ _ ≤ ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * (⌊x / d⌋₊ + 1) := by ++ gcongr ++ exact Nat.lt_floor_add_one _|>.le ++ _ = (∑ d ∈ Ioc 0 ⌊x⌋₊, log d) + ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d := by ++ simp_rw [mul_add, mul_one] ++ rw [Finset.sum_add_distrib, sum_log_eq_sum_mangoldt] ++ _ ≤ x * log x + (log 4 + 4) * x := by ++ gcongr ++ · exact sum_log_le hx ++ · exact Chebyshev.psi_le_const_mul_self (by linarith) ++ _ = _ := by ring ++ ++theorem sum_mangoldt_div_eq_log {x : ℝ} (hx : 1 ≤ x) : ++ |∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d - log x| ≤ log 4 + 4 := by ++ grind [E₁Λ.le hx, E₁Λ.ge hx, log_nonneg] ++ ++theorem E₁Λ.bounded' : ∃ c > 0, ∀ x ≥ 1, |E₁Λ x| ≤ c := by ++ exact ⟨log 4 + 4, (by positivity), fun x hx ↦ sum_mangoldt_div_eq_log hx⟩ ++ ++theorem E₁Λ.bounded : E₁Λ =O[atTop] (fun _ ↦ (1:ℝ)) := by ++ simp only [isBigO_iff, norm_eq_abs, norm_one, mul_one, ++ eventually_atTop] ++ exact ⟨log 4 + 4, 1, fun _ hx ↦ sum_mangoldt_div_eq_log hx⟩ ++ ++theorem one_eq_o_log : (fun _ ↦ (1:ℝ)) =o[atTop] (fun x ↦ log x) := by ++ simp only [isLittleO_one_left_iff, norm_eq_abs] ++ exact tendsto_abs_atTop_atTop.comp tendsto_log_atTop ++ ++theorem sum_mangoldt_div_eq_log' : ++ (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d) ~[atTop] (fun x ↦ log x) := by ++ apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log) ++ convert! E₁Λ.bounded using 1 ++ ++noncomputable abbrev E₁p (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p - log x ++ ++theorem sum_log_prime_div_eq (x : ℝ) : ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p = log x + E₁p x := by ++ grind ++ ++theorem E₁p.le_E₁Λ (x : ℝ) : ++ E₁p x ≤ E₁Λ x := by ++ unfold E₁p E₁Λ; rw [sum_filter] ++ gcongr with p _ ++ split_ifs with hp ++ · simp [vonMangoldt_apply_prime hp] ++ have : 0 ≤ Λ p := vonMangoldt_nonneg ++ positivity ++ ++theorem E₁p.le {x : ℝ} (hx : 1 ≤ x) : ++ E₁p x ≤ log 4 + 4 := by ++ linarith [E₁Λ.le hx, E₁p.le_E₁Λ x] ++ ++noncomputable abbrev E₁ : ℝ := ∑' p : ℕ, if p.Prime then (log p) / (p*(p-1)) else 0 ++ ++lemma E₁.summand_nonneg (p : ℕ) : 0 ≤ if p.Prime then (log p) / (p*(p-1)) else 0 := by ++ split_ifs with h ++ · refine div_nonneg (log_natCast_nonneg _) (mul_nonneg (Nat.cast_nonneg _) ?_) ++ suffices 1 ≤ (p : ℝ) by linarith ++ exact_mod_cast h.one_le ++ · rfl ++ ++theorem E₁.summable : Summable (fun p : ℕ ↦ if p.Prime then (log p) / (p*(p-1)) else 0) := by ++ refine (Real.summable_one_div_nat_rpow.mpr (by norm_num: 1 < (3 : ℝ) / 2)|>.const_div ++ 4).of_nonneg_of_le E₁.summand_nonneg fun n ↦ ?_ ++ split_ifs with h ++ · grw [Real.log_le_rpow_div (Nat.cast_nonneg _) (by norm_num : 0 < (1 : ℝ) / 2)] ++ · have denom : (n : ℝ) * ((n : ℝ) - 1) ≥ n ^ 2/ 2 := by ++ rw [sq, mul_div_assoc] ++ gcongr ++ suffices (n : ℝ) ≥ 2 by linarith ++ exact_mod_cast h.two_le ++ grw [denom] ++ · apply le_of_eq ++ rw [← Real.rpow_natCast] ++ field_simp ++ rw [mul_div_assoc, ← Real.rpow_sub (mod_cast h.pos)] ++ norm_num ++ rw [Real.rpow_neg (Nat.cast_nonneg _)] ++ field ++ · exact div_pos (pow_pos (mod_cast h.pos) _) (by norm_num) ++ · apply mul_nonneg (Nat.cast_nonneg _) ++ suffices 1 ≤ (n : ℝ) by linarith ++ exact_mod_cast h.one_le ++ · positivity ++ ++private lemma antitoneOn_log_div_sq : ++ AntitoneOn (fun t ↦ log (t + 2) / (t + 2) ^ 2) (Set.Ici 0) := by ++ apply antitoneOn_of_deriv_nonpos (convex_Ici 0) ++ · refine fun t ht ↦ ContinuousAt.continuousWithinAt ?_ ++ simp at ht ++ have : (t + 2) ≠ 0 := by simp; linarith ++ fun_prop (disch := grind) ++ · refine fun t ht ↦ DifferentiableAt.differentiableWithinAt ?_ ++ simp at ht ++ have : (t + 2) ^ 2 ≠ 0 := by simp; grind ++ fun_prop (disch := grind) ++ · intro t ht ++ simp at ht ++ rw [deriv_fun_div (by fun_prop (disch := grind)) (by fun_prop) (by simp; grind), deriv_comp_add_const, deriv_log] ++ simp ++ field_simp ++ simp only [mul_zero, tsub_le_iff_right, zero_add] ++ rw [← log_rpow (by linarith), ← log_exp 1, rpow_ofNat] ++ gcongr ++ nlinarith [exp_one_lt_three] ++ ++private lemma log_div_sq_nonneg : ++ ∀ t ∈ Set.Ioi 0, 0 ≤ log (t + 2) / (t + 2) ^ 2 := by ++ exact fun t ht ↦ div_nonneg (log_nonneg (by simp_all; linarith)) (by positivity) ++ ++private lemma log_div_sq_is_deriv : ++ ∀ x ∈ Set.Ici 0, HasDerivAt (fun t ↦ (-log (t + 2) - 1) / (t + 2)) (log (x + 2) / (x + 2) ^ 2) x := by ++ intro t ht ++ simp at ht ++ apply HasDerivAt.comp_add_const (f := (fun t ↦ (-log t - 1)/ t)) t 2 ++ convert! HasDerivAt.fun_div (c' := -1 / (t + 2)) (d' := (1 : ℝ)) _ _ _ using 1 ++ · field ++ · apply HasDerivAt.sub_const ++ convert! (hasDerivAt_log (by linarith : t + 2 ≠ 0)).neg using 1 ++ ring_nf ++ · exact hasDerivAt_id _ ++ · linarith ++ ++private lemma tendsto_antideriv_log_div_sq : ++ Tendsto (fun t ↦ (-log (t + 2) - 1) / (t + 2)) atTop (nhds 0) := by ++ have : Tendsto (fun (t : ℝ) ↦ t + 2) atTop atTop := by exact tendsto_atTop_add_const_right atTop 2 tendsto_id ++ apply Tendsto.comp (g := (fun t ↦ (-log t - 1) / t)) _ this ++ convert! Tendsto.sub (f := (fun t ↦ -log t / t)) (a := 0) _ tendsto_inv_atTop_zero using 1 ++ · ring_nf ++ · ring_nf ++ · convert! (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 (by linarith)).neg using 1 ++ · ext; ring ++ · simp ++ ++private lemma integrableOn_log_div_sq : ++ MeasureTheory.IntegrableOn (fun t ↦ log (t + 2) / (t + 2) ^ 2) (Set.Ioi 0) := by ++ exact MeasureTheory.integrableOn_Ioi_deriv_of_nonneg' log_div_sq_is_deriv log_div_sq_nonneg tendsto_antideriv_log_div_sq ++ ++private lemma integral_log_div_sq : ++ ∫ t in Set.Ioi 0, log (t + 2) / (t + 2) ^ 2 = (log 2 + 1) / 2 := by ++ rw [MeasureTheory.integral_Ioi_of_hasDerivAt_of_nonneg' log_div_sq_is_deriv log_div_sq_nonneg tendsto_antideriv_log_div_sq] ++ ring_nf ++ ++private lemma summable_log_div_sq : ++ Summable (fun (n : ℕ)↦ log (n + 3) / (n + 3) ^ 2) := by ++ let g : ℝ → ℝ := (fun n ↦ log (n + 2) / (n + 2) ^ 2) ++ suffices Summable (fun (n : ℕ) ↦ g n ) by ++ convert! summable_nat_add_iff 1|>.mpr this using 2 ++ unfold g ++ push_cast ++ ring_nf ++ exact antitoneOn_log_div_sq.summable_of_integrableOn_Ioi_zero integrableOn_log_div_sq log_div_sq_nonneg ++ ++private lemma sum_log_div_sq_le : ++ ∑' (n : ℕ), log (n + 3) / (n + 3) ^2 ≤ (log 2 + 1) / 2 := by ++ let g : ℝ → ℝ := (fun n ↦ log (n + 2) / (n + 2) ^ 2) ++ calc ++ _ = ∑' (n : ℕ), g (n + 1 : ℕ):= by ++ unfold g ++ congr ++ push_cast ++ ring_nf ++ _ ≤ ∫ x in Set.Ioi 0, g x := by ++ exact antitoneOn_log_div_sq.tsum_add_one_le_integral integrableOn_log_div_sq log_div_sq_nonneg ++ _ = _ := by ++ exact integral_log_div_sq ++ ++theorem E₁.le : E₁ ≤ (5 * log 2 + 3) / 4 := by ++ unfold E₁ ++ calc ++ _ = log 2 / 2 + ∑' (n : ℕ), if (n + 3).Prime then log (n + 3) / ((n + 3) * (n + 2)) else 0 := by ++ rw [← E₁.summable.sum_add_tsum_nat_add 3, (by rfl : range 3 = {0, 1, 2})] ++ simp [Nat.prime_two] ++ ring_nf ++ _ ≤ log 2 / 2 + ∑' (n : ℕ), (3 / 2) * (log (n + 3) / (n + 3) ^ 2) := by ++ gcongr with n ++ · convert! summable_nat_add_iff 3|>.mpr E₁.summable using 4 ++ · norm_cast ++ · push_cast; ring ++ · exact summable_log_div_sq.mul_left _ ++ · split_ifs with h ++ · grw [(by linarith : (n + 2 : ℝ) ≥ 2 * (n + 3) / 3)] ++ · field_simp ++ rfl ++ · exact log_nonneg (by grind) ++ · exact mul_nonneg (by norm_num) (div_nonneg (log_nonneg (by grind)) (by positivity)) ++ _ = log 2 / 2 + (3 / 2) * ∑' (n : ℕ), log (n + 3) / (n + 3) ^ 2 := by ++ rw [tsum_mul_left] ++ _ ≤ _ := by ++ grw [sum_log_div_sq_le] ++ ring_nf ++ rfl ++ ++theorem E₁.nonneg : E₁ ≥ 0 := ++ tsum_nonneg E₁.summand_nonneg ++ ++theorem E₁Λ.le_E₁p_add_E₁ {x : ℝ} (hx : 1 ≤ x) : ++ E₁Λ x ≤ E₁p x + E₁ := by ++ unfold E₁Λ E₁p ++ suffices ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d / d ≤ ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / p + E₁ by linarith ++ simp_rw [vonMangoldt_apply, ite_div, zero_div, ← sum_filter, Chebyshev.sum_PrimePow_eq_sum_sum _ (by linarith)] ++ calc ++ _ = ∑ k ∈ Icc 1 ⌊log x / log 2⌋₊, ∑ p ∈ Ioc 0 ⌊x ^ (1 / (k : ℝ))⌋₊ with Nat.Prime p, log p / (p ^ k : ℕ) := by ++ refine sum_congr rfl fun k hk ↦ sum_congr rfl fun p hp ↦ ?_ ++ rw [Nat.Prime.pow_minFac (by simp_all) (by simp_all; linarith)] ++ _ ≤ ∑ k ∈ Icc 1 ⌊log x / log 2⌋₊, ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / (p ^ k : ℕ) := by ++ gcongr with k hk ++ apply rpow_le_self_of_one_le hx ++ simp only [mem_Icc] at hk ++ exact div_le_one₀ (by norm_cast; linarith)|>.mpr (mod_cast hk.1) ++ _ ≤ ∑ k ∈ Icc 1 (max 1 ⌊log x / log 2⌋₊), ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / (p ^ k : ℕ) := by ++ apply sum_le_sum_of_subset_of_nonneg ++ · gcongr ++ exact le_max_right .. ++ · exact fun _ _ _ ↦ sum_nonneg fun _ _ ↦ (by positivity) ++ _ = ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, (log p / p) + ∑ k ∈ Ioc 1 (max 1 ⌊log x / log 2⌋₊), ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / (p ^ k : ℕ) := by ++ rw [← add_sum_Ioc_eq_sum_Icc (le_max_left ..)] ++ simp ++ _ ≤ _ := by ++ gcongr ++ rw [sum_comm] ++ conv => lhs; arg 2; ext p; arg 2; ext k; rw [← mul_one_div, Nat.cast_pow, ← one_div_pow] ++ simp_rw [← mul_sum] ++ calc ++ _ ≤ ∑ p ∈ Ioc 0 ⌊x⌋₊ with Nat.Prime p, log p / (p * (p - 1)) := by ++ gcongr with p hp ++ simp only [mem_filter, mem_Ioc] at hp ++ conv => rhs; rw [← mul_one_div] ++ gcongr ++ rw [(by rfl : Ioc 1 (max 1 ⌊log x / log 2⌋₊) = Ico 2 (max 1 ⌊log x / log 2⌋₊ + 1))] ++ grw [geom_sum_Ico_le_of_lt_one (by simp)] ++ · apply le_of_eq ++ have : (p : ℝ) ≠ 0 := by exact_mod_cast hp.1.1.ne.symm ++ field ++ · simpa using inv_lt_one_of_one_lt₀ (mod_cast hp.2.one_lt) ++ _ ≤ _ := by ++ rw [sum_filter] ++ exact E₁.summable.sum_le_tsum _ fun p hp ↦ E₁.summand_nonneg p ++ ++theorem E₁p.ge {x : ℝ} (hx : 1 ≤ x) : ++ E₁p x ≥ -2 - E₁ := by ++ linarith [E₁Λ.le_E₁p_add_E₁ hx, E₁Λ.ge hx] ++ ++theorem sum_log_prime_div_eq_log {x : ℝ} (hx : 1 ≤ x) : ++ |∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p - log x| ≤ log 4 + 4 := by ++ rw [abs_le'] ++ refine ⟨ E₁p.le hx, ?_ ⟩ ++ have : log 2 > 0 := by apply log_pos; norm_num ++ have : log 4 = 2 * log 2 := by rw [←Real.log_rpow (by norm_num)]; norm_num ++ grind [E₁p.ge hx, E₁.le] ++ ++theorem E₁p.bounded : ∃ c > 0, ∀ x ≥ 1, |E₁p x| ≤ c := by ++ exact ⟨log 4 + 4, (by positivity), fun _ hx ↦ sum_log_prime_div_eq_log hx⟩ ++ ++theorem sum_log_prime_div_eq_log' : E₁p =O[atTop] (fun _ ↦ (1:ℝ)) := by ++ simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, ++ eventually_atTop, E₁p] ++ exact ⟨ log 4 + 4, 1, fun _ ↦ sum_log_prime_div_eq_log ⟩ ++ ++theorem sum_log_prime_div_eq_log'' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p) ~[atTop] (fun x ↦ log x) := by ++ apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log) ++ convert! sum_log_prime_div_eq_log' using 1 ++ ++noncomputable abbrev γ : ℝ := (∫ t in Set.Ioi 2, E₁Λ t / (t * log t^2)) + 1 - log (log 2) ++ ++noncomputable abbrev E₂Λ (x : ℝ) : ℝ := ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x) - γ ++ ++lemma sum_Ioc_one_eq_sum_Icc_zero {f : ℕ → ℝ} {x : ℕ} (hx : 1 ≤ x) (hf1 : f 1 = 0) (hf0 : f 0 = 0) : ++ ∑ n ∈ Ioc 1 x, f n = ∑ n ∈ Icc 0 x, f n := by ++ rw [sum_Ioc_one_eq_sum_Ioc_zero hx hf1, ← add_sum_Ioc_eq_sum_Icc (by linarith)] ++ simpa ++ ++private theorem sum_div_log_eq {x : ℝ} (hx : 2 ≤ x) (f : ℕ → ℝ) : ++ ∑ n ∈ Ioc 1 ⌊ x ⌋₊, f n / log n = ++ (∑ n ∈ Ioc 1 ⌊ x ⌋₊, f n) / log x + ∫ t in 2..x, (∑ n ∈ Ioc 1 ⌊ t ⌋₊, f n) / (t * log t^2) := by ++ let g : ℕ → ℝ := (fun n ↦ if n < 2 then 0 else f n) ++ trans ∑ n ∈ Icc 0 ⌊ x ⌋₊, (log n)⁻¹ * g n ++ · rw [← sum_Ioc_one_eq_sum_Icc_zero (Nat.le_floor (by grind)) (by simp) (by simp)] ++ refine sum_congr rfl fun n hn ↦ ?_ ++ have : ¬(n ≤ 1) := by simp_all ++ simp [g, this] ++ field ++ rw [sum_mul_eq_sub_integral_mul₁ g (f := (fun n ↦ (log n)⁻¹)) (by simp [g]) (by simp [g])] ++ · rw [intervalIntegral.integral_of_le hx, mul_comm, ← div_eq_mul_inv, ← sub_neg_eq_add] ++ simp_rw [deriv_inv_log] ++ congr 1 ++ · rw [← sum_Ioc_one_eq_sum_Icc_zero (Nat.le_floor (by grind)) (by simp [g]) (by simp [g])] ++ congr 1 ++ refine sum_congr rfl fun n hn ↦ ?_ ++ simp only [mem_Ioc] at hn ++ have : ¬(n ≤ 1) := by linarith ++ simp [g, this] ++ · rw [← MeasureTheory.integral_neg] ++ refine MeasureTheory.setIntegral_congr_fun (by measurability) fun t ht ↦ ?_ ++ simp only [Set.mem_Ioc] at ht ++ rw [← sum_Ioc_one_eq_sum_Icc_zero (Nat.le_floor (by grind)) (by simp [g]) (by simp [g])] ++ field_simp ++ congr 2 ++ refine sum_congr rfl fun n hn ↦ ?_ ++ simp only [mem_Ioc] at hn ++ have : ¬(n ≤ 1) := by linarith ++ simp [g, this] ++ · intro t ht ++ simp only [Set.mem_Icc] at ht ++ have : log t ≠ 0 := by simp; grind ++ fun_prop (disch := grind) ++ · refine ContinuousOn.integrableOn_Icc fun t ht ↦ ContinuousAt.continuousWithinAt ?_ ++ simp only [Set.mem_Icc] at ht ++ conv => arg 1; ext x; rw [deriv_inv_log] ++ have : log t ^2 ≠ 0 := by simp; grind ++ fun_prop (disch := grind) ++ ++private theorem integrable_const_div_mul_log_sq {x : ℝ} (c : ℝ) (hx : 2 ≤ x) : ++ MeasureTheory.IntegrableOn (fun x ↦ c / (x * log x ^ 2)) (Set.Ioi x) MeasureTheory.volume := by ++ conv => arg 1; ext t; rw [← mul_one_div] ++ apply MeasureTheory.Integrable.const_mul ++ refine MeasureTheory.integrableOn_Ioi_deriv_of_nonneg' ?_ ?_ tendsto_log_atTop.inv_tendsto_atTop.neg ++ · intro t ht ++ simp only [Set.mem_Ici] at ht ++ have : log t ≠ 0 := by simp; grind ++ have : DifferentiableAt ℝ (fun t ↦ -(log t)⁻¹) t := by ++ fun_prop (disch := grind) ++ convert! this.hasDerivAt using 1 ++ simp [deriv_inv_log] ++ field ++ · intro t ht ++ simp only [Set.mem_Ioi] at ht ++ exact one_div_nonneg.mpr <| mul_nonneg (by linarith) (sq_nonneg _) ++ ++attribute [fun_prop] measurable_from_top ++ ++private theorem integrable_E₁Λ_div_mul_log_sq {x : ℝ} (hx : 2 ≤ x) : ++ MeasureTheory.IntegrableOn (fun x ↦ E₁Λ x / (x * log x ^ 2)) (Set.Ioi x) MeasureTheory.volume := by ++ obtain ⟨c, hc1, hc2⟩ := E₁Λ.bounded' ++ apply MeasureTheory.Integrable.mono (integrable_const_div_mul_log_sq c hx) ++ · exact Measurable.aestronglyMeasurable (by fun_prop) ++ · filter_upwards [MeasureTheory.ae_restrict_mem (by measurability)] with t ht ++ simp only [Set.mem_Ioi] at ht ++ simp only [norm_div, norm_eq_abs, norm_mul, norm_pow, sq_abs, abs_of_pos hc1] ++ gcongr ++ exact hc2 t (by linarith) ++ ++private theorem integrable_E₁p_div_mul_log_sq {x : ℝ} (hx : 2 ≤ x) : ++ MeasureTheory.IntegrableOn (fun x ↦ E₁p x / (x * log x ^ 2)) (Set.Ioi x) MeasureTheory.volume := by ++ obtain ⟨c, hc1, hc2⟩ := E₁p.bounded ++ apply MeasureTheory.Integrable.mono (integrable_const_div_mul_log_sq c hx) ++ · exact Measurable.aestronglyMeasurable (by fun_prop) ++ · filter_upwards [MeasureTheory.ae_restrict_mem (by measurability)] with t ht ++ simp only [Set.mem_Ioi] at ht ++ simp only [norm_div, norm_eq_abs, norm_mul, norm_pow, sq_abs, abs_of_pos hc1] ++ gcongr ++ exact hc2 t (by linarith) ++ ++lemma deriv_log_log {x : ℝ} (hx : 1 < x) : ++ deriv (fun t ↦ log (log t)) x = 1 / (x * log x) := by ++ rw [deriv.log (differentiableAt_log (by linarith)) (by simp; grind), deriv_log] ++ field ++ ++lemma integral_one_div_mul_log {x : ℝ} (hx : 2 ≤ x) : ++ ∫ t in 2..x, 1 / (t * log t) = log (log x) - log (log 2) := by ++ rw [← intervalIntegral.integral_deriv_eq_sub (f := fun t ↦ log (log t))] ++ · refine intervalIntegral.integral_congr fun t ht ↦ ?_ ++ rw [deriv_log_log] ++ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht ++ linarith ++ · intro t ht ++ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht ++ have : log t ≠ 0 := by simp; grind ++ fun_prop (disch := grind) ++ · refine ContinuousOn.intervalIntegrable ?_ ++ apply ContinuousOn.congr (f := (fun t ↦ 1 / (t * log t))) ++ · refine fun t ht ↦ ContinuousAt.continuousWithinAt ?_ ++ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht ++ have : log t ≠ 0 := by simp; grind ++ fun_prop (disch := grind) ++ · intro t ht ++ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht ++ exact deriv_log_log (by linarith) ++ ++lemma intervalIntegrable_one_div_mul_log {x : ℝ} (hx : 2 ≤ x) : ++ IntervalIntegrable (fun t ↦ 1 / (t * log t)) MeasureTheory.volume 2 x := by ++ refine ContinuousOn.intervalIntegrable fun t ht ↦ ContinuousAt.continuousWithinAt ?_ ++ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht ++ have : log t ≠ 0 := by simp; grind ++ fun_prop (disch := grind) ++ ++theorem E₂Λ.eq {x : ℝ} (hx : 2 ≤ x) : ++ E₂Λ x = E₁Λ x / log x - ∫ t in Set.Ioi x, E₁Λ t / (t * log t^2) := by ++ unfold E₂Λ ++ rw [← sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp)] ++ conv => lhs; arg 1; arg 1; arg 2; ext n; rw [(by field : Λ n / (n * log n) = (Λ n / n) / log n)] ++ rw [sum_div_log_eq hx] ++ rw [sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp), sum_mangoldt_div_eq] ++ have : ∫ t in 2..x, (∑ n ∈ Ioc 1 ⌊t⌋₊, Λ n / n) / (t * log t ^ 2) = ∫ t in 2..x, (1 / (t * log t) + E₁Λ t / (t * log t ^ 2)) := by ++ refine intervalIntegral.integral_congr fun t ht ↦ ?_ ++ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht ++ rw [sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp), sum_mangoldt_div_eq] ++ field ++ rw [this, intervalIntegral.integral_add] ++ · rw [integral_one_div_mul_log hx, add_div, div_self (by simp; grind)] ++ unfold γ ++ calc ++ _ = E₁Λ x / log x + (∫ (x : ℝ) in 2..x, E₁Λ x / (x * log x ^ 2)) - ++ ((∫ (t : ℝ) in Set.Ioi 2, E₁Λ t / (t * log t ^ 2))) := by ring ++ _ = _ := by ++ rw [← intervalIntegral.integral_interval_add_Ioi (integrable_E₁Λ_div_mul_log_sq (by rfl)) (integrable_E₁Λ_div_mul_log_sq hx)] ++ ring ++ · exact intervalIntegrable_one_div_mul_log hx ++ · rw [intervalIntegrable_iff, Set.uIoc_of_le hx] ++ exact integrable_E₁Λ_div_mul_log_sq (x := 2) (by rfl)|>.mono (by grind) (by rfl) ++ ++private theorem integ_div_mul_log_sq {x : ℝ} (c : ℝ) (hx : 2 ≤ x) : ++ ∫ t in Set.Ioi x, c / (t * log t^2) = c / log x := by ++ convert! MeasureTheory.integral_Ioi_of_hasDerivAt_of_tendsto' (m := 0) (f := fun x ↦ - c / log x) ?_ ++ (integrable_const_div_mul_log_sq c hx) ?_ using 1 ++ · grind ++ · intro t ht; simp at ht ++ convert! HasDerivAt.fun_div (hasDerivAt_const _ (-c)) (hasDerivAt_log (by linarith)) ?_ using 1 ++ · grind ++ simp; grind ++ convert! tendsto_log_atTop.inv_tendsto_atTop.const_mul (-c) using 1 ++ simp ++ ++theorem E₂Λ.abs_le {x : ℝ} (hx : 2 ≤ x) : ++ |E₂Λ x| ≤ (log 4 + 6) / log x := by ++ have : 0 < log x := by apply log_pos; linarith ++ rw [E₂Λ.eq hx, abs_le'] ++ constructor ++ · grw [E₁Λ.le (by linarith)] ++ have : ∫ t in Set.Ioi x, E₁Λ t / (t * log t^2) ≥ - 2 / log x := calc ++ _ ≥ ∫ t in Set.Ioi x, (-2) / (t * log t^2) := by ++ apply MeasureTheory.setIntegral_mono_on (integrable_const_div_mul_log_sq (-2) hx) ++ (integrable_E₁Λ_div_mul_log_sq hx) (by measurability) ++ intro y hy; simp at hy ++ have : 1 < y := by linarith ++ have : 0 < log y := log_pos this ++ gcongr; exact E₁Λ.ge (by linarith) ++ _ = _ := integ_div_mul_log_sq (-2) hx ++ grw [this] ++ grind ++ grw [E₁Λ.ge (by linarith)] ++ have : ∫ t in Set.Ioi x, E₁Λ t / (t * log t^2) ≤ (log 4 + 4) / log x := calc ++ _ ≤ ∫ t in Set.Ioi x, (log 4 + 4) / (t * log t^2) := by ++ apply MeasureTheory.setIntegral_mono_on (integrable_E₁Λ_div_mul_log_sq hx) ++ (integrable_const_div_mul_log_sq (log 4 + 4) hx) (by measurability) ++ intro y hy; simp at hy ++ have : 1 < y := by linarith ++ have : 0 < log y := log_pos this ++ gcongr; exact E₁Λ.le (by linarith) ++ _ = _ := integ_div_mul_log_sq (log 4 + 4) hx ++ grw [this] ++ grind ++ ++theorem E₂Λ.bound : E₂Λ =O[atTop] (fun x ↦ 1 / log x) := by ++ simp only [one_div, isBigO_iff, norm_eq_abs, norm_inv, eventually_atTop] ++ use log 4 + 6, 2 ++ intro x hx ++ convert E₂Λ.abs_le hx using 1 ++ have : 0 < log x := by apply log_pos; linarith ++ grind [abs_of_pos this] ++ ++theorem E₂Λ.bound' : E₂Λ =o[atTop] (fun _ ↦ (1:ℝ)) := E₂Λ.bound.trans_isLittleO inv_log_eq_o_one ++ ++theorem log_zeta_eq_sum (s : ℝ) (hs : 1 < s) : ++ log (riemannZeta (s:ℂ)).re = ∑' n, Λ n / (n^s * log n) := by ++ have hsc : (1 : ℝ) < ((s : ℂ)).re := by simpa using hs ++ ++ have hep := riemannZeta_eulerProduct_exp_log (s := (s : ℂ)) hsc ++ set S : ℂ := ∑' p : Nat.Primes, -Complex.log (1 - (p : ℂ) ^ (-(s : ℂ))) with hS ++ ++ have hcpow : ∀ p : Nat.Primes, (p : ℂ) ^ (-(s : ℂ)) = (((p : ℝ) ^ (-s) : ℝ) : ℂ) := by ++ intro p ++ rw [Complex.ofReal_cpow (by positivity)] ++ push_cast; ring_nf ++ ++ set z : Nat.Primes → ℝ := fun p => (p : ℝ) ^ (-s) with hz ++ ++ have hz_pos : ∀ p : Nat.Primes, 0 < z p := fun p => by ++ have : (0 : ℝ) < (p : ℝ) := by exact_mod_cast p.prop.pos ++ positivity ++ have hz_lt_one : ∀ p : Nat.Primes, z p < 1 := by ++ intro p ++ have hp1 : (1 : ℝ) < (p : ℝ) := by exact_mod_cast p.prop.one_lt ++ change (p : ℝ) ^ (-s) < 1 ++ rw [Real.rpow_neg (by positivity), inv_lt_one_iff₀] ++ right ++ exact (Real.one_lt_rpow_iff_of_pos (by positivity)).mpr (Or.inl ⟨hp1, by linarith⟩) ++ ++ have hterm : ∀ p : Nat.Primes, ++ -Complex.log (1 - (p : ℂ) ^ (-(s : ℂ))) = ((-Real.log (1 - z p) : ℝ) : ℂ) := by ++ intro p ++ rw [hcpow p] ++ have h1z : (0 : ℝ) < 1 - z p := by have := hz_lt_one p; linarith ++ rw [show (1 : ℂ) - ((z p : ℝ) : ℂ) = (((1 - z p : ℝ)) : ℂ) by push_cast; ring] ++ rw [← Complex.ofReal_log h1z.le] ++ push_cast; ring ++ ++ set Sr : ℝ := ∑' p : Nat.Primes, -Real.log (1 - z p) with hSr ++ have hSeq : S = (Sr : ℂ) := by ++ rw [hS, hSr, Complex.ofReal_tsum] ++ exact tsum_congr hterm ++ have hSim : S.im = 0 := by rw [hSeq]; exact Complex.ofReal_im _ ++ have hSre : S.re = Sr := by rw [hSeq]; exact Complex.ofReal_re _ ++ ++ have hlog_zeta : Complex.log (riemannZeta (s : ℂ)) = S := by ++ rw [← hep, Complex.log_exp (by rw [hSim]; exact neg_lt_zero.mpr Real.pi_pos) ++ (by rw [hSim]; exact Real.pi_pos.le)] ++ ++ have hkey : Real.log (riemannZeta (s : ℂ)).re = Sr := by ++ have hζim : (riemannZeta (s : ℂ)).im = 0 := riemannZeta_im_eq_zero_of_one_lt hs ++ have hζeq : riemannZeta (s : ℂ) = ((riemannZeta (s : ℂ)).re : ℂ) := by ++ apply Complex.ext <;> simp [hζim] ++ have : Real.log (riemannZeta (s : ℂ)).re ++ = (Complex.log (riemannZeta (s : ℂ))).re := by ++ conv_rhs => rw [hζeq] ++ rw [Complex.log_ofReal_re] ++ rw [this, hlog_zeta, hSre] ++ rw [hkey] ++ ++ have habs : ∀ p : Nat.Primes, |z p| < 1 := by ++ intro p ++ rw [abs_of_pos (hz_pos p)]; exact hz_lt_one p ++ have htaylor : ∀ p : Nat.Primes, ++ HasSum (fun n : ℕ => (z p) ^ (n + 1) / (n + 1)) (-Real.log (1 - z p)) := ++ fun p => hasSum_pow_div_log_of_abs_lt_one (habs p) ++ have hSr_double : Sr = ∑' (p : Nat.Primes) (n : ℕ), (z p) ^ (n + 1) / (n + 1) := by ++ rw [hSr] ++ exact tsum_congr fun p => ((htaylor p).tsum_eq).symm ++ ++ have hsummable_z : Summable z := Nat.Primes.summable_rpow.mpr (by linarith) ++ ++ have hsummable_prime : Summable (fun p : Nat.Primes => -Real.log (1 - z p)) := by ++ have := Real.summable_log_one_add_of_summable hsummable_z.neg ++ convert! this.neg using 1 ++ ++ have hg_nonneg : ∀ pk : Nat.Primes × ℕ, 0 ≤ (z pk.1) ^ (pk.2 + 1) / (pk.2 + 1) := by ++ intro pk; positivity [hz_pos pk.1] ++ have hsummable_g : Summable (fun pk : Nat.Primes × ℕ => (z pk.1) ^ (pk.2 + 1) / (pk.2 + 1)) := by ++ rw [summable_prod_of_nonneg hg_nonneg] ++ refine ⟨fun p => (htaylor p).summable, ?_⟩ ++ refine hsummable_prime.congr (fun p => ?_) ++ exact ((htaylor p).tsum_eq).symm ++ ++ have hpoint : ∀ (p : Nat.Primes) (n : ℕ), ++ Λ ((p : ℕ) ^ (n + 1)) / ++ ((((p : ℕ) ^ (n + 1) : ℕ) : ℝ) ^ s * Real.log (((p : ℕ) ^ (n + 1) : ℕ) : ℝ)) ++ = (z p) ^ (n + 1) / (n + 1) := by ++ intro p n ++ have hp1 : (1 : ℝ) < (p : ℝ) := by exact_mod_cast p.prop.one_lt ++ have hlogp : 0 < Real.log (p : ℝ) := Real.log_pos hp1 ++ rw [vonMangoldt_apply_pow (Nat.succ_ne_zero n), vonMangoldt_apply_prime p.prop] ++ have hcast : (((p : ℕ) ^ (n + 1) : ℕ) : ℝ) = (p : ℝ) ^ (n + 1) := by push_cast; ring ++ rw [hcast, Real.log_pow] ++ rw [show (z p) ^ (n + 1) = ((p : ℝ) ^ (n + 1)) ^ (-s) by ++ rw [hz]; rw [← Real.rpow_natCast ((p : ℝ) ^ (-s)) (n + 1), ++ ← Real.rpow_natCast ((p : ℝ)) (n + 1), ← Real.rpow_mul (by positivity), ++ ← Real.rpow_mul (by positivity)]; ring_nf] ++ rw [Real.rpow_neg (by positivity)] ++ field_simp ++ push_cast ++ ring ++ ++ set F : ℕ → ℝ := fun n => Λ n / ((n : ℝ) ^ s * Real.log n) with hF ++ ++ have hsupp : Function.support F ⊆ {n : ℕ | IsPrimePow n} := by ++ intro n hn ++ rw [Function.mem_support] at hn ++ simp only [Set.mem_ofPred_eq] ++ by_contra hpp ++ apply hn ++ simp only [hF, vonMangoldt_eq_zero_iff.mpr hpp, zero_div] ++ ++ have hprod_eq : (∑' pk : Nat.Primes × ℕ, (z pk.1) ^ (pk.2 + 1) / (pk.2 + 1)) ++ = ∑' m : {n : ℕ // IsPrimePow n}, F m.val := by ++ rw [← Equiv.tsum_eq Nat.Primes.prodNatEquiv (fun m : {n : ℕ // IsPrimePow n} => F m.val)] ++ apply tsum_congr ++ intro pk ++ rw [Nat.Primes.coe_prodNatEquiv_apply, hF] ++ exact (hpoint pk.1 pk.2).symm ++ ++ rw [hSr_double, ← hsummable_g.tsum_prod' (fun p => (htaylor p).summable), hprod_eq] ++ exact tsum_subtype_eq_of_support_subset hsupp ++ ++section ++open MeasureTheory Set ++ ++namespace LogZetaInteg ++ ++private noncomputable def c (d : ℕ) : ℝ := Λ d / (d * Real.log d) ++ ++private noncomputable def f (s : ℝ) (d : ℕ) (x : ℝ) : ℝ := ++ c d * (Set.Ici (d:ℝ)).indicator (fun x => x ^ (-s)) x ++ ++@[simp] private lemma c_zero : c 0 = 0 := by simp [c] ++@[simp] private lemma c_one : c 1 = 0 := by simp [c, vonMangoldt_apply_one] ++ ++private lemma c_nonneg (d : ℕ) : 0 ≤ c d := by ++ unfold c ++ rcases Nat.eq_zero_or_pos d with hd | hd ++ · subst hd; simp ++ · apply div_nonneg vonMangoldt_nonneg ++ have : (0:ℝ) ≤ (d:ℝ) := Nat.cast_nonneg d ++ have hlog : 0 ≤ Real.log d := Real.log_natCast_nonneg d ++ positivity ++ ++private lemma summable_log_rpow_div_rpow (a : ℝ) {s : ℝ} (hs : 1 < s) : ++ Summable (fun n : ℕ => (Real.log n) ^ a / (n:ℝ) ^ s) := by ++ have hε : (0:ℝ) < (s - 1) / 2 := by linarith ++ refine summable_of_isBigO_nat (g := fun n : ℕ => (n:ℝ) ^ ((s - 1) / 2 - s)) ?_ ?_ ++ · rw [Real.summable_nat_rpow]; linarith ++ · have ho : (fun x : ℝ => (Real.log x) ^ a) =O[atTop] (fun x : ℝ => x ^ ((s - 1) / 2)) := ++ (isLittleO_log_rpow_rpow_atTop a hε).isBigO ++ have hmul : (fun x : ℝ => (Real.log x) ^ a / x ^ s) ++ =O[atTop] (fun x : ℝ => x ^ ((s - 1) / 2) / x ^ s) := by ++ simpa only [div_eq_mul_inv] using ho.mul (isBigO_refl (fun x : ℝ => (x ^ s)⁻¹) atTop) ++ have heq : (fun x : ℝ => x ^ ((s - 1) / 2) / x ^ s) ++ =ᶠ[atTop] (fun x : ℝ => x ^ ((s - 1) / 2 - s)) := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ rw [← Real.rpow_sub hx] ++ exact (hmul.trans_eventuallyEq heq).natCast_atTop ++ ++private lemma summable_vonMangoldt_div_rpow (s : ℝ) (hs : 1 < s) : ++ Summable (fun n : ℕ => (Λ n : ℝ) / (n:ℝ) ^ s) := by ++ refine Summable.of_nonneg_of_le (fun n => div_nonneg vonMangoldt_nonneg (by positivity)) ?_ ++ (summable_log_rpow_div_rpow 1 hs) ++ intro n ++ rw [Real.rpow_one] ++ gcongr ++ exact vonMangoldt_le_log ++ ++private lemma summable_c_term (s : ℝ) (hs : 1 < s) : ++ Summable (fun d : ℕ => c d * ((d:ℝ) ^ (1 - s) / (s - 1))) := by ++ have hs1 : (0:ℝ) < s - 1 := by linarith ++ have hlog2 : (0:ℝ) < Real.log 2 := Real.log_pos (by norm_num) ++ ++ refine Summable.of_nonneg_of_le (fun d => ?_) (fun d => ?_) ++ ((summable_vonMangoldt_div_rpow s hs).mul_left (1 / (Real.log 2 * (s - 1)))) ++ · ++ refine mul_nonneg (c_nonneg d) (div_nonneg ?_ hs1.le) ++ rcases eq_or_ne (d:ℝ) 0 with hd | hd ++ · rw [hd, Real.zero_rpow (by linarith : (1 - s) ≠ 0)] ++ · positivity ++ · ++ rcases lt_or_ge d 2 with hd | hd ++ · have hc : c d = 0 := by interval_cases d <;> simp ++ rw [hc, zero_mul] ++ exact mul_nonneg (by positivity) (div_nonneg vonMangoldt_nonneg (by positivity)) ++ · have hd2 : (2:ℝ) ≤ (d:ℝ) := by exact_mod_cast hd ++ have hd0 : (0:ℝ) < (d:ℝ) := by linarith ++ have hlogge : Real.log 2 ≤ Real.log d := Real.log_le_log (by norm_num) hd2 ++ have hds : (0:ℝ) < (d:ℝ) ^ s := Real.rpow_pos_of_pos hd0 s ++ have hkey : c d * ((d:ℝ) ^ (1 - s) / (s - 1)) = Λ d / ((d:ℝ) ^ s * Real.log d * (s - 1)) := by ++ unfold c ++ rw [show (1 - s : ℝ) = -s + 1 by ring, Real.rpow_add hd0, Real.rpow_one, Real.rpow_neg hd0.le] ++ field_simp ++ ++ have hcb : (d:ℝ) ^ s * Real.log 2 * (s - 1) ≤ (d:ℝ) ^ s * Real.log d * (s - 1) := ++ mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hlogge hds.le) hs1.le ++ rw [hkey, show (1 / (Real.log 2 * (s - 1))) * ((Λ d : ℝ) / (d:ℝ) ^ s) ++ = Λ d / ((d:ℝ) ^ s * Real.log 2 * (s - 1)) from by field_simp] ++ exact div_le_div_of_nonneg_left vonMangoldt_nonneg (by positivity) hcb ++ ++theorem log_zeta_eq_integ_aux (s : ℝ) (hs : 1 < s) : ++ Real.log (riemannZeta (s:ℂ)).re = ++ (s - 1) * ∫ x in Set.Ioi 1, (Real.log (Real.log x) + γ + E₂Λ x) * x ^ (-s) := by ++ rw [Mertens.log_zeta_eq_sum s hs] ++ symm ++ have hstep1 : ∀ x ∈ Set.Ioi (1:ℝ), ++ (Real.log (Real.log x) + γ + E₂Λ x) * x ^ (-s) ++ = (∑ d ∈ Finset.Ioc 0 ⌊x⌋₊, c d) * x ^ (-s) := by ++ intro x hx ++ simp only [Mertens.E₂Λ, c] ++ ring ++ have hstep2 : ∀ x ∈ Set.Ioi (1:ℝ), ++ (Real.log (Real.log x) + γ + E₂Λ x) * x ^ (-s) = ∑' d : ℕ, f s d x := by ++ intro x hx ++ rw [hstep1 x hx] ++ simp only [f] ++ rw [Finset.sum_mul] ++ have hx0 : (0:ℝ) ≤ x := by have := hx; simp only [Set.mem_Ioi] at this; linarith ++ rw [tsum_eq_sum (s := Finset.Ioc 0 ⌊x⌋₊) ?_] ++ · apply Finset.sum_congr rfl ++ intro d hd ++ simp only [Finset.mem_Ioc] at hd ++ have hdx : (d:ℝ) ≤ x := by ++ rw [← Nat.le_floor_iff hx0]; exact hd.2 ++ rw [Set.indicator_of_mem (by simpa using hdx)] ++ · intro d hd ++ simp only [Finset.mem_Ioc, not_and, not_le] at hd ++ rcases Nat.eq_zero_or_pos d with hd0 | hd0 ++ · subst hd0; simp ++ · have hfloor : ⌊x⌋₊ < d := hd hd0 ++ have hdx : x < (d:ℝ) := by ++ rw [← Nat.floor_lt hx0]; exact hfloor ++ rw [Set.indicator_of_notMem (by simpa using not_le.mpr hdx)] ++ ring ++ rw [MeasureTheory.setIntegral_congr_fun measurableSet_Ioi hstep2] ++ have hperterm : ∀ d : ℕ, ∫ x in Set.Ioi (1:ℝ), f s d x = c d * ((d:ℝ) ^ (1 - s) / (s - 1)) := by ++ intro d ++ rcases Nat.eq_zero_or_pos d with hd0 | hd0 ++ · subst hd0; simp [f] ++ simp only [f] ++ rw [MeasureTheory.integral_const_mul, MeasureTheory.setIntegral_indicator measurableSet_Ici] ++ congr 1 ++ have hdR : (1:ℝ) ≤ (d:ℝ) := by exact_mod_cast hd0 ++ have hdR0 : (0:ℝ) < (d:ℝ) := by exact_mod_cast hd0 ++ set A : Set ℝ := Set.Ioi (1:ℝ) ∩ Set.Ici (d:ℝ) with hA ++ have hae : A =ᵐ[volume] Set.Ioi (d:ℝ) := by ++ have h1 : A =ᵐ[volume] (Set.Ici (1:ℝ) ∩ Set.Ici (d:ℝ) : Set ℝ) := ++ MeasureTheory.ae_eq_set_inter MeasureTheory.Ioi_ae_eq_Ici (ae_eq_refl _) ++ rw [Set.Ici_inter_Ici, max_eq_right hdR] at h1 ++ exact h1.trans MeasureTheory.Ioi_ae_eq_Ici.symm ++ rw [MeasureTheory.setIntegral_congr_set hae] ++ rw [integral_Ioi_rpow_of_lt (by linarith : (-s:ℝ) < -1) hdR0, ++ show (-s + 1 : ℝ) = 1 - s by ring] ++ have hs1 : (1 - s) ≠ 0 := by linarith ++ have hs2 : (s - 1) ≠ 0 := by linarith ++ field_simp ++ ring ++ have hint : ∀ d : ℕ, MeasureTheory.IntegrableOn (f s d) (Set.Ioi (1:ℝ)) := by ++ intro d ++ unfold f ++ apply MeasureTheory.Integrable.const_mul ++ rw [show MeasureTheory.Integrable ((Set.Ici (d:ℝ)).indicator fun x => x ^ (-s)) ++ (volume.restrict (Set.Ioi (1:ℝ))) ++ ↔ MeasureTheory.IntegrableOn ((Set.Ici (d:ℝ)).indicator fun x => x ^ (-s)) ++ (Set.Ioi (1:ℝ)) volume from Iff.rfl, ++ MeasureTheory.integrableOn_indicator_iff measurableSet_Ici] ++ apply MeasureTheory.IntegrableOn.mono_set ++ (integrableOn_Ioi_rpow_of_lt (by linarith : (-s:ℝ) < -1) (by norm_num : (0:ℝ) < 1/2)) ++ intro x hx ++ simp only [Set.mem_inter_iff, Set.mem_Ici, Set.mem_Ioi] at hx ⊢ ++ linarith [hx.2] ++ have hnorm_int : ∀ d : ℕ, ++ ∫ x in Set.Ioi (1:ℝ), ‖f s d x‖ = c d * ((d:ℝ) ^ (1 - s) / (s - 1)) := by ++ intro d ++ rw [← hperterm d] ++ apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioi ++ intro x hx ++ simp only [Set.mem_Ioi] at hx ++ have hfnn : 0 ≤ f s d x := by ++ simp only [f] ++ apply mul_nonneg (c_nonneg d) ++ by_cases hxd : (d:ℝ) ≤ x ++ · rw [Set.indicator_of_mem (by simpa using hxd)] ++ exact le_of_lt (Real.rpow_pos_of_pos (by linarith) _) ++ · rw [Set.indicator_of_notMem (by simpa using hxd)] ++ change ‖f s d x‖ = f s d x ++ rw [Real.norm_eq_abs, abs_of_nonneg hfnn] ++ have hinterchange : ∫ x in Set.Ioi (1:ℝ), ∑' d : ℕ, f s d x ++ = ∑' d : ℕ, ∫ x in Set.Ioi (1:ℝ), f s d x := by ++ refine (MeasureTheory.integral_tsum_of_summable_integral_norm hint ?_).symm ++ apply (summable_c_term s hs).congr ++ intro d ++ exact (hnorm_int d).symm ++ rw [hinterchange] ++ simp_rw [hperterm] ++ rw [← tsum_mul_left] ++ apply tsum_congr ++ intro d ++ rcases Nat.eq_zero_or_pos d with hd0 | hd0 ++ · subst hd0; simp ++ · have hdR : (0:ℝ) < (d:ℝ) := by exact_mod_cast hd0 ++ have hsub : (d:ℝ) ^ (1 - s) = (d:ℝ) ^ (-s) * (d:ℝ) := by ++ rw [show (1 - s : ℝ) = -s + 1 by ring, Real.rpow_add hdR, Real.rpow_one] ++ have hs1 : s - 1 ≠ 0 := by linarith ++ have hneg : (d:ℝ) ^ (-s) = ((d:ℝ) ^ s)⁻¹ := by ++ rw [Real.rpow_neg (le_of_lt hdR)] ++ unfold c ++ rw [hsub, hneg] ++ field_simp ++ ++end LogZetaInteg ++end ++ ++private theorem log_zeta_eq_integ (s : ℝ) (hs : 1 < s) : ++ log (riemannZeta (s:ℂ)).re = (s - 1) * ∫ x in .Ioi 1, (log (log x) + γ + E₂Λ x) * x^(-s) := ++ LogZetaInteg.log_zeta_eq_integ_aux s hs ++ ++private theorem mul_integ_log_log_eq (s : ℝ) (hs : 1 < s) : ++ (s - 1) * ∫ x in .Ioi 1, log (log x) * x^(-s) = - log (s - 1) + deriv Gamma 1 := ++ mul_integ_log_log_eq_aux s hs ++ ++private theorem mul_integ_gamma_eq (s) (hs : 1 < s) : (s - 1) * ∫ x in .Ioi 1, γ * x^(-s) = γ := by ++ rw [MeasureTheory.integral_const_mul γ (· ^ (-s)), @integral_Ioi_rpow_of_lt (-s), one_rpow] <;> ++ grind ++ ++private theorem integrableOn_Ioi_mul_rpow_neg_of_abs_le ++ {c B a s : ℝ} (hc : 0 < c) (has : a + 1 < s) {f : ℝ → ℝ} (hf : Measurable f) ++ (hbound : ∀ x ∈ Set.Ioi c, |f x| ≤ B * x ^ a) : ++ MeasureTheory.IntegrableOn (fun x => f x * x ^ (-s)) (Set.Ioi c) := by ++ have hg : MeasureTheory.IntegrableOn (fun x => B * x ^ (a - s)) (Set.Ioi c) := ++ (integrableOn_Ioi_rpow_of_lt (by linarith : a - s < -1) hc).const_mul B ++ refine MeasureTheory.Integrable.mono' hg ++ (hf.mul (measurable_id.pow_const (-s))).aestronglyMeasurable ?_ ++ filter_upwards [MeasureTheory.ae_restrict_mem measurableSet_Ioi] with x hx ++ have hxpos : (0:ℝ) < x := hc.trans hx ++ have hxs : (0:ℝ) < x ^ (-s) := Real.rpow_pos_of_pos hxpos _ ++ rw [norm_mul, norm_eq_abs, norm_eq_abs, abs_of_pos hxs] ++ calc |f x| * x ^ (-s) ≤ B * x ^ a * x ^ (-s) := ++ mul_le_mul_of_nonneg_right (hbound x hx) hxs.le ++ _ = B * x ^ (a - s) := by rw [mul_assoc, ← Real.rpow_add hxpos, sub_eq_add_neg] ++ ++private theorem integrableOn_log_log_mul_rpow (s : ℝ) (hs : 1 < s) : ++ MeasureTheory.IntegrableOn (fun x => log (log x) * x ^ (-s)) (Set.Ioi 1) := by ++ rw [← Set.Ioc_union_Ioi_eq_Ioi (by norm_num : (1:ℝ) ≤ 2)] ++ apply MeasureTheory.IntegrableOn.union ++ · ++ have hll : MeasureTheory.IntegrableOn (fun x => log (log x)) (Set.Ioc 1 2) := by ++ have h : IntervalIntegrable (log ∘ log) MeasureTheory.volume 1 2 := by ++ apply MeromorphicOn.intervalIntegrable_log ++ intro x hx ++ rw [Set.uIcc_of_le (by norm_num : (1:ℝ) ≤ 2)] at hx ++ exact (analyticAt_log (by linarith [hx.1] : 0 < x)).meromorphicAt ++ exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (by norm_num)).mp h ++ have hmul : MeasureTheory.IntegrableOn (fun x => x ^ (-s) * log (log x)) (Set.Ioc 1 2) := by ++ apply hll.bdd_mul (c := 1) ++ · fun_prop ++ · filter_upwards [MeasureTheory.ae_restrict_mem measurableSet_Ioc] with x hx ++ rw [norm_eq_abs, abs_of_nonneg (Real.rpow_nonneg (by linarith [hx.1] : (0:ℝ) ≤ x) _)] ++ calc x ^ (-s) ≤ (1:ℝ) ^ (-s) := ++ Real.rpow_le_rpow_of_nonpos (by norm_num) hx.1.le (by linarith) ++ _ = 1 := Real.one_rpow _ ++ simpa [mul_comm] using hmul ++ · ++ set ε := (s - 1) / 2 with hε ++ have hεpos : 0 < ε := by rw [hε]; linarith ++ refine integrableOn_Ioi_mul_rpow_neg_of_abs_le (a := ε) (B := 1 / ε + |log (log 2)|) ++ (by norm_num) (by rw [hε]; linarith) (Real.measurable_log.comp Real.measurable_log) ?_ ++ intro x hx ++ simp only [Set.mem_Ioi] at hx ++ have hx1 : (1:ℝ) ≤ x ^ ε := Real.one_le_rpow (by linarith) hεpos.le ++ have hlogx : 0 < log x := Real.log_pos (by linarith) ++ have hlog2 : 0 < log 2 := Real.log_pos (by norm_num) ++ have hmono : log 2 ≤ log x := Real.log_le_log (by norm_num) (by linarith) ++ have hub : log (log x) ≤ x ^ ε / ε := ++ calc log (log x) ≤ log x := (Real.log_le_sub_one_of_pos hlogx).trans (by linarith) ++ _ ≤ x ^ ε / ε := Real.log_le_rpow_div (by linarith) hεpos ++ have hlb : log (log 2) ≤ log (log x) := Real.log_le_log hlog2 hmono ++ have hxε : 0 ≤ x ^ ε / ε := by positivity ++ calc |log (log x)| ≤ x ^ ε / ε + |log (log 2)| := by ++ rw [abs_le] ++ exact ⟨by linarith [neg_abs_le (log (log 2))], ++ by linarith [abs_nonneg (log (log 2))]⟩ ++ _ ≤ (1 / ε + |log (log 2)|) * x ^ ε := by ++ have h2 : |log (log 2)| ≤ |log (log 2)| * x ^ ε := le_mul_of_one_le_right (abs_nonneg _) hx1 ++ have h1 : x ^ ε / ε = 1 / ε * x ^ ε := by ring ++ rw [add_mul]; linarith ++ ++private theorem integrableOn_γ_mul_rpow (s : ℝ) (hs : 1 < s) : ++ MeasureTheory.IntegrableOn (fun x => γ * x ^ (-s)) (Set.Ioi 1) := by ++ exact (integrableOn_Ioi_rpow_of_lt (by linarith : -s < -1) one_pos).const_mul γ ++ ++private theorem integrableOn_E₂Λ_mul_rpow (s : ℝ) (hs : 1 < s) : ++ MeasureTheory.IntegrableOn (fun x => E₂Λ x * x ^ (-s)) (Set.Ioi 1) := by ++ rw [← Set.Ioo_union_Ici_eq_Ioi (by norm_num : (1:ℝ) < 2)] ++ apply MeasureTheory.IntegrableOn.union ++ · ++ have hsub : Set.Ioo (1:ℝ) 2 ⊆ Set.Ioi 1 := fun x hx => hx.1 ++ have h1 := (integrableOn_γ_mul_rpow s hs).mono_set hsub ++ have h2 := (integrableOn_log_log_mul_rpow s hs).mono_set hsub ++ have hb : MeasureTheory.IntegrableOn ++ (fun x => -(log (log x) * x ^ (-s)) - γ * x ^ (-s)) (Set.Ioo 1 2) := ++ h2.neg.sub h1 ++ apply hb.congr_fun _ measurableSet_Ioo ++ intro x hx ++ simp only [Set.mem_Ioo] at hx ++ have hfloor : ⌊ x ⌋₊ = 1 := by ++ rw [Nat.floor_eq_iff (by linarith)] ++ exact ⟨by push_cast; linarith [hx.1], by push_cast; linarith [hx.2]⟩ ++ have hsum : (∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / ((d:ℝ) * log d)) = 0 := by rw [hfloor]; norm_num ++ change -(log (log x) * x ^ (-s)) - γ * x ^ (-s) ++ = (∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x) - γ) * x ^ (-s) ++ rw [hsum]; ring ++ · ++ rw [integrableOn_Ici_iff_integrableOn_Ioi] ++ refine integrableOn_Ioi_mul_rpow_neg_of_abs_le (a := 0) (B := (log 4 + 6) / log 2) ++ (by norm_num) (by linarith) (by fun_prop) ?_ ++ intro x hx ++ simp only [Set.mem_Ioi] at hx ++ have hlog2 : 0 < log 2 := Real.log_pos (by norm_num) ++ have hc : 0 ≤ log 4 + 6 := by positivity ++ rw [Real.rpow_zero, mul_one] ++ have hb2 : (log 4 + 6) / log x ≤ (log 4 + 6) / log 2 := ++ div_le_div_of_nonneg_left hc hlog2 (Real.log_le_log (by norm_num) (le_of_lt hx)) ++ exact (E₂Λ.abs_le (le_of_lt hx)).trans hb2 ++ ++private theorem log_zeta_eq (s : ℝ) (hs : 1 < s) : ++ log (riemannZeta (s:ℂ)).re = - log (s - 1) + deriv Gamma 1 + γ + (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x^(-s) := by ++ ++ rw [log_zeta_eq_integ s hs] ++ ++ have key : (∫ x in Set.Ioi 1, (log (log x) + γ + E₂Λ x) * x ^ (-s)) ++ = (∫ x in Set.Ioi 1, log (log x) * x ^ (-s)) ++ + (∫ x in Set.Ioi 1, γ * x ^ (-s)) ++ + (∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)) := by ++ rw [← MeasureTheory.integral_add (integrableOn_log_log_mul_rpow s hs) ++ (integrableOn_γ_mul_rpow s hs)] ++ rw [← MeasureTheory.integral_add (f := fun x => log (log x) * x ^ (-s) + γ * x ^ (-s)) ++ (g := fun x => E₂Λ x * x ^ (-s)) ++ ((integrableOn_log_log_mul_rpow s hs).add (integrableOn_γ_mul_rpow s hs)) ++ (integrableOn_E₂Λ_mul_rpow s hs)] ++ apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioi ++ intro x _ ++ ring ++ ++ rw [key, mul_add, mul_add, mul_integ_log_log_eq s hs, mul_integ_gamma_eq s hs] ++ ++private lemma zeta_pole_mul_re_tendsto_one : ++ Filter.Tendsto (fun s : ℝ => (s - 1) * (riemannZeta (s : ℂ)).re) ++ (nhdsWithin 1 (Set.Ioi 1)) (nhds 1) := by ++ have hofReal : ++ Filter.Tendsto (fun s : ℝ => (s : ℂ)) (nhdsWithin 1 (Set.Ioi 1)) ++ (nhdsWithin (1 : ℂ) ({1} : Set ℂ)ᶜ) := by ++ refine tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ ?_ ?_ ++ · exact (Complex.continuous_ofReal.tendsto 1).mono_left nhdsWithin_le_nhds ++ · filter_upwards [self_mem_nhdsWithin] with s hs ++ exact Set.mem_compl_singleton_iff.mpr (by ++ norm_num ++ exact ne_of_gt (Set.mem_Ioi.mp hs)) ++ have hcomplex : ++ Filter.Tendsto (fun s : ℝ => ((s : ℂ) - 1) * riemannZeta (s : ℂ)) ++ (nhdsWithin 1 (Set.Ioi 1)) (nhds 1) := ++ riemannZeta_residue_one.comp hofReal ++ have hreal : ++ Filter.Tendsto ++ (fun s : ℝ => (((s : ℂ) - 1) * riemannZeta (s : ℂ)).re) ++ (nhdsWithin 1 (Set.Ioi 1)) (nhds (1 : ℝ)) := ++ (Complex.continuous_re.tendsto (1 : ℂ)).comp hcomplex ++ simpa [Complex.ofReal_sub, Complex.ofReal_mul] using hreal ++ ++private theorem log_zeta_limit : ++ Filter.Tendsto ++ (fun s : ℝ => Real.log (riemannZeta (s : ℂ)).re + Real.log (s - 1)) ++ (nhdsWithin 1 (Set.Ioi 1)) (nhds 0) := by ++ have hlog : ++ Filter.Tendsto ++ (fun s : ℝ => Real.log ((s - 1) * (riemannZeta (s : ℂ)).re)) ++ (nhdsWithin 1 (Set.Ioi 1)) (nhds (Real.log 1)) := ++ (Real.continuousAt_log (by norm_num : (1 : ℝ) ≠ 0)).tendsto.comp ++ zeta_pole_mul_re_tendsto_one ++ have hEq : ++ (fun s : ℝ => Real.log (riemannZeta (s : ℂ)).re + Real.log (s - 1)) ++ =ᶠ[nhdsWithin 1 (Set.Ioi 1)] ++ fun s : ℝ => Real.log ((s - 1) * (riemannZeta (s : ℂ)).re) := by ++ filter_upwards [self_mem_nhdsWithin] with s hs ++ have hspos : 0 < s - 1 := sub_pos.mpr (Set.mem_Ioi.mp hs) ++ have hzpos : 0 < (riemannZeta (s : ℂ)).re := ++ riemannZeta_re_pos_of_one_lt (Set.mem_Ioi.mp hs) ++ rw [Real.log_mul hspos.ne' hzpos.ne'] ++ ring ++ simpa using hlog.congr' (hEq.mono fun s hs => hs.symm) ++ ++section ++open MeasureTheory Set ++ ++private lemma measurable_E₂Λ : Measurable E₂Λ := by fun_prop ++ ++private lemma E₂Λ_eq_on_Ioo {x : ℝ} (hx : x ∈ Set.Ioo (1 : ℝ) 2) : ++ E₂Λ x = - log (log x) - γ := by ++ obtain ⟨h1, h2⟩ := hx ++ have hf : ⌊x⌋₊ = 1 := by ++ rw [Nat.floor_eq_iff (by linarith)] ++ exact ⟨by exact_mod_cast h1.le, by exact_mod_cast h2⟩ ++ unfold E₂Λ ++ rw [hf] ++ simp ++ ++private lemma abs_E₂Λ_le_on_Ioo {x : ℝ} (hx : x ∈ Set.Ioo (1 : ℝ) 2) : ++ |E₂Λ x| ≤ |log (x - 1)| + log 2 + |γ| := by ++ obtain ⟨hx1, hx2⟩ := hx ++ have hloglog : |log (log x)| ≤ |log (x - 1)| + log 2 := by ++ have hxpos : (0:ℝ) < x := by linarith ++ have hlogx_pos : 0 < log x := Real.log_pos hx1 ++ have hxm1 : 0 < x - 1 := by linarith ++ have hub : log x ≤ x - 1 := by have := Real.log_le_sub_one_of_pos hxpos; linarith ++ have hlb2 : (x - 1) / 2 ≤ log x := by ++ have h := Real.log_le_sub_one_of_pos (x := 1 / x) (by positivity) ++ rw [Real.log_div one_ne_zero (by positivity), Real.log_one] at h ++ simp only [zero_sub] at h ++ have h12 : (x - 1) / 2 ≤ 1 - 1 / x := by ++ rw [← sub_nonneg] ++ have e : (1 - 1 / x) - (x - 1) / 2 = (3 * x - 2 - x ^ 2) / (2 * x) := by field_simp; ring ++ rw [e]; exact div_nonneg (by nlinarith [hx1, hx2]) (by positivity) ++ linarith ++ have hupper : log (log x) ≤ log (x - 1) := Real.log_le_log hlogx_pos hub ++ have hlower : log (x - 1) - log 2 ≤ log (log x) := by ++ have := Real.log_le_log (show (0:ℝ) < (x - 1) / 2 by positivity) hlb2 ++ rwa [Real.log_div (by linarith) (by norm_num)] at this ++ have h2 : (0:ℝ) ≤ log 2 := Real.log_nonneg (by norm_num) ++ rw [abs_le] ++ exact ⟨by have := neg_abs_le (log (x - 1)); linarith, ++ by have := le_abs_self (log (x - 1)); linarith⟩ ++ rw [E₂Λ_eq_on_Ioo ⟨hx1, hx2⟩] ++ have htri : |(- log (log x) - γ)| ≤ |log (log x)| + |γ| := by ++ have h := abs_sub (-log (log x)) γ ++ rwa [abs_neg] at h ++ linarith ++ ++private lemma abs_E₂Λ_le_const {x : ℝ} (hx : 2 ≤ x) : ++ |E₂Λ x| ≤ (log 4 + 6) / log 2 := ++ (E₂Λ.abs_le hx).trans <| div_le_div_of_nonneg_left (by positivity) ++ (Real.log_pos (by norm_num)) (Real.log_le_log (by norm_num) hx) ++ ++private lemma integrableOn_log_sub_one_bound : ++ IntegrableOn (fun x => |log (x - 1)| + log 2 + |γ|) (Set.Ioo 1 2) volume := by ++ have hlog : IntegrableOn (fun x => |log (x - 1)|) (Set.Ioo 1 2) volume := by ++ have h0 : IntervalIntegrable (fun x => log x) volume 0 1 := ++ intervalIntegral.intervalIntegrable_log' ++ have h1 : IntervalIntegrable (fun x => log (x - 1)) volume (0 + 1) (1 + 1) := ++ h0.comp_sub_right 1 ++ norm_num at h1 ++ exact (h1.1.mono_set Set.Ioo_subset_Ioc_self).abs ++ have hc : IntegrableOn (fun _ : ℝ => log 2 + |γ|) (Set.Ioo (1 : ℝ) 2) volume := ++ integrableOn_const (measure_Ioo_lt_top).ne (by finiteness) ++ have hsum : IntegrableOn (fun x => |log (x - 1)| + (log 2 + |γ|)) (Set.Ioo 1 2) volume := ++ hlog.add hc ++ exact hsum.congr_fun (fun x _ => by ring) measurableSet_Ioo ++ ++private lemma integrableOn_E₂Λ_Ioo {X : ℝ} (_hX : 2 ≤ X) : ++ IntegrableOn E₂Λ (Set.Ioo 1 X) volume := by ++ have hsub : Set.Ioo (1 : ℝ) X ⊆ Set.Ioo 1 2 ∪ Set.Icc 2 X := by ++ intro x hx; simp only [Set.mem_Ioo, Set.mem_union, Set.mem_Icc] at * ++ rcases lt_or_ge x 2 with h | h ++ · exact Or.inl ⟨hx.1, h⟩ ++ · exact Or.inr ⟨h, hx.2.le⟩ ++ apply IntegrableOn.mono_set _ hsub ++ apply IntegrableOn.union ++ · have hg := integrableOn_log_sub_one_bound ++ refine Integrable.mono' hg measurable_E₂Λ.aestronglyMeasurable ?_ ++ filter_upwards [self_mem_ae_restrict measurableSet_Ioo] with x hx ++ rw [Real.norm_eq_abs]; exact abs_E₂Λ_le_on_Ioo hx ++ · refine Integrable.mono' (g := fun _ => (log 4 + 6) / log 2) ?_ ++ measurable_E₂Λ.aestronglyMeasurable ?_ ++ · exact integrableOn_const (by rw [Real.volume_Icc]; exact ENNReal.ofReal_ne_top) (by finiteness) ++ · filter_upwards [self_mem_ae_restrict measurableSet_Icc] with x hx ++ rw [Real.norm_eq_abs]; exact abs_E₂Λ_le_const hx.1 ++ ++private lemma sub_one_mul_integral_E₂Λ_tendsto : ++ Filter.Tendsto (fun s : ℝ => (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)) ++ (nhdsWithin 1 (Set.Ioi 1)) (nhds 0) := by ++ rw [Metric.tendsto_nhdsWithin_nhds] ++ intro ε hε ++ ++ obtain ⟨X₀, hX₀⟩ : ∃ X, ∀ x ≥ X, |E₂Λ x| ≤ ε / 2 := by ++ have := E₂Λ.bound'.def (by positivity : (0:ℝ) < ε / 2) ++ simp only [Real.norm_eq_abs, abs_one, mul_one] at this ++ rw [Filter.eventually_atTop] at this; exact this ++ set X := max X₀ 2 with hXdef ++ have hX2 : 2 ≤ X := le_max_right _ _ ++ have hXge : ∀ x ≥ X, |E₂Λ x| ≤ ε / 2 := fun x hx => hX₀ x (le_trans (le_max_left _ _) hx) ++ ++ set B := ∫ x in Set.Ioo 1 X, |E₂Λ x| with hBdef ++ have hB0 : 0 ≤ B := setIntegral_nonneg measurableSet_Ioo (fun x _ => abs_nonneg _) ++ refine ⟨min 1 (ε / 2 / (B + 1)), by positivity, ?_⟩ ++ intro s hs hdist ++ simp only [Set.mem_Ioi] at hs ++ rw [Real.dist_eq] at hdist ++ have hs1 : s - 1 < min 1 (ε / 2 / (B + 1)) := by ++ rw [abs_of_pos (by linarith)] at hdist; exact hdist ++ have hsm1 : 0 < s - 1 := by linarith ++ ++ have hintAbs : IntegrableOn (fun x => |E₂Λ x| * x ^ (-s)) (Set.Ioi 1) volume := by ++ have h2 : IntegrableOn (fun x => |E₂Λ x * x ^ (-s)|) (Set.Ioi 1) volume := ++ (integrableOn_E₂Λ_mul_rpow s hs).abs ++ refine h2.congr_fun ?_ measurableSet_Ioi ++ intro x hx; simp only [Set.mem_Ioi] at hx ++ change |E₂Λ x * x ^ (-s)| = |E₂Λ x| * x ^ (-s) ++ rw [abs_mul, abs_of_nonneg (Real.rpow_nonneg (by linarith) _)] ++ have hintAbsIoc : IntegrableOn (fun x => |E₂Λ x| * x ^ (-s)) (Set.Ioc 1 X) volume := ++ hintAbs.mono_set Set.Ioc_subset_Ioi_self ++ have hintAbsIoiX : IntegrableOn (fun x => |E₂Λ x| * x ^ (-s)) (Set.Ioi X) volume := ++ hintAbs.mono_set (Set.Ioi_subset_Ioi (by linarith)) ++ ++ have hsplit : ∫ x in Set.Ioi 1, |E₂Λ x| * x ^ (-s) = ++ (∫ x in Set.Ioc 1 X, |E₂Λ x| * x ^ (-s)) + ∫ x in Set.Ioi X, |E₂Λ x| * x ^ (-s) := by ++ have hu : Set.Ioi (1:ℝ) = Set.Ioc 1 X ∪ Set.Ioi X := ++ (Set.Ioc_union_Ioi_eq_Ioi (by linarith)).symm ++ rw [hu, setIntegral_union (Set.Ioc_disjoint_Ioi le_rfl) measurableSet_Ioi ++ (hintAbs.mono_set (by rw [hu]; exact Set.subset_union_left)) ++ (hintAbs.mono_set (by rw [hu]; exact Set.subset_union_right))] ++ ++ have hp1 : ∫ x in Set.Ioc 1 X, |E₂Λ x| * x ^ (-s) ≤ B := by ++ rw [hBdef] ++ have ha : IntegrableOn (fun x => |E₂Λ x|) (Set.Ioo 1 X) volume := (integrableOn_E₂Λ_Ioo hX2).abs ++ have habsIoc : IntegrableOn (fun x => |E₂Λ x|) (Set.Ioc 1 X) volume := ++ ha.congr_set_ae (Ioo_ae_eq_Ioc).symm ++ rw [← integral_Ioc_eq_integral_Ioo] ++ apply setIntegral_mono_on hintAbsIoc habsIoc measurableSet_Ioc ++ intro x hx ++ have hx1 : (1:ℝ) ≤ x := by have := hx.1; linarith ++ have hle1 : x ^ (-s) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos hx1 (by linarith) ++ calc |E₂Λ x| * x ^ (-s) ≤ |E₂Λ x| * 1 := by gcongr ++ _ = |E₂Λ x| := mul_one _ ++ ++ have hp2 : ∫ x in Set.Ioi X, |E₂Λ x| * x ^ (-s) ≤ (ε / 2) * (X ^ (1 - s) / (s - 1)) := by ++ have hrpow_int : IntegrableOn (fun x : ℝ => x ^ (-s)) (Set.Ioi X) volume := ++ integrableOn_Ioi_rpow_of_lt (by linarith) (by linarith : (0:ℝ) < X) ++ have hval : ∫ x in Set.Ioi X, x ^ (-s) = X ^ (1 - s) / (s - 1) := by ++ rw [integral_Ioi_rpow_of_lt (by linarith) (by linarith : (0:ℝ) < X), ++ show -s + 1 = 1 - s by ring, show (1:ℝ) - s = -(s - 1) by ring] ++ rw [div_neg, neg_div, neg_neg] ++ rw [← hval, ← integral_const_mul] ++ apply setIntegral_mono_on hintAbsIoiX (hrpow_int.const_mul (ε / 2)) measurableSet_Ioi ++ intro x hx ++ have hxpos : (0:ℝ) < x := by simp only [Set.mem_Ioi] at hx; linarith ++ have hnn : 0 ≤ x ^ (-s) := Real.rpow_nonneg hxpos.le _ ++ have hb : |E₂Λ x| ≤ ε / 2 := hXge x (by simp only [Set.mem_Ioi] at hx; linarith) ++ gcongr ++ have hXpow : X ^ (1 - s) ≤ 1 := ++ Real.rpow_le_one_of_one_le_of_nonpos (by linarith) (by linarith) ++ ++ have hbound : (s - 1) * ∫ x in Set.Ioi 1, |E₂Λ x| * x ^ (-s) ≤ (s - 1) * B + ε / 2 := by ++ rw [hsplit, mul_add] ++ have ht2 : (s - 1) * ∫ x in Set.Ioi X, |E₂Λ x| * x ^ (-s) ≤ ε / 2 := by ++ calc (s - 1) * ∫ x in Set.Ioi X, |E₂Λ x| * x ^ (-s) ++ ≤ (s - 1) * ((ε / 2) * (X ^ (1 - s) / (s - 1))) := ++ mul_le_mul_of_nonneg_left hp2 hsm1.le ++ _ = (ε / 2) * X ^ (1 - s) := by ++ have hne : s - 1 ≠ 0 := by linarith ++ field_simp ++ _ ≤ (ε / 2) * 1 := by gcongr ++ _ = ε / 2 := mul_one _ ++ have ht1 : (s - 1) * ∫ x in Set.Ioc 1 X, |E₂Λ x| * x ^ (-s) ≤ (s - 1) * B := ++ mul_le_mul_of_nonneg_left hp1 hsm1.le ++ linarith ++ ++ have habs_le : |(s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)| ++ ≤ (s - 1) * ∫ x in Set.Ioi 1, |E₂Λ x| * x ^ (-s) := by ++ rw [abs_mul, abs_of_pos hsm1] ++ gcongr ++ rw [← Real.norm_eq_abs] ++ refine (norm_integral_le_integral_norm _).trans_eq ?_ ++ refine setIntegral_congr_fun measurableSet_Ioi (fun x hx => ?_) ++ simp only [Set.mem_Ioi] at hx ++ change ‖E₂Λ x * x ^ (-s)‖ = |E₂Λ x| * x ^ (-s) ++ rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (Real.rpow_nonneg (by linarith) _)] ++ rw [Real.dist_eq, sub_zero] ++ ++ have hfin : (s - 1) * B + ε / 2 < ε := by ++ have hlt : s - 1 < ε / 2 / (B + 1) := lt_of_lt_of_le hs1 (min_le_right _ _) ++ have hBp : 0 < B + 1 := by linarith ++ have h1 : (s - 1) * B ≤ (s - 1) * (B + 1) := by nlinarith ++ have h2 : (s - 1) * (B + 1) < (ε / 2 / (B + 1)) * (B + 1) := mul_lt_mul_of_pos_right hlt hBp ++ have h3 : (ε / 2 / (B + 1)) * (B + 1) = ε / 2 := by field_simp ++ linarith ++ calc |(s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)| ++ ≤ (s - 1) * ∫ x in Set.Ioi 1, |E₂Λ x| * x ^ (-s) := habs_le ++ _ ≤ (s - 1) * B + ε / 2 := hbound ++ _ < ε := hfin ++ ++end ++ ++theorem deriv_gamma_add_γ_eq_zero : deriv Gamma 1 + γ = 0 := by ++ ++ have key : ∀ s : ℝ, 1 < s → ++ (Real.log (riemannZeta (s:ℂ)).re + Real.log (s - 1)) ++ - (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s) = deriv Gamma 1 + γ := by ++ intro s hs ++ have h := log_zeta_eq s hs ++ linarith ++ ++ have hconst : Filter.Tendsto ++ (fun s : ℝ => (Real.log (riemannZeta (s:ℂ)).re + Real.log (s - 1)) ++ - (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x ^ (-s)) ++ (nhdsWithin 1 (Set.Ioi 1)) (nhds (deriv Gamma 1 + γ)) := by ++ refine Filter.Tendsto.congr' ?_ tendsto_const_nhds ++ filter_upwards [self_mem_nhdsWithin] with s hs ++ exact (key s hs).symm ++ ++ have hlim := log_zeta_limit.sub sub_one_mul_integral_E₂Λ_tendsto ++ rw [sub_zero] at hlim ++ exact tendsto_nhds_unique hconst hlim ++ ++theorem γ.eq_eulerMascheroni : γ = eulerMascheroniConstant := by ++ linarith [Real.eulerMascheroniConstant_eq_neg_deriv, deriv_gamma_add_γ_eq_zero] ++ ++theorem sum_mangoldt_div_log_eq (x : ℝ) : ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) = log (log x) + eulerMascheroniConstant + E₂Λ x := by ++ grind [γ.eq_eulerMascheroni] ++ ++theorem sum_mangoldt_div_log_eq_log_log : ∃ C, ∀ x, 2 ≤ x → ++ |∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x)| ≤ C := by ++ use (log 4 + 6)/log 2 + |eulerMascheroniConstant| ++ intro x hx ++ rw [sum_mangoldt_div_log_eq] ++ calc ++ _ = |E₂Λ x + eulerMascheroniConstant| := by ring_nf ++ _ ≤ (log 4 + 6)/log x + |eulerMascheroniConstant| := by grw [abs_add_le, E₂Λ.abs_le hx] ++ _ ≤ _ := by gcongr ++ ++theorem sum_mangoldt_div_log_eq_log_log' : (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x)) =O[atTop] (fun _ ↦ (1:ℝ)) := by ++ simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, ++ eventually_atTop] ++ obtain ⟨ C, _ ⟩ := sum_mangoldt_div_log_eq_log_log ++ use C, 2 ++ ++theorem sum_mangoldt_div_log_eq_log_log'' : (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d)) ~[atTop] (fun x ↦ log (log x)) := by ++ apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log_log) ++ convert! sum_mangoldt_div_log_eq_log_log' using 1 ++ ++noncomputable def M : ℝ := (∫ t in Set.Ioi 2, E₁p t / (t * log t^2)) + 1 - log (log 2) ++ ++theorem M.le : M ≤ (log 4 + 4) / log 2 + 1 - log (log 2) := calc ++ _ ≤ (∫ t in Set.Ioi 2, (log 4 + 4) / (t * log t^2)) + 1 - log (log 2) := by ++ unfold M; gcongr with x hx ++ · exact integrable_E₁p_div_mul_log_sq (by norm_num) ++ · exact integrable_const_div_mul_log_sq _ (by norm_num) ++ · measurability ++ · simp at hx; positivity ++ simp at hx; exact E₁p.le (by linarith) ++ _ = _ := by rw [integ_div_mul_log_sq _ (by norm_num)] ++ ++theorem M.ge : M ≥ (-2 - E₁) / log 2 + 1 - log (log 2) := calc ++ _ ≥ (∫ t in Set.Ioi 2, (-2 - E₁) / (t * log t^2)) + 1 - log (log 2) := by ++ unfold M; gcongr with x hx ++ · exact integrable_const_div_mul_log_sq _ (by norm_num) ++ · exact integrable_E₁p_div_mul_log_sq (by norm_num) ++ · measurability ++ · simp at hx; positivity ++ simp at hx; exact E₁p.ge (by linarith) ++ _ = _ := by rw [integ_div_mul_log_sq _ (by norm_num)] ++ ++noncomputable abbrev E₂p (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1:ℝ) / p - log (log x) - M ++ ++theorem sum_prime_div_eq (x : ℝ) : ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1:ℝ) / p = log (log x) + M + E₂p x := by ++ ring ++ ++theorem E₂p.eq {x : ℝ} (hx : 2 ≤ x) : ++ E₂p x = E₁p x / log x - ∫ t in Set.Ioi x, E₁p t / (t * log t^2) := by ++ unfold E₂p ++ rw [sum_filter, ← sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp [Nat.not_prime_one])] ++ have (n : ℕ) : (if Nat.Prime n then (1 : ℝ) / n else 0) = (if Nat.Prime n then log n / n else 0) / log n := by ++ split_ifs with h ++ · have : log n ≠ 0 := by simp; grind [h.two_le] ++ field ++ · simp ++ simp_rw [this] ++ rw [sum_div_log_eq hx, sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp), ← sum_filter] ++ rw [sum_log_prime_div_eq] ++ have : ∫ t in 2..x, (∑ n ∈ Ioc 1 ⌊t⌋₊, if Nat.Prime n then log ↑n / ↑n else 0) / (t * log t ^ 2) = ∫ t in 2..x, (1 / (t * log t) + E₁p t / (t * log t ^2)) := by ++ refine intervalIntegral.integral_congr fun t ht ↦ ?_ ++ rw [Set.uIcc_of_le hx, Set.mem_Icc] at ht ++ rw [sum_Ioc_one_eq_sum_Ioc_zero (Nat.le_floor (by grind)) (by simp), ← sum_filter, sum_log_prime_div_eq] ++ field ++ rw [this, intervalIntegral.integral_add] ++ · rw [integral_one_div_mul_log hx, add_div, div_self (by simp; grind)] ++ unfold M ++ calc ++ _ = E₁p x / log x + (∫ (x : ℝ) in 2..x, E₁p x / (x * log x ^ 2)) - ++ ((∫ (t : ℝ) in Set.Ioi 2, E₁p t / (t * log t ^ 2))) := by ring ++ _ = _ := by ++ rw [← intervalIntegral.integral_interval_add_Ioi (integrable_E₁p_div_mul_log_sq (by rfl)) (integrable_E₁p_div_mul_log_sq hx)] ++ ring ++ · exact intervalIntegrable_one_div_mul_log hx ++ · rw [intervalIntegrable_iff, Set.uIoc_of_le hx] ++ exact integrable_E₁p_div_mul_log_sq (x := 2) (by rfl)|>.mono (by grind) (by rfl) ++ ++theorem E₂p.abs_le {x : ℝ} (hx : 2 ≤ x) : ++ |E₂p x| ≤ (log 4 + 6 + E₁) / log x := by ++ have : 0 < log x := by apply log_pos; linarith ++ rw [E₂p.eq hx, abs_le'] ++ constructor ++ · grw [E₁p.le (by linarith)] ++ have : ∫ t in Set.Ioi x, E₁p t / (t * log t^2) ≥ (- 2 - E₁) / log x := calc ++ _ ≥ ∫ t in Set.Ioi x, (-2 - E₁) / (t * log t^2) := by ++ apply MeasureTheory.setIntegral_mono_on (integrable_const_div_mul_log_sq (-2 - E₁) hx) ++ (integrable_E₁p_div_mul_log_sq hx) (by measurability) ++ intro y hy; simp at hy ++ have : 1 < y := by linarith ++ have : 0 < log y := log_pos this ++ gcongr; exact E₁p.ge (by linarith) ++ _ = _ := integ_div_mul_log_sq (-2 - E₁) hx ++ grw [this] ++ grind ++ grw [E₁p.ge (by linarith)] ++ have : ∫ t in Set.Ioi x, E₁p t / (t * log t^2) ≤ (log 4 + 4) / log x := calc ++ _ ≤ ∫ t in Set.Ioi x, (log 4 + 4) / (t * log t^2) := by ++ apply MeasureTheory.setIntegral_mono_on (integrable_E₁p_div_mul_log_sq hx) ++ (integrable_const_div_mul_log_sq (log 4 + 4) hx) (by measurability) ++ intro y hy; simp at hy ++ have : 1 < y := by linarith ++ have : 0 < log y := log_pos this ++ gcongr; exact E₁p.le (by linarith) ++ _ = _ := integ_div_mul_log_sq (log 4 + 4) hx ++ grw [this] ++ grind ++ ++theorem E₂p.bound : E₂p =O[atTop] (fun x ↦ 1 / log x) := by ++ simp only [one_div, isBigO_iff, norm_eq_abs, norm_inv, eventually_atTop] ++ use log 4 + 6 + E₁, 2 ++ intro x hx ++ convert E₂p.abs_le hx using 1 ++ have : 0 < log x := by apply log_pos; linarith ++ grind [abs_of_pos this] ++ ++theorem E₂p.bound' : E₂p =o[atTop] (fun _ ↦ (1:ℝ)) := E₂p.bound.trans_isLittleO inv_log_eq_o_one ++ ++theorem sum_prime_div_eq_log_log : ∃ C, ∀ x, 2 ≤ x → ++ |∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p - log (log x)| ≤ C := by ++ use |M| + (log 4 + 6 + E₁) / log 2 ++ intro x hx ++ rw [sum_prime_div_eq] ++ calc ++ _ = |M + E₂p x| := by ring_nf ++ _ ≤ |M| + (log 4 + 6 + E₁) / log x := by grw [abs_add_le, E₂p.abs_le hx] ++ _ ≤ _ := by ++ gcongr ++ have : 0 < log 4 := by apply log_pos; norm_num ++ linarith [E₁.nonneg] ++ ++theorem sum_prime_div_eq_log_log' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p - log (log x)) =O[atTop] (fun _ ↦ (1:ℝ)) := by ++ simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, ++ eventually_atTop] ++ obtain ⟨ C, hC ⟩ := sum_prime_div_eq_log_log ++ use C, 2 ++ ++theorem sum_prime_div_eq_log_log'' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p) ~[atTop] (fun x ↦ log (log x)) := by ++ apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log_log) ++ convert! sum_prime_div_eq_log_log' using 1 ++ ++lemma HasSum_log_one_sub_one_div_prime {p : ℕ} (hp : p.Prime) : ++ HasSum (fun n : ℕ ↦ (-1 : ℝ) / (( n + 1) * p ^ (n + 1))) (log (1 - 1 / p)) := by ++ convert! Real.hasSum_pow_div_log_of_abs_lt_one (x := 1 / p) _|>.neg using 1 ++ · ext ++ rw [div_pow, one_pow, div_div] ++ ring ++ · ring ++ · simp only [one_div, abs_inv, Nat.abs_cast] ++ exact inv_lt_one_of_one_lt₀ (mod_cast hp.one_lt) ++ ++lemma E₂Λ_sub_E₂p_tendsto : ++ Tendsto (E₂Λ - E₂p) atTop (nhds 0) := by ++ exact isLittleO_one_iff ℝ|>.mp <| E₂Λ.bound'.sub E₂p.bound' ++ ++noncomputable abbrev M_eq_f (n : ℕ) := ++ if ¬n.Prime then Λ n /(n * log n) else 0 ++ ++lemma E₂Λ_sub_E₂p_eq (x : ℝ) : ++ E₂Λ x - E₂p x = ∑ n ∈ Ioc 0 ⌊x⌋₊, M_eq_f n - (γ - M) := by ++ calc ++ _ = ∑ n ∈ Ioc 0 ⌊x⌋₊, Λ n / (n * log n) - ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1 : ℝ) / p - (γ - M) := by ring ++ _ = _ := by ++ rw [sum_filter, ← sum_sub_distrib] ++ congr ++ ext n ++ split_ifs with hn ++ · rw [vonMangoldt_apply_prime hn] ++ have : log n ≠ 0 := by simp; grind [hn.two_le] ++ field ++ · ring ++ ++lemma M_eq_f.sum_tendsto : ++ Tendsto (fun (x : ℝ) ↦ ∑ n ∈ Ioc 0 ⌊x⌋₊, M_eq_f n) atTop (nhds (γ - M)) := by ++ apply tendsto_sub_nhds_zero_iff.mp ++ convert E₂Λ_sub_E₂p_tendsto using 1 ++ ext ++ rw [← E₂Λ_sub_E₂p_eq] ++ simp ++ ++lemma M_eq_f.sum_tendsto' : ++ Tendsto (fun (N : ℕ) ↦ ∑ n ∈ range N, M_eq_f n) atTop (nhds (γ - M)) := by ++ have : Tendsto (fun (N : ℕ) ↦ (∑ n ∈ Ioc 0 ⌊(N : ℝ)⌋₊, M_eq_f n)) atTop (nhds (γ - M)) := M_eq_f.sum_tendsto.comp tendsto_natCast_atTop_atTop ++ simp_rw [Nat.floor_natCast] at this ++ apply (this.comp (tendsto_sub_atTop_nat 1)).congr' ++ filter_upwards [eventually_ge_atTop 1] with N hn ++ rw [Nat.range_eq_Icc_zero_sub_one, ← add_sum_Ioc_eq_sum_Icc] <;> grind ++ ++lemma M_eq_f.HasSum : ++ HasSum M_eq_f (γ - M) := by ++ refine hasSum_iff_tendsto_nat_of_nonneg (fun n ↦ ?_) _|>.mpr M_eq_f.sum_tendsto' ++ unfold M_eq_f ++ split_ifs with hn ++ · rfl ++ · exact div_nonneg vonMangoldt_nonneg (by positivity) ++ ++lemma M_eq_f.sum_primes : ++ ∑' (p : Nat.Primes), M_eq_f p = 0 := by ++ convert! tsum_zero with p ++ grind ++ ++lemma tsum_primes_eq_tsum_ite (f : ℕ → ℝ) : ++ ∑' (n : Nat.Primes), f n = ∑' (n : ℕ), if n.Prime then f n else 0 := by ++ convert! _root_.tsum_subtype Nat.Prime f using 2 ++ ext ++ simp [Set.indicator] ++ congr ++ ++lemma tsum_M_eq_f_eq_tsum : ++ -∑' (n : ℕ), M_eq_f n = ∑' p : ℕ, if p.Prime then log (1 - 1 / p) + 1 / p else 0 := by ++ rw [tsum_eq_tsum_primes_add_tsum_primes_of_support_subset_prime_powers M_eq_f.HasSum.summable ++ (fun n hn ↦ (by simp_all [vonMangoldt_ne_zero_iff])), M_eq_f.sum_primes, zero_add, ++ tsum_primes_eq_tsum_ite (fun p ↦ ∑' (k : ℕ), M_eq_f (p ^ (k + 2))), ← tsum_neg] ++ refine tsum_congr fun n ↦ ?_ ++ split_ifs with hn ++ · rw [← HasSum_log_one_sub_one_div_prime hn|>.tsum_eq, HasSum_log_one_sub_one_div_prime hn|>.summable.tsum_eq_zero_add] ++ simp only [ite_not, Nat.cast_pow, log_pow, Nat.cast_add, Nat.cast_ofNat, CharP.cast_eq_zero, ++ zero_add, pow_one, one_mul, Nat.cast_one, one_div] ++ trans -∑' (k : ℕ), (1 : ℝ) / ((k + 2) * n ^ (k + 2)) ++ · congr ++ ext k ++ have : ¬(Nat.Prime (n ^ (k + 2))) := by exact Nat.Prime.not_prime_pow (by grind) ++ simp only [this, ↓reduceIte, one_div, mul_inv_rev] ++ rw [vonMangoldt_apply_pow (by grind), vonMangoldt_apply_prime hn] ++ have : log n ≠ 0 := by simp; grind [hn.two_le] ++ field ++ · rw [← tsum_neg] ++ ring_nf ++ congr ++ ext ++ ring_nf ++ · ring ++ ++theorem M.eq : M = γ + ∑' p : ℕ, if p.Prime then log (1 - 1 / p) + 1 / p else 0 := by ++ rw [← tsum_M_eq_f_eq_tsum, M_eq_f.HasSum.tsum_eq] ++ ring ++ ++noncomputable def E₃ (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, log (1 - (1:ℝ) / p) + log (log x) + eulerMascheroniConstant ++ ++theorem prod_one_minus_div_prime_eq {x : ℝ} (hx : 1 < x) : ++ ∏ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1 - (1 : ℝ) / p) = ++ exp (-eulerMascheroniConstant) * exp (E₃ x) / log x := by ++ have hlog : 0 < log x := log_pos hx ++ have hpos : ∀ {p : ℕ}, p.Prime → (0 : ℝ) < 1 - 1 / p := fun {p} hp ↦ by ++ have : (2 : ℝ) ≤ p := mod_cast hp.two_le ++ grind [one_div_le_one_div_of_le two_pos this] ++ rw [E₃, exp_add, exp_add, exp_sum, exp_log hlog, exp_neg, ++ prod_congr rfl fun p hp ↦ exp_log (hpos (mem_filter.mp hp).2)] ++ field_simp ++ ++noncomputable abbrev M_eq_summand (p : ℕ) := if p.Prime then log (1 - 1 / p) + 1 / p else 0 ++ ++lemma M_eq_summand_bound (n : ℕ) : ++ |M_eq_summand n| ≤ 2 / n ^ 2 := by ++ unfold M_eq_summand ++ split_ifs with h ++ · trans 1 / n ^ 2 / (1 - 1 / n) ++ · convert abs_log_sub_add_sum_range_le (x := 1 / n) _ 1 using 1 ++ · rw [add_comm] ++ simp ++ · rw [abs_of_nonneg (by simp)] ++ ring ++ · simpa using inv_lt_one_of_one_lt₀ (mod_cast h.one_lt) ++ rw [(by ring : (2 : ℝ) / n ^ 2 = 1 / n ^ 2 / (1 / 2))] ++ gcongr ++ suffices (1 : ℝ) / n ≤ 1 / 2 by linarith ++ gcongr ++ exact_mod_cast h.two_le ++ · rw [abs_zero] ++ positivity ++ ++lemma M_eq_summable : Summable M_eq_summand := by ++ apply Summable.of_abs ++ exact Summable.of_nonneg_of_le (by simp) M_eq_summand_bound (Summable.const_div (by simp) _) ++ ++lemma tsum_M_eq_summand_eq : ++ ∑' (n : ℕ), M_eq_summand n = M - γ := by ++ rw [M.eq] ++ grind ++ ++lemma sum_one_div_sq_le {N : ℝ} (hN : 1 ≤ N) : ++ ∑' (n : ℕ), (1 : ℝ) / (n + N) ^ 2 ≤ 2 / N := by ++ grw [AntitoneOn.tsum_le_integral (f := (fun t ↦ 1 / (t + N) ^ 2))] ++ · have hd : ∀ x ∈ Set.Ici 0, HasDerivAt (fun t ↦ -1 / (t + N)) (1 / (x + N) ^ 2) x := by ++ intro t ht ++ convert! HasDerivAt.fun_div (d' := (1 : ℝ)) (hasDerivAt_const ..) _ _ using 1 ++ · ring ++ · simpa using hasDerivAt_id' t ++ · simp at ht ++ linarith ++ have lim : Tendsto (fun t ↦ -1 / (t + N)) atTop (nhds 0) := by ++ exact (tendsto_atTop_add_const_right atTop N tendsto_id).const_div_atTop _ ++ rw [MeasureTheory.integral_Ioi_of_hasDerivAt_of_nonneg' hd (fun _ _ ↦ (by positivity)) lim] ++ ring_nf ++ rw [mul_two] ++ gcongr ++ field_simp ++ exact hN ++ · unfold AntitoneOn ++ intro a ha b hb h ++ beta_reduce ++ simp at ha hb ++ gcongr ++ · convert! integrableOn_add_rpow_Ioi_of_lt (by norm_num : (-2 : ℝ) < -1) (by linarith : -N < 0) using 2 ++ simp ++ · exact fun _ _ ↦ (by positivity) ++ ++lemma sum_M_eq_summand_le {N : ℕ} (hN : 0 < N) : ++ |∑ n ∈ range N, M_eq_summand n - (M - γ)| ≤ 4 / N := by ++ rw [← tsum_M_eq_summand_eq, ← M_eq_summable.sum_add_tsum_nat_add N] ++ simp only [sub_add_cancel_left, abs_neg] ++ rw [← norm_eq_abs] ++ have summable := summable_nat_add_iff N|>.mpr M_eq_summable.norm ++ apply norm_tsum_le_tsum_norm summable|>.trans ++ apply Summable.tsum_le_tsum (fun _ ↦ M_eq_summand_bound _) summable _|>.trans ++ · conv => lhs; arg 1; ext; rw [← mul_one_div] ++ rw [tsum_mul_left] ++ push_cast ++ grw [sum_one_div_sq_le (mod_cast hN)] ++ ring_nf ++ rfl ++ · exact (summable_nat_add_iff N|>.mpr (summable_one_div_nat_pow.mpr one_lt_two))|>.const_div _ ++ ++lemma sum_M_eq_summand_le' {x : ℝ} (hx : 2 ≤ x) : ++ |∑ n ∈ Ioc 0 ⌊x⌋₊, M_eq_summand n - (M - γ)| ≤ 4 / x := by ++ have := sum_M_eq_summand_le (by grind : 0 < ⌊x⌋₊ + 1) ++ rw [Nat.range_eq_Icc_zero_sub_one _ (by grind), ← add_sum_Ioc_eq_sum_Icc (by grind), ++ (by simp : M_eq_summand 0 = 0), zero_add] at this ++ simp only [add_tsub_cancel_right, Nat.cast_add, Nat.cast_one] at this ++ grw [this] ++ gcongr ++ exact Nat.lt_floor_add_one _|>.le ++ ++theorem E₃.abs_le : ∃ C, ∀ x, 2 ≤ x → |E₃ x| ≤ C / log x := by ++ unfold E₃ ++ refine ⟨4 + (log 4 + 6 + E₁), fun x hx ↦ ?_⟩ ++ calc ++ _ = |(∑ n ∈ Ioc 0 ⌊x⌋₊, M_eq_summand n - (M - γ)) - E₂p x| := by ++ unfold E₂p ++ have (n : ℕ) : M_eq_summand n = (if n.Prime then log (1 - 1 / n) else 0) + (if n.Prime then (1 : ℝ) / n else 0) := by ++ unfold M_eq_summand ++ split_ifs ++ · rfl ++ · ring ++ simp_rw [this] ++ rw [sum_filter, sum_filter, sum_add_distrib, γ.eq_eulerMascheroni] ++ ring_nf ++ _ ≤ _ := by ++ grw [abs_sub, E₂p.abs_le hx, sum_M_eq_summand_le' hx] ++ have : 4 / x ≤ 4 / log x := by ++ gcongr ++ · exact log_pos (by linarith) ++ · exact log_le_self (by linarith) ++ grw [this] ++ rw [← add_div] ++ ++theorem E₃.bound : E₃ =O[atTop] (fun x ↦ 1 / log x) := by ++ simp only [isBigO_iff, norm_eq_abs, eventually_atTop] ++ obtain ⟨ C, hC ⟩ := E₃.abs_le ++ use C, 2 ++ convert hC using 3 with x hx ++ have : 0 < log x := by apply log_pos; linarith ++ have : 0 < 1 / log x := by positivity ++ grind [abs_of_pos this] ++ ++theorem E₃.bound' : E₃ =o[atTop] (fun _ ↦ (1:ℝ)) := E₃.bound.trans_isLittleO inv_log_eq_o_one ++ ++theorem E₃.bound'' : (fun x ↦ ∏ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1 - (1:ℝ) / p)) ~[atTop] (fun x ↦ exp (-eulerMascheroniConstant) / log x) := by ++ rw [isEquivalent_iff_tendsto_one] ++ · convert Tendsto.congr' ?_ (Tendsto.rexp ((isLittleO_one_iff ℝ).mp E₃.bound')) using 2 with x ++ · simp ++ simp only [Erdos970.Filter.EventuallyEq.iff_eventually, Pi.div_apply, eventually_atTop]; use 2; intro x hx ++ rw [prod_one_minus_div_prime_eq (by linarith)] ++ have : 0 < log x := by apply log_pos; linarith ++ field_simp ++ simp only [ne_eq, div_eq_zero_iff, exp_ne_zero, log_eq_zero, eventually_atTop]; use 2 ++ grind ++ ++theorem E₃.bound''' : (fun x ↦ ∏ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1 - (1:ℝ) / p) - exp (-eulerMascheroniConstant) / log x) =O[atTop] (fun x ↦ 1 / (log x)^2) := by ++ obtain ⟨c, hc⟩ := E₃.abs_le ++ rw [isBigO_iff] ++ refine ⟨exp (-eulerMascheroniConstant) * 2 * c, ?_⟩ ++ filter_upwards [eventually_ge_atTop 2, eventually_ge_atTop c.exp] with x hx hx2 ++ rw [prod_one_minus_div_prime_eq (by linarith)] ++ specialize hc x hx ++ rw [norm_eq_abs, norm_eq_abs] ++ calc ++ _ = |exp (-eulerMascheroniConstant) / log x * (exp (E₃ x) - 1)| := by ring_nf ++ _ = |exp (-eulerMascheroniConstant) / log x| * |exp (E₃ x) - 1| := by rw [abs_mul] ++ _ ≤ _ := by ++ have : |E₃ x| ≤ 1 := by ++ apply hc.trans ++ have := log_le_log (exp_pos _) hx2 ++ rw [log_exp] at this ++ apply div_le_one_iff.mpr <| Or.inl ⟨log_pos (by linarith), this⟩ ++ grw [abs_exp_sub_one_le this, hc] ++ apply le_of_eq ++ rw [abs_div, abs_div, abs_one, abs_of_nonneg (exp_nonneg _), abs_of_nonneg (log_nonneg (by linarith)), abs_of_nonneg (sq_nonneg _)] ++ ring ++ ++end Mertens ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Rectangle.lean b/PrimeNumberTheoremAnd/Erdos970/Rectangle.lean +new file mode 100644 +index 0000000..c87b920 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Rectangle.lean +@@ -0,0 +1,264 @@ ++import Mathlib.Analysis.Complex.Convex ++import Mathlib.Analysis.InnerProductSpace.Basic ++import Mathlib.Analysis.Normed.Order.Lattice ++import Mathlib.Order.Interval.Set.Monotone ++ ++namespace Erdos970 ++ ++open Complex Set Topology ++ ++open scoped Interval ++ ++variable {z w : ℂ} {c : ℝ} ++ ++namespace Rectangle ++ ++lemma symm : Rectangle z w = Rectangle w z := by ++ simp [Rectangle, uIcc_comm] ++ ++lemma symm_re : Rectangle (w.re + z.im * I) (z.re + w.im * I) = Rectangle z w := by ++ simp [Rectangle, uIcc_comm] ++ ++end Rectangle ++ ++def RectangleBorder (z w : ℂ) : Set ℂ := ++ [[z.re, w.re]] ×ℂ {z.im} ∪ {z.re} ×ℂ [[z.im, w.im]] ∪ ++ [[z.re, w.re]] ×ℂ {w.im} ∪ {w.re} ×ℂ [[z.im, w.im]] ++ ++def Square (p : ℂ) (c : ℝ) : Set ℂ := Rectangle (-c - c * I + p) (c + c * I + p) ++ ++lemma Square_apply (p : ℂ) (cpos : c > 0) : ++ Square p c = Icc (-c + p.re) (c + p.re) ×ℂ Icc (-c + p.im) (c + p.im) := by ++ rw [Square, Rectangle, uIcc_of_le (by simp; linarith), uIcc_of_le (by simp; linarith)] ++ simp ++ ++@[simp] ++theorem preimage_equivRealProdCLM_reProdIm (s t : Set ℝ) : ++ equivRealProdCLM.symm ⁻¹' (s ×ℂ t) = s ×ˢ t := ++ rfl ++ ++@[simp] ++theorem ContinuousLinearEquiv.coe_toLinearEquiv_symm {R : Type*} {S : Type*} [Semiring R] ++ [Semiring S] {σ : R →+* S} {σ' : S →+* R} [RingHomInvPair σ σ'] [RingHomInvPair σ' σ] ++ (M : Type*) [TopologicalSpace M] ++ [AddCommMonoid M] {M₂ : Type*} [TopologicalSpace M₂] [AddCommMonoid M₂] [Module R M] ++ [Module S M₂] (e : M ≃SL[σ] M₂) : ++ ⇑e.toLinearEquiv.symm = e.symm := ++ rfl ++ ++lemma segment_reProdIm_segment_eq_convexHull (z w : ℂ) : ++ [[z.re, w.re]] ×ℂ [[z.im, w.im]] = ++ convexHull ℝ {z, z.re + w.im * I, w.re + z.im * I, w} := by ++ simp_rw [← segment_eq_uIcc, ← convexHull_pair, ← convexHull_reProdIm, reProdIm] ++ exact congrArg _ <| Set.ext <| by simpa [Complex.ext_iff] using by tauto ++ ++lemma rectangle_in_convex {U : Set ℂ} (U_convex : Convex ℝ U) {z w : ℂ} (hz : z ∈ U) ++ (hw : w ∈ U) (hzw : (z.re + w.im * I) ∈ U) (hwz : (w.re + z.im * I) ∈ U) : ++ Rectangle z w ⊆ U := by ++ rw [Rectangle, segment_reProdIm_segment_eq_convexHull] ++ exact convexHull_min (by simp_all [insert_subset_iff]) U_convex ++ ++lemma mem_Rect {z w : ℂ} (zRe_lt_wRe : z.re ≤ w.re) (zIm_lt_wIm : z.im ≤ w.im) (p : ℂ) : ++ p ∈ Rectangle z w ↔ ++ z.re ≤ p.re ∧ p.re ≤ w.re ∧ z.im ≤ p.im ∧ p.im ≤ w.im := by ++ rw [Rectangle, uIcc_of_le zRe_lt_wRe, uIcc_of_le zIm_lt_wIm] ++ exact and_assoc ++ ++lemma square_neg (p : ℂ) (c : ℝ) : Square p (-c) = Square p c := by ++ simpa [Square] using! Rectangle.symm ++ ++theorem Set.left_not_mem_uIoo {a b : ℝ} : a ∉ Set.uIoo a b := ++ fun ⟨h1, h2⟩ ↦ (left_lt_sup.mp h2) (le_of_not_ge (inf_lt_left.mp h1)) ++ ++theorem Set.right_not_mem_uIoo {a b : ℝ} : b ∉ Set.uIoo a b := ++ fun ⟨h1, h2⟩ ↦ (right_lt_sup.mp h2) (le_of_not_ge (inf_lt_right.mp h1)) ++ ++theorem Set.ne_left_of_mem_uIoo {a b c : ℝ} (hc : c ∈ Set.uIoo a b) : c ≠ a := ++ fun h ↦ Set.left_not_mem_uIoo (h ▸ hc) ++ ++theorem Set.ne_right_of_mem_uIoo {a b c : ℝ} (hc : c ∈ Set.uIoo a b) : c ≠ b := ++ fun h ↦ Set.right_not_mem_uIoo (h ▸ hc) ++ ++lemma left_mem_rect (z w : ℂ) : z ∈ Rectangle z w := ⟨left_mem_uIcc, left_mem_uIcc⟩ ++ ++lemma right_mem_rect (z w : ℂ) : w ∈ Rectangle z w := ⟨right_mem_uIcc, right_mem_uIcc⟩ ++ ++lemma rect_subset_iff {z w z' w' : ℂ} : ++ Rectangle z' w' ⊆ Rectangle z w ↔ z' ∈ Rectangle z w ∧ w' ∈ Rectangle z w := by ++ use fun h ↦ ⟨h (left_mem_rect z' w'), h (right_mem_rect z' w')⟩ ++ intro ⟨⟨⟨hz're_ge, hz're_le⟩, ⟨hz'im_ge, hz'im_le⟩⟩, ++ ⟨⟨hw're_ge, hw're_le⟩, ⟨hw'im_ge, hw'im_le⟩⟩⟩ x ++ ⟨⟨hxre_ge, hxre_le⟩, ⟨hxim_ge, hxim_le⟩⟩ ++ refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ ++ · exact (le_inf hz're_ge hw're_ge).trans hxre_ge ++ · exact (le_sup_iff.mp hxre_le).casesOn (fun h ↦ h.trans hz're_le) ++ (fun h ↦ h.trans hw're_le) ++ · exact (le_inf hz'im_ge hw'im_ge).trans hxim_ge ++ · exact (le_sup_iff.mp hxim_le).casesOn (fun h ↦ h.trans hz'im_le) ++ (fun h ↦ h.trans hw'im_le) ++ ++lemma RectSubRect {x₀ x₁ x₂ x₃ y₀ y₁ y₂ y₃ : ℝ} (x₀_le_x₁ : x₀ ≤ x₁) ++ (x₁_le_x₂ : x₁ ≤ x₂) (x₂_le_x₃ : x₂ ≤ x₃) (y₀_le_y₁ : y₀ ≤ y₁) ++ (y₁_le_y₂ : y₁ ≤ y₂) (y₂_le_y₃ : y₂ ≤ y₃) : ++ Rectangle (x₁ + y₁ * I) (x₂ + y₂ * I) ⊆ ++ Rectangle (x₀ + y₀ * I) (x₃ + y₃ * I) := by ++ rw [rect_subset_iff, mem_Rect, mem_Rect] ++ refine ⟨⟨?_, ?_, ?_, ?_⟩, ?_, ?_, ?_, ?_⟩ ++ all_goals simpa using by linarith ++ ++lemma RectSubRect' {z₀ z₁ z₂ z₃ : ℂ} (x₀_le_x₁ : z₀.re ≤ z₁.re) ++ (x₁_le_x₂ : z₁.re ≤ z₂.re) (x₂_le_x₃ : z₂.re ≤ z₃.re) ++ (y₀_le_y₁ : z₀.im ≤ z₁.im) (y₁_le_y₂ : z₁.im ≤ z₂.im) ++ (y₂_le_y₃ : z₂.im ≤ z₃.im) : ++ Rectangle z₁ z₂ ⊆ Rectangle z₀ z₃ := by ++ rw [← re_add_im z₀, ← re_add_im z₁, ← re_add_im z₂, ← re_add_im z₃] ++ exact RectSubRect x₀_le_x₁ x₁_le_x₂ x₂_le_x₃ y₀_le_y₁ y₁_le_y₂ y₂_le_y₃ ++ ++lemma rectangleBorder_subset_rectangle (z w : ℂ) : RectangleBorder z w ⊆ Rectangle z w := by ++ intro x hx ++ obtain ⟨⟨h | h⟩ | h⟩ | h := hx ++ · exact ⟨h.1, h.2 ▸ left_mem_uIcc⟩ ++ · exact ⟨h.1 ▸ left_mem_uIcc, h.2⟩ ++ · exact ⟨h.1, h.2 ▸ right_mem_uIcc⟩ ++ · exact ⟨h.1 ▸ right_mem_uIcc, h.2⟩ ++ ++lemma rectangle_disjoint_singleton {z w p : ℂ} ++ (h : (p.re < z.re ∧ p.re < w.re) ∨ (p.im < z.im ∧ p.im < w.im) ∨ ++ (z.re < p.re ∧ w.re < p.re) ∨ (z.im < p.im ∧ w.im < p.im)) : ++ Disjoint (Rectangle z w) {p} := by ++ refine disjoint_singleton_right.mpr (not_and_or.mpr ?_) ++ obtain h | h | h | h := h ++ · exact Or.inl (notMem_uIcc_of_lt h.1 h.2) ++ · exact Or.inr (notMem_uIcc_of_lt h.1 h.2) ++ · exact Or.inl (notMem_uIcc_of_gt h.1 h.2) ++ · exact Or.inr (notMem_uIcc_of_gt h.1 h.2) ++ ++lemma rectangleBorder_disjoint_singleton {z w p : ℂ} ++ (h : p.re ≠ z.re ∧ p.re ≠ w.re ∧ p.im ≠ z.im ∧ p.im ≠ w.im) : ++ Disjoint (RectangleBorder z w) {p} := by ++ refine disjoint_singleton_right.mpr ?_ ++ simp_rw [RectangleBorder, Set.mem_union, not_or] ++ exact ⟨⟨⟨fun hc ↦ h.2.2.1 hc.2, fun hc ↦ h.1 hc.1⟩, fun hc ↦ h.2.2.2 hc.2⟩, ++ fun hc ↦ h.2.1 hc.1⟩ ++ ++lemma rectangle_subset_punctured_rect {z₀ z₁ z₂ z₃ p : ℂ} ++ (hz : z₀.re ≤ z₁.re ∧ z₁.re ≤ z₂.re ∧ z₂.re ≤ z₃.re ∧ ++ z₀.im ≤ z₁.im ∧ z₁.im ≤ z₂.im ∧ z₂.im ≤ z₃.im) ++ (hp : (p.re < z₁.re ∧ p.re < z₂.re) ∨ (p.im < z₁.im ∧ p.im < z₂.im) ∨ ++ (z₁.re < p.re ∧ z₂.re < p.re) ∨ (z₁.im < p.im ∧ z₂.im < p.im)) : ++ Rectangle z₁ z₂ ⊆ Rectangle z₀ z₃ \ {p} := ++ Set.subset_sdiff.mpr ⟨by apply RectSubRect' <;> tauto, rectangle_disjoint_singleton hp⟩ ++ ++lemma rectangleBorder_subset_punctured_rect {z₀ z₁ z₂ z₃ p : ℂ} ++ (hz : z₀.re ≤ z₁.re ∧ z₁.re ≤ z₂.re ∧ z₂.re ≤ z₃.re ∧ ++ z₀.im ≤ z₁.im ∧ z₁.im ≤ z₂.im ∧ z₂.im ≤ z₃.im) ++ (hp : p.re ≠ z₁.re ∧ p.re ≠ z₂.re ∧ p.im ≠ z₁.im ∧ p.im ≠ z₂.im) : ++ RectangleBorder z₁ z₂ ⊆ Rectangle z₀ z₃ \ {p} := ++ Set.subset_sdiff.mpr ⟨ ++ (rectangleBorder_subset_rectangle _ _).trans (by apply RectSubRect' <;> tauto), ++ rectangleBorder_disjoint_singleton hp⟩ ++ ++lemma rectangle_mem_nhds_iff {z w p : ℂ} : ++ Rectangle z w ∈ 𝓝 p ↔ p ∈ (Set.uIoo z.re w.re) ×ℂ (Set.uIoo z.im w.im) := by ++ simp_rw [← mem_interior_iff_mem_nhds, Rectangle, Complex.interior_reProdIm, uIoo, uIcc, ++ interior_Icc] ++ ++lemma mapsTo_rectangle_left_re (z w : ℂ) : ++ MapsTo (fun (y : ℝ) => ↑z.re + ↑y * I) [[z.im, w.im]] (Rectangle z w) := ++ fun _ hx ↦ ⟨by simp, by simp [hx]⟩ ++ ++lemma mapsTo_rectangle_right_re (z w : ℂ) : ++ MapsTo (fun (y : ℝ) => ↑w.re + ↑y * I) [[z.im, w.im]] (Rectangle z w) := ++ fun _ hx ↦ ⟨by simp, by simp [hx]⟩ ++ ++lemma mapsTo_rectangle_left_im (z w : ℂ) : ++ MapsTo (fun (x : ℝ) => ↑x + z.im * I) [[z.re, w.re]] (Rectangle z w) := ++ fun _ hx ↦ ⟨by simp [hx], by simp⟩ ++ ++lemma mapsTo_rectangle_right_im (z w : ℂ) : ++ MapsTo (fun (x : ℝ) => ↑x + w.im * I) [[z.re, w.re]] (Rectangle z w) := ++ fun _ hx ↦ ⟨by simp [hx], by simp⟩ ++ ++lemma mapsTo_rectangleBorder_left_re (z w : ℂ) : ++ MapsTo (fun (y : ℝ) => ↑z.re + ↑y * I) [[z.im, w.im]] (RectangleBorder z w) := ++ (Set.mapsTo_image _ _).mono subset_rfl fun _ ↦ ++ by simp_all [verticalSegment_eq, RectangleBorder] ++ ++lemma mapsTo_rectangleBorder_right_re (z w : ℂ) : ++ MapsTo (fun (y : ℝ) => ↑w.re + ↑y * I) [[z.im, w.im]] (RectangleBorder z w) := ++ (Set.mapsTo_image _ _).mono subset_rfl fun _ ↦ ++ by simp_all [verticalSegment_eq, RectangleBorder] ++ ++lemma mapsTo_rectangleBorder_left_im (z w : ℂ) : ++ MapsTo (fun (x : ℝ) => ↑x + z.im * I) [[z.re, w.re]] (RectangleBorder z w) := ++ (Set.mapsTo_image _ _).mono subset_rfl fun _ ↦ ++ by simp_all [horizontalSegment_eq, RectangleBorder] ++ ++lemma mapsTo_rectangleBorder_right_im (z w : ℂ) : ++ MapsTo (fun (x : ℝ) => ↑x + w.im * I) [[z.re, w.re]] (RectangleBorder z w) := ++ (Set.mapsTo_image _ _).mono subset_rfl fun _ ↦ ++ by simp_all [horizontalSegment_eq, RectangleBorder] ++ ++lemma mapsTo_rectangle_left_re_NoP (z w : ℂ) {p : ℂ} ++ (pNotOnBorder : p ∉ RectangleBorder z w) : ++ MapsTo (fun (y : ℝ) => ↑z.re + ↑y * I) [[z.im, w.im]] (Rectangle z w \ {p}) := by ++ refine (mapsTo_rectangleBorder_left_re z w).mono_right (Set.subset_sdiff.mpr ?_) ++ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ ++ ++lemma mapsTo_rectangle_right_re_NoP (z w : ℂ) {p : ℂ} ++ (pNotOnBorder : p ∉ RectangleBorder z w) : ++ MapsTo (fun (y : ℝ) => ↑w.re + ↑y * I) [[z.im, w.im]] (Rectangle z w \ {p}) := by ++ refine (mapsTo_rectangleBorder_right_re z w).mono_right (Set.subset_sdiff.mpr ?_) ++ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ ++ ++lemma mapsTo_rectangle_left_im_NoP (z w : ℂ) {p : ℂ} ++ (pNotOnBorder : p ∉ RectangleBorder z w) : ++ MapsTo (fun (x : ℝ) => ↑x + z.im * I) [[z.re, w.re]] (Rectangle z w \ {p}) := by ++ refine (mapsTo_rectangleBorder_left_im z w).mono_right (Set.subset_sdiff.mpr ?_) ++ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ ++ ++lemma mapsTo_rectangle_right_im_NoP (z w : ℂ) {p : ℂ} ++ (pNotOnBorder : p ∉ RectangleBorder z w) : ++ MapsTo (fun (x : ℝ) => ↑x + w.im * I) [[z.re, w.re]] (Rectangle z w \ {p}) := by ++ refine (mapsTo_rectangleBorder_right_im z w).mono_right (Set.subset_sdiff.mpr ?_) ++ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ ++ ++theorem not_mem_rectangleBorder_of_rectangle_mem_nhds {z w p : ℂ} ++ (hp : Rectangle z w ∈ 𝓝 p) : ++ p ∉ RectangleBorder z w := by ++ refine Set.disjoint_right.mp (rectangleBorder_disjoint_singleton ?_) rfl ++ have h1 := rectangle_mem_nhds_iff.mp hp ++ exact ⟨Set.ne_left_of_mem_uIoo h1.1, Set.ne_right_of_mem_uIoo h1.1, ++ Set.ne_left_of_mem_uIoo h1.2, Set.ne_right_of_mem_uIoo h1.2⟩ ++ ++theorem Complex.nhds_hasBasis_square (p : ℂ) : (𝓝 p).HasBasis (0 < ·) (Square p ·) := by ++ suffices ++ (𝓝 p.re ×ˢ 𝓝 p.im).HasBasis (0 < ·) ++ (equivRealProdCLM.symm.toHomeomorph ⁻¹' Square p ·) ++ by simpa only [← nhds_prod_eq, Homeomorph.map_nhds_eq, Homeomorph.image_preimage] ++ using! this.map equivRealProdCLM.symm.toHomeomorph ++ apply ((nhds_basis_Icc_pos p.re).prod_same_index_mono (nhds_basis_Icc_pos p.im) ?_ ?_).congr ++ · intro; rfl ++ · intros ++ rw [← uIcc_of_lt (by linarith), ← uIcc_of_lt (by linarith)] ++ simpa [Square, Rectangle] using by ring_nf ++ all_goals exact (antitone_const_tsub.Icc (monotone_id.const_add _)).monotoneOn _ ++ ++lemma square_mem_nhds (p : ℂ) {c : ℝ} (hc : c ≠ 0) : ++ Square p c ∈ 𝓝 p := by ++ wlog hc_pos : 0 < c generalizing c with h ++ · rw [← square_neg] ++ exact h (neg_ne_zero.mpr hc) <| neg_pos.mpr <| hc.lt_of_le <| not_lt.mp hc_pos ++ exact (Complex.nhds_hasBasis_square p).mem_of_mem hc_pos ++ ++lemma square_subset_square {p : ℂ} {c₁ c₂ : ℝ} (hc₁ : 0 < c₁) (hc : c₁ ≤ c₂) : ++ Square p c₁ ⊆ Square p c₂ := by ++ apply RectSubRect' <;> simpa using by linarith ++ ++lemma SmallSquareInRectangle {z w p : ℂ} (pInRectInterior : Rectangle z w ∈ nhds p) : ++ ∀ᶠ (c : ℝ) in 𝓝[>]0, Square p c ⊆ Rectangle z w := by ++ obtain ⟨ε, hε0, hε⟩ := ((Complex.nhds_hasBasis_square p).1 _).mp pInRectInterior ++ filter_upwards [Ioo_mem_nhdsGT (hε0)] with _ ⟨hε'0, hε'⟩ ++ exact subset_trans (square_subset_square hε'0 hε'.le) hε ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/ResidueCalcOnRectangles.lean b/PrimeNumberTheoremAnd/Erdos970/ResidueCalcOnRectangles.lean +new file mode 100644 +index 0000000..b976da3 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/ResidueCalcOnRectangles.lean +@@ -0,0 +1,1074 @@ ++import Mathlib.Analysis.Complex.CauchyIntegral ++import Mathlib.Analysis.Complex.Convex ++import Mathlib.Analysis.Complex.RemovableSingularity ++import Mathlib.Analysis.SpecialFunctions.Integrals.Basic ++import Mathlib.Analysis.Meromorphic.NormalForm ++import PrimeNumberTheoremAnd.Erdos970.Rectangle ++import PrimeNumberTheoremAnd.Erdos970.Tactic.AdditiveCombination ++ ++namespace Erdos970 ++ ++open _root_.Complex BigOperators Nat Classical Real Topology Filter ++open _root_.Set MeasureTheory intervalIntegral Asymptotics ++ ++open scoped Interval ++ ++variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {f g : ℂ → E} {z w p c A : ℂ} ++ {x x₁ x₂ y y₁ y₂ σ : ℝ} ++ ++noncomputable def HIntegral (f : ℂ → E) (x₁ x₂ y : ℝ) : E := ++ ∫ x in x₁..x₂, f (x + y * I) ++ ++noncomputable def VIntegral (f : ℂ → E) (x y₁ y₂ : ℝ) : E := ++ I • ∫ y in y₁..y₂, f (x + y * I) ++ ++noncomputable def HIntegral' (f : ℂ → E) (x₁ x₂ y : ℝ) : E := ++ (1 / (2 * π * I)) • HIntegral f x₁ x₂ y ++ ++noncomputable def VIntegral' (f : ℂ → E) (x y₁ y₂ : ℝ) : E := ++ (1 / (2 * π * I)) • VIntegral f x y₁ y₂ ++ ++lemma HIntegral_symm : ++ HIntegral f x₁ x₂ y = -HIntegral f x₂ x₁ y := integral_symm _ _ ++ ++lemma VIntegral_symm : ++ VIntegral f x y₁ y₂ = -VIntegral f x y₂ y₁ := by ++ simp_rw [VIntegral, integral_symm y₁ y₂, smul_neg, neg_neg] ++ ++noncomputable def RectangleIntegral (f : ℂ → E) (z w : ℂ) : E := ++ HIntegral f z.re w.re z.im - HIntegral f z.re w.re w.im + ++ VIntegral f w.re z.im w.im - VIntegral f z.re z.im w.im ++ ++noncomputable abbrev RectangleIntegral' (f : ℂ → E) (z w : ℂ) : E := ++ (1 / (2 * π * I)) • RectangleIntegral f z w ++ ++noncomputable def UpperUIntegral (f : ℂ → E) (σ σ' T : ℝ) : E := ++ HIntegral f σ σ' T + ++ I • (∫ y : ℝ in Ici T, f (σ' + y * I)) - ++ I • (∫ y : ℝ in Ici T, f (σ + y * I)) ++ ++noncomputable def LowerUIntegral (f : ℂ → E) (σ σ' T : ℝ) : E := ++ HIntegral f σ σ' (-T) - ++ I • (∫ y : ℝ in Iic (-T), f (σ' + y * I)) + ++ I • (∫ y : ℝ in Iic (-T), f (σ + y * I)) ++ ++noncomputable def VerticalIntegral (f : ℂ → E) (σ : ℝ) : E := ++ I • ∫ t : ℝ, f (σ + t * I) ++ ++noncomputable abbrev VerticalIntegral' (f : ℂ → E) (σ : ℝ) : E := ++ (1 / (2 * π * I)) • VerticalIntegral f σ ++ ++lemma verticalIntegral_split_three (a b : ℝ) ++ (hf : Integrable (fun t : ℝ ↦ f (σ + t * I))) : ++ VerticalIntegral f σ = ++ I • (∫ t in Iic a, f (σ + t * I)) + VIntegral f σ a b + ++ I • ∫ t in Ici b, f (σ + t * I) := by ++ simp_rw [VerticalIntegral, VIntegral, ← smul_add] ++ congr ++ rw [← integral_Iic_sub_Iic hf.restrict hf.restrict, add_sub_cancel, ++ integral_Iic_eq_integral_Iio, integral_Iio_add_Ici hf.restrict hf.restrict] ++ ++lemma DiffVertRect_eq_UpperLowerUs {σ σ' T : ℝ} ++ (f_int_σ : Integrable (fun (t : ℝ) ↦ f (σ + t * I))) ++ (f_int_σ' : Integrable (fun (t : ℝ) ↦ f (σ' + t * I))) : ++ VerticalIntegral f σ' - VerticalIntegral f σ - ++ RectangleIntegral f (σ - I * T) (σ' + I * T) = ++ UpperUIntegral f σ σ' T - LowerUIntegral f σ σ' T := by ++ rw [verticalIntegral_split_three (-T) T f_int_σ, verticalIntegral_split_three (-T) T f_int_σ'] ++ simp only [RectangleIntegral, UpperUIntegral, LowerUIntegral] ++ simp only [sub_re, mul_re, I_re, add_re, ofReal_re, I_im, ofReal_im, sub_im, mul_im, add_im] ++ ring_nf ++ abel ++ ++abbrev HolomorphicOn (f : ℂ → E) (s : Set ℂ) : Prop := ++ DifferentiableOn ℂ f s ++ ++theorem existsDifferentiableOn_of_bddAbove [CompleteSpace E] ++ {s : Set ℂ} {c : ℂ} (hc : s ∈ nhds c) ++ (hd : HolomorphicOn f (s \ {c})) ++ (hb : BddAbove (norm ∘ f '' (s \ {c}))) : ++ ∃ (g : ℂ → E), ++ HolomorphicOn g s ∧ Set.EqOn f g (s \ {c}) := ++ ⟨Function.update f c (limUnder (𝓝[{c}ᶜ] c) f), ++ differentiableOn_update_limUnder_of_bddAbove hc hd hb, ++ fun z hz ↦ if h : z = c then (hz.2 h).elim ++ else by simp [h]⟩ ++ ++theorem HolomorphicOn.vanishesOnRectangle [CompleteSpace E] ++ {U : Set ℂ} (f_holo : HolomorphicOn f U) ++ (hU : Rectangle z w ⊆ U) : ++ RectangleIntegral f z w = 0 := ++ integral_boundary_rect_eq_zero_of_differentiableOn f z w ++ (f_holo.mono hU) ++ ++theorem RectangleIntegral_congr (h : Set.EqOn f g (RectangleBorder z w)) : ++ RectangleIntegral f z w = RectangleIntegral g z w := by ++ unfold RectangleIntegral VIntegral ++ congrm ?_ - ?_ + I • ?_ - I • ?_ ++ all_goals refine integral_congr fun _ _ ↦ h ?_ ++ · exact Or.inl <| Or.inl <| Or.inl ⟨by simpa, by simp⟩ ++ · exact Or.inl <| Or.inr ⟨by simpa, by simp⟩ ++ · exact Or.inr ⟨by simp, by simpa⟩ ++ · exact Or.inl <| Or.inl <| Or.inr ⟨by simp, by simpa⟩ ++ ++theorem RectangleIntegral'_congr (h : Set.EqOn f g (RectangleBorder z w)) : ++ RectangleIntegral' f z w = RectangleIntegral' g z w := by ++ rw [RectangleIntegral', RectangleIntegral_congr h] ++ ++theorem rectangleIntegral_symm (f : ℂ → E) (z w : ℂ) : ++ RectangleIntegral f z w = RectangleIntegral f w z := by ++ simp_rw [RectangleIntegral, HIntegral, VIntegral, intervalIntegral.integral_symm w.re, ++ intervalIntegral.integral_symm w.im, sub_neg_eq_add, smul_neg, sub_neg_eq_add, ++ ← sub_eq_add_neg, neg_add_eq_sub, sub_add_eq_add_sub] ++ ++theorem rectangleIntegral_symm_re (f : ℂ → E) (z w : ℂ) : ++ RectangleIntegral f (w.re + z.im * I) (z.re + w.im * I) = -RectangleIntegral f z w := by ++ simp only [RectangleIntegral, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, ++ mul_one, sub_self, add_zero, add_im, mul_im, zero_add, neg_sub, ← sub_eq_zero, sub_zero] ++ rw [HIntegral_symm (y := z.im), HIntegral_symm (y := w.im)] ++ abel ++ ++def RectangleBorderIntegrable (f : ℂ → E) (z w : ℂ) : Prop := ++ IntervalIntegrable (fun x => f (x + z.im * I)) volume z.re w.re ∧ ++ IntervalIntegrable (fun x => f (x + w.im * I)) volume z.re w.re ∧ ++ IntervalIntegrable (fun y => f (w.re + y * I)) volume z.im w.im ∧ ++ IntervalIntegrable (fun y => f (z.re + y * I)) volume z.im w.im ++ ++theorem RectangleBorderIntegrable.add {f g : ℂ → E} ++ (hf : RectangleBorderIntegrable f z w) (hg : RectangleBorderIntegrable g z w) : ++ RectangleIntegral (f + g) z w = RectangleIntegral f z w + RectangleIntegral g z w := by ++ dsimp [RectangleIntegral, HIntegral, VIntegral] ++ have h₁ := intervalIntegral.integral_add hf.1 hg.1 ++ have h₂ := intervalIntegral.integral_add hf.2.1 hg.2.1 ++ have h₃ := intervalIntegral.integral_add hf.2.2.1 hg.2.2.1 ++ have h₄ := intervalIntegral.integral_add hf.2.2.2 hg.2.2.2 ++ rw [h₁, h₂, h₃, h₄] ++ module ++ ++omit [NormedSpace ℂ E] in ++theorem ContinuousOn.rectangleBorder_integrable (hf : ContinuousOn f (RectangleBorder z w)) : ++ RectangleBorderIntegrable f z w := ++ ⟨(hf.comp (by fun_prop) (mapsTo_rectangleBorder_left_im z w)).intervalIntegrable, ++ (hf.comp (by fun_prop) (mapsTo_rectangleBorder_right_im z w)).intervalIntegrable, ++ (hf.comp (by fun_prop) (mapsTo_rectangleBorder_right_re z w)).intervalIntegrable, ++ (hf.comp (by fun_prop) (mapsTo_rectangleBorder_left_re z w)).intervalIntegrable⟩ ++ ++omit [NormedSpace ℂ E] in ++theorem ContinuousOn.rectangleBorderIntegrable (hf : ContinuousOn f (Rectangle z w)) : ++ RectangleBorderIntegrable f z w := ++ ContinuousOn.rectangleBorder_integrable (hf.mono (rectangleBorder_subset_rectangle z w)) ++ ++omit [NormedSpace ℂ E] in ++theorem ContinuousOn.rectangleBorderNoPIntegrable ++ (hf : ContinuousOn f (Rectangle z w \ {p})) (pNotOnBorder : p ∉ RectangleBorder z w) : ++ RectangleBorderIntegrable f z w := by ++ refine ContinuousOn.rectangleBorder_integrable (hf.mono (Set.subset_sdiff.mpr ?_)) ++ exact ⟨rectangleBorder_subset_rectangle z w, disjoint_singleton_right.mpr pNotOnBorder⟩ ++ ++theorem HolomorphicOn.rectangleBorderIntegrable' ++ (hf : HolomorphicOn f (Rectangle z w \ {p})) (hp : Rectangle z w ∈ nhds p) : ++ RectangleBorderIntegrable f z w := ++ ContinuousOn.rectangleBorderNoPIntegrable hf.continuousOn ++ (not_mem_rectangleBorder_of_rectangle_mem_nhds hp) ++ ++theorem HolomorphicOn.rectangleBorderIntegrable (hf : HolomorphicOn f (Rectangle z w)) : ++ RectangleBorderIntegrable f z w := ContinuousOn.rectangleBorderIntegrable hf.continuousOn ++ ++lemma RectangleIntegralHSplit {a x₀ x₁ y₀ y₁ : ℝ} ++ (f_int_x₀_a_bot : IntervalIntegrable (fun x => f (↑x + ↑y₀ * I)) volume x₀ a) ++ (f_int_a_x₁_bot : IntervalIntegrable (fun x => f (↑x + ↑y₀ * I)) volume a x₁) ++ (f_int_x₀_a_top : IntervalIntegrable (fun x => f (↑x + ↑y₁ * I)) volume x₀ a) ++ (f_int_a_x₁_top : IntervalIntegrable (fun x => f (↑x + ↑y₁ * I)) volume a x₁) : ++ RectangleIntegral f (x₀ + y₀ * I) (x₁ + y₁ * I) = ++ RectangleIntegral f (x₀ + y₀ * I) (a + y₁ * I) + ++ RectangleIntegral f (a + y₀ * I) (x₁ + y₁ * I) := by ++ dsimp [RectangleIntegral, HIntegral, VIntegral] ++ simp only [Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, ++ Complex.I_im, mul_one, mul_zero, add_zero, zero_add, sub_self] ++ have h₁ := integral_add_adjacent_intervals f_int_x₀_a_bot f_int_a_x₁_bot ++ have h₂ := integral_add_adjacent_intervals f_int_x₀_a_top f_int_a_x₁_top ++ have h₁' : ++ (∫ (x : ℝ) in x₀..a, f (↑x + ↑y₀ * I)) + ++ ∫ (x : ℝ) in a..x₁, f (↑y₀ * I + ↑x) = ++ ∫ (x : ℝ) in x₀..x₁, f (↑x + ↑y₀ * I) := by ++ simpa [add_comm] using h₁ ++ have h₂' : ++ (∫ (x : ℝ) in x₀..a, f (↑x + ↑y₁ * I)) + ++ ∫ (x : ℝ) in a..x₁, f (↑y₁ * I + ↑x) = ++ ∫ (x : ℝ) in x₀..x₁, f (↑x + ↑y₁ * I) := by ++ simpa [add_comm] using h₂ ++ rw [← h₁', ← h₂'] ++ have hcomm₁ : ++ ∫ (x : ℝ) in a..x₁, f (↑y₀ * I + ↑x) = ++ ∫ (x : ℝ) in a..x₁, f (↑x + ↑y₀ * I) := by ++ apply intervalIntegral.integral_congr ++ intro x _ ++ exact congrArg f (by ring) ++ have hcomm₂ : ++ ∫ (x : ℝ) in a..x₁, f (↑y₁ * I + ↑x) = ++ ∫ (x : ℝ) in a..x₁, f (↑x + ↑y₁ * I) := by ++ apply intervalIntegral.integral_congr ++ intro x _ ++ exact congrArg f (by ring) ++ rw [hcomm₁, hcomm₂] ++ abel ++ ++lemma RectangleIntegralHSplit' {a x₀ x₁ y₀ y₁ : ℝ} ++ (ha : a ∈ [[x₀, x₁]]) ++ (hf : RectangleBorderIntegrable f (↑x₀ + ↑y₀ * I) (↑x₁ + ↑y₁ * I)) : ++ RectangleIntegral f (x₀ + y₀ * I) (x₁ + y₁ * I) = ++ RectangleIntegral f (x₀ + y₀ * I) (a + y₁ * I) + ++ RectangleIntegral f (a + y₀ * I) (x₁ + y₁ * I) := ++ RectangleIntegralHSplit ++ (IntervalIntegrable.mono (by simpa using hf.1) (uIcc_subset_uIcc left_mem_uIcc ha) le_rfl) ++ (IntervalIntegrable.mono (by simpa using hf.1) (uIcc_subset_uIcc ha right_mem_uIcc) le_rfl) ++ (IntervalIntegrable.mono (by simpa using hf.2.1) (uIcc_subset_uIcc left_mem_uIcc ha) le_rfl) ++ (IntervalIntegrable.mono (by simpa using hf.2.1) (uIcc_subset_uIcc ha right_mem_uIcc) le_rfl) ++ ++lemma RectangleIntegralVSplit {b x₀ x₁ y₀ y₁ : ℝ} ++ (f_int_y₀_b_left : IntervalIntegrable (fun y => f (x₀ + y * I)) volume y₀ b) ++ (f_int_b_y₁_left : IntervalIntegrable (fun y => f (x₀ + y * I)) volume b y₁) ++ (f_int_y₀_b_right : IntervalIntegrable (fun y => f (x₁ + y * I)) volume y₀ b) ++ (f_int_b_y₁_right : IntervalIntegrable (fun y => f (x₁ + y * I)) volume b y₁) : ++ RectangleIntegral f (x₀ + y₀ * I) (x₁ + y₁ * I) = ++ RectangleIntegral f (x₀ + y₀ * I) (x₁ + b * I) + ++ RectangleIntegral f (x₀ + b * I) (x₁ + y₁ * I) := by ++ dsimp [RectangleIntegral, HIntegral, VIntegral] ++ simp only [Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, ++ Complex.I_im, mul_one, mul_zero, add_zero, zero_add, sub_self] ++ have h₁ := integral_add_adjacent_intervals f_int_y₀_b_left f_int_b_y₁_left ++ have h₂ := integral_add_adjacent_intervals f_int_y₀_b_right f_int_b_y₁_right ++ rw [← h₁, ← h₂] ++ module ++ ++lemma RectangleIntegralVSplit' {b x₀ x₁ y₀ y₁ : ℝ} ++ (hb : b ∈ [[y₀, y₁]]) ++ (hf : RectangleBorderIntegrable f (↑x₀ + ↑y₀ * I) (↑x₁ + ↑y₁ * I)) : ++ RectangleIntegral f (x₀ + y₀ * I) (x₁ + y₁ * I) = ++ RectangleIntegral f (x₀ + y₀ * I) (x₁ + b * I) + ++ RectangleIntegral f (x₀ + b * I) (x₁ + y₁ * I) := ++ RectangleIntegralVSplit ++ (IntervalIntegrable.mono (by simpa using hf.2.2.2) (uIcc_subset_uIcc left_mem_uIcc hb) le_rfl) ++ (IntervalIntegrable.mono (by simpa using hf.2.2.2) (uIcc_subset_uIcc hb right_mem_uIcc) le_rfl) ++ (IntervalIntegrable.mono (by simpa using hf.2.2.1) (uIcc_subset_uIcc left_mem_uIcc hb) le_rfl) ++ (IntervalIntegrable.mono (by simpa using hf.2.2.1) (uIcc_subset_uIcc hb right_mem_uIcc) le_rfl) ++ ++lemma RectanglePullToNhdOfPole' [CompleteSpace E] {z₀ z₁ z₂ z₃ p : ℂ} ++ (h_orientation : z₀.re ≤ z₃.re ∧ z₀.im ≤ z₃.im ∧ ++ z₁.re ≤ z₂.re ∧ z₁.im ≤ z₂.im) ++ (hp : Rectangle z₁ z₂ ∈ 𝓝 p) (hz : Rectangle z₁ z₂ ⊆ Rectangle z₀ z₃) ++ (fHolo : HolomorphicOn f (Rectangle z₀ z₃ \ {p})) : ++ RectangleIntegral f z₀ z₃ = RectangleIntegral f z₁ z₂ := by ++ obtain ⟨hz₀_re, hz₀_im, hz₁_re, hz₁_im⟩ := h_orientation ++ have := rect_subset_iff.mp hz ++ rw [Rectangle, uIcc_of_le hz₀_re, uIcc_of_le hz₀_im] at this ++ obtain ⟨⟨⟨_, _⟩, ⟨_, _⟩⟩, ⟨_, _⟩, ⟨_, _⟩⟩ := this ++ obtain ⟨⟨_, _⟩, ⟨_, _⟩⟩ := ++ (uIoo_of_le hz₁_re) ▸ (uIoo_of_le hz₁_im) ▸ rectangle_mem_nhds_iff.mp hp ++ obtain ⟨_, _, _, _⟩ := show ++ p.re < z₂.re ∧ p.re < z₃.re ∧ p.im < z₂.im ∧ p.im < z₃.im from ++ ⟨by linarith, by linarith, by linarith, by linarith⟩ ++ obtain ⟨_, _, _, _⟩ := show ++ z₀.re < p.re ∧ z₁.re < p.re ∧ z₀.im < p.im ∧ z₁.im < p.im from ++ ⟨by linarith, by linarith, by linarith, by linarith⟩ ++ have fCont := fHolo.continuousOn ++ have hbot : RectangleBorderIntegrable f (↑z₀.re + ↑z₀.im * I) ++ (↑z₃.re + ↑z₃.im * I) := ?_ ++ have htop : RectangleBorderIntegrable f (↑z₀.re + ↑z₁.im * I) ++ (↑z₃.re + ↑z₃.im * I) := ?_ ++ have hleft : RectangleBorderIntegrable f (↑z₀.re + ↑z₁.im * I) ++ (↑z₃.re + ↑z₂.im * I) := ?_ ++ have hright : RectangleBorderIntegrable f (↑z₁.re + ↑z₁.im * I) ++ (↑z₃.re + ↑z₂.im * I) := ?_ ++ all_goals try { ++ refine ContinuousOn.rectangleBorder_integrable ++ (fCont.mono (rectangleBorder_subset_punctured_rect ?_ ?_)) ++ · simp_all ++ · simpa using ⟨by linarith, by linarith, by linarith, by linarith⟩ ++ } ++ have hbot' : z₁.im ∈ [[z₀.im, z₃.im]] := ?_ ++ have htop' : z₂.im ∈ [[z₁.im, z₃.im]] := ?_ ++ have hleft' : z₁.re ∈ [[z₀.re, z₃.re]] := ?_ ++ have hright' : z₂.re ∈ [[z₁.re, z₃.re]] := ?_ ++ all_goals try { ++ rw [Set.uIcc_of_le] ++ constructor ++ all_goals assumption ++ } ++ have hbot'' : Rectangle (↑z₀.re + ↑z₀.im * I) (↑z₃.re + ↑z₁.im * I) ⊆ ++ Rectangle z₀ z₃ \ {p} := ?_ ++ have htop'' : Rectangle (↑z₀.re + ↑z₂.im * I) (↑z₃.re + ↑z₃.im * I) ⊆ ++ Rectangle z₀ z₃ \ {p} := ?_ ++ have hleft'' : Rectangle (↑z₀.re + ↑z₁.im * I) (↑z₁.re + ↑z₂.im * I) ⊆ ++ Rectangle z₀ z₃ \ {p} := ?_ ++ have hright'' : Rectangle (↑z₂.re + ↑z₁.im * I) (↑z₃.re + ↑z₂.im * I) ⊆ ++ Rectangle z₀ z₃ \ {p} := ?_ ++ all_goals try { apply rectangle_subset_punctured_rect <;> simp_all } ++ have h₁ := RectangleIntegralVSplit' hbot' hbot ++ have h₂ := fHolo.vanishesOnRectangle hbot'' ++ have h₃ := RectangleIntegralVSplit' htop' htop ++ have h₄ := fHolo.vanishesOnRectangle htop'' ++ have h₅ := RectangleIntegralHSplit' hleft' hleft ++ have h₆ := fHolo.vanishesOnRectangle hleft'' ++ have h₇ := RectangleIntegralHSplit' hright' hright ++ have h₈ := fHolo.vanishesOnRectangle hright'' ++ simp only [re_add_im] at * ++ additive_combination h₁ + h₂ + h₃ + h₄ + h₅ + h₆ + h₇ + h₈ ++ ++lemma RectanglePullToNhdOfPole [CompleteSpace E] {z w p : ℂ} ++ (zRe_lt_wRe : z.re ≤ w.re) (zIm_lt_wIm : z.im ≤ w.im) ++ (hp : Rectangle z w ∈ 𝓝 p) (fHolo : HolomorphicOn f (Rectangle z w \ {p})) : ++ ∀ᶠ (c : ℝ) in 𝓝[>]0, ++ RectangleIntegral f z w = RectangleIntegral f (-c - I * c + p) (c + I * c + p) := by ++ filter_upwards [Ioo_mem_nhdsGT zero_lt_one, SmallSquareInRectangle hp] ++ intro c ⟨cpos, _⟩ hc ++ simp_rw [mul_comm I] ++ exact RectanglePullToNhdOfPole' (by simp_all [cpos.le]) ++ (square_mem_nhds p (ne_of_gt cpos)) hc fHolo ++ ++lemma RectanglePullToNhdOfPole'' [CompleteSpace E] {z w p : ℂ} ++ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) ++ (pInRectInterior : Rectangle z w ∈ 𝓝 p) (fHolo : HolomorphicOn f (Rectangle z w \ {p})) : ++ ∀ᶠ (c : ℝ) in 𝓝[>]0, ++ RectangleIntegral' f z w = RectangleIntegral' f (-c - I * c + p) (c + I * c + p) := by ++ filter_upwards [RectanglePullToNhdOfPole zRe_le_wRe zIm_le_wIm pInRectInterior fHolo] with c h ++ simp_rw [RectangleIntegral', h] ++ ++theorem ResidueTheoremAtOrigin_aux1c (a b : ℝ) : ++ let f : ℝ → ℂ := fun y => (y + I)⁻¹ ++ IntervalIntegrable f volume a b := ++ (ContinuousOn.inv₀ (by fun_prop) ++ (by simp [Complex.ext_iff])).intervalIntegrable ++ ++theorem ResidueTheoremAtOrigin_aux1c' (a b : ℝ) : ++ let f : ℝ → ℂ := fun y => (y - I)⁻¹ ++ IntervalIntegrable f volume a b := ++ (ContinuousOn.inv₀ (by fun_prop) ++ (by simp [Complex.ext_iff])).intervalIntegrable ++ ++theorem ResidueTheoremAtOrigin_aux2c (a b : ℝ) : ++ let f : ℝ → ℂ := fun y => (1 + y * I)⁻¹ ++ IntervalIntegrable f volume a b := ++ (ContinuousOn.inv₀ (by fun_prop) ++ (by simp [Complex.ext_iff])).intervalIntegrable ++ ++theorem ResidueTheoremAtOrigin_aux2c' (a b : ℝ) : ++ let f : ℝ → ℂ := fun y => (-1 + y * I)⁻¹ ++ IntervalIntegrable f volume a b := ++ (ContinuousOn.inv₀ (by fun_prop) ++ (by simp [Complex.ext_iff])).intervalIntegrable ++ ++theorem RectangleIntegral.const_smul (f : ℂ → E) (z w c : ℂ) : ++ RectangleIntegral (fun s => c • f s) z w = c • RectangleIntegral f z w := by ++ simp [RectangleIntegral, HIntegral, VIntegral, smul_add, smul_sub, smul_smul, mul_comm] ++ ++theorem RectangleIntegral.const_mul' (f : ℂ → E) (z w c : ℂ) : ++ RectangleIntegral' (fun s => c • f s) z w = c • RectangleIntegral' f z w := by ++ simp [RectangleIntegral', RectangleIntegral.const_smul, smul_smul] ++ ring_nf ++ ++theorem RectangleIntegral.translate (f : ℂ → E) (z w p : ℂ) : ++ RectangleIntegral (fun s => f (s - p)) z w = RectangleIntegral f (z - p) (w - p) := by ++ simp_rw [RectangleIntegral, HIntegral, VIntegral, sub_re, sub_im, ++ ← intervalIntegral.integral_comp_sub_right] ++ congr <;> ext <;> congr 1 <;> simp [Complex.ext_iff] ++ ++theorem RectangleIntegral.translate' (f : ℂ → E) (z w p : ℂ) : ++ RectangleIntegral' (fun s => f (s - p)) z w = RectangleIntegral' f (z - p) (w - p) := by ++ simp_rw [RectangleIntegral', RectangleIntegral.translate] ++ ++lemma Complex.inv_re_add_im : (x + y * I)⁻¹ = (x - I * y) / (x ^ 2 + y ^ 2) := by ++ rw [Complex.inv_def, div_eq_mul_inv] ++ congr <;> simp [conj_ofReal, normSq] <;> ring ++ ++lemma sq_add_sq_ne_zero (hy : y ≠ 0) : x ^ 2 + y ^ 2 ≠ 0 := by ++ linarith [sq_nonneg x, sq_pos_iff.mpr hy] ++ ++lemma continuous_self_div_sq_add_sq (hy : y ≠ 0) : ++ Continuous fun x => x / (x ^ 2 + y ^ 2) := ++ continuous_id.div (continuous_id.pow 2 |>.add continuous_const) (fun _ => sq_add_sq_ne_zero hy) ++ ++lemma integral_self_div_sq_add_sq (hy : y ≠ 0) : ++ ∫ x in x₁..x₂, x / (x ^ 2 + y ^ 2) = ++ Real.log (x₂ ^ 2 + y ^ 2) / 2 - Real.log (x₁ ^ 2 + y ^ 2) / 2 := by ++ let f (x : ℝ) : ℝ := Real.log (x ^ 2 + y ^ 2) / 2 ++ have e1 {x} := HasDerivAt.add_const (y ^ 2) (by simpa using hasDerivAt_pow 2 x) ++ have e2 {x} : HasDerivAt f (x / (x ^ 2 + y ^ 2)) x := by ++ convert! (e1.log (sq_add_sq_ne_zero hy)).div_const 2 using 1 ++ field_simp ++ have e3 : deriv f = fun x => x / (x ^ 2 + y ^ 2) := funext (fun _ => e2.deriv) ++ have e4 : Continuous (deriv f) := by simpa only [e3] using continuous_self_div_sq_add_sq hy ++ simp_rw [← e2.deriv] ++ exact integral_deriv_eq_sub (fun _ _ => e2.differentiableAt) (e4.intervalIntegrable _ _) ++ ++lemma integral_const_div_sq_add_sq (hy : y ≠ 0) : ++ ∫ x in x₁..x₂, y / (x ^ 2 + y ^ 2) = arctan (x₂ / y) - arctan (x₁ / y) := by ++ nth_rewrite 1 [← div_mul_cancel₀ x₁ hy, ← div_mul_cancel₀ x₂ hy] ++ simp_rw [← mul_integral_comp_mul_right, ← intervalIntegral.integral_const_mul, ++ ← integral_one_div_one_add_sq] ++ exact integral_congr fun x _ => by ++ field_simp ++ ring ++ ++lemma integral_const_div_self_add_im (hy : y ≠ 0) : ++ ∫ x : ℝ in x₁..x₂, A / (x + y * I) = ++ A * (Real.log (x₂ ^ 2 + y ^ 2) / 2 - Real.log (x₁ ^ 2 + y ^ 2) / 2) - ++ A * I * (arctan (x₂ / y) - arctan (x₁ / y)) := by ++ have e1 {x : ℝ} : A / (x + y * I) = A * x / (x ^ 2 + y ^ 2) - A * I * y / (x ^ 2 + y ^ 2) := by ++ ring_nf ++ simp_rw [Complex.inv_re_add_im] ++ ring ++ have e2 : IntervalIntegrable (fun x ↦ A * x / (x ^ 2 + y ^ 2)) volume x₁ x₂ := by ++ apply Continuous.intervalIntegrable ++ simp_rw [mul_div_assoc] ++ norm_cast ++ exact continuous_const.mul (continuous_ofReal.comp (continuous_self_div_sq_add_sq hy)) ++ have e3 : IntervalIntegrable (fun x ↦ A * I * y / (x ^ 2 + y ^ 2)) volume x₁ x₂ := by ++ apply Continuous.intervalIntegrable ++ refine continuous_const.div (by fun_prop) (fun x => ?_) ++ norm_cast ++ exact sq_add_sq_ne_zero hy ++ simp_rw [integral_congr (fun _ _ => e1), integral_sub e2 e3, mul_div_assoc] ++ norm_cast ++ simp_rw [intervalIntegral.integral_const_mul, intervalIntegral.integral_ofReal, ++ integral_self_div_sq_add_sq hy, integral_const_div_sq_add_sq hy] ++ ++lemma integral_const_div_re_add_self (hx : x ≠ 0) : ++ ∫ y : ℝ in y₁..y₂, A / (x + y * I) = ++ A / I * (Real.log (y₂ ^ 2 + (-x) ^ 2) / 2 - Real.log (y₁ ^ 2 + (-x) ^ 2) / 2) - ++ A / I * I * (arctan (y₂ / -x) - arctan (y₁ / -x)) := by ++ have l1 {y : ℝ} : A / (x + y * I) = A / I / (y + ↑(-x) * I) := by ++ have e1 : x + y * I ≠ 0 := by ++ contrapose! hx ++ simpa using congr_arg re hx ++ have e2 : y + I * ↑(-x) ≠ 0 := by ++ contrapose! hx ++ simpa using congr_arg im hx ++ field_simp [*] ++ push_cast ++ ring_nf ++ simp ++ have l2 : -x ≠ 0 := by rwa [neg_ne_zero] ++ simp_rw [l1, integral_const_div_self_add_im l2] ++ ++lemma ResidueTheoremAtOrigin' {z w c : ℂ} ++ (h1 : z.re < 0) (h2 : z.im < 0) (h3 : 0 < w.re) (h4 : 0 < w.im) : ++ RectangleIntegral (fun s => c / s) z w = 2 * I * π * c := by ++ simp only [RectangleIntegral, HIntegral, VIntegral, smul_eq_mul] ++ rw [integral_const_div_re_add_self h1.ne, integral_const_div_re_add_self h3.ne.symm] ++ rw [integral_const_div_self_add_im h2.ne, integral_const_div_self_add_im h4.ne.symm] ++ have l1 : z.im * w.re⁻¹ = (w.re * z.im⁻¹)⁻¹ := by group ++ have l3 := arctan_inv_of_neg <| mul_neg_of_pos_of_neg h3 <| inv_lt_zero.mpr h2 ++ have l4 : w.im * z.re⁻¹ = (z.re * w.im⁻¹)⁻¹ := by group ++ have l6 := arctan_inv_of_neg <| mul_neg_of_neg_of_pos h1 <| inv_pos.mpr h4 ++ have r1 : z.im * z.re⁻¹ = (z.re * z.im⁻¹)⁻¹ := by group ++ have r3 := arctan_inv_of_pos <| mul_pos_of_neg_of_neg h1 <| inv_lt_zero.mpr h2 ++ have r4 : w.im * w.re⁻¹ = (w.re * w.im⁻¹)⁻¹ := by group ++ have r6 := arctan_inv_of_pos <| mul_pos h3 <| inv_pos.mpr h4 ++ ring_nf ++ simp only [one_div, inv_I, mul_neg, neg_mul, I_sq, neg_neg, arctan_neg, ofReal_neg, ++ sub_neg_eq_add] ++ rw [l1, l3, l4, l6, r1, r3, r4, r6] ++ ring_nf ++ simp only [I_sq, ofReal_sub, ofReal_mul, ofReal_ofNat, ofReal_div, ofReal_neg, ofReal_one] ++ ring_nf ++ ++theorem ResidueTheoremInRectangle ++ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) ++ (pInRectInterior : Rectangle z w ∈ 𝓝 p) : ++ RectangleIntegral' (fun s => c / (s - p)) z w = c := by ++ simp only [rectangle_mem_nhds_iff, uIoo_of_le zRe_le_wRe, uIoo_of_le zIm_le_wIm, ++ mem_reProdIm, mem_Ioo] at pInRectInterior ++ rw [RectangleIntegral.translate', RectangleIntegral'] ++ have : 1 / (2 * ↑π * I) * (2 * I * ↑π * c) = c := by ++ field_simp ++ rwa [ResidueTheoremAtOrigin'] ++ all_goals simp [*] ++ ++lemma ResidueTheoremAtOrigin : ++ RectangleIntegral' (fun s ↦ 1 / s) (-1 - I) (1 + I) = 1 := by ++ rw [RectangleIntegral', ResidueTheoremAtOrigin'] ++ all_goals simp [field] ++ ++lemma ResidueTheoremOnRectangleWithSimplePole {f g : ℂ → ℂ} {z w p A : ℂ} ++ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) ++ (pInRectInterior : Rectangle z w ∈ 𝓝 p) (gHolo : HolomorphicOn g (Rectangle z w)) ++ (principalPart : Set.EqOn (f - fun s ↦ A / (s - p)) g (Rectangle z w \ {p})) : ++ RectangleIntegral' f z w = A := by ++ have principalPart' : Set.EqOn f (g + (fun s ↦ A / (s - p))) (Rectangle z w \ {p}) := ++ fun s hs => by rw [Pi.add_apply, ← principalPart hs, Pi.sub_apply, sub_add_cancel] ++ have : Set.EqOn f (g + (fun s ↦ A / (s - p))) (RectangleBorder z w) := ++ principalPart'.mono <| Set.subset_sdiff.mpr ++ ⟨rectangleBorder_subset_rectangle z w, ++ disjoint_singleton_right.mpr ++ (not_mem_rectangleBorder_of_rectangle_mem_nhds pInRectInterior)⟩ ++ rw [RectangleIntegral'_congr this] ++ have t1 : RectangleBorderIntegrable g z w := ++ gHolo.rectangleBorderIntegrable ++ have t2 : HolomorphicOn (fun s ↦ A / (s - p)) (Rectangle z w \ {p}) := by ++ apply DifferentiableOn.mono (t := {p}ᶜ) ++ · apply DifferentiableOn.div ++ · exact differentiableOn_const _ ++ · exact DifferentiableOn.sub differentiableOn_id (differentiableOn_const _) ++ · exact fun x hx => by ++ rw [sub_ne_zero] ++ exact hx ++ · rintro s ⟨_, hs⟩ ++ exact hs ++ have t3 : RectangleBorderIntegrable (fun s ↦ A / (s - p)) z w := ++ HolomorphicOn.rectangleBorderIntegrable' t2 pInRectInterior ++ rw [RectangleIntegral', RectangleBorderIntegrable.add t1 t3, smul_add] ++ rw [gHolo.vanishesOnRectangle (by rfl), smul_zero, zero_add] ++ exact ResidueTheoremInRectangle zRe_le_wRe zIm_le_wIm pInRectInterior ++ ++lemma IsBigO_to_BddAbove {f : ℂ → ℂ} {p : ℂ} ++ (f_near_p : f =O[𝓝[≠] p] (1 : ℂ → ℂ)) : ++ ∃ U ∈ 𝓝 p, BddAbove (norm ∘ f '' (U \ {p})) := by ++ simp only [isBigO_iff, Pi.one_apply, one_mem, CStarRing.norm_of_mem_unitary, mul_one] at f_near_p ++ obtain ⟨c, hc⟩ := f_near_p ++ dsimp [Filter.Eventually, nhdsWithin] at hc ++ rw [mem_inf_principal'] at hc ++ obtain ⟨U, hU, ⟨U_is_open, p_in_U⟩⟩ := mem_nhds_iff.mp hc ++ use U ++ constructor ++ · exact IsOpen.mem_nhds U_is_open p_in_U ++ · refine bddAbove_def.mpr ?_ ++ use c ++ intro y hy ++ simp only [Function.comp_apply, mem_image, Set.mem_sdiff, mem_singleton_iff] at hy ++ obtain ⟨x, ⟨x_in_U, x_not_p⟩, fxy⟩ := hy ++ rw [← fxy] ++ simpa [x_not_p] using hU x_in_U ++ ++theorem BddAbove_on_rectangle_of_bdd_near {z w p : ℂ} {f : ℂ → ℂ} ++ (f_cont : ContinuousOn f (Rectangle z w \ {p})) ++ (f_near_p : f =O[𝓝[≠] p] (1 : ℂ → ℂ)) : ++ BddAbove (norm ∘ f '' (Rectangle z w \ {p})) := by ++ obtain ⟨V, V_in_nhds, V_prop⟩ := IsBigO_to_BddAbove f_near_p ++ rw [mem_nhds_iff] at V_in_nhds ++ obtain ⟨W, W_subset, W_open, p_in_W⟩ := V_in_nhds ++ set U := Rectangle z w ++ have : U \ {p} = (U \ W) ∪ ((U ∩ W) \ {p}) := by ++ ext x ++ simp only [Set.mem_sdiff, mem_singleton_iff, mem_union, mem_inter_iff] ++ constructor ++ · intro ⟨xu, x_not_p⟩ ++ tauto ++ · intro h ++ rcases h with ⟨h1, h2⟩ | ⟨⟨h1, h2⟩, h3⟩ ++ · refine ⟨h1, ?_⟩ ++ intro h ++ rw [← h] at p_in_W ++ exact h2 p_in_W ++ · tauto ++ rw [this, image_union] ++ apply BddAbove.union ++ · apply IsCompact.bddAbove_image ++ · apply IsCompact.diff _ W_open ++ exact IsCompact.reProdIm isCompact_uIcc isCompact_uIcc ++ · apply f_cont.norm.mono ++ apply Set.sdiff_subset_sdiff_right ++ simpa ++ · exact V_prop.mono ++ (image_mono <| Set.sdiff_subset_sdiff_left <| subset_trans inter_subset_right W_subset) ++ ++theorem ResidueTheoremOnRectangleWithSimplePole' {f : ℂ → ℂ} {z w p A : ℂ} ++ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) ++ (pInRectInterior : Rectangle z w ∈ 𝓝 p) (fHolo : HolomorphicOn f (Rectangle z w \ {p})) ++ (near_p : (f - (fun s ↦ A / (s - p))) =O[𝓝[≠] p] (1 : ℂ → ℂ)) : ++ RectangleIntegral' f z w = A := by ++ set g := f - (fun s ↦ A / (s - p)) ++ have gHolo : HolomorphicOn g (Rectangle z w \ {p}) := by ++ apply DifferentiableOn.sub fHolo ++ intro s hs ++ have : s - p ≠ 0 := sub_ne_zero.mpr hs.2 ++ exact DifferentiableWithinAt.div (by fun_prop) (by fun_prop) this ++ have := BddAbove_on_rectangle_of_bdd_near gHolo.continuousOn near_p ++ obtain ⟨h, ⟨hHolo, hEq⟩⟩ := existsDifferentiableOn_of_bddAbove pInRectInterior gHolo this ++ exact ResidueTheoremOnRectangleWithSimplePole zRe_le_wRe zIm_le_wIm pInRectInterior hHolo hEq ++ ++def HasSimplePolesOn (f : ℂ → ℂ) (s : Set ℂ) : Prop := ++ ∀ z ∈ s, (-1 : ℤ) ≤ meromorphicOrderAt f z ++ ++lemma HasSimplePolesOn.mono {f : ℂ → ℂ} {s t : Set ℂ} ++ (h : HasSimplePolesOn f t) (hst : s ⊆ t) : HasSimplePolesOn f s := by ++ intro z hz ++ exact h z (hst hz) ++ ++noncomputable def residue (f : ℂ → ℂ) (z₀ : ℂ) : ℂ := ++ Filter.limUnder (nhdsWithin z₀ {z₀}ᶜ) (fun z ↦ (z - z₀) * f z) ++ ++noncomputable def sumResiduesIn (f : ℂ → ℂ) (S : Set ℂ) : ℂ := ++ ∑' z : S, residue f z ++ ++lemma residue_eq_of_tendsto {f : ℂ → ℂ} {p c : ℂ} ++ (h : Filter.Tendsto (fun z ↦ (z - p) * f z) (nhdsWithin p {p}ᶜ) (nhds c)) : ++ residue f p = c := by ++ unfold residue ++ exact h.limUnder_eq ++ ++lemma residue_analyticAt_eq_zero {f : ℂ → ℂ} {p : ℂ} (hf : AnalyticAt ℂ f p) : ++ residue f p = 0 := by ++ apply residue_eq_of_tendsto ++ have hsub : Filter.Tendsto (fun z : ℂ ↦ z - p) (nhdsWithin p {p}ᶜ) (nhds 0) := ++ tendsto_sub_nhds_zero_iff.mpr (tendsto_id.mono_left nhdsWithin_le_nhds) ++ have hf' : Filter.Tendsto f (nhdsWithin p {p}ᶜ) (nhds (f p)) := ++ hf.continuousAt.continuousWithinAt.tendsto ++ simpa using hsub.mul hf' ++ ++lemma simplePole_sub_residue_isBigO_one {f : ℂ → ℂ} {p : ℂ} ++ (hf : MeromorphicAt f p) (hord : meromorphicOrderAt f p = (-1 : ℤ)) : ++ (f - (fun z ↦ residue f p / (z - p))) =O[nhdsWithin p {p}ᶜ] (1 : ℂ → ℂ) := by ++ obtain ⟨g, hg_analytic, hg_ne, hg_eq⟩ := (meromorphicOrderAt_eq_int_iff hf).1 hord ++ have hres : residue f p = g p := ++ residue_eq_of_tendsto (hg_analytic.continuousAt.continuousWithinAt.tendsto.congr' ++ (show (fun z ↦ (z - p) * f z) =ᶠ[nhdsWithin p {p}ᶜ] g from by ++ filter_upwards [hg_eq, self_mem_nhdsWithin] with z hz hz_ne ++ simp [hz, sub_ne_zero.mpr hz_ne]).symm) ++ have hdslope : (fun z ↦ (z - p)⁻¹ * (g z - g p)) =O[nhdsWithin p {p}ᶜ] (1 : ℂ → ℂ) := by ++ have hcont : ContinuousAt (dslope g p) p := ++ continuousAt_dslope_same.2 hg_analytic.differentiableAt ++ have hbig : dslope g p =O[nhds p] (1 : ℂ → ℂ) := ++ hcont.norm.isBoundedUnder_le.isBigO_one ℂ ++ have hbig_ne : dslope g p =O[nhdsWithin p {p}ᶜ] (1 : ℂ → ℂ) := ++ IsBigO.mono hbig inf_le_left ++ simpa [slope] using! hbig_ne.congr' (dslope_eventuallyEq_slope_nhdsNE (f := g) (a := p)) .rfl ++ refine hdslope.congr' ?_ .rfl ++ filter_upwards [hg_eq, self_mem_nhdsWithin] with z hz hz_ne ++ simp [hz, hres, div_eq_mul_inv, sub_eq_add_neg]; ring ++ ++private lemma intervalIntegral_congr_ae_of_codiscreteWithin_along_path ++ {f g : ℂ → ℂ} {R : Set ℂ} ++ (heq : {s : ℂ | f s = g s} ∈ Filter.codiscreteWithin R) ++ {a b : ℝ} {p : ℝ → ℂ} ++ (hp_an : AnalyticOnNhd ℝ p (Set.uIcc a b)) ++ (hp_nonconst : ∀ x ∈ Set.uIcc a b, ¬Filter.EventuallyConst p (nhds x)) ++ (hp_maps : Set.MapsTo p (Set.uIcc a b) R) : ++ ∫ x in a..b, f (p x) = ∫ x in a..b, g (p x) := by ++ refine intervalIntegral.integral_congr_ae_restrict (μ := volume) ?_ ++ apply ae_restrict_le_codiscreteWithin measurableSet_uIoc ++ change {x : ℝ | f (p x) = g (p x)} ∈ Filter.codiscreteWithin (Set.uIoc a b) ++ simpa [Set.preimage] using Filter.codiscreteWithin_mono Set.uIoc_subset_uIcc ++ (hp_an.preimage_mem_codiscreteWithin hp_nonconst ++ (Filter.codiscreteWithin_mono ++ (by intro s hs; rcases hs with ⟨x, hx, rfl⟩; exact hp_maps hx) heq)) ++ ++private lemma meromorphicOrderAt_eq_neg_one_of_simplePole ++ {f : ℂ → ℂ} {U : Set ℂ} {p : ℂ} ++ (hpU : p ∈ U) ++ (hf_simple : HasSimplePolesOn f U) ++ (hpneg : meromorphicOrderAt f p < 0) : ++ meromorphicOrderAt f p = (-1 : ℤ) := by ++ lift meromorphicOrderAt f p to ℤ using hpneg.ne_top with n hn ++ have hsimple : (-1 : ℤ) ≤ n := WithTop.coe_le_coe.mp (hn ▸ hf_simple p hpU) ++ have hneg : n < 0 := by exact_mod_cast hpneg ++ have hn1 : n = -1 := by omega ++ simp [hn1] ++ ++private lemma residue_toMeromorphicNFOn_eq_residue ++ {f : ℂ → ℂ} {U : Set ℂ} {p : ℂ} ++ (hpU : p ∈ U) ++ (hf_mero : MeromorphicOn f U) ++ (hf_simple : HasSimplePolesOn f U) ++ (hpneg : meromorphicOrderAt f p < 0) : ++ residue (toMeromorphicNFOn f U) p = residue f p := by ++ have hmero : MeromorphicAt f p := hf_mero p hpU ++ have h_exists : ∃ c, Filter.Tendsto (fun z : ℂ ↦ (z - p) * f z) (nhdsWithin p ({p}ᶜ)) (nhds c) := by ++ have hmul_mero : MeromorphicAt (fun z : ℂ ↦ (z - p) * f z) p := ++ (by fun_prop : MeromorphicAt (fun z : ℂ ↦ z - p) p).mul hmero ++ have hmul_nonneg : 0 ≤ meromorphicOrderAt (fun z : ℂ ↦ (z - p) * f z) p := by ++ change 0 ≤ meromorphicOrderAt ((fun z ↦ z - p) * f) p ++ rw [meromorphicOrderAt_mul (by fun_prop : MeromorphicAt (fun z : ℂ ↦ z - p) p) hmero, ++ meromorphicOrderAt_id_sub_const, ++ meromorphicOrderAt_eq_neg_one_of_simplePole hpU hf_simple hpneg] ++ norm_num ++ exact tendsto_nhds_of_meromorphicOrderAt_nonneg hmul_mero hmul_nonneg ++ have h_tendsto : Filter.Tendsto (fun z : ℂ ↦ (z - p) * f z) (nhdsWithin p ({p}ᶜ)) (nhds (residue f p)) := by ++ simpa [residue] using tendsto_nhds_limUnder h_exists ++ have h_eq : ++ (fun z ↦ (z - p) * toMeromorphicNFOn f U z) =ᶠ[nhdsWithin p ({p}ᶜ)] ++ (fun z ↦ (z - p) * f z) := by ++ filter_upwards [hf_mero.toMeromorphicNFOn_eq_self_on_nhdsNE hpU] with z hz ++ simp [hz] ++ exact residue_eq_of_tendsto ++ (h_tendsto.congr' h_eq.symm) ++ ++private lemma horizontalPath_not_eventuallyConst (h : ℝ) (x : ℝ) : ++ ¬Filter.EventuallyConst (fun r : ℝ ↦ (r : ℂ) + (h : ℂ) * Complex.I) (nhds x) := by ++ intro hc ++ obtain ⟨c, hc⟩ := Filter.eventuallyConst_iff_exists_eventuallyEq.1 hc ++ have hpath : HasDerivAt (fun r : ℝ ↦ (r : ℂ) + (h : ℂ) * Complex.I) 1 x := by ++ simpa using (Complex.ofRealCLM.hasDerivAt (x := x)).add_const ((h : ℂ) * Complex.I) ++ have hconst : HasDerivAt (fun r : ℝ ↦ (r : ℂ) + (h : ℂ) * Complex.I) 0 x := ++ (hasDerivAt_const x c).congr_of_eventuallyEq hc ++ exact one_ne_zero (hpath.unique hconst) ++ ++lemma verticalPath_not_eventuallyConst (r : ℝ) (x : ℝ) : ++ ¬Filter.EventuallyConst (fun y : ℝ ↦ (r : ℂ) + (y : ℂ) * Complex.I) (nhds x) := by ++ intro hc ++ obtain ⟨c, hc⟩ := Filter.eventuallyConst_iff_exists_eventuallyEq.1 hc ++ have hpath : HasDerivAt (fun y : ℝ ↦ (r : ℂ) + (y : ℂ) * Complex.I) Complex.I x := by ++ simpa using ((Complex.ofRealCLM.hasDerivAt (x := x)).mul_const Complex.I).const_add (r : ℂ) ++ have hconst : HasDerivAt (fun y : ℝ ↦ (r : ℂ) + (y : ℂ) * Complex.I) 0 x := ++ (hasDerivAt_const x c).congr_of_eventuallyEq hc ++ exact Complex.I_ne_zero (hpath.unique hconst) ++ ++private lemma HIntegral_congr_codiscreteWithin {f g : ℂ → ℂ} {R : Set ℂ} {a b c : ℝ} ++ (h_eq : {s : ℂ | f s = g s} ∈ Filter.codiscreteWithin R) ++ (hmaps : ∀ x ∈ Set.uIcc a b, (↑x + ↑c * Complex.I) ∈ R) : ++ HIntegral f a b c = HIntegral g a b c := by ++ unfold HIntegral ++ exact intervalIntegral_congr_ae_of_codiscreteWithin_along_path h_eq ++ (by intro x _; exact (Complex.ofRealCLM.analyticAt x).add analyticAt_const) ++ (fun x _ ↦ horizontalPath_not_eventuallyConst c x) hmaps ++ ++private lemma VIntegral_congr_codiscreteWithin {f g : ℂ → ℂ} {R : Set ℂ} {c a b : ℝ} ++ (h_eq : {s : ℂ | f s = g s} ∈ Filter.codiscreteWithin R) ++ (hmaps : ∀ y ∈ Set.uIcc a b, (↑c + ↑y * Complex.I) ∈ R) : ++ VIntegral f c a b = VIntegral g c a b := by ++ unfold VIntegral; simp only [smul_eq_mul]; congr 1 ++ exact intervalIntegral_congr_ae_of_codiscreteWithin_along_path h_eq ++ (by intro y _; exact analyticAt_const.add ((Complex.ofRealCLM.analyticAt y).mul analyticAt_const)) ++ (fun x _ ↦ verticalPath_not_eventuallyConst c x) hmaps ++ ++private lemma rectangleIntegral'_toMeromorphicNFOn_eq {f : ℂ → ℂ} {z w : ℂ} ++ (f_mero : MeromorphicOn f (Rectangle z w)) : ++ RectangleIntegral' f z w = RectangleIntegral' (toMeromorphicNFOn f (Rectangle z w)) z w := by ++ classical ++ let R : Set ℂ := Rectangle z w ++ let fNF : ℂ → ℂ := toMeromorphicNFOn f R ++ have h_eq : {s : ℂ | f s = fNF s} ∈ Filter.codiscreteWithin R := by ++ simpa [Filter.EventuallyEq, Filter.Eventually, fNF] using ++ (toMeromorphicNFOn_eqOn_codiscrete (f := f) (U := R) f_mero) ++ have hbot := HIntegral_congr_codiscreteWithin h_eq (by simpa [R] using! mapsTo_rectangle_left_im z w) ++ have htop := HIntegral_congr_codiscreteWithin h_eq (by simpa [R] using! mapsTo_rectangle_right_im z w) ++ have hright := VIntegral_congr_codiscreteWithin h_eq (by simpa [R] using! mapsTo_rectangle_right_re z w) ++ have hleft := VIntegral_congr_codiscreteWithin h_eq (by simpa [R] using! mapsTo_rectangle_left_re z w) ++ unfold RectangleIntegral'; congr 1; unfold RectangleIntegral ++ rw [hbot, htop, hright, hleft] ++ ++private lemma principalPart_meromorphicOn {R : Set ℂ} {polesFin : Finset ℂ} {c : ℂ → ℂ} : ++ MeromorphicOn (fun s ↦ ∑ p ∈ polesFin, c p / (s - p)) R := by ++ intro x _ ++ refine MeromorphicAt.fun_sum (G := fun p s ↦ c p / (s - p)) ?_ ++ intro p _ ++ exact (analyticAt_const.meromorphicAt.div ++ ((analyticAt_id.sub analyticAt_const).meromorphicAt)) ++ ++private lemma sub_principalPart_analyticAt_of_not_mem_poles ++ {f : ℂ → ℂ} {polesFin : Finset ℂ} {x : ℂ} ++ (h_nf : MeromorphicNFAt f x) ++ (hxnp : x ∉ polesFin) ++ (hxneg : 0 ≤ meromorphicOrderAt f x) : ++ AnalyticAt ℂ (f - fun s ↦ ∑ p ∈ polesFin, residue f p / (s - p)) x := by ++ have h_f_analytic : AnalyticAt ℂ f x := ++ h_nf.meromorphicOrderAt_nonneg_iff_analyticAt.1 hxneg ++ have h_principal_analytic : AnalyticAt ℂ (fun s ↦ ∑ p ∈ polesFin, residue f p / (s - p)) x := by ++ refine Finset.analyticAt_fun_sum polesFin ?_ ++ intro p hp ++ have hxp : x ≠ p := by ++ intro heq ++ subst heq ++ exact hxnp hp ++ have : AnalyticAt ℂ (fun z : ℂ ↦ residue f p / (z - p)) x := by ++ fun_prop (disch := exact sub_ne_zero.mpr hxp) ++ simpa using this ++ exact h_f_analytic.sub h_principal_analytic ++ ++private lemma meromorphicOrderAt_sub_principalPart_nonneg ++ {f : ℂ → ℂ} {polesFin : Finset ℂ} {p : ℂ} ++ (hpFin : p ∈ polesFin) ++ (h_mero : MeromorphicAt f p) ++ (h_ord : meromorphicOrderAt f p = -1) : ++ 0 ≤ meromorphicOrderAt (f - fun s ↦ ∑ q ∈ polesFin, residue f q / (s - q)) p := by ++ have hcore : (f - fun z ↦ residue f p / (z - p)) =O[nhdsWithin p ({p}ᶜ)] (1 : ℂ → ℂ) := by ++ exact simplePole_sub_residue_isBigO_one h_mero h_ord ++ let rest : ℂ → ℂ := fun z ↦ ∑ q ∈ polesFin.erase p, residue f q / (z - q) ++ have hrest_cont : ContinuousAt rest p := by ++ dsimp [rest] ++ refine tendsto_finsetSum _ (fun q hq ↦ ?_) ++ have hpq : p - q ≠ 0 := sub_ne_zero.mpr (Finset.mem_erase.mp hq).1.symm ++ have h_cont : ContinuousAt (fun z : ℂ ↦ residue f q / (z - q)) p := by ++ fun_prop (disch := exact hpq) ++ exact h_cont ++ have hrest : rest =O[nhdsWithin p ({p}ᶜ)] (1 : ℂ → ℂ) := by ++ have hbig : rest =O[nhds p] (1 : ℂ → ℂ) := ++ hrest_cont.norm.isBoundedUnder_le.isBigO_one ℂ ++ exact IsBigO.mono hbig inf_le_left ++ have hraw_big : (f - fun s ↦ ∑ q ∈ polesFin, residue f q / (s - q)) =O[nhdsWithin p ({p}ᶜ)] (1 : ℂ → ℂ) := by ++ have htmp : (fun z : ℂ ↦ (f z - residue f p / (z - p)) - rest z) =O[nhdsWithin p ({p}ᶜ)] (1 : ℂ → ℂ) := ++ hcore.sub hrest ++ have hdecomp : (f - fun s ↦ ∑ q ∈ polesFin, residue f q / (s - q)) = ++ (fun z : ℂ ↦ (f z - residue f p / (z - p)) - rest z) := by ++ funext z ++ dsimp [rest] ++ rw [← Finset.add_sum_erase (s := polesFin) (f := fun q ↦ residue f q / (z - q)) hpFin] ++ simp [sub_eq_add_neg, add_assoc, add_comm] ++ simpa [hdecomp, rest] using htmp ++ by_contra hneg ++ have hnorm : Filter.Tendsto (fun z : ℂ ↦ ‖(f - fun s ↦ ∑ q ∈ polesFin, residue f q / (s - q)) z‖) (nhdsWithin p ({p}ᶜ)) Filter.atTop := by ++ rw [tendsto_norm_atTop_iff_cobounded] ++ exact tendsto_cobounded_of_meromorphicOrderAt_neg (not_le.mp hneg) ++ exact (Filter.not_isBoundedUnder_of_tendsto_atTop hnorm) hraw_big.isBoundedUnder_le ++ ++private lemma holoPart_holomorphicOn {f : ℂ → ℂ} {z w : ℂ} ++ (f_mero : MeromorphicOn f (Rectangle z w)) ++ (f_simple_poles : HasSimplePolesOn f (Rectangle z w)) ++ (f_poles_finite : (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}).Finite) : ++ HolomorphicOn (toMeromorphicNFOn (toMeromorphicNFOn f (Rectangle z w) - ++ fun s ↦ ∑ p ∈ f_poles_finite.toFinset, residue (toMeromorphicNFOn f (Rectangle z w)) p / (s - p)) (Rectangle z w)) (Rectangle z w) := by ++ classical ++ let R := Rectangle z w ++ let poles := R ∩ {u | meromorphicOrderAt f u < 0} ++ let polesFin := f_poles_finite.toFinset ++ let fNF := toMeromorphicNFOn f R ++ let principalPart := fun s ↦ ∑ p ∈ polesFin, residue fNF p / (s - p) ++ let holoPart := toMeromorphicNFOn (fNF - principalPart) R ++ have h_fNF_mero : MeromorphicOn fNF R := by ++ simpa [fNF] using ++ (meromorphicNFOn_toMeromorphicNFOn (f := f) (U := R)).meromorphicOn ++ have h_principalPart_mero : MeromorphicOn principalPart R := principalPart_meromorphicOn ++ have h_raw_mero : MeromorphicOn (fNF - principalPart) R := h_fNF_mero.sub h_principalPart_mero ++ intro x hx ++ have h_raw_nonneg : 0 ≤ meromorphicOrderAt (fNF - principalPart) x := by ++ by_cases hxp : x ∈ poles ++ · have hpFin : x ∈ polesFin := by simpa [polesFin, poles] using hxp ++ have hord : meromorphicOrderAt f x = (-1 : ℤ) := ++ meromorphicOrderAt_eq_neg_one_of_simplePole hxp.1 f_simple_poles hxp.2 ++ have hordNF : meromorphicOrderAt fNF x = (-1 : ℤ) := by ++ rw [show meromorphicOrderAt fNF x = meromorphicOrderAt f x by ++ simpa [fNF] using ++ (meromorphicOrderAt_toMeromorphicNFOn (f := f) (U := R) f_mero hxp.1)] ++ exact hord ++ exact meromorphicOrderAt_sub_principalPart_nonneg hpFin (h_fNF_mero x hxp.1) hordNF ++ · have hxnp : x ∉ polesFin := by ++ intro h ++ exact hxp (by simpa [polesFin, poles] using h) ++ have h_fNF_nonneg : 0 ≤ meromorphicOrderAt fNF x := by ++ rw [show meromorphicOrderAt fNF x = meromorphicOrderAt f x by ++ simpa [fNF] using ++ (meromorphicOrderAt_toMeromorphicNFOn (f := f) (U := R) f_mero hx)] ++ exact le_of_not_gt fun hxneg => hxp ⟨hx, hxneg⟩ ++ have h_fNF_nf : MeromorphicNFAt fNF x := by ++ simpa [fNF] using ++ (meromorphicNFOn_toMeromorphicNFOn (f := f) (U := R) hx) ++ exact (sub_principalPart_analyticAt_of_not_mem_poles h_fNF_nf hxnp h_fNF_nonneg).meromorphicOrderAt_nonneg ++ have h_nf : MeromorphicNFAt holoPart x := by ++ simpa [holoPart] using ++ (meromorphicNFOn_toMeromorphicNFOn (f := fNF - principalPart) (U := R) hx) ++ have h_ord : ++ meromorphicOrderAt holoPart x = meromorphicOrderAt (fNF - principalPart) x := by ++ simpa [holoPart] using ++ (meromorphicOrderAt_toMeromorphicNFOn (f := fNF - principalPart) (U := R) h_raw_mero hx) ++ exact (h_nf.meromorphicOrderAt_nonneg_iff_analyticAt.1 (h_ord.symm ▸ h_raw_nonneg)).differentiableAt.differentiableWithinAt ++ ++private lemma principalPart_borderIntegrable {f : ℂ → ℂ} {z w : ℂ} ++ (f_no_poles_boundary : Disjoint (RectangleBorder z w) {z | meromorphicOrderAt f z < 0}) ++ (f_poles_finite : (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}).Finite) : ++ RectangleBorderIntegrable (fun s ↦ ∑ p ∈ f_poles_finite.toFinset, residue (toMeromorphicNFOn f (Rectangle z w)) p / (s - p)) z w := by ++ classical ++ let R := Rectangle z w ++ let poles := R ∩ {u | meromorphicOrderAt f u < 0} ++ let polesFin := f_poles_finite.toFinset ++ let fNF := toMeromorphicNFOn f R ++ let principalPart := fun s ↦ ∑ p ∈ polesFin, residue fNF p / (s - p) ++ refine ContinuousOn.rectangleBorder_integrable ?_ ++ refine continuousOn_finsetSum _ ?_ ++ intro p hp s hs ++ have hsp : s ≠ p := fun hsp => Set.disjoint_right.mp f_no_poles_boundary ++ ((by simpa [polesFin, poles] using hp : p ∈ poles).2) (hsp ▸ hs) ++ have : ContinuousAt (fun z : ℂ ↦ residue fNF p / (z - p)) s := by ++ fun_prop (disch := exact sub_ne_zero.mpr hsp) ++ exact this.continuousWithinAt ++ ++private lemma rectangle_mem_nhds_of_interior {z w p : ℂ} ++ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) ++ (hpR : p ∈ Rectangle z w) (hpnot : p ∉ RectangleBorder z w) : ++ Rectangle z w ∈ nhds p := by ++ rw [mem_Rect zRe_le_wRe zIm_le_wIm] at hpR ++ have hp_re_left : z.re < p.re := ++ lt_of_le_of_ne hpR.1 fun hEq => hpnot ++ (by simp [RectangleBorder, hEq, hpR.2.2.1, hpR.2.2.2, zIm_le_wIm, mem_reProdIm]) ++ have hp_re_right : p.re < w.re := ++ lt_of_le_of_ne hpR.2.1 fun hEq => hpnot ++ (by simp [RectangleBorder, hEq, hpR.2.2.1, hpR.2.2.2, zIm_le_wIm, mem_reProdIm]) ++ have hp_im_left : z.im < p.im := ++ lt_of_le_of_ne hpR.2.2.1 fun hEq => hpnot ++ (by simp [RectangleBorder, hEq, hpR.1, hpR.2.1, zRe_le_wRe, mem_reProdIm]) ++ have hp_im_right : p.im < w.im := ++ lt_of_le_of_ne hpR.2.2.2 fun hEq => hpnot ++ (by simp [RectangleBorder, hEq, hpR.1, hpR.2.1, zRe_le_wRe, mem_reProdIm]) ++ rw [rectangle_mem_nhds_iff, mem_reProdIm, Set.uIoo_of_le zRe_le_wRe, Set.uIoo_of_le zIm_le_wIm] ++ exact ⟨⟨hp_re_left, hp_re_right⟩, ⟨hp_im_left, hp_im_right⟩⟩ ++ ++private lemma sum_div_rectangleBorderIntegrable {z w : ℂ} {S : Finset ℂ} ++ (hS_disjoint : Disjoint (RectangleBorder z w) S) (c : ℂ → ℂ) : ++ RectangleBorderIntegrable (fun s ↦ ∑ p ∈ S, c p / (s - p)) z w := by ++ refine ContinuousOn.rectangleBorder_integrable ?_ ++ refine continuousOn_finsetSum _ ?_ ++ intro p hp s hs ++ have hsp : s ≠ p := fun hsp => Set.disjoint_right.mp hS_disjoint hp (hsp ▸ hs) ++ have : ContinuousAt (fun z : ℂ ↦ c p / (z - p)) s := by ++ fun_prop (disch := exact sub_ne_zero.mpr hsp) ++ exact this.continuousWithinAt ++ ++private lemma rectangleIntegral'_sum_div_sub {z w : ℂ} (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) ++ {S : Finset ℂ} (hS_subset : (S : Set ℂ) ⊆ Rectangle z w) ++ (hS_disjoint : Disjoint (RectangleBorder z w) S) ++ (c : ℂ → ℂ) : ++ RectangleIntegral' (fun s ↦ ∑ p ∈ S, c p / (s - p)) z w = ∑ p ∈ S, c p := by ++ classical ++ have h_partial_border : ∀ (S' : Finset ℂ), S' ⊆ S → RectangleBorderIntegrable (fun s ↦ ∑ p ∈ S', c p / (s - p)) z w := by ++ intro S' hS' ++ exact sum_div_rectangleBorderIntegrable (Disjoint.mono_right hS' hS_disjoint) c ++ have h_term_integral : ∀ {p : ℂ}, p ∈ S → RectangleIntegral' (fun s ↦ c p / (s - p)) z w = c p := ++ fun {p} hp => ResidueTheoremInRectangle zRe_le_wRe zIm_le_wIm ++ (rectangle_mem_nhds_of_interior zRe_le_wRe zIm_le_wIm ++ (hS_subset hp) (Set.disjoint_right.mp hS_disjoint hp)) ++ have h_partial_integral : ++ ∀ (S' : Finset ℂ), S' ⊆ S → ++ RectangleIntegral' (fun s ↦ ∑ p ∈ S', c p / (s - p)) z w = ++ ∑ p ∈ S', c p := by ++ intro S' hS' ++ revert hS' ++ refine Finset.induction_on S' ?_ ?_ ++ · intro _ ++ simp [RectangleIntegral', RectangleIntegral, HIntegral, VIntegral] ++ · intro a S' ha ih hS' ++ obtain ⟨haFin, hSsub⟩ := Finset.insert_subset_iff.mp hS' ++ have hterm_border : ++ RectangleBorderIntegrable (fun s ↦ c a / (s - a)) z w := ++ by simpa using h_partial_border ({a} : Finset ℂ) (Finset.singleton_subset_iff.mpr haFin) ++ have hfun : ++ (fun s ↦ ∑ p ∈ insert a S', c p / (s - p)) = ++ (fun s ↦ c a / (s - a)) + ++ (fun s ↦ ∑ p ∈ S', c p / (s - p)) := by ++ funext s; simp [Finset.sum_insert, ha] ++ have h_add_primed : ++ RectangleIntegral' ((fun s ↦ c a / (s - a)) + (fun s ↦ ∑ p ∈ S', c p / (s - p))) z w = ++ RectangleIntegral' (fun s ↦ c a / (s - a)) z w + ++ RectangleIntegral' (fun s ↦ ∑ p ∈ S', c p / (s - p)) z w := by ++ unfold RectangleIntegral' ++ rw [RectangleBorderIntegrable.add hterm_border (h_partial_border S' hSsub), smul_add] ++ rw [hfun, h_add_primed, h_term_integral haFin, ih hSsub, Finset.sum_insert ha] ++ exact h_partial_integral S (by intro p hp; exact hp) ++ ++private lemma toMeromorphicNFOn_add_integral {f : ℂ → ℂ} {z w : ℂ} ++ (f_mero : MeromorphicOn f (Rectangle z w)) ++ (f_no_poles_boundary : Disjoint (RectangleBorder z w) {z | meromorphicOrderAt f z < 0}) ++ (f_poles_finite : (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}).Finite) ++ (f_simple_poles : HasSimplePolesOn f (Rectangle z w)) : ++ RectangleIntegral' (toMeromorphicNFOn f (Rectangle z w)) z w = ++ RectangleIntegral' (toMeromorphicNFOn (toMeromorphicNFOn f (Rectangle z w) - ++ fun s ↦ ∑ p ∈ f_poles_finite.toFinset, residue (toMeromorphicNFOn f (Rectangle z w)) p / (s - p)) (Rectangle z w)) z w + ++ RectangleIntegral' (fun s ↦ ∑ p ∈ f_poles_finite.toFinset, residue (toMeromorphicNFOn f (Rectangle z w)) p / (s - p)) z w := by ++ let R : Set ℂ := Rectangle z w ++ let poles : Set ℂ := R ∩ {u | meromorphicOrderAt f u < 0} ++ let polesFin : Finset ℂ := f_poles_finite.toFinset ++ let fNF : ℂ → ℂ := toMeromorphicNFOn f R ++ let principalPart : ℂ → ℂ := fun s ↦ ∑ p ∈ polesFin, residue fNF p / (s - p) ++ let holoPart : ℂ → ℂ := toMeromorphicNFOn (fNF - principalPart) R ++ have h_holoPart_border : RectangleBorderIntegrable holoPart z w := ++ (holoPart_holomorphicOn f_mero f_simple_poles f_poles_finite).rectangleBorderIntegrable ++ have h_fNF_eq : ++ Set.EqOn fNF (holoPart + principalPart) (RectangleBorder z w) := by ++ intro s hs ++ have hsR : s ∈ R := rectangleBorder_subset_rectangle z w hs ++ have hsnp : s ∉ poles := fun hsp => Set.disjoint_right.mp f_no_poles_boundary hsp.2 hs ++ have hraw_analytic : AnalyticAt ℂ (fNF - principalPart) s := by ++ have h_fNF_nonneg : 0 ≤ meromorphicOrderAt fNF s := by ++ rw [show meromorphicOrderAt fNF s = meromorphicOrderAt f s by ++ simpa [fNF] using ++ (meromorphicOrderAt_toMeromorphicNFOn (f := f) (U := R) f_mero hsR)] ++ exact le_of_not_gt fun hsneg => hsnp ⟨hsR, hsneg⟩ ++ exact sub_principalPart_analyticAt_of_not_mem_poles ++ (by simpa [fNF] using meromorphicNFOn_toMeromorphicNFOn (f := f) (U := R) hsR) ++ (fun h => hsnp (by simpa [polesFin, poles] using h)) ++ h_fNF_nonneg ++ have hs_eq : holoPart s = (fNF - principalPart) s := by ++ rw [show holoPart = toMeromorphicNFOn (fNF - principalPart) R by rfl] ++ have h_fNF_mero : MeromorphicOn fNF R := by ++ simpa [fNF] using (meromorphicNFOn_toMeromorphicNFOn (f := f) (U := R)).meromorphicOn ++ have hf_sub_mero : MeromorphicOn (fNF - principalPart) R := ++ h_fNF_mero.sub principalPart_meromorphicOn ++ rw [toMeromorphicNFOn_eq_toMeromorphicNFAt (f := fNF - principalPart) (U := R) hf_sub_mero hsR] ++ exact congr_fun (toMeromorphicNFAt_eq_self.2 hraw_analytic.meromorphicNFAt) s ++ calc ++ fNF s = (fNF - principalPart) s + principalPart s := by simp ++ _ = holoPart s + principalPart s := by rw [← hs_eq] ++ rw [RectangleIntegral'_congr h_fNF_eq, RectangleIntegral', ++ RectangleBorderIntegrable.add h_holoPart_border ++ (principalPart_borderIntegrable f_no_poles_boundary f_poles_finite), smul_add] ++ ++lemma RectangleIntegral'_eq_sumResiduesIn {f : ℂ → ℂ} {z w : ℂ} ++ (zRe_le_wRe : z.re ≤ w.re) (zIm_le_wIm : z.im ≤ w.im) ++ (f_mero : MeromorphicOn f (Rectangle z w)) ++ (f_no_poles_boundary : Disjoint (RectangleBorder z w) {z | meromorphicOrderAt f z < 0}) ++ (f_poles_finite : (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}).Finite) ++ (f_simple_poles : HasSimplePolesOn f (Rectangle z w)) : ++ RectangleIntegral' f z w = sumResiduesIn f (Rectangle z w ∩ {z | meromorphicOrderAt f z < 0}) := by ++ let R : Set ℂ := Rectangle z w ++ let poles : Set ℂ := R ∩ {u | meromorphicOrderAt f u < 0} ++ let polesFin : Finset ℂ := f_poles_finite.toFinset ++ let fNF : ℂ → ℂ := toMeromorphicNFOn f R ++ let principalPart : ℂ → ℂ := fun s ↦ ∑ p ∈ polesFin, residue fNF p / (s - p) ++ let holoPart : ℂ → ℂ := toMeromorphicNFOn (fNF - principalPart) R ++ have h_residue_congr : sumResiduesIn f poles = sumResiduesIn fNF poles := by ++ rw [sumResiduesIn, sumResiduesIn] ++ apply tsum_congr ++ intro p ++ exact (residue_toMeromorphicNFOn_eq_residue p.2.1 f_mero f_simple_poles p.2.2).symm ++ have h_principalPart_integral : RectangleIntegral' principalPart z w = sumResiduesIn fNF poles := by ++ have h_sum : RectangleIntegral' principalPart z w = ∑ p ∈ polesFin, residue fNF p := by ++ apply rectangleIntegral'_sum_div_sub zRe_le_wRe zIm_le_wIm ++ · intro p hp ++ dsimp [polesFin, poles, R] at hp ++ simp only [Finset.mem_coe, Set.Finite.mem_toFinset] at hp ++ exact hp.1 ++ · exact Disjoint.mono_right (by rw [f_poles_finite.coe_toFinset]; exact Set.inter_subset_right) f_no_poles_boundary ++ rw [h_sum] ++ have h_eq_poles : poles = ↑polesFin := by ++ dsimp [poles, polesFin, R] ++ exact f_poles_finite.coe_toFinset.symm ++ rw [sumResiduesIn, h_eq_poles, ++ tsum_fintype (f := fun p : (polesFin : Set ℂ) => residue fNF p), ++ ← Finset.sum_coe_sort polesFin]; rfl ++ calc ++ RectangleIntegral' f z w = RectangleIntegral' fNF z w := rectangleIntegral'_toMeromorphicNFOn_eq f_mero ++ _ = RectangleIntegral' holoPart z w + RectangleIntegral' principalPart z w := ++ toMeromorphicNFOn_add_integral f_mero f_no_poles_boundary f_poles_finite f_simple_poles ++ _ = 0 + sumResiduesIn fNF poles := by ++ rw [h_principalPart_integral] ++ rw [RectangleIntegral', ++ (holoPart_holomorphicOn f_mero f_simple_poles f_poles_finite).vanishesOnRectangle subset_rfl] ++ simp ++ _ = sumResiduesIn fNF poles := by simp ++ _ = sumResiduesIn f poles := h_residue_congr.symm ++ ++lemma residue_eq_zero_of_not_pole_of_meromorphicAt {F : ℂ → ℂ} {s : ℂ} ++ (hs_mero : MeromorphicAt F s) (hs_not_pole : 0 ≤ meromorphicOrderAt F s) : ++ residue F s = 0 := by ++ apply residue_eq_of_tendsto ++ obtain ⟨c, hc⟩ := tendsto_nhds_of_meromorphicOrderAt_nonneg hs_mero hs_not_pole ++ have hsub : Filter.Tendsto (fun z : ℂ ↦ z - s) (nhdsWithin s {s}ᶜ) (nhds 0) := ++ tendsto_sub_nhds_zero_iff.mpr (tendsto_id.mono_left nhdsWithin_le_nhds) ++ simpa using hsub.mul hc ++ ++lemma sumResiduesIn_inter_eq_of_set_eq {F : ℂ → ℂ} {Rn S2 P : Set ℂ} ++ (h_set_eq : Rn ∩ P = S2 ∩ P) ++ (h_residue_zero : ∀ s ∈ S2, s ∉ P → residue F s = 0) : ++ sumResiduesIn F (Rn ∩ P) = sumResiduesIn F S2 := by ++ rw [sumResiduesIn, sumResiduesIn, tsum_subtype, tsum_subtype] ++ apply tsum_congr ++ intro s ++ by_cases hs_S2 : s ∈ S2 ++ · by_cases hs_pole : s ∈ P ++ · have hs_rect_pole : s ∈ Rn ∩ P := h_set_eq.symm ▸ ⟨hs_S2, hs_pole⟩ ++ simp [hs_S2, hs_rect_pole] ++ · have hs_not_rect_pole : s ∉ Rn ∩ P := fun hs => hs_pole hs.2 ++ have hres0 : residue F s = 0 := h_residue_zero s hs_S2 hs_pole ++ simp [hs_S2, hs_not_rect_pole, hres0] ++ · have hs_not_rect_pole : s ∉ Rn ∩ P := fun hs => hs_S2 (h_set_eq ▸ hs).1 ++ simp [hs_S2, hs_not_rect_pole] ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/SmoothExistence.lean b/PrimeNumberTheoremAnd/Erdos970/SmoothExistence.lean +new file mode 100644 +index 0000000..74e2172 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/SmoothExistence.lean +@@ -0,0 +1,94 @@ ++import Batteries.Tactic.Lemma ++import Mathlib.Geometry.Manifold.PartitionOfUnity ++import Mathlib.Tactic.Bound ++import PrimeNumberTheoremAnd.Erdos970.Mathlib.Algebra.Notation.Support ++ ++namespace Erdos970 ++ ++ ++open MeasureTheory Set Real ++open scoped ContDiff ++ ++lemma smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : ++ ∃ Ψ : ℝ → ℝ, (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ ++ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 ∧ ++ (Function.support Ψ = Set.Ioo a d) := by ++ have := exists_contMDiff_zero_iff_one_iff_of_isClosed (n := ⊤) ++ (modelWithCornersSelf ℝ ℝ) (s := Set.Iic a ∪ Set.Ici d) (t := Set.Icc b c) ++ (IsClosed.union isClosed_Iic isClosed_Ici) isClosed_Icc ++ (by ++ simp_rw [Set.disjoint_union_left, Set.disjoint_iff, Set.subset_def, ++ Set.mem_inter_iff, Set.mem_Iic, Set.mem_Icc, Set.mem_empty_iff_false, ++ and_imp, imp_false, not_le, Set.mem_Ici] ++ constructor <;> intros <;> linarith) ++ obtain ⟨Ψ, hΨSmooth, hΨrange, hΨ0, hΨ1⟩ := this ++ simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, Set.mem_Icc] at * ++ use Ψ ++ simp only [range_subset_iff, mem_Icc] at hΨrange ++ refine ⟨ContMDiff.contDiff hΨSmooth, ?_, ?_, ?_, ?_⟩ ++ · apply HasCompactSupport.of_support_subset_isCompact (K := Set.Icc a d) isCompact_Icc ++ simp only [Function.support_subset_iff, ne_eq, mem_Icc, ← hΨ0, not_or] ++ bound ++ · apply Set.indicator_le' ++ · intro x hx ++ rw [hΨ1 x |>.mp, Pi.one_apply] ++ simpa using hx ++ · exact fun x _ ↦ (hΨrange x).1 ++ · intro x ++ apply Set.le_indicator_apply ++ · exact fun _ ↦ (hΨrange x).2 ++ · intro hx ++ rw [← hΨ0 x |>.mp] ++ simpa [-not_and, mem_Ioo, not_and_or, not_lt] using hx ++ · ext x ++ simp only [Function.mem_support, ne_eq, mem_Ioo, ← hΨ0, not_or, not_le] ++ ++lemma SmoothExistence : ++ ∃ (ν : ℝ → ℝ), (ContDiff ℝ ∞ ν) ∧ (∀ x, 0 ≤ ν x) ∧ ++ ν.support ⊆ Icc (1 / 2) 2 ∧ ∫ x in Ici 0, ν x / x = 1 := by ++ suffices h : ∃ (ν : ℝ → ℝ), (ContDiff ℝ ∞ ν) ∧ (∀ x, 0 ≤ ν x) ∧ ++ ν.support ⊆ Set.Icc (1 / 2) 2 ∧ 0 < ∫ x in Set.Ici 0, ν x / x by ++ obtain ⟨ν, hν, hνnonneg, hνsupp, hνpos⟩ := h ++ let c := (∫ x in Ici 0, ν x / x) ++ use fun y ↦ ν y / c ++ refine ⟨hν.div_const c, fun y ↦ div_nonneg (hνnonneg y) (le_of_lt hνpos), ?_, ?_⟩ ++ · rw [Function.support_div, Function.support_const (ne_of_lt hνpos).symm, inter_univ] ++ convert hνsupp ++ · simp only [div_right_comm _ c _, integral_div c, div_self <| ne_of_gt hνpos, c] ++ have := smooth_urysohn_support_Ioo (a := 1 / 2) (b := 1) (c := 3 / 2) (d := 2) ++ (by linarith) (by linarith) ++ obtain ⟨ν, hνContDiff, _, hν0, hν1, hνSupport⟩ := this ++ use ν, hνContDiff ++ unfold indicator at hν0 hν1 ++ simp only [mem_Icc, Pi.one_apply, Pi.le_def, mem_Ioo] at hν0 hν1 ++ simp only [hνSupport, subset_def, mem_Ioo, mem_Icc, and_imp] ++ split_ands ++ · exact fun x ↦ le_trans (by simp [apply_ite]) (hν0 x) ++ · exact fun y hy hy' ↦ ⟨by linarith, by linarith⟩ ++ · rw [integral_pos_iff_support_of_nonneg] ++ · simp only [Function.support_div, measurableSet_Ici, Measure.restrict_apply', ++ hνSupport, Function.support_id'] ++ have : (Ioo (1 / 2 : ℝ) 2 ∩ {0}ᶜ ∩ Ici 0) = Ioo (1 / 2) 2 := by ++ ext x ++ simp only [one_div, mem_inter_iff, mem_Ioo, mem_compl_iff, mem_singleton_iff, mem_Ici] ++ bound ++ simp only [this, volume_Ioo, ENNReal.ofReal_pos, sub_pos, gt_iff_lt] ++ linarith ++ · simp_rw [Pi.le_def, Pi.zero_apply] ++ intro y ++ by_cases h : y ∈ Function.support ν ++ · apply div_nonneg <| le_trans (by simp [apply_ite]) (hν0 y) ++ rw [hνSupport, mem_Ioo] at h ++ linarith [h.left] ++ · simp only [Function.mem_support, ne_eq, not_not] at h ++ simp [h] ++ · have : (fun x ↦ ν x / x).support ⊆ Icc (1 / 2) 2 := by ++ rw [Function.support_div, hνSupport] ++ exact (inter_subset_left).trans Ioo_subset_Icc_self ++ apply (integrableOn_iff_integrable_of_support_subset this).mp ++ apply ContinuousOn.integrableOn_compact isCompact_Icc ++ apply hνContDiff.continuous.continuousOn.div continuousOn_id ?_ ++ simp only [mem_Icc, ne_eq, and_imp, id_eq] ++ intros; linarith ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Sobolev.lean b/PrimeNumberTheoremAnd/Erdos970/Sobolev.lean +new file mode 100644 +index 0000000..3e83353 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Sobolev.lean +@@ -0,0 +1,360 @@ ++import Mathlib.Analysis.Calculus.Deriv.Support ++import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv ++import Mathlib.Order.Filter.ZeroAndBoundedAtFilter ++ ++namespace Erdos970 ++ ++open Real Complex MeasureTheory Filter Topology BoundedContinuousFunction SchwartzMap BigOperators ++open scoped ContDiff ++ ++variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {n : ℕ} ++ ++@[ext] structure CS (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where ++ toFun : ℝ → E ++ h1 : ContDiff ℝ n toFun ++ h2 : HasCompactSupport toFun ++ ++structure trunc extends (CS 2 ℝ) where ++ h3 : (Set.Icc (-1) (1)).indicator 1 ≤ toFun ++ h4 : toFun ≤ Set.indicator (Set.Ioo (-2) (2)) 1 ++ ++structure W1 (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where ++ toFun : ℝ → E ++ smooth : ContDiff ℝ n toFun ++ integrable : ∀ ⦃k⦄, k ≤ n → Integrable (iteratedDeriv k toFun) ++ ++abbrev W21 := W1 2 ℂ ++ ++section lemmas ++ ++noncomputable def funscale {E : Type*} (g : ℝ → E) (R x : ℝ) : E := g (R⁻¹ • x) ++ ++lemma contDiff_ofReal : ContDiff ℝ ∞ ofReal := by ++ have key x : HasDerivAt ofReal 1 x := hasDerivAt_id x |>.ofReal_comp ++ have key' : deriv ofReal = fun _ => 1 := by ext x ; exact (key x).deriv ++ refine contDiff_infty_iff_deriv.mpr ⟨fun x => (key x).differentiableAt, ?_⟩ ++ simpa [key'] using contDiff_const ++ ++omit [NormedSpace ℝ E] in ++lemma tendsto_funscale {f : ℝ → E} (hf : ContinuousAt f 0) (x : ℝ) : ++ Tendsto (fun R => funscale f R x) atTop (𝓝 (f 0)) := ++ hf.tendsto.comp (by simpa using tendsto_inv_atTop_zero.mul_const x) ++ ++end lemmas ++ ++namespace CS ++ ++variable {f : CS n E} {R x v : ℝ} ++ ++instance : CoeFun (CS n E) (fun _ => ℝ → E) where coe := CS.toFun ++ ++instance : Coe (CS n ℝ) (CS n ℂ) where coe f := ⟨fun x => f x, ++ contDiff_ofReal.of_le (mod_cast le_top) |>.comp f.h1, f.h2.comp_left (g := ofReal) rfl⟩ ++ ++def neg (f : CS n E) : CS n E where ++ toFun := -f ++ h1 := f.h1.neg ++ h2 := by simpa [HasCompactSupport, tsupport] using f.h2 ++ ++instance : Neg (CS n E) where neg := neg ++ ++@[simp] lemma neg_apply {x : ℝ} : (-f) x = - (f x) := rfl ++ ++def smul (R : ℝ) (f : CS n E) : CS n E := ⟨R • f, f.h1.const_smul R, f.h2.smul_left⟩ ++ ++instance : HSMul ℝ (CS n E) (CS n E) where hSMul := smul ++ ++@[simp] lemma smul_apply : (R • f) x = R • f x := rfl ++ ++lemma continuous (f : CS n E) : Continuous f := f.h1.continuous ++ ++noncomputable def deriv (f : CS (n + 1) E) : CS n E where ++ toFun := _root_.deriv f ++ h1 := (contDiff_succ_iff_deriv.mp f.h1).2.2 ++ h2 := f.h2.deriv ++ ++lemma hasDerivAt (f : CS (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := ++ (f.h1.differentiable (by simp)).differentiableAt.hasDerivAt ++ ++lemma deriv_apply {f : CS (n + 1) E} {x : ℝ} : f.deriv x = _root_.deriv f x := rfl ++ ++lemma deriv_smul {f : CS (n + 1) E} : (R • f).deriv = R • f.deriv := by ++ ext x ; exact (f.hasDerivAt x |>.const_smul R).deriv ++ ++noncomputable def scale (g : CS n E) (R : ℝ) : CS n E := by ++ by_cases h : R = 0 ++ · exact ⟨0, contDiff_const, by simp [HasCompactSupport, tsupport]⟩ ++ · refine ⟨fun x => funscale g R x, ?_, ?_⟩ ++ · exact g.h1.comp (contDiff_const_smul R⁻¹) ++ · exact g.h2.comp_smul (inv_ne_zero h) ++ ++lemma deriv_scale {f : CS (n + 1) E} : (f.scale R).deriv = R⁻¹ • f.deriv.scale R := by ++ ext v ; by_cases hR : R = 0 ++ · simp [hR, scale, deriv] ++ · simp only [scale, hR, ↓reduceDIte, smul_apply] ++ exact ((f.hasDerivAt (R⁻¹ • v)).scomp v ++ (by simpa using! (hasDerivAt_id v).const_smul R⁻¹)).deriv ++ ++lemma deriv_scale' {f : CS (n + 1) E} : ++ (f.scale R).deriv v = R⁻¹ • f.deriv (R⁻¹ • v) := by ++ rw [deriv_scale, smul_apply] ++ by_cases hR : R = 0 <;> simp [hR, scale, funscale] ++ ++lemma hasDerivAt_scale (f : CS (n + 1) E) (R x : ℝ) : ++ HasDerivAt (f.scale R) (R⁻¹ • _root_.deriv f (R⁻¹ • x)) x := by ++ convert hasDerivAt (f.scale R) x ; rw [deriv_scale'] ; rfl ++ ++lemma tendsto_scale (f : CS n E) (x : ℝ) : Tendsto (fun R => f.scale R x) atTop (𝓝 (f 0)) := by ++ apply (tendsto_funscale f.continuous.continuousAt x).congr' ++ filter_upwards [eventually_ne_atTop 0] with R hR ; simp [scale, hR] ++ ++lemma bounded : ∃ C, ∀ v, ‖f v‖ ≤ C := by ++ obtain ⟨x, hx⟩ := ++ (continuous_norm.comp f.continuous).exists_forall_ge_of_hasCompactSupport f.h2.norm ++ exact ⟨_, hx⟩ ++ ++end CS ++ ++namespace trunc ++ ++instance : CoeFun trunc (fun _ => ℝ → ℝ) where coe f := f.toFun ++ ++instance : Coe trunc (CS 2 ℝ) where coe := trunc.toCS ++ ++lemma nonneg (g : trunc) (x : ℝ) : 0 ≤ g x := (Set.indicator_nonneg (by simp) x).trans (g.h3 x) ++ ++lemma le_one (g : trunc) (x : ℝ) : g x ≤ 1 := ++ (g.h4 x).trans <| Set.indicator_le_self' (by simp) x ++ ++lemma zero (g : trunc) : g =ᶠ[𝓝 0] 1 := by ++ have : Set.Icc (-1) 1 ∈ 𝓝 (0 : ℝ) := by apply Icc_mem_nhds <;> linarith ++ exact eventually_of_mem this (fun x hx => le_antisymm (g.le_one x) (by simpa [hx] using g.h3 x)) ++ ++@[simp] lemma zero_at {g : trunc} : g 0 = 1 := g.zero.eq_of_nhds ++ ++end trunc ++ ++namespace W1 ++ ++instance : CoeFun (W1 n E) (fun _ => ℝ → E) where coe := W1.toFun ++ ++lemma continuous (f : W1 n E) : Continuous f := f.smooth.continuous ++ ++lemma differentiable (f : W1 (n + 1) E) : Differentiable ℝ f := ++ f.smooth.differentiable (by simp) ++ ++lemma iteratedDeriv_sub {f g : ℝ → E} (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : ++ iteratedDeriv n (f - g) = iteratedDeriv n f - iteratedDeriv n g := by ++ induction n generalizing f g with ++ | zero => rfl ++ | succ n ih => ++ have hf' : ContDiff ℝ n (deriv f) := hf.iterate_deriv' n 1 ++ have hg' : ContDiff ℝ n (deriv g) := hg.iterate_deriv' n 1 ++ have hfg : deriv (f - g) = deriv f - deriv g := by ++ ext x ; apply deriv_sub ++ · exact (hf.differentiable (by simp)).differentiableAt ++ · exact (hg.differentiable (by simp)).differentiableAt ++ simp_rw [iteratedDeriv_succ', ← ih hf' hg', hfg] ++ ++noncomputable def deriv (f : W1 (n + 1) E) : W1 n E where ++ toFun := _root_.deriv f ++ smooth := contDiff_succ_iff_deriv.mp f.smooth |>.2.2 ++ integrable k hk := by ++ simpa [iteratedDeriv_succ'] using f.integrable (Nat.succ_le_succ hk) ++ ++lemma hasDerivAt (f : W1 (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := ++ f.differentiable.differentiableAt.hasDerivAt ++ ++def sub (f g : W1 n E) : W1 n E where ++ toFun := f - g ++ smooth := f.smooth.sub g.smooth ++ integrable k hk := by ++ have hf : ContDiff ℝ k f := f.smooth.of_le (by simp [hk]) ++ have hg : ContDiff ℝ k g := g.smooth.of_le (by simp [hk]) ++ simpa [iteratedDeriv_sub hf hg] using (f.integrable hk).sub (g.integrable hk) ++ ++instance : Sub (W1 n E) where sub := sub ++ ++lemma integrable_iteratedDeriv_Schwarz {f : 𝓢(ℝ, ℂ)} : Integrable (iteratedDeriv n f) := by ++ induction n generalizing f with ++ | zero => exact f.integrable ++ | succ n ih => simpa [iteratedDeriv_succ'] using! ih (f := SchwartzMap.derivCLM ℝ ℂ f) ++ ++noncomputable def of_Schwartz (f : 𝓢(ℝ, ℂ)) : W1 n ℂ where ++ toFun := f ++ smooth := f.smooth n ++ integrable _ _ := integrable_iteratedDeriv_Schwarz ++ ++end W1 ++ ++namespace W21 ++ ++variable {f : W21} ++ ++noncomputable def norm (f : ℝ → ℂ) : ℝ := ++ (∫ v, ‖f v‖) + (4 * π ^ 2)⁻¹ * (∫ v, ‖deriv (deriv f) v‖) ++ ++lemma norm_nonneg {f : ℝ → ℂ} : 0 ≤ norm f := ++ add_nonneg (integral_nonneg (fun t => by simp)) ++ (mul_nonneg (by positivity) (integral_nonneg (fun t => by simp))) ++ ++noncomputable instance : Norm W21 where norm := norm ∘ W1.toFun ++ ++noncomputable instance : Coe 𝓢(ℝ, ℂ) W21 where coe := W1.of_Schwartz ++ ++def ofCS2 (f : CS 2 ℂ) : W21 := by ++ refine ⟨f, f.h1, fun k hk => ?_⟩ ; match k with ++ | 0 => exact f.h1.continuous.integrable_of_hasCompactSupport f.h2 ++ | 1 => simpa using (f.h1.continuous_deriv one_le_two).integrable_of_hasCompactSupport f.h2.deriv ++ | 2 => simpa [iteratedDeriv_succ] using ++ (f.h1.iterate_deriv' 0 2).continuous.integrable_of_hasCompactSupport f.h2.deriv.deriv ++ ++instance : Coe (CS 2 ℂ) W21 where coe := ofCS2 ++ ++instance : HMul (CS 2 ℂ) W21 (CS 2 ℂ) where ++ hMul g f := ⟨g * f, g.h1.mul f.smooth, g.h2.mul_right⟩ ++ ++instance : HMul (CS 2 ℝ) W21 (CS 2 ℂ) where hMul g f := (g : CS 2 ℂ) * f ++ ++lemma hf (f : W21) : Integrable f := f.integrable zero_le_two ++ ++lemma hf' (f : W21) : Integrable (deriv f) := by ++ simpa [iteratedDeriv_succ] using f.integrable one_le_two ++ ++lemma hf'' (f : W21) : Integrable (deriv (deriv f)) := by ++ simpa [iteratedDeriv_succ] using f.integrable le_rfl ++ ++end W21 ++ ++theorem W21_approximation (f : W21) (g : trunc) : ++ Tendsto (fun R => ‖f - (g.scale R * f : W21)‖) atTop (𝓝 0) := by ++ ++ let f' := f.deriv ++ let f'' := f'.deriv ++ let g' := (g : CS 2 ℝ).deriv ++ let g'' := g'.deriv ++ let h R v := 1 - g.scale R v ++ let h' R := - (g.scale R).deriv ++ let h'' R := - (g.scale R).deriv.deriv ++ ++ have ch {R} : Continuous (fun v => (h R v : ℂ)) := ++ continuous_ofReal.comp <| continuous_const.sub (CS.continuous _) ++ have ch' {R} : Continuous (fun v => (h' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) ++ have ch'' {R} : Continuous (fun v => (h'' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) ++ have dh R v : HasDerivAt (h R) (h' R v) v := by ++ convert! CS.hasDerivAt_scale (g : CS 2 ℝ) R v |>.const_sub 1 using 1 ++ simp [h', CS.deriv_scale', show g.deriv.toFun = deriv g.toFun from rfl] ++ have dh' R v : HasDerivAt (h' R) (h'' R v) v := ((g.scale R).deriv.hasDerivAt v).neg ++ have hh1 R v : |h R v| ≤ 1 := by ++ by_cases hR : R = 0 <;> ++ simp only [CS.scale, funscale, smul_eq_mul, hR, ↓reduceDIte, Pi.zero_apply, sub_zero, ++ abs_one, le_refl, h] ++ rw [abs_le] ; constructor <;> ++ linarith [g.le_one (R⁻¹ * v), g.nonneg (R⁻¹ * v)] ++ have vR v : Tendsto (fun R : ℝ => v * R⁻¹) atTop (𝓝 0) := by ++ simpa using tendsto_inv_atTop_zero.const_mul v ++ ++ convert_to Tendsto (fun R => W21.norm (fun v => h R v * f v)) atTop (𝓝 0) ++ · ext R ; change W21.norm _ = _ ; congr ; ext v ; simp [h, sub_mul] ; rfl ++ rw [show (0 : ℝ) = 0 + ((4 * π ^ 2)⁻¹ : ℝ) * 0 by simp] ++ refine Tendsto.add ?_ (Tendsto.const_mul _ ?_) ++ ++ · let F R v := ‖h R v * f v‖ ++ have eh v : ∀ᶠ R in atTop, h R v = 0 := by ++ filter_upwards [(vR v).eventually g.zero, eventually_ne_atTop 0] with R hR hR' ++ simp [h, hR, CS.scale, hR', funscale, mul_comm R⁻¹] ++ have e1 : ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (F n) volume := by ++ apply Eventually.of_forall ; intro R ++ exact (ch.mul f.continuous).norm.aestronglyMeasurable ++ have e2 : ∀ᶠ (n : ℝ) in atTop, ∀ᵐ (a : ℝ), ‖F n a‖ ≤ ‖f a‖ := by ++ apply Eventually.of_forall ; intro R ++ apply Eventually.of_forall ; intro v ++ simpa [F] using mul_le_mul (hh1 R v) le_rfl (by simp) zero_le_one ++ have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by ++ apply Eventually.of_forall ; intro v ++ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eh v] with R hR ; simp [F, hR] ++ simpa [F] using tendsto_integral_filter_of_dominated_convergence _ e1 e2 f.hf.norm e4 ++ ++ · let F R v := ‖h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v‖ ++ convert_to Tendsto (fun R ↦ ∫ (v : ℝ), F R v) atTop (𝓝 0) ++ · have this R v : ++ deriv (deriv (fun v => h R v * f v)) v = ++ h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v := by ++ have df v : HasDerivAt f (f' v) v := f.hasDerivAt v ++ have df' v : HasDerivAt f' (f'' v) v := f'.hasDerivAt v ++ have l3 v : HasDerivAt (fun v => h R v * f v) (h' R v * f v + h R v * f' v) v := ++ (dh R v).ofReal_comp.mul (df v) ++ have l5 : HasDerivAt (fun v => h' R v * f v) (h'' R v * f v + h' R v * f' v) v := ++ (dh' R v).ofReal_comp.mul (df v) ++ have l7 : HasDerivAt (fun v => h R v * f' v) (h' R v * f' v + h R v * f'' v) v := ++ (dh R v).ofReal_comp.mul (df' v) ++ have d1 : deriv (fun v => h R v * f v) = fun v => h' R v * f v + h R v * f' v := ++ funext (fun v => (l3 v).deriv) ++ rw [d1] ; convert! (l5.add l7).deriv using 1 ; ring ++ simp_rw [this, F] ++ ++ obtain ⟨c1, mg'⟩ := g'.bounded ++ obtain ⟨c2, mg''⟩ := g''.bounded ++ let bound v := c2 * ‖f v‖ + 2 * c1 * ‖f' v‖ + ‖f'' v‖ ++ have e1 : ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (F n) volume := by ++ apply Eventually.of_forall ; intro R ; apply (Continuous.norm ?_).aestronglyMeasurable ++ exact ((ch''.mul f.continuous).add ((continuous_const.mul ch').mul f.deriv.continuous)).add ++ (ch.mul f.deriv.deriv.continuous) ++ have e2 : ∀ᶠ R in atTop, ∀ᵐ (a : ℝ), ‖F R a‖ ≤ bound a := by ++ have hc1 : ∀ᶠ R in atTop, ∀ v, |h' R v| ≤ c1 := by ++ filter_upwards [eventually_ge_atTop 1] with R hR v ++ have hR' : R ≠ 0 := by linarith ++ have : 0 ≤ R := by linarith ++ simp only [CS.deriv_scale, CS.neg_apply, CS.smul_apply, smul_eq_mul, abs_neg, abs_mul, ++ abs_inv, abs_eq_self.mpr this, ge_iff_le, h'] ++ simp only [CS.scale, hR', ↓reduceDIte, funscale, smul_eq_mul] ++ convert_to _ ≤ c1 * 1 ++ · simp ++ · rw [mul_comm] ++ apply mul_le_mul (mg' _) ++ (inv_le_of_inv_le₀ (by linarith) (by simpa using hR)) (by positivity) ++ exact (abs_nonneg _).trans (mg' 0) ++ have hc2 : ∀ᶠ R in atTop, ∀ v, |h'' R v| ≤ c2 := by ++ filter_upwards [eventually_ge_atTop 1] with R hR v ++ have e1 : 0 ≤ R := by linarith ++ have e2 : R⁻¹ ≤ 1 := inv_le_of_inv_le₀ (by linarith) (by simpa using hR) ++ have e3 : R ≠ 0 := by linarith ++ simp only [CS.deriv_scale, CS.deriv_smul, CS.neg_apply, CS.smul_apply, smul_eq_mul, abs_neg, ++ abs_mul, abs_inv, abs_eq_self.mpr e1, ge_iff_le, h''] ++ convert_to _ ≤ 1 * (1 * c2) ++ · simp ++ apply mul_le_mul e2 ?_ (by positivity) zero_le_one ++ apply mul_le_mul e2 ?_ (by positivity) zero_le_one ++ simp only [CS.scale, e3, ↓reduceDIte, funscale, smul_eq_mul] ; apply mg'' ++ filter_upwards [hc1, hc2] with R hc1 hc2 ++ apply Eventually.of_forall ; intro v ; specialize hc1 v ; specialize hc2 v ++ simp only [F, bound, norm_norm] ++ refine (norm_add_le _ _).trans ?_ ; apply add_le_add ++ · refine (norm_add_le _ _).trans ?_ ; apply add_le_add <;> simp only [Complex.norm_mul, ++ Complex.norm_ofNat, norm_real, norm_eq_abs] <;> gcongr ++ · simpa using mul_le_mul (hh1 R v) le_rfl (by simp) zero_le_one ++ have e3 : Integrable bound volume := ++ (((f.hf.norm).const_mul _).add ((f.hf'.norm).const_mul _)).add f.hf''.norm ++ have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by ++ apply Eventually.of_forall ; intro v ++ have evg' : g' =ᶠ[𝓝 0] 0 := by convert! ← g.zero.deriv ; exact deriv_const' _ ++ have evg'' : g'' =ᶠ[𝓝 0] 0 := by convert! ← evg'.deriv ; exact deriv_const' _ ++ refine tendsto_norm_zero.comp <| (ZeroAtFilter.add ?_ ?_).add ?_ ++ · have eh'' v : ∀ᶠ R in atTop, h'' R v = 0 := by ++ filter_upwards [(vR v).eventually evg'', eventually_ne_atTop 0] with R hR hR' ++ simp only [CS.deriv_scale, CS.deriv_smul, CS.neg_apply, CS.smul_apply, smul_eq_mul, ++ neg_eq_zero, mul_eq_zero, inv_eq_zero, hR', false_or, h''] ++ simp only [CS.scale, hR', ↓reduceDIte, funscale, smul_eq_mul, mul_comm R⁻¹] ++ exact hR ++ apply tendsto_nhds_of_eventually_eq ++ filter_upwards [eh'' v] with R hR ; simp [hR] ++ · have eh' v : ∀ᶠ R in atTop, h' R v = 0 := by ++ filter_upwards [(vR v).eventually evg'] with R hR ++ simp [g'] at hR ++ simp [h', CS.deriv_scale', mul_comm R⁻¹, hR] ++ apply tendsto_nhds_of_eventually_eq ++ filter_upwards [eh' v] with R hR ; simp [hR] ++ · simpa [h] using! ((g.tendsto_scale v).const_sub 1).ofReal.mul tendsto_const_nhds ++ simpa [F] using tendsto_integral_filter_of_dominated_convergence bound e1 e2 e3 e4 ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Tactic/AdditiveCombination.lean b/PrimeNumberTheoremAnd/Erdos970/Tactic/AdditiveCombination.lean +new file mode 100644 +index 0000000..f79890f +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Tactic/AdditiveCombination.lean +@@ -0,0 +1,90 @@ ++import Mathlib.Tactic.Abel ++import Mathlib.Tactic.LinearCombinationPrime ++ ++namespace Erdos970 ++ ++namespace Mathlib.Tactic.LinearCombinationPrime ++open _root_.Mathlib.Tactic.LinearCombinationPrime ++open Lean ++open Elab Meta Term ++ ++variable {α β : Type*} ++ ++theorem pf_smul_c [SMul α β] {a b : α} (p : a = b) (c : β) : a • c = b • c := p ▸ rfl ++theorem c_smul_pf [SMul α β] {b c : β} (p : b = c) (a : α) : a • b = a • c := p ▸ rfl ++theorem smul_pf [SMul α β] {a₁ b₁ : α} (p₁ : (a₁ : α) = b₁) {a₂ b₂ : β} (p₂ : a₂ = b₂) : ++ a₁ • a₂ = b₁ • b₂ := p₁ ▸ p₂ ▸ rfl ++ ++partial def expandAdditiveCombo (ty : Expr) (stx : Syntax.Term) : TermElabM Expanded := withRef stx do ++ match stx with ++ | `(($e)) => expandLinearCombo ty e ++ | `($e₁ + $e₂) => do ++ match ← expandAdditiveCombo ty e₁, ← expandAdditiveCombo ty e₂ with ++ | .const c₁, .const c₂ => .const <$> ``($c₁ + $c₂) ++ | .proof p₁, .const c₂ => .proof <$> ``(pf_add_c $p₁ $c₂) ++ | .const c₁, .proof p₂ => .proof <$> ``(c_add_pf $p₂ $c₁) ++ | .proof p₁, .proof p₂ => .proof <$> ``(add_pf $p₁ $p₂) ++ | `($e₁ - $e₂) => do ++ match ← expandAdditiveCombo ty e₁, ← expandAdditiveCombo ty e₂ with ++ | .const c₁, .const c₂ => .const <$> ``($c₁ - $c₂) ++ | .proof p₁, .const c₂ => .proof <$> ``(pf_sub_c $p₁ $c₂) ++ | .const c₁, .proof p₂ => .proof <$> ``(c_sub_pf $p₂ $c₁) ++ | .proof p₁, .proof p₂ => .proof <$> ``(sub_pf $p₁ $p₂) ++ | `(-$e) => do ++ match ← expandAdditiveCombo ty e with ++ | .const c => .const <$> `(-$c) ++ | .proof p => .proof <$> ``(neg_pf $p) ++ | `(← $e:term) => do ++ match ← expandAdditiveCombo ty e with ++ | .const c => return .const c ++ | .proof p => .proof <$> ``(Eq.symm $p) ++ | `($e₁ • $e₂) => do ++ match ← expandAdditiveCombo ty e₁, ← expandAdditiveCombo ty e₂ with ++ | .const c₁, .const c₂ => .const <$> ``($c₁ • $c₂) ++ | .proof p₁, .const c₂ => .proof <$> ``(pf_smul_c $p₁ $c₂) ++ | .const c₁, .proof p₂ => .proof <$> ``(c_smul_pf $p₂ $c₁) ++ | .proof p₁, .proof p₂ => .proof <$> ``(smul_pf $p₁ $p₂) ++ | e => ++ ++ withSynthesize do ++ ++ let c ← withSynthesizeLight <| Term.elabTerm e ty ++ if (← whnfR (← inferType c)).isEq then ++ .proof <$> c.toSyntax ++ else ++ .const <$> c.toSyntax ++ ++def elabAdditiveCombination (tk : Syntax) ++ (norm? : Option Syntax.Tactic) (exp? : Option Syntax.NumLit) (input : Option Syntax.Term) ++ (twoGoals := false) : Tactic.TacticM Unit := Tactic.withMainContext do ++ let some (ty, _) := (← (← Tactic.getMainGoal).getType').eq? | ++ throwError "'additive_combination' only proves equalities" ++ let p ← match input with ++ | none => `(Eq.refl 0) ++ | some e => ++ match ← expandAdditiveCombo ty e with ++ | .const c => `(Eq.refl $c) ++ | .proof p => pure p ++ let norm := norm?.getD (Unhygienic.run <| withRef tk `(tactic| ((try simp only [smul_add, smul_sub]); abel))) ++ Term.withoutErrToSorry <| Tactic.evalTactic <| ← withFreshMacroScope <| ++ if twoGoals then ++ `(tactic| ( ++ refine eq_trans₃ $p ?a ?b ++ case' a => $norm:tactic ++ case' b => $norm:tactic)) ++ else ++ match exp? with ++ | some n => ++ if n.getNat = 1 then `(tactic| (refine eq_of_add $p ?a; case' a => $norm:tactic)) ++ else `(tactic| (refine eq_of_add_pow $n $p ?a; case' a => $norm:tactic)) ++ | _ => `(tactic| (refine eq_of_add $p ?a; case' a => $norm:tactic)) ++ ++syntax (name := AdditiveCombination) "additive_combination" ++ (normStx)? (expStx)? (ppSpace colGt term)? : tactic ++elab_rules : tactic ++ | `(tactic| additive_combination%$tk $[(norm := $tac)]? $[(exp := $n)]? $(e)?) => ++ elabAdditiveCombination tk tac n e ++ ++end Mathlib.Tactic.LinearCombinationPrime ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/Wiener.lean b/PrimeNumberTheoremAnd/Erdos970/Wiener.lean +new file mode 100644 +index 0000000..3259e31 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/Wiener.lean +@@ -0,0 +1,3571 @@ ++import Mathlib.Analysis.Fourier.RiemannLebesgueLemma ++import Mathlib.Analysis.Normed.Group.Tannery ++import Mathlib.Analysis.SumIntegralComparisons ++import Mathlib.NumberTheory.Chebyshev ++import Mathlib.NumberTheory.LSeries.PrimesInAP ++import Mathlib.NumberTheory.MulChar.Lemmas ++import Mathlib.Topology.EMetricSpace.BoundedVariation ++import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.Asymptotics.Asymptotics ++import PrimeNumberTheoremAnd.Erdos970.Fourier ++import PrimeNumberTheoremAnd.Erdos970.SmoothExistence ++import Mathlib.Analysis.Convolution ++ ++namespace Erdos970 ++ ++ ++open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries ++ _root_.Asymptotics Erdos970.Asymptotics SchwartzMap ++open Complex hiding log ++open scoped Topology ++open scoped ContDiff ++open scoped ComplexConjugate ++ ++variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} ++ [RCLike 𝕜] ++ ++noncomputable ++def nterm (f : ℕ → ℂ) (σ' : ℝ) (n : ℕ) : ℝ := if n = 0 then 0 else ‖f n‖ / n ^ σ' ++ ++lemma nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by ++ by_cases h : n = 0 <;> simp [nterm, term, h] ++ ++theorem norm_term_eq_nterm_re (s : ℂ) : ++ ‖term f s n‖ = nterm f (s.re) n := by ++ simp only [nterm, term, apply_ite (‖·‖), norm_zero, norm_div] ++ apply ite_congr rfl (fun _ ↦ rfl) ++ intro h ++ congr ++ refine norm_natCast_cpow_of_pos (by omega) s ++ ++lemma hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : ++ ∑' i, (‖term f σ' i‖₊ : ENNReal) ≠ ⊤ := by ++ simp_rw [ENNReal.tsum_coe_ne_top_iff_summable_coe, ← norm_toNNReal] ++ norm_cast ++ apply Summable.toNNReal ++ convert hf σ' hσ with i ++ simp [nterm_eq_norm_term] ++ ++instance instMeasurableSpace : MeasurableSpace Circle := ++ inferInstanceAs <| MeasurableSpace <| Subtype _ ++instance instBorelSpace : BorelSpace Circle := ++ inferInstanceAs <| BorelSpace <| Subtype (· ∈ Metric.sphere (0 : ℂ) 1) ++ ++attribute [fun_prop] Real.continuous_fourierChar ++ ++lemma first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ ++ (‖fourierChar (-(u * ((1 : ℝ) / ((2 : ℝ) * π) * (n / x).log))) • ψ u‖ₑ : ENNReal) := by ++ fun_prop ++ ++lemma first_fourier_aux2a : ++ (2 : ℂ) * π * -(y * (1 / (2 * π) * Real.log ((n) / x))) = -(y * ((n) / x).log) := by ++ calc ++ _ = -(y * (((2 : ℂ) * π) / (2 * π) * Real.log ((n) / x))) := by ring ++ _ = _ := by rw [div_self (by norm_num), one_mul] ++ ++lemma first_fourier_aux2 (hx : 0 < x) (n : ℕ) : ++ term f σ' n * 𝐞 (-(y * (1 / (2 * π) * Real.log (n / x)))) • ψ y = ++ term f (σ' + y * I) n • (ψ y * x ^ (y * I)) := by ++ by_cases hn : n = 0 ++ · simp [term, hn] ++ simp only [term, hn, ↓reduceIte] ++ calc ++ _ = (f n * (cexp ((2 * π * -(y * (1 / (2 * π) * Real.log (n / x)))) * I) / ++ ↑((n : ℝ) ^ σ'))) • ψ y := by ++ rw [Circle.smul_def, fourierChar_apply, ofReal_cpow (by norm_num)] ++ simp only [one_div, mul_inv_rev, mul_neg, ofReal_neg, ofReal_mul, ofReal_ofNat, ofReal_inv, ++ neg_mul, smul_eq_mul, ofReal_natCast] ++ ring ++ _ = (f n * (x ^ (y * I) / n ^ (σ' + y * I))) • ψ y := by ++ congr 2 ++ have l1 : 0 < (n : ℝ) := by simpa using Nat.pos_iff_ne_zero.mpr hn ++ have l2 : (x : ℂ) ≠ 0 := by simp [hx.ne.symm] ++ have l3 : (n : ℂ) ≠ 0 := by simp [hn] ++ rw [Real.rpow_def_of_pos l1, Complex.cpow_def_of_ne_zero l2, Complex.cpow_def_of_ne_zero l3] ++ push_cast ++ simp_rw [← Complex.exp_sub] ++ congr 1 ++ rw [first_fourier_aux2a, Real.log_div l1.ne.symm hx.ne.symm] ++ push_cast ++ rw [Complex.ofReal_log hx.le] ++ ring ++ _ = _ := by simp ; group ++ ++ ++lemma first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hsupp : Integrable ψ) (hx : 0 < x) (hσ : 1 < σ') : ++ ∑' n : ℕ, term f σ' n * (𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))) = ++ ∫ t : ℝ, LSeries f (σ' + t * I) * ψ t * x ^ (t * I) := by ++ ++ calc ++ _ = ∑' n, term f σ' n * ∫ (v : ℝ), 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ simp only [Real.fourier_eq] ++ simp only [one_div, mul_inv_rev, RCLike.inner_apply', conj_trivial] ++ _ = ∑' n, ∫ (v : ℝ), term f σ' n * 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ simp [integral_const_mul] ++ _ = ∫ (v : ℝ), ∑' n, term f σ' n * 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ refine (integral_tsum ?_ ?_).symm ++ · refine fun _ ↦ AEMeasurable.aestronglyMeasurable ?_ ++ have := hsupp.aemeasurable ++ fun_prop ++ · simp only [enorm_mul] ++ simp_rw [lintegral_const_mul'' _ (first_fourier_aux1 hsupp.aemeasurable _)] ++ calc ++ _ = (∑' (i : ℕ), ‖term f σ' i‖ₑ) * ∫⁻ (a : ℝ), ‖ψ a‖ₑ ∂volume := by ++ simp [ENNReal.tsum_mul_right, enorm_eq_nnnorm] ++ _ ≠ ⊤ := ENNReal.mul_ne_top (hf_coe1 hf hσ) ++ (ne_top_of_lt hsupp.2) ++ _ = _ := by ++ congr 1; ext y ++ simp_rw [mul_assoc (LSeries _ _), ← smul_eq_mul (a := (LSeries _ _)), LSeries] ++ rw [← Summable.tsum_smul_const] ++ · simp_rw [first_fourier_aux2 hx] ++ · apply Summable.of_norm ++ convert hf σ' hσ with n ++ rw [norm_term_eq_nterm_re] ++ simp ++ ++@[continuity] ++lemma continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ ++ ++attribute [fun_prop] measurable_coe_nnreal_ennreal ++ ++lemma second_fourier_integrable_aux1a (hσ : 1 < σ') : ++ IntegrableOn (fun (x : ℝ) ↦ cexp (-((x : ℂ) * ((σ' : ℂ) - 1)))) (Ici (-Real.log x)) := by ++ norm_cast ++ suffices IntegrableOn (fun (x : ℝ) ↦ (rexp (-(x * (σ' - 1))))) (Ici (-x.log)) _ from this.ofReal ++ simp_rw [fun (a x : ℝ) ↦ (by ring : -(x * a) = -a * x)] ++ rw [integrableOn_Ici_iff_integrableOn_Ioi] ++ apply exp_neg_integrableOn_Ioi ++ linarith ++ ++lemma second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : ++ let ν : Measure (ℝ × ℝ) := (volume.restrict (Ici (-Real.log x))).prod volume ++ Integrable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • ++ (𝐞 (Multiplicative.ofAdd (-(a * (u / (2 * π))))) : ℂ) • ψ a) ν := by ++ intro ν ++ constructor ++ · apply Measurable.aestronglyMeasurable ++ ++ simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, ++ Multiplicative.ofAdd, smul_eq_mul] ++ change Measurable (fun v : ℝ × ℝ => ++ cexp (-((v.1 : ℂ) * ((σ' : ℂ) - 1))) * ++ ((𝐞 (-(v.2 * (v.1 / (2 * π)))) : ℂ) * ψ v.2)) ++ fun_prop ++ · let f1 : ℝ → ENNReal := fun a1 ↦ ‖cexp (-(↑a1 * (↑σ' - 1)))‖ₑ ++ let f2 : ℝ → ENNReal := fun a2 ↦ ‖ψ a2‖ₑ ++ suffices ∫⁻ (a : ℝ × ℝ), f1 a.1 * f2 a.2 ∂ν < ⊤ by ++ simpa [hasFiniteIntegral_iff_enorm, enorm_eq_nnnorm, Function.uncurry] ++ refine (lintegral_prod_mul ?_ ?_).trans_lt ?_ <;> try fun_prop ++ exact ENNReal.mul_lt_top (second_fourier_integrable_aux1a hσ).2 hsupp.2 ++ ++lemma second_fourier_integrable_aux2 (hσ : 1 < σ') : ++ IntegrableOn (fun (u : ℝ) ↦ cexp ((1 - ↑σ' - ↑t * I) * ↑u)) (Ioi (-Real.log x)) := by ++ refine (integrable_norm_iff (Measurable.aestronglyMeasurable <| by fun_prop)).mp ?_ ++ suffices IntegrableOn (fun a ↦ rexp (-(σ' - 1) * a)) (Ioi (-x.log)) _ by simpa [Complex.norm_exp] ++ apply exp_neg_integrableOn_Ioi ++ linarith ++ ++lemma second_fourier_aux (hx : 0 < x) : ++ -(cexp (-((1 - ↑σ' - ↑t * I) * ↑(Real.log x))) / (1 - ↑σ' - ↑t * I)) = ++ ↑(x ^ (σ' - 1)) * (↑σ' + ↑t * I - 1)⁻¹ * ↑x ^ (↑t * I) := by ++ calc ++ _ = cexp (↑(Real.log x) * ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [← div_neg]; ring_nf ++ _ = (x ^ ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr (ne_of_gt hx)), Complex.ofReal_log hx.le] ++ _ = (x ^ ((σ' : ℂ) - 1)) * (x ^ (↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [Complex.cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt hx))] ++ _ = _ := by rw [ofReal_cpow hx.le]; push_cast; ring ++ ++ ++lemma second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) ++ {x σ' : ℝ} (hx : 0 < x) (hσ : 1 < σ') : ++ ∫ u in Ici (-log x), Real.exp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = ++ (x^(σ' - 1) : ℝ) * ∫ t, (1 / (σ' + t * I - 1)) * ψ t * x^(t * I) ∂ volume := by ++ ++ conv in ↑(rexp _) * _ => { rw [Real.fourier_real_eq, ← smul_eq_mul, ← integral_smul] } ++ rw [MeasureTheory.integral_integral_swap] ++ swap ++ · exact second_fourier_integrable_aux1 hcont hsupp hσ ++ rw [← integral_const_mul] ++ congr 1; ext t ++ dsimp ++ ++ simp_rw [mul_smul_comm, ← smul_mul_assoc, integral_mul_const] ++ rw [fun (a b d : ℂ) ↦ show a * (b * (ψ t) * d) = (a * b * d) * ψ t by ring] ++ congr 1 ++ conv => ++ lhs ++ enter [2] ++ ext a ++ rw [Circle.smul_def, smul_eq_mul] ++ simp only [Real.fourierChar, Circle.exp] ++ change cexp ((↑(2 * π * -(t * (a / (2 * π)))) : ℂ) * I) * ++ (rexp (-a * (σ' - 1)) : ℂ) ++ push_cast ++ simp_rw [← Complex.exp_add] ++ have (u : ℝ) : ++ 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I + -↑u * (↑σ' - 1) = (1 - σ' - t * I) * u := calc ++ _ = -↑u * (↑σ' - 1) + (2 * ↑π) / (2 * ↑π) * -(↑t * ↑u) * I := by ring ++ _ = -↑u * (↑σ' - 1) + 1 * -(↑t * ↑u) * I := by rw [div_self (by norm_num)] ++ _ = _ := by ring ++ simp_rw [this] ++ let c : ℂ := (1 - ↑σ' - ↑t * I) ++ have : c ≠ 0 := by simp [Complex.ext_iff, c, sub_ne_zero.mpr hσ.ne] ++ let f' (u : ℝ) := cexp (c * u) ++ let f := fun (u : ℝ) ↦ (f' u) / c ++ have hderiv : ∀ u ∈ Ici (-Real.log x), HasDerivAt f (f' u) u := by ++ intro u _ ++ rw [show f' u = cexp (c * u) * (c * 1) / c by simp only [f']; field_simp] ++ exact (hasDerivAt_id' u).ofReal_comp.const_mul c |>.cexp.div_const c ++ have hf : Tendsto f atTop (𝓝 0) := by ++ apply tendsto_zero_iff_norm_tendsto_zero.mpr ++ suffices Tendsto (fun (x : ℝ) ↦ ‖cexp (c * ↑x)‖ / ‖c‖) atTop (𝓝 (0 / ‖c‖)) by ++ simpa [f, f'] using this ++ apply Filter.Tendsto.div_const ++ suffices Tendsto (· * (1 - σ')) atTop atBot by simpa [Complex.norm_exp, mul_comm (1 - σ'), c] ++ exact Tendsto.atTop_mul_const_of_neg (by linarith) fun ⦃s⦄ h ↦ h ++ rw [integral_Ici_eq_integral_Ioi, ++ integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (second_fourier_integrable_aux2 hσ) hf] ++ simpa [f, f'] using second_fourier_aux hx ++ ++lemma one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) ++ ++theorem prelim_decay (ψ : ℝ → ℂ) (u : ℝ) : ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ ∫ t, ‖ψ t‖ := ++ VectorFourier.norm_fourierIntegral_le_integral_norm .. ++ ++lemma decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by ++ have l1 : 0 < 1 + u ^ 2 := one_add_sq_pos _ ++ have l2 : 1 + u ^ 2 = ‖(1 : ℂ) + u ^ 2‖ := by ++ norm_cast ; simp only [Real.norm_eq_abs, abs_eq_self.2 l1.le] ++ have l3 : ‖1 / ((4 : ℂ) * ↑π ^ 2)‖ ≤ (4 * π ^ 2)⁻¹ := by simp ++ have key := fourierIntegral_self_add_deriv_deriv f u ++ simp only [Function.iterate_succ _ 1, Function.iterate_one, Function.comp_apply] at key ++ rw [F_sub f.hf (f.hf''.const_mul (1 / (4 * ↑π ^ 2)))] at key ++ rw [← div_eq_mul_inv, le_div_iff₀ l1, mul_comm, l2, ← norm_mul, key, sub_eq_add_neg] ++ apply norm_add_le _ _ |>.trans ++ change _ ≤ W21.norm _ ++ rw [norm_neg, F_mul, norm_mul, W21.norm] ++ gcongr <;> apply VectorFourier.norm_fourierIntegral_le_integral_norm ++ ++lemma decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) ++ (h : ∀ t, ‖f t‖ ≤ A * (1 + t ^ 2)⁻¹) : ++ ∫ t, ‖f t‖ ≤ π * A := by ++ have l1 : Integrable (fun x ↦ A * (1 + x ^ 2)⁻¹) := integrable_inv_one_add_sq.const_mul A ++ simp_rw [← integral_univ_inv_one_add_sq, mul_comm, ← integral_const_mul] ++ exact integral_mono (l1.mono' hf (Eventually.of_forall h)).norm l1 h ++ ++theorem decay_bounds_W21 (f : W21) (hA : ∀ t, ‖f t‖ ≤ A / (1 + t ^ 2)) ++ (hA' : ∀ t, ‖deriv (deriv f) t‖ ≤ A / (1 + t ^ 2)) (u) : ++ ‖𝓕 (f : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by ++ have l0 : 1 * (4 * π)⁻¹ * A = (4 * π ^ 2)⁻¹ * (π * A) := by field_simp ++ have l1 : ∫ (v : ℝ), ‖f v‖ ≤ π * A := by ++ apply decay_bounds_aux f.continuous.aestronglyMeasurable ++ simp_rw [← div_eq_mul_inv] ; exact hA ++ have l2 : ∫ (v : ℝ), ‖deriv (deriv f) v‖ ≤ π * A := by ++ apply decay_bounds_aux f.deriv.deriv.continuous.aestronglyMeasurable ++ simp_rw [← div_eq_mul_inv] ; exact hA' ++ apply decay_bounds_key f u |>.trans ++ change W21.norm _ * _ ≤ _ ++ simp_rw [W21.norm, div_eq_mul_inv, add_mul, l0] ; gcongr ++ ++lemma decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) ++ (hA' : ∀ t, ‖deriv^[2] ψ t‖ ≤ A / (1 + t ^ 2)) : ++ ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by ++ exact decay_bounds_W21 ψ hA hA' u ++ ++lemma decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by ++ have l1 : HasCompactSupport (fun u : ℝ => ((1 + u ^ 2) : ℝ) * ψ u) := by exact ψ.h2.mul_left ++ have := ψ.h1.continuous ++ obtain ⟨C, hC⟩ := l1.exists_bound_of_continuous (by fun_prop) ++ refine ⟨C, fun u => ?_⟩ ++ specialize hC u ++ simp only [norm_mul, Complex.norm_real, norm_of_nonneg (one_add_sq_pos u).le] at hC ++ rwa [le_div_iff₀' (one_add_sq_pos _)] ++ ++lemma decay_bounds_cor (ψ : W21) : ++ ∃ C : ℝ, ∀ u, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by ++ simpa only [div_eq_mul_inv] using ⟨_, decay_bounds_key ψ⟩ ++ ++@[continuity, fun_prop] lemma continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := ++ VectorFourier.fourierIntegral_continuous continuous_fourierChar ++ (by simp only [innerₗ_apply_apply, RCLike.inner_apply', conj_trivial, continuous_mul]) ++ ψ.hf ++ ++lemma W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : ++ Integrable fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c) := by ++ have l1 (C) : Integrable (fun u ↦ C / (1 + (u / c) ^ 2)) volume := by ++ simpa using! (integrable_inv_one_add_sq.comp_div hc).const_mul C ++ have l2 : AEStronglyMeasurable (fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c)) volume := by ++ apply Continuous.aestronglyMeasurable ; fun_prop ++ obtain ⟨C, h⟩ := decay_bounds_cor ψ ++ apply @Integrable.mono' ℝ ℂ _ volume _ _ (fun u => C / (1 + (u / c) ^ 2)) (l1 C) l2 ?_ ++ apply Eventually.of_forall (fun x => h _) ++ ++lemma continuous_LSeries_aux (hf : Summable (nterm f σ')) : ++ Continuous fun x : ℝ => LSeries f (σ' + x * I) := by ++ ++ have l1 i : Continuous fun x : ℝ ↦ term f (σ' + x * I) i := by ++ by_cases h : i = 0 ++ · simpa [h] using continuous_const ++ · simpa [h] using! continuous_const.div (continuous_const.cpow (by fun_prop) (by simp [h])) ++ (fun x => by simp [h]) ++ have l2 n (x : ℝ) : ‖term f (σ' + x * I) n‖ = nterm f σ' n := by ++ by_cases h : n = 0 ++ · simp [h, nterm] ++ · simp [h, nterm, cpow_add _ _ (Nat.cast_ne_zero.mpr h), ++ Complex.norm_natCast_cpow_of_pos (Nat.pos_of_ne_zero h)] ++ exact continuous_tsum l1 hf (fun n x => le_of_eq (l2 n x)) ++ ++lemma limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) (σ' : ℝ) ++ (hσ' : 1 < σ') : ++ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) ++ (u / (2 * π)) = ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by ++ have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 ++ have l3 : 0 < x := zero_lt_one.trans_le hx ++ have l1 (σ') (hσ' : 1 < σ') := first_fourier hf hint l3 hσ' ++ have l2 (σ') (hσ' : 1 < σ') := second_fourier ψ.h1.continuous.measurable hint l3 hσ' ++ have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := ++ continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [l3]) ++ have l6 : Continuous fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by ++ apply ((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8 ++ have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by ++ exact l6.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right ++ have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := by ++ intro h ; have := congr_arg Complex.re h ; simp at this ; linarith ++ have l7 : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * ++ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by ++ simp only [one_div, ← mul_assoc] ++ refine ((continuous_const.mul <| Continuous.inv₀ ?_ e2).mul ψ.h1.continuous).mul l8 ++ fun_prop ++ have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * ++ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by ++ apply l7.integrable_of_hasCompactSupport ++ exact ψ.h2.mul_left.mul_right.mul_left.mul_left ++ ++ simp_rw [l1 σ' hσ', l2 σ' hσ', ← integral_const_mul, ← integral_sub l4 l5] ++ apply integral_congr_ae ++ apply Eventually.of_forall ++ intro u ++ have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] ++ simp_rw [hG' e1, sub_mul, ← mul_assoc] ++ simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, ++ mul_eq_zero, I_ne_zero, or_false] ++ left ; left ++ field_simp [e2] ++ norm_cast ++ simp [mul_assoc, ← rpow_add l3] ++ ++section nabla ++ ++variable {α E : Type*} [OfNat α 1] [Add α] [Sub α] {u : α → ℂ} ++ ++def cumsum [AddCommMonoid E] (u : ℕ → E) (n : ℕ) : E := ∑ i ∈ Finset.range n, u i ++ ++def nabla [Sub E] (u : α → E) (n : α) : E := u (n + 1) - u n ++ ++def nnabla [Sub E] (u : α → E) (n : α) : E := u n - u (n + 1) ++ ++def shift (u : α → E) (n : α) : E := u (n + 1) ++ ++@[simp] lemma cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] ++ ++lemma cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : ++ cumsum u (n + 1) = cumsum u n + u n := by ++ simp [cumsum, Finset.sum_range_succ] ++ ++@[simp] lemma nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by ++ ext n ; simp [nabla, cumsum, Finset.range_add_one] ++ ++lemma neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := ++ funext (fun n => by simp [cumsum]) ++ ++lemma cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := ++ fun _ => Finset.sum_nonneg (fun i _ => hu i) ++ ++omit [Sub α] in ++lemma neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] ++ ++omit [Sub α] in ++@[simp] lemma nabla_mul [Ring E] {u : α → E} {c : E} : nabla (fun n => c * u n) = c • nabla u := by ++ ext n ; simp [nabla, mul_sub] ++ ++omit [Sub α] in ++@[simp] lemma nnabla_mul [Ring E] {u : α → E} {c : E} : ++ nnabla (fun n => c * u n) = c • nnabla u := by ++ ext n ; simp [nnabla, mul_sub] ++ ++lemma nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by ++ ext n ; simp [nnabla] ++ ++end nabla ++ ++lemma Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : ++ cumsum u (n + 1) = u 0 + cumsum (shift u) n := by ++ simp_rw [add_comm n, cumsum, _root_.Finset.sum_range_add, ++ _root_.Finset.sum_range_one, add_comm 1] ; rfl ++ ++lemma Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : ++ shift (cumsum u) = (fun _ => u 0) + cumsum (shift u) := by ++ ext n ; apply Finset.sum_shift_front ++ ++lemma Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : ++ cumsum u (n + 1) = cumsum u n + u n := by ++ simp [cumsum, Finset.range_add_one, add_comm] ++ ++lemma Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : ++ shift (cumsum u) = cumsum u + u := by ++ ext n ; apply Finset.sum_shift_back ++ ++lemma summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : ++ cumsum (a * b) (n + 1) = A (n + 1) * b n - A 0 * b 0 - ++ cumsum (shift A * fun i => (b (i + 1) - b i)) n := by ++ have l1 : ∑ x ∈ Finset.range (n + 1), A (x + 1) * b x = ∑ x ∈ Finset.range n, ++ A (x + 1) * b x + A (n + 1) * b n := ++ Finset.sum_shift_back ++ have l2 : ∑ x ∈ Finset.range (n + 1), A x * b x = A 0 * b 0 + ∑ x ∈ Finset.range n, ++ A (x + 1) * b (x + 1) := ++ Finset.sum_shift_front ++ simp only [cumsum, ha, Pi.mul_apply, nabla, sub_mul, Finset.sum_sub_distrib, l1, l2, shift, ++ mul_sub] ++ abel ++ ++lemma summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : ++ cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - cumsum (shift (cumsum a) * nabla b) n := by ++ simpa using! summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) ++ ++lemma summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : ++ shift (cumsum (a * b)) = shift (cumsum a) * b - cumsum (shift (cumsum a) * nabla b) := by ++ ext n ; apply summation_by_parts' ++ ++lemma summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : ++ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by ++ have l1 : (cumsum u =O[atTop] 1) ↔ _ := isBigO_one_nat_atTop_iff ++ have l2 n : ‖cumsum u n‖ = cumsum u n := by simpa using cumsum_nonneg hu n ++ simp only [BoundedAtFilter, l1, l2] ++ constructor <;> intro ⟨C, h1⟩ ++ · exact ⟨C, fun n => sum_le_hasSum _ (fun i _ => hu i) h1⟩ ++ · exact summable_of_sum_range_le hu h1 ++ ++lemma Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : ++ Summable u := ++ summable_of_isBigO_nat hu h.isBigO ++ ++lemma summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by ++ exact ⟨Erdos970.Filter.EventuallyEq.summable huv.symm, ++ Erdos970.Filter.EventuallyEq.summable huv⟩ ++ ++lemma BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : ++ BoundedAtFilter atTop (fun n => u n + c) ↔ BoundedAtFilter atTop u := by ++ have : u = fun n => (u n + c) + (-c) := by ext n ; ring ++ simp only [BoundedAtFilter] ++ constructor <;> intro h ++ on_goal 1 => rw [this] ++ all_goals { exact h.add (const_boundedAtFilter _ _) } ++ ++lemma BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : ++ BoundedAtFilter atTop (fun n => u (n + N)) ↔ BoundedAtFilter atTop u := by ++ simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, ++ eventually_atTop] ++ constructor <;> intro ⟨C, n₀, h⟩ <;> use C ++ · refine ⟨n₀ + N, fun n hn => ?_⟩ ++ obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' (m := N) (n := n) (by grind) ++ exact h _ <| Nat.add_le_add_iff_right.mp hn ++ · exact ⟨n₀, fun n hn => h _ (by grind)⟩ ++ ++lemma summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : ++ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by ++ obtain ⟨N, hu⟩ := eventually_atTop.mp hu ++ have e2 : cumsum (fun i ↦ u (i + N)) = fun n => cumsum u (n + N) - cumsum u N := by ++ ext n ; simp_rw [cumsum, add_comm _ N, Finset.sum_range_add] ; ring ++ rw [← summable_nat_add_iff N, summable_iff_bounded (fun n => hu _ <| Nat.le_add_left N n), e2] ++ simp_rw [sub_eq_add_neg, BoundedAtFilter.add_const, BoundedAtFilter.comp_add] ++ ++lemma bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : ++ BoundedAtFilter atTop u := by ++ simp only [BoundedAtFilter, isBigO_iff, eventually_atTop] at h ⊢ ++ obtain ⟨C, N, hC⟩ := h ++ refine ⟨C, N + 1, fun n hn => ?_⟩ ++ simp only [shift] at hC ++ have r1 : n - 1 ≥ N := Nat.le_sub_one_of_lt hn ++ have r2 : n - 1 + 1 = n := Nat.sub_add_cancel (by omega) ++ simpa [r2] using hC (n - 1) r1 ++ ++lemma dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) ++ (hAb : BoundedAtFilter atTop (shift (cumsum a) * b)) (hbb : ∀ᶠ n in atTop, b (n + 1) ≤ b n) ++ (h : Summable (shift (cumsum a) * nnabla b)) : Summable (a * b) := by ++ have l1 : ∀ᶠ n in atTop, 0 ≤ (shift (cumsum a) * nnabla b) n := by ++ filter_upwards [hbb] with n hb ++ exact mul_nonneg (by ++ change 0 ≤ ∑ index ∈ Finset.range (n + 1), a index ++ exact Finset.sum_nonneg (fun index _ => ha index)) (sub_nonneg.mpr hb) ++ rw [summable_iff_bounded (mul_nonneg ha hb)] ++ rw [summable_iff_bounded' l1] at h ++ apply bounded_of_shift ++ simpa only [summation_by_parts'', sub_eq_add_neg, neg_cumsum, ← mul_neg, neg_nabla] ++ using hAb.add h ++ ++lemma exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : ++ ∃ v : ℕ → ℝ, range v ⊆ range u ∧ Antitone v ∧ v =ᶠ[atTop] u := by ++ obtain ⟨N, hN⟩ := eventually_atTop.mp hu ++ let v (n : ℕ) := u (if n < N then N else n) ++ refine ⟨v, ?_, ?_, ?_⟩ ++ · exact fun x ⟨n, hn⟩ => ⟨if n < N then N else n, hn⟩ ++ · refine antitone_nat_of_succ_le (fun n => ?_) ++ by_cases h : n < N ++ · by_cases h' : n + 1 < N <;> simp [v, h, h'] ++ have : n + 1 = N := by linarith ++ simp [this] ++ · have : ¬(n + 1 < N) := by linarith ++ simp only [this, ↓reduceIte, h, ge_iff_le, v] ; apply hN ; linarith ++ · have : ∀ᶠ n in atTop, ¬(n < N) := by simpa using ⟨N, fun b hb => by linarith⟩ ++ filter_upwards [this] with n hn ; simp [v, hn] ++ ++lemma summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by ++ let u (n : ℕ) := (n * (Real.log n) ^ 2)⁻¹ ++ have l7 : ∀ᶠ n : ℕ in atTop, 1 ≤ Real.log n := ++ tendsto_atTop.mp (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) 1 ++ have l8 : ∀ᶠ n : ℕ in atTop, 1 ≤ n := eventually_ge_atTop 1 ++ have l9 : ∀ᶠ n in atTop, u (n + 1) ≤ u n := by ++ filter_upwards [l7, l8] with n l2 l8; dsimp [u]; gcongr <;> simp ++ obtain ⟨v, l1, l2, l3⟩ := exists_antitone_of_eventually l9 ++ rw [summable_congr_ae l3.symm] ++ have l4 (n : ℕ) : 0 ≤ v n := by obtain ⟨k, hk⟩ := l1 ⟨n, rfl⟩ ; rw [← hk] ; positivity ++ apply (summable_condensed_iff_of_nonneg l4 (fun _ _ _ a ↦ l2 a)).mp ++ suffices this : ∀ᶠ k : ℕ in atTop, 2 ^ k * v (2 ^ k) = ((k : ℝ) ^ 2)⁻¹ * ((Real.log 2) ^ 2)⁻¹ by ++ exact (summable_congr_ae this).mpr <| (Real.summable_nat_pow_inv.mpr one_lt_two).mul_right _ ++ have l5 : ∀ᶠ k in atTop, v (2 ^ k) = u (2 ^ k) := ++ l3.comp_tendsto <| tendsto_pow_atTop_atTop_of_one_lt Nat.le.refl ++ filter_upwards [l5, l8] with k l5 l8 ++ simp only [l5, mul_inv_rev, Nat.cast_pow, Nat.cast_ofNat, log_pow, u] ++ field_simp ++ ++lemma tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ Tendsto (fun x => a * x + b) atTop atTop := ++ tendsto_atTop_add_const_right _ b (tendsto_id.const_mul_atTop ha) ++ ++lemma isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} ++ (hf : Tendsto f atTop atTop) : (fun _ => a) =o[atTop] f := by ++ simp [tendsto_norm_atTop_atTop.comp hf] ++ ++lemma isBigO_pow_pow_of_le {m n : ℕ} (h : m ≤ n) : ++ (fun x : ℝ => x ^ m) =O[atTop] (fun x : ℝ => x ^ n) := by ++ apply IsBigO.of_bound 1 ++ filter_upwards [eventually_ge_atTop 1] with x l1 ++ simpa [abs_eq_self.mpr (zero_le_one.trans l1)] using pow_le_pow_right₀ l1 h ++ ++lemma isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by ++ apply IsLittleO.add ++ · apply IsLittleO.const_mul_left ; simpa using isLittleO_pow_pow_atTop_of_lt (𝕜 := ℝ) one_lt_two ++ · apply isLittleO_const_of_tendsto_atTop _ <| tendsto_pow_atTop (by linarith) ++ ++lemma log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ (fun x => Real.log (a * x + b)) =O[atTop] Real.log := by ++ apply IsBigO.of_bound (2 : ℕ) ++ have l2 : ∀ᶠ x : ℝ in atTop, 0 ≤ log x := tendsto_atTop.mp tendsto_log_atTop 0 ++ have l3 : ∀ᶠ x : ℝ in atTop, 0 ≤ log (a * x + b) := ++ tendsto_atTop.mp (tendsto_log_atTop.comp (tendsto_mul_add_atTop ha b)) 0 ++ have l5 : ∀ᶠ x : ℝ in atTop, 1 ≤ a * x + b := tendsto_atTop.mp (tendsto_mul_add_atTop ha b) 1 ++ have l1 : ∀ᶠ x : ℝ in atTop, a * x + b ≤ x ^ 2 := by ++ filter_upwards [(isLittleO_mul_add_sq a b).eventuallyLE, l5] with x r2 l5 ++ simpa [abs_eq_self.mpr (zero_le_one.trans l5)] using r2 ++ filter_upwards [l1, l2, l3, l5] with x l1 l2 l3 l5 ++ simpa [abs_eq_self.mpr l2, abs_eq_self.mpr l3, Real.log_pow] using ++ Real.log_le_log (by linarith) l1 ++ ++lemma isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ Real.log =O[atTop] (fun x => Real.log (a * x + b)) := by ++ convert! (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto ++ (tendsto_mul_add_atTop (b := b) ha) using 1 ++ ext x ++ simp only [Function.comp_apply] ++ congr ++ field_simp ++ simp ++ ++lemma log_isbigo_log_div {d : ℝ} (hb : 0 < d) : ++ (fun n ↦ Real.log n) =O[atTop] (fun n ↦ Real.log (n / d)) := by ++ convert isBigO_log_mul_add (inv_pos.mpr hb) 0 using 1; simp only [add_zero]; field_simp ++ ++lemma Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : ++ f =O[atTop] (f + g) := by ++ rw [isLittleO_iff] at h ; specialize h (c := 2⁻¹) (by norm_num) ++ rw [isBigO_iff''] ++ refine ⟨2⁻¹, by norm_num, ?_⟩ ++ filter_upwards [h] with x h ++ simp only [norm_eq_abs, Pi.add_apply] at h ⊢ ++ calc _ = |f x| - 2⁻¹ * |f x| := by ring ++ _ ≤ |f x| - |g x| := by linarith ++ _ ≤ |(|f x| - |g x|)| := le_abs_self _ ++ _ ≤ _ := by rw [← sub_neg_eq_add, ← abs_neg (g x)] ; exact abs_abs_sub_abs_le (f x) (-g x) ++ ++lemma Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : ++ (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := by ++ simpa [pow_two] using h.mul h ++ ++lemma log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : ++ (fun x ↦ Real.log x ^ 2) =O[atTop] (fun x ↦ a + Real.log (x / b) ^ 2) := by ++ apply (Erdos970.Asymptotics.IsBigO.sq (log_isbigo_log_div hb)).trans ++ simp_rw [add_comm a] ++ refine IsBigO.add_isLittleO_right <| isLittleO_const_of_tendsto_atTop _ ?_ ++ exact (tendsto_pow_atTop two_ne_zero).comp <| ++ tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb ++ ++theorem log_add_div_isBigO_log (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ (fun x ↦ Real.log ((x + a) / b)) =O[atTop] fun x ↦ Real.log x := by ++ convert log_mul_add_isBigO_log (inv_pos.mpr hb) (a / b) using 3 ; ring ++ ++lemma log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by ++ have l1 : ContinuousOn Real.log (Icc x (x + 1)) := by ++ apply continuousOn_log.mono ; intro t ⟨h1, _⟩ ; simp ; linarith ++ have l2 t (ht : t ∈ Ioo x (x + 1)) : HasDerivAt Real.log t⁻¹ t := ++ Real.hasDerivAt_log (by linarith [ht.1]) ++ obtain ⟨t, ⟨ht1, _⟩, htx⟩ := exists_hasDerivAt_eq_slope Real.log (·⁻¹) (by linarith) l1 l2 ++ simp only [add_sub_cancel_left, div_one] at htx ++ rw [nabla, ← htx, inv_le_inv₀ (by linarith) hx] ++ exact ht1.le ++ ++lemma nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by ++ apply IsBigO.of_bound 1 ++ filter_upwards [eventually_gt_atTop 0] with x l1 ++ have l2 : log x ≤ log (x + 1) := log_le_log l1 (by linarith) ++ simpa [nabla, abs_eq_self.mpr l1.le, abs_eq_self.mpr (sub_nonneg.mpr l2)] using ++ log_add_one_sub_log_le l1 ++ ++lemma nabla_log {b : ℝ} (hb : 0 < b) : ++ nabla (fun x => Real.log (x / b)) =O[atTop] (fun x => 1 / x) := by ++ refine EventuallyEq.trans_isBigO ?_ nabla_log_main ++ filter_upwards [eventually_gt_atTop 0] with x l2 ++ rw [nabla, log_div (by linarith) (by linarith), log_div l2.ne.symm (by linarith), nabla] ; ring ++ ++lemma nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ nabla (fun x => x * (a + Real.log (x / b) ^ 2)) =O[atTop] (fun x => Real.log x ^ 2) := by ++ ++ have l1 : nabla (fun n => n * (a + Real.log (n / b) ^ 2)) = fun n => ++ a + Real.log ((n + 1) / b) ^ 2 + ++ (n * (Real.log ((n + 1) / b) ^ 2 - Real.log (n / b) ^ 2)) := by ++ ext n ; simp [nabla] ; ring ++ have l2 := (isLittleO_const_of_tendsto_atTop a ++ ((tendsto_pow_atTop two_ne_zero).comp tendsto_log_atTop)).isBigO ++ have l3 := Erdos970.Asymptotics.IsBigO.sq (log_add_div_isBigO_log 1 hb) ++ have l4 : (fun x => Real.log ((x + 1) / b) + Real.log (x / b)) =O[atTop] Real.log := by ++ simpa using (log_add_div_isBigO_log _ hb).add (log_add_div_isBigO_log 0 hb) ++ have e2 : (fun x : ℝ => x * (Real.log x * (1 / x))) =ᶠ[atTop] Real.log := by ++ filter_upwards [eventually_ge_atTop 1] with x hx using by field_simp ++ have l5 : (fun n ↦ n * (Real.log n * (1 / n))) =O[atTop] (fun n ↦ (Real.log n) ^ 2) := ++ e2.trans_isBigO ++ (by simpa using! (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) ++ ++ simp_rw [l1, _root_.sq_sub_sq] ++ exact ((l2.add l3).add (isBigO_refl (·) atTop |>.mul (l4.mul (nabla_log hb)) |>.trans l5)) ++ ++lemma nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ Tendsto (fun x => x * (a + Real.log (x / b) ^ 2)) atTop atTop := ++ tendsto_id.atTop_mul_atTop₀ <| tendsto_atTop_add_const_left _ _ <| ++ (tendsto_pow_atTop two_ne_zero).comp <| tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb ++ ++lemma nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ ∀ᶠ x in atTop, 0 < x * (a + Real.log (x / b) ^ 2) := ++ (nnabla_bound_aux1 a hb).eventually (eventually_gt_atTop 0) ++ ++lemma Real.log_eventually_gt_atTop (a : ℝ) : ++ ∀ᶠ x in atTop, a < Real.log x := ++ Real.tendsto_log_atTop.eventually (eventually_gt_atTop a) ++ ++@[local gcongr] ++theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : ++ ‖x‖ ≤ ‖y‖ := by ++ simp_rw [Real.norm_eq_abs] ++ apply abs_le_abs hxy ++ linarith ++ ++lemma nnabla_bound_aux {x : ℝ} (hx : 0 < x) : ++ nnabla (fun n ↦ 1 / (n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2))) =O[atTop] ++ (fun n ↦ 1 / (Real.log n ^ 2 * n ^ 2)) := by ++ ++ let d n : ℝ := n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2) ++ change (fun x_1 ↦ nnabla (fun n ↦ 1 / d n) x_1) =O[atTop] _ ++ ++ have l2 : ∀ᶠ n in atTop, 0 < d n := (nnabla_bound_aux2 ((2 * π) ^ 2) hx) ++ have l3 : ∀ᶠ n in atTop, 0 < d (n + 1) := ++ (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_id).eventually l2 ++ have l1 : ∀ᶠ n : ℝ in atTop, ++ nnabla (fun n ↦ 1 / d n) n = (d (n + 1) - d n) * (d n)⁻¹ * (d (n + 1))⁻¹ := by ++ filter_upwards [l2, l3] with n l2 l3 ++ rw [nnabla, one_div, one_div, inv_sub_inv l2.ne.symm l3.ne.symm, div_eq_mul_inv, mul_inv, ++ mul_assoc] ++ ++ have l4 : (fun n => (d n)⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by ++ apply IsBigO.inv_rev ++ · refine (isBigO_refl _ _).mul <| (log_sq_isbigo_mul hx) ++ · filter_upwards [Real.log_eventually_gt_atTop 0, eventually_gt_atTop 0] with x hx hx' ++ rw [← not_imp_not] ++ intro _ ++ positivity ++ have l5 : (fun n => (d (n + 1))⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by ++ refine IsBigO.trans ?_ l4 ++ rw [isBigO_iff]; use 1 ++ have e3 : ∀ᶠ n in atTop, d n ≤ d (n + 1) := by ++ filter_upwards [eventually_ge_atTop x] with n hn ++ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn ++ have : 0 ≤ n := hx.le.trans hn ++ simp only [d] ++ gcongr <;> simp [Real.log_nonneg, *] ++ filter_upwards [l2, l3, e3] with n e1 e2 e3 ++ simp_rw [one_mul] ++ gcongr ++ ++ have l6 : (fun n => d (n + 1) - d n) =O[atTop] (fun n => (Real.log n) ^ 2) := by ++ simpa [d, nabla] using! (nnabla_mul_log_sq ((2 * π) ^ 2) hx) ++ ++ apply EventuallyEq.trans_isBigO l1 ++ ++ apply ((l6.mul l4).mul l5).trans_eventuallyEq ++ filter_upwards [eventually_ge_atTop 2, Real.log_eventually_gt_atTop 0] with n hn hn' ++ field_simp ++ ++lemma nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : ++ nnabla (fun n => C / (1 + (Real.log (n / x) / (2 * π)) ^ 2) / n) =O[atTop] ++ (fun n => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by ++ field_simp ++ simp only [div_eq_mul_inv, mul_inv, nnabla_mul, one_mul] ++ apply IsBigO.const_mul_left ++ simpa [div_eq_mul_inv, mul_pow, mul_comm] using nnabla_bound_aux hx ++ ++def chebyWith (C : ℝ) (f : ℕ → ℂ) : Prop := ∀ n, cumsum (‖f ·‖) n ≤ C * n ++ ++def cheby (f : ℕ → ℂ) : Prop := ∃ C, chebyWith C f ++ ++lemma cheby.bigO (h : cheby f) : cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by ++ have l1 : 0 ≤ cumsum (‖f ·‖) := cumsum_nonneg (fun _ => norm_nonneg _) ++ obtain ⟨C, hC⟩ := h ++ apply isBigO_of_le' (c := C) atTop ++ intro n ++ rw [Real.norm_eq_abs, abs_eq_self.mpr (l1 n)] ++ simpa using hC n ++ ++lemma limiting_fourier_lim1_aux (hcheby : cheby f) (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : ++ Summable fun n ↦ ‖f n‖ / ↑n * (C / (1 + (1 / (2 * π) * Real.log (↑n / x)) ^ 2)) := by ++ ++ let a (n : ℕ) := (C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2) / ↑n) ++ replace hcheby := hcheby.bigO ++ ++ have l1 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n : ℕ => (↑(n + 1) : ℝ)) := ++ hcheby.comp_tendsto <| tendsto_add_atTop_nat 1 ++ have l2 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n => (n : ℝ)) := ++ l1.trans ++ (by simpa using (isBigO_refl _ _).add <| isBigO_iff.mpr ⟨1, by simpa using ⟨1, by tauto⟩⟩) ++ have l5 : BoundedAtFilter atTop (fun n : ℕ => C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2)) := by ++ simp only [BoundedAtFilter] ++ field_simp ++ apply isBigO_of_le' (c := C) ; intro n ++ have : 0 ≤ 2 ^ 2 * π ^ 2 + Real.log (n / x) ^ 2 := by positivity ++ simp only [norm_div, norm_mul, norm_eq_abs, abs_eq_self.mpr hC, norm_pow, ++ abs_eq_self.mpr pi_nonneg, abs_eq_self.mpr this, Pi.one_apply, one_mem, ++ CStarRing.norm_of_mem_unitary, mul_one, ge_iff_le, Nat.abs_ofNat] ++ apply div_le_of_le_mul₀ this hC ++ rw [mul_add, ← mul_assoc] ++ apply le_add_of_le_of_nonneg le_rfl ++ positivity ++ have l3 : a =O[atTop] (fun n => 1 / (n : ℝ)) := by ++ simpa [a] using! IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) ++ have l4 : nnabla a =O[atTop] (fun n : ℕ => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by ++ convert Erdos970.Asymptotics.IsBigO.natCast (nnabla_bound C hx) ++ simp [nnabla, a] ++ ++ simp_rw [div_mul_eq_mul_div, mul_div_assoc, one_mul] ++ apply dirichlet_test' ++ · intro n ; exact norm_nonneg _ ++ · intro n ; positivity ++ · apply (l2.mul l3).trans_eventuallyEq ++ apply eventually_of_mem (Ici_mem_atTop 1) ++ intro x (hx : 1 ≤ x) ++ have : x ≠ 0 := Nat.one_le_iff_ne_zero.mp hx ++ simp [this] ++ · have : ∀ᶠ n : ℕ in atTop, x ≤ n := by simpa using eventually_ge_atTop ⌈x⌉₊ ++ filter_upwards [this] with n hn ++ have e1 : 0 < (n : ℝ) := by linarith ++ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn ++ have e3 := Nat.le_succ n ++ gcongr ++ refine div_nonneg (Real.log_nonneg e2) (by norm_num [pi_nonneg]) ++ · apply summable_of_isBigO_nat summable_inv_mul_log_sq ++ apply (l2.mul l4).trans_eventuallyEq ++ apply eventually_of_mem (Ici_mem_atTop 2) ++ intro x (hx : 2 ≤ x) ++ have : (x : ℝ) ≠ 0 := by simp ; linarith ++ have : Real.log x ≠ 0 := by ++ have ll : 2 ≤ (x : ℝ) := by simp [hx] ++ simp ++ grind ++ field_simp ++ ++theorem limiting_fourier_lim1 (hcheby : cheby f) (ψ : W21) (hx : 0 < x) : ++ Tendsto (fun σ' : ℝ ↦ ++ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x))) (𝓝[>] 1) ++ (𝓝 (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x)))) := by ++ ++ obtain ⟨C, hC⟩ := decay_bounds_cor ψ ++ have : 0 ≤ C := by simpa using (norm_nonneg _).trans (hC 0) ++ refine tendsto_tsum_of_dominated_convergence ++ (limiting_fourier_lim1_aux hcheby hx C this) (fun n => ?_) ?_ ++ · apply Tendsto.mul_const ++ by_cases h : n = 0 <;> simp only [term, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, ++ tendsto_const_nhds_iff] ++ refine tendsto_const_nhds.div ?_ (by simp [h]) ++ simpa using ((continuous_ofReal.tendsto 1).mono_left nhdsWithin_le_nhds).const_cpow ++ · rw [eventually_nhdsWithin_iff] ++ apply Eventually.of_forall ++ intro σ' (hσ' : 1 < σ') n ++ rw [norm_mul, ← nterm_eq_norm_term] ++ refine mul_le_mul ?_ (hC _) (norm_nonneg _) (div_nonneg (norm_nonneg _) (Nat.cast_nonneg _)) ++ by_cases h : n = 0 <;> simp only [nterm, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, le_refl] ++ have : 1 ≤ (n : ℝ) := by simpa using! Nat.pos_iff_ne_zero.mpr h ++ refine div_le_div₀ (norm_nonneg _) le_rfl (by simpa [Nat.pos_iff_ne_zero]) ?_ ++ simpa using Real.rpow_le_rpow_of_exponent_le this hσ'.le ++ ++theorem limiting_fourier_lim2_aux (x : ℝ) (C : ℝ) : ++ Integrable (fun t ↦ max |x| 1 * (C / (1 + (t / (2 * π)) ^ 2))) ++ (Measure.restrict volume (Ici (-Real.log x))) := by ++ simp_rw [div_eq_mul_inv C] ++ exact (((integrable_inv_one_add_sq.comp_div ++ (by simp [pi_ne_zero])).const_mul _).const_mul _).restrict ++ ++theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : ++ Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * ++ ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) ++ (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by ++ ++ obtain ⟨C, hC⟩ := decay_bounds_cor ψ ++ apply Tendsto.mul ++ · suffices h : Tendsto (fun σ' : ℝ ↦ ofReal (x ^ (1 - σ'))) (𝓝[>] 1) (𝓝 1) by ++ simpa using h.const_mul ↑A ++ suffices h : Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) from ++ (continuous_ofReal.tendsto 1).comp h ++ have : Tendsto (fun σ' : ℝ ↦ σ') (𝓝 1) (𝓝 1) := fun _ a ↦ a ++ have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := ++ tendsto_nhdsWithin_of_tendsto_nhds (by simpa using this.const_sub 1) ++ simpa using tendsto_const_nhds.rpow this (Or.inl (zero_lt_one.trans_le hx).ne.symm) ++ · refine tendsto_integral_filter_of_dominated_convergence _ ?_ ?_ ++ (limiting_fourier_lim2_aux x C) ?_ ++ · apply Eventually.of_forall ; intro σ' ++ apply Continuous.aestronglyMeasurable ++ have := continuous_FourierIntegral ψ ++ continuity ++ · apply eventually_of_mem (U := Ioo 1 2) ++ · apply Ioo_mem_nhdsGT_of_mem ; simp ++ · intro σ' ⟨h1, h2⟩ ++ rw [ae_restrict_iff' measurableSet_Ici] ++ apply Eventually.of_forall ++ intro t (ht : - Real.log x ≤ t) ++ rw [norm_mul] ++ have hdom_nonneg : 0 ≤ max |x| 1 := by ++ exact (abs_nonneg x).trans (le_max_left _ _) ++ refine mul_le_mul ?_ (hC _) (norm_nonneg _) hdom_nonneg ++ simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, norm_exp, ++ neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, sub_self, mul_zero, ++ sub_zero] ++ have : -Real.log x * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht (by linarith) ++ have : -(t * (σ' - 1)) ≤ Real.log x * (σ' - 1) := by simpa using neg_le_neg this ++ have := Real.exp_monotone this ++ apply this.trans ++ have l1 : σ' - 1 ≤ 1 := by linarith ++ have : 0 ≤ Real.log x := Real.log_nonneg hx ++ have := mul_le_mul_of_nonneg_left l1 this ++ refine (Real.exp_monotone this).trans ?_ ++ have hxabs : |x| = x := abs_of_nonneg (zero_le_one.trans hx) ++ calc ++ Real.exp (Real.log x * 1) = |x| := by ++ simpa [mul_one, hxabs] using (Real.exp_log (zero_lt_one.trans_le hx)) ++ _ ≤ max |x| 1 := le_max_left _ _ ++ · apply Eventually.of_forall ++ intro x ++ suffices h : Tendsto (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by ++ simpa using h.mul_const _ ++ apply Tendsto.mono_left ?_ nhdsWithin_le_nhds ++ suffices h : Continuous (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) by simpa using h.tendsto 1 ++ continuity ++ ++theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : ++ Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) ++ (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by ++ ++ by_cases hh : tsupport ψ = ∅ ++ · simp [tsupport_eq_empty_iff.mp hh] ++ obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh ++ ++ let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) ++ have l1 : IsCompact S := by ++ refine Metric.isCompact_iff_isClosed_bounded.mpr ⟨?_, ?_⟩ ++ · exact isClosed_Icc.reProdIm (isClosed_tsupport ψ) ++ · exact (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded ++ have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 ++ have l3 : ContinuousOn (‖G ·‖) S := (hG.mono l2).norm ++ have l4 : S.Nonempty := ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ ++ obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn l4 l3 ++ let MG := ‖G z‖ ++ let bound (a : ℝ) : ℝ := MG * ‖ψ a‖ ++ ++ apply tendsto_integral_filter_of_dominated_convergence (bound := bound) ++ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ; intro u hu ++ apply Continuous.aestronglyMeasurable ++ apply Continuous.mul ++ · exact (hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous ++ · apply Continuous.const_cpow (by fun_prop) ; simp ; linarith ++ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ++ intro u hu ++ apply Eventually.of_forall ; intro v ++ by_cases h : v ∈ tsupport ψ ++ · have r1 : u + v * I ∈ S := by simp [S, mem_reProdIm, hu.1, hu.2, h] ++ have r2 := isMaxOn_iff.mp hmax _ r1 ++ have r4 : (x : ℂ) ≠ 0 := by simp ; linarith ++ have r5 : arg x = 0 := by simp [arg_eq_zero_iff] ; linarith ++ have r3 : ‖(x : ℂ) ^ (v * I)‖ = 1 := by simp [norm_cpow_of_ne_zero r4, r5] ++ simp_rw [norm_mul, r3, mul_one] ++ exact mul_le_mul_of_nonneg_right r2 (norm_nonneg _) ++ · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) ++ simp at this ; simp [this, bound] ++ ++ · suffices h : Continuous bound by exact h.integrable_of_hasCompactSupport ψ.h2.norm.mul_left ++ have := ψ.h1.continuous ; fun_prop ++ · apply Eventually.of_forall ; intro t ++ apply Tendsto.mul_const ++ apply Tendsto.mul_const ++ refine (hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr ⟨?_, ?_⟩ ++ · exact ((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds ++ · exact eventually_nhdsWithin_of_forall (fun x (hx : 1 < x) => by simp [hx.le]) ++ ++lemma limiting_fourier (hcheby : cheby f) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : ++ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = ++ ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by ++ ++ have l1 := limiting_fourier_lim1 hcheby ψ (by linarith) ++ have l2 := limiting_fourier_lim2 A ψ hx ++ have l3 := limiting_fourier_lim3 hG ψ hx ++ apply tendsto_nhds_unique_of_eventuallyEq (l1.sub l2) l3 ++ simpa [eventuallyEq_nhdsWithin_iff] using! Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) ++ ++lemma limiting_cor_aux {f : ℝ → ℂ} : Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by ++ ++ have l1 : ∀ᶠ x : ℝ in atTop, ∀ t : ℝ, x ^ (t * I) = exp (log x * t * I) := by ++ filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' t ++ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx'] ; ring_nf ++ ++ have l2 : ∀ᶠ x : ℝ in atTop, ∫ t, f t * x ^ (t * I) = ∫ t, f t * exp (log x * t * I) := by ++ filter_upwards [l1] with x hx ++ refine integral_congr_ae (Eventually.of_forall (fun x => by simp [hx])) ++ ++ simp_rw [tendsto_congr' l2] ++ have hFourier (x : ℝ) : (∫ t, f t * exp (log x * t * I)) = ++ 𝓕 f (-Real.log x / (2 * π)) := by ++ rw [Real.fourier_real_eq_integral_exp_smul] ++ apply integral_congr_ae ++ filter_upwards [] with t ++ rw [smul_eq_mul, mul_comm _ (f t)] ++ congr 1 ++ congr 1 ++ push_cast ++ field_simp ++ simp_rw [hFourier] ++ refine (Real.zero_at_infty_fourier f).comp <| Tendsto.mono_right ?_ _root_.atBot_le_cocompact ++ exact (tendsto_neg_atBot_iff.mpr tendsto_log_atTop).atBot_mul_const (inv_pos.mpr two_pi_pos) ++ ++lemma limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by ++ ++ apply limiting_cor_aux.congr' ++ filter_upwards [eventually_ge_atTop 1] with x hx using ++ limiting_fourier hcheby hG hG' hf ψ hx |>.symm ++ ++lemma smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, ++ (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ ++ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 := by ++ ++ obtain ⟨ψ, l1, l2, l3, l4, -⟩ := smooth_urysohn_support_Ioo h1 h3 ++ refine ⟨ψ, l1, l2, l3, l4⟩ ++ ++noncomputable def exists_trunc : trunc := by ++ choose ψ h1 h2 h3 h4 using smooth_urysohn (-2) (-1) (1) (2) (by linarith) (by linarith) ++ exact ⟨⟨ψ, h1.of_le (by norm_cast), h2⟩, h3, h4⟩ ++ ++lemma one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by ++ match n with ++ | 0 => simp ++ | 1 => simp ++ | n + 2 => { norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith } ++ ++lemma quadratic_pos (a b c x : ℝ) (ha : 0 < a) (hΔ : discrim a b c < 0) : ++ 0 < a * x ^ 2 + b * x + c := by ++ have l1 : a * x ^ 2 + b * x + c = a * (x + b / (2 * a)) ^ 2 - discrim a b c / (4 * a) := by ++ simp only [discrim]; field_simp; ring ++ have l2 : 0 < - discrim a b c := by linarith ++ rw [l1, sub_eq_add_neg, ← neg_div] ; positivity ++ ++noncomputable def pp (a x : ℝ) : ℝ := a ^ 2 * (x + 1) ^ 2 + (1 - a) * (1 + a) ++ ++noncomputable def pp' (a x : ℝ) : ℝ := a ^ 2 * (2 * (x + 1)) ++ ++lemma pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by ++ simp only [pp] ++ have : 0 < 1 - a := by linarith [ha.2] ++ have : 0 < 1 + a := by linarith [ha.1] ++ positivity ++ ++lemma pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by ++ unfold pp pp' ++ simpa using hasDerivAt_id x |>.add_const 1 |>.pow 2 |>.const_mul _ ++ ++lemma pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by ++ ext x ; exact pp_deriv a x |>.deriv ++ ++lemma pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by ++ simpa using! hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) ++ ++lemma pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by ++ ext x ; exact pp'_deriv a x |>.deriv ++ ++noncomputable def hh (a t : ℝ) : ℝ := (t * (1 + (a * log t) ^ 2))⁻¹ ++ ++noncomputable def hh' (a t : ℝ) : ℝ := - pp a (log t) * hh a t ^ 2 ++ ++lemma hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity ++ ++lemma hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by ++ by_cases h0 : t = 0 ++ · simp [hh, h0] ++ replace ht : 0 < t := lt_of_le_of_ne ht (by tauto) ++ unfold hh ++ rw [abs_inv, inv_le_inv₀ (by positivity) ht, abs_mul, abs_eq_self.mpr ht.le] ++ convert_to! t * 1 ≤ _ ++ · simp ++ apply mul_le_mul le_rfl ?_ zero_le_one ht.le ++ rw [abs_eq_self.mpr (by positivity)] ++ simp only [le_add_iff_nonneg_right] ++ positivity ++ ++lemma hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by ++ have e1 : t * (1 + (a * log t) ^ 2) ≠ 0 := mul_ne_zero ht (_root_.ne_of_lt (by positivity)).symm ++ have l5 : HasDerivAt (fun t : ℝ => log t) t⁻¹ t := Real.hasDerivAt_log ht ++ have l4 : HasDerivAt (fun t : ℝ => a * log t) (a * t⁻¹) t := l5.const_mul _ ++ have l3 : HasDerivAt (fun t : ℝ => (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := by ++ convert! l4.pow 2 using 1 ; ring ++ have l2 : HasDerivAt (fun t : ℝ => 1 + (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := ++ l3.const_add _ ++ have l1 : HasDerivAt (fun t : ℝ => t * (1 + (a * log t) ^ 2)) ++ (1 + 2 * a ^ 2 * log t + a ^ 2 * log t ^ 2) t := by ++ convert! (hasDerivAt_id' t).mul l2 using 1; field_simp; ring ++ convert! l1.inv e1 using 1; simp only [hh', pp, hh]; field_simp; ring ++ ++lemma hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := ++ fun t (ht : 0 < t) => (hh_deriv a ht.ne.symm).continuousAt.continuousWithinAt ++ ++lemma hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by ++ have := pp_pos ha (log x) ++ simp only [hh', neg_mul, Left.neg_nonpos_iff, ge_iff_le] ++ positivity ++ ++lemma hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by ++ have l1 x (hx : x ∈ interior (Ioi 0)) : ++ HasDerivWithinAt (hh a) (hh' a x) (interior (Ioi 0)) x := by ++ have : x ≠ 0 := by contrapose! hx ; simp [hx] ++ exact (hh_deriv a this).hasDerivWithinAt ++ apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) (hh_continuous _) l1 ++ (fun x _ => hh'_nonpos ha) ++ ++noncomputable def gg (x i : ℝ) : ℝ := 1 / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ++ ++lemma gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by ++ simp only [gg, hh] ++ field_simp ++ ++lemma gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by ++ simp only [gg_of_hh hx.ne.symm, one_div, mul_inv_rev, abs_mul] ++ apply mul_le_mul le_rfl (hh_le _ _ (by positivity)) (by positivity) (by positivity) |>.trans ++ (le_of_eq ?_) ++ simp [abs_inv, abs_eq_self.mpr hx.le] ; field_simp ++ ++lemma gg_le_one (i : ℕ) : gg x i ≤ 1 := by ++ by_cases hi : i = 0 <;> simp only [gg, hi, CharP.cast_eq_zero, div_zero, one_div, mul_inv_rev, ++ zero_div, Real.log_zero, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, ++ add_zero, inv_one, mul_one, zero_le_one] ++ have l1 : 1 ≤ (i : ℝ) := by simp ; omega ++ have l2 : 1 ≤ 1 + (π⁻¹ * 2⁻¹ * Real.log (↑i / x)) ^ 2 := by ++ simp only [le_add_iff_nonneg_right] ; positivity ++ rw [← mul_inv] ; apply inv_le_one_of_one_le₀ ; simpa using mul_le_mul l1 l2 zero_le_one (by simp) ++ ++lemma one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by ++ constructor ++ · trans 0 ++ · linarith ++ · positivity ++ · rw [div_lt_iff₀ (by positivity)] ++ convert_to! 1 * 1 < 2 * π ++ · simp ++ · simp ++ apply mul_lt_mul one_lt_two ?_ zero_lt_one zero_le_two ++ trans 2 ++ · exact one_le_two ++ · exact two_le_pi ++ ++lemma sum_telescopic (a : ℕ → ℝ) (n : ℕ) : ∑ i ∈ Finset.range n, (a (i + 1) - a i) = a n - a 0 := by ++ apply Finset.sum_range_sub ++ ++lemma cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ ∑ i ∈ Finset.range n, f i * g i ≤ g (n - 1) * (C * n) + (C * (↑(n - 1 - 1) + 1) * g 0 ++ - C * (↑(n - 1 - 1) + 1) * g (n - 1) - ++ ((n - 1 - 1) • (C * g 0) - ∑ x ∈ Finset.range (n - 1 - 1), C * g (x + 1))) := by ++ ++ have l1 (n : ℕ) : ++ (g n - g (n + 1)) * ∑ i ∈ Finset.range (n + 1), f i ≤ (g n - g (n + 1)) * (C * (n + 1)) := by ++ apply mul_le_mul le_rfl (by simpa using! hf' (n + 1)) ++ (Finset.sum_nonneg (fun index _ => hf index)) ?_ ++ simp only [sub_nonneg] ; apply hg' ; simp ++ have l2 (x : ℕ) : C * (↑(x + 1) + 1) - C * (↑x + 1) = C := by simp ; ring ++ have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun index _ => hf index) ++ ++ convert_to ∑ i ∈ Finset.range n, (g i) • (f i) ≤ _ ++ · simp [mul_comm] ++ rw [Finset.sum_range_by_parts, sub_eq_add_neg, ← Finset.sum_neg_distrib] ++ simp_rw [← neg_smul, neg_sub, smul_eq_mul] ++ apply _root_.add_le_add ++ · exact mul_le_mul le_rfl (hf' n) (l3 n) (hg _) ++ · apply Finset.sum_le_sum (fun n _ => l1 n) |>.trans ++ convert_to! ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ ++ · congr ; ext i ; simp ; ring ++ rw [Finset.sum_range_by_parts] ++ simp_rw [Finset.sum_range_sub', l2, smul_sub, smul_eq_mul, Finset.sum_sub_distrib, ++ Finset.sum_const, Finset.card_range] ++ apply le_of_eq ; ring_nf ++ ++lemma sum_range_succ (a : ℕ → ℝ) (n : ℕ) : ++ ∑ i ∈ Finset.range n, a (i + 1) = (∑ i ∈ Finset.range (n + 1), a i) - a 0 := by ++ have := Finset.sum_range_sub a n ++ rw [Finset.sum_sub_distrib, sub_eq_iff_eq_add] at this ++ rw [Finset.sum_range_succ, this] ; ring ++ ++lemma cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ ∑ i ∈ Finset.range n, f i * g i ≤ ++ C * n * g (n - 1) ++ + C * cumsum g (n - 1 - 1 + 1) ++ - C * (↑(n - 1 - 1) + 1) * g (n - 1) ++ := by ++ have := cancel_aux hf hg hf' hg' n ++ simp only [nsmul_eq_mul, ← Finset.mul_sum, sum_range_succ] at this ++ convert this using 1 ; unfold cumsum ; ring ++ ++lemma cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) (hn : 2 ≤ n) : ++ cumsum (f * g) n ≤ C * cumsum g n := by ++ convert! cancel_aux' hf hg hf' hg' n using 1 ++ match n with ++ | n + 2 => simp only [cumsum_succ] ; push_cast ; ring ++ ++lemma cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ cumsum (f * g) n ≤ C * cumsum g n := by ++ match n with ++ | 0 => simp [cumsum] ++ | 1 => specialize hg 0 ; specialize hf' 1 ; simp only [cumsum, Finset.range_one, ++ Finset.sum_singleton, hf0, Nat.cast_one, mul_one, Pi.zero_apply, Pi.mul_apply, zero_mul, ++ ge_iff_le] at hf' hg ⊢ ; positivity ++ | n + 2 => convert! cancel_aux' hf hg hf' hg' (n + 2) using 1 ; simp [cumsum_succ] ; ring ++ ++theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneOn f (Ioc x₀ (x₀ + n))) ++ (hfi : IntegrableOn f (Icc x₀ (x₀ + n))) : ++ (∑ i ∈ Finset.range n, f (x₀ + ↑(i + 1))) ≤ ∫ x in x₀..x₀ + n, f x := by ++ ++ cases n with simp only [Nat.cast_add, Nat.cast_one, CharP.cast_eq_zero, add_zero, ++ lt_self_iff_false, not_false_eq_true, ++ Ioc_eq_empty, Finset.range_zero, Nat.cast_add, Nat.cast_one, Finset.sum_empty, ++ intervalIntegral.integral_same, le_refl] at hf ⊢ ++ | succ n => ++ have : Finset.range (n + 1) = {0} ∪ Finset.Ico 1 (n + 1) := by ++ ext i ; by_cases hi : i = 0 <;> simp [hi] ; omega ++ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, ++ lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, and_true, not_false_eq_true, ++ Finset.sum_insert, CharP.cast_eq_zero, zero_add, ge_iff_le] ++ ++ have l4 : IntervalIntegrable f volume x₀ (x₀ + 1) := by ++ apply IntegrableOn.intervalIntegrable ++ simp only [le_add_iff_nonneg_right, zero_le_one, uIcc_of_le] ++ apply hfi.mono_set ++ apply Icc_subset_Icc le_rfl ++ simp ++ have l5 x (hx : x ∈ Ioc x₀ (x₀ + 1)) : (fun x ↦ f (x₀ + 1)) x ≤ f x := by ++ rcases hx with ⟨hx1, hx2⟩ ++ refine hf ⟨hx1, by linarith⟩ ⟨by linarith, by linarith⟩ hx2 ++ have l6 : ∫ x in x₀..x₀ + 1, f (x₀ + 1) = f (x₀ + 1) := by simp ++ ++ have l1 : f (x₀ + 1) ≤ ∫ x in x₀..x₀ + 1, f x := by ++ rw [← l6] ; apply intervalIntegral.integral_mono_ae_restrict (by linarith) (by simp) l4 ++ apply eventually_of_mem _ l5 ++ have : (Ioc x₀ (x₀ + 1))ᶜ ∩ Icc x₀ (x₀ + 1) = {x₀} := by simp [← sdiff_eq_compl_inter] ++ simp only [mem_ae_iff, Measure.restrict_apply measurableSet_Ioc.compl, this, ++ measure_singleton] ++ ++ have l2 : AntitoneOn (fun x ↦ f (x₀ + x)) (Icc 1 ↑(n + 1)) := by ++ intro u ⟨hu1, _⟩ v ⟨_, hv2⟩ huv ; push_cast at hv2 ++ refine hf ⟨?_, ?_⟩ ⟨?_, ?_⟩ ?_ <;> linarith ++ ++ have l3 := @AntitoneOn.sum_le_integral_Ico 1 (n + 1) (fun x => f (x₀ + x)) (by simp) ++ (by simpa using l2) ++ ++ simp only [Nat.cast_add, Nat.cast_one, intervalIntegral.integral_comp_add_left] at l3 ++ convert! _root_.add_le_add l1 l3 ++ ++ have := @intervalIntegral.integral_comp_mul_add ℝ _ _ 1 (n + 1) 1 f one_ne_zero x₀ ++ rw [intervalIntegral.integral_add_adjacent_intervals] ++ · exact l4 ++ · apply IntegrableOn.intervalIntegrable ++ simp only [add_le_add_iff_left, le_add_iff_nonneg_left, Nat.cast_nonneg, uIcc_of_le] ++ apply hfi.mono_set ++ apply Icc_subset_Icc ++ · linarith ++ · simp ++ ++lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ (IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0)) ∧ ++ (∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π) := by ++ ++ rw [integrableOn_Ici_iff_integrableOn_Ioi] ++ simp only [hh] ++ ++ let g (x : ℝ) := (a * c / b) * Real.arctan (b * log (x / c)) ++ let g₀ (x : ℝ) := if x = 0 then ((a * c / b) * (- (π / 2))) else g x ++ let g' (x : ℝ) := a * (x / c * (1 + (b * Real.log (x / c)) ^ 2))⁻¹ ++ ++ have l3 (x) (hx : 0 < x) : HasDerivAt Real.log x⁻¹ x := by apply Real.hasDerivAt_log (by linarith) ++ have l4 (x) : HasDerivAt (fun t => t / c) (1 / c) x := (hasDerivAt_id x).div_const c ++ have l2 (x) (hx : 0 < x) : HasDerivAt (fun t => log (t / c)) x⁻¹ x := by ++ have := @HasDerivAt.comp _ _ _ _ _ _ (fun t => t / c) _ _ _ (l3 (x / c) (by positivity)) (l4 x) ++ convert! this using 1 ; field_simp ++ have l5 (x) (hx : 0 < x) := (l2 x hx).const_mul b ++ have l1 (x) (hx : 0 < x) := (l5 x hx).arctan ++ have l6 (x) (hx : 0 < x) : HasDerivAt g (g' x) x := by ++ convert! (l1 x hx).const_mul (a * c / b) using 1 ++ simp only [g'] ++ field_simp ++ have key (x) (hx : 0 < x) : HasDerivAt g₀ (g' x) x := by ++ apply (l6 x hx).congr_of_eventuallyEq ++ apply eventually_of_mem <| Ioi_mem_nhds hx ++ intro y (hy : 0 < y) ++ simp [g₀, hy.ne.symm] ++ ++ have k1 : Tendsto g₀ atTop (𝓝 ((a * c / b) * (π / 2))) := by ++ have : g =ᶠ[atTop] g₀ := by ++ apply eventually_of_mem (Ioi_mem_atTop 0) ++ intro y (hy : 0 < y) ++ simp [g₀, hy.ne.symm] ++ apply Tendsto.congr' this ++ apply Tendsto.const_mul ++ apply (tendsto_arctan_atTop.mono_right nhdsWithin_le_nhds).comp ++ apply Tendsto.const_mul_atTop hb ++ apply tendsto_log_atTop.comp ++ apply Tendsto.atTop_div_const hc ++ apply tendsto_id ++ ++ have k2 : Tendsto g₀ (𝓝[>] 0) (𝓝 (g₀ 0)) := by ++ have : g =ᶠ[𝓝[>] 0] g₀ := by ++ apply eventually_of_mem self_mem_nhdsWithin ++ intro x (hx : 0 < x) ; simp [g₀, hx.ne.symm] ++ simp only [g₀] ++ apply Tendsto.congr' this ++ apply Tendsto.const_mul ++ apply (tendsto_arctan_atBot.mono_right nhdsWithin_le_nhds).comp ++ apply Tendsto.const_mul_atBot hb ++ apply tendsto_log_nhdsGT_zero.comp ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨c * ε, by positivity, fun x hx1 hx2 => ⟨?_, ?_⟩⟩ ++ · simp only [mem_Ioi] at hx1 ⊢ ; positivity ++ · simp only [dist_zero_right, norm_eq_abs, norm_div, abs_eq_self.mpr hc.le] at hx2 ⊢ ++ rwa [div_lt_iff₀ hc, mul_comm] ++ ++ have k3 : ContinuousWithinAt g₀ (Ici 0) 0 := by ++ rw [Metric.continuousWithinAt_iff] ++ rw [Metric.tendsto_nhdsWithin_nhds] at k2 ++ intro epsilon hepsilon ++ obtain ⟨delta, hdelta, hbound⟩ := k2 epsilon hepsilon ++ refine ⟨delta, hdelta, ?_⟩ ++ intro point hpoint hdist ++ change 0 ≤ point at hpoint ++ rcases lt_or_eq_of_le hpoint with hpositive | hzero ++ · exact hbound hpositive hdist ++ · simp [g₀, hzero.symm, hepsilon] ++ ++ have k4 : ∀ x ∈ Ioi 0, 0 ≤ g' x := by ++ intro x (hx : 0 < x) ; simp only [mul_inv_rev, inv_div, g'] ; positivity ++ ++ constructor ++ · convert_to IntegrableOn g' _ ++ exact integrableOn_Ioi_deriv_of_nonneg k3 key k4 k1 ++ · have := integral_Ioi_of_hasDerivAt_of_nonneg k3 key k4 k1 ++ simp only [mul_inv_rev, inv_div, mul_neg, ↓reduceIte, sub_neg_eq_add, g', g₀] at this ⊢ ++ convert this using 1 ; field_simp ; ring ++ ++lemma hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0) := ++ hh_integrable_aux ha hb hc |>.1 ++ ++lemma hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ ∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π := ++ hh_integrable_aux ha hb hc |>.2 ++ ++lemma hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by ++ have := hh_integral (a := 1) (b := 1 / (2 * π)) (c := 1) ++ (by positivity) (by positivity) (by positivity) ++ convert this using 1 <;> simp ; ring ++ ++lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ ++ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by ++ ++ let ggg (i : ℕ) : ℝ := if i = 0 then 1 else gg x i ++ ++ have l0 : x ≠ 0 := by linarith ++ have l1 i : 0 ≤ ggg i := by by_cases hi : i = 0 <;> simp only [gg, one_div, mul_inv_rev, hi, ++ ↓reduceIte, zero_le_one, ggg] ; positivity ++ have l2 : Antitone ggg := by ++ intro i j hij ; by_cases hi : i = 0 <;> by_cases hj : j = 0 <;> simp only [hj, ↓reduceIte, hi, ++ le_refl, ggg] ++ · exact gg_le_one _ ++ · omega ++ · simp only [gg_of_hh l0] ++ gcongr ++ apply hh_antitone one_div_two_pi_mem_Ioo ++ · simp only [mem_Ioi] ; positivity ++ · simp only [mem_Ioi] ; positivity ++ · gcongr ++ have l3 : 0 ≤ C := by simpa [cumsum, hf0] using hf 1 ++ ++ have l4 : 0 ≤ ∫ (t : ℝ) in Ioi 0, hh (π⁻¹ * 2⁻¹) t := ++ setIntegral_nonneg measurableSet_Ioi (fun x hx => hh_nonneg _ (LT.lt.le hx)) ++ ++ have l5 {n : ℕ} : AntitoneOn (fun t ↦ x⁻¹ * hh (1 / (2 * π)) (t / x)) (Ioc 0 n) := by ++ intro u ⟨hu1, _⟩ v ⟨hv1, _⟩ huv ++ simp only ++ apply mul_le_mul le_rfl ?_ (hh_nonneg _ (by positivity)) (by positivity) ++ apply hh_antitone one_div_two_pi_mem_Ioo (by simp only [mem_Ioi] ; positivity) ++ (by simp only [mem_Ioi] ; positivity) ++ apply (div_le_div_iff_of_pos_right (by positivity)).mpr huv ++ ++ have l6 {n : ℕ} : IntegrableOn (fun t ↦ x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (Icc 0 n) volume := by ++ apply IntegrableOn.mono_set ++ (hh_integrable (by positivity) (by positivity) (by positivity)) Icc_subset_Ici_self ++ ++ apply Real.tsum_le_of_sum_range_le (fun n => by positivity) ; intro n ++ convert_to! ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ ++ · congr ; ext i ++ by_cases hi : i = 0 ++ · simp [hi, hf0] ++ · simp only [gg, hi, ↓reduceIte, ggg] ++ field_simp ++ ++ apply cancel_main' (fun _ => norm_nonneg _) (by simp [hf0]) l1 hf l2 n |>.trans ++ gcongr ; simp only [cumsum, gg_of_hh l0, one_div, mul_inv_rev, ggg] ++ ++ by_cases hn : n = 0 ++ · simp only [hn, Finset.range_zero, Finset.sum_empty] ; positivity ++ replace hn : 0 < n := by omega ++ have : Finset.range n = {0} ∪ Finset.Ico 1 n := by ++ ext i ; simp ; by_cases hi : i = 0 <;> simp [hi, hn] ; omega ++ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, ++ false_and, not_false_eq_true, Finset.sum_insert, ↓reduceIte, add_le_add_iff_left, ge_iff_le] ++ convert_to! ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ ++ · apply Finset.sum_congr rfl (fun i hi => ?_) ++ simp at hi ++ have : i ≠ 0 := by omega ++ simp [this] ++ simp_rw [Finset.sum_Ico_eq_sum_range, add_comm 1] ++ have := @sum_le_integral 0 (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (n - 1) ++ (by simpa using l5) (by simpa using l6) ++ simp only [zero_add] at this ++ apply this.trans ++ rw [@intervalIntegral.integral_comp_div ℝ _ _ 0 ↑(n - 1) x (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t)) l0] ++ simp only [zero_div, intervalIntegral.integral_const_mul, smul_eq_mul, ← mul_assoc, ++ mul_inv_cancel₀ l0, one_mul] ++ have : (0 : ℝ) ≤ ↑(n - 1) / x := by positivity ++ rw [intervalIntegral.intervalIntegral_eq_integral_uIoc] ++ simp only [this, ↓reduceIte, uIoc_of_le, smul_eq_mul, one_mul, ge_iff_le] ++ apply integral_mono_measure ++ · apply Measure.restrict_mono Ioc_subset_Ioi_self le_rfl ++ · apply eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) ++ intro x (hx : 0 < x) ++ apply hh_nonneg _ hx.le ++ · have := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) ++ simpa using! this.mono_set Ioi_subset_Ici_self ++ ++lemma bound_sum_log0 {C : ℝ} (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ ++ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by ++ ++ let f0 i := if i = 0 then 0 else f i ++ have l1 : chebyWith C f0 := by ++ intro n ; refine Finset.sum_le_sum (fun i _ => ?_) |>.trans (hf n) ++ by_cases hi : i = 0 <;> simp [hi, f0] ++ have l2 i : ‖f i‖ / i = ‖f0 i‖ / i := by by_cases hi : i = 0 <;> simp [hi, f0] ++ simp_rw [l2] ; apply bound_sum_log rfl l1 hx ++ ++lemma bound_sum_log' {C : ℝ} (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + 2 * π ^ 2) := by ++ simpa only [hh_integral'] using bound_sum_log0 hf hx ++ ++variable (f x) in ++lemma summable_fourier_aux (ψ : W21) (i : ℕ) : ++ ‖f i / i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (i / x))‖ ≤ ++ W21.norm ψ * (‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹) := by ++ convert! mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) ++ (norm_nonneg (f i / i)) using 1 ++ · simp ++ · change _ = _ * (W21.norm ψ * _) ++ simp only [W21.norm, mul_inv_rev, one_div, Complex.norm_div, RCLike.norm_natCast] ++ ring ++ ++lemma summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : ++ Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by ++ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by ++ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) ++ have l6 := summable_fourier_aux x f ψ ++ exact Summable.of_nonneg_of_le (fun _ => norm_nonneg _) l6 ++ (by simpa using l5.const_smul (W21.norm ψ)) ++ ++lemma bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ ++ W21.norm ψ • ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ := by ++ ++ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by ++ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) ++ have l6 := summable_fourier_aux x f ψ ++ have l1 : Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by ++ exact summable_fourier x hx ψ hcheby ++ apply (norm_tsum_le_tsum_norm l1).trans ++ simpa only [← Summable.tsum_const_smul _ l5] using! ++ Summable.tsum_mono l1 (by simpa using l5.const_smul (W21.norm ψ)) l6 ++ ++lemma bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) (hcheby : chebyWith C f) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ ++ W21.norm ψ * C * (1 + 2 * π ^ 2) := by ++ ++ apply bound_I1 x (by linarith) ψ ⟨_, hcheby⟩ |>.trans ++ rw [smul_eq_mul, mul_assoc] ++ apply mul_le_mul le_rfl (bound_sum_log' hcheby hx) ?_ W21.norm_nonneg ++ apply tsum_nonneg (fun i => by positivity) ++ ++lemma bound_I2 (x : ℝ) (ψ : W21) : ++ ‖∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ W21.norm ψ * (2 * π ^ 2) := by ++ ++ have key a : ‖𝓕 (ψ : ℝ → ℂ) (a / (2 * π))‖ ≤ W21.norm ψ * (1 + (a / (2 * π)) ^ 2)⁻¹ := ++ decay_bounds_key ψ _ ++ have twopi : 0 ≤ 2 * π := by simp [pi_nonneg] ++ have l3 : Integrable (fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹) := ++ integrable_inv_one_add_sq.comp_div (by norm_num [pi_ne_zero]) ++ have l2 : IntegrableOn (fun i ↦ W21.norm ψ * (1 + (i / (2 * π)) ^ 2)⁻¹) (Ici (-Real.log x)) := by ++ exact (l3.const_mul _).integrableOn ++ have l1 : IntegrableOn (fun i ↦ ‖𝓕 (ψ : ℝ → ℂ) (i / (2 * π))‖) (Ici (-Real.log x)) := by ++ refine ((l3.const_mul (W21.norm ψ)).mono' ?_ ?_).integrableOn ++ · apply Continuous.aestronglyMeasurable ; fun_prop ++ · simp only [norm_norm, key] ; simp ++ have l5 : 0 ≤ᵐ[volume] fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹ := by ++ apply Eventually.of_forall ; intro x ; positivity ++ refine (norm_integral_le_integral_norm _).trans <| (setIntegral_mono l1 l2 key).trans ?_ ++ rw [integral_const_mul] ; gcongr ++ · apply W21.norm_nonneg ++ refine (setIntegral_le_integral l3 l5).trans ?_ ++ rw [Measure.integral_comp_div (fun x => (1 + x ^ 2)⁻¹) (2 * π)] ++ simp [abs_eq_self.mpr twopi] ; ring_nf ; rfl ++ ++lemma bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) ++ (hcheby : chebyWith C f) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ ++ W21.norm ψ * (C * (1 + 2 * π ^ 2) + ‖A‖ * (2 * π ^ 2)) := by ++ ++ have l1 := bound_I1' x hx ψ hcheby ++ have l2 := mul_le_mul (le_refl ‖A‖) (bound_I2 x ψ) (by positivity) (by positivity) ++ apply norm_sub_le _ _ |>.trans ; rw [norm_mul] ++ convert _root_.add_le_add l1 l2 using 1 ; ring ++ ++lemma limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by ++ ++ let S1 x (ψ : ℝ → ℂ) := ∑' (n : ℕ), f n / ↑n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑n / x)) ++ let S2 x (ψ : ℝ → ℂ) := ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) ++ let S x ψ := S1 x ψ - S2 x ψ ; change Tendsto (fun x ↦ S x ψ) atTop (𝓝 0) ++ ++ obtain g := exists_trunc ++ let Ψ R := g.scale R * ψ ++ have key R : Tendsto (fun x ↦ S x (Ψ R)) atTop (𝓝 0) := limiting_cor (Ψ R) hf hcheby hG hG' ++ ++ obtain ⟨C, hcheby⟩ := hcheby ++ have hC : 0 ≤ C := by ++ have : ‖f 0‖ ≤ C := by simpa [cumsum] using hcheby 1 ++ have : 0 ≤ ‖f 0‖ := by positivity ++ linarith ++ have key2 : Tendsto (fun R ↦ W21.norm (ψ - Ψ R)) atTop (𝓝 0) := W21_approximation ψ g ++ simp_rw [Metric.tendsto_nhds] at key key2 ⊢ ; intro ε hε ++ let M := C * (1 + 2 * π ^ 2) + ‖(A : ℂ)‖ * (2 * π ^ 2) ++ obtain ⟨R, hRψ⟩ := (key2 ((ε / 2) / (1 + M)) (by positivity)).exists ++ simp only [dist_zero_right, Real.norm_eq_abs, abs_eq_self.mpr W21.norm_nonneg] at hRψ key ++ ++ filter_upwards [eventually_ge_atTop 1, key R (ε / 2) (by positivity)] with x hx key ++ ++ have key3 : ‖S x (ψ - Ψ R)‖ < ε / 2 := by ++ have : ‖S x _‖ ≤ _ * M := @bound_main f C A x hx (ψ - Ψ R) hcheby ++ apply this.trans_lt ++ apply (mul_le_mul (d := 1 + M) le_rfl (by simp) (by positivity) W21.norm_nonneg).trans_lt ++ have : 0 < 1 + M := by positivity ++ convert! (mul_lt_mul_iff_left₀ this).mpr hRψ using 1 ; field_simp ++ ++ have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := by ++ have l1 : AEStronglyMeasurable (fun x_1 : ℝ ↦ cexp (-(2 * ↑π * (↑x_1 * ↑x) * I))) volume := by ++ refine (Continuous.mul ?_ continuous_const).neg.cexp.aestronglyMeasurable ++ apply continuous_const.mul <| contDiff_ofReal.continuous.mul continuous_const ++ simp only [Real.fourier_eq', neg_mul, RCLike.inner_apply', conj_trivial, ofReal_neg, ++ ofReal_mul, ofReal_ofNat, Pi.sub_apply, smul_eq_mul, mul_sub] ++ apply integral_sub ++ · apply ψ.hf.bdd_mul (c := 1) l1 ; simp [Complex.norm_exp] ++ · apply (Ψ R : W21) |>.hf |>.bdd_mul (c := 1) l1 ++ simp [Complex.norm_exp] ++ ++ have S1_sub : S1 x (ψ - Ψ R) = S1 x ψ - S1 x (Ψ R) := by ++ simp only [one_div, mul_inv_rev, S1_sub_1, mul_sub, S1] ; apply Summable.tsum_sub ++ · have := summable_fourier x (by positivity) ψ ⟨_, hcheby⟩ ++ rw [summable_norm_iff] at this ++ simpa using this ++ · have := summable_fourier x (by positivity) (Ψ R) ⟨_, hcheby⟩ ++ rw [summable_norm_iff] at this ++ simpa using! this ++ ++ have S2_sub : S2 x (ψ - Ψ R) = S2 x ψ - S2 x (Ψ R) := by ++ simp only [S1_sub_1, S2] ; rw [integral_sub] ++ · ring ++ · exact ψ.integrable_fourier (by positivity) |>.restrict ++ · exact (Ψ R : W21).integrable_fourier (by positivity) |>.restrict ++ ++ have S_sub : S x (ψ - Ψ R) = S x ψ - S x (Ψ R) := by simp [S, S1_sub, S2_sub] ; ring ++ simpa [S_sub, Ψ] using norm_add_le _ _ |>.trans_lt (_root_.add_lt_add key3 key) ++ ++lemma limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := ++ limiting_cor_W21 ψ hf hcheby hG hG' ++ ++lemma fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by ++ refine ⟨𝓕⁻ f, ?_⟩ ++ exact FourierTransform.fourier_fourierInv_eq f ++ ++noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) ++ (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) where ++ toFun := f ++ smooth' := h1 ++ decay' k n := by ++ have l1 : Continuous (fun x => ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) := by ++ have : ContDiff ℝ ∞ (iteratedFDeriv ℝ n f) := h1.iteratedFDeriv_right (mod_cast le_top) ++ exact Continuous.mul (by continuity) this.continuous.norm ++ have l2 : HasCompactSupport (fun x ↦ ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) := ++ (h2.iteratedFDeriv _).norm.mul_left ++ simpa using l1.bounded_above_of_compact_support l2 ++ ++@[simp] lemma toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl ++ ++lemma comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ ∀ᶠ x in 𝓝 0, Ψ x = 0 := ++ notMem_tsupport_iff_eventuallyEq.mp (fun h => lt_irrefl 0 <| mem_Ioi.mp (hplus h)) ++ ++lemma comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ ∀ᶠ x in atBot, Ψ (exp x) = 0 := ++ Real.tendsto_exp_atBot <| comp_exp_support0 hplus ++ ++lemma comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : ++ ∀ᶠ (x : ℝ) in atTop, (Ψ ∘ rexp) x = 0 := by ++ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, ++ cocompact_eq_atBot_atTop] at hsupp ++ exact Real.tendsto_exp_atTop hsupp.2 ++ ++theorem comp_exp_support {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : HasCompactSupport (Ψ ∘ rexp) := by ++ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, ++ cocompact_eq_atBot_atTop] ++ exact ⟨comp_exp_support1 hplus, comp_exp_support2 hsupp⟩ ++ ++lemma wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) (x : ℝ) (hx : 0 < x) : ++ ∫ (u : ℝ) in Ioi (-Real.log x), ↑(rexp u) * Ψ (rexp u) = ∫ (y : ℝ) in Ioi (1 / x), Ψ y := by ++ ++ have l1 : ContinuousOn rexp (Ici (-Real.log x)) := by fun_prop ++ have l2 : Tendsto rexp atTop atTop := Real.tendsto_exp_atTop ++ have l3 t (_ : t ∈ Ioi (-log x)) : HasDerivWithinAt rexp (rexp t) (Ioi t) t := ++ (Real.hasDerivAt_exp t).hasDerivWithinAt ++ have l4 : ContinuousOn Ψ (rexp '' Ioi (-Real.log x)) := by fun_prop ++ have l5 : IntegrableOn Ψ (rexp '' Ici (-Real.log x)) volume := ++ (l0.integrable_of_hasCompactSupport hsupp).integrableOn ++ have l6 : IntegrableOn (fun x ↦ rexp x • (Ψ ∘ rexp) x) (Ici (-Real.log x)) volume := by ++ refine (Continuous.integrable_of_hasCompactSupport (by fun_prop) ?_).integrableOn ++ change HasCompactSupport (rexp • (Ψ ∘ rexp)) ++ exact (comp_exp_support hsupp hplus).smul_left ++ have := MeasureTheory.integral_deriv_smul_comp_Ioi l1 l2 l3 l4 l5 l6 ++ simpa [Real.exp_neg, Real.exp_log hx] using this ++ ++theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ Tendsto (fun x ↦ (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ ++ obtain ⟨ε, hε, hh⟩ := Metric.eventually_nhds_iff.mp <| comp_exp_support0 hplus ++ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eventually_gt_atTop ε⁻¹] with x hxε ++ ++ have l1 : Integrable (indicator (Ioi x⁻¹) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi ++ have l2 : Integrable (indicator (Ioi 0) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi ++ ++ simp_rw [← MeasureTheory.integral_indicator measurableSet_Ioi, ← mul_sub, ← integral_sub l1 l2] ++ simp only [mul_eq_zero, ofReal_eq_zero] ++ right ++ apply MeasureTheory.integral_eq_zero_of_ae ++ apply Eventually.of_forall ++ intro t ++ simp only [Pi.zero_apply] ++ ++ have hε' : 0 < ε⁻¹ := by positivity ++ have hx : 0 < x := by linarith ++ have hx' : 0 < x⁻¹ := by positivity ++ have hεx : x⁻¹ < ε := (inv_lt_comm₀ hε hx).mp hxε ++ ++ have l3 : Ioi 0 = Ioc 0 x⁻¹ ∪ Ioi x⁻¹ := by ++ ext t ; simp only [mem_Ioi, mem_union, mem_Ioc] ; constructor <;> intro h ++ · simp [h, le_or_gt] ++ · cases h with ++ | inl h => exact h.1 ++ | inr h => exact hx'.trans h ++ have l4 : Disjoint (Ioc 0 x⁻¹) (Ioi x⁻¹) := by simp ++ have l5 := Set.indicator_union_of_disjoint l4 Ψ ++ rw [l3, l5] ++ simp only ++ rw [add_comm, sub_add_cancel_left] ++ by_cases ht : t ∈ Ioc 0 x⁻¹ ++ · simp only [ht, indicator_of_mem, neg_eq_zero] ++ apply hh ; simp only [mem_Ioc, dist_zero_right, norm_eq_abs] at ht ⊢ ++ apply hεx.trans_le' ++ rw [abs_le] ; constructor <;> linarith ++ simp [ht] ++ ++lemma wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x - A * ∫ y in Set.Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ ++ let h (x : ℝ) : ℂ := rexp (2 * π * x) * Ψ (exp (2 * π * x)) ++ have h1 : ContDiff ℝ ∞ h := by ++ have : ContDiff ℝ ∞ (fun x : ℝ => (rexp (2 * π * x))) := (contDiff_const.mul contDiff_id).exp ++ exact (contDiff_ofReal.comp this).mul (hsmooth.comp this) ++ have h2 : HasCompactSupport h := by ++ have : 2 * π ≠ 0 := by simp [pi_ne_zero] ++ simpa using! (comp_exp_support hsupp hplus).comp_smul this |>.mul_left ++ obtain ⟨g, hg⟩ := fourier_surjection_on_schwartz (toSchwartz h h1 h2) ++ ++ have l1 {y} (hy : 0 < y) : y * Ψ y = 𝓕 g (1 / (2 * π) * Real.log y) := by ++ simp only [one_div, mul_inv_rev, hg, toSchwartz, ofReal_exp, ofReal_mul, ofReal_ofNat, ++ toSchwartz_apply, ofReal_inv, h] ++ field_simp ++ norm_cast ++ rw [Real.exp_log hy] ++ ++ have key := limiting_cor_schwartz g hf hcheby hG hG' ++ ++ have l2 : ∀ᶠ x in atTop, ∑' (n : ℕ), f n / ↑n * 𝓕 g (1 / (2 * π) * Real.log (↑n / x)) = ++ ∑' (n : ℕ), f n * Ψ (↑n / x) / x := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ congr ; ext n ++ by_cases hn : n = 0 ++ · simp [hn, (comp_exp_support0 hplus).self_of_nhds] ++ rw [← l1 (by positivity)] ++ have : (n : ℂ) ≠ 0 := by simpa using hn ++ have : (x : ℂ) ≠ 0 := by simpa using hx.ne.symm ++ simp only [ofReal_div, ofReal_natCast] ++ field_simp ++ ++ have l3 : ∀ᶠ x in atTop, ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 g (u / (2 * π)) = ++ ↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ congr 1 ++ simp only [hg, toSchwartz, ofReal_exp, ofReal_mul, ofReal_ofNat, toSchwartz_apply, ++ ofReal_div, h] ++ norm_cast ; field_simp; norm_cast ++ rw [MeasureTheory.integral_Ici_eq_integral_Ioi] ++ exact wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx ++ ++ have l4 : Tendsto (fun x => (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ exact wiener_ikehara_smooth_sub (hsmooth.continuous.integrable_of_hasCompactSupport hsupp) hplus ++ ++ simpa [tsum_div_const] using (key.congr' <| EventuallyEq.sub l2 l3) |>.add l4 ++ ++lemma wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := ++ tendsto_sub_nhds_zero_iff.mp <| wiener_ikehara_smooth hf hcheby hG hG' hsmooth hsupp hplus ++ ++local instance {E : Type*} : Coe (E → ℝ) (E → ℂ) := ⟨fun f n => f n⟩ ++ ++@[norm_cast] ++theorem set_integral_ofReal {f : ℝ → ℝ} {s : Set ℝ} : ∫ x in s, (f x : ℂ) = ∫ x in s, f x := ++ integral_ofReal ++ ++lemma wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := by ++ ++ let Ψ' := ofReal ∘ Ψ ++ have l1 : ContDiff ℝ ∞ Ψ' := contDiff_ofReal.comp hsmooth ++ have l2 : HasCompactSupport Ψ' := hsupp.comp_left rfl ++ have l3 : closure (Function.support Ψ') ⊆ Ioi 0 := by rwa [Function.support_comp_eq] ; simp ++ have key := (continuous_re.tendsto _).comp ++ (@wiener_ikehara_smooth' A Ψ G f hf hcheby hG hG' l1 l2 l3) ++ simp at key ; norm_cast at key ++ ++lemma interval_approx_inf (ha : 0 < a) (hab : a < b) : ++ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ ++ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ ++ ψ ≤ indicator (Ico a b) 1 ∧ b - a - ε ≤ ∫ y in Ioi 0, ψ y := by ++ ++ have l1 : Iio ((b - a) / 3) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds <| by ++ rw [← sub_pos] at hab ++ positivity ++ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < (b - a) / 3) ++ have l2 : a < a + ε / 2 := by simp [hε] ++ have l3 : b - ε / 2 < b := by simp [hε] ++ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 ++ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ ++ · simp [h5, hab.ne, Icc_subset_Ioi_iff hab.le, ha] ++ · exact h4.trans <| indicator_le_indicator_of_subset Ioo_subset_Ico_self (by simp) ++ · have l4 : 0 ≤ b - a - ε := by linarith ++ have l5 : Icc (a + ε / 2) (b - ε / 2) ⊆ Ioi 0 := by ++ intro t ht ++ simp only [mem_Icc, mem_Ioi] at ht ⊢ ++ exact ha.trans <| l2.trans_le <| ht.1 ++ have l6 : Icc (a + ε / 2) (b - ε / 2) ∩ Ioi 0 = Icc (a + ε / 2) (b - ε / 2) := ++ inter_eq_left.mpr l5 ++ have l7 : ∫ y in Ioi 0, indicator (Icc (a + ε / 2) (b - ε / 2)) 1 y = b - a - ε := by ++ simp only [measurableSet_Icc, integral_indicator_one, measureReal_restrict_apply, l6, ++ volume_real_Icc] ++ convert max_eq_left l4 using 1 ; ring_nf ++ have l8 : IntegrableOn ψ (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ rw [← l7] ; apply setIntegral_mono ?_ l8 h3 ++ rw [IntegrableOn, integrable_indicator_iff measurableSet_Icc] ++ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self ++ apply integrableOn_const <;> ++ simp ++ ++lemma interval_approx_sup (ha : 0 < a) (hab : a < b) : ++ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ ++ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ ++ indicator (Ico a b) 1 ≤ ψ ∧ ∫ y in Ioi 0, ψ y ≤ b - a + ε := by ++ ++ have l1 : Iio (a / 2) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds (by linarith) ++ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < a / 2) ++ have l2 : a - ε / 2 < a := by linarith ++ have l3 : b < b + ε / 2 := by linarith ++ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 ++ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ ++ · have l4 : a - ε / 2 < b + ε / 2 := by linarith ++ have l5 : ε / 2 < a := by linarith ++ simp [h5, l4.ne, Icc_subset_Ioi_iff l4.le, l5] ++ · apply le_trans ?_ h3 ++ apply indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp) ++ · have l4 : 0 ≤ b - a + ε := by linarith ++ have l5 : Ioo (a - ε / 2) (b + ε / 2) ⊆ Ioi 0 := by intro t ht ; simp at ht ⊢ ; linarith ++ have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := inter_eq_left.mpr l5 ++ have l7 : ∫ y in Ioi 0, indicator (Ioo (a - ε / 2) (b + ε / 2)) 1 y = b - a + ε := by ++ simp only [measurableSet_Ioo, integral_indicator_one, measureReal_restrict_apply, l6, ++ volume_real_Ioo] ++ convert max_eq_left l4 using 1 ; ring_nf ++ have l8 : IntegrableOn ψ (Ioi 0) volume := (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ rw [← l7] ++ refine setIntegral_mono l8 ?_ h4 ++ rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo] ++ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self ++ apply integrableOn_const <;> ++ simp ++ ++lemma WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : ++ Summable (fun n => f n * g (n / x)) := by ++ obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure ++ apply summable_of_hasFiniteSupport ++ unfold Function.HasFiniteSupport ++ simp only [Function.support_mul] ; apply Finite.inter_of_right ; rw [finite_iff_bddAbove] ++ exact ⟨Nat.ceil (M * x), fun i hi => by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ ++ ++lemma WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) ++ (hg₁ : HasCompactSupport g₁) (hg₂ : HasCompactSupport g₂) : ++ (∑' n, f n * g₁ (n / x)) / x ≤ (∑' n, f n * g₂ (n / x)) / x := by ++ apply div_le_div_of_nonneg_right ?_ hx.le ++ exact Summable.tsum_le_tsum (fun n => mul_le_mul_of_nonneg_left (hg _) (hf _)) ++ (WI_summable hg₁ hx) (WI_summable hg₂ hx) ++ ++lemma WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : chebyWith C f) (hb : 0 < b) (hxb : 2 / b < x) : ++ (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by ++ have hb' : 0 < 2 / b := by positivity ++ have hx : 0 < x := by linarith ++ have hxb' : 2 < x * b := (div_lt_iff₀ hb).mp hxb ++ have l1 (i : ℕ) (hi : i ∉ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) = 0 := by ++ simp_all [le_div_iff₀ hx] ++ have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by ++ rw [abs_eq_self.mpr (hpos _)] ++ convert_to _ ≤ f i * 1 ++ · ring ++ apply mul_le_mul_of_nonneg_left ?_ (hpos _) ++ by_cases hi : (i / x) ∈ (Ico a b) <;> simp [hi] ++ rw [tsum_eq_sum l1, div_le_iff₀ hx, mul_assoc, mul_assoc] ++ apply Finset.sum_le_sum l2 |>.trans ++ have := hcheby ⌈b * x⌉₊ ; simp only [norm_real, norm_eq_abs] at this ; apply this.trans ++ have : 0 ≤ C := by have := hcheby 1 ; simp only [cumsum, Finset.range_one, norm_real, ++ Finset.sum_singleton, Nat.cast_one, mul_one] at this ; exact (abs_nonneg _).trans this ++ refine mul_le_mul_of_nonneg_left ?_ this ++ apply (Nat.ceil_lt_add_one (by positivity)).le.trans ++ linarith ++ ++lemma WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : chebyWith C f) (hb : 0 < b) : ++ ∀ᶠ x : ℝ in atTop, (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by ++ filter_upwards [eventually_gt_atTop (2 / b)] with x hx using WI_sum_Iab_le hpos hcheby hb hx ++ ++lemma le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by ++ apply le_of_forall_gt ; intro d hd ++ have key : ∀ᶠ c in 𝓝[>] b, c < d := by ++ apply eventually_of_mem (U := Iio d) ?_ (fun x hx => hx) ++ rw [mem_nhdsWithin] ++ refine ⟨Iio d, isOpen_Iio, hd, inter_subset_left⟩ ++ obtain ⟨x, h1, h2⟩ := (h.and key).exists ++ linarith ++ ++lemma ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by ++ apply le_of_forall_lt ; intro d hd ++ have key : ∀ᶠ c in 𝓝[<] b, c > d := by ++ apply eventually_of_mem (U := Ioi d) ?_ (fun x hx => hx) ++ rw [mem_nhdsWithin] ++ refine ⟨Ioi d, isOpen_Ioi, hd, inter_subset_left⟩ ++ obtain ⟨x, h1, h2⟩ := (h.and key).exists ++ linarith ++ ++lemma WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : ++ Tendsto (fun c => c / A - (b - a)) (𝓝[>] (A * (b - a))) (𝓝[>] 0) := by ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨A * ε, by positivity, ?_⟩ ++ intro x hx1 hx2 ++ constructor ++ · simpa [lt_div_iff₀' hA] ++ · simp only [Real.dist_eq, dist_zero_right, Real.norm_eq_abs] at hx2 ⊢ ++ have : |x / A - (b - a)| = |x - A * (b - a)| / A := by ++ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp ++ rwa [this, div_lt_iff₀' hA] ++ ++lemma WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : ++ Tendsto (fun c => (b - a) - c / A) (𝓝[<] (A * (b - a))) (𝓝[>] 0) := by ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨A * ε, by positivity, ?_⟩ ++ intro x hx1 hx2 ++ constructor ++ · simpa [div_lt_iff₀' hA] ++ · simp only [Real.dist_eq, dist_zero_right, norm_eq_abs] at hx2 ⊢ ++ have : |(b - a) - x / A| = |A * (b - a) - x| / A := by ++ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp ++ rwa [this, div_lt_iff₀' hA, ← neg_sub, abs_neg] ++ ++theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) (hcheby : cheby fun n ↦ ↑(f n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : 0 ≤ A := by ++ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x ++ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by ++ filter_upwards [eventually_ge_atTop 0] with x hx ++ exact div_nonneg (tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _))) hx ++ obtain ⟨ε, ψ, h1, h2, h3, h4, -⟩ := (interval_approx_sup zero_lt_one one_lt_two).exists ++ have key := @wiener_ikehara_smooth_real A G f ψ hf hcheby hG hG' h1 h2 h3 ++ have l2 : 0 ≤ ψ := by apply le_trans _ h4 ; apply indicator_nonneg ; simp ++ have l1 : ∀ᶠ x in atTop, 0 ≤ S ψ x := hSnonneg l2 ++ have l3 : 0 ≤ A * ∫ (y : ℝ) in Ioi 0, ψ y := ge_of_tendsto key l1 ++ have l4 : 0 < ∫ (y : ℝ) in Ioi 0, ψ y := by ++ have r1 : 0 ≤ᵐ[Measure.restrict volume (Ioi 0)] ψ := Eventually.of_forall l2 ++ have r2 : IntegrableOn (fun y ↦ ψ y) (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ have r3 : Ico 1 2 ⊆ Function.support ψ := by intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith ++ have r4 : Ico 1 2 ⊆ Function.support ψ ∩ Ioi 0 := by ++ simp only [subset_inter_iff, r3, true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith ++ have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by convert! volume.mono r4 ; norm_num ++ simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using! zero_lt_one.trans_le r5 ++ have := div_nonneg l3 l4.le ; field_simp at this ; exact this ++ ++lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) atTop (nhds (A * (b - a))) := by ++ ++ by_cases hab : a = b ++ · simp [hab] ++ replace hb : a < b := lt_of_le_of_ne hb hab ; clear hab ++ ++ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x ++ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by ++ filter_upwards [eventually_ge_atTop 0] with x hx ++ refine div_nonneg ?_ hx ++ refine tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _)) ++ have hA : 0 ≤ A := residue_nonneg hpos hf hcheby hG hG' ++ ++ let Iab : ℝ → ℝ := indicator (Ico a b) 1 ++ change Tendsto (S Iab) atTop (𝓝 (A * (b - a))) ++ have hIab : HasCompactSupport Iab := by simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc ++ have Iab_nonneg : ∀ᶠ x : ℝ in atTop, 0 ≤ S Iab x := hSnonneg (indicator_nonneg (by simp)) ++ have Iab2 : IsBoundedUnder (· ≤ ·) atTop (S Iab) := by ++ obtain ⟨C, hC⟩ := hcheby ; exact ⟨C * 2 * b, WI_sum_Iab_le' hpos hC (by linarith)⟩ ++ have Iab3 : IsBoundedUnder (· ≥ ·) atTop (S Iab) := ⟨0, Iab_nonneg⟩ ++ have Iab0 : IsCoboundedUnder (· ≥ ·) atTop (S Iab) := Iab2.isCoboundedUnder_ge ++ have Iab1 : IsCoboundedUnder (· ≤ ·) atTop (S Iab) := Iab3.isCoboundedUnder_le ++ ++ have sup_le : limsup (S Iab) atTop ≤ A * (b - a) := by ++ have l_sup : ∀ᶠ ε in 𝓝[>] 0, limsup (S Iab) atTop ≤ A * (b - a + ε) := by ++ filter_upwards [interval_approx_sup ha hb] with ε ⟨ψ, h1, h2, h3, h4, h6⟩ ++ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 ++ have l6 : S Iab ≤ᶠ[atTop] S ψ := by ++ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h4 hx hIab h2 ++ have l5 : IsBoundedUnder (· ≤ ·) atTop (S ψ) := l1.isBoundedUnder_le ++ have l3 : limsup (S Iab) atTop ≤ limsup (S ψ) atTop := limsup_le_limsup l6 Iab1 l5 ++ apply l3.trans ; rw [l1.limsup_eq] ; gcongr ++ obtain rfl | h := eq_or_ne A 0 ++ · simpa using l_sup ++ apply le_of_eventually_nhdsWithin ++ have key : 0 < A := lt_of_le_of_ne hA h.symm ++ filter_upwards [WI_tendsto_aux a b key l_sup] with x hx ++ simpa [mul_div_cancel₀ _ h] using hx ++ ++ have le_inf : A * (b - a) ≤ liminf (S Iab) atTop := by ++ have l_inf : ∀ᶠ ε in 𝓝[>] 0, A * (b - a - ε) ≤ liminf (S Iab) atTop := by ++ filter_upwards [interval_approx_inf ha hb] with ε ⟨ψ, h1, h2, h3, h5, h6⟩ ++ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 ++ have l2 : S ψ ≤ᶠ[atTop] S Iab := by ++ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h5 hx h2 hIab ++ have l4 : IsBoundedUnder (· ≥ ·) atTop (S ψ) := l1.isBoundedUnder_ge ++ have l3 : liminf (S ψ) atTop ≤ liminf (S Iab) atTop := liminf_le_liminf l2 l4 Iab0 ++ apply le_trans ?_ l3 ; rw [l1.liminf_eq] ; gcongr ++ obtain rfl | h := eq_or_ne A 0 ++ · simpa using l_inf ++ apply ge_of_eventually_nhdsWithin ++ have key : 0 < A := lt_of_le_of_ne hA h.symm ++ filter_upwards [WI_tendsto_aux' a b key l_inf] with x hx ++ simpa [mul_div_cancel₀ _ h] using hx ++ ++ have : liminf (S Iab) atTop ≤ limsup (S Iab) atTop := liminf_le_limsup Iab2 Iab3 ++ refine tendsto_of_liminf_eq_limsup ?_ ?_ Iab2 Iab3 <;> linarith ++ ++lemma le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by ++ rw [div_le_iff₀ hx, Nat.le_floor_iff] ; positivity ++ ++lemma lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by ++ rw [div_lt_iff₀ hx, Nat.lt_ceil] ++ ++lemma ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by ++ rw [le_div_iff₀ hx, Nat.ceil_le] ++ ++lemma mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by ++ rw [Finset.mem_Icc, mem_Icc, ceil_mul_le_iff hx, le_floor_mul_iff hb hx] ++ ++lemma mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by ++ rw [Finset.mem_Ico, mem_Ico, ceil_mul_le_iff hx, lt_ceil_mul_iff hx] ++ ++lemma tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : ++ ∑' n, f n * (indicator (Ico a b) 1 (n / x)) = ∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n := by ++ have l1 : ∀ n ∉ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n * indicator (Ico a b) 1 (↑n / x) = 0 := by ++ simp [mem_Ico_iff_div hx] ; tauto ++ rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] ++ ++lemma WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) atTop (nhds (A * (b - a))) := by ++ apply (WienerIkeharaInterval hpos hf hcheby hG hG' ha hb).congr' ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ rw [tsum_indicator hx] ++ ++lemma WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) atTop (nhds (A * (b - a))) := ++ WienerIkeharaInterval_discrete hpos hf hcheby hG hG' ha hb |>.comp tendsto_natCast_atTop_atTop ++ ++lemma tendsto_mul_ceil_div : ++ Tendsto (fun (p : ℝ × ℕ) => ⌈p.1 * p.2⌉₊ / (p.2 : ℝ)) (𝓝[>] 0 ×ˢ atTop) (𝓝 0) := by ++ rw [Metric.tendsto_nhds] ; intro δ hδ ++ have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) ++ have l2 : ∀ᶠ N : ℕ in atTop, 1 ≤ δ / 2 * N := by ++ apply Tendsto.eventually_ge_atTop ++ exact tendsto_natCast_atTop_atTop.const_mul_atTop (by positivity) ++ filter_upwards [l1.prod_mk l2] with (ε, N) ⟨⟨hε, h1⟩, h2⟩ ; dsimp only at * ++ have l3 : 0 < (N : ℝ) := by ++ simp only [Nat.cast_pos, Nat.pos_iff_ne_zero] ; rintro rfl ; simp [zero_lt_one.not_ge] at h2 ++ have l5 : 0 ≤ ε * ↑N := by positivity ++ have l6 : ε * N ≤ δ / 2 * N := mul_le_mul h1.le le_rfl (by positivity) (by positivity) ++ simp only [dist_zero_right, norm_div, RCLike.norm_natCast, div_lt_iff₀ l3, gt_iff_lt] ++ convert (Nat.ceil_lt_add_one l5).trans_le (add_le_add l6 h2) using 1 ; ring ++ ++noncomputable def S (f : ℕ → 𝕜) (ε : ℝ) (N : ℕ) : 𝕜 := (∑ n ∈ Finset.Ico ⌈ε * N⌉₊ N, f n) / N ++ ++lemma S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by ++ have hceilN : ⌈ε * N⌉₊ ≤ N := by ++ simp only [Nat.ceil_le] ++ exact mul_le_of_le_one_left N.cast_nonneg hε ++ have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by ++ ext n ++ simp only [Finset.mem_range, Finset.mem_union, Finset.mem_Ico] ++ omega ++ have r2 : Disjoint (Finset.range ⌈ε * N⌉₊) (Finset.Ico ⌈ε * N⌉₊ N) := by ++ rw [Finset.range_eq_Ico] ; apply Finset.Ico_disjoint_Ico_consecutive ++ simp [S, r1, Finset.sum_union r2, cumsum, add_div] ++ ++lemma tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) (hcheby : cheby f) : ++ TendstoUniformlyOnFilter (S f) (S f 0) (𝓝[>] 0) atTop := by ++ rw [Metric.tendstoUniformlyOnFilter_iff] ; intro δ hδ ++ obtain ⟨C, hC⟩ := hcheby ++ have l1 : ∀ᶠ (p : ℝ × ℕ) in 𝓝[>] 0 ×ˢ atTop, C * ⌈p.1 * p.2⌉₊ / p.2 < δ := by ++ have r1 := tendsto_mul_ceil_div.const_mul C ++ simp only [mul_div_assoc', mul_zero] at r1 ; exact r1 (Iio_mem_nhds hδ) ++ have : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) ++ filter_upwards [l1, Eventually.prod_inl this _] with (ε, N) h1 h2 ++ have l2 : ‖cumsum f ⌈ε * ↑N⌉₊ / ↑N‖ ≤ C * ⌈ε * N⌉₊ / N := by ++ have r1 := hC ⌈ε * N⌉₊ ++ have r2 : 0 ≤ cumsum f ⌈ε * N⌉₊ := by apply cumsum_nonneg hpos ++ simp only [norm_real, norm_of_nonneg (hpos _), norm_div, ++ norm_of_nonneg r2, Real.norm_natCast] at r1 ⊢ ++ apply div_le_div_of_nonneg_right r1 (by positivity) ++ simpa [← S_sub_S h2.2] using! l2.trans_lt h1 ++ ++theorem WienerIkeharaTheorem' {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := by ++ ++ convert_to Tendsto (S f 0) atTop (𝓝 A) ; · ext N ; simp [S, cumsum] ++ apply (tendsto_S_S_zero hpos hcheby).tendsto_of_eventually_tendsto ++ · have L0 : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) ++ apply eventually_of_mem L0 ++ · intro ε hε ++ simpa using! WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 ++ · have : Tendsto (fun ε : ℝ => ε) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds ++ simpa using (this.const_sub 1).const_mul A ++ ++theorem vonMangoldt_cheby : cheby Λ := by ++ use Real.log 4 + 4 ++ intro N ++ by_cases! h : N = 0 ++ · simp [h, cumsum] ++ simp only [cumsum, norm_real, norm_eq_abs] ++ rw [Nat.range_eq_Icc_zero_sub_one _ h, (by simp : N - 1 = ⌊(N : ℝ) - 1⌋₊)] ++ simp_rw [abs_of_nonneg vonMangoldt_nonneg] ++ rw [← Chebyshev.psi_eq_sum_Icc] ++ grw [Chebyshev.psi_le_const_mul_self <| sub_nonneg_of_le <| Nat.one_le_cast_iff_ne_zero.mpr h] ++ gcongr ++ linarith ++ ++theorem WeakPNT : Tendsto (fun N ↦ cumsum Λ N / N) atTop (𝓝 1) := by ++ let F := vonMangoldt.LFunctionResidueClassAux (q := 1) 1 ++ have hnv := riemannZeta_ne_zero_of_one_le_re ++ have l1 (n : ℕ) : 0 ≤ Λ n := vonMangoldt_nonneg ++ have l2 s (hs : 1 < s.re) : F s = LSeries Λ s - 1 / (s - 1) := by ++ have := vonMangoldt.eqOn_LFunctionResidueClassAux (q := 1) isUnit_one hs ++ simp only [F, this, vonMangoldt.residueClass, Nat.totient_one, Nat.cast_one, inv_one, one_div, sub_left_inj] ++ apply LSeries_congr ++ intro n _ ++ simp only [ofReal_inj, indicator_apply_eq_self, mem_ofPred_eq] ++ exact fun hn ↦ absurd (Subsingleton.eq_one _) hn ++ have l3 : ContinuousOn F {s | 1 ≤ s.re} := vonMangoldt.continuousOn_LFunctionResidueClassAux 1 ++ have l4 : cheby Λ := vonMangoldt_cheby ++ have l5 (σ' : ℝ) (hσ' : 1 < σ') : Summable (nterm Λ σ') := by ++ simpa only [← nterm_eq_norm_term] using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm ++ apply WienerIkeharaTheorem' l1 l5 l4 l3 l2 ++ ++section auto_cheby ++ ++variable {f : ℕ → ℝ} ++ ++lemma norm_x_cpow_it (x t : ℝ) (hx : 0 < x) : ‖(x : ℂ) ^ (t * I)‖ = 1 := by ++ rw [cpow_def_of_ne_zero <| ofReal_ne_zero.mpr hx.ne', ← ofReal_log hx.le] ++ convert norm_exp_ofReal_mul_I (t * x.log) using 2 ++ push_cast; ring_nf ++ ++lemma limiting_fourier_aux_gt_zero (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 0 < x) (σ' : ℝ) (hσ' : 1 < σ') : ++ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = ++ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by ++ have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 ++ have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := ++ continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [hx]) ++ have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := ++ (((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8).integrable_of_hasCompactSupport ++ ψ.h2.mul_left.mul_right ++ have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := fun h ↦ by ++ have := congrArg Complex.re (sub_eq_zero.mp h); simp at this; linarith ++ have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * ++ (↑(x ^ (σ' - 1)) * (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by ++ have : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * ++ (↑(x ^ (σ' - 1)) * (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by ++ simp only [one_div, ← mul_assoc] ++ exact ((continuous_const.mul (Continuous.inv₀ (by fun_prop) e2)).mul ψ.h1.continuous).mul l8 ++ exact this.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right.mul_left.mul_left ++ simp_rw [first_fourier hf hint hx hσ', second_fourier ψ.h1.continuous.measurable hint hx hσ', ++ ← integral_const_mul, ← integral_sub l4 l5] ++ refine integral_congr_ae (.of_forall fun u ↦ ?_) ++ have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] ++ simp_rw [hG' e1, sub_mul, ← mul_assoc] ++ simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, ++ mul_eq_zero, I_ne_zero, or_false] ++ field_simp [e2]; norm_cast; simp [mul_assoc, ← rpow_add hx] ++ ++theorem limiting_fourier_lim2_gt_zero (A : ℝ) (ψ : W21) (hx : 0 < x) : ++ Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * ++ ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) ++ (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by ++ obtain ⟨C, hC⟩ := decay_bounds_cor ψ ++ refine Tendsto.mul ?_ (tendsto_integral_filter_of_dominated_convergence _ ++ (.of_forall fun _ ↦ (by continuity : Continuous _).aestronglyMeasurable) ?_ ++ (limiting_fourier_lim2_aux x C) (.of_forall fun u ↦ ?_)) ++ · suffices Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) by ++ simpa using ((continuous_ofReal.tendsto 1).comp this).const_mul ↑A ++ have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := ++ tendsto_nhdsWithin_of_tendsto_nhds (by simpa using (continuous_id.tendsto (1 : ℝ)).const_sub 1) ++ simpa using tendsto_const_nhds.rpow this (Or.inl hx.ne') ++ · refine eventually_of_mem (Ioo_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun σ' hσ' ↦ ?_ ++ obtain ⟨h1, h2⟩ := hσ' ++ rw [ae_restrict_iff' measurableSet_Ici] ++ refine .of_forall fun t ht ↦ ?_ ++ simp only [norm_mul, neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, ++ norm_exp, neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, ++ sub_self, mul_zero, sub_zero] ++ refine mul_le_mul ?_ (hC _) (norm_nonneg _) ((abs_nonneg x).trans (le_max_left _ _)) ++ have hα0 : 0 ≤ σ' - 1 := by linarith ++ have hα1 : σ' - 1 ≤ 1 := by linarith ++ have hmul1 : (-x.log) * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht hα0 ++ calc Real.exp (-(t * (σ' - 1))) ++ ≤ Real.exp (x.log * (σ' - 1)) := Real.exp_monotone (by linarith) ++ _ ≤ max |x| 1 := by ++ by_cases hx1 : 1 ≤ x ++ · calc _ ≤ Real.exp x.log := ++ Real.exp_monotone (mul_le_of_le_one_right (Real.log_nonneg hx1) hα1) ++ _ = |x| := by rw [Real.exp_log hx, abs_of_pos hx] ++ _ ≤ _ := le_max_left _ _ ++ · calc _ ≤ 1 := (Real.exp_monotone (mul_nonpos_of_nonpos_of_nonneg ++ ((Real.log_neg_iff hx).2 (by linarith)).le hα0)).trans_eq Real.exp_zero ++ _ ≤ _ := le_max_right _ _ ++ · suffices Tendsto (fun n ↦ ((rexp (-u * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by simpa using this.mul_const _ ++ refine Tendsto.mono_left ?_ nhdsWithin_le_nhds ++ have : Continuous (fun n ↦ ((rexp (-u * (n - 1))) : ℂ)) := by continuity ++ simpa using this.tendsto 1 ++ ++theorem limiting_fourier_lim3_gt_zero ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 0 < x) : ++ Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) ++ (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by ++ by_cases hh : tsupport ψ = ∅ ++ · simp [tsupport_eq_empty_iff.mp hh] ++ obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh ++ let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) ++ have l1 : IsCompact S := Metric.isCompact_iff_isClosed_bounded.mpr ++ ⟨isClosed_Icc.reProdIm (isClosed_tsupport ψ), (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded⟩ ++ have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 ++ obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ (hG.mono l2).norm ++ have hxC : (x : ℂ) ≠ 0 := ofReal_ne_zero.mpr hx.ne' ++ refine tendsto_integral_filter_of_dominated_convergence (bound := fun a ↦ ‖G z‖ * ‖ψ a‖) ++ (eventually_of_mem (Icc_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun u hu ↦ ++ ((hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous).mul ++ (by simpa using Continuous.const_cpow (by fun_prop) (Or.inl hxC)) |>.aestronglyMeasurable) ++ (eventually_of_mem (Icc_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun u hu ↦ ++ .of_forall fun v ↦ ?_) ++ ((continuous_const.mul ψ.h1.continuous.norm).integrable_of_hasCompactSupport ψ.h2.norm.mul_left) ++ (.of_forall fun t ↦ ?_) ++ · by_cases h : v ∈ tsupport ψ ++ · simp_rw [norm_mul, norm_x_cpow_it x v hx, mul_one] ++ exact mul_le_mul_of_nonneg_right (isMaxOn_iff.mp hmax _ (by simp [S, mem_reProdIm, hu.1, hu.2, h])) (norm_nonneg _) ++ · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) ++ simp [Function.notMem_support.mp this] ++ · exact ((hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr ++ ⟨((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds, ++ eventually_nhdsWithin_of_forall fun _ hx' ↦ by simp [(Set.mem_Ioi.mp hx').le]⟩).mul_const _ |>.mul_const _ ++ ++lemma tendsto_tsum_of_monotone_convergence ++ {β : Type*} {f : ℕ → β → ENNReal} {g : β → ENNReal} ++ (hmono : ∀ k, Monotone (fun n => f n k)) ++ (hlim : ∀ k, Tendsto (fun n => f n k) atTop (𝓝 (g k))) : ++ Tendsto (fun n => ∑' k, f n k) atTop (𝓝 (∑' k, g k)) := by ++ let : MeasurableSpace β := ⊤ ++ let μ : Measure β := Measure.count ++ have hg_iSup (k : β) : (⨆ n : ℕ, f n k) = g k := iSup_eq_of_tendsto (hmono k) (hlim k) ++ have h_tend_lint : Tendsto (fun n => ∫⁻ k, f n k ∂μ) atTop (𝓝 (∫⁻ k, (⨆ n, f n k) ∂μ)) := by ++ have hmeas : ∀ n, Measurable fun k : β => f n k := fun _ _ _ ↦ trivial ++ have hmono_fn : Monotone (fun n => fun k : β => f n k) := fun _ _ hnm k ↦ hmono k hnm ++ simpa [lintegral_iSup hmeas hmono_fn] using ++ tendsto_atTop_iSup fun _ _ hmn ↦ lintegral_mono fun k ↦ hmono k hmn ++ simpa [μ, lintegral_count, hg_iSup] using h_tend_lint ++ ++lemma tendsto_tsum_of_monotone_convergence_nhdsGT_one ++ {F : ℝ → ℕ → ℝ} ++ (hF_nonneg : ∀ σ n, 0 ≤ F σ n) ++ (hF_antitone : ∀ n, AntitoneOn (fun σ : ℝ => F σ n) (Set.Ioi (1 : ℝ))) ++ (hF_tend : ∀ n, Tendsto (fun σ : ℝ => F σ n) (𝓝[>] (1 : ℝ)) (𝓝 (F 1 n))) ++ (hSumm : ∀ σ, 1 < σ → Summable (fun n : ℕ => F σ n)) ++ (hbounded : ++ BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ : ℝ => (∑' n : ℕ, F σ n))) : ++ Tendsto (fun σ : ℝ => ∑' n : ℕ, F σ n) (𝓝[>] (1 : ℝ)) (𝓝 (∑' n : ℕ, F 1 n)) := by ++ let T : ℝ → ℝ := fun σ => ∑' n : ℕ, F σ n ++ have hT_antitone : AntitoneOn T (Set.Ioi (1 : ℝ)) := fun a ha b hb hab ↦ ++ (hSumm b hb).tsum_le_tsum_of_inj (fun n ↦ n) (fun _ _ h ↦ h) (fun c hc ↦ (hc ⟨c, rfl⟩).elim) ++ (fun n ↦ hF_antitone n ha hb hab) (hSumm a ha) ++ have hT_bdd : BddAbove (T '' Set.Ioi (1 : ℝ)) := by ++ obtain ⟨C, hC⟩ := isBigO_iff.1 hbounded ++ have hC' : ∀ᶠ σ : ℝ in 𝓝[>] (1 : ℝ), T σ ≤ C := by ++ filter_upwards [hC] with σ hσ ++ calc T σ ≤ |T σ| := le_abs_self _ ++ _ = ‖T σ‖ := (Real.norm_eq_abs _).symm ++ _ ≤ C * ‖(1 : ℝ → ℝ) σ‖ := hσ ++ _ = C := by simp ++ obtain ⟨U, hU, V, hV, hUV⟩ := Filter.mem_inf_iff_superset.1 hC' ++ obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hU ++ have hIoi_sub : Set.Ioi (1 : ℝ) ⊆ V := Filter.mem_principal.mp hV ++ have hUsub : U ∩ Set.Ioi (1 : ℝ) ⊆ {σ : ℝ | T σ ≤ C} := fun σ hσ ↦ hUV ⟨hσ.1, hIoi_sub hσ.2⟩ ++ have hσ0_Ioi : 1 + ε / 2 ∈ Set.Ioi (1 : ℝ) := by simp [half_pos hε] ++ have hσ0_leC : T (1 + ε / 2) ≤ C := ++ hUsub ⟨hball (by simp only [Metric.mem_ball, Real.dist_eq, add_sub_cancel_left, ++ abs_of_pos (half_pos hε)]; exact half_lt_self hε), hσ0_Ioi⟩ ++ refine ⟨C, ?_⟩ ++ rintro _ ⟨σ, hσIoi, rfl⟩ ++ by_cases hσlt : σ < 1 + ε / 2 ++ · exact hUsub ⟨hball (by ++ simp only [Metric.mem_ball, Real.dist_eq] ++ rw [abs_of_pos (sub_pos.2 (Set.mem_Ioi.mp hσIoi))] ++ linarith [half_lt_self hε]), hσIoi⟩ ++ · exact (hT_antitone hσ0_Ioi hσIoi (le_of_not_gt hσlt)).trans hσ0_leC ++ have hT_tend_sup : Tendsto T (𝓝[>] (1 : ℝ)) (𝓝 (sSup (T '' Set.Ioi (1 : ℝ)))) := ++ hT_antitone.tendsto_nhdsGT hT_bdd ++ let σseq : ℕ → ℝ := fun k => 1 + 1 / (k + 1 : ℝ) ++ have hσseq_mem (k) : σseq k ∈ Set.Ioi (1 : ℝ) := by ++ simp only [σseq, Set.mem_Ioi, lt_add_iff_pos_right] ++ positivity ++ have hσseq_tend_nhds : Tendsto σseq atTop (𝓝 (1 : ℝ)) := by ++ have : Tendsto (fun k : ℕ => (1 : ℝ) + ((k + 1 : ℕ) : ℝ)⁻¹) atTop (𝓝 ((1 : ℝ) + 0)) := ++ tendsto_const_nhds.add (tendsto_inv_atTop_nhds_zero_nat.comp (tendsto_add_atTop_nat 1)) ++ simp only [add_zero] at this ++ convert this using 1; ext k; simp [σseq, one_div] ++ have hσseq_tend_nhdsWithin : Tendsto σseq atTop (𝓝[>] (1 : ℝ)) := ++ tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hσseq_tend_nhds ++ (.of_forall hσseq_mem) ++ have hσseq_antitone : Antitone σseq := fun k₁ k₂ hk ↦ by simp only [σseq]; gcongr ++ have hmono_seq (n) : Monotone (fun k => F (σseq k) n) := fun k₁ k₂ hk ↦ ++ hF_antitone n (hσseq_mem k₂) (hσseq_mem k₁) (hσseq_antitone hk) ++ have htend_seq (n) : Tendsto (fun k => F (σseq k) n) atTop (𝓝 (F 1 n)) := ++ (hF_tend n).comp hσseq_tend_nhdsWithin ++ have hTseq : Tendsto (fun k : ℕ => T (σseq k)) atTop (𝓝 (T 1)) := by ++ have hsum1 : Summable (fun n : ℕ => F (1 : ℝ) n) := by ++ obtain ⟨C, hC⟩ := hT_bdd ++ refine summable_of_sum_range_le (hF_nonneg 1) fun m ↦ le_of_tendsto ++ (tendsto_finsetSum _ fun i _ ↦ hF_tend i) ++ (eventually_of_mem self_mem_nhdsWithin fun σ hσ ↦ ++ ((hSumm σ hσ).sum_le_tsum _ (fun n _ ↦ hF_nonneg σ n)).trans (hC ⟨σ, hσ, rfl⟩)) ++ have hg_ne_top : (∑' n : ℕ, ENNReal.ofReal (F 1 n)) ≠ ⊤ := hsum1.tsum_ofReal_ne_top ++ have hENN : Tendsto (fun k => ∑' n, ENNReal.ofReal (F (σseq k) n)) atTop ++ (𝓝 (∑' n, ENNReal.ofReal (F 1 n))) := ++ tendsto_tsum_of_monotone_convergence (fun n _ _ hk ↦ ENNReal.ofReal_le_ofReal (hmono_seq n hk)) ++ (fun n ↦ ENNReal.tendsto_ofReal (htend_seq n)) ++ have hrew (σ) : (∑' n, ENNReal.ofReal (F σ n)).toReal = ∑' n, F σ n := by ++ rw [ENNReal.tsum_toReal_eq (fun n ↦ by simp)] ++ exact tsum_congr fun n ↦ by simp [hF_nonneg σ n] ++ simp only [T, ← hrew]; exact (ENNReal.tendsto_toReal hg_ne_top).comp hENN ++ have hsSup_eq : sSup (T '' Set.Ioi (1 : ℝ)) = T 1 := ++ tendsto_nhds_unique (hT_tend_sup.comp hσseq_tend_nhdsWithin) hTseq ++ simpa [T, hsSup_eq] using hT_tend_sup ++ ++lemma limiting_fourier_variant_lim1_aux ++ {f : ℕ → ℝ} {x : ℝ} (ψ : CS 2 ℂ) ++ (hpos : 0 ≤ f) ++ (hf : ∀ (σ : ℝ), 1 < σ → Summable (nterm f σ)) ++ (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) : ++ ∀ (σ : ℝ), 1 < σ → ++ Summable (fun n : ℕ => ++ (if n = 0 then 0 else f n / ((n : ℝ) ^ σ)) * ++ (𝓕 ψ.toFun (1 / (2 * π) * Real.log ((n : ℝ) / x))).re) := by ++ intro σ hσ ++ let y : ℕ → ℝ := fun n => (1 / (2 * π)) * Real.log ((n : ℝ) / x) ++ let W : ℕ → ℝ := fun n => (𝓕 ψ.toFun (y n)).re ++ let base : ℕ → ℝ := fun n => if n = 0 then 0 else f n / ((n : ℝ) ^ σ) ++ obtain ⟨C, hC⟩ := decay_bounds_cor (W21.ofCS2 ψ) ++ have hC_nonneg : 0 ≤ C := (norm_nonneg _).trans ((hC 0).trans (by simp)) ++ have hW_nonneg (n : ℕ) : 0 ≤ W n := (hψpos (y n)).1 ++ have hnorm_four (n : ℕ) : ‖𝓕 ψ.toFun (y n)‖ = W n := by ++ have him0 : (𝓕 ψ.toFun (y n)).im = 0 := (hψpos (y n)).2 ++ rw [show 𝓕 ψ.toFun (y n) = W n by exact Complex.ext rfl him0] ++ simp [abs_of_nonneg (hW_nonneg n)] ++ have hW_le_C (n : ℕ) : W n ≤ C := by ++ rw [← hnorm_four]; exact (hC (y n)).trans (div_le_self hC_nonneg (by nlinarith [sq_nonneg (y n)])) ++ have hbase_summ : Summable base := by ++ convert hf σ hσ using 1; ext n ++ by_cases hn : n = 0 <;> simp [nterm, base, hn, Real.norm_eq_abs, abs_of_nonneg (hpos n)] ++ refine (hbase_summ.mul_left C).of_norm_bounded fun n ↦ ?_ ++ by_cases hn : n = 0 ++ · simp [base, hn] ++ · have hnpos : 0 < (n : ℝ) := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn) ++ have hbase_nonneg : 0 ≤ base n := by ++ simp only [base, hn, ite_false] ++ exact div_nonneg (hpos n) (Real.rpow_pos_of_pos hnpos σ).le ++ calc |base n * W n| = base n * W n := abs_of_nonneg (mul_nonneg hbase_nonneg (hW_nonneg n)) ++ _ ≤ base n * C := mul_le_mul_of_nonneg_left (hW_le_C n) hbase_nonneg ++ _ = C * base n := mul_comm _ _ ++ ++theorem limiting_fourier_variant_lim1 ++ {f : ℕ → ℝ} {x : ℝ} {ψ : CS 2 ℂ} ++ (hpos : 0 ≤ f) ++ (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) ++ (S : ℝ → ℂ) ++ (hSdef : ++ ∀ σ' : ℝ, ++ S σ' = ++ ∑' n : ℕ, ++ term (fun n ↦ (f n : ℂ)) (σ' : ℝ) n * ++ 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x))) ++ (hbounded : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ' : ℝ => ‖S σ'‖)) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) : ++ Tendsto ++ (fun σ' : ℝ => ++ ∑' n : ℕ, ++ term (fun n ↦ (f n : ℂ)) (σ' : ℝ) n * ++ 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x))) ++ (𝓝[>] (1 : ℝ)) ++ (𝓝 ++ (∑' n : ℕ, ++ (f n : ℂ) / (n : ℂ) * ++ 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x)))) := by ++ ++ let y : ℕ → ℝ := fun n => (π⁻¹ * 2⁻¹) * Real.log ((n : ℝ) / x) ++ let w : ℕ → ℝ := fun n => (𝓕 ψ.toFun (y n)).re ++ ++ have hw_nonneg : ∀ n, 0 ≤ w n := by ++ intro n ++ exact (hψpos (y n)).1 ++ ++ have hFour_eq_ofReal : ∀ n, 𝓕 ψ.toFun (y n) = Complex.ofReal (w n) := by ++ intro n ++ have h := hψpos (y n) ++ refine Complex.ext ?_ ?_ ++ · simp [w] ++ · simp [w, h.2] ++ ++ let rterm : ℝ → ℕ → ℝ := ++ fun σ n => ++ if h0 : n = 0 then 0 else (f n) / ((n : ℝ) ^ σ) * (w n) ++ ++ have summand_eq_ofReal : ++ ∀ (σ : ℝ) (n : ℕ), ++ term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n) ++ = Complex.ofReal (rterm σ n) := by ++ intro σ n ++ by_cases hn : n = 0 ++ · subst hn ++ simp [rterm, y] ++ · have hnpos : (0 : ℝ) < (n : ℝ) := by ++ exact_mod_cast (Nat.pos_of_ne_zero hn) ++ have hn0 : 0 ≤ (n : ℝ) := le_of_lt hnpos ++ have hcpow : ++ ( (n : ℂ) ^ ((σ : ℝ) : ℂ) ) = ( ( (n : ℝ) ^ σ : ℝ) : ℂ ) := by ++ simpa using (Complex.ofReal_cpow hn0 σ).symm ++ have hpow_ne : ((n : ℝ) ^ σ) ≠ 0 := by ++ exact (ne_of_gt (Real.rpow_pos_of_pos hnpos σ)) ++ calc ++ term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n) ++ = ++ ((f n : ℂ) / ((n : ℂ) ^ ((σ : ℝ) : ℂ))) * ( (w n : ℝ) : ℂ ) := by ++ simp [term, LSeries.term, hn, hFour_eq_ofReal] ++ _ = ++ ((f n : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) * ((w n : ℝ) : ℂ) := by ++ simp [hcpow] ++ _ = ++ (( (f n : ℝ) : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) * ((w n : ℝ) : ℂ) := by ++ simp ++ _ = ++ ( ( (f n : ℝ) / ((n : ℝ) ^ σ) : ℝ) : ℂ ) * ((w n : ℝ) : ℂ) := by ++ simp [Complex.ofReal_div] ++ _ = ++ ( ( (f n : ℝ) / ((n : ℝ) ^ σ) * (w n) : ℝ ) : ℂ ) := by ++ simp [Complex.ofReal_mul] ++ _ = ++ Complex.ofReal (rterm σ n) := by ++ simp [rterm, hn] ++ ++ let T : ℝ → ℝ := fun σ => ∑' n, rterm σ n ++ ++ have tsum_eq_ofReal_T : ∀ σ : ℝ, ++ (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) ++ = Complex.ofReal (T σ) := by ++ intro σ ++ have hcongr : ++ (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) ++ = ∑' n : ℕ, (Complex.ofReal (rterm σ n)) := by ++ refine tsum_congr ?_ ++ intro n ++ simpa using (summand_eq_ofReal σ n) ++ ++ calc ++ (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) ++ = ∑' n : ℕ, (Complex.ofReal (rterm σ n)) := hcongr ++ _ = Complex.ofReal (∑' n : ℕ, rterm σ n) := by ++ simpa using (Complex.ofReal_tsum (fun n : ℕ => rterm σ n)).symm ++ _ = Complex.ofReal (T σ) := by rfl ++ ++ have hS_ofReal_T : ∀ σ : ℝ, S σ = Complex.ofReal (T σ) := by ++ intro σ ++ simpa [hSdef σ, y] using (tsum_eq_ofReal_T σ) ++ ++ have rterm_nonneg : ∀ σ n, 0 ≤ rterm σ n := by ++ intro σ n ++ by_cases hn : n = 0 ++ · subst hn; simp [rterm] ++ · have hf : 0 ≤ f n := hpos n ++ have hw : 0 ≤ w n := hw_nonneg n ++ have hnpos : 0 < (n : ℝ) := by ++ exact_mod_cast (Nat.pos_of_ne_zero hn) ++ have hden : 0 < (n : ℝ) ^ σ := Real.rpow_pos_of_pos hnpos σ ++ have : 0 ≤ (f n) / ((n : ℝ) ^ σ) := div_nonneg hf (le_of_lt hden) ++ simp [rterm, hn, mul_nonneg this hw] ++ ++ have T_nonneg : ∀ σ, 0 ≤ T σ := by ++ intro σ ++ exact tsum_nonneg (fun n => rterm_nonneg σ n) ++ ++ have hT_eq_normS : ∀ σ, T σ = ‖S σ‖ := by ++ intro σ ++ have := hS_ofReal_T σ ++ calc ++ T σ = ‖Complex.ofReal (T σ)‖ := by simp [abs_of_nonneg (T_nonneg σ)] ++ _ = ‖S σ‖ := by simp [this] ++ ++ have hboundedT : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ : ℝ => T σ) := by ++ have : (fun σ : ℝ => T σ) = (fun σ : ℝ => ‖S σ‖) := by ++ funext σ; exact hT_eq_normS σ ++ simpa [this] using hbounded ++ ++ have rterm_antitone : ∀ n, AntitoneOn (fun σ => rterm σ n) (Set.Ioi 1) := by ++ intro n σ₁ hσ₁ σ₂ hσ₂ hσ₁₂ ++ by_cases hn : n = 0 ++ · subst hn; simp [rterm] ++ · have hf : 0 ≤ f n := hpos n ++ have hw : 0 ≤ w n := hw_nonneg n ++ have hnpos : 0 < (n : ℝ) := by exact_mod_cast (Nat.pos_of_ne_zero hn) ++ have hn1 : (1 : ℝ) ≤ (n : ℝ) := by ++ exact_mod_cast (Nat.one_le_iff_ne_zero.mpr hn) ++ have hpow : (n : ℝ) ^ σ₁ ≤ (n : ℝ) ^ σ₂ := ++ Real.rpow_le_rpow_of_exponent_le hn1 hσ₁₂ ++ have hinv : ++ (1 / ((n : ℝ) ^ σ₂)) ≤ (1 / ((n : ℝ) ^ σ₁)) := by ++ have hpos1 : 0 < (n : ℝ) ^ σ₁ := Real.rpow_pos_of_pos hnpos σ₁ ++ exact one_div_le_one_div_of_le hpos1 hpow ++ have hinv_inv : ((n : ℝ) ^ σ₂)⁻¹ ≤ ((n : ℝ) ^ σ₁)⁻¹ := by ++ simpa [one_div] using hinv ++ have hmul1 : ++ (f n) * (((n : ℝ) ^ σ₂)⁻¹) ≤ (f n) * (((n : ℝ) ^ σ₁)⁻¹) := ++ mul_le_mul_of_nonneg_left hinv_inv hf ++ have hmul2 : ++ ((f n) * (((n : ℝ) ^ σ₂)⁻¹)) * (w n) ++ ≤ ((f n) * (((n : ℝ) ^ σ₁)⁻¹)) * (w n) := ++ mul_le_mul_of_nonneg_right hmul1 hw ++ simpa [rterm, hn, div_eq_mul_inv, mul_assoc] using hmul2 ++ ++ have rterm_tend : ∀ n, Tendsto (fun σ : ℝ => rterm σ n) (𝓝[>] (1 : ℝ)) (𝓝 (rterm 1 n)) := by ++ intro n ++ have hterm : ++ Tendsto (fun σ : ℝ => term (fun n ↦ (f n : ℂ)) (σ : ℝ) n) ++ (𝓝[>] (1 : ℝ)) (𝓝 ((f n : ℂ) / (n : ℂ))) := by ++ by_cases hn : n = 0 ++ · subst hn ++ simp [term, LSeries.term] ++ · have hden : ++ Tendsto (fun σ : ℝ => ((n : ℂ) ^ ((σ : ℝ) : ℂ))) (𝓝[>] (1 : ℝ)) (𝓝 ((n : ℂ) ^ (1 : ℂ))) := by ++ simpa using ((continuous_ofReal.tendsto (1 : ℝ)).mono_left nhdsWithin_le_nhds).const_cpow ++ ++ have hden' : ++ Tendsto (fun σ : ℝ => ((n : ℂ) ^ ((σ : ℝ) : ℂ))) (𝓝[>] (1 : ℝ)) (𝓝 (n : ℂ)) := by ++ simpa using hden ++ ++ have hnC : (n : ℂ) ≠ 0 := by ++ exact_mod_cast hn ++ ++ have hterm : ++ Tendsto (fun σ : ℝ => term (fun n ↦ (f n : ℂ)) (σ : ℝ) n) ++ (𝓝[>] (1 : ℝ)) (𝓝 ((f n : ℂ) / (n : ℂ))) := by ++ have hnC : (n : ℂ) ≠ 0 := by ++ exact_mod_cast hn ++ simpa [term, LSeries.term, hn] using! ++ (tendsto_const_nhds.div hden' hnC) ++ exact hterm ++ ++ have hsummand : ++ Tendsto ++ (fun σ : ℝ => ++ term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) ++ (𝓝[>] (1 : ℝ)) ++ (𝓝 (((f n : ℂ) / (n : ℂ)) * 𝓕 ψ.toFun (y n))) := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using (hterm.mul_const (𝓕 ψ.toFun (y n))) ++ ++ have hre : ∀ σ, rterm σ n = ++ (term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)).re := by ++ intro σ ++ have := congrArg Complex.re (summand_eq_ofReal σ n) ++ simpa [Complex.ofReal_re] using this.symm ++ ++ have hRe : Tendsto ++ (fun σ : ℝ => ++ (term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)).re) ++ (𝓝[>] (1 : ℝ)) ++ (𝓝 ((((f n : ℂ) / (n : ℂ)) * 𝓕 ψ.toFun (y n)).re)) := ++ (continuous_re.tendsto _).comp hsummand ++ ++ have hlimit_re : ++ (f n / (n : ℝ)) * (𝓕 ψ.toFun (y n)).re = rterm 1 n := by ++ have h0 : ++ (term (fun n ↦ (f n : ℂ)) (1 : ℝ) n * 𝓕 ψ.toFun (y n)).re = rterm 1 n := by ++ have := congrArg Complex.re (summand_eq_ofReal (σ := (1 : ℝ)) n) ++ simpa [Complex.ofReal_re] using this ++ ++ by_cases hn : n = 0 ++ · subst hn ++ simp [rterm, y] ++ · have h1 : ++ (term (fun n ↦ (f n : ℂ)) (1 : ℝ) n * 𝓕 ψ.toFun (y n)).re ++ = (f n / (n : ℝ)) * (𝓕 ψ.toFun (y n)).re := by ++ simp [Complex.mul_re, term, LSeries.term, hn, y, ++ (hψpos (y n)).2] ++ ++ exact (h1.symm.trans h0) ++ ++ simpa [hre, hlimit_re] using hRe ++ ++ have hSumm_rterm : ∀ σ : ℝ, 1 < σ → Summable (fun n : ℕ => rterm σ n) := by ++ simpa [rterm] using limiting_fourier_variant_lim1_aux (ψ := ψ) ++ (f := f) (x := x) hpos hf hψpos ++ ++ have hT_tend : ++ Tendsto T (𝓝[>] (1 : ℝ)) (𝓝 (T 1)) := by ++ have : ++ Tendsto (fun σ : ℝ => ∑' n : ℕ, rterm σ n) ++ (𝓝[>] (1 : ℝ)) ++ (𝓝 (∑' n : ℕ, rterm (1 : ℝ) n)) := by ++ refine tendsto_tsum_of_monotone_convergence_nhdsGT_one ++ (F := rterm) ++ (hF_nonneg := rterm_nonneg) ++ (hF_antitone := rterm_antitone) ++ (hF_tend := rterm_tend) ++ (hSumm := hSumm_rterm) ++ (hbounded := hboundedT) ++ ++ simpa [T] using this ++ ++ have hToReal : ++ Tendsto (fun σ => Complex.ofReal (T σ)) (𝓝[>] (1 : ℝ)) (𝓝 (Complex.ofReal (T 1))) := ++ (continuous_ofReal.tendsto _).comp hT_tend ++ ++ have hsource : ++ (fun σ : ℝ => ++ ∑' n : ℕ, ++ term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) ++ = fun σ : ℝ => Complex.ofReal (T σ) := by ++ funext σ ++ exact (tsum_eq_ofReal_T σ) ++ ++ have hσ1 : ++ (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (↑(1:ℝ)) n * 𝓕 ψ.toFun (y n)) ++ = (↑(T 1) : ℂ) := ++ by simpa using (tsum_eq_ofReal_T (σ := (1:ℝ))) ++ have hterm1 : ++ ∀ n : ℕ, term (fun n ↦ (f n : ℂ)) (1 : ℂ) n = (f n : ℂ) / (n : ℂ) := by ++ intro n ++ by_cases hn : n = 0 ++ · subst hn ++ simp [term, LSeries.term] ++ · simp [term, LSeries.term, hn] ++ ++ have hrewrite : ++ (∑' n : ℕ, ++ term (fun n ↦ (f n : ℂ)) (1 : ℂ) n * 𝓕 ψ.toFun (y n)) ++ = ++ (∑' n : ℕ, ++ (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (y n)) := by ++ refine tsum_congr ?_ ++ intro n ++ simp [hterm1 n] ++ ++ have htarget : ++ (∑' n : ℕ, ++ (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (y n)) ++ = (↑(T 1) : ℂ) := by ++ exact (hrewrite.symm.trans hσ1) ++ ++ simpa [hsource, htarget, y] using hToReal ++ ++lemma limiting_fourier_variant ++ (hpos : 0 ≤ f) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (ψ : CS 2 ℂ) ++ (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) ++ (hx : 0 < x) : ++ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = ++ ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by ++ ++ have l2 := limiting_fourier_lim2_gt_zero (A := A) (x := x) ψ hx ++ have l3 := limiting_fourier_lim3_gt_zero (G := G) (x := x) hG ψ hx ++ ++ let S : ℝ → ℂ := fun σ' => ++ ∑' n : ℕ, ++ term (fun n ↦ (f n : ℂ)) σ' n * ++ 𝓕 ψ.toFun (1 / (2 * π) * Real.log ((n : ℝ) / x)) ++ let Pole : ℝ → ℂ := fun σ' => ++ (A : ℂ) * ((x ^ (1 - σ') : ℝ) : ℂ) * ++ ∫ u in Set.Ici (-Real.log x), ++ (rexp (-u * (σ' - 1)) : ℂ) * ++ 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π)) ++ let RHS : ℝ → ℂ := fun σ' => ++ ∫ t : ℝ, G (σ' + t * I) * ψ.toFun t * (x : ℂ) ^ (t * I) ++ ++ have haux : ++ (fun σ' : ℝ ↦ ++ ∑' (n : ℕ), ++ term (fun n ↦ (f n : ℂ)) (σ' : ℂ) n * ++ 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x)) ++ - (A : ℂ) * ((x ^ (1 - σ') : ℝ) : ℂ) * ++ ∫ (u : ℝ) in Ici (-Real.log x), ++ cexp (-( (u : ℂ) * ((σ' : ℂ) - 1))) * ++ 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π))) ++ =ᶠ[𝓝[>] (1 : ℝ)] ++ (fun σ' : ℝ ↦ ++ ∫ (t : ℝ), G ((σ' : ℂ) + (t : ℂ) * I) * ψ.toFun t * (x : ℂ) ^ ((t : ℂ) * I)) := by ++ rw [Filter.EventuallyEq] ++ ++ refine eventually_nhdsWithin_of_forall ?_ ++ intro σ' hσ' ++ have hσ' : (1 : ℝ) < σ' := by ++ simpa [Set.mem_Ioi] using hσ' ++ simpa using! (limiting_fourier_aux_gt_zero (G := G) (f := f) (A := A) hG' hf ψ hx σ' hσ') ++ ++ have haux' : ++ (fun σ' : ℝ => S σ') =ᶠ[𝓝[>] (1 : ℝ)] (fun σ' : ℝ => RHS σ' + Pole σ') := by ++ rw [Filter.EventuallyEq] at haux ⊢ ++ filter_upwards [haux] with σ' hσ' ++ have hσ'' : S σ' - Pole σ' = RHS σ' := by ++ simpa [S, Pole, RHS] using hσ' ++ have hadd : (S σ' - Pole σ') + Pole σ' = RHS σ' + Pole σ' := ++ congrArg (fun z : ℂ => z + Pole σ') hσ'' ++ simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using hadd ++ ++ let Pole₁ : ℂ := (A : ℂ) * ∫ u in Set.Ici (-Real.log x), 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π)) ++ let RHS₁ : ℂ := ∫ t : ℝ, G (1 + (t : ℂ) * I) * ψ.toFun t * (x : ℂ) ^ ((t : ℂ) * I) ++ ++ have hRHS_le : ++ ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ‖RHS σ'‖ ≤ ‖RHS₁‖ + 1 := by ++ have hball : Metric.ball RHS₁ (1 : ℝ) ∈ 𝓝 RHS₁ := by ++ simpa using (Metric.ball_mem_nhds (x := RHS₁) (ε := (1 : ℝ)) (by norm_num)) ++ have hpre : {σ' : ℝ | RHS σ' ∈ Metric.ball RHS₁ (1 : ℝ)} ∈ (𝓝[>] (1 : ℝ)) := ++ l3 hball ++ filter_upwards [hpre] with σ' hmem ++ have hdist' : dist (RHS σ') RHS₁ < (1 : ℝ) := by ++ simpa [Metric.mem_ball] using hmem ++ have hdist : ‖RHS σ' - RHS₁‖ < (1 : ℝ) := by ++ simpa [dist_eq_norm] using hdist' ++ have htri : ‖RHS σ'‖ ≤ ‖RHS₁‖ + ‖RHS σ' - RHS₁‖ := by ++ have h := norm_add_le (RHS σ' - RHS₁) RHS₁ ++ simpa [sub_add_cancel, add_comm, add_left_comm, add_assoc] using h ++ have hle : ‖RHS₁‖ + ‖RHS σ' - RHS₁‖ ≤ ‖RHS₁‖ + (1 : ℝ) := by ++ exact add_le_add_right (le_of_lt hdist) ‖RHS₁‖ ++ exact htri.trans hle ++ ++ have hPole_le : ++ ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ‖Pole σ'‖ ≤ ‖Pole₁‖ + 1 := by ++ have hball : Metric.ball Pole₁ 1 ∈ 𝓝 Pole₁ := by ++ simpa using (Metric.ball_mem_nhds Pole₁ (by norm_num : (0 : ℝ) < 1)) ++ have hpre : {σ' : ℝ | Pole σ' ∈ Metric.ball Pole₁ 1} ∈ (𝓝[>] (1 : ℝ)) := l2 hball ++ filter_upwards [hpre] with σ' hmem ++ have hdist : ‖Pole σ' - Pole₁‖ < 1 := by ++ simpa [Metric.mem_ball, dist_eq_norm] using hmem ++ have htri : ‖Pole σ'‖ ≤ ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ := by ++ have hdecomp : Pole σ' = Pole₁ + (Pole σ' - Pole₁) := by abel ++ have hnorm_eq : ‖Pole σ'‖ = ‖Pole₁ + (Pole σ' - Pole₁)‖ := by ++ simp [congrArg (fun z : ℂ => ‖z‖) hdecomp] ++ calc ++ ‖Pole σ'‖ = ‖Pole₁ + (Pole σ' - Pole₁)‖ := hnorm_eq ++ _ ≤ ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ := norm_add_le _ _ ++ have hdist_le : ‖Pole σ' - Pole₁‖ ≤ 1 := le_of_lt hdist ++ have hsum : ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ ≤ ‖Pole₁‖ + 1 := by ++ simpa [add_comm, add_left_comm, add_assoc] using (add_le_add_left hdist_le ‖Pole₁‖) ++ exact htri.trans hsum ++ ++ have hS_le : ++ ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ++ ‖S σ'‖ ≤ (‖RHS₁‖ + 1) + (‖Pole₁‖ + 1) := by ++ rw [Filter.EventuallyEq] at haux' ++ filter_upwards [haux', hRHS_le, hPole_le] with σ' hEq hR hP ++ calc ++ ‖S σ'‖ = ‖RHS σ' + Pole σ'‖ := by simp [hEq] ++ _ ≤ ‖RHS σ'‖ + ‖Pole σ'‖ := norm_add_le _ _ ++ _ ≤ (‖RHS₁‖ + 1) + (‖Pole₁‖ + 1) := by ++ exact add_le_add hR hP ++ ++ have hbounded : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ' : ℝ => ‖S σ'‖) := by ++ let C : ℝ := ‖RHS₁‖ + 1 + (‖Pole₁‖ + 1) ++ simp only [BoundedAtFilter, Asymptotics.IsBigO, Asymptotics.IsBigOWith] ++ refine ⟨C, ?_⟩ ++ filter_upwards [hS_le] with σ' hσ' ++ simpa [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg (S σ'))] using hσ' ++ ++ have hcoef : (1 / (2 * π) : ℝ) = (π⁻¹ * 2⁻¹ : ℝ) := by field_simp [pi_ne_zero] ++ ++ have l1 := ++ limiting_fourier_variant_lim1 ++ (f := f) (x := x) (ψ := ψ) ++ hpos hψpos ++ (S := S) ++ (hSdef := by ++ intro σ ++ simp [S, hcoef] ) ++ hbounded ++ hf ++ have l1S : ++ Tendsto S (𝓝[>] (1 : ℝ)) ++ (𝓝 (∑' n : ℕ, (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (1 / (2 * π) * Real.log (↑n / x)))) := by ++ simpa [S, hcoef] using l1 ++ ++ have l12 : Tendsto (fun σ' : ℝ => S σ' - Pole σ') (𝓝[>] (1 : ℝ)) ++ (𝓝 ((∑' n : ℕ, (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (1 / (2 * π) * Real.log (↑n / x))) - Pole₁)) := ++ l1S.sub l2 ++ ++ have hPole : (Pole : ℝ → ℂ) =ᶠ[𝓝[>] (1 : ℝ)] Pole := by simp ++ have haux_sub : ++ (fun σ' : ℝ => S σ' - Pole σ') =ᶠ[𝓝[>] (1 : ℝ)] RHS := by ++ filter_upwards [haux'] with σ' hσ' ++ calc ++ S σ' - Pole σ' ++ = (RHS σ' + Pole σ') - Pole σ' := by simp [hσ'] ++ _ = RHS σ' := by simp ++ have hlim := ++ tendsto_nhds_unique_of_eventuallyEq (l1S.sub l2) l3 haux_sub ++ ++ simpa [Pole₁, RHS₁] using! hlim ++ ++lemma norm_mul_integral_Ici_le_integral_norm ++ (A : ℂ) (F : ℝ → ℂ) (a : ℝ) ++ (hF : IntegrableOn F (Set.Ici a)) ++ (hnorm : Integrable (fun u : ℝ => ‖F u‖)) : ++ ‖A * (∫ u in Set.Ici a, F u)‖ ≤ ‖A‖ * (∫ u : ℝ, ‖F u‖) := by ++ have hmul : ‖A * (∫ u in Set.Ici a, F u)‖ = ‖A‖ * ‖∫ u in Set.Ici a, F u‖ := by ++ simp ++ have hnormI : ++ ‖∫ u in Set.Ici a, F u‖ ≤ ∫ u in Set.Ici a, ‖F u‖ := by ++ have _ : Integrable F (Measure.restrict volume (Set.Ici a)) := hF ++ have h : ++ ‖∫ u, F u ∂Measure.restrict volume (Set.Ici a)‖ ++ ≤ ∫ u, ‖F u‖ ∂Measure.restrict volume (Set.Ici a) := ++ norm_integral_le_integral_norm (μ := Measure.restrict volume (Set.Ici a)) (f := F) ++ simpa using h ++ ++ have hdom : ++ (∫ u in Set.Ici a, ‖F u‖) ≤ ∫ u : ℝ, ‖F u‖ := by ++ have hEq : ++ (∫ u in Set.Ici a, ‖F u‖) = ++ ∫ u : ℝ, Set.indicator (Set.Ici a) (fun u => ‖F u‖) u := by ++ have h := (integral_indicator (μ := (volume : Measure ℝ)) ++ (s := Set.Ici a) (f := fun u => ‖F u‖)) ++ have h' := h measurableSet_Ici ++ simpa using h'.symm ++ have hind_int : ++ Integrable (Set.indicator (Set.Ici a) (fun u => ‖F u‖)) := ++ hnorm.indicator measurableSet_Ici ++ have hpoint : ++ Set.indicator (Set.Ici a) (fun u => ‖F u‖) ++ ≤ᵐ[volume] (fun u : ℝ => ‖F u‖) := by ++ filter_upwards with u ++ by_cases hu : u ∈ Set.Ici a ++ · simp [Set.indicator_of_mem hu] ++ · simp [Set.indicator_of_notMem hu] ++ have hmono := ++ integral_mono_ae (μ := (volume : Measure ℝ)) ++ hind_int hnorm hpoint ++ simpa [hEq] using hmono ++ ++ calc ++ ‖A * (∫ u in Set.Ici a, F u)‖ ++ = ‖A‖ * ‖∫ u in Set.Ici a, F u‖ := hmul ++ _ ≤ ‖A‖ * (∫ u in Set.Ici a, ‖F u‖) := ++ mul_le_mul_of_nonneg_left hnormI (by simp) ++ _ ≤ ‖A‖ * (∫ u : ℝ, ‖F u‖) := ++ mul_le_mul_of_nonneg_left hdom (by simp) ++ ++lemma fourier_decay_of_CS2 ++ (ψ : CS 2 ℂ) : ++ ∃ C : ℝ, ∀ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by ++ let ψ' : W21 := (ψ : W21) ++ obtain ⟨C, hC⟩ : ++ ∃ C : ℝ, ∀ u : ℝ, ‖𝓕 (ψ' : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by ++ simpa using (decay_bounds_cor (ψ := ψ')) ++ refine ⟨C, ?_⟩ ++ intro u ++ simpa [ψ'] using! (hC u) ++ ++lemma integrable_norm_fourier_scaled_of_CS2 ++ (ψ : CS 2 ℂ) : ++ Integrable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by ++ obtain ⟨C, hdecay⟩ := fourier_decay_of_CS2 (ψ := ψ) ++ have hC_nonneg : 0 ≤ C := by ++ have h0 := hdecay 0 ++ have hnorm : 0 ≤ ‖𝓕 (ψ : ℝ → ℂ) 0‖ := norm_nonneg _ ++ have hC' : ‖𝓕 (ψ : ℝ → ℂ) 0‖ ≤ C := by simpa using h0 ++ exact hnorm.trans hC' ++ have hmaj_int : Integrable (fun u : ℝ => (C : ℝ) / (1 + (u / (2 * Real.pi))^2)) := by ++ have hbase : Integrable (fun u : ℝ => (1 + u ^ 2)⁻¹) := integrable_inv_one_add_sq ++ have hscale : ++ Integrable (fun u : ℝ => (1 + (u / (2 * Real.pi)) ^ 2)⁻¹) := ++ hbase.comp_div (by nlinarith [Real.pi_pos]) ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, pow_two] using ++ hscale.const_mul C ++ have hle : ++ (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) ++ ≤ᵐ[volume] ++ (fun u : ℝ => (C : ℝ) / (1 + (u / (2 * Real.pi))^2)) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro u ++ simpa using (hdecay (u / (2 * Real.pi))) ++ have hle_norm : ++ (fun u : ℝ => ‖‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖‖) ++ ≤ᵐ[volume] ++ (fun u : ℝ => ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖) := by ++ refine hle.mono ?_ ++ intro u hu ++ have hden_pos : 0 < 1 + (u / (2 * Real.pi)) ^ 2 := by nlinarith ++ have hnonneg : 0 ≤ (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := ++ div_nonneg hC_nonneg hden_pos.le ++ have hleft_nonneg : 0 ≤ ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖ := norm_nonneg _ ++ have hbound : ‖‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖‖ ≤ ++ (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := by ++ simpa [Real.norm_eq_abs, abs_of_nonneg hleft_nonneg] using hu ++ have hC_abs : |C| = C := abs_of_nonneg hC_nonneg ++ have hden_abs : |1 + (u / (2 * Real.pi))^2| = 1 + (u / (2 * Real.pi))^2 := by ++ have : 0 ≤ 1 + (u / (2 * Real.pi))^2 := by nlinarith ++ simpa using abs_of_nonneg this ++ have hnorm : ++ ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖ = ++ (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := by ++ have hrec : ++ ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖ = ++ |C| / |1 + (u / (2 * Real.pi))^2| := by ++ simp [Real.norm_eq_abs] ++ simp [hC_abs, hden_abs, hrec] ++ simpa [hnorm] using hbound ++ have hmaj_int_norm : ++ Integrable (fun u : ℝ => ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖) := ++ hmaj_int.norm ++ have hmeas : ++ AEStronglyMeasurable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by ++ have hcont : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) u := by ++ simpa using! continuous_FourierIntegral (ψ : W21) ++ have hcont_scaled : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) := ++ hcont.comp (by continuity) ++ exact hcont_scaled.aestronglyMeasurable.norm ++ exact hmaj_int_norm.mono' hmeas hle_norm ++ ++lemma exists_bound_norm_G_on_tsupport ++ (hG : ContinuousOn G {s : ℂ | 1 ≤ s.re}) ++ (ψ : CS 2 ℂ) : ++ ∃ K : ℝ, ∀ t : ℝ, t ∈ tsupport (ψ : ℝ → ℂ) → ++ ‖G (1 + t * Complex.I)‖ ≤ K := by ++ let s : Set ℝ := tsupport (ψ : ℝ → ℂ) ++ have hscompact : IsCompact s := by ++ simpa [s] using (ψ.h2.isCompact : IsCompact (tsupport (ψ : ℝ → ℂ))) ++ have hphi_cont : Continuous (fun t : ℝ => (1 : ℂ) + t * Complex.I) := by continuity ++ have hphi_maps : ++ Set.MapsTo (fun t : ℝ => (1 : ℂ) + t * Complex.I) s {z : ℂ | 1 ≤ z.re} := by ++ intro t ht ++ simp ++ have hGcomp : ContinuousOn (fun t : ℝ => G ((1 : ℂ) + t * Complex.I)) s := ++ hG.comp hphi_cont.continuousOn hphi_maps ++ have hnorm_contOn : ContinuousOn (fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) s := hGcomp.norm ++ have hbdd : BddAbove ((fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s) := ++ (hscompact.image_of_continuousOn hnorm_contOn).bddAbove ++ refine ⟨sSup ((fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s), ?_⟩ ++ intro t ht ++ have : ‖G ((1 : ℂ) + t * Complex.I)‖ ∈ ++ (fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s := ⟨t, ht, rfl⟩ ++ exact le_csSup hbdd this ++ ++lemma norm_integrand_le_K_mul_norm_psi ++ {x K : ℝ} ++ (hx : 0 < x) ++ (hK : ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K) : ++ ∀ t : ℝ, ++ ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ ≤ K * ‖ψ t‖ := by ++ intro t ++ by_cases ht : t ∈ Function.support ψ ++ · have hxnorm : ‖((x : ℂ) ^ (t * Complex.I))‖ = 1 := norm_x_cpow_it x t hx ++ calc ++ ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ ++ = ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ * ‖((x : ℂ) ^ (t * Complex.I))‖ := by ++ simp [mul_left_comm, mul_comm] ++ _ = ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ * 1 := by simp [hxnorm] ++ _ ≤ K * ‖ψ t‖ := by ++ have hGle : ‖G (1 + t * Complex.I)‖ ≤ K := hK t ht ++ have : ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ ≤ K * ‖ψ t‖ := ++ mul_le_mul_of_nonneg_right hGle (norm_nonneg _) ++ simpa [mul_assoc, mul_left_comm, mul_comm] using this ++ · have hψ0 : ψ t = 0 := by ++ by_contra hψ0 ++ exact ht (by simpa [Function.support] using hψ0) ++ simp [hψ0, mul_comm] ++ ++lemma norm_error_integral_le ++ (ψ : ℝ → ℂ) (x K : ℝ) ++ (hGline_meas : Measurable (fun t : ℝ => G (1 + t * I))) ++ (hψ_meas : AEStronglyMeasurable ψ) ++ (hx : 0 < x) ++ (hK : ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K) ++ (hψ : Integrable (fun t : ℝ => ‖ψ t‖) ) : ++ ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ ++ ≤ K * (∫ t : ℝ, ‖ψ t‖) := by ++ have h1 : ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ ++ ≤ ∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ := by ++ simpa using (norm_integral_le_integral_norm ++ (f := fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I)))) ++ have hmeas_main : AEStronglyMeasurable ++ (fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))) := by ++ have hG' : AEMeasurable fun t : ℝ => G (1 + t * Complex.I) := hGline_meas.aemeasurable ++ have hψ_meas' : AEMeasurable ψ := hψ_meas.aemeasurable ++ have hx_ne : (x : ℂ) ≠ 0 := by exact_mod_cast (ne_of_gt hx) ++ have hx_ne' : NeZero (x : ℂ) := ⟨hx_ne⟩ ++ have hxpow_meas : AEMeasurable fun t : ℝ => ((x : ℂ) ^ (t * Complex.I)) := by ++ have hcontℂ : Continuous fun z : ℂ => ((x : ℂ) ^ z) := ++ continuous_const_cpow (z := (x : ℂ)) ++ have hcont : Continuous fun t : ℝ => ((x : ℂ) ^ ((t : ℂ) * Complex.I)) := ++ hcontℂ.comp (by ++ have h : Continuous fun t : ℝ => (t : ℂ) * Complex.I := by ++ simpa using! (continuous_ofReal.mul continuous_const) ++ simpa [mul_comm] using h) ++ exact hcont.measurable.aemeasurable ++ have hGψ_meas : AEMeasurable fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) := hG'.mul hψ_meas' ++ have htotal : AEMeasurable (fun t : ℝ => ++ (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))) := ++ hGψ_meas.mul hxpow_meas ++ exact htotal.aestronglyMeasurable ++ have hpt : (fun t : ℝ => ++ ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) ++ ≤ᵐ[volume] (fun t : ℝ => K * ‖ψ t‖) := by ++ refine Eventually.of_forall ?_ ++ intro t ++ exact norm_integrand_le_K_mul_norm_psi (hx := hx) (hK := hK) t ++ have hR : Integrable (fun t : ℝ => K * ‖ψ t‖) := hψ.const_mul K ++ have hL : Integrable (fun t : ℝ => ++ ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) := by ++ have hpt_norm : ++ (fun t : ℝ => ‖‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖‖) ++ ≤ᵐ[volume] (fun t : ℝ => K * ‖ψ t‖) := hpt.mono (by ++ intro t ht ++ simpa [norm_mul, mul_comm, mul_left_comm, mul_assoc] using ht) ++ exact hR.mono' hmeas_main.norm hpt_norm ++ have h2 : (∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) ++ ≤ ∫ t : ℝ, K * ‖ψ t‖ := integral_mono_ae (μ := (volume : Measure ℝ)) hL hR hpt ++ have h3 : (∫ t : ℝ, K * ‖ψ t‖) = K * (∫ t : ℝ, ‖ψ t‖) := by ++ simp [integral_const_mul] ++ calc ++ ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ ++ ≤ ∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ := h1 ++ _ ≤ ∫ t : ℝ, K * ‖ψ t‖ := h2 ++ _ = K * (∫ t : ℝ, ‖ψ t‖) := h3 ++ ++lemma crude_upper_bound ++ (hpos : 0 ≤ f) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (ψ : CS 2 ℂ) ++ (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) : ++ ∃ B : ℝ, ∀ x : ℝ, 0 < x → ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ B := by ++ ++ have hψ_int : MeasureTheory.Integrable (ψ : ℝ → ℂ) := by ++ simpa using (ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2) ++ have hψ_norm_int : MeasureTheory.Integrable (fun t : ℝ => ‖(ψ : ℝ → ℂ) t‖) := ++ hψ_int.norm ++ have hψ_meas : MeasureTheory.AEStronglyMeasurable (ψ : ℝ → ℂ) := ++ hψ_int.aestronglyMeasurable ++ ++ rcases exists_bound_norm_G_on_tsupport (G := G) hG ψ with ⟨K, hK_ts⟩ ++ have hK_support : ++ ∀ t : ℝ, t ∈ Function.support (ψ : ℝ → ℂ) → ‖G (1 + t * Complex.I)‖ ≤ K := by ++ have hbnG (hKts : ∀ t : ℝ, t ∈ tsupport ψ → ‖G (1 + t * Complex.I)‖ ≤ K) : ++ ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K := by ++ intro t ht ++ exact hKts t ((subset_tsupport ψ) ht) ++ exact hbnG hK_ts ++ ++ have hGline_meas : Measurable (fun t : ℝ => G (1 + t * Complex.I)) := by ++ have hline_cont : Continuous (fun t : ℝ => (1 : ℂ) + t * Complex.I) := by ++ continuity ++ have hmem : ∀ t : ℝ, ((1 : ℂ) + t * Complex.I) ∈ {s : ℂ | 1 ≤ s.re} := by ++ intro t ++ simp ++ have hcont : Continuous (G ∘ fun t : ℝ => (1 : ℂ) + t * Complex.I) := ++ hG.comp_continuous hline_cont hmem ++ simpa [Function.comp] using! hcont.measurable ++ ++ have hF_norm_int : ++ MeasureTheory.Integrable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := ++ integrable_norm_fourier_scaled_of_CS2 ψ ++ have hF_meas : ++ MeasureTheory.AEStronglyMeasurable ++ (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := by ++ have hcont : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) u := by ++ simpa using! continuous_FourierIntegral (ψ : W21) ++ have hcont_scaled : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) := ++ hcont.comp (by continuity) ++ exact hcont_scaled.aestronglyMeasurable ++ have hF_int : ++ MeasureTheory.Integrable (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := ++ by ++ have hfin_norm : ++ MeasureTheory.HasFiniteIntegral ++ (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := ++ hF_norm_int.hasFiniteIntegral ++ have hfin : ++ MeasureTheory.HasFiniteIntegral ++ (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := by ++ simpa [MeasureTheory.hasFiniteIntegral_iff_norm] using hfin_norm ++ exact ⟨hF_meas, hfin⟩ ++ refine ⟨K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) ++ + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖), ?_⟩ ++ intro x hx ++ set I : ℂ := ∫ u in Set.Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) with hI ++ ++ have hlim := ++ limiting_fourier_variant (f := f) (A := A) (G := G) ++ hpos hG hG' hf ψ hψpos hx ++ have hlim' : ++ (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) ++ - A * I ++ = ∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I) := by ++ simpa [hI] using hlim ++ ++ have htsum : ++ (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) ++ = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := by ++ have h' : ++ (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) ++ = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := ++ eq_add_of_sub_eq hlim' ++ simpa [add_comm, mul_comm, mul_left_comm, mul_assoc] using h' ++ ++ have hRHS_bound : ++ ‖∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)‖ ++ ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) := ++ norm_error_integral_le (G := G) (ψ := (ψ : ℝ → ℂ)) (x := x) (K := K) ++ hGline_meas hψ_meas hx hK_support hψ_norm_int ++ ++ have hA_bound : ++ ‖A * I‖ ≤ ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by ++ have hF_on : MeasureTheory.IntegrableOn ++ (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) ++ (Set.Ici (-Real.log x)) := ++ hF_int.integrableOn ++ simpa [hI] using ++ norm_mul_integral_Ici_le_integral_norm (A := A) ++ (F := fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) ++ (a := -Real.log x) hF_on hF_norm_int ++ ++ have htsum_std : ++ (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))) ++ = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := by ++ simpa [one_div, mul_comm, mul_left_comm, mul_assoc] using htsum ++ ++ have hbound : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) ++ (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ ++ ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) ++ + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by ++ have hnorm : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) ++ (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ = ++ ‖(∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I‖ := ++ congrArg norm htsum_std ++ calc ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) ++ (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ ++ = ‖(∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I‖ := hnorm ++ _ ≤ ‖∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)‖ + ‖A * I‖ := ++ norm_add_le _ _ ++ _ ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) ++ + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := ++ add_le_add hRHS_bound hA_bound ++ exact hbound ++ ++lemma Real.fourierIntegral_convolution {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) : ++ 𝓕 (convolution f g (ContinuousLinearMap.mul ℂ ℂ) volume) = 𝓕 f * 𝓕 g := by ++ ext y ++ simp only [Pi.mul_apply, FourierTransform.fourier, MeasureTheory.convolution, ++ VectorFourier.fourierIntegral, ContinuousLinearMap.mul_apply'] ++ have h_int : Integrable (fun p : ℝ × ℝ ↦ 𝐞 (-(y * p.1)) • (f p.2 * g (p.1 - p.2))) := by ++ simp only [Circle.smul_def, smul_eq_mul] ++ refine (Integrable.convolution_integrand (ContinuousLinearMap.mul ℂ ℂ) hf hg).bdd_mul ++ (c := 1) ?_ ?_ ++ · exact (by continuity : Continuous _).aestronglyMeasurable ++ · filter_upwards with p; simp ++ calc ∫ v, 𝐞 (-(y * v)) • ∫ t, f t * g (v - t) ++ = ∫ v, ∫ t, 𝐞 (-(y * v)) • (f t * g (v - t)) := by ++ simp only [Circle.smul_def, smul_eq_mul, ← integral_const_mul] ++ _ = ∫ t, ∫ v, 𝐞 (-(y * v)) • (f t * g (v - t)) := integral_integral_swap h_int ++ _ = ∫ t, f t • ∫ v, 𝐞 (-(y * v)) • g (v - t) := by ++ simp only [Circle.smul_def, smul_eq_mul, mul_left_comm, integral_const_mul] ++ _ = ∫ t, f t • ∫ u, 𝐞 (-(y * (u + t))) • g u := by ++ congr 1; ext t ++ rw [← integral_add_right_eq_self (fun v ↦ 𝐞 (-(y * v)) • g (v - t)) t]; simp ++ _ = ∫ t, f t • ∫ u, (𝐞 (-(y * t)) * 𝐞 (-(y * u))) • g u := by ++ congr 2 with t; congr 1 ++ simp only [mul_add, neg_add, mul_comm, Real.fourierChar.map_add_eq_mul] ++ _ = ∫ t, 𝐞 (-(y * t)) • f t • ∫ u, 𝐞 (-(y * u)) • g u := by ++ congr 1; ext t ++ simp only [mul_smul, Circle.smul_def, smul_eq_mul, integral_const_mul]; ring ++ _ = (∫ t, 𝐞 (-(y * t)) • f t) * ∫ u, 𝐞 (-(y * u)) • g u := by ++ simp only [Circle.smul_def, smul_eq_mul, ← mul_assoc, integral_mul_const] ++ ++lemma Real.fourierIntegral_conj_neg {f : ℝ → ℂ} (y : ℝ) : ++ 𝓕 (fun x ↦ conj (f (-x))) y = conj (𝓕 f y) := by ++ simp only [fourier_real_eq] ++ have h_conj : ∀ x, 𝐞 (-(x * y)) • conj (f (-x)) = conj (𝐞 (x * y) • f (-x)) := fun x ↦ by ++ simp only [Circle.smul_def, Real.fourierChar_apply, map_mul, smul_eq_mul, neg_mul, ++ Complex.ofReal_neg, mul_neg] ++ congr 1 ++ rw [← Complex.exp_conj] ++ simp only [map_mul, Complex.conj_I, Complex.conj_ofReal, mul_neg] ++ calc ∫ x, 𝐞 (-(x * y)) • conj (f (-x)) ++ = ∫ x, conj (𝐞 (x * y) • f (-x)) := by congr 1; ext x; exact h_conj x ++ _ = conj (∫ x, 𝐞 (x * y) • f (-x)) := integral_conj ++ _ = conj (∫ x, 𝐞 (-(x * y)) • f x) := by ++ rw [← integral_neg_eq_self (fun x => 𝐞 (-(x * y)) • f x)] ++ congr 2 with x; ring_nf ++ ++lemma auto_cheby_exists_smooth_nonneg_fourier_kernel : ++ ∃ (ψ : ℝ → ℂ), ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ ++ (∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) ∧ 0 < (𝓕 ψ 0).re := by ++ obtain ⟨φ_real, hφSmooth, hφCompact, hφIcc, _, hφsupp⟩ := ++ smooth_urysohn_support_Ioo (a := 1/2) (b := 1) (c := 1) (d := 2) (by norm_num) (by norm_num) ++ let φ : ℝ → ℂ := Complex.ofReal ∘ φ_real ++ let φ_rev : ℝ → ℂ := fun x ↦ conj (φ (-x)) ++ let ψ_fun : ℝ → ℂ := convolution φ φ_rev (ContinuousLinearMap.mul ℂ ℂ) volume ++ have hφSmooth' : ContDiff ℝ ∞ φ := contDiff_ofReal.comp hφSmooth ++ have hφCompact' : HasCompactSupport φ := hφCompact.comp_left rfl ++ have hφRevSmooth : ContDiff ℝ ∞ φ_rev := Complex.conjCLE.contDiff.comp (hφSmooth'.comp contDiff_neg) ++ have hφRevCompact : HasCompactSupport φ_rev := (hφCompact'.comp_homeomorph (Homeomorph.neg ℝ)).comp_left (by simp) ++ have hφInt : Integrable φ := hφSmooth'.continuous.integrable_of_hasCompactSupport hφCompact' ++ have hφRevInt : Integrable φ_rev := hφRevSmooth.continuous.integrable_of_hasCompactSupport hφRevCompact ++ have hψSmooth : ContDiff ℝ ∞ ψ_fun := by ++ convert! hφRevCompact.contDiff_convolution_right (ContinuousLinearMap.mul ℝ ℂ) ++ (hφSmooth'.continuous.locallyIntegrable (μ := volume)) hφRevSmooth ++ have hψCompact : HasCompactSupport ψ_fun := ++ HasCompactSupport.convolution (ContinuousLinearMap.mul ℂ ℂ) hφCompact' hφRevCompact ++ refine ⟨ψ_fun, hψSmooth, hψCompact, fun y ↦ ?_, ?_⟩ ++ · rw [Real.fourierIntegral_convolution hφInt hφRevInt, Pi.mul_apply, ++ Real.fourierIntegral_conj_neg y, mul_comm, ← Complex.normSq_eq_conj_mul_self] ++ exact ⟨Complex.normSq_nonneg _, rfl⟩ ++ · have hφ_nonneg : ∀ x, 0 ≤ φ_real x := fun x ↦ by ++ have hx := hφIcc x; by_cases h : x ∈ Set.Icc (1:ℝ) 1 ++ · simp only [Set.indicator_of_mem h, Pi.one_apply] at hx; linarith ++ · simp only [Set.indicator_of_notMem h] at hx; exact hx ++ have hvol_supp : (1 : ENNReal) ≤ volume (Function.support φ_real) := by ++ have hsub : Set.Ico (1:ℝ) 2 ⊆ Function.support φ_real := fun x hx ↦ ++ hφsupp.symm ▸ Set.mem_Ioo.mpr ⟨by linarith [hx.1], hx.2⟩ ++ calc _ = volume (Set.Ico (1:ℝ) 2) := by simp [Real.volume_Ico]; norm_num ++ _ ≤ _ := volume.mono hsub ++ have hφint_pos : 0 < ∫ x, φ_real x := ++ (integral_pos_iff_support_of_nonneg_ae (.of_forall hφ_nonneg) ++ (hφSmooth.continuous.integrable_of_hasCompactSupport hφCompact)).2 ++ (lt_of_lt_of_le (by simp) hvol_supp) ++ have hFφ0_re : 0 < (𝓕 φ 0).re := by ++ simp only [φ, fourier_real_eq, mul_zero, neg_zero, AddChar.map_zero_eq_one, one_smul, ++ Function.comp_apply] ++ have hint : Integrable (fun x => (φ_real x : ℂ)) := ++ (hφSmooth.continuous.integrable_of_hasCompactSupport hφCompact).ofReal ++ calc (∫ x, (φ_real x : ℂ)).re = ∫ x, (φ_real x : ℂ).re := (integral_re hint).symm ++ _ = ∫ x, φ_real x := by simp only [Complex.ofReal_re] ++ _ > 0 := hφint_pos ++ rw [Real.fourierIntegral_convolution hφInt hφRevInt, Pi.mul_apply, ++ Real.fourierIntegral_conj_neg 0, mul_comm, ← Complex.normSq_eq_conj_mul_self] ++ exact Complex.normSq_pos.2 (fun h ↦ (ne_of_gt hFφ0_re) (by simp [h])) ++ ++lemma auto_cheby_fourier_summable (hpos : 0 ≤ f) (hf : ∀ σ', 1 < σ' → Summable (nterm f σ')) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ψ : ℝ → ℂ) (hψSmooth : ContDiff ℝ ∞ ψ) (hψCompact : HasCompactSupport ψ) ++ (hψpos : ∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) (x : ℝ) (hx : 1 ≤ x) : ++ Summable fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x)) := by ++ let ψCS : CS 2 ℂ := ⟨ψ, hψSmooth.of_le (by norm_cast), hψCompact⟩ ++ let S : ℝ → ℂ := fun σ' ↦ ∑' n, term (f · : ℕ → ℂ) σ' n * 𝓕 ψCS.toFun (1 / (2 * π) * Real.log (n / x)) ++ let Pole : ℝ → ℂ := fun σ' ↦ (A : ℂ) * (x ^ (1 - σ') : ℝ) * ++ ∫ u in Set.Ici (-Real.log x), (rexp (-u * (σ' - 1)) : ℂ) * 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π)) ++ let RHS : ℝ → ℂ := fun σ' ↦ ∫ t : ℝ, G (σ' + t * I) * ψCS.toFun t * (x : ℂ) ^ (t * I) ++ have l2 := limiting_fourier_lim2 (A := A) (x := x) ψCS hx ++ have l3 := limiting_fourier_lim3 (G := G) hG ψCS hx ++ have haux : (fun σ' ↦ S σ' - Pole σ') =ᶠ[𝓝[>] 1] RHS := eventually_nhdsWithin_of_forall fun σ' hσ' ↦ by ++ simpa [S, Pole, RHS] using! limiting_fourier_aux hG' hf ψCS hx σ' hσ' ++ have hS_tendsto : Tendsto S (𝓝[>] 1) (𝓝 (RHS 1 + A * ∫ u in Set.Ici (-Real.log x), ++ 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π)))) := by ++ convert! (l3.congr' haux.symm).add l2 using 1; ext σ'; simp [S, Pole] ++ have hbounded : BoundedAtFilter (𝓝[>] 1) (fun σ' ↦ ‖S σ'‖) := by ++ simp only [BoundedAtFilter] ++ let L := ‖RHS 1 + A * ∫ u in Set.Ici (-Real.log x), 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π))‖ ++ have : ∀ᶠ σ' in 𝓝[>] 1, ‖S σ'‖ < L + 1 := ++ hS_tendsto.norm.eventually_lt tendsto_const_nhds (lt_add_one L) ++ exact Asymptotics.IsBigO.of_bound (L + 1) (by filter_upwards [this] with σ h; simpa using h.le) ++ let y : ℕ → ℝ := fun n ↦ (1 / (2 * π)) * Real.log (n / x) ++ let w : ℕ → ℝ := fun n ↦ (𝓕 ψCS.toFun (y n)).re ++ have hw : ∀ n, 0 ≤ w n := fun n ↦ (hψpos (y n)).1 ++ let rt : ℝ → ℕ → ℝ := fun σ n ↦ if n = 0 then 0 else f n / (n : ℝ) ^ σ * w n ++ have rt_nn σ n : 0 ≤ rt σ n := by ++ simp only [rt]; split_ifs with hn ++ · rfl ++ · exact mul_nonneg (div_nonneg (hpos n) (Real.rpow_pos_of_pos (Nat.cast_pos.mpr ++ (Nat.pos_of_ne_zero hn)) σ).le) (hw n) ++ have hS_eq σ' (hσ' : 1 < σ') : S σ' = ↑(∑' n, rt σ' n) := by ++ rw [Complex.ofReal_tsum]; apply tsum_congr; intro n ++ simp only [rt, term, LSeries.term, y, w, one_div, mul_inv_rev] ++ split_ifs with hn <;> simp only [hn, CharP.cast_eq_zero, Complex.ofReal_zero, zero_mul, ++ Complex.ofReal_mul, Complex.ofReal_div] ++ rw [Complex.ofReal_cpow (Nat.cast_nonneg n)]; congr 1 ++ exact Complex.ext rfl (hψpos _).2 ++ have hMono n : AntitoneOn (fun σ ↦ rt σ n) (Set.Ioi 1) := fun σ₁ _ σ₂ _ h ↦ by ++ simp only [rt]; split_ifs with hn; · rfl ++ apply mul_le_mul_of_nonneg_right _ (hw n) ++ apply div_le_div_of_nonneg_left (hpos n) (Real.rpow_pos_of_pos (Nat.cast_pos.mpr ++ (Nat.pos_of_ne_zero hn)) σ₁) ++ exact Real.rpow_le_rpow_of_exponent_le (Nat.one_le_cast.mpr (Nat.pos_of_ne_zero hn)) h ++ have hT_bdd : BoundedAtFilter (𝓝[>] 1) fun σ ↦ ∑' n, rt σ n := by ++ rw [BoundedAtFilter, Asymptotics.isBigO_iff] at hbounded ⊢ ++ obtain ⟨C, hC⟩ := hbounded ++ refine ⟨C, ?_⟩ ++ filter_upwards [hC, self_mem_nhdsWithin] with σ hnorm hσ ++ rw [hS_eq σ hσ] at hnorm; simpa using hnorm ++ have hSumm σ (hσ : 1 < σ) : Summable (rt σ ·) := by ++ simpa [rt, w, y] using limiting_fourier_variant_lim1_aux ψCS hpos hf hψpos σ hσ ++ have hSumm_1 : Summable (rt 1 ·) := by ++ let σ_seq : ℕ → ℝ := fun k ↦ 1 + 1 / ((k : ℝ) + 1) ++ have hσ_gt k : 1 < σ_seq k := by simp only [σ_seq, lt_add_iff_pos_right, one_div]; positivity ++ have h_tendsto : Tendsto σ_seq atTop (𝓝[>] 1) := by ++ rw [tendsto_nhdsWithin_iff] ++ refine ⟨?_, by filter_upwards with k; exact hσ_gt k⟩ ++ have : Tendsto (fun k : ℕ ↦ 1 / ((k : ℝ) + 1)) atTop (𝓝 0) := by ++ simp only [one_div]; exact (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds).inv_tendsto_atTop ++ simpa [σ_seq] using tendsto_const_nhds.add this ++ have h_ptwise n : Tendsto (fun k ↦ rt (σ_seq k) n) atTop (𝓝 (rt 1 n)) := by ++ simp only [rt]; split_ifs with hn; · exact tendsto_const_nhds ++ refine ((tendsto_const_nhds.rpow (tendsto_nhdsWithin_iff.mp h_tendsto).1 (Or.inl ?_)).inv₀ ++ (by simp [hn])).const_mul (f n) |>.mul_const (w n) ++ exact (Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)).ne' ++ obtain ⟨C, hC⟩ := Asymptotics.isBigO_iff.mp (hT_bdd.comp_tendsto h_tendsto) ++ refine summable_of_sum_range_le (c := C) (rt_nn 1) fun m ↦ le_of_tendsto (tendsto_finsetSum _ ++ fun i _ ↦ h_ptwise i) ?_ ++ filter_upwards [h_tendsto.eventually self_mem_nhdsWithin, hC] with k hk hCk ++ calc ∑ i ∈ Finset.range m, rt (σ_seq k) i ++ ≤ ∑' n, rt (σ_seq k) n := (hSumm _ hk).sum_le_tsum _ fun n _ ↦ rt_nn _ n ++ _ ≤ |∑' n, rt (σ_seq k) n| := le_abs_self _ ++ _ ≤ C := by simpa using hCk ++ rw [show (fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x))) = ++ Complex.ofRealCLM ∘ (rt 1 ·) from ?_] ++ · exact hSumm_1.map Complex.ofRealCLM Complex.ofRealCLM.continuous ++ ext n; simp only [rt, Real.rpow_one, one_div, w, y, Function.comp_apply] ++ split_ifs with hn; · simp [hn] ++ have him0 : (𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x))).im = 0 := (hψpos _).2 ++ have hre_eq : 𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x)) = ++ Complex.ofReal ((𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x))).re) := by ++ rw [← Complex.re_add_im (𝓕 ψCS.toFun _), him0]; simp ++ conv_lhs => rw [show ψ = ψCS.toFun from rfl, hre_eq] ++ simp only [Complex.ofRealCLM_apply, Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_natCast] ++ ++lemma auto_cheby_short_interval_bound (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (B : ℝ) (ψ : ℝ → ℂ) (hψSmooth : ContDiff ℝ ∞ ψ) (hψCompact : HasCompactSupport ψ) ++ (hψpos : ∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) (hψ0 : 0 < (𝓕 ψ 0).re) ++ (hB_bound : ∀ x ≥ 1, ‖∑' n, f n / n * 𝓕 ψ (1 / (2 * Real.pi) * Real.log (n / x))‖ ≤ B) : ++ ∃ (ε : ℝ) (C : ℝ), ε > 0 ∧ ε < 1 ∧ C > 0 ∧ ∀ x ≥ 1, ++ ∑' n, (f n) * (Set.indicator (Set.Ioc ((1 - ε) * x) x) (fun _ ↦ 1) (n : ℝ)) ≤ C * x := by ++ have hF : Continuous (𝓕 ψ) := VectorFourier.fourierIntegral_continuous Real.continuous_fourierChar ++ (by continuity) (hψSmooth.continuous.integrable_of_hasCompactSupport hψCompact) ++ have hg : Continuous fun y ↦ (𝓕 ψ y).re := Complex.continuous_re.comp hF ++ obtain ⟨δ, hδpos, hball⟩ := Metric.mem_nhds_iff.1 <| ++ hg.continuousAt.preimage_mem_nhds (IsOpen.mem_nhds isOpen_Ioi (half_lt_self hψ0)) ++ let c := (𝓕 ψ 0).re / 2 ++ have hcpos : 0 < c := by dsimp only [c]; linarith ++ have h_psi_ge_c : ∀ y, |y| < δ → c ≤ (𝓕 ψ y).re := fun y hy ↦ (hball (mem_ball_zero_iff.mpr hy)).le ++ let ε := 1 - Real.exp (-2 * π * δ) ++ have hε : 0 < ε ∧ ε < 1 := by ++ have h1 : Real.exp (-2 * π * δ) < 1 := Real.exp_lt_one_iff.mpr (by nlinarith [Real.pi_pos]) ++ exact ⟨by simp only [ε]; linarith, by simp only [ε]; linarith [Real.exp_pos (-2 * π * δ)]⟩ ++ have hB_nonneg : 0 ≤ B := (norm_nonneg _).trans (hB_bound 1 le_rfl) ++ refine ⟨ε, B / c + 1, hε.1, hε.2, by positivity, fun x hx ↦ ?_⟩ ++ have h_summable : Summable fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x)) := ++ auto_cheby_fourier_summable hpos hf hG hG' ψ hψSmooth hψCompact hψpos x hx ++ have hx_pos : 0 < x := by linarith ++ have h_sum_lower : c / x * ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ) ++ ≤ ∑' n, f n / n * (𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re := by ++ rw [← tsum_mul_left] ++ refine Summable.tsum_le_tsum (fun n ↦ ?_) ?_ ?_ ++ · by_cases hn : (n : ℝ) ∈ Set.Ioc ((1 - ε) * x) x ++ · rw [Set.indicator_of_mem hn, Pi.one_apply, mul_one] ++ have hn_pos : 0 < (n : ℝ) := by nlinarith [hn.1, hε.2] ++ let y := (1 / (2 * π)) * Real.log (n / x) ++ have h_arg_small : |y| < δ := by ++ have h2pi : 0 < 2 * π := by linarith [Real.pi_pos] ++ simp only [y, abs_mul, abs_div, abs_one, abs_of_pos h2pi] ++ field_simp [ne_of_gt h2pi]; rw [mul_comm, abs_lt] ++ have h_log_lower : -2 * π * δ < Real.log (n / x) := by ++ rw [← Real.log_exp (-2 * π * δ), Real.log_lt_log_iff (Real.exp_pos _) (by positivity)] ++ have : Real.exp (-2 * π * δ) = 1 - ε := by simp only [ε]; ring ++ rw [this]; field_simp; exact hn.1 ++ have h_log_upper : Real.log (n / x) ≤ 0 := ++ Real.log_nonpos (by positivity) (div_le_one_of_le₀ hn.2 hx_pos.le) ++ constructor <;> nlinarith [Real.pi_pos] ++ have h1 : x⁻¹ ≤ (n : ℝ)⁻¹ := by rw [inv_le_inv₀ hx_pos hn_pos]; exact hn.2 ++ have h2 : c ≤ (𝓕 ψ y).re := h_psi_ge_c y h_arg_small ++ have hfn : 0 ≤ f n := hpos n ++ have hre : 0 ≤ (𝓕 ψ y).re := (hψpos y).1 ++ have hn_inv : 0 ≤ (n : ℝ)⁻¹ := inv_nonneg.mpr hn_pos.le ++ calc c / x * f n = c * x⁻¹ * f n := by rw [div_eq_mul_inv] ++ _ ≤ c * (n : ℝ)⁻¹ * f n := by gcongr ++ _ ≤ (𝓕 ψ y).re * (n : ℝ)⁻¹ * f n := by gcongr ++ _ = (n : ℝ)⁻¹ * (𝓕 ψ y).re * f n := by ring ++ _ = f n / n * (𝓕 ψ y).re := by ring ++ · rw [Set.indicator_of_notMem hn, mul_zero, mul_zero] ++ exact mul_nonneg (div_nonneg (hpos n) (Nat.cast_nonneg n)) (hψpos _).1 ++ · refine summable_of_hasFiniteSupport <| (Set.finite_le_nat ⌊x⌋₊).subset fun n hn ↦ ?_ ++ simp only [Function.mem_support, ne_eq, mul_eq_zero, not_or, Set.indicator_apply_ne_zero] at hn ++ exact Nat.le_floor hn.2.2.1.2 ++ · rw [← Complex.summable_ofReal]; convert h_summable using 1; ext n ++ rw [Complex.ofReal_mul, Complex.ofReal_div] ++ norm_cast ++ rw [Complex.ofReal_mul] ++ congr 1 ++ apply Complex.ext ++ · simp only [Complex.ofReal_re] ++ · simp only [Complex.ofReal_im]; exact (hψpos _).2.symm ++ have h_real_eq : ∑' n, f n / n * (𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re = ++ (∑' n, (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re := by ++ rw [Complex.re_tsum h_summable]; congr with n ++ rw [Complex.mul_re]; norm_cast; simp only [zero_mul, sub_zero] ++ calc ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ) ++ = x / c * (c / x * ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ)) := by ++ field_simp [ne_of_gt hcpos, ne_of_gt hx_pos] ++ _ ≤ x / c * B := by ++ gcongr; rw [h_real_eq] at h_sum_lower ++ exact h_sum_lower.trans ((Complex.re_le_norm _).trans (hB_bound x hx)) ++ _ = (B / c) * x := by field_simp [ne_of_gt hcpos] ++ _ ≤ (B / c + 1) * x := by nlinarith ++ ++lemma auto_cheby_bootstrap_induction (hpos : 0 ≤ f) ++ (h_short : ∃ (ε : ℝ) (C : ℝ), ε > 0 ∧ ε < 1 ∧ C > 0 ∧ ∀ x ≥ 1, ++ ∑' n, (f n) * (Set.indicator (Set.Ioc ((1 - ε) * x) x) (fun _ ↦ 1) (n : ℝ)) ≤ C * x) : ++ cheby f := by ++ obtain ⟨ε, C₀, hε, hε1, hC₀, h_bound⟩ := h_short ++ let C := C₀ / ε + f 0 + 1 ++ have hf0 : (0 : ℝ) ≤ f 0 := hpos 0 ++ have hdiv : 0 ≤ C₀ / ε := div_nonneg hC₀.le hε.le ++ have hC : 0 ≤ C := by linarith ++ refine ⟨C, fun n ↦ ?_⟩ ++ induction n using Nat.strong_induction_on with | h n ih => ++ rcases lt_or_ge n 2 with hn | hn ++ · interval_cases n ++ · simp [cumsum] ++ · simp only [cumsum, Finset.sum_range_one, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hf0, ++ Nat.cast_one, mul_one, C] ++ linarith ++ let x := (n : ℝ) - 1 ++ have hx : x ≥ 1 := by simp only [x, ge_iff_le, le_sub_iff_add_le]; norm_cast ++ let m := ⌊(1 - ε) * x⌋₊ + 1 ++ have hm_lt : m < n := by ++ simp only [m, x] ++ have h1 : (1 - ε) * (n - 1 : ℝ) < (n - 1 : ℕ) := by ++ calc (1 - ε) * (↑n - 1) < 1 * (↑n - 1) := by gcongr; linarith ++ _ = ↑n - 1 := by ring ++ _ = ↑(n - 1) := by simp [Nat.cast_sub (by omega : 1 ≤ n)] ++ have h2 : ⌊(1 - ε) * (n - 1 : ℝ)⌋₊ < n - 1 := ++ (Nat.floor_lt (mul_nonneg (by linarith) (by linarith : (0 : ℝ) ≤ n - 1))).mpr h1 ++ omega ++ have hm_gt : (m : ℝ) > (1 - ε) * x := by ++ simp only [m, Nat.cast_add, Nat.cast_one, gt_iff_lt] ++ exact Nat.lt_floor_add_one ((1 - ε) * x) ++ have h_decomp : cumsum (fun k ↦ ‖(f k : ℂ)‖) n = cumsum (fun k ↦ ‖(f k : ℂ)‖) m + ∑ k ∈ Finset.Ico m n, f k := by ++ simp only [cumsum, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hpos _), ++ Finset.sum_range_add_sum_Ico _ (by omega : m ≤ n)] ++ have h_Ico : ∑ k ∈ Finset.Ico m n, f k ≤ C₀ * x := by ++ calc ∑ k ∈ Finset.Ico m n, f k ++ = ∑ k ∈ Finset.Ico m n, f k * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (k : ℝ) := by ++ refine Finset.sum_congr rfl fun k hk ↦ ?_ ++ have ⟨hkm, hkn⟩ := Finset.mem_Ico.mp hk ++ have hk_gt : (k : ℝ) > (1 - ε) * x := by linarith [hm_gt, (Nat.cast_le (α := ℝ)).mpr hkm] ++ have hk_le : (k : ℝ) ≤ x := by ++ have h1 : k ≤ n - 1 := Nat.le_pred_of_lt hkn ++ have h2 : (k : ℝ) ≤ (n - 1 : ℕ) := by exact_mod_cast h1 ++ simp only [Nat.cast_sub (by omega : 1 ≤ n), Nat.cast_one, x] at h2 ⊢; exact h2 ++ simp only [Set.indicator_of_mem (Set.mem_Ioc.mpr ⟨hk_gt, hk_le⟩), Pi.one_apply, mul_one] ++ _ ≤ ∑' k, f k * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (k : ℝ) := by ++ refine Summable.sum_le_tsum _ (fun k _ ↦ mul_nonneg (hpos k) (Set.indicator_nonneg (by simp) _)) ?_ ++ refine summable_of_hasFiniteSupport <| (Set.finite_le_nat ⌊x⌋₊).subset fun k hk ↦ ?_ ++ simp only [Function.mem_support, ne_eq, mul_eq_zero, not_or, Set.indicator_apply_ne_zero] at hk ++ exact Nat.le_floor hk.2.1.2 ++ _ ≤ C₀ * x := h_bound x hx ++ have hm_le : (m : ℝ) ≤ (1 - ε) * x + 1 := by ++ have hpos' : 0 ≤ (1 - ε) * x := mul_nonneg (by linarith) (by linarith : (0 : ℝ) ≤ x) ++ simp only [m, Nat.cast_add, Nat.cast_one] ++ linarith [Nat.floor_le hpos'] ++ have hnorm : ∀ k, ‖(f k : ℂ)‖ = f k := fun k ↦ by simp [abs_of_nonneg (hpos k)] ++ simp only [hnorm] at h_decomp ih ⊢ ++ calc cumsum f n = cumsum f m + ∑ k ∈ Finset.Ico m n, f k := h_decomp ++ _ ≤ C * m + C₀ * x := by linarith [ih m hm_lt, h_Ico] ++ _ ≤ C * ((1 - ε) * x + 1) + C₀ * x := by nlinarith [hC] ++ _ = (C * (1 - ε) + C₀) * x + C := by ring ++ _ ≤ C * x + C := by ++ have : C₀ ≤ C * ε := by ++ calc C₀ = (C₀ / ε) * ε := by field_simp [ne_of_gt hε] ++ _ ≤ (C₀ / ε + f 0 + 1) * ε := by gcongr; linarith [hpos 0] ++ _ = C * ε := by simp only [C] ++ nlinarith [hε, hε1, hx] ++ _ ≤ C * n := by simp only [x]; ring_nf; linarith [hC] ++ ++lemma auto_cheby (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : cheby f := by ++ obtain ⟨ψ_fun, hψSmooth, hψCompact, hψpos, hψ0⟩ := auto_cheby_exists_smooth_nonneg_fourier_kernel ++ obtain ⟨B, hB⟩ := crude_upper_bound hpos hG hG' hf ⟨ψ_fun, hψSmooth.of_le ENat.LEInfty.out, hψCompact⟩ hψpos ++ exact auto_cheby_bootstrap_induction hpos <| auto_cheby_short_interval_bound hpos hf hG hG' B ψ_fun ++ hψSmooth hψCompact hψpos hψ0 fun x hx ↦ hB x (by linarith) ++ ++theorem WienerIkeharaTheorem'' (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := ++ WienerIkeharaTheorem' hpos hf (auto_cheby (f := f) (A := A) (G := G) hpos hf hG hG') hG hG' ++ ++end auto_cheby ++ ++theorem WeakPNT_character ++ {q a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) {s : ℂ} (hs : 1 < s.re) : ++ LSeries (fun n ↦ if n % q = a then Λ n else 0) s = ++ - (∑' χ : DirichletCharacter ℂ q, ++ ((starRingEnd ℂ) (χ a) * ((deriv (LSeries (fun n:ℕ ↦ χ n)) s)) / ++ (LSeries (fun n:ℕ ↦ χ n) s))) / (Nat.totient q : ℂ) := by ++ have : NeZero q := ⟨by omega⟩ ++ convert vonMangoldt.LSeries_residueClass_eq ((ZMod.isUnit_iff_coprime a q).mpr ha) hs using 1 ++ · congr with n ++ have : n % q = a ↔ (n : ZMod q) = a := by ++ rw [ZMod.natCast_eq_natCast_iff', Nat.mod_eq_of_lt ha'] ++ simp [this] ++ split_ifs <;> simp [*] ++ · rw [div_eq_inv_mul, neg_mul_comm, tsum_fintype] ++ congr 3 with χ ++ rw [DirichletCharacter.deriv_LFunction_eq_deriv_LSeries _ hs, ++ DirichletCharacter.LFunction_eq_LSeries _ hs, mul_div] ++ congr 2 ++ rw [starRingEnd_apply, MulChar.star_apply', MulChar.inv_apply_eq_inv', ++ ← ZMod.coe_unitOfCoprime a ha, ZMod.inv_coe_unit, map_units_inv] ++ ++theorem WeakPNT_AP_prelim {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) : ++ ∃ G: ℂ → ℂ, (ContinuousOn G {s | 1 ≤ s.re}) ∧ ++ (Set.EqOn G (fun s ↦ LSeries (fun n ↦ if n % q = a then Λ n else 0) s - 1 / ++ ((Nat.totient q) * (s - 1))) {s | 1 < s.re}) := by ++ have : NeZero q := NeZero.of_pos hq ++ have hG : ∃ G : ℂ → ℂ, ContinuousOn G {s | 1 ≤ s.re} ∧ Set.EqOn G ++ (fun s ↦ LSeries (fun n ↦ if (n : ZMod q) = a then Λ n else 0) s - (q.totient : ℂ)⁻¹ / (s - 1)) {s | 1 < s.re} := by ++ use vonMangoldt.LFunctionResidueClassAux (a : ZMod q), vonMangoldt.continuousOn_LFunctionResidueClassAux (q := q) (a := a) ++ have := vonMangoldt.eqOn_LFunctionResidueClassAux ((ZMod.isUnit_iff_coprime a q).mpr ha) ++ convert this using 6; split <;> simp_all ++ convert hG using 6 ++ · simp [ZMod.natCast_eq_natCast_iff', Nat.mod_eq_of_lt ha'] ++ · rw [inv_eq_one_div, div_div] ++ ++lemma summable_vonMangoldt_div_rpow {s : ℝ} (hs : 1 < s) : Summable (fun n ↦ Λ n / n ^ s) := by ++ have h_log_bound : ∀ n : ℕ, (Λ n : ℝ) ≤ Real.log n := fun n ↦ vonMangoldt_le_log ++ suffices h_log_sum : Summable fun n : ℕ ↦ Real.log n / (n : ℝ) ^ s by ++ exact .of_nonneg_of_le (fun n ↦ div_nonneg vonMangoldt_nonneg (by positivity)) ++ (fun n ↦ div_le_div_of_nonneg_right (h_log_bound n) (by positivity)) h_log_sum ++ have h_log_le_n_eps : ∀ ε > 0, ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n / (n : ℝ) ^ s ≤ C * (n : ℝ) ^ (ε - s) := by ++ intro ε hε_pos ++ obtain ⟨C, hC_pos, hC⟩ : ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n ≤ C * (n : ℝ) ^ ε := by ++ refine ⟨1 / ε, by positivity, fun n hn ↦ ?_⟩ ++ have := log_le_sub_one_of_pos (by positivity : 0 < (n : ℝ) ^ ε) ++ rw [log_rpow (by positivity)] at this ++ nlinarith [rpow_pos_of_pos (by positivity : 0 < (n : ℝ)) ε, mul_div_cancel₀ 1 hε_pos.ne'] ++ refine ⟨C, hC_pos, fun n hn ↦ ?_⟩ ++ rw [rpow_sub (by positivity)] ++ exact le_trans (div_le_div_of_nonneg_right (hC n hn) (by positivity)) (by rw [div_eq_mul_inv]; ring_nf; norm_num) ++ obtain ⟨C, _, hC⟩ : ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n / (n : ℝ) ^ s ≤ C * (n : ℝ) ^ ((s - 1) / 2 - s) := ++ h_log_le_n_eps ((s - 1) / 2) (by linarith) ++ rw [← summable_nat_add_iff 2] ++ exact Summable.of_nonneg_of_le (fun n ↦ div_nonneg (log_nonneg (by norm_cast; omega)) ++ (rpow_nonneg (by positivity) _)) (fun n ↦ hC _ (by omega)) (Summable.mul_left _ <| by ++ simpa using summable_nat_add_iff 2 |>.2 <| summable_nat_rpow.2 <| by linarith) ++ ++theorem WeakPNT_AP {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : a.Coprime q) (ha' : a < q) : ++ Tendsto (fun N ↦ cumsum (fun n ↦ if n % q = a then Λ n else 0) N / N) atTop (𝓝 (1 / q.totient)) := by ++ have h_summable : ∀ s : ℝ, 1 < s → Summable (fun n ↦ (if n % q = a then Λ n else 0) / n ^ s) := by ++ intro s hs ++ refine .of_nonneg_of_le (fun n ↦ ?_) (fun n ↦ ?_) (summable_vonMangoldt_div_rpow hs) ++ · split_ifs <;> positivity ++ · split_ifs <;> norm_num; exact div_nonneg vonMangoldt_nonneg (by positivity) ++ obtain ⟨G, hG₁, hG₂⟩ := WeakPNT_AP_prelim hq ha ha' ++ convert WienerIkeharaTheorem'' _ _ _ _ using 1 ++ · use G ++ · intro n ++ simp_all only [ge_iff_le, one_div, mul_inv_rev, Pi.ofNat_apply] ++ split ++ next h => subst h; simp_all only [vonMangoldt_nonneg] ++ next h => simp_all only [le_refl] ++ · intro σ' hσ' ++ specialize h_summable σ' hσ' ++ simp_all only [ge_iff_le, one_div, mul_inv_rev] ++ convert h_summable using 1 ++ ext ++ simp only [nterm, norm_real, norm_eq_abs] ++ ring_nf ++ split_ifs <;> simp [*, mul_comm] ++ · assumption ++ · convert hG₂ using 3 ++ · exact tsum_congr fun n ↦ by cases n <;> aesop ++ · norm_num [div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm] ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/ZetaBounds.lean b/PrimeNumberTheoremAnd/Erdos970/ZetaBounds.lean +new file mode 100644 +index 0000000..84113af +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/ZetaBounds.lean +@@ -0,0 +1,2982 @@ ++import Batteries.Tactic.Lemma ++import Mathlib.MeasureTheory.Function.Floor ++import Mathlib.MeasureTheory.Order.Group.Lattice ++import Mathlib.NumberTheory.Harmonic.Bounds ++import Mathlib.NumberTheory.LSeries.Nonvanishing ++import PrimeNumberTheoremAnd.Erdos970.Auxiliary ++import PrimeNumberTheoremAnd.Erdos970.Fourier ++import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic ++import PrimeNumberTheoremAnd.Erdos970.ResidueCalcOnRectangles ++import PrimeNumberTheoremAnd.Erdos970.EulerMaclaurin ++ ++namespace Erdos970 ++ ++ ++open _root_.Complex Topology Filter Interval _root_.Set Asymptotics ++ ++lemma div_cpow_eq_cpow_neg (a x s : ℂ) : a / x ^ s = a * x ^ (-s) := by ++ rw [div_eq_mul_inv, cpow_neg] ++ ++lemma one_div_cpow_eq_cpow_neg (x s : ℂ) : 1 / x ^ s = x ^ (-s) := by ++ convert div_cpow_eq_cpow_neg 1 x s using 1; simp ++ ++lemma div_rpow_eq_rpow_neg (a x s : ℝ) (hx : 0 ≤ x) : a / x ^ s = a * x ^ (-s) := by ++ rw [div_eq_mul_inv, Real.rpow_neg hx] ++ ++lemma div_rpow_neg_eq_rpow_div {x y s : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) : ++ x ^ (-s) / y ^ (-s) = (y / x) ^ s := by ++ rw [div_eq_mul_inv, Real.rpow_neg hx, Real.rpow_neg hy, Real.div_rpow hy hx]; field_simp ++ ++lemma div_rpow_eq_rpow_div_neg {x y s : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) : ++ x ^ s / y ^ s = (y / x) ^ (-s) := by ++ convert div_rpow_neg_eq_rpow_div (s := -s) hx hy using 1; simp only [neg_neg] ++ ++local notation (name := riemannzeta) "ζ" => riemannZeta ++local notation (name := derivriemannzeta) "ζ'" => deriv riemannZeta ++ ++theorem ResidueOfTendsTo {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} ++ (hU : U ∈ 𝓝 p) ++ (hf : HolomorphicOn f (U \ {p})) ++ {A : ℂ} ++ (h_limit : Tendsto (fun s ↦ (s - p) * f s) (𝓝[≠] p) (𝓝 A)) : ++ ∃ V ∈ 𝓝 p, ++ BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (V \ {p})) := by ++ ++ have h_event : ∀ᶠ s in 𝓝[≠] p, ‖(s - p) * f s - A‖ < 1 := by ++ simp_rw [← dist_eq_norm_sub] ++ exact h_limit.eventually (Metric.ball_mem_nhds _ (by norm_num)) ++ have h_event_nhds : ++ ∀ᶠ s in 𝓝 p, s ≠ p → ‖(s - p) * f s - A‖ < 1 := by ++ exact (eventually_nhdsWithin_iff).1 h_event ++ rcases (eventually_nhds_iff.1 h_event_nhds) with ⟨V₀, hV₀_mem, hV₀_prop⟩ ++ have h_bound : ++ ∀ s, s ∈ V₀ \ {p} → ‖(s - p) * f s‖ ≤ ‖A‖ + 1 := by ++ intro s hs ++ rcases hs with ⟨hV₀, hsne⟩ ++ calc ‖(s - p) * f s‖ = ‖((s - p) * f s - A) + A‖ := by ++ ring_nf ++ _ ≤ ‖(s - p) * f s - A‖ + ‖A‖ := norm_add_le ((s - p) * f s - A) A ++ _ ≤ 1 + ‖A‖ := add_le_add_left (le_of_lt (hV₀_mem s hV₀ hsne)) ‖A‖ ++ _ = ‖A‖ + 1 := add_comm 1 ‖A‖ ++ have h_bdd : ++ BddAbove (norm ∘ (fun s ↦ (s - p) * f s) '' (V₀ \ {p})) := by ++ refine ⟨‖A‖ + 1, ?_⟩ ++ rintro _ ⟨s, hs, rfl⟩ ++ exact h_bound s hs ++ ++ set W : Set ℂ := V₀ ∩ U with hW_def ++ have hW_mem : (W : Set ℂ) ∈ 𝓝 p := inter_mem (IsOpen.mem_nhds hV₀_prop.1 hV₀_prop.2) hU ++ have h_subset_V₀ : (W \ {p}) ⊆ (V₀ \ {p}) := by ++ intro z hz; exact ⟨hz.1.1, hz.2⟩ ++ have h_prod_holo : HolomorphicOn (fun z ↦ (z - p) * f z) (W \ {p}) := by ++ have h_id : HolomorphicOn (fun z : ℂ ↦ z - p) (W \ {p}) := ++ Differentiable.differentiableOn (Differentiable.sub_const differentiable_fun_id p) ++ have hfW : HolomorphicOn f (W \ {p}) := by ++ apply hf.mono ++ exact Set.sdiff_subset_sdiff_left inter_subset_right ++ simpa using! h_id.mul hfW ++ have h_bdd_W : BddAbove (norm ∘ (fun s ↦ (s - p) * f s) '' (W \ {p})) := ++ h_bdd.mono (image_mono h_subset_V₀) ++ ++ obtain ⟨g, hg_holo, hg_eq⟩ := ++ existsDifferentiableOn_of_bddAbove hW_mem h_prod_holo h_bdd_W ++ have h_event_eq : ++ (fun z ↦ g z) =ᶠ[𝓝[≠] p] fun z ↦ (z - p) * f z := by ++ have hW_diff_mem : (W \ {p} : Set ℂ) ∈ 𝓝[≠] p := ++ sdiff_mem_nhdsWithin_compl hW_mem {p} ++ exact (hg_eq.eventuallyEq_of_mem hW_diff_mem).symm ++ have h_tendsto_gA : Tendsto g (𝓝[≠] p) (𝓝 A) := ++ h_limit.congr' (id (EventuallyEq.symm h_event_eq)) ++ have hpW : p ∈ W := by ++ exact mem_of_mem_nhds hW_mem ++ have h_cont_g : ContinuousAt g p := by ++ apply (hg_holo.continuousOn.continuousWithinAt hpW).continuousAt hW_mem ++ have h_tendsto_gp : Tendsto g (𝓝[≠] p) (𝓝 (g p)) := ++ h_cont_g.tendsto.mono_left inf_le_left ++ have g_p_eq : g p = A := ++ tendsto_nhds_unique' (NormedField.nhdsNE_neBot p) h_tendsto_gp h_tendsto_gA ++ let q : ℂ → ℂ := fun z ↦ (g z - A) / (z - p) ++ have h_deriv : HasDerivAt g (deriv g p) p := by ++ exact DifferentiableOn.hasDerivAt hg_holo hW_mem ++ have h_q_limit : Tendsto q (𝓝[≠] p) (𝓝 (deriv g p)) := by ++ rw [hasDerivAt_iff_tendsto_slope] at h_deriv ++ unfold slope at h_deriv ++ simp only [vsub_eq_sub, smul_eq_mul, inv_mul_eq_div, g_p_eq] at h_deriv ++ exact h_deriv ++ have h_event_q : ∀ᶠ z in 𝓝[≠] p, ‖q z - deriv g p‖ < 1 := by ++ simp_rw [← dist_eq_norm_sub] ++ exact h_q_limit.eventually (Metric.ball_mem_nhds _ (by norm_num)) ++ have h_event_q_nhds : ∀ᶠ z in 𝓝 p, z ≠ p → ‖q z - deriv g p‖ < 1 := by ++ simpa using (eventually_nhdsWithin_iff).1 h_event_q ++ rcases (eventually_nhds_iff.1 h_event_q_nhds) with ++ ⟨V₁, hV₁_mem, hV₁_prop⟩ ++ have h_q_bound : ++ ∀ z, z ∈ V₁ \ {p} → ‖q z‖ ≤ ‖deriv g p‖ + 1 := by ++ intro z hz ++ rcases hz with ⟨hV₁, hz_ne⟩ ++ calc ‖q z‖ = ‖(q z - deriv g p) + (deriv g p)‖ := by ++ ring_nf ++ _ ≤ ‖q z - deriv g p‖ + ‖deriv g p‖ := norm_add_le (q z - deriv g p) (deriv g p) ++ _ ≤ 1 + ‖deriv g p‖ := add_le_add_left (le_of_lt (hV₁_mem z hV₁ hz_ne)) ‖deriv g p‖ ++ _ = ‖deriv g p‖ + 1 := add_comm 1 ‖deriv g p‖ ++ ++ have h_eq_diff : ++ EqOn (fun z ↦ f z - A * (z - p)⁻¹) q (W \ {p}) := by ++ intro z hz ++ simp only ++ have hz_ne : (z - p) ≠ 0 := sub_ne_zero.mpr hz.2 ++ have hgz : g z = (z - p) * f z := by ++ exact id (EqOn.symm hg_eq) hz ++ simp only [hgz, q] ++ field_simp ++ apply IsBigO_to_BddAbove ++ rw [isBigO_iff] ++ use ‖deriv g p‖ + 1 ++ apply eventually_nhdsWithin_iff.mpr ++ filter_upwards [IsOpen.mem_nhds hV₁_prop.1 hV₁_prop.2, hW_mem] with z hV₁ hW z_ne_p ++ specialize h_eq_diff ⟨ hW, z_ne_p⟩ ++ simp only [Pi.sub_apply, Pi.one_apply, one_mem, CStarRing.norm_of_mem_unitary, ++ mul_one] at h_eq_diff ⊢ ++ rw [h_eq_diff] ++ exact h_q_bound _ ⟨hV₁, z_ne_p⟩ ++ ++theorem analyticAt_riemannZeta {s : ℂ} (s_ne_one : s ≠ 1) : ++ AnalyticAt ℂ riemannZeta s := by ++ apply Complex.analyticAt_iff_eventually_differentiableAt.mpr ++ filter_upwards [eventually_ne_nhds s_ne_one] with z hz using differentiableAt_riemannZeta hz ++ ++theorem differentiableAt_deriv_riemannZeta {s : ℂ} (s_ne_one : s ≠ 1) : ++ DifferentiableAt ℂ ζ' s := by ++ exact (analyticAt_riemannZeta s_ne_one).deriv.differentiableAt ++ ++theorem riemannZetaResidue : ++ ∃ U ∈ 𝓝 1, BddAbove (norm ∘ (ζ - (fun s ↦ (s - 1)⁻¹)) '' (U \ {1})) := by ++ have zeta_holc : HolomorphicOn ζ (univ \ {1}) := by ++ intro y hy ++ exact DifferentiableAt.differentiableWithinAt <| differentiableAt_riemannZeta hy.2 ++ convert ResidueOfTendsTo univ_mem zeta_holc riemannZeta_residue_one using 6 ++ simp ++ ++theorem deriv_eqOn_of_eqOn_punctured (f g : ℂ → ℂ) (U : Set ℂ) (p : ℂ) ++ (hU_open : IsOpen U) ++ (h_eq : EqOn f g (U \ {p})) : ++ EqOn (deriv f) (deriv g) (U \ {p}) := by ++ intro x hx ++ apply EventuallyEq.deriv_eq ++ filter_upwards [IsOpen.mem_nhds (hU_open.sdiff isClosed_singleton) hx] with t ht using h_eq ht ++ ++theorem analytic_deriv_bounded_near_point ++ (f : ℂ → ℂ) {U : Set ℂ} {p : ℂ} (hU : IsOpen U) (hp : p ∈ U) (hf : HolomorphicOn f U) : ++ (deriv f) =O[𝓝[≠] p] (1 : ℂ → ℂ) := by ++ have U_in_filter : U ∈ 𝓝 p := by ++ exact IsOpen.mem_nhds hU hp ++ have T := (analyticOn_iff_differentiableOn hU).mpr hf ++ have T2 : ContDiffOn ℂ 1 f U := ++ DifferentiableOn.contDiffOn hf hU ++ have T3 : ContinuousOn (fun x ↦ ((deriv f) x)) U := by ++ apply T2.continuousOn_deriv_of_isOpen hU (by simp) ++ have T4 := T3.continuousAt U_in_filter ++ have T5 : (deriv f) =O[𝓝 p] (1 : ℂ → ℂ) := ++ T4.norm.isBoundedUnder_le.isBigO_one ℂ ++ exact Asymptotics.IsBigO.mono T5 inf_le_left ++ ++theorem derivative_const_plus_product {g : ℂ → ℂ} (A p x : ℂ) (hg : DifferentiableAt ℂ g x) : ++ deriv ((fun _ ↦ A) + g * fun s ↦ s - p) x = deriv g x * (x - p) + g x := by ++ rw [deriv_add (by fun_prop) (by fun_prop), deriv_const, deriv_mul hg (by fun_prop)] ++ simp ++ ++lemma deriv_inv_sub {x p : ℂ} (hp : x ≠ p) : ++ deriv (fun z => (z - p)⁻¹) x = -((x - p) ^ 2)⁻¹ := by ++ rw [deriv_fun_inv'' (by fun_prop) (by grind)] ++ simp ++ field ++ ++theorem deriv_f_minus_A_inv_sub_clean (f : ℂ → ℂ) (A x p : ℂ) ++ (hf : DifferentiableAt ℂ f x) (hp : x ≠ p) : ++ deriv (f - (fun z ↦ A * (z - p)⁻¹)) x = deriv f x + A * ((x - p) ^ 2)⁻¹ := by ++ have h1 : DifferentiableAt ℂ (fun z => (z - p)⁻¹) x := by ++ fun_prop (disch := grind) ++ rw [deriv_sub hf (h1.const_mul A), deriv_const_mul A h1, deriv_inv_sub hp] ++ ring ++ ++theorem nonZeroOfBddAbove {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} ++ (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} (A_ne_zero : A ≠ 0) ++ (f_near_p : BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (U \ {p}))) : ++ ∃ V ∈ 𝓝 p, IsOpen V ∧ ∀ s ∈ V \ {p}, f s ≠ 0 := by ++ ++ have h_decomp : ∀ s, f s = (f s - A * (s - p)⁻¹) + A * (s - p)⁻¹ := by ++ intro s ++ ring ++ ++ obtain ⟨M, hM⟩ := f_near_p ++ ++ have A_norm_pos : 0 < ‖A‖ := norm_pos_iff.mpr A_ne_zero ++ ++ let δ := ‖A‖ / (‖M‖ + 1) ++ have δ_pos : 0 < δ := by ++ refine div_pos A_norm_pos (add_pos_of_nonneg_of_pos (norm_nonneg M) one_pos) ++ ++ obtain ⟨V, hV_open, hV_mem, hV_sub⟩ : ∃ V, IsOpen V ∧ p ∈ V ∧ V ⊆ U ∩ Metric.ball p δ := by ++ ++ obtain ⟨W, hW_sub, hW_open, hW_mem⟩ := mem_nhds_iff.mp U_in_nhds ++ let V := W ∩ Metric.ball p δ ++ have VNp : V ∈ 𝓝 p := (𝓝 p).inter_mem (IsOpen.mem_nhds hW_open hW_mem) ++ (Metric.ball_mem_nhds p δ_pos) ++ exact ⟨V, IsOpen.inter hW_open Metric.isOpen_ball, mem_of_mem_nhds VNp, ++ inter_subset_inter_left _ hW_sub⟩ ++ use V, mem_nhds_iff.mpr ⟨V, subset_refl V, hV_open, hV_mem⟩, hV_open ++ ++ intro s hs ++ have hs_in_U : s ∈ U := hV_sub hs.1 |>.1 ++ have hs_near_p : dist s p < δ := hV_sub hs.1 |>.2 ++ have hs_ne_p : s ≠ p := hs.2 ++ ++ rw [h_decomp s] ++ ++ have bound_first : ‖f s - A * (s - p)⁻¹‖ ≤ M := by ++ apply hM ++ exact ⟨s, ⟨hs_in_U, hs_ne_p⟩, rfl⟩ ++ ++ have large_second : ‖M‖ + 1 < ‖A * (s - p)⁻¹‖ := by ++ rw [norm_mul, norm_inv, ← div_eq_mul_inv] ++ rw [lt_div_iff₀ (norm_pos_iff.mpr (sub_ne_zero.mpr hs_ne_p))] ++ rw [mul_comm, ← lt_div_iff₀ (add_pos_of_nonneg_of_pos (norm_nonneg M) one_pos)] ++ rw [dist_eq_norm_sub] at hs_near_p ++ exact hs_near_p ++ ++ by_contra h_zero ++ ++ rw [add_eq_zero_iff_eq_neg] at h_zero ++ rw [h_zero, norm_neg] at bound_first ++ ++ have : ‖M‖ + 1 < ‖M‖ := (lt_of_lt_of_le (lt_of_lt_of_le large_second bound_first) ++ (Real.le_norm_self M)) ++ norm_num at this ++ ++theorem logDerivResidue' {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} ++ (U_is_open : IsOpen U) ++ (non_zero : ∀ x ∈ U \ {p}, f x ≠ 0) ++ (holc : HolomorphicOn f (U \ {p})) ++ (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} (A_ne_zero : A ≠ 0) ++ (f_near_p : BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (U \ {p}))) : ++ (deriv f * f⁻¹ + (fun s ↦ (s - p)⁻¹)) =O[𝓝[≠] p] (1 : ℂ → ℂ) := by ++ ++ have simpleHolo : HolomorphicOn (fun s ↦ A / (s - p)) (U \ {p}) := by ++ apply DifferentiableOn.mono (t := {p}ᶜ) ++ · apply DifferentiableOn.div ++ · exact differentiableOn_const _ ++ · exact DifferentiableOn.sub differentiableOn_id (differentiableOn_const _) ++ · exact fun x hx => by rw [sub_ne_zero]; exact hx ++ · rintro s ⟨_, hs⟩ ; exact hs ++ ++ have f_minus_pole_is_holomorphic : HolomorphicOn (f - (fun s ↦ A * (s - p)⁻¹)) (U \ {p}) := by ++ exact (DifferentiableOn.sub_iff_right holc).mpr simpleHolo ++ ++ let ⟨g, ⟨g_is_holomorphic, g_is_f_minus_pole⟩⟩ := existsDifferentiableOn_of_bddAbove ++ U_in_nhds f_minus_pole_is_holomorphic f_near_p ++ ++ let h := (fun _ ↦ A) + g * (fun (s : ℂ) ↦ (s - p)) ++ ++ have linear_is_holomorphic : HolomorphicOn (fun (s : ℂ ) ↦ (s - p)) U := by ++ exact DifferentiableOn.sub_const differentiableOn_id p ++ ++ have h_is_holomorphic : HolomorphicOn h U := by ++ have T := DifferentiableOn.mul g_is_holomorphic linear_is_holomorphic ++ exact DifferentiableOn.const_add A T ++ ++ have h_continuous : ContinuousOn h U := ++ by exact DifferentiableOn.continuousOn h_is_holomorphic ++ ++ have deriv_h_identity : ∀x ∈ (U \ {p}), (deriv h) x = f x + (deriv f x) * (x - p) := by ++ intro x x_in_u_not_p ++ have x_in_u : x ∈ U := by exact Set.mem_of_mem_sdiff x_in_u_not_p ++ have x_not_p : x ≠ p := by ++ exact ((Set.mem_sdiff x).mp x_in_u_not_p).2 ++ ++ have weird : U ∈ 𝓝 x := by ++ exact IsOpen.mem_nhds (U_is_open) (x_in_u) ++ ++ rw [derivative_const_plus_product, ← g_is_f_minus_pole x_in_u_not_p, ++ ← deriv_eqOn_of_eqOn_punctured _ _ U p U_is_open g_is_f_minus_pole x_in_u_not_p, ++ deriv_f_minus_A_inv_sub_clean] ++ · simp only [Pi.sub_apply] ++ have := sub_ne_zero_of_ne x_not_p ++ field_simp ++ ring ++ · apply holc.differentiableAt ++ exact Filter.inter_mem weird <| compl_singleton_mem_nhds x_not_p ++ · exact x_not_p ++ · exact g_is_holomorphic.differentiableAt weird ++ have h_identity : ∀x ∈ (U \ {p}), h x = (f x) * (x - p) := by ++ intro x x_in_u_not_p ++ have hyp_x_not_p : x ≠ p := by ++ exact ((Set.mem_sdiff x).mp x_in_u_not_p).2 ++ simp only [h, Pi.add_apply, Pi.mul_apply] ++ rw [← g_is_f_minus_pole x_in_u_not_p] ++ simp only [Pi.sub_apply] ++ field [sub_ne_zero.mpr hyp_x_not_p] ++ have log_deriv_f_plus_pole_equal_log_deriv_h : ++ EqOn (deriv f * f⁻¹ + fun s ↦ (s - p)⁻¹) ((deriv h) * h⁻¹) (U \ {p}) := by ++ simp only [Set.mem_sdiff, mem_singleton_iff, ne_eq, and_imp, Function.comp_apply, Pi.sub_apply, ++ DifferentiableOn.sub_iff_right, differentiableOn_const, DifferentiableOn.fun_sub_iff_left, ++ holc] at * ++ intro x hyp_x ++ have x_not_p : x ≠ p := by ++ exact ((Set.mem_sdiff x).mp hyp_x).2 ++ have x_in_u : x ∈ U := by exact Set.mem_of_mem_sdiff hyp_x ++ simp only [Pi.add_apply, Pi.mul_apply, Pi.inv_apply] ++ rw [deriv_h_identity _ x_in_u x_not_p, h_identity _ x_in_u x_not_p] ++ ++ field [sub_ne_zero.mpr x_not_p, non_zero x (x_in_u) x_not_p] ++ have h_inv_bounded : ++ h⁻¹ =O[𝓝[≠] p] (1 : ℂ → ℂ) := by ++ have : ContinuousAt h⁻¹ p := by ++ apply ContinuousOn.continuousAt h_continuous U_in_nhds |>.inv₀ ++ simp [h, A_ne_zero] ++ exact Asymptotics.IsBigO.mono (this.norm.isBoundedUnder_le.isBigO_one ℂ) inf_le_left ++ ++ have h_deriv_bounded : ++ (deriv h) =O[𝓝[≠] p] (1 : ℂ → ℂ) := ++ analytic_deriv_bounded_near_point h U_is_open ++ (by exact mem_of_mem_nhds U_in_nhds) h_is_holomorphic ++ ++ have h_log_deriv_bounded : ++ ((deriv h) * h⁻¹) =O[𝓝[≠] p] (1 : ℂ → ℂ) := by ++ have T := Asymptotics.IsBigO.mul h_deriv_bounded h_inv_bounded ++ exact IsBigO.of_const_mul_right T ++ ++ have u_not_p_in_filter : U \ {p} ∈ 𝓝[≠] p := by ++ exact sdiff_mem_nhdsWithin_compl U_in_nhds {p} ++ have T := Set.EqOn.eventuallyEq_of_mem log_deriv_f_plus_pole_equal_log_deriv_h u_not_p_in_filter ++ exact EventuallyEq.trans_isBigO T h_log_deriv_bounded ++ ++theorem logDerivResidue {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} ++ (non_zero : ∀ x ∈ U \ {p}, f x ≠ 0) ++ (holc : HolomorphicOn f (U \ {p})) ++ (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} (A_ne_zero : A ≠ 0) ++ (f_near_p : BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (U \ {p}))) : ++ (deriv f * f⁻¹ + (fun s ↦ (s - p)⁻¹)) =O[𝓝[≠] p] (1 : ℂ → ℂ) := ++ by ++ let ⟨U', ⟨a,b,c⟩⟩ := mem_nhds_iff.mp U_in_nhds ++ have W : (U' \ {p}) ⊆ U' := by ++ exact Set.sdiff_subset ++ ++ have T : (U' \ {p}) ⊆ (U \ {p}) := by ++ exact Set.sdiff_subset_sdiff a (subset_refl _) ++ ++ refine logDerivResidue' b ?_ ?_ (IsOpen.mem_nhds b c) A_ne_zero ?_ ++ · intro x hyp_x ++ exact non_zero x <| T hyp_x ++ · exact DifferentiableOn.mono holc T ++ · exact (f_near_p.mono (image_mono (Set.sdiff_subset_sdiff a (subset_refl _)))) ++ ++lemma BddAbove_to_IsBigO {f : ℂ → ℂ} {p : ℂ} ++ {U : Set ℂ} (hU : U ∈ 𝓝 p) (bdd : BddAbove (norm ∘ f '' (U \ {p}))) : ++ f =O[𝓝[≠] p] (1 : ℂ → ℂ) := by ++ dsimp [BddAbove, upperBounds] at bdd ++ rcases bdd with ⟨C, hC⟩ ++ ++ have h : ∀ x ∈ U \ {p}, ‖f x‖ ≤ C := by ++ intro x hx ++ have fx_is_norm : ‖f x‖ ∈ norm ∘ f ''(U \ {p}) := by ++ exact ⟨x, hx, rfl⟩ ++ exact hC fx_is_norm ++ ++ rw [Asymptotics.isBigO_iff] ++ use C ++ rw [eventually_nhdsWithin_iff] ++ simp only [Set.mem_sdiff, mem_singleton_iff, and_imp, mem_compl_iff, Pi.one_apply, one_mem, ++ CStarRing.norm_of_mem_unitary, mul_one] at h ⊢ ++ filter_upwards [hU] using h ++ ++theorem logDerivResidue'' {f : ℂ → ℂ} {p : ℂ} {U : Set ℂ} ++ (non_zero : ∀ x ∈ U \ {p}, f x ≠ 0) ++ (holc : HolomorphicOn f (U \ {p})) ++ (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} (A_ne_zero : A ≠ 0) ++ (f_near_p : BddAbove (norm ∘ (f - fun s ↦ A * (s - p)⁻¹) '' (U \ {p}))) : ++ ∃ V ∈ 𝓝 p, BddAbove (norm ∘ (deriv f * f⁻¹ + (fun s ↦ (s - p)⁻¹)) '' (V \ {p})) := by ++ apply IsBigO_to_BddAbove ++ exact logDerivResidue non_zero holc U_in_nhds A_ne_zero f_near_p ++ ++theorem ResidueMult {f g : ℂ → ℂ} {p : ℂ} {U : Set ℂ} ++ (g_holc : HolomorphicOn g U) (U_in_nhds : U ∈ 𝓝 p) {A : ℂ} ++ (f_near_p : (f - (fun s ↦ A * (s - p)⁻¹)) =O[𝓝[≠] p] (1 : ℂ → ℂ)) : ++ (f * g - (fun s ↦ A * g p * (s - p)⁻¹)) =O[𝓝[≠] p] (1 : ℂ → ℂ) := by ++ ++ have : (f * g - fun s ↦ A * g p * (s - p)⁻¹) ++ = (f - A • fun s ↦ (s - p)⁻¹) * g + fun s ↦ (A * (g s - g p) / (s - p)) := by ++ ext; simp; ring ++ ++ rw[this] ++ have p_in_U : p ∈ U := mem_of_mem_nhds U_in_nhds ++ refine Asymptotics.IsBigO.add ?_ ?_ ++ · rw[← mul_one (1 : ℂ → ℂ)] ++ refine Asymptotics.IsBigO.mul f_near_p ?_ ++ ++ have g_cont : ContinuousAt g p := by ++ ++ exact (g_holc.continuousOn.continuousWithinAt p_in_U).continuousAt U_in_nhds ++ ++ have := g_cont.norm.isBoundedUnder_le.isBigO_one ℂ ++ exact IsBigO.mono this inf_le_left ++ · ++ ++ suffices (fun s ↦ A * ((s - p)⁻¹ * (g s - g p))) =O[𝓝[≠] p] 1 by ++ convert! this using 2 ++ rw[div_eq_mul_inv] ++ ring ++ apply Asymptotics.IsBigO.const_mul_left ++ ++ have g_diff : HasDerivAt g (deriv g p) p := ++ (DifferentiableOn.differentiableAt g_holc U_in_nhds).hasDerivAt ++ ++ rw [hasDerivAt_iff_isLittleO] at g_diff ++ apply Asymptotics.IsLittleO.isBigO at g_diff ++ have : (fun x' ↦ deriv g p * (x' - p)) =O[𝓝 p] fun x' ↦ x' - p := by ++ apply Asymptotics.IsBigO.const_mul_left ++ exact Asymptotics.isBigO_refl (fun x ↦ x - p) (𝓝 p) ++ have h1 := g_diff.add this ++ have h2 : (fun x ↦ g x - g p) =O[𝓝 p] fun x' ↦ x' - p := by ++ convert! h1 using 2 ++ simp ++ ring ++ refine (Asymptotics.isBigO_mul_iff_isBigO_div ?_).mpr ?_ ++ · filter_upwards [self_mem_nhdsWithin] with x hx ++ simp only [mem_compl_iff, mem_singleton_iff] at hx ++ exact inv_ne_zero (sub_ne_zero.mpr hx) ++ · simp only [div_inv_eq_mul] ++ refine Asymptotics.IsBigO.mono ?_ inf_le_left ++ simpa ++ ++theorem riemannZetaLogDerivResidue : ++ ∃ U ∈ 𝓝 1, BddAbove (norm ∘ (-(ζ' / ζ) - (fun s ↦ (s - 1)⁻¹)) '' (U \ {1})) := by ++ obtain ⟨U,U_in_nhds, hU⟩ := riemannZetaResidue ++ have hU' : BddAbove (norm ∘ (ζ - fun s ↦ 1 * (s - 1)⁻¹) '' (U \ {1})) := by ++ simp only [Function.comp_apply, Pi.sub_apply, one_mul] at hU ⊢ ++ exact hU ++ obtain ⟨V,V_in_nhds, V_is_open, hV⟩ := nonZeroOfBddAbove U_in_nhds one_ne_zero hU' ++ let W := V ∩ interior U ++ have hW : ∀ s ∈ W \ {1}, ζ s ≠ 0 := by ++ intro s hs ++ have s_in_V_diff : s ∈ V \ {1} := ⟨hs.1.1, hs.2⟩ ++ exact hV s s_in_V_diff ++ have ζ_holc: HolomorphicOn ζ (W \ {1}) := by ++ intro y hy ++ simp only [Set.mem_sdiff, mem_singleton_iff] at hy ++ refine DifferentiableAt.differentiableWithinAt ?_ ++ apply differentiableAt_riemannZeta hy.2 ++ have W_in_nhds : W ∈ 𝓝 1 := by ++ refine inter_mem V_in_nhds ?_ ++ exact interior_mem_nhds.mpr U_in_nhds ++ have := logDerivResidue'' hW ζ_holc W_in_nhds one_ne_zero ++ have HW : BddAbove (norm ∘ (ζ - fun s ↦ (s - 1)⁻¹) '' (W \ {1})) := by ++ obtain ⟨c, hc⟩ := bddAbove_def.mp hU ++ apply bddAbove_def.mpr ++ use c ++ rintro y ⟨x, x_in_W, fxy⟩ ++ apply hc ++ exact ⟨x, ⟨interior_subset x_in_W.1.2, x_in_W.2⟩, fxy⟩ ++ simp only [one_mul] at this ++ have aux: ∀ a, ‖-(deriv ζ a / ζ a) - (a - 1)⁻¹‖ = ‖(deriv ζ a / ζ a) + (a - 1)⁻¹‖ := by ++ intro a ++ calc ‖-(deriv ζ a / ζ a) - (a - 1)⁻¹‖ ++ = ‖-((deriv ζ a / ζ a) + (a - 1)⁻¹)‖ := by ring_nf ++ _ = ‖(deriv ζ a / ζ a) + (a - 1)⁻¹‖ := by rw [norm_neg] ++ simp only [Function.comp_apply, Pi.sub_apply] at hU ++ simp only [Function.comp_apply, Pi.sub_apply, Pi.neg_apply, Pi.div_apply, aux] ++ apply this HW ++ ++theorem riemannZetaLogDerivResidueBigO : ++ (-ζ' / ζ - fun z ↦ (z - 1)⁻¹) =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by ++ obtain ⟨U, hU, bdd⟩ := riemannZetaLogDerivResidue ++ convert BddAbove_to_IsBigO hU bdd using 2 ++ rw [neg_div] ++ ++noncomputable def riemannZeta0 (N : ℕ) (s : ℂ) : ℂ := ++ (∑ n ∈ Finset.range (N + 1), 1 / (n : ℂ) ^ s) + ++ (- N ^ (1 - s)) / (1 - s) + (- N ^ (-s)) / 2 ++ + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (s + 1) ++ ++local notation (name := riemannzeta0) "ζ₀" => riemannZeta0 ++ ++lemma riemannZeta0_apply (N : ℕ) (s : ℂ) : ζ₀ N s = ++ (∑ n ∈ Finset.range (N + 1), 1 / (n : ℂ) ^ s) + ++ ((- N ^ (1 - s)) / (1 - s) + (- N ^ (-s)) / 2 ++ + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1))) := by ++ simp_rw [riemannZeta0, div_cpow_eq_cpow_neg]; ring ++ ++lemma Real.differentiableAt_cpow_const_of_ne (s : ℂ) {x : ℝ} (xpos : 0 < x) : ++ DifferentiableAt ℝ (fun (x : ℝ) ↦ (x : ℂ) ^ s) x := by ++ apply DifferentiableAt.comp_ofReal (e := fun z ↦ z ^ s) ++ apply DifferentiableAt.cpow (by simp) (by simp) (by simp [xpos]) ++ ++lemma Complex.one_div_cpow_eq {s : ℂ} {x : ℝ} (x_ne : x ≠ 0) : ++ 1 / (x : ℂ) ^ s = (x : ℂ) ^ (-s) := by ++ refine (eq_one_div_of_mul_eq_one_left ?_).symm ++ rw [← cpow_add _ _ <| mod_cast x_ne, neg_add_cancel, cpow_zero] ++ ++lemma sum_eq_int_deriv {φ : ℝ → ℂ} {a b : ℝ} (apos : 0 ≤ a) (a_lt_b : a < b) ++ (φDiff : ∀ x ∈ [[a, b]], HasDerivAt φ (deriv φ x) x) ++ (derivφCont : ContinuousOn (deriv φ) [[a, b]]) : ++ ∑ n ∈ Finset.Ioc ⌊a⌋₊ ⌊b⌋₊, φ n = ++ (∫ x in a..b, φ x) + (⌊b⌋₊ + 1 / 2 - b) * φ b - (⌊a⌋₊ + 1 / 2 - a) * φ a ++ - ∫ x in a..b, (⌊x⌋ + 1 / 2 - x) * deriv φ x := by ++ rw [uIcc_of_le a_lt_b.le] at φDiff ++ convert sum_eq_integral_add_integral_deriv apos a_lt_b.le (fun t ht ↦ (φDiff t ht).differentiableAt) derivφCont using 1 ++ unfold B1 ++ push_cast ++ suffices ∫ (x : ℝ) in a..b, (↑⌊x⌋ + 1 / 2 - ↑x) * deriv φ x = -∫ (t : ℝ) in a..b, deriv φ t * (↑t - ↑⌊t⌋₊ - 1 / 2) by ++ rw [this] ++ ring_nf! ++ rw [← intervalIntegral.integral_neg] ++ refine intervalIntegral.integral_congr fun x hx ↦ ?_ ++ rw [uIcc_of_le a_lt_b.le, mem_Icc] at hx ++ rw [← Int.natCast_floor_eq_floor (by linarith)] ++ norm_cast ++ push_cast ++ ring ++ ++lemma xpos_of_uIcc {a b : ℕ} (ha : a ∈ Ioo 0 b) {x : ℝ} (x_in : x ∈ [[(a : ℝ), b]]) : ++ 0 < x := by ++ rw [uIcc_of_le (by exact_mod_cast ha.2.le), mem_Icc] at x_in ++ linarith [(by exact_mod_cast ha.1 : (0 : ℝ) < a)] ++ ++lemma ZetaSum_aux1₁ {a b : ℕ} {s : ℂ} (s_ne_one : s ≠ 1) (ha : a ∈ Ioo 0 b) : ++ (∫ (x : ℝ) in a..b, 1 / (x : ℂ) ^ s) = ++ (b ^ (1 - s) - a ^ (1 - s)) / (1 - s) := by ++ convert integral_cpow (a := a) (b := b) (r := -s) ?_ using 1 ++ · refine intervalIntegral.integral_congr fun x hx ↦ _root_.Erdos970.Complex.one_div_cpow_eq ?_ ++ exact (xpos_of_uIcc ha hx).ne' ++ · norm_cast; ring_nf ++ · right; refine ⟨(by grind), ?_⟩ ++ exact fun hx ↦ (lt_self_iff_false 0).mp <| xpos_of_uIcc ha hx ++ ++lemma ZetaSum_aux1φDiff {s : ℂ} {x : ℝ} (xpos : 0 < x) : ++ HasDerivAt (fun (t : ℝ) ↦ 1 / (t : ℂ) ^ s) (deriv (fun (t : ℝ) ↦ 1 / (t : ℂ) ^ s) x) x := by ++ exact hasDerivAt_deriv_iff.mpr <| ++ DifferentiableAt.div (differentiableAt_const _) ++ (Real.differentiableAt_cpow_const_of_ne s xpos) (by simp [cpow_eq_zero_iff, xpos.ne']) ++ ++lemma ZetaSum_aux1φderiv {s : ℂ} (s_ne_zero : s ≠ 0) {x : ℝ} (xpos : 0 < x) : ++ deriv (fun (t : ℝ) ↦ 1 / (t : ℂ) ^ s) x = (fun (x : ℝ) ↦ -s * (x : ℂ) ^ (-(s + 1))) x := by ++ let r := -s - 1 ++ have r_add1_ne_zero : r + 1 ≠ 0 := fun hr ↦ by simp [neg_ne_zero.mpr s_ne_zero, r] at hr ++ have r_ne_neg1 : r ≠ -1 := fun hr ↦ (hr ▸ r_add1_ne_zero) <| by norm_num ++ have hasDeriv := hasDerivAt_ofReal_cpow_const' xpos.ne' r_ne_neg1 ++ have := hasDeriv.deriv ▸ deriv_const_mul (-s) (hasDeriv).differentiableAt ++ convert! this using 2 ++ · ext y ++ by_cases y_zero : (y : ℂ) = 0 ++ · simp only [y_zero, ne_eq, s_ne_zero, not_false_eq_true, zero_cpow, div_zero, ++ r_add1_ne_zero, zero_div, mul_zero] ++ · have : (y : ℂ) ^ s ≠ 0 := fun hy ↦ y_zero ((cpow_eq_zero_iff _ _).mp hy).1 ++ simp only [one_div, sub_add_cancel, cpow_neg, neg_mul, r] ++ field_simp ++ · simp only [r] ++ ring_nf ++ ++lemma ZetaSum_aux1derivφCont {s : ℂ} (s_ne_zero : s ≠ 0) {a b : ℕ} (ha : a ∈ Ioo 0 b) : ++ ContinuousOn (deriv (fun (t : ℝ) ↦ 1 / (t : ℂ) ^ s)) [[a, b]] := by ++ have : EqOn _ (fun (t : ℝ) ↦ -s * (t : ℂ) ^ (-(s + 1))) [[a, b]] := ++ fun x hx ↦ ZetaSum_aux1φderiv s_ne_zero <| xpos_of_uIcc ha hx ++ refine continuous_ofReal.continuousOn.cpow_const ?_ |>.const_smul (c := -s) |>.congr this ++ exact fun x hx ↦ ofReal_mem_slitPlane.mpr <| xpos_of_uIcc ha hx ++ ++ ++lemma ZetaSum_aux1 {a b : ℕ} {s : ℂ} (s_ne_one : s ≠ 1) (s_ne_zero : s ≠ 0) (ha : a ∈ Ioo 0 b) : ++ ∑ n ∈ Finset.Ioc a b, 1 / (n : ℂ) ^ s = ++ (b ^ (1 - s) - a ^ (1 - s)) / (1 - s) + 1 / 2 * (1 / b ^ (s)) - 1 / 2 * (1 / a ^ s) ++ + s * ∫ x in a..b, (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1)) := by ++ let φ := fun (x : ℝ) ↦ 1 / (x : ℂ) ^ s ++ let φ' := fun (x : ℝ) ↦ -s * (x : ℂ) ^ (-(s + 1)) ++ have xpos : ∀ x ∈ [[(a : ℝ), b]], 0 < x := fun x hx ↦ xpos_of_uIcc ha hx ++ have φDiff : ∀ x ∈ [[(a : ℝ), b]], HasDerivAt φ (deriv φ x) x := ++ fun x hx ↦ ZetaSum_aux1φDiff (xpos x hx) ++ have φderiv : ∀ x ∈ [[(a : ℝ), b]], deriv φ x = φ' x := by ++ exact fun x hx ↦ ZetaSum_aux1φderiv s_ne_zero (xpos x hx) ++ have derivφCont : ContinuousOn (deriv φ) [[a, b]] := ZetaSum_aux1derivφCont s_ne_zero ha ++ convert sum_eq_int_deriv (by linarith) (by exact_mod_cast ha.2) φDiff derivφCont using 1 ++ · congr <;> simp only [Nat.floor_natCast] ++ · rw [Nat.floor_natCast, Nat.floor_natCast, ← intervalIntegral.integral_const_mul] ++ simp_rw [mul_div, ← mul_div, φ, ZetaSum_aux1₁ s_ne_one ha] ++ conv => rhs; rw [sub_eq_add_neg] ++ congr; any_goals norm_cast; simp only [one_div, add_sub_cancel_left] ++ rw [← intervalIntegral.integral_neg, intervalIntegral.integral_congr] ++ simp only [φ, one_div] at φderiv ++ intro x hx; simp_rw [φderiv x hx, φ']; ring_nf ++ ++lemma ZetaSum_aux1_1' {a b x : ℝ} (apos : 0 < a) (hx : x ∈ Icc a b) : 0 < x := ++ lt_of_lt_of_le apos hx.1 ++ ++lemma ZetaSum_aux1_1 {a b x : ℝ} (apos : 0 < a) (a_lt_b : a < b) (hx : x ∈ [[a, b]]) : 0 < x := ++ lt_of_lt_of_le apos (uIcc_of_le a_lt_b.le ▸ hx).1 ++ ++lemma ZetaSum_aux1_2 {a b : ℝ} {c : ℝ} (apos : 0 < a) (a_lt_b : a < b) ++ (h : c ≠ 0 ∧ 0 ∉ [[a, b]]) : ++ ∫ (x : ℝ) in a..b, 1 / x ^ (c+1) = (a ^ (-c) - b ^ (-c)) / c := by ++ rw [(by ring : (a ^ (-c) - b ^ (-c)) / c = (b ^ (-c) - a ^ (-c)) / (-c))] ++ have := integral_rpow (a := a) (b := b) (r := -c-1) (Or.inr ⟨by simp [h.1], h.2⟩) ++ simp only [sub_add_cancel] at this ++ rw [← this] ++ apply intervalIntegral.integral_congr ++ intro x hx ++ have : 0 ≤ x := (ZetaSum_aux1_1 apos a_lt_b hx).le ++ simp [div_rpow_eq_rpow_neg _ _ _ this, sub_eq_add_neg, add_comm] ++ ++lemma ZetaSum_aux1_3 (x : ℝ) : ‖(⌊x⌋ + 1/2 - x)‖ ≤ 1/2 := ++ abs_le.mpr ⟨(by linarith [Int.lt_floor_add_one x]), (by linarith [Int.floor_le x])⟩ ++ ++lemma ZetaSum_aux1_4' (x : ℝ) (hx : 0 < x) (s : ℂ) : ++ ‖(⌊x⌋ + 1 / 2 - (x : ℝ)) / (x : ℂ) ^ (s + 1)‖ = ++ ‖⌊x⌋ + 1 / 2 - x‖ / x ^ ((s + 1).re) := by ++ simp_rw [norm_div, Complex.norm_cpow_eq_rpow_re_of_pos hx, ← norm_real] ++ simp ++ ++lemma ZetaSum_aux1_4 {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} : ++ ∫ (x : ℝ) in a..b, ‖(↑⌊x⌋ + (1 : ℝ) / 2 - ↑x) / (x : ℂ) ^ (s + 1)‖ = ++ ∫ (x : ℝ) in a..b, |⌊x⌋ + 1 / 2 - x| / x ^ (s + 1).re := by ++ apply intervalIntegral.integral_congr ++ exact fun x hx ↦ ZetaSum_aux1_4' x (ZetaSum_aux1_1 apos a_lt_b hx) s ++ ++lemma ZetaSum_aux1_5a {a b : ℝ} (apos : 0 < a) {s : ℂ} (x : ℝ) ++ (h : x ∈ Icc a b) : |↑⌊x⌋ + 1 / 2 - x| / x ^ (s.re + 1) ≤ 1 / x ^ (s.re + 1) := by ++ apply div_le_div_of_nonneg_right _ _ ++ · exact le_trans (ZetaSum_aux1_3 x) (by norm_num) ++ · apply Real.rpow_nonneg <| le_of_lt (ZetaSum_aux1_1' apos h) ++ ++lemma ZetaSum_aux1_5b {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} (σpos : 0 < s.re) : ++ IntervalIntegrable (fun u ↦ 1 / u ^ (s.re + 1)) MeasureTheory.volume a b := by ++ refine continuousOn_const.div ?_ ?_ |>.intervalIntegrable_of_Icc (le_of_lt a_lt_b) ++ · exact continuousOn_id.rpow_const fun x hx ↦ Or.inl (ne_of_gt <| ZetaSum_aux1_1' apos hx) ++ · exact fun x hx h ↦ by rw [Real.rpow_eq_zero] at h <;> linarith [ZetaSum_aux1_1' apos hx] ++ ++open MeasureTheory in ++lemma measurable_floor_add_half_sub : Measurable fun (u : ℝ) ↦ ↑⌊u⌋ + 1 / 2 - u := by ++ refine Measurable.add ?_ measurable_const |>.sub measurable_id ++ exact Measurable.comp (by exact fun _ _ ↦ trivial) Int.measurable_floor ++ ++open MeasureTheory in ++lemma ZetaSum_aux1_5c {a b : ℝ} {s : ℂ} : ++ let g : ℝ → ℝ := fun u ↦ |↑⌊u⌋ + 1 / 2 - u| / u ^ (s.re + 1); ++ AEStronglyMeasurable g ++ (Measure.restrict volume (Ι a b)) := by ++ intro ++ refine (Measurable.div ?_ <| measurable_id.pow_const _).aestronglyMeasurable ++ exact _root_.continuous_abs.measurable.comp measurable_floor_add_half_sub ++ ++lemma ZetaSum_aux1_5d {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} (σpos : 0 < s.re) : ++ IntervalIntegrable (fun u ↦ |↑⌊u⌋ + 1 / 2 - u| / u ^ (s.re + 1)) MeasureTheory.volume a b := by ++ set g : ℝ → ℝ := (fun u ↦ |↑⌊u⌋ + 1 / 2 - u| / u ^ (s.re + 1)) ++ apply ZetaSum_aux1_5b apos a_lt_b σpos |>.mono_fun ZetaSum_aux1_5c ?_ ++ filter_upwards with x ++ simp only [Real.norm_eq_abs, one_div, norm_inv, abs_div, _root_.abs_abs] ++ conv => rw [div_eq_mul_inv, ← one_div]; rhs; rw [← one_mul |x ^ (s.re + 1)|⁻¹] ++ refine mul_le_mul ?_ (le_refl _) (by simp) <| by norm_num ++ exact le_trans (ZetaSum_aux1_3 x) <| by norm_num ++ ++lemma ZetaSum_aux1_5 {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} (σpos : 0 < s.re) : ++ ∫ (x : ℝ) in a..b, |⌊x⌋ + 1 / 2 - x| / x ^ (s.re + 1) ≤ ++ ∫ (x : ℝ) in a..b, 1 / x ^ (s.re + 1) := by ++ apply intervalIntegral.integral_mono_on (le_of_lt a_lt_b) ?_ ?_ ++ · exact ZetaSum_aux1_5a apos ++ · exact ZetaSum_aux1_5d apos a_lt_b σpos ++ · exact ZetaSum_aux1_5b apos a_lt_b σpos ++ ++lemma ZetaBnd_aux1a {a b : ℝ} (apos : 0 < a) (a_lt_b : a < b) {s : ℂ} (σpos : 0 < s.re) : ++ ∫ x in a..b, ‖(⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (s + 1)‖ ≤ ++ (a ^ (-s.re) - b ^ (-s.re)) / s.re := by ++ calc ++ _ = ∫ x in a..b, |(⌊x⌋ + 1 / 2 - x)| / x ^ (s+1).re := ZetaSum_aux1_4 apos a_lt_b ++ _ ≤ ∫ x in a..b, 1 / x ^ (s.re + 1) := ZetaSum_aux1_5 apos a_lt_b σpos ++ _ = (a ^ (-s.re) - b ^ (-s.re)) / s.re := ?_ ++ refine ZetaSum_aux1_2 (c := s.re) apos a_lt_b ⟨ne_of_gt σpos, ?_⟩ ++ exact fun h ↦ (lt_self_iff_false 0).mp <| ZetaSum_aux1_1 apos a_lt_b h ++ ++lemma Finset.Ioc_eq_Ico (M N : ℕ) : Finset.Ioc N M = Finset.Ico (N + 1) (M + 1) := by ++ ext a; simp only [Finset.mem_Ioc, Finset.mem_Ico]; constructor <;> intro ⟨h₁, h₂⟩ <;> omega ++ ++lemma Finset.Ioc_eq_Icc (M N : ℕ) : Finset.Ioc N M = Finset.Icc (N + 1) M := by ++ ext a; simp only [Finset.mem_Ioc, Finset.mem_Icc]; constructor <;> intro ⟨h₁, h₂⟩ <;> omega ++ ++lemma Finset.Icc_eq_Ico (M N : ℕ) : Finset.Icc N M = Finset.Ico N (M + 1) := by ++ ext a; simp only [Finset.mem_Icc, Finset.mem_Ico]; constructor <;> intro ⟨h₁, h₂⟩ <;> omega ++ ++lemma finsetSum_tendsto_tsum {N : ℕ} {f : ℕ → ℂ} (hf : Summable f) : ++ Tendsto (fun (k : ℕ) ↦ ∑ n ∈ Finset.Ico N k, f n) atTop (𝓝 (∑' (n : ℕ), f (n + N))) := by ++ have := Summable.hasSum_iff_tendsto_nat hf (m := ∑' (n : ℕ), f n) |>.mp hf.hasSum ++ have const := tendsto_const_nhds (α := ℕ) (x := ∑ i ∈ Finset.range N, f i) (f := atTop) ++ have := Filter.Tendsto.sub this const ++ rw [← hf.sum_add_tsum_nat_add N, add_comm, add_sub_cancel_right] at this ++ apply this.congr' ++ filter_upwards [Filter.mem_atTop (N + 1)] ++ intro M hM ++ rw [Finset.sum_Ico_eq_sub] ++ linarith ++ ++lemma Complex.cpow_tendsto {s : ℂ} (s_re_gt : 1 < s.re) : ++ Tendsto (fun (x : ℕ) ↦ (x : ℂ) ^ (1 - s)) atTop (𝓝 0) := by ++ have one_sub_s_re_ne : (1 - s).re ≠ 0 := by simp only [sub_re, one_re]; linarith ++ rw [tendsto_zero_iff_norm_tendsto_zero] ++ simp_rw [Complex.norm_natCast_cpow_of_re_ne_zero _ (one_sub_s_re_ne)] ++ rw [(by simp only [sub_re, one_re, neg_sub] : (1 - s).re = - (s - 1).re)] ++ apply (tendsto_rpow_neg_atTop _).comp tendsto_natCast_atTop_atTop; simp [s_re_gt] ++ ++lemma Complex.cpow_inv_tendsto {s : ℂ} (hs : 0 < s.re) : ++ Tendsto (fun (x : ℕ) ↦ ((x : ℂ) ^ s)⁻¹) atTop (𝓝 0) := by ++ rw [tendsto_zero_iff_norm_tendsto_zero] ++ simp_rw [norm_inv, Complex.norm_natCast_cpow_of_re_ne_zero _ <| ne_of_gt hs] ++ apply Filter.Tendsto.inv_tendsto_atTop ++ exact (tendsto_rpow_atTop hs).comp tendsto_natCast_atTop_atTop ++ ++lemma ZetaSum_aux2a : ∃ C, ∀ (x : ℝ), ‖⌊x⌋ + 1 / 2 - x‖ ≤ C := by ++ use 1 / 2; exact ZetaSum_aux1_3 ++ ++lemma ZetaSum_aux3 {N : ℕ} {s : ℂ} (s_re_gt : 1 < s.re) : ++ Tendsto (fun k ↦ ∑ n ∈ Finset.Ioc N k, 1 / (n : ℂ) ^ s) atTop ++ (𝓝 (∑' (n : ℕ), 1 / (n + N + 1 : ℂ) ^ s)) := by ++ let f := fun (n : ℕ) ↦ 1 / (n : ℂ) ^ s ++ have hf := summable_one_div_nat_cpow.mpr s_re_gt ++ simp_rw [Finset.Ioc_eq_Ico] ++ convert finsetSum_tendsto_tsum (f := fun n ↦ f (n + 1)) (N := N) ?_ using 1 ++ · ext k ++ rw [Finset.sum_Ico_add'] ++ · congr; ext n; simp only [one_div, Nat.cast_add, Nat.cast_one, f] ++ · rwa [summable_nat_add_iff (k := 1)] ++ ++lemma integrableOn_of_Zeta0_fun {N : ℕ} (N_pos : 0 < N) {s : ℂ} (s_re_gt : 0 < s.re) : ++ MeasureTheory.IntegrableOn (fun (x : ℝ) ↦ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1))) (Ioi N) ++ MeasureTheory.volume := by ++ obtain ⟨c, hc⟩ := ZetaSum_aux2a ++ apply MeasureTheory.Integrable.bdd_mul (c := c) ?_ ?_ ++ · apply MeasureTheory.ae_of_all ++ convert hc; simp only [← Complex.norm_real]; simp ++ · apply integrableOn_Ioi_cpow_iff (by positivity) |>.mpr (by simp [s_re_gt]) ++ · refine Measurable.add ?_ measurable_const |>.sub (by fun_prop) |>.aestronglyMeasurable ++ exact Measurable.comp (by exact fun _ _ ↦ trivial) Int.measurable_floor ++ ++lemma ZetaSum_aux2 {N : ℕ} (N_pos : 0 < N) {s : ℂ} (s_re_gt : 1 < s.re) : ++ ∑' (n : ℕ), 1 / (n + N + 1 : ℂ) ^ s = ++ (- N ^ (1 - s)) / (1 - s) - N ^ (-s) / 2 ++ + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1)) := by ++ have s_ne_zero : s ≠ 0 := fun hs ↦ by linarith [zero_re ▸ hs ▸ s_re_gt] ++ have s_ne_one : s ≠ 1 := fun hs ↦ (lt_self_iff_false _).mp <| one_re ▸ hs ▸ s_re_gt ++ apply tendsto_nhds_unique (X := ℂ) (Y := ℕ) (l := atTop) ++ (f := fun k ↦ ((k : ℂ) ^ (1 - s) - (N : ℂ) ^ (1 - s)) / (1 - s) + ++ 1 / 2 * (1 / ↑k ^ s) - 1 / 2 * (1 / ↑N ^ s) ++ + s * ∫ (x : ℝ) in (N : ℝ)..k, (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1))) ++ (b := (- N ^ (1 - s)) / (1 - s) - N ^ (-s) / 2 ++ + s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1))) ++ · apply Filter.Tendsto.congr' ++ (f₁ := fun (k : ℕ) ↦ ∑ n ∈ Finset.Ioc N k, 1 / (n : ℂ) ^ s) (l₁ := atTop) ++ · apply Filter.eventually_atTop.mpr ++ use N + 1 ++ intro k hk ++ exact ZetaSum_aux1 (a := N) (b := k) s_ne_one s_ne_zero ⟨N_pos, hk⟩ ++ · exact ZetaSum_aux3 s_re_gt ++ · apply (Tendsto.sub ?_ ?_).add (Tendsto.const_mul _ ?_) ++ · rw [(by ring : -↑N ^ (1 - s) / (1 - s) = (0 - ↑N ^ (1 - s)) / (1 - s) + 0)] ++ apply _root_.Erdos970.Complex.cpow_tendsto s_re_gt |>.sub_const _ |>.div_const _ |>.add ++ simp_rw [mul_comm_div, one_mul, one_div, (by congr; ring : 𝓝 (0 : ℂ) = 𝓝 ((0 : ℂ) / 2))] ++ apply Tendsto.div_const <| _root_.Erdos970.Complex.cpow_inv_tendsto (by positivity) ++ · simp_rw [mul_comm_div, one_mul, one_div, cpow_neg]; exact tendsto_const_nhds ++ · exact MeasureTheory.intervalIntegral_tendsto_integral_Ioi (a := N) ++ (b := (fun (n : ℕ) ↦ (n : ℝ))) ++ (integrableOn_of_Zeta0_fun N_pos <| by positivity) tendsto_natCast_atTop_atTop ++ ++open MeasureTheory in ++ ++lemma ZetaBnd_aux1b (N : ℕ) (Npos : 1 ≤ N) {σ t : ℝ} (σpos : 0 < σ) : ++ ‖∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ ((σ + t * I) + 1)‖ ++ ≤ N ^ (-σ) / σ := by ++ apply le_trans (by apply norm_integral_le_integral_norm) ++ apply le_of_tendsto (x := atTop (α := ℝ)) (f := fun (t : ℝ) ↦ ∫ (x : ℝ) in N..t, ++ ‖(⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (σ + t * I + 1)‖) ?_ ?_ ++ · apply intervalIntegral_tendsto_integral_Ioi (μ := volume) (l := atTop) (b := id) ++ (f := fun (x : ℝ) ↦ ‖(⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (σ + t * I + 1)‖) N ?_ ?_ |>.congr' ?_ ++ · filter_upwards [Filter.mem_atTop ((N : ℝ))] ++ intro u hu ++ simp only [id_eq, intervalIntegral.integral_of_le hu, norm_div] ++ apply setIntegral_congr_fun (by simp) ++ intro x hx; beta_reduce ++ iterate 2 (rw [norm_cpow_eq_rpow_re_of_pos (by linarith [hx.1])]) ++ simp ++ · apply IntegrableOn.integrable ?_ |>.norm ++ convert! integrableOn_of_Zeta0_fun (s := σ + t * I) Npos (by simp [σpos]) using 1 ++ simp_rw [div_eq_mul_inv, cpow_neg] ++ · exact fun ⦃_⦄ a ↦ a ++ · filter_upwards [mem_atTop (N + 1 : ℝ)] with t ht ++ have : (N ^ (-σ) - t ^ (-σ)) / σ ≤ N ^ (-σ) / σ := ++ div_le_div_iff_of_pos_right σpos |>.mpr (by simp [Real.rpow_nonneg (by linarith)]) ++ apply le_trans ?_ this ++ convert! ZetaBnd_aux1a (a := N) (b := t) (by positivity) (by linarith) ?_ <;> simp [σpos] ++ ++lemma ZetaBnd_aux1 (N : ℕ) (Npos : 1 ≤ N) {σ t : ℝ} (hσ : σ ∈ Ioc 0 2) (ht : 2 ≤ |t|) : ++ ‖(σ + t * I) * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ ((σ + t * I) + 1)‖ ++ ≤ 2 * |t| * N ^ (-σ) / σ := by ++ rw [norm_mul, mul_div_assoc] ++ rw [Set.mem_Ioc] at hσ ++ apply mul_le_mul ?_ (ZetaBnd_aux1b N Npos hσ.1) (norm_nonneg _) (by positivity) ++ refine le_trans (by apply norm_add_le) ?_ ++ simp only [Complex.norm_of_nonneg hσ.1.le, Complex.norm_mul, norm_real, Real.norm_eq_abs, norm_I, ++ mul_one] ++ linarith [hσ.2] ++ ++lemma ZetaBnd_aux1p (N : ℕ) (Npos : 1 ≤ N) {σ : ℝ} (hσ : σ ∈ Ioc 0 2) : ++ (fun (t : ℝ) ↦ ++ ‖(σ + t * I) * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ ((σ + t * I) + 1)‖) ++ =O[Filter.principal {t | 2 ≤ |t|}] fun t ↦ |t| * N ^ (-σ) / σ := by ++ rw [Asymptotics.IsBigO_def] ++ use 2 ++ rw [Asymptotics.isBigOWith_principal] ++ intro t ht ++ simp only [mem_ofPred_eq] at ht ++ rw [norm_norm, norm_mul, mul_div_assoc, norm_mul] ++ have : 2 * (‖|t|‖ * ‖↑N ^ (-σ) / σ‖) = (2 * |t|) * ((N : ℝ) ^ (-σ) / σ) := by ++ simp only [Real.norm_eq_abs, _root_.abs_abs, norm_div] ++ have : σ ≠ 0 := by linarith [hσ.1] ++ field_simp ++ rw [abs_of_pos hσ.1] ++ have : 0 < (N : ℝ) ^ (-σ) := by ++ refine Real.rpow_pos_of_pos ?_ _ ++ positivity ++ rw [abs_of_pos this] ++ ring ++ rw [this] ++ apply mul_le_mul ?_ (ZetaBnd_aux1b N Npos hσ.1) (norm_nonneg _) (by positivity) ++ refine le_trans (by apply norm_add_le) ?_ ++ simp only [norm_real, norm_mul, norm_I, mul_one, Complex.norm_of_nonneg hσ.1.le, Real.norm_eq_abs] ++ linarith [hσ.2] ++ ++lemma isOpen_aux : IsOpen {z : ℂ | z ≠ 1 ∧ 0 < z.re} := by ++ refine IsOpen.inter isOpen_ne ?_ ++ exact isOpen_lt (g := fun (z : ℂ) ↦ z.re) (by continuity) (by continuity) ++ ++open MeasureTheory in ++lemma integrable_log_over_pow {r : ℝ} (rneg : r < 0) {N : ℕ} (Npos : 0 < N) : ++ IntegrableOn (fun (x : ℝ) ↦ ‖x ^ (r - 1)‖ * ‖Real.log x‖) <| Ioi N := by ++ apply IntegrableOn.mono_set (hst := Set.Ioi_subset_Ici <| le_refl (N : ℝ)) ++ apply LocallyIntegrableOn.integrableOn_of_isBigO_atTop (g := fun x ↦ x ^ (r / 2 - 1)) ++ · apply ContinuousOn.abs ?_ |>.mul ?_ |>.locallyIntegrableOn (by simp) ++ · apply ContinuousOn.rpow (by fun_prop) (by fun_prop) ++ intro x hx; left; contrapose! Npos with h; exact_mod_cast h ▸ mem_Ici.mp hx ++ · apply continuous_id.continuousOn.log ?_ |>.abs ++ intro x hx; simp only [id_eq]; contrapose! Npos with h; exact_mod_cast h ▸ mem_Ici.mp hx ++ · have := isLittleO_log_rpow_atTop (r := -r / 2) (by linarith) |>.isBigO ++ rw [Asymptotics.isBigO_iff_eventually, Filter.eventually_atTop] at this ++ obtain ⟨C, hC⟩ := this ++ have hh := hC C (by simp) ++ rw [Asymptotics.isBigO_atTop_iff_eventually_exists] ++ have := Filter.eventually_atTop.mp hh ++ obtain ⟨x₀, hx₀ ⟩ := this ++ filter_upwards [hh, Filter.mem_atTop x₀, Filter.mem_atTop 1] ++ intro x hx x_gt x_pos ++ use C ++ intro y hy ++ simp only [norm_mul, Real.norm_eq_abs, _root_.abs_abs] ++ simp only [Real.norm_eq_abs] at hx ++ have y_pos : 0 < y := by linarith ++ have : y ^ (r / 2 - 1) = y ^ (r - 1) * y ^ (-r / 2) := by ++ rw [← Real.rpow_add y_pos]; ring_nf ++ rw [this, abs_mul] ++ have y_gt : y ≥ x₀ := by linarith ++ have := hx₀ y y_gt ++ simp only [Real.norm_eq_abs] at this ++ rw [← mul_assoc, mul_comm C, mul_assoc] ++ exact mul_le_mul_of_nonneg_left (hbc := this) (a := |y ^ (r - 1)|) (ha := by simp) ++ · have := integrableOn_Ioi_rpow_iff (s := r / 2 - 1) (t := N) (by simp [Npos]) |>.mpr ++ (by linarith [rneg]) ++ exact integrableOn_Ioi_iff_integrableAtFilter_atTop_nhdsWithin.mp this |>.1 ++ ++open MeasureTheory in ++lemma integrableOn_of_Zeta0_fun_log {N : ℕ} (Npos : 0 < N) {s : ℂ} (s_re_gt : 0 < s.re) : ++ IntegrableOn (fun (x : ℝ) ↦ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(s + 1)) * (-Real.log x)) (Ioi N) ++ volume := by ++ simp_rw [mul_assoc] ++ obtain ⟨c, hc⟩ := ZetaSum_aux2a ++ apply Integrable.bdd_mul (c := c) ?_ ?_ ?_ ++ · simp only [neg_add_rev, mul_neg, add_comm, ← sub_eq_add_neg] ++ apply integrable_norm_iff ?_ |>.mp ?_ |>.neg ++ · apply ContinuousOn.mul ?_ ?_ |>.aestronglyMeasurable (by simp) ++ · intro x hx ++ apply ContinuousWithinAt.cpow ?_ continuous_const.continuousWithinAt ?_ ++ · exact RCLike.continuous_ofReal.continuousWithinAt ++ · simp only [ofReal_mem_slitPlane]; linarith [mem_Ioi.mp hx] ++ · apply RCLike.continuous_ofReal.continuousOn.comp ?_ (mapsTo_image _ _) ++ refine continuous_id.continuousOn.log ?_ ++ intro x hx; simp only [id_eq]; linarith [mem_Ioi.mp hx] ++ · simp only [norm_mul, norm_real] ++ have := integrable_log_over_pow (r := -s.re) (by linarith) Npos ++ apply IntegrableOn.congr_fun this ?_ (by simp) ++ intro x hx ++ simp only [mul_eq_mul_right_iff, norm_eq_zero, Real.log_eq_zero] ++ left ++ have xpos : 0 < x := by linarith [mem_Ioi.mp hx] ++ simp [norm_cpow_eq_rpow_re_of_pos xpos, Real.abs_rpow_of_nonneg xpos.le, ++ abs_eq_self.mpr xpos.le] ++ · apply Measurable.add ?_ measurable_const |>.sub (by fun_prop) |>.aestronglyMeasurable ++ exact Measurable.comp (fun _ _ ↦ trivial) Int.measurable_floor ++ · apply MeasureTheory.ae_of_all ++ convert hc with _ x; simp only [← Complex.norm_real]; simp ++ ++open MeasureTheory in ++lemma hasDerivAt_Zeta0Integral {N : ℕ} (Npos : 0 < N) {s : ℂ} (hs : s ∈ {s | 0 < s.re}) : ++ HasDerivAt (fun z ↦ ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-z - 1)) ++ (∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (- s - 1) * (- Real.log x)) s := by ++ simp only [mem_ofPred_eq] at hs ++ set f : ℝ → ℂ := fun x ↦ (⌊x⌋ : ℂ) + 1 / 2 - x ++ set F : ℂ → ℝ → ℂ := fun s x ↦ (x : ℂ) ^ (- s - 1) * f x ++ set F' : ℂ → ℝ → ℂ := fun s x ↦ (x : ℂ) ^ (- s - 1) * (- Real.log x) * f x ++ set ε := s.re / 2 ++ have ε_pos : 0 < ε := by aesop ++ set bound : ℝ → ℝ := fun x ↦ |x ^ (- s.re / 2 - 1)| * |Real.log x| ++ let μ : Measure ℝ := volume.restrict (Ioi (N : ℝ)) ++ have hF_meas : ∀ᶠ (z : ℂ) in 𝓝 s, AEStronglyMeasurable (F z) μ := by ++ have : {z : ℂ | 0 < z.re} ∈ 𝓝 s := by ++ rw [mem_nhds_iff] ++ refine ⟨{z | 0 < z.re}, fun ⦃a⦄ a ↦ a, isOpen_lt continuous_const Complex.continuous_re, hs⟩ ++ filter_upwards [this] with z hz ++ convert! integrableOn_of_Zeta0_fun Npos hz |>.aestronglyMeasurable using 1 ++ simp only [F, f]; ext x; ring_nf ++ have hF_int : Integrable (F s) μ := by ++ convert! integrableOn_of_Zeta0_fun Npos hs |>.integrable using 1 ++ simp only [F, f]; ext x; ring_nf ++ have hF'_meas : AEStronglyMeasurable (F' s) μ := by ++ convert! integrableOn_of_Zeta0_fun_log Npos hs |>.aestronglyMeasurable using 1 ++ simp only [F', f]; ext x; ring_nf ++ have IoiSubIoi1 : (Ioi (N : ℝ)) ⊆ {x | 1 < x} := ++ fun x hx ↦ lt_of_le_of_lt (by simp only [Nat.one_le_cast]; omega) <| mem_Ioi.mp hx ++ have measSetIoi1 : MeasurableSet {x : ℝ | 1 < x} := (isOpen_lt' 1).measurableSet ++ have h_bound1 : ++ ∀ᵐ (x : ℝ) ∂volume.restrict {x | 1 < x}, ∀ z ∈ Metric.ball s ε, ‖F' z x‖ ≤ bound x := by ++ filter_upwards [self_mem_ae_restrict measSetIoi1] with x hx ++ intro z hz ++ simp only [F', f, bound] ++ calc _ = ‖(x : ℂ) ^ (-z - 1)‖ * ‖-(Real.log x)‖ * ‖(⌊x⌋ + 1 / 2 - x)‖ := by ++ simp only [mul_neg, one_div, neg_mul, norm_neg, norm_mul, norm_real, Real.norm_eq_abs, ++ ← (by simp : (((⌊x⌋ + 2⁻¹ - x) : ℝ) : ℂ) = (⌊x⌋ : ℂ) + 2⁻¹ - ↑x), ++ Complex.norm_real] ++ _ = ‖x ^ (-z.re - 1)‖ * ‖-(Real.log x)‖ * ‖(⌊x⌋ + 1 / 2 - x)‖ := ?_ ++ _ = |x ^ (-z.re - 1)| * |(Real.log x)| * |(⌊x⌋ + 1 / 2 - x)| := by simp ++ _ ≤ _ := ?_ ++ · congr! 2 ++ simp only [Real.norm_eq_abs, norm_cpow_eq_rpow_re_of_pos (by linarith), ++ sub_re, neg_re, one_re] ++ apply abs_eq_self.mpr ?_ |>.symm ++ positivity ++ · rw [mul_comm, ← mul_assoc] ++ apply mul_le_mul_of_nonneg_right ?_ <| abs_nonneg _ ++ simp only [Metric.mem_ball, ε, Complex.dist_eq] at hz ++ apply le_trans (b := 1 * |x ^ (-z.re - 1)|) ++ · apply mul_le_mul_of_nonneg_right (le_trans (ZetaSum_aux1_3 _) (by norm_num)) <| abs_nonneg _ ++ · simp_rw [one_mul, Real.abs_rpow_of_nonneg (by linarith : 0 ≤ x)] ++ apply Real.rpow_le_rpow_of_exponent_le <| le_abs.mpr (by left; exact hx.le) ++ have := abs_le.mp <| le_trans (abs_re_le_norm (z-s)) hz.le ++ simp only [sub_re, neg_le_sub_iff_le_add, tsub_le_iff_right] at this ++ linarith [this.1] ++ have h_bound : ∀ᵐ x ∂μ, ∀ z ∈ Metric.ball s ε, ‖F' z x‖ ≤ bound x := by ++ apply ae_restrict_of_ae_restrict_of_subset IoiSubIoi1 ++ exact h_bound1 ++ have bound_integrable : Integrable bound μ := by ++ simp only [bound] ++ convert! integrable_log_over_pow (r := -s.re / 2) (by linarith) Npos using 0 ++ have h_diff : ∀ᵐ x ∂μ, ∀ z ∈ Metric.ball s ε, HasDerivAt (fun w ↦ F w x) (F' z x) z := by ++ simp only [F, F', f] ++ apply ae_restrict_of_ae_restrict_of_subset IoiSubIoi1 ++ filter_upwards [h_bound1, self_mem_ae_restrict measSetIoi1] with x _ one_lt_x ++ intro z hz ++ convert! HasDerivAt.mul_const (c := fun (w : ℂ) ↦ (x : ℂ) ^ (-w-1)) ++ (c' := (x : ℂ) ^ (-z-1) * -Real.log x) (d := (⌊x⌋ : ℝ) + 1 / 2 - x) ?_ using 1 ++ convert! HasDerivAt.comp (h := fun w ↦ -w-1) (h' := -1) (h₂ := fun w ↦ x ^ w) ++ (h₂' := x ^ (-z-1) * Real.log x) (x := z) ?_ ?_ using 0 ++ · simp only [mul_neg, mul_one]; congr! 2 ++ · convert! HasDerivAt.const_cpow (c := (x : ℂ)) (f := fun w ↦ w) (f' := 1) (x := -z-1) ++ (hasDerivAt_id _) ?_ using 1 ++ · simp only [mul_one, mul_eq_mul_left_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq] ++ left ++ rw [Complex.ofReal_log] ++ linarith ++ · right ++ intro h ++ simp only [Metric.mem_ball, ε, Complex.dist_eq, ++ neg_eq_iff_eq_neg.mp <| sub_eq_zero.mp h] at hz ++ have := (abs_le.mp <| le_trans (abs_re_le_norm (-1-s)) hz.le).1 ++ simp only [sub_re, neg_re, one_re, neg_le_sub_iff_le_add, le_neg_add_iff_add_le] at this ++ linarith ++ · apply hasDerivAt_id _ |>.neg |>.sub_const ++ convert! (hasDerivAt_integral_of_dominated_loc_of_deriv_le (F := F) (F' := F') (x₀ := s) ++ (s := Metric.ball s ε) (bound := bound) (μ := μ) (Metric.ball_mem_nhds s ε_pos) ++ hF_meas hF_int hF'_meas h_bound bound_integrable h_diff).2 using 3 ++ · ext a; simp only [one_div, F, f]; ring_nf ++ · simp only [one_div, mul_neg, neg_mul, neg_inj, F', f]; ring_nf ++ ++noncomputable def ζ₀' (N : ℕ) (s : ℂ) : ℂ := ++ ∑ n ∈ Finset.range (N + 1), -1 / (n : ℂ) ^ s * Real.log n + ++ (-N ^ (1 - s) / (1 - s) ^ 2 + Real.log N * N ^ (1 - s) / (1 - s)) + ++ Real.log N * N ^ (-s) / 2 + ++ (1 * (∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (- s - 1)) + ++ s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (- s - 1) * (- Real.log x)) ++ ++lemma HasDerivAt_neg_cpow_over2 {N : ℕ} (Npos : 0 < N) (s : ℂ) : ++ HasDerivAt (fun x : ℂ ↦ -(N : ℂ) ^ (-x) / 2) (-((- Real.log N) * (N : ℂ) ^ (-s)) / 2) s := by ++ convert! hasDerivAt_neg' s |>.const_cpow (c := N) (by aesop) |>.neg |>.div_const _ using 1 ++ simp [mul_comm] ++ ++lemma HasDerivAt_cpow_over_var (N : ℕ) {z : ℂ} (z_ne_zero : z ≠ 0) : ++ HasDerivAt (fun z ↦ -(N : ℂ) ^ z / z) ++ (((N : ℂ) ^ z / z ^ 2) - (Real.log N * N ^ z / z)) z := by ++ simp_rw [div_eq_mul_inv] ++ convert! HasDerivAt.mul (c := fun z ↦ - (N : ℂ) ^ z) (d := fun z ↦ z⁻¹) ++ (c' := - (N : ℂ) ^ z * Real.log N) ++ (d' := - (z ^ 2)⁻¹) ?_ ?_ using 1 ++ · simp only [natCast_log, neg_mul, mul_neg, neg_neg] ++ ring_nf ++ · simp only [natCast_log, neg_mul] ++ apply HasDerivAt.neg ++ convert! HasDerivAt.const_cpow (c := (N : ℂ)) (f := id) (f' := 1) (x := z) (hasDerivAt_id z) ++ (by simp [z_ne_zero]) using 1 ++ simp only [id_eq, mul_one] ++ · exact hasDerivAt_inv z_ne_zero ++ ++lemma HasDerivAtZeta0 {N : ℕ} (Npos : 0 < N) {s : ℂ} (reS_pos : 0 < s.re) (s_ne_one : s ≠ 1) : ++ HasDerivAt (ζ₀ N) (ζ₀' N s) s := by ++ unfold riemannZeta0 ζ₀' ++ apply HasDerivAt.fun_sum ?_ |>.add ?_ |>.add ?_ |>.add ?_ ++ · intro n _ ++ convert! hasDerivAt_neg' s |>.const_cpow (c := n) (by aesop) using 1 ++ all_goals (ring_nf; simp [cpow_neg]) ++ · convert! HasDerivAt.comp (h₂ := fun z ↦ -(N : ℂ) ^ z / z) (h := fun z ↦ 1 - z) (h' := -1) ++ (h₂' := ((N : ℂ) ^ (1 - s) / (1 - s) ^ 2 - Real.log (N : ℝ) * (N : ℂ) ^ (1 - s) / (1 - s))) ++ (x := s) ?_ ?_ using 1 ++ · ring_nf ++ · exact HasDerivAt_cpow_over_var N (by rw [sub_ne_zero]; exact s_ne_one.symm) ++ · convert! hasDerivAt_const s _ |>.sub (hasDerivAt_id _) using 1; simp ++ · convert! HasDerivAt_neg_cpow_over2 Npos s using 1; simp only [natCast_log, neg_mul, neg_neg] ++ · simp_rw [div_cpow_eq_cpow_neg, neg_add, ← sub_eq_add_neg] ++ convert! hasDerivAt_id s |>.mul <| hasDerivAt_Zeta0Integral Npos reS_pos using 1 ++ ++lemma HolomorphicOn_riemannZeta0 {N : ℕ} (N_pos : 0 < N) : ++ HolomorphicOn (ζ₀ N) {s : ℂ | s ≠ 1 ∧ 0 < s.re} := ++ fun _ ⟨hs₁, hs₂⟩ ↦ (HasDerivAtZeta0 N_pos hs₂ hs₁).differentiableAt.differentiableWithinAt ++ ++lemma HolomorphicOn_riemannZeta : ++ HolomorphicOn ζ {s : ℂ | s ≠ 1} := by ++ intro z hz ++ simp only [mem_ofPred_eq] at hz ++ exact (differentiableAt_riemannZeta hz).differentiableWithinAt ++ ++lemma isPathConnected_aux : IsPathConnected {z : ℂ | z ≠ 1 ∧ 0 < z.re} := by ++ use (2 : ℂ) ++ constructor ++ · simp ++ intro w hw; simp only [ne_eq, mem_ofPred_eq] at hw ++ by_cases w_im : w.im = 0 ++ · apply JoinedIn.trans (y := 1 + I) ++ · let f : ℝ → ℂ := fun t ↦ (1 + I) * t + 2 * (1 - t) ++ have cont : Continuous f := by continuity ++ apply JoinedIn.ofLine cont.continuousOn (by simp [f]) (by simp [f]) ++ simp only [unitInterval, ne_eq, image_subset_iff, preimage_ofPred_eq, add_re, mul_re, one_re, ++ I_re, add_zero, ofReal_re, one_mul, add_im, one_im, I_im, zero_add, ofReal_im, mul_zero, ++ sub_zero, re_ofNat, sub_re, im_ofNat, sub_im, sub_self, f] ++ intro x hx; simp only [mem_Icc] at hx ++ refine ⟨?_, by linarith⟩ ++ intro h ++ rw [Complex.ext_iff] at h; simp [(by apply And.right; simpa [w_im] using h : x = 0)] at h ++ · let f : ℝ → ℂ := fun t ↦ w * t + (1 + I) * (1 - t) ++ have cont : Continuous f := by continuity ++ apply JoinedIn.ofLine cont.continuousOn (by simp [f]) (by simp [f]) ++ simp only [unitInterval, ne_eq, image_subset_iff, preimage_ofPred_eq, add_re, mul_re, ++ ofReal_re, ofReal_im, mul_zero, sub_zero, one_re, I_re, add_zero, sub_re, one_mul, add_im, ++ one_im, I_im, zero_add, sub_im, sub_self, f] ++ intro x hx; simp only [mem_Icc] at hx ++ simp only [mem_ofPred_eq] ++ constructor ++ · intro h ++ refine hw.1 ?_ ++ rw [Complex.ext_iff] at h ++ have : x = 1 := by linarith [(by apply And.right; simpa [w_im] using h : 1 - x = 0)] ++ rw [Complex.ext_iff, one_re, one_im]; exact ⟨by simpa [this, w_im] using h, w_im⟩ ++ · by_cases hxx : x = 0 ++ · simp only [hxx]; linarith ++ · have : 0 < x := lt_of_le_of_ne hx.1 (Ne.symm hxx) ++ have : 0 ≤ 1 - x := by linarith ++ have := hw.2 ++ positivity ++ · let f : ℝ → ℂ := fun t ↦ w * t + 2 * (1 - t) ++ have cont : Continuous f := by continuity ++ apply JoinedIn.ofLine cont.continuousOn (by simp [f]) (by simp [f]) ++ simp only [unitInterval, ne_eq, image_subset_iff, preimage_ofPred_eq, add_re, mul_re, ofReal_re, ++ ofReal_im, mul_zero, sub_zero, re_ofNat, sub_re, one_re, im_ofNat, sub_im, one_im, sub_self, ++ f] ++ intro x hx; simp only [mem_Icc] at hx ++ constructor ++ · intro h ++ rw [Complex.ext_iff] at h; ++ simp [(by apply And.right; simpa [w_im] using h : x = 0)] at h ++ · by_cases hxx : x = 0 ++ · simp only [hxx]; linarith ++ · have : 0 < x := lt_of_le_of_ne hx.1 (Ne.symm hxx) ++ have : 0 ≤ 1 - x := by linarith ++ have := hw.2 ++ positivity ++ ++lemma Zeta0EqZeta {N : ℕ} (N_pos : 0 < N) {s : ℂ} (reS_pos : 0 < s.re) (s_ne_one : s ≠ 1) : ++ ζ₀ N s = riemannZeta s := by ++ let f := riemannZeta ++ let g := ζ₀ N ++ let U := {z : ℂ | z ≠ 1 ∧ 0 < z.re} ++ have f_an : AnalyticOnNhd ℂ f U := by ++ apply (HolomorphicOn_riemannZeta.analyticOnNhd isOpen_ne).mono ++ simp only [ne_eq, ofPred_subset_ofPred, and_imp, U] ++ exact fun a ha _ ↦ ha ++ have g_an : AnalyticOnNhd ℂ g U := (HolomorphicOn_riemannZeta0 N_pos).analyticOnNhd isOpen_aux ++ have preconU : IsPreconnected U := by ++ apply IsConnected.isPreconnected ++ apply (IsOpen.isConnected_iff_isPathConnected isOpen_aux).mpr isPathConnected_aux ++ have h2 : (2 : ℂ) ∈ U := by simp [U] ++ have s_mem : s ∈ U := by simp [U, reS_pos, s_ne_one] ++ convert (AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq f_an g_an preconU h2 ?_ s_mem).symm ++ have u_mem : {z : ℂ | 1 < z.re} ∈ 𝓝 (2 : ℂ) := by ++ apply mem_nhds_iff.mpr ++ use {z : ℂ | 1 < z.re} ++ simp only [ofPred_subset_ofPred, imp_self, forall_const, mem_ofPred_eq, re_ofNat, ++ Nat.one_lt_ofNat, and_true, true_and] ++ exact isOpen_lt (by continuity) (by continuity) ++ filter_upwards [u_mem] ++ intro z hz ++ simp only [f,g, zeta_eq_tsum_one_div_nat_cpow hz, riemannZeta0_apply] ++ nth_rewrite 2 [neg_div] ++ rw [← sub_eq_add_neg, ← ZetaSum_aux2 N_pos hz, ++ ← (summable_one_div_nat_cpow.mpr hz).sum_add_tsum_nat_add (N + 1)] ++ norm_cast ++ ++lemma DerivZeta0EqDerivZeta {N : ℕ} (N_pos : 0 < N) {s : ℂ} (reS_pos : 0 < s.re) ++ (s_ne_one : s ≠ 1) : ++ deriv (ζ₀ N) s = ζ' s := by ++ let U := {z : ℂ | z ≠ 1 ∧ 0 < z.re} ++ have {x : ℂ} (hx : x ∈ U) : ζ₀ N x = ζ x := by ++ simp only [mem_ofPred_eq, U] at hx; exact Zeta0EqZeta (N := N) N_pos hx.2 hx.1 ++ refine deriv_eqOn isOpen_aux ?_ (by simp [s_ne_one, reS_pos]) ++ intro x hx ++ have hζ := HolomorphicOn_riemannZeta.mono (by aesop)|>.hasDerivAt (s := U) <| ++ isOpen_aux.mem_nhds hx ++ exact hζ.hasDerivWithinAt.congr (fun y hy ↦ this hy) (this hx) ++ ++lemma le_trans₄ {α : Type*} [Preorder α] {a b c d : α} : a ≤ b → b ≤ c → c ≤ d → a ≤ d := ++ fun hab hbc hcd ↦ le_trans (le_trans hab hbc) hcd ++ ++lemma lt_trans₄ {α : Type*} [Preorder α] {a b c d : α} : a < b → b < c → c < d → a < d := ++ fun hab hbc hcd ↦ lt_trans (lt_trans hab hbc) hcd ++ ++lemma norm_add₅_le {E : Type*} [SeminormedAddGroup E] (a : E) (b : E) (c : E) (d : E) (e : E) : ++ ‖a + b + c + d + e‖ ≤ ‖a‖ + ‖b‖ + ‖c‖ + ‖d‖ + ‖e‖ := by ++ apply le_trans <| norm_add_le (a + b + c + d) e ++ simp only [add_le_add_iff_right]; apply norm_add₄_le ++ ++lemma norm_add₆_le {E : Type*} [SeminormedAddGroup E] (a : E) (b : E) (c : E) (d : E) (e : E) ++ (f : E) : ++ ‖a + b + c + d + e + f‖ ≤ ‖a‖ + ‖b‖ + ‖c‖ + ‖d‖ + ‖e‖ + ‖f‖ := by ++ apply le_trans <| norm_add_le (a + b + c + d + e) f ++ simp only [add_le_add_iff_right]; apply norm_add₅_le ++ ++lemma mul_le_mul₃ {α : Type*} {a b c d e f : α} [MulZeroClass α] [Preorder α] [PosMulMono α] ++ [MulPosMono α] (h₁ : a ≤ b) (h₂ : c ≤ d) (h₃ : e ≤ f) (c0 : 0 ≤ c) (b0 : 0 ≤ b) ++ (e0 : 0 ≤ e) : a * c * e ≤ b * d * f := by ++ apply mul_le_mul (mul_le_mul h₁ h₂ c0 b0) h₃ e0 <| mul_nonneg b0 <| le_trans c0 h₂ ++ ++lemma ZetaBnd_aux2 {n : ℕ} {t A σ : ℝ} (Apos : 0 < A) (σpos : 0 < σ) (n_le_t : n ≤ |t|) ++ (σ_ge : (1 : ℝ) - A / Real.log |t| ≤ σ) : ++ ‖(n : ℂ) ^ (-(σ + t * I))‖ ≤ (n : ℝ)⁻¹ * Real.exp A := by ++ set s := σ + t * I ++ by_cases n0 : n = 0 ++ · simp_rw [n0, CharP.cast_eq_zero, inv_zero, zero_mul] ++ rw [Complex.zero_cpow ?_] ++ · simp ++ · exact fun h ↦ σpos.ne' <| zero_eq_neg.mp <| zero_re ▸ h ▸ (by simp [s]) ++ have n_gt_0 : 0 < n := Nat.pos_of_ne_zero n0 ++ have n_gt_0' : (0 : ℝ) < (n : ℝ) := Nat.cast_pos.mpr n_gt_0 ++ have n_ge_1 : 1 ≤ (n : ℝ) := Nat.one_le_cast.mpr <| Nat.succ_le_of_lt n_gt_0 ++ calc ++ _ = |((n : ℝ) ^ (-σ))| := ?_ ++ _ ≤ Real.exp (Real.log n * -σ) := Real.abs_rpow_le_exp_log_mul (n : ℝ) (-σ) ++ _ ≤ Real.exp (Real.log n * -(1 - A / Real.log t)) := ?_ ++ _ ≤ Real.exp (- Real.log n + A) := Real.exp_le_exp_of_le ?_ ++ _ ≤ _ := by rw [Real.exp_add, Real.exp_neg, Real.exp_log n_gt_0'] ++ · have : ‖(n : ℂ) ^ (-s)‖ = n ^ (-s.re) := norm_cpow_eq_rpow_re_of_pos n_gt_0' (-s) ++ rw [this, abs_eq_self.mpr <| Real.rpow_nonneg n_gt_0'.le _]; simp [s] ++ · apply Real.exp_le_exp_of_le <| mul_le_mul_of_nonneg_left _ <| Real.log_nonneg n_ge_1 ++ rw [neg_sub, neg_le_sub_iff_le_add, add_comm, ← Real.log_abs]; linarith ++ · simp only [neg_sub, le_neg_add_iff_add_le] ++ ring_nf ++ conv => rw [mul_comm, ← mul_assoc, ← Real.log_abs]; rhs; rw [← one_mul A] ++ gcongr ++ by_cases ht1 : |t| = 1 ++ · simp [ht1] ++ apply (inv_mul_le_iff₀ ?_).mpr ++ · convert! Real.log_le_log n_gt_0' n_le_t using 1; rw [mul_one] ++ · exact Real.log_pos <| lt_of_le_of_ne (le_trans n_ge_1 n_le_t) <| fun t ↦ ht1 (t.symm) ++ ++lemma logt_gt_one {t : ℝ} (t_ge : 3 ≤ t) : 1 < Real.log t := ++ (Real.lt_log_iff_exp_lt (by linarith)).mpr (by linarith [Real.exp_one_lt_d9]) ++ ++lemma UpperBnd_aux {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < |t|) ++ (σ_ge : 1 - A / Real.log |t| ≤ σ) : ++ let N := ⌊|t|⌋₊; ++ 0 < N ∧ N ≤ |t| ∧ 1 < Real.log |t| ∧ 1 - A < σ ∧ 0 < σ ∧ σ + t * I ≠ 1 := by ++ intro N ++ have Npos : 0 < N := Nat.floor_pos.mpr (by linarith) ++ have N_le_t : N ≤ |t| := Nat.floor_le <| abs_nonneg _ ++ have logt_gt := logt_gt_one t_gt.le ++ have σ_gt : 1 - A < σ := by ++ apply lt_of_lt_of_le ((sub_lt_sub_iff_left (a := 1)).mpr ?_) σ_ge ++ exact (div_lt_iff₀ (by linarith)).mpr <| lt_mul_right hA.1 logt_gt ++ refine ⟨Npos, N_le_t, logt_gt, σ_gt, by linarith [hA.2], ?_⟩ ++ contrapose! t_gt ++ simp only [Complex.ext_iff, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, ++ sub_self, add_zero, one_re, add_im, mul_im, zero_add, one_im] at t_gt ++ norm_num [t_gt.2] ++ ++lemma UpperBnd_aux2 {A σ t : ℝ} (t_ge : 3 < |t|) (σ_ge : 1 - A / Real.log |t| ≤ σ) : ++ |t| ^ (1 - σ) ≤ Real.exp A := by ++ have : |t| ^ (1 - σ) ≤ |t| ^ (A / Real.log |t|) := ++ Real.rpow_le_rpow_of_exponent_le (by linarith) (by linarith) ++ apply le_trans this ?_ ++ conv => lhs; lhs; rw [← Real.exp_log (by linarith : 0 < |t|)] ++ rw [div_eq_mul_inv, Real.rpow_mul (by positivity), ← Real.exp_mul, ← Real.exp_mul, mul_comm, ++ ← mul_assoc, inv_mul_cancel₀, one_mul] ++ apply Real.log_ne_zero.mpr; split_ands <;> linarith ++ ++lemma riemannZeta0_zero_aux (N : ℕ) (Npos : 0 < N) : ++ ∑ x ∈ Finset.Ico 0 N, ((x : ℝ))⁻¹ = ∑ x ∈ Finset.Ico 1 N, ((x : ℝ))⁻¹ := by ++ have : Finset.Ico 1 N ⊆ Finset.Ico 0 N := by ++ intro x hx ++ simp only [Finset.mem_Ico, Nat.Ico_zero_eq_range, Finset.mem_range] at hx ⊢ ++ exact hx.2 ++ rw [← Finset.sum_sdiff (s₁ := Finset.Ico 1 N) (s₂ := Finset.Ico 0 N) this] ++ have : Finset.Ico 0 N \ Finset.Ico 1 N = Finset.range 1 := by ++ ext a ++ simp only [Nat.Ico_zero_eq_range, Finset.mem_sdiff, Finset.mem_range, Finset.mem_Ico, not_and, ++ not_lt, Finset.range_one, Finset.mem_singleton] ++ exact ⟨fun _ ↦ by omega, fun ha ↦ ⟨by simp [ha, Npos], by omega⟩⟩ ++ rw [this]; simp ++ ++lemma UpperBnd_aux3 {A C σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) ++ (σ_ge : 1 - A / Real.log |t| ≤ σ) (t_gt : 3 < |t|) (hC : 2 ≤ C) : let N := ⌊|t|⌋₊; ++ ‖∑ n ∈ Finset.range (N + 1), (n : ℂ) ^ (-(σ + t * I))‖ ≤ ++ Real.exp A * C * Real.log |t| := by ++ intro N ++ obtain ⟨Npos, N_le_t, _, _, σPos, _⟩ := UpperBnd_aux hA t_gt σ_ge ++ have logt_gt := logt_gt_one t_gt.le ++ have (n : ℕ) (hn : n ∈ Finset.range (N + 1)) := ZetaBnd_aux2 (n := n) hA.1 σPos ?_ σ_ge ++ · replace := norm_sum_le_of_le (Finset.range (N + 1)) this ++ rw [← Finset.sum_mul, mul_comm _ (Real.exp A)] at this ++ rw [mul_assoc] ++ apply le_trans this <| (mul_le_mul_iff_right₀ A.exp_pos).mpr ?_ ++ have : 1 + Real.log (N : ℝ) ≤ C * Real.log |t| := by ++ by_cases hN : N = 1 ++ · simp only [hN, Nat.cast_one, Real.log_one, add_zero] ++ have : 2 * 1 ≤ C * Real.log |t| := mul_le_mul hC logt_gt.le (by linarith) (by linarith) ++ linarith ++ · rw [(by ring : C * Real.log |t| = Real.log |t| + (C - 1) * Real.log |t|), ++ ← one_mul <| Real.log (N: ℝ)] ++ apply add_le_add logt_gt.le ++ refine mul_le_mul (by linarith) ?_ (by positivity) (by linarith) ++ exact Real.log_le_log (by positivity) N_le_t ++ refine le_trans ?_ this ++ convert! harmonic_eq_sum_Icc ▸ harmonic_le_one_add_log N ++ · simp only [Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast, Finset.range_eq_Ico] ++ rw [riemannZeta0_zero_aux (N + 1) (by linarith)]; congr! 1 ++ · simp only [Finset.mem_range] at hn ++ linarith [(by exact_mod_cast (by omega : n ≤ N) : (n : ℝ) ≤ N)] ++ ++lemma Nat.self_div_floor_bound {t : ℝ} (t_ge : 1 ≤ |t|) : let N := ⌊|t|⌋₊; ++ (|t| / N) ∈ Icc 1 2 := by ++ intro N ++ have Npos : 0 < N := Nat.floor_pos.mpr (by linarith) ++ have N_le_t : N ≤ |t| := Nat.floor_le <| abs_nonneg _ ++ constructor ++ · apply le_div_iff₀ (by simp [Npos]) |>.mpr; simp [N_le_t] ++ · apply div_le_iff₀ (by positivity) |>.mpr ++ suffices |t| < N + 1 by linarith [(by exact_mod_cast (by omega) : 1 ≤ (N : ℝ))] ++ apply Nat.lt_floor_add_one ++ ++lemma UpperBnd_aux5 {σ t : ℝ} (t_ge : 3 < |t|) (σ_le : σ ≤ 2) : (|t| / ⌊|t|⌋₊) ^ σ ≤ 4 := by ++ obtain ⟨h₁, h₂⟩ := Nat.self_div_floor_bound (by linarith) ++ calc _ ≤ ((|t| / ↑⌊|t|⌋₊) ^ (2 : ℝ)) := by gcongr ++ _ ≤ (2 : ℝ) ^ (2 : ℝ) := by gcongr ++ _ = 4 := by norm_num ++ ++lemma UpperBnd_aux6 {σ t : ℝ} (t_ge : 3 < |t|) (hσ : σ ∈ Ioc (1 / 2) 2) ++ (neOne : σ + t * I ≠ 1) (Npos : 0 < ⌊|t|⌋₊) (N_le_t : ⌊|t|⌋₊ ≤ |t|) : ++ ⌊|t|⌋₊ ^ (1 - σ) / ‖1 - (σ + t * I)‖ ≤ |t| ^ (1 - σ) * 2 ∧ ++ ⌊|t|⌋₊ ^ (-σ) / 2 ≤ |t| ^ (1 - σ) ∧ ⌊|t|⌋₊ ^ (-σ) / σ ≤ 8 * |t| ^ (-σ) := by ++ have bnd := UpperBnd_aux5 t_ge hσ.2 ++ have bnd' : (|t| / ⌊|t|⌋₊) ^ σ ≤ 2 * |t| := by linarith ++ split_ands ++ · apply (div_le_iff₀ <| norm_pos_iff.mpr <| sub_ne_zero_of_ne neOne.symm).mpr ++ conv => rw [mul_assoc]; rhs; rw [mul_comm] ++ apply (div_le_iff₀ <| Real.rpow_pos_of_pos (by linarith) _).mp ++ rw [div_rpow_eq_rpow_div_neg (by positivity) (by positivity), neg_sub] ++ refine le_trans₄ ?_ bnd' ?_ ++ · exact Real.rpow_le_rpow_of_exponent_le (one_le_div (by positivity) |>.mpr N_le_t) (by simp) ++ · apply (mul_le_mul_iff_right₀ (by norm_num)).mpr; simpa using abs_im_le_norm (1 - (σ + t * I)) ++ · apply div_le_iff₀ (by norm_num) |>.mpr ++ rw [Real.rpow_sub (by linarith), Real.rpow_one, div_mul_eq_mul_div, mul_comm] ++ apply div_le_iff₀ (by positivity) |>.mp ++ convert! bnd' using 1 ++ rw [← Real.rpow_neg (by linarith), div_rpow_neg_eq_rpow_div (by positivity) (by positivity)] ++ · apply div_le_iff₀ (by linarith [hσ.1]) |>.mpr ++ rw [mul_assoc, mul_comm, mul_assoc] ++ apply div_le_iff₀' (by positivity) |>.mp ++ apply le_trans ?_ (by linarith [hσ.1] : 4 ≤ σ * 8) ++ convert! bnd using 1; exact div_rpow_neg_eq_rpow_div (by positivity) (by positivity) ++ ++lemma ZetaUpperBnd' {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < |t|) ++ (hσ : σ ∈ Icc (1 - A / Real.log |t|) 2) : ++ let C := Real.exp A * (5 + 8 * 2); ++ let N := ⌊|t|⌋₊; ++ let s := σ + t * I; ++ ‖∑ n ∈ Finset.range (N + 1), 1 / (n : ℂ) ^ s‖ + ‖(N : ℂ) ^ (1 - s) / (1 - s)‖ ++ + ‖(N : ℂ) ^ (-s) / 2‖ ++ + ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (s + 1)‖ ++ ≤ C * Real.log |t| := by ++ intros C N s ++ obtain ⟨Npos, N_le_t, logt_gt, σ_gt, σPos, neOne⟩ := UpperBnd_aux hA t_gt hσ.1 ++ replace σ_gt : 1 / 2 < σ := by linarith [hA.2] ++ calc ++ _ ≤ Real.exp A * 2 * Real.log |t| + ‖N ^ (1 - s) / (1 - s)‖ + ‖(N : ℂ) ^ (-s) / 2‖ + ++ ‖s * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) / (x : ℂ) ^ (s + 1)‖ := ?_ ++ _ ≤ Real.exp A * 2 * Real.log |t| + ‖N ^ (1 - s) / (1 - s)‖ + ‖(N : ℂ) ^ (-s) / 2‖ + ++ 2 * |t| * N ^ (-σ) / σ := ?_ ++ _ = Real.exp A * 2 * Real.log |t| + N ^ (1 - σ) / ‖(1 - s)‖ + N ^ (-σ) / 2 + ++ 2 * |t| * N ^ (-σ) / σ := ?_ ++ _ ≤ Real.exp A * 2 * Real.log |t| + |t| ^ (1 - σ) * 2 + ++ |t| ^ (1 - σ) + 2 * |t| * (8 * |t| ^ (-σ)) := ?_ ++ _ = Real.exp A * 2 * Real.log |t| + (3 + 8 * 2) * |t| ^ (1 - σ) := ?_ ++ _ ≤ Real.exp A * 2 * Real.log |t| + (3 + 8 * 2) * Real.exp A * 1 := ?_ ++ _ ≤ Real.exp A * 2 * Real.log |t| + (3 + 8 * 2) * Real.exp A * Real.log |t| := ?_ ++ _ = _ := by ring ++ · simp only [add_le_add_iff_right, one_div_cpow_eq_cpow_neg] ++ convert UpperBnd_aux3 (C := 2) hA hσ.1 t_gt le_rfl using 1 ++ · simp only [add_le_add_iff_left]; exact ZetaBnd_aux1 N (by linarith) ⟨σPos, hσ.2⟩ (by linarith) ++ · simp only [norm_div, RCLike.norm_ofNat, s] ++ congr <;> (convert norm_natCast_cpow_of_pos Npos _; simp) ++ · have ⟨h₁, h₂, h₃⟩ := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t ++ gcongr ++ rw [mul_div_assoc] ++ gcongr ++ · ring_nf; conv => lhs; rhs; lhs; rw [mul_comm |t|] ++ rw [← Real.rpow_add_one (by positivity)]; ring_nf ++ · simp only [Real.log_abs, add_le_add_iff_left, mul_one] ++ exact mul_le_mul_iff_right₀ (by positivity) |>.mpr <| UpperBnd_aux2 t_gt hσ.1 ++ · simp only [add_le_add_iff_left] ++ apply mul_le_mul_iff_right₀ (by norm_num [Real.exp_pos]) |>.mpr <| logt_gt.le ++ ++lemma ZetaUpperBnd : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Icc (1 - A / Real.log |t|) 2), ‖ζ (σ + t * I)‖ ≤ C * Real.log |t| := by ++ let A := (1 / 2 : ℝ) ++ let C := Real.exp A * (5 + 8 * 2) ++ refine ⟨A, ⟨by norm_num, by norm_num⟩, C, (by positivity), ?_⟩ ++ intro σ t t_gt ⟨σ_ge, σ_le⟩ ++ obtain ⟨Npos, _, _, _, σPos, neOne⟩ := UpperBnd_aux ⟨by norm_num, by norm_num⟩ t_gt σ_ge ++ rw [← Zeta0EqZeta Npos (by simp [σPos]) neOne] ++ apply le_trans (by apply norm_add₄_le) ?_ ++ convert! ZetaUpperBnd' ⟨by norm_num, le_rfl⟩ t_gt ⟨σ_ge, σ_le⟩ using 1; simp ++ ++lemma norm_complex_log_ofNat (n : ℕ) : ‖(n : ℂ).log‖ = (n : ℝ).log := by ++ have := Complex.ofReal_log (x := (n : ℝ)) (Nat.cast_nonneg n) ++ rw [(by simp : ((n : ℝ) : ℂ) = (n : ℂ))] at this ++ rw [← this, Complex.norm_of_nonneg] ++ exact Real.log_natCast_nonneg n ++ ++lemma Real.log_natCast_monotone : Monotone (fun (n : ℕ) ↦ Real.log n) := by ++ intro n m hnm ++ cases n ++ · simp only [CharP.cast_eq_zero, Real.log_zero, Real.log_natCast_nonneg] ++ · apply Real.log_le_log <;> simp only [Nat.cast_add, Nat.cast_one] ++ · exact Nat.cast_add_one_pos _ ++ · exact_mod_cast hnm ++ ++lemma Finset.Icc0_eq (N : ℕ) : Finset.Icc 0 N = {0} ∪ Finset.Icc 1 N := by ++ refine Finset.ext_iff.mpr ?_ ++ intro a ++ cases a ++ · simp only [Finset.mem_Icc, le_refl, zero_le, and_self, Finset.mem_union, Finset.mem_singleton, ++ nonpos_iff_eq_zero, one_ne_zero, and_true, or_false] ++ · simp only [Finset.mem_Icc, le_add_iff_nonneg_left, zero_le, true_and, Finset.mem_union, ++ Finset.mem_singleton, add_eq_zero, one_ne_zero, and_false, false_or] ++ ++lemma harmonic_eq_sum_Icc0_aux (N : ℕ) : ++ ∑ i ∈ Finset.Icc 0 N, (i : ℝ)⁻¹ = ∑ i ∈ Finset.Icc 1 N, (i : ℝ)⁻¹ := by ++ rw [Finset.Icc0_eq, Finset.sum_union] ++ · simp only [Finset.sum_singleton, CharP.cast_eq_zero, inv_zero, zero_add] ++ · simp only [Finset.disjoint_singleton_left, Finset.mem_Icc, nonpos_iff_eq_zero, one_ne_zero, ++ zero_le, and_true, not_false_eq_true] ++ ++lemma harmonic_eq_sum_Icc0 (N : ℕ) : ∑ i ∈ Finset.Icc 0 N, (i : ℝ)⁻¹ = (harmonic N : ℝ) := by ++ rw [harmonic_eq_sum_Icc0_aux, harmonic_eq_sum_Icc] ++ simp only [Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast] ++ ++lemma DerivUpperBnd_aux1 {A C σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) ++ (σ_ge : 1 - A / Real.log |t| ≤ σ) (t_gt : 3 < |t|) (hC : 2 ≤ C) : let N := ⌊|t|⌋₊; ++ ‖∑ n ∈ Finset.range (N + 1), -1 / (n : ℂ) ^ (σ + t * I) * (Real.log n)‖ ++ ≤ Real.exp A * C * (Real.log |t|) ^ 2 := by ++ intro N ++ obtain ⟨Npos, N_le_t, _, _, σPos, _⟩ := UpperBnd_aux hA t_gt σ_ge ++ have logt_gt := logt_gt_one t_gt.le ++ have logN_pos : 0 ≤ Real.log N := Real.log_nonneg (by norm_cast) ++ have fact0 {n : ℕ} (hn : n ≤ N) : n ≤ |t| := by linarith [(by exact_mod_cast hn : (n : ℝ) ≤ N)] ++ have fact1 {n : ℕ} (hn : n ≤ N) : ++ ‖(n : ℂ) ^ (-(σ + t * I))‖ ≤ (n : ℝ)⁻¹ * A.exp := ZetaBnd_aux2 hA.1 σPos (fact0 hn) σ_ge ++ have fact2 {n : ℕ} (hn : n ≤ N) : Real.log n ≤ Real.log |t| := by ++ cases n ++ · simp only [CharP.cast_eq_zero, Real.log_zero]; linarith ++ · exact Real.log_le_log (by exact_mod_cast Nat.add_one_pos _) (fact0 hn) ++ have fact3 (n : ℕ) (hn : n ≤ N) : ++ ‖-1 / (n : ℂ) ^ (σ + t * I) * (Real.log n)‖ ≤ (n : ℝ)⁻¹ * Real.exp A * (Real.log |t|) := by ++ convert! mul_le_mul (fact1 hn) (fact2 hn) (Real.log_natCast_nonneg n) (by positivity) ++ simp only [norm_mul, norm_div, norm_neg, norm_one, one_div, natCast_log, ← norm_inv, cpow_neg] ++ congr; exact norm_complex_log_ofNat n ++ have := norm_sum_le_of_le (Finset.range (N + 1)) ++ (by simp only [Finset.mem_range, Nat.lt_succ_iff]; exact fact3) ++ rw [← Finset.sum_mul, ← Finset.sum_mul, mul_comm _ A.exp, mul_assoc] at this ++ rw [mul_assoc] ++ apply le_trans this <| (mul_le_mul_iff_right₀ A.exp_pos).mpr ?_ ++ rw [pow_two, ← mul_assoc, Finset.range_eq_Ico, ← Finset.Icc_eq_Ico, harmonic_eq_sum_Icc0] ++ apply le_trans (mul_le_mul (h₁ := harmonic_le_one_add_log (n := N)) (le_refl (Real.log |t|)) ++ (by linarith) (by linarith)) ++ apply (mul_le_mul_iff_left₀ (by linarith)).mpr ++ rw [(by ring : C * Real.log |t| = Real.log |t| + (C - 1) * Real.log |t|), ++ ← one_mul <| Real.log (N: ℝ)] ++ refine add_le_add logt_gt.le <| mul_le_mul (by linarith) ?_ (by positivity) (by linarith) ++ exact Real.log_le_log (by positivity) N_le_t ++ ++lemma DerivUpperBnd_aux2 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : ++ let N := ⌊|t|⌋₊; ++ let s := ↑σ + ↑t * I; ++ 0 < N → ↑N ≤ |t| → s ≠ 1 → ++ 1 / 2 < σ → ‖-↑N ^ (1 - s) / (1 - s) ^ 2‖ ≤ A.exp * 2 * (1 / 3) := by ++ intro N s Npos N_le_t neOne σ_gt ++ dsimp only [s] ++ simp_rw [norm_div, norm_neg, norm_pow, norm_natCast_cpow_of_pos Npos _, ++ sub_re, one_re, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, ++ mul_one, sub_self, add_zero] ++ have h := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t |>.1 ++ rw [(by ring_nf : N ^ (1 - σ) / ‖1 - (↑σ + ↑t * I)‖ ^ 2 = ++ N ^ (1 - σ) / ‖1 - (↑σ + ↑t * I)‖ * 1 / ‖1 - (↑σ + ↑t * I)‖)] ++ apply mul_le_mul ?_ ?_ (inv_nonneg.mpr <| norm_nonneg _) ?_ ++ · rw [mul_one]; exact le_trans h (by gcongr; exact UpperBnd_aux2 t_gt hσ.1) ++ · rw [inv_eq_one_div, div_le_iff₀ <| norm_pos_iff.mpr <| sub_ne_zero_of_ne neOne.symm, ++ mul_comm, ← mul_div_assoc, mul_one, le_div_iff₀ (by norm_num), one_mul] ++ apply le_trans t_gt.le ?_ ++ rw [← abs_neg]; convert! abs_im_le_norm (1 - (σ + t * I)); simp ++ · exact mul_nonneg (Real.exp_nonneg _) (by norm_num) ++ ++theorem DerivUpperBnd_aux3 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : ++ let N := ⌊|t|⌋₊; ++ let s := ↑σ + ↑t * I; ++ 0 < N → ↑N ≤ |t| → s ≠ 1 → 1 / 2 < σ → ++ ‖↑(N : ℝ).log * ↑N ^ (1 - s) / (1 - s)‖ ≤ A.exp * 2 * |t|.log := by ++ intro N s Npos N_le_t neOne σ_gt ++ rw [norm_div, norm_mul, mul_div_assoc, mul_comm] ++ apply mul_le_mul ?_ ?_ (by positivity) (by positivity) ++ · have h := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t |>.1 ++ convert le_trans h ?_ using 1 ++ · simp [s, norm_natCast_cpow_of_pos Npos _, N] ++ · gcongr; exact UpperBnd_aux2 t_gt hσ.1 ++ · rw [natCast_log, norm_complex_log_ofNat] ++ exact Real.log_le_log (by positivity) N_le_t ++ ++theorem DerivUpperBnd_aux4 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : ++ let N := ⌊|t|⌋₊; ++ let s := ↑σ + ↑t * I; ++ 0 < N → ↑N ≤ |t| → s ≠ 1 → 1 / 2 < σ → ++ ‖↑(N : ℝ).log * (N : ℂ) ^ (-s) / 2‖ ≤ A.exp * |t|.log := by ++ intro N s Npos N_le_t neOne σ_gt ++ rw [norm_div, norm_mul, mul_div_assoc, mul_comm, RCLike.norm_ofNat] ++ apply mul_le_mul ?_ ?_ (by positivity) (by positivity) ++ · have h := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t |>.2.1 ++ convert le_trans h (UpperBnd_aux2 t_gt hσ.1) using 1 ++ simp [s, norm_natCast_cpow_of_pos Npos _, N] ++ · rw [natCast_log, norm_complex_log_ofNat] ++ exact Real.log_le_log (by positivity) N_le_t ++ ++theorem DerivUpperBnd_aux5 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : ++ let N := ⌊|t|⌋₊; ++ let s := ↑σ + ↑t * I; ++ 0 < N → 1 / 2 < σ → ++ ‖1 * ∫ (x : ℝ) in Ioi (N : ℝ), (↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1)‖ ≤ ++ 1 / 3 * (2 * |t| * ↑N ^ (-σ) / σ) := by ++ intro N s Npos σ_gt ++ have neZero : s ≠ 0 := by ++ contrapose! σ_gt ++ simp only [Complex.ext_iff, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, ++ sub_self, add_zero, zero_re, add_im, mul_im, zero_add, zero_im, s] at σ_gt ++ linarith ++ have : 1 = 1 / s * s := by field_simp ++ nth_rewrite 1 [this] ++ rw [mul_assoc, norm_mul] ++ apply mul_le_mul ?_ ?_ (by positivity) (by positivity) ++ · simp only [s, norm_div, norm_one] ++ apply one_div_le_one_div (norm_pos_iff.mpr neZero) (by norm_num) |>.mpr ++ apply le_trans t_gt.le ?_ ++ convert! abs_im_le_norm (σ + t * I); simp ++ · have hσ : σ ∈ Ioc 0 2 := ⟨(by linarith), hσ.2⟩ ++ simp only [s] ++ have := ZetaBnd_aux1 N (by omega) hσ (by linarith) ++ simp only [div_cpow_eq_cpow_neg] at this ++ convert! this using 1; congr; funext x; ring_nf ++ ++theorem DerivUpperBnd_aux6 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : ++ let N := ⌊|t|⌋₊; ++ 0 < N → ↑N ≤ |t| → ↑σ + ↑t * I ≠ 1 → 1 / 2 < σ → ++ 2 * |t| * ↑N ^ (-σ) / σ ≤ 2 * (8 * A.exp) := by ++ intro N Npos N_le_t neOne σ_gt ++ rw [mul_div_assoc, mul_assoc] ++ apply mul_le_mul_iff_right₀ (by norm_num) |>.mpr ++ have h := UpperBnd_aux6 t_gt ⟨σ_gt, hσ.2⟩ neOne Npos N_le_t |>.2.2 ++ apply le_trans (mul_le_mul_iff_right₀ (a := |t|) (by positivity) |>.mpr h) ?_ ++ rw [← mul_assoc, mul_comm _ 8, mul_assoc] ++ gcongr ++ convert! UpperBnd_aux2 t_gt hσ.1 using 1 ++ rw [mul_comm, ← Real.rpow_add_one (by positivity)]; ring_nf ++ ++lemma DerivUpperBnd_aux7_1 {x σ t : ℝ} (hx : 1 ≤ x) : ++ let s := ↑σ + ↑t * I; ++ ‖(↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1) * -↑x.log‖ = |(↑⌊x⌋ + 1 / 2 - x)| * x ^ (-σ - 1) * x.log := by ++ have xpos : 0 < x := lt_of_lt_of_le (by norm_num) hx ++ have : ‖(x.log : ℂ)‖ = x.log := Complex.norm_of_nonneg <| Real.log_nonneg hx ++ simp [← norm_real, this, Complex.norm_cpow_eq_rpow_re_of_pos xpos, ← Real.norm_eq_abs, ← ofReal_ofNat, ++ ← ofReal_inv, ← ofReal_add, ← ofReal_sub, ← ofReal_intCast, one_div] ++ ++lemma DerivUpperBnd_aux7_2 {x σ : ℝ} (hx : 1 ≤ x) : ++ |(↑⌊x⌋ + 1 / 2 - x)| * x ^ (-σ - 1) * x.log ≤ x ^ (-σ - 1) * x.log := by ++ rw [← one_mul (x ^ (-σ - 1) * Real.log x), mul_assoc] ++ apply mul_le_mul_of_nonneg_right _ (by bound) ++ exact le_trans (ZetaSum_aux1_3 x) (by norm_num) ++ ++lemma DerivUpperBnd_aux7_3 {x σ : ℝ} (xpos : 0 < x) (σnz : σ ≠ 0) : ++ HasDerivAt (fun t ↦ -(1 / σ ^ 2 * t ^ (-σ) + 1 / σ * t ^ (-σ) * Real.log t)) ++ (x ^ (-σ - 1) * Real.log x) x := by ++ have h1 := Real.hasDerivAt_rpow_const (p := -σ) (Or.inl xpos.ne.symm) ++ have h2 := h1.const_mul (1 / σ^2) ++ have cancel : 1 / σ^2 * σ = 1 / σ := by field_simp ++ rw [neg_mul, mul_neg, ← mul_assoc, cancel] at h2 ++ have h3 := Real.hasDerivAt_log xpos.ne.symm ++ have h4 := HasDerivAt.mul (h1.const_mul (1 / σ)) h3 ++ have cancel := Real.rpow_add xpos (-σ) (-1) ++ have : -σ + -1 = -σ - 1 := by rfl ++ rw [← Real.rpow_neg_one x, mul_assoc (1 / σ) (x ^ (-σ)), ← cancel, this] at h4 ++ convert! h2.add h4 |>.neg using 1 ++ field_simp; ring ++ ++lemma DerivUpperBnd_aux7_3' {a σ : ℝ} (apos : 0 < a) (σnz : σ ≠ 0) : ++ ∀ x ∈ Ici a, HasDerivAt (fun t ↦ -(1 / σ ^ 2 * t ^ (-σ) + 1 / σ * t ^ (-σ) * Real.log t)) ++ (x ^ (-σ - 1) * Real.log x) x := by ++ intro x hx ++ simp at hx ++ exact DerivUpperBnd_aux7_3 (by linarith) σnz ++ ++lemma DerivUpperBnd_aux7_nonneg {a σ : ℝ} (ha : 1 ≤ a) : ++ ∀ x ∈ Ioi a, 0 ≤ x ^ (-σ - 1) * Real.log x := by ++ intro x hx ++ simp at hx ++ bound ++ ++lemma DerivUpperBnd_aux7_tendsto {σ : ℝ} (σpos : 0 < σ) : ++ Tendsto (fun t ↦ -(1 / σ ^ 2 * t ^ (-σ) + 1 / σ * t ^ (-σ) * Real.log t)) atTop (nhds 0) := by ++ have h1 := tendsto_rpow_neg_atTop σpos ++ have h2 := h1.const_mul (1 / σ^2) ++ have h3 : Tendsto (fun t : ℝ ↦ t ^ (-σ) * Real.log t) atTop (nhds 0) := by ++ have := Real.tendsto_pow_log_div_pow_atTop σ 1 σpos ++ simp only [Real.rpow_one] at this ++ apply Tendsto.congr' _ this ++ filter_upwards [eventually_ge_atTop 0] with x hx ++ rw [mul_comm] ++ apply div_rpow_eq_rpow_neg _ _ _ hx ++ have h4 := h3.const_mul (1 / σ) ++ have h5 := (h2.add h4).neg ++ convert h5 using 1 ++ · ext; ring ++ simp ++ ++open MeasureTheory in ++lemma DerivUpperBnd_aux7_4 {a σ : ℝ} (σpos : 0 < σ) (ha : 1 ≤ a) : ++ IntegrableOn (fun x ↦ x ^ (-σ - 1) * Real.log x) (Ioi a) volume := by ++ apply integrableOn_Ioi_deriv_of_nonneg' (l := 0) ++ · exact DerivUpperBnd_aux7_3' (by linarith) (by linarith) ++ · exact DerivUpperBnd_aux7_nonneg ha ++ · exact DerivUpperBnd_aux7_tendsto σpos ++ ++open MeasureTheory in ++lemma DerivUpperBnd_aux7_5 {a σ : ℝ} (σpos : 0 < σ) (ha : 1 ≤ a) : ++ IntegrableOn (fun x ↦ |(↑⌊x⌋ + (1 : ℝ) / 2 - x)| * x ^ (-σ - 1) * Real.log x) ++ (Ioi a) volume := by ++ simp_rw [mul_assoc] ++ apply Integrable.bdd_mul (c := 1 / 2) <| DerivUpperBnd_aux7_4 σpos ha ++ · exact Measurable.aestronglyMeasurable <| Measurable.abs measurable_floor_add_half_sub ++ apply ae_of_all ++ intro x ++ simp only [Real.norm_eq_abs, _root_.abs_abs] ++ exact ZetaSum_aux1_3 x ++ ++open MeasureTheory in ++lemma DerivUpperBnd_aux7_integral_eq {a σ : ℝ} (ha : 1 ≤ a) (σpos : 0 < σ) : ++ ∫ (x : ℝ) in Ioi a, x ^ (-σ - 1) * Real.log x = ++ 1 / σ^2 * a ^ (-σ) + 1 / σ * a ^ (-σ) * Real.log a := by ++ convert integral_Ioi_of_hasDerivAt_of_nonneg' ++ (DerivUpperBnd_aux7_3' (by linarith) (by linarith)) ++ (DerivUpperBnd_aux7_nonneg ha) (DerivUpperBnd_aux7_tendsto σpos) using 1 ++ ring ++ ++open MeasureTheory in ++ ++theorem DerivUpperBnd_aux7 {A σ t : ℝ} (t_gt : 3 < |t|) (hσ : σ ∈ Icc (1 - A / |t|.log) 2) : ++ let N := ⌊|t|⌋₊; ++ let s := ↑σ + ↑t * I; ++ 0 < N → ↑N ≤ |t| → s ≠ 1 → 1 / 2 < σ → ++ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), (↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1) * -↑x.log‖ ≤ ++ 6 * |t| * ↑N ^ (-σ) / σ * |t|.log := by ++ intro N s Npos N_le_t neOne σ_gt ++ have σpos : 0 < σ := lt_trans (by norm_num) σ_gt ++ rw [norm_mul, (by ring : 6 * |t| * ↑N ^ (-σ) / σ * Real.log |t| = (2 * |t|) * (3 * ↑N ^ (-σ) / σ * Real.log |t|))] ++ apply mul_le_mul _ _ (by positivity) (by positivity) ++ · apply le_trans (by apply norm_add_le) ++ simp [abs_of_pos σpos] ++ linarith [hσ.2] ++ apply le_trans (by apply norm_integral_le_integral_norm) ++ calc ∫ (x : ℝ) in Ioi (N : ℝ), ‖(↑⌊x⌋ + 1 / 2 - ↑x) * (x : ℂ) ^ (-s - 1) * -↑x.log‖ ++ _ = ∫ (x : ℝ) in Ioi (N : ℝ), |(↑⌊x⌋ + 1 / 2 - x)| * x ^ (-σ - 1) * x.log := by ++ apply setIntegral_congr_fun (by measurability) ++ intro x hx ++ simp only [mem_Ioi] at hx ++ exact DerivUpperBnd_aux7_1 (lt_of_le_of_lt (mod_cast Npos) hx).le ++ _ ≤ ∫ (x : ℝ) in Ioi (N : ℝ), x ^ (-σ - 1) * x.log := by ++ apply setIntegral_mono_on _ _ (by measurability) ++ · intro x hx ++ exact DerivUpperBnd_aux7_2 (lt_of_le_of_lt (mod_cast Npos) hx).le ++ · apply DerivUpperBnd_aux7_5 σpos (mod_cast Npos) ++ apply DerivUpperBnd_aux7_4 σpos (mod_cast Npos) ++ _ = 1 / σ^2 * N ^ (-σ) + 1 / σ * N ^ (-σ) * Real.log N := ++ DerivUpperBnd_aux7_integral_eq (mod_cast Npos) σpos ++ _ ≤ 3 * ↑N ^ (-σ) / σ * |t|.log := by ++ have h2 : 1 / σ * ↑N ^ (-σ) * Real.log ↑N ≤ ↑N ^ (-σ) / σ * Real.log |t| := calc ++ _ = ↑N ^ (-σ) / σ * Real.log N := by ring ++ _ ≤ _ := by ++ apply mul_le_mul_of_nonneg_left _ (by positivity) ++ exact Real.log_le_log (mod_cast Npos) N_le_t ++ have : 2 ≤ 2 * Real.log |t| := by ++ nth_rewrite 1 [← mul_one 2] ++ apply mul_le_mul_of_nonneg_left _ (by norm_num) ++ exact logt_gt_one t_gt.le |>.le ++ have h1 : 1 / σ^2 * ↑N ^ (-σ) ≤ 2 * ↑N ^ (-σ) / σ * Real.log |t| := calc ++ 1 / σ^2 * ↑N ^ (-σ) = (↑N ^ (-σ) / σ) * (1 / σ) := by ring ++ _ ≤ ↑N ^ (-σ) / σ * (2 * Real.log |t|):= by ++ apply mul_le_mul_of_nonneg_left _ (by positivity) ++ apply le_trans _ this ++ exact (one_div_le σpos (by norm_num)).mpr σ_gt.le ++ _ = _ := by ring ++ convert! add_le_add h1 h2 using 1 ++ ring ++ ++lemma ZetaDerivUpperBnd' {A σ t : ℝ} (hA : A ∈ Ioc 0 (1 / 2)) (t_gt : 3 < |t|) ++ (hσ : σ ∈ Icc (1 - A / Real.log |t|) 2) : ++ let C := Real.exp A * 59; ++ let N := ⌊|t|⌋₊; ++ let s := σ + t * I; ++ ‖∑ n ∈ Finset.range (N + 1), -1 / (n : ℂ) ^ s * (Real.log n)‖ + ++ ‖-(N : ℂ) ^ (1 - s) / (1 - s) ^ 2‖ + ++ ‖(Real.log N) * (N : ℂ) ^ (1 - s) / (1 - s)‖ + ++ ‖(Real.log N) * (N : ℂ) ^ (-s) / 2‖ + ++ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + ++ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), ++ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ ++ ≤ C * Real.log |t| ^ 2 := by ++ intros C N s ++ obtain ⟨Npos, N_le_t, logt_gt, σ_gt, _, neOne⟩ := UpperBnd_aux hA t_gt hσ.1 ++ replace σ_gt : 1 / 2 < σ := by linarith [hA.2] ++ calc _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ++ ‖-(N : ℂ) ^ (1 - s) / (1 - s) ^ 2‖ + ++ ‖(Real.log N) * (N : ℂ) ^ (1 - s) / (1 - s)‖ + ++ ‖(Real.log N) * (N : ℂ) ^ (-s) / 2‖ + ++ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + ++ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), ++ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by ++ gcongr; exact DerivUpperBnd_aux1 hA hσ.1 t_gt (by simp : (2 : ℝ) ≤ 2) ++ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ++ Real.exp A * 2 * (1 / 3) + ++ ‖(Real.log N) * (N : ℂ) ^ (1 - s) / (1 - s)‖ + ++ ‖(Real.log N) * (N : ℂ) ^ (-s) / 2‖ + ++ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + ++ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), ++ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by ++ gcongr; exact DerivUpperBnd_aux2 t_gt hσ Npos N_le_t neOne σ_gt ++ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ++ Real.exp A * 2 * (1 / 3) + ++ Real.exp A * 2 * (Real.log |t|) + ++ ‖(Real.log N) * (N : ℂ) ^ (-s) / 2‖ + ++ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + ++ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), ++ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by ++ gcongr; exact DerivUpperBnd_aux3 t_gt hσ Npos N_le_t neOne σ_gt ++ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ++ Real.exp A * 2 * (1 / 3) + ++ Real.exp A * 2 * (Real.log |t|) + ++ Real.exp A * (Real.log |t|) + ++ ‖(1 * ∫ (x : ℝ) in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1))‖ + ++ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), ++ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by ++ gcongr; exact DerivUpperBnd_aux4 t_gt hσ Npos N_le_t neOne σ_gt ++ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ++ Real.exp A * 2 * (1 / 3) + ++ Real.exp A * 2 * (Real.log |t|) + ++ Real.exp A * (Real.log |t|) + ++ 1 / 3 * (2 * |t| * N ^ (-σ) / σ) + ++ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), ++ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by ++ gcongr; exact DerivUpperBnd_aux5 t_gt hσ Npos σ_gt ++ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ++ Real.exp A * 2 * (1 / 3) + ++ Real.exp A * 2 * (Real.log |t|) + ++ Real.exp A * (Real.log |t|) + ++ 1 / 3 * (2 * (8 * Real.exp A)) + ++ ‖s * ∫ (x : ℝ) in Ioi (N : ℝ), ++ (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-s - 1) * -(Real.log x)‖ := by ++ gcongr; exact DerivUpperBnd_aux6 t_gt hσ Npos N_le_t neOne σ_gt ++ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ++ Real.exp A * 2 * (1 / 3) + ++ Real.exp A * 2 * (Real.log |t|) + ++ Real.exp A * (Real.log |t|) + ++ 1 / 3 * (2 * (8 * Real.exp A)) + ++ (6 * |t| * N ^ (-σ) / σ) * (Real.log |t|) := by ++ gcongr; exact DerivUpperBnd_aux7 t_gt hσ Npos N_le_t neOne σ_gt ++ _ ≤ Real.exp A * 2 * (Real.log |t|) ^ 2 + ++ Real.exp A * 2 * (1 / 3) + ++ Real.exp A * 2 * (Real.log |t|) + ++ Real.exp A * (Real.log |t|) + ++ 1 / 3 * (2 * (8 * Real.exp A)) + ++ (6 * (8 * Real.exp A)) * (Real.log |t|) := by ++ gcongr; convert mul_le_mul_of_nonneg_left (DerivUpperBnd_aux6 t_gt hσ Npos N_le_t neOne σ_gt) (by norm_num : (0 : ℝ) ≤ 3) using 1 <;> ring ++ _ ≤ _ := by ++ simp only [C] ++ ring_nf ++ rw [(by ring : A.exp * |t|.log ^ 2 * 59 = A.exp * |t|.log ^ 2 * 6 + A.exp * |t|.log ^ 2 * 51 + ++ A.exp * |t|.log ^ 2 * 2)] ++ nth_rewrite 1 [← mul_one A.exp] ++ gcongr ++ swap ++ · nth_rewrite 1 [← mul_one |t|.log, (by ring : |t|.log ^ 2 = |t|.log * |t|.log)] ++ gcongr ++ nlinarith ++ ++lemma ZetaDerivUpperBnd : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Icc (1 - A / Real.log |t|) 2), ++ ‖ζ' (σ + t * I)‖ ≤ C * Real.log |t| ^ 2 := by ++ obtain ⟨A, hA, _, _, _⟩ := ZetaUpperBnd ++ let C := Real.exp A * 59 ++ refine ⟨A, hA, C, by positivity, ?_⟩ ++ intro σ t t_gt ⟨σ_ge, σ_le⟩ ++ obtain ⟨Npos, N_le_t, _, _, σPos, neOne⟩ := UpperBnd_aux hA t_gt σ_ge ++ rw [← DerivZeta0EqDerivZeta Npos (by simp [σPos]) neOne] ++ set N : ℕ := ⌊|t|⌋₊ ++ rw [(HasDerivAtZeta0 Npos (s := σ + t * I) (by simp [σPos]) neOne).deriv] ++ dsimp only [ζ₀'] ++ rw [← add_assoc] ++ set aa := ∑ n ∈ Finset.range (N + 1), -1 / (n : ℂ) ^ (σ + t * I) * (Real.log n) ++ set bb := -(N : ℂ) ^ (1 - (σ + t * I)) / (1 - (σ + t * I)) ^ 2 ++ set cc := (Real.log N) * (N : ℂ) ^ (1 - (σ + t * I)) / (1 - (σ + t * I)) ++ set dd := (Real.log N) * (N : ℂ) ^ (-(σ + t * I)) / 2 ++ set ee := 1 * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(σ + t * I) - 1) ++ set ff := (σ + t * I) * ∫ x in Ioi (N : ℝ), (⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-(σ + t * I) - 1) * -(Real.log x) ++ rw [(by ring : aa + (bb + cc) + dd + ee + ff = aa + bb + cc + dd + ee + ff)] ++ apply le_trans (by apply norm_add₆_le) ?_ ++ convert ZetaDerivUpperBnd' hA t_gt ⟨σ_ge, σ_le⟩ ++ ++lemma Tendsto_nhdsWithin_punctured_map_add {f : ℝ → ℝ} (a x : ℝ) ++ (f_mono : StrictMono f) (f_iso : Isometry f) : ++ Tendsto (fun y ↦ f y + a) (𝓝[>] x) (𝓝[>] (f x + a)) := by ++ refine tendsto_iff_forall_eventually_mem.mpr ?_ ++ intro v hv ++ simp only [mem_nhdsWithin] at hv ++ obtain ⟨u, hu, hu2, hu3⟩ := hv ++ let t := {x | f x + a ∈ u} ++ have : t ∩ Ioi x ∈ 𝓝[>] x := by ++ simp only [mem_nhdsWithin] ++ use t ++ simp only [subset_inter_iff, inter_subset_left, inter_subset_right, and_self, ++ and_true, t, mem_ofPred_eq] ++ refine ⟨?_, by simp [hu2]⟩ ++ simp only [Metric.isOpen_iff, gt_iff_lt, mem_ofPred_eq] at hu ⊢ ++ intro x hx ++ obtain ⟨ε, εpos, hε⟩ := hu (f x + a) hx ++ simp only [Metric.ball, ofPred_subset_ofPred] at hε ⊢ ++ exact ⟨ε, εpos, fun _ hy ↦ hε (by simp [isometry_iff_dist_eq.mp f_iso, hy])⟩ ++ filter_upwards [this] ++ intro b hb ++ simp only [mem_inter_iff, mem_ofPred_eq, mem_Ioi, t] at hb ++ refine hu3 ?_ ++ simp only [mem_inter_iff, mem_Ioi, add_lt_add_iff_right] ++ exact ⟨hb.1, f_mono hb.2⟩ ++ ++lemma Tendsto_nhdsWithin_punctured_add (a x : ℝ) : ++ Tendsto (fun y ↦ y + a) (𝓝[>] x) (𝓝[>] (x + a)) := ++ Tendsto_nhdsWithin_punctured_map_add a x strictMono_id isometry_id ++ ++lemma riemannZeta_isBigO_near_one_horizontal : ++ (fun x : ℝ ↦ ζ (1 + x)) =O[𝓝[>] 0] (fun x ↦ (1 : ℂ) / x) := by ++ have : (fun w : ℂ ↦ ζ (1 + w)) =O[𝓝[≠] 0] (1 / ·) := by ++ have H : Tendsto (fun w ↦ w * ζ (1 + w)) (𝓝[≠] 0) (𝓝 1) := by ++ convert Tendsto.comp (f := fun w ↦ 1 + w) riemannZeta_residue_one ?_ using 1 ++ · ext w ++ simp only [Function.comp_apply, add_sub_cancel_left] ++ · refine tendsto_iff_comap.mpr <| map_le_iff_le_comap.mp <| Eq.le ?_ ++ convert Homeomorph.map_punctured_nhds_eq (Homeomorph.addLeft (1 : ℂ)) 0 using 2 <;> simp ++ exact ((Asymptotics.isBigO_mul_iff_isBigO_div eventually_mem_nhdsWithin).mp <| ++ Tendsto.isBigO_one ℂ H).trans <| Asymptotics.isBigO_refl .. ++ exact (isBigO_comp_ofReal_nhds_ne this).mono <| nhdsGT_le_nhdsNE 0 ++ ++lemma ZetaNear1BndFilter : ++ (fun σ : ℝ ↦ ζ σ) =O[𝓝[>](1 : ℝ)] (fun σ ↦ (1 : ℂ) / (σ - 1)) := by ++ have := Tendsto_nhdsWithin_punctured_add (a := -1) (x := 1) ++ simp only [add_neg_cancel, ← sub_eq_add_neg] at this ++ have := riemannZeta_isBigO_near_one_horizontal.comp_tendsto this ++ convert this using 1 <;> {ext; simp} ++ ++lemma ZetaNear1BndExact : ++ ∃ (c : ℝ) (_ : 0 < c), ∀ (σ : ℝ) (_ : σ ∈ Ioc 1 2), ‖ζ σ‖ ≤ c / (σ - 1) := by ++ have := ZetaNear1BndFilter ++ rw [Asymptotics.isBigO_iff] at this ++ obtain ⟨c, U, hU, V, hV, h⟩ := this ++ obtain ⟨T, hT, T_open, h1T⟩ := mem_nhds_iff.mp hU ++ obtain ⟨ε, εpos, hε⟩ := Metric.isOpen_iff.mp T_open 1 h1T ++ simp only [Metric.ball] at hε ++ replace hε : Ico 1 (1 + ε) ⊆ U := by ++ refine subset_trans (subset_trans ?_ hε) hT ++ intro x hx ++ simp only [mem_Ico] at hx ++ simp only [dist, abs_lt] ++ exact ⟨by linarith, by linarith⟩ ++ let W := Icc (1 + ε) 2 ++ have W_compact : IsCompact {ofReal z | z ∈ W} := ++ IsCompact.image isCompact_Icc continuous_ofReal ++ have cont : ContinuousOn ζ {ofReal z | z ∈ W} := by ++ apply HasDerivAt.continuousOn (f' := ζ') ++ intro σ hσ ++ exact (differentiableAt_riemannZeta (by contrapose! hσ; simp [W, hσ, εpos])).hasDerivAt ++ obtain ⟨C, hC⟩ := IsCompact.exists_bound_of_continuousOn W_compact cont ++ let C' := max (C + 1) 1 ++ replace hC : ∀ (σ : ℝ), σ ∈ W → ‖ζ σ‖ < C' := by ++ intro σ hσ ++ simp only [lt_max_iff, C'] ++ have := hC σ ++ simp only [mem_ofPred_eq, ofReal_inj, exists_eq_right] at this ++ exact Or.inl <| lt_of_le_of_lt (this hσ) (by norm_num) ++ have Cpos : 0 < C' := by simp [C'] ++ use max (2 * C') c, (by simp [Cpos]) ++ intro σ ⟨σ_ge, σ_le⟩ ++ by_cases hσ : σ ∈ U ∩ V ++ · simp only [← h, mem_ofPred_eq] at hσ ++ apply le_trans hσ ?_ ++ norm_cast ++ have : 0 ≤ 1 / (σ - 1) := by apply one_div_nonneg.mpr; linarith ++ simp only [Real.norm_eq_abs, abs_eq_self.mpr this, mul_div, mul_one] ++ exact div_le_div₀ (by simp [Cpos.le]) (by simp) (by linarith) (by rfl) ++ · replace hσ : σ ∈ W := by ++ simp only [mem_inter_iff, hV σ_ge, and_true] at hσ ++ simp only [mem_Icc, σ_le, and_true, W] ++ contrapose! hσ; exact hε ⟨σ_ge.le, hσ⟩ ++ apply le_trans (hC σ hσ).le ((le_div_iff₀ (by linarith)).mpr ?_) ++ rw [le_max_iff, mul_comm 2]; exact Or.inl <| mul_le_mul_of_nonneg_left (by linarith) Cpos.le ++ ++lemma norm_zeta_product_ge_one {x : ℝ} (hx : 0 < x) (y : ℝ) : ++ ‖ζ (1 + x) ^ 3 * ζ (1 + x + I * y) ^ 4 * ζ (1 + x + 2 * I * y)‖ ≥ 1 := by ++ have h₀ : 1 < ( 1 + x : ℂ).re := by simp[hx] ++ have h₁ : 1 < (1 + x + I * y).re := by simp [hx] ++ have h₂ : 1 < (1 + x + 2 * I * y).re := by simp [hx] ++ simpa only [one_pow, norm_mul, norm_pow, DirichletCharacter.LSeries_modOne_eq, ++ LSeries_one_eq_riemannZeta, h₀, h₁, h₂] using ++ DirichletCharacter.norm_LSeries_product_ge_one (1 : DirichletCharacter ℂ 1) hx y ++ ++theorem ZetaLowerBound1_aux1 {σ t : ℝ} (this : 1 ≤ ‖ζ σ‖ ^ (3 : ℝ) * ‖ζ (σ + I * t)‖ ^ (4 : ℝ) * ‖ζ (σ + 2 * I * t)‖) : ++ ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) * ‖ζ (σ + t * I)‖ ≥ 1 := by ++ use (one_le_pow_iff_of_nonneg (by bound) four_ne_zero).1 (by_contra (this.not_gt ∘ ?_)) ++ simp_rw [mul_pow, ← Real.rpow_natCast, ← Real.rpow_mul (norm_nonneg _)] ++ norm_num [mul_right_comm, mul_comm (t : ℂ), mul_pow] ++ ++lemma ZetaLowerBound1 {σ t : ℝ} (σ_gt : 1 < σ) : ++ ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) * ‖ζ (σ + t * I)‖ ≥ 1 := by ++ ++ have := norm_zeta_product_ge_one (x := σ - 1) (by linarith) t ++ simp_rw [ge_iff_le, norm_mul, norm_pow, ofReal_sub, ofReal_one, add_sub_cancel, ← Real.rpow_natCast] ++ at this ++ apply ZetaLowerBound1_aux1 this ++ ++lemma ZetaLowerBound2 {σ t : ℝ} (σ_gt : 1 < σ) : ++ 1 / (‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4)) ≤ ‖ζ (σ + t * I)‖ := by ++ have := ZetaLowerBound1 (t := t) σ_gt ++ exact (div_le_iff₀' (pos_of_mul_pos_left (one_pos.trans_le this) (norm_nonneg _) ) ).mpr this ++ ++theorem ZetaLowerBound3_aux1 (A : ℝ) (ha : A ∈ Ioc 0 (1 / 2)) (t : ℝ) ++ (ht_2 : 3 < |2 * t|) : 0 < A / Real.log |2 * t| := by ++ exact div_pos ha.1 <| Real.log_pos (by linarith) ++ ++theorem ZetaLowerBound3_aux2 {C : ℝ} ++ {σ t : ℝ} ++ (ζ_2t_bound : ‖ζ (σ + (2 * t) * I)‖ ≤ C * Real.log |2 * t|) : ++ ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) ≤ (C * Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by ++ bound ++ ++theorem ZetaLowerBound3_aux3 (C : ℝ) (c_near : ℝ) {σ : ℝ} (t : ℝ) (σ_gt : 1 < σ) : ++ c_near ^ ((3 : ℝ) / 4) * ((-1 + σ) ^ ((3 : ℝ) / 4))⁻¹ * C ^ ((1 : ℝ) / 4) * Real.log |t * 2| ^ ((1 : ℝ) / 4) = ++ c_near ^ ((3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * Real.log |t * 2| ^ ((1 : ℝ) / 4) * (-1 + σ) ^ (-(3 : ℝ) / 4) := by ++ exact (symm) (.trans (by rw [neg_div, Real.rpow_neg (by linarith)]) (by ring)) ++ ++theorem ZetaLowerBound3_aux4 (C : ℝ) (hC : 0 < C) ++ (c_near : ℝ) (hc_near : 0 < c_near) {σ : ℝ} (t : ℝ) (ht : 3 < |t|) ++ (σ_gt : 1 < σ) ++ : ++ 0 < c_near ^ ((3 : ℝ) / 4) * (σ - 1) ^ (-(3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * Real.log |2 * t| ^ ((1 : ℝ) / 4) := by ++ match sub_pos.mpr σ_gt with | S => match Real.log_pos (by simp; linarith : abs (2 *t) > 1) with | S => positivity ++ ++theorem ZetaLowerBound3_aux5 ++ {σ : ℝ} (t : ℝ) ++ (this : ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) * ‖ζ (σ + t * I)‖ ≥ 1) : ++ 0 < ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) := ++ pos_of_mul_pos_left (this.trans_lt' zero_lt_one) (norm_nonneg _) ++ ++lemma ZetaLowerBound3 : ++ ∃ c > 0, ∀ {σ : ℝ} (_ : σ ∈ Ioc 1 2) (t : ℝ) (_ : 3 < |t|), ++ c * (σ - 1) ^ ((3 : ℝ) / 4) / (Real.log |t|) ^ ((1 : ℝ) / 4) ≤ ‖ζ (σ + t * I)‖ := by ++ obtain ⟨A, ha, C, hC, h_upper⟩ := ZetaUpperBnd ++ obtain ⟨c_near, hc_near, h_near⟩ := ZetaNear1BndExact ++ ++ use 1 / (c_near ^ ((3 : ℝ) / 4) * (2 * C) ^ ((1 : ℝ) / 4)), by positivity ++ intro σ hσ t ht ++ obtain ⟨σ_gt, σ_le⟩ := hσ ++ ++ have lower := ZetaLowerBound2 (t := t) σ_gt ++ apply le_trans _ lower ++ ++ have ζ_σ_bound : ‖ζ σ‖ ≤ c_near / (σ - 1) := by ++ exact h_near σ ⟨σ_gt, σ_le⟩ ++ ++ have ht_2 : 3 < |2 * t| := by simp only [abs_mul, Nat.abs_ofNat]; linarith ++ ++ have σ_in_range : σ ∈ Icc (1 - A / Real.log |2 * t|) 2 := by ++ constructor ++ · ++ have : 0 < A / Real.log |2 * t| := by ++ exact ZetaLowerBound3_aux1 A ha t ht_2 ++ nlinarith ++ · exact σ_le ++ ++ have ζ_2t_bound := h_upper σ (2 * t) ht_2 σ_in_range ++ ++ have denom_bound : ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) ≤ ++ (c_near / (σ - 1)) ^ ((3 : ℝ) / 4) * (C * Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by ++ apply mul_le_mul ++ · apply Real.rpow_le_rpow (norm_nonneg _) ζ_σ_bound (by norm_num) ++ · apply ZetaLowerBound3_aux2 ++ convert ζ_2t_bound ++ norm_cast ++ · apply Real.rpow_nonneg (norm_nonneg _) ++ · apply Real.rpow_nonneg (div_nonneg (by linarith) (by linarith)) ++ ++ have : (c_near / (σ - 1)) ^ ((3 : ℝ) / 4) * (C * Real.log |2 * t|) ^ ((1 : ℝ) / 4) = ++ c_near ^ ((3 : ℝ) / 4) * (σ - 1) ^ (-(3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * (Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by ++ rw [Real.div_rpow (by linarith) (by linarith), Real.mul_rpow (by linarith) (Real.log_nonneg (by linarith))] ++ ring_nf ++ exact ZetaLowerBound3_aux3 _ _ _ σ_gt ++ rw [this] at denom_bound ++ ++ have pos_left : 0 < c_near ^ ((3 : ℝ) / 4) * (σ - 1) ^ (-(3 : ℝ) / 4) * C ^ ((1 : ℝ) / 4) * (Real.log |2 * t|) ^ ((1 : ℝ) / 4) := by ++ apply ZetaLowerBound3_aux4 C hC c_near hc_near t ht σ_gt ++ ++ have pos_right : 0 < ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) := by ++ ++ apply ZetaLowerBound3_aux5 _ <| ZetaLowerBound1 (t := t) σ_gt ++ ++ use (div_le_div_of_nonneg_left zero_le_one pos_right denom_bound).trans' ?_ ++ simp_rw [abs_mul, abs_two, neg_div, Real.rpow_neg (sub_pos.2 σ_gt).le] at * ++ have hlog : 0 < Real.log |t| := Real.log_pos <| ht.trans' <| by norm_num ++ have : 0 < Real.log |t| ^ (1 / 4 : ℝ) := Real.rpow_pos_of_pos hlog _ ++ have hlog2 : 0 < Real.log (2 * |t|) := Real.log_pos <| ht_2.trans' <| by norm_num ++ have : 0 < Real.log (2 * |t|) ^ (1 / 4 : ℝ) := Real.rpow_pos_of_pos hlog2 (1 / 4) ++ field_simp ++ rw [Real.mul_rpow two_pos.le hC.le] ++ move_mul [C ^ (1 / 4)] ++ rw [mul_le_mul_iff_left₀] ++ swap ++ · positivity ++ rw [← Real.mul_rpow two_pos.le hlog.le] ++ apply Real.rpow_le_rpow hlog2.le ?_ (by norm_num) ++ rw [← Real.log_rpow (ht.trans' (by norm_num))] ++ apply Real.log_le_log (ht_2.trans' (by norm_num)) ++ rw [Real.rpow_two, sq] ++ gcongr ++ exact ht.trans' (by norm_num) |>.le ++ ++lemma ZetaInvBound1 {σ t : ℝ} (σ_gt : 1 < σ) : ++ 1 / ‖ζ (σ + t * I)‖ ≤ ‖ζ σ‖ ^ ((3 : ℝ) / 4) * ‖ζ (σ + 2 * t * I)‖ ^ ((1 : ℝ) / 4) := by ++ apply (div_le_iff₀ ?_).mpr ++ · apply (Real.rpow_le_rpow_iff (z := 4) (by norm_num) ?_ (by norm_num)).mp ++ · simp only [Real.one_rpow] ++ rw [Real.mul_rpow, Real.mul_rpow, ← Real.rpow_mul, ← Real.rpow_mul] ++ · simp only [isUnit_iff_ne_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, ++ IsUnit.div_mul_cancel, Real.rpow_one] ++ conv => rw [mul_assoc]; rhs; rhs; rw [mul_comm] ++ rw [← mul_assoc] ++ have := norm_zeta_product_ge_one (x := σ - 1) (by linarith) t ++ simp_rw [ge_iff_le, norm_mul, norm_pow, ofReal_sub, ofReal_one, add_sub_cancel, ← Real.rpow_natCast] at this ++ convert this using 3 <;> ring_nf ++ any_goals ring_nf ++ any_goals apply norm_nonneg ++ any_goals apply Real.rpow_nonneg <| norm_nonneg _ ++ apply mul_nonneg <;> apply Real.rpow_nonneg <| norm_nonneg _ ++ · refine mul_nonneg (mul_nonneg ?_ ?_) ?_ <;> simp [Real.rpow_nonneg] ++ · have s_ne_one : σ + t * I ≠ 1 := by ++ contrapose! σ_gt; apply le_of_eq; apply And.left; simpa [Complex.ext_iff] using σ_gt ++ simpa using riemannZeta_ne_zero_of_one_le_re (by simp [σ_gt.le]) ++ ++lemma Ioi_union_Iio_mem_cocompact {a : ℝ} (ha : 0 ≤ a) : Ioi (a : ℝ) ∪ Iio (-a : ℝ) ∈ cocompact ℝ := by ++ simp only [Filter.mem_cocompact] ++ use Icc (-a) a ++ constructor ++ · exact isCompact_Icc ++ · rw [@compl_subset_iff_union, ← union_assoc, Icc_union_Ioi_eq_Ici, union_comm, Iio_union_Ici] ++ linarith ++ ++lemma lt_abs_mem_cocompact {a : ℝ} (ha : 0 ≤ a) : {t | a < |t|} ∈ cocompact ℝ := by ++ convert Ioi_union_Iio_mem_cocompact ha using 1; ext t ++ simp only [mem_ofPred_eq, mem_union, mem_Ioi, mem_Iio, lt_abs, lt_neg] ++ ++lemma ZetaInvBound2 : ++ ∃ C > 0, ∀ {σ : ℝ} (_ : σ ∈ Ioc 1 2) (t : ℝ) (_ : 3 < |t|), ++ 1 / ‖ζ (σ + t * I)‖ ≤ C * (σ - 1) ^ (-(3 : ℝ) / 4) * (Real.log |t|) ^ ((1 : ℝ) / 4) := by ++ obtain ⟨A, ha, C, hC, h⟩ := ZetaUpperBnd ++ obtain ⟨c, hc, h_inv⟩ := ZetaNear1BndExact ++ refine ⟨(2 * C) ^ ((1 : ℝ)/ 4) * c ^ ((3 : ℝ)/ 4), by positivity, ?_⟩ ++ intro σ hσ t t_gt ++ obtain ⟨σ_gt, σ_le⟩ := hσ ++ have ht' : 3 < |2 * t| := by simp only [abs_mul, Nat.abs_ofNat]; linarith ++ have hnezero: ((σ - 1) / c) ^ (-3 / 4 : ℝ) ≠ 0 := by ++ have : (σ - 1) / c ≠ 0 := ne_of_gt <| div_pos (by linarith) hc ++ contrapose! this ++ rwa [Real.rpow_eq_zero (div_nonneg (by linarith) hc.le) (by norm_num)] at this ++ calc ++ _ ≤ ‖‖ζ σ‖ ^ (3 / 4 : ℝ) * ‖ζ (↑σ + 2 * ↑t * I)‖ ^ (1 / 4 : ℝ)‖ := ?_ ++ _ ≤ ‖((σ - 1) / c) ^ (-3 / 4 : ℝ) * ‖ζ (↑σ + 2 * ↑t * I)‖ ^ (1 / 4 : ℝ)‖ := ?_ ++ _ ≤ ‖((σ - 1) / c) ^ (-3 / 4 : ℝ) * C ^ (1 / 4 : ℝ) * (Real.log |2 * t|) ^ (1 / 4 : ℝ)‖ := ?_ ++ _ ≤ ‖((σ - 1) / c) ^ (-3 / 4 : ℝ) * C ^ (1 / 4 : ℝ) * (Real.log (|t| ^ 2)) ^ (1 / 4 : ℝ)‖ := ?_ ++ _ = ‖((σ - 1)) ^ (-3 / 4 : ℝ) * c ^ (3 / 4 : ℝ) * (C ^ (1 / 4 : ℝ) * (Real.log (|t| ^ 2)) ^ (1 / 4 : ℝ))‖ := ?_ ++ _ = ‖((σ - 1)) ^ (-3 / 4 : ℝ) * c ^ (3 / 4 : ℝ) * ((2 * C) ^ (1 / 4 : ℝ) * Real.log |t| ^ (1 / 4 : ℝ))‖ := ?_ ++ _ = _ := ?_ ++ · simp only [norm_mul] ++ convert ZetaInvBound1 σ_gt using 2 ++ <;> exact abs_eq_self.mpr <| Real.rpow_nonneg (norm_nonneg _) _ ++ · have bnd1: ‖ζ σ‖ ^ (3 / 4 : ℝ) ≤ ((σ - 1) / c) ^ (-(3 : ℝ) / 4) := by ++ have : ((σ - 1) / c) ^ (-(3 : ℝ) / 4) = (((σ - 1) / c) ^ (-1 : ℝ)) ^ (3 / 4 : ℝ) := by ++ rw [← Real.rpow_mul ?_] ++ · ring_nf ++ · exact div_nonneg (by linarith) hc.le ++ rw [this] ++ apply Real.rpow_le_rpow (by simp [norm_nonneg]) ?_ (by norm_num) ++ convert! h_inv σ ⟨σ_gt, σ_le⟩ using 1; simp [Real.rpow_neg_one, inv_div] ++ simp only [norm_mul] ++ apply (mul_le_mul_iff_left₀ ?_).mpr ++ · convert! bnd1 using 1 ++ · exact abs_eq_self.mpr <| Real.rpow_nonneg (norm_nonneg _) _ ++ · exact abs_eq_self.mpr <| Real.rpow_nonneg (div_nonneg (by linarith) hc.le) _ ++ · apply lt_iff_le_and_ne.mpr ⟨(by simp), ?_⟩ ++ have : ζ (↑σ + 2 * ↑t * I) ≠ 0 := by ++ apply riemannZeta_ne_zero_of_one_le_re (by simp [σ_gt.le]) ++ symm; exact fun h2 ↦ this (by simpa using h2) ++ · replace h := h σ (2 * t) (by simpa using ht') ⟨?_, σ_le⟩ ++ · have : 0 ≤ Real.log |2 * t| := Real.log_nonneg (by linarith) ++ conv => rhs; rw [mul_assoc, ← Real.mul_rpow hC.le this] ++ rw [norm_mul, norm_mul] ++ conv => rhs; rhs; rw [Real.norm_rpow_of_nonneg <| mul_nonneg hC.le this] ++ conv => lhs; rhs; rw [Real.norm_rpow_of_nonneg <| norm_nonneg _] ++ apply (mul_le_mul_iff_right₀ ?_).mpr ++ · apply Real.rpow_le_rpow (norm_nonneg _) ?_ (by norm_num) ++ convert h using 1 ++ · simp ++ · rw [Real.norm_eq_abs, abs_eq_self.mpr <| mul_nonneg hC.le this] ++ · simpa only [Real.norm_eq_abs, abs_pos] ++ · linarith [(div_nonneg ha.1.le (Real.log_nonneg (by linarith)) : 0 ≤ A / Real.log |2 * t|)] ++ · simp only [Real.log_abs, norm_mul] ++ apply (mul_le_mul_iff_right₀ ?_).mpr ++ · rw [← Real.log_abs, Real.norm_rpow_of_nonneg <| Real.log_nonneg (by linarith)] ++ have : 1 ≤ |(|t| ^ 2)| := by ++ simp only [_root_.sq_abs, _root_.abs_pow, one_le_sq_iff_one_le_abs] ++ linarith ++ conv => rhs; rw [← Real.log_abs, Real.norm_rpow_of_nonneg <| Real.log_nonneg this] ++ apply Real.rpow_le_rpow (abs_nonneg _) ?_ (by norm_num) ++ · rw [Real.norm_eq_abs, abs_eq_self.mpr <| Real.log_nonneg (by linarith)] ++ rw [abs_eq_self.mpr <| Real.log_nonneg this, abs_mul, Real.log_abs, Nat.abs_ofNat] ++ apply Real.log_le_log (mul_pos (by norm_num) (by linarith)) (by nlinarith) ++ · apply mul_pos (abs_pos.mpr hnezero) (abs_pos.mpr ?_) ++ have : C ≠ 0 := ne_of_gt hC ++ contrapose! this; rwa [Real.rpow_eq_zero (by linarith) (by norm_num)] at this ++ · have : (-3 : ℝ) / 4 = -((3 : ℝ)/ 4) := by norm_num ++ simp only [norm_mul, mul_eq_mul_right_iff, this, ← mul_assoc]; left; left ++ conv => lhs; rw [Real.div_rpow (by linarith) hc.le, Real.rpow_neg hc.le, div_inv_eq_mul, norm_mul] ++ · simp only [Real.log_pow, Nat.cast_ofNat, norm_mul, Real.norm_eq_abs] ++ congr! 1 ++ rw [Real.mul_rpow (by norm_num) hC.le, Real.mul_rpow (by norm_num) <| ++ Real.log_nonneg (by linarith), abs_mul, abs_mul, ← mul_assoc, mul_comm _ |2 ^ (1 / 4)|] ++ · simp only [norm_mul, Real.norm_eq_abs] ++ have : (2 * C) ^ ((1 : ℝ)/ 4) * c ^ ((3 : ℝ)/ 4) = ++ |(2 * C) ^ ((1 : ℝ)/ 4) * c ^ ((3 : ℝ)/ 4)| := by ++ rw [abs_eq_self.mpr (by apply mul_nonneg <;> (apply Real.rpow_nonneg; linarith))] ++ rw [this, abs_mul, abs_eq_self.mpr (by apply Real.rpow_nonneg; linarith), abs_eq_self.mpr (by positivity), ++ abs_eq_self.mpr (by positivity), abs_eq_self.mpr (by apply Real.rpow_nonneg (Real.log_nonneg (by linarith)))] ++ ring_nf ++ ++lemma deriv_fun_re {t : ℝ} {f : ℂ → ℂ} (diff : ∀ (σ : ℝ), DifferentiableAt ℂ f (↑σ + ↑t * I)) : ++ (deriv fun {σ₂ : ℝ} ↦ f (σ₂ + t * I)) = fun (σ : ℝ) ↦ deriv f (σ + t * I) := by ++ ext σ ++ have := deriv_comp (h := fun (σ : ℝ) ↦ σ + t * I) (h₂ := f) σ (diff σ) ?_ ++ · simp only [deriv_add_const', _root_.Erdos970.deriv_ofReal, mul_one] at this ++ exact this ++ · apply DifferentiableAt.add_const _ <| _root_.Erdos970.Complex.differentiableAt_ofReal σ ++ ++ ++lemma Zeta_eq_int_derivZeta {σ₁ σ₂ t : ℝ} (t_ne_zero : t ≠ 0) : ++ (∫ σ in σ₁..σ₂, ζ' (σ + t * I)) = ζ (σ₂ + t * I) - ζ (σ₁ + t * I) := by ++ have diff : ∀ (σ : ℝ), DifferentiableAt ℂ ζ (σ + t * I) := by ++ intro σ ++ refine differentiableAt_riemannZeta ?_ ++ contrapose! t_ne_zero; apply And.right; simpa [Complex.ext_iff] using t_ne_zero ++ apply intervalIntegral.integral_deriv_eq_sub' ++ · exact deriv_fun_re diff ++ · intro s _ ++ apply DifferentiableAt.comp ++ · exact (diff s).restrictScalars ℝ ++ · exact DifferentiableAt.add_const (c := t * I) <| _root_.Erdos970.Complex.differentiableAt_ofReal _ ++ · apply ContinuousOn.comp (g := ζ') ?_ ?_ (mapsTo_image _ _) ++ · apply HasDerivAt.continuousOn (f' := deriv <| ζ') ++ intro x hx ++ apply hasDerivAt_deriv_iff.mpr ++ replace hx : x ≠ 1 := by ++ contrapose! hx ++ simp only [hx, mem_image, Complex.ext_iff, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, ++ I_im, mul_one, sub_self, add_zero, one_re, add_im, mul_im, zero_add, one_im, not_exists, ++ not_and] ++ exact fun _ _ _ ↦ t_ne_zero ++ exact differentiableAt_deriv_riemannZeta hx ++ · exact continuous_ofReal.continuousOn.add continuousOn_const ++ ++lemma Zeta_diff_Bnd : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ₁ σ₂ : ℝ) (t : ℝ) (_ : 3 < |t|) ++ (_ : 1 - A / Real.log |t| ≤ σ₁) (_ : σ₂ ≤ 2) (_ : σ₁ < σ₂), ++ ‖ζ (σ₂ + t * I) - ζ (σ₁ + t * I)‖ ≤ C * Real.log |t| ^ 2 * (σ₂ - σ₁) := by ++ obtain ⟨A, hA, C, Cpos, hC⟩ := ZetaDerivUpperBnd ++ refine ⟨A, hA, C, Cpos, ?_⟩ ++ intro σ₁ σ₂ t t_gt σ₁_ge σ₂_le σ₁_lt_σ₂ ++ have t_ne_zero : t ≠ 0 := by contrapose! t_gt; simp only [t_gt, abs_zero, Nat.ofNat_nonneg] ++ rw [← Zeta_eq_int_derivZeta t_ne_zero] ++ convert intervalIntegral.norm_integral_le_of_norm_le_const ?_ using 1 ++ · congr; rw [_root_.abs_of_nonneg (by linarith)] ++ · intro σ hσ; rw [uIoc_of_le σ₁_lt_σ₂.le, mem_Ioc] at hσ ++ exact hC σ t t_gt ⟨le_trans σ₁_ge hσ.1.le, le_trans hσ.2 σ₂_le⟩ ++ ++lemma ZetaInvBnd_aux' {t : ℝ} (logt_gt_one : 1 < Real.log |t|) : Real.log |t| < Real.log |t| ^ 9 := by ++ nth_rewrite 1 [← Real.rpow_one <| Real.log |t|] ++ exact mod_cast Real.rpow_lt_rpow_left_iff (y := 1) (z := 9) logt_gt_one |>.mpr (by norm_num) ++ ++lemma ZetaInvBnd_aux {t : ℝ} (logt_gt_one : 1 < Real.log |t|) : Real.log |t| ≤ Real.log |t| ^ 9 := ++ ZetaInvBnd_aux' logt_gt_one |>.le ++ ++lemma ZetaInvBnd_aux2 {A C₁ C₂ : ℝ} (Apos : 0 < A) (C₁pos : 0 < C₁) (C₂pos : 0 < C₂) ++ (hA : A ≤ 1 / 2 * (C₁ / (C₂ * 2)) ^ (4 : ℝ)) : ++ 0 < (C₁ * A ^ (3 / 4 : ℝ) - C₂ * 2 * A)⁻¹ := by ++ simp only [inv_pos, sub_pos] ++ apply div_lt_iff₀ (by positivity) |>.mp ++ rw [div_eq_mul_inv, ← Real.rpow_neg (by positivity), mul_assoc] ++ apply lt_div_iff₀' (by positivity) |>.mp ++ nth_rewrite 1 [← Real.rpow_one A] ++ rw [← Real.rpow_add (by positivity)] ++ norm_num ++ apply Real.rpow_lt_rpow_iff (z := 4) (by positivity) (by positivity) (by positivity) |>.mp ++ rw [← Real.rpow_mul (by positivity)] ++ norm_num ++ apply lt_of_le_of_lt hA ++ rw [div_mul_comm, mul_one, Real.rpow_ofNat] ++ apply half_lt_self ++ positivity ++ ++lemma ZetaInvBnd : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Ico (1 - A / (Real.log |t|) ^ 9) (1 + A / (Real.log |t|) ^ 9)), ++ 1 / ‖ζ (σ + t * I)‖ ≤ C * (Real.log |t|) ^ (7 : ℝ) := by ++ obtain ⟨C', C'pos, hC₁⟩ := ZetaInvBound2 ++ obtain ⟨A', hA', C₂, C₂pos, hC₂⟩ := Zeta_diff_Bnd ++ set C₁ := 1 / C' ++ let A := min A' <| (1 / 2 : ℝ) * (C₁ / (C₂ * 2)) ^ (4 : ℝ) ++ have Apos : 0 < A := by have := hA'.1; positivity ++ have Ale : A ≤ 1 / 2 := by dsimp only [A]; apply min_le_iff.mpr; left; exact hA'.2 ++ set C := (C₁ * A ^ (3 / 4 : ℝ) - C₂ * 2 * A)⁻¹ ++ have Cpos : 0 < C := by ++ refine ZetaInvBnd_aux2 (by positivity) (by positivity) (by positivity) ?_ ++ apply min_le_right ++ refine ⟨A, ⟨Apos, by linarith [hA'.2]⟩ , C, Cpos, ?_⟩ ++ intro σ t t_gt hσ ++ have logt_gt_one := logt_gt_one t_gt.le ++ have σ_ge : 1 - A / Real.log |t| ≤ σ := by ++ apply le_trans ?_ hσ.1 ++ suffices A / Real.log |t| ^ 9 ≤ A / Real.log |t| by linarith ++ exact div_le_div₀ Apos.le (by rfl) (by positivity) <| ZetaInvBnd_aux logt_gt_one ++ obtain ⟨_, _, neOne⟩ := UpperBnd_aux ⟨Apos, Ale⟩ t_gt σ_ge ++ set σ' := 1 + A / Real.log |t| ^ 9 ++ have σ'_gt : 1 < σ' := by simp only [σ', lt_add_iff_pos_right]; positivity ++ have σ'_le : σ' ≤ 2 := by ++ simp only [σ'] ++ suffices A / Real.log |t| ^ 9 < 1 by linarith ++ apply div_lt_one (by positivity) |>.mpr ++ exact lt_trans₄ (by linarith) logt_gt_one <| ZetaInvBnd_aux' logt_gt_one ++ set s := σ + t * I ++ set s' := σ' + t * I ++ by_cases h0 : ‖ζ s‖ ≠ 0 ++ swap ++ · simp only [ne_eq, not_not] at h0; simp only [h0, div_zero]; positivity ++ apply div_le_iff₀ (by positivity) |>.mpr <| div_le_iff₀' (by positivity) |>.mp ?_ ++ have pos_aux : 0 < (σ' - 1) := by linarith ++ calc ++ _ ≥ ‖ζ s'‖ - ‖ζ s - ζ s'‖ := ?_ ++ _ ≥ C₁ * (σ' - 1) ^ ((3 : ℝ)/ 4) * Real.log |t| ^ ((-1 : ℝ)/ 4) - C₂ * Real.log |t| ^ 2 * (σ' - σ) := ?_ ++ _ ≥ C₁ * (A / Real.log |t| ^ (9 : ℝ)) ^ ((3 : ℝ)/ 4) * Real.log |t| ^ ((-1 : ℝ)/ 4) - C₂ * Real.log |t| ^ (2 : ℝ) * 2 * A / Real.log |t| ^ (9 : ℝ) := ?_ ++ _ ≥ C₁ * A ^ ((3 : ℝ)/ 4) * Real.log |t| ^ (-7 : ℝ) - C₂ * 2 * A * Real.log |t| ^ (-7 : ℝ) := ?_ ++ _ = (C₁ * A ^ ((3 : ℝ)/ 4) - C₂ * 2 * A) * Real.log |t| ^ (-7 : ℝ) := by ring ++ _ ≥ _ := ?_ ++ · apply ge_iff_le.mpr ++ convert norm_sub_norm_le (a := ζ s') (b := ζ s' - ζ s) using 1 ++ · rw [(by simp : ζ s' - ζ s = -(ζ s - ζ s'))]; simp only [norm_neg] ++ · simp ++ · apply sub_le_sub ++ · have := one_div_le ?_ (by positivity) |>.mp <| hC₁ ⟨σ'_gt, σ'_le⟩ t t_gt ++ · convert this using 1 ++ rw [one_div, mul_inv_rev, mul_comm, mul_inv_rev, mul_comm _ C'⁻¹] ++ simp only [one_div C', C₁] ++ congr <;> (rw [← Real.rpow_neg (by linarith), neg_div]); rw [neg_neg] ++ · apply norm_pos_iff.mpr <| riemannZeta_ne_zero_of_one_lt_re (by simp [σ'_gt]) ++ · rw [(by simp : ζ s - ζ s' = -(ζ s' - ζ s)), norm_neg] ++ refine hC₂ σ σ' t t_gt ?_ σ'_le <| by rw [Set.mem_Ico] at hσ; exact hσ.2 ++ apply le_trans ?_ hσ.1 ++ rw [tsub_le_iff_right, ← add_sub_right_comm, le_sub_iff_add_le, add_le_add_iff_left] ++ exact div_le_div₀ hA'.1.le (by simp [A]) (by positivity) <| ZetaInvBnd_aux logt_gt_one ++ · apply sub_le_sub (by simp only [add_sub_cancel_left, σ']; exact_mod_cast le_rfl) ?_ ++ rw [mul_div_assoc, mul_assoc _ 2 _] ++ apply mul_le_mul (by exact_mod_cast le_rfl) ?_ (by linarith [hσ.2]) (by positivity) ++ suffices h : σ' + (1 - A / Real.log |t| ^ 9) ≤ (1 + A / Real.log |t| ^ 9) + σ by ++ simp only [tsub_le_iff_right] ++ convert! le_sub_right_of_add_le h using 1; ring_nf; norm_cast; simp ++ exact add_le_add (by linarith) (by linarith [hσ.1]) ++ · simp_rw [tsub_le_iff_right, div_eq_mul_inv _ (Real.log |t| ^ (9 : ℝ))] ++ rw [← Real.rpow_neg (by positivity), Real.mul_rpow (by positivity) (by positivity)] ++ rw [← Real.rpow_mul (by positivity)] ++ ring_nf ++ conv => rhs; lhs; rw [mul_assoc, ← Real.rpow_add (by positivity)] ++ rw [(by ring : C₂ * Real.log |t| ^ (2 : ℝ) * A * Real.log |t| ^ (-9 : ℝ) * 2 = C₂ * (Real.log |t| ^ (2 : ℝ) * Real.log |t| ^ (-9 : ℝ) ) * A * 2)] ++ rw [← Real.rpow_add (by positivity)]; norm_num; group; exact le_rfl ++ · apply div_le_iff₀ (by positivity) |>.mpr ++ conv => rw [mul_assoc]; rhs; rhs; rw [mul_comm C, ← mul_assoc, ← Real.rpow_add (by positivity)] ++ have := inv_inv C ▸ mul_inv_cancel₀ (a := C⁻¹) (by positivity) |>.symm.le ++ simpa [C] using this ++ ++lemma ZetaLowerBnd : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (c : ℝ) (_ : 0 < c), ++ ∀ (σ : ℝ) ++ (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Ico (1 - A / (Real.log |t|) ^ 9) 1), ++ c / (Real.log |t|) ^ (7 : ℝ) ≤ ‖ζ (σ + t * I)‖ := by ++ obtain ⟨C₁, C₁pos, hC₁⟩ := ZetaLowerBound3 ++ obtain ⟨A', hA', C₂, C₂pos, hC₂⟩ := Zeta_diff_Bnd ++ ++ let A := min A' ((C₁ / (4 * C₂)) ^ 4) ++ have hA : A ∈ Ioc 0 (1 / 2) := ++ ⟨lt_min hA'.1 (by positivity), (min_le_left A' _).trans hA'.2⟩ ++ ++ let C := C₁ * A ^ ((3:ℝ) /4) - 2 * C₂ * A ++ have hc_pos : 0 < C := by ++ have:= A.rpow_le_rpow hA.1.le (min_le_right _ _) (inv_pos.mpr four_pos).le ++ erw [Real.pow_rpow_inv_natCast (div_pos C₁pos (mul_pos four_pos C₂pos)).le four_ne_zero, ++ le_div_iff₀ (mul_pos four_pos C₂pos)] at this ++ norm_num [mul_assoc, C, mul_left_comm, C₂pos, hA.1, ++ (mul_le_mul_of_nonneg_right this (A.rpow_nonneg hA.1.le _)).trans_lt', ←A.rpow_add] ++ ++ refine ⟨A, hA, C, hc_pos, fun σ t L ⟨σ_low_bound, σ_le_one⟩=>?_⟩ ++ ++ let σ' := 1 + A / Real.log |t| ^ (9 : ℝ) ++ ++ have triangular : ‖ζ (σ + t * I)‖ ≥ ‖ζ (σ' + t * I)‖ - ‖ζ (σ + t * I) - ζ (σ' + t * I)‖ := by ++ apply sub_le_iff_le_add.mpr.comp (sub_sub_self @_ (@_ : ℂ)▸norm_sub_le _ _).trans ++ (by rw [add_comm]) ++ ++ have one_leLogT : 1 ≤ Real.log |t| := (logt_gt_one L.le).le ++ have one_half_le_log_pow : 1 / 2 ≤ Real.log |t| ^ 9 := ++ one_half_lt_one.le.trans <| one_le_pow₀ one_leLogT ++ ++ have σ'_ge : 1 ≤ σ' := by ++ simp_all only [gt_iff_lt, mem_Ioc, Real.log_abs, one_div, and_imp, tsub_le_iff_right, ++ lt_inf_iff, div_pos_iff_of_pos_left, Nat.ofNat_pos, mul_pos_iff_of_pos_left, pow_pos, ++ and_self, inf_le_iff, true_or, sub_pos, mem_Ico, and_true, ofReal_add, ofReal_one, ++ ofReal_div, ge_iff_le, le_add_iff_nonneg_right, A, C, σ'] ++ apply div_nonneg ++ · apply le_min ++ · linarith ++ · have : (C₁ / (4 * C₂)) ^ 4 = ((C₁ / (4 * C₂)) ^ 2) ^ 2 := by ring ++ rw [this] ++ apply sq_nonneg ++ · positivity ++ ++ have right_sub : -‖ζ (σ + t * I) - ζ (σ' + t * I)‖ ≥ - C₂ * Real.log |t| ^ 2 * (σ' - σ) := by ++ change - C₂ * Real.log |t| ^ 2 * (σ' - σ) ≤ -‖ζ (σ + t * I) - ζ (σ' + t * I)‖ ++ have := hC₂ σ σ' t L ?_ ?_ ?_ ++ · convert! neg_le_neg this using 1 ++ · ring ++ · congr! 1 ++ have : ζ (↑σ + ↑t * I) - ζ (↑σ' + ↑t * I) = ++ - (ζ (↑σ' + ↑t * I) - ζ (↑σ + ↑t * I)) := by ring ++ rw [this, norm_neg] ++ · have : 1 - A' / Real.log |t| ≤ 1 - A / (Real.log |t|) ^ 9 := by ++ gcongr ++ · exact hA'.1.le ++ · bound ++ · bound ++ linarith ++ · have : σ' ≤ 1 + A := by ++ simp_all only [gt_iff_lt, mem_Ioc, Real.log_abs, one_div, and_imp, tsub_le_iff_right, ++ lt_inf_iff, div_pos_iff_of_pos_left, Nat.ofNat_pos, mul_pos_iff_of_pos_left, pow_pos, ++ and_self, inf_le_iff, true_or, sub_pos, mem_Ico, and_true, ofReal_add, ofReal_one, ++ ofReal_div, ge_iff_le, le_add_iff_nonneg_right, add_le_add_iff_left, le_inf_iff, ++ σ', A, C] ++ have : 1 ≤ Real.log t ^ (9 : ℕ) := by ++ bound ++ have : 1 ≤ Real.log t ^ (9 : ℝ) := by ++ exact_mod_cast this ++ refine ⟨?_, ?_⟩ ++ · rw [← min_div_div_right] ++ · rw [min_le_iff] ++ left ++ bound ++ · exact le_trans (zero_le_one) this ++ · rw [← min_div_div_right] ++ · rw [min_le_iff] ++ right ++ bound ++ · exact le_trans (zero_le_one) this ++ · bound [hA.2] ++ · linarith ++ ++ have right' : -‖ζ (σ + t * I) - ζ (σ' + t * I)‖ ≥ - C₂ * 2 * A / Real.log |t| ^ 7 := by ++ have := (abs t).log_pos (by bound) ++ refine right_sub.trans' ((div_le_iff₀ (pow_pos this 7)).2 @?_|>.trans ++ (mul_le_mul_of_nonpos_left (sub_le_sub_left σ_low_bound (1+_) ) ++ (by ·linear_combination C₂*this*(.log |t|)))) ++ exact (mod_cast (by linear_combination (2 *_* A) *div_self ↑(pow_pos this 09).ne')) ++ ++ have left_sub : ‖ζ (σ' + t * I)‖ ≥ C₁ * (σ' - 1) ^ ((3:ℝ) /4) / Real.log |t| ^ 4 := by ++ use (hC₁ ⟨lt_add_of_pos_right (1) (by bound[hA.1]), ++ add_le_of_le_sub_left ((div_le_iff₀ (by bound)).2 (hA.2.trans (?_)))⟩ t L).trans' ?_ ++ · norm_num only [one_mul, Real.rpow_ofNat, one_half_le_log_pow] ++ · simp_all only [gt_iff_lt, mem_Ioc, lt_inf_iff, div_pos_iff_of_pos_left, Nat.ofNat_pos, ++ mul_pos_iff_of_pos_left, pow_pos, and_self, inf_le_iff, true_or, sub_pos, mem_Ico, ++ ofReal_add, ofReal_one, ofReal_div, ge_iff_le, le_add_iff_nonneg_right, neg_mul, ++ neg_le_neg_iff, add_sub_cancel_left, σ', A, C] ++ gcongr ++ have : Real.log |t| ^ ((1 : ℝ) / 4) ≤ Real.log |t| ^ (4 : ℝ) := ++ Real.rpow_le_rpow_of_exponent_le one_leLogT (by norm_num) ++ exact_mod_cast this ++ ++ have left' : ‖ζ (σ' + t * I)‖ ≥ C₁ * A ^ ((3:ℝ) /4) / Real.log |t| ^ 7 := by ++ contrapose! hC₁ ++ use σ', ⟨lt_add_of_pos_right 1<|by bound[hA'.1], ++ add_le_of_le_sub_left ((div_le_iff₀ (by bound)).2 (hA.2.trans ?_))⟩, t, L, hC₁.trans_le ?_ ++ · norm_num only [one_mul, Real.rpow_ofNat, one_half_le_log_pow] ++ · norm_num only [σ', add_sub_cancel_left, A.div_rpow hA.1.le, mul_div, pow_pos, L.trans', ++ ←Real.rpow_natCast, ←Real.rpow_mul, le_of_lt, Real.log_pos, refl, div_div, ←Real.rpow_sub] ++ rw [Real.div_rpow hA.1.le, ← Real.rpow_mul (by linarith), ← mul_div_assoc, div_div, ← Real.rpow_add (by linarith)] ++ · norm_num ++ · apply Real.rpow_nonneg (by linarith) ++ have ineq : ‖ζ (σ + t * I)‖ ≥ (C₁ * A ^ ((3:ℝ) /4) - C₂ * 2 * A) / Real.log |t| ^ 7 := by ++ linear_combination left'+triangular+right' ++ ++ rw [mul_comm C₂] at ineq ++ exact_mod_cast ineq ++ ++lemma ZetaZeroFree : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)), ++ ∀ (σ : ℝ) ++ (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Ico (1 - A / (Real.log |t|) ^ 9) 1), ++ ζ (σ + t * I) ≠ 0 := by ++ obtain ⟨A, hA, c, hc, h_lower⟩ := ZetaLowerBnd ++ ++ refine ⟨A, hA, ?_⟩ ++ ++ intro σ t ht hσ h_zero ++ ++ have := h_lower σ t ht hσ ++ ++ rw [h_zero, norm_zero] at this ++ ++ have pos_bound : 0 < c / (Real.log |t|) ^ (7 : ℝ) := by ++ apply div_pos hc ++ apply Real.rpow_pos_of_pos ++ apply Real.log_pos ++ linarith ++ ++ linarith ++ ++lemma LogDerivZetaBnd : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Ico (1 - A / Real.log |t| ^ 9) (1 + A / Real.log |t| ^ 9)), ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ ++ C * Real.log |t| ^ 9 := by ++ obtain ⟨A, hA, C, hC, h⟩ := ZetaInvBnd ++ obtain ⟨A', hA', C', hC', h'⟩ := ZetaDerivUpperBnd ++ use min A A', ⟨lt_min hA.1 hA'.1, min_le_of_right_le hA'.2⟩, C * C', mul_pos hC hC' ++ intro σ t t_gt ⟨σ_ge, σ_lt⟩ ++ have logt_gt : (1 : ℝ) < Real.log |t| := logt_gt_one t_gt.le ++ have σ_ge' : 1 - A / Real.log |t| ^ 9 ≤ σ := by ++ apply le_trans (tsub_le_tsub_left ?_ 1) σ_ge ++ apply div_le_div_of_nonneg_right (min_le_left A A') ++ exact pow_nonneg (zero_le_one.trans logt_gt.le) _ ++ have σ_ge'' : 1 - A' / Real.log |t| ≤ σ := by ++ apply le_trans (tsub_le_tsub_left ?_ 1) σ_ge ++ apply div_le_div₀ hA'.1.le (min_le_right A A') (lt_trans (by norm_num) logt_gt) ?_ ++ exact le_self_pow₀ logt_gt.le (by norm_num) ++ replace h := h σ t t_gt ⟨σ_ge', by calc ++ σ < 1 + min A A' / Real.log |t| ^ 9 := σ_lt ++ _ ≤ 1 + A / Real.log |t| ^ 9 := by gcongr; simp⟩ ++ replace h' := h' σ t t_gt ⟨σ_ge'', by ++ calc ++ σ ≤ 1 + min A A' / Real.log |t| ^ 9 := by linarith [σ_lt] ++ ++ _ ≤ 1 + (1/2) / Real.log |t| ^ 9 := by gcongr; simp [Set.mem_Ioc] at hA' hA ⊢ ; simp [hA.2] ++ ++ _ ≤ 1 + (1/2) / 1 := by ++ gcongr ++ calc ++ 1 ≤ Real.log |t| := by linarith ++ _ ≤ (Real.log |t|)^9 := Real.self_le_rpow_of_one_le (by linarith) (by linarith) ++ norm_cast ++ ++ _ ≤ 2 := by linarith ++ ⟩ ++ simp only [norm_div] ++ convert! mul_le_mul h h' (by simp) ?_ using 1 <;> (norm_cast; ring_nf); positivity ++ ++lemma ZetaNoZerosOn1Line (t : ℝ) : ζ (1 + t * I) ≠ 0 := by ++ refine riemannZeta_ne_zero_of_one_le_re ?_ ++ simp ++ ++lemma ZetaCont : ContinuousOn ζ (univ \ {1}) := by ++ apply continuousOn_of_forall_continuousAt (fun x hx ↦ ?_) ++ apply DifferentiableAt.continuousAt (𝕜 := ℂ) ++ convert differentiableAt_riemannZeta ?_ ++ simp only [Set.mem_sdiff, mem_univ, mem_singleton_iff, true_and] at hx ++ exact hx ++ ++lemma ZetaNoZerosInBox (T : ℝ) : ++ ∃ (σ : ℝ) (_ : σ < 1), ∀ (t : ℝ) (_ : |t| ≤ T) ++ (σ' : ℝ) (_ : σ' ≥ σ), ζ (σ' + t * I) ≠ 0 := by ++ by_contra! h ++ have hn (n : ℕ) := h (1 - 1 / (n + 1)) (sub_lt_self _ (by positivity)) ++ ++ have : ∃ (tn : ℕ → ℝ) (σn : ℕ → ℝ), (∀ n, σn n ≤ 1) ∧ ++ (∀ n, (1 : ℝ) - 1 / (n + 1) ≤ σn n) ∧ (∀ n, |tn n| ≤ T) ∧ ++ (∀ n, ζ (σn n + tn n * I) = 0) := by ++ choose t ht σ' hσ' hζ using hn ++ refine ⟨t, σ', ?_, hσ', ht, hζ⟩ ++ intro n ++ by_contra! hσn ++ have := riemannZeta_ne_zero_of_one_lt_re (s := σ' n + t n * I) ++ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, ++ add_zero, ne_eq] at this ++ exact this hσn (hζ n) ++ ++ choose t σ' hσ'_le hσ'_ge ht hζ using this ++ ++ have σTo1 : Filter.Tendsto σ' Filter.atTop (𝓝 1) := by ++ use sub_zero (1: ℝ)▸tendsto_order.2 ⟨fun A B=>? _,fun A B=>?_⟩ ++ · apply (((tendsto_inv_atTop_nhds_zero_nat.comp ++ (Filter.tendsto_add_atTop_nat (1))).congr (by norm_num)).const_sub 1).eventually_const_lt ++ B|>.mono (hσ'_ge ·|>.trans_lt') ++ · norm_num[(hσ'_le _).trans_lt, B.trans_le'] ++ ++ have : ∃ (t₀ : ℝ) (subseq : ℕ → ℕ), ++ Filter.Tendsto (t ∘ subseq) Filter.atTop (𝓝 t₀) ∧ ++ Filter.Tendsto subseq Filter.atTop Filter.atTop := by ++ refine (isCompact_Icc.isSeqCompact fun and => abs_le.1 (ht and)).imp fun and ⟨x, A, B, _⟩ => ?_ ++ use A, by omega, B.tendsto_atTop ++ ++ obtain ⟨t₀, subseq, tTendsto, subseqTendsto⟩ := this ++ ++ have σTo1 : Filter.Tendsto (σ' ∘ subseq) Filter.atTop (𝓝 1) := ++ σTo1.comp subseqTendsto ++ ++ have (n : ℕ) : ζ (σ' (subseq n) + I * (t (subseq n))) = 0 := by ++ convert hζ (subseq n) using 3 ++ ring ++ ++ have ToOneT0 : Filter.Tendsto (fun n ↦ (σ' (subseq n) : ℂ) + Complex.I * (t (subseq n))) Filter.atTop ++ (𝓝[≠]((1 : ℂ) + I * t₀)) := by ++ simp_rw [tendsto_nhdsWithin_iff, Function.comp_def] at tTendsto ⊢ ++ constructor ++ · exact (σTo1.ofReal.add (tTendsto.ofReal.const_mul _)).trans (by simp) ++ · filter_upwards with n ++ apply ne_of_apply_ne ζ ++ rw [this] ++ apply Ne.symm ++ apply riemannZeta_ne_zero_of_one_le_re ++ simp only [add_re, one_re, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, ++ sub_self, add_zero, le_refl] ++ ++ by_cases ht₀ : t₀ = 0 ++ · have ZetaBlowsUp : ∀ᶠ s in 𝓝[≠](1 : ℂ), ‖ζ s‖ ≥ 1 := by ++ simp_all only [ge_iff_le, one_div, tsub_le_iff_right, Function.comp_def, ofReal_zero, ++ mul_zero, add_zero, norm_eq_sqrt_real_inner, Complex.inner, mul_re, conj_re, conj_im, ++ mul_neg, sub_neg_eq_add, Real.one_le_sqrt, eventually_nhdsWithin_iff, mem_compl_iff, ++ mem_singleton_iff] ++ contrapose! h ++ simp_all only [ne_eq] ++ delta abs at* ++ exfalso ++ simp_rw [Metric.nhds_basis_ball.frequently_iff]at* ++ choose! I A B using h ++ choose a s using exists_seq_strictAnti_tendsto (0: ℝ) ++ apply ((isCompact_closedBall _ _).isSeqCompact ++ fun and=>(A _ (s.2.1 and)).le.trans (s.2.2.bddAbove_range.some_mem ⟨and, rfl⟩)).elim ++ simp only [Metric.mem_ball, dist_eq_norm_sub] at A ++ refine fun and ⟨a, H, S, M⟩=> ?_ ++ refine absurd (tendsto_nhds_unique M (tendsto_sub_nhds_zero_iff.1 ++ (( squeeze_zero_norm fun and=>le_of_lt (A _ (s.2.1 _) ) ) ++ (s.2.2.comp S.tendsto_atTop)))) fun and=>?_ ++ norm_num[*,Function.comp_def] at M ++ have:=@riemannZeta_residue_one ++ use one_ne_zero (tendsto_nhds_unique (this.comp (tendsto_nhdsWithin_iff.2 ++ ⟨ M,.of_forall (by norm_num[*])⟩)) ( squeeze_zero_norm ?_ ++ ((M.sub_const 1).norm.trans (by rw [sub_self,norm_zero])))) ++ use fun and =>.trans (norm_mul_le_of_le ↑(le_rfl) (Complex.norm_def _▸Real.sqrt_le_one.mpr ++ (B ↑_ (s.2.1 ↑_)).right.le)) (by rw [mul_one]) ++ ++ have ZetaNonZ : ∀ᶠ s in 𝓝[≠](1 : ℂ), ζ s ≠ 0 := by ++ filter_upwards [ZetaBlowsUp] ++ intro s hs hfalse ++ rw [hfalse] at hs ++ simp only [norm_zero, ge_iff_le] at hs ++ linarith ++ ++ rw [ht₀] at ToOneT0 ++ simp only [ofReal_zero, mul_zero, add_zero] at ToOneT0 ++ rcases (ToOneT0.eventually ZetaNonZ).exists with ⟨n, hn⟩ ++ exact hn (this n) ++ ++ · have zetaIsZero : ζ (1 + Complex.I * t₀) = 0 := by ++ have cont := @ZetaCont ++ use isClosed_singleton.isSeqClosed ++ this ++ (.comp ++ (cont.continuousAt.comp (eventually_ne_nhds (by field_simp; simp [ht₀])).mono ++ fun and=>.intro ⟨⟩) ++ (ToOneT0.trans (inf_le_left))) ++ ++ exact riemannZeta_ne_zero_of_one_le_re (s := 1 + I * t₀) (by simp) zetaIsZero ++ ++lemma LogDerivZetaHoloOn {S : Set ℂ} (s_ne_one : 1 ∉ S) ++ (nonzero : ∀ s ∈ S, ζ s ≠ 0) : ++ HolomorphicOn (fun s ↦ ζ' s / ζ s) S := by ++ apply DifferentiableOn.div _ _ nonzero <;> intro s hs <;> apply DifferentiableAt.differentiableWithinAt ++ · apply differentiableAt_deriv_riemannZeta ++ exact ne_of_mem_of_not_mem hs s_ne_one ++ · apply differentiableAt_riemannZeta ++ exact ne_of_mem_of_not_mem hs s_ne_one ++ ++theorem LogDerivZetaHolcSmallT : ++ ∃ (σ₂ : ℝ) (_ : σ₂ < 1), HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) ++ (( [[ σ₂, 2 ]] ×ℂ [[ -3, 3 ]]) \ {1}) := by ++ obtain ⟨σ₂, hσ₂_lt_one, hζ_ne_zero⟩ := ZetaNoZerosInBox 3 ++ refine ⟨σ₂, hσ₂_lt_one, ?_⟩ ++ let U := ([[σ₂, 2]] ×ℂ [[-3, 3]]) \ {1} ++ have s_in_U_im_le3 : ∀ s ∈ U, |s.im| ≤ 3 := by ++ intro s hs ++ rw [Set.mem_sdiff_singleton] at hs ++ rcases hs with ⟨hbox, _hne⟩ ++ rcases hbox with ⟨hre, him⟩ ++ simp only [Set.mem_preimage] at him ++ obtain ⟨him_lower, him_upper⟩ := him ++ apply abs_le.2 ++ simp only [neg_le_self_iff, Nat.ofNat_nonneg, inf_of_le_left] at him_lower ++ simp only [neg_le_self_iff, Nat.ofNat_nonneg, sup_of_le_right] at him_upper ++ exact ⟨him_lower, him_upper⟩ ++ ++ have s_in_U_re_ges2 : ∀ s ∈ U, σ₂ ≤ s.re := by ++ intro s hs ++ rw [Set.mem_sdiff_singleton] at hs ++ rcases hs with ⟨hbox, _hne⟩ ++ rcases hbox with ⟨hre, _him⟩ ++ simp only [Set.mem_preimage] at hre ++ obtain ⟨hre_lower, hre_upper⟩ := hre ++ have : min σ₂ 2 = σ₂ := by ++ apply min_eq_left ++ linarith [hσ₂_lt_one] ++ rwa [← this] ++ ++ apply LogDerivZetaHoloOn ++ · exact Set.notMem_sdiff_of_mem rfl ++ · intro s hs ++ rw[← re_add_im s] ++ apply hζ_ne_zero ++ · apply s_in_U_im_le3 _ hs ++ · apply s_in_U_re_ges2 _ hs ++ ++theorem LogDerivZetaHolcLargeT : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)), ∀ (T : ℝ) (_ : 3 ≤ T), ++ HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) ++ (( (Icc ((1 : ℝ) - A / Real.log T ^ 9) 2) ×ℂ (Icc (-T) T) ) \ {1}) := by ++ obtain ⟨A, A_inter, restOfZetaZeroFree⟩ := ZetaZeroFree ++ obtain ⟨σ₁, σ₁_lt_one, noZerosInBox⟩ := ZetaNoZerosInBox 3 ++ let A₀ := min A ((1 - σ₁) * Real.log 3 ^ 9) ++ refine ⟨A₀, ?_, ?_⟩ ++ · constructor ++ · apply lt_min A_inter.1 ++ bound ++ · exact le_trans (min_le_left _ _) A_inter.2 ++ intro T hT ++ apply LogDerivZetaHoloOn ++ · exact Set.notMem_sdiff_of_mem rfl ++ intro s hs ++ rcases le_or_gt 1 s.re with one_le|lt_one ++ · exact riemannZeta_ne_zero_of_one_le_re one_le ++ rw [← re_add_im s] ++ have := Complex.mem_reProdIm.mp hs.1 ++ rcases lt_or_ge 3 |s.im| with gt3|le3 ++ · apply restOfZetaZeroFree _ _ gt3 ++ refine ⟨?_, lt_one⟩ ++ calc ++ _ ≤ 1 - A₀ / Real.log T ^ 9 := by ++ gcongr ++ · exact A_inter.1.le ++ · bound ++ · bound ++ · bound ++ · exact abs_le.mpr ⟨this.2.1, this.2.2⟩ ++ _ ≤ _:= by exact this.1.1 ++ ++ · apply noZerosInBox _ le3 ++ calc ++ _ ≥ 1 - A₀ / Real.log T ^ 9 := by exact this.1.1 ++ _ ≥ 1 - A₀ / Real.log 3 ^ 9 := by ++ gcongr ++ apply le_min A_inter.1.le ++ bound ++ _ ≥ 1 - (((1 - σ₁) * Real.log 3 ^ 9)) / Real.log 3 ^ 9:= by ++ gcongr ++ apply min_le_right ++ _ = _ := by field_simp; simp ++ ++theorem summable_complex_then_summable_real_part (f : ℕ → ℂ) ++ (h : Summable f) : Summable (fun n ↦ (f n).re) := by ++ rcases h with ⟨s, hs⟩ ++ exact ⟨s.re, hasSum_re hs⟩ ++ ++open ArithmeticFunction (vonMangoldt) ++local notation "Λ" => vonMangoldt ++ ++open scoped ComplexOrder in ++theorem dlog_riemannZeta_bdd_on_vertical_lines_generalized ++ (σ₀ σ₁ t : ℝ) (σ₀_gt_one : 1 < σ₀) (σ₀_lt_σ₁ : σ₀ ≤ σ₁) : ++ ‖(- ζ' (σ₁ + t * I) / ζ (σ₁ + t * I))‖ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by ++ let s₁ := σ₁ + t * I ++ have s₁_re_eq_sigma : s₁.re = σ₁ := by ++ rw [add_re, ofReal_re, mul_I_re, ofReal_im] ++ ring ++ ++ have s₀_re_eq_sigma : (↑σ₀ : ℂ).re = σ₀ := by ++ rw [ofReal_re] ++ ++ let s₀ := σ₀ ++ ++ have σ₁_gt_one : 1 < σ₁ := by exact lt_of_le_of_lt' σ₀_lt_σ₁ σ₀_gt_one ++ have s₀_gt_one : 1 < (↑σ₀ : ℂ).re := by exact σ₀_gt_one ++ ++ have s₁_re_geq_one : 1 < s₁.re := by exact lt_of_lt_of_eq σ₁_gt_one (id (Eq.symm s₁_re_eq_sigma)) ++ rw [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₁_re_geq_one)] ++ unfold LSeries ++ ++ have summable_von_mangoldt_at_σ₀ : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i) := by ++ exact ArithmeticFunction.LSeriesSummable_vonMangoldt σ₀_gt_one ++ ++ have summable_re_von_mangoldt_at_σ₀ : ++ Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i).re) := by ++ exact summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) σ₀) ++ summable_von_mangoldt_at_σ₀ ++ ++ have summable_abs_value : Summable (fun i ↦ ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ i‖) := by ++ rw [summable_norm_iff] ++ exact ArithmeticFunction.LSeriesSummable_vonMangoldt s₁_re_geq_one ++ apply le_trans <| norm_tsum_le_tsum_norm summable_abs_value ++ rw [← norm_neg, ← neg_div, ← ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₀_gt_one] ++ unfold LSeries ++ rw [← re_eq_norm.mpr, re_tsum summable_von_mangoldt_at_σ₀] ++ · apply Summable.tsum_mono summable_abs_value summable_re_von_mangoldt_at_σ₀ ++ intro n ++ beta_reduce ++ apply le_trans <| LSeries.norm_term_le_of_re_le_re (s := σ₀) _ _ _ ++ · rw [re_eq_norm.mpr] ++ apply LSeries.term_nonneg ++ exact_mod_cast ArithmeticFunction.vonMangoldt_nonneg ++ · rwa [s₁_re_eq_sigma, s₀_re_eq_sigma] ++ · apply tsum_nonneg ++ intro n ++ apply LSeries.term_nonneg ++ exact_mod_cast ArithmeticFunction.vonMangoldt_nonneg ++ ++theorem triv_bound_zeta : ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → ++ ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ (σ₀ - 1)⁻¹ + C := by ++ let ⟨U, ⟨U_in_nhds, zeta_residue_on_U⟩⟩ := riemannZetaLogDerivResidue ++ let ⟨open_in_U, ⟨open_in_U_subs_U, open_in_U_is_open, one_in_open_U⟩⟩ := ++ mem_nhds_iff.mp U_in_nhds ++ let ⟨ε₀, ⟨ε_pos, metric_ball_around_1_is_in_U'⟩⟩ := ++ EMetric.isOpen_iff.mp open_in_U_is_open (1 : ℂ) one_in_open_U ++ ++ let ε := if ε₀ = ⊤ then ENNReal.ofReal 1 else ε₀ ++ have O1 : ε ≠ ⊤ := by ++ unfold ε ++ by_cases h : ε₀ = ⊤ <;> simp [*] ++ ++ have metric_ball_around_1_is_in_U : ++ Metric.eball (1 : ℂ) ε ⊆ U := by ++ unfold ε ++ by_cases h : ε₀ = ⊤ ++ · simp only [↓reduceIte, ENNReal.ofReal_one, h] ++ have T : Metric.eball (1 : ℂ) 1 ⊆ Metric.eball 1 ε₀ := by ++ simp [*] ++ exact subset_trans (subset_trans T metric_ball_around_1_is_in_U') open_in_U_subs_U ++ ++ · simp only [h, ↓reduceIte] ++ exact subset_trans metric_ball_around_1_is_in_U' open_in_U_subs_U ++ ++ have O2 : ε ≠ 0 := by ++ unfold ε ++ by_cases h : ε₀ = ⊤ ++ · simp [*] ++ · simp only [↓reduceIte, ne_eq, h] ++ exact pos_iff_ne_zero.mp ε_pos ++ ++ let metric_ball_around_1 := Metric.eball (1 : ℂ) ε ++ let ε_div_two := ε / 2 ++ let boundary := ENNReal.toReal (1 + ε_div_two) ++ ++ let ⟨bound, ⟨bound_pos, bound_prop⟩⟩ := ++ BddAbove.exists_ge zeta_residue_on_U 0 ++ ++ have boundary_geq_one : 1 < boundary := by ++ unfold boundary ++ have Z : (1 : ENNReal).toReal = 1 := by rfl ++ rw [←Z] ++ have U : ε_div_two ≠ ⊤ := by ++ refine ENNReal.div_ne_top O1 ?_ ++ simp ++ simp only [ENNReal.toReal_one, ne_eq, ENNReal.one_ne_top, not_false_eq_true, ++ ENNReal.toReal_add _ U, lt_add_iff_pos_right, gt_iff_lt] ++ refine ENNReal.toReal_pos ?_ ?_ ++ · unfold ε_div_two ++ simp [*] ++ · exact U ++ ++ let const : ℝ := bound ++ let final_const : ℝ := (boundary - 1)⁻¹ + const ++ have final_const_pos : final_const ≥ 0 := by bound ++ have const_le_final_const : const ≤ final_const := by bound ++ ++ refine ⟨final_const, final_const_pos, fun σ₀ t σ₀_gt ↦ ?_⟩ ++ have U4 : ENNReal.ofReal 1 ≠ ⊤ := by exact ENNReal.ofReal_ne_top ++ have Z0 : ε_div_two.toReal < ε.toReal := by ++ exact ENNReal.toReal_strict_mono O1 <| ENNReal.half_lt_self O2 O1 ++ ++ by_cases! h : σ₀ ≤ boundary ++ · have σ₀_in_ball : (↑σ₀ : ℂ) ∈ metric_ball_around_1 := by ++ unfold metric_ball_around_1 ++ unfold Metric.eball ++ simp only [mem_ofPred_eq] ++ rw [edist_dist, dist_eq_norm] ++ norm_cast ++ have U : 0 ≤ σ₀ - 1 := by linarith ++ simp only [Real.norm_of_nonneg U, gt_iff_lt] ++ simp only [ENNReal.ofReal_lt_iff_lt_toReal U O1] ++ calc ++ _ ≤ boundary - 1 := by linarith ++ _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl ++ _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp ++ _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 ++ _ = ENNReal.toReal (ε_div_two) := by ++ simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, ++ ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] ++ _ < ε.toReal := Z0 ++ ++ have σ₀_in_U : (↑σ₀ : ℂ) ∈ (U \ {1}) := by ++ refine Set.mem_sdiff_singleton.mpr ?_ ++ constructor ++ · exact metric_ball_around_1_is_in_U σ₀_in_ball ++ · by_contra a ++ have U : σ₀ = 1 := by exact ofReal_eq_one.mp a ++ rw [U] at σ₀_gt ++ linarith ++ ++ have bdd := Set.forall_mem_image.mp bound_prop (σ₀_in_U) ++ simp only [Function.comp_apply, Pi.sub_apply, Pi.neg_apply, Pi.div_apply] at bdd ++ ++ calc ++ _ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by ++ exact dlog_riemannZeta_bdd_on_vertical_lines_generalized σ₀ σ₀ t (σ₀_gt) (by simp) ++ _ = ‖- ζ' σ₀ / ζ σ₀‖ := by simp only [Complex.norm_div, norm_neg] ++ _ = ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) + (σ₀ - 1)⁻¹‖ := by ++ simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] ++ _ ≤ ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹)‖ + ‖(σ₀ - 1)⁻¹‖ := by ++ have Z := norm_add_le (- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) ((σ₀ - 1)⁻¹) ++ norm_cast at Z ++ _ ≤ const + ‖(σ₀ - 1)⁻¹‖ := by ++ have U := add_le_add_left bdd ‖(σ₀ - 1)⁻¹‖ ++ ring_nf at U ++ ring_nf ++ norm_cast at U ++ norm_cast ++ _ ≤ const + (σ₀ - 1)⁻¹ := by ++ simp [norm_inv] ++ have pos : 0 ≤ σ₀ - 1 := by ++ linarith ++ simp [abs_of_nonneg pos] ++ _ = (σ₀ - 1)⁻¹ + const := by ++ rw [add_comm] ++ _ ≤ (σ₀ - 1)⁻¹ + final_const := by ++ simp [const_le_final_const] ++ ++ · have boundary_in_ball : (↑boundary : ℂ) ∈ metric_ball_around_1 := by ++ unfold metric_ball_around_1 ++ unfold Metric.eball ++ simp only [mem_ofPred_eq] ++ rw [edist_dist, dist_eq_norm] ++ norm_cast ++ have U : 0 ≤ boundary - 1 := by linarith ++ simp only [Real.norm_of_nonneg U, gt_iff_lt] ++ simp only [ENNReal.ofReal_lt_iff_lt_toReal U O1] ++ calc ++ _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl ++ _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp ++ _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 ++ _ = ENNReal.toReal (ε_div_two) := by ++ simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, ++ ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] ++ _ < ε.toReal := Z0 ++ ++ have boundary_in_U : (↑boundary : ℂ) ∈ U \ {1} := by ++ refine Set.mem_sdiff_singleton.mpr ?_ ++ constructor ++ · exact metric_ball_around_1_is_in_U boundary_in_ball ++ · by_contra a ++ norm_cast at a ++ norm_cast at boundary_geq_one ++ simp [←a] at boundary_geq_one ++ ++ have bdd := Set.forall_mem_image.mp bound_prop (boundary_in_U) ++ ++ calc ++ _ ≤ ‖ζ' boundary / ζ boundary‖ := by ++ exact dlog_riemannZeta_bdd_on_vertical_lines_generalized boundary σ₀ t ++ (boundary_geq_one) (by linarith) ++ _ = ‖- ζ' boundary / ζ boundary‖ := by simp only [Complex.norm_div, norm_neg] ++ _ = ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) + (boundary - 1)⁻¹‖ := by ++ simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] ++ _ ≤ ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹)‖ + ‖(boundary - 1)⁻¹‖ := by ++ have Z := norm_add_le (- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) ((boundary - 1)⁻¹) ++ norm_cast at Z ++ _ ≤ const + ‖(boundary - 1)⁻¹‖ := by ++ have U9 := add_le_add_left bdd ‖(boundary - 1)⁻¹‖ ++ ring_nf at U9 ++ ring_nf ++ norm_cast at U9 ++ norm_cast ++ simpa [*] using! U9 ++ _ ≤ const + (boundary - 1)⁻¹ := by ++ simp [norm_inv] ++ have pos : 0 ≤ boundary - 1 := by ++ linarith ++ simp [abs_of_nonneg pos] ++ _ = (boundary - 1)⁻¹ + const := by ++ rw [add_comm] ++ _ = final_const := by rfl ++ _ ≤ _ := by bound ++ ++lemma LogDerivZetaBndUnif : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Ici (1 - A / Real.log |t| ^ 9)), ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ ++ C * Real.log |t| ^ 9 := by ++ let ⟨A, pf_A, C, C_pos, ζbd_in⟩ := LogDerivZetaBnd ++ let ⟨C_triv, ⟨pf_C_triv, ζbd_out⟩⟩ := triv_bound_zeta ++ have T0 : A > 0 := pf_A.1 ++ ++ have ha : 1 ≤ A⁻¹ := by ++ simp only [one_div, mem_Ioc, true_and, T0] at pf_A ++ have U := (inv_le_inv₀ (by positivity) (by positivity)).mpr pf_A ++ simp only [inv_inv] at U ++ linarith ++ ++ refine ⟨A, pf_A, ((1 + C + C_triv) * A⁻¹), (by positivity), fun σ t hyp_t hyp_σ ↦ ?_⟩ ++ have logt_gt' : (1 : ℝ) < Real.log |t| ^ 9 := by ++ calc ++ 1 < Real.log |t| := logt_gt_one hyp_t.le ++ _ ≤ (Real.log |t|) ^ 9 := ZetaInvBnd_aux (logt_gt_one hyp_t.le) ++ ++ have logt_gt'' : (1 : ℝ) < 1 + A / Real.log |t| ^ 9 := by ++ simp only [lt_add_iff_pos_right, div_pos_iff_of_pos_left, T0] ++ positivity ++ ++ have T1 : ∀⦃σ : ℝ⦄, 1 + A / Real.log |t| ^ 9 ≤ σ → 1 < σ := by ++ intros ++ linarith ++ ++ have T2 : ∀⦃σ : ℝ⦄, 1 + A / Real.log |t| ^ 9 ≤ σ → A / Real.log |t| ^ 9 ≤ σ - 1 := by ++ intro σ' hyp_σ' ++ calc ++ A / Real.log |t| ^ 9 = (1 + A / Real.log |t| ^ 9) - 1 := by ring_nf ++ _ ≤ σ' - 1 := by gcongr ++ ++ by_cases h : σ ∈ Ico (1 - A / Real.log |t| ^ 9) (1 + A / Real.log |t| ^ 9) ++ · calc ++ ‖ζ' (↑σ + ↑t * I) / ζ (↑σ + ↑t * I)‖ ≤ C * Real.log |t| ^ 9 := ζbd_in σ t hyp_t h ++ _ ≤ ((1 + C + C_triv) * A⁻¹) * Real.log |t| ^ 9 := by ++ gcongr ++ · calc ++ C ≤ 1 + C := by simp only [le_add_iff_nonneg_left, zero_le_one] ++ _ ≤ (1 + C + C_triv) * 1 := by simp only [mul_one, le_add_iff_nonneg_right]; positivity ++ _ ≤ (1 + C + C_triv) * A⁻¹ := by gcongr ++ ++ · simp only [mem_Ico, tsub_le_iff_right, not_and, not_lt, mem_Ici] at h hyp_σ ++ replace h := h hyp_σ ++ calc ++ ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ = ‖-ζ' (σ + t * I) / ζ (σ + t * I)‖ := by simp only [Complex.norm_div, ++ norm_neg] ++ ++ _ ≤ (σ - 1)⁻¹ + C_triv := ζbd_out σ t (by exact T1 h) ++ ++ _ ≤ (A / Real.log |t| ^ 9)⁻¹ + C_triv := by ++ gcongr ++ · exact T2 h ++ ++ _ ≤ (A / Real.log |t| ^ 9)⁻¹ + C_triv * A⁻¹ := by ++ gcongr ++ exact le_mul_of_one_le_right pf_C_triv ha ++ ++ _ ≤ (1 + C_triv) * A⁻¹ * Real.log |t| ^ 9 := by ++ simp only [inv_div] ++ ring_nf ++ gcongr ++ · simp only [inv_pos, le_mul_iff_one_le_left, T0] ++ linarith ++ ++ _ ≤ (1 + C + C_triv) * A⁻¹ * Real.log |t| ^ 9 := by gcongr; simp only [le_add_iff_nonneg_right]; positivity ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Erdos970/ZetaConj.lean b/PrimeNumberTheoremAnd/Erdos970/ZetaConj.lean +new file mode 100644 +index 0000000..79c01fe +--- /dev/null ++++ b/PrimeNumberTheoremAnd/Erdos970/ZetaConj.lean +@@ -0,0 +1,32 @@ ++import Mathlib.Analysis.Calculus.Deriv.Star ++import Mathlib.Analysis.Normed.Module.Connected ++import Mathlib.NumberTheory.Harmonic.ZetaAsymp ++ ++namespace Erdos970 ++ ++open scoped Complex ComplexConjugate ++ ++theorem deriv_conj_conj' (f : ℂ → ℂ) (p : ℂ) : ++ deriv (fun z ↦ conj (f (conj z))) (conj p) = conj (deriv f p) := by ++ trans deriv (conj ∘ f ∘ conj) (conj p) ++ · rfl ++ simp ++ ++theorem deriv_riemannZeta_conj (s : ℂ) : ++ deriv riemannZeta (conj s) = conj (deriv riemannZeta s) := by ++ simp [← deriv_conj_conj'] ++ ++theorem logDerivZeta_conj (s : ℂ) : ++ (deriv riemannZeta / riemannZeta) (conj s) = conj ((deriv riemannZeta / riemannZeta) s) := by ++ simp [deriv_riemannZeta_conj, riemannZeta_conj] ++ ++theorem logDerivZeta_conj' (s : ℂ) : ++ (logDeriv riemannZeta) (conj s) = conj (logDeriv riemannZeta s) := logDerivZeta_conj s ++ ++ ++theorem intervalIntegral_conj {f : ℝ → ℂ} {a b : ℝ} : ++ ∫ (x : ℝ) in a..b, conj (f x) = conj (∫ (x : ℝ) in a..b, f x) := by ++ rw [intervalIntegral.intervalIntegral_eq_integral_uIoc, integral_conj, ← RCLike.conj_smul, ++ ← intervalIntegral.intervalIntegral_eq_integral_uIoc] ++ ++end Erdos970 +diff --git a/PrimeNumberTheoremAnd/Fourier.lean b/PrimeNumberTheoremAnd/Fourier.lean +index 99e15a0..1a8cf07 100644 +--- a/PrimeNumberTheoremAnd/Fourier.lean ++++ b/PrimeNumberTheoremAnd/Fourier.lean +@@ -1,57 +1,29 @@ +-import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv +-import Mathlib.MeasureTheory.Integral.IntegralEqImproper ++/- ++Adapted from PrimeNumberTheoremAnd by Alex Kontorovich and contributors. ++Licensed under the Apache License, Version 2.0; see the upstream LICENSE. ++This compatibility port retains the proven declarations used by this project. ++-/ + import Mathlib.Topology.ContinuousMap.Bounded.Basic +-import Mathlib.Order.Filter.ZeroAndBoundedAtFilter + import Mathlib.Analysis.Fourier.FourierTransformDeriv + import PrimeNumberTheoremAnd.Sobolev + + open FourierTransform Real Complex MeasureTheory Filter Topology BoundedContinuousFunction + SchwartzMap VectorFourier BigOperators + +-local instance {E : Type*} : Coe (E → ℝ) (E → ℂ) := ⟨fun f n => f n⟩ +- + section lemmas + +-@[simp] +-theorem nnnorm_eq_of_mem_circle (z : Circle) : ‖z.val‖₊ = 1 := +- NNReal.coe_eq_one.mp (by simp) +- +-@[simp] +-theorem nnnorm_circle_smul (z : Circle) (s : ℂ) : ‖z • s‖₊ = ‖s‖₊ := by +- simp [show z • s = z.val * s from rfl] +- +-noncomputable def e (u : ℝ) : ℝ →ᵇ ℂ where +- toFun v := 𝐞 (-v * u) +- map_bounded' := +- ⟨2, fun x y => (dist_le_norm_add_norm _ _).trans (by simp [Circle.norm_coe, one_add_one_eq_two])⟩ +- +-@[simp] lemma e_apply (u : ℝ) (v : ℝ) : e u v = 𝐞 (-v * u) := rfl +- +-theorem hasDerivAt_e {u x : ℝ} : HasDerivAt (e u) (-2 * π * u * I * e u x) x := by +- have l2 : HasDerivAt (fun v => -v * u) (-u) x := by +- simpa only [neg_mul_comm] using hasDerivAt_mul_const (-u) +- convert! (hasDerivAt_fourierChar (-x * u)).scomp x l2 using 1 +- change _ = ((-u : ℝ) : ℂ) * _ -- `scomp` introduces ℝ-smul on ℂ, which we undo +- simp ; ring +- +-lemma fourierIntegral_deriv_aux2 (e : ℝ →ᵇ ℂ) {f : ℝ → ℂ} (hf : Integrable f) : +- Integrable (⇑e * f) := +- hf.bdd_mul e.continuous.aestronglyMeasurable (ae_of_all _ e.norm_coe_le_norm) +- +-@[simp] lemma F_neg {f : ℝ → ℂ} {u : ℝ} : 𝓕 (fun x => -f x) u = - 𝓕 f u := by ++@[simp] theorem F_neg {f : ℝ → ℂ} {u : ℝ} : 𝓕 (fun x => -f x) u = - 𝓕 f u := by + simp [fourier_eq, integral_neg] + +-@[simp] lemma F_add {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : ++@[simp] theorem F_add {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : + 𝓕 (fun x => f x + g x) x = 𝓕 f x + 𝓕 g x := by +- have : Continuous fun p : ℝ × ℝ ↦ ((innerₗ ℝ) p.1) p.2 := continuous_inner +- have := fourierIntegral_add continuous_fourierChar this hf hg +- exact congr_fun this x ++ exact congr_fun (fourierIntegral_add continuous_fourierChar continuous_inner hf hg) x + +-@[simp] lemma F_sub {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : ++@[simp] theorem F_sub {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : + 𝓕 (fun x => f x - g x) x = 𝓕 f x - 𝓕 g x := by + simpa [sub_eq_add_neg, Pi.neg_def] using F_add hf hg.neg x + +-@[simp] lemma F_mul {f : ℝ → ℂ} {c : ℂ} {u : ℝ} : ++@[simp] theorem F_mul {f : ℝ → ℂ} {c : ℂ} {u : ℝ} : + 𝓕 (fun x => c * f x) u = c * 𝓕 f u := by + exact congr_fun (VectorFourier.fourierIntegral_const_smul 𝐞 _ _ f c) u + +@@ -67,121 +39,5 @@ theorem fourierIntegral_self_add_deriv_deriv (f : W21) (u : ℝ) : + simp [f.hf, l1, add_mul, Real.fourier_deriv f.hf' l5 f.hf'', Real.fourier_deriv f.hf l4 f.hf'] + field_simp [pi_ne_zero] ; ring_nf ; simp + +-@[simp] lemma deriv_ofReal : deriv ofReal = fun _ => 1 := by ++@[simp] theorem deriv_ofReal : deriv ofReal = fun _ => 1 := by + ext x ; exact ((hasDerivAt_id x).ofReal_comp).deriv +- +-/-- If, eventually in `T`, the integrand `f T` is bounded on `uIoc lo hi` by `B T` +-and `B T * |hi - lo| → 0`, then the interval integral `∫ x in lo..hi, f T x → 0`. -/ +-lemma tendsto_intervalIntegral_zero_of_uniform_norm_bound +- {f : ℝ → ℝ → ℂ} {lo hi : ℝ} {B : ℝ → ℝ} +- (hB : Filter.Tendsto (fun T : ℝ => B T * |hi - lo|) Filter.atTop (nhds 0)) +- (hf : ∀ᶠ T in Filter.atTop, ∀ x ∈ Set.uIoc lo hi, ‖f T x‖ ≤ B T) : +- Filter.Tendsto (fun T : ℝ => ∫ x in lo..hi, f T x) Filter.atTop (nhds 0) := by +- rw [tendsto_zero_iff_norm_tendsto_zero] +- refine squeeze_zero' (Eventually.of_forall fun T => norm_nonneg _) ?_ hB +- filter_upwards [hf] with T hT +- exact intervalIntegral.norm_integral_le_of_norm_le_const (fun x hx => hT x hx) +- +-/-- The decay `K * (log (T + 2) / (T + 2)) → 0` as `T → ∞`, for any constant `K`. -/ +-lemma tendsto_const_mul_log_add_two_div_add_two_atTop (K : ℝ) : +- Filter.Tendsto (fun T : ℝ => K * (Real.log (T + 2) / (T + 2))) +- Filter.atTop (nhds 0) := by +- have h0 : Filter.Tendsto (fun x : ℝ => Real.log x / x) Filter.atTop (nhds 0) := by +- simpa using (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 (by norm_num : (1 : ℝ) ≠ 0)) +- have hshift : Filter.Tendsto (fun T : ℝ => Real.log (T + 2) / (T + 2)) +- Filter.atTop (nhds 0) := by +- have := h0.comp (tendsto_atTop_add_const_right Filter.atTop 2 tendsto_id) +- simpa [Function.comp_def] using this +- simpa using hshift.const_mul K +- +-/-- Fourier-transform decay from an integrable derivative: for integrable, +-differentiable `g` with integrable derivative, `‖𝓕 g w‖ ≤ (∫ ‖deriv g x‖) / (2π·|w|)`. -/ +-lemma norm_fourier_le_integral_deriv_div +- (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) +- (hg' : Integrable (deriv g)) {w : ℝ} (hw : w ≠ 0) : +- ‖𝓕 g w‖ ≤ (∫ x, ‖deriv g x‖ ∂volume) / ((2 * Real.pi) * |w|) := by +- have hmul : +- 𝓕 (deriv g) w = (2 * Real.pi * Complex.I * (w : ℂ)) * 𝓕 g w := by +- have h := congrFun (Real.fourier_deriv hg hdiff hg') w +- simpa [smul_eq_mul, mul_assoc] using h +- have h_fourier : +- ‖𝓕 (deriv g) w‖ ≤ ∫ x, ‖deriv g x‖ ∂volume := by +- exact VectorFourier.norm_fourierIntegral_le_integral_norm 𝐞 volume (innerₗ ℝ) +- (deriv g) w +- have hleft : +- ((2 * Real.pi) * |w|) * ‖𝓕 g w‖ = +- ‖(2 * Real.pi * Complex.I * (w : ℂ)) * 𝓕 g w‖ := by +- have htwopi : ‖(2 * ↑Real.pi : ℂ)‖ = 2 * Real.pi := by +- rw [norm_mul, Complex.norm_two, Complex.norm_of_nonneg Real.pi_pos.le] +- have hwc : ‖(w : ℂ)‖ = |w| := by rw [norm_real, Real.norm_eq_abs] +- rw [norm_mul, norm_mul, norm_mul, htwopi, norm_I, hwc] +- ring +- have hmain : ((2 * Real.pi) * |w|) * ‖𝓕 g w‖ ≤ ∫ x, ‖deriv g x‖ ∂volume := by +- rw [hleft, ← hmul] +- exact h_fourier +- have hpos : 0 < (2 * Real.pi) * |w| := by +- positivity +- exact (le_div_iff₀ hpos).mpr (by simpa [mul_comm, mul_left_comm, mul_assoc] using hmain) +- +-/-- The oscillatory-integral form of the decay bound: for `0 < T`, +-`‖∫ g y · exp(T·i·y)‖ ≤ (∫ ‖deriv g x‖) / T`. -/ +-lemma norm_oscillatory_integral_le_integral_deriv_div +- (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) +- (hg' : Integrable (deriv g)) {T : ℝ} (hT : 0 < T) : +- ‖∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume‖ ≤ +- (∫ x, ‖deriv g x‖ ∂volume) / T := by +- have hw : -T / (2 * Real.pi) ≠ 0 := by +- exact div_ne_zero (neg_ne_zero.mpr hT.ne') (mul_ne_zero two_ne_zero Real.pi_ne_zero) +- have hfourier := norm_fourier_le_integral_deriv_div g hg hdiff hg' hw +- have heq : +- (∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume) = +- 𝓕 g (-T / (2 * Real.pi)) := by +- rw [Real.fourier_real_eq_integral_exp_smul] +- apply integral_congr_ae +- filter_upwards with y +- rw [smul_eq_mul] +- rw [mul_comm (g y)] +- congr 1 +- congr 1 +- push_cast +- field_simp [Real.pi_ne_zero] +- rw [heq] +- refine hfourier.trans_eq ?_ +- congr 1 +- have hden : (2 * Real.pi) * |-T / (2 * Real.pi)| = T := by +- have htwopi_pos : 0 < 2 * Real.pi := by positivity +- have hneg : -T / (2 * Real.pi) < 0 := div_neg_of_neg_of_pos (neg_neg_of_pos hT) htwopi_pos +- rw [abs_of_neg hneg] +- field_simp [Real.pi_ne_zero] +- rw [hden] +- +-/-- The `|T|` variant of the oscillatory-integral decay bound: for `T ≠ 0`, +-`‖∫ g y · exp(T·i·y)‖ ≤ (∫ ‖deriv g x‖) / |T|`. -/ +-lemma norm_oscillatory_integral_le_integral_deriv_div_abs +- (g : ℝ → ℂ) (hg : Integrable g) (hdiff : Differentiable ℝ g) +- (hg' : Integrable (deriv g)) {T : ℝ} (hT : T ≠ 0) : +- ‖∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume‖ ≤ +- (∫ x, ‖deriv g x‖ ∂volume) / |T| := by +- have hw : -T / (2 * Real.pi) ≠ 0 := by +- exact div_ne_zero (neg_ne_zero.mpr hT) (mul_ne_zero two_ne_zero Real.pi_ne_zero) +- have hfourier := norm_fourier_le_integral_deriv_div g hg hdiff hg' hw +- have heq : +- (∫ y, g y * exp ((T : ℂ) * Complex.I * (y : ℂ)) ∂volume) = +- 𝓕 g (-T / (2 * Real.pi)) := by +- rw [Real.fourier_real_eq_integral_exp_smul] +- apply integral_congr_ae +- filter_upwards with y +- rw [smul_eq_mul] +- rw [mul_comm (g y)] +- congr 1 +- congr 1 +- push_cast +- field_simp [Real.pi_ne_zero] +- rw [heq] +- refine hfourier.trans_eq ?_ +- congr 1 +- have hden : (2 * Real.pi) * |-T / (2 * Real.pi)| = |T| := by +- have htwopi_pos : 0 < 2 * Real.pi := by positivity +- rw [abs_div, abs_neg, abs_of_pos htwopi_pos] +- field_simp [Real.pi_ne_zero] +- rw [hden] +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/CartanBounds.lean b/PrimeNumberTheoremAnd/SiegelZeros/CartanBounds.lean +new file mode 100644 +index 0000000..f378d4b +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/CartanBounds.lean +@@ -0,0 +1,843 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.Products ++import PrimeNumberTheoremAnd.SiegelZeros.Counting ++ ++namespace SiegelZeros ++ ++section ++namespace Complex ++ ++variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℂ F] ++ ++theorem norm_le_of_mem_ball_of_forall_sphere_norm_le {f : ℂ → F} {r C : ℝ} {z : ℂ} ++ (hd : Differentiable ℂ f) (hrpos : 0 < r) ++ (hz : z ∈ Metric.ball (0 : ℂ) r) (hsphere : ∀ u : ℂ, ‖u‖ = r → ‖f u‖ ≤ C) : ++ ‖f z‖ ≤ C := by ++ let U : Set ℂ := Metric.ball (0 : ℂ) r ++ have hfront : ∀ u ∈ frontier U, ‖f u‖ ≤ C := by ++ intro u hu ++ have hur : ‖u‖ = r := by ++ have hfront' : frontier (Metric.ball (0 : ℂ) r) = Metric.sphere (0 : ℂ) r := by ++ simpa using (frontier_ball (x := (0 : ℂ)) (r := r) (ne_of_gt hrpos)) ++ have : u ∈ Metric.sphere (0 : ℂ) r := by simpa [U, hfront'] using hu ++ simpa [Metric.mem_sphere, dist_zero_right] using this ++ exact hsphere u hur ++ exact _root_.Complex.norm_le_of_forall_mem_frontier_norm_le (f := f) (U := U) Metric.isBounded_ball ++ hd.diffContOnCl hfront (subset_closure hz) ++ ++end Complex ++end ++section ++namespace Complex ++namespace CartanBound ++ ++open _root_.Real _root_.SiegelZeros.Real MeasureTheory intervalIntegral ++open scoped Topology ENNReal ++ ++private lemma neg_log_le_sqrt_two_div {x : ℝ} (hx : 0 < x) (hxle : x ≤ 1) : ++ -Real.log x ≤ Real.sqrt (2 / x) := by ++ have hx0 : 0 ≤ x := le_of_lt hx ++ have ht : 0 ≤ -Real.log x := by ++ have : Real.log x ≤ 0 := Real.log_nonpos hx0 hxle ++ linarith ++ have hsq_div_two_le_exp : ∀ {t : ℝ}, 0 ≤ t → t ^ 2 / 2 ≤ Real.exp t := by ++ intro t ht ++ let g : ℝ → ℝ := fun u => Real.exp u - u ^ 2 / 2 ++ have hg_cont : ContinuousOn g (Set.Ici (0 : ℝ)) := by ++ have : Continuous g := by fun_prop ++ simpa using this.continuousOn ++ have hg_diff : DifferentiableOn ℝ g (interior (Set.Ici (0 : ℝ))) := by ++ intro u hu ++ have : DifferentiableAt ℝ g u := by fun_prop ++ exact this.differentiableWithinAt ++ have hg'_nonneg : ∀ u ∈ interior (Set.Ici (0 : ℝ)), 0 ≤ deriv g u := by ++ intro u hu ++ have hu0 : 0 < u := by simpa [interior_Ici] using hu ++ have hderiv : deriv g u = Real.exp u - u := by ++ have hExp : HasDerivAt Real.exp (Real.exp u) u := Real.hasDerivAt_exp u ++ have hpow2 : HasDerivAt (fun z : ℝ => z ^ 2) (2 * u) u := by ++ simpa using! ((hasDerivAt_id u).pow 2) ++ have hpow2_div : HasDerivAt (fun z : ℝ => z ^ 2 / 2) u u := by ++ simpa using (hpow2.div_const (2 : ℝ)) ++ have hG : HasDerivAt g (Real.exp u - u) u := by ++ simpa [g] using! hExp.sub hpow2_div ++ exact hG.deriv ++ have hu_le : u ≤ Real.exp u := by ++ have h1 : u + 1 ≤ Real.exp u := Real.add_one_le_exp u ++ exact (le_trans (le_add_of_nonneg_right (by norm_num)) h1) ++ have : 0 ≤ Real.exp u - u := sub_nonneg.2 hu_le ++ simpa [hderiv] using this ++ have hg_mono : MonotoneOn g (Set.Ici (0 : ℝ)) := ++ monotoneOn_of_deriv_nonneg (D := Set.Ici (0 : ℝ)) (hD := convex_Ici 0) ++ hg_cont hg_diff hg'_nonneg ++ have hg0 : g 0 = 1 := by simp [g] ++ have hle : g 0 ≤ g t := hg_mono (by simp) (by simpa [Set.mem_Ici] using ht) ht ++ have : (1 : ℝ) ≤ Real.exp t - t ^ 2 / 2 := by simpa [g, hg0] using hle ++ linarith ++ have hmain : (-Real.log x) ^ 2 / 2 ≤ Real.exp (-Real.log x) := hsq_div_two_le_exp ht ++ have hexp : Real.exp (-Real.log x) = x⁻¹ := by simp [Real.exp_neg, Real.exp_log hx] ++ have hsq2 : (-Real.log x) ^ 2 ≤ 2 * Real.exp (-Real.log x) := by nlinarith [hmain] ++ have hsq' : (-Real.log x) ^ 2 ≤ 2 / x := by simpa [hexp, div_eq_mul_inv, mul_assoc] using hsq2 ++ have hy : 0 ≤ 2 / x := div_nonneg (by norm_num) (le_of_lt hx) ++ exact (Real.le_sqrt ht hy).2 hsq' ++ ++lemma posLog_log_one_div_abs_one_sub_le_sqrt {t : ℝ} : ++ Real.posLog (1 / |1 - t|) ≤ Real.sqrt (2 / |1 - t|) := by ++ by_cases ht : |1 - t| ≤ 1 ++ · by_cases h0 : |1 - t| = 0 ++ · have : t = 1 := by ++ have : 1 - t = 0 := by simpa [abs_eq_zero] using h0 ++ linarith ++ subst this ++ simp ++ · have hpos : 0 < |1 - t| := lt_of_le_of_ne (abs_nonneg _) (Ne.symm h0) ++ have hle : -Real.log |1 - t| ≤ Real.sqrt (2 / |1 - t|) := ++ neg_log_le_sqrt_two_div (x := |1 - t|) hpos ht ++ have hlog : Real.log (1 / |1 - t|) = -Real.log |1 - t| := by simp [Real.log_inv] ++ have hnonneg : 0 ≤ Real.log (1 / |1 - t|) := by ++ exact Real.log_nonneg ((one_le_div hpos).2 ht) ++ have hmax : Real.posLog (1 / |1 - t|) = Real.log (1 / |1 - t|) := ++ max_eq_right hnonneg ++ calc ++ Real.posLog (1 / |1 - t|) = Real.log (1 / |1 - t|) := hmax ++ _ = -Real.log |1 - t| := hlog ++ _ ≤ Real.sqrt (2 / |1 - t|) := hle ++ · have hlt : 1 < |1 - t| := lt_of_not_ge ht ++ have hle0 : Real.log (1 / |1 - t|) ≤ 0 := by ++ have hpos : 0 < |1 - t| := lt_trans (by norm_num) hlt ++ have : (1 / |1 - t| : ℝ) ≤ 1 := (div_le_one hpos).2 (le_of_lt hlt) ++ exact le_trans (Real.log_le_log (by positivity) this) (by simp) ++ have hmax : Real.posLog (1 / |1 - t|) = 0 := max_eq_left hle0 ++ have hrhs : 0 ≤ Real.sqrt (2 / |1 - t|) := by ++ exact Real.sqrt_nonneg _ ++ rw [hmax] ++ exact hrhs ++ ++noncomputable def φ (t : ℝ) : ℝ := ++ log⁺ (1 / |1 - t|) ++ ++lemma measurable_phi : Measurable φ := by ++ unfold φ ++ simpa [Real.posLog_def, Real.posLog] using ++ (by fun_prop : Measurable fun t : ℝ => max 0 (Real.log (1 / |1 - t|))) ++ ++lemma phi_le_log_two_of_le_half {t : ℝ} (ht : t ≤ (1 / 2 : ℝ)) : φ t ≤ Real.log 2 := by ++ have hnonneg : 0 ≤ (1 - t : ℝ) := by linarith ++ have hden : (1 / 2 : ℝ) ≤ |1 - t| := by ++ have : (1 / 2 : ℝ) ≤ (1 - t : ℝ) := by linarith ++ simpa [abs_of_nonneg hnonneg] using this ++ have hfrac : (1 / |1 - t| : ℝ) ≤ 2 := by ++ have hhalfpos : (0 : ℝ) < (1 / 2 : ℝ) := by norm_num ++ have := one_div_le_one_div_of_le hhalfpos hden ++ simpa [one_div, div_eq_mul_inv] using this ++ have hposLog : log⁺ (1 / |1 - t|) ≤ log⁺ (2 : ℝ) := ++ Real.posLog_le_posLog ((by trans (0 : ℝ); norm_num; positivity)) hfrac ++ have habs : (1 : ℝ) ≤ |(2 : ℝ)| := by ++ simp ++ have hposLog2 : (log⁺ (2 : ℝ)) = Real.log 2 := by ++ simpa using (Real.posLog_eq_log habs) ++ simpa [φ, hposLog2] using hposLog ++ ++lemma phi_eq_zero_of_one_le_abs_one_sub {t : ℝ} (ht : (1 : ℝ) ≤ |1 - t|) : φ t = 0 := by ++ have hpos : 0 < |1 - t| := lt_of_lt_of_le (by norm_num) ht ++ have hfrac : (1 / |1 - t| : ℝ) ≤ 1 := (div_le_one hpos).2 ht ++ have habs : |(1 / |1 - t| : ℝ)| ≤ 1 := by ++ have hnonneg : 0 ≤ (1 / |1 - t| : ℝ) := by positivity ++ simpa [abs_of_nonneg hnonneg] using hfrac ++ have : log⁺ (1 / |1 - t|) = 0 := (Real.posLog_eq_zero_iff _).2 habs ++ simpa [φ] using this ++ ++lemma φ_nonneg (t : ℝ) : 0 ≤ φ t := by ++ simpa [φ] using (Real.posLog_nonneg (x := (1 / |1 - t|))) ++ ++lemma φ_le_sqrt (t : ℝ) : φ t ≤ Real.sqrt (2 / |1 - t|) := by ++ simpa [φ, Real.posLog] using ++ posLog_log_one_div_abs_one_sub_le_sqrt (t := t) ++ ++lemma ae_restrict_norm_phi_le_of_forall_mem {A B : ℝ} (hAB : A ≤ B) {g : ℝ → ℝ} ++ (hg : ∀ t, 0 ≤ g t) (h : ∀ t ∈ Set.Icc A B, φ t ≤ g t) : ++ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A B))] fun t => ‖g t‖ := by ++ refine ++ MeasureTheory.ae_restrict_of_forall_mem (μ := (volume : MeasureTheory.Measure ℝ)) ++ (s := Set.uIoc A B) ++ (by simpa using (measurableSet_uIoc : MeasurableSet (Set.uIoc A B))) ?_ ++ intro t ht ++ have htIoc : t ∈ Set.Ioc A B := by ++ simpa [Set.uIoc_of_le hAB] using ht ++ have htIcc : t ∈ Set.Icc A B := ⟨le_of_lt htIoc.1, htIoc.2⟩ ++ have hle : φ t ≤ g t := h t htIcc ++ have hφ0 : 0 ≤ φ t := φ_nonneg t ++ have hg0 : 0 ≤ g t := hg t ++ simpa [Real.norm_eq_abs, abs_of_nonneg hφ0, abs_of_nonneg hg0] using hle ++ ++lemma log_norm_one_sub_div_ge_neg_phi {u a : ℂ} {r : ℝ} ++ (hur : ‖u‖ = r) (ha : a ≠ 0) (hr : r ≠ ‖a‖) : ++ Real.log ‖(1 : ℂ) - u / a‖ ≥ -φ (r / ‖a‖) := by ++ have ha_norm : 0 < ‖a‖ := norm_pos_iff.2 ha ++ have hnorm_eq : ‖(1 : ℂ) - u / a‖ = ‖a - u‖ / ‖a‖ := by ++ have : (1 : ℂ) - u / a = (a - u) / a := by ++ field_simp [ha] ++ calc ++ ‖(1 : ℂ) - u / a‖ = ‖(a - u) / a‖ := by simp [this] ++ _ = ‖a - u‖ / ‖a‖ := by simp ++ have hrev : |‖a‖ - ‖u‖| ≤ ‖a - u‖ := by ++ simpa using (abs_norm_sub_norm_le a u) ++ have hdiv : |‖a‖ - ‖u‖| / ‖a‖ ≤ ‖a - u‖ / ‖a‖ := ++ div_le_div_of_nonneg_right hrev (le_of_lt ha_norm) ++ have habs : |1 - (r / ‖a‖)| = |‖a‖ - ‖u‖| / ‖a‖ := by ++ have hu : ‖u‖ = r := hur ++ have ha0 : (‖a‖ : ℝ) ≠ 0 := ha_norm.ne' ++ have h1 : (1 : ℝ) - (r / ‖a‖) = (‖a‖ - r) / ‖a‖ := by ++ field_simp [ha0] ++ calc ++ |1 - (r / ‖a‖)| = |(‖a‖ - r) / ‖a‖| := by simp [h1] ++ _ = |‖a‖ - r| / ‖a‖ := by simp [abs_div, abs_of_pos ha_norm] ++ _ = |‖a‖ - ‖u‖| / ‖a‖ := by simp [hu] ++ have hnorm_ge : |1 - (r / ‖a‖)| ≤ ‖(1 : ℂ) - u / a‖ := by ++ have : |1 - (r / ‖a‖)| ≤ ‖a - u‖ / ‖a‖ := by ++ rw [habs] ++ exact hdiv ++ rwa [hnorm_eq] ++ have hx0 : 0 < |1 - (r / ‖a‖)| := by ++ have : (1 - (r / ‖a‖) : ℝ) ≠ 0 := by ++ intro h0 ++ have : r = ‖a‖ := by ++ have : r / ‖a‖ = (1 : ℝ) := by linarith ++ simpa using (div_eq_iff ha_norm.ne').1 this ++ exact hr this ++ have : |1 - (r / ‖a‖)| ≠ 0 := by ++ simpa [abs_eq_zero] using this ++ exact lt_of_le_of_ne (abs_nonneg _) (Ne.symm this) ++ have hlogx : ++ Real.log |1 - (r / ‖a‖)| ≥ -φ (r / ‖a‖) := by ++ have := Real.neg_posLog_inv_le_log (x := |1 - (r / ‖a‖)|) ++ simpa [φ, one_div, inv_inv, abs_sub_comm, sub_eq_add_neg] using this ++ have hlog_mono : ++ Real.log |1 - (r / ‖a‖)| ≤ Real.log ‖(1 : ℂ) - u / a‖ := ++ Real.log_le_log (by positivity) hnorm_ge ++ linarith [hlog_mono, hlogx] ++ ++noncomputable def K : ℝ := ++ ∫ (t : ℝ) in (1 / 4 : ℝ)..(4 : ℝ), Real.sqrt (2 / |1 - t|) ∂volume ++ ++lemma K_nonneg : 0 ≤ K := by ++ have hle : (1 / 4 : ℝ) ≤ (4 : ℝ) := by norm_num ++ have hnn : ∀ t ∈ Set.Icc (1 / 4 : ℝ) (4 : ℝ), 0 ≤ Real.sqrt (2 / |1 - t|) := by ++ intro _t _ht ++ exact Real.sqrt_nonneg _ ++ simpa [K] using (intervalIntegral.integral_nonneg ++ (μ := (volume : MeasureTheory.Measure ℝ)) hle hnn) ++ ++noncomputable def Cφ : ℝ := ++ Real.log 2 + 4 * K + 1 ++ ++lemma Cφ_pos : 0 < Cφ := by ++ have hlog : 0 < Real.log 2 := by ++ simpa using Real.log_pos (by norm_num : (1 : ℝ) < 2) ++ have hK : 0 ≤ K := K_nonneg ++ have : 0 < Real.log 2 + 4 * K := by nlinarith ++ have : 0 < Real.log 2 + 4 * K + 1 := by linarith ++ simpa [Cφ] using this ++ ++lemma intervalIntegrable_sqrt_two_div_abs_one_sub_Icc : ++ IntervalIntegrable ++ (fun t : ℝ => Real.sqrt (2 / |1 - t|)) ++ volume (1 / 4 : ℝ) (4 : ℝ) := by ++ let f : ℝ → ℝ := fun u => Real.sqrt (2 / |u|) ++ have hf0 : IntervalIntegrable f volume (0 : ℝ) (3 : ℝ) := by ++ have hpow : ++ IntervalIntegrable (fun u : ℝ => u ^ (- (2⁻¹ : ℝ))) volume (0 : ℝ) (3 : ℝ) := by ++ simpa using ++ (intervalIntegral.intervalIntegrable_rpow' (a := (0 : ℝ)) (b := (3 : ℝ)) ++ (r := (- (2⁻¹ : ℝ))) (by linarith : (-1 : ℝ) < - (2⁻¹ : ℝ))) ++ have hpow2 : ++ IntervalIntegrable (fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) volume (0 : ℝ) (3 : ℝ) := ++ hpow.const_mul (Real.sqrt 2) ++ have hEq : ++ Set.EqOn f (fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) (Set.uIoc (0 : ℝ) (3 : ℝ)) := by ++ intro u hu ++ have hu' : u ∈ Set.Ioc (0 : ℝ) (3 : ℝ) := by ++ simpa [Set.uIoc_of_le (show (0 : ℝ) ≤ 3 by norm_num)] using hu ++ have hu0 : 0 < u := hu'.1 ++ have hu0' : 0 ≤ u := le_of_lt hu0 ++ have habs : |u| = u := abs_of_nonneg hu0' ++ have : f u = Real.sqrt (2 / u) := by simp [f, habs] ++ calc ++ f u = Real.sqrt (2 / u) := this ++ _ = Real.sqrt 2 / Real.sqrt u := by simp ++ _ = Real.sqrt 2 * (Real.sqrt u)⁻¹ := by simp [div_eq_mul_inv] ++ _ = Real.sqrt 2 * (u ^ (2⁻¹ : ℝ))⁻¹ := by simp [Real.sqrt_eq_rpow] ++ _ = Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ)) := by ++ have h : (u ^ (2⁻¹ : ℝ))⁻¹ = u ^ (- (2⁻¹ : ℝ)) := by ++ simpa using (Real.rpow_neg hu0' (2⁻¹ : ℝ)).symm ++ simp [h] ++ exact ++ (IntervalIntegrable.congr (a := (0 : ℝ)) (b := (3 : ℝ)) ++ (μ := (volume : MeasureTheory.Measure ℝ)) ++ (f := fun u : ℝ => Real.sqrt 2 * u ^ (- (2⁻¹ : ℝ))) (g := f) hEq.symm) ++ hpow2 ++ have hf0' : IntervalIntegrable f volume (0 : ℝ) (3 / 4 : ℝ) := ++ hf0.mono_set (by ++ intro u hu ++ have hsub : Set.uIcc (0 : ℝ) (3 / 4 : ℝ) ⊆ Set.uIcc (0 : ℝ) (3 : ℝ) := by ++ refine Set.uIcc_subset_uIcc ?_ ?_ ++ · simp ++ · have h0 : (0 : ℝ) ≤ (3 / 4 : ℝ) := by nlinarith ++ have h1 : (3 / 4 : ℝ) ≤ (3 : ℝ) := by nlinarith ++ exact (Set.mem_uIcc).2 (Or.inl ⟨h0, h1⟩) ++ exact hsub hu) ++ have hleft : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume (1 / 4 : ℝ) (1 : ℝ) := by ++ have htmp : ++ IntervalIntegrable (fun t : ℝ => f (1 - t)) volume (1 : ℝ) ((1 : ℝ) - (3 / 4 : ℝ)) := by ++ simpa using (hf0'.comp_sub_left (c := (1 : ℝ))) ++ have htmp' : ++ IntervalIntegrable (fun t : ℝ => f (1 - t)) volume ((1 : ℝ) - (3 / 4 : ℝ)) (1 : ℝ) := ++ htmp.symm ++ have hsub : ((1 : ℝ) - (3 / 4 : ℝ)) = (1 / 4 : ℝ) := by norm_num ++ have htmp'' : IntervalIntegrable (fun t : ℝ => f (1 - t)) volume (1 / 4 : ℝ) (1 : ℝ) := by ++ simpa [hsub] using htmp' ++ simpa [f] using htmp'' ++ have hright : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume (1 : ℝ) (4 : ℝ) := by ++ have htmp : ++ IntervalIntegrable (fun t : ℝ => f (t - 1)) volume (1 : ℝ) ((3 : ℝ) + (1 : ℝ)) := by ++ simpa using (hf0.comp_sub_right (c := (1 : ℝ))) ++ have hsub : ((3 : ℝ) + (1 : ℝ)) = (4 : ℝ) := by norm_num ++ have htmp' : IntervalIntegrable (fun t : ℝ => f (t - 1)) volume (1 : ℝ) (4 : ℝ) := by ++ simpa [hsub] using htmp ++ have hcongr : ++ Set.EqOn (fun t : ℝ => f (t - 1)) (fun t : ℝ => Real.sqrt (2 / |1 - t|)) ++ (Set.uIoc (1 : ℝ) (4 : ℝ)) := by ++ intro t _ht ++ simp [f, abs_sub_comm] ++ exact ++ (IntervalIntegrable.congr (a := (1 : ℝ)) (b := (4 : ℝ)) ++ (μ := (volume : MeasureTheory.Measure ℝ)) ++ (f := fun t : ℝ => f (t - 1)) (g := fun t : ℝ => Real.sqrt (2 / |1 - t|)) hcongr) ++ htmp' ++ exact hleft.trans hright ++ ++lemma phi_le_log_two_on_dyadic_of_le_quarter {A t : ℝ} (hA : A ≤ (1 / 4 : ℝ)) ++ (ht : t ∈ Set.Icc A (2 * A)) : ++ φ t ≤ Real.log 2 := by ++ have ht_le : t ≤ (1 / 2 : ℝ) := by ++ exact ht.2.trans (by nlinarith [hA]) ++ exact phi_le_log_two_of_le_half ht_le ++ ++lemma phi_eq_zero_of_two_le {t : ℝ} (ht : (2 : ℝ) ≤ t) : φ t = 0 := by ++ have hden : (1 : ℝ) ≤ |1 - t| := by ++ have : (1 : ℝ) ≤ t - 1 := by linarith ++ have : (1 : ℝ) ≤ |t - 1| := by ++ simpa [abs_of_nonneg (by linarith : 0 ≤ t - 1)] using this ++ simpa [abs_sub_comm] using this ++ exact phi_eq_zero_of_one_le_abs_one_sub hden ++ ++lemma intervalIntegrable_phi_dyadic_small {A : ℝ} (hA0 : 0 ≤ A) ++ (hA : A ≤ (1 / 4 : ℝ)) : ++ IntervalIntegrable φ volume A (2 * A) := by ++ have hA_le : A ≤ 2 * A := by nlinarith ++ have hconst : IntervalIntegrable (fun _ : ℝ => (Real.log 2 : ℝ)) volume A (2 * A) := ++ intervalIntegrable_const ++ have hmeas : ++ AEStronglyMeasurable (fun t : ℝ => φ t) (volume.restrict (Set.uIoc A (2 * A))) := ++ (measurable_phi.aestronglyMeasurable : _) ++ have hdom : ++ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A (2 * A)))] ++ fun _ => ‖(Real.log 2 : ℝ)‖ := by ++ refine ae_restrict_norm_phi_le_of_forall_mem (A := A) (B := 2 * A) hA_le ++ (g := fun _ => (Real.log 2 : ℝ)) (hg := fun _ => ?_) ?_ ++ · simpa using (Real.log_nonneg (by norm_num : (1 : ℝ) ≤ 2)) ++ · intro t ht ++ exact phi_le_log_two_on_dyadic_of_le_quarter hA ht ++ exact IntervalIntegrable.mono_fun hconst hmeas hdom ++ ++lemma intervalIntegrable_phi_dyadic_large {A : ℝ} (hA : (2 : ℝ) ≤ A) : ++ IntervalIntegrable φ volume A (2 * A) := by ++ have hA_le : A ≤ 2 * A := by nlinarith ++ have hEq : Set.EqOn (fun t : ℝ => φ t) (fun _ => (0 : ℝ)) (Set.uIoc A (2 * A)) := by ++ intro t ht ++ have htIoc : t ∈ Set.Ioc A (2 * A) := by ++ simpa [Set.uIoc_of_le hA_le] using ht ++ exact phi_eq_zero_of_two_le (le_trans hA (le_of_lt htIoc.1)) ++ have hz : IntervalIntegrable (fun _ : ℝ => (0 : ℝ)) volume A (2 * A) := ++ intervalIntegrable_const ++ exact (IntervalIntegrable.congr (a := A) (b := (2 * A)) ++ (μ := (volume : MeasureTheory.Measure ℝ)) ++ (f := fun _ => (0 : ℝ)) (g := fun t => φ t) (by ++ intro t ht ++ simpa using (hEq (x := t) ht).symm)) hz ++ ++lemma intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle {A : ℝ} ++ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume A (2 * A) := by ++ have hsqrt_big : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) ++ (volume : MeasureTheory.Measure ℝ) (1 / 4 : ℝ) (4 : ℝ) := ++ intervalIntegrable_sqrt_two_div_abs_one_sub_Icc ++ refine hsqrt_big.mono_set ?_ ++ refine Set.uIcc_subset_uIcc ?_ ?_ ++ · exact (Set.mem_uIcc).2 (Or.inl ⟨hA_lower, by nlinarith [hA_upper]⟩) ++ · exact (Set.mem_uIcc).2 (Or.inl ⟨by nlinarith [hA_lower], by nlinarith [hA_upper]⟩) ++ ++lemma intervalIntegrable_phi_dyadic_middle {A : ℝ} ++ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : ++ IntervalIntegrable φ volume A (2 * A) := by ++ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] ++ have hsqrt : ++ IntervalIntegrable (fun t : ℝ => Real.sqrt (2 / |1 - t|)) volume A (2 * A) := ++ intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle hA_lower hA_upper ++ have hmeas : ++ AEStronglyMeasurable (fun t : ℝ => φ t) (volume.restrict (Set.uIoc A (2 * A))) := ++ (measurable_phi.aestronglyMeasurable : _) ++ have hdom : ++ (fun t : ℝ => ‖φ t‖) ≤ᶠ[ae (volume.restrict (Set.uIoc A (2 * A)))] ++ fun t => ‖Real.sqrt (2 / |1 - t|)‖ := by ++ refine ae_restrict_norm_phi_le_of_forall_mem (A := A) (B := 2 * A) hA_le ++ (g := fun t => Real.sqrt (2 / |1 - t|)) (hg := fun _ => Real.sqrt_nonneg _) ?_ ++ intro t _ht ++ exact φ_le_sqrt t ++ exact IntervalIntegrable.mono_fun hsqrt hmeas hdom ++ ++lemma intervalIntegrable_phi_dyadic {A : ℝ} (hA : 0 ≤ A) : ++ IntervalIntegrable φ volume A (2 * A) := by ++ by_cases hA0 : A = 0 ++ · subst hA0 ++ simp ++ cases le_total A (1 / 4 : ℝ) with ++ | inl hsmall => ++ exact intervalIntegrable_phi_dyadic_small hA hsmall ++ | inr hge_quarter => ++ cases le_total (2 : ℝ) A with ++ | inl hbig => ++ exact intervalIntegrable_phi_dyadic_large hbig ++ | inr hA_le_two => ++ exact intervalIntegrable_phi_dyadic_middle hge_quarter hA_le_two ++ ++lemma intervalIntegrable_phi_div {a R : ℝ} (ha : 0 < a) (hR : 0 ≤ R) : ++ IntervalIntegrable (fun r : ℝ => φ (r / a)) volume R (2 * R) := by ++ have ha0 : a ≠ 0 := ne_of_gt ha ++ have hRa_nonneg : 0 ≤ R / a := by ++ exact div_nonneg hR (le_of_lt ha) ++ have hφ : IntervalIntegrable φ volume (R / a) (2 * (R / a)) := ++ intervalIntegrable_phi_dyadic (A := (R / a)) hRa_nonneg ++ have := (hφ.comp_mul_right (c := (a⁻¹ : ℝ))) ++ have hupper : a * (R * (a⁻¹ * 2)) = (2 * R) := by ++ field_simp [ha0] ++ simpa [div_eq_mul_inv, ha0, hupper, mul_assoc, mul_left_comm, mul_comm] using this ++ ++lemma log_two_le_Cφ : Real.log 2 ≤ Cφ := by ++ dsimp [Cφ] ++ have hK : 0 ≤ K := K_nonneg ++ linarith [hK] ++ ++lemma four_mul_K_add_one_le_Cφ : (4 * K + 1 : ℝ) ≤ Cφ := by ++ dsimp [Cφ] ++ have hlog_nonneg : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) ++ linarith [hlog_nonneg] ++ ++lemma integral_phi_le_Cφ_mul_small {A : ℝ} (hA0 : 0 ≤ A) (hA : A ≤ (1 / 4 : ℝ)) : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by ++ have hA_le : A ≤ 2 * A := by nlinarith ++ have hφ_int : IntervalIntegrable φ volume A (2 * A) := ++ intervalIntegrable_phi_dyadic_small hA0 hA ++ have hconst : IntervalIntegrable (fun _ : ℝ => (Real.log 2 : ℝ)) volume A (2 * A) := ++ intervalIntegrable_const ++ have hle_int : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ++ ≤ ∫ (t : ℝ) in A..(2 * A), (Real.log 2 : ℝ) ∂volume := by ++ refine intervalIntegral.integral_mono_on (μ := (volume : MeasureTheory.Measure ℝ)) ++ hA_le hφ_int hconst ?_ ++ intro t ht ++ exact phi_le_log_two_on_dyadic_of_le_quarter hA ht ++ have hRHS : ++ (∫ (t : ℝ) in A..(2 * A), (Real.log 2 : ℝ) ∂volume) = A * Real.log 2 := by ++ simp [intervalIntegral.integral_const, sub_eq_add_neg, add_assoc, two_mul] ++ have hcoef : A * Real.log 2 ≤ Cφ * A := by ++ have := mul_le_mul_of_nonneg_left log_two_le_Cφ hA0 ++ simpa [mul_assoc, mul_left_comm, mul_comm] using this ++ exact le_trans (by simpa [hRHS] using hle_int) hcoef ++ ++lemma integral_phi_le_Cφ_mul_large {A : ℝ} (hA : (2 : ℝ) ≤ A) : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by ++ have hA_le : A ≤ 2 * A := by nlinarith ++ have hφ0 : Set.EqOn (fun t : ℝ => φ t) (fun _ => (0 : ℝ)) (Set.uIcc A (2 * A)) := by ++ intro t ht ++ have ht' : t ∈ Set.Icc A (2 * A) := by ++ simpa [Set.uIcc_of_le hA_le] using ht ++ exact phi_eq_zero_of_two_le (le_trans hA ht'.1) ++ have hzero : (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) = 0 := by ++ simpa using intervalIntegral.integral_congr (μ := (volume : MeasureTheory.Measure ℝ)) hφ0 ++ have hnonneg : (0 : ℝ) ≤ Cφ * A := mul_nonneg (le_of_lt Cφ_pos) (by linarith) ++ simpa [hzero] using hnonneg ++ ++lemma integral_sqrt_two_div_abs_one_sub_le_K_dyadic_middle {A : ℝ} ++ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : ++ (∫ (t : ℝ) in A..(2 * A), Real.sqrt (2 / |1 - t|) ∂volume) ≤ K := by ++ let s (t : ℝ) : ℝ := Real.sqrt (2 / |1 - t|) ++ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] ++ have hA_upper' : (2 * A : ℝ) ≤ 4 := by nlinarith [hA_upper] ++ have hsqrt_big : IntervalIntegrable s volume (1 / 4 : ℝ) (4 : ℝ) := by ++ simpa [s] using intervalIntegrable_sqrt_two_div_abs_one_sub_Icc ++ have hle_K : ++ (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ++ ≤ ∫ (t : ℝ) in (1 / 4 : ℝ)..(4 : ℝ), s t ∂volume := by ++ refine intervalIntegral.integral_mono_interval (μ := (volume : MeasureTheory.Measure ℝ)) ++ (c := (1 / 4 : ℝ)) (d := (4 : ℝ)) (a := A) (b := (2 * A)) ++ hA_lower hA_le hA_upper' ?_ hsqrt_big ++ exact Filter.Eventually.of_forall (fun _t => Real.sqrt_nonneg _) ++ simpa [K, s] using hle_K ++ ++lemma K_le_four_mul_K_add_one_mul_of_quarter_le {A : ℝ} (hA : (1 / 4 : ℝ) ≤ A) : ++ K ≤ (4 * K + 1) * A := by ++ have hcoef : 1 ≤ 4 * A := by nlinarith [hA] ++ have hK : 0 ≤ K := K_nonneg ++ nlinarith [hK, hcoef] ++ ++lemma integral_phi_le_Cφ_mul_middle {A : ℝ} ++ (hA_lower : (1 / 4 : ℝ) ≤ A) (hA_upper : A ≤ (2 : ℝ)) : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by ++ let s (t : ℝ) : ℝ := Real.sqrt (2 / |1 - t|) ++ have hA_le : A ≤ 2 * A := by nlinarith [hA_lower] ++ have hφ_int : IntervalIntegrable φ volume A (2 * A) := ++ intervalIntegrable_phi_dyadic_middle hA_lower hA_upper ++ have hsqrt : IntervalIntegrable s volume A (2 * A) := by ++ simpa [s] using ++ intervalIntegrable_sqrt_two_div_abs_one_sub_dyadic_middle hA_lower hA_upper ++ have hle_int : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ++ ≤ ∫ (t : ℝ) in A..(2 * A), s t ∂volume := by ++ refine intervalIntegral.integral_mono_on ++ (μ := (volume : MeasureTheory.Measure ℝ)) hA_le hφ_int hsqrt ?_ ++ intro t _ht ++ exact φ_le_sqrt t ++ have hsqrt_le : (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ≤ (4 * K + 1) * A := by ++ have hK : (∫ (t : ℝ) in A..(2 * A), s t ∂volume) ≤ K := by ++ simpa [s] using integral_sqrt_two_div_abs_one_sub_le_K_dyadic_middle hA_lower hA_upper ++ exact le_trans hK (K_le_four_mul_K_add_one_mul_of_quarter_le hA_lower) ++ have hcoef : (4 * K + 1 : ℝ) * A ≤ Cφ * A := ++ mul_le_mul_of_nonneg_right four_mul_K_add_one_le_Cφ (by nlinarith [hA_lower]) ++ exact le_trans hle_int (le_trans hsqrt_le hcoef) ++ ++lemma integral_phi_le_Cφ_mul {A : ℝ} (hA : 0 ≤ A) : ++ (∫ (t : ℝ) in A..(2 * A), φ t ∂volume) ≤ Cφ * A := by ++ by_cases hA0 : A = 0 ++ · subst hA0 ++ simp [Cφ, φ, K] ++ cases le_total A (1 / 4 : ℝ) with ++ | inl hsmall => ++ exact integral_phi_le_Cφ_mul_small hA hsmall ++ | inr hge_quarter => ++ cases le_total (2 : ℝ) A with ++ | inl hbig => ++ exact integral_phi_le_Cφ_mul_large hbig ++ | inr hA_le_two => ++ exact integral_phi_le_Cφ_mul_middle hge_quarter hA_le_two ++ ++open scoped BigOperators ++ ++lemma volume_Ioc_two_mul_ne_zero {R : ℝ} (hR : 0 < R) : ++ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R)) ≠ 0 := by ++ have hpos : (0 : ℝ) < 2 * R - R := by nlinarith [hR] ++ simp [Real.volume_Ioc, ENNReal.ofReal_eq_zero, not_le_of_gt hpos] ++ ++lemma volume_Ioc_two_mul_diff_finset_ne_zero (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : ++ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by ++ have hbad_meas : (volume : MeasureTheory.Measure ℝ) (bad : Set ℝ) = 0 := by ++ simpa using (bad.measure_zero (μ := (volume : MeasureTheory.Measure ℝ))) ++ have hdiff : ++ (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ++ = (volume : MeasureTheory.Measure ℝ) (Set.Ioc R (2 * R)) := by ++ simpa [Set.sdiff_eq, Set.inter_assoc, Set.inter_left_comm, Set.inter_comm] using ++ (MeasureTheory.measure_sdiff_null (s := Set.Ioc R (2 * R)) (t := (bad : Set ℝ)) ++ hbad_meas) ++ simpa [hdiff] using volume_Ioc_two_mul_ne_zero hR ++ ++lemma restrict_volume_Ioc_two_mul_diff_finset_ne_zero (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : ++ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by ++ have hsubset : Set.Ioc R (2 * R) \ (bad : Set ℝ) ⊆ Set.Ioc R (2 * R) := by ++ intro r hr ++ exact hr.1 ++ have hinter : ++ (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ∩ Set.Ioc R (2 * R) ++ = (Set.Ioc R (2 * R) \ (bad : Set ℝ)) := by ++ exact Set.inter_eq_left.mpr hsubset ++ simpa [MeasureTheory.Measure.restrict_apply, measurableSet_Ioc, hinter] using ++ volume_Ioc_two_mul_diff_finset_ne_zero bad hR ++ ++lemma integral_phi_div_le_Cφ_mul {a R : ℝ} (ha : 0 < a) (hR : 0 ≤ R) : ++ (∫ (r : ℝ) in R..(2 * R), φ (r / a) ∂volume) ≤ Cφ * R := by ++ have ha0 : a ≠ 0 := ne_of_gt ha ++ have hrew : ++ (∫ (r : ℝ) in R..(2 * R), φ (r / a) ∂volume) ++ = a * (∫ (t : ℝ) in (R / a)..(2 * R / a), φ t ∂volume) := by ++ simp [smul_eq_mul, mul_left_comm, mul_comm, div_eq_mul_inv, ha0] ++ rw [hrew] ++ have hA : 0 ≤ R / a := by ++ exact div_nonneg hR ha.le ++ have hle : (∫ (t : ℝ) in (R / a)..(2 * (R / a)), φ t ∂volume) ≤ Cφ * (R / a) := ++ integral_phi_le_Cφ_mul (A := R / a) hA ++ have hEq : (2 * R / a) = 2 * (R / a) := by ring ++ have hle' : ++ (∫ (t : ℝ) in (R / a)..(2 * R / a), φ t ∂volume) ≤ Cφ * (R / a) := by ++ simpa [hEq] using hle ++ have ha_nonneg : 0 ≤ a := ha.le ++ have := mul_le_mul_of_nonneg_left hle' ha_nonneg ++ have hRHS : a * (Cφ * (R / a)) = Cφ * R := by ++ field_simp [ha0] ++ simpa [hRHS, mul_assoc, mul_left_comm, mul_comm] using this ++ ++lemma intervalIntegrable_sum_mul_phi_div ++ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) ++ (ha : ∀ i ∈ s, 0 < a i) {R : ℝ} (hR : 0 ≤ R) : ++ IntervalIntegrable (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) ++ volume R (2 * R) := by ++ refine IntervalIntegrable.sum (μ := volume) (a := R) (b := 2 * R) ++ (s := s) (f := fun i : ι => fun r : ℝ => w i * φ (r / a i)) ?_ ++ intro i hi ++ have hφi : IntervalIntegrable (fun r : ℝ => φ (r / a i)) volume R (2 * R) := ++ intervalIntegrable_phi_div (a := a i) (R := R) (ha i hi) hR ++ simpa [mul_assoc] using hφi.const_mul (w i) ++ ++lemma integral_sum_mul_phi_div_le_Cφ_mul_sum ++ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) ++ (hw : ∀ i ∈ s, 0 ≤ w i) (ha : ∀ i ∈ s, 0 < a i) {R : ℝ} (hR : 0 ≤ R) : ++ (∫ r in R..(2 * R), (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) r ∂volume) ++ ≤ Cφ * (∑ i ∈ s, w i) * R := by ++ have hint : ∀ i ∈ s, IntervalIntegrable (fun r : ℝ => w i * φ (r / a i)) ++ volume R (2 * R) := by ++ intro i hi ++ have hφi : IntervalIntegrable (fun r : ℝ => φ (r / a i)) volume R (2 * R) := ++ intervalIntegrable_phi_div (a := a i) (R := R) (ha i hi) hR ++ simpa [mul_assoc] using hφi.const_mul (w i) ++ have hsum_int : ++ (∫ r in R..(2 * R), (∑ i ∈ s, fun r : ℝ => w i * φ (r / a i)) r ∂volume) ++ = ∑ i ∈ s, ∫ r in R..(2 * R), (fun r : ℝ => w i * φ (r / a i)) r ++ ∂volume := by ++ simpa using ++ (intervalIntegral.integral_finsetSum (μ := volume) (a := R) (b := 2 * R) ++ (s := s) (f := fun i : ι => fun r : ℝ => w i * φ (r / a i)) hint) ++ rw [hsum_int] ++ have hsum_le : ++ (∑ i ∈ s, ∫ r in R..(2 * R), (fun r : ℝ => w i * φ (r / a i)) r ∂volume) ++ ≤ ∑ i ∈ s, w i * (Cφ * R) := by ++ refine Finset.sum_le_sum ?_ ++ intro i hi ++ have hphi : ++ (∫ r in R..(2 * R), φ (r / a i) ∂volume) ≤ Cφ * R := ++ integral_phi_div_le_Cφ_mul (a := a i) (R := R) (ha i hi) hR ++ have := mul_le_mul_of_nonneg_left hphi (hw i hi) ++ simpa [mul_assoc, mul_left_comm, mul_comm] using this ++ refine le_trans hsum_le ?_ ++ have : (∑ i ∈ s, w i * (Cφ * R)) = Cφ * (∑ i ∈ s, w i) * R := by ++ calc ++ (∑ i ∈ s, w i * (Cφ * R)) = (∑ i ∈ s, w i) * (Cφ * R) := by ++ simp [Finset.sum_mul] ++ _ = Cφ * (∑ i ∈ s, w i) * R := by ++ ac_rfl ++ exact le_of_eq this ++ ++lemma exists_radius_Ioc_sum_mul_phi_div_le_Cφ_mul_sum_avoid ++ {ι : Type} (s : Finset ι) (w : ι → ℝ) (a : ι → ℝ) ++ (hw : ∀ i ∈ s, 0 ≤ w i) (ha : ∀ i ∈ s, 0 < a i) ++ (bad : Finset ℝ) {R : ℝ} (hR : 0 < R) : ++ ∃ r ∈ Set.Ioc R (2 * R), r ∉ bad ∧ ++ (∑ i ∈ s, w i * φ (r / a i)) ≤ Cφ * (∑ i ∈ s, w i) := by ++ by_contra hbad ++ have hforall : ++ ∀ r ∈ Set.Ioc R (2 * R), r ∉ bad → ++ Cφ * (∑ i ∈ s, w i) < (∑ i ∈ s, w i * φ (r / a i)) := by ++ intro r hr hrbad ++ have : ¬(∑ i ∈ s, w i * φ (r / a i)) ≤ Cφ * (∑ i ∈ s, w i) := by ++ intro hle ++ exact hbad ⟨r, hr, hrbad, hle⟩ ++ exact lt_of_not_ge this ++ let g : ℝ → ℝ := ∑ i ∈ s, fun r : ℝ => w i * φ (r / a i) ++ have hg_int : IntervalIntegrable g volume R (2 * R) := by ++ simpa [g] using intervalIntegrable_sum_mul_phi_div s w a ha hR.le ++ have hconst_int : ++ IntervalIntegrable (fun _r : ℝ => Cφ * (∑ i ∈ s, w i)) volume R (2 * R) := ++ intervalIntegrable_const ++ have hlt_meas : ++ (volume.restrict (Set.Ioc R (2 * R))) ++ {r | Cφ * (∑ i ∈ s, w i) < g r} ≠ 0 := by ++ have hall : Set.Ioc R (2 * R) \ (bad : Set ℝ) ⊆ {r | Cφ * (∑ i ∈ s, w i) < g r} := by ++ intro r hr ++ have hrIoc : r ∈ Set.Ioc R (2 * R) := hr.1 ++ have hrbad : r ∉ bad := by simpa using hr.2 ++ simpa [g] using hforall r hrIoc hrbad ++ have hle : ++ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ++ ≤ (volume.restrict (Set.Ioc R (2 * R))) {r | Cφ * (∑ i ∈ s, w i) < g r} := ++ MeasureTheory.measure_mono hall ++ have hpos' : ++ (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) ≠ 0 := by ++ exact restrict_volume_Ioc_two_mul_diff_finset_ne_zero bad hR ++ intro hzero ++ have : (volume.restrict (Set.Ioc R (2 * R))) (Set.Ioc R (2 * R) \ (bad : Set ℝ)) = 0 := ++ le_antisymm (le_trans hle (le_of_eq hzero)) (by positivity) ++ exact hpos' this ++ have hlt_int : ++ (∫ r in R..(2 * R), (Cφ * (∑ i ∈ s, w i)) ∂volume) ++ < ∫ r in R..(2 * R), g r ∂volume := by ++ have hab : R ≤ 2 * R := by nlinarith [hR.le] ++ refine intervalIntegral.integral_lt_integral_of_ae_le_of_measure_setOfPred_lt_ne_zero (μ := volume) ++ (a := R) (b := 2 * R) (f := fun _ => (Cφ * (∑ i ∈ s, w i))) (g := g) ++ hab hconst_int hg_int ?_ hlt_meas ++ have hmem : ∀ᵐ r ∂ (volume.restrict (Set.Ioc R (2 * R))), r ∈ Set.Ioc R (2 * R) := ++ MeasureTheory.ae_restrict_mem (by simp) ++ have hnotBad : ++ ∀ᵐ r ∂ (volume.restrict (Set.Ioc R (2 * R))), r ∉ (bad : Set ℝ) := by ++ simpa using ++ (bad.finite_toSet.countable.ae_notMem (μ := (volume.restrict (Set.Ioc R (2 * R))))) ++ filter_upwards [hmem, hnotBad] with r hrIoc hrNotBad ++ have hrNotBad' : r ∉ bad := by simpa using hrNotBad ++ exact le_of_lt (by simpa [g] using hforall r hrIoc hrNotBad') ++ have hconst_eval : ++ (∫ r in R..(2 * R), (Cφ * (∑ i ∈ s, w i)) ∂volume) = Cφ * (∑ i ∈ s, w i) * R := by ++ simp [intervalIntegral.integral_const, sub_eq_add_neg, mul_comm] ++ ring ++ have hg_le : ++ (∫ r in R..(2 * R), g r ∂volume) ≤ Cφ * (∑ i ∈ s, w i) * R := by ++ simpa [g] using integral_sum_mul_phi_div_le_Cφ_mul_sum s w a hw ha hR.le ++ have : ¬(Cφ * (∑ i ∈ s, w i) * R < Cφ * (∑ i ∈ s, w i) * R) := lt_irrefl _ ++ have hcontra : Cφ * (∑ i ∈ s, w i) * R < Cφ * (∑ i ∈ s, w i) * R := by ++ have := hlt_int ++ simpa [hconst_eval] using (this.trans_le hg_le) ++ exact this hcontra ++ ++end CartanBound ++end Complex ++end ++section ++noncomputable section ++ ++namespace Complex.Hadamard ++ ++open _root_.SiegelZeros.Complex _root_.Real _root_.SiegelZeros.Real ++ ++lemma max_one_norm_div_pow_le_one_add_rpow ++ {m : ℕ} {τ r : ℝ} {u a : ℂ} ++ (hur : ‖u‖ = r) ++ (hmτ : (m : ℝ) ≤ τ) : ++ max 1 (‖u / a‖ ^ m) ≤ 1 + (r / ‖a‖) ^ τ := by ++ by_cases hx : ‖u / a‖ ≤ 1 ++ · have hpowm_le1 : ‖u / a‖ ^ m ≤ 1 := pow_le_one₀ (norm_nonneg (u / a)) hx ++ have hr0 : 0 ≤ r := by simpa [hur] using (norm_nonneg u) ++ have hbase : 0 ≤ r / ‖a‖ := div_nonneg hr0 (norm_nonneg a) ++ have hnonneg : 0 ≤ (r / ‖a‖) ^ τ := Real.rpow_nonneg hbase τ ++ have hle1 : (1 : ℝ) ≤ 1 + (r / ‖a‖) ^ τ := le_add_of_nonneg_right hnonneg ++ have hle2 : ‖u / a‖ ^ m ≤ 1 + (r / ‖a‖) ^ τ := hpowm_le1.trans hle1 ++ exact (max_le_iff).2 ⟨hle1, hle2⟩ ++ · have hx1 : 1 < ‖u / a‖ := lt_of_not_ge hx ++ have hpow : ++ (‖u / a‖ : ℝ) ^ (m : ℝ) ≤ (‖u / a‖ : ℝ) ^ τ := ++ Real.rpow_le_rpow_of_exponent_le (le_of_lt hx1) hmτ ++ have hpow' : ‖u / a‖ ^ m ≤ (‖u / a‖ : ℝ) ^ τ := by ++ simpa [Real.rpow_natCast] using hpow ++ have hmax_add : max 1 (‖u / a‖ ^ m) ≤ 1 + ‖u / a‖ ^ m := by ++ refine max_le (le_add_of_nonneg_right (by positivity)) (le_add_of_nonneg_left (by positivity)) ++ have : max 1 (‖u / a‖ ^ m) ≤ 1 + (‖u / a‖ : ℝ) ^ τ := ++ hmax_add.trans (by nlinarith [hpow']) ++ simpa [norm_div, hur] using this ++ ++lemma norm_inv_weierstrassFactor_le_exp_near ++ {m : ℕ} {τ r : ℝ} {u a : ℂ} ++ (hur : ‖u‖ = r) (ha : a ≠ 0) (hr : r ≠ ‖a‖) ++ (hmτ : (m : ℝ) ≤ τ) : ++ ‖(weierstrassFactor m (u / a))⁻¹‖ ++ ≤ Real.exp (CartanBound.φ (r / ‖a‖) + (m : ℝ) * (1 + (r / ‖a‖) ^ τ)) := by ++ have hlog_one : ++ Real.log ‖(1 : ℂ) - u / a‖ ≥ -CartanBound.φ (r / ‖a‖) := ++ CartanBound.log_norm_one_sub_div_ge_neg_phi (hur := hur) (ha := ha) (hr := hr) ++ have hbase := ++ log_norm_weierstrassFactor_ge_log_norm_one_sub_sub (m := m) (z := (u / a)) ++ have hlogE : ++ Real.log ‖weierstrassFactor m (u / a)‖ ++ ≥ -CartanBound.φ (r / ‖a‖) - (m : ℝ) * max 1 (‖u / a‖ ^ m) := by ++ have hpls := ++ norm_partialLogSum_le_nat_mul_max_one_norm_pow m (u / a) ++ linarith [hbase, hlog_one, hpls] ++ have hmax : ++ max 1 (‖u / a‖ ^ m) ≤ 1 + (r / ‖a‖) ^ τ := ++ max_one_norm_div_pow_le_one_add_rpow (m := m) (τ := τ) (r := r) (u := u) (a := a) hur hmτ ++ have hneglog : ++ -Real.log ‖weierstrassFactor m (u / a)‖ ++ ≤ CartanBound.φ (r / ‖a‖) + (m : ℝ) * (1 + (r / ‖a‖) ^ τ) := by ++ have : -Real.log ‖weierstrassFactor m (u / a)‖ ++ ≤ CartanBound.φ (r / ‖a‖) + (m : ℝ) * max 1 (‖u / a‖ ^ m) := by ++ linarith [hlogE] ++ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ exact this.trans (by nlinarith [mul_le_mul_of_nonneg_left hmax hm0]) ++ have hpos : 0 < ‖weierstrassFactor m (u / a)‖ := by ++ have : weierstrassFactor m (u / a) ≠ 0 := by ++ intro h0 ++ have : u / a = (1 : ℂ) := (weierstrassFactor_eq_zero_iff m (u / a)).1 h0 ++ have : u = a := (div_eq_one_iff_eq ha).1 this ++ have : r = ‖a‖ := by simpa [this] using hur.symm ++ exact (hr this).elim ++ exact norm_pos_iff.2 this ++ have hEq : ++ ‖(weierstrassFactor m (u / a))⁻¹‖ = ++ Real.exp (-Real.log ‖weierstrassFactor m (u / a)‖) := by ++ simp [norm_inv, Real.exp_neg, Real.exp_log hpos] ++ have := Real.exp_le_exp.2 hneglog ++ simpa [hEq] using this ++ ++lemma norm_inv_weierstrassFactor_le_exp_far ++ {m : ℕ} {τ r : ℝ} {u a : ℂ} ++ (hur : ‖u‖ = r) (ha : a ≠ 0) ++ (hz : ‖u / a‖ ≤ (1 / 2 : ℝ)) (hτ_le : τ ≤ (m + 1 : ℝ)) : ++ ‖(weierstrassFactor m (u / a))⁻¹‖ ≤ Real.exp ((2 : ℝ) * (r / ‖a‖) ^ τ) := by ++ by_cases hu : u = 0 ++ · subst hu ++ have hr0 : r = 0 := by simpa [hur] using (norm_zero : ‖(0 : ℂ)‖ = 0) ++ subst hr0 ++ have h0 : 0 ≤ ((0 : ℝ) / ‖a‖) ^ τ := by ++ exact Real.rpow_nonneg (by positivity : (0 : ℝ) ≤ 0 / ‖a‖) τ ++ have h0' : 0 ≤ (2 : ℝ) * ((0 : ℝ) / ‖a‖) ^ τ := mul_nonneg (by norm_num) h0 ++ have hexp : (1 : ℝ) ≤ Real.exp ((2 : ℝ) * ((0 : ℝ) / ‖a‖) ^ τ) := ++ (Real.one_le_exp_iff).2 h0' ++ simpa using hexp ++ have hlogE := ++ log_norm_weierstrassFactor_ge_neg_two_pow (m := m) (z := (u / a)) hz ++ have hneglog : -Real.log ‖weierstrassFactor m (u / a)‖ ≤ (2 : ℝ) * (r / ‖a‖) ^ τ := by ++ have h1 : -Real.log ‖weierstrassFactor m (u / a)‖ ≤ (2 : ℝ) * ‖u / a‖ ^ (m + 1) := by ++ linarith [hlogE] ++ set x : ℝ := ‖u / a‖ ++ have hx1 : x ≤ 1 := le_trans (by simpa [x] using hz) (by norm_num) ++ have hxpos : 0 < x := by ++ simpa [x] using (norm_pos_iff.2 (div_ne_zero hu ha)) ++ have hτ_le' : τ ≤ ((m + 1 : ℕ) : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one] using hτ_le ++ have hpow_rpow : x ^ ((m + 1 : ℕ) : ℝ) ≤ x ^ τ := ++ Real.rpow_le_rpow_of_exponent_ge hxpos hx1 hτ_le' ++ have hpow : x ^ (m + 1) ≤ x ^ τ := by ++ simpa [← Real.rpow_natCast] using hpow_rpow ++ have h2x : (2 : ℝ) * x ^ (m + 1) ≤ (2 : ℝ) * x ^ τ := ++ mul_le_mul_of_nonneg_left hpow (by positivity) ++ have h2 : (2 : ℝ) * ‖u / a‖ ^ (m + 1) ≤ (2 : ℝ) * (‖u / a‖ : ℝ) ^ τ := by ++ simpa [x] using h2x ++ have h3 : (‖u‖ / ‖a‖) ^ τ = (r / ‖a‖) ^ τ := by ++ simp [hur] ++ exact (h1.trans h2).trans_eq (by simp [h3]) ++ have hpos : 0 < ‖weierstrassFactor m (u / a)‖ := by ++ have : weierstrassFactor m (u / a) ≠ 0 := by ++ intro h0 ++ have : u / a = (1 : ℂ) := (weierstrassFactor_eq_zero_iff m (u / a)).1 h0 ++ have : u = a := (div_eq_one_iff_eq ha).1 this ++ have : (‖u / a‖ : ℝ) = 1 := by simpa [this] using (by simp [ha]) ++ linarith [hz, this] ++ exact norm_pos_iff.2 this ++ have hEq : ++ ‖(weierstrassFactor m (u / a))⁻¹‖ = ++ Real.exp (-Real.log ‖weierstrassFactor m (u / a)‖) := by ++ simp [norm_inv, Real.exp_neg, Real.exp_log hpos] ++ have := Real.exp_le_exp.2 hneglog ++ simpa [hEq] using this ++ ++end Complex.Hadamard ++end ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Counting.lean b/PrimeNumberTheoremAnd/SiegelZeros/Counting.lean +new file mode 100644 +index 0000000..cc47f9c +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/Counting.lean +@@ -0,0 +1,689 @@ ++import Mathlib ++ ++namespace SiegelZeros ++ ++open _root_.Real _root_.Function _root_.Function.locallyFinsuppWithin ++ ++section ++open Filter Function MeromorphicOn Metric Real Set ++ ++namespace Function.locallyFinsuppWithin ++ ++variable {E : Type*} [NormedAddCommGroup E] ++ ++lemma norm_le_abs_of_mem_toClosedBall_support {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} ++ (hz : z ∈ (toClosedBall r D).support) : ‖z‖ ≤ |r| := by ++ have hz_ball : z ∈ closedBall (0 : E) |r| := (toClosedBall r D).supportWithinDomain hz ++ simpa [mem_closedBall, dist_zero_right] using hz_ball ++ ++lemma toClosedBall_eval_eq_of_norm_le_abs {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} ++ (hz : ‖z‖ ≤ |r|) : toClosedBall r D z = D z := by ++ have hz_ball : z ∈ closedBall (0 : E) |r| := by ++ simpa [mem_closedBall, dist_zero_right] using hz ++ simpa using toClosedBall_eval_within (f := D) hz_ball ++ ++lemma mem_toClosedBall_support_of_mem_support_of_norm_le_abs ++ {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} (hzD : z ∈ D.support) (hzR : ‖z‖ ≤ |r|) : ++ z ∈ (toClosedBall r D).support := by ++ rw [Function.mem_support] ++ rw [toClosedBall_eval_eq_of_norm_le_abs hzR] ++ rwa [Function.mem_support] at hzD ++ ++lemma mem_support_of_mem_toClosedBall_support {D : locallyFinsupp E ℤ} {r : ℝ} {z : E} ++ (hz : z ∈ (toClosedBall r D).support) : z ∈ D.support := by ++ have hnorm : ‖z‖ ≤ |r| := norm_le_abs_of_mem_toClosedBall_support hz ++ rw [Function.mem_support] at hz ⊢ ++ rw [toClosedBall_eval_eq_of_norm_le_abs hnorm] at hz ++ exact hz ++ ++noncomputable def massClosedBall₀ {E : Type*} [NormedAddCommGroup E] [ProperSpace E] ++ (D : locallyFinsupp E ℤ) (R : ℝ) : ℝ := by ++ classical ++ exact ++ (((finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).toFinset).filter ++ (fun z => z ≠ (0 : E))).sum fun z => (D z : ℝ) ++ ++end Function.locallyFinsuppWithin ++ ++namespace Function.locallyFinsuppWithin ++ ++theorem logCounting_divisor_eq_circleAverage_sub_const_of_differentiable ++ {R : ℝ} {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hR : R ≠ 0) : ++ logCounting (divisor f ⊤) R = ++ circleAverage (log ‖f ·‖) 0 R - log ‖meromorphicTrailingCoeffAt f 0‖ := by ++ have hmero : Meromorphic f := fun z => (hf.analyticAt z).meromorphicAt ++ simpa [top_eq_univ] using ++ logCounting_divisor_eq_circleAverage_sub_const (f := f) hmero hR ++ ++end Function.locallyFinsuppWithin ++end ++section ++namespace Real ++ ++theorem log_one_add_exp_le_add_log_two {x : ℝ} (hx : 0 ≤ x) : ++ log (1 + exp x) ≤ x + log 2 := by ++ have hexp_one : (1 : ℝ) ≤ exp x := by ++ simpa using (one_le_exp_iff.2 hx) ++ have hadd : 1 + exp x ≤ 2 * exp x := by linarith ++ have hlog : log (1 + exp x) ≤ log (2 * exp x) := ++ log_le_log (by positivity) hadd ++ calc ++ log (1 + exp x) ≤ log (2 * exp x) := hlog ++ _ = log 2 + x := by simp [log_mul, add_comm] ++ _ = x + log 2 := by ring ++ ++theorem log_one_add_le_add_log_two_of_le_exp {x y : ℝ} (hy : 0 ≤ y) (hx : 0 ≤ x) ++ (hxy : y ≤ exp x) : ++ log (1 + y) ≤ x + log 2 := by ++ have hpos : 0 < (1 : ℝ) + y := by linarith ++ have hle : (1 : ℝ) + y ≤ 1 + exp x := by linarith ++ exact (log_le_log hpos hle).trans (log_one_add_exp_le_add_log_two hx) ++ ++theorem le_exp_of_log_one_add_le {x y : ℝ} (hy : 0 ≤ y) (hxy : log (1 + y) ≤ x) : ++ y ≤ exp x := by ++ have hpos : 0 < (1 : ℝ) + y := by linarith ++ have hone : 1 + y ≤ exp x := (log_le_iff_le_exp hpos).1 hxy ++ linarith ++ ++theorem neg_posLog_inv_le_log (x : ℝ) : -log⁺ x⁻¹ ≤ log x := by ++ linarith [posLog_sub_posLog_inv (x := x), posLog_nonneg (x := x)] ++ ++end Real ++end ++section ++namespace Real ++ ++variable {α E : Type*} [SeminormedAddCommGroup E] ++ ++theorem log_norm_le_log_one_add_norm (w : E) : ++ Real.log ‖w‖ ≤ Real.log (1 + ‖w‖) := by ++ by_cases h0 : ‖w‖ = 0 ++ · simp [h0] ++ · have hpos : 0 < ‖w‖ := lt_of_le_of_ne (norm_nonneg w) (Ne.symm h0) ++ exact Real.log_le_log hpos (by linarith [norm_nonneg w]) ++ ++variable {F : Type*} [NormedAddCommGroup F] ++ ++theorem log_nonneg_mul_inv_norm_of_norm_le {z : F} {r : ℝ} (hz : ‖z‖ ≤ r) : ++ 0 ≤ Real.log (r * ‖z‖⁻¹) := by ++ by_cases hz0 : z = 0 ++ · simp [hz0] ++ · have hzpos : 0 < ‖z‖ := norm_pos_iff.2 hz0 ++ have : (1 : ℝ) ≤ r * ‖z‖⁻¹ := by ++ have : (1 : ℝ) ≤ r / ‖z‖ := (one_le_div hzpos).2 hz ++ simpa [div_eq_mul_inv] using this ++ exact Real.log_nonneg this ++ ++theorem log_two_le_log_two_mul_mul_inv_norm_of_norm_le {z : F} {R : ℝ} (hz0 : z ≠ 0) ++ (hz : ‖z‖ ≤ R) : ++ Real.log 2 ≤ Real.log ((2 * R) * ‖z‖⁻¹) := by ++ have hzpos : 0 < ‖z‖ := norm_pos_iff.2 hz0 ++ have hRdiv : (1 : ℝ) ≤ R / ‖z‖ := (one_le_div hzpos).2 hz ++ have hle2 : (2 : ℝ) ≤ (2 * R) * ‖z‖⁻¹ := by ++ have : (2 : ℝ) ≤ 2 * (R / ‖z‖) := by nlinarith ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using this ++ exact Real.log_le_log (by norm_num) hle2 ++ ++theorem norm_le_exp_mul_rpow_of_exponent_le ++ {f : α → E} {r : α → ℝ} {C ρ τ : ℝ} (hC : 0 ≤ C) (hr : ∀ x, 1 ≤ r x) (hρτ : ρ ≤ τ) ++ (hbound : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ ρ)) : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ) := by ++ intro x ++ refine (hbound x).trans (Real.exp_le_exp.2 ?_) ++ exact mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le (hr x) hρτ) hC ++ ++theorem norm_le_exp_mul_rpow_of_log_growth ++ {f : α → E} {r : α → ℝ} {C ρ τ : ℝ} (hC : 0 ≤ C) (hr : ∀ x, 1 ≤ r x) (hρτ : ρ ≤ τ) ++ (hlog : ∀ x, Real.log (1 + ‖f x‖) ≤ C * (r x) ^ ρ) : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ) := by ++ intro x ++ have hpow : (r x) ^ ρ ≤ (r x) ^ τ := ++ Real.rpow_le_rpow_of_exponent_le (hr x) hρτ ++ have hlogτ : Real.log (1 + ‖f x‖) ≤ C * (r x) ^ τ := ++ (hlog x).trans (mul_le_mul_of_nonneg_left hpow hC) ++ exact Real.le_exp_of_log_one_add_le (norm_nonneg (f x)) hlogτ ++ ++theorem log_growth_of_norm_le_exp_mul_rpow ++ {f : α → E} {r : α → ℝ} {C τ : ℝ} (hC : 0 < C) (hτ : 0 ≤ τ) ++ (hr : ∀ x, 1 ≤ r x) (hbound : ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ)) : ++ ∃ C' > 0, ∀ x, Real.log (1 + ‖f x‖) ≤ C' * (r x) ^ τ := by ++ refine ⟨C + Real.log 2, by ++ have hlog2 : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) ++ linarith, ?_⟩ ++ intro x ++ have hX : (1 : ℝ) ≤ (r x) ^ τ := Real.one_le_rpow (hr x) hτ ++ have hB : 0 ≤ C * (r x) ^ τ := ++ mul_nonneg hC.le (Real.rpow_nonneg (le_trans zero_le_one (hr x)) _) ++ have hlog : ++ Real.log (1 + ‖f x‖) ≤ C * (r x) ^ τ + Real.log 2 := ++ Real.log_one_add_le_add_log_two_of_le_exp (norm_nonneg _) hB (hbound x) ++ have hlog2_nonneg : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) ++ nlinarith [hlog, hX, hlog2_nonneg] ++ ++theorem exists_norm_le_exp_mul_pow_of_rpow_bound ++ {f : α → E} {r : α → ℝ} {τ : ℝ} {n : ℕ} (hr : ∀ x, 1 ≤ r x) (hτn : τ < (n : ℝ)) ++ (hbound : ∃ C > 0, ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ τ)) : ++ ∃ C > 0, ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ n) := by ++ rcases hbound with ⟨C, hCpos, hC⟩ ++ have hweak : ++ ∀ x, ‖f x‖ ≤ Real.exp (C * (r x) ^ (n : ℝ)) := ++ norm_le_exp_mul_rpow_of_exponent_le ++ (f := f) (r := r) hCpos.le hr (le_of_lt hτn) hC ++ refine ⟨C, hCpos, ?_⟩ ++ intro x ++ have hpow : (r x) ^ (n : ℝ) = (r x) ^ n := Real.rpow_natCast (r x) n ++ simpa [hpow] using hweak x ++ ++theorem one_add_le_three_mul_one_add_of_le_two_mul_max {x r : ℝ} (hx : 0 ≤ x) ++ (hr : r ≤ 2 * max x 1) : 1 + r ≤ 3 * (1 + x) := by ++ have hmax : max x 1 ≤ 1 + x := max_le_iff.2 ⟨by linarith, by linarith⟩ ++ nlinarith ++ ++theorem exp_mul_rpow_le_exp_mul_rpow_of_le_mul ++ {A B x y τ : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hy : 0 ≤ y) ++ (hτ : 0 ≤ τ) (hxy : x ≤ B * y) : Real.exp (A * x ^ τ) ≤ Real.exp ((A * B ^ τ) * y ^ τ) := by ++ refine Real.exp_le_exp.2 ?_ ++ have hpow : x ^ τ ≤ (B * y) ^ τ := Real.rpow_le_rpow hx hxy hτ ++ have hsplit : (B * y) ^ τ = B ^ τ * y ^ τ := by ++ simpa using (Real.mul_rpow (x := B) (y := y) (z := τ) hB hy) ++ simpa [mul_assoc] using mul_le_mul_of_nonneg_left (hpow.trans_eq hsplit) hA ++ ++theorem exists_between_self_and_floor_add_one_same_floor {ρ : ℝ} (hρ : 0 ≤ ρ) : ++ ∃ τ : ℝ, ρ < τ ∧ τ < (Nat.floor ρ + 1 : ℝ) ∧ 0 ≤ τ ∧ Nat.floor τ = Nat.floor ρ := by ++ set m : ℕ := Nat.floor ρ ++ set τ : ℝ := (ρ + (m + 1 : ℝ)) / 2 ++ have hm : ρ < (m + 1 : ℝ) := by simpa [m] using Nat.lt_floor_add_one (a := ρ) ++ have hτ : ρ < τ := by dsimp [τ]; linarith ++ have hτ_lt : τ < (m + 1 : ℝ) := by dsimp [τ]; linarith ++ have hτ_nonneg : 0 ≤ τ := le_trans hρ (le_of_lt hτ) ++ have hfloorτ : Nat.floor τ = m := by ++ have hm_le_τ : (m : ℝ) ≤ τ := le_trans (Nat.floor_le hρ) (le_of_lt hτ) ++ have hτ_lt_m1 : τ < (m : ℝ) + 1 := by simpa [add_assoc, add_comm, add_left_comm] using hτ_lt ++ exact (Nat.floor_eq_iff hτ_nonneg).2 ⟨hm_le_τ, hτ_lt_m1⟩ ++ exact ⟨τ, hτ, by simpa [m] using hτ_lt, hτ_nonneg, by simpa [m] using hfloorτ⟩ ++ ++open Metric Complex ++ ++theorem log_norm_le_of_log_one_add_growth_on_sphere {f : ℂ → ℂ} {C ρ R : ℝ} ++ (hC : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {z : ℂ} ++ (hz : z ∈ sphere (0 : ℂ) |R|) : Real.log ‖f z‖ ≤ C * (1 + |R|) ^ ρ := by ++ have hz_norm : ‖z‖ = |R| := by ++ simpa [mem_sphere, dist_zero_right] using hz ++ simpa [hz_norm] using le_trans (log_norm_le_log_one_add_norm (f z)) (hC z) ++ ++end Real ++end ++section ++open Filter _root_.SiegelZeros.Function MeromorphicOn Metric Real Set ++ ++namespace Function.locallyFinsuppWithin ++ ++theorem logCounting_divisor_le_of_log_growth {f : ℂ → ℂ} {ρ C : ℝ} (hf : Differentiable ℂ f) ++ (hC : ∀ z : ℂ, log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {R : ℝ} (hR0 : 0 < R) : ++ logCounting (divisor f (Set.univ : Set ℂ)) R ++ ≤ C * (1 + |R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ have hR : R ≠ 0 := ne_of_gt hR0 ++ have hEq := ++ logCounting_divisor_eq_circleAverage_sub_const_of_differentiable (f := f) hf hR ++ have hf_sphere : MeromorphicOn f (sphere (0 : ℂ) |R|) := by ++ intro z hz ++ exact (hf.analyticAt z).meromorphicAt ++ have hInt : CircleIntegrable (fun z : ℂ => log ‖f z‖) 0 R := ++ MeromorphicOn.circleIntegrable_log_norm hf_sphere ++ have hbound_circle : ∀ z ∈ sphere (0 : ℂ) |R|, ++ log ‖f z‖ ≤ C * (1 + |R|) ^ ρ := by ++ intro z hz ++ exact log_norm_le_of_log_one_add_growth_on_sphere hC hz ++ have hCircleAvg_le : ++ circleAverage (fun z : ℂ => log ‖f z‖) 0 R ≤ C * (1 + |R|) ^ ρ := ++ circleAverage_mono_on_of_le_circle (c := (0 : ℂ)) (R := R) ++ (f := fun z => log ‖f z‖) hInt hbound_circle ++ calc ++ logCounting (divisor f (Set.univ : Set ℂ)) R ++ = circleAverage (fun z : ℂ => log ‖f z‖) 0 R ++ - log ‖meromorphicTrailingCoeffAt f 0‖ := by ++ simpa [top_eq_univ] using hEq ++ _ ≤ circleAverage (fun z : ℂ => log ‖f z‖) 0 R ++ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ have : ++ -log ‖meromorphicTrailingCoeffAt f 0‖ ++ ≤ |log ‖meromorphicTrailingCoeffAt f 0‖| := ++ neg_le_abs (log ‖meromorphicTrailingCoeffAt f 0‖) ++ linarith ++ _ ≤ C * (1 + |R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ nlinarith [hCircleAvg_le] ++ ++variable {E : Type*} [NormedAddCommGroup E] [ProperSpace E] ++ ++theorem log_two_mul_massClosedBall₀_le_logCounting {D : locallyFinsupp E ℤ} (hDnonneg : 0 ≤ D) ++ {R : ℝ} (hR : 1 ≤ R) : ++ (log 2) * massClosedBall₀ D R ≤ logCounting D (2 * R) := by ++ classical ++ have hR0 : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR ++ set r : ℝ := 2 * R ++ have hrpos : 0 < r := by dsimp [r]; nlinarith ++ let Dr := toClosedBall r D ++ have hDr_fin : Set.Finite Dr.support := Dr.finiteSupport (isCompact_closedBall (0 : E) |r|) ++ let F : Finset E := hDr_fin.toFinset ++ let SR : Finset E := ++ (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).toFinset ++ let S : Finset E := SR.filter fun z => z ≠ (0 : E) ++ have hS_sub : S ⊆ F := by ++ intro z hzS ++ have hz_mem_SR : z ∈ SR := (Finset.mem_filter.1 hzS).1 ++ have hzR : z ∈ (toClosedBall R D).support := by ++ exact (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).mem_toFinset.1 ++ hz_mem_SR ++ have hz_norm_le_R : ‖z‖ ≤ R := by ++ have := norm_le_abs_of_mem_toClosedBall_support hzR ++ simpa [abs_of_pos hR0] using this ++ have hz_norm_le_r : ‖z‖ ≤ |r| := by ++ have : ‖z‖ ≤ r := le_trans hz_norm_le_R (by dsimp [r]; nlinarith) ++ simpa [abs_of_pos hrpos] using this ++ have hzD : z ∈ D.support := mem_support_of_mem_toClosedBall_support hzR ++ have : z ∈ Dr.support := by ++ simpa [Dr] using ++ mem_toClosedBall_support_of_mem_support_of_norm_le_abs (D := D) (r := r) hzD hz_norm_le_r ++ exact hDr_fin.mem_toFinset.2 this ++ have hlogCounting : ++ logCounting D r ++ = (F.sum fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) + (D 0 : ℝ) * log r := by ++ have hsupp : Function.support (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) ⊆ F := by ++ intro z hz ++ have : Dr z ≠ 0 := by ++ by_contra h0 ++ simp [Function.mem_support, h0] at hz ++ have : z ∈ Dr.support := by simpa [Function.mem_support] using this ++ exact hDr_fin.mem_toFinset.2 this ++ simp [logCounting, Dr, r, ++ finsum_eq_sum_of_support_subset (f := fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) (s := F) hsupp] ++ have hsum_le : ++ (log 2) * (S.sum fun z => (D z : ℝ)) ++ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := by ++ have hterm_nonneg : ∀ z ∈ F, 0 ≤ (Dr z : ℝ) * log (r * ‖z‖⁻¹) := by ++ intro z hzF ++ have hz_sup : z ∈ Dr.support := hDr_fin.mem_toFinset.1 hzF ++ have hDz : 0 ≤ Dr z := by ++ have hDz' : 0 ≤ D z := hDnonneg z ++ have hDrz : Dr z = D z := ++ toClosedBall_eval_eq_of_norm_le_abs (norm_le_abs_of_mem_toClosedBall_support hz_sup) ++ simpa [hDrz] using hDz' ++ have hlog : 0 ≤ log (r * ‖z‖⁻¹) := by ++ have hzle : ‖z‖ ≤ r := by ++ have hnorm := norm_le_abs_of_mem_toClosedBall_support hz_sup ++ simpa [abs_of_pos hrpos] using hnorm ++ exact log_nonneg_mul_inv_norm_of_norm_le hzle ++ exact mul_nonneg (by exact_mod_cast hDz) hlog ++ have hsumSF : ++ S.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) ++ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := ++ Finset.sum_le_sum_of_subset_of_nonneg hS_sub (by ++ intro z hzF _; exact hterm_nonneg z hzF) ++ have hterm_ge : ∀ z ∈ S, (log 2) * (D z : ℝ) ≤ (Dr z : ℝ) * log (r * ‖z‖⁻¹) := by ++ intro z hzS ++ have hz0 : z ≠ (0 : E) := (Finset.mem_filter.1 hzS).2 ++ have hz_norm_le_R : ‖z‖ ≤ R := by ++ have hz_mem_SR : z ∈ SR := (Finset.mem_filter.1 hzS).1 ++ have hzRsup : z ∈ (toClosedBall R D).support := by ++ exact (finiteSupport (toClosedBall R D) (isCompact_closedBall (0 : E) |R|)).mem_toFinset.1 ++ hz_mem_SR ++ have hnorm := norm_le_abs_of_mem_toClosedBall_support hzRsup ++ simpa [abs_of_pos hR0] using hnorm ++ have hlog_le : log 2 ≤ log (r * ‖z‖⁻¹) := by ++ simpa [r] using log_two_le_log_two_mul_mul_inv_norm_of_norm_le hz0 hz_norm_le_R ++ have hDz_nonneg : 0 ≤ D z := hDnonneg z ++ have hz_in_ballr : z ∈ closedBall (0 : E) |r| := by ++ have : ‖z‖ ≤ r := le_trans hz_norm_le_R (by dsimp [r]; nlinarith) ++ simpa [mem_closedBall, dist_zero_right, abs_of_pos hrpos] using this ++ have hDrz : Dr z = D z := by ++ have hz_norm_le : ‖z‖ ≤ |r| := by ++ simpa [mem_closedBall, dist_zero_right] using hz_in_ballr ++ simpa [Dr] using toClosedBall_eval_eq_of_norm_le_abs (D := D) (r := r) (z := z) hz_norm_le ++ have : (log 2) * (D z : ℝ) ≤ (log (r * ‖z‖⁻¹)) * (D z : ℝ) := ++ mul_le_mul_of_nonneg_right hlog_le (by exact_mod_cast hDz_nonneg) ++ simpa [hDrz, mul_assoc, mul_left_comm, mul_comm] using this ++ calc ++ (log 2) * (S.sum fun z => (D z : ℝ)) ++ = S.sum (fun z => (log 2) * (D z : ℝ)) := by simp [Finset.mul_sum] ++ _ ≤ S.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := ++ Finset.sum_le_sum fun z hz => hterm_ge z hz ++ _ ≤ F.sum (fun z => (Dr z : ℝ) * log (r * ‖z‖⁻¹)) := hsumSF ++ have hcenter_nonneg : 0 ≤ (D 0 : ℝ) * log r := by ++ have hD0 : 0 ≤ D 0 := hDnonneg 0 ++ have hlogr : 0 ≤ log r := log_nonneg (by nlinarith [hR]) ++ exact mul_nonneg (by exact_mod_cast hD0) hlogr ++ have : (log 2) * (S.sum fun z => (D z : ℝ)) ≤ logCounting D r := by ++ rw [hlogCounting] ++ nlinarith [hsum_le, hcenter_nonneg] ++ simpa [massClosedBall₀, r, S, SR] using this ++ ++theorem massClosedBall₀_divisor_le_of_log_growth {f : ℂ → ℂ} {ρ C : ℝ} ++ (hf : Differentiable ℂ f) ++ (hC : ∀ z : ℂ, log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) {R : ℝ} (hR : 1 ≤ R) : ++ massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R ++ ≤ (C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖|) / log 2 := by ++ have hR0 : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR ++ have hlog2pos : 0 < log 2 := log_pos (by norm_num : (1 : ℝ) < 2) ++ have hlow : ++ (log 2) * massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R ++ ≤ logCounting (divisor f (Set.univ : Set ℂ)) (2 * R) := ++ log_two_mul_massClosedBall₀_le_logCounting ++ (D := divisor f (Set.univ : Set ℂ)) ++ (MeromorphicOn.AnalyticOnNhd.divisor_nonneg ++ (hf.differentiableOn.analyticOnNhd isOpen_univ)) hR ++ have hupp : ++ logCounting (divisor f (Set.univ : Set ℂ)) (2 * R) ++ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ have h2R0 : 0 < 2 * R := by nlinarith [hR0] ++ simpa using logCounting_divisor_le_of_log_growth (f := f) (ρ := ρ) (C := C) hf hC ++ (R := 2 * R) h2R0 ++ have hmul : ++ (log 2) * massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R ++ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := ++ hlow.trans hupp ++ have hmul' : ++ massClosedBall₀ (divisor f (Set.univ : Set ℂ)) R * log 2 ++ ≤ C * (1 + |2 * R|) ^ ρ + |log ‖meromorphicTrailingCoeffAt f 0‖| := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using hmul ++ exact (le_div_iff₀ hlog2pos).2 hmul' ++ ++end Function.locallyFinsuppWithin ++end ++section ++open Set ++ ++variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] ++ ++theorem Differentiable.divisor_nonneg {f : ℂ → E} (hf : Differentiable ℂ f) : ++ 0 ≤ MeromorphicOn.divisor f (univ : Set ℂ) := ++ MeromorphicOn.AnalyticOnNhd.divisor_nonneg (hf.differentiableOn.analyticOnNhd isOpen_univ) ++end ++section ++noncomputable section ++ ++open scoped BigOperators ++open Filter ++ ++namespace Real ++ ++lemma two_pow_floor_logb_le {x : ℝ} (hx : 1 ≤ x) : ++ (2 : ℝ) ^ (⌊Real.logb 2 x⌋₊ : ℝ) ≤ x := by ++ have hx0 : 0 < x := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hx ++ have hlog_nonneg : 0 ≤ Real.logb 2 x := ++ Real.logb_nonneg (b := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) hx ++ have hfloor_le : (⌊Real.logb 2 x⌋₊ : ℝ) ≤ Real.logb 2 x := by ++ simpa using (Nat.floor_le hlog_nonneg) ++ exact (Real.le_logb_iff_rpow_le (b := (2 : ℝ)) ++ (x := (⌊Real.logb 2 x⌋₊ : ℝ)) (y := x) ++ (by norm_num : (1 : ℝ) < 2) hx0).1 hfloor_le ++ ++lemma lt_two_pow_floor_logb_add_one {x : ℝ} (hx : 1 ≤ x) : ++ x < (2 : ℝ) ^ ((⌊Real.logb 2 x⌋₊ : ℝ) + 1) := by ++ have hx0 : 0 < x := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hx ++ have hlt : Real.logb 2 x < (⌊Real.logb 2 x⌋₊ : ℝ) + 1 := by ++ simpa using (Nat.lt_floor_add_one (Real.logb 2 x)) ++ exact (Real.logb_lt_iff_lt_rpow (b := (2 : ℝ)) (x := x) ++ (y := (⌊Real.logb 2 x⌋₊ : ℝ) + 1) ++ (by norm_num : (1 : ℝ) < 2) hx0).1 hlt ++ ++lemma dyadicShell_lower_bound {r0 x : ℝ} {k : ℕ} (hr0 : 0 < r0) (hx : r0 ≤ x) ++ (hk : ⌊Real.logb 2 (x / r0)⌋₊ = k) : ++ r0 * (2 : ℝ) ^ (k : ℝ) ≤ x := by ++ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 ++ have hx1 : (1 : ℝ) ≤ x / r0 := by ++ have : r0 / r0 ≤ x / r0 := div_le_div_of_nonneg_right hx hr0.le ++ simpa [hr0ne] using this ++ have hle : (2 : ℝ) ^ (k : ℝ) ≤ x / r0 := by ++ have := Real.two_pow_floor_logb_le (x := x / r0) hx1 ++ simpa [hk] using this ++ have := mul_le_mul_of_nonneg_left hle hr0.le ++ have hxEq : r0 * (x / r0) = x := by ++ field_simp [hr0ne] ++ simpa [mul_assoc, hxEq] using this ++ ++lemma dyadicShell_upper_bound {r0 x : ℝ} {k : ℕ} (hr0 : 0 < r0) (hx : r0 ≤ x) ++ (hk : ⌊Real.logb 2 (x / r0)⌋₊ = k) : ++ x ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1) := by ++ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 ++ have hx1 : (1 : ℝ) ≤ x / r0 := by ++ have : r0 / r0 ≤ x / r0 := div_le_div_of_nonneg_right hx hr0.le ++ simpa [hr0ne] using this ++ have hlt : x / r0 < (2 : ℝ) ^ ((k : ℝ) + 1) := by ++ have := Real.lt_two_pow_floor_logb_add_one (x := x / r0) hx1 ++ simpa [hk] using this ++ have := mul_lt_mul_of_pos_left hlt hr0 ++ have hxEq : r0 * (x / r0) = x := by ++ field_simp [hr0ne] ++ exact le_of_lt (by simpa [mul_assoc, hxEq] using this) ++ ++lemma exists_nat_le_two_pow (A : ℝ) : ++ ∃ k0 : ℕ, ∀ n ≥ k0, A ≤ (2 : ℝ) ^ n := by ++ have htend : Tendsto (fun n : ℕ => (2 : ℝ) ^ n) atTop atTop := ++ tendsto_pow_atTop_atTop_of_one_lt (r := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) ++ exact eventually_atTop.1 ((tendsto_atTop.1 htend) A) ++ ++lemma one_le_dyadicRadius_succ_of_inv_le_two_pow ++ {r0 : ℝ} {k0 kk : ℕ} (hr0 : 0 < r0) ++ (hk0 : ∀ n ≥ k0, (1 / r0 : ℝ) ≤ (2 : ℝ) ^ n) (hkk : k0 ≤ kk + 1) : ++ (1 : ℝ) ≤ r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) := by ++ have hr0ne : r0 ≠ 0 := ne_of_gt hr0 ++ have hpow_nat : (1 / r0 : ℝ) ≤ (2 : ℝ) ^ (kk + 1) := hk0 (kk + 1) hkk ++ have hpow_rpow : (1 / r0 : ℝ) ≤ (2 : ℝ) ^ ((kk : ℝ) + 1) := by ++ have hcast : (2 : ℝ) ^ ((kk : ℝ) + 1) = (2 : ℝ) ^ (kk + 1) := by ++ calc ++ (2 : ℝ) ^ ((kk : ℝ) + 1) = (2 : ℝ) ^ ((kk + 1 : ℕ) : ℝ) := by ++ simp [Nat.cast_add, Nat.cast_one] ++ _ = (2 : ℝ) ^ (kk + 1) := by ++ simpa using (Real.rpow_natCast (2 : ℝ) (kk + 1)) ++ simpa [hcast] using hpow_nat ++ have : (r0 * (1 / r0) : ℝ) ≤ r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) := ++ mul_le_mul_of_nonneg_left hpow_rpow hr0.le ++ simpa [one_div, hr0ne, mul_assoc] using this ++ ++lemma one_add_abs_two_mul_dyadicRadius_rpow_le {r0 ρ : ℝ} (k : ℕ) ++ (hr0 : 0 < r0) (hρ : 0 ≤ ρ) : ++ (1 + |2 * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1))|) ^ ρ ++ ≤ (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by ++ let Rk : ℝ := r0 * (2 : ℝ) ^ ((k : ℝ) + 1) ++ have hRk' : |2 * Rk| = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by ++ have hnonneg : 0 ≤ (2 : ℝ) * Rk := by ++ have : 0 ≤ Rk := by ++ dsimp [Rk] ++ exact mul_nonneg hr0.le (le_of_lt (Real.rpow_pos_of_pos (by norm_num) _)) ++ nlinarith ++ have hmul : (2 : ℝ) * Rk = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by ++ dsimp [Rk] ++ calc ++ (2 : ℝ) * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) ++ = (2 * r0) * (2 : ℝ) ^ ((k : ℝ) + 1) := by ring ++ _ = (2 * r0) * ((2 : ℝ) ^ (k : ℝ) * (2 : ℝ) ^ (1 : ℝ)) := by ++ simp [Real.rpow_add, mul_assoc] ++ _ = (2 * r0) * ((2 : ℝ) ^ (k : ℝ) * 2) := by simp [Real.rpow_one] ++ _ = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := by ring ++ calc ++ |2 * Rk| = 2 * Rk := abs_of_nonneg hnonneg ++ _ = 4 * r0 * (2 : ℝ) ^ (k : ℝ) := hmul ++ have hbase : ++ (1 + |2 * Rk|) ≤ (1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ) := by ++ have h1 : (1 : ℝ) ≤ (2 : ℝ) ^ (k : ℝ) := by ++ have : (1 : ℝ) ≤ (2 : ℝ) ^ (k : ℕ) := by ++ simpa using (one_le_pow₀ (by norm_num : (1 : ℝ) ≤ (2 : ℝ))) ++ simpa [Real.rpow_natCast] using this ++ have habs : ++ 1 + |2 * Rk| ≤ (2 : ℝ) ^ (k : ℝ) + (4 * r0) * (2 : ℝ) ^ (k : ℝ) := by ++ rw [hRk'] ++ simpa [add_assoc, add_left_comm, add_comm, mul_assoc, mul_left_comm, mul_comm] using ++ (add_le_add_right h1 ((4 * r0) * (2 : ℝ) ^ (k : ℝ))) ++ have hfac : ++ (2 : ℝ) ^ (k : ℝ) + (4 * r0) * (2 : ℝ) ^ (k : ℝ) ++ = (1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ) := by ++ ring ++ exact habs.trans (le_of_eq hfac) ++ have hRnonneg : 0 ≤ (1 + |2 * Rk|) := by linarith [abs_nonneg (2 * Rk)] ++ have : ++ (1 + |2 * Rk|) ^ ρ ≤ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ := ++ Real.rpow_le_rpow hRnonneg hbase hρ ++ have hsplit : ++ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ ++ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ (k : ℝ)) ^ ρ := by ++ have h1 : 0 ≤ (1 + 4 * r0) := by nlinarith [hr0.le] ++ have h2 : 0 ≤ (2 : ℝ) ^ (k : ℝ) := ++ le_of_lt (Real.rpow_pos_of_pos (by norm_num) _) ++ simpa using (Real.mul_rpow h1 h2 (z := ρ)) ++ have hpow : ((2 : ℝ) ^ (k : ℝ)) ^ ρ = ((2 : ℝ) ^ ρ) ^ k := by ++ have h2nonneg : (0 : ℝ) ≤ 2 := by norm_num ++ calc ++ ((2 : ℝ) ^ (k : ℝ)) ^ ρ = (2 : ℝ) ^ ((k : ℝ) * ρ) := by ++ simp [Real.rpow_mul] ++ _ = ((2 : ℝ) ^ ρ) ^ (k : ℝ) := by ++ simpa [mul_comm] using ++ (Real.rpow_mul (x := (2 : ℝ)) (y := ρ) (z := (k : ℝ)) h2nonneg) ++ _ = ((2 : ℝ) ^ ρ) ^ k := by ++ simp [Real.rpow_natCast] ++ calc ++ (1 + |2 * (r0 * (2 : ℝ) ^ ((k : ℝ) + 1))|) ^ ρ ++ = (1 + |2 * Rk|) ^ ρ := by rfl ++ _ ≤ ((1 + 4 * r0) * (2 : ℝ) ^ (k : ℝ)) ^ ρ := this ++ _ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ (k : ℝ)) ^ ρ := hsplit ++ _ = (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by ++ simpa [mul_assoc] using congrArg (fun t => (1 + 4 * r0) ^ ρ * t) hpow ++ ++lemma tsum_inv_rpow_le_card_mul_of_lower_bound {α : Type*} [Fintype α] {a : α → ℝ} ++ {R τ : ℝ} (hR : 0 < R) (hτ : 0 < τ) (ha_nonneg : ∀ x, 0 ≤ a x) ++ (ha_lower : ∀ x, R ≤ a x) : ++ (∑' x : α, (a x)⁻¹ ^ τ) ≤ (Fintype.card α : ℝ) * (R⁻¹ ^ τ) := by ++ have hsum_le : ++ (∑ x : α, (a x)⁻¹ ^ τ) ≤ ∑ _x : α, R⁻¹ ^ τ := by ++ refine Finset.sum_le_sum ?_ ++ intro x _hx ++ have hinv : (a x)⁻¹ ≤ R⁻¹ := by ++ simpa using (inv_anti₀ hR (ha_lower x)) ++ exact Real.rpow_le_rpow (inv_nonneg.2 (ha_nonneg x)) hinv hτ.le ++ simpa [tsum_fintype, Finset.sum_const, nsmul_eq_mul, mul_comm] using hsum_le ++ ++lemma inv_dyadicRadius_rpow_eq (r0 τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : ++ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = ++ (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by ++ have h2k_nonneg : 0 ≤ (2 : ℝ) ^ (k : ℝ) := ++ le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) ++ calc ++ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = ++ (r0 * (2 : ℝ) ^ (k : ℝ)) ^ (-τ) := by ++ simpa using (Real.rpow_neg_eq_inv_rpow (r0 * (2 : ℝ) ^ (k : ℝ)) τ).symm ++ _ = r0 ^ (-τ) * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) := by ++ simpa using (Real.mul_rpow hr0 h2k_nonneg (z := -τ)) ++ _ = (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by ++ have hr0' : r0 ^ (-τ) = (r0⁻¹ : ℝ) ^ τ := by ++ simp [Real.rpow_neg_eq_inv_rpow] ++ have h2' : ((2 : ℝ) ^ (k : ℝ)) ^ (-τ) = ((2 : ℝ) ^ (-τ)) ^ k := by ++ have h2nonneg : (0 : ℝ) ≤ (2 : ℝ) := by norm_num ++ calc ++ ((2 : ℝ) ^ (k : ℝ)) ^ (-τ) = (2 : ℝ) ^ ((k : ℝ) * (-τ)) := by ++ exact (Real.rpow_mul (x := (2 : ℝ)) (y := (k : ℝ)) (z := -τ) ++ h2nonneg).symm ++ _ = (2 : ℝ) ^ ((-τ) * (k : ℝ)) := by ring_nf ++ _ = ((2 : ℝ) ^ (-τ)) ^ (k : ℝ) := by ++ exact Real.rpow_mul (x := (2 : ℝ)) (y := -τ) (z := (k : ℝ)) h2nonneg ++ _ = ((2 : ℝ) ^ (-τ)) ^ k := by ++ simp [Real.rpow_natCast] ++ calc ++ r0 ^ (-τ) * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) ++ = (r0⁻¹ : ℝ) ^ τ * (((2 : ℝ) ^ (k : ℝ)) ^ (-τ)) := by ++ rw [hr0'] ++ _ = (r0⁻¹ : ℝ) ^ τ * ((2 : ℝ) ^ (-τ)) ^ k := by ++ rw [h2'] ++ ++lemma two_rpow_sub_eq_mul_neg (ρ τ : ℝ) : ++ (2 : ℝ) ^ (ρ - τ) = (2 : ℝ) ^ ρ * (2 : ℝ) ^ (-τ) := by ++ have h2pos : (0 : ℝ) < (2 : ℝ) := by norm_num ++ calc ++ (2 : ℝ) ^ (ρ - τ) = (2 : ℝ) ^ (ρ + (-τ)) := by ring_nf ++ _ = (2 : ℝ) ^ ρ * (2 : ℝ) ^ (-τ) := by ++ simp [Real.rpow_add h2pos] ++ ++lemma two_rpow_sub_pow_eq_mul_pow (ρ τ : ℝ) (k : ℕ) : ++ ((2 : ℝ) ^ (ρ - τ)) ^ k = ++ ((2 : ℝ) ^ ρ) ^ k * (((2 : ℝ) ^ (-τ)) ^ k) := by ++ simp [two_rpow_sub_eq_mul_neg, mul_pow] ++ ++lemma dyadic_growth_inv_term_eq (C L M r0 ρ τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : ++ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * ++ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ = (((C / L) * M) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (ρ - τ)) ^ k := by ++ have hrk_inv : ++ (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ = ++ (r0⁻¹ : ℝ) ^ τ * (((2 : ℝ) ^ (-τ)) ^ k) := ++ inv_dyadicRadius_rpow_eq r0 τ k hr0 ++ rw [hrk_inv, two_rpow_sub_pow_eq_mul_pow] ++ ac_rfl ++ ++lemma dyadic_trailing_inv_term_le (C L r0 τ : ℝ) (k : ℕ) (hr0 : 0 ≤ r0) : ++ (C / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ ≤ (((C / L) + 1) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (-τ)) ^ k := by ++ rw [inv_dyadicRadius_rpow_eq r0 τ k hr0] ++ have hcoeff : C / L ≤ C / L + 1 := by linarith ++ have hr0Inv_nonneg : 0 ≤ (r0⁻¹ : ℝ) ^ τ := ++ Real.rpow_nonneg (inv_nonneg.2 hr0) _ ++ have hmul : ++ (C / L) * ((r0⁻¹ : ℝ) ^ τ) ++ ≤ ((C / L) + 1) * ((r0⁻¹ : ℝ) ^ τ) := ++ mul_le_mul_of_nonneg_right hcoeff hr0Inv_nonneg ++ have hqpow_nonneg : 0 ≤ ((2 : ℝ) ^ (-τ)) ^ k := ++ pow_nonneg (le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _)) _ ++ have := mul_le_mul_of_nonneg_right hmul hqpow_nonneg ++ simpa [mul_assoc, mul_left_comm, mul_comm] using this ++ ++lemma dyadic_growth_mass_mul_inv_le_geometric {C L M X T Ctrail r0 ρ τ : ℝ} {k : ℕ} ++ (hL : 0 < L) (hC : 0 ≤ C) (hr0 : 0 ≤ r0) ++ (hX : X ≤ M * ((2 : ℝ) ^ ρ) ^ k) ++ (hT : T ≤ ((C * X + Ctrail) / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) : ++ T ≤ (((C / L) * M) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (ρ - τ)) ^ k ++ + (((Ctrail / L) + 1) * (r0⁻¹ : ℝ) ^ τ) * ((2 : ℝ) ^ (-τ)) ^ k := by ++ have hmul : C * X ≤ C * (M * ((2 : ℝ) ^ ρ) ^ k) := ++ mul_le_mul_of_nonneg_left hX hC ++ have hnum : C * X + Ctrail ≤ C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail := ++ add_le_add hmul le_rfl ++ have hdiv : ++ (C * X + Ctrail) / L ≤ (C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L := ++ div_le_div_of_nonneg_right hnum hL.le ++ have h2k_nonneg : 0 ≤ (2 : ℝ) ^ (k : ℝ) := ++ le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) (k : ℝ)) ++ have hrk_nonneg : 0 ≤ r0 * (2 : ℝ) ^ (k : ℝ) := ++ mul_nonneg hr0 h2k_nonneg ++ have hfactor_nonneg : 0 ≤ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) := ++ Real.rpow_nonneg (inv_nonneg.2 hrk_nonneg) τ ++ have hmul' := ++ mul_le_mul_of_nonneg_right hdiv hfactor_nonneg ++ have hdecomp : ++ ((C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L) * ++ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ = ++ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * ++ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ + ((Ctrail / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) := by ++ let Y : ℝ := (r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ ++ have : ++ ((C * (M * ((2 : ℝ) ^ ρ) ^ k) + Ctrail) / L) * Y ++ = ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * Y ++ + ((Ctrail / L) * Y) := by ++ ring ++ simpa [Y] ++ have hpre : ++ T ≤ ((C / L) * (M * ((2 : ℝ) ^ ρ) ^ k)) * ++ ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ) ++ + ((Ctrail / L) * ((r0 * (2 : ℝ) ^ (k : ℝ))⁻¹ ^ τ)) := ++ hT.trans (hmul'.trans_eq hdecomp) ++ have hA := le_of_eq (dyadic_growth_inv_term_eq C L M r0 ρ τ k hr0) ++ have hB := dyadic_trailing_inv_term_le Ctrail L r0 τ k hr0 ++ exact hpre.trans (by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using add_le_add hA hB) ++ ++lemma two_geometric_shift_add (A B q qσ : ℝ) (k k0 : ℕ) : ++ A * q ^ (k + k0) + B * qσ ^ (k + k0) ++ = (A * q ^ k0) * q ^ k + (B * qσ ^ k0) * qσ ^ k := by ++ rw [pow_add, pow_add] ++ ac_rfl ++ ++end Real ++end ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/DivisorBasics.lean b/PrimeNumberTheoremAnd/SiegelZeros/DivisorBasics.lean +new file mode 100644 +index 0000000..e5a553a +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/DivisorBasics.lean +@@ -0,0 +1,590 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.Products ++ ++namespace SiegelZeros ++ ++section ++open Filter Topology Set ++ ++namespace MeromorphicOn ++ ++variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {U K : Set 𝕜} {z : 𝕜} ++ {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] ++ ++lemma divisor_support_inter_compact_finite (f : 𝕜 → E) {U K : Set 𝕜} ++ (hK : IsCompact K) (hKU : K ⊆ U) : ++ (K ∩ (MeromorphicOn.divisor f U).support).Finite := by ++ classical ++ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U ++ have hloc : ++ ∀ x ∈ K, ∃ V : Set 𝕜, V ∈ 𝓝 x ∧ Set.Finite (V ∩ D.support) := by ++ intro x hxK ++ rcases D.supportLocallyFiniteWithinDomain x (hKU hxK) with ⟨V, hV, hfin⟩ ++ exact ⟨V, hV, hfin⟩ ++ choose V hVnhds hVfin using hloc ++ rcases hK.elim_nhds_subcover' (U := fun x hx => V x hx) (hU := fun x hx => hVnhds x hx) with ++ ⟨t, ht⟩ ++ have hsub : ++ K ∩ D.support ⊆ ⋃ x ∈ t, (V (x : 𝕜) x.2 ∩ D.support) := by ++ intro y hy ++ rcases hy with ⟨hyK, hyS⟩ ++ have hycov : y ∈ ⋃ x ∈ t, V (x : 𝕜) x.2 := ht hyK ++ rcases Set.mem_iUnion.1 hycov with ⟨x, hycov'⟩ ++ rcases Set.mem_iUnion.1 hycov' with ⟨hxT, hyV⟩ ++ refine Set.mem_iUnion.2 ⟨x, Set.mem_iUnion.2 ?_⟩ ++ exact ⟨hxT, ⟨hyV, hyS⟩⟩ ++ have hfinU : Set.Finite (⋃ x ∈ t, (V (x : 𝕜) x.2 ∩ D.support)) := by ++ classical ++ refine (t.finite_toSet).biUnion ?_ ++ intro x hx ++ simpa using (hVfin (x : 𝕜) x.2) ++ exact hfinU.subset hsub ++ ++end MeromorphicOn ++end ++section ++open Set ++ ++namespace Complex.Hadamard ++ ++def divisorZeroIndex (f : ℂ → ℂ) (U : Set ℂ) : Type := ++ Σ z : ℂ, Fin (Int.toNat (MeromorphicOn.divisor f U z)) ++ ++abbrev divisorZeroIndex₀ (f : ℂ → ℂ) (U : Set ℂ) : Type := ++ {p : divisorZeroIndex f U // p.1 ≠ 0} ++ ++abbrev divisorZeroIndex₀Val {f : ℂ → ℂ} {U : Set ℂ} (p : divisorZeroIndex₀ f U) : ℂ := ++ p.1.1 ++ ++@[simp] ++lemma divisorZeroIndex₀Val_ne_zero {f : ℂ → ℂ} {U : Set ℂ} (p : divisorZeroIndex₀ f U) : ++ divisorZeroIndex₀Val p ≠ 0 := p.2 ++ ++@[simp] ++lemma divisorZeroIndex₀Val_mem_divisor_support {f : ℂ → ℂ} {U : Set ℂ} ++ (p : divisorZeroIndex₀ f U) : ++ MeromorphicOn.divisor f U (divisorZeroIndex₀Val p) ≠ 0 := by ++ have hn : ++ Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p)) ≠ 0 := by ++ intro h0 ++ have q0 : Fin 0 := by ++ simpa [divisorZeroIndex₀Val, h0] using p.1.2 ++ exact Fin.elim0 q0 ++ intro hdiv ++ have : Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p)) = 0 := by ++ simp [hdiv] ++ exact hn this ++ ++noncomputable def divisorCanonicalProduct (m : ℕ) (f : ℂ → ℂ) (U : Set ℂ) (z : ℂ) : ℂ := ++ ∏' p : divisorZeroIndex₀ f U, weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ ++@[simp] ++lemma divisorCanonicalProduct_zero (m : ℕ) (f : ℂ → ℂ) (U : Set ℂ) : ++ divisorCanonicalProduct m f U 0 = 1 := by ++ simp [divisorCanonicalProduct] ++ ++end Complex.Hadamard ++end ++section ++namespace Complex ++ ++section UniformMul ++ ++theorem _root_.SiegelZeros.TendstoUniformlyOn.mul_left_bounded {ι : Type*} {p : Filter ι} {K : Set ℂ} ++ {F : ι → ℂ → ℂ} {f : ℂ → ℂ} {h : ℂ → ℂ} ++ (hF : TendstoUniformlyOn F f p K) (hh : ∃ C, ∀ z ∈ K, ‖h z‖ ≤ C) : ++ TendstoUniformlyOn (fun n z => h z * F n z) (fun z => h z * f z) p K := by ++ intro u hu ++ rcases Metric.mem_uniformity_dist.1 hu with ⟨ε, hεpos, hεu⟩ ++ rcases hh with ⟨C, hC⟩ ++ set C' : ℝ := max C 1 ++ have hC'pos : 0 < C' := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ have hC' : ∀ z ∈ K, ‖h z‖ ≤ C' := fun z hz => le_trans (hC z hz) (le_max_left _ _) ++ have hv : {p : ℂ × ℂ | dist p.1 p.2 < ε / C'} ∈ uniformity ℂ := ++ Metric.mem_uniformity_dist.2 ⟨ε / C', div_pos hεpos hC'pos, fun _ _ hab => hab⟩ ++ have hF' : ∀ᶠ n in p, ∀ z : ℂ, z ∈ K → dist (f z) (F n z) < ε / C' := hF _ hv ++ filter_upwards [hF'] with n hn z hzK ++ have hn' : ‖f z - F n z‖ < ε / C' := by simpa [dist_eq_norm] using hn z hzK ++ have hle : ‖h z‖ * ‖f z - F n z‖ ≤ C' * ‖f z - F n z‖ := ++ mul_le_mul_of_nonneg_right (hC' z hzK) (norm_nonneg _) ++ have hlt : C' * ‖f z - F n z‖ < C' * (ε / C') := mul_lt_mul_of_pos_left hn' hC'pos ++ have hnorm : ++ ‖h z * f z - h z * F n z‖ = ‖h z‖ * ‖f z - F n z‖ := by ++ calc ++ ‖h z * f z - h z * F n z‖ = ‖h z * (f z - F n z)‖ := by simp [mul_sub] ++ _ = ‖h z‖ * ‖f z - F n z‖ := by simp ++ have hdist : dist (h z * f z) (h z * F n z) < ε := by ++ rw [dist_eq_norm, hnorm] ++ have hlt' : ‖h z‖ * ‖f z - F n z‖ < ε := by ++ calc ++ ‖h z‖ * ‖f z - F n z‖ ≤ C' * ‖f z - F n z‖ := hle ++ _ < C' * (ε / C') := hlt ++ _ = ε := by field_simp [hC'pos.ne'] ++ exact hlt' ++ exact hεu hdist ++ ++end UniformMul ++ ++end Complex ++end ++section ++open Filter Function _root_.SiegelZeros.Complex _root_.Function.Complex Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++lemma finite_divisorZeroIndex₀_subtype_norm_le {f : ℂ → ℂ} {U : Set ℂ} (B : ℝ) ++ (hBU : Metric.closedBall (0 : ℂ) B ⊆ U) : ++ Finite {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ B} := by ++ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U ++ have hK : IsCompact (Metric.closedBall (0 : ℂ) B) := isCompact_closedBall _ _ ++ have hpts0 : ((Metric.closedBall (0 : ℂ) B) ∩ D.support).Finite := ++ MeromorphicOn.divisor_support_inter_compact_finite (f := f) (U := U) ++ (K := Metric.closedBall (0 : ℂ) B) hK hBU ++ set pts : Set ℂ := ((Metric.closedBall (0 : ℂ) B) ∩ D.support) \ {0} ++ have hpts : pts.Finite := hpts0.sdiff ++ let : Fintype pts := hpts.fintype ++ let T : Type := Σ z : pts, Fin (Int.toNat (D z.1)) ++ have : Finite T := by infer_instance ++ let F : ++ {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ B} → T := fun p => ++ ⟨⟨divisorZeroIndex₀Val p.1, by ++ have hball : divisorZeroIndex₀Val p.1 ∈ Metric.closedBall (0 : ℂ) B := by ++ simpa [Metric.mem_closedBall, dist_zero_right] using p.2 ++ have hsupport : divisorZeroIndex₀Val p.1 ∈ D.support := by ++ have hne_toNat : ++ Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p.1)) ≠ 0 := by ++ intro h0 ++ have hpfin : ++ Fin (Int.toNat (MeromorphicOn.divisor f U (divisorZeroIndex₀Val p.1))) := by ++ simpa [D] using p.1.1.2 ++ have : Fin 0 := by simpa [h0] using hpfin ++ exact Fin.elim0 this ++ have hne_D : D (divisorZeroIndex₀Val p.1) ≠ 0 := by ++ intro hD0 ++ apply hne_toNat ++ simp [D, hD0] ++ simp [D, Function.locallyFinsuppWithin.support, Function.support] ++ have hne0 : divisorZeroIndex₀Val p.1 ≠ 0 := divisorZeroIndex₀Val_ne_zero p.1 ++ exact ⟨⟨hball, hsupport⟩, by simp [Set.mem_singleton_iff]⟩⟩, ++ p.1.1.2⟩ ++ refine Finite.of_injective F ?_ ++ intro p q hpq ++ apply Subtype.ext ++ apply Subtype.ext ++ have h' := (Sigma.mk.inj_iff.1 hpq) ++ have hz : divisorZeroIndex₀Val p.1 = divisorZeroIndex₀Val q.1 := congrArg Subtype.val h'.1 ++ apply (Sigma.mk.inj_iff).2 ++ refine ⟨hz, ?_⟩ ++ exact h'.2 ++ ++lemma divisorZeroIndex₀_norm_le_finite {f : ℂ → ℂ} {U : Set ℂ} (B : ℝ) ++ (hBU : Metric.closedBall (0 : ℂ) B ⊆ U) : ++ ({p : divisorZeroIndex₀ f U | ‖divisorZeroIndex₀Val p‖ ≤ B} : Set _).Finite := by ++ let s : Set (divisorZeroIndex₀ f U) := {p | ‖divisorZeroIndex₀Val p‖ ≤ B} ++ have : Finite (↥s) := ++ finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := U) B hBU ++ exact Set.toFinite s ++ ++lemma norm_div_le_half_of_norm_le_of_two_mul_lt {z a : ℂ} {R : ℝ} ++ (hR : 0 < R) (hz : ‖z‖ ≤ R) (ha : (2 * R : ℝ) < ‖a‖) : ++ ‖z / a‖ ≤ (1 / 2 : ℝ) := by ++ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hR] ++ have hinv : ‖a‖⁻¹ < (2 * R)⁻¹ := by ++ simpa [one_div] using one_div_lt_one_div_of_lt h2R_pos ha ++ have hmul_le : ‖z‖ * ‖a‖⁻¹ ≤ R * ‖a‖⁻¹ := ++ mul_le_mul_of_nonneg_right hz (inv_nonneg.2 (norm_nonneg a)) ++ have hmul_lt : R * ‖a‖⁻¹ < R * (2 * R)⁻¹ := ++ mul_lt_mul_of_pos_left hinv hR ++ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by ++ have hRne : (R : ℝ) ≠ 0 := hR.ne' ++ rw [show R * (2 * R)⁻¹ = R / (2 * R) by simp [div_eq_mul_inv]] ++ field_simp [hRne] ++ have hnorm : ‖z / a‖ = ‖z‖ * ‖a‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ exact le_of_lt <| by ++ calc ++ ‖z / a‖ = ‖z‖ * ‖a‖⁻¹ := hnorm ++ _ ≤ R * ‖a‖⁻¹ := hmul_le ++ _ < R * (2 * R)⁻¹ := hmul_lt ++ _ = (1 / 2 : ℝ) := hRhalf ++ ++theorem summable_logDerivTerms_divisorZeroIndex₀_of_summable_inv_sq ++ {f : ℂ → ℂ} {z : ℂ} ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) ++ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ 1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by ++ let R : ℝ := max ‖z‖ 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ have hzle : ‖z‖ ≤ R := le_max_left _ _ ++ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (2 * R) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ)) ++ have hu : Summable u := h_sum.mul_left (2 * R) ++ refine hu.of_norm_bounded_eventually ?_ ++ have h_big : ++ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, ++ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ++ 2 * R} : Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ exact divisorZeroIndex₀_norm_le_finite ++ (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this ++ have := hfin.eventually_cofinite_notMem ++ filter_upwards [this] with p hp ++ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp ++ exact lt_of_not_ge this ++ filter_upwards [h_big] with p hp ++ let a : ℂ := divisorZeroIndex₀Val p ++ have ha0 : a ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ have hza0 : z - a ≠ 0 := sub_ne_zero.mpr (hz p) ++ have hterm : 1 / (z - a) + 1 / a = z / (a * (z - a)) := by ++ field_simp [ha0, hza0] ++ ring ++ have htri : ‖a‖ ≤ ‖z‖ + ‖z - a‖ := by ++ have hraw : ‖a‖ ≤ ‖z‖ + ‖a - z‖ := by ++ have h := norm_add_le z (a - z) ++ simpa [a, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h ++ simpa [norm_sub_rev] using hraw ++ have hza_lower : ‖a‖ / 2 ≤ ‖z - a‖ := by ++ nlinarith [htri, hzle, hp] ++ have hnorm : ‖1 / (z - a) + 1 / a‖ ≤ (2 * R) * (‖a‖⁻¹ ^ (2 : ℕ)) := by ++ rw [hterm, norm_div, norm_mul] ++ have ha_norm_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha0 ++ have hza_norm_pos : 0 < ‖z - a‖ := norm_pos_iff.mpr hza0 ++ rw [div_eq_mul_inv] ++ calc ++ ‖z‖ * (‖a‖ * ‖z - a‖)⁻¹ ++ = ‖z‖ * ‖a‖⁻¹ * ‖z - a‖⁻¹ := by ++ field_simp [ha_norm_pos.ne', hza_norm_pos.ne'] ++ _ ≤ R * ‖a‖⁻¹ * ‖z - a‖⁻¹ := by ++ gcongr ++ _ ≤ R * ‖a‖⁻¹ * (2 * ‖a‖⁻¹) := by ++ gcongr ++ have hhalf_pos : 0 < ‖a‖ / 2 := by positivity ++ have hinv : ‖z - a‖⁻¹ ≤ (‖a‖ / 2)⁻¹ := by ++ simpa [one_div] using one_div_le_one_div_of_le hhalf_pos hza_lower ++ have hhalf_inv : (‖a‖ / 2)⁻¹ = 2 * ‖a‖⁻¹ := by field_simp [ha_norm_pos.ne'] ++ simpa [hhalf_inv] using hinv ++ _ = (2 * R) * (‖a‖⁻¹ ^ (2 : ℕ)) := by ring ++ simpa [u, a] using hnorm ++ ++theorem hasProdUniformlyOn_divisorCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) {K : Set ℂ} (hK : IsCompact K) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ HasProdUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) K := by ++ rcases (isBounded_iff_forall_norm_le.1 hK.isBounded) with ⟨R0, hR0⟩ ++ set R : ℝ := max R0 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ have hnormK : ∀ z ∈ K, ‖z‖ ≤ R := fun z hzK => le_trans (hR0 z hzK) (le_max_left _ _) ++ let g : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1 ++ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) ++ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) ++ have h_big : ++ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, ++ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 2 * R} : ++ Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this ++ have := hfin.eventually_cofinite_notMem ++ filter_upwards [this] with p hp ++ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp ++ exact lt_of_not_ge this ++ have hBound : ++ ∀ᶠ p in Filter.cofinite, ∀ z ∈ K, ‖g p z‖ ≤ u p := by ++ filter_upwards [h_big] with p hp z hzK ++ have hzle : ‖z‖ ≤ R := hnormK z hzK ++ have hz_div : ‖z / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by ++ exact norm_div_le_half_of_norm_le_of_two_mul_lt hRpos hzle hp ++ have hE : ++ ‖weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1‖ ≤ ++ 4 * ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) := ++ weierstrassFactor_sub_one_pow_bound (m := m) (z := z / divisorZeroIndex₀Val p) hz_div ++ have hz_pow : ++ ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ ++ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ have : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ rw [this] ++ have : (‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = ++ ‖z‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ simp [mul_pow] ++ rw [this] ++ have hzle_pow : ‖z‖ ^ (m + 1) ≤ R ^ (m + 1) := ++ pow_le_pow_left₀ (norm_nonneg z) hzle (m + 1) ++ gcongr ++ dsimp [g, u] ++ nlinarith [hE, hz_pow] ++ have hcts : ∀ p, ContinuousOn (g p) K := by ++ intro p ++ have hcontE : Continuous (fun z : ℂ => weierstrassFactor m z) := ++ (differentiable_weierstrassFactor m).continuous ++ have hdiv : Continuous fun z : ℂ => z / divisorZeroIndex₀Val p := by ++ simpa [div_eq_mul_inv] using! (continuous_id.mul continuous_const) ++ have hcont : Continuous fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) := ++ hcontE.comp hdiv ++ simpa only [g] using hcont.continuousOn.fun_sub continuous_const.continuousOn ++ have hprod : ++ HasProdUniformlyOn (fun p z ↦ 1 + g p z) (fun z ↦ ∏' p, (1 + g p z)) K := by ++ simpa using ++ Summable.hasProdUniformlyOn_one_add (f := g) (u := u) (K := K) hK hu hBound hcts ++ simpa [g, divisorCanonicalProduct, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] ++ using! hprod ++ ++theorem hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ (Set.univ : Set ℂ) := by ++ refine hasProdLocallyUniformlyOn_of_forall_compact ++ (f := fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (g := divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ (s := (Set.univ : Set ℂ)) isOpen_univ ?_ ++ intro K hKU hK ++ simpa using ++ (hasProdUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) (K := K) hK h_sum) ++ ++theorem differentiableOn_divisorCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ DifferentiableOn ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) (Set.univ : Set ℂ) := by ++ have hloc : ++ TendstoLocallyUniformlyOn ++ (fun (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) => ++ ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ Filter.atTop (Set.univ : Set ℂ) := by ++ simpa [HasProdLocallyUniformlyOn] using ++ (hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum) ++ have hF : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in Filter.atTop, ++ DifferentiableOn ℂ ++ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (Set.univ : Set ℂ) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro s ++ have hdiff : ++ Differentiable ℂ ++ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) := by ++ let F : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ have hF' : ∀ p ∈ s, Differentiable ℂ (F p) := by ++ intro p hp ++ have hdiv : Differentiable ℂ (fun z : ℂ => z / divisorZeroIndex₀Val p) := by ++ have : Differentiable ℂ (fun z : ℂ => z * ((divisorZeroIndex₀Val p)⁻¹)) := ++ (differentiable_id : Differentiable ℂ (fun z : ℂ => z)).mul_const ++ ((divisorZeroIndex₀Val p)⁻¹) ++ simp [div_eq_mul_inv] ++ exact (differentiable_weierstrassFactor m).comp hdiv ++ simpa [F] using (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := F) (u := s) hF') ++ simpa using hdiff.differentiableOn ++ have : (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))).NeBot := ++ Filter.atTop_neBot ++ exact hloc.differentiableOn hF isOpen_univ ++ ++theorem differentiableAt_divisorCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : ++ DifferentiableAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := ++ ((differentiableOn_divisorCanonicalProduct_univ m f h_sum) z (by simp)).differentiableAt ++ (by simp) ++ ++theorem logDeriv_divisorCanonicalProduct_one_eq_tsum ++ {f : ℂ → ℂ} {z : ℂ} ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) ++ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) ++ (hprod_ne : divisorCanonicalProduct 1 f (Set.univ : Set ℂ) z ≠ 0) : ++ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z = ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by ++ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p w => weierstrassFactor 1 (w / divisorZeroIndex₀Val p) ++ have hf : ∀ p, Φ p z ≠ 0 := by ++ intro p ++ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ refine weierstrassFactor_ne_zero_of_ne_one 1 ?_ ++ intro h ++ exact hz p ((div_eq_one_iff_eq hp0).1 h) ++ have hd : ∀ p, DifferentiableOn ℂ (Φ p) (Set.univ : Set ℂ) := by ++ intro p ++ have hdiv : Differentiable ℂ (fun w : ℂ => w / divisorZeroIndex₀Val p) := by ++ have : Differentiable ℂ (fun w : ℂ => w * ((divisorZeroIndex₀Val p)⁻¹)) := ++ (differentiable_id : Differentiable ℂ (fun w : ℂ => w)).mul_const ++ ((divisorZeroIndex₀Val p)⁻¹) ++ simp [div_eq_mul_inv] ++ exact ((differentiable_weierstrassFactor 1).comp hdiv).differentiableOn ++ have hm' : Summable fun p => logDeriv (Φ p) z := by ++ have hm : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ 1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := ++ summable_logDerivTerms_divisorZeroIndex₀_of_summable_inv_sq h_sum hz ++ refine hm.congr ?_ ++ intro p ++ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ simpa [Φ] using ++ (Complex.logDeriv_weierstrassFactor_one_div ++ (a := divisorZeroIndex₀Val p) (z := z) hp0 (hz p)).symm ++ have htend : MultipliableLocallyUniformlyOn Φ (Set.univ : Set ℂ) := by ++ have hprod := hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ ++ (m := 1) (f := f) h_sum ++ simpa [Φ, divisorCanonicalProduct] using hprod.multipliableLocallyUniformlyOn ++ have hnez : (∏' p, Φ p z) ≠ 0 := by ++ simpa [Φ, divisorCanonicalProduct] using hprod_ne ++ have hlog : logDeriv (∏' p, Φ p ·) z = ∑' p, logDeriv (Φ p) z := ++ logDeriv_tprod_eq_tsum (s := (Set.univ : Set ℂ)) isOpen_univ (by simp) ++ hf hd hm' htend hnez ++ calc ++ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z ++ = ∑' p, logDeriv (Φ p) z := by ++ simpa [Φ, divisorCanonicalProduct] using! hlog ++ _ = ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := by ++ refine tsum_congr fun p => ?_ ++ have hp0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ simpa [Φ] using ++ Complex.logDeriv_weierstrassFactor_one_div ++ (a := divisorZeroIndex₀Val p) (z := z) hp0 (hz p) ++ ++end Complex.Hadamard ++end ++section ++noncomputable section ++ ++open Set ++open scoped Topology BigOperators ++ ++namespace Complex.Hadamard ++ ++lemma divisor_univ_eq_analyticOrderNatAt_int {f : ℂ → ℂ} (hf : Differentiable ℂ f) (z : ℂ) : ++ MeromorphicOn.divisor f (Set.univ : Set ℂ) z = (analyticOrderNatAt f z : ℤ) := by ++ have hmero : MeromorphicOn f (Set.univ : Set ℂ) := by ++ intro w hw ++ exact (Differentiable.analyticAt (f := f) hf w).meromorphicAt ++ simp only ++ [MeromorphicOn.divisor_apply hmero (by simp : z ∈ (Set.univ : Set ℂ)), analyticOrderNatAt] ++ have han : AnalyticAt ℂ f z := Differentiable.analyticAt (f := f) hf z ++ cases h : analyticOrderAt f z with ++ | top => ++ simp [han.meromorphicOrderAt_eq, h] ++ | coe n => ++ simp [han.meromorphicOrderAt_eq, h] ++ ++theorem divisorZeroIndex₀_fiber_finite (f : ℂ → ℂ) (z₀ : ℂ) : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | divisorZeroIndex₀Val p = z₀} : ++ Set _).Finite := by ++ have hsub : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | divisorZeroIndex₀Val p = z₀} : Set _) ++ ⊆ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ‖z₀‖} : ++ Set _) := by ++ intro p hp ++ have : divisorZeroIndex₀Val p = z₀ := hp ++ simp [this] ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ‖z₀‖} : ++ Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) ‖z₀‖ ⊆ (Set.univ : Set ℂ) := by simp ++ simpa using (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) ++ (B := ‖z₀‖) this) ++ exact hfin.subset hsub ++ ++def divisorZeroIndex₀FiberFinset (f : ℂ → ℂ) (z₀ : ℂ) : ++ Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ (divisorZeroIndex₀_fiber_finite (f := f) z₀).toFinset ++ ++@[simp] ++lemma mem_divisorZeroIndex₀FiberFinset (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : ++ p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ↔ divisorZeroIndex₀Val p = z₀ := by ++ simp [divisorZeroIndex₀FiberFinset] ++ ++theorem eventually_atTop_subset_fiberFinset ++ (f : ℂ → ℂ) (z₀ : ℂ) : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), ++ divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s := by ++ refine (Filter.eventually_atTop.2 ?_) ++ refine ⟨divisorZeroIndex₀FiberFinset (f := f) z₀, ?_⟩ ++ intro s hs ++ exact hs ++ ++lemma divisorZeroIndex₀FiberFinset_card_eq_toNat_divisor (f : ℂ → ℂ) {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = ++ Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) := by ++ let S : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := {p | divisorZeroIndex₀Val p = z₀} ++ have hS : S.Finite := divisorZeroIndex₀_fiber_finite (f := f) z₀ ++ set n : ℕ := Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) ++ have hcard : Nat.card S = n := by ++ classical ++ have : Fintype S := hS.fintype ++ ++ let e : S ≃ Fin n := ++ { toFun := by ++ intro x ++ rcases x with ⟨p, hp⟩ ++ rcases p with ⟨⟨z, q⟩, hz⟩ ++ have hzEq : z = z₀ := by simpa [divisorZeroIndex₀Val] using! hp ++ subst hzEq ++ simpa [n] using q ++ invFun := by ++ intro q ++ refine ⟨⟨⟨z₀, ?_⟩, hz₀⟩, ?_⟩ ++ · simpa [n] using q ++ · simp [S, divisorZeroIndex₀Val] ++ left_inv := by ++ rintro ⟨p, hp⟩ ++ rcases p with ⟨⟨z, q⟩, hz⟩ ++ have hzEq : z = z₀ := by simpa [divisorZeroIndex₀Val] using! hp ++ subst hzEq ++ (ext; rfl) ++ right_inv := by ++ intro q ++ rfl } ++ have h := Nat.card_congr (α := S) (β := Fin n) e ++ simpa using (h.trans (by simp)) ++ have hSncard : S.ncard = n := by ++ simpa [Nat.card_coe_set_eq] using hcard ++ have hto : hS.toFinset = divisorZeroIndex₀FiberFinset (f := f) z₀ := by ++ rfl ++ have htoFinset : S.ncard = (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by ++ have h' : S.ncard = hS.toFinset.card := Set.ncard_eq_toFinset_card S hS ++ simpa [hto] using h' ++ exact htoFinset.symm.trans hSncard ++ ++lemma divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt ++ {f : ℂ → ℂ} (hf : Differentiable ℂ f) {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = analyticOrderNatAt f z₀ := by ++ have hdiv : ++ MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀ = (analyticOrderNatAt f z₀ : ℤ) := ++ divisor_univ_eq_analyticOrderNatAt_int (f := f) hf z₀ ++ have htoNat : Int.toNat (MeromorphicOn.divisor f (Set.univ : Set ℂ) z₀) = ++ analyticOrderNatAt f z₀ := by ++ simp [hdiv] ++ exact (divisorZeroIndex₀FiberFinset_card_eq_toNat_divisor (f := f) (z₀ := z₀) hz₀).trans htoNat ++ ++lemma not_mem_divisorZeroIndex₀FiberFinset_iff_val_ne ++ {f : ℂ → ℂ} (z₀ : ℂ) (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : ++ p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀ ↔ divisorZeroIndex₀Val p ≠ z₀ := by ++ simp [mem_divisorZeroIndex₀FiberFinset] ++ ++end Complex.Hadamard ++end ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/DivisorLimits.lean b/PrimeNumberTheoremAnd/SiegelZeros/DivisorLimits.lean +new file mode 100644 +index 0000000..4325f1f +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/DivisorLimits.lean +@@ -0,0 +1,422 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.DivisorProducts ++ ++namespace SiegelZeros ++ ++section ++open Filter Function _root_.SiegelZeros.Complex _root_.Function.Complex Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++theorem differentiableOn_divisorPartialProduct_div_pow_sub ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) (k : ℕ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : ++ DifferentiableOn ℂ (fun z : ℂ => (divisorPartialProduct m f s z) / (z - z₀) ^ k) ++ ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hdiff_prod : DifferentiableOn ℂ (divisorPartialProduct m f s) (Set.univ : Set ℂ) := by ++ exact (differentiable_divisorPartialProduct m f s).differentiableOn ++ have hdiff_den : DifferentiableOn ℂ (fun z : ℂ => (z - z₀) ^ k) ((Set.univ : Set ℂ) \ {z₀}) := by ++ have : Differentiable ℂ (fun z : ℂ => (z - z₀) ^ k) := by ++ fun_prop ++ exact this.differentiableOn ++ by_cases hk : k = 0 ++ · subst hk ++ simpa [pow_zero] using! (hdiff_prod.mono (by intro z hz; exact hz.1)) ++ · have hne : ∀ z ∈ ((Set.univ : Set ℂ) \ {z₀}), (fun z : ℂ => (z - z₀) ^ k) z ≠ 0 := by ++ intro z hz ++ have hz' : z ≠ z₀ := by ++ simpa [Set.mem_sdiff, Set.mem_singleton_iff] using hz.2 ++ exact pow_ne_zero _ (sub_ne_zero.mpr hz') ++ have hdiff_inv : ++ DifferentiableOn ℂ (fun z : ℂ => ((z - z₀) ^ k)⁻¹) ((Set.univ : Set ℂ) \ {z₀}) := ++ hdiff_den.inv hne ++ simpa [div_eq_mul_inv] using! (hdiff_prod.mono (by intro z hz; exact hz.1)).mul hdiff_inv ++ ++theorem differentiableOn_divisorCanonicalProduct_div_pow_sub ++ (m : ℕ) (f : ℂ → ℂ) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) (k : ℕ) : DifferentiableOn ℂ ++ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) ++ ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hopen : IsOpen ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hset : ((Set.univ : Set ℂ) \ {z₀}) = ({z₀} : Set ℂ)ᶜ := by ++ ext z; simp ++ simp [hset] ++ have hconv := ++ tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m := m) (f := f) h_sum (z₀ := z₀) (k := k) ++ refine hconv.differentiableOn ?_ hopen ++ refine Filter.Eventually.of_forall ?_ ++ intro s ++ exact differentiableOn_divisorPartialProduct_div_pow_sub (m := m) (f := f) (z₀ := z₀) (k := k) s ++ ++theorem differentiableOn_update_limUnder_divisorCanonicalProduct_div_pow ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ∃ r > 0, DifferentiableOn ℂ (Function.update ++ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) z₀ ++ (limUnder (𝓝[≠] z₀) (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card))) ++ (Metric.ball z₀ r) := by ++ rcases bddAbove_norm_divisorCanonicalProduct_div_pow_puncturedBall (m := m) (f := f) ++ (h_sum := h_sum) (z₀ := z₀) with ⟨r, hrpos, hbdd⟩ ++ refine ⟨r, hrpos, ?_⟩ ++ have hnhds : Metric.ball z₀ r ∈ 𝓝 z₀ := Metric.ball_mem_nhds z₀ hrpos ++ have hdiff : DifferentiableOn ℂ (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ ((Metric.ball z₀ r) \ {z₀}) := by ++ have hglob := ++ differentiableOn_divisorCanonicalProduct_div_pow_sub ++ (m := m) (f := f) h_sum (z₀ := z₀) ++ (k := (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ refine hglob.mono ?_ ++ intro z hz ++ exact ⟨by simp, hz.2⟩ ++ have hb : BddAbove (norm ∘ (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) '' ++ ((Metric.ball z₀ r) \ {z₀})) := hbdd ++ simpa using ++ (Complex.differentiableOn_update_limUnder_of_bddAbove (f := fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ (s := Metric.ball z₀ r) (c := z₀) hnhds hdiff hb) ++ ++theorem analyticAt_update_limUnder_divisorCanonicalProduct_div_pow ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : AnalyticAt ℂ (Function.update (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) z₀ ++ (limUnder (𝓝[≠] z₀) (fun z : ℂ => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card))) ++ z₀ := by ++ rcases ++ differentiableOn_update_limUnder_divisorCanonicalProduct_div_pow ++ (m := m) (f := f) h_sum (z₀ := z₀) with ⟨r, hrpos, hdiff⟩ ++ let g : ℂ → ℂ := ++ Function.update ++ (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ z₀ ++ (limUnder (𝓝[≠] z₀) fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ have hcont : ContinuousAt g z₀ := ++ (hdiff.differentiableAt (Metric.ball_mem_nhds z₀ hrpos)).continuousAt ++ have hd : ++ ∀ᶠ z in 𝓝[≠] z₀, DifferentiableAt ℂ g z := by ++ have hballWithin : Metric.ball z₀ r ∈ 𝓝[≠] z₀ := by ++ refine mem_nhdsWithin_iff_exists_mem_nhds_inter.2 ?_ ++ refine ⟨Metric.ball z₀ r, Metric.ball_mem_nhds z₀ hrpos, ?_⟩ ++ intro z hz ++ exact hz.1 ++ filter_upwards [hballWithin] with z hz ++ exact (hdiff z hz).differentiableAt (Metric.isOpen_ball.mem_nhds hz) ++ simpa [g] using Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt hd hcont ++ ++theorem exists_analyticAt_divisorCanonicalProduct_quotient ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ++ ∃ q : ℂ → ℂ, ++ AnalyticAt ℂ q z₀ ∧ ++ q z₀ = ++ limUnder (𝓝[≠] z₀) (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ∧ ++ ∀ z : ℂ, z ≠ z₀ → ++ q z = ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by ++ let q : ℂ → ℂ := ++ Function.update ++ (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ z₀ ++ (limUnder (𝓝[≠] z₀) fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) ++ refine ⟨q, ?_, ?_, ?_⟩ ++ · simpa [q] using ++ analyticAt_update_limUnder_divisorCanonicalProduct_div_pow ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) ++ · simp [q] ++ · intro z hz ++ simp [q, Function.update_of_ne hz] ++ ++theorem analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by ++ set k : ℕ := (divisorZeroIndex₀FiberFinset (f := f) z₀).card ++ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) ++ let q0 : ℂ → ℂ := fun z => F z / (z - z₀) ^ k ++ rcases exists_analyticAt_divisorCanonicalProduct_quotient ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) with ++ ⟨q, hqA, hq_self, hq_ne⟩ ++ have hdiff_univ : DifferentiableOn ℂ F (Set.univ : Set ℂ) := ++ differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ have han : AnalyticAt ℂ F z₀ := by ++ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ have : DifferentiableWithinAt ℂ F (Set.univ : Set ℂ) z := hdiff_univ z (by simp) ++ exact this.differentiableAt (by simp) ++ rcases ++ exists_ball_eq_divisorCanonicalProduct_div_pow_eq (m := m) (f := f) (h_sum := h_sum) ++ (z₀ := z₀) ++ with ⟨ε, hε, u, huA, hu0, hEq⟩ ++ let g : ℂ → ℂ := fun z => (divisorComplementCanonicalProduct m f z₀ z) * u z ++ have hcompDiff : DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) ++ (Set.univ : Set ℂ) := ++ differentiableOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) h_sum ++ have hcompCont : ContinuousAt (divisorComplementCanonicalProduct m f z₀) z₀ := ++ (hcompDiff z₀ (by simp)).differentiableAt (by simp) |>.continuousAt ++ have hgCont : ContinuousAt g z₀ := (hcompCont.mul huA.continuousAt) ++ have hg0 : g z₀ ≠ 0 := by ++ have hcomp0 : divisorComplementCanonicalProduct m f z₀ z₀ ≠ 0 := ++ divisorComplementCanonicalProduct_ne_zero_at (m := m) (f := f) (z₀ := z₀) h_sum ++ exact mul_ne_zero hcomp0 hu0 ++ have hne_mem : ∀ᶠ z in 𝓝[≠] z₀, z ∈ (({z₀} : Set ℂ)ᶜ) := ++ Filter.eventually_of_mem ++ (self_mem_nhdsWithin : (({z₀} : Set ℂ)ᶜ) ∈ 𝓝[≠] z₀) (fun _ hz => hz) ++ have hne : ∀ᶠ z in 𝓝[≠] z₀, z ≠ z₀ := by ++ filter_upwards [hne_mem] with z hz ++ simpa [Set.mem_compl_singleton_iff] using hz ++ have ht_q0 : Tendsto q0 (𝓝[≠] z₀) (𝓝 (g z₀)) := by ++ have hball : ∀ᶠ z in 𝓝[≠] z₀, z ∈ Metric.ball z₀ ε := ++ Filter.eventually_of_mem ++ (mem_nhdsWithin_of_mem_nhds (Metric.ball_mem_nhds z₀ hε)) (fun _ hz => hz) ++ have heq : q0 =ᶠ[𝓝[≠] z₀] g := by ++ filter_upwards [hball, hne] with z hz hzne ++ have hq := hEq z hz hzne ++ simpa [q0, F, k, g, smul_eq_mul] using hq ++ exact (hgCont.continuousWithinAt.tendsto.congr' heq.symm) ++ have hlim : limUnder (𝓝[≠] z₀) q0 = g z₀ := ht_q0.limUnder_eq ++ have hq0 : q z₀ ≠ 0 := by ++ have hq_self' : q z₀ = limUnder (𝓝[≠] z₀) q0 := by ++ simpa [q0, F, k] using hq_self ++ have : q z₀ = g z₀ := hq_self'.trans hlim ++ exact this.symm ▸ hg0 ++ have heq_punct : (fun z : ℂ => F z) =ᶠ[𝓝[≠] z₀] fun z : ℂ => (z - z₀) ^ k • q z := by ++ filter_upwards [hne] with z hz ++ have hzpow : (z - z₀) ^ k ≠ 0 := pow_ne_zero _ (sub_ne_zero.mpr hz) ++ have hq : q z = q0 z := by simpa [q0, F, k] using hq_ne z hz ++ have hmul : (z - z₀) ^ k * q0 z = F z := by ++ calc ++ (z - z₀) ^ k * q0 z ++ = (((z - z₀) ^ k) * F z) / ((z - z₀) ^ k) := by ++ simp [q0, div_eq_mul_inv, mul_assoc] ++ _ = F z := by ++ simpa [mul_assoc] using (mul_div_cancel_left₀ (F z) hzpow) ++ have : F z = (z - z₀) ^ k * q z := by ++ calc ++ F z = (z - z₀) ^ k * q0 z := hmul.symm ++ _ = (z - z₀) ^ k * q z := by simp [hq] ++ simpa [smul_eq_mul] using this ++ have hcontF : ContinuousAt F z₀ := ++ (hdiff_univ z₀ (by simp)).differentiableAt (by simp) |>.continuousAt ++ have hcontq : ContinuousAt q z₀ := hqA.continuousAt ++ have h_at_z0 : F z₀ = (z₀ - z₀) ^ k • q z₀ := by ++ have ht1 : Tendsto F (𝓝[≠] z₀) (𝓝 (F z₀)) := hcontF.continuousWithinAt.tendsto ++ have hpow : ++ Tendsto (fun z : ℂ => (z - z₀) ^ k) (𝓝[≠] z₀) (𝓝 ((z₀ - z₀) ^ k)) := ++ ((continuousAt_id.sub continuousAt_const).pow k).continuousWithinAt.tendsto ++ have ht2 : ++ Tendsto (fun z : ℂ => (z - z₀) ^ k • q z) (𝓝[≠] z₀) ++ (𝓝 ((z₀ - z₀) ^ k • q z₀)) := ++ hpow.mul (hcontq.continuousWithinAt.tendsto) ++ have ht2' : Tendsto F (𝓝[≠] z₀) (𝓝 ((z₀ - z₀) ^ k • q z₀)) := ++ ht2.congr' heq_punct.symm ++ exact tendsto_nhds_unique ht1 ht2' ++ have hfac : ∀ᶠ z in 𝓝 z₀, F z = (z - z₀) ^ k • q z := by ++ have hball1 : Metric.ball z₀ 1 ∈ 𝓝 z₀ := Metric.ball_mem_nhds z₀ (by norm_num) ++ have hball1' : ∀ᶠ z in 𝓝 z₀, z ∈ Metric.ball z₀ 1 := ++ Filter.eventually_of_mem hball1 (fun _ hz => hz) ++ filter_upwards [hball1'] with z _hz ++ by_cases hz0 : z = z₀ ++ · subst hz0 ++ simpa using h_at_z0 ++ · have hzpow : (z - z₀) ^ k ≠ 0 := pow_ne_zero _ (sub_ne_zero.mpr hz0) ++ have hq : q z = q0 z := by simpa [q0, F, k] using hq_ne z hz0 ++ have hmul : (z - z₀) ^ k * q0 z = F z := by ++ calc ++ (z - z₀) ^ k * q0 z ++ = (((z - z₀) ^ k) * F z) / ((z - z₀) ^ k) := by ++ simp [q0, div_eq_mul_inv, mul_assoc] ++ _ = F z := by ++ simpa [mul_assoc] using (mul_div_cancel_left₀ (F z) hzpow) ++ have : F z = (z - z₀) ^ k * q z := by ++ calc ++ F z = (z - z₀) ^ k * q0 z := hmul.symm ++ _ = (z - z₀) ^ k * q z := by simp [hq] ++ simpa [smul_eq_mul] using this ++ have hk' : analyticOrderAt F z₀ = k := ++ (han.analyticOrderAt_eq_natCast (n := k)).2 ⟨q, hqA, hq0, hfac⟩ ++ have hkNat : analyticOrderNatAt F z₀ = k := by ++ simp [analyticOrderNatAt, hk'] ++ simpa [F, k] using hkNat ++ ++theorem analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ {z₀ : ℂ} (hz₀ : z₀ ≠ 0) : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = ++ analyticOrderNatAt f z₀ := by ++ have hcp : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card := ++ analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card (m := m) (f := f) (h_sum := h_sum) ++ (z₀ := z₀) ++ have hfib : ++ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = analyticOrderNatAt f z₀ := ++ divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt (hf := hf) (z₀ := z₀) hz₀ ++ simpa [hfib] using hcp ++ ++end Complex.Hadamard ++end ++section ++namespace Complex.Hadamard ++ ++open scoped Topology ++open Set ++ ++lemma analyticOrderAt_ne_top_of_exists_ne_zero {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (hnot : ∃ z : ℂ, f z ≠ 0) : ++ ∀ z : ℂ, analyticOrderAt f z ≠ ⊤ := by ++ rcases hnot with ⟨z1, hz1⟩ ++ have hf_an : AnalyticOnNhd ℂ f (Set.univ : Set ℂ) := by ++ intro z hz ++ exact (Differentiable.analyticAt (f := f) hf z) ++ have hz1_not_top : analyticOrderAt f z1 ≠ ⊤ := by ++ have : analyticOrderAt f z1 = 0 := ++ (hf.analyticAt z1).analyticOrderAt_eq_zero.2 hz1 ++ simp [this] ++ intro z ++ exact AnalyticOnNhd.analyticOrderAt_ne_top_of_isPreconnected (hf := hf_an) ++ (U := (Set.univ : Set ℂ)) (x := z1) (y := z) (by simpa using isPreconnected_univ) ++ (by simp) (by simp) hz1_not_top ++ ++lemma no_zero_on_sphere_of_forall_val_norm_ne ++ {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ {B r : ℝ} (hrpos : 0 < r) (hBr : r ≤ B) (hr_not : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖ ≤ B → r ≠ ‖divisorZeroIndex₀Val p‖) : ++ ∀ u : ℂ, ‖u‖ = r → f u ≠ 0 := by ++ intro u hur ++ have hu0 : u ≠ 0 := by ++ intro hu0 ++ subst hu0 ++ have : (0 : ℝ) = r := by simpa using hur ++ exact (ne_of_gt hrpos) this.symm ++ intro hfu0 ++ have hnotTop : analyticOrderAt f u ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) hf hnot u ++ have hord_ne0 : analyticOrderNatAt f u ≠ 0 := by ++ intro h0 ++ have hEN : (analyticOrderNatAt f u : ENat) = 0 := by simp [h0] ++ have hAt0 : analyticOrderAt f u = 0 := by ++ have hcast : (analyticOrderNatAt f u : ENat) = analyticOrderAt f u := ++ Nat.cast_analyticOrderNatAt (f := f) (z₀ := u) hnotTop ++ simpa [hcast] using hEN ++ have han : AnalyticAt ℂ f u := Differentiable.analyticAt (f := f) hf u ++ exact ((han.analyticOrderAt_eq_zero).1 hAt0) hfu0 ++ have hcard_pos : 0 < (divisorZeroIndex₀FiberFinset (f := f) u).card := by ++ have hcard := ++ divisorZeroIndex₀FiberFinset_card_eq_analyticOrderNatAt (hf := hf) (z₀ := u) hu0 ++ have : 0 < analyticOrderNatAt f u := Nat.pos_of_ne_zero hord_ne0 ++ simpa [hcard] using this ++ rcases Finset.card_pos.mp hcard_pos with ⟨p, hp⟩ ++ have hpval : divisorZeroIndex₀Val p = u := ++ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := u) p).1 hp ++ have hpB : ‖divisorZeroIndex₀Val p‖ ≤ B := by ++ have : ‖divisorZeroIndex₀Val p‖ = r := by simp [hpval, hur] ++ simpa [this] using hBr ++ have : r ≠ ‖divisorZeroIndex₀Val p‖ := hr_not p hpB ++ exact this (by simp [hpval, hur]) ++ ++theorem analyticOrderAt_divisorCanonicalProduct_eq_fiber_card ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z₀ = ++ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by ++ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) ++ have hNat : ++ analyticOrderNatAt F z₀ = (divisorZeroIndex₀FiberFinset (f := f) z₀).card := by ++ simpa [F] using ++ (analyticOrderNatAt_divisorCanonicalProduct_eq_fiber_card ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀)) ++ have hdiffOn : DifferentiableOn ℂ F (Set.univ : Set ℂ) := by ++ simpa [F] using differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ have hdiff : Differentiable ℂ F := by ++ intro z ++ exact (hdiffOn z (by simp)).differentiableAt (by simp) ++ have hnotTop : analyticOrderAt F z₀ ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hdiff) ++ ⟨0, by simp [F, divisorCanonicalProduct_zero]⟩ z₀ ++ have hcast : (analyticOrderNatAt F z₀ : ℕ∞) = analyticOrderAt F z₀ := ++ Nat.cast_analyticOrderNatAt (f := F) (z₀ := z₀) hnotTop ++ have hNatCast : ++ (analyticOrderNatAt F z₀ : ℕ∞) = ++ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by ++ simp [hNat] ++ simpa [F, hcast] using hNatCast ++ ++theorem divisorCanonicalProduct_ne_zero_of_forall_ne ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ {z : ℂ} (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) z ≠ 0 := by ++ let F : ℂ → ℂ := divisorCanonicalProduct m f (Set.univ : Set ℂ) ++ have hfiber_empty : divisorZeroIndex₀FiberFinset (f := f) z = ∅ := by ++ ext p ++ constructor ++ · intro hp ++ exact False.elim (hz p ((mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z) p).1 hp).symm) ++ · intro hp ++ simp at hp ++ have horder : ++ analyticOrderAt F z = (0 : ℕ∞) := by ++ have h := ++ analyticOrderAt_divisorCanonicalProduct_eq_fiber_card ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z) ++ simpa [F, hfiber_empty] using h ++ have han : AnalyticAt ℂ F z := by ++ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ ++ refine Filter.Eventually.of_forall ?_ ++ intro w ++ exact (((differentiableOn_divisorCanonicalProduct_univ m f h_sum) w ++ (by simp)).differentiableAt (by simp)) ++ exact (han.analyticOrderAt_eq_zero).1 horder ++ ++theorem logDeriv_divisorCanonicalProduct_one_eq_tsum_of_forall_ne ++ {f : ℂ → ℂ} {z : ℂ} ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (2 : ℕ))) ++ (hz : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), z ≠ divisorZeroIndex₀Val p) : ++ logDeriv (divisorCanonicalProduct 1 f (Set.univ : Set ℂ)) z = ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (1 / (z - divisorZeroIndex₀Val p) + 1 / divisorZeroIndex₀Val p) := ++ logDeriv_divisorCanonicalProduct_one_eq_tsum h_sum hz ++ (divisorCanonicalProduct_ne_zero_of_forall_ne 1 f h_sum hz) ++ ++end Hadamard ++end Complex ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/DivisorProducts.lean b/PrimeNumberTheoremAnd/SiegelZeros/DivisorProducts.lean +new file mode 100644 +index 0000000..5ca9514 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/DivisorProducts.lean +@@ -0,0 +1,912 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.DivisorBasics ++ ++namespace SiegelZeros ++ ++section ++open Filter Function _root_.SiegelZeros.Complex _root_.Function.Complex Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++noncomputable def divisorComplementFactor ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) : ℂ := by ++ classical ++ exact if p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ then (1 : ℂ) ++ else weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ ++@[simp] ++theorem divisorComplementFactor_eq_one_of_mem ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) ++ (hp : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀) : ++ divisorComplementFactor m f z₀ p z = 1 := by ++ classical ++ simp [divisorComplementFactor, hp] ++ ++@[simp] ++theorem divisorComplementFactor_eq_weierstrassFactor_of_not_mem ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) ++ (hp : p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀) : ++ divisorComplementFactor m f z₀ p z = ++ weierstrassFactor m (z / divisorZeroIndex₀Val p) := by ++ classical ++ simp [divisorComplementFactor, hp] ++ ++lemma divisorComplementFactor_def ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) : ++ divisorComplementFactor m f z₀ p z = ++ if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) ++ else weierstrassFactor m (z / divisorZeroIndex₀Val p) := by ++ classical ++ by_cases h : divisorZeroIndex₀Val p = z₀ ++ · have hp : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ := by ++ simpa [mem_divisorZeroIndex₀FiberFinset] using h ++ simp [divisorComplementFactor_eq_one_of_mem, hp, h] ++ · have hp : p ∉ divisorZeroIndex₀FiberFinset (f := f) z₀ := by ++ intro hmem ++ exact h ((mem_divisorZeroIndex₀FiberFinset f z₀ p).1 hmem) ++ simp [divisorComplementFactor_eq_weierstrassFactor_of_not_mem, hp, h] ++ ++noncomputable def divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ℂ := ++ ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ ++theorem differentiable_weierstrassFactor_divisorZeroIndex₀ (m : ℕ) {f : ℂ → ℂ} ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : ++ Differentiable ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) := by ++ have hdiv : Differentiable ℂ (fun z : ℂ => z / divisorZeroIndex₀Val p) := by ++ simp [div_eq_mul_inv] ++ exact (differentiable_weierstrassFactor m).comp hdiv ++ ++theorem differentiable_divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : ++ Differentiable ℂ (divisorPartialProduct m f s) := by ++ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p z => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ have hΦ : ∀ p ∈ s, Differentiable ℂ (Φ p) := by ++ intro p _hp ++ exact differentiable_weierstrassFactor_divisorZeroIndex₀ m p ++ simpa [divisorPartialProduct, Φ] using! ++ (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := Φ) (u := s) hΦ) ++ ++theorem analyticAt_divisorPartialProduct (m : ℕ) (f : ℂ → ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z₀ : ℂ) : ++ AnalyticAt ℂ (divisorPartialProduct m f s) z₀ := ++ (differentiable_divisorPartialProduct m f s).analyticAt z₀ ++ ++noncomputable def divisorComplementPartialProduct ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ℂ := ++ ∏ p ∈ s, divisorComplementFactor m f z₀ p z ++ ++@[simp] ++lemma divisorComplementPartialProduct_def ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) : ++ divisorComplementPartialProduct m f z₀ s z = ++ ∏ p ∈ s, if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) ++ else weierstrassFactor m (z / divisorZeroIndex₀Val p) := by ++ simp [divisorComplementPartialProduct, divisorComplementFactor, ++ mem_divisorZeroIndex₀FiberFinset] ++ ++theorem differentiable_divisorComplementPartialProduct ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : ++ Differentiable ℂ (divisorComplementPartialProduct m f z₀ s) := by ++ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := ++ fun p z => divisorComplementFactor m f z₀ p z ++ have hΦ : ∀ p ∈ s, Differentiable ℂ (Φ p) := by ++ intro p _hp ++ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ · have hΦp : Φ p = fun _ => (1 : ℂ) := by ++ ext z ++ simp only [Φ, divisorComplementFactor_eq_one_of_mem m f z₀ p z hpF] ++ rw [hΦp] ++ exact differentiable_const (1 : ℂ) ++ · have hΦp : Φ p = fun z => weierstrassFactor m (z / divisorZeroIndex₀Val p) := by ++ ext z ++ simp only [Φ, divisorComplementFactor_eq_weierstrassFactor_of_not_mem m f z₀ p z hpF] ++ rw [hΦp] ++ exact differentiable_weierstrassFactor_divisorZeroIndex₀ m p ++ have hEq : (fun z : ℂ => ∏ p ∈ s, Φ p z) = ++ divisorComplementPartialProduct m f z₀ s := by ++ ext z ++ simp [Φ, divisorComplementPartialProduct] ++ have : Differentiable ℂ (fun z : ℂ => ∏ p ∈ s, Φ p z) := by ++ simpa using (Differentiable.fun_finsetProd (𝕜 := ℂ) (f := Φ) (u := s) hΦ) ++ simpa [hEq] using this ++ ++noncomputable def divisorComplementCanonicalProduct ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) (z : ℂ) : ℂ := ++ ∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), divisorComplementFactor m f z₀ p z ++ ++theorem hasProdUniformlyOn_divisorComplementCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) {K : Set ℂ} (hK : IsCompact K) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ HasProdUniformlyOn (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ divisorComplementFactor m f z₀ p z) (divisorComplementCanonicalProduct m f z₀) ++ K := by ++ rcases (isBounded_iff_forall_norm_le.1 hK.isBounded) with ⟨R0, hR0⟩ ++ set R : ℝ := max R0 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ have hnormK : ∀ z ∈ K, ‖z‖ ≤ R := fun z hzK => le_trans (hR0 z hzK) (le_max_left _ _) ++ let term : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := fun p z => ++ divisorComplementFactor m f z₀ p z ++ let g : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ → ℂ := fun p z => term p z - 1 ++ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) ++ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) ++ have h_big : ++ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, ++ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 2 * R} : ++ Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this ++ have := hfin.eventually_cofinite_notMem ++ filter_upwards [this] with p hp ++ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp ++ exact lt_of_not_ge this ++ have hBound : ++ ∀ᶠ p in Filter.cofinite, ∀ z ∈ K, ‖g p z‖ ≤ u p := by ++ filter_upwards [h_big] with p hp z hzK ++ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ · have hval : divisorZeroIndex₀Val p = z₀ := ++ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hpF ++ have hu0 : 0 ≤ u p := by ++ dsimp [u] ++ refine mul_nonneg ?_ ?_ ++ · nlinarith [pow_nonneg (show 0 ≤ R from le_of_lt hRpos) (m + 1)] ++ · exact pow_nonneg (inv_nonneg.2 (norm_nonneg _)) (m + 1) ++ simp [g, term, divisorComplementFactor, hval, hu0, sub_eq_add_neg] ++ · have hzle : ‖z‖ ≤ R := hnormK z hzK ++ have hz_div : ‖z / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by ++ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hRpos] ++ have hinv : ‖divisorZeroIndex₀Val p‖⁻¹ < (2 * R)⁻¹ := by ++ simpa [one_div] using (one_div_lt_one_div_of_lt h2R_pos hp) ++ have hmul_le : ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ ≤ R * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ refine mul_le_mul_of_nonneg_right hzle ?_ ++ exact inv_nonneg.2 (norm_nonneg _) ++ have hmul_lt : R * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := ++ mul_lt_mul_of_pos_left hinv hRpos ++ have hlt : ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := ++ lt_of_le_of_lt hmul_le hmul_lt ++ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by ++ have hRne : (R : ℝ) ≠ 0 := hRpos.ne' ++ have : R * (2 * R)⁻¹ = R / (2 * R) := by simp [div_eq_mul_inv] ++ rw [this] ++ field_simp [hRne] ++ have hnorm : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ have hzlt : ‖z / divisorZeroIndex₀Val p‖ < (1 / 2 : ℝ) := by ++ calc ++ ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := hnorm ++ _ < R * (2 * R)⁻¹ := hlt ++ _ = (1 / 2 : ℝ) := hRhalf ++ exact le_of_lt hzlt ++ have hE : ‖weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1‖ ≤ ++ 4 * ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) := ++ weierstrassFactor_sub_one_pow_bound (m := m) (z := z / divisorZeroIndex₀Val p) hz_div ++ have hz_pow : ‖z / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ ++ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ have : ‖z / divisorZeroIndex₀Val p‖ = ‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ rw [this] ++ have : (‖z‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = ++ ‖z‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ simp [mul_pow] ++ rw [this] ++ have hzle_pow : ‖z‖ ^ (m + 1) ≤ R ^ (m + 1) := ++ pow_le_pow_left₀ (norm_nonneg z) hzle (m + 1) ++ gcongr ++ dsimp [g, term, u] ++ simp [divisorComplementFactor, hpF] at * ++ nlinarith [hE, hz_pow] ++ have hcts : ∀ p, ContinuousOn (g p) K := by ++ intro p ++ by_cases hpF : p ∈ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ · have hval : divisorZeroIndex₀Val p = z₀ := ++ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hpF ++ simpa [g, term, divisorComplementFactor, hval, sub_eq_add_neg, add_assoc, add_left_comm, ++ add_comm] using ++ (continuousOn_const : ContinuousOn (fun _ : ℂ => (0 : ℂ)) K) ++ · have hvalne : divisorZeroIndex₀Val p ≠ z₀ := ++ (not_mem_divisorZeroIndex₀FiberFinset_iff_val_ne (f := f) z₀ p).1 hpF ++ have hcontE : Continuous (fun z : ℂ => weierstrassFactor m z) := ++ (differentiable_weierstrassFactor m).continuous ++ have hdiv : Continuous fun z : ℂ => z / divisorZeroIndex₀Val p := by ++ simpa [div_eq_mul_inv] using! (continuous_id.mul continuous_const) ++ have hcont : Continuous fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) := ++ hcontE.comp hdiv ++ have : ContinuousOn (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) - 1) K := ++ (hcont.continuousOn.sub continuous_const.continuousOn) ++ simpa [g, term, divisorComplementFactor, mem_divisorZeroIndex₀FiberFinset, hvalne] using this ++ have hprod : ++ HasProdUniformlyOn (fun p z ↦ 1 + g p z) (fun z ↦ ∏' p, (1 + g p z)) K := by ++ simpa using ++ Summable.hasProdUniformlyOn_one_add (f := g) (u := u) (K := K) hK hu hBound hcts ++ have hterm : ++ HasProdUniformlyOn (fun p z ↦ term p z) (fun z ↦ ∏' p, term p z) K := by ++ simpa [g, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using hprod ++ refine hterm.congr_right ?_ ++ intro z hz ++ simp [term, divisorComplementCanonicalProduct, divisorComplementFactor] ++ ++theorem hasProdLocallyUniformlyOn_divisorComplementCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ divisorComplementFactor m f z₀ p z) ++ (divisorComplementCanonicalProduct m f z₀) ++ (Set.univ : Set ℂ) := by ++ refine hasProdLocallyUniformlyOn_of_forall_compact ++ (f := fun p z => divisorComplementFactor m f z₀ p z) ++ (g := divisorComplementCanonicalProduct m f z₀) (s := (Set.univ : Set ℂ)) ++ isOpen_univ ?_ ++ intro K hKU hK ++ simpa using ++ (hasProdUniformlyOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) ++ (K := K) hK h_sum) ++ ++theorem tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ divisorComplementPartialProduct m f z₀ s) ++ (divisorComplementCanonicalProduct m f z₀) ++ Filter.atTop ++ (Set.univ : Set ℂ) := by ++ have hprod : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ divisorComplementFactor m f z₀ p z) ++ (divisorComplementCanonicalProduct m f z₀) ++ (Set.univ : Set ℂ) := ++ hasProdLocallyUniformlyOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) ++ (z₀ := z₀) h_sum ++ have h : ++ TendstoLocallyUniformlyOn ++ (fun (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z : ℂ) => ++ ∏ p ∈ s, ++ if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) ++ else weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorComplementCanonicalProduct m f z₀) ++ Filter.atTop ++ (Set.univ : Set ℂ) := by ++ simpa [HasProdLocallyUniformlyOn, divisorComplementFactor, mem_divisorZeroIndex₀FiberFinset] ++ using hprod ++ refine h.congr (G := fun s z => divisorComplementPartialProduct m f z₀ s z) ?_ ++ intro s z hz ++ simp [divisorComplementPartialProduct_def] ++ ++theorem differentiableOn_divisorComplementCanonicalProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) (Set.univ : Set ℂ) := by ++ have hloc : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ divisorComplementPartialProduct m f z₀ s) ++ (divisorComplementCanonicalProduct m f z₀) ++ Filter.atTop ++ (Set.univ : Set ℂ) := ++ tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ (m := m) (f := f) ++ (z₀ := z₀) h_sum ++ have hF : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in Filter.atTop, ++ DifferentiableOn ℂ (divisorComplementPartialProduct m f z₀ s) (Set.univ : Set ℂ) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro s ++ exact (differentiable_divisorComplementPartialProduct m f z₀ s).differentiableOn ++ have : (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))).NeBot := ++ Filter.atTop_neBot ++ exact hloc.differentiableOn hF isOpen_univ ++ ++lemma divisorPartialProduct_eq_fiber_mul_complement_of_subset ++ (m : ℕ) (f : ℂ → ℂ) (z₀ z : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : ++ divisorPartialProduct m f s z = ++ divisorPartialProduct m f (divisorZeroIndex₀FiberFinset (f := f) z₀) z * ++ divisorComplementPartialProduct m f z₀ s z := by ++ classical ++ let fiber : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ let P : divisorZeroIndex₀ f (Set.univ : Set ℂ) → Prop := fun p => p ∈ fiber ++ let term : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := ++ fun p => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ have hfilter : s.filter P = fiber := by ++ ext p ++ constructor ++ · intro hp ++ exact (Finset.mem_filter.mp hp).2 ++ · intro hp ++ exact Finset.mem_filter.mpr ⟨hs hp, hp⟩ ++ have hsplit : ++ (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) = ∏ p ∈ s, term p := by ++ simpa [term] using ++ (Finset.prod_filter_mul_prod_filter_not (s := s) (p := P) (f := term)) ++ have hP : (∏ p ∈ s with P p, term p) = divisorPartialProduct m f fiber z := by ++ have hg : ∀ x ∈ s \ fiber, (if x ∈ fiber then term x else (1 : ℂ)) = 1 := by ++ intro x hx ++ have hxnot : x ∉ fiber := (Finset.mem_sdiff.mp hx).2 ++ simp [hxnot] ++ have hfg : ++ ∀ x ∈ fiber, term x = (if x ∈ fiber then term x else (1 : ℂ)) := by ++ intro x hx ++ simp [hx] ++ have hsub := (Finset.prod_subset_one_on_sdiff (s₁ := fiber) (s₂ := s) ++ (f := term) (g := fun x => if x ∈ fiber then term x else (1 : ℂ)) hs hg hfg) ++ simpa [divisorPartialProduct, term, P, fiber, Finset.prod_filter] using hsub.symm ++ have hnotP : (∏ p ∈ s with ¬ P p, term p) = divisorComplementPartialProduct m f z₀ s z := by ++ simp [divisorComplementPartialProduct, divisorComplementFactor, term, P, fiber, ++ Finset.prod_filter, mem_divisorZeroIndex₀FiberFinset] ++ have hsplit' : ∏ p ∈ s, term p = (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) := ++ hsplit.symm ++ calc ++ divisorPartialProduct m f s z ++ = ∏ p ∈ s, term p := by simp [divisorPartialProduct, term] ++ _ = (∏ p ∈ s with P p, term p) * (∏ p ∈ s with ¬ P p, term p) := hsplit' ++ _ = divisorPartialProduct m f fiber z * divisorComplementPartialProduct m f z₀ s z := by ++ simp [hP, hnotP, fiber] ++ ++end Complex.Hadamard ++end ++section ++noncomputable section ++ ++open _root_.SiegelZeros.Complex Filter Function Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++theorem analyticOrderAt_finset_prod_weierstrassFactor_divisorZeroIndex₀ ++ (m : ℕ) (f : ℂ → ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (z₀ : ℂ) : ++ analyticOrderAt (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ z₀ = ((s.filter (fun p => divisorZeroIndex₀Val p = z₀)).card : ℕ∞) := by ++ classical ++ refine Finset.induction_on s ?base ?step ++ · simp [analyticOrderAt_eq_zero] ++ · intro p s hp hs ++ by_cases hEq : divisorZeroIndex₀Val p = z₀ ++ · have hp0 : divisorZeroIndex₀Val p ≠ 0 := p.property ++ have han_fac : ++ AnalyticAt ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) z₀ := by ++ exact (differentiable_weierstrassFactor_divisorZeroIndex₀ m p).analyticAt z₀ ++ have han_rest : AnalyticAt ℂ (fun z : ℂ => ∏ q ∈ s, weierstrassFactor m ++ (z / divisorZeroIndex₀Val q)) z₀ := by ++ simpa [divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ ++ let fac : ℂ → ℂ := fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ let rest : ℂ → ℂ := fun z : ℂ => ∏ q ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val q) ++ have hmul : ++ analyticOrderAt (fac * rest) z₀ = ++ analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := by ++ simpa [fac, rest] using (analyticOrderAt_mul (z₀ := z₀) han_fac han_rest) ++ have hcard : ++ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) (insert p s)).card = ++ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) s).card + 1 := by ++ simp [hEq, hp, Finset.filter_insert] ++ have hfac : analyticOrderAt fac z₀ = (1 : ℕ∞) := by ++ simpa [fac, hEq] using ++ (analyticOrderAt_weierstrassFactor_div_self (m := m) (a := divisorZeroIndex₀Val p) hp0) ++ have hrest : analyticOrderAt rest z₀ = ((s.filter ++ (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simpa [rest] using hs ++ have hcongr : ++ (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m (z / divisorZeroIndex₀Val q)) ++ =ᶠ[𝓝 z₀] (fac * rest) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ simp [fac, rest, Finset.prod_insert, hp, Pi.mul_apply] ++ calc ++ analyticOrderAt (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m ++ (z / divisorZeroIndex₀Val q)) z₀ = analyticOrderAt (fac * rest) z₀ := by ++ simpa using (analyticOrderAt_congr hcongr) ++ _ = analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := hmul ++ _ = (1 : ℕ∞) + ((s.filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simp [hfac, hrest] ++ _ = (((insert p s).filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simp [hcard, Nat.add_comm] ++ · have han_fac : ++ AnalyticAt ℂ (fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p)) z₀ := by ++ exact (differentiable_weierstrassFactor_divisorZeroIndex₀ m p).analyticAt z₀ ++ have hfac0 : analyticOrderAt (fun z : ℂ => weierstrassFactor m ++ (z / divisorZeroIndex₀Val p)) z₀ = 0 := by ++ have hp0 : divisorZeroIndex₀Val p ≠ 0 := p.property ++ have hval : weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ≠ 0 := by ++ have : (z₀ / divisorZeroIndex₀Val p) ≠ 1 := by ++ intro h1 ++ have : z₀ = divisorZeroIndex₀Val p := by ++ have : z₀ = (z₀ / divisorZeroIndex₀Val p) * (divisorZeroIndex₀Val p) := by ++ simp [div_eq_mul_inv] ++ simpa [h1, div_eq_mul_inv, hp0] using this ++ exact hEq (this.symm) ++ exact (weierstrassFactor_ne_zero_iff m (z₀ / divisorZeroIndex₀Val p)).2 this ++ simpa using (han_fac.analyticOrderAt_eq_zero).2 (by simpa using hval) ++ have hcard : ++ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) (insert p s)).card = ++ (Finset.filter (fun q => divisorZeroIndex₀Val q = z₀) s).card := by ++ simp [hEq, Finset.filter_insert] ++ have han_rest : AnalyticAt ℂ (fun z : ℂ => ∏ q ∈ s, weierstrassFactor m ++ (z / divisorZeroIndex₀Val q)) z₀ := by ++ simpa [divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ ++ let fac : ℂ → ℂ := fun z : ℂ => weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ let rest : ℂ → ℂ := fun z : ℂ => ∏ q ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val q) ++ have hmul : ++ analyticOrderAt (fac * rest) z₀ = ++ analyticOrderAt fac z₀ + analyticOrderAt rest z₀ := by ++ simpa [fac, rest] using (analyticOrderAt_mul (z₀ := z₀) han_fac han_rest) ++ have hcongr : ++ (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m (z / divisorZeroIndex₀Val q)) ++ =ᶠ[𝓝 z₀] (fac * rest) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ simp [fac, rest, Finset.prod_insert, hp, Pi.mul_apply] ++ calc ++ analyticOrderAt (fun z : ℂ => ∏ q ∈ insert p s, weierstrassFactor m ++ (z / divisorZeroIndex₀Val q)) z₀ ++ = analyticOrderAt (fac * rest) z₀ := by ++ simpa using (analyticOrderAt_congr hcongr) ++ _ = analyticOrderAt rest z₀ := by ++ calc ++ analyticOrderAt (fac * rest) z₀ = analyticOrderAt fac z₀ + ++ analyticOrderAt rest z₀ := hmul ++ _ = analyticOrderAt rest z₀ := by ++ have hfac0' : analyticOrderAt fac z₀ = 0 := by ++ simpa [fac] using hfac0 ++ simp [hfac0'] ++ _ = ((s.filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simpa [rest] using hs ++ _ = (((insert p s).filter (fun q => divisorZeroIndex₀Val q = z₀)).card : ℕ∞) := by ++ simpa using congrArg (fun n : ℕ => (n : ℕ∞)) hcard.symm ++ ++theorem analyticOrderAt_partialProduct_eq_fiberCard_of_subset ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : ++ analyticOrderAt ++ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ z₀ = ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by ++ have h := ++ analyticOrderAt_finset_prod_weierstrassFactor_divisorZeroIndex₀ ++ (m := m) (f := f) (s := s) (z₀ := z₀) ++ have hfilter : ++ s.filter (fun p => divisorZeroIndex₀Val p = z₀) = ++ divisorZeroIndex₀FiberFinset (f := f) z₀ := by ++ ext p ++ constructor ++ · intro hp' ++ have hpv : divisorZeroIndex₀Val p = z₀ := (Finset.mem_filter.mp hp').2 ++ simpa [mem_divisorZeroIndex₀FiberFinset] using hpv ++ · intro hp_fiber ++ have hpv : divisorZeroIndex₀Val p = z₀ := ++ (mem_divisorZeroIndex₀FiberFinset (f := f) (z₀ := z₀) p).1 hp_fiber ++ have hps : p ∈ s := hs (by simpa [mem_divisorZeroIndex₀FiberFinset] using hpv) ++ exact Finset.mem_filter.2 ⟨hps, hpv⟩ ++ simpa [hfilter] using h ++ ++theorem exists_analyticAt_eq_pow_smul_of_partialProduct_contains_fiber ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hs : divisorZeroIndex₀FiberFinset (f := f) z₀ ⊆ s) : ++ ∃ g : ℂ → ℂ, ++ AnalyticAt ℂ g z₀ ∧ g z₀ ≠ 0 ∧ ++ (fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ =ᶠ[𝓝 z₀] ++ fun z : ℂ => (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card • g z := by ++ let F : ℂ → ℂ := fun z : ℂ => ∏ p ∈ s, weierstrassFactor m (z / divisorZeroIndex₀Val p) ++ have hF_ana : AnalyticAt ℂ F z₀ := by ++ simpa [F, divisorPartialProduct] using! analyticAt_divisorPartialProduct m f s z₀ ++ have hOrder : ++ analyticOrderAt F z₀ = ++ ((divisorZeroIndex₀FiberFinset (f := f) z₀).card : ℕ∞) := by ++ simpa [F] using ++ (analyticOrderAt_partialProduct_eq_fiberCard_of_subset (m := m) ++ (f := f) (z₀ := z₀) (s := s) hs) ++ refine (hF_ana.analyticOrderAt_eq_natCast (n := (divisorZeroIndex₀FiberFinset ++ (f := f) z₀).card)).1 ?_ ++ simp [hOrder] ++ ++end Complex.Hadamard ++end ++end ++section ++open Filter Function _root_.SiegelZeros.Complex _root_.Function.Complex Finset Topology ++open scoped Topology BigOperators ++open Set ++ ++namespace Complex.Hadamard ++ ++theorem tendstoLocallyUniformlyOn_divisorPartialProduct_univ ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ Filter.atTop ++ (Set.univ : Set ℂ) := by ++ have hprod : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (z : ℂ) => ++ weierstrassFactor m (z / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ (Set.univ : Set ℂ) := ++ hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ simpa [HasProdLocallyUniformlyOn, divisorPartialProduct] using! hprod ++ ++theorem tendstoUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) (k : ℕ) {K : Set ℂ} (hK : IsCompact K) (hKz : ∀ z ∈ K, z ≠ z₀) : ++ TendstoUniformlyOn ++ (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ k) ++ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) ++ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) ++ K := by ++ have hloc : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ Filter.atTop ++ K := ++ (tendstoLocallyUniformlyOn_divisorPartialProduct_univ (m := m) (f := f) h_sum).mono ++ (by intro z hz; simp) ++ have hunif : ++ TendstoUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => divisorPartialProduct m f s) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ Filter.atTop ++ K := ++ (tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact hK).1 hloc ++ let h : ℂ → ℂ := fun z => ((z - z₀) ^ k)⁻¹ ++ have hh : ∃ C, ∀ z ∈ K, ‖h z‖ ≤ C := by ++ have hcont : ContinuousOn h K := by ++ have hpow : ContinuousOn (fun z : ℂ => (z - z₀) ^ k) K := by ++ fun_prop ++ refine hpow.inv₀ ?_ ++ intro z hz ++ have hz0 : z - z₀ ≠ 0 := sub_ne_zero.mpr (hKz z hz) ++ exact pow_ne_zero k hz0 ++ have hKimg : IsCompact (h '' K) := hK.image_of_continuousOn hcont ++ rcases (isBounded_iff_forall_norm_le.1 hKimg.isBounded) with ⟨C, hC⟩ ++ refine ⟨C, ?_⟩ ++ intro z hz ++ exact hC (h z) ⟨z, hz, rfl⟩ ++ have hunif' := ++ (TendstoUniformlyOn.mul_left_bounded (p := (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f ++ (Set.univ : Set ℂ))))) ++ (K := K) ++ (F := fun s z => divisorPartialProduct m f s z) ++ (f := fun z => divisorCanonicalProduct m f (Set.univ : Set ℂ) z) ++ (h := h) ++ hunif hh) ++ simpa [h, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hunif' ++ ++theorem tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) (k : ℕ) : ++ TendstoLocallyUniformlyOn ++ (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ k) ++ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ k) ++ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) ++ ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hopen : IsOpen ((Set.univ : Set ℂ) \ {z₀}) := by ++ have hset : ((Set.univ : Set ℂ) \ {z₀}) = ({z₀} : Set ℂ)ᶜ := by ++ ext z ++ simp ++ simp [hset] ++ refine (tendstoLocallyUniformlyOn_iff_forall_isCompact hopen).2 ?_ ++ intro K hKsub hK ++ have hKz : ∀ z ∈ K, z ≠ z₀ := by ++ intro z hzK ++ have : z ∈ (Set.univ : Set ℂ) \ {z₀} := hKsub hzK ++ exact by simpa [Set.mem_sdiff, Set.mem_singleton_iff] using this.2 ++ exact tendstoUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m := m) (f := f) h_sum (z₀ := z₀) (k := k) (hK := hK) hKz ++ ++open Filter ++ ++theorem exists_ball_eq_divisorCanonicalProduct_div_pow_eq ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ++ ∃ ε > 0, ∃ u : ℂ → ℂ, AnalyticAt ℂ u z₀ ∧ ++ u z₀ ≠ 0 ∧ ++ ∀ z : ℂ, z ∈ Metric.ball z₀ ε → z ≠ z₀ → ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card = ++ (divisorComplementCanonicalProduct m f z₀ z) * u z := by ++ let fiber : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ divisorZeroIndex₀FiberFinset (f := f) z₀ ++ have hfib : ∃ u : ℂ → ℂ, AnalyticAt ℂ u z₀ ∧ u z₀ ≠ 0 ∧ ++ (fun z : ℂ => divisorPartialProduct m f fiber z) =ᶠ[𝓝 z₀] ++ fun z : ℂ => (z - z₀) ^ fiber.card • u z := by ++ simpa [fiber, divisorPartialProduct] using ++ (exists_analyticAt_eq_pow_smul_of_partialProduct_contains_fiber (m := m) (f := f) (z₀ := z₀) ++ (s := fiber) (by rfl : fiber ⊆ fiber)) ++ rcases hfib with ⟨u, huA, hu0, huEq⟩ ++ have hmem : {z : ℂ | divisorPartialProduct m f fiber z = ++ (z - z₀) ^ fiber.card • u z} ∈ 𝓝 z₀ := huEq ++ rcases Metric.mem_nhds_iff.1 hmem with ⟨ε, hε, hball⟩ ++ refine ⟨ε, hε, u, huA, hu0, ?_⟩ ++ have hq : ++ TendstoLocallyUniformlyOn (fun s z => (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) ++ (fun z => (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ fiber.card) ++ (Filter.atTop : Filter (Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)))) ++ ((Set.univ : Set ℂ) \ {z₀}) := ++ tendstoLocallyUniformlyOn_divisorPartialProduct_div_pow_sub ++ (m := m) (f := f) (h_sum := h_sum) (z₀ := z₀) (k := fiber.card) ++ have hcomp : ++ TendstoLocallyUniformlyOn ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ divisorComplementPartialProduct m f z₀ s) ++ (divisorComplementCanonicalProduct m f z₀) ++ Filter.atTop ++ (Set.univ : Set ℂ) := ++ tendstoLocallyUniformlyOn_divisorComplementPartialProduct_univ (m := m) (f := f) ++ (z₀ := z₀) h_sum ++ intro z hz hzne ++ have hz' : z ∈ ((Set.univ : Set ℂ) \ {z₀}) := by ++ refine ⟨by simp, ?_⟩ ++ simpa [Set.mem_singleton_iff] using hzne ++ have hF : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) (Filter.atTop : Filter _) ++ (𝓝 ((divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / (z - z₀) ^ fiber.card)) := ++ hq.tendsto_at hz' ++ have hG0 : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ divisorComplementPartialProduct m f z₀ s z) (Filter.atTop : Filter _) ++ (𝓝 (divisorComplementCanonicalProduct m f z₀ z)) := ++ hcomp.tendsto_at (by simp : z ∈ (Set.univ : Set ℂ)) ++ have hG : Tendsto (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ (divisorComplementPartialProduct m f z₀ s z) * u z) (Filter.atTop : Filter _) ++ (𝓝 ((divisorComplementCanonicalProduct m f z₀ z) * u z)) := ++ (hG0.mul tendsto_const_nhds) ++ have hsub : ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), ++ fiber ⊆ s := eventually_atTop_subset_fiberFinset (f := f) z₀ ++ have heq_eventually : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), ++ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card ++ = (divisorComplementPartialProduct m f z₀ s z) * u z := by ++ filter_upwards [hsub] with s hs ++ have hsplit : ++ divisorPartialProduct m f s z = ++ divisorPartialProduct m f fiber z * divisorComplementPartialProduct m f z₀ s z := by ++ simpa [fiber] using ++ (divisorPartialProduct_eq_fiber_mul_complement_of_subset (m := m) (f := f) (z₀ := z₀) ++ (z := z) (s := s) hs) ++ have hfibz : ++ divisorPartialProduct m f fiber z = (z - z₀) ^ fiber.card • u z := by ++ exact hball hz ++ have hzpow : (z - z₀) ^ fiber.card ≠ 0 := ++ pow_ne_zero _ (sub_ne_zero.mpr hzne) ++ set a : ℂ := (z - z₀) ^ fiber.card ++ have ha : a ≠ 0 := by simpa [a] using hzpow ++ set c : ℂ := divisorComplementPartialProduct m f z₀ s z with hc ++ rw [hsplit, hfibz, smul_eq_mul] ++ calc ++ ((a * u z) * c) / a ++ = (a * (u z * c)) / a := by simp [mul_assoc] ++ _ = u z * c := by ++ simpa [mul_assoc] using (mul_div_cancel_left₀ (u z * c) ha) ++ _ = c * u z := by ac_rfl ++ _ = (divisorComplementPartialProduct m f z₀ s z) * u z := by ++ simp [c] ++ have hG' : ++ Tendsto ++ (fun s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) => ++ (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card) ++ (Filter.atTop : Filter _) ++ (𝓝 ((divisorComplementCanonicalProduct m f z₀ z) * u z)) := by ++ have heq' : ++ ∀ᶠ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) in (Filter.atTop : Filter _), ++ (divisorComplementPartialProduct m f z₀ s z) * u z ++ = (divisorPartialProduct m f s z) / (z - z₀) ^ fiber.card := by ++ filter_upwards [heq_eventually] with s hs ++ exact hs.symm ++ exact (hG.congr' heq') ++ exact tendsto_nhds_unique hF hG' ++ ++theorem bddAbove_norm_divisorCanonicalProduct_div_pow_puncturedBall ++ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (z₀ : ℂ) : ∃ r > 0, BddAbove (norm ∘ (fun z : ℂ => ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card) '' ++ ((Metric.ball z₀ r) \ {z₀})) := by ++ rcases exists_ball_eq_divisorCanonicalProduct_div_pow_eq (m := m) (f := f) (h_sum := h_sum) ++ (z₀ := z₀) with ⟨ε, hε, u, huA, hu0, hEq⟩ ++ have huC : ContinuousAt u z₀ := huA.continuousAt ++ have hpre : {z : ℂ | ‖u z - u z₀‖ < 1} ∈ 𝓝 z₀ := by ++ have : u ⁻¹' Metric.ball (u z₀) (1 : ℝ) ∈ 𝓝 z₀ := ++ huC.preimage_mem_nhds (Metric.ball_mem_nhds (u z₀) (by norm_num)) ++ simpa [Metric.ball, dist_eq_norm, Set.preimage] using this ++ rcases Metric.mem_nhds_iff.1 hpre with ⟨r0, hr0pos, hr0sub⟩ ++ set r : ℝ := min (ε / 2) r0 ++ have hrpos : 0 < r := lt_min (by nlinarith [hε]) hr0pos ++ have hr_lt_ε : r < ε := lt_of_le_of_lt (min_le_left _ _) (by nlinarith [hε]) ++ have huBound : ∀ z ∈ Metric.ball z₀ r, ‖u z‖ ≤ ‖u z₀‖ + 1 := by ++ intro z hz ++ have hz0 : z ∈ Metric.ball z₀ r0 := by ++ have : r ≤ r0 := min_le_right _ _ ++ exact Metric.ball_subset_ball this hz ++ have hdiff : ‖u z - u z₀‖ < 1 := hr0sub hz0 ++ have htri : ‖u z‖ ≤ ‖u z - u z₀‖ + ‖u z₀‖ := by ++ simpa [sub_eq_add_neg, add_assoc] using ++ (norm_add_le (u z - u z₀) (u z₀)) ++ have : ‖u z‖ ≤ 1 + ‖u z₀‖ := le_trans htri (by nlinarith [le_of_lt hdiff]) ++ nlinarith [this] ++ have hdiffC : ++ DifferentiableOn ℂ (divisorComplementCanonicalProduct m f z₀) (Set.univ : Set ℂ) := ++ differentiableOn_divisorComplementCanonicalProduct_univ (m := m) (f := f) (z₀ := z₀) h_sum ++ have hcontC : ContinuousOn (divisorComplementCanonicalProduct m f z₀) (Metric.closedBall z₀ r) := ++ (hdiffC.continuousOn).mono (by intro z hz; simp) ++ have hK : IsCompact (Metric.closedBall z₀ r) := isCompact_closedBall _ _ ++ rcases (isBounded_iff_forall_norm_le.1 (hK.image_of_continuousOn hcontC).isBounded) with ⟨C, hC⟩ ++ refine ⟨r, hrpos, ⟨C * (‖u z₀‖ + 1), ?_⟩⟩ ++ rintro _ ⟨z, hzset, rfl⟩ ++ rcases hzset with ⟨hzr, hzne⟩ ++ have hz_in_ε : z ∈ Metric.ball z₀ ε := Metric.ball_subset_ball hr_lt_ε.le hzr ++ have hz_ne : z ≠ z₀ := by simpa [Set.mem_singleton_iff] using hzne ++ have hq : ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ) z) / ++ (z - z₀) ^ (divisorZeroIndex₀FiberFinset (f := f) z₀).card ++ = divisorComplementCanonicalProduct m f z₀ z * u z := ++ hEq z hz_in_ε hz_ne ++ have hCz : ‖divisorComplementCanonicalProduct m f z₀ z‖ ≤ C := by ++ have hzK : z ∈ Metric.closedBall z₀ r := Metric.mem_closedBall.2 (le_of_lt hzr) ++ exact hC _ ⟨z, hzK, rfl⟩ ++ have huZ : ‖u z‖ ≤ ‖u z₀‖ + 1 := huBound z hzr ++ have hCnonneg : 0 ≤ C := le_trans (norm_nonneg _) hCz ++ have hmul : ‖divisorComplementCanonicalProduct m f z₀ z * u z‖ ≤ C * (‖u z₀‖ + 1) := by ++ calc ++ ‖divisorComplementCanonicalProduct m f z₀ z * u z‖ ++ = ‖divisorComplementCanonicalProduct m f z₀ z‖ * ‖u z‖ := by simp ++ _ ≤ C * (‖u z₀‖ + 1) := by ++ exact mul_le_mul hCz huZ (norm_nonneg _) hCnonneg ++ simpa [Function.comp, hq] using hmul ++ ++theorem divisorComplementCanonicalProduct_ne_zero_at ++ (m : ℕ) (f : ℂ → ℂ) (z₀ : ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ divisorComplementCanonicalProduct m f z₀ z₀ ≠ 0 := by ++ let Φ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := ++ fun p => if divisorZeroIndex₀Val p = z₀ then (1 : ℂ) ++ else weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := fun p => Φ p - 1 ++ have hΦ_ne : ∀ p, Φ p ≠ 0 := by ++ intro p ++ by_cases hp : divisorZeroIndex₀Val p = z₀ ++ · simp [Φ, hp] ++ · have hval : divisorZeroIndex₀Val p ≠ z₀ := hp ++ have hz : z₀ / divisorZeroIndex₀Val p ≠ (1 : ℂ) := by ++ intro h ++ by_cases hp0 : divisorZeroIndex₀Val p = 0 ++ · have : z₀ / divisorZeroIndex₀Val p = (0 : ℂ) := by simp [hp0] ++ have h01 := h ++ rw [this] at h01 ++ exact (show False from (by simpa using (show (0 : ℂ) ≠ (1 : ℂ) from by simp) h01)) ++ · have : z₀ = divisorZeroIndex₀Val p := (div_eq_one_iff_eq hp0).1 h ++ exact hval this.symm ++ have hE : weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) ≠ 0 := by ++ intro h0 ++ have : z₀ / divisorZeroIndex₀Val p = (1 : ℂ) := ++ (weierstrassFactor_eq_zero_iff (m := m) (z := z₀ / divisorZeroIndex₀Val p)).1 h0 ++ exact hz this ++ simp [Φ, hp, hE] ++ have hz0_le : ‖z₀‖ ≤ max ‖z₀‖ 1 := le_max_left _ _ ++ set R : ℝ := max ‖z₀‖ 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (le_max_right _ _) ++ let u : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (4 * R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) ++ have hu : Summable u := h_sum.mul_left (4 * R ^ (m + 1)) ++ have h_big : ++ ∀ᶠ p : divisorZeroIndex₀ f (Set.univ : Set ℂ) in Filter.cofinite, ++ (2 * R : ℝ) < ‖divisorZeroIndex₀Val p‖ := by ++ have hfin : ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ ++ 2 * R} : Set _).Finite := by ++ have : Metric.closedBall (0 : ℂ) (2 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ exact divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) (B := 2 * R) this ++ have := hfin.eventually_cofinite_notMem ++ filter_upwards [this] with p hp ++ have : ¬ ‖divisorZeroIndex₀Val p‖ ≤ 2 * R := by simpa using hp ++ exact lt_of_not_ge this ++ have hBound : ++ ∀ᶠ p in Filter.cofinite, ‖a p‖ ≤ u p := by ++ filter_upwards [h_big] with p hp ++ have ha_pos : 0 < ‖divisorZeroIndex₀Val p‖ := lt_trans (by nlinarith [hRpos]) hp ++ have hz_div : ‖z₀ / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := by ++ have h2R_pos : 0 < (2 * R : ℝ) := by nlinarith [hRpos] ++ have hinv : ‖divisorZeroIndex₀Val p‖⁻¹ < (2 * R)⁻¹ := by ++ simpa [one_div] using (one_div_lt_one_div_of_lt h2R_pos hp) ++ have hmul_le : ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ ≤ R * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ refine mul_le_mul_of_nonneg_right ?_ (inv_nonneg.2 (norm_nonneg _)) ++ exact hz0_le ++ have hmul_lt : R * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := ++ mul_lt_mul_of_pos_left hinv hRpos ++ have hlt : ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ < R * (2 * R)⁻¹ := ++ lt_of_le_of_lt hmul_le hmul_lt ++ have hRhalf : R * (2 * R)⁻¹ = (1 / 2 : ℝ) := by ++ have hRne : (R : ℝ) ≠ 0 := hRpos.ne' ++ have : R * (2 * R)⁻¹ = R / (2 * R) := by simp [div_eq_mul_inv] ++ rw [this] ++ field_simp [hRne] ++ have hnorm : ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ have hzlt : ‖z₀ / divisorZeroIndex₀Val p‖ < (1 / 2 : ℝ) := by ++ calc ++ ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := hnorm ++ _ < R * (2 * R)⁻¹ := hlt ++ _ = (1 / 2 : ℝ) := hRhalf ++ exact le_of_lt hzlt ++ have hE : ++ ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ ≤ ++ 4 * ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) := ++ weierstrassFactor_sub_one_pow_bound (m := m) (z := z₀ / divisorZeroIndex₀Val p) hz_div ++ have hz_pow : ++ ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) ≤ ++ (R ^ (m + 1)) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ have : ‖z₀ / divisorZeroIndex₀Val p‖ = ‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹ := by ++ simp [div_eq_mul_inv] ++ rw [this] ++ have : (‖z₀‖ * ‖divisorZeroIndex₀Val p‖⁻¹) ^ (m + 1) = ++ ‖z₀‖ ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ simp [mul_pow] ++ rw [this] ++ have hzle_pow : ‖z₀‖ ^ (m + 1) ≤ R ^ (m + 1) := ++ pow_le_pow_left₀ (norm_nonneg z₀) hz0_le (m + 1) ++ gcongr ++ have hp_ne : divisorZeroIndex₀Val p ≠ z₀ := by ++ intro h ++ have : ‖divisorZeroIndex₀Val p‖ ≤ R := by ++ simp [h, R] ++ exact (not_lt_of_ge this) (lt_trans (by nlinarith [hRpos]) hp) ++ have ha : ‖a p‖ = ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ := by ++ simp [a, Φ, hp_ne, sub_eq_add_neg] ++ calc ++ ‖a p‖ = ‖weierstrassFactor m (z₀ / divisorZeroIndex₀Val p) - 1‖ := ha ++ _ ≤ 4 * ‖z₀ / divisorZeroIndex₀Val p‖ ^ (m + 1) := by ++ simpa [sub_eq_add_neg, add_comm] using hE ++ _ ≤ 4 * (R ^ (m + 1) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) := by ++ gcongr ++ _ = u p := by ++ simp [u, mul_assoc, mul_comm] ++ have hsum_norm : Summable (fun p => ‖a p‖) := by ++ refine (Summable.of_norm_bounded_eventually (E := ℝ) (f := fun p => ‖a p‖) (g := u) hu ?_) ++ filter_upwards [hBound] with p hp ++ simpa [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg (a p))] using hp ++ have htprod_ne : ++ (∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (1 + a p)) ≠ 0 := ++ tprod_one_add_ne_zero_of_summable (R := ℂ) (f := a) (hf := fun p => by ++ simpa [a, Φ, add_sub_cancel] using hΦ_ne p) hsum_norm ++ have : (∏' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (1 + a p)) = ++ divisorComplementCanonicalProduct m f z₀ z₀ := by ++ simp [a, Φ, divisorComplementCanonicalProduct, divisorComplementFactor_def] ++ exact by ++ intro h0 ++ exact htprod_ne (by simpa [this] using h0) ++ ++end Complex.Hadamard ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Exponential.lean b/PrimeNumberTheoremAnd/SiegelZeros/Exponential.lean +new file mode 100644 +index 0000000..082148e +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/Exponential.lean +@@ -0,0 +1,722 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.ProductBounds ++ ++namespace SiegelZeros ++ ++section ++noncomputable section ++ ++namespace Complex ++namespace Hadamard ++ ++open _root_.SiegelZeros.Complex _root_.SiegelZeros.Real BigOperators ++ _root_.SiegelZeros.Finset Set Filter Topology Metric ++ ++open scoped Topology ++ ++theorem zero_free_polynomial_growth_is_exp_poly {H : ℂ → ℂ} {n : ℕ} ++ (hH : Differentiable ℂ H) ++ (h_nonzero : ∀ z, H z ≠ 0) ++ (h_bound : ∃ C > 0, ∀ z, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ n)) : ++ ∃ P : Polynomial ℂ, P.natDegree ≤ n ∧ ∀ z, H z = Complex.exp (Polynomial.eval z P) := by ++ classical ++ rcases h_bound with ⟨C, hCpos, hC⟩ ++ let L : ℂ → ℂ := fun z => deriv H z / H z ++ have hderivH : Differentiable ℂ (deriv H) := by ++ intro z ++ exact ((hH.analyticAt z).deriv).differentiableAt ++ have hL : Differentiable ℂ L := by ++ simpa [L] using! (hderivH.div hH h_nonzero) ++ let h : ℂ → ℂ := fun z => Complex.wedgeIntegral (0 : ℂ) z L ++ have hh_deriv : ∀ z, HasDerivAt h (L z) z := by ++ intro z ++ let r : ℝ := ‖z‖ + 1 ++ have hrpos : 0 < r := by ++ dsimp [r]; linarith [norm_nonneg z] ++ have hz_ball : z ∈ Metric.ball (0 : ℂ) r := by ++ have : dist z (0 : ℂ) < r := by simp [r, dist_zero_right] ++ simpa [Metric.mem_ball] using this ++ have hconserv : Complex.IsConservativeOn L (Metric.ball (0 : ℂ) r) := ++ (hL.differentiableOn).isConservativeOn ++ have hcont : ContinuousOn L (Metric.ball (0 : ℂ) r) := ++ hL.continuous.continuousOn ++ simpa [h, r] using hconserv.hasDerivAt_wedgeIntegral (f_cont := hcont) (hz := hz_ball) ++ have hh : Differentiable ℂ h := fun z => (hh_deriv z).differentiableAt ++ have hderiv_h : ∀ z, deriv h z = L z := fun z => (hh_deriv z).deriv ++ let k : ℂ → ℂ := fun z => h z + Complex.log (H 0) ++ have hk : Differentiable ℂ k := hh.add_const (Complex.log (H 0)) ++ have hk_exp : ∀ z, H z = Complex.exp (k z) := by ++ let F : ℂ → ℂ := fun z => Complex.exp (k z) / H z ++ have hF_deriv : ∀ z, deriv F z = 0 := by ++ intro z ++ have hH_has : HasDerivAt H (deriv H z) z := (hH z).hasDerivAt ++ have hk_has : HasDerivAt k (L z) z := by ++ have hh_has : HasDerivAt h (L z) z := hh_deriv z ++ simpa [k, L] using hh_has.add_const (Complex.log (H 0)) ++ have hExp : HasDerivAt (fun w => Complex.exp (k w)) (Complex.exp (k z) * L z) z := ++ (HasDerivAt.cexp hk_has) ++ have hDiv := (HasDerivAt.div hExp hH_has (h_nonzero z)) ++ have : ++ deriv F z = ++ ((Complex.exp (k z) * L z) * H z - Complex.exp (k z) * deriv H z) / (H z) ^ 2 := by ++ simpa [F] using! hDiv.deriv ++ rw [this] ++ have hnum : ++ (Complex.exp (k z) * L z) * H z - Complex.exp (k z) * deriv H z = 0 := by ++ dsimp [L] ++ field_simp [h_nonzero z] ++ ring ++ simp [hnum] ++ have hF_diff : Differentiable ℂ F := (hk.cexp).div hH h_nonzero ++ have hF_const : ∀ z, F z = F 0 := by ++ intro z ++ exact is_const_of_deriv_eq_zero hF_diff hF_deriv z 0 ++ have hF0 : F 0 = 1 := by ++ have hh0 : h 0 = 0 := by simp [h, Complex.wedgeIntegral] ++ have hk0 : k 0 = Complex.log (H 0) := by simp [k, hh0] ++ have hH0 : H 0 ≠ 0 := h_nonzero 0 ++ simp [F, hk0, Complex.exp_log hH0, hH0] ++ intro z ++ have : F z = 1 := by simpa [hF0] using (hF_const z) ++ have hHz : H z ≠ 0 := h_nonzero z ++ have : Complex.exp (k z) / H z = 1 := by simpa [F] using this ++ have : Complex.exp (k z) = H z := by ++ field_simp [hHz] at this ++ simpa using this ++ exact this.symm ++ have hk_re_bound : ∀ z, (k z).re ≤ C * (1 + ‖z‖) ^ n := by ++ intro z ++ have hHz : H z ≠ 0 := h_nonzero z ++ have hpos : 0 < ‖H z‖ := norm_pos_iff.mpr hHz ++ have hlog_le : Real.log ‖H z‖ ≤ C * (1 + ‖z‖) ^ n := by ++ have := Real.log_le_log hpos (hC z) ++ simpa [Real.log_exp] using this ++ have hlog_eq : Real.log ‖H z‖ = (k z).re := by ++ have : ‖H z‖ = Real.exp (k z).re := by ++ simpa [hk_exp z] using (Complex.norm_exp (k z)) ++ calc ++ Real.log ‖H z‖ = Real.log (Real.exp (k z).re) := by simp [this] ++ _ = (k z).re := by simp ++ simpa [hlog_eq] using hlog_le ++ have hk_iteratedDeriv_eq_zero : ∀ m : ℕ, n < m → iteratedDeriv m k 0 = 0 := by ++ intro m hm ++ have hm' : 0 < (m - n : ℕ) := Nat.sub_pos_of_lt hm ++ have hmne : m - n ≠ 0 := (Nat.pos_iff_ne_zero.1 hm') ++ let f : ℂ → ℂ := fun z => k z - k 0 ++ have hf : Differentiable ℂ f := hk.sub_const (k 0) ++ have hf0 : f 0 = 0 := by simp [f] ++ have hf_re_bound : ∀ R : ℝ, 0 < R → ++ ∀ z, ‖z‖ ≤ R → (f z).re ≤ C * (1 + R) ^ n + ‖k 0‖ := by ++ intro R hRpos z hzR ++ have hkz : (k z).re ≤ C * (1 + ‖z‖) ^ n := hk_re_bound z ++ have hkz' : (k z).re ≤ C * (1 + R) ^ n := by ++ have h1 : (1 + ‖z‖ : ℝ) ≤ 1 + R := by linarith ++ have hpow : (1 + ‖z‖ : ℝ) ^ n ≤ (1 + R) ^ n := ++ pow_le_pow_left₀ (by linarith [norm_nonneg z]) h1 n ++ exact hkz.trans (mul_le_mul_of_nonneg_left hpow (le_of_lt hCpos)) ++ have hRe0 : -(k 0).re ≤ ‖k 0‖ := by ++ have habs : |(k 0).re| ≤ ‖k 0‖ := Complex.abs_re_le_norm (k 0) ++ have hneg : -(k 0).re ≤ |(k 0).re| := by simpa using (neg_le_abs (k 0).re) ++ exact hneg.trans habs ++ have : (f z).re ≤ C * (1 + R) ^ n + ‖k 0‖ := by ++ have : (f z).re = (k z).re - (k 0).re := by simp [f, sub_eq_add_neg] ++ nlinarith [this, hkz', hRe0] ++ exact this ++ have hf_bound_on_ball : ∀ R : ℝ, 0 < R → ++ ∀ z, ‖z‖ ≤ R / 2 → ‖f z‖ ≤ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ intro R hRpos z hz ++ have hR2pos : 0 < R / 2 := by nlinarith ++ have hlt : R / 2 < R := by nlinarith ++ have hMpos : 0 < (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ have : 0 ≤ C * (1 + R) ^ n := by ++ refine mul_nonneg (le_of_lt hCpos) ?_ ++ exact pow_nonneg (by linarith) _ ++ nlinarith [this, norm_nonneg (k 0)] ++ have hf_anal : AnalyticOnNhd ℂ f (Metric.closedBall 0 R) := by ++ intro w _hw ++ exact (hf.analyticAt w) ++ have hf_re : ∀ w, ‖w‖ ≤ R → (f w).re ≤ (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ intro w hw ++ have := hf_re_bound R hRpos w hw ++ linarith ++ have hf_bc := ++ borelCaratheodory_zero_closedBall (f := f) (r := R / 2) (R := R) ++ (M := (C * (1 + R) ^ n + ‖k 0‖ + 1)) ++ hf_anal hR2pos hlt hMpos hf0 hf_re (z := z) hz ++ have hconst : ++ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) * (R / 2) / (R - R / 2) ++ = 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ field_simp [hRpos.ne'] ; ring ++ simpa [hconst] using hf_bc ++ have hCauchy : ∀ R : ℝ, 0 < R → ++ ‖iteratedDeriv m f 0‖ ≤ ++ (m.factorial : ℝ) * (2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) / (R / 2) ^ m := by ++ intro R hRpos ++ have hR2pos : 0 < R / 2 := by nlinarith ++ have hf_diffCont : DiffContOnCl ℂ f (Metric.ball (0 : ℂ) (R / 2)) := hf.diffContOnCl ++ have hbound_sphere : ++ ∀ z ∈ Metric.sphere (0 : ℂ) (R / 2), ++ ‖f z‖ ≤ 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1) := by ++ intro z hz ++ have hz' : ‖z‖ ≤ R / 2 := by ++ simpa [Metric.mem_sphere, dist_zero_right] using (le_of_eq hz) ++ exact hf_bound_on_ball R hRpos z hz' ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using ++ (Complex.norm_iteratedDeriv_le_of_forall_mem_sphere_norm_le (n := m) (c := (0 : ℂ)) ++ (R := R / 2) (C := 2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) ++ (hR := hR2pos) hf_diffCont hbound_sphere) ++ have hf_iter_eq : iteratedDeriv m f 0 = 0 := by ++ by_contra hne ++ have ha : 0 < ‖iteratedDeriv m f 0‖ := norm_pos_iff.2 hne ++ let RHS : ℝ → ℝ := fun R => ++ (m.factorial : ℝ) * (2 * (C * (1 + R) ^ n + ‖k 0‖ + 1)) / (R / 2) ^ m ++ have hle_RHS : ∀ R : ℝ, 0 < R → ‖iteratedDeriv m f 0‖ ≤ RHS R := by ++ intro R hRpos ++ simpa [RHS] using hCauchy R hRpos ++ have hRHS_tendsto : Tendsto RHS atTop (𝓝 0) := by ++ let K : ℝ := ‖k 0‖ + 1 ++ have hmpos : 0 < m := lt_of_le_of_lt (Nat.zero_le n) hm ++ have hm0 : m ≠ 0 := ne_of_gt hmpos ++ have hratio : Tendsto (fun R : ℝ => R ^ n / (R / 2) ^ m) atTop (𝓝 0) := by ++ have hident : ++ (fun R : ℝ => R ^ n / (R / 2) ^ m) = fun R : ℝ => (2 : ℝ) ^ m * (R ^ n / R ^ m) := by ++ funext R ++ simp [div_eq_mul_inv, mul_pow, mul_assoc, mul_comm] ++ have hmain : Tendsto (fun R : ℝ => R ^ n / R ^ m) atTop (𝓝 0) := by ++ have hp : m - n ≠ 0 := (Nat.pos_iff_ne_zero.1 (Nat.sub_pos_of_lt hm)) ++ have hmain' : Tendsto (fun R : ℝ => (R ^ (m - n))⁻¹) atTop (𝓝 0) := by ++ simpa using (tendsto_pow_neg_atTop (𝕜 := ℝ) (n := m - n) hp) ++ have hEq : (fun R : ℝ => (R ^ (m - n))⁻¹) =ᶠ[atTop] fun R : ℝ => R ^ n / R ^ m := by ++ have hEq' : (fun R : ℝ => R ^ n / R ^ m) =ᶠ[atTop] fun R : ℝ => (R ^ (m - n))⁻¹ := by ++ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR ++ have hle : n ≤ m := le_of_lt hm ++ have hm_eq : n + (m - n) = m := Nat.add_sub_of_le hle ++ have hn0 : R ^ n ≠ 0 := pow_ne_zero n hR ++ calc ++ R ^ n / R ^ m = R ^ n / R ^ (n + (m - n)) := by simp [hm_eq] ++ _ = R ^ n * ((R ^ (m - n))⁻¹ * (R ^ n)⁻¹) := by ++ simp [pow_add, div_eq_mul_inv, mul_comm] ++ _ = (R ^ (m - n))⁻¹ := by ++ ring_nf ++ simp [hn0] ++ exact hEq'.symm ++ exact Filter.Tendsto.congr' hEq hmain' ++ have : Tendsto (fun R : ℝ => (2 : ℝ) ^ m * (R ^ n / R ^ m)) atTop (𝓝 ((2 : ℝ) ^ m * 0)) := ++ tendsto_const_nhds.mul hmain ++ simpa [hident] using this ++ have hinv : Tendsto (fun R : ℝ => ((R / 2) ^ m)⁻¹) atTop (𝓝 0) := by ++ have hdiv : Tendsto (fun R : ℝ => R / 2) atTop atTop := ++ (tendsto_id.atTop_div_const (r := (2 : ℝ)) (by norm_num : (0 : ℝ) < 2)) ++ have hpow : Tendsto (fun R : ℝ => (R / 2) ^ m) atTop atTop := ++ (Filter.tendsto_pow_atTop (α := ℝ) (n := m) hm0).comp hdiv ++ simpa using! hpow.inv_tendsto_atTop ++ have hdiv : Tendsto (fun R : ℝ => (1 + R) / R) atTop (𝓝 (1 : ℝ)) := by ++ have hinv' : Tendsto (fun R : ℝ => (R : ℝ)⁻¹) atTop (𝓝 (0 : ℝ)) := tendsto_inv_atTop_zero ++ have hadd : Tendsto (fun R : ℝ => (1 : ℝ) + (R : ℝ)⁻¹) atTop (𝓝 (1 : ℝ)) := by ++ simpa using (tendsto_const_nhds.add hinv') ++ have hEq : (fun R : ℝ => (1 + R) / R) =ᶠ[atTop] fun R : ℝ => (1 : ℝ) + (R : ℝ)⁻¹ := by ++ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR ++ field_simp [hR]; ring ++ exact Filter.Tendsto.congr' hEq.symm hadd ++ have hdiv_pow : Tendsto (fun R : ℝ => ((1 + R) / R) ^ n) atTop (𝓝 (1 : ℝ)) := by ++ simpa using (hdiv.pow n) ++ have hone_add_ratio : ++ Tendsto (fun R : ℝ => (1 + R) ^ n / (R / 2) ^ m) atTop (𝓝 (0 : ℝ)) := by ++ have hEq : ++ (fun R : ℝ => (1 + R) ^ n / (R / 2) ^ m) ++ =ᶠ[atTop] fun R : ℝ => ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) := by ++ filter_upwards [eventually_ne_atTop (0 : ℝ)] with R hR ++ have hRpow : (R ^ n : ℝ) ≠ 0 := pow_ne_zero n hR ++ have hident : ++ ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) = (1 + R) ^ n / (R / 2) ^ m := by ++ calc ++ ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m) ++ = ((1 + R) ^ n / R ^ n) * (R ^ n / (R / 2) ^ m) := by ++ simp [div_pow] ++ _ = ((1 + R) ^ n * R ^ n) / (R ^ n * (R / 2) ^ m) := by ++ simp [div_mul_div_comm, mul_comm] ++ _ = ((1 + R) ^ n * R ^ n) / ((R / 2) ^ m * R ^ n) := by ++ simp [mul_comm] ++ _ = (1 + R) ^ n / (R / 2) ^ m := by ++ simpa [mul_assoc, mul_comm, mul_left_comm] using ++ (mul_div_mul_right (a := (1 + R) ^ n) (b := (R / 2) ^ m) hRpow) ++ exact hident.symm ++ have hmul : ++ Tendsto ++ (fun R : ℝ => ((1 + R) / R) ^ n * (R ^ n / (R / 2) ^ m)) ++ atTop (𝓝 (0 : ℝ)) := by ++ simpa [mul_zero] using (hdiv_pow.mul hratio) ++ exact Filter.Tendsto.congr' hEq.symm hmul ++ have h1 : Tendsto (fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m)) atTop (𝓝 0) := by ++ simpa using (tendsto_const_nhds.mul hone_add_ratio) ++ have h2 : Tendsto (fun R : ℝ => K * ((R / 2) ^ m)⁻¹) atTop (𝓝 0) := by ++ simpa using (tendsto_const_nhds.mul hinv) ++ have hsum : ++ Tendsto ++ (fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m) + K * ((R / 2) ^ m)⁻¹) ++ atTop (𝓝 0) := by ++ simpa using (h1.add h2) ++ have hrew : ++ (fun R : ℝ => (C * (1 + R) ^ n + K) / (R / 2) ^ m) ++ = fun R : ℝ => C * ((1 + R) ^ n / (R / 2) ^ m) + K * ((R / 2) ^ m)⁻¹ := by ++ funext R ++ simp [div_eq_mul_inv, mul_add, mul_assoc, mul_comm] ++ have hbase : Tendsto (fun R : ℝ => (C * (1 + R) ^ n + K) / (R / 2) ^ m) atTop (𝓝 0) := by ++ simpa [hrew] using hsum ++ have hconst : ++ Tendsto (fun _ : ℝ => (m.factorial : ℝ) * (2 : ℝ)) atTop ++ (𝓝 ((m.factorial : ℝ) * (2 : ℝ))) := tendsto_const_nhds ++ have hmul : Tendsto (fun R : ℝ => ((m.factorial : ℝ) * (2 : ℝ)) * ++ ((C * (1 + R) ^ n + K) / (R / 2) ^ m)) atTop (𝓝 0) := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using (hconst.mul hbase) ++ have hRHS_rw : RHS = fun R : ℝ => ((m.factorial : ℝ) * (2 : ℝ)) * ++ ((C * (1 + R) ^ n + K) / (R / 2) ^ m) := by ++ funext R ++ dsimp [RHS, K] ++ ring_nf ++ simpa [hRHS_rw] using hmul ++ have hsmall : ∀ᶠ R in atTop, RHS R < ‖iteratedDeriv m f 0‖ / 2 := ++ (tendsto_order.1 hRHS_tendsto).2 _ (half_pos ha) ++ have hle_eventually : ∀ᶠ R in atTop, ‖iteratedDeriv m f 0‖ ≤ RHS R := by ++ filter_upwards [eventually_gt_atTop (0 : ℝ)] with R hRpos ++ exact hle_RHS R hRpos ++ rcases (hle_eventually.and hsmall).exists with ⟨R, hle, hlt⟩ ++ have : ‖iteratedDeriv m f 0‖ < ‖iteratedDeriv m f 0‖ := ++ (lt_of_le_of_lt hle hlt).trans (half_lt_self ha) ++ exact lt_irrefl _ this ++ have hmpos : 0 < m := lt_of_le_of_lt (Nat.zero_le n) hm ++ have hm0 : m ≠ 0 := ne_of_gt hmpos ++ have hkcd : ContDiffAt ℂ (↑m) k (0 : ℂ) := (hk.analyticAt 0).contDiffAt ++ have hccd : ContDiffAt ℂ (↑m) (fun _ : ℂ => k 0) (0 : ℂ) := contDiffAt_const ++ have hsub : ++ iteratedDeriv m f 0 = ++ iteratedDeriv m k 0 - iteratedDeriv m (fun _ : ℂ => k 0) 0 := by ++ simpa [f] using! (iteratedDeriv_sub (n := m) (x := (0 : ℂ)) hkcd hccd) ++ have hconst0 : iteratedDeriv m (fun _ : ℂ => k 0) 0 = 0 := by ++ simp [iteratedDeriv_const, hm0] ++ have hf_eq : iteratedDeriv m f 0 = iteratedDeriv m k 0 := by ++ simp [hsub, hconst0] ++ simpa [hf_eq] using hf_iter_eq ++ let P : Polynomial ℂ := ++ ∑ m ∈ Finset.range (n + 1), Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) ++ have hPdeg : P.natDegree ≤ n := by ++ have hnat : ++ P.natDegree ≤ ++ Finset.fold max 0 ++ (fun m : ℕ => ++ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) ++ (Finset.range (n + 1)) := by ++ simpa [P, Function.comp] using ++ (Polynomial.natDegree_sum_le (s := Finset.range (n + 1)) ++ (f := fun m : ℕ => ++ Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0))) ++ have hfold : ++ Finset.fold max 0 ++ (fun m : ℕ => ++ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) ++ (Finset.range (n + 1)) ≤ n := by ++ refine (Finset.fold_max_le (f := fun m : ℕ => ++ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree) ++ (b := 0) (s := Finset.range (n + 1)) (c := n)).2 ?_ ++ refine ⟨Nat.zero_le n, ?_⟩ ++ intro m hm ++ have hmon : ++ (Polynomial.monomial m ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0)).natDegree ≤ m := ++ Polynomial.natDegree_monomial_le _ ++ have hm_le : m ≤ n := Nat.le_of_lt_succ (Finset.mem_range.1 hm) ++ exact hmon.trans hm_le ++ exact hnat.trans hfold ++ have hk_poly : ∀ z, k z = Polynomial.eval z P := by ++ intro z ++ have htaylor := Complex.taylorSeries_eq_of_entire' (c := (0 : ℂ)) (z := z) hk ++ have htail : ∀ m : ℕ, m ∉ Finset.range (n + 1) → ++ ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m) = 0 := by ++ intro m hm' ++ have hmgt : n < m := by ++ have : n + 1 ≤ m := Nat.le_of_not_lt (by simpa [Finset.mem_range] using hm') ++ exact Nat.lt_of_lt_of_le (Nat.lt_succ_self n) this ++ have hz : iteratedDeriv m k 0 = 0 := hk_iteratedDeriv_eq_zero m hmgt ++ simp [hz] ++ have htsum : ++ (∑' m : ℕ, (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m) ++ = ∑ m ∈ Finset.range (n + 1), (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * z ^ m := by ++ simpa [sub_zero] using (tsum_eq_sum (s := Finset.range (n + 1)) htail) ++ have hfinite : ++ k z = ∑ m ∈ Finset.range (n + 1), (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * z ^ m := by ++ calc ++ k z = ∑' m : ℕ, (m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0 * (z - 0) ^ m := by ++ simpa using htaylor.symm ++ _ = _ := htsum ++ have hEval : ++ Polynomial.eval z P = ++ ∑ m ∈ Finset.range (n + 1), z ^ m * ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) := by ++ classical ++ change Polynomial.eval₂ (RingHom.id ℂ) z P = _ ++ let φ : Polynomial ℂ →+* ℂ := Polynomial.eval₂RingHom (RingHom.id ℂ) z ++ change φ P = _ ++ simp [P, φ, Polynomial.eval₂_monomial, mul_comm] ++ have hfinite' : ++ k z = ∑ m ∈ Finset.range (n + 1), z ^ m * ((m.factorial : ℂ)⁻¹ * iteratedDeriv m k 0) := by ++ simpa [mul_comm, mul_left_comm, mul_assoc] using hfinite ++ simpa [hEval] using hfinite' ++ refine ⟨P, hPdeg, ?_⟩ ++ intro z ++ have : H z = Complex.exp (k z) := by simp [hk_exp z] ++ simp [this, hk_poly z] ++ ++end Hadamard ++end Complex ++end ++end ++section ++noncomputable section ++ ++namespace Complex ++namespace Hadamard ++ ++open _root_.SiegelZeros.Complex _root_.SiegelZeros.Real BigOperators ++ _root_.SiegelZeros.Finset Set Filter Topology Metric ++ ++open scoped Topology ++ ++open Polynomial ++ ++private lemma exists_pow_eq_complex {n : ℕ} (hn : 0 < n) (w : ℂ) : ∃ z : ℂ, z ^ n = w := by ++ classical ++ by_cases hw : w = 0 ++ · subst hw ++ refine ⟨0, ?_⟩ ++ have hn0 : n ≠ 0 := Nat.ne_of_gt hn ++ simp [hn0] ++ · refine ⟨Complex.exp (Complex.log w / n), ?_⟩ ++ have hn0 : (n : ℂ) ≠ 0 := by ++ exact_mod_cast (Nat.ne_of_gt hn) ++ calc ++ (Complex.exp (Complex.log w / n)) ^ n ++ = Complex.exp ((n : ℂ) * (Complex.log w / n)) := by ++ simpa using (Complex.exp_nat_mul (Complex.log w / n) n).symm ++ _ = Complex.exp (Complex.log w) := by ++ have : (n : ℂ) * (Complex.log w / n) = Complex.log w := by ++ field_simp [hn0] ++ simp [this] ++ _ = w := by simpa using (Complex.exp_log hw) ++ ++private lemma mul_conj_div_norm (a : ℂ) (ha : a ≠ 0) : ++ a * ((starRingEnd ℂ) a / (‖a‖ : ℂ)) = (‖a‖ : ℂ) := by ++ have hnorm_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha ++ have hnorm_ne : (‖a‖ : ℂ) ≠ 0 := by ++ exact_mod_cast (ne_of_gt hnorm_pos) ++ have hmul : a * (starRingEnd ℂ) a = (Complex.normSq a : ℂ) := ++ Complex.mul_conj a ++ have hcast : (Complex.normSq a : ℂ) = ((‖a‖ ^ 2 : ℝ) : ℂ) := by ++ exact_mod_cast (Complex.normSq_eq_norm_sq a) ++ have hdiv : ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) = (‖a‖ : ℂ) := by ++ have : ((‖a‖ ^ 2 : ℝ) : ℂ) = (‖a‖ : ℂ) * (‖a‖ : ℂ) := by ++ simp [pow_two] ++ calc ++ ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) ++ = ((‖a‖ : ℂ) * (‖a‖ : ℂ)) / (‖a‖ : ℂ) := by simp [this] ++ _ = (‖a‖ : ℂ) := by ++ field_simp [hnorm_ne] ++ calc ++ a * ((starRingEnd ℂ) a / (‖a‖ : ℂ)) ++ = (a * (starRingEnd ℂ) a) / (‖a‖ : ℂ) := by ++ simp [div_eq_mul_inv, mul_assoc] ++ _ = (Complex.normSq a : ℂ) / (‖a‖ : ℂ) := by simp [hmul] ++ _ = ((‖a‖ ^ 2 : ℝ) : ℂ) / (‖a‖ : ℂ) := by simp [hcast] ++ _ = (‖a‖ : ℂ) := hdiv ++ ++private lemma exists_z_norm_eq_re_eval_ge ++ (P : Polynomial ℂ) (hn : 0 < P.natDegree) : ++ ∃ R0 : ℝ, 0 < R0 ∧ ++ ∀ R : ℝ, R0 ≤ R → ++ ∃ z : ℂ, ‖z‖ = R ∧ ++ (‖P.leadingCoeff‖ / 2) * R ^ P.natDegree ≤ (P.eval z).re := by ++ classical ++ set n : ℕ := P.natDegree ++ have hn0 : 0 < n := hn ++ have hP0 : P ≠ 0 := by ++ intro h0 ++ simp [n, h0] at hn0 ++ have hLC : P.leadingCoeff ≠ 0 := Polynomial.leadingCoeff_ne_zero.mpr hP0 ++ set a : ℂ := P.leadingCoeff ++ have ha : a ≠ 0 := hLC ++ have hnorm_a_pos : 0 < ‖a‖ := norm_pos_iff.mpr ha ++ set wtarget : ℂ := (starRingEnd ℂ) a / (‖a‖ : ℂ) ++ have hwtarget_norm : ‖wtarget‖ = (1 : ℝ) := by ++ calc ++ ‖wtarget‖ = ‖(starRingEnd ℂ) a‖ / ‖(‖a‖ : ℂ)‖ := by ++ simp [wtarget] ++ _ = ‖a‖ / ‖a‖ := by simp ++ _ = (1 : ℝ) := by ++ field_simp [hnorm_a_pos.ne'] ++ rcases exists_pow_eq_complex (n := n) hn0 (w := wtarget) with ⟨w, hw⟩ ++ have hw_norm : ‖w‖ = (1 : ℝ) := by ++ have hpow : (‖w‖ : ℝ) ^ n = 1 := by ++ have := congrArg (fun z : ℂ => ‖z‖) hw ++ simpa [norm_pow, hwtarget_norm] using this ++ have hn0' : n ≠ 0 := Nat.ne_of_gt hn0 ++ exact (pow_eq_one_iff_of_nonneg (norm_nonneg w) hn0').1 hpow ++ set S : ℝ := ∑ i ∈ Finset.range n, ‖P.coeff i‖ ++ set R0 : ℝ := max 1 (2 * S / ‖a‖) ++ refine ⟨R0, ?_, ?_⟩ ++ · have : (0 : ℝ) < (1 : ℝ) := by norm_num ++ exact lt_of_lt_of_le this (le_max_left _ _) ++ · intro R hR ++ have hR_ge1 : (1 : ℝ) ≤ R := by ++ exact le_trans (le_max_left _ _) hR ++ have hR_nonneg : 0 ≤ R := le_trans (by norm_num) hR_ge1 ++ set z : ℂ := (R : ℂ) * w ++ have hz_norm : ‖z‖ = R := by ++ have : ‖z‖ = |R| * ‖w‖ := by ++ simp [z] ++ simp [this, hw_norm, abs_of_nonneg hR_nonneg] ++ have h_eval : P.eval z = ++ (∑ i ∈ Finset.range n, P.coeff i * z ^ i) + P.coeff n * z ^ n := by ++ have hsum : P.eval z = ∑ i ∈ Finset.range (n + 1), P.coeff i * z ^ i := by ++ have : P.natDegree + 1 = n + 1 := by simp [n] ++ simpa [this] using (Polynomial.eval_eq_sum_range (p := P) z) ++ have hsplit : ++ (∑ i ∈ Finset.range (n + 1), P.coeff i * z ^ i) ++ = (∑ i ∈ Finset.range n, P.coeff i * z ^ i) + P.coeff n * z ^ n := by ++ simpa using (Finset.sum_range_succ (f := fun i => P.coeff i * z ^ i) n) ++ exact hsum.trans hsplit ++ have h_lower_norm : ++ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ S * R ^ (n - 1) := by ++ have h1 : ++ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ++ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ := by ++ simpa using (norm_sum_le (Finset.range n) (fun i => P.coeff i * z ^ i)) ++ have hterm : ∀ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ ≤ ‖P.coeff i‖ * R ^ (n - 1) := by ++ intro i hi ++ have hi_lt : i < n := Finset.mem_range.mp hi ++ have hi_le : i ≤ n - 1 := Nat.le_pred_of_lt hi_lt ++ have hzpow : ‖z‖ ^ i ≤ R ^ (n - 1) := by ++ have hmono : ‖z‖ ^ i ≤ ‖z‖ ^ (n - 1) := ++ pow_le_pow_right₀ (by simpa [hz_norm] using hR_ge1) hi_le ++ simpa [hz_norm] using hmono ++ calc ++ ‖P.coeff i * z ^ i‖ = ‖P.coeff i‖ * ‖z‖ ^ i := by ++ simp [norm_pow] ++ _ ≤ ‖P.coeff i‖ * R ^ (n - 1) := by ++ exact mul_le_mul_of_nonneg_left hzpow (norm_nonneg _) ++ have h2 : ++ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ ++ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1) := by ++ exact Finset.sum_le_sum (fun i hi => hterm i hi) ++ have h3 : ++ (∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1)) ++ = (∑ i ∈ Finset.range n, ‖P.coeff i‖) * R ^ (n - 1) := by ++ simp [Finset.sum_mul] ++ have hsum_le : (∑ i ∈ Finset.range n, ‖P.coeff i‖) ≤ S := by ++ simp [S] ++ calc ++ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ++ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i * z ^ i‖ := h1 ++ _ ≤ ∑ i ∈ Finset.range n, ‖P.coeff i‖ * R ^ (n - 1) := h2 ++ _ = (∑ i ∈ Finset.range n, ‖P.coeff i‖) * R ^ (n - 1) := h3 ++ _ ≤ S * R ^ (n - 1) := by ++ exact mul_le_mul_of_nonneg_right hsum_le (pow_nonneg hR_nonneg _) ++ have h_lead_re : (P.coeff n * z ^ n).re = ‖a‖ * R ^ n := by ++ have hw_pow : w ^ n = wtarget := hw ++ have ha_mul : a * w ^ n = (‖a‖ : ℂ) := by ++ have : a * w ^ n = a * wtarget := by simp [hw_pow] ++ simpa [wtarget, a] using (this.trans (mul_conj_div_norm a ha)) ++ have hz_pow : z ^ n = ((R : ℂ) ^ n) * (w ^ n) := by ++ simp [z, mul_pow, mul_comm] ++ have hcoeffn : P.coeff n = a := by simp [a, n, Polynomial.coeff_natDegree] ++ have hreR : ∀ m : ℕ, (((R : ℂ) ^ m).re) = R ^ m := by ++ intro m ++ induction m with ++ | zero => simp ++ | succ m ih => ++ simp [pow_succ, ih, Complex.mul_re] ++ calc ++ (P.coeff n * z ^ n).re ++ = (a * z ^ n).re := by simp [hcoeffn] ++ _ = (a * (((R : ℂ) ^ n) * (w ^ n))).re := by simp [hz_pow] ++ _ = (((R : ℂ) ^ n) * (a * (w ^ n))).re := by ++ ring_nf ++ _ = (((R : ℂ) ^ n) * (‖a‖ : ℂ)).re := by simp [ha_mul] ++ _ = (((R : ℂ) ^ n).re) * ‖a‖ := by ++ simp [Complex.mul_re] ++ _ = (R ^ n) * ‖a‖ := by simp [hreR n] ++ _ = ‖a‖ * R ^ n := by ring ++ refine ⟨z, hz_norm, ?_⟩ ++ have hre_lower : (∑ i ∈ Finset.range n, P.coeff i * z ^ i).re ++ ≥ -‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := by ++ have habs : |(∑ i ∈ Finset.range n, P.coeff i * z ^ i).re| ++ ≤ ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := ++ Complex.abs_re_le_norm _ ++ have := neg_le_of_abs_le habs ++ simpa using this ++ have hre_main : ++ (P.eval z).re ≥ (P.coeff n * z ^ n).re - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := by ++ have : (P.eval z).re = ++ (∑ i ∈ Finset.range n, P.coeff i * z ^ i).re + (P.coeff n * z ^ n).re := by ++ simp [h_eval, add_comm] ++ linarith [this, hre_lower] ++ have hR_ge_R0 : R0 ≤ R := hR ++ have hR_ge : 2 * S / ‖a‖ ≤ R := le_trans (le_max_right _ _) hR_ge_R0 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR_ge1 ++ have hR_nonneg' : 0 ≤ R := le_of_lt hRpos ++ have hn_ge1 : 1 ≤ n := Nat.succ_le_of_lt hn0 ++ have hlower_le : S * R ^ (n - 1) ≤ (‖a‖ / 2) * R ^ n := by ++ have ha_pos : 0 < ‖a‖ := hnorm_a_pos ++ have hS_le : S ≤ (‖a‖ / 2) * R := by ++ have : 2 * S ≤ ‖a‖ * R := by ++ have := (mul_le_mul_of_nonneg_left hR_ge (by linarith [ha_pos.le] : (0 : ℝ) ≤ ‖a‖)) ++ have hne : (‖a‖ : ℝ) ≠ 0 := ne_of_gt ha_pos ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm, hne] using this ++ have : S ≤ (‖a‖ * R) / 2 := by linarith ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using this ++ have : S * R ^ (n - 1) ≤ (‖a‖ / 2) * R * R ^ (n - 1) := by ++ have hpow_nonneg : 0 ≤ R ^ (n - 1) := pow_nonneg hR_nonneg' _ ++ exact mul_le_mul_of_nonneg_right hS_le hpow_nonneg ++ have hRR : R * R ^ (n - 1) = R ^ n := by ++ have : n = (n - 1) + 1 := by ++ exact (Nat.sub_add_cancel hn_ge1).symm ++ rw [this, pow_succ] ++ ring_nf; grind ++ simpa [mul_assoc, hRR] using this ++ have hfinal_re : ++ (‖a‖ / 2) * R ^ n ≤ (P.eval z).re := by ++ have hlower' : ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ (‖a‖ / 2) * R ^ n := by ++ exact h_lower_norm.trans hlower_le ++ have hlead : (P.coeff n * z ^ n).re = ‖a‖ * R ^ n := by simpa [a] using h_lead_re ++ have hre_main' : ++ (‖a‖ * R ^ n) - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ ≤ (P.eval z).re := by ++ simpa [hlead] using hre_main ++ have hsub : ++ (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n ≤ ++ (‖a‖ * R ^ n) - ‖∑ i ∈ Finset.range n, P.coeff i * z ^ i‖ := ++ sub_le_sub_left hlower' (‖a‖ * R ^ n) ++ have hsim : (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n = (‖a‖ / 2) * R ^ n := by ring ++ have : (‖a‖ * R ^ n) - (‖a‖ / 2) * R ^ n ≤ (P.eval z).re := ++ hsub.trans hre_main' ++ simpa [hsim] using this ++ simpa [a, n] using hfinal_re ++ ++theorem natDegree_le_floor_of_growth_exp_eval ++ {ρ : ℝ} (hρ : 0 ≤ ρ) (P : Polynomial ℂ) ++ (hgrowth : ++ ∃ C > 0, ∀ z : ℂ, ++ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ ρ) : ++ P.natDegree ≤ Nat.floor ρ := by ++ classical ++ by_cases hdeg : P.natDegree = 0 ++ · simp [hdeg] ++ · have hnpos : 0 < P.natDegree := Nat.pos_of_ne_zero hdeg ++ rcases exists_z_norm_eq_re_eval_ge (P := P) hnpos with ⟨R0, hR0pos, hray⟩ ++ rcases hgrowth with ⟨C, hCpos, hC⟩ ++ have hLCpos : 0 < ‖P.leadingCoeff‖ := by ++ have hP0 : P ≠ 0 := by ++ intro h0 ++ simp [h0] at hdeg ++ have : P.leadingCoeff ≠ 0 := (Polynomial.leadingCoeff_ne_zero).2 hP0 ++ exact norm_pos_iff.2 this ++ let c : ℝ := ‖P.leadingCoeff‖ / 2 ++ have hcpos : 0 < c := by ++ have : (0 : ℝ) < (2 : ℝ) := by norm_num ++ exact (div_pos hLCpos this) ++ have hn_le_real : (P.natDegree : ℝ) ≤ ρ := by ++ by_contra hnlt ++ have hnlt' : ρ < (P.natDegree : ℝ) := lt_of_not_ge hnlt ++ let δ : ℝ := (P.natDegree : ℝ) - ρ ++ have hδ : 0 < δ := sub_pos.2 hnlt' ++ let K0 : ℝ := (C * (2 : ℝ) ^ ρ) / c ++ have hK0 : ∃ R1, ∀ R ≥ R1, K0 + 1 ≤ R ^ δ := by ++ have h : ∀ᶠ R in (atTop : Filter ℝ), K0 + 1 ≤ R ^ δ := ++ (tendsto_atTop.mp (tendsto_rpow_atTop hδ)) (K0 + 1) ++ rcases (eventually_atTop.1 h) with ⟨R1, hR1⟩ ++ exact ⟨R1, hR1⟩ ++ rcases hK0 with ⟨R1, hR1⟩ ++ set R : ℝ := max (max R0 1) R1 ++ have hR_ge_R0 : R0 ≤ R := le_trans (le_max_left _ _) (le_max_left _ _) ++ have hR_ge1 : (1 : ℝ) ≤ R := le_trans (le_max_right _ _) (le_max_left _ _) ++ have hR_ge_R1 : R1 ≤ R := le_max_right _ _ ++ have hR_pos : 0 < R := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hR_ge1 ++ have hRδ : K0 + 1 ≤ R ^ δ := hR1 R hR_ge_R1 ++ rcases hray R hR_ge_R0 with ⟨z, hz_norm, hz_re⟩ ++ have hlog_lower : ++ (P.eval z).re ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := by ++ have hpos : 0 < ‖Complex.exp (Polynomial.eval z P)‖ := by ++ simp ++ have hle : ++ ‖Complex.exp (Polynomial.eval z P)‖ ≤ ++ 1 + ‖Complex.exp (Polynomial.eval z P)‖ := by ++ linarith [norm_nonneg (Complex.exp (Polynomial.eval z P))] ++ have hlog_le : Real.log ‖Complex.exp (Polynomial.eval z P)‖ ++ ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := ++ Real.log_le_log hpos hle ++ have hlog_eq : Real.log ‖Complex.exp (Polynomial.eval z P)‖ = (P.eval z).re := by ++ simp [Complex.norm_exp] ++ simpa [hlog_eq] using hlog_le ++ have hlog_upper : ++ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ ρ := ++ hC z ++ have hmain : c * R ^ (P.natDegree : ℝ) ≤ C * (1 + R) ^ ρ := by ++ have hz_re' : c * R ^ P.natDegree ≤ (P.eval z).re := by ++ simpa [c] using hz_re ++ have hz_re'' : c * R ^ (P.natDegree : ℝ) ≤ (P.eval z).re := by ++ simpa [Real.rpow_natCast, c] using hz_re' ++ have : c * R ^ (P.natDegree : ℝ) ≤ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) := ++ hz_re''.trans hlog_lower ++ have : c * R ^ (P.natDegree : ℝ) ≤ C * (1 + ‖z‖) ^ ρ := ++ this.trans hlog_upper ++ simpa [hz_norm] using this ++ have h1R_le : (1 + R : ℝ) ≤ R * 2 := by linarith ++ have hpow1 : (1 + R : ℝ) ^ ρ ≤ (R * 2) ^ ρ := ++ Real.rpow_le_rpow (by linarith [hR_pos.le]) h1R_le hρ ++ have hR2 : (R * 2) ^ ρ = R ^ ρ * (2 : ℝ) ^ ρ := by ++ have hRnonneg : 0 ≤ R := le_of_lt hR_pos ++ have h2nonneg : 0 ≤ (2 : ℝ) := by norm_num ++ simpa [mul_assoc] using (Real.mul_rpow hRnonneg h2nonneg (z := ρ)) ++ have hmain' : c * R ^ (P.natDegree : ℝ) ≤ C * (R ^ ρ * (2 : ℝ) ^ ρ) := by ++ have := le_trans hmain (mul_le_mul_of_nonneg_left hpow1 (le_of_lt hCpos)) ++ simpa [hR2, mul_assoc, mul_left_comm, mul_comm] using this ++ have hRρ_pos : 0 < R ^ ρ := Real.rpow_pos_of_pos hR_pos _ ++ have hRρ_ne : (R ^ ρ : ℝ) ≠ 0 := ne_of_gt hRρ_pos ++ have hdiv : ++ (c * R ^ (P.natDegree : ℝ)) / (R ^ ρ) ≤ C * (2 : ℝ) ^ ρ := by ++ have h := ++ div_le_div_of_nonneg_right hmain' (le_of_lt hRρ_pos) ++ have hRhs : (C * (R ^ ρ * (2 : ℝ) ^ ρ)) / (R ^ ρ) = C * (2 : ℝ) ^ ρ := by ++ field_simp [hRρ_ne] ++ simpa [hRhs, mul_assoc, mul_left_comm, mul_comm] using h ++ have hRsub : R ^ δ = R ^ (P.natDegree : ℝ) / R ^ ρ := by ++ simpa [δ] using (Real.rpow_sub hR_pos (P.natDegree : ℝ) ρ) ++ have hRδ_le : c * (R ^ δ) ≤ C * (2 : ℝ) ^ ρ := by ++ have hLhs : c * (R ^ δ) = (c * R ^ (P.natDegree : ℝ)) / (R ^ ρ) := by ++ simp [hRsub, div_eq_mul_inv, mul_left_comm, mul_comm] ++ simpa [hLhs] using hdiv ++ have hRδ_le' : R ^ δ ≤ K0 := by ++ have : R ^ δ ≤ (C * (2 : ℝ) ^ ρ) / c := by ++ refine (le_div_iff₀ hcpos).2 ?_ ++ simpa [mul_assoc, mul_left_comm, mul_comm] using hRδ_le ++ simpa [K0] using this ++ have : K0 + 1 ≤ K0 := le_trans hRδ (le_trans hRδ_le' (le_rfl)) ++ exact (not_lt_of_ge this) (lt_add_of_pos_right _ (by norm_num : (0 : ℝ) < 1)) ++ exact (Nat.le_floor_iff hρ).2 hn_le_real ++ ++theorem natDegree_le_floor_of_exp_eval_norm_bound {τ : ℝ} (hτ : 0 ≤ τ) (P : Polynomial ℂ) ++ (hbound : ++ ∃ C > 0, ∀ z : ℂ, ++ ‖Complex.exp (Polynomial.eval z P)‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ)) : ++ P.natDegree ≤ Nat.floor τ := by ++ rcases hbound with ⟨C, hCpos, hC⟩ ++ have hlog_growth : ++ ∃ C > 0, ∀ z : ℂ, ++ Real.log (1 + ‖Complex.exp (Polynomial.eval z P)‖) ≤ C * (1 + ‖z‖) ^ τ := ++ Real.log_growth_of_norm_le_exp_mul_rpow ++ (f := fun z : ℂ => Complex.exp (Polynomial.eval z P)) ++ (r := fun z : ℂ => 1 + ‖z‖) hCpos hτ ++ (fun z => by linarith [norm_nonneg z]) hC ++ exact natDegree_le_floor_of_growth_exp_eval (ρ := τ) hτ P hlog_growth ++ ++end Hadamard ++end Complex ++end ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Factorization.lean b/PrimeNumberTheoremAnd/SiegelZeros/Factorization.lean +new file mode 100644 +index 0000000..8fb7d8e +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/Factorization.lean +@@ -0,0 +1,415 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.DivisorLimits ++ ++namespace SiegelZeros ++ ++section ++namespace Complex.Hadamard ++ ++open Filter Topology Set _root_.SiegelZeros.Complex ++ ++open scoped BigOperators Topology ++ ++noncomputable def hadamardDenom (m : ℕ) (f : ℂ → ℂ) (z : ℂ) : ℂ := ++ z ^ (analyticOrderNatAt f 0) * divisorCanonicalProduct m f (Set.univ : Set ℂ) z ++ ++theorem differentiable_divisorCanonicalProduct_univ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by ++ intro z ++ have hdiffOn : ++ DifferentiableOn ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) (Set.univ : Set ℂ) := ++ differentiableOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ exact (hdiffOn z (by simp)).differentiableAt (by simp) ++ ++theorem analyticAt_divisorCanonicalProduct_univ (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : ++ AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := ++ (differentiable_divisorCanonicalProduct_univ m f h_sum).analyticAt z ++ ++theorem differentiable_hadamardDenom (m : ℕ) (f : ℂ → ℂ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ Differentiable ℂ (hadamardDenom m f) := by ++ have hcprod : Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by ++ exact differentiable_divisorCanonicalProduct_univ m f h_sum ++ simpa [hadamardDenom] using! (differentiable_id.pow (analyticOrderNatAt f 0)).mul hcprod ++ ++theorem hadamardDenom_ne_zero_at {m : ℕ} {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (hnot : ∃ z : ℂ, f z ≠ 0) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) {z : ℂ} (hz : f z ≠ 0) : hadamardDenom m f z ≠ 0 := by ++ have hf_not_top : ∀ w : ℂ, analyticOrderAt f w ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hf) hnot ++ have han_f : AnalyticAt ℂ f z := hf.analyticAt z ++ have horder_f : analyticOrderNatAt f z = 0 := by ++ have : analyticOrderAt f z = 0 := (han_f.analyticOrderAt_eq_zero).2 hz ++ have hcast : (analyticOrderNatAt f z : ℕ∞) = analyticOrderAt f z := ++ Nat.cast_analyticOrderNatAt (f := f) (z₀ := z) (hf_not_top z) ++ have : (analyticOrderNatAt f z : ℕ∞) = 0 := by simp [hcast, this] ++ exact_mod_cast this ++ have han_cprod : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by ++ exact analyticAt_divisorCanonicalProduct_univ m f h_sum z ++ by_cases hz0 : z = 0 ++ · subst hz0 ++ have hord0 : analyticOrderNatAt f 0 = 0 := by simpa using horder_f ++ simp [hadamardDenom, hord0, divisorCanonicalProduct_zero] ++ · have hp : z ^ (analyticOrderNatAt f 0) ≠ 0 := pow_ne_zero _ hz0 ++ have hcprod_order : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = 0 := by ++ simpa [horder_f] using ++ (analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt (m := m) (hf := hf) ++ (h_sum := h_sum) (z₀ := z) hz0) ++ have hcprod_ne : divisorCanonicalProduct m f (Set.univ : Set ℂ) z ≠ 0 := by ++ have hcprod_entire : ++ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by ++ exact differentiable_divisorCanonicalProduct_univ m f h_sum ++ have hcprod_not_top : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hcprod_entire) ++ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ z ++ have hcprod_cast : ++ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z : ℕ∞) = ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := ++ Nat.cast_analyticOrderNatAt ++ (f := divisorCanonicalProduct m f (Set.univ : Set ℂ)) (z₀ := z) hcprod_not_top ++ have : analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = 0 := by ++ have : ++ (analyticOrderNatAt ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z : ℕ∞) = 0 := by ++ exact_mod_cast hcprod_order ++ simp [hcprod_cast] at this ++ simpa using this ++ exact (han_cprod.analyticOrderAt_eq_zero).1 this ++ exact mul_ne_zero hp hcprod_ne ++ ++lemma analyticOrderNatAt_divisorCanonicalProduct_zero ++ (m : ℕ) (f : ℂ → ℂ) (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := by ++ have hcprod_entire : ++ Differentiable ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) := by ++ exact differentiable_divisorCanonicalProduct_univ m f h_sum ++ have hcprod_not_top : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (hf := hcprod_entire) ++ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ 0 ++ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := ++ hcprod_entire.analyticAt 0 ++ have hcprod0 : divisorCanonicalProduct m f (Set.univ : Set ℂ) 0 ≠ 0 := by ++ simp [divisorCanonicalProduct_zero] ++ have : analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := ++ (hcprodA.analyticOrderAt_eq_zero).2 hcprod0 ++ have hcast : ++ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 : ℕ∞) = ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := ++ Nat.cast_analyticOrderNatAt ++ (f := divisorCanonicalProduct m f (Set.univ : Set ℂ)) (z₀ := (0 : ℂ)) hcprod_not_top ++ have : ++ (analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 : ℕ∞) = ++ 0 := by ++ simp [hcast, this] ++ exact_mod_cast this ++ ++theorem analyticOrderNatAt_hadamardDenom_eq ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) (z : ℂ) : ++ analyticOrderNatAt (hadamardDenom m f) z = analyticOrderNatAt f z := by ++ by_cases hz0 : z = 0 ++ · subst hz0 ++ have hpowA : AnalyticAt ℂ (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 := by ++ simpa using! (analyticAt_id.pow (analyticOrderNatAt f 0)) ++ have hpow_not_top : ++ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero ++ (hf := (differentiable_id.pow (analyticOrderNatAt f 0))) ++ ⟨1, by simp⟩ 0 ++ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := by ++ exact analyticAt_divisorCanonicalProduct_univ m f h_sum 0 ++ have hcprod0 : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 = 0 := ++ analyticOrderNatAt_divisorCanonicalProduct_zero (m := m) (f := f) h_sum ++ have hid0 : analyticOrderNatAt (fun z : ℂ => z) 0 = 1 := by ++ have hid_entire : Differentiable ℂ (fun z : ℂ => z) := differentiable_id ++ have hdiv : ++ (MeromorphicOn.divisor (fun z : ℂ => z) (Set.univ : Set ℂ)) 0 = ++ (analyticOrderNatAt (fun z : ℂ => z) 0 : ℤ) := by ++ simpa using ++ (divisor_univ_eq_analyticOrderNatAt_int ++ (f := fun z : ℂ => z) hid_entire 0) ++ have hdiv1 : (MeromorphicOn.divisor (fun z : ℂ => z) (Set.univ : Set ℂ)) 0 = 1 := by ++ simpa using ++ (MeromorphicOn.divisor_sub_const_self (z₀ := (0 : ℂ)) ++ (U := (Set.univ : Set ℂ)) (by simp)) ++ have : (analyticOrderNatAt (fun z : ℂ => z) 0 : ℤ) = 1 := by ++ simpa [hdiv] using hdiv1 ++ exact_mod_cast this ++ have hpow0 : ++ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 = ++ analyticOrderNatAt f 0 := by ++ have hidA : AnalyticAt ℂ (fun z : ℂ => z) 0 := by ++ simpa [id] using! (analyticAt_id : AnalyticAt ℂ (id : ℂ → ℂ) 0) ++ simpa [hid0] using! (analyticOrderNatAt_pow (hf := hidA) (n := analyticOrderNatAt f 0)) ++ have hmul : ++ analyticOrderNatAt (hadamardDenom m f) 0 = ++ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) 0 + ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 := by ++ have hcprod_not_top' : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) 0 ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero ++ (hf := differentiable_divisorCanonicalProduct_univ m f h_sum) ++ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ 0 ++ simpa [hadamardDenom] using! ++ analyticOrderNatAt_mul (hf := hpowA) (hg := hcprodA) ++ (hf' := hpow_not_top) (hg' := hcprod_not_top') ++ simp [hmul, hpow0, hcprod0] ++ · have hpowA : AnalyticAt ℂ (fun z : ℂ => z ^ analyticOrderNatAt f 0) z := by ++ simpa using! (analyticAt_id.pow (analyticOrderNatAt f 0)) ++ have hpow_not_top : ++ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero ++ (hf := (differentiable_id.pow (analyticOrderNatAt f 0))) ++ ⟨1, by simp⟩ z ++ have hpow0 : analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z = 0 := by ++ have hz' : (fun z : ℂ => z ^ analyticOrderNatAt f 0) z ≠ 0 := by ++ simp [hz0] ++ have : analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z = 0 := ++ ((hpowA).analyticOrderAt_eq_zero).2 hz' ++ have hcast : (analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z : ℕ∞) = ++ analyticOrderAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z := ++ Nat.cast_analyticOrderNatAt ++ (f := fun z : ℂ => z ^ analyticOrderNatAt f 0) (z₀ := z) hpow_not_top ++ have : (analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z : ℕ∞) = 0 := by ++ simp [hcast, this] ++ exact_mod_cast this ++ have hcprod_eq : ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z = ++ analyticOrderNatAt f z := ++ analyticOrderNatAt_divisorCanonicalProduct_eq_analyticOrderNatAt ++ (m := m) (hf := hf) (h_sum := h_sum) (z₀ := z) hz0 ++ have hcprodA : AnalyticAt ℂ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by ++ exact analyticAt_divisorCanonicalProduct_univ m f h_sum z ++ have hcprod_not_top : ++ analyticOrderAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero ++ (hf := differentiable_divisorCanonicalProduct_univ m f h_sum) ++ ⟨0, by simp [divisorCanonicalProduct_zero]⟩ z ++ have hmul : ++ analyticOrderNatAt (hadamardDenom m f) z = ++ analyticOrderNatAt (fun z : ℂ => z ^ analyticOrderNatAt f 0) z + ++ analyticOrderNatAt (divisorCanonicalProduct m f (Set.univ : Set ℂ)) z := by ++ simpa [hadamardDenom] using! ++ analyticOrderNatAt_mul (hf := hpowA) (hg := hcprodA) ++ (hf' := hpow_not_top) (hg' := hcprod_not_top) ++ simp [hmul, hpow0, hcprod_eq] ++ ++theorem divisor_hadamardDenom_eq ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) = ++ MeromorphicOn.divisor f (Set.univ : Set ℂ) := by ++ ext z ++ have hden_entire : Differentiable ℂ (hadamardDenom m f) := ++ differentiable_hadamardDenom (m := m) f h_sum ++ have hf_entire : Differentiable ℂ f := hf ++ have hden : ++ (MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ)) z = ++ (analyticOrderNatAt (hadamardDenom m f) z : ℤ) := by ++ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := hadamardDenom m f) hden_entire z) ++ have hfz : ++ (MeromorphicOn.divisor f (Set.univ : Set ℂ)) z = ++ (analyticOrderNatAt f z : ℤ) := by ++ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := f) hf_entire z) ++ simp [hden, hfz, analyticOrderNatAt_hadamardDenom_eq (m := m) (hf := hf) (h_sum := h_sum) z] ++ ++theorem divisor_hadamardQuotient_eq_zero ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ MeromorphicOn.divisor (fun z : ℂ => f z / hadamardDenom m f z) (Set.univ : Set ℂ) = 0 := by ++ have hf_mero : MeromorphicOn f (Set.univ : Set ℂ) := by ++ intro z hz ++ exact (hf.analyticAt z).meromorphicAt ++ have hden_entire : Differentiable ℂ (hadamardDenom m f) := ++ differentiable_hadamardDenom (m := m) f h_sum ++ have hden_mero : MeromorphicOn (hadamardDenom m f) (Set.univ : Set ℂ) := by ++ intro z hz ++ exact (hden_entire.analyticAt z).meromorphicAt ++ rcases hnot with ⟨z1, hz1⟩ ++ have hden1 : hadamardDenom m f z1 ≠ 0 := ++ hadamardDenom_ne_zero_at (m := m) (f := f) hf ⟨z1, hz1⟩ h_sum hz1 ++ have hf_order_ne_top : ∀ z ∈ (Set.univ : Set ℂ), meromorphicOrderAt f z ≠ ⊤ := by ++ intro z hzU ++ have hz1_ne_top : meromorphicOrderAt f z1 ≠ ⊤ := by ++ have hfAt : MeromorphicAt f z1 := hf_mero z1 (by simp) ++ have hcont : ContinuousAt f z1 := (hf.differentiableAt).continuousAt ++ have hne_nhds : ∀ᶠ w in 𝓝 z1, f w ≠ 0 := ++ (hcont.ne_iff_eventually_ne continuousAt_const).1 hz1 ++ have hne_nhdsNE : ∀ᶠ w in 𝓝[≠] z1, f w ≠ 0 := ++ eventually_nhdsWithin_of_eventually_nhds hne_nhds ++ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hfAt)).2 hne_nhdsNE ++ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hf_mero) ++ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top ++ have hden_order_ne_top : ++ ∀ z ∈ (Set.univ : Set ℂ), meromorphicOrderAt (hadamardDenom m f) z ≠ ⊤ := by ++ intro z hzU ++ have hz1_ne_top : meromorphicOrderAt (hadamardDenom m f) z1 ≠ ⊤ := by ++ have hdenAt : MeromorphicAt (hadamardDenom m f) z1 := hden_mero z1 (by simp) ++ have hcont : ContinuousAt (hadamardDenom m f) z1 := ++ (hden_entire.differentiableAt).continuousAt ++ have hne_nhds : ∀ᶠ w in 𝓝 z1, hadamardDenom m f w ≠ 0 := ++ (hcont.ne_iff_eventually_ne continuousAt_const).1 hden1 ++ have hne_nhdsNE : ∀ᶠ w in 𝓝[≠] z1, hadamardDenom m f w ≠ 0 := ++ eventually_nhdsWithin_of_eventually_nhds hne_nhds ++ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hdenAt)).2 hne_nhdsNE ++ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hden_mero) ++ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top ++ have hinv_order_ne_top : ++ ∀ z ∈ (Set.univ : Set ℂ), ++ meromorphicOrderAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z ≠ ⊤ := by ++ intro z hzU ++ have hinv_mero : ++ MeromorphicOn (fun z : ℂ => (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := ++ hden_mero.inv ++ have hz1_ne_top : ++ meromorphicOrderAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 ≠ ⊤ := by ++ have hinvAt : MeromorphicAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 := ++ hinv_mero z1 (by simp) ++ have hcont_denom : ContinuousAt (hadamardDenom m f) z1 := ++ (hden_entire.differentiableAt).continuousAt ++ have hcont : ContinuousAt (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 := ++ hcont_denom.inv₀ hden1 ++ have hinv1 : (fun z : ℂ => (hadamardDenom m f z)⁻¹) z1 ≠ 0 := by ++ simpa using inv_ne_zero hden1 ++ have hne_nhds : ++ ∀ᶠ w in 𝓝 z1, (fun z : ℂ => (hadamardDenom m f z)⁻¹) w ≠ 0 := ++ (hcont.ne_iff_eventually_ne continuousAt_const).1 hinv1 ++ have hne_nhdsNE : ++ ∀ᶠ w in 𝓝[≠] z1, (fun z : ℂ => (hadamardDenom m f z)⁻¹) w ≠ 0 := ++ eventually_nhdsWithin_of_eventually_nhds hne_nhds ++ exact (meromorphicOrderAt_ne_top_iff_eventually_ne_zero (hf := hinvAt)).2 hne_nhdsNE ++ exact MeromorphicOn.meromorphicOrderAt_ne_top_of_isPreconnected (hf := hinv_mero) ++ (x := z1) (hU := isPreconnected_univ) (h₁x := by simp) (hy := by simp) hz1_ne_top ++ have hdiv_denom : MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) = ++ MeromorphicOn.divisor f (Set.univ : Set ℂ) := ++ divisor_hadamardDenom_eq (m := m) (hf := hf) (h_sum := h_sum) ++ calc ++ MeromorphicOn.divisor (fun z : ℂ => f z / hadamardDenom m f z) (Set.univ : Set ℂ) ++ = MeromorphicOn.divisor ++ (fun z : ℂ => f z * (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := by ++ simp [div_eq_mul_inv] ++ _ = MeromorphicOn.divisor f (Set.univ : Set ℂ) + ++ MeromorphicOn.divisor (fun z : ℂ => (hadamardDenom m f z)⁻¹) (Set.univ : Set ℂ) := by ++ simpa using (MeromorphicOn.divisor_fun_mul (U := (Set.univ : Set ℂ)) ++ (f₁ := f) (f₂ := fun z => (hadamardDenom m f z)⁻¹) hf_mero (hden_mero.inv) ++ hf_order_ne_top hinv_order_ne_top) ++ _ = MeromorphicOn.divisor f (Set.univ : Set ℂ) - ++ MeromorphicOn.divisor (hadamardDenom m f) (Set.univ : Set ℂ) := by ++ simp [sub_eq_add_neg] ++ _ = 0 := by ++ simp [hdiv_denom] ++ ++theorem exists_entire_nonzero_hadamardQuotient ++ (m : ℕ) {f : ℂ → ℂ} (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) : ++ ∃ H : ℂ → ℂ, Differentiable ℂ H ∧ (∀ z, H z ≠ 0) ∧ ∀ z : ℂ, f z = ++ H z * z ^ (analyticOrderNatAt f 0) * divisorCanonicalProduct m f (Set.univ : Set ℂ) z := by ++ let denom : ℂ → ℂ := hadamardDenom m f ++ let q : ℂ → ℂ := fun z => f z / denom z ++ have hden_entire : Differentiable ℂ denom := ++ differentiable_hadamardDenom (m := m) f h_sum ++ have hq_mero : MeromorphicOn q (Set.univ : Set ℂ) := by ++ intro z hzU ++ have hf_m : MeromorphicAt f z := (hf.analyticAt z).meromorphicAt ++ have hden_m : MeromorphicAt denom z := (hden_entire.analyticAt z).meromorphicAt ++ simpa [q, denom, div_eq_mul_inv] using! (hf_m.mul hden_m.inv) ++ let H : ℂ → ℂ := toMeromorphicNFOn q (Set.univ : Set ℂ) ++ have hNF : MeromorphicNFOn H (Set.univ : Set ℂ) := ++ meromorphicNFOn_toMeromorphicNFOn q (Set.univ : Set ℂ) ++ have hdivH : MeromorphicOn.divisor H (Set.univ : Set ℂ) = 0 := by ++ have hdivq : MeromorphicOn.divisor q (Set.univ : Set ℂ) = 0 := ++ divisor_hadamardQuotient_eq_zero (m := m) (f := f) (hf := hf) ++ (hnot := hnot) (h_sum := h_sum) ++ simpa [H, hdivq] using ++ (MeromorphicOn.divisor_of_toMeromorphicNFOn ++ (f := q) (U := (Set.univ : Set ℂ)) hq_mero) ++ have hA : AnalyticOnNhd ℂ H (Set.univ : Set ℂ) := by ++ have : ++ (0 : Function.locallyFinsuppWithin (Set.univ : Set ℂ) ℤ) ≤ ++ MeromorphicOn.divisor H (Set.univ : Set ℂ) := by ++ simp [hdivH] ++ exact (MeromorphicNFOn.divisor_nonneg_iff_analyticOnNhd (h₁f := hNF)).1 (by simp [hdivH]) ++ have hH_entire : Differentiable ℂ H := by ++ intro z ++ exact (hA z (by simp)).differentiableAt ++ rcases hnot with ⟨z1, hz1⟩ ++ have hden1 : denom z1 ≠ 0 := ++ hadamardDenom_ne_zero_at (m := m) (f := f) hf ⟨z1, hz1⟩ h_sum hz1 ++ have hqA1 : AnalyticAt ℂ q z1 := by ++ have hdenA1 : AnalyticAt ℂ denom z1 := hden_entire.analyticAt z1 ++ exact (hf.analyticAt z1).div hdenA1 hden1 ++ have hqNF1 : MeromorphicNFAt q z1 := hqA1.meromorphicNFAt ++ have htoEq : toMeromorphicNFAt q z1 = q := (toMeromorphicNFAt_eq_self (f := q) (x := z1)).2 hqNF1 ++ have hH1 : H z1 = q z1 := by ++ have hx : z1 ∈ (Set.univ : Set ℂ) := by simp ++ have : toMeromorphicNFOn q (Set.univ : Set ℂ) z1 = toMeromorphicNFAt q z1 z1 := ++ (toMeromorphicNFOn_eq_toMeromorphicNFAt (f := q) (U := (Set.univ : Set ℂ)) hq_mero hx) ++ simpa [H, htoEq] using this ++ have hH1_ne : H z1 ≠ 0 := by ++ have : q z1 ≠ 0 := div_ne_zero hz1 hden1 ++ simpa [hH1] using this ++ have hH_not_top : ∀ z : ℂ, analyticOrderAt H z ≠ ⊤ := by ++ exact analyticOrderAt_ne_top_of_exists_ne_zero (hf := hH_entire) ⟨z1, hH1_ne⟩ ++ have hH_orderNat_zero : ∀ z : ℂ, analyticOrderNatAt H z = 0 := by ++ intro z ++ have hzdiv : ++ (MeromorphicOn.divisor H (Set.univ : Set ℂ)) z = (analyticOrderNatAt H z : ℤ) := by ++ simpa using (divisor_univ_eq_analyticOrderNatAt_int (f := H) hH_entire z) ++ have : (MeromorphicOn.divisor H (Set.univ : Set ℂ)) z = 0 := by ++ simp [hdivH] ++ have : (analyticOrderNatAt H z : ℤ) = 0 := by simpa [hzdiv] using this ++ exact_mod_cast this ++ have hH_ne : ∀ z : ℂ, H z ≠ 0 := by ++ intro z ++ have hcast : (analyticOrderNatAt H z : ℕ∞) = analyticOrderAt H z := ++ Nat.cast_analyticOrderNatAt (f := H) (z₀ := z) (hH_not_top z) ++ have : analyticOrderAt H z = 0 := by ++ have : (analyticOrderNatAt H z : ℕ∞) = 0 := by exact_mod_cast (hH_orderNat_zero z) ++ simpa [hcast] using this ++ exact ((hA z (by simp)).analyticOrderAt_eq_zero).1 this ++ have hfA : AnalyticOnNhd ℂ f (Set.univ : Set ℂ) := fun z hzU => hf.analyticAt z ++ have hdenA : AnalyticOnNhd ℂ denom (Set.univ : Set ℂ) := fun z hzU => hden_entire.analyticAt z ++ have hprodA : AnalyticOnNhd ℂ (fun z => H z * denom z) (Set.univ : Set ℂ) := ++ (hA.mul hdenA) ++ have hlocal : f =ᶠ[𝓝 z1] fun z => H z * denom z := by ++ have hden_ne : ∀ᶠ z in 𝓝 z1, denom z ≠ 0 := ++ (hden_entire.differentiableAt.continuousAt.ne_iff_eventually_ne continuousAt_const).1 hden1 ++ have hH_eq_q : H =ᶠ[𝓝 z1] q := by ++ have hx : z1 ∈ (Set.univ : Set ℂ) := by simp ++ have hloc : ++ toMeromorphicNFOn q (Set.univ : Set ℂ) =ᶠ[𝓝 z1] toMeromorphicNFAt q z1 := by ++ simpa [H] using (toMeromorphicNFOn_eq_toMeromorphicNFAt_on_nhds (f := q) ++ (U := (Set.univ : Set ℂ)) hq_mero hx) ++ simpa [H, htoEq] using hloc ++ filter_upwards [hden_ne, hH_eq_q] with z hzden hHz ++ have hcancel : q z * denom z = f z := by ++ dsimp [q] ++ field_simp [hzden] ++ calc ++ f z = q z * denom z := hcancel.symm ++ _ = H z * denom z := by simp [hHz] ++ have hglob : f = fun z => H z * denom z := ++ AnalyticOnNhd.eq_of_eventuallyEq (hf := hfA) (hg := hprodA) hlocal ++ refine ⟨H, hH_entire, hH_ne, ?_⟩ ++ intro z ++ have hglobz : f z = H z * denom z := congrArg (fun g => g z) hglob ++ simpa [denom, hadamardDenom, mul_assoc, mul_left_comm, mul_comm] using hglobz ++ ++end Complex.Hadamard ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Growth.lean b/PrimeNumberTheoremAnd/SiegelZeros/Growth.lean +new file mode 100644 +index 0000000..99df501 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/Growth.lean +@@ -0,0 +1,439 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.Summability ++import PrimeNumberTheoremAnd.SiegelZeros.Exponential ++ ++namespace SiegelZeros ++ ++section ++noncomputable section ++ ++open Set Filter Asymptotics ++open scoped Topology BigOperators ++ ++namespace Complex.Hadamard ++ ++lemma no_zero_on_sphere_of_norm_image_avoid ++ {f : ℂ → ℂ} (hentire : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ {B r : ℝ} (hrpos : 0 < r) (hr_le_B : r ≤ B) ++ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) (hsmall_fin : smallSet.Finite) ++ (hsmallSet : ++ smallSet = {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ B}) ++ (hr_not_bad : ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ r ∉ small.image a) : ++ ∀ u : ℂ, ‖u‖ = r → f u ≠ 0 := by ++ classical ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let bad : Finset ℝ := small.image a ++ have hr_not_bad' : r ∉ bad := by ++ simpa [bad, small, a] using hr_not_bad ++ have hr_not : ++ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖ ≤ B → r ≠ ‖divisorZeroIndex₀Val p‖ := by ++ intro p hpB hEq ++ have hp_small : p ∈ small := by ++ have hp_mem : p ∈ smallSet := by ++ simpa [hsmallSet] using hpB ++ simpa [small] using (hsmall_fin.mem_toFinset.2 hp_mem) ++ have : r ∈ bad := Finset.mem_image.2 ⟨p, hp_small, by simpa [a] using hEq.symm⟩ ++ exact (hr_not_bad' this).elim ++ exact no_zero_on_sphere_of_forall_val_norm_ne (f := f) hentire hnot ++ (B := B) (r := r) hrpos hr_le_B hr_not ++ ++theorem norm_inv_hadamardDenominator_le_exp_on_cartan_circle ++ {f : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} ++ (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) ++ (hτ_nonneg : 0 ≤ τ) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (hsumτ : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : ++ let Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ let Cprod : ℝ := cartanProductConstant m τ Sτ ++ ∀ {R r : ℝ}, 0 < R → 1 ≤ R → R ≤ r → r ≤ 2 * R → ++ ∀ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsmall_fin : smallSet.Finite), ++ smallSet = ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} → ++ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ‖divisorZeroIndex₀Val p‖ ++ r ∉ small.image a) → ++ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ‖divisorZeroIndex₀Val p‖ ++ (∑ p ∈ small, (1 : ℝ) * CartanBound.φ (r / a p)) ≤ ++ CartanBound.Cφ * (small.card : ℝ)) → ++ ∀ u : ℂ, ‖u‖ = r → ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ ≤ Real.exp (Cprod * (1 + r) ^ τ) := by ++ classical ++ intro Sτ Cprod R r hRpos hRle hR_le_r hr_le_2R smallSet hsmall_fin ++ hsmallSet hr_not_bad hr_phi u hur ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let bad : Finset ℝ := small.image a ++ have hr_not_bad' : r ∉ bad := by ++ simpa [bad, small, a] using hr_not_bad ++ have hr1 : (1 : ℝ) ≤ r := le_trans hRle hR_le_r ++ have hpow_inv_le1 : ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ ≤ 1 := ++ Complex.norm_inv_pow_le_one_of_one_le_norm u (analyticOrderNatAt f 0) (by simpa [hur] using hr1) ++ let fac : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℂ := ++ fun p => weierstrassFactor m (u / divisorZeroIndex₀Val p) ++ have hloc : ++ HasProdLocallyUniformlyOn ++ (fun (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) (w : ℂ) => ++ weierstrassFactor m (w / divisorZeroIndex₀Val p)) ++ (divisorCanonicalProduct m f (Set.univ : Set ℂ)) ++ (Set.univ : Set ℂ) := ++ hasProdLocallyUniformlyOn_divisorCanonicalProduct_univ (m := m) (f := f) h_sum ++ have hprod : ++ HasProd fac (divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := ++ hloc.hasProd (by simp : u ∈ (Set.univ : Set ℂ)) ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ have : DecidablePred (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => p ∈ small) := ++ Classical.decPred _ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if hp : p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ have hterm : ∀ p, ‖(fac p)⁻¹‖ ≤ Real.exp (b p) := by ++ intro p ++ by_cases hp : p ∈ small ++ · have hval_ne : r ≠ ap p := by ++ intro hEq ++ have : r ∈ bad := by ++ refine Finset.mem_image.2 ⟨p, hp, ?_⟩ ++ simp [ap, a, hEq] ++ exact (hr_not_bad' this).elim ++ have hval0 : divisorZeroIndex₀Val p ≠ 0 := divisorZeroIndex₀Val_ne_zero p ++ have hmτ : (m : ℝ) ≤ τ := le_trans hmρ (le_of_lt hτ) ++ have hnear : ++ ‖(weierstrassFactor m (u / divisorZeroIndex₀Val p))⁻¹‖ ++ ≤ Real.exp (CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ)) := by ++ simpa [ap] using ++ (norm_inv_weierstrassFactor_le_exp_near (m := m) (τ := τ) (r := r) ++ (u := u) (a := divisorZeroIndex₀Val p) ++ (hur := hur) (ha := hval0) (hr := by simpa [ap] using hval_ne) hmτ) ++ simpa [fac, b, hp] using hnear ++ · have hlarge : (4 * R : ℝ) < ap p := by ++ have : ¬ap p ≤ 4 * R := by ++ intro hle ++ have : p ∈ small := by ++ have hp_mem : p ∈ smallSet := by ++ simpa [hsmallSet, ap] using hle ++ simpa [small] using (hsmall_fin.mem_toFinset.2 hp_mem) ++ exact hp this ++ exact lt_of_not_ge this ++ have hz' : ‖u / divisorZeroIndex₀Val p‖ ≤ (1 / 2 : ℝ) := ++ norm_div_le_half_of_norm_le_of_two_mul_lt (z := u) (a := divisorZeroIndex₀Val p) ++ (R := 2 * R) (by nlinarith [hRpos]) (by rw [hur]; exact hr_le_2R) ++ (by nlinarith [hlarge]) ++ have hτ_le : τ ≤ (m + 1 : ℝ) := le_of_lt hτ_lt ++ have hfar : ++ ‖(weierstrassFactor m (u / divisorZeroIndex₀Val p))⁻¹‖ ≤ ++ Real.exp ((2 : ℝ) * (r / ap p) ^ τ) := by ++ simpa [ap] using ++ (norm_inv_weierstrassFactor_le_exp_far (m := m) (τ := τ) (r := r) ++ (u := u) (a := divisorZeroIndex₀Val p) ++ (hur := hur) (ha := divisorZeroIndex₀Val_ne_zero p) (hz := hz') hτ_le) ++ simpa [fac, b, hp] using hfar ++ have hb_le : ++ ∀ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)), ++ (∑ p ∈ s, b p) ≤ Cprod * (1 + r) ^ τ := by ++ intro s ++ simpa [small, ap, b, Sτ, Cprod, a, hsmallSet] using ++ (Complex.Hadamard.cartan_sum_majorant_le (f := f) (m := m) (τ := τ) (R := R) (r := r) ++ (hRpos := hRpos) (hrpos := lt_of_lt_of_le hRpos hR_le_r) ++ (hR_le_r := hR_le_r) (hτ_nonneg := hτ_nonneg) ++ (smallSet := smallSet) (hsmall_fin := hsmall_fin) (hsmallSet := hsmallSet) ++ (hsumτ := hsumτ) ++ (hr_phi := by ++ simpa [small, a, one_mul] using hr_phi) ++ s) ++ have hcprod_inv : ++ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ≤ ++ Real.exp (Cprod * (1 + r) ^ τ) := by ++ refine hasProd_norm_inv_le_exp_of_pointwise_le_exp ++ (α := divisorZeroIndex₀ f (Set.univ : Set ℂ)) (fac := fac) ++ (F := divisorCanonicalProduct m f (Set.univ : Set ℂ) u) ++ hprod (b := b) (B := Cprod * (1 + r) ^ τ) ?_ ?_ ++ · exact hterm ++ · intro s ++ exact hb_le s ++ have hmul : ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ = ++ ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ * ++ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ := by ++ simp [mul_inv_rev, mul_comm] ++ rw [hmul] ++ have : ++ ‖(u ^ analyticOrderNatAt f 0)⁻¹‖ * ++ ‖(divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ ≤ 1 * Real.exp (Cprod * (1 + r) ^ τ) := ++ mul_le_mul hpow_inv_le1 hcprod_inv (by positivity) (by positivity) ++ simpa using this ++ ++theorem hadamardQuotient_norm_le_exp_on_cartan_circle ++ {f H : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} {Cf : ℝ} ++ (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) ++ (hτ_nonneg : 0 ≤ τ) (hentire : Differentiable ℂ f) ++ (hnot : ∃ z : ℂ, f z ≠ 0) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (hsumτ : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) ++ (hf_boundτ : ∀ z : ℂ, ‖f z‖ ≤ Real.exp (Cf * (1 + ‖z‖) ^ τ)) ++ (hfactor : ∀ z : ℂ, ++ f z = ++ H z * z ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) z) : ++ let Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ let Cprod : ℝ := cartanProductConstant m τ Sτ ++ ∀ {R r : ℝ}, 0 < R → 1 ≤ R → R ≤ r → r ≤ 2 * R → 0 < r → ++ ∀ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsmall_fin : smallSet.Finite), ++ smallSet = ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} → ++ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ‖divisorZeroIndex₀Val p‖ ++ r ∉ small.image a) → ++ (let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ‖divisorZeroIndex₀Val p‖ ++ (∑ p ∈ small, (1 : ℝ) * CartanBound.φ (r / a p)) ≤ ++ CartanBound.Cφ * (small.card : ℝ)) → ++ ∀ u : ℂ, ‖u‖ = r → ‖H u‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by ++ classical ++ intro Sτ Cprod R r hRpos hRle hR_le_r hr_le_2R hrpos smallSet hsmall_fin ++ hsmallSet hr_not_bad hr_phi u hur ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let bad : Finset ℝ := small.image a ++ have hr_not_bad' : r ∉ bad := by ++ simpa [bad, small, a] using hr_not_bad ++ have hden_eq : ++ f u = ++ H u * (u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using (hfactor u) ++ have hfu_ne : f u ≠ 0 := by ++ have hr_le_4R : r ≤ 4 * R := by nlinarith [hr_le_2R, hRpos] ++ exact no_zero_on_sphere_of_norm_image_avoid (f := f) hentire hnot ++ (B := 4 * R) (r := r) hrpos hr_le_4R smallSet hsmall_fin hsmallSet ++ (by simpa [small, a] using hr_not_bad) u hur ++ have hden_ne : ++ (u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) ≠ 0 := by ++ intro hden0 ++ have : f u = 0 := by simpa [hden0] using hden_eq ++ exact hfu_ne this ++ have hHu : ++ H u = ++ f u / (u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u) := by ++ exact eq_div_of_mul_eq hden_ne (Eq.symm hden_eq) ++ have hf_u : ‖f u‖ ≤ Real.exp (Cf * (1 + r) ^ τ) := by ++ simpa [hur] using hf_boundτ u ++ have hden_inv : ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ ≤ Real.exp (Cprod * (1 + r) ^ τ) := by ++ simpa [Sτ, Cprod] using ++ (norm_inv_hadamardDenominator_le_exp_on_cartan_circle ++ (f := f) (ρ := ρ) (τ := τ) (m := m) ++ hmρ hτ hτ_lt hτ_nonneg h_sum hsumτ ++ (R := R) (r := r) hRpos hRle hR_le_r hr_le_2R ++ smallSet hsmall_fin hsmallSet ++ (by simpa [small, a] using hr_not_bad) ++ (by simpa [small, a, one_mul] using hr_phi) ++ u hur) ++ have : ++ ‖H u‖ ≤ ++ ‖f u‖ * ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ := by ++ have : ++ ‖H u‖ = ++ ‖f u / ++ (u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)‖ := by ++ simp [hHu] ++ simp [div_eq_mul_inv, norm_inv, this] ++ have hmul : ++ ‖f u‖ * ++ ‖(u ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) u)⁻¹‖ ++ ≤ Real.exp (Cf * (1 + r) ^ τ) * Real.exp (Cprod * (1 + r) ^ τ) := ++ mul_le_mul hf_u hden_inv (by positivity) (by positivity) ++ have hexp : ++ Real.exp (Cf * (1 + r) ^ τ) * Real.exp (Cprod * (1 + r) ^ τ) ++ = Real.exp ((Cf + Cprod) * (1 + r) ^ τ) := by ++ simp [Real.exp_add, add_mul, add_comm] ++ have : ‖H u‖ ≤ Real.exp ((Cf + Cprod) * (1 + r) ^ τ) := ++ (this.trans hmul).trans_eq hexp ++ have hslack : ++ Real.exp ((Cf + Cprod) * (1 + r) ^ τ) ≤ ++ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by ++ refine Real.exp_le_exp.2 ?_ ++ have hnn : 0 ≤ (1 + r) ^ τ := by positivity ++ nlinarith ++ exact this.trans hslack ++ ++theorem hadamardQuotient_norm_le_exp_rpow_of_growth {f H : ℂ → ℂ} {ρ τ : ℝ} {m : ℕ} ++ (hρ : 0 ≤ ρ) (hmρ : (m : ℝ) ≤ ρ) (hτ : ρ < τ) (hτ_lt : τ < (m + 1 : ℝ)) ++ (hτ_nonneg : 0 ≤ τ) (hentire : Differentiable ℂ f) (hH_entire : Differentiable ℂ H) ++ (hnot : ∃ z : ℂ, f z ≠ 0) ++ (h_sum : Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1))) ++ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) ++ (hfactor : ∀ z : ℂ, ++ f z = ++ H z * z ^ analyticOrderNatAt f 0 * ++ divisorCanonicalProduct m f (Set.univ : Set ℂ) z) : ++ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := by ++ rcases hgrowth with ⟨Cf, hCfpos, hCf⟩ ++ have hsumτ : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := ++ summable_norm_inv_rpow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) (τ := τ) ++ hρ hτ hentire hnot ⟨Cf, hCfpos, hCf⟩ ++ let Sτ : ℝ := ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ have hSτ_nonneg : 0 ≤ Sτ := tsum_nonneg fun _ => ++ Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ ++ let Cprod : ℝ := cartanProductConstant m τ Sτ ++ have hCprod_nonneg : 0 ≤ Cprod := by ++ simpa [Cprod] using cartanProductConstant_nonneg (m := m) (τ := τ) hSτ_nonneg ++ have hf_boundτ : ∀ z : ℂ, ‖f z‖ ≤ Real.exp (Cf * (1 + ‖z‖) ^ τ) := ++ Real.norm_le_exp_mul_rpow_of_log_growth ++ (f := f) (r := fun z : ℂ => 1 + ‖z‖) (C := Cf) (ρ := ρ) (τ := τ) ++ hCfpos.le (fun z => by linarith [norm_nonneg z]) (le_of_lt hτ) hCf ++ refine ⟨(Cf + Cprod + 10) * (3 : ℝ) ^ τ, by ++ have h3τ : 0 < (3 : ℝ) ^ τ := by positivity ++ nlinarith [hCfpos, hCprod_nonneg, h3τ], ?_⟩ ++ intro z ++ let R : ℝ := max ‖z‖ 1 ++ have hRpos : 0 < R := lt_of_lt_of_le (by norm_num) (le_max_right _ _) ++ have hRle : (1 : ℝ) ≤ R := le_max_right _ _ ++ let smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ {p | ‖divisorZeroIndex₀Val p‖ ≤ 4 * R} ++ have hsmall_fin : smallSet.Finite := by ++ have : Metric.closedBall (0 : ℂ) (4 * R) ⊆ (Set.univ : Set ℂ) := by simp ++ simpa [smallSet] using ++ (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) ++ (B := 4 * R) this) ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ have ha_pos : ∀ p ∈ small, 0 < a p := by ++ intro p hp ++ exact norm_pos_iff.2 (divisorZeroIndex₀Val_ne_zero p) ++ let bad : Finset ℝ := small.image a ++ rcases CartanBound.exists_radius_Ioc_sum_mul_phi_div_le_Cφ_mul_sum_avoid ++ (s := small) (w := fun _ => (1 : ℝ)) (a := a) ++ (hw := by intro _ _; norm_num) (ha := ha_pos) (bad := bad) (R := R) hRpos with ++ ⟨r, hr_mem, hr_not_bad, hr_phi⟩ ++ have hR_le_r : R ≤ r := le_of_lt hr_mem.1 ++ have hr_le_2R : r ≤ 2 * R := hr_mem.2 ++ have hrpos : 0 < r := lt_of_lt_of_le hRpos hR_le_r ++ have hcircle : ++ ∀ u : ℂ, ‖u‖ = r → ‖H u‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by ++ simpa [Sτ, Cprod] using ++ (hadamardQuotient_norm_le_exp_on_cartan_circle ++ (f := f) (H := H) (ρ := ρ) (τ := τ) (m := m) (Cf := Cf) ++ hmρ hτ hτ_lt hτ_nonneg hentire hnot h_sum hsumτ hf_boundτ hfactor ++ (R := R) (r := r) hRpos hRle hR_le_r hr_le_2R hrpos ++ smallSet hsmall_fin (by rfl) ++ (by simpa [small, a, bad] using hr_not_bad) ++ (by simpa [small, a, one_mul, Finset.sum_const, nsmul_eq_mul] using hr_phi)) ++ have hz_ball : z ∈ Metric.ball (0 : ℂ) r := by ++ rw [Metric.mem_ball, dist_zero_right] ++ exact lt_of_le_of_lt (le_max_left _ _) hr_mem.1 ++ have hball : ++ ‖H z‖ ≤ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) := by ++ exact Complex.norm_le_of_mem_ball_of_forall_sphere_norm_le hH_entire hrpos hz_ball hcircle ++ have hr_le_3 : 1 + r ≤ 3 * (1 + ‖z‖) := by ++ exact Real.one_add_le_three_mul_one_add_of_le_two_mul_max (norm_nonneg z) ++ (by simpa [R] using hr_le_2R) ++ have hmain : ++ Real.exp ((Cf + Cprod + 10) * (1 + r) ^ τ) ++ ≤ Real.exp (((Cf + Cprod + 10) * (3 : ℝ) ^ τ) * (1 + ‖z‖) ^ τ) := by ++ have hnn : 0 ≤ (Cf + Cprod + 10) := by nlinarith [le_of_lt hCfpos, hCprod_nonneg] ++ exact Real.exp_mul_rpow_le_exp_mul_rpow_of_le_mul hnn (by norm_num) ++ (by linarith [le_of_lt hrpos]) (by positivity) hτ_nonneg hr_le_3 ++ simpa [mul_assoc] using hball.trans hmain ++ ++theorem hadamard_factorization_of_growth {f : ℂ → ℂ} {ρ : ℝ} (hρ : 0 ≤ ρ) ++ (hentire : Differentiable ℂ f) ++ (hnot : ∃ z : ℂ, f z ≠ 0) ++ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : ++ ∃ (P : Polynomial ℂ), ++ P.degree ≤ Nat.floor ρ ∧ ++ ∀ z : ℂ, ++ f z = ++ Complex.exp (Polynomial.eval z P) * ++ z ^ (analyticOrderNatAt f 0) * ++ divisorCanonicalProduct (Nat.floor ρ) f (Set.univ : Set ℂ) z := by ++ set m : ℕ := Nat.floor ρ ++ have h_sum : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (m + 1)) := by ++ simpa [m] using ++ (summable_norm_inv_pow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) ++ hρ hentire hnot hgrowth) ++ rcases exists_entire_nonzero_hadamardQuotient (m := m) (f := f) hentire hnot h_sum with ++ ⟨H, hH_entire, hH_ne, hfactor⟩ ++ rcases Real.exists_between_self_and_floor_add_one_same_floor hρ with ++ ⟨τ, hτ, hτ_lt, hτ_nonneg, hfloorτ'⟩ ++ have hfloorτ : Nat.floor τ = m := by ++ simpa [m] using hfloorτ' ++ have hτ_lt_m : τ < (m + 1 : ℝ) := by ++ simpa [m] using hτ_lt ++ have hτ_lt_nat : τ < ((m + 1 : ℕ) : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one] using hτ_lt_m ++ have hmρ : (m : ℝ) ≤ ρ := by ++ have := Nat.floor_le hρ ++ simpa [m] using this ++ have hH_bound_rpow : ++ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := ++ hadamardQuotient_norm_le_exp_rpow_of_growth (f := f) (H := H) (ρ := ρ) (τ := τ) ++ (m := m) hρ hmρ hτ hτ_lt hτ_nonneg hentire hH_entire hnot h_sum hgrowth hfactor ++ have hH_growth_nat : ++ ∃ C > 0, ∀ z : ℂ, ‖H z‖ ≤ Real.exp (C * (1 + ‖z‖) ^ (m + 1)) := by ++ exact Real.exists_norm_le_exp_mul_pow_of_rpow_bound ++ (f := H) (r := fun z : ℂ => 1 + ‖z‖) ++ (fun z => by linarith [norm_nonneg z]) hτ_lt_nat hH_bound_rpow ++ rcases zero_free_polynomial_growth_is_exp_poly (H := H) (n := m + 1) ++ hH_entire hH_ne hH_growth_nat with ++ ⟨P, hPn, hHP⟩ ++ have hPnat : P.natDegree ≤ m := by ++ have hbound : ++ ∃ C > 0, ∀ z : ℂ, ++ ‖Complex.exp (Polynomial.eval z P)‖ ≤ Real.exp (C * (1 + ‖z‖) ^ τ) := by ++ rcases hH_bound_rpow with ⟨C, hCpos, hC⟩ ++ exact ⟨C, hCpos, fun z => by simpa [hHP z] using (hC z)⟩ ++ have := natDegree_le_floor_of_exp_eval_norm_bound hτ_nonneg P hbound ++ simpa [hfloorτ] using this ++ refine ⟨P, ?_, ?_⟩ ++ · have : P.degree ≤ m := Polynomial.degree_le_of_natDegree_le hPnat ++ simpa [m] using this ++ · intro z ++ have hH' : H z = Complex.exp (Polynomial.eval z P) := by simpa using (hHP z) ++ simpa [hH', mul_assoc, mul_left_comm, mul_comm, m] using (hfactor z) ++ ++end Complex.Hadamard ++end ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/HadamardSupport.lean b/PrimeNumberTheoremAnd/SiegelZeros/HadamardSupport.lean +new file mode 100644 +index 0000000..7ec52e3 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/HadamardSupport.lean +@@ -0,0 +1 @@ ++import PrimeNumberTheoremAnd.SiegelZeros.Growth +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/NOTICE.md b/PrimeNumberTheoremAnd/SiegelZeros/NOTICE.md +new file mode 100644 +index 0000000..a3e10f6 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/NOTICE.md +@@ -0,0 +1,15 @@ ++# Captured support notices ++ ++The mathematical support is derived from PrimeNumberTheoremAnd. Its existing repository license remains applicable. Original retained notices follow. ++ ++/- ++Copyright (c) 2026 Matteo Cipollina. All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Matteo Cipollina ++-/ ++ ++/- ++Copyright (c) 2025 Stefan Kebekus. All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Stefan Kebekus, Matteo Cipollina ++-/ +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/ProductBounds.lean b/PrimeNumberTheoremAnd/SiegelZeros/ProductBounds.lean +new file mode 100644 +index 0000000..6a2985a +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/ProductBounds.lean +@@ -0,0 +1,724 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.DivisorLimits ++import PrimeNumberTheoremAnd.SiegelZeros.CartanBounds ++ ++namespace SiegelZeros ++ ++section ++noncomputable section ++ ++namespace Complex.Hadamard ++ ++open scoped BigOperators ++open Filter Finset _root_.Real _root_.SiegelZeros.Real Topology ++ ++section CartanFiniteSum ++ ++variable {α : Type*} ++ ++private lemma summable_ite_mem_finset [DecidableEq α] (s : Finset α) (u : α → ℝ) : ++ Summable (fun a => if a ∈ s then u a else 0) := ++ summable_of_ne_finset_zero (s := s) fun a ha => by simp [ite_eq_right ha] ++ ++private lemma tsum_ite_mem_finset [DecidableEq α] (s : Finset α) (u : α → ℝ) : ++ (∑' a, if a ∈ s then u a else 0) = ∑ a ∈ s, u a := by ++ classical ++ simpa [Finset.sum_ite] using ++ (hasSum_sum_of_ne_finset_zero (s := s) (f := fun a => if a ∈ s then u a else 0) ++ fun a ha => by simp [ite_eq_right ha]).tsum_eq ++ ++private lemma tsum_add_four (u₁ u₂ u₃ u₄ : α → ℝ) ++ (h₁ : Summable u₁) (h₂ : Summable u₂) (h₃ : Summable u₃) (h₄ : Summable u₄) : ++ tsum (fun a => ((u₁ a + u₂ a) + u₃ a) + u₄ a) ++ = tsum u₁ + tsum u₂ + tsum u₃ + tsum u₄ := by ++ calc ++ tsum (fun a => ((u₁ a + u₂ a) + u₃ a) + u₄ a) ++ = tsum (fun a => (u₁ a + u₂ a) + (u₃ a + u₄ a)) := by ++ simp [add_comm, add_left_comm] ++ _ = tsum (fun a => u₁ a + u₂ a) + tsum (fun a => u₃ a + u₄ a) := ++ Summable.tsum_add (h₁.add h₂) (h₃.add h₄) ++ _ = tsum u₁ + tsum u₂ + tsum u₃ + tsum u₄ := by ++ rw [Summable.tsum_add h₁ h₂, Summable.tsum_add h₃ h₄] ++ ring ++ ++end CartanFiniteSum ++ ++noncomputable def cartanProductConstant (m : ℕ) (τ Sτ : ℝ) : ℝ := ++ ((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 3) * (Sτ + 1) ++ ++lemma cartanProductConstant_nonneg {m : ℕ} {τ Sτ : ℝ} (hSτ : 0 ≤ Sτ) : ++ 0 ≤ cartanProductConstant m τ Sτ := by ++ have hS : 0 ≤ Sτ + 1 := by linarith ++ have hA : 0 ≤ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 3 := by ++ have hCφ : 0 ≤ CartanBound.Cφ := le_of_lt CartanBound.Cφ_pos ++ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ have h4τ : 0 ≤ (4 : ℝ) ^ τ := by positivity ++ nlinarith [hCφ, hm0, h4τ] ++ simpa [cartanProductConstant] using mul_nonneg hA hS ++ ++lemma rpow_div_norm_divisorZeroIndex₀_eq ++ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) ++ (p : divisorZeroIndex₀ f (Set.univ : Set ℂ)) : ++ (r / ‖divisorZeroIndex₀Val p‖) ^ τ = ++ (r ^ τ) * ((‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) := by ++ have hp : 0 ≤ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) := by positivity ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using ++ (Real.mul_rpow (x := r) (y := (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ)) (z := τ) hr hp) ++ ++lemma tsum_rpow_div_norm_divisorZeroIndex₀_eq ++ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ = (r ^ τ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ calc ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ = ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by ++ refine tsum_congr ?_ ++ intro p ++ exact rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p ++ _ = (r ^ τ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ simp [tsum_mul_left] ++ ++lemma tsum_two_mul_rpow_div_norm_divisorZeroIndex₀_le ++ {f : ℂ → ℂ} {r τ : ℝ} (hr : 0 ≤ r) (hτ_nonneg : 0 ≤ τ) : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ ≤ (2 : ℝ) * ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) * (1 + r) ^ τ := by ++ set Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ have htsum : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ = (2 : ℝ) * (r ^ τ) * Sτ := by ++ calc ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (2 : ℝ) * (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ = (2 : ℝ) * ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ (r / ‖divisorZeroIndex₀Val p‖) ^ τ := by ++ simp [tsum_mul_left] ++ _ = (2 : ℝ) * ((r ^ τ) * Sτ) := by ++ rw [tsum_rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr] ++ _ = (2 : ℝ) * (r ^ τ) * Sτ := by ring ++ have hSτ_nonneg : 0 ≤ Sτ := ++ tsum_nonneg (fun _ => Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _) ++ have h1r : r ^ τ ≤ (1 + r) ^ τ := ++ Real.rpow_le_rpow (by positivity) (by linarith) hτ_nonneg ++ have hS : Sτ ≤ Sτ + 1 := by linarith ++ have hle : (r ^ τ) * Sτ ≤ (1 + r) ^ τ * (Sτ + 1) := ++ mul_le_mul h1r hS (by linarith) (by positivity) ++ rw [htsum] ++ have : (2 : ℝ) * (r ^ τ) * Sτ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by ++ nlinarith [hle] ++ simpa [Sτ, mul_assoc, mul_left_comm, mul_comm] using this ++ ++lemma sum_rpow_div_norm_divisorZeroIndex₀_le ++ {f : ℂ → ℂ} {r τ : ℝ} (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hr : 0 ≤ r) (hτ_nonneg : 0 ≤ τ) ++ (hsumτ : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : ++ (∑ p ∈ small, (r / ‖divisorZeroIndex₀Val p‖) ^ τ) ++ ≤ ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) * (1 + r) ^ τ := by ++ set Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ have hsum_inv : ++ (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ≤ Sτ := by ++ have hnn : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ 0 ≤ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by ++ intro p ++ positivity ++ simpa [Sτ] using ++ (Summable.sum_le_tsum (s := small) ++ (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ++ (fun p _ => hnn p) hsumτ) ++ have hsum_eq : ++ ∑ p ∈ small, (r / ‖divisorZeroIndex₀Val p‖) ^ τ = ++ (r ^ τ) * ∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ := by ++ simp [rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr, Finset.mul_sum] ++ have h1r : r ^ τ ≤ (1 + r) ^ τ := ++ Real.rpow_le_rpow (by positivity) (by linarith) hτ_nonneg ++ have hS : (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ≤ Sτ + 1 := by ++ linarith [hsum_inv] ++ have hle : ++ (r ^ τ) * (∑ p ∈ small, (‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ) ++ ≤ (1 + r) ^ τ * (Sτ + 1) := ++ mul_le_mul h1r hS (by positivity) (by positivity) ++ simpa [Sτ, hsum_eq, mul_assoc, mul_left_comm, mul_comm] using hle ++ ++lemma add_four_le_add_two_mul_of_le {x₁ x₂ x₃ x₄ A B C : ℝ} ++ (h₁ : x₁ ≤ A) (h₂ : x₂ ≤ B) (h₃ : x₃ ≤ B) (h₄ : x₄ ≤ C) : ++ x₁ + x₂ + x₃ + x₄ ≤ A + 2 * B + C := by ++ nlinarith ++ ++lemma cartan_majorant_four_term_bound ++ {xφ x0 xm xt Cφ m q Y T : ℝ} ++ (hφ : xφ ≤ Cφ * q * Y * T) ++ (h0 : x0 ≤ m * q * Y * T) ++ (hm : xm ≤ m * q * Y * T) ++ (ht : xt ≤ (2 : ℝ) * Y * T) : ++ xφ + x0 + xm + xt ≤ (Cφ + (2 : ℝ) * m) * q * Y * T + (2 : ℝ) * Y * T := by ++ have h := ++ add_four_le_add_two_mul_of_le hφ h0 hm ht ++ have hring : ++ Cφ * (q * (Y * T)) + 2 * (m * (q * (Y * T))) + 2 * (Y * T) ++ = (Cφ + (2 : ℝ) * m) * (q * (Y * T)) + (2 : ℝ) * (Y * T) := by ++ ring ++ simpa [mul_assoc, hring] using h ++ ++lemma cartan_majorant_add_two_factor (A Y T : ℝ) : ++ A * Y * T + (2 : ℝ) * Y * T = ((A + 2) * Y) * T := by ++ ring ++ ++lemma cartan_majorant_pad_two_to_three {A S T : ℝ} (hS : 0 ≤ S + 1) (hT : 0 ≤ T) : ++ ((A + 2) * (S + 1)) * T ≤ ((A + 3) * (S + 1)) * T := by ++ have h : (A + 2) * (S + 1) ≤ (A + 3) * (S + 1) := by ++ nlinarith ++ exact mul_le_mul_of_nonneg_right h hT ++ ++lemma cartan_majorant_nonneg ++ {f : ℂ → ℂ} {m : ℕ} {τ r : ℝ} (hr : 0 ≤ r) ++ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) : ++ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ ∀ p, 0 ≤ b p := by ++ classical ++ dsimp ++ intro p ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun q => ‖divisorZeroIndex₀Val q‖ ++ have hap : ap p = ‖divisorZeroIndex₀Val p‖ := rfl ++ by_cases hp : p ∈ small ++ · have hφ : 0 ≤ CartanBound.φ (r / ap p) := CartanBound.φ_nonneg (t := r / ap p) ++ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ have h1 : 0 ≤ (1 + (r / ap p) ^ τ) := by positivity ++ have : 0 ≤ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) := by ++ nlinarith [hφ, hm0, h1] ++ simpa [hap, hp, ap] using this ++ · have hbase : 0 ≤ r / ap p := div_nonneg hr (by positivity) ++ have hpow : 0 ≤ (r / ap p) ^ τ := Real.rpow_nonneg hbase τ ++ have : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := mul_nonneg (by norm_num) hpow ++ simpa [hap, hp, ap] using this ++ ++lemma cartan_majorant_summable ++ {f : ℂ → ℂ} {m : ℕ} {τ r : ℝ} (hr : 0 ≤ r) ++ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsumτ : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : ++ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ Summable b := by ++ classical ++ dsimp ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun q => ‖divisorZeroIndex₀Val q‖ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ have hb : Summable b := by ++ let b₁ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else 0 ++ let b₂ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => if p ∈ small then 0 else (2 : ℝ) * (r / ap p) ^ τ ++ have hb_decomp : b = fun p => b₁ p + b₂ p := by ++ funext p ++ by_cases hp : p ∈ small <;> simp [b, b₁, b₂, hp] ++ have hb₁ : Summable b₁ := by ++ simpa [b₁] using ++ summable_ite_mem_finset small ++ (fun p => CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ)) ++ have hb₂ : Summable b₂ := by ++ have hconst : ++ Summable (fun p => ++ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) := ++ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) ++ refine Summable.of_nonneg_of_le ++ (fun p => by ++ by_cases hp : p ∈ small ++ · simp [b₂, hp] ++ · have : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := by positivity ++ simpa [b₂, hp] using this) ++ (fun p => ?_) hconst ++ by_cases hp : p ∈ small ++ · have : 0 ≤ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by positivity ++ simpa [b₂, hp] using this ++ · have hrpow : (r / ap p) ^ τ = (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by ++ simpa [ap] using rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p ++ simp [b₂, hp, hrpow, mul_assoc, mul_left_comm, mul_comm] ++ simpa [hb_decomp] using hb₁.add hb₂ ++ refine hb.congr ?_ ++ intro p ++ by_cases hp : p ∈ small <;> simp [b, ap, hp] ++ ++lemma cartan_card_small_le ++ {f : ℂ → ℂ} {τ R : ℝ} (hRpos : 0 < R) (hτ_nonneg : 0 ≤ τ) ++ (small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsmall : ∀ p ∈ small, ‖divisorZeroIndex₀Val p‖ ≤ 4 * R) ++ (hsumτ : ++ Summable ++ (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) : ++ (small.card : ℝ) ++ ≤ (4 * R) ^ τ ++ * ((∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) + 1) := by ++ classical ++ set Sτ : ℝ := ++ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ have hsum_le : (∑ p ∈ small, ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) ≤ Sτ := by ++ have hnn : ++ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ 0 ≤ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ intro p ++ exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ ++ simpa [Sτ] using ++ (Summable.sum_le_tsum (s := small) ++ (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) ++ (fun p _ => hnn p) hsumτ) ++ have hgeom_sum : ++ (small.card : ℝ) ≤ ∑ p ∈ small, (4 * R) ^ τ * ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ have hcard_eq : (small.card : ℝ) = ∑ p ∈ small, (1 : ℝ) := by simp ++ rw [hcard_eq] ++ refine Finset.sum_le_sum (fun p hp => ?_) ++ have hp_le : ‖divisorZeroIndex₀Val p‖ ≤ 4 * R := hsmall p hp ++ have hap : 0 < ‖divisorZeroIndex₀Val p‖ := ++ norm_pos_iff.2 (divisorZeroIndex₀Val_ne_zero p) ++ have hbase : (1 : ℝ) ≤ (4 * R) / ‖divisorZeroIndex₀Val p‖ := by ++ exact (le_div_iff₀ hap).2 (by simpa [mul_one] using hp_le) ++ have : (1 : ℝ) ≤ ((4 * R) / ‖divisorZeroIndex₀Val p‖) ^ τ := ++ Real.one_le_rpow hbase hτ_nonneg ++ have hdiv : ++ ((4 * R) / ‖divisorZeroIndex₀Val p‖) ^ τ = ++ (4 * R) ^ τ * (‖divisorZeroIndex₀Val p‖)⁻¹ ^ τ := by ++ have h4 : 0 ≤ (4 * R : ℝ) := by nlinarith [le_of_lt hRpos] ++ have ha : 0 ≤ (‖divisorZeroIndex₀Val p‖ : ℝ)⁻¹ := by positivity ++ simpa [div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using ++ (Real.mul_rpow (x := (4 * R : ℝ)) ++ (y := (‖divisorZeroIndex₀Val p‖ : ℝ)⁻¹) (z := τ) h4 ha) ++ have : (1 : ℝ) ≤ (4 * R) ^ τ * ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ simpa [hdiv] using this ++ exact this ++ have hgeom : ++ (small.card : ℝ) ≤ (4 * R) ^ τ * (∑ p ∈ small, ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by ++ simpa [Finset.mul_sum] using hgeom_sum ++ have hsmall_le : (small.card : ℝ) ≤ (4 * R) ^ τ * Sτ := by ++ exact hgeom.trans (mul_le_mul_of_nonneg_left hsum_le (by positivity)) ++ have hS_le : (4 * R) ^ τ * Sτ ≤ (4 * R) ^ τ * (Sτ + 1) := by ++ refine mul_le_mul_of_nonneg_left ?_ (by positivity) ++ linarith ++ have : (small.card : ℝ) ≤ (4 * R) ^ τ * (Sτ + 1) := hsmall_le.trans hS_le ++ simpa [Sτ, add_comm, add_left_comm, add_assoc, mul_assoc] using this ++ ++lemma cartan_rpow_mul_le ++ {τ R r : ℝ} (hRpos : 0 < R) (hrpos : 0 < r) (hR_le_r : R ≤ r) (hτ_nonneg : 0 ≤ τ) : ++ (4 * R) ^ τ ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ := by ++ have hR_le_1r : R ≤ 1 + r := by linarith [hR_le_r, le_of_lt hrpos] ++ have hbase0 : 0 ≤ (4 * R : ℝ) := by nlinarith [le_of_lt hRpos] ++ have : (4 * R) ^ τ ≤ (4 * (1 + r)) ^ τ := by ++ refine Real.rpow_le_rpow hbase0 ?_ hτ_nonneg ++ nlinarith [hR_le_1r] ++ have hmul : (4 * (1 + r)) ^ τ = (4 : ℝ) ^ τ * (1 + r) ^ τ := by ++ have h4 : 0 ≤ (4 : ℝ) := by norm_num ++ have h1 : 0 ≤ (1 + r : ℝ) := by positivity ++ simpa [mul_assoc] using ++ (Real.mul_rpow (x := (4 : ℝ)) (y := (1 + r : ℝ)) (z := τ) h4 h1) ++ simpa [hmul] using this ++ ++open Classical in ++theorem cartan_sum_majorant_le ++ {f : ℂ → ℂ} {m : ℕ} {τ R r : ℝ} ++ (hRpos : 0 < R) ++ (hrpos : 0 < r) ++ (hR_le_r : R ≤ r) ++ (hτ_nonneg : 0 ≤ τ) ++ (smallSet : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))) ++ (hsmall_fin : smallSet.Finite) ++ (hsmallSet : ++ smallSet = {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ‖divisorZeroIndex₀Val p‖ ≤ 4 * R}) ++ (hsumτ : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) ++ (hr_phi : ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ let a : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ (∑ p ∈ small, CartanBound.φ (r / a p)) ≤ CartanBound.Cφ * (small.card : ℝ)) : ++ let small : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := hsmall_fin.toFinset ++ letI : DecidableEq (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := Classical.decEq _ ++ let ap : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := fun p => ‖divisorZeroIndex₀Val p‖ ++ let b : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => ++ if p ∈ small then ++ CartanBound.φ (r / ap p) + (m : ℝ) * (1 + (r / ap p) ^ τ) ++ else ++ (2 : ℝ) * (r / ap p) ^ τ ++ let Sτ : ℝ := ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ ++ let Cprod : ℝ := cartanProductConstant m τ Sτ ++ ∀ s : Finset (divisorZeroIndex₀ f (Set.univ : Set ℂ)), ++ (∑ p ∈ s, b p) ≤ Cprod * (1 + r) ^ τ := by ++ classical ++ intro small ap b Sτ Cprod s ++ have hr : 0 ≤ r := le_of_lt hrpos ++ have hSτ_nonneg : 0 ≤ Sτ := ++ tsum_nonneg (fun _ => Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _) ++ have hsmall_mem : ∀ p, p ∈ small ↔ p ∈ smallSet := by ++ intro p ++ simp [small, hsmall_fin.mem_toFinset] ++ have hphi_sum : ++ (∑ p ∈ small, CartanBound.φ (r / ap p)) ≤ CartanBound.Cφ * (small.card : ℝ) := by ++ simpa [small, ap] using hr_phi ++ have hb_nonneg : ∀ p, 0 ≤ b p := by ++ simpa [ap, b] using (cartan_majorant_nonneg (f := f) (m := m) (τ := τ) (r := r) hr small) ++ have hb_summable : Summable b := by ++ simpa [ap, b] using ++ (cartan_majorant_summable (f := f) (m := m) (τ := τ) (r := r) hr small hsumτ) ++ have hsmall_norm : ∀ p ∈ small, ‖divisorZeroIndex₀Val p‖ ≤ 4 * R := by ++ intro p hp ++ have : p ∈ smallSet := (hsmall_mem p).1 hp ++ simpa [hsmallSet] using this ++ have hcard_le : (small.card : ℝ) ≤ (4 * R) ^ τ * (Sτ + 1) := by ++ simpa [Sτ, mul_assoc, add_assoc, add_left_comm, add_comm] using ++ (cartan_card_small_le (f := f) (τ := τ) (R := R) hRpos hτ_nonneg small hsmall_norm hsumτ) ++ have hpowR : (4 * R) ^ τ ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ := ++ cartan_rpow_mul_le (τ := τ) (R := R) (r := r) hRpos hrpos hR_le_r hτ_nonneg ++ have hcard_le' : (small.card : ℝ) ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ * (Sτ + 1) := by ++ have : (4 * R) ^ τ * (Sτ + 1) ≤ (4 : ℝ) ^ τ * (1 + r) ^ τ * (Sτ + 1) := by ++ exact mul_le_mul_of_nonneg_right hpowR (by linarith [hSτ_nonneg]) ++ exact le_trans hcard_le this ++ have hb_tsum_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) ≤ Cprod * (1 + r) ^ τ := by ++ let bφ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => if p ∈ small then CartanBound.φ (r / ap p) else 0 ++ let b0 : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => if p ∈ small then (m : ℝ) else 0 ++ let bmτ : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => if p ∈ small then (m : ℝ) * (r / ap p) ^ τ else 0 ++ let bt : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℝ := ++ fun p => (2 : ℝ) * (r / ap p) ^ τ ++ have hb_pointwise : ∀ p, b p ≤ bφ p + b0 p + bmτ p + bt p := by ++ intro p ++ by_cases hp : p ∈ small ++ · have hbase : 0 ≤ r / ap p := div_nonneg hr (by positivity) ++ have hx : 0 ≤ (r / ap p) ^ τ := Real.rpow_nonneg hbase τ ++ have hpos : 0 ≤ (2 : ℝ) * (r / ap p) ^ τ := mul_nonneg (by norm_num) hx ++ simp [b, bφ, b0, bmτ, bt, hp] ++ nlinarith ++ · simp [b, bφ, b0, bmτ, bt, hp] ++ have hmaj_summ : Summable (fun p => bφ p + b0 p + bmτ p + bt p) := by ++ have hbφ_summ : Summable bφ := by ++ simpa [bφ] using summable_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) ++ have hb0_summ : Summable b0 := by ++ simpa [b0] using summable_ite_mem_finset small (fun _ => (m : ℝ)) ++ have hbmτ_summ : Summable bmτ := by ++ simpa [bmτ] using summable_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) ++ have hbt_summ : Summable bt := by ++ have hconst : Summable (fun p => ++ (2 : ℝ) * (r ^ τ) * (‖divisorZeroIndex₀Val p‖⁻¹ ^ τ)) := ++ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) ++ refine hconst.congr ?_ ++ intro p ++ simp [bt, ap, rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p, ++ mul_assoc, mul_left_comm, mul_comm] ++ have h' : Summable (fun p => bφ p + b0 p + (bmτ p + bt p)) := ++ (hbφ_summ.add hb0_summ).add (hbmτ_summ.add hbt_summ) ++ simpa [add_assoc] using h' ++ have htsum_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) ++ ≤ ∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p) := ++ (hasSum_le hb_pointwise hb_summable.hasSum hmaj_summ.hasSum) ++ have htsum_bφ : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ++ = ∑ p ∈ small, CartanBound.φ (r / ap p) := by ++ classical ++ simpa [bφ] using tsum_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) ++ have htsum_b0 : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ++ = (m : ℝ) * (small.card : ℝ) := by ++ classical ++ have : (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) = ∑ p ∈ small, (m : ℝ) := by ++ simpa [b0] using tsum_ite_mem_finset small (fun _ => (m : ℝ)) ++ simp [this, Finset.sum_const, nsmul_eq_mul, mul_comm] ++ have htsum_bmτ : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ++ = (m : ℝ) * ∑ p ∈ small, (r / ap p) ^ τ := by ++ classical ++ have : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ++ = ∑ p ∈ small, (m : ℝ) * (r / ap p) ^ τ := by ++ simpa [bmτ] using tsum_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) ++ simp [this, Finset.mul_sum] ++ have htsum_bt : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) ++ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by ++ simpa [bt, ap, Sτ] using ++ tsum_two_mul_rpow_div_norm_divisorZeroIndex₀_le (f := f) (τ := τ) hr hτ_nonneg ++ have hsum_small_rpow_le : ++ (∑ p ∈ small, (r / ap p) ^ τ) ≤ (Sτ + 1) * (1 + r) ^ τ := by ++ simpa [ap, Sτ] using ++ sum_rpow_div_norm_divisorZeroIndex₀_le (f := f) (τ := τ) small hr hτ_nonneg hsumτ ++ have hm0 : 0 ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ have hCφ : 0 ≤ CartanBound.Cφ := le_of_lt CartanBound.Cφ_pos ++ have hS : 0 ≤ Sτ + 1 := by linarith [hSτ_nonneg] ++ have htsum_majorant : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) ++ ≤ (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) ++ * (1 + r) ^ τ := by ++ have hφ_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ++ ≤ CartanBound.Cφ * (small.card : ℝ) := by ++ simpa [htsum_bφ] using hphi_sum ++ have hb0_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ++ ≤ (m : ℝ) * (small.card : ℝ) := by ++ simp [htsum_b0] ++ have hbmτ_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ≤ ++ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ have h0 : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ++ ≤ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) := by ++ have hmul := mul_le_mul_of_nonneg_left hsum_small_rpow_le hm0 ++ ++ simpa [htsum_bmτ, mul_assoc, mul_left_comm, mul_comm] using hmul ++ have h1 : (1 : ℝ) ≤ (4 : ℝ) ^ τ := ++ Real.one_le_rpow (by norm_num) hτ_nonneg ++ have hscale : ++ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) ++ ≤ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ have hnonneg : 0 ≤ (m : ℝ) * ((Sτ + 1) * (1 + r) ^ τ) := by ++ have : 0 ≤ (Sτ + 1) * (1 + r) ^ τ := by positivity ++ exact mul_nonneg hm0 this ++ simpa [mul_assoc, mul_left_comm, mul_comm] using (mul_le_mul_of_nonneg_right h1 hnonneg) ++ exact h0.trans hscale ++ have hbt_le : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) ++ ≤ (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using htsum_bt ++ have hsplit : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) ++ = (∑' p, bφ p) + (∑' p, b0 p) + (∑' p, bmτ p) + (∑' p, bt p) := by ++ classical ++ have hbφ_summ : Summable bφ := by ++ simpa [bφ] using summable_ite_mem_finset small (fun p => CartanBound.φ (r / ap p)) ++ have hb0_summ : Summable b0 := by ++ simpa [b0] using summable_ite_mem_finset small (fun _ => (m : ℝ)) ++ have hbmτ_summ : Summable bmτ := by ++ simpa [bmτ] using summable_ite_mem_finset small (fun p => (m : ℝ) * (r / ap p) ^ τ) ++ have hbt_summ : Summable bt := by ++ have hconst : ++ Summable ++ (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ (2 : ℝ) * (r ^ τ) * ((‖divisorZeroIndex₀Val p‖⁻¹ : ℝ) ^ τ)) := ++ hsumτ.mul_left ((2 : ℝ) * (r ^ τ)) ++ refine hconst.congr ?_ ++ intro p ++ simp [bt, ap, rpow_div_norm_divisorZeroIndex₀_eq (f := f) (τ := τ) hr p, ++ mul_assoc, mul_left_comm, mul_comm] ++ exact tsum_add_four bφ b0 bmτ bt hbφ_summ hb0_summ hbmτ_summ hbt_summ ++ have hcard_le'' : ++ (small.card : ℝ) ≤ (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ simpa [mul_assoc, mul_left_comm, mul_comm] using hcard_le' ++ have hφ_le' : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ≤ ++ CartanBound.Cφ * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ have : CartanBound.Cφ * (small.card : ℝ) ≤ ++ CartanBound.Cφ * ((4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ) := ++ mul_le_mul_of_nonneg_left hcard_le'' hCφ ++ exact hφ_le.trans (by simpa [mul_assoc, mul_left_comm, mul_comm] using this) ++ have hb0_le' : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ≤ ++ (m : ℝ) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ := by ++ have : (m : ℝ) * (small.card : ℝ) ≤ (m : ℝ) * ((4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ) := ++ mul_le_mul_of_nonneg_left hcard_le'' hm0 ++ exact hb0_le.trans (by simpa [mul_assoc, mul_left_comm, mul_comm] using this) ++ have htsum_majorant' : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), (bφ p + b0 p + bmτ p + bt p)) ++ ≤ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ ++ + (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ := by ++ rw [hsplit] ++ set Y : ℝ := Sτ + 1 with hY ++ set T : ℝ := (1 + r) ^ τ with hT ++ have hφ_leY : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bφ p) ++ ≤ CartanBound.Cφ * (4 : ℝ) ^ τ * Y * T := by ++ simpa [hY, hT, mul_assoc] using hφ_le' ++ have hb0_leY : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b0 p) ++ ≤ (m : ℝ) * (4 : ℝ) ^ τ * Y * T := by ++ simpa [hY, hT, mul_assoc] using hb0_le' ++ have hbmτ_leY : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bmτ p) ++ ≤ (m : ℝ) * (4 : ℝ) ^ τ * Y * T := by ++ simpa [hY, hT, mul_assoc] using hbmτ_le ++ have hbt_leY : ++ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), bt p) ≤ (2 : ℝ) * Y * T := by ++ simpa [hY, hT, mul_assoc] using hbt_le ++ have hmain := ++ cartan_majorant_four_term_bound ++ (q := (4 : ℝ) ^ τ) hφ_leY hb0_leY hbmτ_leY hbt_leY ++ simpa [Y, T, add_assoc] using hmain ++ have hring : ++ (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ * (Sτ + 1) * (1 + r) ^ τ ++ + (2 : ℝ) * (Sτ + 1) * (1 + r) ^ τ ++ = (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) * (1 + r) ^ τ := by ++ exact cartan_majorant_add_two_factor ++ ((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ) (Sτ + 1) ((1 + r) ^ τ) ++ rw [← hring] ++ exact htsum_majorant' ++ have hCprod' : ++ (((CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ + 2) * (Sτ + 1)) * (1 + r) ^ τ ++ ≤ Cprod * (1 + r) ^ τ := by ++ simpa [Cprod, cartanProductConstant, mul_assoc, mul_left_comm, mul_comm] using ++ cartan_majorant_pad_two_to_three ++ (A := (CartanBound.Cφ + (2 : ℝ) * m) * (4 : ℝ) ^ τ) ++ (S := Sτ) (T := (1 + r) ^ τ) hS (by positivity) ++ exact (le_trans (le_trans htsum_le htsum_majorant) hCprod') ++ have hsum_fin_le : ++ (∑ p ∈ s, b p) ≤ (∑' p : divisorZeroIndex₀ f (Set.univ : Set ℂ), b p) := by ++ simpa using ++ (Summable.sum_le_tsum (s := s) (f := b) (fun p _ => hb_nonneg p) hb_summable) ++ exact hsum_fin_le.trans hb_tsum_le ++ ++end Complex.Hadamard ++end ++end ++section ++noncomputable section ++ ++open scoped BigOperators ++open Filter Finset _root_.Real _root_.SiegelZeros.Real Topology ++ ++lemma Finset.prod_le_exp_sum {α : Type} (s : Finset α) (a : α → ℝ) (b : α → ℝ) ++ (ha : ∀ x ∈ s, 0 ≤ a x) (hab : ∀ x ∈ s, a x ≤ Real.exp (b x)) : ++ (∏ x ∈ s, a x) ≤ Real.exp (∑ x ∈ s, b x) := by ++ calc ++ (∏ x ∈ s, a x) ≤ ∏ x ∈ s, Real.exp (b x) := Finset.prod_le_prod₀ ha hab ++ _ = Real.exp (∑ x ∈ s, b x) := by ++ simpa using (Real.exp_sum (s := s) (f := b)).symm ++ ++lemma hasProd_le_of_prod_le_exp {α : Type} {f : α → ℝ} {a : ℝ} ++ (hf : HasProd f a (SummationFilter.unconditional α)) ++ {B : ℝ} (hB : ∀ s : Finset α, (∏ x ∈ s, f x) ≤ Real.exp B) : ++ a ≤ Real.exp B := ++ hasProd_le_of_prod_le (L := (SummationFilter.unconditional α)) hf hB ++ ++lemma hasProd_inv_unconditional {α : Type} {fac : α → ℂ} {F : ℂ} ++ (hfac : HasProd fac F (SummationFilter.unconditional α)) (hF : F ≠ 0) : ++ HasProd (fun x => (fac x)⁻¹) (F⁻¹) (SummationFilter.unconditional α) := by ++ change ++ Tendsto (fun s : Finset α => ∏ x ∈ s, (fac x)⁻¹) ++ (SummationFilter.unconditional α).filter (𝓝 (F⁻¹)) ++ have hprod : ++ Tendsto (fun s : Finset α => ∏ x ∈ s, fac x) ++ (SummationFilter.unconditional α).filter (𝓝 F) := by ++ simpa [HasProd] using hfac ++ have hinv : ++ Tendsto (fun s : Finset α => (∏ x ∈ s, fac x)⁻¹) ++ (SummationFilter.unconditional α).filter (𝓝 (F⁻¹)) := ++ hprod.inv₀ hF ++ refine hinv.congr' (Filter.Eventually.of_forall ?_) ++ intro s ++ simp [Finset.prod_inv_distrib] ++ ++lemma hasProd_norm_inv_unconditional {α : Type} {fac : α → ℂ} {F : ℂ} ++ (hfac : HasProd fac F (SummationFilter.unconditional α)) (hF : F ≠ 0) : ++ HasProd (fun x => ‖(fac x)⁻¹‖) ‖F⁻¹‖ (SummationFilter.unconditional α) := by ++ change ++ Tendsto (fun s : Finset α => ∏ x ∈ s, ‖(fac x)⁻¹‖) ++ (SummationFilter.unconditional α).filter (𝓝 ‖F⁻¹‖) ++ have hnorm := (hasProd_inv_unconditional hfac hF).norm ++ refine hnorm.congr' (Filter.Eventually.of_forall ?_) ++ intro s ++ simp [norm_inv, Finset.prod_inv_distrib] ++ ++lemma hasProd_norm_inv_le_exp_of_pointwise_le_exp {α : Type} {fac : α → ℂ} {F : ℂ} ++ (hfac : HasProd fac F (SummationFilter.unconditional α)) ++ (b : α → ℝ) (B : ℝ) ++ (hterm : ∀ x, ‖(fac x)⁻¹‖ ≤ Real.exp (b x)) ++ (hsum : ∀ s : Finset α, (∑ x ∈ s, b x) ≤ B) : ++ ‖F⁻¹‖ ≤ Real.exp B := by ++ by_cases hF : F = 0 ++ · subst hF ++ simpa using exp_nonneg B ++ have hnorm : ++ HasProd (fun x => ‖(fac x)⁻¹‖) ‖F⁻¹‖ (SummationFilter.unconditional α) := ++ hasProd_norm_inv_unconditional hfac hF ++ have hprod : ∀ s : Finset α, (∏ x ∈ s, ‖(fac x)⁻¹‖) ≤ Real.exp B := by ++ intro s ++ have h0 : ∀ x ∈ s, 0 ≤ ‖(fac x)⁻¹‖ := by intro _ _; positivity ++ have h1 : (∏ x ∈ s, ‖(fac x)⁻¹‖) ≤ Real.exp (∑ x ∈ s, b x) := by ++ refine Finset.prod_le_exp_sum s (a := fun x => ‖(fac x)⁻¹‖) (b := b) h0 ?_ ++ intro x hx ++ simpa using hterm x ++ have h2 : Real.exp (∑ x ∈ s, b x) ≤ Real.exp B := ++ Real.exp_le_exp.2 (hsum s) ++ exact h1.trans h2 ++ exact hasProd_le_of_prod_le_exp hnorm hprod ++end ++end ++section ++open Metric ++ ++namespace Complex ++ ++theorem borelCaratheodory_zero_closedBall {f : ℂ → ℂ} {M r R : ℝ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ (hr : 0 < r) (hlt : r < R) (hM : 0 < M) (hf0 : f 0 = 0) ++ (hf_re : ∀ w, ‖w‖ ≤ R → (f w).re ≤ M) {z : ℂ} (hz : ‖z‖ ≤ r) : ++ ‖f z‖ ≤ 2 * M * r / (R - r) := by ++ have hR : 0 < R := lt_trans hr hlt ++ have hz_ball : z ∈ Metric.ball (0 : ℂ) R := by ++ rw [Metric.mem_ball, dist_zero_right] ++ exact hz.trans_lt hlt ++ have hf_diff : DifferentiableOn ℂ f (Metric.ball (0 : ℂ) R) := by ++ intro w hw ++ have hw' : w ∈ Metric.closedBall (0 : ℂ) R := ball_subset_closedBall hw ++ exact (hf w hw').differentiableAt.differentiableWithinAt ++ have hf_map : Set.MapsTo f (Metric.ball (0 : ℂ) R) {w | w.re ≤ M} := by ++ intro w hw ++ simp only [Set.mem_ofPred_eq] ++ have hw' : ‖w‖ < R := by simpa [Metric.mem_ball, dist_zero_right] using hw ++ exact hf_re w hw'.le ++ have hbc := ++ _root_.Complex.borelCaratheodory_zero hM hf_diff hf_map hR hz_ball hf0 ++ have hzR : ‖z‖ < R := by ++ rw [Metric.mem_ball, dist_zero_right] at hz_ball ++ exact hz_ball ++ have hmono : ‖z‖ / (R - ‖z‖) ≤ r / (R - r) := by ++ have hrden : 0 < R - r := sub_pos.mpr hlt ++ have hden : 0 < R - ‖z‖ := sub_pos.mpr hzR ++ rw [div_le_div_iff₀ hden hrden] ++ nlinarith [hz, norm_nonneg z] ++ have hM' : 0 ≤ 2 * M := mul_nonneg (by norm_num) (le_of_lt hM) ++ calc ‖f z‖ ++ ≤ 2 * M * ‖z‖ / (R - ‖z‖) := hbc ++ _ ≤ 2 * M * (r / (R - r)) := by ++ simpa [mul_div_assoc] using mul_le_mul_of_nonneg_left hmono hM' ++ _ = 2 * M * r / (R - r) := by ring ++ ++end Complex ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Products.lean b/PrimeNumberTheoremAnd/SiegelZeros/Products.lean +new file mode 100644 +index 0000000..db0daa8 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/Products.lean +@@ -0,0 +1,496 @@ ++import Mathlib ++ ++namespace SiegelZeros ++ ++open _root_.Complex ++ ++section ++open scoped BigOperators ++ ++namespace Real ++ ++lemma pow_div_one_sub_le_two_mul {r : ℝ} (hr : 0 ≤ r) (hrhalf : r ≤ 1 / 2) (m : ℕ) : ++ r ^ (m + 1) / (1 - r) ≤ 2 * r ^ (m + 1) := by ++ have hpow : 0 ≤ r ^ (m + 1) := pow_nonneg hr _ ++ have hhalf' : (1 / 2 : ℝ) ≤ 1 - r := by linarith ++ calc ++ r ^ (m + 1) / (1 - r) ≤ r ^ (m + 1) / (1 / 2 : ℝ) := by ++ exact div_le_div_of_nonneg_left hpow (by positivity) hhalf' ++ _ = 2 * r ^ (m + 1) := by ring ++ ++end Real ++ ++namespace Complex ++ ++open scoped BigOperators in ++ ++lemma neg_log_one_sub_eq_tsum {z : ℂ} (hz : ‖z‖ < 1) : ++ -log (1 - z) = ∑' n : ℕ, z ^ (n + 1) / (n + 1) := by ++ have h := hasSum_taylorSeries_neg_log hz ++ rw [← h.tsum_eq, h.summable.tsum_eq_zero_add] ++ simp only [pow_zero, Nat.cast_zero, div_zero, zero_add, Nat.cast_add, Nat.cast_one] ++ ++noncomputable ++def partialLogSum (m : ℕ) (z : ℂ) : ℂ := ++ -logTaylor (m + 1) (-z) ++ ++@[simp] ++lemma partialLogSum_zero (z : ℂ) : partialLogSum 0 z = 0 := by ++ simp [partialLogSum, logTaylor_succ, logTaylor_zero] ++ ++@[simp] ++lemma partialLogSum_at_zero (m : ℕ) : partialLogSum m 0 = 0 := by ++ simp [partialLogSum, logTaylor_at_zero] ++ ++lemma logTaylor_succ_neg (n : ℕ) (z : ℂ) : ++ logTaylor (n + 1) (-z) = logTaylor n (-z) - z ^ n / n := by ++ rw [logTaylor_succ, Pi.add_apply] ++ have hsign : (-1 : ℂ) ^ (n + 1) * (-z) ^ n = -z ^ n := by ++ have hzpow : (-z) ^ n = (((-1 : ℂ) * z) ^ n) := by simp ++ rw [hzpow, mul_pow, ← mul_assoc, ← pow_add] ++ have hpow : (-1 : ℂ) ^ (n + 1 + n) = (-1 : ℂ) := by ++ rw [show n + 1 + n = 2 * n + 1 by omega, pow_add, pow_mul] ++ norm_num ++ rw [hpow] ++ ring ++ rw [show (-1 : ℂ) ^ (n + 1) * (-z) ^ n / n = -(z ^ n / n) by ++ rw [hsign] ++ ring] ++ abel ++ ++lemma logTaylor_neg_eq_neg_sum (m : ℕ) (z : ℂ) : ++ logTaylor (m + 1) (-z) = -∑ k ∈ Finset.range m, z ^ (k + 1) / (k + 1) := by ++ induction m with ++ | zero => ++ simp [logTaylor_succ, logTaylor_zero] ++ | succ m hm => ++ rw [logTaylor_succ_neg, hm, Finset.sum_range_succ] ++ have hcast : ((m + 1 : ℕ) : ℂ) = (1 + (m : ℂ)) := by ++ simp [Nat.cast_add, Nat.cast_one, add_comm] ++ rw [hcast] ++ ring_nf ++ ++lemma partialLogSum_eq_sum (m : ℕ) (z : ℂ) : ++ partialLogSum m z = ∑ k ∈ Finset.range m, z ^ (k + 1) / (k + 1) := by ++ simpa [partialLogSum] using congrArg Neg.neg (logTaylor_neg_eq_neg_sum m z) ++ ++lemma hasDerivAt_partialLogSum (m : ℕ) (z : ℂ) : ++ HasDerivAt (partialLogSum m) (∑ j ∈ Finset.range m, z ^ j) z := by ++ cases m with ++ | zero => ++ have hzero : partialLogSum 0 = fun _ : ℂ ↦ (0 : ℂ) := by ++ funext w ++ exact partialLogSum_zero w ++ simpa [hzero] using (hasDerivAt_const z (c := (0 : ℂ))) ++ | succ m => ++ have hsum : ++ (∑ j ∈ Finset.range (m + 1), z ^ j) = ++ ∑ j ∈ Finset.range (m + 1), (-1) ^ j * (-z) ^ j := by ++ refine Finset.sum_congr rfl ?_ ++ intro j hj ++ symm ++ calc ++ (-1 : ℂ) ^ j * (-z) ^ j = (-1 : ℂ) ^ j * (((-1 : ℂ) * z) ^ j) := by simp ++ _ = ((-1 : ℂ) ^ j * (-1 : ℂ) ^ j) * z ^ j := by rw [mul_pow]; ring ++ _ = z ^ j := by ++ rw [← pow_add, show j + j = 2 * j by omega, pow_mul] ++ norm_num ++ rw [hsum] ++ simpa [partialLogSum] using! ++ (((hasDerivAt_logTaylor (m + 1) (-z)).comp z (hasDerivAt_neg z)).neg) ++ ++lemma differentiable_partialLogSum (m : ℕ) : ++ Differentiable ℂ (fun z : ℂ => partialLogSum m z) := by ++ intro z ++ exact (hasDerivAt_partialLogSum m z).differentiableAt ++ ++noncomputable ++def logTail (m : ℕ) (z : ℂ) : ℂ := ++ ∑' k, z ^ (m + 1 + k) / (m + 1 + k) ++ ++lemma summable_logTail {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : ++ Summable (fun k => z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)) := by ++ have h_geom : Summable (fun k : ℕ => ‖z‖ ^ k) := ++ summable_geometric_of_lt_one (norm_nonneg z) hz ++ refine Summable.of_norm_bounded (g := fun k => ‖z‖ ^ k) h_geom ?_ ++ intro k ++ rw [norm_div, norm_pow] ++ have h1 : (1 : ℝ) ≤ (m + 1 + k : ℝ) := by ++ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity ++ nlinarith ++ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (Complex.norm_natCast (m + 1 + k)) ++ rw [hnorm] ++ calc ++ ‖z‖ ^ (m + 1 + k) / (m + 1 + k : ℝ) ≤ ‖z‖ ^ (m + 1 + k) := by ++ exact div_le_self (pow_nonneg (norm_nonneg z) _) h1 ++ _ = ‖z‖ ^ (m + 1) * ‖z‖ ^ k := by rw [pow_add] ++ _ ≤ 1 * ‖z‖ ^ k := by ++ refine mul_le_mul_of_nonneg_right ?_ (pow_nonneg (norm_nonneg z) k) ++ exact pow_le_one₀ (norm_nonneg z) (le_of_lt hz) ++ _ = ‖z‖ ^ k := one_mul _ ++ ++lemma norm_logTail_le {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : ++ ‖logTail m z‖ ≤ ‖z‖ ^ (m + 1) / (1 - ‖z‖) := by ++ dsimp only [logTail] ++ have h_rhs_summable : Summable (fun k => ‖z‖ ^ (m + 1 + k)) := by ++ simpa [pow_add] using ++ (summable_geometric_of_lt_one (norm_nonneg z) hz).mul_left (‖z‖ ^ (m + 1)) ++ have h_norm_summable : Summable (fun k => ‖z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖) := by ++ refine Summable.of_nonneg_of_le (fun _ => norm_nonneg _) ?_ h_rhs_summable ++ intro k ++ rw [norm_div, norm_pow] ++ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (Complex.norm_natCast (m + 1 + k)) ++ rw [hnorm] ++ have hm : 1 ≤ (m + 1 + k : ℝ) := by ++ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity ++ nlinarith ++ exact div_le_self (pow_nonneg (norm_nonneg z) _) hm ++ calc ++ ‖∑' k, z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖ ++ ≤ ∑' k, ‖z ^ (m + 1 + k) / ((m + 1 + k) : ℂ)‖ := ++ norm_tsum_le_tsum_norm h_norm_summable ++ _ ≤ ∑' k, ‖z‖ ^ (m + 1 + k) := by ++ refine h_norm_summable.tsum_le_tsum ?_ h_rhs_summable ++ intro k ++ rw [norm_div, norm_pow] ++ have hm : 1 ≤ (m + 1 + k : ℝ) := by ++ have : (0 : ℝ) ≤ (m + k : ℝ) := by positivity ++ nlinarith ++ have hnorm : ‖(↑m + 1 + ↑k : ℂ)‖ = (m + 1 + k : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (Complex.norm_natCast (m + 1 + k)) ++ rw [hnorm] ++ exact div_le_self (pow_nonneg (norm_nonneg z) _) hm ++ _ = ‖z‖ ^ (m + 1) / (1 - ‖z‖) := by ++ have h_eq : ++ (fun k => ‖z‖ ^ (m + 1 + k)) = fun k => ‖z‖ ^ (m + 1) * ‖z‖ ^ k := by ++ ext k ++ rw [pow_add] ++ rw [h_eq, tsum_mul_left] ++ have h_geom := hasSum_geometric_of_lt_one (norm_nonneg z) hz ++ rw [h_geom.tsum_eq, div_eq_mul_inv] ++ ++lemma norm_logTail_le_two_mul_norm_pow {z : ℂ} (hz : ‖z‖ < 1) (hzhalf : ‖z‖ ≤ 1 / 2) (m : ℕ) : ++ ‖logTail m z‖ ≤ 2 * ‖z‖ ^ (m + 1) := ++ (norm_logTail_le hz m).trans (Real.pow_div_one_sub_le_two_mul (norm_nonneg z) hzhalf m) ++ ++lemma norm_partialLogSum_le_nat_mul_max_one_norm_pow (m : ℕ) (z : ℂ) : ++ ‖partialLogSum m z‖ ≤ (m : ℝ) * max 1 (‖z‖ ^ m) := by ++ have hsum : ++ ‖partialLogSum m z‖ ≤ ∑ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖ := by ++ rw [partialLogSum_eq_sum] ++ exact norm_sum_le _ _ ++ have hterm : ∀ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖ ≤ max 1 (‖z‖ ^ m) := by ++ intro k hk ++ rw [norm_div, norm_pow] ++ have hk1 : (1 : ℝ) ≤ (k : ℝ) + 1 := by ++ have hk1_nat : (1 : ℕ) ≤ k + 1 := Nat.succ_le_succ (Nat.zero_le k) ++ exact_mod_cast hk1_nat ++ have hdenom : ‖((k : ℂ) + 1)‖ = (k : ℝ) + 1 := by ++ simpa [Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (Complex.norm_natCast (k + 1)) ++ have hk_le : k + 1 ≤ m := Nat.succ_le_iff.2 (Finset.mem_range.1 hk) ++ have hpow_le : ‖z‖ ^ (k + 1) ≤ max 1 (‖z‖ ^ m) := by ++ have hz0 : 0 ≤ ‖z‖ := norm_nonneg z ++ by_cases hz1 : ‖z‖ ≤ (1 : ℝ) ++ · have : ‖z‖ ^ (k + 1) ≤ 1 := by exact pow_le_one₀ hz0 hz1 ++ exact this.trans (le_max_left _ _) ++ · have hz1' : (1 : ℝ) ≤ ‖z‖ := le_of_lt (lt_of_not_ge hz1) ++ have : ‖z‖ ^ (k + 1) ≤ ‖z‖ ^ m := pow_le_pow_right₀ hz1' hk_le ++ exact this.trans (le_max_right _ _) ++ calc ++ ‖z‖ ^ (k + 1) / ‖((k : ℂ) + 1)‖ = ‖z‖ ^ (k + 1) / ((k : ℝ) + 1) := by simp [hdenom] ++ _ ≤ ‖z‖ ^ (k + 1) := by ++ exact div_le_self (pow_nonneg (norm_nonneg z) _) hk1 ++ _ ≤ max 1 (‖z‖ ^ m) := hpow_le ++ have hsum_le : ++ (∑ k ∈ Finset.range m, ‖z ^ (k + 1) / (k + 1)‖) ≤ ++ ∑ _k ∈ Finset.range m, max 1 (‖z‖ ^ m) := ++ Finset.sum_le_sum (fun k hk => hterm k hk) ++ have hcard : ∑ _k ∈ Finset.range m, max 1 (‖z‖ ^ m) = (m : ℝ) * max 1 (‖z‖ ^ m) := by ++ simp [Finset.sum_const] ++ exact hsum.trans (hsum_le.trans_eq hcard) ++ ++lemma neg_log_one_sub_eq_partialLogSum_add_logTail {z : ℂ} (hz : ‖z‖ < 1) (m : ℕ) : ++ -log (1 - z) = partialLogSum m z + logTail m z := by ++ let f : ℕ → ℂ := fun k ↦ z ^ (k + 1) / ((k : ℂ) + 1) ++ have h_summable : Summable f := by ++ simpa [f, Nat.cast_add, Nat.cast_one, add_assoc, add_comm, add_left_comm] using ++ (summable_logTail hz 0) ++ have h_decomp := h_summable.sum_add_tsum_nat_add m ++ rw [neg_log_one_sub_eq_tsum hz, partialLogSum_eq_sum, ← h_decomp] ++ congr 1 ++ dsimp only [logTail] ++ refine tsum_congr fun k ↦ ?_ ++ simp only [f, Nat.cast_add] ++ ring_nf ++ ++end Complex ++end ++section ++noncomputable section ++ ++namespace Complex ++ ++variable {z : ℂ} ++ ++@[bound] ++theorem neg_norm_le_re (z : ℂ) : -‖z‖ ≤ z.re := ++ neg_le_of_abs_le (abs_re_le_norm z) ++ ++lemma norm_inv_pow_le_one_of_one_le_norm (u : ℂ) (n : ℕ) (hu : (1 : ℝ) ≤ ‖u‖) : ++ ‖(u ^ n)⁻¹‖ ≤ 1 := by ++ have hge : (1 : ℝ) ≤ ‖u ^ n‖ := by ++ rw [Complex.norm_pow] ++ exact one_le_pow₀ hu ++ calc ‖(u ^ n)⁻¹‖ = ‖(1 : ℂ) / u ^ n‖ := by rw [inv_eq_one_div] ++ _ = 1 / ‖u ^ n‖ := by ++ have hone : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp ++ rw [Complex.norm_div, hone] ++ _ ≤ 1 := by simpa [one_div] using inv_le_one_of_one_le₀ hge ++ ++end Complex ++end ++end ++section ++noncomputable section ++ ++open scoped BigOperators ++open Set ++ ++namespace Complex ++ ++def weierstrassFactor (m : ℕ) (z : ℂ) : ℂ := ++ (1 - z) * exp (partialLogSum m z) ++ ++lemma weierstrassFactor_def (m : ℕ) (z : ℂ) : ++ weierstrassFactor m z = (1 - z) * exp (partialLogSum m z) := by ++ simp [weierstrassFactor] ++ ++@[simp] ++lemma weierstrassFactor_at_zero (m : ℕ) : weierstrassFactor m 0 = 1 := by ++ simp [weierstrassFactor, partialLogSum_at_zero] ++ ++lemma weierstrassFactor_eq_zero_iff (m : ℕ) (z : ℂ) : ++ weierstrassFactor m z = 0 ↔ z = 1 := by ++ constructor ++ · intro hz ++ rw [weierstrassFactor] at hz ++ rcases mul_eq_zero.mp hz with h1 | h2 ++ · exact (sub_eq_zero.mp h1).symm ++ · exact absurd h2 (exp_ne_zero _) ++ · rintro rfl ++ simp [weierstrassFactor] ++ ++lemma weierstrassFactor_ne_zero_iff (m : ℕ) (z : ℂ) : ++ weierstrassFactor m z ≠ 0 ↔ z ≠ 1 := by ++ simpa [ne_eq] using (not_congr (weierstrassFactor_eq_zero_iff (m := m) (z := z))) ++ ++lemma weierstrassFactor_ne_zero_of_ne_one (m : ℕ) {z : ℂ} (hz : z ≠ 1) : ++ weierstrassFactor m z ≠ 0 := ++ (weierstrassFactor_ne_zero_iff (m := m) (z := z)).2 hz ++ ++lemma differentiable_weierstrassFactor (m : ℕ) : ++ Differentiable ℂ (fun z : ℂ => weierstrassFactor m z) := by ++ simpa [weierstrassFactor] using! ++ ((differentiable_const (c := (1 : ℂ))).sub differentiable_id).mul ++ (differentiable_exp.comp (differentiable_partialLogSum m)) ++ ++theorem analyticOrderAt_weierstrassFactor_div_self (m : ℕ) {a : ℂ} (ha : a ≠ 0) : ++ analyticOrderAt (fun z : ℂ => weierstrassFactor m (z / a)) a = (1 : ℕ∞) := by ++ set F : ℂ → ℂ := fun z => weierstrassFactor m (z / a) ++ have hF : AnalyticAt ℂ F a := by ++ have hdiv : Differentiable ℂ (fun z : ℂ => z / a) := by ++ simp [div_eq_mul_inv] ++ have hdiff : Differentiable ℂ F := (differentiable_weierstrassFactor m).comp hdiv ++ exact Differentiable.analyticAt (f := F) hdiff a ++ let g : ℂ → ℂ := fun z => (-a⁻¹) * Complex.exp (partialLogSum m (z / a)) ++ have hg : AnalyticAt ℂ g a := by ++ have hdiv : Differentiable ℂ (fun z : ℂ => z / a) := by ++ simp [div_eq_mul_inv] ++ have hpls : Differentiable ℂ (fun z : ℂ => partialLogSum m (z / a)) := ++ (differentiable_partialLogSum m).comp hdiv ++ have hexp : Differentiable ℂ (fun z : ℂ => Complex.exp (partialLogSum m (z / a))) := ++ (Complex.differentiable_exp).comp hpls ++ have hdiffg : Differentiable ℂ g := by ++ simpa [g] using hexp.const_mul (-a⁻¹ : ℂ) ++ exact Differentiable.analyticAt (f := g) hdiffg a ++ have hg0 : g a ≠ 0 := by ++ have hconst : (-a⁻¹ : ℂ) ≠ 0 := by simp [ha] ++ have hexp0 : Complex.exp (partialLogSum m (a / a)) ≠ 0 := ++ Complex.exp_ne_zero (partialLogSum m (a / a)) ++ simpa [g] using mul_ne_zero hconst hexp0 ++ refine (hF.analyticOrderAt_eq_natCast (n := 1)).2 ?_ ++ refine ⟨g, hg, hg0, ?_⟩ ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ have hlin : (1 - z / a) = (z - a) * (-a⁻¹) := by ++ have h1 : (1 : ℂ) = a * a⁻¹ := by simp [ha] ++ simp [div_eq_mul_inv, h1] ++ ring ++ simp only [F, g, pow_one, smul_eq_mul] ++ rw [weierstrassFactor_def] ++ simp [hlin, mul_assoc] ++ ++lemma weierstrassFactor_eq_exp_neg_tail (m : ℕ) {z : ℂ} (hz : ‖z‖ < 1) (hz1 : z ≠ 1) : ++ weierstrassFactor m z = exp (-logTail m z) := by ++ unfold weierstrassFactor ++ have hz_ne_1 : 1 - z ≠ 0 := sub_ne_zero.mpr hz1.symm ++ rw [← exp_log hz_ne_1, ← Complex.exp_add] ++ have hsum : log (1 - z) + partialLogSum m z = -logTail m z := by ++ have hdecomp := neg_log_one_sub_eq_partialLogSum_add_logTail hz m ++ calc ++ log (1 - z) + partialLogSum m z ++ = log (1 - z) + (partialLogSum m z + logTail m z) - logTail m z := by ring ++ _ = log (1 - z) + (-log (1 - z)) - logTail m z := by rw [hdecomp] ++ _ = -logTail m z := by ring ++ simp [hsum] ++ ++theorem weierstrassFactor_sub_one_pow_bound {m : ℕ} {z : ℂ} (hz : ‖z‖ ≤ 1 / 2) : ++ ‖weierstrassFactor m z - 1‖ ≤ 4 * ‖z‖ ^ (m + 1) := by ++ by_cases hm : m = 0 ++ · subst hm ++ have hmain : ‖(1 - z) - 1‖ ≤ 4 * ‖z‖ ^ 1 := by ++ have h : (1 - z) - 1 = -z := by ring ++ calc ++ ‖(1 - z) - 1‖ = ‖-z‖ := by simp [h] ++ _ = ‖z‖ := norm_neg z ++ _ = ‖z‖ ^ 1 := by simp ++ _ ≤ 4 * ‖z‖ ^ 1 := by nlinarith [pow_nonneg (norm_nonneg z) 1] ++ simpa [weierstrassFactor] using hmain ++ · have hz_lt : ‖z‖ < 1 := lt_of_le_of_lt hz (by norm_num) ++ by_cases hz1 : z = 1 ++ · exfalso; rw [hz1] at hz; norm_num at hz ++ have h_eq : weierstrassFactor m z = exp (-logTail m z) := ++ weierstrassFactor_eq_exp_neg_tail m hz_lt hz1 ++ rw [h_eq] ++ have h_tail_bound := norm_logTail_le_two_mul_norm_pow hz_lt hz m ++ have hw_le_one : ‖-logTail m z‖ ≤ 1 := by ++ simp only [norm_neg] ++ have : ‖logTail m z‖ ≤ 1 := by ++ have hm_pos : 0 < m := Nat.pos_of_ne_zero hm ++ have h2 : 2 ≤ m + 1 := by ++ exact Nat.succ_le_succ (Nat.succ_le_iff.2 hm_pos) ++ have hpow : (‖z‖ ^ (m + 1)) ≤ (‖z‖ ^ 2) := by ++ have hz1' : ‖z‖ ≤ 1 := by nlinarith [hz] ++ have hz0' : 0 ≤ ‖z‖ := norm_nonneg z ++ exact pow_le_pow_of_le_one hz0' hz1' h2 ++ have hmul : 2 * ‖z‖ ^ (m + 1) ≤ 2 * ‖z‖ ^ 2 := by gcongr ++ have hsq : 2 * ‖z‖ ^ 2 ≤ 1 := by ++ have hz0 : 0 ≤ ‖z‖ := norm_nonneg z ++ have hz_sq : ‖z‖ ^ 2 ≤ (1 / 2 : ℝ) ^ 2 := pow_le_pow_left₀ hz0 hz 2 ++ nlinarith ++ exact (h_tail_bound.trans hmul).trans hsq ++ linarith ++ have h_exp_sub_one : ‖exp (-logTail m z) - 1‖ ≤ 2 * ‖-logTail m z‖ := ++ Complex.norm_exp_sub_one_le hw_le_one ++ simp only [norm_neg] at h_exp_sub_one ++ calc ++ ‖exp (-logTail m z) - 1‖ ≤ 2 * ‖logTail m z‖ := h_exp_sub_one ++ _ ≤ 2 * (2 * ‖z‖ ^ (m + 1)) := by gcongr ++ _ = 4 * ‖z‖ ^ (m + 1) := by ring ++ ++lemma log_norm_weierstrassFactor_ge_log_norm_one_sub_sub (m : ℕ) (z : ℂ) : ++ Real.log ‖1 - z‖ - ‖partialLogSum m z‖ ≤ Real.log ‖weierstrassFactor m z‖ := by ++ by_cases hz1 : z = (1 : ℂ) ++ · subst hz1 ++ simp [weierstrassFactor] ++ set S : ℂ := partialLogSum m z ++ have hS : weierstrassFactor m z = (1 - z) * Complex.exp S := by ++ simp [weierstrassFactor, S] ++ have hnorm_pos : 0 < ‖(1 : ℂ) - z‖ := ++ norm_pos_iff.mpr (sub_ne_zero.mpr (Ne.symm hz1)) ++ have hlog : ++ Real.log ‖weierstrassFactor m z‖ = Real.log ‖1 - z‖ + S.re := by ++ have hne : ‖(1 : ℂ) - z‖ ≠ 0 := ne_of_gt hnorm_pos ++ calc ++ Real.log ‖weierstrassFactor m z‖ ++ = Real.log (‖(1 : ℂ) - z‖ * ‖Complex.exp S‖) := by ++ simp [hS] ++ _ = Real.log ‖(1 : ℂ) - z‖ + Real.log ‖Complex.exp S‖ := by ++ simpa using (Real.log_mul hne (ne_of_gt (by simp))) ++ _ = Real.log ‖(1 : ℂ) - z‖ + S.re := by ++ simp [Complex.norm_exp, Real.log_exp] ++ _ = Real.log ‖1 - z‖ + S.re := by simp [sub_eq_add_neg, add_comm] ++ have hre : S.re ≥ -‖S‖ := Complex.neg_norm_le_re S ++ have : Real.log ‖weierstrassFactor m z‖ ≥ Real.log ‖1 - z‖ - ‖S‖ := by ++ linarith [hlog, hre] ++ simpa [S] using this ++ ++lemma log_norm_weierstrassFactor_ge_neg_two_pow {m : ℕ} {z : ℂ} (hz : ‖z‖ ≤ (1 / 2 : ℝ)) : ++ (-2 : ℝ) * ‖z‖ ^ (m + 1) ≤ Real.log ‖weierstrassFactor m z‖ := by ++ have hz_lt : ‖z‖ < (1 : ℝ) := lt_of_le_of_lt hz (by norm_num) ++ have hz1 : z ≠ (1 : ℂ) := by ++ intro h ++ have : (1 : ℝ) ≤ (1 / 2 : ℝ) := by ++ simpa [h] using hz ++ norm_num at this ++ have hEq : weierstrassFactor m z = Complex.exp (-logTail m z) := ++ weierstrassFactor_eq_exp_neg_tail m hz_lt hz1 ++ have hlog : ++ Real.log ‖weierstrassFactor m z‖ = (-logTail m z).re := by ++ simp [hEq, Complex.norm_exp, Real.log_exp] ++ have hre : (-logTail m z).re ≥ -‖logTail m z‖ := by ++ simpa [norm_neg] using Complex.neg_norm_le_re (-logTail m z) ++ have htail := norm_logTail_le_two_mul_norm_pow hz_lt hz m ++ have : (-logTail m z).re ≥ (-2 : ℝ) * ‖z‖ ^ (m + 1) := by ++ calc ++ (-logTail m z).re ≥ -‖logTail m z‖ := hre ++ _ ≥ (-2 : ℝ) * ‖z‖ ^ (m + 1) := by ++ nlinarith [htail] ++ simpa [hlog, mul_assoc, mul_left_comm, mul_comm] using this ++ ++end Complex ++end ++end ++section ++noncomputable section ++ ++open Filter Topology ++ ++namespace Complex ++ ++theorem logDeriv_weierstrassFactor_one_div {a z : ℂ} (ha : a ≠ 0) (hz : z ≠ a) : ++ logDeriv (fun w : ℂ => weierstrassFactor 1 (w / a)) z = ++ 1 / (z - a) + 1 / a := by ++ have hE : ++ (fun w : ℂ => weierstrassFactor 1 (w / a)) = ++ fun w : ℂ => (1 - w / a) * exp (w / a) := by ++ ext w ++ simp [weierstrassFactor_def, partialLogSum_eq_sum] ++ have hf : (1 - z / a) ≠ 0 := by ++ intro hzero ++ have hdiv : z / a = 1 := by ++ exact (sub_eq_zero.mp hzero).symm ++ exact hz ((div_eq_one_iff_eq ha).1 hdiv) ++ rw [hE, logDeriv_fun_mul z hf (exp_ne_zero (z / a)) (by fun_prop) (by fun_prop)] ++ have hleft : logDeriv (fun w : ℂ => 1 - w / a) z = 1 / (z - a) := by ++ rw [logDeriv_apply] ++ have hderiv : deriv (fun w : ℂ => 1 - w / a) z = -(1 / a) := by ++ simp [one_div] ++ rw [hderiv] ++ have haz : -z + a ≠ 0 := by ++ simpa [sub_eq_add_neg, add_comm] using sub_ne_zero.mpr (Ne.symm hz) ++ field_simp [ha, sub_ne_zero.mpr hz, haz] ++ have haz' : a - z ≠ 0 := sub_ne_zero.mpr (Ne.symm hz) ++ have hza : z - a = -(a - z) := by ring ++ rw [hza] ++ field_simp [haz'] ++ have hright : logDeriv (fun w : ℂ => exp (w / a)) z = 1 / a := by ++ rw [logDeriv_apply] ++ have hderiv : deriv (fun w : ℂ => exp (w / a)) z = ++ exp (z / a) * (1 / a) := by ++ simp [one_div] ++ rw [hderiv] ++ field_simp [exp_ne_zero (z / a)] ++ rw [hleft, hright] ++ ++end Complex ++end ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SiegelZeros/Summability.lean b/PrimeNumberTheoremAnd/SiegelZeros/Summability.lean +new file mode 100644 +index 0000000..0a11558 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/SiegelZeros/Summability.lean +@@ -0,0 +1,501 @@ ++import Mathlib ++import PrimeNumberTheoremAnd.SiegelZeros.Factorization ++import PrimeNumberTheoremAnd.SiegelZeros.Counting ++ ++namespace SiegelZeros ++ ++section ++noncomputable section ++ ++open Filter Topology Set _root_.SiegelZeros.Complex ++open scoped BigOperators Topology ++ ++namespace Complex.Hadamard ++ ++open scoped _root_.Real ++ ++noncomputable def divisorMassClosedBall₀ (f : ℂ → ℂ) (R : ℝ) : ℝ := ++ Function.locallyFinsuppWithin.massClosedBall₀ (MeromorphicOn.divisor f (Set.univ : Set ℂ)) R ++ ++lemma divisorMassClosedBall₀_le_of_growth {f : ℂ → ℂ} {ρ C : ℝ} ++ (hf : Differentiable ℂ f) ++ (hC : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) ++ {R : ℝ} (hR : 1 ≤ R) : ++ divisorMassClosedBall₀ f R ++ ≤ (C * (1 + |2 * R|) ^ ρ + |Real.log ‖meromorphicTrailingCoeffAt f 0‖|) / ++ Real.log 2 := by ++ simpa [divisorMassClosedBall₀] using ++ (Function.locallyFinsuppWithin.massClosedBall₀_divisor_le_of_log_growth ++ (f := f) (ρ := ρ) (C := C) hf hC hR) ++ ++lemma exists_r0_le_norm_divisorZeroIndex₀Val {f : ℂ → ℂ} ++ (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) : ++ ∃ r0 : ℝ, 0 < r0 ∧ ++ ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖ := by ++ classical ++ set U : Set ℂ := (Set.univ : Set ℂ) ++ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U ++ have hDnonneg : 0 ≤ D := by ++ simpa [D, U] using (Differentiable.divisor_nonneg (f := f) hf) ++ have hzero : ∀ p : divisorZeroIndex₀ f U, f (divisorZeroIndex₀Val p) = 0 := by ++ intro p ++ set z : ℂ := divisorZeroIndex₀Val p ++ have hneTop : meromorphicOrderAt f z ≠ ⊤ := by ++ have hzAnal : AnalyticAt ℂ f z := hf.analyticAt z ++ have hzA : analyticOrderAt f z ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) (hf := hf) hnot (z := z) ++ intro htop ++ have hm : meromorphicOrderAt f z = (analyticOrderAt f z).map (↑) := ++ hzAnal.meromorphicOrderAt_eq (𝕜 := ℂ) ++ cases h : analyticOrderAt f z with ++ | top => ++ exact hzA (by simp [h]) ++ | coe n => ++ have : (analyticOrderAt f z).map (↑) ≠ (⊤ : WithTop ℤ) := by ++ simp [h] ++ exact this (by simpa [hm] using htop) ++ have hmon : MeromorphicOn f U := by ++ intro w hw; exact (hf.analyticAt w).meromorphicAt ++ have hdiv : MeromorphicOn.divisor f U z = (meromorphicOrderAt f z).untop₀ := by ++ simpa [U] using (MeromorphicOn.divisor_apply (f := f) (U := U) (z := z) hmon (by aesop)) ++ have hDz : MeromorphicOn.divisor f U z ≠ 0 := by ++ have hzsup : z ∈ (MeromorphicOn.divisor f U).support := by ++ simp [z] ++ simpa [Function.mem_support] using hzsup ++ have hposZ : (0 : ℤ) < (meromorphicOrderAt f z).untop₀ := by ++ have hge0 : 0 ≤ (meromorphicOrderAt f z).untop₀ := by ++ have : 0 ≤ MeromorphicOn.divisor f U z := by ++ simpa [D, U, z] using hDnonneg z ++ simpa [hdiv] using this ++ have hne0 : (meromorphicOrderAt f z).untop₀ ≠ 0 := by ++ simpa [hdiv] using hDz ++ exact lt_of_le_of_ne hge0 (by simpa [eq_comm] using hne0) ++ have hpos : (0 : WithTop ℤ) < meromorphicOrderAt f z := by ++ have : (0 : WithTop ℤ) < ((meromorphicOrderAt f z).untop₀ : WithTop ℤ) := ++ WithTop.coe_lt_coe.2 hposZ ++ simpa [WithTop.coe_untop₀_of_ne_top hneTop] using this ++ have htend0 : Tendsto f (𝓝[≠] z) (𝓝 (0 : ℂ)) := ++ tendsto_zero_of_meromorphicOrderAt_pos (f := f) (x := z) hpos ++ have hcontz : ContinuousAt f z := (hf z).continuousAt ++ have htendz : Tendsto f (𝓝[≠] z) (𝓝 (f z)) := ++ (hcontz.tendsto.mono_left (nhdsWithin_le_nhds : 𝓝[≠] z ≤ 𝓝 z)) ++ exact tendsto_nhds_unique htendz htend0 ++ by_cases h0 : f 0 = 0 ++ · have hD0 : D 0 ≠ 0 := by ++ have hmero0 : MeromorphicAt f (0 : ℂ) := (hf.analyticAt 0).meromorphicAt ++ have hneTop0 : meromorphicOrderAt f (0 : ℂ) ≠ ⊤ := by ++ have hA0 : analyticOrderAt f (0 : ℂ) ≠ ⊤ := ++ analyticOrderAt_ne_top_of_exists_ne_zero (f := f) (hf := hf) hnot (z := 0) ++ intro htop ++ have hm : meromorphicOrderAt f (0 : ℂ) = (analyticOrderAt f (0 : ℂ)).map (↑) := ++ (hf.analyticAt 0).meromorphicOrderAt_eq (𝕜 := ℂ) ++ cases h : analyticOrderAt f (0 : ℂ) with ++ | top => exact (hA0 h).elim ++ | coe n => ++ have : (analyticOrderAt f (0 : ℂ)).map (↑) ≠ (⊤ : WithTop ℤ) := by ++ simp [h] ++ exact this (by simpa [hm] using htop) ++ have htend0 : Tendsto f (𝓝[≠] (0 : ℂ)) (𝓝 (0 : ℂ)) := by ++ have hcont0 : ContinuousAt f (0 : ℂ) := (hf 0).continuousAt ++ have : Tendsto f (𝓝 (0 : ℂ)) (𝓝 (0 : ℂ)) := by simpa [h0] using hcont0.tendsto ++ exact this.mono_left (nhdsWithin_le_nhds : 𝓝[≠] (0 : ℂ) ≤ 𝓝 (0 : ℂ)) ++ have hpos0 : (0 : WithTop ℤ) < meromorphicOrderAt f (0 : ℂ) := ++ (tendsto_zero_iff_meromorphicOrderAt_pos hmero0).1 htend0 ++ have hpos0' : (0 : ℤ) < (meromorphicOrderAt f (0 : ℂ)).untop₀ := by ++ have : (0 : WithTop ℤ) < ((meromorphicOrderAt f (0 : ℂ)).untop₀ : WithTop ℤ) := by ++ simpa [WithTop.coe_untop₀_of_ne_top hneTop0] using hpos0 ++ simpa using (WithTop.coe_lt_coe.1 this) ++ have hdiv0 : D 0 = (meromorphicOrderAt f (0 : ℂ)).untop₀ := by ++ have hmon : MeromorphicOn f U := by ++ intro w hw; exact (hf.analyticAt w).meromorphicAt ++ simpa [D, U] using ++ (MeromorphicOn.divisor_apply (f := f) (U := U) (z := (0 : ℂ)) ++ hmon (by aesop)) ++ exact by ++ have : (meromorphicOrderAt f (0 : ℂ)).untop₀ ≠ 0 := ne_of_gt hpos0' ++ simpa [hdiv0] using this ++ have hmem0 : (0 : ℂ) ∈ D.support := by ++ simp [Function.mem_support, hD0] ++ have hdisc : IsDiscrete D.support := by ++ simpa [D] using (D.discreteSupport) ++ rcases Metric.exists_ball_inter_eq_singleton_of_mem_discrete hdisc hmem0 with ⟨r0, hr0pos, hr0⟩ ++ refine ⟨r0, hr0pos, ?_⟩ ++ intro p ++ have hp : divisorZeroIndex₀Val p ∈ D.support := by ++ simp [D, divisorZeroIndex₀Val_mem_divisor_support (f := f) (U := U) p] ++ have hnotBall : divisorZeroIndex₀Val p ∉ Metric.ball (0 : ℂ) r0 := by ++ intro hball ++ have : divisorZeroIndex₀Val p ∈ Metric.ball (0 : ℂ) r0 ∩ D.support := ⟨hball, hp⟩ ++ have : divisorZeroIndex₀Val p ∈ ({(0 : ℂ)} : Set ℂ) := by simp [hr0] at this ++ have : divisorZeroIndex₀Val p = 0 := by simp [Set.mem_singleton_iff] at this ++ exact (divisorZeroIndex₀Val_ne_zero p) this ++ have : r0 ≤ ‖divisorZeroIndex₀Val p‖ := by ++ have : ¬ ‖divisorZeroIndex₀Val p‖ < r0 := by ++ intro hlt ++ exact hnotBall (by simpa [Metric.mem_ball, dist_zero_right] using hlt) ++ exact le_of_not_gt this ++ exact this ++ · have hcont0 : ContinuousAt f (0 : ℂ) := (hf 0).continuousAt ++ have hne : ∀ᶠ z in 𝓝 (0 : ℂ), f z ≠ 0 := hcont0.eventually_ne h0 ++ rcases Metric.mem_nhds_iff.1 hne with ⟨r0, hr0pos, hr0⟩ ++ refine ⟨r0, hr0pos, ?_⟩ ++ intro p ++ have : ¬ ‖divisorZeroIndex₀Val p‖ < r0 := by ++ intro hlt ++ have hzball : divisorZeroIndex₀Val p ∈ Metric.ball (0 : ℂ) r0 := by ++ simpa [Metric.mem_ball, dist_zero_right] using hlt ++ have : f (divisorZeroIndex₀Val p) ≠ 0 := hr0 hzball ++ exact this (hzero p) ++ exact le_of_not_gt this ++ ++open scoped BigOperators ++ ++lemma card_ball_le_divisorMassClosedBall₀ ++ {f : ℂ → ℂ} (hf : Differentiable ℂ f) {R : ℝ} (hR : 0 < R) : ++ (Nat.card {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) ++ ≤ divisorMassClosedBall₀ f R := by ++ set U : Set ℂ := (Set.univ : Set ℂ) ++ set D : Function.locallyFinsuppWithin U ℤ := MeromorphicOn.divisor f U ++ have : ++ Fintype {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} := by ++ have : Finite {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} := by ++ have : Metric.closedBall (0 : ℂ) R ⊆ U := by simp [U] ++ simpa using (finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := U) (B := R) this) ++ exact Fintype.ofFinite _ ++ have hDnonneg : 0 ≤ D := by ++ simpa [D, U] using (Differentiable.divisor_nonneg (f := f) hf) ++ let SR : Finset ℂ := ++ (Function.locallyFinsuppWithin.finiteSupport (Function.locallyFinsuppWithin.toClosedBall R D) ++ (isCompact_closedBall (0 : ℂ) |R|)).toFinset ++ let S : Finset ℂ := SR.filter fun z : ℂ => z ≠ 0 ++ let T : Type := ++ Σ z : S, Fin (Int.toNat (D z.1)) ++ let φ : ++ {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} → T := fun p => ++ let z0 : ℂ := divisorZeroIndex₀Val p.1 ++ have hz0_memSR : z0 ∈ SR := by ++ have hz0_norm : ‖z0‖ ≤ |R| := by ++ have : ‖z0‖ ≤ R := p.2 ++ simpa [abs_of_pos hR] using this ++ have hz0_support : z0 ∈ (Function.locallyFinsuppWithin.toClosedBall R D).support := by ++ have hz0_suppD : z0 ∈ D.support := by ++ simp [z0, D] ++ exact Function.locallyFinsuppWithin.mem_toClosedBall_support_of_mem_support_of_norm_le_abs ++ hz0_suppD hz0_norm ++ exact (Set.Finite.mem_toFinset ++ (Function.locallyFinsuppWithin.finiteSupport ++ (Function.locallyFinsuppWithin.toClosedBall R D) ++ (isCompact_closedBall (0 : ℂ) |R|))).2 hz0_support ++ have hz0_ne0 : z0 ≠ 0 := divisorZeroIndex₀Val_ne_zero p.1 ++ have hz0_memS : z0 ∈ S := Finset.mem_filter.2 ⟨hz0_memSR, hz0_ne0⟩ ++ ⟨⟨z0, hz0_memS⟩, by ++ simpa [z0, divisorZeroIndex₀Val, D] using p.1.1.2⟩ ++ have hφ_inj : Function.Injective φ := by ++ intro p q hpq ++ have hσ := (Sigma.mk.inj_iff).1 hpq ++ have hzS : (φ p).1 = (φ q).1 := hσ.1 ++ have hz : divisorZeroIndex₀Val p.1 = divisorZeroIndex₀Val q.1 := by ++ simpa [φ] using congrArg Subtype.val hzS ++ apply Subtype.ext ++ apply Subtype.ext ++ apply Sigma.ext ++ · exact hz ++ · simpa [φ] using hσ.2 ++ have hcard_le : ++ Fintype.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} ≤ Fintype.card T := ++ Fintype.card_le_of_injective φ hφ_inj ++ have hT_card : ++ (Fintype.card T : ℝ) = ++ (S.sum fun z : ℂ => (Int.toNat (D z) : ℝ)) := by ++ have hNat : ++ Fintype.card T = ∑ z : S, Int.toNat (D z.1) := by ++ have h1 : ++ Fintype.card T = ∑ z : S, Fintype.card (Fin (Int.toNat (D z.1))) := by ++ change Fintype.card (Sigma (fun z : S => Fin (Int.toNat (D z.1)))) ++ = ∑ z : S, Fintype.card (Fin (Int.toNat (D z.1))) ++ exact (Fintype.card_sigma (ι := S) (α := fun z : S => Fin (Int.toNat (D z.1)))) ++ simpa using h1 ++ have hR : ++ (Fintype.card T : ℝ) = ∑ z : S, (Int.toNat (D z.1) : ℝ) := by ++ exact_mod_cast hNat ++ have hR' : ++ (Fintype.card T : ℝ) = S.attach.sum (fun z : S => (Int.toNat (D z.1) : ℝ)) := by ++ simpa [Finset.univ_eq_attach] using hR ++ calc ++ (Fintype.card T : ℝ) = S.attach.sum (fun z : S => (Int.toNat (D z.1) : ℝ)) := hR' ++ _ = S.sum (fun z : ℂ => (Int.toNat (D z) : ℝ)) := by ++ simpa using (Finset.sum_attach (s := S) (f := fun z : ℂ => (Int.toNat (D z) : ℝ))) ++ have htoNat_le : ∀ z ∈ S, (Int.toNat (D z) : ℝ) ≤ (D z : ℝ) := by ++ intro z hz ++ have hDz_nonneg : 0 ≤ D z := by simpa [D] using hDnonneg z ++ have hEqZ : ((Int.toNat (D z) : ℕ) : ℤ) = D z := by ++ simpa using (Int.toNat_of_nonneg hDz_nonneg) ++ have hEqR : (Int.toNat (D z) : ℝ) = (D z : ℝ) := by ++ exact_mod_cast hEqZ ++ exact le_of_eq hEqR ++ calc ++ (Nat.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) ++ = (Fintype.card {p : divisorZeroIndex₀ f U // ‖divisorZeroIndex₀Val p‖ ≤ R} : ℝ) := by ++ simp [Nat.card_eq_fintype_card] ++ _ ≤ (Fintype.card T : ℝ) := by exact_mod_cast hcard_le ++ _ = S.sum (fun z : ℂ => (Int.toNat (D z) : ℝ)) := hT_card ++ _ ≤ S.sum (fun z : ℂ => (D z : ℝ)) := by ++ refine Finset.sum_le_sum ?_ ++ intro z hz ++ exact htoNat_le z hz ++ _ = divisorMassClosedBall₀ f R := by ++ rfl ++ ++lemma card_subtype_le_divisorMassClosedBall₀_of_norm_le ++ {f : ℂ → ℂ} (hf : Differentiable ℂ f) ++ {s : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ))} [Fintype s] ++ {R : ℝ} (hR : 0 < R) (hs : ∀ p : s, ‖divisorZeroIndex₀Val p.1‖ ≤ R) : ++ (Fintype.card s : ℝ) ≤ divisorMassClosedBall₀ f R := by ++ let Aball : Type := ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) // ‖divisorZeroIndex₀Val p‖ ≤ R} ++ have : Fintype Aball := by ++ have : Finite Aball := by ++ have : Metric.closedBall (0 : ℂ) R ⊆ (Set.univ : Set ℂ) := by simp ++ simpa [Aball] using ++ (finite_divisorZeroIndex₀_subtype_norm_le (f := f) (U := (Set.univ : Set ℂ)) ++ (B := R) this) ++ exact Fintype.ofFinite _ ++ have hinj : Function.Injective (fun p : s => (⟨p.1, hs p⟩ : Aball)) := by ++ intro p q hpq ++ apply Subtype.ext ++ exact congrArg (fun x : Aball => x.1) hpq ++ have hcard_le : Fintype.card s ≤ Fintype.card Aball := ++ Fintype.card_le_of_injective _ hinj ++ have hAball : (Nat.card Aball : ℝ) ≤ divisorMassClosedBall₀ f R := by ++ simpa [Aball] using card_ball_le_divisorMassClosedBall₀ (f := f) hf hR ++ calc ++ (Fintype.card s : ℝ) ≤ (Fintype.card Aball : ℝ) := by exact_mod_cast hcard_le ++ _ = (Nat.card Aball : ℝ) := by simp [Nat.card_eq_fintype_card] ++ _ ≤ divisorMassClosedBall₀ f R := hAball ++ ++lemma divisorZeroIndex₀_dyadicShell_upper_bound ++ {f : ℂ → ℂ} {r0 : ℝ} ++ (hr0pos : 0 < r0) ++ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) ++ {k : ℕ} {p : divisorZeroIndex₀ f (Set.univ : Set ℂ)} ++ (hp : ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k) : ++ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1) := by ++ exact Real.dyadicShell_upper_bound (r0 := r0) (x := ‖divisorZeroIndex₀Val p‖) ++ hr0pos (hr0 p) hp ++ ++lemma divisorZeroIndex₀_dyadicShell_lower_bound ++ {f : ℂ → ℂ} {r0 : ℝ} ++ (hr0pos : 0 < r0) ++ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) ++ {k : ℕ} {p : divisorZeroIndex₀ f (Set.univ : Set ℂ)} ++ (hp : ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k) : ++ r0 * (2 : ℝ) ^ (k : ℝ) ≤ ‖divisorZeroIndex₀Val p‖ := by ++ exact Real.dyadicShell_lower_bound (r0 := r0) (x := ‖divisorZeroIndex₀Val p‖) ++ hr0pos (hr0 p) hp ++ ++lemma finite_divisorZeroIndex₀_dyadicShell ++ {f : ℂ → ℂ} {r0 : ℝ} ++ (hr0pos : 0 < r0) ++ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), r0 ≤ ‖divisorZeroIndex₀Val p‖) ++ (k : ℕ) : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k} : Set _).Finite := by ++ have hsub : ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ = k} ⊆ ++ {p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)} := by ++ intro p hp ++ exact divisorZeroIndex₀_dyadicShell_upper_bound hr0pos hr0 hp ++ have hfin : ++ ({p : divisorZeroIndex₀ f (Set.univ : Set ℂ) | ++ ‖divisorZeroIndex₀Val p‖ ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)} : Set _).Finite := by ++ have : ++ Metric.closedBall (0 : ℂ) (r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) ⊆ ++ (Set.univ : Set ℂ) := by ++ simp ++ simpa using ++ (divisorZeroIndex₀_norm_le_finite (f := f) (U := (Set.univ : Set ℂ)) ++ (B := r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) this) ++ exact hfin.subset hsub ++ ++lemma tsum_divisorZeroIndex₀_dyadicShell_inv_rpow_le_geometric_of_growth ++ {f : ℂ → ℂ} {ρ τ r0 Cgrow : ℝ} ++ (hρ : 0 ≤ ρ) (hτpos : 0 < τ) (hf : Differentiable ℂ f) ++ (hCgrow_pos : 0 < Cgrow) ++ (hCgrow : ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ Cgrow * (1 + ‖z‖) ^ ρ) ++ (hr0pos : 0 < r0) ++ (hr0 : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ++ r0 ≤ ‖divisorZeroIndex₀Val p‖) ++ (k : ℕ) (hk_ge_one : 1 ≤ r0 * (2 : ℝ) ^ ((k : ℝ) + 1)) : ++ let kfun : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℕ := ++ fun p => ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ ++ let S : Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := {p | kfun p = k} ++ let Ctrail : ℝ := |Real.log ‖meromorphicTrailingCoeffAt f 0‖| ++ let A : ℝ := ((Cgrow / Real.log 2) * (1 + 4 * r0) ^ ρ) * (r0⁻¹) ^ τ ++ let B : ℝ := ((Ctrail / Real.log 2) + 1) * (r0⁻¹) ^ τ ++ let q : ℝ := (2 : ℝ) ^ (ρ - τ) ++ let qσ : ℝ := (2 : ℝ) ^ (-τ) ++ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ≤ A * q ^ k + B * qσ ^ k := by ++ classical ++ intro kfun S Ctrail A B q qσ ++ let rk : ℝ := r0 * (2 : ℝ) ^ (k : ℝ) ++ let Rk : ℝ := r0 * (2 : ℝ) ^ ((k : ℝ) + 1) ++ have hrk_pos : 0 < rk := mul_pos hr0pos (Real.rpow_pos_of_pos (by norm_num) _) ++ have hrk0 : 0 ≤ rk := le_of_lt hrk_pos ++ have : Finite S := by ++ simpa [S, kfun] using (finite_divisorZeroIndex₀_dyadicShell ++ (f := f) hr0pos hr0 k).to_subtype ++ have : Fintype S := Fintype.ofFinite S ++ have hk_upper : ∀ p : S, ‖divisorZeroIndex₀Val p.1‖ ≤ Rk := by ++ intro p ++ have hk' : kfun p.1 = k := p.2 ++ simpa [Rk, kfun] using ++ divisorZeroIndex₀_dyadicShell_upper_bound (f := f) hr0pos hr0 hk' ++ have hk_lower : ∀ p : S, rk ≤ ‖divisorZeroIndex₀Val p.1‖ := by ++ intro p ++ have hk' : kfun p.1 = k := p.2 ++ simpa [rk, kfun] using ++ divisorZeroIndex₀_dyadicShell_lower_bound (f := f) hr0pos hr0 hk' ++ have htsum_le : ++ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ++ ≤ (Fintype.card S : ℝ) * (rk⁻¹ ^ τ) := by ++ exact Real.tsum_inv_rpow_le_card_mul_of_lower_bound ++ (a := fun p : S => ‖divisorZeroIndex₀Val p.1‖) ++ hrk_pos hτpos (fun _ => norm_nonneg _) hk_lower ++ have hmass_le_growth : ++ divisorMassClosedBall₀ f Rk ++ ≤ (Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2) := by ++ simpa [Ctrail, Rk] using ++ (divisorMassClosedBall₀_le_of_growth (f := f) (ρ := ρ) (C := Cgrow) hf hCgrow ++ (R := Rk) hk_ge_one) ++ have hcard_le_mass : ++ (Fintype.card S : ℝ) ≤ divisorMassClosedBall₀ f Rk := by ++ have hRk_pos : 0 < Rk := lt_of_lt_of_le (by norm_num) hk_ge_one ++ exact card_subtype_le_divisorMassClosedBall₀_of_norm_le (f := f) hf hRk_pos hk_upper ++ have htsum' : ++ (∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ++ ≤ ((Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2)) * (rk⁻¹ ^ τ) := by ++ have hcard_le_growth : ++ (Fintype.card S : ℝ) ≤ ++ (Cgrow * (1 + |2 * Rk|) ^ ρ + Ctrail) / (Real.log 2) := ++ le_trans hcard_le_mass hmass_le_growth ++ exact le_trans htsum_le <| ++ mul_le_mul_of_nonneg_right hcard_le_growth (Real.rpow_nonneg (inv_nonneg.2 hrk0) τ) ++ have hpow_bound : ++ (1 + |2 * Rk|) ^ ρ ≤ (1 + 4 * r0) ^ ρ * ((2 : ℝ) ^ ρ) ^ k := by ++ simpa [Rk] using ++ Real.one_add_abs_two_mul_dyadicRadius_rpow_le (r0 := r0) (ρ := ρ) k hr0pos hρ ++ have hlog2pos : 0 < Real.log 2 := Real.log_pos (by norm_num : (1 : ℝ) < 2) ++ simpa [A, B, q, qσ, rk, Ctrail, mul_assoc, mul_left_comm, mul_comm] using ++ Real.dyadic_growth_mass_mul_inv_le_geometric ++ (C := Cgrow) (L := Real.log 2) (M := (1 + 4 * r0) ^ ρ) ++ (X := (1 + |2 * Rk|) ^ ρ) ++ (T := ∑' p : S, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ++ (Ctrail := Ctrail) (r0 := r0) (ρ := ρ) (τ := τ) (k := k) ++ hlog2pos hCgrow_pos.le hr0pos.le hpow_bound ++ (by simpa [rk] using htsum') ++ ++theorem summable_norm_inv_rpow_divisorZeroIndex₀_of_growth {f : ℂ → ℂ} {ρ τ : ℝ} ++ (hρ : 0 ≤ ρ) (hτ : ρ < τ) (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) := by ++ rcases hgrowth with ⟨Cgrow, hCgrow_pos, hCgrow⟩ ++ have hτpos : 0 < τ := lt_of_le_of_lt hρ hτ ++ rcases exists_r0_le_norm_divisorZeroIndex₀Val (f := f) hf hnot with ⟨r0, hr0pos, hr0⟩ ++ have hr0ne : (r0 : ℝ) ≠ 0 := ne_of_gt hr0pos ++ let kfun : divisorZeroIndex₀ f (Set.univ : Set ℂ) → ℕ := ++ fun p => ⌊Real.logb 2 (‖divisorZeroIndex₀Val p‖ / r0)⌋₊ ++ let S : ℕ → Set (divisorZeroIndex₀ f (Set.univ : Set ℂ)) := ++ fun k => {p | kfun p = k} ++ have hS : ∀ p : divisorZeroIndex₀ f (Set.univ : Set ℂ), ∃! k : ℕ, p ∈ S k := by ++ intro p ++ refine ⟨kfun p, ?_, ?_⟩ ++ · simp [S] ++ · intro k hk ++ simpa [S] using hk.symm ++ have hnonneg : 0 ≤ fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ := by ++ intro p ++ exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ ++ have hSk_summable : ∀ k : ℕ, Summable fun p : S k => ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by ++ intro k ++ have : Finite (S k) := by ++ simpa [S, kfun] using (finite_divisorZeroIndex₀_dyadicShell ++ (f := f) hr0pos hr0 k).to_subtype ++ exact Summable.of_finite ++ have hshell_summable : ++ Summable fun k : ℕ => ∑' p : S k, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by ++ let q : ℝ := (2 : ℝ) ^ (ρ - τ) ++ let qσ : ℝ := (2 : ℝ) ^ (-τ) ++ have hq_nonneg : 0 ≤ q := le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) ++ have hq_lt_one : q < 1 := ++ Real.rpow_lt_one_of_one_lt_of_neg (x := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) ++ (sub_neg.2 hτ) ++ have hqσ_nonneg : 0 ≤ qσ := le_of_lt (Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) _) ++ have hqσ_lt_one : qσ < 1 := ++ Real.rpow_lt_one_of_one_lt_of_neg (x := (2 : ℝ)) (by norm_num : (1 : ℝ) < 2) ++ (by simpa using (neg_neg_of_pos hτpos)) ++ have hgeom_q : Summable (fun k : ℕ => q ^ k) := ++ summable_geometric_of_lt_one hq_nonneg hq_lt_one ++ have hgeom_qσ : Summable (fun k : ℕ => qσ ^ k) := ++ summable_geometric_of_lt_one hqσ_nonneg hqσ_lt_one ++ let Ctrail : ℝ := |Real.log ‖meromorphicTrailingCoeffAt f 0‖| ++ let A : ℝ := ((Cgrow / Real.log 2) * (1 + 4 * r0) ^ ρ) * (r0⁻¹) ^ τ ++ let B : ℝ := ((Ctrail / Real.log 2) + 1) * (r0⁻¹) ^ τ ++ rcases Real.exists_nat_le_two_pow (1 / r0) with ⟨k0, hk0⟩ ++ let A0 : ℝ := A * q ^ k0 ++ let B0 : ℝ := B * qσ ^ k0 ++ have hmajor : Summable (fun k : ℕ => A0 * q ^ k + B0 * qσ ^ k) := ++ (hgeom_q.mul_left A0).add (hgeom_qσ.mul_left B0) ++ have hshell_summable_shift : ++ Summable fun k : ℕ => ∑' p : S (k + k0), ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by ++ refine hmajor.of_nonneg_of_le ++ (fun k => by ++ have : ∀ p : S (k + k0), 0 ≤ ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ := by ++ intro p; exact Real.rpow_nonneg (inv_nonneg.2 (norm_nonneg _)) _ ++ exact tsum_nonneg this) ++ (fun k => by ++ let kk : ℕ := k + k0 ++ let Rk : ℝ := r0 * (2 : ℝ) ^ ((kk : ℝ) + 1) ++ have hRk_ge_one : (1 : ℝ) ≤ Rk := by ++ have hkk : k0 ≤ kk + 1 := by ++ simp [kk, Nat.add_assoc, Nat.add_comm] ++ simpa [Rk] using ++ Real.one_le_dyadicRadius_succ_of_inv_le_two_pow hr0pos hk0 hkk ++ have hmain : ++ (∑' p : S kk, ‖divisorZeroIndex₀Val p.1‖⁻¹ ^ τ) ≤ A * q ^ kk + B * qσ ^ kk := by ++ simpa [S, kfun, Ctrail, A, B, q, qσ] using ++ tsum_divisorZeroIndex₀_dyadicShell_inv_rpow_le_geometric_of_growth ++ (f := f) (ρ := ρ) (τ := τ) hρ hτpos hf hCgrow_pos hCgrow hr0pos hr0 kk hRk_ge_one ++ have : A * q ^ kk + B * qσ ^ kk = A0 * q ^ k + B0 * qσ ^ k := by ++ simpa [A0, B0, kk] using Real.two_geometric_shift_add A B q qσ k k0 ++ simpa [kk] using (hmain.trans_eq this) ++ ) ++ exact (summable_nat_add_iff k0).1 hshell_summable_shift ++ have hpart := ++ (summable_partition (f := fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ τ) hnonneg (s := S) hS) ++ exact (hpart.2 ⟨hSk_summable, hshell_summable⟩) ++ ++theorem summable_norm_inv_pow_divisorZeroIndex₀_of_growth {f : ℂ → ℂ} {ρ : ℝ} ++ (hρ : 0 ≤ ρ) (hf : Differentiable ℂ f) (hnot : ∃ z : ℂ, f z ≠ 0) ++ (hgrowth : ∃ C > 0, ∀ z : ℂ, Real.log (1 + ‖f z‖) ≤ C * (1 + ‖z‖) ^ ρ) : ++ Summable (fun p : divisorZeroIndex₀ f (Set.univ : Set ℂ) => ++ ‖divisorZeroIndex₀Val p‖⁻¹ ^ (Nat.floor ρ + 1)) := by ++ have hτ : ρ < (Nat.floor ρ + 1 : ℝ) := by ++ simpa [Nat.cast_add, Nat.cast_one] using (Nat.lt_floor_add_one (a := ρ)) ++ have hs := ++ summable_norm_inv_rpow_divisorZeroIndex₀_of_growth (f := f) (ρ := ρ) ++ (τ := (Nat.floor ρ + 1 : ℝ)) hρ hτ hf hnot hgrowth ++ exact hs.congr fun p => by ++ have hcast : ((Nat.floor ρ : ℝ) + 1) = ((Nat.floor ρ + 1 : ℕ) : ℝ) := by ++ norm_num ++ rw [hcast, Real.rpow_natCast] ++ ++end Complex.Hadamard ++end ++end ++ ++end SiegelZeros +diff --git a/PrimeNumberTheoremAnd/SmoothExistence.lean b/PrimeNumberTheoremAnd/SmoothExistence.lean +index b33edf8..2513738 100644 +--- a/PrimeNumberTheoremAnd/SmoothExistence.lean ++++ b/PrimeNumberTheoremAnd/SmoothExistence.lean +@@ -1,20 +1,20 @@ +-import Architect +-import Batteries.Tactic.Lemma ++/- ++Adapted from PrimeNumberTheoremAnd by Alex Kontorovich and contributors. ++Licensed under the Apache License, Version 2.0; see the upstream LICENSE. ++This compatibility port retains the proven declarations used by this project. ++-/ + import Mathlib.Geometry.Manifold.PartitionOfUnity + import Mathlib.Tactic.Bound +-import PrimeNumberTheoremAnd.Mathlib.Algebra.Notation.Support +- +-set_option lang.lemmaCmd true + + open MeasureTheory Set Real + open scoped ContDiff + +-lemma smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : ++theorem smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : + ∃ Ψ : ℝ → ℝ, (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ + Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 ∧ + (Function.support Ψ = Set.Ioo a d) := by +- have := exists_contMDiff_zero_iff_one_iff_of_isClosed (n := ⊤) +- (modelWithCornersSelf ℝ ℝ) (s := Set.Iic a ∪ Set.Ici d) (t := Set.Icc b c) ++ have := exists_contDiff_zero_iff_one_iff_of_isClosed (n := ⊤) ++ (s := Set.Iic a ∪ Set.Ici d) (t := Set.Icc b c) + (IsClosed.union isClosed_Iic isClosed_Ici) isClosed_Icc + (by + simp_rw [Set.disjoint_union_left, Set.disjoint_iff, Set.subset_def, +@@ -25,7 +25,7 @@ lemma smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : + simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, Set.mem_Icc] at * + use Ψ + simp only [range_subset_iff, mem_Icc] at hΨrange +- refine ⟨ContMDiff.contDiff hΨSmooth, ?_, ?_, ?_, ?_⟩ ++ refine ⟨hΨSmooth, ?_, ?_, ?_, ?_⟩ + · apply HasCompactSupport.of_support_subset_isCompact (K := Set.Icc a d) isCompact_Icc + simp only [Function.support_subset_iff, ne_eq, mem_Icc, ← hΨ0, not_or] + bound +@@ -42,66 +42,3 @@ lemma smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : + simpa [-not_and, mem_Ioo, not_and_or, not_lt] using hx + · ext x + simp only [Function.mem_support, ne_eq, mem_Ioo, ← hΨ0, not_or, not_le] +- +-blueprint_comment /-- +-Let $\nu$ be a bumpfunction. +--/ +- +-@[blueprint +- (title := "SmoothExistence") +- (statement := /-- +- There exists a smooth (once differentiable would be enough), +- nonnegative ``bumpfunction'' $\nu$, +- supported in $[1/2,2]$ with total mass one: +- $$ +- \int_0^\infty \nu(x)\frac{dx}{x} = 1. +- $$ +- -/) +- (proof := /-- Same idea as Urysohn-type argument. -/)] +-lemma SmoothExistence : +- ∃ (ν : ℝ → ℝ), (ContDiff ℝ ∞ ν) ∧ (∀ x, 0 ≤ ν x) ∧ +- ν.support ⊆ Icc (1 / 2) 2 ∧ ∫ x in Ici 0, ν x / x = 1 := by +- suffices h : ∃ (ν : ℝ → ℝ), (ContDiff ℝ ∞ ν) ∧ (∀ x, 0 ≤ ν x) ∧ +- ν.support ⊆ Set.Icc (1 / 2) 2 ∧ 0 < ∫ x in Set.Ici 0, ν x / x by +- obtain ⟨ν, hν, hνnonneg, hνsupp, hνpos⟩ := h +- let c := (∫ x in Ici 0, ν x / x) +- use fun y ↦ ν y / c +- refine ⟨hν.div_const c, fun y ↦ div_nonneg (hνnonneg y) (le_of_lt hνpos), ?_, ?_⟩ +- · rw [Function.support_div, Function.support_const (ne_of_lt hνpos).symm, inter_univ] +- convert hνsupp +- · simp only [div_right_comm _ c _, integral_div c, div_self <| ne_of_gt hνpos, c] +- have := smooth_urysohn_support_Ioo (a := 1 / 2) (b := 1) (c := 3 / 2) (d := 2) +- (by linarith) (by linarith) +- obtain ⟨ν, hνContDiff, _, hν0, hν1, hνSupport⟩ := this +- use ν, hνContDiff +- unfold indicator at hν0 hν1 +- simp only [mem_Icc, Pi.one_apply, Pi.le_def, mem_Ioo] at hν0 hν1 +- simp only [hνSupport, subset_def, mem_Ioo, mem_Icc, and_imp] +- split_ands +- · exact fun x ↦ le_trans (by simp [apply_ite]) (hν0 x) +- · exact fun y hy hy' ↦ ⟨by linarith, by linarith⟩ +- · rw [integral_pos_iff_support_of_nonneg] +- · simp only [Function.support_div, measurableSet_Ici, Measure.restrict_apply', +- hνSupport, Function.support_id'] +- have : (Ioo (1 / 2 : ℝ) 2 ∩ {0}ᶜ ∩ Ici 0) = Ioo (1 / 2) 2 := by +- ext x +- simp only [one_div, mem_inter_iff, mem_Ioo, mem_compl_iff, mem_singleton_iff, mem_Ici] +- bound +- simp only [this, volume_Ioo, ENNReal.ofReal_pos, sub_pos, gt_iff_lt] +- linarith +- · simp_rw [Pi.le_def, Pi.zero_apply] +- intro y +- by_cases h : y ∈ Function.support ν +- · apply div_nonneg <| le_trans (by simp [apply_ite]) (hν0 y) +- rw [hνSupport, mem_Ioo] at h +- linarith [h.left] +- · simp only [Function.mem_support, ne_eq, not_not] at h +- simp [h] +- · have : (fun x ↦ ν x / x).support ⊆ Icc (1 / 2) 2 := by +- rw [Function.support_div, hνSupport] +- exact (inter_subset_left).trans Ioo_subset_Icc_self +- apply (integrableOn_iff_integrable_of_support_subset this).mp +- apply ContinuousOn.integrableOn_compact isCompact_Icc +- apply hνContDiff.continuous.continuousOn.div continuousOn_id ?_ +- simp only [mem_Icc, ne_eq, and_imp, id_eq] +- intros; linarith +diff --git a/PrimeNumberTheoremAnd/Sobolev.lean b/PrimeNumberTheoremAnd/Sobolev.lean +index 1f98bcb..c069633 100644 +--- a/PrimeNumberTheoremAnd/Sobolev.lean ++++ b/PrimeNumberTheoremAnd/Sobolev.lean +@@ -1,4 +1,10 @@ ++/- ++Adapted from PrimeNumberTheoremAnd by Alex Kontorovich and contributors. ++Licensed under the Apache License, Version 2.0; see the upstream LICENSE. ++This compatibility port retains the proven declarations used by this project. ++-/ + import Mathlib.Analysis.Calculus.Deriv.Support ++import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas + import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv + import Mathlib.Order.Filter.ZeroAndBoundedAtFilter + +@@ -7,16 +13,26 @@ open scoped ContDiff + + variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {n : ℕ} + +-@[ext] structure CS (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where ++structure CS (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where ++ + toFun : ℝ → E + h1 : ContDiff ℝ n toFun + h2 : HasCompactSupport toFun + ++@[ext] protected theorem CS.ext {n : ℕ} {E : Type*} ++ [NormedAddCommGroup E] [NormedSpace ℝ E] {x y : CS n E} ++ (h : x.toFun = y.toFun) : x = y := by ++ cases x ++ cases y ++ cases h ++ rfl ++ + structure trunc extends (CS 2 ℝ) where + h3 : (Set.Icc (-1) (1)).indicator 1 ≤ toFun + h4 : toFun ≤ Set.indicator (Set.Ioo (-2) (2)) 1 + + structure W1 (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where ++ + toFun : ℝ → E + smooth : ContDiff ℝ n toFun + integrable : ∀ ⦃k⦄, k ≤ n → Integrable (iteratedDeriv k toFun) +@@ -27,14 +43,10 @@ section lemmas + + noncomputable def funscale {E : Type*} (g : ℝ → E) (R x : ℝ) : E := g (R⁻¹ • x) + +-lemma contDiff_ofReal : ContDiff ℝ ∞ ofReal := by +- have key x : HasDerivAt ofReal 1 x := hasDerivAt_id x |>.ofReal_comp +- have key' : deriv ofReal = fun _ => 1 := by ext x ; exact (key x).deriv +- refine contDiff_infty_iff_deriv.mpr ⟨fun x => (key x).differentiableAt, ?_⟩ +- simpa [key'] using contDiff_const ++theorem contDiff_ofReal : ContDiff ℝ ∞ ofReal := Complex.ofRealCLM.contDiff + + omit [NormedSpace ℝ E] in +-lemma tendsto_funscale {f : ℝ → E} (hf : ContinuousAt f 0) (x : ℝ) : ++theorem tendsto_funscale {f : ℝ → E} (hf : ContinuousAt f 0) (x : ℝ) : + Tendsto (fun R => funscale f R x) atTop (𝓝 (f 0)) := + hf.tendsto.comp (by simpa using tendsto_inv_atTop_zero.mul_const x) + +@@ -52,31 +64,31 @@ instance : Coe (CS n ℝ) (CS n ℂ) where coe f := ⟨fun x => f x, + def neg (f : CS n E) : CS n E where + toFun := -f + h1 := f.h1.neg +- h2 := by simpa [HasCompactSupport, tsupport] using f.h2 ++ h2 := f.h2.neg + + instance : Neg (CS n E) where neg := neg + +-@[simp] lemma neg_apply {x : ℝ} : (-f) x = - (f x) := rfl ++@[simp] theorem neg_apply {x : ℝ} : (-f) x = - (f x) := rfl + + def smul (R : ℝ) (f : CS n E) : CS n E := ⟨R • f, f.h1.const_smul R, f.h2.smul_left⟩ + + instance : HSMul ℝ (CS n E) (CS n E) where hSMul := smul + +-@[simp] lemma smul_apply : (R • f) x = R • f x := rfl ++@[simp] theorem smul_apply : (R • f) x = R • f x := rfl + +-lemma continuous (f : CS n E) : Continuous f := f.h1.continuous ++theorem continuous (f : CS n E) : Continuous f := f.h1.continuous + + noncomputable def deriv (f : CS (n + 1) E) : CS n E where + toFun := _root_.deriv f + h1 := (contDiff_succ_iff_deriv.mp f.h1).2.2 + h2 := f.h2.deriv + +-lemma hasDerivAt (f : CS (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := ++theorem hasDerivAt (f : CS (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := + (f.h1.differentiable (by simp)).differentiableAt.hasDerivAt + +-lemma deriv_apply {f : CS (n + 1) E} {x : ℝ} : f.deriv x = _root_.deriv f x := rfl ++theorem deriv_apply {f : CS (n + 1) E} {x : ℝ} : f.deriv x = _root_.deriv f x := rfl + +-lemma deriv_smul {f : CS (n + 1) E} : (R • f).deriv = R • f.deriv := by ++theorem deriv_smul {f : CS (n + 1) E} : (R • f).deriv = R • f.deriv := by + ext x ; exact (f.hasDerivAt x |>.const_smul R).deriv + + noncomputable def scale (g : CS n E) (R : ℝ) : CS n E := by +@@ -86,27 +98,27 @@ noncomputable def scale (g : CS n E) (R : ℝ) : CS n E := by + · exact g.h1.comp (contDiff_const_smul R⁻¹) + · exact g.h2.comp_smul (inv_ne_zero h) + +-lemma deriv_scale {f : CS (n + 1) E} : (f.scale R).deriv = R⁻¹ • f.deriv.scale R := by ++theorem deriv_scale {f : CS (n + 1) E} : (f.scale R).deriv = R⁻¹ • f.deriv.scale R := by + ext v ; by_cases hR : R = 0 + · simp [hR, scale, deriv] + · simp only [scale, hR, ↓reduceDIte, smul_apply] + exact ((f.hasDerivAt (R⁻¹ • v)).scomp v +- (by simpa using! (hasDerivAt_id v).const_smul R⁻¹)).deriv ++ (by convert (hasDerivAt_const_mul (x := v) R⁻¹) using 1)).deriv + +-lemma deriv_scale' {f : CS (n + 1) E} : ++theorem deriv_scale' {f : CS (n + 1) E} : + (f.scale R).deriv v = R⁻¹ • f.deriv (R⁻¹ • v) := by + rw [deriv_scale, smul_apply] + by_cases hR : R = 0 <;> simp [hR, scale, funscale] + +-lemma hasDerivAt_scale (f : CS (n + 1) E) (R x : ℝ) : ++theorem hasDerivAt_scale (f : CS (n + 1) E) (R x : ℝ) : + HasDerivAt (f.scale R) (R⁻¹ • _root_.deriv f (R⁻¹ • x)) x := by + convert hasDerivAt (f.scale R) x ; rw [deriv_scale'] ; rfl + +-lemma tendsto_scale (f : CS n E) (x : ℝ) : Tendsto (fun R => f.scale R x) atTop (𝓝 (f 0)) := by ++theorem tendsto_scale (f : CS n E) (x : ℝ) : Tendsto (fun R => f.scale R x) atTop (𝓝 (f 0)) := by + apply (tendsto_funscale f.continuous.continuousAt x).congr' + filter_upwards [eventually_ne_atTop 0] with R hR ; simp [scale, hR] + +-lemma bounded : ∃ C, ∀ v, ‖f v‖ ≤ C := by ++theorem bounded : ∃ C, ∀ v, ‖f v‖ ≤ C := by + obtain ⟨x, hx⟩ := + (continuous_norm.comp f.continuous).exists_forall_ge_of_hasCompactSupport f.h2.norm + exact ⟨_, hx⟩ +@@ -119,16 +131,16 @@ instance : CoeFun trunc (fun _ => ℝ → ℝ) where coe f := f.toFun + + instance : Coe trunc (CS 2 ℝ) where coe := trunc.toCS + +-lemma nonneg (g : trunc) (x : ℝ) : 0 ≤ g x := (Set.indicator_nonneg (by simp) x).trans (g.h3 x) ++theorem nonneg (g : trunc) (x : ℝ) : 0 ≤ g x := (Set.indicator_nonneg (by simp) x).trans (g.h3 x) + +-lemma le_one (g : trunc) (x : ℝ) : g x ≤ 1 := ++theorem le_one (g : trunc) (x : ℝ) : g x ≤ 1 := + (g.h4 x).trans <| Set.indicator_le_self' (by simp) x + +-lemma zero (g : trunc) : g =ᶠ[𝓝 0] 1 := by ++theorem zero (g : trunc) : g =ᶠ[𝓝 0] 1 := by + have : Set.Icc (-1) 1 ∈ 𝓝 (0 : ℝ) := by apply Icc_mem_nhds <;> linarith + exact eventually_of_mem this (fun x hx => le_antisymm (g.le_one x) (by simpa [hx] using g.h3 x)) + +-@[simp] lemma zero_at {g : trunc} : g 0 = 1 := g.zero.eq_of_nhds ++@[simp] theorem zero_at {g : trunc} : g 0 = 1 := g.zero.eq_of_nhds + + end trunc + +@@ -136,23 +148,15 @@ namespace W1 + + instance : CoeFun (W1 n E) (fun _ => ℝ → E) where coe := W1.toFun + +-lemma continuous (f : W1 n E) : Continuous f := f.smooth.continuous ++theorem continuous (f : W1 n E) : Continuous f := f.smooth.continuous + +-lemma differentiable (f : W1 (n + 1) E) : Differentiable ℝ f := ++theorem differentiable (f : W1 (n + 1) E) : Differentiable ℝ f := + f.smooth.differentiable (by simp) + +-lemma iteratedDeriv_sub {f g : ℝ → E} (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : ++theorem iteratedDeriv_sub {f g : ℝ → E} (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : + iteratedDeriv n (f - g) = iteratedDeriv n f - iteratedDeriv n g := by +- induction n generalizing f g with +- | zero => rfl +- | succ n ih => +- have hf' : ContDiff ℝ n (deriv f) := hf.iterate_deriv' n 1 +- have hg' : ContDiff ℝ n (deriv g) := hg.iterate_deriv' n 1 +- have hfg : deriv (f - g) = deriv f - deriv g := by +- ext x ; apply deriv_sub +- · exact (hf.differentiable (by simp)).differentiableAt +- · exact (hg.differentiable (by simp)).differentiableAt +- simp_rw [iteratedDeriv_succ', ← ih hf' hg', hfg] ++ funext x ++ exact _root_.iteratedDeriv_sub hf.contDiffAt hg.contDiffAt + + noncomputable def deriv (f : W1 (n + 1) E) : W1 n E where + toFun := _root_.deriv f +@@ -160,7 +164,7 @@ noncomputable def deriv (f : W1 (n + 1) E) : W1 n E where + integrable k hk := by + simpa [iteratedDeriv_succ'] using f.integrable (Nat.succ_le_succ hk) + +-lemma hasDerivAt (f : W1 (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := ++theorem hasDerivAt (f : W1 (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := + f.differentiable.differentiableAt.hasDerivAt + + def sub (f g : W1 n E) : W1 n E where +@@ -173,12 +177,18 @@ def sub (f g : W1 n E) : W1 n E where + + instance : Sub (W1 n E) where sub := sub + +-lemma integrable_iteratedDeriv_Schwarz {f : 𝓢(ℝ, ℂ)} : Integrable (iteratedDeriv n f) := by ++theorem integrable_iteratedDeriv_Schwarz {f : 𝓢(ℝ, ℂ)} : Integrable (iteratedDeriv n f) := by + induction n generalizing f with + | zero => exact f.integrable +- | succ n ih => simpa [iteratedDeriv_succ'] using! ih (f := SchwartzMap.derivCLM ℝ ℂ f) +- +-noncomputable def of_Schwartz (f : 𝓢(ℝ, ℂ)) : W1 n ℂ where ++ | succ n ih => ++ rw [iteratedDeriv_succ'] ++ have hd : (SchwartzMap.derivCLM ℝ ℂ f : ℝ → ℂ) = _root_.deriv f := by ++ funext x ++ exact SchwartzMap.derivCLM_apply ℝ f x ++ rw [← hd] ++ exact ih (f := SchwartzMap.derivCLM ℝ ℂ f) ++ ++noncomputable def ofSchwartz (f : 𝓢(ℝ, ℂ)) : W1 n ℂ where + toFun := f + smooth := f.smooth n + integrable _ _ := integrable_iteratedDeriv_Schwarz +@@ -192,20 +202,29 @@ variable {f : W21} + noncomputable def norm (f : ℝ → ℂ) : ℝ := + (∫ v, ‖f v‖) + (4 * π ^ 2)⁻¹ * (∫ v, ‖deriv (deriv f) v‖) + +-lemma norm_nonneg {f : ℝ → ℂ} : 0 ≤ norm f := ++theorem norm_nonneg {f : ℝ → ℂ} : 0 ≤ norm f := + add_nonneg (integral_nonneg (fun t => by simp)) + (mul_nonneg (by positivity) (integral_nonneg (fun t => by simp))) + + noncomputable instance : Norm W21 where norm := norm ∘ W1.toFun + +-noncomputable instance : Coe 𝓢(ℝ, ℂ) W21 where coe := W1.of_Schwartz ++noncomputable instance : Coe 𝓢(ℝ, ℂ) W21 where coe := W1.ofSchwartz + + def ofCS2 (f : CS 2 ℂ) : W21 := by +- refine ⟨f, f.h1, fun k hk => ?_⟩ ; match k with +- | 0 => exact f.h1.continuous.integrable_of_hasCompactSupport f.h2 +- | 1 => simpa using (f.h1.continuous_deriv one_le_two).integrable_of_hasCompactSupport f.h2.deriv +- | 2 => simpa [iteratedDeriv_succ] using +- (f.h1.iterate_deriv' 0 2).continuous.integrable_of_hasCompactSupport f.h2.deriv.deriv ++ refine ⟨f, f.h1, ?_⟩ ++ intro k hk ++ cases k with ++ | zero => exact f.h1.continuous.integrable_of_hasCompactSupport f.h2 ++ | succ k => ++ cases k with ++ | zero => ++ simpa using (f.h1.continuous_deriv one_le_two).integrable_of_hasCompactSupport f.h2.deriv ++ | succ k => ++ have hk0 : k = 0 := ++ Nat.eq_zero_of_le_zero (Nat.le_of_succ_le_succ (Nat.le_of_succ_le_succ hk)) ++ subst k ++ simpa [iteratedDeriv_succ] using ++ (f.h1.iterate_deriv' 0 2).continuous.integrable_of_hasCompactSupport f.h2.deriv.deriv + + instance : Coe (CS 2 ℂ) W21 where coe := ofCS2 + +@@ -214,12 +233,12 @@ instance : HMul (CS 2 ℂ) W21 (CS 2 ℂ) where + + instance : HMul (CS 2 ℝ) W21 (CS 2 ℂ) where hMul g f := (g : CS 2 ℂ) * f + +-lemma hf (f : W21) : Integrable f := f.integrable zero_le_two ++theorem hf (f : W21) : Integrable f := f.integrable zero_le_two + +-lemma hf' (f : W21) : Integrable (deriv f) := by ++theorem hf' (f : W21) : Integrable (deriv f) := by + simpa [iteratedDeriv_succ] using f.integrable one_le_two + +-lemma hf'' (f : W21) : Integrable (deriv (deriv f)) := by ++theorem hf'' (f : W21) : Integrable (deriv (deriv f)) := by + simpa [iteratedDeriv_succ] using f.integrable le_rfl + + end W21 +@@ -227,7 +246,6 @@ end W21 + theorem W21_approximation (f : W21) (g : trunc) : + Tendsto (fun R => ‖f - (g.scale R * f : W21)‖) atTop (𝓝 0) := by + +- -- Definitions + let f' := f.deriv + let f'' := f'.deriv + let g' := (g : CS 2 ℝ).deriv +@@ -236,13 +254,12 @@ theorem W21_approximation (f : W21) (g : trunc) : + let h' R := - (g.scale R).deriv + let h'' R := - (g.scale R).deriv.deriv + +- -- Properties of h + have ch {R} : Continuous (fun v => (h R v : ℂ)) := + continuous_ofReal.comp <| continuous_const.sub (CS.continuous _) + have ch' {R} : Continuous (fun v => (h' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) + have ch'' {R} : Continuous (fun v => (h'' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) + have dh R v : HasDerivAt (h R) (h' R v) v := by +- convert! CS.hasDerivAt_scale (g : CS 2 ℝ) R v |>.const_sub 1 using 1 ++ convert CS.hasDerivAt_scale (g : CS 2 ℝ) R v |>.const_sub 1 using 1 + simp [h', CS.deriv_scale', show g.deriv.toFun = deriv g.toFun from rfl] + have dh' R v : HasDerivAt (h' R) (h'' R v) v := ((g.scale R).deriv.hasDerivAt v).neg + have hh1 R v : |h R v| ≤ 1 := by +@@ -254,12 +271,10 @@ theorem W21_approximation (f : W21) (g : trunc) : + have vR v : Tendsto (fun R : ℝ => v * R⁻¹) atTop (𝓝 0) := by + simpa using tendsto_inv_atTop_zero.const_mul v + +- -- Proof + convert_to Tendsto (fun R => W21.norm (fun v => h R v * f v)) atTop (𝓝 0) + · ext R ; change W21.norm _ = _ ; congr ; ext v ; simp [h, sub_mul] ; rfl + rw [show (0 : ℝ) = 0 + ((4 * π ^ 2)⁻¹ : ℝ) * 0 by simp] + refine Tendsto.add ?_ (Tendsto.const_mul _ ?_) +- + · let F R v := ‖h R v * f v‖ + have eh v : ∀ᶠ R in atTop, h R v = 0 := by + filter_upwards [(vR v).eventually g.zero, eventually_ne_atTop 0] with R hR hR' +@@ -275,7 +290,6 @@ theorem W21_approximation (f : W21) (g : trunc) : + apply Eventually.of_forall ; intro v + apply tendsto_nhds_of_eventually_eq ; filter_upwards [eh v] with R hR ; simp [F, hR] + simpa [F] using tendsto_integral_filter_of_dominated_convergence _ e1 e2 f.hf.norm e4 +- + · let F R v := ‖h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v‖ + convert_to Tendsto (fun R ↦ ∫ (v : ℝ), F R v) atTop (𝓝 0) + · have this R v : +@@ -291,9 +305,8 @@ theorem W21_approximation (f : W21) (g : trunc) : + (dh R v).ofReal_comp.mul (df' v) + have d1 : deriv (fun v => h R v * f v) = fun v => h' R v * f v + h R v * f' v := + funext (fun v => (l3 v).deriv) +- rw [d1] ; convert! (l5.add l7).deriv using 1 ; ring ++ rw [d1] ; convert (l5.add l7).deriv using 1 ; ring + simp_rw [this, F] +- + obtain ⟨c1, mg'⟩ := g'.bounded + obtain ⟨c2, mg''⟩ := g''.bounded + let bound v := c2 * ‖f v‖ + 2 * c1 * ‖f' v‖ + ‖f'' v‖ +@@ -338,8 +351,13 @@ theorem W21_approximation (f : W21) (g : trunc) : + (((f.hf.norm).const_mul _).add ((f.hf'.norm).const_mul _)).add f.hf''.norm + have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by + apply Eventually.of_forall ; intro v +- have evg' : g' =ᶠ[𝓝 0] 0 := by convert! ← g.zero.deriv ; exact deriv_const' _ +- have evg'' : g'' =ᶠ[𝓝 0] 0 := by convert! ← evg'.deriv ; exact deriv_const' _ ++ have evg' : (g' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) := by ++ have hzero : (g : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 1) := g.zero ++ change _root_.deriv (g : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) ++ simpa only [deriv_const'] using hzero.deriv ++ have evg'' : (g'' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) := by ++ change _root_.deriv (g' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) ++ simpa only [deriv_const'] using evg'.deriv + refine tendsto_norm_zero.comp <| (ZeroAtFilter.add ?_ ?_).add ?_ + · have eh'' v : ∀ᶠ R in atTop, h'' R v = 0 := by + filter_upwards [(vR v).eventually evg'', eventually_ne_atTop 0] with R hR hR' +@@ -355,5 +373,6 @@ theorem W21_approximation (f : W21) (g : trunc) : + simp [h', CS.deriv_scale', mul_comm R⁻¹, hR] + apply tendsto_nhds_of_eventually_eq + filter_upwards [eh' v] with R hR ; simp [hR] +- · simpa [h] using! ((g.tendsto_scale v).const_sub 1).ofReal.mul tendsto_const_nhds ++ · simpa [h, Filter.ZeroAtFilter] using ++ ((g.tendsto_scale v).const_sub 1).ofReal.mul tendsto_const_nhds + simpa [F] using tendsto_integral_filter_of_dominated_convergence bound e1 e2 e3 e4 +diff --git a/PrimeNumberTheoremAnd/Wiener.lean b/PrimeNumberTheoremAnd/Wiener.lean +index 59fd506..d69b893 100644 +--- a/PrimeNumberTheoremAnd/Wiener.lean ++++ b/PrimeNumberTheoremAnd/Wiener.lean +@@ -1,22 +1,18 @@ +-import Architect ++/- ++Adapted from PrimeNumberTheoremAnd by Alex Kontorovich and contributors. ++Licensed under the Apache License, Version 2.0; see the upstream LICENSE. ++This compatibility port retains the proven declarations used by this project. ++-/ + import Mathlib.Analysis.Fourier.RiemannLebesgueLemma + import Mathlib.Analysis.Normed.Group.Tannery + import Mathlib.Analysis.SumIntegralComparisons + import Mathlib.NumberTheory.Chebyshev + import Mathlib.NumberTheory.LSeries.PrimesInAP + import Mathlib.NumberTheory.MulChar.Lemmas +-import Mathlib.Topology.EMetricSpace.BoundedVariation +-import PrimeNumberTheoremAnd.Mathlib.Analysis.Asymptotics.Asymptotics + import PrimeNumberTheoremAnd.Fourier + import PrimeNumberTheoremAnd.SmoothExistence + import Mathlib.Analysis.Convolution +- +-set_option lang.lemmaCmd true +-set_option linter.style.header false +- +--- note: the opening of ArithmeticFunction introduces a notation σ that seems +--- impossible to hide, and hence parameters that are traditionally called σ will +--- have to be called σ' instead in this file. ++import Mathlib.MeasureTheory.Group.Circle + + open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries + Asymptotics SchwartzMap +@@ -28,31 +24,17 @@ open scoped ComplexConjugate + variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} + [RCLike 𝕜] + +-blueprint_comment /-- +-The Fourier transform of an absolutely integrable function $\psi: \R \to \C$ is defined by the +-formula $$ \hat \psi(u) := \int_\R e(-tu) \psi(t)\ dt$$ where $e(\theta) := e^{2\pi i \theta}$. +- +-Let $f: \N \to \C$ be an arithmetic function such that $\sum_{n=1}^\infty \frac{|f(n)|}{n^\sigma} < +-\infty$ for all $\sigma>1$. Then the Dirichlet series +-$$ F(s) := \sum_{n=1}^\infty \frac{f(n)}{n^s}$$ +-is absolutely convergent for $\sigma>1$. +--/ +- + noncomputable + def nterm (f : ℕ → ℂ) (σ' : ℝ) (n : ℕ) : ℝ := if n = 0 then 0 else ‖f n‖ / n ^ σ' + +-lemma nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by ++theorem nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by + by_cases h : n = 0 <;> simp [nterm, term, h] + + theorem norm_term_eq_nterm_re (s : ℂ) : + ‖term f s n‖ = nterm f (s.re) n := by +- simp only [nterm, term, apply_ite (‖·‖), norm_zero, norm_div] +- apply ite_congr rfl (fun _ ↦ rfl) +- intro h +- congr +- refine norm_natCast_cpow_of_pos (by omega) s ++ simpa only [nterm] using LSeries.norm_term_eq f s n + +-lemma hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : ++theorem hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : + ∑' i, (‖term f σ' i‖₊ : ENNReal) ≠ ⊤ := by + simp_rw [ENNReal.tsum_coe_ne_top_iff_summable_coe, ← norm_toNNReal] + norm_cast +@@ -60,25 +42,19 @@ lemma hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : + convert hf σ' hσ with i + simp [nterm_eq_norm_term] + +-instance instMeasurableSpace : MeasurableSpace Circle := +- inferInstanceAs <| MeasurableSpace <| Subtype _ +-instance instBorelSpace : BorelSpace Circle := +- inferInstanceAs <| BorelSpace <| Subtype (· ∈ Metric.sphere (0 : ℂ) 1) +- +--- TODO - add to mathlib + attribute [fun_prop] Real.continuous_fourierChar + +-lemma first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ ++theorem first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ + (‖fourierChar (-(u * ((1 : ℝ) / ((2 : ℝ) * π) * (n / x).log))) • ψ u‖ₑ : ENNReal) := by + fun_prop + +-lemma first_fourier_aux2a : ++theorem first_fourier_aux2a : + (2 : ℂ) * π * -(y * (1 / (2 * π) * Real.log ((n) / x))) = -(y * ((n) / x).log) := by + calc + _ = -(y * (((2 : ℂ) * π) / (2 * π) * Real.log ((n) / x))) := by ring + _ = _ := by rw [div_self (by norm_num), one_mul] + +-lemma first_fourier_aux2 (hx : 0 < x) (n : ℕ) : ++theorem first_fourier_aux2 (hx : 0 < x) (n : ℕ) : + term f σ' n * 𝐞 (-(y * (1 / (2 * π) * Real.log (n / x)))) • ψ y = + term f (σ' + y * I) n • (ψ y * x ^ (y * I)) := by + by_cases hn : n = 0 +@@ -106,31 +82,10 @@ lemma first_fourier_aux2 (hx : 0 < x) (n : ℕ) : + ring + _ = _ := by simp ; group + +-set_option backward.isDefEq.respectTransparency false in +-@[blueprint "first-fourier" +- (title := "first-fourier") +- (statement := /-- +- If $\psi: \R \to \C$ is integrable and $x > 0$, then for any $\sigma>1$ +- $$ \sum_{n=1}^\infty \frac{f(n)}{n^\sigma} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) = +- \int_\R F(\sigma + it) \psi(t) x^{it}\ dt.$$ +- -/) +- (proof := /-- +- By the definition of the Fourier transform, the left-hand side expands as +- $$ \sum_{n=1}^\infty \int_\R \frac{f(n)}{n^\sigma} \psi(t) e( - \frac{1}{2\pi} t \log +- \frac{n}{x})\ dt$$ +- while the right-hand side expands as +- $$ \int_\R \sum_{n=1}^\infty \frac{f(n)}{n^{\sigma+it}} \psi(t) x^{it}\ dt.$$ +- Since +- $$\frac{f(n)}{n^\sigma} \psi(t) e( - \frac{1}{2\pi} t \log \frac{n}{x}) = +- \frac{f(n)}{n^{\sigma+it}} \psi(t) x^{it}$$ +- the claim then follows from Fubini's theorem. +- -/) +- (latexEnv := "lemma")] +-lemma first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++theorem first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) + (hsupp : Integrable ψ) (hx : 0 < x) (hσ : 1 < σ') : + ∑' n : ℕ, term f σ' n * (𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))) = + ∫ t : ℝ, LSeries f (σ' + t * I) * ψ t * x ^ (t * I) := by +- + calc + _ = ∑' n, term f σ' n * ∫ (v : ℝ), 𝐞 (-(v * ((1 : ℝ) / + ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by +@@ -162,14 +117,12 @@ lemma first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) + rw [norm_term_eq_nterm_re] + simp + +- +- + @[continuity] +-lemma continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ ++theorem continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ + + attribute [fun_prop] measurable_coe_nnreal_ennreal + +-lemma second_fourier_integrable_aux1a (hσ : 1 < σ') : ++theorem second_fourier_integrable_aux1a (hσ : 1 < σ') : + IntegrableOn (fun (x : ℝ) ↦ cexp (-((x : ℂ) * ((σ' : ℂ) - 1)))) (Ici (-Real.log x)) := by + norm_cast + suffices IntegrableOn (fun (x : ℝ) ↦ (rexp (-(x * (σ' - 1))))) (Ici (-x.log)) _ from this.ofReal +@@ -178,18 +131,16 @@ lemma second_fourier_integrable_aux1a (hσ : 1 < σ') : + apply exp_neg_integrableOn_Ioi + linarith + +-lemma second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : ++theorem second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : + let ν : Measure (ℝ × ℝ) := (volume.restrict (Ici (-Real.log x))).prod volume + Integrable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • + (𝐞 (Multiplicative.ofAdd (-(a * (u / (2 * π))))) : ℂ) • ψ a) ν := by + intro ν + constructor + · apply Measurable.aestronglyMeasurable +- -- `Multiplicative.ofAdd x` is definitionally `x`; unfold it by `change` since `fun_prop` +- -- does not see through it. +- change Measurable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • +- (𝐞 (-(a * (u / (2 * π)))) : ℂ) • ψ a) +- simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, smul_eq_mul] ++ change Measurable (fun p : ℝ × ℝ => ++ (rexp (-p.1 * (σ' - 1)) : ℂ) * ++ ((fourierChar (-(p.2 * (p.1 / (2 * π)))) : ℂ) * ψ p.2)) + fun_prop + · let f1 : ℝ → ENNReal := fun a1 ↦ ‖cexp (-(↑a1 * (↑σ' - 1)))‖ₑ + let f2 : ℝ → ENNReal := fun a2 ↦ ‖ψ a2‖ₑ +@@ -198,14 +149,14 @@ lemma second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable + refine (lintegral_prod_mul ?_ ?_).trans_lt ?_ <;> try fun_prop + exact ENNReal.mul_lt_top (second_fourier_integrable_aux1a hσ).2 hsupp.2 + +-lemma second_fourier_integrable_aux2 (hσ : 1 < σ') : ++theorem second_fourier_integrable_aux2 (hσ : 1 < σ') : + IntegrableOn (fun (u : ℝ) ↦ cexp ((1 - ↑σ' - ↑t * I) * ↑u)) (Ioi (-Real.log x)) := by + refine (integrable_norm_iff (Measurable.aestronglyMeasurable <| by fun_prop)).mp ?_ + suffices IntegrableOn (fun a ↦ rexp (-(σ' - 1) * a)) (Ioi (-x.log)) _ by simpa [Complex.norm_exp] + apply exp_neg_integrableOn_Ioi + linarith + +-lemma second_fourier_aux (hx : 0 < x) : ++theorem second_fourier_aux (hx : 0 < x) : + -(cexp (-((1 - ↑σ' - ↑t * I) * ↑(Real.log x))) / (1 - ↑σ' - ↑t * I)) = + ↑(x ^ (σ' - 1)) * (↑σ' + ↑t * I - 1)⁻¹ * ↑x ^ (↑t * I) := by + calc +@@ -217,51 +168,24 @@ lemma second_fourier_aux (hx : 0 < x) : + rw [Complex.cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt hx))] + _ = _ := by rw [ofReal_cpow hx.le]; push_cast; ring + +-set_option backward.isDefEq.respectTransparency false in +-@[blueprint "second-fourier" +- (title := "second-fourier") +- (statement := /-- +- If $\psi: \R \to \C$ is absolutely integrable and $x > 0$, then for any $\sigma>1$ +- $$ \int_{-\log x}^\infty e^{-u(\sigma-1)} \hat \psi(\frac{u}{2\pi})\ du = +- x^{\sigma - 1} \int_\R \frac{1}{\sigma+it-1} \psi(t) x^{it}\ dt.$$ +- -/) +- (proof := /-- +- The left-hand side expands as +- $$ \int_{-\log x}^\infty \int_\R e^{-u(\sigma-1)} \psi(t) e(-\frac{tu}{2\pi})\ dt\ du$$ +- so by Fubini's theorem it suffices to verify the identity +- \begin{align*} +- \int_{-\log x}^\infty e^{-u(\sigma-1)} e(-\frac{tu}{2\pi})\ du +- &= \int_{-\log x}^\infty e^{(it - \sigma + 1)u}\ du \\ +- &= \frac{1}{it - \sigma + 1} e^{(it - \sigma + 1)u}\ \Big|_{-\log x}^\infty \\ +- &= x^{\sigma - 1} \frac{1}{\sigma+it-1} x^{it} +- \end{align*} +- -/) +- (latexEnv := "lemma")] +-lemma second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) ++theorem second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) + {x σ' : ℝ} (hx : 0 < x) (hσ : 1 < σ') : + ∫ u in Ici (-log x), Real.exp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = + (x^(σ' - 1) : ℝ) * ∫ t, (1 / (σ' + t * I - 1)) * ψ t * x^(t * I) ∂ volume := by +- + conv in ↑(rexp _) * _ => { rw [Real.fourier_real_eq, ← smul_eq_mul, ← integral_smul] } + rw [MeasureTheory.integral_integral_swap] + swap + · exact second_fourier_integrable_aux1 hcont hsupp hσ + rw [← integral_const_mul] + congr 1; ext t +- dsimp [Real.fourierChar, Circle.exp] +- +- simp_rw [mul_smul_comm, ← smul_mul_assoc, integral_mul_const] +- rw [fun (a b d : ℂ) ↦ show a * (b * (ψ t) * d) = (a * b * d) * ψ t by ring] ++ simp_rw [Circle.smul_def, smul_eq_mul, Real.fourierChar_apply, ++ ← mul_assoc, integral_mul_const] ++ rw [mul_right_comm _ (ψ t) _] + congr 1 +- conv => +- lhs +- enter [2] +- ext a +- rw [AddChar.coe_mk, Submonoid.mk_smul, smul_eq_mul] + push_cast + simp_rw [← Complex.exp_add] + have (u : ℝ) : +- 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I + -↑u * (↑σ' - 1) = (1 - σ' - t * I) * u := calc ++ -↑u * (↑σ' - 1) + 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I = (1 - σ' - t * I) * u := calc + _ = -↑u * (↑σ' - 1) + (2 * ↑π) / (2 * ↑π) * -(↑t * ↑u) * I := by ring + _ = -↑u * (↑σ' - 1) + 1 * -(↑t * ↑u) * I := by rw [div_self (by norm_num)] + _ = _ := by ring +@@ -285,107 +209,12 @@ lemma second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) + integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (second_fourier_integrable_aux2 hσ) hf] + simpa [f, f'] using second_fourier_aux hx + +-blueprint_comment /-- +-Now let $A \in \C$, and suppose that there is a continuous function $G(s)$ defined on +-$\mathrm{Re} s \geq 1$ such that $G(s) = F(s) - \frac{A}{s-1}$ whenever $\mathrm{Re} s > 1$. +-We also make the Chebyshev-type hypothesis +-\begin{equation}\label{cheby} +-\sum_{n \leq x} |f(n)| \ll x +-\end{equation} +-for all $x \geq 1$ (this hypothesis is not strictly necessary, but simplifies the arguments and +-can be obtained fairly easily in applications). +--/ ++theorem one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) + +-lemma one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) +- +-@[blueprint "prelim-decay" +- (title := "Preliminary decay bound I") +- (statement := /-- +- If $\psi:\R \to \C$ is absolutely integrable then $$ |\hat \psi(u)| \leq \| \psi \|_1 $$ +- for all $u \in \R$. where $C$ is an absolute constant. +- -/) +- (proof := /-- Immediate from the triangle inequality. -/) +- (latexEnv := "lemma") +- (discussion := 561)] + theorem prelim_decay (ψ : ℝ → ℂ) (u : ℝ) : ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ ∫ t, ‖ψ t‖ := + VectorFourier.norm_fourierIntegral_le_integral_norm .. + +-@[blueprint "prelim-decay-2" +- (title := "Preliminary decay bound II") +- (statement := /-- +-If $\psi:\R \to \C$ is absolutely integrable and of bounded variation, then +-$$ |\hat \psi(u)| \leq \| \psi \|_{TV} / 2\pi |u| $$ +-for all non-zero $u \in \R$. +- -/) +- (proof := /-- By Lebesgue--Stiejtes integration by parts we have +-$$ 2\pi i u \hat \psi(u) = \int _\R e(-tu) d\psi(t)$$ +-and the claim then follows from the triangle inequality. -/) +- (latexEnv := "lemma") +- (discussion := 562)] +-theorem prelim_decay_2 (ψ : ℝ → ℂ) (hψ : Integrable ψ) (hvar : BoundedVariationOn ψ Set.univ) +- (u : ℝ) (hu : u ≠ 0) : +- ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (eVariationOn ψ Set.univ).toReal / (2 * π * ‖u‖) := by sorry +- +-noncomputable def AbsolutelyContinuous (f : ℝ → ℂ) : Prop := (∀ᵐ x, DifferentiableAt ℝ f x) ∧ +- ∀ a b : ℝ, f b - f a = ∫ t in a..b, deriv f t +- +-@[blueprint "prelim-decay-3" +- (title := "Preliminary decay bound III") +- (statement := /-- +-If $\psi:\R \to \C$ is absolutely integrable, absolutely continuous, and $\psi'$ is of bounded +-variation, then +-$$ |\hat \psi(u)| \leq \| \psi' \|_{TV} / (2\pi |u|)^2$$ +-for all non-zero $u \in \R$. +- -/) +- (proof := /-- Should follow from previous lemma. -/) +- (proofUses := ["prelim-decay-2"]) +- (latexEnv := "lemma") +- (discussion := 563)] +-theorem prelim_decay_3 (ψ : ℝ → ℂ) (hψ : Integrable ψ) +- (habscont : AbsolutelyContinuous ψ) +- (hvar : BoundedVariationOn (deriv ψ) Set.univ) (u : ℝ) (hu : u ≠ 0) : +- ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π * ‖u‖) ^ 2 := by sorry +- +-@[blueprint "decay-alt" +- (title := "Decay bound, alternate form") +- (statement := /-- +-If $\psi:\R \to \C$ is absolutely +-integrable, absolutely continuous, and $\psi'$ is of bounded variation, then +-$$ |\hat \psi(u)| \leq ( \|\psi\|_1 + \| \psi' \|_{TV} / (2\pi)^2) / (1+|u|^2)$$ +-for all $u \in \R$. -/) +- (proof := /-- Should follow from previous lemmas. -/) +- (proofUses := ["prelim-decay", "prelim-decay-3", "decay"]) +- (latexEnv := "lemma") +- (discussion := 564)] +-theorem decay_alt (ψ : ℝ → ℂ) (hψ : Integrable ψ) (habscont : AbsolutelyContinuous ψ) +- (hvar : BoundedVariationOn (deriv ψ) Set.univ) (u : ℝ) : +- ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ +- ((∫ t, ‖ψ t‖) + (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π) ^ 2) / +- (1 + ‖u‖ ^ 2) := by +- rw [le_div_iff₀' <| one_add_sq_pos ‖u‖] +- by_cases hu : u = 0 +- · subst hu +- simp only [norm_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, add_zero, +- one_mul] +- calc ‖𝓕 ψ 0‖ ≤ ∫ t, ‖ψ t‖ := prelim_decay ψ 0 +- _ ≤ (∫ t, ‖ψ t‖) + (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π) ^ 2 := by +- have : 0 ≤ (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π) ^ 2 := by positivity +- linarith +- · have bound1 : ‖𝓕 ψ u‖ ≤ ∫ t, ‖ψ t‖ := prelim_decay ψ u +- have bound2 : ‖𝓕 ψ u‖ ≤ (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π * ‖u‖) ^ 2 := +- prelim_decay_3 ψ hψ habscont hvar u hu +- have : (2 * π * ‖u‖) ^ 2 = (2 * π) ^ 2 * ‖u‖ ^ 2 := by ring +- calc (1 + ‖u‖ ^ 2) * ‖𝓕 ψ u‖ +- = ‖𝓕 ψ u‖ * 1 + ‖𝓕 ψ u‖ * ‖u‖ ^ 2 := by ring +- _ ≤ (∫ t, ‖ψ t‖) * 1 + +- (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π * ‖u‖) ^ 2 * ‖u‖ ^ 2 := by +- gcongr +- _ = (∫ t, ‖ψ t‖) + (eVariationOn (deriv ψ) Set.univ).toReal / (2 * π) ^ 2 := by +- rw [mul_one, this, div_mul_eq_div_div] +- congr 1 +- rw [div_mul_eq_mul_div, div_eq_iff (pow_ne_zero 2 <| norm_ne_zero_iff.mpr hu)] +- +-lemma decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by ++theorem decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by + have l1 : 0 < 1 + u ^ 2 := one_add_sq_pos _ + have l2 : 1 + u ^ 2 = ‖(1 : ℂ) + u ^ 2‖ := by + norm_cast ; simp only [Real.norm_eq_abs, abs_eq_self.2 l1.le] +@@ -399,7 +228,7 @@ lemma decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ + rw [norm_neg, F_mul, norm_mul, W21.norm] + gcongr <;> apply VectorFourier.norm_fourierIntegral_le_integral_norm + +-lemma decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) ++theorem decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) + (h : ∀ t, ‖f t‖ ≤ A * (1 + t ^ 2)⁻¹) : + ∫ t, ‖f t‖ ≤ π * A := by + have l1 : Integrable (fun x ↦ A * (1 + x ^ 2)⁻¹) := integrable_inv_one_add_sq.const_mul A +@@ -420,29 +249,12 @@ theorem decay_bounds_W21 (f : W21) (hA : ∀ t, ‖f t‖ ≤ A / (1 + t ^ 2)) + change W21.norm _ * _ ≤ _ + simp_rw [W21.norm, div_eq_mul_inv, add_mul, l0] ; gcongr + +-@[blueprint +- "decay" +- (title := "Decay bounds") +- (statement := /-- +- If $\psi:\R \to \C$ is $C^2$ and obeys the bounds +- $$ |\psi(t)|, |\psi''(t)| \leq A / (1 + |t|^2)$$ +- for all $t \in \R$, then +- $$ |\hat \psi(u)| \leq C A / (1+|u|^2)$$ +- for all $u \in \R$, where $C$ is an absolute constant. +- -/) +- (proof := /-- +- From two integration by parts we obtain the identity +- $$ (1+u^2) \hat \psi(u) = \int_{\bf R} (\psi(t) - \frac{u}{4\pi^2} \psi''(t)) e(-tu)\ dt.$$ +- Now apply the triangle inequality and the identity $\int_{\bf R} \frac{dt}{1+t^2}\ dt = \pi$ to +- obtain the claim with $C = \pi + 1 / 4 \pi$. +- -/) +- (latexEnv := "lemma")] +-lemma decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) ++theorem decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) + (hA' : ∀ t, ‖deriv^[2] ψ t‖ ≤ A / (1 + t ^ 2)) : + ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by + exact decay_bounds_W21 ψ hA hA' u + +-lemma decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by ++theorem decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by + have l1 : HasCompactSupport (fun u : ℝ => ((1 + u ^ 2) : ℝ) * ψ u) := by exact ψ.h2.mul_left + have := ψ.h1.continuous + obtain ⟨C, hC⟩ := l1.exists_bound_of_continuous (by fun_prop) +@@ -451,48 +263,37 @@ lemma decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ + simp only [norm_mul, Complex.norm_real, norm_of_nonneg (one_add_sq_pos u).le] at hC + rwa [le_div_iff₀' (one_add_sq_pos _)] + +-lemma decay_bounds_cor (ψ : W21) : ++theorem decay_bounds_cor (ψ : W21) : + ∃ C : ℝ, ∀ u, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by + simpa only [div_eq_mul_inv] using ⟨_, decay_bounds_key ψ⟩ + +-set_option backward.isDefEq.respectTransparency false in +-@[continuity, fun_prop] lemma continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := ++@[continuity, fun_prop] theorem continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := + VectorFourier.fourierIntegral_continuous continuous_fourierChar + (by simp only [innerₗ_apply_apply, RCLike.inner_apply', conj_trivial, continuous_mul]) + ψ.hf + +-lemma W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : ++theorem W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : + Integrable fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c) := by + have l1 (C) : Integrable (fun u ↦ C / (1 + (u / c) ^ 2)) volume := by +- simpa using! (integrable_inv_one_add_sq.comp_div hc).const_mul C ++ simpa only [div_eq_mul_inv] using (integrable_inv_one_add_sq.comp_div hc).const_mul C + have l2 : AEStronglyMeasurable (fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c)) volume := by + apply Continuous.aestronglyMeasurable ; fun_prop + obtain ⟨C, h⟩ := decay_bounds_cor ψ + apply @Integrable.mono' ℝ ℂ _ volume _ _ (fun u => C / (1 + (u / c) ^ 2)) (l1 C) l2 ?_ + apply Eventually.of_forall (fun x => h _) + +- +- +- +- +-lemma continuous_LSeries_aux (hf : Summable (nterm f σ')) : ++theorem continuous_LSeries_aux (hf : Summable (nterm f σ')) : + Continuous fun x : ℝ => LSeries f (σ' + x * I) := by +- + have l1 i : Continuous fun x : ℝ ↦ term f (σ' + x * I) i := by + by_cases h : i = 0 + · simpa [h] using continuous_const +- · simpa [h] using! continuous_const.div (continuous_const.cpow (by fun_prop) (by simp [h])) ++ · simpa [h] using continuous_const.div₀ (continuous_const.cpow (by fun_prop) (by simp [h])) + (fun x => by simp [h]) + have l2 n (x : ℝ) : ‖term f (σ' + x * I) n‖ = nterm f σ' n := by +- by_cases h : n = 0 +- · simp [h, nterm] +- · simp [h, nterm, cpow_add _ _ (Nat.cast_ne_zero.mpr h), +- Complex.norm_natCast_cpow_of_pos (Nat.pos_of_ne_zero h)] ++ simpa using norm_term_eq_nterm_re (f := f) (n := n) (σ' + x * I) + exact continuous_tsum l1 hf (fun n x => le_of_eq (l2 n x)) + +--- Here compact support is used but perhaps it is not necessary +-set_option backward.isDefEq.respectTransparency false in +-lemma limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++theorem limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) + (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) (σ' : ℝ) + (hσ' : 1 < σ') : + ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - +@@ -519,7 +320,6 @@ lemma limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1 + (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by + apply l7.integrable_of_hasCompactSupport + exact ψ.h2.mul_left.mul_right.mul_left.mul_left +- + simp_rw [l1 σ' hσ', l2 σ' hσ', ← integral_const_mul, ← integral_sub l4 l5] + apply integral_congr_ae + apply Eventually.of_forall +@@ -541,61 +341,60 @@ def cumsum [AddCommMonoid E] (u : ℕ → E) (n : ℕ) : E := ∑ i ∈ Finset.r + + def nabla [Sub E] (u : α → E) (n : α) : E := u (n + 1) - u n + +-/- `nnabla` is the backward difference `u n - u (n+1)`; kept alongside `nabla` +- for summation-by-parts identities that prefer that orientation. -/ + def nnabla [Sub E] (u : α → E) (n : α) : E := u n - u (n + 1) + + def shift (u : α → E) (n : α) : E := u (n + 1) + +-@[simp] lemma cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] ++@[simp] theorem cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] + +-lemma cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : ++theorem cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : + cumsum u (n + 1) = cumsum u n + u n := by + simp [cumsum, Finset.sum_range_succ] + +-@[simp] lemma nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by ++@[simp] theorem nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by + ext n ; simp [nabla, cumsum, Finset.range_add_one] + +-lemma neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := ++theorem neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := + funext (fun n => by simp [cumsum]) + +-lemma cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := ++theorem cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := + fun _ => Finset.sum_nonneg (fun i _ => hu i) + + omit [Sub α] in +-lemma neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] ++theorem neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] + + omit [Sub α] in +-@[simp] lemma nabla_mul [Ring E] {u : α → E} {c : E} : nabla (fun n => c * u n) = c • nabla u := by ++@[simp] theorem nabla_mul [Ring E] {u : α → E} {c : E} : ++ nabla (fun n => c * u n) = c • nabla u := by + ext n ; simp [nabla, mul_sub] + + omit [Sub α] in +-@[simp] lemma nnabla_mul [Ring E] {u : α → E} {c : E} : ++@[simp] theorem nnabla_mul [Ring E] {u : α → E} {c : E} : + nnabla (fun n => c * u n) = c • nnabla u := by + ext n ; simp [nnabla, mul_sub] + +-lemma nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by ++theorem nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by + ext n ; simp [nnabla] + + end nabla + +-lemma Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : ++theorem Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : + cumsum u (n + 1) = u 0 + cumsum (shift u) n := by + simp_rw [add_comm n, cumsum, sum_range_add, sum_range_one, add_comm 1] ; rfl + +-lemma Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : ++theorem Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : + shift (cumsum u) = (fun _ => u 0) + cumsum (shift u) := by + ext n ; apply Finset.sum_shift_front + +-lemma Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : ++theorem Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : + cumsum u (n + 1) = cumsum u n + u n := by + simp [cumsum, Finset.range_add_one, add_comm] + +-lemma Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : ++theorem Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : + shift (cumsum u) = cumsum u + u := by + ext n ; apply Finset.sum_shift_back + +-lemma summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : ++theorem summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : + cumsum (a * b) (n + 1) = A (n + 1) * b n - A 0 * b 0 - + cumsum (shift A * fun i => (b (i + 1) - b i)) n := by + have l1 : ∑ x ∈ Finset.range (n + 1), A (x + 1) * b x = ∑ x ∈ Finset.range n, +@@ -608,31 +407,33 @@ lemma summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabl + mul_sub] + abel + +-lemma summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : ++theorem summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : + cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - cumsum (shift (cumsum a) * nabla b) n := by +- simpa using! summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) ++ change cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - ++ cumsum (shift (cumsum a) * (fun i : ℕ => b (i + 1) - b i)) n ++ simpa using summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) + +-lemma summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : ++theorem summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : + shift (cumsum (a * b)) = shift (cumsum a) * b - cumsum (shift (cumsum a) * nabla b) := by + ext n ; apply summation_by_parts' + +-lemma summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : ++theorem summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : + Summable u ↔ BoundedAtFilter atTop (cumsum u) := by + have l1 : (cumsum u =O[atTop] 1) ↔ _ := isBigO_one_nat_atTop_iff + have l2 n : ‖cumsum u n‖ = cumsum u n := by simpa using cumsum_nonneg hu n + simp only [BoundedAtFilter, l1, l2] +- constructor <;> intro ⟨C, h1⟩ ++ constructor <;> intro h <;> rcases h with ⟨C, h1⟩ + · exact ⟨C, fun n => sum_le_hasSum _ (fun i _ => hu i) h1⟩ + · exact summable_of_sum_range_le hu h1 + +-lemma Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : ++theorem Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : + Summable u := + summable_of_isBigO_nat hu h.isBigO + +-lemma summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by ++theorem summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by + constructor <;> intro h <;> simp [huv.summable, huv.symm.summable, h] + +-lemma BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : ++theorem BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : + BoundedAtFilter atTop (fun n => u n + c) ↔ BoundedAtFilter atTop u := by + have : u = fun n => (u n + c) + (-c) := by ext n ; ring + simp only [BoundedAtFilter] +@@ -640,17 +441,17 @@ lemma BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : + on_goal 1 => rw [this] + all_goals { exact h.add (const_boundedAtFilter _ _) } + +-lemma BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : ++theorem BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : + BoundedAtFilter atTop (fun n => u (n + N)) ↔ BoundedAtFilter atTop u := by +- simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, +- eventually_atTop] +- constructor <;> intro ⟨C, n₀, h⟩ <;> use C ++ simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, one_mem, ++ CStarRing.norm_of_mem_unitary, mul_one, eventually_atTop] ++ constructor <;> intro hbound <;> rcases hbound with ⟨C, n₀, h⟩ <;> use C + · refine ⟨n₀ + N, fun n hn => ?_⟩ + obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' (m := N) (n := n) (by grind) + exact h _ <| Nat.add_le_add_iff_right.mp hn + · exact ⟨n₀, fun n hn => h _ (by grind)⟩ + +-lemma summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : ++theorem summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : + Summable u ↔ BoundedAtFilter atTop (cumsum u) := by + obtain ⟨N, hu⟩ := eventually_atTop.mp hu + have e2 : cumsum (fun i ↦ u (i + N)) = fun n => cumsum u (n + N) - cumsum u N := by +@@ -658,7 +459,7 @@ lemma summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n + rw [← summable_nat_add_iff N, summable_iff_bounded (fun n => hu _ <| Nat.le_add_left N n), e2] + simp_rw [sub_eq_add_neg, BoundedAtFilter.add_const, BoundedAtFilter.comp_add] + +-lemma bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : ++theorem bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : + BoundedAtFilter atTop u := by + simp only [BoundedAtFilter, isBigO_iff, eventually_atTop] at h ⊢ + obtain ⟨C, N, hC⟩ := h +@@ -668,24 +469,26 @@ lemma bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : + have r2 : n - 1 + 1 = n := Nat.sub_add_cancel (by omega) + simpa [r2] using hC (n - 1) r1 + +-lemma dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) ++theorem dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) + (hAb : BoundedAtFilter atTop (shift (cumsum a) * b)) (hbb : ∀ᶠ n in atTop, b (n + 1) ≤ b n) + (h : Summable (shift (cumsum a) * nnabla b)) : Summable (a * b) := by + have l1 : ∀ᶠ n in atTop, 0 ≤ (shift (cumsum a) * nnabla b) n := by + filter_upwards [hbb] with n hb +- exact mul_nonneg (by simpa [shift] using! Finset.sum_nonneg (fun n _ ↦ ha n)) (sub_nonneg.mpr hb) ++ exact mul_nonneg (by simpa [shift] using cumsum_nonneg ha (n + 1)) (sub_nonneg.mpr hb) + rw [summable_iff_bounded (mul_nonneg ha hb)] + rw [summable_iff_bounded' l1] at h + apply bounded_of_shift + simpa only [summation_by_parts'', sub_eq_add_neg, neg_cumsum, ← mul_neg, neg_nabla] + using hAb.add h + +-lemma exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : ++theorem exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : + ∃ v : ℕ → ℝ, range v ⊆ range u ∧ Antitone v ∧ v =ᶠ[atTop] u := by + obtain ⟨N, hN⟩ := eventually_atTop.mp hu + let v (n : ℕ) := u (if n < N then N else n) + refine ⟨v, ?_, ?_, ?_⟩ +- · exact fun x ⟨n, hn⟩ => ⟨if n < N then N else n, hn⟩ ++ · intro x hx ++ rcases hx with ⟨n, hn⟩ ++ exact ⟨if n < N then N else n, hn⟩ + · refine antitone_nat_of_succ_le (fun n => ?_) + by_cases h : n < N + · by_cases h' : n + 1 < N <;> simp [v, h, h'] +@@ -696,7 +499,7 @@ lemma exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u + · have : ∀ᶠ n in atTop, ¬(n < N) := by simpa using ⟨N, fun b hb => by linarith⟩ + filter_upwards [this] with n hn ; simp [v, hn] + +-lemma summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by ++theorem summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by + let u (n : ℕ) := (n * (Real.log n) ^ 2)⁻¹ + have l7 : ∀ᶠ n : ℕ in atTop, 1 ≤ Real.log n := + tendsto_atTop.mp (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) 1 +@@ -715,26 +518,26 @@ lemma summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2) + simp only [l5, mul_inv_rev, Nat.cast_pow, Nat.cast_ofNat, log_pow, u] + field_simp + +-lemma tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : ++theorem tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : + Tendsto (fun x => a * x + b) atTop atTop := + tendsto_atTop_add_const_right _ b (tendsto_id.const_mul_atTop ha) + +-lemma isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} ++theorem isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} + (hf : Tendsto f atTop atTop) : (fun _ => a) =o[atTop] f := by + simp [tendsto_norm_atTop_atTop.comp hf] + +-lemma isBigO_pow_pow_of_le {m n : ℕ} (h : m ≤ n) : ++theorem isBigO_pow_pow_of_le {m n : ℕ} (h : m ≤ n) : + (fun x : ℝ => x ^ m) =O[atTop] (fun x : ℝ => x ^ n) := by + apply IsBigO.of_bound 1 + filter_upwards [eventually_ge_atTop 1] with x l1 + simpa [abs_eq_self.mpr (zero_le_one.trans l1)] using pow_le_pow_right₀ l1 h + +-lemma isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by ++theorem isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by + apply IsLittleO.add + · apply IsLittleO.const_mul_left ; simpa using isLittleO_pow_pow_atTop_of_lt (𝕜 := ℝ) one_lt_two + · apply isLittleO_const_of_tendsto_atTop _ <| tendsto_pow_atTop (by linarith) + +-lemma log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : ++theorem log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : + (fun x => Real.log (a * x + b)) =O[atTop] Real.log := by + apply IsBigO.of_bound (2 : ℕ) + have l2 : ∀ᶠ x : ℝ in atTop, 0 ≤ log x := tendsto_atTop.mp tendsto_log_atTop 0 +@@ -748,21 +551,22 @@ lemma log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : + simpa [abs_eq_self.mpr l2, abs_eq_self.mpr l3, Real.log_pow] using + Real.log_le_log (by linarith) l1 + +-lemma isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : ++theorem isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : + Real.log =O[atTop] (fun x => Real.log (a * x + b)) := by +- convert! (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto ++ convert (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto + (tendsto_mul_add_atTop (b := b) ha) using 1 +- ext x +- simp only [Function.comp_apply] +- congr +- field_simp +- simp ++ · ext x ++ simp only [Function.comp_apply] ++ congr ++ field_simp ++ simp ++ · rfl + +-lemma log_isbigo_log_div {d : ℝ} (hb : 0 < d) : ++theorem log_isbigo_log_div {d : ℝ} (hb : 0 < d) : + (fun n ↦ Real.log n) =O[atTop] (fun n ↦ Real.log (n / d)) := by + convert isBigO_log_mul_add (inv_pos.mpr hb) 0 using 1; simp only [add_zero]; field_simp + +-lemma Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : ++theorem Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : + f =O[atTop] (f + g) := by + rw [isLittleO_iff] at h ; specialize h (c := 2⁻¹) (by norm_num) + rw [isBigO_iff''] +@@ -774,11 +578,11 @@ lemma Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop + _ ≤ |(|f x| - |g x|)| := le_abs_self _ + _ ≤ _ := by rw [← sub_neg_eq_add, ← abs_neg (g x)] ; exact abs_abs_sub_abs_le (f x) (-g x) + +-lemma Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : +- (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := by +- simpa [pow_two] using h.mul h ++theorem Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : ++ (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := ++ h.pow 2 + +-lemma log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : ++theorem log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : + (fun x ↦ Real.log x ^ 2) =O[atTop] (fun x ↦ a + Real.log (x / b) ^ 2) := by + apply (log_isbigo_log_div hb).sq.trans ; simp_rw [add_comm a] + refine IsBigO.add_isLittleO_right <| isLittleO_const_of_tendsto_atTop _ ?_ +@@ -789,9 +593,13 @@ theorem log_add_div_isBigO_log (a : ℝ) {b : ℝ} (hb : 0 < b) : + (fun x ↦ Real.log ((x + a) / b)) =O[atTop] fun x ↦ Real.log x := by + convert log_mul_add_isBigO_log (inv_pos.mpr hb) (a / b) using 3 ; ring + +-lemma log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by ++theorem log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by + have l1 : ContinuousOn Real.log (Icc x (x + 1)) := by +- apply continuousOn_log.mono ; intro t ⟨h1, _⟩ ; simp ; linarith ++ apply continuousOn_log.mono ++ intro t ht ++ have h1 := ht.1 ++ simp ++ linarith + have l2 t (ht : t ∈ Ioo x (x + 1)) : HasDerivAt Real.log t⁻¹ t := + Real.hasDerivAt_log (by linarith [ht.1]) + obtain ⟨t, ⟨ht1, _⟩, htx⟩ := exists_hasDerivAt_eq_slope Real.log (·⁻¹) (by linarith) l1 l2 +@@ -799,22 +607,21 @@ lemma log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻ + rw [nabla, ← htx, inv_le_inv₀ (by linarith) hx] + exact ht1.le + +-lemma nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by ++theorem nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by + apply IsBigO.of_bound 1 + filter_upwards [eventually_gt_atTop 0] with x l1 + have l2 : log x ≤ log (x + 1) := log_le_log l1 (by linarith) + simpa [nabla, abs_eq_self.mpr l1.le, abs_eq_self.mpr (sub_nonneg.mpr l2)] using + log_add_one_sub_log_le l1 + +-lemma nabla_log {b : ℝ} (hb : 0 < b) : ++theorem nabla_log {b : ℝ} (hb : 0 < b) : + nabla (fun x => Real.log (x / b)) =O[atTop] (fun x => 1 / x) := by + refine EventuallyEq.trans_isBigO ?_ nabla_log_main + filter_upwards [eventually_gt_atTop 0] with x l2 + rw [nabla, log_div (by linarith) (by linarith), log_div l2.ne.symm (by linarith), nabla] ; ring + +-lemma nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : ++theorem nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : + nabla (fun x => x * (a + Real.log (x / b) ^ 2)) =O[atTop] (fun x => Real.log x ^ 2) := by +- + have l1 : nabla (fun n => n * (a + Real.log (n / b) ^ 2)) = fun n => + a + Real.log ((n + 1) / b) ^ 2 + + (n * (Real.log ((n + 1) / b) ^ 2 - Real.log (n / b) ^ 2)) := by +@@ -828,25 +635,24 @@ lemma nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : + filter_upwards [eventually_ge_atTop 1] with x hx using by field_simp + have l5 : (fun n ↦ n * (Real.log n * (1 / n))) =O[atTop] (fun n ↦ (Real.log n) ^ 2) := + e2.trans_isBigO +- (by simpa using! (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) +- ++ (by simpa [Function.comp_def] using ++ (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) + simp_rw [l1, _root_.sq_sub_sq] + exact ((l2.add l3).add (isBigO_refl (·) atTop |>.mul (l4.mul (nabla_log hb)) |>.trans l5)) + +-lemma nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : ++theorem nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : + Tendsto (fun x => x * (a + Real.log (x / b) ^ 2)) atTop atTop := + tendsto_id.atTop_mul_atTop₀ <| tendsto_atTop_add_const_left _ _ <| + (tendsto_pow_atTop two_ne_zero).comp <| tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb + +-lemma nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : ++theorem nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : + ∀ᶠ x in atTop, 0 < x * (a + Real.log (x / b) ^ 2) := + (nnabla_bound_aux1 a hb).eventually (eventually_gt_atTop 0) + +-lemma Real.log_eventually_gt_atTop (a : ℝ) : ++theorem Real.log_eventually_gt_atTop (a : ℝ) : + ∀ᶠ x in atTop, a < Real.log x := + Real.tendsto_log_atTop.eventually (eventually_gt_atTop a) + +-/-- Should this be a gcongr lemma? -/ + @[local gcongr] + theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : + ‖x‖ ≤ ‖y‖ := by +@@ -854,13 +660,11 @@ theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : + apply abs_le_abs hxy + linarith + +-lemma nnabla_bound_aux {x : ℝ} (hx : 0 < x) : ++theorem nnabla_bound_aux {x : ℝ} (hx : 0 < x) : + nnabla (fun n ↦ 1 / (n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2))) =O[atTop] + (fun n ↦ 1 / (Real.log n ^ 2 * n ^ 2)) := by +- + let d n : ℝ := n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2) + change (fun x_1 ↦ nnabla (fun n ↦ 1 / d n) x_1) =O[atTop] _ +- + have l2 : ∀ᶠ n in atTop, 0 < d n := (nnabla_bound_aux2 ((2 * π) ^ 2) hx) + have l3 : ∀ᶠ n in atTop, 0 < d (n + 1) := + (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_id).eventually l2 +@@ -869,7 +673,6 @@ lemma nnabla_bound_aux {x : ℝ} (hx : 0 < x) : + filter_upwards [l2, l3] with n l2 l3 + rw [nnabla, one_div, one_div, inv_sub_inv l2.ne.symm l3.ne.symm, div_eq_mul_inv, mul_inv, + mul_assoc] +- + have l4 : (fun n => (d n)⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by + apply IsBigO.inv_rev + · refine (isBigO_refl _ _).mul <| (log_sq_isbigo_mul hx) +@@ -889,17 +692,16 @@ lemma nnabla_bound_aux {x : ℝ} (hx : 0 < x) : + filter_upwards [l2, l3, e3] with n e1 e2 e3 + simp_rw [one_mul] + gcongr +- + have l6 : (fun n => d (n + 1) - d n) =O[atTop] (fun n => (Real.log n) ^ 2) := by +- simpa [d, nabla] using! (nnabla_mul_log_sq ((2 * π) ^ 2) hx) +- ++ change nabla (fun n : ℝ => n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2)) ++ =O[atTop] (fun n => (Real.log n) ^ 2) ++ exact nnabla_mul_log_sq ((2 * π) ^ 2) hx + apply EventuallyEq.trans_isBigO l1 +- + apply ((l6.mul l4).mul l5).trans_eventuallyEq + filter_upwards [eventually_ge_atTop 2, Real.log_eventually_gt_atTop 0] with n hn hn' + field_simp + +-lemma nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : ++theorem nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : + nnabla (fun n => C / (1 + (Real.log (n / x) / (2 * π)) ^ 2) / n) =O[atTop] + (fun n => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by + field_simp +@@ -907,11 +709,8 @@ lemma nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : + apply IsBigO.const_mul_left + simpa [div_eq_mul_inv, mul_pow, mul_comm] using nnabla_bound_aux hx + +-def chebyWith (C : ℝ) (f : ℕ → ℂ) : Prop := ∀ n, cumsum (‖f ·‖) n ≤ C * n +- +-def cheby (f : ℕ → ℂ) : Prop := ∃ C, chebyWith C f +- +-lemma cheby.bigO (h : cheby f) : cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by ++theorem cheby.bigO (h : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by + have l1 : 0 ≤ cumsum (‖f ·‖) := cumsum_nonneg (fun _ => norm_nonneg _) + obtain ⟨C, hC⟩ := h + apply isBigO_of_le' (c := C) atTop +@@ -919,12 +718,12 @@ lemma cheby.bigO (h : cheby f) : cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → + rw [Real.norm_eq_abs, abs_eq_self.mpr (l1 n)] + simpa using hC n + +-lemma limiting_fourier_lim1_aux (hcheby : cheby f) (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : ++theorem limiting_fourier_lim1_aux ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : + Summable fun n ↦ ‖f n‖ / ↑n * (C / (1 + (1 / (2 * π) * Real.log (↑n / x)) ^ 2)) := by +- + let a (n : ℕ) := (C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2) / ↑n) +- replace hcheby := hcheby.bigO +- ++ replace hcheby := cheby.bigO hcheby + have l1 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n : ℕ => (↑(n + 1) : ℝ)) := + hcheby.comp_tendsto <| tendsto_add_atTop_nat 1 + have l2 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n => (n : ℝ)) := +@@ -943,10 +742,13 @@ lemma limiting_fourier_lim1_aux (hcheby : cheby f) (hx : 0 < x) (C : ℝ) (hC : + apply le_add_of_le_of_nonneg le_rfl + positivity + have l3 : a =O[atTop] (fun n => 1 / (n : ℝ)) := by +- simpa [a] using! IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) ++ convert IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) using 1 ++ · ext n ++ simp [a, div_eq_mul_inv] ++ · ext n ++ simp + have l4 : nnabla a =O[atTop] (fun n : ℕ => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by +- convert (nnabla_bound C hx).natCast ; simp [nnabla, a] +- ++ convert (nnabla_bound C hx).natCast_atTop ; simp [nnabla, a] + simp_rw [div_mul_eq_mul_div, mul_div_assoc, one_mul] + apply dirichlet_test' + · intro n ; exact norm_nonneg _ +@@ -974,11 +776,12 @@ lemma limiting_fourier_lim1_aux (hcheby : cheby f) (hx : 0 < x) (C : ℝ) (hC : + grind + field_simp + +-theorem limiting_fourier_lim1 (hcheby : cheby f) (ψ : W21) (hx : 0 < x) : ++theorem limiting_fourier_lim1 ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (ψ : W21) (hx : 0 < x) : + Tendsto (fun σ' : ℝ ↦ + ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x))) (𝓝[>] 1) + (𝓝 (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x)))) := by +- + obtain ⟨C, hC⟩ := decay_bounds_cor ψ + have : 0 ≤ C := by simpa using (norm_nonneg _).trans (hC 0) + refine tendsto_tsum_of_dominated_convergence +@@ -994,7 +797,7 @@ theorem limiting_fourier_lim1 (hcheby : cheby f) (ψ : W21) (hx : 0 < x) : + rw [norm_mul, ← nterm_eq_norm_term] + refine mul_le_mul ?_ (hC _) (norm_nonneg _) (div_nonneg (norm_nonneg _) (Nat.cast_nonneg _)) + by_cases h : n = 0 <;> simp only [nterm, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, le_refl] +- have : 1 ≤ (n : ℝ) := by simpa using! Nat.pos_iff_ne_zero.mpr h ++ have : 1 ≤ (n : ℝ) := by exact_mod_cast (show 1 ≤ n by omega) + refine div_le_div₀ (norm_nonneg _) le_rfl (by simpa [Nat.pos_iff_ne_zero]) ?_ + simpa using Real.rpow_le_rpow_of_exponent_le this hσ'.le + +@@ -1009,7 +812,6 @@ theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : + Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * + ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) + (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by +- + obtain ⟨C, hC⟩ := decay_bounds_cor ψ + apply Tendsto.mul + · suffices h : Tendsto (fun σ' : ℝ ↦ ofReal (x ^ (1 - σ'))) (𝓝[>] 1) (𝓝 1) by +@@ -1028,7 +830,9 @@ theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : + continuity + · apply eventually_of_mem (U := Ioo 1 2) + · apply Ioo_mem_nhdsGT_of_mem ; simp +- · intro σ' ⟨h1, h2⟩ ++ · intro σ' hσ ++ have h1 := hσ.1 ++ have h2 := hσ.2 + rw [ae_restrict_iff' measurableSet_Ici] + apply Eventually.of_forall + intro t (ht : - Real.log x ≤ t) +@@ -1063,11 +867,9 @@ theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : + theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : + Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) + (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by +- + by_cases hh : tsupport ψ = ∅ + · simp [tsupport_eq_empty_iff.mp hh] + obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh +- + let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) + have l1 : IsCompact S := by + refine Metric.isCompact_iff_isClosed_bounded.mpr ⟨?_, ?_⟩ +@@ -1079,7 +881,6 @@ theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 + obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn l4 l3 + let MG := ‖G z‖ + let bound (a : ℝ) : ℝ := MG * ‖ψ a‖ +- + apply tendsto_integral_filter_of_dominated_convergence (bound := bound) + · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ; intro u hu + apply Continuous.aestronglyMeasurable +@@ -1099,7 +900,6 @@ theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 + exact mul_le_mul_of_nonneg_right r2 (norm_nonneg _) + · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) + simp at this ; simp [this, bound] +- + · suffices h : Continuous bound by exact h.integrable_of_hasCompactSupport ψ.h2.norm.mul_left + have := ψ.h1.continuous ; fun_prop + · apply Eventually.of_forall ; intro t +@@ -1109,125 +909,70 @@ theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 + · exact ((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds + · exact eventually_nhdsWithin_of_forall (fun x (hx : 1 < x) => by simp [hx.le]) + +-@[blueprint +- "limiting" +- (title := "Limiting Fourier identity") +- (statement := /-- +- If $\psi: \R \to \C$ is $C^2$ and compactly supported and $x \geq 1$, then +- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) +- - A \int_{-\log x}^\infty \hat \psi(\frac{u}{2\pi})\ du +- = \int_\R G(1+it) \psi(t) x^{it}\ dt.$$ +- -/) +- (proof := /-- +- By Lemma \ref{first-fourier} and Lemma \ref{second-fourier}, we know that for any $\sigma>1$, +- we have +- $$ \sum_{n=1}^\infty \frac{f(n)}{n^\sigma} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) +- - A x^{1-\sigma} \int_{-\log x}^\infty e^{-u(\sigma-1)} \hat \psi(\frac{u}{2\pi})\ du +- = \int_\R G(\sigma+it) \psi(t) x^{it}\ dt.$$ +- Now take limits as $\sigma \to 1$ using dominated convergence together with \eqref{cheby} +- and Lemma \ref{decay} to obtain the result. +- -/) +- (latexEnv := "lemma")] +-lemma limiting_fourier (hcheby : cheby f) ++theorem limiting_fourier (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) + (hG : ContinuousOn G {s | 1 ≤ s.re}) + (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) + (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : + ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - + A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = + ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by +- + have l1 := limiting_fourier_lim1 hcheby ψ (by linarith) + have l2 := limiting_fourier_lim2 A ψ hx + have l3 := limiting_fourier_lim3 hG ψ hx + apply tendsto_nhds_unique_of_eventuallyEq (l1.sub l2) l3 +- simpa [eventuallyEq_nhdsWithin_iff] using! Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) +- +- +- +- +-set_option backward.isDefEq.respectTransparency false in +-lemma limiting_cor_aux {f : ℝ → ℂ} : Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by ++ simpa [eventuallyEq_nhdsWithin_iff, W21.ofCS2] using ++ Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) + ++theorem limiting_cor_aux {f : ℝ → ℂ} : ++ Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by + have l1 : ∀ᶠ x : ℝ in atTop, ∀ t : ℝ, x ^ (t * I) = exp (log x * t * I) := by + filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' t + rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx'] ; ring_nf +- + have l2 : ∀ᶠ x : ℝ in atTop, ∫ t, f t * x ^ (t * I) = ∫ t, f t * exp (log x * t * I) := by + filter_upwards [l1] with x hx + refine integral_congr_ae (Eventually.of_forall (fun x => by simp [hx])) +- + simp_rw [tendsto_congr' l2] + convert_to Tendsto (fun x => 𝓕 f (-Real.log x / (2 * π))) atTop (𝓝 0) +- · ext ; congr ; ext +- simp only [← ofReal_mul, mul_comm (f _), fourierChar, Circle.exp, ContinuousMap.coe_mk, +- innerₗ_apply_apply, RCLike.inner_apply, conj_trivial, AddChar.coe_mk, mul_neg, ofReal_neg, +- neg_mul] +- congr +- rw [← neg_mul] ; congr ; norm_cast ; field_simp ++ · funext x ++ rw [Real.fourier_real_eq_integral_exp_smul] ++ apply integral_congr_ae ++ filter_upwards [] with t ++ have hphase : -2 * π * t * (-Real.log x / (2 * π)) = Real.log x * t := by ++ field_simp ++ rw [hphase, ofReal_mul, smul_eq_mul] ++ exact mul_comm _ _ + refine (Real.zero_at_infty_fourier f).comp <| Tendsto.mono_right ?_ _root_.atBot_le_cocompact + exact (tendsto_neg_atBot_iff.mpr tendsto_log_atTop).atBot_mul_const (inv_pos.mpr two_pi_pos) + +-@[blueprint +- "limiting-cor" +- (title := "Corollary of limiting identity") +- (statement := /-- +- With the hypotheses as above, we have +- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) +- = A \int_{-\infty}^\infty \hat \psi(\frac{u}{2\pi})\ du + o(1)$$ +- as $x \to \infty$. +- -/) +- (proof := /-- +- Immediate from the Riemann-Lebesgue lemma, and also noting that +- $\int_{-\infty}^{-\log x} \hat \psi(\frac{u}{2\pi})\ du = o(1)$. +- -/) +- (latexEnv := "corollary")] +-lemma limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) ++theorem limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) + (hG : ContinuousOn G {s | 1 ≤ s.re}) + (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : + Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - + A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by +- + apply limiting_cor_aux.congr' + filter_upwards [eventually_ge_atTop 1] with x hx using + limiting_fourier hcheby hG hG' hf ψ hx |>.symm + +- +- +- +- +-@[blueprint +- "smooth-ury" +- (title := "Smooth Urysohn lemma") +- (statement := /-- +- If $I$ is a closed interval contained in an open interval $J$, then there exists a smooth +- function $\Psi: \R \to \R$ with $1_I \leq \Psi \leq 1_J$. +- -/) +- (proof := /-- +- A standard analysis lemma, which can be proven by convolving $1_K$ with a smooth approximation +- to the identity for some interval $K$ between $I$ and $J$. Note that we have +- ``SmoothBumpFunction''s on smooth manifolds in Mathlib, so this shouldn't be too hard... +- -/) +- (latexEnv := "lemma")] +-lemma smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, ++theorem smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, + (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ + Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 := by +- + obtain ⟨ψ, l1, l2, l3, l4, -⟩ := smooth_urysohn_support_Ioo h1 h3 + refine ⟨ψ, l1, l2, l3, l4⟩ + +- +- + noncomputable def exists_trunc : trunc := by + choose ψ h1 h2 h3 h4 using smooth_urysohn (-2) (-1) (1) (2) (by linarith) (by linarith) + exact ⟨⟨ψ, h1.of_le (by norm_cast), h2⟩, h3, h4⟩ + +-lemma one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by +- match n with +- | 0 => simp +- | 1 => simp +- | n + 2 => { norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith } ++theorem one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by ++ cases n with ++ | zero => simp ++ | succ n => ++ cases n with ++ | zero => simp ++ | succ n => norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith + +-lemma quadratic_pos (a b c x : ℝ) (ha : 0 < a) (hΔ : discrim a b c < 0) : ++theorem quadratic_pos (a b c x : ℝ) (ha : 0 < a) (hΔ : discrim a b c < 0) : + 0 < a * x ^ 2 + b * x + c := by + have l1 : a * x ^ 2 + b * x + c = a * (x + b / (2 * a)) ^ 2 - discrim a b c / (4 * a) := by + simp only [discrim]; field_simp; ring +@@ -1238,66 +983,71 @@ noncomputable def pp (a x : ℝ) : ℝ := a ^ 2 * (x + 1) ^ 2 + (1 - a) * (1 + a + + noncomputable def pp' (a x : ℝ) : ℝ := a ^ 2 * (2 * (x + 1)) + +-lemma pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by ++theorem pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by + simp only [pp] + have : 0 < 1 - a := by linarith [ha.2] + have : 0 < 1 + a := by linarith [ha.1] + positivity + +-lemma pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by ++theorem pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by + unfold pp pp' + simpa using hasDerivAt_id x |>.add_const 1 |>.pow 2 |>.const_mul _ + +-lemma pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by ++theorem pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by + ext x ; exact pp_deriv a x |>.deriv + +-lemma pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by +- simpa using! hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) ++theorem pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by ++ change HasDerivAt (fun y : ℝ => a ^ 2 * (2 * (y + 1))) (a ^ 2 * 2) x ++ convert hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) ++ using 1 <;> first | rfl | ring + +-lemma pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by ++theorem pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by + ext x ; exact pp'_deriv a x |>.deriv + + noncomputable def hh (a t : ℝ) : ℝ := (t * (1 + (a * log t) ^ 2))⁻¹ + + noncomputable def hh' (a t : ℝ) : ℝ := - pp a (log t) * hh a t ^ 2 + +-lemma hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity ++theorem hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity + +-lemma hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by ++theorem hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by + by_cases h0 : t = 0 + · simp [hh, h0] + replace ht : 0 < t := lt_of_le_of_ne ht (by tauto) + unfold hh + rw [abs_inv, inv_le_inv₀ (by positivity) ht, abs_mul, abs_eq_self.mpr ht.le] +- convert_to! t * 1 ≤ _ ++ convert_to t * 1 ≤ _ + · simp + apply mul_le_mul le_rfl ?_ zero_le_one ht.le + rw [abs_eq_self.mpr (by positivity)] + simp only [le_add_iff_nonneg_right] + positivity + +-lemma hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by ++theorem hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by + have e1 : t * (1 + (a * log t) ^ 2) ≠ 0 := mul_ne_zero ht (_root_.ne_of_lt (by positivity)).symm + have l5 : HasDerivAt (fun t : ℝ => log t) t⁻¹ t := Real.hasDerivAt_log ht + have l4 : HasDerivAt (fun t : ℝ => a * log t) (a * t⁻¹) t := l5.const_mul _ + have l3 : HasDerivAt (fun t : ℝ => (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := by +- convert! l4.pow 2 using 1 ; ring ++ convert l4.pow 2 using 1 ; ring + have l2 : HasDerivAt (fun t : ℝ => 1 + (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := + l3.const_add _ + have l1 : HasDerivAt (fun t : ℝ => t * (1 + (a * log t) ^ 2)) + (1 + 2 * a ^ 2 * log t + a ^ 2 * log t ^ 2) t := by +- convert! (hasDerivAt_id' t).mul l2 using 1; field_simp; ring +- convert! l1.inv e1 using 1; simp only [hh', pp, hh]; field_simp; ring ++ convert (hasDerivAt_id' t).mul l2 using 1; field_simp; ring ++ apply (l1.inv e1).congr_deriv ++ dsimp only [hh', pp, hh] ++ simp only [div_eq_mul_inv, inv_pow] ++ ring + +-lemma hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := ++theorem hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := + fun t (ht : 0 < t) => (hh_deriv a ht.ne.symm).continuousAt.continuousWithinAt + +-lemma hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by ++theorem hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by + have := pp_pos ha (log x) + simp only [hh', neg_mul, Left.neg_nonpos_iff, ge_iff_le] + positivity + +-lemma hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by ++theorem hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by + have l1 x (hx : x ∈ interior (Ioi 0)) : + HasDerivWithinAt (hh a) (hh' a x) (interior (Ioi 0)) x := by + have : x ≠ 0 := by contrapose! hx ; simp [hx] +@@ -1307,17 +1057,17 @@ lemma hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) + + noncomputable def gg (x i : ℝ) : ℝ := 1 / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ + +-lemma gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by ++theorem gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by + simp only [gg, hh] + field_simp + +-lemma gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by ++theorem gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by + simp only [gg_of_hh hx.ne.symm, one_div, mul_inv_rev, abs_mul] + apply mul_le_mul le_rfl (hh_le _ _ (by positivity)) (by positivity) (by positivity) |>.trans + (le_of_eq ?_) + simp [abs_inv, abs_eq_self.mpr hx.le] ; field_simp + +-lemma gg_le_one (i : ℕ) : gg x i ≤ 1 := by ++theorem gg_le_one (i : ℕ) : gg x i ≤ 1 := by + by_cases hi : i = 0 <;> simp only [gg, hi, CharP.cast_eq_zero, div_zero, one_div, mul_inv_rev, + zero_div, Real.log_zero, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, + add_zero, inv_one, mul_one, zero_le_one] +@@ -1326,13 +1076,13 @@ lemma gg_le_one (i : ℕ) : gg x i ≤ 1 := by + simp only [le_add_iff_nonneg_right] ; positivity + rw [← mul_inv] ; apply inv_le_one_of_one_le₀ ; simpa using mul_le_mul l1 l2 zero_le_one (by simp) + +-lemma one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by ++theorem one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by + constructor + · trans 0 + · linarith + · positivity + · rw [div_lt_iff₀ (by positivity)] +- convert_to! 1 * 1 < 2 * π ++ convert_to 1 * 1 < 2 * π + · simp + · simp + apply mul_lt_mul one_lt_two ?_ zero_lt_one zero_le_two +@@ -1340,22 +1090,22 @@ lemma one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by + · exact one_le_two + · exact two_le_pi + +-lemma sum_telescopic (a : ℕ → ℝ) (n : ℕ) : ∑ i ∈ Finset.range n, (a (i + 1) - a i) = a n - a 0 := by ++theorem sum_telescopic (a : ℕ → ℝ) (n : ℕ) : ++ ∑ i ∈ Finset.range n, (a (i + 1) - a i) = a n - a 0 := by + apply Finset.sum_range_sub + +-lemma cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++theorem cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) + (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : + ∑ i ∈ Finset.range n, f i * g i ≤ g (n - 1) * (C * n) + (C * (↑(n - 1 - 1) + 1) * g 0 + - C * (↑(n - 1 - 1) + 1) * g (n - 1) - + ((n - 1 - 1) • (C * g 0) - ∑ x ∈ Finset.range (n - 1 - 1), C * g (x + 1))) := by +- + have l1 (n : ℕ) : + (g n - g (n + 1)) * ∑ i ∈ Finset.range (n + 1), f i ≤ (g n - g (n + 1)) * (C * (n + 1)) := by +- apply mul_le_mul le_rfl (by simpa using! hf' (n + 1)) (Finset.sum_nonneg (fun n _ ↦ hf n)) ?_ ++ apply mul_le_mul le_rfl (by simpa only [cumsum, Nat.cast_add, Nat.cast_one] using hf' (n + 1)) ++ (Finset.sum_nonneg (fun i _ => hf i)) ?_ + simp only [sub_nonneg] ; apply hg' ; simp + have l2 (x : ℕ) : C * (↑(x + 1) + 1) - C * (↑x + 1) = C := by simp ; ring +- have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun n _ ↦ hf n) +- ++ have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun i _ => hf i) + convert_to ∑ i ∈ Finset.range n, (g i) • (f i) ≤ _ + · simp [mul_comm] + rw [Finset.sum_range_by_parts, sub_eq_add_neg, ← Finset.sum_neg_distrib] +@@ -1363,20 +1113,20 @@ lemma cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) + apply _root_.add_le_add + · exact mul_le_mul le_rfl (hf' n) (l3 n) (hg _) + · apply Finset.sum_le_sum (fun n _ => l1 n) |>.trans +- convert_to! ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ ++ convert_to ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ + · congr ; ext i ; simp ; ring + rw [Finset.sum_range_by_parts] + simp_rw [Finset.sum_range_sub', l2, smul_sub, smul_eq_mul, Finset.sum_sub_distrib, + Finset.sum_const, Finset.card_range] + apply le_of_eq ; ring_nf + +-lemma sum_range_succ (a : ℕ → ℝ) (n : ℕ) : ++theorem sum_range_succ (a : ℕ → ℝ) (n : ℕ) : + ∑ i ∈ Finset.range n, a (i + 1) = (∑ i ∈ Finset.range (n + 1), a i) - a 0 := by + have := Finset.sum_range_sub a n + rw [Finset.sum_sub_distrib, sub_eq_iff_eq_add] at this + rw [Finset.sum_range_succ, this] ; ring + +-lemma cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++theorem cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) + (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : + ∑ i ∈ Finset.range n, f i * g i ≤ + C * n * g (n - 1) +@@ -1387,27 +1137,37 @@ lemma cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) + simp only [nsmul_eq_mul, ← Finset.mul_sum, sum_range_succ] at this + convert this using 1 ; unfold cumsum ; ring + +-lemma cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++theorem cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) + (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) (hn : 2 ≤ n) : + cumsum (f * g) n ≤ C * cumsum g n := by +- convert! cancel_aux' hf hg hf' hg' n using 1 +- match n with +- | n + 2 => simp only [cumsum_succ] ; push_cast ; ring +- +-lemma cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) ++ change (∑ i ∈ Finset.range n, f i * g i) ≤ C * cumsum g n ++ refine (cancel_aux' hf hg hf' hg' n).trans_eq ?_ ++ have hindex : n - 1 - 1 + 1 = n - 1 := by omega ++ have hcast : (n : ℝ) = ↑(n - 1) + 1 := by ++ exact_mod_cast (show n = (n - 1) + 1 by omega) ++ have hcast' : (↑(n - 1 - 1) : ℝ) + 1 = ↑(n - 1) := by ++ exact_mod_cast hindex ++ have hsum : cumsum g n = cumsum g (n - 1) + g (n - 1) := by ++ conv_lhs => rw [show n = (n - 1) + 1 by omega] ++ exact cumsum_succ (n - 1) ++ rw [hindex, hcast', hcast, hsum] ++ ring ++ ++theorem cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) + (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : + cumsum (f * g) n ≤ C * cumsum g n := by +- match n with +- | 0 => simp [cumsum] +- | 1 => specialize hg 0 ; specialize hf' 1 ; simp only [cumsum, Finset.range_one, +- Finset.sum_singleton, hf0, Nat.cast_one, mul_one, Pi.zero_apply, Pi.mul_apply, zero_mul, +- ge_iff_le] at hf' hg ⊢ ; positivity +- | n + 2 => convert! cancel_aux' hf hg hf' hg' (n + 2) using 1 ; simp [cumsum_succ] ; ring ++ cases n with ++ | zero => simp [cumsum] ++ | succ n => ++ cases n with ++ | zero => ++ have hC : 0 ≤ C := by simpa [cumsum, hf0] using hf' 1 ++ simpa [cumsum, hf0] using mul_nonneg hC (hg 0) ++ | succ n => exact cancel_main hf hg hf' hg' (n + 2) (by omega) + + theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneOn f (Ioc x₀ (x₀ + n))) + (hfi : IntegrableOn f (Icc x₀ (x₀ + n))) : + (∑ i ∈ Finset.range n, f (x₀ + ↑(i + 1))) ≤ ∫ x in x₀..x₀ + n, f x := by +- + cases n with simp only [Nat.cast_add, Nat.cast_one, CharP.cast_eq_zero, add_zero, + lt_self_iff_false, not_false_eq_true, + Ioc_eq_empty, Finset.range_zero, Nat.cast_add, Nat.cast_one, Finset.sum_empty, +@@ -1418,7 +1178,6 @@ theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneO + simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, + lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, and_true, not_false_eq_true, + Finset.sum_insert, CharP.cast_eq_zero, zero_add, ge_iff_le] +- + have l4 : IntervalIntegrable f volume x₀ (x₀ + 1) := by + apply IntegrableOn.intervalIntegrable + simp only [le_add_iff_nonneg_right, zero_le_one, uIcc_of_le] +@@ -1429,24 +1188,21 @@ theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneO + rcases hx with ⟨hx1, hx2⟩ + refine hf ⟨hx1, by linarith⟩ ⟨by linarith, by linarith⟩ hx2 + have l6 : ∫ x in x₀..x₀ + 1, f (x₀ + 1) = f (x₀ + 1) := by simp +- + have l1 : f (x₀ + 1) ≤ ∫ x in x₀..x₀ + 1, f x := by +- rw [← l6] ; apply intervalIntegral.integral_mono_ae_restrict (by linarith) (by simp) l4 +- apply eventually_of_mem _ l5 +- have : (Ioc x₀ (x₀ + 1))ᶜ ∩ Icc x₀ (x₀ + 1) = {x₀} := by simp [← sdiff_eq_compl_inter] +- rw [mem_ae_iff, Measure.restrict_apply measurableSet_Ioc.compl, this] +- simp +- ++ rw [← l6] ++ apply intervalIntegral.integral_mono_on_of_le_Ioo (by linarith) (by simp) l4 ++ intro x hx ++ exact l5 x ⟨hx.1, hx.2.le⟩ + have l2 : AntitoneOn (fun x ↦ f (x₀ + x)) (Icc 1 ↑(n + 1)) := by +- intro u ⟨hu1, _⟩ v ⟨_, hv2⟩ huv ; push_cast at hv2 ++ intro u hu v hv huv ++ have hu1 := hu.1 ++ have hv2 := hv.2 ++ push_cast at hv2 + refine hf ⟨?_, ?_⟩ ⟨?_, ?_⟩ ?_ <;> linarith +- + have l3 := @AntitoneOn.sum_le_integral_Ico 1 (n + 1) (fun x => f (x₀ + x)) (by simp) + (by simpa using l2) +- + simp only [Nat.cast_add, Nat.cast_one, intervalIntegral.integral_comp_add_left] at l3 +- convert! _root_.add_le_add l1 l3 +- ++ convert _root_.add_le_add l1 l3 + have := @intervalIntegral.integral_comp_mul_add ℝ _ _ 1 (n + 1) 1 f one_ne_zero x₀ + rw [intervalIntegral.integral_add_adjacent_intervals] + · exact l4 +@@ -1457,26 +1213,25 @@ theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneO + · linarith + · simp + +-lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++theorem hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : + (IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0)) ∧ + (∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π) := by +- + rw [integrableOn_Ici_iff_integrableOn_Ioi] + simp only [hh] +- + let g (x : ℝ) := (a * c / b) * Real.arctan (b * log (x / c)) + let g₀ (x : ℝ) := if x = 0 then ((a * c / b) * (- (π / 2))) else g x + let g' (x : ℝ) := a * (x / c * (1 + (b * Real.log (x / c)) ^ 2))⁻¹ +- + have l3 (x) (hx : 0 < x) : HasDerivAt Real.log x⁻¹ x := by apply Real.hasDerivAt_log (by linarith) + have l4 (x) : HasDerivAt (fun t => t / c) (1 / c) x := (hasDerivAt_id x).div_const c + have l2 (x) (hx : 0 < x) : HasDerivAt (fun t => log (t / c)) x⁻¹ x := by +- have := @HasDerivAt.comp _ _ _ _ _ _ (fun t => t / c) _ _ _ (l3 (x / c) (by positivity)) (l4 x) +- convert! this using 1 ; field_simp ++ have hcomp := (l3 (x / c) (by positivity)).comp x (l4 x) ++ convert hcomp using 1 ++ · rfl ++ · field_simp [hc.ne', hx.ne'] + have l5 (x) (hx : 0 < x) := (l2 x hx).const_mul b + have l1 (x) (hx : 0 < x) := (l5 x hx).arctan + have l6 (x) (hx : 0 < x) : HasDerivAt g (g' x) x := by +- convert! (l1 x hx).const_mul (a * c / b) using 1 ++ convert (l1 x hx).const_mul (a * c / b) using 1 + simp only [g'] + field_simp + have key (x) (hx : 0 < x) : HasDerivAt g₀ (g' x) x := by +@@ -1484,7 +1239,6 @@ lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : + apply eventually_of_mem <| Ioi_mem_nhds hx + intro y (hy : 0 < y) + simp [g₀, hy.ne.symm] +- + have k1 : Tendsto g₀ atTop (𝓝 ((a * c / b) * (π / 2))) := by + have : g =ᶠ[atTop] g₀ := by + apply eventually_of_mem (Ioi_mem_atTop 0) +@@ -1497,7 +1251,6 @@ lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : + apply tendsto_log_atTop.comp + apply Tendsto.atTop_div_const hc + apply tendsto_id +- + have k2 : Tendsto g₀ (𝓝[>] 0) (𝓝 (g₀ 0)) := by + have : g =ᶠ[𝓝[>] 0] g₀ := by + apply eventually_of_mem self_mem_nhdsWithin +@@ -1514,20 +1267,20 @@ lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : + · simp only [mem_Ioi] at hx1 ⊢ ; positivity + · simp only [dist_zero_right, norm_eq_abs, norm_div, abs_eq_self.mpr hc.le] at hx2 ⊢ + rwa [div_lt_iff₀ hc, mul_comm] +- + have k3 : ContinuousWithinAt g₀ (Ici 0) 0 := by + rw [Metric.continuousWithinAt_iff] + rw [Metric.tendsto_nhdsWithin_nhds] at k2 +- gconvert k2 using 5 with ε hε δ hδ x h +- intro (hx : 0 ≤ x) +- have := le_iff_lt_or_eq.mp hx +- cases this with +- | inl hx => exact h hx +- | inr hx => simp [g₀, hx.symm, hε] +- ++ intro ε hε ++ obtain ⟨δ, hδ, hδx⟩ := k2 ε hε ++ refine ⟨δ, hδ, ?_⟩ ++ intro x hx hdist ++ change 0 ≤ x at hx ++ rcases lt_or_eq_of_le hx with hx | hx ++ · exact hδx hx hdist ++ · subst x ++ simpa only [dist_self] using hε + have k4 : ∀ x ∈ Ioi 0, 0 ≤ g' x := by + intro x (hx : 0 < x) ; simp only [mul_inv_rev, inv_div, g'] ; positivity +- + constructor + · convert_to IntegrableOn g' _ + exact integrableOn_Ioi_deriv_of_nonneg k3 key k4 k1 +@@ -1535,25 +1288,25 @@ lemma hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : + simp only [mul_inv_rev, inv_div, mul_neg, ↓reduceIte, sub_neg_eq_add, g', g₀] at this ⊢ + convert this using 1 ; field_simp ; ring + +-lemma hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++theorem hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : + IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0) := + hh_integrable_aux ha hb hc |>.1 + +-lemma hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++theorem hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : + ∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π := + hh_integrable_aux ha hb hc |>.2 + +-lemma hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by ++theorem hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by + have := hh_integral (a := 1) (b := 1 / (2 * π)) (c := 1) + (by positivity) (by positivity) (by positivity) + convert this using 1 <;> simp ; ring + +-lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : ++theorem bound_sum_log {C : ℝ} (hf0 : f 0 = 0) ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : + ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ + C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by +- + let ggg (i : ℕ) : ℝ := if i = 0 then 1 else gg x i +- + have l0 : x ≠ 0 := by linarith + have l1 i : 0 ≤ ggg i := by by_cases hi : i = 0 <;> simp only [gg, one_div, mul_inv_rev, hi, + ↓reduceIte, zero_le_one, ggg] ; positivity +@@ -1569,33 +1322,29 @@ lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx + · simp only [mem_Ioi] ; positivity + · gcongr + have l3 : 0 ≤ C := by simpa [cumsum, hf0] using hf 1 +- + have l4 : 0 ≤ ∫ (t : ℝ) in Ioi 0, hh (π⁻¹ * 2⁻¹) t := + setIntegral_nonneg measurableSet_Ioi (fun x hx => hh_nonneg _ (LT.lt.le hx)) +- + have l5 {n : ℕ} : AntitoneOn (fun t ↦ x⁻¹ * hh (1 / (2 * π)) (t / x)) (Ioc 0 n) := by +- intro u ⟨hu1, _⟩ v ⟨hv1, _⟩ huv ++ intro u hu v hv huv ++ have hu1 := hu.1 ++ have hv1 := hv.1 + simp only + apply mul_le_mul le_rfl ?_ (hh_nonneg _ (by positivity)) (by positivity) + apply hh_antitone one_div_two_pi_mem_Ioo (by simp only [mem_Ioi] ; positivity) + (by simp only [mem_Ioi] ; positivity) + apply (div_le_div_iff_of_pos_right (by positivity)).mpr huv +- + have l6 {n : ℕ} : IntegrableOn (fun t ↦ x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (Icc 0 n) volume := by + apply IntegrableOn.mono_set + (hh_integrable (by positivity) (by positivity) (by positivity)) Icc_subset_Ici_self +- + apply Real.tsum_le_of_sum_range_le (fun n => by positivity) ; intro n +- convert_to! ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ ++ convert_to ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ + · congr ; ext i + by_cases hi : i = 0 + · simp [hi, hf0] + · simp only [gg, hi, ↓reduceIte, ggg] + field_simp +- + apply cancel_main' (fun _ => norm_nonneg _) (by simp [hf0]) l1 hf l2 n |>.trans + gcongr ; simp only [cumsum, gg_of_hh l0, one_div, mul_inv_rev, ggg] +- + by_cases hn : n = 0 + · simp only [hn, Finset.range_zero, Finset.sum_empty] ; positivity + replace hn : 0 < n := by omega +@@ -1603,7 +1352,7 @@ lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx + ext i ; simp ; by_cases hi : i = 0 <;> simp [hi, hn] ; omega + simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, + false_and, not_false_eq_true, Finset.sum_insert, ↓reduceIte, add_le_add_iff_left, ge_iff_le] +- convert_to! ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ ++ convert_to ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ + · apply Finset.sum_congr rfl (fun i hi => ?_) + simp at hi + have : i ≠ 0 := by omega +@@ -1624,36 +1373,43 @@ lemma bound_sum_log {C : ℝ} (hf0 : f 0 = 0) (hf : chebyWith C f) {x : ℝ} (hx + · apply eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) + intro x (hx : 0 < x) + apply hh_nonneg _ hx.le +- · have := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) +- simpa using! this.mono_set Ioi_subset_Ici_self +- +-lemma bound_sum_log0 {C : ℝ} (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : ++ · have h := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) ++ have h' := h.mono_set Ioi_subset_Ici_self ++ unfold IntegrableOn at h' ++ apply h'.congr ++ exact Eventually.of_forall (fun t => by simp) ++ ++theorem bound_sum_log0 {C : ℝ} ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : + ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ + C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by +- + let f0 i := if i = 0 then 0 else f i +- have l1 : chebyWith C f0 := by ++ have l1 : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f0 k : ℂ)‖) n ≤ C * n) := by + intro n ; refine Finset.sum_le_sum (fun i _ => ?_) |>.trans (hf n) + by_cases hi : i = 0 <;> simp [hi, f0] + have l2 i : ‖f i‖ / i = ‖f0 i‖ / i := by by_cases hi : i = 0 <;> simp [hi, f0] + simp_rw [l2] ; apply bound_sum_log rfl l1 hx + +-lemma bound_sum_log' {C : ℝ} (hf : chebyWith C f) {x : ℝ} (hx : 1 ≤ x) : ++theorem bound_sum_log' {C : ℝ} ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : + ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + 2 * π ^ 2) := by + simpa only [hh_integral'] using bound_sum_log0 hf hx + + variable (f x) in +-lemma summable_fourier_aux (ψ : W21) (i : ℕ) : ++theorem summable_fourier_aux (ψ : W21) (i : ℕ) : + ‖f i / i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (i / x))‖ ≤ + W21.norm ψ * (‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹) := by +- convert! mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) ++ convert mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) + (norm_nonneg (f i / i)) using 1 + · simp + · change _ = _ * (W21.norm ψ * _) + simp only [W21.norm, mul_inv_rev, one_div, Complex.norm_div, RCLike.norm_natCast] + ring + +-lemma summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : ++theorem summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : + Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by + have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by + simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) +@@ -1661,31 +1417,32 @@ lemma summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : + exact Summable.of_nonneg_of_le (fun _ => norm_nonneg _) l6 + (by simpa using l5.const_smul (W21.norm ψ)) + +-lemma bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) (hcheby : cheby f) : ++theorem bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : + ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ + W21.norm ψ • ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ := by +- + have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by + simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) + have l6 := summable_fourier_aux x f ψ + have l1 : Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by + exact summable_fourier x hx ψ hcheby + apply (norm_tsum_le_tsum_norm l1).trans +- simpa only [← Summable.tsum_const_smul _ l5] using! +- Summable.tsum_mono l1 (by simpa using l5.const_smul (W21.norm ψ)) l6 ++ change (∑' i, ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) ++ (1 / (2 * π) * Real.log (↑i / x))‖) ≤ W21.norm ψ * _ ++ rw [← tsum_mul_left] ++ exact Summable.tsum_mono l1 (l5.mul_left (W21.norm ψ)) l6 + +-lemma bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) (hcheby : chebyWith C f) : ++theorem bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : + ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ + W21.norm ψ * C * (1 + 2 * π ^ 2) := by +- + apply bound_I1 x (by linarith) ψ ⟨_, hcheby⟩ |>.trans + rw [smul_eq_mul, mul_assoc] + apply mul_le_mul le_rfl (bound_sum_log' hcheby hx) ?_ W21.norm_nonneg + apply tsum_nonneg (fun i => by positivity) + +-lemma bound_I2 (x : ℝ) (ψ : W21) : ++theorem bound_I2 (x : ℝ) (ψ : W21) : + ‖∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ W21.norm ψ * (2 * π ^ 2) := by +- + have key a : ‖𝓕 (ψ : ℝ → ℂ) (a / (2 * π))‖ ≤ W21.norm ψ * (1 + (a / (2 * π)) ^ 2)⁻¹ := + decay_bounds_key ψ _ + have twopi : 0 ≤ 2 * π := by simp [pi_nonneg] +@@ -1706,36 +1463,31 @@ lemma bound_I2 (x : ℝ) (ψ : W21) : + rw [Measure.integral_comp_div (fun x => (1 + x ^ 2)⁻¹) (2 * π)] + simp [abs_eq_self.mpr twopi] ; ring_nf ; rfl + +-lemma bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) +- (hcheby : chebyWith C f) : ++theorem bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : + ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - + A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ + W21.norm ψ * (C * (1 + 2 * π ^ 2) + ‖A‖ * (2 * π ^ 2)) := by +- + have l1 := bound_I1' x hx ψ hcheby + have l2 := mul_le_mul (le_refl ‖A‖) (bound_I2 x ψ) (by positivity) (by positivity) + apply norm_sub_le _ _ |>.trans ; rw [norm_mul] + convert _root_.add_le_add l1 l2 using 1 ; ring + +- +-set_option backward.isDefEq.respectTransparency false in +-lemma limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++theorem limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) + (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : + Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - + A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by + +- -- Shorter notation for clarity + let S1 x (ψ : ℝ → ℂ) := ∑' (n : ℕ), f n / ↑n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑n / x)) + let S2 x (ψ : ℝ → ℂ) := ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) + let S x ψ := S1 x ψ - S2 x ψ ; change Tendsto (fun x ↦ S x ψ) atTop (𝓝 0) + +- -- Build the truncation + obtain g := exists_trunc + let Ψ R := g.scale R * ψ + have key R : Tendsto (fun x ↦ S x (Ψ R)) atTop (𝓝 0) := limiting_cor (Ψ R) hf hcheby hG hG' + +- -- Choose the truncation radius + obtain ⟨C, hcheby⟩ := hcheby + have hC : 0 ≤ C := by + have : ‖f 0‖ ≤ C := by simpa [cumsum] using hcheby 1 +@@ -1747,130 +1499,62 @@ lemma limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (n + obtain ⟨R, hRψ⟩ := (key2 ((ε / 2) / (1 + M)) (by positivity)).exists + simp only [dist_zero_right, Real.norm_eq_abs, abs_eq_self.mpr W21.norm_nonneg] at hRψ key + +- -- Apply the compact support case + filter_upwards [eventually_ge_atTop 1, key R (ε / 2) (by positivity)] with x hx key + +- -- Control the tail term + have key3 : ‖S x (ψ - Ψ R)‖ < ε / 2 := by +- have : ‖S x _‖ ≤ _ * M := @bound_main f C A x hx (ψ - Ψ R) hcheby +- apply this.trans_lt +- apply (mul_le_mul (d := 1 + M) le_rfl (by simp) (by positivity) W21.norm_nonneg).trans_lt +- have : 0 < 1 + M := by positivity +- convert! (mul_lt_mul_iff_left₀ this).mpr hRψ using 1 ; field_simp +- +- -- Conclude the proof +- have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := by +- have l1 : AEStronglyMeasurable (fun x_1 : ℝ ↦ cexp (-(2 * ↑π * (↑x_1 * ↑x) * I))) volume := by +- refine (Continuous.mul ?_ continuous_const).neg.cexp.aestronglyMeasurable +- apply continuous_const.mul <| contDiff_ofReal.continuous.mul continuous_const +- simp only [Real.fourier_eq', neg_mul, RCLike.inner_apply', conj_trivial, ofReal_neg, +- ofReal_mul, ofReal_ofNat, Pi.sub_apply, smul_eq_mul, mul_sub] +- apply integral_sub +- · apply ψ.hf.bdd_mul (c := 1) l1 ; simp [Complex.norm_exp] +- · apply (Ψ R : W21) |>.hf |>.bdd_mul (c := 1) l1 +- simp [Complex.norm_exp] ++ have hbound := @bound_main f C A x hx (ψ - Ψ R) hcheby ++ change ‖S x (⇑ψ - ⇑(Ψ R))‖ ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * M at hbound ++ apply hbound.trans_lt ++ calc ++ W21.norm (⇑ψ - ⇑(Ψ R)) * M ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * (1 + M) := ++ mul_le_mul_of_nonneg_left (by linarith) W21.norm_nonneg ++ _ < ε / 2 := (lt_div_iff₀ (show 0 < 1 + M by positivity)).mp hRψ + ++ have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := ++ F_sub ψ.hf (Ψ R : W21).hf x + have S1_sub : S1 x (ψ - Ψ R) = S1 x ψ - S1 x (Ψ R) := by + simp only [one_div, mul_inv_rev, S1_sub_1, mul_sub, S1] ; apply Summable.tsum_sub + · have := summable_fourier x (by positivity) ψ ⟨_, hcheby⟩ + rw [summable_norm_iff] at this + simpa using this +- · have := summable_fourier x (by positivity) (Ψ R) ⟨_, hcheby⟩ +- rw [summable_norm_iff] at this +- simpa using! this +- ++ · have hsum := summable_fourier x (by positivity) (Ψ R : W21) ⟨_, hcheby⟩ ++ rw [summable_norm_iff] at hsum ++ simpa only [W21.ofCS2, one_div, mul_inv_rev] using hsum + have S2_sub : S2 x (ψ - Ψ R) = S2 x ψ - S2 x (Ψ R) := by + simp only [S1_sub_1, S2] ; rw [integral_sub] + · ring + · exact ψ.integrable_fourier (by positivity) |>.restrict + · exact (Ψ R : W21).integrable_fourier (by positivity) |>.restrict +- + have S_sub : S x (ψ - Ψ R) = S x ψ - S x (Ψ R) := by simp [S, S1_sub, S2_sub] ; ring + simpa [S_sub, Ψ] using norm_add_le _ _ |>.trans_lt (_root_.add_lt_add key3 key) + +-@[blueprint +- "schwarz-id" +- (title := "Limiting identity for Schwartz functions") +- (statement := /-- +- The previous corollary also holds for functions $\psi$ that are assumed to be in the Schwartz +- class, as opposed to being $C^2$ and compactly supported. +- -/) +- (proof := /-- +- For any $R>1$, one can use a smooth cutoff function (provided by Lemma \ref{smooth-ury} to write +- $\psi = \psi_{\leq R} + \psi_{>R}$, where $\psi_{\leq R}$ is $C^2$ (in fact smooth) and compactly +- supported (on $[-R,R]$), and $\psi_{>R}$ obeys bounds of the form +- $$ |\psi_{>R}(t)|, |\psi''_{>R}(t)| \ll R^{-1} / (1 + |t|^2) $$ +- where the implied constants depend on $\psi$. By Lemma \ref{decay} we then have +- $$ \hat \psi_{>R}(u) \ll R^{-1} / (1+|u|^2).$$ +- Using this and \eqref{cheby} one can show that +- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi_{>R}( \frac{1}{2\pi} \log \frac{n}{x} ), +- A \int_{-\infty}^\infty \hat \psi_{>R} (\frac{u}{2\pi})\ du \ll R^{-1} $$ +- (with implied constants also depending on $A$), while from Lemma \ref{limiting-cor} one has +- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi_{\leq R}( \frac{1}{2\pi} \log \frac{n}{x} ) +- = A \int_{-\infty}^\infty \hat \psi_{\leq R} (\frac{u}{2\pi})\ du + o(1).$$ +- Combining the two estimates and letting $R$ be large, we obtain the claim. +- -/) +- (latexEnv := "lemma")] +-lemma limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++theorem limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) + (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : + Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - + A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := + limiting_cor_W21 ψ hf hcheby hG hG' + +- +- +- +- +--- just the surjectivity is stated here, as this is all that is needed for the current +--- application, but perhaps one should state and prove bijectivity instead +- +-@[blueprint +- "bij" +- (title := "Bijectivity of Fourier transform") +- (statement := /-- +- The Fourier transform is a bijection on the Schwartz class. [Note: only surjectivity is +- actually used.] +- -/) +- (proof := /-- +- This is a standard result in Fourier analysis. +- It can be proved here by appealing to Mellin inversion, Theorem \ref{MellinInversion}. +- In particular, given $f$ in the Schwartz class, let +- $F : \R_+ \to \C : x \mapsto f(\log x)$ be a function in the ``Mellin space''; then the +- Mellin transform of $F$ on the imaginary axis $s=it$ is the Fourier transform of $f$. +- The Mellin inversion theorem gives Fourier inversion. +- -/) +- (latexEnv := "lemma")] +-lemma fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by ++theorem fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by + refine ⟨𝓕⁻ f, ?_⟩ + exact FourierTransform.fourier_fourierInv_eq f + ++noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) ++ (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) := ++ h2.toSchwartzMap h1 + ++@[simp] theorem toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl + +- +-noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) +- (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) where +- toFun := f +- smooth' := h1 +- decay' k n := by +- have l1 : Continuous (fun x => ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) := by +- have : ContDiff ℝ ∞ (iteratedFDeriv ℝ n f) := h1.iteratedFDeriv_right (mod_cast le_top) +- exact Continuous.mul (by continuity) this.continuous.norm +- have l2 : HasCompactSupport (fun x ↦ ‖x‖ ^ k * ‖iteratedFDeriv ℝ n f x‖) := +- (h2.iteratedFDeriv _).norm.mul_left +- simpa using l1.bounded_above_of_compact_support l2 +- +-@[simp] lemma toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl +- +-lemma comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++theorem comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : + ∀ᶠ x in 𝓝 0, Ψ x = 0 := + notMem_tsupport_iff_eventuallyEq.mp (fun h => lt_irrefl 0 <| mem_Ioi.mp (hplus h)) + +-lemma comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++theorem comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : + ∀ᶠ x in atBot, Ψ (exp x) = 0 := + Real.tendsto_exp_atBot <| comp_exp_support0 hplus + +-lemma comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : ++theorem comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : + ∀ᶠ (x : ℝ) in atTop, (Ψ ∘ rexp) x = 0 := by + simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, + cocompact_eq_atBot_atTop] at hsupp +@@ -1882,11 +1566,9 @@ theorem comp_exp_support {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) + cocompact_eq_atBot_atTop] + exact ⟨comp_exp_support1 hplus, comp_exp_support2 hsupp⟩ + +-set_option backward.isDefEq.respectTransparency false in +-lemma wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) ++theorem wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) + (hplus : closure (Function.support Ψ) ⊆ Ioi 0) (x : ℝ) (hx : 0 < x) : + ∫ (u : ℝ) in Ioi (-Real.log x), ↑(rexp u) * Ψ (rexp u) = ∫ (y : ℝ) in Ioi (1 / x), Ψ y := by +- + have l1 : ContinuousOn rexp (Ici (-Real.log x)) := by fun_prop + have l2 : Tendsto rexp atTop atTop := Real.tendsto_exp_atTop + have l3 t (_ : t ∈ Ioi (-log x)) : HasDerivWithinAt rexp (rexp t) (Ioi t) t := +@@ -1905,13 +1587,10 @@ theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) + (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : + Tendsto (fun x ↦ (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) + atTop (𝓝 0) := by +- + obtain ⟨ε, hε, hh⟩ := Metric.eventually_nhds_iff.mp <| comp_exp_support0 hplus + apply tendsto_nhds_of_eventually_eq ; filter_upwards [eventually_gt_atTop ε⁻¹] with x hxε +- + have l1 : Integrable (indicator (Ioi x⁻¹) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi + have l2 : Integrable (indicator (Ioi 0) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi +- + simp_rw [← MeasureTheory.integral_indicator measurableSet_Ioi, ← mul_sub, ← integral_sub l1 l2] + simp only [mul_eq_zero, ofReal_eq_zero] + right +@@ -1919,12 +1598,10 @@ theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) + apply Eventually.of_forall + intro t + simp only [Pi.zero_apply] +- + have hε' : 0 < ε⁻¹ := by positivity + have hx : 0 < x := by linarith + have hx' : 0 < x⁻¹ := by positivity + have hεx : x⁻¹ < ε := (inv_lt_comm₀ hε hx).mp hxε +- + have l3 : Ioi 0 = Ioc 0 x⁻¹ ∪ Ioi x⁻¹ := by + ext t ; simp only [mem_Ioi, mem_union, mem_Ioc] ; constructor <;> intro h + · simp [h, le_or_gt] +@@ -1943,52 +1620,35 @@ theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) + rw [abs_le] ; constructor <;> linarith + simp [ht] + +- +- +-@[blueprint +- "WienerIkeharaSmooth" +- (title := "Smoothed Wiener-Ikehara") +- (statement := /-- +- If $\Psi: (0,\infty) \to \C$ is smooth and compactly supported away from the origin, then, +- $$ \sum_{n=1}^\infty f(n) \Psi( \frac{n}{x} ) = A x \int_0^\infty \Psi(y)\ dy + o(x)$$ +- as $x \to \infty$. +- -/) +- (proof := /-- +- By Lemma \ref{bij}, we can write +- $$ y \Psi(y) = \hat \psi( \frac{1}{2\pi} \log y )$$ +- for all $y>0$ and some Schwartz function $\psi$. Making this substitution, the claim is then +- equivalent after standard manipulations to +- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) +- = A \int_{-\infty}^\infty \hat \psi(\frac{u}{2\pi})\ du + o(1)$$ +- and the claim follows from Lemma \ref{schwarz-id}. +- -/) +- (latexEnv := "corollary")] +-lemma wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) ++theorem wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) + (hG : ContinuousOn G {s | 1 ≤ s.re}) + (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) + (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) + (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : + Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x - A * ∫ y in Set.Ioi 0, Ψ y) + atTop (𝓝 0) := by +- + let h (x : ℝ) : ℂ := rexp (2 * π * x) * Ψ (exp (2 * π * x)) + have h1 : ContDiff ℝ ∞ h := by + have : ContDiff ℝ ∞ (fun x : ℝ => (rexp (2 * π * x))) := (contDiff_const.mul contDiff_id).exp + exact (contDiff_ofReal.comp this).mul (hsmooth.comp this) + have h2 : HasCompactSupport h := by +- have : 2 * π ≠ 0 := by simp [pi_ne_zero] +- simpa using! (comp_exp_support hsupp hplus).comp_smul this |>.mul_left ++ have hπ : 2 * π ≠ 0 := by simp [pi_ne_zero] ++ have hh : HasCompactSupport (fun x : ℝ => Ψ (rexp (2 * π * x))) := by ++ simpa only [Function.comp_def, smul_eq_mul] using ++ (comp_exp_support hsupp hplus).comp_smul hπ ++ change HasCompactSupport ++ ((fun x : ℝ => (rexp (2 * π * x) : ℂ)) * fun x : ℝ => Ψ (rexp (2 * π * x))) ++ exact hh.mul_left + obtain ⟨g, hg⟩ := fourier_surjection_on_schwartz (toSchwartz h h1 h2) +- + have l1 {y} (hy : 0 < y) : y * Ψ y = 𝓕 g (1 / (2 * π) * Real.log y) := by +- simp only [one_div, mul_inv_rev, hg, toSchwartz, ofReal_exp, ofReal_mul, ofReal_ofNat, +- toSchwartz_apply, ofReal_inv, h] +- field_simp +- norm_cast +- rw [Real.exp_log hy] +- ++ rw [hg] ++ change (y : ℂ) * Ψ y = h (1 / (2 * π) * Real.log y) ++ have harg : 2 * π * (1 / (2 * π) * Real.log y) = Real.log y := by ++ rw [← mul_assoc, mul_one_div_cancel (mul_ne_zero (by norm_num) pi_ne_zero), one_mul] ++ dsimp only [h] ++ rw [harg, Real.exp_log hy] + have key := limiting_cor_schwartz g hf hcheby hG hG' +- + have l2 : ∀ᶠ x in atTop, ∑' (n : ℕ), f n / ↑n * 𝓕 g (1 / (2 * π) * Real.log (↑n / x)) = + ∑' (n : ℕ), f n * Ψ (↑n / x) / x := by + filter_upwards [eventually_gt_atTop 0] with x hx +@@ -2000,26 +1660,25 @@ lemma wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f + have : (x : ℂ) ≠ 0 := by simpa using hx.ne.symm + simp only [ofReal_div, ofReal_natCast] + field_simp +- + have l3 : ∀ᶠ x in atTop, ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 g (u / (2 * π)) = + ↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y := by + filter_upwards [eventually_gt_atTop 0] with x hx + congr 1 +- simp only [hg, toSchwartz, ofReal_exp, ofReal_mul, ofReal_ofNat, toSchwartz_apply, +- ofReal_div, h] +- norm_cast ; field_simp; norm_cast ++ rw [hg] ++ change (∫ u in Ici (-Real.log x), h (u / (2 * π))) = ∫ y in Ioi x⁻¹, Ψ y ++ dsimp only [h] ++ have hscale : (2 : ℝ) * π ≠ 0 := mul_ne_zero (by norm_num) pi_ne_zero ++ have harg (u : ℝ) : 2 * π * (u / (2 * π)) = u := mul_div_cancel₀ u hscale ++ simp_rw [harg] + rw [MeasureTheory.integral_Ici_eq_integral_Ioi] +- exact wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx +- ++ simpa only [one_div] using wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx + have l4 : Tendsto (fun x => (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) + atTop (𝓝 0) := by + exact wiener_ikehara_smooth_sub (hsmooth.continuous.integrable_of_hasCompactSupport hsupp) hplus +- + simpa [tsum_div_const] using (key.congr' <| EventuallyEq.sub l2 l3) |>.add l4 + +- +- +-lemma wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hcheby : cheby f) ++theorem wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) + (hG : ContinuousOn G {s | 1 ≤ s.re}) + (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) + (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) +@@ -2033,14 +1692,14 @@ local instance {E : Type*} : Coe (E → ℝ) (E → ℂ) := ⟨fun f n => f n⟩ + theorem set_integral_ofReal {f : ℝ → ℝ} {s : Set ℝ} : ∫ x in s, (f x : ℂ) = ∫ x in s, f x := + integral_ofReal + +-lemma wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} ++theorem wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} + (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) + (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) + (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) + (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : + Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := by +- + let Ψ' := ofReal ∘ Ψ + have l1 : ContDiff ℝ ∞ Ψ' := contDiff_ofReal.comp hsmooth + have l2 : HasCompactSupport Ψ' := hsupp.comp_left rfl +@@ -2049,11 +1708,10 @@ lemma wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} + (@wiener_ikehara_smooth' A Ψ G f hf hcheby hG hG' l1 l2 l3) + simp at key ; norm_cast at key + +-lemma interval_approx_inf (ha : 0 < a) (hab : a < b) : ++theorem interval_approx_inf (ha : 0 < a) (hab : a < b) : + ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ + closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ + ψ ≤ indicator (Ico a b) 1 ∧ b - a - ε ≤ ∫ y in Ioi 0, ψ y := by +- + have l1 : Iio ((b - a) / 3) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds <| by + rw [← sub_pos] at hab + positivity +@@ -2083,11 +1741,10 @@ lemma interval_approx_inf (ha : 0 < a) (hab : a < b) : + apply integrableOn_const <;> + simp + +-lemma interval_approx_sup (ha : 0 < a) (hab : a < b) : ++theorem interval_approx_sup (ha : 0 < a) (hab : a < b) : + ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ + closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ + indicator (Ico a b) 1 ≤ ψ ∧ ∫ y in Ioi 0, ψ y ≤ b - a + ε := by +- + have l1 : Iio (a / 2) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds (by linarith) + filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < a / 2) + have l2 : a - ε / 2 < a := by linarith +@@ -2101,12 +1758,14 @@ lemma interval_approx_sup (ha : 0 < a) (hab : a < b) : + apply indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp) + · have l4 : 0 ≤ b - a + ε := by linarith + have l5 : Ioo (a - ε / 2) (b + ε / 2) ⊆ Ioi 0 := by intro t ht ; simp at ht ⊢ ; linarith +- have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := inter_eq_left.mpr l5 ++ have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := ++ inter_eq_left.mpr l5 + have l7 : ∫ y in Ioi 0, indicator (Ioo (a - ε / 2) (b + ε / 2)) 1 y = b - a + ε := by + simp only [measurableSet_Ioo, integral_indicator_one, measureReal_restrict_apply, l6, + volume_real_Ioo] + convert max_eq_left l4 using 1 ; ring_nf +- have l8 : IntegrableOn ψ (Ioi 0) volume := (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ have l8 : IntegrableOn ψ (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn + rw [← l7] + refine setIntegral_mono l8 ?_ h4 + rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo] +@@ -2114,7 +1773,7 @@ lemma interval_approx_sup (ha : 0 < a) (hab : a < b) : + apply integrableOn_const <;> + simp + +-lemma WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : ++theorem WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : + Summable (fun n => f n * g (n / x)) := by + obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure + apply summable_of_hasFiniteSupport +@@ -2122,21 +1781,24 @@ lemma WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) + simp only [Function.support_mul] ; apply Finite.inter_of_right ; rw [finite_iff_bddAbove] + exact ⟨Nat.ceil (M * x), fun i hi => by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ + +-lemma WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) ++theorem WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) + (hg₁ : HasCompactSupport g₁) (hg₂ : HasCompactSupport g₂) : + (∑' n, f n * g₁ (n / x)) / x ≤ (∑' n, f n * g₂ (n / x)) / x := by + apply div_le_div_of_nonneg_right ?_ hx.le + exact Summable.tsum_le_tsum (fun n => mul_le_mul_of_nonneg_left (hg _) (hf _)) + (WI_summable hg₁ hx) (WI_summable hg₂ hx) + +-lemma WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : chebyWith C f) (hb : 0 < b) (hxb : 2 / b < x) : ++theorem WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hb : 0 < b) (hxb : 2 / b < x) : + (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by + have hb' : 0 < 2 / b := by positivity + have hx : 0 < x := by linarith + have hxb' : 2 < x * b := (div_lt_iff₀ hb).mp hxb + have l1 (i : ℕ) (hi : i ∉ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) = 0 := by + simp_all [le_div_iff₀ hx] +- have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by ++ have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : ++ f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by + rw [abs_eq_self.mpr (hpos _)] + convert_to _ ≤ f i * 1 + · ring +@@ -2151,29 +1813,21 @@ lemma WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : cheby + apply (Nat.ceil_lt_add_one (by positivity)).le.trans + linarith + +-lemma WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} (hcheby : chebyWith C f) (hb : 0 < b) : ++theorem WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hb : 0 < b) : + ∀ᶠ x : ℝ in atTop, (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by + filter_upwards [eventually_gt_atTop (2 / b)] with x hx using WI_sum_Iab_le hpos hcheby hb hx + +-lemma le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by +- apply le_of_forall_gt ; intro d hd +- have key : ∀ᶠ c in 𝓝[>] b, c < d := by +- apply eventually_of_mem (U := Iio d) ?_ (fun x hx => hx) +- rw [mem_nhdsWithin] +- refine ⟨Iio d, isOpen_Iio, hd, inter_subset_left⟩ +- obtain ⟨x, h1, h2⟩ := (h.and key).exists +- linarith ++theorem le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by ++ exact ge_of_tendsto ++ (show Tendsto (fun c : ℝ => c) (𝓝[>] b) (𝓝 b) from nhdsWithin_le_nhds) h + +-lemma ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by +- apply le_of_forall_lt ; intro d hd +- have key : ∀ᶠ c in 𝓝[<] b, c > d := by +- apply eventually_of_mem (U := Ioi d) ?_ (fun x hx => hx) +- rw [mem_nhdsWithin] +- refine ⟨Ioi d, isOpen_Ioi, hd, inter_subset_left⟩ +- obtain ⟨x, h1, h2⟩ := (h.and key).exists +- linarith ++theorem ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by ++ exact le_of_tendsto ++ (show Tendsto (fun c : ℝ => c) (𝓝[<] b) (𝓝 b) from nhdsWithin_le_nhds) h + +-lemma WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : ++theorem WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : + Tendsto (fun c => c / A - (b - a)) (𝓝[>] (A * (b - a))) (𝓝[>] 0) := by + rw [Metric.tendsto_nhdsWithin_nhdsWithin] + intro ε hε +@@ -2186,7 +1840,7 @@ lemma WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : + rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp + rwa [this, div_lt_iff₀' hA] + +-lemma WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : ++theorem WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : + Tendsto (fun c => (b - a) - c / A) (𝓝[<] (A * (b - a))) (𝓝[>] 0) := by + rw [Metric.tendsto_nhdsWithin_nhdsWithin] + intro ε hε +@@ -2200,8 +1854,11 @@ lemma WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : + rwa [this, div_lt_iff₀' hA, ← neg_sub, abs_neg] + + theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) +- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) (hcheby : cheby fun n ↦ ↑(f n)) +- (hG : ContinuousOn G {s | 1 ≤ s.re}) (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : 0 ≤ A := by ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : ++ 0 ≤ A := by + let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x + have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by + filter_upwards [eventually_ge_atTop 0] with x hx +@@ -2215,37 +1872,29 @@ theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) + have r1 : 0 ≤ᵐ[Measure.restrict volume (Ioi 0)] ψ := Eventually.of_forall l2 + have r2 : IntegrableOn (fun y ↦ ψ y) (Ioi 0) volume := + (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn +- have r3 : Ico 1 2 ⊆ Function.support ψ := by intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith ++ have r3 : Ico 1 2 ⊆ Function.support ψ := by ++ intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith + have r4 : Ico 1 2 ⊆ Function.support ψ ∩ Ioi 0 := by +- simp only [subset_inter_iff, r3, true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith +- have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by convert! volume.mono r4 ; norm_num +- simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using! zero_lt_one.trans_le r5 ++ simp only [subset_inter_iff, r3, ++ true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith ++ have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by ++ convert volume.mono r4 ; norm_num ++ simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using zero_lt_one.trans_le r5 + have := div_nonneg l3 l4.le ; field_simp at this ; exact this + +-blueprint_comment /-- +-Now we add the hypothesis that $f(n) \geq 0$ for all $n$. +- +--/ ++theorem WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) ++ atTop (nhds (A * (b - a))) := by + +-@[blueprint +- (title := "Wiener-Ikehara in an interval") +- (statement := /-- +- For any closed interval $I \subset (0,+\infty)$, we have +- $$ \sum_{n=1}^\infty f(n) 1_I( \frac{n}{x} ) = A x |I| + o(x).$$ +- -/) +- (proof := /-- Use Lemma \ref{smooth-ury} to bound $1_I$ above and below by smooth compactly supported functions whose integral is close to the measure of $|I|$, and use the non-negativity of $f$. -/) +- (latexEnv := "proposition")] +-lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : +- Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) atTop (nhds (A * (b - a))) := by +- +- -- Take care of the trivial case `a = b` + by_cases hab : a = b + · simp [hab] + replace hb : a < b := lt_of_le_of_ne hb hab ; clear hab + +- -- Notation to make the proof more readable + let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x + have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by + filter_upwards [eventually_ge_atTop 0] with x hx +@@ -2253,10 +1902,10 @@ lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : + refine tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _)) + have hA : 0 ≤ A := residue_nonneg hpos hf hcheby hG hG' + +- -- A few facts about the indicator function of `Icc a b` + let Iab : ℝ → ℝ := indicator (Ico a b) 1 + change Tendsto (S Iab) atTop (𝓝 (A * (b - a))) +- have hIab : HasCompactSupport Iab := by simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc ++ have hIab : HasCompactSupport Iab := by ++ simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc + have Iab_nonneg : ∀ᶠ x : ℝ in atTop, 0 ≤ S Iab x := hSnonneg (indicator_nonneg (by simp)) + have Iab2 : IsBoundedUnder (· ≤ ·) atTop (S Iab) := by + obtain ⟨C, hC⟩ := hcheby ; exact ⟨C * 2 * b, WI_sum_Iab_le' hpos hC (by linarith)⟩ +@@ -2264,10 +1913,10 @@ lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : + have Iab0 : IsCoboundedUnder (· ≥ ·) atTop (S Iab) := Iab2.isCoboundedUnder_ge + have Iab1 : IsCoboundedUnder (· ≤ ·) atTop (S Iab) := Iab3.isCoboundedUnder_le + +- -- Bound from above by a smooth function + have sup_le : limsup (S Iab) atTop ≤ A * (b - a) := by + have l_sup : ∀ᶠ ε in 𝓝[>] 0, limsup (S Iab) atTop ≤ A * (b - a + ε) := by +- filter_upwards [interval_approx_sup ha hb] with ε ⟨ψ, h1, h2, h3, h4, h6⟩ ++ filter_upwards [interval_approx_sup ha hb] with ε happrox ++ rcases happrox with ⟨ψ, h1, h2, h3, h4, h6⟩ + have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 + have l6 : S Iab ≤ᶠ[atTop] S ψ := by + filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h4 hx hIab h2 +@@ -2281,10 +1930,10 @@ lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : + filter_upwards [WI_tendsto_aux a b key l_sup] with x hx + simpa [mul_div_cancel₀ _ h] using hx + +- -- Bound from below by a smooth function + have le_inf : A * (b - a) ≤ liminf (S Iab) atTop := by + have l_inf : ∀ᶠ ε in 𝓝[>] 0, A * (b - a - ε) ≤ liminf (S Iab) atTop := by +- filter_upwards [interval_approx_inf ha hb] with ε ⟨ψ, h1, h2, h3, h5, h6⟩ ++ filter_upwards [interval_approx_inf ha hb] with ε happrox ++ rcases happrox with ⟨ψ, h1, h2, h3, h5, h6⟩ + have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 + have l2 : S ψ ≤ᶠ[atTop] S Iab := by + filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h5 hx h2 hIab +@@ -2298,63 +1947,66 @@ lemma WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : + filter_upwards [WI_tendsto_aux' a b key l_inf] with x hx + simpa [mul_div_cancel₀ _ h] using hx + +- -- Combine the two bounds + have : liminf (S Iab) atTop ≤ limsup (S Iab) atTop := liminf_le_limsup Iab2 Iab3 + refine tendsto_of_liminf_eq_limsup ?_ ?_ Iab2 Iab3 <;> linarith + +- +- +-lemma le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by ++theorem le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by + rw [div_le_iff₀ hx, Nat.le_floor_iff] ; positivity + +-lemma lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by ++theorem lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by + rw [div_lt_iff₀ hx, Nat.lt_ceil] + +-lemma ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by ++theorem ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by + rw [le_div_iff₀ hx, Nat.ceil_le] + +-lemma mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by ++theorem mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : ++ n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by + rw [Finset.mem_Icc, mem_Icc, ceil_mul_le_iff hx, le_floor_mul_iff hb hx] + +-lemma mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by ++theorem mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by + rw [Finset.mem_Ico, mem_Ico, ceil_mul_le_iff hx, lt_ceil_mul_iff hx] + +-lemma tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : ++theorem tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : + ∑' n, f n * (indicator (Ico a b) 1 (n / x)) = ∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n := by + have l1 : ∀ n ∉ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n * indicator (Ico a b) 1 (↑n / x) = 0 := by + simp [mem_Ico_iff_div hx] ; tauto +- rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] ++ rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only ++ [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] + +-lemma WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : +- Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) atTop (nhds (A * (b - a))) := by ++theorem WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) ++ atTop (nhds (A * (b - a))) := by + apply (WienerIkeharaInterval hpos hf hcheby hG hG' ha hb).congr' + filter_upwards [eventually_gt_atTop 0] with x hx + rw [tsum_indicator hx] + +-lemma WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) (ha : 0 < a) (hb : a ≤ b) : +- Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) atTop (nhds (A * (b - a))) := ++theorem WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) ++ atTop (nhds (A * (b - a))) := + WienerIkeharaInterval_discrete hpos hf hcheby hG hG' ha hb |>.comp tendsto_natCast_atTop_atTop + +--- TODO with `Ico` +- +- +- +-/-- A version of the *Wiener-Ikehara Tauberian Theorem*: If `f` is a nonnegative arithmetic +-function whose L-series has a simple pole at `s = 1` with residue `A` and otherwise extends +-continuously to the closed half-plane `re s ≥ 1`, then `∑ n < N, f n` is asymptotic to `A*N`. -/ +- +-lemma tendsto_mul_ceil_div : ++theorem tendsto_mul_ceil_div : + Tendsto (fun (p : ℝ × ℕ) => ⌈p.1 * p.2⌉₊ / (p.2 : ℝ)) (𝓝[>] 0 ×ˢ atTop) (𝓝 0) := by + rw [Metric.tendsto_nhds] ; intro δ hδ +- have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) ++ have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := ++ inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) + have l2 : ∀ᶠ N : ℕ in atTop, 1 ≤ δ / 2 * N := by + apply Tendsto.eventually_ge_atTop + exact tendsto_natCast_atTop_atTop.const_mul_atTop (by positivity) +- filter_upwards [l1.prod_mk l2] with (ε, N) ⟨⟨hε, h1⟩, h2⟩ ; dsimp only at * ++ filter_upwards [l1.prod_mk l2] with p hp ++ rcases p with ⟨ε, N⟩ ++ rcases hp with ⟨⟨hε, h1⟩, h2⟩ ++ dsimp only at * + have l3 : 0 < (N : ℝ) := by + simp only [Nat.cast_pos, Nat.pos_iff_ne_zero] ; rintro rfl ; simp [zero_lt_one.not_ge] at h2 + have l5 : 0 ≤ ε * ↑N := by positivity +@@ -2364,19 +2016,20 @@ lemma tendsto_mul_ceil_div : + + noncomputable def S (f : ℕ → 𝕜) (ε : ℝ) (N : ℕ) : 𝕜 := (∑ n ∈ Finset.Ico ⌈ε * N⌉₊ N, f n) / N + +-lemma S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by +- have hceilN : ⌈ε * N⌉₊ ≤ N := by ++theorem S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : ++ S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by ++ have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by ++ simp_rw [Finset.range_eq_Ico] ++ symm ++ apply Finset.Ico_union_Ico_eq_Ico (Nat.zero_le _) + simp only [Nat.ceil_le] + exact mul_le_of_le_one_left N.cast_nonneg hε +- have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by +- ext n +- simp only [Finset.mem_range, Finset.mem_union, Finset.mem_Ico] +- omega + have r2 : Disjoint (Finset.range ⌈ε * N⌉₊) (Finset.Ico ⌈ε * N⌉₊ N) := by + rw [Finset.range_eq_Ico] ; apply Finset.Ico_disjoint_Ico_consecutive + simp [S, r1, Finset.sum_union r2, cumsum, add_div] + +-lemma tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) (hcheby : cheby f) : ++theorem tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : + TendstoUniformlyOnFilter (S f) (S f 0) (𝓝[>] 0) atTop := by + rw [Metric.tendstoUniformlyOnFilter_iff] ; intro δ hδ + obtain ⟨C, hC⟩ := hcheby +@@ -2384,40 +2037,34 @@ lemma tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) (hcheby : cheby f) : + have r1 := tendsto_mul_ceil_div.const_mul C + simp only [mul_div_assoc', mul_zero] at r1 ; exact r1 (Iio_mem_nhds hδ) + have : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) +- filter_upwards [l1, Eventually.prod_inl this _] with (ε, N) h1 h2 ++ filter_upwards [l1, Eventually.prod_inl this _] with p h1 h2 ++ rcases p with ⟨ε, N⟩ + have l2 : ‖cumsum f ⌈ε * ↑N⌉₊ / ↑N‖ ≤ C * ⌈ε * N⌉₊ / N := by + have r1 := hC ⌈ε * N⌉₊ + have r2 : 0 ≤ cumsum f ⌈ε * N⌉₊ := by apply cumsum_nonneg hpos + simp only [norm_real, norm_of_nonneg (hpos _), norm_div, + norm_of_nonneg r2, Real.norm_natCast] at r1 ⊢ + apply div_le_div_of_nonneg_right r1 (by positivity) +- simpa [← S_sub_S h2.2] using! l2.trans_lt h1 +- +-@[blueprint "WienerIkehara" +- (title := "Wiener-Ikehara Theorem (1)") +- (statement := /-- +- We have +- $$ \sum_{n\leq x} f(n) = A x + o(x).$$ +- -/) +- (proof := /-- Apply the preceding proposition with $I = [\varepsilon,1]$ and then send +- $\varepsilon$ to zero (using \eqref{cheby} to control the error). -/) +- (latexEnv := "corollary")] ++ simpa [dist_eq_norm, ← S_sub_S h2.2] using l2.trans_lt h1 ++ + theorem WienerIkeharaTheorem' {f : ℕ → ℝ} (hpos : 0 ≤ f) + (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hcheby : cheby f) (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) + (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : + Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := by +- + convert_to Tendsto (S f 0) atTop (𝓝 A) ; · ext N ; simp [S, cumsum] + apply (tendsto_S_S_zero hpos hcheby).tendsto_of_eventually_tendsto + · have L0 : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) + apply eventually_of_mem L0 + · intro ε hε +- simpa using! WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 ++ convert WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 using 1 ++ funext N ++ simp only [S, one_mul, Nat.ceil_natCast] + · have : Tendsto (fun ε : ℝ => ε) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds + simpa using (this.const_sub 1).const_mul A + +-theorem vonMangoldt_cheby : cheby Λ := by ++theorem vonMangoldt_cheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := by + use Real.log 4 + 4 + intro N + by_cases! h : N = 0 +@@ -2430,1956 +2077,20 @@ theorem vonMangoldt_cheby : cheby Λ := by + gcongr + linarith + +-blueprint_comment /-- +-\section{Weak PNT} +- +--/ +- +--- Proof extracted from the `EulerProducts` project so we can adapt it to the +--- version of the Wiener-Ikehara theorem proved above (with the `cheby` +--- hypothesis) +- +-@[blueprint +- (title := "WeakPNT") +- (statement := /-- +- We have +- $$ \sum_{n \leq x} \Lambda(n) = x + o(x).$$ +- -/) +- (proof := /-- Already done by Stoll, assuming Wiener-Ikehara. -/)] + theorem WeakPNT : Tendsto (fun N ↦ cumsum Λ N / N) atTop (𝓝 1) := by + let F := vonMangoldt.LFunctionResidueClassAux (q := 1) 1 +- have hnv := riemannZeta_ne_zero_of_one_le_re + have l1 (n : ℕ) : 0 ≤ Λ n := vonMangoldt_nonneg + have l2 s (hs : 1 < s.re) : F s = LSeries Λ s - 1 / (s - 1) := by + have := vonMangoldt.eqOn_LFunctionResidueClassAux (q := 1) isUnit_one hs +- simp only [F, this, vonMangoldt.residueClass, Nat.totient_one, Nat.cast_one, inv_one, one_div, sub_left_inj] ++ simp only [F, this, vonMangoldt.residueClass, Nat.totient_one, Nat.cast_one, ++ inv_one, one_div, sub_left_inj] + apply LSeries_congr + intro n _ +- simp only [ofReal_inj, indicator_apply_eq_self, mem_ofPred_eq] ++ simp only [ofReal_inj, indicator_apply_eq_self, Set.mem_ofPred_eq] + exact fun hn ↦ absurd (Subsingleton.eq_one _) hn + have l3 : ContinuousOn F {s | 1 ≤ s.re} := vonMangoldt.continuousOn_LFunctionResidueClassAux 1 +- have l4 : cheby Λ := vonMangoldt_cheby ++ have l4 : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := vonMangoldt_cheby + have l5 (σ' : ℝ) (hσ' : 1 < σ') : Summable (nterm Λ σ') := by +- simpa only [← nterm_eq_norm_term] using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm ++ simpa only [← nterm_eq_norm_term] ++ using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm + apply WienerIkeharaTheorem' l1 l5 l4 l3 l2 +- +--- #print axioms WeakPNT +- +-section auto_cheby +- +-variable {f : ℕ → ℝ} +- +-lemma norm_x_cpow_it (x t : ℝ) (hx : 0 < x) : ‖(x : ℂ) ^ (t * I)‖ = 1 := by +- rw [cpow_def_of_ne_zero <| ofReal_ne_zero.mpr hx.ne', ← ofReal_log hx.le] +- convert norm_exp_ofReal_mul_I (t * x.log) using 2 +- push_cast; ring_nf +- +-set_option backward.isDefEq.respectTransparency false in +-lemma limiting_fourier_aux_gt_zero (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) +- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 0 < x) (σ' : ℝ) (hσ' : 1 < σ') : +- ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - +- A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = +- ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by +- have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 +- have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := +- continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [hx]) +- have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := +- (((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8).integrable_of_hasCompactSupport +- ψ.h2.mul_left.mul_right +- have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := fun h ↦ by +- have := congrArg Complex.re (sub_eq_zero.mp h); simp at this; linarith +- have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * +- (↑(x ^ (σ' - 1)) * (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by +- have : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * +- (↑(x ^ (σ' - 1)) * (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by +- simp only [one_div, ← mul_assoc] +- exact ((continuous_const.mul (Continuous.inv₀ (by fun_prop) e2)).mul ψ.h1.continuous).mul l8 +- exact this.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right.mul_left.mul_left +- simp_rw [first_fourier hf hint hx hσ', second_fourier ψ.h1.continuous.measurable hint hx hσ', +- ← integral_const_mul, ← integral_sub l4 l5] +- refine integral_congr_ae (.of_forall fun u ↦ ?_) +- have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] +- simp_rw [hG' e1, sub_mul, ← mul_assoc] +- simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, +- mul_eq_zero, I_ne_zero, or_false] +- field_simp [e2]; norm_cast; simp [mul_assoc, ← rpow_add hx] +- +-theorem limiting_fourier_lim2_gt_zero (A : ℝ) (ψ : W21) (hx : 0 < x) : +- Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * +- ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) +- (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by +- obtain ⟨C, hC⟩ := decay_bounds_cor ψ +- refine Tendsto.mul ?_ (tendsto_integral_filter_of_dominated_convergence _ +- (.of_forall fun _ ↦ (by continuity : Continuous _).aestronglyMeasurable) ?_ +- (limiting_fourier_lim2_aux x C) (.of_forall fun u ↦ ?_)) +- · suffices Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) by +- simpa using ((continuous_ofReal.tendsto 1).comp this).const_mul ↑A +- have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := +- tendsto_nhdsWithin_of_tendsto_nhds (by simpa using (continuous_id.tendsto (1 : ℝ)).const_sub 1) +- simpa using tendsto_const_nhds.rpow this (Or.inl hx.ne') +- · refine eventually_of_mem (Ioo_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun σ' hσ' ↦ ?_ +- obtain ⟨h1, h2⟩ := hσ' +- rw [ae_restrict_iff' measurableSet_Ici] +- refine .of_forall fun t ht ↦ ?_ +- simp only [norm_mul, neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, +- norm_exp, neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, +- sub_self, mul_zero, sub_zero] +- refine mul_le_mul ?_ (hC _) (norm_nonneg _) ((abs_nonneg x).trans (le_max_left _ _)) +- have hα0 : 0 ≤ σ' - 1 := by linarith +- have hα1 : σ' - 1 ≤ 1 := by linarith +- have hmul1 : (-x.log) * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht hα0 +- calc Real.exp (-(t * (σ' - 1))) +- ≤ Real.exp (x.log * (σ' - 1)) := Real.exp_monotone (by linarith) +- _ ≤ max |x| 1 := by +- by_cases hx1 : 1 ≤ x +- · calc _ ≤ Real.exp x.log := +- Real.exp_monotone (mul_le_of_le_one_right (Real.log_nonneg hx1) hα1) +- _ = |x| := by rw [Real.exp_log hx, abs_of_pos hx] +- _ ≤ _ := le_max_left _ _ +- · calc _ ≤ 1 := (Real.exp_monotone (mul_nonpos_of_nonpos_of_nonneg +- ((Real.log_neg_iff hx).2 (by linarith)).le hα0)).trans_eq Real.exp_zero +- _ ≤ _ := le_max_right _ _ +- · suffices Tendsto (fun n ↦ ((rexp (-u * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by simpa using this.mul_const _ +- refine Tendsto.mono_left ?_ nhdsWithin_le_nhds +- have : Continuous (fun n ↦ ((rexp (-u * (n - 1))) : ℂ)) := by continuity +- simpa using this.tendsto 1 +- +-theorem limiting_fourier_lim3_gt_zero +- (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 0 < x) : +- Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) +- (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by +- by_cases hh : tsupport ψ = ∅ +- · simp [tsupport_eq_empty_iff.mp hh] +- obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh +- let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) +- have l1 : IsCompact S := Metric.isCompact_iff_isClosed_bounded.mpr +- ⟨isClosed_Icc.reProdIm (isClosed_tsupport ψ), (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded⟩ +- have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 +- obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ (hG.mono l2).norm +- have hxC : (x : ℂ) ≠ 0 := ofReal_ne_zero.mpr hx.ne' +- refine tendsto_integral_filter_of_dominated_convergence (bound := fun a ↦ ‖G z‖ * ‖ψ a‖) +- (eventually_of_mem (Icc_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun u hu ↦ +- ((hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous).mul +- (by simpa using Continuous.const_cpow (by fun_prop) (Or.inl hxC)) |>.aestronglyMeasurable) +- (eventually_of_mem (Icc_mem_nhdsGT_of_mem (by norm_num : (1 : ℝ) ∈ Set.Ico 1 2)) fun u hu ↦ +- .of_forall fun v ↦ ?_) +- ((continuous_const.mul ψ.h1.continuous.norm).integrable_of_hasCompactSupport ψ.h2.norm.mul_left) +- (.of_forall fun t ↦ ?_) +- · by_cases h : v ∈ tsupport ψ +- · simp_rw [norm_mul, norm_x_cpow_it x v hx, mul_one] +- exact mul_le_mul_of_nonneg_right (isMaxOn_iff.mp hmax _ (by simp [S, mem_reProdIm, hu.1, hu.2, h])) (norm_nonneg _) +- · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) +- simp [Function.notMem_support.mp this] +- · exact ((hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr +- ⟨((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds, +- eventually_nhdsWithin_of_forall fun _ hx' ↦ by simp [(Set.mem_Ioi.mp hx').le]⟩).mul_const _ |>.mul_const _ +- +-lemma tendsto_tsum_of_monotone_convergence +- {β : Type*} {f : ℕ → β → ENNReal} {g : β → ENNReal} +- (hmono : ∀ k, Monotone (fun n => f n k)) +- (hlim : ∀ k, Tendsto (fun n => f n k) atTop (𝓝 (g k))) : +- Tendsto (fun n => ∑' k, f n k) atTop (𝓝 (∑' k, g k)) := by +- let : MeasurableSpace β := ⊤ +- let μ : Measure β := Measure.count +- have hg_iSup (k : β) : (⨆ n : ℕ, f n k) = g k := iSup_eq_of_tendsto (hmono k) (hlim k) +- have h_tend_lint : Tendsto (fun n => ∫⁻ k, f n k ∂μ) atTop (𝓝 (∫⁻ k, (⨆ n, f n k) ∂μ)) := by +- have hmeas : ∀ n, Measurable fun k : β => f n k := fun _ _ _ ↦ trivial +- have hmono_fn : Monotone (fun n => fun k : β => f n k) := fun _ _ hnm k ↦ hmono k hnm +- simpa [lintegral_iSup hmeas hmono_fn] using +- tendsto_atTop_iSup fun _ _ hmn ↦ lintegral_mono fun k ↦ hmono k hmn +- simpa [μ, lintegral_count, hg_iSup] using h_tend_lint +- +-lemma tendsto_tsum_of_monotone_convergence_nhdsGT_one +- {F : ℝ → ℕ → ℝ} +- (hF_nonneg : ∀ σ n, 0 ≤ F σ n) +- (hF_antitone : ∀ n, AntitoneOn (fun σ : ℝ => F σ n) (Set.Ioi (1 : ℝ))) +- (hF_tend : ∀ n, Tendsto (fun σ : ℝ => F σ n) (𝓝[>] (1 : ℝ)) (𝓝 (F 1 n))) +- (hSumm : ∀ σ, 1 < σ → Summable (fun n : ℕ => F σ n)) +- (hbounded : +- BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ : ℝ => (∑' n : ℕ, F σ n))) : +- Tendsto (fun σ : ℝ => ∑' n : ℕ, F σ n) (𝓝[>] (1 : ℝ)) (𝓝 (∑' n : ℕ, F 1 n)) := by +- let T : ℝ → ℝ := fun σ => ∑' n : ℕ, F σ n +- have hT_antitone : AntitoneOn T (Set.Ioi (1 : ℝ)) := fun a ha b hb hab ↦ +- (hSumm b hb).tsum_le_tsum_of_inj (fun n ↦ n) (fun _ _ h ↦ h) (fun c hc ↦ (hc ⟨c, rfl⟩).elim) +- (fun n ↦ hF_antitone n ha hb hab) (hSumm a ha) +- have hT_bdd : BddAbove (T '' Set.Ioi (1 : ℝ)) := by +- obtain ⟨C, hC⟩ := isBigO_iff.1 hbounded +- have hC' : ∀ᶠ σ : ℝ in 𝓝[>] (1 : ℝ), T σ ≤ C := by +- filter_upwards [hC] with σ hσ +- calc T σ ≤ |T σ| := le_abs_self _ +- _ = ‖T σ‖ := (Real.norm_eq_abs _).symm +- _ ≤ C * ‖(1 : ℝ → ℝ) σ‖ := hσ +- _ = C := by simp +- obtain ⟨U, hU, V, hV, hUV⟩ := Filter.mem_inf_iff_superset.1 hC' +- obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hU +- have hIoi_sub : Set.Ioi (1 : ℝ) ⊆ V := Filter.mem_principal.mp hV +- have hUsub : U ∩ Set.Ioi (1 : ℝ) ⊆ {σ : ℝ | T σ ≤ C} := fun σ hσ ↦ hUV ⟨hσ.1, hIoi_sub hσ.2⟩ +- have hσ0_Ioi : 1 + ε / 2 ∈ Set.Ioi (1 : ℝ) := by simp [half_pos hε] +- have hσ0_leC : T (1 + ε / 2) ≤ C := +- hUsub ⟨hball (by simp only [Metric.mem_ball, Real.dist_eq, add_sub_cancel_left, +- abs_of_pos (half_pos hε)]; exact half_lt_self hε), hσ0_Ioi⟩ +- refine ⟨C, ?_⟩ +- rintro _ ⟨σ, hσIoi, rfl⟩ +- by_cases hσlt : σ < 1 + ε / 2 +- · exact hUsub ⟨hball (by +- simp only [Metric.mem_ball, Real.dist_eq] +- rw [abs_of_pos (sub_pos.2 (Set.mem_Ioi.mp hσIoi))] +- linarith [half_lt_self hε]), hσIoi⟩ +- · exact (hT_antitone hσ0_Ioi hσIoi (le_of_not_gt hσlt)).trans hσ0_leC +- have hT_tend_sup : Tendsto T (𝓝[>] (1 : ℝ)) (𝓝 (sSup (T '' Set.Ioi (1 : ℝ)))) := +- hT_antitone.tendsto_nhdsGT hT_bdd +- let σseq : ℕ → ℝ := fun k => 1 + 1 / (k + 1 : ℝ) +- have hσseq_mem (k) : σseq k ∈ Set.Ioi (1 : ℝ) := by +- simp only [σseq, Set.mem_Ioi, lt_add_iff_pos_right] +- positivity +- have hσseq_tend_nhds : Tendsto σseq atTop (𝓝 (1 : ℝ)) := by +- have : Tendsto (fun k : ℕ => (1 : ℝ) + ((k + 1 : ℕ) : ℝ)⁻¹) atTop (𝓝 ((1 : ℝ) + 0)) := +- tendsto_const_nhds.add (tendsto_inv_atTop_nhds_zero_nat.comp (tendsto_add_atTop_nat 1)) +- simp only [add_zero] at this +- convert this using 1; ext k; simp [σseq, one_div] +- have hσseq_tend_nhdsWithin : Tendsto σseq atTop (𝓝[>] (1 : ℝ)) := +- tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ hσseq_tend_nhds +- (.of_forall hσseq_mem) +- have hσseq_antitone : Antitone σseq := fun k₁ k₂ hk ↦ by simp only [σseq]; gcongr +- have hmono_seq (n) : Monotone (fun k => F (σseq k) n) := fun k₁ k₂ hk ↦ +- hF_antitone n (hσseq_mem k₂) (hσseq_mem k₁) (hσseq_antitone hk) +- have htend_seq (n) : Tendsto (fun k => F (σseq k) n) atTop (𝓝 (F 1 n)) := +- (hF_tend n).comp hσseq_tend_nhdsWithin +- have hTseq : Tendsto (fun k : ℕ => T (σseq k)) atTop (𝓝 (T 1)) := by +- have hsum1 : Summable (fun n : ℕ => F (1 : ℝ) n) := by +- obtain ⟨C, hC⟩ := hT_bdd +- refine summable_of_sum_range_le (hF_nonneg 1) fun m ↦ le_of_tendsto +- (tendsto_finsetSum _ fun i _ ↦ hF_tend i) +- (eventually_of_mem self_mem_nhdsWithin fun σ hσ ↦ +- ((hSumm σ hσ).sum_le_tsum _ (fun n _ ↦ hF_nonneg σ n)).trans (hC ⟨σ, hσ, rfl⟩)) +- have hg_ne_top : (∑' n : ℕ, ENNReal.ofReal (F 1 n)) ≠ ⊤ := hsum1.tsum_ofReal_ne_top +- have hENN : Tendsto (fun k => ∑' n, ENNReal.ofReal (F (σseq k) n)) atTop +- (𝓝 (∑' n, ENNReal.ofReal (F 1 n))) := +- tendsto_tsum_of_monotone_convergence (fun n _ _ hk ↦ ENNReal.ofReal_le_ofReal (hmono_seq n hk)) +- (fun n ↦ ENNReal.tendsto_ofReal (htend_seq n)) +- have hrew (σ) : (∑' n, ENNReal.ofReal (F σ n)).toReal = ∑' n, F σ n := by +- rw [ENNReal.tsum_toReal_eq (fun n ↦ by simp)] +- exact tsum_congr fun n ↦ by simp [hF_nonneg σ n] +- simp only [T, ← hrew]; exact (ENNReal.tendsto_toReal hg_ne_top).comp hENN +- have hsSup_eq : sSup (T '' Set.Ioi (1 : ℝ)) = T 1 := +- tendsto_nhds_unique (hT_tend_sup.comp hσseq_tend_nhdsWithin) hTseq +- simpa [T, hsSup_eq] using hT_tend_sup +- +-lemma limiting_fourier_variant_lim1_aux +- {f : ℕ → ℝ} {x : ℝ} (ψ : CS 2 ℂ) +- (hpos : 0 ≤ f) +- (hf : ∀ (σ : ℝ), 1 < σ → Summable (nterm f σ)) +- (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) : +- ∀ (σ : ℝ), 1 < σ → +- Summable (fun n : ℕ => +- (if n = 0 then 0 else f n / ((n : ℝ) ^ σ)) * +- (𝓕 ψ.toFun (1 / (2 * π) * Real.log ((n : ℝ) / x))).re) := by +- intro σ hσ +- let y : ℕ → ℝ := fun n => (1 / (2 * π)) * Real.log ((n : ℝ) / x) +- let W : ℕ → ℝ := fun n => (𝓕 ψ.toFun (y n)).re +- let base : ℕ → ℝ := fun n => if n = 0 then 0 else f n / ((n : ℝ) ^ σ) +- obtain ⟨C, hC⟩ := decay_bounds_cor (W21.ofCS2 ψ) +- have hC_nonneg : 0 ≤ C := (norm_nonneg _).trans ((hC 0).trans (by simp)) +- have hW_nonneg (n : ℕ) : 0 ≤ W n := (hψpos (y n)).1 +- have hnorm_four (n : ℕ) : ‖𝓕 ψ.toFun (y n)‖ = W n := by +- have him0 : (𝓕 ψ.toFun (y n)).im = 0 := (hψpos (y n)).2 +- rw [show 𝓕 ψ.toFun (y n) = W n by exact Complex.ext rfl him0] +- simp [abs_of_nonneg (hW_nonneg n)] +- have hW_le_C (n : ℕ) : W n ≤ C := by +- rw [← hnorm_four]; exact (hC (y n)).trans (div_le_self hC_nonneg (by nlinarith [sq_nonneg (y n)])) +- have hbase_summ : Summable base := by +- convert hf σ hσ using 1; ext n +- by_cases hn : n = 0 <;> simp [nterm, base, hn, Real.norm_eq_abs, abs_of_nonneg (hpos n)] +- refine (hbase_summ.mul_left C).of_norm_bounded fun n ↦ ?_ +- by_cases hn : n = 0 +- · simp [base, hn] +- · have hnpos : 0 < (n : ℝ) := Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn) +- have hbase_nonneg : 0 ≤ base n := by +- simp only [base, hn, ite_false] +- exact div_nonneg (hpos n) (Real.rpow_pos_of_pos hnpos σ).le +- calc |base n * W n| = base n * W n := abs_of_nonneg (mul_nonneg hbase_nonneg (hW_nonneg n)) +- _ ≤ base n * C := mul_le_mul_of_nonneg_left (hW_le_C n) hbase_nonneg +- _ = C * base n := mul_comm _ _ +- +- +-theorem limiting_fourier_variant_lim1 +- {f : ℕ → ℝ} {x : ℝ} {ψ : CS 2 ℂ} +- (hpos : 0 ≤ f) +- (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) +- (S : ℝ → ℂ) +- (hSdef : +- ∀ σ' : ℝ, +- S σ' = +- ∑' n : ℕ, +- term (fun n ↦ (f n : ℂ)) (σ' : ℝ) n * +- 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x))) +- (hbounded : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ' : ℝ => ‖S σ'‖)) +- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) : +- Tendsto +- (fun σ' : ℝ => +- ∑' n : ℕ, +- term (fun n ↦ (f n : ℂ)) (σ' : ℝ) n * +- 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x))) +- (𝓝[>] (1 : ℝ)) +- (𝓝 +- (∑' n : ℕ, +- (f n : ℂ) / (n : ℂ) * +- 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x)))) := by +- +- let y : ℕ → ℝ := fun n => (π⁻¹ * 2⁻¹) * Real.log ((n : ℝ) / x) +- let w : ℕ → ℝ := fun n => (𝓕 ψ.toFun (y n)).re +- +- have hw_nonneg : ∀ n, 0 ≤ w n := by +- intro n +- exact (hψpos (y n)).1 +- +- have hFour_eq_ofReal : ∀ n, 𝓕 ψ.toFun (y n) = Complex.ofReal (w n) := by +- intro n +- have h := hψpos (y n) +- refine Complex.ext ?_ ?_ +- · simp [w] +- · simp [w, h.2] +- +- let rterm : ℝ → ℕ → ℝ := +- fun σ n => +- if h0 : n = 0 then 0 else (f n) / ((n : ℝ) ^ σ) * (w n) +- +- have summand_eq_ofReal : +- ∀ (σ : ℝ) (n : ℕ), +- term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n) +- = Complex.ofReal (rterm σ n) := by +- intro σ n +- by_cases hn : n = 0 +- · subst hn +- simp [rterm, y] +- · have hnpos : (0 : ℝ) < (n : ℝ) := by +- exact_mod_cast (Nat.pos_of_ne_zero hn) +- have hn0 : 0 ≤ (n : ℝ) := le_of_lt hnpos +- have hcpow : +- ( (n : ℂ) ^ ((σ : ℝ) : ℂ) ) = ( ( (n : ℝ) ^ σ : ℝ) : ℂ ) := by +- simpa using (Complex.ofReal_cpow hn0 σ).symm +- have hpow_ne : ((n : ℝ) ^ σ) ≠ 0 := by +- exact (ne_of_gt (Real.rpow_pos_of_pos hnpos σ)) +- calc +- term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n) +- = +- ((f n : ℂ) / ((n : ℂ) ^ ((σ : ℝ) : ℂ))) * ( (w n : ℝ) : ℂ ) := by +- simp [term, LSeries.term, hn, hFour_eq_ofReal] +- _ = +- ((f n : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) * ((w n : ℝ) : ℂ) := by +- simp [hcpow] +- _ = +- (( (f n : ℝ) : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) * ((w n : ℝ) : ℂ) := by +- simp +- _ = +- ( ( (f n : ℝ) / ((n : ℝ) ^ σ) : ℝ) : ℂ ) * ((w n : ℝ) : ℂ) := by +- simp [Complex.ofReal_div] +- _ = +- ( ( (f n : ℝ) / ((n : ℝ) ^ σ) * (w n) : ℝ ) : ℂ ) := by +- simp [Complex.ofReal_mul] +- _ = +- Complex.ofReal (rterm σ n) := by +- simp [rterm, hn] +- +- let T : ℝ → ℝ := fun σ => ∑' n, rterm σ n +- +- have tsum_eq_ofReal_T : ∀ σ : ℝ, +- (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) +- = Complex.ofReal (T σ) := by +- intro σ +- have hcongr : +- (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) +- = ∑' n : ℕ, (Complex.ofReal (rterm σ n)) := by +- refine tsum_congr ?_ +- intro n +- simpa using (summand_eq_ofReal σ n) +- +- calc +- (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) +- = ∑' n : ℕ, (Complex.ofReal (rterm σ n)) := hcongr +- _ = Complex.ofReal (∑' n : ℕ, rterm σ n) := by +- simpa using (Complex.ofReal_tsum (fun n : ℕ => rterm σ n)).symm +- _ = Complex.ofReal (T σ) := by rfl +- +- have hS_ofReal_T : ∀ σ : ℝ, S σ = Complex.ofReal (T σ) := by +- intro σ +- simpa [hSdef σ, y] using (tsum_eq_ofReal_T σ) +- +- have rterm_nonneg : ∀ σ n, 0 ≤ rterm σ n := by +- intro σ n +- by_cases hn : n = 0 +- · subst hn; simp [rterm] +- · have hf : 0 ≤ f n := hpos n +- have hw : 0 ≤ w n := hw_nonneg n +- have hnpos : 0 < (n : ℝ) := by +- exact_mod_cast (Nat.pos_of_ne_zero hn) +- have hden : 0 < (n : ℝ) ^ σ := Real.rpow_pos_of_pos hnpos σ +- have : 0 ≤ (f n) / ((n : ℝ) ^ σ) := div_nonneg hf (le_of_lt hden) +- simp [rterm, hn, mul_nonneg this hw] +- +- have T_nonneg : ∀ σ, 0 ≤ T σ := by +- intro σ +- exact tsum_nonneg (fun n => rterm_nonneg σ n) +- +- have hT_eq_normS : ∀ σ, T σ = ‖S σ‖ := by +- intro σ +- have := hS_ofReal_T σ +- calc +- T σ = ‖Complex.ofReal (T σ)‖ := by simp [abs_of_nonneg (T_nonneg σ)] +- _ = ‖S σ‖ := by simp [this] +- +- have hboundedT : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ : ℝ => T σ) := by +- have : (fun σ : ℝ => T σ) = (fun σ : ℝ => ‖S σ‖) := by +- funext σ; exact hT_eq_normS σ +- simpa [this] using hbounded +- +- have rterm_antitone : ∀ n, AntitoneOn (fun σ => rterm σ n) (Set.Ioi 1) := by +- intro n σ₁ hσ₁ σ₂ hσ₂ hσ₁₂ +- by_cases hn : n = 0 +- · subst hn; simp [rterm] +- · have hf : 0 ≤ f n := hpos n +- have hw : 0 ≤ w n := hw_nonneg n +- have hnpos : 0 < (n : ℝ) := by exact_mod_cast (Nat.pos_of_ne_zero hn) +- have hn1 : (1 : ℝ) ≤ (n : ℝ) := by +- exact_mod_cast (Nat.one_le_iff_ne_zero.mpr hn) +- have hpow : (n : ℝ) ^ σ₁ ≤ (n : ℝ) ^ σ₂ := +- Real.rpow_le_rpow_of_exponent_le hn1 hσ₁₂ +- have hinv : +- (1 / ((n : ℝ) ^ σ₂)) ≤ (1 / ((n : ℝ) ^ σ₁)) := by +- have hpos1 : 0 < (n : ℝ) ^ σ₁ := Real.rpow_pos_of_pos hnpos σ₁ +- exact one_div_le_one_div_of_le hpos1 hpow +- have hinv_inv : ((n : ℝ) ^ σ₂)⁻¹ ≤ ((n : ℝ) ^ σ₁)⁻¹ := by +- simpa [one_div] using hinv +- have hmul1 : +- (f n) * (((n : ℝ) ^ σ₂)⁻¹) ≤ (f n) * (((n : ℝ) ^ σ₁)⁻¹) := +- mul_le_mul_of_nonneg_left hinv_inv hf +- have hmul2 : +- ((f n) * (((n : ℝ) ^ σ₂)⁻¹)) * (w n) +- ≤ ((f n) * (((n : ℝ) ^ σ₁)⁻¹)) * (w n) := +- mul_le_mul_of_nonneg_right hmul1 hw +- simpa [rterm, hn, div_eq_mul_inv, mul_assoc] using hmul2 +- +- have rterm_tend : ∀ n, Tendsto (fun σ : ℝ => rterm σ n) (𝓝[>] (1 : ℝ)) (𝓝 (rterm 1 n)) := by +- intro n +- have hterm : +- Tendsto (fun σ : ℝ => term (fun n ↦ (f n : ℂ)) (σ : ℝ) n) +- (𝓝[>] (1 : ℝ)) (𝓝 ((f n : ℂ) / (n : ℂ))) := by +- by_cases hn : n = 0 +- · subst hn +- simp [term, LSeries.term] +- · have hden : +- Tendsto (fun σ : ℝ => ((n : ℂ) ^ ((σ : ℝ) : ℂ))) (𝓝[>] (1 : ℝ)) (𝓝 ((n : ℂ) ^ (1 : ℂ))) := by +- simpa using ((continuous_ofReal.tendsto (1 : ℝ)).mono_left nhdsWithin_le_nhds).const_cpow +- +- have hden' : +- Tendsto (fun σ : ℝ => ((n : ℂ) ^ ((σ : ℝ) : ℂ))) (𝓝[>] (1 : ℝ)) (𝓝 (n : ℂ)) := by +- simpa using hden +- +- have hnC : (n : ℂ) ≠ 0 := by +- exact_mod_cast hn +- +- have hterm : +- Tendsto (fun σ : ℝ => term (fun n ↦ (f n : ℂ)) (σ : ℝ) n) +- (𝓝[>] (1 : ℝ)) (𝓝 ((f n : ℂ) / (n : ℂ))) := by +- have hnC : (n : ℂ) ≠ 0 := by +- exact_mod_cast hn +- simpa [term, LSeries.term, hn] using! +- (tendsto_const_nhds.div hden' hnC) +- exact hterm +- +- have hsummand : +- Tendsto +- (fun σ : ℝ => +- term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) +- (𝓝[>] (1 : ℝ)) +- (𝓝 (((f n : ℂ) / (n : ℂ)) * 𝓕 ψ.toFun (y n))) := by +- simpa [mul_assoc, mul_left_comm, mul_comm] using (hterm.mul_const (𝓕 ψ.toFun (y n))) +- +- have hre : ∀ σ, rterm σ n = +- (term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)).re := by +- intro σ +- have := congrArg Complex.re (summand_eq_ofReal σ n) +- simpa [Complex.ofReal_re] using this.symm +- +- have hRe : Tendsto +- (fun σ : ℝ => +- (term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)).re) +- (𝓝[>] (1 : ℝ)) +- (𝓝 ((((f n : ℂ) / (n : ℂ)) * 𝓕 ψ.toFun (y n)).re)) := +- (continuous_re.tendsto _).comp hsummand +- +- have hlimit_re : +- (f n / (n : ℝ)) * (𝓕 ψ.toFun (y n)).re = rterm 1 n := by +- have h0 : +- (term (fun n ↦ (f n : ℂ)) (1 : ℝ) n * 𝓕 ψ.toFun (y n)).re = rterm 1 n := by +- have := congrArg Complex.re (summand_eq_ofReal (σ := (1 : ℝ)) n) +- simpa [Complex.ofReal_re] using this +- +- by_cases hn : n = 0 +- · subst hn +- simp [rterm, y] +- · have h1 : +- (term (fun n ↦ (f n : ℂ)) (1 : ℝ) n * 𝓕 ψ.toFun (y n)).re +- = (f n / (n : ℝ)) * (𝓕 ψ.toFun (y n)).re := by +- simp [Complex.mul_re, term, LSeries.term, hn, y, +- (hψpos (y n)).2] +- +- exact (h1.symm.trans h0) +- +- simpa [hre, hlimit_re] using hRe +- +- have hSumm_rterm : ∀ σ : ℝ, 1 < σ → Summable (fun n : ℕ => rterm σ n) := by +- simpa [rterm] using limiting_fourier_variant_lim1_aux (ψ := ψ) +- (f := f) (x := x) hpos hf hψpos +- +- have hT_tend : +- Tendsto T (𝓝[>] (1 : ℝ)) (𝓝 (T 1)) := by +- have : +- Tendsto (fun σ : ℝ => ∑' n : ℕ, rterm σ n) +- (𝓝[>] (1 : ℝ)) +- (𝓝 (∑' n : ℕ, rterm (1 : ℝ) n)) := by +- refine tendsto_tsum_of_monotone_convergence_nhdsGT_one +- (F := rterm) +- (hF_nonneg := rterm_nonneg) +- (hF_antitone := rterm_antitone) +- (hF_tend := rterm_tend) +- (hSumm := hSumm_rterm) +- (hbounded := hboundedT) +- +- simpa [T] using this +- +- have hToReal : +- Tendsto (fun σ => Complex.ofReal (T σ)) (𝓝[>] (1 : ℝ)) (𝓝 (Complex.ofReal (T 1))) := +- (continuous_ofReal.tendsto _).comp hT_tend +- +- have hsource : +- (fun σ : ℝ => +- ∑' n : ℕ, +- term (fun n ↦ (f n : ℂ)) (σ : ℝ) n * 𝓕 ψ.toFun (y n)) +- = fun σ : ℝ => Complex.ofReal (T σ) := by +- funext σ +- exact (tsum_eq_ofReal_T σ) +- +- have hσ1 : +- (∑' n : ℕ, term (fun n ↦ (f n : ℂ)) (↑(1:ℝ)) n * 𝓕 ψ.toFun (y n)) +- = (↑(T 1) : ℂ) := +- by simpa using (tsum_eq_ofReal_T (σ := (1:ℝ))) +- have hterm1 : +- ∀ n : ℕ, term (fun n ↦ (f n : ℂ)) (1 : ℂ) n = (f n : ℂ) / (n : ℂ) := by +- intro n +- by_cases hn : n = 0 +- · subst hn +- simp [term, LSeries.term] +- · simp [term, LSeries.term, hn] +- +- have hrewrite : +- (∑' n : ℕ, +- term (fun n ↦ (f n : ℂ)) (1 : ℂ) n * 𝓕 ψ.toFun (y n)) +- = +- (∑' n : ℕ, +- (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (y n)) := by +- refine tsum_congr ?_ +- intro n +- simp [hterm1 n] +- +- have htarget : +- (∑' n : ℕ, +- (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (y n)) +- = (↑(T 1) : ℂ) := by +- exact (hrewrite.symm.trans hσ1) +- +- simpa [hsource, htarget, y] using hToReal +- +- +- +- +-blueprint_comment /-- +-\section{Removing the Chebyshev hypothesis} +- +-In this section we do *not* assume the bound \eqref{cheby}, but instead derive it from the other hypotheses. +- +--/ +- +-@[blueprint "limiting-fourier-variant" +- (title := "limiting-fourier-variant") +- (statement := /-- +- If $\psi: \R \to \C$ is $C^2$ and compactly supported with $f$ and $\hat \psi$ non-negative, and $0 < x$, then +- $$ \sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} ) - A \int_{-\log x}^\infty \hat \psi(\frac{u}{2\pi})\ du = \int_\R G(1+it) \psi(t) x^{it}\ dt.$$ +- -/) +- (proof := /-- Repeat the proof of Lemma \ref{limiting-fourier-variant}, but use monotone convergence instead of dominated convergence. (The proof should be simpler, as one no longer needs to establish domination for the sum.) -/) +- (proofUses := ["decay", "second-fourier", "first-fourier"]) +- (latexEnv := "lemma")] +-lemma limiting_fourier_variant +- (hpos : 0 ≤ f) +- (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) +- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (ψ : CS 2 ℂ) +- (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) +- (hx : 0 < x) : +- ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - +- A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = +- ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by +- +- have l2 := limiting_fourier_lim2_gt_zero (A := A) (x := x) ψ hx +- have l3 := limiting_fourier_lim3_gt_zero (G := G) (x := x) hG ψ hx +- +- let S : ℝ → ℂ := fun σ' => +- ∑' n : ℕ, +- term (fun n ↦ (f n : ℂ)) σ' n * +- 𝓕 ψ.toFun (1 / (2 * π) * Real.log ((n : ℝ) / x)) +- let Pole : ℝ → ℂ := fun σ' => +- (A : ℂ) * ((x ^ (1 - σ') : ℝ) : ℂ) * +- ∫ u in Set.Ici (-Real.log x), +- (rexp (-u * (σ' - 1)) : ℂ) * +- 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π)) +- let RHS : ℝ → ℂ := fun σ' => +- ∫ t : ℝ, G (σ' + t * I) * ψ.toFun t * (x : ℂ) ^ (t * I) +- +- +- have haux : +- (fun (σ' : ℝ) ↦ +- ∑' (n : ℕ), +- term (fun n ↦ (f n : ℂ)) (σ' : ℂ) n * +- 𝓕 ψ.toFun (π⁻¹ * 2⁻¹ * Real.log ((n : ℝ) / x)) +- - (A : ℂ) * ((x ^ (1 - σ') : ℝ) : ℂ) * +- ∫ (u : ℝ) in Ici (-Real.log x), +- cexp (-( (u : ℂ) * ((σ' : ℂ) - 1))) * +- 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π))) +- =ᶠ[𝓝[>] (1 : ℝ)] +- (fun σ' ↦ +- ∫ (t : ℝ), G ((σ' : ℂ) + (t : ℂ) * I) * ψ.toFun t * (x : ℂ) ^ ((t : ℂ) * I)) := by +- rw [Filter.EventuallyEq] +- +- refine eventually_nhdsWithin_of_forall ?_ +- intro σ' hσ' +- have hσ' : (1 : ℝ) < σ' := by +- simpa [Set.mem_Ioi] using hσ' +- simpa using! (limiting_fourier_aux_gt_zero (G := G) (f := f) (A := A) hG' hf ψ hx σ' hσ') +- +- have haux' : +- (fun σ' : ℝ => S σ') =ᶠ[𝓝[>] (1 : ℝ)] (fun σ' : ℝ => RHS σ' + Pole σ') := by +- rw [Filter.EventuallyEq] at haux ⊢ +- filter_upwards [haux] with σ' hσ' +- have hσ'' : S σ' - Pole σ' = RHS σ' := by +- simpa [S, Pole, RHS] using hσ' +- have hadd : (S σ' - Pole σ') + Pole σ' = RHS σ' + Pole σ' := +- congrArg (fun z : ℂ => z + Pole σ') hσ'' +- simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using hadd +- +- let Pole₁ : ℂ := (A : ℂ) * ∫ u in Set.Ici (-Real.log x), 𝓕 (W21.ofCS2 ψ).toFun (u / (2 * π)) +- let RHS₁ : ℂ := ∫ t : ℝ, G (1 + (t : ℂ) * I) * ψ.toFun t * (x : ℂ) ^ ((t : ℂ) * I) +- +- have hRHS_le : +- ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ‖RHS σ'‖ ≤ ‖RHS₁‖ + 1 := by +- have hball : Metric.ball RHS₁ (1 : ℝ) ∈ 𝓝 RHS₁ := by +- simpa using (Metric.ball_mem_nhds (x := RHS₁) (ε := (1 : ℝ)) (by norm_num)) +- have hpre : {σ' : ℝ | RHS σ' ∈ Metric.ball RHS₁ (1 : ℝ)} ∈ (𝓝[>] (1 : ℝ)) := +- l3 hball +- filter_upwards [hpre] with σ' hmem +- have hdist' : dist (RHS σ') RHS₁ < (1 : ℝ) := by +- simpa [Metric.mem_ball] using hmem +- have hdist : ‖RHS σ' - RHS₁‖ < (1 : ℝ) := by +- simpa [dist_eq_norm] using hdist' +- have htri : ‖RHS σ'‖ ≤ ‖RHS₁‖ + ‖RHS σ' - RHS₁‖ := by +- have h := norm_add_le (RHS σ' - RHS₁) RHS₁ +- simpa [sub_add_cancel, add_comm, add_left_comm, add_assoc] using h +- have hle : ‖RHS₁‖ + ‖RHS σ' - RHS₁‖ ≤ ‖RHS₁‖ + (1 : ℝ) := by +- exact add_le_add_right (le_of_lt hdist) ‖RHS₁‖ +- exact htri.trans hle +- +- have hPole_le : +- ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), ‖Pole σ'‖ ≤ ‖Pole₁‖ + 1 := by +- have hball : Metric.ball Pole₁ 1 ∈ 𝓝 Pole₁ := by +- simpa using (Metric.ball_mem_nhds Pole₁ (by norm_num : (0 : ℝ) < 1)) +- have hpre : {σ' : ℝ | Pole σ' ∈ Metric.ball Pole₁ 1} ∈ (𝓝[>] (1 : ℝ)) := l2 hball +- filter_upwards [hpre] with σ' hmem +- have hdist : ‖Pole σ' - Pole₁‖ < 1 := by +- simpa [Metric.mem_ball, dist_eq_norm] using hmem +- have htri : ‖Pole σ'‖ ≤ ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ := by +- have hdecomp : Pole σ' = Pole₁ + (Pole σ' - Pole₁) := by abel +- have hnorm_eq : ‖Pole σ'‖ = ‖Pole₁ + (Pole σ' - Pole₁)‖ := by +- simp [congrArg (fun z : ℂ => ‖z‖) hdecomp] +- calc +- ‖Pole σ'‖ = ‖Pole₁ + (Pole σ' - Pole₁)‖ := hnorm_eq +- _ ≤ ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ := norm_add_le _ _ +- have hdist_le : ‖Pole σ' - Pole₁‖ ≤ 1 := le_of_lt hdist +- have hsum : ‖Pole₁‖ + ‖Pole σ' - Pole₁‖ ≤ ‖Pole₁‖ + 1 := by +- simpa [add_comm, add_left_comm, add_assoc] using (add_le_add_left hdist_le ‖Pole₁‖) +- exact htri.trans hsum +- +- have hS_le : +- ∀ᶠ σ' : ℝ in 𝓝[>] (1 : ℝ), +- ‖S σ'‖ ≤ (‖RHS₁‖ + 1) + (‖Pole₁‖ + 1) := by +- rw [Filter.EventuallyEq] at haux' +- filter_upwards [haux', hRHS_le, hPole_le] with σ' hEq hR hP +- calc +- ‖S σ'‖ = ‖RHS σ' + Pole σ'‖ := by simp [hEq] +- _ ≤ ‖RHS σ'‖ + ‖Pole σ'‖ := norm_add_le _ _ +- _ ≤ (‖RHS₁‖ + 1) + (‖Pole₁‖ + 1) := by +- exact add_le_add hR hP +- +- have hbounded : BoundedAtFilter (𝓝[>] (1 : ℝ)) (fun σ' : ℝ => ‖S σ'‖) := by +- let C : ℝ := ‖RHS₁‖ + 1 + (‖Pole₁‖ + 1) +- simp only [BoundedAtFilter, Asymptotics.IsBigO, Asymptotics.IsBigOWith] +- refine ⟨C, ?_⟩ +- filter_upwards [hS_le] with σ' hσ' +- simpa [Real.norm_eq_abs, abs_of_nonneg (norm_nonneg (S σ'))] using hσ' +- +- have hcoef : (1 / (2 * π) : ℝ) = (π⁻¹ * 2⁻¹ : ℝ) := by field_simp [pi_ne_zero] +- +- have l1 := +- limiting_fourier_variant_lim1 +- (f := f) (x := x) (ψ := ψ) +- hpos hψpos +- (S := S) +- (hSdef := by +- intro σ +- simp [S, hcoef] ) +- hbounded +- hf +- have l1S : +- Tendsto S (𝓝[>] (1 : ℝ)) +- (𝓝 (∑' n : ℕ, (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (1 / (2 * π) * Real.log (↑n / x)))) := by +- simpa [S, hcoef] using l1 +- +- have l12 : Tendsto (fun σ' : ℝ => S σ' - Pole σ') (𝓝[>] (1 : ℝ)) +- (𝓝 ((∑' n : ℕ, (f n : ℂ) / (n : ℂ) * 𝓕 ψ.toFun (1 / (2 * π) * Real.log (↑n / x))) - Pole₁)) := +- l1S.sub l2 +- +- have hPole : (Pole : ℝ → ℂ) =ᶠ[𝓝[>] (1 : ℝ)] Pole := by simp +- have haux_sub : +- (fun σ' : ℝ => S σ' - Pole σ') =ᶠ[𝓝[>] (1 : ℝ)] RHS := by +- filter_upwards [haux'] with σ' hσ' +- calc +- S σ' - Pole σ' +- = (RHS σ' + Pole σ') - Pole σ' := by simp [hσ'] +- _ = RHS σ' := by simp +- have hlim := +- tendsto_nhds_unique_of_eventuallyEq (l1S.sub l2) l3 haux_sub +- +- simpa [Pole₁, RHS₁] using! hlim +- +- +-lemma norm_mul_integral_Ici_le_integral_norm +- (A : ℂ) (F : ℝ → ℂ) (a : ℝ) +- (hF : IntegrableOn F (Set.Ici a)) +- (hnorm : Integrable (fun u : ℝ => ‖F u‖)) : +- ‖A * (∫ u in Set.Ici a, F u)‖ ≤ ‖A‖ * (∫ u : ℝ, ‖F u‖) := by +- have hmul : ‖A * (∫ u in Set.Ici a, F u)‖ = ‖A‖ * ‖∫ u in Set.Ici a, F u‖ := by +- simp +- have hnormI : +- ‖∫ u in Set.Ici a, F u‖ ≤ ∫ u in Set.Ici a, ‖F u‖ := by +- have _ : Integrable F (Measure.restrict volume (Set.Ici a)) := hF +- have h : +- ‖∫ u, F u ∂Measure.restrict volume (Set.Ici a)‖ +- ≤ ∫ u, ‖F u‖ ∂Measure.restrict volume (Set.Ici a) := +- norm_integral_le_integral_norm (μ := Measure.restrict volume (Set.Ici a)) (f := F) +- simpa using h +- +- have hdom : +- (∫ u in Set.Ici a, ‖F u‖) ≤ ∫ u : ℝ, ‖F u‖ := by +- have hEq : +- (∫ u in Set.Ici a, ‖F u‖) = +- ∫ u : ℝ, Set.indicator (Set.Ici a) (fun u => ‖F u‖) u := by +- have h := (integral_indicator (μ := (volume : Measure ℝ)) +- (s := Set.Ici a) (f := fun u => ‖F u‖)) +- have h' := h measurableSet_Ici +- simpa using h'.symm +- have hind_int : +- Integrable (Set.indicator (Set.Ici a) (fun u => ‖F u‖)) := +- hnorm.indicator measurableSet_Ici +- have hpoint : +- Set.indicator (Set.Ici a) (fun u => ‖F u‖) +- ≤ᵐ[volume] (fun u : ℝ => ‖F u‖) := by +- filter_upwards with u +- by_cases hu : u ∈ Set.Ici a +- · simp [Set.indicator_of_mem hu] +- · simp [Set.indicator_of_notMem hu] +- have hmono := +- integral_mono_ae (μ := (volume : Measure ℝ)) +- hind_int hnorm hpoint +- simpa [hEq] using hmono +- +- calc +- ‖A * (∫ u in Set.Ici a, F u)‖ +- = ‖A‖ * ‖∫ u in Set.Ici a, F u‖ := hmul +- _ ≤ ‖A‖ * (∫ u in Set.Ici a, ‖F u‖) := +- mul_le_mul_of_nonneg_left hnormI (by simp) +- _ ≤ ‖A‖ * (∫ u : ℝ, ‖F u‖) := +- mul_le_mul_of_nonneg_left hdom (by simp) +- +-lemma fourier_decay_of_CS2 +- (ψ : CS 2 ℂ) : +- ∃ C : ℝ, ∀ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by +- let ψ' : W21 := (ψ : W21) +- obtain ⟨C, hC⟩ : +- ∃ C : ℝ, ∀ u : ℝ, ‖𝓕 (ψ' : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by +- simpa using (decay_bounds_cor (ψ := ψ')) +- refine ⟨C, ?_⟩ +- intro u +- simpa [ψ'] using! (hC u) +- +-lemma integrable_norm_fourier_scaled_of_CS2 +- (ψ : CS 2 ℂ) : +- Integrable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by +- obtain ⟨C, hdecay⟩ := fourier_decay_of_CS2 (ψ := ψ) +- have hC_nonneg : 0 ≤ C := by +- have h0 := hdecay 0 +- have hnorm : 0 ≤ ‖𝓕 (ψ : ℝ → ℂ) 0‖ := norm_nonneg _ +- have hC' : ‖𝓕 (ψ : ℝ → ℂ) 0‖ ≤ C := by simpa using h0 +- exact hnorm.trans hC' +- have hmaj_int : Integrable (fun u : ℝ => (C : ℝ) / (1 + (u / (2 * Real.pi))^2)) := by +- have hbase : Integrable (fun u : ℝ => (1 + u ^ 2)⁻¹) := integrable_inv_one_add_sq +- have hscale : +- Integrable (fun u : ℝ => (1 + (u / (2 * Real.pi)) ^ 2)⁻¹) := +- hbase.comp_div (by nlinarith [Real.pi_pos]) +- simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, pow_two] using +- hscale.const_mul C +- have hle : +- (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) +- ≤ᵐ[volume] +- (fun u : ℝ => (C : ℝ) / (1 + (u / (2 * Real.pi))^2)) := by +- refine Filter.Eventually.of_forall ?_ +- intro u +- simpa using (hdecay (u / (2 * Real.pi))) +- have hle_norm : +- (fun u : ℝ => ‖‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖‖) +- ≤ᵐ[volume] +- (fun u : ℝ => ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖) := by +- refine hle.mono ?_ +- intro u hu +- have hden_pos : 0 < 1 + (u / (2 * Real.pi)) ^ 2 := by nlinarith +- have hnonneg : 0 ≤ (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := +- div_nonneg hC_nonneg hden_pos.le +- have hleft_nonneg : 0 ≤ ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖ := norm_nonneg _ +- have hbound : ‖‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖‖ ≤ +- (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := by +- simpa [Real.norm_eq_abs, abs_of_nonneg hleft_nonneg] using hu +- have hC_abs : |C| = C := abs_of_nonneg hC_nonneg +- have hden_abs : |1 + (u / (2 * Real.pi))^2| = 1 + (u / (2 * Real.pi))^2 := by +- have : 0 ≤ 1 + (u / (2 * Real.pi))^2 := by nlinarith +- simpa using abs_of_nonneg this +- have hnorm : +- ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖ = +- (C : ℝ) / (1 + (u / (2 * Real.pi))^2) := by +- have hrec : +- ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖ = +- |C| / |1 + (u / (2 * Real.pi))^2| := by +- simp [Real.norm_eq_abs] +- simp [hC_abs, hden_abs, hrec] +- simpa [hnorm] using hbound +- have hmaj_int_norm : +- Integrable (fun u : ℝ => ‖(C : ℝ) / (1 + (u / (2 * Real.pi))^2)‖) := +- hmaj_int.norm +- have hmeas : +- AEStronglyMeasurable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by +- have hcont : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) u := by +- simpa using! continuous_FourierIntegral (ψ : W21) +- have hcont_scaled : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) := +- hcont.comp (by continuity) +- exact hcont_scaled.aestronglyMeasurable.norm +- exact hmaj_int_norm.mono' hmeas hle_norm +- +-lemma exists_bound_norm_G_on_tsupport +- (hG : ContinuousOn G {s : ℂ | 1 ≤ s.re}) +- (ψ : CS 2 ℂ) : +- ∃ K : ℝ, ∀ t : ℝ, t ∈ tsupport (ψ : ℝ → ℂ) → +- ‖G (1 + t * Complex.I)‖ ≤ K := by +- let s : Set ℝ := tsupport (ψ : ℝ → ℂ) +- have hscompact : IsCompact s := by +- simpa [s] using (ψ.h2.isCompact : IsCompact (tsupport (ψ : ℝ → ℂ))) +- have hphi_cont : Continuous (fun t : ℝ => (1 : ℂ) + t * Complex.I) := by continuity +- have hphi_maps : +- Set.MapsTo (fun t : ℝ => (1 : ℂ) + t * Complex.I) s {z : ℂ | 1 ≤ z.re} := by +- intro t ht +- simp +- have hGcomp : ContinuousOn (fun t : ℝ => G ((1 : ℂ) + t * Complex.I)) s := +- hG.comp hphi_cont.continuousOn hphi_maps +- have hnorm_contOn : ContinuousOn (fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) s := hGcomp.norm +- have hbdd : BddAbove ((fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s) := +- (hscompact.image_of_continuousOn hnorm_contOn).bddAbove +- refine ⟨sSup ((fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s), ?_⟩ +- intro t ht +- have : ‖G ((1 : ℂ) + t * Complex.I)‖ ∈ +- (fun t : ℝ => ‖G ((1 : ℂ) + t * Complex.I)‖) '' s := ⟨t, ht, rfl⟩ +- exact le_csSup hbdd this +- +-lemma norm_integrand_le_K_mul_norm_psi +- {x K : ℝ} +- (hx : 0 < x) +- (hK : ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K) : +- ∀ t : ℝ, +- ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ ≤ K * ‖ψ t‖ := by +- intro t +- by_cases ht : t ∈ Function.support ψ +- · have hxnorm : ‖((x : ℂ) ^ (t * Complex.I))‖ = 1 := norm_x_cpow_it x t hx +- calc +- ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ +- = ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ * ‖((x : ℂ) ^ (t * Complex.I))‖ := by +- simp [mul_left_comm, mul_comm] +- _ = ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ * 1 := by simp [hxnorm] +- _ ≤ K * ‖ψ t‖ := by +- have hGle : ‖G (1 + t * Complex.I)‖ ≤ K := hK t ht +- have : ‖G (1 + t * Complex.I)‖ * ‖ψ t‖ ≤ K * ‖ψ t‖ := +- mul_le_mul_of_nonneg_right hGle (norm_nonneg _) +- simpa [mul_assoc, mul_left_comm, mul_comm] using this +- · have hψ0 : ψ t = 0 := by +- by_contra hψ0 +- exact ht (by simpa [Function.support] using hψ0) +- simp [hψ0, mul_comm] +- +- +-lemma norm_error_integral_le +- (ψ : ℝ → ℂ) (x K : ℝ) +- (hGline_meas : Measurable (fun t : ℝ => G (1 + t * I))) +- (hψ_meas : AEStronglyMeasurable ψ) +- (hx : 0 < x) +- (hK : ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K) +- (hψ : Integrable (fun t : ℝ => ‖ψ t‖) ) : +- ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ +- ≤ K * (∫ t : ℝ, ‖ψ t‖) := by +- have h1 : ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ +- ≤ ∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ := by +- simpa using (norm_integral_le_integral_norm +- (f := fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I)))) +- have hmeas_main : AEStronglyMeasurable +- (fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))) := by +- have hG' : AEMeasurable fun t : ℝ => G (1 + t * Complex.I) := hGline_meas.aemeasurable +- have hψ_meas' : AEMeasurable ψ := hψ_meas.aemeasurable +- have hx_ne : (x : ℂ) ≠ 0 := by exact_mod_cast (ne_of_gt hx) +- have hx_ne' : NeZero (x : ℂ) := ⟨hx_ne⟩ +- have hxpow_meas : AEMeasurable fun t : ℝ => ((x : ℂ) ^ (t * Complex.I)) := by +- have hcontℂ : Continuous fun z : ℂ => ((x : ℂ) ^ z) := +- continuous_const_cpow (z := (x : ℂ)) +- have hcont : Continuous fun t : ℝ => ((x : ℂ) ^ ((t : ℂ) * Complex.I)) := +- hcontℂ.comp (by +- have h : Continuous fun t : ℝ => (t : ℂ) * Complex.I := by +- simpa using! (continuous_ofReal.mul continuous_const) +- simpa [mul_comm] using h) +- exact hcont.measurable.aemeasurable +- have hGψ_meas : AEMeasurable fun t : ℝ => (G (1 + t * Complex.I)) * (ψ t) := hG'.mul hψ_meas' +- have htotal : AEMeasurable (fun t : ℝ => +- (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))) := +- hGψ_meas.mul hxpow_meas +- exact htotal.aestronglyMeasurable +- have hpt : (fun t : ℝ => +- ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) +- ≤ᵐ[volume] (fun t : ℝ => K * ‖ψ t‖) := by +- refine Eventually.of_forall ?_ +- intro t +- exact norm_integrand_le_K_mul_norm_psi (hx := hx) (hK := hK) t +- have hR : Integrable (fun t : ℝ => K * ‖ψ t‖) := hψ.const_mul K +- have hL : Integrable (fun t : ℝ => +- ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) := by +- have hpt_norm : +- (fun t : ℝ => ‖‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖‖) +- ≤ᵐ[volume] (fun t : ℝ => K * ‖ψ t‖) := hpt.mono (by +- intro t ht +- simpa [norm_mul, mul_comm, mul_left_comm, mul_assoc] using ht) +- exact hR.mono' hmeas_main.norm hpt_norm +- have h2 : (∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖) +- ≤ ∫ t : ℝ, K * ‖ψ t‖ := integral_mono_ae (μ := (volume : Measure ℝ)) hL hR hpt +- have h3 : (∫ t : ℝ, K * ‖ψ t‖) = K * (∫ t : ℝ, ‖ψ t‖) := by +- simp [integral_const_mul] +- calc +- ‖∫ t : ℝ, (G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ +- ≤ ∫ t : ℝ, ‖(G (1 + t * Complex.I)) * (ψ t) * ((x : ℂ) ^ (t * Complex.I))‖ := h1 +- _ ≤ ∫ t : ℝ, K * ‖ψ t‖ := h2 +- _ = K * (∫ t : ℝ, ‖ψ t‖) := h3 +- +- +- +-@[blueprint "crude-upper-bound" +- (title := "crude-upper-bound") +- (statement := /-- +- If $\psi: \R \to \C$ is $C^2$ and compactly supported with $f$ and $\hat \psi$ non-negative, then there exists a constant $B$ such that +- $$ |\sum_{n=1}^\infty \frac{f(n)}{n} \hat \psi( \frac{1}{2\pi} \log \frac{n}{x} )| \leq B$$ +- for all $x > 0$. +- -/) +- (proof := /-- This readily follows from the previous lemma and the triangle inequality. -/) +- (proofUses := ["limiting-fourier-variant"]) +- (latexEnv := "corollary")] +-lemma crude_upper_bound +- (hpos : 0 ≤ f) +- (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) +- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (ψ : CS 2 ℂ) +- (hψpos : ∀ y, 0 ≤ (𝓕 (ψ : ℝ → ℂ) y).re ∧ (𝓕 (ψ : ℝ → ℂ) y).im = 0) : +- ∃ B : ℝ, ∀ x : ℝ, 0 < x → ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ B := by +- +- -- Integrability of ψ +- have hψ_int : MeasureTheory.Integrable (ψ : ℝ → ℂ) := by +- simpa using (ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2) +- have hψ_norm_int : MeasureTheory.Integrable (fun t : ℝ => ‖(ψ : ℝ → ℂ) t‖) := +- hψ_int.norm +- have hψ_meas : MeasureTheory.AEStronglyMeasurable (ψ : ℝ → ℂ) := +- hψ_int.aestronglyMeasurable +- +- -- Uniform bound K for ‖G(1+it)‖ on support ψ +- rcases exists_bound_norm_G_on_tsupport (G := G) hG ψ with ⟨K, hK_ts⟩ +- have hK_support : +- ∀ t : ℝ, t ∈ Function.support (ψ : ℝ → ℂ) → ‖G (1 + t * Complex.I)‖ ≤ K := by +- have hbnG (hKts : ∀ t : ℝ, t ∈ tsupport ψ → ‖G (1 + t * Complex.I)‖ ≤ K) : +- ∀ t : ℝ, t ∈ Function.support ψ → ‖G (1 + t * Complex.I)‖ ≤ K := by +- intro t ht +- exact hKts t ((subset_tsupport ψ) ht) +- exact hbnG hK_ts +- +- -- Measurability of the line restriction t ↦ G(1 + t I) from continuity-on +- have hGline_meas : Measurable (fun t : ℝ => G (1 + t * Complex.I)) := by +- have hline_cont : Continuous (fun t : ℝ => (1 : ℂ) + t * Complex.I) := by +- continuity +- have hmem : ∀ t : ℝ, ((1 : ℂ) + t * Complex.I) ∈ {s : ℂ | 1 ≤ s.re} := by +- intro t +- simp +- have hcont : Continuous (G ∘ fun t : ℝ => (1 : ℂ) + t * Complex.I) := +- hG.comp_continuous hline_cont hmem +- simpa [Function.comp] using! hcont.measurable +- +- -- L¹ bound for the scaled Fourier transform norm +- have hF_norm_int : +- MeasureTheory.Integrable (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := +- integrable_norm_fourier_scaled_of_CS2 ψ +- have hF_meas : +- MeasureTheory.AEStronglyMeasurable +- (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := by +- have hcont : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) u := by +- simpa using! continuous_FourierIntegral (ψ : W21) +- have hcont_scaled : Continuous fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) := +- hcont.comp (by continuity) +- exact hcont_scaled.aestronglyMeasurable +- have hF_int : +- MeasureTheory.Integrable (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := +- by +- have hfin_norm : +- MeasureTheory.HasFiniteIntegral +- (fun u : ℝ => ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := +- hF_norm_int.hasFiniteIntegral +- have hfin : +- MeasureTheory.HasFiniteIntegral +- (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) := by +- simpa [MeasureTheory.hasFiniteIntegral_iff_norm] using hfin_norm +- exact ⟨hF_meas, hfin⟩ +- refine ⟨K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) +- + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖), ?_⟩ +- intro x hx +- set I : ℂ := ∫ u in Set.Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi)) with hI +- +- -- Lemma 12 +- have hlim := +- limiting_fourier_variant (f := f) (A := A) (G := G) +- hpos hG hG' hf ψ hψpos hx +- have hlim' : +- (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) +- - A * I +- = ∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I) := by +- simpa [hI] using hlim +- +- -- express the tsum as RHS + A*I +- have htsum : +- (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) +- = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := by +- have h' : +- (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log (n / x))) +- = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := +- eq_add_of_sub_eq hlim' +- simpa [add_comm, mul_comm, mul_left_comm, mul_assoc] using h' +- +- -- bound the RHS integral +- have hRHS_bound : +- ‖∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)‖ +- ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) := +- norm_error_integral_le (G := G) (ψ := (ψ : ℝ → ℂ)) (x := x) (K := K) +- hGline_meas hψ_meas hx hK_support hψ_norm_int +- +- -- bound the A * I term +- have hA_bound : +- ‖A * I‖ ≤ ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by +- have hF_on : MeasureTheory.IntegrableOn +- (fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) +- (Set.Ici (-Real.log x)) := +- hF_int.integrableOn +- simpa [hI] using +- norm_mul_integral_Ici_le_integral_norm (A := A) +- (F := fun u : ℝ => 𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))) +- (a := -Real.log x) hF_on hF_norm_int +- +- -- combine bounds +- have htsum_std : +- (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))) +- = (∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I := by +- simpa [one_div, mul_comm, mul_left_comm, mul_assoc] using htsum +- +- -- bound in the normalized form +- have hbound : +- ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) +- (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ +- ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) +- + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := by +- have hnorm : +- ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) +- (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ = +- ‖(∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I‖ := +- congrArg norm htsum_std +- calc +- ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) +- (1 / (2 * Real.pi) * Real.log ((n : ℝ) / x))‖ +- = ‖(∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)) + A * I‖ := hnorm +- _ ≤ ‖∫ (t : ℝ), (G (1 + t * Complex.I)) * (ψ t) * x ^ (t * Complex.I)‖ + ‖A * I‖ := +- norm_add_le _ _ +- _ ≤ K * (∫ t : ℝ, ‖(ψ : ℝ → ℂ) t‖) +- + ‖A‖ * (∫ u : ℝ, ‖𝓕 (ψ : ℝ → ℂ) (u / (2 * Real.pi))‖) := +- add_le_add hRHS_bound hA_bound +- exact hbound +- +-set_option backward.isDefEq.respectTransparency false in +-lemma Real.fourierIntegral_convolution {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) : +- 𝓕 (convolution f g (ContinuousLinearMap.mul ℂ ℂ) volume) = 𝓕 f * 𝓕 g := by +- ext y +- simp only [Pi.mul_apply, FourierTransform.fourier, MeasureTheory.convolution, +- VectorFourier.fourierIntegral, ContinuousLinearMap.mul_apply'] +- have h_int : Integrable (fun p : ℝ × ℝ ↦ 𝐞 (-(y * p.1)) • (f p.2 * g (p.1 - p.2))) := by +- simp only [Circle.smul_def, smul_eq_mul] +- refine (Integrable.convolution_integrand (ContinuousLinearMap.mul ℂ ℂ) hf hg).bdd_mul +- (c := 1) ?_ ?_ +- · exact (by continuity : Continuous _).aestronglyMeasurable +- · filter_upwards with p; simp +- calc ∫ v, 𝐞 (-(y * v)) • ∫ t, f t * g (v - t) +- = ∫ v, ∫ t, 𝐞 (-(y * v)) • (f t * g (v - t)) := by +- simp only [Circle.smul_def, smul_eq_mul, ← integral_const_mul] +- _ = ∫ t, ∫ v, 𝐞 (-(y * v)) • (f t * g (v - t)) := integral_integral_swap h_int +- _ = ∫ t, f t • ∫ v, 𝐞 (-(y * v)) • g (v - t) := by +- simp only [Circle.smul_def, smul_eq_mul, mul_left_comm, integral_const_mul] +- _ = ∫ t, f t • ∫ u, 𝐞 (-(y * (u + t))) • g u := by +- congr 1; ext t +- rw [← integral_add_right_eq_self (fun v ↦ 𝐞 (-(y * v)) • g (v - t)) t]; simp +- _ = ∫ t, f t • ∫ u, (𝐞 (-(y * t)) * 𝐞 (-(y * u))) • g u := by +- congr 2 with t; congr 1 +- simp only [mul_add, neg_add, mul_comm, Real.fourierChar.map_add_eq_mul] +- _ = ∫ t, 𝐞 (-(y * t)) • f t • ∫ u, 𝐞 (-(y * u)) • g u := by +- congr 1; ext t +- simp only [mul_smul, Circle.smul_def, smul_eq_mul, integral_const_mul]; ring +- _ = (∫ t, 𝐞 (-(y * t)) • f t) * ∫ u, 𝐞 (-(y * u)) • g u := by +- simp only [Circle.smul_def, smul_eq_mul, ← mul_assoc, integral_mul_const] +- +-lemma Real.fourierIntegral_conj_neg {f : ℝ → ℂ} (y : ℝ) : +- 𝓕 (fun x ↦ conj (f (-x))) y = conj (𝓕 f y) := by +- simp only [fourier_real_eq] +- have h_conj : ∀ x, 𝐞 (-(x * y)) • conj (f (-x)) = conj (𝐞 (x * y) • f (-x)) := fun x ↦ by +- simp only [Circle.smul_def, Real.fourierChar_apply, map_mul, smul_eq_mul, neg_mul, +- Complex.ofReal_neg, mul_neg] +- congr 1 +- rw [← Complex.exp_conj] +- simp only [map_mul, Complex.conj_I, Complex.conj_ofReal, mul_neg] +- calc ∫ x, 𝐞 (-(x * y)) • conj (f (-x)) +- = ∫ x, conj (𝐞 (x * y) • f (-x)) := by congr 1; ext x; exact h_conj x +- _ = conj (∫ x, 𝐞 (x * y) • f (-x)) := integral_conj +- _ = conj (∫ x, 𝐞 (-(x * y)) • f x) := by +- rw [← integral_neg_eq_self (fun x => 𝐞 (-(x * y)) • f x)] +- congr 2 with x; ring_nf +- +-/-- Smooth compactly supported function with non-negative Fourier transform via self-convolution. -/ +-lemma auto_cheby_exists_smooth_nonneg_fourier_kernel : +- ∃ (ψ : ℝ → ℂ), ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ +- (∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) ∧ 0 < (𝓕 ψ 0).re := by +- obtain ⟨φ_real, hφSmooth, hφCompact, hφIcc, _, hφsupp⟩ := +- smooth_urysohn_support_Ioo (a := 1/2) (b := 1) (c := 1) (d := 2) (by norm_num) (by norm_num) +- let φ : ℝ → ℂ := Complex.ofReal ∘ φ_real +- let φ_rev : ℝ → ℂ := fun x ↦ conj (φ (-x)) +- let ψ_fun : ℝ → ℂ := convolution φ φ_rev (ContinuousLinearMap.mul ℂ ℂ) volume +- have hφSmooth' : ContDiff ℝ ∞ φ := contDiff_ofReal.comp hφSmooth +- have hφCompact' : HasCompactSupport φ := hφCompact.comp_left rfl +- have hφRevSmooth : ContDiff ℝ ∞ φ_rev := Complex.conjCLE.contDiff.comp (hφSmooth'.comp contDiff_neg) +- have hφRevCompact : HasCompactSupport φ_rev := (hφCompact'.comp_homeomorph (Homeomorph.neg ℝ)).comp_left (by simp) +- have hφInt : Integrable φ := hφSmooth'.continuous.integrable_of_hasCompactSupport hφCompact' +- have hφRevInt : Integrable φ_rev := hφRevSmooth.continuous.integrable_of_hasCompactSupport hφRevCompact +- have hψSmooth : ContDiff ℝ ∞ ψ_fun := by +- convert! hφRevCompact.contDiff_convolution_right (ContinuousLinearMap.mul ℝ ℂ) +- (hφSmooth'.continuous.locallyIntegrable (μ := volume)) hφRevSmooth +- have hψCompact : HasCompactSupport ψ_fun := +- HasCompactSupport.convolution (ContinuousLinearMap.mul ℂ ℂ) hφCompact' hφRevCompact +- refine ⟨ψ_fun, hψSmooth, hψCompact, fun y ↦ ?_, ?_⟩ +- · rw [Real.fourierIntegral_convolution hφInt hφRevInt, Pi.mul_apply, +- Real.fourierIntegral_conj_neg y, mul_comm, ← Complex.normSq_eq_conj_mul_self] +- exact ⟨Complex.normSq_nonneg _, rfl⟩ +- · have hφ_nonneg : ∀ x, 0 ≤ φ_real x := fun x ↦ by +- have hx := hφIcc x; by_cases h : x ∈ Set.Icc (1:ℝ) 1 +- · simp only [Set.indicator_of_mem h, Pi.one_apply] at hx; linarith +- · simp only [Set.indicator_of_notMem h] at hx; exact hx +- have hvol_supp : (1 : ENNReal) ≤ volume (Function.support φ_real) := by +- have hsub : Set.Ico (1:ℝ) 2 ⊆ Function.support φ_real := fun x hx ↦ +- hφsupp.symm ▸ Set.mem_Ioo.mpr ⟨by linarith [hx.1], hx.2⟩ +- calc _ = volume (Set.Ico (1:ℝ) 2) := by simp [Real.volume_Ico]; norm_num +- _ ≤ _ := volume.mono hsub +- have hφint_pos : 0 < ∫ x, φ_real x := +- (integral_pos_iff_support_of_nonneg_ae (.of_forall hφ_nonneg) +- (hφSmooth.continuous.integrable_of_hasCompactSupport hφCompact)).2 +- (lt_of_lt_of_le (by simp) hvol_supp) +- have hFφ0_re : 0 < (𝓕 φ 0).re := by +- simp only [φ, fourier_real_eq, mul_zero, neg_zero, AddChar.map_zero_eq_one, one_smul, +- Function.comp_apply] +- have hint : Integrable (fun x => (φ_real x : ℂ)) := +- (hφSmooth.continuous.integrable_of_hasCompactSupport hφCompact).ofReal +- calc (∫ x, (φ_real x : ℂ)).re = ∫ x, (φ_real x : ℂ).re := (integral_re hint).symm +- _ = ∫ x, φ_real x := by simp only [Complex.ofReal_re] +- _ > 0 := hφint_pos +- rw [Real.fourierIntegral_convolution hφInt hφRevInt, Pi.mul_apply, +- Real.fourierIntegral_conj_neg 0, mul_comm, ← Complex.normSq_eq_conj_mul_self] +- exact Complex.normSq_pos.2 (fun h ↦ (ne_of_gt hFφ0_re) (by simp [h])) +- +- +-/-- The series `∑ f(n)/n · 𝓕ψ(log(n/x)/(2π))` is summable for `x ≥ 1`. -/ +-lemma auto_cheby_fourier_summable (hpos : 0 ≤ f) (hf : ∀ σ', 1 < σ' → Summable (nterm f σ')) +- (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) +- (ψ : ℝ → ℂ) (hψSmooth : ContDiff ℝ ∞ ψ) (hψCompact : HasCompactSupport ψ) +- (hψpos : ∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) (x : ℝ) (hx : 1 ≤ x) : +- Summable fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x)) := by +- let ψCS : CS 2 ℂ := ⟨ψ, hψSmooth.of_le (by norm_cast), hψCompact⟩ +- let S : ℝ → ℂ := fun σ' ↦ ∑' n, term (f · : ℕ → ℂ) σ' n * 𝓕 ψCS.toFun (1 / (2 * π) * Real.log (n / x)) +- let Pole : ℝ → ℂ := fun σ' ↦ (A : ℂ) * (x ^ (1 - σ') : ℝ) * +- ∫ u in Set.Ici (-Real.log x), (rexp (-u * (σ' - 1)) : ℂ) * 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π)) +- let RHS : ℝ → ℂ := fun σ' ↦ ∫ t : ℝ, G (σ' + t * I) * ψCS.toFun t * (x : ℂ) ^ (t * I) +- have l2 := limiting_fourier_lim2 (A := A) (x := x) ψCS hx +- have l3 := limiting_fourier_lim3 (G := G) hG ψCS hx +- have haux : (fun σ' ↦ S σ' - Pole σ') =ᶠ[𝓝[>] 1] RHS := eventually_nhdsWithin_of_forall fun σ' hσ' ↦ by +- simpa [S, Pole, RHS] using! limiting_fourier_aux hG' hf ψCS hx σ' hσ' +- have hS_tendsto : Tendsto S (𝓝[>] 1) (𝓝 (RHS 1 + A * ∫ u in Set.Ici (-Real.log x), +- 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π)))) := by +- convert! (l3.congr' haux.symm).add l2 using 1; ext σ'; simp [S, Pole] +- have hbounded : BoundedAtFilter (𝓝[>] 1) (fun σ' ↦ ‖S σ'‖) := by +- simp only [BoundedAtFilter] +- let L := ‖RHS 1 + A * ∫ u in Set.Ici (-Real.log x), 𝓕 (W21.ofCS2 ψCS).toFun (u / (2 * π))‖ +- have : ∀ᶠ σ' in 𝓝[>] 1, ‖S σ'‖ < L + 1 := +- hS_tendsto.norm.eventually_lt tendsto_const_nhds (lt_add_one L) +- exact Asymptotics.IsBigO.of_bound (L + 1) (by filter_upwards [this] with σ h; simpa using h.le) +- let y : ℕ → ℝ := fun n ↦ (1 / (2 * π)) * Real.log (n / x) +- let w : ℕ → ℝ := fun n ↦ (𝓕 ψCS.toFun (y n)).re +- have hw : ∀ n, 0 ≤ w n := fun n ↦ (hψpos (y n)).1 +- let rt : ℝ → ℕ → ℝ := fun σ n ↦ if n = 0 then 0 else f n / (n : ℝ) ^ σ * w n +- have rt_nn σ n : 0 ≤ rt σ n := by +- simp only [rt]; split_ifs with hn +- · rfl +- · exact mul_nonneg (div_nonneg (hpos n) (Real.rpow_pos_of_pos (Nat.cast_pos.mpr +- (Nat.pos_of_ne_zero hn)) σ).le) (hw n) +- have hS_eq σ' (hσ' : 1 < σ') : S σ' = ↑(∑' n, rt σ' n) := by +- rw [Complex.ofReal_tsum]; apply tsum_congr; intro n +- simp only [rt, term, LSeries.term, y, w, one_div, mul_inv_rev] +- split_ifs with hn <;> simp only [hn, CharP.cast_eq_zero, Complex.ofReal_zero, zero_mul, +- Complex.ofReal_mul, Complex.ofReal_div] +- rw [Complex.ofReal_cpow (Nat.cast_nonneg n)]; congr 1 +- exact Complex.ext rfl (hψpos _).2 +- have hMono n : AntitoneOn (fun σ ↦ rt σ n) (Set.Ioi 1) := fun σ₁ _ σ₂ _ h ↦ by +- simp only [rt]; split_ifs with hn; · rfl +- apply mul_le_mul_of_nonneg_right _ (hw n) +- apply div_le_div_of_nonneg_left (hpos n) (Real.rpow_pos_of_pos (Nat.cast_pos.mpr +- (Nat.pos_of_ne_zero hn)) σ₁) +- exact Real.rpow_le_rpow_of_exponent_le (Nat.one_le_cast.mpr (Nat.pos_of_ne_zero hn)) h +- have hT_bdd : BoundedAtFilter (𝓝[>] 1) fun σ ↦ ∑' n, rt σ n := by +- rw [BoundedAtFilter, Asymptotics.isBigO_iff] at hbounded ⊢ +- obtain ⟨C, hC⟩ := hbounded +- refine ⟨C, ?_⟩ +- filter_upwards [hC, self_mem_nhdsWithin] with σ hnorm hσ +- rw [hS_eq σ hσ] at hnorm; simpa using hnorm +- have hSumm σ (hσ : 1 < σ) : Summable (rt σ ·) := by +- simpa [rt, w, y] using limiting_fourier_variant_lim1_aux ψCS hpos hf hψpos σ hσ +- have hSumm_1 : Summable (rt 1 ·) := by +- let σ_seq : ℕ → ℝ := fun k ↦ 1 + 1 / ((k : ℝ) + 1) +- have hσ_gt k : 1 < σ_seq k := by simp only [σ_seq, lt_add_iff_pos_right, one_div]; positivity +- have h_tendsto : Tendsto σ_seq atTop (𝓝[>] 1) := by +- rw [tendsto_nhdsWithin_iff] +- refine ⟨?_, by filter_upwards with k; exact hσ_gt k⟩ +- have : Tendsto (fun k : ℕ ↦ 1 / ((k : ℝ) + 1)) atTop (𝓝 0) := by +- simp only [one_div]; exact (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds).inv_tendsto_atTop +- simpa [σ_seq] using tendsto_const_nhds.add this +- have h_ptwise n : Tendsto (fun k ↦ rt (σ_seq k) n) atTop (𝓝 (rt 1 n)) := by +- simp only [rt]; split_ifs with hn; · exact tendsto_const_nhds +- refine ((tendsto_const_nhds.rpow (tendsto_nhdsWithin_iff.mp h_tendsto).1 (Or.inl ?_)).inv₀ +- (by simp [hn])).const_mul (f n) |>.mul_const (w n) +- exact (Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)).ne' +- obtain ⟨C, hC⟩ := Asymptotics.isBigO_iff.mp (hT_bdd.comp_tendsto h_tendsto) +- refine summable_of_sum_range_le (c := C) (rt_nn 1) fun m ↦ le_of_tendsto (tendsto_finsetSum _ +- fun i _ ↦ h_ptwise i) ?_ +- filter_upwards [h_tendsto.eventually self_mem_nhdsWithin, hC] with k hk hCk +- calc ∑ i ∈ Finset.range m, rt (σ_seq k) i +- ≤ ∑' n, rt (σ_seq k) n := (hSumm _ hk).sum_le_tsum _ fun n _ ↦ rt_nn _ n +- _ ≤ |∑' n, rt (σ_seq k) n| := le_abs_self _ +- _ ≤ C := by simpa using hCk +- rw [show (fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x))) = +- Complex.ofRealCLM ∘ (rt 1 ·) from ?_] +- · exact hSumm_1.map Complex.ofRealCLM Complex.ofRealCLM.continuous +- ext n; simp only [rt, Real.rpow_one, one_div, w, y, Function.comp_apply] +- split_ifs with hn; · simp [hn] +- have him0 : (𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x))).im = 0 := (hψpos _).2 +- have hre_eq : 𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x)) = +- Complex.ofReal ((𝓕 ψCS.toFun ((2 * π)⁻¹ * Real.log (n / x))).re) := by +- rw [← Complex.re_add_im (𝓕 ψCS.toFun _), him0]; simp +- conv_lhs => rw [show ψ = ψCS.toFun from rfl, hre_eq] +- simp only [Complex.ofRealCLM_apply, Complex.ofReal_div, Complex.ofReal_mul, Complex.ofReal_natCast] +- +-/-- Short interval bound from global filtered bound: if `∑ f(n)/n · 𝓕ψ(log(n/x)) ≤ B`, +-then `∑_{(1-ε)x < n ≤ x} f(n) ≤ Cx` for some `ε, C > 0`. -/ +-lemma auto_cheby_short_interval_bound (hpos : 0 ≤ f) +- (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) +- (B : ℝ) (ψ : ℝ → ℂ) (hψSmooth : ContDiff ℝ ∞ ψ) (hψCompact : HasCompactSupport ψ) +- (hψpos : ∀ y, 0 ≤ (𝓕 ψ y).re ∧ (𝓕 ψ y).im = 0) (hψ0 : 0 < (𝓕 ψ 0).re) +- (hB_bound : ∀ x ≥ 1, ‖∑' n, f n / n * 𝓕 ψ (1 / (2 * Real.pi) * Real.log (n / x))‖ ≤ B) : +- ∃ (ε : ℝ) (C : ℝ), ε > 0 ∧ ε < 1 ∧ C > 0 ∧ ∀ x ≥ 1, +- ∑' n, (f n) * (Set.indicator (Set.Ioc ((1 - ε) * x) x) (fun _ ↦ 1) (n : ℝ)) ≤ C * x := by +- have hF : Continuous (𝓕 ψ) := VectorFourier.fourierIntegral_continuous Real.continuous_fourierChar +- (by continuity) (hψSmooth.continuous.integrable_of_hasCompactSupport hψCompact) +- have hg : Continuous fun y ↦ (𝓕 ψ y).re := Complex.continuous_re.comp hF +- obtain ⟨δ, hδpos, hball⟩ := Metric.mem_nhds_iff.1 <| +- hg.continuousAt.preimage_mem_nhds (IsOpen.mem_nhds isOpen_Ioi (half_lt_self hψ0)) +- let c := (𝓕 ψ 0).re / 2 +- have hcpos : 0 < c := by dsimp only [c]; linarith +- have h_psi_ge_c : ∀ y, |y| < δ → c ≤ (𝓕 ψ y).re := fun y hy ↦ (hball (mem_ball_zero_iff.mpr hy)).le +- let ε := 1 - Real.exp (-2 * π * δ) +- have hε : 0 < ε ∧ ε < 1 := by +- have h1 : Real.exp (-2 * π * δ) < 1 := Real.exp_lt_one_iff.mpr (by nlinarith [Real.pi_pos]) +- exact ⟨by simp only [ε]; linarith, by simp only [ε]; linarith [Real.exp_pos (-2 * π * δ)]⟩ +- have hB_nonneg : 0 ≤ B := (norm_nonneg _).trans (hB_bound 1 le_rfl) +- refine ⟨ε, B / c + 1, hε.1, hε.2, by positivity, fun x hx ↦ ?_⟩ +- have h_summable : Summable fun n ↦ (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x)) := +- auto_cheby_fourier_summable hpos hf hG hG' ψ hψSmooth hψCompact hψpos x hx +- have hx_pos : 0 < x := by linarith +- have h_sum_lower : c / x * ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ) +- ≤ ∑' n, f n / n * (𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re := by +- rw [← tsum_mul_left] +- refine Summable.tsum_le_tsum (fun n ↦ ?_) ?_ ?_ +- · by_cases hn : (n : ℝ) ∈ Set.Ioc ((1 - ε) * x) x +- · rw [Set.indicator_of_mem hn, Pi.one_apply, mul_one] +- have hn_pos : 0 < (n : ℝ) := by nlinarith [hn.1, hε.2] +- let y := (1 / (2 * π)) * Real.log (n / x) +- have h_arg_small : |y| < δ := by +- have h2pi : 0 < 2 * π := by linarith [Real.pi_pos] +- simp only [y, abs_mul, abs_div, abs_one, abs_of_pos h2pi] +- field_simp [ne_of_gt h2pi]; rw [mul_comm, abs_lt] +- have h_log_lower : -2 * π * δ < Real.log (n / x) := by +- rw [← Real.log_exp (-2 * π * δ), Real.log_lt_log_iff (Real.exp_pos _) (by positivity)] +- have : Real.exp (-2 * π * δ) = 1 - ε := by simp only [ε]; ring +- rw [this]; field_simp; exact hn.1 +- have h_log_upper : Real.log (n / x) ≤ 0 := +- Real.log_nonpos (by positivity) (div_le_one_of_le₀ hn.2 hx_pos.le) +- constructor <;> nlinarith [Real.pi_pos] +- have h1 : x⁻¹ ≤ (n : ℝ)⁻¹ := by rw [inv_le_inv₀ hx_pos hn_pos]; exact hn.2 +- have h2 : c ≤ (𝓕 ψ y).re := h_psi_ge_c y h_arg_small +- have hfn : 0 ≤ f n := hpos n +- have hre : 0 ≤ (𝓕 ψ y).re := (hψpos y).1 +- have hn_inv : 0 ≤ (n : ℝ)⁻¹ := inv_nonneg.mpr hn_pos.le +- calc c / x * f n = c * x⁻¹ * f n := by rw [div_eq_mul_inv] +- _ ≤ c * (n : ℝ)⁻¹ * f n := by gcongr +- _ ≤ (𝓕 ψ y).re * (n : ℝ)⁻¹ * f n := by gcongr +- _ = (n : ℝ)⁻¹ * (𝓕 ψ y).re * f n := by ring +- _ = f n / n * (𝓕 ψ y).re := by ring +- · rw [Set.indicator_of_notMem hn, mul_zero, mul_zero] +- exact mul_nonneg (div_nonneg (hpos n) (Nat.cast_nonneg n)) (hψpos _).1 +- · refine summable_of_hasFiniteSupport <| (Set.finite_le_nat ⌊x⌋₊).subset fun n hn ↦ ?_ +- simp only [Function.mem_support, ne_eq, mul_eq_zero, not_or, Set.indicator_apply_ne_zero] at hn +- exact Nat.le_floor hn.2.2.1.2 +- · rw [← Complex.summable_ofReal]; convert h_summable using 1; ext n +- rw [Complex.ofReal_mul, Complex.ofReal_div] +- norm_cast +- rw [Complex.ofReal_mul] +- congr 1 +- apply Complex.ext +- · simp only [Complex.ofReal_re] +- · simp only [Complex.ofReal_im]; exact (hψpos _).2.symm +- have h_real_eq : ∑' n, f n / n * (𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re = +- (∑' n, (f n : ℂ) / n * 𝓕 ψ (1 / (2 * π) * Real.log (n / x))).re := by +- rw [Complex.re_tsum h_summable]; congr with n +- rw [Complex.mul_re]; norm_cast; simp only [zero_mul, sub_zero] +- calc ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ) +- = x / c * (c / x * ∑' n, f n * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (n : ℝ)) := by +- field_simp [ne_of_gt hcpos, ne_of_gt hx_pos] +- _ ≤ x / c * B := by +- gcongr; rw [h_real_eq] at h_sum_lower +- exact h_sum_lower.trans ((Complex.re_le_norm _).trans (hB_bound x hx)) +- _ = (B / c) * x := by field_simp [ne_of_gt hcpos] +- _ ≤ (B / c + 1) * x := by nlinarith +- +-/-- Bootstraps short interval bounds to global Chebyshev bound via strong induction. +-If `∑_{(1-ε)x < n ≤ x} f(n) ≤ Cx` for all `x ≥ 1`, then `∑_{n ≤ x} f(n) = O(x)`. -/ +-lemma auto_cheby_bootstrap_induction (hpos : 0 ≤ f) +- (h_short : ∃ (ε : ℝ) (C : ℝ), ε > 0 ∧ ε < 1 ∧ C > 0 ∧ ∀ x ≥ 1, +- ∑' n, (f n) * (Set.indicator (Set.Ioc ((1 - ε) * x) x) (fun _ ↦ 1) (n : ℝ)) ≤ C * x) : +- cheby f := by +- obtain ⟨ε, C₀, hε, hε1, hC₀, h_bound⟩ := h_short +- let C := C₀ / ε + f 0 + 1 +- have hf0 : (0 : ℝ) ≤ f 0 := hpos 0 +- have hdiv : 0 ≤ C₀ / ε := div_nonneg hC₀.le hε.le +- have hC : 0 ≤ C := by linarith +- refine ⟨C, fun n ↦ ?_⟩ +- induction n using Nat.strong_induction_on with | h n ih => +- rcases lt_or_ge n 2 with hn | hn +- · interval_cases n +- · simp [cumsum] +- · simp only [cumsum, Finset.sum_range_one, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hf0, +- Nat.cast_one, mul_one, C] +- linarith +- let x := (n : ℝ) - 1 +- have hx : x ≥ 1 := by simp only [x, ge_iff_le, le_sub_iff_add_le]; norm_cast +- let m := ⌊(1 - ε) * x⌋₊ + 1 +- have hm_lt : m < n := by +- simp only [m, x] +- have h1 : (1 - ε) * (n - 1 : ℝ) < (n - 1 : ℕ) := by +- calc (1 - ε) * (↑n - 1) < 1 * (↑n - 1) := by gcongr; linarith +- _ = ↑n - 1 := by ring +- _ = ↑(n - 1) := by simp [Nat.cast_sub (by omega : 1 ≤ n)] +- have h2 : ⌊(1 - ε) * (n - 1 : ℝ)⌋₊ < n - 1 := +- (Nat.floor_lt (mul_nonneg (by linarith) (by linarith : (0 : ℝ) ≤ n - 1))).mpr h1 +- omega +- have hm_gt : (m : ℝ) > (1 - ε) * x := by +- simp only [m, Nat.cast_add, Nat.cast_one, gt_iff_lt] +- exact Nat.lt_floor_add_one ((1 - ε) * x) +- have h_decomp : cumsum (fun k ↦ ‖(f k : ℂ)‖) n = cumsum (fun k ↦ ‖(f k : ℂ)‖) m + ∑ k ∈ Finset.Ico m n, f k := by +- simp only [cumsum, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hpos _), +- Finset.sum_range_add_sum_Ico _ (by omega : m ≤ n)] +- have h_Ico : ∑ k ∈ Finset.Ico m n, f k ≤ C₀ * x := by +- calc ∑ k ∈ Finset.Ico m n, f k +- = ∑ k ∈ Finset.Ico m n, f k * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (k : ℝ) := by +- refine Finset.sum_congr rfl fun k hk ↦ ?_ +- have ⟨hkm, hkn⟩ := Finset.mem_Ico.mp hk +- have hk_gt : (k : ℝ) > (1 - ε) * x := by linarith [hm_gt, (Nat.cast_le (α := ℝ)).mpr hkm] +- have hk_le : (k : ℝ) ≤ x := by +- have h1 : k ≤ n - 1 := Nat.le_pred_of_lt hkn +- have h2 : (k : ℝ) ≤ (n - 1 : ℕ) := by exact_mod_cast h1 +- simp only [Nat.cast_sub (by omega : 1 ≤ n), Nat.cast_one, x] at h2 ⊢; exact h2 +- simp only [Set.indicator_of_mem (Set.mem_Ioc.mpr ⟨hk_gt, hk_le⟩), Pi.one_apply, mul_one] +- _ ≤ ∑' k, f k * Set.indicator (Set.Ioc ((1 - ε) * x) x) 1 (k : ℝ) := by +- refine Summable.sum_le_tsum _ (fun k _ ↦ mul_nonneg (hpos k) (Set.indicator_nonneg (by simp) _)) ?_ +- refine summable_of_hasFiniteSupport <| (Set.finite_le_nat ⌊x⌋₊).subset fun k hk ↦ ?_ +- simp only [Function.mem_support, ne_eq, mul_eq_zero, not_or, Set.indicator_apply_ne_zero] at hk +- exact Nat.le_floor hk.2.1.2 +- _ ≤ C₀ * x := h_bound x hx +- have hm_le : (m : ℝ) ≤ (1 - ε) * x + 1 := by +- have hpos' : 0 ≤ (1 - ε) * x := mul_nonneg (by linarith) (by linarith : (0 : ℝ) ≤ x) +- simp only [m, Nat.cast_add, Nat.cast_one] +- linarith [Nat.floor_le hpos'] +- have hnorm : ∀ k, ‖(f k : ℂ)‖ = f k := fun k ↦ by simp [abs_of_nonneg (hpos k)] +- simp only [hnorm] at h_decomp ih ⊢ +- calc cumsum f n = cumsum f m + ∑ k ∈ Finset.Ico m n, f k := h_decomp +- _ ≤ C * m + C₀ * x := by linarith [ih m hm_lt, h_Ico] +- _ ≤ C * ((1 - ε) * x + 1) + C₀ * x := by nlinarith [hC] +- _ = (C * (1 - ε) + C₀) * x + C := by ring +- _ ≤ C * x + C := by +- have : C₀ ≤ C * ε := by +- calc C₀ = (C₀ / ε) * ε := by field_simp [ne_of_gt hε] +- _ ≤ (C₀ / ε + f 0 + 1) * ε := by gcongr; linarith [hpos 0] +- _ = C * ε := by simp only [C] +- nlinarith [hε, hε1, hx] +- _ ≤ C * n := by simp only [x]; ring_nf; linarith [hC] +- +-@[blueprint "auto-cheby" +- (title := "auto-cheby") +- (statement := /-- One has $$ \sum_{n \leq x} f(n) = O(x)$$ for all $x \geq 1$. -/) +- (proof := /-- +- By applying Corollary \ref{crude-upper-bound} for a specific compactly supported function $\psi$, +- one can obtain a bound of the form $\sum_{(1-\varepsilon)x < n \leq x} f(n) = O(x)$ for all $x$ +- and some absolute constant $\varepsilon$ (which can be made explicit). +- +- If $C$ is a sufficiently large constant, the claim $|\sum_{n \leq x} f(n)| \leq Cx$ can now be +- proven by strong induction on $x$, as the claim for $(1-\varepsilon)x$ implies the claim for $x$ +- by the triangle inequality (and the claim is trivial for $x < 1$). +- -/) +- (proofUses := ["crude-upper-bound", "WienerIkehara"]) +- (latexEnv := "corollary")] +-lemma auto_cheby (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : cheby f := by +- obtain ⟨ψ_fun, hψSmooth, hψCompact, hψpos, hψ0⟩ := auto_cheby_exists_smooth_nonneg_fourier_kernel +- obtain ⟨B, hB⟩ := crude_upper_bound hpos hG hG' hf ⟨ψ_fun, hψSmooth.of_le ENat.LEInfty.out, hψCompact⟩ hψpos +- exact auto_cheby_bootstrap_induction hpos <| auto_cheby_short_interval_bound hpos hf hG hG' B ψ_fun +- hψSmooth hψCompact hψpos hψ0 fun x hx ↦ hB x (by linarith) +- +-@[blueprint "WienerIkehara2" +- (title := "Wiener-Ikehara Theorem (2)") +- (statement := /-- We have $$ \sum_{n\leq x} f(n) = A x + o(x).$$ -/) +- (proof := /-- Use Corollary \ref{auto-cheby} to remove the Chebyshev hypothesis in Theorem \ref{WienerIkehara}. -/) +- (latexEnv := "theorem")] +-theorem WienerIkeharaTheorem'' (hpos : 0 ≤ f) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) +- (hG : ContinuousOn G {s | 1 ≤ s.re}) +- (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : +- Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := +- WienerIkeharaTheorem' hpos hf (auto_cheby (f := f) (A := A) (G := G) hpos hf hG hG') hG hG' +- +-end auto_cheby +- +-blueprint_comment /-- +-\section{The prime number theorem in arithmetic progressions} +--/ +- +-@[blueprint "WeakPNT-character" +- (title := "WeakPNT-character") +- (statement := /-- +- If $q ≥ 1$ and $a$ is coprime to $q$, and $\mathrm{Re} s > 1$, we have +- $$ +- \sum_{n: n = a\ (q)} \frac{\Lambda(n)}{n^s} = - \frac{1}{\varphi(q)} \sum_{\chi\ (q)} +- \overline{\chi(a)} \frac{L'(s,\chi)}{L(s,\chi)}.$$ +- -/) +- (proof := /-- +- From the Fourier inversion formula on the multiplicative group $(\Z/q\Z)^\times$, we have +- $$ 1_{n=a\ (q)} = \frac{\varphi(q)}{q} \sum_{\chi\ (q)} \overline{\chi(a)} \chi(n).$$ +- On the other hand, from standard facts about L-series we have for each character $\chi$ that +- $$ +- \sum_{n} \frac{\Lambda(n) \chi(n)}{n^s} = - \frac{L'(s,\chi)}{L(s,\chi)}.$$ +- Combining these two facts, we obtain the claim. +- -/) +- (latexEnv := "lemma")] +-theorem WeakPNT_character +- {q a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) {s : ℂ} (hs : 1 < s.re) : +- LSeries (fun n ↦ if n % q = a then Λ n else 0) s = +- - (∑' χ : DirichletCharacter ℂ q, +- ((starRingEnd ℂ) (χ a) * ((deriv (LSeries (fun n:ℕ ↦ χ n)) s)) / +- (LSeries (fun n:ℕ ↦ χ n) s))) / (Nat.totient q : ℂ) := by +- have : NeZero q := ⟨by omega⟩ +- convert vonMangoldt.LSeries_residueClass_eq ((ZMod.isUnit_iff_coprime a q).mpr ha) hs using 1 +- · congr with n +- have : n % q = a ↔ (n : ZMod q) = a := by +- rw [ZMod.natCast_eq_natCast_iff', Nat.mod_eq_of_lt ha'] +- simp [this] +- split_ifs <;> simp [*] +- · rw [div_eq_inv_mul, neg_mul_comm, tsum_fintype] +- congr 3 with χ +- rw [DirichletCharacter.deriv_LFunction_eq_deriv_LSeries _ hs, +- DirichletCharacter.LFunction_eq_LSeries _ hs, mul_div] +- congr 2 +- rw [starRingEnd_apply, MulChar.star_apply', MulChar.inv_apply_eq_inv', +- ← ZMod.coe_unitOfCoprime a ha, ZMod.inv_coe_unit, map_units_inv] +- +- +-@[blueprint "WeakPNT-AP-prelim" +- (title := "WeakPNT-AP-prelim") +- (statement := /-- +- If $q ≥ 1$ and $a$ is coprime to $q$, the Dirichlet series +- $\sum_{n \leq x: n = a\ (q)} \frac{\Lambda(n)}{n^s}$ converges for $\mathrm{Re}(s) > 1$ to +- $\frac{1}{\varphi(q)} \frac{1}{s-1} + G(s)$ where $G$ has a continuous extension to +- $\mathrm{Re}(s)=1$. +- -/) +- (proof := /-- +- We expand out the left-hand side using Lemma \ref{WeakPNT-character}. The contribution of the +- non-principal characters $\chi$ extend continuously to $\mathrm{Re}(s) = 1$ thanks to the +- non-vanishing of $L(s,\chi)$ on this line (which should follow from another component of +- this project), so it suffices to show that for the principal character $\chi_0$, that +- $$ -\frac{L'(s,\chi_0)}{L(s,\chi_0)} - \frac{1}{s-1}$$ +- also extends continuously here. But we already know that +- $$ -\frac{\zeta'(s)}{\zeta(s)} - \frac{1}{s-1}$$ +- extends, and from Euler product machinery one has the identity +- $$ \frac{L'(s,\chi_0)}{L(s,\chi_0)} +- = \frac{\zeta'(s)}{\zeta(s)} + \sum_{p|q} \frac{\log p}{p^s-1}.$$ +- Since there are only finitely many primes dividing $q$, and each summand $\frac{\log p}{p^s-1}$ +- extends continuously, the claim follows. +- -/) +- (proofUses := ["ChebyshevPsi", "WeakPNT-character"]) +- (latexEnv := "proposition")] +-theorem WeakPNT_AP_prelim {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : Nat.Coprime a q) (ha' : a < q) : +- ∃ G: ℂ → ℂ, (ContinuousOn G {s | 1 ≤ s.re}) ∧ +- (Set.EqOn G (fun s ↦ LSeries (fun n ↦ if n % q = a then Λ n else 0) s - 1 / +- ((Nat.totient q) * (s - 1))) {s | 1 < s.re}) := by +- have : NeZero q := NeZero.of_pos hq +- have hG : ∃ G : ℂ → ℂ, ContinuousOn G {s | 1 ≤ s.re} ∧ Set.EqOn G +- (fun s ↦ LSeries (fun n ↦ if (n : ZMod q) = a then Λ n else 0) s - (q.totient : ℂ)⁻¹ / (s - 1)) {s | 1 < s.re} := by +- use vonMangoldt.LFunctionResidueClassAux (a : ZMod q), vonMangoldt.continuousOn_LFunctionResidueClassAux (q := q) (a := a) +- have := vonMangoldt.eqOn_LFunctionResidueClassAux ((ZMod.isUnit_iff_coprime a q).mpr ha) +- convert this using 6; split <;> simp_all +- convert hG using 6 +- · simp [ZMod.natCast_eq_natCast_iff', Nat.mod_eq_of_lt ha'] +- · rw [inv_eq_one_div, div_div] +- +-/-- The von Mangoldt function divided by `n ^ s` is summable for `s > 1`. -/ +-lemma summable_vonMangoldt_div_rpow {s : ℝ} (hs : 1 < s) : Summable (fun n ↦ Λ n / n ^ s) := by +- have h_log_bound : ∀ n : ℕ, (Λ n : ℝ) ≤ Real.log n := fun n ↦ vonMangoldt_le_log +- suffices h_log_sum : Summable fun n : ℕ ↦ Real.log n / (n : ℝ) ^ s by +- exact .of_nonneg_of_le (fun n ↦ div_nonneg vonMangoldt_nonneg (by positivity)) +- (fun n ↦ div_le_div_of_nonneg_right (h_log_bound n) (by positivity)) h_log_sum +- have h_log_le_n_eps : ∀ ε > 0, ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n / (n : ℝ) ^ s ≤ C * (n : ℝ) ^ (ε - s) := by +- intro ε hε_pos +- obtain ⟨C, hC_pos, hC⟩ : ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n ≤ C * (n : ℝ) ^ ε := by +- refine ⟨1 / ε, by positivity, fun n hn ↦ ?_⟩ +- have := log_le_sub_one_of_pos (by positivity : 0 < (n : ℝ) ^ ε) +- rw [log_rpow (by positivity)] at this +- nlinarith [rpow_pos_of_pos (by positivity : 0 < (n : ℝ)) ε, mul_div_cancel₀ 1 hε_pos.ne'] +- refine ⟨C, hC_pos, fun n hn ↦ ?_⟩ +- rw [rpow_sub (by positivity)] +- exact le_trans (div_le_div_of_nonneg_right (hC n hn) (by positivity)) (by rw [div_eq_mul_inv]; ring_nf; norm_num) +- obtain ⟨C, _, hC⟩ : ∃ C > 0, ∀ n : ℕ, n ≥ 2 → Real.log n / (n : ℝ) ^ s ≤ C * (n : ℝ) ^ ((s - 1) / 2 - s) := +- h_log_le_n_eps ((s - 1) / 2) (by linarith) +- rw [← summable_nat_add_iff 2] +- exact Summable.of_nonneg_of_le (fun n ↦ div_nonneg (log_nonneg (by norm_cast; omega)) +- (rpow_nonneg (by positivity) _)) (fun n ↦ hC _ (by omega)) (Summable.mul_left _ <| by +- simpa using summable_nat_add_iff 2 |>.2 <| summable_nat_rpow.2 <| by linarith) +- +-@[blueprint "WeakPNT-AP" +- (title := "WeakPNT-AP") +- (statement := /-- +- If $q ≥ 1$ and $a$ is coprime to $q$, we have +- $$ \sum_{n \leq x: n = a\ (q)} \Lambda(n) = \frac{x}{\varphi(q)} + o(x).$$ +- -/) +- (proof := /-- Apply Theorem \ref{WienerIkehara} (or Theorem \ref{WienerIkehara2} to avoid +- checking the Chebyshev condition) using Proposition \ref{WeakPNT-AP-prelim}.-/) +- (proofUses := ["WienerIkehara", "WeakPNT-AP-prelim"])] +-theorem WeakPNT_AP {q : ℕ} {a : ℕ} (hq : q ≥ 1) (ha : a.Coprime q) (ha' : a < q) : +- Tendsto (fun N ↦ cumsum (fun n ↦ if n % q = a then Λ n else 0) N / N) atTop (𝓝 (1 / q.totient)) := by +- have h_summable : ∀ s : ℝ, 1 < s → Summable (fun n ↦ (if n % q = a then Λ n else 0) / n ^ s) := by +- intro s hs +- refine .of_nonneg_of_le (fun n ↦ ?_) (fun n ↦ ?_) (summable_vonMangoldt_div_rpow hs) +- · split_ifs <;> positivity +- · split_ifs <;> norm_num; exact div_nonneg vonMangoldt_nonneg (by positivity) +- obtain ⟨G, hG₁, hG₂⟩ := WeakPNT_AP_prelim hq ha ha' +- convert WienerIkeharaTheorem'' _ _ _ _ using 1 +- · use G +- · intro n +- simp_all only [ge_iff_le, one_div, mul_inv_rev, Pi.ofNat_apply] +- split +- next h => subst h; simp_all only [vonMangoldt_nonneg] +- next h => simp_all only [le_refl] +- · intro σ' hσ' +- specialize h_summable σ' hσ' +- simp_all only [ge_iff_le, one_div, mul_inv_rev] +- convert h_summable using 1 +- ext +- simp only [nterm, norm_real, norm_eq_abs] +- ring_nf +- split_ifs <;> simp [*, mul_comm] +- · assumption +- · convert hG₂ using 3 +- · exact tsum_congr fun n ↦ by cases n <;> aesop +- · norm_num [div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm] +- +- +-blueprint_comment /-- +-\section{The Chebotarev density theorem: the case of cyclotomic extensions} +- +-Throughout this section, $K$ is a number field, $m \geq 1$ is a fixed integer, +-$L = K(\mu_m)$, and $G = \mathrm{Gal}(L/K)$. (In particular $G$ is abelian, and for +-$K=\mathbb{Q}$ one recovers $G \cong (\mathbb{Z}/m\mathbb{Z})^\times$.) +-Write $\zeta_K$ and $\zeta_L$ for the Dedekind zeta functions of $K$ and $L$, and for +-an abelian character $\chi : G \to \mathbb{C}^\times$ write $L(\chi,s)$ for the associated +-Artin $L$-function (equivalently, the Hecke $L$-function of the ideal character attached to +-$\chi$; cf.\ Notation~7.1.17 and Proposition~7.1.18 of +-\url{https://www.math.ucla.edu/~sharifi/algnum.pdf}). +- +-The goal of this section is to prove the Chebotarev density theorem in the cyclotomic case +-(Proposition~\ref{Chebotarev-cyclotomic-density} below), following the classical argument via +-Artin $L$-functions as in Sharifi, Propositions~7.1.16--7.1.19 and Proposition~7.2.1. The +-abelian and general cases are then reduced to this one in the subsequent sections. +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Artin $L$-function as Euler product]\label{Artin-L-euler} +-Let $\chi : G \to \mathbb{C}^\times$ be an abelian character. For $\Re(s) > 1$ one has +-\[ +-L(\chi,s) \;=\; \prod_{\mathfrak{p}} \bigl(1 - \chi(\mathfrak{p})\, N\mathfrak{p}^{-s}\bigr)^{-1} +-\;=\; \sum_{\mathfrak{a} \subseteq \mathcal{O}_K} \chi(\mathfrak{a})\, N\mathfrak{a}^{-s}, +-\] +-where the product runs over nonzero prime ideals of $\mathcal{O}_K$, with the convention +-$\chi(\mathfrak{p}) = 0$ if $\mathfrak{p}$ ramifies in the fixed field of $\ker\chi$. +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof} +-This is the specialisation of the Artin Euler product (Definition~7.1.15 of Sharifi) to +-abelian characters; see Proposition~7.1.18 of +-\url{https://www.math.ucla.edu/~sharifi/algnum.pdf}. Absolute convergence for $\Re(s)>1$ +-follows from comparison with $\zeta_K(s)$. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Dedekind-factor]\label{Dedekind-factor} +-For $\Re(s) > 1$ one has +-\[ +-\zeta_L(s) \;=\; \prod_{\chi : G \to \mathbb{C}^\times} L(\chi,s), +-\] +-where the product runs over all (necessarily one-dimensional) irreducible characters of $G$. +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof}\uses{Artin-L-euler} +-In general, for a Galois extension $L/K$ and characters $\chi$ of irreducible representations of +-$\mathrm{Gal}(L/K)$, Proposition~7.1.16 of +-\url{https://www.math.ucla.edu/~sharifi/algnum.pdf} gives +-$\zeta_L(s) = \prod_\chi L(\chi,s)^{\chi(1)}$ for $\Re(s)>1$. In the present abelian +-(cyclotomic) setting every irreducible character is one-dimensional, so $\chi(1)=1$ and the +-exponents disappear. Alternatively, comparing Euler factors at an unramified prime +-$\mathfrak{p}$: the primes of $L$ above $\mathfrak{p}$ contribute the factor +-$(1 - N\mathfrak{p}^{-fs})^{-g}$ to $\zeta_L$, while the Artin factors multiply to the same +-quantity by the usual identity $\prod_\chi (1 - \chi(\varphi_{\mathfrak{p}}) X) = 1 - X^f$ +-(with $X = N\mathfrak{p}^{-s}$ and $f$ the residue degree). +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Simple pole]\label{Dedekind-pole} +-The Dedekind zeta function $\zeta_L$ admits a meromorphic continuation to a neighbourhood of +-the line $\Re(s)=1$ with a single simple pole at $s=1$ (and is otherwise holomorphic and +-nonvanishing on that line after removing the pole). In particular +-$\log \zeta_L(s) \sim \log(s-1)^{-1}$ as $s \to 1^+$. +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof} +-This is the standard analytic continuation of Dedekind zeta (Theorem~7.1.12 of +-\url{https://www.math.ucla.edu/~sharifi/algnum.pdf}): absolute convergence of the ideal +-Dirichlet series and Euler product for $\Re(s)>1$, meromorphic continuation across +-$\Re(s)>1-[L:\mathbb{Q}]^{-1}$, and a simple pole at $s=1$. The logarithmic asymptotic is +-immediate from the simple pole. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Continuation of nontrivial Artin $L$-functions]\label{Artin-L-continuation} +-Let $\chi : G \to \mathbb{C}^\times$ be a nontrivial character. Then $L(\chi,s)$ extends to an +-analytic function on the half-plane $\Re(s) > 1 - [K:\mathbb{Q}]^{-1}$, and in particular is +-holomorphic at $s=1$. +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof} +-Following Proposition~7.1.19 of \url{https://www.math.ucla.edu/~sharifi/algnum.pdf}: let $n$ +-be the order of $\chi$. Geometry of numbers supplies the estimate that, for each $n$th root of +-unity $\zeta$, the number of ideals $\mathfrak{a}$ with $N\mathfrak{a} \leq N$ and +-$\chi(\mathfrak{a})=\zeta$ is $CN + O\bigl(N^{1-[K:\mathbb{Q}]^{-1}}\bigr)$ with $C$ independent of +-$\zeta$. Summing against $\zeta$ cancels the main terms, so +-$\sum_{N\mathfrak{a}\leq N} \chi(\mathfrak{a}) = O\bigl(N^{1-[K:\mathbb{Q}]^{-1}}\bigr)$. +-Lemma~7.1.5 of Sharifi then yields absolute uniform convergence of +-$\sum_{\mathfrak{a}} \chi(\mathfrak{a})\, N\mathfrak{a}^{-s}$ on compact subsets of +-$\Re(s) > 1 - [K:\mathbb{Q}]^{-1}$. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Dedekind-nonvanishing]\label{Dedekind-nonvanishing} +-For any nontrivial character $\chi$ of $G = \mathrm{Gal}(L/K)$, one has $L(\chi,1) \neq 0$. +-Moreover $L(\chi,s)$ does not vanish for $\Re(s)=1$. +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof}\uses{Dedekind-factor, Dedekind-pole, Artin-L-continuation} +-For the value at $s=1$: write $\log\zeta_L(t) = \sum_\chi \log L(\chi,t)$ for real $t>1$. +-As $t\to 1^+$, the left side is $\sim \log(t-1)^{-1}$ by Lemma~\ref{Dedekind-pole}. If some +-nontrivial $L(\chi,\cdot)$ had a zero of order $m_\chi \geq 1$ at $s=1$, the right side would +-behave like $\bigl(1 - \sum_\chi m_\chi\bigr)\log(t-1)^{-1}$ up to a bounded error +-(the trivial character contributes the pole of $\zeta_K$, absorbed into the factorisation), +-forcing $1-\sum m_\chi \leq 0$, a contradiction. Hence $L(\chi,1)\neq 0$ for all nontrivial +-$\chi$ (Sharifi, Proposition~7.1.19). +- +-For the rest of the line $\Re(s)=1$, $s\neq 1$: adapt the classical nonvanishing argument for +-Dirichlet $L$-functions (comparison of $\zeta_L(s)$, $\zeta_L(s)^3\,|L(\chi,s)|^4$, or the +-$3+4\operatorname{Re}$ inequality) using the Euler product of Lemma~\ref{Artin-L-euler} and the +-absence of poles of nontrivial $L(\chi,\cdot)$ on $\Re(s)=1$ from +-Lemma~\ref{Artin-L-continuation}. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Orthogonality for Frobenius classes]\label{Chebotarev-orthogonality} +-Fix $\sigma \in G$. For every prime ideal $\mathfrak{p}$ of $\mathcal{O}_K$ unramified in $L$, +-\[ +-\sum_{\chi : G \to \mathbb{C}^\times} \chi(\sigma)^{-1}\,\chi(\varphi_{\mathfrak{p}}) +-\;=\; +-\begin{cases} +-|G| & \text{if }\varphi_{\mathfrak{p}} = \sigma,\\ +-0 & \text{otherwise.} +-\end{cases} +-\] +-Equivalently, if $\sigma(\zeta_m) = \zeta_m^a$ with $\gcd(a,m)=1$, the sum equals $|G|$ +-precisely when $N\mathfrak{p} \equiv a \pmod{m}$. +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof} +-Standard character orthogonality on the finite abelian group $G$. The reformulation in terms +-of $N\mathfrak{p} \bmod m$ uses that $\varphi_{\mathfrak{p}}(\zeta_m) = \zeta_m^{N\mathfrak{p}}$ +-for the cyclotomic character. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{proposition}[Cyclotomic Chebotarev density]\label{Chebotarev-cyclotomic-density} +-For every $\sigma \in G$, the set of prime ideals $\mathfrak{p}$ of $K$ unramified in $L$ with +-Frobenius $\varphi_{\mathfrak{p}} = \sigma$ has Dirichlet density $1/|G|$. +-\end{proposition} +--/ +- +-blueprint_comment /-- +-\begin{proof}\uses{Dedekind-factor, Dedekind-pole, Dedekind-nonvanishing, Artin-L-euler, +-Chebotarev-orthogonality} +-This is Proposition~7.2.1 of \url{https://www.math.ucla.edu/~sharifi/algnum.pdf}. For +-$\Re(s)>1$ one has $\log L(\chi,s) \sim \sum_{\mathfrak{p}} \chi(\mathfrak{p})\, N\mathfrak{p}^{-s}$. +-Summing against $\chi(\sigma)^{-1}$ and applying Lemma~\ref{Chebotarev-orthogonality} yields +-\[ +-\sum_{\chi} \chi(\sigma)^{-1} \log L(\chi,s) +-\;\sim\; +-|G| \sum_{\varphi_{\mathfrak{p}}=\sigma} N\mathfrak{p}^{-s}. +-\] +-On the other hand, by Lemmas~\ref{Dedekind-factor} and~\ref{Dedekind-nonvanishing} the left +-side is $\sim \log\zeta_K(s) \sim \log(s-1)^{-1}$ as $s\to 1^+$ (only the trivial character +-contributes a pole). Comparing the two asymptotics gives the asserted Dirichlet density. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{lemma}[PNT for one character]\label{Dedekind-PNT} +-For any nontrivial character $\chi$ of $G$, +-\[ +-\sum_{N\mathfrak{p} \leq x} \chi(\mathfrak{p})\, \log N\mathfrak{p} \;=\; o(x) +-\qquad(x\to\infty). +-\] +-(Equivalently, writing $\Lambda_\chi$ for the von Mangoldt-type coefficients of $-\frac{L'}{L}(\chi,s)$, +-one has $\sum_{n\leq x} \Lambda_\chi(n) = o(x)$.) +-\end{lemma} +- +-\emph{Remark on prime powers.} +-Expanding $-\frac{L'}{L}(\chi,s)$ as a Dirichlet series selects coefficients supported on +-prime powers $\mathfrak{p}^j$ with weight $\chi(\varphi_{\mathfrak{p}})^j\log N\mathfrak{p}$. +-Thus an \emph{exact} identity expressing $-\sum_\chi \chi(\sigma)^{-1}\frac{L'}{L}(\chi,s)$ as a +-sum over primes with Frobenius $\sigma$ should use the condition $\varphi_{\mathfrak{p}}^j=\sigma$ +-rather than $\varphi_{\mathfrak{p}}=\sigma$. For the density statement in +-Proposition~\ref{Chebotarev-cyclotomic-density} this distinction is immaterial: the $j=1$ terms +-agree with the Frobenius condition, while the $j\geq 2$ terms converge absolutely for +-$\Re(s)>1/2$ and do not affect the residue at $s=1$. +--/ +- +-blueprint_comment /-- +-\begin{proof}\uses{Dedekind-nonvanishing, Artin-L-continuation} +-By Lemmas~\ref{Artin-L-continuation} and~\ref{Dedekind-nonvanishing}, $L(\chi,s)$ is holomorphic +-and nonvanishing on $\Re(s)\geq 1$, so $-\frac{L'}{L}(\chi,s)$ extends continuously to +-$\Re(s)\geq 1$. The claimed prime-sum estimate then follows by the same Wiener--Ikehara / +-Ingham contour argument used for Dirichlet $L$-functions in the prime-number theorem in +-arithmetic progressions (cf.\ the material already formalised for Dirichlet $L$-functions +-earlier in this file). Passing through $\Lambda_\chi$ (rather than the bare prime sum) makes +-the $j\geq 2$ prime-power contributions explicit and shows they are $O(x^{1/2}\log x)$, +-hence absorbable in the $o(x)$ error; cf.\ the remark after the statement. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\section{The Chebotarev density theorem: the case of abelian extensions} +- +-Now let $L/K$ be an arbitrary finite abelian extension with Galois group $G$, and fix +-$\sigma \in G$. The goal is to show that the primes of $K$ with Frobenius $\sigma$ still have +-Dirichlet density $1/|G|$, by reducing to the cyclotomic case already treated. +-(Cf.\ Theorem~7.2.2, Step~2, of \url{https://www.math.ucla.edu/~sharifi/algnum.pdf}; cyclic +-extensions already suffice for the later reduction to the general case.) +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Cyclotomic crossing]\label{Chebotarev-abelian-crossing} +-Choose an integer $m\geq 1$ not dividing the discriminant of $L/K$, large enough that +-$H := \mathrm{Gal}(L(\mu_m)/L) \cong (\mathbb{Z}/m\mathbb{Z})^\times$ via the cyclotomic character +-and $\mathrm{Gal}(L(\mu_m)/K) \cong G \times H$. For $\sigma\in G$ and $\tau\in H$ write +-$S_{\sigma,\tau}$ for the set of primes of $K$ unramified in $L(\mu_m)$ with Frobenius +-$(\sigma,\tau)\in G\times H$, and $S_\sigma$ for the set of primes of $K$ unramified in $L$ +-with Frobenius $\sigma$ in $G$. Then +-\[ +-\delta_{\mathrm{inf}}(S_\sigma) \;=\; \sum_{\tau\in H} \delta_{\mathrm{inf}}(S_{\sigma,\tau}). +-\] +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof} +-Every prime counted in $S_\sigma$ lifts to primes in the various $S_{\sigma,\tau}$ according to +-the Frobenius in the cyclotomic layer; the identity of lower densities is the usual additivity +-of Dirichlet densities over a finite partition (up to the finitely many ramified primes). +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Density after cyclotomic crossing]\label{Chebotarev-abelian-density} +-In the notation of Lemma~\ref{Chebotarev-abelian-crossing}, if the order of $\tau\in H$ is +-divisible by $|G|$, then $\langle(\sigma,\tau)\rangle \cap (G\times\{1\}) = \{1\}$, so +-$L(\mu_m)$ is obtained by adjoining $\mu_m$ to the fixed field +-$F := L(\mu_m)^{\langle(\sigma,\tau)\rangle}$. Applying Proposition~\ref{Chebotarev-cyclotomic-density} +-to the cyclotomic extension $F(\mu_m)/F$ and transporting densities as in the reduction step +-of Theorem~7.2.2 yields $\delta(S_{\sigma,\tau}) = 1/(|G|\,|H|)$. +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof}\uses{Chebotarev-cyclotomic-density, Chebotarev-abelian-crossing} +-See Sharifi, Theorem~7.2.2, Step~2 (display after ``Now suppose that $|G|$ divides the order of +-$\tau$''). +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{proposition}[Abelian Chebotarev]\label{Chebotarev-abelian} +-Let $L/K$ be finite abelian with Galois group $G$. For every $\sigma\in G$, the Dirichlet +-density of primes of $K$ with Frobenius $\sigma$ exists and equals $1/|G|$. +-\end{proposition} +--/ +- +-blueprint_comment /-- +-\begin{proof}\uses{Chebotarev-abelian-crossing, Chebotarev-abelian-density, +-Chebotarev-cyclotomic-density} +-Let $H_n \subset H$ be the set of elements whose order is divisible by $n$. Summing the +-densities of Lemma~\ref{Chebotarev-abelian-density} over $\tau\in H_n$ gives +-$\delta_{\mathrm{inf}}(S_\sigma) \geq |H_n|/(|G|\,|H|)$. Choosing $m$ so that $|H_n|/|H|$ is +-arbitrarily close to $1$ (possible since there are primes $m\equiv 1\pmod{n^j}$ by the +-cyclotomic case already proved, and $|H_n|/|H|$ tends to $1$ as $j\to\infty$), one obtains +-$\delta_{\mathrm{inf}}(S_\sigma) \geq 1/|G|$. Summing over $\sigma\in G$ forces equality +-throughout, so each density exists and equals $1/|G|$. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\section{The Chebotarev density theorem: the general case} +- +-Finally let $L/K$ be an arbitrary finite Galois extension with group $G$, and let $C\subset G$ +-be a conjugacy class. The theorem reduces to the abelian (indeed cyclic) case already proved, +-by passing to the fixed field of an element of $C$. +--/ +- +-blueprint_comment /-- +-\begin{lemma}[Reduction to a cyclic subextension]\label{Chebotarev-reduction} +-Fix $\sigma\in C$ and let $E$ be the fixed field of $\langle\sigma\rangle$, so $L/E$ is cyclic of +-degree $f = |\langle\sigma\rangle|$. Write $S$ for the set of primes of $K$ unramified in $L$ +-whose Frobenius class equals $C$, and $T_\sigma$ for the set of primes $\mathfrak{P}$ of $E$ +-unramified in $L$ (and lying over $K$) with Frobenius equal to $\sigma$. Then +-\[ +-\delta(S) \;=\; \frac{f\,|C|}{|G|}\,\delta(T_\sigma), +-\] +-whenever either density exists. In particular, the Chebotarev statement for $L/K$ and $C$ +-follows from the abelian statement for the cyclic extension $L/E$ and the element $\sigma$. +-\end{lemma} +--/ +- +-blueprint_comment /-- +-\begin{proof} +-If $\mathfrak{P}\in T_\sigma$, then $\varphi_{\mathfrak{P}}=\sigma$ fixes $E$, so $\mathfrak{P}$ has +-residue degree one over $K$. There are exactly $|G|/f$ primes of $L$ over $\mathfrak{P}\cap K$, +-and their Frobenii are equidistributed among the $|C|$ elements of the conjugacy class $C$; +-exactly $|G|/(f\,|C|)$ of them have Frobenius $\sigma$. Comparing the Dirichlet series +-$\sum N\mathfrak{p}^{-s}$ over $S$ with $\sum N\mathfrak{P}^{-s}$ over $T_\sigma$ (and using +-$\sum_{\mathfrak{p}} N\mathfrak{p}^{-s} \sim \sum_{\mathfrak{P}} N\mathfrak{P}^{-s}$) yields the +-displayed identity. See Sharifi, Theorem~7.2.2, Step~1. +-\end{proof} +--/ +- +-blueprint_comment /-- +-\begin{theorem}[Chebotarev density theorem]\label{Chebotarev-general} +-Let $L/K$ be a finite Galois extension of number fields with Galois group $G$, and let +-$C\subset G$ be a conjugacy class. The set of prime ideals $\mathfrak{p}$ of $K$ unramified in +-$L$ whose Frobenius conjugacy class equals $C$ has Dirichlet density $|C|/|G|$. +-\end{theorem} +--/ +- +-blueprint_comment /-- +-\begin{proof}\uses{Chebotarev-reduction, Chebotarev-abelian} +-Combine Lemma~\ref{Chebotarev-reduction} with Proposition~\ref{Chebotarev-abelian} applied to +-the cyclic extension $L/E$: the latter gives $\delta(T_\sigma) = 1/f$, whence +-$\delta(S) = |C|/|G|$. +-\end{proof} +--/ +diff --git a/PrimeNumberTheoremAnd/ZetaFive.lean b/PrimeNumberTheoremAnd/ZetaFive.lean +new file mode 100644 +index 0000000..6e3d2a8 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/ZetaFive.lean +@@ -0,0 +1,5 @@ ++import PrimeNumberTheoremAnd.ZetaFive.Sobolev ++import PrimeNumberTheoremAnd.ZetaFive.Fourier ++import PrimeNumberTheoremAnd.ZetaFive.SmoothExistence ++import PrimeNumberTheoremAnd.ZetaFive.Wiener ++import PrimeNumberTheoremAnd.ZetaFive.Consequences +diff --git a/PrimeNumberTheoremAnd/ZetaFive/Consequences.lean b/PrimeNumberTheoremAnd/ZetaFive/Consequences.lean +new file mode 100644 +index 0000000..aa7c25c +--- /dev/null ++++ b/PrimeNumberTheoremAnd/ZetaFive/Consequences.lean +@@ -0,0 +1,66 @@ ++import Mathlib.Analysis.Asymptotics.SpecificAsymptotics ++import Mathlib.Analysis.SpecialFunctions.Log.Basic ++import PrimeNumberTheoremAnd.ZetaFive.Wiener ++ ++namespace ZetaFivePNT ++ ++open ArithmeticFunction hiding log ++open Nat hiding log ++open _root_.Finset ++open BigOperators _root_.Filter _root_.Real _root_.Asymptotics ++open scoped Chebyshev ++ ++theorem WeakPNT' : Tendsto (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) atTop (nhds 1) := by ++ have : (fun N ↦ (∑ n ∈ Iic N, Λ n) / N) = ++ (fun N ↦ (∑ n ∈ range N, Λ n)/N + Λ N / N) := by ++ ext N ++ have : N ∈ Iic N := mem_Iic.mpr (le_refl _) ++ rw [← Finset.sum_erase_add _ _ this, ← Nat.Iio_eq_range, Iic_erase] ++ exact add_div _ _ _ ++ rw [this, ← add_zero 1] ++ apply Tendsto.add WeakPNT ++ convert squeeze_zero (f := fun N ↦ Λ N / N) (g := fun N ↦ log N / N) (t₀ := atTop) ?_ ?_ ?_ ++ · intro N ++ exact div_nonneg vonMangoldt_nonneg (cast_nonneg N) ++ · intro N ++ exact div_le_div_of_nonneg_right vonMangoldt_le_log (cast_nonneg N) ++ simpa only [Function.comp_def, pow_one, one_mul, add_zero] using ++ (Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 one_ne_zero).comp ++ tendsto_natCast_atTop_atTop ++ ++theorem WeakPNT'' : ψ ~[atTop] (fun x ↦ x) := by ++ rw [(by rfl : ψ = (fun x ↦ ψ x))] ++ simp_rw [Chebyshev.psi_eq_sum_Icc] ++ apply IsEquivalent.trans (v := fun x ↦ (⌊x⌋₊:ℝ)) ++ · rw [isEquivalent_iff_tendsto_one] ++ · convert Tendsto.comp WeakPNT' (tendsto_nat_floor_atTop (α := ℝ)) using 1 ++ ext x ++ rfl ++ rw [eventually_iff] ++ simp only [ne_eq, cast_eq_zero, floor_eq_zero, not_lt, mem_atTop_sets, ++ Set.mem_ofPred_eq] ++ use 1 ++ simp only [imp_self, implies_true] ++ exact Asymptotics.isEquivalent_nat_floor ++ ++theorem isLittleO_sqrt_mul_log : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] _root_.id := by ++ have : (fun x : ℝ ↦ x.sqrt * x.log) =o[atTop] fun x ↦ x := by ++ refine (isLittleO_mul_iff_isLittleO_div ?_).mpr ?_ ++ · filter_upwards [eventually_gt_atTop 0] with x hx; exact (sqrt_ne_zero hx.le).mpr hx.ne' ++ · convert isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2) using 2 with x ++ rw [div_sqrt, sqrt_eq_rpow] ++ exact this ++ ++theorem chebyshev_asymptotic : θ ~[atTop] id := by ++ rw [← sub_sub_self ψ θ] ++ refine WeakPNT''.sub_isLittleO ++ (IsBigO.trans_isLittleO (g := fun x ↦ 2 * x.sqrt * x.log) ?_ ?_) ++ · rw [isBigO_iff']; refine ⟨1, one_pos, ?_⟩ ++ simp only [one_mul, eventually_atTop] ++ exact ⟨2, fun x hx ↦ by ++ rw [Pi.sub_apply, norm_eq_abs, norm_eq_abs, abs_of_nonneg (by bound : 0 ≤ 2 * √x * log x)] ++ exact (abs_of_nonneg (sub_nonneg.mpr (Chebyshev.theta_le_psi x))).symm ▸ ++ Chebyshev.abs_psi_sub_theta_le_sqrt_mul_log (by linarith : 1 ≤ x)⟩ ++ · convert isLittleO_sqrt_mul_log.const_mul_left 2 using 1 <;> first | rfl | (funext x; ring) ++ ++end ZetaFivePNT +diff --git a/PrimeNumberTheoremAnd/ZetaFive/Fourier.lean b/PrimeNumberTheoremAnd/ZetaFive/Fourier.lean +new file mode 100644 +index 0000000..95d8904 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/ZetaFive/Fourier.lean +@@ -0,0 +1,42 @@ ++import Mathlib.Topology.ContinuousMap.Bounded.Basic ++import Mathlib.Analysis.Fourier.FourierTransformDeriv ++import PrimeNumberTheoremAnd.ZetaFive.Sobolev ++ ++namespace ZetaFivePNT ++ ++open FourierTransform Real Complex MeasureTheory Filter Topology BoundedContinuousFunction ++ SchwartzMap VectorFourier BigOperators ++ ++section lemmas ++ ++@[simp] theorem F_neg {f : ℝ → ℂ} {u : ℝ} : 𝓕 (fun x => -f x) u = - 𝓕 f u := by ++ simp [fourier_eq, integral_neg] ++ ++@[simp] theorem F_add {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : ++ 𝓕 (fun x => f x + g x) x = 𝓕 f x + 𝓕 g x := by ++ exact congr_fun (fourierIntegral_add continuous_fourierChar continuous_inner hf hg) x ++ ++@[simp] theorem F_sub {f g : ℝ → ℂ} (hf : Integrable f) (hg : Integrable g) (x : ℝ) : ++ 𝓕 (fun x => f x - g x) x = 𝓕 f x - 𝓕 g x := by ++ simpa [sub_eq_add_neg, Pi.neg_def] using F_add hf hg.neg x ++ ++@[simp] theorem F_mul {f : ℝ → ℂ} {c : ℂ} {u : ℝ} : ++ 𝓕 (fun x => c * f x) u = c * 𝓕 f u := by ++ exact congr_fun (VectorFourier.fourierIntegral_const_smul 𝐞 _ _ f c) u ++ ++end lemmas ++ ++theorem fourierIntegral_self_add_deriv_deriv (f : W21) (u : ℝ) : ++ (1 + u ^ 2) * 𝓕 (f : ℝ → ℂ) u = ++ 𝓕 (fun u : ℝ => (f u - (1 / (4 * π ^ 2)) * deriv^[2] f u : ℂ)) u := by ++ have l1 : Integrable (fun x => (((π : ℂ) ^ 2)⁻¹ * 4⁻¹) * deriv (deriv f) x) := by ++ apply Integrable.const_mul ; simpa [iteratedDeriv_succ] using f.integrable le_rfl ++ have l4 : Differentiable ℝ f := f.differentiable ++ have l5 : Differentiable ℝ (deriv f) := f.deriv.differentiable ++ simp [f.hf, l1, add_mul, Real.fourier_deriv f.hf' l5 f.hf'', Real.fourier_deriv f.hf l4 f.hf'] ++ field_simp [pi_ne_zero] ; ring_nf ; simp ++ ++@[simp] theorem deriv_ofReal : deriv ofReal = fun _ => 1 := by ++ ext x ; exact ((hasDerivAt_id x).ofReal_comp).deriv ++ ++end ZetaFivePNT +diff --git a/PrimeNumberTheoremAnd/ZetaFive/SmoothExistence.lean b/PrimeNumberTheoremAnd/ZetaFive/SmoothExistence.lean +new file mode 100644 +index 0000000..6dad927 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/ZetaFive/SmoothExistence.lean +@@ -0,0 +1,43 @@ ++import Mathlib.Geometry.Manifold.PartitionOfUnity ++import Mathlib.Tactic.Bound ++ ++namespace ZetaFivePNT ++ ++open MeasureTheory Set Real ++open scoped ContDiff ++ ++theorem smooth_urysohn_support_Ioo {a b c d : ℝ} (h1 : a < b) (h3 : c < d) : ++ ∃ Ψ : ℝ → ℝ, (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ ++ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 ∧ ++ (Function.support Ψ = Set.Ioo a d) := by ++ have := exists_contDiff_zero_iff_one_iff_of_isClosed (n := ⊤) ++ (s := Set.Iic a ∪ Set.Ici d) (t := Set.Icc b c) ++ (IsClosed.union isClosed_Iic isClosed_Ici) isClosed_Icc ++ (by ++ simp_rw [Set.disjoint_union_left, Set.disjoint_iff, Set.subset_def, ++ Set.mem_inter_iff, Set.mem_Iic, Set.mem_Icc, Set.mem_empty_iff_false, ++ and_imp, imp_false, not_le, Set.mem_Ici] ++ constructor <;> intros <;> linarith) ++ obtain ⟨Ψ, hΨSmooth, hΨrange, hΨ0, hΨ1⟩ := this ++ simp only [Set.mem_union, Set.mem_Iic, Set.mem_Ici, Set.mem_Icc] at * ++ use Ψ ++ simp only [range_subset_iff, mem_Icc] at hΨrange ++ refine ⟨hΨSmooth, ?_, ?_, ?_, ?_⟩ ++ · apply HasCompactSupport.of_support_subset_isCompact (K := Set.Icc a d) isCompact_Icc ++ simp only [Function.support_subset_iff, ne_eq, mem_Icc, ← hΨ0, not_or] ++ bound ++ · apply Set.indicator_le' ++ · intro x hx ++ rw [hΨ1 x |>.mp, Pi.one_apply] ++ simpa using hx ++ · exact fun x _ ↦ (hΨrange x).1 ++ · intro x ++ apply Set.le_indicator_apply ++ · exact fun _ ↦ (hΨrange x).2 ++ · intro hx ++ rw [← hΨ0 x |>.mp] ++ simpa [-not_and, mem_Ioo, not_and_or, not_lt] using hx ++ · ext x ++ simp only [Function.mem_support, ne_eq, mem_Ioo, ← hΨ0, not_or, not_le] ++ ++end ZetaFivePNT +diff --git a/PrimeNumberTheoremAnd/ZetaFive/Sobolev.lean b/PrimeNumberTheoremAnd/ZetaFive/Sobolev.lean +new file mode 100644 +index 0000000..10b6035 +--- /dev/null ++++ b/PrimeNumberTheoremAnd/ZetaFive/Sobolev.lean +@@ -0,0 +1,401 @@ ++import Mathlib.Analysis.Calculus.Deriv.Support ++import Mathlib.Analysis.Calculus.IteratedDeriv.Lemmas ++import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv ++import Mathlib.Order.Filter.ZeroAndBoundedAtFilter ++ ++namespace ZetaFivePNT ++ ++open Real Complex MeasureTheory Filter Topology BoundedContinuousFunction SchwartzMap BigOperators ++open scoped ContDiff ++ ++variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {n : ℕ} ++ ++ ++ ++structure CS (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where ++ ++ toFun : ℝ → E ++ h1 : ContDiff ℝ n toFun ++ h2 : HasCompactSupport toFun ++ ++@[ext] protected theorem CS.ext {n : ℕ} {E : Type*} ++ [NormedAddCommGroup E] [NormedSpace ℝ E] {x y : CS n E} ++ (h : x.toFun = y.toFun) : x = y := by ++ cases x ++ cases y ++ cases h ++ rfl ++ ++ ++ ++structure trunc extends (CS 2 ℝ) where ++ h3 : (Set.Icc (-1) (1)).indicator 1 ≤ toFun ++ h4 : toFun ≤ Set.indicator (Set.Ioo (-2) (2)) 1 ++ ++ ++ ++structure W1 (n : ℕ) (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] where ++ ++ toFun : ℝ → E ++ smooth : ContDiff ℝ n toFun ++ integrable : ∀ ⦃k⦄, k ≤ n → Integrable (iteratedDeriv k toFun) ++ ++ ++ ++abbrev W21 := W1 2 ℂ ++ ++section lemmas ++ ++ ++noncomputable def funscale {E : Type*} (g : ℝ → E) (R x : ℝ) : E := g (R⁻¹ • x) ++ ++theorem contDiff_ofReal : ContDiff ℝ ∞ ofReal := Complex.ofRealCLM.contDiff ++ ++omit [NormedSpace ℝ E] in ++theorem tendsto_funscale {f : ℝ → E} (hf : ContinuousAt f 0) (x : ℝ) : ++ Tendsto (fun R => funscale f R x) atTop (𝓝 (f 0)) := ++ hf.tendsto.comp (by simpa using tendsto_inv_atTop_zero.mul_const x) ++ ++end lemmas ++ ++namespace CS ++ ++variable {f : CS n E} {R x v : ℝ} ++ ++instance : CoeFun (CS n E) (fun _ => ℝ → E) where coe := CS.toFun ++ ++instance : Coe (CS n ℝ) (CS n ℂ) where coe f := ⟨fun x => f x, ++ contDiff_ofReal.of_le (mod_cast le_top) |>.comp f.h1, f.h2.comp_left (g := ofReal) rfl⟩ ++ ++ ++def neg (f : CS n E) : CS n E where ++ toFun := -f ++ h1 := f.h1.neg ++ h2 := f.h2.neg ++ ++instance : Neg (CS n E) where neg := neg ++ ++@[simp] theorem neg_apply {x : ℝ} : (-f) x = - (f x) := rfl ++ ++ ++def smul (R : ℝ) (f : CS n E) : CS n E := ⟨R • f, f.h1.const_smul R, f.h2.smul_left⟩ ++ ++instance : HSMul ℝ (CS n E) (CS n E) where hSMul := smul ++ ++@[simp] theorem smul_apply : (R • f) x = R • f x := rfl ++ ++theorem continuous (f : CS n E) : Continuous f := f.h1.continuous ++ ++ ++ ++noncomputable def deriv (f : CS (n + 1) E) : CS n E where ++ toFun := _root_.deriv f ++ h1 := (contDiff_succ_iff_deriv.mp f.h1).2.2 ++ h2 := f.h2.deriv ++ ++theorem hasDerivAt (f : CS (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := ++ (f.h1.differentiable (by simp)).differentiableAt.hasDerivAt ++ ++theorem deriv_apply {f : CS (n + 1) E} {x : ℝ} : f.deriv x = _root_.deriv f x := rfl ++ ++theorem deriv_smul {f : CS (n + 1) E} : (R • f).deriv = R • f.deriv := by ++ ext x ; exact (f.hasDerivAt x |>.const_smul R).deriv ++ ++ ++ ++noncomputable def scale (g : CS n E) (R : ℝ) : CS n E := by ++ by_cases h : R = 0 ++ · exact ⟨0, contDiff_const, by simp [HasCompactSupport, tsupport]⟩ ++ · refine ⟨fun x => funscale g R x, ?_, ?_⟩ ++ · exact g.h1.comp (contDiff_const_smul R⁻¹) ++ · exact g.h2.comp_smul (inv_ne_zero h) ++ ++theorem deriv_scale {f : CS (n + 1) E} : (f.scale R).deriv = R⁻¹ • f.deriv.scale R := by ++ ext v ; by_cases hR : R = 0 ++ · simp [hR, scale, deriv] ++ · simp only [scale, hR, ↓reduceDIte, smul_apply] ++ exact ((f.hasDerivAt (R⁻¹ • v)).scomp v ++ (by convert (hasDerivAt_const_mul (x := v) R⁻¹) using 1)).deriv ++ ++theorem deriv_scale' {f : CS (n + 1) E} : ++ (f.scale R).deriv v = R⁻¹ • f.deriv (R⁻¹ • v) := by ++ rw [deriv_scale, smul_apply] ++ by_cases hR : R = 0 <;> simp [hR, scale, funscale] ++ ++theorem hasDerivAt_scale (f : CS (n + 1) E) (R x : ℝ) : ++ HasDerivAt (f.scale R) (R⁻¹ • _root_.deriv f (R⁻¹ • x)) x := by ++ convert hasDerivAt (f.scale R) x ; rw [deriv_scale'] ; rfl ++ ++theorem tendsto_scale (f : CS n E) (x : ℝ) : Tendsto (fun R => f.scale R x) atTop (𝓝 (f 0)) := by ++ apply (tendsto_funscale f.continuous.continuousAt x).congr' ++ filter_upwards [eventually_ne_atTop 0] with R hR ; simp [scale, hR] ++ ++theorem bounded : ∃ C, ∀ v, ‖f v‖ ≤ C := by ++ obtain ⟨x, hx⟩ := ++ (continuous_norm.comp f.continuous).exists_forall_ge_of_hasCompactSupport f.h2.norm ++ exact ⟨_, hx⟩ ++ ++end CS ++ ++namespace trunc ++ ++instance : CoeFun trunc (fun _ => ℝ → ℝ) where coe f := f.toFun ++ ++instance : Coe trunc (CS 2 ℝ) where coe := trunc.toCS ++ ++theorem nonneg (g : trunc) (x : ℝ) : 0 ≤ g x := (Set.indicator_nonneg (by simp) x).trans (g.h3 x) ++ ++theorem le_one (g : trunc) (x : ℝ) : g x ≤ 1 := ++ (g.h4 x).trans <| Set.indicator_le_self' (by simp) x ++ ++theorem zero (g : trunc) : g =ᶠ[𝓝 0] 1 := by ++ have : Set.Icc (-1) 1 ∈ 𝓝 (0 : ℝ) := by apply Icc_mem_nhds <;> linarith ++ exact eventually_of_mem this (fun x hx => le_antisymm (g.le_one x) (by simpa [hx] using g.h3 x)) ++ ++@[simp] theorem zero_at {g : trunc} : g 0 = 1 := g.zero.eq_of_nhds ++ ++end trunc ++ ++namespace W1 ++ ++instance : CoeFun (W1 n E) (fun _ => ℝ → E) where coe := W1.toFun ++ ++theorem continuous (f : W1 n E) : Continuous f := f.smooth.continuous ++ ++theorem differentiable (f : W1 (n + 1) E) : Differentiable ℝ f := ++ f.smooth.differentiable (by simp) ++ ++theorem iteratedDeriv_sub {f g : ℝ → E} (hf : ContDiff ℝ n f) (hg : ContDiff ℝ n g) : ++ iteratedDeriv n (f - g) = iteratedDeriv n f - iteratedDeriv n g := by ++ funext x ++ exact _root_.iteratedDeriv_sub hf.contDiffAt hg.contDiffAt ++ ++ ++ ++noncomputable def deriv (f : W1 (n + 1) E) : W1 n E where ++ toFun := _root_.deriv f ++ smooth := contDiff_succ_iff_deriv.mp f.smooth |>.2.2 ++ integrable k hk := by ++ simpa [iteratedDeriv_succ'] using f.integrable (Nat.succ_le_succ hk) ++ ++theorem hasDerivAt (f : W1 (n + 1) E) (x : ℝ) : HasDerivAt f (f.deriv x) x := ++ f.differentiable.differentiableAt.hasDerivAt ++ ++ ++ ++def sub (f g : W1 n E) : W1 n E where ++ toFun := f - g ++ smooth := f.smooth.sub g.smooth ++ integrable k hk := by ++ have hf : ContDiff ℝ k f := f.smooth.of_le (by simp [hk]) ++ have hg : ContDiff ℝ k g := g.smooth.of_le (by simp [hk]) ++ simpa [iteratedDeriv_sub hf hg] using (f.integrable hk).sub (g.integrable hk) ++ ++instance : Sub (W1 n E) where sub := sub ++ ++theorem integrable_iteratedDeriv_Schwarz {f : 𝓢(ℝ, ℂ)} : Integrable (iteratedDeriv n f) := by ++ induction n generalizing f with ++ | zero => exact f.integrable ++ | succ n ih => ++ rw [iteratedDeriv_succ'] ++ have hd : (SchwartzMap.derivCLM ℝ ℂ f : ℝ → ℂ) = _root_.deriv f := by ++ funext x ++ exact SchwartzMap.derivCLM_apply ℝ f x ++ rw [← hd] ++ exact ih (f := SchwartzMap.derivCLM ℝ ℂ f) ++ ++ ++ ++noncomputable def ofSchwartz (f : 𝓢(ℝ, ℂ)) : W1 n ℂ where ++ toFun := f ++ smooth := f.smooth n ++ integrable _ _ := integrable_iteratedDeriv_Schwarz ++ ++end W1 ++ ++namespace W21 ++ ++variable {f : W21} ++ ++ ++ ++noncomputable def norm (f : ℝ → ℂ) : ℝ := ++ (∫ v, ‖f v‖) + (4 * π ^ 2)⁻¹ * (∫ v, ‖deriv (deriv f) v‖) ++ ++theorem norm_nonneg {f : ℝ → ℂ} : 0 ≤ norm f := ++ add_nonneg (integral_nonneg (fun t => by simp)) ++ (mul_nonneg (by positivity) (integral_nonneg (fun t => by simp))) ++ ++noncomputable instance : Norm W21 where norm := norm ∘ W1.toFun ++ ++noncomputable instance : Coe 𝓢(ℝ, ℂ) W21 where coe := W1.ofSchwartz ++ ++ ++def ofCS2 (f : CS 2 ℂ) : W21 := by ++ refine ⟨f, f.h1, ?_⟩ ++ intro k hk ++ cases k with ++ | zero => exact f.h1.continuous.integrable_of_hasCompactSupport f.h2 ++ | succ k => ++ cases k with ++ | zero => ++ simpa using (f.h1.continuous_deriv one_le_two).integrable_of_hasCompactSupport f.h2.deriv ++ | succ k => ++ have hk0 : k = 0 := ++ Nat.eq_zero_of_le_zero (Nat.le_of_succ_le_succ (Nat.le_of_succ_le_succ hk)) ++ subst k ++ simpa [iteratedDeriv_succ] using ++ (f.h1.iterate_deriv' 0 2).continuous.integrable_of_hasCompactSupport f.h2.deriv.deriv ++ ++instance : Coe (CS 2 ℂ) W21 where coe := ofCS2 ++ ++instance : HMul (CS 2 ℂ) W21 (CS 2 ℂ) where ++ hMul g f := ⟨g * f, g.h1.mul f.smooth, g.h2.mul_right⟩ ++ ++instance : HMul (CS 2 ℝ) W21 (CS 2 ℂ) where hMul g f := (g : CS 2 ℂ) * f ++ ++theorem hf (f : W21) : Integrable f := f.integrable zero_le_two ++ ++theorem hf' (f : W21) : Integrable (deriv f) := by ++ simpa [iteratedDeriv_succ] using f.integrable one_le_two ++ ++theorem hf'' (f : W21) : Integrable (deriv (deriv f)) := by ++ simpa [iteratedDeriv_succ] using f.integrable le_rfl ++ ++end W21 ++ ++theorem W21_approximation (f : W21) (g : trunc) : ++ Tendsto (fun R => ‖f - (g.scale R * f : W21)‖) atTop (𝓝 0) := by ++ ++ let f' := f.deriv ++ let f'' := f'.deriv ++ let g' := (g : CS 2 ℝ).deriv ++ let g'' := g'.deriv ++ let h R v := 1 - g.scale R v ++ let h' R := - (g.scale R).deriv ++ let h'' R := - (g.scale R).deriv.deriv ++ ++ have ch {R} : Continuous (fun v => (h R v : ℂ)) := ++ continuous_ofReal.comp <| continuous_const.sub (CS.continuous _) ++ have ch' {R} : Continuous (fun v => (h' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) ++ have ch'' {R} : Continuous (fun v => (h'' R v : ℂ)) := continuous_ofReal.comp (CS.continuous _) ++ have dh R v : HasDerivAt (h R) (h' R v) v := by ++ convert CS.hasDerivAt_scale (g : CS 2 ℝ) R v |>.const_sub 1 using 1 ++ simp [h', CS.deriv_scale', show g.deriv.toFun = deriv g.toFun from rfl] ++ have dh' R v : HasDerivAt (h' R) (h'' R v) v := ((g.scale R).deriv.hasDerivAt v).neg ++ have hh1 R v : |h R v| ≤ 1 := by ++ by_cases hR : R = 0 <;> ++ simp only [CS.scale, funscale, smul_eq_mul, hR, ↓reduceDIte, Pi.zero_apply, sub_zero, ++ abs_one, le_refl, h] ++ rw [abs_le] ; constructor <;> ++ linarith [g.le_one (R⁻¹ * v), g.nonneg (R⁻¹ * v)] ++ have vR v : Tendsto (fun R : ℝ => v * R⁻¹) atTop (𝓝 0) := by ++ simpa using tendsto_inv_atTop_zero.const_mul v ++ ++ convert_to Tendsto (fun R => W21.norm (fun v => h R v * f v)) atTop (𝓝 0) ++ · ext R ; change W21.norm _ = _ ; congr ; ext v ; simp [h, sub_mul] ; rfl ++ rw [show (0 : ℝ) = 0 + ((4 * π ^ 2)⁻¹ : ℝ) * 0 by simp] ++ refine Tendsto.add ?_ (Tendsto.const_mul _ ?_) ++ · let F R v := ‖h R v * f v‖ ++ have eh v : ∀ᶠ R in atTop, h R v = 0 := by ++ filter_upwards [(vR v).eventually g.zero, eventually_ne_atTop 0] with R hR hR' ++ simp [h, hR, CS.scale, hR', funscale, mul_comm R⁻¹] ++ have e1 : ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (F n) volume := by ++ apply Eventually.of_forall ; intro R ++ exact (ch.mul f.continuous).norm.aestronglyMeasurable ++ have e2 : ∀ᶠ (n : ℝ) in atTop, ∀ᵐ (a : ℝ), ‖F n a‖ ≤ ‖f a‖ := by ++ apply Eventually.of_forall ; intro R ++ apply Eventually.of_forall ; intro v ++ simpa [F] using mul_le_mul (hh1 R v) le_rfl (by simp) zero_le_one ++ have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by ++ apply Eventually.of_forall ; intro v ++ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eh v] with R hR ; simp [F, hR] ++ simpa [F] using tendsto_integral_filter_of_dominated_convergence _ e1 e2 f.hf.norm e4 ++ · let F R v := ‖h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v‖ ++ convert_to Tendsto (fun R ↦ ∫ (v : ℝ), F R v) atTop (𝓝 0) ++ · have this R v : ++ deriv (deriv (fun v => h R v * f v)) v = ++ h'' R v * f v + 2 * h' R v * f' v + h R v * f'' v := by ++ have df v : HasDerivAt f (f' v) v := f.hasDerivAt v ++ have df' v : HasDerivAt f' (f'' v) v := f'.hasDerivAt v ++ have l3 v : HasDerivAt (fun v => h R v * f v) (h' R v * f v + h R v * f' v) v := ++ (dh R v).ofReal_comp.mul (df v) ++ have l5 : HasDerivAt (fun v => h' R v * f v) (h'' R v * f v + h' R v * f' v) v := ++ (dh' R v).ofReal_comp.mul (df v) ++ have l7 : HasDerivAt (fun v => h R v * f' v) (h' R v * f' v + h R v * f'' v) v := ++ (dh R v).ofReal_comp.mul (df' v) ++ have d1 : deriv (fun v => h R v * f v) = fun v => h' R v * f v + h R v * f' v := ++ funext (fun v => (l3 v).deriv) ++ rw [d1] ; convert (l5.add l7).deriv using 1 ; ring ++ simp_rw [this, F] ++ obtain ⟨c1, mg'⟩ := g'.bounded ++ obtain ⟨c2, mg''⟩ := g''.bounded ++ let bound v := c2 * ‖f v‖ + 2 * c1 * ‖f' v‖ + ‖f'' v‖ ++ have e1 : ∀ᶠ (n : ℝ) in atTop, AEStronglyMeasurable (F n) volume := by ++ apply Eventually.of_forall ; intro R ; apply (Continuous.norm ?_).aestronglyMeasurable ++ exact ((ch''.mul f.continuous).add ((continuous_const.mul ch').mul f.deriv.continuous)).add ++ (ch.mul f.deriv.deriv.continuous) ++ have e2 : ∀ᶠ R in atTop, ∀ᵐ (a : ℝ), ‖F R a‖ ≤ bound a := by ++ have hc1 : ∀ᶠ R in atTop, ∀ v, |h' R v| ≤ c1 := by ++ filter_upwards [eventually_ge_atTop 1] with R hR v ++ have hR' : R ≠ 0 := by linarith ++ have : 0 ≤ R := by linarith ++ simp only [CS.deriv_scale, CS.neg_apply, CS.smul_apply, smul_eq_mul, abs_neg, abs_mul, ++ abs_inv, abs_eq_self.mpr this, ge_iff_le, h'] ++ simp only [CS.scale, hR', ↓reduceDIte, funscale, smul_eq_mul] ++ convert_to _ ≤ c1 * 1 ++ · simp ++ · rw [mul_comm] ++ apply mul_le_mul (mg' _) ++ (inv_le_of_inv_le₀ (by linarith) (by simpa using hR)) (by positivity) ++ exact (abs_nonneg _).trans (mg' 0) ++ have hc2 : ∀ᶠ R in atTop, ∀ v, |h'' R v| ≤ c2 := by ++ filter_upwards [eventually_ge_atTop 1] with R hR v ++ have e1 : 0 ≤ R := by linarith ++ have e2 : R⁻¹ ≤ 1 := inv_le_of_inv_le₀ (by linarith) (by simpa using hR) ++ have e3 : R ≠ 0 := by linarith ++ simp only [CS.deriv_scale, CS.deriv_smul, CS.neg_apply, CS.smul_apply, smul_eq_mul, abs_neg, ++ abs_mul, abs_inv, abs_eq_self.mpr e1, ge_iff_le, h''] ++ convert_to _ ≤ 1 * (1 * c2) ++ · simp ++ apply mul_le_mul e2 ?_ (by positivity) zero_le_one ++ apply mul_le_mul e2 ?_ (by positivity) zero_le_one ++ simp only [CS.scale, e3, ↓reduceDIte, funscale, smul_eq_mul] ; apply mg'' ++ filter_upwards [hc1, hc2] with R hc1 hc2 ++ apply Eventually.of_forall ; intro v ; specialize hc1 v ; specialize hc2 v ++ simp only [F, bound, norm_norm] ++ refine (norm_add_le _ _).trans ?_ ; apply add_le_add ++ · refine (norm_add_le _ _).trans ?_ ; apply add_le_add <;> simp only [Complex.norm_mul, ++ Complex.norm_ofNat, norm_real, norm_eq_abs] <;> gcongr ++ · simpa using mul_le_mul (hh1 R v) le_rfl (by simp) zero_le_one ++ have e3 : Integrable bound volume := ++ (((f.hf.norm).const_mul _).add ((f.hf'.norm).const_mul _)).add f.hf''.norm ++ have e4 : ∀ᵐ (a : ℝ), Tendsto (fun n ↦ F n a) atTop (𝓝 0) := by ++ apply Eventually.of_forall ; intro v ++ have evg' : (g' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) := by ++ have hzero : (g : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 1) := g.zero ++ change _root_.deriv (g : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) ++ simpa only [deriv_const'] using hzero.deriv ++ have evg'' : (g'' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) := by ++ change _root_.deriv (g' : ℝ → ℝ) =ᶠ[𝓝 (0 : ℝ)] (fun _ : ℝ => 0) ++ simpa only [deriv_const'] using evg'.deriv ++ refine tendsto_norm_zero.comp <| (ZeroAtFilter.add ?_ ?_).add ?_ ++ · have eh'' v : ∀ᶠ R in atTop, h'' R v = 0 := by ++ filter_upwards [(vR v).eventually evg'', eventually_ne_atTop 0] with R hR hR' ++ simp only [CS.deriv_scale, CS.deriv_smul, CS.neg_apply, CS.smul_apply, smul_eq_mul, ++ neg_eq_zero, mul_eq_zero, inv_eq_zero, hR', false_or, h''] ++ simp only [CS.scale, hR', ↓reduceDIte, funscale, smul_eq_mul, mul_comm R⁻¹] ++ exact hR ++ apply tendsto_nhds_of_eventually_eq ++ filter_upwards [eh'' v] with R hR ; simp [hR] ++ · have eh' v : ∀ᶠ R in atTop, h' R v = 0 := by ++ filter_upwards [(vR v).eventually evg'] with R hR ++ simp [g'] at hR ++ simp [h', CS.deriv_scale', mul_comm R⁻¹, hR] ++ apply tendsto_nhds_of_eventually_eq ++ filter_upwards [eh' v] with R hR ; simp [hR] ++ · simpa [h, Filter.ZeroAtFilter] using ++ ((g.tendsto_scale v).const_sub 1).ofReal.mul tendsto_const_nhds ++ simpa [F] using tendsto_integral_filter_of_dominated_convergence bound e1 e2 e3 e4 ++ ++end ZetaFivePNT +diff --git a/PrimeNumberTheoremAnd/ZetaFive/Wiener.lean b/PrimeNumberTheoremAnd/ZetaFive/Wiener.lean +new file mode 100644 +index 0000000..18c58cb +--- /dev/null ++++ b/PrimeNumberTheoremAnd/ZetaFive/Wiener.lean +@@ -0,0 +1,2358 @@ ++import Mathlib.Analysis.Fourier.RiemannLebesgueLemma ++import Mathlib.Analysis.Normed.Group.Tannery ++import Mathlib.Analysis.SumIntegralComparisons ++import Mathlib.NumberTheory.Chebyshev ++import Mathlib.NumberTheory.LSeries.PrimesInAP ++import Mathlib.NumberTheory.MulChar.Lemmas ++import PrimeNumberTheoremAnd.ZetaFive.Fourier ++import PrimeNumberTheoremAnd.ZetaFive.SmoothExistence ++import Mathlib.Analysis.Convolution ++import Mathlib.MeasureTheory.Group.Circle ++ ++namespace ZetaFivePNT ++ ++open Real BigOperators ArithmeticFunction MeasureTheory Filter Set FourierTransform LSeries ++ Asymptotics SchwartzMap ++open Complex hiding log ++open scoped Topology ++open scoped ContDiff ++open scoped ComplexConjugate ++ ++variable {n : ℕ} {A a b c d u x y t σ' : ℝ} {ψ Ψ : ℝ → ℂ} {F G : ℂ → ℂ} {f : ℕ → ℂ} {𝕜 : Type} ++ [RCLike 𝕜] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++noncomputable ++def nterm (f : ℕ → ℂ) (σ' : ℝ) (n : ℕ) : ℝ := if n = 0 then 0 else ‖f n‖ / n ^ σ' ++ ++theorem nterm_eq_norm_term {f : ℕ → ℂ} : nterm f σ' n = ‖term f σ' n‖ := by ++ by_cases h : n = 0 <;> simp [nterm, term, h] ++ ++theorem norm_term_eq_nterm_re (s : ℂ) : ++ ‖term f s n‖ = nterm f (s.re) n := by ++ simpa only [nterm] using LSeries.norm_term_eq f s n ++ ++theorem hf_coe1 (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (hσ : 1 < σ') : ++ ∑' i, (‖term f σ' i‖₊ : ENNReal) ≠ ⊤ := by ++ simp_rw [ENNReal.tsum_coe_ne_top_iff_summable_coe, ← norm_toNNReal] ++ norm_cast ++ apply Summable.toNNReal ++ convert hf σ' hσ with i ++ simp [nterm_eq_norm_term] ++ ++ ++attribute [fun_prop] Real.continuous_fourierChar ++ ++theorem first_fourier_aux1 (hψ : AEMeasurable ψ) {x : ℝ} (n : ℕ) : AEMeasurable fun (u : ℝ) ↦ ++ (‖fourierChar (-(u * ((1 : ℝ) / ((2 : ℝ) * π) * (n / x).log))) • ψ u‖ₑ : ENNReal) := by ++ fun_prop ++ ++theorem first_fourier_aux2a : ++ (2 : ℂ) * π * -(y * (1 / (2 * π) * Real.log ((n) / x))) = -(y * ((n) / x).log) := by ++ calc ++ _ = -(y * (((2 : ℂ) * π) / (2 * π) * Real.log ((n) / x))) := by ring ++ _ = _ := by rw [div_self (by norm_num), one_mul] ++ ++theorem first_fourier_aux2 (hx : 0 < x) (n : ℕ) : ++ term f σ' n * 𝐞 (-(y * (1 / (2 * π) * Real.log (n / x)))) • ψ y = ++ term f (σ' + y * I) n • (ψ y * x ^ (y * I)) := by ++ by_cases hn : n = 0 ++ · simp [term, hn] ++ simp only [term, hn, ↓reduceIte] ++ calc ++ _ = (f n * (cexp ((2 * π * -(y * (1 / (2 * π) * Real.log (n / x)))) * I) / ++ ↑((n : ℝ) ^ σ'))) • ψ y := by ++ rw [Circle.smul_def, fourierChar_apply, ofReal_cpow (by norm_num)] ++ simp only [one_div, mul_inv_rev, mul_neg, ofReal_neg, ofReal_mul, ofReal_ofNat, ofReal_inv, ++ neg_mul, smul_eq_mul, ofReal_natCast] ++ ring ++ _ = (f n * (x ^ (y * I) / n ^ (σ' + y * I))) • ψ y := by ++ congr 2 ++ have l1 : 0 < (n : ℝ) := by simpa using Nat.pos_iff_ne_zero.mpr hn ++ have l2 : (x : ℂ) ≠ 0 := by simp [hx.ne.symm] ++ have l3 : (n : ℂ) ≠ 0 := by simp [hn] ++ rw [Real.rpow_def_of_pos l1, Complex.cpow_def_of_ne_zero l2, Complex.cpow_def_of_ne_zero l3] ++ push_cast ++ simp_rw [← Complex.exp_sub] ++ congr 1 ++ rw [first_fourier_aux2a, Real.log_div l1.ne.symm hx.ne.symm] ++ push_cast ++ rw [Complex.ofReal_log hx.le] ++ ring ++ _ = _ := by simp ; group ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem first_fourier (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hsupp : Integrable ψ) (hx : 0 < x) (hσ : 1 < σ') : ++ ∑' n : ℕ, term f σ' n * (𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))) = ++ ∫ t : ℝ, LSeries f (σ' + t * I) * ψ t * x ^ (t * I) := by ++ calc ++ _ = ∑' n, term f σ' n * ∫ (v : ℝ), 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ simp only [Real.fourier_eq] ++ simp only [one_div, mul_inv_rev, RCLike.inner_apply', conj_trivial] ++ _ = ∑' n, ∫ (v : ℝ), term f σ' n * 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ simp [integral_const_mul] ++ _ = ∫ (v : ℝ), ∑' n, term f σ' n * 𝐞 (-(v * ((1 : ℝ) / ++ ((2 : ℝ) * π) * Real.log (n / x)))) • ψ v := by ++ refine (integral_tsum ?_ ?_).symm ++ · refine fun _ ↦ AEMeasurable.aestronglyMeasurable ?_ ++ have := hsupp.aemeasurable ++ fun_prop ++ · simp only [enorm_mul] ++ simp_rw [lintegral_const_mul'' _ (first_fourier_aux1 hsupp.aemeasurable _)] ++ calc ++ _ = (∑' (i : ℕ), ‖term f σ' i‖ₑ) * ∫⁻ (a : ℝ), ‖ψ a‖ₑ ∂volume := by ++ simp [ENNReal.tsum_mul_right, enorm_eq_nnnorm] ++ _ ≠ ⊤ := ENNReal.mul_ne_top (hf_coe1 hf hσ) ++ (ne_top_of_lt hsupp.2) ++ _ = _ := by ++ congr 1; ext y ++ simp_rw [mul_assoc (LSeries _ _), ← smul_eq_mul (a := (LSeries _ _)), LSeries] ++ rw [← Summable.tsum_smul_const] ++ · simp_rw [first_fourier_aux2 hx] ++ · apply Summable.of_norm ++ convert hf σ' hσ with n ++ rw [norm_term_eq_nterm_re] ++ simp ++ ++ ++ ++@[continuity] ++theorem continuous_multiplicative_ofAdd : Continuous (⇑Multiplicative.ofAdd : ℝ → ℝ) := ⟨fun _ ↦ id⟩ ++ ++attribute [fun_prop] measurable_coe_nnreal_ennreal ++ ++theorem second_fourier_integrable_aux1a (hσ : 1 < σ') : ++ IntegrableOn (fun (x : ℝ) ↦ cexp (-((x : ℂ) * ((σ' : ℂ) - 1)))) (Ici (-Real.log x)) := by ++ norm_cast ++ suffices IntegrableOn (fun (x : ℝ) ↦ (rexp (-(x * (σ' - 1))))) (Ici (-x.log)) _ from this.ofReal ++ simp_rw [fun (a x : ℝ) ↦ (by ring : -(x * a) = -a * x)] ++ rw [integrableOn_Ici_iff_integrableOn_Ioi] ++ apply exp_neg_integrableOn_Ioi ++ linarith ++ ++theorem second_fourier_integrable_aux1 (hcont : Measurable ψ) (hsupp : Integrable ψ) (hσ : 1 < σ') : ++ let ν : Measure (ℝ × ℝ) := (volume.restrict (Ici (-Real.log x))).prod volume ++ Integrable (Function.uncurry fun (u : ℝ) (a : ℝ) ↦ ((rexp (-u * (σ' - 1))) : ℂ) • ++ (𝐞 (Multiplicative.ofAdd (-(a * (u / (2 * π))))) : ℂ) • ψ a) ν := by ++ intro ν ++ constructor ++ · apply Measurable.aestronglyMeasurable ++ change Measurable (fun p : ℝ × ℝ => ++ (rexp (-p.1 * (σ' - 1)) : ℂ) * ++ ((fourierChar (-(p.2 * (p.1 / (2 * π)))) : ℂ) * ψ p.2)) ++ fun_prop ++ · let f1 : ℝ → ENNReal := fun a1 ↦ ‖cexp (-(↑a1 * (↑σ' - 1)))‖ₑ ++ let f2 : ℝ → ENNReal := fun a2 ↦ ‖ψ a2‖ₑ ++ suffices ∫⁻ (a : ℝ × ℝ), f1 a.1 * f2 a.2 ∂ν < ⊤ by ++ simpa [hasFiniteIntegral_iff_enorm, enorm_eq_nnnorm, Function.uncurry] ++ refine (lintegral_prod_mul ?_ ?_).trans_lt ?_ <;> try fun_prop ++ exact ENNReal.mul_lt_top (second_fourier_integrable_aux1a hσ).2 hsupp.2 ++ ++theorem second_fourier_integrable_aux2 (hσ : 1 < σ') : ++ IntegrableOn (fun (u : ℝ) ↦ cexp ((1 - ↑σ' - ↑t * I) * ↑u)) (Ioi (-Real.log x)) := by ++ refine (integrable_norm_iff (Measurable.aestronglyMeasurable <| by fun_prop)).mp ?_ ++ suffices IntegrableOn (fun a ↦ rexp (-(σ' - 1) * a)) (Ioi (-x.log)) _ by simpa [Complex.norm_exp] ++ apply exp_neg_integrableOn_Ioi ++ linarith ++ ++theorem second_fourier_aux (hx : 0 < x) : ++ -(cexp (-((1 - ↑σ' - ↑t * I) * ↑(Real.log x))) / (1 - ↑σ' - ↑t * I)) = ++ ↑(x ^ (σ' - 1)) * (↑σ' + ↑t * I - 1)⁻¹ * ↑x ^ (↑t * I) := by ++ calc ++ _ = cexp (↑(Real.log x) * ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [← div_neg]; ring_nf ++ _ = (x ^ ((↑σ' - 1) + ↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr (ne_of_gt hx)), Complex.ofReal_log hx.le] ++ _ = (x ^ ((σ' : ℂ) - 1)) * (x ^ (↑t * I)) * (↑σ' + ↑t * I - 1)⁻¹ := by ++ rw [Complex.cpow_add _ _ (ofReal_ne_zero.mpr (ne_of_gt hx))] ++ _ = _ := by rw [ofReal_cpow hx.le]; push_cast; ring ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem second_fourier (hcont : Measurable ψ) (hsupp : Integrable ψ) ++ {x σ' : ℝ} (hx : 0 < x) (hσ : 1 < σ') : ++ ∫ u in Ici (-log x), Real.exp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = ++ (x^(σ' - 1) : ℝ) * ∫ t, (1 / (σ' + t * I - 1)) * ψ t * x^(t * I) ∂ volume := by ++ conv in ↑(rexp _) * _ => { rw [Real.fourier_real_eq, ← smul_eq_mul, ← integral_smul] } ++ rw [MeasureTheory.integral_integral_swap] ++ swap ++ · exact second_fourier_integrable_aux1 hcont hsupp hσ ++ rw [← integral_const_mul] ++ congr 1; ext t ++ simp_rw [Circle.smul_def, smul_eq_mul, Real.fourierChar_apply, ++ ← mul_assoc, integral_mul_const] ++ rw [mul_right_comm _ (ψ t) _] ++ congr 1 ++ push_cast ++ simp_rw [← Complex.exp_add] ++ have (u : ℝ) : ++ -↑u * (↑σ' - 1) + 2 * ↑π * -(↑t * (↑u / (2 * ↑π))) * I = (1 - σ' - t * I) * u := calc ++ _ = -↑u * (↑σ' - 1) + (2 * ↑π) / (2 * ↑π) * -(↑t * ↑u) * I := by ring ++ _ = -↑u * (↑σ' - 1) + 1 * -(↑t * ↑u) * I := by rw [div_self (by norm_num)] ++ _ = _ := by ring ++ simp_rw [this] ++ let c : ℂ := (1 - ↑σ' - ↑t * I) ++ have : c ≠ 0 := by simp [Complex.ext_iff, c, sub_ne_zero.mpr hσ.ne] ++ let f' (u : ℝ) := cexp (c * u) ++ let f := fun (u : ℝ) ↦ (f' u) / c ++ have hderiv : ∀ u ∈ Ici (-Real.log x), HasDerivAt f (f' u) u := by ++ intro u _ ++ rw [show f' u = cexp (c * u) * (c * 1) / c by simp only [f']; field_simp] ++ exact (hasDerivAt_id' u).ofReal_comp.const_mul c |>.cexp.div_const c ++ have hf : Tendsto f atTop (𝓝 0) := by ++ apply tendsto_zero_iff_norm_tendsto_zero.mpr ++ suffices Tendsto (fun (x : ℝ) ↦ ‖cexp (c * ↑x)‖ / ‖c‖) atTop (𝓝 (0 / ‖c‖)) by ++ simpa [f, f'] using this ++ apply Filter.Tendsto.div_const ++ suffices Tendsto (· * (1 - σ')) atTop atBot by simpa [Complex.norm_exp, mul_comm (1 - σ'), c] ++ exact Tendsto.atTop_mul_const_of_neg (by linarith) fun ⦃s⦄ h ↦ h ++ rw [integral_Ici_eq_integral_Ioi, ++ integral_Ioi_of_hasDerivAt_of_tendsto' hderiv (second_fourier_integrable_aux2 hσ) hf] ++ simpa [f, f'] using second_fourier_aux hx ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem one_add_sq_pos (u : ℝ) : 0 < 1 + u ^ 2 := zero_lt_one.trans_le (by simpa using sq_nonneg u) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem decay_bounds_key (f : W21) (u : ℝ) : ‖𝓕 (f : ℝ → ℂ) u‖ ≤ ‖f‖ * (1 + u ^ 2)⁻¹ := by ++ have l1 : 0 < 1 + u ^ 2 := one_add_sq_pos _ ++ have l2 : 1 + u ^ 2 = ‖(1 : ℂ) + u ^ 2‖ := by ++ norm_cast ; simp only [Real.norm_eq_abs, abs_eq_self.2 l1.le] ++ have l3 : ‖1 / ((4 : ℂ) * ↑π ^ 2)‖ ≤ (4 * π ^ 2)⁻¹ := by simp ++ have key := fourierIntegral_self_add_deriv_deriv f u ++ simp only [Function.iterate_succ _ 1, Function.iterate_one, Function.comp_apply] at key ++ rw [F_sub f.hf (f.hf''.const_mul (1 / (4 * ↑π ^ 2)))] at key ++ rw [← div_eq_mul_inv, le_div_iff₀ l1, mul_comm, l2, ← norm_mul, key, sub_eq_add_neg] ++ apply norm_add_le _ _ |>.trans ++ change _ ≤ W21.norm _ ++ rw [norm_neg, F_mul, norm_mul, W21.norm] ++ gcongr <;> apply VectorFourier.norm_fourierIntegral_le_integral_norm ++ ++theorem decay_bounds_aux {f : ℝ → ℂ} (hf : AEStronglyMeasurable f volume) ++ (h : ∀ t, ‖f t‖ ≤ A * (1 + t ^ 2)⁻¹) : ++ ∫ t, ‖f t‖ ≤ π * A := by ++ have l1 : Integrable (fun x ↦ A * (1 + x ^ 2)⁻¹) := integrable_inv_one_add_sq.const_mul A ++ simp_rw [← integral_univ_inv_one_add_sq, mul_comm, ← integral_const_mul] ++ exact integral_mono (l1.mono' hf (Eventually.of_forall h)).norm l1 h ++ ++theorem decay_bounds_W21 (f : W21) (hA : ∀ t, ‖f t‖ ≤ A / (1 + t ^ 2)) ++ (hA' : ∀ t, ‖deriv (deriv f) t‖ ≤ A / (1 + t ^ 2)) (u) : ++ ‖𝓕 (f : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by ++ have l0 : 1 * (4 * π)⁻¹ * A = (4 * π ^ 2)⁻¹ * (π * A) := by field_simp ++ have l1 : ∫ (v : ℝ), ‖f v‖ ≤ π * A := by ++ apply decay_bounds_aux f.continuous.aestronglyMeasurable ++ simp_rw [← div_eq_mul_inv] ; exact hA ++ have l2 : ∫ (v : ℝ), ‖deriv (deriv f) v‖ ≤ π * A := by ++ apply decay_bounds_aux f.deriv.deriv.continuous.aestronglyMeasurable ++ simp_rw [← div_eq_mul_inv] ; exact hA' ++ apply decay_bounds_key f u |>.trans ++ change W21.norm _ * _ ≤ _ ++ simp_rw [W21.norm, div_eq_mul_inv, add_mul, l0] ; gcongr ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem decay_bounds (ψ : CS 2 ℂ) (hA : ∀ t, ‖ψ t‖ ≤ A / (1 + t ^ 2)) ++ (hA' : ∀ t, ‖deriv^[2] ψ t‖ ≤ A / (1 + t ^ 2)) : ++ ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ (π + 1 / (4 * π)) * A / (1 + u ^ 2) := by ++ exact decay_bounds_W21 ψ hA hA' u ++ ++theorem decay_bounds_cor_aux (ψ : CS 2 ℂ) : ∃ C : ℝ, ∀ u, ‖ψ u‖ ≤ C / (1 + u ^ 2) := by ++ have l1 : HasCompactSupport (fun u : ℝ => ((1 + u ^ 2) : ℝ) * ψ u) := by exact ψ.h2.mul_left ++ have := ψ.h1.continuous ++ obtain ⟨C, hC⟩ := l1.exists_bound_of_continuous (by fun_prop) ++ refine ⟨C, fun u => ?_⟩ ++ specialize hC u ++ simp only [norm_mul, Complex.norm_real, norm_of_nonneg (one_add_sq_pos u).le] at hC ++ rwa [le_div_iff₀' (one_add_sq_pos _)] ++ ++theorem decay_bounds_cor (ψ : W21) : ++ ∃ C : ℝ, ∀ u, ‖𝓕 (ψ : ℝ → ℂ) u‖ ≤ C / (1 + u ^ 2) := by ++ simpa only [div_eq_mul_inv] using ⟨_, decay_bounds_key ψ⟩ ++ ++@[continuity, fun_prop] theorem continuous_FourierIntegral (ψ : W21) : Continuous (𝓕 (ψ : ℝ → ℂ)) := ++ VectorFourier.fourierIntegral_continuous continuous_fourierChar ++ (by simp only [innerₗ_apply_apply, RCLike.inner_apply', conj_trivial, continuous_mul]) ++ ψ.hf ++ ++theorem W21.integrable_fourier (ψ : W21) (hc : c ≠ 0) : ++ Integrable fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c) := by ++ have l1 (C) : Integrable (fun u ↦ C / (1 + (u / c) ^ 2)) volume := by ++ simpa only [div_eq_mul_inv] using (integrable_inv_one_add_sq.comp_div hc).const_mul C ++ have l2 : AEStronglyMeasurable (fun u ↦ 𝓕 (ψ : ℝ → ℂ) (u / c)) volume := by ++ apply Continuous.aestronglyMeasurable ; fun_prop ++ obtain ⟨C, h⟩ := decay_bounds_cor ψ ++ apply @Integrable.mono' ℝ ℂ _ volume _ _ (fun u => C / (1 + (u / c) ^ 2)) (l1 C) l2 ?_ ++ apply Eventually.of_forall (fun x => h _) ++ ++ ++ ++ ++ ++theorem continuous_LSeries_aux (hf : Summable (nterm f σ')) : ++ Continuous fun x : ℝ => LSeries f (σ' + x * I) := by ++ have l1 i : Continuous fun x : ℝ ↦ term f (σ' + x * I) i := by ++ by_cases h : i = 0 ++ · simpa [h] using continuous_const ++ · simpa [h] using continuous_const.div₀ (continuous_const.cpow (by fun_prop) (by simp [h])) ++ (fun x => by simp [h]) ++ have l2 n (x : ℝ) : ‖term f (σ' + x * I) n‖ = nterm f σ' n := by ++ simpa using norm_term_eq_nterm_re (f := f) (n := n) (σ' + x * I) ++ exact continuous_tsum l1 hf (fun n x => le_of_eq (l2 n x)) ++ ++ ++theorem limiting_fourier_aux (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) (σ' : ℝ) ++ (hσ' : 1 < σ') : ++ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * (x ^ (1 - σ') : ℝ) * ∫ u in Ici (- log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) ++ (u / (2 * π)) = ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I) := by ++ have hint : Integrable ψ := ψ.h1.continuous.integrable_of_hasCompactSupport ψ.h2 ++ have l3 : 0 < x := zero_lt_one.trans_le hx ++ have l1 (σ') (hσ' : 1 < σ') := first_fourier hf hint l3 hσ' ++ have l2 (σ') (hσ' : 1 < σ') := second_fourier ψ.h1.continuous.measurable hint l3 hσ' ++ have l8 : Continuous fun t : ℝ ↦ (x : ℂ) ^ (t * I) := ++ continuous_const.cpow (continuous_ofReal.mul continuous_const) (by simp [l3]) ++ have l6 : Continuous fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by ++ apply ((continuous_LSeries_aux (hf _ hσ')).mul ψ.h1.continuous).mul l8 ++ have l4 : Integrable fun t : ℝ ↦ LSeries f (↑σ' + ↑t * I) * ψ t * ↑x ^ (↑t * I) := by ++ exact l6.integrable_of_hasCompactSupport ψ.h2.mul_left.mul_right ++ have e2 (u : ℝ) : σ' + u * I - 1 ≠ 0 := by ++ intro h ; have := congr_arg Complex.re h ; simp at this ; linarith ++ have l7 : Continuous fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * ++ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by ++ simp only [one_div, ← mul_assoc] ++ refine ((continuous_const.mul <| Continuous.inv₀ ?_ e2).mul ψ.h1.continuous).mul l8 ++ fun_prop ++ have l5 : Integrable fun a ↦ A * ↑(x ^ (1 - σ')) * (↑(x ^ (σ' - 1)) * ++ (1 / (σ' + a * I - 1) * ψ a * x ^ (a * I))) := by ++ apply l7.integrable_of_hasCompactSupport ++ exact ψ.h2.mul_left.mul_right.mul_left.mul_left ++ simp_rw [l1 σ' hσ', l2 σ' hσ', ← integral_const_mul, ← integral_sub l4 l5] ++ apply integral_congr_ae ++ apply Eventually.of_forall ++ intro u ++ have e1 : 1 < ((σ' : ℂ) + (u : ℂ) * I).re := by simp [hσ'] ++ simp_rw [hG' e1, sub_mul, ← mul_assoc] ++ simp only [one_div, sub_right_inj, mul_eq_mul_right_iff, cpow_eq_zero_iff, ofReal_eq_zero, ne_eq, ++ mul_eq_zero, I_ne_zero, or_false] ++ left ; left ++ field_simp [e2] ++ norm_cast ++ simp [mul_assoc, ← rpow_add l3] ++ ++section nabla ++ ++variable {α E : Type*} [OfNat α 1] [Add α] [Sub α] {u : α → ℂ} ++ ++ ++def cumsum [AddCommMonoid E] (u : ℕ → E) (n : ℕ) : E := ∑ i ∈ Finset.range n, u i ++ ++ ++def nabla [Sub E] (u : α → E) (n : α) : E := u (n + 1) - u n ++ ++ ++ ++def nnabla [Sub E] (u : α → E) (n : α) : E := u n - u (n + 1) ++ ++ ++def shift (u : α → E) (n : α) : E := u (n + 1) ++ ++@[simp] theorem cumsum_zero [AddCommMonoid E] {u : ℕ → E} : cumsum u 0 = 0 := by simp [cumsum] ++ ++theorem cumsum_succ [AddCommMonoid E] {u : ℕ → E} (n : ℕ) : ++ cumsum u (n + 1) = cumsum u n + u n := by ++ simp [cumsum, Finset.sum_range_succ] ++ ++@[simp] theorem nabla_cumsum [AddCommGroup E] {u : ℕ → E} : nabla (cumsum u) = u := by ++ ext n ; simp [nabla, cumsum, Finset.range_add_one] ++ ++theorem neg_cumsum [AddCommGroup E] {u : ℕ → E} : -(cumsum u) = cumsum (-u) := ++ funext (fun n => by simp [cumsum]) ++ ++theorem cumsum_nonneg {u : ℕ → ℝ} (hu : 0 ≤ u) : 0 ≤ cumsum u := ++ fun _ => Finset.sum_nonneg (fun i _ => hu i) ++ ++omit [Sub α] in ++theorem neg_nabla [Ring E] {u : α → E} : -(nabla u) = nnabla u := by ext n ; simp [nabla, nnabla] ++ ++omit [Sub α] in ++@[simp] theorem nabla_mul [Ring E] {u : α → E} {c : E} : ++ nabla (fun n => c * u n) = c • nabla u := by ++ ext n ; simp [nabla, mul_sub] ++ ++omit [Sub α] in ++@[simp] theorem nnabla_mul [Ring E] {u : α → E} {c : E} : ++ nnabla (fun n => c * u n) = c • nnabla u := by ++ ext n ; simp [nnabla, mul_sub] ++ ++theorem nnabla_cast (u : ℝ → E) [Sub E] : nnabla u ∘ ((↑) : ℕ → ℝ) = nnabla (u ∘ (↑)) := by ++ ext n ; simp [nnabla] ++ ++end nabla ++ ++theorem Finset.sum_shift_front {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : ++ cumsum u (n + 1) = u 0 + cumsum (shift u) n := by ++ simp_rw [add_comm n, cumsum, _root_.Finset.sum_range_add, ++ _root_.Finset.sum_range_one, add_comm 1] ; rfl ++ ++theorem Finset.sum_shift_front' {E : Type*} [Ring E] {u : ℕ → E} : ++ shift (cumsum u) = (fun _ => u 0) + cumsum (shift u) := by ++ ext n ; apply Finset.sum_shift_front ++ ++theorem Finset.sum_shift_back {E : Type*} [Ring E] {u : ℕ → E} {n : ℕ} : ++ cumsum u (n + 1) = cumsum u n + u n := by ++ simp [cumsum, Finset.range_add_one, add_comm] ++ ++theorem Finset.sum_shift_back' {E : Type*} [Ring E] {u : ℕ → E} : ++ shift (cumsum u) = cumsum u + u := by ++ ext n ; apply Finset.sum_shift_back ++ ++theorem summation_by_parts {E : Type*} [Ring E] {a A b : ℕ → E} (ha : a = nabla A) {n : ℕ} : ++ cumsum (a * b) (n + 1) = A (n + 1) * b n - A 0 * b 0 - ++ cumsum (shift A * fun i => (b (i + 1) - b i)) n := by ++ have l1 : ∑ x ∈ Finset.range (n + 1), A (x + 1) * b x = ∑ x ∈ Finset.range n, ++ A (x + 1) * b x + A (n + 1) * b n := ++ Finset.sum_shift_back ++ have l2 : ∑ x ∈ Finset.range (n + 1), A x * b x = A 0 * b 0 + ∑ x ∈ Finset.range n, ++ A (x + 1) * b (x + 1) := ++ Finset.sum_shift_front ++ simp only [cumsum, ha, Pi.mul_apply, nabla, sub_mul, Finset.sum_sub_distrib, l1, l2, shift, ++ mul_sub] ++ abel ++ ++theorem summation_by_parts' {E : Type*} [Ring E] {a b : ℕ → E} {n : ℕ} : ++ cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - cumsum (shift (cumsum a) * nabla b) n := by ++ change cumsum (a * b) (n + 1) = cumsum a (n + 1) * b n - ++ cumsum (shift (cumsum a) * (fun i : ℕ => b (i + 1) - b i)) n ++ simpa using summation_by_parts (a := a) (b := b) (A := cumsum a) (by simp) ++ ++theorem summation_by_parts'' {E : Type*} [Ring E] {a b : ℕ → E} : ++ shift (cumsum (a * b)) = shift (cumsum a) * b - cumsum (shift (cumsum a) * nabla b) := by ++ ext n ; apply summation_by_parts' ++ ++theorem summable_iff_bounded {u : ℕ → ℝ} (hu : 0 ≤ u) : ++ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by ++ have l1 : (cumsum u =O[atTop] 1) ↔ _ := isBigO_one_nat_atTop_iff ++ have l2 n : ‖cumsum u n‖ = cumsum u n := by simpa using cumsum_nonneg hu n ++ simp only [BoundedAtFilter, l1, l2] ++ constructor <;> intro h <;> rcases h with ⟨C, h1⟩ ++ · exact ⟨C, fun n => sum_le_hasSum _ (fun i _ => hu i) h1⟩ ++ · exact summable_of_sum_range_le hu h1 ++ ++theorem Filter.EventuallyEq.summable {u v : ℕ → ℝ} (h : u =ᶠ[atTop] v) (hu : Summable v) : ++ Summable u := ++ summable_of_isBigO_nat hu h.isBigO ++ ++theorem summable_congr_ae {u v : ℕ → ℝ} (huv : u =ᶠ[atTop] v) : Summable u ↔ Summable v := by ++ exact ⟨ZetaFivePNT.Filter.EventuallyEq.summable huv.symm, ++ ZetaFivePNT.Filter.EventuallyEq.summable huv⟩ ++ ++theorem BoundedAtFilter.add_const {u : ℕ → ℝ} {c : ℝ} : ++ BoundedAtFilter atTop (fun n => u n + c) ↔ BoundedAtFilter atTop u := by ++ have : u = fun n => (u n + c) + (-c) := by ext n ; ring ++ simp only [BoundedAtFilter] ++ constructor <;> intro h ++ on_goal 1 => rw [this] ++ all_goals { exact h.add (const_boundedAtFilter _ _) } ++ ++theorem BoundedAtFilter.comp_add {u : ℕ → ℝ} {N : ℕ} : ++ BoundedAtFilter atTop (fun n => u (n + N)) ↔ BoundedAtFilter atTop u := by ++ simp only [BoundedAtFilter, isBigO_iff, norm_eq_abs, Pi.one_apply, one_mem, ++ CStarRing.norm_of_mem_unitary, mul_one, eventually_atTop] ++ constructor <;> intro hbound <;> rcases hbound with ⟨C, n₀, h⟩ <;> use C ++ · refine ⟨n₀ + N, fun n hn => ?_⟩ ++ obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' (m := N) (n := n) (by grind) ++ exact h _ <| Nat.add_le_add_iff_right.mp hn ++ · exact ⟨n₀, fun n hn => h _ (by grind)⟩ ++ ++theorem summable_iff_bounded' {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, 0 ≤ u n) : ++ Summable u ↔ BoundedAtFilter atTop (cumsum u) := by ++ obtain ⟨N, hu⟩ := eventually_atTop.mp hu ++ have e2 : cumsum (fun i ↦ u (i + N)) = fun n => cumsum u (n + N) - cumsum u N := by ++ ext n ; simp_rw [cumsum, add_comm _ N, Finset.sum_range_add] ; ring ++ rw [← summable_nat_add_iff N, summable_iff_bounded (fun n => hu _ <| Nat.le_add_left N n), e2] ++ simp_rw [sub_eq_add_neg, BoundedAtFilter.add_const, BoundedAtFilter.comp_add] ++ ++theorem bounded_of_shift {u : ℕ → ℝ} (h : BoundedAtFilter atTop (shift u)) : ++ BoundedAtFilter atTop u := by ++ simp only [BoundedAtFilter, isBigO_iff, eventually_atTop] at h ⊢ ++ obtain ⟨C, N, hC⟩ := h ++ refine ⟨C, N + 1, fun n hn => ?_⟩ ++ simp only [shift] at hC ++ have r1 : n - 1 ≥ N := Nat.le_sub_one_of_lt hn ++ have r2 : n - 1 + 1 = n := Nat.sub_add_cancel (by omega) ++ simpa [r2] using hC (n - 1) r1 ++ ++theorem dirichlet_test' {a b : ℕ → ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) ++ (hAb : BoundedAtFilter atTop (shift (cumsum a) * b)) (hbb : ∀ᶠ n in atTop, b (n + 1) ≤ b n) ++ (h : Summable (shift (cumsum a) * nnabla b)) : Summable (a * b) := by ++ have l1 : ∀ᶠ n in atTop, 0 ≤ (shift (cumsum a) * nnabla b) n := by ++ filter_upwards [hbb] with n hb ++ exact mul_nonneg (by simpa [shift] using cumsum_nonneg ha (n + 1)) (sub_nonneg.mpr hb) ++ rw [summable_iff_bounded (mul_nonneg ha hb)] ++ rw [summable_iff_bounded' l1] at h ++ apply bounded_of_shift ++ simpa only [summation_by_parts'', sub_eq_add_neg, neg_cumsum, ← mul_neg, neg_nabla] ++ using hAb.add h ++ ++theorem exists_antitone_of_eventually {u : ℕ → ℝ} (hu : ∀ᶠ n in atTop, u (n + 1) ≤ u n) : ++ ∃ v : ℕ → ℝ, range v ⊆ range u ∧ Antitone v ∧ v =ᶠ[atTop] u := by ++ obtain ⟨N, hN⟩ := eventually_atTop.mp hu ++ let v (n : ℕ) := u (if n < N then N else n) ++ refine ⟨v, ?_, ?_, ?_⟩ ++ · intro x hx ++ rcases hx with ⟨n, hn⟩ ++ exact ⟨if n < N then N else n, hn⟩ ++ · refine antitone_nat_of_succ_le (fun n => ?_) ++ by_cases h : n < N ++ · by_cases h' : n + 1 < N <;> simp [v, h, h'] ++ have : n + 1 = N := by linarith ++ simp [this] ++ · have : ¬(n + 1 < N) := by linarith ++ simp only [this, ↓reduceIte, h, ge_iff_le, v] ; apply hN ; linarith ++ · have : ∀ᶠ n in atTop, ¬(n < N) := by simpa using ⟨N, fun b hb => by linarith⟩ ++ filter_upwards [this] with n hn ; simp [v, hn] ++ ++theorem summable_inv_mul_log_sq : Summable (fun n : ℕ => (n * (Real.log n) ^ 2)⁻¹) := by ++ let u (n : ℕ) := (n * (Real.log n) ^ 2)⁻¹ ++ have l7 : ∀ᶠ n : ℕ in atTop, 1 ≤ Real.log n := ++ tendsto_atTop.mp (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) 1 ++ have l8 : ∀ᶠ n : ℕ in atTop, 1 ≤ n := eventually_ge_atTop 1 ++ have l9 : ∀ᶠ n in atTop, u (n + 1) ≤ u n := by ++ filter_upwards [l7, l8] with n l2 l8; dsimp [u]; gcongr <;> simp ++ obtain ⟨v, l1, l2, l3⟩ := exists_antitone_of_eventually l9 ++ rw [summable_congr_ae l3.symm] ++ have l4 (n : ℕ) : 0 ≤ v n := by obtain ⟨k, hk⟩ := l1 ⟨n, rfl⟩ ; rw [← hk] ; positivity ++ apply (summable_condensed_iff_of_nonneg l4 (fun _ _ _ a ↦ l2 a)).mp ++ suffices this : ∀ᶠ k : ℕ in atTop, 2 ^ k * v (2 ^ k) = ((k : ℝ) ^ 2)⁻¹ * ((Real.log 2) ^ 2)⁻¹ by ++ exact (summable_congr_ae this).mpr <| (Real.summable_nat_pow_inv.mpr one_lt_two).mul_right _ ++ have l5 : ∀ᶠ k in atTop, v (2 ^ k) = u (2 ^ k) := ++ l3.comp_tendsto <| tendsto_pow_atTop_atTop_of_one_lt Nat.le.refl ++ filter_upwards [l5, l8] with k l5 l8 ++ simp only [l5, mul_inv_rev, Nat.cast_pow, Nat.cast_ofNat, log_pow, u] ++ field_simp ++ ++theorem tendsto_mul_add_atTop {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ Tendsto (fun x => a * x + b) atTop atTop := ++ tendsto_atTop_add_const_right _ b (tendsto_id.const_mul_atTop ha) ++ ++theorem isLittleO_const_of_tendsto_atTop {α : Type*} [Preorder α] (a : ℝ) {f : α → ℝ} ++ (hf : Tendsto f atTop atTop) : (fun _ => a) =o[atTop] f := by ++ simp [tendsto_norm_atTop_atTop.comp hf] ++ ++theorem isLittleO_mul_add_sq (a b : ℝ) : (fun x => a * x + b) =o[atTop] (fun x => x ^ 2) := by ++ apply IsLittleO.add ++ · apply IsLittleO.const_mul_left ; simpa using isLittleO_pow_pow_atTop_of_lt (𝕜 := ℝ) one_lt_two ++ · apply isLittleO_const_of_tendsto_atTop _ <| tendsto_pow_atTop (by linarith) ++ ++theorem log_mul_add_isBigO_log {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ (fun x => Real.log (a * x + b)) =O[atTop] Real.log := by ++ apply IsBigO.of_bound (2 : ℕ) ++ have l2 : ∀ᶠ x : ℝ in atTop, 0 ≤ log x := tendsto_atTop.mp tendsto_log_atTop 0 ++ have l3 : ∀ᶠ x : ℝ in atTop, 0 ≤ log (a * x + b) := ++ tendsto_atTop.mp (tendsto_log_atTop.comp (tendsto_mul_add_atTop ha b)) 0 ++ have l5 : ∀ᶠ x : ℝ in atTop, 1 ≤ a * x + b := tendsto_atTop.mp (tendsto_mul_add_atTop ha b) 1 ++ have l1 : ∀ᶠ x : ℝ in atTop, a * x + b ≤ x ^ 2 := by ++ filter_upwards [(isLittleO_mul_add_sq a b).eventuallyLE, l5] with x r2 l5 ++ simpa [abs_eq_self.mpr (zero_le_one.trans l5)] using r2 ++ filter_upwards [l1, l2, l3, l5] with x l1 l2 l3 l5 ++ simpa [abs_eq_self.mpr l2, abs_eq_self.mpr l3, Real.log_pow] using ++ Real.log_le_log (by linarith) l1 ++ ++theorem isBigO_log_mul_add {a : ℝ} (ha : 0 < a) (b : ℝ) : ++ Real.log =O[atTop] (fun x => Real.log (a * x + b)) := by ++ convert (log_mul_add_isBigO_log (b := -b / a) (inv_pos.mpr ha)).comp_tendsto ++ (tendsto_mul_add_atTop (b := b) ha) using 1 ++ · ext x ++ simp only [Function.comp_apply] ++ congr ++ field_simp ++ simp ++ · rfl ++ ++theorem log_isbigo_log_div {d : ℝ} (hb : 0 < d) : ++ (fun n ↦ Real.log n) =O[atTop] (fun n ↦ Real.log (n / d)) := by ++ convert isBigO_log_mul_add (inv_pos.mpr hb) 0 using 1; simp only [add_zero]; field_simp ++ ++theorem Asymptotics.IsBigO.add_isLittleO_right {f g : ℝ → ℝ} (h : g =o[atTop] f) : ++ f =O[atTop] (f + g) := by ++ exact h.right_isBigO_add' ++ ++theorem Asymptotics.IsBigO.sq {α : Type*} [Preorder α] {f g : α → ℝ} (h : f =O[atTop] g) : ++ (fun n ↦ f n ^ 2) =O[atTop] (fun n => g n ^ 2) := ++ h.pow 2 ++ ++theorem log_sq_isbigo_mul {a b : ℝ} (hb : 0 < b) : ++ (fun x ↦ Real.log x ^ 2) =O[atTop] (fun x ↦ a + Real.log (x / b) ^ 2) := by ++ apply (ZetaFivePNT.Asymptotics.IsBigO.sq (log_isbigo_log_div hb)).trans ++ simp_rw [add_comm a] ++ refine ZetaFivePNT.Asymptotics.IsBigO.add_isLittleO_right <| ++ isLittleO_const_of_tendsto_atTop _ ?_ ++ exact (tendsto_pow_atTop two_ne_zero).comp <| ++ tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb ++ ++theorem log_add_div_isBigO_log (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ (fun x ↦ Real.log ((x + a) / b)) =O[atTop] fun x ↦ Real.log x := by ++ convert log_mul_add_isBigO_log (inv_pos.mpr hb) (a / b) using 3 ; ring ++ ++theorem log_add_one_sub_log_le {x : ℝ} (hx : 0 < x) : nabla Real.log x ≤ x⁻¹ := by ++ rw [nabla, ← Real.log_div (by linarith) hx.ne'] ++ calc ++ _ ≤ (x + 1) / x - 1 := Real.log_le_sub_one_of_pos (by positivity) ++ _ = x⁻¹ := by field_simp; ring ++ ++theorem nabla_log_main : nabla Real.log =O[atTop] fun x ↦ 1 / x := by ++ apply IsBigO.of_bound 1 ++ filter_upwards [eventually_gt_atTop 0] with x l1 ++ have l2 : log x ≤ log (x + 1) := log_le_log l1 (by linarith) ++ simpa [nabla, abs_eq_self.mpr l1.le, abs_eq_self.mpr (sub_nonneg.mpr l2)] using ++ log_add_one_sub_log_le l1 ++ ++theorem nabla_log {b : ℝ} (hb : 0 < b) : ++ nabla (fun x => Real.log (x / b)) =O[atTop] (fun x => 1 / x) := by ++ refine EventuallyEq.trans_isBigO ?_ nabla_log_main ++ filter_upwards [eventually_gt_atTop 0] with x l2 ++ rw [nabla, log_div (by linarith) (by linarith), log_div l2.ne.symm (by linarith), nabla] ; ring ++ ++theorem nnabla_mul_log_sq (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ nabla (fun x => x * (a + Real.log (x / b) ^ 2)) =O[atTop] (fun x => Real.log x ^ 2) := by ++ have l1 : nabla (fun n => n * (a + Real.log (n / b) ^ 2)) = fun n => ++ a + Real.log ((n + 1) / b) ^ 2 + ++ (n * (Real.log ((n + 1) / b) ^ 2 - Real.log (n / b) ^ 2)) := by ++ ext n ; simp [nabla] ; ring ++ have l2 := (isLittleO_const_of_tendsto_atTop a ++ ((tendsto_pow_atTop two_ne_zero).comp tendsto_log_atTop)).isBigO ++ have l3 := ZetaFivePNT.Asymptotics.IsBigO.sq (log_add_div_isBigO_log 1 hb) ++ have l4 : (fun x => Real.log ((x + 1) / b) + Real.log (x / b)) =O[atTop] Real.log := by ++ simpa using (log_add_div_isBigO_log _ hb).add (log_add_div_isBigO_log 0 hb) ++ have e2 : (fun x : ℝ => x * (Real.log x * (1 / x))) =ᶠ[atTop] Real.log := by ++ filter_upwards [eventually_ge_atTop 1] with x hx using by field_simp ++ have l5 : (fun n ↦ n * (Real.log n * (1 / n))) =O[atTop] (fun n ↦ (Real.log n) ^ 2) := ++ e2.trans_isBigO ++ (by simpa [Function.comp_def] using ++ (isLittleO_mul_add_sq 1 0).isBigO.comp_tendsto Real.tendsto_log_atTop) ++ simp_rw [l1, _root_.sq_sub_sq] ++ exact ((l2.add l3).add (isBigO_refl (·) atTop |>.mul (l4.mul (nabla_log hb)) |>.trans l5)) ++ ++theorem nnabla_bound_aux1 (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ Tendsto (fun x => x * (a + Real.log (x / b) ^ 2)) atTop atTop := ++ tendsto_id.atTop_mul_atTop₀ <| tendsto_atTop_add_const_left _ _ <| ++ (tendsto_pow_atTop two_ne_zero).comp <| tendsto_log_atTop.comp <| tendsto_id.atTop_div_const hb ++ ++theorem nnabla_bound_aux2 (a : ℝ) {b : ℝ} (hb : 0 < b) : ++ ∀ᶠ x in atTop, 0 < x * (a + Real.log (x / b) ^ 2) := ++ (nnabla_bound_aux1 a hb).eventually (eventually_gt_atTop 0) ++ ++theorem Real.log_eventually_gt_atTop (a : ℝ) : ++ ∀ᶠ x in atTop, a < Real.log x := ++ Real.tendsto_log_atTop.eventually (eventually_gt_atTop a) ++ ++ ++@[local gcongr] ++theorem norm_lt_norm_of_nonneg (x y : ℝ) (hx : 0 ≤ x) (hxy : x ≤ y) : ++ ‖x‖ ≤ ‖y‖ := by ++ simp_rw [Real.norm_eq_abs] ++ apply abs_le_abs hxy ++ linarith ++ ++theorem nnabla_bound_aux {x : ℝ} (hx : 0 < x) : ++ nnabla (fun n ↦ 1 / (n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2))) =O[atTop] ++ (fun n ↦ 1 / (Real.log n ^ 2 * n ^ 2)) := by ++ let d n : ℝ := n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2) ++ change (fun x_1 ↦ nnabla (fun n ↦ 1 / d n) x_1) =O[atTop] _ ++ have l2 : ∀ᶠ n in atTop, 0 < d n := (nnabla_bound_aux2 ((2 * π) ^ 2) hx) ++ have l3 : ∀ᶠ n in atTop, 0 < d (n + 1) := ++ (tendsto_atTop_add_const_right atTop (1 : ℝ) tendsto_id).eventually l2 ++ have l1 : ∀ᶠ n : ℝ in atTop, ++ nnabla (fun n ↦ 1 / d n) n = (d (n + 1) - d n) * (d n)⁻¹ * (d (n + 1))⁻¹ := by ++ filter_upwards [l2, l3] with n l2 l3 ++ rw [nnabla, one_div, one_div, inv_sub_inv l2.ne.symm l3.ne.symm, div_eq_mul_inv, mul_inv, ++ mul_assoc] ++ have l4 : (fun n => (d n)⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by ++ apply IsBigO.inv_rev ++ · refine (isBigO_refl _ _).mul <| (log_sq_isbigo_mul hx) ++ · filter_upwards [Real.log_eventually_gt_atTop 0, eventually_gt_atTop 0] with x hx hx' ++ rw [← not_imp_not] ++ intro _ ++ positivity ++ have l5 : (fun n => (d (n + 1))⁻¹) =O[atTop] (fun n => (n * (Real.log n) ^ 2)⁻¹) := by ++ refine IsBigO.trans ?_ l4 ++ rw [isBigO_iff]; use 1 ++ have e3 : ∀ᶠ n in atTop, d n ≤ d (n + 1) := by ++ filter_upwards [eventually_ge_atTop x] with n hn ++ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn ++ have : 0 ≤ n := hx.le.trans hn ++ simp only [d] ++ gcongr <;> simp [Real.log_nonneg, *] ++ filter_upwards [l2, l3, e3] with n e1 e2 e3 ++ simp_rw [one_mul] ++ gcongr ++ have l6 : (fun n => d (n + 1) - d n) =O[atTop] (fun n => (Real.log n) ^ 2) := by ++ change nabla (fun n : ℝ => n * ((2 * π) ^ 2 + Real.log (n / x) ^ 2)) ++ =O[atTop] (fun n => (Real.log n) ^ 2) ++ exact nnabla_mul_log_sq ((2 * π) ^ 2) hx ++ apply EventuallyEq.trans_isBigO l1 ++ apply ((l6.mul l4).mul l5).trans_eventuallyEq ++ filter_upwards [eventually_ge_atTop 2, Real.log_eventually_gt_atTop 0] with n hn hn' ++ field_simp ++ ++theorem nnabla_bound (C : ℝ) {x : ℝ} (hx : 0 < x) : ++ nnabla (fun n => C / (1 + (Real.log (n / x) / (2 * π)) ^ 2) / n) =O[atTop] ++ (fun n => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by ++ field_simp ++ simp only [div_eq_mul_inv, mul_inv, nnabla_mul, one_mul] ++ apply IsBigO.const_mul_left ++ simpa [div_eq_mul_inv, mul_pow, mul_comm] using nnabla_bound_aux hx ++ ++ ++theorem cheby.bigO (h : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ cumsum (‖f ·‖) =O[atTop] ((↑) : ℕ → ℝ) := by ++ have l1 : 0 ≤ cumsum (‖f ·‖) := cumsum_nonneg (fun _ => norm_nonneg _) ++ obtain ⟨C, hC⟩ := h ++ apply isBigO_of_le' (c := C) atTop ++ intro n ++ rw [Real.norm_eq_abs, abs_eq_self.mpr (l1 n)] ++ simpa using hC n ++ ++theorem limiting_fourier_lim1_aux ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hx : 0 < x) (C : ℝ) (hC : 0 ≤ C) : ++ Summable fun n ↦ ‖f n‖ / ↑n * (C / (1 + (1 / (2 * π) * Real.log (↑n / x)) ^ 2)) := by ++ let a (n : ℕ) := (C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2) / ↑n) ++ replace hcheby := cheby.bigO hcheby ++ have l1 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n : ℕ => (↑(n + 1) : ℝ)) := ++ hcheby.comp_tendsto <| tendsto_add_atTop_nat 1 ++ have l2 : shift (cumsum (‖f ·‖)) =O[atTop] (fun n => (n : ℝ)) := ++ l1.trans ++ (by simpa using (isBigO_refl _ _).add <| isBigO_iff.mpr ⟨1, by simpa using ⟨1, by tauto⟩⟩) ++ have l5 : BoundedAtFilter atTop (fun n : ℕ => C / (1 + (Real.log (↑n / x) / (2 * π)) ^ 2)) := by ++ simp only [BoundedAtFilter] ++ field_simp ++ apply isBigO_of_le' (c := C) ; intro n ++ have : 0 ≤ 2 ^ 2 * π ^ 2 + Real.log (n / x) ^ 2 := by positivity ++ simp only [norm_div, norm_mul, norm_eq_abs, abs_eq_self.mpr hC, norm_pow, ++ abs_eq_self.mpr pi_nonneg, abs_eq_self.mpr this, Pi.one_apply, one_mem, ++ CStarRing.norm_of_mem_unitary, mul_one, ge_iff_le, Nat.abs_ofNat] ++ apply div_le_of_le_mul₀ this hC ++ rw [mul_add, ← mul_assoc] ++ apply le_add_of_le_of_nonneg le_rfl ++ positivity ++ have l3 : a =O[atTop] (fun n => 1 / (n : ℝ)) := by ++ convert IsBigO.mul l5 (isBigO_refl (fun n : ℕ => 1 / (n : ℝ)) _) using 1 ++ · ext n ++ simp [a, div_eq_mul_inv] ++ · ext n ++ simp ++ have l4 : nnabla a =O[atTop] (fun n : ℕ => (n ^ 2 * (Real.log n) ^ 2)⁻¹) := by ++ convert (nnabla_bound C hx).natCast_atTop ; simp [nnabla, a] ++ simp_rw [div_mul_eq_mul_div, mul_div_assoc, one_mul] ++ apply dirichlet_test' ++ · intro n ; exact norm_nonneg _ ++ · intro n ; positivity ++ · apply (l2.mul l3).trans_eventuallyEq ++ apply eventually_of_mem (Ici_mem_atTop 1) ++ intro x (hx : 1 ≤ x) ++ have : x ≠ 0 := Nat.one_le_iff_ne_zero.mp hx ++ simp [this] ++ · have : ∀ᶠ n : ℕ in atTop, x ≤ n := by simpa using eventually_ge_atTop ⌈x⌉₊ ++ filter_upwards [this] with n hn ++ have e1 : 0 < (n : ℝ) := by linarith ++ have e2 : 1 ≤ n / x := (one_le_div hx).mpr hn ++ have e3 := Nat.le_succ n ++ gcongr ++ refine div_nonneg (Real.log_nonneg e2) (by norm_num [pi_nonneg]) ++ · apply summable_of_isBigO_nat summable_inv_mul_log_sq ++ apply (l2.mul l4).trans_eventuallyEq ++ apply eventually_of_mem (Ici_mem_atTop 2) ++ intro x (hx : 2 ≤ x) ++ have : (x : ℝ) ≠ 0 := by simp ; linarith ++ have : Real.log x ≠ 0 := by ++ have ll : 2 ≤ (x : ℝ) := by simp [hx] ++ simp ++ grind ++ field_simp ++ ++theorem limiting_fourier_lim1 ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (ψ : W21) (hx : 0 < x) : ++ Tendsto (fun σ' : ℝ ↦ ++ ∑' n, term f σ' n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x))) (𝓝[>] 1) ++ (𝓝 (∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (n / x)))) := by ++ obtain ⟨C, hC⟩ := decay_bounds_cor ψ ++ have : 0 ≤ C := by simpa using (norm_nonneg _).trans (hC 0) ++ refine tendsto_tsum_of_dominated_convergence ++ (limiting_fourier_lim1_aux hcheby hx C this) (fun n => ?_) ?_ ++ · apply Tendsto.mul_const ++ by_cases h : n = 0 <;> simp only [term, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, ++ tendsto_const_nhds_iff] ++ refine tendsto_const_nhds.div ?_ (by simp [h]) ++ simpa using ((continuous_ofReal.tendsto 1).mono_left nhdsWithin_le_nhds).const_cpow ++ · rw [eventually_nhdsWithin_iff] ++ apply Eventually.of_forall ++ intro σ' (hσ' : 1 < σ') n ++ rw [norm_mul, ← nterm_eq_norm_term] ++ refine mul_le_mul ?_ (hC _) (norm_nonneg _) (div_nonneg (norm_nonneg _) (Nat.cast_nonneg _)) ++ by_cases h : n = 0 <;> simp only [nterm, h, ↓reduceIte, CharP.cast_eq_zero, div_zero, le_refl] ++ have : 1 ≤ (n : ℝ) := by exact_mod_cast (show 1 ≤ n by omega) ++ refine div_le_div₀ (norm_nonneg _) le_rfl (by simpa [Nat.pos_iff_ne_zero]) ?_ ++ simpa using Real.rpow_le_rpow_of_exponent_le this hσ'.le ++ ++theorem limiting_fourier_lim2_aux (x : ℝ) (C : ℝ) : ++ Integrable (fun t ↦ max |x| 1 * (C / (1 + (t / (2 * π)) ^ 2))) ++ (Measure.restrict volume (Ici (-Real.log x))) := by ++ simp_rw [div_eq_mul_inv C] ++ exact (((integrable_inv_one_add_sq.comp_div ++ (by simp [pi_ne_zero])).const_mul _).const_mul _).restrict ++ ++theorem limiting_fourier_lim2 (A : ℝ) (ψ : W21) (hx : 1 ≤ x) : ++ Tendsto (fun σ' ↦ A * ↑(x ^ (1 - σ')) * ++ ∫ u in Ici (-Real.log x), rexp (-u * (σ' - 1)) * 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) ++ (𝓝[>] 1) (𝓝 (A * ∫ u in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)))) := by ++ obtain ⟨C, hC⟩ := decay_bounds_cor ψ ++ apply Tendsto.mul ++ · suffices h : Tendsto (fun σ' : ℝ ↦ ofReal (x ^ (1 - σ'))) (𝓝[>] 1) (𝓝 1) by ++ simpa using h.const_mul ↑A ++ suffices h : Tendsto (fun σ' : ℝ ↦ x ^ (1 - σ')) (𝓝[>] 1) (𝓝 1) from ++ (continuous_ofReal.tendsto 1).comp h ++ have : Tendsto (fun σ' : ℝ ↦ σ') (𝓝 1) (𝓝 1) := fun _ a ↦ a ++ have : Tendsto (fun σ' : ℝ ↦ 1 - σ') (𝓝[>] 1) (𝓝 0) := ++ tendsto_nhdsWithin_of_tendsto_nhds (by simpa using this.const_sub 1) ++ simpa using tendsto_const_nhds.rpow this (Or.inl (zero_lt_one.trans_le hx).ne.symm) ++ · refine tendsto_integral_filter_of_dominated_convergence _ ?_ ?_ ++ (limiting_fourier_lim2_aux x C) ?_ ++ · apply Eventually.of_forall ; intro σ' ++ apply Continuous.aestronglyMeasurable ++ have := continuous_FourierIntegral ψ ++ continuity ++ · apply eventually_of_mem (U := Ioo 1 2) ++ · apply Ioo_mem_nhdsGT_of_mem ; simp ++ · intro σ' hσ ++ have h1 := hσ.1 ++ have h2 := hσ.2 ++ rw [ae_restrict_iff' measurableSet_Ici] ++ apply Eventually.of_forall ++ intro t (ht : - Real.log x ≤ t) ++ rw [norm_mul] ++ have hdom_nonneg : 0 ≤ max |x| 1 := by ++ exact (abs_nonneg x).trans (le_max_left _ _) ++ refine mul_le_mul ?_ (hC _) (norm_nonneg _) hdom_nonneg ++ simp only [neg_mul, ofReal_exp, ofReal_neg, ofReal_mul, ofReal_sub, ofReal_one, norm_exp, ++ neg_re, mul_re, ofReal_re, sub_re, one_re, ofReal_im, sub_im, one_im, sub_self, mul_zero, ++ sub_zero] ++ have : -Real.log x * (σ' - 1) ≤ t * (σ' - 1) := mul_le_mul_of_nonneg_right ht (by linarith) ++ have : -(t * (σ' - 1)) ≤ Real.log x * (σ' - 1) := by simpa using neg_le_neg this ++ have := Real.exp_monotone this ++ apply this.trans ++ have l1 : σ' - 1 ≤ 1 := by linarith ++ have : 0 ≤ Real.log x := Real.log_nonneg hx ++ have := mul_le_mul_of_nonneg_left l1 this ++ refine (Real.exp_monotone this).trans ?_ ++ have hxabs : |x| = x := abs_of_nonneg (zero_le_one.trans hx) ++ calc ++ Real.exp (Real.log x * 1) = |x| := by ++ simpa [mul_one, hxabs] using (Real.exp_log (zero_lt_one.trans_le hx)) ++ _ ≤ max |x| 1 := le_max_left _ _ ++ · apply Eventually.of_forall ++ intro x ++ suffices h : Tendsto (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) (𝓝[>] 1) (𝓝 1) by ++ simpa using h.mul_const _ ++ apply Tendsto.mono_left ?_ nhdsWithin_le_nhds ++ suffices h : Continuous (fun n ↦ ((rexp (-x * (n - 1))) : ℂ)) by simpa using h.tendsto 1 ++ continuity ++ ++theorem limiting_fourier_lim3 (hG : ContinuousOn G {s | 1 ≤ s.re}) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : ++ Tendsto (fun σ' : ℝ ↦ ∫ t : ℝ, G (σ' + t * I) * ψ t * x ^ (t * I)) (𝓝[>] 1) ++ (𝓝 (∫ t : ℝ, G (1 + t * I) * ψ t * x ^ (t * I))) := by ++ by_cases hh : tsupport ψ = ∅ ++ · simp [tsupport_eq_empty_iff.mp hh] ++ obtain ⟨a₀, ha₀⟩ := Set.nonempty_iff_ne_empty.mpr hh ++ let S : Set ℂ := reProdIm (Icc 1 2) (tsupport ψ) ++ have l1 : IsCompact S := by ++ refine Metric.isCompact_iff_isClosed_bounded.mpr ⟨?_, ?_⟩ ++ · exact isClosed_Icc.reProdIm (isClosed_tsupport ψ) ++ · exact (Metric.isBounded_Icc 1 2).reProdIm ψ.h2.isBounded ++ have l2 : S ⊆ {s : ℂ | 1 ≤ s.re} := fun z hz => (mem_reProdIm.mp hz).1.1 ++ have l3 : ContinuousOn (‖G ·‖) S := (hG.mono l2).norm ++ have l4 : S.Nonempty := ⟨1 + a₀ * I, by simp [S, mem_reProdIm, ha₀]⟩ ++ obtain ⟨z, -, hmax⟩ := l1.exists_isMaxOn l4 l3 ++ let MG := ‖G z‖ ++ let bound (a : ℝ) : ℝ := MG * ‖ψ a‖ ++ apply tendsto_integral_filter_of_dominated_convergence (bound := bound) ++ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ; intro u hu ++ apply Continuous.aestronglyMeasurable ++ apply Continuous.mul ++ · exact (hG.comp_continuous (by fun_prop) (by simp [hu.1])).mul ψ.h1.continuous ++ · apply Continuous.const_cpow (by fun_prop) ; simp ; linarith ++ · apply eventually_of_mem (U := Icc 1 2) (Icc_mem_nhdsGT_of_mem (by simp)) ++ intro u hu ++ apply Eventually.of_forall ; intro v ++ by_cases h : v ∈ tsupport ψ ++ · have r1 : u + v * I ∈ S := by simp [S, mem_reProdIm, hu.1, hu.2, h] ++ have r2 := isMaxOn_iff.mp hmax _ r1 ++ have r4 : (x : ℂ) ≠ 0 := by simp ; linarith ++ have r5 : arg x = 0 := by simp [arg_eq_zero_iff] ; linarith ++ have r3 : ‖(x : ℂ) ^ (v * I)‖ = 1 := by simp [norm_cpow_of_ne_zero r4, r5] ++ simp_rw [norm_mul, r3, mul_one] ++ exact mul_le_mul_of_nonneg_right r2 (norm_nonneg _) ++ · have : v ∉ Function.support ψ := fun a ↦ h (subset_tsupport ψ a) ++ simp at this ; simp [this, bound] ++ · suffices h : Continuous bound by exact h.integrable_of_hasCompactSupport ψ.h2.norm.mul_left ++ have := ψ.h1.continuous ; fun_prop ++ · apply Eventually.of_forall ; intro t ++ apply Tendsto.mul_const ++ apply Tendsto.mul_const ++ refine (hG (1 + t * I) (by simp)).tendsto.comp <| tendsto_nhdsWithin_iff.mpr ⟨?_, ?_⟩ ++ · exact ((continuous_ofReal.tendsto _).add tendsto_const_nhds).mono_left nhdsWithin_le_nhds ++ · exact eventually_nhdsWithin_of_forall (fun x (hx : 1 < x) => by simp [hx.le]) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem limiting_fourier (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) (ψ : CS 2 ℂ) (hx : 1 ≤ x) : ++ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) = ++ ∫ (t : ℝ), (G (1 + t * I)) * (ψ t) * x ^ (t * I) := by ++ have l1 := limiting_fourier_lim1 hcheby ψ (by linarith) ++ have l2 := limiting_fourier_lim2 A ψ hx ++ have l3 := limiting_fourier_lim3 hG ψ hx ++ apply tendsto_nhds_unique_of_eventuallyEq (l1.sub l2) l3 ++ simpa [eventuallyEq_nhdsWithin_iff, W21.ofCS2] using ++ Eventually.of_forall (limiting_fourier_aux hG' hf ψ hx) ++ ++ ++ ++ ++theorem limiting_cor_aux {f : ℝ → ℂ} : ++ Tendsto (fun x : ℝ ↦ ∫ t, f t * x ^ (t * I)) atTop (𝓝 0) := by ++ have l1 : ∀ᶠ x : ℝ in atTop, ∀ t : ℝ, x ^ (t * I) = exp (log x * t * I) := by ++ filter_upwards [eventually_ne_atTop 0, eventually_ge_atTop 0] with x hx hx' t ++ rw [Complex.cpow_def_of_ne_zero (ofReal_ne_zero.mpr hx), ofReal_log hx'] ; ring_nf ++ have l2 : ∀ᶠ x : ℝ in atTop, ∫ t, f t * x ^ (t * I) = ∫ t, f t * exp (log x * t * I) := by ++ filter_upwards [l1] with x hx ++ refine integral_congr_ae (Eventually.of_forall (fun x => by simp [hx])) ++ simp_rw [tendsto_congr' l2] ++ convert_to Tendsto (fun x => 𝓕 f (-Real.log x / (2 * π))) atTop (𝓝 0) ++ · funext x ++ rw [Real.fourier_real_eq_integral_exp_smul] ++ apply integral_congr_ae ++ filter_upwards [] with t ++ have hphase : -2 * π * t * (-Real.log x / (2 * π)) = Real.log x * t := by ++ field_simp ++ rw [hphase, ofReal_mul, smul_eq_mul] ++ exact mul_comm _ _ ++ refine (Real.zero_at_infty_fourier f).comp <| Tendsto.mono_right ?_ _root_.atBot_le_cocompact ++ exact (tendsto_neg_atBot_iff.mpr tendsto_log_atTop).atBot_mul_const (inv_pos.mpr two_pi_pos) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem limiting_cor (ψ : CS 2 ℂ) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by ++ apply limiting_cor_aux.congr' ++ filter_upwards [eventually_ge_atTop 1] with x hx using ++ limiting_fourier hcheby hG hG' hf ψ hx |>.symm ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem smooth_urysohn (a b c d : ℝ) (h1 : a < b) (h3 : c < d) : ∃ Ψ : ℝ → ℝ, ++ (ContDiff ℝ ∞ Ψ) ∧ (HasCompactSupport Ψ) ∧ ++ Set.indicator (Set.Icc b c) 1 ≤ Ψ ∧ Ψ ≤ Set.indicator (Set.Ioo a d) 1 := by ++ obtain ⟨ψ, l1, l2, l3, l4, -⟩ := smooth_urysohn_support_Ioo h1 h3 ++ refine ⟨ψ, l1, l2, l3, l4⟩ ++ ++ ++ ++ ++ ++noncomputable def compactTruncation : trunc := by ++ choose ψ h1 h2 h3 h4 using smooth_urysohn (-2) (-1) (1) (2) (by linarith) (by linarith) ++ exact ⟨⟨ψ, h1.of_le (by norm_cast), h2⟩, h3, h4⟩ ++ ++theorem one_div_sub_one (n : ℕ) : 1 / (↑(n - 1) : ℝ) ≤ 2 / n := by ++ cases n with ++ | zero => simp ++ | succ n => ++ cases n with ++ | zero => simp ++ | succ n => norm_cast ; rw [div_le_div_iff₀] <;> simp [mul_add] <;> linarith ++ ++ ++ ++noncomputable def pp (a x : ℝ) : ℝ := a ^ 2 * (x + 1) ^ 2 + (1 - a) * (1 + a) ++ ++ ++ ++noncomputable def pp' (a x : ℝ) : ℝ := a ^ 2 * (2 * (x + 1)) ++ ++theorem pp_pos {a : ℝ} (ha : a ∈ Ioo (-1) 1) (x : ℝ) : 0 < pp a x := by ++ simp only [pp] ++ have : 0 < 1 - a := by linarith [ha.2] ++ have : 0 < 1 + a := by linarith [ha.1] ++ positivity ++ ++theorem pp_deriv (a x : ℝ) : HasDerivAt (pp a) (pp' a x) x := by ++ unfold pp pp' ++ simpa using hasDerivAt_id x |>.add_const 1 |>.pow 2 |>.const_mul _ ++ ++theorem pp_deriv_eq (a : ℝ) : deriv (pp a) = pp' a := by ++ ext x ; exact pp_deriv a x |>.deriv ++ ++theorem pp'_deriv (a x : ℝ) : HasDerivAt (pp' a) (a ^ 2 * 2) x := by ++ change HasDerivAt (fun y : ℝ => a ^ 2 * (2 * (y + 1))) (a ^ 2 * 2) x ++ convert hasDerivAt_id x |>.add_const 1 |>.const_mul 2 |>.const_mul (a ^ 2) ++ using 1 <;> first | rfl | ring ++ ++theorem pp'_deriv_eq (a : ℝ) : deriv (pp' a) = fun _ => a ^ 2 * 2 := by ++ ext x ; exact pp'_deriv a x |>.deriv ++ ++ ++ ++noncomputable def hh (a t : ℝ) : ℝ := (t * (1 + (a * log t) ^ 2))⁻¹ ++ ++ ++ ++noncomputable def hh' (a t : ℝ) : ℝ := - pp a (log t) * hh a t ^ 2 ++ ++theorem hh_nonneg (a : ℝ) {t : ℝ} (ht : 0 ≤ t) : 0 ≤ hh a t := by dsimp only [hh] ; positivity ++ ++theorem hh_le (a t : ℝ) (ht : 0 ≤ t) : |hh a t| ≤ t⁻¹ := by ++ by_cases h0 : t = 0 ++ · simp [hh, h0] ++ replace ht : 0 < t := lt_of_le_of_ne ht (by tauto) ++ unfold hh ++ rw [abs_inv, inv_le_inv₀ (by positivity) ht, abs_mul, abs_eq_self.mpr ht.le] ++ convert_to t * 1 ≤ _ ++ · simp ++ apply mul_le_mul le_rfl ?_ zero_le_one ht.le ++ rw [abs_eq_self.mpr (by positivity)] ++ simp only [le_add_iff_nonneg_right] ++ positivity ++ ++theorem hh_deriv (a : ℝ) {t : ℝ} (ht : t ≠ 0) : HasDerivAt (hh a) (hh' a t) t := by ++ have e1 : t * (1 + (a * log t) ^ 2) ≠ 0 := mul_ne_zero ht (_root_.ne_of_lt (by positivity)).symm ++ have l5 : HasDerivAt (fun t : ℝ => log t) t⁻¹ t := Real.hasDerivAt_log ht ++ have l4 : HasDerivAt (fun t : ℝ => a * log t) (a * t⁻¹) t := l5.const_mul _ ++ have l3 : HasDerivAt (fun t : ℝ => (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := by ++ convert l4.pow 2 using 1 ; ring ++ have l2 : HasDerivAt (fun t : ℝ => 1 + (a * log t) ^ 2) (2 * a ^ 2 * t⁻¹ * log t) t := ++ l3.const_add _ ++ have l1 : HasDerivAt (fun t : ℝ => t * (1 + (a * log t) ^ 2)) ++ (1 + 2 * a ^ 2 * log t + a ^ 2 * log t ^ 2) t := by ++ convert (hasDerivAt_id' t).mul l2 using 1; field_simp; ring ++ apply (l1.inv e1).congr_deriv ++ dsimp only [hh', pp, hh] ++ simp only [div_eq_mul_inv, inv_pow] ++ ring ++ ++theorem hh_continuous (a : ℝ) : ContinuousOn (hh a) (Ioi 0) := ++ fun t (ht : 0 < t) => (hh_deriv a ht.ne.symm).continuousAt.continuousWithinAt ++ ++theorem hh'_nonpos {a x : ℝ} (ha : a ∈ Ioo (-1) 1) : hh' a x ≤ 0 := by ++ have := pp_pos ha (log x) ++ simp only [hh', neg_mul, Left.neg_nonpos_iff, ge_iff_le] ++ positivity ++ ++theorem hh_antitone {a : ℝ} (ha : a ∈ Ioo (-1) 1) : AntitoneOn (hh a) (Ioi 0) := by ++ have l1 x (hx : x ∈ interior (Ioi 0)) : ++ HasDerivWithinAt (hh a) (hh' a x) (interior (Ioi 0)) x := by ++ have : x ≠ 0 := by contrapose! hx ; simp [hx] ++ exact (hh_deriv a this).hasDerivWithinAt ++ apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ioi _) (hh_continuous _) l1 ++ (fun x _ => hh'_nonpos ha) ++ ++ ++ ++noncomputable def gg (x i : ℝ) : ℝ := 1 / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ++ ++theorem gg_of_hh {x : ℝ} (hx : x ≠ 0) (i : ℝ) : gg x i = x⁻¹ * hh (1 / (2 * π)) (i / x) := by ++ simp only [gg, hh] ++ field_simp ++ ++theorem gg_l1 {x : ℝ} (hx : 0 < x) (n : ℕ) : |gg x n| ≤ 1 / n := by ++ simp only [gg_of_hh hx.ne.symm, one_div, mul_inv_rev, abs_mul] ++ apply mul_le_mul le_rfl (hh_le _ _ (by positivity)) (by positivity) (by positivity) |>.trans ++ (le_of_eq ?_) ++ simp [abs_inv, abs_eq_self.mpr hx.le] ; field_simp ++ ++theorem gg_le_one (i : ℕ) : gg x i ≤ 1 := by ++ by_cases hi : i = 0 <;> simp only [gg, hi, CharP.cast_eq_zero, div_zero, one_div, mul_inv_rev, ++ zero_div, Real.log_zero, mul_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, ++ add_zero, inv_one, mul_one, zero_le_one] ++ have l1 : 1 ≤ (i : ℝ) := by simp ; omega ++ have l2 : 1 ≤ 1 + (π⁻¹ * 2⁻¹ * Real.log (↑i / x)) ^ 2 := by ++ simp only [le_add_iff_nonneg_right] ; positivity ++ rw [← mul_inv] ; apply inv_le_one_of_one_le₀ ; simpa using mul_le_mul l1 l2 zero_le_one (by simp) ++ ++theorem one_div_two_pi_mem_Ioo : 1 / (2 * π) ∈ Ioo (-1) 1 := by ++ constructor ++ · trans 0 ++ · linarith ++ · positivity ++ · rw [div_lt_iff₀ (by positivity)] ++ convert_to 1 * 1 < 2 * π ++ · simp ++ · simp ++ apply mul_lt_mul one_lt_two ?_ zero_lt_one zero_le_two ++ trans 2 ++ · exact one_le_two ++ · exact two_le_pi ++ ++theorem cancel_aux {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ ∑ i ∈ Finset.range n, f i * g i ≤ g (n - 1) * (C * n) + (C * (↑(n - 1 - 1) + 1) * g 0 ++ - C * (↑(n - 1 - 1) + 1) * g (n - 1) - ++ ((n - 1 - 1) • (C * g 0) - ∑ x ∈ Finset.range (n - 1 - 1), C * g (x + 1))) := by ++ have l1 (n : ℕ) : ++ (g n - g (n + 1)) * ∑ i ∈ Finset.range (n + 1), f i ≤ (g n - g (n + 1)) * (C * (n + 1)) := by ++ apply mul_le_mul le_rfl (by simpa only [cumsum, Nat.cast_add, Nat.cast_one] using hf' (n + 1)) ++ (Finset.sum_nonneg (fun i _ => hf i)) ?_ ++ simp only [sub_nonneg] ; apply hg' ; simp ++ have l2 (x : ℕ) : C * (↑(x + 1) + 1) - C * (↑x + 1) = C := by simp ; ring ++ have l3 (n : ℕ) : 0 ≤ cumsum f n := Finset.sum_nonneg (fun i _ => hf i) ++ convert_to ∑ i ∈ Finset.range n, (g i) • (f i) ≤ _ ++ · simp [mul_comm] ++ rw [Finset.sum_range_by_parts, sub_eq_add_neg, ← Finset.sum_neg_distrib] ++ simp_rw [← neg_smul, neg_sub, smul_eq_mul] ++ apply _root_.add_le_add ++ · exact mul_le_mul le_rfl (hf' n) (l3 n) (hg _) ++ · apply Finset.sum_le_sum (fun n _ => l1 n) |>.trans ++ convert_to ∑ i ∈ Finset.range (n - 1), (C * (↑i + 1)) • (g i - g (i + 1)) ≤ _ ++ · congr ; ext i ; simp ; ring ++ rw [Finset.sum_range_by_parts] ++ simp_rw [Finset.sum_range_sub', l2, smul_sub, smul_eq_mul, Finset.sum_sub_distrib, ++ Finset.sum_const, Finset.card_range] ++ apply le_of_eq ; ring_nf ++ ++theorem sum_range_succ (a : ℕ → ℝ) (n : ℕ) : ++ ∑ i ∈ Finset.range n, a (i + 1) = (∑ i ∈ Finset.range (n + 1), a i) - a 0 := by ++ have := Finset.sum_range_sub a n ++ rw [Finset.sum_sub_distrib, sub_eq_iff_eq_add] at this ++ rw [Finset.sum_range_succ, this] ; ring ++ ++theorem cancel_aux' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ ∑ i ∈ Finset.range n, f i * g i ≤ ++ C * n * g (n - 1) ++ + C * cumsum g (n - 1 - 1 + 1) ++ - C * (↑(n - 1 - 1) + 1) * g (n - 1) ++ := by ++ have := cancel_aux hf hg hf' hg' n ++ simp only [nsmul_eq_mul, ← Finset.mul_sum, sum_range_succ] at this ++ convert this using 1 ; unfold cumsum ; ring ++ ++theorem cancel_main {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) (hn : 2 ≤ n) : ++ cumsum (f * g) n ≤ C * cumsum g n := by ++ change (∑ i ∈ Finset.range n, f i * g i) ≤ C * cumsum g n ++ refine (cancel_aux' hf hg hf' hg' n).trans_eq ?_ ++ have hindex : n - 1 - 1 + 1 = n - 1 := by omega ++ have hcast : (n : ℝ) = ↑(n - 1) + 1 := by ++ exact_mod_cast (show n = (n - 1) + 1 by omega) ++ have hcast' : (↑(n - 1 - 1) : ℝ) + 1 = ↑(n - 1) := by ++ exact_mod_cast hindex ++ have hsum : cumsum g n = cumsum g (n - 1) + g (n - 1) := by ++ conv_lhs => rw [show n = (n - 1) + 1 by omega] ++ exact cumsum_succ (n - 1) ++ rw [hindex, hcast', hcast, hsum] ++ ring ++ ++theorem cancel_main' {C : ℝ} {f g : ℕ → ℝ} (hf : 0 ≤ f) (hf0 : f 0 = 0) (hg : 0 ≤ g) ++ (hf' : ∀ n, cumsum f n ≤ C * n) (hg' : Antitone g) (n : ℕ) : ++ cumsum (f * g) n ≤ C * cumsum g n := by ++ cases n with ++ | zero => simp [cumsum] ++ | succ n => ++ cases n with ++ | zero => ++ have hC : 0 ≤ C := by simpa [cumsum, hf0] using hf' 1 ++ simpa [cumsum, hf0] using mul_nonneg hC (hg 0) ++ | succ n => exact cancel_main hf hg hf' hg' (n + 2) (by omega) ++ ++theorem sum_le_integral {x₀ : ℝ} {f : ℝ → ℝ} {n : ℕ} (hf : AntitoneOn f (Ioc x₀ (x₀ + n))) ++ (hfi : IntegrableOn f (Icc x₀ (x₀ + n))) : ++ (∑ i ∈ Finset.range n, f (x₀ + ↑(i + 1))) ≤ ∫ x in x₀..x₀ + n, f x := by ++ cases n with simp only [Nat.cast_add, Nat.cast_one, CharP.cast_eq_zero, add_zero, ++ lt_self_iff_false, not_false_eq_true, ++ Ioc_eq_empty, Finset.range_zero, Nat.cast_add, Nat.cast_one, Finset.sum_empty, ++ intervalIntegral.integral_same, le_refl] at hf ⊢ ++ | succ n => ++ have : Finset.range (n + 1) = {0} ∪ Finset.Ico 1 (n + 1) := by ++ ext i ; by_cases hi : i = 0 <;> simp [hi] ; omega ++ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, ++ lt_add_iff_pos_left, add_pos_iff, zero_lt_one, or_true, and_true, not_false_eq_true, ++ Finset.sum_insert, CharP.cast_eq_zero, zero_add, ge_iff_le] ++ have l4 : IntervalIntegrable f volume x₀ (x₀ + 1) := by ++ apply IntegrableOn.intervalIntegrable ++ simp only [le_add_iff_nonneg_right, zero_le_one, uIcc_of_le] ++ apply hfi.mono_set ++ apply Icc_subset_Icc le_rfl ++ simp ++ have l5 x (hx : x ∈ Ioc x₀ (x₀ + 1)) : (fun x ↦ f (x₀ + 1)) x ≤ f x := by ++ rcases hx with ⟨hx1, hx2⟩ ++ refine hf ⟨hx1, by linarith⟩ ⟨by linarith, by linarith⟩ hx2 ++ have l6 : ∫ x in x₀..x₀ + 1, f (x₀ + 1) = f (x₀ + 1) := by simp ++ have l1 : f (x₀ + 1) ≤ ∫ x in x₀..x₀ + 1, f x := by ++ rw [← l6] ++ apply intervalIntegral.integral_mono_on_of_le_Ioo (by linarith) (by simp) l4 ++ intro x hx ++ exact l5 x ⟨hx.1, hx.2.le⟩ ++ have l2 : AntitoneOn (fun x ↦ f (x₀ + x)) (Icc 1 ↑(n + 1)) := by ++ intro u hu v hv huv ++ have hu1 := hu.1 ++ have hv2 := hv.2 ++ push_cast at hv2 ++ refine hf ⟨?_, ?_⟩ ⟨?_, ?_⟩ ?_ <;> linarith ++ have l3 := @AntitoneOn.sum_le_integral_Ico 1 (n + 1) (fun x => f (x₀ + x)) (by simp) ++ (by simpa using l2) ++ simp only [Nat.cast_add, Nat.cast_one, intervalIntegral.integral_comp_add_left] at l3 ++ convert _root_.add_le_add l1 l3 ++ have := @intervalIntegral.integral_comp_mul_add ℝ _ _ 1 (n + 1) 1 f one_ne_zero x₀ ++ rw [intervalIntegral.integral_add_adjacent_intervals] ++ · exact l4 ++ · apply IntegrableOn.intervalIntegrable ++ simp only [add_le_add_iff_left, le_add_iff_nonneg_left, Nat.cast_nonneg, uIcc_of_le] ++ apply hfi.mono_set ++ apply Icc_subset_Icc ++ · linarith ++ · simp ++ ++theorem hh_integrable_aux (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ (IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0)) ∧ ++ (∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π) := by ++ rw [integrableOn_Ici_iff_integrableOn_Ioi] ++ simp only [hh] ++ let g (x : ℝ) := (a * c / b) * Real.arctan (b * log (x / c)) ++ let g₀ (x : ℝ) := if x = 0 then ((a * c / b) * (- (π / 2))) else g x ++ let g' (x : ℝ) := a * (x / c * (1 + (b * Real.log (x / c)) ^ 2))⁻¹ ++ have l3 (x) (hx : 0 < x) : HasDerivAt Real.log x⁻¹ x := by apply Real.hasDerivAt_log (by linarith) ++ have l4 (x) : HasDerivAt (fun t => t / c) (1 / c) x := (hasDerivAt_id x).div_const c ++ have l2 (x) (hx : 0 < x) : HasDerivAt (fun t => log (t / c)) x⁻¹ x := by ++ have hcomp := (l3 (x / c) (by positivity)).comp x (l4 x) ++ convert hcomp using 1 ++ · rfl ++ · field_simp [hc.ne', hx.ne'] ++ have l5 (x) (hx : 0 < x) := (l2 x hx).const_mul b ++ have l1 (x) (hx : 0 < x) := (l5 x hx).arctan ++ have l6 (x) (hx : 0 < x) : HasDerivAt g (g' x) x := by ++ convert (l1 x hx).const_mul (a * c / b) using 1 ++ simp only [g'] ++ field_simp ++ have key (x) (hx : 0 < x) : HasDerivAt g₀ (g' x) x := by ++ apply (l6 x hx).congr_of_eventuallyEq ++ apply eventually_of_mem <| Ioi_mem_nhds hx ++ intro y (hy : 0 < y) ++ simp [g₀, hy.ne.symm] ++ have k1 : Tendsto g₀ atTop (𝓝 ((a * c / b) * (π / 2))) := by ++ have : g =ᶠ[atTop] g₀ := by ++ apply eventually_of_mem (Ioi_mem_atTop 0) ++ intro y (hy : 0 < y) ++ simp [g₀, hy.ne.symm] ++ apply Tendsto.congr' this ++ apply Tendsto.const_mul ++ apply (tendsto_arctan_atTop.mono_right nhdsWithin_le_nhds).comp ++ apply Tendsto.const_mul_atTop hb ++ apply tendsto_log_atTop.comp ++ apply Tendsto.atTop_div_const hc ++ apply tendsto_id ++ have k2 : Tendsto g₀ (𝓝[>] 0) (𝓝 (g₀ 0)) := by ++ have : g =ᶠ[𝓝[>] 0] g₀ := by ++ apply eventually_of_mem self_mem_nhdsWithin ++ intro x (hx : 0 < x) ; simp [g₀, hx.ne.symm] ++ simp only [g₀] ++ apply Tendsto.congr' this ++ apply Tendsto.const_mul ++ apply (tendsto_arctan_atBot.mono_right nhdsWithin_le_nhds).comp ++ apply Tendsto.const_mul_atBot hb ++ apply tendsto_log_nhdsGT_zero.comp ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨c * ε, by positivity, fun x hx1 hx2 => ⟨?_, ?_⟩⟩ ++ · simp only [mem_Ioi] at hx1 ⊢ ; positivity ++ · simp only [dist_zero_right, norm_eq_abs, norm_div, abs_eq_self.mpr hc.le] at hx2 ⊢ ++ rwa [div_lt_iff₀ hc, mul_comm] ++ have k3 : ContinuousWithinAt g₀ (Ici 0) 0 := by ++ rw [Metric.continuousWithinAt_iff] ++ rw [Metric.tendsto_nhdsWithin_nhds] at k2 ++ intro ε hε ++ obtain ⟨δ, hδ, hδx⟩ := k2 ε hε ++ refine ⟨δ, hδ, ?_⟩ ++ intro x hx hdist ++ change 0 ≤ x at hx ++ rcases lt_or_eq_of_le hx with hx | hx ++ · exact hδx hx hdist ++ · subst x ++ simpa only [dist_self] using hε ++ have k4 : ∀ x ∈ Ioi 0, 0 ≤ g' x := by ++ intro x (hx : 0 < x) ; simp only [mul_inv_rev, inv_div, g'] ; positivity ++ constructor ++ · convert_to IntegrableOn g' _ ++ exact integrableOn_Ioi_deriv_of_nonneg k3 key k4 k1 ++ · have := integral_Ioi_of_hasDerivAt_of_nonneg k3 key k4 k1 ++ simp only [mul_inv_rev, inv_div, mul_neg, ↓reduceIte, sub_neg_eq_add, g', g₀] at this ⊢ ++ convert this using 1 ; field_simp ; ring ++ ++theorem hh_integrable (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ IntegrableOn (fun t ↦ a * hh b (t / c)) (Ici 0) := ++ hh_integrable_aux ha hb hc |>.1 ++ ++theorem hh_integral (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : ++ ∫ (t : ℝ) in Ioi 0, a * hh b (t / c) = a * c / b * π := ++ hh_integrable_aux ha hb hc |>.2 ++ ++theorem hh_integral' : ∫ t in Ioi 0, hh (1 / (2 * π)) t = 2 * π ^ 2 := by ++ have := hh_integral (a := 1) (b := 1 / (2 * π)) (c := 1) ++ (by positivity) (by positivity) (by positivity) ++ convert this using 1 <;> simp ; ring ++ ++theorem bound_sum_log {C : ℝ} (hf0 : f 0 = 0) ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ ++ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by ++ let ggg (i : ℕ) : ℝ := if i = 0 then 1 else gg x i ++ have l0 : x ≠ 0 := by linarith ++ have l1 i : 0 ≤ ggg i := by by_cases hi : i = 0 <;> simp only [gg, one_div, mul_inv_rev, hi, ++ ↓reduceIte, zero_le_one, ggg] ; positivity ++ have l2 : Antitone ggg := by ++ intro i j hij ; by_cases hi : i = 0 <;> by_cases hj : j = 0 <;> simp only [hj, ↓reduceIte, hi, ++ le_refl, ggg] ++ · exact gg_le_one _ ++ · omega ++ · simp only [gg_of_hh l0] ++ gcongr ++ apply hh_antitone one_div_two_pi_mem_Ioo ++ · simp only [mem_Ioi] ; positivity ++ · simp only [mem_Ioi] ; positivity ++ · gcongr ++ have l3 : 0 ≤ C := by simpa [cumsum, hf0] using hf 1 ++ have l4 : 0 ≤ ∫ (t : ℝ) in Ioi 0, hh (π⁻¹ * 2⁻¹) t := ++ setIntegral_nonneg measurableSet_Ioi (fun x hx => hh_nonneg _ (LT.lt.le hx)) ++ have l5 {n : ℕ} : AntitoneOn (fun t ↦ x⁻¹ * hh (1 / (2 * π)) (t / x)) (Ioc 0 n) := by ++ intro u hu v hv huv ++ have hu1 := hu.1 ++ have hv1 := hv.1 ++ simp only ++ apply mul_le_mul le_rfl ?_ (hh_nonneg _ (by positivity)) (by positivity) ++ apply hh_antitone one_div_two_pi_mem_Ioo (by simp only [mem_Ioi] ; positivity) ++ (by simp only [mem_Ioi] ; positivity) ++ apply (div_le_div_iff_of_pos_right (by positivity)).mpr huv ++ have l6 {n : ℕ} : IntegrableOn (fun t ↦ x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (Icc 0 n) volume := by ++ apply IntegrableOn.mono_set ++ (hh_integrable (by positivity) (by positivity) (by positivity)) Icc_subset_Ici_self ++ apply Real.tsum_le_of_sum_range_le (fun n => by positivity) ; intro n ++ convert_to ∑ i ∈ Finset.range n, ‖f i‖ * ggg i ≤ _ ++ · congr ; ext i ++ by_cases hi : i = 0 ++ · simp [hi, hf0] ++ · simp only [gg, hi, ↓reduceIte, ggg] ++ field_simp ++ apply cancel_main' (fun _ => norm_nonneg _) (by simp [hf0]) l1 hf l2 n |>.trans ++ gcongr ; simp only [cumsum, gg_of_hh l0, one_div, mul_inv_rev, ggg] ++ by_cases hn : n = 0 ++ · simp only [hn, Finset.range_zero, Finset.sum_empty] ; positivity ++ replace hn : 0 < n := by omega ++ have : Finset.range n = {0} ∪ Finset.Ico 1 n := by ++ ext i ; simp ; by_cases hi : i = 0 <;> simp [hi, hn] ; omega ++ simp only [this, Finset.singleton_union, Finset.mem_Ico, nonpos_iff_eq_zero, one_ne_zero, ++ false_and, not_false_eq_true, Finset.sum_insert, ↓reduceIte, add_le_add_iff_left, ge_iff_le] ++ convert_to ∑ x_1 ∈ Finset.Ico 1 n, x⁻¹ * hh (π⁻¹ * 2⁻¹) (↑x_1 / x) ≤ _ ++ · apply Finset.sum_congr rfl (fun i hi => ?_) ++ simp at hi ++ have : i ≠ 0 := by omega ++ simp [this] ++ simp_rw [Finset.sum_Ico_eq_sum_range, add_comm 1] ++ have := @sum_le_integral 0 (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t / x)) (n - 1) ++ (by simpa using l5) (by simpa using l6) ++ simp only [zero_add] at this ++ apply this.trans ++ rw [@intervalIntegral.integral_comp_div ℝ _ _ 0 ↑(n - 1) x (fun t => x⁻¹ * hh (π⁻¹ * 2⁻¹) (t)) l0] ++ simp only [zero_div, intervalIntegral.integral_const_mul, smul_eq_mul, ← mul_assoc, ++ mul_inv_cancel₀ l0, one_mul] ++ have : (0 : ℝ) ≤ ↑(n - 1) / x := by positivity ++ rw [intervalIntegral.intervalIntegral_eq_integral_uIoc] ++ simp only [this, ↓reduceIte, uIoc_of_le, smul_eq_mul, one_mul, ge_iff_le] ++ apply integral_mono_measure ++ · apply Measure.restrict_mono Ioc_subset_Ioi_self le_rfl ++ · apply eventually_of_mem (self_mem_ae_restrict measurableSet_Ioi) ++ intro x (hx : 0 < x) ++ apply hh_nonneg _ hx.le ++ · have h := (@hh_integrable 1 (1 / (2 * π)) 1 (by positivity) (by positivity) (by positivity)) ++ have h' := h.mono_set Ioi_subset_Ici_self ++ unfold IntegrableOn at h' ++ apply h'.congr ++ exact Eventually.of_forall (fun t => by simp) ++ ++theorem bound_sum_log0 {C : ℝ} ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ ++ C * (1 + ∫ t in Ioi 0, hh (1 / (2 * π)) t) := by ++ let f0 i := if i = 0 then 0 else f i ++ have l1 : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f0 k : ℂ)‖) n ≤ C * n) := by ++ intro n ; refine Finset.sum_le_sum (fun i _ => ?_) |>.trans (hf n) ++ by_cases hi : i = 0 <;> simp [hi, f0] ++ have l2 i : ‖f i‖ / i = ‖f0 i‖ / i := by by_cases hi : i = 0 <;> simp [hi, f0] ++ simp_rw [l2] ; apply bound_sum_log rfl l1 hx ++ ++theorem bound_sum_log' {C : ℝ} ++ (hf : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ {x : ℝ} (hx : 1 ≤ x) : ++ ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ ≤ C * (1 + 2 * π ^ 2) := by ++ simpa only [hh_integral'] using bound_sum_log0 hf hx ++ ++variable (f x) in ++theorem summable_fourier_aux (ψ : W21) (i : ℕ) : ++ ‖f i / i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (i / x))‖ ≤ ++ W21.norm ψ * (‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹) := by ++ convert mul_le_mul_of_nonneg_left (decay_bounds_key ψ (1 / (2 * π) * log (i / x))) ++ (norm_nonneg (f i / i)) using 1 ++ · simp ++ · change _ = _ * (W21.norm ψ * _) ++ simp only [W21.norm, mul_inv_rev, one_div, Complex.norm_div, RCLike.norm_natCast] ++ ring ++ ++theorem summable_fourier (x : ℝ) (hx : 0 < x) (ψ : W21) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by ++ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by ++ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) ++ have l6 := summable_fourier_aux x f ψ ++ exact Summable.of_nonneg_of_le (fun _ => norm_nonneg _) l6 ++ (by simpa using l5.const_smul (W21.norm ψ)) ++ ++theorem bound_I1 (x : ℝ) (hx : 0 < x) (ψ : W21) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ ++ W21.norm ψ • ∑' i, ‖f i‖ / i * (1 + (1 / (2 * π) * log (i / x)) ^ 2)⁻¹ := by ++ have l5 : Summable fun i ↦ ‖f i‖ / ↑i * ((1 + (1 / (2 * ↑π) * ↑(Real.log (↑i / x))) ^ 2)⁻¹) := by ++ simpa using limiting_fourier_lim1_aux hcheby hx 1 (zero_le_one' ℝ) ++ have l6 := summable_fourier_aux x f ψ ++ have l1 : Summable fun i ↦ ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑i / x))‖ := by ++ exact summable_fourier x hx ψ hcheby ++ apply (norm_tsum_le_tsum_norm l1).trans ++ change (∑' i, ‖f i / ↑i * 𝓕 (ψ : ℝ → ℂ) ++ (1 / (2 * π) * Real.log (↑i / x))‖) ≤ W21.norm ψ * _ ++ rw [← tsum_mul_left] ++ exact Summable.tsum_mono l1 (l5.mul_left (W21.norm ψ)) l6 ++ ++theorem bound_I1' {C : ℝ} (x : ℝ) (hx : 1 ≤ x) (ψ : W21) ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x))‖ ≤ ++ W21.norm ψ * C * (1 + 2 * π ^ 2) := by ++ apply bound_I1 x (by linarith) ψ ⟨_, hcheby⟩ |>.trans ++ rw [smul_eq_mul, mul_assoc] ++ apply mul_le_mul le_rfl (bound_sum_log' hcheby hx) ?_ W21.norm_nonneg ++ apply tsum_nonneg (fun i => by positivity) ++ ++theorem bound_I2 (x : ℝ) (ψ : W21) : ++ ‖∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ W21.norm ψ * (2 * π ^ 2) := by ++ have key a : ‖𝓕 (ψ : ℝ → ℂ) (a / (2 * π))‖ ≤ W21.norm ψ * (1 + (a / (2 * π)) ^ 2)⁻¹ := ++ decay_bounds_key ψ _ ++ have twopi : 0 ≤ 2 * π := by simp [pi_nonneg] ++ have l3 : Integrable (fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹) := ++ integrable_inv_one_add_sq.comp_div (by norm_num [pi_ne_zero]) ++ have l2 : IntegrableOn (fun i ↦ W21.norm ψ * (1 + (i / (2 * π)) ^ 2)⁻¹) (Ici (-Real.log x)) := by ++ exact (l3.const_mul _).integrableOn ++ have l1 : IntegrableOn (fun i ↦ ‖𝓕 (ψ : ℝ → ℂ) (i / (2 * π))‖) (Ici (-Real.log x)) := by ++ refine ((l3.const_mul (W21.norm ψ)).mono' ?_ ?_).integrableOn ++ · apply Continuous.aestronglyMeasurable ; fun_prop ++ · simp only [norm_norm, key] ; simp ++ have l5 : 0 ≤ᵐ[volume] fun a ↦ (1 + (a / (2 * π)) ^ 2)⁻¹ := by ++ apply Eventually.of_forall ; intro x ; positivity ++ refine (norm_integral_le_integral_norm _).trans <| (setIntegral_mono l1 l2 key).trans ?_ ++ rw [integral_const_mul] ; gcongr ++ · apply W21.norm_nonneg ++ refine (setIntegral_le_integral l3 l5).trans ?_ ++ rw [Measure.integral_comp_div (fun x => (1 + x ^ 2)⁻¹) (2 * π)] ++ simp [abs_eq_self.mpr twopi] ; ring_nf ; rfl ++ ++theorem bound_main {C : ℝ} (A : ℂ) (x : ℝ) (hx : 1 ≤ x) (ψ : W21) ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ ‖∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))‖ ≤ ++ W21.norm ψ * (C * (1 + 2 * π ^ 2) + ‖A‖ * (2 * π ^ 2)) := by ++ have l1 := bound_I1' x hx ψ hcheby ++ have l2 := mul_le_mul (le_refl ‖A‖) (bound_I2 x ψ) (by positivity) (by positivity) ++ apply norm_sub_le _ _ |>.trans ; rw [norm_mul] ++ convert _root_.add_le_add l1 l2 using 1 ; ring ++ ++ ++theorem limiting_cor_W21 (ψ : W21) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := by ++ ++ let S1 x (ψ : ℝ → ℂ) := ∑' (n : ℕ), f n / ↑n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * Real.log (↑n / x)) ++ let S2 x (ψ : ℝ → ℂ) := ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π)) ++ let S x ψ := S1 x ψ - S2 x ψ ; change Tendsto (fun x ↦ S x ψ) atTop (𝓝 0) ++ ++ obtain g := compactTruncation ++ let Ψ R := g.scale R * ψ ++ have key R : Tendsto (fun x ↦ S x (Ψ R)) atTop (𝓝 0) := limiting_cor (Ψ R) hf hcheby hG hG' ++ ++ obtain ⟨C, hcheby⟩ := hcheby ++ have hC : 0 ≤ C := by ++ have : ‖f 0‖ ≤ C := by simpa [cumsum] using hcheby 1 ++ have : 0 ≤ ‖f 0‖ := by positivity ++ linarith ++ have key2 : Tendsto (fun R ↦ W21.norm (ψ - Ψ R)) atTop (𝓝 0) := W21_approximation ψ g ++ simp_rw [Metric.tendsto_nhds] at key key2 ⊢ ; intro ε hε ++ let M := C * (1 + 2 * π ^ 2) + ‖(A : ℂ)‖ * (2 * π ^ 2) ++ obtain ⟨R, hRψ⟩ := (key2 ((ε / 2) / (1 + M)) (by positivity)).exists ++ simp only [dist_zero_right, Real.norm_eq_abs, abs_eq_self.mpr W21.norm_nonneg] at hRψ key ++ ++ filter_upwards [eventually_ge_atTop 1, key R (ε / 2) (by positivity)] with x hx key ++ ++ have key3 : ‖S x (ψ - Ψ R)‖ < ε / 2 := by ++ have hbound := @bound_main f C A x hx (ψ - Ψ R) hcheby ++ change ‖S x (⇑ψ - ⇑(Ψ R))‖ ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * M at hbound ++ apply hbound.trans_lt ++ calc ++ W21.norm (⇑ψ - ⇑(Ψ R)) * M ≤ W21.norm (⇑ψ - ⇑(Ψ R)) * (1 + M) := ++ mul_le_mul_of_nonneg_left (by linarith) W21.norm_nonneg ++ _ < ε / 2 := (lt_div_iff₀ (show 0 < 1 + M by positivity)).mp hRψ ++ ++ have S1_sub_1 x : 𝓕 (⇑ψ - ⇑(Ψ R)) x = 𝓕 (ψ : ℝ → ℂ) x - 𝓕 ⇑(Ψ R) x := ++ F_sub ψ.hf (Ψ R : W21).hf x ++ have S1_sub : S1 x (ψ - Ψ R) = S1 x ψ - S1 x (Ψ R) := by ++ simp only [one_div, mul_inv_rev, S1_sub_1, mul_sub, S1] ; apply Summable.tsum_sub ++ · have := summable_fourier x (by positivity) ψ ⟨_, hcheby⟩ ++ rw [summable_norm_iff] at this ++ simpa using this ++ · have hsum := summable_fourier x (by positivity) (Ψ R : W21) ⟨_, hcheby⟩ ++ rw [summable_norm_iff] at hsum ++ simpa only [W21.ofCS2, one_div, mul_inv_rev] using hsum ++ have S2_sub : S2 x (ψ - Ψ R) = S2 x ψ - S2 x (Ψ R) := by ++ simp only [S1_sub_1, S2] ; rw [integral_sub] ++ · ring ++ · exact ψ.integrable_fourier (by positivity) |>.restrict ++ · exact (Ψ R : W21).integrable_fourier (by positivity) |>.restrict ++ have S_sub : S x (ψ - Ψ R) = S x ψ - S x (Ψ R) := by simp [S, S1_sub, S2_sub] ; ring ++ simpa [S_sub, Ψ] using norm_add_le _ _ |>.trans_lt (_root_.add_lt_add key3 key) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem limiting_cor_schwartz (ψ : 𝓢(ℝ, ℂ)) (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun x : ℝ ↦ ∑' n, f n / n * 𝓕 (ψ : ℝ → ℂ) (1 / (2 * π) * log (n / x)) - ++ A * ∫ u in Set.Ici (-log x), 𝓕 (ψ : ℝ → ℂ) (u / (2 * π))) atTop (𝓝 0) := ++ limiting_cor_W21 ψ hf hcheby hG hG' ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem fourier_surjection_on_schwartz (f : 𝓢(ℝ, ℂ)) : ∃ g : 𝓢(ℝ, ℂ), 𝓕 g = f := by ++ refine ⟨𝓕⁻ f, ?_⟩ ++ exact FourierTransform.fourier_fourierInv_eq f ++ ++ ++ ++ ++ ++ ++noncomputable def toSchwartz (f : ℝ → ℂ) (h1 : ContDiff ℝ ∞ f) ++ (h2 : HasCompactSupport f) : 𝓢(ℝ, ℂ) := ++ h2.toSchwartzMap h1 ++ ++@[simp] theorem toSchwartz_apply (f : ℝ → ℂ) {h1 h2 x} : SchwartzMap.mk f h1 h2 x = f x := rfl ++ ++theorem comp_exp_support0 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ ∀ᶠ x in 𝓝 0, Ψ x = 0 := ++ notMem_tsupport_iff_eventuallyEq.mp (fun h => lt_irrefl 0 <| mem_Ioi.mp (hplus h)) ++ ++theorem comp_exp_support1 {Ψ : ℝ → ℂ} (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ ∀ᶠ x in atBot, Ψ (exp x) = 0 := ++ Real.tendsto_exp_atBot <| comp_exp_support0 hplus ++ ++theorem comp_exp_support2 {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) : ++ ∀ᶠ (x : ℝ) in atTop, (Ψ ∘ rexp) x = 0 := by ++ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, ++ cocompact_eq_atBot_atTop] at hsupp ++ exact Real.tendsto_exp_atTop hsupp.2 ++ ++theorem comp_exp_support {Ψ : ℝ → ℂ} (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : HasCompactSupport (Ψ ∘ rexp) := by ++ simp only [hasCompactSupport_iff_eventuallyEq, coclosedCompact_eq_cocompact, ++ cocompact_eq_atBot_atTop] ++ exact ⟨comp_exp_support1 hplus, comp_exp_support2 hsupp⟩ ++ ++theorem wiener_ikehara_smooth_aux (l0 : Continuous Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) (x : ℝ) (hx : 0 < x) : ++ ∫ (u : ℝ) in Ioi (-Real.log x), ↑(rexp u) * Ψ (rexp u) = ∫ (y : ℝ) in Ioi (1 / x), Ψ y := by ++ have l1 : ContinuousOn rexp (Ici (-Real.log x)) := by fun_prop ++ have l2 : Tendsto rexp atTop atTop := Real.tendsto_exp_atTop ++ have l3 t (_ : t ∈ Ioi (-log x)) : HasDerivWithinAt rexp (rexp t) (Ioi t) t := ++ (Real.hasDerivAt_exp t).hasDerivWithinAt ++ have l4 : ContinuousOn Ψ (rexp '' Ioi (-Real.log x)) := by fun_prop ++ have l5 : IntegrableOn Ψ (rexp '' Ici (-Real.log x)) volume := ++ (l0.integrable_of_hasCompactSupport hsupp).integrableOn ++ have l6 : IntegrableOn (fun x ↦ rexp x • (Ψ ∘ rexp) x) (Ici (-Real.log x)) volume := by ++ refine (Continuous.integrable_of_hasCompactSupport (by fun_prop) ?_).integrableOn ++ change HasCompactSupport (rexp • (Ψ ∘ rexp)) ++ exact (comp_exp_support hsupp hplus).smul_left ++ have := MeasureTheory.integral_deriv_smul_comp_Ioi l1 l2 l3 l4 l5 l6 ++ simpa [Real.exp_neg, Real.exp_log hx] using this ++ ++theorem wiener_ikehara_smooth_sub (h1 : Integrable Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Ioi 0) : ++ Tendsto (fun x ↦ (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ obtain ⟨ε, hε, hh⟩ := Metric.eventually_nhds_iff.mp <| comp_exp_support0 hplus ++ apply tendsto_nhds_of_eventually_eq ; filter_upwards [eventually_gt_atTop ε⁻¹] with x hxε ++ have l1 : Integrable (indicator (Ioi x⁻¹) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi ++ have l2 : Integrable (indicator (Ioi 0) (fun x : ℝ => Ψ x)) := h1.indicator measurableSet_Ioi ++ simp_rw [← MeasureTheory.integral_indicator measurableSet_Ioi, ← mul_sub, ← integral_sub l1 l2] ++ simp only [mul_eq_zero, ofReal_eq_zero] ++ right ++ apply MeasureTheory.integral_eq_zero_of_ae ++ apply Eventually.of_forall ++ intro t ++ simp only [Pi.zero_apply] ++ have hε' : 0 < ε⁻¹ := by positivity ++ have hx : 0 < x := by linarith ++ have hx' : 0 < x⁻¹ := by positivity ++ have hεx : x⁻¹ < ε := (inv_lt_comm₀ hε hx).mp hxε ++ have l3 : Ioi 0 = Ioc 0 x⁻¹ ∪ Ioi x⁻¹ := by ++ ext t ; simp only [mem_Ioi, mem_union, mem_Ioc] ; constructor <;> intro h ++ · simp [h, le_or_gt] ++ · cases h with ++ | inl h => exact h.1 ++ | inr h => exact hx'.trans h ++ have l4 : Disjoint (Ioc 0 x⁻¹) (Ioi x⁻¹) := by simp ++ have l5 := Set.indicator_union_of_disjoint l4 Ψ ++ rw [l3, l5] ++ simp only ++ rw [add_comm, sub_add_cancel_left] ++ by_cases ht : t ∈ Ioc 0 x⁻¹ ++ · simp only [ht, indicator_of_mem, neg_eq_zero] ++ apply hh ; simp only [mem_Ioc, dist_zero_right, norm_eq_abs] at ht ⊢ ++ apply hεx.trans_le' ++ rw [abs_le] ; constructor <;> linarith ++ simp [ht] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem wiener_ikehara_smooth (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x - A * ∫ y in Set.Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ let h (x : ℝ) : ℂ := rexp (2 * π * x) * Ψ (exp (2 * π * x)) ++ have h1 : ContDiff ℝ ∞ h := by ++ have : ContDiff ℝ ∞ (fun x : ℝ => (rexp (2 * π * x))) := (contDiff_const.mul contDiff_id).exp ++ exact (contDiff_ofReal.comp this).mul (hsmooth.comp this) ++ have h2 : HasCompactSupport h := by ++ have hπ : 2 * π ≠ 0 := by simp [pi_ne_zero] ++ have hh : HasCompactSupport (fun x : ℝ => Ψ (rexp (2 * π * x))) := by ++ simpa only [Function.comp_def, smul_eq_mul] using ++ (comp_exp_support hsupp hplus).comp_smul hπ ++ change HasCompactSupport ++ ((fun x : ℝ => (rexp (2 * π * x) : ℂ)) * fun x : ℝ => Ψ (rexp (2 * π * x))) ++ exact hh.mul_left ++ obtain ⟨g, hg⟩ := fourier_surjection_on_schwartz (toSchwartz h h1 h2) ++ have l1 {y} (hy : 0 < y) : y * Ψ y = 𝓕 g (1 / (2 * π) * Real.log y) := by ++ rw [hg] ++ change (y : ℂ) * Ψ y = h (1 / (2 * π) * Real.log y) ++ have harg : 2 * π * (1 / (2 * π) * Real.log y) = Real.log y := by ++ rw [← mul_assoc, mul_one_div_cancel (mul_ne_zero (by norm_num) pi_ne_zero), one_mul] ++ dsimp only [h] ++ rw [harg, Real.exp_log hy] ++ have key := limiting_cor_schwartz g hf hcheby hG hG' ++ have l2 : ∀ᶠ x in atTop, ∑' (n : ℕ), f n / ↑n * 𝓕 g (1 / (2 * π) * Real.log (↑n / x)) = ++ ∑' (n : ℕ), f n * Ψ (↑n / x) / x := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ congr ; ext n ++ by_cases hn : n = 0 ++ · simp [hn, (comp_exp_support0 hplus).self_of_nhds] ++ rw [← l1 (by positivity)] ++ have : (n : ℂ) ≠ 0 := by simpa using hn ++ have : (x : ℂ) ≠ 0 := by simpa using hx.ne.symm ++ simp only [ofReal_div, ofReal_natCast] ++ field_simp ++ have l3 : ∀ᶠ x in atTop, ↑A * ∫ (u : ℝ) in Ici (-Real.log x), 𝓕 g (u / (2 * π)) = ++ ↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ congr 1 ++ rw [hg] ++ change (∫ u in Ici (-Real.log x), h (u / (2 * π))) = ∫ y in Ioi x⁻¹, Ψ y ++ dsimp only [h] ++ have hscale : (2 : ℝ) * π ≠ 0 := mul_ne_zero (by norm_num) pi_ne_zero ++ have harg (u : ℝ) : 2 * π * (u / (2 * π)) = u := mul_div_cancel₀ u hscale ++ simp_rw [harg] ++ rw [MeasureTheory.integral_Ici_eq_integral_Ioi] ++ simpa only [one_div] using wiener_ikehara_smooth_aux hsmooth.continuous hsupp hplus x hx ++ have l4 : Tendsto (fun x => (↑A * ∫ (y : ℝ) in Ioi x⁻¹, Ψ y) - ↑A * ∫ (y : ℝ) in Ioi 0, Ψ y) ++ atTop (𝓝 0) := by ++ exact wiener_ikehara_smooth_sub (hsmooth.continuous.integrable_of_hasCompactSupport hsupp) hplus ++ simpa [tsum_div_const] using (key.congr' <| EventuallyEq.sub l2 l3) |>.add l4 ++ ++ ++ ++theorem wiener_ikehara_smooth' (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := ++ tendsto_sub_nhds_zero_iff.mp <| wiener_ikehara_smooth hf hcheby hG hG' hsmooth hsupp hplus ++ ++ ++local instance coeRealFunctionComplex {E : Type*} : Coe (E → ℝ) (E → ℂ) := ++ ⟨fun f n => f n⟩ ++ ++@[norm_cast] ++theorem set_integral_ofReal {f : ℝ → ℝ} {s : Set ℝ} : ∫ x in s, (f x : ℂ) = ∫ x in s, f x := ++ integral_ofReal ++ ++theorem wiener_ikehara_smooth_real {f : ℕ → ℝ} {Ψ : ℝ → ℝ} ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (hsmooth : ContDiff ℝ ∞ Ψ) (hsupp : HasCompactSupport Ψ) ++ (hplus : closure (Function.support Ψ) ⊆ Set.Ioi 0) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * Ψ (n / x)) / x) atTop (nhds (A * ∫ y in Set.Ioi 0, Ψ y)) := by ++ let Ψ' := ofReal ∘ Ψ ++ have l1 : ContDiff ℝ ∞ Ψ' := contDiff_ofReal.comp hsmooth ++ have l2 : HasCompactSupport Ψ' := hsupp.comp_left rfl ++ have l3 : closure (Function.support Ψ') ⊆ Ioi 0 := by rwa [Function.support_comp_eq] ; simp ++ have key := (continuous_re.tendsto _).comp ++ (@wiener_ikehara_smooth' A Ψ G f hf hcheby hG hG' l1 l2 l3) ++ simp at key ; norm_cast at key ++ ++theorem interval_approx_inf (ha : 0 < a) (hab : a < b) : ++ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ ++ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ ++ ψ ≤ indicator (Ico a b) 1 ∧ b - a - ε ≤ ∫ y in Ioi 0, ψ y := by ++ have l1 : Iio ((b - a) / 3) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds <| by ++ rw [← sub_pos] at hab ++ positivity ++ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < (b - a) / 3) ++ have l2 : a < a + ε / 2 := by simp [hε] ++ have l3 : b - ε / 2 < b := by simp [hε] ++ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 ++ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ ++ · simp [h5, hab.ne, Icc_subset_Ioi_iff hab.le, ha] ++ · exact h4.trans <| indicator_le_indicator_of_subset Ioo_subset_Ico_self (by simp) ++ · have l4 : 0 ≤ b - a - ε := by linarith ++ have l5 : Icc (a + ε / 2) (b - ε / 2) ⊆ Ioi 0 := by ++ intro t ht ++ simp only [mem_Icc, mem_Ioi] at ht ⊢ ++ exact ha.trans <| l2.trans_le <| ht.1 ++ have l6 : Icc (a + ε / 2) (b - ε / 2) ∩ Ioi 0 = Icc (a + ε / 2) (b - ε / 2) := ++ inter_eq_left.mpr l5 ++ have l7 : ∫ y in Ioi 0, indicator (Icc (a + ε / 2) (b - ε / 2)) 1 y = b - a - ε := by ++ simp only [measurableSet_Icc, integral_indicator_one, measureReal_restrict_apply, l6, ++ volume_real_Icc] ++ convert max_eq_left l4 using 1 ; ring_nf ++ have l8 : IntegrableOn ψ (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ rw [← l7] ; apply setIntegral_mono ?_ l8 h3 ++ rw [IntegrableOn, integrable_indicator_iff measurableSet_Icc] ++ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self ++ apply integrableOn_const <;> ++ simp ++ ++theorem interval_approx_sup (ha : 0 < a) (hab : a < b) : ++ ∀ᶠ ε in 𝓝[>] 0, ∃ ψ : ℝ → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ ++ closure (Function.support ψ) ⊆ Set.Ioi 0 ∧ ++ indicator (Ico a b) 1 ≤ ψ ∧ ∫ y in Ioi 0, ψ y ≤ b - a + ε := by ++ have l1 : Iio (a / 2) ∈ 𝓝[>] 0 := nhdsWithin_le_nhds <| Iio_mem_nhds (by linarith) ++ filter_upwards [self_mem_nhdsWithin, l1] with ε (hε : 0 < ε) (hε' : ε < a / 2) ++ have l2 : a - ε / 2 < a := by linarith ++ have l3 : b < b + ε / 2 := by linarith ++ obtain ⟨ψ, h1, h2, h3, h4, h5⟩ := smooth_urysohn_support_Ioo l2 l3 ++ refine ⟨ψ, h1, h2, ?_, ?_, ?_⟩ ++ · have l4 : a - ε / 2 < b + ε / 2 := by linarith ++ have l5 : ε / 2 < a := by linarith ++ simp [h5, l4.ne, Icc_subset_Ioi_iff l4.le, l5] ++ · apply le_trans ?_ h3 ++ apply indicator_le_indicator_of_subset Ico_subset_Icc_self (by simp) ++ · have l4 : 0 ≤ b - a + ε := by linarith ++ have l5 : Ioo (a - ε / 2) (b + ε / 2) ⊆ Ioi 0 := by intro t ht ; simp at ht ⊢ ; linarith ++ have l6 : Ioo (a - ε / 2) (b + ε / 2) ∩ Ioi 0 = Ioo (a - ε / 2) (b + ε / 2) := ++ inter_eq_left.mpr l5 ++ have l7 : ∫ y in Ioi 0, indicator (Ioo (a - ε / 2) (b + ε / 2)) 1 y = b - a + ε := by ++ simp only [measurableSet_Ioo, integral_indicator_one, measureReal_restrict_apply, l6, ++ volume_real_Ioo] ++ convert max_eq_left l4 using 1 ; ring_nf ++ have l8 : IntegrableOn ψ (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ rw [← l7] ++ refine setIntegral_mono l8 ?_ h4 ++ rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo] ++ apply IntegrableOn.mono ?_ subset_rfl Measure.restrict_le_self ++ apply integrableOn_const <;> ++ simp ++ ++theorem WI_summable {f : ℕ → ℝ} {g : ℝ → ℝ} (hg : HasCompactSupport g) (hx : 0 < x) : ++ Summable (fun n => f n * g (n / x)) := by ++ obtain ⟨M, hM⟩ := hg.bddAbove.mono subset_closure ++ apply summable_of_hasFiniteSupport ++ unfold Function.HasFiniteSupport ++ simp only [Function.support_mul] ; apply Finite.inter_of_right ; rw [finite_iff_bddAbove] ++ exact ⟨Nat.ceil (M * x), fun i hi => by simpa using Nat.ceil_mono ((div_le_iff₀ hx).mp (hM hi))⟩ ++ ++theorem WI_sum_le {f : ℕ → ℝ} {g₁ g₂ : ℝ → ℝ} (hf : 0 ≤ f) (hg : g₁ ≤ g₂) (hx : 0 < x) ++ (hg₁ : HasCompactSupport g₁) (hg₂ : HasCompactSupport g₂) : ++ (∑' n, f n * g₁ (n / x)) / x ≤ (∑' n, f n * g₂ (n / x)) / x := by ++ apply div_le_div_of_nonneg_right ?_ hx.le ++ exact Summable.tsum_le_tsum (fun n => mul_le_mul_of_nonneg_left (hg _) (hf _)) ++ (WI_summable hg₁ hx) (WI_summable hg₂ hx) ++ ++theorem WI_sum_Iab_le {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hb : 0 < b) (hxb : 2 / b < x) : ++ (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by ++ have hb' : 0 < 2 / b := by positivity ++ have hx : 0 < x := by linarith ++ have hxb' : 2 < x * b := (div_lt_iff₀ hb).mp hxb ++ have l1 (i : ℕ) (hi : i ∉ Finset.range ⌈b * x⌉₊) : f i * indicator (Ico a b) 1 (i / x) = 0 := by ++ simp_all [le_div_iff₀ hx] ++ have l2 (i : ℕ) (_ : i ∈ Finset.range ⌈b * x⌉₊) : ++ f i * indicator (Ico a b) 1 (i / x) ≤ |f i| := by ++ rw [abs_eq_self.mpr (hpos _)] ++ convert_to _ ≤ f i * 1 ++ · ring ++ apply mul_le_mul_of_nonneg_left ?_ (hpos _) ++ by_cases hi : (i / x) ∈ (Ico a b) <;> simp [hi] ++ rw [tsum_eq_sum l1, div_le_iff₀ hx, mul_assoc, mul_assoc] ++ apply Finset.sum_le_sum l2 |>.trans ++ have := hcheby ⌈b * x⌉₊ ; simp only [norm_real, norm_eq_abs] at this ; apply this.trans ++ have : 0 ≤ C := by have := hcheby 1 ; simp only [cumsum, Finset.range_one, norm_real, ++ Finset.sum_singleton, Nat.cast_one, mul_one] at this ; exact (abs_nonneg _).trans this ++ refine mul_le_mul_of_nonneg_left ?_ this ++ apply (Nat.ceil_lt_add_one (by positivity)).le.trans ++ linarith ++ ++theorem WI_sum_Iab_le' {f : ℕ → ℝ} (hpos : 0 ≤ f) {C : ℝ} ++ (hcheby : (∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hb : 0 < b) : ++ ∀ᶠ x : ℝ in atTop, (∑' n, f n * indicator (Ico a b) 1 (n / x)) / x ≤ C * 2 * b := by ++ filter_upwards [eventually_gt_atTop (2 / b)] with x hx using WI_sum_Iab_le hpos hcheby hb hx ++ ++theorem le_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[>] b, a ≤ c) : a ≤ b := by ++ exact ge_of_tendsto ++ (show Tendsto (fun c : ℝ => c) (𝓝[>] b) (𝓝 b) from nhdsWithin_le_nhds) h ++ ++theorem ge_of_eventually_nhdsWithin {a b : ℝ} (h : ∀ᶠ c in 𝓝[<] b, c ≤ a) : b ≤ a := by ++ exact le_of_tendsto ++ (show Tendsto (fun c : ℝ => c) (𝓝[<] b) (𝓝 b) from nhdsWithin_le_nhds) h ++ ++theorem WI_tendsto_aux (a b : ℝ) {A : ℝ} (hA : 0 < A) : ++ Tendsto (fun c => c / A - (b - a)) (𝓝[>] (A * (b - a))) (𝓝[>] 0) := by ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨A * ε, by positivity, ?_⟩ ++ intro x hx1 hx2 ++ constructor ++ · simpa [lt_div_iff₀' hA] ++ · simp only [Real.dist_eq, dist_zero_right, Real.norm_eq_abs] at hx2 ⊢ ++ have : |x / A - (b - a)| = |x - A * (b - a)| / A := by ++ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp ++ rwa [this, div_lt_iff₀' hA] ++ ++theorem WI_tendsto_aux' (a b : ℝ) {A : ℝ} (hA : 0 < A) : ++ Tendsto (fun c => (b - a) - c / A) (𝓝[<] (A * (b - a))) (𝓝[>] 0) := by ++ rw [Metric.tendsto_nhdsWithin_nhdsWithin] ++ intro ε hε ++ refine ⟨A * ε, by positivity, ?_⟩ ++ intro x hx1 hx2 ++ constructor ++ · simpa [div_lt_iff₀' hA] ++ · simp only [Real.dist_eq, dist_zero_right, norm_eq_abs] at hx2 ⊢ ++ have : |(b - a) - x / A| = |A * (b - a) - x| / A := by ++ rw [← abs_eq_self.mpr hA.le, ← abs_div, abs_eq_self.mpr hA.le] ; congr ; field_simp ++ rwa [this, div_lt_iff₀' hA, ← neg_sub, abs_neg] ++ ++theorem residue_nonneg {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm (fun n ↦ ↑(f n)) σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : EqOn G (fun s ↦ LSeries (fun n ↦ ↑(f n)) s - ↑A / (s - 1)) {s | 1 < s.re}) : ++ 0 ≤ A := by ++ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x ++ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by ++ filter_upwards [eventually_ge_atTop 0] with x hx ++ exact div_nonneg (tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _))) hx ++ obtain ⟨ε, ψ, h1, h2, h3, h4, -⟩ := (interval_approx_sup zero_lt_one one_lt_two).exists ++ have key := @wiener_ikehara_smooth_real A G f ψ hf hcheby hG hG' h1 h2 h3 ++ have l2 : 0 ≤ ψ := by apply le_trans _ h4 ; apply indicator_nonneg ; simp ++ have l1 : ∀ᶠ x in atTop, 0 ≤ S ψ x := hSnonneg l2 ++ have l3 : 0 ≤ A * ∫ (y : ℝ) in Ioi 0, ψ y := ge_of_tendsto key l1 ++ have l4 : 0 < ∫ (y : ℝ) in Ioi 0, ψ y := by ++ have r1 : 0 ≤ᵐ[Measure.restrict volume (Ioi 0)] ψ := Eventually.of_forall l2 ++ have r2 : IntegrableOn (fun y ↦ ψ y) (Ioi 0) volume := ++ (h1.continuous.integrable_of_hasCompactSupport h2).integrableOn ++ have r3 : Ico 1 2 ⊆ Function.support ψ := by ++ intro x hx ; have := h4 x ; simp [hx] at this ⊢ ; linarith ++ have r4 : Ico 1 2 ⊆ Function.support ψ ∩ Ioi 0 := by ++ simp only [subset_inter_iff, r3, ++ true_and] ; apply Ico_subset_Icc_self.trans ; rw [Icc_subset_Ioi_iff] <;> linarith ++ have r5 : 1 ≤ volume ((Function.support fun y ↦ ψ y) ∩ Ioi 0) := by ++ convert volume.mono r4 ; norm_num ++ simpa [setIntegral_pos_iff_support_of_nonneg_ae r1 r2] using zero_lt_one.trans_le r5 ++ have := div_nonneg l3 l4.le ; field_simp at this ; exact this ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem WienerIkeharaInterval {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun x : ℝ ↦ (∑' n, f n * (indicator (Ico a b) 1 (n / x))) / x) ++ atTop (nhds (A * (b - a))) := by ++ ++ by_cases hab : a = b ++ · simp [hab] ++ replace hb : a < b := lt_of_le_of_ne hb hab ; clear hab ++ ++ let S (g : ℝ → ℝ) (x : ℝ) := (∑' n, f n * g (n / x)) / x ++ have hSnonneg {g : ℝ → ℝ} (hg : 0 ≤ g) : ∀ᶠ x : ℝ in atTop, 0 ≤ S g x := by ++ filter_upwards [eventually_ge_atTop 0] with x hx ++ refine div_nonneg ?_ hx ++ refine tsum_nonneg (fun i => mul_nonneg (hpos _) (hg _)) ++ have hA : 0 ≤ A := residue_nonneg hpos hf hcheby hG hG' ++ ++ let Iab : ℝ → ℝ := indicator (Ico a b) 1 ++ change Tendsto (S Iab) atTop (𝓝 (A * (b - a))) ++ have hIab : HasCompactSupport Iab := by ++ simpa [Iab, HasCompactSupport, tsupport, hb.ne] using isCompact_Icc ++ have Iab_nonneg : ∀ᶠ x : ℝ in atTop, 0 ≤ S Iab x := hSnonneg (indicator_nonneg (by simp)) ++ have Iab2 : IsBoundedUnder (· ≤ ·) atTop (S Iab) := by ++ obtain ⟨C, hC⟩ := hcheby ; exact ⟨C * 2 * b, WI_sum_Iab_le' hpos hC (by linarith)⟩ ++ have Iab3 : IsBoundedUnder (· ≥ ·) atTop (S Iab) := ⟨0, Iab_nonneg⟩ ++ have Iab0 : IsCoboundedUnder (· ≥ ·) atTop (S Iab) := Iab2.isCoboundedUnder_ge ++ have Iab1 : IsCoboundedUnder (· ≤ ·) atTop (S Iab) := Iab3.isCoboundedUnder_le ++ ++ have sup_le : limsup (S Iab) atTop ≤ A * (b - a) := by ++ have l_sup : ∀ᶠ ε in 𝓝[>] 0, limsup (S Iab) atTop ≤ A * (b - a + ε) := by ++ filter_upwards [interval_approx_sup ha hb] with ε happrox ++ rcases happrox with ⟨ψ, h1, h2, h3, h4, h6⟩ ++ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 ++ have l6 : S Iab ≤ᶠ[atTop] S ψ := by ++ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h4 hx hIab h2 ++ have l5 : IsBoundedUnder (· ≤ ·) atTop (S ψ) := l1.isBoundedUnder_le ++ have l3 : limsup (S Iab) atTop ≤ limsup (S ψ) atTop := limsup_le_limsup l6 Iab1 l5 ++ apply l3.trans ; rw [l1.limsup_eq] ; gcongr ++ obtain rfl | h := eq_or_ne A 0 ++ · simpa using l_sup ++ apply le_of_eventually_nhdsWithin ++ have key : 0 < A := lt_of_le_of_ne hA h.symm ++ filter_upwards [WI_tendsto_aux a b key l_sup] with x hx ++ simpa [mul_div_cancel₀ _ h] using hx ++ ++ have le_inf : A * (b - a) ≤ liminf (S Iab) atTop := by ++ have l_inf : ∀ᶠ ε in 𝓝[>] 0, A * (b - a - ε) ≤ liminf (S Iab) atTop := by ++ filter_upwards [interval_approx_inf ha hb] with ε happrox ++ rcases happrox with ⟨ψ, h1, h2, h3, h5, h6⟩ ++ have l1 : Tendsto (S ψ) atTop _ := wiener_ikehara_smooth_real hf hcheby hG hG' h1 h2 h3 ++ have l2 : S ψ ≤ᶠ[atTop] S Iab := by ++ filter_upwards [eventually_gt_atTop 0] with x hx using WI_sum_le hpos h5 hx h2 hIab ++ have l4 : IsBoundedUnder (· ≥ ·) atTop (S ψ) := l1.isBoundedUnder_ge ++ have l3 : liminf (S ψ) atTop ≤ liminf (S Iab) atTop := liminf_le_liminf l2 l4 Iab0 ++ apply le_trans ?_ l3 ; rw [l1.liminf_eq] ; gcongr ++ obtain rfl | h := eq_or_ne A 0 ++ · simpa using l_inf ++ apply ge_of_eventually_nhdsWithin ++ have key : 0 < A := lt_of_le_of_ne hA h.symm ++ filter_upwards [WI_tendsto_aux' a b key l_inf] with x hx ++ simpa [mul_div_cancel₀ _ h] using hx ++ ++ have : liminf (S Iab) atTop ≤ limsup (S Iab) atTop := liminf_le_limsup Iab2 Iab3 ++ refine tendsto_of_liminf_eq_limsup ?_ ?_ Iab2 Iab3 <;> linarith ++ ++ ++ ++theorem le_floor_mul_iff (hb : 0 ≤ b) (hx : 0 < x) : n ≤ ⌊b * x⌋₊ ↔ n / x ≤ b := by ++ rw [div_le_iff₀ hx, Nat.le_floor_iff] ; positivity ++ ++theorem lt_ceil_mul_iff (hx : 0 < x) : n < ⌈b * x⌉₊ ↔ n / x < b := by ++ rw [div_lt_iff₀ hx, Nat.lt_ceil] ++ ++theorem ceil_mul_le_iff (hx : 0 < x) : ⌈a * x⌉₊ ≤ n ↔ a ≤ n / x := by ++ rw [le_div_iff₀ hx, Nat.ceil_le] ++ ++theorem mem_Icc_iff_div (hb : 0 ≤ b) (hx : 0 < x) : ++ n ∈ Finset.Icc ⌈a * x⌉₊ ⌊b * x⌋₊ ↔ n / x ∈ Icc a b := by ++ rw [Finset.mem_Icc, mem_Icc, ceil_mul_le_iff hx, le_floor_mul_iff hb hx] ++ ++theorem mem_Ico_iff_div (hx : 0 < x) : n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊ ↔ n / x ∈ Ico a b := by ++ rw [Finset.mem_Ico, mem_Ico, ceil_mul_le_iff hx, lt_ceil_mul_iff hx] ++ ++theorem tsum_indicator {f : ℕ → ℝ} (hx : 0 < x) : ++ ∑' n, f n * (indicator (Ico a b) 1 (n / x)) = ∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n := by ++ have l1 : ∀ n ∉ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n * indicator (Ico a b) 1 (↑n / x) = 0 := by ++ simp [mem_Ico_iff_div hx] ; tauto ++ rw [tsum_eq_sum l1] ; apply Finset.sum_congr rfl ; simp only ++ [mem_Ico_iff_div hx] ; intro n hn ; simp [hn] ++ ++theorem WienerIkeharaInterval_discrete {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun x : ℝ ↦ (∑ n ∈ Finset.Ico ⌈a * x⌉₊ ⌈b * x⌉₊, f n) / x) ++ atTop (nhds (A * (b - a))) := by ++ apply (WienerIkeharaInterval hpos hf hcheby hG hG' ha hb).congr' ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ rw [tsum_indicator hx] ++ ++theorem WienerIkeharaInterval_discrete' {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) ++ (ha : 0 < a) (hb : a ≤ b) : ++ Tendsto (fun N : ℕ ↦ (∑ n ∈ Finset.Ico ⌈a * N⌉₊ ⌈b * N⌉₊, f n) / N) ++ atTop (nhds (A * (b - a))) := ++ WienerIkeharaInterval_discrete hpos hf hcheby hG hG' ha hb |>.comp tendsto_natCast_atTop_atTop ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem tendsto_mul_ceil_div : ++ Tendsto (fun (p : ℝ × ℕ) => ⌈p.1 * p.2⌉₊ / (p.2 : ℝ)) (𝓝[>] 0 ×ˢ atTop) (𝓝 0) := by ++ rw [Metric.tendsto_nhds] ; intro δ hδ ++ have l1 : ∀ᶠ ε : ℝ in 𝓝[>] 0, ε ∈ Ioo 0 (δ / 2) := ++ inter_mem_nhdsWithin _ (Iio_mem_nhds (by positivity)) ++ have l2 : ∀ᶠ N : ℕ in atTop, 1 ≤ δ / 2 * N := by ++ apply Tendsto.eventually_ge_atTop ++ exact tendsto_natCast_atTop_atTop.const_mul_atTop (by positivity) ++ filter_upwards [l1.prod_mk l2] with p hp ++ rcases p with ⟨ε, N⟩ ++ rcases hp with ⟨⟨hε, h1⟩, h2⟩ ++ dsimp only at * ++ have l3 : 0 < (N : ℝ) := by ++ simp only [Nat.cast_pos, Nat.pos_iff_ne_zero] ; rintro rfl ; simp [zero_lt_one.not_ge] at h2 ++ have l5 : 0 ≤ ε * ↑N := by positivity ++ have l6 : ε * N ≤ δ / 2 * N := mul_le_mul h1.le le_rfl (by positivity) (by positivity) ++ simp only [dist_zero_right, norm_div, RCLike.norm_natCast, div_lt_iff₀ l3, gt_iff_lt] ++ convert (Nat.ceil_lt_add_one l5).trans_le (add_le_add l6 h2) using 1 ; ring ++ ++ ++ ++noncomputable def S (f : ℕ → 𝕜) (ε : ℝ) (N : ℕ) : 𝕜 := (∑ n ∈ Finset.Ico ⌈ε * N⌉₊ N, f n) / N ++ ++theorem S_sub_S {f : ℕ → 𝕜} {ε : ℝ} {N : ℕ} (hε : ε ≤ 1) : ++ S f 0 N - S f ε N = cumsum f ⌈ε * N⌉₊ / N := by ++ have r1 : Finset.range N = Finset.range ⌈ε * N⌉₊ ∪ Finset.Ico ⌈ε * N⌉₊ N := by ++ simp_rw [Finset.range_eq_Ico] ++ symm ++ apply Finset.Ico_union_Ico_eq_Ico (Nat.zero_le _) ++ simp only [Nat.ceil_le] ++ exact mul_le_of_le_one_left N.cast_nonneg hε ++ have r2 : Disjoint (Finset.range ⌈ε * N⌉₊) (Finset.Ico ⌈ε * N⌉₊ N) := by ++ rw [Finset.range_eq_Ico] ; apply Finset.Ico_disjoint_Ico_consecutive ++ simp [S, r1, Finset.sum_union r2, cumsum, add_div] ++ ++theorem tendsto_S_S_zero {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) : ++ TendstoUniformlyOnFilter (S f) (S f 0) (𝓝[>] 0) atTop := by ++ rw [Metric.tendstoUniformlyOnFilter_iff] ; intro δ hδ ++ obtain ⟨C, hC⟩ := hcheby ++ have l1 : ∀ᶠ (p : ℝ × ℕ) in 𝓝[>] 0 ×ˢ atTop, C * ⌈p.1 * p.2⌉₊ / p.2 < δ := by ++ have r1 := tendsto_mul_ceil_div.const_mul C ++ simp only [mul_div_assoc', mul_zero] at r1 ; exact r1 (Iio_mem_nhds hδ) ++ have : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) ++ filter_upwards [l1, Eventually.prod_inl this _] with p h1 h2 ++ rcases p with ⟨ε, N⟩ ++ have l2 : ‖cumsum f ⌈ε * ↑N⌉₊ / ↑N‖ ≤ C * ⌈ε * N⌉₊ / N := by ++ have r1 := hC ⌈ε * N⌉₊ ++ have r2 : 0 ≤ cumsum f ⌈ε * N⌉₊ := by apply cumsum_nonneg hpos ++ simp only [norm_real, norm_of_nonneg (hpos _), norm_div, ++ norm_of_nonneg r2, Real.norm_natCast] at r1 ⊢ ++ apply div_le_div_of_nonneg_right r1 (by positivity) ++ simpa [dist_eq_norm, ← S_sub_S h2.2] using l2.trans_lt h1 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem WienerIkeharaTheorem' {f : ℕ → ℝ} (hpos : 0 ≤ f) ++ (hf : ∀ (σ' : ℝ), 1 < σ' → Summable (nterm f σ')) ++ (hcheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(f k : ℂ)‖) n ≤ C * n)) ++ (hG : ContinuousOn G {s | 1 ≤ s.re}) ++ (hG' : Set.EqOn G (fun s ↦ LSeries f s - A / (s - 1)) {s | 1 < s.re}) : ++ Tendsto (fun N => cumsum f N / N) atTop (𝓝 A) := by ++ convert_to Tendsto (S f 0) atTop (𝓝 A) ; · ext N ; simp [S, cumsum] ++ apply (tendsto_S_S_zero hpos hcheby).tendsto_of_eventually_tendsto ++ · have L0 : Ioc 0 1 ∈ 𝓝[>] (0 : ℝ) := inter_mem_nhdsWithin _ (Iic_mem_nhds zero_lt_one) ++ apply eventually_of_mem L0 ++ · intro ε hε ++ convert WienerIkeharaInterval_discrete' hpos hf hcheby hG hG' hε.1 hε.2 using 1 ++ funext N ++ simp only [S, one_mul, Nat.ceil_natCast] ++ · have : Tendsto (fun ε : ℝ => ε) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds ++ simpa using (this.const_sub 1).const_mul A ++ ++theorem vonMangoldt_cheby : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := by ++ use Real.log 4 + 4 ++ intro N ++ by_cases! h : N = 0 ++ · simp [h, cumsum] ++ simp only [cumsum, norm_real, norm_eq_abs] ++ rw [Nat.range_eq_Icc_zero_sub_one _ h, (by simp : N - 1 = ⌊(N : ℝ) - 1⌋₊)] ++ simp_rw [abs_of_nonneg vonMangoldt_nonneg] ++ rw [← Chebyshev.psi_eq_sum_Icc] ++ grw [Chebyshev.psi_le_const_mul_self <| sub_nonneg_of_le <| Nat.one_le_cast_iff_ne_zero.mpr h] ++ gcongr ++ linarith ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++theorem WeakPNT : Tendsto (fun N ↦ cumsum Λ N / N) atTop (𝓝 1) := by ++ let F := vonMangoldt.LFunctionResidueClassAux (q := 1) 1 ++ have l1 (n : ℕ) : 0 ≤ Λ n := vonMangoldt_nonneg ++ have l2 s (hs : 1 < s.re) : F s = LSeries Λ s - 1 / (s - 1) := by ++ have := vonMangoldt.eqOn_LFunctionResidueClassAux (q := 1) isUnit_one hs ++ simp only [F, this, vonMangoldt.residueClass, Nat.totient_one, Nat.cast_one, ++ inv_one, one_div, sub_left_inj] ++ apply LSeries_congr ++ intro n _ ++ simp only [ofReal_inj, indicator_apply_eq_self, Set.mem_ofPred_eq] ++ exact fun hn ↦ absurd (Subsingleton.eq_one _) hn ++ have l3 : ContinuousOn F {s | 1 ≤ s.re} := vonMangoldt.continuousOn_LFunctionResidueClassAux 1 ++ have l4 : (∃ C : ℝ, ∀ n : ℕ, cumsum (fun k : ℕ ↦ ‖(Λ k : ℂ)‖) n ≤ C * n) := vonMangoldt_cheby ++ have l5 (σ' : ℝ) (hσ' : 1 < σ') : Summable (nterm Λ σ') := by ++ simpa only [← nterm_eq_norm_term] ++ using (@ArithmeticFunction.LSeriesSummable_vonMangoldt σ' hσ').norm ++ apply WienerIkeharaTheorem' l1 l5 l4 l3 l2 ++ ++end ZetaFivePNT +diff --git a/lakefile.toml b/lakefile.toml +index 2f3660d..71d9c89 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -1,17 +1,5 @@ + name = "PrimeNumberTheoremAnd" +-defaultTargets = ["PrimeNumberTheoremAnd"] +- +-[leanOptions] +-pp.unicode.fun = true +-pp.proofs.withType = false +-autoImplicit = false +-relaxedAutoImplicit = false +-linter.mathlibStandardSet = true +-linter.style.header = false +-linter.style.openClassical = false +-linter.style.longLine = false +-linter.style.emptyLine = false +-linter.flexible = true ++defaultTargets = ["PrimeNumberTheoremAnd.Wiener", "PrimeNumberTheoremAndZetaFive"] + + [[require]] + name = "LeanArchitect" +@@ -39,3 +27,24 @@ rev = "v4.34.0" + + [[lean_lib]] + name = "PrimeNumberTheoremAnd" ++leanOptions = { autoImplicit = false } ++ ++[[lean_lib]] ++name = "PrimeNumberTheoremAndZetaFive" ++roots = ["PrimeNumberTheoremAnd.ZetaFive"] ++globs = ["PrimeNumberTheoremAnd.ZetaFive.*"] ++ ++[[lean_lib]] ++name = "PrimeNumberTheoremAndCatalan" ++roots = ["PrimeNumberTheoremAnd.Catalan"] ++globs = ["PrimeNumberTheoremAnd.Catalan.*"] ++ ++[[lean_lib]] ++name = "PrimeNumberTheoremAndSiegelZeros" ++roots = ["PrimeNumberTheoremAnd.SiegelZeros.HadamardSupport"] ++globs = ["PrimeNumberTheoremAnd.SiegelZeros.*"] ++ ++[[lean_lib]] ++name = "PrimeNumberTheoremAndErdos970" ++roots = ["PrimeNumberTheoremAnd.Erdos970"] ++globs = ["PrimeNumberTheoremAnd.Erdos970.*"] +diff --git a/lean-toolchain b/lean-toolchain +index 664e12d..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.34.0 +\ No newline at end of file ++leanprover/lean4:v4.34.1 +diff --git a/PrimeNumberTheoremAnd/IEANTN/Mertens.lean b/PrimeNumberTheoremAnd/IEANTN/Mertens.lean +--- a/PrimeNumberTheoremAnd/IEANTN/Mertens.lean ++++ b/PrimeNumberTheoremAnd/IEANTN/Mertens.lean +@@ -14,7 +14,7 @@ + import Mathlib.Analysis.SpecialFunctions.Log.Summable + import Mathlib.Algebra.Group.Submonoid.BigOperators + import PrimeNumberTheoremAnd.EulerMaclaurin +-import Architect ++ + + + theorem Filter.EventuallyEq.iff_eventually {α : Type _} {β : Type _} {l : Filter α} {f g : α → β} : f =ᶠ[l] g ↔ ∀ᶠ (x : α) in l, f x = g x := by rfl +@@ -284,23 +284,23 @@ + + namespace Mertens + +-blueprint_comment /-- +-\section{Mertens' theorems} +- +-In this section we give explicit versions of Mertens' theorems: +-\begin{itemize} +-\item Mertens' first theorem (von Mangoldt form): $\sum_{n \leq x} \frac{\Lambda(n)}{n} = \log x + O(1)$. +-\item Mertens' first theorem (prime form): $\sum_{p \leq x} \frac{\log p}{p} = \log x + O(1)$. +-\item Mertens' second theorem (von Mangoldt form): $\sum_{n \leq x} \frac{\Lambda(n)}{n \log n} = \log \log x + \gamma + O(1/\log x)$. +-\item Mertens' second theorem (prime form): $\sum_{p \leq x} \frac{1}{p} = \log \log x + M + O(1/\log x)$, where $M$ is the Meissel-Mertens constant. +-\item Mertens' third theorem: $\prod_{p \leq x} (1 - \frac{1}{p}) = e^{-\gamma}/\log x + O(1/\log^2 x)$. +-\end{itemize} +-We aim to upstreaming these results to Mathlib. In particular, the arguments here should be self-contained and written for efficiency, coherency, and clarity. As such, extensive use of AI tools is \emph{strongly discouraged} in this section. +- +-The arguments here are drawn from Leo Goldmakher's ``A quick proof of Mertens' theorem'' from https://web.williams.edu/Mathematics/lg5/mertens.pdf +- +-The unfinished formalization of Mertens' theorems by Arend Mellendijk in https://github.com/FLDutchmann/Analytic/blob/main/Analytic/Mertens.lean may also be relevant here. +--/ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + open Real Finset Filter Asymptotics Topology +@@ -311,17 +311,17 @@ + rw [(by rfl : Ioc 0 x = Icc 1 x), ← add_sum_Ioc_eq_sum_Icc hx] + simpa + +-@[blueprint +- "Mertens-sum-log" +- (title := "Partial sum of logarithm identity") +- (statement := /-- For any $x \geq 1$, one has +-$$ \sum_{n \leq x} \log n = x \log x - (\{ x \}-1/2) \log x - x + 1 + \int_1^x (\{ t \}-1/2) \frac{dt}{t} $$ +-(NOTE: this identity is not actually needed in the proof of Mertens' theorems, but may be worth recording nevertheless.) +- -/) +- (proof := /-- Apply the Euler-Maclaurin formula. +- -/) +- (latexEnv := "lemma") +- (discussion := 1303)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_log_eq {x : ℝ} (hx : 1 ≤ x) : + ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n = + x * log x - (x - ⌊x⌋₊ - 1 / 2) * log x - x + 1 + ∫ t in 1..x, (t - ⌊t⌋₊ - 1 / 2) / t := by +@@ -339,16 +339,16 @@ + · simp only [deriv_log', Set.uIcc_of_le hx] + fun_prop (disch := grind) + +-@[blueprint +- "Mertens-sum-log-le" +- (title := "Partial sum of logarithm upper bound") +- (statement := /-- For any $x \geq 1$, one has +-$$ \sum_{n \leq x} \log n \leq x \log x.$$ +- -/) +- (proof := /-- Trivial since $\log n \leq \log x$. +- -/) +- (latexEnv := "lemma") +- (discussion := 1304)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_log_le {x : ℝ} (hx : 1 ≤ x) : + ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n ≤ x * log x := by + calc +@@ -374,25 +374,25 @@ + grw [← norm_eq_abs, intervalIntegral.norm_integral_le_of_norm_le_const this, + abs_of_nonneg (by linarith)] + +-@[blueprint +- "Mertens-sum-log-ge" +- (title := "Partial sum of logarithm lower bound") +- (statement := /-- For any $x \geq 1$, one has +-$$ \sum_{n \leq x} \log n \geq x \log x - 2 x.$$ +- -/) +- (proof := /-- We have +- \begin{align*} +- \sum_{n \leq x} \log n &= \sum_{2 \leq n \leq \lfloor x \rfloor} \log n \\ +- &\geq \sum_{2 \leq n \leq \lfloor x \rfloor} \int_{n-1}^n \log t \, dt \\ +- &= \int_1^{\lfloor x \rfloor} \log t \, dt \\ +- &\geq \int_1^x \log t\ dt - \log x \\ +- &= x \log x - x - \log x \\ +- &\geq x \log x - 2 x. +-\end{align*} +-Here we use the monotonicity of $\log n$ (and its vanishing at $n=1$) and the crude bound $\log x \leq x$. Note: the tools at Mathlib.Analysis.SumIntegralComparisons may be useful. +- -/) +- (latexEnv := "corollary") +- (discussion := 1305)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_log_ge {x : ℝ} (hx : 1 ≤ x) : + ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n ≥ x * log x - 2 * x := by + have one_le_floor : 1 ≤ ⌊x⌋₊ := by simpa +@@ -422,16 +422,16 @@ + tsub_le_iff_right, sub_add_cancel, le_add_iff_nonneg_right, zero_le_one] + _ ≥ _ := by linarith [log_le_self (by linarith : 0 ≤ x)] + +-@[blueprint +- "Mertens-sum-log-eq-log-factorial" +- (title := "Partial sum of logarithm as logarithm of factorial") +- (statement := /-- For any $x \geq 1$, one has +-$$ \sum_{n \leq x} \log n = \log(\lfloor x \rfloor!). $$ +- -/) +- (proof := /-- Follows from the definition of the factorial function. Is not needed for the Mertens theorems, but is a natural fact to have. +- -/) +- (latexEnv := "proposition") +- (discussion := 1315)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_log_eq_log_factorial (x : ℝ) : + ∑ n ∈ Ioc 0 ⌊ x ⌋₊, log n = log (Nat.floor x).factorial := by + rw [←prod_Ico_id_eq_factorial, ←log_prod, prod_natCast] +@@ -439,47 +439,47 @@ + intro x hx + simp at hx ⊢; grind + +-@[blueprint +- "Mertens-sum-log-eq-sum-mangoldt" +- (title := "Partial sum of logarithm as sum of $\\Lambda(d)/d$") +- (statement := /-- For any real $x$, one has +-$$ \sum_{n \leq x} \log n = \sum_{d \leq x} \Lambda(d) \lfloor \frac{x}{d} \rfloor.$$ +--/) +- (proof := /-- We have +-\begin{align*} +-\sum_{n \leq x} \log n +-&= \sum_{n \leq x} \sum_{d \mid n} \Lambda(d) +-= \sum_{d \leq x} \Lambda(d) \sum_{n \leq x, d \mid n} 1 +-= \sum_{d \leq x} \Lambda(d) \left\lfloor \frac{x}{d} \right\rfloor. +-\end{align*} +- -/) +- (latexEnv := "lemma") +- (discussion := 1306)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_log_eq_sum_mangoldt {x : ℝ} : + ∑ n ∈ Ioc 0 ⌊x⌋₊, log n = ∑ d ∈ Ioc 0 ⌊x⌋₊, Λ d * ⌊x / d⌋₊ := by + have : ∀ n : ℕ, log n = (Λ * zeta) n := by simp [vonMangoldt_mul_zeta] + simp_rw [this, sum_Ioc_mul_zeta_eq_sum, ← Nat.floor_div_natCast] + +-@[blueprint +- "Mertens-first-error-mangoldt" +- (title := "The remainder term in Mertens first theorem (von Mangoldt form)") +- (statement := /-- We define $E_{1,\Lambda}(x) := \sum_{d \leq x} \frac{\Lambda(d)}{d} - \log x$. +--/)] ++ ++ ++ ++ ++ + noncomputable abbrev E₁Λ (x : ℝ) : ℝ := ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d - log x + + theorem sum_mangoldt_div_eq (x : ℝ) : ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d = log x + E₁Λ x := by + grind + +-@[blueprint +- "Mertens-first-error-mangoldt-ge" +- (title := "Partial sum of $\\Lambda(d)/d$ lower bound") +- (statement := /-- For any $x \geq 1$, one has +-$$ E_{1,\Lambda}(x) \geq - 2.$$ +--/) +- (proof := /-- Insert Lemma \ref{Mertens-sum-log-eq-sum-mangoldt} into Lemma \ref{Mertens-sum-log-ge} and lower bound $x/d$ by $\lfloor x/d \rfloor$. +- -/) +- (latexEnv := "corollary") +- (discussion := 1307)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₁Λ.ge {x : ℝ} (hx : 1 ≤ x) : + E₁Λ x ≥ -2 := by + unfold E₁Λ +@@ -498,16 +498,16 @@ + + + +-@[blueprint +- "Mertens-first-error-mangoldt-le" +- (title := "Partial sum of $\\Lambda(d)/d$ upper bound") +- (statement := /-- For any $x \geq 1$, one has +-$$ E_{1,\Lambda}(x) \leq \log 4 + 4.$$ +--/) +- (proof := /-- Insert Lemma \ref{Mertens-sum-log-eq-sum-mangoldt} into Lemma \ref{Mertens-sum-log-le} and upper bound $x/d$ by $\lfloor x/d \rfloor + 1$, and use the Mathlib bound $\psi(x) \leq (\log 4 + 4) x$. +- -/) +- (latexEnv := "corollary") +- (discussion := 1308)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₁Λ.le {x : ℝ} (hx : 1 ≤ x) : + E₁Λ x ≤ log 4 + 4 := by + unfold E₁Λ +@@ -529,16 +529,16 @@ + · exact Chebyshev.psi_le_const_mul_self (by linarith) + _ = _ := by ring + +-@[blueprint +- "Mertens-first-theorem-mangoldt" +- (title := "Mertens' first theorem (von Mangoldt form)") +- (statement := /-- For any $x \geq 1$, one has +-$$ \sum_{n \leq x} \frac{\Lambda(n)}{n} = \log x + O(1). $$ +--/) +- (proof := /-- Immediate from previous two corollaries. +- -/) +- (latexEnv := "corollary") +- (discussion := 1309)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_mangoldt_div_eq_log {x : ℝ} (hx : 1 ≤ x) : + |∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d - log x| ≤ log 4 + 4 := by + grind [E₁Λ.le hx, E₁Λ.ge hx, log_nonneg] +@@ -548,9 +548,9 @@ + + + +-@[blueprint +- "Mertens-first-error-mangoldt" +- (discussion := 1309)] ++ ++ ++ + theorem E₁Λ.bounded : E₁Λ =O[atTop] (fun _ ↦ (1:ℝ)) := by + simp only [isBigO_iff, norm_eq_abs, norm_one, mul_one, + eventually_atTop] +@@ -560,34 +560,34 @@ + simp only [isLittleO_one_left_iff, norm_eq_abs] + exact tendsto_abs_atTop_atTop.comp tendsto_log_atTop + +-@[blueprint +- "Mertens-first-error-mangoldt" +- (discussion := 1309)] ++ ++ ++ + theorem sum_mangoldt_div_eq_log' : + (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / d) ~[atTop] (fun x ↦ log x) := by + apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log) + convert! E₁Λ.bounded using 1 + +-@[blueprint +- "Mertens-first-error-prime" +- (title := "The remainder term in Mertens first theorem (prime form)") +- (statement := /-- We define $E_{1,p}(x) := \sum_{p \leq x} \frac{\log p}{p} - \log x$. +--/)] ++ ++ ++ ++ ++ + noncomputable abbrev E₁p (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p - log x + + theorem sum_log_prime_div_eq (x : ℝ) : ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p = log x + E₁p x := by + grind + +-@[blueprint +- "Mertens-first-error-prime-le-mangoldt" +- (title := "Prime error for Mertens first theorem bounded by von Mangoldt error") +- (statement := /-- For any $x \geq 1$, one has +-$$ E_{1,p}(x) \leq E_{1,\Lambda}(x). $$ +--/) +- (proof := /-- Drop all terms in Lemma \ref{Mertens-sum-log-eq-sum-mangoldt} arising from prime powers. +- -/) +- (latexEnv := "corollary") +- (discussion := 1311)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₁p.le_E₁Λ (x : ℝ) : + E₁p x ≤ E₁Λ x := by + unfold E₁p E₁Λ; rw [sum_filter] +@@ -597,15 +597,15 @@ + have : 0 ≤ Λ p := vonMangoldt_nonneg + positivity + +-@[blueprint +- "Mertens-first-error-prime-le" +- (title := "Partial sum of $\\frac{\\log p}{p}$ upper bound") +- (statement := /-- For any $x \geq 1$, one has +-$$ E_{1,p}(x) \leq \log 4 + 4.$$ +--/) +- (proof := /-- Drop all terms in Lemma \ref{Mertens-sum-mangoldt-div-le} arising from prime powers. +- -/) +- (latexEnv := "corollary")] ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₁p.le {x : ℝ} (hx : 1 ≤ x) : + E₁p x ≤ log 4 + 4 := by + linarith [E₁Λ.le hx, E₁p.le_E₁Λ x] +@@ -619,14 +619,14 @@ + exact_mod_cast h.one_le + · rfl + +-@[blueprint +- "E1_summable" +- (title := "$E_1$ summable") +- (statement := /-- The series $E_1 := \sum_p \frac{\log p}{p(p-1)}$ converges. -/) +- (proof := /-- We have $\sum_{n=2}^\infty \frac{\log n}{n(n-1)}$ converges by comparison with $\sum_{n=2}^\infty \frac{2\log n}{n^2}$, which converges by the integral test. By a further application of comparison test we can conclude that $E_1$ converges as well. +- Alternatively bound $\log n$ by $2\sqrt n$ and use the existing Mathlib API for $\sum n^{-3/2}$.-/) +- (latexEnv := "proposition") +- (discussion := 1352)] ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₁.summable : Summable (fun p : ℕ ↦ if p.Prime then (log p) / (p*(p-1)) else 0) := by + refine (Real.summable_one_div_nat_rpow.mpr (by norm_num: 1 < (3 : ℝ) / 2)|>.const_div + 4).of_nonneg_of_le E₁.summand_nonneg fun n ↦ ?_ +@@ -733,13 +733,13 @@ + _ = _ := by + exact integral_log_div_sq + +-@[blueprint +- "E1_bound" +- (title := "Upper bound on $E_1$") +- (statement := /-- One has $E_1 \leq \frac{5 \log 2 + 3}{4}$-/) +- (proof := /-- We can bound $E_1 \leq \sum_{n=2}^\infty \frac{\log n}{n(n-1)} \leq \frac{\log 2}{2} + \frac{3}{2} \sum_{n=3}^\infty \frac{\log n}{n^2}$. Calculus shows that $\log x / x^2$ is decreasing for $x \geq 2 > e^{1/2}$, so we can bound $\sum_{n=3}^\infty \frac{\log n}{n^2} \leq \int_2^\infty \frac{\log t}{t^2}\ dt = \frac{\log 2+1}{2}$.-/) +- (latexEnv := "proposition") +- (discussion := 1316)] ++ ++ ++ ++ ++ ++ ++ + theorem E₁.le : E₁ ≤ (5 * log 2 + 3) / 4 := by + unfold E₁ + calc +@@ -769,20 +769,20 @@ + theorem E₁.nonneg : E₁ ≥ 0 := + tsum_nonneg E₁.summand_nonneg + +-@[blueprint +- "Mertens-first-error-prime-ge" +- (title := "Partial sum of $\\frac{\\log p}{p}$ lower bound") +- (statement := /-- For any $x \geq 1$, one has +-$$ E_{1,\Lambda}(x) \leq E_{1,p}(x) + E_1$$ +-and thus +-$$ E_{1,p}(x) \geq -2 - E_1$$ +-where +-$$ E_1 := \sum_{p} \frac{\log p}{p(p-1)}. $$ +--/) +- (proof := /-- Use the triangle inequality and the geometric series formula to estimate in Lemma \ref{Mertens-sum-mangoldt-div-le} arising from prime powers. +- -/) +- (latexEnv := "corollary") +- (discussion := 1312)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₁Λ.le_E₁p_add_E₁ {x : ℝ} (hx : 1 ≤ x) : + E₁Λ x ≤ E₁p x + E₁ := by + unfold E₁Λ E₁p +@@ -831,15 +831,15 @@ + linarith [E₁Λ.le_E₁p_add_E₁ hx, E₁Λ.ge hx] + + +-@[blueprint +- "Mertens-first-theorem-prime-bounded" +- (title := "Error term in Mertens' first theorem bounded (prime form)") +- (statement := /-- For any $x \geq 1$, one has +-$$ \sum_{p \leq x} \frac{\log p}{p} = \log x + O(1). $$ +--/) +- (proof := /-- Immediate from previous two corollaries. +- -/) +- (discussion := 1313)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_log_prime_div_eq_log {x : ℝ} (hx : 1 ≤ x) : + |∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p - log x| ≤ log 4 + 4 := by + rw [abs_le'] +@@ -851,31 +851,31 @@ + theorem E₁p.bounded : ∃ c > 0, ∀ x ≥ 1, |E₁p x| ≤ c := by + exact ⟨log 4 + 4, (by positivity), fun _ hx ↦ sum_log_prime_div_eq_log hx⟩ + +-@[blueprint +- "Mertens-first-theorem-prime-bounded"] ++ ++ + theorem sum_log_prime_div_eq_log' : E₁p =O[atTop] (fun _ ↦ (1:ℝ)) := by + simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, + eventually_atTop, E₁p] + exact ⟨ log 4 + 4, 1, fun _ ↦ sum_log_prime_div_eq_log ⟩ + +-@[blueprint +- "Mertens-first-theorem-prime-bounded"] ++ ++ + theorem sum_log_prime_div_eq_log'' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (log p) / p) ~[atTop] (fun x ↦ log x) := by + apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log) + convert! sum_log_prime_div_eq_log' using 1 + +-@[blueprint +- "Euler-Mascheroni-const-alt" +- (title := "Alternate Formula for Euler-Mascheroni constant") +- (statement := /-- We set $\gamma := \int_2^\infty \frac{E_{1,\Lambda}(t)}{t \log^2 t} \, dt + 1 - \log \log 2$. +--/)] ++ ++ ++ ++ ++ + noncomputable abbrev γ : ℝ := (∫ t in Set.Ioi 2, E₁Λ t / (t * log t^2)) + 1 - log (log 2) + +-@[blueprint +- "Mertens-second-error-mangoldt" +- (title := "The remainder term in Mertens second theorem (von Mangoldt form)") +- (statement := /-- We define $E_{2,\Lambda}(x) := \sum_{d \leq x} \frac{\Lambda(d)}{d \log d} - \log \log x - \gamma$. +--/)] ++ ++ ++ ++ ++ + noncomputable abbrev E₂Λ (x : ℝ) : ℝ := ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x) - γ + + lemma sum_Ioc_one_eq_sum_Icc_zero {f : ℕ → ℝ} {x : ℕ} (hx : 1 ≤ x) (hf1 : f 1 = 0) (hf0 : f 0 = 0) : +@@ -883,17 +883,17 @@ + rw [sum_Ioc_one_eq_sum_Ioc_zero hx hf1, ← add_sum_Ioc_eq_sum_Icc (by linarith)] + simpa + +-@[blueprint +- "Mertens-integral-ident" +- (title := "Integral identity involving inverse log weight") +- (statement := /-- For any $x \geq 2$ and any $f : {\mathbb N} \mapsto {\mathbb R}$, one has +-$$ \sum_{2 \leq n \leq x} \frac{f(n)}{\log n} = \frac{1}{\log x} \sum_{2 \leq n \leq x} f(n) + \int_2^x \frac{1}{t \log^2 t} \sum_{2 \leq n \leq t} f(n) \, dt$$-/) +- (proof := /-- Establish the identity +- $$ \frac{1}{\log n} = \frac{1}{\log x} + \int_2^x \frac{1}{t \log^2 t} 1_{t \geq n}\ dt$$ +- for $2 \leq n \leq x$,multiply by $f(n)$, then sum. +- +- -/) +- (latexEnv := "sublemma")] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + private theorem sum_div_log_eq {x : ℝ} (hx : 2 ≤ x) (f : ℕ → ℝ) : + ∑ n ∈ Ioc 1 ⌊ x ⌋₊, f n / log n = + (∑ n ∈ Ioc 1 ⌊ x ⌋₊, f n) / log x + ∫ t in 2..x, (∑ n ∈ Ioc 1 ⌊ t ⌋₊, f n) / (t * log t^2) := by +@@ -1008,19 +1008,19 @@ + have : log t ≠ 0 := by simp; grind + fun_prop (disch := grind) + +-@[blueprint +- "Mertens-second-error-mangoldt-eq" +- (title := "Integral form for second error (von Mangoldt form)") +- (statement := /-- For any $x \geq 2$, one has +-$$ E_{2,\Lambda}(x) = \frac{E_{1,\Lambda}(x)}{\log x} - \int_x^\infty \frac{E_{1,\Lambda}(t)}{t \log^2 t}\ dt$$ +--/) +- (proof := /-- +-From Lemma \ref{Mertens-integral-ident} one has +-$$ \sum_{n \leq x} \frac{\Lambda(n)}{n \log n} = \frac{1}{\log x} \sum_{n \leq x} \frac{\Lambda(n)}{n} + \int_2^x \frac{1}{t \log^2 t} \sum_{n \leq t} \frac{\Lambda(n)}{n} \, dt.$$ +-Now substitute the definitions of $E_{1,\Lambda}$, $E_{2,\Lambda}$, $\gamma$ and simplify. +- -/) +- (latexEnv := "corollary") +- (discussion := 1317)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₂Λ.eq {x : ℝ} (hx : 2 ≤ x) : + E₂Λ x = E₁Λ x / log x - ∫ t in Set.Ioi x, E₁Λ t / (t * log t^2) := by + unfold E₂Λ +@@ -1058,17 +1058,17 @@ + convert! tendsto_log_atTop.inv_tendsto_atTop.const_mul (-c) using 1 + simp + +-@[blueprint +- "Mertens-second-error-mangoldt-bound" +- (title := "Bound for second Mertens error (von Mangoldt form)") +- (statement := /-- For any $x \geq 2$, one has +-$$ |E_{2,\Lambda}(x)| \leq \frac{\log 4 + 6}{\log x}.$$ +--/) +- (proof := /-- +- Insert Lemma \ref{Mertens-first-error-mangoldt-le} and Lemma \ref{Mertens-first-error-mangoldt-ge} into Lemma \ref{Mertens-second-error-mangoldt-eq} and use the triangle inequality to obtain the required upper and lower bounds. +- -/) +- (latexEnv := "corollary") +- (discussion := 1318)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₂Λ.abs_le {x : ℝ} (hx : 2 ≤ x) : + |E₂Λ x| ≤ (log 4 + 6) / log x := by + have : 0 < log x := by apply log_pos; linarith +@@ -1100,8 +1100,8 @@ + grind + + +-@[blueprint +- "Mertens-second-error-mangoldt-bound"] ++ ++ + theorem E₂Λ.bound : E₂Λ =O[atTop] (fun x ↦ 1 / log x) := by + simp only [one_div, isBigO_iff, norm_eq_abs, norm_inv, eventually_atTop] + use log 4 + 6, 2 +@@ -1110,22 +1110,22 @@ + have : 0 < log x := by apply log_pos; linarith + grind [abs_of_pos this] + +-@[blueprint +- "Mertens-second-error-mangoldt-bound"] ++ ++ + theorem E₂Λ.bound' : E₂Λ =o[atTop] (fun _ ↦ (1:ℝ)) := E₂Λ.bound.trans_isLittleO inv_log_eq_o_one + +-@[blueprint +- "log-zeta-eq-1" +- (title := "Dirichlet series for $\\log \\zeta(s)$") +- (statement := /-- If $s > 1$ then $\log\zeta(s) = - \log (s-1) + \Gamma'(1) + \gamma + (s-1) \int_1^\infty E_{2,\Lambda}(x) x^{-s}\ ds$. +--/) +- (proof := /-- First use the fundamental theorem of calculus and decay of $\log \zeta(s)$ to write +- $$ \log \zeta(s) = \int_s^\infty -\frac{\zeta'(u)}{\zeta(u)}\ du.$$ +- Then substitute in the known identity +- $-\frac{\zeta'(u)}{\zeta(u)} = \sum_n \frac{\Lambda(n)}{n^u}$ and integrate term by term. +- -/) +- (latexEnv := "sublemma") +- (discussion := 1582)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem log_zeta_eq_sum (s : ℝ) (hs : 1 < s) : + log (riemannZeta (s:ℂ)).re = ∑' n, Λ n / (n^s * log n) := by + have hsc : (1 : ℝ) < ((s : ℂ)).re := by simpa using hs +@@ -1449,41 +1449,41 @@ + end LogZetaInteg + end + +-@[blueprint +- "log-zeta-eq-2" +- (title := "Integration by parts identity for $\\log \\zeta(s)$") +- (statement := /-- If $s > 1$ then $\log\zeta(s) = (s-1) \int_1^\infty (\log \log x + \gamma + E_{2,\Lambda}(x)) x^{-s})\ dx$. +--/) +- (proof := /-- Apply the preceding identity then integrate by parts. +- -/) +- (latexEnv := "sublemma") +- (discussion := 1583)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + private theorem log_zeta_eq_integ (s : ℝ) (hs : 1 < s) : + log (riemannZeta (s:ℂ)).re = (s - 1) * ∫ x in .Ioi 1, (log (log x) + γ + E₂Λ x) * x^(-s) := + LogZetaInteg.log_zeta_eq_integ_aux s hs + +-@[blueprint +- "log-zeta-eq-3" +- (title := "First integral identity") +- (statement := /-- If $s > 1$ then $(s-1) \int_1^\infty \log \log x \cdot x^{-s}\ dx = -\log (s-1) + \Gamma'(1)$. +--/) +- (proof := /-- Writing $t = \log x$, the LHS is $(s-1) \int_0^\infty \log t e^{-(s-1) t}\ dt$. Now differentiate $\Gamma(z) = (s-1)^z \int_0^\infty t^{z-1} e^{-(s-1)t}\ dt$ in $z$ at $z=1$. +- -/) +- (latexEnv := "sublemma") +- (discussion := 1584)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + private theorem mul_integ_log_log_eq (s : ℝ) (hs : 1 < s) : + (s - 1) * ∫ x in .Ioi 1, log (log x) * x^(-s) = - log (s - 1) + deriv Gamma 1 := + mul_integ_log_log_eq_aux s hs + +-@[blueprint +- "log-zeta-eq-4" +- (title := "Second integral identity") +- (statement := /-- If $s > 1$ then $(s-1) \int_1^\infty \gamma \cdot x^{-s}\ dx = \gamma$. +--/) +- (proof := /-- Apply the fundamental theorem of calculus. +- -/) +- (latexEnv := "sublemma") +- (discussion := 1585)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + private theorem mul_integ_gamma_eq (s) (hs : 1 < s) : (s - 1) * ∫ x in .Ioi 1, γ * x^(-s) = γ := by + rw [MeasureTheory.integral_const_mul γ (· ^ (-s)), @integral_Ioi_rpow_of_lt (-s), one_rpow] <;> + grind +@@ -1600,14 +1600,14 @@ + div_le_div_of_nonneg_left hc hlog2 (Real.log_le_log (by norm_num) (le_of_lt hx)) + exact (E₂Λ.abs_le (le_of_lt hx)).trans hb2 + +-@[blueprint +- "log-zeta-eq" +- (title := "An identity for $\\log \\zeta(s)$") +- (statement := /-- If $s > 1$ then $\log\zeta(s) = - \log (s-1) + \Gamma'(1) + \gamma + (s-1) \int_1^\infty E_{2,\Lambda}(x) x^{-s}\ ds$. +--/) +- (proof := /-- Combine the previous four sublemmas.-/) +- (latexEnv := "theorem") +- (discussion := 1319)] ++ ++ ++ ++ ++ ++ ++ ++ + private theorem log_zeta_eq (s : ℝ) (hs : 1 < s) : + log (riemannZeta (s:ℂ)).re = - log (s - 1) + deriv Gamma 1 + γ + (s - 1) * ∫ x in Set.Ioi 1, E₂Λ x * x^(-s) := by + -- Start from the integration-by-parts identity (#1583). +@@ -1652,15 +1652,15 @@ + (Complex.continuous_re.tendsto (1 : ℂ)).comp hcomplex + simpa [Complex.ofReal_sub, Complex.ofReal_mul] using hreal + +-@[blueprint +- "log-zeta-limit" +- (title := "limiting behavior of log zeta") +- (statement := /-- One has $\log \zeta(s) = - \log(s-1) + o(1)$ as $s \to 1^+$. +--/) +- (proof := /-- Start with the asymptotic $\zeta(s) = \frac{1}{s-1} + O(1)$ and take logarithms. +- -/) +- (latexEnv := "sublemma") +- (discussion := 1586)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + private theorem log_zeta_limit : + Filter.Tendsto + (fun s : ℝ => Real.log (riemannZeta (s : ℂ)).re + Real.log (s - 1)) +@@ -1895,14 +1895,14 @@ + + end + +-@[blueprint +- "Euler-Mascheroni-eq" +- (title := "Compatibility with Mathlib Euler-Mascheroni constant") +- (statement := /-- $\gamma$ is the Euler--Mascheroni constant. +--/) +- (proof := /-- Take limits as $s \to 1$ in the previous asymptotic using known asymptotics for $\zeta(s)$, and using that $- \Gamma'(1)$ is the Euler--Mascheroni constant. -/) +- (latexEnv := "theorem") +- (discussion := 1320)] ++ ++ ++ ++ ++ ++ ++ ++ + theorem deriv_gamma_add_γ_eq_zero : deriv Gamma 1 + γ = 0 := by + -- For `s > 1`, `log_zeta_eq` rearranges to a constant identity. + have key : ∀ s : ℝ, 1 < s → +@@ -1930,15 +1930,15 @@ + theorem sum_mangoldt_div_log_eq (x : ℝ) : ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) = log (log x) + eulerMascheroniConstant + E₂Λ x := by + grind [γ.eq_eulerMascheroni] + +-@[blueprint +- "Mertens-second-theorem-mangoldt-weak" +- (title := "Mertens' second theorem (weak von Mangoldt form)") +- (statement := /-- For any $x \geq 2$, one has +-$$ \sum_{n \leq x} \frac{\Lambda(n)}{n \log n} = \log \log x + O(1). $$ +--/) +- (proof := /-- Immediate from previous two corollaries. +- -/) +- (discussion := 1321)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_mangoldt_div_log_eq_log_log : ∃ C, ∀ x, 2 ≤ x → + |∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x)| ≤ C := by + use (log 4 + 6)/log 2 + |eulerMascheroniConstant| +@@ -1949,8 +1949,8 @@ + _ ≤ (log 4 + 6)/log x + |eulerMascheroniConstant| := by grw [abs_add_le, E₂Λ.abs_le hx] + _ ≤ _ := by gcongr + +-@[blueprint +- "Mertens-second-theorem-mangoldt-weak"] ++ ++ + theorem sum_mangoldt_div_log_eq_log_log' : (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d) - log (log x)) =O[atTop] (fun _ ↦ (1:ℝ)) := by + simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, + eventually_atTop] +@@ -1958,27 +1958,27 @@ + use C, 2 + + +-@[blueprint +- "Mertens-second-theorem-mangoldt-weak"] ++ ++ + theorem sum_mangoldt_div_log_eq_log_log'' : (fun x ↦ ∑ d ∈ Ioc 0 ⌊ x ⌋₊, (Λ d) / (d * log d)) ~[atTop] (fun x ↦ log (log x)) := by + apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log_log) + convert! sum_mangoldt_div_log_eq_log_log' using 1 + +-@[blueprint +- "Meissel-Mertens-constant" +- (title := "The Meissel-Mertens constant") +- (statement := /-- We define $M := \int_2^\infty \frac{E_{1,p}(t)}{t \log^2 t} \, dt + 1 - \log \log 2$.-/)] ++ ++ ++ ++ + noncomputable def M : ℝ := (∫ t in Set.Ioi 2, E₁p t / (t * log t^2)) + 1 - log (log 2) + +-@[blueprint +- "Mertens-second-constant-prime-le" +- (title := "Upper bound for $M$") +- (statement := /-- One has $M \leq \frac{\log 4 + 4}{\log 2} + 1 - \log \log 2$. +--/) +- (proof := /-- Insert Lemma \ref{Mertens-first-error-prime-le} into the definition of $M$ and use the fact that $\int_2^\infty \frac{dt}{t \log^2 t} = 1/\log 2$. +- -/) +- (latexEnv := "corollary") +- (discussion := 1323)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem M.le : M ≤ (log 4 + 4) / log 2 + 1 - log (log 2) := calc + _ ≤ (∫ t in Set.Ioi 2, (log 4 + 4) / (t * log t^2)) + 1 - log (log 2) := by + unfold M; gcongr with x hx +@@ -1989,15 +1989,15 @@ + simp at hx; exact E₁p.le (by linarith) + _ = _ := by rw [integ_div_mul_log_sq _ (by norm_num)] + +-@[blueprint +- "Mertens-second-constant-prime-ge" +- (title := "Lower bound for $M$") +- (statement := /-- One has $M \geq -\frac{2 + E_1}{\log 2} + 1 - \log \log 2$. +--/) +- (proof := /-- Insert Lemma \ref{Mertens-first-error-prime-ge} into the definition of $M$ and use the fact that $\int_2^\infty \frac{dt}{t \log^2 t} = 1/\log 2$. +- -/) +- (latexEnv := "corollary") +- (discussion := 1324)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem M.ge : M ≥ (-2 - E₁) / log 2 + 1 - log (log 2) := calc + _ ≥ (∫ t in Set.Ioi 2, (-2 - E₁) / (t * log t^2)) + 1 - log (log 2) := by + unfold M; gcongr with x hx +@@ -2008,29 +2008,29 @@ + simp at hx; exact E₁p.ge (by linarith) + _ = _ := by rw [integ_div_mul_log_sq _ (by norm_num)] + +-@[blueprint +- "Mertens-second-error-mangoldt" +- (title := "The remainder term in Mertens second theorem (von Mangoldt form)") +- (statement := /-- We define $E_{2,p}(x) := \sum_{p \leq x} \frac{1}{p} - \log \log x - M$. +--/)] ++ ++ ++ ++ ++ + noncomputable abbrev E₂p (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1:ℝ) / p - log (log x) - M + + theorem sum_prime_div_eq (x : ℝ) : ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1:ℝ) / p = log (log x) + M + E₂p x := by + ring + +-@[blueprint +- "Mertens-second-error-prime-eq" +- (title := "Integral form for second error (prime form)") +- (statement := /-- For any $x \geq 2$, one has +-$$ E_{2,p}(x) = \frac{E_{1,p}(x)}{\log x} - \int_x^\infty \frac{E_{1,p}(t)}{t \log^2 t}\ dt$$ +--/) +- (proof := /-- +-From Lemma \ref{Mertens-integral-ident} one has +-$$ \sum_{p \leq x} \frac{1}{p} = \frac{1}{\log x} \sum_{p \leq x} \frac{\log p}{p} + \int_2^x \frac{1}{t \log^2 t} \sum_{p \leq t} \frac{\log p}{p} \, dt.$$ +-Now substitute the definitions of $E_{1,p}$, $E_{2,p}$, $M$ and simplify. +- -/) +- (latexEnv := "corollary") +- (discussion := 1325)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₂p.eq {x : ℝ} (hx : 2 ≤ x) : + E₂p x = E₁p x / log x - ∫ t in Set.Ioi x, E₁p t / (t * log t^2) := by + unfold E₂p +@@ -2061,16 +2061,16 @@ + · rw [intervalIntegrable_iff, Set.uIoc_of_le hx] + exact integrable_E₁p_div_mul_log_sq (x := 2) (by rfl)|>.mono (by grind) (by rfl) + +-@[blueprint +- "Mertens-second-error-prime-abs-le" +- (title := "Bound for second error (prime form)") +- (statement := /-- For any $x \geq 2$, one has +-$$ |E_{2,p}(x)| \leq \frac{\log 4 + 6 + E_1}{\log x}.$$ +--/) +- (proof := /-- Similar to Lemma \ref{Mertens-second-error-prime-eq}. +- -/) +- (latexEnv := "corollary") +- (discussion := 1326)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₂p.abs_le {x : ℝ} (hx : 2 ≤ x) : + |E₂p x| ≤ (log 4 + 6 + E₁) / log x := by + have : 0 < log x := by apply log_pos; linarith +@@ -2101,8 +2101,8 @@ + grw [this] + grind + +-@[blueprint +- "Mertens-second-error-prime-abs-le"] ++ ++ + theorem E₂p.bound : E₂p =O[atTop] (fun x ↦ 1 / log x) := by + simp only [one_div, isBigO_iff, norm_eq_abs, norm_inv, eventually_atTop] + use log 4 + 6 + E₁, 2 +@@ -2111,19 +2111,19 @@ + have : 0 < log x := by apply log_pos; linarith + grind [abs_of_pos this] + +-@[blueprint +- "Mertens-second-error-prime-abs-le"] ++ ++ + theorem E₂p.bound' : E₂p =o[atTop] (fun _ ↦ (1:ℝ)) := E₂p.bound.trans_isLittleO inv_log_eq_o_one + +-@[blueprint +- "Mertens-second-theorem-prime-weak" +- (title := "Mertens' second theorem (weak prime form)") +- (statement := /-- For any $x \geq 2$, one has +-$$ \sum_{p \leq x} \frac{1}{p} = \log \log x + O(1). $$ +--/) +- (proof := /-- Immediate from previous two corollaries. +- -/) +- (discussion := 1327)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem sum_prime_div_eq_log_log : ∃ C, ∀ x, 2 ≤ x → + |∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p - log (log x)| ≤ C := by + use |M| + (log 4 + 6 + E₁) / log 2 +@@ -2137,16 +2137,16 @@ + have : 0 < log 4 := by apply log_pos; norm_num + linarith [E₁.nonneg] + +-@[blueprint +- "Mertens-second-theorem-prime-weak"] ++ ++ + theorem sum_prime_div_eq_log_log' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p - log (log x)) =O[atTop] (fun _ ↦ (1:ℝ)) := by + simp only [isBigO_iff, norm_eq_abs, one_mem, CStarRing.norm_of_mem_unitary, mul_one, + eventually_atTop] + obtain ⟨ C, hC ⟩ := sum_prime_div_eq_log_log + use C, 2 + +-@[blueprint +- "Mertens-second-theorem-prime-weak"] ++ ++ + theorem sum_prime_div_eq_log_log'' : (fun x ↦ ∑ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1:ℝ) / p) ~[atTop] (fun x ↦ log (log x)) := by + apply IsLittleO.isEquivalent (IsBigO.trans_isLittleO _ one_eq_o_log_log) + convert! sum_prime_div_eq_log_log' using 1 +@@ -2244,33 +2244,33 @@ + ring_nf + · ring + +-@[blueprint +- "Meissel-Mertens-eq" +- (title := "Formula for Meissel-Mertens constant") +- (statement := /-- One has $M = \gamma + \sum_p \log(1-\frac{1}{p}) + \frac{1}{p}$. +--/) +- (proof := /-- The RHS can be Taylor expanded as $\sum_{j=2}^\infty \sum_p \frac{1}{jp^j}$. Meanwhile, the difference between $\sum_{n \leq x} \frac{\Lambda(n)}{n \log n}$ and $\sum_{p \leq x} \frac{1}{p}$ is equal to $\sum_{j=2}^\infty \sum_{p: p^j \leq x} \frac{1}{j p^j}$. Applying the monotone convergence theorem, Lemma \ref{Mertens-second-error-prime-abs-le}, and Lemma \ref{Mertens-second-error-mangoldt-bound} gives the claim. -/) +- (discussion := 1328)] ++ ++ ++ ++ ++ ++ ++ + theorem M.eq : M = γ + ∑' p : ℕ, if p.Prime then log (1 - 1 / p) + 1 / p else 0 := by + rw [← tsum_M_eq_f_eq_tsum, M_eq_f.HasSum.tsum_eq] + ring + +-@[blueprint +- "Mertens-third-error" +- (title := "The remainder term in Mertens third theorem ") +- (statement := /-- We define $E_3(x) := \sum_{p \leq x} \log (1 - \frac{1}{p}) + \log\log x + \gamma$. +--/)] ++ ++ ++ ++ ++ + noncomputable def E₃ (x : ℝ) : ℝ := ∑ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, log (1 - (1:ℝ) / p) + log (log x) + eulerMascheroniConstant + +-@[blueprint +- "Mertens-third-theorem-error" +- (title := "Mertens' third theorem error term") +- (statement := /-- For any $x \geq 2$, one has +-$$ \prod_{p \leq x} \left(1 - \frac{1}{p}\right) = \frac{e^{-\gamma}}{\log x} \exp(E_3(x)). $$ +--/) +- (proof := /-- Immediate from definition +- -/) +- (discussion := 1329)] ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem prod_one_minus_div_prime_eq {x : ℝ} (hx : 1 < x) : + ∏ p ∈ Ioc 0 ⌊x⌋₊ with p.Prime, (1 - (1 : ℝ) / p) = + exp (-eulerMascheroniConstant) * exp (E₃ x) / log x := by +@@ -2365,17 +2365,17 @@ + gcongr + exact Nat.lt_floor_add_one _|>.le + +-@[blueprint +- "Mertens-third-theorem-error-le" +- (title := "Mertens' third theorem error bound") +- (statement := /-- For any $x \geq 2$, one has +-$$ E_3(x) = O\left(\frac{1}{\log x}\right) $$ +--/) +- (proof := /--Estimating the error in \ref{Meissel-Mertens-eq} using the first order Taylor expansion of log one gets +-$$\sum_{p \le x}(\log (1-1/p)+1/p) = (M - \gamma) + O(1/x).$$ +-The result follows by combining with \ref{Mertens-second-error-prime-abs-le}. +- -/) +- (discussion := 1330)] ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + theorem E₃.abs_le : ∃ C, ∀ x, 2 ≤ x → |E₃ x| ≤ C / log x := by + unfold E₃ + refine ⟨4 + (log 4 + 6 + E₁), fun x hx ↦ ?_⟩ +@@ -2399,8 +2399,8 @@ + grw [this] + rw [← add_div] + +-@[blueprint +- "Mertens-third-theorem-error-le"] ++ ++ + theorem E₃.bound : E₃ =O[atTop] (fun x ↦ 1 / log x) := by + simp only [isBigO_iff, norm_eq_abs, eventually_atTop] + obtain ⟨ C, hC ⟩ := E₃.abs_le +@@ -2410,12 +2410,12 @@ + have : 0 < 1 / log x := by positivity + grind [abs_of_pos this] + +-@[blueprint +- "Mertens-third-theorem-error-le"] ++ ++ + theorem E₃.bound' : E₃ =o[atTop] (fun _ ↦ (1:ℝ)) := E₃.bound.trans_isLittleO inv_log_eq_o_one + +-@[blueprint +- "Mertens-third-theorem-error-le"] ++ ++ + theorem E₃.bound'' : (fun x ↦ ∏ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1 - (1:ℝ) / p)) ~[atTop] (fun x ↦ exp (-eulerMascheroniConstant) / log x) := by + rw [isEquivalent_iff_tendsto_one] + · convert Tendsto.congr' ?_ (Tendsto.rexp ((isLittleO_one_iff ℝ).mp E₃.bound')) using 2 with x +@@ -2427,8 +2427,8 @@ + simp only [ne_eq, div_eq_zero_iff, exp_ne_zero, log_eq_zero, eventually_atTop]; use 2 + grind + +-@[blueprint +- "Mertens-third-theorem-error-le"] ++ ++ + theorem E₃.bound''' : (fun x ↦ ∏ p ∈ Ioc 0 ⌊ x ⌋₊ with p.Prime, (1 - (1:ℝ) / p) - exp (-eulerMascheroniConstant) / log x) =O[atTop] (fun x ↦ 1 / (log x)^2) := by + obtain ⟨c, hc⟩ := E₃.abs_le + rw [isBigO_iff] +diff --git a/PrimeNumberTheoremAnd/PerronFormula.lean b/PrimeNumberTheoremAnd/PerronFormula.lean +--- a/PrimeNumberTheoremAnd/PerronFormula.lean ++++ b/PrimeNumberTheoremAnd/PerronFormula.lean +@@ -6,5 +6,3 @@ + import PrimeNumberTheoremAnd.Wiener +- +-set_option lang.lemmaCmd true +- ++ + open Asymptotics Complex ComplexConjugate Topology Filter Real MeasureTheory Set diff --git a/lean/patches/README.md b/lean/patches/README.md index 128aee6b60aa056755c2e29d5c8aa8b6fc502ff0..7e5d730ab22d51c12aaf8a94ff143ebd63d903cb 100644 --- a/lean/patches/README.md +++ b/lean/patches/README.md @@ -1,6 +1,6 @@ -# Dependency patches - -Compatibility patches for third-party Lean dependencies. -We thank the authors of these packages for their work. - -Run `lake update` from `lean/` to fetch dependencies and apply the patches. +# Dependency patches + +Compatibility patches for third-party Lean dependencies. +We thank the authors of these packages for their work. + +Run `lake update` from `lean/` to fetch dependencies and apply the patches. diff --git a/lean/patches/SphereEversion-lean4341.patch b/lean/patches/SphereEversion-lean4341.patch index d8e4a5d38848378c32d2fece23786e62ba51fe06..33c9eea01e40afede1d4ad4a16d9c6a9a48f8d26 100644 --- a/lean/patches/SphereEversion-lean4341.patch +++ b/lean/patches/SphereEversion-lean4341.patch @@ -1,21 +1,21 @@ -diff --git a/lakefile.toml b/lakefile.toml -index 0247e04..211f3d8 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -11,7 +11,7 @@ - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.34.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[require]] - name = "checkdecls" -diff --git a/lean-toolchain b/lean-toolchain -index 12359f9..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.34.0 -+leanprover/lean4:v4.34.1 +diff --git a/lakefile.toml b/lakefile.toml +index 0247e04..211f3d8 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -11,7 +11,7 @@ + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.34.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[require]] + name = "checkdecls" +diff --git a/lean-toolchain b/lean-toolchain +index 12359f9..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.34.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/StrongPNT-lean4341.patch b/lean/patches/StrongPNT-lean4341.patch index e6264e1cc566bf17c29ab25c8d23777ba8955bd7..0269959e81418ffd738958089922f4eca4fec787 100644 --- a/lean/patches/StrongPNT-lean4341.patch +++ b/lean/patches/StrongPNT-lean4341.patch @@ -1,26284 +1,26284 @@ -diff --git a/StrongPNT/Erdos970.lean b/StrongPNT/Erdos970.lean -new file mode 100644 -index 0000000..2427743 ---- /dev/null -+++ b/StrongPNT/Erdos970.lean -@@ -0,0 +1 @@ -+import StrongPNT.Erdos970.PNT5_Strong -diff --git a/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean b/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean -new file mode 100644 -index 0000000..c54399a ---- /dev/null -+++ b/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean -@@ -0,0 +1,5460 @@ -+import Mathlib -+ -+namespace Erdos970 -+ -+ -+lemma lem_2logOlog : (fun t : ℝ => 2 * Real.log t) =O[Filter.atTop] (fun t : ℝ => Real.log t) := Asymptotics.isBigO_const_mul_self 2 Real.log Filter.atTop -+ -+lemma lem_logt22logt (t : ℝ) (_ht : t ≥ 2) : Real.log (t ^ 2) = 2 * Real.log t := by -+ exact Real.log_pow t 2 -+ -+lemma lem_log2tlogt2 (t : ℝ) (ht : t ≥ 2) : Real.log (2 * t) ≤ Real.log (t ^ 2) := by -+ apply Real.log_le_log -+ · -+ linarith -+ · -+ -+ have h1 : t * (t - 2) ≥ 0 := by -+ apply mul_nonneg -+ · linarith -+ · linarith -+ -+ linarith [h1] -+ -+lemma lem_log22log (t : ℝ) (ht : t ≥ 2) : Real.log (2 * t) ≤ 2 * Real.log t := by -+ rw [← lem_logt22logt t ht] -+ exact lem_log2tlogt2 t ht -+ -+lemma lem_exprule (n : ℕ) (hn : n ≥ 1) (α β : ℂ) : (n : ℂ) ^ (α + β) = (n : ℂ) ^ α * (n : ℂ) ^ β := by -+ apply Complex.cpow_add -+ -+ rw [Nat.cast_ne_zero] -+ -+ rw [← Nat.one_le_iff_ne_zero] -+ exact hn -+ -+lemma lem_realbw (b : ℝ) (w : ℂ) : (b * w).re = b * w.re := by -+ exact Complex.re_ofReal_mul b w -+ -+lemma lem_sumReal {f : ℕ+ → ℂ} (hf : Summable f) : (∑' n : ℕ+, f n).re = ∑' n : ℕ+, (f n).re := by -+ exact Complex.re_tsum hf -+ -+lemma lem_Euler (a : ℝ) : Complex.exp (a * Complex.I) = Real.cos a + Real.sin a * Complex.I := by -+ rw [Complex.exp_mul_I] -+ rw [← Complex.ofReal_cos, ← Complex.ofReal_sin] -+ -+lemma lem_Reecos (a : ℝ) : (Complex.exp (a * Complex.I)).re = Real.cos a := by -+ rw [lem_Euler] -+ rw [Complex.add_re] -+ rw [Complex.ofReal_re] -+ rw [Complex.re_ofReal_mul] -+ rw [Complex.I_re] -+ simp -+ -+lemma lem_explog (n : ℕ) (hn : n ≥ 1) : (n : ℝ) = Real.exp (Real.log (n : ℝ)) := by -+ rw [Real.exp_log] -+ -+ rw [Nat.cast_pos] -+ -+ have h1 : n ≠ 0 := by -+ rw [← Nat.one_le_iff_ne_zero] -+ exact hn -+ rw [Nat.pos_iff_ne_zero] -+ exact h1 -+ -+lemma lem_coseven (a : ℝ) : Real.cos (-a) = Real.cos a := by -+ exact Real.cos_neg a -+ -+lemma lem_coseveny (n : ℕ) (_hn : n ≥ 1) (y : ℝ) : Real.cos (-y * Real.log (n : ℝ)) = Real.cos (y * Real.log (n : ℝ)) := by -+ rw [neg_mul] -+ exact lem_coseven (y * Real.log (n : ℝ)) -+ -+lemma lem_niyelog (n : ℕ) (hn : n ≥ 1) (y : ℝ) : (n : ℂ) ^ (-y * Complex.I) = Complex.exp (-y * Complex.I * Real.log (n : ℝ)) := by -+ -+ have h1 : (n : ℂ) ≠ 0 := by -+ rw [Nat.cast_ne_zero] -+ rw [← Nat.one_le_iff_ne_zero] -+ exact hn -+ -+ rw [Complex.cpow_def_of_ne_zero h1] -+ -+ rw [← Complex.natCast_log] -+ -+ ring_nf -+ -+lemma lem_eacosalog (n : ℕ) (_hn : n ≥ 1) (y : ℝ) : (Complex.exp (-y * Complex.I * Real.log (n : ℝ))).re = Real.cos (-y * Real.log (n : ℝ)) := by -+ -+ let a := -y * Real.log (n : ℝ) -+ -+ have h : -y * Complex.I * Real.log (n : ℝ) = a * Complex.I := by -+ simp [a, mul_assoc, mul_comm Complex.I] -+ rw [h] -+ -+ exact lem_Reecos a -+ -+lemma lem_eacosalog2 (n : ℕ) (hn : n ≥ 1) (y : ℝ) : ((n : ℂ) ^ (-y * Complex.I)).re = Real.cos (-y * Real.log (n : ℝ)) := by -+ rw [lem_niyelog n hn y] -+ exact lem_eacosalog n hn y -+ -+lemma lem_eacosalog3 (n : ℕ) (hn : n ≥ 1) (y : ℝ) : ((n : ℂ) ^ (-y * Complex.I)).re = Real.cos (y * Real.log (n : ℝ)) := by -+ rw [lem_eacosalog2 n hn y] -+ exact lem_coseveny n hn y -+ -+lemma lem_cos2t (θ : ℝ) : Real.cos (2 * θ) = 2 * Real.cos θ ^ 2 - 1 := by -+ exact Real.cos_two_mul θ -+ -+lemma lem_cos2t2 (θ : ℝ) : 2 * Real.cos θ ^ 2 = 1 + Real.cos (2 * θ) := by -+ rw [lem_cos2t] -+ ring -+ -+lemma lem_cosSquare (θ : ℝ) : 2 * (1 + Real.cos θ)^2 = 2 + 4 * Real.cos θ + 2 * Real.cos θ^2 := by -+ ring -+ -+lemma lem_cos2cos341 (θ : ℝ) : 2 * (1 + Real.cos θ) ^ 2 = 3 + 4 * Real.cos θ + Real.cos (2 * θ) := by -+ rw [lem_cosSquare] -+ rw [lem_cos2t2] -+ ring -+ -+lemma lem_SquarePos (y : ℝ) : 0 ≤ y ^ 2 := by -+ exact sq_nonneg y -+ -+lemma lem_SquarePos2 (y : ℝ) : 0 ≤ 2 * y ^ 2 := by -+ apply mul_nonneg -+ · norm_num -+ · exact lem_SquarePos y -+ -+lemma lem_SquarePoscos (θ : ℝ) : 0 ≤ 2 * (1 + Real.cos θ) ^ 2 := by -+ exact lem_SquarePos2 (1 + Real.cos θ) -+ -+lemma lem_postrig (θ : ℝ) : 0 ≤ 3 + 4 * Real.cos θ + Real.cos (2 * θ) := by -+ rw [← lem_cos2cos341] -+ exact lem_SquarePoscos θ -+ -+lemma lem_postriglogn (n : ℕ) (_hn : n ≥ 1) (t : ℝ) : 0 ≤ 3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ)) := by -+ rw [mul_assoc] -+ exact lem_postrig (t * Real.log (n : ℝ)) -+ -+lemma lem_seriesPos {r_n : ℕ+ → ℝ} {r : ℝ} (h_hasSum : HasSum r_n r) (h_nonneg : ∀ n : ℕ+, r_n n ≥ 0) : r ≥ 0 := by -+ -+ have h_eq : ∑' n, r_n n = r := HasSum.tsum_eq h_hasSum -+ -+ have h_tsum_nonneg : ∑' n, r_n n ≥ 0 := tsum_nonneg h_nonneg -+ -+ rw [← h_eq] -+ exact h_tsum_nonneg -+ -+lemma real_part_of_diff (M : ℝ) (w : ℂ) : (2 * M - w).re = 2 * M - w.re := by -+ simp [Complex.sub_re] -+ -+lemma real_part_of_diffz (M : ℝ) (f_z : ℂ) : (2 * M - f_z).re = 2 * M - f_z.re := real_part_of_diff M f_z -+ -+lemma inequality_reversal (x M : ℝ) (hxM : x ≤ M) : 2 * M - x ≥ M := by linarith -+ -+lemma real_part_lower_bound (w : ℂ) (M : ℝ) (_hM : M > 0) (h : w.re ≤ M) : 2 * M - w.re ≥ M := by apply inequality_reversal w.re M h -+ -+lemma real_part_lower_bound2 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w).re ≥ M := by rw [real_part_of_diffz]; exact real_part_lower_bound w M hM h -+ -+lemma real_part_lower_bound3 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w).re > 0 := by -+ rw [real_part_of_diffz] -+ apply lt_of_le_of_lt' -+ apply real_part_lower_bound -+ exact hM -+ exact h -+ exact hM -+ -+lemma nonzero_if_real_part_positive (w : ℂ) (hw_re_pos : w.re > 0) : w ≠ 0 := by -+ by_contra h -+ rw [h] at hw_re_pos -+ exact lt_irrefl 0 hw_re_pos -+ -+lemma lem_real_part_lower_bound4 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w) ≠ 0 := by -+ apply nonzero_if_real_part_positive -+ exact real_part_lower_bound3 w M hM h -+ -+lemma lem_abspos (z : ℂ) : z ≠ 0 → norm z > 0 := by -+ intro h_ne_zero -+ apply Real.sqrt_pos.mpr -+ exact Complex.normSq_pos.mpr h_ne_zero -+ -+lemma lem_real_part_lower_bound5 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : norm (2 * M - w) > 0 := by -+ apply lem_abspos -+ exact lem_real_part_lower_bound4 w M hM h -+ -+lemma lem_wReIm (w : ℂ) : w = w.re + Complex.I * w.im := by -+ apply Complex.ext -+ simp -+ simp -+ -+lemma lem_modaib (a b : ℝ) : norm (a + Complex.I * b) ^ 2 = a ^ 2 + b ^ 2 := by rw [Complex.sq_norm, Complex.normSq_apply]; simp; ring -+ -+lemma lem_modcaib (a b c : ℝ) : norm (c - a - Complex.I * b) ^ 2 = (c - a) ^ 2 + b ^ 2 := by -+ rw [Complex.sq_norm, Complex.normSq_apply] -+ simp -+ ring -+ -+lemma lem_diffmods (a b c : ℝ) : -+norm (c - a - Complex.I * b) ^ 2 - norm (a + Complex.I * b) ^ 2 = (c - a) ^ 2 - a ^ 2 := by -+ rw [lem_modcaib, lem_modaib] -+ ring -+ -+lemma lem_casq (a c : ℝ) : (c - a) ^ 2 = a ^ 2 - 2 * a * c + c ^ 2 := by linarith -+ -+lemma lem_casq2 (a c : ℝ) : (c - a) ^ 2 - a ^ 2 = c * (c - 2 * a) := by -+ ring -+ -+lemma lem_diffmods2 (a b c : ℝ) : norm (c - a - Complex.I * b) ^ 2 - norm (a + Complex.I * b) ^ 2 = c * (c - 2 * a) := by -+ rw [lem_diffmods] -+ rw [lem_casq2] -+ -+lemma lem_modulus_sq_ReImw (M : ℝ) (w : ℂ) : norm (2 * M - w) ^ 2 - norm w ^ 2 = 4 * M * (M - w.re) := by -+ simp_rw [Complex.sq_norm] -+ simp_rw [Complex.normSq_apply] -+ simp [Complex.sub_re, Complex.sub_im, Complex.ofReal_re, Complex.ofReal_im] -+ ring -+ -+lemma lem_modulus_sq_identity (M : ℝ) (w : ℂ) : norm (2 * M - w) ^ 2 - norm w ^ 2 = 4 * M * (M - w.re) := lem_modulus_sq_ReImw M w -+ -+lemma lem_nonnegative_product (M x : ℝ) (hM : M > 0) (hxM : x ≤ M) : 4 * M * (M - x) ≥ 0 := by -+ have h_four_M_nonneg : 4 * M ≥ 0 := by linarith [hM] -+ have h_diff_nonneg : M - x ≥ 0 := by linarith [hxM] -+ apply mul_nonneg h_four_M_nonneg h_diff_nonneg -+ -+lemma lem_nonnegative_product2 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : 4 * M * (M - w.re) ≥ 0 := by -+ apply lem_nonnegative_product -+ exact hM -+ exact hw_re_le_M -+ -+lemma lem_nonnegative_product3 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ^ 2 - norm w ^ 2 ≥ 0 := by -+ rw [lem_modulus_sq_identity] -+ apply lem_nonnegative_product2 -+ exact hM -+ exact hw_re_le_M -+ -+lemma lem_nonnegative_product4 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ^ 2 ≥ norm w ^ 2 := by -+ have h := lem_nonnegative_product3 M w hM hw_re_le_M -+ linarith -+ -+lemma lem_nonnegative_product5 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ≥ norm w := by -+ have h_sq_ge : ‖2 * M - w‖ ^ 2 ≥ ‖w‖ ^ 2 := by -+ apply lem_nonnegative_product4 M w hM hw_re_le_M -+ rw [ge_iff_le] at h_sq_ge -+ -+ apply (sq_le_sq₀ (norm_nonneg w) (norm_nonneg (2 * M - w))).mp -+ exact h_sq_ge -+ -+lemma lem_nonnegative_product6 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm w ≤ norm (2 * M - w) := by apply lem_nonnegative_product5 M w hM hw_re_le_M -+ -+lemma lem_ineqmultr (a b c : ℝ) (hc : c > 0) (_ha : 0 ≤ a) (hab : a ≤ b) : a / c ≤ b / c := by -+ apply div_le_div_of_nonneg_right -+ exact hab -+ linarith [hc] -+ -+lemma lem_ineqmultrbb (a b : ℝ) (hb : b > 0) (ha : 0 ≤ a) (hab : a ≤ b) : a / b ≤ 1 := by -+ have h := lem_ineqmultr a b b hb ha hab -+ rw [div_self (ne_of_gt hb)] at h -+ exact h -+ -+lemma lem_nonnegative_product7 (M : ℝ) (w : ℂ) (_hM : M > 0) (h_abs_diff_pos : norm (2 * M - w) > 0) (h_abs_le_abs_diff : norm w ≤ norm (2 * M - w)) : norm w / norm (2 * M - w) ≤ 1 := by -+ -+ have h_abs_w_nonneg : 0 ≤ ‖w‖ := norm_nonneg w -+ -+ apply lem_ineqmultrbb -+ exact h_abs_diff_pos -+ exact h_abs_w_nonneg -+ exact h_abs_le_abs_diff -+ -+lemma lem_nonnegative_product8 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) (h_abs_le_abs_diff : norm w ≤ -+norm (2 * M - w)) : norm w / norm (2 * M - w) ≤ 1 := by -+ apply lem_nonnegative_product7 M w -+ exact hM -+ apply lem_real_part_lower_bound5 w M hM hw_re_le_M -+ exact h_abs_le_abs_diff -+ -+lemma lem_nonnegative_product9 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm w / norm (2 * M - w) ≤ 1 := by -+ apply lem_nonnegative_product8 -+ exact hM -+ exact hw_re_le_M -+ apply lem_nonnegative_product6 -+ exact hM -+ exact hw_re_le_M -+ -+lemma lem_triangle_ineq (N G : ℂ) : norm (N + G) ≤ norm N + norm G := by -+ exact norm_add_le N G -+ -+lemma lem_triangleineqminus (N F : ℂ) : norm (N - F) ≤ norm N + norm F := by -+ rw [sub_eq_add_neg] -+ calc -+ ‖N + (-F)‖ ≤ ‖N‖ + ‖-F‖ := by apply lem_triangle_ineq -+ _ = ‖N‖ + ‖F‖ := by rw [norm_neg] -+ -+lemma lem_rtriangle (r : ℝ) (N F : ℂ) (hr : r > 0) : r * norm (N - F) ≤ r * (norm N + norm F) := by -+ apply mul_le_mul_of_nonneg_left -+ apply lem_triangleineqminus -+ linarith -+ -+lemma rtriangle2 (r : ℝ) (N F : ℂ) (hr : r > 0) : r * norm (N - F) ≤ r * norm N + r * norm F := by -+ have h := lem_rtriangle r N F hr -+ linarith [h] -+ -+lemma lem_rtriangle3 (r R : ℝ) (N F : ℂ) (hr : r > 0) (_hR : r < R) (h : R * norm F ≤ r * norm (N - F)) : R * norm F ≤ r * norm N + r * norm F := by -+ calc -+ R * norm F ≤ r * norm (N - F) := by exact h -+ _ ≤ r * norm N + r * norm F := by apply rtriangle2 r N F hr -+ -+lemma lem_rtriangle4 (r R : ℝ) (N F : ℂ) (hr : 0 < r) (hR : r < R) (h_hyp : R * norm F ≤ r * norm (N - F)) : (R - r) * norm F ≤ r * norm N := by -+ have h_result_from_lem3 : R * norm F ≤ r * norm N + r * norm F := by -+ apply lem_rtriangle3 r R N F hr hR h_hyp -+ linarith [h_result_from_lem3] -+ -+lemma lem_absposeq (a : ℝ) (ha : a > 0) : |a| = a := by -+ apply Real.norm_of_nonneg -+ linarith [ha] -+ -+lemma lem_a2a (a : ℝ) (ha : a > 0) : 2 * a > 0 := by linarith -+ -+lemma lem_absposeq2 (a : ℝ) (ha : a > 0) : |2 * a| = 2 * a := by -+ apply lem_absposeq -+ apply lem_a2a -+ exact ha -+ -+lemma lem_rtriangle5 (r R M : ℝ) (F : ℂ) (hr : 0 < r) (hrR : r < R) (hM : M > 0) -+ (h_hyp : R * norm F ≤ r * norm (2 * M - F)) : -+(R - r) * norm F ≤ 2 * M * r := by -+ -+ have h1 : (R - r) * norm F ≤ r * norm (2 * M : ℂ) := -+ lem_rtriangle4 r R (2 * M : ℂ) F hr hrR h_hyp -+ -+ have h2 : norm (2 * M : ℂ) = 2 * M := by -+ -+ have h_pos : (2 * M : ℝ) > 0 := by linarith [hM] -+ -+ convert Complex.norm_of_nonneg (le_of_lt h_pos) using 1 -+ -+ norm_cast -+ -+ rw [h2] at h1 -+ -+ rw [mul_comm r (2 * M)] at h1 -+ exact h1 -+ -+lemma lem_RrFpos (r R : ℝ) (F : ℂ) (_hr : 0 < r) (hrR : r < R) : (R - r) * norm F ≥ 0 := by -+ have h_R_minus_r_nonneg : R - r ≥ 0 := by linarith [hrR] -+ have h_abs_F_nonneg : 0 ≤ norm F := by apply norm_nonneg -+ apply mul_nonneg h_R_minus_r_nonneg h_abs_F_nonneg -+ -+lemma lem_rtriangle6 (r R M : ℝ) (F : ℂ) (hr : 0 < r) (hrR : r < R) (_hM : M > 0) -+ (h_hyp : (R - r) * norm F ≤ 2 * M * r) : -+norm F ≤ (2 * M * r) / (R - r) := by -+ have h_R_minus_r_pos : R - r > 0 := by linarith [hrR] -+ have h_numerator_nonneg : 0 ≤ (R - r) * ‖F‖ := by apply lem_RrFpos r R F hr hrR -+ -+ have h_ineq_with_denominators : ( (R - r) * ‖F‖ ) / (R - r) ≤ (2 * M * r) / (R - r) := by -+ apply lem_ineqmultr -+ exact h_R_minus_r_pos -+ exact h_numerator_nonneg -+ exact h_hyp -+ -+ rw [mul_div_cancel_left₀ (‖F‖) (ne_of_gt h_R_minus_r_pos)] at h_ineq_with_denominators -+ -+ exact h_ineq_with_denominators -+ -+lemma lem_rtriangle7 (r R M : ℝ) (F : ℂ) -+ (hr : 0 < r) (hrR : r < R) (hM : M > 0) -+ (h_hyp : R * norm F ≤ r * norm (2 * M - F)) : -+norm F ≤ (2 * M * r) / (R - r) := by -+ have h_step1 := lem_rtriangle5 r R M F hr hrR hM h_hyp -+ apply lem_rtriangle6 r R M F hr hrR hM h_step1 -+ -+def ballDR (R : ℝ) : Set ℂ := Metric.ball (0 : ℂ) R -+ -+lemma analyticAt_to_analyticWithinAt {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} (hf : AnalyticAt ℂ f z) : AnalyticWithinAt ℂ f S z := by -+ exact hf.analyticWithinAt -+ -+theorem analyticWithinAt_to_analyticAt_aux {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} (_hS : S ∈ nhds z) -+ (p : FormalMultilinearSeries ℂ ℂ ℂ) (r : ENNReal) (_h_conv_on_inter : r ≤ p.radius) (_hr_pos : 0 < r) -+ (hasSumt : ∀ {y : ℂ}, z + y ∈ insert z S → y ∈ Metric.eball 0 r → HasSum (fun n => (p n) fun _x => y) (f (z + y))) -+ (ε : ℝ) (hε_pos : ε > 0) (h_ball_subset_S : Metric.ball z ε ⊆ S) : -+ let r' := min r (ENNReal.ofReal ε); -+ ∀ {y : ℂ}, y ∈ Metric.eball 0 r' → HasSum (fun n => (p n) fun _x => y) (f (z + y)) := by -+ intro r' y hy -+ apply hasSumt -+ · -+ -+ right -+ apply h_ball_subset_S -+ rw [Metric.mem_ball] -+ -+ simp -+ -+ have : y ∈ Metric.eball 0 (ENNReal.ofReal ε) := by -+ apply Metric.eball_subset_eball (min_le_right r (ENNReal.ofReal ε)) hy -+ -+ have ε_nn : ENNReal.ofReal ε = ↑(ε.toNNReal) := by -+ simp [ENNReal.ofReal] -+ rw [ε_nn] at this -+ rw [@Metric.eball_coe] at this -+ simpa [Metric.mem_ball, dist_self_add_right, Real.toNNReal_of_nonneg hε_pos.le] -+ -+ · -+ exact Metric.eball_subset_eball (min_le_left r (ENNReal.ofReal ε)) hy -+ -+theorem analyticWithinAt_to_analyticAt {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} -+ (hS : S ∈ nhds z) (h : AnalyticWithinAt ℂ f S z) : AnalyticAt ℂ f z := by -+ rcases h with ⟨p, hp⟩ -+ -+ use p -+ -+ rcases hp with ⟨r, h_conv_on_inter, hr_pos⟩ -+ -+ rcases Metric.mem_nhds_iff.mp hS with ⟨ε, hε_pos, h_ball_subset_S⟩ -+ -+ let r' := min r (ENNReal.ofReal ε) -+ use r' -+ -+ constructor -+ -+ · exact inf_le_of_left_le h_conv_on_inter -+ -+ · -+ exact lt_min hr_pos (ENNReal.ofReal_pos.mpr hε_pos) -+ rename_i hasSumt -+ exact analyticWithinAt_to_analyticAt_aux hS p r h_conv_on_inter hr_pos hasSumt ε hε_pos h_ball_subset_S -+ -+lemma lem_not0mono (R : ℝ) (_hR_pos : 0 < R) (_hR_lt_one : R < 1) : -+ {z : ℂ | norm z ≤ R ∧ z ≠ 0} ⊆ {z : ℂ | z ≠ 0} := by -+ intro z hz -+ exact hz.2 -+ -+lemma lem_analmono {T S : Set ℂ} {f : ℂ → ℂ} (hS : AnalyticOn ℂ f S) (hT : T ⊆ S) : -+ AnalyticOn ℂ f T := by -+ exact hS.mono hT -+ -+lemma lem_1zanalDR (R : ℝ) (_hR_pos : 0 < R) : -+ AnalyticOn ℂ (fun z ↦ z⁻¹) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by -+ -+ apply AnalyticOn.mono (analyticOn_inv) -+ -+ intro z hz -+ -+ exact hz.2 -+ -+lemma lem_analprod {T : Set ℂ} {f1 f2 : ℂ → ℂ} (hf1 : AnalyticOn ℂ f1 T) (hf2 : AnalyticOn ℂ f2 T) : -+ AnalyticOn ℂ (f1 * f2) T := by -+ exact hf1.mul hf2 -+ -+lemma lem_analprodST {T S : Set ℂ} {f1 f2 : ℂ → ℂ} (hTS : T ⊆ S) (hf1 : AnalyticOn ℂ f1 T) (hf2 : AnalyticOn ℂ f2 S) : -+ AnalyticOn ℂ (f1 * f2) T := by -+ exact hf1.mul (hf2.mono hTS) -+ -+lemma lem_analprodTDR (R : ℝ) (f1 f2 : ℂ → ℂ) : -+ (AnalyticOn ℂ f1 {z : ℂ | norm z ≤ R ∧ z ≠ 0}) → -+ (AnalyticOn ℂ f2 (Metric.closedBall 0 R)) → -+ AnalyticOn ℂ (f1 * f2) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by -+ intro hf1 hf2 -+ -+ let T := {z : ℂ | norm z ≤ R ∧ z ≠ 0} -+ -+ have hf2_on_T : AnalyticOn ℂ f2 T := by -+ -+ apply hf2.mono -+ intro z hz -+ -+ simp [Metric.closedBall, dist_zero_right] -+ -+ exact hz.1 -+ -+ exact hf1.mul hf2_on_T -+ -+lemma lem_fzzTanal {R : ℝ} (hR_pos : 0 < R) (f : ℂ → ℂ) -+ (hf : AnalyticOn ℂ f (Metric.closedBall 0 R)) : -+ AnalyticOn ℂ (fun z ↦ f z / z) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by -+ -+ rw [show (fun z ↦ f z / z) = (fun z ↦ f z) * (fun z ↦ z⁻¹) by ext; simp [div_eq_mul_inv]] -+ -+ let T := {z : ℂ | norm z ≤ R ∧ z ≠ 0} -+ -+ have hf_on_T : AnalyticOn ℂ f T := hf.mono (?_) -+ -+ have h_inv_on_T : AnalyticOn ℂ (fun z ↦ z⁻¹) T := lem_1zanalDR R hR_pos -+ -+ exact lem_analprod hf_on_T h_inv_on_T -+ intro z hz -+ have hT : T = {z | norm z ≤ R ∧ z ≠ 0} := rfl -+ rw [hT] at hz -+ simp only [Set.mem_ofPred_eq] at hz -+ simp only [Metric.mem_closedBall] -+ simp only [dist_zero_right] -+ exact hz.1 -+ -+lemma lem_AnalOntoWithin {V : Set ℂ} {h : ℂ → ℂ} (hh : AnalyticOn ℂ h V) (z : ℂ) (hz : z ∈ V) : -+ AnalyticWithinAt ℂ h V z := by -+ exact hh z hz -+ -+lemma lem_AnalWithintoOn {R : ℝ} (_hR : 0 < R) (h : ℂ → ℂ) : -+ (∀ z ∈ Metric.closedBall 0 R, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) → -+ AnalyticOn ℂ h (Metric.closedBall 0 R) := by -+ exact fun h => h -+ -+lemma lem_DR0T {R : ℝ} (hR : 0 < R) : -+ Metric.closedBall 0 R = {0} ∪ {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by -+ ext z -+ simp [Metric.closedBall, dist_zero_right] -+ by_cases hz : z = 0 -+ · simp [hz, hR.le] -+ · simp [hz] -+ -+lemma lem_analWWWithin {R : ℝ} (hR_pos : 0 < R) (h : ℂ → ℂ) : -+ (AnalyticWithinAt ℂ h (Metric.closedBall 0 R) 0) → -+ (∀ z ∈ {z : ℂ | norm z ≤ R ∧ z ≠ 0}, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) → -+ (∀ z ∈ Metric.closedBall 0 R, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) := by -+ intro h0 hT z hz -+ rw [lem_DR0T hR_pos] at hz -+ cases' hz with hz hz -+ · simp at hz -+ rw [hz] -+ exact h0 -+ · exact hT z hz -+ -+lemma lem_analWWithinAtOn (R : ℝ) (hR_pos : 0 < R) (h : ℂ → ℂ) -+ (h_at_0 : AnalyticWithinAt ℂ h (Metric.closedBall 0 R) 0) -+ (h_at_T : ∀ z ∈ {z : ℂ | norm z ≤ R ∧ z ≠ 0}, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) : -+ AnalyticOn ℂ h (Metric.closedBall 0 R) := by -+ exact lem_analWWWithin hR_pos h h_at_0 h_at_T -+ -+lemma lem_AnalAttoWithin {h : ℂ → ℂ} {s : Set ℂ} (hh : AnalyticAt ℂ h 0) : -+ AnalyticWithinAt ℂ h s 0 := by -+ exact hh.analyticWithinAt -+ -+lemma analyticWithinAt_punctured_to_closedBall {R : ℝ} (_hR : 0 < R) {h : ℂ → ℂ} {z : ℂ} (hz : z ∈ {w : ℂ | norm w ≤ R ∧ w ≠ 0}) (h_within : AnalyticWithinAt ℂ h {w : ℂ | norm w ≤ R ∧ w ≠ 0} z) : AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z := by -+ -+ apply AnalyticWithinAt.mono_of_mem_nhdsWithin h_within -+ -+ have hz_ne_zero : z ≠ 0 := hz.2 -+ -+ rw [mem_nhdsWithin_iff_exists_mem_nhds_inter] -+ -+ use Metric.ball z (‖z‖ / 2) -+ -+ constructor -+ · -+ exact Metric.ball_mem_nhds z (half_pos (norm_pos_iff.mpr hz_ne_zero)) -+ -+ · -+ intro w hw -+ constructor -+ · -+ have w_in_closedball : w ∈ Metric.closedBall 0 R := hw.2 -+ simp only [Metric.mem_closedBall, dist_zero_right] at w_in_closedball -+ -+ simp [w_in_closedball] -+ · -+ intro hw_eq_zero -+ have w_in_ball : w ∈ Metric.ball z (‖z‖ / 2) := hw.1 -+ rw [hw_eq_zero] at w_in_ball -+ simp only [Metric.mem_ball] at w_in_ball -+ -+ rw [dist_comm] at w_in_ball -+ simp at w_in_ball -+ have pos_norm : 0 < ‖z‖ := norm_pos_iff.mpr hz_ne_zero -+ linarith [pos_norm] -+ -+lemma lem_analAtOnOn {R : ℝ} (hR_pos : 0 < R) (h : ℂ → ℂ) : -+ AnalyticAt ℂ h 0 → -+ AnalyticOn ℂ h {z : ℂ | norm z ≤ R ∧ z ≠ 0} → -+ AnalyticOn ℂ h (Metric.closedBall 0 R) := by -+ intro h_at_0 h_on_punctured -+ -+ apply lem_analWWithinAtOn R hR_pos h -+ -+ · exact lem_AnalAttoWithin h_at_0 -+ -+ · intro z hz -+ -+ have h_within_punctured : AnalyticWithinAt ℂ h {w : ℂ | norm w ≤ R ∧ w ≠ 0} z := -+ lem_AnalOntoWithin h_on_punctured z hz -+ -+ exact analyticWithinAt_punctured_to_closedBall hR_pos hz h_within_punctured -+ -+lemma lem_orderne0 (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (hf0 : f 0 = 0) : -+ analyticOrderAt f 0 ≠ 0 := by exact (AnalyticAt.analyticOrderAt_ne_zero hf).mpr hf0 -+ -+lemma lem_ordernetop (f : ℂ → ℂ) (_hf : AnalyticAt ℂ f 0) (hf_ne_zero : ¬(∀ᶠ z in nhds 0, f z = 0)) : -+ analyticOrderAt f 0 ≠ ⊤ := by -+ intro h -+ rw [analyticOrderAt_eq_top] at h -+ exact hf_ne_zero h -+ -+lemma lem_ordernatcast (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (n : ℕ) (hn : analyticOrderAt f 0 = n) : -+ ∃ (g : ℂ → ℂ), AnalyticAt ℂ g 0 ∧ g 0 ≠ 0 ∧ ∀ᶠ (z : ℂ) in nhds 0, f z = z ^ n * g z := by -+ -+ rw [AnalyticAt.analyticOrderAt_eq_natCast] at hn -+ · convert hn -+ aesop -+ · exact hf -+ -+lemma lem_ordernatcast1 (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (n : ℕ) (hn : analyticOrderAt f 0 = n) (hn_ne_zero : n ≠ 0) : -+ ∃ (h : ℂ → ℂ), AnalyticAt ℂ h 0 ∧ ∀ᶠ z in nhds 0, f z = z * h z := by -+ -+ rcases lem_ordernatcast f hf n hn with ⟨g, hg_analytic, _, hf_eq_g⟩ -+ -+ use fun z ↦ z ^ (n - 1) * g z -+ constructor -+ · -+ exact (analyticAt_id.pow (n - 1)).mul hg_analytic -+ · -+ filter_upwards [hf_eq_g] with z h_eq -+ rw [h_eq] -+ ring_nf -+ rw [← pow_succ' z (n - 1), Nat.sub_add_cancel (Nat.pos_of_ne_zero hn_ne_zero)] -+ -+lemma lem_ordernatcast2_old (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (hf0 : f 0 = 0) -+ (h_not_eventually_zero : ¬ (∀ᶠ z in nhds 0, f z = 0)) : -+ ∃ (h : ℂ → ℂ), AnalyticAt ℂ h 0 ∧ ∀ᶠ z in nhds 0, f z = z * h z := by -+ -+ let n₀ := analyticOrderAt f 0 -+ -+ have hn_ne_top : n₀ ≠ ⊤ := lem_ordernetop f hf h_not_eventually_zero -+ -+ lift n₀ to ℕ using hn_ne_top with n hn_eq -+ -+ have hn_ne_zero : n ≠ 0 := by -+ intro hn_zero -+ rw [hn_zero] at hn_eq -+ -+ have t := (lem_orderne0 f hf hf0) -+ have : n₀ = analyticOrderAt f 0 := rfl -+ rw [←this] at t -+ exact t (id (Eq.symm hn_eq)) -+ -+ exact lem_ordernatcast1 f hf n (by aesop) hn_ne_zero -+ -+lemma lem_ordernatcast2 {R : ℝ} (hR_pos : 0 < R) (f : ℂ → ℂ) (hf0 : f 0 = 0) -+ (hf : AnalyticOn ℂ f (Metric.closedBall 0 R)) : -+ AnalyticAt ℂ (fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z) 0 := by -+ -+ have hS : Metric.closedBall 0 R ∈ nhds (0 : ℂ) := by -+ -+ refine Filter.mem_of_superset (Metric.ball_mem_nhds (0 : ℂ) hR_pos) ?subset -+ exact Metric.ball_subset_closedBall -+ have hf_within : AnalyticWithinAt ℂ f (Metric.closedBall 0 R) 0 := hf 0 (by -+ simp [Metric.mem_closedBall, hR_pos.le]) -+ have hf_at0 : AnalyticAt ℂ f 0 := analyticWithinAt_to_analyticAt hS hf_within -+ -+ let g : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z -+ -+ by_cases hEZ : (∀ᶠ z in nhds (0 : ℂ), f z = 0) -+ · -+ -+ have hU : {z : ℂ | f z = 0} ∈ nhds (0 : ℂ) := by simpa only [Filter.Eventually] using hEZ -+ -+ have hf_eq_zero : f =ᶠ[nhds (0 : ℂ)] (fun _ : ℂ => 0) := by -+ refine (Filter.eventuallyEq_iff_exists_mem).2 ?_ -+ exact ⟨{z | f z = 0}, hU, by intro z hz; simpa [Set.mem_ofPred_eq] using hz⟩ -+ -+ have h_fderiv_zero : (fderiv ℂ f 0) = 0 := by -+ simpa using (Filter.EventuallyEq.fderiv_eq hf_eq_zero) -+ -+ have h_g_zero_on_U : ∀ z ∈ {z : ℂ | f z = 0}, g z = 0 := by -+ intro z hzU -+ by_cases hz0 : z = 0 -+ · -+ simp [g, hz0, h_fderiv_zero] -+ · -+ have : f z = 0 := by simpa [Set.mem_ofPred_eq] using hzU -+ simp [g, hz0, this] -+ -+ have h_const0_within : AnalyticWithinAt ℂ (fun _ : ℂ => (0 : ℂ)) {z : ℂ | f z = 0} 0 := -+ analyticAt_const.analyticWithinAt -+ have h_g_within : AnalyticWithinAt ℂ g {z : ℂ | f z = 0} 0 := by -+ -+ apply h_const0_within.congr -+ intro z hz -+ by_cases hz0 : z = 0 -+ · -+ simp [g, hz0, h_fderiv_zero] -+ · -+ have : f z = 0 := by simpa [Set.mem_ofPred_eq] using hz -+ simp [g, hz0, this] -+ -+ simp [g, h_fderiv_zero] -+ exact analyticWithinAt_to_analyticAt hU h_g_within -+ -+ · -+ have h_notEZ : ¬ (∀ᶠ z in nhds (0 : ℂ), f z = 0) := hEZ -+ -+ rcases lem_ordernatcast2_old f hf_at0 hf0 h_notEZ with ⟨h0, h0_at0, hfac_ev⟩ -+ -+ have hV : {z : ℂ | f z = z * h0 z} ∈ nhds (0 : ℂ) := by simpa only [Filter.Eventually] using hfac_ev -+ have h_eq_nhds : f =ᶠ[nhds (0 : ℂ)] (fun z => z * h0 z) := -+ (Filter.eventuallyEq_iff_exists_mem).2 ⟨{z : ℂ | f z = z * h0 z}, hV, by -+ intro z hz; simpa [Set.mem_ofPred_eq] using hz⟩ -+ -+ have h_fderiv_prod : fderiv ℂ f 0 = fderiv ℂ (fun z => z * h0 z) 0 := -+ Filter.EventuallyEq.fderiv_eq h_eq_nhds -+ -+ have h_diff_id : DifferentiableAt ℂ (fun z : ℂ => z) 0 := differentiableAt_id -+ have h_diff_h0 : DifferentiableAt ℂ h0 0 := h0_at0.differentiableAt -+ -+ have h_val0 : (fderiv ℂ f 0) 1 = h0 0 := by -+ -+ rw [h_fderiv_prod] -+ rw [fderiv_fun_mul' h_diff_id h_diff_h0] -+ simp only [add_apply, smul_apply] -+ rw [fderiv_fun_id] -+ simp only [ContinuousLinearMap.id_apply] -+ simp only [zero_smul, zero_add] -+ simp -+ -+ have h_geq_h0_on_V : ∀ z ∈ {z : ℂ | f z = z * h0 z}, g z = h0 z := by -+ intro z hzU -+ by_cases hz0 : z = 0 -+ · -+ simpa [g, hz0] using h_val0 -+ · -+ have : f z = z * h0 z := by simpa [Set.mem_ofPred_eq] using hzU -+ simp only [g, ite_eq_right hz0, this] -+ exact mul_div_cancel_left₀ (h0 z) hz0 -+ -+ have h0_within : AnalyticWithinAt ℂ h0 {z : ℂ | f z = z * h0 z} 0 := h0_at0.analyticWithinAt -+ have hg_within : AnalyticWithinAt ℂ g {z : ℂ | f z = z * h0 z} 0 := by -+ -+ apply AnalyticWithinAt.congr h0_within -+ -+ intro z hz -+ exact h_geq_h0_on_V z hz -+ -+ have h_0_in_V : (0 : ℂ) ∈ {z : ℂ | f z = z * h0 z} := by -+ simp [hf0] -+ exact h_geq_h0_on_V 0 h_0_in_V -+ exact analyticWithinAt_to_analyticAt hV hg_within -+ -+theorem ex (x : ℂ) {r : ℝ} (hr : r > 0) : -+ closure (Metric.ball x r) = Metric.closedBall x r := by -+ exact closure_ball x (by linarith [hr]) -+ -+lemma lem_ballDR (R : ℝ) (hR : R > 0) : closure (ballDR R) = Metric.closedBall (0 : ℂ) R := by -+ unfold ballDR -+ exact closure_ball 0 (ne_of_gt hR) -+ -+lemma lem_inDR (R : ℝ) (hR : R > 0) (w : ℂ) (hw : w ∈ closure (ballDR R)) : norm w ≤ R := by -+ rw [lem_ballDR R hR] at hw -+ rw [Metric.mem_closedBall] at hw -+ rw [Complex.dist_eq] at hw -+ simp at hw -+ exact hw -+ -+lemma lem_notinDR (R : ℝ) (_hR : R > 0) (w : ℂ) (hw : w ∉ ballDR R) : norm w ≥ R := by -+ -+ unfold ballDR at hw -+ -+ rw [Metric.mem_ball] at hw -+ -+ push Not at hw -+ -+ rw [Complex.dist_eq] at hw -+ -+ simp at hw -+ exact hw -+ -+lemma lem_legeR (R : ℝ) (_hR : R > 0) (w : ℂ) (hw1 : norm w ≤ R) (hw2 : norm w ≥ R) : norm w = R := by -+ linarith -+ -+lemma lem_circleDR (R : ℝ) (hR : R > 0) (w : ℂ) (hw1 : w ∈ closure (ballDR R)) (hw2 : w ∉ ballDR R) : norm w = R := by -+ have h1 : norm w ≤ R := lem_inDR R hR w hw1 -+ have h2 : norm w ≥ R := lem_notinDR R hR w hw2 -+ exact lem_legeR R hR w h1 h2 -+ -+lemma lem_Rself (R : ℝ) (hR : R > 0) : |R| = R := by -+ rw [abs_eq_self] -+ linarith -+ -+lemma lem_Rself2 (R : ℝ) (hR : R > 0) : |R| ≤ R := by -+ rw [lem_Rself R hR] -+ -+lemma lem_Rself3 (R : ℝ) (hR : R > 0) : (R : ℂ) ∈ closure (ballDR R) := by -+ rw [lem_ballDR R hR] -+ rw [Metric.mem_closedBall] -+ simp -+ exact lem_Rself2 R hR -+ -+lemma lem_DRcompact (R : ℝ) (hR : R > 0) : IsCompact (closure (ballDR R)) := by -+ rw [lem_ballDR R hR] -+ apply Metric.isCompact_of_isClosed_isBounded -+ · exact Metric.isClosed_closedBall -+ · exact Metric.isBounded_closedBall -+ -+lemma lem_ExtrValThm {K : Set ℂ} (hK : IsCompact K) (hK_nonempty : K.Nonempty) (g : K → ℂ) (hg : Continuous g) : -+∃ v : K, ∀ z : K, norm (g z) ≤ norm (g v) := by -+ -+ have : CompactSpace K := isCompact_iff_compactSpace.mp hK -+ -+ have : Nonempty K := hK_nonempty.to_subtype -+ -+ let f : K → ℝ := fun z => norm (g z) -+ -+ have hf_cont : Continuous f := continuous_norm.comp hg -+ -+ obtain ⟨v, hv_mem, hv_max⟩ := IsCompact.exists_isMaxOn isCompact_univ Set.univ_nonempty hf_cont.continuousOn -+ use v -+ intro z -+ exact hv_max (Set.mem_univ z) -+ -+lemma lem_ExtrValThmDR (R : ℝ) (hR : R > 0) (g : closure (ballDR R) → ℂ) (hg : Continuous g) : -+∃ v : closure (ballDR R), ∀ z : closure (ballDR R), norm (g z) ≤ norm (g v) := by -+ -+ have hK_compact : IsCompact (closure (ballDR R)) := lem_DRcompact R hR -+ -+ have hK_nonempty : (closure (ballDR R)).Nonempty := by -+ rw [lem_ballDR R hR] -+ rw [Metric.nonempty_closedBall] -+ linarith -+ -+ exact lem_ExtrValThm hK_compact hK_nonempty g hg -+ -+lemma lem_AnalCont {R : ℝ} (_hR : R > 0) (H : ℂ → ℂ) (h_analytic : AnalyticOn ℂ H (closure (ballDR R))) : -+Continuous (H ∘ (Subtype.val : closure (ballDR R) → ℂ)) := by -+ -+ have h_cont_on : ContinuousOn H (closure (ballDR R)) := AnalyticOn.continuousOn h_analytic -+ -+ have h_val_cont : Continuous (Subtype.val : closure (ballDR R) → ℂ) := continuous_subtype_val -+ -+ exact ContinuousOn.comp_continuous h_cont_on h_val_cont (fun _ => Subtype.mem _) -+ -+lemma lem_ExtrValThmh {R : ℝ} (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : -+∃ u : closure (ballDR R), ∀ z : closure (ballDR R), norm (h u) ≥ norm (h z) := by -+ -+ have hg_continuous : Continuous (h ∘ Subtype.val : closure (ballDR R) → ℂ) := -+ lem_AnalCont hR h h_analytic -+ -+ obtain ⟨v, hv⟩ := lem_ExtrValThmDR R hR (h ∘ Subtype.val) hg_continuous -+ -+ use v -+ -+ intro z -+ have : norm ((h ∘ Subtype.val) z) ≤ norm ((h ∘ Subtype.val) v) := hv z -+ -+ simp [Function.comp] at this -+ exact this -+ -+lemma lem_MaxModP (R : ℝ) (_hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : ∀ z ∈ closure (ballDR R), norm (h z) = norm (h w) := by -+ -+ have h_preconnected : IsPreconnected (ballDR R) := by -+ unfold ballDR -+ apply Convex.isPreconnected -+ exact convex_ball (0 : ℂ) R -+ -+ have h_open : IsOpen (ballDR R) := by -+ unfold ballDR -+ exact Metric.isOpen_ball -+ -+ have h_diff_cont : DiffContOnCl ℂ h (ballDR R) := by -+ constructor -+ · -+ apply AnalyticOn.differentiableOn -+ exact h_analytic.mono subset_closure -+ · -+ exact AnalyticOn.continuousOn h_analytic -+ -+ have h_max_on : IsMaxOn (norm ∘ h) (ballDR R) w := by -+ intro z hz -+ change ‖h z‖ ≤ ‖h w‖ -+ exact hw_max z hz -+ -+ have h_eq := Complex.norm_eqOn_closure_of_isPreconnected_of_isMaxOn h_preconnected h_open h_diff_cont hw_in_DR h_max_on -+ -+ intro z hz -+ have norm_eq := h_eq hz -+ simp only [Function.comp_apply, Function.const_apply] at norm_eq -+ -+ convert norm_eq -+ -+lemma lem_MaxModR (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : norm (h R) = norm (h w) := by -+ -+ have h_const : ∀ z ∈ closure (ballDR R), norm (h z) = norm (h w) := -+ lem_MaxModP R hR h h_analytic w hw_in_DR hw_max -+ -+ have hR_in_closure : (R : ℂ) ∈ closure (ballDR R) := lem_Rself3 R hR -+ -+ exact h_const (R : ℂ) hR_in_closure -+ -+lemma lem_MaxModRR (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) -+ (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : -+∀ z ∈ closure (ballDR R), norm (h R) ≥ norm (h z) := by -+ intro z hz -+ -+ have h1 := lem_MaxModP R hR h h_analytic w hw_in_DR hw_max z hz -+ -+ have h2 := lem_MaxModR R hR h h_analytic w hw_in_DR hw_max -+ -+ rw [h2, h1] -+ -+theorem lem_MaxModv2 (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : -+∃ v : closure (ballDR R), norm (v : ℂ) = R ∧ ∀ z : closure (ballDR R), norm (h (v : ℂ)) ≥ norm (h (z : ℂ)) := by -+ -+ obtain ⟨u, hu⟩ := lem_ExtrValThmh hR h h_analytic -+ -+ if h_case : (u : ℂ) ∈ ballDR R then -+ -+ have hR_in_closure : (R : ℂ) ∈ closure (ballDR R) := lem_Rself3 R hR -+ let v : closure (ballDR R) := ⟨R, hR_in_closure⟩ -+ use v -+ constructor -+ · -+ -+ have v_eq : (v : ℂ) = (R : ℂ) := rfl -+ rw [v_eq] -+ -+ have : norm (R : ℂ) = abs R := by -+ simp [Complex.norm_real] -+ rw [this, lem_Rself R hR] -+ · -+ intro z -+ -+ have hw_max : ∀ w ∈ ballDR R, norm (h w) ≤ norm (h (u : ℂ)) := by -+ intro w hw -+ -+ have hw_closure : w ∈ closure (ballDR R) := subset_closure hw -+ -+ let w_sub : closure (ballDR R) := ⟨w, hw_closure⟩ -+ exact hu w_sub -+ -+ have h_result := lem_MaxModRR R hR h h_analytic (u : ℂ) h_case hw_max -+ -+ have v_eq : (v : ℂ) = (R : ℂ) := rfl -+ rw [v_eq] -+ -+ exact h_result (z : ℂ) (Subtype.mem z) -+ else -+ -+ use u -+ constructor -+ · -+ exact lem_circleDR R hR (u : ℂ) (Subtype.mem u) h_case -+ · -+ exact hu -+ -+theorem lem_MaxModv3 (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : -+∃ v : ℂ, norm v = R ∧ ∀ z : ℂ, z ∈ closure (ballDR R) → norm (h v) ≥ norm (h z) := by -+ -+ obtain ⟨v_sub, hv_abs, hv_max⟩ := lem_MaxModv2 R hR h h_analytic -+ -+ let v := (v_sub : ℂ) -+ use v -+ constructor -+ · -+ exact hv_abs -+ · -+ intro z hz -+ -+ have hz_sub : z ∈ closure (ballDR R) := hz -+ let z_sub : closure (ballDR R) := ⟨z, hz_sub⟩ -+ have := hv_max z_sub -+ -+ simp at this -+ exact this -+ -+lemma lem_MaxModv4 (R B : ℝ) (hR : R > 0) (_hB : B ≥ 0) -+ (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) -+ (h_boundary_bound : ∀ z : ℂ, norm z = R → norm (h z) ≤ B) : -+∃ v : ℂ, norm v = R ∧ (∀ w : ℂ, w ∈ closure (ballDR R) → norm (h v) ≥ norm (h w)) ∧ norm (h v) ≤ B := by -+ -+ obtain ⟨v, hv_abs, hv_max⟩ := lem_MaxModv3 R hR h h_analytic -+ -+ use v -+ constructor -+ · -+ exact hv_abs -+ constructor -+ · -+ exact hv_max -+ · -+ apply h_boundary_bound -+ exact hv_abs -+ -+lemma lem_HardMMP (R B : ℝ) (hR : R > 0) (hB : B ≥ 0) -+ (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) -+ (h_boundary_bound : ∀ z : ℂ, norm z = R → norm (h z) ≤ B) : -+∀ w : ℂ, w ∈ closure (ballDR R) → norm (h w) ≤ B := by -+ intro w hw -+ -+ obtain ⟨v, hv_abs, hv_max, hv_bound⟩ := lem_MaxModv4 R B hR hB h h_analytic h_boundary_bound -+ -+ have h1 : norm (h w) ≤ norm (h v) := hv_max w hw -+ have h2 : norm (h v) ≤ B := hv_bound -+ -+ linarith [h1, h2] -+ -+lemma lem_EasyMMP (R B : ℝ) (hR : R > 0) (_hB : B ≥ 0) -+ (h : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ h (closure (ballDR R))) -+ (h_closure_bound : ∀ w : ℂ, w ∈ closure (ballDR R) → norm (h w) ≤ B) : -+∀ z : ℂ, norm z = R → norm (h z) ≤ B := by -+ intro z hz -+ -+ apply h_closure_bound z -+ -+ rw [lem_ballDR R hR] -+ rw [Metric.mem_closedBall] -+ rw [Complex.dist_eq] -+ simp -+ -+ have : ‖z‖ = R := hz -+ linarith -+ -+theorem lem_MMP (R B : ℝ) (hR : R > 0) (hB : B ≥ 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : -+(∀ z : ℂ, z ∈ closure (ballDR R) → norm (h z) ≤ B) ↔ (∀ z : ℂ, norm z = R → norm (h z) ≤ B) := by -+ constructor -+ · -+ intro h_closure_bound -+ exact lem_EasyMMP R B hR hB h h_analytic h_closure_bound -+ · -+ intro h_boundary_bound -+ exact lem_HardMMP R B hR hB h h_analytic h_boundary_bound -+ -+lemma lem_denominator_nonzero (R M : ℝ) (_hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : -+∀ z : ℂ, z ∈ closure (ballDR R) → (2 * M - f z) ≠ 0 := by -+ intro z hz -+ -+ apply lem_real_part_lower_bound4 (f z) M hM -+ -+ exact h_re_bound z hz -+ -+lemma lem_f_vs_2M_minus_f (R M : ℝ) (_hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : -+∀ z : ℂ, z ∈ closure (ballDR R) → norm (f z) / norm (2 * M - f z) ≤ 1 := by -+ intro z hz -+ -+ apply lem_nonnegative_product9 M (f z) hM -+ -+ exact h_re_bound z hz -+ -+lemma fderiv_factorization_at_zero (R : ℝ) (hR : R > 0) (f h : ℂ → ℂ) -+ (h_analytic_f : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_analytic_h : AnalyticOn ℂ h (closure (ballDR R))) -+ (_h_zero : f 0 = 0) -+ (h_factor : ∀ z ∈ closure (ballDR R), f z = z * h z) : -+ (fderiv ℂ f 0) 1 = h 0 := by -+ -+ have h_zero_in : (0 : ℂ) ∈ closure (ballDR R) := by -+ rw [lem_ballDR R hR] -+ rw [Metric.mem_closedBall] -+ simp -+ linarith [hR] -+ -+ have h_diff_on_f : DifferentiableOn ℂ f (closure (ballDR R)) := h_analytic_f.differentiableOn -+ have h_diff_on_h : DifferentiableOn ℂ h (closure (ballDR R)) := h_analytic_h.differentiableOn -+ -+ have h_nhds_mem : closure (ballDR R) ∈ nhds (0 : ℂ) := by -+ rw [lem_ballDR R hR] -+ rw [mem_nhds_iff] -+ use Metric.ball 0 R -+ constructor -+ · exact Metric.ball_subset_closedBall -+ constructor -+ · exact Metric.isOpen_ball -+ · rw [Metric.mem_ball] -+ simp -+ exact hR -+ -+ have h_diff_f : DifferentiableAt ℂ f 0 := h_diff_on_f.differentiableAt h_nhds_mem -+ have h_diff_h : DifferentiableAt ℂ h 0 := h_diff_on_h.differentiableAt h_nhds_mem -+ -+ have h_diff_id : DifferentiableAt ℂ (fun z : ℂ => z) 0 := differentiableAt_id -+ -+ have h_eq_nhds : f =ᶠ[nhds 0] (fun z => z * h z) := by -+ rw [Filter.eventuallyEq_iff_exists_mem] -+ exact ⟨closure (ballDR R), h_nhds_mem, h_factor⟩ -+ -+ have h_fderiv_eq : fderiv ℂ f 0 = fderiv ℂ (fun z => z * h z) 0 := -+ Filter.EventuallyEq.fderiv_eq h_eq_nhds -+ -+ rw [h_fderiv_eq] -+ rw [fderiv_fun_mul' h_diff_id h_diff_h] -+ -+ simp only [add_apply, smul_apply] -+ rw [fderiv_fun_id] -+ simp only [ContinuousLinearMap.id_apply] -+ -+ simp only [zero_smul, zero_add] -+ -+ simp -+ -+lemma lem_removable_singularity (R : ℝ) (hR : R > 0) (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) (h_zero : f 0 = 0) : -+AnalyticOn ℂ (fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z) (closure (ballDR R)) := by -+ -+ rw [lem_ballDR R hR] at h_analytic ⊢ -+ -+ let g : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z -+ -+ apply lem_analAtOnOn hR g -+ -+ · -+ -+ exact lem_ordernatcast2 hR f h_zero h_analytic -+ -+ · -+ -+ have f_on_closedball : AnalyticOn ℂ f (Metric.closedBall 0 R) := h_analytic -+ have quotient_analytic : AnalyticOn ℂ (fun z ↦ f z / z) {z : ℂ | ‖z‖ ≤ R ∧ z ≠ 0} := -+ lem_fzzTanal hR f f_on_closedball -+ -+ apply AnalyticOn.congr quotient_analytic -+ intro z hz -+ -+ simp [g, ite_eq_right hz.2] -+ -+lemma lem_quotient_analytic {R : ℝ} (_hR : R > 0) (h1 h2 : ℂ → ℂ) -+ (h_analytic1 : AnalyticOn ℂ h1 (closure (ballDR R))) -+ (h_analytic2 : AnalyticOn ℂ h2 (closure (ballDR R))) -+ (h_nonzero : ∀ z ∈ closure (ballDR R), h2 z ≠ 0) : -+AnalyticOn ℂ (fun z ↦ h1 z / h2 z) (closure (ballDR R)) := by -+ exact AnalyticOn.div h_analytic1 h_analytic2 h_nonzero -+ -+noncomputable def f_M (R M : ℝ) (_hR : R > 0) (_hM : M > 0) -+ (f : ℂ → ℂ) -+ (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (_h_zero : f 0 = 0) -+ (_h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : -+ℂ → ℂ := fun z ↦ (if z = 0 then (fderiv ℂ f 0) 1 else f z / z) / (2 * M - f z) -+ -+lemma lem_g_analytic (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : -+AnalyticOn ℂ (f_M R M hR hM f h_analytic h_zero h_re_bound) (closure (ballDR R)) := by -+ -+ let h₁ : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z -+ -+ let h₂ : ℂ → ℂ := fun z ↦ 2 * M - f z -+ -+ have h_eq : f_M R M hR hM f h_analytic h_zero h_re_bound = fun z ↦ h₁ z / h₂ z := by -+ ext z -+ unfold f_M h₁ h₂ -+ simp -+ -+ rw [h_eq] -+ -+ apply lem_quotient_analytic hR -+ -+ · exact lem_removable_singularity R hR f h_analytic h_zero -+ -+ · have h₂_analytic : AnalyticOn ℂ h₂ (closure (ballDR R)) := by -+ unfold h₂ -+ apply AnalyticOn.sub -+ · exact analyticOn_const -+ · exact h_analytic -+ exact h₂_analytic -+ -+ · intro z hz -+ unfold h₂ -+ exact lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz -+ -+lemma lem_absab (a b : ℂ) (_hb : b ≠ 0) : norm (a / b) = norm a / norm b := by -+ exact IsAbsoluteValue.abv_div norm a b -+ -+lemma lem_g_on_boundaryz (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (z : ℂ) (hz_in_closure : z ∈ closure (ballDR R)) (hz_nonzero : z ≠ 0) : -+ norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = -+norm (f z / z) / norm (2 * M - f z) := by -+ -+ unfold f_M -+ -+ simp only [ite_eq_right hz_nonzero] -+ -+ have h_nonzero : (2 * M - f z) ≠ 0 := lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz_in_closure -+ -+ exact lem_absab (f z / z) (2 * M - f z) h_nonzero -+ -+lemma lem_fzzR (R : ℝ) (hR : R > 0) (z w : ℂ) (hz : norm z = R) : norm (w / z) = norm w / R := by -+ -+ have hz_nonzero : z ≠ 0 := by -+ intro h_eq -+ rw [h_eq] at hz -+ simp at hz -+ linarith [hz, hR] -+ -+ rw [lem_absab w z hz_nonzero] -+ -+ rw [hz] -+ -+lemma lem_g_on_boundary (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (z : ℂ) (hz_on_boundary : norm z = R) : -+ norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = -+(norm (f z) / R) / norm (2 * M - f z) := by -+ -+ have hz_nonzero : z ≠ 0 := by -+ intro h_eq -+ rw [h_eq] at hz_on_boundary -+ simp at hz_on_boundary -+ linarith [hz_on_boundary, hR] -+ -+ have hz_in_closure : z ∈ closure (ballDR R) := by -+ rw [lem_ballDR R hR] -+ rw [Metric.mem_closedBall] -+ rw [Complex.dist_eq] -+ simp -+ convert le_of_eq hz_on_boundary -+ -+ have h1 : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = -+ norm (f z / z) / norm (2 * M - f z) := -+ lem_g_on_boundaryz R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure hz_nonzero -+ -+ have h2 : norm (f z / z) = norm (f z) / R := -+ lem_fzzR R hR z (f z) hz_on_boundary -+ -+ rw [h1, h2] -+ -+lemma lem_f_vs_2M_minus_fR (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (_h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (z : ℂ) (hz_in_closure : z ∈ closure (ballDR R)) : -+(norm (f z) / R) / norm (2 * M - f z) ≤ 1 / R := by -+ -+ have h1 : norm (f z) / norm (2 * M - f z) ≤ 1 := -+ lem_f_vs_2M_minus_f R M hR hM f h_analytic h_re_bound z hz_in_closure -+ -+ rw [div_div] -+ -+ rw [mul_comm R] -+ -+ rw [← div_div] -+ -+ exact div_le_div_of_nonneg_right h1 (le_of_lt hR) -+ -+lemma lem_g_boundary_bound0 (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (z : ℂ) (hz_on_boundary : norm z = R) : -+norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := by -+ -+ have hz_in_closure : z ∈ closure (ballDR R) := by -+ rw [lem_ballDR R hR] -+ rw [Metric.mem_closedBall] -+ rw [Complex.dist_eq] -+ simp -+ convert le_of_eq hz_on_boundary -+ -+ rw [lem_g_on_boundary R M hR hM f h_analytic h_zero h_re_bound z hz_on_boundary] -+ -+ exact lem_f_vs_2M_minus_fR R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure -+ -+lemma lem_g_interior_bound (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : -+∀ z : ℂ, z ∈ closure (ballDR R) → norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := by -+ -+ have hB : (1 / R : ℝ) ≥ 0 := div_nonneg zero_le_one (le_of_lt hR) -+ -+ have h_g_analytic : AnalyticOn ℂ (f_M R M hR hM f h_analytic h_zero h_re_bound) (closure (ballDR R)) := -+ lem_g_analytic R M hR hM f h_analytic h_zero h_re_bound -+ -+ apply (lem_MMP R (1 / R) hR hB (f_M R M hR hM f h_analytic h_zero h_re_bound) h_g_analytic).mpr -+ -+ intro z hz_boundary -+ exact lem_g_boundary_bound0 R M hR hM f h_analytic h_zero h_re_bound z hz_boundary -+ -+lemma lem_g_at_r (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) -+ (z : ℂ) (hz_on_boundary : norm z = r) : -+ norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = -+(norm (f z) / r) / norm (2 * M - f z) := by -+ -+ have hz_nonzero : z ≠ 0 := by -+ intro h_eq -+ rw [h_eq] at hz_on_boundary -+ simp at hz_on_boundary -+ linarith [hz_on_boundary, hr_pos] -+ -+ have hz_in_closure : z ∈ closure (ballDR R) := by -+ rw [lem_ballDR R hR] -+ rw [Metric.mem_closedBall] -+ rw [Complex.dist_eq] -+ simp -+ linarith [hz_on_boundary, hr_lt_R] -+ -+ have h1 : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = -+ norm (f z / z) / norm (2 * M - f z) := -+ lem_g_on_boundaryz R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure hz_nonzero -+ -+ have h2 : norm (f z / z) = norm (f z) / r := -+ lem_fzzR r hr_pos z (f z) hz_on_boundary -+ -+ rw [h1, h2] -+ -+lemma lem_g_at_rR (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) -+ (z : ℂ) (hz_on_boundary : norm z = r) : -+(norm (f z) / r) / norm (2 * M - f z) ≤ 1 / R := by -+ -+ have hz_in_closure : z ∈ closure (ballDR R) := by -+ rw [lem_ballDR R hR] -+ rw [Metric.mem_closedBall] -+ rw [Complex.dist_eq] -+ simp -+ linarith [hz_on_boundary, hr_lt_R] -+ -+ have h_bound : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := -+ lem_g_interior_bound R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure -+ -+ have h_eq : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = -+ (norm (f z) / r) / norm (2 * M - f z) := -+ lem_g_at_r R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary -+ -+ rw [← h_eq] -+ exact h_bound -+ -+lemma lem_fracs (a b r R : ℝ) (ha : a > 0) (hb : b > 0) (hr : r > 0) (hR : R > 0) -+(h_le : (a / r) / b ≤ 1 / R) : R * a ≤ r * b := by -+ -+ have h1 : (a / r) / b = a / (r * b) := by -+ field_simp -+ rw [h1] at h_le -+ -+ have h_pos_rb : 0 < r * b := mul_pos hr hb -+ rw [div_le_div_iff₀ h_pos_rb hR] at h_le -+ -+ simp only [one_mul] at h_le -+ -+ linarith -+ -+lemma lem_nonneg_product_with_real_abs (r M : ℝ) (hr : r > 0) (hM : M > 0) : 0 ≤ r * (2 * |M|) := by -+ -+ have h_abs_eq : |M| = M := abs_of_pos hM -+ -+ rw [h_abs_eq] -+ -+ have h_two_M_pos : (2 : ℝ) * M > 0 := by -+ apply mul_pos -+ norm_num -+ exact hM -+ -+ apply mul_nonneg -+ linarith [hr] -+ linarith [h_two_M_pos] -+ -+lemma lem_f_bound_rearranged (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) -+ (z : ℂ) (hz_on_boundary : norm z = r) : -+R * norm (f z) ≤ r * norm (2 * M - f z) := by -+ -+ have hz_in_closure : z ∈ closure (ballDR R) := by -+ rw [lem_ballDR R hR] -+ rw [Metric.mem_closedBall] -+ rw [Complex.dist_eq] -+ simp -+ linarith [hz_on_boundary, hr_lt_R] -+ -+ have h_ineq : (norm (f z) / r) / norm (2 * M - f z) ≤ 1 / R := -+ lem_g_at_rR R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary -+ -+ have h_denom_nonzero : (2 * M - f z) ≠ 0 := -+ lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz_in_closure -+ -+ have h_denom_pos : norm (2 * M - f z) > 0 := -+ lem_abspos (2 * M - f z) h_denom_nonzero -+ -+ by_cases h_case : f z = 0 -+ · -+ rw [h_case] -+ simp [mul_zero] -+ exact lem_nonneg_product_with_real_abs r M hr_pos hM -+ · -+ have h_num_pos : norm (f z) > 0 := -+ lem_abspos (f z) h_case -+ -+ exact lem_fracs (norm (f z)) (norm (2 * M - f z)) r R -+ h_num_pos h_denom_pos hr_pos hR h_ineq -+ -+lemma lem_final_bound_on_circle0 (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) -+ (z : ℂ) (hz_on_boundary : norm z = r) : -+norm (f z) ≤ (2 * r / (R - r)) * M := by -+ -+ have h_ineq : R * norm (f z) ≤ r * norm (2 * M - f z) := -+ lem_f_bound_rearranged R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary -+ -+ have h_bound : norm (f z) ≤ (2 * M * r) / (R - r) := -+ lem_rtriangle7 r R M (f z) hr_pos hr_lt_R hM h_ineq -+ -+ have h_rearrange : (2 * M * r) / (R - r) = (2 * r / (R - r)) * M := by -+ field_simp -+ -+ rw [← h_rearrange] -+ exact h_bound -+ -+lemma lem_final_bound_on_circle (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) -+ (z : ℂ) (hz_on_boundary : norm z = r) : -+norm (f z) ≤ (2 * r / (R - r)) * M := by -+ exact lem_final_bound_on_circle0 R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary -+ -+lemma lem_BCI (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) -+ (z : ℂ) (hz_in_ball : norm z ≤ r) : -+norm (f z) ≤ (2 * r / (R - r)) * M := by -+ -+ let B := (2 * r / (R - r)) * M -+ -+ have hB : B ≥ 0 := by -+ unfold B -+ apply mul_nonneg -+ · apply div_nonneg -+ · apply mul_nonneg -+ · norm_num -+ · linarith [hr_pos] -+ · linarith [hr_lt_R] -+ · linarith [hM] -+ -+ have h_analytic_r : AnalyticOn ℂ f (closure (ballDR r)) := by -+ apply AnalyticOn.mono h_analytic -+ -+ apply closure_mono -+ unfold ballDR -+ exact Metric.ball_subset_ball (le_of_lt hr_lt_R) -+ -+ have hz_in_closure_r : z ∈ closure (ballDR r) := by -+ rw [lem_ballDR r hr_pos] -+ rw [Metric.mem_closedBall] -+ rw [Complex.dist_eq] -+ simp -+ exact hz_in_ball -+ -+ have h_boundary : ∀ w : ℂ, norm w = r → norm (f w) ≤ B := by -+ intro w hw_boundary -+ exact lem_final_bound_on_circle R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R w hw_boundary -+ -+ have h_closure := (lem_MMP r B hr_pos hB f h_analytic_r).mpr h_boundary -+ -+ exact h_closure z hz_in_closure_r -+ -+theorem thm_BorelCaratheodoryI (R M : ℝ) (hR : R > 0) (hM : M > 0) -+ (f : ℂ → ℂ) -+ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) -+ (h_zero : f 0 = 0) -+ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) -+ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) : -+sSup ((norm ∘ f) '' (closure (ballDR r))) ≤ (2 * r / (R - r)) * M := by -+ -+ apply Real.sSup_le -+ · -+ intro x hx -+ -+ obtain ⟨z, hz_in_closure, hx_eq⟩ := hx -+ rw [← hx_eq] -+ -+ have hz_bound : norm z ≤ r := by -+ rw [lem_ballDR r hr_pos] at hz_in_closure -+ rw [Metric.mem_closedBall] at hz_in_closure -+ rw [Complex.dist_eq] at hz_in_closure -+ simp at hz_in_closure -+ exact hz_in_closure -+ -+ exact lem_BCI R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_bound -+ · -+ apply mul_nonneg -+ · apply div_nonneg -+ · apply mul_nonneg -+ · norm_num -+ · linarith [hr_pos] -+ · linarith [hr_lt_R] -+ · linarith [hM] -+ -+def I := Complex.I -+ -+lemma cauchy_formula_deriv {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (_h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+deriv f z = (1 / (2 * Real.pi * I)) • ∮ w in C(0, r_int), (w - z)⁻¹ ^ 2 • f w := by -+ -+ obtain ⟨U', hU'_open, h_subset, hf_diff_U'⟩ := hf_domain -+ -+ have hz_in_ball : z ∈ Metric.ball (0 : ℂ) r_int := by -+ apply Metric.mem_ball.mpr -+ have h1 : ‖z - 0‖ ≤ r_z := by simpa only [dist_eq_norm] using Metric.mem_closedBall.mp hz -+ simp only [sub_zero] at h1 -+ have h2 : ‖z‖ < r_int := lt_of_le_of_lt h1 h_r_z_lt_r_int -+ rwa [dist_eq_norm, sub_zero] -+ -+ set U := Metric.ball (0 : ℂ) R_analytic -+ -+ have hc_subset : Metric.closedBall (0 : ℂ) r_int ⊆ U := by -+ apply Metric.closedBall_subset_ball -+ exact h_r_int_lt_R_analytic -+ -+ have hf_on_U : DifferentiableOn ℂ f U := by -+ -+ apply DifferentiableOn.mono hf_diff_U' -+ calc U = Metric.ball 0 R_analytic := rfl -+ _ ⊆ Metric.closedBall 0 R_analytic := Metric.ball_subset_closedBall -+ _ ⊆ U' := h_subset -+ -+ have cauchy_eq := Complex.two_pi_I_inv_smul_circleIntegral_sub_sq_inv_smul_of_differentiable -+ Metric.isOpen_ball hc_subset hf_on_U hz_in_ball -+ -+ rw [← cauchy_eq] -+ -+ congr 2 -+ · -+ simp only [one_div] -+ -+ rfl -+ · -+ ext w -+ rw [← inv_pow] -+ -+lemma lem_dw_dt {r_int : ℝ} (t : ℝ) : -+deriv (fun t' => r_int * Complex.exp (I * t')) t = I * r_int * Complex.exp (I * t) := by -+ -+ rw [deriv_const_mul] -+ -+ rw [deriv_cexp] -+ -+ rw [deriv_const_mul] -+ -+ convert_to r_int * (Complex.exp (I * t) * (I * 1)) = I * r_int * Complex.exp (I * t) -+ · -+ rw [← deriv_id] -+ congr -+ -+ ring -+ -+ · exact differentiableAt_id -+ · exact (differentiableAt_const I).mul differentiableAt_id -+ · exact DifferentiableAt.cexp ((differentiableAt_const I).mul differentiableAt_id) -+ -+lemma circleMap_zero_eq_exp (r : ℝ) (t : ℝ) : circleMap 0 r t = r * Complex.exp (I * t) := by -+ -+ rw [circleMap] -+ -+ simp only [zero_add] -+ -+ congr 2 -+ rw [mul_comm (t : ℂ) Complex.I] -+ -+ rfl -+ -+lemma deriv_ofReal_eq_one (t : ℝ) : deriv Complex.ofReal t = 1 := by -+ -+ have h : deriv Complex.ofReal t = Complex.ofReal 1 := by -+ -+ rw [show Complex.ofReal = ⇑Complex.ofRealCLM from rfl] -+ exact ContinuousLinearMap.deriv Complex.ofRealCLM -+ -+ rw [h] -+ simp only [Complex.ofReal_one] -+ -+lemma differentiableAt_ofReal (t : ℝ) : DifferentiableAt ℝ Complex.ofReal t := by -+ -+ rw [show Complex.ofReal = ⇑Complex.ofRealCLM from rfl] -+ -+ apply ContinuousLinearMap.differentiableAt -+ -+lemma lem_dw_dt_real {r_int : ℝ} (t : ℝ) : -+deriv (fun (t' : ℝ) => r_int * Complex.exp (I * t')) t = I * r_int * Complex.exp (I * t) := by -+ -+ rw [deriv_const_mul] -+ -+ rw [deriv_cexp] -+ -+ rw [deriv_const_mul] -+ -+ rw [deriv_ofReal_eq_one] -+ -+ ring -+ -+ · exact differentiableAt_ofReal t -+ · exact (differentiableAt_const I).mul (differentiableAt_ofReal t) -+ · exact DifferentiableAt.cexp ((differentiableAt_const I).mul (differentiableAt_ofReal t)) -+ -+lemma deriv_circleMap_zero (r : ℝ) (t : ℝ) : deriv (circleMap 0 r) t = I * r * Complex.exp (I * t) := by -+ -+ have h : circleMap 0 r = fun (t' : ℝ) => r * Complex.exp (I * t') := by -+ ext t' -+ exact circleMap_zero_eq_exp r t' -+ -+ rw [h] -+ -+ exact lem_dw_dt_real t -+ -+lemma lem_CIF_deriv_param {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ deriv f z = (1 / (2 * Real.pi * I)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), -+(I * r_int * Complex.exp (I * t) * ((r_int * Complex.exp (I * t)) - z)⁻¹ ^ 2) * f (r_int * Complex.exp (I * t))) := by -+ -+ rw [cauchy_formula_deriv hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] -+ -+ rw [circleIntegral_def_Icc] -+ -+ rw [smul_eq_mul] -+ -+ simp only [circleMap_zero_eq_exp, deriv_circleMap_zero] -+ -+ congr 2 -+ ext t -+ simp only [smul_eq_mul] -+ ring -+ -+lemma mul_comm_div_cancel (a b : ℂ) (ha : a ≠ 0) (hb : b ≠ 0) : a * b / (b * a) = 1 := by -+ -+ rw [mul_comm b a] -+ -+ apply div_self -+ -+ exact mul_ne_zero ha hb -+ -+lemma complex_coeff_I_cancel : (1 : ℂ) / (2 * Real.pi * I) * I = 1 / (2 * Real.pi) := by -+ field_simp [I, Complex.I_ne_zero, Real.pi_pos.ne'] -+ -+lemma factor_I_from_integrand (f : ℂ → ℂ) (r_int : ℝ) (z : ℂ) : -+ ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I * ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = -+ I * ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) := by -+ -+ have h : ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I * ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = -+ ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I • (↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t))) := by -+ congr 1 -+ ext t -+ rw [smul_eq_mul] -+ ring -+ rw [h] -+ -+ rw [MeasureTheory.integral_smul] -+ -+ rw [smul_eq_mul] -+ -+lemma integrand_transform_div (f : ℂ → ℂ) (r_int : ℝ) (z : ℂ) (t : ℝ) : -+ ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = -+ ↑r_int * Complex.exp (I * ↑t) * f (↑r_int * Complex.exp (I * ↑t)) / (↑r_int * Complex.exp (I * ↑t) - z) ^ 2 := by -+ -+ rw [inv_pow] -+ -+ rw [← div_eq_mul_inv] -+ -+ ring -+ -+lemma lem_CIF_deriv_simplified {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ deriv f z = (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), -+(r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) := by -+ -+ rw [lem_CIF_deriv_param hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] -+ -+ rw [factor_I_from_integrand f r_int z] -+ -+ rw [← mul_assoc, complex_coeff_I_cancel] -+ -+ congr 2 -+ funext t -+ rw [integrand_transform_div f r_int z t] -+ -+lemma lem_modulus_of_f_prime0 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ norm (deriv f z) = norm ((1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), -+(r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by -+ -+ rw [lem_CIF_deriv_simplified hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] -+ -+lemma one_div_two_pi_pos : (1 : ℝ) / (2 * Real.pi) > 0 := by -+ -+ have h_pi_pos : Real.pi > 0 := Real.pi_pos -+ -+ have h_2pi_pos : 2 * Real.pi > 0 := by -+ apply mul_pos -+ · norm_num -+ · exact h_pi_pos -+ -+ apply div_pos -+ · norm_num -+ · exact h_2pi_pos -+ -+lemma abs_integral_le_integral_abs {a b : ℝ} {g : ℝ → ℂ} (_hab : a ≤ b) : norm (∫ (t : ℝ) in Set.Icc a b, g t) ≤ ∫ (t : ℝ) in Set.Icc a b, norm (g t) := by -+ -+ exact MeasureTheory.norm_integral_le_integral_norm g -+ -+lemma abs_ofReal_mul_complex (c : ℝ) (z : ℂ) (hc : c ≥ 0) : norm (↑c * z) = c * norm z := by -+ -+ have h1 : norm (↑c * z) = norm (↑c) * norm z := by simp -+ rw [h1] -+ -+ congr 1 -+ -+ simp -+ assumption -+ -+lemma complex_abs_mul (a b : ℂ) : norm (a * b) = norm a * norm b := -+ Complex.norm_mul a b -+ -+lemma complex_abs_ofReal_nonneg (r : ℝ) (hr : r ≥ 0) : norm (↑r : ℂ) = r := by -+ -+ have h1 : norm (↑r * 1) = r * norm (1 : ℂ) := by simp; assumption -+ -+ simp only [mul_one] at h1 -+ have h2 : norm (1 : ℂ) = 1 := by simp -+ rw [h2] at h1 -+ simp only [mul_one] at h1 -+ simp -+ assumption -+ -+lemma abs_one_div_two_pi_complex : norm (1 / (2 * ↑Real.pi : ℂ)) = 1 / (2 * Real.pi) := by -+ -+ have h_eq : (1 / (2 * ↑Real.pi) : ℂ) = ↑(1 / (2 * Real.pi) : ℝ) := by -+ simp only [Complex.ofReal_div, Complex.ofReal_one, Complex.ofReal_mul, Complex.ofReal_ofNat] -+ -+ rw [h_eq] -+ -+ have h_nonneg : (1 / (2 * Real.pi) : ℝ) ≥ 0 := by -+ apply div_nonneg -+ · norm_num -+ · apply mul_nonneg -+ · norm_num -+ · exact le_of_lt Real.pi_pos -+ -+ exact complex_abs_ofReal_nonneg (1 / (2 * Real.pi)) h_nonneg -+ -+lemma lem_integral_modulus_inequality {r_int : ℝ} {z : ℂ} {f : ℂ → ℂ} : -+norm ((1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), (r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) ≤ (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by -+ -+ rw [complex_abs_mul] -+ -+ rw [abs_one_div_two_pi_complex] -+ -+ apply mul_le_mul_of_nonneg_left -+ · -+ have h_2pi_nonneg : (0 : ℝ) ≤ 2 * Real.pi := by -+ apply mul_nonneg -+ · norm_num -+ · exact le_of_lt Real.pi_pos -+ exact abs_integral_le_integral_abs h_2pi_nonneg -+ · exact le_of_lt one_div_two_pi_pos -+ -+lemma lem_modulus_of_f_prime {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ norm (deriv f z) ≤ (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), -+norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by -+ -+ rw [lem_modulus_of_f_prime0 hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] -+ -+ exact lem_integral_modulus_inequality -+ -+lemma lem_modulus_of_integrand_product2 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (_hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (_h_r_z_pos : 0 < r_z) -+ (_h_r_z_lt_r_int : r_z < r_int) -+ (_h_r_int_lt_R_analytic : r_int < R_analytic) : -+ norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) = -+norm (f (r_int * Complex.exp (I * t))) * norm (r_int * Complex.exp (I * t)) := by -+ -+ rw [norm_mul] -+ -+lemma lem_modeit (t : ℝ) : norm (Complex.exp (I * t)) = Real.exp (Complex.re (I * t)) := by -+ -+ exact Complex.norm_exp (I * t) -+ -+lemma lem_Reit0 (t : ℝ) : Complex.re (I * t) = 0 := by -+ -+ unfold I -+ -+ rw [Complex.mul_re] -+ -+ rw [Complex.I_re, Complex.I_im, Complex.ofReal_re, Complex.ofReal_im] -+ -+ ring -+ -+lemma lem_eReite0 (t : ℝ) : Real.exp (Complex.re (I * t)) = Real.exp 0 := by -+ -+ rw [lem_Reit0] -+ -+lemma lem_e01 : Real.exp 0 = 1 := by -+ exact Real.exp_zero -+ -+lemma lem_eReit1 (t : ℝ) : Real.exp (Complex.re (I * t)) = 1 := by -+ -+ rw [lem_eReite0] -+ -+ rw [Real.exp_zero] -+ -+lemma lem_modulus_of_e_it_is_one (t : ℝ) : norm (Complex.exp (I * t)) = 1 := by -+ -+ rw [lem_modeit] -+ -+ rw [lem_Reit0] -+ -+ rw [lem_e01] -+ -+lemma lem_modulus_of_ae_it {a t : ℝ} (ha : 0 < a) : norm (a * Complex.exp (I * t)) = a := by -+ -+ rw [norm_mul, lem_modulus_of_e_it_is_one, mul_one, Complex.norm_real] -+ exact abs_of_pos ha -+ -+lemma lem_modulus_of_integrand_product3 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) : -+norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) = r_int * norm (f (r_int * Complex.exp (I * t))) := by -+ -+ rw [lem_modulus_of_integrand_product2 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] -+ -+ have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int -+ rw [lem_modulus_of_ae_it h_r_int_pos] -+ -+ ring -+ -+lemma lem_modulus_of_square (c : ℂ) : norm (c ^ 2) = (norm c) ^ 2 := by -+ exact Complex.norm_pow c 2 -+ -+lemma lem_modulus_wz (w z : ℂ) : norm ((w - z) ^ 2) = (norm (w - z)) ^ 2 := by -+ -+ exact Complex.norm_pow (w - z) 2 -+ -+lemma lem_reverse_triangle (w z : ℂ) : norm w - norm z ≤ norm (w - z) := by -+ -+ exact norm_sub_norm_le w z -+ -+lemma lem_reverse_triangle2 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} -+ (_h_r_z_pos : 0 < r_z) -+ (_h_r_z_lt_r_int : r_z < r_int) -+ (_h_r_int_lt_R_analytic : r_int < R_analytic) : -+norm (r_int * Complex.exp (I * t)) - norm z ≤ norm (r_int * Complex.exp (I * t) - z) := by -+ -+ exact lem_reverse_triangle (r_int * Complex.exp (I * t)) z -+ -+lemma lem_reverse_triangle3 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (_h_r_int_lt_R_analytic : r_int < R_analytic) : -+r_int - norm z ≤ norm (r_int * Complex.exp (I * t) - z) := by -+ -+ have h_mod : norm (r_int * Complex.exp (I * t)) = r_int := by -+ have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int -+ exact lem_modulus_of_ae_it h_r_int_pos -+ -+ have h_triangle := lem_reverse_triangle (r_int * Complex.exp (I * t)) z -+ -+ rw [h_mod] at h_triangle -+ exact h_triangle -+ -+lemma lem_zrr1 {R_analytic r_z r_int : ℝ} -+ (_h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (_h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+0 < r_int - norm z := by -+ -+ have h1 : dist z 0 ≤ r_z := Metric.mem_closedBall.mp hz -+ -+ have h2 : dist z 0 = ‖z‖ := by -+ rw [dist_eq_norm, sub_zero] -+ -+ have h3 : ‖z‖ ≤ r_z := by rwa [← h2] -+ -+ have h4 : norm z = ‖z‖ := rfl -+ -+ have h5 : norm z ≤ r_z := by rwa [h4] -+ -+ have h6 : norm z < r_int := lt_of_le_of_lt h5 h_r_z_lt_r_int -+ -+ linarith -+ -+lemma lem_zrr2 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ (hz : z ∈ Metric.closedBall 0 r_z) : -+r_int - r_z ≤ norm (r_int * Complex.exp (I * t) - z) := by -+ -+ have h1 : norm z ≤ r_z := by -+ have h_dist : dist z 0 ≤ r_z := Metric.mem_closedBall.mp hz -+ rw [dist_eq_norm, sub_zero] at h_dist -+ exact h_dist -+ -+ have h2 : r_int - r_z ≤ r_int - norm z := by linarith [h1] -+ -+ have h3 := @lem_reverse_triangle3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic -+ -+ exact le_trans h2 h3 -+ -+lemma lem_rr11 {r r' : ℝ} (_h_r_pos : 0 < r) (h_r_lt_r_prime : r < r') : r' - r > 0 := by -+ linarith -+ -+lemma lem_rr12 {r r' : ℝ} (h_r_pos : 0 < r) (h_r_lt_r_prime : r < r') : -+(r' - r) ^ 2 > 0 := by -+ -+ have h_diff_pos : r' - r > 0 := lem_rr11 h_r_pos h_r_lt_r_prime -+ -+ exact sq_pos_of_pos h_diff_pos -+ -+lemma lem_zrr3 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ (hz : z ∈ Metric.closedBall 0 r_z) : -+(r_int - r_z) ^ 2 ≤ norm (r_int * Complex.exp (I * t) - z) ^ 2 := by -+ -+ have h_ineq := @lem_zrr2 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ have h_nonneg_left : 0 ≤ r_int - r_z := by linarith [h_r_z_lt_r_int] -+ have h_nonneg_right : 0 ≤ norm (r_int * Complex.exp (I * t) - z) := norm_nonneg _ -+ -+ have h_sq := mul_self_le_mul_self h_nonneg_left h_ineq -+ -+ rw [pow_two, pow_two] -+ exact h_sq -+ -+lemma lem_zrr4 {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (_h_r_z_pos : 0 < r_z) -+ (_h_r_z_lt_r_int : r_z < r_int) -+ (_h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (_hz : z ∈ Metric.closedBall 0 r_z) : -+norm ((r_int * Complex.exp (I * t) - z) ^ 2) = (norm (r_int * Complex.exp (I * t) - z)) ^ 2 := by -+ -+ exact lem_modulus_of_square (r_int * Complex.exp (I * t) - z) -+ -+lemma lem_reverse_triangle4 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ (hz : z ∈ Metric.closedBall 0 r_z) : -+0 < norm (r_int * Complex.exp (I * t) - z) := by -+ -+ have h1 := lem_zrr1 h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ have h2 := @lem_reverse_triangle3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic -+ -+ exact lt_of_lt_of_le h1 h2 -+ -+lemma lem_wposneq0 (w : ℂ) : norm w > 0 → w ≠ 0 := by -+ intro h -+ -+ by_contra h_eq_zero -+ -+ have h_abs_zero : norm w = 0 := by -+ rw [h_eq_zero] -+ simp -+ -+ rw [h_abs_zero] at h -+ exact lt_irrefl 0 h -+ -+lemma lem_reverse_triangle5 {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+r_int * Complex.exp (I * t) - z ≠ 0 := by -+ -+ have h_pos := @lem_reverse_triangle4 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ exact lem_wposneq0 (r_int * Complex.exp (I * t) - z) h_pos -+ -+lemma lem_reverse_triangle6 {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+(r_int * Complex.exp (I * t) - z) ^ 2 ≠ 0 := by -+ -+ have h_ne_zero := lem_reverse_triangle5 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ exact pow_ne_zero 2 h_ne_zero -+ -+lemma lem_absdiv {a b : ℂ} (_hb : b ≠ 0) : norm (a / b) = norm a / norm b := by -+ -+ exact norm_div a b -+ -+lemma lem_modulus_of_integrand_product {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (_hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = -+norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / norm ((r_int * Complex.exp (I * t)) - z) ^ 2 := by -+ -+ have h_neq_zero : r_int * Complex.exp (I * t) - z ≠ 0 := -+ lem_reverse_triangle5 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ have h_sq_neq_zero : (r_int * Complex.exp (I * t) - z) ^ 2 ≠ 0 := by -+ rw [pow_two] -+ exact mul_self_ne_zero.mpr h_neq_zero -+ -+ rw [lem_absdiv h_sq_neq_zero] -+ -+ rw [lem_modulus_wz] -+ -+lemma lem_modulus_of_product {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = -+(r_int * norm (f (r_int * Complex.exp (I * t)))) / norm ((r_int * Complex.exp (I * t)) - z) ^ 2 := by -+ -+ rw [lem_modulus_of_integrand_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] -+ -+ rw [lem_modulus_of_integrand_product3 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] -+ -+lemma lem_modulus_of_product2 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = -+(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((norm (r_int * Complex.exp (I * t) - z)) ^ 2) := by -+ -+ rw [lem_modulus_of_integrand_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] -+ -+ rw [lem_modulus_of_integrand_product3 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] -+ -+lemma lem_modulus_of_product3 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (_hf : DifferentiableOn ℂ f (Metric.closedBall 0 R_analytic)) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ (r_int * norm (f (r_int * Complex.exp (I * t)))) / ((norm (r_int * Complex.exp (I * t) - z)) ^ 2) ≤ -+(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((r_int - r_z) ^ 2) := by -+ -+ have h_ineq := @lem_zrr3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ have h_numer_nonneg : 0 ≤ r_int * norm (f (r_int * Complex.exp (I * t))) := by -+ apply mul_nonneg -+ · linarith [h_r_z_pos, h_r_z_lt_r_int] -+ · exact norm_nonneg _ -+ -+ have h_denom1_pos : 0 < (norm (r_int * Complex.exp (I * t) - z)) ^ 2 := by -+ apply pow_pos -+ exact lem_reverse_triangle4 h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ have h_denom2_pos : 0 < (r_int - r_z) ^ 2 := by -+ exact lem_rr12 h_r_z_pos h_r_z_lt_r_int -+ -+ exact div_le_div_of_nonneg_left h_numer_nonneg h_denom2_pos h_ineq -+ -+lemma lem_modulus_of_product4 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ -+(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((r_int - r_z) ^ 2) := by -+ -+ rw [lem_modulus_of_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] -+ -+ have h_ineq := @lem_zrr3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ apply div_le_div_of_nonneg_left -+ · -+ apply mul_nonneg -+ · linarith [h_r_z_pos, h_r_z_lt_r_int] -+ · exact norm_nonneg _ -+ · -+ apply pow_pos -+ linarith [h_r_z_lt_r_int] -+ · -+ exact h_ineq -+ -+lemma lem_bound_on_f_at_r_prime {M R_analytic r_int : ℝ} -+ (hM_pos : 0 < M) -+ (hR_analytic_pos : 0 < R_analytic) -+ (hr_int_pos : 0 < r_int) -+ (hr_int_lt_R_analytic : r_int < R_analytic) -+ (f : ℂ → ℂ) -+ -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (hf0 : f 0 = 0) -+ (hRe_f_le_M : ∀ z ∈ Metric.closedBall 0 R_analytic, (f z).re ≤ M) -+ (t : ℝ) : -+norm (f (r_int * Complex.exp (I * t))) ≤ (2 * r_int * M) / (R_analytic - r_int) := by -+ -+ obtain ⟨U, hU_open, h_subset, hf_diff_U⟩ := hf_domain -+ -+ let z₀ := r_int * Complex.exp (I * t) -+ -+ have h_sSup_bound := thm_BorelCaratheodoryI R_analytic M hR_analytic_pos hM_pos f -+ -+ (by -+ -+ have h_analytic_U : AnalyticOn ℂ f U := hf_diff_U.analyticOn hU_open -+ -+ rw [ballDR] -+ convert h_analytic_U.mono h_subset -+ -+ apply closure_ball -+ linarith -+ ) -+ hf0 -+ (by rwa [lem_ballDR R_analytic hR_analytic_pos]) -+ r_int hr_int_pos hr_int_lt_R_analytic -+ -+ have hz₀_in_ball : z₀ ∈ Metric.closedBall 0 r_int := by -+ rw [Metric.mem_closedBall] -+ simp only [dist_eq_norm, sub_zero] -+ -+ have h_norm : ‖r_int * Complex.exp (I * t)‖ = r_int := by -+ rw [norm_mul] -+ -+ have h1 : ‖(r_int : ℂ)‖ = r_int := by -+ rw [Complex.norm_real] -+ exact abs_of_pos hr_int_pos -+ -+ have h2 : ‖Complex.exp (I * ↑t)‖ = 1 := by -+ -+ exact lem_modulus_of_e_it_is_one t -+ rw [h1, h2] -+ ring -+ rw [h_norm] -+ -+ have hz₀_in_closure : z₀ ∈ closure (ballDR r_int) := by -+ rw [lem_ballDR r_int hr_int_pos] -+ exact hz₀_in_ball -+ -+ have h_in_image : norm (f z₀) ∈ (norm ∘ f) '' (closure (ballDR r_int)) := by -+ use z₀, hz₀_in_closure -+ rfl -+ -+ have h_le_sSup : norm (f z₀) ≤ sSup ((norm ∘ f) '' (closure (ballDR r_int))) := by -+ apply le_csSup -+ -+ · use (2 * r_int / (R_analytic - r_int)) * M -+ intros x hx -+ obtain ⟨w, hw_in, hx_eq⟩ := hx -+ rw [← hx_eq] -+ -+ have hw_in_closed : w ∈ Metric.closedBall 0 r_int := by -+ rwa [← lem_ballDR r_int hr_int_pos] -+ -+ have hw_in_R : w ∈ Metric.closedBall 0 R_analytic := by -+ have h_subset : Metric.closedBall (0 : ℂ) r_int ⊆ Metric.closedBall 0 R_analytic := by -+ apply Metric.closedBall_subset_closedBall -+ linarith [hr_int_lt_R_analytic] -+ exact h_subset hw_in_closed -+ -+ exact lem_BCI R_analytic M hR_analytic_pos hM_pos f -+ (by -+ rw [ballDR] -+ have h_analytic_U : AnalyticOn ℂ f U := hf_diff_U.analyticOn hU_open -+ convert h_analytic_U.mono h_subset -+ apply closure_ball -+ linarith) -+ hf0 -+ (by rwa [lem_ballDR R_analytic hR_analytic_pos]) -+ r_int hr_int_pos hr_int_lt_R_analytic w -+ (by aesop) -+ -+ · exact h_in_image -+ -+ calc norm (f z₀) -+ ≤ sSup ((norm ∘ f) '' (closure (ballDR r_int))) := h_le_sSup -+ _ ≤ (2 * r_int / (R_analytic - r_int)) * M := h_sSup_bound -+ _ = (2 * r_int * M) / (R_analytic - r_int) := by ring -+ -+lemma lem_bound_on_integrand_modulus {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} -+ (hM_pos : 0 < M) -+ (hR_analytic_pos : 0 < R_analytic) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (hf0 : f 0 = 0) -+ (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) -+ (t : ℝ) : -+norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by -+ -+ have h1 := lem_modulus_of_product4 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ have h2 := lem_bound_on_f_at_r_prime hM_pos hR_analytic_pos (lt_trans h_r_z_pos h_r_z_lt_r_int) h_r_int_lt_R_analytic f hf_domain hf0 hRe_f_le_M t -+ -+ have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int -+ have h_denom_nonneg : 0 ≤ (r_int - r_z) ^ 2 := by -+ apply sq_nonneg -+ -+ have h3 : (r_int * norm (f (r_int * Complex.exp (I * t)))) / (r_int - r_z) ^ 2 ≤ -+ (r_int * (2 * r_int * M / (R_analytic - r_int))) / (r_int - r_z) ^ 2 := by -+ apply div_le_div_of_nonneg_right _ h_denom_nonneg -+ apply mul_le_mul_of_nonneg_left h2 -+ linarith [h_r_int_pos] -+ -+ have h4 : (r_int * (2 * r_int * M / (R_analytic - r_int))) / (r_int - r_z) ^ 2 = -+ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by -+ have h_R_sub_r_pos : 0 < R_analytic - r_int := by linarith [h_r_int_lt_R_analytic] -+ have h_r_sub_r_pos : 0 < r_int - r_z := by linarith [h_r_z_lt_r_int] -+ field_simp [ne_of_gt h_R_sub_r_pos, ne_of_gt (pow_pos h_r_sub_r_pos 2)] -+ -+ rw [h4] at h3 -+ exact le_trans h1 h3 -+ -+lemma lem_integral_inequality_aux {g : ℝ → ℝ} {C a b : ℝ} (hab : a ≤ b) -+ (h_integrable : IntervalIntegrable g MeasureTheory.volume a b) -+ (h_bound : ∀ t ∈ Set.Icc a b, g t ≤ C) : -+∫ t in a..b, g t ≤ ∫ _t in a..b, C := by -+ -+ have h_const_integrable : IntervalIntegrable (fun _ => C) MeasureTheory.volume a b := -+ intervalIntegrable_const -+ -+ have h_pointwise : ∀ x ∈ Set.Icc a b, g x ≤ (fun _ => C) x := by -+ intro x hx -+ simp -+ exact h_bound x hx -+ -+ exact intervalIntegral.integral_mono_on hab h_integrable h_const_integrable h_pointwise -+ -+lemma lem_integral_inequality {g : ℝ → ℝ} {C a b : ℝ} (hab : a ≤ b) -+ (h_integrable : IntervalIntegrable g MeasureTheory.volume a b) -+ (h_bound : ∀ t ∈ Set.Icc a b, g t ≤ C) : -+∫ t in Set.Icc a b, g t ≤ ∫ _t in Set.Icc a b, C := by -+ rw [MeasureTheory.integral_Icc_eq_integral_Ioc, MeasureTheory.integral_Icc_eq_integral_Ioc] -+ rw [← intervalIntegral.integral_of_le hab, ← intervalIntegral.integral_of_le hab] -+ exact lem_integral_inequality_aux hab h_integrable h_bound -+ -+lemma continuous_real_parameterization (r : ℝ) : Continuous (fun t : ℝ => r * Complex.exp (I * t)) := by -+ -+ have h1 : Continuous (fun t : ℝ => (t : ℂ)) := Complex.continuous_ofReal -+ -+ have h2 : Continuous (fun z : ℂ => I * z) := by -+ apply Continuous.mul -+ · exact continuous_const -+ · exact continuous_id -+ -+ have h3 : Continuous Complex.exp := Complex.continuous_exp -+ -+ have h4 : Continuous (fun z : ℂ => (r : ℂ) * z) := by -+ apply Continuous.mul -+ · exact continuous_const -+ · exact continuous_id -+ -+ apply Continuous.comp h4 -+ apply Continuous.comp h3 -+ apply Continuous.comp h2 -+ exact h1 -+ -+lemma continuous_f_parameterized {f : ℂ → ℂ} {R r : ℝ} (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R ⊆ U ∧ DifferentiableOn ℂ f U) -+ (hr_pos : 0 < r) (hr_lt_R : r < R) : Continuous (fun t : ℝ => f (r * Complex.exp (I * t))) := by -+ -+ obtain ⟨U', hU'_open, h_subset, hf_diff_U'⟩ := hf_domain -+ have hf_cont : ContinuousOn f (Metric.closedBall 0 R) := by -+ -+ have hf_on_closed : DifferentiableOn ℂ f (Metric.closedBall 0 R) := -+ hf_diff_U'.mono h_subset -+ -+ exact DifferentiableOn.continuousOn hf_on_closed -+ -+ have hparam_cont : Continuous (fun t : ℝ => r * Complex.exp (I * t)) := continuous_real_parameterization r -+ -+ have hparam_range : ∀ t : ℝ, r * Complex.exp (I * t) ∈ Metric.closedBall 0 R := by -+ intro t -+ rw [Metric.mem_closedBall, dist_zero_right] -+ -+ change norm (r * Complex.exp (I * t)) ≤ R -+ rw [lem_modulus_of_ae_it hr_pos] -+ exact le_of_lt hr_lt_R -+ -+ have hcomp_on : ContinuousOn (fun t : ℝ => f (r * Complex.exp (I * t))) Set.univ := by -+ apply ContinuousOn.comp hf_cont (Continuous.continuousOn hparam_cont) -+ intro t _ -+ exact hparam_range t -+ -+ exact continuousOn_univ.mp hcomp_on -+ -+lemma continuous_denominator_parameterized (r : ℝ) (z : ℂ) : Continuous (fun t : ℝ => (r * Complex.exp (I * t) - z) ^ 2) := by -+ -+ have h1 : Continuous (fun t : ℝ => r * Complex.exp (I * t) - z) := by -+ -+ apply Continuous.sub -+ · -+ exact continuous_real_parameterization r -+ · -+ exact continuous_const -+ -+ have h2 : Continuous (fun x : ℂ => x ^ 2) := continuous_pow 2 -+ -+ exact Continuous.comp h2 h1 -+ -+lemma interval_integrable_cauchy_integrand {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} {z : ℂ} -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ (hz : z ∈ Metric.closedBall 0 r_z) : -+IntervalIntegrable (fun t => norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) MeasureTheory.volume 0 (2 * Real.pi) := by -+ -+ apply Continuous.intervalIntegrable -+ -+ apply Continuous.comp continuous_norm -+ -+ apply Continuous.div₀ -+ -+ · apply Continuous.mul -+ -+ · exact continuous_real_parameterization r_int -+ -+ · have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int -+ exact continuous_f_parameterized hf_domain h_r_int_pos h_r_int_lt_R_analytic -+ -+ · exact continuous_denominator_parameterized r_int z -+ -+ · intro t -+ exact lem_reverse_triangle6 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+lemma integral_const_over_interval (C : ℝ) : -+∫ _t in Set.Icc 0 (2 * Real.pi), C = (2 * Real.pi) * C := by -+ -+ rw [MeasureTheory.integral_Icc_eq_integral_Ioc] -+ -+ have h_le : (0 : ℝ) ≤ 2 * Real.pi := by -+ apply mul_nonneg -+ · norm_num -+ · exact Real.pi_pos.le -+ rw [← intervalIntegral.integral_of_le h_le] -+ -+ rw [intervalIntegral.integral_const] -+ -+ simp [sub_zero, smul_eq_mul] -+ -+lemma lem_f_prime_bound_by_integral_of_constant {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} -+ (hM_pos : 0 < M) -+ (hR_analytic_pos : 0 < R_analytic) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (hf0 : f 0 = 0) -+ (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+norm (deriv f z) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by -+ -+ have h1 := lem_modulus_of_f_prime hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ set C := (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) -+ -+ have h_bound : ∀ t ∈ Set.Icc 0 (2 * Real.pi), -+ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ C := by -+ intro t ht -+ exact lem_bound_on_integrand_modulus hM_pos hR_analytic_pos h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hf_domain hf0 hRe_f_le_M hz t -+ -+ have h_eq : ∀ t, norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = -+ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) := by -+ intro t -+ congr 2 -+ ring -+ -+ have h_bound_h1 : ∀ t ∈ Set.Icc 0 (2 * Real.pi), -+ norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ C := by -+ intro t ht -+ rw [h_eq] -+ exact h_bound t ht -+ -+ have h_integrable : IntervalIntegrable (fun t => norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) MeasureTheory.volume 0 (2 * Real.pi) := by -+ -+ exact interval_integrable_cauchy_integrand hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz -+ -+ have h2 := lem_integral_inequality ?_ h_integrable h_bound_h1 -+ -+ have h_const_integral : ∫ t in Set.Icc 0 (2 * Real.pi), C = (2 * Real.pi) * C := by -+ -+ exact integral_const_over_interval C -+ -+ rw [h_const_integral] at h2 -+ -+ have h3 : (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), -+ norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) ≤ -+ (1 / (2 * Real.pi)) * (2 * Real.pi * C) := by -+ apply mul_le_mul_of_nonneg_left h2 -+ apply div_nonneg -+ · norm_num -+ · linarith [Real.pi_pos] -+ -+ have h4 : (1 / (2 * Real.pi)) * (2 * Real.pi * C) = C := by -+ have h_pi_ne_zero : (2 : ℝ) * Real.pi ≠ 0 := ne_of_gt (by linarith [Real.pi_pos]) -+ field_simp [h_pi_ne_zero] -+ -+ rw [h4] at h3 -+ exact le_trans h1 h3 -+ simp [Real.pi_nonneg] -+ -+lemma lem_integral_of_1 : ∫ (_t : ℝ) in Set.Icc 0 (2 * Real.pi), (1 : ℝ) = 2 * Real.pi := by -+ -+ rw [MeasureTheory.integral_Icc_eq_integral_Ioc] -+ -+ rw [← intervalIntegral.integral_of_le] -+ -+ rw [integral_one] -+ -+ simp -+ -+ exact mul_nonneg (by norm_num) Real.pi_pos.le -+ -+lemma lem_integral_2 : (1 / (2 * Real.pi)) * (∫ (_t : ℝ) in Set.Icc 0 (2 * Real.pi), (1 : ℝ)) = 1 := by -+ -+ rw [lem_integral_of_1] -+ -+ field_simp -+ -+lemma lem_f_prime_bound {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} -+ (hM_pos : 0 < M) -+ (hR_analytic_pos : 0 < R_analytic) -+ (h_r_z_pos : 0 < r_z) -+ (h_r_z_lt_r_int : r_z < r_int) -+ (h_r_int_lt_R_analytic : r_int < R_analytic) -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) -+ (hf0 : f 0 = 0) -+ (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : -+norm (deriv f z) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by -+ -+ exact lem_f_prime_bound_by_integral_of_constant hM_pos hR_analytic_pos h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hf_domain hf0 hRe_f_le_M hz -+ -+lemma lem_r_prime_gt_r {r R : ℝ} -+ (_h_r_pos : 0 < r) -+ (h_r_lt_R : r < R) : -+r < (r + R) / 2 := by -+ linarith -+ -+lemma lem_r_prime_lt_R {r R : ℝ} -+ (_h_r_pos : 0 < r) -+ (h_r_lt_R : r < R) : -+(r + R) / 2 < R := by -+ -+ rw [add_div_two_lt_right] -+ exact h_r_lt_R -+ -+lemma lem_r_prime_is_intermediate {r R : ℝ} -+ (h_r_pos : 0 < r) -+ (h_r_lt_R : r < R) : -+r < (r + R) / 2 ∧ (r + R) / 2 < R := by -+ constructor -+ · -+ rw [left_lt_add_div_two] -+ exact h_r_lt_R -+ · -+ exact lem_r_prime_lt_R h_r_pos h_r_lt_R -+ -+lemma lem_calc_R_minus_r_prime {r R : ℝ} -+ (_h_r_pos : 0 < r) -+ (_h_r_lt_R : r < R) : -+R - ((r + R) / 2) = (R - r) / 2 := by -+ field_simp; ring -+ -+lemma lem_calc_r_prime_minus_r {r R : ℝ} -+ (_h_r_pos : 0 < r) -+ (_h_r_lt_R : r < R) : -+((r + R) / 2) - r = (R - r) / 2 := by -+ -+ field_simp -+ -+ ring -+ -+lemma lem_calc_denominator_specific {r R : ℝ} -+ (h_r_pos : 0 < r) -+ (h_r_lt_R : r < R) : -+(R - ((r + R) / 2)) * (((r + R) / 2) - r) ^ 2 = ((R - r) ^ 3) / 8 := by -+ -+ rw [lem_calc_R_minus_r_prime h_r_pos h_r_lt_R] -+ -+ have h_calc : ((r + R) / 2) - r = (R - r) / 2 := by -+ field_simp; ring -+ -+ rw [h_calc] -+ -+ ring -+ -+lemma lem_calc_numerator_specific {M r R : ℝ} -+ (_hM_pos : 0 < M) -+ (_hr_pos : 0 < r) -+ (_hr_lt_R : r < R) : -+2 * (((r + R) / 2) ^ 2) * M = ((R + r) ^ 2 * M) / 2 := by -+ -+ ring -+ -+lemma lem_frac_simplify {M r R : ℝ} -+ (hM_pos : 0 < M) -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+ let r_prime := (r + R) / 2 -+(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) = (((R + r) ^ 2 * M) / 2) / (((R - r) ^ 3) / 8) := by -+ -+ dsimp only -+ -+ have h_num := lem_calc_numerator_specific hM_pos hr_pos hr_lt_R -+ -+ have h_denom := lem_calc_denominator_specific hr_pos hr_lt_R -+ -+ rw [← h_num, ← h_denom] -+ -+lemma lem_frac_simplify2 {M r R : ℝ} -+ (hM_pos : 0 < M) -+ (_hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+((R + r) ^ 2 * M / 2) / ((R - r) ^ 3 / 8) = (4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) := by -+ -+ have h_two_ne_zero : (2 : ℝ) ≠ 0 := by norm_num -+ have h_eight_ne_zero : (8 : ℝ) ≠ 0 := by norm_num -+ have h_R_minus_r_ne_zero : R - r ≠ 0 := by linarith [hr_lt_R] -+ have h_R_minus_r_pow_ne_zero : (R - r) ^ 3 ≠ 0 := by -+ apply pow_ne_zero -+ exact h_R_minus_r_ne_zero -+ -+ field_simp [h_two_ne_zero, h_eight_ne_zero, h_R_minus_r_pow_ne_zero]; ring -+ -+lemma lem_frac_simplify3 {M r R : ℝ} -+ (hM_pos : 0 < M) -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+ let r_prime := (r + R) / 2 -+(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) = (4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) := by -+ -+ dsimp only -+ -+ have h1 := lem_frac_simplify hM_pos hr_pos hr_lt_R -+ -+ have h2 := lem_frac_simplify2 hM_pos hr_pos hr_lt_R -+ -+ rw [h1, h2] -+ -+lemma lem_ineq_R_plus_r_lt_2R {r R : ℝ} (h_r_lt_R : r < R) : -+R + r < 2 * R := by -+ -+ rw [two_mul] -+ -+ linarith [h_r_lt_R] -+ -+lemma lem_R_plus_r_is_positive {r R : ℝ} -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+0 < R + r := by -+ -+ have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R -+ -+ exact add_pos hR_pos hr_pos -+ -+lemma lem_2R_is_positive {R : ℝ} (hR_pos : 0 < R) : 0 < 2 * R := by -+ apply mul_pos -+ · norm_num -+ · exact hR_pos -+ -+lemma lem_square_inequality_strict {a b : ℝ} -+ (h_a_pos : 0 < a) -+ (h_a_lt_b : a < b) : -+a ^ 2 < b ^ 2 := by -+ -+ have h_a_nonneg : 0 ≤ a := le_of_lt h_a_pos -+ -+ have h_b_pos : 0 < b := lt_trans h_a_pos h_a_lt_b -+ have h_b_nonneg : 0 ≤ b := le_of_lt h_b_pos -+ -+ have h_squares := mul_self_lt_mul_self_iff h_a_nonneg h_b_nonneg -+ -+ have h_mult : a * a < b * b := h_squares.mp h_a_lt_b -+ -+ rw [← pow_two, ← pow_two] at h_mult -+ exact h_mult -+ -+lemma lem_ineq_R_plus_r_sq_lt_2R_sq {r R : ℝ} -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+(R + r) ^ 2 < (2 * R) ^ 2 := by -+ -+ let a := R + r -+ let b := 2 * R -+ -+ have ha_pos : 0 < a := lem_R_plus_r_is_positive hr_pos hr_lt_R -+ -+ have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R -+ have hb_pos : 0 < b := by -+ unfold b -+ exact lem_2R_is_positive hR_pos -+ -+ have hab : a < b := by -+ unfold a b -+ exact lem_ineq_R_plus_r_lt_2R hr_lt_R -+ -+ have : a ^ 2 < b ^ 2 := lem_square_inequality_strict ha_pos hab -+ -+ unfold a b at this -+ exact this -+ -+lemma lem_2R_sq_is_4R_sq {R : ℝ} (_hR_pos : 0 < R) : (2 * R) ^ 2 = 4 * R ^ 2 := by -+ -+ ring -+ -+lemma lem_ineq_R_plus_r_sq {r R : ℝ} -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+(R + r) ^ 2 < 4 * R ^ 2 := by -+ -+ have h1 := lem_ineq_R_plus_r_lt_2R hr_lt_R -+ -+ have h2 := lem_R_plus_r_is_positive hr_pos hr_lt_R -+ -+ have h3 := lem_square_inequality_strict h2 h1 -+ -+ have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R -+ have h4 := lem_2R_sq_is_4R_sq hR_pos -+ rw [h4] at h3 -+ exact h3 -+ -+lemma lem_ineq_R_plus_r_sqM {M r R : ℝ} -+ (hM_pos : 0 < M) -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+4 * (R + r) ^ 2 * M < 16 * R ^ 2 * M := by -+ -+ have h_ineq := lem_ineq_R_plus_r_sq hr_pos hr_lt_R -+ -+ have h_4M_pos : 0 < 4 * M := by -+ apply mul_pos -+ · norm_num -+ · exact hM_pos -+ -+ have h_mult := mul_lt_mul_of_pos_right h_ineq h_4M_pos -+ -+ nlinarith [h_mult] -+ -+lemma lem_simplify_final_bound {M r R : ℝ} -+ (hM_pos : 0 < M) -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+(4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) < (16 * R ^ 2 * M) / ((R - r) ^ 3) := by -+ -+ have h_num_ineq := lem_ineq_R_plus_r_sqM hM_pos hr_pos hr_lt_R -+ -+ have h_denom_pos : 0 < (R - r) ^ 3 := by -+ apply pow_pos -+ linarith [hr_lt_R] -+ -+ exact div_lt_div_of_pos_right h_num_ineq h_denom_pos -+ -+lemma lem_bound_after_substitution {M r R : ℝ} -+ (hM_pos : 0 < M) -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) : -+ let r_prime := (r + R) / 2 -+(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) ≤ (16 * R ^ 2 * M) / ((R - r) ^ 3) := by -+ -+ dsimp only -+ -+ have h1 := lem_frac_simplify3 hM_pos hr_pos hr_lt_R -+ -+ dsimp only at h1 -+ rw [h1] -+ -+ have h2 := lem_simplify_final_bound hM_pos hr_pos hr_lt_R -+ -+ exact le_of_lt h2 -+ -+theorem borel_caratheodory_II {f : ℂ → ℂ} {R M r : ℝ} -+ (hR_pos : 0 < R) -+ (hM_pos : 0 < M) -+ (hr_pos : 0 < r) -+ (hr_lt_R : r < R) -+ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R ⊆ U ∧ DifferentiableOn ℂ f U) -+ (hf0 : f 0 = 0) -+ (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R, (f w).re ≤ M) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r) : -+norm (deriv f z) ≤ (16 * M * R ^ 2) / ((R - r) ^ 3) := by -+ -+ set r_prime := (r + R) / 2 -+ -+ have h_intermediate := lem_r_prime_is_intermediate hr_pos hr_lt_R -+ have h_r_lt_r_prime := h_intermediate.1 -+ have h_r_prime_lt_R := h_intermediate.2 -+ -+ have h_bound := lem_f_prime_bound hM_pos hR_pos hr_pos h_r_lt_r_prime h_r_prime_lt_R hf_domain hf0 hRe_f_le_M hz -+ -+ have h_final := lem_bound_after_substitution hM_pos hr_pos hr_lt_R -+ -+ have h_combined : norm (deriv f z) ≤ (16 * R ^ 2 * M) / ((R - r) ^ 3) := by -+ exact le_trans h_bound h_final -+ -+ convert h_combined using 1 -+ ring -+ -+open Complex MeasureTheory intervalIntegral -+open scoped Interval -+ -+noncomputable def If_taxicab -+ {r1 R R0: ℝ} -+ (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) -+ (f : ℂ → ℂ) -+ (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : -+ (Metric.closedBall (0 : ℂ) r1) → ℂ := -+ fun z => -+ (∫ t in (0 : ℝ)..z.1.re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.1.im, f ((z.1.re : ℂ) + Complex.I * τ)) -+ -+lemma def_If_z_plus_h -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, f (( (z + h).re : ℂ) + Complex.I * τ)) := by -+ rfl -+ -+lemma def_If_z -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ -+ = (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) := by -+ rfl -+ -+lemma def_If_w -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (_hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ -+ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) := by -+ simp [If_taxicab] -+ -+lemma continuous_vertical_line (a : ℂ) : -+ Continuous (fun τ : ℝ => ((a.re : ℂ) + Complex.I * (τ : ℂ))) := by -+ have hconst : Continuous (fun _ : ℝ => (a.re : ℂ)) := continuous_const -+ have hmul : Continuous (fun τ : ℝ => (Complex.I : ℂ) * (τ : ℂ)) := -+ continuous_const.mul Complex.continuous_ofReal -+ convert hconst.add hmul using 1 -+ -+lemma norm_re_add_I_mul_le_norm (a : ℂ) {τ : ℝ} (hτ : |τ| ≤ |a.im|) : -+ ‖((a.re : ℂ) + Complex.I * (τ : ℂ))‖ ≤ ‖a‖ := by -+ -+ set z1 : ℂ := ((a.re : ℂ) + Complex.I * (τ : ℂ)) with hz1 -+ -+ have hsq_z1 : ‖z1‖ ^ 2 = z1.re ^ 2 + z1.im ^ 2 := by -+ have hx : ‖z1‖ ^ 2 - z1.re ^ 2 = z1.im ^ 2 := Complex.sq_norm_sub_sq_re z1 -+ have hx' := congrArg (fun t : ℝ => t + z1.re ^ 2) hx -+ -+ have : ‖z1‖ ^ 2 = z1.im ^ 2 + z1.re ^ 2 := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hx' -+ simpa [add_comm] using this -+ have hsq_a : ‖a‖ ^ 2 = a.re ^ 2 + a.im ^ 2 := by -+ have hx : ‖a‖ ^ 2 - a.re ^ 2 = a.im ^ 2 := Complex.sq_norm_sub_sq_re a -+ have hx' := congrArg (fun t : ℝ => t + a.re ^ 2) hx -+ have : ‖a‖ ^ 2 = a.im ^ 2 + a.re ^ 2 := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hx' -+ simpa [add_comm] using this -+ -+ have hz1_re : z1.re = a.re := by -+ simp [hz1, mul_comm] -+ have hz1_im : z1.im = τ := by -+ simp [hz1, mul_comm] -+ -+ have hτ_sq : τ ^ 2 ≤ a.im ^ 2 := by -+ simpa using (sq_le_sq.mpr hτ) -+ -+ have hsq_le : ‖z1‖ ^ 2 ≤ ‖a‖ ^ 2 := by -+ have : a.re ^ 2 + τ ^ 2 ≤ a.re ^ 2 + a.im ^ 2 := add_le_add_right hτ_sq _ -+ simpa [hsq_z1, hz1_re, hz1_im, hsq_a] using this -+ -+ have hnonneg : 0 ≤ ‖a‖ := norm_nonneg _ -+ exact le_of_sq_le_sq hsq_le hnonneg -+ -+lemma closedBall_mono_center0 {r1 R : ℝ} (h : r1 ≤ R) : -+ Metric.closedBall (0 : ℂ) r1 ⊆ Metric.closedBall (0 : ℂ) R := by -+ intro z hz -+ have hz' : dist z (0 : ℂ) ≤ r1 := (Metric.mem_closedBall.mp hz) -+ exact Metric.mem_closedBall.mpr (le_trans hz' h) -+ -+lemma abs_le_abs_of_mem_uIcc_zero {b t : ℝ} (ht : t ∈ Set.uIcc (0 : ℝ) b) : |t| ≤ |b| := by -+ classical -+ by_cases hb : 0 ≤ b -+ · -+ have ht' : t ∈ Set.Icc (0 : ℝ) b := by -+ simpa [Set.uIcc_of_le hb] using ht -+ have ht0 : 0 ≤ t := ht'.1 -+ have htb : t ≤ b := ht'.2 -+ have htabs : |t| = t := abs_of_nonneg ht0 -+ have hbabs : |b| = b := abs_of_nonneg hb -+ simpa [htabs, hbabs] using htb -+ · -+ have ht' : t ∈ Set.Icc b 0 := by -+ simpa [Set.uIcc_of_not_le hb] using ht -+ have hb_le : b ≤ 0 := le_trans ht'.1 ht'.2 -+ have ht_le0 : t ≤ 0 := ht'.2 -+ have hbabs : |b| = -b := abs_of_nonpos hb_le -+ have htabs : |t| = -t := abs_of_nonpos ht_le0 -+ have hneg : -t ≤ -b := neg_le_neg ht'.1 -+ simpa [htabs, hbabs] using hneg -+ -+lemma vertical_intervalIntegrable_of_mem_ball -+ {r1 R R0 : ℝ} -+ (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {a : ℂ} -+ (ha : a ∈ Metric.closedBall (0 : ℂ) r1) : -+ IntervalIntegrable (fun τ : ℝ => f (((a.re : ℂ)) + Complex.I * τ)) volume (0 : ℝ) a.im := by -+ classical -+ -+ have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn -+ -+ let g : ℝ → ℂ := fun τ => ((a.re : ℂ) + Complex.I * (τ : ℂ)) -+ -+ have hg_cont : ContinuousOn g (Set.uIcc (0 : ℝ) a.im) := by -+ simpa [g] using (continuous_vertical_line a).continuousOn -+ -+ have hg_maps : Set.MapsTo g (Set.uIcc (0 : ℝ) a.im) (Metric.closedBall (0 : ℂ) R) := by -+ intro τ hτ -+ have hτabs : |τ| ≤ |a.im| := abs_le_abs_of_mem_uIcc_zero hτ -+ have hnorm_le_a : ‖g τ‖ ≤ ‖a‖ := by -+ simpa [g] using norm_re_add_I_mul_le_norm a hτabs -+ have ha_norm : ‖a‖ ≤ r1 := by -+ have : dist a (0 : ℂ) ≤ r1 := (Metric.mem_closedBall.mp ha) -+ simpa [dist_eq_norm] using this -+ have hnorm_le_r1 : ‖g τ‖ ≤ r1 := le_trans hnorm_le_a ha_norm -+ have hg_mem_r1 : g τ ∈ Metric.closedBall (0 : ℂ) r1 := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hnorm_le_r1 -+ exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) hg_mem_r1 -+ -+ have hcomp : ContinuousOn (fun τ : ℝ => f (g τ)) (Set.uIcc (0 : ℝ) a.im) := by -+ -+ convert (ContinuousOn.comp (hg := hf_cont) (hf := hg_cont) (h := hg_maps)) using 1; rfl -+ -+ have hInt : IntervalIntegrable (fun τ : ℝ => f (g τ)) volume (0 : ℝ) a.im := -+ ContinuousOn.intervalIntegrable (u := fun τ : ℝ => f (g τ)) (a := 0) (b := a.im) hcomp -+ simpa [g] using hInt -+ -+lemma helper_im_of_w (z h : ℂ) : (((((z + h).re : ℂ) + Complex.I * z.im)).im) = z.im := by -+ simp [Complex.add_im] -+ -+lemma helper_mul_sub_complex (x y : ℂ) : Complex.I * x - Complex.I * y = Complex.I * (x - y) := by -+ simp [mul_sub] -+ -+lemma helper_re_of_w (z h : ℂ) : (((((z + h).re : ℂ) + Complex.I * z.im)).re) = (z + h).re := by -+ simp -+ -+lemma diff_If_zh_w -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ -+ = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by -+ classical -+ intro w -+ -+ let g : ℝ → ℂ := fun τ => f (((z + h).re : ℂ) + Complex.I * τ) -+ -+ have hInt1 : IntervalIntegrable g volume (0 : ℝ) ((z + h).im) := by -+ simpa [g] using -+ (vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf (a := z + h) hzh) -+ have hInt2 : IntervalIntegrable g volume (0 : ℝ) (z.im) := by -+ have hInt2' : -+ IntervalIntegrable -+ (fun τ : ℝ => f (((( (((z + h).re : ℂ) + Complex.I * z.im)).re : ℂ)) + Complex.I * τ)) -+ volume (0 : ℝ) (((((z + h).re : ℂ) + Complex.I * z.im)).im) := -+ vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf -+ (a := (((z + h).re : ℂ) + Complex.I * z.im)) hw -+ simpa [g, helper_re_of_w z h, helper_im_of_w z h] using hInt2' -+ have hinterval : -+ ((∫ τ in (0 : ℝ)..(z + h).im, g τ) - ∫ τ in (0 : ℝ)..z.im, g τ) -+ = ∫ τ in z.im..(z + h).im, g τ := -+ intervalIntegral.integral_interval_sub_left (μ := volume) (f := g) hInt1 hInt2 -+ -+ have h1 : -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ) := by -+ have hzph := def_If_z_plus_h hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf (z := z) (h := h) hz hzh -+ simpa [g] using hzph -+ have h2 : -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ -+ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ) := by -+ have hwdef := def_If_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw -+ simpa [g, w] using hwdef -+ -+ calc -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ -+ = ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ)) -+ - ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ)) := by -+ simp [h1, h2] -+ _ = (Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ)) -+ - (Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ)) := by -+ simp [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] -+ _ = Complex.I * -+ ((∫ τ in (0 : ℝ)..(z + h).im, g τ) -+ - (∫ τ in (0 : ℝ)..z.im, g τ)) := by -+ simp [helper_mul_sub_complex] -+ _ = Complex.I * (∫ τ in z.im..(z + h).im, g τ) := by -+ simpa using congrArg (fun t => Complex.I * t) hinterval -+ _ = Complex.I * (∫ τ in z.im..(z + h).im, -+ f (((z + h).re : ℂ) + Complex.I * τ)) := by -+ simp [g] -+ -+lemma diff_If_w_z_initial_form_vertical -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ -+ = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by -+ simpa using -+ (diff_If_zh_w (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw) -+ -+lemma diff_If_w_z_initial_form -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im -+ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = (∫ t in z.re..w.re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (w.re + Complex.I * τ) - f (z.re + Complex.I * τ))) := by -+ intro w -+ -+ rw [def_If_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw] -+ rw [def_If_z hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz] -+ -+ have hw_re : w.re = (z + h).re := by simp [w] -+ have hw_im : w.im = z.im := by simp [w] -+ -+ have step1 : -+ ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ))) -+ - ((∫ t in (0 : ℝ)..z.re, f (t : ℂ)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) -+ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) - (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) -+ + Complex.I * ((∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) -+ - (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) := by ring -+ rw [step1] -+ -+ have horizontal_integrable_zh : IntervalIntegrable (fun t : ℝ => f (t : ℂ)) volume (0 : ℝ) (z + h).re := by -+ -+ apply ContinuousOn.intervalIntegrable -+ apply ContinuousOn.comp hf.continuousOn Complex.continuous_ofReal.continuousOn -+ intro t ht -+ simp [Metric.mem_closedBall, dist_eq_norm, Complex.norm_real] -+ -+ have : ‖z + h‖ ≤ r1 := by simp [← dist_zero_right]; exact Metric.mem_closedBall.mp hzh -+ have : |(z + h).re| ≤ ‖z + h‖ := Complex.abs_re_le_norm (z + h) -+ have : |t| ≤ |(z + h).re| := abs_le_abs_of_mem_uIcc_zero ht -+ linarith [le_of_lt hr1_lt_R] -+ -+ have horizontal_integrable_z : IntervalIntegrable (fun t : ℝ => f (t : ℂ)) volume (0 : ℝ) z.re := by -+ apply ContinuousOn.intervalIntegrable -+ apply ContinuousOn.comp hf.continuousOn Complex.continuous_ofReal.continuousOn -+ intro t ht -+ simp [Metric.mem_closedBall, dist_eq_norm, Complex.norm_real] -+ have : ‖z‖ ≤ r1 := by simp [← dist_zero_right]; exact Metric.mem_closedBall.mp hz -+ have : |z.re| ≤ ‖z‖ := Complex.abs_re_le_norm z -+ have : |t| ≤ |z.re| := abs_le_abs_of_mem_uIcc_zero ht -+ linarith [le_of_lt hr1_lt_R] -+ -+ have horizontal_eq : -+ (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) - (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) -+ = ∫ t in z.re..(z + h).re, f (t : ℂ) := by -+ rw [← intervalIntegral.integral_interval_sub_left horizontal_integrable_zh horizontal_integrable_z] -+ -+ have vertical_integrable_zh : IntervalIntegrable (fun τ : ℝ => f (((z + h).re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := by -+ -+ rw [← hw_re, ← hw_im] -+ exact vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hw -+ -+ have vertical_integrable_z : IntervalIntegrable (fun τ : ℝ => f ((z.re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := -+ vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz -+ -+ have vertical_eq : -+ (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) -+ - (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) -+ = ∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ)) := by -+ rw [← intervalIntegral.integral_sub vertical_integrable_zh vertical_integrable_z] -+ -+ rw [horizontal_eq, vertical_eq, hw_re] -+ -+lemma scalar_mul_integral_sub {a b : ℝ} (c : ℂ) (f g : ℝ → ℂ) -+ (hf : IntervalIntegrable f volume a b) (hg : IntervalIntegrable g volume a b) : -+ c * (∫ x in a..b, f x) - c * (∫ x in a..b, g x) = c * (∫ x in a..b, f x - g x) := by -+ rw [← mul_sub] -+ rw [← intervalIntegral.integral_sub hf hg] -+ -+lemma algebraic_rearrangement_four_terms (a b c d : ℂ) : -+ a - b + c - d = 0 → c - d = b - a := by -+ intro h -+ -+ calc c - d -+ = (a - b + c - d) - (a - b) := by ring -+ _ = 0 - (a - b) := by rw [h] -+ _ = -(a - b) := by ring -+ _ = b - a := by ring -+ -+lemma real_between_as_convex_combination (b₁ b₂ t : ℝ) -+ (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : -+ ∃ lam : ℝ, 0 ≤ lam ∧ lam ≤ 1 ∧ t = (1 - lam) * b₁ + lam * b₂ := by -+ -+ cases' le_total b₁ b₂ with h₁ h₂ -+ case inl => -+ -+ have ht : b₁ ≤ t ∧ t ≤ b₂ := by -+ cases' h with h_left h_right -+ · exact h_left -+ · -+ exact ⟨le_trans h₁ h_right.1, le_trans h_right.2 h₁⟩ -+ -+ by_cases heq : b₁ = b₂ -+ · -+ use 0 -+ constructor -+ · norm_num -+ constructor -+ · norm_num -+ · rw [heq] at ht ⊢ -+ have : t = b₂ := le_antisymm ht.2 ht.1 -+ rw [this] -+ ring -+ · -+ have hlt : b₁ < b₂ := lt_of_le_of_ne h₁ heq -+ let lam := (t - b₁) / (b₂ - b₁) -+ use lam -+ constructor -+ · -+ apply div_nonneg -+ · linarith [ht.1] -+ · linarith [hlt] -+ constructor -+ · -+ rw [div_le_iff₀] -+ · linarith [ht.2] -+ · linarith [hlt] -+ · -+ unfold lam -+ have h_nonzero : b₂ - b₁ ≠ 0 := ne_of_gt (sub_pos.2 hlt) -+ field_simp [h_nonzero]; ring -+ case inr => -+ -+ have ht : b₂ ≤ t ∧ t ≤ b₁ := by -+ cases' h with h_left h_right -+ · -+ exact ⟨le_trans h₂ h_left.1, le_trans h_left.2 h₂⟩ -+ · exact h_right -+ -+ by_cases heq : b₁ = b₂ -+ · -+ use 0 -+ constructor -+ · norm_num -+ constructor -+ · norm_num -+ · rw [← heq] at ht ⊢ -+ have : t = b₁ := le_antisymm ht.2 ht.1 -+ rw [this, heq] -+ ring -+ · -+ have hlt : b₂ < b₁ := lt_of_le_of_ne h₂ (Ne.symm heq) -+ let lam := (b₁ - t) / (b₁ - b₂) -+ use lam -+ constructor -+ · -+ apply div_nonneg -+ · linarith [ht.2] -+ · linarith [hlt] -+ constructor -+ · -+ rw [div_le_iff₀] -+ · linarith [ht.1] -+ · linarith [hlt] -+ · -+ unfold lam -+ have h_nonzero : b₁ - b₂ ≠ 0 := ne_of_gt (sub_pos.2 hlt) -+ field_simp [h_nonzero]; ring -+ -+lemma convex_combination_mem_segment {E : Type*} [AddCommGroup E] [Module ℝ E] (x y : E) (t : ℝ) -+ (h₀ : 0 ≤ t) (h₁ : t ≤ 1) : -+ (1 - t) • x + t • y ∈ segment ℝ x y := by -+ -+ use (1 - t), t -+ constructor -+ · -+ linarith [h₁] -+ constructor -+ · -+ exact h₀ -+ constructor -+ · -+ ring -+ · -+ rfl -+ -+lemma vertical_line_in_segment (a : ℂ) (b₁ b₂ t : ℝ) -+ (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : -+ a + Complex.I * t ∈ segment ℝ (a + Complex.I * b₁) (a + Complex.I * b₂) := by -+ -+ obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination b₁ b₂ t h -+ -+ have h_convex : a + Complex.I * t = (1 - lam) • (a + Complex.I * b₁) + lam • (a + Complex.I * b₂) := by -+ -+ simp only [Complex.real_smul] -+ -+ rw [h_t_eq] -+ -+ simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] -+ -+ rw [mul_add] -+ -+ ring -+ -+ rw [h_convex] -+ exact convex_combination_mem_segment (a + Complex.I * b₁) (a + Complex.I * b₂) lam h_lam_nonneg h_lam_le_one -+ -+lemma horizontal_line_in_segment (a : ℝ) (b₁ b₂ t : ℝ) -+ (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : -+ (t : ℂ) + Complex.I * a ∈ segment ℝ ((b₁ : ℂ) + Complex.I * a) ((b₂ : ℂ) + Complex.I * a) := by -+ -+ obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination b₁ b₂ t h -+ -+ have h_convex : (t : ℂ) + Complex.I * a -+ = (1 - lam) • ((b₁ : ℂ) + Complex.I * a) + lam • ((b₂ : ℂ) + Complex.I * a) := by -+ simp only [Complex.real_smul] -+ -+ rw [h_t_eq] -+ simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] -+ ring -+ -+ simpa [h_convex] using -+ (convex_combination_mem_segment ((b₁ : ℂ) + Complex.I * a) ((b₂ : ℂ) + Complex.I * a) lam h_lam_nonneg h_lam_le_one) -+ -+lemma intervalIntegrable_of_continuousOn_range (f : ℂ → ℂ) (g : ℝ → ℂ) (a b : ℝ) (S : Set ℂ) -+ (hf : ContinuousOn f S) (hg : Continuous g) -+ (hrange : ∀ t ∈ Set.uIcc a b, g t ∈ S) : -+ IntervalIntegrable (f ∘ g) volume a b := by -+ -+ have h_comp : ContinuousOn (f ∘ g) (Set.uIcc a b) := by -+ apply ContinuousOn.comp hf (hg.continuousOn) hrange -+ -+ exact h_comp.intervalIntegrable -+ -+lemma intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball -+ {r1 R : ℝ} (hr1_lt_R : r1 < R) {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {a : ℂ} {b₁ b₂ : ℝ} -+ (h₁ : ‖a + Complex.I * b₁‖ ≤ r1) (h₂ : ‖a + Complex.I * b₂‖ ≤ r1) : -+ IntervalIntegrable (fun t => f (a + Complex.I * t)) volume b₁ b₂ := by -+ -+ apply intervalIntegrable_of_continuousOn_range f (fun t => a + Complex.I * ↑t) b₁ b₂ (Metric.closedBall (0 : ℂ) R) -+ · -+ exact AnalyticOnNhd.continuousOn hf -+ · -+ exact Continuous.add continuous_const (Continuous.mul continuous_const continuous_ofReal) -+ · -+ intro t ht -+ -+ have h_in_r1 : ‖a + Complex.I * ↑t‖ ≤ r1 := by -+ -+ have h_segment : a + Complex.I * ↑t ∈ segment ℝ (a + Complex.I * b₁) (a + Complex.I * b₂) := by -+ apply vertical_line_in_segment -+ exact Set.mem_uIcc.mp ht -+ -+ have h₁_mem : a + Complex.I * b₁ ∈ Metric.closedBall (0 : ℂ) r1 := by -+ rwa [Metric.mem_closedBall, dist_zero_right] -+ have h₂_mem : a + Complex.I * b₂ ∈ Metric.closedBall (0 : ℂ) r1 := by -+ rwa [Metric.mem_closedBall, dist_zero_right] -+ -+ have h_subset := (convex_closedBall (0 : ℂ) r1).segment_subset h₁_mem h₂_mem -+ have h_in_ball := h_subset h_segment -+ rwa [Metric.mem_closedBall, dist_zero_right] at h_in_ball -+ -+ rw [Metric.mem_closedBall, dist_zero_right] -+ exact le_trans h_in_r1 (le_of_lt hr1_lt_R) -+ -+lemma cauchy_for_rectangles -+ {r1 R R0 : ℝ} -+ (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z w : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : w ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzw : ((w.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1) -+ (hwz : ((z.re : ℂ) + Complex.I * w.im) ∈ Metric.closedBall (0 : ℂ) r1) : -+ (∫ x in z.re..w.re, f ((x : ℂ) + Complex.I * (z.im))) -+ - (∫ x in z.re..w.re, f ((x : ℂ) + Complex.I * (w.im))) -+ + Complex.I * (∫ y in z.im..w.im, f ((w.re : ℂ) + Complex.I * y)) -+ - Complex.I * (∫ y in z.im..w.im, f ((z.re : ℂ) + Complex.I * y)) = 0 := by -+ classical -+ -+ have hA : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ -+ have hz_eq : z = (z.re : ℂ) + Complex.I * z.im := by -+ exact (lem_wReIm z) -+ rwa [← hz_eq] -+ have hC : ((w.re : ℂ) + Complex.I * w.im) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ -+ have hw_eq : w = (w.re : ℂ) + Complex.I * w.im := by -+ exact (lem_wReIm w) -+ rwa [← hw_eq] -+ -+ have h_left_in_ball : ∀ y ∈ Set.uIcc z.im w.im, -+ ((z.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ intro y hy -+ have hseg : (z.re : ℂ) + Complex.I * (y : ℂ) -+ ∈ segment ℝ ((z.re : ℂ) + Complex.I * z.im) ((z.re : ℂ) + Complex.I * w.im) := by -+ simpa using vertical_line_in_segment (a := (z.re : ℂ)) (b₁ := z.im) (b₂ := w.im) (t := y) -+ (h := Set.mem_uIcc.mp hy) -+ exact (convex_closedBall (0 : ℂ) r1).segment_subset hA hwz hseg -+ have h_right_in_ball : ∀ y ∈ Set.uIcc z.im w.im, -+ ((w.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ intro y hy -+ have hseg : (w.re : ℂ) + Complex.I * (y : ℂ) -+ ∈ segment ℝ ((w.re : ℂ) + Complex.I * z.im) ((w.re : ℂ) + Complex.I * w.im) := by -+ simpa using vertical_line_in_segment (a := (w.re : ℂ)) (b₁ := z.im) (b₂ := w.im) (t := y) -+ (h := Set.mem_uIcc.mp hy) -+ exact (convex_closedBall (0 : ℂ) r1).segment_subset hzw hC hseg -+ have h_point_in_ball : ∀ x ∈ Set.uIcc z.re w.re, ∀ y ∈ Set.uIcc z.im w.im, -+ ((x : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ intro x hx y hy -+ have hL : ((z.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := h_left_in_ball y hy -+ have hR' : ((w.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := h_right_in_ball y hy -+ -+ obtain ⟨lam, hlam0, hlam1, hx_eq⟩ := real_between_as_convex_combination z.re w.re x (Set.mem_uIcc.mp hx) -+ have hseg_horiz : (x : ℂ) + Complex.I * (y : ℂ) -+ ∈ segment ℝ ((z.re : ℂ) + Complex.I * (y : ℂ)) ((w.re : ℂ) + Complex.I * (y : ℂ)) := by -+ -+ have : (x : ℂ) + Complex.I * (y : ℂ) -+ = (1 - lam) • ((z.re : ℂ) + Complex.I * (y : ℂ)) + lam • ((w.re : ℂ) + Complex.I * (y : ℂ)) := by -+ simp only [Complex.real_smul] -+ -+ rw [hx_eq] -+ simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] -+ ring -+ simpa [this] using -+ (convex_combination_mem_segment ((z.re : ℂ) + Complex.I * (y : ℂ)) ((w.re : ℂ) + Complex.I * (y : ℂ)) lam hlam0 hlam1) -+ exact (convex_closedBall (0 : ℂ) r1).segment_subset hL hR' hseg_horiz -+ -+ set S := ([[z.re, w.re]] ×ℂ [[z.im, w.im]]) -+ have hS_subset_r1 : S ⊆ Metric.closedBall (0 : ℂ) r1 := by -+ intro p hp -+ have hx : p.re ∈ [[z.re, w.re]] := hp.1 -+ have hy : p.im ∈ [[z.im, w.im]] := hp.2 -+ -+ have : ((p.re : ℂ) + Complex.I * (p.im : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := -+ h_point_in_ball p.re hx p.im hy -+ -+ have hp_eq : p = (p.re : ℂ) + Complex.I * (p.im : ℂ) := lem_wReIm p -+ rwa [hp_eq] -+ have hS_subset_R : S ⊆ Metric.closedBall (0 : ℂ) R := -+ fun p hp => (closedBall_mono_center0 (le_of_lt hr1_lt_R)) (hS_subset_r1 hp) -+ -+ have Hdiff : DifferentiableOn ℂ f S := by -+ intro p hp -+ have hpR : p ∈ Metric.closedBall (0 : ℂ) R := hS_subset_R hp -+ exact (hf p hpR).differentiableAt.differentiableWithinAt -+ -+ simpa [smul_eq_mul, mul_comm] using -+ Complex.integral_boundary_rect_eq_zero_of_differentiableOn f z w Hdiff -+ -+lemma cauchy_for_horizontal_strip -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ (∫ t in z.re..(z + h).re, f (t : ℂ)) -+ - (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) -+ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) -+ - Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) = 0 := by -+ -+ let z₀ : ℂ := (z.re : ℂ) -+ let w₀ : ℂ := (z + h).re + Complex.I * z.im -+ -+ have hz₀ : z₀ ∈ Metric.closedBall (0 : ℂ) r1 := by -+ have hz_norm : ‖z‖ ≤ r1 := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hz -+ have hzre_le : ‖(z.re : ℂ)‖ ≤ ‖z‖ := by -+ rw [Complex.norm_real] -+ exact Complex.abs_re_le_norm z -+ have : ‖z₀‖ ≤ r1 := le_trans hzre_le hz_norm -+ simpa [z₀, Metric.mem_closedBall, dist_eq_norm] using this -+ have hw₀ : w₀ ∈ Metric.closedBall (0 : ℂ) r1 := hw -+ -+ have hzw : ((w₀.re : ℂ) + Complex.I * z₀.im) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ -+ have h1 : ((w₀.re : ℂ) + Complex.I * z₀.im) = ((z + h).re : ℂ) := by -+ simp [w₀, z₀, Complex.ofReal_im, mul_zero, add_zero] -+ rw [h1] -+ have h2 : ‖((z + h).re : ℂ)‖ ≤ ‖z + h‖ := by -+ rw [Complex.norm_real] -+ exact Complex.abs_re_le_norm (z + h) -+ have h3 : ‖z + h‖ ≤ r1 := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hzh -+ simpa [Metric.mem_closedBall, dist_eq_norm] using le_trans h2 h3 -+ have hwz : ((z₀.re : ℂ) + Complex.I * w₀.im) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ -+ have h1 : ((z₀.re : ℂ) + Complex.I * w₀.im) = z := by -+ simp [z₀, w₀, Complex.ofReal_re] -+ exact (lem_wReIm z).symm -+ rw [h1] -+ exact hz -+ -+ have H := cauchy_for_rectangles (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz₀ hw₀ hzw hwz -+ -+ rw [(show z₀.re = z.re by simp [z₀])] at H -+ rw [(show z₀.im = (0 : ℝ) by simp [z₀])] at H -+ rw [(show w₀.re = (z + h).re by simp [w₀])] at H -+ rw [(show w₀.im = z.im by simp [w₀])] at H -+ -+ convert H using 1 -+ simp only [Complex.ofReal_zero, mul_zero, add_zero] -+ -+lemma integrability_from_cauchy_horizontal_strip -+ {r1 R R0 : ℝ} (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) r1) (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ IntervalIntegrable (fun τ => f (((z + h).re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im ∧ -+ IntervalIntegrable (fun τ => f ((z.re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := by -+ constructor -+ · -+ apply intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball hr1_lt_R hf -+ · -+ simp only [Complex.ofReal_zero, mul_zero, add_zero, Complex.norm_real] -+ rw [Metric.mem_closedBall, dist_zero_right] at hzh -+ exact le_trans (Complex.abs_re_le_norm (z + h)) hzh -+ · -+ rw [Metric.mem_closedBall, dist_zero_right] at hw -+ exact hw -+ · -+ apply intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball hr1_lt_R hf -+ · -+ simp only [Complex.ofReal_zero, mul_zero, add_zero, Complex.norm_real] -+ rw [Metric.mem_closedBall, dist_zero_right] at hz -+ exact le_trans (Complex.abs_re_le_norm z) hz -+ · -+ rw [Metric.mem_closedBall, dist_zero_right] at hz -+ rw [← lem_wReIm z] -+ exact hz -+ -+lemma cauchy_rearrangement_step1 -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ))) -+ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) - (∫ t in z.re..(z + h).re, f (t : ℂ)) := by -+ -+ have H := cauchy_for_horizontal_strip hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw -+ -+ have integrable := integrability_from_cauchy_horizontal_strip hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw -+ -+ have rearrange := algebraic_rearrangement_four_terms -+ (∫ t in z.re..(z + h).re, f (t : ℂ)) -+ (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) -+ (Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ))) -+ (Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) -+ H -+ -+ have vertical_linearity : -+ Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) -+ - Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) -+ = Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ))) := by -+ rw [← mul_sub] -+ rw [← intervalIntegral.integral_sub integrable.1 integrable.2] -+ -+ rw [← vertical_linearity] -+ exact rearrange -+ -+lemma diff_If_w_z -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ -+ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) := by -+ -+ have initial_form := diff_If_w_z_initial_form hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw -+ -+ have rearrange_step := cauchy_rearrangement_step1 hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw -+ -+ have w_re_eq : (((z + h).re : ℂ) + Complex.I * z.im).re = (z + h).re := by -+ simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im, Complex.ofReal_im] -+ -+ simp_rw [initial_form, w_re_eq, rearrange_step] -+ -+ ring -+ -+lemma If_difference_is_L_path_integral -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) -+ + Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by -+ -+ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im -+ -+ calc If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ -+ = (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩) -+ + (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) := by ring -+ _ = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) -+ + (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) := by -+ rw [diff_If_zh_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw, -+ diff_If_w_z hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw] -+ _ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) -+ + Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by ring -+ -+lemma If_diff_add_sub_identity -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = -+ (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z) + f z) -+ + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z) + f z) := by -+ -+ have H := -+ If_difference_is_L_path_integral (hr1_pos) (hr1_lt_R) (hR_lt_R0) (hR0_lt_one) hf hz hzh hw -+ simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using H -+ -+lemma intervalIntegrable_of_analyticOnNhd_of_horizontal_endpoints_in_smaller_ball -+ {r1 R : ℝ} (hr1_lt_R : r1 < R) {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {im_part : ℝ} {a b : ℝ} -+ (h₁ : ‖(a : ℂ) + Complex.I * im_part‖ ≤ r1) (h₂ : ‖(b : ℂ) + Complex.I * im_part‖ ≤ r1) : -+ IntervalIntegrable (fun t => f ((t : ℂ) + Complex.I * im_part)) volume a b := by -+ -+ apply intervalIntegrable_of_continuousOn_range f (fun t => (t : ℂ) + Complex.I * im_part) a b (Metric.closedBall (0 : ℂ) R) -+ · -+ exact AnalyticOnNhd.continuousOn hf -+ · -+ exact Continuous.add continuous_ofReal continuous_const -+ · -+ intro t ht -+ -+ have h_in_r1 : ‖(t : ℂ) + Complex.I * im_part‖ ≤ r1 := by -+ -+ have h_segment : (t : ℂ) + Complex.I * im_part ∈ segment ℝ ((a : ℂ) + Complex.I * im_part) ((b : ℂ) + Complex.I * im_part) := by -+ -+ obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination a b t (Set.mem_uIcc.mp ht) -+ -+ have h_convex : (t : ℂ) + Complex.I * im_part = (1 - lam) • ((a : ℂ) + Complex.I * im_part) + lam • ((b : ℂ) + Complex.I * im_part) := by -+ -+ simp only [Complex.real_smul] -+ -+ rw [h_t_eq] -+ -+ simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] -+ -+ ring -+ -+ rw [h_convex] -+ exact convex_combination_mem_segment ((a : ℂ) + Complex.I * im_part) ((b : ℂ) + Complex.I * im_part) lam h_lam_nonneg h_lam_le_one -+ -+ have h₁_mem : (a : ℂ) + Complex.I * im_part ∈ Metric.closedBall (0 : ℂ) r1 := by -+ rwa [Metric.mem_closedBall, dist_zero_right] -+ have h₂_mem : (b : ℂ) + Complex.I * im_part ∈ Metric.closedBall (0 : ℂ) r1 := by -+ rwa [Metric.mem_closedBall, dist_zero_right] -+ -+ have h_subset := (convex_closedBall (0 : ℂ) r1).segment_subset h₁_mem h₂_mem -+ have h_in_ball := h_subset h_segment -+ rwa [Metric.mem_closedBall, dist_zero_right] at h_in_ball -+ -+ rw [Metric.mem_closedBall, dist_zero_right] -+ exact le_trans h_in_r1 (le_of_lt hr1_lt_R) -+ -+lemma If_diff_linearity -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = -+ ((∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) -+ + (∫ _t in z.re..(z + h).re, f z)) -+ + Complex.I * -+ ((∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) -+ + (∫ _τ in z.im..(z + h).im, f z)) := by -+ -+ have H := If_diff_add_sub_identity hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw -+ -+ have hz_norm : ‖z‖ ≤ r1 := by rwa [Metric.mem_closedBall, dist_zero_right] at hz -+ have hzh_norm : ‖z + h‖ ≤ r1 := by rwa [Metric.mem_closedBall, dist_zero_right] at hzh -+ have hw_norm : ‖((z + h).re : ℂ) + Complex.I * z.im‖ ≤ r1 := by -+ rwa [Metric.mem_closedBall, dist_zero_right] at hw -+ -+ have h_z_eq : z = (z.re : ℂ) + Complex.I * z.im := lem_wReIm z -+ have h_zh_eq : z + h = ((z + h).re : ℂ) + Complex.I * (z + h).im := lem_wReIm (z + h) -+ -+ have hz_endpoint : ‖(z.re : ℂ) + Complex.I * z.im‖ ≤ r1 := by rwa [← h_z_eq] -+ have h_horiz_integrable := intervalIntegrable_of_analyticOnNhd_of_horizontal_endpoints_in_smaller_ball -+ hr1_lt_R hf hz_endpoint hw_norm -+ -+ have hzh_endpoint : ‖((z + h).re : ℂ) + Complex.I * (z + h).im‖ ≤ r1 := by rwa [← h_zh_eq] -+ have h_vert_integrable := intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball -+ hr1_lt_R hf hw_norm hzh_endpoint -+ -+ have h_const_horiz : IntervalIntegrable (fun _ => f z) volume z.re (z + h).re := intervalIntegrable_const -+ have h_const_vert : IntervalIntegrable (fun _ => f z) volume z.im (z + h).im := intervalIntegrable_const -+ -+ have h_diff_horiz : IntervalIntegrable (fun t => f (t + Complex.I * z.im) - f z) volume z.re (z + h).re := -+ IntervalIntegrable.sub h_horiz_integrable h_const_horiz -+ -+ have h_diff_vert : IntervalIntegrable (fun τ => f (((z + h).re : ℂ) + Complex.I * τ) - f z) volume z.im (z + h).im := -+ IntervalIntegrable.sub h_vert_integrable h_const_vert -+ -+ have h1 : ∫ t in z.re..(z + h).re, ((f (t + Complex.I * z.im) - f z) + f z) = -+ (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) + (∫ t in z.re..(z + h).re, f z) := -+ intervalIntegral.integral_add h_diff_horiz h_const_horiz -+ -+ have h2 : ∫ τ in z.im..(z + h).im, ((f (((z + h).re : ℂ) + Complex.I * τ) - f z) + f z) = -+ (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) + (∫ τ in z.im..(z + h).im, f z) := -+ intervalIntegral.integral_add h_diff_vert h_const_vert -+ -+ rw [H, h1, h2, mul_add] -+ -+lemma integral_of_constant_over_L_path -+ {r1 R R0 : ℝ} -+ (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (_hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : -+ (∫ _t in z.re..(z + h).re, f z) + Complex.I * (∫ _τ in z.im..(z + h).im, f z) -+ = f z * h := by -+ -+ rw [intervalIntegral.integral_const, intervalIntegral.integral_const] -+ -+ rw [Complex.add_re, Complex.add_im] -+ simp only [add_sub_cancel_left] -+ -+ rw [Complex.real_smul, Complex.real_smul] -+ -+ rw [← mul_assoc] -+ -+ rw [← add_mul] -+ -+ rw [mul_comm Complex.I (↑h.im)] -+ -+ rw [Complex.re_add_im h] -+ -+ rw [mul_comm] -+ -+noncomputable def Err -+ {r1 R R0 : ℝ} -+ (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) -+ (f : ℂ → ℂ) -+ (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ (z h : ℂ) : ℂ := -+ (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) -+ + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) -+ -+lemma CD_eq_fz_h -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : -+ (∫ _t in z.re..(z + h).re, f z) + Complex.I * (∫ _τ in z.im..(z + h).im, f z) -+ = f z * h := by -+ simpa using -+ integral_of_constant_over_L_path (r1:=r1) (R:=R) (R0:=R0) -+ hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh -+ -+lemma If_diff_decomposition_final -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = f z * h -+ + Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h := by -+ -+ have H := -+ If_diff_linearity (hr1_pos) (hr1_lt_R) (hR_lt_R0) (hR0_lt_one) -+ (f := f) (hf := hf) -+ (z := z) (h := h) -+ (hz := hz) (hzh := hzh) (hw := hw) -+ -+ let A : ℂ := ∫ t in z.re..(z + h).re, f (t + Complex.I * z.im) - f z -+ let B : ℂ := ∫ t in z.re..(z + h).re, f z -+ let C : ℂ := ∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ) - f z -+ let D : ℂ := ∫ τ in z.im..(z + h).im, f z -+ -+ have hH' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = (A + B) + Complex.I * (C + D) := by -+ simpa [A, B, C, D, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using H -+ -+ have hsplit : (A + B) + Complex.I * (C + D) -+ = (A + Complex.I * C) + (B + Complex.I * D) := by ring -+ have hH'' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = (A + Complex.I * C) + (B + Complex.I * D) := by -+ simpa [hsplit] using hH' -+ -+ have hBD : (B + Complex.I * D) = f z * h := by -+ simpa [B, D] using -+ integral_of_constant_over_L_path (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh -+ have hH''' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = (A + Complex.I * C) + f z * h := by -+ simpa [hBD] using hH'' -+ -+ have hH4 : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ -+ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) -+ = Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h + f z * h := by -+ simpa [Err, A, C, add_comm, add_left_comm, add_assoc] using hH''' -+ -+ simpa [Err, add_comm, add_left_comm, add_assoc] using hH4 -+ -+noncomputable def S_horiz (z h : ℂ) (f : ℂ → ℂ) : ℝ := -+ sSup {r | ∃ t ∈ Set.uIcc z.re (z + h).re, -+ r = ‖f (t + Complex.I * z.im) - f z‖} -+ -+noncomputable def S_vert (z h : ℂ) (f : ℂ → ℂ) : ℝ := -+ sSup {r | ∃ τ ∈ Set.uIcc z.im (z + h).im, -+ r = ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖} -+ -+noncomputable def S_max (z h : ℂ) (f : ℂ → ℂ) : ℝ := -+ max (S_horiz z h f) (S_vert z h f) -+ -+lemma bound_on_Err -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : -+ ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h‖ -+ ≤ |h.re| * S_max z h f + |h.im| * S_max z h f := by -+ -+ unfold Err -+ -+ have hsplit : -+ ‖(∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) -+ + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ -+ ≤ ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ -+ + ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ := -+ norm_add_le _ _ -+ -+ have hI : ‖Complex.I‖ = (1 : ℝ) := by simp -+ have hvertnorm : -+ ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ -+ = ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ := by -+ simp [hI, one_mul] -+ -+ set SH : Set ℝ := {r | ∃ t ∈ Set.uIcc z.re (z + h).re, -+ r = ‖f (t + Complex.I * z.im) - f z‖} -+ have hbdd_SH : BddAbove SH := by -+ classical -+ -+ have hK : IsCompact (Set.uIcc z.re (z + h).re) := isCompact_uIcc -+ -+ let γ : ℝ → ℂ := fun t => (t : ℂ) + Complex.I * z.im -+ have hγ_cont : Continuous γ := by -+ convert (Complex.continuous_ofReal.add (continuous_const (y := Complex.I * (z.im : ℂ)))) using 1 -+ have hz_mem : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ simp only [Metric.mem_closedBall, dist_zero_right] -+ rw [show (z.re : ℂ) + Complex.I * z.im = z.re + z.im * Complex.I by ring] -+ rw [Complex.re_add_im] -+ rwa [Metric.mem_closedBall, dist_zero_right] at hz -+ have hw_mem : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hw -+ have hseg_subset : -+ (γ '' Set.uIcc z.re (z + h).re) ⊆ Metric.closedBall (0 : ℂ) r1 := by -+ intro w hwim -+ rcases hwim with ⟨t, ht, rfl⟩ -+ -+ have hseg : ((t : ℂ) + Complex.I * z.im) -+ ∈ segment ℝ ((z.re : ℂ) + Complex.I * z.im) -+ (((z + h).re : ℂ) + Complex.I * z.im) := by -+ -+ have := horizontal_line_in_segment (a := z.im) (b₁ := z.re) (b₂ := (z + h).re) -+ (t := t) (by simpa [Set.mem_uIcc] using ht) -+ simpa using this -+ have hz_in : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := hz_mem -+ have hw_in : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := hw_mem -+ have hsubset := (convex_closedBall (0 : ℂ) r1).segment_subset hz_in hw_in -+ have hw' := hsubset hseg -+ simpa [Metric.mem_closedBall, dist_zero_right] using hw' -+ have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn -+ -+ have hmaps : Set.MapsTo γ (Set.uIcc z.re (z + h).re) (Metric.closedBall (0 : ℂ) R) := by -+ intro t ht -+ have himg_r1 : γ t ∈ Metric.closedBall (0 : ℂ) r1 := by -+ exact hseg_subset (Set.mem_image_of_mem _ ht) -+ exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) himg_r1 -+ have hcont_on : ContinuousOn (fun t => f (γ t)) (Set.uIcc z.re (z + h).re) := by -+ convert (ContinuousOn.comp (hf_cont) (hγ_cont.continuousOn) hmaps) using 1; rfl -+ -+ have hψ : Continuous (fun w : ℂ => ‖w - f z‖) := -+ (continuous_id.sub continuous_const).norm -+ have hR_cont : ContinuousOn (fun t => ‖f (γ t) - f z‖) (Set.uIcc z.re (z + h).re) := by -+ -+ have h_cont_sub : ContinuousOn (fun t => f (γ t) - f z) (Set.uIcc z.re (z + h).re) := -+ hcont_on.sub continuousOn_const -+ -+ exact h_cont_sub.norm -+ -+ have himage_compact : IsCompact ((fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re) := -+ IsCompact.image_of_continuousOn hK hR_cont -+ -+ have hSH_eq : SH = (fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re := by -+ ext r; constructor -+ · intro hr; rcases hr with ⟨t, ht, rfl⟩; exact ⟨t, ht, rfl⟩ -+ · intro hr; rcases hr with ⟨t, ht, rfl⟩; exact ⟨t, ht, rfl⟩ -+ -+ have : BddAbove ((fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re) := -+ himage_compact.bddAbove -+ simpa [hSH_eq] using this -+ -+ set SV : Set ℝ := {r | ∃ τ ∈ Set.uIcc z.im (z + h).im, -+ r = ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖} -+ have hbdd_SV : BddAbove SV := by -+ classical -+ -+ have hK : IsCompact (Set.uIcc z.im (z + h).im) := isCompact_uIcc -+ let γv : ℝ → ℂ := fun τ => ((z + h).re : ℂ) + Complex.I * τ -+ have hγv_cont : Continuous γv := by -+ have hmul : Continuous (fun τ : ℝ => Complex.I * (τ : ℂ)) := by -+ exact continuous_const.mul Complex.continuous_ofReal -+ simp only [γv] -+ exact continuous_const.add hmul -+ have hw_mem' : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ simpa [Metric.mem_closedBall, dist_zero_right] using hw -+ have hzh_mem : (((z + h).re : ℂ) + Complex.I * (z + h).im) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ simp only [Metric.mem_closedBall, dist_zero_right] -+ rw [show ((z + h).re : ℂ) + Complex.I * (z + h).im = (z + h).re + (z + h).im * Complex.I by ring] -+ rw [Complex.re_add_im] -+ rwa [Metric.mem_closedBall, dist_zero_right] at hzh -+ have hseg_subset : -+ (γv '' Set.uIcc z.im (z + h).im) ⊆ Metric.closedBall (0 : ℂ) r1 := by -+ intro w hwim; rcases hwim with ⟨τ, hτ, rfl⟩ -+ have hseg : (((z + h).re : ℂ) + Complex.I * τ) -+ ∈ segment ℝ (((z + h).re : ℂ) + Complex.I * z.im) -+ (((z + h).re : ℂ) + Complex.I * (z + h).im) := by -+ have := vertical_line_in_segment (((z + h).re : ℂ)) (b₁ := z.im) (b₂ := (z + h).im) (t := τ) -+ (by simpa [Set.mem_uIcc] using hτ) -+ simpa using this -+ have hz_in := hw_mem' -+ have hw_in := hzh_mem -+ have hsubset := (convex_closedBall (0 : ℂ) r1).segment_subset hz_in hw_in -+ have hw' := hsubset hseg -+ simp only [Metric.mem_closedBall, dist_zero_right] at hw' -+ rwa [Metric.mem_closedBall, dist_zero_right] -+ have hmaps : Set.MapsTo γv (Set.uIcc z.im (z + h).im) (Metric.closedBall (0 : ℂ) R) := by -+ intro τ hτ; have : γv τ ∈ Metric.closedBall (0 : ℂ) r1 := hseg_subset (Set.mem_image_of_mem _ hτ) -+ exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) this -+ have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn -+ have hcont_on : ContinuousOn (fun τ => f (γv τ)) (Set.uIcc z.im (z + h).im) := by -+ convert (ContinuousOn.comp (hf_cont) (hγv_cont.continuousOn) hmaps) using 1; rfl -+ have hψ : Continuous (fun w : ℂ => ‖w - f z‖) := -+ (continuous_id.sub continuous_const).norm -+ have hR_cont : ContinuousOn (fun τ => ‖f (γv τ) - f z‖) (Set.uIcc z.im (z + h).im) := by -+ have h1 : ContinuousOn (fun τ => f (γv τ) - f z) (Set.uIcc z.im (z + h).im) := by -+ exact hcont_on.sub continuousOn_const -+ exact h1.norm -+ have himage_compact : IsCompact ((fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im) := -+ IsCompact.image_of_continuousOn hK hR_cont -+ have hSV_eq : SV = (fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im := by -+ ext r; constructor -+ · intro hr; rcases hr with ⟨τ, hτ, rfl⟩; exact ⟨τ, hτ, rfl⟩ -+ · intro hr; rcases hr with ⟨τ, hτ, rfl⟩; exact ⟨τ, hτ, rfl⟩ -+ have : BddAbove ((fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im) := -+ himage_compact.bddAbove -+ simpa [hSV_eq] using this -+ -+ have hC_horiz : ∀ t ∈ Set.uIcc z.re (z + h).re, -+ ‖(f (t + Complex.I * z.im) - f z)‖ ≤ S_horiz z h f := by -+ intro t ht -+ have hx : ‖f (t + Complex.I * z.im) - f z‖ ∈ SH := ⟨t, ht, rfl⟩ -+ -+ have : S_horiz z h f = sSup SH := rfl -+ simpa [this] using (le_csSup hbdd_SH hx) -+ -+ have hC_vert : ∀ τ ∈ Set.uIcc z.im (z + h).im, -+ ‖(f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ ≤ S_vert z h f := by -+ intro τ hτ -+ have hx : ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖ ∈ SV := ⟨τ, hτ, rfl⟩ -+ have : S_vert z h f = sSup SV := rfl -+ simpa [this] using (le_csSup hbdd_SV hx) -+ -+ have hH : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ -+ ≤ |(z + h).re - z.re| * S_horiz z h f := by -+ -+ have h_bound : ∀ t, t ∈ [[z.re, (z + h).re]] → ‖f (↑t + Complex.I * ↑z.im) - f z‖ ≤ S_horiz z h f := by -+ intro t ht; exact hC_horiz t ht -+ have h_int : ∀ t ∈ Ι z.re (z + h).re, ‖f (↑t + Complex.I * ↑z.im) - f z‖ ≤ S_horiz z h f := by -+ intro t ht -+ have ht_uIcc : t ∈ Set.uIcc z.re (z + h).re := by -+ -+ exact Set.uIoc_subset_uIcc ht -+ exact h_bound t ht_uIcc -+ have := intervalIntegral.norm_integral_le_of_norm_le_const h_int -+ convert this using 1 -+ ring -+ -+ have hV : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ -+ ≤ |(z + h).im - z.im| * S_vert z h f := by -+ have h_bound : ∀ τ, τ ∈ [[z.im, (z + h).im]] → ‖f (↑(z + h).re + Complex.I * ↑τ) - f z‖ ≤ S_vert z h f := by -+ intro τ hτ; exact hC_vert τ hτ -+ have h_int : ∀ τ ∈ Ι z.im (z + h).im, ‖f (↑(z + h).re + Complex.I * ↑τ) - f z‖ ≤ S_vert z h f := by -+ intro τ hτ -+ have hτ_uIcc : τ ∈ Set.uIcc z.im (z + h).im := by -+ -+ exact Set.uIoc_subset_uIcc hτ -+ exact h_bound τ hτ_uIcc -+ have := intervalIntegral.norm_integral_le_of_norm_le_const h_int -+ rwa [mul_comm] at this -+ -+ have hre' : (z + h).re - z.re = h.re := by -+ simp [Complex.add_re] -+ have him' : (z + h).im - z.im = h.im := by -+ simp [Complex.add_im] -+ have hre : |(z + h).re - z.re| = |h.re| := by simp -+ have him : |(z + h).im - z.im| = |h.im| := by simp -+ -+ have hH' : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ -+ ≤ |h.re| * S_max z h f := by -+ have : S_horiz z h f ≤ S_max z h f := by exact le_max_left _ _ -+ -+ have hH_rewritten : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ ≤ |h.re| * S_horiz z h f := by -+ rwa [hre] at hH -+ -+ have h_bound := mul_le_mul_of_nonneg_left this (abs_nonneg (h.re)) -+ exact le_trans hH_rewritten h_bound -+ -+ have hV' : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ -+ ≤ |h.im| * S_max z h f := by -+ have : S_vert z h f ≤ S_max z h f := by exact le_max_right _ _ -+ -+ have hV_rewritten : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ ≤ |h.im| * S_vert z h f := by -+ rwa [him] at hV -+ -+ have h_bound := mul_le_mul_of_nonneg_left this (abs_nonneg (h.im)) -+ exact le_trans hV_rewritten h_bound -+ -+ have := -+ calc -+ ‖(∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) -+ + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ -+ ≤ ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ -+ + ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ := hsplit -+ _ = ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ -+ + ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ := by simp -+ _ ≤ |h.re| * S_max z h f + |h.im| * S_max z h f := add_le_add hH' hV' -+ -+ simpa [Err] using this -+ -+lemma S_horiz_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_horiz z h f := by -+ -+ unfold S_horiz -+ apply Real.sSup_nonneg -+ intro r hr; rcases hr with ⟨t, ht, rfl⟩; exact norm_nonneg _ -+ -+lemma S_max_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_max z h f := by -+ unfold S_max -+ have h1 : 0 ≤ S_horiz z h f := S_horiz_nonneg z h f -+ exact le_trans h1 (le_max_left _ _) -+ -+lemma bound_on_Err_ratio -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) -+ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) -+ (hh : h ≠ 0) : -+ ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ ≤ 2 * S_max z h f := by -+ -+ have h_abs_eq : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ = ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ := rfl -+ -+ have h1 := bound_on_Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw -+ -+ rw [← add_mul] at h1 -+ -+ have h_norm_pos : 0 < ‖h‖ := norm_pos_iff.mpr hh -+ -+ have h2 : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h‖ / ‖h‖ ≤ -+ (|h.re| + |h.im|) * S_max z h f / ‖h‖ := by -+ exact div_le_div_of_nonneg_right h1 (le_of_lt h_norm_pos) -+ -+ rw [← norm_div] at h2 -+ -+ have h2' : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ ≤ -+ (|h.re| + |h.im|) / ‖h‖ * S_max z h f := by -+ rw [← div_mul_eq_mul_div] at h2 -+ exact h2 -+ -+ have h3 : |h.re| + |h.im| ≤ 2 * ‖h‖ := by -+ -+ calc |h.re| + |h.im| -+ ≤ ‖h‖ + ‖h‖ := add_le_add (Complex.abs_re_le_norm h) (Complex.abs_im_le_norm h) -+ _ = 2 * ‖h‖ := by ring -+ -+ have h4 : (|h.re| + |h.im|) / ‖h‖ ≤ 2 := by -+ -+ rw [div_le_iff₀ h_norm_pos] -+ exact h3 -+ -+ calc ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ -+ ≤ (|h.re| + |h.im|) / ‖h‖ * S_max z h f := h2' -+ _ ≤ 2 * S_max z h f := mul_le_mul_of_nonneg_right h4 (S_max_nonneg z h f) -+open Filter Topology -+ -+lemma abs_horizontal_diff_eq_abs_real (z : ℂ) (t : ℝ) : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := by -+ -+ have h : (t : ℂ) + Complex.I * z.im - z = (t - z.re : ℂ) := by -+ apply Complex.ext_iff.mpr -+ constructor -+ · -+ simp only [Complex.add_re, Complex.sub_re, Complex.ofReal_re, Complex.mul_re, -+ Complex.I_re, Complex.I_im, Complex.ofReal_im] -+ ring -+ · -+ simp only [Complex.add_im, Complex.sub_im, Complex.ofReal_im, Complex.mul_im, -+ Complex.I_re, Complex.I_im, Complex.ofReal_re] -+ ring -+ -+ rw [h] -+ -+ rw [← Complex.ofReal_sub] -+ -+ rw [Complex.norm_real, Real.norm_eq_abs] -+ -+lemma abs_sub_le_of_mem_uIcc (a b t : ℝ) (ht : t ∈ Set.uIcc a b) : |t - a| ≤ |b - a| ∧ |b - t| ≤ |b - a| := by -+ -+ have h1 : a ≤ b ∨ b ≤ a := le_total a b -+ rcases h1 with hle | hle -+ · -+ have ht' : t ∈ Set.Icc a b := by simpa [Set.uIcc_of_le hle] using ht -+ have h_bounds : a ≤ t ∧ t ≤ b := by simpa using ht' -+ constructor -+ · have h_ta : |t - a| = t - a := by simp [abs_of_nonneg (sub_nonneg.mpr h_bounds.left)] -+ have h_ba : |b - a| = b - a := by simp [abs_of_nonneg (sub_nonneg.mpr hle)] -+ rw [h_ta, h_ba] -+ exact sub_le_sub_right h_bounds.right a -+ · have h_bt : |b - t| = b - t := by simp [abs_of_nonneg (sub_nonneg.mpr h_bounds.right)] -+ have h_ba : |b - a| = b - a := by simp [abs_of_nonneg (sub_nonneg.mpr hle)] -+ rw [h_bt, h_ba] -+ exact sub_le_sub_left h_bounds.left b -+ · -+ have ht' : t ∈ Set.Icc b a := by -+ rw [Set.uIcc_comm] at ht -+ simpa [Set.uIcc_of_le hle] using ht -+ have h_bounds : b ≤ t ∧ t ≤ a := by simpa using ht' -+ constructor -+ · have h_ta : |t - a| = a - t := by simp [abs_of_nonpos (sub_nonpos.mpr h_bounds.right)] -+ have h_ba : |b - a| = a - b := by simp [abs_of_nonpos (sub_nonpos.mpr hle)] -+ rw [h_ta, h_ba] -+ exact sub_le_sub_left h_bounds.left a -+ · have h_bt : |b - t| = t - b := by -+ rw [abs_of_nonpos (sub_nonpos.mpr h_bounds.left)] -+ ring -+ have h_ba : |b - a| = a - b := by simp [abs_of_nonpos (sub_nonpos.mpr hle)] -+ rw [h_bt, h_ba] -+ exact sub_le_sub_right h_bounds.right b -+ -+lemma sub_ofReal_add_I (a b c d : ℝ) : ((a : ℂ) + Complex.I * b) - ((c : ℂ) + Complex.I * d) = ((a - c : ℝ) : ℂ) + Complex.I * (b - d) := by -+ apply Complex.ext -+ · -+ simp only [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.I_mul_re, Complex.ofReal_im, neg_zero, add_zero] -+ -+ rw [← Complex.ofReal_sub, Complex.ofReal_im, neg_zero, add_zero] -+ · -+ simp only [Complex.sub_im, Complex.add_im, Complex.ofReal_im, Complex.I_mul_im, Complex.ofReal_re, zero_add] -+ -+ rw [← Complex.ofReal_sub, Complex.ofReal_re] -+ -+lemma abs_re_im_bound (a b : ℝ) : ‖(a : ℂ) + Complex.I * b‖ ≤ |a| + |b| := by -+ -+ have triangle := lem_triangle_ineq (a : ℂ) (Complex.I * (b : ℂ)) -+ convert triangle -+ · -+ simp [Complex.norm_real, Real.norm_eq_abs] -+ · -+ simp [Complex.norm_I, Complex.norm_real, Real.norm_eq_abs] -+ -+lemma norm_ofReal (x : ℝ) : ‖(x : ℂ)‖ = |x| := by -+ simp [Complex.norm_real, Real.norm_eq_abs] -+ -+lemma norm_I_mul_ofReal (b : ℝ) : ‖Complex.I * (b : ℂ)‖ = |b| := by -+ simp [Complex.norm_I, Complex.norm_real, Real.norm_eq_abs] -+ -+lemma abs_add_Ile (a b : ℝ) : ‖(a : ℂ) + Complex.I * b‖ ≤ |a| + |b| := by -+ -+ have h := Complex.norm_le_abs_re_add_abs_im (a + Complex.I * b) -+ -+ have re_eq : (a + Complex.I * b).re = a := by -+ simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im] -+ have im_eq : (a + Complex.I * b).im = b := by -+ simp [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im] -+ rw [re_eq, im_eq] at h -+ exact h -+ -+lemma abs_vertical_diff_le_core (z h : ℂ) (τ : ℝ) : ‖((z + h).re - z.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |(z + h).re - z.re| + |τ - z.im| := by -+ -+ let a : ℝ := (z + h).re - z.re -+ let b : ℝ := τ - z.im -+ -+ have h_eq : ((z + h).re - z.re : ℝ) + Complex.I * (τ - z.im) = (a : ℂ) + Complex.I * (b : ℂ) := by -+ simp only [a, b] -+ -+ rw [← Complex.ofReal_sub τ z.im] -+ -+ rw [h_eq] -+ have triangle := Complex.norm_le_abs_re_add_abs_im ((a : ℂ) + Complex.I * (b : ℂ)) -+ -+ have re_calc : ((a : ℂ) + Complex.I * (b : ℂ)).re = a := by -+ simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.ofReal_im] -+ ring -+ -+ have im_calc : ((a : ℂ) + Complex.I * (b : ℂ)).im = b := by -+ simp only [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_im, Complex.ofReal_re] -+ ring -+ -+ rw [re_calc, im_calc] at triangle -+ simp only [a, b] at triangle -+ exact triangle -+ -+lemma abs_vertical_core (z h : ℂ) (τ : ℝ) : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |h.re| + |τ - z.im| := by -+ -+ have h1 : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |((h.re : ℝ) + Complex.I * (τ - z.im)).re| + |((h.re : ℝ) + Complex.I * (τ - z.im)).im| := by -+ apply Complex.norm_le_abs_re_add_abs_im -+ -+ have h2 : ((h.re : ℝ) + Complex.I * (τ - z.im)).re = h.re := by simp -+ have h3 : ((h.re : ℝ) + Complex.I * (τ - z.im)).im = τ - z.im := by simp -+ -+ rw [h2, h3] at h1 -+ exact h1 -+ -+lemma S_vert_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_vert z h f := by -+ unfold S_vert -+ apply Real.sSup_nonneg -+ intro r hr; rcases hr with ⟨τ, hτ, rfl⟩; exact norm_nonneg _ -+ -+lemma abs_im_le_norm (z : ℂ) : |z.im| ≤ ‖z‖ := by -+ exact Complex.abs_im_le_norm z -+ -+lemma mem_closedBall_mono_radius {z : ℂ} {r R : ℝ} (hz : z ∈ Metric.closedBall (0 : ℂ) r) (h : r ≤ R) : z ∈ Metric.closedBall (0 : ℂ) R := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using le_trans (by simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz) h -+ -+lemma tendsto_of_nonneg_local_bound {g : ℂ → ℝ} -+ (h_nonneg : ∀ h, 0 ≤ g h) -+ (h_loc : ∀ ε > 0, ∃ δ > 0, ∀ h, ‖h‖ < δ → g h ≤ ε) : -+ Tendsto g (𝓝 (0:ℂ)) (𝓝 (0:ℝ)) := by -+ rw [Metric.tendsto_nhds_nhds] -+ intro ε hε -+ -+ have hε_half : (0 : ℝ) < ε / 2 := by linarith -+ obtain ⟨δ, hδ_pos, hδ⟩ := h_loc (ε / 2) hε_half -+ use δ -+ exact ⟨hδ_pos, fun h hh_dist => by -+ rw [Real.dist_eq, sub_zero] -+ rw [abs_of_nonneg (h_nonneg h)] -+ have : g h ≤ ε / 2 := hδ h (by rwa [Complex.dist_eq, sub_zero] at hh_dist) -+ linarith⟩ -+ -+lemma sum_abs_le_two_mul {x y A : ℝ} (hx : |x| ≤ A) (hy : |y| ≤ A) : |x| + |y| ≤ (2:ℝ) * A := by -+ have := add_le_add hx hy -+ simpa [two_mul] using this -+ -+lemma two_norm_lt_of_norm_lt_half {h : ℂ} {δ : ℝ} (_hpos : 0 < δ) (hbound : ‖h‖ < δ/2) : (2:ℝ) * ‖h‖ < δ := by -+ have := mul_lt_mul_of_pos_left hbound (by norm_num : (0:ℝ) < 2) -+ simpa [two_mul, add_halves] using this -+ -+lemma limit_of_S_is_zero -+ {r1 R R0 : ℝ} -+ (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : -+ Tendsto (fun h => S_max z h f) (𝓝 0) (𝓝 0) := by -+ -+ have f_cont_at_z : ContinuousAt f z := by -+ -+ have hz_in_R : z ∈ Metric.closedBall (0 : ℂ) R := -+ mem_closedBall_mono_radius hz (le_of_lt hr1_lt_R) -+ -+ exact (hf z hz_in_R).continuousAt -+ -+ apply tendsto_of_nonneg_local_bound -+ · -+ exact fun h => S_max_nonneg z h f -+ · -+ intro ε hε_pos -+ -+ rw [Metric.continuousAt_iff] at f_cont_at_z -+ obtain ⟨δ₁, hδ₁_pos, hf_bound⟩ := f_cont_at_z ε hε_pos -+ -+ use δ₁ / 2 -+ constructor -+ · exact half_pos hδ₁_pos -+ · intro h hh_norm -+ -+ unfold S_max -+ apply max_le -+ -+ · unfold S_horiz -+ -+ apply Real.sSup_le -+ · -+ intro r hr -+ obtain ⟨t, ht, rfl⟩ := hr -+ -+ have key_dist : dist ((t : ℂ) + Complex.I * z.im) z < δ₁ := by -+ -+ rw [dist_eq] -+ -+ have eq_transform : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := abs_horizontal_diff_eq_abs_real z t -+ simp [eq_transform] -+ -+ have t_bound : |t - z.re| ≤ |(z + h).re - z.re| := (abs_sub_le_of_mem_uIcc z.re (z + h).re t ht).1 -+ have re_diff_le : |(z + h).re - z.re| ≤ ‖h‖ := by -+ -+ simpa [Complex.add_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using (Complex.abs_re_le_norm h) -+ have h_bound : ‖h‖ < δ₁ / 2 := hh_norm -+ calc |t - z.re| -+ _ ≤ |(z + h).re - z.re| := t_bound -+ _ ≤ ‖h‖ := re_diff_le -+ _ < δ₁ / 2 := h_bound -+ _ < δ₁ := by linarith -+ -+ have f_dist := hf_bound key_dist -+ -+ rw [dist_eq] at f_dist -+ -+ exact le_of_lt f_dist -+ · -+ exact le_of_lt hε_pos -+ -+ · unfold S_vert -+ apply Real.sSup_le -+ · -+ intro r hr -+ obtain ⟨τ, hτ, rfl⟩ := hr -+ -+ have key_dist : dist (((z + h).re : ℂ) + Complex.I * τ) z < δ₁ := by -+ rw [dist_eq] -+ -+ have h_eq : (((z + h).re : ℂ) + Complex.I * τ - z) = (h.re : ℝ) + Complex.I * (τ - z.im) := by -+ apply Complex.ext_iff.mpr -+ constructor -+ · simp [Complex.add_re, Complex.sub_re] -+ · simp [Complex.add_im, Complex.sub_im] -+ rw [h_eq] -+ -+ have τ_bound0 : |τ - z.im| ≤ |(z + h).im - z.im| := (abs_sub_le_of_mem_uIcc z.im (z + h).im τ hτ).1 -+ have im_diff_eq : |(z + h).im - z.im| = |h.im| := by -+ simp [Complex.add_im, sub_eq_add_neg, add_assoc] -+ have τ_bound : |τ - z.im| ≤ |h.im| := by simpa [im_diff_eq] using τ_bound0 -+ -+ have vertical_bound : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |h.re| + |τ - z.im| := -+ abs_vertical_core z h τ -+ have sum_bound : |h.re| + |τ - z.im| ≤ |h.re| + |h.im| := by -+ exact add_le_add_right τ_bound _ -+ have norm_bound := sum_abs_le_two_mul (Complex.abs_re_le_norm h) (Complex.abs_im_le_norm h) -+ have h_bound : ‖h‖ < δ₁ / 2 := hh_norm -+ have final_bound := two_norm_lt_of_norm_lt_half hδ₁_pos h_bound -+ calc ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ -+ _ ≤ |h.re| + |τ - z.im| := vertical_bound -+ _ ≤ |h.re| + |h.im| := sum_bound -+ _ ≤ (2 : ℝ) * ‖h‖ := norm_bound -+ _ < δ₁ := final_bound -+ -+ have f_dist := hf_bound key_dist -+ rw [dist_eq] at f_dist -+ -+ exact le_of_lt f_dist -+ · -+ exact le_of_lt hε_pos -+ -+lemma eventually_corner_and_sum_in_closedBall {z : ℂ} {R' : ℝ} -+ (hz : ‖z‖ < R') : -+ ∀ᶠ h in 𝓝 (0:ℂ), -+ (z + h) ∈ Metric.closedBall (0 : ℂ) R' ∧ -+ (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) R' := by -+ -+ have hρ_pos : 0 < R' - ‖z‖ := sub_pos.mpr hz -+ have h_small : ∀ᶠ h in 𝓝 (0:ℂ), h ∈ Metric.ball (0 : ℂ) (R' - ‖z‖) := -+ Metric.ball_mem_nhds (0 : ℂ) hρ_pos -+ refine h_small.mono ?_ -+ intro h hhball -+ have hnorm_lt : ‖h‖ < R' - ‖z‖ := by -+ simpa [Metric.mem_ball, Complex.dist_eq, sub_zero] using hhball -+ -+ have hsum_lt : ‖z‖ + ‖h‖ < R' := by -+ have htemp : ‖z‖ + ‖h‖ < ‖z‖ + (R' - ‖z‖) := add_lt_add_right hnorm_lt _ -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using htemp -+ have hzph_le : ‖z + h‖ ≤ R' := -+ le_of_lt (lt_of_le_of_lt (norm_add_le _ _) hsum_lt) -+ have hzph_mem : (z + h) ∈ Metric.closedBall (0 : ℂ) R' := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hzph_le -+ -+ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im -+ -+ have tri : ‖w‖ ≤ ‖w - z‖ + ‖z‖ := by -+ have := norm_add_le (w - z) z -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ -+ let t : ℝ := (z + h).re -+ have hwz_eq : w - z = (t : ℂ) + Complex.I * z.im - z := by -+ simp [w, t, sub_eq_add_neg, add_assoc] -+ have eq_transform : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := -+ abs_horizontal_diff_eq_abs_real z t -+ have t_sub_re : t - z.re = h.re := by -+ simp [t, Complex.add_re, sub_eq_add_neg, add_assoc] -+ have hwz_abs2 : ‖w - z‖ = |h.re| := by -+ simpa [hwz_eq, t_sub_re] using eq_transform -+ have hwz_le : ‖w - z‖ ≤ ‖h‖ := by -+ simpa [hwz_abs2] using (Complex.abs_re_le_norm h) -+ have hw_le'' : ‖w‖ ≤ ‖h‖ + ‖z‖ := by -+ exact le_trans tri (add_le_add_left hwz_le _) -+ have hw_lt : ‖w‖ < R' := by -+ have : ‖h‖ + ‖z‖ < R' := by simpa [add_comm] using hsum_lt -+ exact lt_of_le_of_lt hw_le'' this -+ have hw_mem : w ∈ Metric.closedBall (0 : ℂ) R' := by -+ simpa [w, Metric.mem_closedBall, Complex.dist_eq, sub_zero] using (le_of_lt hw_lt) -+ exact And.intro hzph_mem hw_mem -+ -+lemma limit_of_Err_ratio_is_zero -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : -+ Tendsto (fun h => Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h) (𝓝 0) (𝓝 0) := by -+ -+ set g : ℂ → ℂ := fun h => Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h -+ -+ have hS : Tendsto (fun h => S_max z h f) (𝓝 0) (𝓝 0) := -+ limit_of_S_is_zero (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz -+ -+ have h_upper : Tendsto (fun h => |(2 : ℝ) * S_max z h f|) (𝓝 0) (𝓝 0) := by -+ have hcont : Continuous fun x : ℝ => |(2 : ℝ) * x| := -+ (continuous_const.mul continuous_id).abs -+ have h0 := hcont.tendsto (0 : ℝ) -+ simpa only [Function.comp_def, mul_zero, abs_zero] using h0.comp hS -+ -+ have h_lower_nonneg : ∀ᶠ h in 𝓝 0, 0 ≤ ‖g h‖ := -+ Filter.Eventually.of_forall (fun _ => by simpa [g] using (norm_nonneg (g _))) -+ -+ let δ : ℝ := (R - r1) / 2 -+ have hδ_pos : 0 < δ := by -+ have : 0 < R - r1 := sub_pos.mpr hr1_lt_R -+ simpa [δ] using half_pos this -+ let R' : ℝ := r1 + δ -+ have hR'_pos : 0 < R' := by -+ have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) -+ simpa [R'] using this -+ have hR'_lt_R : R' < R := by -+ have hδlt : δ < R - r1 := by -+ simpa [δ] using (half_lt_self (sub_pos.mpr hr1_lt_R)) -+ have : r1 + δ < r1 + (R - r1) := add_lt_add_right hδlt r1 -+ simpa [R', sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ -+ have hz_le_r1 : ‖z‖ ≤ r1 := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz -+ have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by -+ have hr1_le_R' : r1 ≤ R' := by -+ have : 0 ≤ δ := le_of_lt hδ_pos -+ simpa [R'] using (le_add_of_nonneg_right this : r1 ≤ r1 + δ) -+ have : ‖z‖ ≤ R' := le_trans hz_le_r1 hr1_le_R' -+ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this -+ -+ have h_event : ∀ᶠ h in 𝓝 0, ‖g h‖ ≤ |(2 : ℝ) * S_max z h f| := by -+ -+ have hcorner := eventually_corner_and_sum_in_closedBall (z:=z) (R':=R') (hz := by -+ -+ have : ‖z‖ ≤ r1 := hz_le_r1 -+ exact lt_of_le_of_lt this (by simpa [R'] using (lt_add_of_pos_right r1 hδ_pos))) -+ refine hcorner.mono ?_ -+ intro h hh -+ have hzh' : z + h ∈ Metric.closedBall (0 : ℂ) R' := hh.1 -+ have hw' : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) R' := hh.2 -+ by_cases hh0 : h = 0 -+ · have : 0 ≤ |(2 : ℝ) * S_max z h f| := abs_nonneg _ -+ simp [g, hh0, div_zero, norm_zero] -+ · -+ have hb := -+ bound_on_Err_ratio (r1:=R') (R:=R) (R0:=R0) -+ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf (z:=z) (h:=h) hz' hzh' hw' hh0 -+ have hb' : ‖g h‖ ≤ 2 * S_max z h f := by -+ simpa [g, norm, Err] using hb -+ exact le_trans hb' (le_abs_self ((2 : ℝ) * S_max z h f)) -+ -+ have h_norm_tendsto : Tendsto (fun h => ‖g h‖) (𝓝 0) (𝓝 0) := by -+ refine Filter.Tendsto.squeeze' tendsto_const_nhds h_upper h_lower_nonneg h_event -+ -+ have h_dist_tendsto : Tendsto (fun h => dist (g h) 0) (𝓝 0) (𝓝 0) := by -+ simpa [dist_eq_norm] using h_norm_tendsto -+ simpa [g] using (tendsto_iff_dist_tendsto_zero).2 h_dist_tendsto -+ -+open Classical -+ -+noncomputable def If_ext -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ (f : ℂ → ℂ) -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : ℂ → ℂ := -+ fun w => -+ if h : w ∈ Metric.closedBall (0 : ℂ) r1 then -+ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, h⟩ -+ else -+ 0 -+ -+lemma If_ext_eq_taxicab_of_mem {r1 R R0 : ℝ} (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ (f : ℂ → ℂ) -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {w : ℂ} (hw : w ∈ Metric.closedBall (0 : ℂ) r1) : -+ If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w -+ = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := by -+ classical -+ simp [If_ext, hw] -+ -+lemma If_taxicab_param_invariance {r1₁ r1₂ R R0 : ℝ} -+ (hr1₁_pos : 0 < r1₁) (hr1₁_lt_R : r1₁ < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ (hr1₂_pos : 0 < r1₂) (hr1₂_lt_R : r1₂ < R) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {w : ℂ} -+ (hw₁ : w ∈ Metric.closedBall (0 : ℂ) r1₁) -+ (hw₂ : w ∈ Metric.closedBall (0 : ℂ) r1₂) : -+ If_taxicab hr1₁_pos hr1₁_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw₁⟩ -+ = If_taxicab hr1₂_pos hr1₂_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw₂⟩ := by -+ -+ simp [If_taxicab] -+ -+lemma derivWithin_eq_deriv_of_isOpen_mem {s : Set ℂ} (hs : IsOpen s) {f : ℂ → ℂ} {z : ℂ} -+ (hz : z ∈ s) : derivWithin f s z = deriv f z := by -+ simpa using (derivWithin_of_isOpen (f := f) (s := s) (x := z) hs hz) -+ -+lemma eventually_decomposition_for_ext -+ {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ (z : ℂ) (hz : ‖z‖ < R') : -+ ∀ᶠ h in 𝓝 (0:ℂ), -+ let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf -+ g (z + h) - g z = f z * h + Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h := by -+ -+ have h_event := eventually_corner_and_sum_in_closedBall (z:=z) (R':=R') hz -+ refine h_event.mono ?_ -+ intro h hh -+ -+ let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf -+ -+ have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by -+ have : ‖z‖ ≤ R' := le_of_lt hz -+ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this -+ -+ have hgzh : g (z + h) -+ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hh.1⟩ := by -+ simpa [g] using -+ If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=z + h) hh.1 -+ have hgz : g z -+ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz'⟩ := by -+ simpa [g] using -+ If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=z) hz' -+ -+ have H := -+ If_diff_decomposition_final (r1:=R') (R:=R) (R0:=R0) -+ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) -+ (z:=z) (h:=h) -+ (hz:=hz') (hzh:=hh.1) (hw:=hh.2) -+ -+ calc -+ g (z + h) - g z -+ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hh.1⟩ -+ - If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz'⟩ := by -+ simp [hgzh, hgz] -+ _ = f z * h + Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h := by -+ simpa using H -+ -+lemma tendsto_Err_ratio_radius (R' R R0 : ℝ) (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z : ℂ} (hz : ‖z‖ < R') : -+ Tendsto (fun h => Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h / h) (𝓝 0) (𝓝 0) := by -+ -+ have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by -+ have : ‖z‖ ≤ R' := le_of_lt hz -+ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this -+ -+ simpa using -+ (limit_of_Err_ratio_is_zero (r1:=R') (R:=R) (R0:=R0) -+ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf (z:=z) (hz:=hz')) -+ -+lemma If_ext_eq_taxicab_at_sum {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z h : ℂ} -+ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) R') : -+ If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (z + h) -+ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ := by -+ simpa using -+ (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) -+ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) (w:=z + h) hzh) -+ -+lemma If_ext_eq_taxicab_at_point {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) -+ {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) R') : -+ If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z -+ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ := by -+ simpa using -+ (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) -+ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) (w:=z) hz) -+ -+lemma hasDerivWithinAt_congr_eqOn {f g : ℂ → ℂ} {s : Set ℂ} {z f' : ℂ} -+ (hEq : Set.EqOn f g s) (hz : z ∈ s) : -+ HasDerivWithinAt g f' s z → HasDerivWithinAt f f' s z := by -+ intro hg -+ have hfg : ∀ x ∈ s, f x = g x := fun x hx => hEq hx -+ simpa using (HasDerivWithinAt.congr_of_mem (h := hg) (hs := hfg) (hx := hz)) -+ -+lemma differentiableOn_of_hasDerivWithinAt {f : ℂ → ℂ} {s : Set ℂ} {F : ℂ → ℂ} -+ (h : ∀ z ∈ s, HasDerivWithinAt f (F z) s z) : DifferentiableOn ℂ f s := by -+ intro z hz -+ exact (h z hz).differentiableWithinAt -+ -+lemma If_ext_agree_on_smallBall {r1 R' R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hR'_pos : 0 < R') (hr1_lt_R : r1 < R) (hR'_lt_R : R' < R) (hr1_lt_R' : r1 < R') (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : -+ Set.EqOn (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) -+ (If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf) -+ (Metric.closedBall (0 : ℂ) r1) := by -+ intro w hw -+ -+ have hw' : w ∈ Metric.closedBall (0 : ℂ) R' := -+ mem_closedBall_mono_radius (z:=w) (r:=r1) (R:=R') hw (le_of_lt hr1_lt_R') -+ -+ have hleft : -+ If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w -+ = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := by -+ simpa using -+ (If_ext_eq_taxicab_of_mem (r1:=r1) (R:=R) (R0:=R0) -+ hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf (w:=w) hw) -+ have hright : -+ If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf w -+ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw'⟩ := by -+ simpa using -+ (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) -+ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=w) hw') -+ -+ have hparam := -+ If_taxicab_param_invariance (r1₁:=r1) (r1₂:=R') (R:=R) (R0:=R0) -+ hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hR'_pos hR'_lt_R hf (w:=w) hw hw' -+ -+ calc -+ If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w -+ = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := hleft -+ _ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw'⟩ := hparam -+ _ = If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf w := by -+ simpa using hright.symm -+ -+lemma hasDerivAt_of_local_decomposition' (g : ℂ → ℂ) (z F : ℂ) -+ (Err_func : ℂ → ℂ) -+ (hdecomp : ∀ᶠ h in 𝓝 (0:ℂ), g (z + h) - g z = F * h + Err_func h) -+ (hErr : Tendsto (fun h => Err_func h / h) (𝓝 (0:ℂ)) (𝓝 (0:ℂ))) : -+ HasDerivAt g F z := by -+ -+ have hdecomp_within : ∀ᶠ h in 𝓝[≠] (0:ℂ), g (z + h) - g z = F * h + Err_func h := -+ (hdecomp.filter_mono (nhdsWithin_le_nhds : 𝓝[≠] (0:ℂ) ≤ 𝓝 (0:ℂ))) -+ -+ have h_ne0 : ∀ᶠ h in 𝓝[≠] (0:ℂ), h ≠ 0 := by -+ filter_upwards [eventually_mem_nhdsWithin (a := (0 : ℂ)) (s := ({0}ᶜ : Set ℂ))] with h hh -+ simpa only [Set.mem_compl_iff, Set.mem_singleton_iff] using hh -+ -+ have h_eq_slope : ∀ᶠ h in 𝓝[≠] (0:ℂ), -+ h⁻¹ • (g (z + h) - g z) = F + Err_func h / h := by -+ refine (hdecomp_within.and h_ne0).mono ?_ -+ intro h hh -+ rcases hh with ⟨hEq, hne⟩ -+ -+ have H0 : h⁻¹ • (g (z + h) - g z) = h⁻¹ • (F * h + Err_func h) := by -+ simpa using congrArg (fun x => h⁻¹ • x) hEq -+ -+ have h1 : h⁻¹ * (F * h) = F := by -+ have hne' : h ≠ 0 := hne -+ calc -+ h⁻¹ * (F * h) = F * (h⁻¹ * h) := by -+ ac_rfl -+ _ = F * 1 := by simp [hne'] -+ _ = F := by simp -+ have h2 : h⁻¹ * Err_func h = Err_func h / h := by -+ simp [div_eq_mul_inv, mul_comm] -+ calc -+ h⁻¹ • (g (z + h) - g z) -+ = h⁻¹ • (F * h + Err_func h) := H0 -+ _ = h⁻¹ * (F * h + Err_func h) := by simp [smul_eq_mul] -+ _ = h⁻¹ * (F * h) + h⁻¹ * (Err_func h) := by simp [mul_add] -+ _ = F + Err_func h / h := by simp [h1, h2] -+ -+ have hErr_within : Tendsto (fun h => Err_func h / h) (𝓝[≠] (0:ℂ)) (𝓝 (0:ℂ)) := -+ hErr.mono_left (nhdsWithin_le_nhds : 𝓝[≠] (0:ℂ) ≤ 𝓝 (0:ℂ)) -+ have h_const : Tendsto (fun _ : ℂ => F) (𝓝[≠] (0:ℂ)) (𝓝 F) := tendsto_const_nhds -+ have h_sum : Tendsto (fun h => F + Err_func h / h) (𝓝[≠] (0:ℂ)) (𝓝 (F + 0)) := -+ h_const.add hErr_within -+ have h_target : Tendsto (fun h => h⁻¹ • (g (z + h) - g z)) (𝓝[≠] (0:ℂ)) (𝓝 F) := by -+ have := (Filter.tendsto_congr' h_eq_slope).2 h_sum -+ simpa [zero_add] using this -+ -+ exact (hasDerivAt_iff_tendsto_slope_zero).2 h_target -+ -+lemma uniqueDiffWithinAt_convex_complex {s : Set ℂ} (hconv : Convex ℝ s) -+ (hs : (interior s).Nonempty) {x : ℂ} (hx : x ∈ closure s) : -+ UniqueDiffWithinAt ℂ s x := by -+ -+ have hR : UniqueDiffWithinAt ℝ s x := -+ uniqueDiffWithinAt_convex (E := ℂ) (conv := hconv) (hs := hs) (x := x) (hx := hx) -+ -+ have dR : Dense ((Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) : Set ℂ) := by -+ simpa using (hR.dense_tangentConeAt) -+ -+ have h_tc_subset : tangentConeAt ℝ s x ⊆ tangentConeAt ℂ s x := -+ tangentConeAt_mono_field -+ -+ set TC : Set ℂ := tangentConeAt ℂ s x -+ set Sℂ : Submodule ℂ ℂ := Submodule.span ℂ TC -+ set Sℝ : Submodule ℝ ℂ := Sℂ.restrictScalars ℝ -+ have h_span_le : (Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) ≤ Sℝ := by -+ -+ refine Submodule.span_le.mpr ?_ -+ intro v hv -+ have hv' : v ∈ TC := h_tc_subset hv -+ have : v ∈ Sℂ := Submodule.subset_span hv' -+ simpa [Sℝ] using this -+ -+ have hsubset_sets : -+ ((Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) : Set ℂ) -+ ⊆ ((Sℂ : Submodule ℂ ℂ) : Set ℂ) := by -+ intro z hz -+ have hz' : z ∈ Sℝ := h_span_le hz -+ simpa [Sℝ] using hz' -+ have dC : Dense ((Sℂ : Submodule ℂ ℂ) : Set ℂ) := dR.mono hsubset_sets -+ -+ exact ⟨dC, hx⟩ -+ -+lemma interior_closedBall_nonempty_of_pos {R : ℝ} (hR_pos : 0 < R) : -+ (interior (Metric.closedBall (0 : ℂ) R)).Nonempty := by -+ -+ have h0mem : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by -+ simpa [Metric.mem_ball, Complex.dist_eq, sub_zero] using hR_pos -+ -+ have hsub : Metric.ball (0 : ℂ) R ⊆ interior (Metric.closedBall (0 : ℂ) R) := -+ Metric.ball_subset_interior_closedBall -+ -+ exact ⟨0, hsub h0mem⟩ -+ -+lemma mem_closure_of_mem_closedBall {R : ℝ} {z : ℂ} -+ (hz : z ∈ Metric.closedBall (0 : ℂ) R) : -+ z ∈ closure (Metric.closedBall (0 : ℂ) R) := by -+ exact subset_closure hz -+ -+lemma uniqueDiffWithinAt_closedBall_complex_of_mem {R : ℝ} {z : ℂ} -+ (hR_pos : 0 < R) (hz : z ∈ Metric.closedBall (0 : ℂ) R) : -+ UniqueDiffWithinAt ℂ (Metric.closedBall (0 : ℂ) R) z := -+by -+ -+ have hconv : Convex ℝ (Metric.closedBall (0 : ℂ) R) := -+ convex_closedBall (0 : ℂ) R -+ -+ have hnonempty : (interior (Metric.closedBall (0 : ℂ) R)).Nonempty := -+ interior_closedBall_nonempty_of_pos (R := R) hR_pos -+ -+ have hz_cl : z ∈ closure (Metric.closedBall (0 : ℂ) R) := -+ mem_closure_of_mem_closedBall (R := R) (z := z) hz -+ -+ exact uniqueDiffWithinAt_convex_complex hconv hnonempty hz_cl -+ -+lemma If_is_differentiable_on -+ {r1 R R0 : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) -+ {f : ℂ → ℂ} -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : -+ DifferentiableOn ℂ (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (Metric.closedBall (0 : ℂ) r1) -+ ∧ -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ derivWithin (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (Metric.closedBall (0 : ℂ) r1) z = f z := by -+ set s : Set ℂ := Metric.closedBall (0 : ℂ) r1 -+ have hHasDerivWithinAt : ∀ z ∈ s, -+ HasDerivWithinAt (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (f z) s z := by -+ intro z hz -+ -+ let δ : ℝ := (R - r1) / 2 -+ have hδ_pos : 0 < δ := by -+ have : 0 < R - r1 := sub_pos.mpr hr1_lt_R -+ simpa [δ] using half_pos this -+ let R' : ℝ := r1 + δ -+ have hR'_pos : 0 < R' := by -+ have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) -+ simpa [R'] using this -+ have hR'_lt_R : R' < R := by -+ have hδlt : δ < R - r1 := by -+ have : 0 < R - r1 := sub_pos.mpr hr1_lt_R -+ simpa [δ] using (half_lt_self this) -+ have : r1 + δ < r1 + (R - r1) := add_lt_add_right hδlt r1 -+ simpa [R', sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ have hr1_lt_R' : r1 < R' := by -+ have : r1 < r1 + δ := by simpa [add_comm, add_left_comm, add_assoc, R', δ] using (lt_of_le_of_lt (le_of_eq rfl) (add_lt_add_right hδ_pos r1)) -+ simpa [R'] using this -+ -+ have hz_le_r1 : ‖z‖ ≤ r1 := by -+ simpa [s, Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz -+ have hz_lt_R' : ‖z‖ < R' := lt_of_le_of_lt hz_le_r1 (by simpa [R'] using (lt_add_of_pos_right r1 hδ_pos)) -+ -+ let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf -+ -+ have hdecomp := eventually_decomposition_for_ext (R':=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf z hz_lt_R' -+ -+ have hErr := tendsto_Err_ratio_radius (R':=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf hz_lt_R' -+ -+ have hDerivAt_g : HasDerivAt g (f z) z := -+ hasDerivAt_of_local_decomposition' (g := g) (z := z) (F := f z) -+ (Err_func := fun h => Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h) -+ (hdecomp := by -+ -+ simpa [g] using hdecomp) -+ (hErr := by -+ -+ simpa using hErr) -+ -+ have hWithin_g : HasDerivWithinAt g (f z) s z := hDerivAt_g.hasDerivWithinAt -+ -+ have hEq : Set.EqOn (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) -+ (If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf) -+ s := -+ If_ext_agree_on_smallBall (r1:=r1) (R':=R') (R:=R) (R0:=R0) -+ hr1_pos hR'_pos hr1_lt_R hR'_lt_R hr1_lt_R' hR_lt_R0 hR0_lt_one hf -+ -+ exact hasDerivWithinAt_congr_eqOn (f := If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) -+ (g := g) (s := s) (z := z) (f' := f z) hEq hz hWithin_g -+ -+ refine And.intro ?hdiff ?hderiv -+ · -+ apply differentiableOn_of_hasDerivWithinAt -+ intro z hz -+ exact hHasDerivWithinAt z hz -+ · -+ intro z hz -+ have hUD : UniqueDiffWithinAt ℂ s z := -+ uniqueDiffWithinAt_closedBall_complex_of_mem (R := r1) hr1_pos (z := z) (hz := by simpa [s] using hz) -+ have hD := hHasDerivWithinAt z hz -+ simpa using hD.derivWithin hUD -+ -+open scoped Topology -+ -+theorem AnalyticOnNhd.mono_closedBall {B : ℂ → ℂ} {R : ℝ} (R' : ℝ) -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall 0 R)) (hR' : R' < R) : -+ AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by -+ -+ exact hB.mono (Metric.closedBall_subset_closedBall (le_of_lt hR')) -+ -+lemma log_deriv_is_analytic -+ {r1 R' R : ℝ} -+ (_hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R')) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z ≠ 0) : -+ AnalyticOnNhd ℂ (fun z => deriv B z / B z) (Metric.closedBall (0 : ℂ) r1) := by -+ have step1 : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) r1) := by simp [AnalyticOnNhd.mono_closedBall r1 hB hr1_lt_R'] -+ have hderiv : AnalyticOnNhd ℂ (deriv B) (Metric.closedBall (0 : ℂ) r1) := by -+ apply AnalyticOnNhd.deriv step1 -+ -+ simpa using AnalyticOnNhd.div hderiv step1 hB_ne_zero -+ -+lemma I_is_antiderivative -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) : -+ ∃ J : ℂ → ℂ, AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1) ∧ -+ J 0 = 0 ∧ -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z := by -+ classical -+ -+ have hB_on_R' : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R') := -+ AnalyticOnNhd.mono_closedBall R' hB hR'_lt_R -+ have hderiv_on_R' : AnalyticOnNhd ℂ (deriv B) (Metric.closedBall (0 : ℂ) R') := -+ AnalyticOnNhd.deriv hB_on_R' -+ let L : ℂ → ℂ := fun z => deriv B z / B z -+ have hL_on_R' : AnalyticOnNhd ℂ L (Metric.closedBall (0 : ℂ) R') := by -+ simpa [L] using AnalyticOnNhd.div hderiv_on_R' hB_on_R' hB_ne_zero -+ -+ let δ : ℝ := (R' - r1) / 2 -+ have hδ_pos : 0 < δ := by -+ have : 0 < R' - r1 := sub_pos.mpr hr1_lt_R' -+ simpa [δ] using half_pos this -+ let R_mid : ℝ := r1 + δ -+ have hR_mid_pos : 0 < R_mid := by -+ have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) -+ simpa [R_mid] using this -+ have hr1_lt_R_mid : r1 < R_mid := by -+ have : 0 < δ := hδ_pos -+ simpa [R_mid] using (lt_add_of_pos_right r1 this) -+ have hR_mid_lt_R' : R_mid < R' := by -+ have hδlt : δ < R' - r1 := by -+ simpa [δ] using (half_lt_self (sub_pos.mpr hr1_lt_R')) -+ have : r1 + δ < r1 + (R' - r1) := add_lt_add_right hδlt r1 -+ simpa [R_mid, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ -+ let J : ℂ → ℂ := -+ If_ext (r1 := R_mid) (R := R') (R0 := R) hR_mid_pos hR_mid_lt_R' hR'_lt_R hR_lt_one L hL_on_R' -+ -+ have hIf := -+ (If_is_differentiable_on (r1 := R_mid) (R := R') (R0 := R) -+ hR_mid_pos hR_mid_lt_R' hR'_lt_R hR_lt_one (f := L) hL_on_R') -+ have hDiffOn_mid : DifferentiableOn ℂ J (Metric.closedBall (0 : ℂ) R_mid) := by -+ simpa [J] using hIf.1 -+ -+ have hDiffOn_ball_R_mid : DifferentiableOn ℂ J (Metric.ball (0 : ℂ) R_mid) := -+ hDiffOn_mid.mono Metric.ball_subset_closedBall -+ -+ have hJ_analyticOnNhd : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1) := by -+ intro z hz -+ -+ have hz_le : dist z (0 : ℂ) ≤ r1 := by -+ simpa [Metric.mem_closedBall] using hz -+ have hz_lt : dist z (0 : ℂ) < R_mid := lt_of_le_of_lt hz_le hr1_lt_R_mid -+ have hz_ball : z ∈ Metric.ball (0 : ℂ) R_mid := by simpa [Metric.mem_ball] using hz_lt -+ -+ exact (DifferentiableOn.analyticAt (s := Metric.ball (0 : ℂ) R_mid) -+ (f := J) hDiffOn_ball_R_mid (Metric.isOpen_ball.mem_nhds hz_ball)) -+ -+ have h0_in_mid : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R_mid := by -+ simpa [Metric.mem_closedBall, dist_self] using (le_of_lt hR_mid_pos) -+ have hJ0 : J 0 = 0 := by -+ simp [J, If_ext, If_taxicab, h0_in_mid] -+ -+ have hderiv_eq : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = L z := by -+ intro z hz -+ -+ have hz_le : dist z (0 : ℂ) ≤ r1 := by simpa [Metric.mem_closedBall] using hz -+ have hz_lt : dist z (0 : ℂ) < R_mid := lt_of_le_of_lt hz_le hr1_lt_R_mid -+ have hz_ball : z ∈ Metric.ball (0 : ℂ) R_mid := by simpa [Metric.mem_ball] using hz_lt -+ have hz_cb_mid : z ∈ Metric.closedBall (0 : ℂ) R_mid := Metric.ball_subset_closedBall hz_ball -+ -+ have h_cb_nhds : Metric.closedBall (0 : ℂ) R_mid ∈ 𝓝 z := -+ Filter.mem_of_superset (Metric.isOpen_ball.mem_nhds hz_ball) Metric.ball_subset_closedBall -+ -+ have hDW_eq_L : derivWithin J (Metric.closedBall (0 : ℂ) R_mid) z = L z := by -+ simpa [J] using hIf.2 z hz_cb_mid -+ -+ have hHasWithin : HasDerivWithinAt J (derivWithin J (Metric.closedBall (0 : ℂ) R_mid) z) -+ (Metric.closedBall (0 : ℂ) R_mid) z := -+ (hDiffOn_mid z hz_cb_mid).hasDerivWithinAt -+ have hHasWithinL : HasDerivWithinAt J (L z) (Metric.closedBall (0 : ℂ) R_mid) z := by -+ simpa [hDW_eq_L] -+ using hHasWithin -+ -+ have hHasDerivAt : HasDerivAt J (L z) z := -+ HasDerivWithinAt.hasDerivAt hHasWithinL h_cb_nhds -+ -+ simpa using hHasDerivAt.deriv -+ -+ refine ⟨J, hJ_analyticOnNhd, hJ0, ?_⟩ -+ intro z hz -+ simpa [L] using hderiv_eq z hz -+ -+noncomputable def H_auxiliary -+ {r1 R' R : ℝ} -+ (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ (J : ℂ → ℂ) : ℂ → ℂ := -+ fun z => Complex.exp (J z) / B z -+ -+lemma exp_I_at_zero -+ {r1 R' R : ℝ} -+ (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ Complex.exp (J 0) = 1 := by -+ simp [hJ_zero] -+ -+lemma H_at_zero -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 = 1 / B 0 := by -+ simp [H_auxiliary, hJ_zero] -+ -+lemma log_deriv_id -+ {r1 R' R : ℝ} -+ (_hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (_hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z * B z = deriv B z := by -+ intro z hz -+ -+ have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by -+ have hzR' : dist z (0 : ℂ) ≤ r1 := hz -+ have hR'_le : r1 ≤ R' := le_of_lt (hr1_lt_R') -+ have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR'_le -+ simpa using hzR'' -+ have hBnz : B z ≠ 0 := hB_ne_zero z hzR -+ have hJd := hJ_deriv z hz -+ have hmult := congrArg (fun t => t * B z) hJd -+ have hR2 : (deriv B z / B z) * B z = deriv B z * B z / B z := by -+ simpa using (div_mul_eq_mul_div (deriv B z) (B z) (B z)) -+ have hmult' : deriv J z * B z = deriv B z * B z / B z := by -+ simpa [hR2] using hmult -+ have hdiv' : deriv B z * B z / B z = deriv B z := by -+ field_simp [hBnz] -+ calc -+ deriv J z * B z = deriv B z * B z / B z := hmult' -+ _ = deriv B z := by simpa using hdiv' -+ -+lemma log_deriv_identity -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z * B z - deriv B z = 0 := by -+ intro z hz -+ have h_eq := log_deriv_id hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ rw [h_eq] -+ simp -+ -+lemma H_derivative_quotient_rule -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (_hJ_zero : J 0 = 0) -+ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = -+ (deriv (fun w => Complex.exp (J w)) z * B z - deriv B z * Complex.exp (J z)) / (B z)^2 := by -+ intro z hz -+ -+ have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by -+ have hzR' : dist z (0 : ℂ) ≤ r1 := hz -+ have hR_le : r1 ≤ R' := le_of_lt (hr1_lt_R') -+ have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR_le -+ simpa using hzR'' -+ -+ have hB_nz : B z ≠ 0 := hB_ne_zero z hzR -+ have hB' : AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by -+ apply AnalyticOnNhd.mono_closedBall R' hB -+ assumption -+ have hB_diff : DifferentiableAt ℂ B z := (hB' z hzR).differentiableAt -+ have hJ_diff : DifferentiableAt ℂ J z := (hJ z hz).differentiableAt -+ have hF_diff : DifferentiableAt ℂ (fun w => Complex.exp (J w)) z := hJ_diff.cexp -+ -+ have h := deriv_div (hc := hF_diff) (hd := hB_diff) (hx := hB_nz) -+ unfold H_auxiliary -+ simpa only [Pi.div_def, mul_comm] using h -+ -+lemma exp_I_derivative_chain_rule -+ {r1 R' R : ℝ} -+ (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (_hJ_zero : J 0 = 0) -+ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ deriv (fun w => Complex.exp (J w)) z = deriv J z * Complex.exp (J z) := by -+ intro z hz -+ have hJ_diff : DifferentiableAt ℂ J z := (hJ z hz).differentiableAt -+ have hJ_has : HasDerivAt J (deriv J z) z := hJ_diff.hasDerivAt -+ have hcomp := (Complex.hasDerivAt_exp (J z)).comp z hJ_has -+ -+ simpa only [Function.comp_def, mul_comm] using hcomp.deriv -+ -+lemma H_derivative_calc -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = -+ (deriv J z * B z - deriv B z) * Complex.exp (J z) / (B z)^2 := by -+ intro z hz -+ -+ have hquot := H_derivative_quotient_rule hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ -+ have hchain := exp_I_derivative_chain_rule hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ -+ rw [hquot, hchain] -+ -+ have h1 : deriv J z * Complex.exp (J z) * B z - deriv B z * Complex.exp (J z) = -+ Complex.exp (J z) * (deriv J z * B z - deriv B z) := by ring -+ rw [h1] -+ -+ ring -+ -+lemma H_derivative_is_zero -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := by -+ intro z hz -+ have hcalc := -+ H_derivative_calc hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ have hident := -+ log_deriv_identity hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ simpa [hident] using hcalc -+ -+lemma zero_mem_closedBall_zero_radius {r1 : ℝ} (hr1 : 0 ≤ r1) : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) r1 := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hr1 -+ -+lemma H_deriv_zero_on_closedBall -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := by -+ simpa using -+ (H_derivative_is_zero hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv) -+ -+lemma H_auxiliary_differentiableOn_closedBall -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) : -+ DifferentiableOn ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (Metric.closedBall (0 : ℂ) r1) := -+by -+ -+ have hsubset : Metric.closedBall (0 : ℂ) r1 ⊆ Metric.closedBall (0 : ℂ) R := by -+ intro z hz -+ have hz' : dist z (0 : ℂ) ≤ r1 := by -+ simpa [Metric.mem_closedBall] using hz -+ have hle : r1 ≤ R := le_of_lt (lt_trans hr1_lt_R' hR'_lt_R) -+ have : dist z (0 : ℂ) ≤ R := le_trans hz' hle -+ simpa [Metric.mem_closedBall] using this -+ -+ have hJ_diff : DifferentiableOn ℂ J (Metric.closedBall (0 : ℂ) r1) := -+ hJ.differentiableOn -+ have hB_diff_r1 : DifferentiableOn ℂ B (Metric.closedBall (0 : ℂ) r1) := -+ (hB.differentiableOn).mono hsubset -+ -+ have hExp_diff : DifferentiableOn ℂ Complex.exp (Set.univ : Set ℂ) := -+ (Complex.differentiable_exp.differentiableOn) -+ have hExp_comp : DifferentiableOn ℂ (fun z => Complex.exp (J z)) (Metric.closedBall (0 : ℂ) r1) := by -+ refine hExp_diff.comp hJ_diff ?_ -+ intro x hx; simp -+ -+ have hB_ne_zero_r1 : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z ≠ 0 := by -+ intro z hz; exact hB_ne_zero z (by -+ have x : Metric.closedBall 0 r1 ⊆ Metric.closedBall 0 R' := Metric.closedBall_subset_closedBall (le_of_lt hr1_lt_R') -+ simp -+ simp at hz -+ linarith -+ ) -+ -+ have hdiv : DifferentiableOn ℂ (fun z => Complex.exp (J z) / B z) -+ (Metric.closedBall (0 : ℂ) r1) := -+ hExp_comp.div hB_diff_r1 hB_ne_zero_r1 -+ -+ unfold H_auxiliary -+ exact hdiv -+ -+lemma hasDerivAt_H_auxiliary_zero_on_closedBall -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ HasDerivAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) 0 z := by -+ intro z hz -+ -+ have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by -+ have hzR' : dist z (0 : ℂ) ≤ r1 := by -+ simpa [Metric.mem_closedBall] using hz -+ have hR_le : r1 ≤ R' := le_of_lt (hr1_lt_R') -+ have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR_le -+ simpa [Metric.mem_closedBall] using hzR'' -+ have hBnz : B z ≠ 0 := hB_ne_zero z (hzR) -+ -+ have hJ_anal : AnalyticAt ℂ J z := hJ z hz -+ have hExp_diff_at_Jz : DifferentiableAt ℂ Complex.exp (J z) := -+ Complex.differentiableAt_exp -+ have hc_diff : DifferentiableAt ℂ (fun w => Complex.exp (J w)) z := -+ hExp_diff_at_Jz.comp z hJ_anal.differentiableAt -+ -+ have hB' : AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by -+ apply AnalyticOnNhd.mono_closedBall R' hB -+ assumption -+ have hd_diff : DifferentiableAt ℂ B z := (hB' z hzR).differentiableAt -+ -+ have hH_diff : DifferentiableAt ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z := by -+ unfold H_auxiliary -+ convert hc_diff.div hd_diff hBnz using 1 -+ have hH_has : HasDerivAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z) z := -+ hH_diff.hasDerivAt -+ have hderiv0 : deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := -+ H_deriv_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ simpa [hderiv0] using hH_has -+ -+lemma fderivWithin_eq_zero_of_derivWithin_eq_zero {s : Set ℂ} {f : ℂ → ℂ} {x : ℂ} -+ (_hdiff : DifferentiableWithinAt ℂ f s x) -+ (hderiv : derivWithin f s x = 0) : -+ fderivWithin ℂ f s x = 0 := by -+ rw [← toSpanSingleton_derivWithin, hderiv] -+ simp -+ -+lemma hasDerivWithinAt_of_hasDerivAt {f : ℂ → ℂ} {s : Set ℂ} {x : ℂ} -+ (h : HasDerivAt f 0 x) : HasDerivWithinAt f 0 s x := by -+ simpa using h.hasDerivWithinAt -+ -+lemma uniqueDiffWithinAt_closedBall (r1 : ℝ) {x : ℂ} -+ (hr1 : 0 < r1) (hx : x ∈ Metric.closedBall (0 : ℂ) r1) : -+ UniqueDiffWithinAt ℝ (Metric.closedBall (0 : ℂ) r1) x := by -+ -+ have hconv : Convex ℝ (Metric.closedBall (0 : ℂ) r1) := by -+ simpa using (convex_closedBall (0 : ℂ) r1) -+ -+ have hinter_eq : interior (Metric.closedBall (0 : ℂ) r1) = Metric.ball (0 : ℂ) r1 := by -+ simpa using (interior_closedBall (x := (0 : ℂ)) (r := r1) (hr := ne_of_gt hr1)) -+ have hball_nonempty : (Metric.ball (0 : ℂ) r1).Nonempty := -+ ⟨0, by simpa [Metric.mem_ball, dist_eq_norm] using hr1⟩ -+ have hinter : (interior (Metric.closedBall (0 : ℂ) r1)).Nonempty := by -+ simpa [hinter_eq] using hball_nonempty -+ -+ have hx_closure : x ∈ closure (Metric.closedBall (0 : ℂ) r1) := subset_closure hx -+ -+ simpa using uniqueDiffWithinAt_convex hconv hinter hx_closure -+ -+lemma H_auxiliary_fderivWithin_zero_on_closedBall -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (Metric.closedBall (0 : ℂ) r1) z = 0 := -+by -+ intro z hz -+ -+ have hHasAt := -+ hasDerivAt_H_auxiliary_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero -+ hJ hJ_zero hJ_deriv z hz -+ have hHasWithin : -+ HasDerivWithinAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) 0 -+ (Metric.closedBall (0 : ℂ) r1) z := -+ hasDerivWithinAt_of_hasDerivAt hHasAt -+ -+ have hdiff : DifferentiableWithinAt ℂ -+ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (Metric.closedBall (0 : ℂ) r1) z := -+ hHasWithin.differentiableWithinAt -+ -+ classical -+ have hderivWithin0 : -+ derivWithin (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (Metric.closedBall (0 : ℂ) r1) z = 0 := by -+ by_cases hUDc : UniqueDiffWithinAt ℂ (Metric.closedBall (0 : ℂ) r1) z -+ · simpa using hHasWithin.derivWithin hUDc -+ · simpa using -+ (derivWithin_zero_of_not_uniqueDiffWithinAt -+ (𝕜 := ℂ) -+ (f := H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (s := Metric.closedBall (0 : ℂ) r1) (x := z) hUDc) -+ -+ exact fderivWithin_eq_zero_of_derivWithin_eq_zero hdiff hderivWithin0 -+ -+lemma H_is_constant -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z = -+ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 := by -+ intro z hz -+ -+ have hs : Convex ℝ (Metric.closedBall (0 : ℂ) r1) := by -+ simpa using (convex_closedBall (0 : ℂ) r1) -+ -+ have hdiff : DifferentiableOn ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (Metric.closedBall (0 : ℂ) r1) := -+ H_auxiliary_differentiableOn_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ -+ -+ have hfderiv0 : ∀ x ∈ Metric.closedBall (0 : ℂ) r1, -+ fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (Metric.closedBall (0 : ℂ) r1) x = 0 := -+ H_auxiliary_fderivWithin_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv -+ -+ have h0mem : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) r1 := -+ zero_mem_closedBall_zero_radius (le_of_lt hr1_pos) -+ -+ have hbound : ∀ x ∈ Metric.closedBall (0 : ℂ) r1, -+ ‖fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (Metric.closedBall (0 : ℂ) r1) x‖ ≤ 0 := by -+ intro x hx -+ simp [hfderiv0 x hx] -+ have hineq := -+ Convex.norm_image_sub_le_of_norm_fderivWithin_le (𝕜 := ℂ) -+ (f := H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) -+ (s := Metric.closedBall (0 : ℂ) r1) (x := (0 : ℂ)) (y := z) -+ hdiff hbound hs h0mem hz -+ have hzero : H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z - -+ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 = 0 := by -+ have : ‖H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z - -+ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0‖ ≤ 0 := by -+ simpa using hineq -+ simpa [norm_le_zero_iff] using this -+ simpa [sub_eq_add_neg] using sub_eq_zero.mp hzero -+ -+lemma H_is_one -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z = 1 / B 0 := by -+ intro z hz -+ have hconst := H_is_constant hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ have h0 := H_at_zero hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv -+ simpa [h0] using hconst -+ -+lemma analytic_log_exists -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z = B 0 * Complex.exp (J z) := by -+ intro z hz -+ -+ have hH_const := H_is_one hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ -+ unfold H_auxiliary at hH_const -+ -+ have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by -+ have hzR' : dist z (0 : ℂ) ≤ r1 := hz -+ have hR_le : r1 ≤ R := le_of_lt (lt_trans hr1_lt_R' hR'_lt_R) -+ exact le_trans hzR' (by linarith) -+ have hBnz : B z ≠ 0 := hB_ne_zero z hzR -+ have hR_pos : 0 < R := lt_trans (lt_trans hr1_pos hr1_lt_R') hR'_lt_R -+ have hB0nz : B 0 ≠ 0 := hB_ne_zero 0 (by -+ simp [Metric.closedBall, dist_zero_right] -+ exact le_of_lt (by linarith)) -+ -+ have heq : Complex.exp (J z) * B 0 = B z := by -+ field_simp [hBnz, hB0nz] at hH_const -+ exact hH_const -+ -+ rw [← heq, mul_comm] -+ -+lemma modulus_of_exp_I -+ {r1 R' R : ℝ} -+ (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (_hJ_zero : J 0 = 0) -+ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ norm (Complex.exp (J z)) = Real.exp (Complex.re (J z)) := by -+ intro z hz -+ exact Complex.norm_exp (J z) -+ -+lemma modulus_of_B_product_form -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ norm (B z) = norm (B 0) * norm (Complex.exp (J z)) := by -+ intro z hz -+ have hBform := analytic_log_exists hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ -+ simpa [norm_mul] using (congrArg norm hBform) -+ -+lemma modulus_of_exp_log -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ norm (B z) = norm (B 0) * Real.exp (Complex.re (J z)) := by -+ intro z hz -+ rw [modulus_of_B_product_form hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz] -+ rw [modulus_of_exp_I hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz] -+ -+lemma log_modulus_as_sum -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ Real.log (norm (B z)) = -+ Real.log (norm (B 0)) + Real.log (Real.exp (Complex.re (J z))) := by -+ intro z hz -+ -+ have h_eq := modulus_of_exp_log hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ -+ rw [h_eq, Real.log_mul] -+ · -+ -+ simp -+ apply hB_ne_zero -+ -+ rw [Metric.mem_closedBall, dist_self] -+ linarith -+ · -+ exact Real.exp_ne_zero _ -+ -+lemma real_log_of_modulus_difference -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) -+ {J : ℂ → ℂ} -+ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) -+ (hJ_zero : J 0 = 0) -+ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ Real.log (norm (B z)) - Real.log (norm (B 0)) = Complex.re (J z) := by -+ intro z hz -+ -+ have h_sum := log_modulus_as_sum hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz -+ -+ rw [h_sum] -+ -+ rw [Real.log_exp] -+ ring -+ -+theorem log_of_analytic -+ {r1 R' R : ℝ} -+ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) -+ {B : ℂ → ℂ} -+ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) -+ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) : -+ ∃ J_B : ℂ → ℂ, -+ AnalyticOnNhd ℂ J_B (Metric.closedBall (0 : ℂ) r1) ∧ -+ J_B 0 = 0 ∧ -+ (∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J_B z = deriv B z / B z) ∧ -+ (∀ z ∈ Metric.closedBall (0 : ℂ) r1, -+ Real.log (norm (B z)) - Real.log (norm (B 0)) = Complex.re (J_B z)) := by -+ have hB_ne_zero_R' : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0 := hB_ne_zero -+ obtain ⟨J_B, hJ, hJ0, hJderiv⟩ := -+ I_is_antiderivative hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero_R' -+ refine ⟨J_B, hJ, hJ0, hJderiv, ?_⟩ -+ intro z hz -+ simpa using -+ (real_log_of_modulus_difference hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ0 hJderiv z hz) -+ -+end Erdos970 -diff --git a/StrongPNT/Erdos970/PNT2_LogDerivative.lean b/StrongPNT/Erdos970/PNT2_LogDerivative.lean -new file mode 100644 -index 0000000..4d1d6e5 ---- /dev/null -+++ b/StrongPNT/Erdos970/PNT2_LogDerivative.lean -@@ -0,0 +1,3971 @@ -+import StrongPNT.Erdos970.PNT1_ComplexAnalysis -+ -+namespace Erdos970 -+ -+ -+lemma DRinD1 (R : ℝ) (_hR : 0 < R) (hR' : R < 1) : -+ Metric.closedBall (0 : ℂ) R ⊆ Metric.ball (0 : ℂ) 1 := by -+ exact Metric.closedBall_subset_ball hR' -+def zerosetKfR (R : ℝ) (_hR : 0 < R) (f : ℂ → ℂ) : Set ℂ := -+ {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ f ρ = 0} -+lemma lemKinDR (R : ℝ) (hR : 0 < R) (f : ℂ → ℂ) : -+ zerosetKfR R hR f ⊆ Metric.closedBall (0 : ℂ) R := by -+ intro ρ hρ -+ -+ rw [zerosetKfR] at hρ -+ -+ exact hρ.1 -+lemma lemKRinK1 (R : ℝ) (hR : 0 < R) (hR' : R < 1) (f : ℂ → ℂ) : -+ zerosetKfR R hR f ⊆ {ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0} := by -+ intro ρ hρ -+ simp only [zerosetKfR, Set.mem_ofPred_eq] at hρ ⊢ -+ constructor -+ · exact DRinD1 R hR hR' hρ.1 -+ · exact hρ.2 -+ -+lemma lem_bolzano_weierstrass {D : Set ℂ} (hD : IsCompact D) {Z : Set ℂ} (hZ_inf : Z.Infinite) (hZ_sub_D : Z ⊆ D) : -+ ∃ ρ₀ ∈ D, AccPt ρ₀ (Filter.principal Z) := -+ Set.Infinite.exists_accPt_of_subset_isCompact hZ_inf hD hZ_sub_D -+lemma lem_zeros_have_limit_point (R : ℝ) (hR : 0 < R) (f : ℂ → ℂ) (h_Kf_inf : Set.Infinite (zerosetKfR R hR f)) : -+ ∃ ρ₀ ∈ Metric.closedBall (0 : ℂ) R, AccPt ρ₀ (Filter.principal (zerosetKfR R hR f)) := by -+ apply lem_bolzano_weierstrass -+ · -+ rw [← lem_ballDR R hR] -+ exact lem_DRcompact R hR -+ · exact h_Kf_inf -+ · exact lemKinDR R hR f -+ -+open Filter Metric Set Bornology Function -+ -+lemma lem_identity_theorem (f : ℂ → ℂ) -+ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) -+ (ρ₀ : ℂ) (hρ₀_in_D1 : ρ₀ ∈ Metric.ball (0 : ℂ) 1) -+ (h_acc : AccPt ρ₀ (Filter.principal ({ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0}))) : -+ EqOn f 0 (Metric.ball (0 : ℂ) 1) := by -+ -+ have h_subset : Metric.ball (0 : ℂ) 1 ⊆ Metric.closedBall (0 : ℂ) 1 := Metric.ball_subset_closedBall -+ -+ have hf_open : AnalyticOnNhd ℂ f (Metric.ball (0 : ℂ) 1) := AnalyticOnNhd.mono hf h_subset -+ -+ have h_conn : IsConnected (Metric.ball (0 : ℂ) 1) := Metric.isConnected_ball (by norm_num : (0 : ℝ) < 1) -+ have h_preconn : IsPreconnected (Metric.ball (0 : ℂ) 1) := h_conn.isPreconnected -+ -+ have h_zeros_subset : {ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0} ⊆ {z | f z = 0} := by -+ intro z hz -+ exact hz.2 -+ -+ have h_acc_zero : AccPt ρ₀ (Filter.principal ({z | f z = 0})) := by -+ exact AccPt.mono h_acc (principal_mono.2 h_zeros_subset) -+ -+ have h_closure : ρ₀ ∈ closure ({z | f z = 0} \ {ρ₀}) := by -+ -+ have h_cluster : ClusterPt ρ₀ (Filter.principal ({z | f z = 0} \ {ρ₀})) := -+ (accPt_principal_iff_clusterPt).mp h_acc_zero -+ exact (mem_closure_iff_clusterPt).2 h_cluster -+ -+ exact AnalyticOnNhd.eqOn_zero_of_preconnected_of_mem_closure hf_open h_preconn hρ₀_in_D1 h_closure -+lemma lem_identity_theoremR (R : ℝ) (hR : 0 < R) (hR' : R < 1) -+ (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) -+ (ρ₀ : ℂ) (hρ₀_in_DR : ρ₀ ∈ Metric.closedBall (0 : ℂ) R) -+ (h_acc : AccPt ρ₀ (Filter.principal ({ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0}))) : -+ EqOn f 0 (Metric.ball (0 : ℂ) 1) := by -+ have hρ₀_in_D1 : ρ₀ ∈ Metric.ball (0 : ℂ) 1 := DRinD1 R hR hR' hρ₀_in_DR -+ exact lem_identity_theorem f hf ρ₀ hρ₀_in_D1 h_acc -+lemma lem_identity_theoremKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) -+ (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) -+ (h_exists_rho0 : ∃ ρ₀ ∈ Metric.closedBall (0 : ℂ) R, AccPt ρ₀ (Filter.principal (zerosetKfR R hR f))) : -+ EqOn f 0 (Metric.ball (0 : ℂ) 1) := by -+ -+ obtain ⟨ρ₀, hρ₀_in_R, h_acc⟩ := h_exists_rho0 -+ -+ apply lem_identity_theoremR R hR hR' f hf ρ₀ hρ₀_in_R -+ -+ exact AccPt.mono h_acc (principal_mono.2 (lemKRinK1 R hR hR' f)) -+lemma lem_identity_infiniteKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) -+ (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) -+ (h_Kf_inf : Set.Infinite (zerosetKfR R hR f)) : -+ EqOn f 0 (Metric.ball (0 : ℂ) 1) := by -+ have h_exists_rho0 := lem_zeros_have_limit_point R hR f h_Kf_inf -+ exact lem_identity_theoremKR R hR hR' f hf h_exists_rho0 -+lemma lem_Contra_finiteKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) -+ (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) -+ (h_exists_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, f z ≠ 0) : -+ Set.Finite (zerosetKfR R hR f) := by -+ -+ by_contra h_not_finite -+ -+ have h_Kf_inf : Set.Infinite (zerosetKfR R hR f) := h_not_finite -+ -+ have h_eq_zero := lem_identity_infiniteKR R hR hR' f hf h_Kf_inf -+ -+ obtain ⟨z, hz_in_ball, hz_nonzero⟩ := h_exists_nonzero -+ have h_f_z_zero : f z = 0 := h_eq_zero hz_in_ball -+ exact hz_nonzero h_f_z_zero -+ -+open Classical -+ -+lemma lem_frho_zero (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (_hR1_lt_R : R1 < R) -+ (f : ℂ → ℂ) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : -+ f ρ = 0 := h_rho_in_KfR1.2 -+ -+lemma lem_m_rho_is_nat (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hR_lt_1 : R < 1) : -+ ∀ (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f), -+ analyticOrderAt f ρ ≠ ⊤ := by -+ intro ρ h_rho_in_KfR1 -+ -+ have hρ_closed_R1 : ρ ∈ Metric.closedBall (0 : ℂ) R1 := h_rho_in_KfR1.1 -+ -+ have hR1_le_R : R1 ≤ R := by linarith -+ have hR1_lt_one : R1 < 1 := by linarith -+ -+ have hρ_ball1 : ρ ∈ Metric.ball (0 : ℂ) 1 := by -+ have hdist_le : dist ρ (0 : ℂ) ≤ R1 := (Metric.mem_closedBall.mp hρ_closed_R1) -+ have hdist_lt : dist ρ (0 : ℂ) < 1 := by linarith -+ simpa [Metric.mem_ball] using hdist_lt -+ -+ have hf_at_ρ : AnalyticAt ℂ f ρ := by -+ -+ have hsubset : Metric.closedBall (0 : ℂ) R1 ⊆ Metric.closedBall (0 : ℂ) 1 := -+ Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_one) -+ have hρ_closed1 : ρ ∈ Metric.closedBall (0 : ℂ) 1 := hsubset hρ_closed_R1 -+ exact h_f_analytic ρ hρ_closed1 -+ -+ by_contra htop -+ -+ have h_eventually_zero : ∀ᶠ z in nhds ρ, f z = 0 := by -+ have h_equiv : (analyticOrderAt f ρ = ⊤ ↔ ∀ᶠ z in nhds ρ, f z = 0) := by -+ simp [analyticOrderAt, hf_at_ρ] -+ exact h_equiv.mp (by simpa using htop) -+ -+ have hf_on_ball : AnalyticOnNhd ℂ f (Metric.ball (0 : ℂ) 1) := by -+ intro z hz -+ have hz' : z ∈ Metric.closedBall (0 : ℂ) 1 := -+ (Metric.ball_subset_closedBall : Metric.ball (0 : ℂ) 1 ⊆ Metric.closedBall (0 : ℂ) 1) hz -+ exact h_f_analytic z hz' -+ -+ have h_preconn : IsPreconnected (Metric.ball (0 : ℂ) 1) := -+ (Metric.isConnected_ball (by exact (zero_lt_one : (0 : ℝ) < 1))).isPreconnected -+ -+ have h_eqOn_zero : Set.EqOn f 0 (Metric.ball (0 : ℂ) 1) := -+ AnalyticOnNhd.eqOn_zero_of_preconnected_of_eventuallyEq_zero hf_on_ball h_preconn hρ_ball1 -+ h_eventually_zero -+ -+ have h0_in_ball : (0 : ℂ) ∈ Metric.ball (0 : ℂ) 1 := by -+ simp [Metric.mem_ball] -+ have : f 0 = 0 := by -+ have h := h_eqOn_zero h0_in_ball -+ simpa [Pi.zero_apply] using h -+ exact h_f_nonzero_at_zero this -+ -+lemma analyticOrderAt_ge_one_of_zero (f : ℂ → ℂ) (z : ℂ) (hf : AnalyticAt ℂ f z) (hz : f z = 0) (hfinite : analyticOrderAt f z ≠ ⊤) : analyticOrderAt f z ≥ 1 := by -+ -+ have h_order_ne_zero : analyticOrderAt f z ≠ 0 := by -+ intro h_order_zero -+ -+ have h_f_ne_zero : f z ≠ 0 := by -+ rw [← AnalyticAt.analyticOrderAt_eq_zero hf] -+ exact h_order_zero -+ -+ exact h_f_ne_zero hz -+ -+ cases' h : analyticOrderAt f z with n -+ · -+ -+ rw [h] at hfinite -+ exact False.elim (hfinite rfl) -+ · -+ -+ rw [h] at h_order_ne_zero -+ have n_ne_zero : n ≠ 0 := by -+ intro n_zero -+ rw [n_zero, Nat.cast_zero] at h_order_ne_zero -+ exact h_order_ne_zero rfl -+ -+ have n_ge_one : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr n_ne_zero -+ -+ exact Nat.cast_le.mpr n_ge_one -+ -+lemma lem_m_rho_ge_1 (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hR_lt_1 : R < 1) : -+ ∀ (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f), -+ analyticOrderAt f ρ ≥ 1 := by -+ intro ρ h_rho_in_KfR1 -+ -+ have h_f_rho_zero : f ρ = 0 := lem_frho_zero R R1 hR1_pos hR1_lt_R f h_f_analytic ρ h_rho_in_KfR1 -+ -+ have h_order_finite : analyticOrderAt f ρ ≠ ⊤ := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 ρ h_rho_in_KfR1 -+ -+ have h_f_analytic_at_rho : AnalyticAt ℂ f ρ := by -+ apply h_f_analytic -+ -+ have h_R1_lt_1 : R1 < 1 := by linarith -+ have h_rho_in_R1 : ρ ∈ Metric.closedBall 0 R1 := h_rho_in_KfR1.1 -+ exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) h_rho_in_R1 -+ -+ exact analyticOrderAt_ge_one_of_zero f ρ h_f_analytic_at_rho h_f_rho_zero h_order_finite -+ -+noncomputable def Cf -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (_hR1_lt_R : R1 < R) -+ (_hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (_h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (z : ℂ) : ℂ := -+ if hz : z ∈ zerosetKfR R1 (by linarith) f then -+ h_σ z z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase z), (z - ρ) ^ (analyticOrderAt f ρ).toNat -+ else -+ f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat -+ -+lemma lem_analDiv (R : ℝ) (_hR_pos : 0 < R) (_hR_lt_1 : R < 1) (w : ℂ) -+ (_hw : w ∈ Metric.closedBall (0 : ℂ) R) -+ (h : ℂ → ℂ) (g : ℂ → ℂ) -+ (hh : AnalyticAt ℂ h w) (hg : AnalyticAt ℂ g w) (hg_ne : g w ≠ 0) : -+ AnalyticAt ℂ (fun z => h z / g z) w := by -+ convert hh.div hg hg_ne using 1 -+ -+lemma lem_denomAnalAt (S : Finset ℂ) (n : ℂ → ℕ) -+ (_hn_pos : ∀ s ∈ S, 0 < n s) (w : ℂ) (hw : w ∉ S) : -+ AnalyticAt ℂ (fun z => ∏ s ∈ S, (z - s) ^ (n s)) w ∧ -+ (∏ s ∈ S, (w - s) ^ (n s)) ≠ 0 := by -+ constructor -+ · -+ -+ let f : ℂ → ℂ → ℂ := fun s z => (z - s) ^ (n s) -+ have h_each_analytic : ∀ s ∈ S, AnalyticAt ℂ (f s) w := by -+ intro s hs -+ simp only [f] -+ -+ have h_sub : AnalyticAt ℂ (fun z => z - s) w := by -+ exact AnalyticAt.sub analyticAt_id analyticAt_const -+ -+ exact h_sub.pow (n s) -+ have h_prod := Finset.analyticAt_prod S h_each_analytic -+ convert h_prod using 1 -+ first | rfl | (ext z; simp [f]) -+ · -+ apply Finset.prod_ne_zero_iff.mpr -+ intro s hs -+ apply pow_ne_zero -+ -+ intro h_eq -+ -+ have h_w_eq_s : w = s := by -+ rwa [← sub_eq_zero] -+ -+ rw [h_w_eq_s] at hw -+ exact hw hs -+ -+lemma lem_ratioAnalAt (w : ℂ) (R R1 : ℝ) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) -+ (h : ℂ → ℂ) (hh : AnalyticAt ℂ h w) -+ (S : Finset ℂ) (_hS : ↑S ⊆ Metric.closedBall (0 : ℂ) R1) (n : ℂ → ℕ) -+ (hn_pos : ∀ s ∈ S, 0 < n s) -+ (hw : w ∈ Metric.closedBall (0 : ℂ) 1 \ ↑S) : -+ AnalyticAt ℂ (fun z => h z / ∏ s ∈ S, (z - s) ^ (n s)) w := by -+ classical -+ -+ have hden := lem_denomAnalAt (S := S) (n := n) -+ (_hn_pos := hn_pos) (w := w) -+ (hw := by simpa using hw.2) -+ -+ exact AnalyticAt.div hh hden.1 hden.2 -+ -+lemma lem_analytic_zero_factor (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : -+ ∃ h_σ : ℂ → ℂ, AnalyticAt ℂ h_σ σ ∧ h_σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ z := by -+ classical -+ -+ have hσ_closed_R1 : σ ∈ Metric.closedBall (0 : ℂ) R1 := hσ.1 -+ have hR1_le_R : R1 ≤ R := by linarith -+ have hR1_lt_one : R1 < 1 := by linarith -+ have hσ_closed1 : σ ∈ Metric.closedBall (0 : ℂ) 1 := -+ (Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_one)) hσ_closed_R1 -+ have hfσ : AnalyticAt ℂ f σ := h_f_analytic σ hσ_closed1 -+ -+ have h_order_finite : analyticOrderAt f σ ≠ ⊤ := -+ lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 σ hσ -+ -+ rcases (hfσ.analyticOrderAt_ne_top).mp h_order_finite with ⟨g, hgσ, hgσ_ne, h_eq⟩ -+ -+ have h_eq' : ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * g z := by -+ refine h_eq.mono ?_ -+ intro z hz -+ simpa [smul_eq_mul, analyticOrderNatAt] using hz -+ exact ⟨g, hgσ, hgσ_ne, h_eq'⟩ -+ -+lemma lem_Cf_analytic_off_K -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : -+ AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) z := by -+ -+ have h_ratio_analytic : AnalyticAt ℂ (fun w => f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) z := by -+ apply lem_ratioAnalAt z R R1 hR1_lt_R hR_lt_1 f -+ -+ · apply h_f_analytic -+ exact Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) hz.1 -+ -+ · intro ρ hρ -+ have h_mem : ρ ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hρ -+ exact h_mem.1 -+ -+ · intro s hs -+ have h_s_in_zeros : s ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hs -+ have h_order_ge_1 := lem_m_rho_ge_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros -+ have h_order_finite := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros -+ -+ cases' h_cases : analyticOrderAt f s with n -+ · -+ rw [h_cases] at h_order_finite -+ exact False.elim (h_order_finite rfl) -+ · -+ have n_ge_1 : n ≥ 1 := by -+ rw [h_cases] at h_order_ge_1 -+ exact Nat.cast_le.mp h_order_ge_1 -+ simp -+ exact Nat.pos_iff_ne_zero.mpr (ne_of_gt n_ge_1) -+ -+ · constructor -+ · exact Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) hz.1 -+ · -+ intro h_z_in_finset -+ have h_z_in_zeros : z ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp h_z_in_finset -+ exact hz.2 h_z_in_zeros -+ -+ have h_eventually_eq : (fun w => f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) =ᶠ[nhds z] -+ (fun w => Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ w) := by -+ -+ have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 -+ have h_open : IsOpen (Set.compl (zerosetKfR R1 (by linarith) f)) := h_finite_zeros.isClosed.isOpen_compl -+ apply Filter.eventually_of_mem (h_open.mem_nhds hz_not_in) -+ intro w hw_not_in_compl -+ -+ have hw_not_in_zeros : w ∉ zerosetKfR R1 (by linarith) f := hw_not_in_compl -+ -+ show f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat = -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ w -+ -+ rw [Cf, dite_eq_right hw_not_in_zeros] -+ -+ exact h_ratio_analytic.congr h_eventually_eq -+ -+lemma lem_Cf_at_sigma_onK -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : -+ ∀ᶠ z in nhds σ, z = σ → -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ h_σ z z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by -+ refine Filter.Eventually.of_forall ?_ -+ intro z hz -+ subst hz -+ simp [Cf, hσ] -+ -+lemma lem_K_isolated -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {_h_f_nonzero_at_zero : f 0 ≠ 0} -+ (σ ρ : ℂ) (_hσ : σ ∈ zerosetKfR R1 (by linarith) f) -+ (_hρ : ρ ∈ zerosetKfR R1 (by linarith) f) (hne : σ ≠ ρ) : -+ ∀ᶠ z in nhds σ, z ≠ ρ := eventually_ne_nhds hne -+ -+lemma lem_Cf_at_sigma_offK0 -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : -+ ∀ᶠ z in nhds σ, z ≠ σ → -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z / -+ ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by -+ -+ obtain ⟨h_σ_analytic, h_σ_ne_zero, h_f_eq⟩ := h_σ_spec σ hσ -+ -+ have h_σ_eventually_nonzero : ∀ᶠ z in nhds σ, h_σ σ z ≠ 0 := by -+ have h_cont : ContinuousAt (h_σ σ) σ := h_σ_analytic.continuousAt -+ exact h_cont.eventually_ne h_σ_ne_zero -+ -+ have h_f_eventually_nonzero : ∀ᶠ z in nhds σ, z ≠ σ → f z ≠ 0 := by -+ filter_upwards [h_f_eq, h_σ_eventually_nonzero] with z h_fz_eq h_σz_nonzero -+ intro hz_ne -+ rw [h_fz_eq] -+ apply mul_ne_zero -+ · apply pow_ne_zero -+ exact sub_ne_zero.mpr hz_ne -+ · exact h_σz_nonzero -+ -+ have h_eventually_not_in_zeroset : ∀ᶠ z in nhds σ, z ≠ σ → z ∉ zerosetKfR R1 (by linarith) f := by -+ filter_upwards [h_f_eventually_nonzero] with z h_fz_nonzero -+ intro hz_ne hz_in_zeroset -+ exact h_fz_nonzero hz_ne hz_in_zeroset.2 -+ -+ filter_upwards [h_f_eq, h_eventually_not_in_zeroset] with z h_fz_eq h_not_in_zeroset -+ intro hz_ne -+ -+ have hz_not_in_K : z ∉ zerosetKfR R1 (by linarith) f := h_not_in_zeroset hz_ne -+ -+ unfold Cf -+ simp [hz_not_in_K, h_fz_eq] -+ -+lemma lem_prod_no_sigma1 -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {_h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) (z : ℂ) : -+ ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat = -+ (z - σ) ^ (analyticOrderAt f σ).toNat * -+ ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by -+ classical -+ have hmem : σ ∈ h_finite_zeros.toFinset := -+ (Set.Finite.mem_toFinset (hs := h_finite_zeros)).2 hσ -+ simpa using -+ (Finset.mul_prod_erase (s := h_finite_zeros.toFinset) -+ (f := fun ρ => (z - ρ) ^ (analyticOrderAt f ρ).toNat) (a := σ) hmem).symm -+ -+lemma lem_prod_no_sigma2 -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) (z : ℂ) -+ (hz : z ∉ zerosetKfR R1 (by linarith) f) : -+ (z - σ) ^ (analyticOrderAt f σ).toNat / -+ ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat = -+ 1 / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by -+ -+ have h_factor := @lem_prod_no_sigma1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ z -+ rw [h_factor] -+ -+ rw [div_mul_eq_div_div] -+ -+ have h_nonzero : (z - σ) ^ (analyticOrderAt f σ).toNat ≠ 0 := by -+ apply pow_ne_zero -+ intro h_eq -+ -+ have h_z_eq_sigma : z = σ := sub_eq_zero.mp h_eq -+ rw [h_z_eq_sigma] at hz -+ exact hz hσ -+ -+ rw [div_self h_nonzero, one_div] -+ -+lemma lem_Cf_at_sigma_offK -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : -+ ∀ᶠ z in nhds σ, z ≠ σ → -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by -+ -+ have h_cf_form := @lem_Cf_at_sigma_offK0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ -+ -+ filter_upwards [h_cf_form] with z h_cf_z -+ intro hz_ne_sigma -+ -+ rw [h_cf_z hz_ne_sigma] -+ -+ have h_prod_decomp := @lem_prod_no_sigma1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ z -+ -+ rw [h_prod_decomp] -+ -+ apply mul_div_mul_left -+ -+ apply pow_ne_zero -+ exact sub_ne_zero.mpr hz_ne_sigma -+ -+lemma lem_Cf_at_sigma -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : -+ ∀ᶠ z in nhds σ, -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by -+ -+ have h_on := @lem_Cf_at_sigma_onK R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ -+ have h_off := @lem_Cf_at_sigma_offK R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ -+ -+ filter_upwards [h_on, h_off] with z hz_on hz_off -+ by_cases h : z = σ -+ · -+ have eq_result := hz_on h -+ -+ rw [h] at eq_result ⊢ -+ exact eq_result -+ · -+ exact hz_off h -+ -+lemma lem_h_ratio_anal -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (σ : ℂ) (_hσ : σ ∈ zerosetKfR R1 (by linarith) f) -+ (g : ℂ → ℂ) (hg_analytic : AnalyticAt ℂ g σ) : -+ AnalyticAt ℂ -+ (fun z => g z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), -+ (z - ρ) ^ (analyticOrderAt f ρ).toNat) σ := by -+ -+ have hden := lem_denomAnalAt (S := h_finite_zeros.toFinset.erase σ) -+ (n := fun ρ => (analyticOrderAt f ρ).toNat) -+ (_hn_pos := by -+ intro s hs -+ have h_s_in_zeros : s ∈ zerosetKfR R1 (by linarith) f := by -+ have h_mem_erase : s ∈ h_finite_zeros.toFinset.erase σ := hs -+ have h_mem_orig : s ∈ h_finite_zeros.toFinset := Finset.mem_of_mem_erase h_mem_erase -+ exact h_finite_zeros.mem_toFinset.mp h_mem_orig -+ have h_order_ge_1 := lem_m_rho_ge_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros -+ have h_order_finite := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros -+ cases' h_cases : analyticOrderAt f s with n -+ · -+ rw [h_cases] at h_order_finite -+ exact False.elim (h_order_finite rfl) -+ · -+ have n_ge_1 : n ≥ 1 := by -+ rw [h_cases] at h_order_ge_1 -+ exact Nat.cast_le.mp h_order_ge_1 -+ simp -+ exact Nat.pos_iff_ne_zero.mpr (ne_of_gt n_ge_1)) -+ (w := σ) -+ (hw := by -+ simp [Finset.mem_erase]) -+ -+ exact AnalyticAt.div hg_analytic hden.1 hden.2 -+ -+lemma lem_Cf_analytic_at_K -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : -+ AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) σ := by -+ -+ have h_eventually_eq := @lem_Cf_at_sigma R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ -+ -+ obtain ⟨h_σ_analytic, _, _⟩ := h_σ_spec σ hσ -+ have h_ratio_analytic := @lem_h_ratio_anal R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ (h_σ σ) h_σ_analytic -+ -+ have h_rev_eq : (fun z => h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat) =ᶠ[nhds σ] -+ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) := by -+ filter_upwards [h_eventually_eq] with z h_z -+ exact h_z.symm -+ -+ exact AnalyticAt.congr h_ratio_analytic h_rev_eq -+ -+lemma lem_Cf_is_analytic -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R) : -+ AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) z := by -+ -+ by_cases h_case : z ∈ zerosetKfR R1 (by linarith) f -+ -+ case pos => -+ -+ exact lem_Cf_analytic_at_K h_finite_zeros h_σ h_σ_spec z h_case -+ -+ case neg => -+ -+ have hz_in_complement : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f := by -+ constructor -+ · exact hz -+ · exact h_case -+ exact lem_Cf_analytic_off_K h_finite_zeros h_σ h_σ_spec z hz_in_complement -+ -+lemma lem_f_nonzero_off_K -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {_h_f_nonzero_at_zero : f 0 ≠ 0} -+ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : -+ f z ≠ 0 := by -+ exact fun h => hz.2 ⟨hz.1, h⟩ -+ -+lemma lem_Cf_nonzero_off_K -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z ≠ 0 := by -+ -+ have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 -+ -+ have h_cf_eq : Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by -+ unfold Cf -+ simp [hz_not_in] -+ -+ rw [h_cf_eq] -+ -+ apply div_ne_zero -+ -+ · apply @lem_f_nonzero_off_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero z hz -+ -+ · apply Finset.prod_ne_zero_iff.mpr -+ intro ρ hρ -+ -+ apply pow_ne_zero -+ -+ intro h_eq -+ -+ have hz_eq_rho : z = ρ := by -+ rwa [sub_eq_zero] at h_eq -+ -+ have hρ_in : ρ ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hρ -+ rw [hz_eq_rho] at hz_not_in -+ exact hz_not_in hρ_in -+ -+lemma lem_Cf_nonzero_on_K -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ σ ≠ 0 := by -+ have hnum : h_σ σ σ ≠ 0 := (h_σ_spec σ hσ).2.1 -+ have hden : -+ (∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), -+ (σ - ρ) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by -+ refine Finset.prod_ne_zero_iff.mpr ?_ -+ intro ρ hρmem -+ have hρ_ne_σ : ρ ≠ σ := (Finset.mem_erase.mp hρmem).1 -+ have hσ_ne_ρ : σ ≠ ρ := hρ_ne_σ.symm -+ exact pow_ne_zero _ (sub_ne_zero.mpr hσ_ne_ρ) -+ have : -+ h_σ σ σ / -+ ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), -+ (σ - ρ) ^ (analyticOrderAt f ρ).toNat ≠ -+ 0 := by -+ exact div_ne_zero hnum hden -+ simpa [Cf, hσ] using this -+ -+lemma lem_Cf_never_zero -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1) : -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z ≠ 0 := by -+ -+ by_cases h : z ∈ zerosetKfR R1 (by linarith) f -+ · -+ exact lem_Cf_nonzero_on_K h_finite_zeros h_σ h_σ_spec z h -+ · -+ have hz_diff : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f := ⟨hz, h⟩ -+ exact lem_Cf_nonzero_off_K h_finite_zeros h_σ h_σ_spec z hz_diff -+ -+lemma factor_nonzero_outside_domain (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) -+ (ρ : ℂ) (hρ_bound : ‖ρ‖ ≤ R1) (_hρ_ne_zero : ρ ≠ 0) (z : ℂ) (hz_in_R1 : ‖z‖ ≤ R1) : -+ (R : ℂ) - star ρ * z / (R : ℂ) ≠ 0 := by -+ -+ intro h_eq_zero -+ have hR_pos : 0 < R := by linarith -+ -+ have h_mul_eq_R_sq : star ρ * z = (R : ℂ) ^ 2 := by -+ have hR_ne_zero : (R : ℂ) ≠ 0 := by -+ rw [Ne, ← norm_eq_zero] -+ simp -+ linarith -+ -+ rw [sub_eq_zero] at h_eq_zero -+ rw [eq_div_iff_mul_eq hR_ne_zero] at h_eq_zero -+ rw [← pow_two] at h_eq_zero -+ exact h_eq_zero.symm -+ -+ have h_norm_eq : ‖ρ‖ * ‖z‖ = R ^ 2 := by -+ have h_left : ‖star ρ * z‖ = ‖ρ‖ * ‖z‖ := by -+ rw [norm_mul, norm_star] -+ have h_right : ‖(R : ℂ) ^ 2‖ = R ^ 2 := by -+ rw [Complex.norm_pow, Complex.norm_of_nonneg (le_of_lt hR_pos)] -+ rw [← h_left, h_mul_eq_R_sq, h_right] -+ -+ have h_R_sq_le : R ^ 2 ≤ R1 ^ 2 := by -+ calc R ^ 2 -+ = ‖ρ‖ * ‖z‖ := h_norm_eq.symm -+ _ ≤ R1 * ‖z‖ := mul_le_mul_of_nonneg_right hρ_bound (norm_nonneg z) -+ _ ≤ R1 * R1 := mul_le_mul_of_nonneg_left hz_in_R1 (le_of_lt hR1_pos) -+ _ = R1 ^ 2 := by rw [← pow_two] -+ -+ have h_R_le_R1 : R ≤ R1 := by -+ exact le_of_pow_le_pow_left₀ (by norm_num) (le_of_lt hR1_pos) h_R_sq_le -+ -+ linarith -+ -+lemma linear_pow_analytic (a b : ℂ) (n : ℕ) (z : ℂ) : -+ AnalyticAt ℂ (fun w => (a - b * w) ^ n) z := by -+ -+ have h_linear : AnalyticAt ℂ (fun w => a - b * w) z := by -+ -+ have h_const : AnalyticAt ℂ (fun _ => a) z := analyticAt_const -+ -+ have h_mul : AnalyticAt ℂ (fun w => b * w) z := by -+ have h_id : AnalyticAt ℂ (fun w => w) z := analyticAt_id -+ convert h_id.const_smul (c := b) using 1 -+ -+ exact h_const.sub h_mul -+ -+ exact h_linear.fun_pow n -+ -+lemma bl_num_diff -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {_h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R) : -+ DifferentiableAt ℂ -+ (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ · -+ have h_analytic : AnalyticAt ℂ (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ -+ let factor_func : ℂ → ℂ → ℂ := fun ρ w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat -+ -+ have h_each_analytic : ∀ ρ ∈ h_finite_zeros.toFinset, AnalyticAt ℂ (factor_func ρ) z := by -+ intro ρ hρ_mem -+ simp only [factor_func] -+ -+ have h_rewrite : (fun w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) = -+ (fun w => ((R : ℂ) - (star ρ / (R : ℂ)) * w) ^ (analyticOrderAt f ρ).toNat) := by -+ ext w -+ ring -+ rw [h_rewrite] -+ -+ exact linear_pow_analytic (R : ℂ) (star ρ / (R : ℂ)) (analyticOrderAt f ρ).toNat z -+ -+ have h_prod_analytic := Finset.analyticAt_prod h_finite_zeros.toFinset h_each_analytic -+ -+ convert h_prod_analytic using 1; first | rfl | (ext w; simp [factor_func]) -+ -+ exact h_analytic.differentiableAt -+ -+lemma lem_bl_num_nonzero -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : -+ (∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by -+ -+ · refine Finset.prod_ne_zero_iff.mpr ?_ -+ intro ρ hρ_mem -+ apply pow_ne_zero -+ -+ have hρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := -+ h_finite_zeros.mem_toFinset.mp hρ_mem -+ have hρ_bound : ‖ρ‖ ≤ R1 := by -+ -+ have : dist ρ 0 ≤ R1 := Metric.mem_closedBall.mp hρ_in_zeros.1 -+ simp only [dist_zero_right] at this -+ exact this -+ have hρ_ne_zero : ρ ≠ 0 := by -+ intro h_eq_zero -+ rw [h_eq_zero] at hρ_in_zeros -+ exact h_f_nonzero_at_zero hρ_in_zeros.2 -+ have hz_bound : ‖z‖ ≤ R1 := by -+ have : dist z 0 ≤ R1 := Metric.mem_closedBall.mp hz.1 -+ simp only [dist_zero_right] at this -+ exact this -+ exact factor_nonzero_outside_domain R R1 hR1_pos hR1_lt_R hR_lt_1 ρ hρ_bound hρ_ne_zero z hz_bound -+ -+noncomputable def Bf -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (z : ℂ) : ℂ := -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z * -+ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat -+ -+lemma lem_BfCf -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ f z * (∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) / -+ (∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat) := by -+ -+ have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 -+ -+ unfold Bf -+ -+ unfold Cf -+ simp [hz_not_in] -+ -+ exact div_mul_eq_mul_div _ _ _ -+ -+lemma lem_Bf_div -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {_h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : -+ (∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) / -+ (∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat) = -+ ∏ ρ ∈ h_finite_zeros.toFinset, -+ (((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat / -+ (z - ρ) ^ (analyticOrderAt f ρ).toNat) := by -+ rw [Finset.prod_div_distrib] -+ -+lemma lem_Bf_prodpow -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {_h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : -+ ∏ ρ ∈ h_finite_zeros.toFinset, -+ (((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat / -+ (z - ρ) ^ (analyticOrderAt f ρ).toNat) = -+ ∏ ρ ∈ h_finite_zeros.toFinset, -+ (((R : ℂ) - star ρ * z / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat := by -+ simp only [div_pow] -+ -+lemma lem_Bf_off_K -+ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} -+ {f : ℂ → ℂ} -+ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} -+ {h_f_nonzero_at_zero : f 0 ≠ 0} -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ f z * ∏ ρ ∈ h_finite_zeros.toFinset, -+ (((R : ℂ) - star ρ * z / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat := by -+ -+ rw [lem_BfCf h_finite_zeros h_σ z hz] -+ -+ rw [mul_div_assoc] -+ -+ congr 1 -+ -+ rw [@lem_Bf_div R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros z hz] -+ -+ rw [@lem_Bf_prodpow R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros z hz] -+ -+lemma lem_frho_zero_contra -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (_hR1_lt_R : R1 < R) -+ (f : ℂ → ℂ) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (ρ : ℂ) : f ρ ≠ 0 → ρ ∉ zerosetKfR R1 (by linarith) f := by -+ intro h_f_rho_ne_zero h_rho_in_KfR1 -+ -+ have h_f_rho_zero : f ρ = 0 := h_rho_in_KfR1.2 -+ -+ exact h_f_rho_ne_zero h_f_rho_zero -+ -+lemma lem_f_is_nonzero (f : ℂ → ℂ) : f 0 ≠ 0 → f ≠ 0 := by -+ intro h_f_zero_ne_zero h_f_eq_zero -+ -+ have h_f_at_zero_eq_zero : f 0 = 0 := by -+ rw [h_f_eq_zero] -+ simp -+ -+ exact h_f_zero_ne_zero h_f_at_zero_eq_zero -+ -+theorem lem_rho_in_disk_R1 -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (_hR1_lt_R : R1 < R) -+ (f : ℂ → ℂ) -+ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : -+ norm ρ ≤ R1 := by -+ -+ have h_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R1 := h_rho_in_KfR1.1 -+ -+ rw [Metric.mem_closedBall, Complex.dist_eq] at h_in_ball -+ simp only [sub_zero] at h_in_ball -+ exact h_in_ball -+ -+theorem lem_zero_not_in_Kf (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (_hR1_lt_R : R1 < R) -+ (f : ℂ → ℂ) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) : -+ f 0 ≠ 0 → 0 ∉ zerosetKfR R1 (by linarith) f := by -+ intro h_f_zero_ne_zero h_zero_in_KfR1 -+ -+ have h_f_zero_eq_zero : f 0 = 0 := h_zero_in_KfR1.2 -+ -+ exact h_f_zero_ne_zero h_f_zero_eq_zero -+ -+lemma lem_rho_ne_zero (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) : -+ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, ρ ≠ 0 := by -+ intro ρ h_ρ_in_zeros h_ρ_eq_zero -+ -+ rw [h_ρ_eq_zero] at h_ρ_in_zeros -+ -+ have h_zero_not_in : 0 ∉ zerosetKfR R1 (by linarith) f := -+ lem_zero_not_in_Kf R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero -+ exact h_zero_not_in h_ρ_in_zeros -+ -+lemma lem_mod_pos_iff_ne_zero (z : ℂ) : z ≠ 0 → norm z > 0 := -+ lem_abspos z -+ -+theorem lem_mod_rho_pos -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) : -+ ∀ (ρ : ℂ), ρ ∈ zerosetKfR R1 (by linarith) f → norm ρ > 0 := by -+ intro ρ h_ρ_in_zeros -+ -+ have h_ρ_ne_zero : ρ ≠ 0 := -+ lem_rho_ne_zero R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros -+ -+ exact lem_mod_pos_iff_ne_zero ρ h_ρ_ne_zero -+ -+theorem lem_rho_in_disk_R1_repeat (R R1 : ℝ) (hR1_pos : 0 < R1) -+(hR1_lt_R : R1 < R) (f : ℂ → ℂ) -+ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : -+ norm ρ ≤ R1 := -+ lem_rho_in_disk_R1 R R1 hR1_pos hR1_lt_R f ρ h_rho_in_KfR1 -+ -+lemma lem_inv_mono_decr (x y : ℝ) (hx : 0 < x) (hxy : x ≤ y) : 1 / x ≥ 1 / y := by -+ -+ have hy : 0 < y := lt_of_lt_of_le hx hxy -+ -+ exact one_div_le_one_div_of_le hx hxy -+ -+lemma lem_inv_mod_rho_ge_inv_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) -+(hR1_lt_R : R1 < R) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : -+ 1 / norm ρ ≥ 1 / R1 := by -+ -+ have h_abs_ρ_le_R1 : norm ρ ≤ R1 := -+ lem_rho_in_disk_R1 R R1 hR1_pos hR1_lt_R f ρ h_rho_in_KfR1 -+ -+ have h_abs_ρ_pos : norm ρ > 0 := -+ lem_mod_rho_pos R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 -+ -+ have h_R1_pos : R1 > 0 := by -+ linarith -+ -+ exact lem_inv_mono_decr (norm ρ) R1 h_abs_ρ_pos h_abs_ρ_le_R1 -+ -+theorem lem_mul_pos_preserves_ineq (a b c : ℝ) (hab : a ≤ b) (hc : 0 < c) : -+ a * c ≤ b * c := by -+ exact mul_le_mul_of_nonneg_right hab (le_of_lt hc) -+ -+theorem lem_R_div_mod_rho_ge_R_div_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) -+(hR1_lt_R : R1 < R) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) (ρ : ℂ) -+ (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : -+ R / norm ρ ≥ R / R1 := by -+ -+ have h_inv_ineq : 1 / norm ρ ≥ 1 / R1 := -+ lem_inv_mod_rho_ge_inv_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 -+ -+ have h_R_div_abs_ρ_eq : R * (1 / norm ρ) = R / norm ρ := by ring -+ have h_R_div_R1_eq : R * (1 / R1) = R / R1 := by ring -+ rw [← h_R_div_abs_ρ_eq, ← h_R_div_R1_eq] -+ exact mul_le_mul_of_nonneg_left h_inv_ineq (by linarith) -+ -+theorem lem_R_div_mod_rho_ge_R_over_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) -+(hR1_lt_R : R1 < R) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) (ρ : ℂ) -+ (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : -+ R / norm ρ ≥ (R/R1 : ℝ) := by -+ -+ have h_ineq1 : R / norm ρ ≥ R / R1 := -+ lem_R_div_mod_rho_ge_R_div_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 -+ -+ linarith -+ -+theorem lem_mod_of_prod2 {ι : Type*} (K : Finset ι) (w : ι → ℂ) : -+ ‖∏ ρ ∈ K, w ρ‖ = ∏ ρ ∈ K, ‖w ρ‖ := by -+ classical -+ refine Finset.induction_on K ?h0 ?hstep -+ · simp -+ · intro a s ha ih -+ -+ simp [Finset.prod_insert ha, ih] -+ -+lemma lem_mod_Bf_is_prod_mod (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (z : ℂ) -+ (hz : z ∉ zerosetKfR R1 (by linarith) f) : -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = -+ ‖f z‖ * ∏ ρ ∈ h_finite_zeros.toFinset, -+ ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat‖ := by -+ -+ unfold Bf -+ rw [norm_mul] -+ -+ rw [lem_mod_of_prod2] -+ -+ have hCf : Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by -+ unfold Cf -+ simp only [hz, ↓reduceDIte] -+ rw [hCf, norm_div] -+ -+ rw [lem_mod_of_prod2] -+ -+ rw [div_mul_eq_mul_div] -+ -+ rw [mul_div_assoc] -+ -+ rw [← Finset.prod_div_distrib] -+ congr 2 -+ ext ρ -+ -+ rw [← norm_div, ← div_pow] -+ congr 2 -+ -+ ring -+ -+lemma lem_abs_pow (w : ℂ) (n : ℕ) : ‖w ^ n‖ = ‖w‖ ^ n := by -+ simp -+ -+lemma lem_Bmod_pow (R R1 : ℝ) (hR_pos : 0 < R) (hR1 : R1 = 2 * R / 3) (f : ℂ → ℂ) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) -+ (z : ℂ) : -+ ‖((((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat)‖ = -+ (‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖) ^ (analyticOrderAt f ρ).toNat := by -+ simp -+ -+lemma lem_mod_Bf_prod_mod (R R1 : ℝ) (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (z : ℂ) -+ (hz : z ∉ zerosetKfR R1 (by linarith) f) : -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = -+ ‖f z‖ * ∏ ρ ∈ h_finite_zeros.toFinset, -+ ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ ^ (analyticOrderAt f ρ).toNat := by -+ -+ have h1 := lem_mod_Bf_is_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz -+ rw [h1] -+ -+ congr 2 -+ ext ρ -+ rw [lem_abs_pow] -+ -+lemma lem_mod_Bf_at_0 (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = -+ ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, -+ ‖((R : ℂ) / (-ρ))‖ ^ (analyticOrderAt f ρ).toNat := by -+ -+ have hz0 : 0 ∉ zerosetKfR R1 (by linarith) f := -+ lem_zero_not_in_Kf R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero -+ rw [lem_mod_Bf_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec 0 hz0] -+ -+ congr 2 -+ ext ρ -+ congr 1 -+ simp only [zero_mul, zero_div, sub_zero, zero_sub] -+ -+lemma lem_mod_div_ (w1 w2 : ℂ) (_hw2_ne_zero : w2 ≠ 0) : ‖w1 / w2‖ = ‖w1‖ / ‖w2‖ := by -+ simp -+ -+lemma lem_mod_neg (w : ℂ) : ‖-w‖ = ‖w‖ := by -+ simp -+ -+lemma lem_mod_div_and_neg (R : ℝ) (hR_pos : 0 < R) (ρ : ℂ) (h_rho_ne_zero : ρ ≠ 0) : -+ ‖(R : ℂ) / (-ρ)‖ = R / ‖ρ‖ := by -+ -+ have hden : (-ρ) ≠ 0 := by simpa using neg_ne_zero.mpr h_rho_ne_zero -+ have hdiv := lem_mod_div_ (R : ℂ) (-ρ) hden -+ calc -+ ‖(R : ℂ) / (-ρ)‖ = ‖(R : ℂ)‖ / ‖-ρ‖ := hdiv -+ _ = ‖(R : ℂ)‖ / ‖ρ‖ := by simp [norm_neg] -+ _ = |R| / ‖ρ‖ := by simp -+ _ = R / ‖ρ‖ := by simp [abs_of_pos hR_pos] -+ -+theorem lem_mod_Bf_at_0_eval (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = -+ ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, -+ (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by -+ -+ rw [lem_mod_Bf_at_0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec] -+ -+ congr 1 -+ -+ apply Finset.prod_congr rfl -+ intro ρ hρ -+ -+ have h_ρ_ne_zero : ρ ≠ 0 := by -+ -+ have h_ρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := by -+ exact (Set.Finite.mem_toFinset h_finite_zeros).mp hρ -+ exact lem_rho_ne_zero R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros -+ -+ rw [lem_mod_div_and_neg R (by linarith) ρ h_ρ_ne_zero] -+ -+lemma lem_mod_of_pos_real (x : ℝ) (hx : 0 < x) : abs x = x := by -+ exact abs_of_pos hx -+ -+theorem lem_mod_Bf_at_0_as_ratio (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = -+ ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, -+ (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by -+ exact lem_mod_Bf_at_0_eval R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec -+ -+lemma lem_prod_ineq {ι : Type*} (K : Finset ι) (a b : ι → ℝ) -+ (h_nonneg : ∀ ρ ∈ K, 0 ≤ a ρ) (h_le : ∀ ρ ∈ K, a ρ ≤ b ρ) : -+ ∏ ρ ∈ K, a ρ ≤ ∏ ρ ∈ K, b ρ := by -+ exact Finset.prod_le_prod₀ h_nonneg h_le -+ -+lemma lem_power_ineq (n : ℕ) (c : ℝ) (hc : c > 1) (hn : n ≥ 1) : c ≤ c ^ n := by -+ cases' n with n -+ · -+ omega -+ · -+ have h_c_ge_1 : 1 ≤ c := le_of_lt hc -+ rw [pow_succ] -+ -+ have h_c_pow_n_ge_1 : 1 ≤ c ^ n := by exact one_le_pow₀ h_c_ge_1 -+ calc c = c * 1 := (mul_one c).symm -+ _ ≤ c * c ^ n := mul_le_mul_of_nonneg_left h_c_pow_n_ge_1 (le_of_lt (lt_trans zero_lt_one hc)) -+ _ = c ^ n * c := mul_comm (c) (c ^ n) -+ -+lemma lem_power_ineq_1 (n : ℕ) (c : ℝ) (hc : 1 ≤ c) (_hn : 1 ≤ n) : 1 ≤ c ^ n := by -+ exact one_le_pow₀ hc -+ -+lemma lem_prod_power_ineq {ι : Type*} (K : Finset ι) (c : ι → ℝ) (n : ι → ℕ) -+ (h_c_ge_1 : ∀ ρ ∈ K, 1 ≤ c ρ) -+ (h_n_ge_1 : ∀ ρ ∈ K, 1 ≤ n ρ) : -+ ∏ ρ ∈ K, (c ρ) ^ (n ρ) ≥ 1 := by -+ classical -+ induction K using Finset.induction with -+ | empty => simp -+ | insert i s h_not_in ih => -+ rw [Finset.prod_insert h_not_in] -+ have h_pow_ge_1 : 1 ≤ c i ^ n i := -+ one_le_pow₀ (h_c_ge_1 i (Finset.mem_insert_self i s)) -+ have h_prod_ge_1 : 1 ≤ ∏ ρ ∈ s, (c ρ) ^ (n ρ) := by -+ apply ih -+ · intro ρ hρ; exact h_c_ge_1 ρ (Finset.mem_insert_of_mem hρ) -+ · intro ρ hρ; exact h_n_ge_1 ρ (Finset.mem_insert_of_mem hρ) -+ exact one_le_mul_of_one_le_of_one_le h_pow_ge_1 h_prod_ge_1 -+ -+theorem lem_prod_1 {ι : Type*} {M : Type*} [CommMonoid M] (K : Finset ι) : ∏ _ρ ∈ K, (1 : M) = 1 := by -+ exact Finset.prod_const_one -+ -+lemma lem_prod_power_ineq1 {ι : Type*} (K : Finset ι) (c : ι → ℝ) (n : ι → ℕ) -+ (h_c_ge_1 : ∀ ρ ∈ K, 1 ≤ c ρ) (h_n_ge_1 : ∀ ρ ∈ K, 1 ≤ n ρ) : -+ ∏ ρ ∈ K, (c ρ) ^ (n ρ) ≥ 1 := by -+ exact lem_prod_power_ineq K c n h_c_ge_1 h_n_ge_1 -+ -+lemma lem_mod_lower_bound_1 (R R1 : ℝ) (hR1_pos : 0 < R1) -+(hR1_lt_R : R1 < R) (f : ℂ → ℂ) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (_hf0_eq_one : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (_hR_lt_1 : R < 1) : -+ ∏ ρ ∈ h_finite_zeros.toFinset, -+ (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat ≥ 1 := by -+ classical -+ set K := h_finite_zeros.toFinset -+ -+ have h_base_ge_1 : (1 : ℝ) < (R/R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R -+ have h := -+ lem_prod_ineq K (fun _ : ℂ => (1 : ℝ)) -+ (fun ρ : ℂ => (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) -+ (by intro ρ hρ; norm_num) -+ (by -+ intro ρ hρ -+ simpa using (one_le_pow₀ (by linarith [h_base_ge_1]))) -+ simpa [K] using h -+ -+theorem lem_mod_Bf_at_0_ge_1 (R R1 : ℝ) (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hf0_eq_one : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≥ 1 := by -+ -+ have R_over_R1_nonneg : 1 < R / R1 := by exact (one_lt_div hR1_pos).mpr hR1_lt_R -+ have R_over_R1_nonneg : 0 ≤ R / R1 := by linarith -+ have h_f_nonzero_at_zero : f 0 ≠ 0 := by -+ rw [hf0_eq_one]; norm_num -+ -+ rw [lem_mod_Bf_at_0_as_ratio R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros] -+ -+ rw [hf0_eq_one, norm_one, one_mul] -+ -+ have h_prod_ge : ∏ ρ ∈ h_finite_zeros.toFinset, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat ≥ -+ ∏ ρ ∈ h_finite_zeros.toFinset, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat := by -+ apply Finset.prod_le_prod₀ -+ -+ · intro ρ hρ -+ apply pow_nonneg -+ apply R_over_R1_nonneg -+ -+ · intro ρ hρ -+ have h_ρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := by -+ exact (Set.Finite.mem_toFinset h_finite_zeros).mp hρ -+ -+ have h_ratio_ge : R / ‖ρ‖ ≥ (R/R1 : ℝ) := by -+ -+ have h_norm_abs_eq : ‖ρ‖ = norm ρ := by rfl -+ rw [h_norm_abs_eq] -+ exact lem_R_div_mod_rho_ge_R_over_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros -+ -+ have h_3_2_pos : (1 : ℝ) < (R/R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R -+ have h_3_2_pos : (0 : ℝ) < (R/R1 : ℝ) := by linarith -+ have h_ratio_pos : (0 : ℝ) ≤ R / ‖ρ‖ := by -+ linarith [h_ratio_ge] -+ exact pow_le_pow_left₀ R_over_R1_nonneg h_ratio_ge (analyticOrderAt f ρ).toNat -+ -+ have h_3_2_prod_ge_1 : ∏ ρ ∈ h_finite_zeros.toFinset, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat ≥ 1 := -+ lem_mod_lower_bound_1 R R1 hR1_pos hR1_lt_R f h_f_analytic hf0_eq_one h_finite_zeros hR_lt_1 -+ -+ exact le_trans h_3_2_prod_ge_1 h_prod_ge -+ assumption -+ -+lemma lem_linear_factor_analytic (R : ℝ) (_hR_pos : 0 < R) (ρ : ℂ) (z : ℂ) : -+ AnalyticAt ℂ (fun w => (R : ℂ) - star ρ * w / (R : ℂ)) z := by -+ -+ have h_const : AnalyticAt ℂ (fun _ => (R : ℂ)) z := analyticAt_const -+ -+ have h_id : AnalyticAt ℂ (fun w => w) z := analyticAt_id -+ -+ have h_const_coeff : AnalyticAt ℂ (fun _ => star ρ / (R : ℂ)) z := analyticAt_const -+ -+ have h_mul : AnalyticAt ℂ (fun w => star ρ / (R : ℂ) * w) z := -+ AnalyticAt.fun_mul h_const_coeff h_id -+ -+ have h_sub : AnalyticAt ℂ (fun w => (R : ℂ) - star ρ / (R : ℂ) * w) z := -+ AnalyticAt.fun_sub h_const h_mul -+ -+ convert h_sub using 1 -+ ext w -+ ring -+ -+lemma lem_pow_analyticAt {g : ℂ → ℂ} (n : ℕ) (w : ℂ) : -+ AnalyticAt ℂ g w → AnalyticAt ℂ (fun z => (g z) ^ n) w := by -+ intro hg -+ exact AnalyticAt.fun_pow hg n -+ -+lemma lem_finset_prod_analyticAt {α : Type*} {S : Finset α} {g : α → ℂ → ℂ} (w : ℂ) : -+ (∀ a ∈ S, AnalyticAt ℂ (g a) w) → AnalyticAt ℂ (fun z => ∏ a ∈ S, g a z) w := by -+ intro h -+ classical -+ induction S using Finset.induction with -+ | empty => -+ -+ simp only [Finset.prod_empty] -+ exact analyticAt_const -+ | insert a s ha ih => -+ -+ simp only [Finset.prod_insert ha] -+ -+ apply AnalyticAt.fun_mul -+ · -+ apply h -+ exact Finset.mem_insert_self a s -+ · -+ apply ih -+ intro b hb -+ apply h -+ exact Finset.mem_insert_of_mem hb -+ -+lemma analyticOrderAt_top_iff_eventually_zero (f : ℂ → ℂ) (z : ℂ) (hf : AnalyticAt ℂ f z) : -+ analyticOrderAt f z = ⊤ ↔ ∀ᶠ w in nhds z, f w = 0 := by -+ simp [analyticOrderAt, hf] -+ -+lemma isPreconnected_closedBall (x : ℂ) (r : ℝ) : IsPreconnected (Metric.closedBall x r) := by -+ -+ have h_convex : Convex ℝ (Metric.closedBall x r) := convex_closedBall _ _ -+ -+ exact h_convex.isPreconnected -+ -+lemma Set.infinite_Icc_of_lt {a b : ℝ} (h : a < b) : (Set.Icc a b).Infinite := by -+ -+ intro h_finite -+ -+ have h_subset : Set.Ioo a b ⊆ Set.Icc a b := Set.Ioo_subset_Icc_self -+ -+ have h_Ioo_finite : (Set.Ioo a b).Finite := h_finite.subset h_subset -+ -+ have h_Ioo_infinite : (Set.Ioo a b).Infinite := Set.Ioo_infinite h -+ -+ exact h_Ioo_infinite h_Ioo_finite -+ -+lemma infinite_closedBall_of_pos (x : ℂ) (r : ℝ) (hr : 0 < r) : (Metric.closedBall x r).Infinite := by -+ -+ let f : ℝ → ℂ := fun t => x + t -+ -+ have h_maps_to : Set.MapsTo f (Set.Icc 0 (r/2)) (Metric.closedBall x r) := by -+ intro t ht -+ rw [Metric.mem_closedBall] -+ -+ have h_eq : f t = x + t := rfl -+ rw [h_eq, Complex.dist_eq, add_sub_cancel_left] -+ -+ have h_norm : ‖(t : ℂ)‖ = |t| := by -+ exact Complex.norm_real t -+ rw [h_norm, abs_of_nonneg ht.1] -+ exact le_trans ht.2 (le_of_lt (half_lt_self hr)) -+ -+ have h_inj : Set.InjOn f (Set.Icc 0 (r/2)) := by -+ intro s hs t ht h_eq -+ have : x + s = x + t := h_eq -+ have : (s : ℂ) = (t : ℂ) := add_left_cancel this -+ exact Complex.ofReal_inj.mp this -+ -+ have h_infinite_interval : (Set.Icc (0:ℝ) (r/2)).Infinite := -+ Set.infinite_Icc_of_lt (half_pos hr) -+ -+ have h_infinite_image : (f '' Set.Icc 0 (r/2)).Infinite := -+ Set.Infinite.image h_inj h_infinite_interval -+ -+ have h_subset : f '' Set.Icc 0 (r/2) ⊆ Metric.closedBall x r := -+ Set.MapsTo.image_subset h_maps_to -+ -+ intro h_finite -+ exact h_infinite_image (h_finite.subset h_subset) -+ -+lemma analyticOrderAt_ne_top_of_finite_zeros_in_ball (f : ℂ → ℂ) (R : ℝ) (hR_pos : 0 < R) -+ (hf_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) R, AnalyticAt ℂ f z) -+ (ρ : ℂ) (_hρ_zero : f ρ = 0) (hρ_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R) -+ (h_finite_zeros : {z ∈ Metric.closedBall (0 : ℂ) R | f z = 0}.Finite) : -+ analyticOrderAt f ρ ≠ ⊤ := by -+ -+ by_contra htop -+ -+ have h_eventually_zero : ∀ᶠ z in nhds ρ, f z = 0 := by -+ rw [← analyticOrderAt_top_iff_eventually_zero f ρ (hf_analytic ρ hρ_in_ball)] -+ exact htop -+ -+ have hf_on_ball : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R) := by -+ intro z -+ exact hf_analytic z -+ -+ have h_preconn : IsPreconnected (Metric.closedBall (0 : ℂ) R) := -+ isPreconnected_closedBall (0 : ℂ) R -+ -+ have h_eqOn_zero : Set.EqOn f 0 (Metric.closedBall (0 : ℂ) R) := -+ AnalyticOnNhd.eqOn_zero_of_preconnected_of_eventuallyEq_zero hf_on_ball h_preconn hρ_in_ball h_eventually_zero -+ -+ have h_all_zeros : ∀ z ∈ Metric.closedBall (0 : ℂ) R, f z = 0 := by -+ intro z hz -+ have := h_eqOn_zero hz -+ simpa [Pi.zero_apply] using this -+ -+ have h_zero_set_eq : {z ∈ Metric.closedBall (0 : ℂ) R | f z = 0} = Metric.closedBall (0 : ℂ) R := by -+ ext z -+ constructor -+ · intro hz; exact hz.1 -+ · intro hz; exact ⟨hz, h_all_zeros z hz⟩ -+ -+ have h_ball_infinite : (Metric.closedBall (0 : ℂ) R).Infinite := -+ infinite_closedBall_of_pos (0 : ℂ) R hR_pos -+ -+ rw [h_zero_set_eq] at h_finite_zeros -+ exact h_ball_infinite h_finite_zeros -+ -+theorem lem_Bf_is_analytic (R R1 : ℝ) (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := by -+ -+ intro z hz -+ -+ have h_blaschke_linear : ∀ ρ ∈ h_finite_zeros.toFinset, -+ AnalyticAt ℂ (fun w => (R : ℂ) - star ρ * w / (R : ℂ)) z := by -+ intro ρ hρ -+ -+ have h_eq : (fun w : ℂ => (R : ℂ) - star ρ * w / (R : ℂ)) = -+ (fun w : ℂ => (R : ℂ) + (-(star ρ) / (R : ℂ)) * w) := by -+ funext w -+ field_simp -+ ring -+ rw [h_eq] -+ exact analyticAt_const.add (analyticAt_const.mul analyticAt_id) -+ -+ have h_powers : ∀ ρ ∈ h_finite_zeros.toFinset, -+ AnalyticAt ℂ (fun w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ intro ρ hρ -+ exact (h_blaschke_linear ρ hρ).fun_pow _ -+ -+ have h_product : AnalyticAt ℂ (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ -+ apply lem_finset_prod_analyticAt z -+ intro ρ hρ -+ apply h_powers -+ exact hρ -+ -+ by_cases hz_in : z ∈ zerosetKfR R1 (by linarith) f -+ · -+ have h_cf_at_sigma := @lem_Cf_analytic_at_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_in -+ -+ exact AnalyticAt.fun_mul h_cf_at_sigma h_product -+ -+ · -+ have hz_in_compl : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f := by -+ constructor -+ · exact hz -+ · exact hz_in -+ have h_cf_off := @lem_Cf_analytic_off_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_in_compl -+ exact AnalyticAt.fun_mul h_cf_off h_product -+ -+lemma complex_mul_star_eq_norm_sq (z : ℂ) : z * star z = (‖z‖ ^ 2 : ℂ) := by -+ -+ rw [Complex.star_def] -+ -+ exact Complex.mul_conj' z -+ -+lemma lem_mod_Bf_eq_mod_f_on_boundary (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ∀ z : ℂ, ‖z‖ = R → -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = ‖f z‖ := by -+ intro z hz -+ -+ have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := by -+ intro h_in -+ -+ have h_norm_le_R1 : ‖z‖ ≤ R1 := by simpa [sub_zero] using (h_in.1 : z ∈ Metric.closedBall (0 : ℂ) R1) -+ -+ have h_norm_eq_R : ‖z‖ = R := by simpa using hz -+ linarith [h_norm_le_R1, h_norm_eq_R, hR1_lt_R] -+ rw [lem_mod_Bf_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_not_in] -+ -+ have h_each_factor_one : ∀ ρ ∈ h_finite_zeros.toFinset, ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ = 1 := by -+ intro ρ hρ -+ -+ have z_ne_rho : z ≠ ρ := by -+ intro h_eq -+ have rho_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := (Set.Finite.mem_toFinset h_finite_zeros).mp hρ -+ have rho_bound : ‖ρ‖ ≤ R1 := by -+ have h_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R1 := rho_in_zeros.1 -+ rw [Metric.mem_closedBall, Complex.dist_eq] at h_in_ball -+ simpa using h_in_ball -+ have R1_lt_R : R1 < R := by linarith -+ rw [← h_eq, hz] at rho_bound -+ linarith [R1_lt_R] -+ -+ rw [Complex.norm_div] -+ -+ have z_conj_eq : z * star z = (R ^ 2 : ℂ) := by -+ rw [complex_mul_star_eq_norm_sq z, hz, pow_two] -+ -+ have num_rewrite : (R : ℂ) - z * star ρ / (R : ℂ) = ((R : ℂ)^2 - z * star ρ) / (R : ℂ) := by -+ have hRne : (R : ℂ) ≠ 0 := by exact_mod_cast (hR1_pos.trans hR1_lt_R).ne' -+ field_simp [hRne] -+ -+ rw [num_rewrite, Complex.norm_div] -+ -+ have factor_eq : (R : ℂ)^2 - z * star ρ = z * star (z - ρ) := by -+ rw [← z_conj_eq, star_sub] -+ ring -+ -+ rw [factor_eq, Complex.norm_mul, norm_star, ←hz] -+ have hRpos : 0 < R := hR1_pos.trans hR1_lt_R -+ have hnorm_denom : ‖z - ρ‖ ≠ 0 := norm_ne_zero_iff.mpr (sub_ne_zero.mpr z_ne_rho) -+ simp [hz, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hRpos, hnorm_denom, hRpos.ne'] -+ -+ have h_prod_one : ∏ ρ ∈ h_finite_zeros.toFinset, ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ ^ (analyticOrderAt f ρ).toNat = 1 := by -+ -+ rw [← Finset.prod_congr rfl (fun ρ hρ => by rw [h_each_factor_one ρ hρ, one_pow])] -+ rw [Finset.prod_const_one] -+ -+ rw [h_prod_one, mul_one] -+ -+lemma lem_Bf_bounded_on_boundary (B R R1 : ℝ) (_hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : -+ ∀ z : ℂ, ‖z‖ = R → -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by -+ -+ intro z hz -+ have hz_le : ‖z‖ ≤ R := le_of_eq hz -+ have h_eq := -+ lem_mod_Bf_eq_mod_f_on_boundary R R1 (by linarith) hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz -+ simpa [h_eq] using hf_le_B z hz_le -+ -+lemma norm_eq_radius_of_mem_sphere (w : ℂ) (R : ℝ) (hw : w ∈ Metric.sphere (0 : ℂ) R) : ‖w‖ = R := by -+ have hdist : dist w (0 : ℂ) = R := by simpa [Metric.sphere] using hw -+ simpa [Complex.dist_eq, sub_zero] using hdist -+ -+lemma mem_closedBall_of_norm_le {z : ℂ} {R : ℝ} (hz : ‖z‖ ≤ R) : z ∈ Metric.closedBall (0 : ℂ) R := by -+ have : dist z (0 : ℂ) ≤ R := by simpa [Complex.dist_eq, sub_zero] using hz -+ simpa [Metric.closedBall] using this -+ -+lemma closure_ball_eq_closedBall_center (R : ℝ) (hR : 0 < R) : -+ closure (Metric.ball (0 : ℂ) R) = Metric.closedBall (0 : ℂ) R := by -+ simpa using (closure_ball (x := (0 : ℂ)) (r := R) (ne_of_gt hR)) -+ -+lemma lem_max_mod_principle_for_Bf (B R : ℝ) (hB : 1 < B) (hR_pos : 0 < R) -+ (fB : ℂ → ℂ) -+ (h_analytic : AnalyticOnNhd ℂ fB (Metric.closedBall (0 : ℂ) R)) -+ (h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → ‖fB z‖ ≤ B) : -+ ∀ z : ℂ, ‖z‖ ≤ R → ‖fB z‖ ≤ B := by -+ intro z hz -+ -+ have hB0 : 0 ≤ B := le_of_lt (lt_trans zero_lt_one hB) -+ -+ have h_an_on_closure : AnalyticOn ℂ fB (closure (ballDR R)) := by -+ simpa [ballDR, closure_ball_eq_closedBall_center R hR_pos] using h_analytic.analyticOn -+ -+ have h_le := -+ lem_HardMMP R B hR_pos hB0 fB h_an_on_closure (by -+ intro z hzR; exact h_bd_boundary z hzR) -+ -+ have hz_cl : z ∈ closure (ballDR R) := by -+ have hz_closed : z ∈ Metric.closedBall (0 : ℂ) R := mem_closedBall_of_norm_le hz -+ simpa [ballDR, closure_ball_eq_closedBall_center R hR_pos] using hz_closed -+ exact h_le z hz_cl -+ -+lemma lem_Bf_bounded_in_disk_from_boundary (B R R1 : ℝ) -+ (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B) : -+ ∀ z : ℂ, ‖z‖ ≤ R → -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by -+ have hA := lem_Bf_is_analytic R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec -+ exact lem_max_mod_principle_for_Bf B R hB (by linarith) -+ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) hA h_bd_boundary -+ -+lemma lem_Bf_bounded_in_disk_from_f (B R R1 : ℝ) -+ (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : -+ ∀ z : ℂ, ‖z‖ ≤ R → -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by -+ intro z hz -+ have h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := -+ lem_Bf_bounded_on_boundary B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec hf_le_B -+ exact (lem_Bf_bounded_in_disk_from_boundary B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec h_bd_boundary) z hz -+ -+lemma lem_Bf_at_0_le_M (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≤ B := by -+ have h := -+ lem_Bf_bounded_in_disk_from_f B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec hf_le_B -+ have h0 : ‖(0 : ℂ)‖ ≤ R := by simpa using (le_of_lt (by linarith)) -+ simpa using h 0 h0 -+ -+lemma lem_combine_bounds_on_Bf0 (B R R1 : ℝ) (_hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hf0_eq_one : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (hBf0 : ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≤ B) : -+ (R / R1 : ℝ) ^ (∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat : ℝ) ≤ B := by -+ classical -+ -+ set K := h_finite_zeros.toFinset -+ -+ have hf0_ne0 : f 0 ≠ 0 := by simp [hf0_eq_one] -+ have hf0_norm : ‖f 0‖ = 1 := by simp [hf0_eq_one] -+ have h_eval0 := -+ lem_mod_Bf_at_0_eval R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic hf0_ne0 h_finite_zeros h_σ h_σ_spec -+ have h_eval_prod : -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ -+ = ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by -+ rw [h_eval0, hf0_norm, one_mul] -+ -+ have h_base_ge : ∀ ρ ∈ K, R / ‖ρ‖ ≥ (R/R1 : ℝ) := by -+ intro ρ hρK -+ have hρ_in : ρ ∈ zerosetKfR R1 (by linarith) f := by simpa [K] using hρK -+ simpa using -+ (lem_R_div_mod_rho_ge_R_over_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic hf0_ne0 ρ hρ_in) -+ -+ have R_over_R1_nonneg : 0 ≤ R/R1 := by -+ have : 0 ≤ R := by linarith -+ apply div_nonneg (by assumption) (le_of_lt hR1_pos) -+ have h_prod_le : -+ ∏ ρ ∈ K, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat -+ ≤ ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by -+ refine lem_prod_ineq K -+ (fun ρ => (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) -+ (fun ρ => (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat) -+ ?h_nonneg ?h_le -+ · intro ρ hρK; exact pow_nonneg (R_over_R1_nonneg) _ -+ · intro ρ hρK -+ exact pow_le_pow_left₀ (by linarith : (0 : ℝ) ≤ R / R1) (h_base_ge ρ hρK) _ -+ have h_prod_le_B : -+ ∏ ρ ∈ K, (R / R1: ℝ) ^ (analyticOrderAt f ρ).toNat ≤ B := by -+ have h_right : ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat = -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ := by -+ simp [h_eval_prod] -+ exact le_trans h_prod_le (by simpa [h_right] using hBf0) -+ -+ have h_prod_pow_sum : -+ (∏ ρ ∈ K, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) -+ = (R/R1 : ℝ) ^ (∑ ρ ∈ K, (analyticOrderAt f ρ).toNat) := by -+ simpa using -+ (Finset.prod_pow_eq_pow_sum K (fun ρ => (analyticOrderAt f ρ).toNat) (R/R1 : ℝ)) -+ -+ have h_natPow : (R / R1 : ℝ) ^ (∑ ρ ∈ K, (analyticOrderAt f ρ).toNat) ≤ B := by -+ simpa [h_prod_pow_sum] using h_prod_le_B -+ -+ set S : ℕ := ∑ ρ ∈ K, (analyticOrderAt f ρ).toNat -+ have h_natPowS : (R / R1 : ℝ) ^ S ≤ B := by simpa [S] using h_natPow -+ -+ have h_rpowS : (R / R1 : ℝ) ^ (S : ℝ) ≤ B := by -+ -+ simpa [(Real.rpow_natCast (R / R1 : ℝ) S)] using h_natPowS -+ -+ have h_cast_sum : (S : ℝ) -+ = (∑ ρ ∈ K, ((analyticOrderAt f ρ).toNat : ℝ)) := by -+ simp [S] -+ -+ have : (R / R1 : ℝ) ^ (∑ ρ ∈ K, ((analyticOrderAt f ρ).toNat : ℝ)) ≤ B := by -+ simpa [h_cast_sum] using h_rpowS -+ simpa [K] using this -+ -+lemma lem_jensen_inequality_form (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hf0_eq_one : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : -+ (R / R1 : ℝ) ^ (∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat : ℝ) ≤ B := by -+ -+ have hf0_ne0 : f 0 ≠ 0 := by -+ rw [hf0_eq_one]; norm_num -+ -+ have hBf0 := -+ lem_Bf_at_0_le_M B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic hf0_ne0 h_finite_zeros h_σ h_σ_spec hf_le_B -+ -+ let K := h_finite_zeros.toFinset -+ have hres := lem_combine_bounds_on_Bf0 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hBf0 -+ -+ simpa using hres -+ -+lemma lem_log_mono_inc {x y : ℝ} (hx : 0 < x) (hxy : x ≤ y) : Real.log x ≤ Real.log y := by -+ exact Real.log_le_log hx hxy -+ -+lemma lem_three_gt_e : (3 : ℝ) > Real.exp 1 := by -+ have h1 : Real.exp 1 < 2.7182818286 := Real.exp_one_lt_d9 -+ have h2 : (2.7182818286 : ℝ) < 3 := by norm_num -+ exact lt_trans h1 h2 -+ -+lemma lem_jensen_log_form (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hf0_eq_one : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : -+ (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) * Real.log (R / R1) ≤ Real.log B := by -+ -+ set S : ℝ := ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) -+ -+ have hpow_le : (R / R1 : ℝ) ^ S ≤ B := by -+ simpa [S] using -+ (lem_jensen_inequality_form B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hf_le_B) -+ -+ have hbase_pos : 1 < (R / R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R -+ have hbase_pos' : 0 < (R / R1 : ℝ) := by -+ have : 0 < R := by linarith -+ linarith -+ -+ have hxpos : 0 < (R / R1 : ℝ) ^ S := by -+ simpa [S] using Real.rpow_pos_of_pos hbase_pos' S -+ -+ have hlog_le : Real.log ((R / R1 : ℝ) ^ S) ≤ Real.log B := -+ lem_log_mono_inc hxpos hpow_le -+ -+ have hlog_rpow : Real.log ((R / R1 : ℝ) ^ S) = S * Real.log (R / R1) := by -+ simpa using (Real.log_rpow hbase_pos' S) -+ -+ simpa [S, hlog_rpow] using hlog_le -+ -+lemma lem_sum_ineq {ι : Type*} (K : Finset ι) (a b : ι → ℝ) -+ (h_le : ∀ i ∈ K, a i ≤ b i) : -+ Finset.sum K a ≤ Finset.sum K b := by -+ classical -+ exact Finset.sum_le_sum (by intro i hi; exact h_le i hi) -+ -+lemma ENat_coe_ge_one_iff_nat_ge_one (n : ℕ) : (n : ENat) ≥ 1 ↔ 1 ≤ n := by -+ -+ rw [ge_iff_le] -+ -+ exact ENat.natCast_le_natCast -+ -+lemma nat_one_le_cast_real (n : ℕ) : 1 ≤ n → (1 : ℝ) ≤ (n : ℝ) := by -+ intro h -+ rw [← Nat.cast_one] -+ exact Nat.cast_le.mpr h -+ -+lemma zerosetKfR_eq_zeros_in_ball (R : ℝ) (hR_pos : 0 < R) (f : ℂ → ℂ) : -+ zerosetKfR R hR_pos f = {z | z ∈ Metric.closedBall (0 : ℂ) R ∧ f z = 0} := by -+ rfl -+ -+lemma lem_frho_zero' (R R1 : ℝ) -+ (hR_pos : 0 < R1) -+ (_hR1 : R1 < R) -+ (f : ℂ → ℂ) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : -+ f ρ = 0 := h_rho_in_KfR1.2 -+ -+lemma lem_sum_m_rho_1 (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (hR_lt_1 : R < 1) : -+ (h_finite_zeros.toFinset.card : ℝ) ≤ ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) := by -+ -+ have h_card_as_sum : (h_finite_zeros.toFinset.card : ℝ) = ∑ ρ ∈ h_finite_zeros.toFinset, (1 : ℝ) := by -+ simp [Finset.sum_const] -+ rw [h_card_as_sum] -+ -+ apply lem_sum_ineq h_finite_zeros.toFinset (fun _ => (1 : ℝ)) (fun ρ => ((analyticOrderAt f ρ).toNat : ℝ)) -+ -+ intro ρ hρ -+ -+ have hρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := -+ (Set.Finite.mem_toFinset h_finite_zeros).mp hρ -+ have h_f_rho_zero : f ρ = 0 := -+ lem_frho_zero' R R1 (by linarith) hR1_lt_R f h_f_analytic ρ hρ_in_zeros -+ -+ have h_f_analytic_at_rho : AnalyticAt ℂ f ρ := by -+ apply h_f_analytic -+ have h_R1_lt_1 : R1 < 1 := by linarith [hR_lt_1] -+ exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) hρ_in_zeros.1 -+ -+ have h_order_finite : analyticOrderAt f ρ ≠ ⊤ := by -+ have h_R1_pos : 0 < R1 := by linarith [hR1_pos] -+ apply analyticOrderAt_ne_top_of_finite_zeros_in_ball f R1 h_R1_pos -+ · intro z hz -+ apply h_f_analytic -+ have h_R1_lt_1 : R1 < 1 := by linarith [hR_lt_1] -+ exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) hz -+ · exact h_f_rho_zero -+ · exact hρ_in_zeros.1 -+ · exact h_finite_zeros -+ -+ have h_order_ge_one : analyticOrderAt f ρ ≥ 1 := -+ analyticOrderAt_ge_one_of_zero f ρ h_f_analytic_at_rho h_f_rho_zero h_order_finite -+ -+ have h_toNat_ge_one : 1 ≤ (analyticOrderAt f ρ).toNat := by -+ cases' h_cases : analyticOrderAt f ρ with n -+ · rw [h_cases] at h_order_finite; contradiction -+ · rw [h_cases] at h_order_ge_one -+ rw [ENat.toNat_natCast] -+ exact (ENat_coe_ge_one_iff_nat_ge_one n).mp h_order_ge_one -+ -+ exact nat_one_le_cast_real _ h_toNat_ge_one -+ -+lemma lem_sum_1_is_card {ι : Type*} (K : Finset ι) : Finset.sum K (fun _ => (1 : ℝ)) = (K.card : ℝ) := by -+ -+ rw [Finset.sum_const, nsmul_eq_mul] -+ simp only [mul_one] -+ -+lemma lem_sum_m_rho_bound (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hf0_eq_one : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) ≤ (1/Real.log (R/R1)) * Real.log B := by -+ have h_div_log : (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) * Real.log (R/R1) ≤ Real.log B := by -+ apply lem_jensen_log_form B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hf_le_B -+ have log_pos' : R/R1 > 1 := by exact (one_lt_div hR1_pos).mpr hR1_lt_R -+ have log_pos : Real.log (R/R1) > 0 := by exact Real.log_pos log_pos' -+ calc -+ ∑ ρ ∈ h_finite_zeros.toFinset, ↑(analyticOrderAt f ρ).toNat -+ _ = 1 / Real.log (R / R1) * (Real.log (R / R1) * (∑ ρ ∈ h_finite_zeros.toFinset, ↑(analyticOrderAt f ρ).toNat)) := by -+ field_simp [ne_of_gt log_pos] -+ _ ≤ 1 / Real.log (R / R1) * Real.log B := by -+ gcongr -+ rw [mul_comm] -+ exact h_div_log -+ -+lemma lem_sum_1_bound (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hf0_eq_one : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ (h_finite_zeros.toFinset.card : ℝ) ≤ (1/Real.log (R/R1)) * Real.log B := by -+ have h1 := -+ lem_sum_m_rho_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_finite_zeros hR_lt_1 -+ have h2 := -+ lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ hf_le_B h_σ_spec -+ exact le_trans h1 h2 -+ -+lemma lem_num_zeros_bound (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (hf0_eq_one : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ let S_zeros := zerosetKfR R1 (by linarith) f -+ have inst_fintype_S_zeros : Fintype ↑S_zeros := h_finite_zeros.fintype -+ (S_zeros.toFinset.card : ℝ) ≤ (1 / Real.log (R / R1)) * Real.log B := by -+ intro S_zeros _inst -+ dsimp [S_zeros] -+ simpa using -+ (lem_sum_1_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ hf_le_B h_σ_spec) -+ -+variable {R R1 r B : ℝ} {f : ℂ → ℂ} {h_σ : ℂ → (ℂ → ℂ)} -+variable (hr_pos : 0 < r) (hr_lt_R1 : r < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+variable (hR1_pos : 0 < R1) -+variable (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+variable (h_f_zero : f 0 = 1) -+variable (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+variable (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ -+lemma f_zero_ne_zero (h_f_zero : f 0 = 1) : f 0 ≠ 0 := by -+ rw [h_f_zero]; simp -+ -+lemma Bf_is_analytic_on_disk -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := -+ let hspec := h_σ_spec -+ lem_Bf_is_analytic R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) -+ h_finite_zeros h_σ hspec -+ -+lemma lem_Bf_eq_prod_Cf -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ∀ z, Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = -+ (∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) * -+ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z) := by -+ intro z -+ rw [Bf] -+ ring -+ -+lemma lem_num_prod_never_zero_all -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (_hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (_h_f_nonzero_at_zero : f 0 ≠ 0) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1, -+ (∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by -+ intro z hz -+ apply Finset.prod_ne_zero_iff.mpr -+ intro ρ hρ -+ apply pow_ne_zero -+ -+ have hρ_mem : ρ ∈ zerosetKfR R1 (by linarith) f := by -+ rwa [Set.Finite.mem_toFinset h_finite_zeros] at hρ -+ have hρ_bound : ‖ρ‖ ≤ R1 := by -+ rw [zerosetKfR] at hρ_mem; simp at hρ_mem; exact hρ_mem.1 -+ have hz_bound : ‖z‖ ≤ R1 := by -+ rw [Metric.mem_closedBall, dist_zero_right] at hz; exact hz -+ -+ have hR_pos : (0 : ℝ) < R := lt_trans hR1_pos hR1_lt_R -+ -+ have key_positive : (0 : ℝ) < R - R1 * R1 / R := by -+ -+ have h1 : R1 * R1 < R * R := by -+ apply mul_self_lt_mul_self (le_of_lt hR1_pos) hR1_lt_R -+ have h2 : R1 * R1 / R < R := by -+ rw [div_lt_iff₀ hR_pos] -+ exact h1 -+ linarith [h2] -+ -+ suffices h : (0 : ℝ) < ‖(R : ℂ) - star ρ * z / (R : ℂ)‖ by -+ exact norm_pos_iff.mp h -+ -+ have triangle_ineq : ‖(R : ℂ) - star ρ * z / (R : ℂ)‖ ≥ ‖(R : ℂ)‖ - ‖star ρ * z / (R : ℂ)‖ := -+ norm_sub_norm_le _ _ -+ -+ have R_norm_eq : ‖(R : ℂ)‖ = R := by -+ rw [Complex.norm_of_nonneg (le_of_lt hR_pos)] -+ -+ have product_bound : ‖star ρ * z / (R : ℂ)‖ ≤ R1 * R1 / R := by -+ rw [norm_div, norm_mul, norm_star, R_norm_eq] -+ -+ have mult_bound : ‖ρ‖ * ‖z‖ ≤ R1 * R1 := by -+ exact mul_le_mul hρ_bound hz_bound (norm_nonneg _) (le_of_lt hR1_pos) -+ -+ have : ‖ρ‖ * ‖z‖ / R ≤ R1 * R1 / R := by -+ exact div_le_div_of_nonneg_right mult_bound (le_of_lt hR_pos) -+ exact this -+ -+ rw [R_norm_eq] at triangle_ineq -+ linarith [triangle_ineq, product_bound, key_positive] -+ -+lemma Bf_never_zero -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1, Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z ≠ 0 := by -+ intro z hz -+ -+ rw [lem_Bf_eq_prod_Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec] -+ -+ apply mul_ne_zero -+ · -+ exact lem_num_prod_never_zero_all R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec z hz -+ · -+ exact lem_Cf_never_zero h_finite_zeros h_σ h_σ_spec z hz -+ -+lemma Bf0_not_zero -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 := by -+ apply Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ simp [Metric.mem_closedBall, le_of_lt hR1_pos] -+ -+noncomputable def Lf : ℂ → ℂ := -+ let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ -+ Classical.choose (log_of_analytic -+ (r1 := r) (R' := R1) (R := R) -+ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 -+ (B := B_f) -+ (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) -+ (hB_ne_zero := by -+ intro z hz -+ have h_num_ne_zero : B_f z ≠ 0 := -+ Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz -+ assumption -+ ) -+) -+ -+lemma Lf_is_analytic -+ (r R R1 : ℝ) -+ (hr_pos : 0 < r) -+ (hr_lt_R1 : r < R1) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ AnalyticOnNhd ℂ (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) -+ (Metric.closedBall (0 : ℂ) r) := by -+ unfold Lf -+ exact (Classical.choose_spec (log_of_analytic -+ (r1 := r) (R' := R1) (R := R) -+ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 -+ (B := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) -+ (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) -+ (hB_ne_zero := by -+ intro z hz -+ exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz -+ ) -+ )).1 -+ -+lemma Lf_at_0_is_0 -+ (r R R1 : ℝ) -+ (hr_pos : 0 < r) -+ (hr_lt_R1 : r < R1) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec 0 = 0 := by -+ unfold Lf -+ let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ -+ let log_exists := log_of_analytic -+ (r1 := r) (R' := R1) (R := R) -+ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 -+ (B := B_f) -+ (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) -+ (hB_ne_zero := by -+ intro z hz -+ have h_num_ne_zero : B_f z ≠ 0 := -+ Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz -+ assumption -+ ) -+ exact (Classical.choose_spec log_exists).2.1 -+ -+lemma lem_BCII {L : ℂ → ℂ} {r M r₁ : ℝ} -+ (hr_pos : 0 < r) -+ (hM_pos : 0 < M) -+ (hr₁_pos : 0 < r₁) -+ (hr₁_lt_r : r₁ < r) -+ (hL_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 r ⊆ U ∧ DifferentiableOn ℂ L U) -+ (hL0 : L 0 = 0) -+ (hre_L_le_M : ∀ w ∈ Metric.closedBall 0 r, (L w).re ≤ M) -+ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r₁) : -+norm (deriv L z) ≤ (16 * M * r ^ 2) / ((r - r₁) ^ 3) := by -+ apply borel_caratheodory_II hr_pos hM_pos hr₁_pos hr₁_lt_r hL_domain hL0 hre_L_le_M hz -+ -+lemma re_Lf_as_diff_of_log_mods -+ (r R R1 : ℝ) -+ (hr_pos : 0 < r) -+ (hr_lt_R1 : r < R1) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r, -+ Complex.re (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z) = -+ Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) - -+ Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)) := by -+ intro z hz -+ -+ let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ -+ have h_Bf_analytic : AnalyticOnNhd ℂ B_f (Metric.closedBall (0 : ℂ) R) := -+ Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ have h_Bf_ne_zero : ∀ w ∈ Metric.closedBall (0 : ℂ) R1, B_f w ≠ 0 := by -+ intro w hw -+ exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec w hw -+ -+ have h_log_exists := log_of_analytic hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 h_Bf_analytic h_Bf_ne_zero -+ have h_choose_spec := Classical.choose_spec h_log_exists -+ -+ have h_Lf_def : Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec = Classical.choose h_log_exists := by -+ unfold Lf -+ simp only [B_f] -+ -+ rw [h_Lf_def] -+ exact (h_choose_spec.2.2.2 z hz).symm -+ -+lemma log_Bf_le_log_B -+ (B R R1 : ℝ) -+ (_hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (h_Bf_pos : ∀ z, norm z ≤ R1 → -+ 0 < norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) -+ (h_Bf_bound : ∀ z, norm z ≤ R1 → -+ norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z) ≤ B) : -+ ∀ z, norm z ≤ R1 → -+ Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) ≤ Real.log B := by -+ intro z hz -+ apply Real.log_le_log -+ · exact h_Bf_pos z hz -+ · exact h_Bf_bound z hz -+ -+lemma log_Bf_le_log_B2 -+ (B R R1 : ℝ) -+ (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (h_Bf_bound : ∀ z, ‖z‖ ≤ R → -+ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z‖ ≤ B) : -+ ∀ z, ‖z‖ ≤ R1 → -+ Real.log (‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z‖) ≤ Real.log B := by -+ -+ apply log_Bf_le_log_B B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ · -+ intro z hz -+ have hz_mem : z ∈ Metric.closedBall (0 : ℂ) R1 := by -+ rw [Metric.mem_closedBall, dist_zero_right] -+ exact hz -+ have hBf_ne_zero := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz_mem -+ exact norm_pos_iff.mpr hBf_ne_zero -+ · -+ intro z hz -+ have hz_le_R : ‖z‖ ≤ R := by linarith [hz, hR1_lt_R] -+ exact h_Bf_bound z hz_le_R -+ -+lemma log_Bf_le_log_B3 -+ (B R R1 : ℝ) -+ (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : -+ ∀ z, norm z ≤ R1 → -+ Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) ≤ Real.log B := by -+ -+ apply log_Bf_le_log_B2 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ -+ apply lem_Bf_bounded_in_disk_from_f B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec -+ -+ exact h_f_bound -+ -+lemma log_Bf0_ge_0 -+ (R R1 : ℝ) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ 0 ≤ Real.log (‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0‖) := by -+ -+ have h_pos : 0 < (1 : ℝ) := by norm_num -+ have h_Bf_ge_1 : 1 ≤ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0‖ := -+ lem_mod_Bf_at_0_ge_1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_f_zero h_finite_zeros h_σ h_σ_spec -+ have h_log_mono := lem_log_mono_inc h_pos h_Bf_ge_1 -+ rw [Real.log_one] at h_log_mono -+ exact h_log_mono -+ -+lemma re_Lf_le_log_B -+ (B r R R1 : ℝ) -+ (hB : 1 < B) -+ (hr_pos : 0 < r) -+ (hr_lt_R1 : r < R1) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : -+ ∀ z, norm z ≤ r → -+ Complex.re (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z) ≤ Real.log B := by -+ intro z hz -+ -+ rw [re_Lf_as_diff_of_log_mods r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z] -+ · -+ -+ have hz_apply_BC_to_Lfle_R1 : ‖z‖ ≤ R1 := by linarith [hz, hr_lt_R1] -+ have h1 := log_Bf_le_log_B3 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec h_f_bound z hz_apply_BC_to_Lfle_R1 -+ have h2 := log_Bf0_ge_0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ linarith -+ · -+ exact Metric.mem_closedBall.mpr (by simpa [dist_zero_right] using hz) -+ -+lemma analyticOnNhd_closedBall_exists_open_differentiableOn {L : ℂ → ℂ} {r : ℝ} -+ (h : AnalyticOnNhd ℂ L (Metric.closedBall (0 : ℂ) r)) : -+ ∃ U, IsOpen U ∧ Metric.closedBall (0 : ℂ) r ⊆ U ∧ DifferentiableOn ℂ L U := by -+ classical -+ -+ let I := {x : ℂ // x ∈ Metric.closedBall (0 : ℂ) r} -+ -+ have hI : ∀ i : I, ∃ (W : Set ℂ), IsOpen W ∧ (i : ℂ) ∈ W ∧ AnalyticOn ℂ L W := by -+ intro i -+ have hAt : AnalyticAt ℂ L (i : ℂ) := h i i.property -+ -+ have hWithin : AnalyticWithinAt ℂ L (Set.univ) (i : ℂ) := by -+ simpa using (hAt.analyticWithinAt : AnalyticWithinAt ℂ L Set.univ (i : ℂ)) -+ rcases (AnalyticWithinAt.exists_mem_nhdsWithin_analyticOn hWithin) with ⟨U₀, hU₀nhds, hU₀analytic⟩ -+ have hU₀nhds' : U₀ ∈ nhds (i : ℂ) := by simpa [nhdsWithin_univ] using hU₀nhds -+ rcases _root_.mem_nhds_iff.mp hU₀nhds' with ⟨W, hWsub, hWopen, hiW⟩ -+ refine ⟨W, hWopen, hiW, hU₀analytic.mono ?_⟩ -+ exact hWsub -+ choose V hVopen hiV hVanalytic using hI -+ -+ let U : Set ℂ := ⋃ i : I, V i -+ have hUopen : IsOpen U := by -+ simpa [U] using isOpen_iUnion (fun i => hVopen i) -+ -+ have hsub : Metric.closedBall (0 : ℂ) r ⊆ U := by -+ intro x hx -+ refine Set.mem_iUnion.mpr ?_ -+ refine ⟨⟨x, hx⟩, ?_⟩ -+ simpa using hiV ⟨x, hx⟩ -+ -+ have hdiffOn : DifferentiableOn ℂ L U := by -+ intro y hy -+ rcases Set.mem_iUnion.mp hy with ⟨i, hyi⟩ -+ have hdi : DifferentiableOn ℂ L (V i) := (hVanalytic i).differentiableOn -+ have hdiAt : DifferentiableAt ℂ L y := hdi.differentiableAt ((hVopen i).mem_nhds hyi) -+ exact hdiAt.differentiableWithinAt -+ exact ⟨U, hUopen, hsub, hdiffOn⟩ -+ -+lemma log_pos_of_one_lt {B : ℝ} (hB : 1 < B) : 0 < Real.log B := by -+ simpa using Real.log_pos hB -+ -+lemma apply_BC_to_Lf -+ (B r1 r R R1 : ℝ) -+ (hB : 1 < B) -+ (hr1_pos : 0 < r1) -+ (hr1_lt_r : r1 < r) -+ (hr_lt_R1 : r < R1) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : -+ ∀ z, norm z ≤ r1 → -+ norm (deriv (Lf (lt_trans hr1_pos hr1_lt_r : 0 < r) hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z) ≤ -+ (16 * Real.log B * r^2) / (r - r1)^3 := by -+ classical -+ intro z hz -+ -+ have hr_pos : 0 < r := lt_trans hr1_pos hr1_lt_r -+ -+ let L := Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec -+ -+ have h_analytic_nhd := -+ Lf_is_analytic r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ -+ let U : Set ℂ := -+ { y | ∃ x ∈ Metric.closedBall (0 : ℂ) r, ∃ s : ℝ, 0 < s ∧ y ∈ Metric.ball x s ∧ -+ AnalyticOnNhd ℂ L (Metric.ball x s) } -+ have hU_open : IsOpen U := by -+ refine isOpen_iff_mem_nhds.mpr ?_ -+ intro y hy -+ rcases hy with ⟨x, hxCB, s, hs_pos, hyin, hAnaBall⟩ -+ have hnhds : Metric.ball x s ∈ nhds y := (Metric.isOpen_ball.mem_nhds hyin) -+ exact Filter.mem_of_superset hnhds (by intro z hz; exact ⟨x, hxCB, s, hs_pos, hz, hAnaBall⟩) -+ have hCB_subset : Metric.closedBall (0 : ℂ) r ⊆ U := by -+ intro x hx -+ have hAt : AnalyticAt ℂ L x := h_analytic_nhd x hx -+ rcases AnalyticAt.exists_ball_analyticOnNhd hAt with ⟨s, hs_pos, hAnaBall⟩ -+ have hx_in_ball : x ∈ Metric.ball x s := by -+ simpa [Metric.mem_ball, dist_self] using hs_pos -+ exact ⟨x, hx, s, hs_pos, hx_in_ball, hAnaBall⟩ -+ have hDiffU : DifferentiableOn ℂ L U := by -+ intro y hy -+ rcases hy with ⟨x, hxCB, s, hs_pos, hy_in, hAnaBall⟩ -+ -+ have hAt : AnalyticAt ℂ L y := hAnaBall y hy_in -+ exact (AnalyticAt.differentiableAt hAt).differentiableWithinAt -+ -+ have hL_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 r ⊆ U ∧ DifferentiableOn ℂ L U := -+ ⟨U, hU_open, hCB_subset, hDiffU⟩ -+ -+ have hL0 : L 0 = 0 := by -+ simpa [L] using (Lf_at_0_is_0 r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) -+ -+ have hre_L_le_M : ∀ w ∈ Metric.closedBall 0 r, (L w).re ≤ Real.log B := by -+ intro w hw -+ have hw' : norm w ≤ r := by -+ simpa [Metric.mem_closedBall, dist_zero_right] using hw -+ exact re_Lf_le_log_B B r R R1 hB hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec h_f_bound w hw' -+ -+ have hz' : z ∈ Metric.closedBall 0 r1 := by -+ simpa [Metric.mem_closedBall, dist_zero_right] using hz -+ -+ have hBC := -+ lem_BCII hr_pos (Real.log_pos hB) hr1_pos hr1_lt_r hL_domain hL0 hre_L_le_M hz' -+ -+ simpa [L] using hBC -+ -+lemma analyticOnNhd_Bf_closedBall (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): -+ AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := -+ Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ -+lemma helper_Bf_analytic_on_disk (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R, AnalyticAt ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z := by -+ intro z hz -+ have h_analytic_on := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ exact h_analytic_on z hz -+ -+lemma closedBall_R1_subset_R (_hR1_nonneg : 0 ≤ R1) (hR1_lt_R : R1 < R) : Metric.closedBall (0 : ℂ) R1 ⊆ Metric.closedBall (0 : ℂ) R := by -+ exact (Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_R)) -+ -+lemma logDerivconst {a : ℂ} {g : ℂ → ℂ} (ha : a ≠ 0) : -+ ∀ z, logDeriv (fun w ↦ a * g w) z = logDeriv g z := by -+ intro z -+ exact logDeriv_const_mul z a ha -+ -+lemma oneBneq0 (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 ∧ -+ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ ≠ 0 := by -+ have h0mem : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R1 := by -+ simpa [Metric.mem_closedBall, dist_zero_right] using le_of_lt hR1_pos -+ have hB0ne : -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 := by -+ have h := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ -+ exact h 0 h0mem -+ refine And.intro hB0ne ?_ -+ exact inv_ne_zero hB0ne -+ -+lemma Lf_deriv_is_logBf_deriv (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ logDeriv (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w / -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0) z = -+ logDeriv (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) z := by -+ intro z _ -+ -+ have h_eq : (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w / -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0) = -+ (fun w ↦ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ * -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) := by -+ ext w -+ rw [div_eq_mul_inv] -+ ring -+ rw [h_eq] -+ -+ have h0_in_ball : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R1 := by -+ simp [Metric.mem_closedBall] -+ exact le_of_lt hR1_pos -+ have h_Bf0_ne_zero := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec 0 h0_in_ball -+ -+ have h_inv_ne_zero : (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ ≠ 0 := -+ inv_ne_zero h_Bf0_ne_zero -+ -+ exact logDerivconst h_inv_ne_zero z -+ -+lemma logDeriv_div_const {a : ℂ} {g : ℂ → ℂ} (ha : a ≠ 0) : ∀ z, logDeriv (fun w ↦ g w / a) z = logDeriv g z := by -+ intro z -+ have hfun : (fun w ↦ g w / a) = (fun w ↦ a⁻¹ * g w) := by -+ funext w -+ simp [div_eq_mul_inv, mul_comm] -+ simpa [hfun] using (logDerivconst (a := a⁻¹) (g := g) (inv_ne_zero ha) z) -+ -+lemma deriv_over_fun_is_logDeriv {g : ℂ → ℂ} : ∀ z, deriv g z / g z = logDeriv g z := by -+ intro z -+ rfl -+ -+lemma logDerivmul {f g : ℂ → ℂ} {z : ℂ} -+ (hf : DifferentiableAt ℂ f z) (hg : DifferentiableAt ℂ g z) -+ (hf_ne : f z ≠ 0) (hg_ne : g z ≠ 0) : -+ logDeriv (fun w ↦ f w * g w) z = logDeriv f z + logDeriv g z := by -+ exact logDeriv_mul z hf_ne hg_ne hf hg -+ -+lemma logDerivprod {K : Finset ℂ} {g : ℂ → ℂ → ℂ} {z : ℂ} -+ (hg_diff : ∀ ρ ∈ K, DifferentiableAt ℂ (g ρ) z) -+ (hg_ne : ∀ ρ ∈ K, g ρ z ≠ 0) : -+ logDeriv (fun w ↦ ∏ ρ ∈ K, g ρ w) z = ∑ ρ ∈ K, logDeriv (g ρ) z := by -+ simpa only [Finset.prod_fn] using logDeriv_prod hg_ne hg_diff -+ -+lemma logDerivdiv {h g : ℂ → ℂ} {z : ℂ} -+ (hh : DifferentiableAt ℂ h z) (hg : DifferentiableAt ℂ g z) -+ (hh_ne : h z ≠ 0) (hg_ne : g z ≠ 0) : -+ logDeriv (fun w ↦ h w / g w) z = logDeriv h z - logDeriv g z := by -+ exact logDeriv_div z hh_ne hg_ne hh hg -+ -+lemma logDerivfunpow {g : ℂ → ℂ} {z : ℂ} {m : ℕ} -+ (hg : DifferentiableAt ℂ g z) : -+ logDeriv (fun w ↦ (g w) ^ m) z = m * logDeriv g z := by -+ exact logDeriv_fun_pow hg m -+ -+lemma z_minus_rho_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (_h_f_zero : f 0 = 1) -+ (_h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ z - ρ ≠ 0 ∧ DifferentiableAt ℂ (fun w ↦ w - ρ) z := by -+ intro ρ hρ z hz -+ have hz_pair := (Set.mem_sdiff z).1 hz -+ have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R1 := hz_pair.1 -+ have hz_notK : z ∉ zerosetKfR R1 (by linarith) f := hz_pair.2 -+ -+ have hz_ne_rho : z ≠ ρ := by -+ intro h_eq -+ exact hz_notK (by simpa [h_eq] using hρ) -+ have h_nonzero : z - ρ ≠ 0 := sub_ne_zero.mpr hz_ne_rho -+ -+ have hdiff : DifferentiableAt ℂ (fun w => w) z := differentiableAt_fun_id -+ have hdiff_sub : DifferentiableAt ℂ (fun w => w - ρ) z := hdiff.sub_const ρ -+ exact ⟨h_nonzero, hdiff_sub⟩ -+ -+lemma blaschke_num_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (_h_f_zero : f 0 = 1) -+ (_h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R, -+ R - (star ρ) * z / R ≠ 0 ∧ DifferentiableAt ℂ (fun w ↦ R - (star ρ) * w / R) z := by -+ intro ρ hρ z hz -+ constructor -+ · intro hzero -+ have hRne : (R : ℂ) ≠ 0 := by -+ simpa using (Complex.ofReal_ne_zero.mpr (ne_of_gt (hR1_pos.trans hR1_lt_R))) -+ -+ have heq : (R : ℂ) = (star ρ) * z / (R : ℂ) := sub_eq_zero.mp hzero -+ have hmul := congrArg (fun t : ℂ => t * (R : ℂ)) heq -+ have heq_mul : (R : ℂ) * (R : ℂ) = (star ρ) * z := by -+ -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hRne] using hmul -+ -+ have hnorm_eq : ‖(R : ℂ)‖ * ‖(R : ℂ)‖ = ‖ρ‖ * ‖z‖ := by -+ simpa [Complex.norm_mul, Complex.norm_conj] using congrArg (fun t : ℂ => ‖t‖) heq_mul -+ -+ have hz_norm_le : ‖z‖ ≤ R := by -+ have hz' : dist z (0 : ℂ) ≤ R := (Metric.mem_closedBall.mp hz) -+ simpa [dist_eq_norm] using hz' -+ have hrho_norm_le : ‖ρ‖ ≤ R1 := by -+ rcases hρ with ⟨hρ_ball, _hρ_zero⟩ -+ have : dist ρ (0 : ℂ) ≤ R1 := (Metric.mem_closedBall.mp hρ_ball) -+ simpa [dist_eq_norm] using this -+ have hz_nonneg : 0 ≤ ‖z‖ := by simp -+ have hR1_nonneg : 0 ≤ R1 := le_of_lt hR1_pos -+ have hle : ‖ρ‖ * ‖z‖ ≤ R1 * R := by -+ have h1 : ‖ρ‖ * ‖z‖ ≤ R1 * ‖z‖ := mul_le_mul_of_nonneg_right hrho_norm_le hz_nonneg -+ have h2 : R1 * ‖z‖ ≤ R1 * R := mul_le_mul_of_nonneg_left hz_norm_le hR1_nonneg -+ exact le_trans h1 h2 -+ -+ have hnorm_R : ‖(R : ℂ)‖ = R := by -+ have h1 : ‖(R : ℂ)‖ = |R| := by simp -+ simp [abs_of_pos (hR1_pos.trans hR1_lt_R)] -+ -+ have : R * R = ‖ρ‖ * ‖z‖ := by simpa [hnorm_R] using hnorm_eq -+ have hle' : R * R ≤ R1 * R := by simpa [this] using hle -+ -+ have hposR : 0 < R := hR1_pos.trans hR1_lt_R -+ have hposRR : 0 < R * R := by nlinarith [hposR] -+ have hlt : R1 * R < R * R := by -+ exact mul_lt_mul_of_pos_right hR1_lt_R hposR -+ exact (lt_irrefl _ (lt_of_le_of_lt hle' hlt)) -+ · -+ have h_const : DifferentiableAt ℂ (fun _ : ℂ => (R : ℂ)) z := by -+ simp -+ have h_id : DifferentiableAt ℂ (fun w : ℂ => w) z := by -+ simp -+ have h_mul : DifferentiableAt ℂ (fun w : ℂ => (star ρ) * w) z := by -+ simpa using h_id.const_mul (star ρ) -+ have h_div : DifferentiableAt ℂ (fun w : ℂ => (star ρ) * w / (R : ℂ)) z := by -+ simpa [div_eq_mul_inv] using h_mul.mul_const ((R : ℂ)⁻¹) -+ simpa using h_const.sub h_div -+ -+lemma blaschke_frac_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ (R - (star ρ) * z / R) / (z - ρ) ≠ 0 ∧ -+ DifferentiableAt ℂ (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by -+ intro ρ hρ z hz -+ -+ have hden := z_minus_rho_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ z hz -+ have hden_ne : z - ρ ≠ 0 := hden.1 -+ have hden_diff : DifferentiableAt ℂ (fun w ↦ w - ρ) z := hden.2 -+ -+ have hz_in_small : z ∈ Metric.closedBall (0 : ℂ) R1 ∧ -+ z ∉ zerosetKfR R1 (by linarith) f := by -+ simpa [Set.mem_sdiff] using hz -+ have hz_small : z ∈ Metric.closedBall (0 : ℂ) R1 := hz_in_small.1 -+ -+ have hz_dist_le_small : dist z (0 : ℂ) ≤ R1 := by -+ simpa [Metric.mem_closedBall] using hz_small -+ have hRle : R ≤ 1 := le_of_lt hR_lt_1 -+ have hR1_le_R : R1 ≤ R := le_of_lt hR1_lt_R -+ have hR1_le_1 : R1 ≤ 1 := le_trans hR1_le_R hRle -+ have hz_ball1 : z ∈ Metric.closedBall (0 : ℂ) 1 := by -+ have hz_le1 : dist z (0 : ℂ) ≤ 1 := le_trans hz_dist_le_small hR1_le_1 -+ simpa [Metric.mem_closedBall] using hz_le1 -+ -+ have hz_ballR : z ∈ Metric.closedBall (0 : ℂ) R := by -+ have hz_le_R : dist z (0 : ℂ) ≤ R := le_trans hz_dist_le_small (le_of_lt hR1_lt_R) -+ simpa [Metric.mem_closedBall] using hz_le_R -+ have hnum := blaschke_num_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ z hz_ballR -+ have hnum_ne : R - (star ρ) * z / R ≠ 0 := hnum.1 -+ have hnum_diff : DifferentiableAt ℂ (fun w ↦ R - (star ρ) * w / R) z := hnum.2 -+ -+ refine And.intro ?_ ?_ -+ · intro h -+ have h' : (R - (star ρ) * z / R) * (z - ρ)⁻¹ = 0 := by -+ simpa [div_eq_mul_inv] using h -+ rcases mul_eq_zero.mp h' with hnum0 | hinv0 -+ · exact hnum_ne hnum0 -+ · exact hden_ne (inv_eq_zero.mp hinv0) -+ · exact hnum_diff.div hden_diff hden_ne -+ -+lemma blaschke_pow_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 ∧ -+ DifferentiableAt ℂ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ intro ρ hρ z hz -+ have hfrac := -+ blaschke_frac_diff_nonzero (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros -+ ρ hρ z hz -+ rcases hfrac with ⟨hne, hdiff⟩ -+ constructor -+ · exact pow_ne_zero _ hne -+ · convert hdiff.pow ((analyticOrderAt f ρ).toNat) using 1 -+ -+lemma blaschke_prod_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ (∏ ρ ∈ h_finite_zeros.toFinset, ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 ∧ -+ DifferentiableAt ℂ (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ intro z hz -+ classical -+ constructor -+ · -+ have hne_each : ∀ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 := by -+ intro ρ hρ -+ have hρ' : ρ ∈ zerosetKfR R1 (by linarith) f := -+ (h_finite_zeros.mem_toFinset).1 hρ -+ have hpair := -+ blaschke_pow_diff_nonzero (R := R) (R1 := R1) (f := f) -+ hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ' z hz -+ exact hpair.1 -+ exact (Finset.prod_ne_zero_iff).2 hne_each -+ · -+ have hdiff_each : ∀ ρ ∈ h_finite_zeros.toFinset, -+ DifferentiableAt ℂ -+ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ intro ρ hρ -+ have hρ' : ρ ∈ zerosetKfR R1 (by linarith) f := -+ (h_finite_zeros.mem_toFinset).1 hρ -+ have hpair := -+ blaschke_pow_diff_nonzero (R := R) (R1 := R1) (f := f) -+ hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ' z hz -+ exact hpair.2 -+ -+ have hdiff := -+ (DifferentiableAt.finsetProd (u := h_finite_zeros.toFinset) -+ (f := fun ρ => fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) -+ (x := z) hdiff_each) -+ have hfun_eq : -+ (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) -+ = -+ (∏ ρ ∈ h_finite_zeros.toFinset, -+ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat)) := by -+ funext w -+ simp [Finset.prod_apply] -+ exact hfun_eq.symm ▸ hdiff -+ -+lemma f_diff_nonzero_outside_Kf {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (_h_f_zero : f 0 = 1) -+ (_h_finite_zeros : (zerosetKfR R1 (by linarith ) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ f z ≠ 0 ∧ DifferentiableAt ℂ f z := by -+ intro z hz -+ -+ have hz' : z ∈ Metric.closedBall (0 : ℂ) R1 ∧ -+ z ∉ zerosetKfR R1 (by linarith) f := by -+ simpa [Set.mem_sdiff] using hz -+ have hz_in_R1 : z ∈ Metric.closedBall (0 : ℂ) R1 := hz'.1 -+ have hz_notin : z ∉ zerosetKfR R1 (by linarith) f := hz'.2 -+ -+ have hz_nonzero : f z ≠ 0 := by -+ intro hfz -+ exact hz_notin ⟨hz_in_R1, hfz⟩ -+ -+ have hR1_lt_1 : R1 < 1 := by linarith -+ have hsubset1 : -+ Metric.closedBall (0 : ℂ) R1 ⊆ Metric.ball (0 : ℂ) 1 := -+ Metric.closedBall_subset_ball hR1_lt_1 -+ have hz_in_ball1 : z ∈ Metric.ball (0 : ℂ) 1 := hsubset1 hz_in_R1 -+ have hz_in_1 : z ∈ Metric.closedBall (0 : ℂ) 1 := -+ Metric.ball_subset_closedBall hz_in_ball1 -+ have hAna : AnalyticAt ℂ f z := h_f_analytic z hz_in_1 -+ have hDiff : DifferentiableAt ℂ f z := hAna.differentiableAt -+ exact ⟨hz_nonzero, hDiff⟩ -+ -+lemma Bf_diff_nonzero_outside_Kf -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z ≠ 0 ∧ -+ DifferentiableAt ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z := by -+ intro z hz -+ -+ rw [Set.mem_sdiff] at hz -+ have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R1 := hz.1 -+ -+ constructor -+ · -+ exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz_ball -+ -+ · -+ -+ have hz_R : z ∈ Metric.closedBall (0 : ℂ) R := -+ Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_R) hz_ball -+ -+ have h_analytic_on := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec -+ -+ have h_analytic_at := h_analytic_on z hz_R -+ -+ exact h_analytic_at.differentiableAt -+ -+lemma logDeriv_fprod_is_sum {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ logDeriv (fun w ↦ f w * ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = -+ logDeriv f z + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ intro z hz -+ have hf' := f_diff_nonzero_outside_Kf (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz -+ rcases hf' with ⟨hf_ne, hf_diff⟩ -+ have hg' := blaschke_prod_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz -+ rcases hg' with ⟨hg_ne, hg_diff⟩ -+ simpa using -+ (logDerivmul (f:=f) (g:=fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) (z:=z) -+ hf_diff hg_diff hf_ne hg_ne) -+ -+lemma nhds_avoids_finset {z : ℂ} (K : Finset ℂ) (hz : z ∉ (K : Set ℂ)) : ∀ᶠ w in nhds z, ∀ ρ ∈ K, w ≠ ρ := by -+ classical -+ -+ let U : Set ℂ := ⋂ ρ ∈ K, {w : ℂ | w ≠ ρ} -+ -+ have hopen_each : ∀ ρ ∈ K, IsOpen ({w : ℂ | w ≠ ρ} : Set ℂ) := by -+ intro ρ hρ -+ have hopen : IsOpen ((({ρ} : Set ℂ)ᶜ : Set ℂ)) := isOpen_compl_singleton -+ have hEq : ((({ρ} : Set ℂ)ᶜ : Set ℂ)) = {w : ℂ | w ≠ ρ} := by -+ ext w; simp -+ simpa [hEq] -+ using hopen -+ -+ have hopenU : IsOpen U := -+ isOpen_biInter_finset (s := K) (f := fun ρ : ℂ => ({w : ℂ | w ≠ ρ} : Set ℂ)) hopen_each -+ -+ have hzU : z ∈ U := by -+ have hznot : ∀ ρ ∈ K, z ≠ ρ := by -+ intro ρ hρ h -+ exact hz (by simpa [h] using hρ) -+ simpa [U] using hznot -+ -+ have hU_mem : U ∈ nhds z := hopenU.mem_nhds hzU -+ -+ refine Filter.eventually_of_mem hU_mem ?_ -+ intro w hw ρ hρ -+ have hw_all := Set.mem_iInter₂.mp hw -+ have : w ∈ ({w : ℂ | w ≠ ρ} : Set ℂ) := hw_all ρ hρ -+ simpa using this -+ -+lemma pow_div_pow_eq_div_pow (a b : ℂ) (n : ℕ) : a^n / b^n = (a / b)^n := by -+ simpa using (div_pow a b n).symm -+ -+lemma Cf_eventually_eq_f_div_prod {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ : ℂ → (ℂ → ℂ)) -+ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : -+ (fun w ↦ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (by simp [h_f_zero]) h_finite_zeros h_σ w) -+ =ᶠ[nhds z] -+ (fun w ↦ f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) := by -+ classical -+ rcases hz with ⟨hz_ball, hz_notin⟩ -+ -+ set S : Set ℂ := zerosetKfR R1 (by linarith) f -+ have hS_fin : S.Finite := h_finite_zeros -+ have hS_closed : IsClosed S := hS_fin.isClosed -+ have hU_open : IsOpen Sᶜ := hS_closed.isOpen_compl -+ have hz_memU : z ∈ Sᶜ := by simpa [S] using hz_notin -+ have hU_mem : Sᶜ ∈ nhds z := hU_open.mem_nhds hz_memU -+ refine Filter.eventually_of_mem hU_mem ?_ -+ intro w hw -+ have hw_notin : w ∉ S := by -+ -+ simpa [Set.mem_compl] using hw -+ -+ simp [S, Cf, hw_notin] -+ -+lemma eventuallyEq_mul_right_fun {α β} {l : Filter α} [Mul β] -+ {f g h : α → β} (hfg : f =ᶠ[l] g) : -+ (fun x => f x * h x) =ᶠ[l] (fun x => g x * h x) := by -+ filter_upwards [hfg] with x hx -+ rw [hx] -+ -+lemma inv_prod_complex {ι} (s : Finset ι) (f : ι → ℂ) : (∏ x ∈ s, f x)⁻¹ = ∏ x ∈ s, (f x)⁻¹ := by -+ classical -+ simp -+ -+lemma prod_num_mul_inv_den_eq_prod_ratio -+ (K : Finset ℂ) (N D : ℂ → ℂ) (m : ℂ → ℕ) : -+ (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ -+ = ∏ ρ ∈ K, ((N ρ / D ρ) ^ (m ρ)) := by -+ classical -+ -+ have hinv : (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ = ∏ ρ ∈ K, ((D ρ) ^ (m ρ))⁻¹ := by -+ simp -+ calc -+ (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ -+ = (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, ((D ρ) ^ (m ρ))⁻¹) := by -+ simp -+ _ = ∏ ρ ∈ K, ((N ρ) ^ (m ρ) * ((D ρ) ^ (m ρ))⁻¹) := by -+ simpa using (Finset.prod_mul_distrib (s := K) -+ (f := fun ρ => (N ρ) ^ (m ρ)) -+ (g := fun ρ => ((D ρ) ^ (m ρ))⁻¹)).symm -+ _ = ∏ ρ ∈ K, ((N ρ / D ρ) ^ (m ρ)) := by -+ apply Finset.prod_congr rfl -+ intro ρ hρ -+ -+ calc -+ (N ρ) ^ (m ρ) * ((D ρ) ^ (m ρ))⁻¹ -+ = (N ρ) ^ (m ρ) * ((D ρ)⁻¹) ^ (m ρ) := by -+ simp -+ _ = ((N ρ) * (D ρ)⁻¹) ^ (m ρ) := by -+ simp [mul_pow] -+ _ = (N ρ / D ρ) ^ (m ρ) := by -+ simp [div_eq_mul_inv] -+ -+lemma prod_num_mul_inv_den_eq_prod_ratio_fun -+ (K : Finset ℂ) (N D : ℂ → ℂ → ℂ) (m : ℂ → ℕ) : -+ (fun w ↦ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹) -+ = (fun w ↦ ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ))) := by -+ funext w -+ classical -+ have h_inv : -+ (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ = ∏ ρ ∈ K, ((D ρ w) ^ (m ρ))⁻¹ := by -+ simp -+ calc -+ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ -+ = (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, ((D ρ w) ^ (m ρ))⁻¹) := by -+ rw [h_inv] -+ _ = ∏ ρ ∈ K, ((N ρ w) ^ (m ρ)) * ((D ρ w) ^ (m ρ))⁻¹ := by -+ simpa using -+ (Finset.prod_mul_distrib -+ (s := K) -+ (f := fun ρ => (N ρ w) ^ (m ρ)) -+ (g := fun ρ => ((D ρ w) ^ (m ρ))⁻¹)).symm -+ _ = ∏ ρ ∈ K, (N ρ w / D ρ w) ^ (m ρ) := by -+ refine Finset.prod_congr rfl ?_ -+ intro ρ hρ -+ have hpow : -+ (N ρ w / D ρ w) ^ (m ρ) -+ = ((N ρ w) ^ (m ρ)) * ((D ρ w) ^ (m ρ))⁻¹ := by -+ simp [div_eq_mul_inv, mul_pow, inv_pow] -+ simp [hpow] -+ -+lemma div_mul_eq_mul_mul_inv_fun {α} (f A B : α → ℂ) : -+ (fun w => (f w / A w) * B w) = (fun w => f w * (B w * (A w)⁻¹)) := by -+ funext w -+ simp [div_eq_mul_inv, mul_comm, mul_left_comm] -+ -+lemma assoc_fun_mul {α} (f g h : α → ℂ) : (fun w => f w * (g w * h w)) = (fun w => (f w * g w) * h w) := by -+ funext w -+ simp [mul_assoc] -+ -+lemma prod_num_mul_inv_den_eq_prod_ratio_fun_mem -+ (K : Finset ℂ) (N D : ℂ → ℂ → ℂ) (m : ℂ → ℕ) : -+ (fun w ↦ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹) -+ = (fun w ↦ ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ))) := by -+ funext w -+ classical -+ calc -+ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ -+ = (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) / (∏ ρ ∈ K, (D ρ w) ^ (m ρ)) := by -+ simp [div_eq_mul_inv] -+ _ = ∏ ρ ∈ K, ((N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ)) := by -+ simp -+ _ = ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ)) := by -+ refine Finset.prod_congr rfl ?_ -+ intro ρ hρ -+ have hpow_div : -+ (N ρ w / D ρ w) ^ (m ρ) -+ = (N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ) := by -+ calc -+ (N ρ w / D ρ w) ^ (m ρ) -+ = (N ρ w * (D ρ w)⁻¹) ^ (m ρ) := by -+ simp [div_eq_mul_inv] -+ _ = (N ρ w) ^ (m ρ) * ((D ρ w)⁻¹) ^ (m ρ) := by -+ simpa using (mul_pow (N ρ w) ((D ρ w)⁻¹) (m ρ)) -+ _ = (N ρ w) ^ (m ρ) * ((D ρ w) ^ (m ρ))⁻¹ := by -+ simp -+ _ = (N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ) := by -+ simp [div_eq_mul_inv] -+ simpa using hpow_div.symm -+ -+lemma eventuallyEq_of_eq {α β} {l : Filter α} {f g : α → β} (h : f = g) : f =ᶠ[l] g := by -+ simp [h] -+ -+lemma logDeriv_congr_of_eventuallyEq {f g : ℂ → ℂ} {z : ℂ} -+ (hfg : f =ᶠ[nhds z] g) : logDeriv f z = logDeriv g z := by -+ -+ have hval : f z = g z := Filter.EventuallyEq.eq_of_nhds hfg -+ have hderiv_eq_ev : deriv f =ᶠ[nhds z] deriv g := hfg.deriv -+ have hderiv : deriv f z = deriv g z := Filter.EventuallyEq.eq_of_nhds hderiv_eq_ev -+ -+ have hf := deriv_over_fun_is_logDeriv (g := f) z -+ have hg := deriv_over_fun_is_logDeriv (g := g) z -+ simp [hf.symm, hg.symm, hval, hderiv] -+ -+lemma logDeriv_Bf_is_sum : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ -+ zerosetKfR R1 (by linarith) f, -+ logDeriv (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z = -+ logDeriv f z + -+ logDeriv -+ (fun w ↦ -+ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ classical -+ intro z hz -+ -+ set K : Finset ℂ := h_finite_zeros.toFinset -+ -+ let A : ℂ → ℂ := fun w => ∏ ρ ∈ K, (w - ρ) ^ (analyticOrderAt f ρ).toNat -+ let BN : ℂ → ℂ := fun w => ∏ ρ ∈ K, (R - (star ρ) * w / R) ^ (analyticOrderAt f ρ).toNat -+ let RatProd : ℂ → ℂ := -+ fun w => ∏ ρ ∈ K, ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat -+ -+ set S : Set ℂ := zerosetKfR R1 (by linarith) f -+ have hS_fin : S.Finite := h_finite_zeros -+ have hU_open : IsOpen Sᶜ := hS_fin.isClosed.isOpen_compl -+ have hz_notin : z ∉ S := by -+ rcases hz with ⟨_, hnotin⟩; exact hnotin -+ have hzU : z ∈ Sᶜ := by simpa [Set.mem_compl] using hz_notin -+ have hU_mem : Sᶜ ∈ nhds z := hU_open.mem_nhds hzU -+ have h_ev : -+ (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) -+ =ᶠ[nhds z] -+ (fun w ↦ f w * RatProd w) := by -+ refine Filter.eventually_of_mem hU_mem ?_ -+ intro w hwU -+ have hw_notin : w ∉ S := by simpa [Set.mem_compl] using hwU -+ -+ have hBf_w : -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w -+ = Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w * BN w := by -+ simp [Bf, BN, K] -+ have hCf_w : -+ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w -+ = f w / A w := by -+ simp [Cf, S, A, K, hw_notin] -+ -+ have h_eq1 := div_mul_eq_mul_mul_inv_fun (f := f) (A := A) (B := BN) -+ have h_eq1_w : (f w / A w) * BN w = f w * (BN w * (A w)⁻¹) := by -+ simpa using congrArg (fun g : (ℂ → ℂ) => g w) h_eq1 -+ have h_eq2 := -+ prod_num_mul_inv_den_eq_prod_ratio_fun_mem -+ (K := K) -+ (N := fun ρ w ↦ (R - (star ρ) * w / R)) -+ (D := fun ρ w ↦ (w - ρ)) -+ (m := fun ρ ↦ (analyticOrderAt f ρ).toNat) -+ have h_eq2_w : BN w * (A w)⁻¹ = RatProd w := by -+ simpa [BN, A, RatProd] using congrArg (fun g : (ℂ → ℂ) => g w) h_eq2 -+ -+ calc -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w -+ = (f w / A w) * BN w := by simpa [hCf_w] using hBf_w -+ _ = f w * (BN w * (A w)⁻¹) := h_eq1_w -+ _ = f w * RatProd w := by simp [h_eq2_w] -+ -+ have hlog_congr := logDeriv_congr_of_eventuallyEq (f := fun w ↦ -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) -+ (g := fun w ↦ f w * RatProd w) (z := z) h_ev -+ -+ have hsum := -+ (logDeriv_fprod_is_sum (R:=R) (R1:=R1) (f:=f) -+ hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz) -+ simpa [RatProd, K] using hlog_congr.trans hsum -+ -+lemma logDeriv_def_as_frac {f : ℂ → ℂ} {z : ℂ} -+ (_hf : DifferentiableAt ℂ f z) (_hf_ne : f z ≠ 0) : -+ logDeriv f z = deriv f z / f z := by -+ simp [logDeriv] -+ -+theorem ball_containment {r R1 : ℝ} (_hr_pos : 0 < r) (hr_lt_R1 : r < R1) (z : ℂ) (hz : z ∈ Metric.closedBall 0 r) : z ∈ Metric.closedBall 0 R1 := by -+ simp at * -+ exact le_trans hz (le_of_lt hr_lt_R1) -+ -+theorem in_r_minus_kf {R1 r : ℝ} {f : ℂ → ℂ} -+ (hr_pos : 0 < r) -+ (hr_lt_R1 : r < R1) -+ (z : ℂ) -+ (hz : z ∈ Metric.closedBall 0 r \ zerosetKfR R1 (by linarith) f) : -+ z ∈ Metric.closedBall 0 R1 \ zerosetKfR R1 (by linarith) f := by -+ obtain ⟨h1, h2⟩ := hz -+ have : z ∈ Metric.closedBall 0 R1 := by -+ apply ball_containment hr_pos hr_lt_R1 z h1 -+ constructor <;> assumption -+ -+lemma Lf_deriv_step1 : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, -+ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = -+ deriv f z / f z + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ intro z hz -+ -+ have hz' : z ∈ Metric.closedBall (0 : ℂ) r ∧ z ∉ zerosetKfR R1 (by linarith) f := by -+ simpa [Set.mem_sdiff] using hz -+ have hz_ball : z ∈ Metric.closedBall (0 : ℂ) r := hz'.1 -+ -+ have hLf := -+ -+ (Lf_deriv_is_logBf_deriv hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec -+ z (in_r_minus_kf hr_pos hr_lt_R1 _ hz)).symm -+ -+ have hsum : -+ logDeriv (fun w ↦ -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) -+ h_finite_zeros h_σ w) z = -+ logDeriv f z + -+ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ have h := -+ (logDeriv_Bf_is_sum (R := R) (R1 := R1) (r := r) (f := f) (h_σ := h_σ) -+ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros) z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) -+ simpa using h -+ -+ obtain ⟨hf_ne, hfdiff⟩ := -+ f_diff_nonzero_outside_Kf (R := R) (R1 := R1) (f := f) -+ hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) -+ have hfrac : logDeriv f z = deriv f z / f z := -+ logDeriv_def_as_frac (f := f) (z := z) hfdiff hf_ne -+ -+ have hLf_eq_logDerivBf : -+ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = -+ logDeriv (fun w ↦ -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) -+ h_finite_zeros h_σ w) z := by -+ -+ have hz_in_r : z ∈ Metric.closedBall (0 : ℂ) r := hz_ball -+ -+ let B_f : ℂ → ℂ := -+ fun w => Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w -+ let log_exists := log_of_analytic -+ (r1 := r) (R' := R1) (R := R) -+ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 -+ (B := B_f) -+ (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 -+ f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) -+ (hB_ne_zero := by -+ intro w hw -+ exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 -+ f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec w hw) -+ have hderiv_all : ∀ w ∈ Metric.closedBall (0 : ℂ) r, -+ deriv (Classical.choose log_exists) w = deriv B_f w / B_f w := -+ (Classical.choose_spec log_exists).2.2.1 -+ have hderiv_Lf : -+ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos -+ h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z -+ = deriv B_f z / B_f z := by -+ -+ unfold Lf -+ -+ simpa using hderiv_all z hz_in_r -+ -+ have h_as_log : deriv B_f z / B_f z = logDeriv B_f z := -+ deriv_over_fun_is_logDeriv (g := B_f) z -+ -+ simpa [B_f] using hderiv_Lf.trans h_as_log -+ -+ calc -+ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z -+ = logDeriv (fun w ↦ -+ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) -+ h_finite_zeros h_σ w) z := hLf_eq_logDerivBf -+ _ = logDeriv f z + -+ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := hsum -+ _ = deriv f z / f z + -+ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ simp [hfrac] -+ -+lemma logDeriv_prod_is_sum {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = -+ ∑ ρ ∈ h_finite_zeros.toFinset, logDeriv (fun w ↦ -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ intro z hz -+ have hdiff : ∀ ρ ∈ h_finite_zeros.toFinset, -+ DifferentiableAt ℂ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by -+ intro ρ hρ -+ have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := -+ (h_finite_zeros.mem_toFinset).mp hρ -+ have h := blaschke_pow_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρmem z hz -+ exact h.2 -+ have hne : ∀ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 := by -+ intro ρ hρ -+ have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := -+ (h_finite_zeros.mem_toFinset).mp hρ -+ have h := blaschke_pow_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρmem z hz -+ exact h.1 -+ simpa using -+ (logDerivprod (K := h_finite_zeros.toFinset) -+ (g := fun ρ w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) -+ (z := z) hdiff hne) -+ -+lemma logDeriv_power_is_mul {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ ∀ ρ ∈ h_finite_zeros.toFinset, -+ logDeriv (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = -+ (analyticOrderAt f ρ).toNat * logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by -+ intro z hz ρ hρFin -+ have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := by -+ simpa using (h_finite_zeros.mem_toFinset.mp hρFin) -+ have hfrac := -+ blaschke_frac_diff_nonzero (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros -+ ρ hρmem z hz -+ rcases hfrac with ⟨_hneq, hdiff⟩ -+ simpa using -+ (logDerivfunpow (g := fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) (z := z) -+ (m := (analyticOrderAt f ρ).toNat) hdiff) -+ -+lemma logDeriv_prod_is_sum_mul {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, -+ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = -+ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * -+ logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by -+ intro z hz -+ classical -+ have hsum := -+ logDeriv_prod_is_sum (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz -+ refine hsum.trans ?_ -+ refine Finset.sum_congr rfl ?_ -+ intro ρ hρ -+ exact -+ logDeriv_power_is_mul (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ρ hρ -+ -+lemma Lf_deriv_step2 : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, -+ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = -+ deriv f z / f z + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * -+ logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by -+ intro z hz -+ classical -+ have h1 := -+ Lf_deriv_step1 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz -+ have hsum := -+ logDeriv_prod_is_sum_mul (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) -+ have h2 := congrArg (fun t => deriv f z / f z + t) hsum -+ exact h1.trans h2 -+ -+lemma logDeriv_Blaschke_is_diff {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ ∀ ρ ∈ h_finite_zeros.toFinset, -+ logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z = -+ logDeriv (fun w ↦ R - (star ρ) * w / R) z - logDeriv (fun w ↦ w - ρ) z := by -+ intro z hz ρ hρ -+ have hρ_set : ρ ∈ zerosetKfR R1 (by linarith) f := by -+ exact (Set.Finite.mem_toFinset (hs := h_finite_zeros) (a := ρ)).mp hρ -+ rcases hz with ⟨hz_in, hz_notin⟩ -+ have hden := z_minus_rho_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros -+ ρ hρ_set z ⟨hz_in, hz_notin⟩ -+ rcases hden with ⟨hden_nz, hden_diff⟩ -+ have hz_le : ‖z‖ ≤ R1 := by -+ simpa [Metric.closedBall, dist_eq_norm] using hz_in -+ have hle1 : R1 < 1 := by linarith [hR1_lt_R, hR_lt_1] -+ have hz_in1 : z ∈ Metric.closedBall (0 : ℂ) 1 := by -+ have : ‖z‖ ≤ 1 := le_of_lt (hz_le.trans_lt hle1) -+ simpa [Metric.closedBall, dist_eq_norm] using this -+ have hz_inR : z ∈ Metric.closedBall (0 : ℂ) R := by -+ have hz_le_R : ‖z‖ ≤ R := by -+ calc ‖z‖ ≤ R1 := hz_le -+ _ ≤ R := le_of_lt hR1_lt_R -+ simpa [Metric.closedBall, dist_eq_norm] using hz_le_R -+ have hnum := blaschke_num_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros -+ ρ hρ_set z hz_inR -+ rcases hnum with ⟨hnum_nz, hnum_diff⟩ -+ simpa using -+ (logDerivdiv (hh := hnum_diff) (hg := hden_diff) (hh_ne := hnum_nz) (hg_ne := hden_nz)) -+ -+lemma logDeriv_linear {a b : ℂ} {z : ℂ} (_ha : a ≠ 0) (_hz : z ≠ -b/a) : -+ logDeriv (fun w ↦ a * w + b) z = a / (a * z + b) := by -+ -+ have h_id : HasDerivAt (fun w : ℂ => w) (1 : ℂ) z := hasDerivAt_id _ -+ have h_mul' : HasDerivAt (fun w : ℂ => a * w) a z := by -+ simpa [one_mul] using (h_id.const_mul a) -+ have h_deriv_mul : deriv (fun w : ℂ => a * w) z = a := h_mul'.deriv -+ -+ simp [logDeriv] -+ -+lemma logDeriv_denominator {ρ : ℂ} {z : ℂ} (hz : z ≠ ρ) : -+ logDeriv (fun w ↦ w - ρ) z = 1 / (z - ρ) := by -+ have h := -+ logDeriv_linear (a := (1 : ℂ)) (b := -ρ) (z := z) -+ (_ha := by simp) -+ (_hz := by simpa using hz) -+ simpa [one_mul, sub_eq_add_neg] using h -+ -+lemma logDeriv_numerator_pre {R : ℝ} {ρ : ℂ} {z : ℂ} : -+ logDeriv (fun w ↦ R - (star ρ) * w / R) z = -(star ρ) / R / (R - (star ρ) * z / R) := by -+ classical -+ -+ let a : ℂ := -(star ρ) / (R : ℂ) -+ let b : ℂ := (R : ℂ) -+ have hlin : (fun w : ℂ ↦ (R : ℂ) - (star ρ) * w / (R : ℂ)) = (fun w : ℂ ↦ b + a * w) := by -+ funext w -+ -+ simp [a, b, sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm] -+ -+ have hderiv_add : deriv (fun w : ℂ => b + a * w) z = -+ deriv (fun _ : ℂ => b) z + deriv (fun y : ℂ => a * y) z := by -+ simp -+ have hderiv_ab : deriv (fun w : ℂ => b + a * w) z = a := by -+ simp [deriv_const, mul_comm] -+ -+ simp [logDeriv, sub_eq_add_neg, div_eq_mul_inv, -+ mul_comm, mul_left_comm, mul_assoc, add_comm] -+ -+lemma star_ne_zero_of_ne_zero {ρ : ℂ} (hρ : ρ ≠ 0) : star ρ ≠ 0 := by -+ -+ intro h -+ -+ have : ρ = 0 := (star_eq_zero).1 h -+ exact hρ this -+ -+lemma field_identity_general {K : Type*} [Field K] {a b c : K} (ha : a ≠ 0) (hb : b ≠ 0) (_hden : a - c*b/a ≠ 0) : (-(b/a)) / (a - c*b/a) = (1 : K) / (c - a^2/b) := by -+ -+ have hmul : (-(a / b) : K) ≠ 0 := by -+ have hdiv_ne : a / b ≠ 0 := div_ne_zero ha hb -+ exact neg_ne_zero.mpr hdiv_ne -+ have hnum : (-(b/a) * (-(a/b))) = (1 : K) := by -+ calc -+ (-(b/a) * (-(a/b))) = (b/a) * (a/b) := by simp -+ _ = (b * a⁻¹) * (a * b⁻¹) := by simp [div_eq_mul_inv] -+ _ = b * (a⁻¹ * (a * b⁻¹)) := by simp [mul_assoc] -+ _ = b * ((a⁻¹ * a) * b⁻¹) := by simp [mul_assoc] -+ _ = b * (1 * b⁻¹) := by simp [ha] -+ _ = b * b⁻¹ := by simp -+ _ = 1 := by simp [hb] -+ have hOne : (b/a) * (a/b) = (1 : K) := by -+ calc -+ (b/a) * (a/b) = (b * a⁻¹) * (a * b⁻¹) := by simp [div_eq_mul_inv] -+ _ = b * (a⁻¹ * (a * b⁻¹)) := by simp [mul_assoc] -+ _ = b * ((a⁻¹ * a) * b⁻¹) := by simp [mul_assoc] -+ _ = b * (1 * b⁻¹) := by simp [ha] -+ _ = b * b⁻¹ := by simp -+ _ = 1 := by simp [hb] -+ have haab : a * (a / b) = a^2 / b := by -+ simp [div_eq_mul_inv, pow_two, mul_assoc] -+ have hcbab : (c * b / a) * (a / b) = c := by -+ calc -+ (c * b / a) * (a / b) = (c * (b / a)) * (a / b) := by simp [div_eq_mul_inv, mul_assoc] -+ _ = c * ((b / a) * (a / b)) := by simp [mul_assoc] -+ _ = c * 1 := by simp [hOne] -+ _ = c := by simp -+ have hdenom : ((a - c*b/a) * (-(a/b))) = c - a^2 / b := by -+ calc -+ ((a - c*b/a) * (-(a/b))) = -((a - c*b/a) * (a / b)) := by simp [mul_neg] -+ _ = -(a * (a / b) - (c * b / a) * (a / b)) := by simp [sub_mul] -+ _ = (c * b / a) * (a / b) - a * (a / b) := by simp [neg_sub] -+ _ = c - a^2 / b := by simp [hcbab, haab] -+ calc -+ (-(b/a)) / (a - c*b/a) -+ = (-(b/a) * (-(a/b))) / ((a - c*b/a) * (-(a/b))) := by -+ simpa using -+ (mul_div_mul_right (a := (-(b / a))) (b := (a - c * b / a)) (c := (-(a / b))) hmul).symm -+ _ = 1 / ((a - c*b/a) * (-(a/b))) := by simp [hnum] -+ _ = 1 / (c - a^2/b) := by simp [hdenom] -+ -+lemma complex_identity_from_field {R : ℝ} {ρ z : ℂ} (hR : R ≠ 0) (hρ : ρ ≠ 0) (hden : (R:ℂ) - (star ρ) * z / R ≠ 0) : (-(star ρ) / (R:ℂ)) / ((R:ℂ) - (star ρ) * z / R) = (1 : ℂ) / (z - (R:ℂ)^2 / (star ρ)) := by -+ have ha : (R : ℂ) ≠ 0 := by simpa using (Complex.ofReal_ne_zero.mpr hR) -+ have hb : star ρ ≠ 0 := star_ne_zero_of_ne_zero hρ -+ have hden' : (R : ℂ) - z * (star ρ) / (R : ℂ) ≠ 0 := by -+ simpa [mul_comm, mul_left_comm, mul_assoc, div_eq_mul_inv] using hden -+ have h := field_identity_general (K := ℂ) (a := (R : ℂ)) (b := star ρ) (c := z) ha hb hden' -+ simpa [mul_comm, mul_left_comm, mul_assoc, div_eq_mul_inv] using h -+ -+lemma logDeriv_numerator_rearranged {R : ℝ} {ρ z : ℂ} (hR : R ≠ 0) (hrho : ρ ≠ 0) (h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0) : -(star ρ) / R / ((R : ℂ) - (star ρ) * z / R) = 1 / (z - (R : ℂ)^2 / (star ρ)) := by -+ simpa using (complex_identity_from_field (R:=R) (ρ:=ρ) (z:=z) (hR:=hR) (hρ:=hrho) (hden:=h_denom_ne_zero)) -+ -+lemma logDeriv_numerator {R : ℝ} {ρ : ℂ} {z : ℂ} -+ (hR : R ≠ 0) -+ (hrho : ρ ≠ 0) -+ (h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0): -+ logDeriv (fun w ↦ R - (star ρ) * w / R) z = 1 / (z - R^2 / (star ρ)) := by -+ rw [logDeriv_numerator_pre, logDeriv_numerator_rearranged] -+ <;> assumption -+ -+lemma logDeriv_Blaschke_is_diff_frac {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) (h_f_zero : f 0 = 1) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ ρ ∈ h_finite_zeros.toFinset, -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f , logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z = -+ 1 / (z - R^2 / (star ρ)) - 1 / (z - ρ) := by -+ intro ρ hρ z hz -+ -+ have h_div := logDeriv_Blaschke_is_diff (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ρ hρ -+ -+ have hρ_mem : ρ ∈ zerosetKfR R1 (by linarith) f := by -+ exact (h_finite_zeros.mem_toFinset).mp hρ -+ have hρ_ne_zero : ρ ≠ 0 := by -+ intro h_eq -+ -+ have : f 0 = 0 := by simpa [h_eq] using hρ_mem.2 -+ exact (zero_ne_one : (0 : ℂ) ≠ 1) (this.symm.trans h_f_zero) -+ have hR_ne_zero : R ≠ 0 := ne_of_gt (hR1_pos.trans hR1_lt_R) -+ have h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0 := by -+ -+ have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R := by -+ have hle : R1 < R := hR1_lt_R -+ apply Metric.closedBall_subset_closedBall (le_of_lt hle) -+ exact hz.1 -+ have h := blaschke_num_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ_mem z hz_ball -+ exact h.1 -+ have h_num := logDeriv_numerator hR_ne_zero hρ_ne_zero h_denom_ne_zero -+ -+ have hz_ne_rho : z ≠ ρ := by -+ intro h_eq -+ exact hz.2 (by simpa [h_eq] using hρ_mem) -+ have h_den := logDeriv_denominator hz_ne_rho -+ -+ rw [h_div, h_num, h_den] -+ -+lemma Lf_deriv_step3 : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, -+ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = -+ deriv f z / f z + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * (1 / (z - R^2 / (star ρ)) - 1 / (z - ρ)) := by -+ intro z hz -+ -+ rw [Lf_deriv_step2 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz] -+ congr 1 -+ apply Finset.sum_congr rfl -+ intro ρ hρ -+ congr 1 -+ exact logDeriv_Blaschke_is_diff_frac hR1_pos hR1_lt_R hR_lt_1 h_f_zero h_f_analytic h_finite_zeros ρ hρ z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) -+ -+lemma sum_of_diff {K : Finset ℂ} {a b : ℂ → ℂ} : -+ ∑ ρ ∈ K, (a ρ - b ρ) = ∑ ρ ∈ K, a ρ - ∑ ρ ∈ K, b ρ := by -+ simp [Finset.sum_sub_distrib] -+ -+lemma sum_rearranged {R R1 : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (_h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, -+ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * -+ (1 / (z - R^2 / (star ρ)) - 1 / (z - ρ)) = -+ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) - -+ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) := by -+ intro z hz -+ rw [← Finset.sum_sub_distrib] -+ congr 1 -+ ext ρ -+ rw [mul_sub, mul_one_div, mul_one_div] -+ -+lemma Lf_deriv_final_formula : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, -+ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = -+ deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) + -+ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) := by -+ intro z hz -+ -+ rw [Lf_deriv_step3 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz] -+ -+ rw [sum_rearranged hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz] -+ -+ ring -+ -+lemma rearrange_Lf_deriv : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, -+ deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) = -+ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z - -+ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) := by -+ intro z hz -+ -+ have h_final := Lf_deriv_final_formula hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz -+ rw [h_final] -+ ring -+ -+lemma triangle_ineq_sum {w₁ w₂ : ℂ} : -+ ‖w₁ - w₂‖ ≤ ‖w₁‖ + ‖w₂‖ := by -+ have h : w₁ - w₂ = w₁ + (-w₂) := sub_eq_add_neg w₁ w₂ -+ rw [h] -+ have h₁ : ‖w₁ + (-w₂)‖ ≤ ‖w₁‖ + ‖-w₂‖ := norm_add_le w₁ (-w₂) -+ have h₂ : ‖-w₂‖ = ‖w₂‖ := norm_neg w₂ -+ rw [h₂] at h₁; exact h₁ -+ -+lemma target_inequality_setup : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, -+ ‖deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ -+ ‖deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z‖ + -+ ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ := by -+ intro z hz -+ -+ have hrearr := rearrange_Lf_deriv hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz -+ -+ rw [hrearr] -+ exact norm_sub_le _ _ -+ -+lemma conj_norm_eq_norm (z : ℂ) : ‖star z‖ = ‖z‖ := by -+ simp -+ -+lemma norm_div_eq (a b : ℂ) (_hb : b ≠ 0) : ‖a / b‖ = ‖a‖ / ‖b‖ := by -+ calc -+ ‖a / b‖ = ‖a * b⁻¹‖ := by simp [div_eq_mul_inv] -+ _ = ‖a‖ * ‖b⁻¹‖ := norm_mul _ _ -+ _ = ‖a‖ * ‖b‖⁻¹ := by simp [norm_inv] -+ _ = ‖a‖ / ‖b‖ := by simp [div_eq_mul_inv] -+ -+lemma norm_Rsq_div_conj (R : ℝ) (ρ : ℂ) (hρ : ρ ≠ 0) : ‖((R^2 : ℂ) / (star ρ))‖ = (R^2 : ℝ) / ‖ρ‖ := by -+ have hb : star ρ ≠ 0 := by -+ intro h -+ have h' := congrArg star h -+ -+ have : ρ = 0 := by simpa [star_star] using h' -+ exact hρ this -+ have hnormR : ‖(R^2 : ℂ)‖ = (R^2 : ℝ) := by -+ have h := (RCLike.norm_ofReal (K:=ℂ) (R^2)) -+ simp -+ calc -+ ‖((R^2 : ℂ) / (star ρ))‖ -+ = ‖(R^2 : ℂ)‖ / ‖star ρ‖ := norm_div_eq _ _ hb -+ _ = (R^2 : ℝ) / ‖ρ‖ := by -+ simp [hnormR] -+ -+lemma zerosetKfR_subset_closedBall {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} : -+ zerosetKfR R1 hR1 f ⊆ Metric.closedBall (0 : ℂ) R1 := by -+ intro ρ hρ -+ have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 ∧ f ρ = 0 := by -+ simpa [zerosetKfR] using hρ -+ exact hmem.left -+ -+lemma mem_zerosetKfR_ne_zero_of_f0_eq_one {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} -+ (hf0 : f 0 = 1) {ρ : ℂ} (hρ : ρ ∈ zerosetKfR R1 hR1 f) : ρ ≠ 0 := by -+ intro hρ0 -+ have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 ∧ f ρ = 0 := by -+ simpa [zerosetKfR] using hρ -+ have hzero : f 0 = 0 := by simpa [hρ0] using hmem.right -+ have h10 : (1 : ℂ) ≠ 0 := one_ne_zero -+ exact h10 (by simp [hf0] at hzero) -+ -+lemma norm_sub_ge_norm_sub (x y : ℂ) : ‖x - y‖ ≥ ‖y‖ - ‖x‖ := by -+ have htri : ‖y‖ ≤ ‖y - x‖ + ‖x‖ := by -+ simpa [sub_eq_add_neg, add_comm] using norm_add_le (y - x) x -+ have h' : ‖y‖ - ‖x‖ ≤ ‖y - x‖ := (sub_le_iff_le_add).mpr htri -+ have hsymm : ‖y - x‖ = ‖x - y‖ := by -+ simpa [sub_eq_add_neg, add_comm] using (norm_neg (x - y)) -+ simpa [hsymm] using h' -+ -+lemma mem_zerosetKfR_norm_le {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} {ρ : ℂ} -+ (hρ : ρ ∈ zerosetKfR R1 hR1 f) : ‖ρ‖ ≤ R1 := by -+ have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 := -+ (zerosetKfR_subset_closedBall (R1 := R1) hR1 (f := f)) hρ -+ have hdist : dist ρ (0 : ℂ) ≤ R1 := by -+ simpa [Metric.mem_closedBall] using hmem -+ simpa [dist_eq_norm, sub_zero] using hdist -+ -+lemma lem_sum_bound_step2 {R R1: ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (_hR_lt_1 : R < 1) -+ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ (∑ ρ ∈ h_finite_zeros.toFinset, -+ ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - (R^2 : ℂ) / (star ρ)‖) -+ ≤ (1/(R^2/R1 - R1)) * -+ (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) := by -+ classical -+ intro z hz -+ rcases hz with ⟨hzball, _hznotin⟩ -+ have hz_norm : ‖z‖ ≤ R1 := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hzball -+ -+ set S := h_finite_zeros.toFinset -+ have hS_spec : ∀ {ρ : ℂ}, ρ ∈ S → ρ ∈ zerosetKfR R1 (by linarith) f := by -+ intro ρ hρ -+ have hiff := (Set.Finite.mem_toFinset (hs := h_finite_zeros) : ρ ∈ S ↔ ρ ∈ zerosetKfR R1 (by linarith) f) -+ exact (Iff.mp hiff) hρ -+ -+ have hsum_le : -+ (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - (R^2 : ℂ) / (star ρ)‖) -+ ≤ ∑ ρ ∈ S, (1/(R^2/R1 - R1)) * ((analyticOrderAt f ρ).toNat : ℝ) := by -+ refine Finset.sum_le_sum ?termwise -+ intro ρ hρS -+ have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := hS_spec hρS -+ have hρ_ne : ρ ≠ 0 := -+ mem_zerosetKfR_ne_zero_of_f0_eq_one (R1 := R1) (hR1 := by linarith) -+ (f := f) h_f_zero hρmem -+ have hρ_norm : ‖ρ‖ ≤ R1 := mem_zerosetKfR_norm_le (R1 := R1) -+ (hR1 := by linarith) (f := f) hρmem -+ have hpt : 1 / ‖z - (R^2 : ℂ) / (star ρ)‖ ≤ 1/(R^2/R1 - R1) := by -+ -+ have h_Rsq_norm : ‖((R^2 : ℂ) / (star ρ))‖ = (R^2 : ℝ) / ‖ρ‖ := -+ norm_Rsq_div_conj R ρ hρ_ne -+ have h_lower_bound : ‖z - (R^2 : ℂ) / (star ρ)‖ ≥ ‖((R^2 : ℂ) / (star ρ))‖ - ‖z‖ := -+ norm_sub_ge_norm_sub z ((R^2 : ℂ) / (star ρ)) -+ -+ have hρ_pos : 0 < ‖ρ‖ := by -+ simpa [norm_pos_iff] using hρ_ne -+ have h_Rsq_bound : R^2/R1 ≤ ‖((R^2 : ℂ) / (star ρ))‖ := by -+ rw [h_Rsq_norm] -+ exact div_le_div_of_nonneg_left (sq_nonneg R) hρ_pos hρ_norm -+ have h_combined : R^2/R1 - R1 ≤ ‖z - (R^2 : ℂ) / (star ρ)‖ := by -+ calc R^2/R1 - R1 -+ _ ≤ ‖((R^2 : ℂ) / (star ρ))‖ - R1 := by linarith [h_Rsq_bound] -+ _ ≤ ‖((R^2 : ℂ) / (star ρ))‖ - ‖z‖ := by linarith [hz_norm] -+ _ ≤ ‖z - (R^2 : ℂ) / (star ρ)‖ := h_lower_bound -+ have h_pos_denom : 0 < R^2/R1 - R1 := by -+ have h_R_pos : 0 < R := by linarith [hR1_pos, hR1_lt_R] -+ have h_Rsq_pos : 0 < R^2 := sq_pos_of_pos h_R_pos -+ calc R^2/R1 - R1 -+ _ = (R^2 - R1*R1)/R1 := by field_simp -+ _ = (R - R1)*(R + R1)/R1 := by ring -+ _ > 0 := by -+ apply div_pos -+ · apply mul_pos -+ · linarith [hR1_lt_R] -+ · linarith [hR1_pos, hR1_lt_R] -+ · exact hR1_pos -+ have h_pos_norm : 0 < ‖z - (R^2 : ℂ) / (star ρ)‖ := by -+ apply lt_of_lt_of_le h_pos_denom h_combined -+ -+ have h_reciprocal : 1 / ‖z - (R^2 : ℂ) / (star ρ)‖ ≤ 1 / (R^2/R1 - R1) := by -+ apply div_le_div_of_nonneg_left -+ · norm_num -+ · exact h_pos_denom -+ · exact h_combined -+ exact h_reciprocal -+ have hmnonneg : 0 ≤ ((analyticOrderAt f ρ).toNat : ℝ) := by -+ exact_mod_cast (Nat.zero_le (analyticOrderAt f ρ).toNat) -+ have hmul := mul_le_mul_of_nonneg_left hpt hmnonneg -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hmul -+ -+ rw [← Finset.mul_sum] at hsum_le -+ exact hsum_le -+ -+lemma sq_div_sub_pos (a b : ℝ) (ha_pos : 0 < a) (hab : a < b) : 0 < b^2/a - a := by -+ -+ rw [sub_pos] -+ -+ rw [lt_div_iff₀ ha_pos] -+ -+ rw [← pow_two] -+ -+ have ha_nonneg : 0 ≤ a := le_of_lt ha_pos -+ apply pow_lt_pow_left₀ hab ha_nonneg -+ norm_num -+ -+lemma final_sum_bound {R R1 B : ℝ} {f : ℂ → ℂ} -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (hB : 1 < B) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, -+ ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ ≤ -+ 1/((R^2/R1 - R1) * Real.log (R/R1)) * Real.log B := by -+ intro z hz -+ -+ have h_norm_bound := norm_sum_le h_finite_zeros.toFinset (fun ρ => (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))) -+ -+ have h_sum_eq : ∑ ρ ∈ h_finite_zeros.toFinset, ‖(analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ = -+ ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - R^2 / (star ρ)‖ := by -+ apply Finset.sum_congr rfl -+ intro ρ hρ -+ rw [norm_div, Complex.norm_natCast] -+ -+ have h_step2 := lem_sum_bound_step2 hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz -+ -+ have h_f_nonzero : f 0 ≠ 0 := by rw [h_f_zero]; norm_num -+ have h_f_bounded_alt : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B := by -+ intro w hw -+ exact h_f_bounded w (Metric.mem_closedBall.mpr (by simpa [dist_eq_norm] using hw)) -+ -+ have h_exists : ∀ σ : ℂ, ∃ g : ℂ → ℂ, -+ AnalyticAt ℂ g σ ∧ g σ ≠ 0 ∧ -+ (σ ∈ zerosetKfR R1 (by linarith) f → -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * g z) := by -+ intro σ -+ by_cases hσ : σ ∈ zerosetKfR R1 (by linarith) f -+ · -+ have hex := lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero σ hσ -+ obtain ⟨g, hg_at, hg_ne, h_eq⟩ := hex -+ exact ⟨g, hg_at, hg_ne, fun _ => h_eq⟩ -+ · -+ refine ⟨fun _ => 1, ?_, ?_, ?_⟩ -+ · exact analyticAt_const -+ · norm_num -+ · intro h_contra -+ contradiction -+ -+ let h_σ : ℂ → (ℂ → ℂ) := fun σ => Classical.choose (h_exists σ) -+ have h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z := by -+ intro σ hσ -+ have spec := Classical.choose_spec (h_exists σ) -+ exact ⟨spec.1, spec.2.1, spec.2.2 hσ⟩ -+ have h_sum_bound := lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero h_f_zero h_finite_zeros h_σ h_f_bounded_alt h_σ_spec -+ -+ have h_pos : 0 < R^2/R1 - R1 := sq_div_sub_pos R1 R hR1_pos hR1_lt_R -+ have h_ratio_gt_one : 1 < R/R1 := by -+ rw [one_lt_div_iff] -+ left -+ exact ⟨hR1_pos, hR1_lt_R⟩ -+ have h_log_pos : 0 < Real.log (R/R1) := Real.log_pos h_ratio_gt_one -+ -+ calc ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ -+ ≤ ∑ ρ ∈ h_finite_zeros.toFinset, ‖(analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ := h_norm_bound -+ _ = ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - R^2 / (star ρ)‖ := h_sum_eq -+ _ ≤ (1/(R^2/R1 - R1)) * (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) := h_step2 -+ _ ≤ (1/(R^2/R1 - R1)) * ((1/Real.log (R/R1)) * Real.log B) := by -+ apply mul_le_mul_of_nonneg_left h_sum_bound (div_nonneg zero_le_one (le_of_lt h_pos)) -+ _ = 1/((R^2/R1 - R1) * Real.log (R/R1)) * Real.log B := by -+ field_simp [ne_of_gt h_pos, ne_of_gt h_log_pos] -+ -+lemma final_inequality -+ (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) -+ (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ_spec : -+ ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, -+ f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1 \ zerosetKfR R1 (by linarith) f, -+ -+ ‖(deriv f z / f z -+ - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ))‖ -+ ≤ -+ 16 * r^2 / ((r - r1)^3) * Real.log B -+ + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) * Real.log B := by -+ intro z hz -+ -+ have hr_pos : 0 < r := by linarith [hr1pos, hr1_lt_r] -+ have hR1_pos : 0 < R1 := by linarith [hr_pos, hr_lt_R1] -+ -+ have hz_in_r : z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f := by -+ constructor -+ · apply Metric.closedBall_subset_closedBall (le_of_lt hr1_lt_r) -+ exact hz.1 -+ · exact hz.2 -+ -+ have hineq := -+ target_inequality_setup hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz_in_r -+ -+ have hz_in_R1 : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f := by -+ constructor -+ · apply Metric.closedBall_subset_closedBall -+ exact le_of_lt (lt_trans hr1_lt_r hr_lt_R1) -+ exact hz.1 -+ · exact hz.2 -+ -+ have hsum := -+ final_sum_bound hR1_pos hR1_lt_R hR_lt_1 hB h_f_analytic h_f_zero h_finite_zeros h_f_bounded z hz_in_R1 -+ -+ have hz_le_r1 : ‖z‖ ≤ r1 := by simpa [Metric.mem_closedBall, dist_eq_norm] using hz.1 -+ -+ have hz_abs : ‖z‖ ≤ r1 := hz_le_r1 -+ -+ have h_BC := apply_BC_to_Lf -+ (B := B) (r1 := r1) (r := r) (R := R) (R1 := R1) -+ (hB := hB) (hr1_pos := hr1pos) (hr1_lt_r := hr1_lt_r) (hr_lt_R1 := hr_lt_R1) -+ (hR1_pos := hR1_pos) (hR1_lt_R := hR1_lt_R) (hR_lt_1 := hR_lt_1) -+ (f := f) (h_f_analytic := h_f_analytic) (h_f_zero := h_f_zero) -+ (h_finite_zeros := h_finite_zeros) (h_σ := h_σ) (h_σ_spec := h_σ_spec) -+ (h_f_bound := fun w hw => h_f_bounded w (Metric.mem_closedBall.mpr (by simpa [dist_eq_norm] using hw))) -+ z hz_abs -+ -+ have hLf : ‖deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z‖ ≤ -+ 16 * r^2 / ((r - r1)^3) * Real.log B := by -+ -+ convert h_BC using 1 -+ -+ ring -+ -+ exact le_trans hineq (add_le_add hLf hsum) -+ -+lemma final_ineq1 -+ (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) -+ (hR1_lt_R : R1 < R) (hR : R < 1) -+ (f : ℂ → ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) -+ (h_f_zero : f 0 = 1) -+ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) -+ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) -+ (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) r1 \ zerosetKfR R1 (by linarith) f, -+ ‖(deriv f z / f z) - ∑ ρ ∈ h_finite_zeros.toFinset, -+ (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ -+ (16 * r^2 / ((r - r1)^3) + -+ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log B := by -+ intro z hz -+ -+ have h_bound : ‖(deriv f z / f z) - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ -+ 16 * r^2 / ((r - r1)^3) * Real.log B + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) * Real.log B := by -+ apply final_inequality <;> assumption -+ -+ rw [← add_mul] at h_bound -+ exact h_bound -+ -+end Erdos970 -diff --git a/StrongPNT/Erdos970/PNT3_RiemannZeta.lean b/StrongPNT/Erdos970/PNT3_RiemannZeta.lean -new file mode 100644 -index 0000000..0ab91b1 ---- /dev/null -+++ b/StrongPNT/Erdos970/PNT3_RiemannZeta.lean -@@ -0,0 +1,4546 @@ -+import StrongPNT.Erdos970.PNT2_LogDerivative -+ -+namespace Erdos970 -+ -+ -+open scoped BigOperators Topology -+abbrev ℙ := Nat.Primes -+ -+lemma p_s_abs_1 (p : ℙ) (s : ℂ) (hs : 1 < s.re) : norm (((p : ℕ) : ℂ) ^ (-s : ℂ)) < 1 := by -+ -+ have hx1 : 1 < ((p : ℕ) : ℝ) := by -+ have h2 : (2 : ℝ) ≤ ((p : ℕ) : ℝ) := by -+ exact_mod_cast (p.2.two_le : 2 ≤ (p : ℕ)) -+ exact lt_of_lt_of_le one_lt_two h2 -+ have hx0 : 0 < ((p : ℕ) : ℝ) := lt_trans zero_lt_one hx1 -+ -+ have hnorm_eq : ‖(((p : ℕ) : ℂ) ^ (-s : ℂ))‖ = ((p : ℕ) : ℝ) ^ ((-s : ℂ).re) := by -+ simpa using (Complex.norm_cpow_eq_rpow_re_of_pos hx0 (-s : ℂ)) -+ -+ have hz : ((-s : ℂ).re) < 0 := by -+ have h0 : 0 < s.re := lt_trans zero_lt_one hs -+ have : -s.re < 0 := neg_lt_zero.mpr h0 -+ simpa using this -+ -+ have hlt : ((p : ℕ) : ℝ) ^ ((-s : ℂ).re) < 1 := -+ Real.rpow_lt_one_of_one_lt_of_neg hx1 hz -+ -+ have : ‖(((p : ℕ) : ℂ) ^ (-s : ℂ))‖ < 1 := by simpa [hnorm_eq] using hlt -+ simpa [norm] using this -+ -+lemma zetaEulerprod (s : ℂ) (hs : 1 < s.re) : Multipliable (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) ∧ riemannZeta s = ∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹ := by -+ have hprod : HasProd (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) (riemannZeta s) := by -+ simpa using (riemannZeta_eulerProduct_hasProd (s := s) hs) -+ refine And.intro ?_ ?_ -+ · exact hprod.multipliable -+ · simpa using (hprod.tprod_eq.symm) -+ -+lemma abs_of_tprod {P : Type*} (w : P → ℂ) (hw : Multipliable w) : norm (∏' p : P, w p) = ∏' p : P, norm (w p) := by exact Multipliable.norm_tprod hw -+ -+lemma abs_P_prod (s : ℂ) (hs : 1 < s.re) : norm (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) = ∏' p : ℙ, norm ((1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by -+ have hw : Multipliable (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := (zetaEulerprod s hs).1 -+ simpa using abs_of_tprod (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) hw -+ -+lemma abs_zeta_prod (s : ℂ) (hs : 1 < s.re) : norm (riemannZeta s) = ∏' p : ℙ, norm ((1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by -+ rw [zetaEulerprod s hs |>.2, abs_P_prod s hs] -+ -+lemma abs_of_inv (z : ℂ) (_hz : z ≠ 0) : norm (z⁻¹) = (norm z)⁻¹ := norm_inv z -+ -+lemma one_minus_p_s_neq_0 (p : ℙ) (s : ℂ) (hs : 1 < s.re) : 1 - ((p : ℕ) : ℂ) ^ (-s : ℂ) ≠ 0 := by -+ intro h -+ have hz : ((p : ℕ) : ℂ) ^ (-s : ℂ) = 1 := by -+ simpa using (sub_eq_zero.mp h).symm -+ have : (1 : ℝ) < 1 := by -+ simpa [hz] using (p_s_abs_1 p s hs) -+ exact (lt_irrefl (1 : ℝ)) this -+ -+lemma abs_zeta_prod_prime (s : ℂ) (hs : 1 < s.re) : -+ norm (riemannZeta s) = ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ)))⁻¹ := by -+ rw [abs_zeta_prod s hs] -+ congr 1 -+ ext p -+ rw [abs_of_inv (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ)) (one_minus_p_s_neq_0 p s hs)] -+ -+lemma Re2s (s : ℂ) : (2 * s).re = 2 * s.re := by simp -+ -+lemma Re2sge1 (s : ℂ) (hs : 1 < s.re) : 1 < (2 * s).re := by -+ rw [Re2s] -+ linarith -+ -+lemma zeta_ratio_prod (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-(2 * s) : ℂ))⁻¹) / (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by -+ have h2 := (zetaEulerprod (2 * s) (Re2sge1 s hs)).2 -+ have h1 := (zetaEulerprod s hs).2 -+ simp [h2, h1] -+ -+local notation "ι" => fun (z : ℂˣ) ↦ (z : ℂ) -+ -+theorem tprod_commutes_with_inclusion_infinite {α : Type*} (f : α → ℂˣ) (h : Multipliable f) : -+ ι (tprod f) = tprod (fun i ↦ ι (f i)) := -+by -+ change ((tprod f : ℂˣ) : ℂ) = tprod (fun i ↦ ((f i : ℂˣ) : ℂ)) -+ have hcont : Continuous (Units.coeHom ℂ) := by -+ simpa using! (Units.continuous_val : Continuous (fun u : ℂˣ => ((u : ℂˣ) : ℂ))) -+ simpa [Units.coeHom] using -+ (Multipliable.map_tprod (f := f) (γ := ℂ) h (g := Units.coeHom ℂ) hcont) -+ -+theorem inclusion_commutes_with_division (a b : ℂˣ) : -+ ι (a / b) = ι a / ι b := by -+ exact Units.val_div_eq_div_val a b -+ -+lemma lift_multipliable_of_nonzero {P : Type*} (a : P → ℂ) (ha : Multipliable a) (h_a_nonzero : ∀ p, a p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0): -+ Multipliable (fun p ↦ Units.mk0 (a p) (h_a_nonzero p)) := by -+ -+ obtain ⟨A, hA⟩ := ha -+ have hA_nonzero := hA_nonzero' A hA -+ refine ⟨Units.mk0 A hA_nonzero, ?_⟩ -+ simp [HasProd, tendsto_nhds] at hA ⊢ -+ intro sU h_sU_open hA_mem -+ have hA_im_mem : ι (Units.mk0 A hA_nonzero) ∈ ι '' sU := Set.mem_image_of_mem ι hA_mem -+ have sU_im_open : IsOpen (ι '' sU) := by -+ apply (Topology.IsOpenEmbedding.isOpen_iff_image_isOpen ?_).mp -+ assumption -+ exact Units.isOpenEmbedding_val -+ have := hA (ι '' sU) sU_im_open hA_im_mem -+ obtain ⟨a1, ha⟩ := this -+ use a1 -+ intro b ha1 -+ obtain ⟨x', x'_spec_mem, x'_spec_eq⟩ := ha b ha1 -+ suffices x' = ∏ b ∈ b, Units.mk0 (a b) (by simp [*]) by -+ rwa [← this] -+ have : Units.mk0 (ι x') (Units.ne_zero x') = x' := -+ Units.mk0_val x' (Units.ne_zero x') -+ have this2 : (Units.mk0 (∏ b ∈ b, a b) -+ (Finset.prod_ne_zero_iff.mpr fun a a_1 => h_a_nonzero a)) = x' := -+ Units.ext (id (Eq.symm x'_spec_eq)) -+ rw [Units.mk0_prod] at this2 -+ rw [←this2] -+ conv => -+ rhs -+ rw [← Finset.prod_attach] -+ -+lemma prod_of_ratios_simplified {P : Type*} (a b : P → ℂ) -+(ha : Multipliable a) (hb : Multipliable b) -+ (h_a_nonzero : ∀ p, a p ≠ 0) (h_b_nonzero : ∀ p, b p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0) (hB_nonzero' : ∀ A, HasProd b A → A ≠ 0): -+ (∏' p : P, a p) / (∏' p : P, b p) = ∏' p : P, (a p / b p) := by -+ -+ let a' : P → ℂˣ := fun p ↦ Units.mk0 (a p) (h_a_nonzero p) -+ let b' : P → ℂˣ := fun p ↦ Units.mk0 (b p) (h_b_nonzero p) -+ -+ have h_multipliable_a' : Multipliable a' := lift_multipliable_of_nonzero a ha h_a_nonzero hA_nonzero' -+ have h_multipliable_b' : Multipliable b' := lift_multipliable_of_nonzero b hb h_b_nonzero hB_nonzero' -+ have h_multipliable_a'_div_b' : Multipliable (fun p ↦ a' p / b' p) := Multipliable.div h_multipliable_a' h_multipliable_b' -+ -+ calc -+ (∏' p, a p) / (∏' p, b p) -+ -+ _ = (∏' p, ι (a' p)) / (∏' p, ι (b' p)) := by simp [a', b'] -+ -+ _ = ι (∏' p, a' p) / ι (∏' p, b' p) := by simp [tprod_commutes_with_inclusion_infinite, *] -+ -+ _ = ι ((∏' p, a' p) / (∏' p, b' p)) := by rw [← inclusion_commutes_with_division] -+ -+ _ = ι (∏' p, a' p / b' p) := by simp [Multipliable.tprod_div, *] -+ -+ _ = ∏' p, ι (a' p / b' p) := by simp [tprod_commutes_with_inclusion_infinite, *] -+ -+ _ = ∏' p, (ι (a' p) / ι (b' p)) := by simp -+ -+ _ = ∏' p, a p / b p := by simp [a', b'] -+ -+lemma prod_of_ratios {P : Type*} (a b : P → ℂ) (ha : Multipliable a) (hb : Multipliable b) (h_b_nonzero : ∀ p, b p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0) (hB_nonzero' : ∀ B, HasProd b B → B ≠ 0): -+ (∏' p : P, a p) / (∏' p : P, b p) = ∏' p : P, (a p / b p) := by -+ -+ by_cases h_a_zero : ∃ p, a p = 0 -+ case pos => -+ -+ have lhs_zero : ∏' p : P, a p = 0 := by -+ -+ exact tprod_of_exists_eq_zero h_a_zero -+ have rhs_zero : ∏' p : P, (a p / b p) = 0 := by -+ -+ obtain ⟨p₀, hp₀⟩ := h_a_zero -+ have h_div_zero : ∃ p, (a p / b p) = 0 := by -+ use p₀ -+ simp [hp₀] -+ exact tprod_of_exists_eq_zero h_div_zero -+ simp [lhs_zero, rhs_zero] -+ case neg => -+ -+ push Not at h_a_zero -+ -+ exact prod_of_ratios_simplified a b ha hb h_a_zero h_b_nonzero hA_nonzero' hB_nonzero' -+ -+lemma simplify_prod_ratio (s : ℂ) (hs : 1 < s.re) : (∏' p : ℙ, (1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹) / (∏' p : ℙ, (1 - (p : ℂ) ^ (-s : ℂ))⁻¹) = ∏' p : ℙ, ((1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹ / (1 - (p : ℂ) ^ (-s : ℂ))⁻¹) := by -+ -+ let a := fun p : ℙ => (1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹ -+ let b := fun p : ℙ => (1 - (p : ℂ) ^ (-s : ℂ))⁻¹ -+ -+ have ha : Multipliable a := (zetaEulerprod (2 * s) (Re2sge1 s hs)).1 -+ have hb : Multipliable b := (zetaEulerprod s hs).1 -+ -+ have h_b_nonzero : ∀ p, b p ≠ 0 := by -+ intro p -+ exact inv_ne_zero (one_minus_p_s_neq_0 p s hs) -+ -+ exact prod_of_ratios a b ha hb h_b_nonzero (by -+ intro A hA -+ -+ have h_eq : A = riemannZeta (2 * s) := by -+ have h : HasProd a (riemannZeta (2 * s)) := by -+ simpa [a] using riemannZeta_eulerProduct_hasProd (s := 2 * s) (by simp; linarith) -+ exact HasProd.unique hA h -+ rw [h_eq] -+ exact riemannZeta_ne_zero_of_one_lt_re (by simp; linarith) -+ ) (by -+ intro B hB -+ -+ have h_eq : B = riemannZeta s := by -+ have h : HasProd b (riemannZeta s) := by -+ simpa [b] using riemannZeta_eulerProduct_hasProd (s := s) hs -+ exact HasProd.unique hB h -+ rw [h_eq] -+ exact riemannZeta_ne_zero_of_one_lt_re hs -+ ) -+ -+lemma zeta_ratios (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = ∏' p : ℙ, ((1 - ((p : ℕ) : ℂ) ^ (-(2 * s) : ℂ))⁻¹ / (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by -+ have h1 := zeta_ratio_prod s hs -+ have h2 := simplify_prod_ratio s hs -+ exact h1.trans h2 -+ -+lemma diff_of_squares (z : ℂ) : 1 - z^2 = (1 - z) * (1 + z) := by ring -+ -+lemma one_sub_ne_zero_of_abs_lt_one (z : ℂ) (hz : norm z < 1) : 1 - z ≠ 0 := by -+ intro h -+ have h1 : 1 = z := by -+ have := congrArg (fun w : ℂ => w + z) h -+ simpa [sub_add_cancel, zero_add] using this -+ have habs1lt : norm (1 : ℂ) < 1 := by simpa [h1] using hz -+ have hnorm1lt : ‖(1 : ℂ)‖ < 1 := by simp [norm] at habs1lt -+ have : (1 : ℝ) < 1 := by simp [norm_one] at hnorm1lt -+ exact (lt_irrefl _) this -+ -+lemma one_add_ne_zero_of_abs_lt_one (z : ℂ) (hz : norm z < 1) : 1 + z ≠ 0 := by -+ have hz' : norm (-z) < 1 := by -+ simpa [norm, norm_neg] using hz -+ simpa [sub_eq_add_neg] using one_sub_ne_zero_of_abs_lt_one (-z) hz' -+ -+lemma inv_mul_div_cancel_right_of_ne_zero (a b : ℂ) (ha : a ≠ 0) : ((a * b)⁻¹) / a⁻¹ = b⁻¹ := by -+ simp [div_eq_mul_inv, inv_inv, mul_inv_rev, mul_comm, ha] -+ -+lemma ratio_invs (z : ℂ) (hz : norm z < 1) : (1 - z^2)⁻¹ / (1 - z)⁻¹ = (1 + z)⁻¹ := by -+ have hz1 : 1 - z ≠ 0 := one_sub_ne_zero_of_abs_lt_one z hz -+ simpa [diff_of_squares z] using -+ inv_mul_div_cancel_right_of_ne_zero (1 - z) (1 + z) hz1 -+ -+lemma complex_cpow_neg_two_mul (z w : ℂ) (_hz : z ≠ 0) : z^(-(2*w)) = (z^(-w))^2 := by -+ have h1 : -(2*w) = 2*(-w) := by ring -+ rw [h1] -+ have h2 : (2 : ℂ)*(-w) = ((2 : ℕ) : ℂ)*(-w) := by norm_cast -+ rw [h2, Complex.cpow_nat_mul] -+ -+theorem zeta_ratio_identity (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹ := by -+ rw [zeta_ratios s hs]; congr 1; ext p -+ have hp : ((p : ℕ) : ℂ) ≠ 0 := by rw [ne_eq, Nat.cast_eq_zero]; exact Nat.Prime.ne_zero p.2 -+ have h1 : ((p : ℕ) : ℂ) ^ (-(2 * s)) = (((p : ℕ) : ℂ) ^ (-s))^2 := complex_cpow_neg_two_mul ((p : ℕ) : ℂ) s hp -+ have h2 : norm (((p : ℕ) : ℂ) ^ (-s)) < 1 := p_s_abs_1 p s hs -+ rw [h1]; exact ratio_invs (((p : ℕ) : ℂ) ^ (-s)) h2 -+ -+lemma two_mul_ofReal_div_two (r : ℝ) : (2 : ℂ) * ((r : ℝ) / 2 : ℂ) = (r : ℂ) := by -+ have hreal : (2 : ℝ) * (r / 2) = r := by -+ calc -+ (2 : ℝ) * (r / 2) = (2 : ℝ) * r / 2 := by -+ have h : (2 : ℝ) * r / 2 = (2 : ℝ) * (r / 2) := by -+ simpa using (mul_div_assoc (2 : ℝ) r (2 : ℝ)) -+ simpa using h.symm -+ _ = r := by -+ simp -+ calc -+ (2 : ℂ) * ((r : ℝ) / 2 : ℂ) -+ = ((2 * (r / 2) : ℝ) : ℂ) := by -+ simp -+ _ = (r : ℂ) := by simp [hreal] -+ -+lemma zeta_ratio_identity_ofReal_div_two (r : ℝ) (hr : 1 < ( ((r : ℝ) / 2 : ℂ) ).re) : riemannZeta (r : ℂ) / riemannZeta ((r / 2 : ℝ) : ℂ) = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-(((r : ℝ) / 2) : ℂ)))⁻¹ := by -+ have h := zeta_ratio_identity (((r : ℝ) / 2 : ℂ)) hr -+ simpa [two_mul_ofReal_div_two r] using h -+ -+lemma zeta_ratio_at_3_2 : riemannZeta 3 / riemannZeta ((3 : ℝ) / 2) = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ := by -+ have hr : 1 < (((3 : ℝ) / 2 : ℂ)).re := by -+ simpa using (by norm_num : (1 : ℝ) < (3 : ℝ) / 2) -+ simpa using zeta_ratio_identity_ofReal_div_two (3 : ℝ) hr -+ -+lemma triangle_inequality_specific (z : ℂ) : norm (1 - z) ≤ 1 + norm z := by -+ simpa [sub_eq_add_neg, norm_one, norm_neg] using (norm_add_le (1 : ℂ) (-z)) -+ -+lemma re_neg_eq_neg_re (s : ℂ) : (-s).re = - s.re := by -+ simp -+ -+lemma abs_cpow_eq_rpow_re_of_pos {x : ℝ} (hx : 0 < x) (y : ℂ) : norm ((x : ℂ) ^ y) = x ^ y.re := by -+ simpa using Complex.norm_cpow_eq_rpow_re_of_pos hx y -+ -+lemma abs_p_pow_s (p : ℙ) (s : ℂ) : norm (((p : ℕ) : ℂ) ^ (-s : ℂ)) = ((p : ℕ) : ℝ) ^ (-s.re : ℝ) := by -+ have hx : 0 < ((p : ℕ) : ℝ) := by -+ exact_mod_cast (p.property.pos : 0 < (p : ℕ)) -+ simpa [Complex.ofReal_natCast, re_neg_eq_neg_re] using -+ (abs_cpow_eq_rpow_re_of_pos hx (-s)) -+ -+lemma abs_term_bound (p : ℙ) (t : ℝ) : -+ norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) ≤ 1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by -+ -+ have h1 := triangle_inequality_specific (((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) -+ -+ have h2 := abs_p_pow_s p (((3 : ℝ) / 2) + t * Complex.I) -+ -+ have h3 : (((3 : ℝ) / 2) + t * Complex.I).re = ((3 : ℝ) / 2) := by simp [Complex.add_re, Complex.ofReal_re] -+ -+ have h4 : -(((3 : ℝ) / 2) + t * Complex.I).re = -((3 : ℝ) / 2) := by rw [h3] -+ -+ have h5 : norm (((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) = ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by -+ rw [h2, h4] -+ -+ rw [h5] at h1 -+ exact h1 -+ -+lemma inv_inequality {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) : b⁻¹ ≤ a⁻¹ := by -+ simpa [one_div] using (one_div_le_one_div_of_le ha hab) -+ -+lemma eq_of_one_sub_eq_zero (z : ℂ) (h : 1 - z = 0) : z = 1 := by -+ rw [sub_eq_zero] at h -+ exact h.symm -+ -+lemma condp32 (p : ℙ) (t : ℝ) : 1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) ≠ 0 := by -+ intro h -+ have hp_eq_one : ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) = 1 := eq_of_one_sub_eq_zero _ h -+ let s := ((3 : ℝ) / 2) + t * Complex.I -+ have hs : 1 < s.re := by -+ simp only [s, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im, mul_zero] -+ norm_num -+ have h_abs_lt : norm (((p : ℕ) : ℂ) ^ (-s)) < 1 := p_s_abs_1 p s hs -+ have h_s_eq : ((p : ℕ) : ℂ) ^ (-s) = ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) := by simp only [s] -+ rw [h_s_eq, hp_eq_one] at h_abs_lt -+ have : norm (1 : ℂ) = 1 := by simp [norm] -+ rw [this] at h_abs_lt -+ exact lt_irrefl 1 h_abs_lt -+ -+lemma abs_term_inv_bound (p : ℙ) (t : ℝ) : (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ ≤ (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by -+ have h1 := abs_term_bound p t -+ have h2 := condp32 p t -+ have h3 := lem_abspos _ h2 -+ exact inv_inequality h3 h1 -+ -+open NNReal in -+lemma prod_inequality {P : Type*} (a b : P → ℝ≥0) (ha : Multipliable a) (hb : Multipliable b) -+ (hab : ∀ p : P, a p ≤ b p) : -+ ∏' p : P, a p ≤ ∏' p : P, b p := by -+ exact Multipliable.tprod_le_tprod hab ha hb -+ -+lemma multipliable_complex_abs_inv {i : Type*} (g : i → ℂ) (h_mult : Multipliable (fun i => (1 - g i)⁻¹)) (_h_nonzero : ∀ i, 1 - g i ≠ 0) : Multipliable (fun i => (norm (1 - g i))⁻¹) := by -+ -+ have h_eq : (fun i => (norm (1 - g i))⁻¹) = (fun i => ‖1 - g i‖⁻¹) := by -+ ext i -+ simp -+ rw [h_eq] -+ -+ have h_norm_mult : Multipliable (fun i => ‖(1 - g i)⁻¹‖) := Multipliable.norm h_mult -+ have h_norm_eq : (fun i => ‖(1 - g i)⁻¹‖) = (fun i => ‖1 - g i‖⁻¹) := by -+ ext i -+ rw [norm_inv] -+ rwa [← h_norm_eq] -+ -+lemma multipliable_positive_inv_powers (r : ℝ) (hr : 1 < r) : Multipliable (fun p : ℙ => (1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹) := by -+ -+ have h_sum : Summable (fun p : ℙ => ((p : ℕ) : ℝ) ^ (-r)) := by -+ rw [Nat.Primes.summable_rpow] -+ linarith -+ -+ have h_log_sum : Summable (fun p : ℙ => Real.log (1 + ((p : ℕ) : ℝ) ^ (-r))) := by -+ exact Real.summable_log_one_add_of_summable h_sum -+ -+ have h_log_inv_sum : Summable (fun p : ℙ => Real.log ((1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹)) := by -+ have h_eq : (fun p : ℙ => Real.log ((1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹)) = -+ (fun p : ℙ => -(Real.log (1 + ((p : ℕ) : ℝ) ^ (-r)))) := by -+ ext p -+ rw [Real.log_inv] -+ rw [h_eq] -+ exact Summable.neg h_log_sum -+ -+ have h_pos : ∀ p : ℙ, 0 < (1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹ := by -+ intro p -+ apply inv_pos.mpr -+ have h_ge : 0 ≤ ((p : ℕ) : ℝ) ^ (-r) := Real.rpow_nonneg (Nat.cast_nonneg _) _ -+ linarith -+ -+ exact Real.multipliable_of_summable_log h_pos h_log_inv_sum -+ -+lemma hasProd_map_nnreal_coe {i : Type*} (f : i → NNReal) (a : NNReal) (h : HasProd f a) : HasProd (fun i => (f i : ℝ)) ((a : NNReal) : ℝ) := by -+ have hcont : Continuous (⇑NNReal.toRealHom) := by -+ rw [NNReal.coe_toRealHom] -+ exact NNReal.continuous_coe -+ exact HasProd.map h NNReal.toRealHom hcont -+ -+lemma multipliable_nnreal_coe {i : Type*} (f : i → NNReal) (hf : Multipliable f) : Multipliable (fun i => (f i : ℝ)) := by -+ -+ obtain ⟨a, ha⟩ := hf -+ -+ have h_coe := hasProd_map_nnreal_coe f a ha -+ -+ exact ⟨(a : ℝ), h_coe⟩ -+ -+lemma nnreal_coe_tprod_eq {i : Type*} (f : i → NNReal) (_hf : Multipliable f) : (∏' i : i, f i : ℝ) = ∏' i : i, (f i : ℝ) := by -+ rfl -+ -+lemma hasProd_nonneg_of_pos {i : Type*} (f : i → ℝ) (hpos : ∀ i, 0 < f i) (a : ℝ) (ha : HasProd f a) : 0 ≤ a := by -+ -+ have h_pos : ∀ s : Finset i, 0 < ∏ i ∈ s, f i := fun s => Finset.prod_pos (fun i _ => hpos i) -+ -+ have h_nonneg : ∀ s : Finset i, 0 ≤ ∏ i ∈ s, f i := fun s => le_of_lt (h_pos s) -+ -+ exact ge_of_tendsto ha (Filter.Eventually.of_forall h_nonneg) -+ -+lemma tendsto_finprod_coe_iff_tendsto_coe_finprod {i : Type*} (f : i → NNReal) (a : NNReal) : -+ Filter.Tendsto (fun s => ∏ i ∈ s, (f i : ℝ)) Filter.atTop (𝓝 (a : ℝ)) ↔ -+ Filter.Tendsto ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) Filter.atTop (𝓝 (a : ℝ)) := by -+ -+ have h_comp : ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) = (fun s => ↑(∏ i ∈ s, f i)) := by -+ rfl -+ -+ have h_eq : (fun s => ∏ i ∈ s, (f i : ℝ)) = (fun s => ↑(∏ i ∈ s, f i)) := by -+ ext s -+ exact (NNReal.coe_prod s f).symm -+ -+ rw [h_comp, ← h_eq] -+ -+lemma pnt_nnreal_isEmbedding_coe : Topology.IsEmbedding (fun x : NNReal => (x : ℝ)) := by -+ refine ⟨?_, NNReal.coe_injective⟩ -+ -+ exact Topology.IsInducing.subtypeVal -+ -+lemma HasProd.of_coe_hasProd {i : Type*} (f : i → NNReal) (a : NNReal) (h : HasProd (fun i => (f i : ℝ)) (a : ℝ)) : HasProd f a := by -+ -+ have h_comp : Filter.Tendsto ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) Filter.atTop (𝓝 (a : ℝ)) := by -+ rw [← tendsto_finprod_coe_iff_tendsto_coe_finprod] -+ exact h -+ -+ have h_embed : Topology.IsEmbedding (fun x : NNReal => (x : ℝ)) := pnt_nnreal_isEmbedding_coe -+ -+ exact h_embed.tendsto_nhds_iff.mpr h_comp -+ -+lemma hasProd_nnreal_of_coe {i : Type*} (g : i → NNReal) (b : NNReal) (h : HasProd (fun i => (g i : ℝ)) (b : ℝ)) : HasProd g b := by -+ exact HasProd.of_coe_hasProd g b h -+ -+lemma multipliable_real_to_nnreal {i : Type*} (f : i → ℝ) (hpos : ∀ i, 0 < f i) (h_mult : Multipliable f) : Multipliable (fun i => ⟨f i, le_of_lt (hpos i)⟩ : i → NNReal) := by -+ -+ obtain ⟨a, ha⟩ := h_mult -+ -+ have ha_nonneg : 0 ≤ a := hasProd_nonneg_of_pos f hpos a ha -+ -+ let a_nnreal : NNReal := ⟨a, ha_nonneg⟩ -+ -+ have h_coe_eq : (fun i => ((⟨f i, le_of_lt (hpos i)⟩ : NNReal) : ℝ)) = f := by -+ ext i -+ rfl -+ -+ have ha_coe : HasProd (fun i => ((⟨f i, le_of_lt (hpos i)⟩ : NNReal) : ℝ)) (a_nnreal : ℝ) := by -+ rw [h_coe_eq] -+ simp only [a_nnreal] -+ exact ha -+ -+ have ha_nnreal : HasProd (fun i => ⟨f i, le_of_lt (hpos i)⟩) a_nnreal := -+ hasProd_nnreal_of_coe (fun i => ⟨f i, le_of_lt (hpos i)⟩) a_nnreal ha_coe -+ -+ exact ⟨a_nnreal, ha_nnreal⟩ -+ -+lemma nnreal_coe_tprod_eq_tprod_coe {i : Type*} (f : i → NNReal) (hf : Multipliable f) : -+ ∏' i, (↑(f i) : ℝ) = ↑(∏' i, f i) := by -+ -+ have h_prod : HasProd f (∏' i, f i) := Multipliable.hasProd hf -+ -+ have h_map : HasProd (NNReal.toRealHom ∘ f) (NNReal.toRealHom (∏' i, f i)) := -+ HasProd.map h_prod NNReal.toRealHom NNReal.continuous_coe -+ -+ have h_comp : NNReal.toRealHom ∘ f = fun i => (↑(f i) : ℝ) := by -+ ext i -+ rfl -+ have h_val : NNReal.toRealHom (∏' i, f i) = ↑(∏' i, f i) := rfl -+ -+ rw [h_comp, h_val] at h_map -+ -+ exact HasProd.tprod_eq h_map -+ -+lemma nnreal_tprod_le_coe {i : Type*} (f g : i → NNReal) (hf : Multipliable f) (hg : Multipliable g) (h : ∏' i, f i ≤ ∏' i, g i) : ∏' i, (f i : ℝ) ≤ ∏' i, (g i : ℝ) := by -+ -+ rw [nnreal_coe_tprod_eq_tprod_coe f hf, nnreal_coe_tprod_eq_tprod_coe g hg] -+ -+ exact NNReal.coe_le_coe.mpr h -+ -+lemma abs_zeta_inequality (t : ℝ) : -+ ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ ≤ -+ ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by -+ -+ have h_pos_left : ∀ p : ℙ, 0 < (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by -+ intro p -+ apply inv_pos.mpr -+ apply add_pos zero_lt_one -+ -+ apply Real.rpow_pos_of_pos -+ exact_mod_cast (p.property.pos : 0 < (p : ℕ)) -+ -+ have h_pos_right : ∀ p : ℙ, 0 < (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by -+ intro p -+ apply inv_pos.mpr -+ -+ rw [norm_pos_iff] -+ exact condp32 p t -+ -+ have h_mult_left : Multipliable (fun p : ℙ => (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹) := -+ multipliable_positive_inv_powers ((3 : ℝ) / 2) (by norm_num : 1 < (3 : ℝ) / 2) -+ -+ have h_mult_right : Multipliable (fun p : ℙ => (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹) := by -+ let s := ((3 : ℝ) / 2) + t * Complex.I -+ have hs : 1 < s.re := by -+ simp only [s, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, mul_zero] -+ norm_num -+ -+ have h_euler := (zetaEulerprod s hs).1 -+ have h_nonzero : ∀ p : ℙ, 1 - ((p : ℕ) : ℂ) ^ (-s) ≠ 0 := fun p => condp32 p t -+ exact multipliable_complex_abs_inv (fun p : ℙ => ((p : ℕ) : ℂ) ^ (-s)) h_euler h_nonzero -+ -+ let f : ℙ → NNReal := fun p => ⟨(1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹, le_of_lt (h_pos_left p)⟩ -+ let g : ℙ → NNReal := fun p => ⟨(norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹, le_of_lt (h_pos_right p)⟩ -+ -+ have hf : Multipliable f := multipliable_real_to_nnreal _ h_pos_left h_mult_left -+ have hg : Multipliable g := multipliable_real_to_nnreal _ h_pos_right h_mult_right -+ -+ have h_pointwise : ∀ p : ℙ, f p ≤ g p := by -+ intro p -+ simp only [f, g] -+ exact abs_term_inv_bound p t -+ -+ have h_nnreal_ineq : ∏' p, f p ≤ ∏' p, g p := prod_inequality f g hf hg h_pointwise -+ -+ have h_convert : ∏' p, (f p : ℝ) ≤ ∏' p, (g p : ℝ) := nnreal_tprod_le_coe f g hf hg h_nnreal_ineq -+ -+ have h_eq_f : ∏' p, (f p : ℝ) = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by -+ rfl -+ -+ have h_eq_g : ∏' p, (g p : ℝ) = ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by -+ rfl -+ -+ rw [h_eq_f, h_eq_g] at h_convert -+ exact h_convert -+ -+lemma abs_zeta_ratio_eval : norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by -+ -+ have hratio := zeta_ratio_at_3_2 -+ -+ let w : ℙ → ℂ := fun p => (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ -+ let u : ℙ → ℝ := fun p => (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ -+ -+ have hu_mult : Multipliable u := -+ multipliable_positive_inv_powers ((3 : ℝ) / 2) (by norm_num : 1 < (3 : ℝ) / 2) -+ -+ have hw_eq : w = fun p : ℙ => (u p : ℂ) := by -+ funext p -+ -+ have hx : 0 ≤ ((p : ℕ) : ℝ) := by exact_mod_cast (Nat.zero_le (p : ℕ)) -+ have hcpow : (((((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2))) : ℝ) : ℂ) -+ = ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)) := by -+ simpa using (Complex.ofReal_cpow (x := ((p : ℕ) : ℝ)) (hx := hx) (y := -((3 : ℝ) / 2))) -+ calc -+ w p = (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ := rfl -+ _ = (1 + (((((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2))) : ℝ) : ℂ))⁻¹ := by -+ simp [hcpow] -+ _ = (((1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ : ℝ) : ℂ) := by -+ simp [Complex.ofReal_add, Complex.ofReal_inv, Complex.ofReal_one] -+ -+ have hw_mult : Multipliable w := by -+ have hmap : Multipliable ((fun x : ℝ => (x : ℂ)) ∘ u) := -+ Multipliable.map (hf := hu_mult) Complex.ofRealHom Complex.continuous_ofReal -+ simpa [hw_eq] using! hmap -+ -+ have h_abs_tprod : norm (∏' p : ℙ, w p) = ∏' p : ℙ, norm (w p) := -+ abs_of_tprod w hw_mult -+ -+ have h_abs_eq_fun : (fun p : ℙ => norm (w p)) = u := by -+ funext p -+ -+ have hge : 0 ≤ ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := -+ Real.rpow_nonneg (by exact_mod_cast (Nat.zero_le (p : ℕ))) _ -+ have hpos : 0 < 1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by linarith -+ have hnonneg : 0 ≤ u p := by -+ have : 0 < (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := inv_pos.mpr hpos -+ exact this.le -+ -+ simp [hw_eq, Complex.norm_real, abs_of_nonneg hnonneg] -+ -+ have h_abs_ratio : norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) -+ = norm (∏' p : ℙ, w p) := by -+ simpa [w] using congrArg norm hratio -+ calc -+ norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) -+ = norm (∏' p : ℙ, w p) := h_abs_ratio -+ _ = ∏' p : ℙ, norm (w p) := h_abs_tprod -+ _ = ∏' p : ℙ, u p := by simp [h_abs_eq_fun] -+ _ = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := rfl -+ -+theorem zeta_lower_bound (t : ℝ) : -+ norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) ≤ -+ norm (riemannZeta (((3 : ℝ) / 2) + t * Complex.I)) := by -+ have hs : 1 < (((3 : ℝ) / 2 : ℂ) + t * Complex.I).re := by -+ simp only [Complex.add_re, Complex.mul_I_re] -+ norm_num -+ calc -+ norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) -+ = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := abs_zeta_ratio_eval -+ _ ≤ ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := -+ abs_zeta_inequality t -+ _ = norm (riemannZeta (((3 : ℝ) / 2 : ℂ) + t * Complex.I)) := by -+ simpa using (abs_zeta_prod_prime (((3 : ℝ) / 2 : ℂ) + t * Complex.I) hs).symm -+ -+lemma summable_one_div_nat_add_rpow' {x : ℝ} (hx : 1 < x) : Summable (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x)) := by -+ have h := (Real.summable_one_div_nat_add_rpow (1 : ℝ) x).2 hx -+ have h' : Summable (fun n : ℕ => (|((n : ℝ) + 1)| ^ x)⁻¹) := by -+ simpa [one_div] using h -+ have h2 : (fun n : ℕ => (|((n : ℝ) + 1)| ^ x)⁻¹) = (fun n : ℕ => (((n : ℝ) + 1) ^ x)⁻¹) := by -+ funext n -+ have hn : 0 ≤ (n : ℝ) + 1 := by -+ have : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) -+ exact add_nonneg this (show 0 ≤ (1 : ℝ) from zero_le_one) -+ simp [abs_of_nonneg hn] -+ have h'' : Summable (fun n : ℕ => (((n : ℝ) + 1) ^ x)⁻¹) := by -+ simpa [h2] using h' -+ have h''' : Summable (fun n : ℕ => ((n + 1 : ℝ) ^ x)⁻¹) := by -+ simpa [Nat.cast_add] using h'' -+ simpa [one_div] using h''' -+ -+lemma tsum_pos_of_pos_first_term {f : ℕ → ℝ} (hf : Summable f) (h0 : 0 < f 0) (hnonneg : ∀ n, 0 ≤ f n) : 0 < ∑' n, f n := by -+ have hsum0 : ∑ n ∈ Finset.range 1, f n = f 0 := by -+ simp -+ have hpos_partial : 0 < ∑ n ∈ Finset.range 1, f n := by -+ simpa [hsum0] using h0 -+ have hsumle : ∑ n ∈ Finset.range 1, f n ≤ ∑' n, f n := by -+ have hnonneg' : ∀ n ∉ Finset.range 1, 0 ≤ f n := by -+ intro n hn -+ exact hnonneg n -+ simpa using (hf.sum_le_tsum (s := Finset.range 1) hnonneg') -+ exact lt_of_lt_of_le hpos_partial hsumle -+ -+lemma first_term_pos (x : ℝ) : 0 < (1 : ℝ) / ((1 : ℝ) ^ x) := by -+ simp [Real.one_rpow] -+ -+lemma terms_nonneg (x : ℝ) : ∀ n : ℕ, 0 ≤ (1 : ℝ) / ((n + 1 : ℝ) ^ x) := by -+ intro n -+ have hposb' : 0 < ((n : ℝ) + 1) := -+ add_pos_of_nonneg_of_pos (show 0 ≤ (n : ℝ) from by exact_mod_cast (Nat.zero_le n)) zero_lt_one -+ have hposb : 0 < ((n + 1 : ℝ)) := by -+ simpa [Nat.cast_add, Nat.cast_one] using hposb' -+ have hdenpos : 0 < ((n + 1 : ℝ) ^ x) := by -+ simpa using (Real.rpow_pos_of_pos hposb x) -+ have hden_nonneg : 0 ≤ ((n + 1 : ℝ) ^ x) := le_of_lt hdenpos -+ have hnum_nonneg : 0 ≤ (1 : ℝ) := le_of_lt (zero_lt_one : 0 < (1 : ℝ)) -+ exact div_nonneg hnum_nonneg hden_nonneg -+ -+lemma term_eq_ofRealC (x : ℝ) (n : ℕ) : (1 / ((n + 1 : ℂ) ^ (x : ℂ))) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by -+ have hbase_nonneg : 0 ≤ (n + 1 : ℝ) := by -+ have hn : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) -+ have : 0 ≤ (n : ℝ) + 1 := add_nonneg hn (show 0 ≤ (1 : ℝ) from zero_le_one) -+ simpa [Nat.cast_add, Nat.cast_one] using this -+ have hpow' : ((n + 1 : ℂ) ^ (x : ℂ)) = (((n + 1 : ℝ) ^ x : ℝ) : ℂ) := by -+ simpa using (Complex.ofReal_cpow (x := (n + 1 : ℝ)) (hx := hbase_nonneg) (y := x)).symm -+ have hdiv : (1 : ℂ) / (((n + 1 : ℝ) ^ x : ℝ) : ℂ) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by -+ simp -+ calc -+ 1 / ((n + 1 : ℂ) ^ (x : ℂ)) -+ = (1 : ℂ) / (((n + 1 : ℝ) ^ x : ℝ) : ℂ) := by simp [hpow'] -+ _ = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := hdiv -+ -+lemma zeta_eq_ofReal (x : ℝ) (hx : 1 < x) : -+ riemannZeta x = ((∑' n : ℕ, ((1 : ℝ) / ((n + 1 : ℝ) ^ x))) : ℝ) := by -+ -+ have h1 : riemannZeta (x : ℂ) = ∑' n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) := by -+ apply zeta_eq_tsum_one_div_nat_add_one_cpow -+ simpa using hx -+ -+ have h2 : ∀ n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by -+ exact fun n => term_eq_ofRealC x n -+ -+ rw [h1] -+ simp_rw [h2] -+ -+ rw [← Complex.ofReal_tsum] -+ -+lemma term_inv_eq_ofRealC (x : ℝ) (n : ℕ) : ((n + 1 : ℂ) ^ (x : ℂ))⁻¹ = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by -+ rw [inv_eq_one_div] -+ simpa using (term_eq_ofRealC x n) -+ -+lemma im_tsum_ofReal (g : ℕ → ℝ) : (∑' n : ℕ, (g n : ℂ)).im = 0 := by -+ have him := congrArg Complex.im (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := g)).symm -+ have hz : (((∑' n : ℕ, g n) : ℝ) : ℂ).im = 0 := by -+ simp -+ exact Eq.trans him hz -+ -+lemma re_tsum_ofReal (g : ℕ → ℝ) : (∑' n : ℕ, (g n : ℂ)).re = ∑' n : ℕ, g n := by -+ have h := congrArg Complex.re (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := g)).symm -+ simpa [Complex.ofReal_re] using h -+ -+lemma zetapos (x : ℝ) (hx : 1 < x) : (riemannZeta x).im = 0 ∧ 0 < (riemannZeta x).re := by -+ have hxC : 1 < (Complex.ofReal x).re := by simpa [Complex.ofReal_re] using hx -+ have hz : riemannZeta (x : ℂ) = ∑' n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) := -+ zeta_eq_tsum_one_div_nat_add_one_cpow (s := (x : ℂ)) hxC -+ have him : (riemannZeta x).im = 0 := by -+ simpa [hz, term_eq_ofRealC x] using -+ (im_tsum_ofReal (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x))) -+ have hre : (riemannZeta x).re = ∑' n : ℕ, 1 / ((n + 1 : ℝ) ^ x) := by -+ simpa [hz, term_eq_ofRealC x] using -+ (re_tsum_ofReal (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x))) -+ have hsum : Summable (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x)) := -+ summable_one_div_nat_add_rpow' (x := x) hx -+ have hpos0 : 0 < 1 / ((Nat.cast 0 + 1 : ℝ) ^ x) := by -+ simp [zero_add] -+ have hnonneg : ∀ n : ℕ, 0 ≤ 1 / ((n + 1 : ℝ) ^ x) := terms_nonneg x -+ have hpos : 0 < ∑' n : ℕ, 1 / ((n + 1 : ℝ) ^ x) := -+ tsum_pos_of_pos_first_term hsum hpos0 hnonneg -+ exact ⟨him, by simpa [hre] using hpos⟩ -+ -+lemma zeta332pos : 0 < norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) := by -+ have h3 : (1 : ℝ) < 3 := by norm_num -+ have h32 : (1 : ℝ) < (3 : ℝ) / 2 := by norm_num -+ obtain ⟨h3im, h3repos⟩ := zetapos 3 h3 -+ obtain ⟨h32im, h32repos⟩ := zetapos ((3 : ℝ) / 2) h32 -+ have h3ne : riemannZeta (3 : ℝ) ≠ 0 := by -+ intro hz -+ exact (ne_of_gt h3repos) (by simpa using congrArg Complex.re hz) -+ have h32ne : riemannZeta ((3 : ℝ) / 2) ≠ 0 := by -+ intro hz -+ exact (ne_of_gt h32repos) (by simpa using congrArg Complex.re hz) -+ have hdivne : riemannZeta (3 : ℝ) / riemannZeta ((3 : ℝ) / 2) ≠ 0 := -+ div_ne_zero h3ne h32ne -+ simpa using (norm_pos_iff.mpr hdivne) -+ -+lemma zeta_low_332 : ∃ a : ℝ, 0 < a ∧ ∀ t : ℝ, a ≤ norm (riemannZeta (((3 : ℝ) / 2) + t * Complex.I)) := by -+ use norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) -+ exact ⟨zeta332pos, zeta_lower_bound⟩ -+ -+open Real _root_.Set Filter Topology MeasureTheory -+open scoped BigOperators Topology -+ -+lemma one_div_nat_cpow_eq_ite_cpow_neg (s : ℂ) (hs : s ≠ 0) (n : ℕ) : 1 / (n : ℂ) ^ s = if n = 0 then 0 else (n : ℂ) ^ (-s) := by -+ by_cases h : n = 0 -+ · simp [h, Complex.zero_cpow hs] -+ · have hcalc : 1 / (n : ℂ) ^ s = (n : ℂ) ^ (-s) := by -+ calc -+ 1 / (n : ℂ) ^ s = ((n : ℂ) ^ s)⁻¹ := by simp [one_div] -+ _ = (n : ℂ) ^ (-s) := by simpa using (Complex.cpow_neg (n : ℂ) s).symm -+ simpa [h] using hcalc -+ -+lemma lem_zetaLimit (s : ℂ) (hs : 1 < s.re) : riemannZeta s = ∑' n : ℕ, if n = 0 then 0 else (n : ℂ) ^ (-s) := by -+ classical -+ have hsne : s ≠ 0 := by -+ intro h -+ have hpos : 0 < s.re := lt_trans (show (0 : ℝ) < 1 from zero_lt_one) hs -+ have hne : s.re ≠ 0 := ne_of_gt hpos -+ simp [h] at hne -+ have hz : riemannZeta s = ∑' n : ℕ, 1 / (n : ℂ) ^ s := zeta_eq_tsum_one_div_nat_cpow (s := s) hs -+ simpa [one_div_nat_cpow_eq_ite_cpow_neg s hsne] using hz -+ -+noncomputable def zetaPartialSum (s : ℂ) (N : ℕ) : ℂ := -+ ∑ n ∈ Finset.range N, (n + 1 : ℂ) ^ (-s) -+ -+lemma sum_Icc1_eq_sum_range_succ (N : ℕ) (g : ℕ → ℂ) : -+ (∑ k ∈ Finset.Icc 1 N, g k) = ∑ n ∈ Finset.range N, g (n + 1) := by -+ classical -+ -+ symm -+ refine Finset.sum_bij (s := Finset.range N) (t := Finset.Icc 1 N) -+ (f := fun n => g (n + 1)) (g := fun k => g k) -+ (i := fun n (_hn : n ∈ Finset.range N) => n + 1) -+ ?hi ?hinj ?hsurj ?hcongr -+ · intro n hn -+ have hlt : n < N := Finset.mem_range.mp hn -+ have h1 : 1 ≤ n + 1 := Nat.succ_le_succ (Nat.zero_le n) -+ have h2 : n + 1 ≤ N := Nat.succ_le_of_lt hlt -+ exact (Finset.mem_Icc.mpr ⟨h1, h2⟩) -+ · intro a ha b hb h -+ -+ simpa using Nat.succ_injective h -+ · intro k hk -+ rcases Finset.mem_Icc.mp hk with ⟨hk1, hk2⟩ -+ refine ⟨k - 1, ?_, ?_⟩ -+ · -+ have hsucc : (k - 1) + 1 = k := Nat.sub_add_cancel hk1 -+ have hle : (k - 1) + 1 ≤ N := by simpa [hsucc] using hk2 -+ have hlt : k - 1 < N := lt_of_lt_of_le (Nat.lt_succ_self (k - 1)) hle -+ exact Finset.mem_range.mpr hlt -+ · -+ simp [Nat.sub_add_cancel hk1] -+ · intro n hn -+ rfl -+ -+lemma sum_Icc0_eq_sum_Icc1_of_zero (N : ℕ) (g : ℕ → ℂ) (h0 : g 0 = 0) : -+ (∑ k ∈ Finset.Icc 0 N, g k) = ∑ k ∈ Finset.Icc 1 N, g k := by -+ classical -+ have hdecomp : insert (0 : ℕ) (Finset.Icc 1 N) = Finset.Icc 0 N := by -+ simpa [Nat.succ_eq_add_one] using -+ (Finset.insert_Icc_succ_left_eq_Icc (a := 0) (b := N) (h := Nat.zero_le N)) -+ have hnotmem : (0 : ℕ) ∉ Finset.Icc 1 N := by -+ intro h -+ rcases Finset.mem_Icc.mp h with ⟨h1, _h2⟩ -+ have : ¬ (1 ≤ (0 : ℕ)) := by decide -+ exact this h1 -+ calc -+ (∑ k ∈ Finset.Icc 0 N, g k) -+ = ∑ k ∈ insert 0 (Finset.Icc 1 N), g k := by -+ simp [hdecomp] -+ _ = g 0 + ∑ k ∈ Finset.Icc 1 N, g k := by -+ simp -+ _ = ∑ k ∈ Finset.Icc 1 N, g k := by simp [h0] -+ -+lemma sum_Icc0_shifted_eq_sum_range (a : ℕ → ℂ) (m : ℕ) : -+ (∑ k ∈ Finset.Icc 0 m, (if k = 0 then 0 else a k)) = ∑ n ∈ Finset.range m, a (n + 1) := by -+ classical -+ calc -+ (∑ k ∈ Finset.Icc 0 m, (if k = 0 then 0 else a k)) -+ = ∑ k ∈ Finset.Icc 1 m, (if k = 0 then 0 else a k) := by -+ simpa using -+ (sum_Icc0_eq_sum_Icc1_of_zero (N := m) -+ (g := fun k => (if k = 0 then 0 else a k)) (h0 := by simp)) -+ _ = ∑ n ∈ Finset.range m, (if n + 1 = 0 then 0 else a (n + 1)) := by -+ simpa using -+ (sum_Icc1_eq_sum_range_succ (N := m) (g := fun k => (if k = 0 then 0 else a k))) -+ _ = ∑ n ∈ Finset.range m, a (n + 1) := by -+ apply Finset.sum_congr rfl -+ intro n hn -+ simp -+ -+lemma sum_Icc0_shifted_floor_eq (a : ℕ → ℂ) (t : ℝ) : -+ (∑ k ∈ Finset.Icc 0 ⌊t⌋₊, (if k = 0 then 0 else a k)) = ∑ n ∈ Finset.range ⌊t⌋₊, a (n + 1) := by -+ simpa using (sum_Icc0_shifted_eq_sum_range a ⌊t⌋₊) -+ -+lemma helper_contdiff_differentiable_integrable (f : ℝ → ℂ) (hf : ContDiff ℝ 1 f) -+ (a b : ℝ) : -+ (∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) ∧ IntegrableOn (deriv f) (Set.Icc a b) := by -+ have hdiff : Differentiable ℝ f := hf.differentiable (by norm_num) -+ have hcont_deriv : Continuous (deriv f) := hf.continuous_deriv le_rfl -+ refine And.intro ?hdiffAt ?hint -+ · intro t ht -+ have hdt : DifferentiableAt ℝ f t := hdiff.differentiableAt -+ exact hdt -+ · -+ have hcontOn : ContinuousOn (deriv f) (Set.Icc a b) := hcont_deriv.continuousOn -+ exact hcontOn.integrableOn_compact isCompact_Icc -+ -+lemma sum_range_mul_shift_comm (N : ℕ) (a : ℕ → ℂ) (f : ℝ → ℂ) : -+ (∑ n ∈ Finset.range N, f (n + 1) * (if n + 1 = 0 then 0 else a (n + 1))) -+ = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by -+ classical -+ apply Finset.sum_congr rfl -+ intro n hn -+ simp [mul_comm] -+ -+lemma sum_range_shifted_coeffs (N : ℕ) (a c : ℕ → ℂ) (f : ℝ → ℂ) -+ (hshift : ∀ n, c (n + 1) = a (n + 1)) : -+ (∑ n ∈ Finset.range N, f (↑(n + 1)) * c (n + 1)) -+ = ∑ n ∈ Finset.range N, f (↑(n + 1)) * a (n + 1) := by -+ classical -+ apply Finset.sum_congr rfl -+ intro n hn -+ simp [hshift n] -+ -+lemma sum_range_commute_mul (N : ℕ) (a : ℕ → ℂ) (f : ℝ → ℂ) : -+ (∑ n ∈ Finset.range N, f (↑(n + 1)) * a (n + 1)) -+ = ∑ n ∈ Finset.range N, a (n + 1) * f (↑(n + 1)) := by -+ classical -+ apply Finset.sum_congr rfl -+ intro n hn -+ simp [mul_comm] -+ -+lemma lem_abelSummation {a : ℕ → ℂ} {f : ℝ → ℂ} -+ (hf : ContDiff ℝ 1 f) (N : ℕ) (hN : 1 ≤ N) : -+ (let A := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1); -+ ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) -+ = (A N) * f N - ∫ u in (1 : ℝ)..N, (A u) * deriv f u) := by -+ classical -+ -+ let c : ℕ → ℂ := fun k => if k = 0 then 0 else a k -+ -+ set A : ℝ → ℂ := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1) with hA -+ -+ have hdiff_int := helper_contdiff_differentiable_integrable (f := f) hf (1 : ℝ) N -+ rcases hdiff_int with ⟨hdiff, hint⟩ -+ -+ have habel := -+ sum_mul_eq_sub_integral_mul₀' (c := c) (m := N) -+ (hc := by simp [c]) -+ (hf_diff := by -+ intro t ht -+ simpa using (hdiff t ht)) -+ (hf_int := by simpa using hint) -+ -+ have hLHS : -+ (∑ k ∈ Finset.Icc 0 N, f k * c k) -+ = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by -+ -+ have h0 : -+ (∑ k ∈ Finset.Icc 0 N, f k * c k) -+ = ∑ k ∈ Finset.Icc 1 N, f k * c k := by -+ simpa [c] using -+ (sum_Icc0_eq_sum_Icc1_of_zero (N := N) -+ (g := fun k => f k * c k) (h0 := by simp [c])) -+ -+ have h1 : -+ (∑ k ∈ Finset.Icc 1 N, f k * c k) -+ = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by -+ simpa using -+ (sum_Icc1_eq_sum_range_succ (N := N) (g := fun k => f k * c k)) -+ -+ have h2 : -+ (∑ n ∈ Finset.range N, f (n + 1) * c (n + 1)) -+ = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by -+ simpa [c] using (sum_range_mul_shift_comm (N := N) (a := a) (f := f)) -+ -+ simp [h0, h1, h2] -+ -+ have hAN : A N = ∑ n ∈ Finset.range N, a (n + 1) := by -+ have : (Nat.floor (N : ℝ)) = N := by -+ simp -+ simp [hA, this] -+ have hMain : -+ f N * (∑ k ∈ Finset.Icc 0 N, c k) = (A N) * f N := by -+ -+ have hs : (∑ k ∈ Finset.Icc 0 N, c k) = ∑ n ∈ Finset.range N, a (n + 1) := by -+ simpa [c] using (sum_Icc0_shifted_eq_sum_range (a := a) (m := N)) -+ calc -+ f N * (∑ k ∈ Finset.Icc 0 N, c k) -+ = (∑ k ∈ Finset.Icc 0 N, c k) * f N := by simp [mul_comm] -+ _ = (∑ n ∈ Finset.range N, a (n + 1)) * f N := by simp [hs] -+ _ = (A N) * f N := by simp [hAN] -+ -+ have hInt : -+ (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) -+ = ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by -+ -+ have hfun : -+ (fun t => deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) -+ = (fun t => deriv f t * A t) := by -+ funext t -+ have : (∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) = A t := by -+ simpa [c, hA] using (sum_Icc0_shifted_floor_eq (a := a) (t := t)) -+ simp [this] -+ -+ have h1Nℝ : (1 : ℝ) ≤ N := by exact_mod_cast hN -+ have hI : -+ (∫ u in (1 : ℝ)..N, (A u) * deriv f u) -+ = ∫ u in Set.Ioc (1 : ℝ) N, (A u) * deriv f u := by -+ simpa using -+ (intervalIntegral.integral_of_le -+ (f := fun u => (A u) * deriv f u) (μ := volume) h1Nℝ) -+ calc -+ (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) -+ = ∫ t in Set.Ioc (1 : ℝ) N, deriv f t * A t := by -+ simp [hfun] -+ _ = ∫ t in Set.Ioc (1 : ℝ) N, (A t) * deriv f t := by -+ simp [mul_comm] -+ _ = ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by -+ simp [hI] -+ -+ have hfinal : ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) -+ = (A N) * f N - ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by -+ -+ simpa [hLHS, hMain, hInt] -+ using habel -+ -+ simpa [hA] using hfinal -+ -+lemma lem_partialSumIsZetaN (s : ℂ) (N : ℕ) : -+ (let f := fun u : ℝ => (u : ℂ) ^ (-s) -+ let a := fun _n : ℕ => (1 : ℂ) -+ zetaPartialSum s N = ∑ n ∈ Finset.range N, a n * f (n + 1)) := by -+ simp [zetaPartialSum] -+ -+lemma lem_sumOfAn (u : ℝ) (_hu : 1 ≤ u) : -+ (let a := fun _n : ℕ => (1 : ℂ) -+ let A := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1) -+ A u = (Nat.floor u : ℂ)) := by -+ simp [Finset.sum_const, Finset.card_range] -+ -+lemma lem_fDeriv (s : ℂ) (u : ℝ) (hu : 0 < u) : -+ (let f := fun u : ℝ => (u : ℂ) ^ (-s) -+ deriv f u = -s * (u : ℂ) ^ (-s - 1)) := by -+ -+ show deriv (fun u : ℝ => (u : ℂ) ^ (-s)) u = -s * (u : ℂ) ^ (-s - 1) -+ have hu_ne_zero : u ≠ 0 := ne_of_gt hu -+ by_cases h : s = 0 -+ · -+ simp [h] -+ · -+ have hneg_s_ne_zero : -s ≠ 0 := neg_ne_zero.mpr h -+ exact Complex.deriv_ofReal_cpow_const hu_ne_zero hneg_s_ne_zero -+ -+lemma differentiable_integrable_cpow_on_Icc (s : ℂ) (a b : ℝ) (h0 : 0 < a) (_hle : a ≤ b) : -+ (∀ t ∈ Set.Icc a b, DifferentiableAt ℝ (fun u : ℝ => (u : ℂ) ^ (-s)) t) -+ ∧ IntegrableOn (deriv (fun u : ℝ => (u : ℂ) ^ (-s))) (Set.Icc a b) := -+by -+ classical -+ -+ set f : ℝ → ℂ := fun u => (u : ℂ) ^ (-s) -+ set g : ℝ → ℂ := fun u => -s * (u : ℂ) ^ (-s - 1) -+ -+ have hpos_of_mem : ∀ {t : ℝ}, t ∈ Set.Icc a b → 0 < t := by -+ intro t ht; exact lt_of_lt_of_le h0 ht.1 -+ -+ have hdiff_at : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t := by -+ intro t ht -+ have ht_ne : t ≠ 0 := ne_of_gt (hpos_of_mem ht) -+ by_cases hs : s = 0 -+ · -+ simp [f, hs] -+ · -+ have hr : (-s) ≠ 0 := by simpa using (neg_ne_zero.mpr hs) -+ have hhas : HasDerivAt (fun y : ℝ => (y : ℂ) ^ (-s)) ((-s) * t ^ ((-s) - 1)) t := -+ hasDerivAt_ofReal_cpow_const (x := t) (hx := ht_ne) (r := -s) (hr := hr) -+ exact hhas.differentiableAt -+ -+ have hcont_pow : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := by -+ intro t ht -+ have ht_ne : t ≠ 0 := ne_of_gt (hpos_of_mem ht) -+ by_cases hzero : (-s - 1) = 0 -+ · -+ have : (fun u : ℝ => (u : ℂ) ^ (-s - 1)) = fun _ : ℝ => (1 : ℂ) := by -+ funext u; simp [hzero] -+ simpa [this] using (continuousAt_const : ContinuousAt (fun _ : ℝ => (1 : ℂ)) t).continuousWithinAt -+ · -+ have hr : (-s - 1) ≠ 0 := hzero -+ have hcpow : HasDerivAt (fun y : ℝ => (y : ℂ) ^ (-s - 1)) ((-s - 1) * t ^ ((-s - 1) - 1)) t := -+ hasDerivAt_ofReal_cpow_const (x := t) (hx := ht_ne) (r := -s - 1) (hr := hr) -+ have hcont_at : ContinuousAt (fun u : ℝ => (u : ℂ) ^ (-s - 1)) t := -+ hcpow.differentiableAt.continuousAt -+ simpa using hcont_at.continuousWithinAt -+ have hcont_g : ContinuousOn g (Set.Icc a b) := by -+ have hconst : ContinuousOn (fun _ : ℝ => (-s : ℂ)) (Set.Icc a b) := continuousOn_const -+ simpa only [g, Pi.mul_def, neg_mul] using! hconst.mul hcont_pow -+ -+ have hEqOn : EqOn (deriv f) g (Set.Icc a b) := by -+ intro u hu -+ have hu_pos : 0 < u := hpos_of_mem hu -+ simpa [f, g] using (lem_fDeriv s u hu_pos) -+ -+ have hcont_deriv : ContinuousOn (deriv f) (Set.Icc a b) := by -+ -+ have hg_restr : Continuous ((Set.Icc a b).domRestrict g) := hcont_g.domRestrict -+ have hEqRestr : (Set.Icc a b).domRestrict (deriv f) = (Set.Icc a b).domRestrict g := by -+ funext x; exact hEqOn x.property -+ have hderiv_restr : Continuous ((Set.Icc a b).domRestrict (deriv f)) := by -+ simpa [hEqRestr] using hg_restr -+ simpa [continuousOn_iff_continuous_domRestrict] using hderiv_restr -+ -+ have hInt : IntegrableOn (deriv f) (Set.Icc a b) := -+ hcont_deriv.integrableOn_compact isCompact_Icc -+ exact And.intro hdiff_at hInt -+ -+lemma intervalIntegral_congr_of_Ioc_eq (a b : ℝ) (h : a ≤ b) -+ (f g : ℝ → ℂ) -+ (hpt : ∀ u ∈ Set.Ioc a b, f u = g u) : -+ (∫ u in a..b, f u) = ∫ u in a..b, g u := by -+ -+ have h1 : (∀ᵐ u ∂(MeasureTheory.volume), u ∈ Set.Ioc a b → f u = g u) := by -+ refine Filter.Eventually.of_forall ?_; -+ intro u hu; exact hpt u hu -+ have hIocEmpty : Set.Ioc b a = (∅ : Set ℝ) := by -+ simpa using! (Set.Ioc_eq_empty_of_le h) -+ have h2 : (∀ᵐ u ∂(MeasureTheory.volume), u ∈ Set.Ioc b a → f u = g u) := by -+ refine Filter.Eventually.of_forall ?_; -+ intro u hu -+ have : u ∈ (∅ : Set ℝ) := by simp [hIocEmpty] at hu -+ exact this.elim -+ simpa using -+ (intervalIntegral.integral_congr_ae' (a := a) (b := b) (μ := MeasureTheory.volume) -+ (f := f) (g := g) h1 h2) -+ -+lemma lem_applyAbel (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : -+ zetaPartialSum s N -+ = (N : ℂ) * (N : ℂ) ^ (-s) -+ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by -+ classical -+ -+ set f : ℝ → ℂ := fun u => (u : ℂ) ^ (-s) -+ let c : ℕ → ℂ := fun k => if k = 0 then 0 else (1 : ℂ) -+ -+ have hle : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN -+ have hdiff_int := -+ differentiable_integrable_cpow_on_Icc (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) -+ (h0 := by exact zero_lt_one) (_hle := hle) -+ rcases hdiff_int with ⟨hdiff, hint⟩ -+ -+ have habel := -+ sum_mul_eq_sub_integral_mul₀' (c := c) (f := f) (m := N) -+ (hc := by simp [c]) -+ (hf_diff := by intro t ht; simpa [f] using (hdiff t ht)) -+ (hf_int := by simpa [f] using hint) -+ -+ have hLHS : (∑ k ∈ Finset.Icc 0 N, f k * c k) = zetaPartialSum s N := by -+ -+ have h0 : -+ (∑ k ∈ Finset.Icc 0 N, f k * c k) = ∑ k ∈ Finset.Icc 1 N, f k * c k := by -+ simpa [c] using -+ (sum_Icc0_eq_sum_Icc1_of_zero (N := N) -+ (g := fun k => f k * c k) (h0 := by simp [c])) -+ have h1 : (∑ k ∈ Finset.Icc 1 N, f k * c k) -+ = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by -+ simpa using (sum_Icc1_eq_sum_range_succ (N := N) (g := fun k => f k * c k)) -+ have h2 : (∑ n ∈ Finset.range N, f (n + 1) * c (n + 1)) -+ = ∑ n ∈ Finset.range N, f (n + 1) := by -+ apply Finset.sum_congr rfl; intro n hn; simp [c] -+ calc -+ (∑ k ∈ Finset.Icc 0 N, f k * c k) -+ = ∑ k ∈ Finset.Icc 1 N, f k * c k := by simpa using h0 -+ _ = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by simpa using h1 -+ _ = ∑ n ∈ Finset.range N, f (n + 1) := by simpa using h2 -+ _ = zetaPartialSum s N := by simp [zetaPartialSum, f] -+ -+ have hset_to_interval : -+ (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) -+ = ∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k := by -+ simpa using -+ (intervalIntegral.integral_of_le -+ (f := fun u => deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) -+ (μ := volume) hle).symm -+ have hstep1 : -+ zetaPartialSum s N -+ = f N * (∑ k ∈ Finset.Icc 0 N, c k) -+ - ∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k := by -+ simpa [hLHS, hset_to_interval] using habel -+ -+ have hInt_congr : -+ (∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) -+ = ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by -+ -+ apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hle) -+ (f := fun u => deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) -+ (g := fun u => (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1))) -+ intro u hu -+ have hu_pos : 0 < u := lt_trans zero_lt_one hu.1 -+ have hderiv : deriv f u = -s * (u : ℂ) ^ (-s - 1) := by -+ simpa [f] using (lem_fDeriv s u hu_pos) -+ -+ have hsumfloor : (∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) = (Nat.floor u : ℂ) := by -+ have hshift := sum_Icc0_shifted_floor_eq (a := fun _ => (1 : ℂ)) (t := u) -+ have hsum : (∑ n ∈ Finset.range ⌊u⌋₊, (1 : ℂ)) = (Nat.floor u : ℂ) := by -+ simp [Finset.sum_const, Finset.card_range] -+ simpa [c, hsum] using hshift -+ calc -+ deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k -+ = deriv f u * (Nat.floor u : ℂ) := by simp [hsumfloor] -+ _ = (Nat.floor u : ℂ) * deriv f u := by simp [mul_comm] -+ _ = (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by simp [hderiv] -+ -+ have hstep2 : -+ zetaPartialSum s N -+ = f N * (∑ k ∈ Finset.Icc 0 N, c k) -+ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by -+ simpa [hInt_congr] using hstep1 -+ -+ have hMain : f N * (∑ k ∈ Finset.Icc 0 N, c k) = (N : ℂ) * f N := by -+ have hs : (∑ k ∈ Finset.Icc 0 N, c k) = ∑ n ∈ Finset.range N, (1 : ℂ) := by -+ simpa [c] using (sum_Icc0_shifted_eq_sum_range (a := fun _ => (1 : ℂ)) (m := N)) -+ have hsumN : (∑ n ∈ Finset.range N, (1 : ℂ)) = (N : ℂ) := by -+ simp [Finset.sum_const, Finset.card_range] -+ calc -+ f N * (∑ k ∈ Finset.Icc 0 N, c k) -+ = f N * (∑ n ∈ Finset.range N, (1 : ℂ)) := by simp [hs] -+ _ = f N * (N : ℂ) := by simp [hsumN] -+ _ = (N : ℂ) * f N := by simp [mul_comm] -+ -+ have hfinal : -+ zetaPartialSum s N -+ = (N : ℂ) * (N : ℂ) ^ (-s) -+ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by -+ calc -+ zetaPartialSum s N -+ = f N * (∑ k ∈ Finset.Icc 0 N, c k) -+ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by -+ simpa using hstep2 -+ _ = (N : ℂ) * f N -+ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by -+ simp [hMain] -+ _ = (N : ℂ) * (N : ℂ) ^ (-s) -+ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by -+ simp [f] -+ exact hfinal -+ -+lemma lem_floorNisN (N : ℕ) (_hN : 1 ≤ N) : Nat.floor (N : ℝ) = N := by simp -+ -+lemma helper_integral_const_mul (a b : ℝ) (c : ℂ) (g : ℝ → ℂ) : ∫ x in a..b, c * g x = c * ∫ x in a..b, g x := by simp -+ -+lemma helper_cpow_mul_cpow_neg_eq_cpow_sub (x s : ℂ) (hx : x ≠ 0) : x * x ^ (-s) = x ^ (1 - s) := by -+ calc -+ x * x ^ (-s) = x ^ (1 : ℂ) * x ^ (-s) := by -+ simp [Complex.cpow_one] -+ _ = x ^ (1 + (-s)) := by -+ simpa using (Complex.cpow_add (x := x) (y := (1 : ℂ)) (z := (-s)) hx).symm -+ _ = x ^ (1 - s) := by -+ simp [sub_eq_add_neg] -+ -+lemma lem_zetaNsimplified1 (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : zetaPartialSum s N = (N : ℂ) ^ (1 - s) + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by -+ have happly := lem_applyAbel s N hN -+ -+ have hInt : -+ ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) -+ = (-s) * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by -+ simp [mul_left_comm] -+ calc -+ zetaPartialSum s N -+ = (N : ℂ) * (N : ℂ) ^ (-s) -+ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by -+ simpa using happly -+ _ = (N : ℂ) * (N : ℂ) ^ (-s) -+ - ((-s) * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1)) := by -+ rw [hInt] -+ _ = (N : ℂ) * (N : ℂ) ^ (-s) -+ + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by -+ simp [sub_eq_add_neg, neg_mul] -+ _ = (N : ℂ) ^ (1 - s) -+ + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by -+ have hpos : 0 < N := (Nat.succ_le_iff).mp hN -+ have hNz : (N : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt hpos) -+ have hpow := helper_cpow_mul_cpow_neg_eq_cpow_sub (x := (N : ℂ)) (s := s) hNz -+ simp [hpow] -+ -+lemma lem_floorUdecomp (u : ℝ) : (Int.floor u : ℝ) = u - Int.fract u := by exact (eq_sub_iff_add_eq).2 (Int.floor_add_fract u) -+ -+lemma lem_fracPartBound (u : ℝ) : 0 ≤ Int.fract u ∧ Int.fract u < 1 ∧ |Int.fract u| ≤ (1 : ℝ) := by -+ constructor -+ · exact Int.fract_nonneg u -+ · constructor -+ · exact Int.fract_lt_one u -+ · have hnonneg : 0 ≤ Int.fract u := Int.fract_nonneg u -+ have hle : Int.fract u ≤ (1 : ℝ) := le_of_lt (Int.fract_lt_one u) -+ simpa [abs_of_nonneg hnonneg] using hle -+ -+lemma helper_continuousOn_cpow (r : ℂ) {a b : ℝ} (ha : 0 < a) (_hab : a ≤ b) : -+ ContinuousOn (fun u : ℝ => (u : ℂ) ^ r) (Set.Icc a b) := by -+ classical -+ intro t ht -+ have ht_pos : 0 < t := lt_of_lt_of_le ha ht.1 -+ by_cases hr : r = 0 -+ · -+ have hconst : (fun u : ℝ => (u : ℂ) ^ r) = fun _ => (1 : ℂ) := by -+ funext u; simp [hr] -+ simpa [hconst] using (continuousAt_const : ContinuousAt (fun _ : ℝ => (1 : ℂ)) t).continuousWithinAt -+ · -+ have hderiv : HasDerivAt (fun u : ℝ => (u : ℂ) ^ r) (r * t ^ (r - 1)) t := -+ hasDerivAt_ofReal_cpow_const (x := t) (hx := ne_of_gt ht_pos) (r := r) (hr := hr) -+ exact hderiv.differentiableAt.continuousAt.continuousWithinAt -+ -+lemma helper_intervalIntegrable_mul_cpow_id (s : ℂ) {a b : ℝ} (ha : 1 ≤ a) (hab : a ≤ b) : -+ IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by -+ classical -+ -+ have hcont1 : ContinuousOn (fun u : ℝ => (u : ℂ)) (Set.Icc a b) := -+ (Complex.continuous_ofReal).continuousOn -+ have hcont2 : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := -+ helper_continuousOn_cpow (-s - 1) (lt_of_lt_of_le zero_lt_one ha) hab -+ have hcont : ContinuousOn (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := -+ hcont1.mul hcont2 -+ -+ have hint_on : IntegrableOn (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := -+ hcont.integrableOn_compact isCompact_Icc -+ have hint : IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by -+ simpa using -+ (intervalIntegrable_iff_integrableOn_Icc_of_le (μ := volume) (a := a) (b := b) -+ (f := fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) hab).2 hint_on -+ exact hint -+ -+lemma helper_aestronglyMeasurable_kernel_Icc (s : ℂ) {a b : ℝ} : -+ AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) -+ (volume.restrict (Icc a b)) := by -+ -+ have hmeas_fract : Measurable (Int.fract : ℝ → ℝ) := by simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) -+ have h1 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) (volume.restrict (Icc a b)) := -+ (Complex.measurable_ofReal.comp hmeas_fract).aestronglyMeasurable -+ have h2 : AEStronglyMeasurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (volume.restrict (Icc a b)) := by -+ have hmeas : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by measurability -+ exact hmeas.aestronglyMeasurable -+ simpa using! (MeasureTheory.AEStronglyMeasurable.mul h1 h2) -+ -+lemma helper_intervalIntegrable_frac_kernel (s : ℂ) {a b : ℝ} (ha : 1 ≤ a) (hab : a ≤ b) : -+ IntervalIntegrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by -+ classical -+ -+ let μ := volume.restrict (Icc a b) -+ set f : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) -+ set g : ℝ → ℝ := fun u => ‖(u : ℂ) ^ (-s - 1)‖ -+ -+ have hmeas : AEStronglyMeasurable f μ := by simpa [μ, f] using helper_aestronglyMeasurable_kernel_Icc (s := s) (a := a) (b := b) -+ -+ have hbound_ae : ∀ᵐ u ∂μ, ‖f u‖ ≤ g u := by -+ -+ refine ((ae_restrict_iff' (μ := volume) (s := Icc a b) -+ (p := fun u : ℝ => ‖f u‖ ≤ g u) measurableSet_Icc)).2 ?_ -+ refine Filter.Eventually.of_forall ?_ -+ intro u hu -+ -+ have hfract_le1 : ‖(Int.fract u : ℝ)‖ ≤ (1 : ℝ) := by -+ simpa using (lem_fracPartBound u).2.2 -+ -+ have : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ ‖(Int.fract u : ℝ)‖ * ‖(u : ℂ) ^ (-s - 1)‖ := by -+ simp -+ have : ‖f u‖ ≤ ‖(Int.fract u : ℝ)‖ * ‖(u : ℂ) ^ (-s - 1)‖ := by -+ simp [f] -+ have : ‖f u‖ ≤ 1 * ‖(u : ℂ) ^ (-s - 1)‖ := -+ le_trans this (mul_le_mul_of_nonneg_right hfract_le1 (by exact norm_nonneg _)) -+ simpa [g] using (by simpa [one_mul] using this) -+ -+ have hcont : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Icc a b) := -+ helper_continuousOn_cpow (-s - 1) (lt_of_lt_of_le zero_lt_one ha) hab -+ have hg_int_on : IntegrableOn g (Icc a b) := by -+ have hcont_norm : ContinuousOn g (Icc a b) := by -+ simpa [g] using (hcont.norm) -+ exact hcont_norm.integrableOn_compact isCompact_Icc -+ -+ have hf0 : Integrable (fun _ : ℝ => (0 : ℂ)) μ := by simp [μ] -+ have hg : Integrable g μ := by simpa [μ] using! hg_int_on -+ -+ have hf : Integrable f μ := -+ MeasureTheory.integrable_of_norm_sub_le (μ := μ) hmeas hf0 hg -+ (by -+ -+ have : ∀ᵐ u ∂μ, ‖(0 : ℂ) - f u‖ ≤ g u := by -+ simpa [sub_eq_add_neg, norm_neg, μ, f, g] using hbound_ae -+ simpa using this) -+ -+ have hf_on : IntegrableOn f (Icc a b) := by simpa [μ, f] using! hf -+ simpa using -+ (intervalIntegrable_iff_integrableOn_Icc_of_le (μ := volume) (a := a) (b := b) -+ (f := f) hab).2 hf_on -+ -+lemma lem_integralSplit (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : -+ ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) -+ = (∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) -+ - ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by -+ have hab : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN -+ -+ have hcongr1 : -+ (∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1)) -+ = ∫ u in (1 : ℝ)..N, -+ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1) := by -+ apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) -+ intro u hu -+ have hu0 : 0 ≤ u := le_trans (by norm_num) (le_of_lt hu.1) -+ have hfloorR : (Nat.floor u : ℝ) = (Int.floor u : ℝ) := by -+ simpa using (natCast_floor_eq_intCast_floor (R := ℝ) (a := u) hu0) -+ have hfloorC : (Nat.floor u : ℂ) = ((Int.floor u : ℝ) : ℂ) := by -+ simpa using congrArg (fun x : ℝ => (x : ℂ)) hfloorR -+ have hIFR : (Int.floor u : ℝ) = u - Int.fract u := lem_floorUdecomp u -+ have hIFC : ((Int.floor u : ℝ) : ℂ) = ((u - Int.fract u : ℝ) : ℂ) := -+ congrArg (fun x : ℝ => (x : ℂ)) hIFR -+ have : (Nat.floor u : ℂ) = ((u - Int.fract u : ℝ) : ℂ) := hfloorC.trans hIFC -+ simp [this, sub_eq_add_neg] -+ -+ have hcongr2 : -+ (∫ u in (1 : ℝ)..N, -+ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) -+ = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) -+ - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := by -+ have hI1 : IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume (1 : ℝ) (N : ℝ) := -+ helper_intervalIntegrable_mul_cpow_id (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) (ha := le_rfl) (hab := hab) -+ have hI2 : IntervalIntegrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) volume (1 : ℝ) (N : ℝ) := -+ helper_intervalIntegrable_frac_kernel (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) (ha := le_rfl) (hab := hab) -+ have : -+ (∫ u in (1 : ℝ)..N, -+ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) -+ = ∫ u in (1 : ℝ)..N, -+ ((u : ℂ) * (u : ℂ) ^ (-s - 1) -+ - ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := by -+ apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) -+ intro u hu; simp [sub_mul] -+ calc -+ (∫ u in (1 : ℝ)..N, -+ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) -+ = ∫ u in (1 : ℝ)..N, -+ ((u : ℂ) * (u : ℂ) ^ (-s - 1) -+ - ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := this -+ _ = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) -+ - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := -+ (intervalIntegral.integral_sub (μ := volume) (a := (1 : ℝ)) (b := (N : ℝ)) hI1 hI2) -+ -+ have hpow : -+ (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) -+ = ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) := by -+ apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) -+ intro u hu -+ have hu_pos : 0 < u := lt_trans zero_lt_one hu.1 -+ have hux0 : (u : ℝ) ≠ 0 := ne_of_gt hu_pos -+ have hcx0 : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hux0 -+ calc -+ (u : ℂ) * (u : ℂ) ^ (-s - 1) -+ = (u : ℂ) ^ (1 : ℂ) * (u : ℂ) ^ (-s - 1) := by simp [Complex.cpow_one] -+ _ = (u : ℂ) ^ (1 + (-s - 1)) := by -+ simpa using -+ (Complex.cpow_add (x := (u : ℂ)) (y := (1 : ℂ)) (z := (-s - 1)) hcx0).symm -+ _ = (u : ℂ) ^ (-s) := by -+ simp [add_left_comm, sub_eq_add_neg] -+ -+ calc -+ ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) -+ = ∫ u in (1 : ℝ)..N, -+ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1) := hcongr1 -+ _ = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) -+ - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := hcongr2 -+ _ = (∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) -+ - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := by -+ simp [hpow] -+ -+lemma lem_zetaNsimplified2 (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : -+ zetaPartialSum s N -+ = (N : ℂ) ^ (1 - s) -+ + (s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) -+ - (s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) := by -+ have hstep1: _ := lem_zetaNsimplified1 s N hN -+ rw [lem_integralSplit] at hstep1 -+ rw [mul_sub] at hstep1 -+ rw [hstep1] -+ exact (add_sub_assoc _ _ _).symm -+ exact hN -+ -+lemma lem_evalMainIntegral (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := by -+ have h01leN : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN -+ have h0notIcc : (0 : ℝ) ∉ Set.Icc (1 : ℝ) (N : ℝ) := by -+ intro hx -+ exact (not_le.mpr (by norm_num : (0 : ℝ) < 1)) hx.1 -+ have h0not : (0 : ℝ) ∉ Set.uIcc (1 : ℝ) (N : ℝ) := by -+ simp [uIcc_of_le h01leN] -+ have hrne : -s ≠ (-1 : ℂ) := by -+ intro h -+ apply hs -+ simpa using congrArg Neg.neg h -+ have hint : ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) -+ = ((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1) := by -+ have hcond : (-1 < (-s).re) ∨ (-s ≠ -1 ∧ (0 : ℝ) ∉ Set.uIcc (1 : ℝ) (N : ℝ)) := by -+ exact Or.inr ⟨hrne, h0not⟩ -+ simpa using (integral_cpow (a := (1 : ℝ)) (b := (N : ℝ)) (r := -s) hcond) -+ have hmul : s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) -+ = s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) := by -+ simpa using congrArg (fun x => s * x) hint -+ have hrewrite : -+ s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) -+ = s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) := by -+ have : s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) -+ = s * (((N : ℂ) ^ (1 - s) - (1 : ℂ) ^ (1 - s)) / (1 - s)) := by -+ simp [add_comm, sub_eq_add_neg] -+ have h1pow : (1 : ℂ) ^ (1 - s) = 1 := by simp -+ simpa [h1pow] using this -+ have hsplit : s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) -+ = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := by -+ have h1 : s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) -+ = (s * ((N : ℂ) ^ (1 - s) - 1)) / (1 - s) := by -+ simpa using (mul_div_assoc s ((N : ℂ) ^ (1 - s) - 1) (1 - s)).symm -+ have h2 : (s * ((N : ℂ) ^ (1 - s) - 1)) / (1 - s) -+ = (s / (1 - s)) * ((N : ℂ) ^ (1 - s) - 1) := by -+ simpa [mul_comm, mul_left_comm, mul_assoc] using -+ (div_mul_eq_mul_div (a := s) (b := (1 - s)) (c := ((N : ℂ) ^ (1 - s) - 1))).symm -+ exact h1.trans h2 -+ calc -+ s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) -+ = s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) := hmul -+ _ = s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) := hrewrite -+ _ = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := hsplit -+ -+lemma lem_zetaNfinal (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : -+ zetaPartialSum s N -+ = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) -+ - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by -+ -+ have hstep := lem_zetaNsimplified2 s N hN -+ -+ rw [lem_evalMainIntegral s hs N hN] at hstep -+ -+ have hden : (1 - s) ≠ 0 := by -+ intro h -+ have h1 : 1 = s := by simpa [sub_eq_zero] using h -+ have h2 : s = 1 := h1.symm -+ exact hs h2 -+ let A := (N : ℂ) ^ (1 - s) -+ -+ have h1 : (1 - s) * (A + s / (1 - s) * (A - 1)) = A - s := by -+ calc -+ (1 - s) * (A + s / (1 - s) * (A - 1)) -+ = (1 - s) * A + (1 - s) * (s / (1 - s) * (A - 1)) := by ring -+ _ = (1 - s) * A + s * (A - 1) := by field_simp [hden] -+ _ = A - s := by ring -+ have h2 : (1 - s) * (A / (1 - s) + 1 + 1 / (s - 1)) = A - s := by -+ have hne : s - 1 ≠ 0 := by simpa [sub_eq_zero] using hs -+ field_simp [hden, hne]; ring -+ have halg : A + s / (1 - s) * (A - 1) = A / (1 - s) + 1 + 1 / (s - 1) := -+ mul_left_cancel₀ hden (h1.trans h2.symm) -+ -+ rw [halg] at hstep -+ exact hstep -+ -+lemma complex_tendsto_zero_iff_norm_tendsto_zero {α : Type*} {f : α → ℂ} {l : Filter α} : -+ Tendsto f l (𝓝 0) ↔ Tendsto (fun x => ‖f x‖) l (𝓝 0) := by -+ rw [tendsto_iff_dist_tendsto_zero] -+ simp only [dist_zero_right] -+ -+lemma complex_norm_natCast_cpow (N : ℕ) (w : ℂ) (hN : 0 < N) : -+ ‖(N : ℂ) ^ w‖ = (N : ℝ) ^ w.re := by -+ have hNnz : (N : ℂ) ≠ 0 := by -+ simp [Ne, Nat.cast_eq_zero] -+ exact ne_of_gt hN -+ rw [Complex.norm_cpow_of_ne_zero hNnz] -+ rw [Complex.norm_natCast] -+ rw [Complex.natCast_arg] -+ simp [Real.exp_zero] -+ -+lemma tendsto_natCast_cpow_zero_of_neg_re (w : ℂ) (hw : w.re < 0) : -+ Tendsto (fun N : ℕ => (N : ℂ) ^ w) atTop (𝓝 0) := by -+ rw [complex_tendsto_zero_iff_norm_tendsto_zero] -+ -+ have h1 : ∀ᶠ (N : ℕ) in atTop, ‖(N : ℂ) ^ w‖ = (N : ℝ) ^ w.re := by -+ filter_upwards [eventually_gt_atTop 0] with N hN -+ exact complex_norm_natCast_cpow N w hN -+ rw [tendsto_congr' h1] -+ -+ have hw_pos : 0 < -w.re := neg_pos.mpr hw -+ -+ have h_eq : w.re = -(-w.re) := by ring -+ rw [h_eq] -+ -+ have h_comp : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop -+ have h_rpow : Tendsto (fun x : ℝ => x ^ (-(-w.re))) atTop (𝓝 0) := tendsto_rpow_neg_atTop hw_pos -+ exact Tendsto.comp h_rpow h_comp -+ -+lemma lem_limitTerm1 (s : ℂ) (hs : 1 < s.re) : -+ Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s)) atTop (𝓝 0) := by -+ apply tendsto_natCast_cpow_zero_of_neg_re -+ simp only [Complex.sub_re, Complex.one_re] -+ linarith -+ -+lemma lem_integrandBound (u : ℝ) (hu : 1 ≤ u) (s : ℂ) : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by -+ -+ set a : ℂ := ((Int.fract u : ℝ) : ℂ) -+ set b : ℂ := (u : ℂ) ^ (-s - 1) -+ -+ have hfract_le1 : ‖a‖ ≤ (1 : ℝ) := by -+ simpa [a, Complex.norm_real] using (lem_fracPartBound u).2.2 -+ -+ have hu0 : 0 < u := lt_of_lt_of_le zero_lt_one hu -+ -+ have h₁ : ‖a * b‖ ≤ ‖a‖ * ‖b‖ := by simp -+ have h₂ : ‖a‖ * ‖b‖ ≤ 1 * ‖b‖ := -+ mul_le_mul_of_nonneg_right hfract_le1 (norm_nonneg _) -+ have h₃ : ‖a * b‖ ≤ 1 * ‖b‖ := le_trans h₁ h₂ -+ have hle : ‖a * b‖ ≤ ‖b‖ := by simpa [one_mul] using h₃ -+ -+ have hb : ‖b‖ = u ^ ((-s - 1).re) := by -+ simpa [b] using -+ Complex.norm_cpow_eq_rpow_re_of_pos (x := u) (hx := hu0) (y := -s - 1) -+ -+ have hexp : (-s - 1).re = -s.re - 1 := by -+ simp [sub_eq_add_neg] -+ -+ calc -+ ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ -+ = ‖a * b‖ := rfl -+ _ ≤ ‖b‖ := hle -+ _ = u ^ ((-s - 1).re) := hb -+ _ = u ^ (-s.re - 1) := by simp [hexp] -+ -+lemma lem_integrandBoundeps (ε : ℝ) (_hε : 0 < ε) (u : ℝ) (hu : 1 ≤ u) (s : ℂ) (hs : ε ≤ s.re) : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε) := by -+ have h1 : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := lem_integrandBound u hu s -+ have h2 : -s.re - 1 ≤ -1 - ε := by linarith [hs] -+ have h3 : u ^ (-s.re - 1) ≤ u ^ (-1 - ε) := Real.rpow_le_rpow_of_exponent_le hu h2 -+ exact le_trans h1 h3 -+ -+lemma lem_triangleInequality_add (z₁ z₂ : ℂ) : -+ ‖z₁ + z₂‖ ≤ ‖z₁‖ + ‖z₂‖ := by -+ exact norm_add_le z₁ z₂ -+ -+lemma lem_triangleInequality_integral {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] -+ {f : ℝ → E} {a b : ℝ} (_hf : IntervalIntegrable f volume a b) (h : a ≤ b) : -+ ‖∫ u in a..b, f u‖ ≤ ∫ u in a..b, ‖f u‖ := by -+ -+ simpa using (intervalIntegral.norm_integral_le_integral_norm (μ := volume) (f := f) (a := a) (b := b) h) -+ -+lemma helper_integral_interval_sub_left {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] -+ {f : ℝ → E} {a b c : ℝ} -+ (hab : IntervalIntegrable f volume a b) (hac : IntervalIntegrable f volume a c) : -+ ((∫ x in a..b, f x) - ∫ x in a..c, f x) = ∫ x in c..b, f x := by -+ simpa using -+ (intervalIntegral.integral_interval_sub_left (μ := volume) (f := f) (a := a) (b := b) (c := c) -+ hab hac) -+ -+lemma helper_integral_rpow_eval {ε : ℝ} (hε : 0 < ε) {m n : ℝ} -+ (hm : 1 ≤ m) (hmn : m ≤ n) : -+ ∫ u in m..n, u ^ (-1 - ε) = (m ^ (-ε) - n ^ (-ε)) / ε := by -+ -+ have h0notIcc : (0 : ℝ) ∉ Set.Icc m n := by -+ intro hx -+ have : ¬ m ≤ 0 := not_le.mpr (lt_of_lt_of_le zero_lt_one hm) -+ exact this hx.1 -+ have h0not : (0 : ℝ) ∉ Set.uIcc m n := by -+ simpa [uIcc_of_le hmn] using h0notIcc -+ -+ have hrne : (-1 - ε) ≠ (-1 : ℝ) := by -+ intro h -+ have hplus := congrArg (fun t => t + 1) h -+ have hminus : -ε = 0 := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hplus -+ have hε0 : ε = 0 := by simpa using congrArg Neg.neg hminus -+ exact (ne_of_gt hε) hε0 -+ -+ have hint : ∫ u in m..n, u ^ (-1 - ε) -+ = (n ^ ((-1 - ε) + 1) - m ^ ((-1 - ε) + 1)) / ((-1 - ε) + 1) := by -+ have hcond : (-1 < (-1 - ε)) ∨ ((-1 - ε) ≠ -1 ∧ (0 : ℝ) ∉ Set.uIcc m n) := by -+ exact Or.inr ⟨hrne, h0not⟩ -+ simpa using (integral_rpow (a := m) (b := n) (r := -1 - ε) hcond) -+ -+ have h1 : ((-1 - ε) + 1) = -ε := by -+ simp [sub_eq_add_neg, add_comm, add_left_comm] -+ have : ∫ u in m..n, u ^ (-1 - ε) -+ = (n ^ (-ε) - m ^ (-ε)) / (-ε) := by -+ simpa [h1] -+ using hint -+ have hnegnum : -(n ^ (-ε) - m ^ (-ε)) = m ^ (-ε) - n ^ (-ε) := by -+ simp -+ calc -+ ∫ u in m..n, u ^ (-1 - ε) -+ = (n ^ (-ε) - m ^ (-ε)) / (-ε) := this -+ _ = (n ^ (-ε) - m ^ (-ε)) * ((-ε)⁻¹) := by simp [div_eq_mul_inv] -+ _ = (n ^ (-ε) - m ^ (-ε)) * (-(ε⁻¹)) := by simp [inv_neg] -+ _ = -((n ^ (-ε) - m ^ (-ε)) * ε⁻¹) := by simp [mul_neg] -+ _ = (-(n ^ (-ε) - m ^ (-ε))) * ε⁻¹ := by -+ simpa using (neg_mul (n ^ (-ε) - m ^ (-ε)) (ε⁻¹)).symm -+ _ = (m ^ (-ε) - n ^ (-ε)) * ε⁻¹ := by -+ simp -+ _ = (m ^ (-ε) - n ^ (-ε)) / ε := by simp [div_eq_mul_inv] -+ -+lemma helper_integral_rpow_le {ε : ℝ} (hε : 0 < ε) {m n : ℝ} -+ (hm : 1 ≤ m) (hmn : m ≤ n) : -+ ∫ u in m..n, u ^ (-1 - ε) ≤ (1 / ε) * m ^ (-ε) := by -+ have heval := helper_integral_rpow_eval (ε := ε) hε hm hmn -+ have hn0 : 0 ≤ n := by -+ have h01 : (0 : ℝ) ≤ 1 := by norm_num -+ exact le_trans h01 (le_trans hm hmn) -+ have hsub_le : m ^ (-ε) - n ^ (-ε) ≤ m ^ (-ε) := by -+ exact sub_le_self _ (Real.rpow_nonneg hn0 (-ε)) -+ have hinv_nonneg : 0 ≤ ε⁻¹ := by -+ exact inv_nonneg.mpr (le_of_lt hε) -+ have hdiv_le : ((m ^ (-ε) - n ^ (-ε)) / ε) ≤ (m ^ (-ε) / ε) := by -+ have := mul_le_mul_of_nonneg_right hsub_le hinv_nonneg -+ simpa [div_eq_mul_inv, mul_comm] using this -+ calc -+ ∫ u in m..n, u ^ (-1 - ε) -+ = (m ^ (-ε) - n ^ (-ε)) / ε := heval -+ _ ≤ m ^ (-ε) / ε := hdiv_le -+ _ = (1 / ε) * m ^ (-ε) := by simp [div_eq_mul_inv, mul_comm] -+ -+lemma helper_tendsto_nat_rpow_neg (ε : ℝ) (hε : 0 < ε) : -+ Tendsto (fun m : ℕ => (m : ℝ) ^ (-ε)) atTop (𝓝 0) := by -+ -+ have hcont : Tendsto (fun x : ℝ => x ^ (-ε)) atTop (𝓝 0) := by -+ -+ simpa using (tendsto_rpow_neg_atTop (y := ε) hε) -+ -+ have hcoe : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop := by -+ exact tendsto_natCast_atTop_atTop -+ -+ have : Tendsto ((fun x : ℝ => x ^ (-ε)) ∘ fun n : ℕ => (n : ℝ)) atTop (𝓝 0) := -+ hcont.comp hcoe -+ -+ simpa using! this -+ -+lemma helper_exists_limit_of_tail_bound (a : ℕ → ℂ) (b : ℕ → ℝ) -+ (hb_nonneg : ∀ m, 0 ≤ b m) -+ (hb_tendsto : Tendsto b atTop (𝓝 0)) -+ (hbound : ∀ᶠ m in atTop, ∀ᶠ n in atTop, m ≤ n → ‖a n - a m‖ ≤ b m) : -+ ∃ l : ℂ, Tendsto a atTop (𝓝 l) := by -+ classical -+ -+ have hCauchy : CauchySeq a := by -+ -+ refine (Metric.cauchySeq_iff).2 ?_ -+ intro ε hε -+ -+ have h_ball : ∀ᶠ m in atTop, dist (b m) 0 < ε / 2 := by -+ exact hb_tendsto (Metric.ball_mem_nhds (0 : ℝ) (half_pos hε)) -+ have h_b_lt : ∀ᶠ m in atTop, b m < ε / 2 := by -+ refine h_ball.mono ?_ -+ intro m hm -+ have : |b m| < ε / 2 := by -+ simpa [Metric.mem_ball, Real.dist_eq] using hm -+ simpa [abs_of_nonneg (hb_nonneg m)] using this -+ -+ rcases eventually_atTop.1 hbound with ⟨M1, hM1⟩ -+ rcases eventually_atTop.1 h_b_lt with ⟨M2, hM2⟩ -+ let M := max M1 M2 -+ have hPM : ∀ᶠ n in atTop, M ≤ n → ‖a n - a M‖ ≤ b M := by -+ have h' := hM1 M (le_max_left _ _) -+ exact h' -+ have hMb : b M < ε / 2 := hM2 M (le_max_right _ _) -+ rcases eventually_atTop.1 hPM with ⟨N0, hN0⟩ -+ refine ⟨max N0 M, ?_⟩ -+ intro n hn k hk -+ have hMn : M ≤ n := le_trans (le_max_right _ _) hn -+ have hMk : M ≤ k := le_trans (le_max_right _ _) hk -+ have hN0n : N0 ≤ n := le_trans (le_max_left _ _) hn -+ have hN0k : N0 ≤ k := le_trans (le_max_left _ _) hk -+ have h1 : ‖a n - a M‖ ≤ b M := (hN0 n hN0n) hMn -+ have h2 : ‖a k - a M‖ ≤ b M := (hN0 k hN0k) hMk -+ -+ have htri : ‖a n - a k‖ ≤ ‖a n - a M‖ + ‖a M - a k‖ := by -+ have h := norm_add_le (a n - a M) (a M - a k) -+ simpa [sub_add_sub_cancel (a n) (a M) (a k)] using h -+ have h2' : ‖a M - a k‖ ≤ b M := by simpa [norm_sub_rev] using h2 -+ have hsumle : ‖a n - a k‖ ≤ b M + b M := -+ le_trans htri (add_le_add h1 h2') -+ have hsumlt : b M + b M < ε := by -+ have := add_lt_add hMb hMb -+ simpa [add_halves] using this -+ have : ‖a n - a k‖ < ε := lt_of_le_of_lt hsumle hsumlt -+ simpa [dist_eq_norm] using this -+ -+ rcases cauchySeq_tendsto_of_complete (u := a) hCauchy with ⟨l, hl⟩ -+ exact ⟨l, hl⟩ -+ -+lemma helper_limit_norm_le_of_uniform_bound {a : ℕ → ℂ} {l : ℂ} {B : ℝ} -+ (h : Tendsto a atTop (𝓝 l)) (hbound : ∀ n, ‖a n‖ ≤ B) : ‖l‖ ≤ B := by -+ have hnorm : Tendsto (fun n => ‖a n‖) atTop (𝓝 ‖l‖) := (Filter.Tendsto.norm h) -+ exact le_of_tendsto' hnorm (fun n => by simpa using hbound n) -+ -+lemma helper_one_le_of_mem_Icc {m n u : ℝ} (hm : 1 ≤ m) (hu : u ∈ Icc m n) : 1 ≤ u := by -+ exact le_trans hm hu.1 -+ -+lemma helper_intervalIntegrable_rpow_neg {ε : ℝ} {a b : ℝ} (_hε : 0 < ε) -+ (ha : 1 ≤ a) (hab : a ≤ b) : -+ IntervalIntegrable (fun u : ℝ => u ^ (-1 - ε)) volume a b := by -+ have h0notIcc : (0 : ℝ) ∉ Set.Icc a b := by -+ intro hx -+ have : ¬ a ≤ 0 := not_le.mpr (lt_of_lt_of_le zero_lt_one ha) -+ exact this hx.1 -+ have h0not : (0 : ℝ) ∉ Set.uIcc a b := by -+ simpa [uIcc_of_le hab] using h0notIcc -+ simpa using -+ (intervalIntegral.intervalIntegrable_rpow (μ := volume) (a := a) (b := b) (r := -1 - ε) -+ (Or.inr h0not)) -+ -+lemma helper_one_le_of_mem_Ioc {m n u : ℝ} (hm : 1 ≤ m) (hu : u ∈ Ioc m n) : 1 ≤ u := by -+ exact le_trans hm (le_of_lt hu.1) -+ -+lemma helper_integrableOn_of_bound_Ioc {m n : ℝ} {f : ℝ → ℂ} {g : ℝ → ℝ} -+ (hmeas : AEStronglyMeasurable f (volume.restrict (Ioc m n))) -+ (hbound : ∀ᵐ u ∂(volume.restrict (Ioc m n)), ‖f u‖ ≤ g u) -+ (hg : IntegrableOn g (Ioc m n) volume) : -+ IntegrableOn f (Ioc m n) volume := by -+ -+ let μ := volume.restrict (Ioc m n) -+ -+ have hf0 : Integrable (fun _ : ℝ => (0 : ℂ)) μ := by -+ simp -+ -+ have hg' : Integrable g μ := by -+ simpa [μ] using! hg -+ -+ have hmeas' : AEStronglyMeasurable f μ := by -+ simpa [μ] using hmeas -+ -+ have hineq : ∀ᵐ u ∂μ, ‖(0 : ℂ) - f u‖ ≤ g u := by -+ simpa [μ, sub_eq_add_neg, norm_neg] using hbound -+ -+ have hf : Integrable f μ := -+ MeasureTheory.integrable_of_norm_sub_le (μ := μ) hmeas' hf0 hg' hineq -+ -+ simpa [μ] using! hf -+ -+lemma helper_aestronglyMeasurable_kernel_Ioc (s : ℂ) {m n : ℝ} : -+ AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) -+ (volume.restrict (Ioc m n)) := by -+ -+ have h1 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) (volume.restrict (Ioc m n)) := by -+ have hmeas_fract : Measurable (Int.fract : ℝ → ℝ) := by -+ simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) -+ have hmeas_coe : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := -+ (Complex.measurable_ofReal.comp hmeas_fract) -+ exact hmeas_coe.aestronglyMeasurable -+ -+ have h2 : AEStronglyMeasurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (volume.restrict (Ioc m n)) := by -+ have hmeas : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by -+ measurability -+ exact hmeas.aestronglyMeasurable -+ -+ simpa using! (MeasureTheory.AEStronglyMeasurable.mul h1 h2) -+ -+lemma helper_aebound_kernel_Ioc {ε : ℝ} (hε : 0 < ε) (s : ℂ) (hs : ε ≤ s.re) -+ {m n : ℝ} (hm : 1 ≤ m) (_hmn : m ≤ n) : -+ ∀ᵐ u ∂(volume.restrict (Ioc m n)), -+ ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε) := by -+ -+ refine -+ ((ae_restrict_iff' (μ := volume) (s := Ioc m n) -+ (p := fun u : ℝ => ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε)) -+ measurableSet_Ioc)).2 ?_ -+ -+ refine Filter.Eventually.of_forall ?_ -+ intro u hu -+ have hu1 : 1 ≤ u := helper_one_le_of_mem_Ioc hm hu -+ simpa using (lem_integrandBoundeps ε hε u hu1 s hs) -+ -+lemma helper_integrableOn_rpow_neg_Ioc {ε : ℝ} (hε : 0 < ε) -+ {m n : ℝ} (hm : 1 ≤ m) (hmn : m ≤ n) : -+ IntegrableOn (fun u : ℝ => u ^ (-1 - ε)) (Ioc m n) volume := by -+ have hInt : IntervalIntegrable (fun u : ℝ => u ^ (-1 - ε)) volume m n := -+ helper_intervalIntegrable_rpow_neg (ε := ε) hε hm hmn -+ exact -+ (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) -+ (f := fun u : ℝ => u ^ (-1 - ε)) hmn).1 hInt -+ -+lemma helper_intervalIntegrable_of_integrableOn_Ioc {f : ℝ → ℂ} {m n : ℝ} -+ (hmn : m ≤ n) (hint : IntegrableOn f (Ioc m n) volume) : -+ IntervalIntegrable f volume m n := by -+ exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) -+ (a := m) (b := n) (f := f) hmn).2 hint -+ -+lemma helper_rpow_neg_nonneg_on {ε a b : ℝ} (_hε : 0 < ε) (ha : 1 ≤ a) (_hab : a ≤ b) : -+ ∀ u ∈ Icc a b, 0 ≤ u ^ (-1 - ε) := by -+ intro u hu -+ have h1u : 1 ≤ u := le_trans ha hu.1 -+ have h0u : 0 ≤ u := le_trans (by norm_num) h1u -+ exact Real.rpow_nonneg h0u (-1 - ε) -+ -+lemma helper_norm_integral_le_integral_norm_of_le {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] -+ {f : ℝ → E} {a b : ℝ} (h : a ≤ b) : -+ ‖∫ u in a..b, f u‖ ≤ ∫ u in a..b, ‖f u‖ := by -+ simpa using (intervalIntegral.norm_integral_le_integral_norm (μ := volume) (f := f) (a := a) (b := b) h) -+ -+lemma helper_tendsto_const_mul_zero (c : ℝ) {f : ℕ → ℝ} -+ (h : Tendsto f atTop (𝓝 0)) : Tendsto (fun n => c * f n) atTop (𝓝 0) := by -+ simpa using (Filter.Tendsto.const_mul (b := c) h) -+ -+lemma helper_limit_norm_le_of_eventual_bound {a : ℕ → ℂ} {l : ℂ} {B : ℝ} -+ (h : Tendsto a atTop (𝓝 l)) (hbound : ∀ᶠ n in atTop, ‖a n‖ ≤ B) : ‖l‖ ≤ B := by -+ have hnorm : Tendsto (fun n => ‖a n‖) atTop (𝓝 ‖l‖) := (Filter.Tendsto.norm h) -+ exact le_of_tendsto hnorm hbound -+ -+lemma lem_integralConvergence (ε : ℝ) (hε : 0 < ε) (s : ℂ) (hs : ε ≤ s.re) : -+ ∃ I : ℂ, -+ Tendsto -+ (fun N : ℕ => -+ ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) -+ atTop (𝓝 I) -+ ∧ ‖I‖ ≤ (1 / ε) := by -+ classical -+ -+ let fC : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) -+ let gR : ℝ → ℝ := fun u => u ^ (-1 - ε) -+ let a : ℕ → ℂ := fun N => ∫ u in (1 : ℝ)..(N : ℝ), fC u -+ let b : ℕ → ℝ := fun m => (1 / ε) * (m : ℝ) ^ (-ε) -+ -+ have hb_nonneg : ∀ m, 0 ≤ b m := by -+ intro m -+ have hm0 : (0 : ℝ) ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) -+ have hpow : 0 ≤ (m : ℝ) ^ (-ε) := Real.rpow_nonneg hm0 _ -+ have hpos : 0 ≤ 1 / ε := by exact le_of_lt (one_div_pos.mpr hε) -+ have := mul_le_mul_of_nonneg_left hpow hpos -+ simpa [b] using this -+ -+ have hb_tendsto : Tendsto b atTop (𝓝 0) := by -+ have hpow := helper_tendsto_nat_rpow_neg (ε := ε) hε -+ have hmul := helper_tendsto_const_mul_zero (c := (1 / ε)) hpow -+ simpa [b] using hmul -+ -+ have h_tail_pointwise : ∀ m n : ℕ, 1 ≤ m → m ≤ n → ‖a n - a m‖ ≤ b m := by -+ intro m n hm1 hmn -+ -+ have hmR : (1 : ℝ) ≤ (m : ℝ) := by exact_mod_cast hm1 -+ have hmnR : (m : ℝ) ≤ (n : ℝ) := by exact_mod_cast hmn -+ -+ have hInt_f_1n : IntervalIntegrable fC volume (1 : ℝ) (n : ℝ) := by -+ -+ have h1nNat : 1 ≤ n := le_trans hm1 hmn -+ have h1nR : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast h1nNat -+ have hmeas := helper_aestronglyMeasurable_kernel_Ioc (s := s) (m := (1 : ℝ)) (n := (n : ℝ)) -+ have hgIntOn : IntegrableOn gR (Ioc (1 : ℝ) (n : ℝ)) volume := -+ helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (n : ℝ)) (hm := by norm_num) (hmn := h1nR) -+ have hbound := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (n : ℝ)) (hm := by norm_num) (_hmn := h1nR) -+ have hintOn := helper_integrableOn_of_bound_Ioc (m := (1 : ℝ)) (n := (n : ℝ)) (f := fC) (g := gR) -+ (hmeas := hmeas) (hbound := hbound) (hg := hgIntOn) -+ exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) -+ (a := (1 : ℝ)) (b := (n : ℝ)) (f := fC) h1nR).2 hintOn -+ have hInt_f_1m : IntervalIntegrable fC volume (1 : ℝ) (m : ℝ) := by -+ have hmeas := helper_aestronglyMeasurable_kernel_Ioc (s := s) (m := (1 : ℝ)) (n := (m : ℝ)) -+ have hgIntOn : IntegrableOn gR (Ioc (1 : ℝ) (m : ℝ)) volume := -+ helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (m : ℝ)) (hm := by norm_num) (hmn := hmR) -+ have hbound := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (m : ℝ)) (hm := by norm_num) (_hmn := hmR) -+ have hintOn := helper_integrableOn_of_bound_Ioc (m := (1 : ℝ)) (n := (m : ℝ)) (f := fC) (g := gR) -+ (hmeas := hmeas) (hbound := hbound) (hg := hgIntOn) -+ exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) -+ (a := (1 : ℝ)) (b := (m : ℝ)) (f := fC) hmR).2 hintOn -+ have hdiff := helper_integral_interval_sub_left -+ (E := ℂ) (f := fC) (a := (1 : ℝ)) (b := (n : ℝ)) (c := (m : ℝ)) -+ (hab := hInt_f_1n) (hac := hInt_f_1m) -+ have hsub : a n - a m = ∫ u in (m : ℝ)..(n : ℝ), fC u := by -+ simpa [a] using hdiff -+ -+ have hbound_Ioc := helper_aebound_kernel_Ioc (ε := ε) hε s hs -+ (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (_hmn := hmnR) -+ have hbound_Ioc_imp : ∀ᵐ t ∂(volume), t ∈ Ioc (m : ℝ) (n : ℝ) → ‖fC t‖ ≤ gR t := by -+ simpa [fC, gR] using -+ ((ae_restrict_iff' (μ := volume) (s := Ioc (m : ℝ) (n : ℝ)) measurableSet_Ioc).1 hbound_Ioc) -+ -+ have hgInt_mn : IntervalIntegrable gR volume (m : ℝ) (n : ℝ) := -+ (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) -+ (a := (m : ℝ)) (b := (n : ℝ)) (f := gR) hmnR).2 -+ (helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (hmn := hmnR)) -+ -+ have h1 : ‖∫ u in (m : ℝ)..(n : ℝ), fC u‖ ≤ ∫ u in (m : ℝ)..(n : ℝ), gR u := by -+ simpa using -+ (intervalIntegral.norm_integral_le_of_norm_le (μ := volume) -+ (a := (m : ℝ)) (b := (n : ℝ)) (f := fC) (g := gR) -+ (hab := hmnR) (h := hbound_Ioc_imp) (hbound := hgInt_mn)) -+ -+ have h3 : ∫ u in (m : ℝ)..(n : ℝ), gR u ≤ (1 / ε) * (m : ℝ) ^ (-ε) := -+ helper_integral_rpow_le (ε := ε) hε (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (hmn := hmnR) -+ -+ have : ‖∫ u in (m : ℝ)..(n : ℝ), fC u‖ ≤ (1 / ε) * (m : ℝ) ^ (-ε) := -+ le_trans h1 h3 -+ simpa [hsub, b] using this -+ -+ have hbound : ∀ᶠ m in atTop, ∀ᶠ n in atTop, m ≤ n → ‖a n - a m‖ ≤ b m := by -+ have h_m_ge1 : ∀ᶠ m in atTop, 1 ≤ m := eventually_ge_atTop 1 -+ refine h_m_ge1.mono ?_ -+ intro m hm1 -+ have h_n_ge_m : ∀ᶠ n in atTop, m ≤ n := eventually_ge_atTop m -+ exact h_n_ge_m.mono (fun n hmn => by intro hle; exact h_tail_pointwise m n hm1 hle) -+ -+ rcases helper_exists_limit_of_tail_bound a b hb_nonneg hb_tendsto hbound with ⟨I, hT⟩ -+ -+ have h_eventual_bound : ∀ᶠ N in atTop, ‖a N‖ ≤ (1 / ε) := by -+ have hN1 : ∀ᶠ N in atTop, 1 ≤ N := eventually_ge_atTop 1 -+ refine hN1.mono ?_ -+ intro N hNge1 -+ have h1N : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hNge1 -+ -+ have hbound_Ioc := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (_hmn := h1N) -+ have hbound_Ioc_imp : ∀ᵐ t ∂(volume), t ∈ Ioc (1 : ℝ) (N : ℝ) → ‖fC t‖ ≤ gR t := by -+ simpa [fC, gR] using -+ ((ae_restrict_iff' (μ := volume) (s := Ioc (1 : ℝ) (N : ℝ)) measurableSet_Ioc).1 hbound_Ioc) -+ -+ have hgInt_1N : IntervalIntegrable gR volume (1 : ℝ) (N : ℝ) := -+ (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) -+ (a := (1 : ℝ)) (b := (N : ℝ)) (f := gR) h1N).2 -+ (helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (hmn := h1N)) -+ -+ have h1 : ‖∫ u in (1 : ℝ)..(N : ℝ), fC u‖ ≤ ∫ u in (1 : ℝ)..(N : ℝ), gR u := by -+ simpa [a] using -+ (intervalIntegral.norm_integral_le_of_norm_le (μ := volume) -+ (a := (1 : ℝ)) (b := (N : ℝ)) (f := fC) (g := gR) -+ (hab := h1N) (h := hbound_Ioc_imp) (hbound := hgInt_1N)) -+ -+ have h3 : ∫ u in (1 : ℝ)..(N : ℝ), gR u ≤ (1 / ε) := by -+ have := helper_integral_rpow_le (ε := ε) hε (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (hmn := h1N) -+ simpa [one_div, Real.one_rpow, one_mul] using this -+ have : ‖a N‖ ≤ (1 / ε) := by exact le_trans h1 h3 -+ exact this -+ -+ have hIle : ‖I‖ ≤ (1 / ε) := -+ helper_limit_norm_le_of_eventual_bound (a := a) (l := I) (B := 1 / ε) hT h_eventual_bound -+ -+ refine ⟨I, ?_, hIle⟩ -+ simpa [a, fC] using hT -+ -+lemma helper_tendsto_zetaPartialSum_to_zeta (s : ℂ) (hs : 1 < s.re) : -+ Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) := by -+ classical -+ -+ set g : ℕ → ℂ := fun n => if n = 0 then 0 else (n : ℂ) ^ (-s) -+ set h : ℕ → ℂ := fun n => (n + 1 : ℂ) ^ (-s) -+ -+ have hsne : s ≠ 0 := by -+ intro h0 -+ have : (0 : ℝ) < s.re := lt_trans (show (0 : ℝ) < 1 by norm_num) hs -+ simpa [h0] using (ne_of_gt this) -+ -+ have hsum_div : Summable (fun n : ℕ => 1 / (n : ℂ) ^ s) := -+ (Complex.summable_one_div_nat_cpow (p := s)).2 hs -+ have hgSumm : Summable g := by -+ simpa [g, one_div_nat_cpow_eq_ite_cpow_neg s hsne] using hsum_div -+ -+ have h_eq_tail : (fun n => g (n + 1)) = h := by -+ funext n; simp [g, h] -+ have hhSumm : Summable h := by -+ have : Summable (fun n : ℕ => g (n + 1)) := (summable_nat_add_iff (f := g) (k := 1)).2 hgSumm -+ simpa [h_eq_tail] using this -+ -+ have hg0 : g 0 = 0 := by simp [g] -+ have h_tsum_eq : (∑' n : ℕ, h n) = ∑' n : ℕ, g n := by -+ have hzero_add := (Summable.tsum_eq_zero_add (f := g) hgSumm) -+ -+ have : (∑' n : ℕ, g n) = ∑' n : ℕ, g (n + 1) := by -+ simpa [hg0, add_comm] using hzero_add -+ simpa [h_eq_tail] using this.symm -+ -+ have hzeta : riemannZeta s = ∑' n : ℕ, g n := by -+ simpa [g] using lem_zetaLimit s hs -+ -+ have h_tendsto : Tendsto (fun N : ℕ => ∑ n ∈ Finset.range N, h n) atTop (𝓝 (∑' n, h n)) := -+ (Summable.tendsto_sum_tsum_nat hhSumm) -+ -+ have htsumeq : (∑' n, h n) = riemannZeta s := h_tsum_eq.trans hzeta.symm -+ simpa [zetaPartialSum, htsumeq, h] using h_tendsto -+ -+lemma integrableOn_of_ae_bound {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] -+ {f : ℝ → E} {g : ℝ → ℝ} {s : Set ℝ} -+ (hfm : AEStronglyMeasurable f (volume.restrict s)) -+ (hgint : IntegrableOn g s) -+ (hbound : ∀ᵐ x ∂(volume.restrict s), ‖f x‖ ≤ g x) : -+ IntegrableOn f s := by -+ have hg' : Integrable g (volume.restrict s) := by -+ simpa [IntegrableOn] using hgint -+ have hf' : Integrable f (volume.restrict s) := -+ MeasureTheory.Integrable.mono' (μ := volume.restrict s) hg' hfm hbound -+ simpa [IntegrableOn] using hf' -+ -+lemma kernel_aestronglyMeasurable_on_Ioi (s : ℂ) (a : ℝ) : -+ AEStronglyMeasurable (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (volume.restrict (Ioi a)) := by -+ -+ have hmeas_fract : Measurable (fun u : ℝ => (Int.fract u : ℝ)) := by -+ simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) -+ have hmeas_fractC : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := -+ hmeas_fract.complex_ofReal -+ have hmeas_cpow : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by -+ have hmeas_ofReal : Measurable (fun u : ℝ => (u : ℂ)) := Complex.measurable_ofReal -+ simpa using hmeas_ofReal.pow_const (-s - 1) -+ have hmeas : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := -+ hmeas_fractC.mul hmeas_cpow -+ -+ simpa using hmeas.aestronglyMeasurable -+ -+lemma kernel_ae_bound_on_Ioi (s : ℂ) : -+ ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), -+ ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by -+ -+ let p : ℝ → Prop := fun u => ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) -+ -+ have hAll : ∀ u ∈ Ioi (1 : ℝ), p u := by -+ intro u hu -+ have hu' : (1 : ℝ) ≤ u := le_of_lt hu -+ dsimp [p] -+ simpa using (lem_integrandBound u hu' s) -+ -+ have hAE : ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → p u := -+ MeasureTheory.ae_of_all _ hAll -+ -+ have hiff : -+ (∀ᵐ u ∂volume.restrict (Ioi (1 : ℝ)), p u) ↔ ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → p u := -+ (MeasureTheory.ae_restrict_iff' (μ := volume) (s := Ioi (1 : ℝ)) (p := p)) measurableSet_Ioi -+ exact hiff.mpr hAE -+ -+lemma helper_intervalIntegral_tendstoIoi_kernel (s : ℂ) (hs : 1 < s.re) : -+ Tendsto (fun N : ℕ => ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop -+ (𝓝 (∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := by -+ -+ have hfm : AEStronglyMeasurable (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) -+ (volume.restrict (Ioi (1 : ℝ))) := by -+ simpa using kernel_aestronglyMeasurable_on_Ioi (s := s) (a := (1 : ℝ)) -+ have hbound' : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), -+ ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by -+ -+ simpa using kernel_ae_bound_on_Ioi (s := s) -+ have hlt : (-s.re - 1) < (-1 : ℝ) := by linarith -+ have hpos : 0 < (1 : ℝ) := by norm_num -+ have hgint : IntegrableOn (fun u : ℝ => u ^ (-s.re - 1)) (Ioi (1 : ℝ)) := by -+ simpa using integrableOn_Ioi_rpow_of_lt (a := (-s.re - 1)) (c := (1 : ℝ)) hlt hpos -+ have hint : IntegrableOn (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (Ioi (1 : ℝ)) := by -+ -+ exact integrableOn_of_ae_bound (s := Ioi (1 : ℝ)) hfm hgint hbound' -+ -+ have hb : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop -+ simpa using -+ (MeasureTheory.intervalIntegral_tendsto_integral_Ioi (μ := volume) -+ (f := fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (a := (1 : ℝ)) -+ (b := fun N : ℕ => (N : ℝ)) hint hb) -+ -+lemma helper_zetaNfinal (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : -+ zetaPartialSum s N -+ = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) -+ - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by -+ simpa using (lem_zetaNfinal s hs N hN) -+ -+lemma helper_eventually_eq_from_zetaNfinal (s : ℂ) (hs : s ≠ 1) : -+ ∀ᶠ N in atTop, -+ zetaPartialSum s N -+ = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) -+ - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by -+ have hEv : ∀ᶠ N : ℕ in atTop, 1 ≤ N := Filter.eventually_ge_atTop (1 : ℕ) -+ refine hEv.mono ?_ -+ intro N hN -+ simpa using (helper_zetaNfinal s hs N hN) -+ -+lemma helper_limit_scaled_cpow (s : ℂ) (hs : 1 < s.re) (_hsne : s ≠ 1) : -+ Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s) / (1 - s)) atTop (𝓝 0) := by -+ have h := lem_limitTerm1 s hs -+ have h' := (Filter.Tendsto.const_mul (b := (1 / (1 - s))) h) -+ simpa [div_eq_mul_inv, mul_comm] using h' -+ -+lemma helper_tendsto_const_mul {f : ℕ → ℂ} {l : ℂ} (c : ℂ) -+ (h : Tendsto f atTop (𝓝 l)) : Tendsto (fun n => c * f n) atTop (𝓝 (c * l)) := by -+ exact h.const_mul c -+ -+lemma helper_tendsto_add {f g : ℕ → ℂ} {a b : ℂ} -+ (hf : Tendsto f atTop (𝓝 a)) (hg : Tendsto g atTop (𝓝 b)) : -+ Tendsto (fun n => f n + g n) atTop (𝓝 (a + b)) := by -+ -+ have hpair : Tendsto (fun n => (f n, g n)) atTop (𝓝 (a, b)) := by -+ simpa using (hf.prodMk_nhds hg) -+ have hadd : Continuous (fun p : ℂ × ℂ => p.1 + p.2) := by -+ simpa using! (continuous_fst.add continuous_snd) -+ simpa using! ((hadd.tendsto (a, b)).comp hpair) -+ -+lemma helper_tendsto_neg {f : ℕ → ℂ} {a : ℂ} -+ (hf : Tendsto f atTop (𝓝 a)) : Tendsto (fun n => - f n) atTop (𝓝 (-a)) := by -+ simpa only [Function.comp_def] using! ((continuous_neg.tendsto a).comp hf) -+ -+lemma helper_tendsto_sub {f g : ℕ → ℂ} {a b : ℂ} -+ (hf : Tendsto f atTop (𝓝 a)) (hg : Tendsto g atTop (𝓝 b)) : -+ Tendsto (fun n => f n - g n) atTop (𝓝 (a - b)) := by -+ have hneg : Tendsto (fun n => - g n) atTop (𝓝 (-b)) := -+ helper_tendsto_neg (f := g) (a := b) hg -+ simpa [sub_eq_add_neg] using -+ helper_tendsto_add (f := f) (g := fun n => - g n) hf hneg -+ -+lemma lem_zetaFormula (s : ℂ) (hs : 1 < s.re) : -+ riemannZeta s -+ = 1 + 1 / (s - 1) -+ - s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by -+ classical -+ -+ have hsne : s ≠ 1 := by -+ intro h -+ have hlt : 1 < (1 : ℝ) := by simp [h, Complex.one_re] at hs -+ exact (lt_irrefl _ ) hlt -+ -+ let G : ℕ → ℂ := fun N => -+ (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) -+ - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) -+ -+ have hEv : ∀ᶠ N in atTop, zetaPartialSum s N = G N := by -+ simpa [G] using helper_eventually_eq_from_zetaNfinal s hsne -+ -+ have h_ps : Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) := -+ helper_tendsto_zetaPartialSum_to_zeta s hs -+ -+ have hG_to_zeta : Tendsto G atTop (𝓝 (riemannZeta s)) := by -+ have hcongr := (Filter.tendsto_congr' (hl := hEv) : -+ Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) ↔ -+ Tendsto G atTop (𝓝 (riemannZeta s))) -+ exact hcongr.mp h_ps -+ -+ have hA : Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s) / (1 - s)) atTop (𝓝 0) := -+ helper_limit_scaled_cpow s hs hsne -+ -+ have hK : Tendsto (fun _ : ℕ => (1 : ℂ) + 1 / (s - 1)) atTop (𝓝 ((1 : ℂ) + 1 / (s - 1))) := -+ tendsto_const_nhds -+ -+ have hInt : Tendsto (fun N : ℕ => ∫ u in (1 : ℝ)..N, -+ (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop -+ (𝓝 (∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := -+ helper_intervalIntegral_tendstoIoi_kernel s hs -+ -+ have hIntMul : Tendsto (fun N : ℕ => s * ∫ u in (1 : ℝ)..N, -+ (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop -+ (𝓝 (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := -+ helper_tendsto_const_mul (c := s) hInt -+ -+ set Aseq : ℕ → ℂ := fun N => (N : ℂ) ^ (1 - s) / (1 - s) -+ set Kseq : ℕ → ℂ := fun _ => (1 : ℂ) + 1 / (s - 1) -+ have hA2 : Tendsto Aseq atTop (𝓝 0) := by simpa [Aseq] using hA -+ have hK2 : Tendsto Kseq atTop (𝓝 ((1 : ℂ) + 1 / (s - 1))) := by simp [Kseq] -+ have hSum : Tendsto (fun N => Aseq N + Kseq N) atTop (𝓝 (0 + ((1 : ℂ) + 1 / (s - 1)))) := -+ helper_tendsto_add (hf := hA2) (hg := hK2) -+ set Iseq : ℕ → ℂ := fun N => s * ∫ u in (1 : ℝ)..N, -+ (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) -+ have hIseq : Tendsto Iseq atTop (𝓝 (s * ∫ u in Ioi (1 : ℝ), -+ (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := by -+ simpa [Iseq] using hIntMul -+ have hG_limit : Tendsto G atTop -+ (𝓝 ((0 + ((1 : ℂ) + 1 / (s - 1))) -+ - (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)))) := by -+ have hSub := helper_tendsto_sub (hf := hSum) (hg := hIseq) -+ -+ have hGdef : (fun N => (Aseq N + Kseq N) - Iseq N) = G := by -+ funext N; simp [Aseq, Kseq, Iseq, G, add_comm, add_left_comm, add_assoc, sub_eq_add_neg] -+ simpa [hGdef] -+ using hSub -+ -+ have huniq := -+ tendsto_nhds_unique (f := G) (l := atTop) -+ (a := riemannZeta s) -+ (b := ((0 + ((1 : ℂ) + 1 / (s - 1))) -+ - (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)))) -+ (ha := hG_to_zeta) (hb := hG_limit) -+ -+ simpa [zero_add, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using huniq -+ -+lemma lem_zetaanalOnnot1 : AnalyticOn ℂ riemannZeta {s : ℂ | s ≠ 1} := by -+ -+ have hset : {s : ℂ | s ≠ 1} = ({1} : Set ℂ)ᶜ := by -+ ext z; simp -+ have hopen : IsOpen ({s : ℂ | s ≠ 1}) := by -+ simp [hset] -+ -+ have hdiff : DifferentiableOn ℂ riemannZeta {s : ℂ | s ≠ 1} := by -+ intro z hz -+ -+ simpa using (differentiableAt_riemannZeta (by simpa [Set.mem_ofPred_eq] using hz)).differentiableWithinAt -+ simpa [Complex.analyticOn_iff_differentiableOn hopen] using hdiff -+ -+lemma lem_zetaanalS : (let S := {s : ℂ | s ≠ 1}; AnalyticOn ℂ riemannZeta S) := by exact lem_zetaanalOnnot1 -+ -+lemma lem_S_isOpen : (let S := {s : ℂ | s ≠ 1}; IsOpen S) := by -+ -+ have h : {s : ℂ | s ≠ 1} = {(1 : ℂ)}ᶜ := by -+ ext s; simp [Set.mem_compl_iff, Set.mem_singleton_iff] -+ rw [h] -+ exact isOpen_compl_singleton -+ -+lemma lem_T_isOpen : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsOpen T) := by -+ -+ show IsOpen {s : ℂ | s ≠ 1 ∧ 1/10 < s.re} -+ -+ apply IsOpen.and -+ · -+ exact lem_S_isOpen -+ · -+ -+ have h_eq : {s : ℂ | 1/10 < s.re} = Complex.re ⁻¹' (Set.Ioi (1/10)) := by -+ ext s -+ simp [Set.mem_preimage, Set.mem_Ioi] -+ rw [h_eq] -+ exact Complex.continuous_re.isOpen_preimage (Set.Ioi (1/10)) isOpen_Ioi -+ -+lemma helper_T_open : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsOpen T) := by -+ classical -+ -+ intro S T -+ -+ have hSopen : IsOpen S := by simpa using lem_S_isOpen -+ -+ have hHalfplane : IsOpen {s : ℂ | (1 / 10 : ℝ) < s.re} := by -+ have : IsOpen ((fun s : ℂ => s.re) ⁻¹' Ioi (1 / 10 : ℝ)) := -+ IsOpen.preimage (hf := Complex.continuous_re) (t := Ioi (1 / 10 : ℝ)) (h := isOpen_Ioi) -+ simpa [Set.preimage, Ioi] using this -+ -+ have hInter : IsOpen (S ∩ {s : ℂ | (1 / 10 : ℝ) < s.re}) := hSopen.inter hHalfplane -+ -+ simpa [T, Set.ofPred_and] using hInter -+ -+lemma open_mem_interior_of_isOpen {X : Type*} [TopologicalSpace X] {U : Set X} (hU : IsOpen U) {x : X} (hx : x ∈ U) : x ∈ interior U := by simpa [hU.interior_eq] using hx -+ -+lemma isOpen_halfplane_re_gt (a : ℝ) : IsOpen {z : ℂ | a < z.re} := by -+ simpa [Set.mem_ofPred_eq] using -+ (isOpen_lt (hf := continuous_const) (hg := Complex.continuous_re)) -+ -+lemma T_eq_inter_S_half (S T : Set ℂ) (_hS : S = {s : ℂ | s ≠ 1}) (hT : T = {s : ℂ | s ∈ S ∧ (1/10 : ℝ) < s.re}) : -+ T = S ∩ {s : ℂ | (1/10 : ℝ) < s.re} := by -+ classical -+ ext z -+ simp [hT, Set.inter_def] -+ -+lemma inter_compl_singleton_eq_diff {α : Type*} [DecidableEq α] (A : Set α) (x : α) : -+ A ∩ ({x} : Set α)ᶜ = A \ ({x} : Set α) := by -+ ext z; simp [Set.mem_inter_iff, Set.mem_singleton_iff] -+ -+lemma joinedIn_of_path_forall_mem {s : Set ℂ} {x y : ℂ} -+ (γ : Path x y) (hγ : ∀ t, γ t ∈ s) : JoinedIn s x y := by -+ exact ⟨γ, hγ⟩ -+ -+lemma path_forall_mem_symm {x y : ℂ} {P : ℂ → Prop} (γ : Path x y) -+ (h : ∀ t, P (γ t)) : ∀ t, P (γ.symm t) := by -+ intro t -+ simpa [Path.symm] using (h (unitInterval.symm t)) -+ -+lemma isPathConnected_punctured_halfplane_re_gt (a : ℝ) (p : ℂ) (hp : a < p.re) : -+ IsPathConnected ({z : ℂ | a < z.re} \ ({p} : Set ℂ)) := by -+ classical -+ -+ let S1 : Set ℂ := {z : ℂ | a < z.re ∧ z.im < p.im} -+ let S2 : Set ℂ := {z : ℂ | a < z.re ∧ z.re < p.re} -+ let S3 : Set ℂ := {z : ℂ | a < z.re ∧ p.im < z.im} -+ let S4 : Set ℂ := {z : ℂ | p.re < z.re} -+ -+ have hS1conv : Convex ℝ S1 := by -+ have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) -+ have h2 : Convex ℝ {z : ℂ | z.im < p.im} := convex_halfSpace_im_lt (r := p.im) -+ simpa [S1, Set.ofPred_and] using h1.inter h2 -+ have hS2conv : Convex ℝ S2 := by -+ have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) -+ have h2 : Convex ℝ {z : ℂ | z.re < p.re} := convex_halfSpace_re_lt (r := p.re) -+ simpa [S2, Set.ofPred_and] using h1.inter h2 -+ have hS3conv : Convex ℝ S3 := by -+ have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) -+ have h2 : Convex ℝ {z : ℂ | p.im < z.im} := convex_halfSpace_im_gt (r := p.im) -+ simpa [S3, Set.ofPred_and] using h1.inter h2 -+ have hS4conv : Convex ℝ S4 := by -+ simpa [S4] using (convex_halfSpace_re_gt (r := p.re)) -+ -+ have hS1ne : S1.Nonempty := by -+ refine ⟨((max a p.re) + 1 : ℝ) + (p.im - 1) * Complex.I, ?_⟩ -+ have h1 : a < (max a p.re) + 1 := by -+ have : a ≤ max a p.re := le_max_left _ _ -+ exact lt_of_le_of_lt this (by linarith) -+ have h2 : (p.im - 1) < p.im := by linarith -+ simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] -+ using And.intro h1 h2 -+ have hS2ne : S2.Nonempty := by -+ refine ⟨((a + p.re) / 2 : ℝ) + (p.im : ℝ) * Complex.I, ?_⟩ -+ have h1 : a < (a + p.re) / 2 := by linarith -+ have h2 : (a + p.re) / 2 < p.re := by linarith -+ simpa [S2, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] -+ using And.intro h1 h2 -+ have hS3ne : S3.Nonempty := by -+ refine ⟨((max a p.re) + 1 : ℝ) + (p.im + 1) * Complex.I, ?_⟩ -+ have h1 : a < (max a p.re) + 1 := by -+ have : a ≤ max a p.re := le_max_left _ _ -+ exact lt_of_le_of_lt this (by linarith) -+ have h2 : p.im < (p.im + 1) := by linarith -+ simpa [S3, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] -+ using And.intro h1 h2 -+ have hS4ne : S4.Nonempty := by -+ refine ⟨(p.re + 1 : ℝ) + (0 : ℝ) * Complex.I, ?_⟩ -+ have : p.re < p.re + 1 := by linarith -+ simp [S4, Complex.add_re] -+ -+ have hS1pc : IsPathConnected S1 := (hS1conv.isPathConnected hS1ne) -+ have hS2pc : IsPathConnected S2 := (hS2conv.isPathConnected hS2ne) -+ have hS3pc : IsPathConnected S3 := (hS3conv.isPathConnected hS3ne) -+ have hS4pc : IsPathConnected S4 := (hS4conv.isPathConnected hS4ne) -+ -+ let A : Set ℂ := S1 ∪ S2 -+ let B : Set ℂ := S3 ∪ S4 -+ -+ have hS1S2_int : (S1 ∩ S2).Nonempty := by -+ refine ⟨((a + p.re) / 2 : ℝ) + (p.im - (1/2)) * Complex.I, ?_⟩ -+ have h1a : a < (a + p.re) / 2 := by linarith -+ have h1b : (p.im - (1/2)) < p.im := by linarith -+ have h2a : a < (a + p.re) / 2 := by linarith -+ have h2b : (a + p.re) / 2 < p.re := by linarith -+ constructor -+ · -+ simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] -+ using And.intro h1a h1b -+ · -+ simpa [S2, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] -+ using And.intro h2a h2b -+ have hApc : IsPathConnected A := -+ IsPathConnected.union (U := S1) (V := S2) hS1pc hS2pc (by -+ rcases hS1S2_int with ⟨z, hz⟩; exact ⟨z, hz⟩) -+ have hS3S4_int : (S3 ∩ S4).Nonempty := by -+ refine ⟨(p.re + 1 : ℝ) + (p.im + 1) * Complex.I, ?_⟩ -+ have h3a : a < p.re + 1 := lt_trans hp (by linarith) -+ have h3b : p.im < p.im + 1 := by linarith -+ have h4 : p.re < p.re + 1 := by linarith -+ constructor -+ · -+ simpa [S3, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] -+ using And.intro h3a h3b -+ · -+ simp [S4, Complex.add_re, Complex.mul_re] -+ have hBpc : IsPathConnected B := -+ IsPathConnected.union (U := S3) (V := S4) hS3pc hS4pc (by -+ rcases hS3S4_int with ⟨z, hz⟩; exact ⟨z, hz⟩) -+ -+ have hABint : (A ∩ B).Nonempty := by -+ refine ⟨(p.re + 1 : ℝ) + (p.im - 1) * Complex.I, ?_⟩ -+ constructor -+ · -+ refine Or.inl ?_ -+ have h1 : a < p.re + 1 := lt_trans hp (by linarith) -+ have h2 : (p.im - 1) < p.im := by linarith -+ simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] -+ using And.intro h1 h2 -+ · -+ refine Or.inr ?_ -+ have h4 : p.re < p.re + 1 := by linarith -+ simp [S4, Complex.add_re, Complex.mul_re] -+ -+ have hUnionPC : IsPathConnected (A ∪ B) := -+ IsPathConnected.union (U := A) (V := B) hApc hBpc (by -+ rcases hABint with ⟨z, hz⟩; exact ⟨z, hz⟩) -+ -+ have hcover : ({z : ℂ | a < z.re} \ ({p} : Set ℂ)) = A ∪ B := by -+ ext z; constructor -+ · intro hz -+ rcases hz with ⟨hzH, hznot⟩ -+ -+ rcases lt_trichotomy z.re p.re with hlt | heq | hgt -+ · -+ exact Or.inl (Or.inr ⟨hzH, hlt⟩) -+ · -+ rcases lt_trichotomy z.im p.im with himlt | himeq | himgt -+ · -+ exact Or.inl (Or.inl ⟨hzH, himlt⟩) -+ · -+ have hz_eq : z = p := by -+ -+ have hzdecomp : (z.re : ℂ) + (z.im : ℝ) * Complex.I = z := by -+ simp -+ have hpdecomp : (p.re : ℂ) + (p.im : ℝ) * Complex.I = p := by -+ simp -+ have : (z.re : ℂ) + (z.im : ℝ) * Complex.I = (p.re : ℂ) + (p.im : ℝ) * Complex.I := by -+ -+ simp [heq, himeq] -+ -+ simpa [hzdecomp, hpdecomp] using this -+ have : z ∈ ({p} : Set ℂ) := by simp [Set.mem_singleton_iff, hz_eq] -+ exact (hznot this).elim -+ · -+ exact Or.inr (Or.inl ⟨hzH, himgt⟩) -+ · -+ exact Or.inr (Or.inr hgt) -+ · intro hz -+ -+ have hzH : a < z.re := by -+ rcases hz with hA | hB -+ · rcases hA with hS1 | hS2 -+ · exact hS1.1 -+ · exact hS2.1 -+ · rcases hB with hS3 | hS4 -+ · exact hS3.1 -+ · exact lt_trans hp hS4 -+ have hzneq : z ≠ p := by -+ rcases hz with hA | hB -+ · rcases hA with hS1 | hS2 -+ · -+ intro h -+ have : z.im = p.im := by simp [h] -+ have : z.im < z.im := by simpa [this] using hS1.2 -+ exact lt_irrefl _ this -+ · -+ intro h -+ have : z.re = p.re := by simp [h] -+ exact (ne_of_lt hS2.2) this -+ · rcases hB with hS3 | hS4 -+ · -+ intro h -+ have : p.im = z.im := by simp [h] -+ have : z.im < z.im := by simpa [this] using hS3.2 -+ exact lt_irrefl _ this -+ · -+ intro h -+ have : p.re = z.re := by simp [h] -+ exact (ne_of_gt hS4) this.symm -+ exact And.intro hzH (by intro hzmem; exact hzneq (by simpa [Set.mem_singleton_iff] using hzmem)) -+ -+ simpa [hcover] using hUnionPC -+ -+lemma inter_compl_singleton_eq_diff' {α : Type*} [DecidableEq α] (A : Set α) (x : α) : -+ A ∩ ({x} : Set α)ᶜ = A \ ({x} : Set α) := by -+ ext z; simp [Set.mem_inter_iff, Set.mem_singleton_iff] -+ -+lemma lem_T_isPreconnected : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsPreconnected T) := by -+ classical -+ -+ let S : Set ℂ := {s : ℂ | s ≠ 1} -+ let T : Set ℂ := {s : ℂ | s ∈ S ∧ (1/10 : ℝ) < s.re} -+ -+ have hTinter : T = S ∩ {s : ℂ | (1/10 : ℝ) < s.re} := by -+ simpa using (T_eq_inter_S_half S T (by rfl) (by rfl)) -+ -+ have hScompl : S = ({(1 : ℂ)} : Set ℂ)ᶜ := by -+ ext z; simp [S] -+ -+ have hTdiff : T = {s : ℂ | (1/10 : ℝ) < s.re} \ (({(1 : ℂ)} : Set ℂ)) := by -+ have : T = {s : ℂ | (1/10 : ℝ) < s.re} ∩ S := by -+ simpa [Set.inter_comm] using hTinter -+ -+ simpa [hScompl, inter_compl_singleton_eq_diff] using this -+ -+ have hp : (1/10 : ℝ) < (1 : ℂ).re := by -+ simpa using (by norm_num : (1/10 : ℝ) < (1 : ℝ)) -+ -+ have hpc : IsPathConnected ({z : ℂ | (1/10 : ℝ) < z.re} \ (({(1 : ℂ)} : Set ℂ))) := -+ isPathConnected_punctured_halfplane_re_gt (a := (1/10 : ℝ)) (p := (1 : ℂ)) (hp := hp) -+ -+ have hpcT : IsPathConnected T := by -+ simpa [hTdiff] using hpc -+ -+ have hconnT : IsConnected T := hpcT.isConnected -+ exact (IsConnected.isPreconnected (s := T) hconnT) -+ -+lemma hasDerivAt_param_cpow_neg_one (u : ℝ) (hu : 0 < u) (z : ℂ) : -+ HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) (-(Real.log u) * (u : ℂ) ^ (-z - 1)) z := by -+ -+ have hcu : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (ne_of_gt hu) -+ -+ have hId : HasDerivAt (fun w : ℂ => w) (1 : ℂ) z := by simpa using! (hasDerivAt_id (x := z)) -+ have hneg : HasDerivAt (fun w : ℂ => -w) (-1 : ℂ) z := by simpa using! hId.neg -+ have hf : HasDerivAt (fun w : ℂ => -w - 1) (-1 : ℂ) z := by -+ -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hneg.add_const (-1 : ℂ) -+ -+ have h := (HasDerivAt.const_cpow (c := (u : ℂ)) (hf := hf) (h0 := Or.inl hcu)) -+ -+ have clog : Complex.log (u : ℂ) = (Real.log u : ℂ) := by -+ simpa using (Complex.ofReal_log (x := u) (hx := le_of_lt hu)).symm -+ simpa [clog, mul_comm, mul_left_comm, mul_assoc] using h -+ -+lemma integrableOn_t_mul_exp_neg (ε : ℝ) (hε : 0 < ε) : IntegrableOn (fun t : ℝ => t * Real.exp (- ε * t)) (Ioi (0 : ℝ)) := by -+ -+ have h := integrableOn_rpow_mul_exp_neg_mul_rpow (p := (1 : ℝ)) (s := (1 : ℝ)) (b := ε) -+ (hs := by norm_num) (hp := by norm_num) (hb := hε) -+ -+ simpa [Real.rpow_one] using h -+ -+lemma aestronglyMeasurable_kernel_param_deriv (z : ℂ) : -+ AEStronglyMeasurable (fun u : ℝ => -((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1))) (volume.restrict (Ioi (1 : ℝ))) := by -+ -+ let μ := volume.restrict (Ioi (1 : ℝ)) -+ -+ have hmeas_logR : Measurable (fun u : ℝ => Real.log u) := Real.measurable_log -+ have hmeas_logC : Measurable (fun u : ℝ => ((Real.log u) : ℂ)) := hmeas_logR.complex_ofReal -+ have hmeas_neg : Measurable (fun u : ℝ => -((Real.log u) : ℂ)) := hmeas_logC.neg -+ have h1 : AEStronglyMeasurable (fun u : ℝ => -((Real.log u) : ℂ)) μ := by -+ simpa [μ] using hmeas_neg.aestronglyMeasurable -+ -+ have h2 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) μ := by -+ simpa [μ] using kernel_aestronglyMeasurable_on_Ioi (s := z) (a := (1 : ℝ)) -+ -+ have hmul : AEStronglyMeasurable -+ (fun u : ℝ => (-((Real.log u) : ℂ)) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1))) -+ μ := (MeasureTheory.AEStronglyMeasurable.mul h1 h2) -+ simpa [μ] using hmul -+ -+lemma kernel_deriv_norm_bound_on_ball (ε : ℝ) (u : ℝ) (hu : 1 < u) (x : ℂ) (hx : ε ≤ x.re) : -+ ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ ≤ Real.log u * u ^ (-1 - ε) := by -+ -+ have hu1 : (1 : ℝ) ≤ u := le_of_lt hu -+ -+ have hinner1 : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ ≤ u ^ (-x.re - 1) := by -+ simpa using (lem_integrandBound u hu1 x) -+ have hexp_le : -x.re - 1 ≤ -1 - ε := by linarith -+ have hmono : u ^ (-x.re - 1) ≤ u ^ (-1 - ε) := -+ Real.rpow_le_rpow_of_exponent_le hu1 hexp_le -+ have hinner : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ ≤ u ^ (-1 - ε) := -+ le_trans hinner1 hmono -+ -+ have hmul : ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ -+ = ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ := by -+ simp -+ have hnorm_nonneg : 0 ≤ ‖-((Real.log u) : ℂ)‖ := by simp -+ have hmul_le : ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ -+ ≤ ‖-((Real.log u) : ℂ)‖ * (u ^ (-1 - ε)) := by -+ exact mul_le_mul_of_nonneg_left hinner hnorm_nonneg -+ -+ have hlognorm_neg : ‖-((Real.log u) : ℂ)‖ = Real.log u := by -+ have hnonneg : 0 ≤ Real.log u := le_of_lt (Real.log_pos hu) -+ simp [norm_neg, Complex.norm_real, abs_of_nonneg hnonneg] -+ -+ calc -+ ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ -+ = ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ := hmul -+ _ ≤ ‖-((Real.log u) : ℂ)‖ * (u ^ (-1 - ε)) := hmul_le -+ _ = (Real.log u) * u ^ (-1 - ε) := by simp [hlognorm_neg, mul_comm] -+ -+lemma exists_radius_ball_two_step_subset_halfspace (s : ℂ) {ε : ℝ} (hε : ε < s.re) : -+ ∃ δ > 0, ∀ x, dist x s < δ → ∀ y, dist y x < δ → ε ≤ y.re := by -+ -+ set δ : ℝ := (s.re - ε) / 2 with hδdef -+ have hpos : 0 < s.re - ε := sub_pos.mpr hε -+ have hδpos : 0 < δ := by simpa [hδdef] using (half_pos hpos) -+ refine ⟨δ, hδpos, ?_⟩ -+ intro x hx y hy -+ -+ have htri : dist y s ≤ dist y x + dist x s := by -+ simpa using (dist_triangle y x s) -+ have hsumlt : dist y x + dist x s < δ + δ := add_lt_add hy hx -+ have hnorm_lt : ‖y - s‖ < δ + δ := by -+ have := lt_of_le_of_lt htri hsumlt -+ simpa [dist_eq_norm] using this -+ have hdeltaSum : δ + δ = s.re - ε := by -+ simp [hδdef, add_halves] -+ have hnorm_lt_re : ‖y - s‖ < s.re - ε := by simpa [hdeltaSum] using hnorm_lt -+ -+ have h_eps_lt : ε < s.re - ‖y - s‖ := by -+ have hsum' : ε + ‖y - s‖ < s.re := by -+ simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using -+ (add_lt_add_right hnorm_lt_re ε) -+ simpa [lt_sub_iff_add_lt] using hsum' -+ -+ have hre_abs : |(y - s).re| ≤ ‖y - s‖ := by -+ simpa using (Complex.abs_re_le_norm (y - s)) -+ have hre_lower : -‖y - s‖ ≤ (y - s).re := by -+ -+ have hpair := (abs_le.mp hre_abs) -+ exact hpair.left -+ have hyge : s.re - ‖y - s‖ ≤ y.re := by -+ have h' : s.re + (-‖y - s‖) ≤ s.re + (y - s).re := add_le_add_right hre_lower s.re -+ have h'' : s.re + (y - s).re = y.re := by -+ simp [sub_eq_add_neg] -+ simpa [sub_eq_add_neg, h''] using h' -+ -+ have hygt : ε < y.re := lt_of_lt_of_le h_eps_lt hyge -+ exact le_of_lt hygt -+ -+lemma integrable_kernel_at_param (s : ℂ) (hs : 0 < s.re) : -+ Integrable ((fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1))) (volume.restrict (Ioi (1 : ℝ))) := by -+ classical -+ -+ set f : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) -+ set ε : ℝ := s.re / 2 -+ set g1 : ℝ → ℝ := fun u => u ^ (-s.re - 1) -+ set g : ℝ → ℝ := fun u => u ^ (-1 - ε) -+ -+ have hfm : AEStronglyMeasurable f (volume.restrict (Ioi (1 : ℝ))) := by -+ simpa [f] using kernel_aestronglyMeasurable_on_Ioi (s := s) (a := (1 : ℝ)) -+ -+ have hε : 0 < ε := by -+ have : 0 < s.re := hs -+ simpa [ε] using (half_pos this) -+ have hεle : ε ≤ s.re := by -+ have hnonneg : 0 ≤ s.re := le_of_lt hs -+ simpa [ε] using (half_le_self hnonneg) -+ -+ have hbound1 : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), ‖f u‖ ≤ g1 u := by -+ simpa [f, g1] using (kernel_ae_bound_on_Ioi (s := s)) -+ -+ have hpow_ae : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), g1 u ≤ g u := by -+ -+ have hAll : ∀ u ∈ Ioi (1 : ℝ), g1 u ≤ g u := by -+ intro u hu -+ have hx : (1 : ℝ) ≤ u := le_of_lt hu -+ have hlexp : (-s.re - 1) ≤ (-1 - ε) := by linarith -+ have := Real.rpow_le_rpow_of_exponent_le hx hlexp -+ simpa [g1, g] using this -+ -+ have hAE : ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → g1 u ≤ g u := -+ MeasureTheory.ae_of_all _ hAll -+ have hiff := -+ (MeasureTheory.ae_restrict_iff' (μ := volume) (s := Ioi (1 : ℝ)) -+ (p := fun u => g1 u ≤ g u) measurableSet_Ioi) -+ exact hiff.mpr hAE -+ -+ have hbound : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), ‖f u‖ ≤ g u := by -+ filter_upwards [hbound1, hpow_ae] with u hu1 hu2 -+ exact le_trans hu1 hu2 -+ -+ have hgint : IntegrableOn g (Ioi (1 : ℝ)) := by -+ have ha_lt : (-1 - ε) < (-1 : ℝ) := by linarith -+ have hc : 0 < (1 : ℝ) := by norm_num -+ simpa [g] using (integrableOn_Ioi_rpow_of_lt (a := (-1 - ε)) (ha := ha_lt) (c := (1 : ℝ)) (hc := hc)) -+ -+ have hint : IntegrableOn f (Ioi (1 : ℝ)) := -+ integrableOn_of_ae_bound (s := Ioi (1 : ℝ)) (f := f) (g := g) -+ (hfm := hfm) (hgint := hgint) (hbound := hbound) -+ simpa [IntegrableOn, f] using hint -+ -+lemma eventually_aestronglyMeasurable_kernel_param (s : ℂ) : -+ ∀ᶠ z in 𝓝 s, AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) (volume.restrict (Ioi (1 : ℝ))) := by -+ refine Filter.Eventually.of_forall ?_ -+ intro z -+ -+ have hmeas_fract : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := by -+ have hmeas_fr : Measurable (Int.fract : ℝ → ℝ) := by -+ simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) -+ exact (Complex.measurable_ofReal.comp hmeas_fr) -+ have hmeas_cpow : Measurable (fun u : ℝ => (u : ℂ) ^ (-z - 1)) := by -+ -+ measurability -+ have hmeas : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) := -+ hmeas_fract.mul hmeas_cpow -+ simpa using hmeas.aestronglyMeasurable -+ -+lemma hasDerivAt_kernel_in_param (u : ℝ) (hu : 1 < u) (z : ℂ) : -+ HasDerivAt (fun w : ℂ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-w - 1)) -+ ( -((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) ) z := by -+ -+ set c0 : ℂ := ((Int.fract u : ℝ) : ℂ) -+ have hu0 : 0 < u := lt_trans zero_lt_one hu -+ have hux0 : (u : ℝ) ≠ 0 := ne_of_gt hu0 -+ have hcz : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hux0 -+ -+ have hfneg : HasDerivAt (fun w : ℂ => -w) (-1) z := (hasDerivAt_id z).neg -+ have hf : HasDerivAt (fun w : ℂ => -w - 1) (-1) z := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hfneg.sub_const (1 : ℂ) -+ -+ have hbase : HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) -+ ((u : ℂ) ^ (-z - 1) * Complex.log (u : ℂ) * (-1)) z := -+ HasDerivAt.const_cpow (c := (u : ℂ)) (hf := hf) (h0 := Or.inl hcz) -+ have hbase' : HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) -+ (-(Complex.log (u : ℂ)) * (u : ℂ) ^ (-z - 1)) z := by -+ -+ simpa [mul_comm, mul_left_comm, mul_assoc] using hbase -+ -+ have hmul : HasDerivAt (fun w : ℂ => c0 * ((u : ℂ) ^ (-w - 1))) -+ (c0 * (-(Complex.log (u : ℂ)) * (u : ℂ) ^ (-z - 1))) z := -+ HasDerivAt.const_mul c0 hbase' -+ -+ have hlog : (Real.log u : ℂ) = Complex.log (u : ℂ) := by -+ simpa using (Complex.ofReal_log (x := u) (hx := le_of_lt hu0)) -+ -+ simpa [c0, hlog, mul_comm, mul_left_comm, mul_assoc] using hmul -+ -+lemma hasDerivAt_integral_param_dominated_Ioi -+ (F F' : ℂ → ℝ → ℂ) (s : ℂ) (δ : ℝ) (hδ : 0 < δ) -+ (hmeas : ∀ᶠ z in 𝓝 s, AEStronglyMeasurable (F z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) -+ (hFint : Integrable (F s) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) -+ (hF'meas : AEStronglyMeasurable (F' s) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) -+ (bound : ℝ → ℝ) -+ (hbound_int : Integrable bound (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) -+ (hbound : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), ∀ z ∈ Metric.ball s δ, ‖F' z u‖ ≤ bound u) -+ (hderiv : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), ∀ z ∈ Metric.ball s δ, HasDerivAt (fun w => F w u) (F' z u) z) -+ : -+ HasDerivAt (fun z => ∫ u in Ioi (1 : ℝ), F z u) (∫ u in Ioi (1 : ℝ), F' s u) s := by -+ -+ have h := -+ hasDerivAt_integral_of_dominated_loc_of_deriv_le -+ (μ := MeasureTheory.volume.restrict (Ioi (1 : ℝ))) -+ (F := F) (F' := F') (x₀ := s) -+ (s := Metric.ball s δ) (hs := Metric.ball_mem_nhds s hδ) -+ (hF_meas := hmeas) (hF_int := hFint) -+ (hF'_meas := hF'meas) -+ (h_bound := hbound) (bound_integrable := hbound_int) -+ (h_diff := hderiv) -+ rcases h with ⟨_hint, hDeriv⟩ -+ -+ simpa using hDeriv -+ -+lemma dist_lt_of_mem_two_balls {x z s : ℂ} {r : ℝ} -+ (hxz : dist x z < r) (hzs : dist z s < r) : dist x s < r + r := by -+ have htri : dist x s ≤ dist x z + dist z s := dist_triangle x z s -+ have hadd : dist x z + dist z s < r + r := add_lt_add hxz hzs -+ exact lt_of_le_of_lt htri hadd -+ -+lemma mem_ball_of_mem_two_half_balls {x z s : ℂ} {δ : ℝ} -+ (hx : x ∈ Metric.ball z (δ/2)) (hz : z ∈ Metric.ball s (δ/2)) : -+ x ∈ Metric.ball s δ := by -+ have hxz : dist x z < δ / 2 := by -+ simpa [Metric.mem_ball] using hx -+ have hzs : dist z s < δ / 2 := by -+ simpa [Metric.mem_ball] using hz -+ have htri : dist x s ≤ dist x z + dist z s := dist_triangle x z s -+ have hadd : dist x z + dist z s < δ / 2 + δ / 2 := add_lt_add hxz hzs -+ have hlt : dist x s < δ := by -+ exact lt_of_le_of_lt htri (by simpa [add_halves] using hadd) -+ simpa [Metric.mem_ball] using hlt -+ -+lemma dist_lt_delta_of_half {x s : ℂ} {δ : ℝ} (hδpos : 0 < δ) -+ (hx : dist x s < δ/2) : dist x s < δ := by -+ have hhalf : δ / 2 < δ := by -+ simpa using (half_lt_self hδpos) -+ exact lt_trans hx hhalf -+ -+lemma re_lower_bound_from_two_step {s x : ℂ} {ε δ : ℝ} -+ (h : ∀ z, dist z s < δ → ∀ y, dist y z < δ → ε ≤ y.re) -+ (hδpos : 0 < δ) (hx : dist x s < δ) : ε ≤ x.re := by -+ have hxx : dist x x < δ := by simpa [dist_self] using hδpos -+ have hxstep := h x hx -+ have hxres := hxstep x hxx -+ simpa using hxres -+ -+lemma analyticAt_of_eventually_differentiableAt {f : ℂ → ℂ} {s : ℂ} -+ (h : ∀ᶠ z in 𝓝 s, DifferentiableAt ℂ f z) : AnalyticAt ℂ f s := by -+ simpa using -+ (Complex.analyticAt_iff_eventually_differentiableAt (f := f) (c := s)).2 h -+ -+lemma kernel_integrable_param_of_re_pos (z : ℂ) (hz : 0 < z.re) : -+ Integrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) -+ (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by -+ simpa using (integrable_kernel_at_param (s := z) (hs := hz)) -+ -+lemma integrable_kernel_at_param' (z : ℂ) (hz : 0 < z.re) : -+ Integrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) -+ (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by simpa using integrable_kernel_at_param (s := z) hz -+ -+lemma lem_integralAnalytic (s : ℂ) (hs : 1/10 < s.re) : -+ AnalyticAt ℂ (fun z : ℂ => ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by -+ classical -+ -+ have hspos : 0 < s.re := lt_trans (by norm_num : (0 : ℝ) < 1/10) hs -+ set ε : ℝ := s.re / 2 with hεdef -+ have hεpos : 0 < ε := by simpa [ε] using (half_pos hspos) -+ have hεlt : ε < s.re := by -+ have : s.re / 2 < s.re := by simpa [ε] using (half_lt_self hspos) -+ simpa [ε] using this -+ -+ rcases exists_radius_ball_two_step_subset_halfspace (s := s) (ε := ε) hεlt with ⟨δ, hδpos, hδprop⟩ -+ -+ let F : ℂ → ℝ → ℂ := fun z u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1) -+ let F' : ℂ → ℝ → ℂ := fun z u => -((Real.log u) : ℂ) * F z u -+ -+ let bound : ℝ → ℝ := fun u => (2/ε) * u ^ (-1 - (ε/2)) -+ -+ have hbound_int : Integrable bound (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by -+ have hlt : (-1 - (ε/2)) < (-1 : ℝ) := by -+ have : 0 < ε/2 := by simpa using (half_pos hεpos) -+ linarith -+ have hpos1 : 0 < (1 : ℝ) := by norm_num -+ have hpow_int : IntegrableOn (fun u : ℝ => u ^ (-1 - (ε/2))) (Ioi (1 : ℝ)) := by -+ simpa using (integrableOn_Ioi_rpow_of_lt (a := (-1 - (ε/2))) hlt (c := (1 : ℝ)) hpos1) -+ have hconst : IntegrableOn (fun u : ℝ => (2/ε) * u ^ (-1 - (ε/2))) (Ioi (1 : ℝ)) := -+ hpow_int.const_mul (2/ε) -+ simpa [IntegrableOn, bound] using hconst -+ -+ have hDiff_eventually : ∀ᶠ z in 𝓝 s, -+ DifferentiableAt ℂ (fun z0 => ∫ u in Ioi (1 : ℝ), F z0 u) z := by -+ -+ have hball : Metric.ball s (δ/2) ∈ 𝓝 s := Metric.ball_mem_nhds _ (by simpa using (half_pos hδpos)) -+ refine Filter.eventually_of_mem hball ?_ -+ intro z hz -+ -+ have hz_lt_δ : dist z s < δ := lt_trans (by simpa [Metric.mem_ball] using hz) (by simpa using (half_lt_self hδpos)) -+ have hRe_inner : ∀ y, y ∈ Metric.ball z (δ/2) → ε ≤ y.re := by -+ intro y hy -+ have hy_lt_δ : dist y z < δ := lt_trans (by simpa [Metric.mem_ball] using hy) (by simpa using (half_lt_self hδpos)) -+ exact hδprop z hz_lt_δ y hy_lt_δ -+ -+ have hmeas_z : ∀ᶠ w in 𝓝 z, -+ AEStronglyMeasurable (F w) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := -+ eventually_aestronglyMeasurable_kernel_param (s := z) -+ -+ have hzRe_ge : ε ≤ z.re := by -+ -+ have hss : dist s s < δ := by simpa [dist_self] using hδpos -+ have hz_lt_δ' : dist z s < δ := hz_lt_δ -+ exact hδprop s hss z hz_lt_δ' -+ have hzpos : 0 < z.re := lt_of_lt_of_le hεpos hzRe_ge -+ have hFint_z : Integrable (F z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by -+ simpa [F] using integrable_kernel_at_param (s := z) hzpos -+ -+ have hF'meas_z : AEStronglyMeasurable (F' z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by -+ simpa [F, F'] using aestronglyMeasurable_kernel_param_deriv (z := z) -+ -+ have hbound_z : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), -+ ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u := by -+ -+ have hAll : ∀ u ∈ Ioi (1 : ℝ), ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u := by -+ intro u hu w hw -+ have hu1 : 1 < u := hu -+ have hu0 : 0 < u := lt_trans zero_lt_one hu1 -+ -+ have hwRe : ε ≤ w.re := hRe_inner w hw -+ have hker : ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-w - 1))‖ -+ ≤ Real.log u * u ^ (-1 - ε) := -+ kernel_deriv_norm_bound_on_ball (ε := ε) (u := u) (hu := hu1) (x := w) (hx := hwRe) -+ have hF'le : ‖F' w u‖ ≤ Real.log u * u ^ (-1 - ε) := by -+ simpa [F, F', mul_comm, mul_left_comm, mul_assoc] using hker -+ -+ have hx' := Real.add_one_le_exp ((ε/2) * Real.log u) -+ have hx : 1 + (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) := by -+ simpa [add_comm] using hx' -+ have hsub : (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) - 1 := by -+ have := sub_le_sub_right hx 1 -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ have hle_exp : (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) := by -+ have hnonneg : 0 ≤ (1 : ℝ) := by norm_num -+ have : Real.exp ((ε/2) * Real.log u) - 1 ≤ Real.exp ((ε/2) * Real.log u) := -+ sub_le_self _ hnonneg -+ exact le_trans hsub this -+ have hεne : (ε : ℝ) ≠ 0 := ne_of_gt hεpos -+ have hpos_inv : 0 < ε⁻¹ := inv_pos.mpr hεpos -+ have hpos_coeff : 0 < (2/ε) := by -+ have : 0 < (2 : ℝ) := by norm_num -+ simpa [one_div, div_eq_mul_inv] using (mul_pos this hpos_inv) -+ have hlog_bound : Real.log u ≤ (2/ε) * Real.exp ((ε/2) * Real.log u) := by -+ have hmul := mul_le_mul_of_nonneg_left hle_exp (le_of_lt hpos_coeff) -+ -+ have hleft : (2/ε) * ((ε/2) * Real.log u) = Real.log u := by -+ have h2ne : (2 : ℝ) ≠ 0 := by norm_num -+ calc -+ (2/ε) * ((ε/2) * Real.log u) -+ = ((2/ε) * (ε/2)) * Real.log u := by ring -+ _ = ((2 * ε⁻¹) * (ε * (2)⁻¹)) * Real.log u := by simp [div_eq_mul_inv] -+ _ = ((2 * (2)⁻¹) * (ε⁻¹ * ε)) * Real.log u := by ring -+ _ = (1 * 1) * Real.log u := by simp [hεne, h2ne] -+ _ = Real.log u := by simp -+ simpa [hleft] -+ using hmul -+ -+ have hexp_rpow : Real.exp ((ε/2) * Real.log u) = u ^ (ε/2) := by -+ have : 0 < u := hu0 -+ simp [Real.rpow_def_of_pos this, mul_comm] -+ -+ have hmul : Real.log u * u ^ (-1 - ε) -+ ≤ ((2/ε) * u ^ (ε/2)) * u ^ (-1 - ε) := by -+ have hqpos : 0 < u ^ (-1 - ε) := Real.rpow_pos_of_pos hu0 _ -+ have hq : 0 ≤ u ^ (-1 - ε) := le_of_lt hqpos -+ exact mul_le_mul_of_nonneg_right (by simpa [hexp_rpow] using hlog_bound) hq -+ -+ have hpow_mul : u ^ (ε/2) * u ^ (-1 - ε) = u ^ (-1 - (ε/2)) := by -+ have hu0' : 0 < u := hu0 -+ have h1 : Real.exp ((ε/2) * Real.log u) * Real.exp ((-1 - ε) * Real.log u) -+ = Real.exp (((ε/2) * Real.log u) + ((-1 - ε) * Real.log u)) := by -+ simpa using (Real.exp_add ((ε/2) * Real.log u) ((-1 - ε) * Real.log u)).symm -+ calc -+ u ^ (ε/2) * u ^ (-1 - ε) -+ = Real.exp ((ε/2) * Real.log u) * Real.exp ((-1 - ε) * Real.log u) := by -+ simp [Real.rpow_def_of_pos hu0', mul_comm] -+ _ = Real.exp (((ε/2) * Real.log u) + ((-1 - ε) * Real.log u)) := by -+ simpa using h1 -+ _ = Real.exp (((ε/2) + (-1 - ε)) * Real.log u) := by -+ ring_nf -+ _ = u ^ (-1 - (ε/2)) := by -+ have : (ε/2) + (-1 - ε) = -1 - (ε/2) := by ring -+ simp [this, Real.rpow_def_of_pos hu0', mul_comm] -+ have hmul' : ((2/ε) * u ^ (ε/2)) * u ^ (-1 - ε) = (2/ε) * u ^ (-1 - (ε/2)) := by -+ simp [mul_assoc, hpow_mul] -+ -+ have : ‖F' w u‖ ≤ bound u := by -+ refine le_trans hF'le ?_ -+ simpa [bound, hmul'] using hmul -+ simpa [F, F', bound] -+ using this -+ -+ have hiff := -+ (MeasureTheory.ae_restrict_iff' (μ := MeasureTheory.volume) (s := Ioi (1 : ℝ)) -+ (p := fun u : ℝ => ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u) measurableSet_Ioi) -+ exact hiff.mpr (MeasureTheory.ae_of_all _ hAll) -+ -+ have hderiv_z : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), -+ ∀ w ∈ Metric.ball z (δ/2), HasDerivAt (fun w0 => F w0 u) (F' w u) w := by -+ -+ have hAll : ∀ u ∈ Ioi (1 : ℝ), ∀ w ∈ Metric.ball z (δ/2), -+ HasDerivAt (fun w0 => F w0 u) (F' w u) w := by -+ intro u hu w hw -+ simpa [F, F', mul_comm, mul_left_comm, mul_assoc] -+ using hasDerivAt_kernel_in_param (u := u) (hu := hu) (z := w) -+ -+ have hiff := -+ (MeasureTheory.ae_restrict_iff' (μ := MeasureTheory.volume) (s := Ioi (1 : ℝ)) -+ (p := fun u : ℝ => ∀ w ∈ Metric.ball z (δ/2), -+ HasDerivAt (fun w0 => F w0 u) (F' w u) w) measurableSet_Ioi) -+ exact hiff.mpr (MeasureTheory.ae_of_all _ hAll) -+ -+ have hD := hasDerivAt_integral_param_dominated_Ioi -+ (F := F) (F' := F') (s := z) (δ := δ/2) (hδ := by simpa using (half_pos hδpos)) -+ (hmeas := hmeas_z) (hFint := hFint_z) (hF'meas := hF'meas_z) -+ (bound := bound) (hbound_int := hbound_int) (hbound := hbound_z) (hderiv := hderiv_z) -+ -+ simpa using hD.differentiableAt -+ -+ exact analyticAt_of_eventually_differentiableAt hDiff_eventually -+ -+lemma lem_zetaFormulaAC : -+ (let S := {s : ℂ | s ≠ 1} -+ let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} -+ let F := fun z : ℂ => -+ z / (z - 1) -+ - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) -+ AnalyticOn ℂ F T) := by -+ -+ simp only [AnalyticOn] -+ intro s hs -+ simp at hs -+ obtain ⟨hs_ne_1, hs_re⟩ := hs -+ -+ apply AnalyticAt.analyticWithinAt -+ -+ have h1 : AnalyticAt ℂ (fun z => z / (z - 1)) s := by -+ apply AnalyticAt.div -+ · exact analyticAt_id -+ · exact analyticAt_id.sub analyticAt_const -+ · -+ rw [sub_ne_zero] -+ exact hs_ne_1 -+ -+ have hs_re_eq : (10 : ℝ)⁻¹ = (1 : ℝ) / 10 := by norm_num -+ have hs_re_correct : (1 : ℝ) / 10 < s.re := by rwa [← hs_re_eq] -+ -+ have hconv := lem_integralConvergence (1/10) (by norm_num) s (le_of_lt hs_re_correct) -+ -+ obtain ⟨I, hI_tendsto, hI_bound⟩ := hconv -+ -+ have hI_bound_10 : ‖I‖ ≤ 10 := by -+ convert hI_bound -+ norm_num -+ -+ have h_integral : AnalyticAt ℂ (fun z => ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by -+ apply lem_integralAnalytic s hs_re_correct -+ -+ have h2 : AnalyticAt ℂ (fun z => z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by -+ exact analyticAt_id.mul h_integral -+ -+ exact h1.sub h2 -+ -+lemma lem_div_eq_one_plus_one_div (z : ℂ) (hz : z ≠ 1) : z / (z - 1) = 1 + 1 / (z - 1) := by -+ have h : z - 1 ≠ 0 := by -+ intro h0 -+ have : z = 1 := by -+ rw [sub_eq_zero] at h0 -+ exact h0 -+ exact hz this -+ calc z / (z - 1) -+ = ((z - 1) + 1) / (z - 1) := by ring_nf -+ _ = (z - 1) / (z - 1) + 1 / (z - 1) := by rw [add_div] -+ _ = 1 + 1 / (z - 1) := by simp [div_self h] -+ -+lemma lem_zetaAnalyticContinuation : -+ (let S := {s : ℂ | s ≠ 1} -+ let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} -+ ∀ s ∈ T, -+ riemannZeta s -+ = 1 + 1 / (s - 1) -+ - s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) := by -+ -+ simp only [Set.mem_ofPred_eq] -+ intro s h_s -+ -+ have hs_ne_1 : s ≠ 1 := h_s.1 -+ have hs_re : 1/10 < s.re := h_s.2 -+ -+ let F := fun z : ℂ => 1 + 1 / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) -+ -+ let S := {s : ℂ | s ≠ 1} -+ let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} -+ -+ have hs_in_T : s ∈ T := by -+ simp only [T, S, Set.mem_ofPred_eq] -+ exact ⟨hs_ne_1, hs_re⟩ -+ -+ have h_T_open := lem_T_isOpen -+ have h_T_preconnected := lem_T_isPreconnected -+ -+ have h_zeta_analytic_S := lem_zetaanalS -+ have h_zeta_analytic_T : AnalyticOn ℂ riemannZeta T := by -+ apply AnalyticOn.mono h_zeta_analytic_S -+ intro x hx; exact hx.1 -+ have h_zeta_analyticOnNhd_T : AnalyticOnNhd ℂ riemannZeta T := by -+ rwa [← h_T_open.analyticOn_iff_analyticOnNhd] -+ -+ have h_F_orig_analytic := lem_zetaFormulaAC -+ -+ have h_F_eq : EqOn F (fun z => z / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) T := by -+ intro z hz -+ simp only [F] -+ rw [lem_div_eq_one_plus_one_div z hz.1] -+ -+ have h_F_analytic_T : AnalyticOn ℂ F T := -+ AnalyticOn.congr h_F_orig_analytic h_F_eq -+ have h_F_analyticOnNhd_T : AnalyticOnNhd ℂ F T := by -+ rwa [← h_T_open.analyticOn_iff_analyticOnNhd] -+ -+ have ⟨s₀, hs₀_T, hs₀_re⟩ : ∃ s₀, s₀ ∈ T ∧ 1 < s₀.re := by -+ use 2 -+ constructor -+ · simp only [T, S, Set.mem_ofPred_eq] -+ norm_num -+ · norm_num -+ -+ have h_eventually_eq : riemannZeta =ᶠ[𝓝 s₀] F := by -+ -+ have h_re_cont : ContinuousAt Complex.re s₀ := Complex.continuous_re.continuousAt -+ have h_nhd_re : ∀ᶠ s in 𝓝 s₀, 1 < s.re := -+ ContinuousAt.eventually_lt continuousAt_const h_re_cont hs₀_re -+ -+ have h_nhd_T : ∀ᶠ s in 𝓝 s₀, s ∈ T := h_T_open.mem_nhds hs₀_T -+ -+ filter_upwards [h_nhd_re, h_nhd_T] with w hw_re hw_T -+ -+ have h_formula := lem_zetaFormula w hw_re -+ simp only [F] -+ exact h_formula -+ -+ have h_eqOn_global := AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq -+ h_zeta_analyticOnNhd_T h_F_analyticOnNhd_T h_T_preconnected hs₀_T h_eventually_eq -+ -+ exact h_eqOn_global hs_in_T -+ -+lemma lem_zetaBound1 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ := by -+ classical -+ set S : Set ℂ := {z : ℂ | z ≠ 1} -+ set T : Set ℂ := {z : ℂ | z ∈ S ∧ 1/10 < z.re} -+ set Iint : ℂ := ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) -+ have hT : s ∈ T := by -+ have hsS : s ∈ S := by simpa [S, Set.mem_ofPred_eq] using hs_ne -+ simpa [T, Set.mem_ofPred_eq] using And.intro hsS hs_re -+ have hAC : ∀ z ∈ T, riemannZeta z = 1 + 1 / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) := by -+ simpa [S, T] using lem_zetaAnalyticContinuation -+ have hzeta : riemannZeta s = 1 + 1 / (s - 1) - s * Iint := by -+ simpa [Iint] using hAC s hT -+ have h1 : ‖riemannZeta s‖ ≤ ‖1 + 1 / (s - 1)‖ + ‖-s * Iint‖ := by -+ simpa [hzeta, sub_eq_add_neg] using (lem_triangleInequality_add (1 + 1 / (s - 1)) (-s * Iint)) -+ have hA : ‖1 + 1 / (s - 1)‖ ≤ ‖(1 : ℂ)‖ + ‖1 / (s - 1)‖ := by -+ simpa using (lem_triangleInequality_add (1 : ℂ) (1 / (s - 1))) -+ have hmul : ‖-s * Iint‖ = ‖-s‖ * ‖Iint‖ := by -+ simp -+ have hB : ‖-s * Iint‖ ≤ ‖s‖ * ‖Iint‖ := by -+ have : ‖-s * Iint‖ = ‖s‖ * ‖Iint‖ := by simp -+ exact this.le -+ have h2 : ‖riemannZeta s‖ ≤ (‖(1 : ℂ)‖ + ‖1 / (s - 1)‖) + (‖s‖ * ‖Iint‖) := -+ le_trans h1 (add_le_add hA hB) -+ have h1norm : ‖(1 : ℂ)‖ = 1 := by simp -+ simpa [Iint, h1norm, add_comm, add_left_comm, add_assoc] using h2 -+ -+lemma lem_integralBoundValue (s : ℂ) (hs : 0 < s.re) : ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) = 1 / s.re := by -+ have ha : (-s.re - 1) < -1 := by linarith -+ have hc : 0 < (1 : ℝ) := by exact zero_lt_one -+ have h := integral_Ioi_rpow_of_lt (a := (-s.re - 1)) ha (c := (1 : ℝ)) hc -+ have h' : ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) = - (1 : ℝ) ^ (-s.re) / (-s.re) := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h -+ calc -+ ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) -+ = - (1 : ℝ) ^ (-s.re) / (-s.re) := h' -+ _ = - (1 : ℝ) / (-s.re) := by simp [Real.one_rpow] -+ _ = 1 / s.re := by simp -+ -+lemma lem_zetaBound2 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ / s.re := by -+ -+ set f : ℝ → ℂ := fun u => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) with hfdef -+ set g : ℝ → ℝ := fun u => u ^ (-s.re - 1) with hgdef -+ -+ have hζ : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ := by -+ simpa [hfdef] using lem_zetaBound1 s hs_re hs_ne -+ -+ let μ : Measure ℝ := (volume : Measure ℝ).restrict (Ioi (1 : ℝ)) -+ -+ have h_ae_bound : ∀ᵐ u ∂μ, ‖f u‖ ≤ g u := by -+ have hforall : ∀ u ∈ Ioi (1 : ℝ), ‖f u‖ ≤ g u := by -+ intro u hu -+ have := lem_integrandBound u (le_of_lt hu) s -+ simpa [hfdef, hgdef] using this -+ have hmeas : MeasurableSet (Ioi (1 : ℝ)) := measurableSet_Ioi -+ simpa [μ] using -+ (MeasureTheory.ae_restrict_of_forall_mem (μ := volume) (s := Ioi (1 : ℝ)) hmeas hforall) -+ -+ have hg_intOn : IntegrableOn g (Ioi (1 : ℝ)) := by -+ classical -+ by_contra hnot -+ have hnot' : ¬ Integrable g μ := by simpa [μ, IntegrableOn] using hnot -+ have hint0 : (∫ u, g u ∂μ) = 0 := by -+ simpa using (integral_undef (μ := μ) (f := g) hnot') -+ have hval : ∫ u in Ioi (1 : ℝ), g u = 1 / s.re := by -+ simpa [hgdef] using lem_integralBoundValue s (by linarith [hs_re]) -+ have hne : (1 / s.re) ≠ 0 := by exact one_div_ne_zero (ne_of_gt (by linarith [hs_re])) -+ have : (∫ u in Ioi (1 : ℝ), g u) = 0 := by simpa [μ] using hint0 -+ exact hne (by simpa [hval] using this) -+ have hg_int : Integrable g μ := by simpa [μ, IntegrableOn] using hg_intOn -+ -+ have h_int_bound : ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ ∫ u in Ioi (1 : ℝ), g u := by -+ have := -+ (MeasureTheory.norm_integral_le_of_norm_le (μ := μ) (f := f) (g := g) hg_int h_ae_bound) -+ simpa [μ] using this -+ -+ have h_g_val : ∫ u in Ioi (1 : ℝ), g u = 1 / s.re := by -+ simpa [hgdef] using lem_integralBoundValue s (by linarith [hs_re]) -+ have h_int_bound_conc : ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ 1 / s.re := by -+ simpa [h_g_val] using h_int_bound -+ -+ have hmul : ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ ‖s‖ * (1 / s.re) := by -+ exact mul_le_mul_of_nonneg_left h_int_bound_conc (by exact norm_nonneg s) -+ -+ have hsum0 : (1 + ‖1 / (s - 1)‖) + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ -+ ≤ (1 + ‖1 / (s - 1)‖) + ‖s‖ * (1 / s.re) := by -+ exact add_le_add_right hmul (1 + ‖1 / (s - 1)‖) -+ have hsum : 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ -+ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * (1 / s.re) := by -+ simpa [add_assoc] using hsum0 -+ -+ have hfinal1 : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * (1 / s.re) := -+ le_trans hζ hsum -+ simpa [div_eq_mul_inv] using hfinal1 -+ -+lemma lem_sOverSminus1Bound (s : ℂ) (_hs : s ≠ 1) : ‖(1 / (s - 1))‖ = 1 / ‖s - 1‖ := by simp [one_div] -+ -+lemma lem_zetaBound3 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := by -+ simpa [lem_sOverSminus1Bound s hs_ne] using lem_zetaBound2 s hs_re hs_ne -+ -+lemma helper_normsq (z : ℂ) : ‖z‖ ^ 2 = z.re ^ 2 + z.im ^ 2 := by -+ simpa [Complex.normSq, pow_two] using (Complex.normSq_eq_norm_sq z).symm -+ -+lemma helper_three_abs_sq (t : ℝ) : (3 : ℝ) ^ 2 + t ^ 2 ≤ (3 + |t|) ^ 2 := by -+ have hnonneg : 0 ≤ (6 : ℝ) * |t| := by -+ have h6 : (0 : ℝ) ≤ 6 := by norm_num -+ exact mul_nonneg h6 (abs_nonneg t) -+ have hmul : |t| * |t| = t * t := by -+ simp -+ calc -+ (3 : ℝ) ^ 2 + t ^ 2 = (3 : ℝ) ^ 2 + t * t := by simp [pow_two] -+ _ = (3 : ℝ) ^ 2 + |t| * |t| := by simp [hmul] -+ _ ≤ (3 : ℝ) ^ 2 + |t| * |t| + (6 : ℝ) * |t| := by exact le_add_of_nonneg_right hnonneg -+ _ = (3 + |t|) ^ 2 := by ring -+ -+lemma lem_sBound (s : ℂ) (hs : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) : ‖s‖ < (3 : ℝ) + |s.im| := by -+ have hnegthree_lt_re : (- (3 : ℝ)) < s.re := by -+ have hlt : (- (3 : ℝ)) < (1 / 2 : ℝ) := by norm_num -+ exact lt_of_lt_of_le hlt hs.1 -+ have hlt3 : s.re < (3 : ℝ) := hs.2 -+ have h_re_sq_lt : s.re ^ 2 < (3 : ℝ) ^ 2 := by -+ simpa using (sq_lt_sq' hnegthree_lt_re hlt3) -+ have hsumlt : s.re ^ 2 + s.im ^ 2 < (3 : ℝ) ^ 2 + s.im ^ 2 := by -+ exact add_lt_add_left h_re_sq_lt _ -+ have hsq : ‖s‖ ^ 2 < (3 + |s.im|) ^ 2 := by -+ have h := lt_of_lt_of_le hsumlt (helper_three_abs_sq s.im) -+ simpa [helper_normsq s] using h -+ have hnormnn : 0 ≤ ‖s‖ := norm_nonneg _ -+ have hpos : 0 ≤ (3 : ℝ) + |s.im| := add_nonneg (by norm_num) (abs_nonneg _) -+ exact (sq_lt_sq₀ hnormnn hpos).1 hsq -+ -+lemma lem_invReSbound (s : ℂ) (hs : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) : -+ 1 / s.re ≤ (2 : ℝ) := by -+ have h_pos : (0 : ℝ) < s.re := by -+ linarith [hs.1] -+ have h_half_pos : (0 : ℝ) < (1/2 : ℝ) := by norm_num -+ have h_recip : 1 / s.re ≤ 1 / (1/2 : ℝ) := one_div_le_one_div_of_le h_half_pos hs.1 -+ have h_simplify : 1 / (1/2 : ℝ) = (2 : ℝ) := by norm_num -+ rw [h_simplify] at h_recip -+ exact h_recip -+ -+lemma lem_invSminus1bound (s : ℂ) (_hs_re : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) (hs_im : (1 : ℝ) ≤ |s.im|) : (1 : ℝ) ≤ ‖s - 1‖ := by -+ have h2 : |s.im| ≤ ‖s - 1‖ := by -+ have : (s - (1 : ℂ)).im = s.im := by -+ simp [Complex.sub_im, Complex.one_im] -+ simpa [this] using Complex.abs_im_le_norm (s - 1) -+ exact le_trans hs_im h2 -+ -+lemma reciprocal_le_one_of_one_le {x : ℝ} (hx_pos : 0 < x) (hx_ge : 1 ≤ x) : 1 / x ≤ 1 := by -+ -+ have h_div_pos : 0 < 1 / x := one_div_pos.mpr hx_pos -+ -+ have h1 : (1 / x) * 1 ≤ (1 / x) * x := by -+ exact mul_le_mul_of_nonneg_left hx_ge (le_of_lt h_div_pos) -+ -+ rw [mul_one] at h1 -+ rw [one_div_mul_cancel (ne_of_gt hx_pos)] at h1 -+ exact h1 -+ -+lemma div_le_mul_of_one_div_le {a c d : ℝ} (ha : 0 ≤ a) (_hc : 0 < c) (h : 1 / c ≤ d) : a / c ≤ a * d := by -+ -+ rw [div_eq_mul_one_div] -+ -+ exact mul_le_mul_of_nonneg_left h ha -+ -+lemma lem_finalBoundCombination (s : ℂ) (hs_re : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) (hs_im : (1 : ℝ) ≤ |s.im|) : ‖riemannZeta s‖ < 1 + 1 + ((3 : ℝ) + |s.im|) * 2 := by -+ -+ have hs_ne : s ≠ 1 := by -+ intro h -+ rw [h] at hs_im -+ simp at hs_im -+ linarith -+ -+ have hs_re_pos : 0 < s.re := by linarith [hs_re.1] -+ -+ have h1 : ‖riemannZeta s‖ ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := lem_zetaBound3 s (by linarith [hs_re_pos]) hs_ne -+ -+ have h2 : (1 : ℝ) ≤ ‖s - 1‖ := lem_invSminus1bound s hs_re hs_im -+ have h3 : 1 / ‖s - 1‖ ≤ 1 := reciprocal_le_one_of_one_le (by linarith [h2]) h2 -+ -+ have h4 : ‖s‖ < (3 : ℝ) + |s.im| := lem_sBound s hs_re -+ -+ have h5 : 1 / s.re ≤ (2 : ℝ) := lem_invReSbound s hs_re -+ -+ calc ‖riemannZeta s‖ -+ ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := h1 -+ _ ≤ 1 + 1 + ‖s‖ / s.re := by linarith [h3] -+ _ ≤ 1 + 1 + ‖s‖ * 2 := by -+ have s_nonneg : 0 ≤ ‖s‖ := norm_nonneg _ -+ exact add_le_add_right (div_le_mul_of_one_div_le s_nonneg hs_re_pos h5) _ -+ _ < 1 + 1 + ((3 : ℝ) + |s.im|) * 2 := by linarith [h4] -+ -+lemma lem_finalAlgebra (t : ℝ) : 1 + 1 + ((3 : ℝ) + |t|) * 2 = (8 : ℝ) + 2 * |t| := by ring -+ -+lemma lem_zetaUppBd (z : ℂ) (hz_re : z.re ∈ Ico (1/2 : ℝ) (3 : ℝ)) (hz_im : (1 : ℝ) ≤ |z.im|) : ‖riemannZeta z‖ < (8 : ℝ) + 2 * |z.im| := by -+ have hz_re' : (1/2 : ℝ) ≤ z.re ∧ z.re < (3 : ℝ) := by -+ simpa [Ico] using hz_re -+ have h := lem_finalBoundCombination z hz_re' hz_im -+ simpa [lem_finalAlgebra] using h -+ -+lemma lem_zfroms_calc (s : ℂ) (t : ℝ) : -+ (let z := s + (3/2 : ℝ) + I * t -+ z.re = s.re + (3/2 : ℝ) ∧ z.im = s.im + t) := by -+ constructor -+ · -+ simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im] -+ -+ have h1 : I.re = 0 := Complex.I_re -+ have h2 : I.im * 0 = 0 := mul_zero _ -+ rw [h1, h2] -+ simp -+ · -+ simp only [Complex.add_im, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im] -+ -+ have h1 : I.re * 0 = 0 := mul_zero _ -+ have h2 : I.im = 1 := Complex.I_im -+ rw [h1, h2] -+ simp -+ -+lemma lem_zfroms_conditions (s : ℂ) (t : ℝ) -+ (hs : ‖s‖ ≤ (1 : ℝ)) (ht : (2 : ℝ) < |t|) : -+ (let z := s + (3/2 : ℝ) + I * t -+ z.re ∈ Ico (1/2 : ℝ) (3 : ℝ) ∧ (1 : ℝ) ≤ |z.im|) := by -+ -+ have h_calc := lem_zfroms_calc s t -+ simp only [h_calc.1, h_calc.2] -+ constructor -+ -+ · -+ -+ have hs_re_bound : |s.re| ≤ 1 := -+ (Complex.abs_re_le_norm s).trans hs -+ rw [abs_le] at hs_re_bound -+ -+ rw [Set.mem_Ico] -+ constructor -+ · -+ linarith [hs_re_bound.1] -+ · -+ linarith [hs_re_bound.2] -+ -+ · -+ have hs_im_bound : |s.im| ≤ 1 := -+ (Complex.abs_im_le_norm s).trans hs -+ rw [abs_le] at hs_im_bound -+ -+ by_cases h : 0 ≤ t -+ · -+ have ht_pos : t > 2 := by -+ rwa [abs_of_nonneg h] at ht -+ -+ have lower_bound : s.im + t ≥ 1 := by -+ linarith [hs_im_bound.1, ht_pos] -+ have nonneg : 0 ≤ s.im + t := by linarith -+ rw [abs_of_nonneg nonneg] -+ linarith [lower_bound] -+ · -+ push Not at h -+ have ht_neg : t < -2 := by -+ rw [abs_of_neg h] at ht -+ linarith [ht] -+ -+ have upper_bound : s.im + t ≤ -1 := by -+ linarith [hs_im_bound.2, ht_neg] -+ have neg : s.im + t < 0 := by linarith -+ rw [abs_of_neg neg] -+ linarith [upper_bound] -+ -+lemma lem_abs_im_bound (s : ℂ) (t : ℝ) (hs : ‖s‖ ≤ 1) : |s.im + t| ≤ 1 + |t| := by -+ have h1 : |s.im| ≤ ‖s‖ := Complex.abs_im_le_norm s -+ have h2 : |s.im| ≤ 1 := le_trans h1 hs -+ have h3 : |s.im + t| ≤ |s.im| + |t| := abs_add_le s.im t -+ linarith -+ -+lemma lem_zetaUppBound : -+ ∀ t : ℝ, ∀ s : ℂ, ‖s‖ ≤ (1 : ℝ) → (2 : ℝ) < |t| → -+ ‖riemannZeta (s + (3/2 : ℝ) + I * t)‖ < (10 : ℝ) + 2 * |t| := by -+ intro t s hs ht -+ set z := s + (3/2 : ℝ) + I * t with hz_def -+ -+ have hz_cond : z.re ∈ Ico (1/2 : ℝ) (3 : ℝ) ∧ (1 : ℝ) ≤ |z.im| := -+ lem_zfroms_conditions s t hs ht -+ -+ have h_bound : ‖riemannZeta z‖ < (8 : ℝ) + 2 * |z.im| := -+ lem_zetaUppBd z hz_cond.1 hz_cond.2 -+ -+ have hz_im_calc : z.im = s.im + t := (lem_zfroms_calc s t).2 -+ have h_im_bound : |z.im| ≤ 1 + |t| := by -+ rw [hz_im_calc] -+ exact lem_abs_im_bound s t hs -+ -+ have h_intermediate : ‖riemannZeta z‖ < (8 : ℝ) + 2 * (1 + |t|) := by -+ calc ‖riemannZeta z‖ -+ < (8 : ℝ) + 2 * |z.im| := h_bound -+ _ ≤ (8 : ℝ) + 2 * (1 + |t|) := by linarith [h_im_bound] -+ -+ have h_algebra : (8 : ℝ) + 2 * (1 + |t|) = (10 : ℝ) + 2 * |t| := by ring -+ -+ have h_final : ‖riemannZeta z‖ < (10 : ℝ) + 2 * |t| := by -+ linarith [h_intermediate, h_algebra] -+ -+ rwa [hz_def] at h_final -+ -+open Metric _root_.Set Filter Asymptotics BigOperators -+ -+noncomputable def logDerivZeta (s : ℂ) : ℂ := deriv riemannZeta s / riemannZeta s -+ -+def zerosetKfRc (R : ℝ) (c : ℂ) (f : ℂ → ℂ) : Set ℂ := -+ {ρ : ℂ | ρ ∈ Metric.closedBall c R ∧ f ρ = 0} -+ -+lemma zetadiffAtnot1 : ∀ s : ℂ, s ≠ 1 → DifferentiableAt ℂ riemannZeta s := -+ fun _ => differentiableAt_riemannZeta -+ -+lemma DiffAtWithinAt {T : Set ℂ} {g : ℂ → ℂ} {s : ℂ} (_hs : s ∈ T) : -+ DifferentiableAt ℂ g s → DifferentiableWithinAt ℂ g T s := -+ DifferentiableAt.differentiableWithinAt -+ -+lemma DiffWithinAtallOn {T : Set ℂ} {g : ℂ → ℂ} : -+ (∀ s ∈ T, DifferentiableWithinAt ℂ g T s) → DifferentiableOn ℂ g T := fun h => h -+ -+lemma DiffAtOn {T : Set ℂ} {g : ℂ → ℂ} : -+ (∀ s ∈ T, DifferentiableAt ℂ g s) → DifferentiableOn ℂ g T := by -+ intro h s hs -+ exact (h s hs).differentiableWithinAt -+ -+lemma DiffOnanalOnNhd {T : Set ℂ} (hT : IsOpen T) {g : ℂ → ℂ} : -+ DifferentiableOn ℂ g T → AnalyticOnNhd ℂ g T := by -+ intro hdiff -+ exact hdiff.analyticOnNhd hT -+ -+lemma DiffAtallanalOnNhd {T : Set ℂ} (hT : IsOpen T) {g : ℂ → ℂ} : -+ (∀ s ∈ T, DifferentiableAt ℂ g s) → AnalyticOnNhd ℂ g T := by -+ intro hdiff -+ apply DiffOnanalOnNhd hT -+ exact DiffAtOn hdiff -+ -+lemma zetaanalOnnot1 : AnalyticOnNhd ℂ riemannZeta {s : ℂ | s ≠ 1} := by -+ apply DiffAtallanalOnNhd -+ · apply isOpen_compl_singleton -+ · exact zetadiffAtnot1 -+ -+lemma I_mul_ofReal_im (t : ℝ) : (I * ↑t).im = t := by -+ have h1 : (I * (↑t : ℂ)).im = (↑t : ℂ).re := Complex.I_mul_im (↑t : ℂ) -+ rw [h1] -+ simp [Complex.ofReal_re] -+ -+lemma complex_im_sub_I_mul (a : ℂ) (t : ℝ) : (a - I * t).im = a.im - t := by -+ rw [Complex.sub_im] -+ rw [I_mul_ofReal_im] -+ -+lemma D1cinTt_pre (t : ℝ) (ht : |t| > 1) : -+ ∀ s ∈ closedBall (3/2 + I * t : ℂ) 1, s ≠ 1 := by -+ intro s hs -+ by_contra h -+ -+ rw [h] at hs -+ -+ rw [mem_closedBall] at hs -+ -+ rw [Complex.dist_eq] at hs -+ -+ have h1 : (1 : ℂ) - (3/2 + I * t) = -1/2 - I * t := by ring -+ rw [h1] at hs -+ -+ have h2 : (-1/2 - I * t : ℂ).im = -t := by -+ have : (-1/2 - I * t : ℂ) = (-1/2 : ℂ) - I * t := by ring -+ rw [this] -+ rw [complex_im_sub_I_mul] -+ simp -+ -+ have h3 : ‖(-1/2 - I * t : ℂ)‖ ≥ |(-1/2 - I * t : ℂ).im| := Complex.abs_im_le_norm _ -+ -+ rw [h2] at h3 -+ rw [abs_neg] at h3 -+ -+ have h4 : ‖(-1/2 - I * t : ℂ)‖ > 1 := lt_of_lt_of_le ht h3 -+ -+ linarith [h4, hs] -+ -+lemma D1cinTt (t : ℝ) (ht : |t| > 1) : -+ closedBall (3/2 + I * t : ℂ) 1 ⊆ {s : ℂ | s ≠ 1} := by -+ -+ exact fun s hs => D1cinTt_pre t ht s hs -+ -+lemma zetaanalOnD1c (t : ℝ) (ht : |t| > 1) : -+ AnalyticOnNhd ℂ riemannZeta (closedBall (3/2 + I * t : ℂ) 1) := by -+ apply zetaanalOnnot1.mono -+ exact D1cinTt t ht -+ -+lemma zetaanalOnD1c_general (x t : ℝ) (ht : |t| > 1) : -+ AnalyticOnNhd ℂ riemannZeta (closedBall (x + I * t : ℂ) 1) := by -+ apply zetaanalOnnot1.mono -+ -+ intro s hs -+ by_contra h -+ -+ have h' : s = 1 := by -+ simp at h -+ exact h -+ rw [h'] at hs -+ rw [mem_closedBall] at hs -+ rw [Complex.dist_eq] at hs -+ -+ have h1 : (1 : ℂ) - (x + I * t) = (1 - x) - I * t := by ring -+ rw [h1] at hs -+ -+ have h2 : ((1 - x) - I * t : ℂ).im = -t := by -+ rw [Complex.sub_im] -+ rw [Complex.sub_im] -+ rw [Complex.ofReal_im] -+ rw [I_mul_ofReal_im] -+ simp -+ -+ have h3 : ‖((1 - x) - I * t : ℂ)‖ ≥ |((1 - x) - I * t : ℂ).im| := Complex.abs_im_le_norm _ -+ rw [h2] at h3 -+ rw [abs_neg] at h3 -+ -+ have h4 : ‖((1 - x) - I * t : ℂ)‖ > 1 := lt_of_lt_of_le ht h3 -+ -+ linarith -+ -+lemma sigmageq1 (s : ℂ) (hs : s.re > 1) : riemannZeta s ≠ 0 := -+ riemannZeta_ne_zero_of_one_lt_re hs -+ -+lemma Complex_I_mul_ofReal_re (r : ℝ) : (I * (r : ℂ)).re = 0 := by -+ have h : (I * (r : ℂ)).re = -(r : ℂ).im := Complex.I_mul_re (r : ℂ) -+ rw [h] -+ simp -+ -+lemma re_real_add_I_mul_gt (a b : ℝ) (h : a > 1) : (a + I * b).re > 1 := by -+ rw [Complex.add_re] -+ rw [Complex.ofReal_re] -+ rw [Complex_I_mul_ofReal_re] -+ simp -+ exact h -+ -+lemma zetacnot0 (t : ℝ) : riemannZeta (3/2 + I * t) ≠ 0 := by -+ apply sigmageq1 -+ apply re_real_add_I_mul_gt -+ norm_num -+ -+lemma zetacnot0_general (x t : ℝ) (hx : x > 1) : riemannZeta (x + I * t) ≠ 0 := by -+ apply sigmageq1 -+ apply re_real_add_I_mul_gt -+ exact hx -+ -+lemma fc_analytic_normalized (c : ℂ) (f : ℂ → ℂ) -+ (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) : -+ (AnalyticOnNhd ℂ (fun z => f (z + c) / f c) (closedBall (0 : ℂ) 1)) ∧ (fun z => f (z + c) / f c) 0 = 1 := by -+ constructor -+ · -+ apply AnalyticOnNhd.div -+ · -+ apply AnalyticOnNhd.comp h_analytic -+ · -+ intro z _ -+ exact analyticAt_id.add analyticAt_const -+ · -+ intro z hz -+ rw [mem_closedBall] at hz ⊢ -+ rw [Complex.dist_eq] at hz ⊢ -+ -+ convert hz using 1 -+ ring_nf -+ · -+ exact analyticOnNhd_const -+ · -+ intro z _ -+ exact h_nonzero -+ · -+ simpa using h_nonzero -+ -+lemma deriv_normalized_nohd (c : ℂ) (f : ℂ → ℂ) (z : ℂ) (_h_nonzero : f c ≠ 0) : -+ deriv (fun w => f (w + c) / f c) z = (deriv f (z + c)) / f c := by -+ rw [deriv_div_const] -+ rw [deriv_comp_add_const] -+ -+lemma frac_cancel_const {x y c : ℂ} (hc : c ≠ 0) (hy : y ≠ 0) : (x / c) / (y / c) = x / y := by -+ field_simp [hc, hy] -+ -+lemma fc_log_deriv (c : ℂ) (f : ℂ → ℂ) -+ (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) -+ {z : ℂ} (hz_nonzero : f (z + c) ≠ 0) : -+ (deriv (fun w => f (w + c) / f c) z) / (f (z + c) / f c) = (deriv f (z + c)) / f (z + c) := by -+ -+ rw [deriv_normalized_nohd c f z h_nonzero] -+ -+ rw [frac_cancel_const h_nonzero hz_nonzero] -+ -+lemma fc_bound (B : ℝ) (_hB : B > 1) (R : ℝ) (_hRpos : 0 < R) (_hR : R < 1) (c : ℂ) (f : ℂ → ℂ) (_h_nonzero : f c ≠ 0) -+ (h_bound : ∀ z ∈ closedBall c R, ‖f z‖ ≤ B) : -+ ∀ z ∈ closedBall (0 : ℂ) R, ‖(fun w => f (w + c) / f c) z‖ ≤ B / ‖f c‖ := by -+ intro z hz -+ have hz' : ‖z‖ ≤ R := by -+ simpa [mem_closedBall, Complex.dist_eq] using hz -+ have hz_plus : z + c ∈ closedBall c R := by -+ have : ‖(z + c) - c‖ ≤ R := by simpa [add_sub_cancel] using hz' -+ simpa [mem_closedBall, Complex.dist_eq] using this -+ have hfb : ‖f (z + c)‖ ≤ B := h_bound (z + c) hz_plus -+ have hnorm : ‖f (z + c) / f c‖ = ‖f (z + c)‖ / ‖f c‖ := by -+ simp [div_eq_mul_inv, norm_inv] -+ have : ‖f (z + c)‖ / ‖f c‖ ≤ B / ‖f c‖ := -+ div_le_div_of_nonneg_right hfb (norm_nonneg _) -+ simpa [hnorm] using this -+ -+lemma fc_zeros (r : ℝ) (_h : r > 0) (c : ℂ) (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) -+ (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) : -+ (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)) = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := by -+ ext ρ'; constructor -+ · intro hmem -+ rcases hmem with ⟨hball, hzero⟩ -+ -+ have hprod : f (ρ' + c) * (f c)⁻¹ = 0 := by simpa [div_eq_mul_inv] using hzero -+ have hnum0 : f (ρ' + c) = 0 := by -+ rcases mul_eq_zero.mp hprod with hnum | hinv -+ · exact hnum -+ · have : (f c)⁻¹ ≠ 0 := inv_ne_zero h_nonzero -+ exact (this hinv).elim -+ refine ⟨ρ' + c, ?_, ?_⟩ -+ · -+ have hdist0 : dist ρ' (0 : ℂ) ≤ r := by simpa [mem_closedBall] using hball -+ have hdist1 : dist (ρ' + c) c ≤ r := by -+ simpa [Complex.dist_eq, add_sub_cancel] using hdist0 -+ have hmem_ball : ρ' + c ∈ closedBall c r := by -+ simpa [mem_closedBall] using hdist1 -+ exact And.intro hmem_ball hnum0 -+ · -+ simp -+ · intro him -+ rcases him with ⟨y, hy_mem, hy_eq⟩ -+ -+ subst hy_eq -+ rcases hy_mem with ⟨hy_ball, hy_zero⟩ -+ refine And.intro ?_ ?_ -+ · -+ have hdist : dist y c ≤ r := by simpa [mem_closedBall] using hy_ball -+ have hdist0 : dist (y - c) (0 : ℂ) ≤ r := by -+ simpa [Complex.dist_eq, sub_zero] using hdist -+ simpa [mem_closedBall] using hdist0 -+ · -+ simp [sub_add_cancel, hy_zero] -+ -+lemma analyticOrderAt_const_mul_eq (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : -+ analyticOrderAt (fun z => a * f z) z0 = analyticOrderAt f z0 := by -+ classical -+ by_cases hf : AnalyticAt ℂ f z0 -+ · -+ have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by -+ simpa using (analyticAt_const (x := z0) (v := a)) -+ have hconst_order_zero : analyticOrderAt (fun _ : ℂ => a) z0 = 0 := by -+ -+ refine (AnalyticAt.analyticOrderAt_eq_natCast (f := fun _ : ℂ => a) (z₀ := z0) hconst).mpr ?_ -+ refine ⟨(fun _ : ℂ => a), (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0), ?_, ?_⟩ -+ · simpa using ha -+ · exact Filter.Eventually.of_forall (fun _ => by simp) -+ have hmul := analyticOrderAt_mul (f := fun _ : ℂ => a) (g := f) hconst hf -+ -+ simpa [hconst_order_zero, zero_add] using! hmul -+ · -+ have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by -+ simpa using (analyticAt_const (x := z0) (v := a)) -+ have hconst_ne : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha -+ have hiff := (analyticAt_iff_analytic_fun_mul (f := fun _ : ℂ => a) (g := f) (z := z0) hconst hconst_ne) -+ have hmul : ¬ AnalyticAt ℂ (fun z => a * f z) z0 := by -+ intro h -+ have : AnalyticAt ℂ f z0 := (hiff.mpr (by simpa using h)) -+ exact hf this -+ -+ simp [analyticOrderAt, hf, hmul] -+ -+lemma AnalyticAt.comp_add_const {f : ℂ → ℂ} {z0 c : ℂ} (hf : AnalyticAt ℂ f (z0 + c)) : AnalyticAt ℂ (fun z => f (z + c)) z0 := by -+ -+ have hinner : AnalyticAt ℂ (fun z : ℂ => z + c) z0 := by -+ have h_id : AnalyticAt ℂ (fun z : ℂ => z) z0 := by -+ simpa [id] using! (analyticAt_id : AnalyticAt ℂ (id : ℂ → ℂ) z0) -+ have h_const : AnalyticAt ℂ (fun _ : ℂ => c) z0 := by -+ simpa using (analyticAt_const (v := c) (x := z0)) -+ simpa using (AnalyticAt.fun_add (f := fun z : ℂ => z) (g := fun _ : ℂ => c) (x := z0) h_id h_const) -+ -+ simpa using (AnalyticAt.fun_comp (x := z0) hf hinner) -+ -+lemma AnalyticAt.of_comp_add_const {f : ℂ → ℂ} {z0 c : ℂ} -+ (hg : AnalyticAt ℂ (fun z => f (z + c)) z0) : -+ AnalyticAt ℂ f (z0 + c) := by -+ -+ have hT : AnalyticAt ℂ (fun z => z - c) (z0 + c) := by -+ have h1 : AnalyticAt ℂ (fun z : ℂ => z) (z0 + c) := by -+ simpa using! (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (z0 + c)) -+ have h2 : AnalyticAt ℂ (fun _ : ℂ => -c) (z0 + c) := by -+ simpa using (analyticAt_const (x := (z0 + c)) (v := (-c : ℂ))) -+ have : AnalyticAt ℂ (fun z => z + (-c)) (z0 + c) := by -+ simpa using (AnalyticAt.fun_add h1 h2) -+ simpa [sub_eq_add_neg] using this -+ -+ have hx : (z0 + c) - c = z0 := by simp -+ have hg' : AnalyticAt ℂ (fun z => f (z + c)) ((z0 + c) - c) := by -+ simpa [hx] using hg -+ -+ have hcomp := -+ (AnalyticAt.comp (g := (fun z => f (z + c))) (f := (fun z => z - c)) (x := z0 + c) -+ hg' hT) -+ have hgf : ((fun z => f (z + c)) ∘ (fun z => z - c)) = f := by -+ funext z -+ simp [Function.comp, sub_eq_add_neg] -+ simpa [hgf] using hcomp -+ -+lemma order_top_iff_comp_add (f : ℂ → ℂ) (z0 c : ℂ) : -+ analyticOrderAt (fun z => f (z + c)) z0 = ⊤ ↔ analyticOrderAt f (z0 + c) = ⊤ := by -+ classical -+ let g : ℂ → ℂ := fun z => f (z + c) -+ -+ have eq_left : analyticOrderAt g z0 = ⊤ ↔ ∀ᶠ z in nhds z0, g z = 0 := by -+ simpa [g] using (analyticOrderAt_eq_top (f := g)) -+ have eq_right : analyticOrderAt f (z0 + c) = ⊤ ↔ ∀ᶠ w in nhds (z0 + c), f w = 0 := by -+ simpa using (analyticOrderAt_eq_top (f := f)) -+ constructor -+ · intro htop -+ have hz : ∀ᶠ z in nhds z0, g z = 0 := (eq_left.mp htop) -+ -+ have hcont_sub : ContinuousAt (fun w : ℂ => w - c) (z0 + c) := by -+ simpa [sub_eq_add_neg] using! -+ ((continuousAt_id).add (continuousAt_const : ContinuousAt (fun _ : ℂ => -c) (z0 + c))) -+ have htend : Tendsto (fun w : ℂ => w - c) (nhds (z0 + c)) (nhds ((z0 + c) - c)) := -+ hcont_sub.tendsto -+ have hz' : ∀ᶠ w in nhds ((z0 + c) - c), g w = 0 := by -+ simpa [sub_eq_add_neg, add_sub_cancel] using hz -+ have hw : ∀ᶠ w in nhds (z0 + c), g (w - c) = 0 := htend.eventually hz' -+ have hw' : ∀ᶠ w in nhds (z0 + c), f w = 0 := by -+ simpa [g, sub_add_cancel] using hw -+ exact eq_right.mpr hw' -+ · intro htop -+ have hw : ∀ᶠ w in nhds (z0 + c), f w = 0 := (eq_right.mp htop) -+ -+ have hcont_add : ContinuousAt (fun z : ℂ => z + c) z0 := -+ by simpa using! ((continuousAt_id).add (continuousAt_const : ContinuousAt (fun _ : ℂ => c) z0)) -+ have htend : Tendsto (fun z : ℂ => z + c) (nhds z0) (nhds (z0 + c)) := -+ hcont_add.tendsto -+ have hz : ∀ᶠ z in nhds z0, f (z + c) = 0 := htend.eventually hw -+ have hz' : ∀ᶠ z in nhds z0, g z = 0 := by simpa [g] using hz -+ exact eq_left.mpr hz' -+ -+lemma enat_le_iff_forall_nat {x y : ℕ∞} : x ≤ y ↔ ∀ n : ℕ, (n : ℕ∞) ≤ x → (n : ℕ∞) ≤ y := by -+ classical -+ constructor -+ · intro hxy n hnx -+ exact le_trans hnx hxy -+ · intro h -+ by_cases hx : x = ⊤ -+ · -+ subst hx -+ -+ by_contra hnot -+ have hy_ne : y ≠ ⊤ := by -+ simpa [WithTop.top_le_iff] using hnot -+ obtain ⟨m, hm⟩ := (WithTop.ne_top_iff_exists).1 hy_ne -+ -+ have h' : ((m + 1 : ℕ) : ℕ∞) ≤ y := h (m + 1) (by simp) -+ -+ have h'' : ((m + 1 : ℕ) : ℕ∞) ≤ (m : ℕ∞) := by -+ simpa [← hm] -+ using! h' -+ -+ have : m + 1 ≤ m := (WithTop.coe_le_coe).1 h'' -+ exact Nat.not_succ_le_self m this -+ · -+ obtain ⟨k, hk'⟩ := (WithTop.ne_top_iff_exists).1 hx -+ have hk : x = (k : ℕ∞) := hk'.symm -+ -+ have hxk : ((k : ℕ∞) ≤ y) := h k (by simp [hk]) -+ -+ simpa [hk] using hxk -+ -+lemma natCast_le_order_const_mul_iff (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) (n : ℕ) : -+ (n : ℕ∞) ≤ analyticOrderAt (fun z => a * f z) z0 ↔ (n : ℕ∞) ≤ analyticOrderAt f z0 := by -+ constructor -+ · intro h -+ simpa [analyticOrderAt_const_mul_eq f a z0 ha] using h -+ · intro h -+ simpa [analyticOrderAt_const_mul_eq f a z0 ha] using h -+ -+lemma order_top_iff_const_mul (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : -+ analyticOrderAt (fun z => a * f z) z0 = ⊤ ↔ analyticOrderAt f z0 = ⊤ := by -+ simp [analyticOrderAt_const_mul_eq (f := f) (a := a) (z0 := z0) ha] -+ -+lemma analyticOrderAt_mul_const_eq (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : -+ analyticOrderAt (fun z => f z * a) z0 = analyticOrderAt f z0 := by -+ classical -+ -+ have hcomm : (fun z => f z * a) = (fun z => a * f z) := by -+ funext z; simp [mul_comm] -+ have hrew : analyticOrderAt (fun z => f z * a) z0 = -+ analyticOrderAt (fun z => a * f z) z0 := by -+ simp [hcomm] -+ by_cases hf : AnalyticAt ℂ f z0 -+ · -+ have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by -+ simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0) -+ have hadd : analyticOrderAt (fun z => a * f z) z0 -+ = analyticOrderAt (fun _ : ℂ => a) z0 + analyticOrderAt f z0 := by -+ simpa using! (analyticOrderAt_mul hconst hf) -+ -+ have hconst_zero : analyticOrderAt (fun _ : ℂ => a) z0 = 0 := by -+ have hiff := (AnalyticAt.analyticOrderAt_eq_zero hconst) -+ have hval : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha -+ exact hiff.mpr hval -+ calc -+ analyticOrderAt (fun z => f z * a) z0 -+ = analyticOrderAt (fun z => a * f z) z0 := hrew -+ _ = analyticOrderAt (fun _ : ℂ => a) z0 + analyticOrderAt f z0 := hadd -+ _ = 0 + analyticOrderAt f z0 := by simp [hconst_zero] -+ _ = analyticOrderAt f z0 := by simp -+ · -+ have hnot : ¬ AnalyticAt ℂ (fun z => a * f z) z0 := by -+ intro hmul -+ have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by -+ simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0) -+ have hval : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha -+ -+ have hiff := (analyticAt_iff_analytic_fun_smul (h₁f := hconst) (h₂f := hval) -+ (g := f) (z := z0)) -+ have hsmul : AnalyticAt ℂ (fun z => (fun _ : ℂ => a) z • f z) z0 := by -+ -+ simpa [smul_eq_mul] using hmul -+ have : AnalyticAt ℂ f z0 := hiff.mpr hsmul -+ exact hf this -+ calc -+ analyticOrderAt (fun z => f z * a) z0 -+ = analyticOrderAt (fun z => a * f z) z0 := hrew -+ _ = 0 := by simp [analyticOrderAt, hnot] -+ _ = analyticOrderAt f z0 := by simp [analyticOrderAt, hf] -+ -+lemma fc_m_order (r : ℝ) (_h : r > 0) (c : ℂ) (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) -+ (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) -+ {ρ' : ℂ} (_hρ' : ρ' ∈ zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)) : -+ analyticOrderAt (fun z => f (z + c) / f c) ρ' = analyticOrderAt f (ρ' + c) := by -+ classical -+ -+ set g0 : ℂ → ℂ := fun z => f (z + c) with hg0 -+ -+ have hconst : analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' = analyticOrderAt g0 ρ' := by -+ have hne : (1 / f c) ≠ 0 := one_div_ne_zero h_nonzero -+ simpa using (analyticOrderAt_mul_const_eq (f := g0) (a := (1 / f c)) (z0 := ρ') hne) -+ have hconst_rewrite : analyticOrderAt (fun z => f (z + c) / f c) ρ' -+ = analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' := by -+ have : (fun z => f (z + c) / f c) = (fun z => g0 z * (1 / f c)) := by -+ funext z; simp [g0, div_eq_mul_inv, mul_comm] -+ simp [this] -+ -+ have htrans : analyticOrderAt g0 ρ' = analyticOrderAt f (ρ' + c) := by -+ -+ by_cases hfA : AnalyticAt ℂ f (ρ' + c) -+ · -+ have h_add : AnalyticAt ℂ (fun z : ℂ => z + c) ρ' := by -+ simpa using! (AnalyticAt.add (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) ρ') -+ (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) ρ')) -+ have hgA : AnalyticAt ℂ g0 ρ' := by -+ have : AnalyticAt ℂ f ((fun z : ℂ => z + c) ρ') := by simpa using hfA -+ simpa [g0, hg0] using! (AnalyticAt.comp (g := f) (f := fun z : ℂ => z + c) (x := ρ') this h_add) -+ -+ by_cases hgez : (∀ᶠ z in nhds ρ', g0 z = 0) -+ · -+ have hT_sub_cont : ContinuousAt (fun w : ℂ => w - c) (ρ' + c) := by -+ simpa using! (ContinuousAt.sub (continuousAt_id : ContinuousAt (fun w : ℂ => w) (ρ' + c)) -+ (continuousAt_const : ContinuousAt (fun _ : ℂ => c) (ρ' + c))) -+ have hT_sub : Tendsto (fun w : ℂ => w - c) (nhds (ρ' + c)) (nhds ρ') := by -+ simpa using (hT_sub_cont.tendsto) -+ have hEfw : ∀ᶠ w in nhds (ρ' + c), f w = 0 := by -+ have : ∀ᶠ w in nhds (ρ' + c), g0 (w - c) = 0 := hT_sub.eventually hgez -+ -+ simpa [g0, hg0, sub_add_cancel] using this -+ -+ have hg_top : analyticOrderAt g0 ρ' = ⊤ := -+ (analyticOrderAt_eq_top (f := g0) (z₀ := ρ')).2 hgez -+ have hf_top : analyticOrderAt f (ρ' + c) = ⊤ := -+ (analyticOrderAt_eq_top (f := f) (z₀ := ρ' + c)).2 hEfw -+ simp [hg_top, hf_top] -+ · -+ have h_exists := (AnalyticAt.exists_eventuallyEq_pow_smul_nonzero_iff hgA).mpr hgez -+ rcases h_exists with ⟨n, φ, hφA, hφ_ne, hevent⟩ -+ -+ have hT_sub_cont : ContinuousAt (fun w : ℂ => w - c) (ρ' + c) := by -+ simpa using! (ContinuousAt.sub (continuousAt_id : ContinuousAt (fun w : ℂ => w) (ρ' + c)) -+ (continuousAt_const : ContinuousAt (fun _ : ℂ => c) (ρ' + c))) -+ have hT_sub : Tendsto (fun w : ℂ => w - c) (nhds (ρ' + c)) (nhds ρ') := by -+ simpa using (hT_sub_cont.tendsto) -+ have hevent_w : ∀ᶠ w in nhds (ρ' + c), f w -+ = (w - (ρ' + c)) ^ n * ((fun w => φ (w - c)) w) := by -+ have : ∀ᶠ w in nhds (ρ' + c), g0 (w - c) -+ = ((w - c) - ρ') ^ n * φ (w - c) := -+ hT_sub.eventually hevent -+ -+ refine this.mono ?_ -+ intro w hw -+ have hsubsimp : (w - c) - ρ' = w - (ρ' + c) := by ring -+ simpa [g0, hg0, hsubsimp] using hw -+ -+ have hψA : AnalyticAt ℂ (fun w => φ (w - c)) (ρ' + c) := by -+ have h_subA : AnalyticAt ℂ (fun w : ℂ => w - c) (ρ' + c) := by -+ simpa using! (AnalyticAt.sub (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (ρ' + c)) -+ (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) (ρ' + c))) -+ have hφA_at : AnalyticAt ℂ φ ((fun w : ℂ => w - c) (ρ' + c)) := by simpa using hφA -+ simpa using! (AnalyticAt.comp (g := φ) (f := fun w => w - c) (x := (ρ' + c)) hφA_at h_subA) -+ have hψ_ne : (fun w => φ (w - c)) (ρ' + c) ≠ 0 := by -+ -+ simpa using hφ_ne -+ -+ have hg_eq_n : analyticOrderAt g0 ρ' = n := by -+ exact (AnalyticAt.analyticOrderAt_eq_natCast (f := g0) (z₀ := ρ') hgA).mpr -+ ⟨φ, hφA, hφ_ne, hevent⟩ -+ have hf_eq_n : analyticOrderAt f (ρ' + c) = n := by -+ exact (AnalyticAt.analyticOrderAt_eq_natCast (f := f) (z₀ := ρ' + c) hfA).mpr -+ ⟨(fun w => φ (w - c)), hψA, hψ_ne, hevent_w⟩ -+ simp [hg_eq_n, hf_eq_n] -+ · -+ have hg_not : ¬ AnalyticAt ℂ g0 ρ' := by -+ intro hgA -+ -+ have h_subA : AnalyticAt ℂ (fun w : ℂ => w - c) (ρ' + c) := by -+ simpa using! (AnalyticAt.sub (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (ρ' + c)) -+ (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) (ρ' + c))) -+ have hgA_at : AnalyticAt ℂ g0 ((ρ' + c) - c) := by simpa using hgA -+ have hcomp := (AnalyticAt.comp (g := g0) (f := fun w => w - c) -+ (x := (ρ' + c)) hgA_at h_subA) -+ -+ have : AnalyticAt ℂ (fun w : ℂ => g0 (w - c)) (ρ' + c) := by simpa using! hcomp -+ have : AnalyticAt ℂ f (ρ' + c) := by -+ simpa [g0, hg0, sub_add_cancel] using this -+ exact hfA this -+ -+ simp [analyticOrderAt, hfA, hg_not] -+ -+ calc -+ analyticOrderAt (fun z => f (z + c) / f c) ρ' -+ = analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' := hconst_rewrite -+ _ = analyticOrderAt g0 ρ' := hconst -+ _ = analyticOrderAt f (ρ' + c) := htrans -+ -+lemma DminusK (r1 : ℝ) (R1 : ℝ) (_hr1 : r1 > 0) (_hR1 : R1 > 0) (c : ℂ) (f : ℂ → ℂ) -+ (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) : -+ ∀ z : ℂ, z ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun w => f (w + c) / f c) ↔ -+ z + c ∈ closedBall c r1 \ zerosetKfRc R1 c f := by -+ intro z -+ constructor -+ · -+ intro ⟨hz_ball, hz_not_zero⟩ -+ constructor -+ · -+ have hdist : dist z (0 : ℂ) ≤ r1 := by simpa [mem_closedBall] using hz_ball -+ have hdist_c : dist (z + c) c ≤ r1 := by -+ simpa [Complex.dist_eq, add_sub_cancel] using hdist -+ simpa [mem_closedBall] using hdist_c -+ · -+ intro h_contra -+ apply hz_not_zero -+ -+ rcases h_contra with ⟨hz_c_ball, hz_c_zero⟩ -+ constructor -+ · -+ have hdist_c : dist (z + c) c ≤ R1 := by simpa [mem_closedBall] using hz_c_ball -+ have hdist_0 : dist z (0 : ℂ) ≤ R1 := by -+ simpa [Complex.dist_eq, add_sub_cancel] using hdist_c -+ simpa [mem_closedBall] using hdist_0 -+ · -+ have : f (z + c) = 0 := hz_c_zero -+ simp [this, zero_div] -+ · -+ intro ⟨hz_c_ball, hz_c_not_zero⟩ -+ constructor -+ · -+ have hdist_c : dist (z + c) c ≤ r1 := by simpa [mem_closedBall] using hz_c_ball -+ have hdist_0 : dist z (0 : ℂ) ≤ r1 := by -+ simpa [Complex.dist_eq, add_sub_cancel] using hdist_c -+ simpa [mem_closedBall] using hdist_0 -+ · -+ intro h_contra -+ apply hz_c_not_zero -+ -+ rcases h_contra with ⟨hz_ball, hz_zero⟩ -+ constructor -+ · -+ have hdist_0 : dist z (0 : ℂ) ≤ R1 := by simpa [mem_closedBall] using hz_ball -+ have hdist_c : dist (z + c) c ≤ R1 := by -+ simpa [Complex.dist_eq, add_sub_cancel] using hdist_0 -+ simpa [mem_closedBall] using hdist_c -+ · -+ have h_div_zero : f (z + c) / f c = 0 := hz_zero -+ have h_mul_zero : f (z + c) * (f c)⁻¹ = 0 := by simpa [div_eq_mul_inv] using h_div_zero -+ cases' mul_eq_zero.mp h_mul_zero with h_num h_inv -+ · exact h_num -+ · have : (f c)⁻¹ ≠ 0 := inv_ne_zero h_nonzero -+ exact (this h_inv).elim -+ -+lemma shifted_zeros_correspondence (R1 : ℝ) (hR1 : R1 > 0) (c z : ℂ) -+ (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) -+ (hfin_orig : (zerosetKfRc R1 c f).Finite) -+ (hfin_shift : (zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c)).Finite) : -+ ∑ ρ ∈ hfin_orig.toFinset, ((analyticOrderAt f ρ).toNat : ℂ) / (z - ρ) = -+ ∑ ρ' ∈ hfin_shift.toFinset, ((analyticOrderAt (fun u => f (u + c) / f c) ρ').toNat : ℂ) / ((z - c) - ρ') := by -+ -+ have h_bij : (zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c)) = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := -+ fc_zeros R1 hR1 c f h_nonzero h_analytic -+ -+ apply Finset.sum_bij (fun ρ _ => ρ - c) -+ -+ · intro ρ hρ -+ simp only [Set.Finite.mem_toFinset] at hρ ⊢ -+ rw [h_bij] -+ use ρ, hρ -+ -+ · intro ρ₁ hρ₁ ρ₂ hρ₂ h_eq -+ -+ have : ρ₁ = ρ₁ - c + c := by ring -+ rw [this, h_eq] -+ ring -+ -+ · intro ρ' hρ' -+ simp only [Set.Finite.mem_toFinset] at hρ' -+ rw [h_bij] at hρ' -+ obtain ⟨ρ, hρ_mem, hρ_eq⟩ := hρ' -+ use ρ -+ simp only [Set.Finite.mem_toFinset] -+ exact ⟨hρ_mem, hρ_eq⟩ -+ -+ · intro ρ hρ -+ simp only [Set.Finite.mem_toFinset] at hρ -+ -+ have h_shift_mem : ρ - c ∈ zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c) := by -+ rw [h_bij] -+ use ρ, hρ -+ -+ have h_order := fc_m_order R1 hR1 c f h_nonzero h_analytic h_shift_mem -+ -+ have h_add : (ρ - c) + c = ρ := by ring -+ rw [h_add] at h_order -+ rw [← h_order] -+ -+ ring -+ -+lemma final_ineq2 -+ (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) -+ (hR1_lt_R : R1 < R) (hR : R < 1) -+ (c : ℂ) (f : ℂ → ℂ) (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) -+ (h_bound : ∀ z ∈ closedBall c R, ‖f z‖ < B) -+ (hfin : (zerosetKfRc R1 (0 : ℂ) (fun z => f (z + c) / f c)).Finite) : -+ ∀ z ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun z => f (z + c) / f c), -+ ‖(deriv (fun z => f (z + c) / f c) z / (f (z + c) / f c)) - ∑ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt (fun w => f (w + c) / f c) ρ).toNat : ℂ) / (z - ρ)‖ ≤ (16 * r^2 / ((r - r1)^3) + -+ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (B / ‖f c‖) := by -+ intro z hz -+ -+ let g : ℂ → ℂ := fun w => f (w + c) / f c -+ -+ have hR_pos : 0 < R := by linarith [hr1pos, hr1_lt_r, hr_lt_R1, hR1_lt_R] -+ have hR1_pos : 0 < R1 := by linarith [hr1pos, hr1_lt_r, hr_lt_R1] -+ have h_norm_pos : 0 < ‖f c‖ := norm_pos_iff.mpr h_nonzero -+ -+ have h_fc_bound_at_c : ‖f c‖ < B := by -+ apply h_bound -+ rw [mem_closedBall, dist_self] -+ exact le_of_lt hR_pos -+ -+ have h_B_div_gt_one : 1 < B / ‖f c‖ := by -+ rw [one_lt_div h_norm_pos] -+ exact h_fc_bound_at_c -+ -+ have h_g_analytic : ∀ w ∈ closedBall (0 : ℂ) 1, AnalyticAt ℂ g w := -+ (fc_analytic_normalized c f h_analytic h_nonzero).1 -+ -+ have h_g_zero : g 0 = 1 := -+ (fc_analytic_normalized c f h_analytic h_nonzero).2 -+ -+ have h_g_bound : ∀ w ∈ closedBall (0 : ℂ) R, ‖g w‖ ≤ B / ‖f c‖ := by -+ apply fc_bound B hB R hR_pos hR c f h_nonzero -+ intro w hw -+ exact le_of_lt (h_bound w hw) -+ -+ have h_zeroset_equiv : zerosetKfRc R1 (0 : ℂ) g = zerosetKfR R1 hR1_pos g := by -+ ext ρ -+ simp only [zerosetKfRc, zerosetKfR, mem_ofPred_eq, mem_closedBall, Complex.dist_eq, sub_zero] -+ -+ have h_g_finite : (zerosetKfR R1 hR1_pos g).Finite := by -+ rwa [← h_zeroset_equiv] -+ -+ have h_σ_exists : ∃ h_σ : ℂ → (ℂ → ℂ), ∀ σ ∈ zerosetKfR R1 hR1_pos g, -+ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ -+ ∀ᶠ w in nhds σ, g w = (w - σ) ^ (analyticOrderAt g σ).toNat * h_σ σ w := by -+ -+ classical -+ let h_σ : ℂ → (ℂ → ℂ) := fun σ => -+ if hσ : σ ∈ zerosetKfR R1 hR1_pos g -+ then Classical.choose (lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR g h_g_analytic -+ (by simp [g]; exact h_nonzero) σ hσ) -+ else fun _ => 0 -+ use h_σ -+ intro σ hσ -+ simp only [h_σ, dite_eq_left hσ] -+ exact Classical.choose_spec (lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR g h_g_analytic -+ (by simp [g]; exact h_nonzero) σ hσ) -+ -+ obtain ⟨h_σ, h_σ_spec⟩ := h_σ_exists -+ -+ have := final_ineq1 (B / ‖f c‖) h_B_div_gt_one r1 r R R1 hr1pos hr1_lt_r hr_lt_R1 hR1_lt_R hR -+ g h_g_analytic h_g_zero h_g_finite h_σ_spec h_g_bound z -+ -+ have hz_domain : z ∈ closedBall (0 : ℂ) r1 \ zerosetKfR R1 hR1_pos g := by -+ rw [h_zeroset_equiv] at hz -+ exact hz -+ -+ exact this hz_domain -+ -+lemma log_Deriv_Expansion_Zeta (t : ℝ) (ht : |t| > 2) -+ (r1 r R1 R : ℝ) -+ (hr1_pos : 0 < r1) (hr1_lt_r : r1 < r) -+ (_hr_pos : 0 < r) (hr_lt_R1 : r < R1) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) : -+ let c := (3/2 : ℂ) + I * t -+ ∀ B > 1, (∀ z ∈ closedBall c R, ‖riemannZeta z‖ < B) → -+ ∀ (hfin : (zerosetKfRc R1 c riemannZeta).Finite), -+ ∀ z ∈ closedBall c r1 \ zerosetKfRc R1 c riemannZeta, -+ ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ (16 * r^2 / ((r - r1)^3) + -+ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (B / ‖riemannZeta c‖) := by -+ intro c B hB h_bound hfin z hzmem -+ -+ have ht1 : |t| > 1 := lt_trans (by norm_num : (1 : ℝ) < 2) (by simpa using ht) -+ -+ have hζ_analytic : AnalyticOnNhd ℂ riemannZeta (closedBall c 1) := by -+ simpa [c] using zetaanalOnD1c t ht1 -+ have hζ_c_ne : riemannZeta c ≠ 0 := by simpa [c] using zetacnot0 t -+ -+ have hfin_shift : (zerosetKfRc R1 (0 : ℂ) (fun u => riemannZeta (u + c) / riemannZeta c)).Finite := by -+ have h_bij := fc_zeros R1 hR1_pos c riemannZeta hζ_c_ne hζ_analytic -+ have himg : ((fun ρ => ρ - c) '' (zerosetKfRc R1 c riemannZeta)).Finite := hfin.image _ -+ simpa [h_bij] using himg -+ -+ have hz0mem : (z - c) ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun u => riemannZeta (u + c) / riemannZeta c) := by -+ have hiff := DminusK r1 R1 hr1_pos hR1_pos c riemannZeta hζ_analytic hζ_c_ne (z - c) -+ exact (hiff).mpr (by simpa [sub_add_cancel] using hzmem) -+ -+ have hineq0 := -+ (final_ineq2 B hB r1 r R R1 hr1_pos hr1_lt_r hr_lt_R1 hR1_lt_R hR_lt_1 c riemannZeta -+ hζ_analytic hζ_c_ne h_bound hfin_shift) (z - c) hz0mem -+ -+ rcases hzmem with ⟨hz_ball, hz_notin⟩ -+ have hr1_lt_R1' : r1 < R1 := lt_trans hr1_lt_r hr_lt_R1 -+ have hz_in_ball_R1 : z ∈ closedBall c R1 := by -+ have hz_le_r1 : dist z c ≤ r1 := by simpa [mem_closedBall] using hz_ball -+ have hr1_le_R1 : r1 ≤ R1 := le_of_lt hr1_lt_R1' -+ have hz_le_R1 : dist z c ≤ R1 := le_trans hz_le_r1 hr1_le_R1 -+ simpa [mem_closedBall] using hz_le_R1 -+ have hzeta_ne : riemannZeta z ≠ 0 := by -+ intro hz0 -+ exact hz_notin ⟨hz_in_ball_R1, hz0⟩ -+ -+ have hcancel_frac : (deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta c) -+ / (riemannZeta z / riemannZeta c) -+ = deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta z := by -+ have hc : riemannZeta c ≠ 0 := hζ_c_ne -+ have hy : riemannZeta z ≠ 0 := hzeta_ne -+ simpa using (frac_cancel_const (x := deriv (fun x => riemannZeta (x + c)) (z - c)) -+ (y := riemannZeta z) (c := riemannZeta c) hc hy) -+ have hcancel_all : (deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta c) -+ / (riemannZeta z / riemannZeta c) -+ = deriv riemannZeta z / riemannZeta z := by -+ simpa [deriv_comp_add_const, sub_add_cancel] using hcancel_frac -+ -+ have hineq1 : ‖(deriv riemannZeta z / riemannZeta z) -+ - ∑ ρ ∈ hfin_shift.toFinset, -+ ((analyticOrderAt (fun u => riemannZeta (u + c) / riemannZeta c) ρ).toNat : ℂ) -+ / ((z - c) - ρ)‖ -+ ≤ (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * -+ Real.log (B / ‖riemannZeta c‖) := by -+ simpa [hcancel_all] using hineq0 -+ -+ have hsum_eq := shifted_zeros_correspondence R1 hR1_pos c z riemannZeta hζ_c_ne hζ_analytic hfin hfin_shift -+ -+ have hineq2 : ‖(deriv riemannZeta z / riemannZeta z) -+ - ∑ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ -+ ≤ (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * -+ Real.log (B / ‖riemannZeta c‖) := by -+ simpa [hsum_eq] using hineq1 -+ -+ simpa [logDerivZeta] using hineq2 -+ -+lemma zeta32lower : ∃ a > 0, ∀ t : ℝ, ‖riemannZeta (3/2 + I * t)‖ ≥ a := by -+ rcases zeta_low_332 with ⟨a, ha_pos, hbound⟩ -+ refine ⟨a, ha_pos, ?_⟩ -+ intro t -+ simpa [mul_comm] using! (hbound t) -+ -+lemma zeta32lower_log : ∃ A > 1, ∀ t : ℝ, -+ Real.log (1 / ‖riemannZeta (3/2 + I * t)‖) ≤ A := by -+ obtain ⟨a, ha_pos, hbound⟩ := zeta32lower -+ refine ⟨max (2 : ℝ) (Real.log (1 / a)), ?_, ?_⟩ -+ · have h1 : (1 : ℝ) < 2 := by norm_num -+ have h2 : (2 : ℝ) ≤ max (2 : ℝ) (Real.log (1 / a)) := by exact le_max_left _ _ -+ exact lt_of_lt_of_le h1 h2 -+ · intro t -+ set x := ‖riemannZeta (3/2 + I * t)‖ with hx -+ have hax : a ≤ x := by -+ simpa [hx] using (hbound t) -+ have hxpos : 0 < x := lt_of_lt_of_le ha_pos hax -+ have hxy : 1 / x ≤ 1 / a := by -+ -+ have := one_div_le_one_div_of_le ha_pos hax -+ -+ simpa [hx] using this -+ have hxpos' : 0 < 1 / x := one_div_pos.mpr hxpos -+ have hlog : Real.log (1 / x) ≤ Real.log (1 / a) := -+ Real.log_le_log hxpos' hxy -+ have : Real.log (1 / x) ≤ max (2 : ℝ) (Real.log (1 / a)) := -+ le_trans hlog (le_max_right _ _) -+ simpa [hx] using this -+ -+lemma zeta32upper_pre : ∃ b > 1, ∀ t : ℝ, ∀ s : ℂ, ‖s‖ ≤ 1 → (2 : ℝ) < |t| → ‖riemannZeta (s + 3/2 + Complex.I * t)‖ < b * |t| := by -+ refine ⟨(12 : ℝ), by norm_num, ?_⟩ -+ intro t s hs ht -+ have hlt : ‖riemannZeta (s + 3/2 + Complex.I * t)‖ < (10 : ℝ) + 2 * |t| := by -+ simpa using! (lem_zetaUppBound t s hs ht) -+ have honele : (1 : ℝ) ≤ |t| := by -+ have : (1 : ℝ) < |t| := lt_trans (by norm_num) ht -+ exact le_of_lt this -+ have h10le : (10 : ℝ) ≤ 10 * |t| := by -+ simpa [mul_comm] using -+ (mul_le_mul_of_nonneg_right honele (by norm_num : (0 : ℝ) ≤ (10 : ℝ))) -+ have hle2 : (10 : ℝ) + 2 * |t| ≤ (12 : ℝ) * |t| := by -+ have htmp := add_le_add_left h10le (2 * |t|) -+ have hcalc : 10 * |t| + 2 * |t| = (12 : ℝ) * |t| := by ring -+ simpa [hcalc] using! htmp -+ exact lt_of_lt_of_le hlt hle2 -+ -+lemma zeta32upper : ∃ b > 1, ∀ t : ℝ, |t| > 2 → -+ let c := (3/2 : ℂ) + I * t -+ ∀ s ∈ closedBall c 1, ‖riemannZeta s‖ < b * |t| := by -+ -+ obtain ⟨b, hb_gt, hbound⟩ := zeta32upper_pre -+ refine ⟨b, hb_gt, ?_⟩ -+ intro t ht c s hs -+ -+ rw [mem_closedBall] at hs -+ -+ set s_pre := s - c with hs_pre_def -+ have hs_pre_bound : ‖s_pre‖ ≤ 1 := by -+ rw [hs_pre_def] -+ rwa [Complex.dist_eq] at hs -+ -+ have hs_eq : s = s_pre + 3/2 + I * t := by -+ rw [hs_pre_def] -+ ring -+ -+ rw [hs_eq] -+ exact hbound t s_pre hs_pre_bound ht -+ -+lemma closedBall_subset_unit (c : ℂ) (R : ℝ) (hR_lt_1 : R < 1) : -+ Metric.closedBall c R ⊆ Metric.closedBall c 1 := by -+ apply Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) -+ -+lemma zeta_c_nonzero (t : ℝ) : riemannZeta (3/2 + I * t) ≠ 0 := by -+ exact zetacnot0 t -+ -+lemma zeta_c_norm_pos (t : ℝ) : 0 < ‖riemannZeta (3/2 + I * t)‖ := by -+ have h := zetacnot0 t -+ exact norm_pos_iff.mpr h -+ -+lemma Zeta1_Zeta_Expand : -+ ∃ A > 1, ∃ b > 1, -+ ∀ (t : ℝ) (_ht : |t| > 2) -+ (r1 r R1 R : ℝ) -+ (_hr1_pos : 0 < r1) (_hr1_lt_r : r1 < r) -+ (_hr_pos : 0 < r) (_hr_lt_R1 : r < R1) (_hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1), -+ let c := (3/2 : ℂ) + I * t; -+ ∀ (hfin : (zerosetKfRc R1 c riemannZeta).Finite), -+ ∀ z ∈ closedBall c r1 \ zerosetKfRc R1 c riemannZeta, -+ ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ -+ (16 * r^2 / ((r - r1)^3) + -+ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * (Real.log |t| + Real.log b + A) := by -+ -+ obtain ⟨b, hbgt1, hb⟩ := zeta32upper -+ obtain ⟨A, hAgt1, hA⟩ := zeta32lower_log -+ -+ refine ⟨A, hAgt1, b, hbgt1, ?_⟩ -+ intro t ht r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 c hfin z hz -+ -+ have hexp_lemma := log_Deriv_Expansion_Zeta t ht r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 -+ -+ have htpos : (0 : ℝ) < |t| := by linarith [ht] -+ have hBgt1 : b * |t| > 1 := by -+ have hb_pos : (0 : ℝ) < b := by linarith [hbgt1] -+ calc (1 : ℝ) < 1 * 2 := by norm_num -+ _ < b * 2 := mul_lt_mul_of_pos_right (by linarith [hbgt1]) (by norm_num) -+ _ < b * |t| := mul_lt_mul_of_pos_left ht hb_pos -+ -+ have hbound_ball : ∀ s ∈ closedBall (3/2 + I * t) R, ‖riemannZeta s‖ < b * |t| := by -+ have hsubset : closedBall (3/2 + I * t) R ⊆ closedBall (3/2 + I * t) 1 := -+ Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) -+ intro s hs -+ have hs1 : s ∈ closedBall (3/2 + I * t) 1 := hsubset hs -+ have ht2 : |t| > 2 := by linarith [ht] -+ specialize hb t ht2 -+ exact hb s hs1 -+ -+ have hexp := hexp_lemma (b * |t|) hBgt1 hbound_ball hfin z hz -+ -+ have hζne : riemannZeta (3/2 + I * t) ≠ 0 := zetacnot0 t -+ have hζpos : (0 : ℝ) < ‖riemannZeta (3/2 + I * t)‖ := norm_pos_iff.mpr hζne -+ -+ have hBpos : (0 : ℝ) < b * |t| := mul_pos (by linarith [hbgt1]) htpos -+ have hBne : b * |t| ≠ 0 := ne_of_gt hBpos -+ have htne : |t| ≠ 0 := ne_of_gt htpos -+ have hbne : b ≠ 0 := ne_of_gt (by linarith [hbgt1]) -+ -+ have hlog_bound : Real.log (b * |t| / ‖riemannZeta (3/2 + I * t)‖) ≤ -+ Real.log |t| + Real.log b + A := by -+ rw [Real.log_div hBne (ne_of_gt hζpos)] -+ rw [Real.log_mul hbne htne] -+ -+ have hA_bound := hA t -+ have : -Real.log ‖riemannZeta (3/2 + I * t)‖ ≤ A := by -+ have eq_neg : Real.log (1 / ‖riemannZeta (3/2 + I * t)‖) = -Real.log ‖riemannZeta (3/2 + I * t)‖ := by -+ rw [Real.log_div (by norm_num) (ne_of_gt hζpos)] -+ simp -+ rw [← eq_neg] -+ exact hA_bound -+ linarith -+ -+ have hcoeff_nonneg : (0 : ℝ) ≤ 16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) := by -+ apply add_nonneg -+ · apply div_nonneg -+ · apply mul_nonneg -+ · norm_num -+ · apply sq_nonneg -+ · apply le_of_lt -+ apply pow_pos -+ linarith [hr1_lt_r] -+ · apply div_nonneg -+ · norm_num -+ · apply le_of_lt -+ apply mul_pos -+ · -+ have h_gt : R > R1 := hR1_lt_R -+ have h1_pos : (1 : ℝ) < R/R1 := by -+ rw [one_lt_div] -+ · exact h_gt -+ · exact hR1_pos -+ have h_sq_div : R^2/R1 = R * (R/R1) := by -+ field_simp [ne_of_gt hR1_pos] -+ rw [h_sq_div] -+ have h_r_pos : (0 : ℝ) < R := by linarith [hR1_pos, h_gt] -+ have : R * (R/R1) > R * 1 := by -+ apply mul_lt_mul_of_pos_left h1_pos h_r_pos -+ simp at this -+ linarith [this] -+ · apply Real.log_pos -+ rw [one_lt_div] -+ · exact hR1_lt_R -+ · exact hR1_pos -+ -+ calc ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ -+ ≤ (16 * r^2 / ((r - r1)^3) + -+ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (b * |t| / ‖riemannZeta (3/2 + I * t)‖) := hexp -+ _ ≤ (16 * r^2 / ((r - r1)^3) + -+ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * (Real.log |t| + Real.log b + A) := by -+ exact mul_le_mul_of_nonneg_left hlog_bound hcoeff_nonneg -+ -+lemma helper_log_ratio_le_sum (b t x A : ℝ) -+ (hb : b > 1) (ht : 0 < |t|) (hx : 0 < x) (hA : Real.log (1 / x) ≤ A) : -+ Real.log ((b * |t|) / x) ≤ Real.log |t| + Real.log b + A := by -+ have hbpos : 0 < b := lt_trans (by norm_num) hb -+ have hb_ne : (b : ℝ) ≠ 0 := ne_of_gt hbpos -+ have ht_ne : |t| ≠ 0 := ne_of_gt ht -+ have hx_ne : x ≠ 0 := ne_of_gt hx -+ have h_inv_ne : (1 / x) ≠ 0 := one_div_ne_zero hx_ne -+ calc -+ Real.log ((b * |t|) / x) -+ = Real.log ((b * |t|) * (1 / x)) := by simp [div_eq_mul_inv] -+ _ = Real.log (b * |t|) + Real.log (1 / x) := by -+ exact Real.log_mul (mul_ne_zero hb_ne ht_ne) h_inv_ne -+ _ ≤ Real.log (b * |t|) + A := by -+ exact add_le_add_right hA (Real.log (b * |t|)) -+ _ = Real.log b + Real.log |t| + A := by -+ have hmul : Real.log (b * |t|) = Real.log b + Real.log |t| := -+ Real.log_mul hb_ne ht_ne -+ simp [hmul, add_comm] -+ _ = Real.log |t| + Real.log b + A := by -+ simp [add_comm] -+ -+lemma helper_bound_sum_by_Klog (t b A : ℝ) -+ (ht : |t| > 3) (hb : b > 1) (hA : A > 1) : -+ ∃ K > 1, Real.log |t| + Real.log b + A ≤ K * Real.log (|t| + 2) := by -+ -+ let S := Real.log b + A -+ let K := 1 + S / Real.log 5 -+ have hpos_t : 0 < |t| := lt_trans (by norm_num) ht -+ -+ have hle_log : Real.log |t| ≤ Real.log (|t| + 2) := by -+ apply Real.log_le_log -+ · exact hpos_t -+ · have hxle : |t| ≤ |t| + 2 := by -+ have h2 : (0 : ℝ) ≤ 2 := by norm_num -+ linarith -+ exact hxle -+ -+ have log5pos : 0 < Real.log (5 : ℝ) := by -+ have : (1 : ℝ) < 5 := by norm_num -+ exact Real.log_pos this -+ have Spos : 0 < S := by -+ have hlogbpos : 0 < Real.log b := Real.log_pos hb -+ have hApos : 0 < A := lt_trans (by norm_num) hA -+ exact add_pos hlogbpos hApos -+ have Kgt1 : 1 < K := by -+ have : 0 < S / Real.log 5 := div_pos Spos log5pos -+ simpa [K] using (lt_add_of_pos_right (1 : ℝ) this) -+ -+ have hlog5_le : Real.log 5 ≤ Real.log (|t| + 2) := by -+ apply Real.log_le_log -+ · exact (by norm_num : 0 < (5 : ℝ)) -+ · have : (5 : ℝ) < |t| + 2 := by linarith [ht] -+ exact le_of_lt this -+ have hfac_nonneg : 0 ≤ S / Real.log 5 := le_of_lt (div_pos Spos log5pos) -+ have hmul : (S / Real.log 5) * Real.log 5 ≤ (S / Real.log 5) * Real.log (|t| + 2) := -+ mul_le_mul_of_nonneg_left hlog5_le hfac_nonneg -+ have hleft : (S / Real.log 5) * Real.log 5 = S := by -+ have hne : (Real.log 5) ≠ 0 := ne_of_gt log5pos -+ field_simp [hne] -+ have hS_le : S ≤ (S / Real.log 5) * Real.log (|t| + 2) := by -+ simp [hleft] at hmul -+ exact hmul -+ -+ refine ⟨K, Kgt1, ?_⟩ -+ calc -+ Real.log |t| + Real.log b + A -+ = Real.log |t| + S := by -+ simp [S, add_comm, add_left_comm] -+ _ -+ ≤ Real.log (|t| + 2) + S := by -+ exact add_le_add_left hle_log S -+ _ -+ ≤ Real.log (|t| + 2) + (S / Real.log 5) * Real.log (|t| + 2) := by -+ exact add_le_add_right hS_le (Real.log (|t| + 2)) -+ _ = (1 + S / Real.log 5) * Real.log (|t| + 2) := by -+ ring -+ _ = K * Real.log (|t| + 2) := by rfl -+ _ = K * Real.log (|t| + 2) := by rfl -+ -+lemma Zeta1_Zeta_Expansion -+ (r1 r : ℝ) -+ (hr1_pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < 5 / (6 : ℝ)) : -+ ∃ C > 1, -+ ∀ (t : ℝ) (_ht : |t| > 3), -+ let c := (3/2 : ℂ) + I * t; -+ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), -+ ∀ z ∈ closedBall c r1 \ zerosetKfRc (5 / (6 : ℝ)) c riemannZeta, -+ ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ -+ C * (1 / (r - r1)^3 + 1) * Real.log |t| := by -+ -+ obtain ⟨A, hAgt1, b, hbgt1, hmain⟩ := Zeta1_Zeta_Expand -+ -+ let R1 : ℝ := 5 / 6 -+ let R : ℝ := 8 / 9 -+ have hR1_pos : 0 < R1 := by norm_num [R1] -+ have hR1_lt_R : R1 < R := by norm_num [R1, R] -+ have hR_lt_1 : R < 1 := by norm_num [R] -+ have hr_pos : 0 < r := lt_trans hr1_pos hr1_lt_r -+ -+ let d : ℝ := (r - r1) ^ 3 -+ have hd_pos : 0 < d := by -+ have : 0 < r - r1 := sub_pos.mpr hr1_lt_r -+ simpa [d] using pow_pos this 3 -+ let A0 : ℝ := 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) -+ have hA0_pos : 0 < A0 := by -+ have hx1 : 0 < R^2 / R1 - R1 := by -+ -+ norm_num [R, R1] -+ have hx2 : 0 < Real.log (R / R1) := by -+ -+ have : (1 : ℝ) < R / R1 := by norm_num [R, R1] -+ exact Real.log_pos this -+ have hxden : 0 < (R^2 / R1 - R1) * Real.log (R / R1) := mul_pos hx1 hx2 -+ simpa [A0] using (one_div_pos.mpr hxden) -+ -+ let K : ℝ := 16 * r^2 / d + A0 -+ -+ let S : ℝ := Real.log b + A -+ have hS_pos : 0 < S := by -+ have hbpos : 0 < Real.log b := Real.log_pos hbgt1 -+ have hApos : 0 < A := lt_trans (by norm_num) hAgt1 -+ exact add_pos hbpos hApos -+ -+ let Kcoeff : ℝ := max (16 * r^2) A0 -+ have hK_le : K ≤ Kcoeff * (1 / d + 1) := by -+ have hx_nonneg : 0 ≤ 1 / d := by -+ exact le_of_lt (one_div_pos.mpr hd_pos) -+ have hα_le : 16 * r^2 / d ≤ Kcoeff * (1 / d) := by -+ have hα : 16 * r^2 ≤ Kcoeff := le_max_left _ _ -+ have : (16 * r^2) * (1 / d) ≤ Kcoeff * (1 / d) := -+ mul_le_mul_of_nonneg_right hα hx_nonneg -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this -+ have hβ_le : A0 ≤ Kcoeff * 1 := by -+ have hβ : A0 ≤ Kcoeff := le_max_right _ _ -+ simpa using hβ -+ have : 16 * r^2 / d + A0 ≤ Kcoeff * (1 / d) + Kcoeff * 1 := -+ add_le_add hα_le hβ_le -+ simpa [K, mul_add, mul_one, add_comm, add_left_comm, add_assoc] using this -+ -+ let C : ℝ := max (Kcoeff * (1 + S / Real.log 3)) 2 -+ have hC_gt1 : 1 < C := by -+ have : (1 : ℝ) < 2 := by norm_num -+ exact lt_of_lt_of_le this (le_max_right _ _) -+ refine ⟨C, hC_gt1, ?_⟩ -+ -+ intro t ht -+ -+ simp only -+ intro hfin z hz -+ -+ have ht2 : |t| > 2 := by linarith [ht] -+ have hineq0 := -+ hmain t ht2 r1 r R1 R hr1_pos hr1_lt_r (lt_trans hr1_pos hr1_lt_r) hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 -+ have hineq1 := hineq0 hfin z hz -+ -+ have hK_eq : (16 * r^2 / (r - r1)^3 + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) = K := by -+ simp [K, A0, d, R1, R] -+ have hLS_eq : Real.log |t| + Real.log b + A = Real.log |t| + S := by -+ simp [S, add_comm, add_assoc] -+ have hineq2 : ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ -+ ≤ K * (Real.log |t| + S) := by -+ rw [← hK_eq, ← hLS_eq] -+ exact hineq1 -+ -+ have hlog3pos : 0 < Real.log (3 : ℝ) := by -+ have : (1 : ℝ) < 3 := by norm_num -+ exact Real.log_pos this -+ -+ have hpos_t : 0 < |t| := lt_trans (by norm_num) ht -+ have hL_ge_log3' : Real.log 3 ≤ Real.log |t| := by -+ have hge : (3 : ℝ) ≤ |t| := le_of_lt ht -+ exact Real.log_le_log (by norm_num) hge -+ have hratio_nonneg : 0 ≤ S / Real.log 3 := le_of_lt (div_pos hS_pos hlog3pos) -+ have hneq : Real.log 3 ≠ 0 := ne_of_gt hlog3pos -+ -+ have hS_le : S ≤ (S / Real.log 3) * Real.log |t| := by -+ -+ calc S -+ = (S / Real.log 3) * Real.log 3 := by simp [hneq] -+ _ ≤ (S / Real.log 3) * Real.log |t| := mul_le_mul_of_nonneg_left hL_ge_log3' hratio_nonneg -+ -+ have hsum_bound : Real.log |t| + S ≤ (1 + S / Real.log 3) * Real.log |t| := by -+ have hstep : Real.log |t| + S ≤ Real.log |t| + (S / Real.log 3) * Real.log |t| := -+ add_le_add_right hS_le (Real.log |t|) -+ -+ have h_factor : Real.log |t| + (S / Real.log 3) * Real.log |t| = (1 + S / Real.log 3) * Real.log |t| := by ring -+ rw [← h_factor] -+ exact hstep -+ -+ have hineq3 : ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ -+ ≤ K * ((1 + S / Real.log 3) * Real.log |t|) := -+ le_trans hineq2 (mul_le_mul_of_nonneg_left hsum_bound (by -+ have hr2_nonneg : 0 ≤ r^2 := by -+ have : 0 ≤ r * r := mul_nonneg (le_of_lt hr_pos) (le_of_lt hr_pos) -+ simpa [pow_two] using this -+ have hterm1 : 0 ≤ 16 * r^2 / d := -+ div_nonneg (mul_nonneg (by norm_num) hr2_nonneg) (le_of_lt hd_pos) -+ have : 0 ≤ K := add_nonneg hterm1 (le_of_lt hA0_pos) -+ exact this)) -+ -+ have hKcoeff : K * ((1 + S / Real.log 3) * Real.log |t|) -+ ≤ (Kcoeff * (1 / d + 1)) * ((1 + S / Real.log 3) * Real.log |t|) := -+ mul_le_mul_of_nonneg_right hK_le (by -+ have hLpos : 0 < Real.log |t| := -+ Real.log_pos (lt_trans (by norm_num) ht) -+ have hcoef_pos : 0 < 1 + S / Real.log 3 := -+ add_pos_of_pos_of_nonneg (by norm_num) (le_of_lt (div_pos hS_pos hlog3pos)) -+ have : 0 ≤ (1 + S / Real.log 3) * Real.log |t| := -+ le_of_lt (mul_pos hcoef_pos hLpos) -+ simpa using this) -+ -+ have hfinal := le_trans hineq3 hKcoeff -+ -+ have hC_ge : Kcoeff * (1 + S / Real.log 3) ≤ C := by -+ exact le_max_left _ _ -+ -+ have : (Kcoeff * (1 / d + 1)) * ((1 + S / Real.log 3) * Real.log |t|) -+ ≤ C * (1 / d + 1) * Real.log |t| := by -+ have hnonneg_term : 0 ≤ (1 / d + 1) * Real.log |t| := by -+ have h1 : 0 ≤ 1 / d := le_of_lt (one_div_pos.mpr hd_pos) -+ have h2 : 0 ≤ Real.log |t| := le_of_lt (Real.log_pos (lt_trans (by norm_num) ht)) -+ have : 0 ≤ (1 / d + 1) := add_nonneg h1 (by norm_num) -+ exact mul_nonneg this h2 -+ have hstep := mul_le_mul_of_nonneg_left hC_ge hnonneg_term -+ -+ simpa [mul_comm, mul_left_comm, mul_assoc] using hstep -+ -+ have hfinal_le := le_trans hfinal this -+ simp only [d] at hfinal_le -+ exact hfinal_le -+ -+end Erdos970 -diff --git a/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean b/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean -new file mode 100644 -index 0000000..37dfc62 ---- /dev/null -+++ b/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean -@@ -0,0 +1,6165 @@ -+import StrongPNT.Erdos970.PNT3_RiemannZeta -+import StrongPNT.Erdos970.Z0 -+ -+namespace Erdos970 -+ -+ -+def zeroZ : Set ℂ := {s : ℂ | riemannZeta s = 0} -+ -+def ZetaZerosNearPoint (t : ℝ) : Set ℂ := { ρ : ℂ | ρ ∈ zeroZ ∧ ‖ρ - ((3/2 : ℂ) + t * Complex.I)‖ ≤ (5/6 : ℝ) } -+ -+lemma ZetaZerosNearPoint_finite (t : ℝ) : Set.Finite (ZetaZerosNearPoint t) := by -+ -+ let c : ℂ := (3/2 : ℂ) + t * Complex.I -+ let R : ℝ := (5/6 : ℝ) -+ have hRpos : 0 < R := by norm_num -+ -+ let H : ℂ → ℂ := Function.update (fun s : ℂ => (s - 1) * riemannZeta s) 1 1 -+ have hH_diff : Differentiable ℂ H := by -+ -+ intro s -+ rcases eq_or_ne s 1 with rfl | hs -+ · -+ refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt -+ · -+ filter_upwards [self_mem_nhdsWithin] with t ht -+ -+ have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) t := by -+ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := -+ (differentiableAt_id.sub_const 1) -+ have h2 : DifferentiableAt ℂ riemannZeta t := -+ (differentiableAt_riemannZeta ht) -+ exact h1.mul h2 -+ apply DifferentiableAt.congr_of_eventuallyEq hdiff -+ filter_upwards [eventually_ne_nhds ht] with u hu using by -+ simp [H, Function.update_of_ne hu] -+ · -+ simpa [H, continuousAt_update_same] using riemannZeta_residue_one -+ · -+ have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) s := by -+ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) s := -+ (differentiableAt_id.sub_const 1) -+ have h2 : DifferentiableAt ℂ riemannZeta s := -+ (differentiableAt_riemannZeta hs) -+ exact h1.mul h2 -+ apply DifferentiableAt.congr_of_eventuallyEq hdiff -+ filter_upwards [eventually_ne_nhds hs] with u hu using by -+ simp [H, Function.update_of_ne hu] -+ -+ by_cases hPoleIn : ‖1 - c‖ ≤ R -+ · -+ let g : ℂ → ℂ := fun z => H (z + c) -+ -+ have hzeta_c_ne : riemannZeta c ≠ 0 := by -+ -+ have : c.re = (3/2 : ℝ) := by -+ simp [c, Complex.add_re, Complex.mul_re, Complex.I_re] -+ have hgt : c.re > 1 := by simpa [this] using (by norm_num : (3:ℝ)/2 > 1) -+ -+ exact riemannZeta_ne_zero_of_one_le_re (by -+ -+ have : (1 : ℝ) < c.re := hgt -+ exact le_of_lt this) -+ have hg_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) R, g z ≠ 0 := by -+ -+ have h0in : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by -+ simpa [Metric.mem_ball, Complex.dist_eq] using hRpos -+ refine ⟨0, h0in, ?_⟩ -+ -+ have hcne1 : c ≠ (1 : ℂ) := by -+ intro hc; have hcreq : c.re = 1 := by simp [hc, Complex.one_re] -+ have : (3 : ℝ) / 2 = (1 : ℝ) := by -+ simpa [c, Complex.add_re, Complex.mul_re, Complex.I_re] using hcreq -+ norm_num at this -+ have hHc : g 0 = H c := by simp [g] -+ have : g 0 = (c - 1) * riemannZeta c := by -+ simpa [H, Function.update_of_ne hcne1] using hHc -+ simpa [this] using mul_ne_zero (sub_ne_zero.mpr (by -+ -+ exact hcne1)) hzeta_c_ne -+ -+ let Kg : Set ℂ := {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ g ρ = 0} -+ -+ have h_subset : ZetaZerosNearPoint t ⊆ {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by -+ intro ρ hρ -+ rcases hρ with ⟨hzero, hdist⟩ -+ -+ have hball : ρ - c ∈ Metric.closedBall 0 R := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq, c, sub_eq_add_neg] using hdist -+ -+ have hρne1 : (ρ : ℂ) ≠ 1 := by -+ intro hρ1 -+ -+ have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) -+ exact hz1_ne (by simpa [hρ1] using! hzero) -+ have hsum : (ρ - c) + c = ρ := by simp [sub_add_cancel] -+ have hxne : (ρ - c) + c ≠ (1 : ℂ) := by simpa [hsum] using hρne1 -+ have hform : g (ρ - c) = (ρ - 1) * riemannZeta ρ := by -+ simp [g, H, hsum, Function.update_of_ne hxne] -+ have hzeroζ : riemannZeta ρ = 0 := hzero -+ have hzero' : g (ρ - c) = 0 := by simp [hform, hzeroζ] -+ exact ⟨hball, hzero'⟩ -+ -+ have hg_diff : Differentiable ℂ g := by -+ intro z -+ have hH := hH_diff (z + c) -+ have h_addc : DifferentiableAt ℂ (fun z : ℂ => z + c) z := -+ (differentiableAt_id.add_const c) -+ simpa [g] using! hH.comp z h_addc -+ have hg_analyticNhd_univ : AnalyticOnNhd ℂ g Set.univ := -+ (Complex.analyticOnNhd_univ_iff_differentiable).2 hg_diff -+ have hg_analyticNhd : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := -+ AnalyticOnNhd.mono hg_analyticNhd_univ (by intro z hz; simp) -+ have hNonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, g z ≠ 0 := by -+ rcases hg_nonzero with ⟨z, hz_in, hz_ne⟩ -+ -+ have hz_in' : z ∈ Metric.ball (0 : ℂ) 1 := by -+ have hRle : (R : ℝ) ≤ 1 := by norm_num -+ exact Metric.ball_subset_ball hRle hz_in -+ exact ⟨z, hz_in', hz_ne⟩ -+ have hfiniteKg : Set.Finite Kg := -+ (lem_Contra_finiteKR R hRpos (by norm_num : R < 1) g hg_analyticNhd hNonzero) -+ -+ have hTarget_eq : {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} = -+ (fun ρ : ℂ => ρ + c) '' Kg := by -+ ext ρ; constructor -+ · intro h -+ rcases h with ⟨hball, hzero⟩ -+ refine ⟨ρ - c, ⟨?_, ?_⟩, ?_⟩ -+ · exact hball -+ · exact hzero -+ · simp [sub_add_cancel] -+ · intro h -+ rcases h with ⟨z, ⟨hzball, hz0⟩, rfl⟩ -+ constructor -+ · simpa [sub_add_cancel] using hzball -+ · simpa [sub_add_cancel] using hz0 -+ -+ have hTarget_fin : Set.Finite {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by -+ have himg : Set.Finite ((fun ρ : ℂ => ρ + c) '' Kg) := hfiniteKg.image _ -+ -+ exact hTarget_eq ▸ himg -+ exact Set.Finite.subset hTarget_fin h_subset -+ · -+ let g : ℂ → ℂ := fun z => H (z + c) -+ -+ have hzeta_c_ne : riemannZeta c ≠ 0 := by -+ have : c.re = (3/2 : ℝ) := by -+ simp [c, Complex.add_re, Complex.mul_re, Complex.I_re] -+ have hgt : c.re > 1 := by simpa [this] using (by norm_num : (3:ℝ)/2 > 1) -+ exact riemannZeta_ne_zero_of_one_le_re (le_of_lt hgt) -+ have hg_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) R, g z ≠ 0 := by -+ have h0in : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by -+ simpa [Metric.mem_ball, Complex.dist_eq] using hRpos -+ refine ⟨0, h0in, ?_⟩ -+ have hcne1 : c ≠ (1 : ℂ) := by -+ intro hc; have hcreq : c.re = 1 := by simp [hc, Complex.one_re] -+ have : (3 : ℝ) / 2 = (1 : ℝ) := by -+ simpa [c, Complex.add_re, Complex.mul_re, Complex.I_re] using hcreq -+ norm_num at this -+ -+ have hHc : g 0 = H c := by simp [g] -+ have : g 0 = (c - 1) * riemannZeta c := by -+ simpa [H, Function.update_of_ne hcne1] using hHc -+ simpa [this] using mul_ne_zero (sub_ne_zero.mpr hcne1) hzeta_c_ne -+ -+ let Kg : Set ℂ := {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ g ρ = 0} -+ -+ have h_subset : ZetaZerosNearPoint t ⊆ {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by -+ intro ρ hρ -+ rcases hρ with ⟨hzero, hdist⟩ -+ have hball : ρ - c ∈ Metric.closedBall 0 R := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq, c, sub_eq_add_neg] using hdist -+ have hρne1 : (ρ : ℂ) ≠ 1 := by -+ intro hρ1 -+ have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) -+ exact hz1_ne (by simpa [hρ1] using! hzero) -+ have hsum : (ρ - c) + c = ρ := by simp [sub_add_cancel] -+ have hxne : (ρ - c) + c ≠ (1 : ℂ) := by simpa [hsum] using hρne1 -+ have hform : g (ρ - c) = (ρ - 1) * riemannZeta ρ := by -+ simp [g, H, hsum, Function.update_of_ne hxne] -+ -+ have hzeroζ : riemannZeta ρ = 0 := hzero -+ have hzero' : g (ρ - c) = 0 := by -+ calc -+ g (ρ - c) = (ρ - 1) * riemannZeta ρ := hform -+ _ = (ρ - 1) * 0 := by simp [hzeroζ] -+ _ = 0 := by simp -+ exact ⟨hball, hzero'⟩ -+ -+ have hg_diff : Differentiable ℂ g := by -+ intro z -+ have hH := hH_diff (z + c) -+ have h_addc : DifferentiableAt ℂ (fun z : ℂ => z + c) z := -+ (differentiableAt_id.add_const c) -+ simpa [g] using! hH.comp z h_addc -+ have hg_analyticNhd_univ : AnalyticOnNhd ℂ g Set.univ := -+ (Complex.analyticOnNhd_univ_iff_differentiable).2 hg_diff -+ have hg_analyticNhd : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := -+ AnalyticOnNhd.mono hg_analyticNhd_univ (by intro z hz; simp) -+ have hNonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, g z ≠ 0 := by -+ rcases hg_nonzero with ⟨z, hz_in, hz_ne⟩ -+ have hz_in' : z ∈ Metric.ball (0 : ℂ) 1 := by -+ have hRle : (R : ℝ) ≤ 1 := by norm_num -+ exact Metric.ball_subset_ball hRle hz_in -+ exact ⟨z, hz_in', hz_ne⟩ -+ have hfiniteKg : Set.Finite Kg := -+ (lem_Contra_finiteKR R hRpos (by norm_num : R < 1) g hg_analyticNhd hNonzero) -+ have hTarget_eq : {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} = -+ (fun ρ : ℂ => ρ + c) '' Kg := by -+ ext ρ; constructor -+ · intro h -+ rcases h with ⟨hball, hzero⟩ -+ refine ⟨ρ - c, ⟨?_, ?_⟩, ?_⟩ -+ · exact hball -+ · exact hzero -+ · simp [sub_add_cancel] -+ · intro h -+ rcases h with ⟨z, ⟨hzball, hz0⟩, rfl⟩ -+ constructor -+ · simpa [sub_add_cancel] using hzball -+ · simpa [sub_add_cancel] using hz0 -+ have hTarget_fin : Set.Finite {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by -+ have himg : Set.Finite ((fun ρ : ℂ => ρ + c) '' Kg) := hfiniteKg.image _ -+ exact hTarget_eq ▸ himg -+ exact Set.Finite.subset hTarget_fin h_subset -+ -+lemma lem_Re1zge0 (z : ℂ) : z.re > 0 → (1 / z).re > 0 := by -+ intro h -+ -+ have hz_ne_zero : z ≠ 0 := by -+ intro hz_eq_zero -+ rw [hz_eq_zero] at h -+ simp at h -+ -+ rw [one_div] -+ -+ rw [Complex.inv_re] -+ -+ apply div_pos h -+ -+ rwa [Complex.normSq_pos] -+ -+lemma lem_sigmage1 (sigma t : ℝ) (hsigma : sigma > 1) : riemannZeta (sigma + t * Complex.I) ≠ 0 := by -+ apply riemannZeta_ne_zero_of_one_le_re -+ simp [Complex.add_re, Complex.mul_re, Complex.I_re] -+ linarith -+ -+lemma lem_sigmale1 (sigma1 t1 : ℝ) : riemannZeta (sigma1 + t1 * Complex.I) = 0 → sigma1 ≤ 1 := by -+ intro h -+ -+ by_contra h_not_le -+ -+ push Not at h_not_le -+ -+ have h_nonzero := lem_sigmage1 sigma1 t1 h_not_le -+ -+ exact h_nonzero h -+ -+lemma lem_sigmale1Zt (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : rho1.re ≤ 1 := by -+ -+ have h1 : rho1 ∈ zeroZ := h_rho1_in_Zt.1 -+ -+ have h2 : riemannZeta rho1 = 0 := h1 -+ -+ have h3 : rho1 = rho1.re + rho1.im * Complex.I := by simp [Complex.re_add_im] -+ -+ rw [h3] at h2 -+ -+ exact lem_sigmale1 rho1.re rho1.im h2 -+ -+lemma lem_s_notin_Zt (δ : ℝ) (hδ : 0 < δ) (t : ℝ) : -+ ((1 : ℂ) + δ + t * Complex.I) ∉ ZetaZerosNearPoint t := by -+ intro hmem -+ -+ have h_zero : riemannZeta ((1 : ℂ) + δ + t * Complex.I) = 0 := hmem.1 -+ -+ have h_gt : (1 : ℝ) + δ > 1 := by linarith [hδ] -+ have h_nonzero := lem_sigmage1 (1 + δ) t h_gt -+ -+ have h_coercion : (1 : ℂ) + δ = ↑(1 + δ) := by simp [Complex.ofReal_add] -+ -+ rw [h_coercion] at h_zero -+ exact h_nonzero h_zero -+ -+lemma complex_abs_of_real (x : ℝ) : ‖(x : ℂ)‖ = abs x := by -+ rw [Complex.norm_real, Real.norm_eq_abs] -+ -+lemma complex_add_real_imag_parts (a b : ℝ) (t : ℝ) : -+ ((a : ℂ) + b + t * Complex.I).re = a + b ∧ ((a : ℂ) + b + t * Complex.I).im = t := by -+ constructor -+ -+ · rw [Complex.add_re, Complex.add_re] -+ -+ simp [Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im] -+ -+ · rw [Complex.add_im, Complex.add_im] -+ -+ simp [Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im] -+ -+lemma complex_abs_real_cast (r : ℝ) : ‖(r : ℂ)‖ = abs r := Complex.norm_real r -+ -+lemma isBigO_comp_principal_domain {α β E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] -+ {f : β → E} {g : β → F} {h : α → β} {l : Filter α} {s : Set β} -+ (hfg : f =O[Filter.principal s] g) -+ (h_domain : ∀ᶠ x in l, h x ∈ s) : -+ (f ∘ h) =O[l] (g ∘ h) := by -+ -+ have h_le : Filter.map h l ≤ Filter.principal s := by -+ intro t ht -+ -+ rw [Filter.mem_principal] at ht -+ -+ rw [Filter.mem_map] -+ -+ rw [Filter.eventually_iff] at h_domain -+ -+ apply Filter.mem_of_superset h_domain -+ intro x hx -+ exact ht hx -+ -+ have hfg_map : f =O[Filter.map h l] g := Asymptotics.IsBigO.mono hfg h_le -+ -+ rwa [Asymptotics.isBigO_map] at hfg_map -+ -+lemma isBigOWith_comp_principal_domain {α β E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] -+ {C : ℝ} {f : β → E} {g : β → F} {h : α → β} {l : Filter α} {s : Set β} -+ (hfg : Asymptotics.IsBigOWith C (Filter.principal s) f g) -+ (h_domain : ∀ᶠ x in l, h x ∈ s) : -+ Asymptotics.IsBigOWith C l (f ∘ h) (g ∘ h) := by -+ -+ rw [Asymptotics.isBigOWith_iff, Filter.eventually_principal] at hfg -+ -+ rw [Asymptotics.isBigOWith_iff] -+ -+ filter_upwards [h_domain] with x hx_in_s -+ -+ exact hfg (h x) hx_in_s -+ -+lemma s_in_D12 (delta : ℝ) (hdelta_pos : 0 < delta) (t : ℝ) (hdelta_lt : delta < 1) : -+ ((1 : ℂ) + (delta : ℝ) + (t : ℝ) * Complex.I) ∈ -+ Metric.ball ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) (1 / 2) := by -+ -+ rw [Metric.mem_ball] -+ -+ have h1 : ((1 : ℂ) + (delta : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) = -+ (1 : ℂ) + (delta : ℝ) - (3 / 2 : ℂ) := by ring -+ -+ have h2 : (1 : ℂ) + (delta : ℝ) - (3 / 2 : ℂ) = (delta - 1/2 : ℝ) := by -+ simp [Complex.ofReal_sub] -+ ring -+ -+ rw [Complex.dist_eq, h1, h2, Complex.norm_real] -+ -+ rw [Real.norm_eq_abs] -+ -+ have h3 : abs (delta - 1/2) < 1/2 := by -+ rw [abs_lt] -+ constructor -+ · -+ linarith [hdelta_pos] -+ · -+ linarith [hdelta_lt] -+ exact h3 -+ -+lemma zerosetKfRc_eq_ZetaZerosNearPoint (t : ℝ) : -+ zerosetKfRc (5/6 : ℝ) ((3/2 : ℂ) + t * Complex.I) riemannZeta = ZetaZerosNearPoint t := by -+ ext ρ; constructor -+ · intro h -+ rcases h with ⟨hball, hzero⟩ -+ refine ⟨?hz, ?hnorm⟩ -+ · simpa [zeroZ] using hzero -+ · simpa [Metric.mem_closedBall, Complex.dist_eq, sub_eq_add_neg] using hball -+ · intro h -+ rcases h with ⟨hz, hnorm⟩ -+ refine ⟨?hball, ?hzero⟩ -+ · simpa [Metric.mem_closedBall, Complex.dist_eq, sub_eq_add_neg] using hnorm -+ · simpa [zeroZ] using hz -+ -+lemma mem_closedBall_of_mem_ball {x c : ℂ} {r : ℝ} (hx : x ∈ Metric.ball c r) : -+ x ∈ Metric.closedBall c r := by -+ exact (Metric.ball_subset_closedBall) hx -+ -+lemma I_mul_real_eq_real_mul_I (t : ℝ) : -+ (Complex.I : ℂ) * (t : ℂ) = (t : ℂ) * Complex.I := by -+ simpa using mul_comm (Complex.I : ℂ) (t : ℂ) -+ -+lemma center_eq_comm (t : ℝ) : -+ ((3/2 : ℂ) + (Complex.I : ℂ) * (t : ℂ)) = ((3/2 : ℂ) + (t : ℂ) * Complex.I) := by -+ have h : (Complex.I : ℂ) * (t : ℂ) = (t : ℂ) * Complex.I := by -+ simpa using mul_comm (Complex.I : ℂ) (t : ℂ) -+ simp [h] -+ -+lemma log_abs_le_log_abs_add_two {t : ℝ} (ht : 2 < |t|) : -+ Real.log (abs t) ≤ Real.log (abs t + 2) := by -+ have hpos : 0 < |t| := lt_trans (by norm_num) ht -+ have hle : |t| ≤ |t| + 2 := by nlinarith -+ simpa using Real.log_le_log hpos hle -+ -+lemma s_notin_ZetaZerosNearPoint (δ t : ℝ) (hδ_pos : 0 < δ) : -+ ((1 : ℂ) + δ + t * Complex.I) ∉ ZetaZerosNearPoint t := by -+ intro hmem -+ have hz0 : riemannZeta ((1 : ℂ) + δ + t * Complex.I) = 0 := hmem.1 -+ have : ((1 : ℂ) + δ + t * Complex.I).re = 1 + δ := by simp -+ have hpos : (1 : ℝ) < 1 + δ := by linarith -+ have hnonzero := lem_sigmage1 (1 + δ) t hpos -+ exact hnonzero (by simpa using hz0) -+ -+lemma norm_sub_comm' (x y : ℂ) : ‖x - y‖ = ‖y - x‖ := by -+ calc -+ ‖x - y‖ = ‖-(x - y)‖ := by simpa using (norm_neg (x - y)).symm -+ _ = ‖y - x‖ := by simp [neg_sub] -+ -+lemma s_in_closedBall_12 (δ t : ℝ) (hδ_pos : 0 < δ) (hδ_lt : δ < 1) : -+ ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) ∈ -+ Metric.closedBall ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) (1 / 2) := by -+ -+ have hdiff : -+ ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) -+ = ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) := by -+ simp -+ have hreal : -+ ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) = ((δ - (1 / 2 : ℝ)) : ℂ) := by -+ have h' : ((1 + δ : ℝ) - (3 / 2 : ℝ)) = δ - (1 / 2 : ℝ) := by -+ calc -+ (1 + δ) - (3 / 2 : ℝ) = δ + 1 - (3 / 2 : ℝ) := by ac_rfl -+ _ = δ + (1 - (3 / 2 : ℝ)) := by simp [add_sub_assoc] -+ _ = δ + (- (1 / 2 : ℝ)) := by norm_num -+ _ = δ - (1 / 2 : ℝ) := by simp [sub_eq_add_neg] -+ calc -+ ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) -+ = ((1 + δ : ℝ) : ℂ) - (3 / 2 : ℂ) := by -+ simp [add_comm] -+ _ = (↑((1 + δ : ℝ) - (3 / 2 : ℝ)) : ℂ) := by -+ simp [Complex.ofReal_sub] -+ _ = ((δ - (1 / 2 : ℝ)) : ℂ) := by simp [h'] -+ have hnormle : -+ ‖((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I)‖ -+ ≤ (1 / 2 : ℝ) := by -+ calc -+ ‖((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I)‖ -+ = ‖((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ)‖ := by simp [hdiff] -+ _ = ‖((δ - (1 / 2 : ℝ)) : ℂ)‖ := by simp [hreal] -+ _ = |δ - (1 / 2 : ℝ)| := by simpa using complex_abs_real_cast (δ - (1 / 2 : ℝ)) -+ _ ≤ 1 / 2 := by -+ have hleft : - (1 / 2 : ℝ) ≤ δ - 1 / 2 := by linarith [hδ_pos] -+ have hright : δ - 1 / 2 ≤ 1 / 2 := by linarith [hδ_lt] -+ simpa using (abs_le.mpr ⟨hleft, hright⟩) -+ -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hnormle -+ -+lemma lem_explicit1deltat : -+ ∃ C > 1, -+ ∀ t : ℝ, 2 < |t| → -+ ∀ δ : ℝ, 0 < δ ∧ δ < 1 → -+ ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) -+ (fun rho1 : ℂ => -+ ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / -+ (((1 : ℂ) + δ + t * Complex.I) - rho1)) -+ - logDerivZeta ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I)‖ -+ ≤ C * Real.log (abs t + 2) := by -+ classical -+ -+ let r1 : ℝ := (1/2 : ℝ) -+ let r : ℝ := (2/3 : ℝ) -+ let R1 : ℝ := (5/6 : ℝ) -+ let R : ℝ := (9/10 : ℝ) -+ have hr1_pos : 0 < r1 := by norm_num -+ have hr_pos : 0 < r := by norm_num -+ have hr1_lt_r : r1 < r := by norm_num -+ have hr_lt_R1 : r < R1 := by norm_num -+ have hR1_pos : 0 < R1 := by norm_num -+ have hR1_lt_R : R1 < R := by norm_num -+ have hR_lt_1 : R < 1 := by norm_num -+ -+ let F : ℝ := (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) -+ -+ obtain ⟨b, hb_gt1, hb_bound⟩ := zeta32upper -+ obtain ⟨A, hA_gt1, hA_bound⟩ := zeta32lower_log -+ -+ let K : ℝ := 1 + (Real.log b + A) / Real.log 4 -+ -+ let C : ℝ := max (F * K) 2 -+ have hC_gt1 : 1 < C := by -+ have : (1 : ℝ) < 2 := by norm_num -+ exact lt_of_lt_of_le this (le_max_right _ _) -+ refine ⟨C, hC_gt1, ?_⟩ -+ -+ intro t ht δ hδ -+ rcases hδ with ⟨hδ_pos, hδ_lt1⟩ -+ -+ let c_std : ℂ := ((3/2 : ℂ) + Complex.I * (t : ℂ)) -+ let c_comm : ℂ := ((3/2 : ℂ) + (t : ℝ) * Complex.I) -+ have hcenter_eq : c_std = c_comm := by simpa [c_std, c_comm] using (center_eq_comm t) -+ let s : ℂ := (1 : ℂ) + δ + t * Complex.I -+ -+ have hs_mem_comm : s ∈ Metric.closedBall c_comm r1 := s_in_closedBall_12 δ t hδ_pos hδ_lt1 -+ have hs_mem_std : s ∈ Metric.closedBall c_std r1 := by simpa [c_std, c_comm, hcenter_eq] using hs_mem_comm -+ -+ have hs_notin_Zt : s ∉ ZetaZerosNearPoint t := s_notin_ZetaZerosNearPoint δ t hδ_pos -+ have hzeros_eq : zerosetKfRc (5/6 : ℝ) c_comm riemannZeta = ZetaZerosNearPoint t := by -+ simpa [c_comm] using zerosetKfRc_eq_ZetaZerosNearPoint t -+ have hs_notin_comm : s ∉ zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by simpa [hzeros_eq] using hs_notin_Zt -+ have hs_notin_std : s ∉ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [c_std, c_comm, hcenter_eq] using hs_notin_comm -+ -+ have hfin_comm : (zerosetKfRc (5/6 : ℝ) c_comm riemannZeta).Finite := by -+ simpa [hzeros_eq] using (ZetaZerosNearPoint_finite t) -+ have hfin_std : (zerosetKfRc (5/6 : ℝ) c_std riemannZeta).Finite := by -+ simpa [c_std, c_comm, hcenter_eq] using hfin_comm -+ -+ have h_bound_R : ∀ z ∈ Metric.closedBall c_std R, ‖riemannZeta z‖ < b * |t| := by -+ intro z hz -+ have hsubs : Metric.closedBall c_std R ⊆ Metric.closedBall c_std (1 : ℝ) := by -+ intro w hw; exact Metric.closedBall_subset_closedBall (by norm_num : (R : ℝ) ≤ (1 : ℝ)) hw -+ exact hb_bound t (by simpa using ht) z (hsubs hz) -+ -+ have hmain := -+ log_Deriv_Expansion_Zeta t ht -+ r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 -+ -+ have hbpos : 0 < b := lt_trans (by norm_num) hb_gt1 -+ have ht1 : 1 < |t| := lt_trans (by norm_num) ht -+ have hmul : b * 1 < b * |t| := (mul_lt_mul_of_pos_left ht1 hbpos) -+ have hB_gt1 : 1 < b * |t| := lt_trans hb_gt1 (by simpa using hmul) -+ have hineq := hmain (b * |t|) hB_gt1 h_bound_R -+ have hz_in : s ∈ Metric.closedBall c_std r1 \ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := ⟨hs_mem_std, hs_notin_std⟩ -+ have hineq2 := hineq hfin_std s hz_in -+ -+ have hFinset_eq : hfin_std.toFinset = (ZetaZerosNearPoint_finite t).toFinset := by -+ ext ρ; constructor <;> intro hρ -+ · have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [Set.mem_toFinset] using hρ -+ have : ρ ∈ ZetaZerosNearPoint t := by -+ have heq : zerosetKfRc (5/6 : ℝ) c_std riemannZeta = zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by -+ -+ simp [c_std, c_comm, hcenter_eq] -+ simpa [hzeros_eq, heq] -+ using this -+ simpa [Set.mem_toFinset] using this -+ · have : ρ ∈ ZetaZerosNearPoint t := by simpa [Set.mem_toFinset] using hρ -+ have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by simpa [hzeros_eq] using this -+ have heq : zerosetKfRc (5/6 : ℝ) c_std riemannZeta = zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by -+ simp [c_std, c_comm, hcenter_eq] -+ have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [heq] using this -+ simpa [Set.mem_toFinset] using this -+ have hLHS_le : -+ ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) -+ (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1)) -+ - logDerivZeta s‖ -+ ≤ F * Real.log (b * |t| / ‖riemannZeta c_std‖) := by -+ have : -+ ‖logDerivZeta s - -+ Finset.sum (hfin_std.toFinset) -+ (fun ρ : ℂ => ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (s - ρ))‖ -+ ≤ F * Real.log (b * |t| / ‖riemannZeta c_std‖) := by -+ simpa [F] using! hineq2 -+ simpa [norm_sub_comm', hFinset_eq] -+ using this -+ -+ have hc_ne : riemannZeta c_std ≠ 0 := by simpa [c_std] using! zetacnot0 t -+ have hnorm_pos : 0 < ‖riemannZeta c_std‖ := by simpa [norm_pos_iff] using hc_ne -+ have hnorm_ne : ‖riemannZeta c_std‖ ≠ 0 := ne_of_gt hnorm_pos -+ have hb_ne : b ≠ 0 := ne_of_gt hbpos -+ have htpos0 : 0 < |t| := lt_trans (by norm_num) ht -+ have ht_ne : |t| ≠ 0 := ne_of_gt htpos0 -+ have hlog_mul1 : -+ Real.log (b * |t| / ‖riemannZeta c_std‖) -+ = Real.log (b * |t|) + Real.log (1 / ‖riemannZeta c_std‖) := by -+ simpa [div_eq_mul_inv] using Real.log_mul (mul_ne_zero hb_ne ht_ne) (inv_ne_zero hnorm_ne) -+ have hlog_mul2 : Real.log (b * |t|) = Real.log b + Real.log (|t|) := by -+ simpa using Real.log_mul hb_ne ht_ne -+ have hζ_log_le : Real.log (1 / ‖riemannZeta c_std‖) ≤ A := by -+ simpa [c_std] using! hA_bound t -+ have hlog_bound1 : -+ Real.log (b * |t| / ‖riemannZeta c_std‖) -+ ≤ (Real.log b + Real.log (|t|)) + A := by -+ have := add_le_add_right hζ_log_le (Real.log (b * |t|)) -+ simpa [hlog_mul1, hlog_mul2, add_comm, add_left_comm, add_assoc] using this -+ -+ have hlog_mono : Real.log (|t|) ≤ Real.log (|t| + 2) := -+ log_abs_le_log_abs_add_two (by simpa using ht) -+ have hlog_bound2 : -+ Real.log (b * |t| / ‖riemannZeta c_std‖) -+ ≤ Real.log (|t| + 2) + (Real.log b + A) := by -+ have : Real.log b + Real.log (|t|) + A ≤ Real.log b + Real.log (|t| + 2) + A := by -+ have := add_le_add_right hlog_mono (Real.log b) -+ simpa [add_comm, add_left_comm, add_assoc] using add_le_add_left this A -+ exact le_trans hlog_bound1 (by simpa [add_comm, add_left_comm, add_assoc] using this) -+ -+ have hlog5pos : 0 < Real.log 4 := Real.log_pos (by norm_num : (1 : ℝ) < 4) -+ have hge5 : Real.log 4 ≤ Real.log (|t| + 2) := by -+ have hxy : (4 : ℝ) ≤ |t| + 2 := by nlinarith [le_of_lt ht] -+ exact Real.log_le_log (by norm_num) hxy -+ have hconst_nonneg : 0 ≤ Real.log b + A := by -+ have hbposlog : 0 < Real.log b := Real.log_pos hb_gt1 -+ have hApos : 0 < A := lt_trans (by norm_num) hA_gt1 -+ have : 0 ≤ Real.log b := le_of_lt hbposlog -+ nlinarith -+ have hnonneg : 0 ≤ (Real.log b + A) / Real.log 4 := div_nonneg hconst_nonneg (le_of_lt hlog5pos) -+ have hne5 : Real.log 4 ≠ 0 := ne_of_gt hlog5pos -+ have hconst_bound : (Real.log b + A) -+ ≤ (Real.log b + A) / Real.log 4 * Real.log (|t| + 2) := by -+ have := mul_le_mul_of_nonneg_left hge5 hnonneg -+ -+ have : ((Real.log b + A) / Real.log 4) * Real.log 4 ≤ (Real.log b + A) / Real.log 4 * Real.log (|t| + 2) := this -+ -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hne5] using this -+ have hlog_bound3 : -+ Real.log (|t| + 2) + (Real.log b + A) -+ ≤ K * Real.log (|t| + 2) := by -+ have := add_le_add_right hconst_bound (Real.log (|t| + 2)) -+ -+ simpa [K, mul_add, add_comm, add_left_comm, add_assoc, mul_comm, mul_left_comm, mul_assoc, one_mul] -+ using this -+ have hlog_bound_final : -+ Real.log (b * |t| / ‖riemannZeta c_std‖) -+ ≤ K * Real.log (|t| + 2) := le_trans hlog_bound2 hlog_bound3 -+ -+ have hF_nonneg : 0 ≤ F := by -+ have h1 : 0 ≤ 16 * r ^ 2 / (r - r1) ^ 3 := by -+ have hnum : 0 ≤ 16 * r ^ 2 := by -+ have : 0 ≤ (16 : ℝ) := by norm_num -+ have : 0 ≤ r ^ 2 := by -+ have := sq_nonneg r -+ simpa [pow_two] using this -+ simpa [mul_comm] using mul_nonneg (show 0 ≤ (16 : ℝ) by norm_num) this -+ have hden : 0 < (r - r1) ^ 3 := by -+ have : 0 < r - r1 := sub_pos.mpr hr1_lt_r -+ simpa using pow_pos this 3 -+ exact div_nonneg hnum (le_of_lt hden) -+ have h2 : 0 ≤ 1 / ((R ^ 2 / R1 - R1) * Real.log (R / R1)) := by -+ -+ have hden1 : 0 < (R ^ 2 / R1 - R1) := by -+ change 0 < ((9/10 : ℝ) ^ 2 / (5/6 : ℝ) - (5/6 : ℝ)) -+ norm_num -+ have hden2 : 0 < Real.log (R / R1) := by -+ have : 1 < R / R1 := by -+ change (1 : ℝ) < (9/10 : ℝ) / (5/6 : ℝ) -+ norm_num -+ exact Real.log_pos this -+ have hpos : 0 < ((R ^ 2 / R1 - R1) * Real.log (R / R1)) := mul_pos hden1 hden2 -+ exact le_of_lt (one_div_pos.mpr hpos) -+ have := add_nonneg h1 h2 -+ simpa [F] using this -+ -+ have hY_nonneg : 0 ≤ Real.log (|t| + 2) := by -+ -+ have hgt1 : (1 : ℝ) < |t| + 2 := by -+ have : (2 : ℝ) ≤ |t| + 2 := by -+ have : 0 ≤ |t| := abs_nonneg t -+ simp -+ exact lt_of_lt_of_le (by norm_num) this -+ exact le_of_lt (Real.log_pos hgt1) -+ have hfinal1 : -+ ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) -+ (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1)) -+ - logDerivZeta s‖ -+ ≤ F * (K * Real.log (|t| + 2)) := -+ le_trans hLHS_le (by exact mul_le_mul_of_nonneg_left hlog_bound_final hF_nonneg) -+ have hFactor_leC : F * K ≤ C := by exact le_trans (le_of_eq rfl) (le_max_left _ _) -+ have hfinal2 : F * (K * Real.log (|t| + 2)) ≤ C * Real.log (|t| + 2) := by -+ have := mul_le_mul_of_nonneg_right hFactor_leC hY_nonneg -+ simpa [mul_comm, mul_left_comm, mul_assoc] using this -+ have := le_trans hfinal1 hfinal2 -+ simpa [s] -+ -+lemma lem_explicit1RealReal : -+ ∃ C > 1, -+ ∀ t : ℝ, 2 < |t| → -+ ∀ δ : ℝ, 0 < δ ∧ δ < 1 → -+ abs ((logDerivZeta ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I)).re -+ - (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) -+ (fun rho1 : ℂ => -+ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / -+ (((1 : ℂ) + δ + t * Complex.I) - rho1)).re))) -+ ≤ C * Real.log (|t| + 2) := by -+ rcases lem_explicit1deltat with ⟨C, hCpos, hE⟩ -+ refine ⟨C, hCpos, ?_⟩ -+ intro t ht δ hδ -+ -+ let s : ℂ := (1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I -+ let S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite t) -+ let g : ℂ → ℂ := fun rho1 : ℂ => -+ ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1) -+ -+ have ht' : ‖logDerivZeta s - ∑ rho1 ∈ S, g rho1‖ -+ ≤ C * Real.log (abs t + 2) := by -+ -+ have h_app := hE t ht δ hδ -+ rw [norm_sub_rev] at h_app -+ exact h_app -+ -+ have hleft_eq : -+ abs ((logDerivZeta s).re - ∑ rho1 ∈ S, (g rho1).re) -+ = abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) := by -+ simp [Complex.sub_re, Complex.re_sum] -+ -+ have hbound : -+ abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) -+ ≤ ‖logDerivZeta s - ∑ rho1 ∈ S, g rho1‖ := by -+ simpa using Complex.abs_re_le_norm (logDerivZeta s - ∑ rho1 ∈ S, g rho1) -+ -+ have hfinal : -+ abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) -+ ≤ C * Real.log (abs t + 2) := -+ le_trans hbound ht' -+ -+ have hnorm : |t| = abs t := rfl -+ simpa [s, S, g, hleft_eq, hnorm] using hfinal -+ -+lemma lem_explicit2Real : -+ ∃ C > 1, -+ ∀ t : ℝ, 2 < |t| → -+ ∀ δ : ℝ, 0 < δ ∧ δ < 1 → -+ abs ( -+ (logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I)).re -+ - (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) -+ (fun rho1 : ℂ => -+ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / -+ (((1 : ℂ) + δ + (2 * t) * Complex.I) - rho1)).re)) -+ ) -+ ≤ C * Real.log (abs (2 * t) + 2) := by -+ rcases lem_explicit1RealReal with ⟨C, hCpos, hEv⟩ -+ refine ⟨C, hCpos, ?_⟩ -+ intro t ht δ hδ -+ -+ have h_2t : 2 < |2 * t| := by -+ rw [abs_mul, abs_two] -+ linarith [ht] -+ have h_bound := hEv (2 * t) h_2t δ hδ -+ -+ simp only [Complex.ofReal_mul] at h_bound -+ exact h_bound -+ -+lemma lem_Realsum {α : Type*} (s : Finset α) (f : α → ℂ) : (Finset.sum s f).re = Finset.sum s (fun i => (f i).re) := by -+ exact Complex.re_sum s f -+ -+lemma lem_Ztfinite (t : ℝ) : Set.Finite (ZetaZerosNearPoint t) := ZetaZerosNearPoint_finite t -+ -+lemma lem_sumrho1 (t : ℝ) (δ : ℝ) (_hdelta_pos : δ > 0) (_hdelta_lt1 : δ < 1) : -+ (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) -+ (fun rho1 : ℂ => -+ ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / -+ (((1 : ℂ) + δ + t * Complex.I) - rho1))).re = -+ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) -+ (fun rho1 : ℂ => -+ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / -+ (((1 : ℂ) + δ + t * Complex.I) - rho1)).re) := by -+ exact lem_Realsum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) _ -+ -+lemma lem_sumrho2 (t : ℝ) (delta : ℝ) (_hdelta : delta > 0) (_hdelta_lt1 : delta < 1) : -+ (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) -+ (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1))).re = -+ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) -+ (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1)).re) := by -+ rw [Complex.re_sum] -+ -+lemma lem_1deltatrho1 (delta : ℝ) (_hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (_h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ((1 : ℂ) + delta + t * Complex.I - rho1) = ((1 : ℝ) + delta - rho1.re) + (t - rho1.im) * Complex.I := by -+ -+ conv_lhs => rw [← Complex.re_add_im rho1] -+ -+ simp only [sub_add_eq_sub_sub] -+ -+ ring_nf -+ -+ simp only [Complex.ofReal_one] -+ ring -+ -+lemma lem_Re1deltatrho1 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : -+((1 : ℂ) + delta + t * Complex.I - rho1).re = (1 : ℝ) + delta - rho1.re := by -+ -+ rw [lem_1deltatrho1 delta hdelta t rho1 h_rho1_in_Zt] -+ -+ rw [Complex.add_re] -+ -+ rw [Complex.mul_I_re] -+ -+ simp -+ -+lemma lem_Re1delta1 (delta : ℝ) (_hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : -+(1 : ℝ) + delta - rho1.re ≥ delta := by -+ -+ have h_rho1_re_le_1 : rho1.re ≤ 1 := lem_sigmale1Zt t rho1 h_rho1_in_Zt -+ -+ have h_nonneg : 1 - rho1.re ≥ 0 := by linarith -+ -+ linarith -+ -+lemma lem_Re1deltatge (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ((1 : ℂ) + delta + t * Complex.I - rho1).re ≥ delta := by -+ -+ rw [lem_Re1deltatrho1 delta hdelta t rho1 h_rho1_in_Zt] -+ -+ exact lem_Re1delta1 delta hdelta t rho1 h_rho1_in_Zt -+ -+lemma lem_Re1deltatneq0 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : -+((1 : ℂ) + delta + t * Complex.I - rho1).re > 0 := by -+ -+ have h_ge_delta : ((1 : ℂ) + delta + t * Complex.I - rho1).re ≥ delta := lem_Re1deltatge delta hdelta t rho1 h_rho1_in_Zt -+ -+ linarith [hdelta] -+ -+lemma lem_Re1deltatge0 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : -+(1 / ((1 : ℂ) + delta + t * Complex.I - rho1)).re ≥ 0 := by -+ -+ apply le_of_lt -+ apply lem_Re1zge0 -+ -+ exact lem_Re1deltatneq0 delta hdelta t rho1 h_rho1_in_Zt -+ -+lemma lem_Re1deltatge0m (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (_hdelta_lt_1 : delta < 1) -+ (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : -+ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / -+ (((1 : ℂ) + delta + t * Complex.I) - rho1)).re ≥ 0 := by -+ -+ let n := (analyticOrderAt riemannZeta rho1).toNat -+ let z := ((1 : ℂ) + delta + t * Complex.I) - rho1 -+ -+ have h_eq : (n : ℂ) / z = n • (1/z) := by -+ rw [nsmul_eq_mul] -+ simp [div_eq_mul_inv] -+ -+ rw [h_eq, Complex.re_nsmul] -+ -+ apply nsmul_nonneg -+ exact lem_Re1deltatge0 delta hdelta t rho1 h_rho1_in_Zt -+ -+lemma lem_Re1delta2tge0 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint (2 * t)) : -+(((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + (2 * t) * Complex.I - rho1)).re ≥ 0 := by -+ -+ convert lem_Re1deltatge0m delta hdelta (2 * t) hdelta_lt_1 rho1 h_rho1_in_Zt -+ simp -+ -+lemma lem_sumrho2ge (t : ℝ) (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) : -+Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + (2 * t) * Complex.I - rho1)).re) ≥ 0 := by -+ apply Finset.sum_nonneg -+ intro rho1 h_rho1_in_finset -+ -+ have h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint (2 * t) := by -+ rwa [Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite (2 * t))] at h_rho1_in_finset -+ -+ exact lem_Re1delta2tge0 delta hdelta hdelta_lt_1 t rho1 h_rho1_in_Zt -+ -+lemma lem_sumrho2ge02 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) : -+ (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) -+(fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1))).re ≥ 0 := by -+ -+ rw [lem_sumrho2 t delta hdelta hdelta_lt_1] -+ -+ exact lem_sumrho2ge t delta hdelta hdelta_lt_1 -+ -+lemma lem_explicit2Real2 : -+ ∃ C > 1, -+ ∀ t : ℝ, 2 < |t| → -+ ∀ δ : ℝ, 0 < δ ∧ δ < 1 → -+ ((-logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I)).re) -+ ≤ C * Real.log (abs (2 * t) + 2) := by -+ rcases lem_explicit2Real with ⟨C, hCpos, hEv⟩ -+ refine ⟨C, hCpos, ?_⟩ -+ intro t ht δ hδ -+ -+ set s : ℂ := (1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I -+ set S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t)) -+ set Sre : ℝ := -+ Finset.sum S -+ (fun rho1 : ℂ => -+ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / -+ (s - rho1)).re) -+ -+ have h_bound : -+ abs ((logDerivZeta s).re - Sre) -+ ≤ C * Real.log (abs (2 * t) + 2) := by -+ simpa [s, S, Sre] using hEv t ht δ hδ -+ -+ have hS_nonneg : 0 ≤ Sre := by -+ -+ have h0 := lem_sumrho2ge02 t δ hδ.1 hδ.2 -+ -+ simpa [s, S, Sre, lem_sumrho2 t δ hδ.1 hδ.2] using h0 -+ -+ have h_left : -(C * Real.log (abs (2 * t) + 2)) ≤ (logDerivZeta s).re - Sre := -+ (abs_le.mp h_bound).1 -+ -+ have h_neg : -((logDerivZeta s).re - Sre) ≤ C * Real.log (abs (2 * t) + 2) := by -+ simpa using neg_le_neg h_left -+ -+ have h_aux := sub_le_sub_right h_neg Sre -+ have h_isol : - (logDerivZeta s).re ≤ C * Real.log (abs (2 * t) + 2) - Sre := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h_aux -+ -+ have h_drop : C * Real.log (abs (2 * t) + 2) - Sre ≤ C * Real.log (abs (2 * t) + 2) := -+ sub_le_self _ hS_nonneg -+ -+ have h_final := le_trans h_isol h_drop -+ -+ simpa [s, Complex.neg_re] using h_final -+ -+lemma lem_log2Olog : (fun t : ℝ => Real.log (2 * t)) =O[Filter.atTop] (fun t : ℝ => Real.log t) := by -+ -+ have h_eq : (fun t : ℝ => Real.log (2 * t)) =ᶠ[Filter.atTop] (fun t : ℝ => Real.log 2 + Real.log t) := by -+ filter_upwards [Filter.eventually_gt_atTop (0 : ℝ)] with t ht -+ rw [Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) (ne_of_gt ht)] -+ -+ have h_bigO : (fun t : ℝ => Real.log 2 + Real.log t) =O[Filter.atTop] (fun t : ℝ => Real.log t) := by -+ -+ have h_const : (fun _ : ℝ => Real.log 2) =o[Filter.atTop] Real.log := -+ Real.isLittleO_const_log_atTop -+ have h_self : Real.log =O[Filter.atTop] Real.log := -+ Asymptotics.isBigO_refl _ _ -+ -+ have h_const_bigO : (fun _ : ℝ => Real.log 2) =O[Filter.atTop] Real.log := -+ Asymptotics.IsLittleO.isBigO h_const -+ -+ exact Asymptotics.IsBigO.add h_const_bigO h_self -+ -+ exact h_eq.trans_isBigO h_bigO -+ -+lemma lem_w2t (t : ℝ) : abs (2 * t) + 2 ≥ 0 := by -+ have h1 : abs (2 * t) ≥ 0 := abs_nonneg (2 * t) -+ linarith -+ -+lemma lem_log2Olog2 : -+(fun t : ℝ => Real.log (abs (2 * t) + 4)) =O[Filter.atTop ⊔ Filter.atBot] (fun t : ℝ => Real.log (abs t + 2)) := by -+ -+ have h_eq : ∀ t : ℝ, abs (2 * t) + 4 = 2 * (abs t + 2) := by -+ intro t -+ rw [abs_mul, abs_two] -+ ring -+ -+ have h_log_decomp : ∀ t : ℝ, Real.log (abs (2 * t) + 4) = Real.log 2 + Real.log (abs t + 2) := by -+ intro t -+ rw [h_eq] -+ have h_pos : 0 < abs t + 2 := by linarith [abs_nonneg t] -+ rw [Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) (ne_of_gt h_pos)] -+ -+ have h_target_eq : (fun t : ℝ => Real.log (abs (2 * t) + 4)) = -+ (fun t : ℝ => Real.log 2 + Real.log (abs t + 2)) := by -+ funext t -+ exact h_log_decomp t -+ -+ rw [h_target_eq] -+ -+ apply Asymptotics.IsBigO.of_bound 2 -+ -+ filter_upwards with t -+ -+ have h_pos_arg : abs t + 2 ≥ 1 := by linarith [abs_nonneg t] -+ have h_log_nonneg : 0 ≤ Real.log (abs t + 2) := Real.log_nonneg h_pos_arg -+ have h_log2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num : 1 < (2 : ℝ)) -+ -+ simp only [Real.norm_eq_abs] -+ rw [abs_of_nonneg (by linarith [h_log2_pos.le, h_log_nonneg] : 0 ≤ Real.log 2 + Real.log (abs t + 2))] -+ rw [abs_of_nonneg h_log_nonneg] -+ -+ have h_bound : Real.log 2 ≤ Real.log (abs t + 2) := by -+ apply Real.log_le_log (by norm_num : 0 < (2 : ℝ)) -+ linarith [abs_nonneg t] -+ -+ linarith [h_bound] -+ -+lemma lem_Z2bound : -+ ∃ C > 1, -+ ∀ t : ℝ, 2 < |t| → -+ ∀ δ, 0 < δ ∧ δ < 1 → -+ (-(logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I))).re -+ ≤ C * Real.log (abs t + 2) := by -+ -+ obtain ⟨C₁, hC₁_pos, hbound₁⟩ := lem_explicit2Real2 -+ -+ have h_log_comp : -+ ∀ t : ℝ, 2 < |t| → Real.log (abs (2 * t) + 2) ≤ 2 * Real.log (abs t + 2) := by -+ intro t ht -+ have h_pos_2t : 0 < abs (2 * t) + 2 := by linarith [abs_nonneg (2 * t)] -+ have h_pos_t : 0 < abs t + 2 := by linarith [abs_nonneg t] -+ have h_2t_eq : abs (2 * t) = 2 * abs t := by -+ rw [abs_mul, abs_two] -+ -+ have h_bound : abs (2 * t) + 2 ≤ 4 * (abs t + 2) := by -+ rw [h_2t_eq] -+ -+ linarith [abs_nonneg t] -+ -+ have h_4_pos : (0 : ℝ) < 4 := by norm_num -+ have h_log_bound : Real.log (abs (2 * t) + 2) ≤ Real.log (4 * (abs t + 2)) := -+ Real.log_le_log h_pos_2t h_bound -+ -+ have h_log_mul_eq : Real.log (4 * (abs t + 2)) = Real.log 4 + Real.log (abs t + 2) := by -+ exact Real.log_mul (by norm_num : (4 : ℝ) ≠ 0) (ne_of_gt h_pos_t) -+ -+ have h_4_le : (4 : ℝ) ≤ abs t + 2 := by linarith [ht] -+ have h_log_4 : Real.log 4 ≤ Real.log (abs t + 2) := -+ Real.log_le_log (by norm_num) h_4_le -+ -+ calc Real.log (abs (2 * t) + 2) -+ ≤ Real.log (4 * (abs t + 2)) := h_log_bound -+ _ = Real.log 4 + Real.log (abs t + 2) := h_log_mul_eq -+ _ ≤ Real.log (abs t + 2) + Real.log (abs t + 2) := add_le_add_left h_log_4 _ -+ _ = 2 * Real.log (abs t + 2) := by ring -+ -+ have hC₁_nonneg : 0 ≤ C₁ := le_of_lt (lt_trans zero_lt_one hC₁_pos) -+ -+ refine ⟨2 * C₁, ?_, ?_⟩ -+ · -+ linarith [hC₁_pos] -+ · -+ intro t ht δ hδ -+ let s := (1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I -+ -+ have h1 : (-(logDerivZeta s)).re ≤ C₁ * Real.log (abs (2 * t) + 2) := hbound₁ t ht δ hδ -+ -+ have h3 : Real.log (abs (2 * t) + 2) ≤ 2 * Real.log (abs t + 2) := h_log_comp t ht -+ -+ calc (-(logDerivZeta s)).re -+ ≤ C₁ * Real.log (abs (2 * t) + 2) := h1 -+ _ ≤ C₁ * (2 * Real.log (abs t + 2)) := mul_le_mul_of_nonneg_left h3 hC₁_nonneg -+ _ = (2 * C₁) * Real.log (abs t + 2) := by ring -+ -+lemma lem_Z1split (delta : ℝ) (_hdelta : delta > 0) (_hdelta_lt1 : delta < 1) (rho : ℂ) -+ (_h_rho_in_zeroZ : rho ∈ zeroZ) -+ (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : -+ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) -+ (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) = -+ (((analyticOrderAt riemannZeta rho).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re + -+ Finset.sum ((Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)).erase rho) -+ (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) := by -+ classical -+ set s := Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im) -+ set f := fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re -+ have hmem : rho ∈ s := by -+ simpa [s, Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite rho.im)] using h_rho_in_Zt -+ -+ have h_decomp : ∑ x ∈ s, f x = f rho + ∑ x ∈ s.erase rho, f x := by -+ rw [← Finset.insert_erase hmem] -+ rw [Finset.sum_insert (Finset.notMem_erase rho s)] -+ simp -+ exact h_decomp -+ -+lemma re_ofReal_mul_eq (a : ℝ) (z : ℂ) : ((a : ℂ) * z).re = a * z.re := by -+ calc -+ ((a : ℂ) * z).re = ((a : ℂ).re) * z.re - ((a : ℂ).im) * z.im := by -+ simp [Complex.mul_re] -+ _ = a * z.re - 0 := by -+ simp -+ _ = a * z.re := by -+ simp -+ -+lemma re_ofReal_div_eq (a : ℝ) (z : ℂ) : ((a : ℂ) / z).re = a * (1 / z).re := by -+ simp [div_eq_mul_inv] -+ -+lemma re_ofReal_div_ge_one (a : ℝ) (z : ℂ) (ha : 1 ≤ a) (hz : 0 ≤ (1 / z).re) : ((a : ℂ) / z).re ≥ (1 / z).re := by -+ have hrepr : ((a : ℂ) / z).re = a * (1 / z).re := by -+ simp [div_eq_mul_inv, Complex.mul_re] -+ have hmul : (1 : ℝ) * (1 / z).re ≤ a * (1 / z).re := -+ mul_le_mul_of_nonneg_right ha hz -+ calc -+ ((a : ℂ) / z).re = a * (1 / z).re := hrepr -+ _ ≥ 1 * (1 / z).re := by exact hmul -+ _ = (1 / z).re := by simp [one_mul] -+ -+lemma analyticAt_riemannZeta_of_ne_one {s : ℂ} (hs : s ≠ 1) : AnalyticAt ℂ riemannZeta s := by -+ -+ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ -+ -+ filter_upwards [eventually_ne_nhds hs] with z hz -+ exact differentiableAt_riemannZeta hz -+ -+lemma riemannZeta_not_eventually_zero_of_ne_one {s : ℂ} (hs : s ≠ 1) : -+ ¬ (∀ᶠ z in nhds s, riemannZeta z = 0) := by -+ intro hEvZero -+ -+ let H : ℂ → ℂ := Function.update (fun z : ℂ => (z - 1) * riemannZeta z) 1 1 -+ -+ have hH_diff : Differentiable ℂ H := by -+ intro z -+ rcases eq_or_ne z 1 with rfl | hz -+ · -+ refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt -+ · -+ -+ filter_upwards [self_mem_nhdsWithin] with t ht -+ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := (differentiableAt_id.sub_const 1) -+ have h2 : DifferentiableAt ℂ riemannZeta t := by -+ -+ exact differentiableAt_riemannZeta ht -+ have hdiff := h1.mul h2 -+ -+ apply hdiff.congr_of_eventuallyEq -+ filter_upwards [eventually_ne_nhds ht] with u hu -+ simp [H, Function.update_of_ne hu] -+ · -+ simpa [H, continuousAt_update_same] using riemannZeta_residue_one -+ · -+ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) -+ have h2 : DifferentiableAt ℂ riemannZeta z := by -+ exact differentiableAt_riemannZeta hz -+ have hdiff := h1.mul h2 -+ -+ apply hdiff.congr_of_eventuallyEq -+ filter_upwards [eventually_ne_nhds hz] with u hu -+ simp [H, Function.update_of_ne hu] -+ -+ have hH_analytic : AnalyticOnNhd ℂ H Set.univ := -+ (Complex.analyticOnNhd_univ_iff_differentiable).2 hH_diff -+ -+ have h0_analytic : AnalyticOnNhd ℂ (fun _ : ℂ => (0 : ℂ)) Set.univ := by -+ intro z _; simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => (0 : ℂ)) z) -+ -+ have hEv_ne1 : ∀ᶠ z in nhds s, z ≠ 1 := eventually_ne_nhds hs -+ have hEv_H0 : ∀ᶠ z in nhds s, H z = 0 := by -+ filter_upwards [hEvZero, hEv_ne1] with z hz_zero hz_ne1 -+ -+ have : H z = (z - 1) * riemannZeta z := by simp [H, Function.update_of_ne hz_ne1] -+ simp [this, hz_zero] -+ -+ have hEqOn : Set.EqOn H (fun _ : ℂ => (0 : ℂ)) Set.univ := by -+ -+ have hU : IsPreconnected (Set.univ : Set ℂ) := by simpa using isPreconnected_univ -+ exact AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq hH_analytic h0_analytic hU (by simp) hEv_H0 -+ have hHeq : H = fun _ : ℂ => (0 : ℂ) := by -+ funext z; simpa using hEqOn (by simp : z ∈ (Set.univ : Set ℂ)) -+ -+ have h2ne1 : (2 : ℂ) ≠ 1 := by norm_num -+ have hH2 : H (2 : ℂ) = (2 - 1) * riemannZeta (2 : ℂ) := by -+ simp [H] -+ have hzeta2_ne : riemannZeta (2 : ℂ) ≠ 0 := -+ riemannZeta_ne_zero_of_one_le_re (by simp) -+ have hprod_zero' : 0 = (2 - 1) * riemannZeta (2 : ℂ) := by -+ simpa [hHeq] using hH2 -+ have hprod_zero : (2 - 1) * riemannZeta (2 : ℂ) = 0 := hprod_zero'.symm -+ have hnonzero : (2 - 1) * riemannZeta (2 : ℂ) ≠ 0 := by -+ have hcoeff : (2 : ℂ) - 1 ≠ 0 := sub_ne_zero.mpr h2ne1 -+ exact mul_ne_zero hcoeff hzeta2_ne -+ exact hnonzero hprod_zero -+ -+lemma analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero {f : ℂ → ℂ} {z0 : ℂ} -+ (hf : AnalyticAt ℂ f z0) (hzero : f z0 = 0) -+ (hnot : ¬ (∀ᶠ z in nhds z0, f z = 0)) : -+ 1 ≤ (analyticOrderAt f z0).toNat := by -+ classical -+ -+ have hne0 : analyticOrderAt f z0 ≠ 0 := by -+ intro h0 -+ have hzne : f z0 ≠ 0 := (AnalyticAt.analyticOrderAt_eq_zero hf).1 h0 -+ exact hzne hzero -+ -+ have hneTop : analyticOrderAt f z0 ≠ ⊤ := by -+ intro htop -+ have hall : (∀ᶠ z in nhds z0, f z = 0) := (analyticOrderAt_eq_top).1 htop -+ exact hnot hall -+ -+ rcases WithTop.ne_top_iff_exists.mp hneTop with ⟨n, hn⟩ -+ -+ have hn_ne_zero : n ≠ 0 := by -+ intro hn0 -+ apply hne0 -+ -+ simp [hn.symm, hn0] -+ rfl -+ -+ have hposn : 1 ≤ n := Nat.succ_le_of_lt (Nat.pos_of_ne_zero hn_ne_zero) -+ -+ simpa [hn.symm] using! hposn -+ -+lemma lem_Z1splitge (delta : ℝ) (hdelta_pos : delta > 0) (hdelta : delta < 1) (rho : ℂ) -+ (h_rho_in_zeroZ : rho ∈ zeroZ) (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : -+ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) ≥ -+(1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re := by -+ classical -+ -+ have hsplit := -+ lem_Z1split delta hdelta_pos hdelta rho h_rho_in_zeroZ h_rho_in_Zt -+ -+ rw [hsplit] -+ -+ have h_rho_ne_one : rho ≠ (1 : ℂ) := by -+ intro h -+ have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) -+ exact hz1_ne (by simpa [h] using! h_rho_in_zeroZ) -+ have hAnal : AnalyticAt ℂ riemannZeta rho := analyticAt_riemannZeta_of_ne_one h_rho_ne_one -+ have hNotEv : ¬ (∀ᶠ z in nhds rho, riemannZeta z = 0) := -+ riemannZeta_not_eventually_zero_of_ne_one h_rho_ne_one -+ have horder_nat : 1 ≤ (analyticOrderAt riemannZeta rho).toNat := -+ analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero -+ hAnal (by simpa using! h_rho_in_zeroZ) hNotEv -+ have ha_real : (1 : ℝ) ≤ ((analyticOrderAt riemannZeta rho).toNat : ℝ) := by exact_mod_cast horder_nat -+ have hz_nonneg : 0 ≤ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re := -+ lem_Re1deltatge0 delta hdelta_pos rho.im rho h_rho_in_Zt -+ have hfirst : -+ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re -+ ≤ (((((analyticOrderAt riemannZeta rho).toNat : ℝ) : ℂ) / -+ (((1 : ℂ) + delta + rho.im * Complex.I) - rho))).re := by -+ -+ simpa [ge_iff_le] using -+ (re_ofReal_div_ge_one ((analyticOrderAt riemannZeta rho).toNat : ℝ) -+ ((((1 : ℂ) + delta + rho.im * Complex.I) - rho)) ha_real hz_nonneg) -+ -+ have hsum_nonneg : -+ 0 ≤ Finset.sum -+ ((Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)).erase rho) -+ (fun rho1 : ℂ => -+ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / -+ (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) := by -+ apply Finset.sum_nonneg -+ intro rho1 hmem -+ rcases Finset.mem_erase.mp hmem with ⟨_, hmemS⟩ -+ -+ have hZt : rho1 ∈ ZetaZerosNearPoint rho.im := by -+ simpa [Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite rho.im)] using hmemS -+ -+ have hne1 : rho1 ≠ (1 : ℂ) := by -+ intro h -+ have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) -+ have hzero1 : riemannZeta rho1 = 0 := hZt.1 -+ exact hz1_ne (by simpa [h] using hzero1) -+ -+ have hAnal1 : AnalyticAt ℂ riemannZeta rho1 := analyticAt_riemannZeta_of_ne_one hne1 -+ have hNotEv1 : ¬ (∀ᶠ z in nhds rho1, riemannZeta z = 0) := -+ riemannZeta_not_eventually_zero_of_ne_one hne1 -+ have hzero1 : riemannZeta rho1 = 0 := hZt.1 -+ have horder1 : 1 ≤ (analyticOrderAt riemannZeta rho1).toNat := -+ analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero hAnal1 hzero1 hNotEv1 -+ have ha1_real : (1 : ℝ) ≤ ((analyticOrderAt riemannZeta rho1).toNat : ℝ) := by exact_mod_cast horder1 -+ -+ have hz1_nonneg : 0 ≤ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re := -+ lem_Re1deltatge0 delta hdelta_pos rho.im rho1 hZt -+ -+ have hge : -+ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re ≤ -+ (((((analyticOrderAt riemannZeta rho1).toNat : ℝ) : ℂ) / -+ (((1 : ℂ) + delta + rho.im * Complex.I) - rho1))).re := by -+ simpa [ge_iff_le] using -+ (re_ofReal_div_ge_one ((analyticOrderAt riemannZeta rho1).toNat : ℝ) -+ ((((1 : ℂ) + delta + rho.im * Complex.I) - rho1)) ha1_real hz1_nonneg) -+ -+ exact le_trans hz1_nonneg hge -+ -+ have h := add_le_add hfirst hsum_nonneg -+ -+ simpa using h -+ -+lemma lem_1deltatrho0 (delta : ℝ) (_hdelta : delta > 0) (rho : ℂ) (_h_rho_in_zeroZ : rho ∈ zeroZ) : -+((1 : ℂ) + delta + rho.im * Complex.I - rho) = ((1 : ℝ) + delta - rho.re) := by -+ -+ calc (1 : ℂ) + delta + rho.im * Complex.I - rho -+ = (1 : ℂ) + delta + rho.im * Complex.I - (rho.re + rho.im * Complex.I) := by rw [Complex.re_add_im] -+ _ = (1 : ℂ) + delta - rho.re := by ring -+ _ = ((1 : ℝ) + delta - rho.re : ℂ) := by norm_cast -+ -+lemma lem_1delsigReal (delta : ℝ) (hdelta_pos : delta > 0) (_hdelta : delta < 1) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : -+(1 / ((1 : ℂ) + delta + rho.im * Complex.I - rho)).re = 1 / ((1 : ℝ) + delta - rho.re) := by -+ rw [lem_1deltatrho0 delta hdelta_pos rho h_rho_in_zeroZ] -+ -+ rw [← Complex.ofReal_add, ← Complex.ofReal_sub, ← Complex.ofReal_one] -+ -+ rw [Complex.div_ofReal_re] -+ -+ rw [Complex.ofReal_re] -+ -+lemma lem_11delsiginR (delta : ℝ) (hdelta : delta > 0) (_hdelta_lt_1 : delta < 1) (sigma : ℝ) (hsigma : sigma ≤ 1) : -+(1 / ((1 : ℂ) + delta - sigma)).im = 0 := by -+ -+ have h_pos : 1 + delta - sigma > 0 := by -+ calc 1 + delta - sigma -+ = (1 - sigma) + delta := by ring -+ _ ≥ 0 + delta := by linarith [hsigma] -+ _ = delta := by simp -+ _ > 0 := hdelta -+ -+ have h_eq : (1 : ℂ) + delta - sigma = (1 + delta - sigma : ℝ) := by -+ simp only [Complex.ofReal_add, Complex.ofReal_sub, Complex.ofReal_one] -+ -+ rw [h_eq] -+ -+ rw [Complex.div_ofReal_im] -+ -+ rw [Complex.one_im] -+ -+ simp -+ -+lemma lem_11delsiginR2 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : -+(1 / ((1 : ℂ) + delta - rho.re)).im = 0 := by -+ -+ have h_zeta_zero : riemannZeta rho = 0 := h_rho_in_zeroZ -+ -+ have h_rho_form : rho = rho.re + rho.im * Complex.I := by simp [Complex.re_add_im] -+ -+ rw [h_rho_form] at h_zeta_zero -+ -+ have h_rho_re_le_1 : rho.re ≤ 1 := lem_sigmale1 rho.re rho.im h_zeta_zero -+ -+ exact lem_11delsiginR delta hdelta hdelta_lt_1 rho.re h_rho_re_le_1 -+ -+lemma lem_ReReal (x : ℝ) : (x : ℂ).re = x := Complex.ofReal_re x -+ -+lemma lem_1delsigReal2 (delta : ℝ) (_hdelta : delta > 0) (rho : ℂ) (_h_rho_in_zeroZ : rho ∈ zeroZ) : -+(1 / ((1 : ℂ) + delta - rho.re)).re = 1 / ((1 : ℝ) + delta - rho.re) := by -+ -+ have h_eq : (1 : ℂ) + delta - rho.re = (1 + delta - rho.re : ℝ) := by -+ simp only [Complex.ofReal_add, Complex.ofReal_sub, Complex.ofReal_one] -+ -+ rw [h_eq] -+ -+ rw [Complex.div_ofReal_re] -+ -+ rw [Complex.one_re] -+ -+lemma lem_re_inv_one_plus_delta_minus_rho_real (delta : ℝ) (hdelta : delta > 0) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : -+(1 / ((1 : ℂ) + delta + rho.im * Complex.I - rho)).re = 1 / ((1 : ℝ) + delta - rho.re) := by -+ -+ rw [lem_1deltatrho0 delta hdelta rho h_rho_in_zeroZ] -+ -+ exact lem_1delsigReal2 delta hdelta rho h_rho_in_zeroZ -+ -+lemma lem_Z1splitge2 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (rho : ℂ) -+ (h_rho_in_zeroZ : rho ∈ zeroZ) (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : -+ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) -+ (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + rho.im * Complex.I - rho1)).re) ≥ -+1 / ((1 : ℝ) + delta - rho.re) := by -+ -+ have h1 := lem_Z1splitge delta hdelta hdelta_lt_1 rho h_rho_in_zeroZ h_rho_in_Zt -+ -+ have h2 := lem_re_inv_one_plus_delta_minus_rho_real delta hdelta rho h_rho_in_zeroZ -+ -+ rw [← h2] -+ exact h1 -+ -+lemma lem_Z1splitge3 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (sigma t : ℝ) (rho : ℂ) -+ (h_rho_eq : rho = sigma + t * Complex.I) (h_rho_in_zeroZ : rho ∈ zeroZ) -+ (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint t) : -+(Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + t * Complex.I) - rho1)) ).re ≥ 1 / ((1 : ℝ) + delta - sigma) := by -+ -+ rw [lem_sumrho1 t delta hdelta hdelta_lt_1] -+ -+ have h_rho_im : rho.im = t := by -+ rw [h_rho_eq] -+ simp [Complex.add_im, Complex.mul_im, Complex.I_im] -+ have h_rho_re : rho.re = sigma := by -+ rw [h_rho_eq] -+ simp [Complex.add_re, Complex.mul_re, Complex.I_re] -+ -+ have h_rho_in_Zt' : rho ∈ ZetaZerosNearPoint rho.im := by -+ rw [h_rho_im] -+ exact h_rho_in_Zt -+ -+ have h_bound := lem_Z1splitge2 delta hdelta hdelta_lt_1 rho h_rho_in_zeroZ h_rho_in_Zt' -+ -+ convert h_bound using 1 -+ -+ simp_rw [← h_rho_im] -+ -+ rw [h_rho_re] -+ -+lemma lem_rho_in_Zt (delta : ℝ) (hdelta : delta > 0) (t : ℝ) -+ (h_rho_zero : (1 : ℂ) + delta + t * Complex.I ∈ zeroZ) : -+ (1 : ℂ) + delta + t * Complex.I ∈ ZetaZerosNearPoint t := by -+ -+ let ρ : ℂ := (1 : ℂ) + delta + t * Complex.I -+ -+ have h_re : ρ.re > 1 := by -+ simp [ρ, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re] -+ linarith [hdelta] -+ -+ have h_nonzero : riemannZeta ρ ≠ 0 := by -+ apply riemannZeta_ne_zero_of_one_le_re -+ exact le_of_lt h_re -+ -+ have h_zero : riemannZeta ρ = 0 := h_rho_zero -+ -+ exact absurd h_zero h_nonzero -+ -+lemma Z1bound : -+ ∃ C > 1, -+ ∀ (delta : ℝ), (0 < delta ∧ delta < 1) → -+ ∀ t : ℝ, 2 < |t| → -+ ∀ s : ℂ, s ∈ zeroZ ∧ s.im = t → -+ (-(logDerivZeta ((1 : ℂ) + delta + t * Complex.I))).re -+ ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by -+ classical -+ -+ obtain ⟨C0, hC0gt1, hExp⟩ := lem_explicit1RealReal -+ -+ have hlog5pos : 0 < Real.log 4 := Real.log_pos (by norm_num : (1 : ℝ) < 4) -+ let C : ℝ := max (C0 + 3 / Real.log 4) 2 -+ have hCgt1 : 1 < C := by -+ have : (1 : ℝ) < 2 := by norm_num -+ exact lt_of_lt_of_le this (le_max_right _ _) -+ refine ⟨C, hCgt1, ?_⟩ -+ intro delta hdelta t ht s hs -+ -+ set sp : ℂ := (1 : ℂ) + delta + t * Complex.I -+ set S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite t) -+ set Sre : ℝ := -+ Finset.sum S -+ (fun rho1 : ℂ => -+ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (sp - rho1)).re) -+ -+ have h_bound : abs ((logDerivZeta sp).re - Sre) -+ ≤ C0 * Real.log (abs t + 2) := by -+ simpa [sp, S, Sre] using hExp t ht delta hdelta -+ -+ have h_left : -(C0 * Real.log (abs t + 2)) ≤ (logDerivZeta sp).re - Sre := -+ (abs_le.mp h_bound).1 -+ have h_neg : -((logDerivZeta sp).re - Sre) ≤ C0 * Real.log (abs t + 2) := by -+ simpa using neg_le_neg h_left -+ have h_isol : - (logDerivZeta sp).re ≤ C0 * Real.log (abs t + 2) - Sre := by -+ have := sub_le_sub_right h_neg Sre -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ -+ have hS_nonneg : 0 ≤ Sre := by -+ apply Finset.sum_nonneg -+ intro rho1 hmem -+ have hZt : rho1 ∈ ZetaZerosNearPoint t := by -+ simpa [S, Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite t)] using hmem -+ -+ simpa [sp] using -+ (lem_Re1deltatge0m delta hdelta.1 t hdelta.2 rho1 hZt) -+ -+ have h_basic : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) := by -+ have h_drop : C0 * Real.log (abs t + 2) - Sre ≤ C0 * Real.log (abs t + 2) := -+ sub_le_self _ hS_nonneg -+ exact le_trans h_isol h_drop -+ -+ by_cases hmem : s ∈ ZetaZerosNearPoint t -+ · -+ set sigma : ℝ := s.re -+ have h_rho_eq : s = (sigma : ℂ) + t * Complex.I := by -+ have : s = s.re + s.im * Complex.I := by simp [Complex.re_add_im] -+ simpa [sigma, hs.2] using this -+ -+ have hsum_rew := lem_sumrho1 t delta hdelta.1 hdelta.2 -+ have h_sum_ge' := -+ lem_Z1splitge3 delta hdelta.1 hdelta.2 sigma t s h_rho_eq hs.1 hmem -+ have h_sum_ge : Sre ≥ 1 / ((1 : ℝ) + delta - sigma) := by -+ simpa [sp, S, Sre, hsum_rew] using h_sum_ge' -+ -+ have h1 : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) := by -+ have : (1 / ((1 : ℝ) + delta - sigma)) ≤ Sre := h_sum_ge -+ have := sub_le_sub_left this (C0 * Real.log (abs t + 2)) -+ exact le_trans h_isol (by simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this) -+ -+ have hCge : C0 ≤ C := -+ le_trans (by -+ have : 0 ≤ 3 / Real.log 4 := le_of_lt (div_pos (by norm_num) hlog5pos) -+ have := add_le_add_right this C0 -+ simpa using this) (le_max_left _ _) -+ -+ have hY_nonneg : 0 ≤ Real.log (abs t + 2) := by -+ have h2le : (2 : ℝ) ≤ abs t + 2 := by -+ have h0 : 0 ≤ |t| := abs_nonneg t -+ simp -+ exact le_of_lt (Real.log_pos (lt_of_lt_of_le (by norm_num) h2le)) -+ have h_enlarge : C0 * Real.log (abs t + 2) ≤ C * Real.log (abs t + 2) := -+ mul_le_mul_of_nonneg_right hCge hY_nonneg -+ have h2 : C0 * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) ≤ -+ C * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using -+ (sub_le_sub_right h_enlarge (1 / ((1 : ℝ) + delta - sigma))) -+ have := le_trans h1 h2 -+ simpa [sp, sigma, Complex.neg_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] -+ using this -+ · -+ -+ have h_notle : ¬ ‖s - ((3/2 : ℂ) + t * Complex.I)‖ ≤ (5/6 : ℝ) := by -+ intro hle -+ exact hmem ⟨hs.1, hle⟩ -+ have hdist_gt : (5/6 : ℝ) < ‖s - ((3/2 : ℂ) + t * Complex.I)‖ := not_le.mp h_notle -+ -+ have h_re : (s - ((3/2 : ℂ) + t * Complex.I)).re = s.re - (3/2 : ℝ) := by -+ simp [Complex.sub_re, Complex.add_re] -+ have h_im : (s - ((3/2 : ℂ) + t * Complex.I)).im = 0 := by -+ have : (s - ((3/2 : ℂ) + t * Complex.I)).im = s.im - t := by -+ simp [Complex.sub_im, Complex.add_im] -+ simp [hs.2] -+ have h_eq : s - ((3/2 : ℂ) + t * Complex.I) = (((s.re - (3/2 : ℝ)) : ℝ) : ℂ) := by -+ apply Complex.ext -+ · simp [h_re] -+ · simp [h_im] -+ have hdist_real : ‖s - ((3/2 : ℂ) + t * Complex.I)‖ = |s.re - (3/2 : ℝ)| := by -+ simpa [h_eq] using complex_abs_of_real (s.re - (3/2 : ℝ)) -+ have habs_gt : (5/6 : ℝ) < |s.re - (3/2 : ℝ)| := by simpa [hdist_real] using hdist_gt -+ -+ have h0 : riemannZeta (s.re + s.im * Complex.I) = 0 := by -+ simpa [Complex.re_add_im] using! hs.1 -+ have hs_le1 : s.re ≤ 1 := lem_sigmale1 s.re s.im h0 -+ -+ have h_nonpos : s.re - (3/2 : ℝ) ≤ 0 := by linarith [hs_le1] -+ have h_abs_eq : |s.re - (3/2 : ℝ)| = (3/2 : ℝ) - s.re := by -+ have : |s.re - (3/2 : ℝ)| = -(s.re - (3/2 : ℝ)) := abs_of_nonpos h_nonpos -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ have h_gt' : (5/6 : ℝ) < (3/2 : ℝ) - s.re := by simpa [h_abs_eq] using habs_gt -+ have hs_le_23 : s.re ≤ (2/3 : ℝ) := by linarith [h_gt'] -+ -+ have hden_ge : (1/3 : ℝ) ≤ 1 + delta - s.re := by -+ have : (1/3 : ℝ) ≤ 1 - s.re := by linarith [hs_le_23] -+ have : 1 - s.re ≤ 1 + delta - s.re := by linarith [hdelta.1] -+ exact le_trans ‹(1/3 : ℝ) ≤ 1 - s.re› this -+ have hone_div_le3 : 1 / (1 + delta - s.re) ≤ (3 : ℝ) := by -+ have : 1 / (1 + delta - s.re) ≤ 1 / (1/3 : ℝ) := -+ one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 1/3) hden_ge -+ simpa [one_div] using this -+ have hneg_ge : - (3 : ℝ) ≤ - (1 / (1 + delta - s.re)) := by -+ simpa using (neg_le_neg hone_div_le3) -+ -+ have hlog_ge : Real.log 4 ≤ Real.log (abs t + 2) := by -+ have : (4 : ℝ) < abs t + 2 := by linarith [ht] -+ exact Real.log_le_log (by norm_num) (le_of_lt this) -+ have hC_ge_add : C ≥ C0 + 3 / Real.log 4 := by exact le_max_left _ _ -+ have hCminus : C - C0 ≥ 3 / Real.log 4 := by linarith -+ have hY_nonneg : 0 ≤ Real.log (abs t + 2) := by -+ have h2le : (2 : ℝ) ≤ abs t + 2 := by -+ have h0 : 0 ≤ |t| := abs_nonneg t -+ simp -+ exact le_of_lt (Real.log_pos (lt_of_lt_of_le (by norm_num) h2le)) -+ have hmul1 : (3 / Real.log 4) * Real.log 4 ≤ (3 / Real.log 4) * Real.log (abs t + 2) := by -+ have hk_nonneg : 0 ≤ 3 / Real.log 4 := le_of_lt (div_pos (by norm_num) hlog5pos) -+ exact mul_le_mul_of_nonneg_left hlog_ge hk_nonneg -+ have hmul2 : (3 / Real.log 4) * Real.log (abs t + 2) ≤ (C - C0) * Real.log (abs t + 2) := by -+ exact mul_le_mul_of_nonneg_right hCminus hY_nonneg -+ have hmul_ge3 : (3 : ℝ) ≤ (C - C0) * Real.log (abs t + 2) := by -+ have hne5 : Real.log 4 ≠ 0 := ne_of_gt hlog5pos -+ have hcalc : (3 / Real.log 4) * Real.log 4 = 3 := by -+ simp [div_eq_mul_inv, hne5] -+ have : (3 / Real.log 4) * Real.log 4 ≤ (C - C0) * Real.log (abs t + 2) := -+ le_trans hmul1 hmul2 -+ simpa [hcalc] using this -+ -+ have hCmul' : C0 * Real.log (abs t + 2) + 3 ≤ C * Real.log (abs t + 2) := by -+ have : C0 * Real.log (abs t + 2) + 3 ≤ C0 * Real.log (abs t + 2) + (C - C0) * Real.log (abs t + 2) := by -+ exact add_le_add_right hmul_ge3 _ -+ have hcalc : C * Real.log (abs t + 2) = -+ C0 * Real.log (abs t + 2) + (C - C0) * Real.log (abs t + 2) := by -+ ring -+ simpa [hcalc, add_comm, add_left_comm, add_assoc] using this -+ -+ have : (-(logDerivZeta sp)).re ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by -+ have h1 : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) := h_basic -+ have h2 : C0 * Real.log (abs t + 2) ≤ C * Real.log (abs t + 2) - 3 := by -+ linarith [hCmul'] -+ have h3 : C * Real.log (abs t + 2) - 3 ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by -+ have := add_le_add_left hneg_ge (C * Real.log (abs t + 2)) -+ simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using this -+ exact le_trans h1 (le_trans h2 h3) -+ simpa [sp, Complex.neg_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ -+lemma Z0boundRe : -+Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => (- (logDerivZeta ((1 : ℂ) + delta))).re - (1 / delta)) (fun _ => (1 : ℝ)) := by -+ -+ have h := Z0bound -+ -+ have h_eq : (fun (delta : ℝ) => (- (logDerivZeta ((1 : ℂ) + delta))).re - (1 / delta)) = -+ (fun (delta : ℝ) => (-logDerivZeta ((1 : ℂ) + delta) - (1 / (delta : ℂ))).re) := by -+ ext delta -+ rw [Complex.sub_re, Complex.neg_re] -+ -+ have : (1 / (delta : ℂ)).re = 1 / delta := by -+ rw [Complex.div_re, Complex.one_re, Complex.ofReal_re, Complex.ofReal_im] -+ simp [Complex.normSq_ofReal] -+ rw [this] -+ -+ rw [h_eq] -+ -+ rw [Asymptotics.isBigO_iff] at h ⊢ -+ obtain ⟨c, hc⟩ := h -+ use c -+ filter_upwards [hc] with delta h_delta -+ have : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp -+ rw [this] at h_delta -+ have : ‖(1 : ℝ)‖ = (1 : ℝ) := by simp -+ rw [this] -+ exact le_trans (Complex.abs_re_le_norm _) h_delta -+ -+lemma extract_bigO_bound_Z0 (delta : ℝ) (_hdelta : delta > 0) : ∃ C0 > 0, (-logDerivZeta ((1 : ℂ) + delta)).re ≤ 1 / delta + C0 := by -+ -+ let target := (-logDerivZeta ((1 : ℂ) + delta)).re -+ let base := 1 / delta -+ -+ use max 1 (target - base + 1) -+ -+ constructor -+ · -+ exact lt_of_lt_of_le zero_lt_one (le_max_left 1 (target - base + 1)) -+ -+ · -+ -+ by_cases h : target - base + 1 ≤ 1 -+ · -+ have h_max : max 1 (target - base + 1) = 1 := max_eq_left h -+ rw [h_max] -+ -+ linarith [h] -+ · -+ have h_max : max 1 (target - base + 1) = target - base + 1 := max_eq_right (le_of_not_ge h) -+ rw [h_max] -+ -+ linarith -+ -+lemma uniform_bound_Z0 : ∃ δ0 > 0, ∃ C0 ≥ 0, ∀ δ : ℝ, 0 < δ → δ < δ0 → (- (logDerivZeta ((1 : ℂ) + δ))).re ≤ 1 / δ + C0 := by -+ -+ let f : ℝ → ℝ := fun δ => (- (logDerivZeta ((1 : ℂ) + δ))).re - (1 / δ) -+ -+ have hO := Z0boundRe -+ -+ rcases (Asymptotics.isBigO_iff).1 hO with ⟨c, hc⟩ -+ -+ have h1norm : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c := by -+ -+ have : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c * ‖(1 : ℝ)‖ := hc -+ refine this.mono ?_ -+ intro δ hδ -+ simpa using (by simpa using hδ) -+ -+ rcases (Filter.eventually_iff_exists_mem).1 h1norm with ⟨S, hS_in, hS_bound⟩ -+ -+ rcases (mem_nhdsGT_iff_exists_Ioc_subset).1 hS_in with ⟨δ0, hδ0pos, hIoc_sub_S⟩ -+ -+ refine ⟨δ0, hδ0pos, max c 0, le_max_right _ _, ?_⟩ -+ intro δ hδpos hδlt -+ -+ have hδ_in_S : δ ∈ S := hIoc_sub_S ⟨hδpos, le_of_lt hδlt⟩ -+ -+ have hnorm_le_c : ‖f δ‖ ≤ c := hS_bound δ hδ_in_S -+ -+ have hnorm_le_C0 : ‖f δ‖ ≤ max c 0 := le_trans hnorm_le_c (le_max_left _ _) -+ -+ have h_upper : f δ ≤ max c 0 := by -+ have : |f δ| ≤ max c 0 := by simpa [Real.norm_eq_abs] using hnorm_le_C0 -+ exact (abs_le.mp this).2 -+ -+ have := (sub_le_iff_le_add).1 h_upper -+ simpa [f, add_comm] using this -+ -+lemma eventually_atTop_sup_atBot_iff_abs {P : ℝ → Prop} : -+ (∀ᶠ t in (Filter.atTop ⊔ Filter.atBot), P t) ↔ ∃ T : ℝ, ∀ t : ℝ, T ≤ |t| → P t := by -+ constructor -+ · intro h -+ have h' := (Filter.eventually_sup).1 h -+ rcases h' with ⟨hTop, hBot⟩ -+ rcases (Filter.eventually_atTop).1 hTop with ⟨A, hA⟩ -+ rcases (Filter.eventually_atBot).1 hBot with ⟨B, hB⟩ -+ refine ⟨max A (-B), ?_⟩ -+ intro t ht -+ have hcases : max A (-B) ≤ t ∨ max A (-B) ≤ -t := (le_abs).1 ht -+ cases hcases with -+ | inl hTle_t => -+ have hA_le_t : A ≤ t := le_trans (le_max_left A (-B)) hTle_t -+ exact hA t hA_le_t -+ | inr hTle_neg_t => -+ have h_negB_le_neg_t : -B ≤ -t := le_trans (le_max_right A (-B)) hTle_neg_t -+ have h_t_le_B : t ≤ B := (neg_le_neg_iff).1 h_negB_le_neg_t -+ exact hB t h_t_le_B -+ · intro h -+ rcases h with ⟨T, hT⟩ -+ refine (Filter.eventually_sup).2 ?_ -+ constructor -+ · -+ refine (Filter.eventually_atTop).2 ?_ -+ refine ⟨max T 0, ?_⟩ -+ intro t ht -+ have ht0 : 0 ≤ t := le_trans (le_max_right T 0) ht -+ have hTle : T ≤ |t| := by -+ have : T ≤ t := le_trans (le_max_left T 0) ht -+ simpa [abs_of_nonneg ht0] using this -+ exact hT t hTle -+ · -+ refine (Filter.eventually_atBot).2 ?_ -+ refine ⟨-max T 0, ?_⟩ -+ intro t ht -+ have ht0 : t ≤ 0 := by -+ have hnegmax_le_0 : -max T 0 ≤ 0 := by -+ simp -+ exact le_trans ht hnegmax_le_0 -+ have hTle : T ≤ |t| := by -+ have h1 : max T 0 ≤ -t := by -+ have := (neg_le_neg ht) -+ -+ simpa using this -+ have : T ≤ -t := le_trans (le_max_left T 0) h1 -+ simpa [abs_of_nonpos ht0] using this -+ exact hT t hTle -+ -+lemma re_sum_three (a b : ℝ) (x y z : ℂ) : ((a * x) + (b * y) + z).re = a * x.re + b * y.re + z.re := by -+ -+ simp [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, add_assoc] -+ -+lemma log_abs_add_two_ge_one (t : ℝ) (ht : Real.exp 1 - 2 ≤ |t|) : (1 : ℝ) ≤ Real.log (|t| + 2) := by -+ have hx : Real.exp 1 ≤ |t| + 2 := by -+ have h' := add_le_add_left ht (2 : ℝ) -+ simpa [sub_add_cancel] using! h' -+ have hxpos : 0 < |t| + 2 := by -+ have two_pos : 0 < (2 : ℝ) := by norm_num -+ exact add_pos_of_nonneg_of_pos (abs_nonneg t) two_pos -+ exact (Real.le_log_iff_exp_le hxpos).2 hx -+ -+lemma log_abs_add_two_ge_of_threshold (K t : ℝ) (ht : Real.exp K - 2 ≤ |t|) : K ≤ Real.log (|t| + 2) := by -+ have hx : Real.exp K ≤ |t| + 2 := by -+ have h' := add_le_add_left ht (2 : ℝ) -+ simpa [sub_add_cancel] using! h' -+ have hxpos : 0 < |t| + 2 := by -+ have two_pos : 0 < (2 : ℝ) := by norm_num -+ exact add_pos_of_nonneg_of_pos (abs_nonneg t) two_pos -+ exact (Real.le_log_iff_exp_le hxpos).2 hx -+ -+lemma re_ofReal_add_ofReal_add (a b : ℝ) (z : ℂ) : (a + b + z).re = a + b + z.re := by -+ simp [Complex.add_re, Complex.ofReal_re, add_assoc] -+ -+lemma algebraic_rewrite_RHS (δ s L C0 C1 C2 : ℝ) : -+ 3 * (1 / δ + C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L = -+ 3 / δ - 4 / (1 + δ - s) + (4 * C1 + C2) * L + 3 * C0 := by -+ have hA : 3 * (1 / δ + C0) = 3 * (1 / δ) + 3 * C0 := by -+ simp [mul_add] -+ have hB2 : -+ 4 * (-(1 / (1 + δ - s)) + C1 * L) = -+ -(4 * (1 / (1 + δ - s))) + (4 * C1) * L := by -+ calc -+ 4 * (-(1 / (1 + δ - s)) + C1 * L) -+ = 4 * (-(1 / (1 + δ - s))) + 4 * (C1 * L) := by -+ simp [mul_add] -+ _ = -(4 * (1 / (1 + δ - s))) + (4 * C1) * L := by -+ simp [mul_comm, mul_assoc] -+ calc -+ 3 * (1 / δ + C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L -+ = (3 * (1 / δ) + 3 * C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L := by -+ rw [hA] -+ _ = (3 * (1 / δ) + 3 * C0) + (-(4 * (1 / (1 + δ - s))) + (4 * C1) * L) + C2 * L := by -+ rw [hB2] -+ _ = (3 / δ + 3 * C0) + (- 4 / (1 + δ - s) + (4 * C1) * L) + C2 * L := by -+ simp [div_eq_mul_inv] -+ _ = 3 / δ - 4 / (1 + δ - s) + (4 * C1) * L + C2 * L + 3 * C0 := by -+ ring -+ _ = 3 / δ - 4 / (1 + δ - s) + (4 * C1 + C2) * L + 3 * C0 := by -+ ring -+ -+lemma absorb_pos_constant_into_log {L A c : ℝ} (hL : 1 ≤ L) (hc : 0 ≤ c) : A * L + c ≤ (A + c) * L := by -+ -+ have hc_le : c ≤ L * c := by -+ have h := mul_le_mul_of_nonneg_right hL hc -+ simpa [one_mul] using h -+ -+ have h0 : A * L + c ≤ A * L + L * c := by -+ exact add_le_add_right hc_le (A * L) -+ calc -+ A * L + c ≤ A * L + L * c := h0 -+ _ = A * L + c * L := by simp [mul_comm] -+ _ = (A + c) * L := by simp [right_distrib] -+ -+lemma neg_logDeriv_zeta_eq_vonMangoldt_sum (s : ℂ) (hs : 1 < s.re) : -(deriv riemannZeta s / riemannZeta s) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-s) := by -+ -+ have h1 := ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div hs -+ -+ have h2 : -deriv riemannZeta s / riemannZeta s = LSeries (fun n => ↑(ArithmeticFunction.vonMangoldt n)) s := h1.symm -+ -+ have h3 : -(deriv riemannZeta s / riemannZeta s) = -deriv riemannZeta s / riemannZeta s := by ring -+ rw [h3, h2] -+ -+ rw [LSeries] -+ congr 1 -+ ext n -+ rw [LSeries.term_def] -+ split_ifs with h_zero -+ · -+ simp [h_zero] -+ · -+ rw [div_eq_mul_inv, Complex.cpow_neg] -+ -+lemma zeta1zetaseries {s : ℂ} (hs : 1 < s.re) : -+-logDerivZeta s = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-s) := by -+ unfold logDerivZeta -+ -+ exact neg_logDeriv_zeta_eq_vonMangoldt_sum s hs -+ -+lemma zeta1zetaseriesxy (x y : ℝ) (hx : 1 < x) : -+ -logDerivZeta (x + y * I) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I)) := by -+ apply zeta1zetaseries -+ -+ have h : (x + y * I).re = x := by -+ simp [Complex.add_re, Complex.ofReal_re, Complex.ofReal_im] -+ right -+ exact Complex.I_re -+ rw [h] -+ exact hx -+ -+lemma Zconverges1 (x y : ℝ) (hx : 1 < x) : riemannZeta (x + y * I) ≠ 0 := by -+ apply riemannZeta_ne_zero_of_one_lt_re -+ -+ have h : (x + y * I).re = x := by -+ rw [Complex.add_re, Complex.ofReal_re] -+ simp [Complex.mul_re] -+ right -+ exact Complex.I_re -+ rw [h] -+ exact hx -+ -+lemma complex_re_of_real_add_imag (x y : ℝ) : (x + y * I).re = x := by -+ simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im] -+ -+ right -+ exact Complex.I_re -+ -+lemma vonMangoldt_LSeriesSummable (s : ℂ) (hs : 1 < s.re) : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) s := by -+ -+ exact ArithmeticFunction.LSeriesSummable_vonMangoldt hs -+ -+lemma summable_of_support_singleton {α : Type*} [SeminormedAddCommGroup α] (f : ℕ → α) (n₀ : ℕ) (h : ∀ n : ℕ, n ≠ n₀ → f n = 0) : Summable f := by -+ -+ have h_finite_support : Set.Finite (Function.support f) := by -+ -+ have h_subset : Function.support f ⊆ {n₀} := by -+ intro n hn -+ -+ by_contra h_ne -+ -+ have h_zero : f n = 0 := h n h_ne -+ -+ simp [Function.mem_support] at hn -+ exact hn h_zero -+ -+ exact Set.Finite.subset (Set.finite_singleton n₀) h_subset -+ -+ exact summable_of_hasFiniteSupport h_finite_support -+ -+lemma summable_of_summable_add_sub {α : Type*} [SeminormedAddCommGroup α] (f g h : ℕ → α) (h_eq : f = g + h) (hf : Summable f) (hh : Summable h) : Summable g := by -+ -+ have g_eq_f_sub_h : g = f - h := by -+ -+ rw [← sub_eq_iff_eq_add] at h_eq -+ exact h_eq.symm -+ -+ rw [g_eq_f_sub_h] -+ -+ exact hf.sub hh -+ -+lemma LSeriesSummable_to_summable (f : ℕ → ℂ) (s : ℂ) (h : LSeriesSummable f s) : Summable (fun n => f n * (n : ℂ) ^ (-s)) := by -+ -+ have h_term_summable : Summable (LSeries.term f s) := h -+ -+ have h_eq_nonzero : ∀ n : ℕ, n ≠ 0 → LSeries.term f s n = f n * (n : ℂ) ^ (-s) := by -+ intro n hn -+ rw [LSeries.term_of_ne_zero hn] -+ rw [div_eq_mul_inv, Complex.cpow_neg] -+ -+ let diff := fun n => LSeries.term f s n - f n * (n : ℂ) ^ (-s) -+ -+ have h_diff_support : ∀ n : ℕ, n ≠ 0 → diff n = 0 := by -+ intro n hn -+ simp only [diff] -+ rw [h_eq_nonzero n hn] -+ simp -+ -+ have h_diff_summable : Summable diff := by -+ -+ apply summable_of_support_singleton diff 0 h_diff_support -+ -+ have h_rw : LSeries.term f s = (fun n => f n * (n : ℂ) ^ (-s)) + diff := by -+ ext n -+ simp only [diff, Pi.add_apply] -+ ring -+ -+ exact summable_of_summable_add_sub (LSeries.term f s) (fun n => f n * (n : ℂ) ^ (-s)) diff h_rw h_term_summable h_diff_summable -+ -+lemma ReZconverges1 (x y : ℝ) (hx : 1 < x) : -+Summable (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) := by -+ -+ have h_nonzero : riemannZeta (x + y * I) ≠ 0 := Zconverges1 x y hx -+ -+ have h_re_gt_one : 1 < (x + y * I).re := by -+ rw [complex_re_of_real_add_imag] -+ exact hx -+ -+ have h_L_summable : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) := -+ vonMangoldt_LSeriesSummable (x + y * I) h_re_gt_one -+ -+ have h_summable : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) := -+ LSeriesSummable_to_summable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) h_L_summable -+ -+ have h_hasSum : HasSum (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) := -+ h_summable.hasSum -+ -+ have h_hasSum_re : HasSum (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))).re) (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))).re := -+ Complex.hasSum_re h_hasSum -+ -+ exact h_hasSum_re.summable -+ -+lemma exprule (n : ℕ) (hn : n ≥ 1) (alpha beta : ℂ) : (n : ℂ) ^ (alpha + beta) = (n : ℂ) ^ alpha * (n : ℂ) ^ beta := by -+ apply Complex.cpow_add -+ -+ rw [Nat.cast_ne_zero] -+ -+ rw [← Nat.one_le_iff_ne_zero] -+ exact hn -+ -+lemma lem_nxy (n : ℕ) (hn : n ≥ 1) (x y : ℝ) : -+ Complex.cpow (n : ℂ) (-(x + y * I)) = Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) := by -+ -+ have h : -(x + y * I) = (-x : ℂ) + (-(y * I)) := by ring -+ rw [h] -+ -+ exact lem_exprule n hn (-x : ℂ) (-(y * I)) -+ -+lemma lem_zeta1zetaseriesxy2 (x y : ℝ) (hx : 1 < x) : -+ -logDerivZeta (x + y * I) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (Complex.cpow (n : ℂ) ((-x) : ℂ)) * (Complex.cpow (n : ℂ) (-(y * I))) := by -+ -+ rw [zeta1zetaseriesxy x y hx] -+ -+ congr 1 -+ ext n -+ -+ rw [← Complex.cpow_eq_pow] -+ -+ by_cases h : n = 0 -+ · -+ simp [h] -+ · -+ have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h -+ rw [lem_nxy n hn x y] -+ -+ ring -+ -+lemma complex_add_re_ofReal_mul_I (x y : ℝ) : (x + y * I).re = x := by -+ rw [Complex.add_re, Complex.ofReal_re, Complex.re_ofReal_mul] -+ -+ have h : I.re = 0 := Complex.I_re -+ rw [h] -+ simp -+ -+lemma LSeriesSummable_to_explicit_summable (x y : ℝ) (_hx : 1 < x) : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) → Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))) := by -+ intro h_summable -+ -+ have h_vm_zero : (ArithmeticFunction.vonMangoldt 0 : ℂ) = 0 := by -+ simp -+ -+ have h_eq : ∀ n : ℕ, LSeries.term (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) n = -+ (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) := by -+ intro n -+ -+ rw [LSeries.term_def₀ h_vm_zero] -+ -+ rw [← Complex.cpow_eq_pow] -+ -+ by_cases hn : n = 0 -+ · -+ simp [hn] -+ · -+ have hn_ge : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr hn -+ rw [lem_nxy n hn_ge x y] -+ ring -+ -+ have h_term_summable : Summable (fun n => LSeries.term (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) n) := by -+ exact h_summable -+ -+ convert h_term_summable using 1 -+ ext n -+ exact (h_eq n).symm -+ -+lemma Zseriesconverges1 (x y : ℝ) (hx : 1 < x) : -+Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))) := by -+ -+ have h_zeta_ne_zero := Zconverges1 x y hx -+ -+ have h_series := lem_zeta1zetaseriesxy2 x y hx -+ -+ have h_re : 1 < (x + y * I).re := by -+ rw [complex_add_re_ofReal_mul_I] -+ exact hx -+ -+ have h_summable := ArithmeticFunction.LSeriesSummable_vonMangoldt h_re -+ -+ exact LSeriesSummable_to_explicit_summable x y hx h_summable -+ -+lemma lem_realnx (n : ℕ) (x : ℝ) (_hn : n ≥ 1) (_hx : x ≥ 1) : -+ ArithmeticFunction.vonMangoldt n * (n : ℝ) ^ (-x) ≥ 0 := by -+ apply mul_nonneg -+ · -+ exact ArithmeticFunction.vonMangoldt_nonneg -+ · -+ apply Real.rpow_nonneg -+ -+ exact Nat.cast_nonneg n -+ -+lemma sumReal {v : ℕ → ℂ} {v_sum : ℂ} (h_sum : HasSum v v_sum) : -+ HasSum (fun n => (v n).re) v_sum.re := by -+ exact Complex.hasSum_re h_sum -+ -+lemma sumRealLambda (x y : ℝ) (hx : 1 < x) : -+ (∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re = -+ ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re := by -+ apply Complex.re_tsum -+ exact Zseriesconverges1 x y hx -+ -+lemma lem_sumRealZ (x y : ℝ) (hx : 1 < x) : -+ (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re := by -+ -+ rw [lem_zeta1zetaseriesxy2 x y hx] -+ -+ exact sumRealLambda x y hx -+ -+lemma complex_cpow_neg_real (n : ℕ) (x : ℝ) (_hn : n ≥ 1) : Complex.cpow (n : ℂ) ((-x) : ℂ) = Complex.ofReal ((n : ℝ) ^ (-x)) := by -+ -+ have h_nonneg : 0 ≤ (n : ℝ) := Nat.cast_nonneg n -+ -+ rw [Complex.cpow_eq_pow] -+ -+ rw [Complex.ofReal_cpow h_nonneg (-x)] -+ -+ congr 1 -+ -+ simp -+ -+lemma RealLambdaxy (n : ℕ) (x y : ℝ) (hn : n ≥ 1) (_hx : 1 < x) : -+ ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re = -+((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) * (Complex.cpow (n : ℂ) (-(y * I))).re := by -+ -+ let b := ArithmeticFunction.vonMangoldt n * (n : ℝ) ^ (-x) -+ -+ have h1 : (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) = (b : ℂ) := by -+ -+ have h_real_pow : Complex.cpow (n : ℂ) ((-x) : ℂ) = Complex.ofReal ((n : ℝ) ^ (-x)) := by -+ exact complex_cpow_neg_real n x hn -+ -+ rw [h_real_pow] -+ rw [← Complex.ofReal_mul] -+ -+ have h2 : (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) = -+ ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ)) * Complex.cpow (n : ℂ) (-(y * I)) := by -+ rw [mul_assoc] -+ -+ rw [h2, h1] -+ -+ exact lem_realbw b (Complex.cpow (n : ℂ) (-(y * I))) -+ -+lemma ReZseriesRen (x y : ℝ) (hx : 1 < x) : -+ (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) * (Complex.cpow (n : ℂ) (-(y * I))).re := by -+ rw [lem_sumRealZ x y hx] -+ congr 1 -+ ext n -+ by_cases h : n = 0 -+ · simp [h] -+ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h -+ exact RealLambdaxy n x y hn hx -+ -+lemma Rezeta1zetaseries (x y : ℝ) (hx : 1 < x) : -+ (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by -+ rw [ReZseriesRen x y hx] -+ congr 1 -+ ext n -+ by_cases h : n = 0 -+ · simp [h] -+ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h -+ rw [← lem_eacosalog3 n hn y] -+ -+ congr 1 -+ -+ rw [Complex.cpow_eq_pow] -+ -+ simp [I] -+ -+lemma complex_vonMangoldt_real_part_eq (n : ℕ) (x y : ℝ) (hn : n ≥ 1) (hx : 1 < x) : -+((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re = -+(ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by -+ -+ rw [lem_nxy n hn x y] -+ -+ rw [← mul_assoc] -+ -+ rw [RealLambdaxy n x y hn hx] -+ -+ have h_cpow : (Complex.cpow (n : ℂ) (-(y * I))).re = ((n : ℂ) ^ (-(y * I))).re := by -+ rw [Complex.cpow_eq_pow] -+ -+ have h_I : -(y * I) = -y * Complex.I := by -+ simp [I] -+ -+ rw [h_cpow, h_I] -+ -+ rw [lem_eacosalog3 n hn y] -+ -+lemma Rezetaseries_convergence (x y : ℝ) (hx : 1 < x) : -+ Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ))) := by -+ -+ have h1 : Summable (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) := -+ ReZconverges1 x y hx -+ -+ have h2 : ∀ n : ℕ, ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re = -+ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by -+ intro n -+ by_cases h : n = 0 -+ · simp [h] -+ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h -+ exact complex_vonMangoldt_real_part_eq n x y hn hx -+ -+ have h3 : (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) = -+ (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ))) := -+ funext h2 -+ rwa [← h3] -+ -+lemma Rezetaseries2t (x t : ℝ) (hx : 1 < x) : -+ Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (2 * t * Real.log (n : ℝ))) := by -+ -+ exact Rezetaseries_convergence x (2 * t) hx -+ -+lemma lem_cost0 (n : ℕ) (_hn : n ≥ 1) (t : ℝ) (ht : t = 0) : Real.cos (t * Real.log (n : ℝ)) = 1 := by -+ rw [ht] -+ simp -+ -+lemma Rezetaseries0 (x : ℝ) (hx : 1 < x) : -+ Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) := by -+ -+ have h1 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (0 * Real.log (n : ℝ))) := -+ Rezetaseries_convergence x 0 hx -+ -+ convert h1 using 1 -+ ext n -+ by_cases h : n = 0 -+ · simp [h] -+ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h -+ rw [lem_cost0 n hn 0 rfl] -+ ring -+ -+lemma uniform_bound_Z0_complex : ∃ δ0 > 0, ∃ C0 ≥ 0, ∀ δ : ℝ, 0 < δ → δ < δ0 → ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C0 := by -+ -+ let f : ℝ → ℂ := fun δ => -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ)) -+ -+ have hO := Z0bound -+ -+ rcases (Asymptotics.isBigO_iff).1 hO with ⟨c, hc⟩ -+ have h_event : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c := by -+ -+ have : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c * ‖(1 : ℂ)‖ := hc -+ refine this.mono ?_ -+ intro δ hδ -+ have : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp -+ simpa [this] using hδ -+ -+ rcases (Filter.eventually_iff_exists_mem).1 h_event with ⟨S, hS_in, hS_bound⟩ -+ -+ rcases (mem_nhdsGT_iff_exists_Ioc_subset).1 hS_in with ⟨δ0, hδ0pos, hIoc_sub_S⟩ -+ -+ refine ⟨δ0, hδ0pos, max c 0, le_max_right _ _, ?_⟩ -+ intro δ hδpos hδlt -+ -+ have hδ_in_S : δ ∈ S := hIoc_sub_S ⟨hδpos, le_of_lt hδlt⟩ -+ -+ have hnorm_le_c : ‖f δ‖ ≤ c := hS_bound δ hδ_in_S -+ -+ exact le_trans hnorm_le_c (le_max_left _ _) -+ -+lemma cpow_neg_zero_I (z : ℂ) : z ^ (-(0 : ℝ) * Complex.I) = (1 : ℂ) := by -+ simp -+ -+lemma tsum_nonneg_of_nonneg {f : ℕ → ℝ} (hnon : ∀ n, 0 ≤ f n) : 0 ≤ ∑' n, f n := by -+ simpa using (tsum_nonneg hnon) -+ -+lemma vonMangoldt_rpow_nonneg (x : ℝ) : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) := by -+ intro n -+ have h1 : 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) := ArithmeticFunction.vonMangoldt_nonneg -+ have h2 : 0 ≤ (n : ℝ) ^ (-x) := by -+ exact Real.rpow_nonneg (show 0 ≤ (n : ℝ) from Nat.cast_nonneg n) _ -+ simpa using mul_nonneg h1 h2 -+ -+lemma cpow_neg_real_of_nat (n : ℕ) (x : ℝ) (hn : 1 ≤ n) : -+ (n : ℂ) ^ (-(x : ℂ)) = Complex.ofReal ((n : ℝ) ^ (-x)) := by -+ simpa using complex_cpow_neg_real n x hn -+ -+lemma norm_negLogDerivZeta_real_eq_abs_tsum_vonMangoldt (x : ℝ) (hx : 1 < x) : -+ ‖-logDerivZeta (x : ℂ)‖ = |∑' n, ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x))| := by -+ -+ have hx' : 1 < (x : ℂ).re := by simpa using hx -+ have hseries := zeta1zetaseries (s := (x : ℂ)) hx' -+ -+ let g : ℕ → ℝ := fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) -+ have hterm : ∀ n : ℕ, -+ (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ)) = (g n : ℂ) := by -+ intro n -+ by_cases h : n = 0 -+ · -+ have hv0C : (ArithmeticFunction.vonMangoldt 0 : ℂ) = 0 := by -+ simp -+ have hv0R : (ArithmeticFunction.vonMangoldt 0 : ℝ) = 0 := by -+ simp -+ simp [g, h, hv0R] -+ · -+ have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h -+ have hcp : (n : ℂ) ^ (-(x : ℂ)) = Complex.ofReal ((n : ℝ) ^ (-x)) := -+ complex_cpow_neg_real n x hn -+ -+ have : (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ)) -+ = Complex.ofReal (ArithmeticFunction.vonMangoldt n) * Complex.ofReal ((n : ℝ) ^ (-x)) := by -+ simp [hcp] -+ simpa [g, Complex.ofReal_mul] using this -+ -+ have hsum_eq : (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ))) -+ = ∑' n, (g n : ℂ) := by -+ -+ have hfun : (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ))) -+ = (fun n => (g n : ℂ)) := funext hterm -+ simp [hfun] -+ -+ have hsum_ofReal : (∑' n, (g n : ℂ)) = Complex.ofReal (∑' n, g n) := by -+ simpa using (Complex.ofReal_tsum g).symm -+ -+ have hval : -logDerivZeta (x : ℂ) = Complex.ofReal (∑' n, g n) := by -+ -+ simpa [hsum_eq, hsum_ofReal] using hseries -+ -+ calc -+ ‖-logDerivZeta (x : ℂ)‖ = ‖Complex.ofReal (∑' n, g n)‖ := by simp [hval] -+ _ = |∑' n, g n| := by -+ exact (RCLike.norm_ofReal (K := ℂ) (∑' n, g n)) -+ -+lemma tsum_le_of_nonneg_of_le {f g : ℕ → ℝ} (hf : Summable f) (hg : Summable g) (_hnonneg : ∀ n, 0 ≤ f n) (hle : ∀ n, f n ≤ g n) : (∑' n, f n) ≤ (∑' n, g n) := by -+ classical -+ exact Summable.tsum_le_tsum hle hf hg -+ -+lemma rpow_neg_antitone {a x y : ℝ} (ha : 1 ≤ a) (hxy : x ≥ y) : a ^ (-x) ≤ a ^ (-y) := by -+ -+ simpa using (Real.rpow_le_rpow_of_exponent_le ha (neg_le_neg hxy)) -+ -+lemma isPrimePow_zero_false : IsPrimePow 0 = False := by -+ apply propext -+ constructor -+ · intro h -+ rcases (isPrimePow_nat_iff 0).1 h with ⟨p, k, hp, hkpos, hk⟩ -+ have hpnz : (p : ℕ) ≠ 0 := by -+ exact ne_of_gt (Nat.Prime.pos hp) -+ have hpow_ne : (p : ℕ) ^ k ≠ 0 := pow_ne_zero _ hpnz -+ exact (hpow_ne (by simp [hk])) -+ · intro hFalse -+ exact hFalse.elim -+ -+lemma bounded_on_compact_interval (a b : ℝ) (h0 : 0 < a) (_hle : a ≤ b) : ∃ Cmid ≥ 0, ∀ δ : ℝ, a ≤ δ → δ ≤ b → ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ Cmid := by -+ -+ let s : Set ℝ := Set.Icc a b -+ let f : ℝ → ℂ := fun δ => -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ)) -+ -+ let H : ℂ → ℂ := Function.update (fun z : ℂ => (z - 1) * riemannZeta z) 1 1 -+ -+ have hH_diff : Differentiable ℂ H := by -+ intro z -+ rcases eq_or_ne z 1 with rfl | hz -+ · -+ refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt -+ · -+ filter_upwards [self_mem_nhdsWithin] with t ht -+ have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) t := by -+ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := -+ (differentiableAt_id.sub_const 1) -+ have h2 : DifferentiableAt ℂ riemannZeta t := -+ (differentiableAt_riemannZeta ht) -+ exact h1.mul h2 -+ apply DifferentiableAt.congr_of_eventuallyEq hdiff -+ filter_upwards [eventually_ne_nhds ht] with u hu using by -+ simp [H, Function.update_of_ne hu] -+ · -+ simpa [H, continuousAt_update_same] using riemannZeta_residue_one -+ · -+ have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) z := by -+ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) -+ have h2 : DifferentiableAt ℂ riemannZeta z := (differentiableAt_riemannZeta hz) -+ exact h1.mul h2 -+ apply DifferentiableAt.congr_of_eventuallyEq hdiff -+ filter_upwards [eventually_ne_nhds hz] with u hu using by -+ simp [H, Function.update_of_ne hu] -+ -+ let G : ℂ → ℂ := fun z => - (deriv H z) / H z -+ -+ have h_eq_on_pos : ∀ ⦃δ : ℝ⦄, 0 < δ → -+ (-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))) = G ((1 : ℂ) + δ) := by -+ intro δ hδ -+ -+ let z : ℂ := (1 : ℂ) + δ -+ have hz_ne_one : z ≠ (1 : ℂ) := by -+ intro h -+ have hre : (1 + δ : ℝ) = 1 := by -+ simpa [z, Complex.add_re, Complex.ofReal_re] using congrArg Complex.re h -+ have : δ = 0 := by linarith -+ exact (ne_of_gt hδ) this -+ have hzeta_ne : riemannZeta z ≠ 0 := by -+ have : 1 < z.re := by simpa [z, Complex.add_re, Complex.ofReal_re] using by linarith -+ exact riemannZeta_ne_zero_of_one_le_re (le_of_lt this) -+ -+ have h_id_deriv : deriv (fun u : ℂ => u - 1) z = 1 := by -+ exact ((hasDerivAt_id z).sub_const 1).deriv -+ have h_log_id : logDeriv (fun u : ℂ => u - 1) z = 1 / (z - 1) := by -+ simp [logDeriv_apply, h_id_deriv] -+ have hz1 : z - 1 ≠ 0 := by simpa using sub_ne_zero.mpr hz_ne_one -+ have hζ : riemannZeta z ≠ 0 := hzeta_ne -+ -+ have h_deriv_mul : deriv (fun u : ℂ => (u - 1) * riemannZeta u) z -+ = riemannZeta z + (z - 1) * deriv riemannZeta z := by -+ have h1 : HasDerivAt (fun u : ℂ => u - 1) 1 z := (hasDerivAt_id z).sub_const 1 -+ have h2 : HasDerivAt riemannZeta (deriv riemannZeta z) z := -+ (differentiableAt_riemannZeta hz_ne_one).hasDerivAt -+ simpa [one_mul, mul_comm, mul_left_comm, mul_assoc] using! (h1.mul h2).deriv -+ -+ have h_prodLog : -+ logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = -+ logDeriv (fun u : ℂ => u - 1) z + logDerivZeta z := by -+ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) -+ have h2 : DifferentiableAt ℂ riemannZeta z := (differentiableAt_riemannZeta hz_ne_one) -+ have hfnz : (fun u : ℂ => u - 1) z ≠ 0 := by simpa using hz1 -+ have hgnz : riemannZeta z ≠ 0 := hζ -+ simpa [logDerivZeta] using! -+ (logDeriv_mul (x := z) (f := fun u : ℂ => u - 1) (g := riemannZeta) hfnz hgnz h1 h2) -+ -+ have h_step : -logDerivZeta z - (1 / (z - 1)) -+ = - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z := by -+ have : logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z -+ = 1 / (z - 1) + logDerivZeta z := by -+ simpa [h_log_id, add_comm] using h_prodLog -+ have hneg : - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z -+ = - (1 / (z - 1) + logDerivZeta z) := by -+ simpa using congrArg Neg.neg this -+ simpa [sub_eq_add_neg, add_comm] using hneg.symm -+ -+ have h_H_eq : H z = (z - 1) * riemannZeta z := by -+ simp [H, Function.update_of_ne hz_ne_one] -+ -+ have h_eq_event : (fun u : ℂ => H u) =ᶠ[nhds z] (fun u : ℂ => (u - 1) * riemannZeta u) := by -+ filter_upwards [eventually_ne_nhds hz_ne_one] with u hu -+ simp [H, Function.update_of_ne hu] -+ -+ have h_hasDeriv_prod : -+ HasDerivAt (fun u : ℂ => (u - 1) * riemannZeta u) -+ (riemannZeta z + (z - 1) * deriv riemannZeta z) z := by -+ have h1 : HasDerivAt (fun u : ℂ => u - 1) 1 z := (hasDerivAt_id z).sub_const 1 -+ have h2 : HasDerivAt riemannZeta (deriv riemannZeta z) z := -+ (differentiableAt_riemannZeta hz_ne_one).hasDerivAt -+ simpa [one_mul, mul_comm, mul_left_comm, mul_assoc] using! (h1.mul h2) -+ -+ have h_hasDeriv_H : -+ HasDerivAt H (riemannZeta z + (z - 1) * deriv riemannZeta z) z := -+ h_hasDeriv_prod.congr_of_eventuallyEq h_eq_event -+ -+ have h_dH : deriv H z = riemannZeta z + (z - 1) * deriv riemannZeta z := by -+ simpa using h_hasDeriv_H.deriv -+ -+ have h_log_to_G : - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = G z := by -+ have h' : logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = (deriv H z) / H z := by -+ simp [logDeriv_apply, h_H_eq, h_dH, h_deriv_mul] -+ have hneg' := congrArg (fun w => -w) h' -+ simpa [G, neg_div] using hneg' -+ -+ have : -logDerivZeta z - (1 / (z - 1)) = G z := by -+ simpa using h_step.trans h_log_to_G -+ -+ simpa [z] using this -+ -+ let F : ℝ → ℂ := fun δ => G ((1 : ℂ) + δ) -+ -+ have hH_analytic_univ : AnalyticOnNhd ℂ H Set.univ := -+ (Complex.analyticOnNhd_univ_iff_differentiable).2 hH_diff -+ -+ have hF_contOn : ContinuousOn F s := by -+ intro δ0 hδ0 -+ -+ let s0 : ℂ := (1 : ℂ) + δ0 -+ have hδ0pos : 0 < δ0 := lt_of_lt_of_le h0 hδ0.1 -+ have hs0_ne_one : s0 ≠ (1 : ℂ) := by -+ intro h -+ have hre : (1 + δ0 : ℝ) = 1 := by -+ simpa [s0, Complex.add_re, Complex.ofReal_re] using congrArg Complex.re h -+ have : δ0 = 0 := by linarith -+ exact (ne_of_gt hδ0pos) this -+ have hs0_re_gt_one : 1 < s0.re := by -+ simpa [s0, Complex.add_re, Complex.ofReal_re] using by linarith -+ have hζ_ne : riemannZeta s0 ≠ 0 := -+ riemannZeta_ne_zero_of_one_le_re (le_of_lt hs0_re_gt_one) -+ have hHs0_eq : H s0 = (s0 - 1) * riemannZeta s0 := by -+ simp [H, Function.update_of_ne hs0_ne_one] -+ have hHs0_ne : H s0 ≠ 0 := by -+ have hs0m1_ne : s0 - 1 ≠ 0 := sub_ne_zero.mpr hs0_ne_one -+ have : (s0 - 1) * riemannZeta s0 ≠ 0 := mul_ne_zero hs0m1_ne hζ_ne -+ simpa [hHs0_eq] using this -+ -+ have hH_an_at_s0 : AnalyticAt ℂ H s0 := hH_analytic_univ s0 (by simp) -+ have hH'_an_at_s0 : AnalyticAt ℂ (fun z => deriv H z) s0 := hH_an_at_s0.deriv -+ have hG_an_at_s0 : AnalyticAt ℂ (fun z => G z) s0 := by -+ have h_div : AnalyticAt ℂ (fun z => (deriv H z) / H z) s0 := -+ hH'_an_at_s0.div hH_an_at_s0 (by simpa using hHs0_ne) -+ have h_neg : AnalyticAt ℂ (fun z => -((deriv H z) / H z)) s0 := h_div.neg -+ simpa [G, div_eq_mul_inv, mul_left_comm, mul_comm, mul_assoc] using h_neg -+ have hG_cont_s0 : ContinuousAt (fun z : ℂ => G z) s0 := hG_an_at_s0.continuousAt -+ -+ let affine : ℝ → ℂ := fun δ => (1 : ℂ) + (δ : ℂ) -+ have h_affine_at : ContinuousAt affine δ0 := -+ (continuousAt_const).add Complex.continuous_ofReal.continuousAt -+ -+ have hy : affine δ0 = s0 := by simp [affine, s0] -+ have hG_at : ContinuousAt (fun z : ℂ => G z) (affine δ0) := by simpa [hy] using hG_cont_s0 -+ have h_comp_at : ContinuousAt (fun δ : ℝ => G (affine δ)) δ0 := hG_at.comp h_affine_at -+ simpa [F, s, affine] using h_comp_at.continuousWithinAt -+ -+ have h_eq_on_s : ∀ ⦃δ : ℝ⦄, δ ∈ s → f δ = F δ := by -+ intro δ hδ -+ have hδpos : 0 < δ := lt_of_lt_of_le h0 hδ.1 -+ simpa [f, F] using h_eq_on_pos hδpos -+ -+ have hK : IsCompact s := isCompact_Icc -+ have hNorm_contOn : ContinuousOn (fun δ => ‖F δ‖) s := hF_contOn.norm -+ have hBdd : BddAbove ((fun δ => ‖F δ‖) '' s) := IsCompact.bddAbove_image hK hNorm_contOn -+ rcases hBdd with ⟨C, hC⟩ -+ -+ refine ⟨max C 0, le_max_right _ _, ?_⟩ -+ intro δ hδa hδb -+ -+ change ‖f δ‖ ≤ max C 0 -+ have hδmem : δ ∈ s := ⟨hδa, hδb⟩ -+ have himg : (fun δ => ‖F δ‖) δ ∈ (fun δ => ‖F δ‖) '' s := ⟨δ, hδmem, rfl⟩ -+ have hbound : ‖F δ‖ ≤ C := hC himg -+ have hbound' : ‖F δ‖ ≤ max C 0 := le_trans hbound (le_max_left _ _) -+ -+ have hfδ_eq : f δ = F δ := h_eq_on_s hδmem -+ calc -+ ‖f δ‖ = ‖F δ‖ := by simp [hfδ_eq] -+ _ ≤ max C 0 := hbound' -+ -+lemma norm_one_div_coe_real_le_one_of_one_le {δ : ℝ} (h : 1 ≤ δ) : ‖(1 : ℂ) / (δ : ℂ)‖ ≤ 1 := by -+ -+ have hδpos : 0 < δ := lt_of_lt_of_le zero_lt_one h -+ calc -+ ‖(1 : ℂ) / (δ : ℂ)‖ = ‖(1 : ℂ)‖ / ‖(δ : ℂ)‖ := by -+ exact norm_div (1 : ℂ) (δ : ℂ) -+ _ = 1 / ‖(δ : ℂ)‖ := by simp -+ _ = 1 / |δ| := by simp -+ _ = 1 / δ := by simp [abs_of_nonneg (le_of_lt hδpos)] -+ _ ≤ 1 := by -+ -+ simpa using (one_div_le_one_div_of_le (ha := (zero_lt_one)) (h := h)) -+ -+lemma Z0bound_const : -+ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), -+ ‖ -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C := by -+ -+ rcases uniform_bound_Z0_complex with ⟨δ0, hδ0pos, C0, hC0nonneg, hsmall⟩ -+ -+ let a : ℝ := min δ0 1 -+ have ha_pos : 0 < a := lt_min_iff.2 ⟨hδ0pos, zero_lt_one⟩ -+ have ha_le_one : a ≤ 1 := min_le_right _ _ -+ rcases bounded_on_compact_interval a 1 ha_pos ha_le_one with ⟨Cmid, hCmid_nonneg, hmid⟩ -+ -+ let C2 : ℝ := ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) -+ have hC2_nonneg : 0 ≤ C2 := by -+ have hnn : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) := -+ vonMangoldt_rpow_nonneg 2 -+ exact tsum_nonneg_of_nonneg hnn -+ -+ let C : ℝ := 2 + C0 + Cmid + C2 -+ have hCgt1 : 1 < C := by -+ have : 2 ≤ 2 + C0 + Cmid + C2 := by linarith [hC0nonneg, hCmid_nonneg, hC2_nonneg] -+ linarith -+ refine ⟨C, hCgt1, ?_⟩ -+ intro δ hδpos -+ by_cases hlt : δ < δ0 -+ · -+ have hbound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C0 := -+ hsmall δ hδpos hlt -+ -+ have hC0_le_C : C0 ≤ C := by linarith -+ exact le_trans hbound hC0_le_C -+ · -+ have hge : δ0 ≤ δ := le_of_not_gt hlt -+ rcases le_total δ 1 with hδle1 | hδge1 -+ · -+ have ha_le_δ : a ≤ δ := le_trans (min_le_left δ0 1) hge -+ have hbound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ Cmid := -+ hmid δ ha_le_δ hδle1 -+ -+ have hCmid_le_C : Cmid ≤ C := by linarith -+ exact le_trans hbound hCmid_le_C -+ · -+ -+ let x : ℝ := 1 + δ -+ have hx1 : 1 < x := by -+ have : 0 < δ := hδpos -+ have : 1 < 1 + δ := lt_add_of_pos_right 1 this -+ exact this -+ -+ have h_norm_eq_abs_real : ‖-logDerivZeta (x : ℂ)‖ -+ = |∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)| := -+ norm_negLogDerivZeta_real_eq_abs_tsum_vonMangoldt x hx1 -+ -+ have eqArg : ((1 : ℂ) + δ) = (x : ℂ) := by simp [x] -+ -+ have h_norm_eq_abs : ‖-logDerivZeta ((1 : ℂ) + δ)‖ -+ = |∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)| := by -+ simpa [eqArg] using h_norm_eq_abs_real -+ -+ let S : ℝ := ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) -+ have hsum_nonneg : 0 ≤ S := by -+ change 0 ≤ ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) -+ exact tsum_nonneg_of_nonneg (vonMangoldt_rpow_nonneg x) -+ -+ have h_norm_le_sum : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ S := by -+ have : ‖-logDerivZeta ((1 : ℂ) + δ)‖ = |S| := h_norm_eq_abs -+ have : |S| = S := abs_of_nonneg hsum_nonneg -+ exact le_of_eq (h_norm_eq_abs.trans this) -+ -+ have hx_ge_two : 2 ≤ x := by -+ -+ have : 1 ≤ δ := hδge1 -+ have : 2 ≤ 1 + δ := by linarith -+ exact this -+ -+ have h_le_2 : ∀ n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) -+ ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) := by -+ intro n -+ by_cases h0 : n = 0 -+ · simp [h0] -+ · have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h0 -+ have hn' : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn -+ have hrpow : (n : ℝ) ^ (-x) ≤ (n : ℝ) ^ (-(2 : ℝ)) := -+ rpow_neg_antitone hn' hx_ge_two -+ have hΛ_nonneg : 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) := -+ ArithmeticFunction.vonMangoldt_nonneg -+ exact mul_le_mul_of_nonneg_left hrpow hΛ_nonneg -+ -+ have h_summ_x : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) := by -+ exact Rezetaseries0 x hx1 -+ have h_summ_2 : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ))) := -+ Rezetaseries0 2 (by norm_num) -+ have hsum_le : S ≤ C2 := by -+ -+ have h_nonneg_x : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) := -+ vonMangoldt_rpow_nonneg x -+ exact tsum_le_of_nonneg_of_le h_summ_x h_summ_2 h_nonneg_x h_le_2 -+ -+ have h_norm_le_C2 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C2 := -+ le_trans h_norm_le_sum hsum_le -+ -+ have h_one_div_le : ‖(1 : ℂ) / (δ : ℂ)‖ ≤ 1 := norm_one_div_coe_real_le_one_of_one_le hδge1 -+ have htriangle : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ -+ ≤ ‖-logDerivZeta ((1 : ℂ) + δ)‖ + ‖(1 : ℂ) / (δ : ℂ)‖ := -+ norm_sub_le _ _ -+ have hlarge_bound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C2 + 1 := by -+ refine le_trans htriangle ?_ -+ exact add_le_add h_norm_le_C2 h_one_div_le -+ -+ have hC2_le_C : C2 + 1 ≤ C := by linarith -+ exact le_trans hlarge_bound hC2_le_C -+ -+lemma Z0boundRe_const : -+ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), -+ ((-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))).re) ≤ C := by -+ -+ rcases Z0bound_const with ⟨C, hCpos, hC⟩ -+ use C -+ constructor -+ · exact hCpos -+ · intro δ hδ -+ -+ have h_bound := hC δ hδ -+ exact le_trans (Complex.re_le_norm _) h_bound -+ -+lemma Z0boundRe_const2 : -+ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), -+ ((-logDerivZeta ((1 : ℂ) + δ)).re + (-(1 / (δ : ℂ))).re) ≤ C := by -+ -+ rcases Z0boundRe_const with ⟨C, hC_pos, hC⟩ -+ use C, hC_pos -+ intro δ hδ -+ have h_sub_re : ((-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))).re) = -+ ((-logDerivZeta ((1 : ℂ) + δ)).re + (-(1 / (δ : ℂ))).re) := by -+ rw [Complex.sub_re] -+ rfl -+ rw [← h_sub_re] -+ exact hC δ hδ -+ -+lemma Z0boundRe_const3 : -+ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), -+ (-logDerivZeta ((1 : ℂ) + δ)).re - (1 / δ) ≤ C := by -+ -+ rcases Z0boundRe_const2 with ⟨C, hCpos, hC⟩ -+ use C, hCpos -+ intro δ hδ -+ -+ have h := hC δ hδ -+ -+ have h_re_eq : (-(1 / (δ : ℂ))).re = -(1 / δ) := by -+ rw [Complex.neg_re, Complex.div_re, Complex.one_re, Complex.ofReal_re, Complex.ofReal_im] -+ simp [Complex.normSq_ofReal] -+ -+ rwa [h_re_eq] at h -+ -+lemma Z341bounds_const : -+ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0) (_hδ1 : δ < 1), ∀ t : ℝ, 2 < |t| → ∀ σ : ℝ, -+ (σ + t * Complex.I) ∈ zeroZ → -+ 3 * (-logDerivZeta ((1 : ℂ) + δ)).re -+ + 4 * (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re -+ + (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re -+ ≤ 3 / δ - 4 / (1 + δ - σ) + C * Real.log (|t| + 2) := by -+ -+ rcases Z0boundRe_const3 with ⟨C0, hC0pos, hZ0⟩ -+ rcases Z1bound with ⟨C1, hC1pos, hZ1⟩ -+ rcases lem_Z2bound with ⟨C2, hC2pos, hZ2⟩ -+ -+ let C := 3 * C0 + 4 * C1 + C2 -+ -+ have hC_gt_one : 1 < C := by -+ have h1 : 1 < C0 := hC0pos -+ have h2 : 3 < 3 * C0 := by linarith [mul_lt_mul_of_pos_left h1 (by norm_num : (0 : ℝ) < 3)] -+ have h3 : 0 < 4 * C1 := mul_pos (by norm_num) (lt_trans zero_lt_one hC1pos) -+ have h4 : 0 < C2 := lt_trans zero_lt_one hC2pos -+ linarith [h2, h3, h4] -+ -+ use C -+ constructor -+ · exact hC_gt_one -+ · intro δ hδpos hδ1 t ht σ hσ -+ -+ have hZ0_bound : (-logDerivZeta ((1 : ℂ) + δ)).re ≤ C0 + (1 / δ) := by -+ have := hZ0 δ hδpos -+ linarith -+ -+ have hZ1_bound : (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re ≤ -(1 / (1 + δ - σ)) + C1 * Real.log (|t| + 2) := by -+ let s := σ + t * Complex.I -+ have hs_mem : s ∈ zeroZ := hσ -+ have hs_im : s.im = t := by simp [s] -+ have hs_re : s.re = σ := by simp [s] -+ have hδ_cond : 0 < δ ∧ δ < 1 := ⟨hδpos, hδ1⟩ -+ have := hZ1 δ hδ_cond t ht s ⟨hs_mem, hs_im⟩ -+ rw [hs_re] at this -+ exact this -+ -+ have hZ2_bound : (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re ≤ C2 * Real.log (|t| + 2) := by -+ have hδ_cond : 0 < δ ∧ δ < 1 := ⟨hδpos, hδ1⟩ -+ exact hZ2 t ht δ hδ_cond -+ -+ have hlog_ge_one : 1 ≤ Real.log (|t| + 2) := by -+ have h1 : 2 < |t| := ht -+ have h2 : Real.exp 1 < 3 := lem_three_gt_e -+ have he_lt_t2 : Real.exp 1 < |t| + 2 := by linarith -+ have ht2_pos : 0 < |t| + 2 := by linarith [abs_nonneg t] -+ exact Real.le_log_iff_exp_le ht2_pos |>.mpr (le_of_lt he_lt_t2) -+ -+ calc -+ 3 * (-logDerivZeta ((1 : ℂ) + δ)).re + 4 * (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re + (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re -+ ≤ 3 * (C0 + (1 / δ)) + 4 * (-(1 / (1 + δ - σ)) + C1 * Real.log (|t| + 2)) + C2 * Real.log (|t| + 2) := by -+ exact add_le_add (add_le_add (mul_le_mul_of_nonneg_left hZ0_bound (by norm_num)) (mul_le_mul_of_nonneg_left hZ1_bound (by norm_num))) hZ2_bound -+ _ = 3 * C0 + 3 / δ - 4 / (1 + δ - σ) + (4 * C1 + C2) * Real.log (|t| + 2) := by ring -+ _ = 3 / δ - 4 / (1 + δ - σ) + 3 * C0 + (4 * C1 + C2) * Real.log (|t| + 2) := by ring -+ _ = 3 / δ - 4 / (1 + δ - σ) + ((4 * C1 + C2) * Real.log (|t| + 2) + 3 * C0) := by ring -+ _ ≤ 3 / δ - 4 / (1 + δ - σ) + (4 * C1 + C2 + 3 * C0) * Real.log (|t| + 2) := by -+ -+ have hC0_pos : 0 < C0 := lt_trans zero_lt_one hC0pos -+ have hC0_nonneg : 0 ≤ 3 * C0 := mul_nonneg (by norm_num) (le_of_lt hC0_pos) -+ have h_absorb := absorb_pos_constant_into_log (L := Real.log (|t| + 2)) (A := 4 * C1 + C2) (c := 3 * C0) hlog_ge_one hC0_nonneg -+ -+ exact add_le_add_right h_absorb (3 / δ - 4 / (1 + δ - σ)) -+ _ = 3 / δ - 4 / (1 + δ - σ) + (3 * C0 + 4 * C1 + C2) * Real.log (|t| + 2) := by ring -+ _ = 3 / δ - 4 / (1 + δ - σ) + C * Real.log (|t| + 2) := by ring -+ -+def ZeroAt (σ t : ℝ) : Prop := -+ (σ + t * I) ∈ zeroZ -+ -+def Ft (σ : ℝ) : Filter ℝ := -+ (Filter.atTop ⊔ Filter.atBot) ⊓ Filter.principal {t : ℝ | ZeroAt σ t} -+ -+def Fδ : Filter ℝ := nhdsWithin 0 (Set.Ioi 0) -+ -+lemma Rezeta1zetaseries1 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ (-logDerivZeta ((1 : ℂ) + delta + t * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) := by -+ -+ have h1 : 1 < 1 + delta := by linarith [hdelta] -+ convert Rezeta1zetaseries (1 + delta) t h1 -+ -+ simp [Complex.ofReal_add] -+ -+lemma Rezeta1zetaseries2 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ)) := by -+ -+ have h1 : 1 < 1 + delta := by linarith [hdelta] -+ -+ have h2 : (1 : ℂ) + delta + (2 * t) * I = (1 + delta : ℝ) + ((2 * t) : ℝ) * I := by -+ simp [Complex.ofReal_add, Complex.ofReal_one, Complex.ofReal_mul] -+ rw [h2] -+ exact Rezeta1zetaseries (1 + delta) (2 * t) h1 -+ -+lemma Rezeta1zetaseries0 (delta : ℝ) (hdelta : delta > 0) : -+ (-logDerivZeta ((1 : ℂ) + delta)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) := by -+ -+ have h_series : (-logDerivZeta ((1 : ℂ) + delta + 0 * I)).re = -+ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (0 * Real.log (n : ℝ)) := -+ Rezeta1zetaseries1 0 delta hdelta -+ -+ have h_lhs : (-logDerivZeta ((1 : ℂ) + delta + 0 * I)).re = (-logDerivZeta ((1 : ℂ) + delta)).re := by -+ congr 2 -+ simp -+ -+ have h_rhs : ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (0 * Real.log (n : ℝ)) = -+ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) := by -+ congr 1 -+ funext n -+ by_cases h : n = 0 -+ · simp [h] -+ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h -+ rw [lem_cost0 n hn 0 rfl, mul_one] -+ -+ rw [← h_lhs, h_series, h_rhs] -+ -+lemma Z341series (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ (3 * (-logDerivZeta ((1 : ℂ) + delta)).re + -+ 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + -+ (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re) -+ = -+ (3 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + -+ 4 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + -+ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := by -+ rw [Rezeta1zetaseries0 delta hdelta, Rezeta1zetaseries1 t delta hdelta, Rezeta1zetaseries2 t delta hdelta] -+ -+lemma lem341seriesConv (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ Summable (fun n : ℕ => -+ 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + -+ 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + -+ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := by -+ -+ have h1 : 1 < 1 + delta := by linarith [hdelta] -+ -+ have h2 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := -+ Rezetaseries0 (1 + delta) h1 -+ -+ have h3 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := -+ Rezetaseries_convergence (1 + delta) t h1 -+ -+ have h4 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := -+ Rezetaseries2t (1 + delta) t h1 -+ -+ have h5 : Summable (fun n : ℕ => 3 * ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)))) := -+ Summable.mul_left 3 h2 -+ -+ have h6 : Summable (fun n : ℕ => 4 * ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)))) := -+ Summable.mul_left 4 h3 -+ -+ have h5' : Summable (fun n : ℕ => 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := by -+ convert h5 using 1 -+ ext n -+ ring -+ -+ have h6' : Summable (fun n : ℕ => 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := by -+ convert h6 using 1 -+ ext n -+ ring -+ -+ have h7 : Summable (fun n : ℕ => -+ 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + -+ 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := -+ h5'.add h6' -+ -+ exact h7.add h4 -+ -+lemma lem341series (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ (3 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) -+ + (4 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) -+ + (∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) -+ = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by -+ -+ have h1 : 1 < 1 + delta := by linarith [hdelta] -+ -+ have h2 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := -+ Rezetaseries0 (1 + delta) h1 -+ -+ have h3 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := -+ Rezetaseries_convergence (1 + delta) t h1 -+ -+ have h4 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := -+ Rezetaseries2t (1 + delta) t h1 -+ -+ rw [← Summable.tsum_mul_left 3 h2] -+ rw [← Summable.tsum_mul_left 4 h3] -+ -+ rw [← Summable.tsum_add (Summable.mul_left 3 h2) (Summable.mul_left 4 h3)] -+ rw [← Summable.tsum_add] -+ -+ congr 1 -+ ext n -+ ring -+ -+ · exact Summable.add (Summable.mul_left 3 h2) (Summable.mul_left 4 h3) -+ · exact h4 -+ -+lemma lem_341seriesConverge (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ)))) := by -+ -+ have h1 : Summable (fun n : ℕ => -+ 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + -+ 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + -+ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := -+ lem341seriesConv t delta hdelta -+ -+ convert h1 using 1 -+ ext n -+ ring -+ -+lemma lem_341series2 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ (3 * (-logDerivZeta ((1 : ℂ) + delta)).re + -+ 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + -+ (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re) -+ = -+ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by -+ rw [Z341series t delta hdelta] -+ exact lem341series t delta hdelta -+ -+lemma lem_Lambda_pos_trig_sum (n : ℕ) (delta : ℝ) (t : ℝ) (hn : n ≥ 1) (hdelta : delta > 0) : -+ 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by -+ apply mul_nonneg -+ · -+ apply lem_realnx n (1 + delta) hn -+ -+ linarith [hdelta] -+ · -+ exact lem_postriglogn n hn t -+ -+lemma seriesPos {f : ℕ → ℝ} (_h_summable : Summable (fun n => if 1 ≤ n then f n else 0)) (h_nonneg : ∀ n : ℕ, 1 ≤ n → 0 ≤ f n) : 0 ≤ ∑' (n : ℕ), (if 1 ≤ n then f n else 0) := by -+ apply tsum_nonneg -+ intro n -+ by_cases h : 1 ≤ n -+ · simp [h] -+ exact h_nonneg n h -+ · simp [h] -+ -+lemma lem_seriespos (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ 0 ≤ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by -+ apply tsum_nonneg -+ intro n -+ by_cases h : n = 0 -+ · -+ simp [h] -+ · -+ have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h -+ exact lem_Lambda_pos_trig_sum n delta t hn hdelta -+ -+lemma Z341pos (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : -+ 0 ≤ 3 * (-logDerivZeta ((1 : ℂ) + delta)).re + -+ 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + -+ (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re := by -+ rw [lem_341series2 t delta hdelta] -+ exact lem_seriespos t delta hdelta -+ -+lemma frac_den_increase_bound {a b c : ℝ} (hpos : 0 < a + b) (hc : 0 ≤ c) : -+ 4 / (a + b + c) ≤ 4 / (a + b) := by -+ -+ have hle : a + b ≤ a + b + c := by linarith -+ -+ have h1 : 1 / (a + b + c) ≤ 1 / (a + b) := by -+ exact one_div_le_one_div_of_le hpos hle -+ -+ have h4nonneg : 0 ≤ (4 : ℝ) := by norm_num -+ have hmul := mul_le_mul_of_nonneg_left h1 h4nonneg -+ -+ have hmul' : 4 * (a + b + c)⁻¹ ≤ 4 * (a + b)⁻¹ := by -+ simpa [one_div] using hmul -+ simpa [div_eq_mul_inv] using hmul' -+ -+lemma log_abs_add_two_pos (t : ℝ) : 0 < Real.log (abs t + 2) := by -+ -+ have h0 : 0 ≤ abs t + 2 := by -+ have h' : 0 ≤ abs t := abs_nonneg t -+ linarith -+ have hge : (2 : ℝ) ≤ abs t + 2 := by -+ have h' : 0 ≤ abs t := abs_nonneg t -+ have := add_le_add_left h' (2 : ℝ) -+ simp -+ have hgt : 1 < abs t + 2 := lt_of_lt_of_le (by norm_num : (1 : ℝ) < 2) hge -+ -+ exact (Real.log_pos_iff h0).2 hgt -+ -+lemma log_gt_of_gt_exp {x y : ℝ} (h : Real.exp y < x) : y < Real.log x := by -+ have hxpos : 0 < x := lt_trans (Real.exp_pos y) h -+ exact (Real.lt_log_iff_exp_lt hxpos).2 h -+ -+lemma denom_rewrite (σ C L : ℝ) : 1 - σ + (1 / (2 * C * L)) = 1 + (1 / (2 * C * L)) - σ := by -+ ring -+ -+lemma pos_delta_from_C_L {C L : ℝ} (hC : 0 < C) (hL : 0 < L) : 0 < 1 / (2 * C * L) := by -+ have hCL : 0 < C * L := mul_pos hC hL -+ have h2 : 0 < (2 : ℝ) := by norm_num -+ have hpos : 0 < 2 * C * L := by -+ have : 0 < 2 * (C * L) := mul_pos h2 hCL -+ simpa [mul_assoc] using this -+ exact one_div_pos.mpr hpos -+ -+lemma add_two_pos_of_abs (t : ℝ) : 0 < |t| + 2 := by -+ have : 0 ≤ |t| := abs_nonneg t -+ linarith -+ -+lemma log_abs_two_pos (t : ℝ) : 0 < Real.log (|t| + 2) := by -+ simpa using log_abs_add_two_pos t -+ -+lemma two_C_log_pos {C t : ℝ} (hC : 0 < C) : 0 < 2 * C * Real.log (|t| + 2) := by -+ have hL : 0 < Real.log (|t| + 2) := log_abs_two_pos t -+ have h2 : 0 < (2 : ℝ) := by norm_num -+ have hCL : 0 < C * Real.log (|t| + 2) := mul_pos hC hL -+ have : 0 < 2 * (C * Real.log (|t| + 2)) := mul_pos h2 hCL -+ simpa [mul_comm, mul_left_comm, mul_assoc] using this -+ -+lemma mul_one_div_self_of_pos {a : ℝ} (ha : 0 < a) : a * (1 / a) = 1 := by -+ have hne : a ≠ 0 := ne_of_gt ha -+ simp [one_div, hne] -+ -+lemma mul_one_div_mul_right {A b : ℝ} (hA : A ≠ 0) : A * (1 / (A * b)) = 1 / b := by -+ calc -+ A * (1 / (A * b)) = A * ((A * b)⁻¹) := by simp [one_div] -+ _ = A / (A * b) := by simp [div_eq_mul_inv] -+ _ = A / A / b := by -+ simpa using (div_mul_eq_div_div (a := A) (b := A) (c := b)) -+ _ = 1 / b := by -+ have : A / A = (1 : ℝ) := by simp [hA] -+ simp [this] -+ -+lemma one_div_mul_one_div_mul_right {A b : ℝ} (hA : A ≠ 0) (_hb : b ≠ 0) : 1 / (A * (1 / (A * b))) = b := by -+ have h := mul_one_div_mul_right (A := A) (b := b) hA -+ have hinv := congrArg (fun x : ℝ => x⁻¹) h -+ calc -+ 1 / (A * (1 / (A * b))) = (A * (1 / (A * b)))⁻¹ := by simp [one_div] -+ _ = (1 / b)⁻¹ := by simpa using hinv -+ _ = b := by simp [one_div] -+ -+lemma inv_of_delta_def (C L δ : ℝ) (hδ : δ = 1 / (2 * C * L)) : 1 / δ = 2 * C * L := by -+ simp [hδ, one_div] -+ -+lemma rhs_eval_of_inv (C L δ : ℝ) (h : 1 / δ = 2 * C * L) : 3 / δ + C * L = 7 * C * L := by -+ calc -+ 3 / δ + C * L -+ = 3 * (1 / δ) + C * L := by simp [div_eq_mul_inv] -+ _ = 3 * (2 * C * L) + C * L := by simp [h] -+ _ = 6 * C * L + C * L := by ring -+ _ = 7 * C * L := by ring -+ -+lemma lem341tsC : -+ ∃ C > 1, ∀ s : ℂ, -+ (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → -+ 2 < |s.im| → -+ 4 / (1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2))) ≤ 7 * C * Real.log (abs s.im + 2) := by -+ -+ obtain ⟨C, hCpos, hbound⟩ := Z341bounds_const -+ refine ⟨C, hCpos, ?_⟩ -+ intro s hs hTim -+ -+ let L : ℝ := Real.log (|s.im| + 2) -+ have hLpos : 0 < L := log_abs_two_pos (s.im) -+ let δ : ℝ := 1 / (2 * C * L) -+ -+ have hCpos_weak : 0 < C := lt_trans zero_lt_one hCpos -+ have hδpos : 0 < δ := pos_delta_from_C_L hCpos_weak hLpos -+ -+ have hδlt : δ < 1 := by -+ -+ have hL_gt_1 : 1 < L := by -+ have h5_lt : 4 < |s.im| + 2 := by linarith [hTim] -+ have hL_gt_log5 : Real.log 4 < L := Real.log_lt_log (by norm_num) h5_lt -+ have hlog5_gt_1 : 1 < Real.log 4 := by -+ have h5_gt_e : Real.exp 1 < 4 := by -+ have h3_gt_e := lem_three_gt_e -+ linarith [h3_gt_e] -+ rw [← Real.log_exp 1] -+ exact Real.log_lt_log (Real.exp_pos 1) h5_gt_e -+ linarith [hlog5_gt_1, hL_gt_log5] -+ -+ have h2CL_gt_1 : 1 < 2 * C * L := by -+ -+ have hCL_gt_1 : 1 < C * L := by -+ calc C * L -+ > 1 * L := by exact mul_lt_mul_of_pos_right hCpos hLpos -+ _ = L := by simp -+ _ > 1 := hL_gt_1 -+ have h2_pos : (0 : ℝ) < 2 := by norm_num -+ calc 2 * C * L -+ = 2 * (C * L) := by ring -+ _ > 2 * 1 := by exact mul_lt_mul_of_pos_left hCL_gt_1 h2_pos -+ _ = 2 := by simp -+ _ > 1 := by norm_num -+ -+ simp only [δ] -+ rw [div_lt_one_iff] -+ left -+ exact ⟨two_C_log_pos hCpos_weak, h2CL_gt_1⟩ -+ -+ have hmem : (s.re + s.im * Complex.I) ∈ zeroZ := by -+ simpa [Complex.re_add_im] using hs.1 -+ have hupper := hbound δ hδpos hδlt (s.im) hTim (s.re) hmem -+ -+ have hpos := Z341pos (s.im) δ hδpos -+ -+ have hRHS_nonneg : 0 ≤ 3 / δ - 4 / (1 + δ - s.re) + C * L := le_trans hpos hupper -+ have hineq1 : 4 / (1 + δ - s.re) ≤ 3 / δ + C * L := by linarith [hRHS_nonneg] -+ -+ have hineq2 : 4 / (1 - s.re + δ) ≤ 3 / δ + C * L := by -+ convert hineq1 using 2 -+ ring -+ -+ have hinv : 1 / δ = 2 * C * L := by -+ simp only [δ, one_div, inv_inv] -+ -+ have hrhs_eval : 3 / δ + C * L = 7 * C * L := rhs_eval_of_inv C L δ hinv -+ -+ have hfinal : 4 / (1 - s.re + δ) ≤ 7 * C * L := by -+ rw [← hrhs_eval] -+ exact hineq2 -+ -+ convert hfinal -+ -+lemma zeta_zero_re_lt_one (s : ℂ) (hs : s ∈ zeroZ) : s.re < 1 := by -+ -+ by_contra h -+ -+ push Not at h -+ -+ have h_zero : riemannZeta s = 0 := hs -+ -+ have h_nonzero : riemannZeta s ≠ 0 := riemannZeta_ne_zero_of_one_le_re h -+ -+ exact h_nonzero h_zero -+ -+lemma div_le_to_le_mul (x y z : ℝ) (hy : 0 < y) (h : x / y ≤ z) : x ≤ z * y := by -+ rwa [div_le_iff₀ hy] at h -+ -+lemma le_mul_to_le_div (x y z : ℝ) (hy : 0 < y) (h : x ≤ z * y) : x / y ≤ z := by -+ rw [div_le_iff₀ hy] -+ exact h -+ -+lemma reciprocal_div_inequality (a b : ℝ) (ha : 0 < a) (hb : 0 < b) (h : 4 / a ≤ b) : a ≥ 4 / b := by -+ -+ have h1 : 4 ≤ b * a := div_le_to_le_mul 4 a b ha h -+ -+ have h2 : 4 ≤ a * b := by -+ rwa [mul_comm] at h1 -+ -+ have h3 : 4 / b ≤ a := le_mul_to_le_div 4 b a hb h2 -+ -+ exact h3 -+ -+lemma lem341tsC2 : -+ ∃ C > 1, ∀ s : ℂ, -+ (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → -+ 2 < |s.im| → -+ 1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2)) ≥ 4 / (7 * C * Real.log (abs s.im + 2)) := by -+ -+ rcases lem341tsC with ⟨C, hCpos, hT⟩ -+ refine ⟨C, hCpos, ?_⟩ -+ intro s hs hTs -+ -+ set a := 1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2)) with ha -+ set b := 7 * C * Real.log (abs s.im + 2) with hb -+ have hineq : 4 / a ≤ b := by -+ simpa [ha, hb] using hT s hs hTs -+ -+ have h_abs_nonneg : 0 ≤ |s.im| := abs_nonneg _ -+ have h_two_le : (2 : ℝ) ≤ |s.im| + 2 := by -+ have h' : (2 : ℝ) + 0 ≤ 2 + |s.im| := add_le_add_right h_abs_nonneg 2 -+ simp -+ have h_one_lt : (1 : ℝ) < |s.im| + 2 := lt_of_lt_of_le one_lt_two h_two_le -+ have hx0 : 0 ≤ |s.im| + 2 := by linarith [h_abs_nonneg] -+ have hlogpos : 0 < Real.log (|s.im| + 2) := (Real.log_pos_iff hx0).2 h_one_lt -+ have h7pos : 0 < (7 : ℝ) := by exact_mod_cast (by decide : (0 : ℕ) < 7) -+ have hbpos : 0 < b := by -+ have h7Cpos : 0 < 7 * C := by linarith -+ exact mul_pos h7Cpos hlogpos -+ -+ rcases hs with ⟨_, hRepos, hRelt⟩ -+ have h1 : 0 < 1 - s.re := sub_pos.mpr hRelt -+ have h2pos : 0 < (2 : ℝ) := lt_trans zero_lt_one one_lt_two -+ have h2Cpos : 0 < (2 : ℝ) * C := by linarith -+ have hdenpos : 0 < 2 * C * Real.log (|s.im| + 2) := mul_pos h2Cpos hlogpos -+ have hinvpos : 0 < 1 / (2 * C * Real.log (|s.im| + 2)) := one_div_pos.mpr hdenpos -+ have hapos : 0 < a := by -+ have := add_pos h1 hinvpos -+ simpa [ha] using this -+ -+ have hres := reciprocal_div_inequality a b hapos hbpos hineq -+ simpa [ha, hb] using hres -+ -+lemma simplify_4_7_2 (C L : ℝ) : 4 / (7 * C * L) - 1 / (2 * C * L) = 1 / (14 * C * L) := by -+ -+ have h1 : (4 : ℝ) / (7 * (C * L)) = (4 : ℝ) / (7 : ℝ) / (C * L) := by -+ simpa using (div_mul_eq_div_div (a := (4 : ℝ)) (b := (7 : ℝ)) (c := C * L)) -+ have h2 : (1 : ℝ) / (2 * (C * L)) = (1 : ℝ) / (2 : ℝ) / (C * L) := by -+ simpa using (div_mul_eq_div_div (a := (1 : ℝ)) (b := (2 : ℝ)) (c := C * L)) -+ -+ have h3' : ((4 : ℝ) / (7 : ℝ)) - (2 : ℝ)⁻¹ = (14 : ℝ)⁻¹ := by -+ have h3 : ((4 : ℝ) / (7 : ℝ)) - ((1 : ℝ) / (2 : ℝ)) = (1 : ℝ) / (14 : ℝ) := by -+ norm_num -+ simpa [one_div] using h3 -+ calc -+ 4 / (7 * C * L) - 1 / (2 * C * L) -+ = (4 : ℝ) / (7 * (C * L)) - (1 : ℝ) / (2 * (C * L)) := by -+ simp [mul_assoc] -+ _ = (4 : ℝ) / (7 : ℝ) / (C * L) - (1 : ℝ) / (2 : ℝ) / (C * L) := by -+ simp [h1, h2] -+ _ = (((4 : ℝ) / (7 : ℝ)) - ((1 : ℝ) / (2 : ℝ))) / (C * L) := by -+ simpa using (sub_div (a := ((4 : ℝ) / (7 : ℝ))) (b := ((1 : ℝ) / (2 : ℝ))) (c := C * L)).symm -+ _ = (((4 : ℝ) / (7 : ℝ)) - (2 : ℝ)⁻¹) / (C * L) := by -+ simp [one_div] -+ _ = (14 : ℝ)⁻¹ / (C * L) := by -+ simp [h3'] -+ _ = 1 / (14 * (C * L)) := by -+ simpa [mul_comm, mul_left_comm, mul_assoc, one_div] using -+ (div_mul_eq_div_div (a := (1 : ℝ)) (b := (14 : ℝ)) (c := C * L)).symm -+ _ = 1 / (14 * C * L) := by simp [mul_assoc] -+ -+lemma fraction_diff_lower_bound (C L a : ℝ) : 4 / (7 * C * L) ≤ a + 1 / (2 * C * L) → 1 / (14 * C * L) ≤ a := by -+ intro h -+ have h' : 4 / (7 * C * L) - 1 / (2 * C * L) ≤ a := (sub_le_iff_le_add).mpr h -+ have hdiff : 1 / (14 * C * L) = 4 / (7 * C * L) - 1 / (2 * C * L) := by -+ symm -+ exact simplify_4_7_2 C L -+ calc -+ 1 / (14 * C * L) -+ = 4 / (7 * C * L) - 1 / (2 * C * L) := hdiff -+ _ ≤ a := h' -+ -+lemma lem341tsC3 : -+ ∃ C > 1, ∀ s : ℂ, -+ (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → -+ 2 < |s.im| → -+ 1 - s.re ≥ 1 / (14 * C * Real.log (abs s.im + 2)) := by -+ obtain ⟨C, hCpos, hT⟩ := lem341tsC2 -+ refine ⟨C, hCpos, ?_⟩ -+ intro s hs hTle -+ have h := hT s hs hTle -+ -+ have h' : 4 / (7 * C * Real.log (abs s.im + 2)) ≤ -+ (1 - s.re) + 1 / (2 * C * Real.log (abs s.im + 2)) := by -+ simpa [ge_iff_le, add_comm, add_left_comm, add_assoc] using h -+ -+ have h'' := fraction_diff_lower_bound C (Real.log (abs s.im + 2)) (1 - s.re) h' -+ -+ simpa [ge_iff_le, mul_comm, mul_left_comm, mul_assoc] using h'' -+ -+lemma zerofree : -+ ∃ c, c > 0 ∧ c < 1 ∧ ∀ s : ℂ, -+ (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → -+ 2 < |s.im| → s.re ≤ 1 - c / (Real.log (abs s.im + 2)) := by -+ -+ rcases lem341tsC3 with ⟨C0, hC0pos, hT⟩ -+ -+ set C : ℝ := 1 / (14 * C0) with hCdef -+ -+ have h14pos : 0 < (14 : ℝ) := by norm_num -+ have hC0pos' : 0 < C0 := lt_trans zero_lt_one hC0pos -+ have hCpos : 0 < C := by -+ have hdenpos : 0 < 14 * C0 := mul_pos h14pos hC0pos' -+ exact one_div_pos.mpr hdenpos -+ -+ have hClt1 : C < 1 := by -+ have h14C0_pos : 0 < 14 * C0 := mul_pos h14pos hC0pos' -+ have h14C0_gt_1 : 1 < 14 * C0 := by -+ have h14_gt_1 : (1 : ℝ) < 14 := by norm_num -+ calc -+ (1 : ℝ) = 1 * 1 := by ring -+ _ < 14 * 1 := by exact mul_lt_mul_of_pos_right h14_gt_1 zero_lt_one -+ _ < 14 * C0 := by exact mul_lt_mul_of_pos_left hC0pos h14pos -+ rw [hCdef] -+ rw [div_lt_one_iff] -+ left -+ exact ⟨h14C0_pos, h14C0_gt_1⟩ -+ -+ refine ⟨C, hCpos, hClt1, ?_⟩ -+ intro s hs hTle -+ -+ set L := Real.log (abs s.im + 2) with hLdef -+ -+ have hb0 := hT s hs hTle -+ -+ have hb' : C / L ≤ 1 - s.re := by -+ simpa [hLdef, hCdef, one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hb0 -+ -+ have : s.re ≤ 1 - C / L := by linarith -+ simpa [hLdef] using this -+ -+def Yt (t : ℝ) (δ : ℝ) : Set ℂ := -+ { ρ_1 : ℂ | riemannZeta ρ_1 = 0 ∧ ‖ρ_1 - (1 - δ + t * Complex.I)‖ ≤ 2 * δ } -+ -+noncomputable def zerofree_constant : ℝ := Classical.choose zerofree -+ -+lemma zerofree_constant_pos : 0 < zerofree_constant := -+ (Classical.choose_spec zerofree).1 -+ -+lemma zerofree_constant_lt_one : zerofree_constant < 1 := -+ (Classical.choose_spec zerofree).2.1 -+ -+noncomputable def deltaz (z : ℂ) : ℝ := (zerofree_constant / 20) / Real.log (|z.im| + 2) -+ -+noncomputable def deltaz_t (t : ℝ) : ℝ := deltaz (t * Complex.I) -+ -+lemma lem_delta19 : -+ (∀ z : ℂ, |z.im| > 2 → (0 < deltaz z ∧ deltaz z < 1/9)) ∧ -+ (∀ t : ℝ, |t| > 2 → (0 < deltaz_t t ∧ deltaz_t t < 1/9)) := by -+ -+ have h_complex : ∀ z : ℂ, |z.im| > 2 → (0 < deltaz z ∧ deltaz z < 1/9) := by -+ intro z hz -+ constructor -+ · -+ have h_num_pos : 0 < zerofree_constant / 20 := by -+ exact div_pos zerofree_constant_pos (by norm_num) -+ have h_den_pos : 0 < Real.log (|z.im| + 2) := by -+ have h_gt_one : (1 : ℝ) < |z.im| + 2 := by -+ have h_nonneg : (0 : ℝ) ≤ |z.im| := abs_nonneg _ -+ linarith [hz] -+ exact Real.log_pos h_gt_one -+ unfold deltaz -+ exact div_pos h_num_pos h_den_pos -+ · -+ -+ have h_den_ge_half : (1/2 : ℝ) ≤ Real.log (|z.im| + 2) := by -+ -+ have h_den_ge_log2 : Real.log 2 ≤ Real.log (|z.im| + 2) := by -+ have h_pos : 0 < |z.im| + 2 := by linarith [abs_nonneg (z.im)] -+ have h_le : (2 : ℝ) ≤ |z.im| + 2 := by linarith [abs_nonneg (z.im)] -+ exact Real.log_le_log (by norm_num) h_le -+ -+ have h_log2_ge_half : (1/2 : ℝ) ≤ Real.log 2 := by -+ have h_exp_half_le_two : Real.exp (1/2) ≤ 2 := by -+ -+ have h_exp_one_lt_three : Real.exp 1 < 3 := lem_three_gt_e -+ have h_exp_sq : (Real.exp (1/2))^2 = Real.exp 1 := by -+ rw [pow_two, ← Real.exp_add]; norm_num -+ have h_exp_sq_lt_four : (Real.exp (1/2))^2 < 4 := by -+ rw [h_exp_sq]; linarith [h_exp_one_lt_three] -+ -+ have h_exp_pos : 0 ≤ Real.exp (1/2) := le_of_lt (Real.exp_pos _) -+ have h_two_pos : 0 ≤ (2 : ℝ) := by norm_num -+ have h_four_eq : (2 : ℝ)^2 = 4 := by norm_num -+ rw [← h_four_eq] at h_exp_sq_lt_four -+ have h_lt_abs := (sq_lt_sq).mp h_exp_sq_lt_four -+ rw [abs_of_nonneg h_exp_pos, abs_of_nonneg h_two_pos] at h_lt_abs -+ exact le_of_lt h_lt_abs -+ exact (Real.le_log_iff_exp_le (by norm_num : 0 < (2 : ℝ))).mpr h_exp_half_le_two -+ exact le_trans h_log2_ge_half h_den_ge_log2 -+ -+ have h_inv_le_two : 1 / Real.log (|z.im| + 2) ≤ 2 := by -+ have h_pos_half : 0 < (1/2 : ℝ) := by norm_num -+ have h_ineq := one_div_le_one_div_of_le h_pos_half h_den_ge_half -+ convert h_ineq using 1; first | rfl | norm_num -+ -+ have h_bound : deltaz z ≤ zerofree_constant / 10 := by -+ unfold deltaz -+ -+ rw [div_eq_mul_inv] -+ -+ have h_num_nonneg : 0 ≤ zerofree_constant / 20 := by -+ exact le_of_lt (div_pos zerofree_constant_pos (by norm_num)) -+ have h_mul_ineq := mul_le_mul_of_nonneg_left h_inv_le_two h_num_nonneg -+ convert h_mul_ineq using 1 <;> first | rfl | ring -+ -+ have h_lt_tenth : zerofree_constant / 10 < 1 / 10 := by -+ exact div_lt_div_of_pos_right zerofree_constant_lt_one (by norm_num) -+ have h_tenth_lt_ninth : (1 : ℝ) / 10 < 1 / 9 := by norm_num -+ exact lt_trans (lt_of_le_of_lt h_bound h_lt_tenth) h_tenth_lt_ninth -+ -+ constructor -+ · exact h_complex -+ · -+ intro t ht -+ -+ have h_eq : deltaz_t t = deltaz (t * Complex.I) := rfl -+ rw [h_eq] -+ have h_im_eq : |(t * Complex.I).im| = |t| := by simp -+ rw [← h_im_eq] at ht -+ exact h_complex (t * Complex.I) ht -+ -+lemma closedBall_compact_complex (c : ℂ) (r : ℝ) : -+ IsCompact (Metric.closedBall c r) := by -+ -+ exact ProperSpace.isCompact_closedBall c r -+ -+lemma riemannZeta_no_zeros_accumulate_at_one : -+ ∀ Z : Set ℂ, (∀ z ∈ Z, riemannZeta z = 0) → ¬AccPt 1 (Filter.principal Z) := by -+ intro Z hZ -+ -+ by_contra h_acc -+ -+ have h_residue := riemannZeta_residue_one -+ -+ rw [Metric.tendsto_nhdsWithin_nhds] at h_residue -+ obtain ⟨δ, hδ_pos, hδ_bound⟩ := h_residue (1/2) (by norm_num : (0 : ℝ) < 1/2) -+ -+ rw [accPt_iff_nhds] at h_acc -+ -+ obtain ⟨y, ⟨hy_ball, hy_Z⟩, hy_ne⟩ := h_acc (Metric.ball 1 δ) (Metric.ball_mem_nhds 1 hδ_pos) -+ -+ have hy_zero : riemannZeta y = 0 := hZ y hy_Z -+ -+ have hy_in_compl : y ∈ ({1} : Set ℂ)ᶜ := by -+ rw [Set.mem_compl_iff, Set.mem_singleton_iff] -+ exact hy_ne -+ -+ have hy_dist : dist y 1 < δ := hy_ball -+ -+ have h_bound := hδ_bound hy_in_compl hy_dist -+ -+ rw [hy_zero, mul_zero] at h_bound -+ -+ have h_dist_eq : dist (0 : ℂ) (1 : ℂ) = 1 := by -+ rw [Complex.dist_eq] -+ norm_num -+ -+ rw [h_dist_eq] at h_bound -+ -+ norm_num at h_bound -+ -+lemma complex_minus_singleton_connected : IsPreconnected ({s : ℂ | s ≠ 1} : Set ℂ) := by -+ -+ have h_eq : {s : ℂ | s ≠ 1} = ({1} : Set ℂ)ᶜ := by -+ ext x -+ simp [Set.mem_compl_iff, Set.mem_singleton_iff] -+ -+ rw [h_eq] -+ -+ have h_rank : 1 < Module.rank ℝ ℂ := by -+ rw [Complex.rank_real_complex] -+ -+ norm_num -+ -+ have h_connected := isConnected_compl_singleton_of_one_lt_rank h_rank (1 : ℂ) -+ -+ exact h_connected.isPreconnected -+ -+lemma eventually_eq_zero_implies_frequently_eq_zero_punctured (f : ℂ → ℂ) (z₀ : ℂ) : -+ (∀ᶠ z in nhds z₀, f z = 0) → (∃ᶠ z in nhdsWithin z₀ {z₀}ᶜ, f z = 0) := by -+ intro h_eventually -+ -+ have h_nebot : Filter.NeBot (nhdsWithin z₀ {z₀}ᶜ) := by -+ -+ exact NormedField.nhdsNE_neBot z₀ -+ -+ have h_eventually_punctured : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ, f z = 0 := by -+ -+ exact Filter.Eventually.filter_mono nhdsWithin_le_nhds h_eventually -+ -+ exact h_eventually_punctured.frequently -+ -+lemma riemannZeta_zeros_finite_of_compact (K : Set ℂ) (hK : IsCompact K) : -+ {z ∈ K | riemannZeta z = 0}.Finite := by -+ -+ by_contra h_not_finite -+ push Not at h_not_finite -+ -+ let Z := {z ∈ K | riemannZeta z = 0} -+ -+ have hZ_inf : Z.Infinite := h_not_finite -+ have hZ_sub : Z ⊆ K := fun z hz => hz.1 -+ -+ obtain ⟨z₀, hz₀_K, hz₀_acc⟩ := lem_bolzano_weierstrass hK hZ_inf hZ_sub -+ -+ by_cases h_eq_one : z₀ = 1 -+ · -+ subst h_eq_one -+ -+ have hZ_zeros : ∀ z ∈ Z, riemannZeta z = 0 := fun z hz => hz.2 -+ -+ exact riemannZeta_no_zeros_accumulate_at_one Z hZ_zeros hz₀_acc -+ -+ · -+ -+ have h_analytic : AnalyticAt ℂ riemannZeta z₀ := -+ zetaanalOnnot1 z₀ h_eq_one -+ -+ obtain h_ev_zero | h_ev_ne := h_analytic.eventually_eq_zero_or_eventually_ne_zero -+ -+ · -+ -+ have h_freq := eventually_eq_zero_implies_frequently_eq_zero_punctured riemannZeta z₀ h_ev_zero -+ -+ have h_eq_on_zero := zetaanalOnnot1.eqOn_zero_of_preconnected_of_frequently_eq_zero -+ complex_minus_singleton_connected h_eq_one h_freq -+ -+ have : riemannZeta 0 = 0 := h_eq_on_zero (by simp : (0 : ℂ) ∈ {s | s ≠ 1}) -+ rw [riemannZeta_zero] at this -+ norm_num at this -+ -+ · -+ -+ unfold AccPt at hz₀_acc -+ -+ have h_ev_not_Z : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ, z ∉ Z := by -+ apply Filter.Eventually.mono h_ev_ne -+ intro z hz hz_in_Z -+ exact hz hz_in_Z.2 -+ -+ have h_ev_false : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z, False := by -+ rw [Filter.eventually_inf_principal] -+ exact h_ev_not_Z -+ -+ have h_eq_bot : nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z = ⊥ := -+ Filter.eventually_false_iff_eq_bot.mp h_ev_false -+ -+ have h_ne_bot : nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z ≠ ⊥ := hz₀_acc.ne -+ -+ exact h_ne_bot h_eq_bot -+ -+lemma lem_ZFRdelta : -+ ∀ z : ℂ, 2 < |z.im| → z.re > 1 - 9 * deltaz z → riemannZeta z ≠ 0 := by -+ intro z him hre -+ by_cases h1 : 1 ≤ z.re -+ · -+ simpa using riemannZeta_ne_zero_of_one_le_re h1 -+ -+ have hzlt1 : z.re < 1 := lt_of_not_ge h1 -+ -+ have hgt : |z.im| > 2 := by simpa using him -+ have hδ := (lem_delta19).1 z hgt -+ rcases hδ with ⟨hδ_pos, hδ_lt_19⟩ -+ -+ have h9δ_lt1 : 9 * deltaz z < 1 := by -+ have h := mul_lt_mul_of_pos_left hδ_lt_19 (by norm_num : 0 < (9 : ℝ)) -+ have h9 : (9 : ℝ) * (1 / 9) = 1 := by norm_num -+ simpa [h9] using h -+ have hzre_pos : 0 < z.re := by -+ have : 0 < 1 - 9 * deltaz z := sub_pos.mpr h9δ_lt1 -+ exact lt_trans this hre -+ -+ by_contra hzero -+ have hzmem : z ∈ zeroZ := by simpa [zeroZ] using hzero -+ -+ have hprop := (Classical.choose_spec zerofree).2.2 -+ have hbound : z.re ≤ 1 - zerofree_constant / Real.log (|z.im| + 2) := -+ hprop z ⟨hzmem, hzre_pos, hzlt1⟩ him -+ -+ set L : ℝ := Real.log (|z.im| + 2) with hLdef -+ have hLpos : 0 < L := by -+ have hone_lt : (1 : ℝ) < |z.im| + 2 := by -+ have : (0 : ℝ) ≤ |z.im| := abs_nonneg _ -+ linarith -+ have := Real.log_pos hone_lt -+ simpa [hLdef] using this -+ -+ have hb_le_a' : ((9 : ℝ) / 20) * (zerofree_constant / L) ≤ zerofree_constant / L := by -+ have hcoef_le1 : ((9 : ℝ) / 20) ≤ 1 := by norm_num -+ have ha_nonneg : 0 ≤ zerofree_constant / L := le_of_lt (div_pos zerofree_constant_pos hLpos) -+ have := mul_le_mul_of_nonneg_right hcoef_le1 ha_nonneg -+ simpa [one_mul] using this -+ have h9d_eq : 9 * deltaz z = ((9 : ℝ) / 20) * (zerofree_constant / L) := by -+ simp [deltaz, hLdef, div_eq_mul_inv, mul_left_comm, mul_assoc] -+ have hdelta_le : 9 * deltaz z ≤ zerofree_constant / L := by -+ simpa [h9d_eq] using hb_le_a' -+ have h_le_rhs : 1 - zerofree_constant / L ≤ 1 - 9 * deltaz z := by -+ have hneg := neg_le_neg hdelta_le -+ simpa [sub_eq_add_neg] using! add_le_add_right hneg 1 -+ -+ have hle : z.re ≤ 1 - 9 * deltaz z := le_trans hbound h_le_rhs -+ have hcontr : z.re < z.re := lt_of_le_of_lt hle hre -+ exact (lt_irrefl (z.re)) hcontr -+ -+lemma complex_re_add_I_mul_real (a t : ℝ) : (((a : ℂ) + Complex.I * t).re) = a := by -+ -+ have h1 : ((Complex.I * (t : ℂ)).re) = -((t : ℂ).im) := by -+ simp -+ have ht_im : ((t : ℂ).im) = 0 := by simp -+ simp [Complex.add_re, Complex.ofReal_re, h1] -+ -+lemma complex_im_add_I_mul_real (a t : ℝ) : (((a : ℂ) + Complex.I * t).im) = t := by -+ -+ have h1 : ((Complex.I * (t : ℂ)).im) = ((t : ℂ).re) := by -+ simp -+ have ht_re : ((t : ℂ).re) = t := by simp -+ simp [Complex.add_im, Complex.ofReal_im, h1] -+ -+lemma complex_sub_ofReal_I_real_eq_ofReal (z : ℂ) (a t : ℝ) (him : z.im = t) : -+ z - ((a : ℂ) + Complex.I * t) = ((z.re - a) : ℂ) := by -+ apply Complex.ext -+ · simp [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.ofReal_im] -+ · simp [Complex.sub_im, Complex.add_im, Complex.ofReal_im, Complex.ofReal_re, him] -+ -+lemma lem_ZFRinD (t : ℝ) (ht : |t| > 2) (z : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → -+ z ∈ Metric.closedBall c (2/3) := by -+ intro c h -+ rcases h with ⟨h_low, hrest⟩ -+ rcases hrest with ⟨h_high, him⟩ -+ have hsub : z - c = ((z.re - (3/2)) : ℂ) := by -+ simpa [c] using! complex_sub_ofReal_I_real_eq_ofReal z (3/2) t him -+ have h1 : dist z c = ‖((z.re - (3/2)) : ℂ)‖ := by -+ simp [dist_eq_norm, hsub] -+ have h2 : ‖((z.re - (3/2)) : ℂ)‖ = ‖z.re - (3/2)‖ := by -+ simpa using (Complex.norm_real (z.re - (3/2))) -+ have hdist_abs : dist z c = |z.re - (3/2)| := by -+ have h4 : dist z c = ‖z.re - (3/2)‖ := h1.trans h2 -+ simpa [Real.norm_eq_abs] using h4 -+ have hnonpos : z.re - (3/2) ≤ 0 := sub_nonpos_of_le h_high -+ have habs : |z.re - (3/2)| = 3/2 - z.re := by -+ have := abs_of_nonpos hnonpos -+ simpa [neg_sub] using this -+ have hdist_eq : dist z c = 3/2 - z.re := hdist_abs.trans habs -+ have h_le : dist z c ≤ 1/2 + deltaz_t t := by -+ calc -+ dist z c = 3/2 - z.re := hdist_eq -+ _ ≤ 3/2 - (1 - deltaz_t t) := by linarith -+ _ = 1/2 + deltaz_t t := by ring -+ have hδlt : deltaz_t t < 1/9 := (lem_delta19.2 t ht).2 -+ have h12δ_lt : (1/2 : ℝ) + deltaz_t t < (1/2 : ℝ) + 1/9 := by -+ have := add_lt_add_left hδlt (1/2 : ℝ) -+ simpa [add_comm, add_left_comm, add_assoc] using this -+ have h123_lt : (1/2 : ℝ) + 1/9 < (2/3 : ℝ) := by norm_num -+ have h_lt : (1/2 : ℝ) + deltaz_t t < (2/3 : ℝ) := lt_trans h12δ_lt h123_lt -+ have hdist_le : dist z c ≤ 2/3 := le_trans h_le (le_of_lt h_lt) -+ exact (Metric.mem_closedBall).2 hdist_le -+ -+lemma lem_ZFRnotK (t : ℝ) (ht : |t| > 2) (z : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → -+ z ∉ zerosetKfRc (5/6) c riemannZeta := by -+ intro c h -+ -+ obtain ⟨h_ge, h_le, h_im⟩ := h -+ -+ have h_delta_eq : deltaz z = deltaz_t t := by -+ rw [deltaz_t, deltaz] -+ -+ congr 1 -+ congr 1 -+ -+ rw [h_im] -+ -+ simp only [Complex.mul_I_im, Complex.ofReal_re] -+ -+ have h_ge_delta : 1 - deltaz z ≤ Complex.re z := by -+ rwa [← h_delta_eq] at h_ge -+ -+ have h_im_gt : |z.im| > 2 := by -+ rw [h_im] -+ exact ht -+ -+ have h_delta_pos : 0 < deltaz z := by -+ exact (lem_delta19.1 z h_im_gt).1 -+ -+ have h_delta_lt_9delta : deltaz z < 9 * deltaz z := by -+ linarith [h_delta_pos] -+ -+ have h_strict : Complex.re z > 1 - 9 * deltaz z := by -+ linarith [h_ge_delta, h_delta_lt_9delta] -+ -+ have h_zeta_ne_zero : riemannZeta z ≠ 0 := -+ lem_ZFRdelta z h_im_gt h_strict -+ -+ intro h_mem -+ -+ have h_zero : riemannZeta z = 0 := h_mem.2 -+ -+ exact h_zeta_ne_zero h_zero -+ -+lemma lem_Zeta_Expansion_ZFR : -+ ∃ C_1 : ℝ, C_1 > 1 ∧ -+ ∀ t : ℝ, |t| > 3 → -+ let c := (3/2 : ℂ) + I * t; -+ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), -+ ∀ z : ℂ, 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → -+ ‖(deriv riemannZeta z / riemannZeta z) - -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ -+ ≤ C_1 * Real.log |t| := by -+ obtain ⟨C, hC_gt_one, hC_expansion⟩ := -+ Zeta1_Zeta_Expansion (2/3) (3/4) -+ (by norm_num : (0 : ℝ) < 2/3) -+ (by norm_num : (2/3 : ℝ) < 3/4) -+ (by norm_num : (3/4 : ℝ) < 5/6) -+ let C_1 := C * (1 / ((3/4 : ℝ) - 2/3)^3 + 1) -+ have hC_1_gt_1 : C_1 > 1 := by -+ have h_coeff : (1 : ℝ) / ((3/4 : ℝ) - 2/3)^3 + 1 > 1 := by -+ have h_pos : ((3/4 : ℝ) - 2/3)^3 > 0 := by norm_num -+ have h_div_pos : (1 : ℝ) / ((3/4 : ℝ) - 2/3)^3 > 0 := div_pos one_pos h_pos -+ linarith -+ have h_ge_1 : (1 : ℝ) ≤ C := le_of_lt hC_gt_one -+ exact one_lt_mul_of_le_of_lt h_ge_1 h_coeff -+ refine ⟨C_1, hC_1_gt_1, ?_⟩ -+ intro t ht c hfin z hz -+ have ht2 : |t| > 2 := by linarith -+ have hz_in_ball : z ∈ Metric.closedBall c (2/3) := by -+ simpa [c] using (lem_ZFRinD t ht2 z hz) -+ have hz_not_in_K : z ∉ zerosetKfRc (5/6) c riemannZeta := by -+ simpa [c] using (lem_ZFRnotK t ht2 z hz) -+ have hz_in_diff : z ∈ Metric.closedBall c (2/3) \ zerosetKfRc (5/6) c riemannZeta := -+ ⟨hz_in_ball, hz_not_in_K⟩ -+ have h_expansion := hC_expansion t ht hfin z hz_in_diff -+ rw [show logDerivZeta z = deriv riemannZeta z / riemannZeta z from rfl] at h_expansion -+ exact h_expansion -+ -+lemma lem_abszrhoReRe (z ρ : ℂ) : ‖z - ρ‖ ≥ z.re - ρ.re := by -+ have h1 : (z - ρ).re ≤ ‖z - ρ‖ := Complex.re_le_norm (z - ρ) -+ have h2 : (z - ρ).re = z.re - ρ.re := Complex.sub_re z ρ -+ rw [← h2] -+ exact h1 -+ -+lemma lem_Rerhotodeltarho {ρ : ℂ} : -+ ∀ t : ℝ, |t| > 3 → ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) (3/2+ t* Complex.I) riemannZeta) → ρ.re ≤ 1 - 9 * deltaz ρ := by -+ intro t ht h_mem -+ -+ have h_zero : riemannZeta ρ = 0 := h_mem.2 -+ -+ have h_ball : ρ ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6) := h_mem.1 -+ -+ have h_dist : dist ρ (3/2 + t * Complex.I) ≤ 5/6 := by -+ rwa [Metric.mem_closedBall] at h_ball -+ -+ have h_im : 2 < |ρ.im| := by -+ -+ have h_im_bound : |ρ.im - t| ≤ 5/6 := by -+ -+ have h_le_norm : |ρ.im - t| ≤ ‖ρ - (3/2 + t * Complex.I)‖ := by -+ have : |(ρ - (3/2 + t * Complex.I)).im| ≤ ‖ρ - (3/2 + t * Complex.I)‖ := -+ Complex.abs_im_le_norm _ -+ have h_im_eq : (ρ - (3/2 + t * Complex.I)).im = ρ.im - t := by -+ simp [Complex.sub_im, Complex.add_im, Complex.ofReal_im] -+ rwa [← h_im_eq] -+ rw [← Complex.dist_eq] at h_le_norm -+ linarith [h_le_norm, h_dist] -+ -+ have triangle := abs_sub_abs_le_abs_sub t ρ.im -+ -+ have eq_comm : |t - ρ.im| = |ρ.im - t| := abs_sub_comm t ρ.im -+ rw [eq_comm] at triangle -+ -+ have h_ge : |ρ.im| ≥ |t| - |ρ.im - t| := by linarith [triangle] -+ -+ have : |ρ.im| ≥ |t| - 5/6 := by linarith [h_ge, h_im_bound] -+ have : |ρ.im| > 3 - 5/6 := by linarith [ht] -+ have h_calc : (3 : ℝ) - 5/6 = 13/6 := by norm_num -+ have h_gt2 : (13 : ℝ)/6 > 2 := by norm_num -+ rw [h_calc] at * -+ linarith [h_gt2] -+ -+ have h_not_gt : ¬(ρ.re > 1 - 9 * deltaz ρ) := by -+ intro h_gt -+ have h_ne_zero := lem_ZFRdelta ρ h_im h_gt -+ exact h_ne_zero h_zero -+ -+ exact le_of_not_gt h_not_gt -+ -+lemma lem_DImt2d : -+ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), -+ |z.im| ≤ |t| + 5/6 := by -+ intro t ht z hz -+ -+ rw [Metric.mem_closedBall] at hz -+ -+ have center_im : (3/2 + t * Complex.I).im = t := by simp [Complex.add_im, Complex.mul_im] -+ -+ have diff_im : (z - (3/2 + t * Complex.I)).im = z.im - t := by -+ rw [Complex.sub_im, center_im] -+ -+ have h1 : |z.im - t| ≤ ‖z - (3/2 + t * Complex.I)‖ := by -+ rw [← diff_im] -+ exact Complex.abs_im_le_norm _ -+ -+ have h2 : |z.im - t| ≤ 5/6 := le_trans h1 (by simpa only [dist_eq_norm] using! hz) -+ -+ have h3 : |z.im| ≤ |z.im - t| + |t| := by -+ conv_lhs => rw [show z.im = (z.im - t) + t by ring] -+ exact abs_add_le (z.im - t) t -+ linarith -+ -+lemma lem_DIMt2 : -+ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), -+ |z.im| + 2 ≤ (|t| + 2)^3 := by -+ intro t ht z hz -+ -+ have h1' := lem_DImt2d t ht z hz -+ -+ have h1a : |z.im| + 2 ≤ |t| + 17/6 := by -+ simpa [show |t| + 5/6 + 2 = |t| + 17/6 by ring] using! add_le_add_left h1' 2 -+ -+ have h17le3 : |t| + 17/6 ≤ |t| + 3 := by -+ have : (17 : ℝ) / 6 ≤ 3 := by norm_num -+ exact add_le_add_right this _ -+ -+ have h_nonneg_poly : 0 ≤ |t|^3 + 6 * |t|^2 + 11 * |t| + 5 := by -+ have h0 : 0 ≤ |t|^3 := by exact pow_nonneg (abs_nonneg _) 3 -+ have h1 : 0 ≤ 6 * |t|^2 := by -+ have : 0 ≤ (6 : ℝ) := by norm_num -+ exact mul_nonneg this (sq_nonneg _) -+ have h2 : 0 ≤ 11 * |t| := by -+ have : 0 ≤ (11 : ℝ) := by norm_num -+ exact mul_nonneg this (abs_nonneg _) -+ have h3 : 0 ≤ (5 : ℝ) := by norm_num -+ exact add_nonneg (add_nonneg (add_nonneg h0 h1) h2) h3 -+ have h_add : |t| + 3 ≤ (|t| + 3) + (|t|^3 + 6 * |t|^2 + 11 * |t| + 5) := by -+ simpa using (le_add_of_nonneg_right (a := |t| + 3) h_nonneg_poly) -+ have h_expand : (|t| + 2)^3 = (|t| + 3) + (|t|^3 + 6 * |t|^2 + 11 * |t| + 5) := by -+ ring -+ have h3 : |t| + 3 ≤ (|t| + 2)^3 := by -+ simpa [h_expand] using h_add -+ -+ exact le_trans (le_trans h1a h17le3) h3 -+ -+lemma lem_DlogImlog : -+ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), -+ Real.log (|z.im| + 2) ≤ 3 * Real.log (|t| + 2) := by -+ intro t ht z hz -+ -+ have h1 : |z.im| + 2 ≤ (|t| + 2)^3 := lem_DIMt2 t ht z hz -+ -+ have h2 : 0 < |z.im| + 2 := by -+ have : 0 ≤ |z.im| := abs_nonneg _ -+ linarith -+ -+ have hlog := Real.log_le_log h2 h1 -+ -+ simpa [Real.log_pow] using hlog -+ -+lemma lem_D1logtlog : -+ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), -+ (1 : ℝ) / Real.log (|t| + 2) ≤ 3 / Real.log (|z.im| + 2) := by -+ intro t ht z hz -+ have h1 := lem_DlogImlog t ht z hz -+ -+ have ht_pos : |t| + 2 > 1 := by linarith [abs_nonneg t] -+ have hz_pos : |z.im| + 2 > 1 := by linarith [abs_nonneg z.im] -+ have log_t_pos : Real.log (|t| + 2) > 0 := Real.log_pos ht_pos -+ have log_z_pos : Real.log (|z.im| + 2) > 0 := Real.log_pos hz_pos -+ -+ rw [div_le_div_iff₀ log_t_pos log_z_pos] -+ simp only [one_mul] -+ exact h1 -+ -+lemma lem_Ddt2dz : -+ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), -+ deltaz_t t ≤ 3 * deltaz z := by -+ intro t ht z hz -+ have h := lem_D1logtlog t ht z hz -+ have hpos : 0 ≤ zerofree_constant / 20 := by -+ have ha : 0 < zerofree_constant := zerofree_constant_pos -+ have h9 : 0 < (20 : ℝ) := by norm_num -+ exact div_nonneg (le_of_lt ha) (le_of_lt h9) -+ have h2 := mul_le_mul_of_nonneg_left h hpos -+ calc -+ deltaz_t t -+ = (zerofree_constant / 20) / Real.log (|t| + 2) := by -+ simp [deltaz_t, deltaz] -+ _ = (zerofree_constant / 20) * (1 / Real.log (|t| + 2)) := by simp [div_eq_mul_inv] -+ _ ≤ (zerofree_constant / 20) * (3 / Real.log (|z.im| + 2)) := h2 -+ _ = 3 * ((zerofree_constant / 20) * (1 / Real.log (|z.im| + 2))) := by -+ simp [div_eq_mul_inv, mul_left_comm, mul_assoc] -+ _ = 3 * deltaz z := by simp [deltaz, div_eq_mul_inv, mul_left_comm, mul_assoc] -+ -+lemma lem_deltarhotodeltat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → deltaz ρ ≥ (1/3) * deltaz_t t := by -+ intro c hρK -+ rcases hρK with ⟨hball, _hzero⟩ -+ have hball' : ρ ∈ Metric.closedBall ((3/2 : ℂ) + t * Complex.I) (5/6) := by -+ simpa [c, mul_comm] using! hball -+ have hmain : deltaz_t t ≤ 3 * deltaz ρ := lem_Ddt2dz t ht ρ hball' -+ have hthird_nonneg : 0 ≤ (1/3 : ℝ) := by norm_num -+ have h_mul : (1/3 : ℝ) * deltaz_t t ≤ (1/3 : ℝ) * (3 * deltaz ρ) := -+ mul_le_mul_of_nonneg_left hmain hthird_nonneg -+ have h_simplify : (1/3 : ℝ) * (3 * deltaz ρ) = deltaz ρ := by -+ ring -+ have : (1/3 : ℝ) * deltaz_t t ≤ deltaz ρ := by -+ simpa [h_simplify] using h_mul -+ simpa [mul_comm] using this -+ -+lemma lem_Rerhotodeltat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ρ.re ≤ 1 - 3 * deltaz_t t := by -+ intros c h_rho_in -+ -+ have h1 : ρ.re ≤ 1 - 9 * deltaz ρ := -+ lem_Rerhotodeltarho (ρ := ρ) t ht (by simpa [c, mul_comm] using! h_rho_in) -+ -+ have h2 : deltaz ρ ≥ (1/3) * deltaz_t t := lem_deltarhotodeltat t ht ρ h_rho_in -+ -+ have h3 : 9 * deltaz ρ ≥ 3 * deltaz_t t := by -+ calc -+ 9 * deltaz ρ -+ ≥ 9 * ((1/3) * deltaz_t t) := by -+ exact mul_le_mul_of_nonneg_left h2 (by norm_num : (0 : ℝ) ≤ 9) -+ _ = 9 * (1/3) * deltaz_t t := by ring -+ _ = 3 * deltaz_t t := by norm_num -+ -+ have h4 : 1 - 9 * deltaz ρ ≤ 1 - 3 * deltaz_t t := by -+ linarith [h3] -+ -+ exact le_trans h1 h4 -+ -+lemma lem_RezRerho (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → -+ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ z.re - ρ.re ≥ 2 * deltaz_t t := by -+ intro c h_rho_mem h_z -+ -+ have h_rho_bound := lem_Rerhotodeltat t ht ρ h_rho_mem -+ -+ have h_z_lower := h_z.1 -+ -+ linarith [h_z_lower, h_rho_bound] -+ -+lemma lem_abszrhodelta (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → -+ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ ‖z - ρ‖ ≥ 2 * deltaz_t t := by -+ intro c h_rho_in_K h_z_conditions -+ -+ have h1 : z.re - ρ.re ≥ 2 * deltaz_t t := (lem_RezRerho t ht z ρ) h_rho_in_K h_z_conditions -+ -+ have h2 : ‖z - ρ‖ ≥ z.re - ρ.re := lem_abszrhoReRe z ρ -+ -+ exact le_trans h1 h2 -+ -+lemma lem_abszrhodeltanot0 (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → -+ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ ‖z - ρ‖ > 0 := by -+ intro c hmem hbounds -+ -+ have h1 := lem_abszrhodelta t ht z ρ hmem hbounds -+ -+ have h2 := lem_delta19.2 t (by linarith [ht] : |t| > 2) -+ have h3 : 0 < deltaz_t t := h2.1 -+ -+ have h4 : 0 < 2 * deltaz_t t := by -+ linarith [h3] -+ -+ linarith [h1, h4] -+ -+lemma lem_1abszrho (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → -+ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ 1 / ‖z - ρ‖ ≤ 1 / (2 * deltaz_t t) := by -+ intro c hρ hz -+ -+ apply one_div_le_one_div_of_le -+ -+ · have h_delta_pos : 0 < deltaz_t t := by -+ have h_delta19 := lem_delta19 -+ exact (h_delta19.2 t (by linarith [ht] : |t| > 2)).1 -+ linarith [h_delta_pos] -+ -+ · exact lem_abszrhodelta t ht z ρ hρ hz -+ -+lemma lem_m_rho_zeta_nat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ∃ n : ℕ, (analyticOrderAt riemannZeta ρ) = n := by -+ intro c hρK -+ classical -+ -+ have ht1 : |t| > 1 := lt_trans (by norm_num) ht -+ -+ have hρ_in_ball1 : ρ ∈ Metric.closedBall c 1 := by -+ have hρ_le : dist ρ c ≤ (5 / 6 : ℝ) := by simpa [Metric.mem_closedBall] using hρK.1 -+ have : dist ρ c ≤ (1 : ℝ) := le_trans hρ_le (by norm_num) -+ simpa [Metric.mem_closedBall] using this -+ -+ have hρ_ne_one : ρ ≠ (1 : ℂ) := (D1cinTt_pre t ht1) ρ hρ_in_ball1 -+ -+ have hζ_analytic_at_ρ : AnalyticAt ℂ riemannZeta ρ := zetaanalOnnot1 ρ hρ_ne_one -+ -+ have h_not_eventually_zero : ¬ (∀ᶠ z in nhds ρ, riemannZeta z = 0) := by -+ by_contra h_ev -+ -+ have h_freq := eventually_eq_zero_implies_frequently_eq_zero_punctured riemannZeta ρ h_ev -+ -+ have h_zero_on_S := -+ zetaanalOnnot1.eqOn_zero_of_preconnected_of_frequently_eq_zero -+ complex_minus_singleton_connected hρ_ne_one h_freq -+ -+ have hc_in_ball1 : c ∈ Metric.closedBall c 1 := by -+ have : dist c c ≤ (1 : ℝ) := by simp [dist_self] -+ simp [Metric.mem_closedBall] -+ have hc_ne_one : c ≠ (1 : ℂ) := (D1cinTt_pre t ht1) c hc_in_ball1 -+ have hc_in_S : c ∈ {s : ℂ | s ≠ 1} := by simpa [Set.mem_ofPred_eq] using hc_ne_one -+ have hζc_zero : riemannZeta c = 0 := h_zero_on_S hc_in_S -+ exact (zetacnot0 t) hζc_zero -+ -+ have hfinite : analyticOrderAt riemannZeta ρ ≠ ⊤ := by -+ intro htop -+ have hiff : analyticOrderAt riemannZeta ρ = ⊤ ↔ ∀ᶠ z in nhds ρ, riemannZeta z = 0 := -+ analyticOrderAt_eq_top (f := riemannZeta) (z₀ := ρ) -+ have : ∀ᶠ z in nhds ρ, riemannZeta z = 0 := hiff.mp htop -+ exact h_not_eventually_zero this -+ -+ refine ⟨(analyticOrderAt riemannZeta ρ).toNat, ?_⟩ -+ simpa using (ENat.natCast_toNat hfinite).symm -+ -+lemma lem_finiteKzeta (t : ℝ) (_ht : |t| > 3) : -+ let c := (3/2 : ℂ) + I * t -+ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite := by -+ intro c -+ have hK : IsCompact (Metric.closedBall c (5 / (6 : ℝ))) := -+ closedBall_compact_complex c (5 / (6 : ℝ)) -+ simpa [zerosetKfRc] using -+ (riemannZeta_zeros_finite_of_compact (Metric.closedBall c (5 / (6 : ℝ))) hK) -+ -+lemma lem_triangle_ZFR (t : ℝ) (_ht : |t| > 3) (z : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), -+ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ ≤ -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) := by -+ -+ intros c hfin hz_cond -+ -+ apply le_trans (norm_sum_le _ _) -+ -+ apply Finset.sum_le_sum -+ intro ρ hρ -+ -+ rw [norm_div] -+ -+ rw [Complex.norm_natCast] -+ -+lemma lem_Zeta_Triangle_ZFR : -+ ∃ C_1 : ℝ, C_1 > 1 ∧ -+ ∀ t : ℝ, |t| > 3 → -+ let c := (3/2 : ℂ) + I * t -+ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), -+ ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ ‖deriv riemannZeta z / riemannZeta z‖ ≤ -+ ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ + -+ C_1 * Real.log |t| := by -+ obtain ⟨C1, hC1, hbound⟩ := lem_Zeta_Expansion_ZFR -+ refine ⟨C1, hC1, ?_⟩ -+ intro t ht c hfin z hz -+ -+ let S := (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)) -+ have hbound1 := hbound t ht hfin z hz -+ have htri : ‖deriv riemannZeta z / riemannZeta z‖ ≤ ‖(deriv riemannZeta z / riemannZeta z) - S‖ + ‖S‖ := by -+ have hn := norm_add_le ((deriv riemannZeta z / riemannZeta z) - S) S -+ have hrewrite : (deriv riemannZeta z / riemannZeta z) - S + S = (deriv riemannZeta z / riemannZeta z) := by -+ simp [sub_eq_add_neg] -+ simpa [S, hrewrite] using hn -+ have hsum := add_le_add_left hbound1 ‖S‖ -+ have : ‖deriv riemannZeta z / riemannZeta z‖ ≤ C1 * Real.log |t| + ‖S‖ := le_trans htri hsum -+ simpa [S, add_comm] using this -+ -+lemma lem_sumK1abs (t : ℝ) (ht : |t| > 3) (z : ℂ) : -+ let c := (3/2 : ℂ) + I * t -+ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), -+ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ -+ (1 / (2 * deltaz_t t)) * (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) := by -+ intro c hfin hzcond -+ -+ have hptwise : ∀ ρ ∈ hfin.toFinset, -+ ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖ ≤ -+ (1 / (2 * deltaz_t t)) * ((analyticOrderAt riemannZeta ρ).toNat : ℝ) := by -+ intro ρ hρmem -+ have hρ_in : ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) := -+ (Set.Finite.mem_toFinset (hs := hfin)).1 hρmem -+ have hbase : 1 / ‖z - ρ‖ ≤ 1 / (2 * deltaz_t t) := -+ lem_1abszrho t ht z ρ hρ_in hzcond -+ have hnonneg : 0 ≤ ((analyticOrderAt riemannZeta ρ).toNat : ℝ) := by -+ exact_mod_cast (Nat.zero_le ((analyticOrderAt riemannZeta ρ).toNat)) -+ have := mul_le_mul_of_nonneg_left hbase hnonneg -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this -+ have hsum := Finset.sum_le_sum hptwise -+ -+ have hrw := -+ (Finset.mul_sum (s := hfin.toFinset) -+ (f := fun ρ => ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) -+ (a := (1 / (2 * deltaz_t t)))) -+ have hsum2 := hsum -+ -+ rw [← hrw] at hsum2 -+ -+ simpa [div_eq_mul_inv] using hsum2 -+ -+lemma helper_analyticOnNhd_shift_div (f : ℂ → ℂ) (c : ℂ) -+ (h : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ f z) -+ (_hc : f c ≠ 0) : -+ AnalyticOnNhd ℂ (fun z => f (z + c) / f c) (Metric.closedBall (0 : ℂ) 1) := by -+ -+ intro z hz -+ -+ have hz_norm : ‖z‖ ≤ 1 := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hz -+ -+ have hz_addc_mem : z + c ∈ Metric.closedBall c 1 := by -+ -+ have : dist (z + c) c ≤ 1 := by -+ simpa [dist_eq_norm, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hz_norm -+ simpa [Metric.mem_closedBall] using this -+ -+ have h_f_at : AnalyticAt ℂ f (z + c) := h (z + c) hz_addc_mem -+ -+ have h_addc : AnalyticAt ℂ (fun w => w + c) z := by -+ simpa using! (analyticAt_id.add analyticAt_const) -+ -+ have h_comp : AnalyticAt ℂ (fun w => f (w + c)) z := -+ (AnalyticAt.fun_comp h_f_at h_addc) -+ -+ have h_mul_const : AnalyticAt ℂ (fun w => (1 / f c) * f (w + c)) z := -+ (analyticAt_const.mul h_comp) -+ -+ simpa [div_eq_mul_inv, mul_comm] using h_mul_const -+ -+lemma helper_finite_zeros_shift (r : ℝ) (_hr : r > 0) (c : ℂ) (f : ℂ → ℂ) -+ (hc : f c ≠ 0) -+ (_h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) -+ (hfin : (zerosetKfRc r c f).Finite) : -+ (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)).Finite := -+by -+ classical -+ let g : ℂ → ℂ := fun z => f (z + c) / f c -+ have hEq : -+ zerosetKfRc r (0 : ℂ) g = (fun ρ : ℂ => ρ - c) '' zerosetKfRc r c f := by -+ apply Set.Subset.antisymm -+ · intro x hx -+ -+ have hx_ball : dist x (0 : ℂ) ≤ r := by -+ simpa [Metric.mem_closedBall] using hx.1 -+ -+ have hx_ball' : dist (x + c) c ≤ r := by -+ simpa [Complex.dist_eq, add_sub_cancel] using hx_ball -+ -+ have hx_zero : f (x + c) = 0 := by -+ rcases (div_eq_zero_iff).mp (by simpa [g] using hx.2) with hnum | hden -+ · exact hnum -+ · exact (hc hden).elim -+ refine ⟨x + c, ?_, ?_⟩ -+ · exact ⟨by simpa [Metric.mem_closedBall] using hx_ball', hx_zero⟩ -+ · simp -+ · intro x hx -+ rcases hx with ⟨ρ, hρ, rfl⟩ -+ -+ have hρ_ball : dist ρ c ≤ r := by -+ simpa [Metric.mem_closedBall] using hρ.1 -+ refine ⟨?_, ?_⟩ -+ · -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hρ_ball -+ · -+ have : f ρ = 0 := hρ.2 -+ simp [g, sub_add_cancel, this] -+ -+ have himage : ((fun ρ : ℂ => ρ - c) '' zerosetKfRc r c f).Finite := -+ hfin.image (fun ρ : ℂ => ρ - c) -+ simpa [g, hEq] using himage -+ -+lemma helper_bound_shifted (B R : ℝ) (_hB : 1 < B) (_hRpos : 0 < R) (_hRlt1 : R < 1) -+ (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) -+ (h_bound : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R, -+ ‖(fun w => f (w + c) / f c) z‖ ≤ B / ‖f c‖ := -+by -+ intro z hz -+ -+ have hz_norm : ‖z‖ ≤ R := by -+ have hz' : dist z (0 : ℂ) ≤ R := by simpa [Metric.mem_closedBall] using hz -+ simpa [Complex.dist_eq] using hz' -+ -+ have hz_ballc : z + c ∈ Metric.closedBall c R := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq, add_sub_cancel] using hz_norm -+ -+ have hfb : ‖f (z + c)‖ ≤ B := h_bound (z + c) hz_ballc -+ -+ have hpos : 0 < ‖f c‖ := (norm_pos_iff).2 hc -+ -+ have hdiv : ‖f (z + c)‖ / ‖f c‖ ≤ B / ‖f c‖ := (div_le_div_iff_of_pos_right hpos).2 hfb -+ -+ have hnorm_eq : ‖(fun w => f (w + c) / f c) z‖ = ‖f (z + c)‖ / ‖f c‖ := by -+ change ‖f (z + c) / f c‖ = ‖f (z + c)‖ / ‖f c‖ -+ simp -+ simpa [hnorm_eq] using hdiv -+ -+lemma helper_g_zero_eq_one (f : ℂ → ℂ) (c : ℂ) (hc : f c ≠ 0) : -+ (fun z => f (z + c) / f c) 0 = 1 := by -+ simp [hc] -+ -+lemma helper_zerosetKfR_eq_center0 (r : ℝ) (hr : r > 0) (f : ℂ → ℂ) : -+ zerosetKfR r hr f = zerosetKfRc r (0 : ℂ) f := by -+ ext ρ; simp [zerosetKfR, zerosetKfRc] -+ -+lemma helper_sum_nonneg_nat (ι : Type*) (s : Finset ι) (f : ι → ℕ) : -+ 0 ≤ ∑ i ∈ s, ((f i : ℝ)) := by -+ classical -+ have h : ∀ i ∈ s, (0 : ℝ) ≤ (f i : ℝ) := by -+ intro i hi -+ exact_mod_cast (Nat.zero_le (f i)) -+ simpa using Finset.sum_nonneg h -+ -+lemma helper_one_le_Bdivfc2 (B R : ℝ) (_hB : 1 < B) (hRpos : 0 < R) (_hRlt1 : R < 1) -+ (f : ℂ → ℂ) (c : ℂ) (hc : f c ≠ 0) -+ (h_bound : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) : -+ 1 ≤ B / ‖f c‖ := -+by -+ have hc_in : c ∈ Metric.closedBall c R := by -+ have h0le : (0 : ℝ) ≤ R := le_of_lt hRpos -+ simpa [Metric.mem_closedBall, dist_self] using h0le -+ have hfc_le : ‖f c‖ ≤ B := h_bound c hc_in -+ have hfc_pos : 0 < ‖f c‖ := (norm_pos_iff.mpr hc) -+ have hdiv := (div_le_div_iff_of_pos_right (c := ‖f c‖) hfc_pos).mpr hfc_le -+ simpa [div_self (ne_of_gt hfc_pos)] using hdiv -+ -+lemma helper_sum_over_equal_finite_sets {α : Type*} (S T : Set α) -+ (hS : S.Finite) (hT : T.Finite) (hST : S = T) (φ : α → ℝ) : -+ (∑ x ∈ hS.toFinset, φ x) = (∑ x ∈ hT.toFinset, φ x) := by -+ classical -+ have hfin_eq : hS.toFinset = hT.toFinset := by -+ ext x -+ constructor -+ · intro hx -+ have hxS : x ∈ S := by -+ have hmem : x ∈ hS.toFinset ↔ x ∈ S := by -+ simp -+ exact hmem.mp hx -+ have hxT : x ∈ T := by simpa [hST] using hxS -+ have hmemT : x ∈ hT.toFinset ↔ x ∈ T := by -+ simp -+ exact hmemT.mpr hxT -+ · intro hx -+ have hxT : x ∈ T := by -+ have hmemT : x ∈ hT.toFinset ↔ x ∈ T := by -+ simp -+ exact hmemT.mp hx -+ have hxS : x ∈ S := by simpa [hST] using hxT -+ have hmemS : x ∈ hS.toFinset ↔ x ∈ S := by -+ simp -+ exact hmemS.mpr hxS -+ simp [hfin_eq] -+ -+lemma helper_apply_jensen_to_g -+ (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (g : ℂ → ℂ) -+ (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) -+ (hg0_ne : g 0 ≠ 0) -+ (hg0_one : g 0 = 1) -+ (hfin_g : (zerosetKfR R1 (by linarith) g).Finite) -+ (hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B) : -+ (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ≤ Real.log B / Real.log (R / R1) := by -+ classical -+ -+ have h_exists : ∀ σ ∈ zerosetKfR R1 (by linarith) g, -+ ∃ hσ : ℂ → ℂ, AnalyticAt ℂ hσ σ ∧ hσ σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, g z = (z - σ) ^ (analyticOrderAt g σ).toNat * hσ z := by -+ intro σ hσ -+ exact lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR_lt_1 g h_g_analytic hg0_ne σ hσ -+ -+ let h_σ : ℂ → (ℂ → ℂ) := -+ fun σ => dite (σ ∈ zerosetKfR R1 (by linarith) g) -+ (fun h => Classical.choose (h_exists σ h)) -+ (fun _ => fun _ => (1 : ℂ)) -+ -+ have h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) g, -+ AnalyticAt ℂ (h_σ σ) σ ∧ (h_σ σ) σ ≠ 0 ∧ -+ ∀ᶠ z in nhds σ, g z = (z - σ) ^ (analyticOrderAt g σ).toNat * (h_σ σ) z := by -+ intro σ hσin -+ have hx := h_exists σ hσin -+ dsimp [h_σ] -+ -+ simpa [hσin] using (Classical.choose_spec hx) -+ -+ have hbound := -+ lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 -+ g h_g_analytic hg0_ne hg0_one hfin_g (h_σ := h_σ) hg_le_B h_σ_spec -+ -+ simpa [one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hbound -+ -+lemma helper_sum_f_equals_sum_g -+ (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) -+ (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) -+ (hfin : (zerosetKfRc r c f).Finite) : -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) -+ = -+ (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), -+ ((analyticOrderAt (fun z => f (z + c) / f c) ρ').toNat : ℝ)) := -+by -+ classical -+ -+ let S : Finset ℂ := hfin.toFinset -+ let φ : ℂ → ℂ := fun ρ => ρ - c -+ let g' : ℂ → ℂ := fun z => f (z + c) / f c -+ -+ have himg : (φ '' zerosetKfRc r c f).Finite := hfin.image φ -+ have h_img_toFinset : ((hfin.image φ).toFinset) = S.image φ := by -+ simpa [S] using (Set.Finite.toFinset_image (s := (zerosetKfRc r c f)) (f := φ) -+ (hs := hfin) (h := himg)) -+ -+ have h_orders_match : -+ (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ)) = -+ (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := by -+ apply Finset.sum_congr rfl -+ intro ρ hρS -+ -+ have hρ_mem : ρ ∈ zerosetKfRc r c f := -+ (Set.Finite.mem_toFinset (hs := hfin)).1 hρS -+ have hρ_ball : ρ ∈ Metric.closedBall c r := hρ_mem.1 -+ have hρ_fzero : f ρ = 0 := hρ_mem.2 -+ -+ have hρ'_ball : (φ ρ) ∈ Metric.closedBall (0 : ℂ) r := by -+ -+ have hdist_le : dist ρ c ≤ r := by -+ simpa [Metric.mem_closedBall] using hρ_ball -+ -+ have : dist (φ ρ) 0 ≤ r := by -+ simpa [φ, dist_eq_norm] using (by simpa [dist_eq_norm] using hdist_le) -+ simpa [Metric.mem_closedBall] using this -+ have hρ'_gzero : g' (φ ρ) = 0 := by -+ simp [g', φ, hρ_fzero, sub_eq_add_neg, add_comm] -+ have hρ'_mem : (φ ρ) ∈ zerosetKfRc r (0 : ℂ) g' := ⟨hρ'_ball, hρ'_gzero⟩ -+ -+ have h_m_eq := fc_m_order r hr c f hc h_analytic (ρ' := φ ρ) hρ'_mem -+ -+ have h_m_eq' : analyticOrderAt g' (φ ρ) = analyticOrderAt f ρ := by -+ simpa [g', φ, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h_m_eq -+ -+ have h_toNat : (analyticOrderAt g' (φ ρ)).toNat = (analyticOrderAt f ρ).toNat := by -+ simpa using congrArg ENat.toNat h_m_eq' -+ simp [h_toNat] -+ -+ have h_inj : Function.Injective φ := by -+ intro x y hxy -+ -+ have := congrArg (fun z => z + c) hxy -+ simpa [φ, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this -+ -+ have h_sum_image : -+ (∑ ρ' ∈ S.image φ, ((analyticOrderAt g' ρ').toNat : ℝ)) = -+ (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := by -+ refine Finset.sum_image ?h -+ intro x hx y hy hxy -+ -+ exact h_inj hxy -+ -+ calc -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) -+ = (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ)) := by rfl -+ _ = (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := h_orders_match -+ _ = (∑ ρ' ∈ S.image φ, ((analyticOrderAt g' ρ').toNat : ℝ)) := h_sum_image.symm -+ _ = (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), -+ ((analyticOrderAt (fun z => f (z + c) / f c) ρ').toNat : ℝ)) := by -+ -+ simp [S, φ, g', h_img_toFinset] -+ -+lemma helper_zero_set_shift_eq -+ (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) -+ (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) : -+ zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c) -+ = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := by -+ simpa using fc_zeros r hr c f hc h_analytic -+ -+lemma helper_fin_zero_g_is_image -+ (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) -+ (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) -+ (hfin : (zerosetKfRc r c f).Finite) : -+ (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)).Finite := -+by -+ classical -+ have hset : zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c) -+ = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := -+ by simpa using fc_zeros r hr c f hc h_analytic -+ have hfin_img : ((fun ρ => ρ - c) '' (zerosetKfRc r c f)).Finite := hfin.image _ -+ simpa [hset] using hfin_img -+ -+lemma helper_AnalyticOnNhd_to_pointwise {S : Set ℂ} {f : ℂ → ℂ} -+ (h : AnalyticOnNhd ℂ f S) : ∀ z ∈ S, AnalyticAt ℂ f z := by -+ intro z hz -+ exact h z hz -+ -+lemma jensen_sum_bound_strict -+ (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) -+ (g : ℂ → ℂ) -+ (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) -+ (hg0_ne : g 0 ≠ 0) -+ (hg0_one : g 0 = 1) -+ (hfin_g : (zerosetKfR R1 (by linarith) g).Finite) -+ (hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B) : -+ (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ≤ -+ Real.log B / Real.log (R / R1) := by -+ exact helper_apply_jensen_to_g B R R1 hB hR1_pos hR1_lt_R hR_lt_1 g -+ h_g_analytic hg0_ne hg0_one hfin_g hg_le_B -+ -+lemma no_zero_of_bound_one_and_center_one -+ (R : ℝ) (hR_lt_1 : R < 1) -+ (g : ℂ → ℂ) -+ (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) -+ (hg0_one : g 0 = 1) -+ (hg_le_one : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ 1) : -+ ∀ z ∈ Metric.closedBall (0 : ℂ) R, g z ≠ 0 := by -+ intro z hz -+ by_cases hRpos : 0 < R -+ · -+ -+ have hdiff : DifferentiableOn ℂ g (Metric.ball (0 : ℂ) R) := by -+ intro x hx -+ have hxlt : ‖x‖ < R := by -+ simpa [Metric.mem_ball, Complex.dist_eq] using hx -+ have hxle1 : ‖x‖ ≤ 1 := le_trans (le_of_lt hxlt) (le_of_lt hR_lt_1) -+ have hx_in1 : x ∈ Metric.closedBall (0 : ℂ) 1 := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hxle1 -+ exact ((h_g_analytic x hx_in1).differentiableAt).differentiableWithinAt -+ -+ have hcont : ContinuousOn g (Metric.closedBall (0 : ℂ) R) := by -+ intro x hx -+ have hxleR : ‖x‖ ≤ R := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hx -+ have hxle1 : ‖x‖ ≤ 1 := le_trans hxleR (le_of_lt hR_lt_1) -+ have hx_in1 : x ∈ Metric.closedBall (0 : ℂ) 1 := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hxle1 -+ exact (h_g_analytic x hx_in1).continuousAt.continuousWithinAt -+ have hdcc : DiffContOnCl ℂ g (Metric.ball (0 : ℂ) R) := -+ DiffContOnCl.mk_ball hdiff hcont -+ -+ have hIsMax : IsMaxOn (fun z => ‖g z‖) (Metric.ball (0 : ℂ) R) 0 := by -+ intro y hy -+ have hynormlt : ‖y‖ < R := by -+ simpa [Metric.mem_ball, Complex.dist_eq] using hy -+ have hyle : ‖y‖ ≤ R := le_of_lt hynormlt -+ have hgy : ‖g y‖ ≤ 1 := hg_le_one y hyle -+ simpa [hg0_one] using hgy -+ -+ have hEqOn := -+ Complex.eqOn_closedBall_of_isMaxOn_norm (z := (0 : ℂ)) (r := R) hdcc hIsMax -+ have hz_eq : g z = (fun _ => g 0) z := hEqOn hz -+ have hz_eq1 : g z = g 0 := by simpa using hz_eq -+ have gz_one : g z = 1 := by simpa [hg0_one] using hz_eq1 -+ simp [gz_one] -+ · -+ -+ have hRle : R ≤ 0 := le_of_not_gt hRpos -+ have hz_le : ‖z‖ ≤ R := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz -+ have hz_norm_eq : ‖z‖ = 0 := -+ le_antisymm (le_trans hz_le hRle) (norm_nonneg z) -+ have hz_zero : z = 0 := by -+ simpa [norm_eq_zero] using hz_norm_eq -+ simp [hz_zero, hg0_one] -+ -+lemma helper_sum_over_equal_finite_sets_orders -+ {S T : Set ℂ} (g : ℂ → ℂ) -+ (hS : S.Finite) (hT : T.Finite) (hST : S = T) : -+ (∑ x ∈ hS.toFinset, ((analyticOrderAt g x).toNat : ℝ)) -+ = (∑ x ∈ hT.toFinset, ((analyticOrderAt g x).toNat : ℝ)) := by -+ classical -+ have hF : hS.toFinset = hT.toFinset := by -+ ext x -+ simp [Set.Finite.mem_toFinset, hST] -+ simp [hF] -+ -+lemma helper_mem_closedBall_zero_iff_norm_le (z : ℂ) (R : ℝ) : -+ z ∈ Metric.closedBall (0 : ℂ) R ↔ ‖z‖ ≤ R := by -+ simp [Metric.mem_closedBall, dist_eq_norm] -+ -+lemma helper_bound_on_ball_to_norm_imp -+ {R : ℝ} {g : ℂ → ℂ} {M : ℝ} -+ (hg : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖g z‖ ≤ M) : -+ ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ M := by -+ intro z hz -+ have hz' : z ∈ Metric.closedBall (0 : ℂ) R := by -+ have : dist z (0 : ℂ) ≤ R := by -+ simpa [dist_eq_norm] using hz -+ simpa [Metric.mem_closedBall] using this -+ exact hg z hz' -+ -+lemma helper_pointwise_to_AnalyticOnNhd {S : Set ℂ} {f : ℂ → ℂ} -+ (h : ∀ z ∈ S, AnalyticAt ℂ f z) : AnalyticOnNhd ℂ f S := by -+ simpa using! h -+ -+lemma lem_sum_m_rho_bound_c (B R R1 : ℝ) (hB : 1 < B) -+ (hR1_pos : 0 < R1) -+ (hR1_lt_R : R1 < R) -+ (hR_lt_1 : R < 1) -+ (f : ℂ → ℂ) -+ (c : ℂ) -+ (h_f_analytic : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ f z) -+ (h_f_nonzero_at_zero : f c ≠ 0) -+ (hf_le_B : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) -+ (hfin : (zerosetKfRc R1 c f).Finite) : -+ ∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by -+ classical -+ -+ let g : ℂ → ℂ := fun z => f (z + c) / f c -+ -+ have h_g_analyticOn : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := -+ helper_analyticOnNhd_shift_div f c h_f_analytic h_f_nonzero_at_zero -+ have h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z := -+ helper_AnalyticOnNhd_to_pointwise h_g_analyticOn -+ -+ have hg0_one : g 0 = 1 := helper_g_zero_eq_one f c h_f_nonzero_at_zero -+ have hg0_ne : g 0 ≠ 0 := by simp [hg0_one] -+ -+ have hAnal_f : AnalyticOnNhd ℂ f (Metric.closedBall c 1) := -+ helper_pointwise_to_AnalyticOnNhd h_f_analytic -+ have hfin_g0 : (zerosetKfRc R1 (0 : ℂ) g).Finite := -+ helper_fin_zero_g_is_image R1 hR1_pos c f h_f_nonzero_at_zero hAnal_f hfin -+ have hZR_eq : zerosetKfR R1 hR1_pos g = zerosetKfRc R1 (0 : ℂ) g := -+ helper_zerosetKfR_eq_center0 R1 hR1_pos g -+ have hfin_g : (zerosetKfR R1 (by exact hR1_pos) g).Finite := by -+ simpa [hZR_eq] using hfin_g0 -+ -+ have h_bound_shift : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖g z‖ ≤ B / ‖f c‖ := -+ helper_bound_shifted B R hB (by exact lt_trans hR1_pos hR1_lt_R) hR_lt_1 c f -+ h_f_nonzero_at_zero (fun z hz => hf_le_B z <| by simpa using hz) -+ have hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B / ‖f c‖ := -+ helper_bound_on_ball_to_norm_imp (R := R) (g := g) (M := B / ‖f c‖) h_bound_shift -+ -+ have hfc_le : ‖f c‖ ≤ B := by -+ have : c ∈ Metric.closedBall c R := by -+ have hRpos' : 0 ≤ R := le_of_lt (lt_trans hR1_pos hR1_lt_R) -+ have : dist c c ≤ R := by simpa [dist_self] using hRpos' -+ simpa [Metric.mem_closedBall] using this -+ exact hf_le_B c this -+ have hfc_pos : 0 < ‖f c‖ := (norm_pos_iff).2 h_f_nonzero_at_zero -+ have hBdiv_ge_one : 1 ≤ B / ‖f c‖ := by -+ have hdiv := (div_le_div_iff_of_pos_right hfc_pos).mpr hfc_le -+ simpa [div_self (ne_of_gt hfc_pos)] using hdiv -+ -+ have hsum_fg_eq : -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) -+ = (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), -+ ((analyticOrderAt g ρ').toNat : ℝ)) := -+ helper_sum_f_equals_sum_g (r := R1) (hr := hR1_pos) (c := c) -+ (f := f) (hc := h_f_nonzero_at_zero) (h_analytic := hAnal_f) (hfin := hfin) -+ -+ have hST_g_img : zerosetKfR R1 hR1_pos g -+ = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := by -+ have h1 : zerosetKfR R1 hR1_pos g = zerosetKfRc R1 (0 : ℂ) g := -+ helper_zerosetKfR_eq_center0 R1 hR1_pos g -+ have h2 : zerosetKfRc R1 (0 : ℂ) g -+ = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := -+ helper_zero_set_shift_eq R1 hR1_pos c f h_f_nonzero_at_zero hAnal_f -+ simpa [h1] using h2 -+ -+ rcases lt_or_eq_of_le hBdiv_ge_one with hBdiv_gt_one | hBdiv_eq_one -+ · -+ have hsum_g_bound := -+ jensen_sum_bound_strict (B := B / ‖f c‖) (R := R) (R1 := R1) -+ (hB := hBdiv_gt_one) -+ (hR1_pos := hR1_pos) (hR1_lt_R := hR1_lt_R) (hR_lt_1 := hR_lt_1) -+ (g := g) (h_g_analytic := h_g_analytic) (hg0_ne := hg0_ne) -+ (hg0_one := hg0_one) (hfin_g := hfin_g) (hg_le_B := hg_le_B) -+ -+ have hsum_g_reindex : -+ (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) -+ = (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) := -+ helper_sum_over_equal_finite_sets_orders (g := g) -+ (S := zerosetKfR R1 hR1_pos g) -+ (T := (fun ρ => ρ - c) '' (zerosetKfRc R1 c f)) -+ (hS := hfin_g) (hT := hfin.image (fun ρ => ρ - c)) (hST := hST_g_img) -+ -+ have : -+ (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) -+ ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by -+ simpa [hsum_g_reindex] using hsum_g_bound -+ -+ simpa [hsum_fg_eq] using this -+ · -+ have hBdiv_eq_one' : B / ‖f c‖ = 1 := by -+ simpa [eq_comm] using hBdiv_eq_one -+ have hg_le_one : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ 1 := by -+ intro z hz -+ have := hg_le_B z hz -+ simpa [hBdiv_eq_one'] using this -+ have g_nonzero_on_ball : ∀ z ∈ Metric.closedBall (0 : ℂ) R, g z ≠ 0 := -+ no_zero_of_bound_one_and_center_one R hR_lt_1 g h_g_analytic hg0_one hg_le_one -+ -+ have hS_empty : zerosetKfR R1 hR1_pos g = (∅ : Set ℂ) := by -+ ext z; constructor -+ · intro hz -+ rcases hz with ⟨hzball, hzzero⟩ -+ have hzR1 : ‖z‖ ≤ R1 := by simpa [Metric.mem_closedBall, dist_eq_norm] using hzball -+ have hzR : ‖z‖ ≤ R := le_trans hzR1 (le_of_lt hR1_lt_R) -+ have hzR' : z ∈ Metric.closedBall (0 : ℂ) R := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hzR -+ exact (g_nonzero_on_ball z hzR') hzzero -+ · intro hzfalse -+ cases hzfalse -+ have hsum_g_zero : -+ (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) = 0 := by -+ have h := -+ helper_sum_over_equal_finite_sets_orders (g := g) -+ (S := zerosetKfR R1 hR1_pos g) (T := (∅ : Set ℂ)) -+ (hS := hfin_g) (hT := Set.finite_empty) (hST := hS_empty) -+ simpa using h -+ -+ have hsum_reindex := -+ helper_sum_over_equal_finite_sets_orders (g := g) -+ (S := zerosetKfR R1 hR1_pos g) -+ (T := (fun ρ => ρ - c) '' (zerosetKfRc R1 c f)) -+ (hS := hfin_g) (hT := hfin.image (fun ρ => ρ - c)) (hST := hST_g_img) -+ have hsum_img_eq : -+ (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) -+ = (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) := by -+ simpa using hsum_reindex.symm -+ have hsum_img_zero : -+ (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) = 0 := by -+ simp [hsum_img_eq, hsum_g_zero] -+ -+ have hsum_f_zero : -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) = 0 := by -+ simpa [hsum_img_zero] using hsum_fg_eq -+ -+ have hRHS_zero : Real.log (B / ‖f c‖) / Real.log (R / R1) = 0 := by -+ simp [hBdiv_eq_one'] -+ -+ have : -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) -+ ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by -+ simp [hsum_f_zero, hRHS_zero] -+ exact this -+ -+lemma lem_sum_m_rho_zeta : -+ ∃ C_2 > 1, ∀ (t : ℝ) (_ht : |t| > 3), -+ let c := (3/2 : ℂ) + I * t; -+ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), -+ ∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) ≤ C_2 * Real.log |t| := by -+ classical -+ -+ obtain ⟨b, hb_gt1, hb_bound⟩ := zeta32upper -+ obtain ⟨a, ha_pos, ha_bound⟩ := zeta_low_332 -+ -+ let R1 : ℝ := 5 / 6 -+ let R : ℝ := 8 / 9 -+ let logRatio : ℝ := Real.log (R / R1) -+ -+ let u : ℝ := Real.log (b / a) -+ let C2 : ℝ := max 2 ((1 + |u|) / logRatio) -+ have hC2_gt_one : 1 < C2 := by -+ have htwo_lt : (1 : ℝ) < 2 := by norm_num -+ have hle : (2 : ℝ) ≤ C2 := by -+ have := le_max_left (2 : ℝ) ((1 + |u|) / logRatio) -+ simp [C2] -+ exact lt_of_lt_of_le htwo_lt hle -+ refine ⟨C2, hC2_gt_one, ?_⟩ -+ intro t ht c hfin -+ -+ have hR1_pos : 0 < R1 := by dsimp [R1]; norm_num -+ have hR1_lt_R : R1 < R := by dsimp [R1, R]; norm_num -+ have hR_lt_1 : R < 1 := by dsimp [R]; norm_num -+ have hR_le_one : R ≤ (1 : ℝ) := by dsimp [R]; norm_num -+ -+ have ht1 : |t| > 1 := lt_trans (by norm_num) ht -+ have h_f_analytic : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ riemannZeta z := by -+ intro z hz -+ have hz_ne_one : z ≠ (1 : ℂ) := (D1cinTt_pre t ht1) z (by simpa [c] using hz) -+ exact zetaanalOnnot1 z hz_ne_one -+ -+ have h_nonzero : riemannZeta c ≠ 0 := by simpa [c] using zetacnot0 t -+ -+ have ht2 : |t| > 2 := by linarith -+ have h_upper_on_ball1 : ∀ z ∈ Metric.closedBall c 1, ‖riemannZeta z‖ < b * |t| := by -+ have h := hb_bound t ht2 -+ intro z hz; simpa [c] using h z (by simpa [c] using hz) -+ have hf_le_B : ∀ z ∈ Metric.closedBall c R, ‖riemannZeta z‖ ≤ b * |t| := by -+ intro z hz -+ have hz1 : z ∈ Metric.closedBall c 1 := -+ (Metric.closedBall_subset_closedBall hR_le_one) hz -+ exact le_of_lt (h_upper_on_ball1 z hz1) -+ -+ have hb_pos : 0 < b := lt_trans (by norm_num) hb_gt1 -+ have htabove1 : (1 : ℝ) ≤ |t| := le_of_lt ht1 -+ have hb_le_B : b ≤ b * |t| := by -+ have := mul_le_mul_of_nonneg_left htabove1 (le_of_lt hb_pos) -+ simpa [one_mul] using this -+ have hBpos : 1 < b * |t| := lt_of_lt_of_le hb_gt1 hb_le_B -+ -+ have h_sum_bound := -+ lem_sum_m_rho_bound_c (B := b * |t|) (R := R) (R1 := R1) -+ (hB := hBpos) -+ (hR1_pos := hR1_pos) -+ (hR1_lt_R := hR1_lt_R) -+ (hR_lt_1 := hR_lt_1) -+ (f := riemannZeta) (c := c) -+ (h_f_analytic := h_f_analytic) -+ (h_f_nonzero_at_zero := h_nonzero) -+ (hf_le_B := hf_le_B) -+ (hfin := hfin) -+ -+ have hlogRatio_pos : 0 < logRatio := by -+ have : 1 < R / R1 := by dsimp [R, R1]; norm_num -+ exact Real.log_pos this -+ -+ have h_zeta_ge_a : a ≤ ‖riemannZeta c‖ := by -+ simpa [c, mul_comm] using! ha_bound t -+ -+ have ht_abs_pos : 0 < |t| := lt_trans (by norm_num) ht -+ have hζ_norm_pos : 0 < ‖riemannZeta c‖ := norm_pos_iff.mpr h_nonzero -+ have hb_ne : (b : ℝ) ≠ 0 := ne_of_gt hb_pos -+ have ht_abs_ne : (|t| : ℝ) ≠ 0 := ne_of_gt ht_abs_pos -+ have ha_ne : a ≠ 0 := ne_of_gt ha_pos -+ have hlog_split1 : -+ Real.log ((b * |t|) / ‖riemannZeta c‖) -+ = (Real.log b + Real.log |t|) - Real.log ‖riemannZeta c‖ := by -+ have : Real.log (b * |t|) = Real.log b + Real.log |t| := -+ Real.log_mul hb_ne ht_abs_ne -+ have : -+ Real.log ((b * |t|) / ‖riemannZeta c‖) -+ = Real.log (b * |t|) - Real.log ‖riemannZeta c‖ := -+ Real.log_div (by exact mul_ne_zero hb_ne ht_abs_ne) (ne_of_gt hζ_norm_pos) -+ simp [this, Real.log_mul hb_ne ht_abs_ne] -+ have hlog_div_eq : Real.log (b / a) = Real.log b - Real.log a := -+ Real.log_div hb_ne ha_ne -+ have hlog_a_le : Real.log a ≤ Real.log ‖riemannZeta c‖ := -+ Real.log_le_log (by exact ha_pos) (by exact h_zeta_ge_a) -+ have hneg : -(Real.log ‖riemannZeta c‖) ≤ -Real.log a := by -+ simpa using (neg_le_neg hlog_a_le) -+ have hRHS_le_const : -+ Real.log ((b * |t|) / ‖riemannZeta c‖) -+ ≤ Real.log |t| + Real.log (b / a) := by -+ -+ have : -+ (Real.log b + Real.log |t|) - Real.log ‖riemannZeta c‖ -+ ≤ (Real.log b + Real.log |t|) - Real.log a := by -+ simpa [sub_eq_add_neg] using! add_le_add_right hneg (Real.log b + Real.log |t|) -+ simpa [hlog_split1, sub_eq_add_neg, add_comm, add_left_comm, add_assoc, hlog_div_eq] -+ using this -+ -+ have hRHS1 : -+ Real.log ((b * |t|) / ‖riemannZeta c‖) / logRatio -+ ≤ (Real.log |t| + Real.log (b / a)) / logRatio := by -+ exact div_le_div_of_nonneg_right hRHS_le_const (le_of_lt hlogRatio_pos) -+ -+ have hlogt_ge_one : (1 : ℝ) ≤ Real.log |t| := by -+ -+ have h3le : (3 : ℝ) ≤ |t| := le_of_lt ht -+ have hlog3_le : Real.log 3 ≤ Real.log |t| := Real.log_le_log (by norm_num) h3le -+ have h_exp_le : Real.exp (1 : ℝ) ≤ 3 := le_of_lt lem_three_gt_e -+ have hlog3_ge_one : (1 : ℝ) ≤ Real.log 3 := -+ (Real.le_log_iff_exp_le (by norm_num : 0 < (3 : ℝ))).mpr h_exp_le -+ exact le_trans hlog3_ge_one hlog3_le -+ have hadd_le : Real.log |t| + Real.log (b / a) ≤ (1 + |u|) * Real.log |t| := by -+ have haux1 : Real.log (b / a) ≤ |u| := by simpa [u] using le_abs_self (Real.log (b / a)) -+ have haux2 : |u| ≤ |u| * Real.log |t| := by -+ have hnonneg : 0 ≤ |u| := abs_nonneg _ -+ have h1le : (1 : ℝ) ≤ Real.log |t| := hlogt_ge_one -+ simpa [one_mul] using (mul_le_mul_of_nonneg_left h1le hnonneg) -+ calc -+ Real.log |t| + Real.log (b / a) -+ ≤ Real.log |t| + |u| := by exact add_le_add_right haux1 _ -+ _ ≤ Real.log |t| + (|u| * Real.log |t|) := by exact add_le_add_right haux2 _ -+ _ = (1 + |u|) * Real.log |t| := by ring -+ have hRHS2 : -+ (Real.log |t| + Real.log (b / a)) / logRatio -+ ≤ ((1 + |u|) / logRatio) * Real.log |t| := by -+ have := div_le_div_of_nonneg_right hadd_le (le_of_lt hlogRatio_pos) -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this -+ have hfinal : -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) -+ ≤ ((1 + |u|) / logRatio) * Real.log |t| := by -+ have := le_trans h_sum_bound hRHS1 -+ exact le_trans this hRHS2 -+ -+ have hC2_ge : ((1 + |u|) / logRatio) ≤ C2 := by -+ have := le_max_right (2 : ℝ) ((1 + |u|) / logRatio) -+ simp [C2] -+ have hlogt_nonneg : 0 ≤ Real.log |t| := le_trans (by norm_num) hlogt_ge_one -+ have hscale := mul_le_mul_of_nonneg_right hC2_ge hlogt_nonneg -+ exact le_trans hfinal hscale -+ -+lemma lem_sumKdeltatlogt : -+ ∃ C_3 > 1, ∀ (t : ℝ) (_ht : |t| > 3), -+ let c := (3/2 : ℂ) + I * t; -+ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), -+ ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ -+ (C_3 / (deltaz_t t)) * Real.log |t| := by -+ -+ obtain ⟨C_2, hC_2_pos, hC_2_bound⟩ := lem_sum_m_rho_zeta -+ -+ use C_2 -+ -+ constructor -+ · -+ exact hC_2_pos -+ -+ · -+ intro t ht c hfin z hz -+ -+ have h1 := lem_sumK1abs t ht z hfin hz -+ -+ have h2 := hC_2_bound t ht hfin -+ -+ have ht2 : |t| > 2 := by linarith [ht] -+ have h_delta_pos : 0 < deltaz_t t := (lem_delta19.2 t ht2).1 -+ -+ have h_t_ge_one : (1 : ℝ) ≤ |t| := by linarith [ht] -+ -+ calc -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) -+ ≤ (1 / (2 * deltaz_t t)) * (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) := h1 -+ _ ≤ (1 / (2 * deltaz_t t)) * (C_2 * Real.log |t|) := by -+ apply mul_le_mul_of_nonneg_left h2 -+ apply div_nonneg (by norm_num) -+ apply mul_nonneg (by norm_num) (le_of_lt h_delta_pos) -+ _ = (C_2 / (2 * deltaz_t t)) * Real.log |t| := by ring -+ _ ≤ (C_2 / deltaz_t t) * Real.log |t| := by -+ apply mul_le_mul_of_nonneg_right _ (Real.log_nonneg h_t_ge_one) -+ -+ apply div_le_div_of_nonneg_left (le_of_lt (lt_trans zero_lt_one hC_2_pos)) -+ · exact h_delta_pos -+ · -+ calc deltaz_t t -+ = 1 * deltaz_t t := by rw [one_mul] -+ _ ≤ 2 * deltaz_t t := by -+ apply mul_le_mul_of_nonneg_right (by norm_num : (1 : ℝ) ≤ 2) (le_of_lt h_delta_pos) -+ -+lemma lem_sumKlogt2 : -+ ∃ C_4 > 1, ∀ (t : ℝ) (_ht : |t| > 3), -+ let c := (3/2 : ℂ) + I * t -+ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), -+ ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → -+ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ -+ C_4 * Real.log |t|^2 := by -+ -+ obtain ⟨C_3, hC_3_gt, hC_3⟩ := lem_sumKdeltatlogt -+ -+ use max (100 * C_3 / zerofree_constant) 2 -+ -+ constructor -+ · exact lt_max_of_lt_right (by norm_num : (2 : ℝ) > 1) -+ -+ · intro t ht c hfin z hz -+ -+ have h_bound := hC_3 t ht hfin z hz -+ -+ have h_t_pos : 0 < |t| := by linarith [ht, abs_nonneg t] -+ have h_log_t_pos : 0 < Real.log |t| := Real.log_pos (by linarith [ht] : (1 : ℝ) < |t|) -+ have hC_3_pos : 0 < C_3 := lt_trans zero_lt_one hC_3_gt -+ have h_zerofree_pos : 0 < zerofree_constant := zerofree_constant_pos -+ -+ have h_log_bound : Real.log (|t| + 2) ≤ 2 * Real.log |t| := by -+ have h_ineq : |t| + 2 ≤ 2 * |t| := by linarith [ht] -+ have h_log_ineq := Real.log_le_log (by linarith [abs_nonneg t] : 0 < |t| + 2) h_ineq -+ rw [Real.log_mul (by norm_num) (ne_of_gt h_t_pos)] at h_log_ineq -+ have h_log2_bound : Real.log 2 ≤ Real.log |t| := -+ Real.log_le_log (by norm_num) (by linarith [ht] : (2 : ℝ) ≤ |t|) -+ linarith [h_log_ineq] -+ -+ have h_deltaz_eq : deltaz_t t = (zerofree_constant / 20) / Real.log (|t| + 2) := by -+ simp [deltaz_t, deltaz] -+ -+ have h_main_bound : C_3 / deltaz_t t * Real.log |t| ≤ -+ 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := by -+ -+ rw [h_deltaz_eq] -+ -+ have h_div_rewrite : C_3 / ((zerofree_constant / 20) / Real.log (|t| + 2)) = -+ C_3 * Real.log (|t| + 2) * 20 / zerofree_constant := by -+ field_simp [ne_of_gt h_zerofree_pos, ne_of_gt (Real.log_pos (by linarith [abs_nonneg t] : (1 : ℝ) < |t| + 2))] -+ -+ rw [h_div_rewrite] -+ -+ have h_pos_factor : 0 ≤ C_3 * 20 / zerofree_constant := -+ div_nonneg (mul_nonneg (le_of_lt hC_3_pos) (by norm_num)) (le_of_lt h_zerofree_pos) -+ -+ calc C_3 * Real.log (|t| + 2) * 20 / zerofree_constant * Real.log |t| -+ = C_3 * 20 / zerofree_constant * Real.log (|t| + 2) * Real.log |t| := by ring -+ _ ≤ C_3 * 20 / zerofree_constant * (2 * Real.log |t|) * Real.log |t| := by -+ exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left h_log_bound h_pos_factor) -+ (le_of_lt h_log_t_pos) -+ _ = 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := by simp [pow_two]; ring -+ -+ calc (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) -+ ≤ C_3 / deltaz_t t * Real.log |t| := h_bound -+ _ ≤ 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := h_main_bound -+ _ ≤ max (100 * C_3 / zerofree_constant) 2 * (Real.log |t|)^2 := by -+ have h_factor_bound : 40 * C_3 / zerofree_constant ≤ max (100 * C_3 / zerofree_constant) 2 := by -+ have h_coeff_ineq : 40 * C_3 ≤ 100 * C_3 := by -+ -+ have h_coeff : (40 : ℝ) ≤ 100 := by norm_num -+ exact mul_le_mul_of_nonneg_right h_coeff (le_of_lt hC_3_pos) -+ have h_div_ineq : 40 * C_3 / zerofree_constant ≤ 100 * C_3 / zerofree_constant := by -+ -+ exact div_le_div_of_nonneg_right h_coeff_ineq (le_of_lt h_zerofree_pos) -+ exact le_trans h_div_ineq (le_max_left _ _) -+ exact mul_le_mul_of_nonneg_right h_factor_bound (sq_nonneg _) -+ -+lemma lem_logDerivZetalogt0 : -+ ∃ C > 1, -+ ∀ (t : ℝ) (_ht : |t| > 3), -+ ∀ s : ℂ, (1 - deltaz_t t) ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t → -+ ‖deriv riemannZeta s / riemannZeta s‖ ≤ C * Real.log |t|^2 := by -+ -+ obtain ⟨C_1, hC_1_gt, hC_1⟩ := lem_Zeta_Triangle_ZFR -+ obtain ⟨C_4, hC_4_gt, hC_4⟩ := lem_sumKlogt2 -+ -+ use C_1 + C_4 -+ -+ constructor -+ · -+ linarith [hC_1_gt, hC_4_gt] -+ -+ · -+ intro t ht s hs -+ -+ let c := (3/2 : ℂ) + I * t -+ have hfin := lem_finiteKzeta t ht -+ -+ have h_triangle := hC_1 t ht hfin s hs -+ -+ have h_triangle_ineq := lem_triangle_ZFR t ht s hfin hs -+ -+ have h_sum_bound := hC_4 t ht hfin s hs -+ -+ have h_log_sq_ge : Real.log |t| ≤ Real.log |t|^2 := by -+ have h_log_ge_one : (1 : ℝ) ≤ Real.log |t| := by -+ -+ have h_t_gt_e : Real.exp 1 < |t| := by -+ have h_e_bound : Real.exp 1 < 3 := by -+ -+ simpa using lem_three_gt_e -+ linarith [ht] -+ -+ have h_t_pos : 0 < |t| := by linarith [ht, abs_nonneg t] -+ rw [← Real.log_exp 1] -+ exact Real.log_le_log (Real.exp_pos 1) (le_of_lt h_t_gt_e) -+ have h_log_pos : 0 < Real.log |t| := Real.log_pos (by linarith [ht] : (1 : ℝ) < |t|) -+ rw [pow_two] -+ exact le_mul_of_one_le_right (le_of_lt h_log_pos) h_log_ge_one -+ -+ calc ‖deriv riemannZeta s / riemannZeta s‖ -+ ≤ ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (s - ρ))‖ + C_1 * Real.log |t| := h_triangle -+ _ ≤ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖s - ρ‖) + C_1 * Real.log |t| := by -+ apply add_le_add_left h_triangle_ineq -+ _ ≤ C_4 * Real.log |t|^2 + C_1 * Real.log |t| := by -+ apply add_le_add_left h_sum_bound -+ _ ≤ C_4 * Real.log |t|^2 + C_1 * Real.log |t|^2 := by -+ -+ have h_c1_nonneg : 0 ≤ C_1 := le_of_lt (lt_trans zero_lt_one hC_1_gt) -+ exact add_le_add_right (mul_le_mul_of_nonneg_left h_log_sq_ge h_c1_nonneg) _ -+ _ = (C_4 + C_1) * Real.log |t|^2 := by ring -+ _ = (C_1 + C_4) * Real.log |t|^2 := by ring -+ -+lemma lem_logDerivZetalogt2 : -+ ∃ A: ℝ, A > 0 ∧ A < 1 ∧ -+ ∃ C > 1, -+ ∀ (t : ℝ) (_ht : |t| > 3), -+ ∀ s : ℂ, (1 - A / Real.log (abs t + 2) ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t) → -+ ‖deriv riemannZeta s / riemannZeta s‖ ≤ C * Real.log |t|^2 := by -+ obtain ⟨C, hC_gt, hC_bound⟩ := lem_logDerivZetalogt0 -+ refine ⟨zerofree_constant / 20, ?Apos, ?Alt1, ⟨C, hC_gt, ?_⟩⟩ -+ · -+ exact div_pos zerofree_constant_pos (by norm_num) -+ · -+ have hlt : zerofree_constant / 20 < (1 : ℝ) / 20 := -+ div_lt_div_of_pos_right zerofree_constant_lt_one (by norm_num) -+ have : (1 : ℝ) / 20 < 1 := by norm_num -+ exact lt_trans hlt this -+ · -+ intro t ht s hs -+ have hδ : 1 - deltaz_t t ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t := by -+ simpa [deltaz_t, deltaz, Complex.mul_I_im] using hs -+ exact hC_bound t ht s hδ -+ -+lemma lem_rhoDRe4 : -+ ∀ t : ℝ, ∀ z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t), -+ z.re > 1 - 4 * deltaz_t t := by -+ intro t z hz -+ -+ have h_pos : 0 < deltaz_t t := by -+ -+ have h_log_pos : 0 < Real.log (|t| + 2) := by -+ have h1 : (1 : ℝ) < |t| + 2 := by -+ have : (0 : ℝ) ≤ |t| := abs_nonneg _ -+ linarith -+ exact Real.log_pos h1 -+ have h_num_pos : 0 < zerofree_constant / 20 := by -+ have h20 : 0 < (20 : ℝ) := by norm_num -+ exact div_pos zerofree_constant_pos h20 -+ have : 0 < (zerofree_constant / 20) / Real.log (|t| + 2) := by -+ exact div_pos h_num_pos h_log_pos -+ simpa [deltaz_t, deltaz, Complex.mul_I_im] using this -+ -+ have h_norm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz -+ -+ have re_bound : |(z - (1 - deltaz_t t + t * Complex.I)).re| ≤ 2 * deltaz_t t := -+ (Complex.abs_re_le_norm _).trans h_norm -+ -+ have center_re : (1 - deltaz_t t + t * Complex.I).re = 1 - deltaz_t t := by -+ calc (1 - deltaz_t t + t * Complex.I).re -+ = (1 - deltaz_t t : ℂ).re + (t * Complex.I).re := by rw [Complex.add_re] -+ _ = (1 - deltaz_t t) + (t * Complex.I).re := by simp [Complex.ofReal_re] -+ _ = (1 - deltaz_t t) + 0 := by simp [Complex.mul_re, Complex.I_re] -+ _ = 1 - deltaz_t t := by simp -+ -+ have re_simp : (z - (1 - deltaz_t t + t * Complex.I)).re = z.re - (1 - deltaz_t t) := by -+ rw [Complex.sub_re, center_re] -+ -+ have re_bound' : |z.re - (1 - deltaz_t t)| ≤ 2 * deltaz_t t := by -+ simpa [re_simp] using re_bound -+ -+ have lower_bound : z.re - (1 - deltaz_t t) ≥ -(2 * deltaz_t t) := by -+ have h := (abs_le).1 re_bound' -+ exact h.1 -+ -+ have : z.re ≥ 1 - deltaz_t t - 2 * deltaz_t t := by linarith [lower_bound] -+ have : z.re ≥ 1 - 3 * deltaz_t t := by linarith -+ linarith [h_pos] -+ -+lemma helper_absIm_le_add_smallball (t : ℝ) (z : ℂ) -+ (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : -+ |z.im| ≤ |t| + 2 * deltaz_t t := by -+ -+ have hnorm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz -+ -+ have h_im_diff : |(z - (1 - deltaz_t t + t * Complex.I)).im| ≤ 2 * deltaz_t t := -+ le_trans (Complex.abs_im_le_norm _) hnorm -+ -+ have center_im : (1 - deltaz_t t + t * Complex.I).im = t := by -+ simp [Complex.add_im, Complex.mul_im] -+ -+ have diff_im : (z - (1 - deltaz_t t + t * Complex.I)).im = z.im - t := by -+ simp [Complex.sub_im, center_im] -+ -+ have h_im_sub : |z.im - t| ≤ 2 * deltaz_t t := by -+ simpa [diff_im] using h_im_diff -+ -+ have tri : |z.im| ≤ |z.im - t| + |t| := by -+ simpa [sub_eq_add_neg] using! (abs_add_le (z.im - t) t) -+ -+ have : |z.im - t| + |t| ≤ 2 * deltaz_t t + |t| := add_le_add_left h_im_sub _ -+ have hfinal : |z.im| ≤ 2 * deltaz_t t + |t| := le_trans tri this -+ simpa [add_comm] using hfinal -+ -+lemma helper_log_le_two_log_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) -+ (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : -+ Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by -+ -+ have h_abs : |z.im| ≤ |t| + 2 * deltaz_t t := -+ helper_absIm_le_add_smallball t z hz -+ -+ set a : ℝ := |t| + 2 -+ have h1 : |z.im| + 2 ≤ a + 2 * deltaz_t t := by -+ have := add_le_add_left h_abs (2 : ℝ) -+ simpa [a, add_comm, add_left_comm, add_assoc] using this -+ -+ have ht2 : |t| > 2 := by linarith -+ have hδ : 0 < deltaz_t t ∧ deltaz_t t < 1 / 9 := (lem_delta19).2 t ht2 -+ have hδlt : deltaz_t t < 1 / 9 := hδ.2 -+ -+ have h_two_delta_le_one : 2 * deltaz_t t ≤ 1 := by -+ have hle : deltaz_t t ≤ 1 / 9 := le_of_lt hδlt -+ have hmul : 2 * deltaz_t t ≤ 2 * (1 / 9 : ℝ) := -+ mul_le_mul_of_nonneg_left hle (by norm_num) -+ have : 2 * (1 / 9 : ℝ) ≤ 1 := by norm_num -+ exact le_trans hmul this -+ have h2 : a + 2 * deltaz_t t ≤ a + 1 := add_le_add_right h_two_delta_le_one a -+ -+ have ha_ge_two : (2 : ℝ) ≤ a := by -+ have : 0 ≤ |t| := abs_nonneg t -+ linarith [this] -+ have ha_ge_one : (1 : ℝ) ≤ a := le_trans (by norm_num) ha_ge_two -+ have h_a_plus_one_le_two_a : a + 1 ≤ a + a := by -+ simpa using add_le_add_right ha_ge_one a -+ have h_nonneg_a : 0 ≤ a := le_trans (by norm_num) ha_ge_two -+ have h_2a_le_a2 : (2 : ℝ) * a ≤ a ^ 2 := by -+ have : (2 : ℝ) * a ≤ a * a := mul_le_mul_of_nonneg_right ha_ge_two h_nonneg_a -+ simpa [pow_two] using this -+ have h_a1_le_a2 : a + 1 ≤ a ^ 2 := -+ le_trans h_a_plus_one_le_two_a (by simpa [two_mul] using h_2a_le_a2) -+ -+ have h_total : |z.im| + 2 ≤ a ^ 2 := le_trans (le_trans h1 h2) h_a1_le_a2 -+ -+ have hxpos : 0 < |z.im| + 2 := by -+ have : 0 ≤ |z.im| := abs_nonneg _ -+ linarith -+ have hlog := Real.log_le_log hxpos h_total -+ calc -+ Real.log (|z.im| + 2) ≤ Real.log (a ^ 2) := hlog -+ _ = (2 : ℝ) * Real.log a := by simp -+ _ = 2 * Real.log (|t| + 2) := by simp [a] -+ -+lemma helper_one_div_log_le_two_div_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) -+ (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : -+ (1 : ℝ) / Real.log (|t| + 2) ≤ 2 / Real.log (|z.im| + 2) := by -+ -+ have ht_pos1 : 1 < |t| + 2 := by linarith [abs_nonneg t] -+ have hz_pos1 : 1 < |z.im| + 2 := by linarith [abs_nonneg z.im] -+ have log_t_pos : 0 < Real.log (|t| + 2) := Real.log_pos ht_pos1 -+ have log_z_pos : 0 < Real.log (|z.im| + 2) := Real.log_pos hz_pos1 -+ -+ have h_norm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz -+ have center_im : (1 - deltaz_t t + t * Complex.I).im = t := by -+ simp [Complex.add_im] -+ have diff_im : (z - (1 - deltaz_t t + t * Complex.I)).im = z.im - t := by -+ simp [Complex.sub_im, center_im] -+ have h1 : |z.im - t| ≤ ‖z - (1 - deltaz_t t + t * Complex.I)‖ := by -+ simpa [diff_im] using Complex.abs_im_le_norm (z - (1 - deltaz_t t + t * Complex.I)) -+ have h2 : |z.im - t| ≤ 2 * deltaz_t t := h1.trans h_norm -+ have hz_im_le : |z.im| ≤ |z.im - t| + |t| := by -+ -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using! abs_add_le (z.im - t) t -+ have hz_im_le2 : |z.im| ≤ 2 * deltaz_t t + |t| := hz_im_le.trans (add_le_add_left h2 _) -+ have hz_add2_le1 : |z.im| + 2 ≤ (2 * deltaz_t t + |t|) + 2 := add_le_add_left hz_im_le2 2 -+ -+ have hdelta_lt_one : deltaz_t t < 1 := by -+ have hlt19 : deltaz_t t < 1 / 9 := -+ ((lem_delta19).2 t (by linarith : |t| > 2)).2 -+ exact lt_trans hlt19 (by norm_num) -+ have h2delta_le_two : 2 * deltaz_t t ≤ 2 := by -+ have hle : deltaz_t t ≤ 1 := le_of_lt hdelta_lt_one -+ have := mul_le_mul_of_nonneg_left hle (by norm_num : (0 : ℝ) ≤ 2) -+ simpa using this -+ have htwo_le : (2 : ℝ) ≤ |t| + 2 := by linarith [abs_nonneg t] -+ have h2delta_le_tplus2 : 2 * deltaz_t t ≤ |t| + 2 := le_trans h2delta_le_two htwo_le -+ have step_mid : (2 * deltaz_t t + |t|) + 2 ≤ ((|t| + 2) + |t|) + 2 := by -+ have := add_le_add_left (add_le_add_left h2delta_le_tplus2 |t|) 2 -+ simpa [add_comm, add_left_comm, add_assoc] using this -+ have hz_plus2_le : |z.im| + 2 ≤ (|t| + 2) + |t| + 2 := le_trans hz_add2_le1 step_mid -+ have hz_im_bound_final : |z.im| + 2 ≤ 2 * (|t| + 2) := by -+ -+ simpa [two_mul, add_comm, add_left_comm, add_assoc] using hz_plus2_le -+ -+ have hxpos : 0 < |z.im| + 2 := by linarith [abs_nonneg z.im] -+ have hlog_step : Real.log (|z.im| + 2) ≤ Real.log (2 * (|t| + 2)) := -+ Real.log_le_log hxpos hz_im_bound_final -+ have hlog_mul : Real.log (2 * (|t| + 2)) = Real.log 2 + Real.log (|t| + 2) := by -+ have hneet : (|t| + 2) ≠ 0 := ne_of_gt (lt_trans (by norm_num) ht_pos1) -+ simpa using Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) hneet -+ have hlog2_le_logt : Real.log 2 ≤ Real.log (|t| + 2) := by -+ have h2lt : 0 < (2 : ℝ) := by norm_num -+ have h2le : (2 : ℝ) ≤ |t| + 2 := by linarith [abs_nonneg t] -+ exact Real.log_le_log h2lt h2le -+ have hlog_le_two : Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by -+ have : Real.log (|z.im| + 2) ≤ Real.log 2 + Real.log (|t| + 2) := by -+ simpa [hlog_mul] using hlog_step -+ have : Real.log (|z.im| + 2) ≤ Real.log (|t| + 2) + Real.log (|t| + 2) := -+ this.trans (add_le_add_left hlog2_le_logt _) -+ simpa [two_mul] using this -+ -+ have h' : 1 * Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by -+ simpa [one_mul] using hlog_le_two -+ simpa [one_mul] using (div_le_div_iff₀ log_t_pos log_z_pos).mpr h' -+ -+lemma helper_deltaz_t_le_two_deltaz_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) -+ (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : -+ deltaz_t t ≤ 2 * deltaz z := by -+ -+ have h_recip := helper_one_div_log_le_two_div_smallball t ht z hz -+ -+ have hpos_const : 0 ≤ zerofree_constant / 20 := by -+ have hpos : 0 < zerofree_constant := zerofree_constant_pos -+ have h20 : 0 < (20 : ℝ) := by norm_num -+ exact div_nonneg (le_of_lt hpos) (le_of_lt h20) -+ -+ have h_mul := mul_le_mul_of_nonneg_left h_recip hpos_const -+ -+ calc -+ deltaz_t t -+ = (zerofree_constant / 20) / Real.log (|t| + 2) := by -+ simp [deltaz_t, deltaz] -+ _ = (zerofree_constant / 20) * (1 / Real.log (|t| + 2)) := by -+ simp [div_eq_mul_inv] -+ _ ≤ (zerofree_constant / 20) * (2 / Real.log (|z.im| + 2)) := by -+ simpa [one_div, div_eq_mul_inv] using h_mul -+ _ = 2 * ((zerofree_constant / 20) * (1 / Real.log (|z.im| + 2))) := by -+ ring -+ _ = 2 * deltaz z := by -+ simp [deltaz, div_eq_mul_inv] -+ -+lemma lem_DRez6dz : -+ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t), -+ z.re ≥ 1 - 6 * deltaz z := by -+ intro t ht z hz -+ -+ have h_ball : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by -+ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz -+ -+ have h_re_absle : |(z - (1 - deltaz_t t + t * Complex.I)).re| ≤ 2 * deltaz_t t := -+ (Complex.abs_re_le_norm _).trans h_ball -+ have h_re_absle' : |z.re - (1 - deltaz_t t)| ≤ 2 * deltaz_t t := by -+ simpa [Complex.sub_re] using h_re_absle -+ -+ have h_lower : z.re - (1 - deltaz_t t) ≥ -(2 * deltaz_t t) := by -+ have := (abs_le).1 h_re_absle' -+ exact this.1 -+ -+ have h3 : z.re ≥ 1 - 3 * deltaz_t t := by -+ linarith -+ -+ have h_dt_le : deltaz_t t ≤ 2 * deltaz z := -+ helper_deltaz_t_le_two_deltaz_smallball t ht z hz -+ -+ have h_mult : 3 * deltaz_t t ≤ 6 * deltaz z := by -+ have h := mul_le_mul_of_nonneg_left h_dt_le (by norm_num : (0 : ℝ) ≤ 3) -+ calc -+ 3 * deltaz_t t ≤ 3 * (2 * deltaz z) := h -+ _ = 6 * deltaz z := by ring -+ -+ have h_final : 1 - 3 * deltaz_t t ≥ 1 - 6 * deltaz z := by -+ linarith [h_mult] -+ -+ exact le_trans h_final h3 -+ -+lemma lem_YinD : -+ ∀ t : ℝ, |t| > 3 → -+ Yt t (deltaz_t t) ⊆ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t) := by -+ intro t ht z hz -+ rcases hz with ⟨hzero, habs⟩ -+ have hdist : dist z (1 - deltaz_t t + t * Complex.I) ≤ 2 * deltaz_t t := by -+ simpa [Complex.dist_eq] using habs -+ exact Metric.mem_closedBall.mpr hdist -+ -+theorem lem_rhoYzero (t : ℝ) (δ : ℝ) (ρ_1 : ℂ) (h_rho_1_in_Yt : ρ_1 ∈ Yt t δ) : -+ riemannZeta ρ_1 = 0 := by -+ -+ unfold Yt at h_rho_1_in_Yt -+ -+ exact h_rho_1_in_Yt.1 -+ -+theorem lem_absReabs (w : ℂ) : |w.re| ≤ ‖w‖ := by -+ exact Complex.abs_re_le_norm w -+ -+theorem lem_zRe (t : ℝ) (δ : ℝ) (z : ℂ) : |(z - (1 - δ + t * Complex.I)).re| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := by -+ apply lem_absReabs -+ -+theorem lem_zRe2 (t : ℝ) (δ : ℝ) (z : ℂ) -+ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : -+ |(z - (1 - δ + t * Complex.I)).re| ≤ 2 * δ := by -+ have h1 : |(z - (1 - δ + t * Complex.I)).re| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := lem_zRe t δ z -+ exact le_trans h1 h_le -+ -+theorem lem_Rezit (t : ℝ) (δ : ℝ) (z : ℂ) : -+ (z - (1 - δ + t * Complex.I)).re = z.re - (1 - δ) := by -+ rw [Complex.sub_re] -+ -+ rw [Complex.add_re] -+ -+ rw [Complex.sub_re, Complex.one_re, Complex.ofReal_re] -+ -+ rw [Complex.mul_re, Complex.I_re, Complex.I_im, Complex.ofReal_im] -+ -+ simp -+ -+theorem lem_zRe3 (t : ℝ) (δ : ℝ) (z : ℂ) -+ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : -+ |z.re - (1 - δ)| ≤ 2 * δ := by -+ -+ have h1 : |(z - (1 - δ + t * Complex.I)).re| ≤ 2 * δ := -+ lem_zRe2 t δ z h_le -+ -+ have hRe : (z - (1 - δ + t * Complex.I)).re = z.re - (1 - δ) := -+ lem_Rezit t δ z -+ simpa [hRe] using h1 -+ -+theorem lem_negleabs (a : ℝ) (b : ℝ) (h_abs : |a| ≤ b) : a ≥ -b := by -+ rw [abs_le] at h_abs -+ exact h_abs.1 -+ -+theorem lem_absrez1d (δ : ℝ) (z : ℂ) -+ (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : -+ z.re - (1 - δ) ≥ - (2 * δ) := by -+ exact lem_negleabs (z.re - (1 - δ)) (2 * δ) h_le -+ -+theorem lem_absrez1d2 (δ : ℝ) (z : ℂ) -+ (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : -+ z.re ≥ 1 - 3 * δ := by -+ -+ have hneg : z.re - (1 - δ) ≥ - (2 * δ) := -+ lem_absrez1d δ z h_le -+ -+ have : z.re ≥ 1 - δ - 2 * δ := by linarith -+ -+ convert this using 1 -+ ring -+theorem lem_absrez1d3 (δ : ℝ) (z : ℂ) (hδ : δ > 0) -+ (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : -+ z.re > 1 - 4 * δ := by -+ have h1 : z.re ≥ 1 - 3 * δ := lem_absrez1d2 δ z h_le -+ linarith [h1, hδ] -+ -+theorem lem_zRe4 (t : ℝ) (δ : ℝ) (hδ : δ > 0) (z : ℂ) -+ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : -+ z.re > 1 - 4 * δ := by -+ have h1 : |z.re - (1 - δ)| ≤ 2 * δ := lem_zRe3 t δ z h_le -+ exact lem_absrez1d3 δ z hδ h1 -+ -+lemma riemannZeta_no_zeros_left_halfplane_off_real_axis (s : ℂ) (h_re : s.re ≤ 0) (h_im : s.im ≠ 0) : riemannZeta s ≠ 0 := by -+ -+ intro h_zero -+ -+ have hs_not_neg_nat : ∀ n : ℕ, s ≠ -n := by -+ intro n h_eq -+ -+ have : s.im = 0 := by -+ rw [h_eq] -+ rw [Complex.neg_im] -+ simp -+ exact h_im this -+ -+ have hs_not_one : s ≠ 1 := by -+ intro h_eq -+ -+ have : s.re = 1 := by -+ rw [h_eq] -+ exact Complex.one_re -+ linarith [h_re, this] -+ -+ have functional_eq := riemannZeta_one_sub hs_not_neg_nat hs_not_one -+ -+ rw [h_zero] at functional_eq -+ simp at functional_eq -+ -+ have h1s_re_ge_1 : (1 - s).re ≥ 1 := by -+ rw [Complex.sub_re, Complex.one_re] -+ linarith [h_re] -+ -+ have h1s_nonzero : riemannZeta (1 - s) ≠ 0 := by -+ apply riemannZeta_ne_zero_of_one_le_re -+ exact h1s_re_ge_1 -+ -+ exact h1s_nonzero functional_eq -+ -+lemma lem_Imzit (t : ℝ) (δ : ℝ) (z : ℂ) : -+ (z - (1 - δ + t * Complex.I)).im = z.im - t := by -+ have him : (1 - δ + t * Complex.I).im = t := by -+ simp [Complex.add_im, Complex.mul_im] -+ simp [Complex.sub_im, him] -+ -+lemma lem_zIm2 (t : ℝ) (δ : ℝ) (z : ℂ) -+ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : -+ |(z - (1 - δ + t * Complex.I)).im| ≤ 2 * δ := by -+ have : |(z - (1 - δ + t * Complex.I)).im| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := -+ Complex.abs_im_le_norm (z - (1 - δ + t * Complex.I)) -+ exact le_trans this h_le -+ -+lemma lem_zIm3 (t : ℝ) (δ : ℝ) (z : ℂ) -+ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : -+ |z.im - t| ≤ 2 * δ := by -+ have h1 : |(z - (1 - δ + t * Complex.I)).im| ≤ 2 * δ := -+ lem_zIm2 t δ z h_le -+ have him : (z - (1 - δ + t * Complex.I)).im = z.im - t := -+ lem_Imzit t δ z -+ simpa [him] using h1 -+ -+lemma abs_le_add_of_abs_sub_le {a b ε : ℝ} (h : |a - b| ≤ ε) : -+ |a| ≤ |b| + ε := by -+ calc -+ |a| = |b + (a - b)| := by -+ simp [sub_eq_add_neg, add_left_comm] -+ _ ≤ |b| + |a - b| := by -+ simpa [sub_eq_add_neg] using! abs_add_le b (a - b) -+ _ ≤ |b| + ε := by -+ exact add_le_add_right h _ -+ -+lemma log_add_lt_log_add_div {x y : ℝ} (hx : 0 < x) (hy : 0 < y) : -+ Real.log (x + y) < Real.log x + y / x := by -+ have hxne : x ≠ 0 := ne_of_gt hx -+ have hxy_pos : 0 < x + y := add_pos hx hy -+ have hxy_ne : x + y ≠ 0 := ne_of_gt hxy_pos -+ have hy_div_pos : 0 < y / x := div_pos hy hx -+ have hdiv_eq : (x + y) / x = 1 + y / x := by -+ have : (x + y) / x = x / x + y / x := by simp [add_div] -+ simpa [div_self hxne] using this -+ have hgt1 : 1 < (x + y) / x := by -+ have : 1 < 1 + y / x := by linarith [hy_div_pos] -+ simpa [hdiv_eq] using this -+ have hposu : 0 < (x + y) / x := lt_trans zero_lt_one hgt1 -+ have hne1 : (x + y) / x ≠ 1 := ne_of_gt hgt1 -+ have hloglt : Real.log ((x + y) / x) < (x + y) / x - 1 := -+ Real.log_lt_sub_one_of_pos hposu hne1 -+ have hrhs : (x + y) / x - 1 = y / x := by -+ have : (1 + y / x) - 1 = y / x := by -+ simp -+ simp [hdiv_eq] -+ have hldiv : Real.log ((x + y) / x) = Real.log (x + y) - Real.log x := -+ Real.log_div hxy_ne hxne -+ have hcore : Real.log (x + y) - Real.log x < y / x := by -+ simpa [hldiv, hrhs] using hloglt -+ have := add_lt_add_left hcore (Real.log x) -+ simpa [sub_add_cancel, add_comm, add_left_comm, add_assoc] using this -+ -+lemma abs_le_add_of_abs_sub_le' {a b ε : ℝ} (h : |a - b| ≤ ε) : -+ |a| ≤ |b| + ε := by -+ calc -+ |a| = |b + (a - b)| := by -+ simp [sub_eq_add_neg, add_left_comm] -+ _ ≤ |b| + |a - b| := by -+ simpa [sub_eq_add_neg] using! abs_add_le b (a - b) -+ _ ≤ |b| + ε := by -+ exact add_le_add_right h _ -+ -+lemma delta_half_eq (c t : ℝ) : -+ ((c / 2) / Real.log (|t| + 2)) / 2 = (c / 4) / Real.log (|t| + 2) := by -+ -+ have hx : -+ ((c * (1 / 2)) * ((Real.log (|t| + 2))⁻¹)) * (1 / 2) -+ = (c * (1 / 4)) * ((Real.log (|t| + 2))⁻¹) := by -+ ring -+ simpa [div_eq_mul_inv] using hx -+ -+lemma log_abs_im_le (t t1 δ : ℝ) (h : |t1 - t| ≤ δ) : -+ Real.log (|t1| + 2) ≤ Real.log (|t| + 2) + δ / (|t| + 2) := by -+ -+ have hx1pos : 0 < |t1| + 2 := by -+ have : (0 : ℝ) ≤ |t1| := abs_nonneg t1 -+ linarith -+ have hxpos : 0 < |t| + 2 := by -+ have : (0 : ℝ) ≤ |t| := abs_nonneg t -+ linarith -+ have hxnonneg : 0 ≤ |t| + 2 := le_of_lt hxpos -+ -+ have habs : |t1| ≤ |t| + |t1 - t| := by -+ have htri : |(t1 - t) + t| ≤ |t1 - t| + |t| := abs_add_le (t1 - t) t -+ simpa [sub_add_cancel, add_comm] using htri -+ -+ have hxy : |t1| + 2 ≤ (|t| + 2) + |t1 - t| := by -+ have := add_le_add_left habs 2 -+ simpa [add_comm, add_left_comm, add_assoc] using this -+ -+ have hlog1 : Real.log (|t1| + 2) ≤ Real.log ((|t| + 2) + |t1 - t|) := -+ Real.log_le_log hx1pos hxy -+ -+ have hy_nonneg : 0 ≤ |t1 - t| := abs_nonneg (t1 - t) -+ have hlog2 : Real.log ((|t| + 2) + |t1 - t|) -+ ≤ Real.log (|t| + 2) + |t1 - t| / (|t| + 2) := by -+ by_cases hpos : 0 < |t1 - t| -+ · exact le_of_lt (log_add_lt_log_add_div hxpos hpos) -+ · have heq : |t1 - t| = 0 := le_antisymm (le_of_not_gt hpos) hy_nonneg -+ have : Real.log (|t| + 2) ≤ Real.log (|t| + 2) := le_rfl -+ simp [heq] -+ -+ have hdiv : |t1 - t| / (|t| + 2) ≤ δ / (|t| + 2) := -+ div_le_div_of_nonneg_right h hxnonneg -+ have hadd := add_le_add_right hdiv (Real.log (|t| + 2)) -+ exact le_trans (le_trans hlog1 hlog2) hadd -+ -+lemma combine_re_bounds_to_c_over_log_le {ρre c δ L1 : ℝ} -+ (h_ge : ρre ≥ 1 - (3 / 2) * δ) (h_le : ρre ≤ 1 - c / L1) : -+ c / L1 ≤ (3 / 2) * δ := by -+ -+ have h : 1 - (3 / 2) * δ ≤ 1 - c / L1 := le_trans h_ge h_le -+ -+ have h' := sub_le_sub_right h (1 : ℝ) -+ -+ have h'' : -((3 / 2) * δ) ≤ -(c / L1) := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h' -+ -+ simpa using (neg_le_neg_iff.mp h'') -+ -+lemma core_contradiction2 {L t c δ : ℝ} -+ (hLpos : 0 < L) (hpos : 0 < |t| + 2) -+ (hδ : δ = (c / 2) / L) -+ (h : L ≤ (3 / 2) * δ / (|t| + 2)) : -+ L ^ 2 * (|t| + 2) ≤ 3 * c / 4 := by -+ -+ have h1' := (mul_le_mul_of_nonneg_right h (le_of_lt hpos)) -+ -+ have hbne : (|t| + 2) ≠ 0 := ne_of_gt hpos -+ have rhs_eq : ((3 / 2) * δ / (|t| + 2)) * (|t| + 2) = (3 / 2) * δ := by -+ calc -+ ((3 / 2) * δ / (|t| + 2)) * (|t| + 2) -+ = ((3 / 2) * δ) * ((1 / (|t| + 2)) * (|t| + 2)) := by -+ simp [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] -+ _ = ((3 / 2) * δ) * 1 := by -+ simp [hbne] -+ _ = (3 / 2) * δ := by -+ ring -+ have h1 : L * (|t| + 2) ≤ (3 / 2) * δ := by -+ simpa [rhs_eq] using h1' -+ -+ have h2 := (mul_le_mul_of_nonneg_left h1 (le_of_lt hLpos)) -+ have h3 : L ^ 2 * (|t| + 2) ≤ (3 / 2) * (δ * L) := by -+ simpa [pow_two, mul_left_comm, mul_assoc, mul_comm] using h2 -+ -+ have hLne : L ≠ 0 := ne_of_gt hLpos -+ have hδL : δ * L = c / 2 := by -+ calc -+ δ * L = ((c / 2) / L) * L := by simp [hδ] -+ _ = (c / 2) * ((L⁻¹) * L) := by -+ simp [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] -+ _ = (c / 2) * 1 := by -+ simp [hLne] -+ _ = c / 2 := by simp -+ have h4 : L ^ 2 * (|t| + 2) ≤ (3 / 2) * (c / 2) := by -+ simpa [hδL] using h3 -+ -+ have h5 : (3 / 2 : ℝ) * (c / 2) = 3 * c / 4 := by -+ ring -+ simpa [h5] using h4 -+ -+lemma abs_lower_bound_sub (x y : ℝ) : |x| ≥ |y| - |x - y| := by -+ -+ have h' : |y| ≤ |x| + |y - x| := by -+ have htriv : |y - x| ≤ |y - x| := le_rfl -+ simpa [sub_eq_add_neg] using -+ (abs_le_add_of_abs_sub_le' (a := y) (b := x) (ε := |y - x|) htriv) -+ -+ have h1 : |y| ≤ |x| + |x - y| := by simpa [abs_sub_comm] using h' -+ -+ simpa [ge_iff_le] using (sub_le_iff_le_add).2 h1 -+ -+lemma abs_im_ge_T0_from_close {t : ℝ} {ρ : ℂ} {δ T0 : ℝ} -+ (hclose : |ρ.im - t| ≤ 2 * δ) (hineq : |t| - 2 * δ ≥ T0) : -+ T0 ≤ |ρ.im| := by -+ have h1 : |ρ.im| ≥ |t| - |ρ.im - t| := by -+ simpa [sub_eq_add_neg, abs_sub_comm] using (abs_lower_bound_sub ρ.im t) -+ have : |ρ.im| ≥ |t| - 2 * δ := by -+ exact ge_trans h1 (by -+ -+ gcongr) -+ exact le_trans hineq this -+ -+lemma lem_Kzetaempty : -+ ∀ t : ℝ, |t| > 3 → -+ Yt t (deltaz_t t) = ∅ := by -+ intro t ht -+ -+ rw [Set.eq_empty_iff_forall_notMem] -+ intro ρ_1 h_mem -+ -+ have h_zero : riemannZeta ρ_1 = 0 := lem_rhoYzero t (deltaz_t t) ρ_1 h_mem -+ -+ have h_norm : ‖ρ_1 - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by -+ exact h_mem.2 -+ -+ have h_im_bound : |ρ_1.im - t| ≤ 2 * deltaz_t t := by -+ exact lem_zIm3 t (deltaz_t t) ρ_1 h_norm -+ -+ have h_delta_small : deltaz_t t < 1/9 := by -+ have h_bounds := lem_delta19 -+ exact (h_bounds.2 t (by linarith [ht])).2 -+ -+ have h_im_large : 2 < |ρ_1.im| := by -+ -+ have h_tri : |ρ_1.im| ≥ |t| - |ρ_1.im - t| := by -+ exact abs_lower_bound_sub ρ_1.im t -+ have h_bound : |ρ_1.im| ≥ |t| - 2 * deltaz_t t := by -+ exact ge_trans h_tri (by gcongr) -+ have h_small_delta : 2 * deltaz_t t < 2/9 := by -+ linarith [h_delta_small] -+ have h_final : |t| - 2 * deltaz_t t > 3 - 2/9 := by -+ linarith [ht, h_small_delta] -+ have h_gt_2 : 3 - 2/9 > 2 := by norm_num -+ linarith [h_bound, h_final, h_gt_2] -+ -+ have h_in_ball : ρ_1 ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t) := by -+ exact Metric.mem_closedBall.mpr (by simpa only [dist_eq_norm] using! h_norm) -+ -+ have h_re_bound : ρ_1.re ≥ 1 - 6 * deltaz ρ_1 := by -+ exact lem_DRez6dz t ht ρ_1 h_in_ball -+ -+ have h_delta_pos : 0 < deltaz ρ_1 := by -+ have h_bounds := lem_delta19 -+ exact (h_bounds.1 ρ_1 (by linarith [h_im_large])).1 -+ -+ have h_re_strict : ρ_1.re > 1 - 9 * deltaz ρ_1 := by -+ linarith [h_re_bound, h_delta_pos] -+ -+ have h_nonzero : riemannZeta ρ_1 ≠ 0 := by -+ exact lem_ZFRdelta ρ_1 h_im_large h_re_strict -+ -+ exact h_nonzero h_zero -+ -+lemma Yt_subset_closedBall (t : ℝ) (δ : ℝ) : -+ Yt t δ ⊆ Metric.closedBall (1 - δ + t * Complex.I) (2 * δ) := by -+ -+ intro ρ_1 hρ_1 -+ -+ unfold Yt at hρ_1 -+ -+ obtain ⟨_, h_abs⟩ := hρ_1 -+ -+ rw [Metric.mem_closedBall] -+ -+ rw [Complex.dist_eq] -+ -+ exact h_abs -+ -+lemma Yt_finite (t : ℝ) (δ : ℝ) : (Yt t δ).Finite := by -+ -+ have h_subset := Yt_subset_closedBall t δ -+ -+ let K := Metric.closedBall (1 - δ + t * Complex.I) (2 * δ) -+ have h_compact : IsCompact K := closedBall_compact_complex (1 - δ + t * Complex.I) (2 * δ) -+ -+ have h_zeros_finite := riemannZeta_zeros_finite_of_compact K h_compact -+ -+ have h_sub : Yt t δ ⊆ {z ∈ K | riemannZeta z = 0} := by -+ intro ρ hρ -+ -+ constructor -+ · -+ exact h_subset hρ -+ · -+ unfold Yt at hρ -+ exact hρ.1 -+ -+ exact Set.Finite.subset h_zeros_finite h_sub -+ -+lemma lem_sumempty (g : ℂ → ℂ) : (∑ s ∈ (∅ : Finset ℂ), g s) = 0 := by -+ rfl -+ -+lemma lem_Ksumempty : -+ ∀ t : ℝ, |t| > 3 → -+ (∑ ρ_1 ∈ (Yt_finite t (deltaz_t t)).toFinset, ((analyticOrderAt riemannZeta ρ_1).toNat : ℂ) / (1 - (deltaz_t t) + t * Complex.I - ρ_1)) = 0 := by -+ intro t ht -+ -+ have h_empty : Yt t (deltaz_t t) = ∅ := lem_Kzetaempty t ht -+ -+ have h_finset_empty : (Yt_finite t (deltaz_t t)).toFinset = ∅ := by -+ rw [Set.Finite.toFinset_eq_empty] -+ exact h_empty -+ -+ rw [h_finset_empty] -+ exact lem_sumempty _ -+ -+lemma norm_div_cast_vonMangoldt (s : ℂ) : -+ (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) -+ = (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by -+ funext n -+ simp [Complex.norm_real, Real.norm_eq_abs] -+ -+lemma ArithmeticFunction.summable_vonMangoldt_norm_rw {s : ℂ} : -+ Summable (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) -+ ↔ Summable (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by -+ classical -+ have hfun : -+ (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) -+ = (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by -+ funext n -+ simp [Complex.norm_real, div_eq_mul_inv] -+ simp -+ -+lemma lem_norm_cpow_nat (n : ℕ) (s : ℂ) (hn : 1 ≤ n) : ‖(n : ℂ) ^ s‖ = (n : ℝ) ^ s.re := by -+ have hpos : 0 < (n : ℝ) := -+ lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (by exact_mod_cast hn) -+ simpa using (Complex.norm_cpow_eq_rpow_re_of_pos (x := (n : ℝ)) hpos s) -+ -+lemma lem_vonMangoldt_nonneg (n : ℕ) : 0 ≤ (ArithmeticFunction.vonMangoldt n) := by -+ simp -+ -+lemma lem_term_real_nonneg (n : ℕ) (σ : ℝ) (_hσ : 1 < σ) : ∃ r ≥ (0:ℝ), ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = (r : ℂ) := by -+ -+ let r : ℝ := (ArithmeticFunction.vonMangoldt n) / ((n : ℝ) ^ σ) -+ refine ⟨r, ?_, ?_⟩ -+ · -+ have hbase_nonneg : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) -+ have hden_nonneg : 0 ≤ (n : ℝ) ^ σ := by -+ simpa using (Real.rpow_nonneg hbase_nonneg σ) -+ -+ have hv_nonneg : 0 ≤ (ArithmeticFunction.vonMangoldt n) := by -+ simp -+ have : 0 ≤ (ArithmeticFunction.vonMangoldt n) * ((n : ℝ) ^ σ)⁻¹ := -+ mul_nonneg hv_nonneg (inv_nonneg.mpr hden_nonneg) -+ simpa [r, div_eq_mul_inv] using this -+ · -+ have hbase_nonneg : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) -+ have hden_eq : (((n : ℝ) ^ σ : ℝ) : ℂ) = (n : ℂ) ^ (σ : ℂ) := by -+ simpa using (Complex.ofReal_cpow (x := (n : ℝ)) (hx := hbase_nonneg) (y := σ)) -+ calc -+ ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) -+ = ((ArithmeticFunction.vonMangoldt n : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) := by -+ simp [hden_eq.symm] -+ _ = (((ArithmeticFunction.vonMangoldt n : ℝ) / ((n : ℝ) ^ σ)) : ℝ) := by -+ simp -+ _ = (r : ℂ) := by rfl -+ -+lemma lem_tsum_norm_vonMangoldt_depends_on_Re (s : ℂ) (σ : ℝ) (hσ : σ = s.re) (_hs : 1 < s.re) : -+ (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) = -+ (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by -+ classical -+ -+ have hfun : (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) -+ = (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by -+ funext n -+ by_cases h0 : n = 0 -+ · -+ subst h0 -+ simp [ArithmeticFunction.vonMangoldt] -+ simp only [_root_.ite_eq_right (not_isPrimePow_zero (R := ℕ)), abs_zero, zero_div] -+ · -+ have hn0C : (n : ℂ) ≠ 0 := by -+ exact_mod_cast (Nat.cast_ne_zero.mpr h0) -+ have harg : Complex.arg (n : ℂ) = 0 := by -+ have : (0 : ℝ) ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) -+ simp -+ -+ have hden_s : ‖(n : ℂ) ^ s‖ = ‖(n : ℂ)‖ ^ s.re := by -+ -+ simpa [harg, Real.exp_zero, div_one] using -+ (Complex.norm_cpow_of_ne_zero (z := (n : ℂ)) (w := s) hn0C) -+ have hden_σ : ‖(n : ℂ) ^ (σ : ℂ)‖ = ‖(n : ℂ)‖ ^ σ := by -+ simp -+ -+ simp [hden_s, hσ] -+ -+ have htsum := congrArg (fun f : ℕ → ℝ => (∑' n, f n)) hfun -+ simpa using htsum -+ -+lemma helper_LSeries_vonMangoldt_tsum (σ : ℝ) (hσ : 1 < σ) : -+ (∑' n : ℕ, (ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = -+ - deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ) := by -+ have hs : 1 < (σ : ℂ).re := by simpa using hσ -+ have h0 : ((fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ)) 0) = 0 := by simp -+ simpa [LSeries, LSeries.term_def₀ (f := fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ)) h0, -+ Complex.cpow_neg, div_eq_mul_inv] using -+ (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := (σ : ℂ)) hs) -+ -+lemma summable_ofReal_iff {f : ℕ → ℝ} : Summable (fun n => (f n : ℂ)) ↔ Summable f := by -+ simp -+ -+lemma helper_summable_of_summable_norm {u : ℕ → ℂ} -+ (h : Summable (fun n => ‖u n‖)) : Summable u := by -+ simpa using (Summable.of_norm (f := u) h) -+ -+lemma helper_norm_tsum_eq_tsum_norm_of_nonneg_real {u : ℕ → ℂ} {r : ℕ → ℝ} -+ (h : ∀ n, u n = (r n : ℂ)) (hr : ∀ n, 0 ≤ r n) (_hu : Summable u) : -+ ‖(∑' n, u n)‖ = ∑' n, ‖u n‖ := by -+ classical -+ -+ have hsum_eq_ofReal : (∑' n, (r n : ℂ)) = ((∑' n, r n : ℝ) : ℂ) := by -+ simpa using (Complex.ofReal_tsum r).symm -+ have hrewrite_u : ‖∑' n, u n‖ = ‖∑' n, (r n : ℂ)‖ := by -+ have hfun : u = (fun n => (r n : ℂ)) := funext h -+ simp [hfun] -+ have hnorm_abs : ‖((∑' n, r n : ℝ) : ℂ)‖ = |∑' n, r n| := by -+ simp [Real.norm_eq_abs] -+ -+ have hLHS : ‖∑' n, u n‖ = |∑' n, r n| := by -+ simp [hrewrite_u, hsum_eq_ofReal] -+ -+ have hsum_nonneg : 0 ≤ ∑' n, r n := tsum_nonneg hr -+ have habs_sum : |∑' n, r n| = ∑' n, r n := abs_of_nonneg hsum_nonneg -+ -+ have hfunEq : (fun n => ‖u n‖) = (fun n => ‖(r n : ℂ)‖) := by -+ funext n; simp [h n] -+ have hfunEq2 : (fun n => ‖(r n : ℂ)‖) = (fun n => r n) := by -+ funext n -+ have : ‖(r n : ℂ)‖ = ‖r n‖ := by simp -+ have : ‖r n‖ = |r n| := by simp -+ have : |r n| = r n := abs_of_nonneg (hr n) -+ simp [this] -+ have hsum_norms1 : (∑' n, ‖u n‖) = ∑' n, ‖(r n : ℂ)‖ := -+ congrArg (fun f : ℕ → ℝ => ∑' n, f n) hfunEq -+ have hsum_norms2 : (∑' n, ‖(r n : ℂ)‖) = ∑' n, r n := -+ congrArg (fun f : ℕ → ℝ => ∑' n, f n) hfunEq2 -+ have hRHS : (∑' n, ‖u n‖) = ∑' n, r n := hsum_norms1.trans hsum_norms2 -+ -+ calc -+ ‖(∑' n, u n)‖ = |∑' n, r n| := hLHS -+ _ = ∑' n, r n := habs_sum -+ _ = ∑' n, ‖u n‖ := by simp [hRHS] -+ -+lemma lem_norm_logDeriv_le_tsum (s : ℂ) (hs : 1 < s.re) : -+ ‖deriv riemannZeta s / riemannZeta s‖ ≤ ∑' n : ℕ, ‖((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) / ((n : ℂ) ^ s)‖ := by -+ classical -+ -+ let f : ℕ → ℂ := fun n => ((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) -+ -+ have hsum_term : Summable (fun n : ℕ => LSeries.term f s n) := by -+ simpa [f] using! (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := s) hs) -+ -+ have hsum_norm : Summable (fun n : ℕ => ‖LSeries.term f s n‖) := -+ (summable_norm_iff).mpr hsum_term -+ -+ have hEq : (∑' n : ℕ, LSeries.term f s n) = - deriv riemannZeta s / riemannZeta s := by -+ simpa [f] using! (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := s) hs) -+ -+ have hpoint : (fun n : ℕ => ‖LSeries.term f s n‖) -+ = (fun n : ℕ => ‖f n / ((n : ℂ) ^ s)‖) := by -+ funext n -+ by_cases h0 : n = 0 -+ · -+ subst h0 -+ -+ have hf0r : ArithmeticFunction.vonMangoldt 0 = 0 := by -+ simp -+ have hf0 : f 0 = 0 := by simp [f, hf0r] -+ simp [LSeries.term, f, hf0] -+ · -+ simp [LSeries.term, f, h0] -+ -+ calc -+ ‖deriv riemannZeta s / riemannZeta s‖ -+ = ‖- deriv riemannZeta s / riemannZeta s‖ := by simp [norm_neg] -+ _ = ‖∑' n : ℕ, LSeries.term f s n‖ := by simp [hEq] -+ _ ≤ ∑' n : ℕ, ‖LSeries.term f s n‖ := -+ norm_tsum_le_tsum_norm (f := fun n : ℕ => LSeries.term f s n) hsum_norm -+ _ = ∑' n : ℕ, ‖f n / ((n : ℂ) ^ s)‖ := by simp [hpoint] -+ _ = ∑' n : ℕ, ‖((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) / ((n : ℂ) ^ s)‖ := rfl -+ -+lemma lem_tsum_norm_vonMangoldt_depends_on_Re_cast (s : ℂ) (σ : ℝ) -+ (hσ : σ = s.re) (hs : 1 < s.re) : -+ (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) -+ = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by -+ -+ have hre_ne_zero : s.re ≠ 0 := ne_of_gt (lt_trans zero_lt_one hs) -+ have hσ_ne_zero : σ ≠ 0 := by -+ have : 0 < σ := by simpa [hσ] using (lt_trans zero_lt_one hs) -+ exact ne_of_gt this -+ -+ have hterm : (fun n : ℕ => ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) -+ = (fun n : ℕ => ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by -+ funext n -+ -+ have hden_s : ‖(n : ℂ) ^ s‖ = (n : ℝ) ^ s.re := -+ Complex.norm_natCast_cpow_of_re_ne_zero n hre_ne_zero -+ have hden_σ : ‖(n : ℂ) ^ (σ : ℂ)‖ = (n : ℝ) ^ (σ : ℂ).re := -+ Complex.norm_natCast_cpow_of_re_ne_zero n (by simpa [Complex.ofReal_re] using hσ_ne_zero) -+ calc -+ ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖ -+ = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ))‖ / ‖(n : ℂ) ^ s‖ := by simp -+ _ = |ArithmeticFunction.vonMangoldt n| / ((n : ℝ) ^ s.re) := by -+ simp [hden_s, Complex.norm_real] -+ _ = |ArithmeticFunction.vonMangoldt n| / ((n : ℝ) ^ σ) := by simp [hσ] -+ _ = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ))‖ / ‖(n : ℂ) ^ (σ : ℂ)‖ := by -+ simp [hden_σ, Complex.ofReal_re, Complex.norm_real] -+ _ = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖ := by simp -+ simpa using congrArg (fun f : ℕ → ℝ => ∑' n, f n) hterm -+ -+lemma helper_norm_neg_logDeriv_eq_tsum_norm (σ : ℝ) (hσ : 1 < σ) : -+ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ = -+ (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by -+ classical -+ -+ let s : ℂ := (σ : ℂ) -+ -+ let f : ℕ → ℂ := fun n => ((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) -+ -+ let u : ℕ → ℂ := fun n => LSeries.term f s n -+ -+ have hs_re : 1 < s.re := by simpa using! hσ -+ have hsum_term : Summable (fun n : ℕ => LSeries.term f s n) := by -+ simpa [f] using! (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := s) hs_re) -+ -+ have hsum_u : Summable u := hsum_term -+ -+ have hL_eq : (∑' n : ℕ, LSeries.term f s n) = - deriv riemannZeta s / riemannZeta s := -+ (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := s) hs_re) -+ have hsum_eq : (∑' n, u n) = - deriv riemannZeta s / riemannZeta s := by -+ simpa [u] using hL_eq -+ -+ have hterm_as_div : ∀ n, -+ u n = ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) := by -+ intro n; by_cases h0 : n = 0 -+ · -+ subst h0; simp [u, LSeries.term, f, s] -+ · -+ simp [u, LSeries.term, f, s, h0] -+ -+ let r : ℕ → ℝ := fun n => Classical.choose (lem_term_real_nonneg n σ hσ) -+ have hr_nonneg : ∀ n, 0 ≤ r n := by -+ intro n; exact (Classical.choose_spec (lem_term_real_nonneg n σ hσ)).1 -+ have hr_cast : ∀ n, -+ ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = (r n : ℂ) := by -+ intro n; exact (Classical.choose_spec (lem_term_real_nonneg n σ hσ)).2 -+ have hr_eq' : ∀ n, u n = (r n : ℂ) := by -+ intro n; simpa [hterm_as_div n] using (hr_cast n) -+ -+ have hsum_rc : Summable (fun n => (r n : ℂ)) := by -+ simpa [u, hr_eq'] using hsum_u -+ have hsum_r : Summable r := (Complex.summable_ofReal).1 hsum_rc -+ -+ have hsum_u_as_real : (∑' n, u n) = ((∑' n, r n) : ℝ) := by -+ have hru : (fun n => (r n : ℂ)) = u := by -+ funext n; symm; exact hr_eq' n -+ have := (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := r)) -+ -+ simpa [hru] using this.symm -+ -+ have hpoint_norm : (fun n : ℕ => ‖u n‖) -+ = (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by -+ funext n; by_cases h0 : n = 0 -+ · subst h0; simp [u, LSeries.term, f, s] -+ · simp [u, LSeries.term, f, s, h0] -+ have hnorm_fun : (fun n : ℕ => ‖u n‖) = r := by -+ funext n; simp [hr_eq' n, Complex.norm_real, abs_of_nonneg (hr_nonneg n)] -+ have hsum_norm : Summable (fun n : ℕ => ‖u n‖) := by -+ simpa [hnorm_fun] using hsum_r -+ -+ have hineq : ‖∑' n, u n‖ ≤ ∑' n, ‖u n‖ := -+ norm_tsum_le_tsum_norm (f := u) hsum_norm -+ -+ set S : ℝ := ∑' n, r n -+ have hS_le : ‖((S : ℝ) : ℂ)‖ ≤ S := by -+ simpa [S, hsum_u_as_real, hnorm_fun] using hineq -+ -+ have hS_nonneg : 0 ≤ S := by -+ have habs_le : |S| ≤ S := by simpa [Complex.norm_real] using hS_le -+ exact (abs_nonneg S).trans habs_le -+ -+ have h_left : ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ -+ = ‖∑' n, u n‖ := by -+ have : - deriv riemannZeta s / riemannZeta s = ∑' n, u n := by simpa [hsum_u_as_real] using hsum_eq.symm -+ simp [s, this] -+ have h_mid : ‖∑' n, u n‖ = S := by -+ -+ have : ‖((S : ℝ) : ℂ)‖ = S := by simp [Complex.norm_real, abs_of_nonneg hS_nonneg] -+ simpa [S, hsum_u_as_real] using this -+ have h_right : (∑' n : ℕ, ‖u n‖) = S := by simp [S, hnorm_fun] -+ -+ calc -+ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ -+ = ‖∑' n, u n‖ := h_left -+ _ = S := h_mid -+ _ = (∑' n : ℕ, ‖u n‖) := h_right.symm -+ _ = (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by -+ simp [hpoint_norm] -+ -+theorem lem_zetacenterbd : -+ ∀ t : ℝ, -+ ∀ σ : ℝ, -+ σ ≥ 3/2 → -+ ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ -+ ‖deriv riemannZeta σ / riemannZeta σ‖ := by -+ intro t σ hσge -+ -+ set s : ℂ := Complex.mk σ t -+ -+ have hs : 1 < s.re := by -+ have : (1 : ℝ) < (3 / 2 : ℝ) := by norm_num -+ exact lt_of_lt_of_le this hσge -+ have hσgt1 : 1 < σ := by -+ have : (1 : ℝ) < (3 / 2 : ℝ) := by norm_num -+ exact lt_of_lt_of_le this hσge -+ -+ have h_le_sum := lem_norm_logDeriv_le_tsum s hs -+ have h1 : ‖deriv riemannZeta s / riemannZeta s‖ ≤ -+ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) := by -+ simpa [norm_div, Complex.norm_real] using h_le_sum -+ -+ have h_dep : -+ (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) -+ = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by -+ -+ have hre : σ = s.re := by simp [s] -+ simpa using (lem_tsum_norm_vonMangoldt_depends_on_Re_cast s σ hre hs) -+ have h_dep_ratio : -+ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) -+ = (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) := by -+ simpa [norm_div, Complex.norm_real] using h_dep -+ -+ have h_sum_eq_norm : -+ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ -+ = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := -+ helper_norm_neg_logDeriv_eq_tsum_norm σ hσgt1 -+ have h_sum_eq_norm_ratio : -+ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) -+ = ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := by -+ simpa [norm_div, Complex.norm_real] using h_sum_eq_norm.symm -+ -+ have h_main : ‖deriv riemannZeta s / riemannZeta s‖ ≤ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := by -+ calc -+ ‖deriv riemannZeta s / riemannZeta s‖ -+ ≤ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) := h1 -+ _ = (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) := h_dep_ratio -+ _ = ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := h_sum_eq_norm_ratio -+ -+ simpa [s, norm_neg] using h_main -+ -+lemma lem_logDerivZetalogt32 : -+ ∃ C : ℝ, C > 1 ∧ -+ ∀ t : ℝ, |t| > 3 → -+ ∀ σ : ℝ, -+ σ ≥ 3/2 → -+ ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ C := by -+ -+ obtain ⟨C0, hC0_gt1, hC0_bound⟩ := Z0bound_const -+ -+ refine ⟨C0 + 2, by linarith, ?_⟩ -+ intro t ht σ hσ -+ -+ have h_center := lem_zetacenterbd t σ hσ -+ -+ set δ : ℝ := σ - 1 -+ have hδ_pos : 0 < δ := by linarith [hσ] -+ have hδ_ge_half : (1 / 2 : ℝ) ≤ δ := by linarith [hσ] -+ -+ have hZ0 := hC0_bound δ hδ_pos -+ -+ have h_tri : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ -+ ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ + ‖(1 / (δ : ℂ))‖ := by -+ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using -+ (norm_add_le (-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))) (1 / (δ : ℂ))) -+ -+ have h_norm_div_le_two : ‖(1 / (δ : ℂ))‖ ≤ 2 := by -+ -+ have hnorm_div : ‖(1 : ℂ) / (δ : ℂ)‖ = ‖(1 : ℂ)‖ / ‖(δ : ℂ)‖ := by -+ simp -+ have hnorm_ofReal : ‖(δ : ℂ)‖ = |δ| := by -+ simp -+ -+ have h_abs_ge : (1 / 2 : ℝ) ≤ |δ| := by -+ have hδ_nonneg : 0 ≤ δ := le_of_lt hδ_pos -+ simpa [abs_of_nonneg hδ_nonneg] using hδ_ge_half -+ have hhalfpos : (0 : ℝ) < 1 / 2 := by norm_num -+ have hone_div_abs_le_two : 1 / |δ| ≤ 2 := by -+ simpa using (one_div_le_one_div_of_le hhalfpos h_abs_ge) -+ -+ have : 1 / ‖(δ : ℂ)‖ ≤ 2 := by simpa [hnorm_ofReal] using hone_div_abs_le_two -+ -+ have hnorm_div' : ‖(1 / (δ : ℂ))‖ = 1 / ‖(δ : ℂ)‖ := by -+ simp -+ simpa [hnorm_div'] using this -+ -+ have h_real_axis_bound : ‖logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + 2 := by -+ have h1 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + ‖(1 / (δ : ℂ))‖ := -+ le_trans h_tri (add_le_add_left hZ0 _) -+ have h2 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + 2 := -+ le_trans h1 (add_le_add_right h_norm_div_le_two _) -+ simpa [norm_neg] using h2 -+ -+ have hσ_real : (1 : ℝ) + δ = σ := by -+ simp [δ, sub_eq_add_neg, add_left_comm] -+ have hσ_eq : (1 : ℂ) + δ = (σ : ℂ) := by -+ have : ((1 + δ : ℝ) : ℂ) = (σ : ℂ) := by simpa using congrArg Complex.ofReal hσ_real -+ simpa [Complex.ofReal_add] using this -+ have hR_bound : ‖deriv riemannZeta σ / riemannZeta σ‖ ≤ C0 + 2 := by -+ -+ simpa [logDerivZeta, hσ_eq] using h_real_axis_bound -+ -+ exact le_trans h_center hR_bound -+ -+theorem thm_final_result : -+ ∃ A : ℝ, A > 0 ∧ A < 1 ∧ -+ ∃ C : ℝ, C > 1 ∧ -+ ∀ t : ℝ, |t| > 3 → -+ ∀ σ : ℝ, -+ σ ≥ 1 - A / Real.log (abs t + 2) → -+ ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ C * (Real.log (abs t)) ^ 2 := by -+ -+ obtain ⟨C₀, hC₀_pos, hC₀⟩ := lem_logDerivZetalogt0 -+ obtain ⟨C₃₂, hC₃₂_pos, hC₃₂⟩ := lem_logDerivZetalogt32 -+ -+ use zerofree_constant / 20 -+ -+ constructor -+ · -+ apply div_pos zerofree_constant_pos -+ norm_num -+ -+ constructor -+ · -+ rw [div_lt_one (by norm_num : (0 : ℝ) < 20)] -+ -+ have h1 : zerofree_constant < 1 := zerofree_constant_lt_one -+ linarith -+ -+ use max C₀ C₃₂ -+ -+ constructor -+ · -+ exact lt_max_of_lt_left hC₀_pos -+ -+ · -+ intro t ht σ hσ -+ -+ have h_eq : zerofree_constant / 20 / Real.log (abs t + 2) = deltaz_t t := by -+ unfold deltaz_t deltaz -+ simp -+ -+ have hσ' : σ ≥ 1 - deltaz_t t := by -+ rw [← h_eq] -+ exact hσ -+ -+ by_cases h : σ ≥ 3/2 -+ · -+ have bound := hC₃₂ t ht σ h -+ have hC_le : C₃₂ ≤ max C₀ C₃₂ := le_max_right _ _ -+ -+ have hlog_ge_one : 1 ≤ Real.log (abs t) := by -+ have h_ge : Real.exp 1 ≤ abs t := by -+ -+ have he_lt_3 : Real.exp 1 < 3 := lem_three_gt_e -+ linarith [ht, abs_nonneg t] -+ exact (Real.le_log_iff_exp_le (by linarith [abs_nonneg t])).2 h_ge -+ have h_one_le_sq : 1 ≤ (Real.log (abs t)) ^ 2 := by -+ have h_sq : (Real.log (abs t)) ^ 2 = Real.log (abs t) * Real.log (abs t) := by -+ rw [pow_two] -+ rw [h_sq] -+ have h_mul : 1 * 1 ≤ Real.log (abs t) * Real.log (abs t) := -+ mul_self_le_mul_self (zero_le_one) hlog_ge_one -+ simpa using h_mul -+ have h_pos : 0 < C₃₂ := lt_trans zero_lt_one hC₃₂_pos -+ calc ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ -+ ≤ C₃₂ := bound -+ _ = C₃₂ * 1 := by rw [mul_one] -+ _ ≤ C₃₂ * (Real.log (abs t)) ^ 2 := by -+ apply mul_le_mul_of_nonneg_left h_one_le_sq (le_of_lt h_pos) -+ _ ≤ max C₀ C₃₂ * (Real.log (abs t)) ^ 2 := by -+ apply mul_le_mul_of_nonneg_right hC_le (sq_nonneg _) -+ -+ · -+ push Not at h -+ have h_conditions : 1 - deltaz_t t ≤ σ ∧ σ ≤ 3/2 ∧ t = t := by -+ exact ⟨hσ', le_of_lt h, rfl⟩ -+ have bound := hC₀ t ht ⟨σ, t⟩ h_conditions -+ have hC_le : C₀ ≤ max C₀ C₃₂ := le_max_left _ _ -+ calc ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ -+ ≤ C₀ * Real.log |t| ^ 2 := bound -+ _ ≤ max C₀ C₃₂ * Real.log |t| ^ 2 := by -+ apply mul_le_mul_of_nonneg_right hC_le (sq_nonneg _) -+ -+lemma ZetaZeroFree_p : -+ ∃ (A : ℝ) (_ : A ∈ Set.Ioc 0 (1 / 2)), -+ ∀ (σ : ℝ) -+ (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Set.Ico (1 - A / Real.log |t| ^ 1) 1), -+ riemannZeta (σ + t * Complex.I) ≠ 0 := by -+ -+ obtain ⟨c, hc_pos, hc_lt_one, hbound⟩ := zerofree -+ -+ let A0 : ℝ := min (1 / 2 : ℝ) (c / 2) -+ let A : ℝ := min A0 ((1 / 4 : ℝ) * Real.log 3) -+ have hA_pos : 0 < A := by -+ have h1 : 0 < (1 / 2 : ℝ) := by norm_num -+ have h2 : 0 < c / 2 := by -+ have : 0 < (2 : ℝ) := by norm_num -+ exact div_pos hc_pos this -+ have hA0pos : 0 < A0 := lt_min_iff.mpr ⟨h1, h2⟩ -+ have hlog3pos : 0 < Real.log (3 : ℝ) := -+ (Real.log_pos_iff (by norm_num : (0 : ℝ) ≤ 3)).2 (by norm_num) -+ have h3 : 0 < (1 / 4 : ℝ) * Real.log 3 := by -+ exact mul_pos (by norm_num) hlog3pos -+ exact lt_min_iff.mpr ⟨hA0pos, h3⟩ -+ have hA_le_half : A ≤ 1/2 := by -+ have : A ≤ A0 := min_le_left _ _ -+ exact this.trans (min_le_left _ _) -+ have hA_le_c2 : A ≤ c / 2 := by -+ have : A ≤ A0 := min_le_left _ _ -+ exact this.trans (min_le_right _ _) -+ have hA_le_log3quarter : A ≤ (1 / 4 : ℝ) * Real.log 3 := min_le_right _ _ -+ refine ⟨A, ?_, ?_⟩ -+ · exact ⟨hA_pos, hA_le_half⟩ -+ · intro σ t htgt3 hσI hzero -+ -+ set L := Real.log |t| with hLdef -+ set Lp := Real.log (|t| + 2) with hLpdef -+ have hpos_abs : 0 ≤ |t| := abs_nonneg t -+ have hLpos : 0 < L := (Real.log_pos_iff hpos_abs).2 (lt_trans (by norm_num) htgt3) -+ have hLp_pos_arg : 0 < |t| + 2 := by linarith -+ have hLp_pos : 0 < Lp := (Real.log_pos_iff (le_of_lt hLp_pos_arg)).2 (by linarith) -+ -+ have hlog3_le_L : Real.log 3 ≤ L := by -+ have h3pos : 0 < (3 : ℝ) := by norm_num -+ have : (3 : ℝ) ≤ |t| := le_of_lt htgt3 -+ simpa [hLdef] using Real.log_le_log h3pos this -+ -+ have hquarter_ratio_le : ((1 / 4 : ℝ) * Real.log 3) / L ≤ (1 / 4 : ℝ) := by -+ have h := div_le_div_of_nonneg_right hlog3_le_L (le_of_lt hLpos) -+ have h' := mul_le_mul_of_nonneg_left h (by norm_num : (0 : ℝ) ≤ 1/4) -+ have hne : L ≠ 0 := ne_of_gt hLpos -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hne] using h' -+ -+ have hA_over_le_quarter : A / L ≤ (1 / 4 : ℝ) := by -+ have := div_le_div_of_nonneg_right hA_le_log3quarter (le_of_lt hLpos) -+ exact this.trans hquarter_ratio_le -+ -+ have hlow : 1 - A / L ≤ σ := by simpa [hLdef, pow_one] using hσI.1 -+ have hσ_ge_34 : (3 / 4 : ℝ) ≤ σ := by -+ have : (3 / 4 : ℝ) ≤ 1 - A / L := by linarith -+ exact this.trans hlow -+ have hσ_pos : 0 < σ := lt_of_lt_of_le (by norm_num : (0 : ℝ) < (3/4 : ℝ)) hσ_ge_34 -+ have hσ_lt_one : σ < 1 := hσI.2 -+ -+ have hlog_lt : Lp < 2 * L := by -+ have h1 : 0 < |t| - 2 := by linarith -+ have h2 : 0 < |t| + 1 := by linarith -+ have hprod_pos : 0 < (|t| - 2) * (|t| + 1) := mul_pos h1 h2 -+ have hpoly : |t| * |t| - (|t| + 2) = (|t| - 2) * (|t| + 1) := by ring -+ have hlt : |t| + 2 < |t| * |t| := by -+ calc -+ |t| + 2 < |t| + 2 + (|t| - 2) * (|t| + 1) := by linarith [hprod_pos] -+ _ = |t| * |t| := by rw [← hpoly]; ring -+ have hposb : 0 < |t| + 2 := by linarith -+ have hlog_lt' : Real.log (|t| + 2) < Real.log (|t| * |t|) := Real.log_lt_log hposb hlt -+ have hlogmul : Real.log (|t| ^ 2) = 2 * Real.log |t| := Real.log_pow |t| 2 -+ calc -+ Lp = Real.log (|t| + 2) := by simp [hLpdef] -+ _ < Real.log (|t| * |t|) := hlog_lt' -+ _ = Real.log (|t| ^ 2) := by simp [pow_two] -+ _ = 2 * Real.log |t| := by simp -+ _ = 2 * L := by simp [hLdef] -+ -+ have h_inv_comp : 1 / (2 * L) < 1 / Lp := one_div_lt_one_div_of_lt hLp_pos hlog_lt -+ have hstep2 : (c / 2) / L < c / Lp := by -+ have hcpos' : 0 < c := hc_pos -+ have : c * (1 / (2 * L)) < c * (1 / Lp) := mul_lt_mul_of_pos_left h_inv_comp hcpos' -+ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this -+ -+ have hstep1 : A / L ≤ (c / 2) / L := by -+ have := div_le_div_of_nonneg_right hA_le_c2 (le_of_lt hLpos) -+ simpa [div_eq_mul_inv] using this -+ have hstrict_div : A / L < c / Lp := lt_of_le_of_lt hstep1 hstep2 -+ -+ have hσ_gt : 1 - c / Lp < σ := by -+ have hneg' : - (c / Lp) < - (A / L) := by simpa [neg_div] using neg_lt_neg hstrict_div -+ have : 1 - c / Lp < 1 - A / L := by simpa [sub_eq_add_neg] using! add_lt_add_right hneg' 1 -+ exact this.trans_le hlow -+ -+ let s : ℂ := Complex.mk σ t -+ have hs_zero : riemannZeta s = 0 := by simpa [s, Complex.mk_eq_add_mul_I] using hzero -+ have hs_in_zeroZ : s ∈ zeroZ := by simpa [zeroZ] using hs_zero -+ have hpre : s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1 := by -+ refine ⟨hs_in_zeroZ, ?_, ?_⟩ -+ · simpa [s] using hσ_pos -+ · simpa [s] using hσ_lt_one -+ have him_bound : 2 < |s.im| := by -+ have : 2 < |t| := lt_trans (by norm_num) htgt3 -+ simpa [s] using this -+ have hbound_applied : s.re ≤ 1 - c / Real.log (abs s.im + 2) := hbound s hpre him_bound -+ have hle : σ ≤ 1 - c / Lp := by simpa [s, hLpdef] using hbound_applied -+ have hcontr : σ < σ := lt_of_le_of_lt hle hσ_gt -+ exact (lt_irrefl _ : ¬ σ < σ) hcontr -+ -+open _root_.Set Function Filter _root_.Complex _root_.Real -+lemma LogDerivZetaBndUnif2 : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Ici (1 - A / Real.log |t| ^ 1)), ‖(deriv riemannZeta) (σ + t * Complex.I) / riemannZeta (σ + t * Complex.I)‖ ≤ -+ C * Real.log |t| ^ 2 := by -+ classical -+ obtain ⟨c, hc, hc2, K, hK, hfinal⟩ := thm_final_result -+ -+ let A : ℝ := min (1/2 : ℝ) (c / 2) -+ have hApos : 0 < A := by -+ have h1 : 0 < (1/2 : ℝ) := by norm_num -+ have h2 : 0 < c / 2 := by -+ have : 0 < (2 : ℝ) := by norm_num -+ exact div_pos hc this -+ exact (lt_min_iff).2 ⟨h1, h2⟩ -+ have hAle : A ≤ (1/2 : ℝ) := min_le_left _ _ -+ have hA_in : A ∈ Ioc 0 (1/2) := ⟨hApos, hAle⟩ -+ let C : ℝ := K -+ have hCpos : 0 < C := by -+ have hKpos : 0 < K := lt_trans (by norm_num : (0 : ℝ) < 1) hK -+ exact hKpos -+ refine ⟨A, hA_in, C, hCpos, ?_⟩ -+ intro σ t htgt3 hσI -+ -+ let x := |t| -+ have hxpos : 0 ≤ x := abs_nonneg t -+ have hxgt3 : 3 < x := htgt3 -+ let L := Real.log x -+ let L' := Real.log (x + 2) -+ have hLpos : 0 < L := (Real.log_pos_iff hxpos).2 (lt_trans (by norm_num) hxgt3) -+ have hL'pos : 0 < L' := -+ (Real.log_pos_iff (by linarith : 0 ≤ x + 2)).2 (by linarith [hxpos, hxgt3]) -+ -+ have hσ_ge : 1 - A / L ≤ σ := by simpa [pow_one, L, x] using hσI -+ -+ have hprod_pos : 0 < (x - 2) * (x + 1) := by -+ have hxgt2 : (2 : ℝ) < x := lt_trans (by norm_num) hxgt3 -+ exact mul_pos (sub_pos.mpr hxgt2) (add_pos_of_nonneg_of_pos hxpos (by norm_num)) -+ have hdiff_pos : 0 < x ^ 2 - (x + 2) := by -+ have hpoly : x ^ 2 - (x + 2) = (x - 2) * (x + 1) := by ring -+ simpa [hpoly] using hprod_pos -+ have hlt_sq : x + 2 < x ^ 2 := by linarith -+ have hlog_lt : L' < Real.log (x ^ 2) := -+ Real.log_lt_log (by linarith : 0 < x + 2) hlt_sq -+ have hlog_pow : Real.log (x ^ 2) = 2 * L := by -+ simp [L] -+ have hL'_lt_2L : L' < 2 * L := by simpa [L', hlog_pow] -+ using hlog_lt -+ -+ have hA_le_c2 : A ≤ c / 2 := min_le_right _ _ -+ have hstep0 : A / L ≤ (c / 2) / L := -+ div_le_div_of_nonneg_right hA_le_c2 (le_of_lt hLpos) -+ have hrecip : 1 / (2 * L) < 1 / L' := -+ one_div_lt_one_div_of_lt hL'pos hL'_lt_2L -+ have hmul : c * (1 / (2 * L)) < c * (1 / L') := -+ mul_lt_mul_of_pos_left hrecip hc -+ have hstep2 : (c / 2) / L < c / L' := by -+ simpa [one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] -+ using hmul -+ have hineq : A / L < c / L' := lt_of_le_of_lt hstep0 hstep2 -+ have hσ_gt : σ > 1 - c / L' := by -+ have : 1 - c / L' < 1 - A / L := by linarith [hineq] -+ exact lt_of_lt_of_le this hσ_ge -+ -+ have hmain' : ‖(deriv riemannZeta) (σ + t * Complex.I) / riemannZeta (σ + t * Complex.I)‖ ≤ -+ K * (Real.log |t|) ^ 2 := by -+ have h_eq : σ + t * Complex.I = Complex.mk σ t := by -+ rw [Complex.mk_eq_add_mul_I] -+ rw [h_eq] -+ have hσ_ge_required : σ ≥ 1 - c / Real.log (abs t + 2) := by -+ have h_abs_eq : abs t = |t| := by simp -+ rw [h_abs_eq] -+ exact le_of_lt hσ_gt -+ exact hfinal t htgt3 σ hσ_ge_required -+ -+ simpa [C, L, x] using hmain' -+ -+end Erdos970 -diff --git a/StrongPNT/Erdos970/PNT5_Strong.lean b/StrongPNT/Erdos970/PNT5_Strong.lean -new file mode 100644 -index 0000000..bc0f938 ---- /dev/null -+++ b/StrongPNT/Erdos970/PNT5_Strong.lean -@@ -0,0 +1,5754 @@ -+import PrimeNumberTheoremAnd.Erdos970.ZetaBounds -+import PrimeNumberTheoremAnd.Erdos970.ZetaConj -+import PrimeNumberTheoremAnd.Erdos970.SmoothExistence -+import Mathlib.Algebra.Group.Support -+import Mathlib.Analysis.SpecialFunctions.Log.Monotone -+import Mathlib.Analysis.Real.Pi.Bounds -+import Mathlib.Analysis.Complex.ExponentialBounds -+import StrongPNT.Erdos970.ZetaZeroFree -+ -+namespace Erdos970 -+ -+ -+open _root_.Set _root_.Function _root_.Filter _root_.Complex _root_.Real -+ -+open _root_.ArithmeticFunction (vonMangoldt) -+ -+noncomputable abbrev MellinTransform : (ℝ → ℂ) → ℂ → ℂ := mellin -+ -+lemma MellinTransform_integral (f : ℝ → ℂ) (s : ℂ) : -+ MellinTransform f s = ∫ x in Set.Ioi (0 : ℝ), f x * (x : ℂ) ^ (s - 1) := by -+ simp only [MellinTransform, mellin, smul_eq_mul, mul_comm] -+ -+lemma MellinTransform_eq : MellinTransform = (mellin : (ℝ → ℂ) → ℂ → ℂ) := by -+ rfl -+ -+noncomputable def MellinInverseTransform (F : ℂ → ℂ) (σ : ℝ) (x : ℝ) : ℂ := -+ VerticalIntegral' (fun s ↦ x ^ (-s) * F s) σ -+ -+lemma MellinInverseTransform_eq (σ : ℝ) (f : ℂ → ℂ) : -+ MellinInverseTransform f σ = mellinInv σ f := by -+ unfold mellinInv MellinInverseTransform VerticalIntegral' VerticalIntegral -+ beta_reduce; ext x -+ rw [← smul_assoc, smul_eq_mul (b := Complex.I), div_mul]; simp -+ -+theorem MellinInversion (σ : ℝ) {f : ℝ → ℂ} {x : ℝ} (hx : 0 < x) (hf : MellinConvergent f σ) -+ (hFf : VerticalIntegrable (mellin f) σ) (hfx : ContinuousAt f x) : -+ MellinInverseTransform (MellinTransform f) σ x = f x := by -+ rw [MellinInverseTransform_eq, mellinInv_mellin_eq σ f hx hf hFf hfx] -+ -+local notation (name := mellintransform2) "𝓜" => MellinTransform -+ -+local notation "Λ" => vonMangoldt -+ -+local notation "ζ" => riemannZeta -+ -+local notation "ζ'" => deriv ζ -+ -+local notation "I" => Complex.I -+ -+noncomputable def ChebyshevPsi (x : ℝ) : ℝ := -+ (Finset.range ⌊x + 1⌋₊).sum Λ -+ -+local notation "ψ" => ChebyshevPsi -+ -+theorem LogDerivativeDirichlet (s : ℂ) (hs : 1 < s.re) : -+ - deriv riemannZeta s / riemannZeta s = ∑' n, Λ n / (n : ℂ) ^ s := by -+ rw [← ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div hs] -+ dsimp [LSeries, LSeries.term] -+ nth_rewrite 2 [Summable.tsum_eq_add_tsum_ite (b := 0) ?_] -+ · simp -+ · have := ArithmeticFunction.LSeriesSummable_vonMangoldt hs -+ dsimp [LSeriesSummable] at this -+ convert! this using 1 -+ funext n -+ by_cases h : n = 0 <;> simp [LSeries.term, h] -+ -+noncomputable abbrev SmoothedChebyshevIntegrand (SmoothingF : ℝ → ℝ) (ε : ℝ) (X : ℝ) : ℂ → ℂ := -+ fun s ↦ (- deriv riemannZeta s) / riemannZeta s * -+ 𝓜 ((Smooth1 SmoothingF ε) ·) s * (X : ℂ) ^ s -+ -+noncomputable def SmoothedChebyshev (SmoothingF : ℝ → ℝ) (ε : ℝ) (X : ℝ) : ℂ := -+ VerticalIntegral' (SmoothedChebyshevIntegrand SmoothingF ε X) ((1 : ℝ) + (Real.log X)⁻¹) -+ -+open ComplexConjugate -+ -+lemma smoothedChebyshevIntegrand_conj {SmoothingF : ℝ → ℝ} {ε X : ℝ} (Xpos : 0 < X) (s : ℂ) : -+ SmoothedChebyshevIntegrand SmoothingF ε X (conj s) = conj (SmoothedChebyshevIntegrand SmoothingF ε X s) := by -+ unfold SmoothedChebyshevIntegrand -+ simp only [map_mul, map_div₀, map_neg] -+ congr -+ · exact deriv_riemannZeta_conj s -+ · exact riemannZeta_conj s -+ · simp_rw [MellinTransform_integral] -+ -+ rw[← integral_conj] -+ apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioi -+ intro x xpos -+ simp only [map_mul, Complex.conj_ofReal] -+ congr -+ nth_rw 1 [← map_one conj] -+ rw[← map_sub, Complex.cpow_conj, Complex.conj_ofReal] -+ rw[Complex.arg_ofReal_of_nonneg xpos.le] -+ exact Real.pi_ne_zero.symm -+ · rw[Complex.cpow_conj, Complex.conj_ofReal] -+ rw[Complex.arg_ofReal_of_nonneg Xpos.le] -+ exact Real.pi_ne_zero.symm -+ -+open _root_.MeasureTheory -+ -+lemma SmoothedChebyshevDirichlet_aux_integrable {SmoothingF : ℝ → ℝ} -+ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) -+ (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) -+ (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) -+ {ε : ℝ} (εpos : 0 < ε) (ε_lt_one : ε < 1) {σ : ℝ} (σ_gt : 1 < σ) (σ_le : σ ≤ 2) : -+ MeasureTheory.Integrable -+ (fun (y : ℝ) ↦ 𝓜 (fun x ↦ (Smooth1 SmoothingF ε x : ℂ)) (σ + y * I)) := by -+ obtain ⟨c, cpos, hc⟩ := MellinOfSmooth1b diffSmoothingF suppSmoothingF -+ apply Integrable.mono' (g := (fun t ↦ c / ε * 1 / (1 + t ^ 2))) -+ · apply Integrable.const_mul integrable_inv_one_add_sq -+ · apply Continuous.aestronglyMeasurable -+ apply continuous_iff_continuousAt.mpr -+ intro x -+ have := Smooth1MellinDifferentiable diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ -+ SmoothingFpos mass_one (s := σ + x * I) (by simp only [add_re, ofReal_re, mul_re, I_re, -+ mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero]; linarith) |>.continuousAt -+ fun_prop -+ · filter_upwards [] with t -+ calc -+ _≤ c / ε * 1 / (σ^2 + t^2) := by -+ convert hc (σ / 2) (by linarith) (σ + t * I) (by simp only [add_re, ofReal_re, mul_re, -+ I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, half_le_self_iff]; linarith) -+ (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, -+ sub_self, add_zero]; linarith) ε εpos ε_lt_one using 1 -+ simp only [mul_one, Complex.sq_norm, normSq_apply, add_re, ofReal_re, mul_re, I_re, -+ mul_zero, ofReal_im, I_im, sub_self, add_zero, add_im, mul_im, zero_add, mul_inv_rev] -+ ring_nf -+ _ ≤ _ := by -+ gcongr; nlinarith -+ -+attribute [fun_prop] Continuous.const_cpow -+ -+lemma SmoothedChebyshevDirichlet_aux_tsum_integral {SmoothingF : ℝ → ℝ} -+ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) -+ (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) -+ (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) {X : ℝ} -+ (X_pos : 0 < X) {ε : ℝ} (εpos : 0 < ε) -+ (ε_lt_one : ε < 1) {σ : ℝ} (σ_gt : 1 < σ) (σ_le : σ ≤ 2) : -+ ∫ (t : ℝ), -+ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n) / (n : ℂ) ^ (σ + t * I) * -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + t * I) * (X : ℂ) ^ (σ + t * I) = -+ ∑' (n : ℕ), -+ ∫ (t : ℝ), (ArithmeticFunction.vonMangoldt n) / (n : ℂ) ^ (σ + ↑t * I) * -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X : ℂ) ^ (σ + t * I) := by -+ -+ have cont_mellin_smooth : Continuous fun (a : ℝ) ↦ -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑a * I) := by -+ apply continuousOn_univ.mp -+ refine ContinuousOn.comp' ?_ ?_ ?_ (t := {z : ℂ | 0 < z.re }) -+ . refine continuousOn_of_forall_continuousAt ?_ -+ intro z hz -+ exact (Smooth1MellinDifferentiable diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ SmoothingFpos mass_one hz).continuousAt -+ . fun_prop -+ . simp only [mapsTo_univ_iff, mem_ofPred_eq, add_re, ofReal_re, mul_re, I_re, mul_zero, -+ ofReal_im, I_im, mul_one, sub_self, add_zero, forall_const]; linarith -+ -+ have abs_two : ∀ a : ℝ, ∀ i : ℕ, ‖(i : ℂ) ^ ((σ : ℂ) + ↑a * I)‖₊ = i ^ σ := by -+ intro a i -+ simp_rw [← norm_toNNReal] -+ -+ rw [norm_natCast_cpow_of_re_ne_zero _ (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, -+ ofReal_im, I_im, mul_one, sub_self, add_zero, ne_eq]; linarith)] -+ simp only [add_re, mul_re, ofReal_re, I_re, mul_zero, ofReal_im, I_im, mul_one, -+ sub_self, add_zero, Real.toNNReal_of_nonneg <| rpow_nonneg (y:= σ) (x:= i) (by linarith)] -+ norm_cast -+ -+ rw [MeasureTheory.integral_tsum] -+ have x_neq_zero : X ≠ 0 := by linarith -+ . intro i -+ by_cases i_eq_zero : i = 0 -+ . simpa [i_eq_zero] using aestronglyMeasurable_const -+ . apply Continuous.aestronglyMeasurable -+ fun_prop (disch := simp[i_eq_zero, x_neq_zero]) -+ . rw [← lt_top_iff_ne_top] -+ simp_rw [enorm_mul, enorm_eq_nnnorm, nnnorm_div, ← norm_toNNReal, Complex.norm_cpow_eq_rpow_re_of_pos X_pos, norm_toNNReal, abs_two] -+ simp only [nnnorm_real, add_re, mul_re, ofReal_re, I_re, mul_zero, ofReal_im, I_im, -+ mul_one, sub_self, add_zero] -+ simp_rw [MeasureTheory.lintegral_mul_const' (r := ↑(X ^ σ).toNNReal) (hr := by simp), ENNReal.tsum_mul_right] -+ apply ENNReal.mul_lt_top ?_ ENNReal.coe_lt_top -+ -+ conv => -+ arg 1 -+ arg 1 -+ intro i -+ rw [MeasureTheory.lintegral_const_mul' (hr := by simp)] -+ -+ rw [ENNReal.tsum_mul_right] -+ apply ENNReal.mul_lt_top -+ . rw [lt_top_iff_ne_top, ENNReal.tsum_coe_ne_top_iff_summable_coe] -+ push_cast -+ convert (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := σ) -+ (by simp only [ofReal_re]; linarith)).norm -+ rw [LSeries.term_def] -+ split_ifs with h <;> simp[h] -+ . simp_rw [← enorm_eq_nnnorm] -+ rw [← MeasureTheory.hasFiniteIntegral_iff_enorm] -+ exact SmoothedChebyshevDirichlet_aux_integrable diffSmoothingF SmoothingFpos suppSmoothingF -+ mass_one εpos ε_lt_one σ_gt σ_le |>.hasFiniteIntegral -+ -+theorem SmoothedChebyshevDirichlet {SmoothingF : ℝ → ℝ} -+ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (mass_one: ∫ x in Ioi (0 : ℝ), SmoothingF x / x = 1) -+ {X : ℝ} (X_gt : 3 < X) {ε : ℝ} (εpos: 0 < ε) (ε_lt_one : ε < 1) : -+ SmoothedChebyshev SmoothingF ε X = -+ ∑' n, ArithmeticFunction.vonMangoldt n * Smooth1 SmoothingF ε (n / X) := by -+ dsimp [SmoothedChebyshev, SmoothedChebyshevIntegrand, VerticalIntegral', VerticalIntegral] -+ set σ : ℝ := 1 + (Real.log X)⁻¹ -+ have log_gt : 1 < Real.log X := by -+ rw [Real.lt_log_iff_exp_lt (by linarith : 0 < X)] -+ linarith [Real.exp_one_lt_d9] -+ have σ_gt : 1 < σ := by -+ simp only [σ] -+ have : 0 < (Real.log X)⁻¹ := by -+ simp only [inv_pos] -+ linarith -+ linarith -+ have σ_le : σ ≤ 2 := by -+ simp only [σ] -+ have : (Real.log X)⁻¹ < 1 := inv_lt_one_of_one_lt₀ log_gt -+ linarith -+ calc -+ _ = 1 / (2 * π * I) * (I * ∫ (t : ℝ), ∑' n, Λ n / (n : ℂ) ^ (σ + ↑t * I) * -+ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * X ^ (σ + ↑t * I)) := ?_ -+ _ = 1 / (2 * π * I) * (I * ∑' n, ∫ (t : ℝ), Λ n / (n : ℂ) ^ (σ + ↑t * I) * -+ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * X ^ (σ + ↑t * I)) := ?_ -+ _ = 1 / (2 * π * I) * (I * ∑' n, Λ n * ∫ (t : ℝ), -+ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ -+ _ = 1 / (2 * π) * (∑' n, Λ n * ∫ (t : ℝ), -+ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ -+ _ = ∑' n, Λ n * (1 / (2 * π) * ∫ (t : ℝ), -+ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ -+ _ = ∑' n, Λ n * (1 / (2 * π) * ∫ (t : ℝ), -+ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * ((n : ℂ) / X) ^ (-(σ + ↑t * I))) := ?_ -+ _ = _ := ?_ -+ · congr; ext t -+ rw [LogDerivativeDirichlet] -+ · rw [← tsum_mul_right, ← tsum_mul_right] -+ · simp [σ_gt] -+ · congr -+ exact SmoothedChebyshevDirichlet_aux_tsum_integral diffSmoothingF SmoothingFpos -+ suppSmoothingF mass_one (by linarith) εpos ε_lt_one σ_gt σ_le -+ · field_simp; congr; ext n; rw [← MeasureTheory.integral_const_mul]; congr; ext t -+ by_cases n_ne_zero : n = 0; simp [n_ne_zero] -+ rw [mul_div_assoc, mul_assoc] -+ congr -+ rw [(div_eq_iff ?_).mpr] -+ have := @mul_cpow_ofReal_nonneg (a := X / (n : ℝ)) (b := (n : ℝ)) (r := σ + t * I) ?_ ?_ -+ push_cast at this ⊢ -+ rw [mul_comm I (↑t : ℂ)] -+ rw [← this, div_mul_cancel₀] -+ · simp only [ne_eq, Nat.cast_eq_zero, n_ne_zero, not_false_eq_true] -+ · apply div_nonneg (by linarith : 0 ≤ X); simp -+ · simp -+ · simp only [ne_eq, cpow_eq_zero_iff, Nat.cast_eq_zero, not_and, not_not] -+ intro hn; exfalso; exact n_ne_zero hn -+ · conv => rw [← mul_assoc, div_mul]; lhs; lhs; rhs; simp -+ · simp_rw [← tsum_mul_left, ← mul_assoc, mul_comm] -+ · have ht (t : ℝ) : -(σ + t * I) = (-1) * (σ + t * I) := by simp -+ have hn (n : ℂ) : (n / X) ^ (-1 : ℂ) = X / n := by simp [cpow_neg_one] -+ have (n : ℕ) : (log ((n : ℂ) / (X : ℂ)) * -1).im = 0 := by -+ simp [Complex.log_im, arg_eq_zero_iff, div_nonneg (Nat.cast_nonneg _) (by linarith : 0 ≤ X)] -+ have h (n : ℕ) (t : ℝ) : ((n : ℂ) / X) ^ ((-1 : ℂ) * (σ + t * I)) = -+ ((n / X) ^ (-1 : ℂ)) ^ (σ + ↑t * I) := by -+ rw [cpow_mul] <;> {rw [this n]; simp [Real.pi_pos, Real.pi_nonneg]} -+ congr 1 -+ funext n -+ -+ simp_rw [ht, h, hn] -+ · push_cast -+ congr -+ ext n -+ by_cases n_zero : n = 0; simp [n_zero] -+ have n_pos : 0 < n := by -+ simpa only [n_zero, gt_iff_lt, false_or] using (Nat.eq_zero_or_pos n) -+ congr -+ rw [(by rw [div_mul]; simp : 1 / (2 * π) = 1 / (2 * π * I) * I), mul_assoc] -+ conv => lhs; rhs; rhs; rhs; intro t; rw [mul_comm]; norm_cast -+ have := MellinInversion σ (f := fun x ↦ (Smooth1 SmoothingF ε x : ℂ)) (x := n / X) -+ ?_ ?_ ?_ ?_ -+ · beta_reduce at this -+ dsimp [MellinInverseTransform, VerticalIntegral] at this -+ rw [this] -+ · exact div_pos (by exact_mod_cast n_pos) (by linarith : 0 < X) -+ · apply Smooth1MellinConvergent diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ SmoothingFpos mass_one -+ simp only [ofReal_re] -+ linarith -+ · dsimp [VerticalIntegrable] -+ apply SmoothedChebyshevDirichlet_aux_integrable diffSmoothingF SmoothingFpos -+ suppSmoothingF mass_one εpos ε_lt_one σ_gt σ_le -+ · refine ContinuousAt.comp (g := ofReal) RCLike.continuous_ofReal.continuousAt ?_ -+ exact Smooth1ContinuousAt diffSmoothingF SmoothingFpos suppSmoothingF -+ εpos (by positivity) -+ -+theorem SmoothedChebyshevClose_aux {Smooth1 : (ℝ → ℝ) → ℝ → ℝ → ℝ} (SmoothingF : ℝ → ℝ) -+ (c₁ : ℝ) (c₁_pos : 0 < c₁) (c₁_lt : c₁ < 1) -+ (c₂ : ℝ) (c₂_pos : 0 < c₂) (c₂_lt : c₂ < 2) (hc₂ : ∀ (ε x : ℝ), ε ∈ Ioo 0 1 → 1 + c₂ * ε ≤ x → Smooth1 SmoothingF ε x = 0) -+ (C : ℝ) (C_eq : C = 6 * (3 * c₁ + c₂)) -+ (ε : ℝ) (ε_pos : 0 < ε) (ε_lt_one : ε < 1) -+ (X : ℝ) (X_pos : 0 < X) (X_gt_three : 3 < X) (X_bound_1 : 1 ≤ X * ε * c₁) (X_bound_2 : 1 ≤ X * ε * c₂) -+ (smooth1BddAbove : ∀ (n : ℕ), 0 < n → Smooth1 SmoothingF ε (↑n / X) ≤ 1) -+ (smooth1BddBelow : ∀ (n : ℕ), 0 < n → Smooth1 SmoothingF ε (↑n / X) ≥ 0) -+ (smoothIs1 : ∀ (n : ℕ), 0 < n → ↑n ≤ X * (1 - c₁ * ε) → Smooth1 SmoothingF ε (↑n / X) = 1) -+ (smoothIs0 : ∀ (n : ℕ), 1 + c₂ * ε ≤ ↑n / X → Smooth1 SmoothingF ε (↑n / X) = 0) : -+ ‖(↑((∑' (n : ℕ), ArithmeticFunction.vonMangoldt n * Smooth1 SmoothingF ε (↑n / X))) : ℂ) - -+ ↑((Finset.range ⌊X + 1⌋₊).sum ⇑ArithmeticFunction.vonMangoldt)‖ ≤ -+ C * ε * X * Real.log X := by -+ norm_cast -+ -+ let F := Smooth1 SmoothingF ε -+ -+ let n₀ := ⌈X * (1 - c₁ * ε)⌉₊ -+ -+ have n₀_pos : 0 < n₀ := by -+ simp only [Nat.ceil_pos, n₀] -+ subst C_eq -+ simp_all only [mem_Ioo, and_imp, ge_iff_le, implies_true, mul_pos_iff_of_pos_left, sub_pos] -+ exact (mul_le_of_le_one_right c₁_pos.le ε_lt_one.le).trans_lt c₁_lt -+ -+ have n₀_inside_le_X : X * (1 - c₁ * ε) ≤ X := by -+ nth_rewrite 2 [← mul_one X] -+ apply mul_le_mul_of_nonneg_left _ X_pos.le -+ apply sub_le_self -+ positivity -+ -+ have n₀_le : n₀ ≤ X * ((1 - c₁ * ε)) + 1 := by -+ simp only [n₀] -+ apply le_of_lt -+ exact Nat.ceil_lt_add_one (by bound) -+ -+ have n₀_gt : X * ((1 - c₁ * ε)) ≤ n₀ := by -+ simp only [n₀] -+ exact Nat.le_ceil (X * (1 - c₁ * ε)) -+ -+ have sumΛ : Summable (fun (n : ℕ) ↦ Λ n * F (n / X)) := by -+ exact (summable_of_ne_finset_zero fun a s=>mul_eq_zero_of_right _ -+ (hc₂ _ _ (by trivial) ((le_div_iff₀ X_pos).2 (Nat.ceil_le.1 (not_lt.1 -+ (s ∘ Finset.mem_range.2)))))) -+ -+ have sumΛn₀ (n₀ : ℕ) : Summable (fun n ↦ Λ (n + n₀) * F ((n + n₀) / X)) := by exact_mod_cast sumΛ.comp_injective fun Q=>by valid -+ -+ rw[← Summable.sum_add_tsum_nat_add' (k := n₀) (mod_cast sumΛn₀ n₀)] -+ -+ let n₁ := ⌊X * (1 + c₂ * ε)⌋₊ -+ -+ have n₁_pos : 0 < n₁ := by -+ dsimp only [n₁] -+ apply Nat.le_floor -+ rw[Nat.succ_eq_add_one, zero_add] -+ norm_cast -+ apply one_le_mul_of_one_le_of_one_le (by linarith) -+ apply le_add_of_nonneg_right -+ positivity -+ -+ have n₁_ge : X * (1 + c₂ * ε) - 1 ≤ n₁ := by -+ simp only [tsub_le_iff_right, n₁] -+ exact le_of_lt (Nat.lt_floor_add_one (X * (1 + c₂ * ε))) -+ -+ have n₁_le : (n₁ : ℝ) ≤ X * (1 + c₂ * ε) := by -+ simp only [n₁] -+ exact Nat.floor_le (by bound) -+ -+ have n₁_ge_n₀ : n₀ ≤ n₁ := by -+ have hn : (n₀ : ℝ) ≤ (n₁ : ℝ) := by linarith -+ exact_mod_cast hn -+ -+ have n₁_sub_n₀ : (n₁ : ℝ) - n₀ ≤ X * ε * (c₂ + c₁) := by -+ calc -+ (n₁ : ℝ) - n₀ ≤ X * (1 + c₂ * ε) - n₀ := by -+ exact sub_le_sub_right n₁_le ↑n₀ -+ _ ≤ X * (1 + c₂ * ε) - (X * (1 - c₁ * ε)) := by -+ exact tsub_le_tsub_left n₀_gt (X * (1 + c₂ * ε)) -+ _ = X * ε * (c₂ + c₁) := by ring -+ -+ have : (∑' (n : ℕ), Λ (n + n₀ : ) * F ((n + n₀ : ) / X)) = -+ (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((n + n₀) / X)) + -+ (∑' (n : ℕ), Λ (n + n₁ : ) * F ((n + n₁ : ) / X)) := by -+ rw[← Summable.sum_add_tsum_nat_add' (k := n₁ - n₀)] -+ congr! 5 -+ · simp only [Nat.cast_add] -+ · omega -+ · congr! 1 -+ norm_cast -+ omega -+ · convert sumΛn₀ ((n₁ - n₀) + n₀) using 4 -+ · omega -+ · congr! 1 -+ norm_cast -+ omega -+ -+ rw [this] -+ clear this -+ -+ have : (∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X)) = Λ (n₁) * F (↑n₁ / X) := by -+ have : (∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X)) = Λ (n₁) * F (↑n₁ / X) + (∑' (n : ℕ), Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X)) := by -+ let fTemp := fun n ↦ Λ (n + n₁) * F ((↑n + ↑n₁) / X) -+ have sum_fTemp : Summable fTemp := by exact sumΛn₀ n₁ -+ have hTemp (n : ℕ): fTemp n = Λ (n + n₁) * F (↑(n + n₁) / X) := by rw[Nat.cast_add] -+ have : ∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X) = ∑' (n : ℕ), fTemp n := by exact Eq.symm (tsum_congr hTemp) -+ rw[this] -+ have (n : ℕ): fTemp (n + 1) = Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X) := by exact hTemp (n + 1) -+ have : ∑' (n : ℕ), Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X) = ∑' (n : ℕ), fTemp (n + 1) := by exact Eq.symm (tsum_congr this) -+ rw[this] -+ have : Λ n₁ * F (↑n₁ / X) = fTemp 0 := by -+ dsimp only [fTemp] -+ rw[← Nat.cast_add, zero_add] -+ rw[this] -+ exact Summable.tsum_eq_zero_add (sumΛn₀ n₁) -+ rw[this] -+ apply add_eq_left.mpr -+ convert tsum_zero with n -+ have : n₁ ≤ n + (n₁) := by exact Nat.le_add_left (n₁) n -+ convert mul_zero _ -+ convert smoothIs0 (n + 1 + n₁) ?_ -+ rw[← mul_le_mul_iff_left₀ X_pos] -+ have : ↑(n + 1 + n₁) / X * X = ↑(n + 1 + n₁) := by field_simp -+ rw[this] -+ have : (1 + c₂ * ε) * X = 1 + (X * (1 + c₂ * ε) - 1) := by ring -+ rw[this, Nat.cast_add, Nat.cast_add] -+ exact add_le_add (by bound) n₁_ge -+ -+ rw [this] -+ clear this -+ -+ have X_le_floor_add_one : X ≤ ↑⌊X + 1⌋₊ := by -+ rw[Nat.floor_add_one, Nat.cast_add, Nat.cast_one] -+ have temp : X ≤ ↑⌈X⌉₊ := by exact Nat.le_ceil X -+ have : (⌈X⌉₊ : ℝ) ≤ ↑⌊X⌋₊ + 1 := by exact_mod_cast Nat.ceil_le_floor_add_one X -+ exact Preorder.le_trans X (↑⌈X⌉₊) (↑⌊X⌋₊ + 1) temp this -+ positivity -+ -+ have floor_X_add_one_le_self : ↑⌊X + 1⌋₊ ≤ X + 1 := by exact Nat.floor_le (by positivity) -+ -+ have : ∑ x ∈ Finset.range ⌊X + 1⌋₊, Λ x = -+ (∑ x ∈ Finset.range n₀, Λ x) + -+ ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + ↑n₀) := by -+ simp only [add_comm _ n₀] -+ rw [← Finset.sum_range_add, Nat.add_sub_of_le] -+ dsimp only [n₀] -+ refine Nat.ceil_le.mpr ?_ -+ exact Preorder.le_trans (X * (1 - c₁ * ε)) X (↑⌊X + 1⌋₊) n₀_inside_le_X X_le_floor_add_one -+ rw [this] -+ clear this -+ -+ have : ∑ n ∈ Finset.range n₀, Λ n * F (↑n / X) = -+ ∑ n ∈ Finset.range n₀, Λ n := by -+ apply Finset.sum_congr rfl -+ intro n hn -+ by_cases n_zero : n = 0 -+ · rw [n_zero] -+ simp only [ArithmeticFunction.map_zero, CharP.cast_eq_zero, zero_div, zero_mul] -+ · convert mul_one _ -+ convert smoothIs1 n (Nat.zero_lt_of_ne_zero n_zero) ?_ -+ simp only [Finset.mem_range, n₀] at hn -+ have : (n < ⌈X * (1 - c₁ * ε)⌉₊) → (n ≤ ⌊X * (1 - c₁ * ε)⌋₊) := by -+ intro n_lt -+ by_contra hcontra -+ -+ rw[not_le] at hcontra -+ -+ have temp1: (⌊X * (1 - c₁ * ε)⌋₊).succ.succ ≤ n.succ := by -+ apply Nat.succ_le_succ -+ exact Nat.succ_le_of_lt hcontra -+ have : n.succ ≤ ⌈X * (1 - c₁ * ε)⌉₊ := by exact Nat.succ_le_of_lt hn -+ have temp2: ⌊X * (1 - c₁ * ε)⌋₊ + 2 = (⌊X * (1 - c₁ * ε)⌋₊ + 1) + 1 := by ring -+ have : ⌊X * (1 - c₁ * ε)⌋₊ + 2 ≤ ⌈X * (1 - c₁ * ε)⌉₊ := by -+ rw[temp2, ← Nat.succ_eq_add_one, ← Nat.succ_eq_add_one] -+ exact Nat.le_trans temp1 hn -+ rw[← and_not_self_iff (⌊X * (1 - c₁ * ε)⌋₊ + 2 ≤ ⌈X * (1 - c₁ * ε)⌉₊), not_le] -+ apply And.intro -+ exact this -+ rw[temp2, ← Nat.succ_eq_add_one, Nat.lt_succ_iff] -+ exact Nat.ceil_le_floor_add_one (X * (1 - c₁ * ε)) -+ exact (Nat.le_floor_iff' n_zero).mp (this hn) -+ -+ rw [this, sub_eq_add_neg, add_assoc, add_assoc] -+ nth_rewrite 3 [add_comm] -+ nth_rewrite 2 [← add_assoc] -+ rw [← add_assoc, ← add_assoc, ← sub_eq_add_neg] -+ clear this -+ -+ have : -+ ∑ n ∈ Finset.range n₀, Λ n + (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X)) - -+ (∑ x ∈ Finset.range n₀, Λ x + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀)) -+ = -+ (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X)) - -+ (∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀)) := by -+ ring -+ rw [this] -+ clear this -+ -+ have : -+ ‖∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X) - ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀) + Λ n₁ * F (↑n₁ / X)‖ -+ ≤ -+ (∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖) + -+ ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + -+ ‖Λ n₁‖ * ‖F (↑n₁ / X)‖:= by -+ apply norm_add_le_of_le -+ apply norm_sub_le_of_le -+ apply norm_sum_le_of_le -+ intro b hb -+ exact norm_mul_le_of_le (by rfl) (by rfl) -+ apply norm_sum_le_of_le -+ intro b hb -+ rfl -+ exact_mod_cast norm_mul_le_of_le (by rfl) (by rfl) -+ -+ refine this.trans ?_ -+ -+ clear this -+ -+ have vonBnd1 : -+ ∀ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ ≤ Real.log (X * (1 + c₂ * ε)) := by -+ intro n hn -+ have n_add_n0_le_n1: (n : ℝ) + n₀ ≤ n₁ := by -+ apply le_of_lt -+ rw[Finset.mem_range] at hn -+ rw[← add_lt_add_iff_right (-↑n₀), add_neg_cancel_right, add_comm, ← sub_eq_neg_add] -+ exact_mod_cast hn -+ have inter1: ‖ Λ (n + n₀)‖ ≤ Real.log (↑n + ↑n₀) := by -+ rw[Real.norm_of_nonneg, ← Nat.cast_add] -+ apply ArithmeticFunction.vonMangoldt_le_log -+ apply ArithmeticFunction.vonMangoldt_nonneg -+ have inter2: Real.log (↑n + ↑n₀) ≤ Real.log (↑n₁) := by exact_mod_cast Real.log_le_log (by positivity) n_add_n0_le_n1 -+ have inter3: Real.log (↑n₁) ≤ Real.log (X * (1 + c₂ * ε)) := by exact Real.log_le_log (by bound) (by linarith) -+ exact inter1.trans (inter2.trans inter3) -+ -+ have bnd1 : -+ ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ -+ ≤ (n₁ - n₀) * Real.log (X * (1 + c₂ * ε)) := by -+ have : (n₁ - n₀) * Real.log (X * (1 + c₂ * ε)) = (∑ n ∈ Finset.range (n₁ - n₀), Real.log (X * (1 + c₂ * ε))) := by -+ rw[← Nat.cast_sub] -+ nth_rewrite 1 [← Finset.card_range (n₁ - n₀)] -+ rw[Finset.cast_card, Finset.sum_const, smul_one_mul] -+ exact Eq.symm (Finset.sum_const (Real.log (X * (1 + c₂ * ε)))) -+ exact n₁_ge_n₀ -+ rw [this] -+ apply Finset.sum_le_sum -+ intro n hn -+ rw [← mul_one (Real.log (X * (1 + c₂ * ε)))] -+ apply mul_le_mul (vonBnd1 _ hn) _ (norm_nonneg _) (log_nonneg (by bound)) -+ rw[Real.norm_of_nonneg, ← Nat.cast_add] -+ dsimp only [F] -+ apply smooth1BddAbove -+ bound -+ rw[← Nat.cast_add] -+ dsimp only [F] -+ apply smooth1BddBelow -+ bound -+ -+ have bnd2 : -+ ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ ≤ (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) := by -+ have : (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) = (∑ n ∈ Finset.range (⌊X + 1⌋₊ - n₀), Real.log (X + 1)) := by -+ rw[← Nat.cast_sub] -+ nth_rewrite 1 [← Finset.card_range (⌊X + 1⌋₊ - n₀)] -+ rw[Finset.cast_card, Finset.sum_const, smul_one_mul] -+ exact Eq.symm (Finset.sum_const (Real.log (X + 1))) -+ simp only [Nat.ceil_le, n₀] -+ exact Preorder.le_trans (X * (1 - c₁ * ε)) X (↑⌊X + 1⌋₊) n₀_inside_le_X X_le_floor_add_one -+ rw[this] -+ apply Finset.sum_le_sum -+ intro n hn -+ have n_add_n0_le_X_add_one: (n : ℝ) + n₀ ≤ X + 1 := by -+ rw[Finset.mem_range] at hn -+ rw[← add_le_add_iff_right (-↑n₀), add_assoc, ← sub_eq_add_neg, sub_self, add_zero, ← sub_eq_add_neg] -+ have temp: (n : ℝ) < ⌊X + 1⌋₊ - n₀ := by -+ rw[← Nat.cast_sub, Nat.cast_lt] -+ exact hn -+ simp only [Nat.ceil_le, n₀] -+ exact le_trans n₀_inside_le_X X_le_floor_add_one -+ have : ↑⌊X + 1⌋₊ - ↑n₀ ≤ X + 1 - ↑n₀ := by -+ apply sub_le_sub_right floor_X_add_one_le_self -+ exact le_of_lt (lt_of_le_of_lt' this temp) -+ have inter1: ‖ Λ (n + n₀)‖ ≤ Real.log (↑n + ↑n₀) := by -+ rw[Real.norm_of_nonneg, ← Nat.cast_add] -+ apply ArithmeticFunction.vonMangoldt_le_log -+ apply ArithmeticFunction.vonMangoldt_nonneg -+ apply le_trans inter1 -+ exact_mod_cast Real.log_le_log (by positivity) (n_add_n0_le_X_add_one) -+ -+ have largeSumBound := add_le_add bnd1 bnd2 -+ -+ clear vonBnd1 bnd1 bnd2 -+ -+ have inter1 : Real.log (X * (1 + c₂ * ε)) ≤ Real.log (3 * X) := by -+ apply Real.log_le_log (by positivity) -+ have const_le_2: 1 + c₂ * ε ≤ 3 := by -+ have : (3 : ℝ) = 1 + 2 := by ring -+ rw[this] -+ apply add_le_add_right -+ rw[← mul_one 2] -+ exact mul_le_mul (by linarith) (by linarith) (by positivity) (by positivity) -+ rw[mul_comm] -+ exact mul_le_mul const_le_2 (by rfl) (by positivity) (by positivity) -+ -+ have inter2 : (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) ≤ (X * ε * (c₂ + c₁)) * (Real.log (X) + Real.log (3)) := by -+ apply mul_le_mul n₁_sub_n₀ _ (log_nonneg (by linarith)) (by positivity) -+ rw[← Real.log_mul (by positivity) (by positivity)] -+ nth_rewrite 3 [mul_comm] -+ exact inter1 -+ -+ have inter3 : (X * ε * (c₂ + c₁)) * (Real.log (X) + Real.log (3)) ≤ 2 * (X * ε * (c₂ + c₁)) * (Real.log (X)) := by -+ nth_rewrite 3 [mul_assoc] -+ rw[two_mul, mul_add] -+ apply add_le_add_right -+ apply mul_le_mul_of_nonneg_left _ (by positivity) -+ exact Real.log_le_log (by positivity) (by linarith) -+ -+ have inter4 : (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) ≤ 2 * (X * ε * (c₁ + c₂)) * (Real.log (X)) := by -+ nth_rewrite 2 [add_comm] -+ exact le_trans inter2 inter3 -+ -+ clear inter2 inter3 -+ -+ have inter6 : (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) ≤ 2 * (X * ε * c₁) * (Real.log (X) + Real.log (3)) := by -+ apply mul_le_mul _ _ (log_nonneg (by linarith)) (by positivity) -+ have : 2 * (X * ε * c₁) = (X * (1 + ε * c₁)) - (X * (1 - ε * c₁)) := by ring -+ rw[this] -+ apply sub_le_sub -+ have : X + 1 ≤ X * (1 + ε * c₁) := by -+ ring_nf -+ rw[add_comm, add_le_add_iff_left] -+ exact X_bound_1 -+ exact le_trans floor_X_add_one_le_self this -+ nth_rewrite 2 [mul_comm] -+ exact n₀_gt -+ rw[← Real.log_mul (by positivity) (by norm_num), mul_comm] -+ exact Real.log_le_log (by positivity) (by linarith) -+ -+ have inter7: 2 * (X * ε * c₁) * (Real.log (X) + Real.log (3)) ≤ 4 * (X * ε * c₁) * Real.log (X) := by -+ have : (4 : ℝ) = 2 + 2 := by ring -+ rw[this, mul_add] -+ nth_rewrite 5 [mul_assoc] -+ rw[add_mul] -+ apply add_le_add -+ nth_rewrite 1 [mul_assoc] -+ rfl -+ nth_rewrite 1 [mul_assoc] -+ apply mul_le_mul_of_nonneg_left _ (by norm_num) -+ apply mul_le_mul_of_nonneg_left <| Real.log_le_log (by positivity) (by linarith) -+ positivity -+ -+ have inter9: (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) + (↑⌊X + 1⌋₊ - ↑n₀) * Real.log (X + 1) ≤ -+ 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X := by -+ have : 2 * (X * ε * (3 * c₁ + c₂)) = 2 * (X * ε * (c₁ + c₂)) + 4 * (X * ε * c₁) := by ring -+ rw[this, add_mul] -+ exact add_le_add inter4 <| le_trans inter6 inter7 -+ -+ have largeSumBound2 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ ≤ -+ 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X := by -+ exact le_trans largeSumBound inter9 -+ -+ clear largeSumBound inter4 inter9 -+ -+ have inter2 : ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ Real.log (X * (1 + c₂ * ε)) := by -+ rw[← mul_one (Real.log (X * (1 + c₂ * ε)))] -+ apply mul_le_mul _ _ (norm_nonneg _) (log_nonneg (by bound)) -+ rw[Real.norm_of_nonneg ArithmeticFunction.vonMangoldt_nonneg] -+ exact le_trans ArithmeticFunction.vonMangoldt_le_log <| Real.log_le_log (mod_cast n₁_pos) n₁_le -+ rw[Real.norm_of_nonneg] -+ apply smooth1BddAbove _ n₁_pos -+ apply smooth1BddBelow _ n₁_pos -+ -+ have largeSumBound3 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + -+ ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X + Real.log (3 * X) := by exact add_le_add largeSumBound2 (le_trans inter2 inter1) -+ clear inter1 inter2 largeSumBound2 -+ -+ have largeSumBound4 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + -+ ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ 2 * (X * ε * (3 * c₁ + c₂)) * (2 * Real.log X + Real.log (3)) := by -+ nth_rewrite 2 [two_mul, add_assoc] -+ rw [← Real.log_mul (by positivity) (by positivity), mul_comm X 3] -+ apply le_trans largeSumBound3 -+ nth_rewrite 2 [mul_add] -+ apply add_le_add_right -+ nth_rewrite 1 [← one_mul (Real.log (3 * X))] -+ apply mul_le_mul_of_nonneg_right _ (log_nonneg (by linarith)) -+ linarith -+ -+ clear largeSumBound3 -+ -+ have largeSumBoundFinal : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + -+ ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ (6 * (X * ε * (3 * c₁ + c₂))) * Real.log (X) := by -+ apply le_trans largeSumBound4 -+ rw[mul_add] -+ have : (6 : ℝ) = 4 + 2 := by ring -+ rw[this, add_mul, add_mul] -+ apply add_le_add -+ ring_nf -+ rfl -+ apply mul_le_mul_of_nonneg_left _ (by positivity) -+ exact Real.log_le_log (by positivity) (by linarith) -+ -+ clear largeSumBound4 -+ -+ rw[C_eq] -+ linear_combination largeSumBoundFinal -+ -+theorem SmoothedChebyshevClose {SmoothingF : ℝ → ℝ} -+ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) -+ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : -+ ∃ C > 0, ∀ (X : ℝ) (_ : 3 < X) (ε : ℝ) (_ : 0 < ε) (_ : ε < 1) (_ : 2 < X * ε), -+ ‖SmoothedChebyshev SmoothingF ε X - ChebyshevPsi X‖ ≤ C * ε * X * Real.log X := by -+ have vonManBnd (n : ℕ) : ArithmeticFunction.vonMangoldt n ≤ Real.log n := -+ ArithmeticFunction.vonMangoldt_le_log -+ -+ obtain ⟨c₁, c₁_pos, c₁_eq, hc₁⟩ := Smooth1Properties_below suppSmoothingF mass_one -+ -+ obtain ⟨c₂, c₂_pos, c₂_eq, hc₂⟩ := Smooth1Properties_above suppSmoothingF -+ -+ have c₁_lt : c₁ < 1 := by -+ rw[c₁_eq] -+ exact lt_trans (Real.log_two_lt_d9) (by norm_num) -+ -+ have c₂_lt : c₂ < 2 := by -+ rw[c₂_eq] -+ nth_rewrite 3 [← mul_one 2] -+ apply mul_lt_mul' -+ rfl -+ exact lt_trans (Real.log_two_lt_d9) (by norm_num) -+ exact Real.log_nonneg (by norm_num) -+ positivity -+ -+ let C : ℝ := 6 * (3 * c₁ + c₂) -+ have C_eq : C = 6 * (3 * c₁ + c₂) := rfl -+ -+ clear_value C -+ -+ have Cpos : 0 < C := by -+ rw [C_eq] -+ positivity -+ -+ refine ⟨C, Cpos, fun X X_ge_C ε εpos ε_lt_one ↦ ?_⟩ -+ unfold ChebyshevPsi -+ -+ have X_gt_zero : (0 : ℝ) < X := by linarith -+ -+ have X_ne_zero : X ≠ 0 := by linarith -+ -+ have n_on_X_pos {n : ℕ} (npos : 0 < n) : -+ 0 < n / X := by -+ have : (0 : ℝ) < n := by exact_mod_cast npos -+ positivity -+ -+ have smooth1BddAbove (n : ℕ) (npos : 0 < n) : -+ Smooth1 SmoothingF ε (n / X) ≤ 1 := -+ Smooth1LeOne SmoothingFnonneg mass_one εpos (n_on_X_pos npos) -+ -+ have smooth1BddBelow (n : ℕ) (npos : 0 < n) : -+ Smooth1 SmoothingF ε (n / X) ≥ 0 := -+ Smooth1Nonneg SmoothingFnonneg (n_on_X_pos npos) εpos -+ -+ have smoothIs1 (n : ℕ) (npos : 0 < n) (n_le : n ≤ X * (1 - c₁ * ε)) : -+ Smooth1 SmoothingF ε (↑n / X) = 1 := by -+ apply hc₁ (ε := ε) (n / X) εpos (n_on_X_pos npos) -+ exact (div_le_iff₀' X_gt_zero).mpr n_le -+ -+ have smoothIs0 (n : ℕ) (n_le : (1 + c₂ * ε) ≤ n / X) := -+ hc₂ (ε := ε) (n / X) ⟨εpos, ε_lt_one⟩ n_le -+ -+ have ε_pos: ε > 0 := by linarith -+ have X_pos: X > 0 := by linarith -+ have X_gt_three : 3 < X := by linarith -+ -+ intro X_bound -+ -+ have X_bound_1 : 1 ≤ X * ε * c₁ := by -+ rw[c₁_eq, ← div_le_iff₀] -+ have : 1 / Real.log 2 < 2 := by -+ nth_rewrite 2 [← one_div_one_div 2] -+ rw[one_div_lt_one_div] -+ exact lt_of_le_of_lt (by norm_num) (Real.log_two_gt_d9) -+ exact Real.log_pos (by norm_num) -+ norm_num -+ apply le_of_lt -+ exact gt_trans X_bound this -+ exact Real.log_pos (by norm_num) -+ -+ have X_bound_2 : 1 ≤ X * ε * c₂ := by -+ rw[c₂_eq, ← div_le_iff₀] -+ have : 1 / (2 * Real.log 2) < 2 := by -+ nth_rewrite 3 [← one_div_one_div 2] -+ rw[one_div_lt_one_div, ← one_mul (1 / 2)] -+ apply mul_lt_mul -+ norm_num -+ apply le_of_lt -+ exact lt_trans (by norm_num) (Real.log_two_gt_d9) -+ all_goals norm_num -+ exact Real.log_pos (by norm_num) -+ -+ apply le_of_lt -+ exact gt_trans X_bound this -+ norm_num -+ exact Real.log_pos (by norm_num) -+ -+ rw [SmoothedChebyshevDirichlet diffSmoothingF SmoothingFnonneg suppSmoothingF -+ mass_one (by linarith) εpos ε_lt_one] -+ -+ convert SmoothedChebyshevClose_aux SmoothingF c₁ c₁_pos c₁_lt c₂ c₂_pos c₂_lt hc₂ C C_eq ε ε_pos ε_lt_one -+ X X_pos X_gt_three X_bound_1 X_bound_2 smooth1BddAbove smooth1BddBelow smoothIs1 smoothIs0 -+ -+@[inline] noncomputable def sigma1Of (A T : ℝ) : ℝ := 1 - A / Real.log T -+ -+noncomputable def I₁ (SmoothingF : ℝ → ℝ) (ε X T : ℝ) : ℂ := -+ (1 / (2 * π * I)) * (I * (∫ t : ℝ in Iic (-T), -+ SmoothedChebyshevIntegrand SmoothingF ε X ((1 + (Real.log X)⁻¹) + t * I))) -+ -+noncomputable def I₂ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := -+ (1 / (2 * π * I)) * ((∫ σ in σ₁..(1 + (Real.log X)⁻¹), -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ - T * I))) -+ -+noncomputable def I₃₇ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := -+ (1 / (2 * π * I)) * (I * (∫ t in (-T)..T, -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) -+ -+noncomputable def I₈ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := -+ (1 / (2 * π * I)) * ((∫ σ in σ₁..(1 + (Real.log X)⁻¹), -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ + T * I))) -+ -+noncomputable def I₉ (SmoothingF : ℝ → ℝ) (ε X T : ℝ) : ℂ := -+ (1 / (2 * π * I)) * (I * (∫ t : ℝ in Ici T, -+ SmoothedChebyshevIntegrand SmoothingF ε X ((1 + (Real.log X)⁻¹) + t * I))) -+ -+noncomputable def I₃ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := -+ (1 / (2 * π * I)) * (I * (∫ t in (-T)..(-3), -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) -+ -+noncomputable def I₇ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := -+ (1 / (2 * π * I)) * (I * (∫ t in (3 : ℝ)..T, -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) -+ -+noncomputable def I₄ (SmoothingF : ℝ → ℝ) (ε X σ₁ σ₂ : ℝ) : ℂ := -+ (1 / (2 * π * I)) * ((∫ σ in σ₂..σ₁, -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ - 3 * I))) -+ -+noncomputable def I₆ (SmoothingF : ℝ → ℝ) (ε X σ₁ σ₂ : ℝ) : ℂ := -+ (1 / (2 * π * I)) * ((∫ σ in σ₂..σ₁, -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ + 3 * I))) -+ -+noncomputable def I₅ (SmoothingF : ℝ → ℝ) (ε X σ₂ : ℝ) : ℂ := -+ (1 / (2 * π * I)) * (I * (∫ t in (-3)..3, -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ₂ + t * I))) -+ -+theorem realDiff_of_complexDiff {f : ℂ → ℂ} (s : ℂ) (hf : DifferentiableAt ℂ f s) : -+ ContinuousAt (fun (x : ℝ) ↦ f (s.re + x * I)) s.im := by -+ apply ContinuousAt.comp _ (by fun_prop) -+ convert hf.continuousAt -+ simp -+ -+theorem riemannZeta_bdd_on_vertical_lines {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) (t : ℝ) : -+ ∃ c > 0, ‖ζ (σ₀ + t * I)‖ ≤ c := -+ by -+ let s := σ₀ + t * I -+ let s_re : ℂ := σ₀ -+ -+ have H : s.re = σ₀ := by -+ rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] -+ simp -+ -+ have non_neg : σ₀ ≠ 0 := by -+ by_contra h -+ rw [h] at σ₀_gt -+ norm_cast at σ₀_gt -+ -+ have pos : s.re > 1 := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm H)) -+ have pos_triv : s_re.re > 1 := by exact σ₀_gt -+ -+ have series := LSeries_one_eq_riemannZeta pos -+ rw [← series] -+ -+ have identity : ∀(n : ℕ), ‖LSeries.term 1 s n‖ = 1 / n^σ₀ := by -+ unfold LSeries.term -+ intro n -+ by_cases h0 : n = 0 -+ · simp [*] -+ · simp [*] -+ push Not at h0 -+ have C : n > 0 := by exact Nat.zero_lt_of_ne_zero h0 -+ have T := Complex.norm_natCast_cpow_of_pos C s -+ rw [H] at T -+ exact T -+ -+ have summable : Summable (fun (n : ℕ) ↦ ‖LSeries.term 1 s n‖) := by -+ simp [identity] -+ exact σ₀_gt -+ -+ have B := calc -+ ‖∑' (n : ℕ), LSeries.term 1 s n‖ ≤ ∑' (n : ℕ), ‖LSeries.term 1 s n‖ := norm_tsum_le_tsum_norm summable -+ _ ≤ ∑' (n : ℕ), (1 / ↑n^σ₀) := by simp [← identity] -+ _ ≤ norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) := by exact le_norm_self (∑' (n : ℕ), 1 / ↑n ^ σ₀) -+ _ ≤ 1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) := by linarith -+ -+ let c : ℝ := 1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) -+ -+ have c_is_pos : c > 0 := by positivity -+ use (1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ )) -+ exact ⟨c_is_pos, B⟩ -+ -+theorem summable_real_iff_summable_coe_complex (f : ℕ → ℝ) : -+ Summable f ↔ Summable (fun n => (f n : ℂ)) := by -+ constructor -+ -+ · intro ⟨s, hs⟩ -+ use (s : ℂ) -+ exact hasSum_ofReal.mpr hs -+ -+ · intro ⟨s, hs⟩ -+ use s.re -+ have h_re : HasSum (fun n => ((f n : ℂ)).re) s.re := -+ by exact hasSum_re hs -+ simpa using! h_re -+ -+theorem cast_pow_eq (n : ℕ) (σ₀ : ℝ): -+ (↑((↑n : ℝ) ^ σ₀) : ℂ ) = (↑n : ℂ) ^ (↑σ₀ : ℂ) := by -+ have U : (↑n : ℝ) ≥ 0 := by exact Nat.cast_nonneg' n -+ have endit := Complex.ofReal_cpow U σ₀ -+ exact endit -+ -+theorem strongPnt_summable_complex_then_summable_real_part (f : ℕ → ℂ) : -+ Summable f → Summable (fun n ↦ (f n).re) := by -+ intro ⟨s, hs⟩ -+ use s.re -+ have h_re : HasSum (fun n => ((f n : ℂ)).re) s.re := -+ by exact hasSum_re hs -+ convert h_re using 1 -+ -+theorem strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized : -+ ∀(σ₀ σ₁ : ℝ), ∀(t : ℝ), 1 < σ₀ → σ₀ ≤ σ₁ → -+ ‖(- ζ' (σ₁ + t * I) / ζ (σ₁ + t * I))‖ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by -+ intro σ₀ σ₁ t σ₀_gt_one σ₀_lt_σ₁ -+ -+ let s₁ := σ₁ + t * I -+ have s₁_re_eq_sigma : s₁.re = σ₁ := by -+ rw [Complex.add_re (σ₁) (t * I)] -+ rw [Complex.ofReal_re σ₁] -+ rw [Complex.mul_I_re] -+ simp [*] -+ -+ have s₀_re_eq_sigma : (↑σ₀ : ℂ).re = σ₀ := by -+ rw [Complex.ofReal_re σ₀] -+ -+ let s₀ := σ₀ -+ -+ have σ₁_gt_one : 1 < σ₁ := by exact lt_of_le_of_lt' σ₀_lt_σ₁ σ₀_gt_one -+ have s₀_gt_one : 1 < (↑σ₀ : ℂ).re := by exact σ₀_gt_one -+ -+ have s₁_re_geq_one : 1 < s₁.re := by exact lt_of_lt_of_eq σ₁_gt_one (id (Eq.symm s₁_re_eq_sigma)) -+ have s₁_re_coerce_geq_one : 1 < (↑s₁.re : ℂ).re := by exact s₁_re_geq_one -+ rw [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₁_re_geq_one)] -+ unfold LSeries -+ -+ have summable_von_mangoldt : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) s₁.re i) := by -+ exact ArithmeticFunction.LSeriesSummable_vonMangoldt s₁_re_geq_one -+ -+ have summable_von_mangoldt_at_σ₀ : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i) := by -+ exact ArithmeticFunction.LSeriesSummable_vonMangoldt σ₀_gt_one -+ -+ have summable_re_von_mangoldt : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) s₁.re i).re) := by -+ exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) s₁.re) summable_von_mangoldt -+ -+ have summable_re_von_mangoldt_at_σ₀ : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i).re) := by -+ exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) σ₀) summable_von_mangoldt_at_σ₀ -+ -+ have positivity : ∀(n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ = (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by -+ intro n -+ calc -+ ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ = Λ n / ‖(↑n : ℂ)^(s₁ : ℂ)‖ := by -+ unfold LSeries.term -+ by_cases h : n = 0 -+ · simp [*] -+ · push Not at h -+ simp [*] -+ -+ _ = Λ n / (↑n)^s₁.re := by -+ by_cases h : n = 0 -+ · simp [*] -+ · rw [Complex.norm_natCast_cpow_of_pos] -+ push Not at h -+ exact Nat.zero_lt_of_ne_zero h -+ -+ _ = (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by -+ unfold LSeries.term -+ by_cases h : n = 0 -+ · simp [*] -+ · simp [*] -+ push Not at h -+ ring_nf -+ rw [Complex.re_ofReal_mul (Λ n)] -+ ring_nf -+ rw [Complex.inv_re] -+ rw [Complex.cpow_ofReal_re] -+ simp [*] -+ left -+ have N : (0 : ℝ) ≤ ↑n := by exact Nat.cast_nonneg' n -+ have T2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).re = (↑n : ℝ)^σ₁ := by exact rfl -+ have T1 : ((↑n : ℂ ) ^ (↑σ₁ : ℂ)).im = 0 := by -+ refine abs_re_eq_norm.mp ?_ -+ rw [T2] -+ simp [*] -+ exact Real.rpow_nonneg N σ₁ -+ -+ simp [Complex.normSq_apply] -+ simp [T1, T2] -+ -+ have summable_abs_value : Summable (fun i ↦ ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ i‖) := by -+ rw [summable_congr positivity] -+ exact summable_re_von_mangoldt -+ -+ have triangle_ineq : ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), ↑‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ := -+ norm_tsum_le_tsum_norm summable_abs_value -+ -+ have bounded_by_sum_of_re : ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n).re := -+ by -+ simp [positivity] at triangle_ineq -+ exact triangle_ineq -+ -+ have sum_of_re_commutes : ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n).re = (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)).re := -+ (Complex.re_tsum (summable_von_mangoldt)).symm -+ -+ have re_of_sum_bdd_by_norm : (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)).re ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)‖ := -+ Complex.re_le_norm (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)) -+ -+ have ineq_s₁_s₀ : ∀(n : ℕ), -+ (LSeries.term (fun n ↦ Λ n) s₁.re n).re ≤ (LSeries.term (fun n ↦ Λ n) σ₀ n).re := -+ by -+ intro n -+ unfold LSeries.term -+ by_cases h : n = 0 -+ · simp [*] -+ · push Not at h -+ simp [*] -+ have H : 0 ≤ Λ n := ArithmeticFunction.vonMangoldt_nonneg -+ ring_nf -+ rw [Complex.re_ofReal_mul (Λ n) ((↑n : ℂ) ^ (↑σ₁ : ℂ))⁻¹] -+ rw [Complex.re_ofReal_mul (Λ n) ((↑n : ℂ) ^ (↑σ₀ : ℂ))⁻¹] -+ refine mul_le_mul_of_nonneg_left ?_ H -+ · simp [Complex.inv_re] -+ have R1 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).re = (↑n : ℝ) ^ σ₀ := rfl -+ have R2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).re = (↑n : ℝ) ^ σ₁ := rfl -+ have geq : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h -+ have geq_zero : 0 ≤ n := Nat.zero_le n -+ have n_geq_one : (1 : ℝ) ≤ ↑n := by -+ norm_cast -+ have n_geq_pos : (0 : ℝ) ≤ ↑n := by -+ norm_cast -+ have n_gt_pos : (0 : ℝ) < (↑n) := by -+ norm_cast -+ -+ have I1 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).im = 0 := by -+ refine abs_re_eq_norm.mp ?_ -+ rw [R1] -+ simp [*] -+ exact Real.rpow_nonneg n_geq_pos σ₀ -+ -+ have I2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).im = 0 := by -+ refine abs_re_eq_norm.mp ?_ -+ rw [R2] -+ simp [*] -+ exact Real.rpow_nonneg n_geq_pos σ₁ -+ -+ simp [Complex.normSq_apply, R1, R2, I1, I2] -+ have P1 : 0 < (↑n : ℝ)^σ₁ := Real.rpow_pos_of_pos n_gt_pos σ₁ -+ have P2 : 0 < (↑n : ℝ)^σ₀ := Real.rpow_pos_of_pos n_gt_pos σ₀ -+ -+ have N : (↑n : ℝ)^σ₀ ≤ (↑n : ℝ)^σ₁ := -+ Real.rpow_le_rpow_of_exponent_le n_geq_one σ₀_lt_σ₁ -+ apply inv_anti₀ -+ · exact P2 -+ · exact N -+ -+ have Z := -+ by -+ calc -+ ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ -+ := norm_tsum_le_tsum_norm summable_abs_value -+ _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by simp [←positivity] -+ _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n).re := by -+ refine Summable.tsum_mono ?_ ?_ ineq_s₁_s₀ -+ · exact summable_re_von_mangoldt -+ · exact summable_re_von_mangoldt_at_σ₀ -+ _ = (∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n)).re := (Complex.re_tsum (summable_von_mangoldt_at_σ₀)).symm -+ _ ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n)‖ := re_le_norm (∑' (n : ℕ), LSeries.term (fun n ↦ ↑(Λ n)) σ₀ n) -+ _ = ‖- ζ' (σ₀) / ζ (σ₀)‖ := by -+ simp only [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₀_gt_one)] -+ unfold LSeries -+ rfl -+ _ = ‖ζ' σ₀ / ζ σ₀‖ := by -+ rw [← s₀_re_eq_sigma] -+ simp [*] -+ -+ exact Z -+ -+theorem strongPnt_triv_bound_zeta : -+ ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ (σ₀ - 1)⁻¹ + C -+ := by -+ -+ let ⟨U, ⟨U_in_nhds, zeta_residue_on_U⟩⟩ := riemannZetaLogDerivResidue -+ -+ let ⟨open_in_U, ⟨open_in_U_subs_U, open_in_U_is_open, one_in_open_U⟩⟩ := mem_nhds_iff.mp U_in_nhds -+ -+ let ⟨ε₀, ⟨ε_pos, metric_ball_around_1_is_in_U'⟩⟩ := EMetric.isOpen_iff.mp open_in_U_is_open (1 : ℂ) one_in_open_U -+ -+ let ε := if ε₀ = ⊤ then ENNReal.ofReal 1 else ε₀ -+ have O1 : ε ≠ ⊤ := by -+ by_cases h : ε₀ = ⊤ -+ · unfold ε -+ simp [*] -+ · unfold ε -+ simp [*] -+ -+ have metric_ball_around_1_is_in_U : -+ Metric.eball (1 : ℂ) ε ⊆ U := by -+ by_cases h : ε₀ = ⊤ -+ · unfold ε -+ simp [*] -+ have T : Metric.eball (1 : ℂ) 1 ⊆ Metric.eball 1 ε₀ := by -+ rw [h] -+ exact Metric.eball_subset_eball (by simp) -+ exact subset_trans (subset_trans T metric_ball_around_1_is_in_U') open_in_U_subs_U -+ -+ · unfold ε -+ -+ simp [h] -+ exact subset_trans metric_ball_around_1_is_in_U' open_in_U_subs_U -+ -+ have O2 : ε ≠ 0 := by -+ by_cases h : ε₀ = ⊤ -+ · unfold ε -+ simp [*] -+ · unfold ε -+ simp [*] -+ exact pos_iff_ne_zero.mp ε_pos -+ -+ let metric_ball_around_1 := Metric.eball (1 : ℂ) ε -+ let ε_div_two := ε / 2 -+ let boundary := ENNReal.toReal (1 + ε_div_two) -+ -+ let ⟨bound, ⟨bound_pos, bound_prop⟩⟩ := -+ BddAbove.exists_ge zeta_residue_on_U 0 -+ -+ have boundary_geq_one : 1 < boundary := by -+ unfold boundary -+ have Z : (1 : ENNReal).toReal = 1 := by rfl -+ rw [←Z] -+ have U : ε_div_two ≠ ⊤ := by -+ refine ENNReal.div_ne_top O1 ?_ -+ simp -+ simp -+ simp [ENNReal.toReal_add _ U] -+ refine ENNReal.toReal_pos ?_ ?_ -+ · unfold ε_div_two -+ simp [*] -+ · exact U -+ -+ let const : ℝ := bound -+ let final_const : ℝ := (boundary - 1)⁻¹ + const -+ have boundary_inv_pos : 0 < (boundary - 1)⁻¹ := by -+ ring_nf -+ apply inv_pos_of_pos -+ simp [*] -+ -+ have final_const_pos : final_const ≥ 0 := by -+ unfold final_const -+ simp [*] -+ have Z := -+ by -+ calc -+ 0 ≤ (boundary - 1)⁻¹ := by simp; linarith -+ _ ≤ (boundary - 1)⁻¹ + const := by unfold const; simp [bound_pos] -+ -+ exact Z -+ -+ have const_le_final_const : const ≤ final_const := by -+ calc -+ const ≤ (boundary - 1)⁻¹ + const := by simp; linarith -+ _ = final_const := by rfl -+ -+ have const_pos : const ≥ 0 := by -+ linarith -+ -+ use final_const -+ use final_const_pos -+ intro σ₀ t σ₀_gt -+ -+ by_cases h : σ₀ ≤ boundary -+ · have σ₀_in_ball : (↑σ₀ : ℂ) ∈ metric_ball_around_1 := by -+ unfold metric_ball_around_1 -+ unfold Metric.eball -+ simp [*] -+ have Z := edist_dist (↑σ₀) (↑1 : ℂ) -+ rw [Z] -+ have U := dist_eq_norm (↑σ₀) (↑1 : ℂ) -+ rw [U] -+ norm_cast -+ have U : 0 ≤ σ₀ - 1 := by linarith -+ have U1 : ‖σ₀ - 1‖ = σ₀ - 1 := by exact norm_of_nonneg U -+ have U2 : ε ≠ ⊤ := by exact O1 -+ have U3 : 0 ≤ ε := by exact zero_le -+ simp [Real.norm_of_nonneg U] -+ simp [ENNReal.ofReal_lt_iff_lt_toReal U U2] -+ have U4 : ENNReal.ofReal 1 ≠ ⊤ := by exact ENNReal.ofReal_ne_top -+ have Z0 : ε_div_two.toReal < ε.toReal := by -+ have T1 : ε ≠ ⊤ := by exact U2 -+ have T2 : ε ≠ 0 := by exact O2 -+ have T3 : ε_div_two < ε := by -+ refine ENNReal.half_lt_self ?_ U2 -+ exact T2 -+ -+ exact ENNReal.toReal_strict_mono T1 T3 -+ -+ have Z := by -+ calc -+ σ₀ - 1 ≤ boundary - 1 := by linarith -+ _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl -+ _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp -+ _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 -+ _ = ENNReal.toReal (ε_div_two) := by simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] -+ _ < ε.toReal := Z0 -+ -+ exact Z -+ -+ have σ₀_in_U : (↑σ₀ : ℂ) ∈ (U \ {1}) := by -+ refine mem_sdiff_singleton.mpr ?_ -+ constructor -+ · unfold metric_ball_around_1 at σ₀_in_ball -+ exact metric_ball_around_1_is_in_U σ₀_in_ball -+ · by_contra a -+ have U : σ₀ = 1 := by exact ofReal_eq_one.mp a -+ rw [U] at σ₀_gt -+ linarith -+ -+ have bdd := Set.forall_mem_image.mp bound_prop (σ₀_in_U) -+ simp [*] at bdd -+ have Z := -+ calc -+ ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by -+ have U := strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized σ₀ σ₀ t (σ₀_gt) (by simp) -+ exact U -+ _ = ‖- ζ' σ₀ / ζ σ₀‖ := by simp only [Complex.norm_div, norm_neg] -+ _ = ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) + (σ₀ - 1)⁻¹‖ := by simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] -+ _ ≤ ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹)‖ + ‖(σ₀ - 1)⁻¹‖ := by -+ have Z := norm_add_le (- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) ((σ₀ - 1)⁻¹) -+ norm_cast at Z -+ _ ≤ const + ‖(σ₀ - 1)⁻¹‖ := by -+ have U := add_le_add_left bdd ‖(σ₀ - 1)⁻¹‖ -+ ring_nf at U -+ ring_nf -+ norm_cast at U -+ norm_cast -+ _ ≤ const + (σ₀ - 1)⁻¹ := by -+ simp [norm_inv] -+ have pos : 0 ≤ σ₀ - 1 := by -+ linarith -+ simp [abs_of_nonneg pos] -+ _ = (σ₀ - 1)⁻¹ + const := by -+ rw [add_comm] -+ _ ≤ (σ₀ - 1)⁻¹ + final_const := by -+ simp [const_le_final_const] -+ -+ exact Z -+ -+ · push Not at h -+ -+ have boundary_geq_one : 1 < boundary := by -+ unfold boundary -+ have Z : (1 : ENNReal).toReal = 1 := by rfl -+ rw [←Z] -+ have U : ε_div_two ≠ ⊤ := by -+ refine ENNReal.div_ne_top O1 ?_ -+ simp -+ simp -+ simp [ENNReal.toReal_add _ U] -+ refine ENNReal.toReal_pos ?_ ?_ -+ · unfold ε_div_two -+ simp [*] -+ · exact U -+ -+ have boundary_in_ball : (↑boundary : ℂ) ∈ metric_ball_around_1 := by -+ unfold metric_ball_around_1 -+ unfold Metric.eball -+ simp [*] -+ have Z := edist_dist (↑boundary) (↑1 : ℂ) -+ rw [Z] -+ have U := dist_eq_norm (↑boundary) (↑1 : ℂ) -+ rw [U] -+ norm_cast -+ have U : 0 ≤ boundary - 1 := by linarith -+ have U1 : ‖boundary - 1‖ = boundary - 1 := by exact norm_of_nonneg U -+ have U2 : ε ≠ ⊤ := by exact O1 -+ have U3 : 0 ≤ ε := by exact zero_le -+ simp [Real.norm_of_nonneg U] -+ simp [ENNReal.ofReal_lt_iff_lt_toReal U U2] -+ have U4 : ENNReal.ofReal 1 ≠ ⊤ := by exact ENNReal.ofReal_ne_top -+ have Z0 : ε_div_two.toReal < ε.toReal := by -+ have T1 : ε ≠ ⊤ := by exact U2 -+ have T2 : ε ≠ 0 := by exact O2 -+ have T3 : ε_div_two < ε := by -+ refine ENNReal.half_lt_self ?_ U2 -+ exact T2 -+ -+ exact ENNReal.toReal_strict_mono T1 T3 -+ -+ have Z := by -+ calc -+ boundary - 1 ≤ boundary - 1 := by linarith -+ _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl -+ _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp -+ _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 -+ _ = ENNReal.toReal (ε_div_two) := by simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] -+ _ < ε.toReal := Z0 -+ -+ exact Z -+ -+ have boundary_in_U : (↑boundary : ℂ) ∈ U \ {1} := by -+ refine mem_sdiff_singleton.mpr ?_ -+ constructor -+ · unfold metric_ball_around_1 at boundary_in_ball -+ exact metric_ball_around_1_is_in_U boundary_in_ball -+ · by_contra a -+ norm_cast at a -+ norm_cast at boundary_geq_one -+ simp [←a] at boundary_geq_one -+ -+ have bdd := Set.forall_mem_image.mp bound_prop (boundary_in_U) -+ -+ have Z := -+ calc -+ ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ ‖ζ' boundary / ζ boundary‖ := by -+ have U := strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized boundary σ₀ t (boundary_geq_one) (by linarith) -+ exact U -+ _ = ‖- ζ' boundary / ζ boundary‖ := by simp only [Complex.norm_div, norm_neg] -+ _ = ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) + (boundary - 1)⁻¹‖ := by simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] -+ _ ≤ ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹)‖ + ‖(boundary - 1)⁻¹‖ := by -+ have Z := norm_add_le (- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) ((boundary - 1)⁻¹) -+ norm_cast at Z -+ _ ≤ const + ‖(boundary - 1)⁻¹‖ := by -+ have U9 := add_le_add_left bdd ‖(boundary - 1)⁻¹‖ -+ ring_nf at U9 -+ ring_nf -+ norm_cast at U9 -+ norm_cast -+ simp [*] at U9 -+ simp [*] -+ exact U9 -+ -+ _ ≤ const + (boundary - 1)⁻¹ := by -+ simp [norm_inv] -+ have pos : 0 ≤ boundary - 1 := by -+ linarith -+ simp [abs_of_nonneg pos] -+ _ = (boundary - 1)⁻¹ + const := by -+ rw [add_comm] -+ _ = final_const := by rfl -+ _ ≤ (σ₀ - 1)⁻¹ + final_const := by -+ have H : 0 ≤ (σ₀ - 1)⁻¹ := by -+ simp -+ linarith -+ -+ simp [H] -+ -+ exact Z -+ -+def LogDerivZetaHasBound (A C : ℝ) : Prop := ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) -+ (_ : σ ∈ Ici (1 - A / Real.log |t|)), ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ -+ C * Real.log |t| ^ 9 -+ -+def LogDerivZetaIsHoloSmall (σ₂ : ℝ) : Prop := -+ HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) -+ (((uIcc σ₂ 2) ×ℂ (uIcc (-3) 3)) \ {1}) -+ -+theorem dlog_riemannZeta_bdd_on_vertical_lines_explicit {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : -+ ∀(t : ℝ), ‖(-ζ' (σ₀ + t * I) / ζ (σ₀ + t * I))‖ ≤ ‖(ζ' σ₀ / ζ σ₀)‖ := by -+ -+ intro t -+ let s := σ₀ + t * I -+ have s_re_eq_sigma : s.re = σ₀ := by -+ rw [Complex.add_re (σ₀) (t * I)] -+ rw [Complex.ofReal_re σ₀] -+ rw [Complex.mul_I_re] -+ simp [*] -+ -+ have s₀_geq_one : 1 < (↑σ₀ : ℂ).re := by exact σ₀_gt -+ have s_re_geq_one : 1 < s.re := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm s_re_eq_sigma)) -+ have s_re_coerce_geq_one : 1 < (↑s.re : ℂ).re := by exact s_re_geq_one -+ rw [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s_re_geq_one)] -+ unfold LSeries -+ -+ have summable_von_mangoldt : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) s.re i) := by -+ exact ArithmeticFunction.LSeriesSummable_vonMangoldt s_re_geq_one -+ -+ have summable_von_mangoldt_at_σ₀ : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i) := by -+ exact ArithmeticFunction.LSeriesSummable_vonMangoldt s₀_geq_one -+ -+ have summable_re_von_mangoldt : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) s.re i).re) := by -+ exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) s.re) summable_von_mangoldt -+ -+ have positivity : ∀(n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ = (LSeries.term (fun n ↦ Λ n) s.re n).re := by -+ intro n -+ calc -+ ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ = Λ n / ‖(↑n : ℂ)^(s : ℂ)‖ := by -+ unfold LSeries.term -+ by_cases h : n = 0 -+ · simp [*] -+ · push Not at h -+ simp [*] -+ -+ _ = Λ n / (↑n)^s.re := by -+ by_cases h : n = 0 -+ · simp [*] -+ · rw [Complex.norm_natCast_cpow_of_pos] -+ push Not at h -+ exact Nat.zero_lt_of_ne_zero h -+ -+ _ = (LSeries.term (fun n ↦ Λ n) s.re n).re := by -+ unfold LSeries.term -+ by_cases h : n = 0 -+ · simp [*] -+ · simp [*] -+ push Not at h -+ ring_nf -+ rw [Complex.re_ofReal_mul (Λ n)] -+ ring_nf -+ rw [Complex.inv_re] -+ rw [Complex.cpow_ofReal_re] -+ simp [*] -+ left -+ have N : (0 : ℝ) ≤ ↑n := by exact Nat.cast_nonneg' n -+ have T2 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).re = (↑n : ℝ)^σ₀ := by exact rfl -+ have T1 : ((↑n : ℂ ) ^ (↑σ₀ : ℂ)).im = 0 := by -+ refine abs_re_eq_norm.mp ?_ -+ rw [T2] -+ simp [*] -+ exact Real.rpow_nonneg N σ₀ -+ -+ simp [Complex.normSq_apply] -+ simp [T1, T2] -+ -+ have summable_abs_value : Summable (fun i ↦ ‖LSeries.term (fun n ↦ ↑(Λ n)) s i‖) := by -+ rw [summable_congr positivity] -+ exact summable_re_von_mangoldt -+ -+ have triangle_ineq : ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), ↑‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ := -+ norm_tsum_le_tsum_norm summable_abs_value -+ -+ have bounded_by_sum_of_re : ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n).re := -+ by -+ simp [positivity] at triangle_ineq -+ exact triangle_ineq -+ -+ have sum_of_re_commutes : ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n).re = (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)).re := -+ (Complex.re_tsum (summable_von_mangoldt)).symm -+ -+ have re_of_sum_bdd_by_norm : (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)).re ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)‖ := -+ Complex.re_le_norm (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)) -+ -+ have Z := -+ by -+ calc -+ ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ -+ := norm_tsum_le_tsum_norm summable_abs_value -+ _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n).re := by simp [←positivity] -+ _ = (∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n)).re := (Complex.re_tsum (summable_von_mangoldt)).symm -+ _ ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n)‖ := re_le_norm (∑' (n : ℕ), LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n) -+ _ = ‖- ζ' (↑s.re) / ζ (↑s.re)‖ := by -+ simp only [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s_re_coerce_geq_one)] -+ unfold LSeries -+ rfl -+ _ = ‖ζ' σ₀ / ζ σ₀‖ := by -+ rw [← s_re_eq_sigma] -+ simp [*] -+ -+ exact Z -+ -+theorem dlog_riemannZeta_bdd_on_vertical_lines {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : -+ ∃ c > 0, ∀(t : ℝ), ‖ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ c := by -+ -+ let s_re : ℂ := σ₀ -+ -+ let new_const : ℝ := 1 + (↑(Norm.norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) (↑ s_re : ℂ ) n‖)) : ℝ ) -+ have new_const_is_pos : new_const > 0 := by positivity -+ -+ use new_const -+ use new_const_is_pos -+ intro t -+ -+ let s := σ₀ + t * I -+ -+ have DD : (↑ s.re : ℂ) = s_re := by -+ refine ofReal_inj.mpr ?_ -+ rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] -+ simp -+ -+ have L : s_re = σ₀ := by rfl -+ -+ have H : s.re = σ₀ := by -+ rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] -+ simp -+ -+ have non_neg : σ₀ ≠ 0 := by -+ by_contra h -+ rw [h] at σ₀_gt -+ norm_cast at σ₀_gt -+ -+ have pos : s.re > 1 := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm H)) -+ have pos_triv : s_re.re > 1 := by exact σ₀_gt -+ -+ rw [← norm_neg, ← neg_div, ← ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div pos] -+ -+ have identity0 : ∀(n : ℕ), ‖LSeries.term 1 s n‖ = 1 / n^σ₀ := by -+ unfold LSeries.term -+ intro n -+ by_cases h0 : n = 0 -+ · simp [*] -+ · simp [*] -+ push Not at h0 -+ have C : n > 0 := by exact Nat.zero_lt_of_ne_zero h0 -+ have T := Complex.norm_natCast_cpow_of_pos C s -+ rw [H] at T -+ exact T -+ -+ have O : ∀(s : ℂ), ∀(n : ℕ), s.re = σ₀ → (↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ) : ℂ) = LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n := by -+ intro s n cond -+ -+ by_cases h1 : (n = 0) -+ · simp [h1] -+ · push Not at h1 -+ unfold LSeries.term -+ simp [*] -+ have U : |Λ n| = Λ n := abs_of_nonneg (ArithmeticFunction.vonMangoldt_nonneg) -+ have R : n > 0 := by exact Nat.zero_lt_of_ne_zero h1 -+ rw [U] -+ have Z := Complex.norm_natCast_cpow_of_pos R s -+ rw [Z] -+ rw [← L] -+ -+ by_cases h : (Λ n = 0) -+ · simp [h] -+ · norm_cast -+ apply_fun (fun (w : ℂ) ↦ w * (↑ n : ℂ)^s_re / (Λ n)) -+ · simp [*] -+ ring_nf -+ rw [mul_comm] -+ nth_rewrite 1 [mul_assoc] -+ simp [*] -+ have := cast_pow_eq n σ₀ -+ rw [this] -+ simp [*] -+ -+ · have G : (↑ n : ℂ)^s_re / (Λ n) ≠ 0 := by -+ have T : (↑ n : ℂ)^s_re ≠ 0 := by -+ have T : n > 0 := by exact R -+ have M : ∃(m : ℕ), n = m + 1 := by exact Nat.exists_eq_succ_of_ne_zero h1 -+ let ⟨m, pf⟩ := M -+ have U := Complex.natCast_add_one_cpow_ne_zero m s_re -+ rw [pf] -+ push_cast -+ exact U -+ refine div_ne_zero T ?_ -+ push Not at h -+ norm_cast -+ have U := by exact mul_left_injective₀ G -+ have T : (fun (x : ℂ) ↦ x * (↑ n : ℂ)^s_re / (Λ n)) = (fun (x : ℂ) ↦ x * ((↑ n : ℂ)^s_re / (Λ n))) := by funext x; exact mul_div_assoc x (↑n ^ s_re) ↑(Λ n) -+ simp [←T] at U -+ exact U -+ -+ have K : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ)) = (fun (n : ℕ) ↦ (LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n )) := by -+ funext n -+ rw [O s n H] -+ -+ have K1 : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) (↑ s.re : ℂ) n‖ : ℝ)) = (fun (n : ℕ) ↦ (LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n )) := by -+ funext n -+ rw [O (↑ s.re : ℂ) n H] -+ simp [*] -+ -+ have D2 : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ)) = (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) (↑ s.re : ℂ) n‖ : ℝ)) := by -+ simp [← K] -+ -+ have S : Summable (fun n ↦ (↑(‖LSeries.term (fun x ↦ Λ x) s n‖ : ℝ) : ℝ )) := by -+ apply (summable_real_iff_summable_coe_complex (fun n ↦ (↑(‖LSeries.term (fun x ↦ Λ x) s n‖ : ℝ) : ℝ ))).mpr -+ rw [K] -+ have T := ArithmeticFunction.LSeriesSummable_vonMangoldt (pos_triv) -+ have U : s_re = s.re := by exact congrFun (congrArg Complex.mk (id (Eq.symm H))) 0 -+ simp [← U] -+ exact T -+ -+ have C := calc -+ ‖∑' (n : ℕ), (LSeries.term (fun x ↦ Λ x) s n)‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) s n‖ := norm_tsum_le_tsum_norm S -+ -+ _ ≤ norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) s n‖) := by exact le_norm_self (∑' (n : ℕ), ‖LSeries.term (fun x ↦ ↑(Λ x)) s n‖) -+ _ = norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ) n‖) := by simp [D2] -+ _ ≤ 1 + norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) ( ↑ s.re : ℂ) n‖ ) := by linarith -+ _ = new_const := by rw [DD] -+ -+ exact C -+ -+theorem dlog_riemannZeta_bdd_on_vertical_lines' {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : -+ ∃ C > 0, ∀ (t : ℝ), ‖ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ C := -+ dlog_riemannZeta_bdd_on_vertical_lines σ₀_gt -+ -+theorem SmoothedChebyshevPull1_aux_integrable {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos : 0 < ε) -+ (ε_lt_one : ε < 1) -+ {X : ℝ} (X_gt : 3 < X) -+ {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) (σ₀_le_2 : σ₀ ≤ 2) -+ (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) -+ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) -+ (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ : -+ Integrable (fun (t : ℝ) ↦ -+ SmoothedChebyshevIntegrand SmoothingF ε X (σ₀ + (t : ℂ) * I)) volume := by -+ obtain ⟨C, C_pos, hC⟩ := dlog_riemannZeta_bdd_on_vertical_lines' σ₀_gt -+ let c : ℝ := C * X ^ σ₀ -+ have : ∀ t, ‖(fun (t : ℝ) ↦ (- deriv riemannZeta (σ₀ + (t : ℂ) * I)) / -+ riemannZeta (σ₀ + (t : ℂ) * I) * -+ (X : ℂ) ^ (σ₀ + (t : ℂ) * I)) t‖ ≤ c := by -+ intro t -+ simp only [Complex.norm_mul, c] -+ gcongr -+ · simpa only [neg_div, norm_neg] using hC t -+ -+ · rw [Complex.norm_cpow_eq_rpow_re_of_nonneg] -+ · simp -+ · linarith -+ · simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, -+ add_zero, ne_eq] -+ linarith -+ convert! (SmoothedChebyshevDirichlet_aux_integrable ContDiffSmoothingF SmoothingFnonneg -+ suppSmoothingF mass_one ε_pos ε_lt_one σ₀_gt σ₀_le_2).bdd_mul (c := c) ?_ (Filter.Eventually.of_forall this) using 2 -+ · unfold SmoothedChebyshevIntegrand -+ ring -+ · apply Continuous.aestronglyMeasurable -+ apply continuousOn_univ.mp -+ intro t _ -+ let s := σ₀ + (t : ℂ) * I -+ have s_ne_one : s ≠ 1 := by -+ intro h -+ -+ have : σ₀ = 1 := by -+ have := congr_arg Complex.re h -+ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, -+ sub_self, add_zero, one_re, s] at this -+ exact this -+ -+ linarith [σ₀_gt] -+ apply ContinuousAt.continuousWithinAt -+ apply ContinuousAt.mul -+ · have diffζ := differentiableAt_riemannZeta s_ne_one -+ apply ContinuousAt.div -+ · apply ContinuousAt.neg -+ have : DifferentiableAt ℂ (fun s ↦ deriv riemannZeta s) s := -+ differentiableAt_deriv_riemannZeta s_ne_one -+ convert realDiff_of_complexDiff (s := σ₀ + (t : ℂ) * I) this <;> simp -+ · convert realDiff_of_complexDiff (s := σ₀ + (t : ℂ) * I) diffζ <;> simp -+ · apply riemannZeta_ne_zero_of_one_lt_re -+ simp [σ₀_gt] -+ · apply ContinuousAt.comp _ (by fun_prop) -+ apply continuousAt_const_cpow -+ norm_cast -+ linarith -+ -+lemma BddAboveOnRect {g : ℂ → ℂ} {z w : ℂ} (holoOn : HolomorphicOn g (z.Rectangle w)) : -+ BddAbove (norm ∘ g '' (z.Rectangle w)) := by -+ have compact_rect : IsCompact (z.Rectangle w) := by -+ apply IsCompact.reProdIm <;> apply isCompact_uIcc -+ refine IsCompact.bddAbove_image compact_rect ?_ -+ apply holoOn.continuousOn.norm -+ -+theorem SmoothedChebyshevPull1 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos: 0 < ε) -+ (ε_lt_one : ε < 1) -+ (X : ℝ) (X_gt : 3 < X) -+ {T : ℝ} (T_pos : 0 < T) {σ₁ : ℝ} -+ (σ₁_pos : 0 < σ₁) (σ₁_lt_one : σ₁ < 1) -+ (holoOn : HolomorphicOn (ζ' / ζ) ((Icc σ₁ 2)×ℂ (Icc (-T) T) \ {1})) -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) -+ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) : -+ SmoothedChebyshev SmoothingF ε X = -+ I₁ SmoothingF ε X T - -+ I₂ SmoothingF ε T X σ₁ + -+ I₃₇ SmoothingF ε T X σ₁ + -+ I₈ SmoothingF ε T X σ₁ + -+ I₉ SmoothingF ε X T -+ + 𝓜 ((Smooth1 SmoothingF ε) ·) 1 * X := by -+ unfold SmoothedChebyshev -+ unfold VerticalIntegral' -+ have X_eq_gt_one : 1 < 1 + (Real.log X)⁻¹ := by -+ nth_rewrite 1 [← add_zero 1] -+ refine add_lt_add_of_le_of_lt ?_ ?_ -+ rfl -+ rw[inv_pos, ← Real.log_one] -+ apply Real.log_lt_log -+ norm_num -+ linarith -+ have X_eq_lt_two : (1 + (Real.log X)⁻¹) < 2 := by -+ rw[← one_add_one_eq_two] -+ refine (add_lt_add_iff_left 1).mpr ?_ -+ refine inv_lt_one_of_one_lt₀ ?_ -+ refine (lt_log_iff_exp_lt ?_).mpr ?_ -+ positivity -+ have : rexp 1 < 3 := by exact lt_trans (Real.exp_one_lt_d9) (by norm_num) -+ linarith -+ have X_eq_le_two : 1 + (Real.log X)⁻¹ ≤ 2 := X_eq_lt_two.le -+ rw [verticalIntegral_split_three (a := -T) (b := T)] -+ swap -+ · -+ exact SmoothedChebyshevPull1_aux_integrable ε_pos ε_lt_one X_gt X_eq_gt_one -+ X_eq_le_two suppSmoothingF SmoothingFnonneg mass_one ContDiffSmoothingF -+ · -+ have temp : ↑(1 + (Real.log X)⁻¹) = (1 : ℂ) + ↑(Real.log X)⁻¹ := by push_cast; rfl -+ repeat rw[smul_eq_mul] -+ unfold I₁ -+ rw[temp, mul_add, mul_add, add_assoc, sub_eq_add_neg] -+ nth_rewrite 4 [add_assoc] -+ nth_rewrite 3 [add_assoc] -+ nth_rewrite 2 [add_assoc] -+ rw[add_assoc, add_left_cancel_iff, add_assoc] -+ nth_rewrite 7 [add_comm] -+ rw[← add_assoc] -+ unfold I₉ -+ rw[add_right_cancel_iff, ← add_right_inj (1 / (2 * ↑π * I) * -+ -VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) (1 + (Real.log X)⁻¹) (-T) T), -+ ← mul_add, ← sub_eq_neg_add, sub_self, mul_zero] -+ unfold VIntegral I₂ I₃₇ I₈ -+ rw[smul_eq_mul, temp, ← add_assoc, ← add_assoc] -+ nth_rewrite 2 [div_mul_comm] -+ rw[mul_one, ← neg_div, ← mul_neg] -+ nth_rewrite 2 [← one_div_mul_eq_div] -+ repeat rw[← mul_add] -+ let fTempRR : ℝ → ℝ → ℂ := fun x ↦ fun y ↦ -+ SmoothedChebyshevIntegrand SmoothingF ε X ((x : ℝ) + (y : ℝ) * I) -+ let fTempC : ℂ → ℂ := fun z ↦ fTempRR z.re z.im -+ have : ∫ (y : ℝ) in -T..T, -+ SmoothedChebyshevIntegrand SmoothingF ε X (1 + ↑(Real.log X)⁻¹ + ↑y * I) = -+ ∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y := by -+ unfold fTempRR -+ rw[temp] -+ rw[this] -+ have : ∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, -+ SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I) = -+ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T) := by -+ unfold fTempRR -+ rw[Complex.ofReal_neg, neg_mul] -+ rfl -+ rw[this] -+ have : ∫ (t : ℝ) in -T..T, SmoothedChebyshevIntegrand SmoothingF ε X (↑σ₁ + ↑t * I) = -+ ∫ (y : ℝ) in -T..T, fTempRR σ₁ y := by rfl -+ rw[this] -+ have : ∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, -+ SmoothedChebyshevIntegrand SmoothingF ε X (↑σ + ↑T * I) = -+ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T := by rfl -+ rw[this] -+ repeat rw[← add_assoc] -+ have : (((I * -∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y) + -+ -∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T)) + -+ I * ∫ (y : ℝ) in -T..T, fTempRR σ₁ y) + -+ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T = -+ -1 * RectangleIntegral fTempC ((1 : ℝ) + (Real.log X)⁻¹ + T * I) (σ₁ - T * I) := by -+ unfold RectangleIntegral -+ rw[HIntegral_symm, VIntegral_symm] -+ nth_rewrite 2 [HIntegral_symm, VIntegral_symm] -+ unfold HIntegral VIntegral -+ repeat rw[smul_eq_mul] -+ repeat rw[add_re] -+ repeat rw[add_im] -+ repeat rw[sub_re] -+ repeat rw[sub_im] -+ repeat rw[mul_re] -+ repeat rw[mul_im] -+ repeat rw[ofReal_re] -+ repeat rw[ofReal_im] -+ rw[I_re, I_im, mul_zero, zero_mul, mul_one] -+ ring_nf -+ unfold fTempC -+ have : ∫ (y : ℝ) in -T..T, fTempRR (I * ↑y + ↑σ₁).re (I * ↑y + ↑σ₁).im = -+ ∫ (y : ℝ) in -T..T, fTempRR σ₁ y := by simp -+ rw[this] -+ have : ∫ (y : ℝ) in -T..T, -+ fTempRR (I * ↑y + ↑(1 + (Real.log X)⁻¹)).re (I * ↑y + ↑(1 + (Real.log X)⁻¹)).im = -+ ∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y := by simp -+ rw[this] -+ have : ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR (I * ↑T + ↑x).re (I * ↑T + ↑x).im = -+ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T := by simp -+ rw[this] -+ have : ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR (I * ↑(-T) + ↑x).re (I * ↑(-T) + ↑x).im = -+ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T) := by simp -+ rw[this] -+ ring_nf -+ rw[this, neg_one_mul, div_mul_comm, mul_one, -+ ← add_right_inj -+ (RectangleIntegral fTempC (1 + ↑(Real.log X)⁻¹ + ↑T * I) (↑σ₁ - ↑T * I) / (2 * ↑π * I)), -+ ← add_assoc] -+ simp only [ofReal_one, ofReal_inv, add_zero] -+ rw[rectangleIntegral_symm] -+ have : RectangleIntegral fTempC (↑σ₁ - ↑T * I) (1 + 1 / ↑(Real.log X) + ↑T * I) / (2 * ↑π * I) = -+ RectangleIntegral' fTempC (σ₁ - T * I) (1 + ↑(Real.log X)⁻¹ + T * I) := by -+ unfold RectangleIntegral' -+ rw [smul_eq_mul] -+ simp only [one_div, ofReal_inv] -+ ring -+ -+ simp only [one_div, ofReal_inv] at this -+ rw [this] -+ -+ let holoMatch : ℂ → ℂ := fun z ↦ -+ (fTempC z - (𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) 1 * ↑X) / (z - 1)) -+ have inv_log_X_pos: 0 < (Real.log X)⁻¹ := by -+ rw[inv_pos, ← Real.log_one] -+ apply Real.log_lt_log (by positivity) (by linarith) -+ have pInRectangleInterior : -+ (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) ∈ nhds 1) := by -+ refine rectangle_mem_nhds_iff.mpr ?_ -+ refine mem_reProdIm.mpr ?_ -+ have : re 1 = 1 := by rfl -+ rw[this] -+ have : im 1 = 0 := by rfl -+ rw[this] -+ repeat rw[sub_re] -+ repeat rw[sub_im] -+ repeat rw[add_re] -+ repeat rw[add_im] -+ rw[mul_re, mul_im, I_re, I_im] -+ repeat rw[ofReal_re] -+ repeat rw[ofReal_im] -+ ring_nf -+ have temp : 1 ∈ uIoo σ₁ (re 1 + (Real.log X)⁻¹) := by -+ have : re 1 = 1 := by rfl -+ rw[this] -+ unfold uIoo -+ have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) -+ rw[this] -+ have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by exact max_eq_right (by linarith) -+ rw[this] -+ refine mem_Ioo.mpr ?_ -+ exact ⟨σ₁_lt_one, (by linarith)⟩ -+ have : 0 ∈ uIoo (-T) (T + im 1) := by -+ have : im 1 = 0 := by rfl -+ rw[this, add_zero] -+ unfold uIoo -+ have : min (-T) T = -T := by exact min_eq_left (by linarith) -+ rw[this] -+ have : max (-T) T = T := by exact max_eq_right (by linarith) -+ rw[this] -+ refine mem_Ioo.mpr ?_ -+ exact ⟨(by linarith), (by linarith)⟩ -+ exact ⟨temp, this⟩ -+ -+ have holoMatchHoloOn : HolomorphicOn holoMatch -+ (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) \ {1}) := by -+ unfold HolomorphicOn holoMatch -+ refine DifferentiableOn.sub ?_ ?_ -+ · unfold fTempC fTempRR -+ have : (fun z ↦ SmoothedChebyshevIntegrand SmoothingF ε X (↑z.re + ↑z.im * I)) = -+ (fun z ↦ SmoothedChebyshevIntegrand SmoothingF ε X z) := by -+ apply funext -+ intro z -+ have : (↑z.re + ↑z.im * I) = z := by exact re_add_im z -+ rw[this] -+ rw[this] -+ refine DifferentiableOn.mul ?_ ?_ -+ · refine DifferentiableOn.mul ?_ ?_ -+ · have : (fun s ↦ -ζ' s / ζ s) = (fun s ↦ -(ζ' s / ζ s)) := by -+ refine funext ?_ -+ intro x -+ exact neg_div (ζ x) (ζ' x) -+ rw[this] -+ refine DifferentiableOn.neg ?_ -+ unfold DifferentiableOn -+ intro x x_location -+ unfold Rectangle at x_location -+ rw[Set.mem_sdiff, Complex.mem_reProdIm, sub_re, add_re, sub_im, add_im, mul_re, mul_im, -+ I_re, I_im, add_re, add_im] at x_location -+ simp only [ofReal_re, mul_zero, ofReal_im, mul_one, sub_self, sub_zero, one_re, -+ ofReal_inv, inv_re, normSq_ofReal, div_self_mul_self', add_zero, zero_sub, one_im, -+ inv_im, neg_zero, zero_div, zero_add, mem_singleton_iff] at x_location -+ -+ obtain ⟨⟨xReIn, xImIn⟩, xOut⟩ := x_location -+ unfold uIcc at xReIn xImIn -+ have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) -+ rw[this] at xReIn -+ have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by exact max_eq_right (by linarith) -+ rw[this] at xReIn -+ have : min (-T) T = (-T) := by exact min_eq_left (by linarith) -+ rw[this] at xImIn -+ have : max (-T) T = T := by exact max_eq_right (by linarith) -+ rw[this] at xImIn -+ unfold HolomorphicOn DifferentiableOn at holoOn -+ have temp : DifferentiableWithinAt ℂ (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) x := by -+ have : x ∈ Icc σ₁ 2 ×ℂ Icc (-T) T \ {1} := by -+ rw [Set.mem_sdiff, Complex.mem_reProdIm] -+ have xReTemp : x.re ∈ Icc σ₁ 2 := by -+ have xReLb : σ₁ ≤ x.re := by exact xReIn.1 -+ have xReUb : x.re ≤ 2 := by exact (lt_of_le_of_lt xReIn.2 X_eq_lt_two).le -+ exact ⟨xReLb, xReUb⟩ -+ have xImTemp : x.im ∈ Icc (-T) T := by exact ⟨xImIn.1, xImIn.2⟩ -+ exact ⟨⟨xReTemp, xImTemp⟩, xOut⟩ -+ exact holoOn x this -+ -+ have : ((↑σ₁ - ↑T * I).Rectangle (1 + ↑(Real.log X)⁻¹ + ↑T * I) \ {1}) ⊆ -+ (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) := by -+ intro a a_location -+ rw[Set.mem_sdiff, Complex.mem_reProdIm] -+ rw[Set.mem_sdiff] at a_location -+ obtain ⟨aIn, aOut⟩ := a_location -+ unfold Rectangle uIcc at aIn -+ rw[sub_re, add_re, add_re, sub_im, add_im, add_im, mul_re, mul_im, ofReal_re, ofReal_re, ofReal_re, ofReal_im, ofReal_im, ofReal_im, I_re, I_im] at aIn -+ have : re 1 = 1 := by rfl -+ rw[this] at aIn -+ have : im 1 = 0 := by rfl -+ rw[this] at aIn -+ ring_nf at aIn -+ have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by linarith -+ rw[this] at aIn -+ have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by linarith -+ rw[this] at aIn -+ have : min (-T) T = (-T) := by linarith -+ rw[this] at aIn -+ have : max (-T) T = T := by linarith -+ rw[this] at aIn -+ rw[Complex.mem_reProdIm] at aIn -+ obtain ⟨aReIn, aImIn⟩ := aIn -+ have aReInRedo : a.re ∈ Icc σ₁ 2 := by -+ have : a.re ≤ 2 := by exact (lt_of_le_of_lt aReIn.2 X_eq_lt_two).le -+ exact ⟨aReIn.1, this⟩ -+ exact ⟨⟨aReInRedo, aImIn⟩, aOut⟩ -+ exact DifferentiableWithinAt.mono temp this -+ · unfold DifferentiableOn -+ intro x x_location -+ refine DifferentiableAt.differentiableWithinAt ?_ -+ have hε : ε ∈ Ioo 0 1 := by exact ⟨ε_pos, ε_lt_one⟩ -+ have xRePos : 0 < x.re := by -+ unfold Rectangle at x_location -+ rw[Set.mem_sdiff, Complex.mem_reProdIm] at x_location -+ obtain ⟨⟨xReIn, _⟩, _⟩ := x_location -+ unfold uIcc at xReIn -+ rw[sub_re, add_re, add_re, mul_re, I_re, I_im] at xReIn -+ repeat rw[ofReal_re] at xReIn -+ repeat rw[ofReal_im] at xReIn -+ ring_nf at xReIn -+ have : re 1 = 1 := by rfl -+ rw[this] at xReIn -+ have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) -+ rw[this] at xReIn -+ have : σ₁ ≤ x.re := by exact xReIn.1 -+ linarith -+ exact Smooth1MellinDifferentiable ContDiffSmoothingF suppSmoothingF hε SmoothingFnonneg mass_one xRePos -+ · unfold DifferentiableOn -+ intro x x_location -+ apply DifferentiableAt.differentiableWithinAt -+ unfold HPow.hPow instHPow -+ simp only -+ apply DifferentiableAt.const_cpow -+ · exact differentiableAt_fun_id -+ · left -+ refine ne_zero_of_re_pos ?_ -+ simp only [ofReal_re] -+ linarith -+ · refine DifferentiableOn.mul ?_ ?_ -+ · -+ unfold DifferentiableOn -+ intro x x_location -+ rw[Set.mem_sdiff] at x_location -+ obtain ⟨xInRect, xOut⟩ := x_location -+ apply DifferentiableAt.differentiableWithinAt -+ apply differentiableAt_const -+ · unfold DifferentiableOn -+ intro x x_location -+ apply DifferentiableAt.differentiableWithinAt -+ apply DifferentiableAt.inv -+ · fun_prop -+ · intro h -+ rw [sub_eq_zero] at h -+ have := x_location.2 -+ simp only [mem_singleton_iff] at this -+ exact this h -+ -+ have holoMatchBddAbove : BddAbove -+ (norm ∘ holoMatch '' (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) \ {1})) := by -+ let U : Set ℂ := Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) -+ let f : ℂ → ℂ := fun z ↦ -ζ' z / ζ z -+ let g : ℂ → ℂ := fun z ↦ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) z * ↑X ^ z -+ have bigO_holoMatch : holoMatch =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by -+ unfold holoMatch fTempC fTempRR SmoothedChebyshevIntegrand -+ simp only [re_add_im] -+ have : (fun z ↦ -+ (-ζ' z / ζ z * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) z * ↑X ^ z - -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) 1 * ↑X / (z - 1))) = -+ (fun z ↦ (f z * g z - 1 * g 1 / (z - 1))) := by -+ apply funext -+ intro x -+ simp[f, g] -+ rw[mul_assoc] -+ rw[this] -+ have g_holc : HolomorphicOn g U := by -+ unfold HolomorphicOn DifferentiableOn -+ intro u uInU -+ refine DifferentiableAt.differentiableWithinAt ?_ -+ simp[g] -+ refine DifferentiableAt.mul ?_ ?_ -+ have hε : ε ∈ Set.Ioo 0 1 := by exact ⟨ε_pos, ε_lt_one⟩ -+ have hu : 0 < u.re := by -+ simp[U] at uInU -+ unfold Rectangle uIcc at uInU -+ rw[Complex.mem_reProdIm] at uInU -+ obtain ⟨uReIn, uImIn⟩ := uInU -+ have : min (↑σ₁ - ↑T * I).re (1 + (↑(Real.log X))⁻¹ + ↑T * I).re = σ₁ := by -+ rw[sub_re, add_re, add_re, mul_re, I_re, I_im] -+ repeat rw[ofReal_re] -+ repeat rw[ofReal_im] -+ simp -+ linarith -+ rw[this] at uReIn -+ have : σ₁ ≤ u.re := by exact uReIn.1 -+ linarith -+ exact Smooth1MellinDifferentiable ContDiffSmoothingF suppSmoothingF hε SmoothingFnonneg mass_one hu -+ unfold HPow.hPow instHPow -+ simp -+ apply DifferentiableAt.const_cpow -+ exact differentiableAt_fun_id -+ refine Or.inl ?_ -+ refine ne_zero_of_re_pos ?_ -+ rw[ofReal_re] -+ positivity -+ have U_in_nhds : U ∈ nhds 1 := by -+ simp only [U] -+ exact pInRectangleInterior -+ have f_near_p : (f - fun (z : ℂ) => 1 * (z - 1)⁻¹) =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by -+ simp[f] -+ have : ((fun z ↦ -ζ' z / ζ z) - fun z ↦ (z - 1)⁻¹) = -+ (-ζ' / ζ - fun z ↦ (z - 1)⁻¹) := by -+ apply funext -+ intro z -+ simp -+ rw[this] -+ exact riemannZetaLogDerivResidueBigO -+ exact ResidueMult g_holc U_in_nhds f_near_p -+ have : ∃ V ∈ nhds 1, BddAbove (norm ∘ holoMatch '' (V \ {1})) := by exact IsBigO_to_BddAbove bigO_holoMatch -+ obtain ⟨V, VInNhds_one, BddAboveV⟩ := this -+ have : ∃ W ⊆ V, 1 ∈ W ∧ IsOpen W ∧ BddAbove (norm ∘ holoMatch '' (W \ {1})) := by -+ rw[mem_nhds_iff] at VInNhds_one -+ obtain ⟨W, WSubset, WOpen, one_in_W⟩ := VInNhds_one -+ use W -+ have : BddAbove (Norm.norm ∘ holoMatch '' (W \ {1})) := by -+ have : Norm.norm ∘ holoMatch '' (W \ {1}) ⊆ -+ Norm.norm ∘ holoMatch '' (V \ {1}) := by -+ exact image_mono (by exact sdiff_subset_sdiff_left WSubset) -+ exact BddAbove.mono this BddAboveV -+ exact ⟨WSubset, ⟨one_in_W, WOpen, this⟩⟩ -+ obtain ⟨W, WSubset, one_in_W, OpenW, BddAboveW⟩ := this -+ have : (↑σ₁ - ↑T * I).Rectangle (1 + ↑(Real.log X)⁻¹ + ↑T * I) = U := by rfl -+ rw[this] at holoMatchHoloOn ⊢ -+ have one_in_U : 1 ∈ U := by -+ have U_in_nhds : U ∈ nhds 1 := by -+ simp only [U] -+ exact pInRectangleInterior -+ exact mem_of_mem_nhds U_in_nhds -+ have (h1 : 1 ∈ U) (h2 : 1 ∈ W) : U \ {1} = (U \ W) ∪ ((U ∩ W) \ {1}) := by -+ ext x -+ simp only [Set.mem_sdiff, Set.mem_singleton_iff, Set.mem_union, Set.mem_inter_iff] -+ constructor -+ intro ⟨hxU, hx1⟩ -+ by_cases hw : x ∈ W -+ · right -+ exact ⟨⟨hxU, hw⟩, hx1⟩ -+ · left -+ exact ⟨hxU, hw⟩ -+ · intro h -+ cases' h with h_left h_right -+ have : x ≠ 1 := by -+ intro x_eq_1 -+ rw[x_eq_1] at h_left -+ exact h_left.2 h2 -+ · exact ⟨h_left.1, this⟩ -+ · exact ⟨h_right.1.1, h_right.2⟩ -+ rw[this one_in_U one_in_W] -+ have : Norm.norm ∘ holoMatch '' (U \ W ∪ (U ∩ W) \ {1}) = -+ Norm.norm ∘ holoMatch '' (U \ W) ∪ Norm.norm ∘ holoMatch '' ((U ∩ W) \ {1}) := by -+ exact image_union (Norm.norm ∘ holoMatch) (U \ W) ((U ∩ W) \ {1}) -+ rw[this] -+ refine BddAbove.union ?_ ?_ -+ refine IsCompact.bddAbove_image ?_ ?_ -+ refine IsCompact.diff ?_ ?_ -+ unfold U Rectangle -+ apply IsCompact.reProdIm -+ unfold uIcc -+ exact isCompact_Icc -+ unfold uIcc -+ exact isCompact_Icc -+ exact OpenW -+ refine Continuous.comp_continuousOn ?_ ?_ -+ exact continuous_norm -+ have : HolomorphicOn holoMatch (U \ W) := by -+ have : U \ W ⊆ U \ {1} := by -+ intro x x_location -+ obtain ⟨xInU, xOutW⟩ := x_location -+ rw[Set.mem_sdiff] -+ apply And.intro -+ exact xInU -+ rw[Set.mem_singleton_iff] -+ intro x_eq_1 -+ rw[x_eq_1] at xOutW -+ exact xOutW one_in_W -+ exact DifferentiableOn.mono holoMatchHoloOn this -+ unfold HolomorphicOn at this -+ exact DifferentiableOn.continuousOn this -+ have : Norm.norm ∘ holoMatch '' ((U ∩ W) \ {1}) ⊆ -+ Norm.norm ∘ holoMatch '' (W \ {1}) := by -+ have : (U ∩ W) \ {1} ⊆ W \ {1} := by -+ intro x x_location -+ rw[Set.mem_sdiff] at x_location -+ obtain ⟨⟨xInU, xInW⟩, xOut⟩ := x_location -+ exact ⟨xInW, xOut⟩ -+ exact image_mono this -+ exact BddAbove.mono this BddAboveW -+ -+ obtain ⟨g, gHolo_Eq⟩ := existsDifferentiableOn_of_bddAbove -+ pInRectangleInterior holoMatchHoloOn holoMatchBddAbove -+ obtain ⟨gHolo, gEq⟩ := gHolo_Eq -+ -+ have zRe_le_wRe : (σ₁ - ↑T * I).re ≤ (1 + (Real.log X)⁻¹ + T * I).re := by -+ repeat rw[sub_re] -+ repeat rw[add_re] -+ repeat rw[mul_re] -+ rw[I_re, I_im] -+ repeat rw[ofReal_re] -+ repeat rw[ofReal_im] -+ ring_nf -+ have : re 1 = 1 := by rfl -+ rw[this] -+ linarith -+ have zIm_le_wIm : (σ₁ - ↑T * I).im ≤ (1 + (Real.log X)⁻¹ + T * I).im := by -+ repeat rw[sub_im] -+ repeat rw[add_im] -+ repeat rw[mul_im] -+ rw[I_re, I_im] -+ repeat rw[ofReal_re] -+ repeat rw[ofReal_im] -+ ring_nf -+ have : im 1 = 0 := by rfl -+ rw[this] -+ linarith -+ have hres := ResidueTheoremOnRectangleWithSimplePole zRe_le_wRe zIm_le_wIm -+ pInRectangleInterior gHolo gEq -+ simp only [ofReal_inv] at hres -+ rw [← hres] -+ unfold RectangleIntegral' -+ simp only [smul_eq_mul] -+ ring -+ -+lemma interval_membership (r : ℝ)(a b: ℝ)(h1 : r ∈ Set.Icc (min a b) (max a b)) (h2 : a < b) : -+ a ≤ r ∧ r ≤ b := by -+ -+ have min_eq : min a b = a := min_eq_left (le_of_lt h2) -+ have max_eq : max a b = b := max_eq_right (le_of_lt h2) -+ rw [min_eq, max_eq] at h1 -+ rw [← @mem_Icc] -+ exact h1 -+ -+lemma verticalIntegral_split_three_finite {s a b e σ : ℝ} {f : ℂ → ℂ} -+ (hf : IntegrableOn (fun t : ℝ ↦ f (σ + t * I)) (Icc s e)) -+ (hab: s < a ∧ a < b ∧ b < e): -+ VIntegral f σ s e = -+ VIntegral f σ s a + -+ VIntegral f σ a b + -+ VIntegral f σ b e := by -+ dsimp [VIntegral] -+ rw [← intervalIntegrable_iff_integrableOn_Icc_of_le (by linarith)] at hf -+ rw[← intervalIntegral.integral_add_adjacent_intervals (b := a), ← intervalIntegral.integral_add_adjacent_intervals (a := a) (b := b)] -+ · ring -+ all_goals apply IntervalIntegrable.mono_set hf; apply uIcc_subset_uIcc <;> apply mem_uIcc_of_le <;> linarith -+ -+lemma verticalIntegral_split_three_finite' {s a b e σ : ℝ} {f : ℂ → ℂ} -+ (hf : IntegrableOn (fun t : ℝ ↦ f (σ + t * I)) (Icc s e)) -+ (hab: s < a ∧ a < b ∧ b < e): -+ (1 : ℂ) / (2 * π * I) * (VIntegral f σ s e) = -+ (1 : ℂ) / (2 * π * I) * (VIntegral f σ s a) + -+ (1 : ℂ) / (2 * π * I) * (VIntegral f σ a b) + -+ (1 : ℂ) / (2 * π * I) * (VIntegral f σ b e) := by -+ have : (1 : ℂ) / (2 * π * I) * (VIntegral f σ s a) + -+ (1 : ℂ) / (2 * π * I) * (VIntegral f σ a b) + -+ (1 : ℂ) / (2 * π * I) * (VIntegral f σ b e) = (1 : ℂ) / (2 * π * I) * ((VIntegral f σ s a) + -+ (VIntegral f σ a b) + -+ (VIntegral f σ b e)) := by ring -+ rw [this] -+ clear this -+ rw [← verticalIntegral_split_three_finite hf hab] -+ -+theorem SmoothedChebyshevPull2_aux1 {T σ₁ : ℝ} (σ₁lt : σ₁ < 1) -+ (holoOn : HolomorphicOn (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1})) : -+ ContinuousOn (fun (t : ℝ) ↦ -ζ' (σ₁ + t * I) / ζ (σ₁ + t * I)) (Icc (-T) T) := by -+ rw [show (fun (t : ℝ) ↦ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) = -(ζ' / ζ) ∘ (fun (t : ℝ) ↦ ↑σ₁ + ↑t * I) by ext; simp; ring_nf] -+ apply ContinuousOn.neg -+ apply holoOn.continuousOn.comp (by fun_prop) -+ intro t ht -+ simp -+ constructor -+ · apply mem_reProdIm.mpr -+ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add, left_mem_Icc, ht, and_true] -+ linarith -+ · intro h -+ replace h := congr_arg re h -+ simp at h -+ linarith -+ -+theorem SmoothedChebyshevPull2 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos: 0 < ε) (ε_lt_one : ε < 1) -+ (X : ℝ) (_ : 3 < X) -+ {T : ℝ} (T_pos : 3 < T) {σ₁ σ₂ : ℝ} -+ (σ₂_pos : 0 < σ₂) (σ₁_lt_one : σ₁ < 1) -+ (σ₂_lt_σ₁ : σ₂ < σ₁) -+ (holoOn : HolomorphicOn (ζ' / ζ) ((Icc σ₁ 2)×ℂ (Icc (-T) T) \ {1})) -+ (holoOn2 : HolomorphicOn (SmoothedChebyshevIntegrand SmoothingF ε X) -+ (Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1})) -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) -+ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) -+ (diff_SmoothingF : ContDiff ℝ 1 SmoothingF) : -+ I₃₇ SmoothingF ε T X σ₁ = -+ I₃ SmoothingF ε T X σ₁ - -+ I₄ SmoothingF ε X σ₁ σ₂ + -+ I₅ SmoothingF ε X σ₂ + -+ I₆ SmoothingF ε X σ₁ σ₂ + -+ I₇ SmoothingF ε T X σ₁ := by -+ let z : ℂ := σ₂ - 3 * I -+ let w : ℂ := σ₁ + 3 * I -+ have σ₁_pos : 0 < σ₁ := by linarith -+ -+ have sub : z.Rectangle w ⊆ Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1} := by -+ -+ intro x hx -+ constructor -+ . -+ simp only [Rectangle, uIcc] at hx -+ rw [Complex.mem_reProdIm] at hx ⊢ -+ obtain ⟨hx_re, hx_im⟩ := hx -+ -+ have hzw_re : z.re < w.re := by -+ simp only [z, w, add_re, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] -+ linarith -+ have x_re_bounds : z.re ≤ x.re ∧ x.re ≤ w.re := by -+ exact interval_membership x.re z.re w.re hx_re hzw_re -+ have x_re_in_Icc : x.re ∈ Icc σ₂ 2 := by -+ have ⟨h_left, h_right⟩ := x_re_bounds -+ have h_left' : σ₂ ≤ x.re := by -+ simp only [z, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, mul_one] at h_left -+ linarith -+ have h_right' : x.re ≤ 2 := by -+ apply le_trans h_right -+ simp only [w, add_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] -+ linarith -+ exact ⟨h_left', h_right'⟩ -+ -+ have hzw_im : z.im < w.im := by -+ simp only [z, w, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, add_im, sub_im, mul_im, mul_one, zero_sub] -+ linarith -+ have x_im_bounds : z.im ≤ x.im ∧ x.im ≤ w.im := by -+ exact interval_membership x.im z.im w.im hx_im hzw_im -+ have x_im_in_Icc : x.im ∈ Icc (-3) 3 := by -+ have ⟨h_left, h_right⟩ := x_im_bounds -+ have h_left' : -3 ≤ x.im := by -+ simp only [z, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, sub_im, mul_im, mul_one, zero_sub] at h_left -+ linarith -+ have h_right' : x.im ≤ 3 := by -+ simp only [w, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, add_im, mul_im, mul_one] at h_right -+ linarith -+ exact ⟨h_left', h_right'⟩ -+ exact ⟨x_re_in_Icc, x_im_in_Icc⟩ -+ -+ . simp only [mem_singleton_iff] -+ -+ have x_re_upper: x.re ≤ σ₁ := by -+ simp only [Rectangle, uIcc] at hx -+ rw [Complex.mem_reProdIm] at hx -+ obtain ⟨hx_re, _⟩ := hx -+ -+ have hzw_re : z.re < w.re := by -+ simp only [z, w, add_re, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] -+ linarith -+ have x_re_bounds : z.re ≤ x.re ∧ x.re ≤ w.re := by -+ exact interval_membership x.re z.re w.re hx_re hzw_re -+ have x_re_upper' : x.re ≤ w.re := by exact x_re_bounds.2 -+ simp only [w, add_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] at x_re_upper' -+ linarith -+ -+ have h_x_ne_one : x ≠ 1 := by -+ intro h_eq -+ have h_re : x.re = 1 := by rw [h_eq, Complex.one_re] -+ have h1 : 1 ≤ σ₁ := by -+ rw [← h_re] -+ exact x_re_upper -+ linarith -+ exact h_x_ne_one -+ have zero_over_box := HolomorphicOn.vanishesOnRectangle holoOn2 sub -+ have splitting : I₃₇ SmoothingF ε T X σ₁ = -+ I₃ SmoothingF ε T X σ₁ + I₅ SmoothingF ε X σ₁ + I₇ SmoothingF ε T X σ₁ := by -+ unfold I₃₇ I₃ I₅ I₇ -+ apply verticalIntegral_split_three_finite' -+ · apply ContinuousOn.integrableOn_Icc -+ unfold SmoothedChebyshevIntegrand -+ apply ContinuousOn.mul -+ · apply ContinuousOn.mul -+ · apply SmoothedChebyshevPull2_aux1 σ₁_lt_one holoOn -+ · apply continuousOn_of_forall_continuousAt -+ intro t t_mem -+ have := Smooth1MellinDifferentiable diff_SmoothingF suppSmoothingF ⟨ε_pos, ε_lt_one⟩ SmoothingFnonneg mass_one (s := ↑σ₁ + ↑t * I) (by simpa) -+ simpa using! realDiff_of_complexDiff _ this -+ · apply continuousOn_of_forall_continuousAt -+ intro t t_mem -+ apply ContinuousAt.comp -+ · refine continuousAt_const_cpow' ?_ -+ intro h -+ have : σ₁ = 0 := by -+ have h_real : (↑σ₁ + ↑t * I).re = (0 : ℂ).re := by -+ rw [h] -+ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, -+ sub_self, add_zero, zero_re] at h_real -+ exact h_real -+ linarith -+ · -+ apply ContinuousAt.add -+ · exact continuousAt_const -+ · apply ContinuousAt.mul -+ · apply continuous_ofReal.continuousAt -+ · exact continuousAt_const -+ · refine ⟨by linarith, by linarith, by linarith⟩ -+ calc I₃₇ SmoothingF ε T X σ₁ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (0 : ℂ) := by simp -+ _ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (RectangleIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z w) := by rw [← zero_over_box] -+ _ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re z.im -+ - HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im -+ + VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im -+ - VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by simp [RectangleIntegral] -+ _ = I₃₇ SmoothingF ε T X σ₁ - ((1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re z.im -+ - (1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im -+ + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im -+ - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by ring -+ _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ -+ - (1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im -+ + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im -+ - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by -+ simp only [one_div, mul_inv_rev, inv_I, neg_mul, HIntegral, sub_im, ofReal_im, mul_im, -+ re_ofNat, I_im, mul_one, im_ofNat, I_re, mul_zero, add_zero, zero_sub, ofReal_neg, -+ ofReal_ofNat, sub_re, ofReal_re, mul_re, sub_self, sub_zero, add_re, add_im, zero_add, -+ sub_neg_eq_add, I₄, sub_right_inj, add_left_inj, neg_inj, mul_eq_mul_left_iff, mul_eq_zero, -+ I_ne_zero, inv_eq_zero, ofReal_eq_zero, OfNat.ofNat_ne_zero, or_false, false_or, z, w] -+ left -+ rfl -+ _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ -+ - I₆ SmoothingF ε X σ₁ σ₂ -+ + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im -+ - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by -+ simp only [one_div, mul_inv_rev, inv_I, neg_mul, HIntegral, add_im, ofReal_im, mul_im, -+ re_ofNat, I_im, mul_one, im_ofNat, I_re, mul_zero, add_zero, zero_add, ofReal_ofNat, sub_re, -+ ofReal_re, mul_re, sub_self, sub_zero, add_re, sub_neg_eq_add, sub_im, zero_sub, I₆, w, z] -+ _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ -+ - I₆ SmoothingF ε X σ₁ σ₂ -+ + I₅ SmoothingF ε X σ₁ -+ - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by -+ simp only [one_div, mul_inv_rev, inv_I, neg_mul, VIntegral, add_re, ofReal_re, mul_re, -+ re_ofNat, I_re, mul_zero, im_ofNat, I_im, mul_one, sub_self, add_zero, sub_im, ofReal_im, -+ mul_im, zero_sub, add_im, zero_add, smul_eq_mul, sub_re, sub_zero, sub_neg_eq_add, I₅, -+ w, z] -+ _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ -+ - I₆ SmoothingF ε X σ₁ σ₂ -+ + I₅ SmoothingF ε X σ₁ -+ - I₅ SmoothingF ε X σ₂) := by -+ simp only [I₅, one_div, mul_inv_rev, inv_I, neg_mul, VIntegral, sub_re, ofReal_re, mul_re, -+ re_ofNat, I_re, mul_zero, im_ofNat, I_im, mul_one, sub_self, sub_zero, sub_im, ofReal_im, -+ mul_im, add_zero, zero_sub, add_im, zero_add, smul_eq_mul, sub_neg_eq_add, z, w] -+ -+ _ = I₃ SmoothingF ε T X σ₁ -+ + I₅ SmoothingF ε X σ₁ -+ + I₇ SmoothingF ε T X σ₁ -+ - (I₄ SmoothingF ε X σ₁ σ₂ -+ - I₆ SmoothingF ε X σ₁ σ₂ -+ + I₅ SmoothingF ε X σ₁ -+ - I₅ SmoothingF ε X σ₂) := by -+ rw [splitting] -+ _ = I₃ SmoothingF ε T X σ₁ -+ - I₄ SmoothingF ε X σ₁ σ₂ -+ + I₅ SmoothingF ε X σ₂ -+ + I₆ SmoothingF ε X σ₁ σ₂ -+ + I₇ SmoothingF ε T X σ₁ := by -+ ring -+ -+theorem ZetaBoxEval {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) : -+ ∃ C, ∀ᶠ ε in (nhdsWithin 0 (Ioi 0)), ∀ X : ℝ, 0 ≤ X → -+ ‖𝓜 ((Smooth1 SmoothingF ε) ·) 1 * X - X‖ ≤ C * ε * X := by -+ have := MellinOfSmooth1c ContDiffSmoothingF suppSmoothingF mass_one -+ clear suppSmoothingF mass_one ContDiffSmoothingF -+ rw[Asymptotics.isBigO_iff] at this -+ obtain ⟨C, hC⟩ := this -+ use C -+ have εpos : ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Ioi 0), ε > 0 := -+ eventually_mem_of_tendsto_nhdsWithin fun ⦃U⦄ hU ↦ hU -+ filter_upwards [hC, εpos] with ε hC εpos -+ rw[id_eq, norm_of_nonneg (le_of_lt εpos)] at hC -+ intro X Xnne -+ nth_rw 2 [← one_mul (X : ℂ)] -+ rw[← sub_mul, norm_mul, norm_real, norm_of_nonneg Xnne] -+ exact mul_le_mul_of_nonneg_right hC Xnne -+ -+theorem norm_reciprocal_inequality_1 (x : ℝ) (x₁ : ℝ) (hx₁ : x₁ ≥ 1) : -+ ‖x^2 + x₁^2‖₊⁻¹ ≤ (‖x₁‖₊^2)⁻¹ := by -+ -+ have h1 : x₁^2 ≥ 1 := by -+ have h_abs : |x₁| ≥ 1 := by -+ rw [abs_of_pos] -+ linarith -+ positivity -+ simp only [ge_iff_le, one_le_sq_iff_one_le_abs, h_abs] -+ -+ have h2 : x^2 + x₁^2 ≥ x₁^2 := by -+ linarith [sq_nonneg x] -+ -+ have h3 : x₁^2 > 0 := by -+ apply sq_pos_of_ne_zero -+ linarith -+ -+ have h33 : 2 * x₁^2 > 0 := by -+ simp [*] -+ -+ have h4 : x^2 + x₁^2 > 0 := by -+ linarith [sq_nonneg x, h3] -+ -+ have h5 : x₁^2 ≤ x^2 + x₁^2 := h2 -+ -+ have h6 : ‖x₁^2‖₊ = ‖x₁‖₊^2 := by -+ rw [nnnorm_pow] -+ -+ have h7 : ‖x^2 + x₁^2‖₊ = x^2 + x₁^2 := by -+ rw [Real.nnnorm_of_nonneg (le_of_lt h4)] -+ norm_cast -+ -+ rw [← NNReal.coe_le_coe] -+ push_cast -+ simp [*] -+ simp_all -+ rw [abs_of_nonneg] -+ · have U := inv_le_inv₀ h4 h3 -+ rw [U] -+ simp [*] -+ -+ · positivity -+ -+theorem norm_reciprocal_inequality (x : ℝ) (x₁ : ℝ) (hx₁ : x₁ ≤ -1) : -+ ‖x^2 + x₁^2‖₊⁻¹ ≤ (‖x₁‖₊^2)⁻¹ := by -+ -+ have h1 : x₁^2 ≥ 1 := by -+ have h_abs : |x₁| ≥ 1 := by -+ rw [abs_of_nonpos (le_of_lt (lt_of_le_of_lt hx₁ (by norm_num : (-1 : ℝ) < 0)))] -+ linarith -+ simp only [ge_iff_le, one_le_sq_iff_one_le_abs, h_abs] -+ -+ have h2 : x^2 + x₁^2 ≥ x₁^2 := by -+ linarith [sq_nonneg x] -+ -+ have h3 : x₁^2 > 0 := by -+ apply sq_pos_of_ne_zero -+ linarith -+ -+ have h33 : 2 * x₁^2 > 0 := by -+ simp [*] -+ -+ have h4 : x^2 + x₁^2 > 0 := by -+ linarith [sq_nonneg x, h3] -+ -+ have h5 : x₁^2 ≤ x^2 + x₁^2 := h2 -+ -+ have h6 : ‖x₁^2‖₊ = ‖x₁‖₊^2 := by -+ rw [nnnorm_pow] -+ -+ have h7 : ‖x^2 + x₁^2‖₊ = x^2 + x₁^2 := by -+ rw [Real.nnnorm_of_nonneg (le_of_lt h4)] -+ norm_cast -+ -+ rw [← NNReal.coe_le_coe] -+ push_cast -+ simp [*] -+ simp_all -+ rw [abs_of_nonneg] -+ · have U := inv_le_inv₀ h4 h3 -+ rw [U] -+ simp [*] -+ -+ · positivity -+ -+theorem poisson_kernel_integrable (x : ℝ) (hx : x ≠ 0) : -+ MeasureTheory.Integrable (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by -+ -+ have h1 : ∀ t : ℝ, ‖x + t * I‖^2 = x^2 + t^2 := by -+ intro t -+ rw [Complex.norm_add_mul_I, Real.sq_sqrt] -+ positivity -+ -+ have h2 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) = (fun (t : ℝ) ↦ (x^2 + t^2)⁻¹) := by -+ ext t -+ rw [h1] -+ rw [h2] -+ -+ have h3 : ∀ t : ℝ, x^2 + t^2 > 0 := by -+ intro t -+ apply add_pos_of_pos_of_nonneg -+ · exact sq_pos_of_ne_zero hx -+ · exact sq_nonneg t -+ -+ have h4 : Continuous (fun t : ℝ ↦ (x^2 + t^2)⁻¹) := by -+ apply Continuous.inv₀ -+ · exact continuous_const.add (continuous_pow 2) -+ · intro t -+ exact ne_of_gt (h3 t) -+ -+ have integrable_on_bounded : ∀ R > 0, MeasureTheory.IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Icc (-R) R) := by -+ intro R hR -+ refine ContinuousOn.integrableOn_Icc ?_ -+ · exact Continuous.continuousOn h4 -+ -+ have decay_bound : ∀ t : ℝ, 0 < |t| → (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by -+ intro t hyp_t -+ rw [←inv_le_inv₀] -+ simp_all only [ne_eq, gt_iff_lt, abs_pos, inv_inv, le_add_iff_nonneg_left] -+ · positivity -+ · simp_all only [ne_eq, gt_iff_lt, abs_pos, inv_pos] -+ positivity -+ · positivity -+ -+ have decay_bound_1 : ∀ x_1 ≤ -1, ‖x ^ 2 + x_1 ^ 2‖₊⁻¹ ≤ (‖x_1‖₊ ^ 2)⁻¹ := by -+ exact norm_reciprocal_inequality x -+ -+ have decay_bound_2 : ∀ (x_1 : ℝ), 1 ≤ x_1 → ‖x ^ 2 + x_1 ^ 2‖₊⁻¹ ≤ (‖x_1‖₊ ^ 2)⁻¹ := by -+ exact norm_reciprocal_inequality_1 x -+ -+ have f_int_1 : IntegrableOn (fun (t : ℝ) ↦ (t^2)⁻¹) (Set.Iic (-1)) volume := by -+ have D1 : (-2) < (-1 : ℝ) := by simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, -+ Nat.one_lt_ofNat] -+ have D2 : 0 < (1 : ℝ) := by simp only [zero_lt_one] -+ have D := integrableOn_Ioi_rpow_of_lt D1 D2 -+ have D3 := MeasureTheory.IntegrableOn.comp_neg D -+ simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg, neg_Ioi] at D3 -+ have D4 := -+ (integrableOn_Iic_iff_integrableOn_Iio' -+ (by -+ refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ -+ · simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, -+ zero_lt_one, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, -+ EReal.coe_ennreal_zero, EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 -+ simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, zero_lt_one, -+ rpow_neg_ofNat, Int.reduceNeg, zpow_neg] -+ unfold IntegrableOn at D4 -+ have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by -+ funext x -+ simp_all only [even_two, Even.neg_pow] -+ simp_all only [even_two, Even.neg_pow] -+ norm_cast at D4 -+ simp_all only [even_two, Even.neg_pow, Int.reduceNegSucc, Int.cast_neg, Int.cast_one] -+ exact D4 -+ -+ have f_int_2 : IntegrableOn (fun (t : ℝ) ↦ (t^2)⁻¹) (Set.Ici 1) volume := by -+ have D1 : (-2) < (-1 : ℝ) := by simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, -+ Nat.one_lt_ofNat] -+ have D2 : 0 < (1 : ℝ) := by simp only [zero_lt_one] -+ have D3 := integrableOn_Ioi_rpow_of_lt D1 D2 -+ simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg] at D3 -+ have D4 := -+ (integrableOn_Ici_iff_integrableOn_Ioi' -+ (by -+ refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ -+ · simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, -+ zero_lt_one, measure_singleton, EReal.coe_ennreal_zero, EReal.coe_ennreal_top, -+ EReal.zero_ne_top, not_false_eq_true])).mpr D3 -+ simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, zero_lt_one] -+ unfold IntegrableOn at D4 -+ have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by -+ funext x -+ simp_all only [even_two, Even.neg_pow] -+ simp_all only [even_two, Even.neg_pow] -+ norm_cast at D4 -+ -+ have int_neg : IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Iic (-1)) volume := by -+ have h_le : ∀ t ∈ Set.Iic (-1), (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by -+ intro t ht -+ simp only [Set.mem_Iic] at ht -+ -+ have t_neg : t < 0 := lt_of_le_of_lt ht (by norm_num : (-1 : ℝ) < 0) -+ exact decay_bound t (abs_pos.mpr (ne_of_lt t_neg)) -+ have h_meas : AEStronglyMeasurable (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Set.Iic (-1))) := by -+ exact Continuous.aestronglyMeasurable h4 -+ -+ unfold IntegrableOn -+ unfold Integrable -+ constructor -+ · exact h_meas -+ · have Z : HasFiniteIntegral (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Iic (-1))) := by -+ refine MeasureTheory.HasFiniteIntegral.mono'_enorm f_int_1.2 ?_ -+ · unfold Filter.Eventually -+ simp only [measurableSet_Iic, ae_restrict_eq, nnnorm_inv, nnnorm_pow, enorm_le_coe] -+ refine mem_inf_of_right ?_ -+ · refine mem_principal.mpr ?_ -+ · rw [Set.subset_def] -+ simp only [mem_Iic, mem_ofPred_eq] -+ exact decay_bound_1 -+ -+ exact Z -+ -+ have int_pos : IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Ici 1) volume := by -+ have h_le : ∀ t ∈ Set.Ici 1, (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by -+ intro t ht -+ simp only [Set.mem_Ici] at ht -+ -+ have t_pos : t > 0 := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) ht -+ exact decay_bound t (abs_pos.mpr (ne_of_gt t_pos)) -+ have h_meas : AEStronglyMeasurable (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Set.Ici 1)) := by -+ exact Continuous.aestronglyMeasurable h4 -+ -+ unfold IntegrableOn -+ unfold Integrable -+ constructor -+ · exact h_meas -+ · have Z : HasFiniteIntegral (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Ici (1))) := by -+ refine MeasureTheory.HasFiniteIntegral.mono'_enorm f_int_2.2 ?_ -+ · unfold Filter.Eventually -+ simp only [measurableSet_Ici, ae_restrict_eq, nnnorm_inv, nnnorm_pow, enorm_le_coe] -+ refine mem_inf_of_right ?_ -+ · refine mem_principal.mpr ?_ -+ · rw [Set.subset_def] -+ simp only [mem_Ici, mem_ofPred_eq] -+ exact decay_bound_2 -+ -+ exact Z -+ -+ have split : Set.univ = Set.Iic (-1) ∪ Set.Icc (-1) 1 ∪ Set.Ici 1 := by -+ ext t -+ simp only [Set.mem_univ, Set.mem_union, Set.mem_Iic, Set.mem_Icc, Set.mem_Ici, true_iff] -+ by_cases h : t ≤ -1 -+ · left; left; exact h -+ · by_cases h' : t ≥ 1 -+ · right; exact h' -+ · left; right; constructor <;> linarith -+ -+ have Z := -+ MeasureTheory.IntegrableOn.union -+ (MeasureTheory.IntegrableOn.union -+ (int_neg) -+ (integrable_on_bounded 1 zero_lt_one)) -+ (int_pos) -+ -+ simp_all only [ne_eq, gt_iff_lt, abs_pos, Int.reduceNeg, neg_le_self_iff, zero_le_one, Iic_union_Icc_eq_Iic, -+ Iic_union_Ici, integrableOn_univ] -+ -+theorem ae_volume_of_contains_compl_singleton_zero -+ (s : Set ℝ) -+ (h : (univ : Set ℝ) \ {0} ⊆ s) : -+ s ∈ (MeasureTheory.ae volume) := by -+ -+ have h_zero_null : volume ({0} : Set ℝ) = 0 := by -+ exact volume_singleton -+ -+ have h_compl_subset : sᶜ ⊆ {0} := by -+ intro x hx -+ -+ by_contra h_not_zero -+ have : x ∈ univ \ {0} := ⟨trivial, h_not_zero⟩ -+ exact hx (h this) -+ -+ have h_compl_measure : volume sᶜ ≤ volume ({0} : Set ℝ) := -+ measure_mono h_compl_subset -+ -+ have h_compl_zero : volume sᶜ = 0 := by -+ rw [h_zero_null] at h_compl_measure -+ exact le_antisymm h_compl_measure zero_le -+ -+ rwa [mem_ae_iff] -+ -+theorem integral_evaluation (x : ℝ) (T : ℝ) -+ : (3 < T) → ∫ (t : ℝ) in Iic (-T), (‖x + t * I‖ ^ 2)⁻¹ ≤ T⁻¹ := by -+ -+ intro T_large -+ -+ have T00 : ∀ (x t : ℝ), t^2 ≤ ‖x + t * I‖^2 := by -+ intro x t -+ rw [Complex.norm_add_mul_I x t] -+ ring_nf -+ rw [Real.sq_sqrt _] -+ simp only [le_add_iff_nonneg_right]; positivity -+ positivity -+ -+ have T0 : ∀ (x t : ℝ), t ≠ 0 → (‖x + t * I‖^2)⁻¹ ≤ (t^2)⁻¹ := by -+ intro x t hyp -+ have U0 : 0 < t^2 := by positivity -+ have U1 : 0 < ‖x + t * I‖^2 := by -+ rw [Complex.norm_add_mul_I x t] -+ rw [Real.sq_sqrt _] -+ positivity -+ positivity -+ rw [inv_le_inv₀ U1 U0] -+ exact (T00 x t) -+ -+ have T1 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) ≤ᶠ[ae (volume.restrict (Iic (-T)))] (fun (t : ℝ) ↦ (t^2)⁻¹) := by -+ unfold Filter.EventuallyLE -+ unfold Filter.Eventually -+ simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq] -+ refine mem_inf_of_left ?_ -+ · refine Filter.mem_sets.mp ?_ -+ · have U : {x_1 : ℝ | x_1 ≠ 0} ⊆ {x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} := by -+ rw [Set.ofPred_subset_ofPred] -+ intro t hyp_t -+ exact T0 x t hyp_t -+ have U1 : {x_1 : ℝ | x_1 ≠ 0} = (univ \ {0}) := by -+ apply Set.ext -+ intro x -+ simp_all only [ne_eq, ofPred_subset_ofPred, not_false_eq_true, implies_true, mem_ofPred_eq, Set.mem_sdiff, mem_univ, -+ mem_singleton_iff, true_and] -+ -+ rw [U1] at U -+ have Z := ae_volume_of_contains_compl_singleton_zero -+ ({x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} : Set ℝ) U -+ exact Z -+ -+ have T2 : 0 ≤ᶠ[ae (volume.restrict (Iic (-T)))] (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by -+ unfold Filter.EventuallyLE -+ unfold Filter.Eventually -+ simp_all only [ne_eq, Pi.zero_apply, inv_nonneg, norm_nonneg, pow_nonneg, -+ ofPred_true, univ_mem] -+ -+ have T4 : deriv (fun (t : ℝ) ↦ t⁻¹) = (fun t ↦ (- (t^2)⁻¹)) := by -+ exact deriv_inv' -+ -+ have hcont : ContinuousWithinAt (fun t ↦ t⁻¹) (Set.Iic (-T)) (-T) := by -+ refine ContinuousWithinAt.inv₀ ?_ ?_ -+ · exact ContinuousAt.continuousWithinAt fun ⦃U⦄ a ↦ a -+ · intro hyp -+ linarith -+ -+ have hderiv : ∀ x ∈ Set.Iio (-T), HasDerivAt (fun t ↦ t⁻¹) ((fun t ↦ - (t^2)⁻¹) x) x := by -+ -+ intro x hx -+ -+ have hx_ne_zero : x ≠ 0 := by -+ intro h -+ rw [h] at hx -+ simp [Set.Iio] at hx -+ linarith -+ -+ convert hasDerivAt_inv hx_ne_zero -+ -+ have f'int : IntegrableOn (fun t ↦ - (t^2)⁻¹) (Set.Iic (-T)) volume := by -+ have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] -+ have D2 : 0 < T := by positivity -+ have D := integrableOn_Ioi_rpow_of_lt D1 D2 -+ -+ have D3 := MeasureTheory.IntegrableOn.comp_neg D -+ simp [*] at D3 -+ have D4 := -+ (integrableOn_Iic_iff_integrableOn_Iio' -+ (by -+ refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ -+ · simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, neg_lt_neg_iff, -+ Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, EReal.coe_ennreal_zero, -+ EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 -+ simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, neg_lt_neg_iff, -+ Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg] -+ -+ unfold IntegrableOn at D4 -+ have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by -+ funext x -+ simp_all only [even_two, Even.neg_pow] -+ -+ simp_all only [even_two, Even.neg_pow] -+ have D6 := MeasureTheory.integrable_neg_iff.mpr D4 -+ have eq_fun : (-fun x ↦ (x^2)⁻¹) = (fun (x : ℝ) ↦ - (x^2)⁻¹) := by -+ funext x -+ simp only [Pi.neg_apply] -+ rw [eq_fun] at D6 -+ exact D6 -+ -+ have hf : Filter.Tendsto (fun (t : ℝ) ↦ t⁻¹) Filter.atBot (nhds 0) := by exact -+ tendsto_inv_atBot_zero -+ -+ have T5 : ∫ (t : ℝ) in Iic (-T), - (t^2)⁻¹ = (-T)⁻¹ - 0 := by -+ exact MeasureTheory.integral_Iic_of_hasDerivAt_of_tendsto hcont hderiv f'int hf -+ -+ have T6 : ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ = T⁻¹ := by -+ simp only [inv_neg, sub_zero] at T5 -+ have D6 : - ∫ (t : ℝ) in Iic (-T), - (t^2)⁻¹ = ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ := by -+ simp only [integral_neg fun a ↦ (a ^ 2)⁻¹, neg_neg] -+ -+ rw [←D6] -+ rw [T5] -+ simp only [neg_neg] -+ -+ have T3 : Integrable (fun (t : ℝ) ↦ (t^2)⁻¹) (volume.restrict (Iic (-T))) := by -+ -+ have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] -+ have D2 : 0 < T := by positivity -+ have D := integrableOn_Ioi_rpow_of_lt D1 D2 -+ -+ have D3 := MeasureTheory.IntegrableOn.comp_neg D -+ simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg, neg_Ioi] at D3 -+ have D4 := -+ (integrableOn_Iic_iff_integrableOn_Iio' -+ (by -+ refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ -+ · simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, inv_neg, sub_zero, -+ neg_lt_neg_iff, Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, EReal.coe_ennreal_zero, -+ EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 -+ simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, inv_neg, sub_zero, -+ neg_lt_neg_iff, Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg] -+ -+ unfold IntegrableOn at D4 -+ have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by -+ funext x -+ simp_all only [even_two, Even.neg_pow] -+ simp_all only [even_two, Even.neg_pow] -+ norm_cast at D4 -+ simp_all only [even_two, Even.neg_pow] -+ -+ have Z := -+ by -+ calc -+ ∫ (t : ℝ) in Iic (-T), (‖x + t * I‖ ^ 2)⁻¹ ≤ ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ := by -+ exact MeasureTheory.integral_mono_of_nonneg T2 T3 T1 -+ -+ _ = T⁻¹ := by exact T6 -+ -+ exact Z -+ -+theorem integral_evaluation' (x : ℝ) (T : ℝ) -+ : (3 < T) → ∫ (t : ℝ) in Ici (T), (‖x + t * I‖ ^ 2)⁻¹ ≤ T⁻¹ := by -+ intro T_large -+ -+ have T00 : ∀ (x t : ℝ), t^2 ≤ ‖x + t * I‖^2 := by -+ intro x t -+ rw [Complex.norm_add_mul_I x t] -+ ring_nf -+ rw [Real.sq_sqrt _] -+ simp only [le_add_iff_nonneg_right]; positivity -+ positivity -+ -+ have T0 : ∀ (x t : ℝ), t ≠ 0 → (‖x + t * I‖^2)⁻¹ ≤ (t^2)⁻¹ := by -+ intro x t hyp -+ have U0 : 0 < t^2 := by positivity -+ have U1 : 0 < ‖x + t * I‖^2 := by -+ rw [Complex.norm_add_mul_I x t] -+ rw [Real.sq_sqrt _] -+ positivity -+ positivity -+ rw [inv_le_inv₀ U1 U0] -+ exact (T00 x t) -+ -+ have T2 : 0 ≤ᶠ[ae (volume.restrict (Ioi T))] (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by -+ unfold Filter.EventuallyLE -+ unfold Filter.Eventually -+ simp_all only [ne_eq, Pi.zero_apply, inv_nonneg, norm_nonneg, pow_nonneg, -+ ofPred_true, univ_mem] -+ -+ have T3 : Integrable (fun (t : ℝ) ↦ - (t^2)⁻¹) (volume.restrict (Ioi T)) := by -+ have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] -+ have D2 : 0 < T := by positivity -+ have D := integrableOn_Ioi_rpow_of_lt D1 D2 -+ simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg] at D -+ exact MeasureTheory.Integrable.fun_neg D -+ -+ have T3' : Integrable (fun (t : ℝ) ↦ (t^2)⁻¹) (volume.restrict (Ioi T)) := by -+ have D := MeasureTheory.Integrable.fun_neg T3 -+ simp_all only [ne_eq, measurableSet_Ioi, ae_restrict_eq, neg_neg] -+ -+ have T1 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) ≤ᶠ[ae (volume.restrict (Ioi T))] (fun (t : ℝ) ↦ (t^2)⁻¹) := by -+ unfold Filter.EventuallyLE -+ unfold Filter.Eventually -+ simp_all only [ne_eq, measurableSet_Ioi, ae_restrict_eq] -+ refine mem_inf_of_left ?_ -+ · refine Filter.mem_sets.mp ?_ -+ · have U : {x_1 : ℝ | x_1 ≠ 0} ⊆ {x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} := by -+ rw [Set.ofPred_subset_ofPred] -+ intro t hyp_t -+ exact T0 x t hyp_t -+ have U1 : {x_1 : ℝ | x_1 ≠ 0} = (univ \ {0}) := by -+ apply Set.ext -+ intro x -+ simp_all only [ne_eq, ofPred_subset_ofPred, not_false_eq_true, implies_true, mem_ofPred_eq, Set.mem_sdiff, mem_univ, -+ mem_singleton_iff, true_and] -+ -+ rw [U1] at U -+ have Z := ae_volume_of_contains_compl_singleton_zero -+ ({x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} : Set ℝ) U -+ exact Z -+ -+ have hcont : ContinuousWithinAt (fun t ↦ t⁻¹) (Set.Ici T) T := by -+ refine ContinuousWithinAt.inv₀ ?_ ?_ -+ · exact ContinuousAt.continuousWithinAt fun ⦃U⦄ a ↦ a -+ · intro hyp -+ linarith -+ -+ have hderiv : ∀ x ∈ Set.Ioi T, HasDerivAt (fun t ↦ t⁻¹) ((fun t ↦ - (t^2)⁻¹) x) x := by -+ -+ intro x hx -+ -+ have hx_ne_zero : x ≠ 0 := by -+ intro h -+ rw [h] at hx -+ simp at hx -+ linarith -+ -+ convert hasDerivAt_inv hx_ne_zero -+ -+ have hf : Filter.Tendsto (fun (t : ℝ) ↦ t⁻¹) Filter.atTop (nhds 0) := by exact -+ tendsto_inv_atTop_zero -+ -+ have T5 : ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ = (T)⁻¹ - 0 := by -+ have U := MeasureTheory.integral_Ioi_of_hasDerivAt_of_tendsto hcont hderiv T3 hf -+ simp [*] at U -+ rw [MeasureTheory.integral_neg] at U -+ simp_all only [ne_eq, mem_Ioi, neg_inj, sub_zero] -+ -+ have T6 : ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ = T⁻¹ := by -+ simp only [sub_zero] at T5 -+ have D6 : - ∫ (t : ℝ) in Ioi T, - (t^2)⁻¹ = ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ := by -+ simp only [integral_neg fun a ↦ (a ^ 2)⁻¹, neg_neg] -+ -+ rw [←D6] -+ rw [←T5] -+ exact D6 -+ -+ have Z := -+ by -+ calc -+ ∫ (t : ℝ) in Ioi T, (‖x + t * I‖ ^ 2)⁻¹ ≤ ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ := by -+ exact MeasureTheory.integral_mono_of_nonneg T2 T3' T1 -+ -+ _ = T⁻¹ := by exact T6 -+ -+ rw [←MeasureTheory.integral_Ici_eq_integral_Ioi] at Z -+ -+ exact Z -+ -+lemma IBound_aux1 (X₀ : ℝ) (X₀pos : X₀ > 0) (k : ℕ) : ∃ C ≥ 1, ∀ X ≥ X₀, Real.log X ^ k ≤ C * X := by -+ -+ have ⟨M, hM⟩ := Filter.eventually_atTop.mp (isLittleO_log_rpow_rpow_atTop k zero_lt_one).eventuallyLE -+ -+ let f := fun X ↦ Real.log X ^ k / X -+ let I1 := Icc X₀ M -+ have : 0 ∉ I1 := notMem_Icc_of_lt X₀pos -+ have f_cont : ContinuousOn f (Icc X₀ M) := -+ ((continuousOn_log.pow k).mono (subset_compl_singleton_iff.mpr this)).div -+ continuous_id.continuousOn (fun x hx ↦ ne_of_mem_of_not_mem hx this) -+ have ⟨C₁, hC₁⟩ := isCompact_Icc.exists_bound_of_continuousOn f_cont -+ use max C₁ 1, le_max_right C₁ 1 -+ intro X hX -+ have Xpos : X > 0 := lt_of_lt_of_le X₀pos hX -+ by_cases hXM : X ≤ M -+ · rw[← div_le_iff₀ Xpos] -+ calc -+ f X ≤ ‖f X‖ := le_norm_self _ -+ _ ≤ C₁ := hC₁ X ⟨hX, hXM⟩ -+ _ ≤ max C₁ 1 := le_max_left C₁ 1 -+ · calc -+ Real.log X ^ k ≤ ‖Real.log X ^ k‖ := le_norm_self _ -+ _ ≤ ‖X ^ 1‖ := by exact_mod_cast hM X (by linarith[hXM]) -+ _ = 1 * X := by -+ rw[pow_one, one_mul] -+ apply norm_of_nonneg -+ exact Xpos.le -+ _ ≤ max C₁ 1 * X := by -+ rw[mul_le_mul_iff_left₀ Xpos] -+ exact le_max_right C₁ 1 -+ -+theorem I1Bound -+ {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) -+ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : -+ ∃ C > 0, ∀(ε : ℝ) (_ : 0 < ε) -+ (_ : ε < 1) -+ (X : ℝ) (_ : 3 < X) -+ {T : ℝ} (_ : 3 < T), -+ ‖I₁ SmoothingF ε X T‖ ≤ C * X * Real.log X / (ε * T) := by -+ -+ obtain ⟨M, ⟨M_is_pos, M_bounds_mellin_hard⟩⟩ := -+ MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF -+ -+ have G0 : ∃K > 0, ∀(t σ : ℝ), 1 < σ → σ < 2 → ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ K * (σ - 1)⁻¹ := by -+ let ⟨K', ⟨K'_pos, K'_bounds_zeta⟩⟩ := strongPnt_triv_bound_zeta -+ use (2 * (K' + 1)) -+ use (by positivity) -+ intro t σ cond cond2 -+ -+ have T0 : 0 < K' + 1 := by positivity -+ have T1 : 1 ≤ (σ - 1)⁻¹ := by -+ have U : σ - 1 ≤ 1 := by linarith -+ have U1 := (inv_le_inv₀ (by positivity) (by exact sub_pos.mpr cond)).mpr U -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, ge_iff_le, Complex.norm_div, -+ norm_neg, tsub_le_iff_right, inv_one] -+ -+ have T : (K' + 1) * 1 ≤ (K' + 1) * (σ - 1)⁻¹ := -+ by -+ exact (mul_le_mul_iff_right₀ T0).mpr T1 -+ have T2 : (K' + 1) ≤ (K' + 1) * (σ - 1)⁻¹ := by -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, ge_iff_le, Complex.norm_div, -+ norm_neg, mul_one, le_mul_iff_one_le_right] -+ -+ have U := calc -+ ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ = ‖-ζ' (σ + t * I) / ζ (σ + t * I)‖ := by -+ rw [← norm_neg _, mul_comm, neg_div' _ _] -+ _ ≤ (σ - 1)⁻¹ + K' := K'_bounds_zeta σ t cond -+ _ ≤ (σ - 1)⁻¹ + (K' + 1) := by aesop -+ _ ≤ (K' + 1) * (σ - 1)⁻¹ + (K' + 1) := by aesop -+ _ ≤ (K' + 1) * (σ - 1)⁻¹ + (K' + 1) * (σ - 1)⁻¹ := by linarith -+ _ = 2 * (K' + 1) * (σ - 1)⁻¹ := by -+ ring_nf -+ -+ exact U -+ -+ obtain ⟨K, ⟨K_is_pos, K_bounds_zeta_at_any_t'⟩⟩ := G0 -+ -+ have C_final_pos : |π|⁻¹ * 2⁻¹ * (Real.exp 1 * K * M) > 0 := by -+ positivity -+ -+ use (|π|⁻¹ * 2⁻¹ * (Real.exp 1 * K * M)) -+ use C_final_pos -+ -+ intro eps eps_pos eps_less_one X X_large T T_large -+ -+ let pts_re := 1 + (Real.log X)⁻¹ -+ let pts := fun (t : ℝ) ↦ (pts_re + t * I) -+ -+ have pts_re_triv : ∀(t : ℝ), (pts t).re = pts_re := by -+ intro t -+ unfold pts -+ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, -+ add_zero] -+ -+ have pts_re_ge_one : 1 < pts_re := by -+ unfold pts_re -+ simp only [lt_add_iff_pos_right, inv_pos] -+ have U : 1 < X := by linarith -+ exact Real.log_pos U -+ -+ have pts_re_le_one : pts_re < 2 := by -+ unfold pts_re -+ have Z0 : 3 ∈ {x : ℝ | 1 ≤ x} := by -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, Complex.norm_div, -+ mem_ofPred_eq, Nat.one_le_ofNat] -+ have Z1 : X ∈ {x : ℝ | 1 ≤ x} := by -+ simp only [mem_ofPred_eq] -+ linarith -+ have Z : Real.log 3 < Real.log X := -+ by -+ refine log_lt_log ?_ X_large -+ simp only [Nat.ofNat_pos] -+ -+ have Z01 : 1 < Real.log 3 := -+ by -+ have Z001 : 1 = Real.log (rexp 1) := by exact Eq.symm (Real.log_exp 1) -+ rw [Z001] -+ have Z002 : (0 : ℝ) < rexp 1 := by positivity -+ have Z003 : (0 : ℝ) < 3 := by positivity -+ have Z004 : rexp 1 < 3 := by -+ calc -+ rexp 1 < (↑ 2.7182818286 : ℚ) := Real.exp_one_lt_d9 -+ _ < (↑ 3 : ℚ) := by linarith -+ -+ exact (Real.log_lt_log_iff Z002 Z003).mpr Z004 -+ -+ have Zpos0 : 0 < Real.log 3 := by positivity -+ have Zpos1 : 0 < Real.log X := by calc -+ 0 < Real.log 3 := Zpos0 -+ _ < Real.log X := Z -+ -+ have Z1 : (Real.log X)⁻¹ < (Real.log 3)⁻¹ := -+ by -+ exact (inv_lt_inv₀ Zpos1 Zpos0).mpr Z -+ -+ have Z02 : (Real.log 3)⁻¹ < 1 := by -+ have T01 := (inv_lt_inv₀ ?_ ?_).mpr Z01 -+ simp only [inv_one] at T01 -+ exact T01 -+ exact Zpos0 -+ simp only [zero_lt_one] -+ -+ have Z2 : 1 + (Real.log X)⁻¹ < 1 + (Real.log 3)⁻¹ := by -+ exact (add_lt_add_iff_left 1).mpr Z1 -+ -+ have Z3 : 1 + (Real.log 3)⁻¹ < 2 := by -+ calc -+ 1 + (Real.log 3)⁻¹ < 1 + 1 := by linarith -+ _ = 2 := by ring_nf -+ -+ calc -+ 1 + (Real.log X)⁻¹ < 1 + (Real.log 3)⁻¹ := Z2 -+ _ < 2 := Z3 -+ -+ have inve : (pts_re - 1)⁻¹ = Real.log X := by -+ unfold pts_re -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, -+ Complex.norm_div, add_sub_cancel_left, inv_inv] -+ -+ have K_bounds_zeta_at_any_t : ∀(t : ℝ), ‖ζ' (pts t) / ζ (pts t)‖ ≤ K * Real.log X := by -+ intro t -+ rw [←inve] -+ exact K_bounds_zeta_at_any_t' t pts_re pts_re_ge_one pts_re_le_one -+ -+ have pts_re_pos : pts_re > 0 := by -+ unfold pts_re -+ positivity -+ -+ have triv_pts_lo_bound : ∀(t : ℝ), pts_re ≤ (pts t).re := by -+ intro t -+ unfold pts_re -+ exact Eq.ge (pts_re_triv t) -+ -+ have triv_pts_up_bound : ∀(t : ℝ), (pts t).re ≤ 2 := by -+ intro t -+ unfold pts -+ refine EReal.coe_le_coe_iff.mp ?_ -+ · simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, -+ Complex.norm_div, le_refl, implies_true, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, -+ I_im, mul_one, sub_self, add_zero, EReal.coe_le_coe_iff] -+ exact le_of_lt pts_re_le_one -+ -+ have pts_re_ge_1 : pts_re > 1 := by -+ unfold pts_re -+ exact pts_re_ge_one -+ -+ have X_pos_triv : 0 < X := by positivity -+ -+ let f := fun (t : ℝ) ↦ SmoothedChebyshevIntegrand SmoothingF eps X (pts t) -+ -+ have G : ∀(t : ℝ), ‖f t‖ ≤ (K * M) * Real.log X * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by -+ -+ intro t -+ -+ let M_bounds_mellin_easy := fun (t : ℝ) ↦ M_bounds_mellin_hard pts_re pts_re_pos (pts t) (triv_pts_lo_bound t) (triv_pts_up_bound t) eps eps_pos eps_less_one -+ -+ let zeta_part := (fun (t : ℝ) ↦ -ζ' (pts t) / ζ (pts t)) -+ let mellin_part := (fun (t : ℝ) ↦ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF eps x)) (pts t)) -+ let X_part := (fun (t : ℝ) ↦ (↑X : ℂ) ^ (pts t)) -+ -+ let g := fun (t : ℝ) ↦ (zeta_part t) * (mellin_part t) * (X_part t) -+ -+ have X_part_eq : ∀(t : ℝ), ‖X_part t‖ = X^pts_re := by -+ intro t -+ have U := Complex.norm_cpow_eq_rpow_re_of_pos (X_pos_triv) (pts t) -+ rw [pts_re_triv t] at U -+ exact U -+ -+ have X_part_bound : ∀(t : ℝ), ‖X_part t‖ ≤ X^pts_re := by -+ intro t -+ rw [←X_part_eq] -+ -+ have mellin_bound : ∀(t : ℝ), ‖mellin_part t‖ ≤ M * (eps * ‖pts t‖ ^ 2)⁻¹ := by -+ intro t -+ exact M_bounds_mellin_easy t -+ -+ have X_part_and_mellin_bound : ∀(t : ℝ),‖mellin_part t * X_part t‖ ≤ M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by -+ intro t -+ exact norm_mul_le_of_le (mellin_bound t) (X_part_bound t) -+ -+ have T2 : ∀(t : ℝ), ‖zeta_part t‖ = ‖ζ' (pts t) / ζ (pts t)‖ := by -+ intro t -+ unfold zeta_part -+ simp only [Complex.norm_div, norm_neg] -+ -+ have zeta_bound : ∀(t : ℝ), ‖zeta_part t‖ ≤ K * Real.log X := by -+ intro t -+ unfold zeta_part -+ rw [T2] -+ exact K_bounds_zeta_at_any_t t -+ -+ have g_bound : ∀(t : ℝ), ‖zeta_part t * (mellin_part t * X_part t)‖ ≤ (K * Real.log X) * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) := by -+ intro t -+ exact norm_mul_le_of_le (zeta_bound t) (X_part_and_mellin_bound t) -+ -+ have T1 : f = g := by rfl -+ -+ have final_bound_pointwise : ‖f t‖ ≤ K * Real.log X * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) := by -+ rw [T1] -+ unfold g -+ rw [mul_assoc] -+ exact g_bound t -+ -+ have trivialize : K * Real.log X * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) = (K * M) * Real.log X * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by -+ ring_nf -+ -+ rw [trivialize] at final_bound_pointwise -+ exact final_bound_pointwise -+ -+ have σ₀_gt : 1 < pts_re := by exact pts_re_ge_1 -+ have σ₀_le_2 : pts_re ≤ 2 := by -+ unfold pts_re -+ -+ exact -+ Preorder.le_trans (1 + (Real.log X)⁻¹) (pts (SmoothingF (SmoothingF M))).re 2 -+ (triv_pts_lo_bound (SmoothingF (SmoothingF M))) (triv_pts_up_bound (SmoothingF (SmoothingF M))) -+ -+ have f_integrable := SmoothedChebyshevPull1_aux_integrable eps_pos eps_less_one X_large σ₀_gt σ₀_le_2 suppSmoothingF SmoothingFnonneg mass_one ContDiffSmoothingF -+ -+ have S : X^pts_re = rexp 1 * X := by -+ unfold pts_re -+ -+ calc -+ X ^ (1 + (Real.log X)⁻¹) = X * X ^ ((Real.log X)⁻¹) := by -+ refine rpow_one_add' ?_ ?_ -+ · positivity -+ · exact Ne.symm (ne_of_lt pts_re_pos) -+ _ = X * rexp 1 := by -+ refine (mul_right_inj' ?_).mpr ?_ -+ · exact Ne.symm (ne_of_lt X_pos_triv) -+ · refine rpow_inv_log X_pos_triv ?_ -+ · by_contra h -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, -+ Complex.norm_div, Nat.not_ofNat_lt_one] -+ _ = rexp 1 * X := by ring_nf -+ -+ have pts_re_neq_zero : pts_re ≠ 0 := by -+ by_contra h -+ rw [h] at pts_re_ge_1 -+ simp only [gt_iff_lt] at pts_re_ge_1 -+ norm_cast at pts_re_ge_1 -+ -+ have Z := -+ by -+ calc -+ ‖∫ (t : ℝ) in Iic (-T), f t‖ ≤ ∫ (t : ℝ) in Iic (-T), ‖f t‖ := MeasureTheory.norm_integral_le_integral_norm f -+ _ ≤ ∫ (t : ℝ) in Iic (-T), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re := by -+ refine integral_mono ?_ ?_ (fun t ↦ G t) -+ · refine Integrable.norm ?_ -+ · unfold f -+ exact MeasureTheory.Integrable.restrict f_integrable -+ · have equ : ∀(t : ℝ), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re = (K * M) * Real.log X * eps⁻¹ * X ^ pts_re * (‖pts t‖^2)⁻¹ := by -+ intro t; ring_nf -+ have fun_equ : (fun (t : ℝ) ↦ ((K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re)) = (fun (t : ℝ) ↦ ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re * (‖pts t‖^2)⁻¹)) := by -+ funext t -+ exact equ t -+ -+ rw [fun_equ] -+ have nonzero := ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re) -+ have simple_int : MeasureTheory.Integrable (fun (t : ℝ) ↦ (‖pts t‖^2)⁻¹) -+ := by -+ unfold pts -+ exact poisson_kernel_integrable pts_re (pts_re_neq_zero) -+ -+ have U := MeasureTheory.Integrable.const_mul simple_int ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re) -+ refine MeasureTheory.Integrable.restrict ?_ -+ exact U -+ _ = (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * ∫ (t : ℝ) in Iic (-T), (‖pts t‖ ^ 2)⁻¹ := by -+ have simpli : ∀(t : ℝ), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re = (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * (‖pts t‖^2)⁻¹ := -+ by intro t; ring_nf -+ have simpli_fun : (fun (t : ℝ) ↦ (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re ) = (fun (t : ℝ) ↦ ((K * M) * Real.log X * X ^ pts_re * eps⁻¹ * (‖pts t‖^2)⁻¹)) := -+ by funext t; ring_nf -+ rw [simpli_fun] -+ exact MeasureTheory.integral_const_mul ((K * M) * Real.log X * X ^ pts_re * eps⁻¹) (fun (t : ℝ) ↦ (‖pts t‖^2)⁻¹) -+ _ ≤ (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * T⁻¹ := by -+ have U := integral_evaluation (pts_re) T (T_large) -+ unfold pts -+ simp only [ge_iff_le] -+ have U2 : 0 ≤ (K * M) * Real.log X * X ^ pts_re * eps⁻¹ := by -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, -+ Complex.norm_div, le_refl, implies_true, inv_pos, mul_nonneg_iff_of_pos_right] -+ refine Left.mul_nonneg ?_ ?_ -+ · refine Left.mul_nonneg ?_ ?_ -+ · exact Left.mul_nonneg (by positivity) (by positivity) -+ · refine log_nonneg ?_ -+ · linarith -+ · refine Left.mul_nonneg ?_ ?_ -+ · exact exp_nonneg 1 -+ · exact le_of_lt X_pos_triv -+ have U1 := mul_le_mul_of_nonneg_left U U2 -+ -+ exact U1 -+ _ = (Real.exp 1 * K * M) * Real.log X * X * eps⁻¹ * T⁻¹ := by -+ rw [S] -+ ring_nf -+ _ = (Real.exp 1 * K * M) * X * Real.log X / (eps * T) := by ring_nf -+ -+ unfold I₁ -+ unfold f at Z -+ unfold pts at Z -+ have Z3 : (↑pts_re : ℂ) = 1 + (Real.log X)⁻¹ := by unfold pts_re; norm_cast -+ rw [Z3] at Z -+ rw [Complex.norm_mul (1 / (2 * ↑π * I)) _] -+ simp only [one_div, mul_inv_rev, inv_I, neg_mul, norm_neg, Complex.norm_mul, norm_I, norm_inv, -+ norm_real, norm_eq_abs, Complex.norm_ofNat, one_mul, ofReal_inv, ge_iff_le] -+ have Z2 : 0 ≤ |π|⁻¹ * 2⁻¹ := by positivity -+ simp only [ofReal_inv] at Z -+ simp only [ge_iff_le] -+ have Z4 := -+ mul_le_mul_of_nonneg_left Z Z2 -+ ring_nf -+ ring_nf at Z4 -+ exact Z4 -+ -+lemma I9I1 {SmoothingF : ℝ → ℝ} {ε X T : ℝ} (Xpos : 0 < X) : -+ I₉ SmoothingF ε X T = conj (I₁ SmoothingF ε X T) := by -+ unfold I₉ I₁ -+ simp only [map_mul, map_div₀, conj_I, conj_ofReal, conj_ofNat, map_one] -+ rw [neg_mul, mul_neg, ← neg_mul] -+ congr -+ · ring -+ · rw [← integral_conj, ← integral_comp_neg_Ioi, integral_Ici_eq_integral_Ioi] -+ apply setIntegral_congr_fun <| measurableSet_Ioi -+ intro t ht -+ simp only -+ rw[← smoothedChebyshevIntegrand_conj Xpos] -+ simp -+ -+theorem I9Bound -+ {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) -+ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : -+ ∃ C > 0, ∀{ε : ℝ} (_ : 0 < ε) -+ (_ : ε < 1) -+ (X : ℝ) (_ : 3 < X) -+ {T : ℝ} (_ : 3 < T), -+ ‖I₉ SmoothingF ε X T‖ ≤ C * X * Real.log X / (ε * T) := by -+ obtain ⟨C, Cpos, bound⟩ := I1Bound suppSmoothingF ContDiffSmoothingF SmoothingFnonneg mass_one -+ refine ⟨C, Cpos, ?_⟩ -+ intro ε εpos ε_lt_one X X_gt T T_gt -+ specialize bound ε εpos ε_lt_one X X_gt T_gt -+ rwa [I9I1 (by linarith), norm_conj] -+ -+lemma one_add_inv_log {X : ℝ} (X_ge : 3 ≤ X): (1 + (Real.log X)⁻¹) < 2 := by -+ rw[← one_add_one_eq_two] -+ refine (add_lt_add_iff_left 1).mpr ?_ -+ refine inv_lt_one_of_one_lt₀ ?_ -+ refine (lt_log_iff_exp_lt ?_).mpr ?_ <;> linarith[Real.exp_one_lt_d9] -+ -+theorem log_pos (T : ℝ) (T_gt : 3 < T) : (Real.log T > 1) := by -+ have elt3 : Real.exp 1 < 3 := by -+ linarith[Real.exp_one_lt_d9] -+ have logTgt1 : Real.log T > 1 := by -+ refine (lt_log_iff_exp_lt ?_).mpr ?_ -+ · linarith -+ · linarith -+ exact logTgt1 -+ -+lemma I2Bound {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ {A C₂ : ℝ} (has_bound: LogDerivZetaHasBound A C₂) (C₂pos : 0 < C₂) (A_in : A ∈ Ioc 0 (1 / 2)) : -+ ∃ (C : ℝ) (_ : 0 < C), -+ ∀(X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) -+ (_ : ε < 1) {T : ℝ} (_ : 3 < T), -+ let σ₁ := sigma1Of A T -+ ‖I₂ SmoothingF ε T X σ₁‖ ≤ C * X / (ε * T) := by -+ have ⟨C₁, C₁pos, Mbd⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF -+ have := (IBound_aux1 3 (by norm_num) 9) -+ obtain ⟨C₃, ⟨C₃_gt, hC₃⟩⟩ := this -+ -+ let C' : ℝ := C₁ * C₂ * C₃ * rexp 1 -+ have : C' > 0 := by positivity -+ use ‖1/(2*π*I)‖ * (2 * C'), by -+ refine Right.mul_pos ?_ ?_ -+ · rw[norm_pos_iff] -+ simp[pi_ne_zero] -+ · simp[this] -+ intro X X_gt ε ε_pos ε_lt_one T T_gt σ₁ -+ -+ have Xpos : 0 < X := lt_trans (by simp only [Nat.ofNat_pos]) X_gt -+ have Tpos : 0 < T := lt_trans (by norm_num) T_gt -+ have log_big : 1 < Real.log T := by exact log_pos T (T_gt) -+ unfold I₂ -+ rw[norm_mul, mul_assoc (c := X), ← mul_div] -+ refine mul_le_mul_of_nonneg_left ?_ (norm_nonneg _) -+ have interval_length_nonneg : σ₁ ≤ 1 + (Real.log X)⁻¹ := by -+ have : σ₁ = sigma1Of A T := rfl -+ rw [this] -+ unfold sigma1Of -+ rw[sub_le_iff_le_add] -+ nth_rw 1 [← add_zero 1] -+ rw[add_assoc] -+ apply add_le_add_right -+ refine Left.add_nonneg ?_ ?_ -+ · rw[inv_nonneg, log_nonneg_iff Xpos] -+ exact le_trans (by norm_num) (le_of_lt X_gt) -+ · refine div_nonneg ?_ ?_ -+ exact A_in.1.le -+ rw[log_nonneg_iff Tpos] -+ exact le_trans (by norm_num) (le_of_lt T_gt) -+ have : σ₁ = sigma1Of A T := rfl -+ have σ₁pos : 0 < σ₁ := by -+ have : σ₁ = sigma1Of A T := rfl -+ rw [this] -+ unfold sigma1Of -+ rw[sub_pos] -+ calc -+ A / Real.log T ≤ 1 / 2 / Real.log T := by -+ refine div_le_div_of_nonneg_right (A_in.2) ?_ -+ apply le_of_lt -+ linarith -+ -+ _ ≤ 1 / 2 / 1 := by -+ refine div_le_div_of_nonneg_left (by norm_num) (by norm_num) ?_ -+ apply le_of_lt -+ refine (lt_log_iff_exp_lt ?_).mpr ?_ <;> linarith[Real.exp_one_lt_d9] -+ _ < 1 := by norm_num -+ suffices ∀ σ ∈ Ioc σ₁ (1 + (Real.log X)⁻¹), ‖SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I)‖ ≤ C' * X / (ε * T) by -+ calc -+ ‖∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, -+ SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I)‖ ≤ -+ C' * X / (ε * T) * |1 + (Real.log X)⁻¹ - σ₁| := by -+ refine intervalIntegral.norm_integral_le_of_norm_le_const ?_ -+ convert this using 3 -+ apply uIoc_of_le -+ exact interval_length_nonneg -+ _ ≤ C' * X / (ε * T) * 2 := by -+ apply mul_le_mul_of_nonneg_left -+ rw[abs_of_nonneg (sub_nonneg.mpr interval_length_nonneg)] -+ calc -+ 1 + (Real.log X)⁻¹ - σ₁ ≤ 1 + (Real.log X)⁻¹ := by linarith -+ _ ≤ 2 := (one_add_inv_log X_gt.le).le -+ positivity -+ _ = 2 * C' * X / (ε * T) := by ring -+ -+ intro σ hσ -+ unfold SmoothedChebyshevIntegrand -+ have log_deriv_zeta_bound : ‖ζ' (σ - T * I) / ζ (σ - T * I)‖ ≤ C₂ * (C₃ * T) := by -+ calc -+ ‖ζ' (σ - (T : ℝ) * I) / ζ (σ - (T : ℝ) * I)‖ = ‖ζ' (σ + (-T : ℝ) * I) / ζ (σ + (-T : ℝ) * I)‖ := by -+ have Z : σ - (T : ℝ) * I = σ + (- T : ℝ) * I := by simp; ring_nf -+ simp [Z] -+ _ ≤ C₂ * Real.log |-T| ^ 9 := has_bound σ (-T) (by simp; rw [abs_of_pos Tpos]; exact T_gt) (by rw[this] at hσ; unfold sigma1Of at hσ; simp at hσ ⊢; replace hσ := hσ.1; linarith) -+ _ ≤ C₂ * Real.log T ^ 9 := by simp -+ _ ≤ C₂ * (C₃ * T) := by gcongr; exact hC₃ T (by linarith) -+ -+ calc -+ ‖-ζ' (σ - T * I) / ζ (σ - T * I) * 𝓜 (fun x ↦ (Smooth1 SmoothingF ε x)) -+ (σ - T * I) * X ^ (σ - T * I)‖ = -+ ‖-ζ' (σ - T * I) / ζ (σ - T * I)‖ * ‖𝓜 (fun x ↦ (Smooth1 SmoothingF ε x)) -+ (σ - T * I)‖ * ‖(X : ℂ) ^ (σ - T * I)‖ := by -+ repeat rw[norm_mul] -+ _ ≤ C₂ * (C₃ * T) * (C₁ * (ε * ‖σ - T * I‖ ^ 2)⁻¹) * (rexp 1 * X) := by -+ apply mul_le_mul₃ -+ · rw[neg_div, norm_neg] -+ exact log_deriv_zeta_bound -+ · refine Mbd σ₁ σ₁pos _ ?_ ?_ ε ε_pos ε_lt_one -+ · simp only [mem_Ioc, sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, -+ sub_self, sub_zero] at hσ ⊢ -+ linarith -+ · simp only [mem_Ioc, sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, -+ sub_self, sub_zero] at hσ ⊢ -+ linarith[one_add_inv_log X_gt.le] -+ · rw[cpow_def_of_ne_zero] -+ · rw[norm_exp,← ofReal_log, re_ofReal_mul] -+ simp only [sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, -+ sub_zero] -+ rw[← le_log_iff_exp_le, Real.log_mul (exp_ne_zero 1), Real.log_exp, ← le_div_iff₀', add_comm, add_div, div_self, one_div] -+ exact hσ.2 -+ · refine (Real.log_pos ?_).ne.symm -+ linarith -+ · apply Real.log_pos -+ linarith -+ · linarith -+ · positivity -+ · positivity -+ · exact_mod_cast Xpos.ne.symm -+ · positivity -+ · positivity -+ · positivity -+ _ = (C' * X * T) / (ε * ‖σ - T * I‖ ^ 2) := by ring -+ _ ≤ C' * X / (ε * T) := by -+ have : ‖σ - T * I‖ ^ 2 ≥ T ^ 2 := by -+ calc -+ ‖σ - T * I‖ ^ 2 = ‖σ + (-T : ℝ) * I‖ ^ 2 := by -+ congr 2 -+ push_cast -+ ring -+ _ = normSq (σ + (-T : ℝ) * I) := (normSq_eq_norm_sq _).symm -+ _ = σ^2 + (-T)^2 := by -+ rw[Complex.normSq_add_mul_I] -+ _ ≥ T^2 := by -+ rw[neg_sq] -+ exact le_add_of_nonneg_left (sq_nonneg _) -+ calc -+ C' * X * T / (ε * ‖↑σ - ↑T * I‖ ^ 2) ≤ C' * X * T / (ε * T ^ 2) := by -+ rw[div_le_div_iff_of_pos_left, mul_le_mul_iff_right₀] -+ exact this -+ exact ε_pos -+ positivity -+ apply mul_pos ε_pos -+ exact lt_of_lt_of_le (pow_pos Tpos 2) this -+ positivity -+ _ = C' * X / (ε * T) := by -+ field_simp -+ -+lemma I8I2 {SmoothingF : ℝ → ℝ} -+ {X ε T σ₁ : ℝ} (T_gt : 3 < T) : -+ I₈ SmoothingF ε X T σ₁ = -conj (I₂ SmoothingF ε X T σ₁) := by -+ unfold I₂ I₈ -+ rw[map_mul, ← neg_mul] -+ congr -+ · simp[conj_ofNat] -+ · rw[← intervalIntegral_conj] -+ apply intervalIntegral.integral_congr -+ intro σ hσ -+ simp only [] -+ rw[← smoothedChebyshevIntegrand_conj] -+ simp only [map_sub, conj_ofReal, map_mul, conj_I, mul_neg, sub_neg_eq_add] -+ exact lt_trans (by norm_num) T_gt -+ -+lemma I8Bound {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ {A C₂ : ℝ} (has_bound : LogDerivZetaHasBound A C₂) (C₂_pos : 0 < C₂) (A_in : A ∈ Ioc 0 (1 / 2)) : -+ -+ ∃ (C : ℝ) (_ : 0 < C), -+ ∀(X : ℝ) (_ : 3 < X) {ε : ℝ} (_: 0 < ε) -+ (_ : ε < 1) -+ {T : ℝ} (_ : 3 < T), -+ let σ₁ : ℝ := 1 - A / (Real.log T) -+ ‖I₈ SmoothingF ε T X σ₁‖ ≤ C * X / (ε * T) := by -+ -+ obtain ⟨C, hC, i2Bound⟩ := I2Bound suppSmoothingF ContDiffSmoothingF has_bound C₂_pos A_in -+ use C, hC -+ intro X hX ε hε0 hε1 T hT σ₁ -+ let i2Bound := i2Bound X hX hε0 hε1 hT -+ rw[I8I2 hX, norm_neg, norm_conj] -+ -+ change ‖I₂ SmoothingF ε T X (sigma1Of A T)‖ ≤ C * X / (ε * T) at i2Bound -+ unfold sigma1Of at i2Bound -+ have σ₁_eq : σ₁ = 1 - A / (Real.log T) := rfl -+ rw[σ₁_eq] -+ exact i2Bound -+ -+lemma log_pow_over_xsq_integral_bounded : -+ ∀ n : ℕ, ∃ C : ℝ, 0 < C ∧ ∀ T >3, ∫ x in Ioo 3 T, (Real.log x)^n / x^2 < C := by -+ have elt3 : Real.exp 1 < 3 := by -+ linarith[Real.exp_one_lt_d9] -+ have log3gt1: 1 < Real.log 3 := by -+ apply (Real.lt_log_iff_exp_lt (by norm_num)).mpr -+ exact elt3 -+ intro n -+ induction n with -+ | zero => -+ use 1 -+ constructor -+ · norm_num -+ · intro T hT -+ have Tgt3 : (3 : ℝ) < T := hT -+ simp only [pow_zero] -+ have h1 :(0 ≤ (-2) ∨ (-2) ≠ (-1) ∧ 0 ∉ Set.uIcc 3 T) := by -+ right -+ constructor -+ · linarith -+ · refine notMem_uIcc_of_lt ?_ ?_ -+ · exact three_pos -+ · linarith -+ have integral := integral_zpow h1 -+ ring_nf at integral -+ -+ have swap_int_kind : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), 1 / x ^ 2 = ∫ (x : ℝ) in Ioo 3 T, 1 / x ^ 2 := by -+ rw [intervalIntegral.integral_of_le (by linarith)] -+ exact MeasureTheory.integral_Ioc_eq_integral_Ioo -+ rw [← swap_int_kind] -+ have change_int_power : ∫ (x : ℝ) in (3 : ℝ)..T, (1 : ℝ) / x ^ (↑ 2) -+ = ∫ (x : ℝ) in (3 : ℝ).. T, x ^ (-2 : ℤ) := by -+ apply intervalIntegral.integral_congr -+ intro x hx -+ simp -+ rw [change_int_power, integral] -+ have : T ^ (-1 : ℤ) > 0 := by -+ refine zpow_pos ?_ (-1) -+ linarith -+ linarith -+ | succ d ih => -+ obtain ⟨Cd, Cdpos, IH⟩ := ih -+ use ((Real.log 3)^(d+1) / 3) + (d+1) * Cd -+ constructor -+ · have logpowpos : (Real.log 3) ^ (d + 1) > 0 := by -+ refine pow_pos ?_ (d + 1) -+ linarith -+ have : 0 < (Real.log 3) ^ (d + 1) / 3 := by -+ exact div_pos logpowpos (by norm_num) -+ have dbound : d + 1 ≥ 1 := by -+ exact Nat.le_add_left 1 d -+ have : Real.log 3 ^ (d + 1) / 3 + (↑d + 1) * Cd > 0 / 3 + 0 := by -+ have term1_pos : 0 < Real.log 3 ^ (d + 1) / 3 := this -+ have term2_pos : 0 < (↑d + 1) * Cd := by -+ refine (mul_pos_iff_of_pos_right Cdpos).mpr ?_ -+ exact Nat.cast_add_one_pos d -+ refine add_lt_add ?_ term2_pos -+ refine div_lt_div₀ logpowpos ?_ ?_ ?_ -+ linarith -+ linarith -+ linarith -+ ring_nf at this -+ ring_nf -+ exact this -+ · intro T Tgt3 -+ let u := fun x : ℝ ↦ (Real.log x) ^ (d + 1) -+ let v := fun x : ℝ ↦ -1 / x -+ let u' := fun x : ℝ ↦ (d + 1 : ℝ) * (Real.log x)^d / x -+ let v' := fun x : ℝ ↦ 1 / x^2 -+ -+ have swap_int_type : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) / x ^ 2 -+ = ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ (d + 1) / x ^ 2 := by -+ rw [intervalIntegral.integral_of_le (by linarith)] -+ exact MeasureTheory.integral_Ioc_eq_integral_Ioo -+ -+ rw [← swap_int_type] -+ -+ have uIcc_is_Icc : Set.uIcc 3 T = Set.Icc 3 T := by -+ exact uIcc_of_lt Tgt3 -+ -+ have cont_u : ContinuousOn u (Set.uIcc 3 T) := by -+ unfold u -+ rw[uIcc_is_Icc] -+ refine ContinuousOn.pow ?_ (d + 1) -+ refine continuousOn_of_forall_continuousAt ?_ -+ intro x hx -+ refine continuousAt_log ?_ -+ linarith [hx.1] -+ -+ have cont_v : ContinuousOn v (Set.uIcc 3 T) := by -+ unfold v -+ rw[uIcc_is_Icc] -+ refine continuousOn_of_forall_continuousAt ?_ -+ intro x hx -+ have cont1 : ContinuousAt (fun (x : ℝ) ↦ 1 / x) x := by -+ refine ContinuousAt.div₀ ?_ (fun ⦃U⦄ a ↦ a) ?_ -+ · exact continuousAt_const -+ · linarith [hx.1] -+ have cont2 : ContinuousAt (fun (x : ℝ) ↦ 1 / x) (-x) := by -+ refine ContinuousAt.div₀ ?_ (fun ⦃U⦄ a ↦ a) ?_ -+ · exact continuousAt_const -+ · linarith [hx.1] -+ have fun1 : (fun (x : ℝ) ↦ -1 / x) = (fun (x : ℝ) ↦ 1 / (-x)) := by -+ ext x -+ ring_nf -+ rw [fun1] -+ exact ContinuousAt.comp cont2 (HasDerivAt.neg (hasDerivAt_id x)).continuousAt -+ -+ have deriv_u : (∀ x ∈ Set.Ioo (3 ⊓ T) (3 ⊔ T), HasDerivAt u (u' x) x) := by -+ intro x hx -+ have min3t : min 3 T = 3 := by -+ exact min_eq_left_of_lt Tgt3 -+ have max3t : max 3 T = T := by -+ exact max_eq_right_of_lt Tgt3 -+ rw[min3t, max3t] at hx -+ unfold u u' -+ have xne0 : x ≠ 0 := by linarith [hx.1] -+ have deriv1 := Real.deriv_log x -+ have deriv2 := (Real.hasDerivAt_log xne0).pow (d + 1) -+ have fun1 : (fun x ↦ (↑d + 1) * Real.log x ^ d / x) = (fun x ↦ (↑d + 1) * Real.log x ^ d * x⁻¹) := by -+ exact rfl -+ have fun2 : (↑d + 1) * Real.log x ^ d / x = (↑d + 1) * Real.log x ^ d * x⁻¹:= by -+ exact rfl -+ rw [fun2] -+ simpa [Nat.cast_add, Nat.cast_one] using! deriv2 -+ -+ have deriv_v : (∀ x ∈ Set.Ioo (3 ⊓ T) (3 ⊔ T), HasDerivAt v (v' x) x) := by -+ intro x hx -+ have min3t : min 3 T = 3 := by -+ exact min_eq_left_of_lt Tgt3 -+ have max3t : max 3 T = T := by -+ exact max_eq_right_of_lt Tgt3 -+ rw[min3t, max3t] at hx -+ have xne0 : x ≠ 0 := by linarith [hx.1] -+ unfold v v' -+ have deriv1 := hasDerivAt_inv xne0 -+ have fun1 : (fun (x : ℝ) ↦ x⁻¹) = (fun (x : ℝ) ↦ 1 / x) := by -+ ext x -+ exact inv_eq_one_div x -+ rw [fun1] at deriv1 -+ have fun2 : -(x ^ 2)⁻¹ = - 1 / x ^ 2 := by -+ field_simp -+ rw [fun2] at deriv1 -+ simpa [neg_div, neg_neg] using! HasDerivAt.neg deriv1 -+ -+ have cont_u' : ContinuousOn u' (Set.uIcc 3 T) := by -+ rw[uIcc_is_Icc] -+ unfold u' -+ refine ContinuousOn.div₀ ?_ ?_ ?_ -+ · refine ContinuousOn.mul ?_ ?_ -+ · exact continuousOn_const -+ · refine ContinuousOn.pow ?_ d -+ refine continuousOn_of_forall_continuousAt ?_ -+ intro x hx -+ refine continuousAt_log ?_ -+ linarith [hx.1] -+ · exact continuousOn_id' (Icc 3 T) -+ · intro x hx -+ linarith [hx.1] -+ -+ have cont_v' : ContinuousOn v' (Set.uIcc 3 T) := by -+ rw[uIcc_is_Icc] -+ unfold v' -+ refine ContinuousOn.div₀ ?_ ?_ ?_ -+ · exact continuousOn_const -+ · exact continuousOn_pow 2 -+ · intro x hx -+ refine pow_ne_zero 2 ?_ -+ linarith [hx.1] -+ -+ have int_u': IntervalIntegrable u' MeasureTheory.volume 3 T := by -+ exact ContinuousOn.intervalIntegrable cont_u' -+ -+ have int_v': IntervalIntegrable v' MeasureTheory.volume 3 T := by -+ exact ContinuousOn.intervalIntegrable cont_v' -+ -+ have IBP := intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt cont_u cont_v deriv_u deriv_v int_u' int_v' -+ -+ unfold u u' v v' at IBP -+ -+ have int1 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) * (1 / x ^ 2) -+ = ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) / x ^ 2 := by -+ refine intervalIntegral.integral_congr ?_ -+ intro x hx -+ field_simp -+ -+ rw[int1] at IBP -+ rw[IBP] -+ -+ have int2 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), (↑d + 1) * Real.log x ^ d / x * (-1 / x) -+ = -(↑d + 1) * ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ d / x ^ 2 := by -+ have : ∀ x, (↑d + 1) * Real.log x ^ d / x * (-1 / x) -+ = -((↑d + 1) * Real.log x ^ d / x ^ 2) := by -+ intro x -+ field_simp -+ have : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), (↑d + 1) * Real.log x ^ d / x * (-1 / x) -+ = ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), -((↑d + 1) * Real.log x ^ d / x ^ 2) := by -+ exact intervalIntegral.integral_congr fun ⦃x⦄ a ↦ this x -+ rw [this] -+ rw [←intervalIntegral.integral_const_mul] -+ ring_nf -+ -+ rw[int2] -+ -+ have int3 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ d / x ^ 2 -+ = ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d / x ^ 2 := by -+ rw [intervalIntegral.integral_of_le (by linarith)] -+ exact MeasureTheory.integral_Ioc_eq_integral_Ioo -+ -+ rw[int3] -+ -+ have IHbound : ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d / x ^ 2 < Cd := by -+ exact IH T Tgt3 -+ -+ ring_nf -+ have bound2 : (Real.log T * Real.log T ^ d * T⁻¹) ≥ 0 := by -+ have logTpos : Real.log T ≥ 0 := by -+ refine log_nonneg ?_ -+ linarith -+ apply mul_nonneg -+ · apply mul_nonneg -+ · exact logTpos -+ · exact pow_nonneg logTpos d -+ · positivity -+ -+ have bound3 : -(Real.log T * Real.log T ^ d * T⁻¹) ≤ 0 := by -+ exact Right.neg_nonpos_iff.mpr bound2 -+ let S := Real.log T * Real.log T ^ d * T⁻¹ -+ have Spos : S ≥ 0 := by -+ unfold S -+ exact bound2 -+ -+ have : (-(Real.log T * Real.log T ^ d * T⁻¹) + Real.log 3 * Real.log 3 ^ d * (1 / 3) + -+ ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) + -+ ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 = (-S + Real.log 3 * Real.log 3 ^ d * (1 / 3) + -+ ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) + -+ ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 := by -+ unfold S -+ rfl -+ rw [this] -+ -+ have GetRidOfS : (-S + Real.log 3 * Real.log 3 ^ d * (1 / 3) -+ + ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) -+ + ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 -+ ≤ ( Real.log 3 * Real.log 3 ^ d * (1 / 3) -+ + ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) -+ + ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 := by -+ linarith [Spos] -+ apply lt_of_le_of_lt GetRidOfS -+ rw [add_assoc] -+ -+ have bound4 : ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 < Cd := IHbound -+ -+ have bound5 : ↑d * ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 ≤ ↑d * Cd := by -+ apply (mul_le_mul_of_nonneg_left bound4.le) -+ exact Nat.cast_nonneg d -+ -+ have bound_sum : ↑d * (∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2) -+ + ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 < ↑d * Cd + Cd := by -+ linarith [bound4, bound5] -+ rw[add_assoc] -+ apply add_lt_add_right -+ field_simp -+ linarith [bound_sum] -+ -+theorem I3Bound {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ {A Cζ : ℝ} (hCζ : LogDerivZetaHasBound A Cζ) (Cζpos : 0 < Cζ) (hA : A ∈ Ioc 0 (1 / 2)) : -+ ∃ (C : ℝ) (_ : 0 < C), -+ ∀ (X : ℝ) (_ : 3 < X) -+ {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) -+ {T : ℝ} (_ : 3 < T), -+ -+ let σ₁ : ℝ := 1 - A / (Real.log T) -+ ‖I₃ SmoothingF ε T X σ₁‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by -+ -+ obtain ⟨CM, CMpos, CMhyp⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF -+ obtain ⟨Cint, Cintpos, Cinthyp⟩ := log_pow_over_xsq_integral_bounded 9 -+ use Cint * CM * Cζ -+ have : Cint * CM > 0 := mul_pos Cintpos CMpos -+ have : Cint * CM * Cζ > 0 := mul_pos this Cζpos -+ use this -+ intro X Xgt3 ε εgt0 εlt1 T Tgt3 σ₁ -+ unfold I₃ -+ unfold SmoothedChebyshevIntegrand -+ -+ have elt3 : Real.exp 1 < 3 := by -+ linarith[Real.exp_one_lt_d9] -+ -+ have log3gt1: 1 < Real.log 3 := by -+ apply (Real.lt_log_iff_exp_lt (by norm_num)).mpr -+ exact elt3 -+ -+ have logXgt1 : Real.log X > 1 := by -+ refine (lt_log_iff_exp_lt ?_).mpr ?_ -+ linarith -+ linarith -+ -+ have logTgt1 : Real.log T > 1 := by -+ refine (lt_log_iff_exp_lt ?_).mpr ?_ -+ linarith -+ linarith -+ -+ have logX9gt1 : Real.log X ^ 1 > 1 := by -+ refine (one_lt_pow_iff_of_nonneg ?_ ?_).mpr logXgt1 -+ linarith -+ linarith -+ -+ have logT9gt1 : Real.log T ^ 1 > 1 := by -+ refine (one_lt_pow_iff_of_nonneg ?_ ?_).mpr logTgt1 -+ linarith -+ linarith -+ -+ have t_bounds : ∀ t ∈ Ioo (-T) (-3), 3 < |t| ∧ |t| < T := by -+ intro t ht -+ obtain ⟨h1,h2⟩ := ht -+ have : |t| = -t := by -+ refine abs_of_neg ?_ -+ linarith[h2] -+ have abs_tgt3 : 3 < |t| := by -+ rw[this] -+ linarith[h2] -+ have abs_tltX : |t| < T := by -+ rw[this] -+ linarith[h1] -+ exact ⟨abs_tgt3, abs_tltX⟩ -+ -+ have logtgt1_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| > 1 := by -+ intro t ht -+ obtain ⟨h1,h2⟩ := ht -+ refine logt_gt_one ?_ -+ exact h1.le -+ -+ have logt9gt1_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 > 1 := by -+ intro t ht -+ refine one_lt_pow₀ (logtgt1_bounds t ht) ?_ -+ linarith -+ -+ have logtltlogT_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| < Real.log T := by -+ intro t ht -+ obtain ⟨h1,h2⟩ := ht -+ have m := log_lt_log (by linarith : 0 < (|t|)) (h2 : |t| < T ) -+ exact m -+ -+ have logt9ltlogT9_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 < Real.log T ^ 9 := by -+ intro t ht -+ obtain h1 := logtltlogT_bounds t ht -+ obtain h2 := logtgt1_bounds t ht -+ have h3: 0 ≤ Real.log |t| := by linarith -+ refine (pow_lt_pow_iff_left₀ ?_ ?_ ?_).mpr h1 -+ linarith -+ linarith -+ linarith -+ -+ have Aoverlogt9gtAoverlogT9_bounds : ∀ t, 3 < |t| ∧ |t| < T → -+ A / Real.log |t| ^ 9 > A / Real.log T ^ 9 := by -+ intro t ht -+ have h1 := logt9ltlogT9_bounds t ht -+ have h2 :=logt9gt1_bounds t ht -+ refine div_lt_div_of_pos_left ?_ ?_ h1 -+ linarith [hA.1] -+ linarith -+ -+ have AoverlogT9in0half: A / Real.log T ^ 1 ∈ Ioo 0 (1/2) := by -+ constructor -+ · refine div_pos ?_ ?_ -+ refine EReal.coe_pos.mp ?_ -+ exact EReal.coe_lt_coe hA.1 -+ linarith -+ · refine (div_lt_comm₀ ?_ ?_).mpr ?_ -+ linarith -+ linarith -+ refine (div_lt_iff₀' ?_).mpr ?_ -+ linarith -+ have hA_lt : A ≤ 1 / 2 := hA.2 -+ have hbound : 1 / 2 < (1 / 2) * Real.log T ^ 1 := by -+ linarith -+ linarith -+ -+ have σ₁lt2 : (σ₁ : ℝ) < 2 := by -+ unfold σ₁ -+ calc 1 - A / Real.log T -+ < 1 - 0 := by simp only [sub_zero]; exact sub_lt_self 1 (div_pos hA.1 (lt_trans zero_lt_one logTgt1)) -+ _ = 1 := by norm_num -+ _ < 2 := by norm_num -+ -+ have σ₁lt1 : σ₁ < 1 := by -+ unfold σ₁ -+ calc 1 - A / Real.log T -+ < 1 - 0 := by simp only [sub_zero]; exact sub_lt_self 1 (div_pos hA.1 (by linarith [logTgt1])) -+ _ = 1 := by norm_num -+ -+ have σ₁pos : 0 < σ₁ := by -+ unfold σ₁ -+ rw [sub_pos] -+ calc -+ A / Real.log T ≤ (1/2) / Real.log T := by -+ apply div_le_div_of_nonneg_right hA.2 (by linarith) -+ _ ≤ (1/2) / 1 := by -+ apply div_le_div_of_nonneg_left (by norm_num) (by norm_num) (by linarith) -+ _ = 1/2 := by norm_num -+ _ < 1 := by norm_num -+ -+ have quotient_bound : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) ≤ Real.log |t| ^ 9/ t ^ 2 := by -+ intro t ht -+ have loght := logt9gt1_bounds t ht -+ have logpos : Real.log |t| ^ 9 > 0 := by linarith -+ have denom_le : t ^ 2 ≤ σ₁ ^ 2 + t ^ 2 := by linarith [sq_nonneg σ₁] -+ have denom_pos : 0 < t ^ 2 := by -+ have : t ^ 2 = |t| ^ 2 := by -+ exact Eq.symm (sq_abs t) -+ rw [this] -+ have h1 := ht.1 -+ have abspos : |t| > 0 := by linarith -+ exact sq_pos_of_pos abspos -+ have denom2_pos : 0 < σ₁ ^ 2 + t ^ 2 := by linarith [sq_nonneg σ₁] -+ exact (div_le_div_iff_of_pos_left logpos denom2_pos denom_pos).mpr denom_le -+ -+ have boundthing : ∀ t, 3 < |t| ∧ |t| < T → σ₁ ∈ Ici (1 - A / Real.log |t|) := by -+ intro t ht -+ have h1 := Aoverlogt9gtAoverlogT9_bounds t ht -+ unfold σ₁ -+ apply mem_Ici.mpr -+ ring_nf -+ -+ apply sub_le_sub_left -+ have : Real.log |t| ≤ Real.log T := by -+ apply Real.log_le_log (by linarith) (le_of_lt ht.2) -+ exact div_le_div_of_nonneg_left (le_of_lt hA.1) (Real.log_pos (by linarith)) this -+ -+ have : ∫ (t : ℝ) in -T..-3, -+ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * -+ ↑X ^ (↑σ₁ + ↑t * I) = ∫ (t : ℝ) in Ioo (-T : ℝ) (-3 : ℝ), -+ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * -+ ↑X ^ (↑σ₁ + ↑t * I) := by -+ rw [intervalIntegral.integral_of_le (by linarith)] -+ exact MeasureTheory.integral_Ioc_eq_integral_Ioo -+ rw[this] -+ -+ have MellinBound : ∀ (t : ℝ) , ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ₁ + t * I)‖ ≤ CM * (ε * ‖(σ₁ + t * I)‖ ^ 2)⁻¹ := by -+ intro t -+ apply CMhyp σ₁ -+ exact σ₁pos -+ · simp only [add_re, mul_re, ofReal_re, ofReal_im, I_re, I_im, mul_zero, zero_mul, sub_zero, add_zero] -+ exact le_rfl -+ · simpa only [add_re, mul_re, ofReal_re, ofReal_im, I_re, I_im, mul_zero, zero_mul, sub_zero, add_zero] using σ₁lt2.le -+ exact εgt0 -+ exact εlt1 -+ -+ have logzetabnd : ∀ t : ℝ, 3 < |t| ∧ |t| < T → ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ ≤ Cζ * Real.log (|t| : ℝ) ^ 9 := by -+ intro t tbounds -+ obtain ⟨tgt3, tltT⟩ := tbounds -+ apply hCζ -+ · exact tgt3 -+ · apply boundthing -+ constructor -+ · exact tgt3 -+ · exact tltT -+ -+ have Mellin_bd : ∀ t, 3 < |t| ∧ |t| < T → -+ ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ₁ + t * I)‖ ≤ CM * (ε * ‖σ₁ + t * I‖ ^ 2)⁻¹ := by -+ intro t ht -+ apply MellinBound -+ -+ have logzeta_bd : ∀ t, 3 < |t| ∧ |t| < T → -+ ‖ζ' (σ₁ + t * I) / ζ (σ₁ + t * I)‖ ≤ Cζ * Real.log |t| ^ 9 := by -+ intro t t_bounds -+ obtain ⟨abs_tgt3,abs_tltX⟩ := t_bounds -+ apply logzetabnd -+ constructor -+ · exact abs_tgt3 -+ · exact abs_tltX -+ have : ‖1 / (2 * ↑π * I) * -+ (I * ∫ (t : ℝ) in -X..-3, -+ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * -+ ↑T ^ (↑σ₁ + ↑t * I))‖ -+ = -+ (1 / (2 * π)) * ‖∫ (t : ℝ) in -X..-3, -+ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * -+ ↑T ^ (↑σ₁ + ↑t * I)‖ := by -+ simp only [norm_mul] -+ rw[Complex.norm_I] -+ simp only [one_mul] -+ have : ‖1 / (2 * ↑π * I)‖ = 1 / (2 * π) := by -+ -+ ring_nf -+ simp only [norm_mul] -+ rw[inv_I] -+ have : ‖-I‖ = ‖-1 * I‖ := by -+ simp -+ rw[this] -+ have : ‖-1 * I‖ = ‖-1‖ * ‖I‖ := by -+ simp -+ rw[this, Complex.norm_I] -+ ring_nf -+ simp -+ rw[this] -+ -+ let f t := (-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * -+ ↑X ^ (↑σ₁ + ↑t * I) -+ -+ let g t := Cζ * CM * Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) * X ^ σ₁ -+ -+ have norm_X_sigma1: ∀ (t : ℝ), ‖↑(X : ℂ) ^ (↑σ₁ + ↑t * I)‖ = X ^ σ₁ := by -+ intro t -+ have Xpos : 0 < X := by linarith -+ have : ((↑σ₁ + ↑t * I).re) = σ₁ := by -+ simp -+ -+ nth_rw 2[← this] -+ apply Complex.norm_cpow_eq_rpow_re_of_pos Xpos -+ -+ have bound_integral : ∀ (t : ℝ), 3 < |t| ∧ |t| < T → ‖f t‖ ≤ g t := by -+ intro t -+ rintro ⟨ht_gt3, ht_ltT⟩ -+ have Xσ_bound : ‖↑(X : ℂ) ^ (↑σ₁ + ↑t * I)‖ = X ^ σ₁ := norm_X_sigma1 t -+ have logtgt1 : 1 < Real.log |t| := by -+ exact logt_gt_one ht_gt3.le -+ have hζ := logzetabnd t ⟨ht_gt3, ht_ltT⟩ -+ have h𝓜 := MellinBound t -+ have : ‖f ↑t‖ = ‖(-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * -+ ↑X ^ (↑σ₁ + ↑t * I)‖ := by -+ rfl -+ rw[this] -+ have : ‖(-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * -+ ↑X ^ (↑σ₁ + ↑t * I)‖ ≤ ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ * -+ ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I)‖ * -+ ‖(↑(X : ℝ) : ℂ) ^ (↑σ₁ + ↑t * I)‖ := by -+ simp [norm_neg] -+ -+ have : ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ * -+ ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I)‖ * -+ ‖(↑X : ℂ) ^ (↑σ₁ + ↑t * I)‖ ≤ (Cζ * Real.log |t| ^ 9) * -+ (CM * (ε * ‖↑σ₁ + ↑t * I‖ ^ 2)⁻¹) * X ^ σ₁:= by -+ rw[Xσ_bound] -+ gcongr -+ have : (Cζ * Real.log |t| ^ 9) * (CM * (ε * ‖↑σ₁ + ↑t * I‖ ^ 2)⁻¹) * X ^ σ₁ = g t := by -+ unfold g -+ ring_nf -+ linarith -+ -+ have int_with_f: ‖1 / (2 * ↑π * I) * -+ (I * -+ ∫ (t : ℝ) in Ioo (-T) (-3), -+ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * -+ ↑X ^ (↑σ₁ + ↑t * I))‖ = ‖1 / (2 * ↑π * I) * -+ (I * -+ ∫ (t : ℝ) in Ioo (-T) (-3), -+ f t)‖ := by -+ unfold f -+ simp -+ rw[int_with_f] -+ apply (norm_mul_le _ _).trans -+ have int_mulbyI_is_int : ‖I * ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ = ‖ ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ := by -+ rw [Complex.norm_mul, Complex.norm_I] -+ ring -+ rw[int_mulbyI_is_int] -+ -+ have norm_1over2pii_le1: ‖1 / (2 * ↑π * I)‖ ≤ 1 := by -+ simp -+ have pi_gt_3 : Real.pi > 3 := by -+ exact pi_gt_three -+ have pi_pos : 0 < π := by linarith [pi_gt_3] -+ have abs_pi_inv_le : |π|⁻¹ ≤ (1 : ℝ) := by -+ rw [abs_of_pos pi_pos] -+ have h : 1 = π * π⁻¹ := by -+ field_simp -+ rw[h] -+ nth_rw 1 [← one_mul π⁻¹] -+ apply mul_le_mul_of_nonneg_right -+ · linarith -+ · exact inv_nonneg.mpr (le_of_lt pi_pos) -+ have : (0 : ℝ) < (2 : ℝ) := by norm_num -+ have h_half_le_one : (2 : ℝ)⁻¹ ≤ 1 := by norm_num -+ rw [abs_of_pos pi_pos] at abs_pi_inv_le -+ norm_num; linarith -+ -+ have : ‖1 / (2 * ↑π * I)‖ * ‖∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ ≤ ‖∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ := by -+ apply mul_le_of_le_one_left -+ · apply norm_nonneg -+ · exact norm_1over2pii_le1 -+ apply le_trans this -+ have : ‖ ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ ≤ ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑ t‖ := by -+ apply norm_integral_le_integral_norm -+ apply le_trans this -+ -+ have norm_f_nonneg: ∀ t, ‖f t‖ ≥ 0 := by -+ exact fun t ↦ norm_nonneg (f t) -+ -+ have g_cont : ContinuousOn g (Icc (-T) (-3)) := by -+ unfold g -+ refine ContinuousOn.mul ?_ ?_ -+ refine ContinuousOn.mul ?_ ?_ -+ refine ContinuousOn.mul ?_ ?_ -+ refine ContinuousOn.mul ?_ ?_ -+ · exact continuousOn_const -+ · exact continuousOn_const -+ · refine ContinuousOn.pow ?_ 9 -+ refine ContinuousOn.log ?_ ?_ -+ · refine Continuous.continuousOn ?_ -+ exact _root_.continuous_abs -+ · intro t ht -+ have h1 := ht.1 -+ have h2 := ht.2 -+ by_contra! -+ have : t = 0 := by -+ exact abs_eq_zero.mp this -+ rw[this] at h2 -+ absurd -+ h2 -+ linarith -+ · refine ContinuousOn.inv₀ ?_ ?_ -+ · refine ContinuousOn.mul ?_ ?_ -+ · exact continuousOn_const -+ · refine ContinuousOn.pow ?_ 2 -+ refine ContinuousOn.norm ?_ -+ refine ContinuousOn.add ?_ ?_ -+ · exact continuousOn_const -+ · refine ContinuousOn.mul ?_ ?_ -+ · refine continuousOn_of_forall_continuousAt ?_ -+ intro x hx -+ exact continuous_ofReal.continuousAt -+ · exact continuousOn_const -+ · intro x hx -+ have norm_sq_pos : ‖(σ₁ : ℂ) + x * Complex.I‖ ^ 2 = σ₁ ^ 2 + x ^ 2 := by -+ rw [Complex.sq_norm] -+ exact normSq_add_mul_I σ₁ x -+ have : 0 < σ₁ ^ 2 + x ^ 2 := by -+ apply add_pos_of_pos_of_nonneg -+ · exact sq_pos_of_pos σ₁pos -+ · exact sq_nonneg x -+ apply mul_ne_zero -+ · linarith -+ · rw [norm_sq_pos] -+ exact ne_of_gt this -+ · exact continuousOn_const -+ -+ have g_integrable_Icc : IntegrableOn g (Icc (-T) (-3)) volume := by -+ exact ContinuousOn.integrableOn_Icc g_cont -+ -+ have g_integrable_Ioo : IntegrableOn g (Ioo (-T) (-3)) volume := by -+ apply MeasureTheory.IntegrableOn.mono_set g_integrable_Icc -+ exact Ioo_subset_Icc_self -+ -+ have int_normf_le_int_g: ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ -+ ≤ ∫ (t : ℝ) in Ioo (-T) (-3), g ↑t := by -+ -+ by_cases h_int : IntervalIntegrable (fun t : ℝ ↦ ‖f t‖) volume (-T) (-3) -+ · have f_int : IntegrableOn (fun (t : ℝ) ↦ ‖f t‖) (Ioo (-T : ℝ) (-3 : ℝ)) volume := by -+ have hle : -T ≤ -3 := by linarith -+ exact (intervalIntegrable_iff_integrableOn_Ioo_of_le hle).mp h_int -+ apply MeasureTheory.setIntegral_mono_on -+ exact f_int -+ exact g_integrable_Ioo -+ exact measurableSet_Ioo -+ intro t ht -+ apply bound_integral -+ have : |t| = -t := by -+ refine abs_of_neg ?_ -+ linarith [ht.2] -+ have abs_tgt3 : 3 < |t| := by -+ rw[this] -+ linarith[ht.2] -+ have abs_tltX : |t| < T := by -+ rw[this] -+ linarith[ht.1] -+ constructor -+ · linarith -+ · linarith -+ · have : ∫ (t : ℝ) in -T..-3, ‖f ↑ t‖ = ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ := by -+ rw [intervalIntegral.integral_of_le (by linarith)] -+ exact MeasureTheory.integral_Ioc_eq_integral_Ioo -+ have : ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ = 0 := by -+ rw [← this] -+ exact intervalIntegral.integral_undef h_int -+ rw [this] -+ apply MeasureTheory.setIntegral_nonneg -+ · exact measurableSet_Ioo -+ · intro t ht -+ have abst_negt : |t| = -t := by -+ refine abs_of_neg ?_ -+ linarith [ht.2] -+ have tbounds1 : 3 < |t| ∧ |t| < T := by -+ rw[abst_negt] -+ constructor -+ · linarith [ht.2] -+ · linarith [ht.1] -+ unfold g -+ apply mul_nonneg -+ apply mul_nonneg -+ apply mul_nonneg -+ apply mul_nonneg -+ · linarith -+ · linarith -+ · have : 0 ≤ Real.log |t| := by -+ apply Real.log_nonneg -+ linarith [tbounds1.1] -+ positivity -+ · positivity -+ -+ · apply Real.rpow_nonneg -+ linarith -+ -+ apply le_trans int_normf_le_int_g -+ unfold g -+ -+ have : X ^ σ₁ = X ^ (1 - A / Real.log T ) := by -+ rfl -+ rw[this] -+ -+ have : X ^ (1 - A / Real.log T) = X * X ^ (- A / Real.log T) := by -+ have hX : X > 0 := by linarith -+ simp only [Real.rpow_sub hX, Real.rpow_one] -+ have h₁ : X ^ (-A / Real.log T) * X ^ (A / Real.log T) = 1 := by -+ rw [← Real.rpow_add hX] -+ ring_nf -+ exact rpow_zero X -+ field_simp -+ simpa only [neg_div, mul_comm] using h₁.symm -+ -+ rw[this] -+ -+ have Bound_of_log_int: ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) ≤ Cint / ε := by -+ have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) -+ = (1 / ε) * ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 := by -+ rw [← integral_const_mul] -+ congr with t -+ field_simp [εgt0] -+ rw[this] -+ have normsquared : ∀ (t : ℝ), ‖↑σ₁ + ↑t * I‖ ^ 2 = σ₁ ^ 2 + t ^ 2 := by -+ intro t -+ simp only [Complex.sq_norm] -+ exact normSq_add_mul_I σ₁ t -+ -+ have : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 -+ = ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) := by -+ simp_rw [normsquared] -+ -+ have bound : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 ≤ Cint := by -+ rw [this] -+ have : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) -+ ≤ ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 := by -+ refine setIntegral_mono_on ?_ ?_ ?_ ?_ -+ · -+ have cont : ContinuousOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Set.Icc (-T) (-3)) := by -+ refine ContinuousOn.div ?_ ?_ ?_ -+ · refine ContinuousOn.pow ?_ 9 -+ refine ContinuousOn.log ?_ ?_ -+ · refine continuousOn_of_forall_continuousAt ?_ -+ intro x hx -+ refine Continuous.continuousAt ?_ -+ exact _root_.continuous_abs -+ · intro x hx -+ have h1 : x ≤ -3 := hx.2 -+ have xne0 : x ≠ 0 := by linarith -+ exact abs_ne_zero.mpr xne0 -+ · refine ContinuousOn.add ?_ ?_ -+ · exact continuousOn_const -+ · refine ContinuousOn.pow ?_ 2 -+ exact continuousOn_id' (Icc (-T) (-3)) -+ · intro t ht -+ have h1 : t ≤ -3 := ht.2 -+ have h2 : t ≠ 0 := by linarith -+ have h3 : 0 < t ^ 2 := pow_two_pos_of_ne_zero h2 -+ have h4 : 0 < σ₁ ^ 2 := sq_pos_of_pos σ₁pos -+ linarith [h3, h4] -+ have int_Icc : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Icc (-T) (-3)) volume := by -+ exact ContinuousOn.integrableOn_Icc cont -+ have int_Ioo : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Ioo (-T) (-3)) volume := by -+ apply MeasureTheory.IntegrableOn.mono_set int_Icc -+ exact Ioo_subset_Icc_self -+ exact int_Ioo -+ · have cont : ContinuousOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Set.Icc (-T) (-3)) := by -+ refine ContinuousOn.div ?_ ?_ ?_ -+ · refine ContinuousOn.pow ?_ 9 -+ refine ContinuousOn.log ?_ ?_ -+ · refine continuousOn_of_forall_continuousAt ?_ -+ intro x hx -+ refine Continuous.continuousAt ?_ -+ exact _root_.continuous_abs -+ · intro x hx -+ have h1 : x ≤ -3 := hx.2 -+ have xne0 : x ≠ 0 := by linarith -+ exact abs_ne_zero.mpr xne0 -+ · refine ContinuousOn.pow ?_ 2 -+ exact continuousOn_id' (Icc (-T) (-3)) -+ · intro t ht -+ have h1 : t ≤ -3 := ht.2 -+ have tne0 : t ≠ 0 := by linarith -+ exact pow_ne_zero 2 tne0 -+ have int_Icc : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Icc (-T) (-3)) volume := by -+ exact ContinuousOn.integrableOn_Icc cont -+ have int_Ioo : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Ioo (-T) (-3)) volume := by -+ apply MeasureTheory.IntegrableOn.mono_set int_Icc -+ exact Ioo_subset_Icc_self -+ exact int_Ioo -+ · exact measurableSet_Ioo -+ · intro x hx -+ have xneg : x < 0 := by linarith[hx.2] -+ have absx : |x| = -x := abs_of_neg xneg -+ have h1 : 3 < |x| ∧ |x| < T := by -+ rw[absx] -+ constructor -+ · linarith [hx.2] -+ · linarith [hx.1] -+ exact quotient_bound x (t_bounds x hx) -+ apply le_trans this -+ have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 -+ = ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 := by -+ have eq_integrand : ∀ (t : ℝ), t ∈ Ioo (-T) (-3) → (Real.log |t|) ^ 9 / t ^ 2 = (Real.log (-t)) ^ 9 / (-t) ^ 2 := by -+ intro t ht -+ have tneg : t < 0 := by linarith[ht.2] -+ have : |t| = -t := abs_of_neg tneg -+ rw [this, neg_sq] -+ -+ have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 -+ = ∫ (t : ℝ) in Ioo (-T) (-3), Real.log (-t) ^ 9 / (-t) ^ 2 := by -+ exact MeasureTheory.setIntegral_congr_fun measurableSet_Ioo eq_integrand -+ -+ rw [this] -+ -+ have interval_to_Ioo1 : ∫ (t : ℝ) in -T..-3, Real.log (-t) ^ 9 / (-t) ^ 2 -+ = ∫ (t : ℝ) in Ioo (-T) (-3), Real.log (-t) ^ 9 / (-t) ^ 2 := by -+ rw [intervalIntegral.integral_of_le (by linarith)] -+ exact MeasureTheory.integral_Ioc_eq_integral_Ioo -+ -+ have interval_to_Ioo2 : ∫ (t : ℝ) in (3)..(T), Real.log t ^ 9 / t ^ 2 -+ = ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 := by -+ rw [intervalIntegral.integral_of_le (by linarith)] -+ exact MeasureTheory.integral_Ioc_eq_integral_Ioo -+ -+ rw [← interval_to_Ioo1, ← interval_to_Ioo2] -+ rw [intervalIntegral.integral_comp_neg (fun (t : ℝ) ↦ Real.log (t) ^ 9 / (t) ^ 2)] -+ simp -+ rw [this] -+ have : ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 < Cint := by -+ exact Cinthyp T Tgt3 -+ linarith -+ rw [ mul_comm] -+ rw [← mul_div_assoc, mul_one] -+ exact (div_le_div_iff_of_pos_right εgt0).mpr bound -+ -+ have factor_out_constants : -+ ∫ (t : ℝ) in Ioo (-T) (-3), Cζ * CM * Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) * (X * X ^ (-A / Real.log T )) -+ = Cζ * CM * (X * X ^ (-A / Real.log T)) * ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) := by -+ rw [mul_assoc, ← mul_assoc (Cζ * CM), ← mul_assoc] -+ field_simp -+ rw [← integral_const_mul] -+ apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioo -+ intro t ht -+ ring_nf -+ -+ rw [factor_out_constants] -+ -+ have : Cζ * CM * (X * X ^ (-A / Real.log T)) * ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) -+ ≤ Cζ * CM * ((X : ℝ) * X ^ (-A / Real.log T)) * (Cint / ε) := by -+ apply mul_le_mul_of_nonneg_left -+ · exact Bound_of_log_int -+ · have hpos : 0 < X * X ^ (-A / Real.log T) := by -+ apply mul_pos -+ · linarith -+ · apply Real.rpow_pos_of_pos -+ linarith -+ apply mul_nonneg -+ · apply mul_nonneg -+ · linarith -+ · linarith -+ · linarith [hpos] -+ -+ apply le_trans this -+ ring_nf -+ field_simp; norm_num -+ -+lemma I7I3 {SmoothingF : ℝ → ℝ} {ε X T σ₁ : ℝ} (Xpos : 0 < X) : -+ I₇ SmoothingF ε T X σ₁ = conj (I₃ SmoothingF ε T X σ₁) := by -+ unfold I₃ I₇ -+ simp only [map_mul, map_div₀, conj_I, conj_ofReal, conj_ofNat, map_one] -+ rw [neg_mul, mul_neg, ← neg_mul] -+ congr -+ · ring -+ · rw [← intervalIntegral_conj, ← intervalIntegral.integral_comp_neg] -+ apply intervalIntegral.integral_congr -+ intro t ht -+ simp only -+ rw [← smoothedChebyshevIntegrand_conj Xpos] -+ simp -+ -+lemma I7Bound {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ {A Cζ : ℝ} (hCζ : LogDerivZetaHasBound A Cζ) (Cζpos : 0 < Cζ) (hA : A ∈ Ioc 0 (1 / 2)) -+ : ∃ (C : ℝ) (_ : 0 < C), -+ ∀ (X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) -+ (_ : ε < 1) {T : ℝ} (_ : 3 < T), -+ let σ₁ : ℝ := 1 - A / (Real.log T) -+ ‖I₇ SmoothingF ε T X σ₁‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by -+ obtain ⟨C, Cpos, bound⟩ := I3Bound suppSmoothingF ContDiffSmoothingF hCζ Cζpos hA -+ refine ⟨C, Cpos, fun X X_gt ε εpos ε_lt_one T T_gt ↦ ?_⟩ -+ specialize bound X X_gt εpos ε_lt_one T_gt -+ intro σ₁ -+ rwa [I7I3 (by linarith), norm_conj] -+ -+lemma I4Bound {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) -+ {A : ℝ} -+ (hA : A ∈ Ioc 0 (1 / 2)) : -+ ∃ (C : ℝ) (_ : 0 ≤ C) (Tlb : ℝ) (_ : 3 < Tlb), -+ ∀ (X : ℝ) (_ : 3 < X) -+ {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) -+ {T : ℝ} (_ : Tlb < T), -+ let σ₁ : ℝ := 1 - A / (Real.log T) -+ ‖I₄ SmoothingF ε X σ₁ σ₂‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by -+ -+ have reOne : re 1 = 1 := by exact rfl -+ have imOne : im 1 = 0 := by exact rfl -+ have reThree : re 3 = 3 := by exact rfl -+ have imThree : im 3 = 0 := by exact rfl -+ -+ have elt3 : Real.exp 1 < 3 := by -+ linarith[Real.exp_one_lt_d9] -+ -+ unfold I₄ SmoothedChebyshevIntegrand -+ -+ let S : Set ℝ := (fun (t : ℝ) ↦ ↑‖-ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)‖₊) '' Icc 0 1 -+ let C' : ℝ := sSup S -+ have bddAboveS : BddAbove S := by -+ refine IsCompact.bddAbove ?_ -+ unfold S -+ refine IsCompact.image_of_continuousOn ?_ ?_ -+ · exact isCompact_Icc -+ · refine ContinuousOn.norm ?_ -+ have : (fun (t : ℝ) ↦ -ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)) = -+ (fun (t : ℝ) ↦ -(ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I))) := by -+ apply funext -+ intro x -+ apply neg_div -+ rw[this] -+ refine ContinuousOn.neg ?_ -+ have : (fun (t : ℝ) ↦ ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)) = -+ ((ζ' / ζ) ∘ (fun (t : ℝ) ↦ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I))) := by exact rfl -+ rw[this] -+ apply h_logDeriv_holo.continuousOn.comp' (by fun_prop) -+ unfold MapsTo -+ intro x xInIcc -+ simp only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, Set.mem_sdiff] -+ have : ¬↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I = 1 := by -+ by_contra h -+ rw[Complex.ext_iff, sub_re, add_re, sub_im, add_im] at h -+ repeat rw[mul_im] at h -+ repeat rw[mul_re] at h -+ rw[sub_im, sub_re, reOne, imOne, reThree, imThree, I_im, I_re] at h -+ repeat rw[ofReal_re] at h -+ repeat rw[ofReal_im] at h -+ ring_nf at h -+ obtain ⟨_, ripGoal⟩ := h -+ have : -3 ≠ 0 := by norm_num -+ linarith -+ refine ⟨?_, this⟩ -+ rw [mem_reProdIm] -+ simp only [sub_re, add_re, ofReal_re, mul_re, one_re, ofReal_im, sub_im, one_im, sub_self, -+ mul_zero, sub_zero, re_ofNat, I_re, im_ofNat, I_im, mul_one, add_im, mul_im, zero_mul, -+ add_zero, zero_sub, mem_Icc, le_refl, neg_le_self_iff, Nat.ofNat_nonneg, and_self, and_true] -+ rw [Set.uIcc_of_le] -+ · rw [mem_Icc] -+ constructor -+ · simp only [le_add_iff_nonneg_right] -+ apply mul_nonneg -+ · exact xInIcc.1 -+ · linarith [hσ₂.2] -+ · have : σ₂ + x * (1 - σ₂) = σ₂ * (1 - x) + x := by ring -+ rw [this] -+ clear this -+ have : (2 : ℝ) = 1 * 1 + 1 := by norm_num -+ rw [this] -+ clear this -+ gcongr -+ · linarith [xInIcc.2] -+ · exact hσ₂.2.le -+ · linarith [xInIcc.1] -+ · exact xInIcc.2 -+ · linarith [hσ₂.2] -+ -+ have CPrimeNonneg : 0 ≤ C' := by -+ apply Real.sSup_nonneg -+ intro x x_in_S -+ obtain ⟨t, ht, rfl⟩ := x_in_S -+ exact NNReal.coe_nonneg _ -+ -+ obtain ⟨D, Dpos, MellinSmooth1bBound⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF -+ let C : ℝ := C' * D / sInf ((fun t => ‖ σ₂ + (t : ℝ) * (1 - σ₂) - 3 * I ‖₊ ^ 2) '' Set.Icc 0 1) -+ use C -+ have sInfPos : 0 < sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1) := by -+ refine (IsCompact.lt_sInf_iff_of_continuous ?_ ?_ ?_ 0).mpr ?_ -+ · exact isCompact_Icc -+ · exact Nonempty.of_subtype -+ · have : (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) = -+ (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ * ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊) := by -+ apply funext -+ intro x -+ rw[pow_two] -+ rw[this] -+ have : ContinuousOn (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊) (Icc 0 1) := by -+ refine ContinuousOn.nnnorm ?_ -+ refine ContinuousOn.sub ?_ (by exact continuousOn_const) -+ refine ContinuousOn.add (by exact continuousOn_const) ?_ -+ exact ContinuousOn.mul (by exact Complex.continuous_ofReal.continuousOn) (by exact continuousOn_const) -+ exact ContinuousOn.mul (by exact this) (by exact this) -+ · intro x xLoc -+ apply pow_pos -+ have temp : |(↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I).im| ≤ -+ ‖↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I‖₊ := by apply Complex.abs_im_le_norm -+ rw[sub_im, add_im, mul_im, mul_im, I_re, I_im, sub_im, sub_re] at temp -+ repeat rw[ofReal_re] at temp -+ repeat rw[ofReal_im] at temp -+ rw[reThree, imOne] at temp -+ ring_nf at temp ⊢ -+ rw[abs_of_neg, neg_neg] at temp -+ · have : (3 : NNReal) ≤ ‖↑σ₂ - ↑σ₂ * ↑x + (↑x - I * 3)‖₊ := by -+ apply (NNReal.coe_le_coe).mp -+ convert! temp using 1; congr 2; ring -+ have hp : (0 : NNReal) < ‖↑σ₂ - ↑σ₂ * ↑x + (↑x - I * 3)‖₊ := -+ lt_of_lt_of_le (by norm_num) this -+ convert! hp using 1; congr 2; ring -+ · rw[neg_lt_zero] -+ norm_num -+ have CNonneg : 0 ≤ C := by -+ unfold C -+ apply mul_nonneg -+ · exact mul_nonneg (by exact CPrimeNonneg) (by exact Dpos.le) -+ · rw[inv_nonneg] -+ norm_cast -+ convert sInfPos.le using 5 -+ norm_cast -+ use CNonneg -+ -+ let Tlb : ℝ := max 4 (max (rexp A) (rexp (A / (1 - σ₂)))) -+ use Tlb -+ -+ have : 3 < Tlb := by -+ unfold Tlb -+ rw[lt_max_iff] -+ refine Or.inl ?_ -+ norm_num -+ use this -+ -+ intro X X_gt_three ε ε_pos ε_lt_one T T_gt_Tlb σ₁ -+ have σ₂_le_σ₁ : σ₂ ≤ σ₁ := by -+ have logTlb_pos : 0 < Real.log Tlb := by -+ rw[← Real.log_one] -+ exact log_lt_log (by norm_num) (by linarith) -+ have logTlb_nonneg : 0 ≤ Real.log Tlb := by exact le_of_lt (by exact logTlb_pos) -+ have expr_nonneg : 0 ≤ A / (1 - σ₂) := by -+ apply div_nonneg -+ · linarith [hA.1] -+ · rw[sub_nonneg] -+ exact le_of_lt hσ₂.2 -+ have temp : σ₂ ≤ 1 - A / Real.log Tlb := by -+ have : rexp (A / (1 - σ₂)) ≤ Tlb := by -+ unfold Tlb -+ apply le_max_of_le_right -+ apply le_max_right -+ rw[← Real.le_log_iff_exp_le] at this -+ · rw[div_le_iff₀, mul_comm, ← div_le_iff₀] at this -+ · linarith -+ · exact logTlb_pos -+ · rw[sub_pos] -+ exact hσ₂.2 -+ · positivity -+ have : 1 - A / Real.log Tlb ≤ 1 - A / Real.log T := by -+ apply sub_le_sub (by rfl) -+ apply div_le_div₀ -+ · exact le_of_lt (by exact hA.1) -+ · rfl -+ · exact logTlb_pos -+ · apply log_le_log (by positivity) -+ exact le_of_lt (by exact T_gt_Tlb) -+ exact le_trans temp this -+ have minσ₂σ₁ : min σ₂ σ₁ = σ₂ := by exact min_eq_left (by exact σ₂_le_σ₁) -+ have maxσ₂σ₁ : max σ₂ σ₁ = σ₁ := by exact max_eq_right (by exact σ₂_le_σ₁) -+ have σ₁_lt_one : σ₁ < 1 := by -+ rw[← sub_zero 1] -+ unfold σ₁ -+ apply sub_lt_sub_left -+ apply div_pos (by exact hA.1) -+ rw[← Real.log_one] -+ exact log_lt_log (by norm_num) (by linarith) -+ -+ rw[norm_mul, ← one_mul C] -+ have : 1 * C * X * X ^ (-A / Real.log T) / ε = 1 * (C * X * X ^ (-A / Real.log T) / ε) := by ring -+ rw[this] -+ apply mul_le_mul -+ · rw[norm_div, norm_one] -+ repeat rw[norm_mul] -+ rw[Complex.norm_two, Complex.norm_real, Real.norm_of_nonneg, Complex.norm_I, mul_one] -+ have : 1 / (2 * π) < 1 / 6 := by -+ rw[one_div_lt_one_div] -+ · refine (div_lt_iff₀' ?_).mp ?_ -+ norm_num -+ ring_nf -+ refine gt_iff_lt.mpr ?_ -+ exact Real.pi_gt_three -+ · positivity -+ · norm_num -+ apply le_of_lt -+ exact lt_trans this (by norm_num) -+ exact pi_nonneg -+ · let f : ℝ → ℂ := fun σ ↦ (-ζ' (↑σ - 3 * I) / ζ (↑σ - 3 * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ - 3 * I) * ↑X ^ (↑σ - 3 * I)) -+ have temp : ‖∫ (σ : ℝ) in σ₂..σ₁, -ζ' (↑σ - 3 * I) / ζ (↑σ - 3 * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ - 3 * I) * ↑X ^ (↑σ - 3 * I)‖ ≤ -+ C * X * X ^ (-A / Real.log T) / ε * |σ₁ - σ₂| := by -+ have : ∀ x ∈ Set.uIoc σ₂ σ₁, ‖f x‖ ≤ C * X * X ^ (-A / Real.log T) / ε := by -+ intro x xInIoc -+ let t : ℝ := (x - σ₂) / (1 - σ₂) -+ have tInIcc : t ∈ Icc 0 1 := by -+ unfold t -+ constructor -+ · apply div_nonneg -+ · rw[sub_nonneg] -+ unfold uIoc at xInIoc -+ rw[minσ₂σ₁] at xInIoc -+ exact le_of_lt (by exact xInIoc.1) -+ · rw[sub_nonneg] -+ apply le_of_lt (by exact hσ₂.2) -+ · rw[div_le_one] -+ · refine sub_le_sub ?_ (by rfl) -+ unfold uIoc at xInIoc -+ rw[maxσ₂σ₁] at xInIoc -+ apply le_trans xInIoc.2 -+ exact le_of_lt (by exact σ₁_lt_one) -+ · rw[sub_pos] -+ exact hσ₂.2 -+ have tExpr : (↑σ₂ + t * (1 - ↑σ₂) - 3 * I) = (↑x - 3 * I) := by -+ unfold t -+ simp only [ofReal_div, ofReal_sub, ofReal_one, sub_left_inj] -+ rw[div_mul_comm, div_self] -+ · simp only [one_mul, add_sub_cancel] -+ · refine sub_ne_zero_of_ne ?_ -+ apply Ne.symm -+ rw[Complex.ofReal_ne_one] -+ exact ne_of_lt (by exact hσ₂.2) -+ unfold f -+ simp only [Complex.norm_mul] -+ have : C * X * X ^ (-A / Real.log T) / ε = -+ (C / ε) * (X * X ^ (-A / Real.log T)) := by ring -+ rw[this] -+ have temp : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)‖ ≤ -+ C / ε := by -+ unfold C -+ rw[div_div] -+ nth_rewrite 2 [div_eq_mul_inv] -+ have temp : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ ≤ C' := by -+ unfold C' -+ have : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ ∈ -+ (fun (t : ℝ) ↦ ↑‖-ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)‖₊) '' Icc 0 1 := by -+ rw[Set.mem_image] -+ use t -+ constructor -+ · exact tInIcc -+ · rw[tExpr] -+ rfl -+ exact le_csSup (by exact bddAboveS) (by exact this) -+ have : ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)‖ ≤ -+ D * ((sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1)) * ε)⁻¹ := by -+ nth_rewrite 3 [mul_comm] -+ let s : ℂ := x - 3 * I -+ have : 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I) = -+ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) s := by exact rfl -+ rw[this] -+ have temp : σ₂ ≤ s.re := by -+ unfold s -+ rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] -+ ring_nf -+ apply le_of_lt -+ unfold uIoc at xInIoc -+ rw[minσ₂σ₁] at xInIoc -+ exact xInIoc.1 -+ have : s.re ≤ 2 := by -+ unfold s -+ rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] -+ ring_nf -+ have : x < 1 := by -+ unfold uIoc at xInIoc -+ rw[maxσ₂σ₁] at xInIoc -+ exact lt_of_le_of_lt xInIoc.2 σ₁_lt_one -+ linarith -+ have temp : ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) s‖ ≤ D * (ε * ‖s‖ ^ 2)⁻¹ := by -+ exact MellinSmooth1bBound σ₂ hσ₂.1 s temp this ε ε_pos ε_lt_one -+ have : D * (ε * ‖s‖ ^ 2)⁻¹ ≤ D * (ε * ↑(sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1)))⁻¹ := by -+ refine mul_le_mul (by rfl) ?_ ?_ (by exact le_of_lt (by exact Dpos)) -+ · rw[inv_le_inv₀] -+ · apply mul_le_mul (by rfl) -+ · rw[NNReal.coe_sInf] -+ apply csInf_le -+ · apply NNReal.bddBelow_coe -+ · unfold s -+ rw[Set.mem_image] -+ let xNorm : NNReal := ‖x - 3 * I‖₊ ^ 2 -+ use xNorm -+ constructor -+ · rw[Set.mem_image] -+ use t -+ exact ⟨tInIcc, by rw[tExpr]⟩ -+ · rfl -+ · exact le_of_lt (by exact sInfPos) -+ · exact le_of_lt (by exact ε_pos) -+ · apply mul_pos (ε_pos) -+ refine sq_pos_of_pos ?_ -+ refine norm_pos_iff.mpr ?_ -+ refine ne_zero_of_re_pos ?_ -+ unfold s -+ rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] -+ ring_nf -+ unfold uIoc at xInIoc -+ rw[minσ₂σ₁] at xInIoc -+ exact lt_trans hσ₂.1 xInIoc.1 -+ · exact mul_pos (ε_pos) (sInfPos) -+ · rw[inv_nonneg] -+ apply mul_nonneg (by exact le_of_lt (by exact ε_pos)) -+ exact sq_nonneg ‖s‖ -+ exact le_trans temp this -+ rw[mul_assoc] -+ apply mul_le_mul (by exact temp) (by exact this) -+ · have this : 0 ≤ |(𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)).re| := by -+ apply abs_nonneg -+ exact le_trans this (by refine Complex.abs_re_le_norm ?_) -+ · exact CPrimeNonneg -+ have : ‖(X : ℂ) ^ (↑x - 3 * I)‖ ≤ -+ X * X ^ (-A / Real.log T) := by -+ nth_rewrite 2 [← Real.rpow_one X] -+ rw[← Real.rpow_add] -+ · rw[Complex.norm_cpow_of_ne_zero] -+ · rw[sub_re, sub_im, mul_re, mul_im, ofReal_re, ofReal_im, I_re, I_im, reThree, imThree] -+ ring_nf -+ rw[Complex.norm_of_nonneg] -+ · rw[Complex.arg_ofReal_of_nonneg] -+ -+ · have one_inv: (1⁻¹ : ℝ) = ( 1 : ℝ) := by norm_num -+ rw[zero_mul, neg_zero, Real.exp_zero, one_inv, mul_one] -+ refine rpow_le_rpow_of_exponent_le ?_ ?_ -+ · linarith -+ · unfold uIoc at xInIoc -+ rw[maxσ₂σ₁] at xInIoc -+ unfold σ₁ at xInIoc -+ rw [←div_eq_mul_inv] -+ ring_nf at xInIoc ⊢ -+ exact xInIoc.2 -+ · positivity -+ · positivity -+ · refine ne_zero_of_re_pos ?_ -+ rw[ofReal_re] -+ positivity -+ · positivity -+ apply mul_le_mul -+ · exact temp -+ · exact this -+ · rw[Complex.norm_cpow_eq_rpow_re_of_pos] -+ · rw[sub_re, mul_re, ofReal_re, I_re, I_im, reThree, imThree] -+ ring_nf -+ apply Real.rpow_nonneg -+ positivity -+ · positivity -+ · exact div_nonneg CNonneg (le_of_lt ε_pos) -+ exact intervalIntegral.norm_integral_le_of_norm_le_const this -+ have : C * X * X ^ (-A / Real.log T) / ε * |σ₁ - σ₂| ≤ -+ C * X * X ^ (-A / Real.log T) / ε := by -+ have : |σ₁ - σ₂| ≤ 1 := by -+ rw[abs_of_nonneg] -+ · rw[← sub_zero 1] -+ exact sub_le_sub σ₁_lt_one.le hσ₂.1.le -+ · rw[sub_nonneg] -+ exact σ₂_le_σ₁ -+ bound -+ exact le_trans temp this -+ simp only [norm_nonneg] -+ norm_num -+ -+lemma I6I4 {SmoothingF : ℝ → ℝ} {ε X σ₁ σ₂ : ℝ} (Xpos : 0 < X) : -+ I₆ SmoothingF ε X σ₁ σ₂ = -conj (I₄ SmoothingF ε X σ₁ σ₂) := by -+ unfold I₆ I₄ -+ simp only [map_mul, map_div₀, conj_ofReal, conj_I, map_one, conj_ofNat] -+ rw [← neg_mul] -+ congr -+ · ring -+ · rw [← intervalIntegral_conj] -+ apply intervalIntegral.integral_congr -+ intro σ hσ -+ simp only -+ rw[← smoothedChebyshevIntegrand_conj Xpos] -+ simp [conj_ofNat] -+ -+lemma I6Bound {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) -+ {A : ℝ} -+ (hA : A ∈ Ioc 0 (1 / 2)) : -+ ∃ (C : ℝ) (_ : 0 ≤ C) (Tlb : ℝ) (_ : 3 < Tlb), -+ ∀ (X : ℝ) (_ : 3 < X) -+ {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) -+ {T : ℝ} (_ : Tlb < T), -+ let σ₁ : ℝ := 1 - A / (Real.log T) -+ ‖I₆ SmoothingF ε X σ₁ σ₂‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by -+ obtain ⟨C, Cpos, Tlb, Tlb_gt, bound⟩ := I4Bound suppSmoothingF ContDiffSmoothingF h_logDeriv_holo hσ₂ hA -+ refine ⟨C, Cpos, Tlb, Tlb_gt, fun X X_gt ε εpos ε_lt_one T T_gt ↦ ?_⟩ -+ specialize bound X X_gt εpos ε_lt_one T_gt -+ intro σ₁ -+ rwa [I6I4 (by linarith), norm_neg, norm_conj] -+ -+lemma I5Bound {SmoothingF : ℝ → ℝ} -+ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) -+ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) -+ {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) -+ : ∃ (C : ℝ) (_ : 0 < C), -+ ∀ (X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) -+ (_ : ε < 1), -+ ‖I₅ SmoothingF ε X σ₂‖ ≤ C * X ^ σ₂ / ε := by -+ -+ unfold LogDerivZetaIsHoloSmall HolomorphicOn at h_logDeriv_holo -+ let zeta'_zeta_on_line := fun (t : ℝ) ↦ ζ' (σ₂ + t * I) / ζ (σ₂ + t * I) -+ -+ have subst : {σ₂} ×ℂ uIcc (-3) 3 ⊆ (uIcc σ₂ 2 ×ℂ uIcc (-3) 3) \ {1} := by -+ simp! only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le] -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, neg_le_self_iff, -+ Nat.ofNat_nonneg, uIcc_of_le] -+ intro z hyp_z -+ simp only [mem_reProdIm, mem_singleton_iff, mem_Icc] at hyp_z -+ simp only [Set.mem_sdiff, mem_reProdIm, mem_Icc, mem_singleton_iff] -+ constructor -+ · constructor -+ · rw [hyp_z.1] -+ apply left_mem_uIcc -+ · exact hyp_z.2 -+ · push Not -+ by_contra h -+ rw [h] at hyp_z -+ simp only [one_re, one_im, Left.neg_nonpos_iff, Nat.ofNat_nonneg, and_self, and_true] at hyp_z -+ linarith [hσ₂.2] -+ -+ have zeta'_zeta_cont := (h_logDeriv_holo.mono subst).continuousOn -+ -+ have is_compact' : IsCompact ({σ₂} ×ℂ uIcc (-3) 3) := by -+ refine IsCompact.reProdIm ?_ ?_ -+ · exact isCompact_singleton -+ · exact isCompact_uIcc -+ -+ let ⟨zeta_bound, zeta_prop⟩ := -+ IsCompact.exists_bound_of_continuousOn (is_compact') zeta'_zeta_cont -+ -+ let ⟨M, ⟨M_is_pos, M_bounds_mellin_hard⟩⟩ := -+ MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF -+ -+ clear is_compact' zeta'_zeta_cont subst zeta'_zeta_on_line h_logDeriv_holo -+ -+ unfold I₅ -+ unfold SmoothedChebyshevIntegrand -+ -+ let mellin_prop : ∀ (t ε : ℝ), -+ 0 < ε → ε < 1 → ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ ≤ M * (ε * ‖↑σ₂ + ↑t * I‖ ^ 2)⁻¹ := -+ fun (t : ℝ) ↦ (M_bounds_mellin_hard σ₂ (by linarith[hσ₂.1]) (σ₂ + t * I) (by simp only [add_re, -+ ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, le_refl]) (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero]; linarith[hσ₂.2])) -+ -+ simp only [mul_inv_rev] at mellin_prop -+ -+ let Const := 1 + (σ₂^2)⁻¹ * (abs zeta_bound) * M -+ -+ let C := |π|⁻¹ * 2⁻¹ * 6 * Const -+ use C -+ have C_pos : 0 < C := by positivity -+ use C_pos -+ -+ have U : σ₂ ∈ Ioo 0 1 := by -+ refine mem_Ioo.mpr ?_ -+ · constructor -+ · linarith[hσ₂.1] -+ · linarith[hσ₂.2] -+ -+ clear U C_pos -+ -+ intros X X_gt ε ε_pos ε_lt_one -+ -+ have mellin_bound := fun (t : ℝ) ↦ mellin_prop t ε ε_pos ε_lt_one -+ -+ have U: 0 < σ₂^2 := by -+ exact sq_pos_of_pos (by linarith[hσ₂.1]) -+ -+ have easy_bound : ∀(t : ℝ), (‖↑σ₂ + ↑t * I‖^2)⁻¹ ≤ (σ₂^2)⁻¹ := -+ by -+ intro t -+ rw [inv_le_inv₀] -+ rw [Complex.sq_norm]; rw [Complex.normSq_apply]; simp only [add_re, ofReal_re, mul_re, I_re, -+ mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add]; ring_nf; simp only [le_add_iff_nonneg_right]; exact zpow_two_nonneg t -+ rw [Complex.sq_norm, Complex.normSq_apply]; simp only [add_re, ofReal_re, mul_re, I_re, -+ mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add]; ring_nf; positivity -+ positivity -+ -+ have T1 : ∀(t : ℝ), t ∈ uIoc (-3) (3 : ℝ) → ‖-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I) * -+ (↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ ≤ Const * ε⁻¹ * X ^ σ₂ := by -+ intro t hyp_t -+ have Z := by -+ calc -+ ‖(-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)) * (𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)) * -+ (↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ = ‖-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by simp only [Complex.norm_mul, -+ Complex.norm_div, norm_neg] -+ _ ≤ ‖ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by simp only [Complex.norm_div, -+ norm_neg, le_refl] -+ _ ≤ zeta_bound * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := -+ by -+ have U := zeta_prop (↑σ₂ + t * I) (by -+ simp only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le] -+ simp only [mem_reProdIm, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, -+ mul_one, sub_self, add_zero, mem_singleton_iff, add_im, mul_im, zero_add, mem_Icc] -+ constructor -+ · trivial -+ · refine mem_Icc.mp ?_ -+ · refine mem_Icc_of_Ioc ?_ -+ · have T : (-3 : ℝ) ≤ 3 := by simp only [neg_le_self_iff, Nat.ofNat_nonneg] -+ rw [←Set.uIoc_of_le T] -+ exact hyp_t) -+ simp only [Complex.norm_div] at U -+ simp only [Complex.norm_div, ge_iff_le] -+ linear_combination U * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ -+ _ ≤ abs zeta_bound * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by -+ have U : zeta_bound ≤ abs zeta_bound := by simp only [le_abs_self] -+ linear_combination (U * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ ) -+ _ ≤ abs zeta_bound * M * ((‖↑σ₂ + ↑t * I‖ ^ 2)⁻¹ * ε⁻¹) * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by -+ have U := mellin_bound t -+ linear_combination (abs zeta_bound) * U * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ -+ _ ≤ abs zeta_bound * M * (σ₂^2)⁻¹ * ε⁻¹ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by -+ have T : 0 ≤ abs zeta_bound * M := by positivity -+ linear_combination (abs zeta_bound * M * easy_bound t * ε⁻¹ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖) -+ _ = abs zeta_bound * M * (σ₂^2)⁻¹ * ε⁻¹ * X ^ (σ₂) := by -+ rw [Complex.norm_cpow_eq_rpow_re_of_pos] -+ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, -+ add_zero] -+ positivity -+ _ ≤ Const * ε⁻¹ * X ^ σ₂ := by -+ unfold Const -+ ring_nf -+ simp only [inv_pow, le_add_iff_nonneg_right, inv_pos, mul_nonneg_iff_of_pos_left, ε_pos] -+ positivity -+ -+ exact Z -+ -+ simp only [one_div, mul_inv_rev, inv_I, neg_mul, norm_neg, Complex.norm_mul, norm_I, norm_inv, -+ norm_real, norm_eq_abs, Complex.norm_ofNat, one_mul, ge_iff_le] -+ have Z := -+ intervalIntegral.norm_integral_le_of_norm_le_const T1 -+ simp only [ge_iff_le] -+ -+ have S : |π|⁻¹ * 2⁻¹ * (Const * ε⁻¹ * X ^ σ₂ * |3 + 3|) = C * X ^ σ₂ / ε := -+ by -+ unfold C -+ ring_nf -+ -+ simp only [sub_neg_eq_add] at Z -+ simp only [← S, ge_iff_le] -+ linear_combination (|π|⁻¹ * 2⁻¹ * Z) -+ -+lemma LogDerivZetaBoundedAndHolo : ∃ A C : ℝ, 0 < C ∧ A ∈ Ioc 0 (1 / 2) ∧ LogDerivZetaHasBound A C -+ ∧ ∀ (T : ℝ) (_ : 3 ≤ T), -+ HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) -+ (( (Icc ((1 : ℝ) - A / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) ) \ {1}) := by -+ -+ obtain ⟨A₁, A₁_in, C, C_pos, zeta_bnd2⟩ := LogDerivZetaBndUnif2 -+ obtain ⟨A₂, A₂_in, holo⟩ := LogDerivZetaHolcLargeT' -+ refine ⟨min A₁ A₂, C, C_pos, ?_, ?_, ?_⟩ -+ · exact ⟨lt_min A₁_in.1 A₂_in.1, le_trans (min_le_left _ _) A₁_in.2⟩ -+ · -+ intro σ t ht hσ -+ have hσ' : σ ∈ Ici (1 - A₁ / Real.log |t| ^ 1) := by -+ -+ have hAle : min A₁ A₂ ≤ A₁ := min_le_left _ _ -+ have hlogpos : 0 < Real.log |t| := by -+ -+ exact Real.log_pos (lt_trans (by norm_num) ht) -+ have := sub_le_sub_left -+ (div_le_div_of_nonneg_right (show min A₁ A₂ ≤ A₁ from hAle) (le_of_lt hlogpos)) 1 -+ -+ have hthr : 1 - A₁ / Real.log |t| ^ 1 ≤ 1 - (min A₁ A₂) / Real.log |t| ^ 1 := by -+ simpa [pow_one] using this -+ -+ have : σ ∈ Ici (1 - (min A₁ A₂) / Real.log |t| ^ 1) := by -+ simpa [pow_one] using hσ -+ exact le_trans hthr (mem_Ici.mp this) -+ -+ have hmain := zeta_bnd2 σ t ht (by simpa [pow_one] using hσ') -+ have hlog_ge_one : (1 : ℝ) ≤ Real.log |t| := by -+ -+ have hpos : 0 < |t| := lt_trans (by norm_num) ht -+ have hle : Real.exp 1 ≤ |t| := by -+ have : Real.exp 1 ≤ 3 := le_of_lt (lt_trans Real.exp_one_lt_d9 (by norm_num)) -+ exact this.trans (le_of_lt ht) -+ have := Real.log_le_log (Real.exp_pos 1) hle -+ simpa [Real.log_exp] using this -+ have hpow : Real.log |t| ^ (2 : ℕ) ≤ Real.log |t| ^ (9 : ℕ) := by -+ exact pow_le_pow_right₀ hlog_ge_one (by decide : (2 : ℕ) ≤ 9) -+ -+ have : C * Real.log |t| ^ (2 : ℕ) ≤ C * Real.log |t| ^ (9 : ℕ) := -+ mul_le_mul_of_nonneg_left hpow (le_of_lt C_pos) -+ exact (le_trans hmain this) -+ · -+ intro T hT -+ -+ have hsubset : -+ ((Icc ((1 : ℝ) - min A₁ A₂ / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) \ {1}) ⊆ -+ ((Icc ((1 : ℝ) - A₂ / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) \ {1}) := by -+ intro s hs -+ rcases hs with ⟨hs_box, hs_ne⟩ -+ rcases hs_box with ⟨hre, him⟩ -+ rcases hre with ⟨hre_left, hre_right⟩ -+ -+ constructor -+ · -+ constructor -+ · -+ constructor -+ · -+ have hAle : min A₁ A₂ ≤ A₂ := min_le_right _ _ -+ have hlogpos : 0 < Real.log T := by -+ have hT' : 1 < T := by linarith -+ exact Real.log_pos hT' -+ have := sub_le_sub_left -+ (div_le_div_of_nonneg_right hAle (le_of_lt hlogpos)) 1 -+ have hthr : 1 - A₂ / Real.log T ^ 1 ≤ 1 - (min A₁ A₂) / Real.log T ^ 1 := by -+ simpa [pow_one] using this -+ exact le_trans hthr hre_left -+ · exact hre_right -+ · exact him -+ · exact hs_ne -+ exact (holo T hT).mono hsubset -+ -+lemma MellinOfSmooth1cExplicit {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) -+ (suppν : ν.support ⊆ Icc (1 / 2) 2) -+ (mass_one : ∫ x in Ioi 0, ν x / x = 1) : -+ ∃ ε₀ c : ℝ, 0 < ε₀ ∧ 0 < c ∧ -+ ∀ ε ∈ Ioo 0 ε₀, ‖𝓜 ((Smooth1 ν ε) ·) 1 - 1‖ ≤ c * ε := by -+ have := MellinOfSmooth1c diffν suppν mass_one -+ rw [Asymptotics.isBigO_iff'] at this -+ rcases this with ⟨c, cpos, hc⟩ -+ unfold Filter.Eventually at hc -+ rw [mem_nhdsGT_iff_exists_Ioo_subset] at hc -+ rcases hc with ⟨ε₀, ε₀pos, h⟩ -+ refine ⟨ε₀, c, ε₀pos, cpos, fun ε hε ↦ ?_⟩ -+ specialize h hε -+ rw [mem_ofPred_eq, id_eq, norm_of_nonneg hε.1.le] at h -+ exact h -+ -+open _root_.Filter Topology -+ -+theorem Strong_PNT : ∃ c > 0, -+ (ψ - id) =O[atTop] -+ fun (x : ℝ) ↦ x * Real.exp (-c * (Real.log x) ^ ((1 : ℝ) / 2)) := by -+ have ⟨ν, ContDiffν, ν_nonneg', ν_supp, ν_massOne'⟩ := SmoothExistence -+ have ContDiff1ν : ContDiff ℝ 1 ν := by -+ exact ContDiffν.of_le (by simp) -+ have ν_nonneg : ∀ x > 0, 0 ≤ ν x := fun x _ ↦ ν_nonneg' x -+ have ν_massOne : ∫ x in Ioi 0, ν x / x = 1 := by -+ rwa [← integral_Ici_eq_integral_Ioi] -+ clear ContDiffν ν_nonneg' ν_massOne' -+ obtain ⟨c_close, c_close_pos, h_close⟩ := -+ SmoothedChebyshevClose ContDiff1ν ν_supp ν_nonneg ν_massOne -+ obtain ⟨ε_main, C_main, ε_main_pos, C_main_pos, h_main⟩ := MellinOfSmooth1cExplicit ContDiff1ν ν_supp ν_massOne -+ obtain ⟨A, C_bnd, C_bnd_pos, A_in_Ioc, zeta_bnd, holo1⟩ := LogDerivZetaBoundedAndHolo -+ obtain ⟨σ₂', σ₂'_lt_one, holo2'⟩ := LogDerivZetaHolcSmallT -+ let σ₂ : ℝ := max σ₂' (1 / 2) -+ have σ₂_pos : 0 < σ₂ := by bound -+ have σ₂_lt_one : σ₂ < 1 := by bound -+ have holo2 : HolomorphicOn (fun s ↦ ζ' s / ζ s) (uIcc σ₂ 2 ×ℂ uIcc (-3) 3 \ {1}) := by -+ apply holo2'.mono -+ intro s hs -+ simp [mem_reProdIm] at hs ⊢ -+ refine ⟨?_, hs.2⟩ -+ refine ⟨?_, hs.1.2⟩ -+ rcases hs.1.1 with ⟨left, right⟩ -+ constructor -+ · apply le_trans _ left -+ apply min_le_min_right -+ apply le_max_left -+ · rw [max_eq_right (by linarith)] at right ⊢ -+ exact right -+ -+ clear holo2' σ₂'_lt_one -+ -+ obtain ⟨c₁, c₁pos, hc₁⟩ := I1Bound ν_supp ContDiff1ν ν_nonneg ν_massOne -+ obtain ⟨c₂, c₂pos, hc₂⟩ := I2Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc -+ obtain ⟨c₃, c₃pos, hc₃⟩ := I3Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc -+ obtain ⟨c₅, c₅pos, hc₅⟩ := I5Bound ν_supp ContDiff1ν holo2 ⟨σ₂_pos, σ₂_lt_one⟩ -+ obtain ⟨c₇, c₇pos, hc₇⟩ := I7Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc -+ obtain ⟨c₈, c₈pos, hc₈⟩ := I8Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc -+ obtain ⟨c₉, c₉pos, hc₉⟩ := I9Bound ν_supp ContDiff1ν ν_nonneg ν_massOne -+ -+ obtain ⟨c₄, c₄pos, Tlb₄, Tlb₄bnd, hc₄⟩ := I4Bound ν_supp ContDiff1ν -+ holo2 ⟨σ₂_pos, σ₂_lt_one⟩ A_in_Ioc -+ -+ obtain ⟨c₆, c₆pos, Tlb₆, Tlb₆bnd, hc₆⟩ := I6Bound ν_supp ContDiff1ν -+ holo2 ⟨σ₂_pos, σ₂_lt_one⟩ A_in_Ioc -+ -+ let C' := c_close + C_main -+ let C'' := c₁ + c₂ + c₈ + c₉ -+ let C''' := c₃ + c₄ + c₆ + c₇ -+ -+ let c : ℝ := A ^ ((1 : ℝ) / 2) / 4 -+ have cpos : 0 < c := by -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, -+ mem_Ioc, lt_sup_iff, -+ inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, -+ div_pos_iff_of_pos_right, σ₂, c] -+ obtain ⟨left, right⟩ := A_in_Ioc -+ positivity -+ refine ⟨c, cpos, ?_⟩ -+ rw [Asymptotics.isBigO_iff] -+ let C : ℝ := C' + C'' + C''' + c₅ -+ refine ⟨C, ?_⟩ -+ -+ let c_εx : ℝ := A ^ ((1 : ℝ) / 2) / 2 -+ have c_εx_pos : 0 < c_εx := by -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, -+ mem_Ioc, lt_sup_iff, -+ inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, -+ div_pos_iff_of_pos_right, σ₂, c, c_εx] -+ let c_Tx : ℝ := A ^ ((1 : ℝ) / 2) -+ have c_Tx_pos : 0 < c_Tx := by -+ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, -+ mem_Ioc, lt_sup_iff, -+ inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, -+ div_pos_iff_of_pos_right, σ₂, c, c_εx, c_Tx] -+ -+ let εx := (fun x ↦ Real.exp (-c_εx * (Real.log x) ^ ((1 : ℝ) / 2))) -+ let Tx := (fun x ↦ Real.exp (c_Tx * (Real.log x) ^ ((1 : ℝ) / 2))) -+ -+ have coeff_to_zero {B : ℝ} (B_le : B < 1) : -+ Tendsto (fun x ↦ Real.log x ^ (B - 1)) atTop (𝓝 0) := by -+ have B_minus_1_neg : B - 1 < 0 := by linarith -+ rw [← Real.zero_rpow (ne_of_lt B_minus_1_neg)] -+ rw [zero_rpow (ne_of_lt B_minus_1_neg)] -+ have one_minus_B_pos : 0 < 1 - B := by linarith -+ rw [show B - 1 = -(1 - B) by ring] -+ have : ∀ᶠ (x : ℝ) in atTop, Real.log x ^ (-(1 - B)) = (Real.log x ^ ((1 - B)))⁻¹ := by -+ filter_upwards [eventually_ge_atTop (1 : ℝ)] with x hx -+ apply Real.rpow_neg -+ exact Real.log_nonneg hx -+ rw [tendsto_congr' this] -+ apply tendsto_inv_atTop_zero.comp -+ apply (tendsto_rpow_atTop one_minus_B_pos).comp -+ exact tendsto_log_atTop -+ -+ have log_sub_log_pow_inf (c : ℝ) {B : ℝ} (B_le : B < 1) : -+ Tendsto (fun (x : ℝ) ↦ Real.log x - c * Real.log x ^ B) atTop atTop := by -+ have factor_form : ∀ x > 1, Real.log x - c * Real.log x ^ B = -+ Real.log x * (1 - c * Real.log x ^ (B - 1)) := by -+ intro x hx -+ ring_nf -+ congr! 1 -+ rw [mul_assoc, mul_comm (Real.log x), mul_assoc] -+ congr! 1 -+ have log_pos : 0 < Real.log x := Real.log_pos hx -+ rw [(by simp : Real.log x ^ (-1 + B) * Real.log x = -+ Real.log x ^ (-1 + B) * (Real.log x) ^ (1 : ℝ))] -+ rw [← Real.rpow_add log_pos] -+ ring_nf -+ have B_minus_1_neg : B - 1 < 0 := by linarith -+ have coeff_to_one : Tendsto (fun x ↦ 1 - c * Real.log x ^ (B - 1)) atTop (𝓝 1) := by -+ specialize coeff_to_zero B_le -+ apply Tendsto.const_mul c at coeff_to_zero -+ convert (tendsto_const_nhds (x := (1 : ℝ)) (f := (atTop : Filter ℝ))).sub coeff_to_zero -+ ring -+ -+ have eventually_pos : ∀ᶠ x in atTop, 0 < 1 - c * Real.log x ^ (B - 1) := by -+ apply (tendsto_order.mp coeff_to_one).1 -+ norm_num -+ -+ have eventually_factored : ∀ᶠ x in atTop, Real.log x - c * Real.log x ^ B = -+ Real.log x * (1 - c * Real.log x ^ (B - 1)) := by -+ filter_upwards [eventually_gt_atTop (1 : ℝ)] with x hx -+ exact factor_form x hx -+ -+ rw [tendsto_congr' eventually_factored] -+ apply Tendsto.atTop_mul_pos (by norm_num : (0 : ℝ) < 1) tendsto_log_atTop coeff_to_one -+ -+ have x_εx_eq (c B : ℝ) : ∀ᶠ (x : ℝ) in atTop, x * rexp (-c * Real.log x ^ B) = -+ rexp (Real.log x - c * Real.log x ^ B) := by -+ filter_upwards [eventually_gt_atTop 0] with x hx_pos -+ conv => -+ enter [1, 1] -+ rw [(Real.exp_log hx_pos).symm] -+ rw [← Real.exp_add] -+ ring_nf -+ -+ have x_ε_to_inf (c : ℝ) {B : ℝ} (B_le : B < 1) : Tendsto -+ (fun x ↦ x * Real.exp (-c * (Real.log x) ^ B)) atTop atTop := by -+ rw [tendsto_congr' (x_εx_eq c B)] -+ exact tendsto_exp_atTop.comp (log_sub_log_pow_inf c B_le) -+ -+ have Tx_to_inf : Tendsto Tx atTop atTop := by -+ unfold Tx -+ apply tendsto_exp_atTop.comp -+ apply Tendsto.pos_mul_atTop c_Tx_pos tendsto_const_nhds -+ exact (tendsto_rpow_atTop (by norm_num : 0 < (1 : ℝ) / 2)).comp Real.tendsto_log_atTop -+ -+ have ex_to_zero : Tendsto εx atTop (𝓝 0) := by -+ unfold εx -+ apply Real.tendsto_exp_atBot.comp -+ have this (x : ℝ) : -c_εx * Real.log x ^ ((1 : ℝ) / 2) = -(c_εx * Real.log x ^ ((1 : ℝ) / 2)) := by -+ ring -+ simp_rw [this] -+ rw [tendsto_neg_atBot_iff] -+ apply Tendsto.const_mul_atTop c_εx_pos -+ apply (tendsto_rpow_atTop (by norm_num)).comp -+ exact tendsto_log_atTop -+ -+ have eventually_εx_lt_one : ∀ᶠ (x : ℝ) in atTop, εx x < 1 := by -+ apply (tendsto_order.mp ex_to_zero).2 -+ norm_num -+ -+ have eventually_2_lt : ∀ᶠ (x : ℝ) in atTop, 2 < x * εx x := by -+ have := x_ε_to_inf c_εx (by norm_num : (1 : ℝ) / 2 < 1) -+ exact this.eventually_gt_atTop 2 -+ -+ have eventually_T_gt_3 : ∀ᶠ (x : ℝ) in atTop, 3 < Tx x := by -+ exact Tx_to_inf.eventually_gt_atTop 3 -+ -+ have eventually_T_gt_Tlb₄ : ∀ᶠ (x : ℝ) in atTop, Tlb₄ < Tx x := by -+ exact Tx_to_inf.eventually_gt_atTop _ -+ have eventually_T_gt_Tlb₆ : ∀ᶠ (x : ℝ) in atTop, Tlb₆ < Tx x := by -+ exact Tx_to_inf.eventually_gt_atTop _ -+ -+ have eventually_σ₂_lt_σ₁ : ∀ᶠ (x : ℝ) in atTop, σ₂ < 1 - A / (Real.log (Tx x)) := by -+ -+ apply (tendsto_order.mp ?_).1 -+ · exact σ₂_lt_one -+ have := tendsto_inv_atTop_zero.comp ((tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 1)).comp -+ (tendsto_log_atTop.comp Tx_to_inf)) -+ have := Tendsto.const_mul (b := A) this -+ convert (tendsto_const_nhds (x := (1 : ℝ))).sub this using 2 -+ · simp [Function.comp, div_eq_mul_inv] -+ · simp -+ -+ have eventually_ε_lt_ε_main : ∀ᶠ (x : ℝ) in atTop, εx x < ε_main := by -+ apply (tendsto_order.mp ex_to_zero).2 -+ assumption -+ -+ have event_logX_ge : ∀ᶠ (x : ℝ) in atTop, 1 ≤ Real.log x := by -+ apply Real.tendsto_log_atTop.eventually_ge_atTop -+ -+ have event_1_aux_1 {const1 const2 : ℝ} (const1pos : 0 < const1) (const2pos : 0 < const2) : -+ ∀ᶠ (x : ℝ) in atTop, -+ rexp (-const1 * Real.log x ^ const2) * Real.log x ≤ -+ rexp 0 := by -+ have := ((isLittleO_log_rpow_atTop const2pos).bound const1pos) -+ have : ∀ᶠ (x : ℝ) in atTop, Real.log (Real.log x) ≤ -+ const1 * (Real.log x) ^ const2 := by -+ have := tendsto_log_atTop.eventually this -+ filter_upwards [this, eventually_gt_atTop 100] with x hx x_gt -+ convert hx using 1 -+ · rw [Real.norm_of_nonneg] -+ apply Real.log_nonneg -+ have : (1 : ℝ) = Real.log (rexp 1) := by -+ exact Eq.symm (Real.log_exp 1) -+ -+ rw [this] -+ apply Real.log_le_log -+ · exact Real.exp_pos _ -+ · have := Real.exp_one_lt_d9 -+ -+ linarith -+ · congr! 1 -+ rw [Real.norm_of_nonneg] -+ apply Real.rpow_nonneg -+ apply Real.log_nonneg -+ linarith -+ have loglogx : ∀ᶠ (x : ℝ) in atTop, -+ Real.log x = rexp (Real.log (Real.log x)) := by -+ filter_upwards [eventually_gt_atTop 3] with x hx -+ rw [Real.exp_log] -+ apply Real.log_pos -+ linarith -+ filter_upwards [loglogx, this] with x loglogx hx -+ conv => -+ enter [1, 2] -+ rw [loglogx] -+ rw [← Real.exp_add] -+ apply Real.exp_monotone -+ grw [hx] -+ simp -+ -+ have event_1_aux {const1 const1' const2 : ℝ} (const1bnds : const1' < const1) -+ (const2pos : 0 < const2) : -+ ∀ᶠ (x : ℝ) in atTop, -+ rexp (-const1 * Real.log x ^ const2) * Real.log x ≤ -+ rexp (-const1' * Real.log x ^ const2) := by -+ have : 0 < const1 - const1' := by linarith -+ filter_upwards [event_1_aux_1 this const2pos] with x hx -+ have : rexp (-const1 * Real.log x ^ const2) * Real.log x -+ = rexp (-(const1') * Real.log x ^ const2) -+ * rexp (-(const1 - const1') * Real.log x ^ const2) * Real.log x := by -+ congr! 1 -+ rw [← Real.exp_add] -+ congr! 1 -+ ring -+ rw [this] -+ rw [mul_assoc] -+ grw [hx] -+ simp -+ -+ have event_1 : ∀ᶠ (x : ℝ) in atTop, C' * (εx x) * x * Real.log x ≤ -+ C' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by -+ unfold c εx c_εx -+ have : 0 < (A ^ ((1 : ℝ) / 2) / 4) := by -+ positivity -+ have const1bnd : (A ^ ((1 : ℝ) / 2) / 4) < (A ^ ((1 : ℝ) / 2) / 2) := by -+ linarith -+ have const2bnd : (0 : ℝ) < 1 / 2 := by norm_num -+ have this (x : ℝ) : -+ C' * rexp (-(A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) * x * Real.log x = -+ C' * x * (rexp (-(A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) * Real.log x) := by ring -+ simp_rw [this] -+ filter_upwards [event_1_aux const1bnd const2bnd, eventually_gt_atTop 3] with x x_bnd x_gt -+ grw [x_bnd] -+ -+ have event_2 : ∀ᶠ (x : ℝ) in atTop, C'' * x * Real.log x / (εx x * Tx x) ≤ -+ C'' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by -+ unfold c εx c_εx Tx c_Tx -+ set const2 : ℝ := 1 / 2 -+ have const2bnd : 0 < const2 := by norm_num -+ set const1 := (A ^ const2 / 2) -+ set const1' := (A ^ const2 / 4) -+ have : 0 < A ^ const2 := by -+ unfold const2 -+ -+ apply Real.rpow_pos_of_pos -+ exact A_in_Ioc.1 -+ have this (x : ℝ) : -(-const1 * Real.log x ^ const2 + A ^ const2 * Real.log x ^ const2) = -+ -(A ^ const2 - const1) * Real.log x ^ const2 := by ring -+ simp_rw [← Real.exp_add, div_eq_mul_inv, ← Real.exp_neg, this] -+ have const1bnd : const1' < (A ^ const2 - const1) := by -+ unfold const1' const1 -+ linarith -+ filter_upwards [event_1_aux const1bnd const2bnd, eventually_gt_atTop 3] with x x_bnd x_gt -+ rw [mul_assoc] -+ conv => -+ enter [1, 2] -+ rw [mul_comm] -+ grw [x_bnd] -+ -+ have event_3_aux {const1 const1' const2 : ℝ} (const2_eq : const2 = 1 / 2) -+ (const1_eq : const1 = (A ^ const2 / 2)) (const1'_eq : const1' = (A ^ const2 / 4)) : -+ ∀ᶠ (x : ℝ) in atTop, -+ x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2)) ^ (1 : ℝ)) * -+ rexp (-(-const1 * Real.log x ^ const2)) ≤ -+ rexp (-const1' * Real.log x ^ const2) := by -+ have : ∀ᶠ (x : ℝ) in atTop, x = rexp (Real.log x) := by -+ filter_upwards [eventually_gt_atTop 0] with x hx -+ rw [Real.exp_log hx] -+ filter_upwards [this, eventually_gt_atTop 3] with x hx x_gt_3 -+ have logxpos : 0 < Real.log x := by apply Real.log_pos; linarith -+ conv => -+ enter [1, 1, 1] -+ rw [hx] -+ rw [← Real.exp_mul] -+ rw [Real.log_exp] -+ rw [Real.mul_rpow] -+ · have {y : ℝ} (ypos : 0 < y) : y / (y ^ const2) ^ (1 : ℝ) = y ^ const2 := by -+ rw [← Real.rpow_mul ypos.le] -+ rw [div_eq_mul_inv] -+ rw [← Real.rpow_neg ypos.le] -+ conv => -+ enter [1, 1] -+ rw [← Real.rpow_one y] -+ rw [← Real.rpow_add ypos] -+ rw [(by linarith : 1 + -(const2 * 1) = const2)] -+ rw [div_mul_eq_div_div] -+ rw [neg_div] -+ rw [this (A_in_Ioc.1)] -+ -+ rw [mul_div] -+ conv => -+ enter [1, 1, 1, 1] -+ rw [mul_comm] -+ rw [← mul_div] -+ -+ rw [this (y := Real.log x) logxpos] -+ -+ rw [← Real.exp_add] -+ apply Real.exp_monotone -+ -+ have : -A ^ const2 * Real.log x ^ const2 + -(-const1 * Real.log x ^ const2) -+ = (-(A ^ const2 - const1) * Real.log x ^ const2) := by ring -+ rw [this] -+ -+ gcongr -+ -+ rw [const1'_eq, const1_eq] -+ have : 0 ≤ A ^ const2 := by -+ apply Real.rpow_nonneg A_in_Ioc.1.le -+ linarith -+ · rw [const2_eq] -+ rw [←Real.sqrt_eq_rpow] -+ apply Real.sqrt_nonneg -+ -+ · apply Real.rpow_nonneg -+ apply Real.log_nonneg -+ linarith -+ -+ have event_3 : ∀ᶠ (x : ℝ) in atTop, C''' * x * x ^ (-A / Real.log (Tx x) ) / (εx x) ≤ -+ C''' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by -+ unfold c Tx c_Tx εx c_εx -+ set const2 : ℝ := 1 / 2 -+ have const2eq : const2 = 1 / 2 := by rfl -+ have const2bnd : 0 < const2 := by norm_num -+ set const1 := (A ^ const2 / 2) -+ have const1eq : const1 = (A ^ const2 / 2) := by rfl -+ set const1' := (A ^ const2 / 4) -+ have const1'eq : const1' = (A ^ const2 / 4) := by rfl -+ have A_pow_pos : 0 < A ^ const2 := by -+ unfold const2 -+ apply Real.rpow_pos_of_pos -+ exact A_in_Ioc.1 -+ -+ conv => -+ enter [1, x, 1] -+ rw [div_eq_mul_inv, ← Real.exp_neg] -+ -+ filter_upwards [event_3_aux const2eq const1eq const1'eq, -+ eventually_gt_atTop 3] with x x_bnd x_gt -+ -+ have this (x : ℝ) : C''' * x * x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2))) -+ * rexp (-(-const1 * Real.log x ^ const2)) -+ = C''' * x * (x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2))) -+ * rexp (-(-const1 * Real.log x ^ const2))) := by -+ ring -+ rw [this] -+ rw [rpow_one] at x_bnd -+ grw [x_bnd] -+ -+ have event_4_aux4 {pow2 : ℝ} (pow2_neg : pow2 < 0) {c : ℝ} (cpos : 0 < c) (c' : ℝ) : -+ Tendsto (fun x ↦ c' * Real.log x ^ pow2) atTop (𝓝 0) := by -+ rw [← mul_zero c'] -+ apply Tendsto.const_mul -+ have := tendsto_rpow_neg_atTop (y := -pow2) (by linarith) -+ rw [neg_neg] at this -+ apply this.comp -+ exact Real.tendsto_log_atTop -+ -+ have event_4_aux3 {pow2 : ℝ} (pow2_neg : pow2 < 0) {c : ℝ} (cpos : 0 < c) (c' : ℝ) : -+ ∀ᶠ (x : ℝ) in atTop, c' * (Real.log x) ^ pow2 < c := by -+ apply (event_4_aux4 pow2_neg cpos c').eventually_lt_const -+ exact cpos -+ -+ have event_4_aux2 {c1 : ℝ} (c1pos : 0 < c1) (c2 : ℝ) {pow1 : ℝ} (pow1_lt : pow1 < 1) : -+ ∀ᶠ (x : ℝ) in atTop, 0 ≤ Real.log x * (c1 - c2 * (Real.log x) ^ (pow1 - 1)) := by -+ filter_upwards [eventually_gt_atTop 3 , event_4_aux3 (by linarith : pow1 - 1 < 0) -+ (by linarith : 0 < c1 / 2) c2] with x x_gt hx -+ have : 0 ≤ Real.log x := by -+ apply Real.log_nonneg -+ linarith -+ apply mul_nonneg this -+ linarith -+ -+ have event_4_aux1 {const1 : ℝ} (const1_lt : const1 < 1) (const2 const3 : ℝ) -+ {pow1 : ℝ} (pow1_lt : pow1 < 1) : ∀ᶠ (x : ℝ) in atTop, -+ const1 * Real.log x + const2 * Real.log x ^ pow1 -+ ≤ Real.log x - const3 * Real.log x ^ pow1 := by -+ filter_upwards [event_4_aux2 (by linarith : 0 < 1 - const1) (const2 + const3) pow1_lt, -+ eventually_gt_atTop 3] with x hx x_gt -+ rw [← sub_nonneg] -+ have : -+ Real.log x - const3 * Real.log x ^ pow1 - (const1 * Real.log x + const2 * Real.log x ^ pow1) -+ = (1 - const1) * Real.log x - (const2 + const3) * Real.log x ^ pow1 := by ring -+ rw [this] -+ convert hx using 1 -+ ring_nf -+ congr! 1 -+ have : Real.log x * const2 * Real.log x ^ (-1 + pow1) -+ = const2 * Real.log x ^ pow1 := by -+ rw [mul_assoc, mul_comm, mul_assoc] -+ congr! 1 -+ conv => -+ enter [1, 2] -+ rw [← Real.rpow_one (Real.log x)] -+ rw [← Real.rpow_add (Real.log_pos (by linarith))] -+ ring_nf -+ rw [this] -+ have : Real.log x * const3 * Real.log x ^ (-1 + pow1) -+ = const3 * Real.log x ^ pow1 := by -+ rw [mul_assoc, mul_comm, mul_assoc] -+ congr! 1 -+ conv => -+ enter [1, 2] -+ rw [← Real.rpow_one (Real.log x)] -+ rw [← Real.rpow_add (Real.log_pos (by linarith))] -+ ring_nf -+ rw [this] -+ -+ have event_4_aux : ∀ᶠ (x : ℝ) in atTop, -+ c₅ * rexp (σ₂ * Real.log x + (A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) ≤ -+ c₅ * rexp (Real.log x - (A ^ ((1 : ℝ) / 2) / 4) * Real.log x ^ ((1 : ℝ) / 2)) := by -+ filter_upwards [eventually_gt_atTop 3, event_4_aux1 σ₂_lt_one (A ^ ((1 : ℝ) / 2) / 2) -+ (A ^ ((1 : ℝ) / 2) / 4) (by norm_num : (1 : ℝ) / 2 < 1)] with x x_gt hx -+ rw [mul_le_mul_iff_right₀ c₅pos] -+ apply Real.exp_monotone -+ convert hx -+ -+ have event_4 : ∀ᶠ (x : ℝ) in atTop, c₅ * x ^ σ₂ / (εx x) ≤ -+ c₅ * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by -+ unfold εx c_εx c -+ filter_upwards [event_4_aux, eventually_gt_atTop 0] with x hx xpos -+ convert hx using 1 -+ · rw [← mul_div] -+ congr! 1 -+ rw [div_eq_mul_inv, ← Real.exp_neg] -+ conv => -+ enter [1, 1, 1] -+ rw [← Real.exp_log xpos] -+ rw [← exp_mul, ← Real.exp_add] -+ ring_nf -+ -+ · rw [mul_assoc] -+ congr! 1 -+ conv => -+ enter [1, 1] -+ rw [← Real.exp_log xpos] -+ rw [← Real.exp_add] -+ ring_nf -+ -+ filter_upwards [eventually_gt_atTop 3, eventually_εx_lt_one, eventually_2_lt, -+ eventually_T_gt_3, eventually_T_gt_Tlb₄, eventually_T_gt_Tlb₆, -+ eventually_σ₂_lt_σ₁, eventually_ε_lt_ε_main, event_logX_ge, event_1, event_2, -+ event_3, event_4] with X X_gt_3 ε_lt_one ε_X T_gt_3 T_gt_Tlb₄ T_gt_Tlb₆ -+ σ₂_lt_σ₁ ε_lt_ε_main logX_ge event_1 event_2 event_3 event_4 -+ -+ clear eventually_εx_lt_one eventually_2_lt eventually_T_gt_3 eventually_T_gt_Tlb₄ -+ eventually_T_gt_Tlb₆ eventually_σ₂_lt_σ₁ eventually_ε_lt_ε_main event_logX_ge zeta_bnd -+ -+ let ε : ℝ := εx X -+ have ε_pos : 0 < ε := by positivity -+ specialize h_close X X_gt_3 ε ε_pos ε_lt_one ε_X -+ let ψ_ε_of_X := SmoothedChebyshev ν ε X -+ -+ let T : ℝ := Tx X -+ specialize holo1 T T_gt_3.le -+ let σ₁ : ℝ := 1 - A / (Real.log T) -+ have σ₁pos : 0 < σ₁ := by calc -+ 1 - A / (Real.log T) >= 1 - (1/2) / 1 := by -+ gcongr -+ · exact A_in_Ioc.2 -+ · apply (Real.le_log_iff_exp_le (by positivity)).mpr -+ linarith[Real.exp_one_lt_d9] -+ _ > 0 := by norm_num -+ have σ₁_lt_one : σ₁ < 1 := by -+ apply sub_lt_self -+ apply div_pos A_in_Ioc.1 -+ bound -+ -+ rw [uIcc_of_le (by linarith), uIcc_of_le (by linarith)] at holo2 -+ -+ have holo1_compat : HolomorphicOn (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) := by -+ -+ simpa [σ₁, pow_one] using! holo1 -+ -+ have holo2a : HolomorphicOn (SmoothedChebyshevIntegrand ν ε X) -+ (Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1}) := by -+ apply DifferentiableOn.mul -+ · apply DifferentiableOn.mul -+ · rw [(by ext; ring : (fun s ↦ -ζ' s / ζ s) = (fun s ↦ -(ζ' s / ζ s)))] -+ apply DifferentiableOn.neg holo2 -+ · intro s hs -+ apply DifferentiableAt.differentiableWithinAt -+ apply Smooth1MellinDifferentiable ContDiff1ν ν_supp ⟨ε_pos, ε_lt_one⟩ ν_nonneg ν_massOne -+ linarith[mem_reProdIm.mp hs.1 |>.1.1] -+ · intro s hs -+ apply DifferentiableAt.differentiableWithinAt -+ apply DifferentiableAt.const_cpow (by fun_prop) -+ left -+ norm_cast -+ linarith -+ have ψ_ε_diff : ‖ψ_ε_of_X - 𝓜 ((Smooth1 ν ε) ·) 1 * X‖ ≤ ‖I₁ ν ε X T‖ + ‖I₂ ν ε T X σ₁‖ -+ + ‖I₃ ν ε T X σ₁‖ + ‖I₄ ν ε X σ₁ σ₂‖ + ‖I₅ ν ε X σ₂‖ + ‖I₆ ν ε X σ₁ σ₂‖ + ‖I₇ ν ε T X σ₁‖ -+ + ‖I₈ ν ε T X σ₁‖ + ‖I₉ ν ε X T‖ := by -+ unfold ψ_ε_of_X -+ rw [SmoothedChebyshevPull1 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith) -+ σ₁pos σ₁_lt_one holo1_compat ν_supp ν_nonneg ν_massOne ContDiff1ν] -+ rw [SmoothedChebyshevPull2 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith) -+ σ₂_pos σ₁_lt_one σ₂_lt_σ₁ holo1_compat holo2a ν_supp ν_nonneg ν_massOne ContDiff1ν] -+ ring_nf -+ iterate 5 -+ apply le_trans (by apply norm_add_le) -+ gcongr -+ exact (norm_sub_le _ _).trans -+ (add_le_add ((norm_add_le _ _).trans -+ (add_le_add (norm_sub_le _ _) le_rfl)) le_rfl) -+ -+ specialize h_main ε ⟨ε_pos, ε_lt_ε_main⟩ -+ have main : ‖𝓜 ((Smooth1 ν ε) ·) 1 * X - X‖ ≤ C_main * ε * X := by -+ nth_rewrite 2 [← one_mul X] -+ push_cast -+ rw [← sub_mul, norm_mul] -+ gcongr -+ rw [norm_real, norm_of_nonneg (by linarith)] -+ specialize hc₁ ε ε_pos ε_lt_one X X_gt_3 T_gt_3 -+ specialize hc₂ X X_gt_3 ε_pos ε_lt_one T_gt_3 -+ specialize hc₃ X X_gt_3 ε_pos ε_lt_one T_gt_3 -+ specialize hc₅ X X_gt_3 ε_pos ε_lt_one -+ specialize hc₇ X X_gt_3 ε_pos ε_lt_one T_gt_3 -+ specialize hc₈ X X_gt_3 ε_pos ε_lt_one T_gt_3 -+ specialize hc₉ ε_pos ε_lt_one X X_gt_3 T_gt_3 -+ specialize hc₄ X X_gt_3 ε_pos ε_lt_one T_gt_Tlb₄ -+ specialize hc₆ X X_gt_3 ε_pos ε_lt_one T_gt_Tlb₆ -+ -+ clear ν_nonneg ν_massOne ContDiff1ν ν_supp holo2 -+ -+ have C'bnd : c_close * ε * X * Real.log X + C_main * ε * X ≤ C' * ε * X * Real.log X := by -+ have : C_main * ε * X * 1 ≤ C_main * ε * X * Real.log X := by -+ gcongr -+ linarith -+ -+ have C''bnd : c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) + c₈ * X / (ε * T) -+ + c₉ * X * Real.log X / (ε * T) ≤ C'' * X * Real.log X / (ε * T) := by -+ unfold C'' -+ rw [(by ring : (c₁ + c₂ + c₈ + c₉) * X * Real.log X / (ε * T) -+ = c₁ * X * Real.log X / (ε * T) + c₂ * X * Real.log X / (ε * T) -+ + c₈ * X * Real.log X / (ε * T) + c₉ * X * Real.log X / (ε * T))] -+ have : c₂ * X / (ε * T) * 1 ≤ c₂ * X / (ε * T) * Real.log X := by -+ gcongr -+ have : c₂ * X / (ε * T) ≤ c₂ * X * Real.log X / (ε * T) := by -+ ring_nf at this ⊢ -+ linarith -+ grw [this] -+ have : c₈ * X / (ε * T) * 1 ≤ c₈ * X / (ε * T) * Real.log X := by -+ gcongr -+ have : c₈ * X / (ε * T) ≤ c₈ * X * Real.log X / (ε * T) := by -+ ring_nf at this ⊢ -+ linarith -+ grw [this] -+ -+ have C'''bnd : c₃ * X * X ^ (-A / Real.log T) / ε -+ + c₄ * X * X ^ (-A / Real.log T) / ε -+ + c₆ * X * X ^ (-A / Real.log T) / ε -+ + c₇ * X * X ^ (-A / Real.log T) / ε -+ ≤ C''' * X * X ^ (-A / Real.log T) / ε := by -+ apply le_of_eq -+ ring -+ -+ calc -+ _ = ‖(ψ X - ψ_ε_of_X) + (ψ_ε_of_X - X)‖ := by ring_nf; norm_cast -+ _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖ψ_ε_of_X - X‖ := norm_add_le _ _ -+ _ = ‖ψ X - ψ_ε_of_X‖ + ‖(ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X) -+ + (𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X)‖ := by ring_nf -+ _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X‖ -+ + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ := by -+ rw [add_assoc] -+ gcongr -+ apply norm_add_le -+ _ = ‖ψ X - ψ_ε_of_X‖ + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ -+ + ‖ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X‖ := by ring -+ _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ -+ + (‖I₁ ν ε X T‖ + ‖I₂ ν ε T X σ₁‖ + ‖I₃ ν ε T X σ₁‖ + ‖I₄ ν ε X σ₁ σ₂‖ -+ + ‖I₅ ν ε X σ₂‖ + ‖I₆ ν ε X σ₁ σ₂‖ + ‖I₇ ν ε T X σ₁‖ + ‖I₈ ν ε T X σ₁‖ -+ + ‖I₉ ν ε X T‖) := by gcongr -+ _ ≤ c_close * ε * X * Real.log X + C_main * ε * X -+ + (c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) -+ + c₃ * X * X ^ (-A / Real.log T) / ε -+ + c₄ * X * X ^ (-A / Real.log T) / ε -+ + c₅ * X ^ σ₂ / ε -+ + c₆ * X * X ^ (-A / Real.log T) / ε -+ + c₇ * X * X ^ (-A / Real.log T) / ε -+ + c₈ * X / (ε * T) -+ + c₉ * X * Real.log X / (ε * T)) := by -+ gcongr -+ convert! h_close using 1 -+ rw [← norm_neg] -+ congr -+ ring -+ -+ change ‖I₂ ν ε (Tx X) X σ₁‖ ≤ c₂ * X / (ε * (Tx X)) -+ dsimp at hc₂ -+ dsimp [σ₁] -+ -+ unfold sigma1Of at hc₂ -+ -+ exact hc₂ -+ -+ _ = (c_close * ε * X * Real.log X + C_main * ε * X) -+ + ((c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) -+ + c₈ * X / (ε * T) -+ + c₉ * X * Real.log X / (ε * T)) -+ + (c₃ * X * X ^ (-A / Real.log T) / ε -+ + c₄ * X * X ^ (-A / Real.log T) / ε -+ + c₆ * X * X ^ (-A / Real.log T) / ε -+ + c₇ * X * X ^ (-A / Real.log T) / ε) -+ + c₅ * X ^ σ₂ / ε -+ ) := by ring -+ _ ≤ C' * ε * X * Real.log X -+ + (C'' * X * Real.log X / (ε * T) -+ + C''' * X * X ^ (-A / Real.log T) / ε -+ + c₅ * X ^ σ₂ / ε -+ ) := by -+ gcongr -+ _ = C' * ε * X * Real.log X -+ + C'' * X * Real.log X / (ε * T) -+ + C''' * X * X ^ (-A / Real.log T) / ε -+ + c₅ * X ^ σ₂ / ε -+ := by ring -+ _ ≤ C' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) -+ + C'' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) -+ + C''' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) -+ + c₅ * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) -+ := by -+ gcongr -+ _ = C * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) -+ := by ring -+ _ = _ := by -+ rw [Real.norm_of_nonneg] -+ · rw [← mul_assoc] -+ · positivity -+ -+end Erdos970 -diff --git a/StrongPNT/Erdos970/Z0.lean b/StrongPNT/Erdos970/Z0.lean -new file mode 100644 -index 0000000..093671d ---- /dev/null -+++ b/StrongPNT/Erdos970/Z0.lean -@@ -0,0 +1,60 @@ -+import PrimeNumberTheoremAnd.Erdos970.ZetaBounds -+import StrongPNT.Erdos970.PNT3_RiemannZeta -+ -+namespace Erdos970 -+ -+open _root_.Complex Topology Filter Interval _root_.Set Asymptotics -+ -+local notation (name := riemannzeta1) "ζ" => riemannZeta -+local notation (name := derivriemannzeta1) "ζ'" => deriv riemannZeta -+ -+lemma Z0bound_aux : -+ Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => -(ζ' / ζ) ((1 : ℂ) + delta) - (1 / (delta : ℂ))) (fun _ => (1 : ℂ)) := by -+ -+ let F := fun s : ℂ => -(ζ' / ζ) s - (s - 1)⁻¹ -+ -+ have h_F_bigO : F =O[𝓝[≠] 1] (1 : ℂ → ℂ) := by -+ have h_fun_eq : F = (-ζ' / ζ - fun z ↦ (z - 1)⁻¹) := by -+ ext s -+ simp only [F, Pi.sub_apply, Pi.neg_apply, Pi.div_apply, neg_div] -+ rw [h_fun_eq] -+ exact riemannZetaLogDerivResidueBigO -+ -+ let u := fun (delta : ℝ) => (1 : ℂ) + delta -+ have h_tendsto : Tendsto u (nhdsWithin 0 (Set.Ioi 0)) (𝓝[≠] 1) := by -+ -+ apply tendsto_inf.mpr -+ constructor -+ · -+ have h_cont : Continuous u := continuous_const.add continuous_ofReal -+ -+ have h_tendsto_nhds : Tendsto u (𝓝 0) (𝓝 (u 0)) := h_cont.continuousAt.tendsto -+ -+ simp only [u, Complex.ofReal_zero, add_zero] at h_tendsto_nhds -+ -+ exact h_tendsto_nhds.mono_left nhdsWithin_le_nhds -+ · -+ -+ simp -+ -+ filter_upwards [self_mem_nhdsWithin] with delta h_delta_pos -+ simp only [u] -+ -+ refine add_ne_left.mpr ?_ -+ rw [Complex.ofReal_ne_zero] -+ exact ne_of_gt h_delta_pos -+ -+ have h_comp := h_F_bigO.comp_tendsto h_tendsto -+ -+ convert h_comp using 1 -+ ext delta -+ -+ simp only [F, u, Function.comp_apply, Pi.div_apply] -+ rw [inv_eq_one_div] -+ aesop -+ all_goals rfl -+ -+lemma Z0bound : -+ Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => -logDerivZeta ((1 : ℂ) + delta) - (1 / (delta : ℂ))) (fun _ => (1 : ℂ)) := Z0bound_aux -+ -+end Erdos970 -diff --git a/StrongPNT/Erdos970/ZetaZeroFree.lean b/StrongPNT/Erdos970/ZetaZeroFree.lean -new file mode 100644 -index 0000000..10f11b5 ---- /dev/null -+++ b/StrongPNT/Erdos970/ZetaZeroFree.lean -@@ -0,0 +1,240 @@ -+import StrongPNT.Erdos970.PNT4_ZeroFreeRegion -+import Mathlib.Analysis.Calculus.ContDiff.Defs -+import Mathlib.Analysis.Asymptotics.Defs -+import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic -+import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus -+import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts -+import Mathlib.Analysis.Calculus.Deriv.Basic -+import Mathlib.NumberTheory.LSeries.RiemannZeta -+import Mathlib.Algebra.Group.Basic -+import PrimeNumberTheoremAnd.Erdos970.ResidueCalcOnRectangles -+import PrimeNumberTheoremAnd.Erdos970.MellinCalculus -+import Mathlib.MeasureTheory.Function.Floor -+import Mathlib.Analysis.Complex.CauchyIntegral -+import Mathlib.NumberTheory.Harmonic.Bounds -+import Mathlib.MeasureTheory.Order.Group.Lattice -+import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic -+import Mathlib.Tactic.Bound -+import Mathlib.NumberTheory.LSeries.PrimesInAP -+import Mathlib.Tactic.FunProp -+import PrimeNumberTheoremAnd.Erdos970.Fourier -+import PrimeNumberTheoremAnd.Erdos970.ZetaBounds -+ -+namespace Erdos970 -+ -+open _root_.Complex Topology _root_.Filter Interval _root_.Set Asymptotics -+local notation (name := riemannzeta') "ζ" => riemannZeta -+local notation (name := derivriemannzeta') "ζ'" => deriv riemannZeta -+ -+local notation "I" => Complex.I -+ -+lemma ZetaNoZerosOn1Line' (t : ℝ) : ζ (1 + t * I) ≠ 0 := by -+ refine riemannZeta_ne_zero_of_one_le_re ?_ -+ simp -+ -+lemma ZetaCont' : ContinuousOn ζ (univ \ {1}) := by -+ apply continuousOn_of_forall_continuousAt (fun x hx ↦ ?_) -+ apply DifferentiableAt.continuousAt (𝕜 := ℂ) -+ convert differentiableAt_riemannZeta ?_ -+ simp only [Set.mem_sdiff, mem_univ, mem_singleton_iff, true_and] at hx -+ exact hx -+ -+lemma ZetaNoZerosInBox' (T : ℝ) : -+ ∃ (σ : ℝ) (_ : σ < 1), ∀ (t : ℝ) (_ : |t| ≤ T) -+ (σ' : ℝ) (_ : σ' ≥ σ), ζ (σ' + t * I) ≠ 0 := by -+ by_contra h -+ push Not at h -+ -+ have hn (n : ℕ) := h (σ := 1 - 1 / (n + 1)) (sub_lt_self _ (by positivity)) -+ -+ have : ∃ (tn : ℕ → ℝ) (σn : ℕ → ℝ), (∀ n, σn n ≤ 1) ∧ -+ (∀ n, (1 : ℝ) - 1 / (n + 1) ≤ σn n) ∧ (∀ n, |tn n| ≤ T) ∧ -+ (∀ n, ζ (σn n + tn n * I) = 0) := by -+ choose t ht σ' hσ' hζ using hn -+ refine ⟨t, σ', ?_, hσ', ht, hζ⟩ -+ intro n -+ by_contra hσn -+ push Not at hσn -+ have := riemannZeta_ne_zero_of_one_lt_re (s := σ' n + t n * I) -+ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, -+ add_zero, ne_eq] at this -+ exact this hσn (hζ n) -+ -+ choose t σ' hσ'_le hσ'_ge ht hζ using this -+ -+ have σTo1 : Filter.Tendsto σ' Filter.atTop (𝓝 1) := by -+ have hlow : Tendsto (fun n : ℕ => (1 : ℝ) - 1 / (n + 1)) atTop (𝓝 1) := by -+ simpa using! (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).const_sub 1 -+ exact tendsto_of_tendsto_of_tendsto_of_le_of_le hlow tendsto_const_nhds hσ'_ge hσ'_le -+ -+ have : ∃ (t₀ : ℝ) (subseq : ℕ → ℕ), -+ Filter.Tendsto (t ∘ subseq) Filter.atTop (𝓝 t₀) ∧ -+ Filter.Tendsto subseq Filter.atTop Filter.atTop := by -+ refine (isCompact_Icc.isSeqCompact fun and => abs_le.1 (ht and)).imp fun and ⟨x, A, B, _⟩ => ?_ -+ use A, by valid, B.tendsto_atTop -+ -+ obtain ⟨t₀, subseq, tTendsto, subseqTendsto⟩ := this -+ -+ have σTo1 : Filter.Tendsto (σ' ∘ subseq) Filter.atTop (𝓝 1) := -+ σTo1.comp subseqTendsto -+ -+ have (n : ℕ) : ζ (σ' (subseq n) + I * (t (subseq n))) = 0 := by -+ convert hζ (subseq n) using 3 -+ ring -+ -+ have ToOneT0 : Filter.Tendsto (fun n ↦ (σ' (subseq n) : ℂ) + Complex.I * (t (subseq n))) Filter.atTop -+ (𝓝[≠]((1 : ℂ) + I * t₀)) := by -+ simp_rw [tendsto_nhdsWithin_iff, Function.comp_def] at tTendsto ⊢ -+ constructor -+ · exact (σTo1.ofReal.add (tTendsto.ofReal.const_mul _)).trans (by simp) -+ · filter_upwards with n -+ apply ne_of_apply_ne ζ -+ rw [this] -+ apply Ne.symm -+ apply riemannZeta_ne_zero_of_one_le_re -+ simp only [add_re, one_re, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, -+ sub_self, add_zero, le_refl] -+ -+ by_cases ht₀ : t₀ = 0 -+ · have ZetaBlowsUp : ∀ᶠ s in 𝓝[≠](1 : ℂ), ‖ζ s‖ ≥ 1 := by -+ have hprod : Tendsto (fun s : ℂ => ‖(s - 1) * ζ s‖) (𝓝[≠] 1) (𝓝 1) := by -+ simpa only [norm_one] using! riemannZeta_residue_one.norm -+ have hid : Tendsto (fun s : ℂ => s) (𝓝[≠] 1) (𝓝 1) := -+ tendsto_id.mono_left nhdsWithin_le_nhds -+ have hdist : Tendsto (fun s : ℂ => ‖s - 1‖) (𝓝[≠] 1) (𝓝 0) := by -+ simpa only [sub_self, norm_zero] using! (hid.sub_const 1).norm -+ filter_upwards [hprod.eventually_const_lt (by norm_num : (1 / 2 : ℝ) < 1), -+ hdist.eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 2)] with s hp hs -+ by_contra h -+ have hlt : ‖ζ s‖ < 1 := lt_of_not_ge h -+ have hm := mul_le_mul_of_nonneg_left hlt.le (norm_nonneg (s - 1)) -+ rw [norm_mul] at hp -+ rw [mul_one] at hm -+ linarith -+ -+ have ZetaNonZ : ∀ᶠ s in 𝓝[≠](1 : ℂ), ζ s ≠ 0 := by -+ filter_upwards [ZetaBlowsUp] -+ intro s hs hfalse -+ rw [hfalse] at hs -+ simp only [norm_zero, ge_iff_le] at hs -+ linarith -+ -+ rw [ht₀] at ToOneT0 -+ simp only [ofReal_zero, mul_zero, add_zero] at ToOneT0 -+ rcases (ToOneT0.eventually ZetaNonZ).exists with ⟨n, hn⟩ -+ exact hn (this n) -+ -+ · have zetaIsZero : ζ (1 + Complex.I * t₀) = 0 := by -+ have hpoint : (1 + Complex.I * t₀ : ℂ) ≠ 1 := by -+ intro heq -+ have him := congrArg Complex.im heq -+ have htzero : t₀ = 0 := by simpa using him -+ exact ht₀ htzero -+ have hcont := (differentiableAt_riemannZeta hpoint).continuousAt -+ have hlim : Tendsto (fun n : ℕ => ζ (σ' (subseq n) + I * t (subseq n))) atTop -+ (𝓝 (ζ (1 + I * t₀))) := by -+ simpa only [Function.comp_def] using! -+ hcont.tendsto.comp (ToOneT0.mono_right nhdsWithin_le_nhds) -+ have hfun : (fun n : ℕ => ζ (σ' (subseq n) + I * t (subseq n))) = (fun _ => 0) := -+ funext this -+ rw [hfun] at hlim -+ exact tendsto_nhds_unique hlim tendsto_const_nhds -+ -+ exact riemannZeta_ne_zero_of_one_le_re (s := 1 + I * t₀) (by simp) zetaIsZero -+ -+lemma LogDerivZetaHoloOn' {S : Set ℂ} (s_ne_one : 1 ∉ S) -+ (nonzero : ∀ s ∈ S, ζ s ≠ 0) : -+ HolomorphicOn (fun s ↦ ζ' s / ζ s) S := by -+ apply DifferentiableOn.div _ _ nonzero <;> intro s hs <;> apply DifferentiableAt.differentiableWithinAt -+ · apply differentiableAt_deriv_riemannZeta -+ exact ne_of_mem_of_not_mem hs s_ne_one -+ · apply differentiableAt_riemannZeta -+ exact ne_of_mem_of_not_mem hs s_ne_one -+ -+theorem LogDerivZetaHolcSmallT' : -+ ∃ (σ₂ : ℝ) (_ : σ₂ < 1), HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) -+ (( [[ σ₂, 2 ]] ×ℂ [[ -3, 3 ]]) \ {1}) := by -+ obtain ⟨σ₂, hσ₂_lt_one, hζ_ne_zero⟩ := ZetaNoZerosInBox 3 -+ refine ⟨σ₂, hσ₂_lt_one, ?_⟩ -+ let U := ([[σ₂, 2]] ×ℂ [[-3, 3]]) \ {1} -+ have s_in_U_im_le3 : ∀ s ∈ U, |s.im| ≤ 3 := by -+ intro s hs -+ rw [mem_sdiff_singleton] at hs -+ rcases hs with ⟨hbox, _hne⟩ -+ rcases hbox with ⟨hre, him⟩ -+ simp only [Set.mem_preimage] at him -+ obtain ⟨him_lower, him_upper⟩ := him -+ apply abs_le.2 -+ simp at him_lower -+ simp at him_upper -+ constructor -+ · exact him_lower -+ · exact him_upper -+ -+ have s_in_U_re_ges2 : ∀ s ∈ U, σ₂ ≤ s.re := by -+ intro s hs -+ rw [mem_sdiff_singleton] at hs -+ rcases hs with ⟨hbox, _hne⟩ -+ rcases hbox with ⟨hre, _him⟩ -+ simp only [Set.mem_preimage] at hre -+ obtain ⟨hre_lower, hre_upper⟩ := hre -+ have : min σ₂ 2 = σ₂ := by -+ apply min_eq_left -+ linarith [hσ₂_lt_one] -+ rw[this] at hre_lower -+ exact hre_lower -+ -+ apply LogDerivZetaHoloOn -+ · exact notMem_sdiff_of_mem rfl -+ · intro s hs -+ rw[← re_add_im s] -+ apply hζ_ne_zero -+ apply s_in_U_im_le3 _ hs -+ apply s_in_U_re_ges2 _ hs -+ -+theorem LogDerivZetaHolcLargeT' : -+ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)), ∀ (T : ℝ) (_ : 3 ≤ T), -+ HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) -+ (( (Icc ((1 : ℝ) - A / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) ) \ {1}) := by -+ obtain ⟨A, A_inter, restOfZetaZeroFree⟩ := ZetaZeroFree_p -+ obtain ⟨σ₁, σ₁_lt_one, noZerosInBox⟩ := ZetaNoZerosInBox' 3 -+ let A₀ := min A ((1 - σ₁) * Real.log 3 ^ 1) -+ refine ⟨A₀, ?_, ?_⟩ -+ · constructor -+ · apply lt_min A_inter.1 -+ bound -+ · exact le_trans (min_le_left _ _) A_inter.2 -+ intro T hT -+ apply LogDerivZetaHoloOn -+ · exact notMem_sdiff_of_mem rfl -+ intro s hs -+ rcases le_or_gt 1 s.re with one_le|lt_one -+ · exact riemannZeta_ne_zero_of_one_le_re one_le -+ rw [← re_add_im s] -+ have := Complex.mem_reProdIm.mp hs.1 -+ rcases lt_or_ge 3 |s.im| with gt3|le3 -+ · apply restOfZetaZeroFree _ _ gt3 -+ refine ⟨?_, lt_one⟩ -+ calc -+ _ ≤ 1 - A₀ / Real.log T ^ 1 := by -+ gcongr -+ · exact A_inter.1.le -+ · bound -+ · bound -+ · bound -+ · exact abs_le.mpr ⟨this.2.1, this.2.2⟩ -+ _ ≤ _:= by exact this.1.1 -+ -+ · apply noZerosInBox _ le3 -+ calc -+ _ ≥ 1 - A₀ / Real.log T ^ 1 := by exact this.1.1 -+ _ ≥ 1 - A₀ / Real.log 3 ^ 1 := by -+ gcongr -+ apply le_min A_inter.1.le -+ bound -+ _ ≥ 1 - (((1 - σ₁) * Real.log 3 ^ 1)) / Real.log 3 ^ 1:= by -+ gcongr -+ apply min_le_right -+ _ = _ := by field_simp; ring -+ -+end Erdos970 -diff --git a/lakefile.toml b/lakefile.toml -index 3bf8290..2fecc18 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -1,16 +1,6 @@ -- --name = "StrongPNT" --version = "0.1.0" --defaultTargets = ["StrongPNT"] -- --[leanOptions] --pp.unicode.fun = true --autoImplicit = false --relaxedAutoImplicit = false --linter.unusedVariables = false -- --[[lean_lib]] - name = "StrongPNT" -+version = "0.1.0" -+defaultTargets = ["StrongPNTErdos970"] - - [[require]] - name = "mathlib" -@@ -30,3 +20,8 @@ git = "https://github.com/PatrickMassot/checkdecls.git" - name = "«doc-gen4»" - git = "https://github.com/leanprover/doc-gen4" - rev = "v4.21.0" -+ -+[[lean_lib]] -+name = "StrongPNTErdos970" -+roots = ["StrongPNT.Erdos970"] -+globs = ["StrongPNT.Erdos970.*"] -diff --git a/lean-toolchain b/lean-toolchain -index 980709b..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.21.0 -+leanprover/lean4:v4.34.1 +diff --git a/StrongPNT/Erdos970.lean b/StrongPNT/Erdos970.lean +new file mode 100644 +index 0000000..2427743 +--- /dev/null ++++ b/StrongPNT/Erdos970.lean +@@ -0,0 +1 @@ ++import StrongPNT.Erdos970.PNT5_Strong +diff --git a/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean b/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean +new file mode 100644 +index 0000000..c54399a +--- /dev/null ++++ b/StrongPNT/Erdos970/PNT1_ComplexAnalysis.lean +@@ -0,0 +1,5460 @@ ++import Mathlib ++ ++namespace Erdos970 ++ ++ ++lemma lem_2logOlog : (fun t : ℝ => 2 * Real.log t) =O[Filter.atTop] (fun t : ℝ => Real.log t) := Asymptotics.isBigO_const_mul_self 2 Real.log Filter.atTop ++ ++lemma lem_logt22logt (t : ℝ) (_ht : t ≥ 2) : Real.log (t ^ 2) = 2 * Real.log t := by ++ exact Real.log_pow t 2 ++ ++lemma lem_log2tlogt2 (t : ℝ) (ht : t ≥ 2) : Real.log (2 * t) ≤ Real.log (t ^ 2) := by ++ apply Real.log_le_log ++ · ++ linarith ++ · ++ ++ have h1 : t * (t - 2) ≥ 0 := by ++ apply mul_nonneg ++ · linarith ++ · linarith ++ ++ linarith [h1] ++ ++lemma lem_log22log (t : ℝ) (ht : t ≥ 2) : Real.log (2 * t) ≤ 2 * Real.log t := by ++ rw [← lem_logt22logt t ht] ++ exact lem_log2tlogt2 t ht ++ ++lemma lem_exprule (n : ℕ) (hn : n ≥ 1) (α β : ℂ) : (n : ℂ) ^ (α + β) = (n : ℂ) ^ α * (n : ℂ) ^ β := by ++ apply Complex.cpow_add ++ ++ rw [Nat.cast_ne_zero] ++ ++ rw [← Nat.one_le_iff_ne_zero] ++ exact hn ++ ++lemma lem_realbw (b : ℝ) (w : ℂ) : (b * w).re = b * w.re := by ++ exact Complex.re_ofReal_mul b w ++ ++lemma lem_sumReal {f : ℕ+ → ℂ} (hf : Summable f) : (∑' n : ℕ+, f n).re = ∑' n : ℕ+, (f n).re := by ++ exact Complex.re_tsum hf ++ ++lemma lem_Euler (a : ℝ) : Complex.exp (a * Complex.I) = Real.cos a + Real.sin a * Complex.I := by ++ rw [Complex.exp_mul_I] ++ rw [← Complex.ofReal_cos, ← Complex.ofReal_sin] ++ ++lemma lem_Reecos (a : ℝ) : (Complex.exp (a * Complex.I)).re = Real.cos a := by ++ rw [lem_Euler] ++ rw [Complex.add_re] ++ rw [Complex.ofReal_re] ++ rw [Complex.re_ofReal_mul] ++ rw [Complex.I_re] ++ simp ++ ++lemma lem_explog (n : ℕ) (hn : n ≥ 1) : (n : ℝ) = Real.exp (Real.log (n : ℝ)) := by ++ rw [Real.exp_log] ++ ++ rw [Nat.cast_pos] ++ ++ have h1 : n ≠ 0 := by ++ rw [← Nat.one_le_iff_ne_zero] ++ exact hn ++ rw [Nat.pos_iff_ne_zero] ++ exact h1 ++ ++lemma lem_coseven (a : ℝ) : Real.cos (-a) = Real.cos a := by ++ exact Real.cos_neg a ++ ++lemma lem_coseveny (n : ℕ) (_hn : n ≥ 1) (y : ℝ) : Real.cos (-y * Real.log (n : ℝ)) = Real.cos (y * Real.log (n : ℝ)) := by ++ rw [neg_mul] ++ exact lem_coseven (y * Real.log (n : ℝ)) ++ ++lemma lem_niyelog (n : ℕ) (hn : n ≥ 1) (y : ℝ) : (n : ℂ) ^ (-y * Complex.I) = Complex.exp (-y * Complex.I * Real.log (n : ℝ)) := by ++ ++ have h1 : (n : ℂ) ≠ 0 := by ++ rw [Nat.cast_ne_zero] ++ rw [← Nat.one_le_iff_ne_zero] ++ exact hn ++ ++ rw [Complex.cpow_def_of_ne_zero h1] ++ ++ rw [← Complex.natCast_log] ++ ++ ring_nf ++ ++lemma lem_eacosalog (n : ℕ) (_hn : n ≥ 1) (y : ℝ) : (Complex.exp (-y * Complex.I * Real.log (n : ℝ))).re = Real.cos (-y * Real.log (n : ℝ)) := by ++ ++ let a := -y * Real.log (n : ℝ) ++ ++ have h : -y * Complex.I * Real.log (n : ℝ) = a * Complex.I := by ++ simp [a, mul_assoc, mul_comm Complex.I] ++ rw [h] ++ ++ exact lem_Reecos a ++ ++lemma lem_eacosalog2 (n : ℕ) (hn : n ≥ 1) (y : ℝ) : ((n : ℂ) ^ (-y * Complex.I)).re = Real.cos (-y * Real.log (n : ℝ)) := by ++ rw [lem_niyelog n hn y] ++ exact lem_eacosalog n hn y ++ ++lemma lem_eacosalog3 (n : ℕ) (hn : n ≥ 1) (y : ℝ) : ((n : ℂ) ^ (-y * Complex.I)).re = Real.cos (y * Real.log (n : ℝ)) := by ++ rw [lem_eacosalog2 n hn y] ++ exact lem_coseveny n hn y ++ ++lemma lem_cos2t (θ : ℝ) : Real.cos (2 * θ) = 2 * Real.cos θ ^ 2 - 1 := by ++ exact Real.cos_two_mul θ ++ ++lemma lem_cos2t2 (θ : ℝ) : 2 * Real.cos θ ^ 2 = 1 + Real.cos (2 * θ) := by ++ rw [lem_cos2t] ++ ring ++ ++lemma lem_cosSquare (θ : ℝ) : 2 * (1 + Real.cos θ)^2 = 2 + 4 * Real.cos θ + 2 * Real.cos θ^2 := by ++ ring ++ ++lemma lem_cos2cos341 (θ : ℝ) : 2 * (1 + Real.cos θ) ^ 2 = 3 + 4 * Real.cos θ + Real.cos (2 * θ) := by ++ rw [lem_cosSquare] ++ rw [lem_cos2t2] ++ ring ++ ++lemma lem_SquarePos (y : ℝ) : 0 ≤ y ^ 2 := by ++ exact sq_nonneg y ++ ++lemma lem_SquarePos2 (y : ℝ) : 0 ≤ 2 * y ^ 2 := by ++ apply mul_nonneg ++ · norm_num ++ · exact lem_SquarePos y ++ ++lemma lem_SquarePoscos (θ : ℝ) : 0 ≤ 2 * (1 + Real.cos θ) ^ 2 := by ++ exact lem_SquarePos2 (1 + Real.cos θ) ++ ++lemma lem_postrig (θ : ℝ) : 0 ≤ 3 + 4 * Real.cos θ + Real.cos (2 * θ) := by ++ rw [← lem_cos2cos341] ++ exact lem_SquarePoscos θ ++ ++lemma lem_postriglogn (n : ℕ) (_hn : n ≥ 1) (t : ℝ) : 0 ≤ 3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ)) := by ++ rw [mul_assoc] ++ exact lem_postrig (t * Real.log (n : ℝ)) ++ ++lemma lem_seriesPos {r_n : ℕ+ → ℝ} {r : ℝ} (h_hasSum : HasSum r_n r) (h_nonneg : ∀ n : ℕ+, r_n n ≥ 0) : r ≥ 0 := by ++ ++ have h_eq : ∑' n, r_n n = r := HasSum.tsum_eq h_hasSum ++ ++ have h_tsum_nonneg : ∑' n, r_n n ≥ 0 := tsum_nonneg h_nonneg ++ ++ rw [← h_eq] ++ exact h_tsum_nonneg ++ ++lemma real_part_of_diff (M : ℝ) (w : ℂ) : (2 * M - w).re = 2 * M - w.re := by ++ simp [Complex.sub_re] ++ ++lemma real_part_of_diffz (M : ℝ) (f_z : ℂ) : (2 * M - f_z).re = 2 * M - f_z.re := real_part_of_diff M f_z ++ ++lemma inequality_reversal (x M : ℝ) (hxM : x ≤ M) : 2 * M - x ≥ M := by linarith ++ ++lemma real_part_lower_bound (w : ℂ) (M : ℝ) (_hM : M > 0) (h : w.re ≤ M) : 2 * M - w.re ≥ M := by apply inequality_reversal w.re M h ++ ++lemma real_part_lower_bound2 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w).re ≥ M := by rw [real_part_of_diffz]; exact real_part_lower_bound w M hM h ++ ++lemma real_part_lower_bound3 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w).re > 0 := by ++ rw [real_part_of_diffz] ++ apply lt_of_le_of_lt' ++ apply real_part_lower_bound ++ exact hM ++ exact h ++ exact hM ++ ++lemma nonzero_if_real_part_positive (w : ℂ) (hw_re_pos : w.re > 0) : w ≠ 0 := by ++ by_contra h ++ rw [h] at hw_re_pos ++ exact lt_irrefl 0 hw_re_pos ++ ++lemma lem_real_part_lower_bound4 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : (2 * M - w) ≠ 0 := by ++ apply nonzero_if_real_part_positive ++ exact real_part_lower_bound3 w M hM h ++ ++lemma lem_abspos (z : ℂ) : z ≠ 0 → norm z > 0 := by ++ intro h_ne_zero ++ apply Real.sqrt_pos.mpr ++ exact Complex.normSq_pos.mpr h_ne_zero ++ ++lemma lem_real_part_lower_bound5 (w : ℂ) (M : ℝ) (hM : M > 0) (h : w.re ≤ M) : norm (2 * M - w) > 0 := by ++ apply lem_abspos ++ exact lem_real_part_lower_bound4 w M hM h ++ ++lemma lem_wReIm (w : ℂ) : w = w.re + Complex.I * w.im := by ++ apply Complex.ext ++ simp ++ simp ++ ++lemma lem_modaib (a b : ℝ) : norm (a + Complex.I * b) ^ 2 = a ^ 2 + b ^ 2 := by rw [Complex.sq_norm, Complex.normSq_apply]; simp; ring ++ ++lemma lem_modcaib (a b c : ℝ) : norm (c - a - Complex.I * b) ^ 2 = (c - a) ^ 2 + b ^ 2 := by ++ rw [Complex.sq_norm, Complex.normSq_apply] ++ simp ++ ring ++ ++lemma lem_diffmods (a b c : ℝ) : ++norm (c - a - Complex.I * b) ^ 2 - norm (a + Complex.I * b) ^ 2 = (c - a) ^ 2 - a ^ 2 := by ++ rw [lem_modcaib, lem_modaib] ++ ring ++ ++lemma lem_casq (a c : ℝ) : (c - a) ^ 2 = a ^ 2 - 2 * a * c + c ^ 2 := by linarith ++ ++lemma lem_casq2 (a c : ℝ) : (c - a) ^ 2 - a ^ 2 = c * (c - 2 * a) := by ++ ring ++ ++lemma lem_diffmods2 (a b c : ℝ) : norm (c - a - Complex.I * b) ^ 2 - norm (a + Complex.I * b) ^ 2 = c * (c - 2 * a) := by ++ rw [lem_diffmods] ++ rw [lem_casq2] ++ ++lemma lem_modulus_sq_ReImw (M : ℝ) (w : ℂ) : norm (2 * M - w) ^ 2 - norm w ^ 2 = 4 * M * (M - w.re) := by ++ simp_rw [Complex.sq_norm] ++ simp_rw [Complex.normSq_apply] ++ simp [Complex.sub_re, Complex.sub_im, Complex.ofReal_re, Complex.ofReal_im] ++ ring ++ ++lemma lem_modulus_sq_identity (M : ℝ) (w : ℂ) : norm (2 * M - w) ^ 2 - norm w ^ 2 = 4 * M * (M - w.re) := lem_modulus_sq_ReImw M w ++ ++lemma lem_nonnegative_product (M x : ℝ) (hM : M > 0) (hxM : x ≤ M) : 4 * M * (M - x) ≥ 0 := by ++ have h_four_M_nonneg : 4 * M ≥ 0 := by linarith [hM] ++ have h_diff_nonneg : M - x ≥ 0 := by linarith [hxM] ++ apply mul_nonneg h_four_M_nonneg h_diff_nonneg ++ ++lemma lem_nonnegative_product2 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : 4 * M * (M - w.re) ≥ 0 := by ++ apply lem_nonnegative_product ++ exact hM ++ exact hw_re_le_M ++ ++lemma lem_nonnegative_product3 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ^ 2 - norm w ^ 2 ≥ 0 := by ++ rw [lem_modulus_sq_identity] ++ apply lem_nonnegative_product2 ++ exact hM ++ exact hw_re_le_M ++ ++lemma lem_nonnegative_product4 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ^ 2 ≥ norm w ^ 2 := by ++ have h := lem_nonnegative_product3 M w hM hw_re_le_M ++ linarith ++ ++lemma lem_nonnegative_product5 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm (2 * M - w) ≥ norm w := by ++ have h_sq_ge : ‖2 * M - w‖ ^ 2 ≥ ‖w‖ ^ 2 := by ++ apply lem_nonnegative_product4 M w hM hw_re_le_M ++ rw [ge_iff_le] at h_sq_ge ++ ++ apply (sq_le_sq₀ (norm_nonneg w) (norm_nonneg (2 * M - w))).mp ++ exact h_sq_ge ++ ++lemma lem_nonnegative_product6 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm w ≤ norm (2 * M - w) := by apply lem_nonnegative_product5 M w hM hw_re_le_M ++ ++lemma lem_ineqmultr (a b c : ℝ) (hc : c > 0) (_ha : 0 ≤ a) (hab : a ≤ b) : a / c ≤ b / c := by ++ apply div_le_div_of_nonneg_right ++ exact hab ++ linarith [hc] ++ ++lemma lem_ineqmultrbb (a b : ℝ) (hb : b > 0) (ha : 0 ≤ a) (hab : a ≤ b) : a / b ≤ 1 := by ++ have h := lem_ineqmultr a b b hb ha hab ++ rw [div_self (ne_of_gt hb)] at h ++ exact h ++ ++lemma lem_nonnegative_product7 (M : ℝ) (w : ℂ) (_hM : M > 0) (h_abs_diff_pos : norm (2 * M - w) > 0) (h_abs_le_abs_diff : norm w ≤ norm (2 * M - w)) : norm w / norm (2 * M - w) ≤ 1 := by ++ ++ have h_abs_w_nonneg : 0 ≤ ‖w‖ := norm_nonneg w ++ ++ apply lem_ineqmultrbb ++ exact h_abs_diff_pos ++ exact h_abs_w_nonneg ++ exact h_abs_le_abs_diff ++ ++lemma lem_nonnegative_product8 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) (h_abs_le_abs_diff : norm w ≤ ++norm (2 * M - w)) : norm w / norm (2 * M - w) ≤ 1 := by ++ apply lem_nonnegative_product7 M w ++ exact hM ++ apply lem_real_part_lower_bound5 w M hM hw_re_le_M ++ exact h_abs_le_abs_diff ++ ++lemma lem_nonnegative_product9 (M : ℝ) (w : ℂ) (hM : M > 0) (hw_re_le_M : w.re ≤ M) : norm w / norm (2 * M - w) ≤ 1 := by ++ apply lem_nonnegative_product8 ++ exact hM ++ exact hw_re_le_M ++ apply lem_nonnegative_product6 ++ exact hM ++ exact hw_re_le_M ++ ++lemma lem_triangle_ineq (N G : ℂ) : norm (N + G) ≤ norm N + norm G := by ++ exact norm_add_le N G ++ ++lemma lem_triangleineqminus (N F : ℂ) : norm (N - F) ≤ norm N + norm F := by ++ rw [sub_eq_add_neg] ++ calc ++ ‖N + (-F)‖ ≤ ‖N‖ + ‖-F‖ := by apply lem_triangle_ineq ++ _ = ‖N‖ + ‖F‖ := by rw [norm_neg] ++ ++lemma lem_rtriangle (r : ℝ) (N F : ℂ) (hr : r > 0) : r * norm (N - F) ≤ r * (norm N + norm F) := by ++ apply mul_le_mul_of_nonneg_left ++ apply lem_triangleineqminus ++ linarith ++ ++lemma rtriangle2 (r : ℝ) (N F : ℂ) (hr : r > 0) : r * norm (N - F) ≤ r * norm N + r * norm F := by ++ have h := lem_rtriangle r N F hr ++ linarith [h] ++ ++lemma lem_rtriangle3 (r R : ℝ) (N F : ℂ) (hr : r > 0) (_hR : r < R) (h : R * norm F ≤ r * norm (N - F)) : R * norm F ≤ r * norm N + r * norm F := by ++ calc ++ R * norm F ≤ r * norm (N - F) := by exact h ++ _ ≤ r * norm N + r * norm F := by apply rtriangle2 r N F hr ++ ++lemma lem_rtriangle4 (r R : ℝ) (N F : ℂ) (hr : 0 < r) (hR : r < R) (h_hyp : R * norm F ≤ r * norm (N - F)) : (R - r) * norm F ≤ r * norm N := by ++ have h_result_from_lem3 : R * norm F ≤ r * norm N + r * norm F := by ++ apply lem_rtriangle3 r R N F hr hR h_hyp ++ linarith [h_result_from_lem3] ++ ++lemma lem_absposeq (a : ℝ) (ha : a > 0) : |a| = a := by ++ apply Real.norm_of_nonneg ++ linarith [ha] ++ ++lemma lem_a2a (a : ℝ) (ha : a > 0) : 2 * a > 0 := by linarith ++ ++lemma lem_absposeq2 (a : ℝ) (ha : a > 0) : |2 * a| = 2 * a := by ++ apply lem_absposeq ++ apply lem_a2a ++ exact ha ++ ++lemma lem_rtriangle5 (r R M : ℝ) (F : ℂ) (hr : 0 < r) (hrR : r < R) (hM : M > 0) ++ (h_hyp : R * norm F ≤ r * norm (2 * M - F)) : ++(R - r) * norm F ≤ 2 * M * r := by ++ ++ have h1 : (R - r) * norm F ≤ r * norm (2 * M : ℂ) := ++ lem_rtriangle4 r R (2 * M : ℂ) F hr hrR h_hyp ++ ++ have h2 : norm (2 * M : ℂ) = 2 * M := by ++ ++ have h_pos : (2 * M : ℝ) > 0 := by linarith [hM] ++ ++ convert Complex.norm_of_nonneg (le_of_lt h_pos) using 1 ++ ++ norm_cast ++ ++ rw [h2] at h1 ++ ++ rw [mul_comm r (2 * M)] at h1 ++ exact h1 ++ ++lemma lem_RrFpos (r R : ℝ) (F : ℂ) (_hr : 0 < r) (hrR : r < R) : (R - r) * norm F ≥ 0 := by ++ have h_R_minus_r_nonneg : R - r ≥ 0 := by linarith [hrR] ++ have h_abs_F_nonneg : 0 ≤ norm F := by apply norm_nonneg ++ apply mul_nonneg h_R_minus_r_nonneg h_abs_F_nonneg ++ ++lemma lem_rtriangle6 (r R M : ℝ) (F : ℂ) (hr : 0 < r) (hrR : r < R) (_hM : M > 0) ++ (h_hyp : (R - r) * norm F ≤ 2 * M * r) : ++norm F ≤ (2 * M * r) / (R - r) := by ++ have h_R_minus_r_pos : R - r > 0 := by linarith [hrR] ++ have h_numerator_nonneg : 0 ≤ (R - r) * ‖F‖ := by apply lem_RrFpos r R F hr hrR ++ ++ have h_ineq_with_denominators : ( (R - r) * ‖F‖ ) / (R - r) ≤ (2 * M * r) / (R - r) := by ++ apply lem_ineqmultr ++ exact h_R_minus_r_pos ++ exact h_numerator_nonneg ++ exact h_hyp ++ ++ rw [mul_div_cancel_left₀ (‖F‖) (ne_of_gt h_R_minus_r_pos)] at h_ineq_with_denominators ++ ++ exact h_ineq_with_denominators ++ ++lemma lem_rtriangle7 (r R M : ℝ) (F : ℂ) ++ (hr : 0 < r) (hrR : r < R) (hM : M > 0) ++ (h_hyp : R * norm F ≤ r * norm (2 * M - F)) : ++norm F ≤ (2 * M * r) / (R - r) := by ++ have h_step1 := lem_rtriangle5 r R M F hr hrR hM h_hyp ++ apply lem_rtriangle6 r R M F hr hrR hM h_step1 ++ ++def ballDR (R : ℝ) : Set ℂ := Metric.ball (0 : ℂ) R ++ ++lemma analyticAt_to_analyticWithinAt {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} (hf : AnalyticAt ℂ f z) : AnalyticWithinAt ℂ f S z := by ++ exact hf.analyticWithinAt ++ ++theorem analyticWithinAt_to_analyticAt_aux {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} (_hS : S ∈ nhds z) ++ (p : FormalMultilinearSeries ℂ ℂ ℂ) (r : ENNReal) (_h_conv_on_inter : r ≤ p.radius) (_hr_pos : 0 < r) ++ (hasSumt : ∀ {y : ℂ}, z + y ∈ insert z S → y ∈ Metric.eball 0 r → HasSum (fun n => (p n) fun _x => y) (f (z + y))) ++ (ε : ℝ) (hε_pos : ε > 0) (h_ball_subset_S : Metric.ball z ε ⊆ S) : ++ let r' := min r (ENNReal.ofReal ε); ++ ∀ {y : ℂ}, y ∈ Metric.eball 0 r' → HasSum (fun n => (p n) fun _x => y) (f (z + y)) := by ++ intro r' y hy ++ apply hasSumt ++ · ++ ++ right ++ apply h_ball_subset_S ++ rw [Metric.mem_ball] ++ ++ simp ++ ++ have : y ∈ Metric.eball 0 (ENNReal.ofReal ε) := by ++ apply Metric.eball_subset_eball (min_le_right r (ENNReal.ofReal ε)) hy ++ ++ have ε_nn : ENNReal.ofReal ε = ↑(ε.toNNReal) := by ++ simp [ENNReal.ofReal] ++ rw [ε_nn] at this ++ rw [@Metric.eball_coe] at this ++ simpa [Metric.mem_ball, dist_self_add_right, Real.toNNReal_of_nonneg hε_pos.le] ++ ++ · ++ exact Metric.eball_subset_eball (min_le_left r (ENNReal.ofReal ε)) hy ++ ++theorem analyticWithinAt_to_analyticAt {f : ℂ → ℂ} {S : Set ℂ} {z : ℂ} ++ (hS : S ∈ nhds z) (h : AnalyticWithinAt ℂ f S z) : AnalyticAt ℂ f z := by ++ rcases h with ⟨p, hp⟩ ++ ++ use p ++ ++ rcases hp with ⟨r, h_conv_on_inter, hr_pos⟩ ++ ++ rcases Metric.mem_nhds_iff.mp hS with ⟨ε, hε_pos, h_ball_subset_S⟩ ++ ++ let r' := min r (ENNReal.ofReal ε) ++ use r' ++ ++ constructor ++ ++ · exact inf_le_of_left_le h_conv_on_inter ++ ++ · ++ exact lt_min hr_pos (ENNReal.ofReal_pos.mpr hε_pos) ++ rename_i hasSumt ++ exact analyticWithinAt_to_analyticAt_aux hS p r h_conv_on_inter hr_pos hasSumt ε hε_pos h_ball_subset_S ++ ++lemma lem_not0mono (R : ℝ) (_hR_pos : 0 < R) (_hR_lt_one : R < 1) : ++ {z : ℂ | norm z ≤ R ∧ z ≠ 0} ⊆ {z : ℂ | z ≠ 0} := by ++ intro z hz ++ exact hz.2 ++ ++lemma lem_analmono {T S : Set ℂ} {f : ℂ → ℂ} (hS : AnalyticOn ℂ f S) (hT : T ⊆ S) : ++ AnalyticOn ℂ f T := by ++ exact hS.mono hT ++ ++lemma lem_1zanalDR (R : ℝ) (_hR_pos : 0 < R) : ++ AnalyticOn ℂ (fun z ↦ z⁻¹) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by ++ ++ apply AnalyticOn.mono (analyticOn_inv) ++ ++ intro z hz ++ ++ exact hz.2 ++ ++lemma lem_analprod {T : Set ℂ} {f1 f2 : ℂ → ℂ} (hf1 : AnalyticOn ℂ f1 T) (hf2 : AnalyticOn ℂ f2 T) : ++ AnalyticOn ℂ (f1 * f2) T := by ++ exact hf1.mul hf2 ++ ++lemma lem_analprodST {T S : Set ℂ} {f1 f2 : ℂ → ℂ} (hTS : T ⊆ S) (hf1 : AnalyticOn ℂ f1 T) (hf2 : AnalyticOn ℂ f2 S) : ++ AnalyticOn ℂ (f1 * f2) T := by ++ exact hf1.mul (hf2.mono hTS) ++ ++lemma lem_analprodTDR (R : ℝ) (f1 f2 : ℂ → ℂ) : ++ (AnalyticOn ℂ f1 {z : ℂ | norm z ≤ R ∧ z ≠ 0}) → ++ (AnalyticOn ℂ f2 (Metric.closedBall 0 R)) → ++ AnalyticOn ℂ (f1 * f2) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by ++ intro hf1 hf2 ++ ++ let T := {z : ℂ | norm z ≤ R ∧ z ≠ 0} ++ ++ have hf2_on_T : AnalyticOn ℂ f2 T := by ++ ++ apply hf2.mono ++ intro z hz ++ ++ simp [Metric.closedBall, dist_zero_right] ++ ++ exact hz.1 ++ ++ exact hf1.mul hf2_on_T ++ ++lemma lem_fzzTanal {R : ℝ} (hR_pos : 0 < R) (f : ℂ → ℂ) ++ (hf : AnalyticOn ℂ f (Metric.closedBall 0 R)) : ++ AnalyticOn ℂ (fun z ↦ f z / z) {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by ++ ++ rw [show (fun z ↦ f z / z) = (fun z ↦ f z) * (fun z ↦ z⁻¹) by ext; simp [div_eq_mul_inv]] ++ ++ let T := {z : ℂ | norm z ≤ R ∧ z ≠ 0} ++ ++ have hf_on_T : AnalyticOn ℂ f T := hf.mono (?_) ++ ++ have h_inv_on_T : AnalyticOn ℂ (fun z ↦ z⁻¹) T := lem_1zanalDR R hR_pos ++ ++ exact lem_analprod hf_on_T h_inv_on_T ++ intro z hz ++ have hT : T = {z | norm z ≤ R ∧ z ≠ 0} := rfl ++ rw [hT] at hz ++ simp only [Set.mem_ofPred_eq] at hz ++ simp only [Metric.mem_closedBall] ++ simp only [dist_zero_right] ++ exact hz.1 ++ ++lemma lem_AnalOntoWithin {V : Set ℂ} {h : ℂ → ℂ} (hh : AnalyticOn ℂ h V) (z : ℂ) (hz : z ∈ V) : ++ AnalyticWithinAt ℂ h V z := by ++ exact hh z hz ++ ++lemma lem_AnalWithintoOn {R : ℝ} (_hR : 0 < R) (h : ℂ → ℂ) : ++ (∀ z ∈ Metric.closedBall 0 R, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) → ++ AnalyticOn ℂ h (Metric.closedBall 0 R) := by ++ exact fun h => h ++ ++lemma lem_DR0T {R : ℝ} (hR : 0 < R) : ++ Metric.closedBall 0 R = {0} ∪ {z : ℂ | norm z ≤ R ∧ z ≠ 0} := by ++ ext z ++ simp [Metric.closedBall, dist_zero_right] ++ by_cases hz : z = 0 ++ · simp [hz, hR.le] ++ · simp [hz] ++ ++lemma lem_analWWWithin {R : ℝ} (hR_pos : 0 < R) (h : ℂ → ℂ) : ++ (AnalyticWithinAt ℂ h (Metric.closedBall 0 R) 0) → ++ (∀ z ∈ {z : ℂ | norm z ≤ R ∧ z ≠ 0}, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) → ++ (∀ z ∈ Metric.closedBall 0 R, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) := by ++ intro h0 hT z hz ++ rw [lem_DR0T hR_pos] at hz ++ cases' hz with hz hz ++ · simp at hz ++ rw [hz] ++ exact h0 ++ · exact hT z hz ++ ++lemma lem_analWWithinAtOn (R : ℝ) (hR_pos : 0 < R) (h : ℂ → ℂ) ++ (h_at_0 : AnalyticWithinAt ℂ h (Metric.closedBall 0 R) 0) ++ (h_at_T : ∀ z ∈ {z : ℂ | norm z ≤ R ∧ z ≠ 0}, AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z) : ++ AnalyticOn ℂ h (Metric.closedBall 0 R) := by ++ exact lem_analWWWithin hR_pos h h_at_0 h_at_T ++ ++lemma lem_AnalAttoWithin {h : ℂ → ℂ} {s : Set ℂ} (hh : AnalyticAt ℂ h 0) : ++ AnalyticWithinAt ℂ h s 0 := by ++ exact hh.analyticWithinAt ++ ++lemma analyticWithinAt_punctured_to_closedBall {R : ℝ} (_hR : 0 < R) {h : ℂ → ℂ} {z : ℂ} (hz : z ∈ {w : ℂ | norm w ≤ R ∧ w ≠ 0}) (h_within : AnalyticWithinAt ℂ h {w : ℂ | norm w ≤ R ∧ w ≠ 0} z) : AnalyticWithinAt ℂ h (Metric.closedBall 0 R) z := by ++ ++ apply AnalyticWithinAt.mono_of_mem_nhdsWithin h_within ++ ++ have hz_ne_zero : z ≠ 0 := hz.2 ++ ++ rw [mem_nhdsWithin_iff_exists_mem_nhds_inter] ++ ++ use Metric.ball z (‖z‖ / 2) ++ ++ constructor ++ · ++ exact Metric.ball_mem_nhds z (half_pos (norm_pos_iff.mpr hz_ne_zero)) ++ ++ · ++ intro w hw ++ constructor ++ · ++ have w_in_closedball : w ∈ Metric.closedBall 0 R := hw.2 ++ simp only [Metric.mem_closedBall, dist_zero_right] at w_in_closedball ++ ++ simp [w_in_closedball] ++ · ++ intro hw_eq_zero ++ have w_in_ball : w ∈ Metric.ball z (‖z‖ / 2) := hw.1 ++ rw [hw_eq_zero] at w_in_ball ++ simp only [Metric.mem_ball] at w_in_ball ++ ++ rw [dist_comm] at w_in_ball ++ simp at w_in_ball ++ have pos_norm : 0 < ‖z‖ := norm_pos_iff.mpr hz_ne_zero ++ linarith [pos_norm] ++ ++lemma lem_analAtOnOn {R : ℝ} (hR_pos : 0 < R) (h : ℂ → ℂ) : ++ AnalyticAt ℂ h 0 → ++ AnalyticOn ℂ h {z : ℂ | norm z ≤ R ∧ z ≠ 0} → ++ AnalyticOn ℂ h (Metric.closedBall 0 R) := by ++ intro h_at_0 h_on_punctured ++ ++ apply lem_analWWithinAtOn R hR_pos h ++ ++ · exact lem_AnalAttoWithin h_at_0 ++ ++ · intro z hz ++ ++ have h_within_punctured : AnalyticWithinAt ℂ h {w : ℂ | norm w ≤ R ∧ w ≠ 0} z := ++ lem_AnalOntoWithin h_on_punctured z hz ++ ++ exact analyticWithinAt_punctured_to_closedBall hR_pos hz h_within_punctured ++ ++lemma lem_orderne0 (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (hf0 : f 0 = 0) : ++ analyticOrderAt f 0 ≠ 0 := by exact (AnalyticAt.analyticOrderAt_ne_zero hf).mpr hf0 ++ ++lemma lem_ordernetop (f : ℂ → ℂ) (_hf : AnalyticAt ℂ f 0) (hf_ne_zero : ¬(∀ᶠ z in nhds 0, f z = 0)) : ++ analyticOrderAt f 0 ≠ ⊤ := by ++ intro h ++ rw [analyticOrderAt_eq_top] at h ++ exact hf_ne_zero h ++ ++lemma lem_ordernatcast (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (n : ℕ) (hn : analyticOrderAt f 0 = n) : ++ ∃ (g : ℂ → ℂ), AnalyticAt ℂ g 0 ∧ g 0 ≠ 0 ∧ ∀ᶠ (z : ℂ) in nhds 0, f z = z ^ n * g z := by ++ ++ rw [AnalyticAt.analyticOrderAt_eq_natCast] at hn ++ · convert hn ++ aesop ++ · exact hf ++ ++lemma lem_ordernatcast1 (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (n : ℕ) (hn : analyticOrderAt f 0 = n) (hn_ne_zero : n ≠ 0) : ++ ∃ (h : ℂ → ℂ), AnalyticAt ℂ h 0 ∧ ∀ᶠ z in nhds 0, f z = z * h z := by ++ ++ rcases lem_ordernatcast f hf n hn with ⟨g, hg_analytic, _, hf_eq_g⟩ ++ ++ use fun z ↦ z ^ (n - 1) * g z ++ constructor ++ · ++ exact (analyticAt_id.pow (n - 1)).mul hg_analytic ++ · ++ filter_upwards [hf_eq_g] with z h_eq ++ rw [h_eq] ++ ring_nf ++ rw [← pow_succ' z (n - 1), Nat.sub_add_cancel (Nat.pos_of_ne_zero hn_ne_zero)] ++ ++lemma lem_ordernatcast2_old (f : ℂ → ℂ) (hf : AnalyticAt ℂ f 0) (hf0 : f 0 = 0) ++ (h_not_eventually_zero : ¬ (∀ᶠ z in nhds 0, f z = 0)) : ++ ∃ (h : ℂ → ℂ), AnalyticAt ℂ h 0 ∧ ∀ᶠ z in nhds 0, f z = z * h z := by ++ ++ let n₀ := analyticOrderAt f 0 ++ ++ have hn_ne_top : n₀ ≠ ⊤ := lem_ordernetop f hf h_not_eventually_zero ++ ++ lift n₀ to ℕ using hn_ne_top with n hn_eq ++ ++ have hn_ne_zero : n ≠ 0 := by ++ intro hn_zero ++ rw [hn_zero] at hn_eq ++ ++ have t := (lem_orderne0 f hf hf0) ++ have : n₀ = analyticOrderAt f 0 := rfl ++ rw [←this] at t ++ exact t (id (Eq.symm hn_eq)) ++ ++ exact lem_ordernatcast1 f hf n (by aesop) hn_ne_zero ++ ++lemma lem_ordernatcast2 {R : ℝ} (hR_pos : 0 < R) (f : ℂ → ℂ) (hf0 : f 0 = 0) ++ (hf : AnalyticOn ℂ f (Metric.closedBall 0 R)) : ++ AnalyticAt ℂ (fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z) 0 := by ++ ++ have hS : Metric.closedBall 0 R ∈ nhds (0 : ℂ) := by ++ ++ refine Filter.mem_of_superset (Metric.ball_mem_nhds (0 : ℂ) hR_pos) ?subset ++ exact Metric.ball_subset_closedBall ++ have hf_within : AnalyticWithinAt ℂ f (Metric.closedBall 0 R) 0 := hf 0 (by ++ simp [Metric.mem_closedBall, hR_pos.le]) ++ have hf_at0 : AnalyticAt ℂ f 0 := analyticWithinAt_to_analyticAt hS hf_within ++ ++ let g : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z ++ ++ by_cases hEZ : (∀ᶠ z in nhds (0 : ℂ), f z = 0) ++ · ++ ++ have hU : {z : ℂ | f z = 0} ∈ nhds (0 : ℂ) := by simpa only [Filter.Eventually] using hEZ ++ ++ have hf_eq_zero : f =ᶠ[nhds (0 : ℂ)] (fun _ : ℂ => 0) := by ++ refine (Filter.eventuallyEq_iff_exists_mem).2 ?_ ++ exact ⟨{z | f z = 0}, hU, by intro z hz; simpa [Set.mem_ofPred_eq] using hz⟩ ++ ++ have h_fderiv_zero : (fderiv ℂ f 0) = 0 := by ++ simpa using (Filter.EventuallyEq.fderiv_eq hf_eq_zero) ++ ++ have h_g_zero_on_U : ∀ z ∈ {z : ℂ | f z = 0}, g z = 0 := by ++ intro z hzU ++ by_cases hz0 : z = 0 ++ · ++ simp [g, hz0, h_fderiv_zero] ++ · ++ have : f z = 0 := by simpa [Set.mem_ofPred_eq] using hzU ++ simp [g, hz0, this] ++ ++ have h_const0_within : AnalyticWithinAt ℂ (fun _ : ℂ => (0 : ℂ)) {z : ℂ | f z = 0} 0 := ++ analyticAt_const.analyticWithinAt ++ have h_g_within : AnalyticWithinAt ℂ g {z : ℂ | f z = 0} 0 := by ++ ++ apply h_const0_within.congr ++ intro z hz ++ by_cases hz0 : z = 0 ++ · ++ simp [g, hz0, h_fderiv_zero] ++ · ++ have : f z = 0 := by simpa [Set.mem_ofPred_eq] using hz ++ simp [g, hz0, this] ++ ++ simp [g, h_fderiv_zero] ++ exact analyticWithinAt_to_analyticAt hU h_g_within ++ ++ · ++ have h_notEZ : ¬ (∀ᶠ z in nhds (0 : ℂ), f z = 0) := hEZ ++ ++ rcases lem_ordernatcast2_old f hf_at0 hf0 h_notEZ with ⟨h0, h0_at0, hfac_ev⟩ ++ ++ have hV : {z : ℂ | f z = z * h0 z} ∈ nhds (0 : ℂ) := by simpa only [Filter.Eventually] using hfac_ev ++ have h_eq_nhds : f =ᶠ[nhds (0 : ℂ)] (fun z => z * h0 z) := ++ (Filter.eventuallyEq_iff_exists_mem).2 ⟨{z : ℂ | f z = z * h0 z}, hV, by ++ intro z hz; simpa [Set.mem_ofPred_eq] using hz⟩ ++ ++ have h_fderiv_prod : fderiv ℂ f 0 = fderiv ℂ (fun z => z * h0 z) 0 := ++ Filter.EventuallyEq.fderiv_eq h_eq_nhds ++ ++ have h_diff_id : DifferentiableAt ℂ (fun z : ℂ => z) 0 := differentiableAt_id ++ have h_diff_h0 : DifferentiableAt ℂ h0 0 := h0_at0.differentiableAt ++ ++ have h_val0 : (fderiv ℂ f 0) 1 = h0 0 := by ++ ++ rw [h_fderiv_prod] ++ rw [fderiv_fun_mul' h_diff_id h_diff_h0] ++ simp only [add_apply, smul_apply] ++ rw [fderiv_fun_id] ++ simp only [ContinuousLinearMap.id_apply] ++ simp only [zero_smul, zero_add] ++ simp ++ ++ have h_geq_h0_on_V : ∀ z ∈ {z : ℂ | f z = z * h0 z}, g z = h0 z := by ++ intro z hzU ++ by_cases hz0 : z = 0 ++ · ++ simpa [g, hz0] using h_val0 ++ · ++ have : f z = z * h0 z := by simpa [Set.mem_ofPred_eq] using hzU ++ simp only [g, ite_eq_right hz0, this] ++ exact mul_div_cancel_left₀ (h0 z) hz0 ++ ++ have h0_within : AnalyticWithinAt ℂ h0 {z : ℂ | f z = z * h0 z} 0 := h0_at0.analyticWithinAt ++ have hg_within : AnalyticWithinAt ℂ g {z : ℂ | f z = z * h0 z} 0 := by ++ ++ apply AnalyticWithinAt.congr h0_within ++ ++ intro z hz ++ exact h_geq_h0_on_V z hz ++ ++ have h_0_in_V : (0 : ℂ) ∈ {z : ℂ | f z = z * h0 z} := by ++ simp [hf0] ++ exact h_geq_h0_on_V 0 h_0_in_V ++ exact analyticWithinAt_to_analyticAt hV hg_within ++ ++theorem ex (x : ℂ) {r : ℝ} (hr : r > 0) : ++ closure (Metric.ball x r) = Metric.closedBall x r := by ++ exact closure_ball x (by linarith [hr]) ++ ++lemma lem_ballDR (R : ℝ) (hR : R > 0) : closure (ballDR R) = Metric.closedBall (0 : ℂ) R := by ++ unfold ballDR ++ exact closure_ball 0 (ne_of_gt hR) ++ ++lemma lem_inDR (R : ℝ) (hR : R > 0) (w : ℂ) (hw : w ∈ closure (ballDR R)) : norm w ≤ R := by ++ rw [lem_ballDR R hR] at hw ++ rw [Metric.mem_closedBall] at hw ++ rw [Complex.dist_eq] at hw ++ simp at hw ++ exact hw ++ ++lemma lem_notinDR (R : ℝ) (_hR : R > 0) (w : ℂ) (hw : w ∉ ballDR R) : norm w ≥ R := by ++ ++ unfold ballDR at hw ++ ++ rw [Metric.mem_ball] at hw ++ ++ push Not at hw ++ ++ rw [Complex.dist_eq] at hw ++ ++ simp at hw ++ exact hw ++ ++lemma lem_legeR (R : ℝ) (_hR : R > 0) (w : ℂ) (hw1 : norm w ≤ R) (hw2 : norm w ≥ R) : norm w = R := by ++ linarith ++ ++lemma lem_circleDR (R : ℝ) (hR : R > 0) (w : ℂ) (hw1 : w ∈ closure (ballDR R)) (hw2 : w ∉ ballDR R) : norm w = R := by ++ have h1 : norm w ≤ R := lem_inDR R hR w hw1 ++ have h2 : norm w ≥ R := lem_notinDR R hR w hw2 ++ exact lem_legeR R hR w h1 h2 ++ ++lemma lem_Rself (R : ℝ) (hR : R > 0) : |R| = R := by ++ rw [abs_eq_self] ++ linarith ++ ++lemma lem_Rself2 (R : ℝ) (hR : R > 0) : |R| ≤ R := by ++ rw [lem_Rself R hR] ++ ++lemma lem_Rself3 (R : ℝ) (hR : R > 0) : (R : ℂ) ∈ closure (ballDR R) := by ++ rw [lem_ballDR R hR] ++ rw [Metric.mem_closedBall] ++ simp ++ exact lem_Rself2 R hR ++ ++lemma lem_DRcompact (R : ℝ) (hR : R > 0) : IsCompact (closure (ballDR R)) := by ++ rw [lem_ballDR R hR] ++ apply Metric.isCompact_of_isClosed_isBounded ++ · exact Metric.isClosed_closedBall ++ · exact Metric.isBounded_closedBall ++ ++lemma lem_ExtrValThm {K : Set ℂ} (hK : IsCompact K) (hK_nonempty : K.Nonempty) (g : K → ℂ) (hg : Continuous g) : ++∃ v : K, ∀ z : K, norm (g z) ≤ norm (g v) := by ++ ++ have : CompactSpace K := isCompact_iff_compactSpace.mp hK ++ ++ have : Nonempty K := hK_nonempty.to_subtype ++ ++ let f : K → ℝ := fun z => norm (g z) ++ ++ have hf_cont : Continuous f := continuous_norm.comp hg ++ ++ obtain ⟨v, hv_mem, hv_max⟩ := IsCompact.exists_isMaxOn isCompact_univ Set.univ_nonempty hf_cont.continuousOn ++ use v ++ intro z ++ exact hv_max (Set.mem_univ z) ++ ++lemma lem_ExtrValThmDR (R : ℝ) (hR : R > 0) (g : closure (ballDR R) → ℂ) (hg : Continuous g) : ++∃ v : closure (ballDR R), ∀ z : closure (ballDR R), norm (g z) ≤ norm (g v) := by ++ ++ have hK_compact : IsCompact (closure (ballDR R)) := lem_DRcompact R hR ++ ++ have hK_nonempty : (closure (ballDR R)).Nonempty := by ++ rw [lem_ballDR R hR] ++ rw [Metric.nonempty_closedBall] ++ linarith ++ ++ exact lem_ExtrValThm hK_compact hK_nonempty g hg ++ ++lemma lem_AnalCont {R : ℝ} (_hR : R > 0) (H : ℂ → ℂ) (h_analytic : AnalyticOn ℂ H (closure (ballDR R))) : ++Continuous (H ∘ (Subtype.val : closure (ballDR R) → ℂ)) := by ++ ++ have h_cont_on : ContinuousOn H (closure (ballDR R)) := AnalyticOn.continuousOn h_analytic ++ ++ have h_val_cont : Continuous (Subtype.val : closure (ballDR R) → ℂ) := continuous_subtype_val ++ ++ exact ContinuousOn.comp_continuous h_cont_on h_val_cont (fun _ => Subtype.mem _) ++ ++lemma lem_ExtrValThmh {R : ℝ} (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : ++∃ u : closure (ballDR R), ∀ z : closure (ballDR R), norm (h u) ≥ norm (h z) := by ++ ++ have hg_continuous : Continuous (h ∘ Subtype.val : closure (ballDR R) → ℂ) := ++ lem_AnalCont hR h h_analytic ++ ++ obtain ⟨v, hv⟩ := lem_ExtrValThmDR R hR (h ∘ Subtype.val) hg_continuous ++ ++ use v ++ ++ intro z ++ have : norm ((h ∘ Subtype.val) z) ≤ norm ((h ∘ Subtype.val) v) := hv z ++ ++ simp [Function.comp] at this ++ exact this ++ ++lemma lem_MaxModP (R : ℝ) (_hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : ∀ z ∈ closure (ballDR R), norm (h z) = norm (h w) := by ++ ++ have h_preconnected : IsPreconnected (ballDR R) := by ++ unfold ballDR ++ apply Convex.isPreconnected ++ exact convex_ball (0 : ℂ) R ++ ++ have h_open : IsOpen (ballDR R) := by ++ unfold ballDR ++ exact Metric.isOpen_ball ++ ++ have h_diff_cont : DiffContOnCl ℂ h (ballDR R) := by ++ constructor ++ · ++ apply AnalyticOn.differentiableOn ++ exact h_analytic.mono subset_closure ++ · ++ exact AnalyticOn.continuousOn h_analytic ++ ++ have h_max_on : IsMaxOn (norm ∘ h) (ballDR R) w := by ++ intro z hz ++ change ‖h z‖ ≤ ‖h w‖ ++ exact hw_max z hz ++ ++ have h_eq := Complex.norm_eqOn_closure_of_isPreconnected_of_isMaxOn h_preconnected h_open h_diff_cont hw_in_DR h_max_on ++ ++ intro z hz ++ have norm_eq := h_eq hz ++ simp only [Function.comp_apply, Function.const_apply] at norm_eq ++ ++ convert norm_eq ++ ++lemma lem_MaxModR (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : norm (h R) = norm (h w) := by ++ ++ have h_const : ∀ z ∈ closure (ballDR R), norm (h z) = norm (h w) := ++ lem_MaxModP R hR h h_analytic w hw_in_DR hw_max ++ ++ have hR_in_closure : (R : ℂ) ∈ closure (ballDR R) := lem_Rself3 R hR ++ ++ exact h_const (R : ℂ) hR_in_closure ++ ++lemma lem_MaxModRR (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) ++ (w : ℂ) (hw_in_DR : w ∈ ballDR R) (hw_max : ∀ z ∈ ballDR R, norm (h z) ≤ norm (h w)) : ++∀ z ∈ closure (ballDR R), norm (h R) ≥ norm (h z) := by ++ intro z hz ++ ++ have h1 := lem_MaxModP R hR h h_analytic w hw_in_DR hw_max z hz ++ ++ have h2 := lem_MaxModR R hR h h_analytic w hw_in_DR hw_max ++ ++ rw [h2, h1] ++ ++theorem lem_MaxModv2 (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : ++∃ v : closure (ballDR R), norm (v : ℂ) = R ∧ ∀ z : closure (ballDR R), norm (h (v : ℂ)) ≥ norm (h (z : ℂ)) := by ++ ++ obtain ⟨u, hu⟩ := lem_ExtrValThmh hR h h_analytic ++ ++ if h_case : (u : ℂ) ∈ ballDR R then ++ ++ have hR_in_closure : (R : ℂ) ∈ closure (ballDR R) := lem_Rself3 R hR ++ let v : closure (ballDR R) := ⟨R, hR_in_closure⟩ ++ use v ++ constructor ++ · ++ ++ have v_eq : (v : ℂ) = (R : ℂ) := rfl ++ rw [v_eq] ++ ++ have : norm (R : ℂ) = abs R := by ++ simp [Complex.norm_real] ++ rw [this, lem_Rself R hR] ++ · ++ intro z ++ ++ have hw_max : ∀ w ∈ ballDR R, norm (h w) ≤ norm (h (u : ℂ)) := by ++ intro w hw ++ ++ have hw_closure : w ∈ closure (ballDR R) := subset_closure hw ++ ++ let w_sub : closure (ballDR R) := ⟨w, hw_closure⟩ ++ exact hu w_sub ++ ++ have h_result := lem_MaxModRR R hR h h_analytic (u : ℂ) h_case hw_max ++ ++ have v_eq : (v : ℂ) = (R : ℂ) := rfl ++ rw [v_eq] ++ ++ exact h_result (z : ℂ) (Subtype.mem z) ++ else ++ ++ use u ++ constructor ++ · ++ exact lem_circleDR R hR (u : ℂ) (Subtype.mem u) h_case ++ · ++ exact hu ++ ++theorem lem_MaxModv3 (R : ℝ) (hR : R > 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : ++∃ v : ℂ, norm v = R ∧ ∀ z : ℂ, z ∈ closure (ballDR R) → norm (h v) ≥ norm (h z) := by ++ ++ obtain ⟨v_sub, hv_abs, hv_max⟩ := lem_MaxModv2 R hR h h_analytic ++ ++ let v := (v_sub : ℂ) ++ use v ++ constructor ++ · ++ exact hv_abs ++ · ++ intro z hz ++ ++ have hz_sub : z ∈ closure (ballDR R) := hz ++ let z_sub : closure (ballDR R) := ⟨z, hz_sub⟩ ++ have := hv_max z_sub ++ ++ simp at this ++ exact this ++ ++lemma lem_MaxModv4 (R B : ℝ) (hR : R > 0) (_hB : B ≥ 0) ++ (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) ++ (h_boundary_bound : ∀ z : ℂ, norm z = R → norm (h z) ≤ B) : ++∃ v : ℂ, norm v = R ∧ (∀ w : ℂ, w ∈ closure (ballDR R) → norm (h v) ≥ norm (h w)) ∧ norm (h v) ≤ B := by ++ ++ obtain ⟨v, hv_abs, hv_max⟩ := lem_MaxModv3 R hR h h_analytic ++ ++ use v ++ constructor ++ · ++ exact hv_abs ++ constructor ++ · ++ exact hv_max ++ · ++ apply h_boundary_bound ++ exact hv_abs ++ ++lemma lem_HardMMP (R B : ℝ) (hR : R > 0) (hB : B ≥ 0) ++ (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) ++ (h_boundary_bound : ∀ z : ℂ, norm z = R → norm (h z) ≤ B) : ++∀ w : ℂ, w ∈ closure (ballDR R) → norm (h w) ≤ B := by ++ intro w hw ++ ++ obtain ⟨v, hv_abs, hv_max, hv_bound⟩ := lem_MaxModv4 R B hR hB h h_analytic h_boundary_bound ++ ++ have h1 : norm (h w) ≤ norm (h v) := hv_max w hw ++ have h2 : norm (h v) ≤ B := hv_bound ++ ++ linarith [h1, h2] ++ ++lemma lem_EasyMMP (R B : ℝ) (hR : R > 0) (_hB : B ≥ 0) ++ (h : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ h (closure (ballDR R))) ++ (h_closure_bound : ∀ w : ℂ, w ∈ closure (ballDR R) → norm (h w) ≤ B) : ++∀ z : ℂ, norm z = R → norm (h z) ≤ B := by ++ intro z hz ++ ++ apply h_closure_bound z ++ ++ rw [lem_ballDR R hR] ++ rw [Metric.mem_closedBall] ++ rw [Complex.dist_eq] ++ simp ++ ++ have : ‖z‖ = R := hz ++ linarith ++ ++theorem lem_MMP (R B : ℝ) (hR : R > 0) (hB : B ≥ 0) (h : ℂ → ℂ) (h_analytic : AnalyticOn ℂ h (closure (ballDR R))) : ++(∀ z : ℂ, z ∈ closure (ballDR R) → norm (h z) ≤ B) ↔ (∀ z : ℂ, norm z = R → norm (h z) ≤ B) := by ++ constructor ++ · ++ intro h_closure_bound ++ exact lem_EasyMMP R B hR hB h h_analytic h_closure_bound ++ · ++ intro h_boundary_bound ++ exact lem_HardMMP R B hR hB h h_analytic h_boundary_bound ++ ++lemma lem_denominator_nonzero (R M : ℝ) (_hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : ++∀ z : ℂ, z ∈ closure (ballDR R) → (2 * M - f z) ≠ 0 := by ++ intro z hz ++ ++ apply lem_real_part_lower_bound4 (f z) M hM ++ ++ exact h_re_bound z hz ++ ++lemma lem_f_vs_2M_minus_f (R M : ℝ) (_hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : ++∀ z : ℂ, z ∈ closure (ballDR R) → norm (f z) / norm (2 * M - f z) ≤ 1 := by ++ intro z hz ++ ++ apply lem_nonnegative_product9 M (f z) hM ++ ++ exact h_re_bound z hz ++ ++lemma fderiv_factorization_at_zero (R : ℝ) (hR : R > 0) (f h : ℂ → ℂ) ++ (h_analytic_f : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_analytic_h : AnalyticOn ℂ h (closure (ballDR R))) ++ (_h_zero : f 0 = 0) ++ (h_factor : ∀ z ∈ closure (ballDR R), f z = z * h z) : ++ (fderiv ℂ f 0) 1 = h 0 := by ++ ++ have h_zero_in : (0 : ℂ) ∈ closure (ballDR R) := by ++ rw [lem_ballDR R hR] ++ rw [Metric.mem_closedBall] ++ simp ++ linarith [hR] ++ ++ have h_diff_on_f : DifferentiableOn ℂ f (closure (ballDR R)) := h_analytic_f.differentiableOn ++ have h_diff_on_h : DifferentiableOn ℂ h (closure (ballDR R)) := h_analytic_h.differentiableOn ++ ++ have h_nhds_mem : closure (ballDR R) ∈ nhds (0 : ℂ) := by ++ rw [lem_ballDR R hR] ++ rw [mem_nhds_iff] ++ use Metric.ball 0 R ++ constructor ++ · exact Metric.ball_subset_closedBall ++ constructor ++ · exact Metric.isOpen_ball ++ · rw [Metric.mem_ball] ++ simp ++ exact hR ++ ++ have h_diff_f : DifferentiableAt ℂ f 0 := h_diff_on_f.differentiableAt h_nhds_mem ++ have h_diff_h : DifferentiableAt ℂ h 0 := h_diff_on_h.differentiableAt h_nhds_mem ++ ++ have h_diff_id : DifferentiableAt ℂ (fun z : ℂ => z) 0 := differentiableAt_id ++ ++ have h_eq_nhds : f =ᶠ[nhds 0] (fun z => z * h z) := by ++ rw [Filter.eventuallyEq_iff_exists_mem] ++ exact ⟨closure (ballDR R), h_nhds_mem, h_factor⟩ ++ ++ have h_fderiv_eq : fderiv ℂ f 0 = fderiv ℂ (fun z => z * h z) 0 := ++ Filter.EventuallyEq.fderiv_eq h_eq_nhds ++ ++ rw [h_fderiv_eq] ++ rw [fderiv_fun_mul' h_diff_id h_diff_h] ++ ++ simp only [add_apply, smul_apply] ++ rw [fderiv_fun_id] ++ simp only [ContinuousLinearMap.id_apply] ++ ++ simp only [zero_smul, zero_add] ++ ++ simp ++ ++lemma lem_removable_singularity (R : ℝ) (hR : R > 0) (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) (h_zero : f 0 = 0) : ++AnalyticOn ℂ (fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z) (closure (ballDR R)) := by ++ ++ rw [lem_ballDR R hR] at h_analytic ⊢ ++ ++ let g : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z ++ ++ apply lem_analAtOnOn hR g ++ ++ · ++ ++ exact lem_ordernatcast2 hR f h_zero h_analytic ++ ++ · ++ ++ have f_on_closedball : AnalyticOn ℂ f (Metric.closedBall 0 R) := h_analytic ++ have quotient_analytic : AnalyticOn ℂ (fun z ↦ f z / z) {z : ℂ | ‖z‖ ≤ R ∧ z ≠ 0} := ++ lem_fzzTanal hR f f_on_closedball ++ ++ apply AnalyticOn.congr quotient_analytic ++ intro z hz ++ ++ simp [g, ite_eq_right hz.2] ++ ++lemma lem_quotient_analytic {R : ℝ} (_hR : R > 0) (h1 h2 : ℂ → ℂ) ++ (h_analytic1 : AnalyticOn ℂ h1 (closure (ballDR R))) ++ (h_analytic2 : AnalyticOn ℂ h2 (closure (ballDR R))) ++ (h_nonzero : ∀ z ∈ closure (ballDR R), h2 z ≠ 0) : ++AnalyticOn ℂ (fun z ↦ h1 z / h2 z) (closure (ballDR R)) := by ++ exact AnalyticOn.div h_analytic1 h_analytic2 h_nonzero ++ ++noncomputable def f_M (R M : ℝ) (_hR : R > 0) (_hM : M > 0) ++ (f : ℂ → ℂ) ++ (_h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (_h_zero : f 0 = 0) ++ (_h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : ++ℂ → ℂ := fun z ↦ (if z = 0 then (fderiv ℂ f 0) 1 else f z / z) / (2 * M - f z) ++ ++lemma lem_g_analytic (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : ++AnalyticOn ℂ (f_M R M hR hM f h_analytic h_zero h_re_bound) (closure (ballDR R)) := by ++ ++ let h₁ : ℂ → ℂ := fun z ↦ if z = 0 then (fderiv ℂ f 0) 1 else f z / z ++ ++ let h₂ : ℂ → ℂ := fun z ↦ 2 * M - f z ++ ++ have h_eq : f_M R M hR hM f h_analytic h_zero h_re_bound = fun z ↦ h₁ z / h₂ z := by ++ ext z ++ unfold f_M h₁ h₂ ++ simp ++ ++ rw [h_eq] ++ ++ apply lem_quotient_analytic hR ++ ++ · exact lem_removable_singularity R hR f h_analytic h_zero ++ ++ · have h₂_analytic : AnalyticOn ℂ h₂ (closure (ballDR R)) := by ++ unfold h₂ ++ apply AnalyticOn.sub ++ · exact analyticOn_const ++ · exact h_analytic ++ exact h₂_analytic ++ ++ · intro z hz ++ unfold h₂ ++ exact lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz ++ ++lemma lem_absab (a b : ℂ) (_hb : b ≠ 0) : norm (a / b) = norm a / norm b := by ++ exact IsAbsoluteValue.abv_div norm a b ++ ++lemma lem_g_on_boundaryz (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (z : ℂ) (hz_in_closure : z ∈ closure (ballDR R)) (hz_nonzero : z ≠ 0) : ++ norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = ++norm (f z / z) / norm (2 * M - f z) := by ++ ++ unfold f_M ++ ++ simp only [ite_eq_right hz_nonzero] ++ ++ have h_nonzero : (2 * M - f z) ≠ 0 := lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz_in_closure ++ ++ exact lem_absab (f z / z) (2 * M - f z) h_nonzero ++ ++lemma lem_fzzR (R : ℝ) (hR : R > 0) (z w : ℂ) (hz : norm z = R) : norm (w / z) = norm w / R := by ++ ++ have hz_nonzero : z ≠ 0 := by ++ intro h_eq ++ rw [h_eq] at hz ++ simp at hz ++ linarith [hz, hR] ++ ++ rw [lem_absab w z hz_nonzero] ++ ++ rw [hz] ++ ++lemma lem_g_on_boundary (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (z : ℂ) (hz_on_boundary : norm z = R) : ++ norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = ++(norm (f z) / R) / norm (2 * M - f z) := by ++ ++ have hz_nonzero : z ≠ 0 := by ++ intro h_eq ++ rw [h_eq] at hz_on_boundary ++ simp at hz_on_boundary ++ linarith [hz_on_boundary, hR] ++ ++ have hz_in_closure : z ∈ closure (ballDR R) := by ++ rw [lem_ballDR R hR] ++ rw [Metric.mem_closedBall] ++ rw [Complex.dist_eq] ++ simp ++ convert le_of_eq hz_on_boundary ++ ++ have h1 : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = ++ norm (f z / z) / norm (2 * M - f z) := ++ lem_g_on_boundaryz R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure hz_nonzero ++ ++ have h2 : norm (f z / z) = norm (f z) / R := ++ lem_fzzR R hR z (f z) hz_on_boundary ++ ++ rw [h1, h2] ++ ++lemma lem_f_vs_2M_minus_fR (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (_h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (z : ℂ) (hz_in_closure : z ∈ closure (ballDR R)) : ++(norm (f z) / R) / norm (2 * M - f z) ≤ 1 / R := by ++ ++ have h1 : norm (f z) / norm (2 * M - f z) ≤ 1 := ++ lem_f_vs_2M_minus_f R M hR hM f h_analytic h_re_bound z hz_in_closure ++ ++ rw [div_div] ++ ++ rw [mul_comm R] ++ ++ rw [← div_div] ++ ++ exact div_le_div_of_nonneg_right h1 (le_of_lt hR) ++ ++lemma lem_g_boundary_bound0 (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (z : ℂ) (hz_on_boundary : norm z = R) : ++norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := by ++ ++ have hz_in_closure : z ∈ closure (ballDR R) := by ++ rw [lem_ballDR R hR] ++ rw [Metric.mem_closedBall] ++ rw [Complex.dist_eq] ++ simp ++ convert le_of_eq hz_on_boundary ++ ++ rw [lem_g_on_boundary R M hR hM f h_analytic h_zero h_re_bound z hz_on_boundary] ++ ++ exact lem_f_vs_2M_minus_fR R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure ++ ++lemma lem_g_interior_bound (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) : ++∀ z : ℂ, z ∈ closure (ballDR R) → norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := by ++ ++ have hB : (1 / R : ℝ) ≥ 0 := div_nonneg zero_le_one (le_of_lt hR) ++ ++ have h_g_analytic : AnalyticOn ℂ (f_M R M hR hM f h_analytic h_zero h_re_bound) (closure (ballDR R)) := ++ lem_g_analytic R M hR hM f h_analytic h_zero h_re_bound ++ ++ apply (lem_MMP R (1 / R) hR hB (f_M R M hR hM f h_analytic h_zero h_re_bound) h_g_analytic).mpr ++ ++ intro z hz_boundary ++ exact lem_g_boundary_bound0 R M hR hM f h_analytic h_zero h_re_bound z hz_boundary ++ ++lemma lem_g_at_r (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) ++ (z : ℂ) (hz_on_boundary : norm z = r) : ++ norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = ++(norm (f z) / r) / norm (2 * M - f z) := by ++ ++ have hz_nonzero : z ≠ 0 := by ++ intro h_eq ++ rw [h_eq] at hz_on_boundary ++ simp at hz_on_boundary ++ linarith [hz_on_boundary, hr_pos] ++ ++ have hz_in_closure : z ∈ closure (ballDR R) := by ++ rw [lem_ballDR R hR] ++ rw [Metric.mem_closedBall] ++ rw [Complex.dist_eq] ++ simp ++ linarith [hz_on_boundary, hr_lt_R] ++ ++ have h1 : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = ++ norm (f z / z) / norm (2 * M - f z) := ++ lem_g_on_boundaryz R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure hz_nonzero ++ ++ have h2 : norm (f z / z) = norm (f z) / r := ++ lem_fzzR r hr_pos z (f z) hz_on_boundary ++ ++ rw [h1, h2] ++ ++lemma lem_g_at_rR (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) ++ (z : ℂ) (hz_on_boundary : norm z = r) : ++(norm (f z) / r) / norm (2 * M - f z) ≤ 1 / R := by ++ ++ have hz_in_closure : z ∈ closure (ballDR R) := by ++ rw [lem_ballDR R hR] ++ rw [Metric.mem_closedBall] ++ rw [Complex.dist_eq] ++ simp ++ linarith [hz_on_boundary, hr_lt_R] ++ ++ have h_bound : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) ≤ 1 / R := ++ lem_g_interior_bound R M hR hM f h_analytic h_zero h_re_bound z hz_in_closure ++ ++ have h_eq : norm (f_M R M hR hM f h_analytic h_zero h_re_bound z) = ++ (norm (f z) / r) / norm (2 * M - f z) := ++ lem_g_at_r R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary ++ ++ rw [← h_eq] ++ exact h_bound ++ ++lemma lem_fracs (a b r R : ℝ) (ha : a > 0) (hb : b > 0) (hr : r > 0) (hR : R > 0) ++(h_le : (a / r) / b ≤ 1 / R) : R * a ≤ r * b := by ++ ++ have h1 : (a / r) / b = a / (r * b) := by ++ field_simp ++ rw [h1] at h_le ++ ++ have h_pos_rb : 0 < r * b := mul_pos hr hb ++ rw [div_le_div_iff₀ h_pos_rb hR] at h_le ++ ++ simp only [one_mul] at h_le ++ ++ linarith ++ ++lemma lem_nonneg_product_with_real_abs (r M : ℝ) (hr : r > 0) (hM : M > 0) : 0 ≤ r * (2 * |M|) := by ++ ++ have h_abs_eq : |M| = M := abs_of_pos hM ++ ++ rw [h_abs_eq] ++ ++ have h_two_M_pos : (2 : ℝ) * M > 0 := by ++ apply mul_pos ++ norm_num ++ exact hM ++ ++ apply mul_nonneg ++ linarith [hr] ++ linarith [h_two_M_pos] ++ ++lemma lem_f_bound_rearranged (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) ++ (z : ℂ) (hz_on_boundary : norm z = r) : ++R * norm (f z) ≤ r * norm (2 * M - f z) := by ++ ++ have hz_in_closure : z ∈ closure (ballDR R) := by ++ rw [lem_ballDR R hR] ++ rw [Metric.mem_closedBall] ++ rw [Complex.dist_eq] ++ simp ++ linarith [hz_on_boundary, hr_lt_R] ++ ++ have h_ineq : (norm (f z) / r) / norm (2 * M - f z) ≤ 1 / R := ++ lem_g_at_rR R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary ++ ++ have h_denom_nonzero : (2 * M - f z) ≠ 0 := ++ lem_denominator_nonzero R M hR hM f h_analytic h_re_bound z hz_in_closure ++ ++ have h_denom_pos : norm (2 * M - f z) > 0 := ++ lem_abspos (2 * M - f z) h_denom_nonzero ++ ++ by_cases h_case : f z = 0 ++ · ++ rw [h_case] ++ simp [mul_zero] ++ exact lem_nonneg_product_with_real_abs r M hr_pos hM ++ · ++ have h_num_pos : norm (f z) > 0 := ++ lem_abspos (f z) h_case ++ ++ exact lem_fracs (norm (f z)) (norm (2 * M - f z)) r R ++ h_num_pos h_denom_pos hr_pos hR h_ineq ++ ++lemma lem_final_bound_on_circle0 (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) ++ (z : ℂ) (hz_on_boundary : norm z = r) : ++norm (f z) ≤ (2 * r / (R - r)) * M := by ++ ++ have h_ineq : R * norm (f z) ≤ r * norm (2 * M - f z) := ++ lem_f_bound_rearranged R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary ++ ++ have h_bound : norm (f z) ≤ (2 * M * r) / (R - r) := ++ lem_rtriangle7 r R M (f z) hr_pos hr_lt_R hM h_ineq ++ ++ have h_rearrange : (2 * M * r) / (R - r) = (2 * r / (R - r)) * M := by ++ field_simp ++ ++ rw [← h_rearrange] ++ exact h_bound ++ ++lemma lem_final_bound_on_circle (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) ++ (z : ℂ) (hz_on_boundary : norm z = r) : ++norm (f z) ≤ (2 * r / (R - r)) * M := by ++ exact lem_final_bound_on_circle0 R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_on_boundary ++ ++lemma lem_BCI (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) ++ (z : ℂ) (hz_in_ball : norm z ≤ r) : ++norm (f z) ≤ (2 * r / (R - r)) * M := by ++ ++ let B := (2 * r / (R - r)) * M ++ ++ have hB : B ≥ 0 := by ++ unfold B ++ apply mul_nonneg ++ · apply div_nonneg ++ · apply mul_nonneg ++ · norm_num ++ · linarith [hr_pos] ++ · linarith [hr_lt_R] ++ · linarith [hM] ++ ++ have h_analytic_r : AnalyticOn ℂ f (closure (ballDR r)) := by ++ apply AnalyticOn.mono h_analytic ++ ++ apply closure_mono ++ unfold ballDR ++ exact Metric.ball_subset_ball (le_of_lt hr_lt_R) ++ ++ have hz_in_closure_r : z ∈ closure (ballDR r) := by ++ rw [lem_ballDR r hr_pos] ++ rw [Metric.mem_closedBall] ++ rw [Complex.dist_eq] ++ simp ++ exact hz_in_ball ++ ++ have h_boundary : ∀ w : ℂ, norm w = r → norm (f w) ≤ B := by ++ intro w hw_boundary ++ exact lem_final_bound_on_circle R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R w hw_boundary ++ ++ have h_closure := (lem_MMP r B hr_pos hB f h_analytic_r).mpr h_boundary ++ ++ exact h_closure z hz_in_closure_r ++ ++theorem thm_BorelCaratheodoryI (R M : ℝ) (hR : R > 0) (hM : M > 0) ++ (f : ℂ → ℂ) ++ (h_analytic : AnalyticOn ℂ f (closure (ballDR R))) ++ (h_zero : f 0 = 0) ++ (h_re_bound : ∀ z : ℂ, z ∈ closure (ballDR R) → Complex.re (f z) ≤ M) ++ (r : ℝ) (hr_pos : r > 0) (hr_lt_R : r < R) : ++sSup ((norm ∘ f) '' (closure (ballDR r))) ≤ (2 * r / (R - r)) * M := by ++ ++ apply Real.sSup_le ++ · ++ intro x hx ++ ++ obtain ⟨z, hz_in_closure, hx_eq⟩ := hx ++ rw [← hx_eq] ++ ++ have hz_bound : norm z ≤ r := by ++ rw [lem_ballDR r hr_pos] at hz_in_closure ++ rw [Metric.mem_closedBall] at hz_in_closure ++ rw [Complex.dist_eq] at hz_in_closure ++ simp at hz_in_closure ++ exact hz_in_closure ++ ++ exact lem_BCI R M hR hM f h_analytic h_zero h_re_bound r hr_pos hr_lt_R z hz_bound ++ · ++ apply mul_nonneg ++ · apply div_nonneg ++ · apply mul_nonneg ++ · norm_num ++ · linarith [hr_pos] ++ · linarith [hr_lt_R] ++ · linarith [hM] ++ ++def I := Complex.I ++ ++lemma cauchy_formula_deriv {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (_h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++deriv f z = (1 / (2 * Real.pi * I)) • ∮ w in C(0, r_int), (w - z)⁻¹ ^ 2 • f w := by ++ ++ obtain ⟨U', hU'_open, h_subset, hf_diff_U'⟩ := hf_domain ++ ++ have hz_in_ball : z ∈ Metric.ball (0 : ℂ) r_int := by ++ apply Metric.mem_ball.mpr ++ have h1 : ‖z - 0‖ ≤ r_z := by simpa only [dist_eq_norm] using Metric.mem_closedBall.mp hz ++ simp only [sub_zero] at h1 ++ have h2 : ‖z‖ < r_int := lt_of_le_of_lt h1 h_r_z_lt_r_int ++ rwa [dist_eq_norm, sub_zero] ++ ++ set U := Metric.ball (0 : ℂ) R_analytic ++ ++ have hc_subset : Metric.closedBall (0 : ℂ) r_int ⊆ U := by ++ apply Metric.closedBall_subset_ball ++ exact h_r_int_lt_R_analytic ++ ++ have hf_on_U : DifferentiableOn ℂ f U := by ++ ++ apply DifferentiableOn.mono hf_diff_U' ++ calc U = Metric.ball 0 R_analytic := rfl ++ _ ⊆ Metric.closedBall 0 R_analytic := Metric.ball_subset_closedBall ++ _ ⊆ U' := h_subset ++ ++ have cauchy_eq := Complex.two_pi_I_inv_smul_circleIntegral_sub_sq_inv_smul_of_differentiable ++ Metric.isOpen_ball hc_subset hf_on_U hz_in_ball ++ ++ rw [← cauchy_eq] ++ ++ congr 2 ++ · ++ simp only [one_div] ++ ++ rfl ++ · ++ ext w ++ rw [← inv_pow] ++ ++lemma lem_dw_dt {r_int : ℝ} (t : ℝ) : ++deriv (fun t' => r_int * Complex.exp (I * t')) t = I * r_int * Complex.exp (I * t) := by ++ ++ rw [deriv_const_mul] ++ ++ rw [deriv_cexp] ++ ++ rw [deriv_const_mul] ++ ++ convert_to r_int * (Complex.exp (I * t) * (I * 1)) = I * r_int * Complex.exp (I * t) ++ · ++ rw [← deriv_id] ++ congr ++ ++ ring ++ ++ · exact differentiableAt_id ++ · exact (differentiableAt_const I).mul differentiableAt_id ++ · exact DifferentiableAt.cexp ((differentiableAt_const I).mul differentiableAt_id) ++ ++lemma circleMap_zero_eq_exp (r : ℝ) (t : ℝ) : circleMap 0 r t = r * Complex.exp (I * t) := by ++ ++ rw [circleMap] ++ ++ simp only [zero_add] ++ ++ congr 2 ++ rw [mul_comm (t : ℂ) Complex.I] ++ ++ rfl ++ ++lemma deriv_ofReal_eq_one (t : ℝ) : deriv Complex.ofReal t = 1 := by ++ ++ have h : deriv Complex.ofReal t = Complex.ofReal 1 := by ++ ++ rw [show Complex.ofReal = ⇑Complex.ofRealCLM from rfl] ++ exact ContinuousLinearMap.deriv Complex.ofRealCLM ++ ++ rw [h] ++ simp only [Complex.ofReal_one] ++ ++lemma differentiableAt_ofReal (t : ℝ) : DifferentiableAt ℝ Complex.ofReal t := by ++ ++ rw [show Complex.ofReal = ⇑Complex.ofRealCLM from rfl] ++ ++ apply ContinuousLinearMap.differentiableAt ++ ++lemma lem_dw_dt_real {r_int : ℝ} (t : ℝ) : ++deriv (fun (t' : ℝ) => r_int * Complex.exp (I * t')) t = I * r_int * Complex.exp (I * t) := by ++ ++ rw [deriv_const_mul] ++ ++ rw [deriv_cexp] ++ ++ rw [deriv_const_mul] ++ ++ rw [deriv_ofReal_eq_one] ++ ++ ring ++ ++ · exact differentiableAt_ofReal t ++ · exact (differentiableAt_const I).mul (differentiableAt_ofReal t) ++ · exact DifferentiableAt.cexp ((differentiableAt_const I).mul (differentiableAt_ofReal t)) ++ ++lemma deriv_circleMap_zero (r : ℝ) (t : ℝ) : deriv (circleMap 0 r) t = I * r * Complex.exp (I * t) := by ++ ++ have h : circleMap 0 r = fun (t' : ℝ) => r * Complex.exp (I * t') := by ++ ext t' ++ exact circleMap_zero_eq_exp r t' ++ ++ rw [h] ++ ++ exact lem_dw_dt_real t ++ ++lemma lem_CIF_deriv_param {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ deriv f z = (1 / (2 * Real.pi * I)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), ++(I * r_int * Complex.exp (I * t) * ((r_int * Complex.exp (I * t)) - z)⁻¹ ^ 2) * f (r_int * Complex.exp (I * t))) := by ++ ++ rw [cauchy_formula_deriv hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] ++ ++ rw [circleIntegral_def_Icc] ++ ++ rw [smul_eq_mul] ++ ++ simp only [circleMap_zero_eq_exp, deriv_circleMap_zero] ++ ++ congr 2 ++ ext t ++ simp only [smul_eq_mul] ++ ring ++ ++lemma mul_comm_div_cancel (a b : ℂ) (ha : a ≠ 0) (hb : b ≠ 0) : a * b / (b * a) = 1 := by ++ ++ rw [mul_comm b a] ++ ++ apply div_self ++ ++ exact mul_ne_zero ha hb ++ ++lemma complex_coeff_I_cancel : (1 : ℂ) / (2 * Real.pi * I) * I = 1 / (2 * Real.pi) := by ++ field_simp [I, Complex.I_ne_zero, Real.pi_pos.ne'] ++ ++lemma factor_I_from_integrand (f : ℂ → ℂ) (r_int : ℝ) (z : ℂ) : ++ ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I * ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = ++ I * ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) := by ++ ++ have h : ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I * ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = ++ ∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), I • (↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t))) := by ++ congr 1 ++ ext t ++ rw [smul_eq_mul] ++ ring ++ rw [h] ++ ++ rw [MeasureTheory.integral_smul] ++ ++ rw [smul_eq_mul] ++ ++lemma integrand_transform_div (f : ℂ → ℂ) (r_int : ℝ) (z : ℂ) (t : ℝ) : ++ ↑r_int * Complex.exp (I * ↑t) * (↑r_int * Complex.exp (I * ↑t) - z)⁻¹ ^ 2 * f (↑r_int * Complex.exp (I * ↑t)) = ++ ↑r_int * Complex.exp (I * ↑t) * f (↑r_int * Complex.exp (I * ↑t)) / (↑r_int * Complex.exp (I * ↑t) - z) ^ 2 := by ++ ++ rw [inv_pow] ++ ++ rw [← div_eq_mul_inv] ++ ++ ring ++ ++lemma lem_CIF_deriv_simplified {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ deriv f z = (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), ++(r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) := by ++ ++ rw [lem_CIF_deriv_param hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] ++ ++ rw [factor_I_from_integrand f r_int z] ++ ++ rw [← mul_assoc, complex_coeff_I_cancel] ++ ++ congr 2 ++ funext t ++ rw [integrand_transform_div f r_int z t] ++ ++lemma lem_modulus_of_f_prime0 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ norm (deriv f z) = norm ((1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), ++(r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by ++ ++ rw [lem_CIF_deriv_simplified hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] ++ ++lemma one_div_two_pi_pos : (1 : ℝ) / (2 * Real.pi) > 0 := by ++ ++ have h_pi_pos : Real.pi > 0 := Real.pi_pos ++ ++ have h_2pi_pos : 2 * Real.pi > 0 := by ++ apply mul_pos ++ · norm_num ++ · exact h_pi_pos ++ ++ apply div_pos ++ · norm_num ++ · exact h_2pi_pos ++ ++lemma abs_integral_le_integral_abs {a b : ℝ} {g : ℝ → ℂ} (_hab : a ≤ b) : norm (∫ (t : ℝ) in Set.Icc a b, g t) ≤ ∫ (t : ℝ) in Set.Icc a b, norm (g t) := by ++ ++ exact MeasureTheory.norm_integral_le_integral_norm g ++ ++lemma abs_ofReal_mul_complex (c : ℝ) (z : ℂ) (hc : c ≥ 0) : norm (↑c * z) = c * norm z := by ++ ++ have h1 : norm (↑c * z) = norm (↑c) * norm z := by simp ++ rw [h1] ++ ++ congr 1 ++ ++ simp ++ assumption ++ ++lemma complex_abs_mul (a b : ℂ) : norm (a * b) = norm a * norm b := ++ Complex.norm_mul a b ++ ++lemma complex_abs_ofReal_nonneg (r : ℝ) (hr : r ≥ 0) : norm (↑r : ℂ) = r := by ++ ++ have h1 : norm (↑r * 1) = r * norm (1 : ℂ) := by simp; assumption ++ ++ simp only [mul_one] at h1 ++ have h2 : norm (1 : ℂ) = 1 := by simp ++ rw [h2] at h1 ++ simp only [mul_one] at h1 ++ simp ++ assumption ++ ++lemma abs_one_div_two_pi_complex : norm (1 / (2 * ↑Real.pi : ℂ)) = 1 / (2 * Real.pi) := by ++ ++ have h_eq : (1 / (2 * ↑Real.pi) : ℂ) = ↑(1 / (2 * Real.pi) : ℝ) := by ++ simp only [Complex.ofReal_div, Complex.ofReal_one, Complex.ofReal_mul, Complex.ofReal_ofNat] ++ ++ rw [h_eq] ++ ++ have h_nonneg : (1 / (2 * Real.pi) : ℝ) ≥ 0 := by ++ apply div_nonneg ++ · norm_num ++ · apply mul_nonneg ++ · norm_num ++ · exact le_of_lt Real.pi_pos ++ ++ exact complex_abs_ofReal_nonneg (1 / (2 * Real.pi)) h_nonneg ++ ++lemma lem_integral_modulus_inequality {r_int : ℝ} {z : ℂ} {f : ℂ → ℂ} : ++norm ((1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), (r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) ≤ (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by ++ ++ rw [complex_abs_mul] ++ ++ rw [abs_one_div_two_pi_complex] ++ ++ apply mul_le_mul_of_nonneg_left ++ · ++ have h_2pi_nonneg : (0 : ℝ) ≤ 2 * Real.pi := by ++ apply mul_nonneg ++ · norm_num ++ · exact le_of_lt Real.pi_pos ++ exact abs_integral_le_integral_abs h_2pi_nonneg ++ · exact le_of_lt one_div_two_pi_pos ++ ++lemma lem_modulus_of_f_prime {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ norm (deriv f z) ≤ (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), ++norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) := by ++ ++ rw [lem_modulus_of_f_prime0 hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] ++ ++ exact lem_integral_modulus_inequality ++ ++lemma lem_modulus_of_integrand_product2 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (_hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (_h_r_z_pos : 0 < r_z) ++ (_h_r_z_lt_r_int : r_z < r_int) ++ (_h_r_int_lt_R_analytic : r_int < R_analytic) : ++ norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) = ++norm (f (r_int * Complex.exp (I * t))) * norm (r_int * Complex.exp (I * t)) := by ++ ++ rw [norm_mul] ++ ++lemma lem_modeit (t : ℝ) : norm (Complex.exp (I * t)) = Real.exp (Complex.re (I * t)) := by ++ ++ exact Complex.norm_exp (I * t) ++ ++lemma lem_Reit0 (t : ℝ) : Complex.re (I * t) = 0 := by ++ ++ unfold I ++ ++ rw [Complex.mul_re] ++ ++ rw [Complex.I_re, Complex.I_im, Complex.ofReal_re, Complex.ofReal_im] ++ ++ ring ++ ++lemma lem_eReite0 (t : ℝ) : Real.exp (Complex.re (I * t)) = Real.exp 0 := by ++ ++ rw [lem_Reit0] ++ ++lemma lem_e01 : Real.exp 0 = 1 := by ++ exact Real.exp_zero ++ ++lemma lem_eReit1 (t : ℝ) : Real.exp (Complex.re (I * t)) = 1 := by ++ ++ rw [lem_eReite0] ++ ++ rw [Real.exp_zero] ++ ++lemma lem_modulus_of_e_it_is_one (t : ℝ) : norm (Complex.exp (I * t)) = 1 := by ++ ++ rw [lem_modeit] ++ ++ rw [lem_Reit0] ++ ++ rw [lem_e01] ++ ++lemma lem_modulus_of_ae_it {a t : ℝ} (ha : 0 < a) : norm (a * Complex.exp (I * t)) = a := by ++ ++ rw [norm_mul, lem_modulus_of_e_it_is_one, mul_one, Complex.norm_real] ++ exact abs_of_pos ha ++ ++lemma lem_modulus_of_integrand_product3 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) : ++norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) = r_int * norm (f (r_int * Complex.exp (I * t))) := by ++ ++ rw [lem_modulus_of_integrand_product2 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] ++ ++ have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int ++ rw [lem_modulus_of_ae_it h_r_int_pos] ++ ++ ring ++ ++lemma lem_modulus_of_square (c : ℂ) : norm (c ^ 2) = (norm c) ^ 2 := by ++ exact Complex.norm_pow c 2 ++ ++lemma lem_modulus_wz (w z : ℂ) : norm ((w - z) ^ 2) = (norm (w - z)) ^ 2 := by ++ ++ exact Complex.norm_pow (w - z) 2 ++ ++lemma lem_reverse_triangle (w z : ℂ) : norm w - norm z ≤ norm (w - z) := by ++ ++ exact norm_sub_norm_le w z ++ ++lemma lem_reverse_triangle2 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} ++ (_h_r_z_pos : 0 < r_z) ++ (_h_r_z_lt_r_int : r_z < r_int) ++ (_h_r_int_lt_R_analytic : r_int < R_analytic) : ++norm (r_int * Complex.exp (I * t)) - norm z ≤ norm (r_int * Complex.exp (I * t) - z) := by ++ ++ exact lem_reverse_triangle (r_int * Complex.exp (I * t)) z ++ ++lemma lem_reverse_triangle3 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (_h_r_int_lt_R_analytic : r_int < R_analytic) : ++r_int - norm z ≤ norm (r_int * Complex.exp (I * t) - z) := by ++ ++ have h_mod : norm (r_int * Complex.exp (I * t)) = r_int := by ++ have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int ++ exact lem_modulus_of_ae_it h_r_int_pos ++ ++ have h_triangle := lem_reverse_triangle (r_int * Complex.exp (I * t)) z ++ ++ rw [h_mod] at h_triangle ++ exact h_triangle ++ ++lemma lem_zrr1 {R_analytic r_z r_int : ℝ} ++ (_h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (_h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++0 < r_int - norm z := by ++ ++ have h1 : dist z 0 ≤ r_z := Metric.mem_closedBall.mp hz ++ ++ have h2 : dist z 0 = ‖z‖ := by ++ rw [dist_eq_norm, sub_zero] ++ ++ have h3 : ‖z‖ ≤ r_z := by rwa [← h2] ++ ++ have h4 : norm z = ‖z‖ := rfl ++ ++ have h5 : norm z ≤ r_z := by rwa [h4] ++ ++ have h6 : norm z < r_int := lt_of_le_of_lt h5 h_r_z_lt_r_int ++ ++ linarith ++ ++lemma lem_zrr2 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ (hz : z ∈ Metric.closedBall 0 r_z) : ++r_int - r_z ≤ norm (r_int * Complex.exp (I * t) - z) := by ++ ++ have h1 : norm z ≤ r_z := by ++ have h_dist : dist z 0 ≤ r_z := Metric.mem_closedBall.mp hz ++ rw [dist_eq_norm, sub_zero] at h_dist ++ exact h_dist ++ ++ have h2 : r_int - r_z ≤ r_int - norm z := by linarith [h1] ++ ++ have h3 := @lem_reverse_triangle3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic ++ ++ exact le_trans h2 h3 ++ ++lemma lem_rr11 {r r' : ℝ} (_h_r_pos : 0 < r) (h_r_lt_r_prime : r < r') : r' - r > 0 := by ++ linarith ++ ++lemma lem_rr12 {r r' : ℝ} (h_r_pos : 0 < r) (h_r_lt_r_prime : r < r') : ++(r' - r) ^ 2 > 0 := by ++ ++ have h_diff_pos : r' - r > 0 := lem_rr11 h_r_pos h_r_lt_r_prime ++ ++ exact sq_pos_of_pos h_diff_pos ++ ++lemma lem_zrr3 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ (hz : z ∈ Metric.closedBall 0 r_z) : ++(r_int - r_z) ^ 2 ≤ norm (r_int * Complex.exp (I * t) - z) ^ 2 := by ++ ++ have h_ineq := @lem_zrr2 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ have h_nonneg_left : 0 ≤ r_int - r_z := by linarith [h_r_z_lt_r_int] ++ have h_nonneg_right : 0 ≤ norm (r_int * Complex.exp (I * t) - z) := norm_nonneg _ ++ ++ have h_sq := mul_self_le_mul_self h_nonneg_left h_ineq ++ ++ rw [pow_two, pow_two] ++ exact h_sq ++ ++lemma lem_zrr4 {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (_h_r_z_pos : 0 < r_z) ++ (_h_r_z_lt_r_int : r_z < r_int) ++ (_h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (_hz : z ∈ Metric.closedBall 0 r_z) : ++norm ((r_int * Complex.exp (I * t) - z) ^ 2) = (norm (r_int * Complex.exp (I * t) - z)) ^ 2 := by ++ ++ exact lem_modulus_of_square (r_int * Complex.exp (I * t) - z) ++ ++lemma lem_reverse_triangle4 {R_analytic r_z r_int : ℝ} {t : ℝ} {z : ℂ} ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ (hz : z ∈ Metric.closedBall 0 r_z) : ++0 < norm (r_int * Complex.exp (I * t) - z) := by ++ ++ have h1 := lem_zrr1 h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ have h2 := @lem_reverse_triangle3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic ++ ++ exact lt_of_lt_of_le h1 h2 ++ ++lemma lem_wposneq0 (w : ℂ) : norm w > 0 → w ≠ 0 := by ++ intro h ++ ++ by_contra h_eq_zero ++ ++ have h_abs_zero : norm w = 0 := by ++ rw [h_eq_zero] ++ simp ++ ++ rw [h_abs_zero] at h ++ exact lt_irrefl 0 h ++ ++lemma lem_reverse_triangle5 {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++r_int * Complex.exp (I * t) - z ≠ 0 := by ++ ++ have h_pos := @lem_reverse_triangle4 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ exact lem_wposneq0 (r_int * Complex.exp (I * t) - z) h_pos ++ ++lemma lem_reverse_triangle6 {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++(r_int * Complex.exp (I * t) - z) ^ 2 ≠ 0 := by ++ ++ have h_ne_zero := lem_reverse_triangle5 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ exact pow_ne_zero 2 h_ne_zero ++ ++lemma lem_absdiv {a b : ℂ} (_hb : b ≠ 0) : norm (a / b) = norm a / norm b := by ++ ++ exact norm_div a b ++ ++lemma lem_modulus_of_integrand_product {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (_hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = ++norm (f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / norm ((r_int * Complex.exp (I * t)) - z) ^ 2 := by ++ ++ have h_neq_zero : r_int * Complex.exp (I * t) - z ≠ 0 := ++ lem_reverse_triangle5 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ have h_sq_neq_zero : (r_int * Complex.exp (I * t) - z) ^ 2 ≠ 0 := by ++ rw [pow_two] ++ exact mul_self_ne_zero.mpr h_neq_zero ++ ++ rw [lem_absdiv h_sq_neq_zero] ++ ++ rw [lem_modulus_wz] ++ ++lemma lem_modulus_of_product {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = ++(r_int * norm (f (r_int * Complex.exp (I * t)))) / norm ((r_int * Complex.exp (I * t)) - z) ^ 2 := by ++ ++ rw [lem_modulus_of_integrand_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] ++ ++ rw [lem_modulus_of_integrand_product3 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] ++ ++lemma lem_modulus_of_product2 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = ++(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((norm (r_int * Complex.exp (I * t) - z)) ^ 2) := by ++ ++ rw [lem_modulus_of_integrand_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] ++ ++ rw [lem_modulus_of_integrand_product3 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic] ++ ++lemma lem_modulus_of_product3 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (_hf : DifferentiableOn ℂ f (Metric.closedBall 0 R_analytic)) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ (r_int * norm (f (r_int * Complex.exp (I * t)))) / ((norm (r_int * Complex.exp (I * t) - z)) ^ 2) ≤ ++(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((r_int - r_z) ^ 2) := by ++ ++ have h_ineq := @lem_zrr3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ have h_numer_nonneg : 0 ≤ r_int * norm (f (r_int * Complex.exp (I * t))) := by ++ apply mul_nonneg ++ · linarith [h_r_z_pos, h_r_z_lt_r_int] ++ · exact norm_nonneg _ ++ ++ have h_denom1_pos : 0 < (norm (r_int * Complex.exp (I * t) - z)) ^ 2 := by ++ apply pow_pos ++ exact lem_reverse_triangle4 h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ have h_denom2_pos : 0 < (r_int - r_z) ^ 2 := by ++ exact lem_rr12 h_r_z_pos h_r_z_lt_r_int ++ ++ exact div_le_div_of_nonneg_left h_numer_nonneg h_denom2_pos h_ineq ++ ++lemma lem_modulus_of_product4 {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} (t : ℝ) ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ ++(r_int * norm (f (r_int * Complex.exp (I * t)))) / ((r_int - r_z) ^ 2) := by ++ ++ rw [lem_modulus_of_product t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz] ++ ++ have h_ineq := @lem_zrr3 R_analytic r_z r_int t z h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ apply div_le_div_of_nonneg_left ++ · ++ apply mul_nonneg ++ · linarith [h_r_z_pos, h_r_z_lt_r_int] ++ · exact norm_nonneg _ ++ · ++ apply pow_pos ++ linarith [h_r_z_lt_r_int] ++ · ++ exact h_ineq ++ ++lemma lem_bound_on_f_at_r_prime {M R_analytic r_int : ℝ} ++ (hM_pos : 0 < M) ++ (hR_analytic_pos : 0 < R_analytic) ++ (hr_int_pos : 0 < r_int) ++ (hr_int_lt_R_analytic : r_int < R_analytic) ++ (f : ℂ → ℂ) ++ ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (hf0 : f 0 = 0) ++ (hRe_f_le_M : ∀ z ∈ Metric.closedBall 0 R_analytic, (f z).re ≤ M) ++ (t : ℝ) : ++norm (f (r_int * Complex.exp (I * t))) ≤ (2 * r_int * M) / (R_analytic - r_int) := by ++ ++ obtain ⟨U, hU_open, h_subset, hf_diff_U⟩ := hf_domain ++ ++ let z₀ := r_int * Complex.exp (I * t) ++ ++ have h_sSup_bound := thm_BorelCaratheodoryI R_analytic M hR_analytic_pos hM_pos f ++ ++ (by ++ ++ have h_analytic_U : AnalyticOn ℂ f U := hf_diff_U.analyticOn hU_open ++ ++ rw [ballDR] ++ convert h_analytic_U.mono h_subset ++ ++ apply closure_ball ++ linarith ++ ) ++ hf0 ++ (by rwa [lem_ballDR R_analytic hR_analytic_pos]) ++ r_int hr_int_pos hr_int_lt_R_analytic ++ ++ have hz₀_in_ball : z₀ ∈ Metric.closedBall 0 r_int := by ++ rw [Metric.mem_closedBall] ++ simp only [dist_eq_norm, sub_zero] ++ ++ have h_norm : ‖r_int * Complex.exp (I * t)‖ = r_int := by ++ rw [norm_mul] ++ ++ have h1 : ‖(r_int : ℂ)‖ = r_int := by ++ rw [Complex.norm_real] ++ exact abs_of_pos hr_int_pos ++ ++ have h2 : ‖Complex.exp (I * ↑t)‖ = 1 := by ++ ++ exact lem_modulus_of_e_it_is_one t ++ rw [h1, h2] ++ ring ++ rw [h_norm] ++ ++ have hz₀_in_closure : z₀ ∈ closure (ballDR r_int) := by ++ rw [lem_ballDR r_int hr_int_pos] ++ exact hz₀_in_ball ++ ++ have h_in_image : norm (f z₀) ∈ (norm ∘ f) '' (closure (ballDR r_int)) := by ++ use z₀, hz₀_in_closure ++ rfl ++ ++ have h_le_sSup : norm (f z₀) ≤ sSup ((norm ∘ f) '' (closure (ballDR r_int))) := by ++ apply le_csSup ++ ++ · use (2 * r_int / (R_analytic - r_int)) * M ++ intros x hx ++ obtain ⟨w, hw_in, hx_eq⟩ := hx ++ rw [← hx_eq] ++ ++ have hw_in_closed : w ∈ Metric.closedBall 0 r_int := by ++ rwa [← lem_ballDR r_int hr_int_pos] ++ ++ have hw_in_R : w ∈ Metric.closedBall 0 R_analytic := by ++ have h_subset : Metric.closedBall (0 : ℂ) r_int ⊆ Metric.closedBall 0 R_analytic := by ++ apply Metric.closedBall_subset_closedBall ++ linarith [hr_int_lt_R_analytic] ++ exact h_subset hw_in_closed ++ ++ exact lem_BCI R_analytic M hR_analytic_pos hM_pos f ++ (by ++ rw [ballDR] ++ have h_analytic_U : AnalyticOn ℂ f U := hf_diff_U.analyticOn hU_open ++ convert h_analytic_U.mono h_subset ++ apply closure_ball ++ linarith) ++ hf0 ++ (by rwa [lem_ballDR R_analytic hR_analytic_pos]) ++ r_int hr_int_pos hr_int_lt_R_analytic w ++ (by aesop) ++ ++ · exact h_in_image ++ ++ calc norm (f z₀) ++ ≤ sSup ((norm ∘ f) '' (closure (ballDR r_int))) := h_le_sSup ++ _ ≤ (2 * r_int / (R_analytic - r_int)) * M := h_sSup_bound ++ _ = (2 * r_int * M) / (R_analytic - r_int) := by ring ++ ++lemma lem_bound_on_integrand_modulus {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} ++ (hM_pos : 0 < M) ++ (hR_analytic_pos : 0 < R_analytic) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (hf0 : f 0 = 0) ++ (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) ++ (t : ℝ) : ++norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by ++ ++ have h1 := lem_modulus_of_product4 t hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ have h2 := lem_bound_on_f_at_r_prime hM_pos hR_analytic_pos (lt_trans h_r_z_pos h_r_z_lt_r_int) h_r_int_lt_R_analytic f hf_domain hf0 hRe_f_le_M t ++ ++ have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int ++ have h_denom_nonneg : 0 ≤ (r_int - r_z) ^ 2 := by ++ apply sq_nonneg ++ ++ have h3 : (r_int * norm (f (r_int * Complex.exp (I * t)))) / (r_int - r_z) ^ 2 ≤ ++ (r_int * (2 * r_int * M / (R_analytic - r_int))) / (r_int - r_z) ^ 2 := by ++ apply div_le_div_of_nonneg_right _ h_denom_nonneg ++ apply mul_le_mul_of_nonneg_left h2 ++ linarith [h_r_int_pos] ++ ++ have h4 : (r_int * (2 * r_int * M / (R_analytic - r_int))) / (r_int - r_z) ^ 2 = ++ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by ++ have h_R_sub_r_pos : 0 < R_analytic - r_int := by linarith [h_r_int_lt_R_analytic] ++ have h_r_sub_r_pos : 0 < r_int - r_z := by linarith [h_r_z_lt_r_int] ++ field_simp [ne_of_gt h_R_sub_r_pos, ne_of_gt (pow_pos h_r_sub_r_pos 2)] ++ ++ rw [h4] at h3 ++ exact le_trans h1 h3 ++ ++lemma lem_integral_inequality_aux {g : ℝ → ℝ} {C a b : ℝ} (hab : a ≤ b) ++ (h_integrable : IntervalIntegrable g MeasureTheory.volume a b) ++ (h_bound : ∀ t ∈ Set.Icc a b, g t ≤ C) : ++∫ t in a..b, g t ≤ ∫ _t in a..b, C := by ++ ++ have h_const_integrable : IntervalIntegrable (fun _ => C) MeasureTheory.volume a b := ++ intervalIntegrable_const ++ ++ have h_pointwise : ∀ x ∈ Set.Icc a b, g x ≤ (fun _ => C) x := by ++ intro x hx ++ simp ++ exact h_bound x hx ++ ++ exact intervalIntegral.integral_mono_on hab h_integrable h_const_integrable h_pointwise ++ ++lemma lem_integral_inequality {g : ℝ → ℝ} {C a b : ℝ} (hab : a ≤ b) ++ (h_integrable : IntervalIntegrable g MeasureTheory.volume a b) ++ (h_bound : ∀ t ∈ Set.Icc a b, g t ≤ C) : ++∫ t in Set.Icc a b, g t ≤ ∫ _t in Set.Icc a b, C := by ++ rw [MeasureTheory.integral_Icc_eq_integral_Ioc, MeasureTheory.integral_Icc_eq_integral_Ioc] ++ rw [← intervalIntegral.integral_of_le hab, ← intervalIntegral.integral_of_le hab] ++ exact lem_integral_inequality_aux hab h_integrable h_bound ++ ++lemma continuous_real_parameterization (r : ℝ) : Continuous (fun t : ℝ => r * Complex.exp (I * t)) := by ++ ++ have h1 : Continuous (fun t : ℝ => (t : ℂ)) := Complex.continuous_ofReal ++ ++ have h2 : Continuous (fun z : ℂ => I * z) := by ++ apply Continuous.mul ++ · exact continuous_const ++ · exact continuous_id ++ ++ have h3 : Continuous Complex.exp := Complex.continuous_exp ++ ++ have h4 : Continuous (fun z : ℂ => (r : ℂ) * z) := by ++ apply Continuous.mul ++ · exact continuous_const ++ · exact continuous_id ++ ++ apply Continuous.comp h4 ++ apply Continuous.comp h3 ++ apply Continuous.comp h2 ++ exact h1 ++ ++lemma continuous_f_parameterized {f : ℂ → ℂ} {R r : ℝ} (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R ⊆ U ∧ DifferentiableOn ℂ f U) ++ (hr_pos : 0 < r) (hr_lt_R : r < R) : Continuous (fun t : ℝ => f (r * Complex.exp (I * t))) := by ++ ++ obtain ⟨U', hU'_open, h_subset, hf_diff_U'⟩ := hf_domain ++ have hf_cont : ContinuousOn f (Metric.closedBall 0 R) := by ++ ++ have hf_on_closed : DifferentiableOn ℂ f (Metric.closedBall 0 R) := ++ hf_diff_U'.mono h_subset ++ ++ exact DifferentiableOn.continuousOn hf_on_closed ++ ++ have hparam_cont : Continuous (fun t : ℝ => r * Complex.exp (I * t)) := continuous_real_parameterization r ++ ++ have hparam_range : ∀ t : ℝ, r * Complex.exp (I * t) ∈ Metric.closedBall 0 R := by ++ intro t ++ rw [Metric.mem_closedBall, dist_zero_right] ++ ++ change norm (r * Complex.exp (I * t)) ≤ R ++ rw [lem_modulus_of_ae_it hr_pos] ++ exact le_of_lt hr_lt_R ++ ++ have hcomp_on : ContinuousOn (fun t : ℝ => f (r * Complex.exp (I * t))) Set.univ := by ++ apply ContinuousOn.comp hf_cont (Continuous.continuousOn hparam_cont) ++ intro t _ ++ exact hparam_range t ++ ++ exact continuousOn_univ.mp hcomp_on ++ ++lemma continuous_denominator_parameterized (r : ℝ) (z : ℂ) : Continuous (fun t : ℝ => (r * Complex.exp (I * t) - z) ^ 2) := by ++ ++ have h1 : Continuous (fun t : ℝ => r * Complex.exp (I * t) - z) := by ++ ++ apply Continuous.sub ++ · ++ exact continuous_real_parameterization r ++ · ++ exact continuous_const ++ ++ have h2 : Continuous (fun x : ℂ => x ^ 2) := continuous_pow 2 ++ ++ exact Continuous.comp h2 h1 ++ ++lemma interval_integrable_cauchy_integrand {f : ℂ → ℂ} {R_analytic r_z r_int : ℝ} {z : ℂ} ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ (hz : z ∈ Metric.closedBall 0 r_z) : ++IntervalIntegrable (fun t => norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) MeasureTheory.volume 0 (2 * Real.pi) := by ++ ++ apply Continuous.intervalIntegrable ++ ++ apply Continuous.comp continuous_norm ++ ++ apply Continuous.div₀ ++ ++ · apply Continuous.mul ++ ++ · exact continuous_real_parameterization r_int ++ ++ · have h_r_int_pos : 0 < r_int := lt_trans h_r_z_pos h_r_z_lt_r_int ++ exact continuous_f_parameterized hf_domain h_r_int_pos h_r_int_lt_R_analytic ++ ++ · exact continuous_denominator_parameterized r_int z ++ ++ · intro t ++ exact lem_reverse_triangle6 t h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++lemma integral_const_over_interval (C : ℝ) : ++∫ _t in Set.Icc 0 (2 * Real.pi), C = (2 * Real.pi) * C := by ++ ++ rw [MeasureTheory.integral_Icc_eq_integral_Ioc] ++ ++ have h_le : (0 : ℝ) ≤ 2 * Real.pi := by ++ apply mul_nonneg ++ · norm_num ++ · exact Real.pi_pos.le ++ rw [← intervalIntegral.integral_of_le h_le] ++ ++ rw [intervalIntegral.integral_const] ++ ++ simp [sub_zero, smul_eq_mul] ++ ++lemma lem_f_prime_bound_by_integral_of_constant {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} ++ (hM_pos : 0 < M) ++ (hR_analytic_pos : 0 < R_analytic) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (hf0 : f 0 = 0) ++ (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++norm (deriv f z) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by ++ ++ have h1 := lem_modulus_of_f_prime hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ set C := (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) ++ ++ have h_bound : ∀ t ∈ Set.Icc 0 (2 * Real.pi), ++ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ C := by ++ intro t ht ++ exact lem_bound_on_integrand_modulus hM_pos hR_analytic_pos h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hf_domain hf0 hRe_f_le_M hz t ++ ++ have h_eq : ∀ t, norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) = ++ norm ((f (r_int * Complex.exp (I * t)) * (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) := by ++ intro t ++ congr 2 ++ ring ++ ++ have h_bound_h1 : ∀ t ∈ Set.Icc 0 (2 * Real.pi), ++ norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2) ≤ C := by ++ intro t ht ++ rw [h_eq] ++ exact h_bound t ht ++ ++ have h_integrable : IntervalIntegrable (fun t => norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) MeasureTheory.volume 0 (2 * Real.pi) := by ++ ++ exact interval_integrable_cauchy_integrand hf_domain h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hz ++ ++ have h2 := lem_integral_inequality ?_ h_integrable h_bound_h1 ++ ++ have h_const_integral : ∫ t in Set.Icc 0 (2 * Real.pi), C = (2 * Real.pi) * C := by ++ ++ exact integral_const_over_interval C ++ ++ rw [h_const_integral] at h2 ++ ++ have h3 : (1 / (2 * Real.pi)) * (∫ (t : ℝ) in Set.Icc 0 (2 * Real.pi), ++ norm ((r_int * Complex.exp (I * t) * f (r_int * Complex.exp (I * t))) / ((r_int * Complex.exp (I * t)) - z) ^ 2)) ≤ ++ (1 / (2 * Real.pi)) * (2 * Real.pi * C) := by ++ apply mul_le_mul_of_nonneg_left h2 ++ apply div_nonneg ++ · norm_num ++ · linarith [Real.pi_pos] ++ ++ have h4 : (1 / (2 * Real.pi)) * (2 * Real.pi * C) = C := by ++ have h_pi_ne_zero : (2 : ℝ) * Real.pi ≠ 0 := ne_of_gt (by linarith [Real.pi_pos]) ++ field_simp [h_pi_ne_zero] ++ ++ rw [h4] at h3 ++ exact le_trans h1 h3 ++ simp [Real.pi_nonneg] ++ ++lemma lem_integral_of_1 : ∫ (_t : ℝ) in Set.Icc 0 (2 * Real.pi), (1 : ℝ) = 2 * Real.pi := by ++ ++ rw [MeasureTheory.integral_Icc_eq_integral_Ioc] ++ ++ rw [← intervalIntegral.integral_of_le] ++ ++ rw [integral_one] ++ ++ simp ++ ++ exact mul_nonneg (by norm_num) Real.pi_pos.le ++ ++lemma lem_integral_2 : (1 / (2 * Real.pi)) * (∫ (_t : ℝ) in Set.Icc 0 (2 * Real.pi), (1 : ℝ)) = 1 := by ++ ++ rw [lem_integral_of_1] ++ ++ field_simp ++ ++lemma lem_f_prime_bound {f : ℂ → ℂ} {M R_analytic r_z r_int : ℝ} ++ (hM_pos : 0 < M) ++ (hR_analytic_pos : 0 < R_analytic) ++ (h_r_z_pos : 0 < r_z) ++ (h_r_z_lt_r_int : r_z < r_int) ++ (h_r_int_lt_R_analytic : r_int < R_analytic) ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R_analytic ⊆ U ∧ DifferentiableOn ℂ f U) ++ (hf0 : f 0 = 0) ++ (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R_analytic, (f w).re ≤ M) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r_z) : ++norm (deriv f z) ≤ (2 * r_int ^ 2 * M) / ((R_analytic - r_int) * (r_int - r_z) ^ 2) := by ++ ++ exact lem_f_prime_bound_by_integral_of_constant hM_pos hR_analytic_pos h_r_z_pos h_r_z_lt_r_int h_r_int_lt_R_analytic hf_domain hf0 hRe_f_le_M hz ++ ++lemma lem_r_prime_gt_r {r R : ℝ} ++ (_h_r_pos : 0 < r) ++ (h_r_lt_R : r < R) : ++r < (r + R) / 2 := by ++ linarith ++ ++lemma lem_r_prime_lt_R {r R : ℝ} ++ (_h_r_pos : 0 < r) ++ (h_r_lt_R : r < R) : ++(r + R) / 2 < R := by ++ ++ rw [add_div_two_lt_right] ++ exact h_r_lt_R ++ ++lemma lem_r_prime_is_intermediate {r R : ℝ} ++ (h_r_pos : 0 < r) ++ (h_r_lt_R : r < R) : ++r < (r + R) / 2 ∧ (r + R) / 2 < R := by ++ constructor ++ · ++ rw [left_lt_add_div_two] ++ exact h_r_lt_R ++ · ++ exact lem_r_prime_lt_R h_r_pos h_r_lt_R ++ ++lemma lem_calc_R_minus_r_prime {r R : ℝ} ++ (_h_r_pos : 0 < r) ++ (_h_r_lt_R : r < R) : ++R - ((r + R) / 2) = (R - r) / 2 := by ++ field_simp; ring ++ ++lemma lem_calc_r_prime_minus_r {r R : ℝ} ++ (_h_r_pos : 0 < r) ++ (_h_r_lt_R : r < R) : ++((r + R) / 2) - r = (R - r) / 2 := by ++ ++ field_simp ++ ++ ring ++ ++lemma lem_calc_denominator_specific {r R : ℝ} ++ (h_r_pos : 0 < r) ++ (h_r_lt_R : r < R) : ++(R - ((r + R) / 2)) * (((r + R) / 2) - r) ^ 2 = ((R - r) ^ 3) / 8 := by ++ ++ rw [lem_calc_R_minus_r_prime h_r_pos h_r_lt_R] ++ ++ have h_calc : ((r + R) / 2) - r = (R - r) / 2 := by ++ field_simp; ring ++ ++ rw [h_calc] ++ ++ ring ++ ++lemma lem_calc_numerator_specific {M r R : ℝ} ++ (_hM_pos : 0 < M) ++ (_hr_pos : 0 < r) ++ (_hr_lt_R : r < R) : ++2 * (((r + R) / 2) ^ 2) * M = ((R + r) ^ 2 * M) / 2 := by ++ ++ ring ++ ++lemma lem_frac_simplify {M r R : ℝ} ++ (hM_pos : 0 < M) ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++ let r_prime := (r + R) / 2 ++(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) = (((R + r) ^ 2 * M) / 2) / (((R - r) ^ 3) / 8) := by ++ ++ dsimp only ++ ++ have h_num := lem_calc_numerator_specific hM_pos hr_pos hr_lt_R ++ ++ have h_denom := lem_calc_denominator_specific hr_pos hr_lt_R ++ ++ rw [← h_num, ← h_denom] ++ ++lemma lem_frac_simplify2 {M r R : ℝ} ++ (hM_pos : 0 < M) ++ (_hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++((R + r) ^ 2 * M / 2) / ((R - r) ^ 3 / 8) = (4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) := by ++ ++ have h_two_ne_zero : (2 : ℝ) ≠ 0 := by norm_num ++ have h_eight_ne_zero : (8 : ℝ) ≠ 0 := by norm_num ++ have h_R_minus_r_ne_zero : R - r ≠ 0 := by linarith [hr_lt_R] ++ have h_R_minus_r_pow_ne_zero : (R - r) ^ 3 ≠ 0 := by ++ apply pow_ne_zero ++ exact h_R_minus_r_ne_zero ++ ++ field_simp [h_two_ne_zero, h_eight_ne_zero, h_R_minus_r_pow_ne_zero]; ring ++ ++lemma lem_frac_simplify3 {M r R : ℝ} ++ (hM_pos : 0 < M) ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++ let r_prime := (r + R) / 2 ++(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) = (4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) := by ++ ++ dsimp only ++ ++ have h1 := lem_frac_simplify hM_pos hr_pos hr_lt_R ++ ++ have h2 := lem_frac_simplify2 hM_pos hr_pos hr_lt_R ++ ++ rw [h1, h2] ++ ++lemma lem_ineq_R_plus_r_lt_2R {r R : ℝ} (h_r_lt_R : r < R) : ++R + r < 2 * R := by ++ ++ rw [two_mul] ++ ++ linarith [h_r_lt_R] ++ ++lemma lem_R_plus_r_is_positive {r R : ℝ} ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++0 < R + r := by ++ ++ have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R ++ ++ exact add_pos hR_pos hr_pos ++ ++lemma lem_2R_is_positive {R : ℝ} (hR_pos : 0 < R) : 0 < 2 * R := by ++ apply mul_pos ++ · norm_num ++ · exact hR_pos ++ ++lemma lem_square_inequality_strict {a b : ℝ} ++ (h_a_pos : 0 < a) ++ (h_a_lt_b : a < b) : ++a ^ 2 < b ^ 2 := by ++ ++ have h_a_nonneg : 0 ≤ a := le_of_lt h_a_pos ++ ++ have h_b_pos : 0 < b := lt_trans h_a_pos h_a_lt_b ++ have h_b_nonneg : 0 ≤ b := le_of_lt h_b_pos ++ ++ have h_squares := mul_self_lt_mul_self_iff h_a_nonneg h_b_nonneg ++ ++ have h_mult : a * a < b * b := h_squares.mp h_a_lt_b ++ ++ rw [← pow_two, ← pow_two] at h_mult ++ exact h_mult ++ ++lemma lem_ineq_R_plus_r_sq_lt_2R_sq {r R : ℝ} ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++(R + r) ^ 2 < (2 * R) ^ 2 := by ++ ++ let a := R + r ++ let b := 2 * R ++ ++ have ha_pos : 0 < a := lem_R_plus_r_is_positive hr_pos hr_lt_R ++ ++ have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R ++ have hb_pos : 0 < b := by ++ unfold b ++ exact lem_2R_is_positive hR_pos ++ ++ have hab : a < b := by ++ unfold a b ++ exact lem_ineq_R_plus_r_lt_2R hr_lt_R ++ ++ have : a ^ 2 < b ^ 2 := lem_square_inequality_strict ha_pos hab ++ ++ unfold a b at this ++ exact this ++ ++lemma lem_2R_sq_is_4R_sq {R : ℝ} (_hR_pos : 0 < R) : (2 * R) ^ 2 = 4 * R ^ 2 := by ++ ++ ring ++ ++lemma lem_ineq_R_plus_r_sq {r R : ℝ} ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++(R + r) ^ 2 < 4 * R ^ 2 := by ++ ++ have h1 := lem_ineq_R_plus_r_lt_2R hr_lt_R ++ ++ have h2 := lem_R_plus_r_is_positive hr_pos hr_lt_R ++ ++ have h3 := lem_square_inequality_strict h2 h1 ++ ++ have hR_pos : 0 < R := lt_trans hr_pos hr_lt_R ++ have h4 := lem_2R_sq_is_4R_sq hR_pos ++ rw [h4] at h3 ++ exact h3 ++ ++lemma lem_ineq_R_plus_r_sqM {M r R : ℝ} ++ (hM_pos : 0 < M) ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++4 * (R + r) ^ 2 * M < 16 * R ^ 2 * M := by ++ ++ have h_ineq := lem_ineq_R_plus_r_sq hr_pos hr_lt_R ++ ++ have h_4M_pos : 0 < 4 * M := by ++ apply mul_pos ++ · norm_num ++ · exact hM_pos ++ ++ have h_mult := mul_lt_mul_of_pos_right h_ineq h_4M_pos ++ ++ nlinarith [h_mult] ++ ++lemma lem_simplify_final_bound {M r R : ℝ} ++ (hM_pos : 0 < M) ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++(4 * (R + r) ^ 2 * M) / ((R - r) ^ 3) < (16 * R ^ 2 * M) / ((R - r) ^ 3) := by ++ ++ have h_num_ineq := lem_ineq_R_plus_r_sqM hM_pos hr_pos hr_lt_R ++ ++ have h_denom_pos : 0 < (R - r) ^ 3 := by ++ apply pow_pos ++ linarith [hr_lt_R] ++ ++ exact div_lt_div_of_pos_right h_num_ineq h_denom_pos ++ ++lemma lem_bound_after_substitution {M r R : ℝ} ++ (hM_pos : 0 < M) ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) : ++ let r_prime := (r + R) / 2 ++(2 * (r_prime ^ 2) * M) / ((R - r_prime) * (r_prime - r) ^ 2) ≤ (16 * R ^ 2 * M) / ((R - r) ^ 3) := by ++ ++ dsimp only ++ ++ have h1 := lem_frac_simplify3 hM_pos hr_pos hr_lt_R ++ ++ dsimp only at h1 ++ rw [h1] ++ ++ have h2 := lem_simplify_final_bound hM_pos hr_pos hr_lt_R ++ ++ exact le_of_lt h2 ++ ++theorem borel_caratheodory_II {f : ℂ → ℂ} {R M r : ℝ} ++ (hR_pos : 0 < R) ++ (hM_pos : 0 < M) ++ (hr_pos : 0 < r) ++ (hr_lt_R : r < R) ++ (hf_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 R ⊆ U ∧ DifferentiableOn ℂ f U) ++ (hf0 : f 0 = 0) ++ (hRe_f_le_M : ∀ w ∈ Metric.closedBall 0 R, (f w).re ≤ M) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r) : ++norm (deriv f z) ≤ (16 * M * R ^ 2) / ((R - r) ^ 3) := by ++ ++ set r_prime := (r + R) / 2 ++ ++ have h_intermediate := lem_r_prime_is_intermediate hr_pos hr_lt_R ++ have h_r_lt_r_prime := h_intermediate.1 ++ have h_r_prime_lt_R := h_intermediate.2 ++ ++ have h_bound := lem_f_prime_bound hM_pos hR_pos hr_pos h_r_lt_r_prime h_r_prime_lt_R hf_domain hf0 hRe_f_le_M hz ++ ++ have h_final := lem_bound_after_substitution hM_pos hr_pos hr_lt_R ++ ++ have h_combined : norm (deriv f z) ≤ (16 * R ^ 2 * M) / ((R - r) ^ 3) := by ++ exact le_trans h_bound h_final ++ ++ convert h_combined using 1 ++ ring ++ ++open Complex MeasureTheory intervalIntegral ++open scoped Interval ++ ++noncomputable def If_taxicab ++ {r1 R R0: ℝ} ++ (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) ++ (f : ℂ → ℂ) ++ (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : ++ (Metric.closedBall (0 : ℂ) r1) → ℂ := ++ fun z => ++ (∫ t in (0 : ℝ)..z.1.re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.1.im, f ((z.1.re : ℂ) + Complex.I * τ)) ++ ++lemma def_If_z_plus_h ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, f (( (z + h).re : ℂ) + Complex.I * τ)) := by ++ rfl ++ ++lemma def_If_z ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ ++ = (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) := by ++ rfl ++ ++lemma def_If_w ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (_hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ ++ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) := by ++ simp [If_taxicab] ++ ++lemma continuous_vertical_line (a : ℂ) : ++ Continuous (fun τ : ℝ => ((a.re : ℂ) + Complex.I * (τ : ℂ))) := by ++ have hconst : Continuous (fun _ : ℝ => (a.re : ℂ)) := continuous_const ++ have hmul : Continuous (fun τ : ℝ => (Complex.I : ℂ) * (τ : ℂ)) := ++ continuous_const.mul Complex.continuous_ofReal ++ convert hconst.add hmul using 1 ++ ++lemma norm_re_add_I_mul_le_norm (a : ℂ) {τ : ℝ} (hτ : |τ| ≤ |a.im|) : ++ ‖((a.re : ℂ) + Complex.I * (τ : ℂ))‖ ≤ ‖a‖ := by ++ ++ set z1 : ℂ := ((a.re : ℂ) + Complex.I * (τ : ℂ)) with hz1 ++ ++ have hsq_z1 : ‖z1‖ ^ 2 = z1.re ^ 2 + z1.im ^ 2 := by ++ have hx : ‖z1‖ ^ 2 - z1.re ^ 2 = z1.im ^ 2 := Complex.sq_norm_sub_sq_re z1 ++ have hx' := congrArg (fun t : ℝ => t + z1.re ^ 2) hx ++ ++ have : ‖z1‖ ^ 2 = z1.im ^ 2 + z1.re ^ 2 := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hx' ++ simpa [add_comm] using this ++ have hsq_a : ‖a‖ ^ 2 = a.re ^ 2 + a.im ^ 2 := by ++ have hx : ‖a‖ ^ 2 - a.re ^ 2 = a.im ^ 2 := Complex.sq_norm_sub_sq_re a ++ have hx' := congrArg (fun t : ℝ => t + a.re ^ 2) hx ++ have : ‖a‖ ^ 2 = a.im ^ 2 + a.re ^ 2 := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hx' ++ simpa [add_comm] using this ++ ++ have hz1_re : z1.re = a.re := by ++ simp [hz1, mul_comm] ++ have hz1_im : z1.im = τ := by ++ simp [hz1, mul_comm] ++ ++ have hτ_sq : τ ^ 2 ≤ a.im ^ 2 := by ++ simpa using (sq_le_sq.mpr hτ) ++ ++ have hsq_le : ‖z1‖ ^ 2 ≤ ‖a‖ ^ 2 := by ++ have : a.re ^ 2 + τ ^ 2 ≤ a.re ^ 2 + a.im ^ 2 := add_le_add_right hτ_sq _ ++ simpa [hsq_z1, hz1_re, hz1_im, hsq_a] using this ++ ++ have hnonneg : 0 ≤ ‖a‖ := norm_nonneg _ ++ exact le_of_sq_le_sq hsq_le hnonneg ++ ++lemma closedBall_mono_center0 {r1 R : ℝ} (h : r1 ≤ R) : ++ Metric.closedBall (0 : ℂ) r1 ⊆ Metric.closedBall (0 : ℂ) R := by ++ intro z hz ++ have hz' : dist z (0 : ℂ) ≤ r1 := (Metric.mem_closedBall.mp hz) ++ exact Metric.mem_closedBall.mpr (le_trans hz' h) ++ ++lemma abs_le_abs_of_mem_uIcc_zero {b t : ℝ} (ht : t ∈ Set.uIcc (0 : ℝ) b) : |t| ≤ |b| := by ++ classical ++ by_cases hb : 0 ≤ b ++ · ++ have ht' : t ∈ Set.Icc (0 : ℝ) b := by ++ simpa [Set.uIcc_of_le hb] using ht ++ have ht0 : 0 ≤ t := ht'.1 ++ have htb : t ≤ b := ht'.2 ++ have htabs : |t| = t := abs_of_nonneg ht0 ++ have hbabs : |b| = b := abs_of_nonneg hb ++ simpa [htabs, hbabs] using htb ++ · ++ have ht' : t ∈ Set.Icc b 0 := by ++ simpa [Set.uIcc_of_not_le hb] using ht ++ have hb_le : b ≤ 0 := le_trans ht'.1 ht'.2 ++ have ht_le0 : t ≤ 0 := ht'.2 ++ have hbabs : |b| = -b := abs_of_nonpos hb_le ++ have htabs : |t| = -t := abs_of_nonpos ht_le0 ++ have hneg : -t ≤ -b := neg_le_neg ht'.1 ++ simpa [htabs, hbabs] using hneg ++ ++lemma vertical_intervalIntegrable_of_mem_ball ++ {r1 R R0 : ℝ} ++ (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {a : ℂ} ++ (ha : a ∈ Metric.closedBall (0 : ℂ) r1) : ++ IntervalIntegrable (fun τ : ℝ => f (((a.re : ℂ)) + Complex.I * τ)) volume (0 : ℝ) a.im := by ++ classical ++ ++ have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn ++ ++ let g : ℝ → ℂ := fun τ => ((a.re : ℂ) + Complex.I * (τ : ℂ)) ++ ++ have hg_cont : ContinuousOn g (Set.uIcc (0 : ℝ) a.im) := by ++ simpa [g] using (continuous_vertical_line a).continuousOn ++ ++ have hg_maps : Set.MapsTo g (Set.uIcc (0 : ℝ) a.im) (Metric.closedBall (0 : ℂ) R) := by ++ intro τ hτ ++ have hτabs : |τ| ≤ |a.im| := abs_le_abs_of_mem_uIcc_zero hτ ++ have hnorm_le_a : ‖g τ‖ ≤ ‖a‖ := by ++ simpa [g] using norm_re_add_I_mul_le_norm a hτabs ++ have ha_norm : ‖a‖ ≤ r1 := by ++ have : dist a (0 : ℂ) ≤ r1 := (Metric.mem_closedBall.mp ha) ++ simpa [dist_eq_norm] using this ++ have hnorm_le_r1 : ‖g τ‖ ≤ r1 := le_trans hnorm_le_a ha_norm ++ have hg_mem_r1 : g τ ∈ Metric.closedBall (0 : ℂ) r1 := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hnorm_le_r1 ++ exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) hg_mem_r1 ++ ++ have hcomp : ContinuousOn (fun τ : ℝ => f (g τ)) (Set.uIcc (0 : ℝ) a.im) := by ++ ++ convert (ContinuousOn.comp (hg := hf_cont) (hf := hg_cont) (h := hg_maps)) using 1; rfl ++ ++ have hInt : IntervalIntegrable (fun τ : ℝ => f (g τ)) volume (0 : ℝ) a.im := ++ ContinuousOn.intervalIntegrable (u := fun τ : ℝ => f (g τ)) (a := 0) (b := a.im) hcomp ++ simpa [g] using hInt ++ ++lemma helper_im_of_w (z h : ℂ) : (((((z + h).re : ℂ) + Complex.I * z.im)).im) = z.im := by ++ simp [Complex.add_im] ++ ++lemma helper_mul_sub_complex (x y : ℂ) : Complex.I * x - Complex.I * y = Complex.I * (x - y) := by ++ simp [mul_sub] ++ ++lemma helper_re_of_w (z h : ℂ) : (((((z + h).re : ℂ) + Complex.I * z.im)).re) = (z + h).re := by ++ simp ++ ++lemma diff_If_zh_w ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ ++ = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by ++ classical ++ intro w ++ ++ let g : ℝ → ℂ := fun τ => f (((z + h).re : ℂ) + Complex.I * τ) ++ ++ have hInt1 : IntervalIntegrable g volume (0 : ℝ) ((z + h).im) := by ++ simpa [g] using ++ (vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf (a := z + h) hzh) ++ have hInt2 : IntervalIntegrable g volume (0 : ℝ) (z.im) := by ++ have hInt2' : ++ IntervalIntegrable ++ (fun τ : ℝ => f (((( (((z + h).re : ℂ) + Complex.I * z.im)).re : ℂ)) + Complex.I * τ)) ++ volume (0 : ℝ) (((((z + h).re : ℂ) + Complex.I * z.im)).im) := ++ vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf ++ (a := (((z + h).re : ℂ) + Complex.I * z.im)) hw ++ simpa [g, helper_re_of_w z h, helper_im_of_w z h] using hInt2' ++ have hinterval : ++ ((∫ τ in (0 : ℝ)..(z + h).im, g τ) - ∫ τ in (0 : ℝ)..z.im, g τ) ++ = ∫ τ in z.im..(z + h).im, g τ := ++ intervalIntegral.integral_interval_sub_left (μ := volume) (f := g) hInt1 hInt2 ++ ++ have h1 : ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ) := by ++ have hzph := def_If_z_plus_h hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf (z := z) (h := h) hz hzh ++ simpa [g] using hzph ++ have h2 : ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ ++ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ) := by ++ have hwdef := def_If_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw ++ simpa [g, w] using hwdef ++ ++ calc ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ ++ = ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ)) ++ - ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ)) := by ++ simp [h1, h2] ++ _ = (Complex.I * (∫ τ in (0 : ℝ)..(z + h).im, g τ)) ++ - (Complex.I * (∫ τ in (0 : ℝ)..z.im, g τ)) := by ++ simp [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] ++ _ = Complex.I * ++ ((∫ τ in (0 : ℝ)..(z + h).im, g τ) ++ - (∫ τ in (0 : ℝ)..z.im, g τ)) := by ++ simp [helper_mul_sub_complex] ++ _ = Complex.I * (∫ τ in z.im..(z + h).im, g τ) := by ++ simpa using congrArg (fun t => Complex.I * t) hinterval ++ _ = Complex.I * (∫ τ in z.im..(z + h).im, ++ f (((z + h).re : ℂ) + Complex.I * τ)) := by ++ simp [g] ++ ++lemma diff_If_w_z_initial_form_vertical ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ ++ = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by ++ simpa using ++ (diff_If_zh_w (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw) ++ ++lemma diff_If_w_z_initial_form ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im ++ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = (∫ t in z.re..w.re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (w.re + Complex.I * τ) - f (z.re + Complex.I * τ))) := by ++ intro w ++ ++ rw [def_If_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw] ++ rw [def_If_z hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz] ++ ++ have hw_re : w.re = (z + h).re := by simp [w] ++ have hw_im : w.im = z.im := by simp [w] ++ ++ have step1 : ++ ((∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ))) ++ - ((∫ t in (0 : ℝ)..z.re, f (t : ℂ)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) ++ = (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) - (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) ++ + Complex.I * ((∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) ++ - (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) := by ring ++ rw [step1] ++ ++ have horizontal_integrable_zh : IntervalIntegrable (fun t : ℝ => f (t : ℂ)) volume (0 : ℝ) (z + h).re := by ++ ++ apply ContinuousOn.intervalIntegrable ++ apply ContinuousOn.comp hf.continuousOn Complex.continuous_ofReal.continuousOn ++ intro t ht ++ simp [Metric.mem_closedBall, dist_eq_norm, Complex.norm_real] ++ ++ have : ‖z + h‖ ≤ r1 := by simp [← dist_zero_right]; exact Metric.mem_closedBall.mp hzh ++ have : |(z + h).re| ≤ ‖z + h‖ := Complex.abs_re_le_norm (z + h) ++ have : |t| ≤ |(z + h).re| := abs_le_abs_of_mem_uIcc_zero ht ++ linarith [le_of_lt hr1_lt_R] ++ ++ have horizontal_integrable_z : IntervalIntegrable (fun t : ℝ => f (t : ℂ)) volume (0 : ℝ) z.re := by ++ apply ContinuousOn.intervalIntegrable ++ apply ContinuousOn.comp hf.continuousOn Complex.continuous_ofReal.continuousOn ++ intro t ht ++ simp [Metric.mem_closedBall, dist_eq_norm, Complex.norm_real] ++ have : ‖z‖ ≤ r1 := by simp [← dist_zero_right]; exact Metric.mem_closedBall.mp hz ++ have : |z.re| ≤ ‖z‖ := Complex.abs_re_le_norm z ++ have : |t| ≤ |z.re| := abs_le_abs_of_mem_uIcc_zero ht ++ linarith [le_of_lt hr1_lt_R] ++ ++ have horizontal_eq : ++ (∫ t in (0 : ℝ)..(z + h).re, f (t : ℂ)) - (∫ t in (0 : ℝ)..z.re, f (t : ℂ)) ++ = ∫ t in z.re..(z + h).re, f (t : ℂ) := by ++ rw [← intervalIntegral.integral_interval_sub_left horizontal_integrable_zh horizontal_integrable_z] ++ ++ have vertical_integrable_zh : IntervalIntegrable (fun τ : ℝ => f (((z + h).re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := by ++ ++ rw [← hw_re, ← hw_im] ++ exact vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hw ++ ++ have vertical_integrable_z : IntervalIntegrable (fun τ : ℝ => f ((z.re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := ++ vertical_intervalIntegrable_of_mem_ball hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz ++ ++ have vertical_eq : ++ (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) ++ - (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) ++ = ∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ)) := by ++ rw [← intervalIntegral.integral_sub vertical_integrable_zh vertical_integrable_z] ++ ++ rw [horizontal_eq, vertical_eq, hw_re] ++ ++lemma scalar_mul_integral_sub {a b : ℝ} (c : ℂ) (f g : ℝ → ℂ) ++ (hf : IntervalIntegrable f volume a b) (hg : IntervalIntegrable g volume a b) : ++ c * (∫ x in a..b, f x) - c * (∫ x in a..b, g x) = c * (∫ x in a..b, f x - g x) := by ++ rw [← mul_sub] ++ rw [← intervalIntegral.integral_sub hf hg] ++ ++lemma algebraic_rearrangement_four_terms (a b c d : ℂ) : ++ a - b + c - d = 0 → c - d = b - a := by ++ intro h ++ ++ calc c - d ++ = (a - b + c - d) - (a - b) := by ring ++ _ = 0 - (a - b) := by rw [h] ++ _ = -(a - b) := by ring ++ _ = b - a := by ring ++ ++lemma real_between_as_convex_combination (b₁ b₂ t : ℝ) ++ (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : ++ ∃ lam : ℝ, 0 ≤ lam ∧ lam ≤ 1 ∧ t = (1 - lam) * b₁ + lam * b₂ := by ++ ++ cases' le_total b₁ b₂ with h₁ h₂ ++ case inl => ++ ++ have ht : b₁ ≤ t ∧ t ≤ b₂ := by ++ cases' h with h_left h_right ++ · exact h_left ++ · ++ exact ⟨le_trans h₁ h_right.1, le_trans h_right.2 h₁⟩ ++ ++ by_cases heq : b₁ = b₂ ++ · ++ use 0 ++ constructor ++ · norm_num ++ constructor ++ · norm_num ++ · rw [heq] at ht ⊢ ++ have : t = b₂ := le_antisymm ht.2 ht.1 ++ rw [this] ++ ring ++ · ++ have hlt : b₁ < b₂ := lt_of_le_of_ne h₁ heq ++ let lam := (t - b₁) / (b₂ - b₁) ++ use lam ++ constructor ++ · ++ apply div_nonneg ++ · linarith [ht.1] ++ · linarith [hlt] ++ constructor ++ · ++ rw [div_le_iff₀] ++ · linarith [ht.2] ++ · linarith [hlt] ++ · ++ unfold lam ++ have h_nonzero : b₂ - b₁ ≠ 0 := ne_of_gt (sub_pos.2 hlt) ++ field_simp [h_nonzero]; ring ++ case inr => ++ ++ have ht : b₂ ≤ t ∧ t ≤ b₁ := by ++ cases' h with h_left h_right ++ · ++ exact ⟨le_trans h₂ h_left.1, le_trans h_left.2 h₂⟩ ++ · exact h_right ++ ++ by_cases heq : b₁ = b₂ ++ · ++ use 0 ++ constructor ++ · norm_num ++ constructor ++ · norm_num ++ · rw [← heq] at ht ⊢ ++ have : t = b₁ := le_antisymm ht.2 ht.1 ++ rw [this, heq] ++ ring ++ · ++ have hlt : b₂ < b₁ := lt_of_le_of_ne h₂ (Ne.symm heq) ++ let lam := (b₁ - t) / (b₁ - b₂) ++ use lam ++ constructor ++ · ++ apply div_nonneg ++ · linarith [ht.2] ++ · linarith [hlt] ++ constructor ++ · ++ rw [div_le_iff₀] ++ · linarith [ht.1] ++ · linarith [hlt] ++ · ++ unfold lam ++ have h_nonzero : b₁ - b₂ ≠ 0 := ne_of_gt (sub_pos.2 hlt) ++ field_simp [h_nonzero]; ring ++ ++lemma convex_combination_mem_segment {E : Type*} [AddCommGroup E] [Module ℝ E] (x y : E) (t : ℝ) ++ (h₀ : 0 ≤ t) (h₁ : t ≤ 1) : ++ (1 - t) • x + t • y ∈ segment ℝ x y := by ++ ++ use (1 - t), t ++ constructor ++ · ++ linarith [h₁] ++ constructor ++ · ++ exact h₀ ++ constructor ++ · ++ ring ++ · ++ rfl ++ ++lemma vertical_line_in_segment (a : ℂ) (b₁ b₂ t : ℝ) ++ (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : ++ a + Complex.I * t ∈ segment ℝ (a + Complex.I * b₁) (a + Complex.I * b₂) := by ++ ++ obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination b₁ b₂ t h ++ ++ have h_convex : a + Complex.I * t = (1 - lam) • (a + Complex.I * b₁) + lam • (a + Complex.I * b₂) := by ++ ++ simp only [Complex.real_smul] ++ ++ rw [h_t_eq] ++ ++ simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] ++ ++ rw [mul_add] ++ ++ ring ++ ++ rw [h_convex] ++ exact convex_combination_mem_segment (a + Complex.I * b₁) (a + Complex.I * b₂) lam h_lam_nonneg h_lam_le_one ++ ++lemma horizontal_line_in_segment (a : ℝ) (b₁ b₂ t : ℝ) ++ (h : (b₁ ≤ t ∧ t ≤ b₂) ∨ (b₂ ≤ t ∧ t ≤ b₁)) : ++ (t : ℂ) + Complex.I * a ∈ segment ℝ ((b₁ : ℂ) + Complex.I * a) ((b₂ : ℂ) + Complex.I * a) := by ++ ++ obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination b₁ b₂ t h ++ ++ have h_convex : (t : ℂ) + Complex.I * a ++ = (1 - lam) • ((b₁ : ℂ) + Complex.I * a) + lam • ((b₂ : ℂ) + Complex.I * a) := by ++ simp only [Complex.real_smul] ++ ++ rw [h_t_eq] ++ simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] ++ ring ++ ++ simpa [h_convex] using ++ (convex_combination_mem_segment ((b₁ : ℂ) + Complex.I * a) ((b₂ : ℂ) + Complex.I * a) lam h_lam_nonneg h_lam_le_one) ++ ++lemma intervalIntegrable_of_continuousOn_range (f : ℂ → ℂ) (g : ℝ → ℂ) (a b : ℝ) (S : Set ℂ) ++ (hf : ContinuousOn f S) (hg : Continuous g) ++ (hrange : ∀ t ∈ Set.uIcc a b, g t ∈ S) : ++ IntervalIntegrable (f ∘ g) volume a b := by ++ ++ have h_comp : ContinuousOn (f ∘ g) (Set.uIcc a b) := by ++ apply ContinuousOn.comp hf (hg.continuousOn) hrange ++ ++ exact h_comp.intervalIntegrable ++ ++lemma intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball ++ {r1 R : ℝ} (hr1_lt_R : r1 < R) {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {a : ℂ} {b₁ b₂ : ℝ} ++ (h₁ : ‖a + Complex.I * b₁‖ ≤ r1) (h₂ : ‖a + Complex.I * b₂‖ ≤ r1) : ++ IntervalIntegrable (fun t => f (a + Complex.I * t)) volume b₁ b₂ := by ++ ++ apply intervalIntegrable_of_continuousOn_range f (fun t => a + Complex.I * ↑t) b₁ b₂ (Metric.closedBall (0 : ℂ) R) ++ · ++ exact AnalyticOnNhd.continuousOn hf ++ · ++ exact Continuous.add continuous_const (Continuous.mul continuous_const continuous_ofReal) ++ · ++ intro t ht ++ ++ have h_in_r1 : ‖a + Complex.I * ↑t‖ ≤ r1 := by ++ ++ have h_segment : a + Complex.I * ↑t ∈ segment ℝ (a + Complex.I * b₁) (a + Complex.I * b₂) := by ++ apply vertical_line_in_segment ++ exact Set.mem_uIcc.mp ht ++ ++ have h₁_mem : a + Complex.I * b₁ ∈ Metric.closedBall (0 : ℂ) r1 := by ++ rwa [Metric.mem_closedBall, dist_zero_right] ++ have h₂_mem : a + Complex.I * b₂ ∈ Metric.closedBall (0 : ℂ) r1 := by ++ rwa [Metric.mem_closedBall, dist_zero_right] ++ ++ have h_subset := (convex_closedBall (0 : ℂ) r1).segment_subset h₁_mem h₂_mem ++ have h_in_ball := h_subset h_segment ++ rwa [Metric.mem_closedBall, dist_zero_right] at h_in_ball ++ ++ rw [Metric.mem_closedBall, dist_zero_right] ++ exact le_trans h_in_r1 (le_of_lt hr1_lt_R) ++ ++lemma cauchy_for_rectangles ++ {r1 R R0 : ℝ} ++ (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z w : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : w ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzw : ((w.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1) ++ (hwz : ((z.re : ℂ) + Complex.I * w.im) ∈ Metric.closedBall (0 : ℂ) r1) : ++ (∫ x in z.re..w.re, f ((x : ℂ) + Complex.I * (z.im))) ++ - (∫ x in z.re..w.re, f ((x : ℂ) + Complex.I * (w.im))) ++ + Complex.I * (∫ y in z.im..w.im, f ((w.re : ℂ) + Complex.I * y)) ++ - Complex.I * (∫ y in z.im..w.im, f ((z.re : ℂ) + Complex.I * y)) = 0 := by ++ classical ++ ++ have hA : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ ++ have hz_eq : z = (z.re : ℂ) + Complex.I * z.im := by ++ exact (lem_wReIm z) ++ rwa [← hz_eq] ++ have hC : ((w.re : ℂ) + Complex.I * w.im) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ ++ have hw_eq : w = (w.re : ℂ) + Complex.I * w.im := by ++ exact (lem_wReIm w) ++ rwa [← hw_eq] ++ ++ have h_left_in_ball : ∀ y ∈ Set.uIcc z.im w.im, ++ ((z.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ intro y hy ++ have hseg : (z.re : ℂ) + Complex.I * (y : ℂ) ++ ∈ segment ℝ ((z.re : ℂ) + Complex.I * z.im) ((z.re : ℂ) + Complex.I * w.im) := by ++ simpa using vertical_line_in_segment (a := (z.re : ℂ)) (b₁ := z.im) (b₂ := w.im) (t := y) ++ (h := Set.mem_uIcc.mp hy) ++ exact (convex_closedBall (0 : ℂ) r1).segment_subset hA hwz hseg ++ have h_right_in_ball : ∀ y ∈ Set.uIcc z.im w.im, ++ ((w.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ intro y hy ++ have hseg : (w.re : ℂ) + Complex.I * (y : ℂ) ++ ∈ segment ℝ ((w.re : ℂ) + Complex.I * z.im) ((w.re : ℂ) + Complex.I * w.im) := by ++ simpa using vertical_line_in_segment (a := (w.re : ℂ)) (b₁ := z.im) (b₂ := w.im) (t := y) ++ (h := Set.mem_uIcc.mp hy) ++ exact (convex_closedBall (0 : ℂ) r1).segment_subset hzw hC hseg ++ have h_point_in_ball : ∀ x ∈ Set.uIcc z.re w.re, ∀ y ∈ Set.uIcc z.im w.im, ++ ((x : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ intro x hx y hy ++ have hL : ((z.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := h_left_in_ball y hy ++ have hR' : ((w.re : ℂ) + Complex.I * (y : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := h_right_in_ball y hy ++ ++ obtain ⟨lam, hlam0, hlam1, hx_eq⟩ := real_between_as_convex_combination z.re w.re x (Set.mem_uIcc.mp hx) ++ have hseg_horiz : (x : ℂ) + Complex.I * (y : ℂ) ++ ∈ segment ℝ ((z.re : ℂ) + Complex.I * (y : ℂ)) ((w.re : ℂ) + Complex.I * (y : ℂ)) := by ++ ++ have : (x : ℂ) + Complex.I * (y : ℂ) ++ = (1 - lam) • ((z.re : ℂ) + Complex.I * (y : ℂ)) + lam • ((w.re : ℂ) + Complex.I * (y : ℂ)) := by ++ simp only [Complex.real_smul] ++ ++ rw [hx_eq] ++ simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] ++ ring ++ simpa [this] using ++ (convex_combination_mem_segment ((z.re : ℂ) + Complex.I * (y : ℂ)) ((w.re : ℂ) + Complex.I * (y : ℂ)) lam hlam0 hlam1) ++ exact (convex_closedBall (0 : ℂ) r1).segment_subset hL hR' hseg_horiz ++ ++ set S := ([[z.re, w.re]] ×ℂ [[z.im, w.im]]) ++ have hS_subset_r1 : S ⊆ Metric.closedBall (0 : ℂ) r1 := by ++ intro p hp ++ have hx : p.re ∈ [[z.re, w.re]] := hp.1 ++ have hy : p.im ∈ [[z.im, w.im]] := hp.2 ++ ++ have : ((p.re : ℂ) + Complex.I * (p.im : ℂ)) ∈ Metric.closedBall (0 : ℂ) r1 := ++ h_point_in_ball p.re hx p.im hy ++ ++ have hp_eq : p = (p.re : ℂ) + Complex.I * (p.im : ℂ) := lem_wReIm p ++ rwa [hp_eq] ++ have hS_subset_R : S ⊆ Metric.closedBall (0 : ℂ) R := ++ fun p hp => (closedBall_mono_center0 (le_of_lt hr1_lt_R)) (hS_subset_r1 hp) ++ ++ have Hdiff : DifferentiableOn ℂ f S := by ++ intro p hp ++ have hpR : p ∈ Metric.closedBall (0 : ℂ) R := hS_subset_R hp ++ exact (hf p hpR).differentiableAt.differentiableWithinAt ++ ++ simpa [smul_eq_mul, mul_comm] using ++ Complex.integral_boundary_rect_eq_zero_of_differentiableOn f z w Hdiff ++ ++lemma cauchy_for_horizontal_strip ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ (∫ t in z.re..(z + h).re, f (t : ℂ)) ++ - (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) ++ + Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) ++ - Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) = 0 := by ++ ++ let z₀ : ℂ := (z.re : ℂ) ++ let w₀ : ℂ := (z + h).re + Complex.I * z.im ++ ++ have hz₀ : z₀ ∈ Metric.closedBall (0 : ℂ) r1 := by ++ have hz_norm : ‖z‖ ≤ r1 := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hz ++ have hzre_le : ‖(z.re : ℂ)‖ ≤ ‖z‖ := by ++ rw [Complex.norm_real] ++ exact Complex.abs_re_le_norm z ++ have : ‖z₀‖ ≤ r1 := le_trans hzre_le hz_norm ++ simpa [z₀, Metric.mem_closedBall, dist_eq_norm] using this ++ have hw₀ : w₀ ∈ Metric.closedBall (0 : ℂ) r1 := hw ++ ++ have hzw : ((w₀.re : ℂ) + Complex.I * z₀.im) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ ++ have h1 : ((w₀.re : ℂ) + Complex.I * z₀.im) = ((z + h).re : ℂ) := by ++ simp [w₀, z₀, Complex.ofReal_im, mul_zero, add_zero] ++ rw [h1] ++ have h2 : ‖((z + h).re : ℂ)‖ ≤ ‖z + h‖ := by ++ rw [Complex.norm_real] ++ exact Complex.abs_re_le_norm (z + h) ++ have h3 : ‖z + h‖ ≤ r1 := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hzh ++ simpa [Metric.mem_closedBall, dist_eq_norm] using le_trans h2 h3 ++ have hwz : ((z₀.re : ℂ) + Complex.I * w₀.im) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ ++ have h1 : ((z₀.re : ℂ) + Complex.I * w₀.im) = z := by ++ simp [z₀, w₀, Complex.ofReal_re] ++ exact (lem_wReIm z).symm ++ rw [h1] ++ exact hz ++ ++ have H := cauchy_for_rectangles (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz₀ hw₀ hzw hwz ++ ++ rw [(show z₀.re = z.re by simp [z₀])] at H ++ rw [(show z₀.im = (0 : ℝ) by simp [z₀])] at H ++ rw [(show w₀.re = (z + h).re by simp [w₀])] at H ++ rw [(show w₀.im = z.im by simp [w₀])] at H ++ ++ convert H using 1 ++ simp only [Complex.ofReal_zero, mul_zero, add_zero] ++ ++lemma integrability_from_cauchy_horizontal_strip ++ {r1 R R0 : ℝ} (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) r1) (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ IntervalIntegrable (fun τ => f (((z + h).re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im ∧ ++ IntervalIntegrable (fun τ => f ((z.re : ℂ) + Complex.I * τ)) volume (0 : ℝ) z.im := by ++ constructor ++ · ++ apply intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball hr1_lt_R hf ++ · ++ simp only [Complex.ofReal_zero, mul_zero, add_zero, Complex.norm_real] ++ rw [Metric.mem_closedBall, dist_zero_right] at hzh ++ exact le_trans (Complex.abs_re_le_norm (z + h)) hzh ++ · ++ rw [Metric.mem_closedBall, dist_zero_right] at hw ++ exact hw ++ · ++ apply intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball hr1_lt_R hf ++ · ++ simp only [Complex.ofReal_zero, mul_zero, add_zero, Complex.norm_real] ++ rw [Metric.mem_closedBall, dist_zero_right] at hz ++ exact le_trans (Complex.abs_re_le_norm z) hz ++ · ++ rw [Metric.mem_closedBall, dist_zero_right] at hz ++ rw [← lem_wReIm z] ++ exact hz ++ ++lemma cauchy_rearrangement_step1 ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ))) ++ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) - (∫ t in z.re..(z + h).re, f (t : ℂ)) := by ++ ++ have H := cauchy_for_horizontal_strip hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw ++ ++ have integrable := integrability_from_cauchy_horizontal_strip hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw ++ ++ have rearrange := algebraic_rearrangement_four_terms ++ (∫ t in z.re..(z + h).re, f (t : ℂ)) ++ (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) ++ (Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ))) ++ (Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ))) ++ H ++ ++ have vertical_linearity : ++ Complex.I * (∫ τ in (0 : ℝ)..z.im, f (((z + h).re : ℂ) + Complex.I * τ)) ++ - Complex.I * (∫ τ in (0 : ℝ)..z.im, f ((z.re : ℂ) + Complex.I * τ)) ++ = Complex.I * (∫ τ in (0 : ℝ)..z.im, (f (((z + h).re : ℂ) + Complex.I * τ) - f ((z.re : ℂ) + Complex.I * τ))) := by ++ rw [← mul_sub] ++ rw [← intervalIntegral.integral_sub integrable.1 integrable.2] ++ ++ rw [← vertical_linearity] ++ exact rearrange ++ ++lemma diff_If_w_z ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ ++ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) := by ++ ++ have initial_form := diff_If_w_z_initial_form hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw ++ ++ have rearrange_step := cauchy_rearrangement_step1 hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw ++ ++ have w_re_eq : (((z + h).re : ℂ) + Complex.I * z.im).re = (z + h).re := by ++ simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im, Complex.ofReal_im] ++ ++ simp_rw [initial_form, w_re_eq, rearrange_step] ++ ++ ring ++ ++lemma If_difference_is_L_path_integral ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) ++ + Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by ++ ++ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im ++ ++ calc If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ ++ = (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩) ++ + (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) := by ring ++ _ = Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) ++ + (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) := by ++ rw [diff_If_zh_w hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw, ++ diff_If_w_z hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw] ++ _ = (∫ t in z.re..(z + h).re, f (t + Complex.I * z.im)) ++ + Complex.I * (∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ)) := by ring ++ ++lemma If_diff_add_sub_identity ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = ++ (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z) + f z) ++ + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z) + f z) := by ++ ++ have H := ++ If_difference_is_L_path_integral (hr1_pos) (hr1_lt_R) (hR_lt_R0) (hR0_lt_one) hf hz hzh hw ++ simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using H ++ ++lemma intervalIntegrable_of_analyticOnNhd_of_horizontal_endpoints_in_smaller_ball ++ {r1 R : ℝ} (hr1_lt_R : r1 < R) {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {im_part : ℝ} {a b : ℝ} ++ (h₁ : ‖(a : ℂ) + Complex.I * im_part‖ ≤ r1) (h₂ : ‖(b : ℂ) + Complex.I * im_part‖ ≤ r1) : ++ IntervalIntegrable (fun t => f ((t : ℂ) + Complex.I * im_part)) volume a b := by ++ ++ apply intervalIntegrable_of_continuousOn_range f (fun t => (t : ℂ) + Complex.I * im_part) a b (Metric.closedBall (0 : ℂ) R) ++ · ++ exact AnalyticOnNhd.continuousOn hf ++ · ++ exact Continuous.add continuous_ofReal continuous_const ++ · ++ intro t ht ++ ++ have h_in_r1 : ‖(t : ℂ) + Complex.I * im_part‖ ≤ r1 := by ++ ++ have h_segment : (t : ℂ) + Complex.I * im_part ∈ segment ℝ ((a : ℂ) + Complex.I * im_part) ((b : ℂ) + Complex.I * im_part) := by ++ ++ obtain ⟨lam, h_lam_nonneg, h_lam_le_one, h_t_eq⟩ := real_between_as_convex_combination a b t (Set.mem_uIcc.mp ht) ++ ++ have h_convex : (t : ℂ) + Complex.I * im_part = (1 - lam) • ((a : ℂ) + Complex.I * im_part) + lam • ((b : ℂ) + Complex.I * im_part) := by ++ ++ simp only [Complex.real_smul] ++ ++ rw [h_t_eq] ++ ++ simp only [Complex.ofReal_add, Complex.ofReal_mul, Complex.ofReal_sub, Complex.ofReal_one] ++ ++ ring ++ ++ rw [h_convex] ++ exact convex_combination_mem_segment ((a : ℂ) + Complex.I * im_part) ((b : ℂ) + Complex.I * im_part) lam h_lam_nonneg h_lam_le_one ++ ++ have h₁_mem : (a : ℂ) + Complex.I * im_part ∈ Metric.closedBall (0 : ℂ) r1 := by ++ rwa [Metric.mem_closedBall, dist_zero_right] ++ have h₂_mem : (b : ℂ) + Complex.I * im_part ∈ Metric.closedBall (0 : ℂ) r1 := by ++ rwa [Metric.mem_closedBall, dist_zero_right] ++ ++ have h_subset := (convex_closedBall (0 : ℂ) r1).segment_subset h₁_mem h₂_mem ++ have h_in_ball := h_subset h_segment ++ rwa [Metric.mem_closedBall, dist_zero_right] at h_in_ball ++ ++ rw [Metric.mem_closedBall, dist_zero_right] ++ exact le_trans h_in_r1 (le_of_lt hr1_lt_R) ++ ++lemma If_diff_linearity ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = ++ ((∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) ++ + (∫ _t in z.re..(z + h).re, f z)) ++ + Complex.I * ++ ((∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) ++ + (∫ _τ in z.im..(z + h).im, f z)) := by ++ ++ have H := If_diff_add_sub_identity hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw ++ ++ have hz_norm : ‖z‖ ≤ r1 := by rwa [Metric.mem_closedBall, dist_zero_right] at hz ++ have hzh_norm : ‖z + h‖ ≤ r1 := by rwa [Metric.mem_closedBall, dist_zero_right] at hzh ++ have hw_norm : ‖((z + h).re : ℂ) + Complex.I * z.im‖ ≤ r1 := by ++ rwa [Metric.mem_closedBall, dist_zero_right] at hw ++ ++ have h_z_eq : z = (z.re : ℂ) + Complex.I * z.im := lem_wReIm z ++ have h_zh_eq : z + h = ((z + h).re : ℂ) + Complex.I * (z + h).im := lem_wReIm (z + h) ++ ++ have hz_endpoint : ‖(z.re : ℂ) + Complex.I * z.im‖ ≤ r1 := by rwa [← h_z_eq] ++ have h_horiz_integrable := intervalIntegrable_of_analyticOnNhd_of_horizontal_endpoints_in_smaller_ball ++ hr1_lt_R hf hz_endpoint hw_norm ++ ++ have hzh_endpoint : ‖((z + h).re : ℂ) + Complex.I * (z + h).im‖ ≤ r1 := by rwa [← h_zh_eq] ++ have h_vert_integrable := intervalIntegrable_of_analyticOnNhd_of_endpoints_in_smaller_ball ++ hr1_lt_R hf hw_norm hzh_endpoint ++ ++ have h_const_horiz : IntervalIntegrable (fun _ => f z) volume z.re (z + h).re := intervalIntegrable_const ++ have h_const_vert : IntervalIntegrable (fun _ => f z) volume z.im (z + h).im := intervalIntegrable_const ++ ++ have h_diff_horiz : IntervalIntegrable (fun t => f (t + Complex.I * z.im) - f z) volume z.re (z + h).re := ++ IntervalIntegrable.sub h_horiz_integrable h_const_horiz ++ ++ have h_diff_vert : IntervalIntegrable (fun τ => f (((z + h).re : ℂ) + Complex.I * τ) - f z) volume z.im (z + h).im := ++ IntervalIntegrable.sub h_vert_integrable h_const_vert ++ ++ have h1 : ∫ t in z.re..(z + h).re, ((f (t + Complex.I * z.im) - f z) + f z) = ++ (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) + (∫ t in z.re..(z + h).re, f z) := ++ intervalIntegral.integral_add h_diff_horiz h_const_horiz ++ ++ have h2 : ∫ τ in z.im..(z + h).im, ((f (((z + h).re : ℂ) + Complex.I * τ) - f z) + f z) = ++ (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) + (∫ τ in z.im..(z + h).im, f z) := ++ intervalIntegral.integral_add h_diff_vert h_const_vert ++ ++ rw [H, h1, h2, mul_add] ++ ++lemma integral_of_constant_over_L_path ++ {r1 R R0 : ℝ} ++ (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (_hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (_hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : ++ (∫ _t in z.re..(z + h).re, f z) + Complex.I * (∫ _τ in z.im..(z + h).im, f z) ++ = f z * h := by ++ ++ rw [intervalIntegral.integral_const, intervalIntegral.integral_const] ++ ++ rw [Complex.add_re, Complex.add_im] ++ simp only [add_sub_cancel_left] ++ ++ rw [Complex.real_smul, Complex.real_smul] ++ ++ rw [← mul_assoc] ++ ++ rw [← add_mul] ++ ++ rw [mul_comm Complex.I (↑h.im)] ++ ++ rw [Complex.re_add_im h] ++ ++ rw [mul_comm] ++ ++noncomputable def Err ++ {r1 R R0 : ℝ} ++ (_hr1_pos : 0 < r1) (_hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) ++ (f : ℂ → ℂ) ++ (_hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ (z h : ℂ) : ℂ := ++ (∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) ++ + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)) ++ ++lemma CD_eq_fz_h ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) : ++ (∫ _t in z.re..(z + h).re, f z) + Complex.I * (∫ _τ in z.im..(z + h).im, f z) ++ = f z * h := by ++ simpa using ++ integral_of_constant_over_L_path (r1:=r1) (R:=R) (R0:=R0) ++ hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh ++ ++lemma If_diff_decomposition_final ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = f z * h ++ + Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h := by ++ ++ have H := ++ If_diff_linearity (hr1_pos) (hr1_lt_R) (hR_lt_R0) (hR0_lt_one) ++ (f := f) (hf := hf) ++ (z := z) (h := h) ++ (hz := hz) (hzh := hzh) (hw := hw) ++ ++ let A : ℂ := ∫ t in z.re..(z + h).re, f (t + Complex.I * z.im) - f z ++ let B : ℂ := ∫ t in z.re..(z + h).re, f z ++ let C : ℂ := ∫ τ in z.im..(z + h).im, f (((z + h).re : ℂ) + Complex.I * τ) - f z ++ let D : ℂ := ∫ τ in z.im..(z + h).im, f z ++ ++ have hH' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = (A + B) + Complex.I * (C + D) := by ++ simpa [A, B, C, D, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using H ++ ++ have hsplit : (A + B) + Complex.I * (C + D) ++ = (A + Complex.I * C) + (B + Complex.I * D) := by ring ++ have hH'' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = (A + Complex.I * C) + (B + Complex.I * D) := by ++ simpa [hsplit] using hH' ++ ++ have hBD : (B + Complex.I * D) = f z * h := by ++ simpa [B, D] using ++ integral_of_constant_over_L_path (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh ++ have hH''' : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = (A + Complex.I * C) + f z * h := by ++ simpa [hBD] using hH'' ++ ++ have hH4 : (If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ ++ - If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩) ++ = Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h + f z * h := by ++ simpa [Err, A, C, add_comm, add_left_comm, add_assoc] using hH''' ++ ++ simpa [Err, add_comm, add_left_comm, add_assoc] using hH4 ++ ++noncomputable def S_horiz (z h : ℂ) (f : ℂ → ℂ) : ℝ := ++ sSup {r | ∃ t ∈ Set.uIcc z.re (z + h).re, ++ r = ‖f (t + Complex.I * z.im) - f z‖} ++ ++noncomputable def S_vert (z h : ℂ) (f : ℂ → ℂ) : ℝ := ++ sSup {r | ∃ τ ∈ Set.uIcc z.im (z + h).im, ++ r = ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖} ++ ++noncomputable def S_max (z h : ℂ) (f : ℂ → ℂ) : ℝ := ++ max (S_horiz z h f) (S_vert z h f) ++ ++lemma bound_on_Err ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) : ++ ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h‖ ++ ≤ |h.re| * S_max z h f + |h.im| * S_max z h f := by ++ ++ unfold Err ++ ++ have hsplit : ++ ‖(∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) ++ + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ ++ ≤ ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ ++ + ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ := ++ norm_add_le _ _ ++ ++ have hI : ‖Complex.I‖ = (1 : ℝ) := by simp ++ have hvertnorm : ++ ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ ++ = ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ := by ++ simp [hI, one_mul] ++ ++ set SH : Set ℝ := {r | ∃ t ∈ Set.uIcc z.re (z + h).re, ++ r = ‖f (t + Complex.I * z.im) - f z‖} ++ have hbdd_SH : BddAbove SH := by ++ classical ++ ++ have hK : IsCompact (Set.uIcc z.re (z + h).re) := isCompact_uIcc ++ ++ let γ : ℝ → ℂ := fun t => (t : ℂ) + Complex.I * z.im ++ have hγ_cont : Continuous γ := by ++ convert (Complex.continuous_ofReal.add (continuous_const (y := Complex.I * (z.im : ℂ)))) using 1 ++ have hz_mem : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ simp only [Metric.mem_closedBall, dist_zero_right] ++ rw [show (z.re : ℂ) + Complex.I * z.im = z.re + z.im * Complex.I by ring] ++ rw [Complex.re_add_im] ++ rwa [Metric.mem_closedBall, dist_zero_right] at hz ++ have hw_mem : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hw ++ have hseg_subset : ++ (γ '' Set.uIcc z.re (z + h).re) ⊆ Metric.closedBall (0 : ℂ) r1 := by ++ intro w hwim ++ rcases hwim with ⟨t, ht, rfl⟩ ++ ++ have hseg : ((t : ℂ) + Complex.I * z.im) ++ ∈ segment ℝ ((z.re : ℂ) + Complex.I * z.im) ++ (((z + h).re : ℂ) + Complex.I * z.im) := by ++ ++ have := horizontal_line_in_segment (a := z.im) (b₁ := z.re) (b₂ := (z + h).re) ++ (t := t) (by simpa [Set.mem_uIcc] using ht) ++ simpa using this ++ have hz_in : ((z.re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := hz_mem ++ have hw_in : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := hw_mem ++ have hsubset := (convex_closedBall (0 : ℂ) r1).segment_subset hz_in hw_in ++ have hw' := hsubset hseg ++ simpa [Metric.mem_closedBall, dist_zero_right] using hw' ++ have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn ++ ++ have hmaps : Set.MapsTo γ (Set.uIcc z.re (z + h).re) (Metric.closedBall (0 : ℂ) R) := by ++ intro t ht ++ have himg_r1 : γ t ∈ Metric.closedBall (0 : ℂ) r1 := by ++ exact hseg_subset (Set.mem_image_of_mem _ ht) ++ exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) himg_r1 ++ have hcont_on : ContinuousOn (fun t => f (γ t)) (Set.uIcc z.re (z + h).re) := by ++ convert (ContinuousOn.comp (hf_cont) (hγ_cont.continuousOn) hmaps) using 1; rfl ++ ++ have hψ : Continuous (fun w : ℂ => ‖w - f z‖) := ++ (continuous_id.sub continuous_const).norm ++ have hR_cont : ContinuousOn (fun t => ‖f (γ t) - f z‖) (Set.uIcc z.re (z + h).re) := by ++ ++ have h_cont_sub : ContinuousOn (fun t => f (γ t) - f z) (Set.uIcc z.re (z + h).re) := ++ hcont_on.sub continuousOn_const ++ ++ exact h_cont_sub.norm ++ ++ have himage_compact : IsCompact ((fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re) := ++ IsCompact.image_of_continuousOn hK hR_cont ++ ++ have hSH_eq : SH = (fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re := by ++ ext r; constructor ++ · intro hr; rcases hr with ⟨t, ht, rfl⟩; exact ⟨t, ht, rfl⟩ ++ · intro hr; rcases hr with ⟨t, ht, rfl⟩; exact ⟨t, ht, rfl⟩ ++ ++ have : BddAbove ((fun t => ‖f (γ t) - f z‖) '' Set.uIcc z.re (z + h).re) := ++ himage_compact.bddAbove ++ simpa [hSH_eq] using this ++ ++ set SV : Set ℝ := {r | ∃ τ ∈ Set.uIcc z.im (z + h).im, ++ r = ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖} ++ have hbdd_SV : BddAbove SV := by ++ classical ++ ++ have hK : IsCompact (Set.uIcc z.im (z + h).im) := isCompact_uIcc ++ let γv : ℝ → ℂ := fun τ => ((z + h).re : ℂ) + Complex.I * τ ++ have hγv_cont : Continuous γv := by ++ have hmul : Continuous (fun τ : ℝ => Complex.I * (τ : ℂ)) := by ++ exact continuous_const.mul Complex.continuous_ofReal ++ simp only [γv] ++ exact continuous_const.add hmul ++ have hw_mem' : (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ simpa [Metric.mem_closedBall, dist_zero_right] using hw ++ have hzh_mem : (((z + h).re : ℂ) + Complex.I * (z + h).im) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ simp only [Metric.mem_closedBall, dist_zero_right] ++ rw [show ((z + h).re : ℂ) + Complex.I * (z + h).im = (z + h).re + (z + h).im * Complex.I by ring] ++ rw [Complex.re_add_im] ++ rwa [Metric.mem_closedBall, dist_zero_right] at hzh ++ have hseg_subset : ++ (γv '' Set.uIcc z.im (z + h).im) ⊆ Metric.closedBall (0 : ℂ) r1 := by ++ intro w hwim; rcases hwim with ⟨τ, hτ, rfl⟩ ++ have hseg : (((z + h).re : ℂ) + Complex.I * τ) ++ ∈ segment ℝ (((z + h).re : ℂ) + Complex.I * z.im) ++ (((z + h).re : ℂ) + Complex.I * (z + h).im) := by ++ have := vertical_line_in_segment (((z + h).re : ℂ)) (b₁ := z.im) (b₂ := (z + h).im) (t := τ) ++ (by simpa [Set.mem_uIcc] using hτ) ++ simpa using this ++ have hz_in := hw_mem' ++ have hw_in := hzh_mem ++ have hsubset := (convex_closedBall (0 : ℂ) r1).segment_subset hz_in hw_in ++ have hw' := hsubset hseg ++ simp only [Metric.mem_closedBall, dist_zero_right] at hw' ++ rwa [Metric.mem_closedBall, dist_zero_right] ++ have hmaps : Set.MapsTo γv (Set.uIcc z.im (z + h).im) (Metric.closedBall (0 : ℂ) R) := by ++ intro τ hτ; have : γv τ ∈ Metric.closedBall (0 : ℂ) r1 := hseg_subset (Set.mem_image_of_mem _ hτ) ++ exact (closedBall_mono_center0 (le_of_lt hr1_lt_R)) this ++ have hf_cont : ContinuousOn f (Metric.closedBall (0 : ℂ) R) := hf.continuousOn ++ have hcont_on : ContinuousOn (fun τ => f (γv τ)) (Set.uIcc z.im (z + h).im) := by ++ convert (ContinuousOn.comp (hf_cont) (hγv_cont.continuousOn) hmaps) using 1; rfl ++ have hψ : Continuous (fun w : ℂ => ‖w - f z‖) := ++ (continuous_id.sub continuous_const).norm ++ have hR_cont : ContinuousOn (fun τ => ‖f (γv τ) - f z‖) (Set.uIcc z.im (z + h).im) := by ++ have h1 : ContinuousOn (fun τ => f (γv τ) - f z) (Set.uIcc z.im (z + h).im) := by ++ exact hcont_on.sub continuousOn_const ++ exact h1.norm ++ have himage_compact : IsCompact ((fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im) := ++ IsCompact.image_of_continuousOn hK hR_cont ++ have hSV_eq : SV = (fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im := by ++ ext r; constructor ++ · intro hr; rcases hr with ⟨τ, hτ, rfl⟩; exact ⟨τ, hτ, rfl⟩ ++ · intro hr; rcases hr with ⟨τ, hτ, rfl⟩; exact ⟨τ, hτ, rfl⟩ ++ have : BddAbove ((fun τ => ‖f (γv τ) - f z‖) '' Set.uIcc z.im (z + h).im) := ++ himage_compact.bddAbove ++ simpa [hSV_eq] using this ++ ++ have hC_horiz : ∀ t ∈ Set.uIcc z.re (z + h).re, ++ ‖(f (t + Complex.I * z.im) - f z)‖ ≤ S_horiz z h f := by ++ intro t ht ++ have hx : ‖f (t + Complex.I * z.im) - f z‖ ∈ SH := ⟨t, ht, rfl⟩ ++ ++ have : S_horiz z h f = sSup SH := rfl ++ simpa [this] using (le_csSup hbdd_SH hx) ++ ++ have hC_vert : ∀ τ ∈ Set.uIcc z.im (z + h).im, ++ ‖(f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ ≤ S_vert z h f := by ++ intro τ hτ ++ have hx : ‖f (((z + h).re : ℂ) + Complex.I * τ) - f z‖ ∈ SV := ⟨τ, hτ, rfl⟩ ++ have : S_vert z h f = sSup SV := rfl ++ simpa [this] using (le_csSup hbdd_SV hx) ++ ++ have hH : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ ++ ≤ |(z + h).re - z.re| * S_horiz z h f := by ++ ++ have h_bound : ∀ t, t ∈ [[z.re, (z + h).re]] → ‖f (↑t + Complex.I * ↑z.im) - f z‖ ≤ S_horiz z h f := by ++ intro t ht; exact hC_horiz t ht ++ have h_int : ∀ t ∈ Ι z.re (z + h).re, ‖f (↑t + Complex.I * ↑z.im) - f z‖ ≤ S_horiz z h f := by ++ intro t ht ++ have ht_uIcc : t ∈ Set.uIcc z.re (z + h).re := by ++ ++ exact Set.uIoc_subset_uIcc ht ++ exact h_bound t ht_uIcc ++ have := intervalIntegral.norm_integral_le_of_norm_le_const h_int ++ convert this using 1 ++ ring ++ ++ have hV : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ ++ ≤ |(z + h).im - z.im| * S_vert z h f := by ++ have h_bound : ∀ τ, τ ∈ [[z.im, (z + h).im]] → ‖f (↑(z + h).re + Complex.I * ↑τ) - f z‖ ≤ S_vert z h f := by ++ intro τ hτ; exact hC_vert τ hτ ++ have h_int : ∀ τ ∈ Ι z.im (z + h).im, ‖f (↑(z + h).re + Complex.I * ↑τ) - f z‖ ≤ S_vert z h f := by ++ intro τ hτ ++ have hτ_uIcc : τ ∈ Set.uIcc z.im (z + h).im := by ++ ++ exact Set.uIoc_subset_uIcc hτ ++ exact h_bound τ hτ_uIcc ++ have := intervalIntegral.norm_integral_le_of_norm_le_const h_int ++ rwa [mul_comm] at this ++ ++ have hre' : (z + h).re - z.re = h.re := by ++ simp [Complex.add_re] ++ have him' : (z + h).im - z.im = h.im := by ++ simp [Complex.add_im] ++ have hre : |(z + h).re - z.re| = |h.re| := by simp ++ have him : |(z + h).im - z.im| = |h.im| := by simp ++ ++ have hH' : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ ++ ≤ |h.re| * S_max z h f := by ++ have : S_horiz z h f ≤ S_max z h f := by exact le_max_left _ _ ++ ++ have hH_rewritten : ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ ≤ |h.re| * S_horiz z h f := by ++ rwa [hre] at hH ++ ++ have h_bound := mul_le_mul_of_nonneg_left this (abs_nonneg (h.re)) ++ exact le_trans hH_rewritten h_bound ++ ++ have hV' : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ ++ ≤ |h.im| * S_max z h f := by ++ have : S_vert z h f ≤ S_max z h f := by exact le_max_right _ _ ++ ++ have hV_rewritten : ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ ≤ |h.im| * S_vert z h f := by ++ rwa [him] at hV ++ ++ have h_bound := mul_le_mul_of_nonneg_left this (abs_nonneg (h.im)) ++ exact le_trans hV_rewritten h_bound ++ ++ have := ++ calc ++ ‖(∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)) ++ + Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ ++ ≤ ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ ++ + ‖Complex.I * (∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z))‖ := hsplit ++ _ = ‖∫ t in z.re..(z + h).re, (f (t + Complex.I * z.im) - f z)‖ ++ + ‖∫ τ in z.im..(z + h).im, (f (((z + h).re : ℂ) + Complex.I * τ) - f z)‖ := by simp ++ _ ≤ |h.re| * S_max z h f + |h.im| * S_max z h f := add_le_add hH' hV' ++ ++ simpa [Err] using this ++ ++lemma S_horiz_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_horiz z h f := by ++ ++ unfold S_horiz ++ apply Real.sSup_nonneg ++ intro r hr; rcases hr with ⟨t, ht, rfl⟩; exact norm_nonneg _ ++ ++lemma S_max_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_max z h f := by ++ unfold S_max ++ have h1 : 0 ≤ S_horiz z h f := S_horiz_nonneg z h f ++ exact le_trans h1 (le_max_left _ _) ++ ++lemma bound_on_Err_ratio ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) r1) ++ (hw : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) r1) ++ (hh : h ≠ 0) : ++ ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ ≤ 2 * S_max z h f := by ++ ++ have h_abs_eq : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ = ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ := rfl ++ ++ have h1 := bound_on_Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz hzh hw ++ ++ rw [← add_mul] at h1 ++ ++ have h_norm_pos : 0 < ‖h‖ := norm_pos_iff.mpr hh ++ ++ have h2 : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h‖ / ‖h‖ ≤ ++ (|h.re| + |h.im|) * S_max z h f / ‖h‖ := by ++ exact div_le_div_of_nonneg_right h1 (le_of_lt h_norm_pos) ++ ++ rw [← norm_div] at h2 ++ ++ have h2' : ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ ≤ ++ (|h.re| + |h.im|) / ‖h‖ * S_max z h f := by ++ rw [← div_mul_eq_mul_div] at h2 ++ exact h2 ++ ++ have h3 : |h.re| + |h.im| ≤ 2 * ‖h‖ := by ++ ++ calc |h.re| + |h.im| ++ ≤ ‖h‖ + ‖h‖ := add_le_add (Complex.abs_re_le_norm h) (Complex.abs_im_le_norm h) ++ _ = 2 * ‖h‖ := by ring ++ ++ have h4 : (|h.re| + |h.im|) / ‖h‖ ≤ 2 := by ++ ++ rw [div_le_iff₀ h_norm_pos] ++ exact h3 ++ ++ calc ‖Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h‖ ++ ≤ (|h.re| + |h.im|) / ‖h‖ * S_max z h f := h2' ++ _ ≤ 2 * S_max z h f := mul_le_mul_of_nonneg_right h4 (S_max_nonneg z h f) ++open Filter Topology ++ ++lemma abs_horizontal_diff_eq_abs_real (z : ℂ) (t : ℝ) : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := by ++ ++ have h : (t : ℂ) + Complex.I * z.im - z = (t - z.re : ℂ) := by ++ apply Complex.ext_iff.mpr ++ constructor ++ · ++ simp only [Complex.add_re, Complex.sub_re, Complex.ofReal_re, Complex.mul_re, ++ Complex.I_re, Complex.I_im, Complex.ofReal_im] ++ ring ++ · ++ simp only [Complex.add_im, Complex.sub_im, Complex.ofReal_im, Complex.mul_im, ++ Complex.I_re, Complex.I_im, Complex.ofReal_re] ++ ring ++ ++ rw [h] ++ ++ rw [← Complex.ofReal_sub] ++ ++ rw [Complex.norm_real, Real.norm_eq_abs] ++ ++lemma abs_sub_le_of_mem_uIcc (a b t : ℝ) (ht : t ∈ Set.uIcc a b) : |t - a| ≤ |b - a| ∧ |b - t| ≤ |b - a| := by ++ ++ have h1 : a ≤ b ∨ b ≤ a := le_total a b ++ rcases h1 with hle | hle ++ · ++ have ht' : t ∈ Set.Icc a b := by simpa [Set.uIcc_of_le hle] using ht ++ have h_bounds : a ≤ t ∧ t ≤ b := by simpa using ht' ++ constructor ++ · have h_ta : |t - a| = t - a := by simp [abs_of_nonneg (sub_nonneg.mpr h_bounds.left)] ++ have h_ba : |b - a| = b - a := by simp [abs_of_nonneg (sub_nonneg.mpr hle)] ++ rw [h_ta, h_ba] ++ exact sub_le_sub_right h_bounds.right a ++ · have h_bt : |b - t| = b - t := by simp [abs_of_nonneg (sub_nonneg.mpr h_bounds.right)] ++ have h_ba : |b - a| = b - a := by simp [abs_of_nonneg (sub_nonneg.mpr hle)] ++ rw [h_bt, h_ba] ++ exact sub_le_sub_left h_bounds.left b ++ · ++ have ht' : t ∈ Set.Icc b a := by ++ rw [Set.uIcc_comm] at ht ++ simpa [Set.uIcc_of_le hle] using ht ++ have h_bounds : b ≤ t ∧ t ≤ a := by simpa using ht' ++ constructor ++ · have h_ta : |t - a| = a - t := by simp [abs_of_nonpos (sub_nonpos.mpr h_bounds.right)] ++ have h_ba : |b - a| = a - b := by simp [abs_of_nonpos (sub_nonpos.mpr hle)] ++ rw [h_ta, h_ba] ++ exact sub_le_sub_left h_bounds.left a ++ · have h_bt : |b - t| = t - b := by ++ rw [abs_of_nonpos (sub_nonpos.mpr h_bounds.left)] ++ ring ++ have h_ba : |b - a| = a - b := by simp [abs_of_nonpos (sub_nonpos.mpr hle)] ++ rw [h_bt, h_ba] ++ exact sub_le_sub_right h_bounds.right b ++ ++lemma sub_ofReal_add_I (a b c d : ℝ) : ((a : ℂ) + Complex.I * b) - ((c : ℂ) + Complex.I * d) = ((a - c : ℝ) : ℂ) + Complex.I * (b - d) := by ++ apply Complex.ext ++ · ++ simp only [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.I_mul_re, Complex.ofReal_im, neg_zero, add_zero] ++ ++ rw [← Complex.ofReal_sub, Complex.ofReal_im, neg_zero, add_zero] ++ · ++ simp only [Complex.sub_im, Complex.add_im, Complex.ofReal_im, Complex.I_mul_im, Complex.ofReal_re, zero_add] ++ ++ rw [← Complex.ofReal_sub, Complex.ofReal_re] ++ ++lemma abs_re_im_bound (a b : ℝ) : ‖(a : ℂ) + Complex.I * b‖ ≤ |a| + |b| := by ++ ++ have triangle := lem_triangle_ineq (a : ℂ) (Complex.I * (b : ℂ)) ++ convert triangle ++ · ++ simp [Complex.norm_real, Real.norm_eq_abs] ++ · ++ simp [Complex.norm_I, Complex.norm_real, Real.norm_eq_abs] ++ ++lemma norm_ofReal (x : ℝ) : ‖(x : ℂ)‖ = |x| := by ++ simp [Complex.norm_real, Real.norm_eq_abs] ++ ++lemma norm_I_mul_ofReal (b : ℝ) : ‖Complex.I * (b : ℂ)‖ = |b| := by ++ simp [Complex.norm_I, Complex.norm_real, Real.norm_eq_abs] ++ ++lemma abs_add_Ile (a b : ℝ) : ‖(a : ℂ) + Complex.I * b‖ ≤ |a| + |b| := by ++ ++ have h := Complex.norm_le_abs_re_add_abs_im (a + Complex.I * b) ++ ++ have re_eq : (a + Complex.I * b).re = a := by ++ simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im] ++ have im_eq : (a + Complex.I * b).im = b := by ++ simp [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im] ++ rw [re_eq, im_eq] at h ++ exact h ++ ++lemma abs_vertical_diff_le_core (z h : ℂ) (τ : ℝ) : ‖((z + h).re - z.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |(z + h).re - z.re| + |τ - z.im| := by ++ ++ let a : ℝ := (z + h).re - z.re ++ let b : ℝ := τ - z.im ++ ++ have h_eq : ((z + h).re - z.re : ℝ) + Complex.I * (τ - z.im) = (a : ℂ) + Complex.I * (b : ℂ) := by ++ simp only [a, b] ++ ++ rw [← Complex.ofReal_sub τ z.im] ++ ++ rw [h_eq] ++ have triangle := Complex.norm_le_abs_re_add_abs_im ((a : ℂ) + Complex.I * (b : ℂ)) ++ ++ have re_calc : ((a : ℂ) + Complex.I * (b : ℂ)).re = a := by ++ simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.ofReal_im] ++ ring ++ ++ have im_calc : ((a : ℂ) + Complex.I * (b : ℂ)).im = b := by ++ simp only [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.I_im, Complex.ofReal_re] ++ ring ++ ++ rw [re_calc, im_calc] at triangle ++ simp only [a, b] at triangle ++ exact triangle ++ ++lemma abs_vertical_core (z h : ℂ) (τ : ℝ) : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |h.re| + |τ - z.im| := by ++ ++ have h1 : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |((h.re : ℝ) + Complex.I * (τ - z.im)).re| + |((h.re : ℝ) + Complex.I * (τ - z.im)).im| := by ++ apply Complex.norm_le_abs_re_add_abs_im ++ ++ have h2 : ((h.re : ℝ) + Complex.I * (τ - z.im)).re = h.re := by simp ++ have h3 : ((h.re : ℝ) + Complex.I * (τ - z.im)).im = τ - z.im := by simp ++ ++ rw [h2, h3] at h1 ++ exact h1 ++ ++lemma S_vert_nonneg (z h : ℂ) (f : ℂ → ℂ) : 0 ≤ S_vert z h f := by ++ unfold S_vert ++ apply Real.sSup_nonneg ++ intro r hr; rcases hr with ⟨τ, hτ, rfl⟩; exact norm_nonneg _ ++ ++lemma abs_im_le_norm (z : ℂ) : |z.im| ≤ ‖z‖ := by ++ exact Complex.abs_im_le_norm z ++ ++lemma mem_closedBall_mono_radius {z : ℂ} {r R : ℝ} (hz : z ∈ Metric.closedBall (0 : ℂ) r) (h : r ≤ R) : z ∈ Metric.closedBall (0 : ℂ) R := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using le_trans (by simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz) h ++ ++lemma tendsto_of_nonneg_local_bound {g : ℂ → ℝ} ++ (h_nonneg : ∀ h, 0 ≤ g h) ++ (h_loc : ∀ ε > 0, ∃ δ > 0, ∀ h, ‖h‖ < δ → g h ≤ ε) : ++ Tendsto g (𝓝 (0:ℂ)) (𝓝 (0:ℝ)) := by ++ rw [Metric.tendsto_nhds_nhds] ++ intro ε hε ++ ++ have hε_half : (0 : ℝ) < ε / 2 := by linarith ++ obtain ⟨δ, hδ_pos, hδ⟩ := h_loc (ε / 2) hε_half ++ use δ ++ exact ⟨hδ_pos, fun h hh_dist => by ++ rw [Real.dist_eq, sub_zero] ++ rw [abs_of_nonneg (h_nonneg h)] ++ have : g h ≤ ε / 2 := hδ h (by rwa [Complex.dist_eq, sub_zero] at hh_dist) ++ linarith⟩ ++ ++lemma sum_abs_le_two_mul {x y A : ℝ} (hx : |x| ≤ A) (hy : |y| ≤ A) : |x| + |y| ≤ (2:ℝ) * A := by ++ have := add_le_add hx hy ++ simpa [two_mul] using this ++ ++lemma two_norm_lt_of_norm_lt_half {h : ℂ} {δ : ℝ} (_hpos : 0 < δ) (hbound : ‖h‖ < δ/2) : (2:ℝ) * ‖h‖ < δ := by ++ have := mul_lt_mul_of_pos_left hbound (by norm_num : (0:ℝ) < 2) ++ simpa [two_mul, add_halves] using this ++ ++lemma limit_of_S_is_zero ++ {r1 R R0 : ℝ} ++ (_hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (_hR_lt_R0 : R < R0) (_hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : ++ Tendsto (fun h => S_max z h f) (𝓝 0) (𝓝 0) := by ++ ++ have f_cont_at_z : ContinuousAt f z := by ++ ++ have hz_in_R : z ∈ Metric.closedBall (0 : ℂ) R := ++ mem_closedBall_mono_radius hz (le_of_lt hr1_lt_R) ++ ++ exact (hf z hz_in_R).continuousAt ++ ++ apply tendsto_of_nonneg_local_bound ++ · ++ exact fun h => S_max_nonneg z h f ++ · ++ intro ε hε_pos ++ ++ rw [Metric.continuousAt_iff] at f_cont_at_z ++ obtain ⟨δ₁, hδ₁_pos, hf_bound⟩ := f_cont_at_z ε hε_pos ++ ++ use δ₁ / 2 ++ constructor ++ · exact half_pos hδ₁_pos ++ · intro h hh_norm ++ ++ unfold S_max ++ apply max_le ++ ++ · unfold S_horiz ++ ++ apply Real.sSup_le ++ · ++ intro r hr ++ obtain ⟨t, ht, rfl⟩ := hr ++ ++ have key_dist : dist ((t : ℂ) + Complex.I * z.im) z < δ₁ := by ++ ++ rw [dist_eq] ++ ++ have eq_transform : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := abs_horizontal_diff_eq_abs_real z t ++ simp [eq_transform] ++ ++ have t_bound : |t - z.re| ≤ |(z + h).re - z.re| := (abs_sub_le_of_mem_uIcc z.re (z + h).re t ht).1 ++ have re_diff_le : |(z + h).re - z.re| ≤ ‖h‖ := by ++ ++ simpa [Complex.add_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using (Complex.abs_re_le_norm h) ++ have h_bound : ‖h‖ < δ₁ / 2 := hh_norm ++ calc |t - z.re| ++ _ ≤ |(z + h).re - z.re| := t_bound ++ _ ≤ ‖h‖ := re_diff_le ++ _ < δ₁ / 2 := h_bound ++ _ < δ₁ := by linarith ++ ++ have f_dist := hf_bound key_dist ++ ++ rw [dist_eq] at f_dist ++ ++ exact le_of_lt f_dist ++ · ++ exact le_of_lt hε_pos ++ ++ · unfold S_vert ++ apply Real.sSup_le ++ · ++ intro r hr ++ obtain ⟨τ, hτ, rfl⟩ := hr ++ ++ have key_dist : dist (((z + h).re : ℂ) + Complex.I * τ) z < δ₁ := by ++ rw [dist_eq] ++ ++ have h_eq : (((z + h).re : ℂ) + Complex.I * τ - z) = (h.re : ℝ) + Complex.I * (τ - z.im) := by ++ apply Complex.ext_iff.mpr ++ constructor ++ · simp [Complex.add_re, Complex.sub_re] ++ · simp [Complex.add_im, Complex.sub_im] ++ rw [h_eq] ++ ++ have τ_bound0 : |τ - z.im| ≤ |(z + h).im - z.im| := (abs_sub_le_of_mem_uIcc z.im (z + h).im τ hτ).1 ++ have im_diff_eq : |(z + h).im - z.im| = |h.im| := by ++ simp [Complex.add_im, sub_eq_add_neg, add_assoc] ++ have τ_bound : |τ - z.im| ≤ |h.im| := by simpa [im_diff_eq] using τ_bound0 ++ ++ have vertical_bound : ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ≤ |h.re| + |τ - z.im| := ++ abs_vertical_core z h τ ++ have sum_bound : |h.re| + |τ - z.im| ≤ |h.re| + |h.im| := by ++ exact add_le_add_right τ_bound _ ++ have norm_bound := sum_abs_le_two_mul (Complex.abs_re_le_norm h) (Complex.abs_im_le_norm h) ++ have h_bound : ‖h‖ < δ₁ / 2 := hh_norm ++ have final_bound := two_norm_lt_of_norm_lt_half hδ₁_pos h_bound ++ calc ‖(h.re : ℝ) + Complex.I * (τ - z.im)‖ ++ _ ≤ |h.re| + |τ - z.im| := vertical_bound ++ _ ≤ |h.re| + |h.im| := sum_bound ++ _ ≤ (2 : ℝ) * ‖h‖ := norm_bound ++ _ < δ₁ := final_bound ++ ++ have f_dist := hf_bound key_dist ++ rw [dist_eq] at f_dist ++ ++ exact le_of_lt f_dist ++ · ++ exact le_of_lt hε_pos ++ ++lemma eventually_corner_and_sum_in_closedBall {z : ℂ} {R' : ℝ} ++ (hz : ‖z‖ < R') : ++ ∀ᶠ h in 𝓝 (0:ℂ), ++ (z + h) ∈ Metric.closedBall (0 : ℂ) R' ∧ ++ (((z + h).re : ℂ) + Complex.I * z.im) ∈ Metric.closedBall (0 : ℂ) R' := by ++ ++ have hρ_pos : 0 < R' - ‖z‖ := sub_pos.mpr hz ++ have h_small : ∀ᶠ h in 𝓝 (0:ℂ), h ∈ Metric.ball (0 : ℂ) (R' - ‖z‖) := ++ Metric.ball_mem_nhds (0 : ℂ) hρ_pos ++ refine h_small.mono ?_ ++ intro h hhball ++ have hnorm_lt : ‖h‖ < R' - ‖z‖ := by ++ simpa [Metric.mem_ball, Complex.dist_eq, sub_zero] using hhball ++ ++ have hsum_lt : ‖z‖ + ‖h‖ < R' := by ++ have htemp : ‖z‖ + ‖h‖ < ‖z‖ + (R' - ‖z‖) := add_lt_add_right hnorm_lt _ ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using htemp ++ have hzph_le : ‖z + h‖ ≤ R' := ++ le_of_lt (lt_of_le_of_lt (norm_add_le _ _) hsum_lt) ++ have hzph_mem : (z + h) ∈ Metric.closedBall (0 : ℂ) R' := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hzph_le ++ ++ let w : ℂ := ((z + h).re : ℂ) + Complex.I * z.im ++ ++ have tri : ‖w‖ ≤ ‖w - z‖ + ‖z‖ := by ++ have := norm_add_le (w - z) z ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ ++ let t : ℝ := (z + h).re ++ have hwz_eq : w - z = (t : ℂ) + Complex.I * z.im - z := by ++ simp [w, t, sub_eq_add_neg, add_assoc] ++ have eq_transform : ‖(t : ℂ) + Complex.I * z.im - z‖ = |t - z.re| := ++ abs_horizontal_diff_eq_abs_real z t ++ have t_sub_re : t - z.re = h.re := by ++ simp [t, Complex.add_re, sub_eq_add_neg, add_assoc] ++ have hwz_abs2 : ‖w - z‖ = |h.re| := by ++ simpa [hwz_eq, t_sub_re] using eq_transform ++ have hwz_le : ‖w - z‖ ≤ ‖h‖ := by ++ simpa [hwz_abs2] using (Complex.abs_re_le_norm h) ++ have hw_le'' : ‖w‖ ≤ ‖h‖ + ‖z‖ := by ++ exact le_trans tri (add_le_add_left hwz_le _) ++ have hw_lt : ‖w‖ < R' := by ++ have : ‖h‖ + ‖z‖ < R' := by simpa [add_comm] using hsum_lt ++ exact lt_of_le_of_lt hw_le'' this ++ have hw_mem : w ∈ Metric.closedBall (0 : ℂ) R' := by ++ simpa [w, Metric.mem_closedBall, Complex.dist_eq, sub_zero] using (le_of_lt hw_lt) ++ exact And.intro hzph_mem hw_mem ++ ++lemma limit_of_Err_ratio_is_zero ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) r1) : ++ Tendsto (fun h => Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h) (𝓝 0) (𝓝 0) := by ++ ++ set g : ℂ → ℂ := fun h => Err hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf z h / h ++ ++ have hS : Tendsto (fun h => S_max z h f) (𝓝 0) (𝓝 0) := ++ limit_of_S_is_zero (r1:=r1) (R:=R) (R0:=R0) hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hf hz ++ ++ have h_upper : Tendsto (fun h => |(2 : ℝ) * S_max z h f|) (𝓝 0) (𝓝 0) := by ++ have hcont : Continuous fun x : ℝ => |(2 : ℝ) * x| := ++ (continuous_const.mul continuous_id).abs ++ have h0 := hcont.tendsto (0 : ℝ) ++ simpa only [Function.comp_def, mul_zero, abs_zero] using h0.comp hS ++ ++ have h_lower_nonneg : ∀ᶠ h in 𝓝 0, 0 ≤ ‖g h‖ := ++ Filter.Eventually.of_forall (fun _ => by simpa [g] using (norm_nonneg (g _))) ++ ++ let δ : ℝ := (R - r1) / 2 ++ have hδ_pos : 0 < δ := by ++ have : 0 < R - r1 := sub_pos.mpr hr1_lt_R ++ simpa [δ] using half_pos this ++ let R' : ℝ := r1 + δ ++ have hR'_pos : 0 < R' := by ++ have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) ++ simpa [R'] using this ++ have hR'_lt_R : R' < R := by ++ have hδlt : δ < R - r1 := by ++ simpa [δ] using (half_lt_self (sub_pos.mpr hr1_lt_R)) ++ have : r1 + δ < r1 + (R - r1) := add_lt_add_right hδlt r1 ++ simpa [R', sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ ++ have hz_le_r1 : ‖z‖ ≤ r1 := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz ++ have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by ++ have hr1_le_R' : r1 ≤ R' := by ++ have : 0 ≤ δ := le_of_lt hδ_pos ++ simpa [R'] using (le_add_of_nonneg_right this : r1 ≤ r1 + δ) ++ have : ‖z‖ ≤ R' := le_trans hz_le_r1 hr1_le_R' ++ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this ++ ++ have h_event : ∀ᶠ h in 𝓝 0, ‖g h‖ ≤ |(2 : ℝ) * S_max z h f| := by ++ ++ have hcorner := eventually_corner_and_sum_in_closedBall (z:=z) (R':=R') (hz := by ++ ++ have : ‖z‖ ≤ r1 := hz_le_r1 ++ exact lt_of_le_of_lt this (by simpa [R'] using (lt_add_of_pos_right r1 hδ_pos))) ++ refine hcorner.mono ?_ ++ intro h hh ++ have hzh' : z + h ∈ Metric.closedBall (0 : ℂ) R' := hh.1 ++ have hw' : ((z + h).re : ℂ) + Complex.I * z.im ∈ Metric.closedBall (0 : ℂ) R' := hh.2 ++ by_cases hh0 : h = 0 ++ · have : 0 ≤ |(2 : ℝ) * S_max z h f| := abs_nonneg _ ++ simp [g, hh0, div_zero, norm_zero] ++ · ++ have hb := ++ bound_on_Err_ratio (r1:=R') (R:=R) (R0:=R0) ++ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf (z:=z) (h:=h) hz' hzh' hw' hh0 ++ have hb' : ‖g h‖ ≤ 2 * S_max z h f := by ++ simpa [g, norm, Err] using hb ++ exact le_trans hb' (le_abs_self ((2 : ℝ) * S_max z h f)) ++ ++ have h_norm_tendsto : Tendsto (fun h => ‖g h‖) (𝓝 0) (𝓝 0) := by ++ refine Filter.Tendsto.squeeze' tendsto_const_nhds h_upper h_lower_nonneg h_event ++ ++ have h_dist_tendsto : Tendsto (fun h => dist (g h) 0) (𝓝 0) (𝓝 0) := by ++ simpa [dist_eq_norm] using h_norm_tendsto ++ simpa [g] using (tendsto_iff_dist_tendsto_zero).2 h_dist_tendsto ++ ++open Classical ++ ++noncomputable def If_ext ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ (f : ℂ → ℂ) ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : ℂ → ℂ := ++ fun w => ++ if h : w ∈ Metric.closedBall (0 : ℂ) r1 then ++ If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, h⟩ ++ else ++ 0 ++ ++lemma If_ext_eq_taxicab_of_mem {r1 R R0 : ℝ} (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ (f : ℂ → ℂ) ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {w : ℂ} (hw : w ∈ Metric.closedBall (0 : ℂ) r1) : ++ If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w ++ = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := by ++ classical ++ simp [If_ext, hw] ++ ++lemma If_taxicab_param_invariance {r1₁ r1₂ R R0 : ℝ} ++ (hr1₁_pos : 0 < r1₁) (hr1₁_lt_R : r1₁ < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ (hr1₂_pos : 0 < r1₂) (hr1₂_lt_R : r1₂ < R) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {w : ℂ} ++ (hw₁ : w ∈ Metric.closedBall (0 : ℂ) r1₁) ++ (hw₂ : w ∈ Metric.closedBall (0 : ℂ) r1₂) : ++ If_taxicab hr1₁_pos hr1₁_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw₁⟩ ++ = If_taxicab hr1₂_pos hr1₂_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw₂⟩ := by ++ ++ simp [If_taxicab] ++ ++lemma derivWithin_eq_deriv_of_isOpen_mem {s : Set ℂ} (hs : IsOpen s) {f : ℂ → ℂ} {z : ℂ} ++ (hz : z ∈ s) : derivWithin f s z = deriv f z := by ++ simpa using (derivWithin_of_isOpen (f := f) (s := s) (x := z) hs hz) ++ ++lemma eventually_decomposition_for_ext ++ {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ (z : ℂ) (hz : ‖z‖ < R') : ++ ∀ᶠ h in 𝓝 (0:ℂ), ++ let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ++ g (z + h) - g z = f z * h + Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h := by ++ ++ have h_event := eventually_corner_and_sum_in_closedBall (z:=z) (R':=R') hz ++ refine h_event.mono ?_ ++ intro h hh ++ ++ let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ++ ++ have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by ++ have : ‖z‖ ≤ R' := le_of_lt hz ++ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this ++ ++ have hgzh : g (z + h) ++ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hh.1⟩ := by ++ simpa [g] using ++ If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=z + h) hh.1 ++ have hgz : g z ++ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz'⟩ := by ++ simpa [g] using ++ If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=z) hz' ++ ++ have H := ++ If_diff_decomposition_final (r1:=R') (R:=R) (R0:=R0) ++ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) ++ (z:=z) (h:=h) ++ (hz:=hz') (hzh:=hh.1) (hw:=hh.2) ++ ++ calc ++ g (z + h) - g z ++ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hh.1⟩ ++ - If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz'⟩ := by ++ simp [hgzh, hgz] ++ _ = f z * h + Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h := by ++ simpa using H ++ ++lemma tendsto_Err_ratio_radius (R' R R0 : ℝ) (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z : ℂ} (hz : ‖z‖ < R') : ++ Tendsto (fun h => Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h / h) (𝓝 0) (𝓝 0) := by ++ ++ have hz' : z ∈ Metric.closedBall (0 : ℂ) R' := by ++ have : ‖z‖ ≤ R' := le_of_lt hz ++ simpa [Metric.mem_closedBall, Complex.dist_eq, sub_zero] using this ++ ++ simpa using ++ (limit_of_Err_ratio_is_zero (r1:=R') (R:=R) (R0:=R0) ++ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf (z:=z) (hz:=hz')) ++ ++lemma If_ext_eq_taxicab_at_sum {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z h : ℂ} ++ (hzh : z + h ∈ Metric.closedBall (0 : ℂ) R') : ++ If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (z + h) ++ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z + h, hzh⟩ := by ++ simpa using ++ (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) ++ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) (w:=z + h) hzh) ++ ++lemma If_ext_eq_taxicab_at_point {R' R R0 : ℝ} (hR'_pos : 0 < R') (hR'_lt_R : R' < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) ++ {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) R') : ++ If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z ++ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨z, hz⟩ := by ++ simpa using ++ (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) ++ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one (f:=f) (hf:=hf) (w:=z) hz) ++ ++lemma hasDerivWithinAt_congr_eqOn {f g : ℂ → ℂ} {s : Set ℂ} {z f' : ℂ} ++ (hEq : Set.EqOn f g s) (hz : z ∈ s) : ++ HasDerivWithinAt g f' s z → HasDerivWithinAt f f' s z := by ++ intro hg ++ have hfg : ∀ x ∈ s, f x = g x := fun x hx => hEq hx ++ simpa using (HasDerivWithinAt.congr_of_mem (h := hg) (hs := hfg) (hx := hz)) ++ ++lemma differentiableOn_of_hasDerivWithinAt {f : ℂ → ℂ} {s : Set ℂ} {F : ℂ → ℂ} ++ (h : ∀ z ∈ s, HasDerivWithinAt f (F z) s z) : DifferentiableOn ℂ f s := by ++ intro z hz ++ exact (h z hz).differentiableWithinAt ++ ++lemma If_ext_agree_on_smallBall {r1 R' R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hR'_pos : 0 < R') (hr1_lt_R : r1 < R) (hR'_lt_R : R' < R) (hr1_lt_R' : r1 < R') (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : ++ Set.EqOn (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) ++ (If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf) ++ (Metric.closedBall (0 : ℂ) r1) := by ++ intro w hw ++ ++ have hw' : w ∈ Metric.closedBall (0 : ℂ) R' := ++ mem_closedBall_mono_radius (z:=w) (r:=r1) (R:=R') hw (le_of_lt hr1_lt_R') ++ ++ have hleft : ++ If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w ++ = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := by ++ simpa using ++ (If_ext_eq_taxicab_of_mem (r1:=r1) (R:=R) (R0:=R0) ++ hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf (w:=w) hw) ++ have hright : ++ If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf w ++ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw'⟩ := by ++ simpa using ++ (If_ext_eq_taxicab_of_mem (r1:=R') (R:=R) (R0:=R0) ++ hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf (w:=w) hw') ++ ++ have hparam := ++ If_taxicab_param_invariance (r1₁:=r1) (r1₂:=R') (R:=R) (R0:=R0) ++ hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one hR'_pos hR'_lt_R hf (w:=w) hw hw' ++ ++ calc ++ If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf w ++ = If_taxicab hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw⟩ := hleft ++ _ = If_taxicab hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ⟨w, hw'⟩ := hparam ++ _ = If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf w := by ++ simpa using hright.symm ++ ++lemma hasDerivAt_of_local_decomposition' (g : ℂ → ℂ) (z F : ℂ) ++ (Err_func : ℂ → ℂ) ++ (hdecomp : ∀ᶠ h in 𝓝 (0:ℂ), g (z + h) - g z = F * h + Err_func h) ++ (hErr : Tendsto (fun h => Err_func h / h) (𝓝 (0:ℂ)) (𝓝 (0:ℂ))) : ++ HasDerivAt g F z := by ++ ++ have hdecomp_within : ∀ᶠ h in 𝓝[≠] (0:ℂ), g (z + h) - g z = F * h + Err_func h := ++ (hdecomp.filter_mono (nhdsWithin_le_nhds : 𝓝[≠] (0:ℂ) ≤ 𝓝 (0:ℂ))) ++ ++ have h_ne0 : ∀ᶠ h in 𝓝[≠] (0:ℂ), h ≠ 0 := by ++ filter_upwards [eventually_mem_nhdsWithin (a := (0 : ℂ)) (s := ({0}ᶜ : Set ℂ))] with h hh ++ simpa only [Set.mem_compl_iff, Set.mem_singleton_iff] using hh ++ ++ have h_eq_slope : ∀ᶠ h in 𝓝[≠] (0:ℂ), ++ h⁻¹ • (g (z + h) - g z) = F + Err_func h / h := by ++ refine (hdecomp_within.and h_ne0).mono ?_ ++ intro h hh ++ rcases hh with ⟨hEq, hne⟩ ++ ++ have H0 : h⁻¹ • (g (z + h) - g z) = h⁻¹ • (F * h + Err_func h) := by ++ simpa using congrArg (fun x => h⁻¹ • x) hEq ++ ++ have h1 : h⁻¹ * (F * h) = F := by ++ have hne' : h ≠ 0 := hne ++ calc ++ h⁻¹ * (F * h) = F * (h⁻¹ * h) := by ++ ac_rfl ++ _ = F * 1 := by simp [hne'] ++ _ = F := by simp ++ have h2 : h⁻¹ * Err_func h = Err_func h / h := by ++ simp [div_eq_mul_inv, mul_comm] ++ calc ++ h⁻¹ • (g (z + h) - g z) ++ = h⁻¹ • (F * h + Err_func h) := H0 ++ _ = h⁻¹ * (F * h + Err_func h) := by simp [smul_eq_mul] ++ _ = h⁻¹ * (F * h) + h⁻¹ * (Err_func h) := by simp [mul_add] ++ _ = F + Err_func h / h := by simp [h1, h2] ++ ++ have hErr_within : Tendsto (fun h => Err_func h / h) (𝓝[≠] (0:ℂ)) (𝓝 (0:ℂ)) := ++ hErr.mono_left (nhdsWithin_le_nhds : 𝓝[≠] (0:ℂ) ≤ 𝓝 (0:ℂ)) ++ have h_const : Tendsto (fun _ : ℂ => F) (𝓝[≠] (0:ℂ)) (𝓝 F) := tendsto_const_nhds ++ have h_sum : Tendsto (fun h => F + Err_func h / h) (𝓝[≠] (0:ℂ)) (𝓝 (F + 0)) := ++ h_const.add hErr_within ++ have h_target : Tendsto (fun h => h⁻¹ • (g (z + h) - g z)) (𝓝[≠] (0:ℂ)) (𝓝 F) := by ++ have := (Filter.tendsto_congr' h_eq_slope).2 h_sum ++ simpa [zero_add] using this ++ ++ exact (hasDerivAt_iff_tendsto_slope_zero).2 h_target ++ ++lemma uniqueDiffWithinAt_convex_complex {s : Set ℂ} (hconv : Convex ℝ s) ++ (hs : (interior s).Nonempty) {x : ℂ} (hx : x ∈ closure s) : ++ UniqueDiffWithinAt ℂ s x := by ++ ++ have hR : UniqueDiffWithinAt ℝ s x := ++ uniqueDiffWithinAt_convex (E := ℂ) (conv := hconv) (hs := hs) (x := x) (hx := hx) ++ ++ have dR : Dense ((Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) : Set ℂ) := by ++ simpa using (hR.dense_tangentConeAt) ++ ++ have h_tc_subset : tangentConeAt ℝ s x ⊆ tangentConeAt ℂ s x := ++ tangentConeAt_mono_field ++ ++ set TC : Set ℂ := tangentConeAt ℂ s x ++ set Sℂ : Submodule ℂ ℂ := Submodule.span ℂ TC ++ set Sℝ : Submodule ℝ ℂ := Sℂ.restrictScalars ℝ ++ have h_span_le : (Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) ≤ Sℝ := by ++ ++ refine Submodule.span_le.mpr ?_ ++ intro v hv ++ have hv' : v ∈ TC := h_tc_subset hv ++ have : v ∈ Sℂ := Submodule.subset_span hv' ++ simpa [Sℝ] using this ++ ++ have hsubset_sets : ++ ((Submodule.span ℝ (tangentConeAt ℝ s x) : Submodule ℝ ℂ) : Set ℂ) ++ ⊆ ((Sℂ : Submodule ℂ ℂ) : Set ℂ) := by ++ intro z hz ++ have hz' : z ∈ Sℝ := h_span_le hz ++ simpa [Sℝ] using hz' ++ have dC : Dense ((Sℂ : Submodule ℂ ℂ) : Set ℂ) := dR.mono hsubset_sets ++ ++ exact ⟨dC, hx⟩ ++ ++lemma interior_closedBall_nonempty_of_pos {R : ℝ} (hR_pos : 0 < R) : ++ (interior (Metric.closedBall (0 : ℂ) R)).Nonempty := by ++ ++ have h0mem : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by ++ simpa [Metric.mem_ball, Complex.dist_eq, sub_zero] using hR_pos ++ ++ have hsub : Metric.ball (0 : ℂ) R ⊆ interior (Metric.closedBall (0 : ℂ) R) := ++ Metric.ball_subset_interior_closedBall ++ ++ exact ⟨0, hsub h0mem⟩ ++ ++lemma mem_closure_of_mem_closedBall {R : ℝ} {z : ℂ} ++ (hz : z ∈ Metric.closedBall (0 : ℂ) R) : ++ z ∈ closure (Metric.closedBall (0 : ℂ) R) := by ++ exact subset_closure hz ++ ++lemma uniqueDiffWithinAt_closedBall_complex_of_mem {R : ℝ} {z : ℂ} ++ (hR_pos : 0 < R) (hz : z ∈ Metric.closedBall (0 : ℂ) R) : ++ UniqueDiffWithinAt ℂ (Metric.closedBall (0 : ℂ) R) z := ++by ++ ++ have hconv : Convex ℝ (Metric.closedBall (0 : ℂ) R) := ++ convex_closedBall (0 : ℂ) R ++ ++ have hnonempty : (interior (Metric.closedBall (0 : ℂ) R)).Nonempty := ++ interior_closedBall_nonempty_of_pos (R := R) hR_pos ++ ++ have hz_cl : z ∈ closure (Metric.closedBall (0 : ℂ) R) := ++ mem_closure_of_mem_closedBall (R := R) (z := z) hz ++ ++ exact uniqueDiffWithinAt_convex_complex hconv hnonempty hz_cl ++ ++lemma If_is_differentiable_on ++ {r1 R R0 : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R : r1 < R) (hR_lt_R0 : R < R0) (hR0_lt_one : R0 < 1) ++ {f : ℂ → ℂ} ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R)) : ++ DifferentiableOn ℂ (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (Metric.closedBall (0 : ℂ) r1) ++ ∧ ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ derivWithin (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (Metric.closedBall (0 : ℂ) r1) z = f z := by ++ set s : Set ℂ := Metric.closedBall (0 : ℂ) r1 ++ have hHasDerivWithinAt : ∀ z ∈ s, ++ HasDerivWithinAt (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) (f z) s z := by ++ intro z hz ++ ++ let δ : ℝ := (R - r1) / 2 ++ have hδ_pos : 0 < δ := by ++ have : 0 < R - r1 := sub_pos.mpr hr1_lt_R ++ simpa [δ] using half_pos this ++ let R' : ℝ := r1 + δ ++ have hR'_pos : 0 < R' := by ++ have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) ++ simpa [R'] using this ++ have hR'_lt_R : R' < R := by ++ have hδlt : δ < R - r1 := by ++ have : 0 < R - r1 := sub_pos.mpr hr1_lt_R ++ simpa [δ] using (half_lt_self this) ++ have : r1 + δ < r1 + (R - r1) := add_lt_add_right hδlt r1 ++ simpa [R', sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ have hr1_lt_R' : r1 < R' := by ++ have : r1 < r1 + δ := by simpa [add_comm, add_left_comm, add_assoc, R', δ] using (lt_of_le_of_lt (le_of_eq rfl) (add_lt_add_right hδ_pos r1)) ++ simpa [R'] using this ++ ++ have hz_le_r1 : ‖z‖ ≤ r1 := by ++ simpa [s, Metric.mem_closedBall, Complex.dist_eq, sub_zero] using hz ++ have hz_lt_R' : ‖z‖ < R' := lt_of_le_of_lt hz_le_r1 (by simpa [R'] using (lt_add_of_pos_right r1 hδ_pos)) ++ ++ let g := If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf ++ ++ have hdecomp := eventually_decomposition_for_ext (R':=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf z hz_lt_R' ++ ++ have hErr := tendsto_Err_ratio_radius (R':=R') (R:=R) (R0:=R0) hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one hf hz_lt_R' ++ ++ have hDerivAt_g : HasDerivAt g (f z) z := ++ hasDerivAt_of_local_decomposition' (g := g) (z := z) (F := f z) ++ (Err_func := fun h => Err hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf z h) ++ (hdecomp := by ++ ++ simpa [g] using hdecomp) ++ (hErr := by ++ ++ simpa using hErr) ++ ++ have hWithin_g : HasDerivWithinAt g (f z) s z := hDerivAt_g.hasDerivWithinAt ++ ++ have hEq : Set.EqOn (If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) ++ (If_ext hR'_pos hR'_lt_R hR_lt_R0 hR0_lt_one f hf) ++ s := ++ If_ext_agree_on_smallBall (r1:=r1) (R':=R') (R:=R) (R0:=R0) ++ hr1_pos hR'_pos hr1_lt_R hR'_lt_R hr1_lt_R' hR_lt_R0 hR0_lt_one hf ++ ++ exact hasDerivWithinAt_congr_eqOn (f := If_ext hr1_pos hr1_lt_R hR_lt_R0 hR0_lt_one f hf) ++ (g := g) (s := s) (z := z) (f' := f z) hEq hz hWithin_g ++ ++ refine And.intro ?hdiff ?hderiv ++ · ++ apply differentiableOn_of_hasDerivWithinAt ++ intro z hz ++ exact hHasDerivWithinAt z hz ++ · ++ intro z hz ++ have hUD : UniqueDiffWithinAt ℂ s z := ++ uniqueDiffWithinAt_closedBall_complex_of_mem (R := r1) hr1_pos (z := z) (hz := by simpa [s] using hz) ++ have hD := hHasDerivWithinAt z hz ++ simpa using hD.derivWithin hUD ++ ++open scoped Topology ++ ++theorem AnalyticOnNhd.mono_closedBall {B : ℂ → ℂ} {R : ℝ} (R' : ℝ) ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall 0 R)) (hR' : R' < R) : ++ AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by ++ ++ exact hB.mono (Metric.closedBall_subset_closedBall (le_of_lt hR')) ++ ++lemma log_deriv_is_analytic ++ {r1 R' R : ℝ} ++ (_hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R')) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z ≠ 0) : ++ AnalyticOnNhd ℂ (fun z => deriv B z / B z) (Metric.closedBall (0 : ℂ) r1) := by ++ have step1 : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) r1) := by simp [AnalyticOnNhd.mono_closedBall r1 hB hr1_lt_R'] ++ have hderiv : AnalyticOnNhd ℂ (deriv B) (Metric.closedBall (0 : ℂ) r1) := by ++ apply AnalyticOnNhd.deriv step1 ++ ++ simpa using AnalyticOnNhd.div hderiv step1 hB_ne_zero ++ ++lemma I_is_antiderivative ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) : ++ ∃ J : ℂ → ℂ, AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1) ∧ ++ J 0 = 0 ∧ ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z := by ++ classical ++ ++ have hB_on_R' : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R') := ++ AnalyticOnNhd.mono_closedBall R' hB hR'_lt_R ++ have hderiv_on_R' : AnalyticOnNhd ℂ (deriv B) (Metric.closedBall (0 : ℂ) R') := ++ AnalyticOnNhd.deriv hB_on_R' ++ let L : ℂ → ℂ := fun z => deriv B z / B z ++ have hL_on_R' : AnalyticOnNhd ℂ L (Metric.closedBall (0 : ℂ) R') := by ++ simpa [L] using AnalyticOnNhd.div hderiv_on_R' hB_on_R' hB_ne_zero ++ ++ let δ : ℝ := (R' - r1) / 2 ++ have hδ_pos : 0 < δ := by ++ have : 0 < R' - r1 := sub_pos.mpr hr1_lt_R' ++ simpa [δ] using half_pos this ++ let R_mid : ℝ := r1 + δ ++ have hR_mid_pos : 0 < R_mid := by ++ have : 0 < r1 + δ := add_pos_of_pos_of_nonneg hr1_pos (le_of_lt hδ_pos) ++ simpa [R_mid] using this ++ have hr1_lt_R_mid : r1 < R_mid := by ++ have : 0 < δ := hδ_pos ++ simpa [R_mid] using (lt_add_of_pos_right r1 this) ++ have hR_mid_lt_R' : R_mid < R' := by ++ have hδlt : δ < R' - r1 := by ++ simpa [δ] using (half_lt_self (sub_pos.mpr hr1_lt_R')) ++ have : r1 + δ < r1 + (R' - r1) := add_lt_add_right hδlt r1 ++ simpa [R_mid, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ ++ let J : ℂ → ℂ := ++ If_ext (r1 := R_mid) (R := R') (R0 := R) hR_mid_pos hR_mid_lt_R' hR'_lt_R hR_lt_one L hL_on_R' ++ ++ have hIf := ++ (If_is_differentiable_on (r1 := R_mid) (R := R') (R0 := R) ++ hR_mid_pos hR_mid_lt_R' hR'_lt_R hR_lt_one (f := L) hL_on_R') ++ have hDiffOn_mid : DifferentiableOn ℂ J (Metric.closedBall (0 : ℂ) R_mid) := by ++ simpa [J] using hIf.1 ++ ++ have hDiffOn_ball_R_mid : DifferentiableOn ℂ J (Metric.ball (0 : ℂ) R_mid) := ++ hDiffOn_mid.mono Metric.ball_subset_closedBall ++ ++ have hJ_analyticOnNhd : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1) := by ++ intro z hz ++ ++ have hz_le : dist z (0 : ℂ) ≤ r1 := by ++ simpa [Metric.mem_closedBall] using hz ++ have hz_lt : dist z (0 : ℂ) < R_mid := lt_of_le_of_lt hz_le hr1_lt_R_mid ++ have hz_ball : z ∈ Metric.ball (0 : ℂ) R_mid := by simpa [Metric.mem_ball] using hz_lt ++ ++ exact (DifferentiableOn.analyticAt (s := Metric.ball (0 : ℂ) R_mid) ++ (f := J) hDiffOn_ball_R_mid (Metric.isOpen_ball.mem_nhds hz_ball)) ++ ++ have h0_in_mid : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R_mid := by ++ simpa [Metric.mem_closedBall, dist_self] using (le_of_lt hR_mid_pos) ++ have hJ0 : J 0 = 0 := by ++ simp [J, If_ext, If_taxicab, h0_in_mid] ++ ++ have hderiv_eq : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = L z := by ++ intro z hz ++ ++ have hz_le : dist z (0 : ℂ) ≤ r1 := by simpa [Metric.mem_closedBall] using hz ++ have hz_lt : dist z (0 : ℂ) < R_mid := lt_of_le_of_lt hz_le hr1_lt_R_mid ++ have hz_ball : z ∈ Metric.ball (0 : ℂ) R_mid := by simpa [Metric.mem_ball] using hz_lt ++ have hz_cb_mid : z ∈ Metric.closedBall (0 : ℂ) R_mid := Metric.ball_subset_closedBall hz_ball ++ ++ have h_cb_nhds : Metric.closedBall (0 : ℂ) R_mid ∈ 𝓝 z := ++ Filter.mem_of_superset (Metric.isOpen_ball.mem_nhds hz_ball) Metric.ball_subset_closedBall ++ ++ have hDW_eq_L : derivWithin J (Metric.closedBall (0 : ℂ) R_mid) z = L z := by ++ simpa [J] using hIf.2 z hz_cb_mid ++ ++ have hHasWithin : HasDerivWithinAt J (derivWithin J (Metric.closedBall (0 : ℂ) R_mid) z) ++ (Metric.closedBall (0 : ℂ) R_mid) z := ++ (hDiffOn_mid z hz_cb_mid).hasDerivWithinAt ++ have hHasWithinL : HasDerivWithinAt J (L z) (Metric.closedBall (0 : ℂ) R_mid) z := by ++ simpa [hDW_eq_L] ++ using hHasWithin ++ ++ have hHasDerivAt : HasDerivAt J (L z) z := ++ HasDerivWithinAt.hasDerivAt hHasWithinL h_cb_nhds ++ ++ simpa using hHasDerivAt.deriv ++ ++ refine ⟨J, hJ_analyticOnNhd, hJ0, ?_⟩ ++ intro z hz ++ simpa [L] using hderiv_eq z hz ++ ++noncomputable def H_auxiliary ++ {r1 R' R : ℝ} ++ (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ (J : ℂ → ℂ) : ℂ → ℂ := ++ fun z => Complex.exp (J z) / B z ++ ++lemma exp_I_at_zero ++ {r1 R' R : ℝ} ++ (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ Complex.exp (J 0) = 1 := by ++ simp [hJ_zero] ++ ++lemma H_at_zero ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 = 1 / B 0 := by ++ simp [H_auxiliary, hJ_zero] ++ ++lemma log_deriv_id ++ {r1 R' R : ℝ} ++ (_hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (_hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z * B z = deriv B z := by ++ intro z hz ++ ++ have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by ++ have hzR' : dist z (0 : ℂ) ≤ r1 := hz ++ have hR'_le : r1 ≤ R' := le_of_lt (hr1_lt_R') ++ have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR'_le ++ simpa using hzR'' ++ have hBnz : B z ≠ 0 := hB_ne_zero z hzR ++ have hJd := hJ_deriv z hz ++ have hmult := congrArg (fun t => t * B z) hJd ++ have hR2 : (deriv B z / B z) * B z = deriv B z * B z / B z := by ++ simpa using (div_mul_eq_mul_div (deriv B z) (B z) (B z)) ++ have hmult' : deriv J z * B z = deriv B z * B z / B z := by ++ simpa [hR2] using hmult ++ have hdiv' : deriv B z * B z / B z = deriv B z := by ++ field_simp [hBnz] ++ calc ++ deriv J z * B z = deriv B z * B z / B z := hmult' ++ _ = deriv B z := by simpa using hdiv' ++ ++lemma log_deriv_identity ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z * B z - deriv B z = 0 := by ++ intro z hz ++ have h_eq := log_deriv_id hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ rw [h_eq] ++ simp ++ ++lemma H_derivative_quotient_rule ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (_hJ_zero : J 0 = 0) ++ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = ++ (deriv (fun w => Complex.exp (J w)) z * B z - deriv B z * Complex.exp (J z)) / (B z)^2 := by ++ intro z hz ++ ++ have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by ++ have hzR' : dist z (0 : ℂ) ≤ r1 := hz ++ have hR_le : r1 ≤ R' := le_of_lt (hr1_lt_R') ++ have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR_le ++ simpa using hzR'' ++ ++ have hB_nz : B z ≠ 0 := hB_ne_zero z hzR ++ have hB' : AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by ++ apply AnalyticOnNhd.mono_closedBall R' hB ++ assumption ++ have hB_diff : DifferentiableAt ℂ B z := (hB' z hzR).differentiableAt ++ have hJ_diff : DifferentiableAt ℂ J z := (hJ z hz).differentiableAt ++ have hF_diff : DifferentiableAt ℂ (fun w => Complex.exp (J w)) z := hJ_diff.cexp ++ ++ have h := deriv_div (hc := hF_diff) (hd := hB_diff) (hx := hB_nz) ++ unfold H_auxiliary ++ simpa only [Pi.div_def, mul_comm] using h ++ ++lemma exp_I_derivative_chain_rule ++ {r1 R' R : ℝ} ++ (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (_hJ_zero : J 0 = 0) ++ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ deriv (fun w => Complex.exp (J w)) z = deriv J z * Complex.exp (J z) := by ++ intro z hz ++ have hJ_diff : DifferentiableAt ℂ J z := (hJ z hz).differentiableAt ++ have hJ_has : HasDerivAt J (deriv J z) z := hJ_diff.hasDerivAt ++ have hcomp := (Complex.hasDerivAt_exp (J z)).comp z hJ_has ++ ++ simpa only [Function.comp_def, mul_comm] using hcomp.deriv ++ ++lemma H_derivative_calc ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = ++ (deriv J z * B z - deriv B z) * Complex.exp (J z) / (B z)^2 := by ++ intro z hz ++ ++ have hquot := H_derivative_quotient_rule hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ ++ have hchain := exp_I_derivative_chain_rule hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ ++ rw [hquot, hchain] ++ ++ have h1 : deriv J z * Complex.exp (J z) * B z - deriv B z * Complex.exp (J z) = ++ Complex.exp (J z) * (deriv J z * B z - deriv B z) := by ring ++ rw [h1] ++ ++ ring ++ ++lemma H_derivative_is_zero ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := by ++ intro z hz ++ have hcalc := ++ H_derivative_calc hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ have hident := ++ log_deriv_identity hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ simpa [hident] using hcalc ++ ++lemma zero_mem_closedBall_zero_radius {r1 : ℝ} (hr1 : 0 ≤ r1) : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) r1 := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hr1 ++ ++lemma H_deriv_zero_on_closedBall ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := by ++ simpa using ++ (H_derivative_is_zero hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv) ++ ++lemma H_auxiliary_differentiableOn_closedBall ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) : ++ DifferentiableOn ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (Metric.closedBall (0 : ℂ) r1) := ++by ++ ++ have hsubset : Metric.closedBall (0 : ℂ) r1 ⊆ Metric.closedBall (0 : ℂ) R := by ++ intro z hz ++ have hz' : dist z (0 : ℂ) ≤ r1 := by ++ simpa [Metric.mem_closedBall] using hz ++ have hle : r1 ≤ R := le_of_lt (lt_trans hr1_lt_R' hR'_lt_R) ++ have : dist z (0 : ℂ) ≤ R := le_trans hz' hle ++ simpa [Metric.mem_closedBall] using this ++ ++ have hJ_diff : DifferentiableOn ℂ J (Metric.closedBall (0 : ℂ) r1) := ++ hJ.differentiableOn ++ have hB_diff_r1 : DifferentiableOn ℂ B (Metric.closedBall (0 : ℂ) r1) := ++ (hB.differentiableOn).mono hsubset ++ ++ have hExp_diff : DifferentiableOn ℂ Complex.exp (Set.univ : Set ℂ) := ++ (Complex.differentiable_exp.differentiableOn) ++ have hExp_comp : DifferentiableOn ℂ (fun z => Complex.exp (J z)) (Metric.closedBall (0 : ℂ) r1) := by ++ refine hExp_diff.comp hJ_diff ?_ ++ intro x hx; simp ++ ++ have hB_ne_zero_r1 : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z ≠ 0 := by ++ intro z hz; exact hB_ne_zero z (by ++ have x : Metric.closedBall 0 r1 ⊆ Metric.closedBall 0 R' := Metric.closedBall_subset_closedBall (le_of_lt hr1_lt_R') ++ simp ++ simp at hz ++ linarith ++ ) ++ ++ have hdiv : DifferentiableOn ℂ (fun z => Complex.exp (J z) / B z) ++ (Metric.closedBall (0 : ℂ) r1) := ++ hExp_comp.div hB_diff_r1 hB_ne_zero_r1 ++ ++ unfold H_auxiliary ++ exact hdiv ++ ++lemma hasDerivAt_H_auxiliary_zero_on_closedBall ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ HasDerivAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) 0 z := by ++ intro z hz ++ ++ have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by ++ have hzR' : dist z (0 : ℂ) ≤ r1 := by ++ simpa [Metric.mem_closedBall] using hz ++ have hR_le : r1 ≤ R' := le_of_lt (hr1_lt_R') ++ have hzR'' : dist z (0 : ℂ) ≤ R' := le_trans hzR' hR_le ++ simpa [Metric.mem_closedBall] using hzR'' ++ have hBnz : B z ≠ 0 := hB_ne_zero z (hzR) ++ ++ have hJ_anal : AnalyticAt ℂ J z := hJ z hz ++ have hExp_diff_at_Jz : DifferentiableAt ℂ Complex.exp (J z) := ++ Complex.differentiableAt_exp ++ have hc_diff : DifferentiableAt ℂ (fun w => Complex.exp (J w)) z := ++ hExp_diff_at_Jz.comp z hJ_anal.differentiableAt ++ ++ have hB' : AnalyticOnNhd ℂ B (Metric.closedBall 0 R') := by ++ apply AnalyticOnNhd.mono_closedBall R' hB ++ assumption ++ have hd_diff : DifferentiableAt ℂ B z := (hB' z hzR).differentiableAt ++ ++ have hH_diff : DifferentiableAt ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z := by ++ unfold H_auxiliary ++ convert hc_diff.div hd_diff hBnz using 1 ++ have hH_has : HasDerivAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z) z := ++ hH_diff.hasDerivAt ++ have hderiv0 : deriv (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) z = 0 := ++ H_deriv_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ simpa [hderiv0] using hH_has ++ ++lemma fderivWithin_eq_zero_of_derivWithin_eq_zero {s : Set ℂ} {f : ℂ → ℂ} {x : ℂ} ++ (_hdiff : DifferentiableWithinAt ℂ f s x) ++ (hderiv : derivWithin f s x = 0) : ++ fderivWithin ℂ f s x = 0 := by ++ rw [← toSpanSingleton_derivWithin, hderiv] ++ simp ++ ++lemma hasDerivWithinAt_of_hasDerivAt {f : ℂ → ℂ} {s : Set ℂ} {x : ℂ} ++ (h : HasDerivAt f 0 x) : HasDerivWithinAt f 0 s x := by ++ simpa using h.hasDerivWithinAt ++ ++lemma uniqueDiffWithinAt_closedBall (r1 : ℝ) {x : ℂ} ++ (hr1 : 0 < r1) (hx : x ∈ Metric.closedBall (0 : ℂ) r1) : ++ UniqueDiffWithinAt ℝ (Metric.closedBall (0 : ℂ) r1) x := by ++ ++ have hconv : Convex ℝ (Metric.closedBall (0 : ℂ) r1) := by ++ simpa using (convex_closedBall (0 : ℂ) r1) ++ ++ have hinter_eq : interior (Metric.closedBall (0 : ℂ) r1) = Metric.ball (0 : ℂ) r1 := by ++ simpa using (interior_closedBall (x := (0 : ℂ)) (r := r1) (hr := ne_of_gt hr1)) ++ have hball_nonempty : (Metric.ball (0 : ℂ) r1).Nonempty := ++ ⟨0, by simpa [Metric.mem_ball, dist_eq_norm] using hr1⟩ ++ have hinter : (interior (Metric.closedBall (0 : ℂ) r1)).Nonempty := by ++ simpa [hinter_eq] using hball_nonempty ++ ++ have hx_closure : x ∈ closure (Metric.closedBall (0 : ℂ) r1) := subset_closure hx ++ ++ simpa using uniqueDiffWithinAt_convex hconv hinter hx_closure ++ ++lemma H_auxiliary_fderivWithin_zero_on_closedBall ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (Metric.closedBall (0 : ℂ) r1) z = 0 := ++by ++ intro z hz ++ ++ have hHasAt := ++ hasDerivAt_H_auxiliary_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero ++ hJ hJ_zero hJ_deriv z hz ++ have hHasWithin : ++ HasDerivWithinAt (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) 0 ++ (Metric.closedBall (0 : ℂ) r1) z := ++ hasDerivWithinAt_of_hasDerivAt hHasAt ++ ++ have hdiff : DifferentiableWithinAt ℂ ++ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (Metric.closedBall (0 : ℂ) r1) z := ++ hHasWithin.differentiableWithinAt ++ ++ classical ++ have hderivWithin0 : ++ derivWithin (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (Metric.closedBall (0 : ℂ) r1) z = 0 := by ++ by_cases hUDc : UniqueDiffWithinAt ℂ (Metric.closedBall (0 : ℂ) r1) z ++ · simpa using hHasWithin.derivWithin hUDc ++ · simpa using ++ (derivWithin_zero_of_not_uniqueDiffWithinAt ++ (𝕜 := ℂ) ++ (f := H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (s := Metric.closedBall (0 : ℂ) r1) (x := z) hUDc) ++ ++ exact fderivWithin_eq_zero_of_derivWithin_eq_zero hdiff hderivWithin0 ++ ++lemma H_is_constant ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z = ++ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 := by ++ intro z hz ++ ++ have hs : Convex ℝ (Metric.closedBall (0 : ℂ) r1) := by ++ simpa using (convex_closedBall (0 : ℂ) r1) ++ ++ have hdiff : DifferentiableOn ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (Metric.closedBall (0 : ℂ) r1) := ++ H_auxiliary_differentiableOn_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ ++ ++ have hfderiv0 : ∀ x ∈ Metric.closedBall (0 : ℂ) r1, ++ fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (Metric.closedBall (0 : ℂ) r1) x = 0 := ++ H_auxiliary_fderivWithin_zero_on_closedBall hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv ++ ++ have h0mem : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) r1 := ++ zero_mem_closedBall_zero_radius (le_of_lt hr1_pos) ++ ++ have hbound : ∀ x ∈ Metric.closedBall (0 : ℂ) r1, ++ ‖fderivWithin ℂ (H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (Metric.closedBall (0 : ℂ) r1) x‖ ≤ 0 := by ++ intro x hx ++ simp [hfderiv0 x hx] ++ have hineq := ++ Convex.norm_image_sub_le_of_norm_fderivWithin_le (𝕜 := ℂ) ++ (f := H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J) ++ (s := Metric.closedBall (0 : ℂ) r1) (x := (0 : ℂ)) (y := z) ++ hdiff hbound hs h0mem hz ++ have hzero : H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z - ++ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0 = 0 := by ++ have : ‖H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z - ++ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J 0‖ ≤ 0 := by ++ simpa using hineq ++ simpa [norm_le_zero_iff] using this ++ simpa [sub_eq_add_neg] using sub_eq_zero.mp hzero ++ ++lemma H_is_one ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ H_auxiliary hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero J z = 1 / B 0 := by ++ intro z hz ++ have hconst := H_is_constant hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ have h0 := H_at_zero hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv ++ simpa [h0] using hconst ++ ++lemma analytic_log_exists ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, B z = B 0 * Complex.exp (J z) := by ++ intro z hz ++ ++ have hH_const := H_is_one hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ ++ unfold H_auxiliary at hH_const ++ ++ have hzR : z ∈ Metric.closedBall (0 : ℂ) R' := by ++ have hzR' : dist z (0 : ℂ) ≤ r1 := hz ++ have hR_le : r1 ≤ R := le_of_lt (lt_trans hr1_lt_R' hR'_lt_R) ++ exact le_trans hzR' (by linarith) ++ have hBnz : B z ≠ 0 := hB_ne_zero z hzR ++ have hR_pos : 0 < R := lt_trans (lt_trans hr1_pos hr1_lt_R') hR'_lt_R ++ have hB0nz : B 0 ≠ 0 := hB_ne_zero 0 (by ++ simp [Metric.closedBall, dist_zero_right] ++ exact le_of_lt (by linarith)) ++ ++ have heq : Complex.exp (J z) * B 0 = B z := by ++ field_simp [hBnz, hB0nz] at hH_const ++ exact hH_const ++ ++ rw [← heq, mul_comm] ++ ++lemma modulus_of_exp_I ++ {r1 R' R : ℝ} ++ (_hr1_pos : 0 < r1) (_hr1_lt_R' : r1 < R') (_hR'_lt_R : R' < R) (_hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (_hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (_hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (_hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (_hJ_zero : J 0 = 0) ++ (_hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ norm (Complex.exp (J z)) = Real.exp (Complex.re (J z)) := by ++ intro z hz ++ exact Complex.norm_exp (J z) ++ ++lemma modulus_of_B_product_form ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ norm (B z) = norm (B 0) * norm (Complex.exp (J z)) := by ++ intro z hz ++ have hBform := analytic_log_exists hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ ++ simpa [norm_mul] using (congrArg norm hBform) ++ ++lemma modulus_of_exp_log ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ norm (B z) = norm (B 0) * Real.exp (Complex.re (J z)) := by ++ intro z hz ++ rw [modulus_of_B_product_form hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz] ++ rw [modulus_of_exp_I hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz] ++ ++lemma log_modulus_as_sum ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ Real.log (norm (B z)) = ++ Real.log (norm (B 0)) + Real.log (Real.exp (Complex.re (J z))) := by ++ intro z hz ++ ++ have h_eq := modulus_of_exp_log hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ ++ rw [h_eq, Real.log_mul] ++ · ++ ++ simp ++ apply hB_ne_zero ++ ++ rw [Metric.mem_closedBall, dist_self] ++ linarith ++ · ++ exact Real.exp_ne_zero _ ++ ++lemma real_log_of_modulus_difference ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) ++ {J : ℂ → ℂ} ++ (hJ : AnalyticOnNhd ℂ J (Metric.closedBall (0 : ℂ) r1)) ++ (hJ_zero : J 0 = 0) ++ (hJ_deriv : ∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J z = deriv B z / B z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ Real.log (norm (B z)) - Real.log (norm (B 0)) = Complex.re (J z) := by ++ intro z hz ++ ++ have h_sum := log_modulus_as_sum hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ_zero hJ_deriv z hz ++ ++ rw [h_sum] ++ ++ rw [Real.log_exp] ++ ring ++ ++theorem log_of_analytic ++ {r1 R' R : ℝ} ++ (hr1_pos : 0 < r1) (hr1_lt_R' : r1 < R') (hR'_lt_R : R' < R) (hR_lt_one : R < 1) ++ {B : ℂ → ℂ} ++ (hB : AnalyticOnNhd ℂ B (Metric.closedBall (0 : ℂ) R)) ++ (hB_ne_zero : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0) : ++ ∃ J_B : ℂ → ℂ, ++ AnalyticOnNhd ℂ J_B (Metric.closedBall (0 : ℂ) r1) ∧ ++ J_B 0 = 0 ∧ ++ (∀ z ∈ Metric.closedBall (0 : ℂ) r1, deriv J_B z = deriv B z / B z) ∧ ++ (∀ z ∈ Metric.closedBall (0 : ℂ) r1, ++ Real.log (norm (B z)) - Real.log (norm (B 0)) = Complex.re (J_B z)) := by ++ have hB_ne_zero_R' : ∀ z ∈ Metric.closedBall (0 : ℂ) R', B z ≠ 0 := hB_ne_zero ++ obtain ⟨J_B, hJ, hJ0, hJderiv⟩ := ++ I_is_antiderivative hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero_R' ++ refine ⟨J_B, hJ, hJ0, hJderiv, ?_⟩ ++ intro z hz ++ simpa using ++ (real_log_of_modulus_difference hr1_pos hr1_lt_R' hR'_lt_R hR_lt_one hB hB_ne_zero hJ hJ0 hJderiv z hz) ++ ++end Erdos970 +diff --git a/StrongPNT/Erdos970/PNT2_LogDerivative.lean b/StrongPNT/Erdos970/PNT2_LogDerivative.lean +new file mode 100644 +index 0000000..4d1d6e5 +--- /dev/null ++++ b/StrongPNT/Erdos970/PNT2_LogDerivative.lean +@@ -0,0 +1,3971 @@ ++import StrongPNT.Erdos970.PNT1_ComplexAnalysis ++ ++namespace Erdos970 ++ ++ ++lemma DRinD1 (R : ℝ) (_hR : 0 < R) (hR' : R < 1) : ++ Metric.closedBall (0 : ℂ) R ⊆ Metric.ball (0 : ℂ) 1 := by ++ exact Metric.closedBall_subset_ball hR' ++def zerosetKfR (R : ℝ) (_hR : 0 < R) (f : ℂ → ℂ) : Set ℂ := ++ {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ f ρ = 0} ++lemma lemKinDR (R : ℝ) (hR : 0 < R) (f : ℂ → ℂ) : ++ zerosetKfR R hR f ⊆ Metric.closedBall (0 : ℂ) R := by ++ intro ρ hρ ++ ++ rw [zerosetKfR] at hρ ++ ++ exact hρ.1 ++lemma lemKRinK1 (R : ℝ) (hR : 0 < R) (hR' : R < 1) (f : ℂ → ℂ) : ++ zerosetKfR R hR f ⊆ {ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0} := by ++ intro ρ hρ ++ simp only [zerosetKfR, Set.mem_ofPred_eq] at hρ ⊢ ++ constructor ++ · exact DRinD1 R hR hR' hρ.1 ++ · exact hρ.2 ++ ++lemma lem_bolzano_weierstrass {D : Set ℂ} (hD : IsCompact D) {Z : Set ℂ} (hZ_inf : Z.Infinite) (hZ_sub_D : Z ⊆ D) : ++ ∃ ρ₀ ∈ D, AccPt ρ₀ (Filter.principal Z) := ++ Set.Infinite.exists_accPt_of_subset_isCompact hZ_inf hD hZ_sub_D ++lemma lem_zeros_have_limit_point (R : ℝ) (hR : 0 < R) (f : ℂ → ℂ) (h_Kf_inf : Set.Infinite (zerosetKfR R hR f)) : ++ ∃ ρ₀ ∈ Metric.closedBall (0 : ℂ) R, AccPt ρ₀ (Filter.principal (zerosetKfR R hR f)) := by ++ apply lem_bolzano_weierstrass ++ · ++ rw [← lem_ballDR R hR] ++ exact lem_DRcompact R hR ++ · exact h_Kf_inf ++ · exact lemKinDR R hR f ++ ++open Filter Metric Set Bornology Function ++ ++lemma lem_identity_theorem (f : ℂ → ℂ) ++ (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) ++ (ρ₀ : ℂ) (hρ₀_in_D1 : ρ₀ ∈ Metric.ball (0 : ℂ) 1) ++ (h_acc : AccPt ρ₀ (Filter.principal ({ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0}))) : ++ EqOn f 0 (Metric.ball (0 : ℂ) 1) := by ++ ++ have h_subset : Metric.ball (0 : ℂ) 1 ⊆ Metric.closedBall (0 : ℂ) 1 := Metric.ball_subset_closedBall ++ ++ have hf_open : AnalyticOnNhd ℂ f (Metric.ball (0 : ℂ) 1) := AnalyticOnNhd.mono hf h_subset ++ ++ have h_conn : IsConnected (Metric.ball (0 : ℂ) 1) := Metric.isConnected_ball (by norm_num : (0 : ℝ) < 1) ++ have h_preconn : IsPreconnected (Metric.ball (0 : ℂ) 1) := h_conn.isPreconnected ++ ++ have h_zeros_subset : {ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0} ⊆ {z | f z = 0} := by ++ intro z hz ++ exact hz.2 ++ ++ have h_acc_zero : AccPt ρ₀ (Filter.principal ({z | f z = 0})) := by ++ exact AccPt.mono h_acc (principal_mono.2 h_zeros_subset) ++ ++ have h_closure : ρ₀ ∈ closure ({z | f z = 0} \ {ρ₀}) := by ++ ++ have h_cluster : ClusterPt ρ₀ (Filter.principal ({z | f z = 0} \ {ρ₀})) := ++ (accPt_principal_iff_clusterPt).mp h_acc_zero ++ exact (mem_closure_iff_clusterPt).2 h_cluster ++ ++ exact AnalyticOnNhd.eqOn_zero_of_preconnected_of_mem_closure hf_open h_preconn hρ₀_in_D1 h_closure ++lemma lem_identity_theoremR (R : ℝ) (hR : 0 < R) (hR' : R < 1) ++ (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) ++ (ρ₀ : ℂ) (hρ₀_in_DR : ρ₀ ∈ Metric.closedBall (0 : ℂ) R) ++ (h_acc : AccPt ρ₀ (Filter.principal ({ρ : ℂ | ρ ∈ Metric.ball (0 : ℂ) 1 ∧ f ρ = 0}))) : ++ EqOn f 0 (Metric.ball (0 : ℂ) 1) := by ++ have hρ₀_in_D1 : ρ₀ ∈ Metric.ball (0 : ℂ) 1 := DRinD1 R hR hR' hρ₀_in_DR ++ exact lem_identity_theorem f hf ρ₀ hρ₀_in_D1 h_acc ++lemma lem_identity_theoremKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) ++ (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) ++ (h_exists_rho0 : ∃ ρ₀ ∈ Metric.closedBall (0 : ℂ) R, AccPt ρ₀ (Filter.principal (zerosetKfR R hR f))) : ++ EqOn f 0 (Metric.ball (0 : ℂ) 1) := by ++ ++ obtain ⟨ρ₀, hρ₀_in_R, h_acc⟩ := h_exists_rho0 ++ ++ apply lem_identity_theoremR R hR hR' f hf ρ₀ hρ₀_in_R ++ ++ exact AccPt.mono h_acc (principal_mono.2 (lemKRinK1 R hR hR' f)) ++lemma lem_identity_infiniteKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) ++ (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) ++ (h_Kf_inf : Set.Infinite (zerosetKfR R hR f)) : ++ EqOn f 0 (Metric.ball (0 : ℂ) 1) := by ++ have h_exists_rho0 := lem_zeros_have_limit_point R hR f h_Kf_inf ++ exact lem_identity_theoremKR R hR hR' f hf h_exists_rho0 ++lemma lem_Contra_finiteKR (R : ℝ) (hR : 0 < R) (hR' : R < 1) ++ (f : ℂ → ℂ) (hf : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) 1)) ++ (h_exists_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, f z ≠ 0) : ++ Set.Finite (zerosetKfR R hR f) := by ++ ++ by_contra h_not_finite ++ ++ have h_Kf_inf : Set.Infinite (zerosetKfR R hR f) := h_not_finite ++ ++ have h_eq_zero := lem_identity_infiniteKR R hR hR' f hf h_Kf_inf ++ ++ obtain ⟨z, hz_in_ball, hz_nonzero⟩ := h_exists_nonzero ++ have h_f_z_zero : f z = 0 := h_eq_zero hz_in_ball ++ exact hz_nonzero h_f_z_zero ++ ++open Classical ++ ++lemma lem_frho_zero (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (_hR1_lt_R : R1 < R) ++ (f : ℂ → ℂ) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : ++ f ρ = 0 := h_rho_in_KfR1.2 ++ ++lemma lem_m_rho_is_nat (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hR_lt_1 : R < 1) : ++ ∀ (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f), ++ analyticOrderAt f ρ ≠ ⊤ := by ++ intro ρ h_rho_in_KfR1 ++ ++ have hρ_closed_R1 : ρ ∈ Metric.closedBall (0 : ℂ) R1 := h_rho_in_KfR1.1 ++ ++ have hR1_le_R : R1 ≤ R := by linarith ++ have hR1_lt_one : R1 < 1 := by linarith ++ ++ have hρ_ball1 : ρ ∈ Metric.ball (0 : ℂ) 1 := by ++ have hdist_le : dist ρ (0 : ℂ) ≤ R1 := (Metric.mem_closedBall.mp hρ_closed_R1) ++ have hdist_lt : dist ρ (0 : ℂ) < 1 := by linarith ++ simpa [Metric.mem_ball] using hdist_lt ++ ++ have hf_at_ρ : AnalyticAt ℂ f ρ := by ++ ++ have hsubset : Metric.closedBall (0 : ℂ) R1 ⊆ Metric.closedBall (0 : ℂ) 1 := ++ Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_one) ++ have hρ_closed1 : ρ ∈ Metric.closedBall (0 : ℂ) 1 := hsubset hρ_closed_R1 ++ exact h_f_analytic ρ hρ_closed1 ++ ++ by_contra htop ++ ++ have h_eventually_zero : ∀ᶠ z in nhds ρ, f z = 0 := by ++ have h_equiv : (analyticOrderAt f ρ = ⊤ ↔ ∀ᶠ z in nhds ρ, f z = 0) := by ++ simp [analyticOrderAt, hf_at_ρ] ++ exact h_equiv.mp (by simpa using htop) ++ ++ have hf_on_ball : AnalyticOnNhd ℂ f (Metric.ball (0 : ℂ) 1) := by ++ intro z hz ++ have hz' : z ∈ Metric.closedBall (0 : ℂ) 1 := ++ (Metric.ball_subset_closedBall : Metric.ball (0 : ℂ) 1 ⊆ Metric.closedBall (0 : ℂ) 1) hz ++ exact h_f_analytic z hz' ++ ++ have h_preconn : IsPreconnected (Metric.ball (0 : ℂ) 1) := ++ (Metric.isConnected_ball (by exact (zero_lt_one : (0 : ℝ) < 1))).isPreconnected ++ ++ have h_eqOn_zero : Set.EqOn f 0 (Metric.ball (0 : ℂ) 1) := ++ AnalyticOnNhd.eqOn_zero_of_preconnected_of_eventuallyEq_zero hf_on_ball h_preconn hρ_ball1 ++ h_eventually_zero ++ ++ have h0_in_ball : (0 : ℂ) ∈ Metric.ball (0 : ℂ) 1 := by ++ simp [Metric.mem_ball] ++ have : f 0 = 0 := by ++ have h := h_eqOn_zero h0_in_ball ++ simpa [Pi.zero_apply] using h ++ exact h_f_nonzero_at_zero this ++ ++lemma analyticOrderAt_ge_one_of_zero (f : ℂ → ℂ) (z : ℂ) (hf : AnalyticAt ℂ f z) (hz : f z = 0) (hfinite : analyticOrderAt f z ≠ ⊤) : analyticOrderAt f z ≥ 1 := by ++ ++ have h_order_ne_zero : analyticOrderAt f z ≠ 0 := by ++ intro h_order_zero ++ ++ have h_f_ne_zero : f z ≠ 0 := by ++ rw [← AnalyticAt.analyticOrderAt_eq_zero hf] ++ exact h_order_zero ++ ++ exact h_f_ne_zero hz ++ ++ cases' h : analyticOrderAt f z with n ++ · ++ ++ rw [h] at hfinite ++ exact False.elim (hfinite rfl) ++ · ++ ++ rw [h] at h_order_ne_zero ++ have n_ne_zero : n ≠ 0 := by ++ intro n_zero ++ rw [n_zero, Nat.cast_zero] at h_order_ne_zero ++ exact h_order_ne_zero rfl ++ ++ have n_ge_one : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr n_ne_zero ++ ++ exact Nat.cast_le.mpr n_ge_one ++ ++lemma lem_m_rho_ge_1 (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hR_lt_1 : R < 1) : ++ ∀ (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f), ++ analyticOrderAt f ρ ≥ 1 := by ++ intro ρ h_rho_in_KfR1 ++ ++ have h_f_rho_zero : f ρ = 0 := lem_frho_zero R R1 hR1_pos hR1_lt_R f h_f_analytic ρ h_rho_in_KfR1 ++ ++ have h_order_finite : analyticOrderAt f ρ ≠ ⊤ := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 ρ h_rho_in_KfR1 ++ ++ have h_f_analytic_at_rho : AnalyticAt ℂ f ρ := by ++ apply h_f_analytic ++ ++ have h_R1_lt_1 : R1 < 1 := by linarith ++ have h_rho_in_R1 : ρ ∈ Metric.closedBall 0 R1 := h_rho_in_KfR1.1 ++ exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) h_rho_in_R1 ++ ++ exact analyticOrderAt_ge_one_of_zero f ρ h_f_analytic_at_rho h_f_rho_zero h_order_finite ++ ++noncomputable def Cf ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (_hR1_lt_R : R1 < R) ++ (_hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (_h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (z : ℂ) : ℂ := ++ if hz : z ∈ zerosetKfR R1 (by linarith) f then ++ h_σ z z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase z), (z - ρ) ^ (analyticOrderAt f ρ).toNat ++ else ++ f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat ++ ++lemma lem_analDiv (R : ℝ) (_hR_pos : 0 < R) (_hR_lt_1 : R < 1) (w : ℂ) ++ (_hw : w ∈ Metric.closedBall (0 : ℂ) R) ++ (h : ℂ → ℂ) (g : ℂ → ℂ) ++ (hh : AnalyticAt ℂ h w) (hg : AnalyticAt ℂ g w) (hg_ne : g w ≠ 0) : ++ AnalyticAt ℂ (fun z => h z / g z) w := by ++ convert hh.div hg hg_ne using 1 ++ ++lemma lem_denomAnalAt (S : Finset ℂ) (n : ℂ → ℕ) ++ (_hn_pos : ∀ s ∈ S, 0 < n s) (w : ℂ) (hw : w ∉ S) : ++ AnalyticAt ℂ (fun z => ∏ s ∈ S, (z - s) ^ (n s)) w ∧ ++ (∏ s ∈ S, (w - s) ^ (n s)) ≠ 0 := by ++ constructor ++ · ++ ++ let f : ℂ → ℂ → ℂ := fun s z => (z - s) ^ (n s) ++ have h_each_analytic : ∀ s ∈ S, AnalyticAt ℂ (f s) w := by ++ intro s hs ++ simp only [f] ++ ++ have h_sub : AnalyticAt ℂ (fun z => z - s) w := by ++ exact AnalyticAt.sub analyticAt_id analyticAt_const ++ ++ exact h_sub.pow (n s) ++ have h_prod := Finset.analyticAt_prod S h_each_analytic ++ convert h_prod using 1 ++ first | rfl | (ext z; simp [f]) ++ · ++ apply Finset.prod_ne_zero_iff.mpr ++ intro s hs ++ apply pow_ne_zero ++ ++ intro h_eq ++ ++ have h_w_eq_s : w = s := by ++ rwa [← sub_eq_zero] ++ ++ rw [h_w_eq_s] at hw ++ exact hw hs ++ ++lemma lem_ratioAnalAt (w : ℂ) (R R1 : ℝ) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) ++ (h : ℂ → ℂ) (hh : AnalyticAt ℂ h w) ++ (S : Finset ℂ) (_hS : ↑S ⊆ Metric.closedBall (0 : ℂ) R1) (n : ℂ → ℕ) ++ (hn_pos : ∀ s ∈ S, 0 < n s) ++ (hw : w ∈ Metric.closedBall (0 : ℂ) 1 \ ↑S) : ++ AnalyticAt ℂ (fun z => h z / ∏ s ∈ S, (z - s) ^ (n s)) w := by ++ classical ++ ++ have hden := lem_denomAnalAt (S := S) (n := n) ++ (_hn_pos := hn_pos) (w := w) ++ (hw := by simpa using hw.2) ++ ++ exact AnalyticAt.div hh hden.1 hden.2 ++ ++lemma lem_analytic_zero_factor (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : ++ ∃ h_σ : ℂ → ℂ, AnalyticAt ℂ h_σ σ ∧ h_σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ z := by ++ classical ++ ++ have hσ_closed_R1 : σ ∈ Metric.closedBall (0 : ℂ) R1 := hσ.1 ++ have hR1_le_R : R1 ≤ R := by linarith ++ have hR1_lt_one : R1 < 1 := by linarith ++ have hσ_closed1 : σ ∈ Metric.closedBall (0 : ℂ) 1 := ++ (Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_one)) hσ_closed_R1 ++ have hfσ : AnalyticAt ℂ f σ := h_f_analytic σ hσ_closed1 ++ ++ have h_order_finite : analyticOrderAt f σ ≠ ⊤ := ++ lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 σ hσ ++ ++ rcases (hfσ.analyticOrderAt_ne_top).mp h_order_finite with ⟨g, hgσ, hgσ_ne, h_eq⟩ ++ ++ have h_eq' : ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * g z := by ++ refine h_eq.mono ?_ ++ intro z hz ++ simpa [smul_eq_mul, analyticOrderNatAt] using hz ++ exact ⟨g, hgσ, hgσ_ne, h_eq'⟩ ++ ++lemma lem_Cf_analytic_off_K ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : ++ AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) z := by ++ ++ have h_ratio_analytic : AnalyticAt ℂ (fun w => f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) z := by ++ apply lem_ratioAnalAt z R R1 hR1_lt_R hR_lt_1 f ++ ++ · apply h_f_analytic ++ exact Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) hz.1 ++ ++ · intro ρ hρ ++ have h_mem : ρ ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hρ ++ exact h_mem.1 ++ ++ · intro s hs ++ have h_s_in_zeros : s ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hs ++ have h_order_ge_1 := lem_m_rho_ge_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros ++ have h_order_finite := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros ++ ++ cases' h_cases : analyticOrderAt f s with n ++ · ++ rw [h_cases] at h_order_finite ++ exact False.elim (h_order_finite rfl) ++ · ++ have n_ge_1 : n ≥ 1 := by ++ rw [h_cases] at h_order_ge_1 ++ exact Nat.cast_le.mp h_order_ge_1 ++ simp ++ exact Nat.pos_iff_ne_zero.mpr (ne_of_gt n_ge_1) ++ ++ · constructor ++ · exact Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) hz.1 ++ · ++ intro h_z_in_finset ++ have h_z_in_zeros : z ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp h_z_in_finset ++ exact hz.2 h_z_in_zeros ++ ++ have h_eventually_eq : (fun w => f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) =ᶠ[nhds z] ++ (fun w => Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ w) := by ++ ++ have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 ++ have h_open : IsOpen (Set.compl (zerosetKfR R1 (by linarith) f)) := h_finite_zeros.isClosed.isOpen_compl ++ apply Filter.eventually_of_mem (h_open.mem_nhds hz_not_in) ++ intro w hw_not_in_compl ++ ++ have hw_not_in_zeros : w ∉ zerosetKfR R1 (by linarith) f := hw_not_in_compl ++ ++ show f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat = ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ w ++ ++ rw [Cf, dite_eq_right hw_not_in_zeros] ++ ++ exact h_ratio_analytic.congr h_eventually_eq ++ ++lemma lem_Cf_at_sigma_onK ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : ++ ∀ᶠ z in nhds σ, z = σ → ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ h_σ z z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by ++ refine Filter.Eventually.of_forall ?_ ++ intro z hz ++ subst hz ++ simp [Cf, hσ] ++ ++lemma lem_K_isolated ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {_h_f_nonzero_at_zero : f 0 ≠ 0} ++ (σ ρ : ℂ) (_hσ : σ ∈ zerosetKfR R1 (by linarith) f) ++ (_hρ : ρ ∈ zerosetKfR R1 (by linarith) f) (hne : σ ≠ ρ) : ++ ∀ᶠ z in nhds σ, z ≠ ρ := eventually_ne_nhds hne ++ ++lemma lem_Cf_at_sigma_offK0 ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : ++ ∀ᶠ z in nhds σ, z ≠ σ → ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z / ++ ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by ++ ++ obtain ⟨h_σ_analytic, h_σ_ne_zero, h_f_eq⟩ := h_σ_spec σ hσ ++ ++ have h_σ_eventually_nonzero : ∀ᶠ z in nhds σ, h_σ σ z ≠ 0 := by ++ have h_cont : ContinuousAt (h_σ σ) σ := h_σ_analytic.continuousAt ++ exact h_cont.eventually_ne h_σ_ne_zero ++ ++ have h_f_eventually_nonzero : ∀ᶠ z in nhds σ, z ≠ σ → f z ≠ 0 := by ++ filter_upwards [h_f_eq, h_σ_eventually_nonzero] with z h_fz_eq h_σz_nonzero ++ intro hz_ne ++ rw [h_fz_eq] ++ apply mul_ne_zero ++ · apply pow_ne_zero ++ exact sub_ne_zero.mpr hz_ne ++ · exact h_σz_nonzero ++ ++ have h_eventually_not_in_zeroset : ∀ᶠ z in nhds σ, z ≠ σ → z ∉ zerosetKfR R1 (by linarith) f := by ++ filter_upwards [h_f_eventually_nonzero] with z h_fz_nonzero ++ intro hz_ne hz_in_zeroset ++ exact h_fz_nonzero hz_ne hz_in_zeroset.2 ++ ++ filter_upwards [h_f_eq, h_eventually_not_in_zeroset] with z h_fz_eq h_not_in_zeroset ++ intro hz_ne ++ ++ have hz_not_in_K : z ∉ zerosetKfR R1 (by linarith) f := h_not_in_zeroset hz_ne ++ ++ unfold Cf ++ simp [hz_not_in_K, h_fz_eq] ++ ++lemma lem_prod_no_sigma1 ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {_h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) (z : ℂ) : ++ ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat = ++ (z - σ) ^ (analyticOrderAt f σ).toNat * ++ ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by ++ classical ++ have hmem : σ ∈ h_finite_zeros.toFinset := ++ (Set.Finite.mem_toFinset (hs := h_finite_zeros)).2 hσ ++ simpa using ++ (Finset.mul_prod_erase (s := h_finite_zeros.toFinset) ++ (f := fun ρ => (z - ρ) ^ (analyticOrderAt f ρ).toNat) (a := σ) hmem).symm ++ ++lemma lem_prod_no_sigma2 ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) (z : ℂ) ++ (hz : z ∉ zerosetKfR R1 (by linarith) f) : ++ (z - σ) ^ (analyticOrderAt f σ).toNat / ++ ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat = ++ 1 / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by ++ ++ have h_factor := @lem_prod_no_sigma1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ z ++ rw [h_factor] ++ ++ rw [div_mul_eq_div_div] ++ ++ have h_nonzero : (z - σ) ^ (analyticOrderAt f σ).toNat ≠ 0 := by ++ apply pow_ne_zero ++ intro h_eq ++ ++ have h_z_eq_sigma : z = σ := sub_eq_zero.mp h_eq ++ rw [h_z_eq_sigma] at hz ++ exact hz hσ ++ ++ rw [div_self h_nonzero, one_div] ++ ++lemma lem_Cf_at_sigma_offK ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : ++ ∀ᶠ z in nhds σ, z ≠ σ → ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by ++ ++ have h_cf_form := @lem_Cf_at_sigma_offK0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ ++ ++ filter_upwards [h_cf_form] with z h_cf_z ++ intro hz_ne_sigma ++ ++ rw [h_cf_z hz_ne_sigma] ++ ++ have h_prod_decomp := @lem_prod_no_sigma1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ z ++ ++ rw [h_prod_decomp] ++ ++ apply mul_div_mul_left ++ ++ apply pow_ne_zero ++ exact sub_ne_zero.mpr hz_ne_sigma ++ ++lemma lem_Cf_at_sigma ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : ++ ∀ᶠ z in nhds σ, ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat := by ++ ++ have h_on := @lem_Cf_at_sigma_onK R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ ++ have h_off := @lem_Cf_at_sigma_offK R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ ++ ++ filter_upwards [h_on, h_off] with z hz_on hz_off ++ by_cases h : z = σ ++ · ++ have eq_result := hz_on h ++ ++ rw [h] at eq_result ⊢ ++ exact eq_result ++ · ++ exact hz_off h ++ ++lemma lem_h_ratio_anal ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (σ : ℂ) (_hσ : σ ∈ zerosetKfR R1 (by linarith) f) ++ (g : ℂ → ℂ) (hg_analytic : AnalyticAt ℂ g σ) : ++ AnalyticAt ℂ ++ (fun z => g z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), ++ (z - ρ) ^ (analyticOrderAt f ρ).toNat) σ := by ++ ++ have hden := lem_denomAnalAt (S := h_finite_zeros.toFinset.erase σ) ++ (n := fun ρ => (analyticOrderAt f ρ).toNat) ++ (_hn_pos := by ++ intro s hs ++ have h_s_in_zeros : s ∈ zerosetKfR R1 (by linarith) f := by ++ have h_mem_erase : s ∈ h_finite_zeros.toFinset.erase σ := hs ++ have h_mem_orig : s ∈ h_finite_zeros.toFinset := Finset.mem_of_mem_erase h_mem_erase ++ exact h_finite_zeros.mem_toFinset.mp h_mem_orig ++ have h_order_ge_1 := lem_m_rho_ge_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros ++ have h_order_finite := lem_m_rho_is_nat R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero hR_lt_1 s h_s_in_zeros ++ cases' h_cases : analyticOrderAt f s with n ++ · ++ rw [h_cases] at h_order_finite ++ exact False.elim (h_order_finite rfl) ++ · ++ have n_ge_1 : n ≥ 1 := by ++ rw [h_cases] at h_order_ge_1 ++ exact Nat.cast_le.mp h_order_ge_1 ++ simp ++ exact Nat.pos_iff_ne_zero.mpr (ne_of_gt n_ge_1)) ++ (w := σ) ++ (hw := by ++ simp [Finset.mem_erase]) ++ ++ exact AnalyticAt.div hg_analytic hden.1 hden.2 ++ ++lemma lem_Cf_analytic_at_K ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : ++ AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) σ := by ++ ++ have h_eventually_eq := @lem_Cf_at_sigma R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec σ hσ ++ ++ obtain ⟨h_σ_analytic, _, _⟩ := h_σ_spec σ hσ ++ have h_ratio_analytic := @lem_h_ratio_anal R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros σ hσ (h_σ σ) h_σ_analytic ++ ++ have h_rev_eq : (fun z => h_σ σ z / ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), (z - ρ) ^ (analyticOrderAt f ρ).toNat) =ᶠ[nhds σ] ++ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) := by ++ filter_upwards [h_eventually_eq] with z h_z ++ exact h_z.symm ++ ++ exact AnalyticAt.congr h_ratio_analytic h_rev_eq ++ ++lemma lem_Cf_is_analytic ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R) : ++ AnalyticAt ℂ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) z := by ++ ++ by_cases h_case : z ∈ zerosetKfR R1 (by linarith) f ++ ++ case pos => ++ ++ exact lem_Cf_analytic_at_K h_finite_zeros h_σ h_σ_spec z h_case ++ ++ case neg => ++ ++ have hz_in_complement : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f := by ++ constructor ++ · exact hz ++ · exact h_case ++ exact lem_Cf_analytic_off_K h_finite_zeros h_σ h_σ_spec z hz_in_complement ++ ++lemma lem_f_nonzero_off_K ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} {_h_f_nonzero_at_zero : f 0 ≠ 0} ++ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : ++ f z ≠ 0 := by ++ exact fun h => hz.2 ⟨hz.1, h⟩ ++ ++lemma lem_Cf_nonzero_off_K ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z ≠ 0 := by ++ ++ have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 ++ ++ have h_cf_eq : Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by ++ unfold Cf ++ simp [hz_not_in] ++ ++ rw [h_cf_eq] ++ ++ apply div_ne_zero ++ ++ · apply @lem_f_nonzero_off_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero z hz ++ ++ · apply Finset.prod_ne_zero_iff.mpr ++ intro ρ hρ ++ ++ apply pow_ne_zero ++ ++ intro h_eq ++ ++ have hz_eq_rho : z = ρ := by ++ rwa [sub_eq_zero] at h_eq ++ ++ have hρ_in : ρ ∈ zerosetKfR R1 (by linarith) f := h_finite_zeros.mem_toFinset.mp hρ ++ rw [hz_eq_rho] at hz_not_in ++ exact hz_not_in hρ_in ++ ++lemma lem_Cf_nonzero_on_K ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (σ : ℂ) (hσ : σ ∈ zerosetKfR R1 (by linarith) f) : ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ σ ≠ 0 := by ++ have hnum : h_σ σ σ ≠ 0 := (h_σ_spec σ hσ).2.1 ++ have hden : ++ (∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), ++ (σ - ρ) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by ++ refine Finset.prod_ne_zero_iff.mpr ?_ ++ intro ρ hρmem ++ have hρ_ne_σ : ρ ≠ σ := (Finset.mem_erase.mp hρmem).1 ++ have hσ_ne_ρ : σ ≠ ρ := hρ_ne_σ.symm ++ exact pow_ne_zero _ (sub_ne_zero.mpr hσ_ne_ρ) ++ have : ++ h_σ σ σ / ++ ∏ ρ ∈ (h_finite_zeros.toFinset.erase σ), ++ (σ - ρ) ^ (analyticOrderAt f ρ).toNat ≠ ++ 0 := by ++ exact div_ne_zero hnum hden ++ simpa [Cf, hσ] using this ++ ++lemma lem_Cf_never_zero ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1) : ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z ≠ 0 := by ++ ++ by_cases h : z ∈ zerosetKfR R1 (by linarith) f ++ · ++ exact lem_Cf_nonzero_on_K h_finite_zeros h_σ h_σ_spec z h ++ · ++ have hz_diff : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f := ⟨hz, h⟩ ++ exact lem_Cf_nonzero_off_K h_finite_zeros h_σ h_σ_spec z hz_diff ++ ++lemma factor_nonzero_outside_domain (R R1 : ℝ) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) ++ (ρ : ℂ) (hρ_bound : ‖ρ‖ ≤ R1) (_hρ_ne_zero : ρ ≠ 0) (z : ℂ) (hz_in_R1 : ‖z‖ ≤ R1) : ++ (R : ℂ) - star ρ * z / (R : ℂ) ≠ 0 := by ++ ++ intro h_eq_zero ++ have hR_pos : 0 < R := by linarith ++ ++ have h_mul_eq_R_sq : star ρ * z = (R : ℂ) ^ 2 := by ++ have hR_ne_zero : (R : ℂ) ≠ 0 := by ++ rw [Ne, ← norm_eq_zero] ++ simp ++ linarith ++ ++ rw [sub_eq_zero] at h_eq_zero ++ rw [eq_div_iff_mul_eq hR_ne_zero] at h_eq_zero ++ rw [← pow_two] at h_eq_zero ++ exact h_eq_zero.symm ++ ++ have h_norm_eq : ‖ρ‖ * ‖z‖ = R ^ 2 := by ++ have h_left : ‖star ρ * z‖ = ‖ρ‖ * ‖z‖ := by ++ rw [norm_mul, norm_star] ++ have h_right : ‖(R : ℂ) ^ 2‖ = R ^ 2 := by ++ rw [Complex.norm_pow, Complex.norm_of_nonneg (le_of_lt hR_pos)] ++ rw [← h_left, h_mul_eq_R_sq, h_right] ++ ++ have h_R_sq_le : R ^ 2 ≤ R1 ^ 2 := by ++ calc R ^ 2 ++ = ‖ρ‖ * ‖z‖ := h_norm_eq.symm ++ _ ≤ R1 * ‖z‖ := mul_le_mul_of_nonneg_right hρ_bound (norm_nonneg z) ++ _ ≤ R1 * R1 := mul_le_mul_of_nonneg_left hz_in_R1 (le_of_lt hR1_pos) ++ _ = R1 ^ 2 := by rw [← pow_two] ++ ++ have h_R_le_R1 : R ≤ R1 := by ++ exact le_of_pow_le_pow_left₀ (by norm_num) (le_of_lt hR1_pos) h_R_sq_le ++ ++ linarith ++ ++lemma linear_pow_analytic (a b : ℂ) (n : ℕ) (z : ℂ) : ++ AnalyticAt ℂ (fun w => (a - b * w) ^ n) z := by ++ ++ have h_linear : AnalyticAt ℂ (fun w => a - b * w) z := by ++ ++ have h_const : AnalyticAt ℂ (fun _ => a) z := analyticAt_const ++ ++ have h_mul : AnalyticAt ℂ (fun w => b * w) z := by ++ have h_id : AnalyticAt ℂ (fun w => w) z := analyticAt_id ++ convert h_id.const_smul (c := b) using 1 ++ ++ exact h_const.sub h_mul ++ ++ exact h_linear.fun_pow n ++ ++lemma bl_num_diff ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {_h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R) : ++ DifferentiableAt ℂ ++ (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ · ++ have h_analytic : AnalyticAt ℂ (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ ++ let factor_func : ℂ → ℂ → ℂ := fun ρ w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat ++ ++ have h_each_analytic : ∀ ρ ∈ h_finite_zeros.toFinset, AnalyticAt ℂ (factor_func ρ) z := by ++ intro ρ hρ_mem ++ simp only [factor_func] ++ ++ have h_rewrite : (fun w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) = ++ (fun w => ((R : ℂ) - (star ρ / (R : ℂ)) * w) ^ (analyticOrderAt f ρ).toNat) := by ++ ext w ++ ring ++ rw [h_rewrite] ++ ++ exact linear_pow_analytic (R : ℂ) (star ρ / (R : ℂ)) (analyticOrderAt f ρ).toNat z ++ ++ have h_prod_analytic := Finset.analyticAt_prod h_finite_zeros.toFinset h_each_analytic ++ ++ convert h_prod_analytic using 1; first | rfl | (ext w; simp [factor_func]) ++ ++ exact h_analytic.differentiableAt ++ ++lemma lem_bl_num_nonzero ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : ++ (∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by ++ ++ · refine Finset.prod_ne_zero_iff.mpr ?_ ++ intro ρ hρ_mem ++ apply pow_ne_zero ++ ++ have hρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := ++ h_finite_zeros.mem_toFinset.mp hρ_mem ++ have hρ_bound : ‖ρ‖ ≤ R1 := by ++ ++ have : dist ρ 0 ≤ R1 := Metric.mem_closedBall.mp hρ_in_zeros.1 ++ simp only [dist_zero_right] at this ++ exact this ++ have hρ_ne_zero : ρ ≠ 0 := by ++ intro h_eq_zero ++ rw [h_eq_zero] at hρ_in_zeros ++ exact h_f_nonzero_at_zero hρ_in_zeros.2 ++ have hz_bound : ‖z‖ ≤ R1 := by ++ have : dist z 0 ≤ R1 := Metric.mem_closedBall.mp hz.1 ++ simp only [dist_zero_right] at this ++ exact this ++ exact factor_nonzero_outside_domain R R1 hR1_pos hR1_lt_R hR_lt_1 ρ hρ_bound hρ_ne_zero z hz_bound ++ ++noncomputable def Bf ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (z : ℂ) : ℂ := ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z * ++ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat ++ ++lemma lem_BfCf ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ f z * (∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) / ++ (∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat) := by ++ ++ have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := hz.2 ++ ++ unfold Bf ++ ++ unfold Cf ++ simp [hz_not_in] ++ ++ exact div_mul_eq_mul_div _ _ _ ++ ++lemma lem_Bf_div ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {_h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : ++ (∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) / ++ (∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat) = ++ ∏ ρ ∈ h_finite_zeros.toFinset, ++ (((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat / ++ (z - ρ) ^ (analyticOrderAt f ρ).toNat) := by ++ rw [Finset.prod_div_distrib] ++ ++lemma lem_Bf_prodpow ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {_hR1_lt_R : R1 < R} {_hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {_h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (z : ℂ) (_hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : ++ ∏ ρ ∈ h_finite_zeros.toFinset, ++ (((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat / ++ (z - ρ) ^ (analyticOrderAt f ρ).toNat) = ++ ∏ ρ ∈ h_finite_zeros.toFinset, ++ (((R : ℂ) - star ρ * z / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat := by ++ simp only [div_pow] ++ ++lemma lem_Bf_off_K ++ {R R1 : ℝ} {hR1_pos : 0 < R1} {hR1_lt_R : R1 < R} {hR_lt_1 : R < 1} ++ {f : ℂ → ℂ} ++ {h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z} ++ {h_f_nonzero_at_zero : f 0 ≠ 0} ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f) : ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ f z * ∏ ρ ∈ h_finite_zeros.toFinset, ++ (((R : ℂ) - star ρ * z / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat := by ++ ++ rw [lem_BfCf h_finite_zeros h_σ z hz] ++ ++ rw [mul_div_assoc] ++ ++ congr 1 ++ ++ rw [@lem_Bf_div R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros z hz] ++ ++ rw [@lem_Bf_prodpow R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros z hz] ++ ++lemma lem_frho_zero_contra ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (_hR1_lt_R : R1 < R) ++ (f : ℂ → ℂ) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (ρ : ℂ) : f ρ ≠ 0 → ρ ∉ zerosetKfR R1 (by linarith) f := by ++ intro h_f_rho_ne_zero h_rho_in_KfR1 ++ ++ have h_f_rho_zero : f ρ = 0 := h_rho_in_KfR1.2 ++ ++ exact h_f_rho_ne_zero h_f_rho_zero ++ ++lemma lem_f_is_nonzero (f : ℂ → ℂ) : f 0 ≠ 0 → f ≠ 0 := by ++ intro h_f_zero_ne_zero h_f_eq_zero ++ ++ have h_f_at_zero_eq_zero : f 0 = 0 := by ++ rw [h_f_eq_zero] ++ simp ++ ++ exact h_f_zero_ne_zero h_f_at_zero_eq_zero ++ ++theorem lem_rho_in_disk_R1 ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (_hR1_lt_R : R1 < R) ++ (f : ℂ → ℂ) ++ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : ++ norm ρ ≤ R1 := by ++ ++ have h_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R1 := h_rho_in_KfR1.1 ++ ++ rw [Metric.mem_closedBall, Complex.dist_eq] at h_in_ball ++ simp only [sub_zero] at h_in_ball ++ exact h_in_ball ++ ++theorem lem_zero_not_in_Kf (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (_hR1_lt_R : R1 < R) ++ (f : ℂ → ℂ) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) : ++ f 0 ≠ 0 → 0 ∉ zerosetKfR R1 (by linarith) f := by ++ intro h_f_zero_ne_zero h_zero_in_KfR1 ++ ++ have h_f_zero_eq_zero : f 0 = 0 := h_zero_in_KfR1.2 ++ ++ exact h_f_zero_ne_zero h_f_zero_eq_zero ++ ++lemma lem_rho_ne_zero (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) : ++ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, ρ ≠ 0 := by ++ intro ρ h_ρ_in_zeros h_ρ_eq_zero ++ ++ rw [h_ρ_eq_zero] at h_ρ_in_zeros ++ ++ have h_zero_not_in : 0 ∉ zerosetKfR R1 (by linarith) f := ++ lem_zero_not_in_Kf R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ++ exact h_zero_not_in h_ρ_in_zeros ++ ++lemma lem_mod_pos_iff_ne_zero (z : ℂ) : z ≠ 0 → norm z > 0 := ++ lem_abspos z ++ ++theorem lem_mod_rho_pos ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) : ++ ∀ (ρ : ℂ), ρ ∈ zerosetKfR R1 (by linarith) f → norm ρ > 0 := by ++ intro ρ h_ρ_in_zeros ++ ++ have h_ρ_ne_zero : ρ ≠ 0 := ++ lem_rho_ne_zero R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros ++ ++ exact lem_mod_pos_iff_ne_zero ρ h_ρ_ne_zero ++ ++theorem lem_rho_in_disk_R1_repeat (R R1 : ℝ) (hR1_pos : 0 < R1) ++(hR1_lt_R : R1 < R) (f : ℂ → ℂ) ++ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : ++ norm ρ ≤ R1 := ++ lem_rho_in_disk_R1 R R1 hR1_pos hR1_lt_R f ρ h_rho_in_KfR1 ++ ++lemma lem_inv_mono_decr (x y : ℝ) (hx : 0 < x) (hxy : x ≤ y) : 1 / x ≥ 1 / y := by ++ ++ have hy : 0 < y := lt_of_lt_of_le hx hxy ++ ++ exact one_div_le_one_div_of_le hx hxy ++ ++lemma lem_inv_mod_rho_ge_inv_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) ++(hR1_lt_R : R1 < R) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : ++ 1 / norm ρ ≥ 1 / R1 := by ++ ++ have h_abs_ρ_le_R1 : norm ρ ≤ R1 := ++ lem_rho_in_disk_R1 R R1 hR1_pos hR1_lt_R f ρ h_rho_in_KfR1 ++ ++ have h_abs_ρ_pos : norm ρ > 0 := ++ lem_mod_rho_pos R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 ++ ++ have h_R1_pos : R1 > 0 := by ++ linarith ++ ++ exact lem_inv_mono_decr (norm ρ) R1 h_abs_ρ_pos h_abs_ρ_le_R1 ++ ++theorem lem_mul_pos_preserves_ineq (a b c : ℝ) (hab : a ≤ b) (hc : 0 < c) : ++ a * c ≤ b * c := by ++ exact mul_le_mul_of_nonneg_right hab (le_of_lt hc) ++ ++theorem lem_R_div_mod_rho_ge_R_div_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) ++(hR1_lt_R : R1 < R) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) (ρ : ℂ) ++ (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : ++ R / norm ρ ≥ R / R1 := by ++ ++ have h_inv_ineq : 1 / norm ρ ≥ 1 / R1 := ++ lem_inv_mod_rho_ge_inv_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 ++ ++ have h_R_div_abs_ρ_eq : R * (1 / norm ρ) = R / norm ρ := by ring ++ have h_R_div_R1_eq : R * (1 / R1) = R / R1 := by ring ++ rw [← h_R_div_abs_ρ_eq, ← h_R_div_R1_eq] ++ exact mul_le_mul_of_nonneg_left h_inv_ineq (by linarith) ++ ++theorem lem_R_div_mod_rho_ge_R_over_R1 (R R1 : ℝ) (hR1_pos : 0 < R1) ++(hR1_lt_R : R1 < R) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) (ρ : ℂ) ++ (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : ++ R / norm ρ ≥ (R/R1 : ℝ) := by ++ ++ have h_ineq1 : R / norm ρ ≥ R / R1 := ++ lem_R_div_mod_rho_ge_R_div_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_rho_in_KfR1 ++ ++ linarith ++ ++theorem lem_mod_of_prod2 {ι : Type*} (K : Finset ι) (w : ι → ℂ) : ++ ‖∏ ρ ∈ K, w ρ‖ = ∏ ρ ∈ K, ‖w ρ‖ := by ++ classical ++ refine Finset.induction_on K ?h0 ?hstep ++ · simp ++ · intro a s ha ih ++ ++ simp [Finset.prod_insert ha, ih] ++ ++lemma lem_mod_Bf_is_prod_mod (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (z : ℂ) ++ (hz : z ∉ zerosetKfR R1 (by linarith) f) : ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = ++ ‖f z‖ * ∏ ρ ∈ h_finite_zeros.toFinset, ++ ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat‖ := by ++ ++ unfold Bf ++ rw [norm_mul] ++ ++ rw [lem_mod_of_prod2] ++ ++ have hCf : Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ f z / ∏ ρ ∈ h_finite_zeros.toFinset, (z - ρ) ^ (analyticOrderAt f ρ).toNat := by ++ unfold Cf ++ simp only [hz, ↓reduceDIte] ++ rw [hCf, norm_div] ++ ++ rw [lem_mod_of_prod2] ++ ++ rw [div_mul_eq_mul_div] ++ ++ rw [mul_div_assoc] ++ ++ rw [← Finset.prod_div_distrib] ++ congr 2 ++ ext ρ ++ ++ rw [← norm_div, ← div_pow] ++ congr 2 ++ ++ ring ++ ++lemma lem_abs_pow (w : ℂ) (n : ℕ) : ‖w ^ n‖ = ‖w‖ ^ n := by ++ simp ++ ++lemma lem_Bmod_pow (R R1 : ℝ) (hR_pos : 0 < R) (hR1 : R1 = 2 * R / 3) (f : ℂ → ℂ) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (ρ : ℂ) (_h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) ++ (z : ℂ) : ++ ‖((((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat)‖ = ++ (‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖) ^ (analyticOrderAt f ρ).toNat := by ++ simp ++ ++lemma lem_mod_Bf_prod_mod (R R1 : ℝ) (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (z : ℂ) ++ (hz : z ∉ zerosetKfR R1 (by linarith) f) : ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = ++ ‖f z‖ * ∏ ρ ∈ h_finite_zeros.toFinset, ++ ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ ^ (analyticOrderAt f ρ).toNat := by ++ ++ have h1 := lem_mod_Bf_is_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz ++ rw [h1] ++ ++ congr 2 ++ ext ρ ++ rw [lem_abs_pow] ++ ++lemma lem_mod_Bf_at_0 (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = ++ ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, ++ ‖((R : ℂ) / (-ρ))‖ ^ (analyticOrderAt f ρ).toNat := by ++ ++ have hz0 : 0 ∉ zerosetKfR R1 (by linarith) f := ++ lem_zero_not_in_Kf R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ++ rw [lem_mod_Bf_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec 0 hz0] ++ ++ congr 2 ++ ext ρ ++ congr 1 ++ simp only [zero_mul, zero_div, sub_zero, zero_sub] ++ ++lemma lem_mod_div_ (w1 w2 : ℂ) (_hw2_ne_zero : w2 ≠ 0) : ‖w1 / w2‖ = ‖w1‖ / ‖w2‖ := by ++ simp ++ ++lemma lem_mod_neg (w : ℂ) : ‖-w‖ = ‖w‖ := by ++ simp ++ ++lemma lem_mod_div_and_neg (R : ℝ) (hR_pos : 0 < R) (ρ : ℂ) (h_rho_ne_zero : ρ ≠ 0) : ++ ‖(R : ℂ) / (-ρ)‖ = R / ‖ρ‖ := by ++ ++ have hden : (-ρ) ≠ 0 := by simpa using neg_ne_zero.mpr h_rho_ne_zero ++ have hdiv := lem_mod_div_ (R : ℂ) (-ρ) hden ++ calc ++ ‖(R : ℂ) / (-ρ)‖ = ‖(R : ℂ)‖ / ‖-ρ‖ := hdiv ++ _ = ‖(R : ℂ)‖ / ‖ρ‖ := by simp [norm_neg] ++ _ = |R| / ‖ρ‖ := by simp ++ _ = R / ‖ρ‖ := by simp [abs_of_pos hR_pos] ++ ++theorem lem_mod_Bf_at_0_eval (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = ++ ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, ++ (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by ++ ++ rw [lem_mod_Bf_at_0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec] ++ ++ congr 1 ++ ++ apply Finset.prod_congr rfl ++ intro ρ hρ ++ ++ have h_ρ_ne_zero : ρ ≠ 0 := by ++ ++ have h_ρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := by ++ exact (Set.Finite.mem_toFinset h_finite_zeros).mp hρ ++ exact lem_rho_ne_zero R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros ++ ++ rw [lem_mod_div_and_neg R (by linarith) ρ h_ρ_ne_zero] ++ ++lemma lem_mod_of_pos_real (x : ℝ) (hx : 0 < x) : abs x = x := by ++ exact abs_of_pos hx ++ ++theorem lem_mod_Bf_at_0_as_ratio (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ = ++ ‖f 0‖ * ∏ ρ ∈ h_finite_zeros.toFinset, ++ (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by ++ exact lem_mod_Bf_at_0_eval R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec ++ ++lemma lem_prod_ineq {ι : Type*} (K : Finset ι) (a b : ι → ℝ) ++ (h_nonneg : ∀ ρ ∈ K, 0 ≤ a ρ) (h_le : ∀ ρ ∈ K, a ρ ≤ b ρ) : ++ ∏ ρ ∈ K, a ρ ≤ ∏ ρ ∈ K, b ρ := by ++ exact Finset.prod_le_prod₀ h_nonneg h_le ++ ++lemma lem_power_ineq (n : ℕ) (c : ℝ) (hc : c > 1) (hn : n ≥ 1) : c ≤ c ^ n := by ++ cases' n with n ++ · ++ omega ++ · ++ have h_c_ge_1 : 1 ≤ c := le_of_lt hc ++ rw [pow_succ] ++ ++ have h_c_pow_n_ge_1 : 1 ≤ c ^ n := by exact one_le_pow₀ h_c_ge_1 ++ calc c = c * 1 := (mul_one c).symm ++ _ ≤ c * c ^ n := mul_le_mul_of_nonneg_left h_c_pow_n_ge_1 (le_of_lt (lt_trans zero_lt_one hc)) ++ _ = c ^ n * c := mul_comm (c) (c ^ n) ++ ++lemma lem_power_ineq_1 (n : ℕ) (c : ℝ) (hc : 1 ≤ c) (_hn : 1 ≤ n) : 1 ≤ c ^ n := by ++ exact one_le_pow₀ hc ++ ++lemma lem_prod_power_ineq {ι : Type*} (K : Finset ι) (c : ι → ℝ) (n : ι → ℕ) ++ (h_c_ge_1 : ∀ ρ ∈ K, 1 ≤ c ρ) ++ (h_n_ge_1 : ∀ ρ ∈ K, 1 ≤ n ρ) : ++ ∏ ρ ∈ K, (c ρ) ^ (n ρ) ≥ 1 := by ++ classical ++ induction K using Finset.induction with ++ | empty => simp ++ | insert i s h_not_in ih => ++ rw [Finset.prod_insert h_not_in] ++ have h_pow_ge_1 : 1 ≤ c i ^ n i := ++ one_le_pow₀ (h_c_ge_1 i (Finset.mem_insert_self i s)) ++ have h_prod_ge_1 : 1 ≤ ∏ ρ ∈ s, (c ρ) ^ (n ρ) := by ++ apply ih ++ · intro ρ hρ; exact h_c_ge_1 ρ (Finset.mem_insert_of_mem hρ) ++ · intro ρ hρ; exact h_n_ge_1 ρ (Finset.mem_insert_of_mem hρ) ++ exact one_le_mul_of_one_le_of_one_le h_pow_ge_1 h_prod_ge_1 ++ ++theorem lem_prod_1 {ι : Type*} {M : Type*} [CommMonoid M] (K : Finset ι) : ∏ _ρ ∈ K, (1 : M) = 1 := by ++ exact Finset.prod_const_one ++ ++lemma lem_prod_power_ineq1 {ι : Type*} (K : Finset ι) (c : ι → ℝ) (n : ι → ℕ) ++ (h_c_ge_1 : ∀ ρ ∈ K, 1 ≤ c ρ) (h_n_ge_1 : ∀ ρ ∈ K, 1 ≤ n ρ) : ++ ∏ ρ ∈ K, (c ρ) ^ (n ρ) ≥ 1 := by ++ exact lem_prod_power_ineq K c n h_c_ge_1 h_n_ge_1 ++ ++lemma lem_mod_lower_bound_1 (R R1 : ℝ) (hR1_pos : 0 < R1) ++(hR1_lt_R : R1 < R) (f : ℂ → ℂ) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (_hf0_eq_one : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (_hR_lt_1 : R < 1) : ++ ∏ ρ ∈ h_finite_zeros.toFinset, ++ (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat ≥ 1 := by ++ classical ++ set K := h_finite_zeros.toFinset ++ ++ have h_base_ge_1 : (1 : ℝ) < (R/R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R ++ have h := ++ lem_prod_ineq K (fun _ : ℂ => (1 : ℝ)) ++ (fun ρ : ℂ => (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) ++ (by intro ρ hρ; norm_num) ++ (by ++ intro ρ hρ ++ simpa using (one_le_pow₀ (by linarith [h_base_ge_1]))) ++ simpa [K] using h ++ ++theorem lem_mod_Bf_at_0_ge_1 (R R1 : ℝ) (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hf0_eq_one : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≥ 1 := by ++ ++ have R_over_R1_nonneg : 1 < R / R1 := by exact (one_lt_div hR1_pos).mpr hR1_lt_R ++ have R_over_R1_nonneg : 0 ≤ R / R1 := by linarith ++ have h_f_nonzero_at_zero : f 0 ≠ 0 := by ++ rw [hf0_eq_one]; norm_num ++ ++ rw [lem_mod_Bf_at_0_as_ratio R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros] ++ ++ rw [hf0_eq_one, norm_one, one_mul] ++ ++ have h_prod_ge : ∏ ρ ∈ h_finite_zeros.toFinset, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat ≥ ++ ∏ ρ ∈ h_finite_zeros.toFinset, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat := by ++ apply Finset.prod_le_prod₀ ++ ++ · intro ρ hρ ++ apply pow_nonneg ++ apply R_over_R1_nonneg ++ ++ · intro ρ hρ ++ have h_ρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := by ++ exact (Set.Finite.mem_toFinset h_finite_zeros).mp hρ ++ ++ have h_ratio_ge : R / ‖ρ‖ ≥ (R/R1 : ℝ) := by ++ ++ have h_norm_abs_eq : ‖ρ‖ = norm ρ := by rfl ++ rw [h_norm_abs_eq] ++ exact lem_R_div_mod_rho_ge_R_over_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_f_nonzero_at_zero ρ h_ρ_in_zeros ++ ++ have h_3_2_pos : (1 : ℝ) < (R/R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R ++ have h_3_2_pos : (0 : ℝ) < (R/R1 : ℝ) := by linarith ++ have h_ratio_pos : (0 : ℝ) ≤ R / ‖ρ‖ := by ++ linarith [h_ratio_ge] ++ exact pow_le_pow_left₀ R_over_R1_nonneg h_ratio_ge (analyticOrderAt f ρ).toNat ++ ++ have h_3_2_prod_ge_1 : ∏ ρ ∈ h_finite_zeros.toFinset, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat ≥ 1 := ++ lem_mod_lower_bound_1 R R1 hR1_pos hR1_lt_R f h_f_analytic hf0_eq_one h_finite_zeros hR_lt_1 ++ ++ exact le_trans h_3_2_prod_ge_1 h_prod_ge ++ assumption ++ ++lemma lem_linear_factor_analytic (R : ℝ) (_hR_pos : 0 < R) (ρ : ℂ) (z : ℂ) : ++ AnalyticAt ℂ (fun w => (R : ℂ) - star ρ * w / (R : ℂ)) z := by ++ ++ have h_const : AnalyticAt ℂ (fun _ => (R : ℂ)) z := analyticAt_const ++ ++ have h_id : AnalyticAt ℂ (fun w => w) z := analyticAt_id ++ ++ have h_const_coeff : AnalyticAt ℂ (fun _ => star ρ / (R : ℂ)) z := analyticAt_const ++ ++ have h_mul : AnalyticAt ℂ (fun w => star ρ / (R : ℂ) * w) z := ++ AnalyticAt.fun_mul h_const_coeff h_id ++ ++ have h_sub : AnalyticAt ℂ (fun w => (R : ℂ) - star ρ / (R : ℂ) * w) z := ++ AnalyticAt.fun_sub h_const h_mul ++ ++ convert h_sub using 1 ++ ext w ++ ring ++ ++lemma lem_pow_analyticAt {g : ℂ → ℂ} (n : ℕ) (w : ℂ) : ++ AnalyticAt ℂ g w → AnalyticAt ℂ (fun z => (g z) ^ n) w := by ++ intro hg ++ exact AnalyticAt.fun_pow hg n ++ ++lemma lem_finset_prod_analyticAt {α : Type*} {S : Finset α} {g : α → ℂ → ℂ} (w : ℂ) : ++ (∀ a ∈ S, AnalyticAt ℂ (g a) w) → AnalyticAt ℂ (fun z => ∏ a ∈ S, g a z) w := by ++ intro h ++ classical ++ induction S using Finset.induction with ++ | empty => ++ ++ simp only [Finset.prod_empty] ++ exact analyticAt_const ++ | insert a s ha ih => ++ ++ simp only [Finset.prod_insert ha] ++ ++ apply AnalyticAt.fun_mul ++ · ++ apply h ++ exact Finset.mem_insert_self a s ++ · ++ apply ih ++ intro b hb ++ apply h ++ exact Finset.mem_insert_of_mem hb ++ ++lemma analyticOrderAt_top_iff_eventually_zero (f : ℂ → ℂ) (z : ℂ) (hf : AnalyticAt ℂ f z) : ++ analyticOrderAt f z = ⊤ ↔ ∀ᶠ w in nhds z, f w = 0 := by ++ simp [analyticOrderAt, hf] ++ ++lemma isPreconnected_closedBall (x : ℂ) (r : ℝ) : IsPreconnected (Metric.closedBall x r) := by ++ ++ have h_convex : Convex ℝ (Metric.closedBall x r) := convex_closedBall _ _ ++ ++ exact h_convex.isPreconnected ++ ++lemma Set.infinite_Icc_of_lt {a b : ℝ} (h : a < b) : (Set.Icc a b).Infinite := by ++ ++ intro h_finite ++ ++ have h_subset : Set.Ioo a b ⊆ Set.Icc a b := Set.Ioo_subset_Icc_self ++ ++ have h_Ioo_finite : (Set.Ioo a b).Finite := h_finite.subset h_subset ++ ++ have h_Ioo_infinite : (Set.Ioo a b).Infinite := Set.Ioo_infinite h ++ ++ exact h_Ioo_infinite h_Ioo_finite ++ ++lemma infinite_closedBall_of_pos (x : ℂ) (r : ℝ) (hr : 0 < r) : (Metric.closedBall x r).Infinite := by ++ ++ let f : ℝ → ℂ := fun t => x + t ++ ++ have h_maps_to : Set.MapsTo f (Set.Icc 0 (r/2)) (Metric.closedBall x r) := by ++ intro t ht ++ rw [Metric.mem_closedBall] ++ ++ have h_eq : f t = x + t := rfl ++ rw [h_eq, Complex.dist_eq, add_sub_cancel_left] ++ ++ have h_norm : ‖(t : ℂ)‖ = |t| := by ++ exact Complex.norm_real t ++ rw [h_norm, abs_of_nonneg ht.1] ++ exact le_trans ht.2 (le_of_lt (half_lt_self hr)) ++ ++ have h_inj : Set.InjOn f (Set.Icc 0 (r/2)) := by ++ intro s hs t ht h_eq ++ have : x + s = x + t := h_eq ++ have : (s : ℂ) = (t : ℂ) := add_left_cancel this ++ exact Complex.ofReal_inj.mp this ++ ++ have h_infinite_interval : (Set.Icc (0:ℝ) (r/2)).Infinite := ++ Set.infinite_Icc_of_lt (half_pos hr) ++ ++ have h_infinite_image : (f '' Set.Icc 0 (r/2)).Infinite := ++ Set.Infinite.image h_inj h_infinite_interval ++ ++ have h_subset : f '' Set.Icc 0 (r/2) ⊆ Metric.closedBall x r := ++ Set.MapsTo.image_subset h_maps_to ++ ++ intro h_finite ++ exact h_infinite_image (h_finite.subset h_subset) ++ ++lemma analyticOrderAt_ne_top_of_finite_zeros_in_ball (f : ℂ → ℂ) (R : ℝ) (hR_pos : 0 < R) ++ (hf_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) R, AnalyticAt ℂ f z) ++ (ρ : ℂ) (_hρ_zero : f ρ = 0) (hρ_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R) ++ (h_finite_zeros : {z ∈ Metric.closedBall (0 : ℂ) R | f z = 0}.Finite) : ++ analyticOrderAt f ρ ≠ ⊤ := by ++ ++ by_contra htop ++ ++ have h_eventually_zero : ∀ᶠ z in nhds ρ, f z = 0 := by ++ rw [← analyticOrderAt_top_iff_eventually_zero f ρ (hf_analytic ρ hρ_in_ball)] ++ exact htop ++ ++ have hf_on_ball : AnalyticOnNhd ℂ f (Metric.closedBall (0 : ℂ) R) := by ++ intro z ++ exact hf_analytic z ++ ++ have h_preconn : IsPreconnected (Metric.closedBall (0 : ℂ) R) := ++ isPreconnected_closedBall (0 : ℂ) R ++ ++ have h_eqOn_zero : Set.EqOn f 0 (Metric.closedBall (0 : ℂ) R) := ++ AnalyticOnNhd.eqOn_zero_of_preconnected_of_eventuallyEq_zero hf_on_ball h_preconn hρ_in_ball h_eventually_zero ++ ++ have h_all_zeros : ∀ z ∈ Metric.closedBall (0 : ℂ) R, f z = 0 := by ++ intro z hz ++ have := h_eqOn_zero hz ++ simpa [Pi.zero_apply] using this ++ ++ have h_zero_set_eq : {z ∈ Metric.closedBall (0 : ℂ) R | f z = 0} = Metric.closedBall (0 : ℂ) R := by ++ ext z ++ constructor ++ · intro hz; exact hz.1 ++ · intro hz; exact ⟨hz, h_all_zeros z hz⟩ ++ ++ have h_ball_infinite : (Metric.closedBall (0 : ℂ) R).Infinite := ++ infinite_closedBall_of_pos (0 : ℂ) R hR_pos ++ ++ rw [h_zero_set_eq] at h_finite_zeros ++ exact h_ball_infinite h_finite_zeros ++ ++theorem lem_Bf_is_analytic (R R1 : ℝ) (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := by ++ ++ intro z hz ++ ++ have h_blaschke_linear : ∀ ρ ∈ h_finite_zeros.toFinset, ++ AnalyticAt ℂ (fun w => (R : ℂ) - star ρ * w / (R : ℂ)) z := by ++ intro ρ hρ ++ ++ have h_eq : (fun w : ℂ => (R : ℂ) - star ρ * w / (R : ℂ)) = ++ (fun w : ℂ => (R : ℂ) + (-(star ρ) / (R : ℂ)) * w) := by ++ funext w ++ field_simp ++ ring ++ rw [h_eq] ++ exact analyticAt_const.add (analyticAt_const.mul analyticAt_id) ++ ++ have h_powers : ∀ ρ ∈ h_finite_zeros.toFinset, ++ AnalyticAt ℂ (fun w => ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ intro ρ hρ ++ exact (h_blaschke_linear ρ hρ).fun_pow _ ++ ++ have h_product : AnalyticAt ℂ (fun w => ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * w / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ ++ apply lem_finset_prod_analyticAt z ++ intro ρ hρ ++ apply h_powers ++ exact hρ ++ ++ by_cases hz_in : z ∈ zerosetKfR R1 (by linarith) f ++ · ++ have h_cf_at_sigma := @lem_Cf_analytic_at_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_in ++ ++ exact AnalyticAt.fun_mul h_cf_at_sigma h_product ++ ++ · ++ have hz_in_compl : z ∈ Metric.closedBall (0 : ℂ) R \ zerosetKfR R1 (by linarith) f := by ++ constructor ++ · exact hz ++ · exact hz_in ++ have h_cf_off := @lem_Cf_analytic_off_K R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_in_compl ++ exact AnalyticAt.fun_mul h_cf_off h_product ++ ++lemma complex_mul_star_eq_norm_sq (z : ℂ) : z * star z = (‖z‖ ^ 2 : ℂ) := by ++ ++ rw [Complex.star_def] ++ ++ exact Complex.mul_conj' z ++ ++lemma lem_mod_Bf_eq_mod_f_on_boundary (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ∀ z : ℂ, ‖z‖ = R → ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ = ‖f z‖ := by ++ intro z hz ++ ++ have hz_not_in : z ∉ zerosetKfR R1 (by linarith) f := by ++ intro h_in ++ ++ have h_norm_le_R1 : ‖z‖ ≤ R1 := by simpa [sub_zero] using (h_in.1 : z ∈ Metric.closedBall (0 : ℂ) R1) ++ ++ have h_norm_eq_R : ‖z‖ = R := by simpa using hz ++ linarith [h_norm_le_R1, h_norm_eq_R, hR1_lt_R] ++ rw [lem_mod_Bf_prod_mod R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz_not_in] ++ ++ have h_each_factor_one : ∀ ρ ∈ h_finite_zeros.toFinset, ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ = 1 := by ++ intro ρ hρ ++ ++ have z_ne_rho : z ≠ ρ := by ++ intro h_eq ++ have rho_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := (Set.Finite.mem_toFinset h_finite_zeros).mp hρ ++ have rho_bound : ‖ρ‖ ≤ R1 := by ++ have h_in_ball : ρ ∈ Metric.closedBall (0 : ℂ) R1 := rho_in_zeros.1 ++ rw [Metric.mem_closedBall, Complex.dist_eq] at h_in_ball ++ simpa using h_in_ball ++ have R1_lt_R : R1 < R := by linarith ++ rw [← h_eq, hz] at rho_bound ++ linarith [R1_lt_R] ++ ++ rw [Complex.norm_div] ++ ++ have z_conj_eq : z * star z = (R ^ 2 : ℂ) := by ++ rw [complex_mul_star_eq_norm_sq z, hz, pow_two] ++ ++ have num_rewrite : (R : ℂ) - z * star ρ / (R : ℂ) = ((R : ℂ)^2 - z * star ρ) / (R : ℂ) := by ++ have hRne : (R : ℂ) ≠ 0 := by exact_mod_cast (hR1_pos.trans hR1_lt_R).ne' ++ field_simp [hRne] ++ ++ rw [num_rewrite, Complex.norm_div] ++ ++ have factor_eq : (R : ℂ)^2 - z * star ρ = z * star (z - ρ) := by ++ rw [← z_conj_eq, star_sub] ++ ring ++ ++ rw [factor_eq, Complex.norm_mul, norm_star, ←hz] ++ have hRpos : 0 < R := hR1_pos.trans hR1_lt_R ++ have hnorm_denom : ‖z - ρ‖ ≠ 0 := norm_ne_zero_iff.mpr (sub_ne_zero.mpr z_ne_rho) ++ simp [hz, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hRpos, hnorm_denom, hRpos.ne'] ++ ++ have h_prod_one : ∏ ρ ∈ h_finite_zeros.toFinset, ‖(((R : ℂ) - z * star ρ / (R : ℂ)) / (z - ρ))‖ ^ (analyticOrderAt f ρ).toNat = 1 := by ++ ++ rw [← Finset.prod_congr rfl (fun ρ hρ => by rw [h_each_factor_one ρ hρ, one_pow])] ++ rw [Finset.prod_const_one] ++ ++ rw [h_prod_one, mul_one] ++ ++lemma lem_Bf_bounded_on_boundary (B R R1 : ℝ) (_hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : ++ ∀ z : ℂ, ‖z‖ = R → ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by ++ ++ intro z hz ++ have hz_le : ‖z‖ ≤ R := le_of_eq hz ++ have h_eq := ++ lem_mod_Bf_eq_mod_f_on_boundary R R1 (by linarith) hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec z hz ++ simpa [h_eq] using hf_le_B z hz_le ++ ++lemma norm_eq_radius_of_mem_sphere (w : ℂ) (R : ℝ) (hw : w ∈ Metric.sphere (0 : ℂ) R) : ‖w‖ = R := by ++ have hdist : dist w (0 : ℂ) = R := by simpa [Metric.sphere] using hw ++ simpa [Complex.dist_eq, sub_zero] using hdist ++ ++lemma mem_closedBall_of_norm_le {z : ℂ} {R : ℝ} (hz : ‖z‖ ≤ R) : z ∈ Metric.closedBall (0 : ℂ) R := by ++ have : dist z (0 : ℂ) ≤ R := by simpa [Complex.dist_eq, sub_zero] using hz ++ simpa [Metric.closedBall] using this ++ ++lemma closure_ball_eq_closedBall_center (R : ℝ) (hR : 0 < R) : ++ closure (Metric.ball (0 : ℂ) R) = Metric.closedBall (0 : ℂ) R := by ++ simpa using (closure_ball (x := (0 : ℂ)) (r := R) (ne_of_gt hR)) ++ ++lemma lem_max_mod_principle_for_Bf (B R : ℝ) (hB : 1 < B) (hR_pos : 0 < R) ++ (fB : ℂ → ℂ) ++ (h_analytic : AnalyticOnNhd ℂ fB (Metric.closedBall (0 : ℂ) R)) ++ (h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → ‖fB z‖ ≤ B) : ++ ∀ z : ℂ, ‖z‖ ≤ R → ‖fB z‖ ≤ B := by ++ intro z hz ++ ++ have hB0 : 0 ≤ B := le_of_lt (lt_trans zero_lt_one hB) ++ ++ have h_an_on_closure : AnalyticOn ℂ fB (closure (ballDR R)) := by ++ simpa [ballDR, closure_ball_eq_closedBall_center R hR_pos] using h_analytic.analyticOn ++ ++ have h_le := ++ lem_HardMMP R B hR_pos hB0 fB h_an_on_closure (by ++ intro z hzR; exact h_bd_boundary z hzR) ++ ++ have hz_cl : z ∈ closure (ballDR R) := by ++ have hz_closed : z ∈ Metric.closedBall (0 : ℂ) R := mem_closedBall_of_norm_le hz ++ simpa [ballDR, closure_ball_eq_closedBall_center R hR_pos] using hz_closed ++ exact h_le z hz_cl ++ ++lemma lem_Bf_bounded_in_disk_from_boundary (B R R1 : ℝ) ++ (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B) : ++ ∀ z : ℂ, ‖z‖ ≤ R → ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by ++ have hA := lem_Bf_is_analytic R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec ++ exact lem_max_mod_principle_for_Bf B R hB (by linarith) ++ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ) hA h_bd_boundary ++ ++lemma lem_Bf_bounded_in_disk_from_f (B R R1 : ℝ) ++ (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : ++ ∀ z : ℂ, ‖z‖ ≤ R → ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := by ++ intro z hz ++ have h_bd_boundary : ∀ z : ℂ, ‖z‖ = R → ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z‖ ≤ B := ++ lem_Bf_bounded_on_boundary B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec hf_le_B ++ exact (lem_Bf_bounded_in_disk_from_boundary B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec h_bd_boundary) z hz ++ ++lemma lem_Bf_at_0_le_M (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≤ B := by ++ have h := ++ lem_Bf_bounded_in_disk_from_f B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ h_σ_spec hf_le_B ++ have h0 : ‖(0 : ℂ)‖ ≤ R := by simpa using (le_of_lt (by linarith)) ++ simpa using h 0 h0 ++ ++lemma lem_combine_bounds_on_Bf0 (B R R1 : ℝ) (_hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hf0_eq_one : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (hBf0 : ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ≤ B) : ++ (R / R1 : ℝ) ^ (∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat : ℝ) ≤ B := by ++ classical ++ ++ set K := h_finite_zeros.toFinset ++ ++ have hf0_ne0 : f 0 ≠ 0 := by simp [hf0_eq_one] ++ have hf0_norm : ‖f 0‖ = 1 := by simp [hf0_eq_one] ++ have h_eval0 := ++ lem_mod_Bf_at_0_eval R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic hf0_ne0 h_finite_zeros h_σ h_σ_spec ++ have h_eval_prod : ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ ++ = ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by ++ rw [h_eval0, hf0_norm, one_mul] ++ ++ have h_base_ge : ∀ ρ ∈ K, R / ‖ρ‖ ≥ (R/R1 : ℝ) := by ++ intro ρ hρK ++ have hρ_in : ρ ∈ zerosetKfR R1 (by linarith) f := by simpa [K] using hρK ++ simpa using ++ (lem_R_div_mod_rho_ge_R_over_R1 R R1 hR1_pos hR1_lt_R f h_f_analytic hf0_ne0 ρ hρ_in) ++ ++ have R_over_R1_nonneg : 0 ≤ R/R1 := by ++ have : 0 ≤ R := by linarith ++ apply div_nonneg (by assumption) (le_of_lt hR1_pos) ++ have h_prod_le : ++ ∏ ρ ∈ K, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat ++ ≤ ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat := by ++ refine lem_prod_ineq K ++ (fun ρ => (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) ++ (fun ρ => (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat) ++ ?h_nonneg ?h_le ++ · intro ρ hρK; exact pow_nonneg (R_over_R1_nonneg) _ ++ · intro ρ hρK ++ exact pow_le_pow_left₀ (by linarith : (0 : ℝ) ≤ R / R1) (h_base_ge ρ hρK) _ ++ have h_prod_le_B : ++ ∏ ρ ∈ K, (R / R1: ℝ) ^ (analyticOrderAt f ρ).toNat ≤ B := by ++ have h_right : ∏ ρ ∈ K, (R / ‖ρ‖) ^ (analyticOrderAt f ρ).toNat = ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ 0‖ := by ++ simp [h_eval_prod] ++ exact le_trans h_prod_le (by simpa [h_right] using hBf0) ++ ++ have h_prod_pow_sum : ++ (∏ ρ ∈ K, (R/R1 : ℝ) ^ (analyticOrderAt f ρ).toNat) ++ = (R/R1 : ℝ) ^ (∑ ρ ∈ K, (analyticOrderAt f ρ).toNat) := by ++ simpa using ++ (Finset.prod_pow_eq_pow_sum K (fun ρ => (analyticOrderAt f ρ).toNat) (R/R1 : ℝ)) ++ ++ have h_natPow : (R / R1 : ℝ) ^ (∑ ρ ∈ K, (analyticOrderAt f ρ).toNat) ≤ B := by ++ simpa [h_prod_pow_sum] using h_prod_le_B ++ ++ set S : ℕ := ∑ ρ ∈ K, (analyticOrderAt f ρ).toNat ++ have h_natPowS : (R / R1 : ℝ) ^ S ≤ B := by simpa [S] using h_natPow ++ ++ have h_rpowS : (R / R1 : ℝ) ^ (S : ℝ) ≤ B := by ++ ++ simpa [(Real.rpow_natCast (R / R1 : ℝ) S)] using h_natPowS ++ ++ have h_cast_sum : (S : ℝ) ++ = (∑ ρ ∈ K, ((analyticOrderAt f ρ).toNat : ℝ)) := by ++ simp [S] ++ ++ have : (R / R1 : ℝ) ^ (∑ ρ ∈ K, ((analyticOrderAt f ρ).toNat : ℝ)) ≤ B := by ++ simpa [h_cast_sum] using h_rpowS ++ simpa [K] using this ++ ++lemma lem_jensen_inequality_form (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hf0_eq_one : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : ++ (R / R1 : ℝ) ^ (∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat : ℝ) ≤ B := by ++ ++ have hf0_ne0 : f 0 ≠ 0 := by ++ rw [hf0_eq_one]; norm_num ++ ++ have hBf0 := ++ lem_Bf_at_0_le_M B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic hf0_ne0 h_finite_zeros h_σ h_σ_spec hf_le_B ++ ++ let K := h_finite_zeros.toFinset ++ have hres := lem_combine_bounds_on_Bf0 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hBf0 ++ ++ simpa using hres ++ ++lemma lem_log_mono_inc {x y : ℝ} (hx : 0 < x) (hxy : x ≤ y) : Real.log x ≤ Real.log y := by ++ exact Real.log_le_log hx hxy ++ ++lemma lem_three_gt_e : (3 : ℝ) > Real.exp 1 := by ++ have h1 : Real.exp 1 < 2.7182818286 := Real.exp_one_lt_d9 ++ have h2 : (2.7182818286 : ℝ) < 3 := by norm_num ++ exact lt_trans h1 h2 ++ ++lemma lem_jensen_log_form (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hf0_eq_one : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) : ++ (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) * Real.log (R / R1) ≤ Real.log B := by ++ ++ set S : ℝ := ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) ++ ++ have hpow_le : (R / R1 : ℝ) ^ S ≤ B := by ++ simpa [S] using ++ (lem_jensen_inequality_form B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hf_le_B) ++ ++ have hbase_pos : 1 < (R / R1 : ℝ) := by exact (one_lt_div hR1_pos).mpr hR1_lt_R ++ have hbase_pos' : 0 < (R / R1 : ℝ) := by ++ have : 0 < R := by linarith ++ linarith ++ ++ have hxpos : 0 < (R / R1 : ℝ) ^ S := by ++ simpa [S] using Real.rpow_pos_of_pos hbase_pos' S ++ ++ have hlog_le : Real.log ((R / R1 : ℝ) ^ S) ≤ Real.log B := ++ lem_log_mono_inc hxpos hpow_le ++ ++ have hlog_rpow : Real.log ((R / R1 : ℝ) ^ S) = S * Real.log (R / R1) := by ++ simpa using (Real.log_rpow hbase_pos' S) ++ ++ simpa [S, hlog_rpow] using hlog_le ++ ++lemma lem_sum_ineq {ι : Type*} (K : Finset ι) (a b : ι → ℝ) ++ (h_le : ∀ i ∈ K, a i ≤ b i) : ++ Finset.sum K a ≤ Finset.sum K b := by ++ classical ++ exact Finset.sum_le_sum (by intro i hi; exact h_le i hi) ++ ++lemma ENat_coe_ge_one_iff_nat_ge_one (n : ℕ) : (n : ENat) ≥ 1 ↔ 1 ≤ n := by ++ ++ rw [ge_iff_le] ++ ++ exact ENat.natCast_le_natCast ++ ++lemma nat_one_le_cast_real (n : ℕ) : 1 ≤ n → (1 : ℝ) ≤ (n : ℝ) := by ++ intro h ++ rw [← Nat.cast_one] ++ exact Nat.cast_le.mpr h ++ ++lemma zerosetKfR_eq_zeros_in_ball (R : ℝ) (hR_pos : 0 < R) (f : ℂ → ℂ) : ++ zerosetKfR R hR_pos f = {z | z ∈ Metric.closedBall (0 : ℂ) R ∧ f z = 0} := by ++ rfl ++ ++lemma lem_frho_zero' (R R1 : ℝ) ++ (hR_pos : 0 < R1) ++ (_hR1 : R1 < R) ++ (f : ℂ → ℂ) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (ρ : ℂ) (h_rho_in_KfR1 : ρ ∈ zerosetKfR R1 (by linarith) f) : ++ f ρ = 0 := h_rho_in_KfR1.2 ++ ++lemma lem_sum_m_rho_1 (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (hR_lt_1 : R < 1) : ++ (h_finite_zeros.toFinset.card : ℝ) ≤ ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) := by ++ ++ have h_card_as_sum : (h_finite_zeros.toFinset.card : ℝ) = ∑ ρ ∈ h_finite_zeros.toFinset, (1 : ℝ) := by ++ simp [Finset.sum_const] ++ rw [h_card_as_sum] ++ ++ apply lem_sum_ineq h_finite_zeros.toFinset (fun _ => (1 : ℝ)) (fun ρ => ((analyticOrderAt f ρ).toNat : ℝ)) ++ ++ intro ρ hρ ++ ++ have hρ_in_zeros : ρ ∈ zerosetKfR R1 (by linarith) f := ++ (Set.Finite.mem_toFinset h_finite_zeros).mp hρ ++ have h_f_rho_zero : f ρ = 0 := ++ lem_frho_zero' R R1 (by linarith) hR1_lt_R f h_f_analytic ρ hρ_in_zeros ++ ++ have h_f_analytic_at_rho : AnalyticAt ℂ f ρ := by ++ apply h_f_analytic ++ have h_R1_lt_1 : R1 < 1 := by linarith [hR_lt_1] ++ exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) hρ_in_zeros.1 ++ ++ have h_order_finite : analyticOrderAt f ρ ≠ ⊤ := by ++ have h_R1_pos : 0 < R1 := by linarith [hR1_pos] ++ apply analyticOrderAt_ne_top_of_finite_zeros_in_ball f R1 h_R1_pos ++ · intro z hz ++ apply h_f_analytic ++ have h_R1_lt_1 : R1 < 1 := by linarith [hR_lt_1] ++ exact Metric.closedBall_subset_closedBall (le_of_lt h_R1_lt_1) hz ++ · exact h_f_rho_zero ++ · exact hρ_in_zeros.1 ++ · exact h_finite_zeros ++ ++ have h_order_ge_one : analyticOrderAt f ρ ≥ 1 := ++ analyticOrderAt_ge_one_of_zero f ρ h_f_analytic_at_rho h_f_rho_zero h_order_finite ++ ++ have h_toNat_ge_one : 1 ≤ (analyticOrderAt f ρ).toNat := by ++ cases' h_cases : analyticOrderAt f ρ with n ++ · rw [h_cases] at h_order_finite; contradiction ++ · rw [h_cases] at h_order_ge_one ++ rw [ENat.toNat_natCast] ++ exact (ENat_coe_ge_one_iff_nat_ge_one n).mp h_order_ge_one ++ ++ exact nat_one_le_cast_real _ h_toNat_ge_one ++ ++lemma lem_sum_1_is_card {ι : Type*} (K : Finset ι) : Finset.sum K (fun _ => (1 : ℝ)) = (K.card : ℝ) := by ++ ++ rw [Finset.sum_const, nsmul_eq_mul] ++ simp only [mul_one] ++ ++lemma lem_sum_m_rho_bound (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hf0_eq_one : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) ≤ (1/Real.log (R/R1)) * Real.log B := by ++ have h_div_log : (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) * Real.log (R/R1) ≤ Real.log B := by ++ apply lem_jensen_log_form B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ h_σ_spec hf_le_B ++ have log_pos' : R/R1 > 1 := by exact (one_lt_div hR1_pos).mpr hR1_lt_R ++ have log_pos : Real.log (R/R1) > 0 := by exact Real.log_pos log_pos' ++ calc ++ ∑ ρ ∈ h_finite_zeros.toFinset, ↑(analyticOrderAt f ρ).toNat ++ _ = 1 / Real.log (R / R1) * (Real.log (R / R1) * (∑ ρ ∈ h_finite_zeros.toFinset, ↑(analyticOrderAt f ρ).toNat)) := by ++ field_simp [ne_of_gt log_pos] ++ _ ≤ 1 / Real.log (R / R1) * Real.log B := by ++ gcongr ++ rw [mul_comm] ++ exact h_div_log ++ ++lemma lem_sum_1_bound (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hf0_eq_one : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ (h_finite_zeros.toFinset.card : ℝ) ≤ (1/Real.log (R/R1)) * Real.log B := by ++ have h1 := ++ lem_sum_m_rho_1 R R1 hR1_pos hR1_lt_R f h_f_analytic h_finite_zeros hR_lt_1 ++ have h2 := ++ lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ hf_le_B h_σ_spec ++ exact le_trans h1 h2 ++ ++lemma lem_num_zeros_bound (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (hf0_eq_one : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (hf_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ let S_zeros := zerosetKfR R1 (by linarith) f ++ have inst_fintype_S_zeros : Fintype ↑S_zeros := h_finite_zeros.fintype ++ (S_zeros.toFinset.card : ℝ) ≤ (1 / Real.log (R / R1)) * Real.log B := by ++ intro S_zeros _inst ++ dsimp [S_zeros] ++ simpa using ++ (lem_sum_1_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero hf0_eq_one h_finite_zeros h_σ hf_le_B h_σ_spec) ++ ++variable {R R1 r B : ℝ} {f : ℂ → ℂ} {h_σ : ℂ → (ℂ → ℂ)} ++variable (hr_pos : 0 < r) (hr_lt_R1 : r < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++variable (hR1_pos : 0 < R1) ++variable (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++variable (h_f_zero : f 0 = 1) ++variable (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++variable (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ ++lemma f_zero_ne_zero (h_f_zero : f 0 = 1) : f 0 ≠ 0 := by ++ rw [h_f_zero]; simp ++ ++lemma Bf_is_analytic_on_disk ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := ++ let hspec := h_σ_spec ++ lem_Bf_is_analytic R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) ++ h_finite_zeros h_σ hspec ++ ++lemma lem_Bf_eq_prod_Cf ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ∀ z, Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z = ++ (∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) * ++ (Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero_at_zero h_finite_zeros h_σ z) := by ++ intro z ++ rw [Bf] ++ ring ++ ++lemma lem_num_prod_never_zero_all ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (_hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (_h_f_nonzero_at_zero : f 0 ≠ 0) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1, ++ (∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R : ℂ) - star ρ * z / (R : ℂ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 := by ++ intro z hz ++ apply Finset.prod_ne_zero_iff.mpr ++ intro ρ hρ ++ apply pow_ne_zero ++ ++ have hρ_mem : ρ ∈ zerosetKfR R1 (by linarith) f := by ++ rwa [Set.Finite.mem_toFinset h_finite_zeros] at hρ ++ have hρ_bound : ‖ρ‖ ≤ R1 := by ++ rw [zerosetKfR] at hρ_mem; simp at hρ_mem; exact hρ_mem.1 ++ have hz_bound : ‖z‖ ≤ R1 := by ++ rw [Metric.mem_closedBall, dist_zero_right] at hz; exact hz ++ ++ have hR_pos : (0 : ℝ) < R := lt_trans hR1_pos hR1_lt_R ++ ++ have key_positive : (0 : ℝ) < R - R1 * R1 / R := by ++ ++ have h1 : R1 * R1 < R * R := by ++ apply mul_self_lt_mul_self (le_of_lt hR1_pos) hR1_lt_R ++ have h2 : R1 * R1 / R < R := by ++ rw [div_lt_iff₀ hR_pos] ++ exact h1 ++ linarith [h2] ++ ++ suffices h : (0 : ℝ) < ‖(R : ℂ) - star ρ * z / (R : ℂ)‖ by ++ exact norm_pos_iff.mp h ++ ++ have triangle_ineq : ‖(R : ℂ) - star ρ * z / (R : ℂ)‖ ≥ ‖(R : ℂ)‖ - ‖star ρ * z / (R : ℂ)‖ := ++ norm_sub_norm_le _ _ ++ ++ have R_norm_eq : ‖(R : ℂ)‖ = R := by ++ rw [Complex.norm_of_nonneg (le_of_lt hR_pos)] ++ ++ have product_bound : ‖star ρ * z / (R : ℂ)‖ ≤ R1 * R1 / R := by ++ rw [norm_div, norm_mul, norm_star, R_norm_eq] ++ ++ have mult_bound : ‖ρ‖ * ‖z‖ ≤ R1 * R1 := by ++ exact mul_le_mul hρ_bound hz_bound (norm_nonneg _) (le_of_lt hR1_pos) ++ ++ have : ‖ρ‖ * ‖z‖ / R ≤ R1 * R1 / R := by ++ exact div_le_div_of_nonneg_right mult_bound (le_of_lt hR_pos) ++ exact this ++ ++ rw [R_norm_eq] at triangle_ineq ++ linarith [triangle_ineq, product_bound, key_positive] ++ ++lemma Bf_never_zero ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1, Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z ≠ 0 := by ++ intro z hz ++ ++ rw [lem_Bf_eq_prod_Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec] ++ ++ apply mul_ne_zero ++ · ++ exact lem_num_prod_never_zero_all R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec z hz ++ · ++ exact lem_Cf_never_zero h_finite_zeros h_σ h_σ_spec z hz ++ ++lemma Bf0_not_zero ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 := by ++ apply Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ simp [Metric.mem_closedBall, le_of_lt hR1_pos] ++ ++noncomputable def Lf : ℂ → ℂ := ++ let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ ++ Classical.choose (log_of_analytic ++ (r1 := r) (R' := R1) (R := R) ++ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 ++ (B := B_f) ++ (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) ++ (hB_ne_zero := by ++ intro z hz ++ have h_num_ne_zero : B_f z ≠ 0 := ++ Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz ++ assumption ++ ) ++) ++ ++lemma Lf_is_analytic ++ (r R R1 : ℝ) ++ (hr_pos : 0 < r) ++ (hr_lt_R1 : r < R1) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ AnalyticOnNhd ℂ (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) ++ (Metric.closedBall (0 : ℂ) r) := by ++ unfold Lf ++ exact (Classical.choose_spec (log_of_analytic ++ (r1 := r) (R' := R1) (R := R) ++ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 ++ (B := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) ++ (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) ++ (hB_ne_zero := by ++ intro z hz ++ exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz ++ ) ++ )).1 ++ ++lemma Lf_at_0_is_0 ++ (r R R1 : ℝ) ++ (hr_pos : 0 < r) ++ (hr_lt_R1 : r < R1) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec 0 = 0 := by ++ unfold Lf ++ let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ ++ let log_exists := log_of_analytic ++ (r1 := r) (R' := R1) (R := R) ++ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 ++ (B := B_f) ++ (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) ++ (hB_ne_zero := by ++ intro z hz ++ have h_num_ne_zero : B_f z ≠ 0 := ++ Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz ++ assumption ++ ) ++ exact (Classical.choose_spec log_exists).2.1 ++ ++lemma lem_BCII {L : ℂ → ℂ} {r M r₁ : ℝ} ++ (hr_pos : 0 < r) ++ (hM_pos : 0 < M) ++ (hr₁_pos : 0 < r₁) ++ (hr₁_lt_r : r₁ < r) ++ (hL_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 r ⊆ U ∧ DifferentiableOn ℂ L U) ++ (hL0 : L 0 = 0) ++ (hre_L_le_M : ∀ w ∈ Metric.closedBall 0 r, (L w).re ≤ M) ++ {z : ℂ} (hz : z ∈ Metric.closedBall 0 r₁) : ++norm (deriv L z) ≤ (16 * M * r ^ 2) / ((r - r₁) ^ 3) := by ++ apply borel_caratheodory_II hr_pos hM_pos hr₁_pos hr₁_lt_r hL_domain hL0 hre_L_le_M hz ++ ++lemma re_Lf_as_diff_of_log_mods ++ (r R R1 : ℝ) ++ (hr_pos : 0 < r) ++ (hr_lt_R1 : r < R1) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r, ++ Complex.re (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z) = ++ Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) - ++ Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)) := by ++ intro z hz ++ ++ let B_f := Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ ++ have h_Bf_analytic : AnalyticOnNhd ℂ B_f (Metric.closedBall (0 : ℂ) R) := ++ Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ have h_Bf_ne_zero : ∀ w ∈ Metric.closedBall (0 : ℂ) R1, B_f w ≠ 0 := by ++ intro w hw ++ exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec w hw ++ ++ have h_log_exists := log_of_analytic hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 h_Bf_analytic h_Bf_ne_zero ++ have h_choose_spec := Classical.choose_spec h_log_exists ++ ++ have h_Lf_def : Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec = Classical.choose h_log_exists := by ++ unfold Lf ++ simp only [B_f] ++ ++ rw [h_Lf_def] ++ exact (h_choose_spec.2.2.2 z hz).symm ++ ++lemma log_Bf_le_log_B ++ (B R R1 : ℝ) ++ (_hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (h_Bf_pos : ∀ z, norm z ≤ R1 → ++ 0 < norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) ++ (h_Bf_bound : ∀ z, norm z ≤ R1 → ++ norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z) ≤ B) : ++ ∀ z, norm z ≤ R1 → ++ Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) ≤ Real.log B := by ++ intro z hz ++ apply Real.log_le_log ++ · exact h_Bf_pos z hz ++ · exact h_Bf_bound z hz ++ ++lemma log_Bf_le_log_B2 ++ (B R R1 : ℝ) ++ (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (h_Bf_bound : ∀ z, ‖z‖ ≤ R → ++ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z‖ ≤ B) : ++ ∀ z, ‖z‖ ≤ R1 → ++ Real.log (‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z‖) ≤ Real.log B := by ++ ++ apply log_Bf_le_log_B B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ · ++ intro z hz ++ have hz_mem : z ∈ Metric.closedBall (0 : ℂ) R1 := by ++ rw [Metric.mem_closedBall, dist_zero_right] ++ exact hz ++ have hBf_ne_zero := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz_mem ++ exact norm_pos_iff.mpr hBf_ne_zero ++ · ++ intro z hz ++ have hz_le_R : ‖z‖ ≤ R := by linarith [hz, hR1_lt_R] ++ exact h_Bf_bound z hz_le_R ++ ++lemma log_Bf_le_log_B3 ++ (B R R1 : ℝ) ++ (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : ++ ∀ z, norm z ≤ R1 → ++ Real.log (norm (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z)) ≤ Real.log B := by ++ ++ apply log_Bf_le_log_B2 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ ++ apply lem_Bf_bounded_in_disk_from_f B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ h_σ_spec ++ ++ exact h_f_bound ++ ++lemma log_Bf0_ge_0 ++ (R R1 : ℝ) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ 0 ≤ Real.log (‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0‖) := by ++ ++ have h_pos : 0 < (1 : ℝ) := by norm_num ++ have h_Bf_ge_1 : 1 ≤ ‖Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0‖ := ++ lem_mod_Bf_at_0_ge_1 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_f_zero h_finite_zeros h_σ h_σ_spec ++ have h_log_mono := lem_log_mono_inc h_pos h_Bf_ge_1 ++ rw [Real.log_one] at h_log_mono ++ exact h_log_mono ++ ++lemma re_Lf_le_log_B ++ (B r R R1 : ℝ) ++ (hB : 1 < B) ++ (hr_pos : 0 < r) ++ (hr_lt_R1 : r < R1) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : ++ ∀ z, norm z ≤ r → ++ Complex.re (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z) ≤ Real.log B := by ++ intro z hz ++ ++ rw [re_Lf_as_diff_of_log_mods r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z] ++ · ++ ++ have hz_apply_BC_to_Lfle_R1 : ‖z‖ ≤ R1 := by linarith [hz, hr_lt_R1] ++ have h1 := log_Bf_le_log_B3 B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec h_f_bound z hz_apply_BC_to_Lfle_R1 ++ have h2 := log_Bf0_ge_0 R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ linarith ++ · ++ exact Metric.mem_closedBall.mpr (by simpa [dist_zero_right] using hz) ++ ++lemma analyticOnNhd_closedBall_exists_open_differentiableOn {L : ℂ → ℂ} {r : ℝ} ++ (h : AnalyticOnNhd ℂ L (Metric.closedBall (0 : ℂ) r)) : ++ ∃ U, IsOpen U ∧ Metric.closedBall (0 : ℂ) r ⊆ U ∧ DifferentiableOn ℂ L U := by ++ classical ++ ++ let I := {x : ℂ // x ∈ Metric.closedBall (0 : ℂ) r} ++ ++ have hI : ∀ i : I, ∃ (W : Set ℂ), IsOpen W ∧ (i : ℂ) ∈ W ∧ AnalyticOn ℂ L W := by ++ intro i ++ have hAt : AnalyticAt ℂ L (i : ℂ) := h i i.property ++ ++ have hWithin : AnalyticWithinAt ℂ L (Set.univ) (i : ℂ) := by ++ simpa using (hAt.analyticWithinAt : AnalyticWithinAt ℂ L Set.univ (i : ℂ)) ++ rcases (AnalyticWithinAt.exists_mem_nhdsWithin_analyticOn hWithin) with ⟨U₀, hU₀nhds, hU₀analytic⟩ ++ have hU₀nhds' : U₀ ∈ nhds (i : ℂ) := by simpa [nhdsWithin_univ] using hU₀nhds ++ rcases _root_.mem_nhds_iff.mp hU₀nhds' with ⟨W, hWsub, hWopen, hiW⟩ ++ refine ⟨W, hWopen, hiW, hU₀analytic.mono ?_⟩ ++ exact hWsub ++ choose V hVopen hiV hVanalytic using hI ++ ++ let U : Set ℂ := ⋃ i : I, V i ++ have hUopen : IsOpen U := by ++ simpa [U] using isOpen_iUnion (fun i => hVopen i) ++ ++ have hsub : Metric.closedBall (0 : ℂ) r ⊆ U := by ++ intro x hx ++ refine Set.mem_iUnion.mpr ?_ ++ refine ⟨⟨x, hx⟩, ?_⟩ ++ simpa using hiV ⟨x, hx⟩ ++ ++ have hdiffOn : DifferentiableOn ℂ L U := by ++ intro y hy ++ rcases Set.mem_iUnion.mp hy with ⟨i, hyi⟩ ++ have hdi : DifferentiableOn ℂ L (V i) := (hVanalytic i).differentiableOn ++ have hdiAt : DifferentiableAt ℂ L y := hdi.differentiableAt ((hVopen i).mem_nhds hyi) ++ exact hdiAt.differentiableWithinAt ++ exact ⟨U, hUopen, hsub, hdiffOn⟩ ++ ++lemma log_pos_of_one_lt {B : ℝ} (hB : 1 < B) : 0 < Real.log B := by ++ simpa using Real.log_pos hB ++ ++lemma apply_BC_to_Lf ++ (B r1 r R R1 : ℝ) ++ (hB : 1 < B) ++ (hr1_pos : 0 < r1) ++ (hr1_lt_r : r1 < r) ++ (hr_lt_R1 : r < R1) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (h_f_bound : ∀ z, norm z ≤ R → norm (f z) ≤ B) : ++ ∀ z, norm z ≤ r1 → ++ norm (deriv (Lf (lt_trans hr1_pos hr1_lt_r : 0 < r) hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z) ≤ ++ (16 * Real.log B * r^2) / (r - r1)^3 := by ++ classical ++ intro z hz ++ ++ have hr_pos : 0 < r := lt_trans hr1_pos hr1_lt_r ++ ++ let L := Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec ++ ++ have h_analytic_nhd := ++ Lf_is_analytic r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ ++ let U : Set ℂ := ++ { y | ∃ x ∈ Metric.closedBall (0 : ℂ) r, ∃ s : ℝ, 0 < s ∧ y ∈ Metric.ball x s ∧ ++ AnalyticOnNhd ℂ L (Metric.ball x s) } ++ have hU_open : IsOpen U := by ++ refine isOpen_iff_mem_nhds.mpr ?_ ++ intro y hy ++ rcases hy with ⟨x, hxCB, s, hs_pos, hyin, hAnaBall⟩ ++ have hnhds : Metric.ball x s ∈ nhds y := (Metric.isOpen_ball.mem_nhds hyin) ++ exact Filter.mem_of_superset hnhds (by intro z hz; exact ⟨x, hxCB, s, hs_pos, hz, hAnaBall⟩) ++ have hCB_subset : Metric.closedBall (0 : ℂ) r ⊆ U := by ++ intro x hx ++ have hAt : AnalyticAt ℂ L x := h_analytic_nhd x hx ++ rcases AnalyticAt.exists_ball_analyticOnNhd hAt with ⟨s, hs_pos, hAnaBall⟩ ++ have hx_in_ball : x ∈ Metric.ball x s := by ++ simpa [Metric.mem_ball, dist_self] using hs_pos ++ exact ⟨x, hx, s, hs_pos, hx_in_ball, hAnaBall⟩ ++ have hDiffU : DifferentiableOn ℂ L U := by ++ intro y hy ++ rcases hy with ⟨x, hxCB, s, hs_pos, hy_in, hAnaBall⟩ ++ ++ have hAt : AnalyticAt ℂ L y := hAnaBall y hy_in ++ exact (AnalyticAt.differentiableAt hAt).differentiableWithinAt ++ ++ have hL_domain : ∃ U, IsOpen U ∧ Metric.closedBall 0 r ⊆ U ∧ DifferentiableOn ℂ L U := ++ ⟨U, hU_open, hCB_subset, hDiffU⟩ ++ ++ have hL0 : L 0 = 0 := by ++ simpa [L] using (Lf_at_0_is_0 r R R1 hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) ++ ++ have hre_L_le_M : ∀ w ∈ Metric.closedBall 0 r, (L w).re ≤ Real.log B := by ++ intro w hw ++ have hw' : norm w ≤ r := by ++ simpa [Metric.mem_closedBall, dist_zero_right] using hw ++ exact re_Lf_le_log_B B r R R1 hB hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec h_f_bound w hw' ++ ++ have hz' : z ∈ Metric.closedBall 0 r1 := by ++ simpa [Metric.mem_closedBall, dist_zero_right] using hz ++ ++ have hBC := ++ lem_BCII hr_pos (Real.log_pos hB) hr1_pos hr1_lt_r hL_domain hL0 hre_L_le_M hz' ++ ++ simpa [L] using hBC ++ ++lemma analyticOnNhd_Bf_closedBall (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): ++ AnalyticOnNhd ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) (Metric.closedBall (0 : ℂ) R) := ++ Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ ++lemma helper_Bf_analytic_on_disk (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R, AnalyticAt ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z := by ++ intro z hz ++ have h_analytic_on := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ exact h_analytic_on z hz ++ ++lemma closedBall_R1_subset_R (_hR1_nonneg : 0 ≤ R1) (hR1_lt_R : R1 < R) : Metric.closedBall (0 : ℂ) R1 ⊆ Metric.closedBall (0 : ℂ) R := by ++ exact (Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_R)) ++ ++lemma logDerivconst {a : ℂ} {g : ℂ → ℂ} (ha : a ≠ 0) : ++ ∀ z, logDeriv (fun w ↦ a * g w) z = logDeriv g z := by ++ intro z ++ exact logDeriv_const_mul z a ha ++ ++lemma oneBneq0 (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z): ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 ∧ ++ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ ≠ 0 := by ++ have h0mem : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R1 := by ++ simpa [Metric.mem_closedBall, dist_zero_right] using le_of_lt hR1_pos ++ have hB0ne : ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0 ≠ 0 := by ++ have h := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ ++ exact h 0 h0mem ++ refine And.intro hB0ne ?_ ++ exact inv_ne_zero hB0ne ++ ++lemma Lf_deriv_is_logBf_deriv (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ logDeriv (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w / ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0) z = ++ logDeriv (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) z := by ++ intro z _ ++ ++ have h_eq : (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w / ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0) = ++ (fun w ↦ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ * ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) := by ++ ext w ++ rw [div_eq_mul_inv] ++ ring ++ rw [h_eq] ++ ++ have h0_in_ball : (0 : ℂ) ∈ Metric.closedBall (0 : ℂ) R1 := by ++ simp [Metric.mem_closedBall] ++ exact le_of_lt hR1_pos ++ have h_Bf0_ne_zero := Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec 0 h0_in_ball ++ ++ have h_inv_ne_zero : (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ 0)⁻¹ ≠ 0 := ++ inv_ne_zero h_Bf0_ne_zero ++ ++ exact logDerivconst h_inv_ne_zero z ++ ++lemma logDeriv_div_const {a : ℂ} {g : ℂ → ℂ} (ha : a ≠ 0) : ∀ z, logDeriv (fun w ↦ g w / a) z = logDeriv g z := by ++ intro z ++ have hfun : (fun w ↦ g w / a) = (fun w ↦ a⁻¹ * g w) := by ++ funext w ++ simp [div_eq_mul_inv, mul_comm] ++ simpa [hfun] using (logDerivconst (a := a⁻¹) (g := g) (inv_ne_zero ha) z) ++ ++lemma deriv_over_fun_is_logDeriv {g : ℂ → ℂ} : ∀ z, deriv g z / g z = logDeriv g z := by ++ intro z ++ rfl ++ ++lemma logDerivmul {f g : ℂ → ℂ} {z : ℂ} ++ (hf : DifferentiableAt ℂ f z) (hg : DifferentiableAt ℂ g z) ++ (hf_ne : f z ≠ 0) (hg_ne : g z ≠ 0) : ++ logDeriv (fun w ↦ f w * g w) z = logDeriv f z + logDeriv g z := by ++ exact logDeriv_mul z hf_ne hg_ne hf hg ++ ++lemma logDerivprod {K : Finset ℂ} {g : ℂ → ℂ → ℂ} {z : ℂ} ++ (hg_diff : ∀ ρ ∈ K, DifferentiableAt ℂ (g ρ) z) ++ (hg_ne : ∀ ρ ∈ K, g ρ z ≠ 0) : ++ logDeriv (fun w ↦ ∏ ρ ∈ K, g ρ w) z = ∑ ρ ∈ K, logDeriv (g ρ) z := by ++ simpa only [Finset.prod_fn] using logDeriv_prod hg_ne hg_diff ++ ++lemma logDerivdiv {h g : ℂ → ℂ} {z : ℂ} ++ (hh : DifferentiableAt ℂ h z) (hg : DifferentiableAt ℂ g z) ++ (hh_ne : h z ≠ 0) (hg_ne : g z ≠ 0) : ++ logDeriv (fun w ↦ h w / g w) z = logDeriv h z - logDeriv g z := by ++ exact logDeriv_div z hh_ne hg_ne hh hg ++ ++lemma logDerivfunpow {g : ℂ → ℂ} {z : ℂ} {m : ℕ} ++ (hg : DifferentiableAt ℂ g z) : ++ logDeriv (fun w ↦ (g w) ^ m) z = m * logDeriv g z := by ++ exact logDeriv_fun_pow hg m ++ ++lemma z_minus_rho_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (_h_f_zero : f 0 = 1) ++ (_h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ z - ρ ≠ 0 ∧ DifferentiableAt ℂ (fun w ↦ w - ρ) z := by ++ intro ρ hρ z hz ++ have hz_pair := (Set.mem_sdiff z).1 hz ++ have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R1 := hz_pair.1 ++ have hz_notK : z ∉ zerosetKfR R1 (by linarith) f := hz_pair.2 ++ ++ have hz_ne_rho : z ≠ ρ := by ++ intro h_eq ++ exact hz_notK (by simpa [h_eq] using hρ) ++ have h_nonzero : z - ρ ≠ 0 := sub_ne_zero.mpr hz_ne_rho ++ ++ have hdiff : DifferentiableAt ℂ (fun w => w) z := differentiableAt_fun_id ++ have hdiff_sub : DifferentiableAt ℂ (fun w => w - ρ) z := hdiff.sub_const ρ ++ exact ⟨h_nonzero, hdiff_sub⟩ ++ ++lemma blaschke_num_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (_h_f_zero : f 0 = 1) ++ (_h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R, ++ R - (star ρ) * z / R ≠ 0 ∧ DifferentiableAt ℂ (fun w ↦ R - (star ρ) * w / R) z := by ++ intro ρ hρ z hz ++ constructor ++ · intro hzero ++ have hRne : (R : ℂ) ≠ 0 := by ++ simpa using (Complex.ofReal_ne_zero.mpr (ne_of_gt (hR1_pos.trans hR1_lt_R))) ++ ++ have heq : (R : ℂ) = (star ρ) * z / (R : ℂ) := sub_eq_zero.mp hzero ++ have hmul := congrArg (fun t : ℂ => t * (R : ℂ)) heq ++ have heq_mul : (R : ℂ) * (R : ℂ) = (star ρ) * z := by ++ ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hRne] using hmul ++ ++ have hnorm_eq : ‖(R : ℂ)‖ * ‖(R : ℂ)‖ = ‖ρ‖ * ‖z‖ := by ++ simpa [Complex.norm_mul, Complex.norm_conj] using congrArg (fun t : ℂ => ‖t‖) heq_mul ++ ++ have hz_norm_le : ‖z‖ ≤ R := by ++ have hz' : dist z (0 : ℂ) ≤ R := (Metric.mem_closedBall.mp hz) ++ simpa [dist_eq_norm] using hz' ++ have hrho_norm_le : ‖ρ‖ ≤ R1 := by ++ rcases hρ with ⟨hρ_ball, _hρ_zero⟩ ++ have : dist ρ (0 : ℂ) ≤ R1 := (Metric.mem_closedBall.mp hρ_ball) ++ simpa [dist_eq_norm] using this ++ have hz_nonneg : 0 ≤ ‖z‖ := by simp ++ have hR1_nonneg : 0 ≤ R1 := le_of_lt hR1_pos ++ have hle : ‖ρ‖ * ‖z‖ ≤ R1 * R := by ++ have h1 : ‖ρ‖ * ‖z‖ ≤ R1 * ‖z‖ := mul_le_mul_of_nonneg_right hrho_norm_le hz_nonneg ++ have h2 : R1 * ‖z‖ ≤ R1 * R := mul_le_mul_of_nonneg_left hz_norm_le hR1_nonneg ++ exact le_trans h1 h2 ++ ++ have hnorm_R : ‖(R : ℂ)‖ = R := by ++ have h1 : ‖(R : ℂ)‖ = |R| := by simp ++ simp [abs_of_pos (hR1_pos.trans hR1_lt_R)] ++ ++ have : R * R = ‖ρ‖ * ‖z‖ := by simpa [hnorm_R] using hnorm_eq ++ have hle' : R * R ≤ R1 * R := by simpa [this] using hle ++ ++ have hposR : 0 < R := hR1_pos.trans hR1_lt_R ++ have hposRR : 0 < R * R := by nlinarith [hposR] ++ have hlt : R1 * R < R * R := by ++ exact mul_lt_mul_of_pos_right hR1_lt_R hposR ++ exact (lt_irrefl _ (lt_of_le_of_lt hle' hlt)) ++ · ++ have h_const : DifferentiableAt ℂ (fun _ : ℂ => (R : ℂ)) z := by ++ simp ++ have h_id : DifferentiableAt ℂ (fun w : ℂ => w) z := by ++ simp ++ have h_mul : DifferentiableAt ℂ (fun w : ℂ => (star ρ) * w) z := by ++ simpa using h_id.const_mul (star ρ) ++ have h_div : DifferentiableAt ℂ (fun w : ℂ => (star ρ) * w / (R : ℂ)) z := by ++ simpa [div_eq_mul_inv] using h_mul.mul_const ((R : ℂ)⁻¹) ++ simpa using h_const.sub h_div ++ ++lemma blaschke_frac_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ (R - (star ρ) * z / R) / (z - ρ) ≠ 0 ∧ ++ DifferentiableAt ℂ (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by ++ intro ρ hρ z hz ++ ++ have hden := z_minus_rho_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ z hz ++ have hden_ne : z - ρ ≠ 0 := hden.1 ++ have hden_diff : DifferentiableAt ℂ (fun w ↦ w - ρ) z := hden.2 ++ ++ have hz_in_small : z ∈ Metric.closedBall (0 : ℂ) R1 ∧ ++ z ∉ zerosetKfR R1 (by linarith) f := by ++ simpa [Set.mem_sdiff] using hz ++ have hz_small : z ∈ Metric.closedBall (0 : ℂ) R1 := hz_in_small.1 ++ ++ have hz_dist_le_small : dist z (0 : ℂ) ≤ R1 := by ++ simpa [Metric.mem_closedBall] using hz_small ++ have hRle : R ≤ 1 := le_of_lt hR_lt_1 ++ have hR1_le_R : R1 ≤ R := le_of_lt hR1_lt_R ++ have hR1_le_1 : R1 ≤ 1 := le_trans hR1_le_R hRle ++ have hz_ball1 : z ∈ Metric.closedBall (0 : ℂ) 1 := by ++ have hz_le1 : dist z (0 : ℂ) ≤ 1 := le_trans hz_dist_le_small hR1_le_1 ++ simpa [Metric.mem_closedBall] using hz_le1 ++ ++ have hz_ballR : z ∈ Metric.closedBall (0 : ℂ) R := by ++ have hz_le_R : dist z (0 : ℂ) ≤ R := le_trans hz_dist_le_small (le_of_lt hR1_lt_R) ++ simpa [Metric.mem_closedBall] using hz_le_R ++ have hnum := blaschke_num_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ z hz_ballR ++ have hnum_ne : R - (star ρ) * z / R ≠ 0 := hnum.1 ++ have hnum_diff : DifferentiableAt ℂ (fun w ↦ R - (star ρ) * w / R) z := hnum.2 ++ ++ refine And.intro ?_ ?_ ++ · intro h ++ have h' : (R - (star ρ) * z / R) * (z - ρ)⁻¹ = 0 := by ++ simpa [div_eq_mul_inv] using h ++ rcases mul_eq_zero.mp h' with hnum0 | hinv0 ++ · exact hnum_ne hnum0 ++ · exact hden_ne (inv_eq_zero.mp hinv0) ++ · exact hnum_diff.div hden_diff hden_ne ++ ++lemma blaschke_pow_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ ρ ∈ zerosetKfR R1 (by linarith) f, ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 ∧ ++ DifferentiableAt ℂ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ intro ρ hρ z hz ++ have hfrac := ++ blaschke_frac_diff_nonzero (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ++ ρ hρ z hz ++ rcases hfrac with ⟨hne, hdiff⟩ ++ constructor ++ · exact pow_ne_zero _ hne ++ · convert hdiff.pow ((analyticOrderAt f ρ).toNat) using 1 ++ ++lemma blaschke_prod_diff_nonzero {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ (∏ ρ ∈ h_finite_zeros.toFinset, ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat) ≠ 0 ∧ ++ DifferentiableAt ℂ (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ intro z hz ++ classical ++ constructor ++ · ++ have hne_each : ∀ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 := by ++ intro ρ hρ ++ have hρ' : ρ ∈ zerosetKfR R1 (by linarith) f := ++ (h_finite_zeros.mem_toFinset).1 hρ ++ have hpair := ++ blaschke_pow_diff_nonzero (R := R) (R1 := R1) (f := f) ++ hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ' z hz ++ exact hpair.1 ++ exact (Finset.prod_ne_zero_iff).2 hne_each ++ · ++ have hdiff_each : ∀ ρ ∈ h_finite_zeros.toFinset, ++ DifferentiableAt ℂ ++ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ intro ρ hρ ++ have hρ' : ρ ∈ zerosetKfR R1 (by linarith) f := ++ (h_finite_zeros.mem_toFinset).1 hρ ++ have hpair := ++ blaschke_pow_diff_nonzero (R := R) (R1 := R1) (f := f) ++ hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ' z hz ++ exact hpair.2 ++ ++ have hdiff := ++ (DifferentiableAt.finsetProd (u := h_finite_zeros.toFinset) ++ (f := fun ρ => fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) ++ (x := z) hdiff_each) ++ have hfun_eq : ++ (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) ++ = ++ (∏ ρ ∈ h_finite_zeros.toFinset, ++ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat)) := by ++ funext w ++ simp [Finset.prod_apply] ++ exact hfun_eq.symm ▸ hdiff ++ ++lemma f_diff_nonzero_outside_Kf {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (_h_f_zero : f 0 = 1) ++ (_h_finite_zeros : (zerosetKfR R1 (by linarith ) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ f z ≠ 0 ∧ DifferentiableAt ℂ f z := by ++ intro z hz ++ ++ have hz' : z ∈ Metric.closedBall (0 : ℂ) R1 ∧ ++ z ∉ zerosetKfR R1 (by linarith) f := by ++ simpa [Set.mem_sdiff] using hz ++ have hz_in_R1 : z ∈ Metric.closedBall (0 : ℂ) R1 := hz'.1 ++ have hz_notin : z ∉ zerosetKfR R1 (by linarith) f := hz'.2 ++ ++ have hz_nonzero : f z ≠ 0 := by ++ intro hfz ++ exact hz_notin ⟨hz_in_R1, hfz⟩ ++ ++ have hR1_lt_1 : R1 < 1 := by linarith ++ have hsubset1 : ++ Metric.closedBall (0 : ℂ) R1 ⊆ Metric.ball (0 : ℂ) 1 := ++ Metric.closedBall_subset_ball hR1_lt_1 ++ have hz_in_ball1 : z ∈ Metric.ball (0 : ℂ) 1 := hsubset1 hz_in_R1 ++ have hz_in_1 : z ∈ Metric.closedBall (0 : ℂ) 1 := ++ Metric.ball_subset_closedBall hz_in_ball1 ++ have hAna : AnalyticAt ℂ f z := h_f_analytic z hz_in_1 ++ have hDiff : DifferentiableAt ℂ f z := hAna.differentiableAt ++ exact ⟨hz_nonzero, hDiff⟩ ++ ++lemma Bf_diff_nonzero_outside_Kf ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ z ≠ 0 ∧ ++ DifferentiableAt ℂ (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z := by ++ intro z hz ++ ++ rw [Set.mem_sdiff] at hz ++ have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R1 := hz.1 ++ ++ constructor ++ · ++ exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec z hz_ball ++ ++ · ++ ++ have hz_R : z ∈ Metric.closedBall (0 : ℂ) R := ++ Metric.closedBall_subset_closedBall (le_of_lt hR1_lt_R) hz_ball ++ ++ have h_analytic_on := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec ++ ++ have h_analytic_at := h_analytic_on z hz_R ++ ++ exact h_analytic_at.differentiableAt ++ ++lemma logDeriv_fprod_is_sum {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ logDeriv (fun w ↦ f w * ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = ++ logDeriv f z + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ intro z hz ++ have hf' := f_diff_nonzero_outside_Kf (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ++ rcases hf' with ⟨hf_ne, hf_diff⟩ ++ have hg' := blaschke_prod_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ++ rcases hg' with ⟨hg_ne, hg_diff⟩ ++ simpa using ++ (logDerivmul (f:=f) (g:=fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) (z:=z) ++ hf_diff hg_diff hf_ne hg_ne) ++ ++lemma nhds_avoids_finset {z : ℂ} (K : Finset ℂ) (hz : z ∉ (K : Set ℂ)) : ∀ᶠ w in nhds z, ∀ ρ ∈ K, w ≠ ρ := by ++ classical ++ ++ let U : Set ℂ := ⋂ ρ ∈ K, {w : ℂ | w ≠ ρ} ++ ++ have hopen_each : ∀ ρ ∈ K, IsOpen ({w : ℂ | w ≠ ρ} : Set ℂ) := by ++ intro ρ hρ ++ have hopen : IsOpen ((({ρ} : Set ℂ)ᶜ : Set ℂ)) := isOpen_compl_singleton ++ have hEq : ((({ρ} : Set ℂ)ᶜ : Set ℂ)) = {w : ℂ | w ≠ ρ} := by ++ ext w; simp ++ simpa [hEq] ++ using hopen ++ ++ have hopenU : IsOpen U := ++ isOpen_biInter_finset (s := K) (f := fun ρ : ℂ => ({w : ℂ | w ≠ ρ} : Set ℂ)) hopen_each ++ ++ have hzU : z ∈ U := by ++ have hznot : ∀ ρ ∈ K, z ≠ ρ := by ++ intro ρ hρ h ++ exact hz (by simpa [h] using hρ) ++ simpa [U] using hznot ++ ++ have hU_mem : U ∈ nhds z := hopenU.mem_nhds hzU ++ ++ refine Filter.eventually_of_mem hU_mem ?_ ++ intro w hw ρ hρ ++ have hw_all := Set.mem_iInter₂.mp hw ++ have : w ∈ ({w : ℂ | w ≠ ρ} : Set ℂ) := hw_all ρ hρ ++ simpa using this ++ ++lemma pow_div_pow_eq_div_pow (a b : ℂ) (n : ℕ) : a^n / b^n = (a / b)^n := by ++ simpa using (div_pow a b n).symm ++ ++lemma Cf_eventually_eq_f_div_prod {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ : ℂ → (ℂ → ℂ)) ++ (_h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f) : ++ (fun w ↦ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (by simp [h_f_zero]) h_finite_zeros h_σ w) ++ =ᶠ[nhds z] ++ (fun w ↦ f w / ∏ ρ ∈ h_finite_zeros.toFinset, (w - ρ) ^ (analyticOrderAt f ρ).toNat) := by ++ classical ++ rcases hz with ⟨hz_ball, hz_notin⟩ ++ ++ set S : Set ℂ := zerosetKfR R1 (by linarith) f ++ have hS_fin : S.Finite := h_finite_zeros ++ have hS_closed : IsClosed S := hS_fin.isClosed ++ have hU_open : IsOpen Sᶜ := hS_closed.isOpen_compl ++ have hz_memU : z ∈ Sᶜ := by simpa [S] using hz_notin ++ have hU_mem : Sᶜ ∈ nhds z := hU_open.mem_nhds hz_memU ++ refine Filter.eventually_of_mem hU_mem ?_ ++ intro w hw ++ have hw_notin : w ∉ S := by ++ ++ simpa [Set.mem_compl] using hw ++ ++ simp [S, Cf, hw_notin] ++ ++lemma eventuallyEq_mul_right_fun {α β} {l : Filter α} [Mul β] ++ {f g h : α → β} (hfg : f =ᶠ[l] g) : ++ (fun x => f x * h x) =ᶠ[l] (fun x => g x * h x) := by ++ filter_upwards [hfg] with x hx ++ rw [hx] ++ ++lemma inv_prod_complex {ι} (s : Finset ι) (f : ι → ℂ) : (∏ x ∈ s, f x)⁻¹ = ∏ x ∈ s, (f x)⁻¹ := by ++ classical ++ simp ++ ++lemma prod_num_mul_inv_den_eq_prod_ratio ++ (K : Finset ℂ) (N D : ℂ → ℂ) (m : ℂ → ℕ) : ++ (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ ++ = ∏ ρ ∈ K, ((N ρ / D ρ) ^ (m ρ)) := by ++ classical ++ ++ have hinv : (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ = ∏ ρ ∈ K, ((D ρ) ^ (m ρ))⁻¹ := by ++ simp ++ calc ++ (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ) ^ (m ρ))⁻¹ ++ = (∏ ρ ∈ K, (N ρ) ^ (m ρ)) * (∏ ρ ∈ K, ((D ρ) ^ (m ρ))⁻¹) := by ++ simp ++ _ = ∏ ρ ∈ K, ((N ρ) ^ (m ρ) * ((D ρ) ^ (m ρ))⁻¹) := by ++ simpa using (Finset.prod_mul_distrib (s := K) ++ (f := fun ρ => (N ρ) ^ (m ρ)) ++ (g := fun ρ => ((D ρ) ^ (m ρ))⁻¹)).symm ++ _ = ∏ ρ ∈ K, ((N ρ / D ρ) ^ (m ρ)) := by ++ apply Finset.prod_congr rfl ++ intro ρ hρ ++ ++ calc ++ (N ρ) ^ (m ρ) * ((D ρ) ^ (m ρ))⁻¹ ++ = (N ρ) ^ (m ρ) * ((D ρ)⁻¹) ^ (m ρ) := by ++ simp ++ _ = ((N ρ) * (D ρ)⁻¹) ^ (m ρ) := by ++ simp [mul_pow] ++ _ = (N ρ / D ρ) ^ (m ρ) := by ++ simp [div_eq_mul_inv] ++ ++lemma prod_num_mul_inv_den_eq_prod_ratio_fun ++ (K : Finset ℂ) (N D : ℂ → ℂ → ℂ) (m : ℂ → ℕ) : ++ (fun w ↦ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹) ++ = (fun w ↦ ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ))) := by ++ funext w ++ classical ++ have h_inv : ++ (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ = ∏ ρ ∈ K, ((D ρ w) ^ (m ρ))⁻¹ := by ++ simp ++ calc ++ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ ++ = (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, ((D ρ w) ^ (m ρ))⁻¹) := by ++ rw [h_inv] ++ _ = ∏ ρ ∈ K, ((N ρ w) ^ (m ρ)) * ((D ρ w) ^ (m ρ))⁻¹ := by ++ simpa using ++ (Finset.prod_mul_distrib ++ (s := K) ++ (f := fun ρ => (N ρ w) ^ (m ρ)) ++ (g := fun ρ => ((D ρ w) ^ (m ρ))⁻¹)).symm ++ _ = ∏ ρ ∈ K, (N ρ w / D ρ w) ^ (m ρ) := by ++ refine Finset.prod_congr rfl ?_ ++ intro ρ hρ ++ have hpow : ++ (N ρ w / D ρ w) ^ (m ρ) ++ = ((N ρ w) ^ (m ρ)) * ((D ρ w) ^ (m ρ))⁻¹ := by ++ simp [div_eq_mul_inv, mul_pow, inv_pow] ++ simp [hpow] ++ ++lemma div_mul_eq_mul_mul_inv_fun {α} (f A B : α → ℂ) : ++ (fun w => (f w / A w) * B w) = (fun w => f w * (B w * (A w)⁻¹)) := by ++ funext w ++ simp [div_eq_mul_inv, mul_comm, mul_left_comm] ++ ++lemma assoc_fun_mul {α} (f g h : α → ℂ) : (fun w => f w * (g w * h w)) = (fun w => (f w * g w) * h w) := by ++ funext w ++ simp [mul_assoc] ++ ++lemma prod_num_mul_inv_den_eq_prod_ratio_fun_mem ++ (K : Finset ℂ) (N D : ℂ → ℂ → ℂ) (m : ℂ → ℕ) : ++ (fun w ↦ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹) ++ = (fun w ↦ ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ))) := by ++ funext w ++ classical ++ calc ++ (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) * (∏ ρ ∈ K, (D ρ w) ^ (m ρ))⁻¹ ++ = (∏ ρ ∈ K, (N ρ w) ^ (m ρ)) / (∏ ρ ∈ K, (D ρ w) ^ (m ρ)) := by ++ simp [div_eq_mul_inv] ++ _ = ∏ ρ ∈ K, ((N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ)) := by ++ simp ++ _ = ∏ ρ ∈ K, ((N ρ w / D ρ w) ^ (m ρ)) := by ++ refine Finset.prod_congr rfl ?_ ++ intro ρ hρ ++ have hpow_div : ++ (N ρ w / D ρ w) ^ (m ρ) ++ = (N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ) := by ++ calc ++ (N ρ w / D ρ w) ^ (m ρ) ++ = (N ρ w * (D ρ w)⁻¹) ^ (m ρ) := by ++ simp [div_eq_mul_inv] ++ _ = (N ρ w) ^ (m ρ) * ((D ρ w)⁻¹) ^ (m ρ) := by ++ simpa using (mul_pow (N ρ w) ((D ρ w)⁻¹) (m ρ)) ++ _ = (N ρ w) ^ (m ρ) * ((D ρ w) ^ (m ρ))⁻¹ := by ++ simp ++ _ = (N ρ w) ^ (m ρ) / (D ρ w) ^ (m ρ) := by ++ simp [div_eq_mul_inv] ++ simpa using hpow_div.symm ++ ++lemma eventuallyEq_of_eq {α β} {l : Filter α} {f g : α → β} (h : f = g) : f =ᶠ[l] g := by ++ simp [h] ++ ++lemma logDeriv_congr_of_eventuallyEq {f g : ℂ → ℂ} {z : ℂ} ++ (hfg : f =ᶠ[nhds z] g) : logDeriv f z = logDeriv g z := by ++ ++ have hval : f z = g z := Filter.EventuallyEq.eq_of_nhds hfg ++ have hderiv_eq_ev : deriv f =ᶠ[nhds z] deriv g := hfg.deriv ++ have hderiv : deriv f z = deriv g z := Filter.EventuallyEq.eq_of_nhds hderiv_eq_ev ++ ++ have hf := deriv_over_fun_is_logDeriv (g := f) z ++ have hg := deriv_over_fun_is_logDeriv (g := g) z ++ simp [hf.symm, hg.symm, hval, hderiv] ++ ++lemma logDeriv_Bf_is_sum : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ ++ zerosetKfR R1 (by linarith) f, ++ logDeriv (Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ) z = ++ logDeriv f z + ++ logDeriv ++ (fun w ↦ ++ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ classical ++ intro z hz ++ ++ set K : Finset ℂ := h_finite_zeros.toFinset ++ ++ let A : ℂ → ℂ := fun w => ∏ ρ ∈ K, (w - ρ) ^ (analyticOrderAt f ρ).toNat ++ let BN : ℂ → ℂ := fun w => ∏ ρ ∈ K, (R - (star ρ) * w / R) ^ (analyticOrderAt f ρ).toNat ++ let RatProd : ℂ → ℂ := ++ fun w => ∏ ρ ∈ K, ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat ++ ++ set S : Set ℂ := zerosetKfR R1 (by linarith) f ++ have hS_fin : S.Finite := h_finite_zeros ++ have hU_open : IsOpen Sᶜ := hS_fin.isClosed.isOpen_compl ++ have hz_notin : z ∉ S := by ++ rcases hz with ⟨_, hnotin⟩; exact hnotin ++ have hzU : z ∈ Sᶜ := by simpa [Set.mem_compl] using hz_notin ++ have hU_mem : Sᶜ ∈ nhds z := hU_open.mem_nhds hzU ++ have h_ev : ++ (fun w ↦ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) ++ =ᶠ[nhds z] ++ (fun w ↦ f w * RatProd w) := by ++ refine Filter.eventually_of_mem hU_mem ?_ ++ intro w hwU ++ have hw_notin : w ∉ S := by simpa [Set.mem_compl] using hwU ++ ++ have hBf_w : ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w ++ = Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w * BN w := by ++ simp [Bf, BN, K] ++ have hCf_w : ++ Cf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w ++ = f w / A w := by ++ simp [Cf, S, A, K, hw_notin] ++ ++ have h_eq1 := div_mul_eq_mul_mul_inv_fun (f := f) (A := A) (B := BN) ++ have h_eq1_w : (f w / A w) * BN w = f w * (BN w * (A w)⁻¹) := by ++ simpa using congrArg (fun g : (ℂ → ℂ) => g w) h_eq1 ++ have h_eq2 := ++ prod_num_mul_inv_den_eq_prod_ratio_fun_mem ++ (K := K) ++ (N := fun ρ w ↦ (R - (star ρ) * w / R)) ++ (D := fun ρ w ↦ (w - ρ)) ++ (m := fun ρ ↦ (analyticOrderAt f ρ).toNat) ++ have h_eq2_w : BN w * (A w)⁻¹ = RatProd w := by ++ simpa [BN, A, RatProd] using congrArg (fun g : (ℂ → ℂ) => g w) h_eq2 ++ ++ calc ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w ++ = (f w / A w) * BN w := by simpa [hCf_w] using hBf_w ++ _ = f w * (BN w * (A w)⁻¹) := h_eq1_w ++ _ = f w * RatProd w := by simp [h_eq2_w] ++ ++ have hlog_congr := logDeriv_congr_of_eventuallyEq (f := fun w ↦ ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w) ++ (g := fun w ↦ f w * RatProd w) (z := z) h_ev ++ ++ have hsum := ++ (logDeriv_fprod_is_sum (R:=R) (R1:=R1) (f:=f) ++ hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz) ++ simpa [RatProd, K] using hlog_congr.trans hsum ++ ++lemma logDeriv_def_as_frac {f : ℂ → ℂ} {z : ℂ} ++ (_hf : DifferentiableAt ℂ f z) (_hf_ne : f z ≠ 0) : ++ logDeriv f z = deriv f z / f z := by ++ simp [logDeriv] ++ ++theorem ball_containment {r R1 : ℝ} (_hr_pos : 0 < r) (hr_lt_R1 : r < R1) (z : ℂ) (hz : z ∈ Metric.closedBall 0 r) : z ∈ Metric.closedBall 0 R1 := by ++ simp at * ++ exact le_trans hz (le_of_lt hr_lt_R1) ++ ++theorem in_r_minus_kf {R1 r : ℝ} {f : ℂ → ℂ} ++ (hr_pos : 0 < r) ++ (hr_lt_R1 : r < R1) ++ (z : ℂ) ++ (hz : z ∈ Metric.closedBall 0 r \ zerosetKfR R1 (by linarith) f) : ++ z ∈ Metric.closedBall 0 R1 \ zerosetKfR R1 (by linarith) f := by ++ obtain ⟨h1, h2⟩ := hz ++ have : z ∈ Metric.closedBall 0 R1 := by ++ apply ball_containment hr_pos hr_lt_R1 z h1 ++ constructor <;> assumption ++ ++lemma Lf_deriv_step1 : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, ++ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = ++ deriv f z / f z + logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ intro z hz ++ ++ have hz' : z ∈ Metric.closedBall (0 : ℂ) r ∧ z ∉ zerosetKfR R1 (by linarith) f := by ++ simpa [Set.mem_sdiff] using hz ++ have hz_ball : z ∈ Metric.closedBall (0 : ℂ) r := hz'.1 ++ ++ have hLf := ++ ++ (Lf_deriv_is_logBf_deriv hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec ++ z (in_r_minus_kf hr_pos hr_lt_R1 _ hz)).symm ++ ++ have hsum : ++ logDeriv (fun w ↦ ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) ++ h_finite_zeros h_σ w) z = ++ logDeriv f z + ++ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ have h := ++ (logDeriv_Bf_is_sum (R := R) (R1 := R1) (r := r) (f := f) (h_σ := h_σ) ++ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros) z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) ++ simpa using h ++ ++ obtain ⟨hf_ne, hfdiff⟩ := ++ f_diff_nonzero_outside_Kf (R := R) (R1 := R1) (f := f) ++ hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) ++ have hfrac : logDeriv f z = deriv f z / f z := ++ logDeriv_def_as_frac (f := f) (z := z) hfdiff hf_ne ++ ++ have hLf_eq_logDerivBf : ++ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = ++ logDeriv (fun w ↦ ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) ++ h_finite_zeros h_σ w) z := by ++ ++ have hz_in_r : z ∈ Metric.closedBall (0 : ℂ) r := hz_ball ++ ++ let B_f : ℂ → ℂ := ++ fun w => Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) h_finite_zeros h_σ w ++ let log_exists := log_of_analytic ++ (r1 := r) (R' := R1) (R := R) ++ hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 ++ (B := B_f) ++ (hB := Bf_is_analytic_on_disk R R1 hR1_pos hR1_lt_R hR_lt_1 ++ f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec) ++ (hB_ne_zero := by ++ intro w hw ++ exact Bf_never_zero R R1 hR1_pos hR1_lt_R hR_lt_1 ++ f h_f_analytic h_f_zero h_finite_zeros h_σ h_σ_spec w hw) ++ have hderiv_all : ∀ w ∈ Metric.closedBall (0 : ℂ) r, ++ deriv (Classical.choose log_exists) w = deriv B_f w / B_f w := ++ (Classical.choose_spec log_exists).2.2.1 ++ have hderiv_Lf : ++ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos ++ h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z ++ = deriv B_f z / B_f z := by ++ ++ unfold Lf ++ ++ simpa using hderiv_all z hz_in_r ++ ++ have h_as_log : deriv B_f z / B_f z = logDeriv B_f z := ++ deriv_over_fun_is_logDeriv (g := B_f) z ++ ++ simpa [B_f] using hderiv_Lf.trans h_as_log ++ ++ calc ++ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z ++ = logDeriv (fun w ↦ ++ Bf R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic (f_zero_ne_zero h_f_zero) ++ h_finite_zeros h_σ w) z := hLf_eq_logDerivBf ++ _ = logDeriv f z + ++ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := hsum ++ _ = deriv f z / f z + ++ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ simp [hfrac] ++ ++lemma logDeriv_prod_is_sum {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = ++ ∑ ρ ∈ h_finite_zeros.toFinset, logDeriv (fun w ↦ ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ intro z hz ++ have hdiff : ∀ ρ ∈ h_finite_zeros.toFinset, ++ DifferentiableAt ℂ (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z := by ++ intro ρ hρ ++ have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := ++ (h_finite_zeros.mem_toFinset).mp hρ ++ have h := blaschke_pow_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρmem z hz ++ exact h.2 ++ have hne : ∀ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * z / R) / (z - ρ)) ^ (analyticOrderAt f ρ).toNat ≠ 0 := by ++ intro ρ hρ ++ have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := ++ (h_finite_zeros.mem_toFinset).mp hρ ++ have h := blaschke_pow_diff_nonzero (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρmem z hz ++ exact h.1 ++ simpa using ++ (logDerivprod (K := h_finite_zeros.toFinset) ++ (g := fun ρ w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) ++ (z := z) hdiff hne) ++ ++lemma logDeriv_power_is_mul {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ ∀ ρ ∈ h_finite_zeros.toFinset, ++ logDeriv (fun w ↦ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = ++ (analyticOrderAt f ρ).toNat * logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by ++ intro z hz ρ hρFin ++ have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := by ++ simpa using (h_finite_zeros.mem_toFinset.mp hρFin) ++ have hfrac := ++ blaschke_frac_diff_nonzero (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ++ ρ hρmem z hz ++ rcases hfrac with ⟨_hneq, hdiff⟩ ++ simpa using ++ (logDerivfunpow (g := fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) (z := z) ++ (m := (analyticOrderAt f ρ).toNat) hdiff) ++ ++lemma logDeriv_prod_is_sum_mul {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ logDeriv (fun w ↦ ∏ ρ ∈ h_finite_zeros.toFinset, ++ ((R - (star ρ) * w / R) / (w - ρ)) ^ (analyticOrderAt f ρ).toNat) z = ++ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * ++ logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by ++ intro z hz ++ classical ++ have hsum := ++ logDeriv_prod_is_sum (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ++ refine hsum.trans ?_ ++ refine Finset.sum_congr rfl ?_ ++ intro ρ hρ ++ exact ++ logDeriv_power_is_mul (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ρ hρ ++ ++lemma Lf_deriv_step2 : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, ++ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = ++ deriv f z / f z + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * ++ logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z := by ++ intro z hz ++ classical ++ have h1 := ++ Lf_deriv_step1 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz ++ have hsum := ++ logDeriv_prod_is_sum_mul (R:=R) (R1:=R1) (f:=f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) ++ have h2 := congrArg (fun t => deriv f z / f z + t) hsum ++ exact h1.trans h2 ++ ++lemma logDeriv_Blaschke_is_diff {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ ∀ ρ ∈ h_finite_zeros.toFinset, ++ logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z = ++ logDeriv (fun w ↦ R - (star ρ) * w / R) z - logDeriv (fun w ↦ w - ρ) z := by ++ intro z hz ρ hρ ++ have hρ_set : ρ ∈ zerosetKfR R1 (by linarith) f := by ++ exact (Set.Finite.mem_toFinset (hs := h_finite_zeros) (a := ρ)).mp hρ ++ rcases hz with ⟨hz_in, hz_notin⟩ ++ have hden := z_minus_rho_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ++ ρ hρ_set z ⟨hz_in, hz_notin⟩ ++ rcases hden with ⟨hden_nz, hden_diff⟩ ++ have hz_le : ‖z‖ ≤ R1 := by ++ simpa [Metric.closedBall, dist_eq_norm] using hz_in ++ have hle1 : R1 < 1 := by linarith [hR1_lt_R, hR_lt_1] ++ have hz_in1 : z ∈ Metric.closedBall (0 : ℂ) 1 := by ++ have : ‖z‖ ≤ 1 := le_of_lt (hz_le.trans_lt hle1) ++ simpa [Metric.closedBall, dist_eq_norm] using this ++ have hz_inR : z ∈ Metric.closedBall (0 : ℂ) R := by ++ have hz_le_R : ‖z‖ ≤ R := by ++ calc ‖z‖ ≤ R1 := hz_le ++ _ ≤ R := le_of_lt hR1_lt_R ++ simpa [Metric.closedBall, dist_eq_norm] using hz_le_R ++ have hnum := blaschke_num_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ++ ρ hρ_set z hz_inR ++ rcases hnum with ⟨hnum_nz, hnum_diff⟩ ++ simpa using ++ (logDerivdiv (hh := hnum_diff) (hg := hden_diff) (hh_ne := hnum_nz) (hg_ne := hden_nz)) ++ ++lemma logDeriv_linear {a b : ℂ} {z : ℂ} (_ha : a ≠ 0) (_hz : z ≠ -b/a) : ++ logDeriv (fun w ↦ a * w + b) z = a / (a * z + b) := by ++ ++ have h_id : HasDerivAt (fun w : ℂ => w) (1 : ℂ) z := hasDerivAt_id _ ++ have h_mul' : HasDerivAt (fun w : ℂ => a * w) a z := by ++ simpa [one_mul] using (h_id.const_mul a) ++ have h_deriv_mul : deriv (fun w : ℂ => a * w) z = a := h_mul'.deriv ++ ++ simp [logDeriv] ++ ++lemma logDeriv_denominator {ρ : ℂ} {z : ℂ} (hz : z ≠ ρ) : ++ logDeriv (fun w ↦ w - ρ) z = 1 / (z - ρ) := by ++ have h := ++ logDeriv_linear (a := (1 : ℂ)) (b := -ρ) (z := z) ++ (_ha := by simp) ++ (_hz := by simpa using hz) ++ simpa [one_mul, sub_eq_add_neg] using h ++ ++lemma logDeriv_numerator_pre {R : ℝ} {ρ : ℂ} {z : ℂ} : ++ logDeriv (fun w ↦ R - (star ρ) * w / R) z = -(star ρ) / R / (R - (star ρ) * z / R) := by ++ classical ++ ++ let a : ℂ := -(star ρ) / (R : ℂ) ++ let b : ℂ := (R : ℂ) ++ have hlin : (fun w : ℂ ↦ (R : ℂ) - (star ρ) * w / (R : ℂ)) = (fun w : ℂ ↦ b + a * w) := by ++ funext w ++ ++ simp [a, b, sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm] ++ ++ have hderiv_add : deriv (fun w : ℂ => b + a * w) z = ++ deriv (fun _ : ℂ => b) z + deriv (fun y : ℂ => a * y) z := by ++ simp ++ have hderiv_ab : deriv (fun w : ℂ => b + a * w) z = a := by ++ simp [deriv_const, mul_comm] ++ ++ simp [logDeriv, sub_eq_add_neg, div_eq_mul_inv, ++ mul_comm, mul_left_comm, mul_assoc, add_comm] ++ ++lemma star_ne_zero_of_ne_zero {ρ : ℂ} (hρ : ρ ≠ 0) : star ρ ≠ 0 := by ++ ++ intro h ++ ++ have : ρ = 0 := (star_eq_zero).1 h ++ exact hρ this ++ ++lemma field_identity_general {K : Type*} [Field K] {a b c : K} (ha : a ≠ 0) (hb : b ≠ 0) (_hden : a - c*b/a ≠ 0) : (-(b/a)) / (a - c*b/a) = (1 : K) / (c - a^2/b) := by ++ ++ have hmul : (-(a / b) : K) ≠ 0 := by ++ have hdiv_ne : a / b ≠ 0 := div_ne_zero ha hb ++ exact neg_ne_zero.mpr hdiv_ne ++ have hnum : (-(b/a) * (-(a/b))) = (1 : K) := by ++ calc ++ (-(b/a) * (-(a/b))) = (b/a) * (a/b) := by simp ++ _ = (b * a⁻¹) * (a * b⁻¹) := by simp [div_eq_mul_inv] ++ _ = b * (a⁻¹ * (a * b⁻¹)) := by simp [mul_assoc] ++ _ = b * ((a⁻¹ * a) * b⁻¹) := by simp [mul_assoc] ++ _ = b * (1 * b⁻¹) := by simp [ha] ++ _ = b * b⁻¹ := by simp ++ _ = 1 := by simp [hb] ++ have hOne : (b/a) * (a/b) = (1 : K) := by ++ calc ++ (b/a) * (a/b) = (b * a⁻¹) * (a * b⁻¹) := by simp [div_eq_mul_inv] ++ _ = b * (a⁻¹ * (a * b⁻¹)) := by simp [mul_assoc] ++ _ = b * ((a⁻¹ * a) * b⁻¹) := by simp [mul_assoc] ++ _ = b * (1 * b⁻¹) := by simp [ha] ++ _ = b * b⁻¹ := by simp ++ _ = 1 := by simp [hb] ++ have haab : a * (a / b) = a^2 / b := by ++ simp [div_eq_mul_inv, pow_two, mul_assoc] ++ have hcbab : (c * b / a) * (a / b) = c := by ++ calc ++ (c * b / a) * (a / b) = (c * (b / a)) * (a / b) := by simp [div_eq_mul_inv, mul_assoc] ++ _ = c * ((b / a) * (a / b)) := by simp [mul_assoc] ++ _ = c * 1 := by simp [hOne] ++ _ = c := by simp ++ have hdenom : ((a - c*b/a) * (-(a/b))) = c - a^2 / b := by ++ calc ++ ((a - c*b/a) * (-(a/b))) = -((a - c*b/a) * (a / b)) := by simp [mul_neg] ++ _ = -(a * (a / b) - (c * b / a) * (a / b)) := by simp [sub_mul] ++ _ = (c * b / a) * (a / b) - a * (a / b) := by simp [neg_sub] ++ _ = c - a^2 / b := by simp [hcbab, haab] ++ calc ++ (-(b/a)) / (a - c*b/a) ++ = (-(b/a) * (-(a/b))) / ((a - c*b/a) * (-(a/b))) := by ++ simpa using ++ (mul_div_mul_right (a := (-(b / a))) (b := (a - c * b / a)) (c := (-(a / b))) hmul).symm ++ _ = 1 / ((a - c*b/a) * (-(a/b))) := by simp [hnum] ++ _ = 1 / (c - a^2/b) := by simp [hdenom] ++ ++lemma complex_identity_from_field {R : ℝ} {ρ z : ℂ} (hR : R ≠ 0) (hρ : ρ ≠ 0) (hden : (R:ℂ) - (star ρ) * z / R ≠ 0) : (-(star ρ) / (R:ℂ)) / ((R:ℂ) - (star ρ) * z / R) = (1 : ℂ) / (z - (R:ℂ)^2 / (star ρ)) := by ++ have ha : (R : ℂ) ≠ 0 := by simpa using (Complex.ofReal_ne_zero.mpr hR) ++ have hb : star ρ ≠ 0 := star_ne_zero_of_ne_zero hρ ++ have hden' : (R : ℂ) - z * (star ρ) / (R : ℂ) ≠ 0 := by ++ simpa [mul_comm, mul_left_comm, mul_assoc, div_eq_mul_inv] using hden ++ have h := field_identity_general (K := ℂ) (a := (R : ℂ)) (b := star ρ) (c := z) ha hb hden' ++ simpa [mul_comm, mul_left_comm, mul_assoc, div_eq_mul_inv] using h ++ ++lemma logDeriv_numerator_rearranged {R : ℝ} {ρ z : ℂ} (hR : R ≠ 0) (hrho : ρ ≠ 0) (h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0) : -(star ρ) / R / ((R : ℂ) - (star ρ) * z / R) = 1 / (z - (R : ℂ)^2 / (star ρ)) := by ++ simpa using (complex_identity_from_field (R:=R) (ρ:=ρ) (z:=z) (hR:=hR) (hρ:=hrho) (hden:=h_denom_ne_zero)) ++ ++lemma logDeriv_numerator {R : ℝ} {ρ : ℂ} {z : ℂ} ++ (hR : R ≠ 0) ++ (hrho : ρ ≠ 0) ++ (h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0): ++ logDeriv (fun w ↦ R - (star ρ) * w / R) z = 1 / (z - R^2 / (star ρ)) := by ++ rw [logDeriv_numerator_pre, logDeriv_numerator_rearranged] ++ <;> assumption ++ ++lemma logDeriv_Blaschke_is_diff_frac {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) (h_f_zero : f 0 = 1) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ ρ ∈ h_finite_zeros.toFinset, ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f , logDeriv (fun w ↦ (R - (star ρ) * w / R) / (w - ρ)) z = ++ 1 / (z - R^2 / (star ρ)) - 1 / (z - ρ) := by ++ intro ρ hρ z hz ++ ++ have h_div := logDeriv_Blaschke_is_diff (R := R) (R1 := R1) (f := f) hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ρ hρ ++ ++ have hρ_mem : ρ ∈ zerosetKfR R1 (by linarith) f := by ++ exact (h_finite_zeros.mem_toFinset).mp hρ ++ have hρ_ne_zero : ρ ≠ 0 := by ++ intro h_eq ++ ++ have : f 0 = 0 := by simpa [h_eq] using hρ_mem.2 ++ exact (zero_ne_one : (0 : ℂ) ≠ 1) (this.symm.trans h_f_zero) ++ have hR_ne_zero : R ≠ 0 := ne_of_gt (hR1_pos.trans hR1_lt_R) ++ have h_denom_ne_zero : (R : ℂ) - (star ρ) * z / R ≠ 0 := by ++ ++ have hz_ball : z ∈ Metric.closedBall (0 : ℂ) R := by ++ have hle : R1 < R := hR1_lt_R ++ apply Metric.closedBall_subset_closedBall (le_of_lt hle) ++ exact hz.1 ++ have h := blaschke_num_diff_nonzero hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros ρ hρ_mem z hz_ball ++ exact h.1 ++ have h_num := logDeriv_numerator hR_ne_zero hρ_ne_zero h_denom_ne_zero ++ ++ have hz_ne_rho : z ≠ ρ := by ++ intro h_eq ++ exact hz.2 (by simpa [h_eq] using hρ_mem) ++ have h_den := logDeriv_denominator hz_ne_rho ++ ++ rw [h_div, h_num, h_den] ++ ++lemma Lf_deriv_step3 : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, ++ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = ++ deriv f z / f z + ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * (1 / (z - R^2 / (star ρ)) - 1 / (z - ρ)) := by ++ intro z hz ++ ++ rw [Lf_deriv_step2 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz] ++ congr 1 ++ apply Finset.sum_congr rfl ++ intro ρ hρ ++ congr 1 ++ exact logDeriv_Blaschke_is_diff_frac hR1_pos hR1_lt_R hR_lt_1 h_f_zero h_f_analytic h_finite_zeros ρ hρ z (in_r_minus_kf hr_pos hr_lt_R1 _ hz) ++ ++lemma sum_of_diff {K : Finset ℂ} {a b : ℂ → ℂ} : ++ ∑ ρ ∈ K, (a ρ - b ρ) = ∑ ρ ∈ K, a ρ - ∑ ρ ∈ K, b ρ := by ++ simp [Finset.sum_sub_distrib] ++ ++lemma sum_rearranged {R R1 : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (_h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, ++ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat * ++ (1 / (z - R^2 / (star ρ)) - 1 / (z - ρ)) = ++ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) - ++ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) := by ++ intro z hz ++ rw [← Finset.sum_sub_distrib] ++ congr 1 ++ ext ρ ++ rw [mul_sub, mul_one_div, mul_one_div] ++ ++lemma Lf_deriv_final_formula : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, ++ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z = ++ deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) + ++ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) := by ++ intro z hz ++ ++ rw [Lf_deriv_step3 hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz] ++ ++ rw [sum_rearranged hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz] ++ ++ ring ++ ++lemma rearrange_Lf_deriv : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, ++ deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ) = ++ deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z - ++ ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ)) := by ++ intro z hz ++ ++ have h_final := Lf_deriv_final_formula hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz ++ rw [h_final] ++ ring ++ ++lemma triangle_ineq_sum {w₁ w₂ : ℂ} : ++ ‖w₁ - w₂‖ ≤ ‖w₁‖ + ‖w₂‖ := by ++ have h : w₁ - w₂ = w₁ + (-w₂) := sub_eq_add_neg w₁ w₂ ++ rw [h] ++ have h₁ : ‖w₁ + (-w₂)‖ ≤ ‖w₁‖ + ‖-w₂‖ := norm_add_le w₁ (-w₂) ++ have h₂ : ‖-w₂‖ = ‖w₂‖ := norm_neg w₂ ++ rw [h₂] at h₁; exact h₁ ++ ++lemma target_inequality_setup : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f, ++ ‖deriv f z / f z - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ ++ ‖deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z‖ + ++ ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ := by ++ intro z hz ++ ++ have hrearr := rearrange_Lf_deriv hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz ++ ++ rw [hrearr] ++ exact norm_sub_le _ _ ++ ++lemma conj_norm_eq_norm (z : ℂ) : ‖star z‖ = ‖z‖ := by ++ simp ++ ++lemma norm_div_eq (a b : ℂ) (_hb : b ≠ 0) : ‖a / b‖ = ‖a‖ / ‖b‖ := by ++ calc ++ ‖a / b‖ = ‖a * b⁻¹‖ := by simp [div_eq_mul_inv] ++ _ = ‖a‖ * ‖b⁻¹‖ := norm_mul _ _ ++ _ = ‖a‖ * ‖b‖⁻¹ := by simp [norm_inv] ++ _ = ‖a‖ / ‖b‖ := by simp [div_eq_mul_inv] ++ ++lemma norm_Rsq_div_conj (R : ℝ) (ρ : ℂ) (hρ : ρ ≠ 0) : ‖((R^2 : ℂ) / (star ρ))‖ = (R^2 : ℝ) / ‖ρ‖ := by ++ have hb : star ρ ≠ 0 := by ++ intro h ++ have h' := congrArg star h ++ ++ have : ρ = 0 := by simpa [star_star] using h' ++ exact hρ this ++ have hnormR : ‖(R^2 : ℂ)‖ = (R^2 : ℝ) := by ++ have h := (RCLike.norm_ofReal (K:=ℂ) (R^2)) ++ simp ++ calc ++ ‖((R^2 : ℂ) / (star ρ))‖ ++ = ‖(R^2 : ℂ)‖ / ‖star ρ‖ := norm_div_eq _ _ hb ++ _ = (R^2 : ℝ) / ‖ρ‖ := by ++ simp [hnormR] ++ ++lemma zerosetKfR_subset_closedBall {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} : ++ zerosetKfR R1 hR1 f ⊆ Metric.closedBall (0 : ℂ) R1 := by ++ intro ρ hρ ++ have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 ∧ f ρ = 0 := by ++ simpa [zerosetKfR] using hρ ++ exact hmem.left ++ ++lemma mem_zerosetKfR_ne_zero_of_f0_eq_one {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} ++ (hf0 : f 0 = 1) {ρ : ℂ} (hρ : ρ ∈ zerosetKfR R1 hR1 f) : ρ ≠ 0 := by ++ intro hρ0 ++ have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 ∧ f ρ = 0 := by ++ simpa [zerosetKfR] using hρ ++ have hzero : f 0 = 0 := by simpa [hρ0] using hmem.right ++ have h10 : (1 : ℂ) ≠ 0 := one_ne_zero ++ exact h10 (by simp [hf0] at hzero) ++ ++lemma norm_sub_ge_norm_sub (x y : ℂ) : ‖x - y‖ ≥ ‖y‖ - ‖x‖ := by ++ have htri : ‖y‖ ≤ ‖y - x‖ + ‖x‖ := by ++ simpa [sub_eq_add_neg, add_comm] using norm_add_le (y - x) x ++ have h' : ‖y‖ - ‖x‖ ≤ ‖y - x‖ := (sub_le_iff_le_add).mpr htri ++ have hsymm : ‖y - x‖ = ‖x - y‖ := by ++ simpa [sub_eq_add_neg, add_comm] using (norm_neg (x - y)) ++ simpa [hsymm] using h' ++ ++lemma mem_zerosetKfR_norm_le {R1 : ℝ} (hR1 : 0 < R1) {f : ℂ → ℂ} {ρ : ℂ} ++ (hρ : ρ ∈ zerosetKfR R1 hR1 f) : ‖ρ‖ ≤ R1 := by ++ have hmem : ρ ∈ Metric.closedBall (0 : ℂ) R1 := ++ (zerosetKfR_subset_closedBall (R1 := R1) hR1 (f := f)) hρ ++ have hdist : dist ρ (0 : ℂ) ≤ R1 := by ++ simpa [Metric.mem_closedBall] using hmem ++ simpa [dist_eq_norm, sub_zero] using hdist ++ ++lemma lem_sum_bound_step2 {R R1: ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (_hR_lt_1 : R < 1) ++ (_h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ (∑ ρ ∈ h_finite_zeros.toFinset, ++ ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - (R^2 : ℂ) / (star ρ)‖) ++ ≤ (1/(R^2/R1 - R1)) * ++ (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) := by ++ classical ++ intro z hz ++ rcases hz with ⟨hzball, _hznotin⟩ ++ have hz_norm : ‖z‖ ≤ R1 := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hzball ++ ++ set S := h_finite_zeros.toFinset ++ have hS_spec : ∀ {ρ : ℂ}, ρ ∈ S → ρ ∈ zerosetKfR R1 (by linarith) f := by ++ intro ρ hρ ++ have hiff := (Set.Finite.mem_toFinset (hs := h_finite_zeros) : ρ ∈ S ↔ ρ ∈ zerosetKfR R1 (by linarith) f) ++ exact (Iff.mp hiff) hρ ++ ++ have hsum_le : ++ (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - (R^2 : ℂ) / (star ρ)‖) ++ ≤ ∑ ρ ∈ S, (1/(R^2/R1 - R1)) * ((analyticOrderAt f ρ).toNat : ℝ) := by ++ refine Finset.sum_le_sum ?termwise ++ intro ρ hρS ++ have hρmem : ρ ∈ zerosetKfR R1 (by linarith) f := hS_spec hρS ++ have hρ_ne : ρ ≠ 0 := ++ mem_zerosetKfR_ne_zero_of_f0_eq_one (R1 := R1) (hR1 := by linarith) ++ (f := f) h_f_zero hρmem ++ have hρ_norm : ‖ρ‖ ≤ R1 := mem_zerosetKfR_norm_le (R1 := R1) ++ (hR1 := by linarith) (f := f) hρmem ++ have hpt : 1 / ‖z - (R^2 : ℂ) / (star ρ)‖ ≤ 1/(R^2/R1 - R1) := by ++ ++ have h_Rsq_norm : ‖((R^2 : ℂ) / (star ρ))‖ = (R^2 : ℝ) / ‖ρ‖ := ++ norm_Rsq_div_conj R ρ hρ_ne ++ have h_lower_bound : ‖z - (R^2 : ℂ) / (star ρ)‖ ≥ ‖((R^2 : ℂ) / (star ρ))‖ - ‖z‖ := ++ norm_sub_ge_norm_sub z ((R^2 : ℂ) / (star ρ)) ++ ++ have hρ_pos : 0 < ‖ρ‖ := by ++ simpa [norm_pos_iff] using hρ_ne ++ have h_Rsq_bound : R^2/R1 ≤ ‖((R^2 : ℂ) / (star ρ))‖ := by ++ rw [h_Rsq_norm] ++ exact div_le_div_of_nonneg_left (sq_nonneg R) hρ_pos hρ_norm ++ have h_combined : R^2/R1 - R1 ≤ ‖z - (R^2 : ℂ) / (star ρ)‖ := by ++ calc R^2/R1 - R1 ++ _ ≤ ‖((R^2 : ℂ) / (star ρ))‖ - R1 := by linarith [h_Rsq_bound] ++ _ ≤ ‖((R^2 : ℂ) / (star ρ))‖ - ‖z‖ := by linarith [hz_norm] ++ _ ≤ ‖z - (R^2 : ℂ) / (star ρ)‖ := h_lower_bound ++ have h_pos_denom : 0 < R^2/R1 - R1 := by ++ have h_R_pos : 0 < R := by linarith [hR1_pos, hR1_lt_R] ++ have h_Rsq_pos : 0 < R^2 := sq_pos_of_pos h_R_pos ++ calc R^2/R1 - R1 ++ _ = (R^2 - R1*R1)/R1 := by field_simp ++ _ = (R - R1)*(R + R1)/R1 := by ring ++ _ > 0 := by ++ apply div_pos ++ · apply mul_pos ++ · linarith [hR1_lt_R] ++ · linarith [hR1_pos, hR1_lt_R] ++ · exact hR1_pos ++ have h_pos_norm : 0 < ‖z - (R^2 : ℂ) / (star ρ)‖ := by ++ apply lt_of_lt_of_le h_pos_denom h_combined ++ ++ have h_reciprocal : 1 / ‖z - (R^2 : ℂ) / (star ρ)‖ ≤ 1 / (R^2/R1 - R1) := by ++ apply div_le_div_of_nonneg_left ++ · norm_num ++ · exact h_pos_denom ++ · exact h_combined ++ exact h_reciprocal ++ have hmnonneg : 0 ≤ ((analyticOrderAt f ρ).toNat : ℝ) := by ++ exact_mod_cast (Nat.zero_le (analyticOrderAt f ρ).toNat) ++ have hmul := mul_le_mul_of_nonneg_left hpt hmnonneg ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hmul ++ ++ rw [← Finset.mul_sum] at hsum_le ++ exact hsum_le ++ ++lemma sq_div_sub_pos (a b : ℝ) (ha_pos : 0 < a) (hab : a < b) : 0 < b^2/a - a := by ++ ++ rw [sub_pos] ++ ++ rw [lt_div_iff₀ ha_pos] ++ ++ rw [← pow_two] ++ ++ have ha_nonneg : 0 ≤ a := le_of_lt ha_pos ++ apply pow_lt_pow_left₀ hab ha_nonneg ++ norm_num ++ ++lemma final_sum_bound {R R1 B : ℝ} {f : ℂ → ℂ} ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (hB : 1 < B) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f, ++ ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ ≤ ++ 1/((R^2/R1 - R1) * Real.log (R/R1)) * Real.log B := by ++ intro z hz ++ ++ have h_norm_bound := norm_sum_le h_finite_zeros.toFinset (fun ρ => (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))) ++ ++ have h_sum_eq : ∑ ρ ∈ h_finite_zeros.toFinset, ‖(analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ = ++ ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - R^2 / (star ρ)‖ := by ++ apply Finset.sum_congr rfl ++ intro ρ hρ ++ rw [norm_div, Complex.norm_natCast] ++ ++ have h_step2 := lem_sum_bound_step2 hR1_pos hR1_lt_R hR_lt_1 h_f_analytic h_f_zero h_finite_zeros z hz ++ ++ have h_f_nonzero : f 0 ≠ 0 := by rw [h_f_zero]; norm_num ++ have h_f_bounded_alt : ∀ z : ℂ, ‖z‖ ≤ R → ‖f z‖ ≤ B := by ++ intro w hw ++ exact h_f_bounded w (Metric.mem_closedBall.mpr (by simpa [dist_eq_norm] using hw)) ++ ++ have h_exists : ∀ σ : ℂ, ∃ g : ℂ → ℂ, ++ AnalyticAt ℂ g σ ∧ g σ ≠ 0 ∧ ++ (σ ∈ zerosetKfR R1 (by linarith) f → ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * g z) := by ++ intro σ ++ by_cases hσ : σ ∈ zerosetKfR R1 (by linarith) f ++ · ++ have hex := lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero σ hσ ++ obtain ⟨g, hg_at, hg_ne, h_eq⟩ := hex ++ exact ⟨g, hg_at, hg_ne, fun _ => h_eq⟩ ++ · ++ refine ⟨fun _ => 1, ?_, ?_, ?_⟩ ++ · exact analyticAt_const ++ · norm_num ++ · intro h_contra ++ contradiction ++ ++ let h_σ : ℂ → (ℂ → ℂ) := fun σ => Classical.choose (h_exists σ) ++ have h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z := by ++ intro σ hσ ++ have spec := Classical.choose_spec (h_exists σ) ++ exact ⟨spec.1, spec.2.1, spec.2.2 hσ⟩ ++ have h_sum_bound := lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 f h_f_analytic h_f_nonzero h_f_zero h_finite_zeros h_σ h_f_bounded_alt h_σ_spec ++ ++ have h_pos : 0 < R^2/R1 - R1 := sq_div_sub_pos R1 R hR1_pos hR1_lt_R ++ have h_ratio_gt_one : 1 < R/R1 := by ++ rw [one_lt_div_iff] ++ left ++ exact ⟨hR1_pos, hR1_lt_R⟩ ++ have h_log_pos : 0 < Real.log (R/R1) := Real.log_pos h_ratio_gt_one ++ ++ calc ‖∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ ++ ≤ ∑ ρ ∈ h_finite_zeros.toFinset, ‖(analyticOrderAt f ρ).toNat / (z - R^2 / (star ρ))‖ := h_norm_bound ++ _ = ∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) / ‖z - R^2 / (star ρ)‖ := h_sum_eq ++ _ ≤ (1/(R^2/R1 - R1)) * (∑ ρ ∈ h_finite_zeros.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) := h_step2 ++ _ ≤ (1/(R^2/R1 - R1)) * ((1/Real.log (R/R1)) * Real.log B) := by ++ apply mul_le_mul_of_nonneg_left h_sum_bound (div_nonneg zero_le_one (le_of_lt h_pos)) ++ _ = 1/((R^2/R1 - R1) * Real.log (R/R1)) * Real.log B := by ++ field_simp [ne_of_gt h_pos, ne_of_gt h_log_pos] ++ ++lemma final_inequality ++ (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) ++ (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ_spec : ++ ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, ++ f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1 \ zerosetKfR R1 (by linarith) f, ++ ++ ‖(deriv f z / f z ++ - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ))‖ ++ ≤ ++ 16 * r^2 / ((r - r1)^3) * Real.log B ++ + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) * Real.log B := by ++ intro z hz ++ ++ have hr_pos : 0 < r := by linarith [hr1pos, hr1_lt_r] ++ have hR1_pos : 0 < R1 := by linarith [hr_pos, hr_lt_R1] ++ ++ have hz_in_r : z ∈ Metric.closedBall (0 : ℂ) r \ zerosetKfR R1 (by linarith) f := by ++ constructor ++ · apply Metric.closedBall_subset_closedBall (le_of_lt hr1_lt_r) ++ exact hz.1 ++ · exact hz.2 ++ ++ have hineq := ++ target_inequality_setup hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec z hz_in_r ++ ++ have hz_in_R1 : z ∈ Metric.closedBall (0 : ℂ) R1 \ zerosetKfR R1 (by linarith) f := by ++ constructor ++ · apply Metric.closedBall_subset_closedBall ++ exact le_of_lt (lt_trans hr1_lt_r hr_lt_R1) ++ exact hz.1 ++ · exact hz.2 ++ ++ have hsum := ++ final_sum_bound hR1_pos hR1_lt_R hR_lt_1 hB h_f_analytic h_f_zero h_finite_zeros h_f_bounded z hz_in_R1 ++ ++ have hz_le_r1 : ‖z‖ ≤ r1 := by simpa [Metric.mem_closedBall, dist_eq_norm] using hz.1 ++ ++ have hz_abs : ‖z‖ ≤ r1 := hz_le_r1 ++ ++ have h_BC := apply_BC_to_Lf ++ (B := B) (r1 := r1) (r := r) (R := R) (R1 := R1) ++ (hB := hB) (hr1_pos := hr1pos) (hr1_lt_r := hr1_lt_r) (hr_lt_R1 := hr_lt_R1) ++ (hR1_pos := hR1_pos) (hR1_lt_R := hR1_lt_R) (hR_lt_1 := hR_lt_1) ++ (f := f) (h_f_analytic := h_f_analytic) (h_f_zero := h_f_zero) ++ (h_finite_zeros := h_finite_zeros) (h_σ := h_σ) (h_σ_spec := h_σ_spec) ++ (h_f_bound := fun w hw => h_f_bounded w (Metric.mem_closedBall.mpr (by simpa [dist_eq_norm] using hw))) ++ z hz_abs ++ ++ have hLf : ‖deriv (Lf hr_pos hr_lt_R1 hR1_lt_R hR_lt_1 hR1_pos h_f_analytic h_f_zero h_finite_zeros h_σ_spec) z‖ ≤ ++ 16 * r^2 / ((r - r1)^3) * Real.log B := by ++ ++ convert h_BC using 1 ++ ++ ring ++ ++ exact le_trans hineq (add_le_add hLf hsum) ++ ++lemma final_ineq1 ++ (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) ++ (hR1_lt_R : R1 < R) (hR : R < 1) ++ (f : ℂ → ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ f z) ++ (h_f_zero : f 0 = 1) ++ (h_finite_zeros : (zerosetKfR R1 (by linarith) f).Finite) ++ (h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) f, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, f z = (z - σ) ^ (analyticOrderAt f σ).toNat * h_σ σ z) ++ (h_f_bounded : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖f z‖ ≤ B) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) r1 \ zerosetKfR R1 (by linarith) f, ++ ‖(deriv f z / f z) - ∑ ρ ∈ h_finite_zeros.toFinset, ++ (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ ++ (16 * r^2 / ((r - r1)^3) + ++ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log B := by ++ intro z hz ++ ++ have h_bound : ‖(deriv f z / f z) - ∑ ρ ∈ h_finite_zeros.toFinset, (analyticOrderAt f ρ).toNat / (z - ρ)‖ ≤ ++ 16 * r^2 / ((r - r1)^3) * Real.log B + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) * Real.log B := by ++ apply final_inequality <;> assumption ++ ++ rw [← add_mul] at h_bound ++ exact h_bound ++ ++end Erdos970 +diff --git a/StrongPNT/Erdos970/PNT3_RiemannZeta.lean b/StrongPNT/Erdos970/PNT3_RiemannZeta.lean +new file mode 100644 +index 0000000..0ab91b1 +--- /dev/null ++++ b/StrongPNT/Erdos970/PNT3_RiemannZeta.lean +@@ -0,0 +1,4546 @@ ++import StrongPNT.Erdos970.PNT2_LogDerivative ++ ++namespace Erdos970 ++ ++ ++open scoped BigOperators Topology ++abbrev ℙ := Nat.Primes ++ ++lemma p_s_abs_1 (p : ℙ) (s : ℂ) (hs : 1 < s.re) : norm (((p : ℕ) : ℂ) ^ (-s : ℂ)) < 1 := by ++ ++ have hx1 : 1 < ((p : ℕ) : ℝ) := by ++ have h2 : (2 : ℝ) ≤ ((p : ℕ) : ℝ) := by ++ exact_mod_cast (p.2.two_le : 2 ≤ (p : ℕ)) ++ exact lt_of_lt_of_le one_lt_two h2 ++ have hx0 : 0 < ((p : ℕ) : ℝ) := lt_trans zero_lt_one hx1 ++ ++ have hnorm_eq : ‖(((p : ℕ) : ℂ) ^ (-s : ℂ))‖ = ((p : ℕ) : ℝ) ^ ((-s : ℂ).re) := by ++ simpa using (Complex.norm_cpow_eq_rpow_re_of_pos hx0 (-s : ℂ)) ++ ++ have hz : ((-s : ℂ).re) < 0 := by ++ have h0 : 0 < s.re := lt_trans zero_lt_one hs ++ have : -s.re < 0 := neg_lt_zero.mpr h0 ++ simpa using this ++ ++ have hlt : ((p : ℕ) : ℝ) ^ ((-s : ℂ).re) < 1 := ++ Real.rpow_lt_one_of_one_lt_of_neg hx1 hz ++ ++ have : ‖(((p : ℕ) : ℂ) ^ (-s : ℂ))‖ < 1 := by simpa [hnorm_eq] using hlt ++ simpa [norm] using this ++ ++lemma zetaEulerprod (s : ℂ) (hs : 1 < s.re) : Multipliable (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) ∧ riemannZeta s = ∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹ := by ++ have hprod : HasProd (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) (riemannZeta s) := by ++ simpa using (riemannZeta_eulerProduct_hasProd (s := s) hs) ++ refine And.intro ?_ ?_ ++ · exact hprod.multipliable ++ · simpa using (hprod.tprod_eq.symm) ++ ++lemma abs_of_tprod {P : Type*} (w : P → ℂ) (hw : Multipliable w) : norm (∏' p : P, w p) = ∏' p : P, norm (w p) := by exact Multipliable.norm_tprod hw ++ ++lemma abs_P_prod (s : ℂ) (hs : 1 < s.re) : norm (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) = ∏' p : ℙ, norm ((1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by ++ have hw : Multipliable (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := (zetaEulerprod s hs).1 ++ simpa using abs_of_tprod (fun p : ℙ => (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) hw ++ ++lemma abs_zeta_prod (s : ℂ) (hs : 1 < s.re) : norm (riemannZeta s) = ∏' p : ℙ, norm ((1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by ++ rw [zetaEulerprod s hs |>.2, abs_P_prod s hs] ++ ++lemma abs_of_inv (z : ℂ) (_hz : z ≠ 0) : norm (z⁻¹) = (norm z)⁻¹ := norm_inv z ++ ++lemma one_minus_p_s_neq_0 (p : ℙ) (s : ℂ) (hs : 1 < s.re) : 1 - ((p : ℕ) : ℂ) ^ (-s : ℂ) ≠ 0 := by ++ intro h ++ have hz : ((p : ℕ) : ℂ) ^ (-s : ℂ) = 1 := by ++ simpa using (sub_eq_zero.mp h).symm ++ have : (1 : ℝ) < 1 := by ++ simpa [hz] using (p_s_abs_1 p s hs) ++ exact (lt_irrefl (1 : ℝ)) this ++ ++lemma abs_zeta_prod_prime (s : ℂ) (hs : 1 < s.re) : ++ norm (riemannZeta s) = ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ)))⁻¹ := by ++ rw [abs_zeta_prod s hs] ++ congr 1 ++ ext p ++ rw [abs_of_inv (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ)) (one_minus_p_s_neq_0 p s hs)] ++ ++lemma Re2s (s : ℂ) : (2 * s).re = 2 * s.re := by simp ++ ++lemma Re2sge1 (s : ℂ) (hs : 1 < s.re) : 1 < (2 * s).re := by ++ rw [Re2s] ++ linarith ++ ++lemma zeta_ratio_prod (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-(2 * s) : ℂ))⁻¹) / (∏' p : ℙ, (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by ++ have h2 := (zetaEulerprod (2 * s) (Re2sge1 s hs)).2 ++ have h1 := (zetaEulerprod s hs).2 ++ simp [h2, h1] ++ ++local notation "ι" => fun (z : ℂˣ) ↦ (z : ℂ) ++ ++theorem tprod_commutes_with_inclusion_infinite {α : Type*} (f : α → ℂˣ) (h : Multipliable f) : ++ ι (tprod f) = tprod (fun i ↦ ι (f i)) := ++by ++ change ((tprod f : ℂˣ) : ℂ) = tprod (fun i ↦ ((f i : ℂˣ) : ℂ)) ++ have hcont : Continuous (Units.coeHom ℂ) := by ++ simpa using! (Units.continuous_val : Continuous (fun u : ℂˣ => ((u : ℂˣ) : ℂ))) ++ simpa [Units.coeHom] using ++ (Multipliable.map_tprod (f := f) (γ := ℂ) h (g := Units.coeHom ℂ) hcont) ++ ++theorem inclusion_commutes_with_division (a b : ℂˣ) : ++ ι (a / b) = ι a / ι b := by ++ exact Units.val_div_eq_div_val a b ++ ++lemma lift_multipliable_of_nonzero {P : Type*} (a : P → ℂ) (ha : Multipliable a) (h_a_nonzero : ∀ p, a p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0): ++ Multipliable (fun p ↦ Units.mk0 (a p) (h_a_nonzero p)) := by ++ ++ obtain ⟨A, hA⟩ := ha ++ have hA_nonzero := hA_nonzero' A hA ++ refine ⟨Units.mk0 A hA_nonzero, ?_⟩ ++ simp [HasProd, tendsto_nhds] at hA ⊢ ++ intro sU h_sU_open hA_mem ++ have hA_im_mem : ι (Units.mk0 A hA_nonzero) ∈ ι '' sU := Set.mem_image_of_mem ι hA_mem ++ have sU_im_open : IsOpen (ι '' sU) := by ++ apply (Topology.IsOpenEmbedding.isOpen_iff_image_isOpen ?_).mp ++ assumption ++ exact Units.isOpenEmbedding_val ++ have := hA (ι '' sU) sU_im_open hA_im_mem ++ obtain ⟨a1, ha⟩ := this ++ use a1 ++ intro b ha1 ++ obtain ⟨x', x'_spec_mem, x'_spec_eq⟩ := ha b ha1 ++ suffices x' = ∏ b ∈ b, Units.mk0 (a b) (by simp [*]) by ++ rwa [← this] ++ have : Units.mk0 (ι x') (Units.ne_zero x') = x' := ++ Units.mk0_val x' (Units.ne_zero x') ++ have this2 : (Units.mk0 (∏ b ∈ b, a b) ++ (Finset.prod_ne_zero_iff.mpr fun a a_1 => h_a_nonzero a)) = x' := ++ Units.ext (id (Eq.symm x'_spec_eq)) ++ rw [Units.mk0_prod] at this2 ++ rw [←this2] ++ conv => ++ rhs ++ rw [← Finset.prod_attach] ++ ++lemma prod_of_ratios_simplified {P : Type*} (a b : P → ℂ) ++(ha : Multipliable a) (hb : Multipliable b) ++ (h_a_nonzero : ∀ p, a p ≠ 0) (h_b_nonzero : ∀ p, b p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0) (hB_nonzero' : ∀ A, HasProd b A → A ≠ 0): ++ (∏' p : P, a p) / (∏' p : P, b p) = ∏' p : P, (a p / b p) := by ++ ++ let a' : P → ℂˣ := fun p ↦ Units.mk0 (a p) (h_a_nonzero p) ++ let b' : P → ℂˣ := fun p ↦ Units.mk0 (b p) (h_b_nonzero p) ++ ++ have h_multipliable_a' : Multipliable a' := lift_multipliable_of_nonzero a ha h_a_nonzero hA_nonzero' ++ have h_multipliable_b' : Multipliable b' := lift_multipliable_of_nonzero b hb h_b_nonzero hB_nonzero' ++ have h_multipliable_a'_div_b' : Multipliable (fun p ↦ a' p / b' p) := Multipliable.div h_multipliable_a' h_multipliable_b' ++ ++ calc ++ (∏' p, a p) / (∏' p, b p) ++ ++ _ = (∏' p, ι (a' p)) / (∏' p, ι (b' p)) := by simp [a', b'] ++ ++ _ = ι (∏' p, a' p) / ι (∏' p, b' p) := by simp [tprod_commutes_with_inclusion_infinite, *] ++ ++ _ = ι ((∏' p, a' p) / (∏' p, b' p)) := by rw [← inclusion_commutes_with_division] ++ ++ _ = ι (∏' p, a' p / b' p) := by simp [Multipliable.tprod_div, *] ++ ++ _ = ∏' p, ι (a' p / b' p) := by simp [tprod_commutes_with_inclusion_infinite, *] ++ ++ _ = ∏' p, (ι (a' p) / ι (b' p)) := by simp ++ ++ _ = ∏' p, a p / b p := by simp [a', b'] ++ ++lemma prod_of_ratios {P : Type*} (a b : P → ℂ) (ha : Multipliable a) (hb : Multipliable b) (h_b_nonzero : ∀ p, b p ≠ 0) (hA_nonzero' : ∀ A, HasProd a A → A ≠ 0) (hB_nonzero' : ∀ B, HasProd b B → B ≠ 0): ++ (∏' p : P, a p) / (∏' p : P, b p) = ∏' p : P, (a p / b p) := by ++ ++ by_cases h_a_zero : ∃ p, a p = 0 ++ case pos => ++ ++ have lhs_zero : ∏' p : P, a p = 0 := by ++ ++ exact tprod_of_exists_eq_zero h_a_zero ++ have rhs_zero : ∏' p : P, (a p / b p) = 0 := by ++ ++ obtain ⟨p₀, hp₀⟩ := h_a_zero ++ have h_div_zero : ∃ p, (a p / b p) = 0 := by ++ use p₀ ++ simp [hp₀] ++ exact tprod_of_exists_eq_zero h_div_zero ++ simp [lhs_zero, rhs_zero] ++ case neg => ++ ++ push Not at h_a_zero ++ ++ exact prod_of_ratios_simplified a b ha hb h_a_zero h_b_nonzero hA_nonzero' hB_nonzero' ++ ++lemma simplify_prod_ratio (s : ℂ) (hs : 1 < s.re) : (∏' p : ℙ, (1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹) / (∏' p : ℙ, (1 - (p : ℂ) ^ (-s : ℂ))⁻¹) = ∏' p : ℙ, ((1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹ / (1 - (p : ℂ) ^ (-s : ℂ))⁻¹) := by ++ ++ let a := fun p : ℙ => (1 - (p : ℂ) ^ (-(2 * s) : ℂ))⁻¹ ++ let b := fun p : ℙ => (1 - (p : ℂ) ^ (-s : ℂ))⁻¹ ++ ++ have ha : Multipliable a := (zetaEulerprod (2 * s) (Re2sge1 s hs)).1 ++ have hb : Multipliable b := (zetaEulerprod s hs).1 ++ ++ have h_b_nonzero : ∀ p, b p ≠ 0 := by ++ intro p ++ exact inv_ne_zero (one_minus_p_s_neq_0 p s hs) ++ ++ exact prod_of_ratios a b ha hb h_b_nonzero (by ++ intro A hA ++ ++ have h_eq : A = riemannZeta (2 * s) := by ++ have h : HasProd a (riemannZeta (2 * s)) := by ++ simpa [a] using riemannZeta_eulerProduct_hasProd (s := 2 * s) (by simp; linarith) ++ exact HasProd.unique hA h ++ rw [h_eq] ++ exact riemannZeta_ne_zero_of_one_lt_re (by simp; linarith) ++ ) (by ++ intro B hB ++ ++ have h_eq : B = riemannZeta s := by ++ have h : HasProd b (riemannZeta s) := by ++ simpa [b] using riemannZeta_eulerProduct_hasProd (s := s) hs ++ exact HasProd.unique hB h ++ rw [h_eq] ++ exact riemannZeta_ne_zero_of_one_lt_re hs ++ ) ++ ++lemma zeta_ratios (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = ∏' p : ℙ, ((1 - ((p : ℕ) : ℂ) ^ (-(2 * s) : ℂ))⁻¹ / (1 - ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹) := by ++ have h1 := zeta_ratio_prod s hs ++ have h2 := simplify_prod_ratio s hs ++ exact h1.trans h2 ++ ++lemma diff_of_squares (z : ℂ) : 1 - z^2 = (1 - z) * (1 + z) := by ring ++ ++lemma one_sub_ne_zero_of_abs_lt_one (z : ℂ) (hz : norm z < 1) : 1 - z ≠ 0 := by ++ intro h ++ have h1 : 1 = z := by ++ have := congrArg (fun w : ℂ => w + z) h ++ simpa [sub_add_cancel, zero_add] using this ++ have habs1lt : norm (1 : ℂ) < 1 := by simpa [h1] using hz ++ have hnorm1lt : ‖(1 : ℂ)‖ < 1 := by simp [norm] at habs1lt ++ have : (1 : ℝ) < 1 := by simp [norm_one] at hnorm1lt ++ exact (lt_irrefl _) this ++ ++lemma one_add_ne_zero_of_abs_lt_one (z : ℂ) (hz : norm z < 1) : 1 + z ≠ 0 := by ++ have hz' : norm (-z) < 1 := by ++ simpa [norm, norm_neg] using hz ++ simpa [sub_eq_add_neg] using one_sub_ne_zero_of_abs_lt_one (-z) hz' ++ ++lemma inv_mul_div_cancel_right_of_ne_zero (a b : ℂ) (ha : a ≠ 0) : ((a * b)⁻¹) / a⁻¹ = b⁻¹ := by ++ simp [div_eq_mul_inv, inv_inv, mul_inv_rev, mul_comm, ha] ++ ++lemma ratio_invs (z : ℂ) (hz : norm z < 1) : (1 - z^2)⁻¹ / (1 - z)⁻¹ = (1 + z)⁻¹ := by ++ have hz1 : 1 - z ≠ 0 := one_sub_ne_zero_of_abs_lt_one z hz ++ simpa [diff_of_squares z] using ++ inv_mul_div_cancel_right_of_ne_zero (1 - z) (1 + z) hz1 ++ ++lemma complex_cpow_neg_two_mul (z w : ℂ) (_hz : z ≠ 0) : z^(-(2*w)) = (z^(-w))^2 := by ++ have h1 : -(2*w) = 2*(-w) := by ring ++ rw [h1] ++ have h2 : (2 : ℂ)*(-w) = ((2 : ℕ) : ℂ)*(-w) := by norm_cast ++ rw [h2, Complex.cpow_nat_mul] ++ ++theorem zeta_ratio_identity (s : ℂ) (hs : 1 < s.re) : riemannZeta (2 * s) / riemannZeta s = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-s : ℂ))⁻¹ := by ++ rw [zeta_ratios s hs]; congr 1; ext p ++ have hp : ((p : ℕ) : ℂ) ≠ 0 := by rw [ne_eq, Nat.cast_eq_zero]; exact Nat.Prime.ne_zero p.2 ++ have h1 : ((p : ℕ) : ℂ) ^ (-(2 * s)) = (((p : ℕ) : ℂ) ^ (-s))^2 := complex_cpow_neg_two_mul ((p : ℕ) : ℂ) s hp ++ have h2 : norm (((p : ℕ) : ℂ) ^ (-s)) < 1 := p_s_abs_1 p s hs ++ rw [h1]; exact ratio_invs (((p : ℕ) : ℂ) ^ (-s)) h2 ++ ++lemma two_mul_ofReal_div_two (r : ℝ) : (2 : ℂ) * ((r : ℝ) / 2 : ℂ) = (r : ℂ) := by ++ have hreal : (2 : ℝ) * (r / 2) = r := by ++ calc ++ (2 : ℝ) * (r / 2) = (2 : ℝ) * r / 2 := by ++ have h : (2 : ℝ) * r / 2 = (2 : ℝ) * (r / 2) := by ++ simpa using (mul_div_assoc (2 : ℝ) r (2 : ℝ)) ++ simpa using h.symm ++ _ = r := by ++ simp ++ calc ++ (2 : ℂ) * ((r : ℝ) / 2 : ℂ) ++ = ((2 * (r / 2) : ℝ) : ℂ) := by ++ simp ++ _ = (r : ℂ) := by simp [hreal] ++ ++lemma zeta_ratio_identity_ofReal_div_two (r : ℝ) (hr : 1 < ( ((r : ℝ) / 2 : ℂ) ).re) : riemannZeta (r : ℂ) / riemannZeta ((r / 2 : ℝ) : ℂ) = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-(((r : ℝ) / 2) : ℂ)))⁻¹ := by ++ have h := zeta_ratio_identity (((r : ℝ) / 2 : ℂ)) hr ++ simpa [two_mul_ofReal_div_two r] using h ++ ++lemma zeta_ratio_at_3_2 : riemannZeta 3 / riemannZeta ((3 : ℝ) / 2) = ∏' p : ℙ, (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ := by ++ have hr : 1 < (((3 : ℝ) / 2 : ℂ)).re := by ++ simpa using (by norm_num : (1 : ℝ) < (3 : ℝ) / 2) ++ simpa using zeta_ratio_identity_ofReal_div_two (3 : ℝ) hr ++ ++lemma triangle_inequality_specific (z : ℂ) : norm (1 - z) ≤ 1 + norm z := by ++ simpa [sub_eq_add_neg, norm_one, norm_neg] using (norm_add_le (1 : ℂ) (-z)) ++ ++lemma re_neg_eq_neg_re (s : ℂ) : (-s).re = - s.re := by ++ simp ++ ++lemma abs_cpow_eq_rpow_re_of_pos {x : ℝ} (hx : 0 < x) (y : ℂ) : norm ((x : ℂ) ^ y) = x ^ y.re := by ++ simpa using Complex.norm_cpow_eq_rpow_re_of_pos hx y ++ ++lemma abs_p_pow_s (p : ℙ) (s : ℂ) : norm (((p : ℕ) : ℂ) ^ (-s : ℂ)) = ((p : ℕ) : ℝ) ^ (-s.re : ℝ) := by ++ have hx : 0 < ((p : ℕ) : ℝ) := by ++ exact_mod_cast (p.property.pos : 0 < (p : ℕ)) ++ simpa [Complex.ofReal_natCast, re_neg_eq_neg_re] using ++ (abs_cpow_eq_rpow_re_of_pos hx (-s)) ++ ++lemma abs_term_bound (p : ℙ) (t : ℝ) : ++ norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) ≤ 1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by ++ ++ have h1 := triangle_inequality_specific (((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) ++ ++ have h2 := abs_p_pow_s p (((3 : ℝ) / 2) + t * Complex.I) ++ ++ have h3 : (((3 : ℝ) / 2) + t * Complex.I).re = ((3 : ℝ) / 2) := by simp [Complex.add_re, Complex.ofReal_re] ++ ++ have h4 : -(((3 : ℝ) / 2) + t * Complex.I).re = -((3 : ℝ) / 2) := by rw [h3] ++ ++ have h5 : norm (((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))) = ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by ++ rw [h2, h4] ++ ++ rw [h5] at h1 ++ exact h1 ++ ++lemma inv_inequality {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) : b⁻¹ ≤ a⁻¹ := by ++ simpa [one_div] using (one_div_le_one_div_of_le ha hab) ++ ++lemma eq_of_one_sub_eq_zero (z : ℂ) (h : 1 - z = 0) : z = 1 := by ++ rw [sub_eq_zero] at h ++ exact h.symm ++ ++lemma condp32 (p : ℙ) (t : ℝ) : 1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) ≠ 0 := by ++ intro h ++ have hp_eq_one : ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) = 1 := eq_of_one_sub_eq_zero _ h ++ let s := ((3 : ℝ) / 2) + t * Complex.I ++ have hs : 1 < s.re := by ++ simp only [s, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im, mul_zero] ++ norm_num ++ have h_abs_lt : norm (((p : ℕ) : ℂ) ^ (-s)) < 1 := p_s_abs_1 p s hs ++ have h_s_eq : ((p : ℕ) : ℂ) ^ (-s) = ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I)) := by simp only [s] ++ rw [h_s_eq, hp_eq_one] at h_abs_lt ++ have : norm (1 : ℂ) = 1 := by simp [norm] ++ rw [this] at h_abs_lt ++ exact lt_irrefl 1 h_abs_lt ++ ++lemma abs_term_inv_bound (p : ℙ) (t : ℝ) : (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ ≤ (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by ++ have h1 := abs_term_bound p t ++ have h2 := condp32 p t ++ have h3 := lem_abspos _ h2 ++ exact inv_inequality h3 h1 ++ ++open NNReal in ++lemma prod_inequality {P : Type*} (a b : P → ℝ≥0) (ha : Multipliable a) (hb : Multipliable b) ++ (hab : ∀ p : P, a p ≤ b p) : ++ ∏' p : P, a p ≤ ∏' p : P, b p := by ++ exact Multipliable.tprod_le_tprod hab ha hb ++ ++lemma multipliable_complex_abs_inv {i : Type*} (g : i → ℂ) (h_mult : Multipliable (fun i => (1 - g i)⁻¹)) (_h_nonzero : ∀ i, 1 - g i ≠ 0) : Multipliable (fun i => (norm (1 - g i))⁻¹) := by ++ ++ have h_eq : (fun i => (norm (1 - g i))⁻¹) = (fun i => ‖1 - g i‖⁻¹) := by ++ ext i ++ simp ++ rw [h_eq] ++ ++ have h_norm_mult : Multipliable (fun i => ‖(1 - g i)⁻¹‖) := Multipliable.norm h_mult ++ have h_norm_eq : (fun i => ‖(1 - g i)⁻¹‖) = (fun i => ‖1 - g i‖⁻¹) := by ++ ext i ++ rw [norm_inv] ++ rwa [← h_norm_eq] ++ ++lemma multipliable_positive_inv_powers (r : ℝ) (hr : 1 < r) : Multipliable (fun p : ℙ => (1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹) := by ++ ++ have h_sum : Summable (fun p : ℙ => ((p : ℕ) : ℝ) ^ (-r)) := by ++ rw [Nat.Primes.summable_rpow] ++ linarith ++ ++ have h_log_sum : Summable (fun p : ℙ => Real.log (1 + ((p : ℕ) : ℝ) ^ (-r))) := by ++ exact Real.summable_log_one_add_of_summable h_sum ++ ++ have h_log_inv_sum : Summable (fun p : ℙ => Real.log ((1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹)) := by ++ have h_eq : (fun p : ℙ => Real.log ((1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹)) = ++ (fun p : ℙ => -(Real.log (1 + ((p : ℕ) : ℝ) ^ (-r)))) := by ++ ext p ++ rw [Real.log_inv] ++ rw [h_eq] ++ exact Summable.neg h_log_sum ++ ++ have h_pos : ∀ p : ℙ, 0 < (1 + ((p : ℕ) : ℝ) ^ (-r))⁻¹ := by ++ intro p ++ apply inv_pos.mpr ++ have h_ge : 0 ≤ ((p : ℕ) : ℝ) ^ (-r) := Real.rpow_nonneg (Nat.cast_nonneg _) _ ++ linarith ++ ++ exact Real.multipliable_of_summable_log h_pos h_log_inv_sum ++ ++lemma hasProd_map_nnreal_coe {i : Type*} (f : i → NNReal) (a : NNReal) (h : HasProd f a) : HasProd (fun i => (f i : ℝ)) ((a : NNReal) : ℝ) := by ++ have hcont : Continuous (⇑NNReal.toRealHom) := by ++ rw [NNReal.coe_toRealHom] ++ exact NNReal.continuous_coe ++ exact HasProd.map h NNReal.toRealHom hcont ++ ++lemma multipliable_nnreal_coe {i : Type*} (f : i → NNReal) (hf : Multipliable f) : Multipliable (fun i => (f i : ℝ)) := by ++ ++ obtain ⟨a, ha⟩ := hf ++ ++ have h_coe := hasProd_map_nnreal_coe f a ha ++ ++ exact ⟨(a : ℝ), h_coe⟩ ++ ++lemma nnreal_coe_tprod_eq {i : Type*} (f : i → NNReal) (_hf : Multipliable f) : (∏' i : i, f i : ℝ) = ∏' i : i, (f i : ℝ) := by ++ rfl ++ ++lemma hasProd_nonneg_of_pos {i : Type*} (f : i → ℝ) (hpos : ∀ i, 0 < f i) (a : ℝ) (ha : HasProd f a) : 0 ≤ a := by ++ ++ have h_pos : ∀ s : Finset i, 0 < ∏ i ∈ s, f i := fun s => Finset.prod_pos (fun i _ => hpos i) ++ ++ have h_nonneg : ∀ s : Finset i, 0 ≤ ∏ i ∈ s, f i := fun s => le_of_lt (h_pos s) ++ ++ exact ge_of_tendsto ha (Filter.Eventually.of_forall h_nonneg) ++ ++lemma tendsto_finprod_coe_iff_tendsto_coe_finprod {i : Type*} (f : i → NNReal) (a : NNReal) : ++ Filter.Tendsto (fun s => ∏ i ∈ s, (f i : ℝ)) Filter.atTop (𝓝 (a : ℝ)) ↔ ++ Filter.Tendsto ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) Filter.atTop (𝓝 (a : ℝ)) := by ++ ++ have h_comp : ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) = (fun s => ↑(∏ i ∈ s, f i)) := by ++ rfl ++ ++ have h_eq : (fun s => ∏ i ∈ s, (f i : ℝ)) = (fun s => ↑(∏ i ∈ s, f i)) := by ++ ext s ++ exact (NNReal.coe_prod s f).symm ++ ++ rw [h_comp, ← h_eq] ++ ++lemma pnt_nnreal_isEmbedding_coe : Topology.IsEmbedding (fun x : NNReal => (x : ℝ)) := by ++ refine ⟨?_, NNReal.coe_injective⟩ ++ ++ exact Topology.IsInducing.subtypeVal ++ ++lemma HasProd.of_coe_hasProd {i : Type*} (f : i → NNReal) (a : NNReal) (h : HasProd (fun i => (f i : ℝ)) (a : ℝ)) : HasProd f a := by ++ ++ have h_comp : Filter.Tendsto ((fun x : NNReal => (x : ℝ)) ∘ (fun s => ∏ i ∈ s, f i)) Filter.atTop (𝓝 (a : ℝ)) := by ++ rw [← tendsto_finprod_coe_iff_tendsto_coe_finprod] ++ exact h ++ ++ have h_embed : Topology.IsEmbedding (fun x : NNReal => (x : ℝ)) := pnt_nnreal_isEmbedding_coe ++ ++ exact h_embed.tendsto_nhds_iff.mpr h_comp ++ ++lemma hasProd_nnreal_of_coe {i : Type*} (g : i → NNReal) (b : NNReal) (h : HasProd (fun i => (g i : ℝ)) (b : ℝ)) : HasProd g b := by ++ exact HasProd.of_coe_hasProd g b h ++ ++lemma multipliable_real_to_nnreal {i : Type*} (f : i → ℝ) (hpos : ∀ i, 0 < f i) (h_mult : Multipliable f) : Multipliable (fun i => ⟨f i, le_of_lt (hpos i)⟩ : i → NNReal) := by ++ ++ obtain ⟨a, ha⟩ := h_mult ++ ++ have ha_nonneg : 0 ≤ a := hasProd_nonneg_of_pos f hpos a ha ++ ++ let a_nnreal : NNReal := ⟨a, ha_nonneg⟩ ++ ++ have h_coe_eq : (fun i => ((⟨f i, le_of_lt (hpos i)⟩ : NNReal) : ℝ)) = f := by ++ ext i ++ rfl ++ ++ have ha_coe : HasProd (fun i => ((⟨f i, le_of_lt (hpos i)⟩ : NNReal) : ℝ)) (a_nnreal : ℝ) := by ++ rw [h_coe_eq] ++ simp only [a_nnreal] ++ exact ha ++ ++ have ha_nnreal : HasProd (fun i => ⟨f i, le_of_lt (hpos i)⟩) a_nnreal := ++ hasProd_nnreal_of_coe (fun i => ⟨f i, le_of_lt (hpos i)⟩) a_nnreal ha_coe ++ ++ exact ⟨a_nnreal, ha_nnreal⟩ ++ ++lemma nnreal_coe_tprod_eq_tprod_coe {i : Type*} (f : i → NNReal) (hf : Multipliable f) : ++ ∏' i, (↑(f i) : ℝ) = ↑(∏' i, f i) := by ++ ++ have h_prod : HasProd f (∏' i, f i) := Multipliable.hasProd hf ++ ++ have h_map : HasProd (NNReal.toRealHom ∘ f) (NNReal.toRealHom (∏' i, f i)) := ++ HasProd.map h_prod NNReal.toRealHom NNReal.continuous_coe ++ ++ have h_comp : NNReal.toRealHom ∘ f = fun i => (↑(f i) : ℝ) := by ++ ext i ++ rfl ++ have h_val : NNReal.toRealHom (∏' i, f i) = ↑(∏' i, f i) := rfl ++ ++ rw [h_comp, h_val] at h_map ++ ++ exact HasProd.tprod_eq h_map ++ ++lemma nnreal_tprod_le_coe {i : Type*} (f g : i → NNReal) (hf : Multipliable f) (hg : Multipliable g) (h : ∏' i, f i ≤ ∏' i, g i) : ∏' i, (f i : ℝ) ≤ ∏' i, (g i : ℝ) := by ++ ++ rw [nnreal_coe_tprod_eq_tprod_coe f hf, nnreal_coe_tprod_eq_tprod_coe g hg] ++ ++ exact NNReal.coe_le_coe.mpr h ++ ++lemma abs_zeta_inequality (t : ℝ) : ++ ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ ≤ ++ ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by ++ ++ have h_pos_left : ∀ p : ℙ, 0 < (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by ++ intro p ++ apply inv_pos.mpr ++ apply add_pos zero_lt_one ++ ++ apply Real.rpow_pos_of_pos ++ exact_mod_cast (p.property.pos : 0 < (p : ℕ)) ++ ++ have h_pos_right : ∀ p : ℙ, 0 < (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by ++ intro p ++ apply inv_pos.mpr ++ ++ rw [norm_pos_iff] ++ exact condp32 p t ++ ++ have h_mult_left : Multipliable (fun p : ℙ => (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹) := ++ multipliable_positive_inv_powers ((3 : ℝ) / 2) (by norm_num : 1 < (3 : ℝ) / 2) ++ ++ have h_mult_right : Multipliable (fun p : ℙ => (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹) := by ++ let s := ((3 : ℝ) / 2) + t * Complex.I ++ have hs : 1 < s.re := by ++ simp only [s, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, mul_zero] ++ norm_num ++ ++ have h_euler := (zetaEulerprod s hs).1 ++ have h_nonzero : ∀ p : ℙ, 1 - ((p : ℕ) : ℂ) ^ (-s) ≠ 0 := fun p => condp32 p t ++ exact multipliable_complex_abs_inv (fun p : ℙ => ((p : ℕ) : ℂ) ^ (-s)) h_euler h_nonzero ++ ++ let f : ℙ → NNReal := fun p => ⟨(1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹, le_of_lt (h_pos_left p)⟩ ++ let g : ℙ → NNReal := fun p => ⟨(norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹, le_of_lt (h_pos_right p)⟩ ++ ++ have hf : Multipliable f := multipliable_real_to_nnreal _ h_pos_left h_mult_left ++ have hg : Multipliable g := multipliable_real_to_nnreal _ h_pos_right h_mult_right ++ ++ have h_pointwise : ∀ p : ℙ, f p ≤ g p := by ++ intro p ++ simp only [f, g] ++ exact abs_term_inv_bound p t ++ ++ have h_nnreal_ineq : ∏' p, f p ≤ ∏' p, g p := prod_inequality f g hf hg h_pointwise ++ ++ have h_convert : ∏' p, (f p : ℝ) ≤ ∏' p, (g p : ℝ) := nnreal_tprod_le_coe f g hf hg h_nnreal_ineq ++ ++ have h_eq_f : ∏' p, (f p : ℝ) = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by ++ rfl ++ ++ have h_eq_g : ∏' p, (g p : ℝ) = ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := by ++ rfl ++ ++ rw [h_eq_f, h_eq_g] at h_convert ++ exact h_convert ++ ++lemma abs_zeta_ratio_eval : norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := by ++ ++ have hratio := zeta_ratio_at_3_2 ++ ++ let w : ℙ → ℂ := fun p => (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ ++ let u : ℙ → ℝ := fun p => (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ ++ ++ have hu_mult : Multipliable u := ++ multipliable_positive_inv_powers ((3 : ℝ) / 2) (by norm_num : 1 < (3 : ℝ) / 2) ++ ++ have hw_eq : w = fun p : ℙ => (u p : ℂ) := by ++ funext p ++ ++ have hx : 0 ≤ ((p : ℕ) : ℝ) := by exact_mod_cast (Nat.zero_le (p : ℕ)) ++ have hcpow : (((((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2))) : ℝ) : ℂ) ++ = ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)) := by ++ simpa using (Complex.ofReal_cpow (x := ((p : ℕ) : ℝ)) (hx := hx) (y := -((3 : ℝ) / 2))) ++ calc ++ w p = (1 + ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) : ℂ)))⁻¹ := rfl ++ _ = (1 + (((((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2))) : ℝ) : ℂ))⁻¹ := by ++ simp [hcpow] ++ _ = (((1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ : ℝ) : ℂ) := by ++ simp [Complex.ofReal_add, Complex.ofReal_inv, Complex.ofReal_one] ++ ++ have hw_mult : Multipliable w := by ++ have hmap : Multipliable ((fun x : ℝ => (x : ℂ)) ∘ u) := ++ Multipliable.map (hf := hu_mult) Complex.ofRealHom Complex.continuous_ofReal ++ simpa [hw_eq] using! hmap ++ ++ have h_abs_tprod : norm (∏' p : ℙ, w p) = ∏' p : ℙ, norm (w p) := ++ abs_of_tprod w hw_mult ++ ++ have h_abs_eq_fun : (fun p : ℙ => norm (w p)) = u := by ++ funext p ++ ++ have hge : 0 ≤ ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := ++ Real.rpow_nonneg (by exact_mod_cast (Nat.zero_le (p : ℕ))) _ ++ have hpos : 0 < 1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)) := by linarith ++ have hnonneg : 0 ≤ u p := by ++ have : 0 < (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := inv_pos.mpr hpos ++ exact this.le ++ ++ simp [hw_eq, Complex.norm_real, abs_of_nonneg hnonneg] ++ ++ have h_abs_ratio : norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) ++ = norm (∏' p : ℙ, w p) := by ++ simpa [w] using congrArg norm hratio ++ calc ++ norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) ++ = norm (∏' p : ℙ, w p) := h_abs_ratio ++ _ = ∏' p : ℙ, norm (w p) := h_abs_tprod ++ _ = ∏' p : ℙ, u p := by simp [h_abs_eq_fun] ++ _ = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := rfl ++ ++theorem zeta_lower_bound (t : ℝ) : ++ norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) ≤ ++ norm (riemannZeta (((3 : ℝ) / 2) + t * Complex.I)) := by ++ have hs : 1 < (((3 : ℝ) / 2 : ℂ) + t * Complex.I).re := by ++ simp only [Complex.add_re, Complex.mul_I_re] ++ norm_num ++ calc ++ norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) ++ = ∏' p : ℙ, (1 + ((p : ℕ) : ℝ) ^ (-((3 : ℝ) / 2)))⁻¹ := abs_zeta_ratio_eval ++ _ ≤ ∏' p : ℙ, (norm (1 - ((p : ℕ) : ℂ) ^ (-(((3 : ℝ) / 2) + t * Complex.I))))⁻¹ := ++ abs_zeta_inequality t ++ _ = norm (riemannZeta (((3 : ℝ) / 2 : ℂ) + t * Complex.I)) := by ++ simpa using (abs_zeta_prod_prime (((3 : ℝ) / 2 : ℂ) + t * Complex.I) hs).symm ++ ++lemma summable_one_div_nat_add_rpow' {x : ℝ} (hx : 1 < x) : Summable (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x)) := by ++ have h := (Real.summable_one_div_nat_add_rpow (1 : ℝ) x).2 hx ++ have h' : Summable (fun n : ℕ => (|((n : ℝ) + 1)| ^ x)⁻¹) := by ++ simpa [one_div] using h ++ have h2 : (fun n : ℕ => (|((n : ℝ) + 1)| ^ x)⁻¹) = (fun n : ℕ => (((n : ℝ) + 1) ^ x)⁻¹) := by ++ funext n ++ have hn : 0 ≤ (n : ℝ) + 1 := by ++ have : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) ++ exact add_nonneg this (show 0 ≤ (1 : ℝ) from zero_le_one) ++ simp [abs_of_nonneg hn] ++ have h'' : Summable (fun n : ℕ => (((n : ℝ) + 1) ^ x)⁻¹) := by ++ simpa [h2] using h' ++ have h''' : Summable (fun n : ℕ => ((n + 1 : ℝ) ^ x)⁻¹) := by ++ simpa [Nat.cast_add] using h'' ++ simpa [one_div] using h''' ++ ++lemma tsum_pos_of_pos_first_term {f : ℕ → ℝ} (hf : Summable f) (h0 : 0 < f 0) (hnonneg : ∀ n, 0 ≤ f n) : 0 < ∑' n, f n := by ++ have hsum0 : ∑ n ∈ Finset.range 1, f n = f 0 := by ++ simp ++ have hpos_partial : 0 < ∑ n ∈ Finset.range 1, f n := by ++ simpa [hsum0] using h0 ++ have hsumle : ∑ n ∈ Finset.range 1, f n ≤ ∑' n, f n := by ++ have hnonneg' : ∀ n ∉ Finset.range 1, 0 ≤ f n := by ++ intro n hn ++ exact hnonneg n ++ simpa using (hf.sum_le_tsum (s := Finset.range 1) hnonneg') ++ exact lt_of_lt_of_le hpos_partial hsumle ++ ++lemma first_term_pos (x : ℝ) : 0 < (1 : ℝ) / ((1 : ℝ) ^ x) := by ++ simp [Real.one_rpow] ++ ++lemma terms_nonneg (x : ℝ) : ∀ n : ℕ, 0 ≤ (1 : ℝ) / ((n + 1 : ℝ) ^ x) := by ++ intro n ++ have hposb' : 0 < ((n : ℝ) + 1) := ++ add_pos_of_nonneg_of_pos (show 0 ≤ (n : ℝ) from by exact_mod_cast (Nat.zero_le n)) zero_lt_one ++ have hposb : 0 < ((n + 1 : ℝ)) := by ++ simpa [Nat.cast_add, Nat.cast_one] using hposb' ++ have hdenpos : 0 < ((n + 1 : ℝ) ^ x) := by ++ simpa using (Real.rpow_pos_of_pos hposb x) ++ have hden_nonneg : 0 ≤ ((n + 1 : ℝ) ^ x) := le_of_lt hdenpos ++ have hnum_nonneg : 0 ≤ (1 : ℝ) := le_of_lt (zero_lt_one : 0 < (1 : ℝ)) ++ exact div_nonneg hnum_nonneg hden_nonneg ++ ++lemma term_eq_ofRealC (x : ℝ) (n : ℕ) : (1 / ((n + 1 : ℂ) ^ (x : ℂ))) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by ++ have hbase_nonneg : 0 ≤ (n + 1 : ℝ) := by ++ have hn : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) ++ have : 0 ≤ (n : ℝ) + 1 := add_nonneg hn (show 0 ≤ (1 : ℝ) from zero_le_one) ++ simpa [Nat.cast_add, Nat.cast_one] using this ++ have hpow' : ((n + 1 : ℂ) ^ (x : ℂ)) = (((n + 1 : ℝ) ^ x : ℝ) : ℂ) := by ++ simpa using (Complex.ofReal_cpow (x := (n + 1 : ℝ)) (hx := hbase_nonneg) (y := x)).symm ++ have hdiv : (1 : ℂ) / (((n + 1 : ℝ) ^ x : ℝ) : ℂ) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by ++ simp ++ calc ++ 1 / ((n + 1 : ℂ) ^ (x : ℂ)) ++ = (1 : ℂ) / (((n + 1 : ℝ) ^ x : ℝ) : ℂ) := by simp [hpow'] ++ _ = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := hdiv ++ ++lemma zeta_eq_ofReal (x : ℝ) (hx : 1 < x) : ++ riemannZeta x = ((∑' n : ℕ, ((1 : ℝ) / ((n + 1 : ℝ) ^ x))) : ℝ) := by ++ ++ have h1 : riemannZeta (x : ℂ) = ∑' n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) := by ++ apply zeta_eq_tsum_one_div_nat_add_one_cpow ++ simpa using hx ++ ++ have h2 : ∀ n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by ++ exact fun n => term_eq_ofRealC x n ++ ++ rw [h1] ++ simp_rw [h2] ++ ++ rw [← Complex.ofReal_tsum] ++ ++lemma term_inv_eq_ofRealC (x : ℝ) (n : ℕ) : ((n + 1 : ℂ) ^ (x : ℂ))⁻¹ = ((1 / ((n + 1 : ℝ) ^ x) : ℝ) : ℂ) := by ++ rw [inv_eq_one_div] ++ simpa using (term_eq_ofRealC x n) ++ ++lemma im_tsum_ofReal (g : ℕ → ℝ) : (∑' n : ℕ, (g n : ℂ)).im = 0 := by ++ have him := congrArg Complex.im (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := g)).symm ++ have hz : (((∑' n : ℕ, g n) : ℝ) : ℂ).im = 0 := by ++ simp ++ exact Eq.trans him hz ++ ++lemma re_tsum_ofReal (g : ℕ → ℝ) : (∑' n : ℕ, (g n : ℂ)).re = ∑' n : ℕ, g n := by ++ have h := congrArg Complex.re (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := g)).symm ++ simpa [Complex.ofReal_re] using h ++ ++lemma zetapos (x : ℝ) (hx : 1 < x) : (riemannZeta x).im = 0 ∧ 0 < (riemannZeta x).re := by ++ have hxC : 1 < (Complex.ofReal x).re := by simpa [Complex.ofReal_re] using hx ++ have hz : riemannZeta (x : ℂ) = ∑' n : ℕ, 1 / (n + 1 : ℂ) ^ (x : ℂ) := ++ zeta_eq_tsum_one_div_nat_add_one_cpow (s := (x : ℂ)) hxC ++ have him : (riemannZeta x).im = 0 := by ++ simpa [hz, term_eq_ofRealC x] using ++ (im_tsum_ofReal (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x))) ++ have hre : (riemannZeta x).re = ∑' n : ℕ, 1 / ((n + 1 : ℝ) ^ x) := by ++ simpa [hz, term_eq_ofRealC x] using ++ (re_tsum_ofReal (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x))) ++ have hsum : Summable (fun n : ℕ => 1 / ((n + 1 : ℝ) ^ x)) := ++ summable_one_div_nat_add_rpow' (x := x) hx ++ have hpos0 : 0 < 1 / ((Nat.cast 0 + 1 : ℝ) ^ x) := by ++ simp [zero_add] ++ have hnonneg : ∀ n : ℕ, 0 ≤ 1 / ((n + 1 : ℝ) ^ x) := terms_nonneg x ++ have hpos : 0 < ∑' n : ℕ, 1 / ((n + 1 : ℝ) ^ x) := ++ tsum_pos_of_pos_first_term hsum hpos0 hnonneg ++ exact ⟨him, by simpa [hre] using hpos⟩ ++ ++lemma zeta332pos : 0 < norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) := by ++ have h3 : (1 : ℝ) < 3 := by norm_num ++ have h32 : (1 : ℝ) < (3 : ℝ) / 2 := by norm_num ++ obtain ⟨h3im, h3repos⟩ := zetapos 3 h3 ++ obtain ⟨h32im, h32repos⟩ := zetapos ((3 : ℝ) / 2) h32 ++ have h3ne : riemannZeta (3 : ℝ) ≠ 0 := by ++ intro hz ++ exact (ne_of_gt h3repos) (by simpa using congrArg Complex.re hz) ++ have h32ne : riemannZeta ((3 : ℝ) / 2) ≠ 0 := by ++ intro hz ++ exact (ne_of_gt h32repos) (by simpa using congrArg Complex.re hz) ++ have hdivne : riemannZeta (3 : ℝ) / riemannZeta ((3 : ℝ) / 2) ≠ 0 := ++ div_ne_zero h3ne h32ne ++ simpa using (norm_pos_iff.mpr hdivne) ++ ++lemma zeta_low_332 : ∃ a : ℝ, 0 < a ∧ ∀ t : ℝ, a ≤ norm (riemannZeta (((3 : ℝ) / 2) + t * Complex.I)) := by ++ use norm (riemannZeta 3 / riemannZeta ((3 : ℝ) / 2)) ++ exact ⟨zeta332pos, zeta_lower_bound⟩ ++ ++open Real _root_.Set Filter Topology MeasureTheory ++open scoped BigOperators Topology ++ ++lemma one_div_nat_cpow_eq_ite_cpow_neg (s : ℂ) (hs : s ≠ 0) (n : ℕ) : 1 / (n : ℂ) ^ s = if n = 0 then 0 else (n : ℂ) ^ (-s) := by ++ by_cases h : n = 0 ++ · simp [h, Complex.zero_cpow hs] ++ · have hcalc : 1 / (n : ℂ) ^ s = (n : ℂ) ^ (-s) := by ++ calc ++ 1 / (n : ℂ) ^ s = ((n : ℂ) ^ s)⁻¹ := by simp [one_div] ++ _ = (n : ℂ) ^ (-s) := by simpa using (Complex.cpow_neg (n : ℂ) s).symm ++ simpa [h] using hcalc ++ ++lemma lem_zetaLimit (s : ℂ) (hs : 1 < s.re) : riemannZeta s = ∑' n : ℕ, if n = 0 then 0 else (n : ℂ) ^ (-s) := by ++ classical ++ have hsne : s ≠ 0 := by ++ intro h ++ have hpos : 0 < s.re := lt_trans (show (0 : ℝ) < 1 from zero_lt_one) hs ++ have hne : s.re ≠ 0 := ne_of_gt hpos ++ simp [h] at hne ++ have hz : riemannZeta s = ∑' n : ℕ, 1 / (n : ℂ) ^ s := zeta_eq_tsum_one_div_nat_cpow (s := s) hs ++ simpa [one_div_nat_cpow_eq_ite_cpow_neg s hsne] using hz ++ ++noncomputable def zetaPartialSum (s : ℂ) (N : ℕ) : ℂ := ++ ∑ n ∈ Finset.range N, (n + 1 : ℂ) ^ (-s) ++ ++lemma sum_Icc1_eq_sum_range_succ (N : ℕ) (g : ℕ → ℂ) : ++ (∑ k ∈ Finset.Icc 1 N, g k) = ∑ n ∈ Finset.range N, g (n + 1) := by ++ classical ++ ++ symm ++ refine Finset.sum_bij (s := Finset.range N) (t := Finset.Icc 1 N) ++ (f := fun n => g (n + 1)) (g := fun k => g k) ++ (i := fun n (_hn : n ∈ Finset.range N) => n + 1) ++ ?hi ?hinj ?hsurj ?hcongr ++ · intro n hn ++ have hlt : n < N := Finset.mem_range.mp hn ++ have h1 : 1 ≤ n + 1 := Nat.succ_le_succ (Nat.zero_le n) ++ have h2 : n + 1 ≤ N := Nat.succ_le_of_lt hlt ++ exact (Finset.mem_Icc.mpr ⟨h1, h2⟩) ++ · intro a ha b hb h ++ ++ simpa using Nat.succ_injective h ++ · intro k hk ++ rcases Finset.mem_Icc.mp hk with ⟨hk1, hk2⟩ ++ refine ⟨k - 1, ?_, ?_⟩ ++ · ++ have hsucc : (k - 1) + 1 = k := Nat.sub_add_cancel hk1 ++ have hle : (k - 1) + 1 ≤ N := by simpa [hsucc] using hk2 ++ have hlt : k - 1 < N := lt_of_lt_of_le (Nat.lt_succ_self (k - 1)) hle ++ exact Finset.mem_range.mpr hlt ++ · ++ simp [Nat.sub_add_cancel hk1] ++ · intro n hn ++ rfl ++ ++lemma sum_Icc0_eq_sum_Icc1_of_zero (N : ℕ) (g : ℕ → ℂ) (h0 : g 0 = 0) : ++ (∑ k ∈ Finset.Icc 0 N, g k) = ∑ k ∈ Finset.Icc 1 N, g k := by ++ classical ++ have hdecomp : insert (0 : ℕ) (Finset.Icc 1 N) = Finset.Icc 0 N := by ++ simpa [Nat.succ_eq_add_one] using ++ (Finset.insert_Icc_succ_left_eq_Icc (a := 0) (b := N) (h := Nat.zero_le N)) ++ have hnotmem : (0 : ℕ) ∉ Finset.Icc 1 N := by ++ intro h ++ rcases Finset.mem_Icc.mp h with ⟨h1, _h2⟩ ++ have : ¬ (1 ≤ (0 : ℕ)) := by decide ++ exact this h1 ++ calc ++ (∑ k ∈ Finset.Icc 0 N, g k) ++ = ∑ k ∈ insert 0 (Finset.Icc 1 N), g k := by ++ simp [hdecomp] ++ _ = g 0 + ∑ k ∈ Finset.Icc 1 N, g k := by ++ simp ++ _ = ∑ k ∈ Finset.Icc 1 N, g k := by simp [h0] ++ ++lemma sum_Icc0_shifted_eq_sum_range (a : ℕ → ℂ) (m : ℕ) : ++ (∑ k ∈ Finset.Icc 0 m, (if k = 0 then 0 else a k)) = ∑ n ∈ Finset.range m, a (n + 1) := by ++ classical ++ calc ++ (∑ k ∈ Finset.Icc 0 m, (if k = 0 then 0 else a k)) ++ = ∑ k ∈ Finset.Icc 1 m, (if k = 0 then 0 else a k) := by ++ simpa using ++ (sum_Icc0_eq_sum_Icc1_of_zero (N := m) ++ (g := fun k => (if k = 0 then 0 else a k)) (h0 := by simp)) ++ _ = ∑ n ∈ Finset.range m, (if n + 1 = 0 then 0 else a (n + 1)) := by ++ simpa using ++ (sum_Icc1_eq_sum_range_succ (N := m) (g := fun k => (if k = 0 then 0 else a k))) ++ _ = ∑ n ∈ Finset.range m, a (n + 1) := by ++ apply Finset.sum_congr rfl ++ intro n hn ++ simp ++ ++lemma sum_Icc0_shifted_floor_eq (a : ℕ → ℂ) (t : ℝ) : ++ (∑ k ∈ Finset.Icc 0 ⌊t⌋₊, (if k = 0 then 0 else a k)) = ∑ n ∈ Finset.range ⌊t⌋₊, a (n + 1) := by ++ simpa using (sum_Icc0_shifted_eq_sum_range a ⌊t⌋₊) ++ ++lemma helper_contdiff_differentiable_integrable (f : ℝ → ℂ) (hf : ContDiff ℝ 1 f) ++ (a b : ℝ) : ++ (∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t) ∧ IntegrableOn (deriv f) (Set.Icc a b) := by ++ have hdiff : Differentiable ℝ f := hf.differentiable (by norm_num) ++ have hcont_deriv : Continuous (deriv f) := hf.continuous_deriv le_rfl ++ refine And.intro ?hdiffAt ?hint ++ · intro t ht ++ have hdt : DifferentiableAt ℝ f t := hdiff.differentiableAt ++ exact hdt ++ · ++ have hcontOn : ContinuousOn (deriv f) (Set.Icc a b) := hcont_deriv.continuousOn ++ exact hcontOn.integrableOn_compact isCompact_Icc ++ ++lemma sum_range_mul_shift_comm (N : ℕ) (a : ℕ → ℂ) (f : ℝ → ℂ) : ++ (∑ n ∈ Finset.range N, f (n + 1) * (if n + 1 = 0 then 0 else a (n + 1))) ++ = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by ++ classical ++ apply Finset.sum_congr rfl ++ intro n hn ++ simp [mul_comm] ++ ++lemma sum_range_shifted_coeffs (N : ℕ) (a c : ℕ → ℂ) (f : ℝ → ℂ) ++ (hshift : ∀ n, c (n + 1) = a (n + 1)) : ++ (∑ n ∈ Finset.range N, f (↑(n + 1)) * c (n + 1)) ++ = ∑ n ∈ Finset.range N, f (↑(n + 1)) * a (n + 1) := by ++ classical ++ apply Finset.sum_congr rfl ++ intro n hn ++ simp [hshift n] ++ ++lemma sum_range_commute_mul (N : ℕ) (a : ℕ → ℂ) (f : ℝ → ℂ) : ++ (∑ n ∈ Finset.range N, f (↑(n + 1)) * a (n + 1)) ++ = ∑ n ∈ Finset.range N, a (n + 1) * f (↑(n + 1)) := by ++ classical ++ apply Finset.sum_congr rfl ++ intro n hn ++ simp [mul_comm] ++ ++lemma lem_abelSummation {a : ℕ → ℂ} {f : ℝ → ℂ} ++ (hf : ContDiff ℝ 1 f) (N : ℕ) (hN : 1 ≤ N) : ++ (let A := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1); ++ ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) ++ = (A N) * f N - ∫ u in (1 : ℝ)..N, (A u) * deriv f u) := by ++ classical ++ ++ let c : ℕ → ℂ := fun k => if k = 0 then 0 else a k ++ ++ set A : ℝ → ℂ := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1) with hA ++ ++ have hdiff_int := helper_contdiff_differentiable_integrable (f := f) hf (1 : ℝ) N ++ rcases hdiff_int with ⟨hdiff, hint⟩ ++ ++ have habel := ++ sum_mul_eq_sub_integral_mul₀' (c := c) (m := N) ++ (hc := by simp [c]) ++ (hf_diff := by ++ intro t ht ++ simpa using (hdiff t ht)) ++ (hf_int := by simpa using hint) ++ ++ have hLHS : ++ (∑ k ∈ Finset.Icc 0 N, f k * c k) ++ = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by ++ ++ have h0 : ++ (∑ k ∈ Finset.Icc 0 N, f k * c k) ++ = ∑ k ∈ Finset.Icc 1 N, f k * c k := by ++ simpa [c] using ++ (sum_Icc0_eq_sum_Icc1_of_zero (N := N) ++ (g := fun k => f k * c k) (h0 := by simp [c])) ++ ++ have h1 : ++ (∑ k ∈ Finset.Icc 1 N, f k * c k) ++ = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by ++ simpa using ++ (sum_Icc1_eq_sum_range_succ (N := N) (g := fun k => f k * c k)) ++ ++ have h2 : ++ (∑ n ∈ Finset.range N, f (n + 1) * c (n + 1)) ++ = ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) := by ++ simpa [c] using (sum_range_mul_shift_comm (N := N) (a := a) (f := f)) ++ ++ simp [h0, h1, h2] ++ ++ have hAN : A N = ∑ n ∈ Finset.range N, a (n + 1) := by ++ have : (Nat.floor (N : ℝ)) = N := by ++ simp ++ simp [hA, this] ++ have hMain : ++ f N * (∑ k ∈ Finset.Icc 0 N, c k) = (A N) * f N := by ++ ++ have hs : (∑ k ∈ Finset.Icc 0 N, c k) = ∑ n ∈ Finset.range N, a (n + 1) := by ++ simpa [c] using (sum_Icc0_shifted_eq_sum_range (a := a) (m := N)) ++ calc ++ f N * (∑ k ∈ Finset.Icc 0 N, c k) ++ = (∑ k ∈ Finset.Icc 0 N, c k) * f N := by simp [mul_comm] ++ _ = (∑ n ∈ Finset.range N, a (n + 1)) * f N := by simp [hs] ++ _ = (A N) * f N := by simp [hAN] ++ ++ have hInt : ++ (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) ++ = ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by ++ ++ have hfun : ++ (fun t => deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) ++ = (fun t => deriv f t * A t) := by ++ funext t ++ have : (∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) = A t := by ++ simpa [c, hA] using (sum_Icc0_shifted_floor_eq (a := a) (t := t)) ++ simp [this] ++ ++ have h1Nℝ : (1 : ℝ) ≤ N := by exact_mod_cast hN ++ have hI : ++ (∫ u in (1 : ℝ)..N, (A u) * deriv f u) ++ = ∫ u in Set.Ioc (1 : ℝ) N, (A u) * deriv f u := by ++ simpa using ++ (intervalIntegral.integral_of_le ++ (f := fun u => (A u) * deriv f u) (μ := volume) h1Nℝ) ++ calc ++ (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) ++ = ∫ t in Set.Ioc (1 : ℝ) N, deriv f t * A t := by ++ simp [hfun] ++ _ = ∫ t in Set.Ioc (1 : ℝ) N, (A t) * deriv f t := by ++ simp [mul_comm] ++ _ = ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by ++ simp [hI] ++ ++ have hfinal : ∑ n ∈ Finset.range N, a (n + 1) * f (n + 1) ++ = (A N) * f N - ∫ u in (1 : ℝ)..N, (A u) * deriv f u := by ++ ++ simpa [hLHS, hMain, hInt] ++ using habel ++ ++ simpa [hA] using hfinal ++ ++lemma lem_partialSumIsZetaN (s : ℂ) (N : ℕ) : ++ (let f := fun u : ℝ => (u : ℂ) ^ (-s) ++ let a := fun _n : ℕ => (1 : ℂ) ++ zetaPartialSum s N = ∑ n ∈ Finset.range N, a n * f (n + 1)) := by ++ simp [zetaPartialSum] ++ ++lemma lem_sumOfAn (u : ℝ) (_hu : 1 ≤ u) : ++ (let a := fun _n : ℕ => (1 : ℂ) ++ let A := fun u : ℝ => ∑ n ∈ Finset.range (Nat.floor u), a (n + 1) ++ A u = (Nat.floor u : ℂ)) := by ++ simp [Finset.sum_const, Finset.card_range] ++ ++lemma lem_fDeriv (s : ℂ) (u : ℝ) (hu : 0 < u) : ++ (let f := fun u : ℝ => (u : ℂ) ^ (-s) ++ deriv f u = -s * (u : ℂ) ^ (-s - 1)) := by ++ ++ show deriv (fun u : ℝ => (u : ℂ) ^ (-s)) u = -s * (u : ℂ) ^ (-s - 1) ++ have hu_ne_zero : u ≠ 0 := ne_of_gt hu ++ by_cases h : s = 0 ++ · ++ simp [h] ++ · ++ have hneg_s_ne_zero : -s ≠ 0 := neg_ne_zero.mpr h ++ exact Complex.deriv_ofReal_cpow_const hu_ne_zero hneg_s_ne_zero ++ ++lemma differentiable_integrable_cpow_on_Icc (s : ℂ) (a b : ℝ) (h0 : 0 < a) (_hle : a ≤ b) : ++ (∀ t ∈ Set.Icc a b, DifferentiableAt ℝ (fun u : ℝ => (u : ℂ) ^ (-s)) t) ++ ∧ IntegrableOn (deriv (fun u : ℝ => (u : ℂ) ^ (-s))) (Set.Icc a b) := ++by ++ classical ++ ++ set f : ℝ → ℂ := fun u => (u : ℂ) ^ (-s) ++ set g : ℝ → ℂ := fun u => -s * (u : ℂ) ^ (-s - 1) ++ ++ have hpos_of_mem : ∀ {t : ℝ}, t ∈ Set.Icc a b → 0 < t := by ++ intro t ht; exact lt_of_lt_of_le h0 ht.1 ++ ++ have hdiff_at : ∀ t ∈ Set.Icc a b, DifferentiableAt ℝ f t := by ++ intro t ht ++ have ht_ne : t ≠ 0 := ne_of_gt (hpos_of_mem ht) ++ by_cases hs : s = 0 ++ · ++ simp [f, hs] ++ · ++ have hr : (-s) ≠ 0 := by simpa using (neg_ne_zero.mpr hs) ++ have hhas : HasDerivAt (fun y : ℝ => (y : ℂ) ^ (-s)) ((-s) * t ^ ((-s) - 1)) t := ++ hasDerivAt_ofReal_cpow_const (x := t) (hx := ht_ne) (r := -s) (hr := hr) ++ exact hhas.differentiableAt ++ ++ have hcont_pow : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := by ++ intro t ht ++ have ht_ne : t ≠ 0 := ne_of_gt (hpos_of_mem ht) ++ by_cases hzero : (-s - 1) = 0 ++ · ++ have : (fun u : ℝ => (u : ℂ) ^ (-s - 1)) = fun _ : ℝ => (1 : ℂ) := by ++ funext u; simp [hzero] ++ simpa [this] using (continuousAt_const : ContinuousAt (fun _ : ℝ => (1 : ℂ)) t).continuousWithinAt ++ · ++ have hr : (-s - 1) ≠ 0 := hzero ++ have hcpow : HasDerivAt (fun y : ℝ => (y : ℂ) ^ (-s - 1)) ((-s - 1) * t ^ ((-s - 1) - 1)) t := ++ hasDerivAt_ofReal_cpow_const (x := t) (hx := ht_ne) (r := -s - 1) (hr := hr) ++ have hcont_at : ContinuousAt (fun u : ℝ => (u : ℂ) ^ (-s - 1)) t := ++ hcpow.differentiableAt.continuousAt ++ simpa using hcont_at.continuousWithinAt ++ have hcont_g : ContinuousOn g (Set.Icc a b) := by ++ have hconst : ContinuousOn (fun _ : ℝ => (-s : ℂ)) (Set.Icc a b) := continuousOn_const ++ simpa only [g, Pi.mul_def, neg_mul] using! hconst.mul hcont_pow ++ ++ have hEqOn : EqOn (deriv f) g (Set.Icc a b) := by ++ intro u hu ++ have hu_pos : 0 < u := hpos_of_mem hu ++ simpa [f, g] using (lem_fDeriv s u hu_pos) ++ ++ have hcont_deriv : ContinuousOn (deriv f) (Set.Icc a b) := by ++ ++ have hg_restr : Continuous ((Set.Icc a b).domRestrict g) := hcont_g.domRestrict ++ have hEqRestr : (Set.Icc a b).domRestrict (deriv f) = (Set.Icc a b).domRestrict g := by ++ funext x; exact hEqOn x.property ++ have hderiv_restr : Continuous ((Set.Icc a b).domRestrict (deriv f)) := by ++ simpa [hEqRestr] using hg_restr ++ simpa [continuousOn_iff_continuous_domRestrict] using hderiv_restr ++ ++ have hInt : IntegrableOn (deriv f) (Set.Icc a b) := ++ hcont_deriv.integrableOn_compact isCompact_Icc ++ exact And.intro hdiff_at hInt ++ ++lemma intervalIntegral_congr_of_Ioc_eq (a b : ℝ) (h : a ≤ b) ++ (f g : ℝ → ℂ) ++ (hpt : ∀ u ∈ Set.Ioc a b, f u = g u) : ++ (∫ u in a..b, f u) = ∫ u in a..b, g u := by ++ ++ have h1 : (∀ᵐ u ∂(MeasureTheory.volume), u ∈ Set.Ioc a b → f u = g u) := by ++ refine Filter.Eventually.of_forall ?_; ++ intro u hu; exact hpt u hu ++ have hIocEmpty : Set.Ioc b a = (∅ : Set ℝ) := by ++ simpa using! (Set.Ioc_eq_empty_of_le h) ++ have h2 : (∀ᵐ u ∂(MeasureTheory.volume), u ∈ Set.Ioc b a → f u = g u) := by ++ refine Filter.Eventually.of_forall ?_; ++ intro u hu ++ have : u ∈ (∅ : Set ℝ) := by simp [hIocEmpty] at hu ++ exact this.elim ++ simpa using ++ (intervalIntegral.integral_congr_ae' (a := a) (b := b) (μ := MeasureTheory.volume) ++ (f := f) (g := g) h1 h2) ++ ++lemma lem_applyAbel (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : ++ zetaPartialSum s N ++ = (N : ℂ) * (N : ℂ) ^ (-s) ++ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by ++ classical ++ ++ set f : ℝ → ℂ := fun u => (u : ℂ) ^ (-s) ++ let c : ℕ → ℂ := fun k => if k = 0 then 0 else (1 : ℂ) ++ ++ have hle : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN ++ have hdiff_int := ++ differentiable_integrable_cpow_on_Icc (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) ++ (h0 := by exact zero_lt_one) (_hle := hle) ++ rcases hdiff_int with ⟨hdiff, hint⟩ ++ ++ have habel := ++ sum_mul_eq_sub_integral_mul₀' (c := c) (f := f) (m := N) ++ (hc := by simp [c]) ++ (hf_diff := by intro t ht; simpa [f] using (hdiff t ht)) ++ (hf_int := by simpa [f] using hint) ++ ++ have hLHS : (∑ k ∈ Finset.Icc 0 N, f k * c k) = zetaPartialSum s N := by ++ ++ have h0 : ++ (∑ k ∈ Finset.Icc 0 N, f k * c k) = ∑ k ∈ Finset.Icc 1 N, f k * c k := by ++ simpa [c] using ++ (sum_Icc0_eq_sum_Icc1_of_zero (N := N) ++ (g := fun k => f k * c k) (h0 := by simp [c])) ++ have h1 : (∑ k ∈ Finset.Icc 1 N, f k * c k) ++ = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by ++ simpa using (sum_Icc1_eq_sum_range_succ (N := N) (g := fun k => f k * c k)) ++ have h2 : (∑ n ∈ Finset.range N, f (n + 1) * c (n + 1)) ++ = ∑ n ∈ Finset.range N, f (n + 1) := by ++ apply Finset.sum_congr rfl; intro n hn; simp [c] ++ calc ++ (∑ k ∈ Finset.Icc 0 N, f k * c k) ++ = ∑ k ∈ Finset.Icc 1 N, f k * c k := by simpa using h0 ++ _ = ∑ n ∈ Finset.range N, f (n + 1) * c (n + 1) := by simpa using h1 ++ _ = ∑ n ∈ Finset.range N, f (n + 1) := by simpa using h2 ++ _ = zetaPartialSum s N := by simp [zetaPartialSum, f] ++ ++ have hset_to_interval : ++ (∫ t in Set.Ioc (1 : ℝ) N, deriv f t * ∑ k ∈ Finset.Icc 0 ⌊t⌋₊, c k) ++ = ∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k := by ++ simpa using ++ (intervalIntegral.integral_of_le ++ (f := fun u => deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) ++ (μ := volume) hle).symm ++ have hstep1 : ++ zetaPartialSum s N ++ = f N * (∑ k ∈ Finset.Icc 0 N, c k) ++ - ∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k := by ++ simpa [hLHS, hset_to_interval] using habel ++ ++ have hInt_congr : ++ (∫ u in (1 : ℝ)..N, deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) ++ = ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by ++ ++ apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hle) ++ (f := fun u => deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) ++ (g := fun u => (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1))) ++ intro u hu ++ have hu_pos : 0 < u := lt_trans zero_lt_one hu.1 ++ have hderiv : deriv f u = -s * (u : ℂ) ^ (-s - 1) := by ++ simpa [f] using (lem_fDeriv s u hu_pos) ++ ++ have hsumfloor : (∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k) = (Nat.floor u : ℂ) := by ++ have hshift := sum_Icc0_shifted_floor_eq (a := fun _ => (1 : ℂ)) (t := u) ++ have hsum : (∑ n ∈ Finset.range ⌊u⌋₊, (1 : ℂ)) = (Nat.floor u : ℂ) := by ++ simp [Finset.sum_const, Finset.card_range] ++ simpa [c, hsum] using hshift ++ calc ++ deriv f u * ∑ k ∈ Finset.Icc 0 ⌊u⌋₊, c k ++ = deriv f u * (Nat.floor u : ℂ) := by simp [hsumfloor] ++ _ = (Nat.floor u : ℂ) * deriv f u := by simp [mul_comm] ++ _ = (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by simp [hderiv] ++ ++ have hstep2 : ++ zetaPartialSum s N ++ = f N * (∑ k ∈ Finset.Icc 0 N, c k) ++ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by ++ simpa [hInt_congr] using hstep1 ++ ++ have hMain : f N * (∑ k ∈ Finset.Icc 0 N, c k) = (N : ℂ) * f N := by ++ have hs : (∑ k ∈ Finset.Icc 0 N, c k) = ∑ n ∈ Finset.range N, (1 : ℂ) := by ++ simpa [c] using (sum_Icc0_shifted_eq_sum_range (a := fun _ => (1 : ℂ)) (m := N)) ++ have hsumN : (∑ n ∈ Finset.range N, (1 : ℂ)) = (N : ℂ) := by ++ simp [Finset.sum_const, Finset.card_range] ++ calc ++ f N * (∑ k ∈ Finset.Icc 0 N, c k) ++ = f N * (∑ n ∈ Finset.range N, (1 : ℂ)) := by simp [hs] ++ _ = f N * (N : ℂ) := by simp [hsumN] ++ _ = (N : ℂ) * f N := by simp [mul_comm] ++ ++ have hfinal : ++ zetaPartialSum s N ++ = (N : ℂ) * (N : ℂ) ^ (-s) ++ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by ++ calc ++ zetaPartialSum s N ++ = f N * (∑ k ∈ Finset.Icc 0 N, c k) ++ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by ++ simpa using hstep2 ++ _ = (N : ℂ) * f N ++ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by ++ simp [hMain] ++ _ = (N : ℂ) * (N : ℂ) ^ (-s) ++ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by ++ simp [f] ++ exact hfinal ++ ++lemma lem_floorNisN (N : ℕ) (_hN : 1 ≤ N) : Nat.floor (N : ℝ) = N := by simp ++ ++lemma helper_integral_const_mul (a b : ℝ) (c : ℂ) (g : ℝ → ℂ) : ∫ x in a..b, c * g x = c * ∫ x in a..b, g x := by simp ++ ++lemma helper_cpow_mul_cpow_neg_eq_cpow_sub (x s : ℂ) (hx : x ≠ 0) : x * x ^ (-s) = x ^ (1 - s) := by ++ calc ++ x * x ^ (-s) = x ^ (1 : ℂ) * x ^ (-s) := by ++ simp [Complex.cpow_one] ++ _ = x ^ (1 + (-s)) := by ++ simpa using (Complex.cpow_add (x := x) (y := (1 : ℂ)) (z := (-s)) hx).symm ++ _ = x ^ (1 - s) := by ++ simp [sub_eq_add_neg] ++ ++lemma lem_zetaNsimplified1 (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : zetaPartialSum s N = (N : ℂ) ^ (1 - s) + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by ++ have happly := lem_applyAbel s N hN ++ ++ have hInt : ++ ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) ++ = (-s) * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by ++ simp [mul_left_comm] ++ calc ++ zetaPartialSum s N ++ = (N : ℂ) * (N : ℂ) ^ (-s) ++ - ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (-s * (u : ℂ) ^ (-s - 1)) := by ++ simpa using happly ++ _ = (N : ℂ) * (N : ℂ) ^ (-s) ++ - ((-s) * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1)) := by ++ rw [hInt] ++ _ = (N : ℂ) * (N : ℂ) ^ (-s) ++ + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by ++ simp [sub_eq_add_neg, neg_mul] ++ _ = (N : ℂ) ^ (1 - s) ++ + s * ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) := by ++ have hpos : 0 < N := (Nat.succ_le_iff).mp hN ++ have hNz : (N : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (ne_of_gt hpos) ++ have hpow := helper_cpow_mul_cpow_neg_eq_cpow_sub (x := (N : ℂ)) (s := s) hNz ++ simp [hpow] ++ ++lemma lem_floorUdecomp (u : ℝ) : (Int.floor u : ℝ) = u - Int.fract u := by exact (eq_sub_iff_add_eq).2 (Int.floor_add_fract u) ++ ++lemma lem_fracPartBound (u : ℝ) : 0 ≤ Int.fract u ∧ Int.fract u < 1 ∧ |Int.fract u| ≤ (1 : ℝ) := by ++ constructor ++ · exact Int.fract_nonneg u ++ · constructor ++ · exact Int.fract_lt_one u ++ · have hnonneg : 0 ≤ Int.fract u := Int.fract_nonneg u ++ have hle : Int.fract u ≤ (1 : ℝ) := le_of_lt (Int.fract_lt_one u) ++ simpa [abs_of_nonneg hnonneg] using hle ++ ++lemma helper_continuousOn_cpow (r : ℂ) {a b : ℝ} (ha : 0 < a) (_hab : a ≤ b) : ++ ContinuousOn (fun u : ℝ => (u : ℂ) ^ r) (Set.Icc a b) := by ++ classical ++ intro t ht ++ have ht_pos : 0 < t := lt_of_lt_of_le ha ht.1 ++ by_cases hr : r = 0 ++ · ++ have hconst : (fun u : ℝ => (u : ℂ) ^ r) = fun _ => (1 : ℂ) := by ++ funext u; simp [hr] ++ simpa [hconst] using (continuousAt_const : ContinuousAt (fun _ : ℝ => (1 : ℂ)) t).continuousWithinAt ++ · ++ have hderiv : HasDerivAt (fun u : ℝ => (u : ℂ) ^ r) (r * t ^ (r - 1)) t := ++ hasDerivAt_ofReal_cpow_const (x := t) (hx := ne_of_gt ht_pos) (r := r) (hr := hr) ++ exact hderiv.differentiableAt.continuousAt.continuousWithinAt ++ ++lemma helper_intervalIntegrable_mul_cpow_id (s : ℂ) {a b : ℝ} (ha : 1 ≤ a) (hab : a ≤ b) : ++ IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by ++ classical ++ ++ have hcont1 : ContinuousOn (fun u : ℝ => (u : ℂ)) (Set.Icc a b) := ++ (Complex.continuous_ofReal).continuousOn ++ have hcont2 : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := ++ helper_continuousOn_cpow (-s - 1) (lt_of_lt_of_le zero_lt_one ha) hab ++ have hcont : ContinuousOn (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := ++ hcont1.mul hcont2 ++ ++ have hint_on : IntegrableOn (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) (Set.Icc a b) := ++ hcont.integrableOn_compact isCompact_Icc ++ have hint : IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by ++ simpa using ++ (intervalIntegrable_iff_integrableOn_Icc_of_le (μ := volume) (a := a) (b := b) ++ (f := fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) hab).2 hint_on ++ exact hint ++ ++lemma helper_aestronglyMeasurable_kernel_Icc (s : ℂ) {a b : ℝ} : ++ AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) ++ (volume.restrict (Icc a b)) := by ++ ++ have hmeas_fract : Measurable (Int.fract : ℝ → ℝ) := by simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) ++ have h1 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) (volume.restrict (Icc a b)) := ++ (Complex.measurable_ofReal.comp hmeas_fract).aestronglyMeasurable ++ have h2 : AEStronglyMeasurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (volume.restrict (Icc a b)) := by ++ have hmeas : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by measurability ++ exact hmeas.aestronglyMeasurable ++ simpa using! (MeasureTheory.AEStronglyMeasurable.mul h1 h2) ++ ++lemma helper_intervalIntegrable_frac_kernel (s : ℂ) {a b : ℝ} (ha : 1 ≤ a) (hab : a ≤ b) : ++ IntervalIntegrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) volume a b := by ++ classical ++ ++ let μ := volume.restrict (Icc a b) ++ set f : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) ++ set g : ℝ → ℝ := fun u => ‖(u : ℂ) ^ (-s - 1)‖ ++ ++ have hmeas : AEStronglyMeasurable f μ := by simpa [μ, f] using helper_aestronglyMeasurable_kernel_Icc (s := s) (a := a) (b := b) ++ ++ have hbound_ae : ∀ᵐ u ∂μ, ‖f u‖ ≤ g u := by ++ ++ refine ((ae_restrict_iff' (μ := volume) (s := Icc a b) ++ (p := fun u : ℝ => ‖f u‖ ≤ g u) measurableSet_Icc)).2 ?_ ++ refine Filter.Eventually.of_forall ?_ ++ intro u hu ++ ++ have hfract_le1 : ‖(Int.fract u : ℝ)‖ ≤ (1 : ℝ) := by ++ simpa using (lem_fracPartBound u).2.2 ++ ++ have : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ ‖(Int.fract u : ℝ)‖ * ‖(u : ℂ) ^ (-s - 1)‖ := by ++ simp ++ have : ‖f u‖ ≤ ‖(Int.fract u : ℝ)‖ * ‖(u : ℂ) ^ (-s - 1)‖ := by ++ simp [f] ++ have : ‖f u‖ ≤ 1 * ‖(u : ℂ) ^ (-s - 1)‖ := ++ le_trans this (mul_le_mul_of_nonneg_right hfract_le1 (by exact norm_nonneg _)) ++ simpa [g] using (by simpa [one_mul] using this) ++ ++ have hcont : ContinuousOn (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (Icc a b) := ++ helper_continuousOn_cpow (-s - 1) (lt_of_lt_of_le zero_lt_one ha) hab ++ have hg_int_on : IntegrableOn g (Icc a b) := by ++ have hcont_norm : ContinuousOn g (Icc a b) := by ++ simpa [g] using (hcont.norm) ++ exact hcont_norm.integrableOn_compact isCompact_Icc ++ ++ have hf0 : Integrable (fun _ : ℝ => (0 : ℂ)) μ := by simp [μ] ++ have hg : Integrable g μ := by simpa [μ] using! hg_int_on ++ ++ have hf : Integrable f μ := ++ MeasureTheory.integrable_of_norm_sub_le (μ := μ) hmeas hf0 hg ++ (by ++ ++ have : ∀ᵐ u ∂μ, ‖(0 : ℂ) - f u‖ ≤ g u := by ++ simpa [sub_eq_add_neg, norm_neg, μ, f, g] using hbound_ae ++ simpa using this) ++ ++ have hf_on : IntegrableOn f (Icc a b) := by simpa [μ, f] using! hf ++ simpa using ++ (intervalIntegrable_iff_integrableOn_Icc_of_le (μ := volume) (a := a) (b := b) ++ (f := f) hab).2 hf_on ++ ++lemma lem_integralSplit (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : ++ ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) ++ = (∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) ++ - ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by ++ have hab : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN ++ ++ have hcongr1 : ++ (∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1)) ++ = ∫ u in (1 : ℝ)..N, ++ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1) := by ++ apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) ++ intro u hu ++ have hu0 : 0 ≤ u := le_trans (by norm_num) (le_of_lt hu.1) ++ have hfloorR : (Nat.floor u : ℝ) = (Int.floor u : ℝ) := by ++ simpa using (natCast_floor_eq_intCast_floor (R := ℝ) (a := u) hu0) ++ have hfloorC : (Nat.floor u : ℂ) = ((Int.floor u : ℝ) : ℂ) := by ++ simpa using congrArg (fun x : ℝ => (x : ℂ)) hfloorR ++ have hIFR : (Int.floor u : ℝ) = u - Int.fract u := lem_floorUdecomp u ++ have hIFC : ((Int.floor u : ℝ) : ℂ) = ((u - Int.fract u : ℝ) : ℂ) := ++ congrArg (fun x : ℝ => (x : ℂ)) hIFR ++ have : (Nat.floor u : ℂ) = ((u - Int.fract u : ℝ) : ℂ) := hfloorC.trans hIFC ++ simp [this, sub_eq_add_neg] ++ ++ have hcongr2 : ++ (∫ u in (1 : ℝ)..N, ++ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) ++ = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) ++ - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := by ++ have hI1 : IntervalIntegrable (fun u : ℝ => (u : ℂ) * (u : ℂ) ^ (-s - 1)) volume (1 : ℝ) (N : ℝ) := ++ helper_intervalIntegrable_mul_cpow_id (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) (ha := le_rfl) (hab := hab) ++ have hI2 : IntervalIntegrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) volume (1 : ℝ) (N : ℝ) := ++ helper_intervalIntegrable_frac_kernel (s := s) (a := (1 : ℝ)) (b := (N : ℝ)) (ha := le_rfl) (hab := hab) ++ have : ++ (∫ u in (1 : ℝ)..N, ++ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) ++ = ∫ u in (1 : ℝ)..N, ++ ((u : ℂ) * (u : ℂ) ^ (-s - 1) ++ - ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := by ++ apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) ++ intro u hu; simp [sub_mul] ++ calc ++ (∫ u in (1 : ℝ)..N, ++ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1)) ++ = ∫ u in (1 : ℝ)..N, ++ ((u : ℂ) * (u : ℂ) ^ (-s - 1) ++ - ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := this ++ _ = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) ++ - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := ++ (intervalIntegral.integral_sub (μ := volume) (a := (1 : ℝ)) (b := (N : ℝ)) hI1 hI2) ++ ++ have hpow : ++ (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) ++ = ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) := by ++ apply intervalIntegral_congr_of_Ioc_eq (a := (1 : ℝ)) (b := (N : ℝ)) (h := hab) ++ intro u hu ++ have hu_pos : 0 < u := lt_trans zero_lt_one hu.1 ++ have hux0 : (u : ℝ) ≠ 0 := ne_of_gt hu_pos ++ have hcx0 : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hux0 ++ calc ++ (u : ℂ) * (u : ℂ) ^ (-s - 1) ++ = (u : ℂ) ^ (1 : ℂ) * (u : ℂ) ^ (-s - 1) := by simp [Complex.cpow_one] ++ _ = (u : ℂ) ^ (1 + (-s - 1)) := by ++ simpa using ++ (Complex.cpow_add (x := (u : ℂ)) (y := (1 : ℂ)) (z := (-s - 1)) hcx0).symm ++ _ = (u : ℂ) ^ (-s) := by ++ simp [add_left_comm, sub_eq_add_neg] ++ ++ calc ++ ∫ u in (1 : ℝ)..N, (Nat.floor u : ℂ) * (u : ℂ) ^ (-s - 1) ++ = ∫ u in (1 : ℝ)..N, ++ ((u : ℂ) - ((Int.fract u : ℝ) : ℂ)) * (u : ℂ) ^ (-s - 1) := hcongr1 ++ _ = (∫ u in (1 : ℝ)..N, (u : ℂ) * (u : ℂ) ^ (-s - 1)) ++ - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := hcongr2 ++ _ = (∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) ++ - ∫ u in (1 : ℝ)..N, ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) := by ++ simp [hpow] ++ ++lemma lem_zetaNsimplified2 (s : ℂ) (N : ℕ) (hN : 1 ≤ N) : ++ zetaPartialSum s N ++ = (N : ℂ) ^ (1 - s) ++ + (s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s)) ++ - (s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) := by ++ have hstep1: _ := lem_zetaNsimplified1 s N hN ++ rw [lem_integralSplit] at hstep1 ++ rw [mul_sub] at hstep1 ++ rw [hstep1] ++ exact (add_sub_assoc _ _ _).symm ++ exact hN ++ ++lemma lem_evalMainIntegral (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := by ++ have h01leN : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hN ++ have h0notIcc : (0 : ℝ) ∉ Set.Icc (1 : ℝ) (N : ℝ) := by ++ intro hx ++ exact (not_le.mpr (by norm_num : (0 : ℝ) < 1)) hx.1 ++ have h0not : (0 : ℝ) ∉ Set.uIcc (1 : ℝ) (N : ℝ) := by ++ simp [uIcc_of_le h01leN] ++ have hrne : -s ≠ (-1 : ℂ) := by ++ intro h ++ apply hs ++ simpa using congrArg Neg.neg h ++ have hint : ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) ++ = ((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1) := by ++ have hcond : (-1 < (-s).re) ∨ (-s ≠ -1 ∧ (0 : ℝ) ∉ Set.uIcc (1 : ℝ) (N : ℝ)) := by ++ exact Or.inr ⟨hrne, h0not⟩ ++ simpa using (integral_cpow (a := (1 : ℝ)) (b := (N : ℝ)) (r := -s) hcond) ++ have hmul : s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) ++ = s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) := by ++ simpa using congrArg (fun x => s * x) hint ++ have hrewrite : ++ s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) ++ = s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) := by ++ have : s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) ++ = s * (((N : ℂ) ^ (1 - s) - (1 : ℂ) ^ (1 - s)) / (1 - s)) := by ++ simp [add_comm, sub_eq_add_neg] ++ have h1pow : (1 : ℂ) ^ (1 - s) = 1 := by simp ++ simpa [h1pow] using this ++ have hsplit : s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) ++ = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := by ++ have h1 : s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) ++ = (s * ((N : ℂ) ^ (1 - s) - 1)) / (1 - s) := by ++ simpa using (mul_div_assoc s ((N : ℂ) ^ (1 - s) - 1) (1 - s)).symm ++ have h2 : (s * ((N : ℂ) ^ (1 - s) - 1)) / (1 - s) ++ = (s / (1 - s)) * ((N : ℂ) ^ (1 - s) - 1) := by ++ simpa [mul_comm, mul_left_comm, mul_assoc] using ++ (div_mul_eq_mul_div (a := s) (b := (1 - s)) (c := ((N : ℂ) ^ (1 - s) - 1))).symm ++ exact h1.trans h2 ++ calc ++ s * ∫ u in (1 : ℝ)..N, (u : ℂ) ^ (-s) ++ = s * (((N : ℂ) ^ ((-s) + 1) - (1 : ℂ) ^ ((-s) + 1)) / ((-s) + 1)) := hmul ++ _ = s * (((N : ℂ) ^ (1 - s) - 1) / (1 - s)) := hrewrite ++ _ = s / (1 - s) * ((N : ℂ) ^ (1 - s) - 1) := hsplit ++ ++lemma lem_zetaNfinal (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : ++ zetaPartialSum s N ++ = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) ++ - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by ++ ++ have hstep := lem_zetaNsimplified2 s N hN ++ ++ rw [lem_evalMainIntegral s hs N hN] at hstep ++ ++ have hden : (1 - s) ≠ 0 := by ++ intro h ++ have h1 : 1 = s := by simpa [sub_eq_zero] using h ++ have h2 : s = 1 := h1.symm ++ exact hs h2 ++ let A := (N : ℂ) ^ (1 - s) ++ ++ have h1 : (1 - s) * (A + s / (1 - s) * (A - 1)) = A - s := by ++ calc ++ (1 - s) * (A + s / (1 - s) * (A - 1)) ++ = (1 - s) * A + (1 - s) * (s / (1 - s) * (A - 1)) := by ring ++ _ = (1 - s) * A + s * (A - 1) := by field_simp [hden] ++ _ = A - s := by ring ++ have h2 : (1 - s) * (A / (1 - s) + 1 + 1 / (s - 1)) = A - s := by ++ have hne : s - 1 ≠ 0 := by simpa [sub_eq_zero] using hs ++ field_simp [hden, hne]; ring ++ have halg : A + s / (1 - s) * (A - 1) = A / (1 - s) + 1 + 1 / (s - 1) := ++ mul_left_cancel₀ hden (h1.trans h2.symm) ++ ++ rw [halg] at hstep ++ exact hstep ++ ++lemma complex_tendsto_zero_iff_norm_tendsto_zero {α : Type*} {f : α → ℂ} {l : Filter α} : ++ Tendsto f l (𝓝 0) ↔ Tendsto (fun x => ‖f x‖) l (𝓝 0) := by ++ rw [tendsto_iff_dist_tendsto_zero] ++ simp only [dist_zero_right] ++ ++lemma complex_norm_natCast_cpow (N : ℕ) (w : ℂ) (hN : 0 < N) : ++ ‖(N : ℂ) ^ w‖ = (N : ℝ) ^ w.re := by ++ have hNnz : (N : ℂ) ≠ 0 := by ++ simp [Ne, Nat.cast_eq_zero] ++ exact ne_of_gt hN ++ rw [Complex.norm_cpow_of_ne_zero hNnz] ++ rw [Complex.norm_natCast] ++ rw [Complex.natCast_arg] ++ simp [Real.exp_zero] ++ ++lemma tendsto_natCast_cpow_zero_of_neg_re (w : ℂ) (hw : w.re < 0) : ++ Tendsto (fun N : ℕ => (N : ℂ) ^ w) atTop (𝓝 0) := by ++ rw [complex_tendsto_zero_iff_norm_tendsto_zero] ++ ++ have h1 : ∀ᶠ (N : ℕ) in atTop, ‖(N : ℂ) ^ w‖ = (N : ℝ) ^ w.re := by ++ filter_upwards [eventually_gt_atTop 0] with N hN ++ exact complex_norm_natCast_cpow N w hN ++ rw [tendsto_congr' h1] ++ ++ have hw_pos : 0 < -w.re := neg_pos.mpr hw ++ ++ have h_eq : w.re = -(-w.re) := by ring ++ rw [h_eq] ++ ++ have h_comp : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop ++ have h_rpow : Tendsto (fun x : ℝ => x ^ (-(-w.re))) atTop (𝓝 0) := tendsto_rpow_neg_atTop hw_pos ++ exact Tendsto.comp h_rpow h_comp ++ ++lemma lem_limitTerm1 (s : ℂ) (hs : 1 < s.re) : ++ Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s)) atTop (𝓝 0) := by ++ apply tendsto_natCast_cpow_zero_of_neg_re ++ simp only [Complex.sub_re, Complex.one_re] ++ linarith ++ ++lemma lem_integrandBound (u : ℝ) (hu : 1 ≤ u) (s : ℂ) : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by ++ ++ set a : ℂ := ((Int.fract u : ℝ) : ℂ) ++ set b : ℂ := (u : ℂ) ^ (-s - 1) ++ ++ have hfract_le1 : ‖a‖ ≤ (1 : ℝ) := by ++ simpa [a, Complex.norm_real] using (lem_fracPartBound u).2.2 ++ ++ have hu0 : 0 < u := lt_of_lt_of_le zero_lt_one hu ++ ++ have h₁ : ‖a * b‖ ≤ ‖a‖ * ‖b‖ := by simp ++ have h₂ : ‖a‖ * ‖b‖ ≤ 1 * ‖b‖ := ++ mul_le_mul_of_nonneg_right hfract_le1 (norm_nonneg _) ++ have h₃ : ‖a * b‖ ≤ 1 * ‖b‖ := le_trans h₁ h₂ ++ have hle : ‖a * b‖ ≤ ‖b‖ := by simpa [one_mul] using h₃ ++ ++ have hb : ‖b‖ = u ^ ((-s - 1).re) := by ++ simpa [b] using ++ Complex.norm_cpow_eq_rpow_re_of_pos (x := u) (hx := hu0) (y := -s - 1) ++ ++ have hexp : (-s - 1).re = -s.re - 1 := by ++ simp [sub_eq_add_neg] ++ ++ calc ++ ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ++ = ‖a * b‖ := rfl ++ _ ≤ ‖b‖ := hle ++ _ = u ^ ((-s - 1).re) := hb ++ _ = u ^ (-s.re - 1) := by simp [hexp] ++ ++lemma lem_integrandBoundeps (ε : ℝ) (_hε : 0 < ε) (u : ℝ) (hu : 1 ≤ u) (s : ℂ) (hs : ε ≤ s.re) : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε) := by ++ have h1 : ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := lem_integrandBound u hu s ++ have h2 : -s.re - 1 ≤ -1 - ε := by linarith [hs] ++ have h3 : u ^ (-s.re - 1) ≤ u ^ (-1 - ε) := Real.rpow_le_rpow_of_exponent_le hu h2 ++ exact le_trans h1 h3 ++ ++lemma lem_triangleInequality_add (z₁ z₂ : ℂ) : ++ ‖z₁ + z₂‖ ≤ ‖z₁‖ + ‖z₂‖ := by ++ exact norm_add_le z₁ z₂ ++ ++lemma lem_triangleInequality_integral {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] ++ {f : ℝ → E} {a b : ℝ} (_hf : IntervalIntegrable f volume a b) (h : a ≤ b) : ++ ‖∫ u in a..b, f u‖ ≤ ∫ u in a..b, ‖f u‖ := by ++ ++ simpa using (intervalIntegral.norm_integral_le_integral_norm (μ := volume) (f := f) (a := a) (b := b) h) ++ ++lemma helper_integral_interval_sub_left {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] ++ {f : ℝ → E} {a b c : ℝ} ++ (hab : IntervalIntegrable f volume a b) (hac : IntervalIntegrable f volume a c) : ++ ((∫ x in a..b, f x) - ∫ x in a..c, f x) = ∫ x in c..b, f x := by ++ simpa using ++ (intervalIntegral.integral_interval_sub_left (μ := volume) (f := f) (a := a) (b := b) (c := c) ++ hab hac) ++ ++lemma helper_integral_rpow_eval {ε : ℝ} (hε : 0 < ε) {m n : ℝ} ++ (hm : 1 ≤ m) (hmn : m ≤ n) : ++ ∫ u in m..n, u ^ (-1 - ε) = (m ^ (-ε) - n ^ (-ε)) / ε := by ++ ++ have h0notIcc : (0 : ℝ) ∉ Set.Icc m n := by ++ intro hx ++ have : ¬ m ≤ 0 := not_le.mpr (lt_of_lt_of_le zero_lt_one hm) ++ exact this hx.1 ++ have h0not : (0 : ℝ) ∉ Set.uIcc m n := by ++ simpa [uIcc_of_le hmn] using h0notIcc ++ ++ have hrne : (-1 - ε) ≠ (-1 : ℝ) := by ++ intro h ++ have hplus := congrArg (fun t => t + 1) h ++ have hminus : -ε = 0 := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hplus ++ have hε0 : ε = 0 := by simpa using congrArg Neg.neg hminus ++ exact (ne_of_gt hε) hε0 ++ ++ have hint : ∫ u in m..n, u ^ (-1 - ε) ++ = (n ^ ((-1 - ε) + 1) - m ^ ((-1 - ε) + 1)) / ((-1 - ε) + 1) := by ++ have hcond : (-1 < (-1 - ε)) ∨ ((-1 - ε) ≠ -1 ∧ (0 : ℝ) ∉ Set.uIcc m n) := by ++ exact Or.inr ⟨hrne, h0not⟩ ++ simpa using (integral_rpow (a := m) (b := n) (r := -1 - ε) hcond) ++ ++ have h1 : ((-1 - ε) + 1) = -ε := by ++ simp [sub_eq_add_neg, add_comm, add_left_comm] ++ have : ∫ u in m..n, u ^ (-1 - ε) ++ = (n ^ (-ε) - m ^ (-ε)) / (-ε) := by ++ simpa [h1] ++ using hint ++ have hnegnum : -(n ^ (-ε) - m ^ (-ε)) = m ^ (-ε) - n ^ (-ε) := by ++ simp ++ calc ++ ∫ u in m..n, u ^ (-1 - ε) ++ = (n ^ (-ε) - m ^ (-ε)) / (-ε) := this ++ _ = (n ^ (-ε) - m ^ (-ε)) * ((-ε)⁻¹) := by simp [div_eq_mul_inv] ++ _ = (n ^ (-ε) - m ^ (-ε)) * (-(ε⁻¹)) := by simp [inv_neg] ++ _ = -((n ^ (-ε) - m ^ (-ε)) * ε⁻¹) := by simp [mul_neg] ++ _ = (-(n ^ (-ε) - m ^ (-ε))) * ε⁻¹ := by ++ simpa using (neg_mul (n ^ (-ε) - m ^ (-ε)) (ε⁻¹)).symm ++ _ = (m ^ (-ε) - n ^ (-ε)) * ε⁻¹ := by ++ simp ++ _ = (m ^ (-ε) - n ^ (-ε)) / ε := by simp [div_eq_mul_inv] ++ ++lemma helper_integral_rpow_le {ε : ℝ} (hε : 0 < ε) {m n : ℝ} ++ (hm : 1 ≤ m) (hmn : m ≤ n) : ++ ∫ u in m..n, u ^ (-1 - ε) ≤ (1 / ε) * m ^ (-ε) := by ++ have heval := helper_integral_rpow_eval (ε := ε) hε hm hmn ++ have hn0 : 0 ≤ n := by ++ have h01 : (0 : ℝ) ≤ 1 := by norm_num ++ exact le_trans h01 (le_trans hm hmn) ++ have hsub_le : m ^ (-ε) - n ^ (-ε) ≤ m ^ (-ε) := by ++ exact sub_le_self _ (Real.rpow_nonneg hn0 (-ε)) ++ have hinv_nonneg : 0 ≤ ε⁻¹ := by ++ exact inv_nonneg.mpr (le_of_lt hε) ++ have hdiv_le : ((m ^ (-ε) - n ^ (-ε)) / ε) ≤ (m ^ (-ε) / ε) := by ++ have := mul_le_mul_of_nonneg_right hsub_le hinv_nonneg ++ simpa [div_eq_mul_inv, mul_comm] using this ++ calc ++ ∫ u in m..n, u ^ (-1 - ε) ++ = (m ^ (-ε) - n ^ (-ε)) / ε := heval ++ _ ≤ m ^ (-ε) / ε := hdiv_le ++ _ = (1 / ε) * m ^ (-ε) := by simp [div_eq_mul_inv, mul_comm] ++ ++lemma helper_tendsto_nat_rpow_neg (ε : ℝ) (hε : 0 < ε) : ++ Tendsto (fun m : ℕ => (m : ℝ) ^ (-ε)) atTop (𝓝 0) := by ++ ++ have hcont : Tendsto (fun x : ℝ => x ^ (-ε)) atTop (𝓝 0) := by ++ ++ simpa using (tendsto_rpow_neg_atTop (y := ε) hε) ++ ++ have hcoe : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop := by ++ exact tendsto_natCast_atTop_atTop ++ ++ have : Tendsto ((fun x : ℝ => x ^ (-ε)) ∘ fun n : ℕ => (n : ℝ)) atTop (𝓝 0) := ++ hcont.comp hcoe ++ ++ simpa using! this ++ ++lemma helper_exists_limit_of_tail_bound (a : ℕ → ℂ) (b : ℕ → ℝ) ++ (hb_nonneg : ∀ m, 0 ≤ b m) ++ (hb_tendsto : Tendsto b atTop (𝓝 0)) ++ (hbound : ∀ᶠ m in atTop, ∀ᶠ n in atTop, m ≤ n → ‖a n - a m‖ ≤ b m) : ++ ∃ l : ℂ, Tendsto a atTop (𝓝 l) := by ++ classical ++ ++ have hCauchy : CauchySeq a := by ++ ++ refine (Metric.cauchySeq_iff).2 ?_ ++ intro ε hε ++ ++ have h_ball : ∀ᶠ m in atTop, dist (b m) 0 < ε / 2 := by ++ exact hb_tendsto (Metric.ball_mem_nhds (0 : ℝ) (half_pos hε)) ++ have h_b_lt : ∀ᶠ m in atTop, b m < ε / 2 := by ++ refine h_ball.mono ?_ ++ intro m hm ++ have : |b m| < ε / 2 := by ++ simpa [Metric.mem_ball, Real.dist_eq] using hm ++ simpa [abs_of_nonneg (hb_nonneg m)] using this ++ ++ rcases eventually_atTop.1 hbound with ⟨M1, hM1⟩ ++ rcases eventually_atTop.1 h_b_lt with ⟨M2, hM2⟩ ++ let M := max M1 M2 ++ have hPM : ∀ᶠ n in atTop, M ≤ n → ‖a n - a M‖ ≤ b M := by ++ have h' := hM1 M (le_max_left _ _) ++ exact h' ++ have hMb : b M < ε / 2 := hM2 M (le_max_right _ _) ++ rcases eventually_atTop.1 hPM with ⟨N0, hN0⟩ ++ refine ⟨max N0 M, ?_⟩ ++ intro n hn k hk ++ have hMn : M ≤ n := le_trans (le_max_right _ _) hn ++ have hMk : M ≤ k := le_trans (le_max_right _ _) hk ++ have hN0n : N0 ≤ n := le_trans (le_max_left _ _) hn ++ have hN0k : N0 ≤ k := le_trans (le_max_left _ _) hk ++ have h1 : ‖a n - a M‖ ≤ b M := (hN0 n hN0n) hMn ++ have h2 : ‖a k - a M‖ ≤ b M := (hN0 k hN0k) hMk ++ ++ have htri : ‖a n - a k‖ ≤ ‖a n - a M‖ + ‖a M - a k‖ := by ++ have h := norm_add_le (a n - a M) (a M - a k) ++ simpa [sub_add_sub_cancel (a n) (a M) (a k)] using h ++ have h2' : ‖a M - a k‖ ≤ b M := by simpa [norm_sub_rev] using h2 ++ have hsumle : ‖a n - a k‖ ≤ b M + b M := ++ le_trans htri (add_le_add h1 h2') ++ have hsumlt : b M + b M < ε := by ++ have := add_lt_add hMb hMb ++ simpa [add_halves] using this ++ have : ‖a n - a k‖ < ε := lt_of_le_of_lt hsumle hsumlt ++ simpa [dist_eq_norm] using this ++ ++ rcases cauchySeq_tendsto_of_complete (u := a) hCauchy with ⟨l, hl⟩ ++ exact ⟨l, hl⟩ ++ ++lemma helper_limit_norm_le_of_uniform_bound {a : ℕ → ℂ} {l : ℂ} {B : ℝ} ++ (h : Tendsto a atTop (𝓝 l)) (hbound : ∀ n, ‖a n‖ ≤ B) : ‖l‖ ≤ B := by ++ have hnorm : Tendsto (fun n => ‖a n‖) atTop (𝓝 ‖l‖) := (Filter.Tendsto.norm h) ++ exact le_of_tendsto' hnorm (fun n => by simpa using hbound n) ++ ++lemma helper_one_le_of_mem_Icc {m n u : ℝ} (hm : 1 ≤ m) (hu : u ∈ Icc m n) : 1 ≤ u := by ++ exact le_trans hm hu.1 ++ ++lemma helper_intervalIntegrable_rpow_neg {ε : ℝ} {a b : ℝ} (_hε : 0 < ε) ++ (ha : 1 ≤ a) (hab : a ≤ b) : ++ IntervalIntegrable (fun u : ℝ => u ^ (-1 - ε)) volume a b := by ++ have h0notIcc : (0 : ℝ) ∉ Set.Icc a b := by ++ intro hx ++ have : ¬ a ≤ 0 := not_le.mpr (lt_of_lt_of_le zero_lt_one ha) ++ exact this hx.1 ++ have h0not : (0 : ℝ) ∉ Set.uIcc a b := by ++ simpa [uIcc_of_le hab] using h0notIcc ++ simpa using ++ (intervalIntegral.intervalIntegrable_rpow (μ := volume) (a := a) (b := b) (r := -1 - ε) ++ (Or.inr h0not)) ++ ++lemma helper_one_le_of_mem_Ioc {m n u : ℝ} (hm : 1 ≤ m) (hu : u ∈ Ioc m n) : 1 ≤ u := by ++ exact le_trans hm (le_of_lt hu.1) ++ ++lemma helper_integrableOn_of_bound_Ioc {m n : ℝ} {f : ℝ → ℂ} {g : ℝ → ℝ} ++ (hmeas : AEStronglyMeasurable f (volume.restrict (Ioc m n))) ++ (hbound : ∀ᵐ u ∂(volume.restrict (Ioc m n)), ‖f u‖ ≤ g u) ++ (hg : IntegrableOn g (Ioc m n) volume) : ++ IntegrableOn f (Ioc m n) volume := by ++ ++ let μ := volume.restrict (Ioc m n) ++ ++ have hf0 : Integrable (fun _ : ℝ => (0 : ℂ)) μ := by ++ simp ++ ++ have hg' : Integrable g μ := by ++ simpa [μ] using! hg ++ ++ have hmeas' : AEStronglyMeasurable f μ := by ++ simpa [μ] using hmeas ++ ++ have hineq : ∀ᵐ u ∂μ, ‖(0 : ℂ) - f u‖ ≤ g u := by ++ simpa [μ, sub_eq_add_neg, norm_neg] using hbound ++ ++ have hf : Integrable f μ := ++ MeasureTheory.integrable_of_norm_sub_le (μ := μ) hmeas' hf0 hg' hineq ++ ++ simpa [μ] using! hf ++ ++lemma helper_aestronglyMeasurable_kernel_Ioc (s : ℂ) {m n : ℝ} : ++ AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) ++ (volume.restrict (Ioc m n)) := by ++ ++ have h1 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) (volume.restrict (Ioc m n)) := by ++ have hmeas_fract : Measurable (Int.fract : ℝ → ℝ) := by ++ simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) ++ have hmeas_coe : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := ++ (Complex.measurable_ofReal.comp hmeas_fract) ++ exact hmeas_coe.aestronglyMeasurable ++ ++ have h2 : AEStronglyMeasurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) (volume.restrict (Ioc m n)) := by ++ have hmeas : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by ++ measurability ++ exact hmeas.aestronglyMeasurable ++ ++ simpa using! (MeasureTheory.AEStronglyMeasurable.mul h1 h2) ++ ++lemma helper_aebound_kernel_Ioc {ε : ℝ} (hε : 0 < ε) (s : ℂ) (hs : ε ≤ s.re) ++ {m n : ℝ} (hm : 1 ≤ m) (_hmn : m ≤ n) : ++ ∀ᵐ u ∂(volume.restrict (Ioc m n)), ++ ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε) := by ++ ++ refine ++ ((ae_restrict_iff' (μ := volume) (s := Ioc m n) ++ (p := fun u : ℝ => ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-1 - ε)) ++ measurableSet_Ioc)).2 ?_ ++ ++ refine Filter.Eventually.of_forall ?_ ++ intro u hu ++ have hu1 : 1 ≤ u := helper_one_le_of_mem_Ioc hm hu ++ simpa using (lem_integrandBoundeps ε hε u hu1 s hs) ++ ++lemma helper_integrableOn_rpow_neg_Ioc {ε : ℝ} (hε : 0 < ε) ++ {m n : ℝ} (hm : 1 ≤ m) (hmn : m ≤ n) : ++ IntegrableOn (fun u : ℝ => u ^ (-1 - ε)) (Ioc m n) volume := by ++ have hInt : IntervalIntegrable (fun u : ℝ => u ^ (-1 - ε)) volume m n := ++ helper_intervalIntegrable_rpow_neg (ε := ε) hε hm hmn ++ exact ++ (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) ++ (f := fun u : ℝ => u ^ (-1 - ε)) hmn).1 hInt ++ ++lemma helper_intervalIntegrable_of_integrableOn_Ioc {f : ℝ → ℂ} {m n : ℝ} ++ (hmn : m ≤ n) (hint : IntegrableOn f (Ioc m n) volume) : ++ IntervalIntegrable f volume m n := by ++ exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) ++ (a := m) (b := n) (f := f) hmn).2 hint ++ ++lemma helper_rpow_neg_nonneg_on {ε a b : ℝ} (_hε : 0 < ε) (ha : 1 ≤ a) (_hab : a ≤ b) : ++ ∀ u ∈ Icc a b, 0 ≤ u ^ (-1 - ε) := by ++ intro u hu ++ have h1u : 1 ≤ u := le_trans ha hu.1 ++ have h0u : 0 ≤ u := le_trans (by norm_num) h1u ++ exact Real.rpow_nonneg h0u (-1 - ε) ++ ++lemma helper_norm_integral_le_integral_norm_of_le {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] ++ {f : ℝ → E} {a b : ℝ} (h : a ≤ b) : ++ ‖∫ u in a..b, f u‖ ≤ ∫ u in a..b, ‖f u‖ := by ++ simpa using (intervalIntegral.norm_integral_le_integral_norm (μ := volume) (f := f) (a := a) (b := b) h) ++ ++lemma helper_tendsto_const_mul_zero (c : ℝ) {f : ℕ → ℝ} ++ (h : Tendsto f atTop (𝓝 0)) : Tendsto (fun n => c * f n) atTop (𝓝 0) := by ++ simpa using (Filter.Tendsto.const_mul (b := c) h) ++ ++lemma helper_limit_norm_le_of_eventual_bound {a : ℕ → ℂ} {l : ℂ} {B : ℝ} ++ (h : Tendsto a atTop (𝓝 l)) (hbound : ∀ᶠ n in atTop, ‖a n‖ ≤ B) : ‖l‖ ≤ B := by ++ have hnorm : Tendsto (fun n => ‖a n‖) atTop (𝓝 ‖l‖) := (Filter.Tendsto.norm h) ++ exact le_of_tendsto hnorm hbound ++ ++lemma lem_integralConvergence (ε : ℝ) (hε : 0 < ε) (s : ℂ) (hs : ε ≤ s.re) : ++ ∃ I : ℂ, ++ Tendsto ++ (fun N : ℕ => ++ ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) ++ atTop (𝓝 I) ++ ∧ ‖I‖ ≤ (1 / ε) := by ++ classical ++ ++ let fC : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) ++ let gR : ℝ → ℝ := fun u => u ^ (-1 - ε) ++ let a : ℕ → ℂ := fun N => ∫ u in (1 : ℝ)..(N : ℝ), fC u ++ let b : ℕ → ℝ := fun m => (1 / ε) * (m : ℝ) ^ (-ε) ++ ++ have hb_nonneg : ∀ m, 0 ≤ b m := by ++ intro m ++ have hm0 : (0 : ℝ) ≤ (m : ℝ) := by exact_mod_cast (Nat.zero_le m) ++ have hpow : 0 ≤ (m : ℝ) ^ (-ε) := Real.rpow_nonneg hm0 _ ++ have hpos : 0 ≤ 1 / ε := by exact le_of_lt (one_div_pos.mpr hε) ++ have := mul_le_mul_of_nonneg_left hpow hpos ++ simpa [b] using this ++ ++ have hb_tendsto : Tendsto b atTop (𝓝 0) := by ++ have hpow := helper_tendsto_nat_rpow_neg (ε := ε) hε ++ have hmul := helper_tendsto_const_mul_zero (c := (1 / ε)) hpow ++ simpa [b] using hmul ++ ++ have h_tail_pointwise : ∀ m n : ℕ, 1 ≤ m → m ≤ n → ‖a n - a m‖ ≤ b m := by ++ intro m n hm1 hmn ++ ++ have hmR : (1 : ℝ) ≤ (m : ℝ) := by exact_mod_cast hm1 ++ have hmnR : (m : ℝ) ≤ (n : ℝ) := by exact_mod_cast hmn ++ ++ have hInt_f_1n : IntervalIntegrable fC volume (1 : ℝ) (n : ℝ) := by ++ ++ have h1nNat : 1 ≤ n := le_trans hm1 hmn ++ have h1nR : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast h1nNat ++ have hmeas := helper_aestronglyMeasurable_kernel_Ioc (s := s) (m := (1 : ℝ)) (n := (n : ℝ)) ++ have hgIntOn : IntegrableOn gR (Ioc (1 : ℝ) (n : ℝ)) volume := ++ helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (n : ℝ)) (hm := by norm_num) (hmn := h1nR) ++ have hbound := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (n : ℝ)) (hm := by norm_num) (_hmn := h1nR) ++ have hintOn := helper_integrableOn_of_bound_Ioc (m := (1 : ℝ)) (n := (n : ℝ)) (f := fC) (g := gR) ++ (hmeas := hmeas) (hbound := hbound) (hg := hgIntOn) ++ exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) ++ (a := (1 : ℝ)) (b := (n : ℝ)) (f := fC) h1nR).2 hintOn ++ have hInt_f_1m : IntervalIntegrable fC volume (1 : ℝ) (m : ℝ) := by ++ have hmeas := helper_aestronglyMeasurable_kernel_Ioc (s := s) (m := (1 : ℝ)) (n := (m : ℝ)) ++ have hgIntOn : IntegrableOn gR (Ioc (1 : ℝ) (m : ℝ)) volume := ++ helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (m : ℝ)) (hm := by norm_num) (hmn := hmR) ++ have hbound := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (m : ℝ)) (hm := by norm_num) (_hmn := hmR) ++ have hintOn := helper_integrableOn_of_bound_Ioc (m := (1 : ℝ)) (n := (m : ℝ)) (f := fC) (g := gR) ++ (hmeas := hmeas) (hbound := hbound) (hg := hgIntOn) ++ exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) ++ (a := (1 : ℝ)) (b := (m : ℝ)) (f := fC) hmR).2 hintOn ++ have hdiff := helper_integral_interval_sub_left ++ (E := ℂ) (f := fC) (a := (1 : ℝ)) (b := (n : ℝ)) (c := (m : ℝ)) ++ (hab := hInt_f_1n) (hac := hInt_f_1m) ++ have hsub : a n - a m = ∫ u in (m : ℝ)..(n : ℝ), fC u := by ++ simpa [a] using hdiff ++ ++ have hbound_Ioc := helper_aebound_kernel_Ioc (ε := ε) hε s hs ++ (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (_hmn := hmnR) ++ have hbound_Ioc_imp : ∀ᵐ t ∂(volume), t ∈ Ioc (m : ℝ) (n : ℝ) → ‖fC t‖ ≤ gR t := by ++ simpa [fC, gR] using ++ ((ae_restrict_iff' (μ := volume) (s := Ioc (m : ℝ) (n : ℝ)) measurableSet_Ioc).1 hbound_Ioc) ++ ++ have hgInt_mn : IntervalIntegrable gR volume (m : ℝ) (n : ℝ) := ++ (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) ++ (a := (m : ℝ)) (b := (n : ℝ)) (f := gR) hmnR).2 ++ (helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (hmn := hmnR)) ++ ++ have h1 : ‖∫ u in (m : ℝ)..(n : ℝ), fC u‖ ≤ ∫ u in (m : ℝ)..(n : ℝ), gR u := by ++ simpa using ++ (intervalIntegral.norm_integral_le_of_norm_le (μ := volume) ++ (a := (m : ℝ)) (b := (n : ℝ)) (f := fC) (g := gR) ++ (hab := hmnR) (h := hbound_Ioc_imp) (hbound := hgInt_mn)) ++ ++ have h3 : ∫ u in (m : ℝ)..(n : ℝ), gR u ≤ (1 / ε) * (m : ℝ) ^ (-ε) := ++ helper_integral_rpow_le (ε := ε) hε (m := (m : ℝ)) (n := (n : ℝ)) (hm := hmR) (hmn := hmnR) ++ ++ have : ‖∫ u in (m : ℝ)..(n : ℝ), fC u‖ ≤ (1 / ε) * (m : ℝ) ^ (-ε) := ++ le_trans h1 h3 ++ simpa [hsub, b] using this ++ ++ have hbound : ∀ᶠ m in atTop, ∀ᶠ n in atTop, m ≤ n → ‖a n - a m‖ ≤ b m := by ++ have h_m_ge1 : ∀ᶠ m in atTop, 1 ≤ m := eventually_ge_atTop 1 ++ refine h_m_ge1.mono ?_ ++ intro m hm1 ++ have h_n_ge_m : ∀ᶠ n in atTop, m ≤ n := eventually_ge_atTop m ++ exact h_n_ge_m.mono (fun n hmn => by intro hle; exact h_tail_pointwise m n hm1 hle) ++ ++ rcases helper_exists_limit_of_tail_bound a b hb_nonneg hb_tendsto hbound with ⟨I, hT⟩ ++ ++ have h_eventual_bound : ∀ᶠ N in atTop, ‖a N‖ ≤ (1 / ε) := by ++ have hN1 : ∀ᶠ N in atTop, 1 ≤ N := eventually_ge_atTop 1 ++ refine hN1.mono ?_ ++ intro N hNge1 ++ have h1N : (1 : ℝ) ≤ (N : ℝ) := by exact_mod_cast hNge1 ++ ++ have hbound_Ioc := helper_aebound_kernel_Ioc (ε := ε) hε s hs (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (_hmn := h1N) ++ have hbound_Ioc_imp : ∀ᵐ t ∂(volume), t ∈ Ioc (1 : ℝ) (N : ℝ) → ‖fC t‖ ≤ gR t := by ++ simpa [fC, gR] using ++ ((ae_restrict_iff' (μ := volume) (s := Ioc (1 : ℝ) (N : ℝ)) measurableSet_Ioc).1 hbound_Ioc) ++ ++ have hgInt_1N : IntervalIntegrable gR volume (1 : ℝ) (N : ℝ) := ++ (intervalIntegrable_iff_integrableOn_Ioc_of_le (μ := volume) ++ (a := (1 : ℝ)) (b := (N : ℝ)) (f := gR) h1N).2 ++ (helper_integrableOn_rpow_neg_Ioc (ε := ε) hε (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (hmn := h1N)) ++ ++ have h1 : ‖∫ u in (1 : ℝ)..(N : ℝ), fC u‖ ≤ ∫ u in (1 : ℝ)..(N : ℝ), gR u := by ++ simpa [a] using ++ (intervalIntegral.norm_integral_le_of_norm_le (μ := volume) ++ (a := (1 : ℝ)) (b := (N : ℝ)) (f := fC) (g := gR) ++ (hab := h1N) (h := hbound_Ioc_imp) (hbound := hgInt_1N)) ++ ++ have h3 : ∫ u in (1 : ℝ)..(N : ℝ), gR u ≤ (1 / ε) := by ++ have := helper_integral_rpow_le (ε := ε) hε (m := (1 : ℝ)) (n := (N : ℝ)) (hm := by norm_num) (hmn := h1N) ++ simpa [one_div, Real.one_rpow, one_mul] using this ++ have : ‖a N‖ ≤ (1 / ε) := by exact le_trans h1 h3 ++ exact this ++ ++ have hIle : ‖I‖ ≤ (1 / ε) := ++ helper_limit_norm_le_of_eventual_bound (a := a) (l := I) (B := 1 / ε) hT h_eventual_bound ++ ++ refine ⟨I, ?_, hIle⟩ ++ simpa [a, fC] using hT ++ ++lemma helper_tendsto_zetaPartialSum_to_zeta (s : ℂ) (hs : 1 < s.re) : ++ Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) := by ++ classical ++ ++ set g : ℕ → ℂ := fun n => if n = 0 then 0 else (n : ℂ) ^ (-s) ++ set h : ℕ → ℂ := fun n => (n + 1 : ℂ) ^ (-s) ++ ++ have hsne : s ≠ 0 := by ++ intro h0 ++ have : (0 : ℝ) < s.re := lt_trans (show (0 : ℝ) < 1 by norm_num) hs ++ simpa [h0] using (ne_of_gt this) ++ ++ have hsum_div : Summable (fun n : ℕ => 1 / (n : ℂ) ^ s) := ++ (Complex.summable_one_div_nat_cpow (p := s)).2 hs ++ have hgSumm : Summable g := by ++ simpa [g, one_div_nat_cpow_eq_ite_cpow_neg s hsne] using hsum_div ++ ++ have h_eq_tail : (fun n => g (n + 1)) = h := by ++ funext n; simp [g, h] ++ have hhSumm : Summable h := by ++ have : Summable (fun n : ℕ => g (n + 1)) := (summable_nat_add_iff (f := g) (k := 1)).2 hgSumm ++ simpa [h_eq_tail] using this ++ ++ have hg0 : g 0 = 0 := by simp [g] ++ have h_tsum_eq : (∑' n : ℕ, h n) = ∑' n : ℕ, g n := by ++ have hzero_add := (Summable.tsum_eq_zero_add (f := g) hgSumm) ++ ++ have : (∑' n : ℕ, g n) = ∑' n : ℕ, g (n + 1) := by ++ simpa [hg0, add_comm] using hzero_add ++ simpa [h_eq_tail] using this.symm ++ ++ have hzeta : riemannZeta s = ∑' n : ℕ, g n := by ++ simpa [g] using lem_zetaLimit s hs ++ ++ have h_tendsto : Tendsto (fun N : ℕ => ∑ n ∈ Finset.range N, h n) atTop (𝓝 (∑' n, h n)) := ++ (Summable.tendsto_sum_tsum_nat hhSumm) ++ ++ have htsumeq : (∑' n, h n) = riemannZeta s := h_tsum_eq.trans hzeta.symm ++ simpa [zetaPartialSum, htsumeq, h] using h_tendsto ++ ++lemma integrableOn_of_ae_bound {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] ++ {f : ℝ → E} {g : ℝ → ℝ} {s : Set ℝ} ++ (hfm : AEStronglyMeasurable f (volume.restrict s)) ++ (hgint : IntegrableOn g s) ++ (hbound : ∀ᵐ x ∂(volume.restrict s), ‖f x‖ ≤ g x) : ++ IntegrableOn f s := by ++ have hg' : Integrable g (volume.restrict s) := by ++ simpa [IntegrableOn] using hgint ++ have hf' : Integrable f (volume.restrict s) := ++ MeasureTheory.Integrable.mono' (μ := volume.restrict s) hg' hfm hbound ++ simpa [IntegrableOn] using hf' ++ ++lemma kernel_aestronglyMeasurable_on_Ioi (s : ℂ) (a : ℝ) : ++ AEStronglyMeasurable (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (volume.restrict (Ioi a)) := by ++ ++ have hmeas_fract : Measurable (fun u : ℝ => (Int.fract u : ℝ)) := by ++ simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) ++ have hmeas_fractC : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := ++ hmeas_fract.complex_ofReal ++ have hmeas_cpow : Measurable (fun u : ℝ => (u : ℂ) ^ (-s - 1)) := by ++ have hmeas_ofReal : Measurable (fun u : ℝ => (u : ℂ)) := Complex.measurable_ofReal ++ simpa using hmeas_ofReal.pow_const (-s - 1) ++ have hmeas : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)) := ++ hmeas_fractC.mul hmeas_cpow ++ ++ simpa using hmeas.aestronglyMeasurable ++ ++lemma kernel_ae_bound_on_Ioi (s : ℂ) : ++ ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), ++ ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by ++ ++ let p : ℝ → Prop := fun u => ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) ++ ++ have hAll : ∀ u ∈ Ioi (1 : ℝ), p u := by ++ intro u hu ++ have hu' : (1 : ℝ) ≤ u := le_of_lt hu ++ dsimp [p] ++ simpa using (lem_integrandBound u hu' s) ++ ++ have hAE : ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → p u := ++ MeasureTheory.ae_of_all _ hAll ++ ++ have hiff : ++ (∀ᵐ u ∂volume.restrict (Ioi (1 : ℝ)), p u) ↔ ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → p u := ++ (MeasureTheory.ae_restrict_iff' (μ := volume) (s := Ioi (1 : ℝ)) (p := p)) measurableSet_Ioi ++ exact hiff.mpr hAE ++ ++lemma helper_intervalIntegral_tendstoIoi_kernel (s : ℂ) (hs : 1 < s.re) : ++ Tendsto (fun N : ℕ => ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop ++ (𝓝 (∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := by ++ ++ have hfm : AEStronglyMeasurable (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) ++ (volume.restrict (Ioi (1 : ℝ))) := by ++ simpa using kernel_aestronglyMeasurable_on_Ioi (s := s) (a := (1 : ℝ)) ++ have hbound' : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), ++ ‖(Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ ≤ u ^ (-s.re - 1) := by ++ ++ simpa using kernel_ae_bound_on_Ioi (s := s) ++ have hlt : (-s.re - 1) < (-1 : ℝ) := by linarith ++ have hpos : 0 < (1 : ℝ) := by norm_num ++ have hgint : IntegrableOn (fun u : ℝ => u ^ (-s.re - 1)) (Ioi (1 : ℝ)) := by ++ simpa using integrableOn_Ioi_rpow_of_lt (a := (-s.re - 1)) (c := (1 : ℝ)) hlt hpos ++ have hint : IntegrableOn (fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (Ioi (1 : ℝ)) := by ++ ++ exact integrableOn_of_ae_bound (s := Ioi (1 : ℝ)) hfm hgint hbound' ++ ++ have hb : Tendsto (fun N : ℕ => (N : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop ++ simpa using ++ (MeasureTheory.intervalIntegral_tendsto_integral_Ioi (μ := volume) ++ (f := fun u : ℝ => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) (a := (1 : ℝ)) ++ (b := fun N : ℕ => (N : ℝ)) hint hb) ++ ++lemma helper_zetaNfinal (s : ℂ) (hs : s ≠ 1) (N : ℕ) (hN : 1 ≤ N) : ++ zetaPartialSum s N ++ = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) ++ - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by ++ simpa using (lem_zetaNfinal s hs N hN) ++ ++lemma helper_eventually_eq_from_zetaNfinal (s : ℂ) (hs : s ≠ 1) : ++ ∀ᶠ N in atTop, ++ zetaPartialSum s N ++ = (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) ++ - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by ++ have hEv : ∀ᶠ N : ℕ in atTop, 1 ≤ N := Filter.eventually_ge_atTop (1 : ℕ) ++ refine hEv.mono ?_ ++ intro N hN ++ simpa using (helper_zetaNfinal s hs N hN) ++ ++lemma helper_limit_scaled_cpow (s : ℂ) (hs : 1 < s.re) (_hsne : s ≠ 1) : ++ Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s) / (1 - s)) atTop (𝓝 0) := by ++ have h := lem_limitTerm1 s hs ++ have h' := (Filter.Tendsto.const_mul (b := (1 / (1 - s))) h) ++ simpa [div_eq_mul_inv, mul_comm] using h' ++ ++lemma helper_tendsto_const_mul {f : ℕ → ℂ} {l : ℂ} (c : ℂ) ++ (h : Tendsto f atTop (𝓝 l)) : Tendsto (fun n => c * f n) atTop (𝓝 (c * l)) := by ++ exact h.const_mul c ++ ++lemma helper_tendsto_add {f g : ℕ → ℂ} {a b : ℂ} ++ (hf : Tendsto f atTop (𝓝 a)) (hg : Tendsto g atTop (𝓝 b)) : ++ Tendsto (fun n => f n + g n) atTop (𝓝 (a + b)) := by ++ ++ have hpair : Tendsto (fun n => (f n, g n)) atTop (𝓝 (a, b)) := by ++ simpa using (hf.prodMk_nhds hg) ++ have hadd : Continuous (fun p : ℂ × ℂ => p.1 + p.2) := by ++ simpa using! (continuous_fst.add continuous_snd) ++ simpa using! ((hadd.tendsto (a, b)).comp hpair) ++ ++lemma helper_tendsto_neg {f : ℕ → ℂ} {a : ℂ} ++ (hf : Tendsto f atTop (𝓝 a)) : Tendsto (fun n => - f n) atTop (𝓝 (-a)) := by ++ simpa only [Function.comp_def] using! ((continuous_neg.tendsto a).comp hf) ++ ++lemma helper_tendsto_sub {f g : ℕ → ℂ} {a b : ℂ} ++ (hf : Tendsto f atTop (𝓝 a)) (hg : Tendsto g atTop (𝓝 b)) : ++ Tendsto (fun n => f n - g n) atTop (𝓝 (a - b)) := by ++ have hneg : Tendsto (fun n => - g n) atTop (𝓝 (-b)) := ++ helper_tendsto_neg (f := g) (a := b) hg ++ simpa [sub_eq_add_neg] using ++ helper_tendsto_add (f := f) (g := fun n => - g n) hf hneg ++ ++lemma lem_zetaFormula (s : ℂ) (hs : 1 < s.re) : ++ riemannZeta s ++ = 1 + 1 / (s - 1) ++ - s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) := by ++ classical ++ ++ have hsne : s ≠ 1 := by ++ intro h ++ have hlt : 1 < (1 : ℝ) := by simp [h, Complex.one_re] at hs ++ exact (lt_irrefl _ ) hlt ++ ++ let G : ℕ → ℂ := fun N => ++ (N : ℂ) ^ (1 - s) / (1 - s) + 1 + 1 / (s - 1) ++ - s * ∫ u in (1 : ℝ)..N, (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) ++ ++ have hEv : ∀ᶠ N in atTop, zetaPartialSum s N = G N := by ++ simpa [G] using helper_eventually_eq_from_zetaNfinal s hsne ++ ++ have h_ps : Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) := ++ helper_tendsto_zetaPartialSum_to_zeta s hs ++ ++ have hG_to_zeta : Tendsto G atTop (𝓝 (riemannZeta s)) := by ++ have hcongr := (Filter.tendsto_congr' (hl := hEv) : ++ Tendsto (fun N : ℕ => zetaPartialSum s N) atTop (𝓝 (riemannZeta s)) ↔ ++ Tendsto G atTop (𝓝 (riemannZeta s))) ++ exact hcongr.mp h_ps ++ ++ have hA : Tendsto (fun N : ℕ => (N : ℂ) ^ (1 - s) / (1 - s)) atTop (𝓝 0) := ++ helper_limit_scaled_cpow s hs hsne ++ ++ have hK : Tendsto (fun _ : ℕ => (1 : ℂ) + 1 / (s - 1)) atTop (𝓝 ((1 : ℂ) + 1 / (s - 1))) := ++ tendsto_const_nhds ++ ++ have hInt : Tendsto (fun N : ℕ => ∫ u in (1 : ℝ)..N, ++ (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop ++ (𝓝 (∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := ++ helper_intervalIntegral_tendstoIoi_kernel s hs ++ ++ have hIntMul : Tendsto (fun N : ℕ => s * ∫ u in (1 : ℝ)..N, ++ (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) atTop ++ (𝓝 (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := ++ helper_tendsto_const_mul (c := s) hInt ++ ++ set Aseq : ℕ → ℂ := fun N => (N : ℂ) ^ (1 - s) / (1 - s) ++ set Kseq : ℕ → ℂ := fun _ => (1 : ℂ) + 1 / (s - 1) ++ have hA2 : Tendsto Aseq atTop (𝓝 0) := by simpa [Aseq] using hA ++ have hK2 : Tendsto Kseq atTop (𝓝 ((1 : ℂ) + 1 / (s - 1))) := by simp [Kseq] ++ have hSum : Tendsto (fun N => Aseq N + Kseq N) atTop (𝓝 (0 + ((1 : ℂ) + 1 / (s - 1)))) := ++ helper_tendsto_add (hf := hA2) (hg := hK2) ++ set Iseq : ℕ → ℂ := fun N => s * ∫ u in (1 : ℝ)..N, ++ (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) ++ have hIseq : Tendsto Iseq atTop (𝓝 (s * ∫ u in Ioi (1 : ℝ), ++ (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1))) := by ++ simpa [Iseq] using hIntMul ++ have hG_limit : Tendsto G atTop ++ (𝓝 ((0 + ((1 : ℂ) + 1 / (s - 1))) ++ - (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)))) := by ++ have hSub := helper_tendsto_sub (hf := hSum) (hg := hIseq) ++ ++ have hGdef : (fun N => (Aseq N + Kseq N) - Iseq N) = G := by ++ funext N; simp [Aseq, Kseq, Iseq, G, add_comm, add_left_comm, add_assoc, sub_eq_add_neg] ++ simpa [hGdef] ++ using hSub ++ ++ have huniq := ++ tendsto_nhds_unique (f := G) (l := atTop) ++ (a := riemannZeta s) ++ (b := ((0 + ((1 : ℂ) + 1 / (s - 1))) ++ - (s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)))) ++ (ha := hG_to_zeta) (hb := hG_limit) ++ ++ simpa [zero_add, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using huniq ++ ++lemma lem_zetaanalOnnot1 : AnalyticOn ℂ riemannZeta {s : ℂ | s ≠ 1} := by ++ ++ have hset : {s : ℂ | s ≠ 1} = ({1} : Set ℂ)ᶜ := by ++ ext z; simp ++ have hopen : IsOpen ({s : ℂ | s ≠ 1}) := by ++ simp [hset] ++ ++ have hdiff : DifferentiableOn ℂ riemannZeta {s : ℂ | s ≠ 1} := by ++ intro z hz ++ ++ simpa using (differentiableAt_riemannZeta (by simpa [Set.mem_ofPred_eq] using hz)).differentiableWithinAt ++ simpa [Complex.analyticOn_iff_differentiableOn hopen] using hdiff ++ ++lemma lem_zetaanalS : (let S := {s : ℂ | s ≠ 1}; AnalyticOn ℂ riemannZeta S) := by exact lem_zetaanalOnnot1 ++ ++lemma lem_S_isOpen : (let S := {s : ℂ | s ≠ 1}; IsOpen S) := by ++ ++ have h : {s : ℂ | s ≠ 1} = {(1 : ℂ)}ᶜ := by ++ ext s; simp [Set.mem_compl_iff, Set.mem_singleton_iff] ++ rw [h] ++ exact isOpen_compl_singleton ++ ++lemma lem_T_isOpen : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsOpen T) := by ++ ++ show IsOpen {s : ℂ | s ≠ 1 ∧ 1/10 < s.re} ++ ++ apply IsOpen.and ++ · ++ exact lem_S_isOpen ++ · ++ ++ have h_eq : {s : ℂ | 1/10 < s.re} = Complex.re ⁻¹' (Set.Ioi (1/10)) := by ++ ext s ++ simp [Set.mem_preimage, Set.mem_Ioi] ++ rw [h_eq] ++ exact Complex.continuous_re.isOpen_preimage (Set.Ioi (1/10)) isOpen_Ioi ++ ++lemma helper_T_open : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsOpen T) := by ++ classical ++ ++ intro S T ++ ++ have hSopen : IsOpen S := by simpa using lem_S_isOpen ++ ++ have hHalfplane : IsOpen {s : ℂ | (1 / 10 : ℝ) < s.re} := by ++ have : IsOpen ((fun s : ℂ => s.re) ⁻¹' Ioi (1 / 10 : ℝ)) := ++ IsOpen.preimage (hf := Complex.continuous_re) (t := Ioi (1 / 10 : ℝ)) (h := isOpen_Ioi) ++ simpa [Set.preimage, Ioi] using this ++ ++ have hInter : IsOpen (S ∩ {s : ℂ | (1 / 10 : ℝ) < s.re}) := hSopen.inter hHalfplane ++ ++ simpa [T, Set.ofPred_and] using hInter ++ ++lemma open_mem_interior_of_isOpen {X : Type*} [TopologicalSpace X] {U : Set X} (hU : IsOpen U) {x : X} (hx : x ∈ U) : x ∈ interior U := by simpa [hU.interior_eq] using hx ++ ++lemma isOpen_halfplane_re_gt (a : ℝ) : IsOpen {z : ℂ | a < z.re} := by ++ simpa [Set.mem_ofPred_eq] using ++ (isOpen_lt (hf := continuous_const) (hg := Complex.continuous_re)) ++ ++lemma T_eq_inter_S_half (S T : Set ℂ) (_hS : S = {s : ℂ | s ≠ 1}) (hT : T = {s : ℂ | s ∈ S ∧ (1/10 : ℝ) < s.re}) : ++ T = S ∩ {s : ℂ | (1/10 : ℝ) < s.re} := by ++ classical ++ ext z ++ simp [hT, Set.inter_def] ++ ++lemma inter_compl_singleton_eq_diff {α : Type*} [DecidableEq α] (A : Set α) (x : α) : ++ A ∩ ({x} : Set α)ᶜ = A \ ({x} : Set α) := by ++ ext z; simp [Set.mem_inter_iff, Set.mem_singleton_iff] ++ ++lemma joinedIn_of_path_forall_mem {s : Set ℂ} {x y : ℂ} ++ (γ : Path x y) (hγ : ∀ t, γ t ∈ s) : JoinedIn s x y := by ++ exact ⟨γ, hγ⟩ ++ ++lemma path_forall_mem_symm {x y : ℂ} {P : ℂ → Prop} (γ : Path x y) ++ (h : ∀ t, P (γ t)) : ∀ t, P (γ.symm t) := by ++ intro t ++ simpa [Path.symm] using (h (unitInterval.symm t)) ++ ++lemma isPathConnected_punctured_halfplane_re_gt (a : ℝ) (p : ℂ) (hp : a < p.re) : ++ IsPathConnected ({z : ℂ | a < z.re} \ ({p} : Set ℂ)) := by ++ classical ++ ++ let S1 : Set ℂ := {z : ℂ | a < z.re ∧ z.im < p.im} ++ let S2 : Set ℂ := {z : ℂ | a < z.re ∧ z.re < p.re} ++ let S3 : Set ℂ := {z : ℂ | a < z.re ∧ p.im < z.im} ++ let S4 : Set ℂ := {z : ℂ | p.re < z.re} ++ ++ have hS1conv : Convex ℝ S1 := by ++ have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) ++ have h2 : Convex ℝ {z : ℂ | z.im < p.im} := convex_halfSpace_im_lt (r := p.im) ++ simpa [S1, Set.ofPred_and] using h1.inter h2 ++ have hS2conv : Convex ℝ S2 := by ++ have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) ++ have h2 : Convex ℝ {z : ℂ | z.re < p.re} := convex_halfSpace_re_lt (r := p.re) ++ simpa [S2, Set.ofPred_and] using h1.inter h2 ++ have hS3conv : Convex ℝ S3 := by ++ have h1 : Convex ℝ {z : ℂ | a < z.re} := convex_halfSpace_re_gt (r := a) ++ have h2 : Convex ℝ {z : ℂ | p.im < z.im} := convex_halfSpace_im_gt (r := p.im) ++ simpa [S3, Set.ofPred_and] using h1.inter h2 ++ have hS4conv : Convex ℝ S4 := by ++ simpa [S4] using (convex_halfSpace_re_gt (r := p.re)) ++ ++ have hS1ne : S1.Nonempty := by ++ refine ⟨((max a p.re) + 1 : ℝ) + (p.im - 1) * Complex.I, ?_⟩ ++ have h1 : a < (max a p.re) + 1 := by ++ have : a ≤ max a p.re := le_max_left _ _ ++ exact lt_of_le_of_lt this (by linarith) ++ have h2 : (p.im - 1) < p.im := by linarith ++ simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] ++ using And.intro h1 h2 ++ have hS2ne : S2.Nonempty := by ++ refine ⟨((a + p.re) / 2 : ℝ) + (p.im : ℝ) * Complex.I, ?_⟩ ++ have h1 : a < (a + p.re) / 2 := by linarith ++ have h2 : (a + p.re) / 2 < p.re := by linarith ++ simpa [S2, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] ++ using And.intro h1 h2 ++ have hS3ne : S3.Nonempty := by ++ refine ⟨((max a p.re) + 1 : ℝ) + (p.im + 1) * Complex.I, ?_⟩ ++ have h1 : a < (max a p.re) + 1 := by ++ have : a ≤ max a p.re := le_max_left _ _ ++ exact lt_of_le_of_lt this (by linarith) ++ have h2 : p.im < (p.im + 1) := by linarith ++ simpa [S3, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] ++ using And.intro h1 h2 ++ have hS4ne : S4.Nonempty := by ++ refine ⟨(p.re + 1 : ℝ) + (0 : ℝ) * Complex.I, ?_⟩ ++ have : p.re < p.re + 1 := by linarith ++ simp [S4, Complex.add_re] ++ ++ have hS1pc : IsPathConnected S1 := (hS1conv.isPathConnected hS1ne) ++ have hS2pc : IsPathConnected S2 := (hS2conv.isPathConnected hS2ne) ++ have hS3pc : IsPathConnected S3 := (hS3conv.isPathConnected hS3ne) ++ have hS4pc : IsPathConnected S4 := (hS4conv.isPathConnected hS4ne) ++ ++ let A : Set ℂ := S1 ∪ S2 ++ let B : Set ℂ := S3 ∪ S4 ++ ++ have hS1S2_int : (S1 ∩ S2).Nonempty := by ++ refine ⟨((a + p.re) / 2 : ℝ) + (p.im - (1/2)) * Complex.I, ?_⟩ ++ have h1a : a < (a + p.re) / 2 := by linarith ++ have h1b : (p.im - (1/2)) < p.im := by linarith ++ have h2a : a < (a + p.re) / 2 := by linarith ++ have h2b : (a + p.re) / 2 < p.re := by linarith ++ constructor ++ · ++ simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] ++ using And.intro h1a h1b ++ · ++ simpa [S2, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] ++ using And.intro h2a h2b ++ have hApc : IsPathConnected A := ++ IsPathConnected.union (U := S1) (V := S2) hS1pc hS2pc (by ++ rcases hS1S2_int with ⟨z, hz⟩; exact ⟨z, hz⟩) ++ have hS3S4_int : (S3 ∩ S4).Nonempty := by ++ refine ⟨(p.re + 1 : ℝ) + (p.im + 1) * Complex.I, ?_⟩ ++ have h3a : a < p.re + 1 := lt_trans hp (by linarith) ++ have h3b : p.im < p.im + 1 := by linarith ++ have h4 : p.re < p.re + 1 := by linarith ++ constructor ++ · ++ simpa [S3, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] ++ using And.intro h3a h3b ++ · ++ simp [S4, Complex.add_re, Complex.mul_re] ++ have hBpc : IsPathConnected B := ++ IsPathConnected.union (U := S3) (V := S4) hS3pc hS4pc (by ++ rcases hS3S4_int with ⟨z, hz⟩; exact ⟨z, hz⟩) ++ ++ have hABint : (A ∩ B).Nonempty := by ++ refine ⟨(p.re + 1 : ℝ) + (p.im - 1) * Complex.I, ?_⟩ ++ constructor ++ · ++ refine Or.inl ?_ ++ have h1 : a < p.re + 1 := lt_trans hp (by linarith) ++ have h2 : (p.im - 1) < p.im := by linarith ++ simpa [S1, Complex.add_re, Complex.add_im, Complex.mul_re, Complex.mul_im] ++ using And.intro h1 h2 ++ · ++ refine Or.inr ?_ ++ have h4 : p.re < p.re + 1 := by linarith ++ simp [S4, Complex.add_re, Complex.mul_re] ++ ++ have hUnionPC : IsPathConnected (A ∪ B) := ++ IsPathConnected.union (U := A) (V := B) hApc hBpc (by ++ rcases hABint with ⟨z, hz⟩; exact ⟨z, hz⟩) ++ ++ have hcover : ({z : ℂ | a < z.re} \ ({p} : Set ℂ)) = A ∪ B := by ++ ext z; constructor ++ · intro hz ++ rcases hz with ⟨hzH, hznot⟩ ++ ++ rcases lt_trichotomy z.re p.re with hlt | heq | hgt ++ · ++ exact Or.inl (Or.inr ⟨hzH, hlt⟩) ++ · ++ rcases lt_trichotomy z.im p.im with himlt | himeq | himgt ++ · ++ exact Or.inl (Or.inl ⟨hzH, himlt⟩) ++ · ++ have hz_eq : z = p := by ++ ++ have hzdecomp : (z.re : ℂ) + (z.im : ℝ) * Complex.I = z := by ++ simp ++ have hpdecomp : (p.re : ℂ) + (p.im : ℝ) * Complex.I = p := by ++ simp ++ have : (z.re : ℂ) + (z.im : ℝ) * Complex.I = (p.re : ℂ) + (p.im : ℝ) * Complex.I := by ++ ++ simp [heq, himeq] ++ ++ simpa [hzdecomp, hpdecomp] using this ++ have : z ∈ ({p} : Set ℂ) := by simp [Set.mem_singleton_iff, hz_eq] ++ exact (hznot this).elim ++ · ++ exact Or.inr (Or.inl ⟨hzH, himgt⟩) ++ · ++ exact Or.inr (Or.inr hgt) ++ · intro hz ++ ++ have hzH : a < z.re := by ++ rcases hz with hA | hB ++ · rcases hA with hS1 | hS2 ++ · exact hS1.1 ++ · exact hS2.1 ++ · rcases hB with hS3 | hS4 ++ · exact hS3.1 ++ · exact lt_trans hp hS4 ++ have hzneq : z ≠ p := by ++ rcases hz with hA | hB ++ · rcases hA with hS1 | hS2 ++ · ++ intro h ++ have : z.im = p.im := by simp [h] ++ have : z.im < z.im := by simpa [this] using hS1.2 ++ exact lt_irrefl _ this ++ · ++ intro h ++ have : z.re = p.re := by simp [h] ++ exact (ne_of_lt hS2.2) this ++ · rcases hB with hS3 | hS4 ++ · ++ intro h ++ have : p.im = z.im := by simp [h] ++ have : z.im < z.im := by simpa [this] using hS3.2 ++ exact lt_irrefl _ this ++ · ++ intro h ++ have : p.re = z.re := by simp [h] ++ exact (ne_of_gt hS4) this.symm ++ exact And.intro hzH (by intro hzmem; exact hzneq (by simpa [Set.mem_singleton_iff] using hzmem)) ++ ++ simpa [hcover] using hUnionPC ++ ++lemma inter_compl_singleton_eq_diff' {α : Type*} [DecidableEq α] (A : Set α) (x : α) : ++ A ∩ ({x} : Set α)ᶜ = A \ ({x} : Set α) := by ++ ext z; simp [Set.mem_inter_iff, Set.mem_singleton_iff] ++ ++lemma lem_T_isPreconnected : (let S := {s : ℂ | s ≠ 1}; let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re}; IsPreconnected T) := by ++ classical ++ ++ let S : Set ℂ := {s : ℂ | s ≠ 1} ++ let T : Set ℂ := {s : ℂ | s ∈ S ∧ (1/10 : ℝ) < s.re} ++ ++ have hTinter : T = S ∩ {s : ℂ | (1/10 : ℝ) < s.re} := by ++ simpa using (T_eq_inter_S_half S T (by rfl) (by rfl)) ++ ++ have hScompl : S = ({(1 : ℂ)} : Set ℂ)ᶜ := by ++ ext z; simp [S] ++ ++ have hTdiff : T = {s : ℂ | (1/10 : ℝ) < s.re} \ (({(1 : ℂ)} : Set ℂ)) := by ++ have : T = {s : ℂ | (1/10 : ℝ) < s.re} ∩ S := by ++ simpa [Set.inter_comm] using hTinter ++ ++ simpa [hScompl, inter_compl_singleton_eq_diff] using this ++ ++ have hp : (1/10 : ℝ) < (1 : ℂ).re := by ++ simpa using (by norm_num : (1/10 : ℝ) < (1 : ℝ)) ++ ++ have hpc : IsPathConnected ({z : ℂ | (1/10 : ℝ) < z.re} \ (({(1 : ℂ)} : Set ℂ))) := ++ isPathConnected_punctured_halfplane_re_gt (a := (1/10 : ℝ)) (p := (1 : ℂ)) (hp := hp) ++ ++ have hpcT : IsPathConnected T := by ++ simpa [hTdiff] using hpc ++ ++ have hconnT : IsConnected T := hpcT.isConnected ++ exact (IsConnected.isPreconnected (s := T) hconnT) ++ ++lemma hasDerivAt_param_cpow_neg_one (u : ℝ) (hu : 0 < u) (z : ℂ) : ++ HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) (-(Real.log u) * (u : ℂ) ^ (-z - 1)) z := by ++ ++ have hcu : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (ne_of_gt hu) ++ ++ have hId : HasDerivAt (fun w : ℂ => w) (1 : ℂ) z := by simpa using! (hasDerivAt_id (x := z)) ++ have hneg : HasDerivAt (fun w : ℂ => -w) (-1 : ℂ) z := by simpa using! hId.neg ++ have hf : HasDerivAt (fun w : ℂ => -w - 1) (-1 : ℂ) z := by ++ ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hneg.add_const (-1 : ℂ) ++ ++ have h := (HasDerivAt.const_cpow (c := (u : ℂ)) (hf := hf) (h0 := Or.inl hcu)) ++ ++ have clog : Complex.log (u : ℂ) = (Real.log u : ℂ) := by ++ simpa using (Complex.ofReal_log (x := u) (hx := le_of_lt hu)).symm ++ simpa [clog, mul_comm, mul_left_comm, mul_assoc] using h ++ ++lemma integrableOn_t_mul_exp_neg (ε : ℝ) (hε : 0 < ε) : IntegrableOn (fun t : ℝ => t * Real.exp (- ε * t)) (Ioi (0 : ℝ)) := by ++ ++ have h := integrableOn_rpow_mul_exp_neg_mul_rpow (p := (1 : ℝ)) (s := (1 : ℝ)) (b := ε) ++ (hs := by norm_num) (hp := by norm_num) (hb := hε) ++ ++ simpa [Real.rpow_one] using h ++ ++lemma aestronglyMeasurable_kernel_param_deriv (z : ℂ) : ++ AEStronglyMeasurable (fun u : ℝ => -((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1))) (volume.restrict (Ioi (1 : ℝ))) := by ++ ++ let μ := volume.restrict (Ioi (1 : ℝ)) ++ ++ have hmeas_logR : Measurable (fun u : ℝ => Real.log u) := Real.measurable_log ++ have hmeas_logC : Measurable (fun u : ℝ => ((Real.log u) : ℂ)) := hmeas_logR.complex_ofReal ++ have hmeas_neg : Measurable (fun u : ℝ => -((Real.log u) : ℂ)) := hmeas_logC.neg ++ have h1 : AEStronglyMeasurable (fun u : ℝ => -((Real.log u) : ℂ)) μ := by ++ simpa [μ] using hmeas_neg.aestronglyMeasurable ++ ++ have h2 : AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) μ := by ++ simpa [μ] using kernel_aestronglyMeasurable_on_Ioi (s := z) (a := (1 : ℝ)) ++ ++ have hmul : AEStronglyMeasurable ++ (fun u : ℝ => (-((Real.log u) : ℂ)) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1))) ++ μ := (MeasureTheory.AEStronglyMeasurable.mul h1 h2) ++ simpa [μ] using hmul ++ ++lemma kernel_deriv_norm_bound_on_ball (ε : ℝ) (u : ℝ) (hu : 1 < u) (x : ℂ) (hx : ε ≤ x.re) : ++ ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ ≤ Real.log u * u ^ (-1 - ε) := by ++ ++ have hu1 : (1 : ℝ) ≤ u := le_of_lt hu ++ ++ have hinner1 : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ ≤ u ^ (-x.re - 1) := by ++ simpa using (lem_integrandBound u hu1 x) ++ have hexp_le : -x.re - 1 ≤ -1 - ε := by linarith ++ have hmono : u ^ (-x.re - 1) ≤ u ^ (-1 - ε) := ++ Real.rpow_le_rpow_of_exponent_le hu1 hexp_le ++ have hinner : ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ ≤ u ^ (-1 - ε) := ++ le_trans hinner1 hmono ++ ++ have hmul : ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ ++ = ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ := by ++ simp ++ have hnorm_nonneg : 0 ≤ ‖-((Real.log u) : ℂ)‖ := by simp ++ have hmul_le : ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ ++ ≤ ‖-((Real.log u) : ℂ)‖ * (u ^ (-1 - ε)) := by ++ exact mul_le_mul_of_nonneg_left hinner hnorm_nonneg ++ ++ have hlognorm_neg : ‖-((Real.log u) : ℂ)‖ = Real.log u := by ++ have hnonneg : 0 ≤ Real.log u := le_of_lt (Real.log_pos hu) ++ simp [norm_neg, Complex.norm_real, abs_of_nonneg hnonneg] ++ ++ calc ++ ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1))‖ ++ = ‖-((Real.log u) : ℂ)‖ * ‖((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-x - 1)‖ := hmul ++ _ ≤ ‖-((Real.log u) : ℂ)‖ * (u ^ (-1 - ε)) := hmul_le ++ _ = (Real.log u) * u ^ (-1 - ε) := by simp [hlognorm_neg, mul_comm] ++ ++lemma exists_radius_ball_two_step_subset_halfspace (s : ℂ) {ε : ℝ} (hε : ε < s.re) : ++ ∃ δ > 0, ∀ x, dist x s < δ → ∀ y, dist y x < δ → ε ≤ y.re := by ++ ++ set δ : ℝ := (s.re - ε) / 2 with hδdef ++ have hpos : 0 < s.re - ε := sub_pos.mpr hε ++ have hδpos : 0 < δ := by simpa [hδdef] using (half_pos hpos) ++ refine ⟨δ, hδpos, ?_⟩ ++ intro x hx y hy ++ ++ have htri : dist y s ≤ dist y x + dist x s := by ++ simpa using (dist_triangle y x s) ++ have hsumlt : dist y x + dist x s < δ + δ := add_lt_add hy hx ++ have hnorm_lt : ‖y - s‖ < δ + δ := by ++ have := lt_of_le_of_lt htri hsumlt ++ simpa [dist_eq_norm] using this ++ have hdeltaSum : δ + δ = s.re - ε := by ++ simp [hδdef, add_halves] ++ have hnorm_lt_re : ‖y - s‖ < s.re - ε := by simpa [hdeltaSum] using hnorm_lt ++ ++ have h_eps_lt : ε < s.re - ‖y - s‖ := by ++ have hsum' : ε + ‖y - s‖ < s.re := by ++ simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using ++ (add_lt_add_right hnorm_lt_re ε) ++ simpa [lt_sub_iff_add_lt] using hsum' ++ ++ have hre_abs : |(y - s).re| ≤ ‖y - s‖ := by ++ simpa using (Complex.abs_re_le_norm (y - s)) ++ have hre_lower : -‖y - s‖ ≤ (y - s).re := by ++ ++ have hpair := (abs_le.mp hre_abs) ++ exact hpair.left ++ have hyge : s.re - ‖y - s‖ ≤ y.re := by ++ have h' : s.re + (-‖y - s‖) ≤ s.re + (y - s).re := add_le_add_right hre_lower s.re ++ have h'' : s.re + (y - s).re = y.re := by ++ simp [sub_eq_add_neg] ++ simpa [sub_eq_add_neg, h''] using h' ++ ++ have hygt : ε < y.re := lt_of_lt_of_le h_eps_lt hyge ++ exact le_of_lt hygt ++ ++lemma integrable_kernel_at_param (s : ℂ) (hs : 0 < s.re) : ++ Integrable ((fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1))) (volume.restrict (Ioi (1 : ℝ))) := by ++ classical ++ ++ set f : ℝ → ℂ := fun u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-s - 1) ++ set ε : ℝ := s.re / 2 ++ set g1 : ℝ → ℝ := fun u => u ^ (-s.re - 1) ++ set g : ℝ → ℝ := fun u => u ^ (-1 - ε) ++ ++ have hfm : AEStronglyMeasurable f (volume.restrict (Ioi (1 : ℝ))) := by ++ simpa [f] using kernel_aestronglyMeasurable_on_Ioi (s := s) (a := (1 : ℝ)) ++ ++ have hε : 0 < ε := by ++ have : 0 < s.re := hs ++ simpa [ε] using (half_pos this) ++ have hεle : ε ≤ s.re := by ++ have hnonneg : 0 ≤ s.re := le_of_lt hs ++ simpa [ε] using (half_le_self hnonneg) ++ ++ have hbound1 : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), ‖f u‖ ≤ g1 u := by ++ simpa [f, g1] using (kernel_ae_bound_on_Ioi (s := s)) ++ ++ have hpow_ae : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), g1 u ≤ g u := by ++ ++ have hAll : ∀ u ∈ Ioi (1 : ℝ), g1 u ≤ g u := by ++ intro u hu ++ have hx : (1 : ℝ) ≤ u := le_of_lt hu ++ have hlexp : (-s.re - 1) ≤ (-1 - ε) := by linarith ++ have := Real.rpow_le_rpow_of_exponent_le hx hlexp ++ simpa [g1, g] using this ++ ++ have hAE : ∀ᵐ u ∂volume, u ∈ Ioi (1 : ℝ) → g1 u ≤ g u := ++ MeasureTheory.ae_of_all _ hAll ++ have hiff := ++ (MeasureTheory.ae_restrict_iff' (μ := volume) (s := Ioi (1 : ℝ)) ++ (p := fun u => g1 u ≤ g u) measurableSet_Ioi) ++ exact hiff.mpr hAE ++ ++ have hbound : ∀ᵐ u ∂(volume.restrict (Ioi (1 : ℝ))), ‖f u‖ ≤ g u := by ++ filter_upwards [hbound1, hpow_ae] with u hu1 hu2 ++ exact le_trans hu1 hu2 ++ ++ have hgint : IntegrableOn g (Ioi (1 : ℝ)) := by ++ have ha_lt : (-1 - ε) < (-1 : ℝ) := by linarith ++ have hc : 0 < (1 : ℝ) := by norm_num ++ simpa [g] using (integrableOn_Ioi_rpow_of_lt (a := (-1 - ε)) (ha := ha_lt) (c := (1 : ℝ)) (hc := hc)) ++ ++ have hint : IntegrableOn f (Ioi (1 : ℝ)) := ++ integrableOn_of_ae_bound (s := Ioi (1 : ℝ)) (f := f) (g := g) ++ (hfm := hfm) (hgint := hgint) (hbound := hbound) ++ simpa [IntegrableOn, f] using hint ++ ++lemma eventually_aestronglyMeasurable_kernel_param (s : ℂ) : ++ ∀ᶠ z in 𝓝 s, AEStronglyMeasurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) (volume.restrict (Ioi (1 : ℝ))) := by ++ refine Filter.Eventually.of_forall ?_ ++ intro z ++ ++ have hmeas_fract : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ)) := by ++ have hmeas_fr : Measurable (Int.fract : ℝ → ℝ) := by ++ simpa using (measurable_fract : Measurable (Int.fract : ℝ → ℝ)) ++ exact (Complex.measurable_ofReal.comp hmeas_fr) ++ have hmeas_cpow : Measurable (fun u : ℝ => (u : ℂ) ^ (-z - 1)) := by ++ ++ measurability ++ have hmeas : Measurable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) := ++ hmeas_fract.mul hmeas_cpow ++ simpa using hmeas.aestronglyMeasurable ++ ++lemma hasDerivAt_kernel_in_param (u : ℝ) (hu : 1 < u) (z : ℂ) : ++ HasDerivAt (fun w : ℂ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-w - 1)) ++ ( -((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) ) z := by ++ ++ set c0 : ℂ := ((Int.fract u : ℝ) : ℂ) ++ have hu0 : 0 < u := lt_trans zero_lt_one hu ++ have hux0 : (u : ℝ) ≠ 0 := ne_of_gt hu0 ++ have hcz : (u : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hux0 ++ ++ have hfneg : HasDerivAt (fun w : ℂ => -w) (-1) z := (hasDerivAt_id z).neg ++ have hf : HasDerivAt (fun w : ℂ => -w - 1) (-1) z := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hfneg.sub_const (1 : ℂ) ++ ++ have hbase : HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) ++ ((u : ℂ) ^ (-z - 1) * Complex.log (u : ℂ) * (-1)) z := ++ HasDerivAt.const_cpow (c := (u : ℂ)) (hf := hf) (h0 := Or.inl hcz) ++ have hbase' : HasDerivAt (fun w : ℂ => (u : ℂ) ^ (-w - 1)) ++ (-(Complex.log (u : ℂ)) * (u : ℂ) ^ (-z - 1)) z := by ++ ++ simpa [mul_comm, mul_left_comm, mul_assoc] using hbase ++ ++ have hmul : HasDerivAt (fun w : ℂ => c0 * ((u : ℂ) ^ (-w - 1))) ++ (c0 * (-(Complex.log (u : ℂ)) * (u : ℂ) ^ (-z - 1))) z := ++ HasDerivAt.const_mul c0 hbase' ++ ++ have hlog : (Real.log u : ℂ) = Complex.log (u : ℂ) := by ++ simpa using (Complex.ofReal_log (x := u) (hx := le_of_lt hu0)) ++ ++ simpa [c0, hlog, mul_comm, mul_left_comm, mul_assoc] using hmul ++ ++lemma hasDerivAt_integral_param_dominated_Ioi ++ (F F' : ℂ → ℝ → ℂ) (s : ℂ) (δ : ℝ) (hδ : 0 < δ) ++ (hmeas : ∀ᶠ z in 𝓝 s, AEStronglyMeasurable (F z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) ++ (hFint : Integrable (F s) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) ++ (hF'meas : AEStronglyMeasurable (F' s) (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) ++ (bound : ℝ → ℝ) ++ (hbound_int : Integrable bound (MeasureTheory.volume.restrict (Ioi (1 : ℝ)))) ++ (hbound : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), ∀ z ∈ Metric.ball s δ, ‖F' z u‖ ≤ bound u) ++ (hderiv : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), ∀ z ∈ Metric.ball s δ, HasDerivAt (fun w => F w u) (F' z u) z) ++ : ++ HasDerivAt (fun z => ∫ u in Ioi (1 : ℝ), F z u) (∫ u in Ioi (1 : ℝ), F' s u) s := by ++ ++ have h := ++ hasDerivAt_integral_of_dominated_loc_of_deriv_le ++ (μ := MeasureTheory.volume.restrict (Ioi (1 : ℝ))) ++ (F := F) (F' := F') (x₀ := s) ++ (s := Metric.ball s δ) (hs := Metric.ball_mem_nhds s hδ) ++ (hF_meas := hmeas) (hF_int := hFint) ++ (hF'_meas := hF'meas) ++ (h_bound := hbound) (bound_integrable := hbound_int) ++ (h_diff := hderiv) ++ rcases h with ⟨_hint, hDeriv⟩ ++ ++ simpa using hDeriv ++ ++lemma dist_lt_of_mem_two_balls {x z s : ℂ} {r : ℝ} ++ (hxz : dist x z < r) (hzs : dist z s < r) : dist x s < r + r := by ++ have htri : dist x s ≤ dist x z + dist z s := dist_triangle x z s ++ have hadd : dist x z + dist z s < r + r := add_lt_add hxz hzs ++ exact lt_of_le_of_lt htri hadd ++ ++lemma mem_ball_of_mem_two_half_balls {x z s : ℂ} {δ : ℝ} ++ (hx : x ∈ Metric.ball z (δ/2)) (hz : z ∈ Metric.ball s (δ/2)) : ++ x ∈ Metric.ball s δ := by ++ have hxz : dist x z < δ / 2 := by ++ simpa [Metric.mem_ball] using hx ++ have hzs : dist z s < δ / 2 := by ++ simpa [Metric.mem_ball] using hz ++ have htri : dist x s ≤ dist x z + dist z s := dist_triangle x z s ++ have hadd : dist x z + dist z s < δ / 2 + δ / 2 := add_lt_add hxz hzs ++ have hlt : dist x s < δ := by ++ exact lt_of_le_of_lt htri (by simpa [add_halves] using hadd) ++ simpa [Metric.mem_ball] using hlt ++ ++lemma dist_lt_delta_of_half {x s : ℂ} {δ : ℝ} (hδpos : 0 < δ) ++ (hx : dist x s < δ/2) : dist x s < δ := by ++ have hhalf : δ / 2 < δ := by ++ simpa using (half_lt_self hδpos) ++ exact lt_trans hx hhalf ++ ++lemma re_lower_bound_from_two_step {s x : ℂ} {ε δ : ℝ} ++ (h : ∀ z, dist z s < δ → ∀ y, dist y z < δ → ε ≤ y.re) ++ (hδpos : 0 < δ) (hx : dist x s < δ) : ε ≤ x.re := by ++ have hxx : dist x x < δ := by simpa [dist_self] using hδpos ++ have hxstep := h x hx ++ have hxres := hxstep x hxx ++ simpa using hxres ++ ++lemma analyticAt_of_eventually_differentiableAt {f : ℂ → ℂ} {s : ℂ} ++ (h : ∀ᶠ z in 𝓝 s, DifferentiableAt ℂ f z) : AnalyticAt ℂ f s := by ++ simpa using ++ (Complex.analyticAt_iff_eventually_differentiableAt (f := f) (c := s)).2 h ++ ++lemma kernel_integrable_param_of_re_pos (z : ℂ) (hz : 0 < z.re) : ++ Integrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) ++ (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by ++ simpa using (integrable_kernel_at_param (s := z) (hs := hz)) ++ ++lemma integrable_kernel_at_param' (z : ℂ) (hz : 0 < z.re) : ++ Integrable (fun u : ℝ => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1)) ++ (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by simpa using integrable_kernel_at_param (s := z) hz ++ ++lemma lem_integralAnalytic (s : ℂ) (hs : 1/10 < s.re) : ++ AnalyticAt ℂ (fun z : ℂ => ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by ++ classical ++ ++ have hspos : 0 < s.re := lt_trans (by norm_num : (0 : ℝ) < 1/10) hs ++ set ε : ℝ := s.re / 2 with hεdef ++ have hεpos : 0 < ε := by simpa [ε] using (half_pos hspos) ++ have hεlt : ε < s.re := by ++ have : s.re / 2 < s.re := by simpa [ε] using (half_lt_self hspos) ++ simpa [ε] using this ++ ++ rcases exists_radius_ball_two_step_subset_halfspace (s := s) (ε := ε) hεlt with ⟨δ, hδpos, hδprop⟩ ++ ++ let F : ℂ → ℝ → ℂ := fun z u => ((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-z - 1) ++ let F' : ℂ → ℝ → ℂ := fun z u => -((Real.log u) : ℂ) * F z u ++ ++ let bound : ℝ → ℝ := fun u => (2/ε) * u ^ (-1 - (ε/2)) ++ ++ have hbound_int : Integrable bound (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by ++ have hlt : (-1 - (ε/2)) < (-1 : ℝ) := by ++ have : 0 < ε/2 := by simpa using (half_pos hεpos) ++ linarith ++ have hpos1 : 0 < (1 : ℝ) := by norm_num ++ have hpow_int : IntegrableOn (fun u : ℝ => u ^ (-1 - (ε/2))) (Ioi (1 : ℝ)) := by ++ simpa using (integrableOn_Ioi_rpow_of_lt (a := (-1 - (ε/2))) hlt (c := (1 : ℝ)) hpos1) ++ have hconst : IntegrableOn (fun u : ℝ => (2/ε) * u ^ (-1 - (ε/2))) (Ioi (1 : ℝ)) := ++ hpow_int.const_mul (2/ε) ++ simpa [IntegrableOn, bound] using hconst ++ ++ have hDiff_eventually : ∀ᶠ z in 𝓝 s, ++ DifferentiableAt ℂ (fun z0 => ∫ u in Ioi (1 : ℝ), F z0 u) z := by ++ ++ have hball : Metric.ball s (δ/2) ∈ 𝓝 s := Metric.ball_mem_nhds _ (by simpa using (half_pos hδpos)) ++ refine Filter.eventually_of_mem hball ?_ ++ intro z hz ++ ++ have hz_lt_δ : dist z s < δ := lt_trans (by simpa [Metric.mem_ball] using hz) (by simpa using (half_lt_self hδpos)) ++ have hRe_inner : ∀ y, y ∈ Metric.ball z (δ/2) → ε ≤ y.re := by ++ intro y hy ++ have hy_lt_δ : dist y z < δ := lt_trans (by simpa [Metric.mem_ball] using hy) (by simpa using (half_lt_self hδpos)) ++ exact hδprop z hz_lt_δ y hy_lt_δ ++ ++ have hmeas_z : ∀ᶠ w in 𝓝 z, ++ AEStronglyMeasurable (F w) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := ++ eventually_aestronglyMeasurable_kernel_param (s := z) ++ ++ have hzRe_ge : ε ≤ z.re := by ++ ++ have hss : dist s s < δ := by simpa [dist_self] using hδpos ++ have hz_lt_δ' : dist z s < δ := hz_lt_δ ++ exact hδprop s hss z hz_lt_δ' ++ have hzpos : 0 < z.re := lt_of_lt_of_le hεpos hzRe_ge ++ have hFint_z : Integrable (F z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by ++ simpa [F] using integrable_kernel_at_param (s := z) hzpos ++ ++ have hF'meas_z : AEStronglyMeasurable (F' z) (MeasureTheory.volume.restrict (Ioi (1 : ℝ))) := by ++ simpa [F, F'] using aestronglyMeasurable_kernel_param_deriv (z := z) ++ ++ have hbound_z : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), ++ ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u := by ++ ++ have hAll : ∀ u ∈ Ioi (1 : ℝ), ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u := by ++ intro u hu w hw ++ have hu1 : 1 < u := hu ++ have hu0 : 0 < u := lt_trans zero_lt_one hu1 ++ ++ have hwRe : ε ≤ w.re := hRe_inner w hw ++ have hker : ‖-((Real.log u) : ℂ) * (((Int.fract u : ℝ) : ℂ) * (u : ℂ) ^ (-w - 1))‖ ++ ≤ Real.log u * u ^ (-1 - ε) := ++ kernel_deriv_norm_bound_on_ball (ε := ε) (u := u) (hu := hu1) (x := w) (hx := hwRe) ++ have hF'le : ‖F' w u‖ ≤ Real.log u * u ^ (-1 - ε) := by ++ simpa [F, F', mul_comm, mul_left_comm, mul_assoc] using hker ++ ++ have hx' := Real.add_one_le_exp ((ε/2) * Real.log u) ++ have hx : 1 + (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) := by ++ simpa [add_comm] using hx' ++ have hsub : (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) - 1 := by ++ have := sub_le_sub_right hx 1 ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ have hle_exp : (ε/2) * Real.log u ≤ Real.exp ((ε/2) * Real.log u) := by ++ have hnonneg : 0 ≤ (1 : ℝ) := by norm_num ++ have : Real.exp ((ε/2) * Real.log u) - 1 ≤ Real.exp ((ε/2) * Real.log u) := ++ sub_le_self _ hnonneg ++ exact le_trans hsub this ++ have hεne : (ε : ℝ) ≠ 0 := ne_of_gt hεpos ++ have hpos_inv : 0 < ε⁻¹ := inv_pos.mpr hεpos ++ have hpos_coeff : 0 < (2/ε) := by ++ have : 0 < (2 : ℝ) := by norm_num ++ simpa [one_div, div_eq_mul_inv] using (mul_pos this hpos_inv) ++ have hlog_bound : Real.log u ≤ (2/ε) * Real.exp ((ε/2) * Real.log u) := by ++ have hmul := mul_le_mul_of_nonneg_left hle_exp (le_of_lt hpos_coeff) ++ ++ have hleft : (2/ε) * ((ε/2) * Real.log u) = Real.log u := by ++ have h2ne : (2 : ℝ) ≠ 0 := by norm_num ++ calc ++ (2/ε) * ((ε/2) * Real.log u) ++ = ((2/ε) * (ε/2)) * Real.log u := by ring ++ _ = ((2 * ε⁻¹) * (ε * (2)⁻¹)) * Real.log u := by simp [div_eq_mul_inv] ++ _ = ((2 * (2)⁻¹) * (ε⁻¹ * ε)) * Real.log u := by ring ++ _ = (1 * 1) * Real.log u := by simp [hεne, h2ne] ++ _ = Real.log u := by simp ++ simpa [hleft] ++ using hmul ++ ++ have hexp_rpow : Real.exp ((ε/2) * Real.log u) = u ^ (ε/2) := by ++ have : 0 < u := hu0 ++ simp [Real.rpow_def_of_pos this, mul_comm] ++ ++ have hmul : Real.log u * u ^ (-1 - ε) ++ ≤ ((2/ε) * u ^ (ε/2)) * u ^ (-1 - ε) := by ++ have hqpos : 0 < u ^ (-1 - ε) := Real.rpow_pos_of_pos hu0 _ ++ have hq : 0 ≤ u ^ (-1 - ε) := le_of_lt hqpos ++ exact mul_le_mul_of_nonneg_right (by simpa [hexp_rpow] using hlog_bound) hq ++ ++ have hpow_mul : u ^ (ε/2) * u ^ (-1 - ε) = u ^ (-1 - (ε/2)) := by ++ have hu0' : 0 < u := hu0 ++ have h1 : Real.exp ((ε/2) * Real.log u) * Real.exp ((-1 - ε) * Real.log u) ++ = Real.exp (((ε/2) * Real.log u) + ((-1 - ε) * Real.log u)) := by ++ simpa using (Real.exp_add ((ε/2) * Real.log u) ((-1 - ε) * Real.log u)).symm ++ calc ++ u ^ (ε/2) * u ^ (-1 - ε) ++ = Real.exp ((ε/2) * Real.log u) * Real.exp ((-1 - ε) * Real.log u) := by ++ simp [Real.rpow_def_of_pos hu0', mul_comm] ++ _ = Real.exp (((ε/2) * Real.log u) + ((-1 - ε) * Real.log u)) := by ++ simpa using h1 ++ _ = Real.exp (((ε/2) + (-1 - ε)) * Real.log u) := by ++ ring_nf ++ _ = u ^ (-1 - (ε/2)) := by ++ have : (ε/2) + (-1 - ε) = -1 - (ε/2) := by ring ++ simp [this, Real.rpow_def_of_pos hu0', mul_comm] ++ have hmul' : ((2/ε) * u ^ (ε/2)) * u ^ (-1 - ε) = (2/ε) * u ^ (-1 - (ε/2)) := by ++ simp [mul_assoc, hpow_mul] ++ ++ have : ‖F' w u‖ ≤ bound u := by ++ refine le_trans hF'le ?_ ++ simpa [bound, hmul'] using hmul ++ simpa [F, F', bound] ++ using this ++ ++ have hiff := ++ (MeasureTheory.ae_restrict_iff' (μ := MeasureTheory.volume) (s := Ioi (1 : ℝ)) ++ (p := fun u : ℝ => ∀ w ∈ Metric.ball z (δ/2), ‖F' w u‖ ≤ bound u) measurableSet_Ioi) ++ exact hiff.mpr (MeasureTheory.ae_of_all _ hAll) ++ ++ have hderiv_z : ∀ᵐ u ∂(MeasureTheory.volume.restrict (Ioi (1 : ℝ))), ++ ∀ w ∈ Metric.ball z (δ/2), HasDerivAt (fun w0 => F w0 u) (F' w u) w := by ++ ++ have hAll : ∀ u ∈ Ioi (1 : ℝ), ∀ w ∈ Metric.ball z (δ/2), ++ HasDerivAt (fun w0 => F w0 u) (F' w u) w := by ++ intro u hu w hw ++ simpa [F, F', mul_comm, mul_left_comm, mul_assoc] ++ using hasDerivAt_kernel_in_param (u := u) (hu := hu) (z := w) ++ ++ have hiff := ++ (MeasureTheory.ae_restrict_iff' (μ := MeasureTheory.volume) (s := Ioi (1 : ℝ)) ++ (p := fun u : ℝ => ∀ w ∈ Metric.ball z (δ/2), ++ HasDerivAt (fun w0 => F w0 u) (F' w u) w) measurableSet_Ioi) ++ exact hiff.mpr (MeasureTheory.ae_of_all _ hAll) ++ ++ have hD := hasDerivAt_integral_param_dominated_Ioi ++ (F := F) (F' := F') (s := z) (δ := δ/2) (hδ := by simpa using (half_pos hδpos)) ++ (hmeas := hmeas_z) (hFint := hFint_z) (hF'meas := hF'meas_z) ++ (bound := bound) (hbound_int := hbound_int) (hbound := hbound_z) (hderiv := hderiv_z) ++ ++ simpa using hD.differentiableAt ++ ++ exact analyticAt_of_eventually_differentiableAt hDiff_eventually ++ ++lemma lem_zetaFormulaAC : ++ (let S := {s : ℂ | s ≠ 1} ++ let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} ++ let F := fun z : ℂ => ++ z / (z - 1) ++ - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) ++ AnalyticOn ℂ F T) := by ++ ++ simp only [AnalyticOn] ++ intro s hs ++ simp at hs ++ obtain ⟨hs_ne_1, hs_re⟩ := hs ++ ++ apply AnalyticAt.analyticWithinAt ++ ++ have h1 : AnalyticAt ℂ (fun z => z / (z - 1)) s := by ++ apply AnalyticAt.div ++ · exact analyticAt_id ++ · exact analyticAt_id.sub analyticAt_const ++ · ++ rw [sub_ne_zero] ++ exact hs_ne_1 ++ ++ have hs_re_eq : (10 : ℝ)⁻¹ = (1 : ℝ) / 10 := by norm_num ++ have hs_re_correct : (1 : ℝ) / 10 < s.re := by rwa [← hs_re_eq] ++ ++ have hconv := lem_integralConvergence (1/10) (by norm_num) s (le_of_lt hs_re_correct) ++ ++ obtain ⟨I, hI_tendsto, hI_bound⟩ := hconv ++ ++ have hI_bound_10 : ‖I‖ ≤ 10 := by ++ convert hI_bound ++ norm_num ++ ++ have h_integral : AnalyticAt ℂ (fun z => ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by ++ apply lem_integralAnalytic s hs_re_correct ++ ++ have h2 : AnalyticAt ℂ (fun z => z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) s := by ++ exact analyticAt_id.mul h_integral ++ ++ exact h1.sub h2 ++ ++lemma lem_div_eq_one_plus_one_div (z : ℂ) (hz : z ≠ 1) : z / (z - 1) = 1 + 1 / (z - 1) := by ++ have h : z - 1 ≠ 0 := by ++ intro h0 ++ have : z = 1 := by ++ rw [sub_eq_zero] at h0 ++ exact h0 ++ exact hz this ++ calc z / (z - 1) ++ = ((z - 1) + 1) / (z - 1) := by ring_nf ++ _ = (z - 1) / (z - 1) + 1 / (z - 1) := by rw [add_div] ++ _ = 1 + 1 / (z - 1) := by simp [div_self h] ++ ++lemma lem_zetaAnalyticContinuation : ++ (let S := {s : ℂ | s ≠ 1} ++ let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} ++ ∀ s ∈ T, ++ riemannZeta s ++ = 1 + 1 / (s - 1) ++ - s * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)) := by ++ ++ simp only [Set.mem_ofPred_eq] ++ intro s h_s ++ ++ have hs_ne_1 : s ≠ 1 := h_s.1 ++ have hs_re : 1/10 < s.re := h_s.2 ++ ++ let F := fun z : ℂ => 1 + 1 / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) ++ ++ let S := {s : ℂ | s ≠ 1} ++ let T := {s : ℂ | s ∈ S ∧ 1/10 < s.re} ++ ++ have hs_in_T : s ∈ T := by ++ simp only [T, S, Set.mem_ofPred_eq] ++ exact ⟨hs_ne_1, hs_re⟩ ++ ++ have h_T_open := lem_T_isOpen ++ have h_T_preconnected := lem_T_isPreconnected ++ ++ have h_zeta_analytic_S := lem_zetaanalS ++ have h_zeta_analytic_T : AnalyticOn ℂ riemannZeta T := by ++ apply AnalyticOn.mono h_zeta_analytic_S ++ intro x hx; exact hx.1 ++ have h_zeta_analyticOnNhd_T : AnalyticOnNhd ℂ riemannZeta T := by ++ rwa [← h_T_open.analyticOn_iff_analyticOnNhd] ++ ++ have h_F_orig_analytic := lem_zetaFormulaAC ++ ++ have h_F_eq : EqOn F (fun z => z / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1)) T := by ++ intro z hz ++ simp only [F] ++ rw [lem_div_eq_one_plus_one_div z hz.1] ++ ++ have h_F_analytic_T : AnalyticOn ℂ F T := ++ AnalyticOn.congr h_F_orig_analytic h_F_eq ++ have h_F_analyticOnNhd_T : AnalyticOnNhd ℂ F T := by ++ rwa [← h_T_open.analyticOn_iff_analyticOnNhd] ++ ++ have ⟨s₀, hs₀_T, hs₀_re⟩ : ∃ s₀, s₀ ∈ T ∧ 1 < s₀.re := by ++ use 2 ++ constructor ++ · simp only [T, S, Set.mem_ofPred_eq] ++ norm_num ++ · norm_num ++ ++ have h_eventually_eq : riemannZeta =ᶠ[𝓝 s₀] F := by ++ ++ have h_re_cont : ContinuousAt Complex.re s₀ := Complex.continuous_re.continuousAt ++ have h_nhd_re : ∀ᶠ s in 𝓝 s₀, 1 < s.re := ++ ContinuousAt.eventually_lt continuousAt_const h_re_cont hs₀_re ++ ++ have h_nhd_T : ∀ᶠ s in 𝓝 s₀, s ∈ T := h_T_open.mem_nhds hs₀_T ++ ++ filter_upwards [h_nhd_re, h_nhd_T] with w hw_re hw_T ++ ++ have h_formula := lem_zetaFormula w hw_re ++ simp only [F] ++ exact h_formula ++ ++ have h_eqOn_global := AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq ++ h_zeta_analyticOnNhd_T h_F_analyticOnNhd_T h_T_preconnected hs₀_T h_eventually_eq ++ ++ exact h_eqOn_global hs_in_T ++ ++lemma lem_zetaBound1 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1)‖ := by ++ classical ++ set S : Set ℂ := {z : ℂ | z ≠ 1} ++ set T : Set ℂ := {z : ℂ | z ∈ S ∧ 1/10 < z.re} ++ set Iint : ℂ := ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) ++ have hT : s ∈ T := by ++ have hsS : s ∈ S := by simpa [S, Set.mem_ofPred_eq] using hs_ne ++ simpa [T, Set.mem_ofPred_eq] using And.intro hsS hs_re ++ have hAC : ∀ z ∈ T, riemannZeta z = 1 + 1 / (z - 1) - z * ∫ u in Ioi (1 : ℝ), (Int.fract u : ℝ) * (u : ℂ) ^ (-z - 1) := by ++ simpa [S, T] using lem_zetaAnalyticContinuation ++ have hzeta : riemannZeta s = 1 + 1 / (s - 1) - s * Iint := by ++ simpa [Iint] using hAC s hT ++ have h1 : ‖riemannZeta s‖ ≤ ‖1 + 1 / (s - 1)‖ + ‖-s * Iint‖ := by ++ simpa [hzeta, sub_eq_add_neg] using (lem_triangleInequality_add (1 + 1 / (s - 1)) (-s * Iint)) ++ have hA : ‖1 + 1 / (s - 1)‖ ≤ ‖(1 : ℂ)‖ + ‖1 / (s - 1)‖ := by ++ simpa using (lem_triangleInequality_add (1 : ℂ) (1 / (s - 1))) ++ have hmul : ‖-s * Iint‖ = ‖-s‖ * ‖Iint‖ := by ++ simp ++ have hB : ‖-s * Iint‖ ≤ ‖s‖ * ‖Iint‖ := by ++ have : ‖-s * Iint‖ = ‖s‖ * ‖Iint‖ := by simp ++ exact this.le ++ have h2 : ‖riemannZeta s‖ ≤ (‖(1 : ℂ)‖ + ‖1 / (s - 1)‖) + (‖s‖ * ‖Iint‖) := ++ le_trans h1 (add_le_add hA hB) ++ have h1norm : ‖(1 : ℂ)‖ = 1 := by simp ++ simpa [Iint, h1norm, add_comm, add_left_comm, add_assoc] using h2 ++ ++lemma lem_integralBoundValue (s : ℂ) (hs : 0 < s.re) : ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) = 1 / s.re := by ++ have ha : (-s.re - 1) < -1 := by linarith ++ have hc : 0 < (1 : ℝ) := by exact zero_lt_one ++ have h := integral_Ioi_rpow_of_lt (a := (-s.re - 1)) ha (c := (1 : ℝ)) hc ++ have h' : ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) = - (1 : ℝ) ^ (-s.re) / (-s.re) := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h ++ calc ++ ∫ u in Ioi (1 : ℝ), u ^ (-s.re - 1) ++ = - (1 : ℝ) ^ (-s.re) / (-s.re) := h' ++ _ = - (1 : ℝ) / (-s.re) := by simp [Real.one_rpow] ++ _ = 1 / s.re := by simp ++ ++lemma lem_zetaBound2 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ / s.re := by ++ ++ set f : ℝ → ℂ := fun u => (Int.fract u : ℝ) * (u : ℂ) ^ (-s - 1) with hfdef ++ set g : ℝ → ℝ := fun u => u ^ (-s.re - 1) with hgdef ++ ++ have hζ : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ := by ++ simpa [hfdef] using lem_zetaBound1 s hs_re hs_ne ++ ++ let μ : Measure ℝ := (volume : Measure ℝ).restrict (Ioi (1 : ℝ)) ++ ++ have h_ae_bound : ∀ᵐ u ∂μ, ‖f u‖ ≤ g u := by ++ have hforall : ∀ u ∈ Ioi (1 : ℝ), ‖f u‖ ≤ g u := by ++ intro u hu ++ have := lem_integrandBound u (le_of_lt hu) s ++ simpa [hfdef, hgdef] using this ++ have hmeas : MeasurableSet (Ioi (1 : ℝ)) := measurableSet_Ioi ++ simpa [μ] using ++ (MeasureTheory.ae_restrict_of_forall_mem (μ := volume) (s := Ioi (1 : ℝ)) hmeas hforall) ++ ++ have hg_intOn : IntegrableOn g (Ioi (1 : ℝ)) := by ++ classical ++ by_contra hnot ++ have hnot' : ¬ Integrable g μ := by simpa [μ, IntegrableOn] using hnot ++ have hint0 : (∫ u, g u ∂μ) = 0 := by ++ simpa using (integral_undef (μ := μ) (f := g) hnot') ++ have hval : ∫ u in Ioi (1 : ℝ), g u = 1 / s.re := by ++ simpa [hgdef] using lem_integralBoundValue s (by linarith [hs_re]) ++ have hne : (1 / s.re) ≠ 0 := by exact one_div_ne_zero (ne_of_gt (by linarith [hs_re])) ++ have : (∫ u in Ioi (1 : ℝ), g u) = 0 := by simpa [μ] using hint0 ++ exact hne (by simpa [hval] using this) ++ have hg_int : Integrable g μ := by simpa [μ, IntegrableOn] using hg_intOn ++ ++ have h_int_bound : ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ ∫ u in Ioi (1 : ℝ), g u := by ++ have := ++ (MeasureTheory.norm_integral_le_of_norm_le (μ := μ) (f := f) (g := g) hg_int h_ae_bound) ++ simpa [μ] using this ++ ++ have h_g_val : ∫ u in Ioi (1 : ℝ), g u = 1 / s.re := by ++ simpa [hgdef] using lem_integralBoundValue s (by linarith [hs_re]) ++ have h_int_bound_conc : ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ 1 / s.re := by ++ simpa [h_g_val] using h_int_bound ++ ++ have hmul : ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ ≤ ‖s‖ * (1 / s.re) := by ++ exact mul_le_mul_of_nonneg_left h_int_bound_conc (by exact norm_nonneg s) ++ ++ have hsum0 : (1 + ‖1 / (s - 1)‖) + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ ++ ≤ (1 + ‖1 / (s - 1)‖) + ‖s‖ * (1 / s.re) := by ++ exact add_le_add_right hmul (1 + ‖1 / (s - 1)‖) ++ have hsum : 1 + ‖1 / (s - 1)‖ + ‖s‖ * ‖∫ u in Ioi (1 : ℝ), f u‖ ++ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * (1 / s.re) := by ++ simpa [add_assoc] using hsum0 ++ ++ have hfinal1 : ‖riemannZeta s‖ ≤ 1 + ‖1 / (s - 1)‖ + ‖s‖ * (1 / s.re) := ++ le_trans hζ hsum ++ simpa [div_eq_mul_inv] using hfinal1 ++ ++lemma lem_sOverSminus1Bound (s : ℂ) (_hs : s ≠ 1) : ‖(1 / (s - 1))‖ = 1 / ‖s - 1‖ := by simp [one_div] ++ ++lemma lem_zetaBound3 (s : ℂ) (hs_re : 1/10 < s.re) (hs_ne : s ≠ 1) : ‖riemannZeta s‖ ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := by ++ simpa [lem_sOverSminus1Bound s hs_ne] using lem_zetaBound2 s hs_re hs_ne ++ ++lemma helper_normsq (z : ℂ) : ‖z‖ ^ 2 = z.re ^ 2 + z.im ^ 2 := by ++ simpa [Complex.normSq, pow_two] using (Complex.normSq_eq_norm_sq z).symm ++ ++lemma helper_three_abs_sq (t : ℝ) : (3 : ℝ) ^ 2 + t ^ 2 ≤ (3 + |t|) ^ 2 := by ++ have hnonneg : 0 ≤ (6 : ℝ) * |t| := by ++ have h6 : (0 : ℝ) ≤ 6 := by norm_num ++ exact mul_nonneg h6 (abs_nonneg t) ++ have hmul : |t| * |t| = t * t := by ++ simp ++ calc ++ (3 : ℝ) ^ 2 + t ^ 2 = (3 : ℝ) ^ 2 + t * t := by simp [pow_two] ++ _ = (3 : ℝ) ^ 2 + |t| * |t| := by simp [hmul] ++ _ ≤ (3 : ℝ) ^ 2 + |t| * |t| + (6 : ℝ) * |t| := by exact le_add_of_nonneg_right hnonneg ++ _ = (3 + |t|) ^ 2 := by ring ++ ++lemma lem_sBound (s : ℂ) (hs : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) : ‖s‖ < (3 : ℝ) + |s.im| := by ++ have hnegthree_lt_re : (- (3 : ℝ)) < s.re := by ++ have hlt : (- (3 : ℝ)) < (1 / 2 : ℝ) := by norm_num ++ exact lt_of_lt_of_le hlt hs.1 ++ have hlt3 : s.re < (3 : ℝ) := hs.2 ++ have h_re_sq_lt : s.re ^ 2 < (3 : ℝ) ^ 2 := by ++ simpa using (sq_lt_sq' hnegthree_lt_re hlt3) ++ have hsumlt : s.re ^ 2 + s.im ^ 2 < (3 : ℝ) ^ 2 + s.im ^ 2 := by ++ exact add_lt_add_left h_re_sq_lt _ ++ have hsq : ‖s‖ ^ 2 < (3 + |s.im|) ^ 2 := by ++ have h := lt_of_lt_of_le hsumlt (helper_three_abs_sq s.im) ++ simpa [helper_normsq s] using h ++ have hnormnn : 0 ≤ ‖s‖ := norm_nonneg _ ++ have hpos : 0 ≤ (3 : ℝ) + |s.im| := add_nonneg (by norm_num) (abs_nonneg _) ++ exact (sq_lt_sq₀ hnormnn hpos).1 hsq ++ ++lemma lem_invReSbound (s : ℂ) (hs : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) : ++ 1 / s.re ≤ (2 : ℝ) := by ++ have h_pos : (0 : ℝ) < s.re := by ++ linarith [hs.1] ++ have h_half_pos : (0 : ℝ) < (1/2 : ℝ) := by norm_num ++ have h_recip : 1 / s.re ≤ 1 / (1/2 : ℝ) := one_div_le_one_div_of_le h_half_pos hs.1 ++ have h_simplify : 1 / (1/2 : ℝ) = (2 : ℝ) := by norm_num ++ rw [h_simplify] at h_recip ++ exact h_recip ++ ++lemma lem_invSminus1bound (s : ℂ) (_hs_re : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) (hs_im : (1 : ℝ) ≤ |s.im|) : (1 : ℝ) ≤ ‖s - 1‖ := by ++ have h2 : |s.im| ≤ ‖s - 1‖ := by ++ have : (s - (1 : ℂ)).im = s.im := by ++ simp [Complex.sub_im, Complex.one_im] ++ simpa [this] using Complex.abs_im_le_norm (s - 1) ++ exact le_trans hs_im h2 ++ ++lemma reciprocal_le_one_of_one_le {x : ℝ} (hx_pos : 0 < x) (hx_ge : 1 ≤ x) : 1 / x ≤ 1 := by ++ ++ have h_div_pos : 0 < 1 / x := one_div_pos.mpr hx_pos ++ ++ have h1 : (1 / x) * 1 ≤ (1 / x) * x := by ++ exact mul_le_mul_of_nonneg_left hx_ge (le_of_lt h_div_pos) ++ ++ rw [mul_one] at h1 ++ rw [one_div_mul_cancel (ne_of_gt hx_pos)] at h1 ++ exact h1 ++ ++lemma div_le_mul_of_one_div_le {a c d : ℝ} (ha : 0 ≤ a) (_hc : 0 < c) (h : 1 / c ≤ d) : a / c ≤ a * d := by ++ ++ rw [div_eq_mul_one_div] ++ ++ exact mul_le_mul_of_nonneg_left h ha ++ ++lemma lem_finalBoundCombination (s : ℂ) (hs_re : (1/2 : ℝ) ≤ s.re ∧ s.re < (3 : ℝ)) (hs_im : (1 : ℝ) ≤ |s.im|) : ‖riemannZeta s‖ < 1 + 1 + ((3 : ℝ) + |s.im|) * 2 := by ++ ++ have hs_ne : s ≠ 1 := by ++ intro h ++ rw [h] at hs_im ++ simp at hs_im ++ linarith ++ ++ have hs_re_pos : 0 < s.re := by linarith [hs_re.1] ++ ++ have h1 : ‖riemannZeta s‖ ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := lem_zetaBound3 s (by linarith [hs_re_pos]) hs_ne ++ ++ have h2 : (1 : ℝ) ≤ ‖s - 1‖ := lem_invSminus1bound s hs_re hs_im ++ have h3 : 1 / ‖s - 1‖ ≤ 1 := reciprocal_le_one_of_one_le (by linarith [h2]) h2 ++ ++ have h4 : ‖s‖ < (3 : ℝ) + |s.im| := lem_sBound s hs_re ++ ++ have h5 : 1 / s.re ≤ (2 : ℝ) := lem_invReSbound s hs_re ++ ++ calc ‖riemannZeta s‖ ++ ≤ 1 + 1 / ‖s - 1‖ + ‖s‖ / s.re := h1 ++ _ ≤ 1 + 1 + ‖s‖ / s.re := by linarith [h3] ++ _ ≤ 1 + 1 + ‖s‖ * 2 := by ++ have s_nonneg : 0 ≤ ‖s‖ := norm_nonneg _ ++ exact add_le_add_right (div_le_mul_of_one_div_le s_nonneg hs_re_pos h5) _ ++ _ < 1 + 1 + ((3 : ℝ) + |s.im|) * 2 := by linarith [h4] ++ ++lemma lem_finalAlgebra (t : ℝ) : 1 + 1 + ((3 : ℝ) + |t|) * 2 = (8 : ℝ) + 2 * |t| := by ring ++ ++lemma lem_zetaUppBd (z : ℂ) (hz_re : z.re ∈ Ico (1/2 : ℝ) (3 : ℝ)) (hz_im : (1 : ℝ) ≤ |z.im|) : ‖riemannZeta z‖ < (8 : ℝ) + 2 * |z.im| := by ++ have hz_re' : (1/2 : ℝ) ≤ z.re ∧ z.re < (3 : ℝ) := by ++ simpa [Ico] using hz_re ++ have h := lem_finalBoundCombination z hz_re' hz_im ++ simpa [lem_finalAlgebra] using h ++ ++lemma lem_zfroms_calc (s : ℂ) (t : ℝ) : ++ (let z := s + (3/2 : ℝ) + I * t ++ z.re = s.re + (3/2 : ℝ) ∧ z.im = s.im + t) := by ++ constructor ++ · ++ simp only [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im] ++ ++ have h1 : I.re = 0 := Complex.I_re ++ have h2 : I.im * 0 = 0 := mul_zero _ ++ rw [h1, h2] ++ simp ++ · ++ simp only [Complex.add_im, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im] ++ ++ have h1 : I.re * 0 = 0 := mul_zero _ ++ have h2 : I.im = 1 := Complex.I_im ++ rw [h1, h2] ++ simp ++ ++lemma lem_zfroms_conditions (s : ℂ) (t : ℝ) ++ (hs : ‖s‖ ≤ (1 : ℝ)) (ht : (2 : ℝ) < |t|) : ++ (let z := s + (3/2 : ℝ) + I * t ++ z.re ∈ Ico (1/2 : ℝ) (3 : ℝ) ∧ (1 : ℝ) ≤ |z.im|) := by ++ ++ have h_calc := lem_zfroms_calc s t ++ simp only [h_calc.1, h_calc.2] ++ constructor ++ ++ · ++ ++ have hs_re_bound : |s.re| ≤ 1 := ++ (Complex.abs_re_le_norm s).trans hs ++ rw [abs_le] at hs_re_bound ++ ++ rw [Set.mem_Ico] ++ constructor ++ · ++ linarith [hs_re_bound.1] ++ · ++ linarith [hs_re_bound.2] ++ ++ · ++ have hs_im_bound : |s.im| ≤ 1 := ++ (Complex.abs_im_le_norm s).trans hs ++ rw [abs_le] at hs_im_bound ++ ++ by_cases h : 0 ≤ t ++ · ++ have ht_pos : t > 2 := by ++ rwa [abs_of_nonneg h] at ht ++ ++ have lower_bound : s.im + t ≥ 1 := by ++ linarith [hs_im_bound.1, ht_pos] ++ have nonneg : 0 ≤ s.im + t := by linarith ++ rw [abs_of_nonneg nonneg] ++ linarith [lower_bound] ++ · ++ push Not at h ++ have ht_neg : t < -2 := by ++ rw [abs_of_neg h] at ht ++ linarith [ht] ++ ++ have upper_bound : s.im + t ≤ -1 := by ++ linarith [hs_im_bound.2, ht_neg] ++ have neg : s.im + t < 0 := by linarith ++ rw [abs_of_neg neg] ++ linarith [upper_bound] ++ ++lemma lem_abs_im_bound (s : ℂ) (t : ℝ) (hs : ‖s‖ ≤ 1) : |s.im + t| ≤ 1 + |t| := by ++ have h1 : |s.im| ≤ ‖s‖ := Complex.abs_im_le_norm s ++ have h2 : |s.im| ≤ 1 := le_trans h1 hs ++ have h3 : |s.im + t| ≤ |s.im| + |t| := abs_add_le s.im t ++ linarith ++ ++lemma lem_zetaUppBound : ++ ∀ t : ℝ, ∀ s : ℂ, ‖s‖ ≤ (1 : ℝ) → (2 : ℝ) < |t| → ++ ‖riemannZeta (s + (3/2 : ℝ) + I * t)‖ < (10 : ℝ) + 2 * |t| := by ++ intro t s hs ht ++ set z := s + (3/2 : ℝ) + I * t with hz_def ++ ++ have hz_cond : z.re ∈ Ico (1/2 : ℝ) (3 : ℝ) ∧ (1 : ℝ) ≤ |z.im| := ++ lem_zfroms_conditions s t hs ht ++ ++ have h_bound : ‖riemannZeta z‖ < (8 : ℝ) + 2 * |z.im| := ++ lem_zetaUppBd z hz_cond.1 hz_cond.2 ++ ++ have hz_im_calc : z.im = s.im + t := (lem_zfroms_calc s t).2 ++ have h_im_bound : |z.im| ≤ 1 + |t| := by ++ rw [hz_im_calc] ++ exact lem_abs_im_bound s t hs ++ ++ have h_intermediate : ‖riemannZeta z‖ < (8 : ℝ) + 2 * (1 + |t|) := by ++ calc ‖riemannZeta z‖ ++ < (8 : ℝ) + 2 * |z.im| := h_bound ++ _ ≤ (8 : ℝ) + 2 * (1 + |t|) := by linarith [h_im_bound] ++ ++ have h_algebra : (8 : ℝ) + 2 * (1 + |t|) = (10 : ℝ) + 2 * |t| := by ring ++ ++ have h_final : ‖riemannZeta z‖ < (10 : ℝ) + 2 * |t| := by ++ linarith [h_intermediate, h_algebra] ++ ++ rwa [hz_def] at h_final ++ ++open Metric _root_.Set Filter Asymptotics BigOperators ++ ++noncomputable def logDerivZeta (s : ℂ) : ℂ := deriv riemannZeta s / riemannZeta s ++ ++def zerosetKfRc (R : ℝ) (c : ℂ) (f : ℂ → ℂ) : Set ℂ := ++ {ρ : ℂ | ρ ∈ Metric.closedBall c R ∧ f ρ = 0} ++ ++lemma zetadiffAtnot1 : ∀ s : ℂ, s ≠ 1 → DifferentiableAt ℂ riemannZeta s := ++ fun _ => differentiableAt_riemannZeta ++ ++lemma DiffAtWithinAt {T : Set ℂ} {g : ℂ → ℂ} {s : ℂ} (_hs : s ∈ T) : ++ DifferentiableAt ℂ g s → DifferentiableWithinAt ℂ g T s := ++ DifferentiableAt.differentiableWithinAt ++ ++lemma DiffWithinAtallOn {T : Set ℂ} {g : ℂ → ℂ} : ++ (∀ s ∈ T, DifferentiableWithinAt ℂ g T s) → DifferentiableOn ℂ g T := fun h => h ++ ++lemma DiffAtOn {T : Set ℂ} {g : ℂ → ℂ} : ++ (∀ s ∈ T, DifferentiableAt ℂ g s) → DifferentiableOn ℂ g T := by ++ intro h s hs ++ exact (h s hs).differentiableWithinAt ++ ++lemma DiffOnanalOnNhd {T : Set ℂ} (hT : IsOpen T) {g : ℂ → ℂ} : ++ DifferentiableOn ℂ g T → AnalyticOnNhd ℂ g T := by ++ intro hdiff ++ exact hdiff.analyticOnNhd hT ++ ++lemma DiffAtallanalOnNhd {T : Set ℂ} (hT : IsOpen T) {g : ℂ → ℂ} : ++ (∀ s ∈ T, DifferentiableAt ℂ g s) → AnalyticOnNhd ℂ g T := by ++ intro hdiff ++ apply DiffOnanalOnNhd hT ++ exact DiffAtOn hdiff ++ ++lemma zetaanalOnnot1 : AnalyticOnNhd ℂ riemannZeta {s : ℂ | s ≠ 1} := by ++ apply DiffAtallanalOnNhd ++ · apply isOpen_compl_singleton ++ · exact zetadiffAtnot1 ++ ++lemma I_mul_ofReal_im (t : ℝ) : (I * ↑t).im = t := by ++ have h1 : (I * (↑t : ℂ)).im = (↑t : ℂ).re := Complex.I_mul_im (↑t : ℂ) ++ rw [h1] ++ simp [Complex.ofReal_re] ++ ++lemma complex_im_sub_I_mul (a : ℂ) (t : ℝ) : (a - I * t).im = a.im - t := by ++ rw [Complex.sub_im] ++ rw [I_mul_ofReal_im] ++ ++lemma D1cinTt_pre (t : ℝ) (ht : |t| > 1) : ++ ∀ s ∈ closedBall (3/2 + I * t : ℂ) 1, s ≠ 1 := by ++ intro s hs ++ by_contra h ++ ++ rw [h] at hs ++ ++ rw [mem_closedBall] at hs ++ ++ rw [Complex.dist_eq] at hs ++ ++ have h1 : (1 : ℂ) - (3/2 + I * t) = -1/2 - I * t := by ring ++ rw [h1] at hs ++ ++ have h2 : (-1/2 - I * t : ℂ).im = -t := by ++ have : (-1/2 - I * t : ℂ) = (-1/2 : ℂ) - I * t := by ring ++ rw [this] ++ rw [complex_im_sub_I_mul] ++ simp ++ ++ have h3 : ‖(-1/2 - I * t : ℂ)‖ ≥ |(-1/2 - I * t : ℂ).im| := Complex.abs_im_le_norm _ ++ ++ rw [h2] at h3 ++ rw [abs_neg] at h3 ++ ++ have h4 : ‖(-1/2 - I * t : ℂ)‖ > 1 := lt_of_lt_of_le ht h3 ++ ++ linarith [h4, hs] ++ ++lemma D1cinTt (t : ℝ) (ht : |t| > 1) : ++ closedBall (3/2 + I * t : ℂ) 1 ⊆ {s : ℂ | s ≠ 1} := by ++ ++ exact fun s hs => D1cinTt_pre t ht s hs ++ ++lemma zetaanalOnD1c (t : ℝ) (ht : |t| > 1) : ++ AnalyticOnNhd ℂ riemannZeta (closedBall (3/2 + I * t : ℂ) 1) := by ++ apply zetaanalOnnot1.mono ++ exact D1cinTt t ht ++ ++lemma zetaanalOnD1c_general (x t : ℝ) (ht : |t| > 1) : ++ AnalyticOnNhd ℂ riemannZeta (closedBall (x + I * t : ℂ) 1) := by ++ apply zetaanalOnnot1.mono ++ ++ intro s hs ++ by_contra h ++ ++ have h' : s = 1 := by ++ simp at h ++ exact h ++ rw [h'] at hs ++ rw [mem_closedBall] at hs ++ rw [Complex.dist_eq] at hs ++ ++ have h1 : (1 : ℂ) - (x + I * t) = (1 - x) - I * t := by ring ++ rw [h1] at hs ++ ++ have h2 : ((1 - x) - I * t : ℂ).im = -t := by ++ rw [Complex.sub_im] ++ rw [Complex.sub_im] ++ rw [Complex.ofReal_im] ++ rw [I_mul_ofReal_im] ++ simp ++ ++ have h3 : ‖((1 - x) - I * t : ℂ)‖ ≥ |((1 - x) - I * t : ℂ).im| := Complex.abs_im_le_norm _ ++ rw [h2] at h3 ++ rw [abs_neg] at h3 ++ ++ have h4 : ‖((1 - x) - I * t : ℂ)‖ > 1 := lt_of_lt_of_le ht h3 ++ ++ linarith ++ ++lemma sigmageq1 (s : ℂ) (hs : s.re > 1) : riemannZeta s ≠ 0 := ++ riemannZeta_ne_zero_of_one_lt_re hs ++ ++lemma Complex_I_mul_ofReal_re (r : ℝ) : (I * (r : ℂ)).re = 0 := by ++ have h : (I * (r : ℂ)).re = -(r : ℂ).im := Complex.I_mul_re (r : ℂ) ++ rw [h] ++ simp ++ ++lemma re_real_add_I_mul_gt (a b : ℝ) (h : a > 1) : (a + I * b).re > 1 := by ++ rw [Complex.add_re] ++ rw [Complex.ofReal_re] ++ rw [Complex_I_mul_ofReal_re] ++ simp ++ exact h ++ ++lemma zetacnot0 (t : ℝ) : riemannZeta (3/2 + I * t) ≠ 0 := by ++ apply sigmageq1 ++ apply re_real_add_I_mul_gt ++ norm_num ++ ++lemma zetacnot0_general (x t : ℝ) (hx : x > 1) : riemannZeta (x + I * t) ≠ 0 := by ++ apply sigmageq1 ++ apply re_real_add_I_mul_gt ++ exact hx ++ ++lemma fc_analytic_normalized (c : ℂ) (f : ℂ → ℂ) ++ (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) : ++ (AnalyticOnNhd ℂ (fun z => f (z + c) / f c) (closedBall (0 : ℂ) 1)) ∧ (fun z => f (z + c) / f c) 0 = 1 := by ++ constructor ++ · ++ apply AnalyticOnNhd.div ++ · ++ apply AnalyticOnNhd.comp h_analytic ++ · ++ intro z _ ++ exact analyticAt_id.add analyticAt_const ++ · ++ intro z hz ++ rw [mem_closedBall] at hz ⊢ ++ rw [Complex.dist_eq] at hz ⊢ ++ ++ convert hz using 1 ++ ring_nf ++ · ++ exact analyticOnNhd_const ++ · ++ intro z _ ++ exact h_nonzero ++ · ++ simpa using h_nonzero ++ ++lemma deriv_normalized_nohd (c : ℂ) (f : ℂ → ℂ) (z : ℂ) (_h_nonzero : f c ≠ 0) : ++ deriv (fun w => f (w + c) / f c) z = (deriv f (z + c)) / f c := by ++ rw [deriv_div_const] ++ rw [deriv_comp_add_const] ++ ++lemma frac_cancel_const {x y c : ℂ} (hc : c ≠ 0) (hy : y ≠ 0) : (x / c) / (y / c) = x / y := by ++ field_simp [hc, hy] ++ ++lemma fc_log_deriv (c : ℂ) (f : ℂ → ℂ) ++ (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) ++ {z : ℂ} (hz_nonzero : f (z + c) ≠ 0) : ++ (deriv (fun w => f (w + c) / f c) z) / (f (z + c) / f c) = (deriv f (z + c)) / f (z + c) := by ++ ++ rw [deriv_normalized_nohd c f z h_nonzero] ++ ++ rw [frac_cancel_const h_nonzero hz_nonzero] ++ ++lemma fc_bound (B : ℝ) (_hB : B > 1) (R : ℝ) (_hRpos : 0 < R) (_hR : R < 1) (c : ℂ) (f : ℂ → ℂ) (_h_nonzero : f c ≠ 0) ++ (h_bound : ∀ z ∈ closedBall c R, ‖f z‖ ≤ B) : ++ ∀ z ∈ closedBall (0 : ℂ) R, ‖(fun w => f (w + c) / f c) z‖ ≤ B / ‖f c‖ := by ++ intro z hz ++ have hz' : ‖z‖ ≤ R := by ++ simpa [mem_closedBall, Complex.dist_eq] using hz ++ have hz_plus : z + c ∈ closedBall c R := by ++ have : ‖(z + c) - c‖ ≤ R := by simpa [add_sub_cancel] using hz' ++ simpa [mem_closedBall, Complex.dist_eq] using this ++ have hfb : ‖f (z + c)‖ ≤ B := h_bound (z + c) hz_plus ++ have hnorm : ‖f (z + c) / f c‖ = ‖f (z + c)‖ / ‖f c‖ := by ++ simp [div_eq_mul_inv, norm_inv] ++ have : ‖f (z + c)‖ / ‖f c‖ ≤ B / ‖f c‖ := ++ div_le_div_of_nonneg_right hfb (norm_nonneg _) ++ simpa [hnorm] using this ++ ++lemma fc_zeros (r : ℝ) (_h : r > 0) (c : ℂ) (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) ++ (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) : ++ (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)) = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := by ++ ext ρ'; constructor ++ · intro hmem ++ rcases hmem with ⟨hball, hzero⟩ ++ ++ have hprod : f (ρ' + c) * (f c)⁻¹ = 0 := by simpa [div_eq_mul_inv] using hzero ++ have hnum0 : f (ρ' + c) = 0 := by ++ rcases mul_eq_zero.mp hprod with hnum | hinv ++ · exact hnum ++ · have : (f c)⁻¹ ≠ 0 := inv_ne_zero h_nonzero ++ exact (this hinv).elim ++ refine ⟨ρ' + c, ?_, ?_⟩ ++ · ++ have hdist0 : dist ρ' (0 : ℂ) ≤ r := by simpa [mem_closedBall] using hball ++ have hdist1 : dist (ρ' + c) c ≤ r := by ++ simpa [Complex.dist_eq, add_sub_cancel] using hdist0 ++ have hmem_ball : ρ' + c ∈ closedBall c r := by ++ simpa [mem_closedBall] using hdist1 ++ exact And.intro hmem_ball hnum0 ++ · ++ simp ++ · intro him ++ rcases him with ⟨y, hy_mem, hy_eq⟩ ++ ++ subst hy_eq ++ rcases hy_mem with ⟨hy_ball, hy_zero⟩ ++ refine And.intro ?_ ?_ ++ · ++ have hdist : dist y c ≤ r := by simpa [mem_closedBall] using hy_ball ++ have hdist0 : dist (y - c) (0 : ℂ) ≤ r := by ++ simpa [Complex.dist_eq, sub_zero] using hdist ++ simpa [mem_closedBall] using hdist0 ++ · ++ simp [sub_add_cancel, hy_zero] ++ ++lemma analyticOrderAt_const_mul_eq (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : ++ analyticOrderAt (fun z => a * f z) z0 = analyticOrderAt f z0 := by ++ classical ++ by_cases hf : AnalyticAt ℂ f z0 ++ · ++ have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by ++ simpa using (analyticAt_const (x := z0) (v := a)) ++ have hconst_order_zero : analyticOrderAt (fun _ : ℂ => a) z0 = 0 := by ++ ++ refine (AnalyticAt.analyticOrderAt_eq_natCast (f := fun _ : ℂ => a) (z₀ := z0) hconst).mpr ?_ ++ refine ⟨(fun _ : ℂ => a), (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0), ?_, ?_⟩ ++ · simpa using ha ++ · exact Filter.Eventually.of_forall (fun _ => by simp) ++ have hmul := analyticOrderAt_mul (f := fun _ : ℂ => a) (g := f) hconst hf ++ ++ simpa [hconst_order_zero, zero_add] using! hmul ++ · ++ have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by ++ simpa using (analyticAt_const (x := z0) (v := a)) ++ have hconst_ne : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha ++ have hiff := (analyticAt_iff_analytic_fun_mul (f := fun _ : ℂ => a) (g := f) (z := z0) hconst hconst_ne) ++ have hmul : ¬ AnalyticAt ℂ (fun z => a * f z) z0 := by ++ intro h ++ have : AnalyticAt ℂ f z0 := (hiff.mpr (by simpa using h)) ++ exact hf this ++ ++ simp [analyticOrderAt, hf, hmul] ++ ++lemma AnalyticAt.comp_add_const {f : ℂ → ℂ} {z0 c : ℂ} (hf : AnalyticAt ℂ f (z0 + c)) : AnalyticAt ℂ (fun z => f (z + c)) z0 := by ++ ++ have hinner : AnalyticAt ℂ (fun z : ℂ => z + c) z0 := by ++ have h_id : AnalyticAt ℂ (fun z : ℂ => z) z0 := by ++ simpa [id] using! (analyticAt_id : AnalyticAt ℂ (id : ℂ → ℂ) z0) ++ have h_const : AnalyticAt ℂ (fun _ : ℂ => c) z0 := by ++ simpa using (analyticAt_const (v := c) (x := z0)) ++ simpa using (AnalyticAt.fun_add (f := fun z : ℂ => z) (g := fun _ : ℂ => c) (x := z0) h_id h_const) ++ ++ simpa using (AnalyticAt.fun_comp (x := z0) hf hinner) ++ ++lemma AnalyticAt.of_comp_add_const {f : ℂ → ℂ} {z0 c : ℂ} ++ (hg : AnalyticAt ℂ (fun z => f (z + c)) z0) : ++ AnalyticAt ℂ f (z0 + c) := by ++ ++ have hT : AnalyticAt ℂ (fun z => z - c) (z0 + c) := by ++ have h1 : AnalyticAt ℂ (fun z : ℂ => z) (z0 + c) := by ++ simpa using! (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (z0 + c)) ++ have h2 : AnalyticAt ℂ (fun _ : ℂ => -c) (z0 + c) := by ++ simpa using (analyticAt_const (x := (z0 + c)) (v := (-c : ℂ))) ++ have : AnalyticAt ℂ (fun z => z + (-c)) (z0 + c) := by ++ simpa using (AnalyticAt.fun_add h1 h2) ++ simpa [sub_eq_add_neg] using this ++ ++ have hx : (z0 + c) - c = z0 := by simp ++ have hg' : AnalyticAt ℂ (fun z => f (z + c)) ((z0 + c) - c) := by ++ simpa [hx] using hg ++ ++ have hcomp := ++ (AnalyticAt.comp (g := (fun z => f (z + c))) (f := (fun z => z - c)) (x := z0 + c) ++ hg' hT) ++ have hgf : ((fun z => f (z + c)) ∘ (fun z => z - c)) = f := by ++ funext z ++ simp [Function.comp, sub_eq_add_neg] ++ simpa [hgf] using hcomp ++ ++lemma order_top_iff_comp_add (f : ℂ → ℂ) (z0 c : ℂ) : ++ analyticOrderAt (fun z => f (z + c)) z0 = ⊤ ↔ analyticOrderAt f (z0 + c) = ⊤ := by ++ classical ++ let g : ℂ → ℂ := fun z => f (z + c) ++ ++ have eq_left : analyticOrderAt g z0 = ⊤ ↔ ∀ᶠ z in nhds z0, g z = 0 := by ++ simpa [g] using (analyticOrderAt_eq_top (f := g)) ++ have eq_right : analyticOrderAt f (z0 + c) = ⊤ ↔ ∀ᶠ w in nhds (z0 + c), f w = 0 := by ++ simpa using (analyticOrderAt_eq_top (f := f)) ++ constructor ++ · intro htop ++ have hz : ∀ᶠ z in nhds z0, g z = 0 := (eq_left.mp htop) ++ ++ have hcont_sub : ContinuousAt (fun w : ℂ => w - c) (z0 + c) := by ++ simpa [sub_eq_add_neg] using! ++ ((continuousAt_id).add (continuousAt_const : ContinuousAt (fun _ : ℂ => -c) (z0 + c))) ++ have htend : Tendsto (fun w : ℂ => w - c) (nhds (z0 + c)) (nhds ((z0 + c) - c)) := ++ hcont_sub.tendsto ++ have hz' : ∀ᶠ w in nhds ((z0 + c) - c), g w = 0 := by ++ simpa [sub_eq_add_neg, add_sub_cancel] using hz ++ have hw : ∀ᶠ w in nhds (z0 + c), g (w - c) = 0 := htend.eventually hz' ++ have hw' : ∀ᶠ w in nhds (z0 + c), f w = 0 := by ++ simpa [g, sub_add_cancel] using hw ++ exact eq_right.mpr hw' ++ · intro htop ++ have hw : ∀ᶠ w in nhds (z0 + c), f w = 0 := (eq_right.mp htop) ++ ++ have hcont_add : ContinuousAt (fun z : ℂ => z + c) z0 := ++ by simpa using! ((continuousAt_id).add (continuousAt_const : ContinuousAt (fun _ : ℂ => c) z0)) ++ have htend : Tendsto (fun z : ℂ => z + c) (nhds z0) (nhds (z0 + c)) := ++ hcont_add.tendsto ++ have hz : ∀ᶠ z in nhds z0, f (z + c) = 0 := htend.eventually hw ++ have hz' : ∀ᶠ z in nhds z0, g z = 0 := by simpa [g] using hz ++ exact eq_left.mpr hz' ++ ++lemma enat_le_iff_forall_nat {x y : ℕ∞} : x ≤ y ↔ ∀ n : ℕ, (n : ℕ∞) ≤ x → (n : ℕ∞) ≤ y := by ++ classical ++ constructor ++ · intro hxy n hnx ++ exact le_trans hnx hxy ++ · intro h ++ by_cases hx : x = ⊤ ++ · ++ subst hx ++ ++ by_contra hnot ++ have hy_ne : y ≠ ⊤ := by ++ simpa [WithTop.top_le_iff] using hnot ++ obtain ⟨m, hm⟩ := (WithTop.ne_top_iff_exists).1 hy_ne ++ ++ have h' : ((m + 1 : ℕ) : ℕ∞) ≤ y := h (m + 1) (by simp) ++ ++ have h'' : ((m + 1 : ℕ) : ℕ∞) ≤ (m : ℕ∞) := by ++ simpa [← hm] ++ using! h' ++ ++ have : m + 1 ≤ m := (WithTop.coe_le_coe).1 h'' ++ exact Nat.not_succ_le_self m this ++ · ++ obtain ⟨k, hk'⟩ := (WithTop.ne_top_iff_exists).1 hx ++ have hk : x = (k : ℕ∞) := hk'.symm ++ ++ have hxk : ((k : ℕ∞) ≤ y) := h k (by simp [hk]) ++ ++ simpa [hk] using hxk ++ ++lemma natCast_le_order_const_mul_iff (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) (n : ℕ) : ++ (n : ℕ∞) ≤ analyticOrderAt (fun z => a * f z) z0 ↔ (n : ℕ∞) ≤ analyticOrderAt f z0 := by ++ constructor ++ · intro h ++ simpa [analyticOrderAt_const_mul_eq f a z0 ha] using h ++ · intro h ++ simpa [analyticOrderAt_const_mul_eq f a z0 ha] using h ++ ++lemma order_top_iff_const_mul (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : ++ analyticOrderAt (fun z => a * f z) z0 = ⊤ ↔ analyticOrderAt f z0 = ⊤ := by ++ simp [analyticOrderAt_const_mul_eq (f := f) (a := a) (z0 := z0) ha] ++ ++lemma analyticOrderAt_mul_const_eq (f : ℂ → ℂ) (a z0 : ℂ) (ha : a ≠ 0) : ++ analyticOrderAt (fun z => f z * a) z0 = analyticOrderAt f z0 := by ++ classical ++ ++ have hcomm : (fun z => f z * a) = (fun z => a * f z) := by ++ funext z; simp [mul_comm] ++ have hrew : analyticOrderAt (fun z => f z * a) z0 = ++ analyticOrderAt (fun z => a * f z) z0 := by ++ simp [hcomm] ++ by_cases hf : AnalyticAt ℂ f z0 ++ · ++ have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by ++ simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0) ++ have hadd : analyticOrderAt (fun z => a * f z) z0 ++ = analyticOrderAt (fun _ : ℂ => a) z0 + analyticOrderAt f z0 := by ++ simpa using! (analyticOrderAt_mul hconst hf) ++ ++ have hconst_zero : analyticOrderAt (fun _ : ℂ => a) z0 = 0 := by ++ have hiff := (AnalyticAt.analyticOrderAt_eq_zero hconst) ++ have hval : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha ++ exact hiff.mpr hval ++ calc ++ analyticOrderAt (fun z => f z * a) z0 ++ = analyticOrderAt (fun z => a * f z) z0 := hrew ++ _ = analyticOrderAt (fun _ : ℂ => a) z0 + analyticOrderAt f z0 := hadd ++ _ = 0 + analyticOrderAt f z0 := by simp [hconst_zero] ++ _ = analyticOrderAt f z0 := by simp ++ · ++ have hnot : ¬ AnalyticAt ℂ (fun z => a * f z) z0 := by ++ intro hmul ++ have hconst : AnalyticAt ℂ (fun _ : ℂ => a) z0 := by ++ simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => a) z0) ++ have hval : (fun _ : ℂ => a) z0 ≠ 0 := by simpa using ha ++ ++ have hiff := (analyticAt_iff_analytic_fun_smul (h₁f := hconst) (h₂f := hval) ++ (g := f) (z := z0)) ++ have hsmul : AnalyticAt ℂ (fun z => (fun _ : ℂ => a) z • f z) z0 := by ++ ++ simpa [smul_eq_mul] using hmul ++ have : AnalyticAt ℂ f z0 := hiff.mpr hsmul ++ exact hf this ++ calc ++ analyticOrderAt (fun z => f z * a) z0 ++ = analyticOrderAt (fun z => a * f z) z0 := hrew ++ _ = 0 := by simp [analyticOrderAt, hnot] ++ _ = analyticOrderAt f z0 := by simp [analyticOrderAt, hf] ++ ++lemma fc_m_order (r : ℝ) (_h : r > 0) (c : ℂ) (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) ++ (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) ++ {ρ' : ℂ} (_hρ' : ρ' ∈ zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)) : ++ analyticOrderAt (fun z => f (z + c) / f c) ρ' = analyticOrderAt f (ρ' + c) := by ++ classical ++ ++ set g0 : ℂ → ℂ := fun z => f (z + c) with hg0 ++ ++ have hconst : analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' = analyticOrderAt g0 ρ' := by ++ have hne : (1 / f c) ≠ 0 := one_div_ne_zero h_nonzero ++ simpa using (analyticOrderAt_mul_const_eq (f := g0) (a := (1 / f c)) (z0 := ρ') hne) ++ have hconst_rewrite : analyticOrderAt (fun z => f (z + c) / f c) ρ' ++ = analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' := by ++ have : (fun z => f (z + c) / f c) = (fun z => g0 z * (1 / f c)) := by ++ funext z; simp [g0, div_eq_mul_inv, mul_comm] ++ simp [this] ++ ++ have htrans : analyticOrderAt g0 ρ' = analyticOrderAt f (ρ' + c) := by ++ ++ by_cases hfA : AnalyticAt ℂ f (ρ' + c) ++ · ++ have h_add : AnalyticAt ℂ (fun z : ℂ => z + c) ρ' := by ++ simpa using! (AnalyticAt.add (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) ρ') ++ (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) ρ')) ++ have hgA : AnalyticAt ℂ g0 ρ' := by ++ have : AnalyticAt ℂ f ((fun z : ℂ => z + c) ρ') := by simpa using hfA ++ simpa [g0, hg0] using! (AnalyticAt.comp (g := f) (f := fun z : ℂ => z + c) (x := ρ') this h_add) ++ ++ by_cases hgez : (∀ᶠ z in nhds ρ', g0 z = 0) ++ · ++ have hT_sub_cont : ContinuousAt (fun w : ℂ => w - c) (ρ' + c) := by ++ simpa using! (ContinuousAt.sub (continuousAt_id : ContinuousAt (fun w : ℂ => w) (ρ' + c)) ++ (continuousAt_const : ContinuousAt (fun _ : ℂ => c) (ρ' + c))) ++ have hT_sub : Tendsto (fun w : ℂ => w - c) (nhds (ρ' + c)) (nhds ρ') := by ++ simpa using (hT_sub_cont.tendsto) ++ have hEfw : ∀ᶠ w in nhds (ρ' + c), f w = 0 := by ++ have : ∀ᶠ w in nhds (ρ' + c), g0 (w - c) = 0 := hT_sub.eventually hgez ++ ++ simpa [g0, hg0, sub_add_cancel] using this ++ ++ have hg_top : analyticOrderAt g0 ρ' = ⊤ := ++ (analyticOrderAt_eq_top (f := g0) (z₀ := ρ')).2 hgez ++ have hf_top : analyticOrderAt f (ρ' + c) = ⊤ := ++ (analyticOrderAt_eq_top (f := f) (z₀ := ρ' + c)).2 hEfw ++ simp [hg_top, hf_top] ++ · ++ have h_exists := (AnalyticAt.exists_eventuallyEq_pow_smul_nonzero_iff hgA).mpr hgez ++ rcases h_exists with ⟨n, φ, hφA, hφ_ne, hevent⟩ ++ ++ have hT_sub_cont : ContinuousAt (fun w : ℂ => w - c) (ρ' + c) := by ++ simpa using! (ContinuousAt.sub (continuousAt_id : ContinuousAt (fun w : ℂ => w) (ρ' + c)) ++ (continuousAt_const : ContinuousAt (fun _ : ℂ => c) (ρ' + c))) ++ have hT_sub : Tendsto (fun w : ℂ => w - c) (nhds (ρ' + c)) (nhds ρ') := by ++ simpa using (hT_sub_cont.tendsto) ++ have hevent_w : ∀ᶠ w in nhds (ρ' + c), f w ++ = (w - (ρ' + c)) ^ n * ((fun w => φ (w - c)) w) := by ++ have : ∀ᶠ w in nhds (ρ' + c), g0 (w - c) ++ = ((w - c) - ρ') ^ n * φ (w - c) := ++ hT_sub.eventually hevent ++ ++ refine this.mono ?_ ++ intro w hw ++ have hsubsimp : (w - c) - ρ' = w - (ρ' + c) := by ring ++ simpa [g0, hg0, hsubsimp] using hw ++ ++ have hψA : AnalyticAt ℂ (fun w => φ (w - c)) (ρ' + c) := by ++ have h_subA : AnalyticAt ℂ (fun w : ℂ => w - c) (ρ' + c) := by ++ simpa using! (AnalyticAt.sub (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (ρ' + c)) ++ (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) (ρ' + c))) ++ have hφA_at : AnalyticAt ℂ φ ((fun w : ℂ => w - c) (ρ' + c)) := by simpa using hφA ++ simpa using! (AnalyticAt.comp (g := φ) (f := fun w => w - c) (x := (ρ' + c)) hφA_at h_subA) ++ have hψ_ne : (fun w => φ (w - c)) (ρ' + c) ≠ 0 := by ++ ++ simpa using hφ_ne ++ ++ have hg_eq_n : analyticOrderAt g0 ρ' = n := by ++ exact (AnalyticAt.analyticOrderAt_eq_natCast (f := g0) (z₀ := ρ') hgA).mpr ++ ⟨φ, hφA, hφ_ne, hevent⟩ ++ have hf_eq_n : analyticOrderAt f (ρ' + c) = n := by ++ exact (AnalyticAt.analyticOrderAt_eq_natCast (f := f) (z₀ := ρ' + c) hfA).mpr ++ ⟨(fun w => φ (w - c)), hψA, hψ_ne, hevent_w⟩ ++ simp [hg_eq_n, hf_eq_n] ++ · ++ have hg_not : ¬ AnalyticAt ℂ g0 ρ' := by ++ intro hgA ++ ++ have h_subA : AnalyticAt ℂ (fun w : ℂ => w - c) (ρ' + c) := by ++ simpa using! (AnalyticAt.sub (analyticAt_id : AnalyticAt ℂ (fun z : ℂ => z) (ρ' + c)) ++ (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) (ρ' + c))) ++ have hgA_at : AnalyticAt ℂ g0 ((ρ' + c) - c) := by simpa using hgA ++ have hcomp := (AnalyticAt.comp (g := g0) (f := fun w => w - c) ++ (x := (ρ' + c)) hgA_at h_subA) ++ ++ have : AnalyticAt ℂ (fun w : ℂ => g0 (w - c)) (ρ' + c) := by simpa using! hcomp ++ have : AnalyticAt ℂ f (ρ' + c) := by ++ simpa [g0, hg0, sub_add_cancel] using this ++ exact hfA this ++ ++ simp [analyticOrderAt, hfA, hg_not] ++ ++ calc ++ analyticOrderAt (fun z => f (z + c) / f c) ρ' ++ = analyticOrderAt (fun z => g0 z * (1 / f c)) ρ' := hconst_rewrite ++ _ = analyticOrderAt g0 ρ' := hconst ++ _ = analyticOrderAt f (ρ' + c) := htrans ++ ++lemma DminusK (r1 : ℝ) (R1 : ℝ) (_hr1 : r1 > 0) (_hR1 : R1 > 0) (c : ℂ) (f : ℂ → ℂ) ++ (_h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) : ++ ∀ z : ℂ, z ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun w => f (w + c) / f c) ↔ ++ z + c ∈ closedBall c r1 \ zerosetKfRc R1 c f := by ++ intro z ++ constructor ++ · ++ intro ⟨hz_ball, hz_not_zero⟩ ++ constructor ++ · ++ have hdist : dist z (0 : ℂ) ≤ r1 := by simpa [mem_closedBall] using hz_ball ++ have hdist_c : dist (z + c) c ≤ r1 := by ++ simpa [Complex.dist_eq, add_sub_cancel] using hdist ++ simpa [mem_closedBall] using hdist_c ++ · ++ intro h_contra ++ apply hz_not_zero ++ ++ rcases h_contra with ⟨hz_c_ball, hz_c_zero⟩ ++ constructor ++ · ++ have hdist_c : dist (z + c) c ≤ R1 := by simpa [mem_closedBall] using hz_c_ball ++ have hdist_0 : dist z (0 : ℂ) ≤ R1 := by ++ simpa [Complex.dist_eq, add_sub_cancel] using hdist_c ++ simpa [mem_closedBall] using hdist_0 ++ · ++ have : f (z + c) = 0 := hz_c_zero ++ simp [this, zero_div] ++ · ++ intro ⟨hz_c_ball, hz_c_not_zero⟩ ++ constructor ++ · ++ have hdist_c : dist (z + c) c ≤ r1 := by simpa [mem_closedBall] using hz_c_ball ++ have hdist_0 : dist z (0 : ℂ) ≤ r1 := by ++ simpa [Complex.dist_eq, add_sub_cancel] using hdist_c ++ simpa [mem_closedBall] using hdist_0 ++ · ++ intro h_contra ++ apply hz_c_not_zero ++ ++ rcases h_contra with ⟨hz_ball, hz_zero⟩ ++ constructor ++ · ++ have hdist_0 : dist z (0 : ℂ) ≤ R1 := by simpa [mem_closedBall] using hz_ball ++ have hdist_c : dist (z + c) c ≤ R1 := by ++ simpa [Complex.dist_eq, add_sub_cancel] using hdist_0 ++ simpa [mem_closedBall] using hdist_c ++ · ++ have h_div_zero : f (z + c) / f c = 0 := hz_zero ++ have h_mul_zero : f (z + c) * (f c)⁻¹ = 0 := by simpa [div_eq_mul_inv] using h_div_zero ++ cases' mul_eq_zero.mp h_mul_zero with h_num h_inv ++ · exact h_num ++ · have : (f c)⁻¹ ≠ 0 := inv_ne_zero h_nonzero ++ exact (this h_inv).elim ++ ++lemma shifted_zeros_correspondence (R1 : ℝ) (hR1 : R1 > 0) (c z : ℂ) ++ (f : ℂ → ℂ) (h_nonzero : f c ≠ 0) (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) ++ (hfin_orig : (zerosetKfRc R1 c f).Finite) ++ (hfin_shift : (zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c)).Finite) : ++ ∑ ρ ∈ hfin_orig.toFinset, ((analyticOrderAt f ρ).toNat : ℂ) / (z - ρ) = ++ ∑ ρ' ∈ hfin_shift.toFinset, ((analyticOrderAt (fun u => f (u + c) / f c) ρ').toNat : ℂ) / ((z - c) - ρ') := by ++ ++ have h_bij : (zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c)) = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := ++ fc_zeros R1 hR1 c f h_nonzero h_analytic ++ ++ apply Finset.sum_bij (fun ρ _ => ρ - c) ++ ++ · intro ρ hρ ++ simp only [Set.Finite.mem_toFinset] at hρ ⊢ ++ rw [h_bij] ++ use ρ, hρ ++ ++ · intro ρ₁ hρ₁ ρ₂ hρ₂ h_eq ++ ++ have : ρ₁ = ρ₁ - c + c := by ring ++ rw [this, h_eq] ++ ring ++ ++ · intro ρ' hρ' ++ simp only [Set.Finite.mem_toFinset] at hρ' ++ rw [h_bij] at hρ' ++ obtain ⟨ρ, hρ_mem, hρ_eq⟩ := hρ' ++ use ρ ++ simp only [Set.Finite.mem_toFinset] ++ exact ⟨hρ_mem, hρ_eq⟩ ++ ++ · intro ρ hρ ++ simp only [Set.Finite.mem_toFinset] at hρ ++ ++ have h_shift_mem : ρ - c ∈ zerosetKfRc R1 (0 : ℂ) (fun u => f (u + c) / f c) := by ++ rw [h_bij] ++ use ρ, hρ ++ ++ have h_order := fc_m_order R1 hR1 c f h_nonzero h_analytic h_shift_mem ++ ++ have h_add : (ρ - c) + c = ρ := by ring ++ rw [h_add] at h_order ++ rw [← h_order] ++ ++ ring ++ ++lemma final_ineq2 ++ (B : ℝ) (hB : 1 < B) (r1 r R R1 : ℝ) (hr1pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < R1) ++ (hR1_lt_R : R1 < R) (hR : R < 1) ++ (c : ℂ) (f : ℂ → ℂ) (h_analytic : AnalyticOnNhd ℂ f (closedBall c 1)) (h_nonzero : f c ≠ 0) ++ (h_bound : ∀ z ∈ closedBall c R, ‖f z‖ < B) ++ (hfin : (zerosetKfRc R1 (0 : ℂ) (fun z => f (z + c) / f c)).Finite) : ++ ∀ z ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun z => f (z + c) / f c), ++ ‖(deriv (fun z => f (z + c) / f c) z / (f (z + c) / f c)) - ∑ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt (fun w => f (w + c) / f c) ρ).toNat : ℂ) / (z - ρ)‖ ≤ (16 * r^2 / ((r - r1)^3) + ++ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (B / ‖f c‖) := by ++ intro z hz ++ ++ let g : ℂ → ℂ := fun w => f (w + c) / f c ++ ++ have hR_pos : 0 < R := by linarith [hr1pos, hr1_lt_r, hr_lt_R1, hR1_lt_R] ++ have hR1_pos : 0 < R1 := by linarith [hr1pos, hr1_lt_r, hr_lt_R1] ++ have h_norm_pos : 0 < ‖f c‖ := norm_pos_iff.mpr h_nonzero ++ ++ have h_fc_bound_at_c : ‖f c‖ < B := by ++ apply h_bound ++ rw [mem_closedBall, dist_self] ++ exact le_of_lt hR_pos ++ ++ have h_B_div_gt_one : 1 < B / ‖f c‖ := by ++ rw [one_lt_div h_norm_pos] ++ exact h_fc_bound_at_c ++ ++ have h_g_analytic : ∀ w ∈ closedBall (0 : ℂ) 1, AnalyticAt ℂ g w := ++ (fc_analytic_normalized c f h_analytic h_nonzero).1 ++ ++ have h_g_zero : g 0 = 1 := ++ (fc_analytic_normalized c f h_analytic h_nonzero).2 ++ ++ have h_g_bound : ∀ w ∈ closedBall (0 : ℂ) R, ‖g w‖ ≤ B / ‖f c‖ := by ++ apply fc_bound B hB R hR_pos hR c f h_nonzero ++ intro w hw ++ exact le_of_lt (h_bound w hw) ++ ++ have h_zeroset_equiv : zerosetKfRc R1 (0 : ℂ) g = zerosetKfR R1 hR1_pos g := by ++ ext ρ ++ simp only [zerosetKfRc, zerosetKfR, mem_ofPred_eq, mem_closedBall, Complex.dist_eq, sub_zero] ++ ++ have h_g_finite : (zerosetKfR R1 hR1_pos g).Finite := by ++ rwa [← h_zeroset_equiv] ++ ++ have h_σ_exists : ∃ h_σ : ℂ → (ℂ → ℂ), ∀ σ ∈ zerosetKfR R1 hR1_pos g, ++ AnalyticAt ℂ (h_σ σ) σ ∧ h_σ σ σ ≠ 0 ∧ ++ ∀ᶠ w in nhds σ, g w = (w - σ) ^ (analyticOrderAt g σ).toNat * h_σ σ w := by ++ ++ classical ++ let h_σ : ℂ → (ℂ → ℂ) := fun σ => ++ if hσ : σ ∈ zerosetKfR R1 hR1_pos g ++ then Classical.choose (lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR g h_g_analytic ++ (by simp [g]; exact h_nonzero) σ hσ) ++ else fun _ => 0 ++ use h_σ ++ intro σ hσ ++ simp only [h_σ, dite_eq_left hσ] ++ exact Classical.choose_spec (lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR g h_g_analytic ++ (by simp [g]; exact h_nonzero) σ hσ) ++ ++ obtain ⟨h_σ, h_σ_spec⟩ := h_σ_exists ++ ++ have := final_ineq1 (B / ‖f c‖) h_B_div_gt_one r1 r R R1 hr1pos hr1_lt_r hr_lt_R1 hR1_lt_R hR ++ g h_g_analytic h_g_zero h_g_finite h_σ_spec h_g_bound z ++ ++ have hz_domain : z ∈ closedBall (0 : ℂ) r1 \ zerosetKfR R1 hR1_pos g := by ++ rw [h_zeroset_equiv] at hz ++ exact hz ++ ++ exact this hz_domain ++ ++lemma log_Deriv_Expansion_Zeta (t : ℝ) (ht : |t| > 2) ++ (r1 r R1 R : ℝ) ++ (hr1_pos : 0 < r1) (hr1_lt_r : r1 < r) ++ (_hr_pos : 0 < r) (hr_lt_R1 : r < R1) (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) : ++ let c := (3/2 : ℂ) + I * t ++ ∀ B > 1, (∀ z ∈ closedBall c R, ‖riemannZeta z‖ < B) → ++ ∀ (hfin : (zerosetKfRc R1 c riemannZeta).Finite), ++ ∀ z ∈ closedBall c r1 \ zerosetKfRc R1 c riemannZeta, ++ ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ (16 * r^2 / ((r - r1)^3) + ++ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (B / ‖riemannZeta c‖) := by ++ intro c B hB h_bound hfin z hzmem ++ ++ have ht1 : |t| > 1 := lt_trans (by norm_num : (1 : ℝ) < 2) (by simpa using ht) ++ ++ have hζ_analytic : AnalyticOnNhd ℂ riemannZeta (closedBall c 1) := by ++ simpa [c] using zetaanalOnD1c t ht1 ++ have hζ_c_ne : riemannZeta c ≠ 0 := by simpa [c] using zetacnot0 t ++ ++ have hfin_shift : (zerosetKfRc R1 (0 : ℂ) (fun u => riemannZeta (u + c) / riemannZeta c)).Finite := by ++ have h_bij := fc_zeros R1 hR1_pos c riemannZeta hζ_c_ne hζ_analytic ++ have himg : ((fun ρ => ρ - c) '' (zerosetKfRc R1 c riemannZeta)).Finite := hfin.image _ ++ simpa [h_bij] using himg ++ ++ have hz0mem : (z - c) ∈ closedBall (0 : ℂ) r1 \ zerosetKfRc R1 (0 : ℂ) (fun u => riemannZeta (u + c) / riemannZeta c) := by ++ have hiff := DminusK r1 R1 hr1_pos hR1_pos c riemannZeta hζ_analytic hζ_c_ne (z - c) ++ exact (hiff).mpr (by simpa [sub_add_cancel] using hzmem) ++ ++ have hineq0 := ++ (final_ineq2 B hB r1 r R R1 hr1_pos hr1_lt_r hr_lt_R1 hR1_lt_R hR_lt_1 c riemannZeta ++ hζ_analytic hζ_c_ne h_bound hfin_shift) (z - c) hz0mem ++ ++ rcases hzmem with ⟨hz_ball, hz_notin⟩ ++ have hr1_lt_R1' : r1 < R1 := lt_trans hr1_lt_r hr_lt_R1 ++ have hz_in_ball_R1 : z ∈ closedBall c R1 := by ++ have hz_le_r1 : dist z c ≤ r1 := by simpa [mem_closedBall] using hz_ball ++ have hr1_le_R1 : r1 ≤ R1 := le_of_lt hr1_lt_R1' ++ have hz_le_R1 : dist z c ≤ R1 := le_trans hz_le_r1 hr1_le_R1 ++ simpa [mem_closedBall] using hz_le_R1 ++ have hzeta_ne : riemannZeta z ≠ 0 := by ++ intro hz0 ++ exact hz_notin ⟨hz_in_ball_R1, hz0⟩ ++ ++ have hcancel_frac : (deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta c) ++ / (riemannZeta z / riemannZeta c) ++ = deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta z := by ++ have hc : riemannZeta c ≠ 0 := hζ_c_ne ++ have hy : riemannZeta z ≠ 0 := hzeta_ne ++ simpa using (frac_cancel_const (x := deriv (fun x => riemannZeta (x + c)) (z - c)) ++ (y := riemannZeta z) (c := riemannZeta c) hc hy) ++ have hcancel_all : (deriv (fun x => riemannZeta (x + c)) (z - c) / riemannZeta c) ++ / (riemannZeta z / riemannZeta c) ++ = deriv riemannZeta z / riemannZeta z := by ++ simpa [deriv_comp_add_const, sub_add_cancel] using hcancel_frac ++ ++ have hineq1 : ‖(deriv riemannZeta z / riemannZeta z) ++ - ∑ ρ ∈ hfin_shift.toFinset, ++ ((analyticOrderAt (fun u => riemannZeta (u + c) / riemannZeta c) ρ).toNat : ℂ) ++ / ((z - c) - ρ)‖ ++ ≤ (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * ++ Real.log (B / ‖riemannZeta c‖) := by ++ simpa [hcancel_all] using hineq0 ++ ++ have hsum_eq := shifted_zeros_correspondence R1 hR1_pos c z riemannZeta hζ_c_ne hζ_analytic hfin hfin_shift ++ ++ have hineq2 : ‖(deriv riemannZeta z / riemannZeta z) ++ - ∑ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ++ ≤ (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * ++ Real.log (B / ‖riemannZeta c‖) := by ++ simpa [hsum_eq] using hineq1 ++ ++ simpa [logDerivZeta] using hineq2 ++ ++lemma zeta32lower : ∃ a > 0, ∀ t : ℝ, ‖riemannZeta (3/2 + I * t)‖ ≥ a := by ++ rcases zeta_low_332 with ⟨a, ha_pos, hbound⟩ ++ refine ⟨a, ha_pos, ?_⟩ ++ intro t ++ simpa [mul_comm] using! (hbound t) ++ ++lemma zeta32lower_log : ∃ A > 1, ∀ t : ℝ, ++ Real.log (1 / ‖riemannZeta (3/2 + I * t)‖) ≤ A := by ++ obtain ⟨a, ha_pos, hbound⟩ := zeta32lower ++ refine ⟨max (2 : ℝ) (Real.log (1 / a)), ?_, ?_⟩ ++ · have h1 : (1 : ℝ) < 2 := by norm_num ++ have h2 : (2 : ℝ) ≤ max (2 : ℝ) (Real.log (1 / a)) := by exact le_max_left _ _ ++ exact lt_of_lt_of_le h1 h2 ++ · intro t ++ set x := ‖riemannZeta (3/2 + I * t)‖ with hx ++ have hax : a ≤ x := by ++ simpa [hx] using (hbound t) ++ have hxpos : 0 < x := lt_of_lt_of_le ha_pos hax ++ have hxy : 1 / x ≤ 1 / a := by ++ ++ have := one_div_le_one_div_of_le ha_pos hax ++ ++ simpa [hx] using this ++ have hxpos' : 0 < 1 / x := one_div_pos.mpr hxpos ++ have hlog : Real.log (1 / x) ≤ Real.log (1 / a) := ++ Real.log_le_log hxpos' hxy ++ have : Real.log (1 / x) ≤ max (2 : ℝ) (Real.log (1 / a)) := ++ le_trans hlog (le_max_right _ _) ++ simpa [hx] using this ++ ++lemma zeta32upper_pre : ∃ b > 1, ∀ t : ℝ, ∀ s : ℂ, ‖s‖ ≤ 1 → (2 : ℝ) < |t| → ‖riemannZeta (s + 3/2 + Complex.I * t)‖ < b * |t| := by ++ refine ⟨(12 : ℝ), by norm_num, ?_⟩ ++ intro t s hs ht ++ have hlt : ‖riemannZeta (s + 3/2 + Complex.I * t)‖ < (10 : ℝ) + 2 * |t| := by ++ simpa using! (lem_zetaUppBound t s hs ht) ++ have honele : (1 : ℝ) ≤ |t| := by ++ have : (1 : ℝ) < |t| := lt_trans (by norm_num) ht ++ exact le_of_lt this ++ have h10le : (10 : ℝ) ≤ 10 * |t| := by ++ simpa [mul_comm] using ++ (mul_le_mul_of_nonneg_right honele (by norm_num : (0 : ℝ) ≤ (10 : ℝ))) ++ have hle2 : (10 : ℝ) + 2 * |t| ≤ (12 : ℝ) * |t| := by ++ have htmp := add_le_add_left h10le (2 * |t|) ++ have hcalc : 10 * |t| + 2 * |t| = (12 : ℝ) * |t| := by ring ++ simpa [hcalc] using! htmp ++ exact lt_of_lt_of_le hlt hle2 ++ ++lemma zeta32upper : ∃ b > 1, ∀ t : ℝ, |t| > 2 → ++ let c := (3/2 : ℂ) + I * t ++ ∀ s ∈ closedBall c 1, ‖riemannZeta s‖ < b * |t| := by ++ ++ obtain ⟨b, hb_gt, hbound⟩ := zeta32upper_pre ++ refine ⟨b, hb_gt, ?_⟩ ++ intro t ht c s hs ++ ++ rw [mem_closedBall] at hs ++ ++ set s_pre := s - c with hs_pre_def ++ have hs_pre_bound : ‖s_pre‖ ≤ 1 := by ++ rw [hs_pre_def] ++ rwa [Complex.dist_eq] at hs ++ ++ have hs_eq : s = s_pre + 3/2 + I * t := by ++ rw [hs_pre_def] ++ ring ++ ++ rw [hs_eq] ++ exact hbound t s_pre hs_pre_bound ht ++ ++lemma closedBall_subset_unit (c : ℂ) (R : ℝ) (hR_lt_1 : R < 1) : ++ Metric.closedBall c R ⊆ Metric.closedBall c 1 := by ++ apply Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) ++ ++lemma zeta_c_nonzero (t : ℝ) : riemannZeta (3/2 + I * t) ≠ 0 := by ++ exact zetacnot0 t ++ ++lemma zeta_c_norm_pos (t : ℝ) : 0 < ‖riemannZeta (3/2 + I * t)‖ := by ++ have h := zetacnot0 t ++ exact norm_pos_iff.mpr h ++ ++lemma Zeta1_Zeta_Expand : ++ ∃ A > 1, ∃ b > 1, ++ ∀ (t : ℝ) (_ht : |t| > 2) ++ (r1 r R1 R : ℝ) ++ (_hr1_pos : 0 < r1) (_hr1_lt_r : r1 < r) ++ (_hr_pos : 0 < r) (_hr_lt_R1 : r < R1) (_hR1_pos : 0 < R1) (_hR1_lt_R : R1 < R) (_hR_lt_1 : R < 1), ++ let c := (3/2 : ℂ) + I * t; ++ ∀ (hfin : (zerosetKfRc R1 c riemannZeta).Finite), ++ ∀ z ∈ closedBall c r1 \ zerosetKfRc R1 c riemannZeta, ++ ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ ++ (16 * r^2 / ((r - r1)^3) + ++ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * (Real.log |t| + Real.log b + A) := by ++ ++ obtain ⟨b, hbgt1, hb⟩ := zeta32upper ++ obtain ⟨A, hAgt1, hA⟩ := zeta32lower_log ++ ++ refine ⟨A, hAgt1, b, hbgt1, ?_⟩ ++ intro t ht r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 c hfin z hz ++ ++ have hexp_lemma := log_Deriv_Expansion_Zeta t ht r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 ++ ++ have htpos : (0 : ℝ) < |t| := by linarith [ht] ++ have hBgt1 : b * |t| > 1 := by ++ have hb_pos : (0 : ℝ) < b := by linarith [hbgt1] ++ calc (1 : ℝ) < 1 * 2 := by norm_num ++ _ < b * 2 := mul_lt_mul_of_pos_right (by linarith [hbgt1]) (by norm_num) ++ _ < b * |t| := mul_lt_mul_of_pos_left ht hb_pos ++ ++ have hbound_ball : ∀ s ∈ closedBall (3/2 + I * t) R, ‖riemannZeta s‖ < b * |t| := by ++ have hsubset : closedBall (3/2 + I * t) R ⊆ closedBall (3/2 + I * t) 1 := ++ Metric.closedBall_subset_closedBall (le_of_lt hR_lt_1) ++ intro s hs ++ have hs1 : s ∈ closedBall (3/2 + I * t) 1 := hsubset hs ++ have ht2 : |t| > 2 := by linarith [ht] ++ specialize hb t ht2 ++ exact hb s hs1 ++ ++ have hexp := hexp_lemma (b * |t|) hBgt1 hbound_ball hfin z hz ++ ++ have hζne : riemannZeta (3/2 + I * t) ≠ 0 := zetacnot0 t ++ have hζpos : (0 : ℝ) < ‖riemannZeta (3/2 + I * t)‖ := norm_pos_iff.mpr hζne ++ ++ have hBpos : (0 : ℝ) < b * |t| := mul_pos (by linarith [hbgt1]) htpos ++ have hBne : b * |t| ≠ 0 := ne_of_gt hBpos ++ have htne : |t| ≠ 0 := ne_of_gt htpos ++ have hbne : b ≠ 0 := ne_of_gt (by linarith [hbgt1]) ++ ++ have hlog_bound : Real.log (b * |t| / ‖riemannZeta (3/2 + I * t)‖) ≤ ++ Real.log |t| + Real.log b + A := by ++ rw [Real.log_div hBne (ne_of_gt hζpos)] ++ rw [Real.log_mul hbne htne] ++ ++ have hA_bound := hA t ++ have : -Real.log ‖riemannZeta (3/2 + I * t)‖ ≤ A := by ++ have eq_neg : Real.log (1 / ‖riemannZeta (3/2 + I * t)‖) = -Real.log ‖riemannZeta (3/2 + I * t)‖ := by ++ rw [Real.log_div (by norm_num) (ne_of_gt hζpos)] ++ simp ++ rw [← eq_neg] ++ exact hA_bound ++ linarith ++ ++ have hcoeff_nonneg : (0 : ℝ) ≤ 16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) := by ++ apply add_nonneg ++ · apply div_nonneg ++ · apply mul_nonneg ++ · norm_num ++ · apply sq_nonneg ++ · apply le_of_lt ++ apply pow_pos ++ linarith [hr1_lt_r] ++ · apply div_nonneg ++ · norm_num ++ · apply le_of_lt ++ apply mul_pos ++ · ++ have h_gt : R > R1 := hR1_lt_R ++ have h1_pos : (1 : ℝ) < R/R1 := by ++ rw [one_lt_div] ++ · exact h_gt ++ · exact hR1_pos ++ have h_sq_div : R^2/R1 = R * (R/R1) := by ++ field_simp [ne_of_gt hR1_pos] ++ rw [h_sq_div] ++ have h_r_pos : (0 : ℝ) < R := by linarith [hR1_pos, h_gt] ++ have : R * (R/R1) > R * 1 := by ++ apply mul_lt_mul_of_pos_left h1_pos h_r_pos ++ simp at this ++ linarith [this] ++ · apply Real.log_pos ++ rw [one_lt_div] ++ · exact hR1_lt_R ++ · exact hR1_pos ++ ++ calc ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ++ ≤ (16 * r^2 / ((r - r1)^3) + ++ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * Real.log (b * |t| / ‖riemannZeta (3/2 + I * t)‖) := hexp ++ _ ≤ (16 * r^2 / ((r - r1)^3) + ++ 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) * (Real.log |t| + Real.log b + A) := by ++ exact mul_le_mul_of_nonneg_left hlog_bound hcoeff_nonneg ++ ++lemma helper_log_ratio_le_sum (b t x A : ℝ) ++ (hb : b > 1) (ht : 0 < |t|) (hx : 0 < x) (hA : Real.log (1 / x) ≤ A) : ++ Real.log ((b * |t|) / x) ≤ Real.log |t| + Real.log b + A := by ++ have hbpos : 0 < b := lt_trans (by norm_num) hb ++ have hb_ne : (b : ℝ) ≠ 0 := ne_of_gt hbpos ++ have ht_ne : |t| ≠ 0 := ne_of_gt ht ++ have hx_ne : x ≠ 0 := ne_of_gt hx ++ have h_inv_ne : (1 / x) ≠ 0 := one_div_ne_zero hx_ne ++ calc ++ Real.log ((b * |t|) / x) ++ = Real.log ((b * |t|) * (1 / x)) := by simp [div_eq_mul_inv] ++ _ = Real.log (b * |t|) + Real.log (1 / x) := by ++ exact Real.log_mul (mul_ne_zero hb_ne ht_ne) h_inv_ne ++ _ ≤ Real.log (b * |t|) + A := by ++ exact add_le_add_right hA (Real.log (b * |t|)) ++ _ = Real.log b + Real.log |t| + A := by ++ have hmul : Real.log (b * |t|) = Real.log b + Real.log |t| := ++ Real.log_mul hb_ne ht_ne ++ simp [hmul, add_comm] ++ _ = Real.log |t| + Real.log b + A := by ++ simp [add_comm] ++ ++lemma helper_bound_sum_by_Klog (t b A : ℝ) ++ (ht : |t| > 3) (hb : b > 1) (hA : A > 1) : ++ ∃ K > 1, Real.log |t| + Real.log b + A ≤ K * Real.log (|t| + 2) := by ++ ++ let S := Real.log b + A ++ let K := 1 + S / Real.log 5 ++ have hpos_t : 0 < |t| := lt_trans (by norm_num) ht ++ ++ have hle_log : Real.log |t| ≤ Real.log (|t| + 2) := by ++ apply Real.log_le_log ++ · exact hpos_t ++ · have hxle : |t| ≤ |t| + 2 := by ++ have h2 : (0 : ℝ) ≤ 2 := by norm_num ++ linarith ++ exact hxle ++ ++ have log5pos : 0 < Real.log (5 : ℝ) := by ++ have : (1 : ℝ) < 5 := by norm_num ++ exact Real.log_pos this ++ have Spos : 0 < S := by ++ have hlogbpos : 0 < Real.log b := Real.log_pos hb ++ have hApos : 0 < A := lt_trans (by norm_num) hA ++ exact add_pos hlogbpos hApos ++ have Kgt1 : 1 < K := by ++ have : 0 < S / Real.log 5 := div_pos Spos log5pos ++ simpa [K] using (lt_add_of_pos_right (1 : ℝ) this) ++ ++ have hlog5_le : Real.log 5 ≤ Real.log (|t| + 2) := by ++ apply Real.log_le_log ++ · exact (by norm_num : 0 < (5 : ℝ)) ++ · have : (5 : ℝ) < |t| + 2 := by linarith [ht] ++ exact le_of_lt this ++ have hfac_nonneg : 0 ≤ S / Real.log 5 := le_of_lt (div_pos Spos log5pos) ++ have hmul : (S / Real.log 5) * Real.log 5 ≤ (S / Real.log 5) * Real.log (|t| + 2) := ++ mul_le_mul_of_nonneg_left hlog5_le hfac_nonneg ++ have hleft : (S / Real.log 5) * Real.log 5 = S := by ++ have hne : (Real.log 5) ≠ 0 := ne_of_gt log5pos ++ field_simp [hne] ++ have hS_le : S ≤ (S / Real.log 5) * Real.log (|t| + 2) := by ++ simp [hleft] at hmul ++ exact hmul ++ ++ refine ⟨K, Kgt1, ?_⟩ ++ calc ++ Real.log |t| + Real.log b + A ++ = Real.log |t| + S := by ++ simp [S, add_comm, add_left_comm] ++ _ ++ ≤ Real.log (|t| + 2) + S := by ++ exact add_le_add_left hle_log S ++ _ ++ ≤ Real.log (|t| + 2) + (S / Real.log 5) * Real.log (|t| + 2) := by ++ exact add_le_add_right hS_le (Real.log (|t| + 2)) ++ _ = (1 + S / Real.log 5) * Real.log (|t| + 2) := by ++ ring ++ _ = K * Real.log (|t| + 2) := by rfl ++ _ = K * Real.log (|t| + 2) := by rfl ++ ++lemma Zeta1_Zeta_Expansion ++ (r1 r : ℝ) ++ (hr1_pos : 0 < r1) (hr1_lt_r : r1 < r) (hr_lt_R1 : r < 5 / (6 : ℝ)) : ++ ∃ C > 1, ++ ∀ (t : ℝ) (_ht : |t| > 3), ++ let c := (3/2 : ℂ) + I * t; ++ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), ++ ∀ z ∈ closedBall c r1 \ zerosetKfRc (5 / (6 : ℝ)) c riemannZeta, ++ ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ≤ ++ C * (1 / (r - r1)^3 + 1) * Real.log |t| := by ++ ++ obtain ⟨A, hAgt1, b, hbgt1, hmain⟩ := Zeta1_Zeta_Expand ++ ++ let R1 : ℝ := 5 / 6 ++ let R : ℝ := 8 / 9 ++ have hR1_pos : 0 < R1 := by norm_num [R1] ++ have hR1_lt_R : R1 < R := by norm_num [R1, R] ++ have hR_lt_1 : R < 1 := by norm_num [R] ++ have hr_pos : 0 < r := lt_trans hr1_pos hr1_lt_r ++ ++ let d : ℝ := (r - r1) ^ 3 ++ have hd_pos : 0 < d := by ++ have : 0 < r - r1 := sub_pos.mpr hr1_lt_r ++ simpa [d] using pow_pos this 3 ++ let A0 : ℝ := 1 / ((R^2 / R1 - R1) * Real.log (R / R1)) ++ have hA0_pos : 0 < A0 := by ++ have hx1 : 0 < R^2 / R1 - R1 := by ++ ++ norm_num [R, R1] ++ have hx2 : 0 < Real.log (R / R1) := by ++ ++ have : (1 : ℝ) < R / R1 := by norm_num [R, R1] ++ exact Real.log_pos this ++ have hxden : 0 < (R^2 / R1 - R1) * Real.log (R / R1) := mul_pos hx1 hx2 ++ simpa [A0] using (one_div_pos.mpr hxden) ++ ++ let K : ℝ := 16 * r^2 / d + A0 ++ ++ let S : ℝ := Real.log b + A ++ have hS_pos : 0 < S := by ++ have hbpos : 0 < Real.log b := Real.log_pos hbgt1 ++ have hApos : 0 < A := lt_trans (by norm_num) hAgt1 ++ exact add_pos hbpos hApos ++ ++ let Kcoeff : ℝ := max (16 * r^2) A0 ++ have hK_le : K ≤ Kcoeff * (1 / d + 1) := by ++ have hx_nonneg : 0 ≤ 1 / d := by ++ exact le_of_lt (one_div_pos.mpr hd_pos) ++ have hα_le : 16 * r^2 / d ≤ Kcoeff * (1 / d) := by ++ have hα : 16 * r^2 ≤ Kcoeff := le_max_left _ _ ++ have : (16 * r^2) * (1 / d) ≤ Kcoeff * (1 / d) := ++ mul_le_mul_of_nonneg_right hα hx_nonneg ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this ++ have hβ_le : A0 ≤ Kcoeff * 1 := by ++ have hβ : A0 ≤ Kcoeff := le_max_right _ _ ++ simpa using hβ ++ have : 16 * r^2 / d + A0 ≤ Kcoeff * (1 / d) + Kcoeff * 1 := ++ add_le_add hα_le hβ_le ++ simpa [K, mul_add, mul_one, add_comm, add_left_comm, add_assoc] using this ++ ++ let C : ℝ := max (Kcoeff * (1 + S / Real.log 3)) 2 ++ have hC_gt1 : 1 < C := by ++ have : (1 : ℝ) < 2 := by norm_num ++ exact lt_of_lt_of_le this (le_max_right _ _) ++ refine ⟨C, hC_gt1, ?_⟩ ++ ++ intro t ht ++ ++ simp only ++ intro hfin z hz ++ ++ have ht2 : |t| > 2 := by linarith [ht] ++ have hineq0 := ++ hmain t ht2 r1 r R1 R hr1_pos hr1_lt_r (lt_trans hr1_pos hr1_lt_r) hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 ++ have hineq1 := hineq0 hfin z hz ++ ++ have hK_eq : (16 * r^2 / (r - r1)^3 + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) = K := by ++ simp [K, A0, d, R1, R] ++ have hLS_eq : Real.log |t| + Real.log b + A = Real.log |t| + S := by ++ simp [S, add_comm, add_assoc] ++ have hineq2 : ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ++ ≤ K * (Real.log |t| + S) := by ++ rw [← hK_eq, ← hLS_eq] ++ exact hineq1 ++ ++ have hlog3pos : 0 < Real.log (3 : ℝ) := by ++ have : (1 : ℝ) < 3 := by norm_num ++ exact Real.log_pos this ++ ++ have hpos_t : 0 < |t| := lt_trans (by norm_num) ht ++ have hL_ge_log3' : Real.log 3 ≤ Real.log |t| := by ++ have hge : (3 : ℝ) ≤ |t| := le_of_lt ht ++ exact Real.log_le_log (by norm_num) hge ++ have hratio_nonneg : 0 ≤ S / Real.log 3 := le_of_lt (div_pos hS_pos hlog3pos) ++ have hneq : Real.log 3 ≠ 0 := ne_of_gt hlog3pos ++ ++ have hS_le : S ≤ (S / Real.log 3) * Real.log |t| := by ++ ++ calc S ++ = (S / Real.log 3) * Real.log 3 := by simp [hneq] ++ _ ≤ (S / Real.log 3) * Real.log |t| := mul_le_mul_of_nonneg_left hL_ge_log3' hratio_nonneg ++ ++ have hsum_bound : Real.log |t| + S ≤ (1 + S / Real.log 3) * Real.log |t| := by ++ have hstep : Real.log |t| + S ≤ Real.log |t| + (S / Real.log 3) * Real.log |t| := ++ add_le_add_right hS_le (Real.log |t|) ++ ++ have h_factor : Real.log |t| + (S / Real.log 3) * Real.log |t| = (1 + S / Real.log 3) * Real.log |t| := by ring ++ rw [← h_factor] ++ exact hstep ++ ++ have hineq3 : ‖logDerivZeta z - ∑ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)‖ ++ ≤ K * ((1 + S / Real.log 3) * Real.log |t|) := ++ le_trans hineq2 (mul_le_mul_of_nonneg_left hsum_bound (by ++ have hr2_nonneg : 0 ≤ r^2 := by ++ have : 0 ≤ r * r := mul_nonneg (le_of_lt hr_pos) (le_of_lt hr_pos) ++ simpa [pow_two] using this ++ have hterm1 : 0 ≤ 16 * r^2 / d := ++ div_nonneg (mul_nonneg (by norm_num) hr2_nonneg) (le_of_lt hd_pos) ++ have : 0 ≤ K := add_nonneg hterm1 (le_of_lt hA0_pos) ++ exact this)) ++ ++ have hKcoeff : K * ((1 + S / Real.log 3) * Real.log |t|) ++ ≤ (Kcoeff * (1 / d + 1)) * ((1 + S / Real.log 3) * Real.log |t|) := ++ mul_le_mul_of_nonneg_right hK_le (by ++ have hLpos : 0 < Real.log |t| := ++ Real.log_pos (lt_trans (by norm_num) ht) ++ have hcoef_pos : 0 < 1 + S / Real.log 3 := ++ add_pos_of_pos_of_nonneg (by norm_num) (le_of_lt (div_pos hS_pos hlog3pos)) ++ have : 0 ≤ (1 + S / Real.log 3) * Real.log |t| := ++ le_of_lt (mul_pos hcoef_pos hLpos) ++ simpa using this) ++ ++ have hfinal := le_trans hineq3 hKcoeff ++ ++ have hC_ge : Kcoeff * (1 + S / Real.log 3) ≤ C := by ++ exact le_max_left _ _ ++ ++ have : (Kcoeff * (1 / d + 1)) * ((1 + S / Real.log 3) * Real.log |t|) ++ ≤ C * (1 / d + 1) * Real.log |t| := by ++ have hnonneg_term : 0 ≤ (1 / d + 1) * Real.log |t| := by ++ have h1 : 0 ≤ 1 / d := le_of_lt (one_div_pos.mpr hd_pos) ++ have h2 : 0 ≤ Real.log |t| := le_of_lt (Real.log_pos (lt_trans (by norm_num) ht)) ++ have : 0 ≤ (1 / d + 1) := add_nonneg h1 (by norm_num) ++ exact mul_nonneg this h2 ++ have hstep := mul_le_mul_of_nonneg_left hC_ge hnonneg_term ++ ++ simpa [mul_comm, mul_left_comm, mul_assoc] using hstep ++ ++ have hfinal_le := le_trans hfinal this ++ simp only [d] at hfinal_le ++ exact hfinal_le ++ ++end Erdos970 +diff --git a/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean b/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean +new file mode 100644 +index 0000000..37dfc62 +--- /dev/null ++++ b/StrongPNT/Erdos970/PNT4_ZeroFreeRegion.lean +@@ -0,0 +1,6165 @@ ++import StrongPNT.Erdos970.PNT3_RiemannZeta ++import StrongPNT.Erdos970.Z0 ++ ++namespace Erdos970 ++ ++ ++def zeroZ : Set ℂ := {s : ℂ | riemannZeta s = 0} ++ ++def ZetaZerosNearPoint (t : ℝ) : Set ℂ := { ρ : ℂ | ρ ∈ zeroZ ∧ ‖ρ - ((3/2 : ℂ) + t * Complex.I)‖ ≤ (5/6 : ℝ) } ++ ++lemma ZetaZerosNearPoint_finite (t : ℝ) : Set.Finite (ZetaZerosNearPoint t) := by ++ ++ let c : ℂ := (3/2 : ℂ) + t * Complex.I ++ let R : ℝ := (5/6 : ℝ) ++ have hRpos : 0 < R := by norm_num ++ ++ let H : ℂ → ℂ := Function.update (fun s : ℂ => (s - 1) * riemannZeta s) 1 1 ++ have hH_diff : Differentiable ℂ H := by ++ ++ intro s ++ rcases eq_or_ne s 1 with rfl | hs ++ · ++ refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt ++ · ++ filter_upwards [self_mem_nhdsWithin] with t ht ++ ++ have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) t := by ++ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := ++ (differentiableAt_id.sub_const 1) ++ have h2 : DifferentiableAt ℂ riemannZeta t := ++ (differentiableAt_riemannZeta ht) ++ exact h1.mul h2 ++ apply DifferentiableAt.congr_of_eventuallyEq hdiff ++ filter_upwards [eventually_ne_nhds ht] with u hu using by ++ simp [H, Function.update_of_ne hu] ++ · ++ simpa [H, continuousAt_update_same] using riemannZeta_residue_one ++ · ++ have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) s := by ++ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) s := ++ (differentiableAt_id.sub_const 1) ++ have h2 : DifferentiableAt ℂ riemannZeta s := ++ (differentiableAt_riemannZeta hs) ++ exact h1.mul h2 ++ apply DifferentiableAt.congr_of_eventuallyEq hdiff ++ filter_upwards [eventually_ne_nhds hs] with u hu using by ++ simp [H, Function.update_of_ne hu] ++ ++ by_cases hPoleIn : ‖1 - c‖ ≤ R ++ · ++ let g : ℂ → ℂ := fun z => H (z + c) ++ ++ have hzeta_c_ne : riemannZeta c ≠ 0 := by ++ ++ have : c.re = (3/2 : ℝ) := by ++ simp [c, Complex.add_re, Complex.mul_re, Complex.I_re] ++ have hgt : c.re > 1 := by simpa [this] using (by norm_num : (3:ℝ)/2 > 1) ++ ++ exact riemannZeta_ne_zero_of_one_le_re (by ++ ++ have : (1 : ℝ) < c.re := hgt ++ exact le_of_lt this) ++ have hg_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) R, g z ≠ 0 := by ++ ++ have h0in : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by ++ simpa [Metric.mem_ball, Complex.dist_eq] using hRpos ++ refine ⟨0, h0in, ?_⟩ ++ ++ have hcne1 : c ≠ (1 : ℂ) := by ++ intro hc; have hcreq : c.re = 1 := by simp [hc, Complex.one_re] ++ have : (3 : ℝ) / 2 = (1 : ℝ) := by ++ simpa [c, Complex.add_re, Complex.mul_re, Complex.I_re] using hcreq ++ norm_num at this ++ have hHc : g 0 = H c := by simp [g] ++ have : g 0 = (c - 1) * riemannZeta c := by ++ simpa [H, Function.update_of_ne hcne1] using hHc ++ simpa [this] using mul_ne_zero (sub_ne_zero.mpr (by ++ ++ exact hcne1)) hzeta_c_ne ++ ++ let Kg : Set ℂ := {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ g ρ = 0} ++ ++ have h_subset : ZetaZerosNearPoint t ⊆ {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by ++ intro ρ hρ ++ rcases hρ with ⟨hzero, hdist⟩ ++ ++ have hball : ρ - c ∈ Metric.closedBall 0 R := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq, c, sub_eq_add_neg] using hdist ++ ++ have hρne1 : (ρ : ℂ) ≠ 1 := by ++ intro hρ1 ++ ++ have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) ++ exact hz1_ne (by simpa [hρ1] using! hzero) ++ have hsum : (ρ - c) + c = ρ := by simp [sub_add_cancel] ++ have hxne : (ρ - c) + c ≠ (1 : ℂ) := by simpa [hsum] using hρne1 ++ have hform : g (ρ - c) = (ρ - 1) * riemannZeta ρ := by ++ simp [g, H, hsum, Function.update_of_ne hxne] ++ have hzeroζ : riemannZeta ρ = 0 := hzero ++ have hzero' : g (ρ - c) = 0 := by simp [hform, hzeroζ] ++ exact ⟨hball, hzero'⟩ ++ ++ have hg_diff : Differentiable ℂ g := by ++ intro z ++ have hH := hH_diff (z + c) ++ have h_addc : DifferentiableAt ℂ (fun z : ℂ => z + c) z := ++ (differentiableAt_id.add_const c) ++ simpa [g] using! hH.comp z h_addc ++ have hg_analyticNhd_univ : AnalyticOnNhd ℂ g Set.univ := ++ (Complex.analyticOnNhd_univ_iff_differentiable).2 hg_diff ++ have hg_analyticNhd : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := ++ AnalyticOnNhd.mono hg_analyticNhd_univ (by intro z hz; simp) ++ have hNonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, g z ≠ 0 := by ++ rcases hg_nonzero with ⟨z, hz_in, hz_ne⟩ ++ ++ have hz_in' : z ∈ Metric.ball (0 : ℂ) 1 := by ++ have hRle : (R : ℝ) ≤ 1 := by norm_num ++ exact Metric.ball_subset_ball hRle hz_in ++ exact ⟨z, hz_in', hz_ne⟩ ++ have hfiniteKg : Set.Finite Kg := ++ (lem_Contra_finiteKR R hRpos (by norm_num : R < 1) g hg_analyticNhd hNonzero) ++ ++ have hTarget_eq : {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} = ++ (fun ρ : ℂ => ρ + c) '' Kg := by ++ ext ρ; constructor ++ · intro h ++ rcases h with ⟨hball, hzero⟩ ++ refine ⟨ρ - c, ⟨?_, ?_⟩, ?_⟩ ++ · exact hball ++ · exact hzero ++ · simp [sub_add_cancel] ++ · intro h ++ rcases h with ⟨z, ⟨hzball, hz0⟩, rfl⟩ ++ constructor ++ · simpa [sub_add_cancel] using hzball ++ · simpa [sub_add_cancel] using hz0 ++ ++ have hTarget_fin : Set.Finite {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by ++ have himg : Set.Finite ((fun ρ : ℂ => ρ + c) '' Kg) := hfiniteKg.image _ ++ ++ exact hTarget_eq ▸ himg ++ exact Set.Finite.subset hTarget_fin h_subset ++ · ++ let g : ℂ → ℂ := fun z => H (z + c) ++ ++ have hzeta_c_ne : riemannZeta c ≠ 0 := by ++ have : c.re = (3/2 : ℝ) := by ++ simp [c, Complex.add_re, Complex.mul_re, Complex.I_re] ++ have hgt : c.re > 1 := by simpa [this] using (by norm_num : (3:ℝ)/2 > 1) ++ exact riemannZeta_ne_zero_of_one_le_re (le_of_lt hgt) ++ have hg_nonzero : ∃ z ∈ Metric.ball (0 : ℂ) R, g z ≠ 0 := by ++ have h0in : (0 : ℂ) ∈ Metric.ball (0 : ℂ) R := by ++ simpa [Metric.mem_ball, Complex.dist_eq] using hRpos ++ refine ⟨0, h0in, ?_⟩ ++ have hcne1 : c ≠ (1 : ℂ) := by ++ intro hc; have hcreq : c.re = 1 := by simp [hc, Complex.one_re] ++ have : (3 : ℝ) / 2 = (1 : ℝ) := by ++ simpa [c, Complex.add_re, Complex.mul_re, Complex.I_re] using hcreq ++ norm_num at this ++ ++ have hHc : g 0 = H c := by simp [g] ++ have : g 0 = (c - 1) * riemannZeta c := by ++ simpa [H, Function.update_of_ne hcne1] using hHc ++ simpa [this] using mul_ne_zero (sub_ne_zero.mpr hcne1) hzeta_c_ne ++ ++ let Kg : Set ℂ := {ρ : ℂ | ρ ∈ Metric.closedBall (0 : ℂ) R ∧ g ρ = 0} ++ ++ have h_subset : ZetaZerosNearPoint t ⊆ {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by ++ intro ρ hρ ++ rcases hρ with ⟨hzero, hdist⟩ ++ have hball : ρ - c ∈ Metric.closedBall 0 R := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq, c, sub_eq_add_neg] using hdist ++ have hρne1 : (ρ : ℂ) ≠ 1 := by ++ intro hρ1 ++ have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) ++ exact hz1_ne (by simpa [hρ1] using! hzero) ++ have hsum : (ρ - c) + c = ρ := by simp [sub_add_cancel] ++ have hxne : (ρ - c) + c ≠ (1 : ℂ) := by simpa [hsum] using hρne1 ++ have hform : g (ρ - c) = (ρ - 1) * riemannZeta ρ := by ++ simp [g, H, hsum, Function.update_of_ne hxne] ++ ++ have hzeroζ : riemannZeta ρ = 0 := hzero ++ have hzero' : g (ρ - c) = 0 := by ++ calc ++ g (ρ - c) = (ρ - 1) * riemannZeta ρ := hform ++ _ = (ρ - 1) * 0 := by simp [hzeroζ] ++ _ = 0 := by simp ++ exact ⟨hball, hzero'⟩ ++ ++ have hg_diff : Differentiable ℂ g := by ++ intro z ++ have hH := hH_diff (z + c) ++ have h_addc : DifferentiableAt ℂ (fun z : ℂ => z + c) z := ++ (differentiableAt_id.add_const c) ++ simpa [g] using! hH.comp z h_addc ++ have hg_analyticNhd_univ : AnalyticOnNhd ℂ g Set.univ := ++ (Complex.analyticOnNhd_univ_iff_differentiable).2 hg_diff ++ have hg_analyticNhd : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := ++ AnalyticOnNhd.mono hg_analyticNhd_univ (by intro z hz; simp) ++ have hNonzero : ∃ z ∈ Metric.ball (0 : ℂ) 1, g z ≠ 0 := by ++ rcases hg_nonzero with ⟨z, hz_in, hz_ne⟩ ++ have hz_in' : z ∈ Metric.ball (0 : ℂ) 1 := by ++ have hRle : (R : ℝ) ≤ 1 := by norm_num ++ exact Metric.ball_subset_ball hRle hz_in ++ exact ⟨z, hz_in', hz_ne⟩ ++ have hfiniteKg : Set.Finite Kg := ++ (lem_Contra_finiteKR R hRpos (by norm_num : R < 1) g hg_analyticNhd hNonzero) ++ have hTarget_eq : {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} = ++ (fun ρ : ℂ => ρ + c) '' Kg := by ++ ext ρ; constructor ++ · intro h ++ rcases h with ⟨hball, hzero⟩ ++ refine ⟨ρ - c, ⟨?_, ?_⟩, ?_⟩ ++ · exact hball ++ · exact hzero ++ · simp [sub_add_cancel] ++ · intro h ++ rcases h with ⟨z, ⟨hzball, hz0⟩, rfl⟩ ++ constructor ++ · simpa [sub_add_cancel] using hzball ++ · simpa [sub_add_cancel] using hz0 ++ have hTarget_fin : Set.Finite {ρ : ℂ | (ρ - c) ∈ Metric.closedBall 0 R ∧ g (ρ - c) = 0} := by ++ have himg : Set.Finite ((fun ρ : ℂ => ρ + c) '' Kg) := hfiniteKg.image _ ++ exact hTarget_eq ▸ himg ++ exact Set.Finite.subset hTarget_fin h_subset ++ ++lemma lem_Re1zge0 (z : ℂ) : z.re > 0 → (1 / z).re > 0 := by ++ intro h ++ ++ have hz_ne_zero : z ≠ 0 := by ++ intro hz_eq_zero ++ rw [hz_eq_zero] at h ++ simp at h ++ ++ rw [one_div] ++ ++ rw [Complex.inv_re] ++ ++ apply div_pos h ++ ++ rwa [Complex.normSq_pos] ++ ++lemma lem_sigmage1 (sigma t : ℝ) (hsigma : sigma > 1) : riemannZeta (sigma + t * Complex.I) ≠ 0 := by ++ apply riemannZeta_ne_zero_of_one_le_re ++ simp [Complex.add_re, Complex.mul_re, Complex.I_re] ++ linarith ++ ++lemma lem_sigmale1 (sigma1 t1 : ℝ) : riemannZeta (sigma1 + t1 * Complex.I) = 0 → sigma1 ≤ 1 := by ++ intro h ++ ++ by_contra h_not_le ++ ++ push Not at h_not_le ++ ++ have h_nonzero := lem_sigmage1 sigma1 t1 h_not_le ++ ++ exact h_nonzero h ++ ++lemma lem_sigmale1Zt (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : rho1.re ≤ 1 := by ++ ++ have h1 : rho1 ∈ zeroZ := h_rho1_in_Zt.1 ++ ++ have h2 : riemannZeta rho1 = 0 := h1 ++ ++ have h3 : rho1 = rho1.re + rho1.im * Complex.I := by simp [Complex.re_add_im] ++ ++ rw [h3] at h2 ++ ++ exact lem_sigmale1 rho1.re rho1.im h2 ++ ++lemma lem_s_notin_Zt (δ : ℝ) (hδ : 0 < δ) (t : ℝ) : ++ ((1 : ℂ) + δ + t * Complex.I) ∉ ZetaZerosNearPoint t := by ++ intro hmem ++ ++ have h_zero : riemannZeta ((1 : ℂ) + δ + t * Complex.I) = 0 := hmem.1 ++ ++ have h_gt : (1 : ℝ) + δ > 1 := by linarith [hδ] ++ have h_nonzero := lem_sigmage1 (1 + δ) t h_gt ++ ++ have h_coercion : (1 : ℂ) + δ = ↑(1 + δ) := by simp [Complex.ofReal_add] ++ ++ rw [h_coercion] at h_zero ++ exact h_nonzero h_zero ++ ++lemma complex_abs_of_real (x : ℝ) : ‖(x : ℂ)‖ = abs x := by ++ rw [Complex.norm_real, Real.norm_eq_abs] ++ ++lemma complex_add_real_imag_parts (a b : ℝ) (t : ℝ) : ++ ((a : ℂ) + b + t * Complex.I).re = a + b ∧ ((a : ℂ) + b + t * Complex.I).im = t := by ++ constructor ++ ++ · rw [Complex.add_re, Complex.add_re] ++ ++ simp [Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.I_im] ++ ++ · rw [Complex.add_im, Complex.add_im] ++ ++ simp [Complex.ofReal_im, Complex.mul_im, Complex.I_re, Complex.I_im] ++ ++lemma complex_abs_real_cast (r : ℝ) : ‖(r : ℂ)‖ = abs r := Complex.norm_real r ++ ++lemma isBigO_comp_principal_domain {α β E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] ++ {f : β → E} {g : β → F} {h : α → β} {l : Filter α} {s : Set β} ++ (hfg : f =O[Filter.principal s] g) ++ (h_domain : ∀ᶠ x in l, h x ∈ s) : ++ (f ∘ h) =O[l] (g ∘ h) := by ++ ++ have h_le : Filter.map h l ≤ Filter.principal s := by ++ intro t ht ++ ++ rw [Filter.mem_principal] at ht ++ ++ rw [Filter.mem_map] ++ ++ rw [Filter.eventually_iff] at h_domain ++ ++ apply Filter.mem_of_superset h_domain ++ intro x hx ++ exact ht hx ++ ++ have hfg_map : f =O[Filter.map h l] g := Asymptotics.IsBigO.mono hfg h_le ++ ++ rwa [Asymptotics.isBigO_map] at hfg_map ++ ++lemma isBigOWith_comp_principal_domain {α β E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F] ++ {C : ℝ} {f : β → E} {g : β → F} {h : α → β} {l : Filter α} {s : Set β} ++ (hfg : Asymptotics.IsBigOWith C (Filter.principal s) f g) ++ (h_domain : ∀ᶠ x in l, h x ∈ s) : ++ Asymptotics.IsBigOWith C l (f ∘ h) (g ∘ h) := by ++ ++ rw [Asymptotics.isBigOWith_iff, Filter.eventually_principal] at hfg ++ ++ rw [Asymptotics.isBigOWith_iff] ++ ++ filter_upwards [h_domain] with x hx_in_s ++ ++ exact hfg (h x) hx_in_s ++ ++lemma s_in_D12 (delta : ℝ) (hdelta_pos : 0 < delta) (t : ℝ) (hdelta_lt : delta < 1) : ++ ((1 : ℂ) + (delta : ℝ) + (t : ℝ) * Complex.I) ∈ ++ Metric.ball ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) (1 / 2) := by ++ ++ rw [Metric.mem_ball] ++ ++ have h1 : ((1 : ℂ) + (delta : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) = ++ (1 : ℂ) + (delta : ℝ) - (3 / 2 : ℂ) := by ring ++ ++ have h2 : (1 : ℂ) + (delta : ℝ) - (3 / 2 : ℂ) = (delta - 1/2 : ℝ) := by ++ simp [Complex.ofReal_sub] ++ ring ++ ++ rw [Complex.dist_eq, h1, h2, Complex.norm_real] ++ ++ rw [Real.norm_eq_abs] ++ ++ have h3 : abs (delta - 1/2) < 1/2 := by ++ rw [abs_lt] ++ constructor ++ · ++ linarith [hdelta_pos] ++ · ++ linarith [hdelta_lt] ++ exact h3 ++ ++lemma zerosetKfRc_eq_ZetaZerosNearPoint (t : ℝ) : ++ zerosetKfRc (5/6 : ℝ) ((3/2 : ℂ) + t * Complex.I) riemannZeta = ZetaZerosNearPoint t := by ++ ext ρ; constructor ++ · intro h ++ rcases h with ⟨hball, hzero⟩ ++ refine ⟨?hz, ?hnorm⟩ ++ · simpa [zeroZ] using hzero ++ · simpa [Metric.mem_closedBall, Complex.dist_eq, sub_eq_add_neg] using hball ++ · intro h ++ rcases h with ⟨hz, hnorm⟩ ++ refine ⟨?hball, ?hzero⟩ ++ · simpa [Metric.mem_closedBall, Complex.dist_eq, sub_eq_add_neg] using hnorm ++ · simpa [zeroZ] using hz ++ ++lemma mem_closedBall_of_mem_ball {x c : ℂ} {r : ℝ} (hx : x ∈ Metric.ball c r) : ++ x ∈ Metric.closedBall c r := by ++ exact (Metric.ball_subset_closedBall) hx ++ ++lemma I_mul_real_eq_real_mul_I (t : ℝ) : ++ (Complex.I : ℂ) * (t : ℂ) = (t : ℂ) * Complex.I := by ++ simpa using mul_comm (Complex.I : ℂ) (t : ℂ) ++ ++lemma center_eq_comm (t : ℝ) : ++ ((3/2 : ℂ) + (Complex.I : ℂ) * (t : ℂ)) = ((3/2 : ℂ) + (t : ℂ) * Complex.I) := by ++ have h : (Complex.I : ℂ) * (t : ℂ) = (t : ℂ) * Complex.I := by ++ simpa using mul_comm (Complex.I : ℂ) (t : ℂ) ++ simp [h] ++ ++lemma log_abs_le_log_abs_add_two {t : ℝ} (ht : 2 < |t|) : ++ Real.log (abs t) ≤ Real.log (abs t + 2) := by ++ have hpos : 0 < |t| := lt_trans (by norm_num) ht ++ have hle : |t| ≤ |t| + 2 := by nlinarith ++ simpa using Real.log_le_log hpos hle ++ ++lemma s_notin_ZetaZerosNearPoint (δ t : ℝ) (hδ_pos : 0 < δ) : ++ ((1 : ℂ) + δ + t * Complex.I) ∉ ZetaZerosNearPoint t := by ++ intro hmem ++ have hz0 : riemannZeta ((1 : ℂ) + δ + t * Complex.I) = 0 := hmem.1 ++ have : ((1 : ℂ) + δ + t * Complex.I).re = 1 + δ := by simp ++ have hpos : (1 : ℝ) < 1 + δ := by linarith ++ have hnonzero := lem_sigmage1 (1 + δ) t hpos ++ exact hnonzero (by simpa using hz0) ++ ++lemma norm_sub_comm' (x y : ℂ) : ‖x - y‖ = ‖y - x‖ := by ++ calc ++ ‖x - y‖ = ‖-(x - y)‖ := by simpa using (norm_neg (x - y)).symm ++ _ = ‖y - x‖ := by simp [neg_sub] ++ ++lemma s_in_closedBall_12 (δ t : ℝ) (hδ_pos : 0 < δ) (hδ_lt : δ < 1) : ++ ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) ∈ ++ Metric.closedBall ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) (1 / 2) := by ++ ++ have hdiff : ++ ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I) ++ = ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) := by ++ simp ++ have hreal : ++ ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) = ((δ - (1 / 2 : ℝ)) : ℂ) := by ++ have h' : ((1 + δ : ℝ) - (3 / 2 : ℝ)) = δ - (1 / 2 : ℝ) := by ++ calc ++ (1 + δ) - (3 / 2 : ℝ) = δ + 1 - (3 / 2 : ℝ) := by ac_rfl ++ _ = δ + (1 - (3 / 2 : ℝ)) := by simp [add_sub_assoc] ++ _ = δ + (- (1 / 2 : ℝ)) := by norm_num ++ _ = δ - (1 / 2 : ℝ) := by simp [sub_eq_add_neg] ++ calc ++ ((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ) ++ = ((1 + δ : ℝ) : ℂ) - (3 / 2 : ℂ) := by ++ simp [add_comm] ++ _ = (↑((1 + δ : ℝ) - (3 / 2 : ℝ)) : ℂ) := by ++ simp [Complex.ofReal_sub] ++ _ = ((δ - (1 / 2 : ℝ)) : ℂ) := by simp [h'] ++ have hnormle : ++ ‖((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I)‖ ++ ≤ (1 / 2 : ℝ) := by ++ calc ++ ‖((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I) - ((3 / 2 : ℂ) + (t : ℝ) * Complex.I)‖ ++ = ‖((1 : ℂ) + (δ : ℝ)) - (3 / 2 : ℂ)‖ := by simp [hdiff] ++ _ = ‖((δ - (1 / 2 : ℝ)) : ℂ)‖ := by simp [hreal] ++ _ = |δ - (1 / 2 : ℝ)| := by simpa using complex_abs_real_cast (δ - (1 / 2 : ℝ)) ++ _ ≤ 1 / 2 := by ++ have hleft : - (1 / 2 : ℝ) ≤ δ - 1 / 2 := by linarith [hδ_pos] ++ have hright : δ - 1 / 2 ≤ 1 / 2 := by linarith [hδ_lt] ++ simpa using (abs_le.mpr ⟨hleft, hright⟩) ++ ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hnormle ++ ++lemma lem_explicit1deltat : ++ ∃ C > 1, ++ ∀ t : ℝ, 2 < |t| → ++ ∀ δ : ℝ, 0 < δ ∧ δ < 1 → ++ ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) ++ (fun rho1 : ℂ => ++ ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ++ (((1 : ℂ) + δ + t * Complex.I) - rho1)) ++ - logDerivZeta ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I)‖ ++ ≤ C * Real.log (abs t + 2) := by ++ classical ++ ++ let r1 : ℝ := (1/2 : ℝ) ++ let r : ℝ := (2/3 : ℝ) ++ let R1 : ℝ := (5/6 : ℝ) ++ let R : ℝ := (9/10 : ℝ) ++ have hr1_pos : 0 < r1 := by norm_num ++ have hr_pos : 0 < r := by norm_num ++ have hr1_lt_r : r1 < r := by norm_num ++ have hr_lt_R1 : r < R1 := by norm_num ++ have hR1_pos : 0 < R1 := by norm_num ++ have hR1_lt_R : R1 < R := by norm_num ++ have hR_lt_1 : R < 1 := by norm_num ++ ++ let F : ℝ := (16 * r^2 / ((r - r1)^3) + 1 / ((R^2 / R1 - R1) * Real.log (R / R1))) ++ ++ obtain ⟨b, hb_gt1, hb_bound⟩ := zeta32upper ++ obtain ⟨A, hA_gt1, hA_bound⟩ := zeta32lower_log ++ ++ let K : ℝ := 1 + (Real.log b + A) / Real.log 4 ++ ++ let C : ℝ := max (F * K) 2 ++ have hC_gt1 : 1 < C := by ++ have : (1 : ℝ) < 2 := by norm_num ++ exact lt_of_lt_of_le this (le_max_right _ _) ++ refine ⟨C, hC_gt1, ?_⟩ ++ ++ intro t ht δ hδ ++ rcases hδ with ⟨hδ_pos, hδ_lt1⟩ ++ ++ let c_std : ℂ := ((3/2 : ℂ) + Complex.I * (t : ℂ)) ++ let c_comm : ℂ := ((3/2 : ℂ) + (t : ℝ) * Complex.I) ++ have hcenter_eq : c_std = c_comm := by simpa [c_std, c_comm] using (center_eq_comm t) ++ let s : ℂ := (1 : ℂ) + δ + t * Complex.I ++ ++ have hs_mem_comm : s ∈ Metric.closedBall c_comm r1 := s_in_closedBall_12 δ t hδ_pos hδ_lt1 ++ have hs_mem_std : s ∈ Metric.closedBall c_std r1 := by simpa [c_std, c_comm, hcenter_eq] using hs_mem_comm ++ ++ have hs_notin_Zt : s ∉ ZetaZerosNearPoint t := s_notin_ZetaZerosNearPoint δ t hδ_pos ++ have hzeros_eq : zerosetKfRc (5/6 : ℝ) c_comm riemannZeta = ZetaZerosNearPoint t := by ++ simpa [c_comm] using zerosetKfRc_eq_ZetaZerosNearPoint t ++ have hs_notin_comm : s ∉ zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by simpa [hzeros_eq] using hs_notin_Zt ++ have hs_notin_std : s ∉ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [c_std, c_comm, hcenter_eq] using hs_notin_comm ++ ++ have hfin_comm : (zerosetKfRc (5/6 : ℝ) c_comm riemannZeta).Finite := by ++ simpa [hzeros_eq] using (ZetaZerosNearPoint_finite t) ++ have hfin_std : (zerosetKfRc (5/6 : ℝ) c_std riemannZeta).Finite := by ++ simpa [c_std, c_comm, hcenter_eq] using hfin_comm ++ ++ have h_bound_R : ∀ z ∈ Metric.closedBall c_std R, ‖riemannZeta z‖ < b * |t| := by ++ intro z hz ++ have hsubs : Metric.closedBall c_std R ⊆ Metric.closedBall c_std (1 : ℝ) := by ++ intro w hw; exact Metric.closedBall_subset_closedBall (by norm_num : (R : ℝ) ≤ (1 : ℝ)) hw ++ exact hb_bound t (by simpa using ht) z (hsubs hz) ++ ++ have hmain := ++ log_Deriv_Expansion_Zeta t ht ++ r1 r R1 R hr1_pos hr1_lt_r hr_pos hr_lt_R1 hR1_pos hR1_lt_R hR_lt_1 ++ ++ have hbpos : 0 < b := lt_trans (by norm_num) hb_gt1 ++ have ht1 : 1 < |t| := lt_trans (by norm_num) ht ++ have hmul : b * 1 < b * |t| := (mul_lt_mul_of_pos_left ht1 hbpos) ++ have hB_gt1 : 1 < b * |t| := lt_trans hb_gt1 (by simpa using hmul) ++ have hineq := hmain (b * |t|) hB_gt1 h_bound_R ++ have hz_in : s ∈ Metric.closedBall c_std r1 \ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := ⟨hs_mem_std, hs_notin_std⟩ ++ have hineq2 := hineq hfin_std s hz_in ++ ++ have hFinset_eq : hfin_std.toFinset = (ZetaZerosNearPoint_finite t).toFinset := by ++ ext ρ; constructor <;> intro hρ ++ · have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [Set.mem_toFinset] using hρ ++ have : ρ ∈ ZetaZerosNearPoint t := by ++ have heq : zerosetKfRc (5/6 : ℝ) c_std riemannZeta = zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by ++ ++ simp [c_std, c_comm, hcenter_eq] ++ simpa [hzeros_eq, heq] ++ using this ++ simpa [Set.mem_toFinset] using this ++ · have : ρ ∈ ZetaZerosNearPoint t := by simpa [Set.mem_toFinset] using hρ ++ have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by simpa [hzeros_eq] using this ++ have heq : zerosetKfRc (5/6 : ℝ) c_std riemannZeta = zerosetKfRc (5/6 : ℝ) c_comm riemannZeta := by ++ simp [c_std, c_comm, hcenter_eq] ++ have : ρ ∈ zerosetKfRc (5/6 : ℝ) c_std riemannZeta := by simpa [heq] using this ++ simpa [Set.mem_toFinset] using this ++ have hLHS_le : ++ ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) ++ (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1)) ++ - logDerivZeta s‖ ++ ≤ F * Real.log (b * |t| / ‖riemannZeta c_std‖) := by ++ have : ++ ‖logDerivZeta s - ++ Finset.sum (hfin_std.toFinset) ++ (fun ρ : ℂ => ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (s - ρ))‖ ++ ≤ F * Real.log (b * |t| / ‖riemannZeta c_std‖) := by ++ simpa [F] using! hineq2 ++ simpa [norm_sub_comm', hFinset_eq] ++ using this ++ ++ have hc_ne : riemannZeta c_std ≠ 0 := by simpa [c_std] using! zetacnot0 t ++ have hnorm_pos : 0 < ‖riemannZeta c_std‖ := by simpa [norm_pos_iff] using hc_ne ++ have hnorm_ne : ‖riemannZeta c_std‖ ≠ 0 := ne_of_gt hnorm_pos ++ have hb_ne : b ≠ 0 := ne_of_gt hbpos ++ have htpos0 : 0 < |t| := lt_trans (by norm_num) ht ++ have ht_ne : |t| ≠ 0 := ne_of_gt htpos0 ++ have hlog_mul1 : ++ Real.log (b * |t| / ‖riemannZeta c_std‖) ++ = Real.log (b * |t|) + Real.log (1 / ‖riemannZeta c_std‖) := by ++ simpa [div_eq_mul_inv] using Real.log_mul (mul_ne_zero hb_ne ht_ne) (inv_ne_zero hnorm_ne) ++ have hlog_mul2 : Real.log (b * |t|) = Real.log b + Real.log (|t|) := by ++ simpa using Real.log_mul hb_ne ht_ne ++ have hζ_log_le : Real.log (1 / ‖riemannZeta c_std‖) ≤ A := by ++ simpa [c_std] using! hA_bound t ++ have hlog_bound1 : ++ Real.log (b * |t| / ‖riemannZeta c_std‖) ++ ≤ (Real.log b + Real.log (|t|)) + A := by ++ have := add_le_add_right hζ_log_le (Real.log (b * |t|)) ++ simpa [hlog_mul1, hlog_mul2, add_comm, add_left_comm, add_assoc] using this ++ ++ have hlog_mono : Real.log (|t|) ≤ Real.log (|t| + 2) := ++ log_abs_le_log_abs_add_two (by simpa using ht) ++ have hlog_bound2 : ++ Real.log (b * |t| / ‖riemannZeta c_std‖) ++ ≤ Real.log (|t| + 2) + (Real.log b + A) := by ++ have : Real.log b + Real.log (|t|) + A ≤ Real.log b + Real.log (|t| + 2) + A := by ++ have := add_le_add_right hlog_mono (Real.log b) ++ simpa [add_comm, add_left_comm, add_assoc] using add_le_add_left this A ++ exact le_trans hlog_bound1 (by simpa [add_comm, add_left_comm, add_assoc] using this) ++ ++ have hlog5pos : 0 < Real.log 4 := Real.log_pos (by norm_num : (1 : ℝ) < 4) ++ have hge5 : Real.log 4 ≤ Real.log (|t| + 2) := by ++ have hxy : (4 : ℝ) ≤ |t| + 2 := by nlinarith [le_of_lt ht] ++ exact Real.log_le_log (by norm_num) hxy ++ have hconst_nonneg : 0 ≤ Real.log b + A := by ++ have hbposlog : 0 < Real.log b := Real.log_pos hb_gt1 ++ have hApos : 0 < A := lt_trans (by norm_num) hA_gt1 ++ have : 0 ≤ Real.log b := le_of_lt hbposlog ++ nlinarith ++ have hnonneg : 0 ≤ (Real.log b + A) / Real.log 4 := div_nonneg hconst_nonneg (le_of_lt hlog5pos) ++ have hne5 : Real.log 4 ≠ 0 := ne_of_gt hlog5pos ++ have hconst_bound : (Real.log b + A) ++ ≤ (Real.log b + A) / Real.log 4 * Real.log (|t| + 2) := by ++ have := mul_le_mul_of_nonneg_left hge5 hnonneg ++ ++ have : ((Real.log b + A) / Real.log 4) * Real.log 4 ≤ (Real.log b + A) / Real.log 4 * Real.log (|t| + 2) := this ++ ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hne5] using this ++ have hlog_bound3 : ++ Real.log (|t| + 2) + (Real.log b + A) ++ ≤ K * Real.log (|t| + 2) := by ++ have := add_le_add_right hconst_bound (Real.log (|t| + 2)) ++ ++ simpa [K, mul_add, add_comm, add_left_comm, add_assoc, mul_comm, mul_left_comm, mul_assoc, one_mul] ++ using this ++ have hlog_bound_final : ++ Real.log (b * |t| / ‖riemannZeta c_std‖) ++ ≤ K * Real.log (|t| + 2) := le_trans hlog_bound2 hlog_bound3 ++ ++ have hF_nonneg : 0 ≤ F := by ++ have h1 : 0 ≤ 16 * r ^ 2 / (r - r1) ^ 3 := by ++ have hnum : 0 ≤ 16 * r ^ 2 := by ++ have : 0 ≤ (16 : ℝ) := by norm_num ++ have : 0 ≤ r ^ 2 := by ++ have := sq_nonneg r ++ simpa [pow_two] using this ++ simpa [mul_comm] using mul_nonneg (show 0 ≤ (16 : ℝ) by norm_num) this ++ have hden : 0 < (r - r1) ^ 3 := by ++ have : 0 < r - r1 := sub_pos.mpr hr1_lt_r ++ simpa using pow_pos this 3 ++ exact div_nonneg hnum (le_of_lt hden) ++ have h2 : 0 ≤ 1 / ((R ^ 2 / R1 - R1) * Real.log (R / R1)) := by ++ ++ have hden1 : 0 < (R ^ 2 / R1 - R1) := by ++ change 0 < ((9/10 : ℝ) ^ 2 / (5/6 : ℝ) - (5/6 : ℝ)) ++ norm_num ++ have hden2 : 0 < Real.log (R / R1) := by ++ have : 1 < R / R1 := by ++ change (1 : ℝ) < (9/10 : ℝ) / (5/6 : ℝ) ++ norm_num ++ exact Real.log_pos this ++ have hpos : 0 < ((R ^ 2 / R1 - R1) * Real.log (R / R1)) := mul_pos hden1 hden2 ++ exact le_of_lt (one_div_pos.mpr hpos) ++ have := add_nonneg h1 h2 ++ simpa [F] using this ++ ++ have hY_nonneg : 0 ≤ Real.log (|t| + 2) := by ++ ++ have hgt1 : (1 : ℝ) < |t| + 2 := by ++ have : (2 : ℝ) ≤ |t| + 2 := by ++ have : 0 ≤ |t| := abs_nonneg t ++ simp ++ exact lt_of_lt_of_le (by norm_num) this ++ exact le_of_lt (Real.log_pos hgt1) ++ have hfinal1 : ++ ‖Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) ++ (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1)) ++ - logDerivZeta s‖ ++ ≤ F * (K * Real.log (|t| + 2)) := ++ le_trans hLHS_le (by exact mul_le_mul_of_nonneg_left hlog_bound_final hF_nonneg) ++ have hFactor_leC : F * K ≤ C := by exact le_trans (le_of_eq rfl) (le_max_left _ _) ++ have hfinal2 : F * (K * Real.log (|t| + 2)) ≤ C * Real.log (|t| + 2) := by ++ have := mul_le_mul_of_nonneg_right hFactor_leC hY_nonneg ++ simpa [mul_comm, mul_left_comm, mul_assoc] using this ++ have := le_trans hfinal1 hfinal2 ++ simpa [s] ++ ++lemma lem_explicit1RealReal : ++ ∃ C > 1, ++ ∀ t : ℝ, 2 < |t| → ++ ∀ δ : ℝ, 0 < δ ∧ δ < 1 → ++ abs ((logDerivZeta ((1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I)).re ++ - (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) ++ (fun rho1 : ℂ => ++ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ++ (((1 : ℂ) + δ + t * Complex.I) - rho1)).re))) ++ ≤ C * Real.log (|t| + 2) := by ++ rcases lem_explicit1deltat with ⟨C, hCpos, hE⟩ ++ refine ⟨C, hCpos, ?_⟩ ++ intro t ht δ hδ ++ ++ let s : ℂ := (1 : ℂ) + (δ : ℝ) + (t : ℝ) * Complex.I ++ let S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite t) ++ let g : ℂ → ℂ := fun rho1 : ℂ => ++ ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (s - rho1) ++ ++ have ht' : ‖logDerivZeta s - ∑ rho1 ∈ S, g rho1‖ ++ ≤ C * Real.log (abs t + 2) := by ++ ++ have h_app := hE t ht δ hδ ++ rw [norm_sub_rev] at h_app ++ exact h_app ++ ++ have hleft_eq : ++ abs ((logDerivZeta s).re - ∑ rho1 ∈ S, (g rho1).re) ++ = abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) := by ++ simp [Complex.sub_re, Complex.re_sum] ++ ++ have hbound : ++ abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) ++ ≤ ‖logDerivZeta s - ∑ rho1 ∈ S, g rho1‖ := by ++ simpa using Complex.abs_re_le_norm (logDerivZeta s - ∑ rho1 ∈ S, g rho1) ++ ++ have hfinal : ++ abs ((logDerivZeta s - ∑ rho1 ∈ S, g rho1).re) ++ ≤ C * Real.log (abs t + 2) := ++ le_trans hbound ht' ++ ++ have hnorm : |t| = abs t := rfl ++ simpa [s, S, g, hleft_eq, hnorm] using hfinal ++ ++lemma lem_explicit2Real : ++ ∃ C > 1, ++ ∀ t : ℝ, 2 < |t| → ++ ∀ δ : ℝ, 0 < δ ∧ δ < 1 → ++ abs ( ++ (logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I)).re ++ - (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) ++ (fun rho1 : ℂ => ++ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ++ (((1 : ℂ) + δ + (2 * t) * Complex.I) - rho1)).re)) ++ ) ++ ≤ C * Real.log (abs (2 * t) + 2) := by ++ rcases lem_explicit1RealReal with ⟨C, hCpos, hEv⟩ ++ refine ⟨C, hCpos, ?_⟩ ++ intro t ht δ hδ ++ ++ have h_2t : 2 < |2 * t| := by ++ rw [abs_mul, abs_two] ++ linarith [ht] ++ have h_bound := hEv (2 * t) h_2t δ hδ ++ ++ simp only [Complex.ofReal_mul] at h_bound ++ exact h_bound ++ ++lemma lem_Realsum {α : Type*} (s : Finset α) (f : α → ℂ) : (Finset.sum s f).re = Finset.sum s (fun i => (f i).re) := by ++ exact Complex.re_sum s f ++ ++lemma lem_Ztfinite (t : ℝ) : Set.Finite (ZetaZerosNearPoint t) := ZetaZerosNearPoint_finite t ++ ++lemma lem_sumrho1 (t : ℝ) (δ : ℝ) (_hdelta_pos : δ > 0) (_hdelta_lt1 : δ < 1) : ++ (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) ++ (fun rho1 : ℂ => ++ ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ++ (((1 : ℂ) + δ + t * Complex.I) - rho1))).re = ++ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) ++ (fun rho1 : ℂ => ++ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ++ (((1 : ℂ) + δ + t * Complex.I) - rho1)).re) := by ++ exact lem_Realsum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) _ ++ ++lemma lem_sumrho2 (t : ℝ) (delta : ℝ) (_hdelta : delta > 0) (_hdelta_lt1 : delta < 1) : ++ (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) ++ (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1))).re = ++ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) ++ (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1)).re) := by ++ rw [Complex.re_sum] ++ ++lemma lem_1deltatrho1 (delta : ℝ) (_hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (_h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ((1 : ℂ) + delta + t * Complex.I - rho1) = ((1 : ℝ) + delta - rho1.re) + (t - rho1.im) * Complex.I := by ++ ++ conv_lhs => rw [← Complex.re_add_im rho1] ++ ++ simp only [sub_add_eq_sub_sub] ++ ++ ring_nf ++ ++ simp only [Complex.ofReal_one] ++ ring ++ ++lemma lem_Re1deltatrho1 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ++((1 : ℂ) + delta + t * Complex.I - rho1).re = (1 : ℝ) + delta - rho1.re := by ++ ++ rw [lem_1deltatrho1 delta hdelta t rho1 h_rho1_in_Zt] ++ ++ rw [Complex.add_re] ++ ++ rw [Complex.mul_I_re] ++ ++ simp ++ ++lemma lem_Re1delta1 (delta : ℝ) (_hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ++(1 : ℝ) + delta - rho1.re ≥ delta := by ++ ++ have h_rho1_re_le_1 : rho1.re ≤ 1 := lem_sigmale1Zt t rho1 h_rho1_in_Zt ++ ++ have h_nonneg : 1 - rho1.re ≥ 0 := by linarith ++ ++ linarith ++ ++lemma lem_Re1deltatge (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ((1 : ℂ) + delta + t * Complex.I - rho1).re ≥ delta := by ++ ++ rw [lem_Re1deltatrho1 delta hdelta t rho1 h_rho1_in_Zt] ++ ++ exact lem_Re1delta1 delta hdelta t rho1 h_rho1_in_Zt ++ ++lemma lem_Re1deltatneq0 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ++((1 : ℂ) + delta + t * Complex.I - rho1).re > 0 := by ++ ++ have h_ge_delta : ((1 : ℂ) + delta + t * Complex.I - rho1).re ≥ delta := lem_Re1deltatge delta hdelta t rho1 h_rho1_in_Zt ++ ++ linarith [hdelta] ++ ++lemma lem_Re1deltatge0 (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ++(1 / ((1 : ℂ) + delta + t * Complex.I - rho1)).re ≥ 0 := by ++ ++ apply le_of_lt ++ apply lem_Re1zge0 ++ ++ exact lem_Re1deltatneq0 delta hdelta t rho1 h_rho1_in_Zt ++ ++lemma lem_Re1deltatge0m (delta : ℝ) (hdelta : delta > 0) (t : ℝ) (_hdelta_lt_1 : delta < 1) ++ (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint t) : ++ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ++ (((1 : ℂ) + delta + t * Complex.I) - rho1)).re ≥ 0 := by ++ ++ let n := (analyticOrderAt riemannZeta rho1).toNat ++ let z := ((1 : ℂ) + delta + t * Complex.I) - rho1 ++ ++ have h_eq : (n : ℂ) / z = n • (1/z) := by ++ rw [nsmul_eq_mul] ++ simp [div_eq_mul_inv] ++ ++ rw [h_eq, Complex.re_nsmul] ++ ++ apply nsmul_nonneg ++ exact lem_Re1deltatge0 delta hdelta t rho1 h_rho1_in_Zt ++ ++lemma lem_Re1delta2tge0 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (t : ℝ) (rho1 : ℂ) (h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint (2 * t)) : ++(((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + (2 * t) * Complex.I - rho1)).re ≥ 0 := by ++ ++ convert lem_Re1deltatge0m delta hdelta (2 * t) hdelta_lt_1 rho1 h_rho1_in_Zt ++ simp ++ ++lemma lem_sumrho2ge (t : ℝ) (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) : ++Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + (2 * t) * Complex.I - rho1)).re) ≥ 0 := by ++ apply Finset.sum_nonneg ++ intro rho1 h_rho1_in_finset ++ ++ have h_rho1_in_Zt : rho1 ∈ ZetaZerosNearPoint (2 * t) := by ++ rwa [Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite (2 * t))] at h_rho1_in_finset ++ ++ exact lem_Re1delta2tge0 delta hdelta hdelta_lt_1 t rho1 h_rho1_in_Zt ++ ++lemma lem_sumrho2ge02 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) : ++ (Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t))) ++(fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + (2 * t) * Complex.I) - rho1))).re ≥ 0 := by ++ ++ rw [lem_sumrho2 t delta hdelta hdelta_lt_1] ++ ++ exact lem_sumrho2ge t delta hdelta hdelta_lt_1 ++ ++lemma lem_explicit2Real2 : ++ ∃ C > 1, ++ ∀ t : ℝ, 2 < |t| → ++ ∀ δ : ℝ, 0 < δ ∧ δ < 1 → ++ ((-logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I)).re) ++ ≤ C * Real.log (abs (2 * t) + 2) := by ++ rcases lem_explicit2Real with ⟨C, hCpos, hEv⟩ ++ refine ⟨C, hCpos, ?_⟩ ++ intro t ht δ hδ ++ ++ set s : ℂ := (1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I ++ set S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite (2 * t)) ++ set Sre : ℝ := ++ Finset.sum S ++ (fun rho1 : ℂ => ++ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ++ (s - rho1)).re) ++ ++ have h_bound : ++ abs ((logDerivZeta s).re - Sre) ++ ≤ C * Real.log (abs (2 * t) + 2) := by ++ simpa [s, S, Sre] using hEv t ht δ hδ ++ ++ have hS_nonneg : 0 ≤ Sre := by ++ ++ have h0 := lem_sumrho2ge02 t δ hδ.1 hδ.2 ++ ++ simpa [s, S, Sre, lem_sumrho2 t δ hδ.1 hδ.2] using h0 ++ ++ have h_left : -(C * Real.log (abs (2 * t) + 2)) ≤ (logDerivZeta s).re - Sre := ++ (abs_le.mp h_bound).1 ++ ++ have h_neg : -((logDerivZeta s).re - Sre) ≤ C * Real.log (abs (2 * t) + 2) := by ++ simpa using neg_le_neg h_left ++ ++ have h_aux := sub_le_sub_right h_neg Sre ++ have h_isol : - (logDerivZeta s).re ≤ C * Real.log (abs (2 * t) + 2) - Sre := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h_aux ++ ++ have h_drop : C * Real.log (abs (2 * t) + 2) - Sre ≤ C * Real.log (abs (2 * t) + 2) := ++ sub_le_self _ hS_nonneg ++ ++ have h_final := le_trans h_isol h_drop ++ ++ simpa [s, Complex.neg_re] using h_final ++ ++lemma lem_log2Olog : (fun t : ℝ => Real.log (2 * t)) =O[Filter.atTop] (fun t : ℝ => Real.log t) := by ++ ++ have h_eq : (fun t : ℝ => Real.log (2 * t)) =ᶠ[Filter.atTop] (fun t : ℝ => Real.log 2 + Real.log t) := by ++ filter_upwards [Filter.eventually_gt_atTop (0 : ℝ)] with t ht ++ rw [Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) (ne_of_gt ht)] ++ ++ have h_bigO : (fun t : ℝ => Real.log 2 + Real.log t) =O[Filter.atTop] (fun t : ℝ => Real.log t) := by ++ ++ have h_const : (fun _ : ℝ => Real.log 2) =o[Filter.atTop] Real.log := ++ Real.isLittleO_const_log_atTop ++ have h_self : Real.log =O[Filter.atTop] Real.log := ++ Asymptotics.isBigO_refl _ _ ++ ++ have h_const_bigO : (fun _ : ℝ => Real.log 2) =O[Filter.atTop] Real.log := ++ Asymptotics.IsLittleO.isBigO h_const ++ ++ exact Asymptotics.IsBigO.add h_const_bigO h_self ++ ++ exact h_eq.trans_isBigO h_bigO ++ ++lemma lem_w2t (t : ℝ) : abs (2 * t) + 2 ≥ 0 := by ++ have h1 : abs (2 * t) ≥ 0 := abs_nonneg (2 * t) ++ linarith ++ ++lemma lem_log2Olog2 : ++(fun t : ℝ => Real.log (abs (2 * t) + 4)) =O[Filter.atTop ⊔ Filter.atBot] (fun t : ℝ => Real.log (abs t + 2)) := by ++ ++ have h_eq : ∀ t : ℝ, abs (2 * t) + 4 = 2 * (abs t + 2) := by ++ intro t ++ rw [abs_mul, abs_two] ++ ring ++ ++ have h_log_decomp : ∀ t : ℝ, Real.log (abs (2 * t) + 4) = Real.log 2 + Real.log (abs t + 2) := by ++ intro t ++ rw [h_eq] ++ have h_pos : 0 < abs t + 2 := by linarith [abs_nonneg t] ++ rw [Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) (ne_of_gt h_pos)] ++ ++ have h_target_eq : (fun t : ℝ => Real.log (abs (2 * t) + 4)) = ++ (fun t : ℝ => Real.log 2 + Real.log (abs t + 2)) := by ++ funext t ++ exact h_log_decomp t ++ ++ rw [h_target_eq] ++ ++ apply Asymptotics.IsBigO.of_bound 2 ++ ++ filter_upwards with t ++ ++ have h_pos_arg : abs t + 2 ≥ 1 := by linarith [abs_nonneg t] ++ have h_log_nonneg : 0 ≤ Real.log (abs t + 2) := Real.log_nonneg h_pos_arg ++ have h_log2_pos : 0 < Real.log 2 := Real.log_pos (by norm_num : 1 < (2 : ℝ)) ++ ++ simp only [Real.norm_eq_abs] ++ rw [abs_of_nonneg (by linarith [h_log2_pos.le, h_log_nonneg] : 0 ≤ Real.log 2 + Real.log (abs t + 2))] ++ rw [abs_of_nonneg h_log_nonneg] ++ ++ have h_bound : Real.log 2 ≤ Real.log (abs t + 2) := by ++ apply Real.log_le_log (by norm_num : 0 < (2 : ℝ)) ++ linarith [abs_nonneg t] ++ ++ linarith [h_bound] ++ ++lemma lem_Z2bound : ++ ∃ C > 1, ++ ∀ t : ℝ, 2 < |t| → ++ ∀ δ, 0 < δ ∧ δ < 1 → ++ (-(logDerivZeta ((1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I))).re ++ ≤ C * Real.log (abs t + 2) := by ++ ++ obtain ⟨C₁, hC₁_pos, hbound₁⟩ := lem_explicit2Real2 ++ ++ have h_log_comp : ++ ∀ t : ℝ, 2 < |t| → Real.log (abs (2 * t) + 2) ≤ 2 * Real.log (abs t + 2) := by ++ intro t ht ++ have h_pos_2t : 0 < abs (2 * t) + 2 := by linarith [abs_nonneg (2 * t)] ++ have h_pos_t : 0 < abs t + 2 := by linarith [abs_nonneg t] ++ have h_2t_eq : abs (2 * t) = 2 * abs t := by ++ rw [abs_mul, abs_two] ++ ++ have h_bound : abs (2 * t) + 2 ≤ 4 * (abs t + 2) := by ++ rw [h_2t_eq] ++ ++ linarith [abs_nonneg t] ++ ++ have h_4_pos : (0 : ℝ) < 4 := by norm_num ++ have h_log_bound : Real.log (abs (2 * t) + 2) ≤ Real.log (4 * (abs t + 2)) := ++ Real.log_le_log h_pos_2t h_bound ++ ++ have h_log_mul_eq : Real.log (4 * (abs t + 2)) = Real.log 4 + Real.log (abs t + 2) := by ++ exact Real.log_mul (by norm_num : (4 : ℝ) ≠ 0) (ne_of_gt h_pos_t) ++ ++ have h_4_le : (4 : ℝ) ≤ abs t + 2 := by linarith [ht] ++ have h_log_4 : Real.log 4 ≤ Real.log (abs t + 2) := ++ Real.log_le_log (by norm_num) h_4_le ++ ++ calc Real.log (abs (2 * t) + 2) ++ ≤ Real.log (4 * (abs t + 2)) := h_log_bound ++ _ = Real.log 4 + Real.log (abs t + 2) := h_log_mul_eq ++ _ ≤ Real.log (abs t + 2) + Real.log (abs t + 2) := add_le_add_left h_log_4 _ ++ _ = 2 * Real.log (abs t + 2) := by ring ++ ++ have hC₁_nonneg : 0 ≤ C₁ := le_of_lt (lt_trans zero_lt_one hC₁_pos) ++ ++ refine ⟨2 * C₁, ?_, ?_⟩ ++ · ++ linarith [hC₁_pos] ++ · ++ intro t ht δ hδ ++ let s := (1 : ℂ) + (δ : ℝ) + (2 * (t : ℝ)) * Complex.I ++ ++ have h1 : (-(logDerivZeta s)).re ≤ C₁ * Real.log (abs (2 * t) + 2) := hbound₁ t ht δ hδ ++ ++ have h3 : Real.log (abs (2 * t) + 2) ≤ 2 * Real.log (abs t + 2) := h_log_comp t ht ++ ++ calc (-(logDerivZeta s)).re ++ ≤ C₁ * Real.log (abs (2 * t) + 2) := h1 ++ _ ≤ C₁ * (2 * Real.log (abs t + 2)) := mul_le_mul_of_nonneg_left h3 hC₁_nonneg ++ _ = (2 * C₁) * Real.log (abs t + 2) := by ring ++ ++lemma lem_Z1split (delta : ℝ) (_hdelta : delta > 0) (_hdelta_lt1 : delta < 1) (rho : ℂ) ++ (_h_rho_in_zeroZ : rho ∈ zeroZ) ++ (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : ++ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) ++ (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) = ++ (((analyticOrderAt riemannZeta rho).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re + ++ Finset.sum ((Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)).erase rho) ++ (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) := by ++ classical ++ set s := Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im) ++ set f := fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re ++ have hmem : rho ∈ s := by ++ simpa [s, Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite rho.im)] using h_rho_in_Zt ++ ++ have h_decomp : ∑ x ∈ s, f x = f rho + ∑ x ∈ s.erase rho, f x := by ++ rw [← Finset.insert_erase hmem] ++ rw [Finset.sum_insert (Finset.notMem_erase rho s)] ++ simp ++ exact h_decomp ++ ++lemma re_ofReal_mul_eq (a : ℝ) (z : ℂ) : ((a : ℂ) * z).re = a * z.re := by ++ calc ++ ((a : ℂ) * z).re = ((a : ℂ).re) * z.re - ((a : ℂ).im) * z.im := by ++ simp [Complex.mul_re] ++ _ = a * z.re - 0 := by ++ simp ++ _ = a * z.re := by ++ simp ++ ++lemma re_ofReal_div_eq (a : ℝ) (z : ℂ) : ((a : ℂ) / z).re = a * (1 / z).re := by ++ simp [div_eq_mul_inv] ++ ++lemma re_ofReal_div_ge_one (a : ℝ) (z : ℂ) (ha : 1 ≤ a) (hz : 0 ≤ (1 / z).re) : ((a : ℂ) / z).re ≥ (1 / z).re := by ++ have hrepr : ((a : ℂ) / z).re = a * (1 / z).re := by ++ simp [div_eq_mul_inv, Complex.mul_re] ++ have hmul : (1 : ℝ) * (1 / z).re ≤ a * (1 / z).re := ++ mul_le_mul_of_nonneg_right ha hz ++ calc ++ ((a : ℂ) / z).re = a * (1 / z).re := hrepr ++ _ ≥ 1 * (1 / z).re := by exact hmul ++ _ = (1 / z).re := by simp [one_mul] ++ ++lemma analyticAt_riemannZeta_of_ne_one {s : ℂ} (hs : s ≠ 1) : AnalyticAt ℂ riemannZeta s := by ++ ++ refine (Complex.analyticAt_iff_eventually_differentiableAt).2 ?_ ++ ++ filter_upwards [eventually_ne_nhds hs] with z hz ++ exact differentiableAt_riemannZeta hz ++ ++lemma riemannZeta_not_eventually_zero_of_ne_one {s : ℂ} (hs : s ≠ 1) : ++ ¬ (∀ᶠ z in nhds s, riemannZeta z = 0) := by ++ intro hEvZero ++ ++ let H : ℂ → ℂ := Function.update (fun z : ℂ => (z - 1) * riemannZeta z) 1 1 ++ ++ have hH_diff : Differentiable ℂ H := by ++ intro z ++ rcases eq_or_ne z 1 with rfl | hz ++ · ++ refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt ++ · ++ ++ filter_upwards [self_mem_nhdsWithin] with t ht ++ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := (differentiableAt_id.sub_const 1) ++ have h2 : DifferentiableAt ℂ riemannZeta t := by ++ ++ exact differentiableAt_riemannZeta ht ++ have hdiff := h1.mul h2 ++ ++ apply hdiff.congr_of_eventuallyEq ++ filter_upwards [eventually_ne_nhds ht] with u hu ++ simp [H, Function.update_of_ne hu] ++ · ++ simpa [H, continuousAt_update_same] using riemannZeta_residue_one ++ · ++ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) ++ have h2 : DifferentiableAt ℂ riemannZeta z := by ++ exact differentiableAt_riemannZeta hz ++ have hdiff := h1.mul h2 ++ ++ apply hdiff.congr_of_eventuallyEq ++ filter_upwards [eventually_ne_nhds hz] with u hu ++ simp [H, Function.update_of_ne hu] ++ ++ have hH_analytic : AnalyticOnNhd ℂ H Set.univ := ++ (Complex.analyticOnNhd_univ_iff_differentiable).2 hH_diff ++ ++ have h0_analytic : AnalyticOnNhd ℂ (fun _ : ℂ => (0 : ℂ)) Set.univ := by ++ intro z _; simpa using (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => (0 : ℂ)) z) ++ ++ have hEv_ne1 : ∀ᶠ z in nhds s, z ≠ 1 := eventually_ne_nhds hs ++ have hEv_H0 : ∀ᶠ z in nhds s, H z = 0 := by ++ filter_upwards [hEvZero, hEv_ne1] with z hz_zero hz_ne1 ++ ++ have : H z = (z - 1) * riemannZeta z := by simp [H, Function.update_of_ne hz_ne1] ++ simp [this, hz_zero] ++ ++ have hEqOn : Set.EqOn H (fun _ : ℂ => (0 : ℂ)) Set.univ := by ++ ++ have hU : IsPreconnected (Set.univ : Set ℂ) := by simpa using isPreconnected_univ ++ exact AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq hH_analytic h0_analytic hU (by simp) hEv_H0 ++ have hHeq : H = fun _ : ℂ => (0 : ℂ) := by ++ funext z; simpa using hEqOn (by simp : z ∈ (Set.univ : Set ℂ)) ++ ++ have h2ne1 : (2 : ℂ) ≠ 1 := by norm_num ++ have hH2 : H (2 : ℂ) = (2 - 1) * riemannZeta (2 : ℂ) := by ++ simp [H] ++ have hzeta2_ne : riemannZeta (2 : ℂ) ≠ 0 := ++ riemannZeta_ne_zero_of_one_le_re (by simp) ++ have hprod_zero' : 0 = (2 - 1) * riemannZeta (2 : ℂ) := by ++ simpa [hHeq] using hH2 ++ have hprod_zero : (2 - 1) * riemannZeta (2 : ℂ) = 0 := hprod_zero'.symm ++ have hnonzero : (2 - 1) * riemannZeta (2 : ℂ) ≠ 0 := by ++ have hcoeff : (2 : ℂ) - 1 ≠ 0 := sub_ne_zero.mpr h2ne1 ++ exact mul_ne_zero hcoeff hzeta2_ne ++ exact hnonzero hprod_zero ++ ++lemma analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero {f : ℂ → ℂ} {z0 : ℂ} ++ (hf : AnalyticAt ℂ f z0) (hzero : f z0 = 0) ++ (hnot : ¬ (∀ᶠ z in nhds z0, f z = 0)) : ++ 1 ≤ (analyticOrderAt f z0).toNat := by ++ classical ++ ++ have hne0 : analyticOrderAt f z0 ≠ 0 := by ++ intro h0 ++ have hzne : f z0 ≠ 0 := (AnalyticAt.analyticOrderAt_eq_zero hf).1 h0 ++ exact hzne hzero ++ ++ have hneTop : analyticOrderAt f z0 ≠ ⊤ := by ++ intro htop ++ have hall : (∀ᶠ z in nhds z0, f z = 0) := (analyticOrderAt_eq_top).1 htop ++ exact hnot hall ++ ++ rcases WithTop.ne_top_iff_exists.mp hneTop with ⟨n, hn⟩ ++ ++ have hn_ne_zero : n ≠ 0 := by ++ intro hn0 ++ apply hne0 ++ ++ simp [hn.symm, hn0] ++ rfl ++ ++ have hposn : 1 ≤ n := Nat.succ_le_of_lt (Nat.pos_of_ne_zero hn_ne_zero) ++ ++ simpa [hn.symm] using! hposn ++ ++lemma lem_Z1splitge (delta : ℝ) (hdelta_pos : delta > 0) (hdelta : delta < 1) (rho : ℂ) ++ (h_rho_in_zeroZ : rho ∈ zeroZ) (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : ++ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) ≥ ++(1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re := by ++ classical ++ ++ have hsplit := ++ lem_Z1split delta hdelta_pos hdelta rho h_rho_in_zeroZ h_rho_in_Zt ++ ++ rw [hsplit] ++ ++ have h_rho_ne_one : rho ≠ (1 : ℂ) := by ++ intro h ++ have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) ++ exact hz1_ne (by simpa [h] using! h_rho_in_zeroZ) ++ have hAnal : AnalyticAt ℂ riemannZeta rho := analyticAt_riemannZeta_of_ne_one h_rho_ne_one ++ have hNotEv : ¬ (∀ᶠ z in nhds rho, riemannZeta z = 0) := ++ riemannZeta_not_eventually_zero_of_ne_one h_rho_ne_one ++ have horder_nat : 1 ≤ (analyticOrderAt riemannZeta rho).toNat := ++ analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero ++ hAnal (by simpa using! h_rho_in_zeroZ) hNotEv ++ have ha_real : (1 : ℝ) ≤ ((analyticOrderAt riemannZeta rho).toNat : ℝ) := by exact_mod_cast horder_nat ++ have hz_nonneg : 0 ≤ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re := ++ lem_Re1deltatge0 delta hdelta_pos rho.im rho h_rho_in_Zt ++ have hfirst : ++ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho)).re ++ ≤ (((((analyticOrderAt riemannZeta rho).toNat : ℝ) : ℂ) / ++ (((1 : ℂ) + delta + rho.im * Complex.I) - rho))).re := by ++ ++ simpa [ge_iff_le] using ++ (re_ofReal_div_ge_one ((analyticOrderAt riemannZeta rho).toNat : ℝ) ++ ((((1 : ℂ) + delta + rho.im * Complex.I) - rho)) ha_real hz_nonneg) ++ ++ have hsum_nonneg : ++ 0 ≤ Finset.sum ++ ((Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)).erase rho) ++ (fun rho1 : ℂ => ++ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ++ (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re) := by ++ apply Finset.sum_nonneg ++ intro rho1 hmem ++ rcases Finset.mem_erase.mp hmem with ⟨_, hmemS⟩ ++ ++ have hZt : rho1 ∈ ZetaZerosNearPoint rho.im := by ++ simpa [Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite rho.im)] using hmemS ++ ++ have hne1 : rho1 ≠ (1 : ℂ) := by ++ intro h ++ have hz1_ne : riemannZeta (1 : ℂ) ≠ 0 := riemannZeta_ne_zero_of_one_le_re (by simp) ++ have hzero1 : riemannZeta rho1 = 0 := hZt.1 ++ exact hz1_ne (by simpa [h] using hzero1) ++ ++ have hAnal1 : AnalyticAt ℂ riemannZeta rho1 := analyticAt_riemannZeta_of_ne_one hne1 ++ have hNotEv1 : ¬ (∀ᶠ z in nhds rho1, riemannZeta z = 0) := ++ riemannZeta_not_eventually_zero_of_ne_one hne1 ++ have hzero1 : riemannZeta rho1 = 0 := hZt.1 ++ have horder1 : 1 ≤ (analyticOrderAt riemannZeta rho1).toNat := ++ analyticOrderAt_pos_toNat_of_zero_of_analytic_not_eventually_zero hAnal1 hzero1 hNotEv1 ++ have ha1_real : (1 : ℝ) ≤ ((analyticOrderAt riemannZeta rho1).toNat : ℝ) := by exact_mod_cast horder1 ++ ++ have hz1_nonneg : 0 ≤ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re := ++ lem_Re1deltatge0 delta hdelta_pos rho.im rho1 hZt ++ ++ have hge : ++ (1 / (((1 : ℂ) + delta + rho.im * Complex.I) - rho1)).re ≤ ++ (((((analyticOrderAt riemannZeta rho1).toNat : ℝ) : ℂ) / ++ (((1 : ℂ) + delta + rho.im * Complex.I) - rho1))).re := by ++ simpa [ge_iff_le] using ++ (re_ofReal_div_ge_one ((analyticOrderAt riemannZeta rho1).toNat : ℝ) ++ ((((1 : ℂ) + delta + rho.im * Complex.I) - rho1)) ha1_real hz1_nonneg) ++ ++ exact le_trans hz1_nonneg hge ++ ++ have h := add_le_add hfirst hsum_nonneg ++ ++ simpa using h ++ ++lemma lem_1deltatrho0 (delta : ℝ) (_hdelta : delta > 0) (rho : ℂ) (_h_rho_in_zeroZ : rho ∈ zeroZ) : ++((1 : ℂ) + delta + rho.im * Complex.I - rho) = ((1 : ℝ) + delta - rho.re) := by ++ ++ calc (1 : ℂ) + delta + rho.im * Complex.I - rho ++ = (1 : ℂ) + delta + rho.im * Complex.I - (rho.re + rho.im * Complex.I) := by rw [Complex.re_add_im] ++ _ = (1 : ℂ) + delta - rho.re := by ring ++ _ = ((1 : ℝ) + delta - rho.re : ℂ) := by norm_cast ++ ++lemma lem_1delsigReal (delta : ℝ) (hdelta_pos : delta > 0) (_hdelta : delta < 1) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : ++(1 / ((1 : ℂ) + delta + rho.im * Complex.I - rho)).re = 1 / ((1 : ℝ) + delta - rho.re) := by ++ rw [lem_1deltatrho0 delta hdelta_pos rho h_rho_in_zeroZ] ++ ++ rw [← Complex.ofReal_add, ← Complex.ofReal_sub, ← Complex.ofReal_one] ++ ++ rw [Complex.div_ofReal_re] ++ ++ rw [Complex.ofReal_re] ++ ++lemma lem_11delsiginR (delta : ℝ) (hdelta : delta > 0) (_hdelta_lt_1 : delta < 1) (sigma : ℝ) (hsigma : sigma ≤ 1) : ++(1 / ((1 : ℂ) + delta - sigma)).im = 0 := by ++ ++ have h_pos : 1 + delta - sigma > 0 := by ++ calc 1 + delta - sigma ++ = (1 - sigma) + delta := by ring ++ _ ≥ 0 + delta := by linarith [hsigma] ++ _ = delta := by simp ++ _ > 0 := hdelta ++ ++ have h_eq : (1 : ℂ) + delta - sigma = (1 + delta - sigma : ℝ) := by ++ simp only [Complex.ofReal_add, Complex.ofReal_sub, Complex.ofReal_one] ++ ++ rw [h_eq] ++ ++ rw [Complex.div_ofReal_im] ++ ++ rw [Complex.one_im] ++ ++ simp ++ ++lemma lem_11delsiginR2 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : ++(1 / ((1 : ℂ) + delta - rho.re)).im = 0 := by ++ ++ have h_zeta_zero : riemannZeta rho = 0 := h_rho_in_zeroZ ++ ++ have h_rho_form : rho = rho.re + rho.im * Complex.I := by simp [Complex.re_add_im] ++ ++ rw [h_rho_form] at h_zeta_zero ++ ++ have h_rho_re_le_1 : rho.re ≤ 1 := lem_sigmale1 rho.re rho.im h_zeta_zero ++ ++ exact lem_11delsiginR delta hdelta hdelta_lt_1 rho.re h_rho_re_le_1 ++ ++lemma lem_ReReal (x : ℝ) : (x : ℂ).re = x := Complex.ofReal_re x ++ ++lemma lem_1delsigReal2 (delta : ℝ) (_hdelta : delta > 0) (rho : ℂ) (_h_rho_in_zeroZ : rho ∈ zeroZ) : ++(1 / ((1 : ℂ) + delta - rho.re)).re = 1 / ((1 : ℝ) + delta - rho.re) := by ++ ++ have h_eq : (1 : ℂ) + delta - rho.re = (1 + delta - rho.re : ℝ) := by ++ simp only [Complex.ofReal_add, Complex.ofReal_sub, Complex.ofReal_one] ++ ++ rw [h_eq] ++ ++ rw [Complex.div_ofReal_re] ++ ++ rw [Complex.one_re] ++ ++lemma lem_re_inv_one_plus_delta_minus_rho_real (delta : ℝ) (hdelta : delta > 0) (rho : ℂ) (h_rho_in_zeroZ : rho ∈ zeroZ) : ++(1 / ((1 : ℂ) + delta + rho.im * Complex.I - rho)).re = 1 / ((1 : ℝ) + delta - rho.re) := by ++ ++ rw [lem_1deltatrho0 delta hdelta rho h_rho_in_zeroZ] ++ ++ exact lem_1delsigReal2 delta hdelta rho h_rho_in_zeroZ ++ ++lemma lem_Z1splitge2 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (rho : ℂ) ++ (h_rho_in_zeroZ : rho ∈ zeroZ) (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint rho.im) : ++ Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite rho.im)) ++ (fun rho1 : ℂ => (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / ((1 : ℂ) + delta + rho.im * Complex.I - rho1)).re) ≥ ++1 / ((1 : ℝ) + delta - rho.re) := by ++ ++ have h1 := lem_Z1splitge delta hdelta hdelta_lt_1 rho h_rho_in_zeroZ h_rho_in_Zt ++ ++ have h2 := lem_re_inv_one_plus_delta_minus_rho_real delta hdelta rho h_rho_in_zeroZ ++ ++ rw [← h2] ++ exact h1 ++ ++lemma lem_Z1splitge3 (delta : ℝ) (hdelta : delta > 0) (hdelta_lt_1 : delta < 1) (sigma t : ℝ) (rho : ℂ) ++ (h_rho_eq : rho = sigma + t * Complex.I) (h_rho_in_zeroZ : rho ∈ zeroZ) ++ (h_rho_in_Zt : rho ∈ ZetaZerosNearPoint t) : ++(Finset.sum (Set.Finite.toFinset (ZetaZerosNearPoint_finite t)) (fun rho1 : ℂ => ((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (((1 : ℂ) + delta + t * Complex.I) - rho1)) ).re ≥ 1 / ((1 : ℝ) + delta - sigma) := by ++ ++ rw [lem_sumrho1 t delta hdelta hdelta_lt_1] ++ ++ have h_rho_im : rho.im = t := by ++ rw [h_rho_eq] ++ simp [Complex.add_im, Complex.mul_im, Complex.I_im] ++ have h_rho_re : rho.re = sigma := by ++ rw [h_rho_eq] ++ simp [Complex.add_re, Complex.mul_re, Complex.I_re] ++ ++ have h_rho_in_Zt' : rho ∈ ZetaZerosNearPoint rho.im := by ++ rw [h_rho_im] ++ exact h_rho_in_Zt ++ ++ have h_bound := lem_Z1splitge2 delta hdelta hdelta_lt_1 rho h_rho_in_zeroZ h_rho_in_Zt' ++ ++ convert h_bound using 1 ++ ++ simp_rw [← h_rho_im] ++ ++ rw [h_rho_re] ++ ++lemma lem_rho_in_Zt (delta : ℝ) (hdelta : delta > 0) (t : ℝ) ++ (h_rho_zero : (1 : ℂ) + delta + t * Complex.I ∈ zeroZ) : ++ (1 : ℂ) + delta + t * Complex.I ∈ ZetaZerosNearPoint t := by ++ ++ let ρ : ℂ := (1 : ℂ) + delta + t * Complex.I ++ ++ have h_re : ρ.re > 1 := by ++ simp [ρ, Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re] ++ linarith [hdelta] ++ ++ have h_nonzero : riemannZeta ρ ≠ 0 := by ++ apply riemannZeta_ne_zero_of_one_le_re ++ exact le_of_lt h_re ++ ++ have h_zero : riemannZeta ρ = 0 := h_rho_zero ++ ++ exact absurd h_zero h_nonzero ++ ++lemma Z1bound : ++ ∃ C > 1, ++ ∀ (delta : ℝ), (0 < delta ∧ delta < 1) → ++ ∀ t : ℝ, 2 < |t| → ++ ∀ s : ℂ, s ∈ zeroZ ∧ s.im = t → ++ (-(logDerivZeta ((1 : ℂ) + delta + t * Complex.I))).re ++ ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by ++ classical ++ ++ obtain ⟨C0, hC0gt1, hExp⟩ := lem_explicit1RealReal ++ ++ have hlog5pos : 0 < Real.log 4 := Real.log_pos (by norm_num : (1 : ℝ) < 4) ++ let C : ℝ := max (C0 + 3 / Real.log 4) 2 ++ have hCgt1 : 1 < C := by ++ have : (1 : ℝ) < 2 := by norm_num ++ exact lt_of_lt_of_le this (le_max_right _ _) ++ refine ⟨C, hCgt1, ?_⟩ ++ intro delta hdelta t ht s hs ++ ++ set sp : ℂ := (1 : ℂ) + delta + t * Complex.I ++ set S : Finset ℂ := Set.Finite.toFinset (ZetaZerosNearPoint_finite t) ++ set Sre : ℝ := ++ Finset.sum S ++ (fun rho1 : ℂ => ++ (((analyticOrderAt riemannZeta rho1).toNat : ℂ) / (sp - rho1)).re) ++ ++ have h_bound : abs ((logDerivZeta sp).re - Sre) ++ ≤ C0 * Real.log (abs t + 2) := by ++ simpa [sp, S, Sre] using hExp t ht delta hdelta ++ ++ have h_left : -(C0 * Real.log (abs t + 2)) ≤ (logDerivZeta sp).re - Sre := ++ (abs_le.mp h_bound).1 ++ have h_neg : -((logDerivZeta sp).re - Sre) ≤ C0 * Real.log (abs t + 2) := by ++ simpa using neg_le_neg h_left ++ have h_isol : - (logDerivZeta sp).re ≤ C0 * Real.log (abs t + 2) - Sre := by ++ have := sub_le_sub_right h_neg Sre ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ ++ have hS_nonneg : 0 ≤ Sre := by ++ apply Finset.sum_nonneg ++ intro rho1 hmem ++ have hZt : rho1 ∈ ZetaZerosNearPoint t := by ++ simpa [S, Set.Finite.mem_toFinset (ZetaZerosNearPoint_finite t)] using hmem ++ ++ simpa [sp] using ++ (lem_Re1deltatge0m delta hdelta.1 t hdelta.2 rho1 hZt) ++ ++ have h_basic : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) := by ++ have h_drop : C0 * Real.log (abs t + 2) - Sre ≤ C0 * Real.log (abs t + 2) := ++ sub_le_self _ hS_nonneg ++ exact le_trans h_isol h_drop ++ ++ by_cases hmem : s ∈ ZetaZerosNearPoint t ++ · ++ set sigma : ℝ := s.re ++ have h_rho_eq : s = (sigma : ℂ) + t * Complex.I := by ++ have : s = s.re + s.im * Complex.I := by simp [Complex.re_add_im] ++ simpa [sigma, hs.2] using this ++ ++ have hsum_rew := lem_sumrho1 t delta hdelta.1 hdelta.2 ++ have h_sum_ge' := ++ lem_Z1splitge3 delta hdelta.1 hdelta.2 sigma t s h_rho_eq hs.1 hmem ++ have h_sum_ge : Sre ≥ 1 / ((1 : ℝ) + delta - sigma) := by ++ simpa [sp, S, Sre, hsum_rew] using h_sum_ge' ++ ++ have h1 : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) := by ++ have : (1 / ((1 : ℝ) + delta - sigma)) ≤ Sre := h_sum_ge ++ have := sub_le_sub_left this (C0 * Real.log (abs t + 2)) ++ exact le_trans h_isol (by simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this) ++ ++ have hCge : C0 ≤ C := ++ le_trans (by ++ have : 0 ≤ 3 / Real.log 4 := le_of_lt (div_pos (by norm_num) hlog5pos) ++ have := add_le_add_right this C0 ++ simpa using this) (le_max_left _ _) ++ ++ have hY_nonneg : 0 ≤ Real.log (abs t + 2) := by ++ have h2le : (2 : ℝ) ≤ abs t + 2 := by ++ have h0 : 0 ≤ |t| := abs_nonneg t ++ simp ++ exact le_of_lt (Real.log_pos (lt_of_lt_of_le (by norm_num) h2le)) ++ have h_enlarge : C0 * Real.log (abs t + 2) ≤ C * Real.log (abs t + 2) := ++ mul_le_mul_of_nonneg_right hCge hY_nonneg ++ have h2 : C0 * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) ≤ ++ C * Real.log (abs t + 2) - (1 / ((1 : ℝ) + delta - sigma)) := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using ++ (sub_le_sub_right h_enlarge (1 / ((1 : ℝ) + delta - sigma))) ++ have := le_trans h1 h2 ++ simpa [sp, sigma, Complex.neg_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] ++ using this ++ · ++ ++ have h_notle : ¬ ‖s - ((3/2 : ℂ) + t * Complex.I)‖ ≤ (5/6 : ℝ) := by ++ intro hle ++ exact hmem ⟨hs.1, hle⟩ ++ have hdist_gt : (5/6 : ℝ) < ‖s - ((3/2 : ℂ) + t * Complex.I)‖ := not_le.mp h_notle ++ ++ have h_re : (s - ((3/2 : ℂ) + t * Complex.I)).re = s.re - (3/2 : ℝ) := by ++ simp [Complex.sub_re, Complex.add_re] ++ have h_im : (s - ((3/2 : ℂ) + t * Complex.I)).im = 0 := by ++ have : (s - ((3/2 : ℂ) + t * Complex.I)).im = s.im - t := by ++ simp [Complex.sub_im, Complex.add_im] ++ simp [hs.2] ++ have h_eq : s - ((3/2 : ℂ) + t * Complex.I) = (((s.re - (3/2 : ℝ)) : ℝ) : ℂ) := by ++ apply Complex.ext ++ · simp [h_re] ++ · simp [h_im] ++ have hdist_real : ‖s - ((3/2 : ℂ) + t * Complex.I)‖ = |s.re - (3/2 : ℝ)| := by ++ simpa [h_eq] using complex_abs_of_real (s.re - (3/2 : ℝ)) ++ have habs_gt : (5/6 : ℝ) < |s.re - (3/2 : ℝ)| := by simpa [hdist_real] using hdist_gt ++ ++ have h0 : riemannZeta (s.re + s.im * Complex.I) = 0 := by ++ simpa [Complex.re_add_im] using! hs.1 ++ have hs_le1 : s.re ≤ 1 := lem_sigmale1 s.re s.im h0 ++ ++ have h_nonpos : s.re - (3/2 : ℝ) ≤ 0 := by linarith [hs_le1] ++ have h_abs_eq : |s.re - (3/2 : ℝ)| = (3/2 : ℝ) - s.re := by ++ have : |s.re - (3/2 : ℝ)| = -(s.re - (3/2 : ℝ)) := abs_of_nonpos h_nonpos ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ have h_gt' : (5/6 : ℝ) < (3/2 : ℝ) - s.re := by simpa [h_abs_eq] using habs_gt ++ have hs_le_23 : s.re ≤ (2/3 : ℝ) := by linarith [h_gt'] ++ ++ have hden_ge : (1/3 : ℝ) ≤ 1 + delta - s.re := by ++ have : (1/3 : ℝ) ≤ 1 - s.re := by linarith [hs_le_23] ++ have : 1 - s.re ≤ 1 + delta - s.re := by linarith [hdelta.1] ++ exact le_trans ‹(1/3 : ℝ) ≤ 1 - s.re› this ++ have hone_div_le3 : 1 / (1 + delta - s.re) ≤ (3 : ℝ) := by ++ have : 1 / (1 + delta - s.re) ≤ 1 / (1/3 : ℝ) := ++ one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 1/3) hden_ge ++ simpa [one_div] using this ++ have hneg_ge : - (3 : ℝ) ≤ - (1 / (1 + delta - s.re)) := by ++ simpa using (neg_le_neg hone_div_le3) ++ ++ have hlog_ge : Real.log 4 ≤ Real.log (abs t + 2) := by ++ have : (4 : ℝ) < abs t + 2 := by linarith [ht] ++ exact Real.log_le_log (by norm_num) (le_of_lt this) ++ have hC_ge_add : C ≥ C0 + 3 / Real.log 4 := by exact le_max_left _ _ ++ have hCminus : C - C0 ≥ 3 / Real.log 4 := by linarith ++ have hY_nonneg : 0 ≤ Real.log (abs t + 2) := by ++ have h2le : (2 : ℝ) ≤ abs t + 2 := by ++ have h0 : 0 ≤ |t| := abs_nonneg t ++ simp ++ exact le_of_lt (Real.log_pos (lt_of_lt_of_le (by norm_num) h2le)) ++ have hmul1 : (3 / Real.log 4) * Real.log 4 ≤ (3 / Real.log 4) * Real.log (abs t + 2) := by ++ have hk_nonneg : 0 ≤ 3 / Real.log 4 := le_of_lt (div_pos (by norm_num) hlog5pos) ++ exact mul_le_mul_of_nonneg_left hlog_ge hk_nonneg ++ have hmul2 : (3 / Real.log 4) * Real.log (abs t + 2) ≤ (C - C0) * Real.log (abs t + 2) := by ++ exact mul_le_mul_of_nonneg_right hCminus hY_nonneg ++ have hmul_ge3 : (3 : ℝ) ≤ (C - C0) * Real.log (abs t + 2) := by ++ have hne5 : Real.log 4 ≠ 0 := ne_of_gt hlog5pos ++ have hcalc : (3 / Real.log 4) * Real.log 4 = 3 := by ++ simp [div_eq_mul_inv, hne5] ++ have : (3 / Real.log 4) * Real.log 4 ≤ (C - C0) * Real.log (abs t + 2) := ++ le_trans hmul1 hmul2 ++ simpa [hcalc] using this ++ ++ have hCmul' : C0 * Real.log (abs t + 2) + 3 ≤ C * Real.log (abs t + 2) := by ++ have : C0 * Real.log (abs t + 2) + 3 ≤ C0 * Real.log (abs t + 2) + (C - C0) * Real.log (abs t + 2) := by ++ exact add_le_add_right hmul_ge3 _ ++ have hcalc : C * Real.log (abs t + 2) = ++ C0 * Real.log (abs t + 2) + (C - C0) * Real.log (abs t + 2) := by ++ ring ++ simpa [hcalc, add_comm, add_left_comm, add_assoc] using this ++ ++ have : (-(logDerivZeta sp)).re ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by ++ have h1 : (-(logDerivZeta sp)).re ≤ C0 * Real.log (abs t + 2) := h_basic ++ have h2 : C0 * Real.log (abs t + 2) ≤ C * Real.log (abs t + 2) - 3 := by ++ linarith [hCmul'] ++ have h3 : C * Real.log (abs t + 2) - 3 ≤ - (1 / (1 + delta - s.re)) + C * Real.log (abs t + 2) := by ++ have := add_le_add_left hneg_ge (C * Real.log (abs t + 2)) ++ simpa [add_comm, add_left_comm, add_assoc, sub_eq_add_neg] using this ++ exact le_trans h1 (le_trans h2 h3) ++ simpa [sp, Complex.neg_re, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ ++lemma Z0boundRe : ++Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => (- (logDerivZeta ((1 : ℂ) + delta))).re - (1 / delta)) (fun _ => (1 : ℝ)) := by ++ ++ have h := Z0bound ++ ++ have h_eq : (fun (delta : ℝ) => (- (logDerivZeta ((1 : ℂ) + delta))).re - (1 / delta)) = ++ (fun (delta : ℝ) => (-logDerivZeta ((1 : ℂ) + delta) - (1 / (delta : ℂ))).re) := by ++ ext delta ++ rw [Complex.sub_re, Complex.neg_re] ++ ++ have : (1 / (delta : ℂ)).re = 1 / delta := by ++ rw [Complex.div_re, Complex.one_re, Complex.ofReal_re, Complex.ofReal_im] ++ simp [Complex.normSq_ofReal] ++ rw [this] ++ ++ rw [h_eq] ++ ++ rw [Asymptotics.isBigO_iff] at h ⊢ ++ obtain ⟨c, hc⟩ := h ++ use c ++ filter_upwards [hc] with delta h_delta ++ have : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp ++ rw [this] at h_delta ++ have : ‖(1 : ℝ)‖ = (1 : ℝ) := by simp ++ rw [this] ++ exact le_trans (Complex.abs_re_le_norm _) h_delta ++ ++lemma extract_bigO_bound_Z0 (delta : ℝ) (_hdelta : delta > 0) : ∃ C0 > 0, (-logDerivZeta ((1 : ℂ) + delta)).re ≤ 1 / delta + C0 := by ++ ++ let target := (-logDerivZeta ((1 : ℂ) + delta)).re ++ let base := 1 / delta ++ ++ use max 1 (target - base + 1) ++ ++ constructor ++ · ++ exact lt_of_lt_of_le zero_lt_one (le_max_left 1 (target - base + 1)) ++ ++ · ++ ++ by_cases h : target - base + 1 ≤ 1 ++ · ++ have h_max : max 1 (target - base + 1) = 1 := max_eq_left h ++ rw [h_max] ++ ++ linarith [h] ++ · ++ have h_max : max 1 (target - base + 1) = target - base + 1 := max_eq_right (le_of_not_ge h) ++ rw [h_max] ++ ++ linarith ++ ++lemma uniform_bound_Z0 : ∃ δ0 > 0, ∃ C0 ≥ 0, ∀ δ : ℝ, 0 < δ → δ < δ0 → (- (logDerivZeta ((1 : ℂ) + δ))).re ≤ 1 / δ + C0 := by ++ ++ let f : ℝ → ℝ := fun δ => (- (logDerivZeta ((1 : ℂ) + δ))).re - (1 / δ) ++ ++ have hO := Z0boundRe ++ ++ rcases (Asymptotics.isBigO_iff).1 hO with ⟨c, hc⟩ ++ ++ have h1norm : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c := by ++ ++ have : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c * ‖(1 : ℝ)‖ := hc ++ refine this.mono ?_ ++ intro δ hδ ++ simpa using (by simpa using hδ) ++ ++ rcases (Filter.eventually_iff_exists_mem).1 h1norm with ⟨S, hS_in, hS_bound⟩ ++ ++ rcases (mem_nhdsGT_iff_exists_Ioc_subset).1 hS_in with ⟨δ0, hδ0pos, hIoc_sub_S⟩ ++ ++ refine ⟨δ0, hδ0pos, max c 0, le_max_right _ _, ?_⟩ ++ intro δ hδpos hδlt ++ ++ have hδ_in_S : δ ∈ S := hIoc_sub_S ⟨hδpos, le_of_lt hδlt⟩ ++ ++ have hnorm_le_c : ‖f δ‖ ≤ c := hS_bound δ hδ_in_S ++ ++ have hnorm_le_C0 : ‖f δ‖ ≤ max c 0 := le_trans hnorm_le_c (le_max_left _ _) ++ ++ have h_upper : f δ ≤ max c 0 := by ++ have : |f δ| ≤ max c 0 := by simpa [Real.norm_eq_abs] using hnorm_le_C0 ++ exact (abs_le.mp this).2 ++ ++ have := (sub_le_iff_le_add).1 h_upper ++ simpa [f, add_comm] using this ++ ++lemma eventually_atTop_sup_atBot_iff_abs {P : ℝ → Prop} : ++ (∀ᶠ t in (Filter.atTop ⊔ Filter.atBot), P t) ↔ ∃ T : ℝ, ∀ t : ℝ, T ≤ |t| → P t := by ++ constructor ++ · intro h ++ have h' := (Filter.eventually_sup).1 h ++ rcases h' with ⟨hTop, hBot⟩ ++ rcases (Filter.eventually_atTop).1 hTop with ⟨A, hA⟩ ++ rcases (Filter.eventually_atBot).1 hBot with ⟨B, hB⟩ ++ refine ⟨max A (-B), ?_⟩ ++ intro t ht ++ have hcases : max A (-B) ≤ t ∨ max A (-B) ≤ -t := (le_abs).1 ht ++ cases hcases with ++ | inl hTle_t => ++ have hA_le_t : A ≤ t := le_trans (le_max_left A (-B)) hTle_t ++ exact hA t hA_le_t ++ | inr hTle_neg_t => ++ have h_negB_le_neg_t : -B ≤ -t := le_trans (le_max_right A (-B)) hTle_neg_t ++ have h_t_le_B : t ≤ B := (neg_le_neg_iff).1 h_negB_le_neg_t ++ exact hB t h_t_le_B ++ · intro h ++ rcases h with ⟨T, hT⟩ ++ refine (Filter.eventually_sup).2 ?_ ++ constructor ++ · ++ refine (Filter.eventually_atTop).2 ?_ ++ refine ⟨max T 0, ?_⟩ ++ intro t ht ++ have ht0 : 0 ≤ t := le_trans (le_max_right T 0) ht ++ have hTle : T ≤ |t| := by ++ have : T ≤ t := le_trans (le_max_left T 0) ht ++ simpa [abs_of_nonneg ht0] using this ++ exact hT t hTle ++ · ++ refine (Filter.eventually_atBot).2 ?_ ++ refine ⟨-max T 0, ?_⟩ ++ intro t ht ++ have ht0 : t ≤ 0 := by ++ have hnegmax_le_0 : -max T 0 ≤ 0 := by ++ simp ++ exact le_trans ht hnegmax_le_0 ++ have hTle : T ≤ |t| := by ++ have h1 : max T 0 ≤ -t := by ++ have := (neg_le_neg ht) ++ ++ simpa using this ++ have : T ≤ -t := le_trans (le_max_left T 0) h1 ++ simpa [abs_of_nonpos ht0] using this ++ exact hT t hTle ++ ++lemma re_sum_three (a b : ℝ) (x y z : ℂ) : ((a * x) + (b * y) + z).re = a * x.re + b * y.re + z.re := by ++ ++ simp [Complex.add_re, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, add_assoc] ++ ++lemma log_abs_add_two_ge_one (t : ℝ) (ht : Real.exp 1 - 2 ≤ |t|) : (1 : ℝ) ≤ Real.log (|t| + 2) := by ++ have hx : Real.exp 1 ≤ |t| + 2 := by ++ have h' := add_le_add_left ht (2 : ℝ) ++ simpa [sub_add_cancel] using! h' ++ have hxpos : 0 < |t| + 2 := by ++ have two_pos : 0 < (2 : ℝ) := by norm_num ++ exact add_pos_of_nonneg_of_pos (abs_nonneg t) two_pos ++ exact (Real.le_log_iff_exp_le hxpos).2 hx ++ ++lemma log_abs_add_two_ge_of_threshold (K t : ℝ) (ht : Real.exp K - 2 ≤ |t|) : K ≤ Real.log (|t| + 2) := by ++ have hx : Real.exp K ≤ |t| + 2 := by ++ have h' := add_le_add_left ht (2 : ℝ) ++ simpa [sub_add_cancel] using! h' ++ have hxpos : 0 < |t| + 2 := by ++ have two_pos : 0 < (2 : ℝ) := by norm_num ++ exact add_pos_of_nonneg_of_pos (abs_nonneg t) two_pos ++ exact (Real.le_log_iff_exp_le hxpos).2 hx ++ ++lemma re_ofReal_add_ofReal_add (a b : ℝ) (z : ℂ) : (a + b + z).re = a + b + z.re := by ++ simp [Complex.add_re, Complex.ofReal_re, add_assoc] ++ ++lemma algebraic_rewrite_RHS (δ s L C0 C1 C2 : ℝ) : ++ 3 * (1 / δ + C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L = ++ 3 / δ - 4 / (1 + δ - s) + (4 * C1 + C2) * L + 3 * C0 := by ++ have hA : 3 * (1 / δ + C0) = 3 * (1 / δ) + 3 * C0 := by ++ simp [mul_add] ++ have hB2 : ++ 4 * (-(1 / (1 + δ - s)) + C1 * L) = ++ -(4 * (1 / (1 + δ - s))) + (4 * C1) * L := by ++ calc ++ 4 * (-(1 / (1 + δ - s)) + C1 * L) ++ = 4 * (-(1 / (1 + δ - s))) + 4 * (C1 * L) := by ++ simp [mul_add] ++ _ = -(4 * (1 / (1 + δ - s))) + (4 * C1) * L := by ++ simp [mul_comm, mul_assoc] ++ calc ++ 3 * (1 / δ + C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L ++ = (3 * (1 / δ) + 3 * C0) + 4 * (-(1 / (1 + δ - s)) + C1 * L) + C2 * L := by ++ rw [hA] ++ _ = (3 * (1 / δ) + 3 * C0) + (-(4 * (1 / (1 + δ - s))) + (4 * C1) * L) + C2 * L := by ++ rw [hB2] ++ _ = (3 / δ + 3 * C0) + (- 4 / (1 + δ - s) + (4 * C1) * L) + C2 * L := by ++ simp [div_eq_mul_inv] ++ _ = 3 / δ - 4 / (1 + δ - s) + (4 * C1) * L + C2 * L + 3 * C0 := by ++ ring ++ _ = 3 / δ - 4 / (1 + δ - s) + (4 * C1 + C2) * L + 3 * C0 := by ++ ring ++ ++lemma absorb_pos_constant_into_log {L A c : ℝ} (hL : 1 ≤ L) (hc : 0 ≤ c) : A * L + c ≤ (A + c) * L := by ++ ++ have hc_le : c ≤ L * c := by ++ have h := mul_le_mul_of_nonneg_right hL hc ++ simpa [one_mul] using h ++ ++ have h0 : A * L + c ≤ A * L + L * c := by ++ exact add_le_add_right hc_le (A * L) ++ calc ++ A * L + c ≤ A * L + L * c := h0 ++ _ = A * L + c * L := by simp [mul_comm] ++ _ = (A + c) * L := by simp [right_distrib] ++ ++lemma neg_logDeriv_zeta_eq_vonMangoldt_sum (s : ℂ) (hs : 1 < s.re) : -(deriv riemannZeta s / riemannZeta s) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-s) := by ++ ++ have h1 := ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div hs ++ ++ have h2 : -deriv riemannZeta s / riemannZeta s = LSeries (fun n => ↑(ArithmeticFunction.vonMangoldt n)) s := h1.symm ++ ++ have h3 : -(deriv riemannZeta s / riemannZeta s) = -deriv riemannZeta s / riemannZeta s := by ring ++ rw [h3, h2] ++ ++ rw [LSeries] ++ congr 1 ++ ext n ++ rw [LSeries.term_def] ++ split_ifs with h_zero ++ · ++ simp [h_zero] ++ · ++ rw [div_eq_mul_inv, Complex.cpow_neg] ++ ++lemma zeta1zetaseries {s : ℂ} (hs : 1 < s.re) : ++-logDerivZeta s = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-s) := by ++ unfold logDerivZeta ++ ++ exact neg_logDeriv_zeta_eq_vonMangoldt_sum s hs ++ ++lemma zeta1zetaseriesxy (x y : ℝ) (hx : 1 < x) : ++ -logDerivZeta (x + y * I) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I)) := by ++ apply zeta1zetaseries ++ ++ have h : (x + y * I).re = x := by ++ simp [Complex.add_re, Complex.ofReal_re, Complex.ofReal_im] ++ right ++ exact Complex.I_re ++ rw [h] ++ exact hx ++ ++lemma Zconverges1 (x y : ℝ) (hx : 1 < x) : riemannZeta (x + y * I) ≠ 0 := by ++ apply riemannZeta_ne_zero_of_one_lt_re ++ ++ have h : (x + y * I).re = x := by ++ rw [Complex.add_re, Complex.ofReal_re] ++ simp [Complex.mul_re] ++ right ++ exact Complex.I_re ++ rw [h] ++ exact hx ++ ++lemma complex_re_of_real_add_imag (x y : ℝ) : (x + y * I).re = x := by ++ simp [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.ofReal_im] ++ ++ right ++ exact Complex.I_re ++ ++lemma vonMangoldt_LSeriesSummable (s : ℂ) (hs : 1 < s.re) : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) s := by ++ ++ exact ArithmeticFunction.LSeriesSummable_vonMangoldt hs ++ ++lemma summable_of_support_singleton {α : Type*} [SeminormedAddCommGroup α] (f : ℕ → α) (n₀ : ℕ) (h : ∀ n : ℕ, n ≠ n₀ → f n = 0) : Summable f := by ++ ++ have h_finite_support : Set.Finite (Function.support f) := by ++ ++ have h_subset : Function.support f ⊆ {n₀} := by ++ intro n hn ++ ++ by_contra h_ne ++ ++ have h_zero : f n = 0 := h n h_ne ++ ++ simp [Function.mem_support] at hn ++ exact hn h_zero ++ ++ exact Set.Finite.subset (Set.finite_singleton n₀) h_subset ++ ++ exact summable_of_hasFiniteSupport h_finite_support ++ ++lemma summable_of_summable_add_sub {α : Type*} [SeminormedAddCommGroup α] (f g h : ℕ → α) (h_eq : f = g + h) (hf : Summable f) (hh : Summable h) : Summable g := by ++ ++ have g_eq_f_sub_h : g = f - h := by ++ ++ rw [← sub_eq_iff_eq_add] at h_eq ++ exact h_eq.symm ++ ++ rw [g_eq_f_sub_h] ++ ++ exact hf.sub hh ++ ++lemma LSeriesSummable_to_summable (f : ℕ → ℂ) (s : ℂ) (h : LSeriesSummable f s) : Summable (fun n => f n * (n : ℂ) ^ (-s)) := by ++ ++ have h_term_summable : Summable (LSeries.term f s) := h ++ ++ have h_eq_nonzero : ∀ n : ℕ, n ≠ 0 → LSeries.term f s n = f n * (n : ℂ) ^ (-s) := by ++ intro n hn ++ rw [LSeries.term_of_ne_zero hn] ++ rw [div_eq_mul_inv, Complex.cpow_neg] ++ ++ let diff := fun n => LSeries.term f s n - f n * (n : ℂ) ^ (-s) ++ ++ have h_diff_support : ∀ n : ℕ, n ≠ 0 → diff n = 0 := by ++ intro n hn ++ simp only [diff] ++ rw [h_eq_nonzero n hn] ++ simp ++ ++ have h_diff_summable : Summable diff := by ++ ++ apply summable_of_support_singleton diff 0 h_diff_support ++ ++ have h_rw : LSeries.term f s = (fun n => f n * (n : ℂ) ^ (-s)) + diff := by ++ ext n ++ simp only [diff, Pi.add_apply] ++ ring ++ ++ exact summable_of_summable_add_sub (LSeries.term f s) (fun n => f n * (n : ℂ) ^ (-s)) diff h_rw h_term_summable h_diff_summable ++ ++lemma ReZconverges1 (x y : ℝ) (hx : 1 < x) : ++Summable (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) := by ++ ++ have h_nonzero : riemannZeta (x + y * I) ≠ 0 := Zconverges1 x y hx ++ ++ have h_re_gt_one : 1 < (x + y * I).re := by ++ rw [complex_re_of_real_add_imag] ++ exact hx ++ ++ have h_L_summable : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) := ++ vonMangoldt_LSeriesSummable (x + y * I) h_re_gt_one ++ ++ have h_summable : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) := ++ LSeriesSummable_to_summable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) h_L_summable ++ ++ have h_hasSum : HasSum (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))) := ++ h_summable.hasSum ++ ++ have h_hasSum_re : HasSum (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))).re) (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x + y * I))).re := ++ Complex.hasSum_re h_hasSum ++ ++ exact h_hasSum_re.summable ++ ++lemma exprule (n : ℕ) (hn : n ≥ 1) (alpha beta : ℂ) : (n : ℂ) ^ (alpha + beta) = (n : ℂ) ^ alpha * (n : ℂ) ^ beta := by ++ apply Complex.cpow_add ++ ++ rw [Nat.cast_ne_zero] ++ ++ rw [← Nat.one_le_iff_ne_zero] ++ exact hn ++ ++lemma lem_nxy (n : ℕ) (hn : n ≥ 1) (x y : ℝ) : ++ Complex.cpow (n : ℂ) (-(x + y * I)) = Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) := by ++ ++ have h : -(x + y * I) = (-x : ℂ) + (-(y * I)) := by ring ++ rw [h] ++ ++ exact lem_exprule n hn (-x : ℂ) (-(y * I)) ++ ++lemma lem_zeta1zetaseriesxy2 (x y : ℝ) (hx : 1 < x) : ++ -logDerivZeta (x + y * I) = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * (Complex.cpow (n : ℂ) ((-x) : ℂ)) * (Complex.cpow (n : ℂ) (-(y * I))) := by ++ ++ rw [zeta1zetaseriesxy x y hx] ++ ++ congr 1 ++ ext n ++ ++ rw [← Complex.cpow_eq_pow] ++ ++ by_cases h : n = 0 ++ · ++ simp [h] ++ · ++ have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h ++ rw [lem_nxy n hn x y] ++ ++ ring ++ ++lemma complex_add_re_ofReal_mul_I (x y : ℝ) : (x + y * I).re = x := by ++ rw [Complex.add_re, Complex.ofReal_re, Complex.re_ofReal_mul] ++ ++ have h : I.re = 0 := Complex.I_re ++ rw [h] ++ simp ++ ++lemma LSeriesSummable_to_explicit_summable (x y : ℝ) (_hx : 1 < x) : LSeriesSummable (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) → Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))) := by ++ intro h_summable ++ ++ have h_vm_zero : (ArithmeticFunction.vonMangoldt 0 : ℂ) = 0 := by ++ simp ++ ++ have h_eq : ∀ n : ℕ, LSeries.term (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) n = ++ (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) := by ++ intro n ++ ++ rw [LSeries.term_def₀ h_vm_zero] ++ ++ rw [← Complex.cpow_eq_pow] ++ ++ by_cases hn : n = 0 ++ · ++ simp [hn] ++ · ++ have hn_ge : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr hn ++ rw [lem_nxy n hn_ge x y] ++ ring ++ ++ have h_term_summable : Summable (fun n => LSeries.term (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (x + y * I) n) := by ++ exact h_summable ++ ++ convert h_term_summable using 1 ++ ext n ++ exact (h_eq n).symm ++ ++lemma Zseriesconverges1 (x y : ℝ) (hx : 1 < x) : ++Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))) := by ++ ++ have h_zeta_ne_zero := Zconverges1 x y hx ++ ++ have h_series := lem_zeta1zetaseriesxy2 x y hx ++ ++ have h_re : 1 < (x + y * I).re := by ++ rw [complex_add_re_ofReal_mul_I] ++ exact hx ++ ++ have h_summable := ArithmeticFunction.LSeriesSummable_vonMangoldt h_re ++ ++ exact LSeriesSummable_to_explicit_summable x y hx h_summable ++ ++lemma lem_realnx (n : ℕ) (x : ℝ) (_hn : n ≥ 1) (_hx : x ≥ 1) : ++ ArithmeticFunction.vonMangoldt n * (n : ℝ) ^ (-x) ≥ 0 := by ++ apply mul_nonneg ++ · ++ exact ArithmeticFunction.vonMangoldt_nonneg ++ · ++ apply Real.rpow_nonneg ++ ++ exact Nat.cast_nonneg n ++ ++lemma sumReal {v : ℕ → ℂ} {v_sum : ℂ} (h_sum : HasSum v v_sum) : ++ HasSum (fun n => (v n).re) v_sum.re := by ++ exact Complex.hasSum_re h_sum ++ ++lemma sumRealLambda (x y : ℝ) (hx : 1 < x) : ++ (∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re = ++ ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re := by ++ apply Complex.re_tsum ++ exact Zseriesconverges1 x y hx ++ ++lemma lem_sumRealZ (x y : ℝ) (hx : 1 < x) : ++ (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re := by ++ ++ rw [lem_zeta1zetaseriesxy2 x y hx] ++ ++ exact sumRealLambda x y hx ++ ++lemma complex_cpow_neg_real (n : ℕ) (x : ℝ) (_hn : n ≥ 1) : Complex.cpow (n : ℂ) ((-x) : ℂ) = Complex.ofReal ((n : ℝ) ^ (-x)) := by ++ ++ have h_nonneg : 0 ≤ (n : ℝ) := Nat.cast_nonneg n ++ ++ rw [Complex.cpow_eq_pow] ++ ++ rw [Complex.ofReal_cpow h_nonneg (-x)] ++ ++ congr 1 ++ ++ simp ++ ++lemma RealLambdaxy (n : ℕ) (x y : ℝ) (hn : n ≥ 1) (_hx : 1 < x) : ++ ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I))).re = ++((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) * (Complex.cpow (n : ℂ) (-(y * I))).re := by ++ ++ let b := ArithmeticFunction.vonMangoldt n * (n : ℝ) ^ (-x) ++ ++ have h1 : (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) = (b : ℂ) := by ++ ++ have h_real_pow : Complex.cpow (n : ℂ) ((-x) : ℂ) = Complex.ofReal ((n : ℝ) ^ (-x)) := by ++ exact complex_cpow_neg_real n x hn ++ ++ rw [h_real_pow] ++ rw [← Complex.ofReal_mul] ++ ++ have h2 : (ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ) * Complex.cpow (n : ℂ) (-(y * I)) = ++ ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) ((-x) : ℂ)) * Complex.cpow (n : ℂ) (-(y * I)) := by ++ rw [mul_assoc] ++ ++ rw [h2, h1] ++ ++ exact lem_realbw b (Complex.cpow (n : ℂ) (-(y * I))) ++ ++lemma ReZseriesRen (x y : ℝ) (hx : 1 < x) : ++ (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) * (Complex.cpow (n : ℂ) (-(y * I))).re := by ++ rw [lem_sumRealZ x y hx] ++ congr 1 ++ ext n ++ by_cases h : n = 0 ++ · simp [h] ++ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h ++ exact RealLambdaxy n x y hn hx ++ ++lemma Rezeta1zetaseries (x y : ℝ) (hx : 1 < x) : ++ (-logDerivZeta (x + y * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by ++ rw [ReZseriesRen x y hx] ++ congr 1 ++ ext n ++ by_cases h : n = 0 ++ · simp [h] ++ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h ++ rw [← lem_eacosalog3 n hn y] ++ ++ congr 1 ++ ++ rw [Complex.cpow_eq_pow] ++ ++ simp [I] ++ ++lemma complex_vonMangoldt_real_part_eq (n : ℕ) (x y : ℝ) (hn : n ≥ 1) (hx : 1 < x) : ++((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re = ++(ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by ++ ++ rw [lem_nxy n hn x y] ++ ++ rw [← mul_assoc] ++ ++ rw [RealLambdaxy n x y hn hx] ++ ++ have h_cpow : (Complex.cpow (n : ℂ) (-(y * I))).re = ((n : ℂ) ^ (-(y * I))).re := by ++ rw [Complex.cpow_eq_pow] ++ ++ have h_I : -(y * I) = -y * Complex.I := by ++ simp [I] ++ ++ rw [h_cpow, h_I] ++ ++ rw [lem_eacosalog3 n hn y] ++ ++lemma Rezetaseries_convergence (x y : ℝ) (hx : 1 < x) : ++ Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ))) := by ++ ++ have h1 : Summable (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) := ++ ReZconverges1 x y hx ++ ++ have h2 : ∀ n : ℕ, ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re = ++ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ)) := by ++ intro n ++ by_cases h : n = 0 ++ · simp [h] ++ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h ++ exact complex_vonMangoldt_real_part_eq n x y hn hx ++ ++ have h3 : (fun n => ((ArithmeticFunction.vonMangoldt n : ℂ) * Complex.cpow (n : ℂ) (-(x + y * I))).re) = ++ (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (y * Real.log (n : ℝ))) := ++ funext h2 ++ rwa [← h3] ++ ++lemma Rezetaseries2t (x t : ℝ) (hx : 1 < x) : ++ Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (2 * t * Real.log (n : ℝ))) := by ++ ++ exact Rezetaseries_convergence x (2 * t) hx ++ ++lemma lem_cost0 (n : ℕ) (_hn : n ≥ 1) (t : ℝ) (ht : t = 0) : Real.cos (t * Real.log (n : ℝ)) = 1 := by ++ rw [ht] ++ simp ++ ++lemma Rezetaseries0 (x : ℝ) (hx : 1 < x) : ++ Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) := by ++ ++ have h1 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) * Real.cos (0 * Real.log (n : ℝ))) := ++ Rezetaseries_convergence x 0 hx ++ ++ convert h1 using 1 ++ ext n ++ by_cases h : n = 0 ++ · simp [h] ++ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h ++ rw [lem_cost0 n hn 0 rfl] ++ ring ++ ++lemma uniform_bound_Z0_complex : ∃ δ0 > 0, ∃ C0 ≥ 0, ∀ δ : ℝ, 0 < δ → δ < δ0 → ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C0 := by ++ ++ let f : ℝ → ℂ := fun δ => -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ)) ++ ++ have hO := Z0bound ++ ++ rcases (Asymptotics.isBigO_iff).1 hO with ⟨c, hc⟩ ++ have h_event : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c := by ++ ++ have : ∀ᶠ δ in nhdsWithin (0 : ℝ) (Set.Ioi (0 : ℝ)), ‖f δ‖ ≤ c * ‖(1 : ℂ)‖ := hc ++ refine this.mono ?_ ++ intro δ hδ ++ have : ‖(1 : ℂ)‖ = (1 : ℝ) := by simp ++ simpa [this] using hδ ++ ++ rcases (Filter.eventually_iff_exists_mem).1 h_event with ⟨S, hS_in, hS_bound⟩ ++ ++ rcases (mem_nhdsGT_iff_exists_Ioc_subset).1 hS_in with ⟨δ0, hδ0pos, hIoc_sub_S⟩ ++ ++ refine ⟨δ0, hδ0pos, max c 0, le_max_right _ _, ?_⟩ ++ intro δ hδpos hδlt ++ ++ have hδ_in_S : δ ∈ S := hIoc_sub_S ⟨hδpos, le_of_lt hδlt⟩ ++ ++ have hnorm_le_c : ‖f δ‖ ≤ c := hS_bound δ hδ_in_S ++ ++ exact le_trans hnorm_le_c (le_max_left _ _) ++ ++lemma cpow_neg_zero_I (z : ℂ) : z ^ (-(0 : ℝ) * Complex.I) = (1 : ℂ) := by ++ simp ++ ++lemma tsum_nonneg_of_nonneg {f : ℕ → ℝ} (hnon : ∀ n, 0 ≤ f n) : 0 ≤ ∑' n, f n := by ++ simpa using (tsum_nonneg hnon) ++ ++lemma vonMangoldt_rpow_nonneg (x : ℝ) : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) := by ++ intro n ++ have h1 : 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) := ArithmeticFunction.vonMangoldt_nonneg ++ have h2 : 0 ≤ (n : ℝ) ^ (-x) := by ++ exact Real.rpow_nonneg (show 0 ≤ (n : ℝ) from Nat.cast_nonneg n) _ ++ simpa using mul_nonneg h1 h2 ++ ++lemma cpow_neg_real_of_nat (n : ℕ) (x : ℝ) (hn : 1 ≤ n) : ++ (n : ℂ) ^ (-(x : ℂ)) = Complex.ofReal ((n : ℝ) ^ (-x)) := by ++ simpa using complex_cpow_neg_real n x hn ++ ++lemma norm_negLogDerivZeta_real_eq_abs_tsum_vonMangoldt (x : ℝ) (hx : 1 < x) : ++ ‖-logDerivZeta (x : ℂ)‖ = |∑' n, ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x))| := by ++ ++ have hx' : 1 < (x : ℂ).re := by simpa using hx ++ have hseries := zeta1zetaseries (s := (x : ℂ)) hx' ++ ++ let g : ℕ → ℝ := fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) ++ have hterm : ∀ n : ℕ, ++ (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ)) = (g n : ℂ) := by ++ intro n ++ by_cases h : n = 0 ++ · ++ have hv0C : (ArithmeticFunction.vonMangoldt 0 : ℂ) = 0 := by ++ simp ++ have hv0R : (ArithmeticFunction.vonMangoldt 0 : ℝ) = 0 := by ++ simp ++ simp [g, h, hv0R] ++ · ++ have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h ++ have hcp : (n : ℂ) ^ (-(x : ℂ)) = Complex.ofReal ((n : ℝ) ^ (-x)) := ++ complex_cpow_neg_real n x hn ++ ++ have : (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ)) ++ = Complex.ofReal (ArithmeticFunction.vonMangoldt n) * Complex.ofReal ((n : ℝ) ^ (-x)) := by ++ simp [hcp] ++ simpa [g, Complex.ofReal_mul] using this ++ ++ have hsum_eq : (∑' n, (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ))) ++ = ∑' n, (g n : ℂ) := by ++ ++ have hfun : (fun n => (ArithmeticFunction.vonMangoldt n : ℂ) * (n : ℂ) ^ (-(x : ℂ))) ++ = (fun n => (g n : ℂ)) := funext hterm ++ simp [hfun] ++ ++ have hsum_ofReal : (∑' n, (g n : ℂ)) = Complex.ofReal (∑' n, g n) := by ++ simpa using (Complex.ofReal_tsum g).symm ++ ++ have hval : -logDerivZeta (x : ℂ) = Complex.ofReal (∑' n, g n) := by ++ ++ simpa [hsum_eq, hsum_ofReal] using hseries ++ ++ calc ++ ‖-logDerivZeta (x : ℂ)‖ = ‖Complex.ofReal (∑' n, g n)‖ := by simp [hval] ++ _ = |∑' n, g n| := by ++ exact (RCLike.norm_ofReal (K := ℂ) (∑' n, g n)) ++ ++lemma tsum_le_of_nonneg_of_le {f g : ℕ → ℝ} (hf : Summable f) (hg : Summable g) (_hnonneg : ∀ n, 0 ≤ f n) (hle : ∀ n, f n ≤ g n) : (∑' n, f n) ≤ (∑' n, g n) := by ++ classical ++ exact Summable.tsum_le_tsum hle hf hg ++ ++lemma rpow_neg_antitone {a x y : ℝ} (ha : 1 ≤ a) (hxy : x ≥ y) : a ^ (-x) ≤ a ^ (-y) := by ++ ++ simpa using (Real.rpow_le_rpow_of_exponent_le ha (neg_le_neg hxy)) ++ ++lemma isPrimePow_zero_false : IsPrimePow 0 = False := by ++ apply propext ++ constructor ++ · intro h ++ rcases (isPrimePow_nat_iff 0).1 h with ⟨p, k, hp, hkpos, hk⟩ ++ have hpnz : (p : ℕ) ≠ 0 := by ++ exact ne_of_gt (Nat.Prime.pos hp) ++ have hpow_ne : (p : ℕ) ^ k ≠ 0 := pow_ne_zero _ hpnz ++ exact (hpow_ne (by simp [hk])) ++ · intro hFalse ++ exact hFalse.elim ++ ++lemma bounded_on_compact_interval (a b : ℝ) (h0 : 0 < a) (_hle : a ≤ b) : ∃ Cmid ≥ 0, ∀ δ : ℝ, a ≤ δ → δ ≤ b → ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ Cmid := by ++ ++ let s : Set ℝ := Set.Icc a b ++ let f : ℝ → ℂ := fun δ => -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ)) ++ ++ let H : ℂ → ℂ := Function.update (fun z : ℂ => (z - 1) * riemannZeta z) 1 1 ++ ++ have hH_diff : Differentiable ℂ H := by ++ intro z ++ rcases eq_or_ne z 1 with rfl | hz ++ · ++ refine (Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt ?_ ?_).differentiableAt ++ · ++ filter_upwards [self_mem_nhdsWithin] with t ht ++ have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) t := by ++ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) t := ++ (differentiableAt_id.sub_const 1) ++ have h2 : DifferentiableAt ℂ riemannZeta t := ++ (differentiableAt_riemannZeta ht) ++ exact h1.mul h2 ++ apply DifferentiableAt.congr_of_eventuallyEq hdiff ++ filter_upwards [eventually_ne_nhds ht] with u hu using by ++ simp [H, Function.update_of_ne hu] ++ · ++ simpa [H, continuousAt_update_same] using riemannZeta_residue_one ++ · ++ have hdiff : DifferentiableAt ℂ (fun u : ℂ => (u - 1) * riemannZeta u) z := by ++ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) ++ have h2 : DifferentiableAt ℂ riemannZeta z := (differentiableAt_riemannZeta hz) ++ exact h1.mul h2 ++ apply DifferentiableAt.congr_of_eventuallyEq hdiff ++ filter_upwards [eventually_ne_nhds hz] with u hu using by ++ simp [H, Function.update_of_ne hu] ++ ++ let G : ℂ → ℂ := fun z => - (deriv H z) / H z ++ ++ have h_eq_on_pos : ∀ ⦃δ : ℝ⦄, 0 < δ → ++ (-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))) = G ((1 : ℂ) + δ) := by ++ intro δ hδ ++ ++ let z : ℂ := (1 : ℂ) + δ ++ have hz_ne_one : z ≠ (1 : ℂ) := by ++ intro h ++ have hre : (1 + δ : ℝ) = 1 := by ++ simpa [z, Complex.add_re, Complex.ofReal_re] using congrArg Complex.re h ++ have : δ = 0 := by linarith ++ exact (ne_of_gt hδ) this ++ have hzeta_ne : riemannZeta z ≠ 0 := by ++ have : 1 < z.re := by simpa [z, Complex.add_re, Complex.ofReal_re] using by linarith ++ exact riemannZeta_ne_zero_of_one_le_re (le_of_lt this) ++ ++ have h_id_deriv : deriv (fun u : ℂ => u - 1) z = 1 := by ++ exact ((hasDerivAt_id z).sub_const 1).deriv ++ have h_log_id : logDeriv (fun u : ℂ => u - 1) z = 1 / (z - 1) := by ++ simp [logDeriv_apply, h_id_deriv] ++ have hz1 : z - 1 ≠ 0 := by simpa using sub_ne_zero.mpr hz_ne_one ++ have hζ : riemannZeta z ≠ 0 := hzeta_ne ++ ++ have h_deriv_mul : deriv (fun u : ℂ => (u - 1) * riemannZeta u) z ++ = riemannZeta z + (z - 1) * deriv riemannZeta z := by ++ have h1 : HasDerivAt (fun u : ℂ => u - 1) 1 z := (hasDerivAt_id z).sub_const 1 ++ have h2 : HasDerivAt riemannZeta (deriv riemannZeta z) z := ++ (differentiableAt_riemannZeta hz_ne_one).hasDerivAt ++ simpa [one_mul, mul_comm, mul_left_comm, mul_assoc] using! (h1.mul h2).deriv ++ ++ have h_prodLog : ++ logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = ++ logDeriv (fun u : ℂ => u - 1) z + logDerivZeta z := by ++ have h1 : DifferentiableAt ℂ (fun u : ℂ => u - 1) z := (differentiableAt_id.sub_const 1) ++ have h2 : DifferentiableAt ℂ riemannZeta z := (differentiableAt_riemannZeta hz_ne_one) ++ have hfnz : (fun u : ℂ => u - 1) z ≠ 0 := by simpa using hz1 ++ have hgnz : riemannZeta z ≠ 0 := hζ ++ simpa [logDerivZeta] using! ++ (logDeriv_mul (x := z) (f := fun u : ℂ => u - 1) (g := riemannZeta) hfnz hgnz h1 h2) ++ ++ have h_step : -logDerivZeta z - (1 / (z - 1)) ++ = - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z := by ++ have : logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z ++ = 1 / (z - 1) + logDerivZeta z := by ++ simpa [h_log_id, add_comm] using h_prodLog ++ have hneg : - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z ++ = - (1 / (z - 1) + logDerivZeta z) := by ++ simpa using congrArg Neg.neg this ++ simpa [sub_eq_add_neg, add_comm] using hneg.symm ++ ++ have h_H_eq : H z = (z - 1) * riemannZeta z := by ++ simp [H, Function.update_of_ne hz_ne_one] ++ ++ have h_eq_event : (fun u : ℂ => H u) =ᶠ[nhds z] (fun u : ℂ => (u - 1) * riemannZeta u) := by ++ filter_upwards [eventually_ne_nhds hz_ne_one] with u hu ++ simp [H, Function.update_of_ne hu] ++ ++ have h_hasDeriv_prod : ++ HasDerivAt (fun u : ℂ => (u - 1) * riemannZeta u) ++ (riemannZeta z + (z - 1) * deriv riemannZeta z) z := by ++ have h1 : HasDerivAt (fun u : ℂ => u - 1) 1 z := (hasDerivAt_id z).sub_const 1 ++ have h2 : HasDerivAt riemannZeta (deriv riemannZeta z) z := ++ (differentiableAt_riemannZeta hz_ne_one).hasDerivAt ++ simpa [one_mul, mul_comm, mul_left_comm, mul_assoc] using! (h1.mul h2) ++ ++ have h_hasDeriv_H : ++ HasDerivAt H (riemannZeta z + (z - 1) * deriv riemannZeta z) z := ++ h_hasDeriv_prod.congr_of_eventuallyEq h_eq_event ++ ++ have h_dH : deriv H z = riemannZeta z + (z - 1) * deriv riemannZeta z := by ++ simpa using h_hasDeriv_H.deriv ++ ++ have h_log_to_G : - logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = G z := by ++ have h' : logDeriv (fun u : ℂ => (u - 1) * riemannZeta u) z = (deriv H z) / H z := by ++ simp [logDeriv_apply, h_H_eq, h_dH, h_deriv_mul] ++ have hneg' := congrArg (fun w => -w) h' ++ simpa [G, neg_div] using hneg' ++ ++ have : -logDerivZeta z - (1 / (z - 1)) = G z := by ++ simpa using h_step.trans h_log_to_G ++ ++ simpa [z] using this ++ ++ let F : ℝ → ℂ := fun δ => G ((1 : ℂ) + δ) ++ ++ have hH_analytic_univ : AnalyticOnNhd ℂ H Set.univ := ++ (Complex.analyticOnNhd_univ_iff_differentiable).2 hH_diff ++ ++ have hF_contOn : ContinuousOn F s := by ++ intro δ0 hδ0 ++ ++ let s0 : ℂ := (1 : ℂ) + δ0 ++ have hδ0pos : 0 < δ0 := lt_of_lt_of_le h0 hδ0.1 ++ have hs0_ne_one : s0 ≠ (1 : ℂ) := by ++ intro h ++ have hre : (1 + δ0 : ℝ) = 1 := by ++ simpa [s0, Complex.add_re, Complex.ofReal_re] using congrArg Complex.re h ++ have : δ0 = 0 := by linarith ++ exact (ne_of_gt hδ0pos) this ++ have hs0_re_gt_one : 1 < s0.re := by ++ simpa [s0, Complex.add_re, Complex.ofReal_re] using by linarith ++ have hζ_ne : riemannZeta s0 ≠ 0 := ++ riemannZeta_ne_zero_of_one_le_re (le_of_lt hs0_re_gt_one) ++ have hHs0_eq : H s0 = (s0 - 1) * riemannZeta s0 := by ++ simp [H, Function.update_of_ne hs0_ne_one] ++ have hHs0_ne : H s0 ≠ 0 := by ++ have hs0m1_ne : s0 - 1 ≠ 0 := sub_ne_zero.mpr hs0_ne_one ++ have : (s0 - 1) * riemannZeta s0 ≠ 0 := mul_ne_zero hs0m1_ne hζ_ne ++ simpa [hHs0_eq] using this ++ ++ have hH_an_at_s0 : AnalyticAt ℂ H s0 := hH_analytic_univ s0 (by simp) ++ have hH'_an_at_s0 : AnalyticAt ℂ (fun z => deriv H z) s0 := hH_an_at_s0.deriv ++ have hG_an_at_s0 : AnalyticAt ℂ (fun z => G z) s0 := by ++ have h_div : AnalyticAt ℂ (fun z => (deriv H z) / H z) s0 := ++ hH'_an_at_s0.div hH_an_at_s0 (by simpa using hHs0_ne) ++ have h_neg : AnalyticAt ℂ (fun z => -((deriv H z) / H z)) s0 := h_div.neg ++ simpa [G, div_eq_mul_inv, mul_left_comm, mul_comm, mul_assoc] using h_neg ++ have hG_cont_s0 : ContinuousAt (fun z : ℂ => G z) s0 := hG_an_at_s0.continuousAt ++ ++ let affine : ℝ → ℂ := fun δ => (1 : ℂ) + (δ : ℂ) ++ have h_affine_at : ContinuousAt affine δ0 := ++ (continuousAt_const).add Complex.continuous_ofReal.continuousAt ++ ++ have hy : affine δ0 = s0 := by simp [affine, s0] ++ have hG_at : ContinuousAt (fun z : ℂ => G z) (affine δ0) := by simpa [hy] using hG_cont_s0 ++ have h_comp_at : ContinuousAt (fun δ : ℝ => G (affine δ)) δ0 := hG_at.comp h_affine_at ++ simpa [F, s, affine] using h_comp_at.continuousWithinAt ++ ++ have h_eq_on_s : ∀ ⦃δ : ℝ⦄, δ ∈ s → f δ = F δ := by ++ intro δ hδ ++ have hδpos : 0 < δ := lt_of_lt_of_le h0 hδ.1 ++ simpa [f, F] using h_eq_on_pos hδpos ++ ++ have hK : IsCompact s := isCompact_Icc ++ have hNorm_contOn : ContinuousOn (fun δ => ‖F δ‖) s := hF_contOn.norm ++ have hBdd : BddAbove ((fun δ => ‖F δ‖) '' s) := IsCompact.bddAbove_image hK hNorm_contOn ++ rcases hBdd with ⟨C, hC⟩ ++ ++ refine ⟨max C 0, le_max_right _ _, ?_⟩ ++ intro δ hδa hδb ++ ++ change ‖f δ‖ ≤ max C 0 ++ have hδmem : δ ∈ s := ⟨hδa, hδb⟩ ++ have himg : (fun δ => ‖F δ‖) δ ∈ (fun δ => ‖F δ‖) '' s := ⟨δ, hδmem, rfl⟩ ++ have hbound : ‖F δ‖ ≤ C := hC himg ++ have hbound' : ‖F δ‖ ≤ max C 0 := le_trans hbound (le_max_left _ _) ++ ++ have hfδ_eq : f δ = F δ := h_eq_on_s hδmem ++ calc ++ ‖f δ‖ = ‖F δ‖ := by simp [hfδ_eq] ++ _ ≤ max C 0 := hbound' ++ ++lemma norm_one_div_coe_real_le_one_of_one_le {δ : ℝ} (h : 1 ≤ δ) : ‖(1 : ℂ) / (δ : ℂ)‖ ≤ 1 := by ++ ++ have hδpos : 0 < δ := lt_of_lt_of_le zero_lt_one h ++ calc ++ ‖(1 : ℂ) / (δ : ℂ)‖ = ‖(1 : ℂ)‖ / ‖(δ : ℂ)‖ := by ++ exact norm_div (1 : ℂ) (δ : ℂ) ++ _ = 1 / ‖(δ : ℂ)‖ := by simp ++ _ = 1 / |δ| := by simp ++ _ = 1 / δ := by simp [abs_of_nonneg (le_of_lt hδpos)] ++ _ ≤ 1 := by ++ ++ simpa using (one_div_le_one_div_of_le (ha := (zero_lt_one)) (h := h)) ++ ++lemma Z0bound_const : ++ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), ++ ‖ -logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C := by ++ ++ rcases uniform_bound_Z0_complex with ⟨δ0, hδ0pos, C0, hC0nonneg, hsmall⟩ ++ ++ let a : ℝ := min δ0 1 ++ have ha_pos : 0 < a := lt_min_iff.2 ⟨hδ0pos, zero_lt_one⟩ ++ have ha_le_one : a ≤ 1 := min_le_right _ _ ++ rcases bounded_on_compact_interval a 1 ha_pos ha_le_one with ⟨Cmid, hCmid_nonneg, hmid⟩ ++ ++ let C2 : ℝ := ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) ++ have hC2_nonneg : 0 ≤ C2 := by ++ have hnn : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) := ++ vonMangoldt_rpow_nonneg 2 ++ exact tsum_nonneg_of_nonneg hnn ++ ++ let C : ℝ := 2 + C0 + Cmid + C2 ++ have hCgt1 : 1 < C := by ++ have : 2 ≤ 2 + C0 + Cmid + C2 := by linarith [hC0nonneg, hCmid_nonneg, hC2_nonneg] ++ linarith ++ refine ⟨C, hCgt1, ?_⟩ ++ intro δ hδpos ++ by_cases hlt : δ < δ0 ++ · ++ have hbound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C0 := ++ hsmall δ hδpos hlt ++ ++ have hC0_le_C : C0 ≤ C := by linarith ++ exact le_trans hbound hC0_le_C ++ · ++ have hge : δ0 ≤ δ := le_of_not_gt hlt ++ rcases le_total δ 1 with hδle1 | hδge1 ++ · ++ have ha_le_δ : a ≤ δ := le_trans (min_le_left δ0 1) hge ++ have hbound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ Cmid := ++ hmid δ ha_le_δ hδle1 ++ ++ have hCmid_le_C : Cmid ≤ C := by linarith ++ exact le_trans hbound hCmid_le_C ++ · ++ ++ let x : ℝ := 1 + δ ++ have hx1 : 1 < x := by ++ have : 0 < δ := hδpos ++ have : 1 < 1 + δ := lt_add_of_pos_right 1 this ++ exact this ++ ++ have h_norm_eq_abs_real : ‖-logDerivZeta (x : ℂ)‖ ++ = |∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)| := ++ norm_negLogDerivZeta_real_eq_abs_tsum_vonMangoldt x hx1 ++ ++ have eqArg : ((1 : ℂ) + δ) = (x : ℂ) := by simp [x] ++ ++ have h_norm_eq_abs : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ++ = |∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)| := by ++ simpa [eqArg] using h_norm_eq_abs_real ++ ++ let S : ℝ := ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) ++ have hsum_nonneg : 0 ≤ S := by ++ change 0 ≤ ∑' n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) ++ exact tsum_nonneg_of_nonneg (vonMangoldt_rpow_nonneg x) ++ ++ have h_norm_le_sum : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ S := by ++ have : ‖-logDerivZeta ((1 : ℂ) + δ)‖ = |S| := h_norm_eq_abs ++ have : |S| = S := abs_of_nonneg hsum_nonneg ++ exact le_of_eq (h_norm_eq_abs.trans this) ++ ++ have hx_ge_two : 2 ≤ x := by ++ ++ have : 1 ≤ δ := hδge1 ++ have : 2 ≤ 1 + δ := by linarith ++ exact this ++ ++ have h_le_2 : ∀ n, (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) ++ ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ)) := by ++ intro n ++ by_cases h0 : n = 0 ++ · simp [h0] ++ · have hn : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h0 ++ have hn' : (1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn ++ have hrpow : (n : ℝ) ^ (-x) ≤ (n : ℝ) ^ (-(2 : ℝ)) := ++ rpow_neg_antitone hn' hx_ge_two ++ have hΛ_nonneg : 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) := ++ ArithmeticFunction.vonMangoldt_nonneg ++ exact mul_le_mul_of_nonneg_left hrpow hΛ_nonneg ++ ++ have h_summ_x : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x)) := by ++ exact Rezetaseries0 x hx1 ++ have h_summ_2 : Summable (fun n => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(2 : ℝ))) := ++ Rezetaseries0 2 (by norm_num) ++ have hsum_le : S ≤ C2 := by ++ ++ have h_nonneg_x : ∀ n, 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-x) := ++ vonMangoldt_rpow_nonneg x ++ exact tsum_le_of_nonneg_of_le h_summ_x h_summ_2 h_nonneg_x h_le_2 ++ ++ have h_norm_le_C2 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C2 := ++ le_trans h_norm_le_sum hsum_le ++ ++ have h_one_div_le : ‖(1 : ℂ) / (δ : ℂ)‖ ≤ 1 := norm_one_div_coe_real_le_one_of_one_le hδge1 ++ have htriangle : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ++ ≤ ‖-logDerivZeta ((1 : ℂ) + δ)‖ + ‖(1 : ℂ) / (δ : ℂ)‖ := ++ norm_sub_le _ _ ++ have hlarge_bound : ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ ≤ C2 + 1 := by ++ refine le_trans htriangle ?_ ++ exact add_le_add h_norm_le_C2 h_one_div_le ++ ++ have hC2_le_C : C2 + 1 ≤ C := by linarith ++ exact le_trans hlarge_bound hC2_le_C ++ ++lemma Z0boundRe_const : ++ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), ++ ((-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))).re) ≤ C := by ++ ++ rcases Z0bound_const with ⟨C, hCpos, hC⟩ ++ use C ++ constructor ++ · exact hCpos ++ · intro δ hδ ++ ++ have h_bound := hC δ hδ ++ exact le_trans (Complex.re_le_norm _) h_bound ++ ++lemma Z0boundRe_const2 : ++ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), ++ ((-logDerivZeta ((1 : ℂ) + δ)).re + (-(1 / (δ : ℂ))).re) ≤ C := by ++ ++ rcases Z0boundRe_const with ⟨C, hC_pos, hC⟩ ++ use C, hC_pos ++ intro δ hδ ++ have h_sub_re : ((-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))).re) = ++ ((-logDerivZeta ((1 : ℂ) + δ)).re + (-(1 / (δ : ℂ))).re) := by ++ rw [Complex.sub_re] ++ rfl ++ rw [← h_sub_re] ++ exact hC δ hδ ++ ++lemma Z0boundRe_const3 : ++ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0), ++ (-logDerivZeta ((1 : ℂ) + δ)).re - (1 / δ) ≤ C := by ++ ++ rcases Z0boundRe_const2 with ⟨C, hCpos, hC⟩ ++ use C, hCpos ++ intro δ hδ ++ ++ have h := hC δ hδ ++ ++ have h_re_eq : (-(1 / (δ : ℂ))).re = -(1 / δ) := by ++ rw [Complex.neg_re, Complex.div_re, Complex.one_re, Complex.ofReal_re, Complex.ofReal_im] ++ simp [Complex.normSq_ofReal] ++ ++ rwa [h_re_eq] at h ++ ++lemma Z341bounds_const : ++ ∃ C > 1, ∀ (δ : ℝ) (_hδ : δ > 0) (_hδ1 : δ < 1), ∀ t : ℝ, 2 < |t| → ∀ σ : ℝ, ++ (σ + t * Complex.I) ∈ zeroZ → ++ 3 * (-logDerivZeta ((1 : ℂ) + δ)).re ++ + 4 * (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re ++ + (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re ++ ≤ 3 / δ - 4 / (1 + δ - σ) + C * Real.log (|t| + 2) := by ++ ++ rcases Z0boundRe_const3 with ⟨C0, hC0pos, hZ0⟩ ++ rcases Z1bound with ⟨C1, hC1pos, hZ1⟩ ++ rcases lem_Z2bound with ⟨C2, hC2pos, hZ2⟩ ++ ++ let C := 3 * C0 + 4 * C1 + C2 ++ ++ have hC_gt_one : 1 < C := by ++ have h1 : 1 < C0 := hC0pos ++ have h2 : 3 < 3 * C0 := by linarith [mul_lt_mul_of_pos_left h1 (by norm_num : (0 : ℝ) < 3)] ++ have h3 : 0 < 4 * C1 := mul_pos (by norm_num) (lt_trans zero_lt_one hC1pos) ++ have h4 : 0 < C2 := lt_trans zero_lt_one hC2pos ++ linarith [h2, h3, h4] ++ ++ use C ++ constructor ++ · exact hC_gt_one ++ · intro δ hδpos hδ1 t ht σ hσ ++ ++ have hZ0_bound : (-logDerivZeta ((1 : ℂ) + δ)).re ≤ C0 + (1 / δ) := by ++ have := hZ0 δ hδpos ++ linarith ++ ++ have hZ1_bound : (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re ≤ -(1 / (1 + δ - σ)) + C1 * Real.log (|t| + 2) := by ++ let s := σ + t * Complex.I ++ have hs_mem : s ∈ zeroZ := hσ ++ have hs_im : s.im = t := by simp [s] ++ have hs_re : s.re = σ := by simp [s] ++ have hδ_cond : 0 < δ ∧ δ < 1 := ⟨hδpos, hδ1⟩ ++ have := hZ1 δ hδ_cond t ht s ⟨hs_mem, hs_im⟩ ++ rw [hs_re] at this ++ exact this ++ ++ have hZ2_bound : (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re ≤ C2 * Real.log (|t| + 2) := by ++ have hδ_cond : 0 < δ ∧ δ < 1 := ⟨hδpos, hδ1⟩ ++ exact hZ2 t ht δ hδ_cond ++ ++ have hlog_ge_one : 1 ≤ Real.log (|t| + 2) := by ++ have h1 : 2 < |t| := ht ++ have h2 : Real.exp 1 < 3 := lem_three_gt_e ++ have he_lt_t2 : Real.exp 1 < |t| + 2 := by linarith ++ have ht2_pos : 0 < |t| + 2 := by linarith [abs_nonneg t] ++ exact Real.le_log_iff_exp_le ht2_pos |>.mpr (le_of_lt he_lt_t2) ++ ++ calc ++ 3 * (-logDerivZeta ((1 : ℂ) + δ)).re + 4 * (-logDerivZeta ((1 : ℂ) + δ + t * Complex.I)).re + (-logDerivZeta ((1 : ℂ) + δ + (2 * t) * Complex.I)).re ++ ≤ 3 * (C0 + (1 / δ)) + 4 * (-(1 / (1 + δ - σ)) + C1 * Real.log (|t| + 2)) + C2 * Real.log (|t| + 2) := by ++ exact add_le_add (add_le_add (mul_le_mul_of_nonneg_left hZ0_bound (by norm_num)) (mul_le_mul_of_nonneg_left hZ1_bound (by norm_num))) hZ2_bound ++ _ = 3 * C0 + 3 / δ - 4 / (1 + δ - σ) + (4 * C1 + C2) * Real.log (|t| + 2) := by ring ++ _ = 3 / δ - 4 / (1 + δ - σ) + 3 * C0 + (4 * C1 + C2) * Real.log (|t| + 2) := by ring ++ _ = 3 / δ - 4 / (1 + δ - σ) + ((4 * C1 + C2) * Real.log (|t| + 2) + 3 * C0) := by ring ++ _ ≤ 3 / δ - 4 / (1 + δ - σ) + (4 * C1 + C2 + 3 * C0) * Real.log (|t| + 2) := by ++ ++ have hC0_pos : 0 < C0 := lt_trans zero_lt_one hC0pos ++ have hC0_nonneg : 0 ≤ 3 * C0 := mul_nonneg (by norm_num) (le_of_lt hC0_pos) ++ have h_absorb := absorb_pos_constant_into_log (L := Real.log (|t| + 2)) (A := 4 * C1 + C2) (c := 3 * C0) hlog_ge_one hC0_nonneg ++ ++ exact add_le_add_right h_absorb (3 / δ - 4 / (1 + δ - σ)) ++ _ = 3 / δ - 4 / (1 + δ - σ) + (3 * C0 + 4 * C1 + C2) * Real.log (|t| + 2) := by ring ++ _ = 3 / δ - 4 / (1 + δ - σ) + C * Real.log (|t| + 2) := by ring ++ ++def ZeroAt (σ t : ℝ) : Prop := ++ (σ + t * I) ∈ zeroZ ++ ++def Ft (σ : ℝ) : Filter ℝ := ++ (Filter.atTop ⊔ Filter.atBot) ⊓ Filter.principal {t : ℝ | ZeroAt σ t} ++ ++def Fδ : Filter ℝ := nhdsWithin 0 (Set.Ioi 0) ++ ++lemma Rezeta1zetaseries1 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ (-logDerivZeta ((1 : ℂ) + delta + t * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) := by ++ ++ have h1 : 1 < 1 + delta := by linarith [hdelta] ++ convert Rezeta1zetaseries (1 + delta) t h1 ++ ++ simp [Complex.ofReal_add] ++ ++lemma Rezeta1zetaseries2 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ)) := by ++ ++ have h1 : 1 < 1 + delta := by linarith [hdelta] ++ ++ have h2 : (1 : ℂ) + delta + (2 * t) * I = (1 + delta : ℝ) + ((2 * t) : ℝ) * I := by ++ simp [Complex.ofReal_add, Complex.ofReal_one, Complex.ofReal_mul] ++ rw [h2] ++ exact Rezeta1zetaseries (1 + delta) (2 * t) h1 ++ ++lemma Rezeta1zetaseries0 (delta : ℝ) (hdelta : delta > 0) : ++ (-logDerivZeta ((1 : ℂ) + delta)).re = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) := by ++ ++ have h_series : (-logDerivZeta ((1 : ℂ) + delta + 0 * I)).re = ++ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (0 * Real.log (n : ℝ)) := ++ Rezeta1zetaseries1 0 delta hdelta ++ ++ have h_lhs : (-logDerivZeta ((1 : ℂ) + delta + 0 * I)).re = (-logDerivZeta ((1 : ℂ) + delta)).re := by ++ congr 2 ++ simp ++ ++ have h_rhs : ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (0 * Real.log (n : ℝ)) = ++ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) := by ++ congr 1 ++ funext n ++ by_cases h : n = 0 ++ · simp [h] ++ · have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h ++ rw [lem_cost0 n hn 0 rfl, mul_one] ++ ++ rw [← h_lhs, h_series, h_rhs] ++ ++lemma Z341series (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ (3 * (-logDerivZeta ((1 : ℂ) + delta)).re + ++ 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + ++ (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re) ++ = ++ (3 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + ++ 4 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + ++ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := by ++ rw [Rezeta1zetaseries0 delta hdelta, Rezeta1zetaseries1 t delta hdelta, Rezeta1zetaseries2 t delta hdelta] ++ ++lemma lem341seriesConv (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ Summable (fun n : ℕ => ++ 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + ++ 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + ++ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := by ++ ++ have h1 : 1 < 1 + delta := by linarith [hdelta] ++ ++ have h2 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := ++ Rezetaseries0 (1 + delta) h1 ++ ++ have h3 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := ++ Rezetaseries_convergence (1 + delta) t h1 ++ ++ have h4 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := ++ Rezetaseries2t (1 + delta) t h1 ++ ++ have h5 : Summable (fun n : ℕ => 3 * ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)))) := ++ Summable.mul_left 3 h2 ++ ++ have h6 : Summable (fun n : ℕ => 4 * ((ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)))) := ++ Summable.mul_left 4 h3 ++ ++ have h5' : Summable (fun n : ℕ => 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := by ++ convert h5 using 1 ++ ext n ++ ring ++ ++ have h6' : Summable (fun n : ℕ => 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := by ++ convert h6 using 1 ++ ext n ++ ring ++ ++ have h7 : Summable (fun n : ℕ => ++ 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + ++ 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := ++ h5'.add h6' ++ ++ exact h7.add h4 ++ ++lemma lem341series (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ (3 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) ++ + (4 * ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) ++ + (∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) ++ = ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by ++ ++ have h1 : 1 < 1 + delta := by linarith [hdelta] ++ ++ have h2 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta))) := ++ Rezetaseries0 (1 + delta) h1 ++ ++ have h3 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ))) := ++ Rezetaseries_convergence (1 + delta) t h1 ++ ++ have h4 : Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := ++ Rezetaseries2t (1 + delta) t h1 ++ ++ rw [← Summable.tsum_mul_left 3 h2] ++ rw [← Summable.tsum_mul_left 4 h3] ++ ++ rw [← Summable.tsum_add (Summable.mul_left 3 h2) (Summable.mul_left 4 h3)] ++ rw [← Summable.tsum_add] ++ ++ congr 1 ++ ext n ++ ring ++ ++ · exact Summable.add (Summable.mul_left 3 h2) (Summable.mul_left 4 h3) ++ · exact h4 ++ ++lemma lem_341seriesConverge (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ Summable (fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ)))) := by ++ ++ have h1 : Summable (fun n : ℕ => ++ 3 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) + ++ 4 * (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (t * Real.log (n : ℝ)) + ++ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * Real.cos (2 * t * Real.log (n : ℝ))) := ++ lem341seriesConv t delta hdelta ++ ++ convert h1 using 1 ++ ext n ++ ring ++ ++lemma lem_341series2 (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ (3 * (-logDerivZeta ((1 : ℂ) + delta)).re + ++ 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + ++ (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re) ++ = ++ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by ++ rw [Z341series t delta hdelta] ++ exact lem341series t delta hdelta ++ ++lemma lem_Lambda_pos_trig_sum (n : ℕ) (delta : ℝ) (t : ℝ) (hn : n ≥ 1) (hdelta : delta > 0) : ++ 0 ≤ (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by ++ apply mul_nonneg ++ · ++ apply lem_realnx n (1 + delta) hn ++ ++ linarith [hdelta] ++ · ++ exact lem_postriglogn n hn t ++ ++lemma seriesPos {f : ℕ → ℝ} (_h_summable : Summable (fun n => if 1 ≤ n then f n else 0)) (h_nonneg : ∀ n : ℕ, 1 ≤ n → 0 ≤ f n) : 0 ≤ ∑' (n : ℕ), (if 1 ≤ n then f n else 0) := by ++ apply tsum_nonneg ++ intro n ++ by_cases h : 1 ≤ n ++ · simp [h] ++ exact h_nonneg n h ++ · simp [h] ++ ++lemma lem_seriespos (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ 0 ≤ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n : ℝ) * (n : ℝ) ^ (-(1 + delta)) * (3 + 4 * Real.cos (t * Real.log (n : ℝ)) + Real.cos (2 * t * Real.log (n : ℝ))) := by ++ apply tsum_nonneg ++ intro n ++ by_cases h : n = 0 ++ · ++ simp [h] ++ · ++ have hn : n ≥ 1 := Nat.one_le_iff_ne_zero.mpr h ++ exact lem_Lambda_pos_trig_sum n delta t hn hdelta ++ ++lemma Z341pos (t : ℝ) (delta : ℝ) (hdelta : delta > 0) : ++ 0 ≤ 3 * (-logDerivZeta ((1 : ℂ) + delta)).re + ++ 4 * (-logDerivZeta ((1 : ℂ) + delta + t * I)).re + ++ (-logDerivZeta ((1 : ℂ) + delta + (2 * t) * I)).re := by ++ rw [lem_341series2 t delta hdelta] ++ exact lem_seriespos t delta hdelta ++ ++lemma frac_den_increase_bound {a b c : ℝ} (hpos : 0 < a + b) (hc : 0 ≤ c) : ++ 4 / (a + b + c) ≤ 4 / (a + b) := by ++ ++ have hle : a + b ≤ a + b + c := by linarith ++ ++ have h1 : 1 / (a + b + c) ≤ 1 / (a + b) := by ++ exact one_div_le_one_div_of_le hpos hle ++ ++ have h4nonneg : 0 ≤ (4 : ℝ) := by norm_num ++ have hmul := mul_le_mul_of_nonneg_left h1 h4nonneg ++ ++ have hmul' : 4 * (a + b + c)⁻¹ ≤ 4 * (a + b)⁻¹ := by ++ simpa [one_div] using hmul ++ simpa [div_eq_mul_inv] using hmul' ++ ++lemma log_abs_add_two_pos (t : ℝ) : 0 < Real.log (abs t + 2) := by ++ ++ have h0 : 0 ≤ abs t + 2 := by ++ have h' : 0 ≤ abs t := abs_nonneg t ++ linarith ++ have hge : (2 : ℝ) ≤ abs t + 2 := by ++ have h' : 0 ≤ abs t := abs_nonneg t ++ have := add_le_add_left h' (2 : ℝ) ++ simp ++ have hgt : 1 < abs t + 2 := lt_of_lt_of_le (by norm_num : (1 : ℝ) < 2) hge ++ ++ exact (Real.log_pos_iff h0).2 hgt ++ ++lemma log_gt_of_gt_exp {x y : ℝ} (h : Real.exp y < x) : y < Real.log x := by ++ have hxpos : 0 < x := lt_trans (Real.exp_pos y) h ++ exact (Real.lt_log_iff_exp_lt hxpos).2 h ++ ++lemma denom_rewrite (σ C L : ℝ) : 1 - σ + (1 / (2 * C * L)) = 1 + (1 / (2 * C * L)) - σ := by ++ ring ++ ++lemma pos_delta_from_C_L {C L : ℝ} (hC : 0 < C) (hL : 0 < L) : 0 < 1 / (2 * C * L) := by ++ have hCL : 0 < C * L := mul_pos hC hL ++ have h2 : 0 < (2 : ℝ) := by norm_num ++ have hpos : 0 < 2 * C * L := by ++ have : 0 < 2 * (C * L) := mul_pos h2 hCL ++ simpa [mul_assoc] using this ++ exact one_div_pos.mpr hpos ++ ++lemma add_two_pos_of_abs (t : ℝ) : 0 < |t| + 2 := by ++ have : 0 ≤ |t| := abs_nonneg t ++ linarith ++ ++lemma log_abs_two_pos (t : ℝ) : 0 < Real.log (|t| + 2) := by ++ simpa using log_abs_add_two_pos t ++ ++lemma two_C_log_pos {C t : ℝ} (hC : 0 < C) : 0 < 2 * C * Real.log (|t| + 2) := by ++ have hL : 0 < Real.log (|t| + 2) := log_abs_two_pos t ++ have h2 : 0 < (2 : ℝ) := by norm_num ++ have hCL : 0 < C * Real.log (|t| + 2) := mul_pos hC hL ++ have : 0 < 2 * (C * Real.log (|t| + 2)) := mul_pos h2 hCL ++ simpa [mul_comm, mul_left_comm, mul_assoc] using this ++ ++lemma mul_one_div_self_of_pos {a : ℝ} (ha : 0 < a) : a * (1 / a) = 1 := by ++ have hne : a ≠ 0 := ne_of_gt ha ++ simp [one_div, hne] ++ ++lemma mul_one_div_mul_right {A b : ℝ} (hA : A ≠ 0) : A * (1 / (A * b)) = 1 / b := by ++ calc ++ A * (1 / (A * b)) = A * ((A * b)⁻¹) := by simp [one_div] ++ _ = A / (A * b) := by simp [div_eq_mul_inv] ++ _ = A / A / b := by ++ simpa using (div_mul_eq_div_div (a := A) (b := A) (c := b)) ++ _ = 1 / b := by ++ have : A / A = (1 : ℝ) := by simp [hA] ++ simp [this] ++ ++lemma one_div_mul_one_div_mul_right {A b : ℝ} (hA : A ≠ 0) (_hb : b ≠ 0) : 1 / (A * (1 / (A * b))) = b := by ++ have h := mul_one_div_mul_right (A := A) (b := b) hA ++ have hinv := congrArg (fun x : ℝ => x⁻¹) h ++ calc ++ 1 / (A * (1 / (A * b))) = (A * (1 / (A * b)))⁻¹ := by simp [one_div] ++ _ = (1 / b)⁻¹ := by simpa using hinv ++ _ = b := by simp [one_div] ++ ++lemma inv_of_delta_def (C L δ : ℝ) (hδ : δ = 1 / (2 * C * L)) : 1 / δ = 2 * C * L := by ++ simp [hδ, one_div] ++ ++lemma rhs_eval_of_inv (C L δ : ℝ) (h : 1 / δ = 2 * C * L) : 3 / δ + C * L = 7 * C * L := by ++ calc ++ 3 / δ + C * L ++ = 3 * (1 / δ) + C * L := by simp [div_eq_mul_inv] ++ _ = 3 * (2 * C * L) + C * L := by simp [h] ++ _ = 6 * C * L + C * L := by ring ++ _ = 7 * C * L := by ring ++ ++lemma lem341tsC : ++ ∃ C > 1, ∀ s : ℂ, ++ (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → ++ 2 < |s.im| → ++ 4 / (1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2))) ≤ 7 * C * Real.log (abs s.im + 2) := by ++ ++ obtain ⟨C, hCpos, hbound⟩ := Z341bounds_const ++ refine ⟨C, hCpos, ?_⟩ ++ intro s hs hTim ++ ++ let L : ℝ := Real.log (|s.im| + 2) ++ have hLpos : 0 < L := log_abs_two_pos (s.im) ++ let δ : ℝ := 1 / (2 * C * L) ++ ++ have hCpos_weak : 0 < C := lt_trans zero_lt_one hCpos ++ have hδpos : 0 < δ := pos_delta_from_C_L hCpos_weak hLpos ++ ++ have hδlt : δ < 1 := by ++ ++ have hL_gt_1 : 1 < L := by ++ have h5_lt : 4 < |s.im| + 2 := by linarith [hTim] ++ have hL_gt_log5 : Real.log 4 < L := Real.log_lt_log (by norm_num) h5_lt ++ have hlog5_gt_1 : 1 < Real.log 4 := by ++ have h5_gt_e : Real.exp 1 < 4 := by ++ have h3_gt_e := lem_three_gt_e ++ linarith [h3_gt_e] ++ rw [← Real.log_exp 1] ++ exact Real.log_lt_log (Real.exp_pos 1) h5_gt_e ++ linarith [hlog5_gt_1, hL_gt_log5] ++ ++ have h2CL_gt_1 : 1 < 2 * C * L := by ++ ++ have hCL_gt_1 : 1 < C * L := by ++ calc C * L ++ > 1 * L := by exact mul_lt_mul_of_pos_right hCpos hLpos ++ _ = L := by simp ++ _ > 1 := hL_gt_1 ++ have h2_pos : (0 : ℝ) < 2 := by norm_num ++ calc 2 * C * L ++ = 2 * (C * L) := by ring ++ _ > 2 * 1 := by exact mul_lt_mul_of_pos_left hCL_gt_1 h2_pos ++ _ = 2 := by simp ++ _ > 1 := by norm_num ++ ++ simp only [δ] ++ rw [div_lt_one_iff] ++ left ++ exact ⟨two_C_log_pos hCpos_weak, h2CL_gt_1⟩ ++ ++ have hmem : (s.re + s.im * Complex.I) ∈ zeroZ := by ++ simpa [Complex.re_add_im] using hs.1 ++ have hupper := hbound δ hδpos hδlt (s.im) hTim (s.re) hmem ++ ++ have hpos := Z341pos (s.im) δ hδpos ++ ++ have hRHS_nonneg : 0 ≤ 3 / δ - 4 / (1 + δ - s.re) + C * L := le_trans hpos hupper ++ have hineq1 : 4 / (1 + δ - s.re) ≤ 3 / δ + C * L := by linarith [hRHS_nonneg] ++ ++ have hineq2 : 4 / (1 - s.re + δ) ≤ 3 / δ + C * L := by ++ convert hineq1 using 2 ++ ring ++ ++ have hinv : 1 / δ = 2 * C * L := by ++ simp only [δ, one_div, inv_inv] ++ ++ have hrhs_eval : 3 / δ + C * L = 7 * C * L := rhs_eval_of_inv C L δ hinv ++ ++ have hfinal : 4 / (1 - s.re + δ) ≤ 7 * C * L := by ++ rw [← hrhs_eval] ++ exact hineq2 ++ ++ convert hfinal ++ ++lemma zeta_zero_re_lt_one (s : ℂ) (hs : s ∈ zeroZ) : s.re < 1 := by ++ ++ by_contra h ++ ++ push Not at h ++ ++ have h_zero : riemannZeta s = 0 := hs ++ ++ have h_nonzero : riemannZeta s ≠ 0 := riemannZeta_ne_zero_of_one_le_re h ++ ++ exact h_nonzero h_zero ++ ++lemma div_le_to_le_mul (x y z : ℝ) (hy : 0 < y) (h : x / y ≤ z) : x ≤ z * y := by ++ rwa [div_le_iff₀ hy] at h ++ ++lemma le_mul_to_le_div (x y z : ℝ) (hy : 0 < y) (h : x ≤ z * y) : x / y ≤ z := by ++ rw [div_le_iff₀ hy] ++ exact h ++ ++lemma reciprocal_div_inequality (a b : ℝ) (ha : 0 < a) (hb : 0 < b) (h : 4 / a ≤ b) : a ≥ 4 / b := by ++ ++ have h1 : 4 ≤ b * a := div_le_to_le_mul 4 a b ha h ++ ++ have h2 : 4 ≤ a * b := by ++ rwa [mul_comm] at h1 ++ ++ have h3 : 4 / b ≤ a := le_mul_to_le_div 4 b a hb h2 ++ ++ exact h3 ++ ++lemma lem341tsC2 : ++ ∃ C > 1, ∀ s : ℂ, ++ (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → ++ 2 < |s.im| → ++ 1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2)) ≥ 4 / (7 * C * Real.log (abs s.im + 2)) := by ++ ++ rcases lem341tsC with ⟨C, hCpos, hT⟩ ++ refine ⟨C, hCpos, ?_⟩ ++ intro s hs hTs ++ ++ set a := 1 - s.re + 1 / (2 * C * Real.log (abs s.im + 2)) with ha ++ set b := 7 * C * Real.log (abs s.im + 2) with hb ++ have hineq : 4 / a ≤ b := by ++ simpa [ha, hb] using hT s hs hTs ++ ++ have h_abs_nonneg : 0 ≤ |s.im| := abs_nonneg _ ++ have h_two_le : (2 : ℝ) ≤ |s.im| + 2 := by ++ have h' : (2 : ℝ) + 0 ≤ 2 + |s.im| := add_le_add_right h_abs_nonneg 2 ++ simp ++ have h_one_lt : (1 : ℝ) < |s.im| + 2 := lt_of_lt_of_le one_lt_two h_two_le ++ have hx0 : 0 ≤ |s.im| + 2 := by linarith [h_abs_nonneg] ++ have hlogpos : 0 < Real.log (|s.im| + 2) := (Real.log_pos_iff hx0).2 h_one_lt ++ have h7pos : 0 < (7 : ℝ) := by exact_mod_cast (by decide : (0 : ℕ) < 7) ++ have hbpos : 0 < b := by ++ have h7Cpos : 0 < 7 * C := by linarith ++ exact mul_pos h7Cpos hlogpos ++ ++ rcases hs with ⟨_, hRepos, hRelt⟩ ++ have h1 : 0 < 1 - s.re := sub_pos.mpr hRelt ++ have h2pos : 0 < (2 : ℝ) := lt_trans zero_lt_one one_lt_two ++ have h2Cpos : 0 < (2 : ℝ) * C := by linarith ++ have hdenpos : 0 < 2 * C * Real.log (|s.im| + 2) := mul_pos h2Cpos hlogpos ++ have hinvpos : 0 < 1 / (2 * C * Real.log (|s.im| + 2)) := one_div_pos.mpr hdenpos ++ have hapos : 0 < a := by ++ have := add_pos h1 hinvpos ++ simpa [ha] using this ++ ++ have hres := reciprocal_div_inequality a b hapos hbpos hineq ++ simpa [ha, hb] using hres ++ ++lemma simplify_4_7_2 (C L : ℝ) : 4 / (7 * C * L) - 1 / (2 * C * L) = 1 / (14 * C * L) := by ++ ++ have h1 : (4 : ℝ) / (7 * (C * L)) = (4 : ℝ) / (7 : ℝ) / (C * L) := by ++ simpa using (div_mul_eq_div_div (a := (4 : ℝ)) (b := (7 : ℝ)) (c := C * L)) ++ have h2 : (1 : ℝ) / (2 * (C * L)) = (1 : ℝ) / (2 : ℝ) / (C * L) := by ++ simpa using (div_mul_eq_div_div (a := (1 : ℝ)) (b := (2 : ℝ)) (c := C * L)) ++ ++ have h3' : ((4 : ℝ) / (7 : ℝ)) - (2 : ℝ)⁻¹ = (14 : ℝ)⁻¹ := by ++ have h3 : ((4 : ℝ) / (7 : ℝ)) - ((1 : ℝ) / (2 : ℝ)) = (1 : ℝ) / (14 : ℝ) := by ++ norm_num ++ simpa [one_div] using h3 ++ calc ++ 4 / (7 * C * L) - 1 / (2 * C * L) ++ = (4 : ℝ) / (7 * (C * L)) - (1 : ℝ) / (2 * (C * L)) := by ++ simp [mul_assoc] ++ _ = (4 : ℝ) / (7 : ℝ) / (C * L) - (1 : ℝ) / (2 : ℝ) / (C * L) := by ++ simp [h1, h2] ++ _ = (((4 : ℝ) / (7 : ℝ)) - ((1 : ℝ) / (2 : ℝ))) / (C * L) := by ++ simpa using (sub_div (a := ((4 : ℝ) / (7 : ℝ))) (b := ((1 : ℝ) / (2 : ℝ))) (c := C * L)).symm ++ _ = (((4 : ℝ) / (7 : ℝ)) - (2 : ℝ)⁻¹) / (C * L) := by ++ simp [one_div] ++ _ = (14 : ℝ)⁻¹ / (C * L) := by ++ simp [h3'] ++ _ = 1 / (14 * (C * L)) := by ++ simpa [mul_comm, mul_left_comm, mul_assoc, one_div] using ++ (div_mul_eq_div_div (a := (1 : ℝ)) (b := (14 : ℝ)) (c := C * L)).symm ++ _ = 1 / (14 * C * L) := by simp [mul_assoc] ++ ++lemma fraction_diff_lower_bound (C L a : ℝ) : 4 / (7 * C * L) ≤ a + 1 / (2 * C * L) → 1 / (14 * C * L) ≤ a := by ++ intro h ++ have h' : 4 / (7 * C * L) - 1 / (2 * C * L) ≤ a := (sub_le_iff_le_add).mpr h ++ have hdiff : 1 / (14 * C * L) = 4 / (7 * C * L) - 1 / (2 * C * L) := by ++ symm ++ exact simplify_4_7_2 C L ++ calc ++ 1 / (14 * C * L) ++ = 4 / (7 * C * L) - 1 / (2 * C * L) := hdiff ++ _ ≤ a := h' ++ ++lemma lem341tsC3 : ++ ∃ C > 1, ∀ s : ℂ, ++ (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → ++ 2 < |s.im| → ++ 1 - s.re ≥ 1 / (14 * C * Real.log (abs s.im + 2)) := by ++ obtain ⟨C, hCpos, hT⟩ := lem341tsC2 ++ refine ⟨C, hCpos, ?_⟩ ++ intro s hs hTle ++ have h := hT s hs hTle ++ ++ have h' : 4 / (7 * C * Real.log (abs s.im + 2)) ≤ ++ (1 - s.re) + 1 / (2 * C * Real.log (abs s.im + 2)) := by ++ simpa [ge_iff_le, add_comm, add_left_comm, add_assoc] using h ++ ++ have h'' := fraction_diff_lower_bound C (Real.log (abs s.im + 2)) (1 - s.re) h' ++ ++ simpa [ge_iff_le, mul_comm, mul_left_comm, mul_assoc] using h'' ++ ++lemma zerofree : ++ ∃ c, c > 0 ∧ c < 1 ∧ ∀ s : ℂ, ++ (s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1) → ++ 2 < |s.im| → s.re ≤ 1 - c / (Real.log (abs s.im + 2)) := by ++ ++ rcases lem341tsC3 with ⟨C0, hC0pos, hT⟩ ++ ++ set C : ℝ := 1 / (14 * C0) with hCdef ++ ++ have h14pos : 0 < (14 : ℝ) := by norm_num ++ have hC0pos' : 0 < C0 := lt_trans zero_lt_one hC0pos ++ have hCpos : 0 < C := by ++ have hdenpos : 0 < 14 * C0 := mul_pos h14pos hC0pos' ++ exact one_div_pos.mpr hdenpos ++ ++ have hClt1 : C < 1 := by ++ have h14C0_pos : 0 < 14 * C0 := mul_pos h14pos hC0pos' ++ have h14C0_gt_1 : 1 < 14 * C0 := by ++ have h14_gt_1 : (1 : ℝ) < 14 := by norm_num ++ calc ++ (1 : ℝ) = 1 * 1 := by ring ++ _ < 14 * 1 := by exact mul_lt_mul_of_pos_right h14_gt_1 zero_lt_one ++ _ < 14 * C0 := by exact mul_lt_mul_of_pos_left hC0pos h14pos ++ rw [hCdef] ++ rw [div_lt_one_iff] ++ left ++ exact ⟨h14C0_pos, h14C0_gt_1⟩ ++ ++ refine ⟨C, hCpos, hClt1, ?_⟩ ++ intro s hs hTle ++ ++ set L := Real.log (abs s.im + 2) with hLdef ++ ++ have hb0 := hT s hs hTle ++ ++ have hb' : C / L ≤ 1 - s.re := by ++ simpa [hLdef, hCdef, one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hb0 ++ ++ have : s.re ≤ 1 - C / L := by linarith ++ simpa [hLdef] using this ++ ++def Yt (t : ℝ) (δ : ℝ) : Set ℂ := ++ { ρ_1 : ℂ | riemannZeta ρ_1 = 0 ∧ ‖ρ_1 - (1 - δ + t * Complex.I)‖ ≤ 2 * δ } ++ ++noncomputable def zerofree_constant : ℝ := Classical.choose zerofree ++ ++lemma zerofree_constant_pos : 0 < zerofree_constant := ++ (Classical.choose_spec zerofree).1 ++ ++lemma zerofree_constant_lt_one : zerofree_constant < 1 := ++ (Classical.choose_spec zerofree).2.1 ++ ++noncomputable def deltaz (z : ℂ) : ℝ := (zerofree_constant / 20) / Real.log (|z.im| + 2) ++ ++noncomputable def deltaz_t (t : ℝ) : ℝ := deltaz (t * Complex.I) ++ ++lemma lem_delta19 : ++ (∀ z : ℂ, |z.im| > 2 → (0 < deltaz z ∧ deltaz z < 1/9)) ∧ ++ (∀ t : ℝ, |t| > 2 → (0 < deltaz_t t ∧ deltaz_t t < 1/9)) := by ++ ++ have h_complex : ∀ z : ℂ, |z.im| > 2 → (0 < deltaz z ∧ deltaz z < 1/9) := by ++ intro z hz ++ constructor ++ · ++ have h_num_pos : 0 < zerofree_constant / 20 := by ++ exact div_pos zerofree_constant_pos (by norm_num) ++ have h_den_pos : 0 < Real.log (|z.im| + 2) := by ++ have h_gt_one : (1 : ℝ) < |z.im| + 2 := by ++ have h_nonneg : (0 : ℝ) ≤ |z.im| := abs_nonneg _ ++ linarith [hz] ++ exact Real.log_pos h_gt_one ++ unfold deltaz ++ exact div_pos h_num_pos h_den_pos ++ · ++ ++ have h_den_ge_half : (1/2 : ℝ) ≤ Real.log (|z.im| + 2) := by ++ ++ have h_den_ge_log2 : Real.log 2 ≤ Real.log (|z.im| + 2) := by ++ have h_pos : 0 < |z.im| + 2 := by linarith [abs_nonneg (z.im)] ++ have h_le : (2 : ℝ) ≤ |z.im| + 2 := by linarith [abs_nonneg (z.im)] ++ exact Real.log_le_log (by norm_num) h_le ++ ++ have h_log2_ge_half : (1/2 : ℝ) ≤ Real.log 2 := by ++ have h_exp_half_le_two : Real.exp (1/2) ≤ 2 := by ++ ++ have h_exp_one_lt_three : Real.exp 1 < 3 := lem_three_gt_e ++ have h_exp_sq : (Real.exp (1/2))^2 = Real.exp 1 := by ++ rw [pow_two, ← Real.exp_add]; norm_num ++ have h_exp_sq_lt_four : (Real.exp (1/2))^2 < 4 := by ++ rw [h_exp_sq]; linarith [h_exp_one_lt_three] ++ ++ have h_exp_pos : 0 ≤ Real.exp (1/2) := le_of_lt (Real.exp_pos _) ++ have h_two_pos : 0 ≤ (2 : ℝ) := by norm_num ++ have h_four_eq : (2 : ℝ)^2 = 4 := by norm_num ++ rw [← h_four_eq] at h_exp_sq_lt_four ++ have h_lt_abs := (sq_lt_sq).mp h_exp_sq_lt_four ++ rw [abs_of_nonneg h_exp_pos, abs_of_nonneg h_two_pos] at h_lt_abs ++ exact le_of_lt h_lt_abs ++ exact (Real.le_log_iff_exp_le (by norm_num : 0 < (2 : ℝ))).mpr h_exp_half_le_two ++ exact le_trans h_log2_ge_half h_den_ge_log2 ++ ++ have h_inv_le_two : 1 / Real.log (|z.im| + 2) ≤ 2 := by ++ have h_pos_half : 0 < (1/2 : ℝ) := by norm_num ++ have h_ineq := one_div_le_one_div_of_le h_pos_half h_den_ge_half ++ convert h_ineq using 1; first | rfl | norm_num ++ ++ have h_bound : deltaz z ≤ zerofree_constant / 10 := by ++ unfold deltaz ++ ++ rw [div_eq_mul_inv] ++ ++ have h_num_nonneg : 0 ≤ zerofree_constant / 20 := by ++ exact le_of_lt (div_pos zerofree_constant_pos (by norm_num)) ++ have h_mul_ineq := mul_le_mul_of_nonneg_left h_inv_le_two h_num_nonneg ++ convert h_mul_ineq using 1 <;> first | rfl | ring ++ ++ have h_lt_tenth : zerofree_constant / 10 < 1 / 10 := by ++ exact div_lt_div_of_pos_right zerofree_constant_lt_one (by norm_num) ++ have h_tenth_lt_ninth : (1 : ℝ) / 10 < 1 / 9 := by norm_num ++ exact lt_trans (lt_of_le_of_lt h_bound h_lt_tenth) h_tenth_lt_ninth ++ ++ constructor ++ · exact h_complex ++ · ++ intro t ht ++ ++ have h_eq : deltaz_t t = deltaz (t * Complex.I) := rfl ++ rw [h_eq] ++ have h_im_eq : |(t * Complex.I).im| = |t| := by simp ++ rw [← h_im_eq] at ht ++ exact h_complex (t * Complex.I) ht ++ ++lemma closedBall_compact_complex (c : ℂ) (r : ℝ) : ++ IsCompact (Metric.closedBall c r) := by ++ ++ exact ProperSpace.isCompact_closedBall c r ++ ++lemma riemannZeta_no_zeros_accumulate_at_one : ++ ∀ Z : Set ℂ, (∀ z ∈ Z, riemannZeta z = 0) → ¬AccPt 1 (Filter.principal Z) := by ++ intro Z hZ ++ ++ by_contra h_acc ++ ++ have h_residue := riemannZeta_residue_one ++ ++ rw [Metric.tendsto_nhdsWithin_nhds] at h_residue ++ obtain ⟨δ, hδ_pos, hδ_bound⟩ := h_residue (1/2) (by norm_num : (0 : ℝ) < 1/2) ++ ++ rw [accPt_iff_nhds] at h_acc ++ ++ obtain ⟨y, ⟨hy_ball, hy_Z⟩, hy_ne⟩ := h_acc (Metric.ball 1 δ) (Metric.ball_mem_nhds 1 hδ_pos) ++ ++ have hy_zero : riemannZeta y = 0 := hZ y hy_Z ++ ++ have hy_in_compl : y ∈ ({1} : Set ℂ)ᶜ := by ++ rw [Set.mem_compl_iff, Set.mem_singleton_iff] ++ exact hy_ne ++ ++ have hy_dist : dist y 1 < δ := hy_ball ++ ++ have h_bound := hδ_bound hy_in_compl hy_dist ++ ++ rw [hy_zero, mul_zero] at h_bound ++ ++ have h_dist_eq : dist (0 : ℂ) (1 : ℂ) = 1 := by ++ rw [Complex.dist_eq] ++ norm_num ++ ++ rw [h_dist_eq] at h_bound ++ ++ norm_num at h_bound ++ ++lemma complex_minus_singleton_connected : IsPreconnected ({s : ℂ | s ≠ 1} : Set ℂ) := by ++ ++ have h_eq : {s : ℂ | s ≠ 1} = ({1} : Set ℂ)ᶜ := by ++ ext x ++ simp [Set.mem_compl_iff, Set.mem_singleton_iff] ++ ++ rw [h_eq] ++ ++ have h_rank : 1 < Module.rank ℝ ℂ := by ++ rw [Complex.rank_real_complex] ++ ++ norm_num ++ ++ have h_connected := isConnected_compl_singleton_of_one_lt_rank h_rank (1 : ℂ) ++ ++ exact h_connected.isPreconnected ++ ++lemma eventually_eq_zero_implies_frequently_eq_zero_punctured (f : ℂ → ℂ) (z₀ : ℂ) : ++ (∀ᶠ z in nhds z₀, f z = 0) → (∃ᶠ z in nhdsWithin z₀ {z₀}ᶜ, f z = 0) := by ++ intro h_eventually ++ ++ have h_nebot : Filter.NeBot (nhdsWithin z₀ {z₀}ᶜ) := by ++ ++ exact NormedField.nhdsNE_neBot z₀ ++ ++ have h_eventually_punctured : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ, f z = 0 := by ++ ++ exact Filter.Eventually.filter_mono nhdsWithin_le_nhds h_eventually ++ ++ exact h_eventually_punctured.frequently ++ ++lemma riemannZeta_zeros_finite_of_compact (K : Set ℂ) (hK : IsCompact K) : ++ {z ∈ K | riemannZeta z = 0}.Finite := by ++ ++ by_contra h_not_finite ++ push Not at h_not_finite ++ ++ let Z := {z ∈ K | riemannZeta z = 0} ++ ++ have hZ_inf : Z.Infinite := h_not_finite ++ have hZ_sub : Z ⊆ K := fun z hz => hz.1 ++ ++ obtain ⟨z₀, hz₀_K, hz₀_acc⟩ := lem_bolzano_weierstrass hK hZ_inf hZ_sub ++ ++ by_cases h_eq_one : z₀ = 1 ++ · ++ subst h_eq_one ++ ++ have hZ_zeros : ∀ z ∈ Z, riemannZeta z = 0 := fun z hz => hz.2 ++ ++ exact riemannZeta_no_zeros_accumulate_at_one Z hZ_zeros hz₀_acc ++ ++ · ++ ++ have h_analytic : AnalyticAt ℂ riemannZeta z₀ := ++ zetaanalOnnot1 z₀ h_eq_one ++ ++ obtain h_ev_zero | h_ev_ne := h_analytic.eventually_eq_zero_or_eventually_ne_zero ++ ++ · ++ ++ have h_freq := eventually_eq_zero_implies_frequently_eq_zero_punctured riemannZeta z₀ h_ev_zero ++ ++ have h_eq_on_zero := zetaanalOnnot1.eqOn_zero_of_preconnected_of_frequently_eq_zero ++ complex_minus_singleton_connected h_eq_one h_freq ++ ++ have : riemannZeta 0 = 0 := h_eq_on_zero (by simp : (0 : ℂ) ∈ {s | s ≠ 1}) ++ rw [riemannZeta_zero] at this ++ norm_num at this ++ ++ · ++ ++ unfold AccPt at hz₀_acc ++ ++ have h_ev_not_Z : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ, z ∉ Z := by ++ apply Filter.Eventually.mono h_ev_ne ++ intro z hz hz_in_Z ++ exact hz hz_in_Z.2 ++ ++ have h_ev_false : ∀ᶠ z in nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z, False := by ++ rw [Filter.eventually_inf_principal] ++ exact h_ev_not_Z ++ ++ have h_eq_bot : nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z = ⊥ := ++ Filter.eventually_false_iff_eq_bot.mp h_ev_false ++ ++ have h_ne_bot : nhdsWithin z₀ {z₀}ᶜ ⊓ Filter.principal Z ≠ ⊥ := hz₀_acc.ne ++ ++ exact h_ne_bot h_eq_bot ++ ++lemma lem_ZFRdelta : ++ ∀ z : ℂ, 2 < |z.im| → z.re > 1 - 9 * deltaz z → riemannZeta z ≠ 0 := by ++ intro z him hre ++ by_cases h1 : 1 ≤ z.re ++ · ++ simpa using riemannZeta_ne_zero_of_one_le_re h1 ++ ++ have hzlt1 : z.re < 1 := lt_of_not_ge h1 ++ ++ have hgt : |z.im| > 2 := by simpa using him ++ have hδ := (lem_delta19).1 z hgt ++ rcases hδ with ⟨hδ_pos, hδ_lt_19⟩ ++ ++ have h9δ_lt1 : 9 * deltaz z < 1 := by ++ have h := mul_lt_mul_of_pos_left hδ_lt_19 (by norm_num : 0 < (9 : ℝ)) ++ have h9 : (9 : ℝ) * (1 / 9) = 1 := by norm_num ++ simpa [h9] using h ++ have hzre_pos : 0 < z.re := by ++ have : 0 < 1 - 9 * deltaz z := sub_pos.mpr h9δ_lt1 ++ exact lt_trans this hre ++ ++ by_contra hzero ++ have hzmem : z ∈ zeroZ := by simpa [zeroZ] using hzero ++ ++ have hprop := (Classical.choose_spec zerofree).2.2 ++ have hbound : z.re ≤ 1 - zerofree_constant / Real.log (|z.im| + 2) := ++ hprop z ⟨hzmem, hzre_pos, hzlt1⟩ him ++ ++ set L : ℝ := Real.log (|z.im| + 2) with hLdef ++ have hLpos : 0 < L := by ++ have hone_lt : (1 : ℝ) < |z.im| + 2 := by ++ have : (0 : ℝ) ≤ |z.im| := abs_nonneg _ ++ linarith ++ have := Real.log_pos hone_lt ++ simpa [hLdef] using this ++ ++ have hb_le_a' : ((9 : ℝ) / 20) * (zerofree_constant / L) ≤ zerofree_constant / L := by ++ have hcoef_le1 : ((9 : ℝ) / 20) ≤ 1 := by norm_num ++ have ha_nonneg : 0 ≤ zerofree_constant / L := le_of_lt (div_pos zerofree_constant_pos hLpos) ++ have := mul_le_mul_of_nonneg_right hcoef_le1 ha_nonneg ++ simpa [one_mul] using this ++ have h9d_eq : 9 * deltaz z = ((9 : ℝ) / 20) * (zerofree_constant / L) := by ++ simp [deltaz, hLdef, div_eq_mul_inv, mul_left_comm, mul_assoc] ++ have hdelta_le : 9 * deltaz z ≤ zerofree_constant / L := by ++ simpa [h9d_eq] using hb_le_a' ++ have h_le_rhs : 1 - zerofree_constant / L ≤ 1 - 9 * deltaz z := by ++ have hneg := neg_le_neg hdelta_le ++ simpa [sub_eq_add_neg] using! add_le_add_right hneg 1 ++ ++ have hle : z.re ≤ 1 - 9 * deltaz z := le_trans hbound h_le_rhs ++ have hcontr : z.re < z.re := lt_of_le_of_lt hle hre ++ exact (lt_irrefl (z.re)) hcontr ++ ++lemma complex_re_add_I_mul_real (a t : ℝ) : (((a : ℂ) + Complex.I * t).re) = a := by ++ ++ have h1 : ((Complex.I * (t : ℂ)).re) = -((t : ℂ).im) := by ++ simp ++ have ht_im : ((t : ℂ).im) = 0 := by simp ++ simp [Complex.add_re, Complex.ofReal_re, h1] ++ ++lemma complex_im_add_I_mul_real (a t : ℝ) : (((a : ℂ) + Complex.I * t).im) = t := by ++ ++ have h1 : ((Complex.I * (t : ℂ)).im) = ((t : ℂ).re) := by ++ simp ++ have ht_re : ((t : ℂ).re) = t := by simp ++ simp [Complex.add_im, Complex.ofReal_im, h1] ++ ++lemma complex_sub_ofReal_I_real_eq_ofReal (z : ℂ) (a t : ℝ) (him : z.im = t) : ++ z - ((a : ℂ) + Complex.I * t) = ((z.re - a) : ℂ) := by ++ apply Complex.ext ++ · simp [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.ofReal_im] ++ · simp [Complex.sub_im, Complex.add_im, Complex.ofReal_im, Complex.ofReal_re, him] ++ ++lemma lem_ZFRinD (t : ℝ) (ht : |t| > 2) (z : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → ++ z ∈ Metric.closedBall c (2/3) := by ++ intro c h ++ rcases h with ⟨h_low, hrest⟩ ++ rcases hrest with ⟨h_high, him⟩ ++ have hsub : z - c = ((z.re - (3/2)) : ℂ) := by ++ simpa [c] using! complex_sub_ofReal_I_real_eq_ofReal z (3/2) t him ++ have h1 : dist z c = ‖((z.re - (3/2)) : ℂ)‖ := by ++ simp [dist_eq_norm, hsub] ++ have h2 : ‖((z.re - (3/2)) : ℂ)‖ = ‖z.re - (3/2)‖ := by ++ simpa using (Complex.norm_real (z.re - (3/2))) ++ have hdist_abs : dist z c = |z.re - (3/2)| := by ++ have h4 : dist z c = ‖z.re - (3/2)‖ := h1.trans h2 ++ simpa [Real.norm_eq_abs] using h4 ++ have hnonpos : z.re - (3/2) ≤ 0 := sub_nonpos_of_le h_high ++ have habs : |z.re - (3/2)| = 3/2 - z.re := by ++ have := abs_of_nonpos hnonpos ++ simpa [neg_sub] using this ++ have hdist_eq : dist z c = 3/2 - z.re := hdist_abs.trans habs ++ have h_le : dist z c ≤ 1/2 + deltaz_t t := by ++ calc ++ dist z c = 3/2 - z.re := hdist_eq ++ _ ≤ 3/2 - (1 - deltaz_t t) := by linarith ++ _ = 1/2 + deltaz_t t := by ring ++ have hδlt : deltaz_t t < 1/9 := (lem_delta19.2 t ht).2 ++ have h12δ_lt : (1/2 : ℝ) + deltaz_t t < (1/2 : ℝ) + 1/9 := by ++ have := add_lt_add_left hδlt (1/2 : ℝ) ++ simpa [add_comm, add_left_comm, add_assoc] using this ++ have h123_lt : (1/2 : ℝ) + 1/9 < (2/3 : ℝ) := by norm_num ++ have h_lt : (1/2 : ℝ) + deltaz_t t < (2/3 : ℝ) := lt_trans h12δ_lt h123_lt ++ have hdist_le : dist z c ≤ 2/3 := le_trans h_le (le_of_lt h_lt) ++ exact (Metric.mem_closedBall).2 hdist_le ++ ++lemma lem_ZFRnotK (t : ℝ) (ht : |t| > 2) (z : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → ++ z ∉ zerosetKfRc (5/6) c riemannZeta := by ++ intro c h ++ ++ obtain ⟨h_ge, h_le, h_im⟩ := h ++ ++ have h_delta_eq : deltaz z = deltaz_t t := by ++ rw [deltaz_t, deltaz] ++ ++ congr 1 ++ congr 1 ++ ++ rw [h_im] ++ ++ simp only [Complex.mul_I_im, Complex.ofReal_re] ++ ++ have h_ge_delta : 1 - deltaz z ≤ Complex.re z := by ++ rwa [← h_delta_eq] at h_ge ++ ++ have h_im_gt : |z.im| > 2 := by ++ rw [h_im] ++ exact ht ++ ++ have h_delta_pos : 0 < deltaz z := by ++ exact (lem_delta19.1 z h_im_gt).1 ++ ++ have h_delta_lt_9delta : deltaz z < 9 * deltaz z := by ++ linarith [h_delta_pos] ++ ++ have h_strict : Complex.re z > 1 - 9 * deltaz z := by ++ linarith [h_ge_delta, h_delta_lt_9delta] ++ ++ have h_zeta_ne_zero : riemannZeta z ≠ 0 := ++ lem_ZFRdelta z h_im_gt h_strict ++ ++ intro h_mem ++ ++ have h_zero : riemannZeta z = 0 := h_mem.2 ++ ++ exact h_zeta_ne_zero h_zero ++ ++lemma lem_Zeta_Expansion_ZFR : ++ ∃ C_1 : ℝ, C_1 > 1 ∧ ++ ∀ t : ℝ, |t| > 3 → ++ let c := (3/2 : ℂ) + I * t; ++ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), ++ ∀ z : ℂ, 1 - deltaz_t t ≤ Complex.re z ∧ Complex.re z ≤ 3/2 ∧ Complex.im z = t → ++ ‖(deriv riemannZeta z / riemannZeta z) - ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ ++ ≤ C_1 * Real.log |t| := by ++ obtain ⟨C, hC_gt_one, hC_expansion⟩ := ++ Zeta1_Zeta_Expansion (2/3) (3/4) ++ (by norm_num : (0 : ℝ) < 2/3) ++ (by norm_num : (2/3 : ℝ) < 3/4) ++ (by norm_num : (3/4 : ℝ) < 5/6) ++ let C_1 := C * (1 / ((3/4 : ℝ) - 2/3)^3 + 1) ++ have hC_1_gt_1 : C_1 > 1 := by ++ have h_coeff : (1 : ℝ) / ((3/4 : ℝ) - 2/3)^3 + 1 > 1 := by ++ have h_pos : ((3/4 : ℝ) - 2/3)^3 > 0 := by norm_num ++ have h_div_pos : (1 : ℝ) / ((3/4 : ℝ) - 2/3)^3 > 0 := div_pos one_pos h_pos ++ linarith ++ have h_ge_1 : (1 : ℝ) ≤ C := le_of_lt hC_gt_one ++ exact one_lt_mul_of_le_of_lt h_ge_1 h_coeff ++ refine ⟨C_1, hC_1_gt_1, ?_⟩ ++ intro t ht c hfin z hz ++ have ht2 : |t| > 2 := by linarith ++ have hz_in_ball : z ∈ Metric.closedBall c (2/3) := by ++ simpa [c] using (lem_ZFRinD t ht2 z hz) ++ have hz_not_in_K : z ∉ zerosetKfRc (5/6) c riemannZeta := by ++ simpa [c] using (lem_ZFRnotK t ht2 z hz) ++ have hz_in_diff : z ∈ Metric.closedBall c (2/3) \ zerosetKfRc (5/6) c riemannZeta := ++ ⟨hz_in_ball, hz_not_in_K⟩ ++ have h_expansion := hC_expansion t ht hfin z hz_in_diff ++ rw [show logDerivZeta z = deriv riemannZeta z / riemannZeta z from rfl] at h_expansion ++ exact h_expansion ++ ++lemma lem_abszrhoReRe (z ρ : ℂ) : ‖z - ρ‖ ≥ z.re - ρ.re := by ++ have h1 : (z - ρ).re ≤ ‖z - ρ‖ := Complex.re_le_norm (z - ρ) ++ have h2 : (z - ρ).re = z.re - ρ.re := Complex.sub_re z ρ ++ rw [← h2] ++ exact h1 ++ ++lemma lem_Rerhotodeltarho {ρ : ℂ} : ++ ∀ t : ℝ, |t| > 3 → ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) (3/2+ t* Complex.I) riemannZeta) → ρ.re ≤ 1 - 9 * deltaz ρ := by ++ intro t ht h_mem ++ ++ have h_zero : riemannZeta ρ = 0 := h_mem.2 ++ ++ have h_ball : ρ ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6) := h_mem.1 ++ ++ have h_dist : dist ρ (3/2 + t * Complex.I) ≤ 5/6 := by ++ rwa [Metric.mem_closedBall] at h_ball ++ ++ have h_im : 2 < |ρ.im| := by ++ ++ have h_im_bound : |ρ.im - t| ≤ 5/6 := by ++ ++ have h_le_norm : |ρ.im - t| ≤ ‖ρ - (3/2 + t * Complex.I)‖ := by ++ have : |(ρ - (3/2 + t * Complex.I)).im| ≤ ‖ρ - (3/2 + t * Complex.I)‖ := ++ Complex.abs_im_le_norm _ ++ have h_im_eq : (ρ - (3/2 + t * Complex.I)).im = ρ.im - t := by ++ simp [Complex.sub_im, Complex.add_im, Complex.ofReal_im] ++ rwa [← h_im_eq] ++ rw [← Complex.dist_eq] at h_le_norm ++ linarith [h_le_norm, h_dist] ++ ++ have triangle := abs_sub_abs_le_abs_sub t ρ.im ++ ++ have eq_comm : |t - ρ.im| = |ρ.im - t| := abs_sub_comm t ρ.im ++ rw [eq_comm] at triangle ++ ++ have h_ge : |ρ.im| ≥ |t| - |ρ.im - t| := by linarith [triangle] ++ ++ have : |ρ.im| ≥ |t| - 5/6 := by linarith [h_ge, h_im_bound] ++ have : |ρ.im| > 3 - 5/6 := by linarith [ht] ++ have h_calc : (3 : ℝ) - 5/6 = 13/6 := by norm_num ++ have h_gt2 : (13 : ℝ)/6 > 2 := by norm_num ++ rw [h_calc] at * ++ linarith [h_gt2] ++ ++ have h_not_gt : ¬(ρ.re > 1 - 9 * deltaz ρ) := by ++ intro h_gt ++ have h_ne_zero := lem_ZFRdelta ρ h_im h_gt ++ exact h_ne_zero h_zero ++ ++ exact le_of_not_gt h_not_gt ++ ++lemma lem_DImt2d : ++ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), ++ |z.im| ≤ |t| + 5/6 := by ++ intro t ht z hz ++ ++ rw [Metric.mem_closedBall] at hz ++ ++ have center_im : (3/2 + t * Complex.I).im = t := by simp [Complex.add_im, Complex.mul_im] ++ ++ have diff_im : (z - (3/2 + t * Complex.I)).im = z.im - t := by ++ rw [Complex.sub_im, center_im] ++ ++ have h1 : |z.im - t| ≤ ‖z - (3/2 + t * Complex.I)‖ := by ++ rw [← diff_im] ++ exact Complex.abs_im_le_norm _ ++ ++ have h2 : |z.im - t| ≤ 5/6 := le_trans h1 (by simpa only [dist_eq_norm] using! hz) ++ ++ have h3 : |z.im| ≤ |z.im - t| + |t| := by ++ conv_lhs => rw [show z.im = (z.im - t) + t by ring] ++ exact abs_add_le (z.im - t) t ++ linarith ++ ++lemma lem_DIMt2 : ++ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), ++ |z.im| + 2 ≤ (|t| + 2)^3 := by ++ intro t ht z hz ++ ++ have h1' := lem_DImt2d t ht z hz ++ ++ have h1a : |z.im| + 2 ≤ |t| + 17/6 := by ++ simpa [show |t| + 5/6 + 2 = |t| + 17/6 by ring] using! add_le_add_left h1' 2 ++ ++ have h17le3 : |t| + 17/6 ≤ |t| + 3 := by ++ have : (17 : ℝ) / 6 ≤ 3 := by norm_num ++ exact add_le_add_right this _ ++ ++ have h_nonneg_poly : 0 ≤ |t|^3 + 6 * |t|^2 + 11 * |t| + 5 := by ++ have h0 : 0 ≤ |t|^3 := by exact pow_nonneg (abs_nonneg _) 3 ++ have h1 : 0 ≤ 6 * |t|^2 := by ++ have : 0 ≤ (6 : ℝ) := by norm_num ++ exact mul_nonneg this (sq_nonneg _) ++ have h2 : 0 ≤ 11 * |t| := by ++ have : 0 ≤ (11 : ℝ) := by norm_num ++ exact mul_nonneg this (abs_nonneg _) ++ have h3 : 0 ≤ (5 : ℝ) := by norm_num ++ exact add_nonneg (add_nonneg (add_nonneg h0 h1) h2) h3 ++ have h_add : |t| + 3 ≤ (|t| + 3) + (|t|^3 + 6 * |t|^2 + 11 * |t| + 5) := by ++ simpa using (le_add_of_nonneg_right (a := |t| + 3) h_nonneg_poly) ++ have h_expand : (|t| + 2)^3 = (|t| + 3) + (|t|^3 + 6 * |t|^2 + 11 * |t| + 5) := by ++ ring ++ have h3 : |t| + 3 ≤ (|t| + 2)^3 := by ++ simpa [h_expand] using h_add ++ ++ exact le_trans (le_trans h1a h17le3) h3 ++ ++lemma lem_DlogImlog : ++ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), ++ Real.log (|z.im| + 2) ≤ 3 * Real.log (|t| + 2) := by ++ intro t ht z hz ++ ++ have h1 : |z.im| + 2 ≤ (|t| + 2)^3 := lem_DIMt2 t ht z hz ++ ++ have h2 : 0 < |z.im| + 2 := by ++ have : 0 ≤ |z.im| := abs_nonneg _ ++ linarith ++ ++ have hlog := Real.log_le_log h2 h1 ++ ++ simpa [Real.log_pow] using hlog ++ ++lemma lem_D1logtlog : ++ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), ++ (1 : ℝ) / Real.log (|t| + 2) ≤ 3 / Real.log (|z.im| + 2) := by ++ intro t ht z hz ++ have h1 := lem_DlogImlog t ht z hz ++ ++ have ht_pos : |t| + 2 > 1 := by linarith [abs_nonneg t] ++ have hz_pos : |z.im| + 2 > 1 := by linarith [abs_nonneg z.im] ++ have log_t_pos : Real.log (|t| + 2) > 0 := Real.log_pos ht_pos ++ have log_z_pos : Real.log (|z.im| + 2) > 0 := Real.log_pos hz_pos ++ ++ rw [div_le_div_iff₀ log_t_pos log_z_pos] ++ simp only [one_mul] ++ exact h1 ++ ++lemma lem_Ddt2dz : ++ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (3/2 + t * Complex.I) (5/6), ++ deltaz_t t ≤ 3 * deltaz z := by ++ intro t ht z hz ++ have h := lem_D1logtlog t ht z hz ++ have hpos : 0 ≤ zerofree_constant / 20 := by ++ have ha : 0 < zerofree_constant := zerofree_constant_pos ++ have h9 : 0 < (20 : ℝ) := by norm_num ++ exact div_nonneg (le_of_lt ha) (le_of_lt h9) ++ have h2 := mul_le_mul_of_nonneg_left h hpos ++ calc ++ deltaz_t t ++ = (zerofree_constant / 20) / Real.log (|t| + 2) := by ++ simp [deltaz_t, deltaz] ++ _ = (zerofree_constant / 20) * (1 / Real.log (|t| + 2)) := by simp [div_eq_mul_inv] ++ _ ≤ (zerofree_constant / 20) * (3 / Real.log (|z.im| + 2)) := h2 ++ _ = 3 * ((zerofree_constant / 20) * (1 / Real.log (|z.im| + 2))) := by ++ simp [div_eq_mul_inv, mul_left_comm, mul_assoc] ++ _ = 3 * deltaz z := by simp [deltaz, div_eq_mul_inv, mul_left_comm, mul_assoc] ++ ++lemma lem_deltarhotodeltat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → deltaz ρ ≥ (1/3) * deltaz_t t := by ++ intro c hρK ++ rcases hρK with ⟨hball, _hzero⟩ ++ have hball' : ρ ∈ Metric.closedBall ((3/2 : ℂ) + t * Complex.I) (5/6) := by ++ simpa [c, mul_comm] using! hball ++ have hmain : deltaz_t t ≤ 3 * deltaz ρ := lem_Ddt2dz t ht ρ hball' ++ have hthird_nonneg : 0 ≤ (1/3 : ℝ) := by norm_num ++ have h_mul : (1/3 : ℝ) * deltaz_t t ≤ (1/3 : ℝ) * (3 * deltaz ρ) := ++ mul_le_mul_of_nonneg_left hmain hthird_nonneg ++ have h_simplify : (1/3 : ℝ) * (3 * deltaz ρ) = deltaz ρ := by ++ ring ++ have : (1/3 : ℝ) * deltaz_t t ≤ deltaz ρ := by ++ simpa [h_simplify] using h_mul ++ simpa [mul_comm] using this ++ ++lemma lem_Rerhotodeltat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ρ.re ≤ 1 - 3 * deltaz_t t := by ++ intros c h_rho_in ++ ++ have h1 : ρ.re ≤ 1 - 9 * deltaz ρ := ++ lem_Rerhotodeltarho (ρ := ρ) t ht (by simpa [c, mul_comm] using! h_rho_in) ++ ++ have h2 : deltaz ρ ≥ (1/3) * deltaz_t t := lem_deltarhotodeltat t ht ρ h_rho_in ++ ++ have h3 : 9 * deltaz ρ ≥ 3 * deltaz_t t := by ++ calc ++ 9 * deltaz ρ ++ ≥ 9 * ((1/3) * deltaz_t t) := by ++ exact mul_le_mul_of_nonneg_left h2 (by norm_num : (0 : ℝ) ≤ 9) ++ _ = 9 * (1/3) * deltaz_t t := by ring ++ _ = 3 * deltaz_t t := by norm_num ++ ++ have h4 : 1 - 9 * deltaz ρ ≤ 1 - 3 * deltaz_t t := by ++ linarith [h3] ++ ++ exact le_trans h1 h4 ++ ++lemma lem_RezRerho (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ++ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ z.re - ρ.re ≥ 2 * deltaz_t t := by ++ intro c h_rho_mem h_z ++ ++ have h_rho_bound := lem_Rerhotodeltat t ht ρ h_rho_mem ++ ++ have h_z_lower := h_z.1 ++ ++ linarith [h_z_lower, h_rho_bound] ++ ++lemma lem_abszrhodelta (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ++ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ ‖z - ρ‖ ≥ 2 * deltaz_t t := by ++ intro c h_rho_in_K h_z_conditions ++ ++ have h1 : z.re - ρ.re ≥ 2 * deltaz_t t := (lem_RezRerho t ht z ρ) h_rho_in_K h_z_conditions ++ ++ have h2 : ‖z - ρ‖ ≥ z.re - ρ.re := lem_abszrhoReRe z ρ ++ ++ exact le_trans h1 h2 ++ ++lemma lem_abszrhodeltanot0 (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ++ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ ‖z - ρ‖ > 0 := by ++ intro c hmem hbounds ++ ++ have h1 := lem_abszrhodelta t ht z ρ hmem hbounds ++ ++ have h2 := lem_delta19.2 t (by linarith [ht] : |t| > 2) ++ have h3 : 0 < deltaz_t t := h2.1 ++ ++ have h4 : 0 < 2 * deltaz_t t := by ++ linarith [h3] ++ ++ linarith [h1, h4] ++ ++lemma lem_1abszrho (t : ℝ) (ht : |t| > 3) (z ρ : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ++ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ 1 / ‖z - ρ‖ ≤ 1 / (2 * deltaz_t t) := by ++ intro c hρ hz ++ ++ apply one_div_le_one_div_of_le ++ ++ · have h_delta_pos : 0 < deltaz_t t := by ++ have h_delta19 := lem_delta19 ++ exact (h_delta19.2 t (by linarith [ht] : |t| > 2)).1 ++ linarith [h_delta_pos] ++ ++ · exact lem_abszrhodelta t ht z ρ hρ hz ++ ++lemma lem_m_rho_zeta_nat (t : ℝ) (ht : |t| > 3) (ρ : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) → ∃ n : ℕ, (analyticOrderAt riemannZeta ρ) = n := by ++ intro c hρK ++ classical ++ ++ have ht1 : |t| > 1 := lt_trans (by norm_num) ht ++ ++ have hρ_in_ball1 : ρ ∈ Metric.closedBall c 1 := by ++ have hρ_le : dist ρ c ≤ (5 / 6 : ℝ) := by simpa [Metric.mem_closedBall] using hρK.1 ++ have : dist ρ c ≤ (1 : ℝ) := le_trans hρ_le (by norm_num) ++ simpa [Metric.mem_closedBall] using this ++ ++ have hρ_ne_one : ρ ≠ (1 : ℂ) := (D1cinTt_pre t ht1) ρ hρ_in_ball1 ++ ++ have hζ_analytic_at_ρ : AnalyticAt ℂ riemannZeta ρ := zetaanalOnnot1 ρ hρ_ne_one ++ ++ have h_not_eventually_zero : ¬ (∀ᶠ z in nhds ρ, riemannZeta z = 0) := by ++ by_contra h_ev ++ ++ have h_freq := eventually_eq_zero_implies_frequently_eq_zero_punctured riemannZeta ρ h_ev ++ ++ have h_zero_on_S := ++ zetaanalOnnot1.eqOn_zero_of_preconnected_of_frequently_eq_zero ++ complex_minus_singleton_connected hρ_ne_one h_freq ++ ++ have hc_in_ball1 : c ∈ Metric.closedBall c 1 := by ++ have : dist c c ≤ (1 : ℝ) := by simp [dist_self] ++ simp [Metric.mem_closedBall] ++ have hc_ne_one : c ≠ (1 : ℂ) := (D1cinTt_pre t ht1) c hc_in_ball1 ++ have hc_in_S : c ∈ {s : ℂ | s ≠ 1} := by simpa [Set.mem_ofPred_eq] using hc_ne_one ++ have hζc_zero : riemannZeta c = 0 := h_zero_on_S hc_in_S ++ exact (zetacnot0 t) hζc_zero ++ ++ have hfinite : analyticOrderAt riemannZeta ρ ≠ ⊤ := by ++ intro htop ++ have hiff : analyticOrderAt riemannZeta ρ = ⊤ ↔ ∀ᶠ z in nhds ρ, riemannZeta z = 0 := ++ analyticOrderAt_eq_top (f := riemannZeta) (z₀ := ρ) ++ have : ∀ᶠ z in nhds ρ, riemannZeta z = 0 := hiff.mp htop ++ exact h_not_eventually_zero this ++ ++ refine ⟨(analyticOrderAt riemannZeta ρ).toNat, ?_⟩ ++ simpa using (ENat.natCast_toNat hfinite).symm ++ ++lemma lem_finiteKzeta (t : ℝ) (_ht : |t| > 3) : ++ let c := (3/2 : ℂ) + I * t ++ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite := by ++ intro c ++ have hK : IsCompact (Metric.closedBall c (5 / (6 : ℝ))) := ++ closedBall_compact_complex c (5 / (6 : ℝ)) ++ simpa [zerosetKfRc] using ++ (riemannZeta_zeros_finite_of_compact (Metric.closedBall c (5 / (6 : ℝ))) hK) ++ ++lemma lem_triangle_ZFR (t : ℝ) (_ht : |t| > 3) (z : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), ++ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ ≤ ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) := by ++ ++ intros c hfin hz_cond ++ ++ apply le_trans (norm_sum_le _ _) ++ ++ apply Finset.sum_le_sum ++ intro ρ hρ ++ ++ rw [norm_div] ++ ++ rw [Complex.norm_natCast] ++ ++lemma lem_Zeta_Triangle_ZFR : ++ ∃ C_1 : ℝ, C_1 > 1 ∧ ++ ∀ t : ℝ, |t| > 3 → ++ let c := (3/2 : ℂ) + I * t ++ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), ++ ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ ‖deriv riemannZeta z / riemannZeta z‖ ≤ ++ ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ))‖ + ++ C_1 * Real.log |t| := by ++ obtain ⟨C1, hC1, hbound⟩ := lem_Zeta_Expansion_ZFR ++ refine ⟨C1, hC1, ?_⟩ ++ intro t ht c hfin z hz ++ ++ let S := (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (z - ρ)) ++ have hbound1 := hbound t ht hfin z hz ++ have htri : ‖deriv riemannZeta z / riemannZeta z‖ ≤ ‖(deriv riemannZeta z / riemannZeta z) - S‖ + ‖S‖ := by ++ have hn := norm_add_le ((deriv riemannZeta z / riemannZeta z) - S) S ++ have hrewrite : (deriv riemannZeta z / riemannZeta z) - S + S = (deriv riemannZeta z / riemannZeta z) := by ++ simp [sub_eq_add_neg] ++ simpa [S, hrewrite] using hn ++ have hsum := add_le_add_left hbound1 ‖S‖ ++ have : ‖deriv riemannZeta z / riemannZeta z‖ ≤ C1 * Real.log |t| + ‖S‖ := le_trans htri hsum ++ simpa [S, add_comm] using this ++ ++lemma lem_sumK1abs (t : ℝ) (ht : |t| > 3) (z : ℂ) : ++ let c := (3/2 : ℂ) + I * t ++ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), ++ 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ ++ (1 / (2 * deltaz_t t)) * (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) := by ++ intro c hfin hzcond ++ ++ have hptwise : ∀ ρ ∈ hfin.toFinset, ++ ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖ ≤ ++ (1 / (2 * deltaz_t t)) * ((analyticOrderAt riemannZeta ρ).toNat : ℝ) := by ++ intro ρ hρmem ++ have hρ_in : ρ ∈ (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta) := ++ (Set.Finite.mem_toFinset (hs := hfin)).1 hρmem ++ have hbase : 1 / ‖z - ρ‖ ≤ 1 / (2 * deltaz_t t) := ++ lem_1abszrho t ht z ρ hρ_in hzcond ++ have hnonneg : 0 ≤ ((analyticOrderAt riemannZeta ρ).toNat : ℝ) := by ++ exact_mod_cast (Nat.zero_le ((analyticOrderAt riemannZeta ρ).toNat)) ++ have := mul_le_mul_of_nonneg_left hbase hnonneg ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this ++ have hsum := Finset.sum_le_sum hptwise ++ ++ have hrw := ++ (Finset.mul_sum (s := hfin.toFinset) ++ (f := fun ρ => ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) ++ (a := (1 / (2 * deltaz_t t)))) ++ have hsum2 := hsum ++ ++ rw [← hrw] at hsum2 ++ ++ simpa [div_eq_mul_inv] using hsum2 ++ ++lemma helper_analyticOnNhd_shift_div (f : ℂ → ℂ) (c : ℂ) ++ (h : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ f z) ++ (_hc : f c ≠ 0) : ++ AnalyticOnNhd ℂ (fun z => f (z + c) / f c) (Metric.closedBall (0 : ℂ) 1) := by ++ ++ intro z hz ++ ++ have hz_norm : ‖z‖ ≤ 1 := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hz ++ ++ have hz_addc_mem : z + c ∈ Metric.closedBall c 1 := by ++ ++ have : dist (z + c) c ≤ 1 := by ++ simpa [dist_eq_norm, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hz_norm ++ simpa [Metric.mem_closedBall] using this ++ ++ have h_f_at : AnalyticAt ℂ f (z + c) := h (z + c) hz_addc_mem ++ ++ have h_addc : AnalyticAt ℂ (fun w => w + c) z := by ++ simpa using! (analyticAt_id.add analyticAt_const) ++ ++ have h_comp : AnalyticAt ℂ (fun w => f (w + c)) z := ++ (AnalyticAt.fun_comp h_f_at h_addc) ++ ++ have h_mul_const : AnalyticAt ℂ (fun w => (1 / f c) * f (w + c)) z := ++ (analyticAt_const.mul h_comp) ++ ++ simpa [div_eq_mul_inv, mul_comm] using h_mul_const ++ ++lemma helper_finite_zeros_shift (r : ℝ) (_hr : r > 0) (c : ℂ) (f : ℂ → ℂ) ++ (hc : f c ≠ 0) ++ (_h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) ++ (hfin : (zerosetKfRc r c f).Finite) : ++ (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)).Finite := ++by ++ classical ++ let g : ℂ → ℂ := fun z => f (z + c) / f c ++ have hEq : ++ zerosetKfRc r (0 : ℂ) g = (fun ρ : ℂ => ρ - c) '' zerosetKfRc r c f := by ++ apply Set.Subset.antisymm ++ · intro x hx ++ ++ have hx_ball : dist x (0 : ℂ) ≤ r := by ++ simpa [Metric.mem_closedBall] using hx.1 ++ ++ have hx_ball' : dist (x + c) c ≤ r := by ++ simpa [Complex.dist_eq, add_sub_cancel] using hx_ball ++ ++ have hx_zero : f (x + c) = 0 := by ++ rcases (div_eq_zero_iff).mp (by simpa [g] using hx.2) with hnum | hden ++ · exact hnum ++ · exact (hc hden).elim ++ refine ⟨x + c, ?_, ?_⟩ ++ · exact ⟨by simpa [Metric.mem_closedBall] using hx_ball', hx_zero⟩ ++ · simp ++ · intro x hx ++ rcases hx with ⟨ρ, hρ, rfl⟩ ++ ++ have hρ_ball : dist ρ c ≤ r := by ++ simpa [Metric.mem_closedBall] using hρ.1 ++ refine ⟨?_, ?_⟩ ++ · ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hρ_ball ++ · ++ have : f ρ = 0 := hρ.2 ++ simp [g, sub_add_cancel, this] ++ ++ have himage : ((fun ρ : ℂ => ρ - c) '' zerosetKfRc r c f).Finite := ++ hfin.image (fun ρ : ℂ => ρ - c) ++ simpa [g, hEq] using himage ++ ++lemma helper_bound_shifted (B R : ℝ) (_hB : 1 < B) (_hRpos : 0 < R) (_hRlt1 : R < 1) ++ (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) ++ (h_bound : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R, ++ ‖(fun w => f (w + c) / f c) z‖ ≤ B / ‖f c‖ := ++by ++ intro z hz ++ ++ have hz_norm : ‖z‖ ≤ R := by ++ have hz' : dist z (0 : ℂ) ≤ R := by simpa [Metric.mem_closedBall] using hz ++ simpa [Complex.dist_eq] using hz' ++ ++ have hz_ballc : z + c ∈ Metric.closedBall c R := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq, add_sub_cancel] using hz_norm ++ ++ have hfb : ‖f (z + c)‖ ≤ B := h_bound (z + c) hz_ballc ++ ++ have hpos : 0 < ‖f c‖ := (norm_pos_iff).2 hc ++ ++ have hdiv : ‖f (z + c)‖ / ‖f c‖ ≤ B / ‖f c‖ := (div_le_div_iff_of_pos_right hpos).2 hfb ++ ++ have hnorm_eq : ‖(fun w => f (w + c) / f c) z‖ = ‖f (z + c)‖ / ‖f c‖ := by ++ change ‖f (z + c) / f c‖ = ‖f (z + c)‖ / ‖f c‖ ++ simp ++ simpa [hnorm_eq] using hdiv ++ ++lemma helper_g_zero_eq_one (f : ℂ → ℂ) (c : ℂ) (hc : f c ≠ 0) : ++ (fun z => f (z + c) / f c) 0 = 1 := by ++ simp [hc] ++ ++lemma helper_zerosetKfR_eq_center0 (r : ℝ) (hr : r > 0) (f : ℂ → ℂ) : ++ zerosetKfR r hr f = zerosetKfRc r (0 : ℂ) f := by ++ ext ρ; simp [zerosetKfR, zerosetKfRc] ++ ++lemma helper_sum_nonneg_nat (ι : Type*) (s : Finset ι) (f : ι → ℕ) : ++ 0 ≤ ∑ i ∈ s, ((f i : ℝ)) := by ++ classical ++ have h : ∀ i ∈ s, (0 : ℝ) ≤ (f i : ℝ) := by ++ intro i hi ++ exact_mod_cast (Nat.zero_le (f i)) ++ simpa using Finset.sum_nonneg h ++ ++lemma helper_one_le_Bdivfc2 (B R : ℝ) (_hB : 1 < B) (hRpos : 0 < R) (_hRlt1 : R < 1) ++ (f : ℂ → ℂ) (c : ℂ) (hc : f c ≠ 0) ++ (h_bound : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) : ++ 1 ≤ B / ‖f c‖ := ++by ++ have hc_in : c ∈ Metric.closedBall c R := by ++ have h0le : (0 : ℝ) ≤ R := le_of_lt hRpos ++ simpa [Metric.mem_closedBall, dist_self] using h0le ++ have hfc_le : ‖f c‖ ≤ B := h_bound c hc_in ++ have hfc_pos : 0 < ‖f c‖ := (norm_pos_iff.mpr hc) ++ have hdiv := (div_le_div_iff_of_pos_right (c := ‖f c‖) hfc_pos).mpr hfc_le ++ simpa [div_self (ne_of_gt hfc_pos)] using hdiv ++ ++lemma helper_sum_over_equal_finite_sets {α : Type*} (S T : Set α) ++ (hS : S.Finite) (hT : T.Finite) (hST : S = T) (φ : α → ℝ) : ++ (∑ x ∈ hS.toFinset, φ x) = (∑ x ∈ hT.toFinset, φ x) := by ++ classical ++ have hfin_eq : hS.toFinset = hT.toFinset := by ++ ext x ++ constructor ++ · intro hx ++ have hxS : x ∈ S := by ++ have hmem : x ∈ hS.toFinset ↔ x ∈ S := by ++ simp ++ exact hmem.mp hx ++ have hxT : x ∈ T := by simpa [hST] using hxS ++ have hmemT : x ∈ hT.toFinset ↔ x ∈ T := by ++ simp ++ exact hmemT.mpr hxT ++ · intro hx ++ have hxT : x ∈ T := by ++ have hmemT : x ∈ hT.toFinset ↔ x ∈ T := by ++ simp ++ exact hmemT.mp hx ++ have hxS : x ∈ S := by simpa [hST] using hxT ++ have hmemS : x ∈ hS.toFinset ↔ x ∈ S := by ++ simp ++ exact hmemS.mpr hxS ++ simp [hfin_eq] ++ ++lemma helper_apply_jensen_to_g ++ (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (g : ℂ → ℂ) ++ (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) ++ (hg0_ne : g 0 ≠ 0) ++ (hg0_one : g 0 = 1) ++ (hfin_g : (zerosetKfR R1 (by linarith) g).Finite) ++ (hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B) : ++ (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ≤ Real.log B / Real.log (R / R1) := by ++ classical ++ ++ have h_exists : ∀ σ ∈ zerosetKfR R1 (by linarith) g, ++ ∃ hσ : ℂ → ℂ, AnalyticAt ℂ hσ σ ∧ hσ σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, g z = (z - σ) ^ (analyticOrderAt g σ).toNat * hσ z := by ++ intro σ hσ ++ exact lem_analytic_zero_factor R R1 hR1_pos hR1_lt_R hR_lt_1 g h_g_analytic hg0_ne σ hσ ++ ++ let h_σ : ℂ → (ℂ → ℂ) := ++ fun σ => dite (σ ∈ zerosetKfR R1 (by linarith) g) ++ (fun h => Classical.choose (h_exists σ h)) ++ (fun _ => fun _ => (1 : ℂ)) ++ ++ have h_σ_spec : ∀ σ ∈ zerosetKfR R1 (by linarith) g, ++ AnalyticAt ℂ (h_σ σ) σ ∧ (h_σ σ) σ ≠ 0 ∧ ++ ∀ᶠ z in nhds σ, g z = (z - σ) ^ (analyticOrderAt g σ).toNat * (h_σ σ) z := by ++ intro σ hσin ++ have hx := h_exists σ hσin ++ dsimp [h_σ] ++ ++ simpa [hσin] using (Classical.choose_spec hx) ++ ++ have hbound := ++ lem_sum_m_rho_bound B R R1 hB hR1_pos hR1_lt_R hR_lt_1 ++ g h_g_analytic hg0_ne hg0_one hfin_g (h_σ := h_σ) hg_le_B h_σ_spec ++ ++ simpa [one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using hbound ++ ++lemma helper_sum_f_equals_sum_g ++ (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) ++ (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) ++ (hfin : (zerosetKfRc r c f).Finite) : ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) ++ = ++ (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), ++ ((analyticOrderAt (fun z => f (z + c) / f c) ρ').toNat : ℝ)) := ++by ++ classical ++ ++ let S : Finset ℂ := hfin.toFinset ++ let φ : ℂ → ℂ := fun ρ => ρ - c ++ let g' : ℂ → ℂ := fun z => f (z + c) / f c ++ ++ have himg : (φ '' zerosetKfRc r c f).Finite := hfin.image φ ++ have h_img_toFinset : ((hfin.image φ).toFinset) = S.image φ := by ++ simpa [S] using (Set.Finite.toFinset_image (s := (zerosetKfRc r c f)) (f := φ) ++ (hs := hfin) (h := himg)) ++ ++ have h_orders_match : ++ (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ)) = ++ (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := by ++ apply Finset.sum_congr rfl ++ intro ρ hρS ++ ++ have hρ_mem : ρ ∈ zerosetKfRc r c f := ++ (Set.Finite.mem_toFinset (hs := hfin)).1 hρS ++ have hρ_ball : ρ ∈ Metric.closedBall c r := hρ_mem.1 ++ have hρ_fzero : f ρ = 0 := hρ_mem.2 ++ ++ have hρ'_ball : (φ ρ) ∈ Metric.closedBall (0 : ℂ) r := by ++ ++ have hdist_le : dist ρ c ≤ r := by ++ simpa [Metric.mem_closedBall] using hρ_ball ++ ++ have : dist (φ ρ) 0 ≤ r := by ++ simpa [φ, dist_eq_norm] using (by simpa [dist_eq_norm] using hdist_le) ++ simpa [Metric.mem_closedBall] using this ++ have hρ'_gzero : g' (φ ρ) = 0 := by ++ simp [g', φ, hρ_fzero, sub_eq_add_neg, add_comm] ++ have hρ'_mem : (φ ρ) ∈ zerosetKfRc r (0 : ℂ) g' := ⟨hρ'_ball, hρ'_gzero⟩ ++ ++ have h_m_eq := fc_m_order r hr c f hc h_analytic (ρ' := φ ρ) hρ'_mem ++ ++ have h_m_eq' : analyticOrderAt g' (φ ρ) = analyticOrderAt f ρ := by ++ simpa [g', φ, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h_m_eq ++ ++ have h_toNat : (analyticOrderAt g' (φ ρ)).toNat = (analyticOrderAt f ρ).toNat := by ++ simpa using congrArg ENat.toNat h_m_eq' ++ simp [h_toNat] ++ ++ have h_inj : Function.Injective φ := by ++ intro x y hxy ++ ++ have := congrArg (fun z => z + c) hxy ++ simpa [φ, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using this ++ ++ have h_sum_image : ++ (∑ ρ' ∈ S.image φ, ((analyticOrderAt g' ρ').toNat : ℝ)) = ++ (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := by ++ refine Finset.sum_image ?h ++ intro x hx y hy hxy ++ ++ exact h_inj hxy ++ ++ calc ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) ++ = (∑ ρ ∈ S, ((analyticOrderAt f ρ).toNat : ℝ)) := by rfl ++ _ = (∑ ρ ∈ S, ((analyticOrderAt g' (φ ρ)).toNat : ℝ)) := h_orders_match ++ _ = (∑ ρ' ∈ S.image φ, ((analyticOrderAt g' ρ').toNat : ℝ)) := h_sum_image.symm ++ _ = (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), ++ ((analyticOrderAt (fun z => f (z + c) / f c) ρ').toNat : ℝ)) := by ++ ++ simp [S, φ, g', h_img_toFinset] ++ ++lemma helper_zero_set_shift_eq ++ (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) ++ (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) : ++ zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c) ++ = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := by ++ simpa using fc_zeros r hr c f hc h_analytic ++ ++lemma helper_fin_zero_g_is_image ++ (r : ℝ) (hr : r > 0) (c : ℂ) (f : ℂ → ℂ) (hc : f c ≠ 0) ++ (h_analytic : AnalyticOnNhd ℂ f (Metric.closedBall c 1)) ++ (hfin : (zerosetKfRc r c f).Finite) : ++ (zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c)).Finite := ++by ++ classical ++ have hset : zerosetKfRc r (0 : ℂ) (fun z => f (z + c) / f c) ++ = (fun ρ => ρ - c) '' (zerosetKfRc r c f) := ++ by simpa using fc_zeros r hr c f hc h_analytic ++ have hfin_img : ((fun ρ => ρ - c) '' (zerosetKfRc r c f)).Finite := hfin.image _ ++ simpa [hset] using hfin_img ++ ++lemma helper_AnalyticOnNhd_to_pointwise {S : Set ℂ} {f : ℂ → ℂ} ++ (h : AnalyticOnNhd ℂ f S) : ∀ z ∈ S, AnalyticAt ℂ f z := by ++ intro z hz ++ exact h z hz ++ ++lemma jensen_sum_bound_strict ++ (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) (hR1_lt_R : R1 < R) (hR_lt_1 : R < 1) ++ (g : ℂ → ℂ) ++ (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) ++ (hg0_ne : g 0 ≠ 0) ++ (hg0_one : g 0 = 1) ++ (hfin_g : (zerosetKfR R1 (by linarith) g).Finite) ++ (hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B) : ++ (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ≤ ++ Real.log B / Real.log (R / R1) := by ++ exact helper_apply_jensen_to_g B R R1 hB hR1_pos hR1_lt_R hR_lt_1 g ++ h_g_analytic hg0_ne hg0_one hfin_g hg_le_B ++ ++lemma no_zero_of_bound_one_and_center_one ++ (R : ℝ) (hR_lt_1 : R < 1) ++ (g : ℂ → ℂ) ++ (h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z) ++ (hg0_one : g 0 = 1) ++ (hg_le_one : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ 1) : ++ ∀ z ∈ Metric.closedBall (0 : ℂ) R, g z ≠ 0 := by ++ intro z hz ++ by_cases hRpos : 0 < R ++ · ++ ++ have hdiff : DifferentiableOn ℂ g (Metric.ball (0 : ℂ) R) := by ++ intro x hx ++ have hxlt : ‖x‖ < R := by ++ simpa [Metric.mem_ball, Complex.dist_eq] using hx ++ have hxle1 : ‖x‖ ≤ 1 := le_trans (le_of_lt hxlt) (le_of_lt hR_lt_1) ++ have hx_in1 : x ∈ Metric.closedBall (0 : ℂ) 1 := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hxle1 ++ exact ((h_g_analytic x hx_in1).differentiableAt).differentiableWithinAt ++ ++ have hcont : ContinuousOn g (Metric.closedBall (0 : ℂ) R) := by ++ intro x hx ++ have hxleR : ‖x‖ ≤ R := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hx ++ have hxle1 : ‖x‖ ≤ 1 := le_trans hxleR (le_of_lt hR_lt_1) ++ have hx_in1 : x ∈ Metric.closedBall (0 : ℂ) 1 := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hxle1 ++ exact (h_g_analytic x hx_in1).continuousAt.continuousWithinAt ++ have hdcc : DiffContOnCl ℂ g (Metric.ball (0 : ℂ) R) := ++ DiffContOnCl.mk_ball hdiff hcont ++ ++ have hIsMax : IsMaxOn (fun z => ‖g z‖) (Metric.ball (0 : ℂ) R) 0 := by ++ intro y hy ++ have hynormlt : ‖y‖ < R := by ++ simpa [Metric.mem_ball, Complex.dist_eq] using hy ++ have hyle : ‖y‖ ≤ R := le_of_lt hynormlt ++ have hgy : ‖g y‖ ≤ 1 := hg_le_one y hyle ++ simpa [hg0_one] using hgy ++ ++ have hEqOn := ++ Complex.eqOn_closedBall_of_isMaxOn_norm (z := (0 : ℂ)) (r := R) hdcc hIsMax ++ have hz_eq : g z = (fun _ => g 0) z := hEqOn hz ++ have hz_eq1 : g z = g 0 := by simpa using hz_eq ++ have gz_one : g z = 1 := by simpa [hg0_one] using hz_eq1 ++ simp [gz_one] ++ · ++ ++ have hRle : R ≤ 0 := le_of_not_gt hRpos ++ have hz_le : ‖z‖ ≤ R := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz ++ have hz_norm_eq : ‖z‖ = 0 := ++ le_antisymm (le_trans hz_le hRle) (norm_nonneg z) ++ have hz_zero : z = 0 := by ++ simpa [norm_eq_zero] using hz_norm_eq ++ simp [hz_zero, hg0_one] ++ ++lemma helper_sum_over_equal_finite_sets_orders ++ {S T : Set ℂ} (g : ℂ → ℂ) ++ (hS : S.Finite) (hT : T.Finite) (hST : S = T) : ++ (∑ x ∈ hS.toFinset, ((analyticOrderAt g x).toNat : ℝ)) ++ = (∑ x ∈ hT.toFinset, ((analyticOrderAt g x).toNat : ℝ)) := by ++ classical ++ have hF : hS.toFinset = hT.toFinset := by ++ ext x ++ simp [Set.Finite.mem_toFinset, hST] ++ simp [hF] ++ ++lemma helper_mem_closedBall_zero_iff_norm_le (z : ℂ) (R : ℝ) : ++ z ∈ Metric.closedBall (0 : ℂ) R ↔ ‖z‖ ≤ R := by ++ simp [Metric.mem_closedBall, dist_eq_norm] ++ ++lemma helper_bound_on_ball_to_norm_imp ++ {R : ℝ} {g : ℂ → ℂ} {M : ℝ} ++ (hg : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖g z‖ ≤ M) : ++ ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ M := by ++ intro z hz ++ have hz' : z ∈ Metric.closedBall (0 : ℂ) R := by ++ have : dist z (0 : ℂ) ≤ R := by ++ simpa [dist_eq_norm] using hz ++ simpa [Metric.mem_closedBall] using this ++ exact hg z hz' ++ ++lemma helper_pointwise_to_AnalyticOnNhd {S : Set ℂ} {f : ℂ → ℂ} ++ (h : ∀ z ∈ S, AnalyticAt ℂ f z) : AnalyticOnNhd ℂ f S := by ++ simpa using! h ++ ++lemma lem_sum_m_rho_bound_c (B R R1 : ℝ) (hB : 1 < B) ++ (hR1_pos : 0 < R1) ++ (hR1_lt_R : R1 < R) ++ (hR_lt_1 : R < 1) ++ (f : ℂ → ℂ) ++ (c : ℂ) ++ (h_f_analytic : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ f z) ++ (h_f_nonzero_at_zero : f c ≠ 0) ++ (hf_le_B : ∀ z ∈ Metric.closedBall c R, ‖f z‖ ≤ B) ++ (hfin : (zerosetKfRc R1 c f).Finite) : ++ ∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ) ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by ++ classical ++ ++ let g : ℂ → ℂ := fun z => f (z + c) / f c ++ ++ have h_g_analyticOn : AnalyticOnNhd ℂ g (Metric.closedBall (0 : ℂ) 1) := ++ helper_analyticOnNhd_shift_div f c h_f_analytic h_f_nonzero_at_zero ++ have h_g_analytic : ∀ z ∈ Metric.closedBall (0 : ℂ) 1, AnalyticAt ℂ g z := ++ helper_AnalyticOnNhd_to_pointwise h_g_analyticOn ++ ++ have hg0_one : g 0 = 1 := helper_g_zero_eq_one f c h_f_nonzero_at_zero ++ have hg0_ne : g 0 ≠ 0 := by simp [hg0_one] ++ ++ have hAnal_f : AnalyticOnNhd ℂ f (Metric.closedBall c 1) := ++ helper_pointwise_to_AnalyticOnNhd h_f_analytic ++ have hfin_g0 : (zerosetKfRc R1 (0 : ℂ) g).Finite := ++ helper_fin_zero_g_is_image R1 hR1_pos c f h_f_nonzero_at_zero hAnal_f hfin ++ have hZR_eq : zerosetKfR R1 hR1_pos g = zerosetKfRc R1 (0 : ℂ) g := ++ helper_zerosetKfR_eq_center0 R1 hR1_pos g ++ have hfin_g : (zerosetKfR R1 (by exact hR1_pos) g).Finite := by ++ simpa [hZR_eq] using hfin_g0 ++ ++ have h_bound_shift : ∀ z ∈ Metric.closedBall (0 : ℂ) R, ‖g z‖ ≤ B / ‖f c‖ := ++ helper_bound_shifted B R hB (by exact lt_trans hR1_pos hR1_lt_R) hR_lt_1 c f ++ h_f_nonzero_at_zero (fun z hz => hf_le_B z <| by simpa using hz) ++ have hg_le_B : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ B / ‖f c‖ := ++ helper_bound_on_ball_to_norm_imp (R := R) (g := g) (M := B / ‖f c‖) h_bound_shift ++ ++ have hfc_le : ‖f c‖ ≤ B := by ++ have : c ∈ Metric.closedBall c R := by ++ have hRpos' : 0 ≤ R := le_of_lt (lt_trans hR1_pos hR1_lt_R) ++ have : dist c c ≤ R := by simpa [dist_self] using hRpos' ++ simpa [Metric.mem_closedBall] using this ++ exact hf_le_B c this ++ have hfc_pos : 0 < ‖f c‖ := (norm_pos_iff).2 h_f_nonzero_at_zero ++ have hBdiv_ge_one : 1 ≤ B / ‖f c‖ := by ++ have hdiv := (div_le_div_iff_of_pos_right hfc_pos).mpr hfc_le ++ simpa [div_self (ne_of_gt hfc_pos)] using hdiv ++ ++ have hsum_fg_eq : ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) ++ = (∑ ρ' ∈ ((hfin.image (fun ρ => ρ - c)).toFinset), ++ ((analyticOrderAt g ρ').toNat : ℝ)) := ++ helper_sum_f_equals_sum_g (r := R1) (hr := hR1_pos) (c := c) ++ (f := f) (hc := h_f_nonzero_at_zero) (h_analytic := hAnal_f) (hfin := hfin) ++ ++ have hST_g_img : zerosetKfR R1 hR1_pos g ++ = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := by ++ have h1 : zerosetKfR R1 hR1_pos g = zerosetKfRc R1 (0 : ℂ) g := ++ helper_zerosetKfR_eq_center0 R1 hR1_pos g ++ have h2 : zerosetKfRc R1 (0 : ℂ) g ++ = (fun ρ => ρ - c) '' (zerosetKfRc R1 c f) := ++ helper_zero_set_shift_eq R1 hR1_pos c f h_f_nonzero_at_zero hAnal_f ++ simpa [h1] using h2 ++ ++ rcases lt_or_eq_of_le hBdiv_ge_one with hBdiv_gt_one | hBdiv_eq_one ++ · ++ have hsum_g_bound := ++ jensen_sum_bound_strict (B := B / ‖f c‖) (R := R) (R1 := R1) ++ (hB := hBdiv_gt_one) ++ (hR1_pos := hR1_pos) (hR1_lt_R := hR1_lt_R) (hR_lt_1 := hR_lt_1) ++ (g := g) (h_g_analytic := h_g_analytic) (hg0_ne := hg0_ne) ++ (hg0_one := hg0_one) (hfin_g := hfin_g) (hg_le_B := hg_le_B) ++ ++ have hsum_g_reindex : ++ (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ++ = (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) := ++ helper_sum_over_equal_finite_sets_orders (g := g) ++ (S := zerosetKfR R1 hR1_pos g) ++ (T := (fun ρ => ρ - c) '' (zerosetKfRc R1 c f)) ++ (hS := hfin_g) (hT := hfin.image (fun ρ => ρ - c)) (hST := hST_g_img) ++ ++ have : ++ (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ++ ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by ++ simpa [hsum_g_reindex] using hsum_g_bound ++ ++ simpa [hsum_fg_eq] using this ++ · ++ have hBdiv_eq_one' : B / ‖f c‖ = 1 := by ++ simpa [eq_comm] using hBdiv_eq_one ++ have hg_le_one : ∀ z : ℂ, ‖z‖ ≤ R → ‖g z‖ ≤ 1 := by ++ intro z hz ++ have := hg_le_B z hz ++ simpa [hBdiv_eq_one'] using this ++ have g_nonzero_on_ball : ∀ z ∈ Metric.closedBall (0 : ℂ) R, g z ≠ 0 := ++ no_zero_of_bound_one_and_center_one R hR_lt_1 g h_g_analytic hg0_one hg_le_one ++ ++ have hS_empty : zerosetKfR R1 hR1_pos g = (∅ : Set ℂ) := by ++ ext z; constructor ++ · intro hz ++ rcases hz with ⟨hzball, hzzero⟩ ++ have hzR1 : ‖z‖ ≤ R1 := by simpa [Metric.mem_closedBall, dist_eq_norm] using hzball ++ have hzR : ‖z‖ ≤ R := le_trans hzR1 (le_of_lt hR1_lt_R) ++ have hzR' : z ∈ Metric.closedBall (0 : ℂ) R := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hzR ++ exact (g_nonzero_on_ball z hzR') hzzero ++ · intro hzfalse ++ cases hzfalse ++ have hsum_g_zero : ++ (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) = 0 := by ++ have h := ++ helper_sum_over_equal_finite_sets_orders (g := g) ++ (S := zerosetKfR R1 hR1_pos g) (T := (∅ : Set ℂ)) ++ (hS := hfin_g) (hT := Set.finite_empty) (hST := hS_empty) ++ simpa using h ++ ++ have hsum_reindex := ++ helper_sum_over_equal_finite_sets_orders (g := g) ++ (S := zerosetKfR R1 hR1_pos g) ++ (T := (fun ρ => ρ - c) '' (zerosetKfRc R1 c f)) ++ (hS := hfin_g) (hT := hfin.image (fun ρ => ρ - c)) (hST := hST_g_img) ++ have hsum_img_eq : ++ (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) ++ = (∑ ρ ∈ hfin_g.toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) := by ++ simpa using hsum_reindex.symm ++ have hsum_img_zero : ++ (∑ ρ ∈ (hfin.image (fun ρ => ρ - c)).toFinset, ((analyticOrderAt g ρ).toNat : ℝ)) = 0 := by ++ simp [hsum_img_eq, hsum_g_zero] ++ ++ have hsum_f_zero : ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) = 0 := by ++ simpa [hsum_img_zero] using hsum_fg_eq ++ ++ have hRHS_zero : Real.log (B / ‖f c‖) / Real.log (R / R1) = 0 := by ++ simp [hBdiv_eq_one'] ++ ++ have : ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt f ρ).toNat : ℝ)) ++ ≤ Real.log (B / ‖f c‖) / Real.log (R / R1) := by ++ simp [hsum_f_zero, hRHS_zero] ++ exact this ++ ++lemma lem_sum_m_rho_zeta : ++ ∃ C_2 > 1, ∀ (t : ℝ) (_ht : |t| > 3), ++ let c := (3/2 : ℂ) + I * t; ++ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), ++ ∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) ≤ C_2 * Real.log |t| := by ++ classical ++ ++ obtain ⟨b, hb_gt1, hb_bound⟩ := zeta32upper ++ obtain ⟨a, ha_pos, ha_bound⟩ := zeta_low_332 ++ ++ let R1 : ℝ := 5 / 6 ++ let R : ℝ := 8 / 9 ++ let logRatio : ℝ := Real.log (R / R1) ++ ++ let u : ℝ := Real.log (b / a) ++ let C2 : ℝ := max 2 ((1 + |u|) / logRatio) ++ have hC2_gt_one : 1 < C2 := by ++ have htwo_lt : (1 : ℝ) < 2 := by norm_num ++ have hle : (2 : ℝ) ≤ C2 := by ++ have := le_max_left (2 : ℝ) ((1 + |u|) / logRatio) ++ simp [C2] ++ exact lt_of_lt_of_le htwo_lt hle ++ refine ⟨C2, hC2_gt_one, ?_⟩ ++ intro t ht c hfin ++ ++ have hR1_pos : 0 < R1 := by dsimp [R1]; norm_num ++ have hR1_lt_R : R1 < R := by dsimp [R1, R]; norm_num ++ have hR_lt_1 : R < 1 := by dsimp [R]; norm_num ++ have hR_le_one : R ≤ (1 : ℝ) := by dsimp [R]; norm_num ++ ++ have ht1 : |t| > 1 := lt_trans (by norm_num) ht ++ have h_f_analytic : ∀ z ∈ Metric.closedBall c 1, AnalyticAt ℂ riemannZeta z := by ++ intro z hz ++ have hz_ne_one : z ≠ (1 : ℂ) := (D1cinTt_pre t ht1) z (by simpa [c] using hz) ++ exact zetaanalOnnot1 z hz_ne_one ++ ++ have h_nonzero : riemannZeta c ≠ 0 := by simpa [c] using zetacnot0 t ++ ++ have ht2 : |t| > 2 := by linarith ++ have h_upper_on_ball1 : ∀ z ∈ Metric.closedBall c 1, ‖riemannZeta z‖ < b * |t| := by ++ have h := hb_bound t ht2 ++ intro z hz; simpa [c] using h z (by simpa [c] using hz) ++ have hf_le_B : ∀ z ∈ Metric.closedBall c R, ‖riemannZeta z‖ ≤ b * |t| := by ++ intro z hz ++ have hz1 : z ∈ Metric.closedBall c 1 := ++ (Metric.closedBall_subset_closedBall hR_le_one) hz ++ exact le_of_lt (h_upper_on_ball1 z hz1) ++ ++ have hb_pos : 0 < b := lt_trans (by norm_num) hb_gt1 ++ have htabove1 : (1 : ℝ) ≤ |t| := le_of_lt ht1 ++ have hb_le_B : b ≤ b * |t| := by ++ have := mul_le_mul_of_nonneg_left htabove1 (le_of_lt hb_pos) ++ simpa [one_mul] using this ++ have hBpos : 1 < b * |t| := lt_of_lt_of_le hb_gt1 hb_le_B ++ ++ have h_sum_bound := ++ lem_sum_m_rho_bound_c (B := b * |t|) (R := R) (R1 := R1) ++ (hB := hBpos) ++ (hR1_pos := hR1_pos) ++ (hR1_lt_R := hR1_lt_R) ++ (hR_lt_1 := hR_lt_1) ++ (f := riemannZeta) (c := c) ++ (h_f_analytic := h_f_analytic) ++ (h_f_nonzero_at_zero := h_nonzero) ++ (hf_le_B := hf_le_B) ++ (hfin := hfin) ++ ++ have hlogRatio_pos : 0 < logRatio := by ++ have : 1 < R / R1 := by dsimp [R, R1]; norm_num ++ exact Real.log_pos this ++ ++ have h_zeta_ge_a : a ≤ ‖riemannZeta c‖ := by ++ simpa [c, mul_comm] using! ha_bound t ++ ++ have ht_abs_pos : 0 < |t| := lt_trans (by norm_num) ht ++ have hζ_norm_pos : 0 < ‖riemannZeta c‖ := norm_pos_iff.mpr h_nonzero ++ have hb_ne : (b : ℝ) ≠ 0 := ne_of_gt hb_pos ++ have ht_abs_ne : (|t| : ℝ) ≠ 0 := ne_of_gt ht_abs_pos ++ have ha_ne : a ≠ 0 := ne_of_gt ha_pos ++ have hlog_split1 : ++ Real.log ((b * |t|) / ‖riemannZeta c‖) ++ = (Real.log b + Real.log |t|) - Real.log ‖riemannZeta c‖ := by ++ have : Real.log (b * |t|) = Real.log b + Real.log |t| := ++ Real.log_mul hb_ne ht_abs_ne ++ have : ++ Real.log ((b * |t|) / ‖riemannZeta c‖) ++ = Real.log (b * |t|) - Real.log ‖riemannZeta c‖ := ++ Real.log_div (by exact mul_ne_zero hb_ne ht_abs_ne) (ne_of_gt hζ_norm_pos) ++ simp [this, Real.log_mul hb_ne ht_abs_ne] ++ have hlog_div_eq : Real.log (b / a) = Real.log b - Real.log a := ++ Real.log_div hb_ne ha_ne ++ have hlog_a_le : Real.log a ≤ Real.log ‖riemannZeta c‖ := ++ Real.log_le_log (by exact ha_pos) (by exact h_zeta_ge_a) ++ have hneg : -(Real.log ‖riemannZeta c‖) ≤ -Real.log a := by ++ simpa using (neg_le_neg hlog_a_le) ++ have hRHS_le_const : ++ Real.log ((b * |t|) / ‖riemannZeta c‖) ++ ≤ Real.log |t| + Real.log (b / a) := by ++ ++ have : ++ (Real.log b + Real.log |t|) - Real.log ‖riemannZeta c‖ ++ ≤ (Real.log b + Real.log |t|) - Real.log a := by ++ simpa [sub_eq_add_neg] using! add_le_add_right hneg (Real.log b + Real.log |t|) ++ simpa [hlog_split1, sub_eq_add_neg, add_comm, add_left_comm, add_assoc, hlog_div_eq] ++ using this ++ ++ have hRHS1 : ++ Real.log ((b * |t|) / ‖riemannZeta c‖) / logRatio ++ ≤ (Real.log |t| + Real.log (b / a)) / logRatio := by ++ exact div_le_div_of_nonneg_right hRHS_le_const (le_of_lt hlogRatio_pos) ++ ++ have hlogt_ge_one : (1 : ℝ) ≤ Real.log |t| := by ++ ++ have h3le : (3 : ℝ) ≤ |t| := le_of_lt ht ++ have hlog3_le : Real.log 3 ≤ Real.log |t| := Real.log_le_log (by norm_num) h3le ++ have h_exp_le : Real.exp (1 : ℝ) ≤ 3 := le_of_lt lem_three_gt_e ++ have hlog3_ge_one : (1 : ℝ) ≤ Real.log 3 := ++ (Real.le_log_iff_exp_le (by norm_num : 0 < (3 : ℝ))).mpr h_exp_le ++ exact le_trans hlog3_ge_one hlog3_le ++ have hadd_le : Real.log |t| + Real.log (b / a) ≤ (1 + |u|) * Real.log |t| := by ++ have haux1 : Real.log (b / a) ≤ |u| := by simpa [u] using le_abs_self (Real.log (b / a)) ++ have haux2 : |u| ≤ |u| * Real.log |t| := by ++ have hnonneg : 0 ≤ |u| := abs_nonneg _ ++ have h1le : (1 : ℝ) ≤ Real.log |t| := hlogt_ge_one ++ simpa [one_mul] using (mul_le_mul_of_nonneg_left h1le hnonneg) ++ calc ++ Real.log |t| + Real.log (b / a) ++ ≤ Real.log |t| + |u| := by exact add_le_add_right haux1 _ ++ _ ≤ Real.log |t| + (|u| * Real.log |t|) := by exact add_le_add_right haux2 _ ++ _ = (1 + |u|) * Real.log |t| := by ring ++ have hRHS2 : ++ (Real.log |t| + Real.log (b / a)) / logRatio ++ ≤ ((1 + |u|) / logRatio) * Real.log |t| := by ++ have := div_le_div_of_nonneg_right hadd_le (le_of_lt hlogRatio_pos) ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this ++ have hfinal : ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) ++ ≤ ((1 + |u|) / logRatio) * Real.log |t| := by ++ have := le_trans h_sum_bound hRHS1 ++ exact le_trans this hRHS2 ++ ++ have hC2_ge : ((1 + |u|) / logRatio) ≤ C2 := by ++ have := le_max_right (2 : ℝ) ((1 + |u|) / logRatio) ++ simp [C2] ++ have hlogt_nonneg : 0 ≤ Real.log |t| := le_trans (by norm_num) hlogt_ge_one ++ have hscale := mul_le_mul_of_nonneg_right hC2_ge hlogt_nonneg ++ exact le_trans hfinal hscale ++ ++lemma lem_sumKdeltatlogt : ++ ∃ C_3 > 1, ∀ (t : ℝ) (_ht : |t| > 3), ++ let c := (3/2 : ℂ) + I * t; ++ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), ++ ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ ++ (C_3 / (deltaz_t t)) * Real.log |t| := by ++ ++ obtain ⟨C_2, hC_2_pos, hC_2_bound⟩ := lem_sum_m_rho_zeta ++ ++ use C_2 ++ ++ constructor ++ · ++ exact hC_2_pos ++ ++ · ++ intro t ht c hfin z hz ++ ++ have h1 := lem_sumK1abs t ht z hfin hz ++ ++ have h2 := hC_2_bound t ht hfin ++ ++ have ht2 : |t| > 2 := by linarith [ht] ++ have h_delta_pos : 0 < deltaz_t t := (lem_delta19.2 t ht2).1 ++ ++ have h_t_ge_one : (1 : ℝ) ≤ |t| := by linarith [ht] ++ ++ calc ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ++ ≤ (1 / (2 * deltaz_t t)) * (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ)) := h1 ++ _ ≤ (1 / (2 * deltaz_t t)) * (C_2 * Real.log |t|) := by ++ apply mul_le_mul_of_nonneg_left h2 ++ apply div_nonneg (by norm_num) ++ apply mul_nonneg (by norm_num) (le_of_lt h_delta_pos) ++ _ = (C_2 / (2 * deltaz_t t)) * Real.log |t| := by ring ++ _ ≤ (C_2 / deltaz_t t) * Real.log |t| := by ++ apply mul_le_mul_of_nonneg_right _ (Real.log_nonneg h_t_ge_one) ++ ++ apply div_le_div_of_nonneg_left (le_of_lt (lt_trans zero_lt_one hC_2_pos)) ++ · exact h_delta_pos ++ · ++ calc deltaz_t t ++ = 1 * deltaz_t t := by rw [one_mul] ++ _ ≤ 2 * deltaz_t t := by ++ apply mul_le_mul_of_nonneg_right (by norm_num : (1 : ℝ) ≤ 2) (le_of_lt h_delta_pos) ++ ++lemma lem_sumKlogt2 : ++ ∃ C_4 > 1, ∀ (t : ℝ) (_ht : |t| > 3), ++ let c := (3/2 : ℂ) + I * t ++ ∀ (hfin : (zerosetKfRc (5 / (6 : ℝ)) c riemannZeta).Finite), ++ ∀ z : ℂ, 1 - deltaz_t t ≤ z.re ∧ z.re ≤ 3/2 ∧ z.im = t → ++ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ≤ ++ C_4 * Real.log |t|^2 := by ++ ++ obtain ⟨C_3, hC_3_gt, hC_3⟩ := lem_sumKdeltatlogt ++ ++ use max (100 * C_3 / zerofree_constant) 2 ++ ++ constructor ++ · exact lt_max_of_lt_right (by norm_num : (2 : ℝ) > 1) ++ ++ · intro t ht c hfin z hz ++ ++ have h_bound := hC_3 t ht hfin z hz ++ ++ have h_t_pos : 0 < |t| := by linarith [ht, abs_nonneg t] ++ have h_log_t_pos : 0 < Real.log |t| := Real.log_pos (by linarith [ht] : (1 : ℝ) < |t|) ++ have hC_3_pos : 0 < C_3 := lt_trans zero_lt_one hC_3_gt ++ have h_zerofree_pos : 0 < zerofree_constant := zerofree_constant_pos ++ ++ have h_log_bound : Real.log (|t| + 2) ≤ 2 * Real.log |t| := by ++ have h_ineq : |t| + 2 ≤ 2 * |t| := by linarith [ht] ++ have h_log_ineq := Real.log_le_log (by linarith [abs_nonneg t] : 0 < |t| + 2) h_ineq ++ rw [Real.log_mul (by norm_num) (ne_of_gt h_t_pos)] at h_log_ineq ++ have h_log2_bound : Real.log 2 ≤ Real.log |t| := ++ Real.log_le_log (by norm_num) (by linarith [ht] : (2 : ℝ) ≤ |t|) ++ linarith [h_log_ineq] ++ ++ have h_deltaz_eq : deltaz_t t = (zerofree_constant / 20) / Real.log (|t| + 2) := by ++ simp [deltaz_t, deltaz] ++ ++ have h_main_bound : C_3 / deltaz_t t * Real.log |t| ≤ ++ 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := by ++ ++ rw [h_deltaz_eq] ++ ++ have h_div_rewrite : C_3 / ((zerofree_constant / 20) / Real.log (|t| + 2)) = ++ C_3 * Real.log (|t| + 2) * 20 / zerofree_constant := by ++ field_simp [ne_of_gt h_zerofree_pos, ne_of_gt (Real.log_pos (by linarith [abs_nonneg t] : (1 : ℝ) < |t| + 2))] ++ ++ rw [h_div_rewrite] ++ ++ have h_pos_factor : 0 ≤ C_3 * 20 / zerofree_constant := ++ div_nonneg (mul_nonneg (le_of_lt hC_3_pos) (by norm_num)) (le_of_lt h_zerofree_pos) ++ ++ calc C_3 * Real.log (|t| + 2) * 20 / zerofree_constant * Real.log |t| ++ = C_3 * 20 / zerofree_constant * Real.log (|t| + 2) * Real.log |t| := by ring ++ _ ≤ C_3 * 20 / zerofree_constant * (2 * Real.log |t|) * Real.log |t| := by ++ exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left h_log_bound h_pos_factor) ++ (le_of_lt h_log_t_pos) ++ _ = 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := by simp [pow_two]; ring ++ ++ calc (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖z - ρ‖) ++ ≤ C_3 / deltaz_t t * Real.log |t| := h_bound ++ _ ≤ 40 * C_3 / zerofree_constant * (Real.log |t|)^2 := h_main_bound ++ _ ≤ max (100 * C_3 / zerofree_constant) 2 * (Real.log |t|)^2 := by ++ have h_factor_bound : 40 * C_3 / zerofree_constant ≤ max (100 * C_3 / zerofree_constant) 2 := by ++ have h_coeff_ineq : 40 * C_3 ≤ 100 * C_3 := by ++ ++ have h_coeff : (40 : ℝ) ≤ 100 := by norm_num ++ exact mul_le_mul_of_nonneg_right h_coeff (le_of_lt hC_3_pos) ++ have h_div_ineq : 40 * C_3 / zerofree_constant ≤ 100 * C_3 / zerofree_constant := by ++ ++ exact div_le_div_of_nonneg_right h_coeff_ineq (le_of_lt h_zerofree_pos) ++ exact le_trans h_div_ineq (le_max_left _ _) ++ exact mul_le_mul_of_nonneg_right h_factor_bound (sq_nonneg _) ++ ++lemma lem_logDerivZetalogt0 : ++ ∃ C > 1, ++ ∀ (t : ℝ) (_ht : |t| > 3), ++ ∀ s : ℂ, (1 - deltaz_t t) ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t → ++ ‖deriv riemannZeta s / riemannZeta s‖ ≤ C * Real.log |t|^2 := by ++ ++ obtain ⟨C_1, hC_1_gt, hC_1⟩ := lem_Zeta_Triangle_ZFR ++ obtain ⟨C_4, hC_4_gt, hC_4⟩ := lem_sumKlogt2 ++ ++ use C_1 + C_4 ++ ++ constructor ++ · ++ linarith [hC_1_gt, hC_4_gt] ++ ++ · ++ intro t ht s hs ++ ++ let c := (3/2 : ℂ) + I * t ++ have hfin := lem_finiteKzeta t ht ++ ++ have h_triangle := hC_1 t ht hfin s hs ++ ++ have h_triangle_ineq := lem_triangle_ZFR t ht s hfin hs ++ ++ have h_sum_bound := hC_4 t ht hfin s hs ++ ++ have h_log_sq_ge : Real.log |t| ≤ Real.log |t|^2 := by ++ have h_log_ge_one : (1 : ℝ) ≤ Real.log |t| := by ++ ++ have h_t_gt_e : Real.exp 1 < |t| := by ++ have h_e_bound : Real.exp 1 < 3 := by ++ ++ simpa using lem_three_gt_e ++ linarith [ht] ++ ++ have h_t_pos : 0 < |t| := by linarith [ht, abs_nonneg t] ++ rw [← Real.log_exp 1] ++ exact Real.log_le_log (Real.exp_pos 1) (le_of_lt h_t_gt_e) ++ have h_log_pos : 0 < Real.log |t| := Real.log_pos (by linarith [ht] : (1 : ℝ) < |t|) ++ rw [pow_two] ++ exact le_mul_of_one_le_right (le_of_lt h_log_pos) h_log_ge_one ++ ++ calc ‖deriv riemannZeta s / riemannZeta s‖ ++ ≤ ‖(∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℂ) / (s - ρ))‖ + C_1 * Real.log |t| := h_triangle ++ _ ≤ (∑ ρ ∈ hfin.toFinset, ((analyticOrderAt riemannZeta ρ).toNat : ℝ) / ‖s - ρ‖) + C_1 * Real.log |t| := by ++ apply add_le_add_left h_triangle_ineq ++ _ ≤ C_4 * Real.log |t|^2 + C_1 * Real.log |t| := by ++ apply add_le_add_left h_sum_bound ++ _ ≤ C_4 * Real.log |t|^2 + C_1 * Real.log |t|^2 := by ++ ++ have h_c1_nonneg : 0 ≤ C_1 := le_of_lt (lt_trans zero_lt_one hC_1_gt) ++ exact add_le_add_right (mul_le_mul_of_nonneg_left h_log_sq_ge h_c1_nonneg) _ ++ _ = (C_4 + C_1) * Real.log |t|^2 := by ring ++ _ = (C_1 + C_4) * Real.log |t|^2 := by ring ++ ++lemma lem_logDerivZetalogt2 : ++ ∃ A: ℝ, A > 0 ∧ A < 1 ∧ ++ ∃ C > 1, ++ ∀ (t : ℝ) (_ht : |t| > 3), ++ ∀ s : ℂ, (1 - A / Real.log (abs t + 2) ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t) → ++ ‖deriv riemannZeta s / riemannZeta s‖ ≤ C * Real.log |t|^2 := by ++ obtain ⟨C, hC_gt, hC_bound⟩ := lem_logDerivZetalogt0 ++ refine ⟨zerofree_constant / 20, ?Apos, ?Alt1, ⟨C, hC_gt, ?_⟩⟩ ++ · ++ exact div_pos zerofree_constant_pos (by norm_num) ++ · ++ have hlt : zerofree_constant / 20 < (1 : ℝ) / 20 := ++ div_lt_div_of_pos_right zerofree_constant_lt_one (by norm_num) ++ have : (1 : ℝ) / 20 < 1 := by norm_num ++ exact lt_trans hlt this ++ · ++ intro t ht s hs ++ have hδ : 1 - deltaz_t t ≤ s.re ∧ s.re ≤ 3/2 ∧ s.im = t := by ++ simpa [deltaz_t, deltaz, Complex.mul_I_im] using hs ++ exact hC_bound t ht s hδ ++ ++lemma lem_rhoDRe4 : ++ ∀ t : ℝ, ∀ z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t), ++ z.re > 1 - 4 * deltaz_t t := by ++ intro t z hz ++ ++ have h_pos : 0 < deltaz_t t := by ++ ++ have h_log_pos : 0 < Real.log (|t| + 2) := by ++ have h1 : (1 : ℝ) < |t| + 2 := by ++ have : (0 : ℝ) ≤ |t| := abs_nonneg _ ++ linarith ++ exact Real.log_pos h1 ++ have h_num_pos : 0 < zerofree_constant / 20 := by ++ have h20 : 0 < (20 : ℝ) := by norm_num ++ exact div_pos zerofree_constant_pos h20 ++ have : 0 < (zerofree_constant / 20) / Real.log (|t| + 2) := by ++ exact div_pos h_num_pos h_log_pos ++ simpa [deltaz_t, deltaz, Complex.mul_I_im] using this ++ ++ have h_norm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz ++ ++ have re_bound : |(z - (1 - deltaz_t t + t * Complex.I)).re| ≤ 2 * deltaz_t t := ++ (Complex.abs_re_le_norm _).trans h_norm ++ ++ have center_re : (1 - deltaz_t t + t * Complex.I).re = 1 - deltaz_t t := by ++ calc (1 - deltaz_t t + t * Complex.I).re ++ = (1 - deltaz_t t : ℂ).re + (t * Complex.I).re := by rw [Complex.add_re] ++ _ = (1 - deltaz_t t) + (t * Complex.I).re := by simp [Complex.ofReal_re] ++ _ = (1 - deltaz_t t) + 0 := by simp [Complex.mul_re, Complex.I_re] ++ _ = 1 - deltaz_t t := by simp ++ ++ have re_simp : (z - (1 - deltaz_t t + t * Complex.I)).re = z.re - (1 - deltaz_t t) := by ++ rw [Complex.sub_re, center_re] ++ ++ have re_bound' : |z.re - (1 - deltaz_t t)| ≤ 2 * deltaz_t t := by ++ simpa [re_simp] using re_bound ++ ++ have lower_bound : z.re - (1 - deltaz_t t) ≥ -(2 * deltaz_t t) := by ++ have h := (abs_le).1 re_bound' ++ exact h.1 ++ ++ have : z.re ≥ 1 - deltaz_t t - 2 * deltaz_t t := by linarith [lower_bound] ++ have : z.re ≥ 1 - 3 * deltaz_t t := by linarith ++ linarith [h_pos] ++ ++lemma helper_absIm_le_add_smallball (t : ℝ) (z : ℂ) ++ (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : ++ |z.im| ≤ |t| + 2 * deltaz_t t := by ++ ++ have hnorm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz ++ ++ have h_im_diff : |(z - (1 - deltaz_t t + t * Complex.I)).im| ≤ 2 * deltaz_t t := ++ le_trans (Complex.abs_im_le_norm _) hnorm ++ ++ have center_im : (1 - deltaz_t t + t * Complex.I).im = t := by ++ simp [Complex.add_im, Complex.mul_im] ++ ++ have diff_im : (z - (1 - deltaz_t t + t * Complex.I)).im = z.im - t := by ++ simp [Complex.sub_im, center_im] ++ ++ have h_im_sub : |z.im - t| ≤ 2 * deltaz_t t := by ++ simpa [diff_im] using h_im_diff ++ ++ have tri : |z.im| ≤ |z.im - t| + |t| := by ++ simpa [sub_eq_add_neg] using! (abs_add_le (z.im - t) t) ++ ++ have : |z.im - t| + |t| ≤ 2 * deltaz_t t + |t| := add_le_add_left h_im_sub _ ++ have hfinal : |z.im| ≤ 2 * deltaz_t t + |t| := le_trans tri this ++ simpa [add_comm] using hfinal ++ ++lemma helper_log_le_two_log_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) ++ (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : ++ Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by ++ ++ have h_abs : |z.im| ≤ |t| + 2 * deltaz_t t := ++ helper_absIm_le_add_smallball t z hz ++ ++ set a : ℝ := |t| + 2 ++ have h1 : |z.im| + 2 ≤ a + 2 * deltaz_t t := by ++ have := add_le_add_left h_abs (2 : ℝ) ++ simpa [a, add_comm, add_left_comm, add_assoc] using this ++ ++ have ht2 : |t| > 2 := by linarith ++ have hδ : 0 < deltaz_t t ∧ deltaz_t t < 1 / 9 := (lem_delta19).2 t ht2 ++ have hδlt : deltaz_t t < 1 / 9 := hδ.2 ++ ++ have h_two_delta_le_one : 2 * deltaz_t t ≤ 1 := by ++ have hle : deltaz_t t ≤ 1 / 9 := le_of_lt hδlt ++ have hmul : 2 * deltaz_t t ≤ 2 * (1 / 9 : ℝ) := ++ mul_le_mul_of_nonneg_left hle (by norm_num) ++ have : 2 * (1 / 9 : ℝ) ≤ 1 := by norm_num ++ exact le_trans hmul this ++ have h2 : a + 2 * deltaz_t t ≤ a + 1 := add_le_add_right h_two_delta_le_one a ++ ++ have ha_ge_two : (2 : ℝ) ≤ a := by ++ have : 0 ≤ |t| := abs_nonneg t ++ linarith [this] ++ have ha_ge_one : (1 : ℝ) ≤ a := le_trans (by norm_num) ha_ge_two ++ have h_a_plus_one_le_two_a : a + 1 ≤ a + a := by ++ simpa using add_le_add_right ha_ge_one a ++ have h_nonneg_a : 0 ≤ a := le_trans (by norm_num) ha_ge_two ++ have h_2a_le_a2 : (2 : ℝ) * a ≤ a ^ 2 := by ++ have : (2 : ℝ) * a ≤ a * a := mul_le_mul_of_nonneg_right ha_ge_two h_nonneg_a ++ simpa [pow_two] using this ++ have h_a1_le_a2 : a + 1 ≤ a ^ 2 := ++ le_trans h_a_plus_one_le_two_a (by simpa [two_mul] using h_2a_le_a2) ++ ++ have h_total : |z.im| + 2 ≤ a ^ 2 := le_trans (le_trans h1 h2) h_a1_le_a2 ++ ++ have hxpos : 0 < |z.im| + 2 := by ++ have : 0 ≤ |z.im| := abs_nonneg _ ++ linarith ++ have hlog := Real.log_le_log hxpos h_total ++ calc ++ Real.log (|z.im| + 2) ≤ Real.log (a ^ 2) := hlog ++ _ = (2 : ℝ) * Real.log a := by simp ++ _ = 2 * Real.log (|t| + 2) := by simp [a] ++ ++lemma helper_one_div_log_le_two_div_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) ++ (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : ++ (1 : ℝ) / Real.log (|t| + 2) ≤ 2 / Real.log (|z.im| + 2) := by ++ ++ have ht_pos1 : 1 < |t| + 2 := by linarith [abs_nonneg t] ++ have hz_pos1 : 1 < |z.im| + 2 := by linarith [abs_nonneg z.im] ++ have log_t_pos : 0 < Real.log (|t| + 2) := Real.log_pos ht_pos1 ++ have log_z_pos : 0 < Real.log (|z.im| + 2) := Real.log_pos hz_pos1 ++ ++ have h_norm : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz ++ have center_im : (1 - deltaz_t t + t * Complex.I).im = t := by ++ simp [Complex.add_im] ++ have diff_im : (z - (1 - deltaz_t t + t * Complex.I)).im = z.im - t := by ++ simp [Complex.sub_im, center_im] ++ have h1 : |z.im - t| ≤ ‖z - (1 - deltaz_t t + t * Complex.I)‖ := by ++ simpa [diff_im] using Complex.abs_im_le_norm (z - (1 - deltaz_t t + t * Complex.I)) ++ have h2 : |z.im - t| ≤ 2 * deltaz_t t := h1.trans h_norm ++ have hz_im_le : |z.im| ≤ |z.im - t| + |t| := by ++ ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using! abs_add_le (z.im - t) t ++ have hz_im_le2 : |z.im| ≤ 2 * deltaz_t t + |t| := hz_im_le.trans (add_le_add_left h2 _) ++ have hz_add2_le1 : |z.im| + 2 ≤ (2 * deltaz_t t + |t|) + 2 := add_le_add_left hz_im_le2 2 ++ ++ have hdelta_lt_one : deltaz_t t < 1 := by ++ have hlt19 : deltaz_t t < 1 / 9 := ++ ((lem_delta19).2 t (by linarith : |t| > 2)).2 ++ exact lt_trans hlt19 (by norm_num) ++ have h2delta_le_two : 2 * deltaz_t t ≤ 2 := by ++ have hle : deltaz_t t ≤ 1 := le_of_lt hdelta_lt_one ++ have := mul_le_mul_of_nonneg_left hle (by norm_num : (0 : ℝ) ≤ 2) ++ simpa using this ++ have htwo_le : (2 : ℝ) ≤ |t| + 2 := by linarith [abs_nonneg t] ++ have h2delta_le_tplus2 : 2 * deltaz_t t ≤ |t| + 2 := le_trans h2delta_le_two htwo_le ++ have step_mid : (2 * deltaz_t t + |t|) + 2 ≤ ((|t| + 2) + |t|) + 2 := by ++ have := add_le_add_left (add_le_add_left h2delta_le_tplus2 |t|) 2 ++ simpa [add_comm, add_left_comm, add_assoc] using this ++ have hz_plus2_le : |z.im| + 2 ≤ (|t| + 2) + |t| + 2 := le_trans hz_add2_le1 step_mid ++ have hz_im_bound_final : |z.im| + 2 ≤ 2 * (|t| + 2) := by ++ ++ simpa [two_mul, add_comm, add_left_comm, add_assoc] using hz_plus2_le ++ ++ have hxpos : 0 < |z.im| + 2 := by linarith [abs_nonneg z.im] ++ have hlog_step : Real.log (|z.im| + 2) ≤ Real.log (2 * (|t| + 2)) := ++ Real.log_le_log hxpos hz_im_bound_final ++ have hlog_mul : Real.log (2 * (|t| + 2)) = Real.log 2 + Real.log (|t| + 2) := by ++ have hneet : (|t| + 2) ≠ 0 := ne_of_gt (lt_trans (by norm_num) ht_pos1) ++ simpa using Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) hneet ++ have hlog2_le_logt : Real.log 2 ≤ Real.log (|t| + 2) := by ++ have h2lt : 0 < (2 : ℝ) := by norm_num ++ have h2le : (2 : ℝ) ≤ |t| + 2 := by linarith [abs_nonneg t] ++ exact Real.log_le_log h2lt h2le ++ have hlog_le_two : Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by ++ have : Real.log (|z.im| + 2) ≤ Real.log 2 + Real.log (|t| + 2) := by ++ simpa [hlog_mul] using hlog_step ++ have : Real.log (|z.im| + 2) ≤ Real.log (|t| + 2) + Real.log (|t| + 2) := ++ this.trans (add_le_add_left hlog2_le_logt _) ++ simpa [two_mul] using this ++ ++ have h' : 1 * Real.log (|z.im| + 2) ≤ 2 * Real.log (|t| + 2) := by ++ simpa [one_mul] using hlog_le_two ++ simpa [one_mul] using (div_le_div_iff₀ log_t_pos log_z_pos).mpr h' ++ ++lemma helper_deltaz_t_le_two_deltaz_smallball (t : ℝ) (ht : |t| > 3) (z : ℂ) ++ (hz : z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t)) : ++ deltaz_t t ≤ 2 * deltaz z := by ++ ++ have h_recip := helper_one_div_log_le_two_div_smallball t ht z hz ++ ++ have hpos_const : 0 ≤ zerofree_constant / 20 := by ++ have hpos : 0 < zerofree_constant := zerofree_constant_pos ++ have h20 : 0 < (20 : ℝ) := by norm_num ++ exact div_nonneg (le_of_lt hpos) (le_of_lt h20) ++ ++ have h_mul := mul_le_mul_of_nonneg_left h_recip hpos_const ++ ++ calc ++ deltaz_t t ++ = (zerofree_constant / 20) / Real.log (|t| + 2) := by ++ simp [deltaz_t, deltaz] ++ _ = (zerofree_constant / 20) * (1 / Real.log (|t| + 2)) := by ++ simp [div_eq_mul_inv] ++ _ ≤ (zerofree_constant / 20) * (2 / Real.log (|z.im| + 2)) := by ++ simpa [one_div, div_eq_mul_inv] using h_mul ++ _ = 2 * ((zerofree_constant / 20) * (1 / Real.log (|z.im| + 2))) := by ++ ring ++ _ = 2 * deltaz z := by ++ simp [deltaz, div_eq_mul_inv] ++ ++lemma lem_DRez6dz : ++ ∀ t : ℝ, |t| > 3 → ∀ z ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t), ++ z.re ≥ 1 - 6 * deltaz z := by ++ intro t ht z hz ++ ++ have h_ball : ‖z - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by ++ simpa [Metric.mem_closedBall, Complex.dist_eq] using hz ++ ++ have h_re_absle : |(z - (1 - deltaz_t t + t * Complex.I)).re| ≤ 2 * deltaz_t t := ++ (Complex.abs_re_le_norm _).trans h_ball ++ have h_re_absle' : |z.re - (1 - deltaz_t t)| ≤ 2 * deltaz_t t := by ++ simpa [Complex.sub_re] using h_re_absle ++ ++ have h_lower : z.re - (1 - deltaz_t t) ≥ -(2 * deltaz_t t) := by ++ have := (abs_le).1 h_re_absle' ++ exact this.1 ++ ++ have h3 : z.re ≥ 1 - 3 * deltaz_t t := by ++ linarith ++ ++ have h_dt_le : deltaz_t t ≤ 2 * deltaz z := ++ helper_deltaz_t_le_two_deltaz_smallball t ht z hz ++ ++ have h_mult : 3 * deltaz_t t ≤ 6 * deltaz z := by ++ have h := mul_le_mul_of_nonneg_left h_dt_le (by norm_num : (0 : ℝ) ≤ 3) ++ calc ++ 3 * deltaz_t t ≤ 3 * (2 * deltaz z) := h ++ _ = 6 * deltaz z := by ring ++ ++ have h_final : 1 - 3 * deltaz_t t ≥ 1 - 6 * deltaz z := by ++ linarith [h_mult] ++ ++ exact le_trans h_final h3 ++ ++lemma lem_YinD : ++ ∀ t : ℝ, |t| > 3 → ++ Yt t (deltaz_t t) ⊆ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t) := by ++ intro t ht z hz ++ rcases hz with ⟨hzero, habs⟩ ++ have hdist : dist z (1 - deltaz_t t + t * Complex.I) ≤ 2 * deltaz_t t := by ++ simpa [Complex.dist_eq] using habs ++ exact Metric.mem_closedBall.mpr hdist ++ ++theorem lem_rhoYzero (t : ℝ) (δ : ℝ) (ρ_1 : ℂ) (h_rho_1_in_Yt : ρ_1 ∈ Yt t δ) : ++ riemannZeta ρ_1 = 0 := by ++ ++ unfold Yt at h_rho_1_in_Yt ++ ++ exact h_rho_1_in_Yt.1 ++ ++theorem lem_absReabs (w : ℂ) : |w.re| ≤ ‖w‖ := by ++ exact Complex.abs_re_le_norm w ++ ++theorem lem_zRe (t : ℝ) (δ : ℝ) (z : ℂ) : |(z - (1 - δ + t * Complex.I)).re| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := by ++ apply lem_absReabs ++ ++theorem lem_zRe2 (t : ℝ) (δ : ℝ) (z : ℂ) ++ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : ++ |(z - (1 - δ + t * Complex.I)).re| ≤ 2 * δ := by ++ have h1 : |(z - (1 - δ + t * Complex.I)).re| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := lem_zRe t δ z ++ exact le_trans h1 h_le ++ ++theorem lem_Rezit (t : ℝ) (δ : ℝ) (z : ℂ) : ++ (z - (1 - δ + t * Complex.I)).re = z.re - (1 - δ) := by ++ rw [Complex.sub_re] ++ ++ rw [Complex.add_re] ++ ++ rw [Complex.sub_re, Complex.one_re, Complex.ofReal_re] ++ ++ rw [Complex.mul_re, Complex.I_re, Complex.I_im, Complex.ofReal_im] ++ ++ simp ++ ++theorem lem_zRe3 (t : ℝ) (δ : ℝ) (z : ℂ) ++ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : ++ |z.re - (1 - δ)| ≤ 2 * δ := by ++ ++ have h1 : |(z - (1 - δ + t * Complex.I)).re| ≤ 2 * δ := ++ lem_zRe2 t δ z h_le ++ ++ have hRe : (z - (1 - δ + t * Complex.I)).re = z.re - (1 - δ) := ++ lem_Rezit t δ z ++ simpa [hRe] using h1 ++ ++theorem lem_negleabs (a : ℝ) (b : ℝ) (h_abs : |a| ≤ b) : a ≥ -b := by ++ rw [abs_le] at h_abs ++ exact h_abs.1 ++ ++theorem lem_absrez1d (δ : ℝ) (z : ℂ) ++ (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : ++ z.re - (1 - δ) ≥ - (2 * δ) := by ++ exact lem_negleabs (z.re - (1 - δ)) (2 * δ) h_le ++ ++theorem lem_absrez1d2 (δ : ℝ) (z : ℂ) ++ (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : ++ z.re ≥ 1 - 3 * δ := by ++ ++ have hneg : z.re - (1 - δ) ≥ - (2 * δ) := ++ lem_absrez1d δ z h_le ++ ++ have : z.re ≥ 1 - δ - 2 * δ := by linarith ++ ++ convert this using 1 ++ ring ++theorem lem_absrez1d3 (δ : ℝ) (z : ℂ) (hδ : δ > 0) ++ (h_le : |z.re - (1 - δ)| ≤ 2 * δ) : ++ z.re > 1 - 4 * δ := by ++ have h1 : z.re ≥ 1 - 3 * δ := lem_absrez1d2 δ z h_le ++ linarith [h1, hδ] ++ ++theorem lem_zRe4 (t : ℝ) (δ : ℝ) (hδ : δ > 0) (z : ℂ) ++ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : ++ z.re > 1 - 4 * δ := by ++ have h1 : |z.re - (1 - δ)| ≤ 2 * δ := lem_zRe3 t δ z h_le ++ exact lem_absrez1d3 δ z hδ h1 ++ ++lemma riemannZeta_no_zeros_left_halfplane_off_real_axis (s : ℂ) (h_re : s.re ≤ 0) (h_im : s.im ≠ 0) : riemannZeta s ≠ 0 := by ++ ++ intro h_zero ++ ++ have hs_not_neg_nat : ∀ n : ℕ, s ≠ -n := by ++ intro n h_eq ++ ++ have : s.im = 0 := by ++ rw [h_eq] ++ rw [Complex.neg_im] ++ simp ++ exact h_im this ++ ++ have hs_not_one : s ≠ 1 := by ++ intro h_eq ++ ++ have : s.re = 1 := by ++ rw [h_eq] ++ exact Complex.one_re ++ linarith [h_re, this] ++ ++ have functional_eq := riemannZeta_one_sub hs_not_neg_nat hs_not_one ++ ++ rw [h_zero] at functional_eq ++ simp at functional_eq ++ ++ have h1s_re_ge_1 : (1 - s).re ≥ 1 := by ++ rw [Complex.sub_re, Complex.one_re] ++ linarith [h_re] ++ ++ have h1s_nonzero : riemannZeta (1 - s) ≠ 0 := by ++ apply riemannZeta_ne_zero_of_one_le_re ++ exact h1s_re_ge_1 ++ ++ exact h1s_nonzero functional_eq ++ ++lemma lem_Imzit (t : ℝ) (δ : ℝ) (z : ℂ) : ++ (z - (1 - δ + t * Complex.I)).im = z.im - t := by ++ have him : (1 - δ + t * Complex.I).im = t := by ++ simp [Complex.add_im, Complex.mul_im] ++ simp [Complex.sub_im, him] ++ ++lemma lem_zIm2 (t : ℝ) (δ : ℝ) (z : ℂ) ++ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : ++ |(z - (1 - δ + t * Complex.I)).im| ≤ 2 * δ := by ++ have : |(z - (1 - δ + t * Complex.I)).im| ≤ ‖(z - (1 - δ + t * Complex.I))‖ := ++ Complex.abs_im_le_norm (z - (1 - δ + t * Complex.I)) ++ exact le_trans this h_le ++ ++lemma lem_zIm3 (t : ℝ) (δ : ℝ) (z : ℂ) ++ (h_le : ‖(z - (1 - δ + t * Complex.I))‖ ≤ 2 * δ) : ++ |z.im - t| ≤ 2 * δ := by ++ have h1 : |(z - (1 - δ + t * Complex.I)).im| ≤ 2 * δ := ++ lem_zIm2 t δ z h_le ++ have him : (z - (1 - δ + t * Complex.I)).im = z.im - t := ++ lem_Imzit t δ z ++ simpa [him] using h1 ++ ++lemma abs_le_add_of_abs_sub_le {a b ε : ℝ} (h : |a - b| ≤ ε) : ++ |a| ≤ |b| + ε := by ++ calc ++ |a| = |b + (a - b)| := by ++ simp [sub_eq_add_neg, add_left_comm] ++ _ ≤ |b| + |a - b| := by ++ simpa [sub_eq_add_neg] using! abs_add_le b (a - b) ++ _ ≤ |b| + ε := by ++ exact add_le_add_right h _ ++ ++lemma log_add_lt_log_add_div {x y : ℝ} (hx : 0 < x) (hy : 0 < y) : ++ Real.log (x + y) < Real.log x + y / x := by ++ have hxne : x ≠ 0 := ne_of_gt hx ++ have hxy_pos : 0 < x + y := add_pos hx hy ++ have hxy_ne : x + y ≠ 0 := ne_of_gt hxy_pos ++ have hy_div_pos : 0 < y / x := div_pos hy hx ++ have hdiv_eq : (x + y) / x = 1 + y / x := by ++ have : (x + y) / x = x / x + y / x := by simp [add_div] ++ simpa [div_self hxne] using this ++ have hgt1 : 1 < (x + y) / x := by ++ have : 1 < 1 + y / x := by linarith [hy_div_pos] ++ simpa [hdiv_eq] using this ++ have hposu : 0 < (x + y) / x := lt_trans zero_lt_one hgt1 ++ have hne1 : (x + y) / x ≠ 1 := ne_of_gt hgt1 ++ have hloglt : Real.log ((x + y) / x) < (x + y) / x - 1 := ++ Real.log_lt_sub_one_of_pos hposu hne1 ++ have hrhs : (x + y) / x - 1 = y / x := by ++ have : (1 + y / x) - 1 = y / x := by ++ simp ++ simp [hdiv_eq] ++ have hldiv : Real.log ((x + y) / x) = Real.log (x + y) - Real.log x := ++ Real.log_div hxy_ne hxne ++ have hcore : Real.log (x + y) - Real.log x < y / x := by ++ simpa [hldiv, hrhs] using hloglt ++ have := add_lt_add_left hcore (Real.log x) ++ simpa [sub_add_cancel, add_comm, add_left_comm, add_assoc] using this ++ ++lemma abs_le_add_of_abs_sub_le' {a b ε : ℝ} (h : |a - b| ≤ ε) : ++ |a| ≤ |b| + ε := by ++ calc ++ |a| = |b + (a - b)| := by ++ simp [sub_eq_add_neg, add_left_comm] ++ _ ≤ |b| + |a - b| := by ++ simpa [sub_eq_add_neg] using! abs_add_le b (a - b) ++ _ ≤ |b| + ε := by ++ exact add_le_add_right h _ ++ ++lemma delta_half_eq (c t : ℝ) : ++ ((c / 2) / Real.log (|t| + 2)) / 2 = (c / 4) / Real.log (|t| + 2) := by ++ ++ have hx : ++ ((c * (1 / 2)) * ((Real.log (|t| + 2))⁻¹)) * (1 / 2) ++ = (c * (1 / 4)) * ((Real.log (|t| + 2))⁻¹) := by ++ ring ++ simpa [div_eq_mul_inv] using hx ++ ++lemma log_abs_im_le (t t1 δ : ℝ) (h : |t1 - t| ≤ δ) : ++ Real.log (|t1| + 2) ≤ Real.log (|t| + 2) + δ / (|t| + 2) := by ++ ++ have hx1pos : 0 < |t1| + 2 := by ++ have : (0 : ℝ) ≤ |t1| := abs_nonneg t1 ++ linarith ++ have hxpos : 0 < |t| + 2 := by ++ have : (0 : ℝ) ≤ |t| := abs_nonneg t ++ linarith ++ have hxnonneg : 0 ≤ |t| + 2 := le_of_lt hxpos ++ ++ have habs : |t1| ≤ |t| + |t1 - t| := by ++ have htri : |(t1 - t) + t| ≤ |t1 - t| + |t| := abs_add_le (t1 - t) t ++ simpa [sub_add_cancel, add_comm] using htri ++ ++ have hxy : |t1| + 2 ≤ (|t| + 2) + |t1 - t| := by ++ have := add_le_add_left habs 2 ++ simpa [add_comm, add_left_comm, add_assoc] using this ++ ++ have hlog1 : Real.log (|t1| + 2) ≤ Real.log ((|t| + 2) + |t1 - t|) := ++ Real.log_le_log hx1pos hxy ++ ++ have hy_nonneg : 0 ≤ |t1 - t| := abs_nonneg (t1 - t) ++ have hlog2 : Real.log ((|t| + 2) + |t1 - t|) ++ ≤ Real.log (|t| + 2) + |t1 - t| / (|t| + 2) := by ++ by_cases hpos : 0 < |t1 - t| ++ · exact le_of_lt (log_add_lt_log_add_div hxpos hpos) ++ · have heq : |t1 - t| = 0 := le_antisymm (le_of_not_gt hpos) hy_nonneg ++ have : Real.log (|t| + 2) ≤ Real.log (|t| + 2) := le_rfl ++ simp [heq] ++ ++ have hdiv : |t1 - t| / (|t| + 2) ≤ δ / (|t| + 2) := ++ div_le_div_of_nonneg_right h hxnonneg ++ have hadd := add_le_add_right hdiv (Real.log (|t| + 2)) ++ exact le_trans (le_trans hlog1 hlog2) hadd ++ ++lemma combine_re_bounds_to_c_over_log_le {ρre c δ L1 : ℝ} ++ (h_ge : ρre ≥ 1 - (3 / 2) * δ) (h_le : ρre ≤ 1 - c / L1) : ++ c / L1 ≤ (3 / 2) * δ := by ++ ++ have h : 1 - (3 / 2) * δ ≤ 1 - c / L1 := le_trans h_ge h_le ++ ++ have h' := sub_le_sub_right h (1 : ℝ) ++ ++ have h'' : -((3 / 2) * δ) ≤ -(c / L1) := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using h' ++ ++ simpa using (neg_le_neg_iff.mp h'') ++ ++lemma core_contradiction2 {L t c δ : ℝ} ++ (hLpos : 0 < L) (hpos : 0 < |t| + 2) ++ (hδ : δ = (c / 2) / L) ++ (h : L ≤ (3 / 2) * δ / (|t| + 2)) : ++ L ^ 2 * (|t| + 2) ≤ 3 * c / 4 := by ++ ++ have h1' := (mul_le_mul_of_nonneg_right h (le_of_lt hpos)) ++ ++ have hbne : (|t| + 2) ≠ 0 := ne_of_gt hpos ++ have rhs_eq : ((3 / 2) * δ / (|t| + 2)) * (|t| + 2) = (3 / 2) * δ := by ++ calc ++ ((3 / 2) * δ / (|t| + 2)) * (|t| + 2) ++ = ((3 / 2) * δ) * ((1 / (|t| + 2)) * (|t| + 2)) := by ++ simp [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] ++ _ = ((3 / 2) * δ) * 1 := by ++ simp [hbne] ++ _ = (3 / 2) * δ := by ++ ring ++ have h1 : L * (|t| + 2) ≤ (3 / 2) * δ := by ++ simpa [rhs_eq] using h1' ++ ++ have h2 := (mul_le_mul_of_nonneg_left h1 (le_of_lt hLpos)) ++ have h3 : L ^ 2 * (|t| + 2) ≤ (3 / 2) * (δ * L) := by ++ simpa [pow_two, mul_left_comm, mul_assoc, mul_comm] using h2 ++ ++ have hLne : L ≠ 0 := ne_of_gt hLpos ++ have hδL : δ * L = c / 2 := by ++ calc ++ δ * L = ((c / 2) / L) * L := by simp [hδ] ++ _ = (c / 2) * ((L⁻¹) * L) := by ++ simp [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] ++ _ = (c / 2) * 1 := by ++ simp [hLne] ++ _ = c / 2 := by simp ++ have h4 : L ^ 2 * (|t| + 2) ≤ (3 / 2) * (c / 2) := by ++ simpa [hδL] using h3 ++ ++ have h5 : (3 / 2 : ℝ) * (c / 2) = 3 * c / 4 := by ++ ring ++ simpa [h5] using h4 ++ ++lemma abs_lower_bound_sub (x y : ℝ) : |x| ≥ |y| - |x - y| := by ++ ++ have h' : |y| ≤ |x| + |y - x| := by ++ have htriv : |y - x| ≤ |y - x| := le_rfl ++ simpa [sub_eq_add_neg] using ++ (abs_le_add_of_abs_sub_le' (a := y) (b := x) (ε := |y - x|) htriv) ++ ++ have h1 : |y| ≤ |x| + |x - y| := by simpa [abs_sub_comm] using h' ++ ++ simpa [ge_iff_le] using (sub_le_iff_le_add).2 h1 ++ ++lemma abs_im_ge_T0_from_close {t : ℝ} {ρ : ℂ} {δ T0 : ℝ} ++ (hclose : |ρ.im - t| ≤ 2 * δ) (hineq : |t| - 2 * δ ≥ T0) : ++ T0 ≤ |ρ.im| := by ++ have h1 : |ρ.im| ≥ |t| - |ρ.im - t| := by ++ simpa [sub_eq_add_neg, abs_sub_comm] using (abs_lower_bound_sub ρ.im t) ++ have : |ρ.im| ≥ |t| - 2 * δ := by ++ exact ge_trans h1 (by ++ ++ gcongr) ++ exact le_trans hineq this ++ ++lemma lem_Kzetaempty : ++ ∀ t : ℝ, |t| > 3 → ++ Yt t (deltaz_t t) = ∅ := by ++ intro t ht ++ ++ rw [Set.eq_empty_iff_forall_notMem] ++ intro ρ_1 h_mem ++ ++ have h_zero : riemannZeta ρ_1 = 0 := lem_rhoYzero t (deltaz_t t) ρ_1 h_mem ++ ++ have h_norm : ‖ρ_1 - (1 - deltaz_t t + t * Complex.I)‖ ≤ 2 * deltaz_t t := by ++ exact h_mem.2 ++ ++ have h_im_bound : |ρ_1.im - t| ≤ 2 * deltaz_t t := by ++ exact lem_zIm3 t (deltaz_t t) ρ_1 h_norm ++ ++ have h_delta_small : deltaz_t t < 1/9 := by ++ have h_bounds := lem_delta19 ++ exact (h_bounds.2 t (by linarith [ht])).2 ++ ++ have h_im_large : 2 < |ρ_1.im| := by ++ ++ have h_tri : |ρ_1.im| ≥ |t| - |ρ_1.im - t| := by ++ exact abs_lower_bound_sub ρ_1.im t ++ have h_bound : |ρ_1.im| ≥ |t| - 2 * deltaz_t t := by ++ exact ge_trans h_tri (by gcongr) ++ have h_small_delta : 2 * deltaz_t t < 2/9 := by ++ linarith [h_delta_small] ++ have h_final : |t| - 2 * deltaz_t t > 3 - 2/9 := by ++ linarith [ht, h_small_delta] ++ have h_gt_2 : 3 - 2/9 > 2 := by norm_num ++ linarith [h_bound, h_final, h_gt_2] ++ ++ have h_in_ball : ρ_1 ∈ Metric.closedBall (1 - deltaz_t t + t * Complex.I) (2 * deltaz_t t) := by ++ exact Metric.mem_closedBall.mpr (by simpa only [dist_eq_norm] using! h_norm) ++ ++ have h_re_bound : ρ_1.re ≥ 1 - 6 * deltaz ρ_1 := by ++ exact lem_DRez6dz t ht ρ_1 h_in_ball ++ ++ have h_delta_pos : 0 < deltaz ρ_1 := by ++ have h_bounds := lem_delta19 ++ exact (h_bounds.1 ρ_1 (by linarith [h_im_large])).1 ++ ++ have h_re_strict : ρ_1.re > 1 - 9 * deltaz ρ_1 := by ++ linarith [h_re_bound, h_delta_pos] ++ ++ have h_nonzero : riemannZeta ρ_1 ≠ 0 := by ++ exact lem_ZFRdelta ρ_1 h_im_large h_re_strict ++ ++ exact h_nonzero h_zero ++ ++lemma Yt_subset_closedBall (t : ℝ) (δ : ℝ) : ++ Yt t δ ⊆ Metric.closedBall (1 - δ + t * Complex.I) (2 * δ) := by ++ ++ intro ρ_1 hρ_1 ++ ++ unfold Yt at hρ_1 ++ ++ obtain ⟨_, h_abs⟩ := hρ_1 ++ ++ rw [Metric.mem_closedBall] ++ ++ rw [Complex.dist_eq] ++ ++ exact h_abs ++ ++lemma Yt_finite (t : ℝ) (δ : ℝ) : (Yt t δ).Finite := by ++ ++ have h_subset := Yt_subset_closedBall t δ ++ ++ let K := Metric.closedBall (1 - δ + t * Complex.I) (2 * δ) ++ have h_compact : IsCompact K := closedBall_compact_complex (1 - δ + t * Complex.I) (2 * δ) ++ ++ have h_zeros_finite := riemannZeta_zeros_finite_of_compact K h_compact ++ ++ have h_sub : Yt t δ ⊆ {z ∈ K | riemannZeta z = 0} := by ++ intro ρ hρ ++ ++ constructor ++ · ++ exact h_subset hρ ++ · ++ unfold Yt at hρ ++ exact hρ.1 ++ ++ exact Set.Finite.subset h_zeros_finite h_sub ++ ++lemma lem_sumempty (g : ℂ → ℂ) : (∑ s ∈ (∅ : Finset ℂ), g s) = 0 := by ++ rfl ++ ++lemma lem_Ksumempty : ++ ∀ t : ℝ, |t| > 3 → ++ (∑ ρ_1 ∈ (Yt_finite t (deltaz_t t)).toFinset, ((analyticOrderAt riemannZeta ρ_1).toNat : ℂ) / (1 - (deltaz_t t) + t * Complex.I - ρ_1)) = 0 := by ++ intro t ht ++ ++ have h_empty : Yt t (deltaz_t t) = ∅ := lem_Kzetaempty t ht ++ ++ have h_finset_empty : (Yt_finite t (deltaz_t t)).toFinset = ∅ := by ++ rw [Set.Finite.toFinset_eq_empty] ++ exact h_empty ++ ++ rw [h_finset_empty] ++ exact lem_sumempty _ ++ ++lemma norm_div_cast_vonMangoldt (s : ℂ) : ++ (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) ++ = (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by ++ funext n ++ simp [Complex.norm_real, Real.norm_eq_abs] ++ ++lemma ArithmeticFunction.summable_vonMangoldt_norm_rw {s : ℂ} : ++ Summable (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) ++ ↔ Summable (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by ++ classical ++ have hfun : ++ (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) ++ = (fun n : ℕ => (|ArithmeticFunction.vonMangoldt n|) / ‖(n : ℂ) ^ s‖) := by ++ funext n ++ simp [Complex.norm_real, div_eq_mul_inv] ++ simp ++ ++lemma lem_norm_cpow_nat (n : ℕ) (s : ℂ) (hn : 1 ≤ n) : ‖(n : ℂ) ^ s‖ = (n : ℝ) ^ s.re := by ++ have hpos : 0 < (n : ℝ) := ++ lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) (by exact_mod_cast hn) ++ simpa using (Complex.norm_cpow_eq_rpow_re_of_pos (x := (n : ℝ)) hpos s) ++ ++lemma lem_vonMangoldt_nonneg (n : ℕ) : 0 ≤ (ArithmeticFunction.vonMangoldt n) := by ++ simp ++ ++lemma lem_term_real_nonneg (n : ℕ) (σ : ℝ) (_hσ : 1 < σ) : ∃ r ≥ (0:ℝ), ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = (r : ℂ) := by ++ ++ let r : ℝ := (ArithmeticFunction.vonMangoldt n) / ((n : ℝ) ^ σ) ++ refine ⟨r, ?_, ?_⟩ ++ · ++ have hbase_nonneg : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) ++ have hden_nonneg : 0 ≤ (n : ℝ) ^ σ := by ++ simpa using (Real.rpow_nonneg hbase_nonneg σ) ++ ++ have hv_nonneg : 0 ≤ (ArithmeticFunction.vonMangoldt n) := by ++ simp ++ have : 0 ≤ (ArithmeticFunction.vonMangoldt n) * ((n : ℝ) ^ σ)⁻¹ := ++ mul_nonneg hv_nonneg (inv_nonneg.mpr hden_nonneg) ++ simpa [r, div_eq_mul_inv] using this ++ · ++ have hbase_nonneg : 0 ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) ++ have hden_eq : (((n : ℝ) ^ σ : ℝ) : ℂ) = (n : ℂ) ^ (σ : ℂ) := by ++ simpa using (Complex.ofReal_cpow (x := (n : ℝ)) (hx := hbase_nonneg) (y := σ)) ++ calc ++ ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) ++ = ((ArithmeticFunction.vonMangoldt n : ℂ) / (((n : ℝ) ^ σ : ℝ) : ℂ)) := by ++ simp [hden_eq.symm] ++ _ = (((ArithmeticFunction.vonMangoldt n : ℝ) / ((n : ℝ) ^ σ)) : ℝ) := by ++ simp ++ _ = (r : ℂ) := by rfl ++ ++lemma lem_tsum_norm_vonMangoldt_depends_on_Re (s : ℂ) (σ : ℝ) (hσ : σ = s.re) (_hs : 1 < s.re) : ++ (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) = ++ (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by ++ classical ++ ++ have hfun : (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ s)‖) ++ = (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by ++ funext n ++ by_cases h0 : n = 0 ++ · ++ subst h0 ++ simp [ArithmeticFunction.vonMangoldt] ++ simp only [_root_.ite_eq_right (not_isPrimePow_zero (R := ℕ)), abs_zero, zero_div] ++ · ++ have hn0C : (n : ℂ) ≠ 0 := by ++ exact_mod_cast (Nat.cast_ne_zero.mpr h0) ++ have harg : Complex.arg (n : ℂ) = 0 := by ++ have : (0 : ℝ) ≤ (n : ℝ) := by exact_mod_cast (Nat.zero_le n) ++ simp ++ ++ have hden_s : ‖(n : ℂ) ^ s‖ = ‖(n : ℂ)‖ ^ s.re := by ++ ++ simpa [harg, Real.exp_zero, div_one] using ++ (Complex.norm_cpow_of_ne_zero (z := (n : ℂ)) (w := s) hn0C) ++ have hden_σ : ‖(n : ℂ) ^ (σ : ℂ)‖ = ‖(n : ℂ)‖ ^ σ := by ++ simp ++ ++ simp [hden_s, hσ] ++ ++ have htsum := congrArg (fun f : ℕ → ℝ => (∑' n, f n)) hfun ++ simpa using htsum ++ ++lemma helper_LSeries_vonMangoldt_tsum (σ : ℝ) (hσ : 1 < σ) : ++ (∑' n : ℕ, (ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = ++ - deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ) := by ++ have hs : 1 < (σ : ℂ).re := by simpa using hσ ++ have h0 : ((fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ)) 0) = 0 := by simp ++ simpa [LSeries, LSeries.term_def₀ (f := fun n : ℕ => (ArithmeticFunction.vonMangoldt n : ℂ)) h0, ++ Complex.cpow_neg, div_eq_mul_inv] using ++ (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := (σ : ℂ)) hs) ++ ++lemma summable_ofReal_iff {f : ℕ → ℝ} : Summable (fun n => (f n : ℂ)) ↔ Summable f := by ++ simp ++ ++lemma helper_summable_of_summable_norm {u : ℕ → ℂ} ++ (h : Summable (fun n => ‖u n‖)) : Summable u := by ++ simpa using (Summable.of_norm (f := u) h) ++ ++lemma helper_norm_tsum_eq_tsum_norm_of_nonneg_real {u : ℕ → ℂ} {r : ℕ → ℝ} ++ (h : ∀ n, u n = (r n : ℂ)) (hr : ∀ n, 0 ≤ r n) (_hu : Summable u) : ++ ‖(∑' n, u n)‖ = ∑' n, ‖u n‖ := by ++ classical ++ ++ have hsum_eq_ofReal : (∑' n, (r n : ℂ)) = ((∑' n, r n : ℝ) : ℂ) := by ++ simpa using (Complex.ofReal_tsum r).symm ++ have hrewrite_u : ‖∑' n, u n‖ = ‖∑' n, (r n : ℂ)‖ := by ++ have hfun : u = (fun n => (r n : ℂ)) := funext h ++ simp [hfun] ++ have hnorm_abs : ‖((∑' n, r n : ℝ) : ℂ)‖ = |∑' n, r n| := by ++ simp [Real.norm_eq_abs] ++ ++ have hLHS : ‖∑' n, u n‖ = |∑' n, r n| := by ++ simp [hrewrite_u, hsum_eq_ofReal] ++ ++ have hsum_nonneg : 0 ≤ ∑' n, r n := tsum_nonneg hr ++ have habs_sum : |∑' n, r n| = ∑' n, r n := abs_of_nonneg hsum_nonneg ++ ++ have hfunEq : (fun n => ‖u n‖) = (fun n => ‖(r n : ℂ)‖) := by ++ funext n; simp [h n] ++ have hfunEq2 : (fun n => ‖(r n : ℂ)‖) = (fun n => r n) := by ++ funext n ++ have : ‖(r n : ℂ)‖ = ‖r n‖ := by simp ++ have : ‖r n‖ = |r n| := by simp ++ have : |r n| = r n := abs_of_nonneg (hr n) ++ simp [this] ++ have hsum_norms1 : (∑' n, ‖u n‖) = ∑' n, ‖(r n : ℂ)‖ := ++ congrArg (fun f : ℕ → ℝ => ∑' n, f n) hfunEq ++ have hsum_norms2 : (∑' n, ‖(r n : ℂ)‖) = ∑' n, r n := ++ congrArg (fun f : ℕ → ℝ => ∑' n, f n) hfunEq2 ++ have hRHS : (∑' n, ‖u n‖) = ∑' n, r n := hsum_norms1.trans hsum_norms2 ++ ++ calc ++ ‖(∑' n, u n)‖ = |∑' n, r n| := hLHS ++ _ = ∑' n, r n := habs_sum ++ _ = ∑' n, ‖u n‖ := by simp [hRHS] ++ ++lemma lem_norm_logDeriv_le_tsum (s : ℂ) (hs : 1 < s.re) : ++ ‖deriv riemannZeta s / riemannZeta s‖ ≤ ∑' n : ℕ, ‖((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) / ((n : ℂ) ^ s)‖ := by ++ classical ++ ++ let f : ℕ → ℂ := fun n => ((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) ++ ++ have hsum_term : Summable (fun n : ℕ => LSeries.term f s n) := by ++ simpa [f] using! (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := s) hs) ++ ++ have hsum_norm : Summable (fun n : ℕ => ‖LSeries.term f s n‖) := ++ (summable_norm_iff).mpr hsum_term ++ ++ have hEq : (∑' n : ℕ, LSeries.term f s n) = - deriv riemannZeta s / riemannZeta s := by ++ simpa [f] using! (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := s) hs) ++ ++ have hpoint : (fun n : ℕ => ‖LSeries.term f s n‖) ++ = (fun n : ℕ => ‖f n / ((n : ℂ) ^ s)‖) := by ++ funext n ++ by_cases h0 : n = 0 ++ · ++ subst h0 ++ ++ have hf0r : ArithmeticFunction.vonMangoldt 0 = 0 := by ++ simp ++ have hf0 : f 0 = 0 := by simp [f, hf0r] ++ simp [LSeries.term, f, hf0] ++ · ++ simp [LSeries.term, f, h0] ++ ++ calc ++ ‖deriv riemannZeta s / riemannZeta s‖ ++ = ‖- deriv riemannZeta s / riemannZeta s‖ := by simp [norm_neg] ++ _ = ‖∑' n : ℕ, LSeries.term f s n‖ := by simp [hEq] ++ _ ≤ ∑' n : ℕ, ‖LSeries.term f s n‖ := ++ norm_tsum_le_tsum_norm (f := fun n : ℕ => LSeries.term f s n) hsum_norm ++ _ = ∑' n : ℕ, ‖f n / ((n : ℂ) ^ s)‖ := by simp [hpoint] ++ _ = ∑' n : ℕ, ‖((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) / ((n : ℂ) ^ s)‖ := rfl ++ ++lemma lem_tsum_norm_vonMangoldt_depends_on_Re_cast (s : ℂ) (σ : ℝ) ++ (hσ : σ = s.re) (hs : 1 < s.re) : ++ (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) ++ = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by ++ ++ have hre_ne_zero : s.re ≠ 0 := ne_of_gt (lt_trans zero_lt_one hs) ++ have hσ_ne_zero : σ ≠ 0 := by ++ have : 0 < σ := by simpa [hσ] using (lt_trans zero_lt_one hs) ++ exact ne_of_gt this ++ ++ have hterm : (fun n : ℕ => ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) ++ = (fun n : ℕ => ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by ++ funext n ++ ++ have hden_s : ‖(n : ℂ) ^ s‖ = (n : ℝ) ^ s.re := ++ Complex.norm_natCast_cpow_of_re_ne_zero n hre_ne_zero ++ have hden_σ : ‖(n : ℂ) ^ (σ : ℂ)‖ = (n : ℝ) ^ (σ : ℂ).re := ++ Complex.norm_natCast_cpow_of_re_ne_zero n (by simpa [Complex.ofReal_re] using hσ_ne_zero) ++ calc ++ ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖ ++ = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ))‖ / ‖(n : ℂ) ^ s‖ := by simp ++ _ = |ArithmeticFunction.vonMangoldt n| / ((n : ℝ) ^ s.re) := by ++ simp [hden_s, Complex.norm_real] ++ _ = |ArithmeticFunction.vonMangoldt n| / ((n : ℝ) ^ σ) := by simp [hσ] ++ _ = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ))‖ / ‖(n : ℂ) ^ (σ : ℂ)‖ := by ++ simp [hden_σ, Complex.ofReal_re, Complex.norm_real] ++ _ = ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖ := by simp ++ simpa using congrArg (fun f : ℕ → ℝ => ∑' n, f n) hterm ++ ++lemma helper_norm_neg_logDeriv_eq_tsum_norm (σ : ℝ) (hσ : 1 < σ) : ++ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ = ++ (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by ++ classical ++ ++ let s : ℂ := (σ : ℂ) ++ ++ let f : ℕ → ℂ := fun n => ((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ) ++ ++ let u : ℕ → ℂ := fun n => LSeries.term f s n ++ ++ have hs_re : 1 < s.re := by simpa using! hσ ++ have hsum_term : Summable (fun n : ℕ => LSeries.term f s n) := by ++ simpa [f] using! (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := s) hs_re) ++ ++ have hsum_u : Summable u := hsum_term ++ ++ have hL_eq : (∑' n : ℕ, LSeries.term f s n) = - deriv riemannZeta s / riemannZeta s := ++ (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div (s := s) hs_re) ++ have hsum_eq : (∑' n, u n) = - deriv riemannZeta s / riemannZeta s := by ++ simpa [u] using hL_eq ++ ++ have hterm_as_div : ∀ n, ++ u n = ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) := by ++ intro n; by_cases h0 : n = 0 ++ · ++ subst h0; simp [u, LSeries.term, f, s] ++ · ++ simp [u, LSeries.term, f, s, h0] ++ ++ let r : ℕ → ℝ := fun n => Classical.choose (lem_term_real_nonneg n σ hσ) ++ have hr_nonneg : ∀ n, 0 ≤ r n := by ++ intro n; exact (Classical.choose_spec (lem_term_real_nonneg n σ hσ)).1 ++ have hr_cast : ∀ n, ++ ((ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))) = (r n : ℂ) := by ++ intro n; exact (Classical.choose_spec (lem_term_real_nonneg n σ hσ)).2 ++ have hr_eq' : ∀ n, u n = (r n : ℂ) := by ++ intro n; simpa [hterm_as_div n] using (hr_cast n) ++ ++ have hsum_rc : Summable (fun n => (r n : ℂ)) := by ++ simpa [u, hr_eq'] using hsum_u ++ have hsum_r : Summable r := (Complex.summable_ofReal).1 hsum_rc ++ ++ have hsum_u_as_real : (∑' n, u n) = ((∑' n, r n) : ℝ) := by ++ have hru : (fun n => (r n : ℂ)) = u := by ++ funext n; symm; exact hr_eq' n ++ have := (Complex.ofReal_tsum (L := SummationFilter.unconditional ℕ) (f := r)) ++ ++ simpa [hru] using this.symm ++ ++ have hpoint_norm : (fun n : ℕ => ‖u n‖) ++ = (fun n : ℕ => ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by ++ funext n; by_cases h0 : n = 0 ++ · subst h0; simp [u, LSeries.term, f, s] ++ · simp [u, LSeries.term, f, s, h0] ++ have hnorm_fun : (fun n : ℕ => ‖u n‖) = r := by ++ funext n; simp [hr_eq' n, Complex.norm_real, abs_of_nonneg (hr_nonneg n)] ++ have hsum_norm : Summable (fun n : ℕ => ‖u n‖) := by ++ simpa [hnorm_fun] using hsum_r ++ ++ have hineq : ‖∑' n, u n‖ ≤ ∑' n, ‖u n‖ := ++ norm_tsum_le_tsum_norm (f := u) hsum_norm ++ ++ set S : ℝ := ∑' n, r n ++ have hS_le : ‖((S : ℝ) : ℂ)‖ ≤ S := by ++ simpa [S, hsum_u_as_real, hnorm_fun] using hineq ++ ++ have hS_nonneg : 0 ≤ S := by ++ have habs_le : |S| ≤ S := by simpa [Complex.norm_real] using hS_le ++ exact (abs_nonneg S).trans habs_le ++ ++ have h_left : ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ ++ = ‖∑' n, u n‖ := by ++ have : - deriv riemannZeta s / riemannZeta s = ∑' n, u n := by simpa [hsum_u_as_real] using hsum_eq.symm ++ simp [s, this] ++ have h_mid : ‖∑' n, u n‖ = S := by ++ ++ have : ‖((S : ℝ) : ℂ)‖ = S := by simp [Complex.norm_real, abs_of_nonneg hS_nonneg] ++ simpa [S, hsum_u_as_real] using this ++ have h_right : (∑' n : ℕ, ‖u n‖) = S := by simp [S, hnorm_fun] ++ ++ calc ++ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ ++ = ‖∑' n, u n‖ := h_left ++ _ = S := h_mid ++ _ = (∑' n : ℕ, ‖u n‖) := h_right.symm ++ _ = (∑' n : ℕ, ‖(ArithmeticFunction.vonMangoldt n : ℂ) / ((n : ℂ) ^ (σ : ℂ))‖) := by ++ simp [hpoint_norm] ++ ++theorem lem_zetacenterbd : ++ ∀ t : ℝ, ++ ∀ σ : ℝ, ++ σ ≥ 3/2 → ++ ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ ++ ‖deriv riemannZeta σ / riemannZeta σ‖ := by ++ intro t σ hσge ++ ++ set s : ℂ := Complex.mk σ t ++ ++ have hs : 1 < s.re := by ++ have : (1 : ℝ) < (3 / 2 : ℝ) := by norm_num ++ exact lt_of_lt_of_le this hσge ++ have hσgt1 : 1 < σ := by ++ have : (1 : ℝ) < (3 / 2 : ℝ) := by norm_num ++ exact lt_of_lt_of_le this hσge ++ ++ have h_le_sum := lem_norm_logDeriv_le_tsum s hs ++ have h1 : ‖deriv riemannZeta s / riemannZeta s‖ ≤ ++ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) := by ++ simpa [norm_div, Complex.norm_real] using h_le_sum ++ ++ have h_dep : ++ (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ s)‖) ++ = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := by ++ ++ have hre : σ = s.re := by simp [s] ++ simpa using (lem_tsum_norm_vonMangoldt_depends_on_Re_cast s σ hre hs) ++ have h_dep_ratio : ++ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) ++ = (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) := by ++ simpa [norm_div, Complex.norm_real] using h_dep ++ ++ have h_sum_eq_norm : ++ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ ++ = (∑' n : ℕ, ‖(((ArithmeticFunction.vonMangoldt n : ℝ) : ℂ)) / ((n : ℂ) ^ (σ : ℂ))‖) := ++ helper_norm_neg_logDeriv_eq_tsum_norm σ hσgt1 ++ have h_sum_eq_norm_ratio : ++ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) ++ = ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := by ++ simpa [norm_div, Complex.norm_real] using h_sum_eq_norm.symm ++ ++ have h_main : ‖deriv riemannZeta s / riemannZeta s‖ ≤ ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := by ++ calc ++ ‖deriv riemannZeta s / riemannZeta s‖ ++ ≤ (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ s‖) := h1 ++ _ = (∑' n : ℕ, |ArithmeticFunction.vonMangoldt n| / ‖(n : ℂ) ^ (σ : ℂ)‖) := h_dep_ratio ++ _ = ‖- deriv riemannZeta (σ : ℂ) / riemannZeta (σ : ℂ)‖ := h_sum_eq_norm_ratio ++ ++ simpa [s, norm_neg] using h_main ++ ++lemma lem_logDerivZetalogt32 : ++ ∃ C : ℝ, C > 1 ∧ ++ ∀ t : ℝ, |t| > 3 → ++ ∀ σ : ℝ, ++ σ ≥ 3/2 → ++ ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ C := by ++ ++ obtain ⟨C0, hC0_gt1, hC0_bound⟩ := Z0bound_const ++ ++ refine ⟨C0 + 2, by linarith, ?_⟩ ++ intro t ht σ hσ ++ ++ have h_center := lem_zetacenterbd t σ hσ ++ ++ set δ : ℝ := σ - 1 ++ have hδ_pos : 0 < δ := by linarith [hσ] ++ have hδ_ge_half : (1 / 2 : ℝ) ≤ δ := by linarith [hσ] ++ ++ have hZ0 := hC0_bound δ hδ_pos ++ ++ have h_tri : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ ++ ‖-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))‖ + ‖(1 / (δ : ℂ))‖ := by ++ simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using ++ (norm_add_le (-logDerivZeta ((1 : ℂ) + δ) - (1 / (δ : ℂ))) (1 / (δ : ℂ))) ++ ++ have h_norm_div_le_two : ‖(1 / (δ : ℂ))‖ ≤ 2 := by ++ ++ have hnorm_div : ‖(1 : ℂ) / (δ : ℂ)‖ = ‖(1 : ℂ)‖ / ‖(δ : ℂ)‖ := by ++ simp ++ have hnorm_ofReal : ‖(δ : ℂ)‖ = |δ| := by ++ simp ++ ++ have h_abs_ge : (1 / 2 : ℝ) ≤ |δ| := by ++ have hδ_nonneg : 0 ≤ δ := le_of_lt hδ_pos ++ simpa [abs_of_nonneg hδ_nonneg] using hδ_ge_half ++ have hhalfpos : (0 : ℝ) < 1 / 2 := by norm_num ++ have hone_div_abs_le_two : 1 / |δ| ≤ 2 := by ++ simpa using (one_div_le_one_div_of_le hhalfpos h_abs_ge) ++ ++ have : 1 / ‖(δ : ℂ)‖ ≤ 2 := by simpa [hnorm_ofReal] using hone_div_abs_le_two ++ ++ have hnorm_div' : ‖(1 / (δ : ℂ))‖ = 1 / ‖(δ : ℂ)‖ := by ++ simp ++ simpa [hnorm_div'] using this ++ ++ have h_real_axis_bound : ‖logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + 2 := by ++ have h1 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + ‖(1 / (δ : ℂ))‖ := ++ le_trans h_tri (add_le_add_left hZ0 _) ++ have h2 : ‖-logDerivZeta ((1 : ℂ) + δ)‖ ≤ C0 + 2 := ++ le_trans h1 (add_le_add_right h_norm_div_le_two _) ++ simpa [norm_neg] using h2 ++ ++ have hσ_real : (1 : ℝ) + δ = σ := by ++ simp [δ, sub_eq_add_neg, add_left_comm] ++ have hσ_eq : (1 : ℂ) + δ = (σ : ℂ) := by ++ have : ((1 + δ : ℝ) : ℂ) = (σ : ℂ) := by simpa using congrArg Complex.ofReal hσ_real ++ simpa [Complex.ofReal_add] using this ++ have hR_bound : ‖deriv riemannZeta σ / riemannZeta σ‖ ≤ C0 + 2 := by ++ ++ simpa [logDerivZeta, hσ_eq] using h_real_axis_bound ++ ++ exact le_trans h_center hR_bound ++ ++theorem thm_final_result : ++ ∃ A : ℝ, A > 0 ∧ A < 1 ∧ ++ ∃ C : ℝ, C > 1 ∧ ++ ∀ t : ℝ, |t| > 3 → ++ ∀ σ : ℝ, ++ σ ≥ 1 - A / Real.log (abs t + 2) → ++ ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ≤ C * (Real.log (abs t)) ^ 2 := by ++ ++ obtain ⟨C₀, hC₀_pos, hC₀⟩ := lem_logDerivZetalogt0 ++ obtain ⟨C₃₂, hC₃₂_pos, hC₃₂⟩ := lem_logDerivZetalogt32 ++ ++ use zerofree_constant / 20 ++ ++ constructor ++ · ++ apply div_pos zerofree_constant_pos ++ norm_num ++ ++ constructor ++ · ++ rw [div_lt_one (by norm_num : (0 : ℝ) < 20)] ++ ++ have h1 : zerofree_constant < 1 := zerofree_constant_lt_one ++ linarith ++ ++ use max C₀ C₃₂ ++ ++ constructor ++ · ++ exact lt_max_of_lt_left hC₀_pos ++ ++ · ++ intro t ht σ hσ ++ ++ have h_eq : zerofree_constant / 20 / Real.log (abs t + 2) = deltaz_t t := by ++ unfold deltaz_t deltaz ++ simp ++ ++ have hσ' : σ ≥ 1 - deltaz_t t := by ++ rw [← h_eq] ++ exact hσ ++ ++ by_cases h : σ ≥ 3/2 ++ · ++ have bound := hC₃₂ t ht σ h ++ have hC_le : C₃₂ ≤ max C₀ C₃₂ := le_max_right _ _ ++ ++ have hlog_ge_one : 1 ≤ Real.log (abs t) := by ++ have h_ge : Real.exp 1 ≤ abs t := by ++ ++ have he_lt_3 : Real.exp 1 < 3 := lem_three_gt_e ++ linarith [ht, abs_nonneg t] ++ exact (Real.le_log_iff_exp_le (by linarith [abs_nonneg t])).2 h_ge ++ have h_one_le_sq : 1 ≤ (Real.log (abs t)) ^ 2 := by ++ have h_sq : (Real.log (abs t)) ^ 2 = Real.log (abs t) * Real.log (abs t) := by ++ rw [pow_two] ++ rw [h_sq] ++ have h_mul : 1 * 1 ≤ Real.log (abs t) * Real.log (abs t) := ++ mul_self_le_mul_self (zero_le_one) hlog_ge_one ++ simpa using h_mul ++ have h_pos : 0 < C₃₂ := lt_trans zero_lt_one hC₃₂_pos ++ calc ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ++ ≤ C₃₂ := bound ++ _ = C₃₂ * 1 := by rw [mul_one] ++ _ ≤ C₃₂ * (Real.log (abs t)) ^ 2 := by ++ apply mul_le_mul_of_nonneg_left h_one_le_sq (le_of_lt h_pos) ++ _ ≤ max C₀ C₃₂ * (Real.log (abs t)) ^ 2 := by ++ apply mul_le_mul_of_nonneg_right hC_le (sq_nonneg _) ++ ++ · ++ push Not at h ++ have h_conditions : 1 - deltaz_t t ≤ σ ∧ σ ≤ 3/2 ∧ t = t := by ++ exact ⟨hσ', le_of_lt h, rfl⟩ ++ have bound := hC₀ t ht ⟨σ, t⟩ h_conditions ++ have hC_le : C₀ ≤ max C₀ C₃₂ := le_max_left _ _ ++ calc ‖deriv riemannZeta (Complex.mk σ t) / riemannZeta (Complex.mk σ t)‖ ++ ≤ C₀ * Real.log |t| ^ 2 := bound ++ _ ≤ max C₀ C₃₂ * Real.log |t| ^ 2 := by ++ apply mul_le_mul_of_nonneg_right hC_le (sq_nonneg _) ++ ++lemma ZetaZeroFree_p : ++ ∃ (A : ℝ) (_ : A ∈ Set.Ioc 0 (1 / 2)), ++ ∀ (σ : ℝ) ++ (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Set.Ico (1 - A / Real.log |t| ^ 1) 1), ++ riemannZeta (σ + t * Complex.I) ≠ 0 := by ++ ++ obtain ⟨c, hc_pos, hc_lt_one, hbound⟩ := zerofree ++ ++ let A0 : ℝ := min (1 / 2 : ℝ) (c / 2) ++ let A : ℝ := min A0 ((1 / 4 : ℝ) * Real.log 3) ++ have hA_pos : 0 < A := by ++ have h1 : 0 < (1 / 2 : ℝ) := by norm_num ++ have h2 : 0 < c / 2 := by ++ have : 0 < (2 : ℝ) := by norm_num ++ exact div_pos hc_pos this ++ have hA0pos : 0 < A0 := lt_min_iff.mpr ⟨h1, h2⟩ ++ have hlog3pos : 0 < Real.log (3 : ℝ) := ++ (Real.log_pos_iff (by norm_num : (0 : ℝ) ≤ 3)).2 (by norm_num) ++ have h3 : 0 < (1 / 4 : ℝ) * Real.log 3 := by ++ exact mul_pos (by norm_num) hlog3pos ++ exact lt_min_iff.mpr ⟨hA0pos, h3⟩ ++ have hA_le_half : A ≤ 1/2 := by ++ have : A ≤ A0 := min_le_left _ _ ++ exact this.trans (min_le_left _ _) ++ have hA_le_c2 : A ≤ c / 2 := by ++ have : A ≤ A0 := min_le_left _ _ ++ exact this.trans (min_le_right _ _) ++ have hA_le_log3quarter : A ≤ (1 / 4 : ℝ) * Real.log 3 := min_le_right _ _ ++ refine ⟨A, ?_, ?_⟩ ++ · exact ⟨hA_pos, hA_le_half⟩ ++ · intro σ t htgt3 hσI hzero ++ ++ set L := Real.log |t| with hLdef ++ set Lp := Real.log (|t| + 2) with hLpdef ++ have hpos_abs : 0 ≤ |t| := abs_nonneg t ++ have hLpos : 0 < L := (Real.log_pos_iff hpos_abs).2 (lt_trans (by norm_num) htgt3) ++ have hLp_pos_arg : 0 < |t| + 2 := by linarith ++ have hLp_pos : 0 < Lp := (Real.log_pos_iff (le_of_lt hLp_pos_arg)).2 (by linarith) ++ ++ have hlog3_le_L : Real.log 3 ≤ L := by ++ have h3pos : 0 < (3 : ℝ) := by norm_num ++ have : (3 : ℝ) ≤ |t| := le_of_lt htgt3 ++ simpa [hLdef] using Real.log_le_log h3pos this ++ ++ have hquarter_ratio_le : ((1 / 4 : ℝ) * Real.log 3) / L ≤ (1 / 4 : ℝ) := by ++ have h := div_le_div_of_nonneg_right hlog3_le_L (le_of_lt hLpos) ++ have h' := mul_le_mul_of_nonneg_left h (by norm_num : (0 : ℝ) ≤ 1/4) ++ have hne : L ≠ 0 := ne_of_gt hLpos ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc, hne] using h' ++ ++ have hA_over_le_quarter : A / L ≤ (1 / 4 : ℝ) := by ++ have := div_le_div_of_nonneg_right hA_le_log3quarter (le_of_lt hLpos) ++ exact this.trans hquarter_ratio_le ++ ++ have hlow : 1 - A / L ≤ σ := by simpa [hLdef, pow_one] using hσI.1 ++ have hσ_ge_34 : (3 / 4 : ℝ) ≤ σ := by ++ have : (3 / 4 : ℝ) ≤ 1 - A / L := by linarith ++ exact this.trans hlow ++ have hσ_pos : 0 < σ := lt_of_lt_of_le (by norm_num : (0 : ℝ) < (3/4 : ℝ)) hσ_ge_34 ++ have hσ_lt_one : σ < 1 := hσI.2 ++ ++ have hlog_lt : Lp < 2 * L := by ++ have h1 : 0 < |t| - 2 := by linarith ++ have h2 : 0 < |t| + 1 := by linarith ++ have hprod_pos : 0 < (|t| - 2) * (|t| + 1) := mul_pos h1 h2 ++ have hpoly : |t| * |t| - (|t| + 2) = (|t| - 2) * (|t| + 1) := by ring ++ have hlt : |t| + 2 < |t| * |t| := by ++ calc ++ |t| + 2 < |t| + 2 + (|t| - 2) * (|t| + 1) := by linarith [hprod_pos] ++ _ = |t| * |t| := by rw [← hpoly]; ring ++ have hposb : 0 < |t| + 2 := by linarith ++ have hlog_lt' : Real.log (|t| + 2) < Real.log (|t| * |t|) := Real.log_lt_log hposb hlt ++ have hlogmul : Real.log (|t| ^ 2) = 2 * Real.log |t| := Real.log_pow |t| 2 ++ calc ++ Lp = Real.log (|t| + 2) := by simp [hLpdef] ++ _ < Real.log (|t| * |t|) := hlog_lt' ++ _ = Real.log (|t| ^ 2) := by simp [pow_two] ++ _ = 2 * Real.log |t| := by simp ++ _ = 2 * L := by simp [hLdef] ++ ++ have h_inv_comp : 1 / (2 * L) < 1 / Lp := one_div_lt_one_div_of_lt hLp_pos hlog_lt ++ have hstep2 : (c / 2) / L < c / Lp := by ++ have hcpos' : 0 < c := hc_pos ++ have : c * (1 / (2 * L)) < c * (1 / Lp) := mul_lt_mul_of_pos_left h_inv_comp hcpos' ++ simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using this ++ ++ have hstep1 : A / L ≤ (c / 2) / L := by ++ have := div_le_div_of_nonneg_right hA_le_c2 (le_of_lt hLpos) ++ simpa [div_eq_mul_inv] using this ++ have hstrict_div : A / L < c / Lp := lt_of_le_of_lt hstep1 hstep2 ++ ++ have hσ_gt : 1 - c / Lp < σ := by ++ have hneg' : - (c / Lp) < - (A / L) := by simpa [neg_div] using neg_lt_neg hstrict_div ++ have : 1 - c / Lp < 1 - A / L := by simpa [sub_eq_add_neg] using! add_lt_add_right hneg' 1 ++ exact this.trans_le hlow ++ ++ let s : ℂ := Complex.mk σ t ++ have hs_zero : riemannZeta s = 0 := by simpa [s, Complex.mk_eq_add_mul_I] using hzero ++ have hs_in_zeroZ : s ∈ zeroZ := by simpa [zeroZ] using hs_zero ++ have hpre : s ∈ zeroZ ∧ 0 < s.re ∧ s.re < 1 := by ++ refine ⟨hs_in_zeroZ, ?_, ?_⟩ ++ · simpa [s] using hσ_pos ++ · simpa [s] using hσ_lt_one ++ have him_bound : 2 < |s.im| := by ++ have : 2 < |t| := lt_trans (by norm_num) htgt3 ++ simpa [s] using this ++ have hbound_applied : s.re ≤ 1 - c / Real.log (abs s.im + 2) := hbound s hpre him_bound ++ have hle : σ ≤ 1 - c / Lp := by simpa [s, hLpdef] using hbound_applied ++ have hcontr : σ < σ := lt_of_le_of_lt hle hσ_gt ++ exact (lt_irrefl _ : ¬ σ < σ) hcontr ++ ++open _root_.Set Function Filter _root_.Complex _root_.Real ++lemma LogDerivZetaBndUnif2 : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)) (C : ℝ) (_ : 0 < C), ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Ici (1 - A / Real.log |t| ^ 1)), ‖(deriv riemannZeta) (σ + t * Complex.I) / riemannZeta (σ + t * Complex.I)‖ ≤ ++ C * Real.log |t| ^ 2 := by ++ classical ++ obtain ⟨c, hc, hc2, K, hK, hfinal⟩ := thm_final_result ++ ++ let A : ℝ := min (1/2 : ℝ) (c / 2) ++ have hApos : 0 < A := by ++ have h1 : 0 < (1/2 : ℝ) := by norm_num ++ have h2 : 0 < c / 2 := by ++ have : 0 < (2 : ℝ) := by norm_num ++ exact div_pos hc this ++ exact (lt_min_iff).2 ⟨h1, h2⟩ ++ have hAle : A ≤ (1/2 : ℝ) := min_le_left _ _ ++ have hA_in : A ∈ Ioc 0 (1/2) := ⟨hApos, hAle⟩ ++ let C : ℝ := K ++ have hCpos : 0 < C := by ++ have hKpos : 0 < K := lt_trans (by norm_num : (0 : ℝ) < 1) hK ++ exact hKpos ++ refine ⟨A, hA_in, C, hCpos, ?_⟩ ++ intro σ t htgt3 hσI ++ ++ let x := |t| ++ have hxpos : 0 ≤ x := abs_nonneg t ++ have hxgt3 : 3 < x := htgt3 ++ let L := Real.log x ++ let L' := Real.log (x + 2) ++ have hLpos : 0 < L := (Real.log_pos_iff hxpos).2 (lt_trans (by norm_num) hxgt3) ++ have hL'pos : 0 < L' := ++ (Real.log_pos_iff (by linarith : 0 ≤ x + 2)).2 (by linarith [hxpos, hxgt3]) ++ ++ have hσ_ge : 1 - A / L ≤ σ := by simpa [pow_one, L, x] using hσI ++ ++ have hprod_pos : 0 < (x - 2) * (x + 1) := by ++ have hxgt2 : (2 : ℝ) < x := lt_trans (by norm_num) hxgt3 ++ exact mul_pos (sub_pos.mpr hxgt2) (add_pos_of_nonneg_of_pos hxpos (by norm_num)) ++ have hdiff_pos : 0 < x ^ 2 - (x + 2) := by ++ have hpoly : x ^ 2 - (x + 2) = (x - 2) * (x + 1) := by ring ++ simpa [hpoly] using hprod_pos ++ have hlt_sq : x + 2 < x ^ 2 := by linarith ++ have hlog_lt : L' < Real.log (x ^ 2) := ++ Real.log_lt_log (by linarith : 0 < x + 2) hlt_sq ++ have hlog_pow : Real.log (x ^ 2) = 2 * L := by ++ simp [L] ++ have hL'_lt_2L : L' < 2 * L := by simpa [L', hlog_pow] ++ using hlog_lt ++ ++ have hA_le_c2 : A ≤ c / 2 := min_le_right _ _ ++ have hstep0 : A / L ≤ (c / 2) / L := ++ div_le_div_of_nonneg_right hA_le_c2 (le_of_lt hLpos) ++ have hrecip : 1 / (2 * L) < 1 / L' := ++ one_div_lt_one_div_of_lt hL'pos hL'_lt_2L ++ have hmul : c * (1 / (2 * L)) < c * (1 / L') := ++ mul_lt_mul_of_pos_left hrecip hc ++ have hstep2 : (c / 2) / L < c / L' := by ++ simpa [one_div, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] ++ using hmul ++ have hineq : A / L < c / L' := lt_of_le_of_lt hstep0 hstep2 ++ have hσ_gt : σ > 1 - c / L' := by ++ have : 1 - c / L' < 1 - A / L := by linarith [hineq] ++ exact lt_of_lt_of_le this hσ_ge ++ ++ have hmain' : ‖(deriv riemannZeta) (σ + t * Complex.I) / riemannZeta (σ + t * Complex.I)‖ ≤ ++ K * (Real.log |t|) ^ 2 := by ++ have h_eq : σ + t * Complex.I = Complex.mk σ t := by ++ rw [Complex.mk_eq_add_mul_I] ++ rw [h_eq] ++ have hσ_ge_required : σ ≥ 1 - c / Real.log (abs t + 2) := by ++ have h_abs_eq : abs t = |t| := by simp ++ rw [h_abs_eq] ++ exact le_of_lt hσ_gt ++ exact hfinal t htgt3 σ hσ_ge_required ++ ++ simpa [C, L, x] using hmain' ++ ++end Erdos970 +diff --git a/StrongPNT/Erdos970/PNT5_Strong.lean b/StrongPNT/Erdos970/PNT5_Strong.lean +new file mode 100644 +index 0000000..bc0f938 +--- /dev/null ++++ b/StrongPNT/Erdos970/PNT5_Strong.lean +@@ -0,0 +1,5754 @@ ++import PrimeNumberTheoremAnd.Erdos970.ZetaBounds ++import PrimeNumberTheoremAnd.Erdos970.ZetaConj ++import PrimeNumberTheoremAnd.Erdos970.SmoothExistence ++import Mathlib.Algebra.Group.Support ++import Mathlib.Analysis.SpecialFunctions.Log.Monotone ++import Mathlib.Analysis.Real.Pi.Bounds ++import Mathlib.Analysis.Complex.ExponentialBounds ++import StrongPNT.Erdos970.ZetaZeroFree ++ ++namespace Erdos970 ++ ++ ++open _root_.Set _root_.Function _root_.Filter _root_.Complex _root_.Real ++ ++open _root_.ArithmeticFunction (vonMangoldt) ++ ++noncomputable abbrev MellinTransform : (ℝ → ℂ) → ℂ → ℂ := mellin ++ ++lemma MellinTransform_integral (f : ℝ → ℂ) (s : ℂ) : ++ MellinTransform f s = ∫ x in Set.Ioi (0 : ℝ), f x * (x : ℂ) ^ (s - 1) := by ++ simp only [MellinTransform, mellin, smul_eq_mul, mul_comm] ++ ++lemma MellinTransform_eq : MellinTransform = (mellin : (ℝ → ℂ) → ℂ → ℂ) := by ++ rfl ++ ++noncomputable def MellinInverseTransform (F : ℂ → ℂ) (σ : ℝ) (x : ℝ) : ℂ := ++ VerticalIntegral' (fun s ↦ x ^ (-s) * F s) σ ++ ++lemma MellinInverseTransform_eq (σ : ℝ) (f : ℂ → ℂ) : ++ MellinInverseTransform f σ = mellinInv σ f := by ++ unfold mellinInv MellinInverseTransform VerticalIntegral' VerticalIntegral ++ beta_reduce; ext x ++ rw [← smul_assoc, smul_eq_mul (b := Complex.I), div_mul]; simp ++ ++theorem MellinInversion (σ : ℝ) {f : ℝ → ℂ} {x : ℝ} (hx : 0 < x) (hf : MellinConvergent f σ) ++ (hFf : VerticalIntegrable (mellin f) σ) (hfx : ContinuousAt f x) : ++ MellinInverseTransform (MellinTransform f) σ x = f x := by ++ rw [MellinInverseTransform_eq, mellinInv_mellin_eq σ f hx hf hFf hfx] ++ ++local notation (name := mellintransform2) "𝓜" => MellinTransform ++ ++local notation "Λ" => vonMangoldt ++ ++local notation "ζ" => riemannZeta ++ ++local notation "ζ'" => deriv ζ ++ ++local notation "I" => Complex.I ++ ++noncomputable def ChebyshevPsi (x : ℝ) : ℝ := ++ (Finset.range ⌊x + 1⌋₊).sum Λ ++ ++local notation "ψ" => ChebyshevPsi ++ ++theorem LogDerivativeDirichlet (s : ℂ) (hs : 1 < s.re) : ++ - deriv riemannZeta s / riemannZeta s = ∑' n, Λ n / (n : ℂ) ^ s := by ++ rw [← ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div hs] ++ dsimp [LSeries, LSeries.term] ++ nth_rewrite 2 [Summable.tsum_eq_add_tsum_ite (b := 0) ?_] ++ · simp ++ · have := ArithmeticFunction.LSeriesSummable_vonMangoldt hs ++ dsimp [LSeriesSummable] at this ++ convert! this using 1 ++ funext n ++ by_cases h : n = 0 <;> simp [LSeries.term, h] ++ ++noncomputable abbrev SmoothedChebyshevIntegrand (SmoothingF : ℝ → ℝ) (ε : ℝ) (X : ℝ) : ℂ → ℂ := ++ fun s ↦ (- deriv riemannZeta s) / riemannZeta s * ++ 𝓜 ((Smooth1 SmoothingF ε) ·) s * (X : ℂ) ^ s ++ ++noncomputable def SmoothedChebyshev (SmoothingF : ℝ → ℝ) (ε : ℝ) (X : ℝ) : ℂ := ++ VerticalIntegral' (SmoothedChebyshevIntegrand SmoothingF ε X) ((1 : ℝ) + (Real.log X)⁻¹) ++ ++open ComplexConjugate ++ ++lemma smoothedChebyshevIntegrand_conj {SmoothingF : ℝ → ℝ} {ε X : ℝ} (Xpos : 0 < X) (s : ℂ) : ++ SmoothedChebyshevIntegrand SmoothingF ε X (conj s) = conj (SmoothedChebyshevIntegrand SmoothingF ε X s) := by ++ unfold SmoothedChebyshevIntegrand ++ simp only [map_mul, map_div₀, map_neg] ++ congr ++ · exact deriv_riemannZeta_conj s ++ · exact riemannZeta_conj s ++ · simp_rw [MellinTransform_integral] ++ ++ rw[← integral_conj] ++ apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioi ++ intro x xpos ++ simp only [map_mul, Complex.conj_ofReal] ++ congr ++ nth_rw 1 [← map_one conj] ++ rw[← map_sub, Complex.cpow_conj, Complex.conj_ofReal] ++ rw[Complex.arg_ofReal_of_nonneg xpos.le] ++ exact Real.pi_ne_zero.symm ++ · rw[Complex.cpow_conj, Complex.conj_ofReal] ++ rw[Complex.arg_ofReal_of_nonneg Xpos.le] ++ exact Real.pi_ne_zero.symm ++ ++open _root_.MeasureTheory ++ ++lemma SmoothedChebyshevDirichlet_aux_integrable {SmoothingF : ℝ → ℝ} ++ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) ++ (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) ++ (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) ++ {ε : ℝ} (εpos : 0 < ε) (ε_lt_one : ε < 1) {σ : ℝ} (σ_gt : 1 < σ) (σ_le : σ ≤ 2) : ++ MeasureTheory.Integrable ++ (fun (y : ℝ) ↦ 𝓜 (fun x ↦ (Smooth1 SmoothingF ε x : ℂ)) (σ + y * I)) := by ++ obtain ⟨c, cpos, hc⟩ := MellinOfSmooth1b diffSmoothingF suppSmoothingF ++ apply Integrable.mono' (g := (fun t ↦ c / ε * 1 / (1 + t ^ 2))) ++ · apply Integrable.const_mul integrable_inv_one_add_sq ++ · apply Continuous.aestronglyMeasurable ++ apply continuous_iff_continuousAt.mpr ++ intro x ++ have := Smooth1MellinDifferentiable diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ ++ SmoothingFpos mass_one (s := σ + x * I) (by simp only [add_re, ofReal_re, mul_re, I_re, ++ mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero]; linarith) |>.continuousAt ++ fun_prop ++ · filter_upwards [] with t ++ calc ++ _≤ c / ε * 1 / (σ^2 + t^2) := by ++ convert hc (σ / 2) (by linarith) (σ + t * I) (by simp only [add_re, ofReal_re, mul_re, ++ I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, half_le_self_iff]; linarith) ++ (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, ++ sub_self, add_zero]; linarith) ε εpos ε_lt_one using 1 ++ simp only [mul_one, Complex.sq_norm, normSq_apply, add_re, ofReal_re, mul_re, I_re, ++ mul_zero, ofReal_im, I_im, sub_self, add_zero, add_im, mul_im, zero_add, mul_inv_rev] ++ ring_nf ++ _ ≤ _ := by ++ gcongr; nlinarith ++ ++attribute [fun_prop] Continuous.const_cpow ++ ++lemma SmoothedChebyshevDirichlet_aux_tsum_integral {SmoothingF : ℝ → ℝ} ++ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) ++ (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) ++ (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) {X : ℝ} ++ (X_pos : 0 < X) {ε : ℝ} (εpos : 0 < ε) ++ (ε_lt_one : ε < 1) {σ : ℝ} (σ_gt : 1 < σ) (σ_le : σ ≤ 2) : ++ ∫ (t : ℝ), ++ ∑' (n : ℕ), (ArithmeticFunction.vonMangoldt n) / (n : ℂ) ^ (σ + t * I) * ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + t * I) * (X : ℂ) ^ (σ + t * I) = ++ ∑' (n : ℕ), ++ ∫ (t : ℝ), (ArithmeticFunction.vonMangoldt n) / (n : ℂ) ^ (σ + ↑t * I) * ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X : ℂ) ^ (σ + t * I) := by ++ ++ have cont_mellin_smooth : Continuous fun (a : ℝ) ↦ ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑a * I) := by ++ apply continuousOn_univ.mp ++ refine ContinuousOn.comp' ?_ ?_ ?_ (t := {z : ℂ | 0 < z.re }) ++ . refine continuousOn_of_forall_continuousAt ?_ ++ intro z hz ++ exact (Smooth1MellinDifferentiable diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ SmoothingFpos mass_one hz).continuousAt ++ . fun_prop ++ . simp only [mapsTo_univ_iff, mem_ofPred_eq, add_re, ofReal_re, mul_re, I_re, mul_zero, ++ ofReal_im, I_im, mul_one, sub_self, add_zero, forall_const]; linarith ++ ++ have abs_two : ∀ a : ℝ, ∀ i : ℕ, ‖(i : ℂ) ^ ((σ : ℂ) + ↑a * I)‖₊ = i ^ σ := by ++ intro a i ++ simp_rw [← norm_toNNReal] ++ ++ rw [norm_natCast_cpow_of_re_ne_zero _ (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ++ ofReal_im, I_im, mul_one, sub_self, add_zero, ne_eq]; linarith)] ++ simp only [add_re, mul_re, ofReal_re, I_re, mul_zero, ofReal_im, I_im, mul_one, ++ sub_self, add_zero, Real.toNNReal_of_nonneg <| rpow_nonneg (y:= σ) (x:= i) (by linarith)] ++ norm_cast ++ ++ rw [MeasureTheory.integral_tsum] ++ have x_neq_zero : X ≠ 0 := by linarith ++ . intro i ++ by_cases i_eq_zero : i = 0 ++ . simpa [i_eq_zero] using aestronglyMeasurable_const ++ . apply Continuous.aestronglyMeasurable ++ fun_prop (disch := simp[i_eq_zero, x_neq_zero]) ++ . rw [← lt_top_iff_ne_top] ++ simp_rw [enorm_mul, enorm_eq_nnnorm, nnnorm_div, ← norm_toNNReal, Complex.norm_cpow_eq_rpow_re_of_pos X_pos, norm_toNNReal, abs_two] ++ simp only [nnnorm_real, add_re, mul_re, ofReal_re, I_re, mul_zero, ofReal_im, I_im, ++ mul_one, sub_self, add_zero] ++ simp_rw [MeasureTheory.lintegral_mul_const' (r := ↑(X ^ σ).toNNReal) (hr := by simp), ENNReal.tsum_mul_right] ++ apply ENNReal.mul_lt_top ?_ ENNReal.coe_lt_top ++ ++ conv => ++ arg 1 ++ arg 1 ++ intro i ++ rw [MeasureTheory.lintegral_const_mul' (hr := by simp)] ++ ++ rw [ENNReal.tsum_mul_right] ++ apply ENNReal.mul_lt_top ++ . rw [lt_top_iff_ne_top, ENNReal.tsum_coe_ne_top_iff_summable_coe] ++ push_cast ++ convert (ArithmeticFunction.LSeriesSummable_vonMangoldt (s := σ) ++ (by simp only [ofReal_re]; linarith)).norm ++ rw [LSeries.term_def] ++ split_ifs with h <;> simp[h] ++ . simp_rw [← enorm_eq_nnnorm] ++ rw [← MeasureTheory.hasFiniteIntegral_iff_enorm] ++ exact SmoothedChebyshevDirichlet_aux_integrable diffSmoothingF SmoothingFpos suppSmoothingF ++ mass_one εpos ε_lt_one σ_gt σ_le |>.hasFiniteIntegral ++ ++theorem SmoothedChebyshevDirichlet {SmoothingF : ℝ → ℝ} ++ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ (SmoothingFpos : ∀ x > 0, 0 ≤ SmoothingF x) ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (mass_one: ∫ x in Ioi (0 : ℝ), SmoothingF x / x = 1) ++ {X : ℝ} (X_gt : 3 < X) {ε : ℝ} (εpos: 0 < ε) (ε_lt_one : ε < 1) : ++ SmoothedChebyshev SmoothingF ε X = ++ ∑' n, ArithmeticFunction.vonMangoldt n * Smooth1 SmoothingF ε (n / X) := by ++ dsimp [SmoothedChebyshev, SmoothedChebyshevIntegrand, VerticalIntegral', VerticalIntegral] ++ set σ : ℝ := 1 + (Real.log X)⁻¹ ++ have log_gt : 1 < Real.log X := by ++ rw [Real.lt_log_iff_exp_lt (by linarith : 0 < X)] ++ linarith [Real.exp_one_lt_d9] ++ have σ_gt : 1 < σ := by ++ simp only [σ] ++ have : 0 < (Real.log X)⁻¹ := by ++ simp only [inv_pos] ++ linarith ++ linarith ++ have σ_le : σ ≤ 2 := by ++ simp only [σ] ++ have : (Real.log X)⁻¹ < 1 := inv_lt_one_of_one_lt₀ log_gt ++ linarith ++ calc ++ _ = 1 / (2 * π * I) * (I * ∫ (t : ℝ), ∑' n, Λ n / (n : ℂ) ^ (σ + ↑t * I) * ++ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * X ^ (σ + ↑t * I)) := ?_ ++ _ = 1 / (2 * π * I) * (I * ∑' n, ∫ (t : ℝ), Λ n / (n : ℂ) ^ (σ + ↑t * I) * ++ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * X ^ (σ + ↑t * I)) := ?_ ++ _ = 1 / (2 * π * I) * (I * ∑' n, Λ n * ∫ (t : ℝ), ++ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ ++ _ = 1 / (2 * π) * (∑' n, Λ n * ∫ (t : ℝ), ++ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ ++ _ = ∑' n, Λ n * (1 / (2 * π) * ∫ (t : ℝ), ++ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * (X / (n : ℂ)) ^ (σ + ↑t * I)) := ?_ ++ _ = ∑' n, Λ n * (1 / (2 * π) * ∫ (t : ℝ), ++ mellin (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ + ↑t * I) * ((n : ℂ) / X) ^ (-(σ + ↑t * I))) := ?_ ++ _ = _ := ?_ ++ · congr; ext t ++ rw [LogDerivativeDirichlet] ++ · rw [← tsum_mul_right, ← tsum_mul_right] ++ · simp [σ_gt] ++ · congr ++ exact SmoothedChebyshevDirichlet_aux_tsum_integral diffSmoothingF SmoothingFpos ++ suppSmoothingF mass_one (by linarith) εpos ε_lt_one σ_gt σ_le ++ · field_simp; congr; ext n; rw [← MeasureTheory.integral_const_mul]; congr; ext t ++ by_cases n_ne_zero : n = 0; simp [n_ne_zero] ++ rw [mul_div_assoc, mul_assoc] ++ congr ++ rw [(div_eq_iff ?_).mpr] ++ have := @mul_cpow_ofReal_nonneg (a := X / (n : ℝ)) (b := (n : ℝ)) (r := σ + t * I) ?_ ?_ ++ push_cast at this ⊢ ++ rw [mul_comm I (↑t : ℂ)] ++ rw [← this, div_mul_cancel₀] ++ · simp only [ne_eq, Nat.cast_eq_zero, n_ne_zero, not_false_eq_true] ++ · apply div_nonneg (by linarith : 0 ≤ X); simp ++ · simp ++ · simp only [ne_eq, cpow_eq_zero_iff, Nat.cast_eq_zero, not_and, not_not] ++ intro hn; exfalso; exact n_ne_zero hn ++ · conv => rw [← mul_assoc, div_mul]; lhs; lhs; rhs; simp ++ · simp_rw [← tsum_mul_left, ← mul_assoc, mul_comm] ++ · have ht (t : ℝ) : -(σ + t * I) = (-1) * (σ + t * I) := by simp ++ have hn (n : ℂ) : (n / X) ^ (-1 : ℂ) = X / n := by simp [cpow_neg_one] ++ have (n : ℕ) : (log ((n : ℂ) / (X : ℂ)) * -1).im = 0 := by ++ simp [Complex.log_im, arg_eq_zero_iff, div_nonneg (Nat.cast_nonneg _) (by linarith : 0 ≤ X)] ++ have h (n : ℕ) (t : ℝ) : ((n : ℂ) / X) ^ ((-1 : ℂ) * (σ + t * I)) = ++ ((n / X) ^ (-1 : ℂ)) ^ (σ + ↑t * I) := by ++ rw [cpow_mul] <;> {rw [this n]; simp [Real.pi_pos, Real.pi_nonneg]} ++ congr 1 ++ funext n ++ ++ simp_rw [ht, h, hn] ++ · push_cast ++ congr ++ ext n ++ by_cases n_zero : n = 0; simp [n_zero] ++ have n_pos : 0 < n := by ++ simpa only [n_zero, gt_iff_lt, false_or] using (Nat.eq_zero_or_pos n) ++ congr ++ rw [(by rw [div_mul]; simp : 1 / (2 * π) = 1 / (2 * π * I) * I), mul_assoc] ++ conv => lhs; rhs; rhs; rhs; intro t; rw [mul_comm]; norm_cast ++ have := MellinInversion σ (f := fun x ↦ (Smooth1 SmoothingF ε x : ℂ)) (x := n / X) ++ ?_ ?_ ?_ ?_ ++ · beta_reduce at this ++ dsimp [MellinInverseTransform, VerticalIntegral] at this ++ rw [this] ++ · exact div_pos (by exact_mod_cast n_pos) (by linarith : 0 < X) ++ · apply Smooth1MellinConvergent diffSmoothingF suppSmoothingF ⟨εpos, ε_lt_one⟩ SmoothingFpos mass_one ++ simp only [ofReal_re] ++ linarith ++ · dsimp [VerticalIntegrable] ++ apply SmoothedChebyshevDirichlet_aux_integrable diffSmoothingF SmoothingFpos ++ suppSmoothingF mass_one εpos ε_lt_one σ_gt σ_le ++ · refine ContinuousAt.comp (g := ofReal) RCLike.continuous_ofReal.continuousAt ?_ ++ exact Smooth1ContinuousAt diffSmoothingF SmoothingFpos suppSmoothingF ++ εpos (by positivity) ++ ++theorem SmoothedChebyshevClose_aux {Smooth1 : (ℝ → ℝ) → ℝ → ℝ → ℝ} (SmoothingF : ℝ → ℝ) ++ (c₁ : ℝ) (c₁_pos : 0 < c₁) (c₁_lt : c₁ < 1) ++ (c₂ : ℝ) (c₂_pos : 0 < c₂) (c₂_lt : c₂ < 2) (hc₂ : ∀ (ε x : ℝ), ε ∈ Ioo 0 1 → 1 + c₂ * ε ≤ x → Smooth1 SmoothingF ε x = 0) ++ (C : ℝ) (C_eq : C = 6 * (3 * c₁ + c₂)) ++ (ε : ℝ) (ε_pos : 0 < ε) (ε_lt_one : ε < 1) ++ (X : ℝ) (X_pos : 0 < X) (X_gt_three : 3 < X) (X_bound_1 : 1 ≤ X * ε * c₁) (X_bound_2 : 1 ≤ X * ε * c₂) ++ (smooth1BddAbove : ∀ (n : ℕ), 0 < n → Smooth1 SmoothingF ε (↑n / X) ≤ 1) ++ (smooth1BddBelow : ∀ (n : ℕ), 0 < n → Smooth1 SmoothingF ε (↑n / X) ≥ 0) ++ (smoothIs1 : ∀ (n : ℕ), 0 < n → ↑n ≤ X * (1 - c₁ * ε) → Smooth1 SmoothingF ε (↑n / X) = 1) ++ (smoothIs0 : ∀ (n : ℕ), 1 + c₂ * ε ≤ ↑n / X → Smooth1 SmoothingF ε (↑n / X) = 0) : ++ ‖(↑((∑' (n : ℕ), ArithmeticFunction.vonMangoldt n * Smooth1 SmoothingF ε (↑n / X))) : ℂ) - ++ ↑((Finset.range ⌊X + 1⌋₊).sum ⇑ArithmeticFunction.vonMangoldt)‖ ≤ ++ C * ε * X * Real.log X := by ++ norm_cast ++ ++ let F := Smooth1 SmoothingF ε ++ ++ let n₀ := ⌈X * (1 - c₁ * ε)⌉₊ ++ ++ have n₀_pos : 0 < n₀ := by ++ simp only [Nat.ceil_pos, n₀] ++ subst C_eq ++ simp_all only [mem_Ioo, and_imp, ge_iff_le, implies_true, mul_pos_iff_of_pos_left, sub_pos] ++ exact (mul_le_of_le_one_right c₁_pos.le ε_lt_one.le).trans_lt c₁_lt ++ ++ have n₀_inside_le_X : X * (1 - c₁ * ε) ≤ X := by ++ nth_rewrite 2 [← mul_one X] ++ apply mul_le_mul_of_nonneg_left _ X_pos.le ++ apply sub_le_self ++ positivity ++ ++ have n₀_le : n₀ ≤ X * ((1 - c₁ * ε)) + 1 := by ++ simp only [n₀] ++ apply le_of_lt ++ exact Nat.ceil_lt_add_one (by bound) ++ ++ have n₀_gt : X * ((1 - c₁ * ε)) ≤ n₀ := by ++ simp only [n₀] ++ exact Nat.le_ceil (X * (1 - c₁ * ε)) ++ ++ have sumΛ : Summable (fun (n : ℕ) ↦ Λ n * F (n / X)) := by ++ exact (summable_of_ne_finset_zero fun a s=>mul_eq_zero_of_right _ ++ (hc₂ _ _ (by trivial) ((le_div_iff₀ X_pos).2 (Nat.ceil_le.1 (not_lt.1 ++ (s ∘ Finset.mem_range.2)))))) ++ ++ have sumΛn₀ (n₀ : ℕ) : Summable (fun n ↦ Λ (n + n₀) * F ((n + n₀) / X)) := by exact_mod_cast sumΛ.comp_injective fun Q=>by valid ++ ++ rw[← Summable.sum_add_tsum_nat_add' (k := n₀) (mod_cast sumΛn₀ n₀)] ++ ++ let n₁ := ⌊X * (1 + c₂ * ε)⌋₊ ++ ++ have n₁_pos : 0 < n₁ := by ++ dsimp only [n₁] ++ apply Nat.le_floor ++ rw[Nat.succ_eq_add_one, zero_add] ++ norm_cast ++ apply one_le_mul_of_one_le_of_one_le (by linarith) ++ apply le_add_of_nonneg_right ++ positivity ++ ++ have n₁_ge : X * (1 + c₂ * ε) - 1 ≤ n₁ := by ++ simp only [tsub_le_iff_right, n₁] ++ exact le_of_lt (Nat.lt_floor_add_one (X * (1 + c₂ * ε))) ++ ++ have n₁_le : (n₁ : ℝ) ≤ X * (1 + c₂ * ε) := by ++ simp only [n₁] ++ exact Nat.floor_le (by bound) ++ ++ have n₁_ge_n₀ : n₀ ≤ n₁ := by ++ have hn : (n₀ : ℝ) ≤ (n₁ : ℝ) := by linarith ++ exact_mod_cast hn ++ ++ have n₁_sub_n₀ : (n₁ : ℝ) - n₀ ≤ X * ε * (c₂ + c₁) := by ++ calc ++ (n₁ : ℝ) - n₀ ≤ X * (1 + c₂ * ε) - n₀ := by ++ exact sub_le_sub_right n₁_le ↑n₀ ++ _ ≤ X * (1 + c₂ * ε) - (X * (1 - c₁ * ε)) := by ++ exact tsub_le_tsub_left n₀_gt (X * (1 + c₂ * ε)) ++ _ = X * ε * (c₂ + c₁) := by ring ++ ++ have : (∑' (n : ℕ), Λ (n + n₀ : ) * F ((n + n₀ : ) / X)) = ++ (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((n + n₀) / X)) + ++ (∑' (n : ℕ), Λ (n + n₁ : ) * F ((n + n₁ : ) / X)) := by ++ rw[← Summable.sum_add_tsum_nat_add' (k := n₁ - n₀)] ++ congr! 5 ++ · simp only [Nat.cast_add] ++ · omega ++ · congr! 1 ++ norm_cast ++ omega ++ · convert sumΛn₀ ((n₁ - n₀) + n₀) using 4 ++ · omega ++ · congr! 1 ++ norm_cast ++ omega ++ ++ rw [this] ++ clear this ++ ++ have : (∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X)) = Λ (n₁) * F (↑n₁ / X) := by ++ have : (∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X)) = Λ (n₁) * F (↑n₁ / X) + (∑' (n : ℕ), Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X)) := by ++ let fTemp := fun n ↦ Λ (n + n₁) * F ((↑n + ↑n₁) / X) ++ have sum_fTemp : Summable fTemp := by exact sumΛn₀ n₁ ++ have hTemp (n : ℕ): fTemp n = Λ (n + n₁) * F (↑(n + n₁) / X) := by rw[Nat.cast_add] ++ have : ∑' (n : ℕ), Λ (n + n₁) * F (↑(n + n₁) / X) = ∑' (n : ℕ), fTemp n := by exact Eq.symm (tsum_congr hTemp) ++ rw[this] ++ have (n : ℕ): fTemp (n + 1) = Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X) := by exact hTemp (n + 1) ++ have : ∑' (n : ℕ), Λ (n + 1 + n₁) * F (↑(n + 1 + n₁) / X) = ∑' (n : ℕ), fTemp (n + 1) := by exact Eq.symm (tsum_congr this) ++ rw[this] ++ have : Λ n₁ * F (↑n₁ / X) = fTemp 0 := by ++ dsimp only [fTemp] ++ rw[← Nat.cast_add, zero_add] ++ rw[this] ++ exact Summable.tsum_eq_zero_add (sumΛn₀ n₁) ++ rw[this] ++ apply add_eq_left.mpr ++ convert tsum_zero with n ++ have : n₁ ≤ n + (n₁) := by exact Nat.le_add_left (n₁) n ++ convert mul_zero _ ++ convert smoothIs0 (n + 1 + n₁) ?_ ++ rw[← mul_le_mul_iff_left₀ X_pos] ++ have : ↑(n + 1 + n₁) / X * X = ↑(n + 1 + n₁) := by field_simp ++ rw[this] ++ have : (1 + c₂ * ε) * X = 1 + (X * (1 + c₂ * ε) - 1) := by ring ++ rw[this, Nat.cast_add, Nat.cast_add] ++ exact add_le_add (by bound) n₁_ge ++ ++ rw [this] ++ clear this ++ ++ have X_le_floor_add_one : X ≤ ↑⌊X + 1⌋₊ := by ++ rw[Nat.floor_add_one, Nat.cast_add, Nat.cast_one] ++ have temp : X ≤ ↑⌈X⌉₊ := by exact Nat.le_ceil X ++ have : (⌈X⌉₊ : ℝ) ≤ ↑⌊X⌋₊ + 1 := by exact_mod_cast Nat.ceil_le_floor_add_one X ++ exact Preorder.le_trans X (↑⌈X⌉₊) (↑⌊X⌋₊ + 1) temp this ++ positivity ++ ++ have floor_X_add_one_le_self : ↑⌊X + 1⌋₊ ≤ X + 1 := by exact Nat.floor_le (by positivity) ++ ++ have : ∑ x ∈ Finset.range ⌊X + 1⌋₊, Λ x = ++ (∑ x ∈ Finset.range n₀, Λ x) + ++ ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + ↑n₀) := by ++ simp only [add_comm _ n₀] ++ rw [← Finset.sum_range_add, Nat.add_sub_of_le] ++ dsimp only [n₀] ++ refine Nat.ceil_le.mpr ?_ ++ exact Preorder.le_trans (X * (1 - c₁ * ε)) X (↑⌊X + 1⌋₊) n₀_inside_le_X X_le_floor_add_one ++ rw [this] ++ clear this ++ ++ have : ∑ n ∈ Finset.range n₀, Λ n * F (↑n / X) = ++ ∑ n ∈ Finset.range n₀, Λ n := by ++ apply Finset.sum_congr rfl ++ intro n hn ++ by_cases n_zero : n = 0 ++ · rw [n_zero] ++ simp only [ArithmeticFunction.map_zero, CharP.cast_eq_zero, zero_div, zero_mul] ++ · convert mul_one _ ++ convert smoothIs1 n (Nat.zero_lt_of_ne_zero n_zero) ?_ ++ simp only [Finset.mem_range, n₀] at hn ++ have : (n < ⌈X * (1 - c₁ * ε)⌉₊) → (n ≤ ⌊X * (1 - c₁ * ε)⌋₊) := by ++ intro n_lt ++ by_contra hcontra ++ ++ rw[not_le] at hcontra ++ ++ have temp1: (⌊X * (1 - c₁ * ε)⌋₊).succ.succ ≤ n.succ := by ++ apply Nat.succ_le_succ ++ exact Nat.succ_le_of_lt hcontra ++ have : n.succ ≤ ⌈X * (1 - c₁ * ε)⌉₊ := by exact Nat.succ_le_of_lt hn ++ have temp2: ⌊X * (1 - c₁ * ε)⌋₊ + 2 = (⌊X * (1 - c₁ * ε)⌋₊ + 1) + 1 := by ring ++ have : ⌊X * (1 - c₁ * ε)⌋₊ + 2 ≤ ⌈X * (1 - c₁ * ε)⌉₊ := by ++ rw[temp2, ← Nat.succ_eq_add_one, ← Nat.succ_eq_add_one] ++ exact Nat.le_trans temp1 hn ++ rw[← and_not_self_iff (⌊X * (1 - c₁ * ε)⌋₊ + 2 ≤ ⌈X * (1 - c₁ * ε)⌉₊), not_le] ++ apply And.intro ++ exact this ++ rw[temp2, ← Nat.succ_eq_add_one, Nat.lt_succ_iff] ++ exact Nat.ceil_le_floor_add_one (X * (1 - c₁ * ε)) ++ exact (Nat.le_floor_iff' n_zero).mp (this hn) ++ ++ rw [this, sub_eq_add_neg, add_assoc, add_assoc] ++ nth_rewrite 3 [add_comm] ++ nth_rewrite 2 [← add_assoc] ++ rw [← add_assoc, ← add_assoc, ← sub_eq_add_neg] ++ clear this ++ ++ have : ++ ∑ n ∈ Finset.range n₀, Λ n + (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X)) - ++ (∑ x ∈ Finset.range n₀, Λ x + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀)) ++ = ++ (∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X)) - ++ (∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀)) := by ++ ring ++ rw [this] ++ clear this ++ ++ have : ++ ‖∑ n ∈ Finset.range (n₁ - n₀), Λ (n + n₀) * F ((↑n + ↑n₀) / X) - ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), Λ (x + n₀) + Λ n₁ * F (↑n₁ / X)‖ ++ ≤ ++ (∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖) + ++ ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + ++ ‖Λ n₁‖ * ‖F (↑n₁ / X)‖:= by ++ apply norm_add_le_of_le ++ apply norm_sub_le_of_le ++ apply norm_sum_le_of_le ++ intro b hb ++ exact norm_mul_le_of_le (by rfl) (by rfl) ++ apply norm_sum_le_of_le ++ intro b hb ++ rfl ++ exact_mod_cast norm_mul_le_of_le (by rfl) (by rfl) ++ ++ refine this.trans ?_ ++ ++ clear this ++ ++ have vonBnd1 : ++ ∀ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ ≤ Real.log (X * (1 + c₂ * ε)) := by ++ intro n hn ++ have n_add_n0_le_n1: (n : ℝ) + n₀ ≤ n₁ := by ++ apply le_of_lt ++ rw[Finset.mem_range] at hn ++ rw[← add_lt_add_iff_right (-↑n₀), add_neg_cancel_right, add_comm, ← sub_eq_neg_add] ++ exact_mod_cast hn ++ have inter1: ‖ Λ (n + n₀)‖ ≤ Real.log (↑n + ↑n₀) := by ++ rw[Real.norm_of_nonneg, ← Nat.cast_add] ++ apply ArithmeticFunction.vonMangoldt_le_log ++ apply ArithmeticFunction.vonMangoldt_nonneg ++ have inter2: Real.log (↑n + ↑n₀) ≤ Real.log (↑n₁) := by exact_mod_cast Real.log_le_log (by positivity) n_add_n0_le_n1 ++ have inter3: Real.log (↑n₁) ≤ Real.log (X * (1 + c₂ * ε)) := by exact Real.log_le_log (by bound) (by linarith) ++ exact inter1.trans (inter2.trans inter3) ++ ++ have bnd1 : ++ ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ ++ ≤ (n₁ - n₀) * Real.log (X * (1 + c₂ * ε)) := by ++ have : (n₁ - n₀) * Real.log (X * (1 + c₂ * ε)) = (∑ n ∈ Finset.range (n₁ - n₀), Real.log (X * (1 + c₂ * ε))) := by ++ rw[← Nat.cast_sub] ++ nth_rewrite 1 [← Finset.card_range (n₁ - n₀)] ++ rw[Finset.cast_card, Finset.sum_const, smul_one_mul] ++ exact Eq.symm (Finset.sum_const (Real.log (X * (1 + c₂ * ε)))) ++ exact n₁_ge_n₀ ++ rw [this] ++ apply Finset.sum_le_sum ++ intro n hn ++ rw [← mul_one (Real.log (X * (1 + c₂ * ε)))] ++ apply mul_le_mul (vonBnd1 _ hn) _ (norm_nonneg _) (log_nonneg (by bound)) ++ rw[Real.norm_of_nonneg, ← Nat.cast_add] ++ dsimp only [F] ++ apply smooth1BddAbove ++ bound ++ rw[← Nat.cast_add] ++ dsimp only [F] ++ apply smooth1BddBelow ++ bound ++ ++ have bnd2 : ++ ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ ≤ (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) := by ++ have : (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) = (∑ n ∈ Finset.range (⌊X + 1⌋₊ - n₀), Real.log (X + 1)) := by ++ rw[← Nat.cast_sub] ++ nth_rewrite 1 [← Finset.card_range (⌊X + 1⌋₊ - n₀)] ++ rw[Finset.cast_card, Finset.sum_const, smul_one_mul] ++ exact Eq.symm (Finset.sum_const (Real.log (X + 1))) ++ simp only [Nat.ceil_le, n₀] ++ exact Preorder.le_trans (X * (1 - c₁ * ε)) X (↑⌊X + 1⌋₊) n₀_inside_le_X X_le_floor_add_one ++ rw[this] ++ apply Finset.sum_le_sum ++ intro n hn ++ have n_add_n0_le_X_add_one: (n : ℝ) + n₀ ≤ X + 1 := by ++ rw[Finset.mem_range] at hn ++ rw[← add_le_add_iff_right (-↑n₀), add_assoc, ← sub_eq_add_neg, sub_self, add_zero, ← sub_eq_add_neg] ++ have temp: (n : ℝ) < ⌊X + 1⌋₊ - n₀ := by ++ rw[← Nat.cast_sub, Nat.cast_lt] ++ exact hn ++ simp only [Nat.ceil_le, n₀] ++ exact le_trans n₀_inside_le_X X_le_floor_add_one ++ have : ↑⌊X + 1⌋₊ - ↑n₀ ≤ X + 1 - ↑n₀ := by ++ apply sub_le_sub_right floor_X_add_one_le_self ++ exact le_of_lt (lt_of_le_of_lt' this temp) ++ have inter1: ‖ Λ (n + n₀)‖ ≤ Real.log (↑n + ↑n₀) := by ++ rw[Real.norm_of_nonneg, ← Nat.cast_add] ++ apply ArithmeticFunction.vonMangoldt_le_log ++ apply ArithmeticFunction.vonMangoldt_nonneg ++ apply le_trans inter1 ++ exact_mod_cast Real.log_le_log (by positivity) (n_add_n0_le_X_add_one) ++ ++ have largeSumBound := add_le_add bnd1 bnd2 ++ ++ clear vonBnd1 bnd1 bnd2 ++ ++ have inter1 : Real.log (X * (1 + c₂ * ε)) ≤ Real.log (3 * X) := by ++ apply Real.log_le_log (by positivity) ++ have const_le_2: 1 + c₂ * ε ≤ 3 := by ++ have : (3 : ℝ) = 1 + 2 := by ring ++ rw[this] ++ apply add_le_add_right ++ rw[← mul_one 2] ++ exact mul_le_mul (by linarith) (by linarith) (by positivity) (by positivity) ++ rw[mul_comm] ++ exact mul_le_mul const_le_2 (by rfl) (by positivity) (by positivity) ++ ++ have inter2 : (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) ≤ (X * ε * (c₂ + c₁)) * (Real.log (X) + Real.log (3)) := by ++ apply mul_le_mul n₁_sub_n₀ _ (log_nonneg (by linarith)) (by positivity) ++ rw[← Real.log_mul (by positivity) (by positivity)] ++ nth_rewrite 3 [mul_comm] ++ exact inter1 ++ ++ have inter3 : (X * ε * (c₂ + c₁)) * (Real.log (X) + Real.log (3)) ≤ 2 * (X * ε * (c₂ + c₁)) * (Real.log (X)) := by ++ nth_rewrite 3 [mul_assoc] ++ rw[two_mul, mul_add] ++ apply add_le_add_right ++ apply mul_le_mul_of_nonneg_left _ (by positivity) ++ exact Real.log_le_log (by positivity) (by linarith) ++ ++ have inter4 : (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) ≤ 2 * (X * ε * (c₁ + c₂)) * (Real.log (X)) := by ++ nth_rewrite 2 [add_comm] ++ exact le_trans inter2 inter3 ++ ++ clear inter2 inter3 ++ ++ have inter6 : (⌊X + 1⌋₊ - n₀) * Real.log (X + 1) ≤ 2 * (X * ε * c₁) * (Real.log (X) + Real.log (3)) := by ++ apply mul_le_mul _ _ (log_nonneg (by linarith)) (by positivity) ++ have : 2 * (X * ε * c₁) = (X * (1 + ε * c₁)) - (X * (1 - ε * c₁)) := by ring ++ rw[this] ++ apply sub_le_sub ++ have : X + 1 ≤ X * (1 + ε * c₁) := by ++ ring_nf ++ rw[add_comm, add_le_add_iff_left] ++ exact X_bound_1 ++ exact le_trans floor_X_add_one_le_self this ++ nth_rewrite 2 [mul_comm] ++ exact n₀_gt ++ rw[← Real.log_mul (by positivity) (by norm_num), mul_comm] ++ exact Real.log_le_log (by positivity) (by linarith) ++ ++ have inter7: 2 * (X * ε * c₁) * (Real.log (X) + Real.log (3)) ≤ 4 * (X * ε * c₁) * Real.log (X) := by ++ have : (4 : ℝ) = 2 + 2 := by ring ++ rw[this, mul_add] ++ nth_rewrite 5 [mul_assoc] ++ rw[add_mul] ++ apply add_le_add ++ nth_rewrite 1 [mul_assoc] ++ rfl ++ nth_rewrite 1 [mul_assoc] ++ apply mul_le_mul_of_nonneg_left _ (by norm_num) ++ apply mul_le_mul_of_nonneg_left <| Real.log_le_log (by positivity) (by linarith) ++ positivity ++ ++ have inter9: (↑n₁ - ↑n₀) * Real.log (X * (1 + c₂ * ε)) + (↑⌊X + 1⌋₊ - ↑n₀) * Real.log (X + 1) ≤ ++ 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X := by ++ have : 2 * (X * ε * (3 * c₁ + c₂)) = 2 * (X * ε * (c₁ + c₂)) + 4 * (X * ε * c₁) := by ring ++ rw[this, add_mul] ++ exact add_le_add inter4 <| le_trans inter6 inter7 ++ ++ have largeSumBound2 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ ≤ ++ 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X := by ++ exact le_trans largeSumBound inter9 ++ ++ clear largeSumBound inter4 inter9 ++ ++ have inter2 : ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ Real.log (X * (1 + c₂ * ε)) := by ++ rw[← mul_one (Real.log (X * (1 + c₂ * ε)))] ++ apply mul_le_mul _ _ (norm_nonneg _) (log_nonneg (by bound)) ++ rw[Real.norm_of_nonneg ArithmeticFunction.vonMangoldt_nonneg] ++ exact le_trans ArithmeticFunction.vonMangoldt_le_log <| Real.log_le_log (mod_cast n₁_pos) n₁_le ++ rw[Real.norm_of_nonneg] ++ apply smooth1BddAbove _ n₁_pos ++ apply smooth1BddBelow _ n₁_pos ++ ++ have largeSumBound3 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + ++ ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ 2 * (X * ε * (3 * c₁ + c₂)) * Real.log X + Real.log (3 * X) := by exact add_le_add largeSumBound2 (le_trans inter2 inter1) ++ clear inter1 inter2 largeSumBound2 ++ ++ have largeSumBound4 : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + ++ ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ 2 * (X * ε * (3 * c₁ + c₂)) * (2 * Real.log X + Real.log (3)) := by ++ nth_rewrite 2 [two_mul, add_assoc] ++ rw [← Real.log_mul (by positivity) (by positivity), mul_comm X 3] ++ apply le_trans largeSumBound3 ++ nth_rewrite 2 [mul_add] ++ apply add_le_add_right ++ nth_rewrite 1 [← one_mul (Real.log (3 * X))] ++ apply mul_le_mul_of_nonneg_right _ (log_nonneg (by linarith)) ++ linarith ++ ++ clear largeSumBound3 ++ ++ have largeSumBoundFinal : ∑ n ∈ Finset.range (n₁ - n₀), ‖Λ (n + n₀)‖ * ‖F ((↑n + ↑n₀) / X)‖ + ∑ x ∈ Finset.range (⌊X + 1⌋₊ - n₀), ‖Λ (x + n₀)‖ + ++ ‖Λ n₁‖ * ‖F (↑n₁ / X)‖ ≤ (6 * (X * ε * (3 * c₁ + c₂))) * Real.log (X) := by ++ apply le_trans largeSumBound4 ++ rw[mul_add] ++ have : (6 : ℝ) = 4 + 2 := by ring ++ rw[this, add_mul, add_mul] ++ apply add_le_add ++ ring_nf ++ rfl ++ apply mul_le_mul_of_nonneg_left _ (by positivity) ++ exact Real.log_le_log (by positivity) (by linarith) ++ ++ clear largeSumBound4 ++ ++ rw[C_eq] ++ linear_combination largeSumBoundFinal ++ ++theorem SmoothedChebyshevClose {SmoothingF : ℝ → ℝ} ++ (diffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) ++ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : ++ ∃ C > 0, ∀ (X : ℝ) (_ : 3 < X) (ε : ℝ) (_ : 0 < ε) (_ : ε < 1) (_ : 2 < X * ε), ++ ‖SmoothedChebyshev SmoothingF ε X - ChebyshevPsi X‖ ≤ C * ε * X * Real.log X := by ++ have vonManBnd (n : ℕ) : ArithmeticFunction.vonMangoldt n ≤ Real.log n := ++ ArithmeticFunction.vonMangoldt_le_log ++ ++ obtain ⟨c₁, c₁_pos, c₁_eq, hc₁⟩ := Smooth1Properties_below suppSmoothingF mass_one ++ ++ obtain ⟨c₂, c₂_pos, c₂_eq, hc₂⟩ := Smooth1Properties_above suppSmoothingF ++ ++ have c₁_lt : c₁ < 1 := by ++ rw[c₁_eq] ++ exact lt_trans (Real.log_two_lt_d9) (by norm_num) ++ ++ have c₂_lt : c₂ < 2 := by ++ rw[c₂_eq] ++ nth_rewrite 3 [← mul_one 2] ++ apply mul_lt_mul' ++ rfl ++ exact lt_trans (Real.log_two_lt_d9) (by norm_num) ++ exact Real.log_nonneg (by norm_num) ++ positivity ++ ++ let C : ℝ := 6 * (3 * c₁ + c₂) ++ have C_eq : C = 6 * (3 * c₁ + c₂) := rfl ++ ++ clear_value C ++ ++ have Cpos : 0 < C := by ++ rw [C_eq] ++ positivity ++ ++ refine ⟨C, Cpos, fun X X_ge_C ε εpos ε_lt_one ↦ ?_⟩ ++ unfold ChebyshevPsi ++ ++ have X_gt_zero : (0 : ℝ) < X := by linarith ++ ++ have X_ne_zero : X ≠ 0 := by linarith ++ ++ have n_on_X_pos {n : ℕ} (npos : 0 < n) : ++ 0 < n / X := by ++ have : (0 : ℝ) < n := by exact_mod_cast npos ++ positivity ++ ++ have smooth1BddAbove (n : ℕ) (npos : 0 < n) : ++ Smooth1 SmoothingF ε (n / X) ≤ 1 := ++ Smooth1LeOne SmoothingFnonneg mass_one εpos (n_on_X_pos npos) ++ ++ have smooth1BddBelow (n : ℕ) (npos : 0 < n) : ++ Smooth1 SmoothingF ε (n / X) ≥ 0 := ++ Smooth1Nonneg SmoothingFnonneg (n_on_X_pos npos) εpos ++ ++ have smoothIs1 (n : ℕ) (npos : 0 < n) (n_le : n ≤ X * (1 - c₁ * ε)) : ++ Smooth1 SmoothingF ε (↑n / X) = 1 := by ++ apply hc₁ (ε := ε) (n / X) εpos (n_on_X_pos npos) ++ exact (div_le_iff₀' X_gt_zero).mpr n_le ++ ++ have smoothIs0 (n : ℕ) (n_le : (1 + c₂ * ε) ≤ n / X) := ++ hc₂ (ε := ε) (n / X) ⟨εpos, ε_lt_one⟩ n_le ++ ++ have ε_pos: ε > 0 := by linarith ++ have X_pos: X > 0 := by linarith ++ have X_gt_three : 3 < X := by linarith ++ ++ intro X_bound ++ ++ have X_bound_1 : 1 ≤ X * ε * c₁ := by ++ rw[c₁_eq, ← div_le_iff₀] ++ have : 1 / Real.log 2 < 2 := by ++ nth_rewrite 2 [← one_div_one_div 2] ++ rw[one_div_lt_one_div] ++ exact lt_of_le_of_lt (by norm_num) (Real.log_two_gt_d9) ++ exact Real.log_pos (by norm_num) ++ norm_num ++ apply le_of_lt ++ exact gt_trans X_bound this ++ exact Real.log_pos (by norm_num) ++ ++ have X_bound_2 : 1 ≤ X * ε * c₂ := by ++ rw[c₂_eq, ← div_le_iff₀] ++ have : 1 / (2 * Real.log 2) < 2 := by ++ nth_rewrite 3 [← one_div_one_div 2] ++ rw[one_div_lt_one_div, ← one_mul (1 / 2)] ++ apply mul_lt_mul ++ norm_num ++ apply le_of_lt ++ exact lt_trans (by norm_num) (Real.log_two_gt_d9) ++ all_goals norm_num ++ exact Real.log_pos (by norm_num) ++ ++ apply le_of_lt ++ exact gt_trans X_bound this ++ norm_num ++ exact Real.log_pos (by norm_num) ++ ++ rw [SmoothedChebyshevDirichlet diffSmoothingF SmoothingFnonneg suppSmoothingF ++ mass_one (by linarith) εpos ε_lt_one] ++ ++ convert SmoothedChebyshevClose_aux SmoothingF c₁ c₁_pos c₁_lt c₂ c₂_pos c₂_lt hc₂ C C_eq ε ε_pos ε_lt_one ++ X X_pos X_gt_three X_bound_1 X_bound_2 smooth1BddAbove smooth1BddBelow smoothIs1 smoothIs0 ++ ++@[inline] noncomputable def sigma1Of (A T : ℝ) : ℝ := 1 - A / Real.log T ++ ++noncomputable def I₁ (SmoothingF : ℝ → ℝ) (ε X T : ℝ) : ℂ := ++ (1 / (2 * π * I)) * (I * (∫ t : ℝ in Iic (-T), ++ SmoothedChebyshevIntegrand SmoothingF ε X ((1 + (Real.log X)⁻¹) + t * I))) ++ ++noncomputable def I₂ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := ++ (1 / (2 * π * I)) * ((∫ σ in σ₁..(1 + (Real.log X)⁻¹), ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ - T * I))) ++ ++noncomputable def I₃₇ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := ++ (1 / (2 * π * I)) * (I * (∫ t in (-T)..T, ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) ++ ++noncomputable def I₈ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := ++ (1 / (2 * π * I)) * ((∫ σ in σ₁..(1 + (Real.log X)⁻¹), ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ + T * I))) ++ ++noncomputable def I₉ (SmoothingF : ℝ → ℝ) (ε X T : ℝ) : ℂ := ++ (1 / (2 * π * I)) * (I * (∫ t : ℝ in Ici T, ++ SmoothedChebyshevIntegrand SmoothingF ε X ((1 + (Real.log X)⁻¹) + t * I))) ++ ++noncomputable def I₃ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := ++ (1 / (2 * π * I)) * (I * (∫ t in (-T)..(-3), ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) ++ ++noncomputable def I₇ (SmoothingF : ℝ → ℝ) (ε T X σ₁ : ℝ) : ℂ := ++ (1 / (2 * π * I)) * (I * (∫ t in (3 : ℝ)..T, ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ₁ + t * I))) ++ ++noncomputable def I₄ (SmoothingF : ℝ → ℝ) (ε X σ₁ σ₂ : ℝ) : ℂ := ++ (1 / (2 * π * I)) * ((∫ σ in σ₂..σ₁, ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ - 3 * I))) ++ ++noncomputable def I₆ (SmoothingF : ℝ → ℝ) (ε X σ₁ σ₂ : ℝ) : ℂ := ++ (1 / (2 * π * I)) * ((∫ σ in σ₂..σ₁, ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ + 3 * I))) ++ ++noncomputable def I₅ (SmoothingF : ℝ → ℝ) (ε X σ₂ : ℝ) : ℂ := ++ (1 / (2 * π * I)) * (I * (∫ t in (-3)..3, ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ₂ + t * I))) ++ ++theorem realDiff_of_complexDiff {f : ℂ → ℂ} (s : ℂ) (hf : DifferentiableAt ℂ f s) : ++ ContinuousAt (fun (x : ℝ) ↦ f (s.re + x * I)) s.im := by ++ apply ContinuousAt.comp _ (by fun_prop) ++ convert hf.continuousAt ++ simp ++ ++theorem riemannZeta_bdd_on_vertical_lines {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) (t : ℝ) : ++ ∃ c > 0, ‖ζ (σ₀ + t * I)‖ ≤ c := ++ by ++ let s := σ₀ + t * I ++ let s_re : ℂ := σ₀ ++ ++ have H : s.re = σ₀ := by ++ rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] ++ simp ++ ++ have non_neg : σ₀ ≠ 0 := by ++ by_contra h ++ rw [h] at σ₀_gt ++ norm_cast at σ₀_gt ++ ++ have pos : s.re > 1 := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm H)) ++ have pos_triv : s_re.re > 1 := by exact σ₀_gt ++ ++ have series := LSeries_one_eq_riemannZeta pos ++ rw [← series] ++ ++ have identity : ∀(n : ℕ), ‖LSeries.term 1 s n‖ = 1 / n^σ₀ := by ++ unfold LSeries.term ++ intro n ++ by_cases h0 : n = 0 ++ · simp [*] ++ · simp [*] ++ push Not at h0 ++ have C : n > 0 := by exact Nat.zero_lt_of_ne_zero h0 ++ have T := Complex.norm_natCast_cpow_of_pos C s ++ rw [H] at T ++ exact T ++ ++ have summable : Summable (fun (n : ℕ) ↦ ‖LSeries.term 1 s n‖) := by ++ simp [identity] ++ exact σ₀_gt ++ ++ have B := calc ++ ‖∑' (n : ℕ), LSeries.term 1 s n‖ ≤ ∑' (n : ℕ), ‖LSeries.term 1 s n‖ := norm_tsum_le_tsum_norm summable ++ _ ≤ ∑' (n : ℕ), (1 / ↑n^σ₀) := by simp [← identity] ++ _ ≤ norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) := by exact le_norm_self (∑' (n : ℕ), 1 / ↑n ^ σ₀) ++ _ ≤ 1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) := by linarith ++ ++ let c : ℝ := 1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ ) ++ ++ have c_is_pos : c > 0 := by positivity ++ use (1 + norm (∑' (n : ℕ), (1 / ↑n^σ₀) : ℝ )) ++ exact ⟨c_is_pos, B⟩ ++ ++theorem summable_real_iff_summable_coe_complex (f : ℕ → ℝ) : ++ Summable f ↔ Summable (fun n => (f n : ℂ)) := by ++ constructor ++ ++ · intro ⟨s, hs⟩ ++ use (s : ℂ) ++ exact hasSum_ofReal.mpr hs ++ ++ · intro ⟨s, hs⟩ ++ use s.re ++ have h_re : HasSum (fun n => ((f n : ℂ)).re) s.re := ++ by exact hasSum_re hs ++ simpa using! h_re ++ ++theorem cast_pow_eq (n : ℕ) (σ₀ : ℝ): ++ (↑((↑n : ℝ) ^ σ₀) : ℂ ) = (↑n : ℂ) ^ (↑σ₀ : ℂ) := by ++ have U : (↑n : ℝ) ≥ 0 := by exact Nat.cast_nonneg' n ++ have endit := Complex.ofReal_cpow U σ₀ ++ exact endit ++ ++theorem strongPnt_summable_complex_then_summable_real_part (f : ℕ → ℂ) : ++ Summable f → Summable (fun n ↦ (f n).re) := by ++ intro ⟨s, hs⟩ ++ use s.re ++ have h_re : HasSum (fun n => ((f n : ℂ)).re) s.re := ++ by exact hasSum_re hs ++ convert h_re using 1 ++ ++theorem strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized : ++ ∀(σ₀ σ₁ : ℝ), ∀(t : ℝ), 1 < σ₀ → σ₀ ≤ σ₁ → ++ ‖(- ζ' (σ₁ + t * I) / ζ (σ₁ + t * I))‖ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by ++ intro σ₀ σ₁ t σ₀_gt_one σ₀_lt_σ₁ ++ ++ let s₁ := σ₁ + t * I ++ have s₁_re_eq_sigma : s₁.re = σ₁ := by ++ rw [Complex.add_re (σ₁) (t * I)] ++ rw [Complex.ofReal_re σ₁] ++ rw [Complex.mul_I_re] ++ simp [*] ++ ++ have s₀_re_eq_sigma : (↑σ₀ : ℂ).re = σ₀ := by ++ rw [Complex.ofReal_re σ₀] ++ ++ let s₀ := σ₀ ++ ++ have σ₁_gt_one : 1 < σ₁ := by exact lt_of_le_of_lt' σ₀_lt_σ₁ σ₀_gt_one ++ have s₀_gt_one : 1 < (↑σ₀ : ℂ).re := by exact σ₀_gt_one ++ ++ have s₁_re_geq_one : 1 < s₁.re := by exact lt_of_lt_of_eq σ₁_gt_one (id (Eq.symm s₁_re_eq_sigma)) ++ have s₁_re_coerce_geq_one : 1 < (↑s₁.re : ℂ).re := by exact s₁_re_geq_one ++ rw [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₁_re_geq_one)] ++ unfold LSeries ++ ++ have summable_von_mangoldt : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) s₁.re i) := by ++ exact ArithmeticFunction.LSeriesSummable_vonMangoldt s₁_re_geq_one ++ ++ have summable_von_mangoldt_at_σ₀ : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i) := by ++ exact ArithmeticFunction.LSeriesSummable_vonMangoldt σ₀_gt_one ++ ++ have summable_re_von_mangoldt : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) s₁.re i).re) := by ++ exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) s₁.re) summable_von_mangoldt ++ ++ have summable_re_von_mangoldt_at_σ₀ : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i).re) := by ++ exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) σ₀) summable_von_mangoldt_at_σ₀ ++ ++ have positivity : ∀(n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ = (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by ++ intro n ++ calc ++ ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ = Λ n / ‖(↑n : ℂ)^(s₁ : ℂ)‖ := by ++ unfold LSeries.term ++ by_cases h : n = 0 ++ · simp [*] ++ · push Not at h ++ simp [*] ++ ++ _ = Λ n / (↑n)^s₁.re := by ++ by_cases h : n = 0 ++ · simp [*] ++ · rw [Complex.norm_natCast_cpow_of_pos] ++ push Not at h ++ exact Nat.zero_lt_of_ne_zero h ++ ++ _ = (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by ++ unfold LSeries.term ++ by_cases h : n = 0 ++ · simp [*] ++ · simp [*] ++ push Not at h ++ ring_nf ++ rw [Complex.re_ofReal_mul (Λ n)] ++ ring_nf ++ rw [Complex.inv_re] ++ rw [Complex.cpow_ofReal_re] ++ simp [*] ++ left ++ have N : (0 : ℝ) ≤ ↑n := by exact Nat.cast_nonneg' n ++ have T2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).re = (↑n : ℝ)^σ₁ := by exact rfl ++ have T1 : ((↑n : ℂ ) ^ (↑σ₁ : ℂ)).im = 0 := by ++ refine abs_re_eq_norm.mp ?_ ++ rw [T2] ++ simp [*] ++ exact Real.rpow_nonneg N σ₁ ++ ++ simp [Complex.normSq_apply] ++ simp [T1, T2] ++ ++ have summable_abs_value : Summable (fun i ↦ ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ i‖) := by ++ rw [summable_congr positivity] ++ exact summable_re_von_mangoldt ++ ++ have triangle_ineq : ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), ↑‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ := ++ norm_tsum_le_tsum_norm summable_abs_value ++ ++ have bounded_by_sum_of_re : ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n).re := ++ by ++ simp [positivity] at triangle_ineq ++ exact triangle_ineq ++ ++ have sum_of_re_commutes : ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n).re = (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)).re := ++ (Complex.re_tsum (summable_von_mangoldt)).symm ++ ++ have re_of_sum_bdd_by_norm : (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)).re ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)‖ := ++ Complex.re_le_norm (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s₁.re) n)) ++ ++ have ineq_s₁_s₀ : ∀(n : ℕ), ++ (LSeries.term (fun n ↦ Λ n) s₁.re n).re ≤ (LSeries.term (fun n ↦ Λ n) σ₀ n).re := ++ by ++ intro n ++ unfold LSeries.term ++ by_cases h : n = 0 ++ · simp [*] ++ · push Not at h ++ simp [*] ++ have H : 0 ≤ Λ n := ArithmeticFunction.vonMangoldt_nonneg ++ ring_nf ++ rw [Complex.re_ofReal_mul (Λ n) ((↑n : ℂ) ^ (↑σ₁ : ℂ))⁻¹] ++ rw [Complex.re_ofReal_mul (Λ n) ((↑n : ℂ) ^ (↑σ₀ : ℂ))⁻¹] ++ refine mul_le_mul_of_nonneg_left ?_ H ++ · simp [Complex.inv_re] ++ have R1 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).re = (↑n : ℝ) ^ σ₀ := rfl ++ have R2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).re = (↑n : ℝ) ^ σ₁ := rfl ++ have geq : 1 ≤ n := Nat.one_le_iff_ne_zero.mpr h ++ have geq_zero : 0 ≤ n := Nat.zero_le n ++ have n_geq_one : (1 : ℝ) ≤ ↑n := by ++ norm_cast ++ have n_geq_pos : (0 : ℝ) ≤ ↑n := by ++ norm_cast ++ have n_gt_pos : (0 : ℝ) < (↑n) := by ++ norm_cast ++ ++ have I1 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).im = 0 := by ++ refine abs_re_eq_norm.mp ?_ ++ rw [R1] ++ simp [*] ++ exact Real.rpow_nonneg n_geq_pos σ₀ ++ ++ have I2 : ((↑n : ℂ) ^ (↑σ₁ : ℂ)).im = 0 := by ++ refine abs_re_eq_norm.mp ?_ ++ rw [R2] ++ simp [*] ++ exact Real.rpow_nonneg n_geq_pos σ₁ ++ ++ simp [Complex.normSq_apply, R1, R2, I1, I2] ++ have P1 : 0 < (↑n : ℝ)^σ₁ := Real.rpow_pos_of_pos n_gt_pos σ₁ ++ have P2 : 0 < (↑n : ℝ)^σ₀ := Real.rpow_pos_of_pos n_gt_pos σ₀ ++ ++ have N : (↑n : ℝ)^σ₀ ≤ (↑n : ℝ)^σ₁ := ++ Real.rpow_le_rpow_of_exponent_le n_geq_one σ₀_lt_σ₁ ++ apply inv_anti₀ ++ · exact P2 ++ · exact N ++ ++ have Z := ++ by ++ calc ++ ‖LSeries (fun n ↦ ↑(Λ n)) s₁‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s₁ n‖ ++ := norm_tsum_le_tsum_norm summable_abs_value ++ _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s₁.re n).re := by simp [←positivity] ++ _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n).re := by ++ refine Summable.tsum_mono ?_ ?_ ineq_s₁_s₀ ++ · exact summable_re_von_mangoldt ++ · exact summable_re_von_mangoldt_at_σ₀ ++ _ = (∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n)).re := (Complex.re_tsum (summable_von_mangoldt_at_σ₀)).symm ++ _ ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) σ₀ n)‖ := re_le_norm (∑' (n : ℕ), LSeries.term (fun n ↦ ↑(Λ n)) σ₀ n) ++ _ = ‖- ζ' (σ₀) / ζ (σ₀)‖ := by ++ simp only [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s₀_gt_one)] ++ unfold LSeries ++ rfl ++ _ = ‖ζ' σ₀ / ζ σ₀‖ := by ++ rw [← s₀_re_eq_sigma] ++ simp [*] ++ ++ exact Z ++ ++theorem strongPnt_triv_bound_zeta : ++ ∃C ≥ 0, ∀(σ₀ t : ℝ), 1 < σ₀ → ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ (σ₀ - 1)⁻¹ + C ++ := by ++ ++ let ⟨U, ⟨U_in_nhds, zeta_residue_on_U⟩⟩ := riemannZetaLogDerivResidue ++ ++ let ⟨open_in_U, ⟨open_in_U_subs_U, open_in_U_is_open, one_in_open_U⟩⟩ := mem_nhds_iff.mp U_in_nhds ++ ++ let ⟨ε₀, ⟨ε_pos, metric_ball_around_1_is_in_U'⟩⟩ := EMetric.isOpen_iff.mp open_in_U_is_open (1 : ℂ) one_in_open_U ++ ++ let ε := if ε₀ = ⊤ then ENNReal.ofReal 1 else ε₀ ++ have O1 : ε ≠ ⊤ := by ++ by_cases h : ε₀ = ⊤ ++ · unfold ε ++ simp [*] ++ · unfold ε ++ simp [*] ++ ++ have metric_ball_around_1_is_in_U : ++ Metric.eball (1 : ℂ) ε ⊆ U := by ++ by_cases h : ε₀ = ⊤ ++ · unfold ε ++ simp [*] ++ have T : Metric.eball (1 : ℂ) 1 ⊆ Metric.eball 1 ε₀ := by ++ rw [h] ++ exact Metric.eball_subset_eball (by simp) ++ exact subset_trans (subset_trans T metric_ball_around_1_is_in_U') open_in_U_subs_U ++ ++ · unfold ε ++ ++ simp [h] ++ exact subset_trans metric_ball_around_1_is_in_U' open_in_U_subs_U ++ ++ have O2 : ε ≠ 0 := by ++ by_cases h : ε₀ = ⊤ ++ · unfold ε ++ simp [*] ++ · unfold ε ++ simp [*] ++ exact pos_iff_ne_zero.mp ε_pos ++ ++ let metric_ball_around_1 := Metric.eball (1 : ℂ) ε ++ let ε_div_two := ε / 2 ++ let boundary := ENNReal.toReal (1 + ε_div_two) ++ ++ let ⟨bound, ⟨bound_pos, bound_prop⟩⟩ := ++ BddAbove.exists_ge zeta_residue_on_U 0 ++ ++ have boundary_geq_one : 1 < boundary := by ++ unfold boundary ++ have Z : (1 : ENNReal).toReal = 1 := by rfl ++ rw [←Z] ++ have U : ε_div_two ≠ ⊤ := by ++ refine ENNReal.div_ne_top O1 ?_ ++ simp ++ simp ++ simp [ENNReal.toReal_add _ U] ++ refine ENNReal.toReal_pos ?_ ?_ ++ · unfold ε_div_two ++ simp [*] ++ · exact U ++ ++ let const : ℝ := bound ++ let final_const : ℝ := (boundary - 1)⁻¹ + const ++ have boundary_inv_pos : 0 < (boundary - 1)⁻¹ := by ++ ring_nf ++ apply inv_pos_of_pos ++ simp [*] ++ ++ have final_const_pos : final_const ≥ 0 := by ++ unfold final_const ++ simp [*] ++ have Z := ++ by ++ calc ++ 0 ≤ (boundary - 1)⁻¹ := by simp; linarith ++ _ ≤ (boundary - 1)⁻¹ + const := by unfold const; simp [bound_pos] ++ ++ exact Z ++ ++ have const_le_final_const : const ≤ final_const := by ++ calc ++ const ≤ (boundary - 1)⁻¹ + const := by simp; linarith ++ _ = final_const := by rfl ++ ++ have const_pos : const ≥ 0 := by ++ linarith ++ ++ use final_const ++ use final_const_pos ++ intro σ₀ t σ₀_gt ++ ++ by_cases h : σ₀ ≤ boundary ++ · have σ₀_in_ball : (↑σ₀ : ℂ) ∈ metric_ball_around_1 := by ++ unfold metric_ball_around_1 ++ unfold Metric.eball ++ simp [*] ++ have Z := edist_dist (↑σ₀) (↑1 : ℂ) ++ rw [Z] ++ have U := dist_eq_norm (↑σ₀) (↑1 : ℂ) ++ rw [U] ++ norm_cast ++ have U : 0 ≤ σ₀ - 1 := by linarith ++ have U1 : ‖σ₀ - 1‖ = σ₀ - 1 := by exact norm_of_nonneg U ++ have U2 : ε ≠ ⊤ := by exact O1 ++ have U3 : 0 ≤ ε := by exact zero_le ++ simp [Real.norm_of_nonneg U] ++ simp [ENNReal.ofReal_lt_iff_lt_toReal U U2] ++ have U4 : ENNReal.ofReal 1 ≠ ⊤ := by exact ENNReal.ofReal_ne_top ++ have Z0 : ε_div_two.toReal < ε.toReal := by ++ have T1 : ε ≠ ⊤ := by exact U2 ++ have T2 : ε ≠ 0 := by exact O2 ++ have T3 : ε_div_two < ε := by ++ refine ENNReal.half_lt_self ?_ U2 ++ exact T2 ++ ++ exact ENNReal.toReal_strict_mono T1 T3 ++ ++ have Z := by ++ calc ++ σ₀ - 1 ≤ boundary - 1 := by linarith ++ _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl ++ _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp ++ _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 ++ _ = ENNReal.toReal (ε_div_two) := by simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] ++ _ < ε.toReal := Z0 ++ ++ exact Z ++ ++ have σ₀_in_U : (↑σ₀ : ℂ) ∈ (U \ {1}) := by ++ refine mem_sdiff_singleton.mpr ?_ ++ constructor ++ · unfold metric_ball_around_1 at σ₀_in_ball ++ exact metric_ball_around_1_is_in_U σ₀_in_ball ++ · by_contra a ++ have U : σ₀ = 1 := by exact ofReal_eq_one.mp a ++ rw [U] at σ₀_gt ++ linarith ++ ++ have bdd := Set.forall_mem_image.mp bound_prop (σ₀_in_U) ++ simp [*] at bdd ++ have Z := ++ calc ++ ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ ‖ζ' σ₀ / ζ σ₀‖ := by ++ have U := strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized σ₀ σ₀ t (σ₀_gt) (by simp) ++ exact U ++ _ = ‖- ζ' σ₀ / ζ σ₀‖ := by simp only [Complex.norm_div, norm_neg] ++ _ = ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) + (σ₀ - 1)⁻¹‖ := by simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] ++ _ ≤ ‖(- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹)‖ + ‖(σ₀ - 1)⁻¹‖ := by ++ have Z := norm_add_le (- ζ' σ₀ / ζ σ₀ - (σ₀ - 1)⁻¹) ((σ₀ - 1)⁻¹) ++ norm_cast at Z ++ _ ≤ const + ‖(σ₀ - 1)⁻¹‖ := by ++ have U := add_le_add_left bdd ‖(σ₀ - 1)⁻¹‖ ++ ring_nf at U ++ ring_nf ++ norm_cast at U ++ norm_cast ++ _ ≤ const + (σ₀ - 1)⁻¹ := by ++ simp [norm_inv] ++ have pos : 0 ≤ σ₀ - 1 := by ++ linarith ++ simp [abs_of_nonneg pos] ++ _ = (σ₀ - 1)⁻¹ + const := by ++ rw [add_comm] ++ _ ≤ (σ₀ - 1)⁻¹ + final_const := by ++ simp [const_le_final_const] ++ ++ exact Z ++ ++ · push Not at h ++ ++ have boundary_geq_one : 1 < boundary := by ++ unfold boundary ++ have Z : (1 : ENNReal).toReal = 1 := by rfl ++ rw [←Z] ++ have U : ε_div_two ≠ ⊤ := by ++ refine ENNReal.div_ne_top O1 ?_ ++ simp ++ simp ++ simp [ENNReal.toReal_add _ U] ++ refine ENNReal.toReal_pos ?_ ?_ ++ · unfold ε_div_two ++ simp [*] ++ · exact U ++ ++ have boundary_in_ball : (↑boundary : ℂ) ∈ metric_ball_around_1 := by ++ unfold metric_ball_around_1 ++ unfold Metric.eball ++ simp [*] ++ have Z := edist_dist (↑boundary) (↑1 : ℂ) ++ rw [Z] ++ have U := dist_eq_norm (↑boundary) (↑1 : ℂ) ++ rw [U] ++ norm_cast ++ have U : 0 ≤ boundary - 1 := by linarith ++ have U1 : ‖boundary - 1‖ = boundary - 1 := by exact norm_of_nonneg U ++ have U2 : ε ≠ ⊤ := by exact O1 ++ have U3 : 0 ≤ ε := by exact zero_le ++ simp [Real.norm_of_nonneg U] ++ simp [ENNReal.ofReal_lt_iff_lt_toReal U U2] ++ have U4 : ENNReal.ofReal 1 ≠ ⊤ := by exact ENNReal.ofReal_ne_top ++ have Z0 : ε_div_two.toReal < ε.toReal := by ++ have T1 : ε ≠ ⊤ := by exact U2 ++ have T2 : ε ≠ 0 := by exact O2 ++ have T3 : ε_div_two < ε := by ++ refine ENNReal.half_lt_self ?_ U2 ++ exact T2 ++ ++ exact ENNReal.toReal_strict_mono T1 T3 ++ ++ have Z := by ++ calc ++ boundary - 1 ≤ boundary - 1 := by linarith ++ _ = ENNReal.toReal (1 + ε_div_two) - 1 := rfl ++ _ = ENNReal.toReal (1 + ε_div_two) - ENNReal.toReal (ENNReal.ofReal 1) := by simp ++ _ ≤ ENNReal.toReal (1 + ε_div_two - ENNReal.ofReal 1) := ENNReal.le_toReal_sub U4 ++ _ = ENNReal.toReal (ε_div_two) := by simp only [ENNReal.ofReal_one, ENNReal.addLECancellable_iff_ne, ne_eq, ENNReal.one_ne_top, not_false_eq_true, AddLECancellable.add_tsub_cancel_left] ++ _ < ε.toReal := Z0 ++ ++ exact Z ++ ++ have boundary_in_U : (↑boundary : ℂ) ∈ U \ {1} := by ++ refine mem_sdiff_singleton.mpr ?_ ++ constructor ++ · unfold metric_ball_around_1 at boundary_in_ball ++ exact metric_ball_around_1_is_in_U boundary_in_ball ++ · by_contra a ++ norm_cast at a ++ norm_cast at boundary_geq_one ++ simp [←a] at boundary_geq_one ++ ++ have bdd := Set.forall_mem_image.mp bound_prop (boundary_in_U) ++ ++ have Z := ++ calc ++ ‖- ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ ‖ζ' boundary / ζ boundary‖ := by ++ have U := strongPnt_dlog_riemannZeta_bdd_on_vertical_lines_generalized boundary σ₀ t (boundary_geq_one) (by linarith) ++ exact U ++ _ = ‖- ζ' boundary / ζ boundary‖ := by simp only [Complex.norm_div, norm_neg] ++ _ = ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) + (boundary - 1)⁻¹‖ := by simp only [Complex.norm_div, norm_neg, ofReal_inv, ofReal_sub, ofReal_one, sub_add_cancel] ++ _ ≤ ‖(- ζ' boundary / ζ boundary - (boundary - 1)⁻¹)‖ + ‖(boundary - 1)⁻¹‖ := by ++ have Z := norm_add_le (- ζ' boundary / ζ boundary - (boundary - 1)⁻¹) ((boundary - 1)⁻¹) ++ norm_cast at Z ++ _ ≤ const + ‖(boundary - 1)⁻¹‖ := by ++ have U9 := add_le_add_left bdd ‖(boundary - 1)⁻¹‖ ++ ring_nf at U9 ++ ring_nf ++ norm_cast at U9 ++ norm_cast ++ simp [*] at U9 ++ simp [*] ++ exact U9 ++ ++ _ ≤ const + (boundary - 1)⁻¹ := by ++ simp [norm_inv] ++ have pos : 0 ≤ boundary - 1 := by ++ linarith ++ simp [abs_of_nonneg pos] ++ _ = (boundary - 1)⁻¹ + const := by ++ rw [add_comm] ++ _ = final_const := by rfl ++ _ ≤ (σ₀ - 1)⁻¹ + final_const := by ++ have H : 0 ≤ (σ₀ - 1)⁻¹ := by ++ simp ++ linarith ++ ++ simp [H] ++ ++ exact Z ++ ++def LogDerivZetaHasBound (A C : ℝ) : Prop := ∀ (σ : ℝ) (t : ℝ) (_ : 3 < |t|) ++ (_ : σ ∈ Ici (1 - A / Real.log |t|)), ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ ++ C * Real.log |t| ^ 9 ++ ++def LogDerivZetaIsHoloSmall (σ₂ : ℝ) : Prop := ++ HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) ++ (((uIcc σ₂ 2) ×ℂ (uIcc (-3) 3)) \ {1}) ++ ++theorem dlog_riemannZeta_bdd_on_vertical_lines_explicit {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : ++ ∀(t : ℝ), ‖(-ζ' (σ₀ + t * I) / ζ (σ₀ + t * I))‖ ≤ ‖(ζ' σ₀ / ζ σ₀)‖ := by ++ ++ intro t ++ let s := σ₀ + t * I ++ have s_re_eq_sigma : s.re = σ₀ := by ++ rw [Complex.add_re (σ₀) (t * I)] ++ rw [Complex.ofReal_re σ₀] ++ rw [Complex.mul_I_re] ++ simp [*] ++ ++ have s₀_geq_one : 1 < (↑σ₀ : ℂ).re := by exact σ₀_gt ++ have s_re_geq_one : 1 < s.re := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm s_re_eq_sigma)) ++ have s_re_coerce_geq_one : 1 < (↑s.re : ℂ).re := by exact s_re_geq_one ++ rw [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s_re_geq_one)] ++ unfold LSeries ++ ++ have summable_von_mangoldt : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) s.re i) := by ++ exact ArithmeticFunction.LSeriesSummable_vonMangoldt s_re_geq_one ++ ++ have summable_von_mangoldt_at_σ₀ : Summable (fun i ↦ LSeries.term (fun n ↦ ↑(Λ n)) σ₀ i) := by ++ exact ArithmeticFunction.LSeriesSummable_vonMangoldt s₀_geq_one ++ ++ have summable_re_von_mangoldt : Summable (fun i ↦ (LSeries.term (fun n ↦ ↑(Λ n)) s.re i).re) := by ++ exact strongPnt_summable_complex_then_summable_real_part (LSeries.term (fun n ↦ ↑(Λ n)) s.re) summable_von_mangoldt ++ ++ have positivity : ∀(n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ = (LSeries.term (fun n ↦ Λ n) s.re n).re := by ++ intro n ++ calc ++ ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ = Λ n / ‖(↑n : ℂ)^(s : ℂ)‖ := by ++ unfold LSeries.term ++ by_cases h : n = 0 ++ · simp [*] ++ · push Not at h ++ simp [*] ++ ++ _ = Λ n / (↑n)^s.re := by ++ by_cases h : n = 0 ++ · simp [*] ++ · rw [Complex.norm_natCast_cpow_of_pos] ++ push Not at h ++ exact Nat.zero_lt_of_ne_zero h ++ ++ _ = (LSeries.term (fun n ↦ Λ n) s.re n).re := by ++ unfold LSeries.term ++ by_cases h : n = 0 ++ · simp [*] ++ · simp [*] ++ push Not at h ++ ring_nf ++ rw [Complex.re_ofReal_mul (Λ n)] ++ ring_nf ++ rw [Complex.inv_re] ++ rw [Complex.cpow_ofReal_re] ++ simp [*] ++ left ++ have N : (0 : ℝ) ≤ ↑n := by exact Nat.cast_nonneg' n ++ have T2 : ((↑n : ℂ) ^ (↑σ₀ : ℂ)).re = (↑n : ℝ)^σ₀ := by exact rfl ++ have T1 : ((↑n : ℂ ) ^ (↑σ₀ : ℂ)).im = 0 := by ++ refine abs_re_eq_norm.mp ?_ ++ rw [T2] ++ simp [*] ++ exact Real.rpow_nonneg N σ₀ ++ ++ simp [Complex.normSq_apply] ++ simp [T1, T2] ++ ++ have summable_abs_value : Summable (fun i ↦ ‖LSeries.term (fun n ↦ ↑(Λ n)) s i‖) := by ++ rw [summable_congr positivity] ++ exact summable_re_von_mangoldt ++ ++ have triangle_ineq : ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), ↑‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ := ++ norm_tsum_le_tsum_norm summable_abs_value ++ ++ have bounded_by_sum_of_re : ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n).re := ++ by ++ simp [positivity] at triangle_ineq ++ exact triangle_ineq ++ ++ have sum_of_re_commutes : ∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n).re = (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)).re := ++ (Complex.re_tsum (summable_von_mangoldt)).symm ++ ++ have re_of_sum_bdd_by_norm : (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)).re ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)‖ := ++ Complex.re_le_norm (∑' (n : ℕ), (LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n)) ++ ++ have Z := ++ by ++ calc ++ ‖LSeries (fun n ↦ ↑(Λ n)) s‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun n ↦ ↑(Λ n)) s n‖ ++ := norm_tsum_le_tsum_norm summable_abs_value ++ _ ≤ ∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n).re := by simp [←positivity] ++ _ = (∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n)).re := (Complex.re_tsum (summable_von_mangoldt)).symm ++ _ ≤ ‖∑' (n : ℕ), (LSeries.term (fun n ↦ Λ n) s.re n)‖ := re_le_norm (∑' (n : ℕ), LSeries.term (fun n ↦ ↑(Λ n)) (↑s.re) n) ++ _ = ‖- ζ' (↑s.re) / ζ (↑s.re)‖ := by ++ simp only [← (ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div s_re_coerce_geq_one)] ++ unfold LSeries ++ rfl ++ _ = ‖ζ' σ₀ / ζ σ₀‖ := by ++ rw [← s_re_eq_sigma] ++ simp [*] ++ ++ exact Z ++ ++theorem dlog_riemannZeta_bdd_on_vertical_lines {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : ++ ∃ c > 0, ∀(t : ℝ), ‖ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ c := by ++ ++ let s_re : ℂ := σ₀ ++ ++ let new_const : ℝ := 1 + (↑(Norm.norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) (↑ s_re : ℂ ) n‖)) : ℝ ) ++ have new_const_is_pos : new_const > 0 := by positivity ++ ++ use new_const ++ use new_const_is_pos ++ intro t ++ ++ let s := σ₀ + t * I ++ ++ have DD : (↑ s.re : ℂ) = s_re := by ++ refine ofReal_inj.mpr ?_ ++ rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] ++ simp ++ ++ have L : s_re = σ₀ := by rfl ++ ++ have H : s.re = σ₀ := by ++ rw [add_re, ofReal_re, mul_re, ofReal_re, I_re, I_im] ++ simp ++ ++ have non_neg : σ₀ ≠ 0 := by ++ by_contra h ++ rw [h] at σ₀_gt ++ norm_cast at σ₀_gt ++ ++ have pos : s.re > 1 := by exact lt_of_lt_of_eq σ₀_gt (id (Eq.symm H)) ++ have pos_triv : s_re.re > 1 := by exact σ₀_gt ++ ++ rw [← norm_neg, ← neg_div, ← ArithmeticFunction.LSeries_vonMangoldt_eq_deriv_riemannZeta_div pos] ++ ++ have identity0 : ∀(n : ℕ), ‖LSeries.term 1 s n‖ = 1 / n^σ₀ := by ++ unfold LSeries.term ++ intro n ++ by_cases h0 : n = 0 ++ · simp [*] ++ · simp [*] ++ push Not at h0 ++ have C : n > 0 := by exact Nat.zero_lt_of_ne_zero h0 ++ have T := Complex.norm_natCast_cpow_of_pos C s ++ rw [H] at T ++ exact T ++ ++ have O : ∀(s : ℂ), ∀(n : ℕ), s.re = σ₀ → (↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ) : ℂ) = LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n := by ++ intro s n cond ++ ++ by_cases h1 : (n = 0) ++ · simp [h1] ++ · push Not at h1 ++ unfold LSeries.term ++ simp [*] ++ have U : |Λ n| = Λ n := abs_of_nonneg (ArithmeticFunction.vonMangoldt_nonneg) ++ have R : n > 0 := by exact Nat.zero_lt_of_ne_zero h1 ++ rw [U] ++ have Z := Complex.norm_natCast_cpow_of_pos R s ++ rw [Z] ++ rw [← L] ++ ++ by_cases h : (Λ n = 0) ++ · simp [h] ++ · norm_cast ++ apply_fun (fun (w : ℂ) ↦ w * (↑ n : ℂ)^s_re / (Λ n)) ++ · simp [*] ++ ring_nf ++ rw [mul_comm] ++ nth_rewrite 1 [mul_assoc] ++ simp [*] ++ have := cast_pow_eq n σ₀ ++ rw [this] ++ simp [*] ++ ++ · have G : (↑ n : ℂ)^s_re / (Λ n) ≠ 0 := by ++ have T : (↑ n : ℂ)^s_re ≠ 0 := by ++ have T : n > 0 := by exact R ++ have M : ∃(m : ℕ), n = m + 1 := by exact Nat.exists_eq_succ_of_ne_zero h1 ++ let ⟨m, pf⟩ := M ++ have U := Complex.natCast_add_one_cpow_ne_zero m s_re ++ rw [pf] ++ push_cast ++ exact U ++ refine div_ne_zero T ?_ ++ push Not at h ++ norm_cast ++ have U := by exact mul_left_injective₀ G ++ have T : (fun (x : ℂ) ↦ x * (↑ n : ℂ)^s_re / (Λ n)) = (fun (x : ℂ) ↦ x * ((↑ n : ℂ)^s_re / (Λ n))) := by funext x; exact mul_div_assoc x (↑n ^ s_re) ↑(Λ n) ++ simp [←T] at U ++ exact U ++ ++ have K : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ)) = (fun (n : ℕ) ↦ (LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n )) := by ++ funext n ++ rw [O s n H] ++ ++ have K1 : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) (↑ s.re : ℂ) n‖ : ℝ)) = (fun (n : ℕ) ↦ (LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ ) n )) := by ++ funext n ++ rw [O (↑ s.re : ℂ) n H] ++ simp [*] ++ ++ have D2 : (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) s n‖ : ℝ)) = (fun (n : ℕ) ↦ ↑(‖LSeries.term (fun x ↦ (Λ x)) (↑ s.re : ℂ) n‖ : ℝ)) := by ++ simp [← K] ++ ++ have S : Summable (fun n ↦ (↑(‖LSeries.term (fun x ↦ Λ x) s n‖ : ℝ) : ℝ )) := by ++ apply (summable_real_iff_summable_coe_complex (fun n ↦ (↑(‖LSeries.term (fun x ↦ Λ x) s n‖ : ℝ) : ℝ ))).mpr ++ rw [K] ++ have T := ArithmeticFunction.LSeriesSummable_vonMangoldt (pos_triv) ++ have U : s_re = s.re := by exact congrFun (congrArg Complex.mk (id (Eq.symm H))) 0 ++ simp [← U] ++ exact T ++ ++ have C := calc ++ ‖∑' (n : ℕ), (LSeries.term (fun x ↦ Λ x) s n)‖ ≤ ∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) s n‖ := norm_tsum_le_tsum_norm S ++ ++ _ ≤ norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) s n‖) := by exact le_norm_self (∑' (n : ℕ), ‖LSeries.term (fun x ↦ ↑(Λ x)) s n‖) ++ _ = norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) (↑ s.re : ℂ) n‖) := by simp [D2] ++ _ ≤ 1 + norm (∑' (n : ℕ), ‖LSeries.term (fun x ↦ Λ x) ( ↑ s.re : ℂ) n‖ ) := by linarith ++ _ = new_const := by rw [DD] ++ ++ exact C ++ ++theorem dlog_riemannZeta_bdd_on_vertical_lines' {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) : ++ ∃ C > 0, ∀ (t : ℝ), ‖ζ' (σ₀ + t * I) / ζ (σ₀ + t * I)‖ ≤ C := ++ dlog_riemannZeta_bdd_on_vertical_lines σ₀_gt ++ ++theorem SmoothedChebyshevPull1_aux_integrable {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos : 0 < ε) ++ (ε_lt_one : ε < 1) ++ {X : ℝ} (X_gt : 3 < X) ++ {σ₀ : ℝ} (σ₀_gt : 1 < σ₀) (σ₀_le_2 : σ₀ ≤ 2) ++ (suppSmoothingF : support SmoothingF ⊆ Icc (1 / 2) 2) ++ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) ++ (mass_one : ∫ (x : ℝ) in Ioi 0, SmoothingF x / x = 1) ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ : ++ Integrable (fun (t : ℝ) ↦ ++ SmoothedChebyshevIntegrand SmoothingF ε X (σ₀ + (t : ℂ) * I)) volume := by ++ obtain ⟨C, C_pos, hC⟩ := dlog_riemannZeta_bdd_on_vertical_lines' σ₀_gt ++ let c : ℝ := C * X ^ σ₀ ++ have : ∀ t, ‖(fun (t : ℝ) ↦ (- deriv riemannZeta (σ₀ + (t : ℂ) * I)) / ++ riemannZeta (σ₀ + (t : ℂ) * I) * ++ (X : ℂ) ^ (σ₀ + (t : ℂ) * I)) t‖ ≤ c := by ++ intro t ++ simp only [Complex.norm_mul, c] ++ gcongr ++ · simpa only [neg_div, norm_neg] using hC t ++ ++ · rw [Complex.norm_cpow_eq_rpow_re_of_nonneg] ++ · simp ++ · linarith ++ · simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, ++ add_zero, ne_eq] ++ linarith ++ convert! (SmoothedChebyshevDirichlet_aux_integrable ContDiffSmoothingF SmoothingFnonneg ++ suppSmoothingF mass_one ε_pos ε_lt_one σ₀_gt σ₀_le_2).bdd_mul (c := c) ?_ (Filter.Eventually.of_forall this) using 2 ++ · unfold SmoothedChebyshevIntegrand ++ ring ++ · apply Continuous.aestronglyMeasurable ++ apply continuousOn_univ.mp ++ intro t _ ++ let s := σ₀ + (t : ℂ) * I ++ have s_ne_one : s ≠ 1 := by ++ intro h ++ ++ have : σ₀ = 1 := by ++ have := congr_arg Complex.re h ++ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, ++ sub_self, add_zero, one_re, s] at this ++ exact this ++ ++ linarith [σ₀_gt] ++ apply ContinuousAt.continuousWithinAt ++ apply ContinuousAt.mul ++ · have diffζ := differentiableAt_riemannZeta s_ne_one ++ apply ContinuousAt.div ++ · apply ContinuousAt.neg ++ have : DifferentiableAt ℂ (fun s ↦ deriv riemannZeta s) s := ++ differentiableAt_deriv_riemannZeta s_ne_one ++ convert realDiff_of_complexDiff (s := σ₀ + (t : ℂ) * I) this <;> simp ++ · convert realDiff_of_complexDiff (s := σ₀ + (t : ℂ) * I) diffζ <;> simp ++ · apply riemannZeta_ne_zero_of_one_lt_re ++ simp [σ₀_gt] ++ · apply ContinuousAt.comp _ (by fun_prop) ++ apply continuousAt_const_cpow ++ norm_cast ++ linarith ++ ++lemma BddAboveOnRect {g : ℂ → ℂ} {z w : ℂ} (holoOn : HolomorphicOn g (z.Rectangle w)) : ++ BddAbove (norm ∘ g '' (z.Rectangle w)) := by ++ have compact_rect : IsCompact (z.Rectangle w) := by ++ apply IsCompact.reProdIm <;> apply isCompact_uIcc ++ refine IsCompact.bddAbove_image compact_rect ?_ ++ apply holoOn.continuousOn.norm ++ ++theorem SmoothedChebyshevPull1 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos: 0 < ε) ++ (ε_lt_one : ε < 1) ++ (X : ℝ) (X_gt : 3 < X) ++ {T : ℝ} (T_pos : 0 < T) {σ₁ : ℝ} ++ (σ₁_pos : 0 < σ₁) (σ₁_lt_one : σ₁ < 1) ++ (holoOn : HolomorphicOn (ζ' / ζ) ((Icc σ₁ 2)×ℂ (Icc (-T) T) \ {1})) ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) ++ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) : ++ SmoothedChebyshev SmoothingF ε X = ++ I₁ SmoothingF ε X T - ++ I₂ SmoothingF ε T X σ₁ + ++ I₃₇ SmoothingF ε T X σ₁ + ++ I₈ SmoothingF ε T X σ₁ + ++ I₉ SmoothingF ε X T ++ + 𝓜 ((Smooth1 SmoothingF ε) ·) 1 * X := by ++ unfold SmoothedChebyshev ++ unfold VerticalIntegral' ++ have X_eq_gt_one : 1 < 1 + (Real.log X)⁻¹ := by ++ nth_rewrite 1 [← add_zero 1] ++ refine add_lt_add_of_le_of_lt ?_ ?_ ++ rfl ++ rw[inv_pos, ← Real.log_one] ++ apply Real.log_lt_log ++ norm_num ++ linarith ++ have X_eq_lt_two : (1 + (Real.log X)⁻¹) < 2 := by ++ rw[← one_add_one_eq_two] ++ refine (add_lt_add_iff_left 1).mpr ?_ ++ refine inv_lt_one_of_one_lt₀ ?_ ++ refine (lt_log_iff_exp_lt ?_).mpr ?_ ++ positivity ++ have : rexp 1 < 3 := by exact lt_trans (Real.exp_one_lt_d9) (by norm_num) ++ linarith ++ have X_eq_le_two : 1 + (Real.log X)⁻¹ ≤ 2 := X_eq_lt_two.le ++ rw [verticalIntegral_split_three (a := -T) (b := T)] ++ swap ++ · ++ exact SmoothedChebyshevPull1_aux_integrable ε_pos ε_lt_one X_gt X_eq_gt_one ++ X_eq_le_two suppSmoothingF SmoothingFnonneg mass_one ContDiffSmoothingF ++ · ++ have temp : ↑(1 + (Real.log X)⁻¹) = (1 : ℂ) + ↑(Real.log X)⁻¹ := by push_cast; rfl ++ repeat rw[smul_eq_mul] ++ unfold I₁ ++ rw[temp, mul_add, mul_add, add_assoc, sub_eq_add_neg] ++ nth_rewrite 4 [add_assoc] ++ nth_rewrite 3 [add_assoc] ++ nth_rewrite 2 [add_assoc] ++ rw[add_assoc, add_left_cancel_iff, add_assoc] ++ nth_rewrite 7 [add_comm] ++ rw[← add_assoc] ++ unfold I₉ ++ rw[add_right_cancel_iff, ← add_right_inj (1 / (2 * ↑π * I) * ++ -VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) (1 + (Real.log X)⁻¹) (-T) T), ++ ← mul_add, ← sub_eq_neg_add, sub_self, mul_zero] ++ unfold VIntegral I₂ I₃₇ I₈ ++ rw[smul_eq_mul, temp, ← add_assoc, ← add_assoc] ++ nth_rewrite 2 [div_mul_comm] ++ rw[mul_one, ← neg_div, ← mul_neg] ++ nth_rewrite 2 [← one_div_mul_eq_div] ++ repeat rw[← mul_add] ++ let fTempRR : ℝ → ℝ → ℂ := fun x ↦ fun y ↦ ++ SmoothedChebyshevIntegrand SmoothingF ε X ((x : ℝ) + (y : ℝ) * I) ++ let fTempC : ℂ → ℂ := fun z ↦ fTempRR z.re z.im ++ have : ∫ (y : ℝ) in -T..T, ++ SmoothedChebyshevIntegrand SmoothingF ε X (1 + ↑(Real.log X)⁻¹ + ↑y * I) = ++ ∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y := by ++ unfold fTempRR ++ rw[temp] ++ rw[this] ++ have : ∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, ++ SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I) = ++ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T) := by ++ unfold fTempRR ++ rw[Complex.ofReal_neg, neg_mul] ++ rfl ++ rw[this] ++ have : ∫ (t : ℝ) in -T..T, SmoothedChebyshevIntegrand SmoothingF ε X (↑σ₁ + ↑t * I) = ++ ∫ (y : ℝ) in -T..T, fTempRR σ₁ y := by rfl ++ rw[this] ++ have : ∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, ++ SmoothedChebyshevIntegrand SmoothingF ε X (↑σ + ↑T * I) = ++ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T := by rfl ++ rw[this] ++ repeat rw[← add_assoc] ++ have : (((I * -∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y) + ++ -∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T)) + ++ I * ∫ (y : ℝ) in -T..T, fTempRR σ₁ y) + ++ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T = ++ -1 * RectangleIntegral fTempC ((1 : ℝ) + (Real.log X)⁻¹ + T * I) (σ₁ - T * I) := by ++ unfold RectangleIntegral ++ rw[HIntegral_symm, VIntegral_symm] ++ nth_rewrite 2 [HIntegral_symm, VIntegral_symm] ++ unfold HIntegral VIntegral ++ repeat rw[smul_eq_mul] ++ repeat rw[add_re] ++ repeat rw[add_im] ++ repeat rw[sub_re] ++ repeat rw[sub_im] ++ repeat rw[mul_re] ++ repeat rw[mul_im] ++ repeat rw[ofReal_re] ++ repeat rw[ofReal_im] ++ rw[I_re, I_im, mul_zero, zero_mul, mul_one] ++ ring_nf ++ unfold fTempC ++ have : ∫ (y : ℝ) in -T..T, fTempRR (I * ↑y + ↑σ₁).re (I * ↑y + ↑σ₁).im = ++ ∫ (y : ℝ) in -T..T, fTempRR σ₁ y := by simp ++ rw[this] ++ have : ∫ (y : ℝ) in -T..T, ++ fTempRR (I * ↑y + ↑(1 + (Real.log X)⁻¹)).re (I * ↑y + ↑(1 + (Real.log X)⁻¹)).im = ++ ∫ (y : ℝ) in -T..T, fTempRR (1 + (Real.log X)⁻¹) y := by simp ++ rw[this] ++ have : ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR (I * ↑T + ↑x).re (I * ↑T + ↑x).im = ++ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x T := by simp ++ rw[this] ++ have : ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR (I * ↑(-T) + ↑x).re (I * ↑(-T) + ↑x).im = ++ ∫ (x : ℝ) in σ₁..1 + (Real.log X)⁻¹, fTempRR x (-T) := by simp ++ rw[this] ++ ring_nf ++ rw[this, neg_one_mul, div_mul_comm, mul_one, ++ ← add_right_inj ++ (RectangleIntegral fTempC (1 + ↑(Real.log X)⁻¹ + ↑T * I) (↑σ₁ - ↑T * I) / (2 * ↑π * I)), ++ ← add_assoc] ++ simp only [ofReal_one, ofReal_inv, add_zero] ++ rw[rectangleIntegral_symm] ++ have : RectangleIntegral fTempC (↑σ₁ - ↑T * I) (1 + 1 / ↑(Real.log X) + ↑T * I) / (2 * ↑π * I) = ++ RectangleIntegral' fTempC (σ₁ - T * I) (1 + ↑(Real.log X)⁻¹ + T * I) := by ++ unfold RectangleIntegral' ++ rw [smul_eq_mul] ++ simp only [one_div, ofReal_inv] ++ ring ++ ++ simp only [one_div, ofReal_inv] at this ++ rw [this] ++ ++ let holoMatch : ℂ → ℂ := fun z ↦ ++ (fTempC z - (𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) 1 * ↑X) / (z - 1)) ++ have inv_log_X_pos: 0 < (Real.log X)⁻¹ := by ++ rw[inv_pos, ← Real.log_one] ++ apply Real.log_lt_log (by positivity) (by linarith) ++ have pInRectangleInterior : ++ (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) ∈ nhds 1) := by ++ refine rectangle_mem_nhds_iff.mpr ?_ ++ refine mem_reProdIm.mpr ?_ ++ have : re 1 = 1 := by rfl ++ rw[this] ++ have : im 1 = 0 := by rfl ++ rw[this] ++ repeat rw[sub_re] ++ repeat rw[sub_im] ++ repeat rw[add_re] ++ repeat rw[add_im] ++ rw[mul_re, mul_im, I_re, I_im] ++ repeat rw[ofReal_re] ++ repeat rw[ofReal_im] ++ ring_nf ++ have temp : 1 ∈ uIoo σ₁ (re 1 + (Real.log X)⁻¹) := by ++ have : re 1 = 1 := by rfl ++ rw[this] ++ unfold uIoo ++ have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) ++ rw[this] ++ have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by exact max_eq_right (by linarith) ++ rw[this] ++ refine mem_Ioo.mpr ?_ ++ exact ⟨σ₁_lt_one, (by linarith)⟩ ++ have : 0 ∈ uIoo (-T) (T + im 1) := by ++ have : im 1 = 0 := by rfl ++ rw[this, add_zero] ++ unfold uIoo ++ have : min (-T) T = -T := by exact min_eq_left (by linarith) ++ rw[this] ++ have : max (-T) T = T := by exact max_eq_right (by linarith) ++ rw[this] ++ refine mem_Ioo.mpr ?_ ++ exact ⟨(by linarith), (by linarith)⟩ ++ exact ⟨temp, this⟩ ++ ++ have holoMatchHoloOn : HolomorphicOn holoMatch ++ (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) \ {1}) := by ++ unfold HolomorphicOn holoMatch ++ refine DifferentiableOn.sub ?_ ?_ ++ · unfold fTempC fTempRR ++ have : (fun z ↦ SmoothedChebyshevIntegrand SmoothingF ε X (↑z.re + ↑z.im * I)) = ++ (fun z ↦ SmoothedChebyshevIntegrand SmoothingF ε X z) := by ++ apply funext ++ intro z ++ have : (↑z.re + ↑z.im * I) = z := by exact re_add_im z ++ rw[this] ++ rw[this] ++ refine DifferentiableOn.mul ?_ ?_ ++ · refine DifferentiableOn.mul ?_ ?_ ++ · have : (fun s ↦ -ζ' s / ζ s) = (fun s ↦ -(ζ' s / ζ s)) := by ++ refine funext ?_ ++ intro x ++ exact neg_div (ζ x) (ζ' x) ++ rw[this] ++ refine DifferentiableOn.neg ?_ ++ unfold DifferentiableOn ++ intro x x_location ++ unfold Rectangle at x_location ++ rw[Set.mem_sdiff, Complex.mem_reProdIm, sub_re, add_re, sub_im, add_im, mul_re, mul_im, ++ I_re, I_im, add_re, add_im] at x_location ++ simp only [ofReal_re, mul_zero, ofReal_im, mul_one, sub_self, sub_zero, one_re, ++ ofReal_inv, inv_re, normSq_ofReal, div_self_mul_self', add_zero, zero_sub, one_im, ++ inv_im, neg_zero, zero_div, zero_add, mem_singleton_iff] at x_location ++ ++ obtain ⟨⟨xReIn, xImIn⟩, xOut⟩ := x_location ++ unfold uIcc at xReIn xImIn ++ have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) ++ rw[this] at xReIn ++ have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by exact max_eq_right (by linarith) ++ rw[this] at xReIn ++ have : min (-T) T = (-T) := by exact min_eq_left (by linarith) ++ rw[this] at xImIn ++ have : max (-T) T = T := by exact max_eq_right (by linarith) ++ rw[this] at xImIn ++ unfold HolomorphicOn DifferentiableOn at holoOn ++ have temp : DifferentiableWithinAt ℂ (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) x := by ++ have : x ∈ Icc σ₁ 2 ×ℂ Icc (-T) T \ {1} := by ++ rw [Set.mem_sdiff, Complex.mem_reProdIm] ++ have xReTemp : x.re ∈ Icc σ₁ 2 := by ++ have xReLb : σ₁ ≤ x.re := by exact xReIn.1 ++ have xReUb : x.re ≤ 2 := by exact (lt_of_le_of_lt xReIn.2 X_eq_lt_two).le ++ exact ⟨xReLb, xReUb⟩ ++ have xImTemp : x.im ∈ Icc (-T) T := by exact ⟨xImIn.1, xImIn.2⟩ ++ exact ⟨⟨xReTemp, xImTemp⟩, xOut⟩ ++ exact holoOn x this ++ ++ have : ((↑σ₁ - ↑T * I).Rectangle (1 + ↑(Real.log X)⁻¹ + ↑T * I) \ {1}) ⊆ ++ (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) := by ++ intro a a_location ++ rw[Set.mem_sdiff, Complex.mem_reProdIm] ++ rw[Set.mem_sdiff] at a_location ++ obtain ⟨aIn, aOut⟩ := a_location ++ unfold Rectangle uIcc at aIn ++ rw[sub_re, add_re, add_re, sub_im, add_im, add_im, mul_re, mul_im, ofReal_re, ofReal_re, ofReal_re, ofReal_im, ofReal_im, ofReal_im, I_re, I_im] at aIn ++ have : re 1 = 1 := by rfl ++ rw[this] at aIn ++ have : im 1 = 0 := by rfl ++ rw[this] at aIn ++ ring_nf at aIn ++ have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by linarith ++ rw[this] at aIn ++ have : max σ₁ (1 + (Real.log X)⁻¹) = 1 + (Real.log X)⁻¹ := by linarith ++ rw[this] at aIn ++ have : min (-T) T = (-T) := by linarith ++ rw[this] at aIn ++ have : max (-T) T = T := by linarith ++ rw[this] at aIn ++ rw[Complex.mem_reProdIm] at aIn ++ obtain ⟨aReIn, aImIn⟩ := aIn ++ have aReInRedo : a.re ∈ Icc σ₁ 2 := by ++ have : a.re ≤ 2 := by exact (lt_of_le_of_lt aReIn.2 X_eq_lt_two).le ++ exact ⟨aReIn.1, this⟩ ++ exact ⟨⟨aReInRedo, aImIn⟩, aOut⟩ ++ exact DifferentiableWithinAt.mono temp this ++ · unfold DifferentiableOn ++ intro x x_location ++ refine DifferentiableAt.differentiableWithinAt ?_ ++ have hε : ε ∈ Ioo 0 1 := by exact ⟨ε_pos, ε_lt_one⟩ ++ have xRePos : 0 < x.re := by ++ unfold Rectangle at x_location ++ rw[Set.mem_sdiff, Complex.mem_reProdIm] at x_location ++ obtain ⟨⟨xReIn, _⟩, _⟩ := x_location ++ unfold uIcc at xReIn ++ rw[sub_re, add_re, add_re, mul_re, I_re, I_im] at xReIn ++ repeat rw[ofReal_re] at xReIn ++ repeat rw[ofReal_im] at xReIn ++ ring_nf at xReIn ++ have : re 1 = 1 := by rfl ++ rw[this] at xReIn ++ have : min σ₁ (1 + (Real.log X)⁻¹) = σ₁ := by exact min_eq_left (by linarith) ++ rw[this] at xReIn ++ have : σ₁ ≤ x.re := by exact xReIn.1 ++ linarith ++ exact Smooth1MellinDifferentiable ContDiffSmoothingF suppSmoothingF hε SmoothingFnonneg mass_one xRePos ++ · unfold DifferentiableOn ++ intro x x_location ++ apply DifferentiableAt.differentiableWithinAt ++ unfold HPow.hPow instHPow ++ simp only ++ apply DifferentiableAt.const_cpow ++ · exact differentiableAt_fun_id ++ · left ++ refine ne_zero_of_re_pos ?_ ++ simp only [ofReal_re] ++ linarith ++ · refine DifferentiableOn.mul ?_ ?_ ++ · ++ unfold DifferentiableOn ++ intro x x_location ++ rw[Set.mem_sdiff] at x_location ++ obtain ⟨xInRect, xOut⟩ := x_location ++ apply DifferentiableAt.differentiableWithinAt ++ apply differentiableAt_const ++ · unfold DifferentiableOn ++ intro x x_location ++ apply DifferentiableAt.differentiableWithinAt ++ apply DifferentiableAt.inv ++ · fun_prop ++ · intro h ++ rw [sub_eq_zero] at h ++ have := x_location.2 ++ simp only [mem_singleton_iff] at this ++ exact this h ++ ++ have holoMatchBddAbove : BddAbove ++ (norm ∘ holoMatch '' (Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) \ {1})) := by ++ let U : Set ℂ := Rectangle (σ₁ - ↑T * I) (1 + (Real.log X)⁻¹ + T * I) ++ let f : ℂ → ℂ := fun z ↦ -ζ' z / ζ z ++ let g : ℂ → ℂ := fun z ↦ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) z * ↑X ^ z ++ have bigO_holoMatch : holoMatch =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by ++ unfold holoMatch fTempC fTempRR SmoothedChebyshevIntegrand ++ simp only [re_add_im] ++ have : (fun z ↦ ++ (-ζ' z / ζ z * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) z * ↑X ^ z - ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) 1 * ↑X / (z - 1))) = ++ (fun z ↦ (f z * g z - 1 * g 1 / (z - 1))) := by ++ apply funext ++ intro x ++ simp[f, g] ++ rw[mul_assoc] ++ rw[this] ++ have g_holc : HolomorphicOn g U := by ++ unfold HolomorphicOn DifferentiableOn ++ intro u uInU ++ refine DifferentiableAt.differentiableWithinAt ?_ ++ simp[g] ++ refine DifferentiableAt.mul ?_ ?_ ++ have hε : ε ∈ Set.Ioo 0 1 := by exact ⟨ε_pos, ε_lt_one⟩ ++ have hu : 0 < u.re := by ++ simp[U] at uInU ++ unfold Rectangle uIcc at uInU ++ rw[Complex.mem_reProdIm] at uInU ++ obtain ⟨uReIn, uImIn⟩ := uInU ++ have : min (↑σ₁ - ↑T * I).re (1 + (↑(Real.log X))⁻¹ + ↑T * I).re = σ₁ := by ++ rw[sub_re, add_re, add_re, mul_re, I_re, I_im] ++ repeat rw[ofReal_re] ++ repeat rw[ofReal_im] ++ simp ++ linarith ++ rw[this] at uReIn ++ have : σ₁ ≤ u.re := by exact uReIn.1 ++ linarith ++ exact Smooth1MellinDifferentiable ContDiffSmoothingF suppSmoothingF hε SmoothingFnonneg mass_one hu ++ unfold HPow.hPow instHPow ++ simp ++ apply DifferentiableAt.const_cpow ++ exact differentiableAt_fun_id ++ refine Or.inl ?_ ++ refine ne_zero_of_re_pos ?_ ++ rw[ofReal_re] ++ positivity ++ have U_in_nhds : U ∈ nhds 1 := by ++ simp only [U] ++ exact pInRectangleInterior ++ have f_near_p : (f - fun (z : ℂ) => 1 * (z - 1)⁻¹) =O[nhdsWithin 1 {1}ᶜ] (1 : ℂ → ℂ) := by ++ simp[f] ++ have : ((fun z ↦ -ζ' z / ζ z) - fun z ↦ (z - 1)⁻¹) = ++ (-ζ' / ζ - fun z ↦ (z - 1)⁻¹) := by ++ apply funext ++ intro z ++ simp ++ rw[this] ++ exact riemannZetaLogDerivResidueBigO ++ exact ResidueMult g_holc U_in_nhds f_near_p ++ have : ∃ V ∈ nhds 1, BddAbove (norm ∘ holoMatch '' (V \ {1})) := by exact IsBigO_to_BddAbove bigO_holoMatch ++ obtain ⟨V, VInNhds_one, BddAboveV⟩ := this ++ have : ∃ W ⊆ V, 1 ∈ W ∧ IsOpen W ∧ BddAbove (norm ∘ holoMatch '' (W \ {1})) := by ++ rw[mem_nhds_iff] at VInNhds_one ++ obtain ⟨W, WSubset, WOpen, one_in_W⟩ := VInNhds_one ++ use W ++ have : BddAbove (Norm.norm ∘ holoMatch '' (W \ {1})) := by ++ have : Norm.norm ∘ holoMatch '' (W \ {1}) ⊆ ++ Norm.norm ∘ holoMatch '' (V \ {1}) := by ++ exact image_mono (by exact sdiff_subset_sdiff_left WSubset) ++ exact BddAbove.mono this BddAboveV ++ exact ⟨WSubset, ⟨one_in_W, WOpen, this⟩⟩ ++ obtain ⟨W, WSubset, one_in_W, OpenW, BddAboveW⟩ := this ++ have : (↑σ₁ - ↑T * I).Rectangle (1 + ↑(Real.log X)⁻¹ + ↑T * I) = U := by rfl ++ rw[this] at holoMatchHoloOn ⊢ ++ have one_in_U : 1 ∈ U := by ++ have U_in_nhds : U ∈ nhds 1 := by ++ simp only [U] ++ exact pInRectangleInterior ++ exact mem_of_mem_nhds U_in_nhds ++ have (h1 : 1 ∈ U) (h2 : 1 ∈ W) : U \ {1} = (U \ W) ∪ ((U ∩ W) \ {1}) := by ++ ext x ++ simp only [Set.mem_sdiff, Set.mem_singleton_iff, Set.mem_union, Set.mem_inter_iff] ++ constructor ++ intro ⟨hxU, hx1⟩ ++ by_cases hw : x ∈ W ++ · right ++ exact ⟨⟨hxU, hw⟩, hx1⟩ ++ · left ++ exact ⟨hxU, hw⟩ ++ · intro h ++ cases' h with h_left h_right ++ have : x ≠ 1 := by ++ intro x_eq_1 ++ rw[x_eq_1] at h_left ++ exact h_left.2 h2 ++ · exact ⟨h_left.1, this⟩ ++ · exact ⟨h_right.1.1, h_right.2⟩ ++ rw[this one_in_U one_in_W] ++ have : Norm.norm ∘ holoMatch '' (U \ W ∪ (U ∩ W) \ {1}) = ++ Norm.norm ∘ holoMatch '' (U \ W) ∪ Norm.norm ∘ holoMatch '' ((U ∩ W) \ {1}) := by ++ exact image_union (Norm.norm ∘ holoMatch) (U \ W) ((U ∩ W) \ {1}) ++ rw[this] ++ refine BddAbove.union ?_ ?_ ++ refine IsCompact.bddAbove_image ?_ ?_ ++ refine IsCompact.diff ?_ ?_ ++ unfold U Rectangle ++ apply IsCompact.reProdIm ++ unfold uIcc ++ exact isCompact_Icc ++ unfold uIcc ++ exact isCompact_Icc ++ exact OpenW ++ refine Continuous.comp_continuousOn ?_ ?_ ++ exact continuous_norm ++ have : HolomorphicOn holoMatch (U \ W) := by ++ have : U \ W ⊆ U \ {1} := by ++ intro x x_location ++ obtain ⟨xInU, xOutW⟩ := x_location ++ rw[Set.mem_sdiff] ++ apply And.intro ++ exact xInU ++ rw[Set.mem_singleton_iff] ++ intro x_eq_1 ++ rw[x_eq_1] at xOutW ++ exact xOutW one_in_W ++ exact DifferentiableOn.mono holoMatchHoloOn this ++ unfold HolomorphicOn at this ++ exact DifferentiableOn.continuousOn this ++ have : Norm.norm ∘ holoMatch '' ((U ∩ W) \ {1}) ⊆ ++ Norm.norm ∘ holoMatch '' (W \ {1}) := by ++ have : (U ∩ W) \ {1} ⊆ W \ {1} := by ++ intro x x_location ++ rw[Set.mem_sdiff] at x_location ++ obtain ⟨⟨xInU, xInW⟩, xOut⟩ := x_location ++ exact ⟨xInW, xOut⟩ ++ exact image_mono this ++ exact BddAbove.mono this BddAboveW ++ ++ obtain ⟨g, gHolo_Eq⟩ := existsDifferentiableOn_of_bddAbove ++ pInRectangleInterior holoMatchHoloOn holoMatchBddAbove ++ obtain ⟨gHolo, gEq⟩ := gHolo_Eq ++ ++ have zRe_le_wRe : (σ₁ - ↑T * I).re ≤ (1 + (Real.log X)⁻¹ + T * I).re := by ++ repeat rw[sub_re] ++ repeat rw[add_re] ++ repeat rw[mul_re] ++ rw[I_re, I_im] ++ repeat rw[ofReal_re] ++ repeat rw[ofReal_im] ++ ring_nf ++ have : re 1 = 1 := by rfl ++ rw[this] ++ linarith ++ have zIm_le_wIm : (σ₁ - ↑T * I).im ≤ (1 + (Real.log X)⁻¹ + T * I).im := by ++ repeat rw[sub_im] ++ repeat rw[add_im] ++ repeat rw[mul_im] ++ rw[I_re, I_im] ++ repeat rw[ofReal_re] ++ repeat rw[ofReal_im] ++ ring_nf ++ have : im 1 = 0 := by rfl ++ rw[this] ++ linarith ++ have hres := ResidueTheoremOnRectangleWithSimplePole zRe_le_wRe zIm_le_wIm ++ pInRectangleInterior gHolo gEq ++ simp only [ofReal_inv] at hres ++ rw [← hres] ++ unfold RectangleIntegral' ++ simp only [smul_eq_mul] ++ ring ++ ++lemma interval_membership (r : ℝ)(a b: ℝ)(h1 : r ∈ Set.Icc (min a b) (max a b)) (h2 : a < b) : ++ a ≤ r ∧ r ≤ b := by ++ ++ have min_eq : min a b = a := min_eq_left (le_of_lt h2) ++ have max_eq : max a b = b := max_eq_right (le_of_lt h2) ++ rw [min_eq, max_eq] at h1 ++ rw [← @mem_Icc] ++ exact h1 ++ ++lemma verticalIntegral_split_three_finite {s a b e σ : ℝ} {f : ℂ → ℂ} ++ (hf : IntegrableOn (fun t : ℝ ↦ f (σ + t * I)) (Icc s e)) ++ (hab: s < a ∧ a < b ∧ b < e): ++ VIntegral f σ s e = ++ VIntegral f σ s a + ++ VIntegral f σ a b + ++ VIntegral f σ b e := by ++ dsimp [VIntegral] ++ rw [← intervalIntegrable_iff_integrableOn_Icc_of_le (by linarith)] at hf ++ rw[← intervalIntegral.integral_add_adjacent_intervals (b := a), ← intervalIntegral.integral_add_adjacent_intervals (a := a) (b := b)] ++ · ring ++ all_goals apply IntervalIntegrable.mono_set hf; apply uIcc_subset_uIcc <;> apply mem_uIcc_of_le <;> linarith ++ ++lemma verticalIntegral_split_three_finite' {s a b e σ : ℝ} {f : ℂ → ℂ} ++ (hf : IntegrableOn (fun t : ℝ ↦ f (σ + t * I)) (Icc s e)) ++ (hab: s < a ∧ a < b ∧ b < e): ++ (1 : ℂ) / (2 * π * I) * (VIntegral f σ s e) = ++ (1 : ℂ) / (2 * π * I) * (VIntegral f σ s a) + ++ (1 : ℂ) / (2 * π * I) * (VIntegral f σ a b) + ++ (1 : ℂ) / (2 * π * I) * (VIntegral f σ b e) := by ++ have : (1 : ℂ) / (2 * π * I) * (VIntegral f σ s a) + ++ (1 : ℂ) / (2 * π * I) * (VIntegral f σ a b) + ++ (1 : ℂ) / (2 * π * I) * (VIntegral f σ b e) = (1 : ℂ) / (2 * π * I) * ((VIntegral f σ s a) + ++ (VIntegral f σ a b) + ++ (VIntegral f σ b e)) := by ring ++ rw [this] ++ clear this ++ rw [← verticalIntegral_split_three_finite hf hab] ++ ++theorem SmoothedChebyshevPull2_aux1 {T σ₁ : ℝ} (σ₁lt : σ₁ < 1) ++ (holoOn : HolomorphicOn (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1})) : ++ ContinuousOn (fun (t : ℝ) ↦ -ζ' (σ₁ + t * I) / ζ (σ₁ + t * I)) (Icc (-T) T) := by ++ rw [show (fun (t : ℝ) ↦ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) = -(ζ' / ζ) ∘ (fun (t : ℝ) ↦ ↑σ₁ + ↑t * I) by ext; simp; ring_nf] ++ apply ContinuousOn.neg ++ apply holoOn.continuousOn.comp (by fun_prop) ++ intro t ht ++ simp ++ constructor ++ · apply mem_reProdIm.mpr ++ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add, left_mem_Icc, ht, and_true] ++ linarith ++ · intro h ++ replace h := congr_arg re h ++ simp at h ++ linarith ++ ++theorem SmoothedChebyshevPull2 {SmoothingF : ℝ → ℝ} {ε : ℝ} (ε_pos: 0 < ε) (ε_lt_one : ε < 1) ++ (X : ℝ) (_ : 3 < X) ++ {T : ℝ} (T_pos : 3 < T) {σ₁ σ₂ : ℝ} ++ (σ₂_pos : 0 < σ₂) (σ₁_lt_one : σ₁ < 1) ++ (σ₂_lt_σ₁ : σ₂ < σ₁) ++ (holoOn : HolomorphicOn (ζ' / ζ) ((Icc σ₁ 2)×ℂ (Icc (-T) T) \ {1})) ++ (holoOn2 : HolomorphicOn (SmoothedChebyshevIntegrand SmoothingF ε X) ++ (Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1})) ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) ++ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) ++ (diff_SmoothingF : ContDiff ℝ 1 SmoothingF) : ++ I₃₇ SmoothingF ε T X σ₁ = ++ I₃ SmoothingF ε T X σ₁ - ++ I₄ SmoothingF ε X σ₁ σ₂ + ++ I₅ SmoothingF ε X σ₂ + ++ I₆ SmoothingF ε X σ₁ σ₂ + ++ I₇ SmoothingF ε T X σ₁ := by ++ let z : ℂ := σ₂ - 3 * I ++ let w : ℂ := σ₁ + 3 * I ++ have σ₁_pos : 0 < σ₁ := by linarith ++ ++ have sub : z.Rectangle w ⊆ Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1} := by ++ ++ intro x hx ++ constructor ++ . ++ simp only [Rectangle, uIcc] at hx ++ rw [Complex.mem_reProdIm] at hx ⊢ ++ obtain ⟨hx_re, hx_im⟩ := hx ++ ++ have hzw_re : z.re < w.re := by ++ simp only [z, w, add_re, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] ++ linarith ++ have x_re_bounds : z.re ≤ x.re ∧ x.re ≤ w.re := by ++ exact interval_membership x.re z.re w.re hx_re hzw_re ++ have x_re_in_Icc : x.re ∈ Icc σ₂ 2 := by ++ have ⟨h_left, h_right⟩ := x_re_bounds ++ have h_left' : σ₂ ≤ x.re := by ++ simp only [z, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, mul_one] at h_left ++ linarith ++ have h_right' : x.re ≤ 2 := by ++ apply le_trans h_right ++ simp only [w, add_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] ++ linarith ++ exact ⟨h_left', h_right'⟩ ++ ++ have hzw_im : z.im < w.im := by ++ simp only [z, w, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, add_im, sub_im, mul_im, mul_one, zero_sub] ++ linarith ++ have x_im_bounds : z.im ≤ x.im ∧ x.im ≤ w.im := by ++ exact interval_membership x.im z.im w.im hx_im hzw_im ++ have x_im_in_Icc : x.im ∈ Icc (-3) 3 := by ++ have ⟨h_left, h_right⟩ := x_im_bounds ++ have h_left' : -3 ≤ x.im := by ++ simp only [z, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, sub_im, mul_im, mul_one, zero_sub] at h_left ++ linarith ++ have h_right' : x.im ≤ 3 := by ++ simp only [w, ofReal_im, re_ofNat, im_ofNat, I_re, I_im, mul_zero, add_zero, add_im, mul_im, mul_one] at h_right ++ linarith ++ exact ⟨h_left', h_right'⟩ ++ exact ⟨x_re_in_Icc, x_im_in_Icc⟩ ++ ++ . simp only [mem_singleton_iff] ++ ++ have x_re_upper: x.re ≤ σ₁ := by ++ simp only [Rectangle, uIcc] at hx ++ rw [Complex.mem_reProdIm] at hx ++ obtain ⟨hx_re, _⟩ := hx ++ ++ have hzw_re : z.re < w.re := by ++ simp only [z, w, add_re, sub_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] ++ linarith ++ have x_re_bounds : z.re ≤ x.re ∧ x.re ≤ w.re := by ++ exact interval_membership x.re z.re w.re hx_re hzw_re ++ have x_re_upper' : x.re ≤ w.re := by exact x_re_bounds.2 ++ simp only [w, add_re, mul_re, ofReal_re, re_ofNat, im_ofNat, I_re, I_im, mul_zero, sub_zero, add_zero, mul_one] at x_re_upper' ++ linarith ++ ++ have h_x_ne_one : x ≠ 1 := by ++ intro h_eq ++ have h_re : x.re = 1 := by rw [h_eq, Complex.one_re] ++ have h1 : 1 ≤ σ₁ := by ++ rw [← h_re] ++ exact x_re_upper ++ linarith ++ exact h_x_ne_one ++ have zero_over_box := HolomorphicOn.vanishesOnRectangle holoOn2 sub ++ have splitting : I₃₇ SmoothingF ε T X σ₁ = ++ I₃ SmoothingF ε T X σ₁ + I₅ SmoothingF ε X σ₁ + I₇ SmoothingF ε T X σ₁ := by ++ unfold I₃₇ I₃ I₅ I₇ ++ apply verticalIntegral_split_three_finite' ++ · apply ContinuousOn.integrableOn_Icc ++ unfold SmoothedChebyshevIntegrand ++ apply ContinuousOn.mul ++ · apply ContinuousOn.mul ++ · apply SmoothedChebyshevPull2_aux1 σ₁_lt_one holoOn ++ · apply continuousOn_of_forall_continuousAt ++ intro t t_mem ++ have := Smooth1MellinDifferentiable diff_SmoothingF suppSmoothingF ⟨ε_pos, ε_lt_one⟩ SmoothingFnonneg mass_one (s := ↑σ₁ + ↑t * I) (by simpa) ++ simpa using! realDiff_of_complexDiff _ this ++ · apply continuousOn_of_forall_continuousAt ++ intro t t_mem ++ apply ContinuousAt.comp ++ · refine continuousAt_const_cpow' ?_ ++ intro h ++ have : σ₁ = 0 := by ++ have h_real : (↑σ₁ + ↑t * I).re = (0 : ℂ).re := by ++ rw [h] ++ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, ++ sub_self, add_zero, zero_re] at h_real ++ exact h_real ++ linarith ++ · ++ apply ContinuousAt.add ++ · exact continuousAt_const ++ · apply ContinuousAt.mul ++ · apply continuous_ofReal.continuousAt ++ · exact continuousAt_const ++ · refine ⟨by linarith, by linarith, by linarith⟩ ++ calc I₃₇ SmoothingF ε T X σ₁ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (0 : ℂ) := by simp ++ _ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (RectangleIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z w) := by rw [← zero_over_box] ++ _ = I₃₇ SmoothingF ε T X σ₁ - (1 / (2 * π * I)) * (HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re z.im ++ - HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im ++ + VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im ++ - VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by simp [RectangleIntegral] ++ _ = I₃₇ SmoothingF ε T X σ₁ - ((1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re z.im ++ - (1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im ++ + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im ++ - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by ring ++ _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ ++ - (1 / (2 * π * I)) * HIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re w.re w.im ++ + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im ++ - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by ++ simp only [one_div, mul_inv_rev, inv_I, neg_mul, HIntegral, sub_im, ofReal_im, mul_im, ++ re_ofNat, I_im, mul_one, im_ofNat, I_re, mul_zero, add_zero, zero_sub, ofReal_neg, ++ ofReal_ofNat, sub_re, ofReal_re, mul_re, sub_self, sub_zero, add_re, add_im, zero_add, ++ sub_neg_eq_add, I₄, sub_right_inj, add_left_inj, neg_inj, mul_eq_mul_left_iff, mul_eq_zero, ++ I_ne_zero, inv_eq_zero, ofReal_eq_zero, OfNat.ofNat_ne_zero, or_false, false_or, z, w] ++ left ++ rfl ++ _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ ++ - I₆ SmoothingF ε X σ₁ σ₂ ++ + (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) w.re z.im w.im ++ - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by ++ simp only [one_div, mul_inv_rev, inv_I, neg_mul, HIntegral, add_im, ofReal_im, mul_im, ++ re_ofNat, I_im, mul_one, im_ofNat, I_re, mul_zero, add_zero, zero_add, ofReal_ofNat, sub_re, ++ ofReal_re, mul_re, sub_self, sub_zero, add_re, sub_neg_eq_add, sub_im, zero_sub, I₆, w, z] ++ _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ ++ - I₆ SmoothingF ε X σ₁ σ₂ ++ + I₅ SmoothingF ε X σ₁ ++ - (1 / (2 * π * I)) * VIntegral (SmoothedChebyshevIntegrand SmoothingF ε X) z.re z.im w.im) := by ++ simp only [one_div, mul_inv_rev, inv_I, neg_mul, VIntegral, add_re, ofReal_re, mul_re, ++ re_ofNat, I_re, mul_zero, im_ofNat, I_im, mul_one, sub_self, add_zero, sub_im, ofReal_im, ++ mul_im, zero_sub, add_im, zero_add, smul_eq_mul, sub_re, sub_zero, sub_neg_eq_add, I₅, ++ w, z] ++ _ = I₃₇ SmoothingF ε T X σ₁ - (I₄ SmoothingF ε X σ₁ σ₂ ++ - I₆ SmoothingF ε X σ₁ σ₂ ++ + I₅ SmoothingF ε X σ₁ ++ - I₅ SmoothingF ε X σ₂) := by ++ simp only [I₅, one_div, mul_inv_rev, inv_I, neg_mul, VIntegral, sub_re, ofReal_re, mul_re, ++ re_ofNat, I_re, mul_zero, im_ofNat, I_im, mul_one, sub_self, sub_zero, sub_im, ofReal_im, ++ mul_im, add_zero, zero_sub, add_im, zero_add, smul_eq_mul, sub_neg_eq_add, z, w] ++ ++ _ = I₃ SmoothingF ε T X σ₁ ++ + I₅ SmoothingF ε X σ₁ ++ + I₇ SmoothingF ε T X σ₁ ++ - (I₄ SmoothingF ε X σ₁ σ₂ ++ - I₆ SmoothingF ε X σ₁ σ₂ ++ + I₅ SmoothingF ε X σ₁ ++ - I₅ SmoothingF ε X σ₂) := by ++ rw [splitting] ++ _ = I₃ SmoothingF ε T X σ₁ ++ - I₄ SmoothingF ε X σ₁ σ₂ ++ + I₅ SmoothingF ε X σ₂ ++ + I₆ SmoothingF ε X σ₁ σ₂ ++ + I₇ SmoothingF ε T X σ₁ := by ++ ring ++ ++theorem ZetaBoxEval {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) : ++ ∃ C, ∀ᶠ ε in (nhdsWithin 0 (Ioi 0)), ∀ X : ℝ, 0 ≤ X → ++ ‖𝓜 ((Smooth1 SmoothingF ε) ·) 1 * X - X‖ ≤ C * ε * X := by ++ have := MellinOfSmooth1c ContDiffSmoothingF suppSmoothingF mass_one ++ clear suppSmoothingF mass_one ContDiffSmoothingF ++ rw[Asymptotics.isBigO_iff] at this ++ obtain ⟨C, hC⟩ := this ++ use C ++ have εpos : ∀ᶠ (ε : ℝ) in nhdsWithin 0 (Ioi 0), ε > 0 := ++ eventually_mem_of_tendsto_nhdsWithin fun ⦃U⦄ hU ↦ hU ++ filter_upwards [hC, εpos] with ε hC εpos ++ rw[id_eq, norm_of_nonneg (le_of_lt εpos)] at hC ++ intro X Xnne ++ nth_rw 2 [← one_mul (X : ℂ)] ++ rw[← sub_mul, norm_mul, norm_real, norm_of_nonneg Xnne] ++ exact mul_le_mul_of_nonneg_right hC Xnne ++ ++theorem norm_reciprocal_inequality_1 (x : ℝ) (x₁ : ℝ) (hx₁ : x₁ ≥ 1) : ++ ‖x^2 + x₁^2‖₊⁻¹ ≤ (‖x₁‖₊^2)⁻¹ := by ++ ++ have h1 : x₁^2 ≥ 1 := by ++ have h_abs : |x₁| ≥ 1 := by ++ rw [abs_of_pos] ++ linarith ++ positivity ++ simp only [ge_iff_le, one_le_sq_iff_one_le_abs, h_abs] ++ ++ have h2 : x^2 + x₁^2 ≥ x₁^2 := by ++ linarith [sq_nonneg x] ++ ++ have h3 : x₁^2 > 0 := by ++ apply sq_pos_of_ne_zero ++ linarith ++ ++ have h33 : 2 * x₁^2 > 0 := by ++ simp [*] ++ ++ have h4 : x^2 + x₁^2 > 0 := by ++ linarith [sq_nonneg x, h3] ++ ++ have h5 : x₁^2 ≤ x^2 + x₁^2 := h2 ++ ++ have h6 : ‖x₁^2‖₊ = ‖x₁‖₊^2 := by ++ rw [nnnorm_pow] ++ ++ have h7 : ‖x^2 + x₁^2‖₊ = x^2 + x₁^2 := by ++ rw [Real.nnnorm_of_nonneg (le_of_lt h4)] ++ norm_cast ++ ++ rw [← NNReal.coe_le_coe] ++ push_cast ++ simp [*] ++ simp_all ++ rw [abs_of_nonneg] ++ · have U := inv_le_inv₀ h4 h3 ++ rw [U] ++ simp [*] ++ ++ · positivity ++ ++theorem norm_reciprocal_inequality (x : ℝ) (x₁ : ℝ) (hx₁ : x₁ ≤ -1) : ++ ‖x^2 + x₁^2‖₊⁻¹ ≤ (‖x₁‖₊^2)⁻¹ := by ++ ++ have h1 : x₁^2 ≥ 1 := by ++ have h_abs : |x₁| ≥ 1 := by ++ rw [abs_of_nonpos (le_of_lt (lt_of_le_of_lt hx₁ (by norm_num : (-1 : ℝ) < 0)))] ++ linarith ++ simp only [ge_iff_le, one_le_sq_iff_one_le_abs, h_abs] ++ ++ have h2 : x^2 + x₁^2 ≥ x₁^2 := by ++ linarith [sq_nonneg x] ++ ++ have h3 : x₁^2 > 0 := by ++ apply sq_pos_of_ne_zero ++ linarith ++ ++ have h33 : 2 * x₁^2 > 0 := by ++ simp [*] ++ ++ have h4 : x^2 + x₁^2 > 0 := by ++ linarith [sq_nonneg x, h3] ++ ++ have h5 : x₁^2 ≤ x^2 + x₁^2 := h2 ++ ++ have h6 : ‖x₁^2‖₊ = ‖x₁‖₊^2 := by ++ rw [nnnorm_pow] ++ ++ have h7 : ‖x^2 + x₁^2‖₊ = x^2 + x₁^2 := by ++ rw [Real.nnnorm_of_nonneg (le_of_lt h4)] ++ norm_cast ++ ++ rw [← NNReal.coe_le_coe] ++ push_cast ++ simp [*] ++ simp_all ++ rw [abs_of_nonneg] ++ · have U := inv_le_inv₀ h4 h3 ++ rw [U] ++ simp [*] ++ ++ · positivity ++ ++theorem poisson_kernel_integrable (x : ℝ) (hx : x ≠ 0) : ++ MeasureTheory.Integrable (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by ++ ++ have h1 : ∀ t : ℝ, ‖x + t * I‖^2 = x^2 + t^2 := by ++ intro t ++ rw [Complex.norm_add_mul_I, Real.sq_sqrt] ++ positivity ++ ++ have h2 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) = (fun (t : ℝ) ↦ (x^2 + t^2)⁻¹) := by ++ ext t ++ rw [h1] ++ rw [h2] ++ ++ have h3 : ∀ t : ℝ, x^2 + t^2 > 0 := by ++ intro t ++ apply add_pos_of_pos_of_nonneg ++ · exact sq_pos_of_ne_zero hx ++ · exact sq_nonneg t ++ ++ have h4 : Continuous (fun t : ℝ ↦ (x^2 + t^2)⁻¹) := by ++ apply Continuous.inv₀ ++ · exact continuous_const.add (continuous_pow 2) ++ · intro t ++ exact ne_of_gt (h3 t) ++ ++ have integrable_on_bounded : ∀ R > 0, MeasureTheory.IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Icc (-R) R) := by ++ intro R hR ++ refine ContinuousOn.integrableOn_Icc ?_ ++ · exact Continuous.continuousOn h4 ++ ++ have decay_bound : ∀ t : ℝ, 0 < |t| → (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by ++ intro t hyp_t ++ rw [←inv_le_inv₀] ++ simp_all only [ne_eq, gt_iff_lt, abs_pos, inv_inv, le_add_iff_nonneg_left] ++ · positivity ++ · simp_all only [ne_eq, gt_iff_lt, abs_pos, inv_pos] ++ positivity ++ · positivity ++ ++ have decay_bound_1 : ∀ x_1 ≤ -1, ‖x ^ 2 + x_1 ^ 2‖₊⁻¹ ≤ (‖x_1‖₊ ^ 2)⁻¹ := by ++ exact norm_reciprocal_inequality x ++ ++ have decay_bound_2 : ∀ (x_1 : ℝ), 1 ≤ x_1 → ‖x ^ 2 + x_1 ^ 2‖₊⁻¹ ≤ (‖x_1‖₊ ^ 2)⁻¹ := by ++ exact norm_reciprocal_inequality_1 x ++ ++ have f_int_1 : IntegrableOn (fun (t : ℝ) ↦ (t^2)⁻¹) (Set.Iic (-1)) volume := by ++ have D1 : (-2) < (-1 : ℝ) := by simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, ++ Nat.one_lt_ofNat] ++ have D2 : 0 < (1 : ℝ) := by simp only [zero_lt_one] ++ have D := integrableOn_Ioi_rpow_of_lt D1 D2 ++ have D3 := MeasureTheory.IntegrableOn.comp_neg D ++ simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg, neg_Ioi] at D3 ++ have D4 := ++ (integrableOn_Iic_iff_integrableOn_Iio' ++ (by ++ refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ ++ · simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, ++ zero_lt_one, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, ++ EReal.coe_ennreal_zero, EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 ++ simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, zero_lt_one, ++ rpow_neg_ofNat, Int.reduceNeg, zpow_neg] ++ unfold IntegrableOn at D4 ++ have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by ++ funext x ++ simp_all only [even_two, Even.neg_pow] ++ simp_all only [even_two, Even.neg_pow] ++ norm_cast at D4 ++ simp_all only [even_two, Even.neg_pow, Int.reduceNegSucc, Int.cast_neg, Int.cast_one] ++ exact D4 ++ ++ have f_int_2 : IntegrableOn (fun (t : ℝ) ↦ (t^2)⁻¹) (Set.Ici 1) volume := by ++ have D1 : (-2) < (-1 : ℝ) := by simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, ++ Nat.one_lt_ofNat] ++ have D2 : 0 < (1 : ℝ) := by simp only [zero_lt_one] ++ have D3 := integrableOn_Ioi_rpow_of_lt D1 D2 ++ simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg] at D3 ++ have D4 := ++ (integrableOn_Ici_iff_integrableOn_Ioi' ++ (by ++ refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ ++ · simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, ++ zero_lt_one, measure_singleton, EReal.coe_ennreal_zero, EReal.coe_ennreal_top, ++ EReal.zero_ne_top, not_false_eq_true])).mpr D3 ++ simp_all only [ne_eq, gt_iff_lt, abs_pos, neg_lt_neg_iff, Nat.one_lt_ofNat, zero_lt_one] ++ unfold IntegrableOn at D4 ++ have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by ++ funext x ++ simp_all only [even_two, Even.neg_pow] ++ simp_all only [even_two, Even.neg_pow] ++ norm_cast at D4 ++ ++ have int_neg : IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Iic (-1)) volume := by ++ have h_le : ∀ t ∈ Set.Iic (-1), (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by ++ intro t ht ++ simp only [Set.mem_Iic] at ht ++ ++ have t_neg : t < 0 := lt_of_le_of_lt ht (by norm_num : (-1 : ℝ) < 0) ++ exact decay_bound t (abs_pos.mpr (ne_of_lt t_neg)) ++ have h_meas : AEStronglyMeasurable (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Set.Iic (-1))) := by ++ exact Continuous.aestronglyMeasurable h4 ++ ++ unfold IntegrableOn ++ unfold Integrable ++ constructor ++ · exact h_meas ++ · have Z : HasFiniteIntegral (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Iic (-1))) := by ++ refine MeasureTheory.HasFiniteIntegral.mono'_enorm f_int_1.2 ?_ ++ · unfold Filter.Eventually ++ simp only [measurableSet_Iic, ae_restrict_eq, nnnorm_inv, nnnorm_pow, enorm_le_coe] ++ refine mem_inf_of_right ?_ ++ · refine mem_principal.mpr ?_ ++ · rw [Set.subset_def] ++ simp only [mem_Iic, mem_ofPred_eq] ++ exact decay_bound_1 ++ ++ exact Z ++ ++ have int_pos : IntegrableOn (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (Set.Ici 1) volume := by ++ have h_le : ∀ t ∈ Set.Ici 1, (x^2 + t^2)⁻¹ ≤ (t^2)⁻¹ := by ++ intro t ht ++ simp only [Set.mem_Ici] at ht ++ ++ have t_pos : t > 0 := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) ht ++ exact decay_bound t (abs_pos.mpr (ne_of_gt t_pos)) ++ have h_meas : AEStronglyMeasurable (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Set.Ici 1)) := by ++ exact Continuous.aestronglyMeasurable h4 ++ ++ unfold IntegrableOn ++ unfold Integrable ++ constructor ++ · exact h_meas ++ · have Z : HasFiniteIntegral (fun t : ℝ ↦ (x^2 + t^2)⁻¹) (volume.restrict (Ici (1))) := by ++ refine MeasureTheory.HasFiniteIntegral.mono'_enorm f_int_2.2 ?_ ++ · unfold Filter.Eventually ++ simp only [measurableSet_Ici, ae_restrict_eq, nnnorm_inv, nnnorm_pow, enorm_le_coe] ++ refine mem_inf_of_right ?_ ++ · refine mem_principal.mpr ?_ ++ · rw [Set.subset_def] ++ simp only [mem_Ici, mem_ofPred_eq] ++ exact decay_bound_2 ++ ++ exact Z ++ ++ have split : Set.univ = Set.Iic (-1) ∪ Set.Icc (-1) 1 ∪ Set.Ici 1 := by ++ ext t ++ simp only [Set.mem_univ, Set.mem_union, Set.mem_Iic, Set.mem_Icc, Set.mem_Ici, true_iff] ++ by_cases h : t ≤ -1 ++ · left; left; exact h ++ · by_cases h' : t ≥ 1 ++ · right; exact h' ++ · left; right; constructor <;> linarith ++ ++ have Z := ++ MeasureTheory.IntegrableOn.union ++ (MeasureTheory.IntegrableOn.union ++ (int_neg) ++ (integrable_on_bounded 1 zero_lt_one)) ++ (int_pos) ++ ++ simp_all only [ne_eq, gt_iff_lt, abs_pos, Int.reduceNeg, neg_le_self_iff, zero_le_one, Iic_union_Icc_eq_Iic, ++ Iic_union_Ici, integrableOn_univ] ++ ++theorem ae_volume_of_contains_compl_singleton_zero ++ (s : Set ℝ) ++ (h : (univ : Set ℝ) \ {0} ⊆ s) : ++ s ∈ (MeasureTheory.ae volume) := by ++ ++ have h_zero_null : volume ({0} : Set ℝ) = 0 := by ++ exact volume_singleton ++ ++ have h_compl_subset : sᶜ ⊆ {0} := by ++ intro x hx ++ ++ by_contra h_not_zero ++ have : x ∈ univ \ {0} := ⟨trivial, h_not_zero⟩ ++ exact hx (h this) ++ ++ have h_compl_measure : volume sᶜ ≤ volume ({0} : Set ℝ) := ++ measure_mono h_compl_subset ++ ++ have h_compl_zero : volume sᶜ = 0 := by ++ rw [h_zero_null] at h_compl_measure ++ exact le_antisymm h_compl_measure zero_le ++ ++ rwa [mem_ae_iff] ++ ++theorem integral_evaluation (x : ℝ) (T : ℝ) ++ : (3 < T) → ∫ (t : ℝ) in Iic (-T), (‖x + t * I‖ ^ 2)⁻¹ ≤ T⁻¹ := by ++ ++ intro T_large ++ ++ have T00 : ∀ (x t : ℝ), t^2 ≤ ‖x + t * I‖^2 := by ++ intro x t ++ rw [Complex.norm_add_mul_I x t] ++ ring_nf ++ rw [Real.sq_sqrt _] ++ simp only [le_add_iff_nonneg_right]; positivity ++ positivity ++ ++ have T0 : ∀ (x t : ℝ), t ≠ 0 → (‖x + t * I‖^2)⁻¹ ≤ (t^2)⁻¹ := by ++ intro x t hyp ++ have U0 : 0 < t^2 := by positivity ++ have U1 : 0 < ‖x + t * I‖^2 := by ++ rw [Complex.norm_add_mul_I x t] ++ rw [Real.sq_sqrt _] ++ positivity ++ positivity ++ rw [inv_le_inv₀ U1 U0] ++ exact (T00 x t) ++ ++ have T1 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) ≤ᶠ[ae (volume.restrict (Iic (-T)))] (fun (t : ℝ) ↦ (t^2)⁻¹) := by ++ unfold Filter.EventuallyLE ++ unfold Filter.Eventually ++ simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq] ++ refine mem_inf_of_left ?_ ++ · refine Filter.mem_sets.mp ?_ ++ · have U : {x_1 : ℝ | x_1 ≠ 0} ⊆ {x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} := by ++ rw [Set.ofPred_subset_ofPred] ++ intro t hyp_t ++ exact T0 x t hyp_t ++ have U1 : {x_1 : ℝ | x_1 ≠ 0} = (univ \ {0}) := by ++ apply Set.ext ++ intro x ++ simp_all only [ne_eq, ofPred_subset_ofPred, not_false_eq_true, implies_true, mem_ofPred_eq, Set.mem_sdiff, mem_univ, ++ mem_singleton_iff, true_and] ++ ++ rw [U1] at U ++ have Z := ae_volume_of_contains_compl_singleton_zero ++ ({x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} : Set ℝ) U ++ exact Z ++ ++ have T2 : 0 ≤ᶠ[ae (volume.restrict (Iic (-T)))] (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by ++ unfold Filter.EventuallyLE ++ unfold Filter.Eventually ++ simp_all only [ne_eq, Pi.zero_apply, inv_nonneg, norm_nonneg, pow_nonneg, ++ ofPred_true, univ_mem] ++ ++ have T4 : deriv (fun (t : ℝ) ↦ t⁻¹) = (fun t ↦ (- (t^2)⁻¹)) := by ++ exact deriv_inv' ++ ++ have hcont : ContinuousWithinAt (fun t ↦ t⁻¹) (Set.Iic (-T)) (-T) := by ++ refine ContinuousWithinAt.inv₀ ?_ ?_ ++ · exact ContinuousAt.continuousWithinAt fun ⦃U⦄ a ↦ a ++ · intro hyp ++ linarith ++ ++ have hderiv : ∀ x ∈ Set.Iio (-T), HasDerivAt (fun t ↦ t⁻¹) ((fun t ↦ - (t^2)⁻¹) x) x := by ++ ++ intro x hx ++ ++ have hx_ne_zero : x ≠ 0 := by ++ intro h ++ rw [h] at hx ++ simp [Set.Iio] at hx ++ linarith ++ ++ convert hasDerivAt_inv hx_ne_zero ++ ++ have f'int : IntegrableOn (fun t ↦ - (t^2)⁻¹) (Set.Iic (-T)) volume := by ++ have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] ++ have D2 : 0 < T := by positivity ++ have D := integrableOn_Ioi_rpow_of_lt D1 D2 ++ ++ have D3 := MeasureTheory.IntegrableOn.comp_neg D ++ simp [*] at D3 ++ have D4 := ++ (integrableOn_Iic_iff_integrableOn_Iio' ++ (by ++ refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ ++ · simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, neg_lt_neg_iff, ++ Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, EReal.coe_ennreal_zero, ++ EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 ++ simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, neg_lt_neg_iff, ++ Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg] ++ ++ unfold IntegrableOn at D4 ++ have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by ++ funext x ++ simp_all only [even_two, Even.neg_pow] ++ ++ simp_all only [even_two, Even.neg_pow] ++ have D6 := MeasureTheory.integrable_neg_iff.mpr D4 ++ have eq_fun : (-fun x ↦ (x^2)⁻¹) = (fun (x : ℝ) ↦ - (x^2)⁻¹) := by ++ funext x ++ simp only [Pi.neg_apply] ++ rw [eq_fun] at D6 ++ exact D6 ++ ++ have hf : Filter.Tendsto (fun (t : ℝ) ↦ t⁻¹) Filter.atBot (nhds 0) := by exact ++ tendsto_inv_atBot_zero ++ ++ have T5 : ∫ (t : ℝ) in Iic (-T), - (t^2)⁻¹ = (-T)⁻¹ - 0 := by ++ exact MeasureTheory.integral_Iic_of_hasDerivAt_of_tendsto hcont hderiv f'int hf ++ ++ have T6 : ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ = T⁻¹ := by ++ simp only [inv_neg, sub_zero] at T5 ++ have D6 : - ∫ (t : ℝ) in Iic (-T), - (t^2)⁻¹ = ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ := by ++ simp only [integral_neg fun a ↦ (a ^ 2)⁻¹, neg_neg] ++ ++ rw [←D6] ++ rw [T5] ++ simp only [neg_neg] ++ ++ have T3 : Integrable (fun (t : ℝ) ↦ (t^2)⁻¹) (volume.restrict (Iic (-T))) := by ++ ++ have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] ++ have D2 : 0 < T := by positivity ++ have D := integrableOn_Ioi_rpow_of_lt D1 D2 ++ ++ have D3 := MeasureTheory.IntegrableOn.comp_neg D ++ simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg, neg_Ioi] at D3 ++ have D4 := ++ (integrableOn_Iic_iff_integrableOn_Iio' ++ (by ++ refine EReal.coe_ennreal_ne_coe_ennreal_iff.mp ?_ ++ · simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, inv_neg, sub_zero, ++ neg_lt_neg_iff, Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg, measure_singleton, EReal.coe_ennreal_zero, ++ EReal.coe_ennreal_top, EReal.zero_ne_top, not_false_eq_true])).mpr D3 ++ simp_all only [ne_eq, measurableSet_Iic, ae_restrict_eq, deriv_inv', mem_Iio, inv_neg, sub_zero, ++ neg_lt_neg_iff, Nat.one_lt_ofNat, rpow_neg_ofNat, Int.reduceNeg, zpow_neg] ++ ++ unfold IntegrableOn at D4 ++ have eq_fun : (fun (x : ℝ) ↦ ((-x)^2)⁻¹) = fun x ↦ (x^2)⁻¹ := by ++ funext x ++ simp_all only [even_two, Even.neg_pow] ++ simp_all only [even_two, Even.neg_pow] ++ norm_cast at D4 ++ simp_all only [even_two, Even.neg_pow] ++ ++ have Z := ++ by ++ calc ++ ∫ (t : ℝ) in Iic (-T), (‖x + t * I‖ ^ 2)⁻¹ ≤ ∫ (t : ℝ) in Iic (-T), (t^2)⁻¹ := by ++ exact MeasureTheory.integral_mono_of_nonneg T2 T3 T1 ++ ++ _ = T⁻¹ := by exact T6 ++ ++ exact Z ++ ++theorem integral_evaluation' (x : ℝ) (T : ℝ) ++ : (3 < T) → ∫ (t : ℝ) in Ici (T), (‖x + t * I‖ ^ 2)⁻¹ ≤ T⁻¹ := by ++ intro T_large ++ ++ have T00 : ∀ (x t : ℝ), t^2 ≤ ‖x + t * I‖^2 := by ++ intro x t ++ rw [Complex.norm_add_mul_I x t] ++ ring_nf ++ rw [Real.sq_sqrt _] ++ simp only [le_add_iff_nonneg_right]; positivity ++ positivity ++ ++ have T0 : ∀ (x t : ℝ), t ≠ 0 → (‖x + t * I‖^2)⁻¹ ≤ (t^2)⁻¹ := by ++ intro x t hyp ++ have U0 : 0 < t^2 := by positivity ++ have U1 : 0 < ‖x + t * I‖^2 := by ++ rw [Complex.norm_add_mul_I x t] ++ rw [Real.sq_sqrt _] ++ positivity ++ positivity ++ rw [inv_le_inv₀ U1 U0] ++ exact (T00 x t) ++ ++ have T2 : 0 ≤ᶠ[ae (volume.restrict (Ioi T))] (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) := by ++ unfold Filter.EventuallyLE ++ unfold Filter.Eventually ++ simp_all only [ne_eq, Pi.zero_apply, inv_nonneg, norm_nonneg, pow_nonneg, ++ ofPred_true, univ_mem] ++ ++ have T3 : Integrable (fun (t : ℝ) ↦ - (t^2)⁻¹) (volume.restrict (Ioi T)) := by ++ have D1 : (-2) < (-1 : ℝ) := by simp only [neg_lt_neg_iff, Nat.one_lt_ofNat] ++ have D2 : 0 < T := by positivity ++ have D := integrableOn_Ioi_rpow_of_lt D1 D2 ++ simp only [rpow_neg_ofNat, Int.reduceNeg, zpow_neg] at D ++ exact MeasureTheory.Integrable.fun_neg D ++ ++ have T3' : Integrable (fun (t : ℝ) ↦ (t^2)⁻¹) (volume.restrict (Ioi T)) := by ++ have D := MeasureTheory.Integrable.fun_neg T3 ++ simp_all only [ne_eq, measurableSet_Ioi, ae_restrict_eq, neg_neg] ++ ++ have T1 : (fun (t : ℝ) ↦ (‖x + t * I‖^2)⁻¹) ≤ᶠ[ae (volume.restrict (Ioi T))] (fun (t : ℝ) ↦ (t^2)⁻¹) := by ++ unfold Filter.EventuallyLE ++ unfold Filter.Eventually ++ simp_all only [ne_eq, measurableSet_Ioi, ae_restrict_eq] ++ refine mem_inf_of_left ?_ ++ · refine Filter.mem_sets.mp ?_ ++ · have U : {x_1 : ℝ | x_1 ≠ 0} ⊆ {x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} := by ++ rw [Set.ofPred_subset_ofPred] ++ intro t hyp_t ++ exact T0 x t hyp_t ++ have U1 : {x_1 : ℝ | x_1 ≠ 0} = (univ \ {0}) := by ++ apply Set.ext ++ intro x ++ simp_all only [ne_eq, ofPred_subset_ofPred, not_false_eq_true, implies_true, mem_ofPred_eq, Set.mem_sdiff, mem_univ, ++ mem_singleton_iff, true_and] ++ ++ rw [U1] at U ++ have Z := ae_volume_of_contains_compl_singleton_zero ++ ({x_1 : ℝ | (‖x + x_1 * I‖ ^ 2)⁻¹ ≤ (x_1 ^ 2)⁻¹} : Set ℝ) U ++ exact Z ++ ++ have hcont : ContinuousWithinAt (fun t ↦ t⁻¹) (Set.Ici T) T := by ++ refine ContinuousWithinAt.inv₀ ?_ ?_ ++ · exact ContinuousAt.continuousWithinAt fun ⦃U⦄ a ↦ a ++ · intro hyp ++ linarith ++ ++ have hderiv : ∀ x ∈ Set.Ioi T, HasDerivAt (fun t ↦ t⁻¹) ((fun t ↦ - (t^2)⁻¹) x) x := by ++ ++ intro x hx ++ ++ have hx_ne_zero : x ≠ 0 := by ++ intro h ++ rw [h] at hx ++ simp at hx ++ linarith ++ ++ convert hasDerivAt_inv hx_ne_zero ++ ++ have hf : Filter.Tendsto (fun (t : ℝ) ↦ t⁻¹) Filter.atTop (nhds 0) := by exact ++ tendsto_inv_atTop_zero ++ ++ have T5 : ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ = (T)⁻¹ - 0 := by ++ have U := MeasureTheory.integral_Ioi_of_hasDerivAt_of_tendsto hcont hderiv T3 hf ++ simp [*] at U ++ rw [MeasureTheory.integral_neg] at U ++ simp_all only [ne_eq, mem_Ioi, neg_inj, sub_zero] ++ ++ have T6 : ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ = T⁻¹ := by ++ simp only [sub_zero] at T5 ++ have D6 : - ∫ (t : ℝ) in Ioi T, - (t^2)⁻¹ = ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ := by ++ simp only [integral_neg fun a ↦ (a ^ 2)⁻¹, neg_neg] ++ ++ rw [←D6] ++ rw [←T5] ++ exact D6 ++ ++ have Z := ++ by ++ calc ++ ∫ (t : ℝ) in Ioi T, (‖x + t * I‖ ^ 2)⁻¹ ≤ ∫ (t : ℝ) in Ioi T, (t^2)⁻¹ := by ++ exact MeasureTheory.integral_mono_of_nonneg T2 T3' T1 ++ ++ _ = T⁻¹ := by exact T6 ++ ++ rw [←MeasureTheory.integral_Ici_eq_integral_Ioi] at Z ++ ++ exact Z ++ ++lemma IBound_aux1 (X₀ : ℝ) (X₀pos : X₀ > 0) (k : ℕ) : ∃ C ≥ 1, ∀ X ≥ X₀, Real.log X ^ k ≤ C * X := by ++ ++ have ⟨M, hM⟩ := Filter.eventually_atTop.mp (isLittleO_log_rpow_rpow_atTop k zero_lt_one).eventuallyLE ++ ++ let f := fun X ↦ Real.log X ^ k / X ++ let I1 := Icc X₀ M ++ have : 0 ∉ I1 := notMem_Icc_of_lt X₀pos ++ have f_cont : ContinuousOn f (Icc X₀ M) := ++ ((continuousOn_log.pow k).mono (subset_compl_singleton_iff.mpr this)).div ++ continuous_id.continuousOn (fun x hx ↦ ne_of_mem_of_not_mem hx this) ++ have ⟨C₁, hC₁⟩ := isCompact_Icc.exists_bound_of_continuousOn f_cont ++ use max C₁ 1, le_max_right C₁ 1 ++ intro X hX ++ have Xpos : X > 0 := lt_of_lt_of_le X₀pos hX ++ by_cases hXM : X ≤ M ++ · rw[← div_le_iff₀ Xpos] ++ calc ++ f X ≤ ‖f X‖ := le_norm_self _ ++ _ ≤ C₁ := hC₁ X ⟨hX, hXM⟩ ++ _ ≤ max C₁ 1 := le_max_left C₁ 1 ++ · calc ++ Real.log X ^ k ≤ ‖Real.log X ^ k‖ := le_norm_self _ ++ _ ≤ ‖X ^ 1‖ := by exact_mod_cast hM X (by linarith[hXM]) ++ _ = 1 * X := by ++ rw[pow_one, one_mul] ++ apply norm_of_nonneg ++ exact Xpos.le ++ _ ≤ max C₁ 1 * X := by ++ rw[mul_le_mul_iff_left₀ Xpos] ++ exact le_max_right C₁ 1 ++ ++theorem I1Bound ++ {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) ++ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : ++ ∃ C > 0, ∀(ε : ℝ) (_ : 0 < ε) ++ (_ : ε < 1) ++ (X : ℝ) (_ : 3 < X) ++ {T : ℝ} (_ : 3 < T), ++ ‖I₁ SmoothingF ε X T‖ ≤ C * X * Real.log X / (ε * T) := by ++ ++ obtain ⟨M, ⟨M_is_pos, M_bounds_mellin_hard⟩⟩ := ++ MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF ++ ++ have G0 : ∃K > 0, ∀(t σ : ℝ), 1 < σ → σ < 2 → ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ ≤ K * (σ - 1)⁻¹ := by ++ let ⟨K', ⟨K'_pos, K'_bounds_zeta⟩⟩ := strongPnt_triv_bound_zeta ++ use (2 * (K' + 1)) ++ use (by positivity) ++ intro t σ cond cond2 ++ ++ have T0 : 0 < K' + 1 := by positivity ++ have T1 : 1 ≤ (σ - 1)⁻¹ := by ++ have U : σ - 1 ≤ 1 := by linarith ++ have U1 := (inv_le_inv₀ (by positivity) (by exact sub_pos.mpr cond)).mpr U ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, ge_iff_le, Complex.norm_div, ++ norm_neg, tsub_le_iff_right, inv_one] ++ ++ have T : (K' + 1) * 1 ≤ (K' + 1) * (σ - 1)⁻¹ := ++ by ++ exact (mul_le_mul_iff_right₀ T0).mpr T1 ++ have T2 : (K' + 1) ≤ (K' + 1) * (σ - 1)⁻¹ := by ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, ge_iff_le, Complex.norm_div, ++ norm_neg, mul_one, le_mul_iff_one_le_right] ++ ++ have U := calc ++ ‖ζ' (σ + t * I) / ζ (σ + t * I)‖ = ‖-ζ' (σ + t * I) / ζ (σ + t * I)‖ := by ++ rw [← norm_neg _, mul_comm, neg_div' _ _] ++ _ ≤ (σ - 1)⁻¹ + K' := K'_bounds_zeta σ t cond ++ _ ≤ (σ - 1)⁻¹ + (K' + 1) := by aesop ++ _ ≤ (K' + 1) * (σ - 1)⁻¹ + (K' + 1) := by aesop ++ _ ≤ (K' + 1) * (σ - 1)⁻¹ + (K' + 1) * (σ - 1)⁻¹ := by linarith ++ _ = 2 * (K' + 1) * (σ - 1)⁻¹ := by ++ ring_nf ++ ++ exact U ++ ++ obtain ⟨K, ⟨K_is_pos, K_bounds_zeta_at_any_t'⟩⟩ := G0 ++ ++ have C_final_pos : |π|⁻¹ * 2⁻¹ * (Real.exp 1 * K * M) > 0 := by ++ positivity ++ ++ use (|π|⁻¹ * 2⁻¹ * (Real.exp 1 * K * M)) ++ use C_final_pos ++ ++ intro eps eps_pos eps_less_one X X_large T T_large ++ ++ let pts_re := 1 + (Real.log X)⁻¹ ++ let pts := fun (t : ℝ) ↦ (pts_re + t * I) ++ ++ have pts_re_triv : ∀(t : ℝ), (pts t).re = pts_re := by ++ intro t ++ unfold pts ++ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, ++ add_zero] ++ ++ have pts_re_ge_one : 1 < pts_re := by ++ unfold pts_re ++ simp only [lt_add_iff_pos_right, inv_pos] ++ have U : 1 < X := by linarith ++ exact Real.log_pos U ++ ++ have pts_re_le_one : pts_re < 2 := by ++ unfold pts_re ++ have Z0 : 3 ∈ {x : ℝ | 1 ≤ x} := by ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, Complex.norm_div, ++ mem_ofPred_eq, Nat.one_le_ofNat] ++ have Z1 : X ∈ {x : ℝ | 1 ≤ x} := by ++ simp only [mem_ofPred_eq] ++ linarith ++ have Z : Real.log 3 < Real.log X := ++ by ++ refine log_lt_log ?_ X_large ++ simp only [Nat.ofNat_pos] ++ ++ have Z01 : 1 < Real.log 3 := ++ by ++ have Z001 : 1 = Real.log (rexp 1) := by exact Eq.symm (Real.log_exp 1) ++ rw [Z001] ++ have Z002 : (0 : ℝ) < rexp 1 := by positivity ++ have Z003 : (0 : ℝ) < 3 := by positivity ++ have Z004 : rexp 1 < 3 := by ++ calc ++ rexp 1 < (↑ 2.7182818286 : ℚ) := Real.exp_one_lt_d9 ++ _ < (↑ 3 : ℚ) := by linarith ++ ++ exact (Real.log_lt_log_iff Z002 Z003).mpr Z004 ++ ++ have Zpos0 : 0 < Real.log 3 := by positivity ++ have Zpos1 : 0 < Real.log X := by calc ++ 0 < Real.log 3 := Zpos0 ++ _ < Real.log X := Z ++ ++ have Z1 : (Real.log X)⁻¹ < (Real.log 3)⁻¹ := ++ by ++ exact (inv_lt_inv₀ Zpos1 Zpos0).mpr Z ++ ++ have Z02 : (Real.log 3)⁻¹ < 1 := by ++ have T01 := (inv_lt_inv₀ ?_ ?_).mpr Z01 ++ simp only [inv_one] at T01 ++ exact T01 ++ exact Zpos0 ++ simp only [zero_lt_one] ++ ++ have Z2 : 1 + (Real.log X)⁻¹ < 1 + (Real.log 3)⁻¹ := by ++ exact (add_lt_add_iff_left 1).mpr Z1 ++ ++ have Z3 : 1 + (Real.log 3)⁻¹ < 2 := by ++ calc ++ 1 + (Real.log 3)⁻¹ < 1 + 1 := by linarith ++ _ = 2 := by ring_nf ++ ++ calc ++ 1 + (Real.log X)⁻¹ < 1 + (Real.log 3)⁻¹ := Z2 ++ _ < 2 := Z3 ++ ++ have inve : (pts_re - 1)⁻¹ = Real.log X := by ++ unfold pts_re ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, ++ Complex.norm_div, add_sub_cancel_left, inv_inv] ++ ++ have K_bounds_zeta_at_any_t : ∀(t : ℝ), ‖ζ' (pts t) / ζ (pts t)‖ ≤ K * Real.log X := by ++ intro t ++ rw [←inve] ++ exact K_bounds_zeta_at_any_t' t pts_re pts_re_ge_one pts_re_le_one ++ ++ have pts_re_pos : pts_re > 0 := by ++ unfold pts_re ++ positivity ++ ++ have triv_pts_lo_bound : ∀(t : ℝ), pts_re ≤ (pts t).re := by ++ intro t ++ unfold pts_re ++ exact Eq.ge (pts_re_triv t) ++ ++ have triv_pts_up_bound : ∀(t : ℝ), (pts t).re ≤ 2 := by ++ intro t ++ unfold pts ++ refine EReal.coe_le_coe_iff.mp ?_ ++ · simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, ++ Complex.norm_div, le_refl, implies_true, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, ++ I_im, mul_one, sub_self, add_zero, EReal.coe_le_coe_iff] ++ exact le_of_lt pts_re_le_one ++ ++ have pts_re_ge_1 : pts_re > 1 := by ++ unfold pts_re ++ exact pts_re_ge_one ++ ++ have X_pos_triv : 0 < X := by positivity ++ ++ let f := fun (t : ℝ) ↦ SmoothedChebyshevIntegrand SmoothingF eps X (pts t) ++ ++ have G : ∀(t : ℝ), ‖f t‖ ≤ (K * M) * Real.log X * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by ++ ++ intro t ++ ++ let M_bounds_mellin_easy := fun (t : ℝ) ↦ M_bounds_mellin_hard pts_re pts_re_pos (pts t) (triv_pts_lo_bound t) (triv_pts_up_bound t) eps eps_pos eps_less_one ++ ++ let zeta_part := (fun (t : ℝ) ↦ -ζ' (pts t) / ζ (pts t)) ++ let mellin_part := (fun (t : ℝ) ↦ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF eps x)) (pts t)) ++ let X_part := (fun (t : ℝ) ↦ (↑X : ℂ) ^ (pts t)) ++ ++ let g := fun (t : ℝ) ↦ (zeta_part t) * (mellin_part t) * (X_part t) ++ ++ have X_part_eq : ∀(t : ℝ), ‖X_part t‖ = X^pts_re := by ++ intro t ++ have U := Complex.norm_cpow_eq_rpow_re_of_pos (X_pos_triv) (pts t) ++ rw [pts_re_triv t] at U ++ exact U ++ ++ have X_part_bound : ∀(t : ℝ), ‖X_part t‖ ≤ X^pts_re := by ++ intro t ++ rw [←X_part_eq] ++ ++ have mellin_bound : ∀(t : ℝ), ‖mellin_part t‖ ≤ M * (eps * ‖pts t‖ ^ 2)⁻¹ := by ++ intro t ++ exact M_bounds_mellin_easy t ++ ++ have X_part_and_mellin_bound : ∀(t : ℝ),‖mellin_part t * X_part t‖ ≤ M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by ++ intro t ++ exact norm_mul_le_of_le (mellin_bound t) (X_part_bound t) ++ ++ have T2 : ∀(t : ℝ), ‖zeta_part t‖ = ‖ζ' (pts t) / ζ (pts t)‖ := by ++ intro t ++ unfold zeta_part ++ simp only [Complex.norm_div, norm_neg] ++ ++ have zeta_bound : ∀(t : ℝ), ‖zeta_part t‖ ≤ K * Real.log X := by ++ intro t ++ unfold zeta_part ++ rw [T2] ++ exact K_bounds_zeta_at_any_t t ++ ++ have g_bound : ∀(t : ℝ), ‖zeta_part t * (mellin_part t * X_part t)‖ ≤ (K * Real.log X) * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) := by ++ intro t ++ exact norm_mul_le_of_le (zeta_bound t) (X_part_and_mellin_bound t) ++ ++ have T1 : f = g := by rfl ++ ++ have final_bound_pointwise : ‖f t‖ ≤ K * Real.log X * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) := by ++ rw [T1] ++ unfold g ++ rw [mul_assoc] ++ exact g_bound t ++ ++ have trivialize : K * Real.log X * (M * (eps * ‖pts t‖^2)⁻¹ * X^pts_re) = (K * M) * Real.log X * (eps * ‖pts t‖^2)⁻¹ * X^pts_re := by ++ ring_nf ++ ++ rw [trivialize] at final_bound_pointwise ++ exact final_bound_pointwise ++ ++ have σ₀_gt : 1 < pts_re := by exact pts_re_ge_1 ++ have σ₀_le_2 : pts_re ≤ 2 := by ++ unfold pts_re ++ ++ exact ++ Preorder.le_trans (1 + (Real.log X)⁻¹) (pts (SmoothingF (SmoothingF M))).re 2 ++ (triv_pts_lo_bound (SmoothingF (SmoothingF M))) (triv_pts_up_bound (SmoothingF (SmoothingF M))) ++ ++ have f_integrable := SmoothedChebyshevPull1_aux_integrable eps_pos eps_less_one X_large σ₀_gt σ₀_le_2 suppSmoothingF SmoothingFnonneg mass_one ContDiffSmoothingF ++ ++ have S : X^pts_re = rexp 1 * X := by ++ unfold pts_re ++ ++ calc ++ X ^ (1 + (Real.log X)⁻¹) = X * X ^ ((Real.log X)⁻¹) := by ++ refine rpow_one_add' ?_ ?_ ++ · positivity ++ · exact Ne.symm (ne_of_lt pts_re_pos) ++ _ = X * rexp 1 := by ++ refine (mul_right_inj' ?_).mpr ?_ ++ · exact Ne.symm (ne_of_lt X_pos_triv) ++ · refine rpow_inv_log X_pos_triv ?_ ++ · by_contra h ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, ++ Complex.norm_div, Nat.not_ofNat_lt_one] ++ _ = rexp 1 * X := by ring_nf ++ ++ have pts_re_neq_zero : pts_re ≠ 0 := by ++ by_contra h ++ rw [h] at pts_re_ge_1 ++ simp only [gt_iff_lt] at pts_re_ge_1 ++ norm_cast at pts_re_ge_1 ++ ++ have Z := ++ by ++ calc ++ ‖∫ (t : ℝ) in Iic (-T), f t‖ ≤ ∫ (t : ℝ) in Iic (-T), ‖f t‖ := MeasureTheory.norm_integral_le_integral_norm f ++ _ ≤ ∫ (t : ℝ) in Iic (-T), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re := by ++ refine integral_mono ?_ ?_ (fun t ↦ G t) ++ · refine Integrable.norm ?_ ++ · unfold f ++ exact MeasureTheory.Integrable.restrict f_integrable ++ · have equ : ∀(t : ℝ), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re = (K * M) * Real.log X * eps⁻¹ * X ^ pts_re * (‖pts t‖^2)⁻¹ := by ++ intro t; ring_nf ++ have fun_equ : (fun (t : ℝ) ↦ ((K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re)) = (fun (t : ℝ) ↦ ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re * (‖pts t‖^2)⁻¹)) := by ++ funext t ++ exact equ t ++ ++ rw [fun_equ] ++ have nonzero := ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re) ++ have simple_int : MeasureTheory.Integrable (fun (t : ℝ) ↦ (‖pts t‖^2)⁻¹) ++ := by ++ unfold pts ++ exact poisson_kernel_integrable pts_re (pts_re_neq_zero) ++ ++ have U := MeasureTheory.Integrable.const_mul simple_int ((K * M) * Real.log X * eps⁻¹ * X ^ pts_re) ++ refine MeasureTheory.Integrable.restrict ?_ ++ exact U ++ _ = (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * ∫ (t : ℝ) in Iic (-T), (‖pts t‖ ^ 2)⁻¹ := by ++ have simpli : ∀(t : ℝ), (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re = (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * (‖pts t‖^2)⁻¹ := ++ by intro t; ring_nf ++ have simpli_fun : (fun (t : ℝ) ↦ (K * M) * Real.log X * (eps * ‖pts t‖ ^ 2)⁻¹ * X ^ pts_re ) = (fun (t : ℝ) ↦ ((K * M) * Real.log X * X ^ pts_re * eps⁻¹ * (‖pts t‖^2)⁻¹)) := ++ by funext t; ring_nf ++ rw [simpli_fun] ++ exact MeasureTheory.integral_const_mul ((K * M) * Real.log X * X ^ pts_re * eps⁻¹) (fun (t : ℝ) ↦ (‖pts t‖^2)⁻¹) ++ _ ≤ (K * M) * Real.log X * X ^ pts_re * eps⁻¹ * T⁻¹ := by ++ have U := integral_evaluation (pts_re) T (T_large) ++ unfold pts ++ simp only [ge_iff_le] ++ have U2 : 0 ≤ (K * M) * Real.log X * X ^ pts_re * eps⁻¹ := by ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, mul_inv_rev, gt_iff_lt, ++ Complex.norm_div, le_refl, implies_true, inv_pos, mul_nonneg_iff_of_pos_right] ++ refine Left.mul_nonneg ?_ ?_ ++ · refine Left.mul_nonneg ?_ ?_ ++ · exact Left.mul_nonneg (by positivity) (by positivity) ++ · refine log_nonneg ?_ ++ · linarith ++ · refine Left.mul_nonneg ?_ ?_ ++ · exact exp_nonneg 1 ++ · exact le_of_lt X_pos_triv ++ have U1 := mul_le_mul_of_nonneg_left U U2 ++ ++ exact U1 ++ _ = (Real.exp 1 * K * M) * Real.log X * X * eps⁻¹ * T⁻¹ := by ++ rw [S] ++ ring_nf ++ _ = (Real.exp 1 * K * M) * X * Real.log X / (eps * T) := by ring_nf ++ ++ unfold I₁ ++ unfold f at Z ++ unfold pts at Z ++ have Z3 : (↑pts_re : ℂ) = 1 + (Real.log X)⁻¹ := by unfold pts_re; norm_cast ++ rw [Z3] at Z ++ rw [Complex.norm_mul (1 / (2 * ↑π * I)) _] ++ simp only [one_div, mul_inv_rev, inv_I, neg_mul, norm_neg, Complex.norm_mul, norm_I, norm_inv, ++ norm_real, norm_eq_abs, Complex.norm_ofNat, one_mul, ofReal_inv, ge_iff_le] ++ have Z2 : 0 ≤ |π|⁻¹ * 2⁻¹ := by positivity ++ simp only [ofReal_inv] at Z ++ simp only [ge_iff_le] ++ have Z4 := ++ mul_le_mul_of_nonneg_left Z Z2 ++ ring_nf ++ ring_nf at Z4 ++ exact Z4 ++ ++lemma I9I1 {SmoothingF : ℝ → ℝ} {ε X T : ℝ} (Xpos : 0 < X) : ++ I₉ SmoothingF ε X T = conj (I₁ SmoothingF ε X T) := by ++ unfold I₉ I₁ ++ simp only [map_mul, map_div₀, conj_I, conj_ofReal, conj_ofNat, map_one] ++ rw [neg_mul, mul_neg, ← neg_mul] ++ congr ++ · ring ++ · rw [← integral_conj, ← integral_comp_neg_Ioi, integral_Ici_eq_integral_Ioi] ++ apply setIntegral_congr_fun <| measurableSet_Ioi ++ intro t ht ++ simp only ++ rw[← smoothedChebyshevIntegrand_conj Xpos] ++ simp ++ ++theorem I9Bound ++ {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ (SmoothingFnonneg : ∀ x > 0, 0 ≤ SmoothingF x) ++ (mass_one : ∫ x in Ioi 0, SmoothingF x / x = 1) : ++ ∃ C > 0, ∀{ε : ℝ} (_ : 0 < ε) ++ (_ : ε < 1) ++ (X : ℝ) (_ : 3 < X) ++ {T : ℝ} (_ : 3 < T), ++ ‖I₉ SmoothingF ε X T‖ ≤ C * X * Real.log X / (ε * T) := by ++ obtain ⟨C, Cpos, bound⟩ := I1Bound suppSmoothingF ContDiffSmoothingF SmoothingFnonneg mass_one ++ refine ⟨C, Cpos, ?_⟩ ++ intro ε εpos ε_lt_one X X_gt T T_gt ++ specialize bound ε εpos ε_lt_one X X_gt T_gt ++ rwa [I9I1 (by linarith), norm_conj] ++ ++lemma one_add_inv_log {X : ℝ} (X_ge : 3 ≤ X): (1 + (Real.log X)⁻¹) < 2 := by ++ rw[← one_add_one_eq_two] ++ refine (add_lt_add_iff_left 1).mpr ?_ ++ refine inv_lt_one_of_one_lt₀ ?_ ++ refine (lt_log_iff_exp_lt ?_).mpr ?_ <;> linarith[Real.exp_one_lt_d9] ++ ++theorem log_pos (T : ℝ) (T_gt : 3 < T) : (Real.log T > 1) := by ++ have elt3 : Real.exp 1 < 3 := by ++ linarith[Real.exp_one_lt_d9] ++ have logTgt1 : Real.log T > 1 := by ++ refine (lt_log_iff_exp_lt ?_).mpr ?_ ++ · linarith ++ · linarith ++ exact logTgt1 ++ ++lemma I2Bound {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ {A C₂ : ℝ} (has_bound: LogDerivZetaHasBound A C₂) (C₂pos : 0 < C₂) (A_in : A ∈ Ioc 0 (1 / 2)) : ++ ∃ (C : ℝ) (_ : 0 < C), ++ ∀(X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) ++ (_ : ε < 1) {T : ℝ} (_ : 3 < T), ++ let σ₁ := sigma1Of A T ++ ‖I₂ SmoothingF ε T X σ₁‖ ≤ C * X / (ε * T) := by ++ have ⟨C₁, C₁pos, Mbd⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF ++ have := (IBound_aux1 3 (by norm_num) 9) ++ obtain ⟨C₃, ⟨C₃_gt, hC₃⟩⟩ := this ++ ++ let C' : ℝ := C₁ * C₂ * C₃ * rexp 1 ++ have : C' > 0 := by positivity ++ use ‖1/(2*π*I)‖ * (2 * C'), by ++ refine Right.mul_pos ?_ ?_ ++ · rw[norm_pos_iff] ++ simp[pi_ne_zero] ++ · simp[this] ++ intro X X_gt ε ε_pos ε_lt_one T T_gt σ₁ ++ ++ have Xpos : 0 < X := lt_trans (by simp only [Nat.ofNat_pos]) X_gt ++ have Tpos : 0 < T := lt_trans (by norm_num) T_gt ++ have log_big : 1 < Real.log T := by exact log_pos T (T_gt) ++ unfold I₂ ++ rw[norm_mul, mul_assoc (c := X), ← mul_div] ++ refine mul_le_mul_of_nonneg_left ?_ (norm_nonneg _) ++ have interval_length_nonneg : σ₁ ≤ 1 + (Real.log X)⁻¹ := by ++ have : σ₁ = sigma1Of A T := rfl ++ rw [this] ++ unfold sigma1Of ++ rw[sub_le_iff_le_add] ++ nth_rw 1 [← add_zero 1] ++ rw[add_assoc] ++ apply add_le_add_right ++ refine Left.add_nonneg ?_ ?_ ++ · rw[inv_nonneg, log_nonneg_iff Xpos] ++ exact le_trans (by norm_num) (le_of_lt X_gt) ++ · refine div_nonneg ?_ ?_ ++ exact A_in.1.le ++ rw[log_nonneg_iff Tpos] ++ exact le_trans (by norm_num) (le_of_lt T_gt) ++ have : σ₁ = sigma1Of A T := rfl ++ have σ₁pos : 0 < σ₁ := by ++ have : σ₁ = sigma1Of A T := rfl ++ rw [this] ++ unfold sigma1Of ++ rw[sub_pos] ++ calc ++ A / Real.log T ≤ 1 / 2 / Real.log T := by ++ refine div_le_div_of_nonneg_right (A_in.2) ?_ ++ apply le_of_lt ++ linarith ++ ++ _ ≤ 1 / 2 / 1 := by ++ refine div_le_div_of_nonneg_left (by norm_num) (by norm_num) ?_ ++ apply le_of_lt ++ refine (lt_log_iff_exp_lt ?_).mpr ?_ <;> linarith[Real.exp_one_lt_d9] ++ _ < 1 := by norm_num ++ suffices ∀ σ ∈ Ioc σ₁ (1 + (Real.log X)⁻¹), ‖SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I)‖ ≤ C' * X / (ε * T) by ++ calc ++ ‖∫ (σ : ℝ) in σ₁..1 + (Real.log X)⁻¹, ++ SmoothedChebyshevIntegrand SmoothingF ε X (↑σ - ↑T * I)‖ ≤ ++ C' * X / (ε * T) * |1 + (Real.log X)⁻¹ - σ₁| := by ++ refine intervalIntegral.norm_integral_le_of_norm_le_const ?_ ++ convert this using 3 ++ apply uIoc_of_le ++ exact interval_length_nonneg ++ _ ≤ C' * X / (ε * T) * 2 := by ++ apply mul_le_mul_of_nonneg_left ++ rw[abs_of_nonneg (sub_nonneg.mpr interval_length_nonneg)] ++ calc ++ 1 + (Real.log X)⁻¹ - σ₁ ≤ 1 + (Real.log X)⁻¹ := by linarith ++ _ ≤ 2 := (one_add_inv_log X_gt.le).le ++ positivity ++ _ = 2 * C' * X / (ε * T) := by ring ++ ++ intro σ hσ ++ unfold SmoothedChebyshevIntegrand ++ have log_deriv_zeta_bound : ‖ζ' (σ - T * I) / ζ (σ - T * I)‖ ≤ C₂ * (C₃ * T) := by ++ calc ++ ‖ζ' (σ - (T : ℝ) * I) / ζ (σ - (T : ℝ) * I)‖ = ‖ζ' (σ + (-T : ℝ) * I) / ζ (σ + (-T : ℝ) * I)‖ := by ++ have Z : σ - (T : ℝ) * I = σ + (- T : ℝ) * I := by simp; ring_nf ++ simp [Z] ++ _ ≤ C₂ * Real.log |-T| ^ 9 := has_bound σ (-T) (by simp; rw [abs_of_pos Tpos]; exact T_gt) (by rw[this] at hσ; unfold sigma1Of at hσ; simp at hσ ⊢; replace hσ := hσ.1; linarith) ++ _ ≤ C₂ * Real.log T ^ 9 := by simp ++ _ ≤ C₂ * (C₃ * T) := by gcongr; exact hC₃ T (by linarith) ++ ++ calc ++ ‖-ζ' (σ - T * I) / ζ (σ - T * I) * 𝓜 (fun x ↦ (Smooth1 SmoothingF ε x)) ++ (σ - T * I) * X ^ (σ - T * I)‖ = ++ ‖-ζ' (σ - T * I) / ζ (σ - T * I)‖ * ‖𝓜 (fun x ↦ (Smooth1 SmoothingF ε x)) ++ (σ - T * I)‖ * ‖(X : ℂ) ^ (σ - T * I)‖ := by ++ repeat rw[norm_mul] ++ _ ≤ C₂ * (C₃ * T) * (C₁ * (ε * ‖σ - T * I‖ ^ 2)⁻¹) * (rexp 1 * X) := by ++ apply mul_le_mul₃ ++ · rw[neg_div, norm_neg] ++ exact log_deriv_zeta_bound ++ · refine Mbd σ₁ σ₁pos _ ?_ ?_ ε ε_pos ε_lt_one ++ · simp only [mem_Ioc, sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, ++ sub_self, sub_zero] at hσ ⊢ ++ linarith ++ · simp only [mem_Ioc, sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, ++ sub_self, sub_zero] at hσ ⊢ ++ linarith[one_add_inv_log X_gt.le] ++ · rw[cpow_def_of_ne_zero] ++ · rw[norm_exp,← ofReal_log, re_ofReal_mul] ++ simp only [sub_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, ++ sub_zero] ++ rw[← le_log_iff_exp_le, Real.log_mul (exp_ne_zero 1), Real.log_exp, ← le_div_iff₀', add_comm, add_div, div_self, one_div] ++ exact hσ.2 ++ · refine (Real.log_pos ?_).ne.symm ++ linarith ++ · apply Real.log_pos ++ linarith ++ · linarith ++ · positivity ++ · positivity ++ · exact_mod_cast Xpos.ne.symm ++ · positivity ++ · positivity ++ · positivity ++ _ = (C' * X * T) / (ε * ‖σ - T * I‖ ^ 2) := by ring ++ _ ≤ C' * X / (ε * T) := by ++ have : ‖σ - T * I‖ ^ 2 ≥ T ^ 2 := by ++ calc ++ ‖σ - T * I‖ ^ 2 = ‖σ + (-T : ℝ) * I‖ ^ 2 := by ++ congr 2 ++ push_cast ++ ring ++ _ = normSq (σ + (-T : ℝ) * I) := (normSq_eq_norm_sq _).symm ++ _ = σ^2 + (-T)^2 := by ++ rw[Complex.normSq_add_mul_I] ++ _ ≥ T^2 := by ++ rw[neg_sq] ++ exact le_add_of_nonneg_left (sq_nonneg _) ++ calc ++ C' * X * T / (ε * ‖↑σ - ↑T * I‖ ^ 2) ≤ C' * X * T / (ε * T ^ 2) := by ++ rw[div_le_div_iff_of_pos_left, mul_le_mul_iff_right₀] ++ exact this ++ exact ε_pos ++ positivity ++ apply mul_pos ε_pos ++ exact lt_of_lt_of_le (pow_pos Tpos 2) this ++ positivity ++ _ = C' * X / (ε * T) := by ++ field_simp ++ ++lemma I8I2 {SmoothingF : ℝ → ℝ} ++ {X ε T σ₁ : ℝ} (T_gt : 3 < T) : ++ I₈ SmoothingF ε X T σ₁ = -conj (I₂ SmoothingF ε X T σ₁) := by ++ unfold I₂ I₈ ++ rw[map_mul, ← neg_mul] ++ congr ++ · simp[conj_ofNat] ++ · rw[← intervalIntegral_conj] ++ apply intervalIntegral.integral_congr ++ intro σ hσ ++ simp only [] ++ rw[← smoothedChebyshevIntegrand_conj] ++ simp only [map_sub, conj_ofReal, map_mul, conj_I, mul_neg, sub_neg_eq_add] ++ exact lt_trans (by norm_num) T_gt ++ ++lemma I8Bound {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ {A C₂ : ℝ} (has_bound : LogDerivZetaHasBound A C₂) (C₂_pos : 0 < C₂) (A_in : A ∈ Ioc 0 (1 / 2)) : ++ ++ ∃ (C : ℝ) (_ : 0 < C), ++ ∀(X : ℝ) (_ : 3 < X) {ε : ℝ} (_: 0 < ε) ++ (_ : ε < 1) ++ {T : ℝ} (_ : 3 < T), ++ let σ₁ : ℝ := 1 - A / (Real.log T) ++ ‖I₈ SmoothingF ε T X σ₁‖ ≤ C * X / (ε * T) := by ++ ++ obtain ⟨C, hC, i2Bound⟩ := I2Bound suppSmoothingF ContDiffSmoothingF has_bound C₂_pos A_in ++ use C, hC ++ intro X hX ε hε0 hε1 T hT σ₁ ++ let i2Bound := i2Bound X hX hε0 hε1 hT ++ rw[I8I2 hX, norm_neg, norm_conj] ++ ++ change ‖I₂ SmoothingF ε T X (sigma1Of A T)‖ ≤ C * X / (ε * T) at i2Bound ++ unfold sigma1Of at i2Bound ++ have σ₁_eq : σ₁ = 1 - A / (Real.log T) := rfl ++ rw[σ₁_eq] ++ exact i2Bound ++ ++lemma log_pow_over_xsq_integral_bounded : ++ ∀ n : ℕ, ∃ C : ℝ, 0 < C ∧ ∀ T >3, ∫ x in Ioo 3 T, (Real.log x)^n / x^2 < C := by ++ have elt3 : Real.exp 1 < 3 := by ++ linarith[Real.exp_one_lt_d9] ++ have log3gt1: 1 < Real.log 3 := by ++ apply (Real.lt_log_iff_exp_lt (by norm_num)).mpr ++ exact elt3 ++ intro n ++ induction n with ++ | zero => ++ use 1 ++ constructor ++ · norm_num ++ · intro T hT ++ have Tgt3 : (3 : ℝ) < T := hT ++ simp only [pow_zero] ++ have h1 :(0 ≤ (-2) ∨ (-2) ≠ (-1) ∧ 0 ∉ Set.uIcc 3 T) := by ++ right ++ constructor ++ · linarith ++ · refine notMem_uIcc_of_lt ?_ ?_ ++ · exact three_pos ++ · linarith ++ have integral := integral_zpow h1 ++ ring_nf at integral ++ ++ have swap_int_kind : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), 1 / x ^ 2 = ∫ (x : ℝ) in Ioo 3 T, 1 / x ^ 2 := by ++ rw [intervalIntegral.integral_of_le (by linarith)] ++ exact MeasureTheory.integral_Ioc_eq_integral_Ioo ++ rw [← swap_int_kind] ++ have change_int_power : ∫ (x : ℝ) in (3 : ℝ)..T, (1 : ℝ) / x ^ (↑ 2) ++ = ∫ (x : ℝ) in (3 : ℝ).. T, x ^ (-2 : ℤ) := by ++ apply intervalIntegral.integral_congr ++ intro x hx ++ simp ++ rw [change_int_power, integral] ++ have : T ^ (-1 : ℤ) > 0 := by ++ refine zpow_pos ?_ (-1) ++ linarith ++ linarith ++ | succ d ih => ++ obtain ⟨Cd, Cdpos, IH⟩ := ih ++ use ((Real.log 3)^(d+1) / 3) + (d+1) * Cd ++ constructor ++ · have logpowpos : (Real.log 3) ^ (d + 1) > 0 := by ++ refine pow_pos ?_ (d + 1) ++ linarith ++ have : 0 < (Real.log 3) ^ (d + 1) / 3 := by ++ exact div_pos logpowpos (by norm_num) ++ have dbound : d + 1 ≥ 1 := by ++ exact Nat.le_add_left 1 d ++ have : Real.log 3 ^ (d + 1) / 3 + (↑d + 1) * Cd > 0 / 3 + 0 := by ++ have term1_pos : 0 < Real.log 3 ^ (d + 1) / 3 := this ++ have term2_pos : 0 < (↑d + 1) * Cd := by ++ refine (mul_pos_iff_of_pos_right Cdpos).mpr ?_ ++ exact Nat.cast_add_one_pos d ++ refine add_lt_add ?_ term2_pos ++ refine div_lt_div₀ logpowpos ?_ ?_ ?_ ++ linarith ++ linarith ++ linarith ++ ring_nf at this ++ ring_nf ++ exact this ++ · intro T Tgt3 ++ let u := fun x : ℝ ↦ (Real.log x) ^ (d + 1) ++ let v := fun x : ℝ ↦ -1 / x ++ let u' := fun x : ℝ ↦ (d + 1 : ℝ) * (Real.log x)^d / x ++ let v' := fun x : ℝ ↦ 1 / x^2 ++ ++ have swap_int_type : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) / x ^ 2 ++ = ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ (d + 1) / x ^ 2 := by ++ rw [intervalIntegral.integral_of_le (by linarith)] ++ exact MeasureTheory.integral_Ioc_eq_integral_Ioo ++ ++ rw [← swap_int_type] ++ ++ have uIcc_is_Icc : Set.uIcc 3 T = Set.Icc 3 T := by ++ exact uIcc_of_lt Tgt3 ++ ++ have cont_u : ContinuousOn u (Set.uIcc 3 T) := by ++ unfold u ++ rw[uIcc_is_Icc] ++ refine ContinuousOn.pow ?_ (d + 1) ++ refine continuousOn_of_forall_continuousAt ?_ ++ intro x hx ++ refine continuousAt_log ?_ ++ linarith [hx.1] ++ ++ have cont_v : ContinuousOn v (Set.uIcc 3 T) := by ++ unfold v ++ rw[uIcc_is_Icc] ++ refine continuousOn_of_forall_continuousAt ?_ ++ intro x hx ++ have cont1 : ContinuousAt (fun (x : ℝ) ↦ 1 / x) x := by ++ refine ContinuousAt.div₀ ?_ (fun ⦃U⦄ a ↦ a) ?_ ++ · exact continuousAt_const ++ · linarith [hx.1] ++ have cont2 : ContinuousAt (fun (x : ℝ) ↦ 1 / x) (-x) := by ++ refine ContinuousAt.div₀ ?_ (fun ⦃U⦄ a ↦ a) ?_ ++ · exact continuousAt_const ++ · linarith [hx.1] ++ have fun1 : (fun (x : ℝ) ↦ -1 / x) = (fun (x : ℝ) ↦ 1 / (-x)) := by ++ ext x ++ ring_nf ++ rw [fun1] ++ exact ContinuousAt.comp cont2 (HasDerivAt.neg (hasDerivAt_id x)).continuousAt ++ ++ have deriv_u : (∀ x ∈ Set.Ioo (3 ⊓ T) (3 ⊔ T), HasDerivAt u (u' x) x) := by ++ intro x hx ++ have min3t : min 3 T = 3 := by ++ exact min_eq_left_of_lt Tgt3 ++ have max3t : max 3 T = T := by ++ exact max_eq_right_of_lt Tgt3 ++ rw[min3t, max3t] at hx ++ unfold u u' ++ have xne0 : x ≠ 0 := by linarith [hx.1] ++ have deriv1 := Real.deriv_log x ++ have deriv2 := (Real.hasDerivAt_log xne0).pow (d + 1) ++ have fun1 : (fun x ↦ (↑d + 1) * Real.log x ^ d / x) = (fun x ↦ (↑d + 1) * Real.log x ^ d * x⁻¹) := by ++ exact rfl ++ have fun2 : (↑d + 1) * Real.log x ^ d / x = (↑d + 1) * Real.log x ^ d * x⁻¹:= by ++ exact rfl ++ rw [fun2] ++ simpa [Nat.cast_add, Nat.cast_one] using! deriv2 ++ ++ have deriv_v : (∀ x ∈ Set.Ioo (3 ⊓ T) (3 ⊔ T), HasDerivAt v (v' x) x) := by ++ intro x hx ++ have min3t : min 3 T = 3 := by ++ exact min_eq_left_of_lt Tgt3 ++ have max3t : max 3 T = T := by ++ exact max_eq_right_of_lt Tgt3 ++ rw[min3t, max3t] at hx ++ have xne0 : x ≠ 0 := by linarith [hx.1] ++ unfold v v' ++ have deriv1 := hasDerivAt_inv xne0 ++ have fun1 : (fun (x : ℝ) ↦ x⁻¹) = (fun (x : ℝ) ↦ 1 / x) := by ++ ext x ++ exact inv_eq_one_div x ++ rw [fun1] at deriv1 ++ have fun2 : -(x ^ 2)⁻¹ = - 1 / x ^ 2 := by ++ field_simp ++ rw [fun2] at deriv1 ++ simpa [neg_div, neg_neg] using! HasDerivAt.neg deriv1 ++ ++ have cont_u' : ContinuousOn u' (Set.uIcc 3 T) := by ++ rw[uIcc_is_Icc] ++ unfold u' ++ refine ContinuousOn.div₀ ?_ ?_ ?_ ++ · refine ContinuousOn.mul ?_ ?_ ++ · exact continuousOn_const ++ · refine ContinuousOn.pow ?_ d ++ refine continuousOn_of_forall_continuousAt ?_ ++ intro x hx ++ refine continuousAt_log ?_ ++ linarith [hx.1] ++ · exact continuousOn_id' (Icc 3 T) ++ · intro x hx ++ linarith [hx.1] ++ ++ have cont_v' : ContinuousOn v' (Set.uIcc 3 T) := by ++ rw[uIcc_is_Icc] ++ unfold v' ++ refine ContinuousOn.div₀ ?_ ?_ ?_ ++ · exact continuousOn_const ++ · exact continuousOn_pow 2 ++ · intro x hx ++ refine pow_ne_zero 2 ?_ ++ linarith [hx.1] ++ ++ have int_u': IntervalIntegrable u' MeasureTheory.volume 3 T := by ++ exact ContinuousOn.intervalIntegrable cont_u' ++ ++ have int_v': IntervalIntegrable v' MeasureTheory.volume 3 T := by ++ exact ContinuousOn.intervalIntegrable cont_v' ++ ++ have IBP := intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt cont_u cont_v deriv_u deriv_v int_u' int_v' ++ ++ unfold u u' v v' at IBP ++ ++ have int1 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) * (1 / x ^ 2) ++ = ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ (d + 1) / x ^ 2 := by ++ refine intervalIntegral.integral_congr ?_ ++ intro x hx ++ field_simp ++ ++ rw[int1] at IBP ++ rw[IBP] ++ ++ have int2 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), (↑d + 1) * Real.log x ^ d / x * (-1 / x) ++ = -(↑d + 1) * ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ d / x ^ 2 := by ++ have : ∀ x, (↑d + 1) * Real.log x ^ d / x * (-1 / x) ++ = -((↑d + 1) * Real.log x ^ d / x ^ 2) := by ++ intro x ++ field_simp ++ have : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), (↑d + 1) * Real.log x ^ d / x * (-1 / x) ++ = ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), -((↑d + 1) * Real.log x ^ d / x ^ 2) := by ++ exact intervalIntegral.integral_congr fun ⦃x⦄ a ↦ this x ++ rw [this] ++ rw [←intervalIntegral.integral_const_mul] ++ ring_nf ++ ++ rw[int2] ++ ++ have int3 : ∫ (x : ℝ) in (3 : ℝ)..(T : ℝ), Real.log x ^ d / x ^ 2 ++ = ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d / x ^ 2 := by ++ rw [intervalIntegral.integral_of_le (by linarith)] ++ exact MeasureTheory.integral_Ioc_eq_integral_Ioo ++ ++ rw[int3] ++ ++ have IHbound : ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d / x ^ 2 < Cd := by ++ exact IH T Tgt3 ++ ++ ring_nf ++ have bound2 : (Real.log T * Real.log T ^ d * T⁻¹) ≥ 0 := by ++ have logTpos : Real.log T ≥ 0 := by ++ refine log_nonneg ?_ ++ linarith ++ apply mul_nonneg ++ · apply mul_nonneg ++ · exact logTpos ++ · exact pow_nonneg logTpos d ++ · positivity ++ ++ have bound3 : -(Real.log T * Real.log T ^ d * T⁻¹) ≤ 0 := by ++ exact Right.neg_nonpos_iff.mpr bound2 ++ let S := Real.log T * Real.log T ^ d * T⁻¹ ++ have Spos : S ≥ 0 := by ++ unfold S ++ exact bound2 ++ ++ have : (-(Real.log T * Real.log T ^ d * T⁻¹) + Real.log 3 * Real.log 3 ^ d * (1 / 3) + ++ ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) + ++ ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 = (-S + Real.log 3 * Real.log 3 ^ d * (1 / 3) + ++ ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) + ++ ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 := by ++ unfold S ++ rfl ++ rw [this] ++ ++ have GetRidOfS : (-S + Real.log 3 * Real.log 3 ^ d * (1 / 3) ++ + ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) ++ + ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 ++ ≤ ( Real.log 3 * Real.log 3 ^ d * (1 / 3) ++ + ↑d * ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2) ++ + ∫ (x : ℝ) in Ioo 3 T, Real.log x ^ d * x⁻¹ ^ 2 := by ++ linarith [Spos] ++ apply lt_of_le_of_lt GetRidOfS ++ rw [add_assoc] ++ ++ have bound4 : ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 < Cd := IHbound ++ ++ have bound5 : ↑d * ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 ≤ ↑d * Cd := by ++ apply (mul_le_mul_of_nonneg_left bound4.le) ++ exact Nat.cast_nonneg d ++ ++ have bound_sum : ↑d * (∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2) ++ + ∫ x in Ioo 3 T, Real.log x ^ d / x ^ 2 < ↑d * Cd + Cd := by ++ linarith [bound4, bound5] ++ rw[add_assoc] ++ apply add_lt_add_right ++ field_simp ++ linarith [bound_sum] ++ ++theorem I3Bound {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ {A Cζ : ℝ} (hCζ : LogDerivZetaHasBound A Cζ) (Cζpos : 0 < Cζ) (hA : A ∈ Ioc 0 (1 / 2)) : ++ ∃ (C : ℝ) (_ : 0 < C), ++ ∀ (X : ℝ) (_ : 3 < X) ++ {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) ++ {T : ℝ} (_ : 3 < T), ++ ++ let σ₁ : ℝ := 1 - A / (Real.log T) ++ ‖I₃ SmoothingF ε T X σ₁‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by ++ ++ obtain ⟨CM, CMpos, CMhyp⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF ++ obtain ⟨Cint, Cintpos, Cinthyp⟩ := log_pow_over_xsq_integral_bounded 9 ++ use Cint * CM * Cζ ++ have : Cint * CM > 0 := mul_pos Cintpos CMpos ++ have : Cint * CM * Cζ > 0 := mul_pos this Cζpos ++ use this ++ intro X Xgt3 ε εgt0 εlt1 T Tgt3 σ₁ ++ unfold I₃ ++ unfold SmoothedChebyshevIntegrand ++ ++ have elt3 : Real.exp 1 < 3 := by ++ linarith[Real.exp_one_lt_d9] ++ ++ have log3gt1: 1 < Real.log 3 := by ++ apply (Real.lt_log_iff_exp_lt (by norm_num)).mpr ++ exact elt3 ++ ++ have logXgt1 : Real.log X > 1 := by ++ refine (lt_log_iff_exp_lt ?_).mpr ?_ ++ linarith ++ linarith ++ ++ have logTgt1 : Real.log T > 1 := by ++ refine (lt_log_iff_exp_lt ?_).mpr ?_ ++ linarith ++ linarith ++ ++ have logX9gt1 : Real.log X ^ 1 > 1 := by ++ refine (one_lt_pow_iff_of_nonneg ?_ ?_).mpr logXgt1 ++ linarith ++ linarith ++ ++ have logT9gt1 : Real.log T ^ 1 > 1 := by ++ refine (one_lt_pow_iff_of_nonneg ?_ ?_).mpr logTgt1 ++ linarith ++ linarith ++ ++ have t_bounds : ∀ t ∈ Ioo (-T) (-3), 3 < |t| ∧ |t| < T := by ++ intro t ht ++ obtain ⟨h1,h2⟩ := ht ++ have : |t| = -t := by ++ refine abs_of_neg ?_ ++ linarith[h2] ++ have abs_tgt3 : 3 < |t| := by ++ rw[this] ++ linarith[h2] ++ have abs_tltX : |t| < T := by ++ rw[this] ++ linarith[h1] ++ exact ⟨abs_tgt3, abs_tltX⟩ ++ ++ have logtgt1_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| > 1 := by ++ intro t ht ++ obtain ⟨h1,h2⟩ := ht ++ refine logt_gt_one ?_ ++ exact h1.le ++ ++ have logt9gt1_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 > 1 := by ++ intro t ht ++ refine one_lt_pow₀ (logtgt1_bounds t ht) ?_ ++ linarith ++ ++ have logtltlogT_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| < Real.log T := by ++ intro t ht ++ obtain ⟨h1,h2⟩ := ht ++ have m := log_lt_log (by linarith : 0 < (|t|)) (h2 : |t| < T ) ++ exact m ++ ++ have logt9ltlogT9_bounds : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 < Real.log T ^ 9 := by ++ intro t ht ++ obtain h1 := logtltlogT_bounds t ht ++ obtain h2 := logtgt1_bounds t ht ++ have h3: 0 ≤ Real.log |t| := by linarith ++ refine (pow_lt_pow_iff_left₀ ?_ ?_ ?_).mpr h1 ++ linarith ++ linarith ++ linarith ++ ++ have Aoverlogt9gtAoverlogT9_bounds : ∀ t, 3 < |t| ∧ |t| < T → ++ A / Real.log |t| ^ 9 > A / Real.log T ^ 9 := by ++ intro t ht ++ have h1 := logt9ltlogT9_bounds t ht ++ have h2 :=logt9gt1_bounds t ht ++ refine div_lt_div_of_pos_left ?_ ?_ h1 ++ linarith [hA.1] ++ linarith ++ ++ have AoverlogT9in0half: A / Real.log T ^ 1 ∈ Ioo 0 (1/2) := by ++ constructor ++ · refine div_pos ?_ ?_ ++ refine EReal.coe_pos.mp ?_ ++ exact EReal.coe_lt_coe hA.1 ++ linarith ++ · refine (div_lt_comm₀ ?_ ?_).mpr ?_ ++ linarith ++ linarith ++ refine (div_lt_iff₀' ?_).mpr ?_ ++ linarith ++ have hA_lt : A ≤ 1 / 2 := hA.2 ++ have hbound : 1 / 2 < (1 / 2) * Real.log T ^ 1 := by ++ linarith ++ linarith ++ ++ have σ₁lt2 : (σ₁ : ℝ) < 2 := by ++ unfold σ₁ ++ calc 1 - A / Real.log T ++ < 1 - 0 := by simp only [sub_zero]; exact sub_lt_self 1 (div_pos hA.1 (lt_trans zero_lt_one logTgt1)) ++ _ = 1 := by norm_num ++ _ < 2 := by norm_num ++ ++ have σ₁lt1 : σ₁ < 1 := by ++ unfold σ₁ ++ calc 1 - A / Real.log T ++ < 1 - 0 := by simp only [sub_zero]; exact sub_lt_self 1 (div_pos hA.1 (by linarith [logTgt1])) ++ _ = 1 := by norm_num ++ ++ have σ₁pos : 0 < σ₁ := by ++ unfold σ₁ ++ rw [sub_pos] ++ calc ++ A / Real.log T ≤ (1/2) / Real.log T := by ++ apply div_le_div_of_nonneg_right hA.2 (by linarith) ++ _ ≤ (1/2) / 1 := by ++ apply div_le_div_of_nonneg_left (by norm_num) (by norm_num) (by linarith) ++ _ = 1/2 := by norm_num ++ _ < 1 := by norm_num ++ ++ have quotient_bound : ∀ t, 3 < |t| ∧ |t| < T → Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) ≤ Real.log |t| ^ 9/ t ^ 2 := by ++ intro t ht ++ have loght := logt9gt1_bounds t ht ++ have logpos : Real.log |t| ^ 9 > 0 := by linarith ++ have denom_le : t ^ 2 ≤ σ₁ ^ 2 + t ^ 2 := by linarith [sq_nonneg σ₁] ++ have denom_pos : 0 < t ^ 2 := by ++ have : t ^ 2 = |t| ^ 2 := by ++ exact Eq.symm (sq_abs t) ++ rw [this] ++ have h1 := ht.1 ++ have abspos : |t| > 0 := by linarith ++ exact sq_pos_of_pos abspos ++ have denom2_pos : 0 < σ₁ ^ 2 + t ^ 2 := by linarith [sq_nonneg σ₁] ++ exact (div_le_div_iff_of_pos_left logpos denom2_pos denom_pos).mpr denom_le ++ ++ have boundthing : ∀ t, 3 < |t| ∧ |t| < T → σ₁ ∈ Ici (1 - A / Real.log |t|) := by ++ intro t ht ++ have h1 := Aoverlogt9gtAoverlogT9_bounds t ht ++ unfold σ₁ ++ apply mem_Ici.mpr ++ ring_nf ++ ++ apply sub_le_sub_left ++ have : Real.log |t| ≤ Real.log T := by ++ apply Real.log_le_log (by linarith) (le_of_lt ht.2) ++ exact div_le_div_of_nonneg_left (le_of_lt hA.1) (Real.log_pos (by linarith)) this ++ ++ have : ∫ (t : ℝ) in -T..-3, ++ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * ++ ↑X ^ (↑σ₁ + ↑t * I) = ∫ (t : ℝ) in Ioo (-T : ℝ) (-3 : ℝ), ++ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * ++ ↑X ^ (↑σ₁ + ↑t * I) := by ++ rw [intervalIntegral.integral_of_le (by linarith)] ++ exact MeasureTheory.integral_Ioc_eq_integral_Ioo ++ rw[this] ++ ++ have MellinBound : ∀ (t : ℝ) , ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ₁ + t * I)‖ ≤ CM * (ε * ‖(σ₁ + t * I)‖ ^ 2)⁻¹ := by ++ intro t ++ apply CMhyp σ₁ ++ exact σ₁pos ++ · simp only [add_re, mul_re, ofReal_re, ofReal_im, I_re, I_im, mul_zero, zero_mul, sub_zero, add_zero] ++ exact le_rfl ++ · simpa only [add_re, mul_re, ofReal_re, ofReal_im, I_re, I_im, mul_zero, zero_mul, sub_zero, add_zero] using σ₁lt2.le ++ exact εgt0 ++ exact εlt1 ++ ++ have logzetabnd : ∀ t : ℝ, 3 < |t| ∧ |t| < T → ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ ≤ Cζ * Real.log (|t| : ℝ) ^ 9 := by ++ intro t tbounds ++ obtain ⟨tgt3, tltT⟩ := tbounds ++ apply hCζ ++ · exact tgt3 ++ · apply boundthing ++ constructor ++ · exact tgt3 ++ · exact tltT ++ ++ have Mellin_bd : ∀ t, 3 < |t| ∧ |t| < T → ++ ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (σ₁ + t * I)‖ ≤ CM * (ε * ‖σ₁ + t * I‖ ^ 2)⁻¹ := by ++ intro t ht ++ apply MellinBound ++ ++ have logzeta_bd : ∀ t, 3 < |t| ∧ |t| < T → ++ ‖ζ' (σ₁ + t * I) / ζ (σ₁ + t * I)‖ ≤ Cζ * Real.log |t| ^ 9 := by ++ intro t t_bounds ++ obtain ⟨abs_tgt3,abs_tltX⟩ := t_bounds ++ apply logzetabnd ++ constructor ++ · exact abs_tgt3 ++ · exact abs_tltX ++ have : ‖1 / (2 * ↑π * I) * ++ (I * ∫ (t : ℝ) in -X..-3, ++ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * ++ ↑T ^ (↑σ₁ + ↑t * I))‖ ++ = ++ (1 / (2 * π)) * ‖∫ (t : ℝ) in -X..-3, ++ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * ++ ↑T ^ (↑σ₁ + ↑t * I)‖ := by ++ simp only [norm_mul] ++ rw[Complex.norm_I] ++ simp only [one_mul] ++ have : ‖1 / (2 * ↑π * I)‖ = 1 / (2 * π) := by ++ ++ ring_nf ++ simp only [norm_mul] ++ rw[inv_I] ++ have : ‖-I‖ = ‖-1 * I‖ := by ++ simp ++ rw[this] ++ have : ‖-1 * I‖ = ‖-1‖ * ‖I‖ := by ++ simp ++ rw[this, Complex.norm_I] ++ ring_nf ++ simp ++ rw[this] ++ ++ let f t := (-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * ++ ↑X ^ (↑σ₁ + ↑t * I) ++ ++ let g t := Cζ * CM * Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) * X ^ σ₁ ++ ++ have norm_X_sigma1: ∀ (t : ℝ), ‖↑(X : ℂ) ^ (↑σ₁ + ↑t * I)‖ = X ^ σ₁ := by ++ intro t ++ have Xpos : 0 < X := by linarith ++ have : ((↑σ₁ + ↑t * I).re) = σ₁ := by ++ simp ++ ++ nth_rw 2[← this] ++ apply Complex.norm_cpow_eq_rpow_re_of_pos Xpos ++ ++ have bound_integral : ∀ (t : ℝ), 3 < |t| ∧ |t| < T → ‖f t‖ ≤ g t := by ++ intro t ++ rintro ⟨ht_gt3, ht_ltT⟩ ++ have Xσ_bound : ‖↑(X : ℂ) ^ (↑σ₁ + ↑t * I)‖ = X ^ σ₁ := norm_X_sigma1 t ++ have logtgt1 : 1 < Real.log |t| := by ++ exact logt_gt_one ht_gt3.le ++ have hζ := logzetabnd t ⟨ht_gt3, ht_ltT⟩ ++ have h𝓜 := MellinBound t ++ have : ‖f ↑t‖ = ‖(-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * ++ ↑X ^ (↑σ₁ + ↑t * I)‖ := by ++ rfl ++ rw[this] ++ have : ‖(-ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)) * ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * ++ ↑X ^ (↑σ₁ + ↑t * I)‖ ≤ ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ * ++ ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I)‖ * ++ ‖(↑(X : ℝ) : ℂ) ^ (↑σ₁ + ↑t * I)‖ := by ++ simp [norm_neg] ++ ++ have : ‖ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I)‖ * ++ ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I)‖ * ++ ‖(↑X : ℂ) ^ (↑σ₁ + ↑t * I)‖ ≤ (Cζ * Real.log |t| ^ 9) * ++ (CM * (ε * ‖↑σ₁ + ↑t * I‖ ^ 2)⁻¹) * X ^ σ₁:= by ++ rw[Xσ_bound] ++ gcongr ++ have : (Cζ * Real.log |t| ^ 9) * (CM * (ε * ‖↑σ₁ + ↑t * I‖ ^ 2)⁻¹) * X ^ σ₁ = g t := by ++ unfold g ++ ring_nf ++ linarith ++ ++ have int_with_f: ‖1 / (2 * ↑π * I) * ++ (I * ++ ∫ (t : ℝ) in Ioo (-T) (-3), ++ -ζ' (↑σ₁ + ↑t * I) / ζ (↑σ₁ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₁ + ↑t * I) * ++ ↑X ^ (↑σ₁ + ↑t * I))‖ = ‖1 / (2 * ↑π * I) * ++ (I * ++ ∫ (t : ℝ) in Ioo (-T) (-3), ++ f t)‖ := by ++ unfold f ++ simp ++ rw[int_with_f] ++ apply (norm_mul_le _ _).trans ++ have int_mulbyI_is_int : ‖I * ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ = ‖ ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ := by ++ rw [Complex.norm_mul, Complex.norm_I] ++ ring ++ rw[int_mulbyI_is_int] ++ ++ have norm_1over2pii_le1: ‖1 / (2 * ↑π * I)‖ ≤ 1 := by ++ simp ++ have pi_gt_3 : Real.pi > 3 := by ++ exact pi_gt_three ++ have pi_pos : 0 < π := by linarith [pi_gt_3] ++ have abs_pi_inv_le : |π|⁻¹ ≤ (1 : ℝ) := by ++ rw [abs_of_pos pi_pos] ++ have h : 1 = π * π⁻¹ := by ++ field_simp ++ rw[h] ++ nth_rw 1 [← one_mul π⁻¹] ++ apply mul_le_mul_of_nonneg_right ++ · linarith ++ · exact inv_nonneg.mpr (le_of_lt pi_pos) ++ have : (0 : ℝ) < (2 : ℝ) := by norm_num ++ have h_half_le_one : (2 : ℝ)⁻¹ ≤ 1 := by norm_num ++ rw [abs_of_pos pi_pos] at abs_pi_inv_le ++ norm_num; linarith ++ ++ have : ‖1 / (2 * ↑π * I)‖ * ‖∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ ≤ ‖∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ := by ++ apply mul_le_of_le_one_left ++ · apply norm_nonneg ++ · exact norm_1over2pii_le1 ++ apply le_trans this ++ have : ‖ ∫ (t : ℝ) in Ioo (-T) (-3), f ↑t‖ ≤ ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑ t‖ := by ++ apply norm_integral_le_integral_norm ++ apply le_trans this ++ ++ have norm_f_nonneg: ∀ t, ‖f t‖ ≥ 0 := by ++ exact fun t ↦ norm_nonneg (f t) ++ ++ have g_cont : ContinuousOn g (Icc (-T) (-3)) := by ++ unfold g ++ refine ContinuousOn.mul ?_ ?_ ++ refine ContinuousOn.mul ?_ ?_ ++ refine ContinuousOn.mul ?_ ?_ ++ refine ContinuousOn.mul ?_ ?_ ++ · exact continuousOn_const ++ · exact continuousOn_const ++ · refine ContinuousOn.pow ?_ 9 ++ refine ContinuousOn.log ?_ ?_ ++ · refine Continuous.continuousOn ?_ ++ exact _root_.continuous_abs ++ · intro t ht ++ have h1 := ht.1 ++ have h2 := ht.2 ++ by_contra! ++ have : t = 0 := by ++ exact abs_eq_zero.mp this ++ rw[this] at h2 ++ absurd ++ h2 ++ linarith ++ · refine ContinuousOn.inv₀ ?_ ?_ ++ · refine ContinuousOn.mul ?_ ?_ ++ · exact continuousOn_const ++ · refine ContinuousOn.pow ?_ 2 ++ refine ContinuousOn.norm ?_ ++ refine ContinuousOn.add ?_ ?_ ++ · exact continuousOn_const ++ · refine ContinuousOn.mul ?_ ?_ ++ · refine continuousOn_of_forall_continuousAt ?_ ++ intro x hx ++ exact continuous_ofReal.continuousAt ++ · exact continuousOn_const ++ · intro x hx ++ have norm_sq_pos : ‖(σ₁ : ℂ) + x * Complex.I‖ ^ 2 = σ₁ ^ 2 + x ^ 2 := by ++ rw [Complex.sq_norm] ++ exact normSq_add_mul_I σ₁ x ++ have : 0 < σ₁ ^ 2 + x ^ 2 := by ++ apply add_pos_of_pos_of_nonneg ++ · exact sq_pos_of_pos σ₁pos ++ · exact sq_nonneg x ++ apply mul_ne_zero ++ · linarith ++ · rw [norm_sq_pos] ++ exact ne_of_gt this ++ · exact continuousOn_const ++ ++ have g_integrable_Icc : IntegrableOn g (Icc (-T) (-3)) volume := by ++ exact ContinuousOn.integrableOn_Icc g_cont ++ ++ have g_integrable_Ioo : IntegrableOn g (Ioo (-T) (-3)) volume := by ++ apply MeasureTheory.IntegrableOn.mono_set g_integrable_Icc ++ exact Ioo_subset_Icc_self ++ ++ have int_normf_le_int_g: ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ ++ ≤ ∫ (t : ℝ) in Ioo (-T) (-3), g ↑t := by ++ ++ by_cases h_int : IntervalIntegrable (fun t : ℝ ↦ ‖f t‖) volume (-T) (-3) ++ · have f_int : IntegrableOn (fun (t : ℝ) ↦ ‖f t‖) (Ioo (-T : ℝ) (-3 : ℝ)) volume := by ++ have hle : -T ≤ -3 := by linarith ++ exact (intervalIntegrable_iff_integrableOn_Ioo_of_le hle).mp h_int ++ apply MeasureTheory.setIntegral_mono_on ++ exact f_int ++ exact g_integrable_Ioo ++ exact measurableSet_Ioo ++ intro t ht ++ apply bound_integral ++ have : |t| = -t := by ++ refine abs_of_neg ?_ ++ linarith [ht.2] ++ have abs_tgt3 : 3 < |t| := by ++ rw[this] ++ linarith[ht.2] ++ have abs_tltX : |t| < T := by ++ rw[this] ++ linarith[ht.1] ++ constructor ++ · linarith ++ · linarith ++ · have : ∫ (t : ℝ) in -T..-3, ‖f ↑ t‖ = ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ := by ++ rw [intervalIntegral.integral_of_le (by linarith)] ++ exact MeasureTheory.integral_Ioc_eq_integral_Ioo ++ have : ∫ (t : ℝ) in Ioo (-T) (-3), ‖f ↑t‖ = 0 := by ++ rw [← this] ++ exact intervalIntegral.integral_undef h_int ++ rw [this] ++ apply MeasureTheory.setIntegral_nonneg ++ · exact measurableSet_Ioo ++ · intro t ht ++ have abst_negt : |t| = -t := by ++ refine abs_of_neg ?_ ++ linarith [ht.2] ++ have tbounds1 : 3 < |t| ∧ |t| < T := by ++ rw[abst_negt] ++ constructor ++ · linarith [ht.2] ++ · linarith [ht.1] ++ unfold g ++ apply mul_nonneg ++ apply mul_nonneg ++ apply mul_nonneg ++ apply mul_nonneg ++ · linarith ++ · linarith ++ · have : 0 ≤ Real.log |t| := by ++ apply Real.log_nonneg ++ linarith [tbounds1.1] ++ positivity ++ · positivity ++ ++ · apply Real.rpow_nonneg ++ linarith ++ ++ apply le_trans int_normf_le_int_g ++ unfold g ++ ++ have : X ^ σ₁ = X ^ (1 - A / Real.log T ) := by ++ rfl ++ rw[this] ++ ++ have : X ^ (1 - A / Real.log T) = X * X ^ (- A / Real.log T) := by ++ have hX : X > 0 := by linarith ++ simp only [Real.rpow_sub hX, Real.rpow_one] ++ have h₁ : X ^ (-A / Real.log T) * X ^ (A / Real.log T) = 1 := by ++ rw [← Real.rpow_add hX] ++ ring_nf ++ exact rpow_zero X ++ field_simp ++ simpa only [neg_div, mul_comm] using h₁.symm ++ ++ rw[this] ++ ++ have Bound_of_log_int: ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) ≤ Cint / ε := by ++ have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) ++ = (1 / ε) * ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 := by ++ rw [← integral_const_mul] ++ congr with t ++ field_simp [εgt0] ++ rw[this] ++ have normsquared : ∀ (t : ℝ), ‖↑σ₁ + ↑t * I‖ ^ 2 = σ₁ ^ 2 + t ^ 2 := by ++ intro t ++ simp only [Complex.sq_norm] ++ exact normSq_add_mul_I σ₁ t ++ ++ have : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 ++ = ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) := by ++ simp_rw [normsquared] ++ ++ have bound : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / ‖↑σ₁ + ↑t * I‖ ^ 2 ≤ Cint := by ++ rw [this] ++ have : ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2) ++ ≤ ∫ t in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 := by ++ refine setIntegral_mono_on ?_ ?_ ?_ ?_ ++ · ++ have cont : ContinuousOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Set.Icc (-T) (-3)) := by ++ refine ContinuousOn.div ?_ ?_ ?_ ++ · refine ContinuousOn.pow ?_ 9 ++ refine ContinuousOn.log ?_ ?_ ++ · refine continuousOn_of_forall_continuousAt ?_ ++ intro x hx ++ refine Continuous.continuousAt ?_ ++ exact _root_.continuous_abs ++ · intro x hx ++ have h1 : x ≤ -3 := hx.2 ++ have xne0 : x ≠ 0 := by linarith ++ exact abs_ne_zero.mpr xne0 ++ · refine ContinuousOn.add ?_ ?_ ++ · exact continuousOn_const ++ · refine ContinuousOn.pow ?_ 2 ++ exact continuousOn_id' (Icc (-T) (-3)) ++ · intro t ht ++ have h1 : t ≤ -3 := ht.2 ++ have h2 : t ≠ 0 := by linarith ++ have h3 : 0 < t ^ 2 := pow_two_pos_of_ne_zero h2 ++ have h4 : 0 < σ₁ ^ 2 := sq_pos_of_pos σ₁pos ++ linarith [h3, h4] ++ have int_Icc : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Icc (-T) (-3)) volume := by ++ exact ContinuousOn.integrableOn_Icc cont ++ have int_Ioo : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / (σ₁ ^ 2 + t ^ 2)) (Ioo (-T) (-3)) volume := by ++ apply MeasureTheory.IntegrableOn.mono_set int_Icc ++ exact Ioo_subset_Icc_self ++ exact int_Ioo ++ · have cont : ContinuousOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Set.Icc (-T) (-3)) := by ++ refine ContinuousOn.div ?_ ?_ ?_ ++ · refine ContinuousOn.pow ?_ 9 ++ refine ContinuousOn.log ?_ ?_ ++ · refine continuousOn_of_forall_continuousAt ?_ ++ intro x hx ++ refine Continuous.continuousAt ?_ ++ exact _root_.continuous_abs ++ · intro x hx ++ have h1 : x ≤ -3 := hx.2 ++ have xne0 : x ≠ 0 := by linarith ++ exact abs_ne_zero.mpr xne0 ++ · refine ContinuousOn.pow ?_ 2 ++ exact continuousOn_id' (Icc (-T) (-3)) ++ · intro t ht ++ have h1 : t ≤ -3 := ht.2 ++ have tne0 : t ≠ 0 := by linarith ++ exact pow_ne_zero 2 tne0 ++ have int_Icc : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Icc (-T) (-3)) volume := by ++ exact ContinuousOn.integrableOn_Icc cont ++ have int_Ioo : IntegrableOn (fun t ↦ Real.log |t| ^ 9 / t ^ 2) (Ioo (-T) (-3)) volume := by ++ apply MeasureTheory.IntegrableOn.mono_set int_Icc ++ exact Ioo_subset_Icc_self ++ exact int_Ioo ++ · exact measurableSet_Ioo ++ · intro x hx ++ have xneg : x < 0 := by linarith[hx.2] ++ have absx : |x| = -x := abs_of_neg xneg ++ have h1 : 3 < |x| ∧ |x| < T := by ++ rw[absx] ++ constructor ++ · linarith [hx.2] ++ · linarith [hx.1] ++ exact quotient_bound x (t_bounds x hx) ++ apply le_trans this ++ have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 ++ = ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 := by ++ have eq_integrand : ∀ (t : ℝ), t ∈ Ioo (-T) (-3) → (Real.log |t|) ^ 9 / t ^ 2 = (Real.log (-t)) ^ 9 / (-t) ^ 2 := by ++ intro t ht ++ have tneg : t < 0 := by linarith[ht.2] ++ have : |t| = -t := abs_of_neg tneg ++ rw [this, neg_sq] ++ ++ have : ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / t ^ 2 ++ = ∫ (t : ℝ) in Ioo (-T) (-3), Real.log (-t) ^ 9 / (-t) ^ 2 := by ++ exact MeasureTheory.setIntegral_congr_fun measurableSet_Ioo eq_integrand ++ ++ rw [this] ++ ++ have interval_to_Ioo1 : ∫ (t : ℝ) in -T..-3, Real.log (-t) ^ 9 / (-t) ^ 2 ++ = ∫ (t : ℝ) in Ioo (-T) (-3), Real.log (-t) ^ 9 / (-t) ^ 2 := by ++ rw [intervalIntegral.integral_of_le (by linarith)] ++ exact MeasureTheory.integral_Ioc_eq_integral_Ioo ++ ++ have interval_to_Ioo2 : ∫ (t : ℝ) in (3)..(T), Real.log t ^ 9 / t ^ 2 ++ = ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 := by ++ rw [intervalIntegral.integral_of_le (by linarith)] ++ exact MeasureTheory.integral_Ioc_eq_integral_Ioo ++ ++ rw [← interval_to_Ioo1, ← interval_to_Ioo2] ++ rw [intervalIntegral.integral_comp_neg (fun (t : ℝ) ↦ Real.log (t) ^ 9 / (t) ^ 2)] ++ simp ++ rw [this] ++ have : ∫ (t : ℝ) in Ioo 3 T, Real.log t ^ 9 / t ^ 2 < Cint := by ++ exact Cinthyp T Tgt3 ++ linarith ++ rw [ mul_comm] ++ rw [← mul_div_assoc, mul_one] ++ exact (div_le_div_iff_of_pos_right εgt0).mpr bound ++ ++ have factor_out_constants : ++ ∫ (t : ℝ) in Ioo (-T) (-3), Cζ * CM * Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) * (X * X ^ (-A / Real.log T )) ++ = Cζ * CM * (X * X ^ (-A / Real.log T)) * ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) := by ++ rw [mul_assoc, ← mul_assoc (Cζ * CM), ← mul_assoc] ++ field_simp ++ rw [← integral_const_mul] ++ apply MeasureTheory.setIntegral_congr_fun measurableSet_Ioo ++ intro t ht ++ ring_nf ++ ++ rw [factor_out_constants] ++ ++ have : Cζ * CM * (X * X ^ (-A / Real.log T)) * ∫ (t : ℝ) in Ioo (-T) (-3), Real.log |t| ^ 9 / (ε * ‖↑σ₁ + ↑t * I‖ ^ 2) ++ ≤ Cζ * CM * ((X : ℝ) * X ^ (-A / Real.log T)) * (Cint / ε) := by ++ apply mul_le_mul_of_nonneg_left ++ · exact Bound_of_log_int ++ · have hpos : 0 < X * X ^ (-A / Real.log T) := by ++ apply mul_pos ++ · linarith ++ · apply Real.rpow_pos_of_pos ++ linarith ++ apply mul_nonneg ++ · apply mul_nonneg ++ · linarith ++ · linarith ++ · linarith [hpos] ++ ++ apply le_trans this ++ ring_nf ++ field_simp; norm_num ++ ++lemma I7I3 {SmoothingF : ℝ → ℝ} {ε X T σ₁ : ℝ} (Xpos : 0 < X) : ++ I₇ SmoothingF ε T X σ₁ = conj (I₃ SmoothingF ε T X σ₁) := by ++ unfold I₃ I₇ ++ simp only [map_mul, map_div₀, conj_I, conj_ofReal, conj_ofNat, map_one] ++ rw [neg_mul, mul_neg, ← neg_mul] ++ congr ++ · ring ++ · rw [← intervalIntegral_conj, ← intervalIntegral.integral_comp_neg] ++ apply intervalIntegral.integral_congr ++ intro t ht ++ simp only ++ rw [← smoothedChebyshevIntegrand_conj Xpos] ++ simp ++ ++lemma I7Bound {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ {A Cζ : ℝ} (hCζ : LogDerivZetaHasBound A Cζ) (Cζpos : 0 < Cζ) (hA : A ∈ Ioc 0 (1 / 2)) ++ : ∃ (C : ℝ) (_ : 0 < C), ++ ∀ (X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) ++ (_ : ε < 1) {T : ℝ} (_ : 3 < T), ++ let σ₁ : ℝ := 1 - A / (Real.log T) ++ ‖I₇ SmoothingF ε T X σ₁‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by ++ obtain ⟨C, Cpos, bound⟩ := I3Bound suppSmoothingF ContDiffSmoothingF hCζ Cζpos hA ++ refine ⟨C, Cpos, fun X X_gt ε εpos ε_lt_one T T_gt ↦ ?_⟩ ++ specialize bound X X_gt εpos ε_lt_one T_gt ++ intro σ₁ ++ rwa [I7I3 (by linarith), norm_conj] ++ ++lemma I4Bound {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) ++ {A : ℝ} ++ (hA : A ∈ Ioc 0 (1 / 2)) : ++ ∃ (C : ℝ) (_ : 0 ≤ C) (Tlb : ℝ) (_ : 3 < Tlb), ++ ∀ (X : ℝ) (_ : 3 < X) ++ {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) ++ {T : ℝ} (_ : Tlb < T), ++ let σ₁ : ℝ := 1 - A / (Real.log T) ++ ‖I₄ SmoothingF ε X σ₁ σ₂‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by ++ ++ have reOne : re 1 = 1 := by exact rfl ++ have imOne : im 1 = 0 := by exact rfl ++ have reThree : re 3 = 3 := by exact rfl ++ have imThree : im 3 = 0 := by exact rfl ++ ++ have elt3 : Real.exp 1 < 3 := by ++ linarith[Real.exp_one_lt_d9] ++ ++ unfold I₄ SmoothedChebyshevIntegrand ++ ++ let S : Set ℝ := (fun (t : ℝ) ↦ ↑‖-ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)‖₊) '' Icc 0 1 ++ let C' : ℝ := sSup S ++ have bddAboveS : BddAbove S := by ++ refine IsCompact.bddAbove ?_ ++ unfold S ++ refine IsCompact.image_of_continuousOn ?_ ?_ ++ · exact isCompact_Icc ++ · refine ContinuousOn.norm ?_ ++ have : (fun (t : ℝ) ↦ -ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)) = ++ (fun (t : ℝ) ↦ -(ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I))) := by ++ apply funext ++ intro x ++ apply neg_div ++ rw[this] ++ refine ContinuousOn.neg ?_ ++ have : (fun (t : ℝ) ↦ ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)) = ++ ((ζ' / ζ) ∘ (fun (t : ℝ) ↦ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I))) := by exact rfl ++ rw[this] ++ apply h_logDeriv_holo.continuousOn.comp' (by fun_prop) ++ unfold MapsTo ++ intro x xInIcc ++ simp only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, Set.mem_sdiff] ++ have : ¬↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I = 1 := by ++ by_contra h ++ rw[Complex.ext_iff, sub_re, add_re, sub_im, add_im] at h ++ repeat rw[mul_im] at h ++ repeat rw[mul_re] at h ++ rw[sub_im, sub_re, reOne, imOne, reThree, imThree, I_im, I_re] at h ++ repeat rw[ofReal_re] at h ++ repeat rw[ofReal_im] at h ++ ring_nf at h ++ obtain ⟨_, ripGoal⟩ := h ++ have : -3 ≠ 0 := by norm_num ++ linarith ++ refine ⟨?_, this⟩ ++ rw [mem_reProdIm] ++ simp only [sub_re, add_re, ofReal_re, mul_re, one_re, ofReal_im, sub_im, one_im, sub_self, ++ mul_zero, sub_zero, re_ofNat, I_re, im_ofNat, I_im, mul_one, add_im, mul_im, zero_mul, ++ add_zero, zero_sub, mem_Icc, le_refl, neg_le_self_iff, Nat.ofNat_nonneg, and_self, and_true] ++ rw [Set.uIcc_of_le] ++ · rw [mem_Icc] ++ constructor ++ · simp only [le_add_iff_nonneg_right] ++ apply mul_nonneg ++ · exact xInIcc.1 ++ · linarith [hσ₂.2] ++ · have : σ₂ + x * (1 - σ₂) = σ₂ * (1 - x) + x := by ring ++ rw [this] ++ clear this ++ have : (2 : ℝ) = 1 * 1 + 1 := by norm_num ++ rw [this] ++ clear this ++ gcongr ++ · linarith [xInIcc.2] ++ · exact hσ₂.2.le ++ · linarith [xInIcc.1] ++ · exact xInIcc.2 ++ · linarith [hσ₂.2] ++ ++ have CPrimeNonneg : 0 ≤ C' := by ++ apply Real.sSup_nonneg ++ intro x x_in_S ++ obtain ⟨t, ht, rfl⟩ := x_in_S ++ exact NNReal.coe_nonneg _ ++ ++ obtain ⟨D, Dpos, MellinSmooth1bBound⟩ := MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF ++ let C : ℝ := C' * D / sInf ((fun t => ‖ σ₂ + (t : ℝ) * (1 - σ₂) - 3 * I ‖₊ ^ 2) '' Set.Icc 0 1) ++ use C ++ have sInfPos : 0 < sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1) := by ++ refine (IsCompact.lt_sInf_iff_of_continuous ?_ ?_ ?_ 0).mpr ?_ ++ · exact isCompact_Icc ++ · exact Nonempty.of_subtype ++ · have : (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) = ++ (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ * ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊) := by ++ apply funext ++ intro x ++ rw[pow_two] ++ rw[this] ++ have : ContinuousOn (fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊) (Icc 0 1) := by ++ refine ContinuousOn.nnnorm ?_ ++ refine ContinuousOn.sub ?_ (by exact continuousOn_const) ++ refine ContinuousOn.add (by exact continuousOn_const) ?_ ++ exact ContinuousOn.mul (by exact Complex.continuous_ofReal.continuousOn) (by exact continuousOn_const) ++ exact ContinuousOn.mul (by exact this) (by exact this) ++ · intro x xLoc ++ apply pow_pos ++ have temp : |(↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I).im| ≤ ++ ‖↑σ₂ + ↑x * (1 - ↑σ₂) - 3 * I‖₊ := by apply Complex.abs_im_le_norm ++ rw[sub_im, add_im, mul_im, mul_im, I_re, I_im, sub_im, sub_re] at temp ++ repeat rw[ofReal_re] at temp ++ repeat rw[ofReal_im] at temp ++ rw[reThree, imOne] at temp ++ ring_nf at temp ⊢ ++ rw[abs_of_neg, neg_neg] at temp ++ · have : (3 : NNReal) ≤ ‖↑σ₂ - ↑σ₂ * ↑x + (↑x - I * 3)‖₊ := by ++ apply (NNReal.coe_le_coe).mp ++ convert! temp using 1; congr 2; ring ++ have hp : (0 : NNReal) < ‖↑σ₂ - ↑σ₂ * ↑x + (↑x - I * 3)‖₊ := ++ lt_of_lt_of_le (by norm_num) this ++ convert! hp using 1; congr 2; ring ++ · rw[neg_lt_zero] ++ norm_num ++ have CNonneg : 0 ≤ C := by ++ unfold C ++ apply mul_nonneg ++ · exact mul_nonneg (by exact CPrimeNonneg) (by exact Dpos.le) ++ · rw[inv_nonneg] ++ norm_cast ++ convert sInfPos.le using 5 ++ norm_cast ++ use CNonneg ++ ++ let Tlb : ℝ := max 4 (max (rexp A) (rexp (A / (1 - σ₂)))) ++ use Tlb ++ ++ have : 3 < Tlb := by ++ unfold Tlb ++ rw[lt_max_iff] ++ refine Or.inl ?_ ++ norm_num ++ use this ++ ++ intro X X_gt_three ε ε_pos ε_lt_one T T_gt_Tlb σ₁ ++ have σ₂_le_σ₁ : σ₂ ≤ σ₁ := by ++ have logTlb_pos : 0 < Real.log Tlb := by ++ rw[← Real.log_one] ++ exact log_lt_log (by norm_num) (by linarith) ++ have logTlb_nonneg : 0 ≤ Real.log Tlb := by exact le_of_lt (by exact logTlb_pos) ++ have expr_nonneg : 0 ≤ A / (1 - σ₂) := by ++ apply div_nonneg ++ · linarith [hA.1] ++ · rw[sub_nonneg] ++ exact le_of_lt hσ₂.2 ++ have temp : σ₂ ≤ 1 - A / Real.log Tlb := by ++ have : rexp (A / (1 - σ₂)) ≤ Tlb := by ++ unfold Tlb ++ apply le_max_of_le_right ++ apply le_max_right ++ rw[← Real.le_log_iff_exp_le] at this ++ · rw[div_le_iff₀, mul_comm, ← div_le_iff₀] at this ++ · linarith ++ · exact logTlb_pos ++ · rw[sub_pos] ++ exact hσ₂.2 ++ · positivity ++ have : 1 - A / Real.log Tlb ≤ 1 - A / Real.log T := by ++ apply sub_le_sub (by rfl) ++ apply div_le_div₀ ++ · exact le_of_lt (by exact hA.1) ++ · rfl ++ · exact logTlb_pos ++ · apply log_le_log (by positivity) ++ exact le_of_lt (by exact T_gt_Tlb) ++ exact le_trans temp this ++ have minσ₂σ₁ : min σ₂ σ₁ = σ₂ := by exact min_eq_left (by exact σ₂_le_σ₁) ++ have maxσ₂σ₁ : max σ₂ σ₁ = σ₁ := by exact max_eq_right (by exact σ₂_le_σ₁) ++ have σ₁_lt_one : σ₁ < 1 := by ++ rw[← sub_zero 1] ++ unfold σ₁ ++ apply sub_lt_sub_left ++ apply div_pos (by exact hA.1) ++ rw[← Real.log_one] ++ exact log_lt_log (by norm_num) (by linarith) ++ ++ rw[norm_mul, ← one_mul C] ++ have : 1 * C * X * X ^ (-A / Real.log T) / ε = 1 * (C * X * X ^ (-A / Real.log T) / ε) := by ring ++ rw[this] ++ apply mul_le_mul ++ · rw[norm_div, norm_one] ++ repeat rw[norm_mul] ++ rw[Complex.norm_two, Complex.norm_real, Real.norm_of_nonneg, Complex.norm_I, mul_one] ++ have : 1 / (2 * π) < 1 / 6 := by ++ rw[one_div_lt_one_div] ++ · refine (div_lt_iff₀' ?_).mp ?_ ++ norm_num ++ ring_nf ++ refine gt_iff_lt.mpr ?_ ++ exact Real.pi_gt_three ++ · positivity ++ · norm_num ++ apply le_of_lt ++ exact lt_trans this (by norm_num) ++ exact pi_nonneg ++ · let f : ℝ → ℂ := fun σ ↦ (-ζ' (↑σ - 3 * I) / ζ (↑σ - 3 * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ - 3 * I) * ↑X ^ (↑σ - 3 * I)) ++ have temp : ‖∫ (σ : ℝ) in σ₂..σ₁, -ζ' (↑σ - 3 * I) / ζ (↑σ - 3 * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ - 3 * I) * ↑X ^ (↑σ - 3 * I)‖ ≤ ++ C * X * X ^ (-A / Real.log T) / ε * |σ₁ - σ₂| := by ++ have : ∀ x ∈ Set.uIoc σ₂ σ₁, ‖f x‖ ≤ C * X * X ^ (-A / Real.log T) / ε := by ++ intro x xInIoc ++ let t : ℝ := (x - σ₂) / (1 - σ₂) ++ have tInIcc : t ∈ Icc 0 1 := by ++ unfold t ++ constructor ++ · apply div_nonneg ++ · rw[sub_nonneg] ++ unfold uIoc at xInIoc ++ rw[minσ₂σ₁] at xInIoc ++ exact le_of_lt (by exact xInIoc.1) ++ · rw[sub_nonneg] ++ apply le_of_lt (by exact hσ₂.2) ++ · rw[div_le_one] ++ · refine sub_le_sub ?_ (by rfl) ++ unfold uIoc at xInIoc ++ rw[maxσ₂σ₁] at xInIoc ++ apply le_trans xInIoc.2 ++ exact le_of_lt (by exact σ₁_lt_one) ++ · rw[sub_pos] ++ exact hσ₂.2 ++ have tExpr : (↑σ₂ + t * (1 - ↑σ₂) - 3 * I) = (↑x - 3 * I) := by ++ unfold t ++ simp only [ofReal_div, ofReal_sub, ofReal_one, sub_left_inj] ++ rw[div_mul_comm, div_self] ++ · simp only [one_mul, add_sub_cancel] ++ · refine sub_ne_zero_of_ne ?_ ++ apply Ne.symm ++ rw[Complex.ofReal_ne_one] ++ exact ne_of_lt (by exact hσ₂.2) ++ unfold f ++ simp only [Complex.norm_mul] ++ have : C * X * X ^ (-A / Real.log T) / ε = ++ (C / ε) * (X * X ^ (-A / Real.log T)) := by ring ++ rw[this] ++ have temp : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)‖ ≤ ++ C / ε := by ++ unfold C ++ rw[div_div] ++ nth_rewrite 2 [div_eq_mul_inv] ++ have temp : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ ≤ C' := by ++ unfold C' ++ have : ‖-ζ' (↑x - 3 * I) / ζ (↑x - 3 * I)‖ ∈ ++ (fun (t : ℝ) ↦ ↑‖-ζ' (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I) / ζ (↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I)‖₊) '' Icc 0 1 := by ++ rw[Set.mem_image] ++ use t ++ constructor ++ · exact tInIcc ++ · rw[tExpr] ++ rfl ++ exact le_csSup (by exact bddAboveS) (by exact this) ++ have : ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)‖ ≤ ++ D * ((sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1)) * ε)⁻¹ := by ++ nth_rewrite 3 [mul_comm] ++ let s : ℂ := x - 3 * I ++ have : 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I) = ++ 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) s := by exact rfl ++ rw[this] ++ have temp : σ₂ ≤ s.re := by ++ unfold s ++ rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] ++ ring_nf ++ apply le_of_lt ++ unfold uIoc at xInIoc ++ rw[minσ₂σ₁] at xInIoc ++ exact xInIoc.1 ++ have : s.re ≤ 2 := by ++ unfold s ++ rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] ++ ring_nf ++ have : x < 1 := by ++ unfold uIoc at xInIoc ++ rw[maxσ₂σ₁] at xInIoc ++ exact lt_of_le_of_lt xInIoc.2 σ₁_lt_one ++ linarith ++ have temp : ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) s‖ ≤ D * (ε * ‖s‖ ^ 2)⁻¹ := by ++ exact MellinSmooth1bBound σ₂ hσ₂.1 s temp this ε ε_pos ε_lt_one ++ have : D * (ε * ‖s‖ ^ 2)⁻¹ ≤ D * (ε * ↑(sInf ((fun (t : ℝ) ↦ ‖↑σ₂ + ↑t * (1 - ↑σ₂) - 3 * I‖₊ ^ 2) '' Icc 0 1)))⁻¹ := by ++ refine mul_le_mul (by rfl) ?_ ?_ (by exact le_of_lt (by exact Dpos)) ++ · rw[inv_le_inv₀] ++ · apply mul_le_mul (by rfl) ++ · rw[NNReal.coe_sInf] ++ apply csInf_le ++ · apply NNReal.bddBelow_coe ++ · unfold s ++ rw[Set.mem_image] ++ let xNorm : NNReal := ‖x - 3 * I‖₊ ^ 2 ++ use xNorm ++ constructor ++ · rw[Set.mem_image] ++ use t ++ exact ⟨tInIcc, by rw[tExpr]⟩ ++ · rfl ++ · exact le_of_lt (by exact sInfPos) ++ · exact le_of_lt (by exact ε_pos) ++ · apply mul_pos (ε_pos) ++ refine sq_pos_of_pos ?_ ++ refine norm_pos_iff.mpr ?_ ++ refine ne_zero_of_re_pos ?_ ++ unfold s ++ rw[sub_re, mul_re, I_re, I_im, reThree, imThree, ofReal_re] ++ ring_nf ++ unfold uIoc at xInIoc ++ rw[minσ₂σ₁] at xInIoc ++ exact lt_trans hσ₂.1 xInIoc.1 ++ · exact mul_pos (ε_pos) (sInfPos) ++ · rw[inv_nonneg] ++ apply mul_nonneg (by exact le_of_lt (by exact ε_pos)) ++ exact sq_nonneg ‖s‖ ++ exact le_trans temp this ++ rw[mul_assoc] ++ apply mul_le_mul (by exact temp) (by exact this) ++ · have this : 0 ≤ |(𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑x - 3 * I)).re| := by ++ apply abs_nonneg ++ exact le_trans this (by refine Complex.abs_re_le_norm ?_) ++ · exact CPrimeNonneg ++ have : ‖(X : ℂ) ^ (↑x - 3 * I)‖ ≤ ++ X * X ^ (-A / Real.log T) := by ++ nth_rewrite 2 [← Real.rpow_one X] ++ rw[← Real.rpow_add] ++ · rw[Complex.norm_cpow_of_ne_zero] ++ · rw[sub_re, sub_im, mul_re, mul_im, ofReal_re, ofReal_im, I_re, I_im, reThree, imThree] ++ ring_nf ++ rw[Complex.norm_of_nonneg] ++ · rw[Complex.arg_ofReal_of_nonneg] ++ ++ · have one_inv: (1⁻¹ : ℝ) = ( 1 : ℝ) := by norm_num ++ rw[zero_mul, neg_zero, Real.exp_zero, one_inv, mul_one] ++ refine rpow_le_rpow_of_exponent_le ?_ ?_ ++ · linarith ++ · unfold uIoc at xInIoc ++ rw[maxσ₂σ₁] at xInIoc ++ unfold σ₁ at xInIoc ++ rw [←div_eq_mul_inv] ++ ring_nf at xInIoc ⊢ ++ exact xInIoc.2 ++ · positivity ++ · positivity ++ · refine ne_zero_of_re_pos ?_ ++ rw[ofReal_re] ++ positivity ++ · positivity ++ apply mul_le_mul ++ · exact temp ++ · exact this ++ · rw[Complex.norm_cpow_eq_rpow_re_of_pos] ++ · rw[sub_re, mul_re, ofReal_re, I_re, I_im, reThree, imThree] ++ ring_nf ++ apply Real.rpow_nonneg ++ positivity ++ · positivity ++ · exact div_nonneg CNonneg (le_of_lt ε_pos) ++ exact intervalIntegral.norm_integral_le_of_norm_le_const this ++ have : C * X * X ^ (-A / Real.log T) / ε * |σ₁ - σ₂| ≤ ++ C * X * X ^ (-A / Real.log T) / ε := by ++ have : |σ₁ - σ₂| ≤ 1 := by ++ rw[abs_of_nonneg] ++ · rw[← sub_zero 1] ++ exact sub_le_sub σ₁_lt_one.le hσ₂.1.le ++ · rw[sub_nonneg] ++ exact σ₂_le_σ₁ ++ bound ++ exact le_trans temp this ++ simp only [norm_nonneg] ++ norm_num ++ ++lemma I6I4 {SmoothingF : ℝ → ℝ} {ε X σ₁ σ₂ : ℝ} (Xpos : 0 < X) : ++ I₆ SmoothingF ε X σ₁ σ₂ = -conj (I₄ SmoothingF ε X σ₁ σ₂) := by ++ unfold I₆ I₄ ++ simp only [map_mul, map_div₀, conj_ofReal, conj_I, map_one, conj_ofNat] ++ rw [← neg_mul] ++ congr ++ · ring ++ · rw [← intervalIntegral_conj] ++ apply intervalIntegral.integral_congr ++ intro σ hσ ++ simp only ++ rw[← smoothedChebyshevIntegrand_conj Xpos] ++ simp [conj_ofNat] ++ ++lemma I6Bound {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) ++ {A : ℝ} ++ (hA : A ∈ Ioc 0 (1 / 2)) : ++ ∃ (C : ℝ) (_ : 0 ≤ C) (Tlb : ℝ) (_ : 3 < Tlb), ++ ∀ (X : ℝ) (_ : 3 < X) ++ {ε : ℝ} (_ : 0 < ε) (_ : ε < 1) ++ {T : ℝ} (_ : Tlb < T), ++ let σ₁ : ℝ := 1 - A / (Real.log T) ++ ‖I₆ SmoothingF ε X σ₁ σ₂‖ ≤ C * X * X ^ (- A / (Real.log T)) / ε := by ++ obtain ⟨C, Cpos, Tlb, Tlb_gt, bound⟩ := I4Bound suppSmoothingF ContDiffSmoothingF h_logDeriv_holo hσ₂ hA ++ refine ⟨C, Cpos, Tlb, Tlb_gt, fun X X_gt ε εpos ε_lt_one T T_gt ↦ ?_⟩ ++ specialize bound X X_gt εpos ε_lt_one T_gt ++ intro σ₁ ++ rwa [I6I4 (by linarith), norm_neg, norm_conj] ++ ++lemma I5Bound {SmoothingF : ℝ → ℝ} ++ (suppSmoothingF : Function.support SmoothingF ⊆ Icc (1 / 2) 2) ++ (ContDiffSmoothingF : ContDiff ℝ 1 SmoothingF) ++ {σ₂ : ℝ} (h_logDeriv_holo : LogDerivZetaIsHoloSmall σ₂) (hσ₂ : σ₂ ∈ Ioo 0 1) ++ : ∃ (C : ℝ) (_ : 0 < C), ++ ∀ (X : ℝ) (_ : 3 < X) {ε : ℝ} (_ : 0 < ε) ++ (_ : ε < 1), ++ ‖I₅ SmoothingF ε X σ₂‖ ≤ C * X ^ σ₂ / ε := by ++ ++ unfold LogDerivZetaIsHoloSmall HolomorphicOn at h_logDeriv_holo ++ let zeta'_zeta_on_line := fun (t : ℝ) ↦ ζ' (σ₂ + t * I) / ζ (σ₂ + t * I) ++ ++ have subst : {σ₂} ×ℂ uIcc (-3) 3 ⊆ (uIcc σ₂ 2 ×ℂ uIcc (-3) 3) \ {1} := by ++ simp! only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le] ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, neg_le_self_iff, ++ Nat.ofNat_nonneg, uIcc_of_le] ++ intro z hyp_z ++ simp only [mem_reProdIm, mem_singleton_iff, mem_Icc] at hyp_z ++ simp only [Set.mem_sdiff, mem_reProdIm, mem_Icc, mem_singleton_iff] ++ constructor ++ · constructor ++ · rw [hyp_z.1] ++ apply left_mem_uIcc ++ · exact hyp_z.2 ++ · push Not ++ by_contra h ++ rw [h] at hyp_z ++ simp only [one_re, one_im, Left.neg_nonpos_iff, Nat.ofNat_nonneg, and_self, and_true] at hyp_z ++ linarith [hσ₂.2] ++ ++ have zeta'_zeta_cont := (h_logDeriv_holo.mono subst).continuousOn ++ ++ have is_compact' : IsCompact ({σ₂} ×ℂ uIcc (-3) 3) := by ++ refine IsCompact.reProdIm ?_ ?_ ++ · exact isCompact_singleton ++ · exact isCompact_uIcc ++ ++ let ⟨zeta_bound, zeta_prop⟩ := ++ IsCompact.exists_bound_of_continuousOn (is_compact') zeta'_zeta_cont ++ ++ let ⟨M, ⟨M_is_pos, M_bounds_mellin_hard⟩⟩ := ++ MellinOfSmooth1b ContDiffSmoothingF suppSmoothingF ++ ++ clear is_compact' zeta'_zeta_cont subst zeta'_zeta_on_line h_logDeriv_holo ++ ++ unfold I₅ ++ unfold SmoothedChebyshevIntegrand ++ ++ let mellin_prop : ∀ (t ε : ℝ), ++ 0 < ε → ε < 1 → ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ ≤ M * (ε * ‖↑σ₂ + ↑t * I‖ ^ 2)⁻¹ := ++ fun (t : ℝ) ↦ (M_bounds_mellin_hard σ₂ (by linarith[hσ₂.1]) (σ₂ + t * I) (by simp only [add_re, ++ ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, le_refl]) (by simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero]; linarith[hσ₂.2])) ++ ++ simp only [mul_inv_rev] at mellin_prop ++ ++ let Const := 1 + (σ₂^2)⁻¹ * (abs zeta_bound) * M ++ ++ let C := |π|⁻¹ * 2⁻¹ * 6 * Const ++ use C ++ have C_pos : 0 < C := by positivity ++ use C_pos ++ ++ have U : σ₂ ∈ Ioo 0 1 := by ++ refine mem_Ioo.mpr ?_ ++ · constructor ++ · linarith[hσ₂.1] ++ · linarith[hσ₂.2] ++ ++ clear U C_pos ++ ++ intros X X_gt ε ε_pos ε_lt_one ++ ++ have mellin_bound := fun (t : ℝ) ↦ mellin_prop t ε ε_pos ε_lt_one ++ ++ have U: 0 < σ₂^2 := by ++ exact sq_pos_of_pos (by linarith[hσ₂.1]) ++ ++ have easy_bound : ∀(t : ℝ), (‖↑σ₂ + ↑t * I‖^2)⁻¹ ≤ (σ₂^2)⁻¹ := ++ by ++ intro t ++ rw [inv_le_inv₀] ++ rw [Complex.sq_norm]; rw [Complex.normSq_apply]; simp only [add_re, ofReal_re, mul_re, I_re, ++ mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add]; ring_nf; simp only [le_add_iff_nonneg_right]; exact zpow_two_nonneg t ++ rw [Complex.sq_norm, Complex.normSq_apply]; simp only [add_re, ofReal_re, mul_re, I_re, ++ mul_zero, ofReal_im, I_im, mul_one, sub_self, add_zero, add_im, mul_im, zero_add]; ring_nf; positivity ++ positivity ++ ++ have T1 : ∀(t : ℝ), t ∈ uIoc (-3) (3 : ℝ) → ‖-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I) * 𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I) * ++ (↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ ≤ Const * ε⁻¹ * X ^ σ₂ := by ++ intro t hyp_t ++ have Z := by ++ calc ++ ‖(-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)) * (𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)) * ++ (↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ = ‖-ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by simp only [Complex.norm_mul, ++ Complex.norm_div, norm_neg] ++ _ ≤ ‖ζ' (↑σ₂ + ↑t * I) / ζ (↑σ₂ + ↑t * I)‖ * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by simp only [Complex.norm_div, ++ norm_neg, le_refl] ++ _ ≤ zeta_bound * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := ++ by ++ have U := zeta_prop (↑σ₂ + t * I) (by ++ simp only [neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le] ++ simp only [mem_reProdIm, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, ++ mul_one, sub_self, add_zero, mem_singleton_iff, add_im, mul_im, zero_add, mem_Icc] ++ constructor ++ · trivial ++ · refine mem_Icc.mp ?_ ++ · refine mem_Icc_of_Ioc ?_ ++ · have T : (-3 : ℝ) ≤ 3 := by simp only [neg_le_self_iff, Nat.ofNat_nonneg] ++ rw [←Set.uIoc_of_le T] ++ exact hyp_t) ++ simp only [Complex.norm_div] at U ++ simp only [Complex.norm_div, ge_iff_le] ++ linear_combination U * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ ++ _ ≤ abs zeta_bound * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by ++ have U : zeta_bound ≤ abs zeta_bound := by simp only [le_abs_self] ++ linear_combination (U * ‖𝓜 (fun x ↦ ↑(Smooth1 SmoothingF ε x)) (↑σ₂ + ↑t * I)‖ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ ) ++ _ ≤ abs zeta_bound * M * ((‖↑σ₂ + ↑t * I‖ ^ 2)⁻¹ * ε⁻¹) * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by ++ have U := mellin_bound t ++ linear_combination (abs zeta_bound) * U * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ ++ _ ≤ abs zeta_bound * M * (σ₂^2)⁻¹ * ε⁻¹ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖ := by ++ have T : 0 ≤ abs zeta_bound * M := by positivity ++ linear_combination (abs zeta_bound * M * easy_bound t * ε⁻¹ * ‖(↑X : ℂ) ^ (↑σ₂ + ↑t * I)‖) ++ _ = abs zeta_bound * M * (σ₂^2)⁻¹ * ε⁻¹ * X ^ (σ₂) := by ++ rw [Complex.norm_cpow_eq_rpow_re_of_pos] ++ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, ++ add_zero] ++ positivity ++ _ ≤ Const * ε⁻¹ * X ^ σ₂ := by ++ unfold Const ++ ring_nf ++ simp only [inv_pow, le_add_iff_nonneg_right, inv_pos, mul_nonneg_iff_of_pos_left, ε_pos] ++ positivity ++ ++ exact Z ++ ++ simp only [one_div, mul_inv_rev, inv_I, neg_mul, norm_neg, Complex.norm_mul, norm_I, norm_inv, ++ norm_real, norm_eq_abs, Complex.norm_ofNat, one_mul, ge_iff_le] ++ have Z := ++ intervalIntegral.norm_integral_le_of_norm_le_const T1 ++ simp only [ge_iff_le] ++ ++ have S : |π|⁻¹ * 2⁻¹ * (Const * ε⁻¹ * X ^ σ₂ * |3 + 3|) = C * X ^ σ₂ / ε := ++ by ++ unfold C ++ ring_nf ++ ++ simp only [sub_neg_eq_add] at Z ++ simp only [← S, ge_iff_le] ++ linear_combination (|π|⁻¹ * 2⁻¹ * Z) ++ ++lemma LogDerivZetaBoundedAndHolo : ∃ A C : ℝ, 0 < C ∧ A ∈ Ioc 0 (1 / 2) ∧ LogDerivZetaHasBound A C ++ ∧ ∀ (T : ℝ) (_ : 3 ≤ T), ++ HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) ++ (( (Icc ((1 : ℝ) - A / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) ) \ {1}) := by ++ ++ obtain ⟨A₁, A₁_in, C, C_pos, zeta_bnd2⟩ := LogDerivZetaBndUnif2 ++ obtain ⟨A₂, A₂_in, holo⟩ := LogDerivZetaHolcLargeT' ++ refine ⟨min A₁ A₂, C, C_pos, ?_, ?_, ?_⟩ ++ · exact ⟨lt_min A₁_in.1 A₂_in.1, le_trans (min_le_left _ _) A₁_in.2⟩ ++ · ++ intro σ t ht hσ ++ have hσ' : σ ∈ Ici (1 - A₁ / Real.log |t| ^ 1) := by ++ ++ have hAle : min A₁ A₂ ≤ A₁ := min_le_left _ _ ++ have hlogpos : 0 < Real.log |t| := by ++ ++ exact Real.log_pos (lt_trans (by norm_num) ht) ++ have := sub_le_sub_left ++ (div_le_div_of_nonneg_right (show min A₁ A₂ ≤ A₁ from hAle) (le_of_lt hlogpos)) 1 ++ ++ have hthr : 1 - A₁ / Real.log |t| ^ 1 ≤ 1 - (min A₁ A₂) / Real.log |t| ^ 1 := by ++ simpa [pow_one] using this ++ ++ have : σ ∈ Ici (1 - (min A₁ A₂) / Real.log |t| ^ 1) := by ++ simpa [pow_one] using hσ ++ exact le_trans hthr (mem_Ici.mp this) ++ ++ have hmain := zeta_bnd2 σ t ht (by simpa [pow_one] using hσ') ++ have hlog_ge_one : (1 : ℝ) ≤ Real.log |t| := by ++ ++ have hpos : 0 < |t| := lt_trans (by norm_num) ht ++ have hle : Real.exp 1 ≤ |t| := by ++ have : Real.exp 1 ≤ 3 := le_of_lt (lt_trans Real.exp_one_lt_d9 (by norm_num)) ++ exact this.trans (le_of_lt ht) ++ have := Real.log_le_log (Real.exp_pos 1) hle ++ simpa [Real.log_exp] using this ++ have hpow : Real.log |t| ^ (2 : ℕ) ≤ Real.log |t| ^ (9 : ℕ) := by ++ exact pow_le_pow_right₀ hlog_ge_one (by decide : (2 : ℕ) ≤ 9) ++ ++ have : C * Real.log |t| ^ (2 : ℕ) ≤ C * Real.log |t| ^ (9 : ℕ) := ++ mul_le_mul_of_nonneg_left hpow (le_of_lt C_pos) ++ exact (le_trans hmain this) ++ · ++ intro T hT ++ ++ have hsubset : ++ ((Icc ((1 : ℝ) - min A₁ A₂ / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) \ {1}) ⊆ ++ ((Icc ((1 : ℝ) - A₂ / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) \ {1}) := by ++ intro s hs ++ rcases hs with ⟨hs_box, hs_ne⟩ ++ rcases hs_box with ⟨hre, him⟩ ++ rcases hre with ⟨hre_left, hre_right⟩ ++ ++ constructor ++ · ++ constructor ++ · ++ constructor ++ · ++ have hAle : min A₁ A₂ ≤ A₂ := min_le_right _ _ ++ have hlogpos : 0 < Real.log T := by ++ have hT' : 1 < T := by linarith ++ exact Real.log_pos hT' ++ have := sub_le_sub_left ++ (div_le_div_of_nonneg_right hAle (le_of_lt hlogpos)) 1 ++ have hthr : 1 - A₂ / Real.log T ^ 1 ≤ 1 - (min A₁ A₂) / Real.log T ^ 1 := by ++ simpa [pow_one] using this ++ exact le_trans hthr hre_left ++ · exact hre_right ++ · exact him ++ · exact hs_ne ++ exact (holo T hT).mono hsubset ++ ++lemma MellinOfSmooth1cExplicit {ν : ℝ → ℝ} (diffν : ContDiff ℝ 1 ν) ++ (suppν : ν.support ⊆ Icc (1 / 2) 2) ++ (mass_one : ∫ x in Ioi 0, ν x / x = 1) : ++ ∃ ε₀ c : ℝ, 0 < ε₀ ∧ 0 < c ∧ ++ ∀ ε ∈ Ioo 0 ε₀, ‖𝓜 ((Smooth1 ν ε) ·) 1 - 1‖ ≤ c * ε := by ++ have := MellinOfSmooth1c diffν suppν mass_one ++ rw [Asymptotics.isBigO_iff'] at this ++ rcases this with ⟨c, cpos, hc⟩ ++ unfold Filter.Eventually at hc ++ rw [mem_nhdsGT_iff_exists_Ioo_subset] at hc ++ rcases hc with ⟨ε₀, ε₀pos, h⟩ ++ refine ⟨ε₀, c, ε₀pos, cpos, fun ε hε ↦ ?_⟩ ++ specialize h hε ++ rw [mem_ofPred_eq, id_eq, norm_of_nonneg hε.1.le] at h ++ exact h ++ ++open _root_.Filter Topology ++ ++theorem Strong_PNT : ∃ c > 0, ++ (ψ - id) =O[atTop] ++ fun (x : ℝ) ↦ x * Real.exp (-c * (Real.log x) ^ ((1 : ℝ) / 2)) := by ++ have ⟨ν, ContDiffν, ν_nonneg', ν_supp, ν_massOne'⟩ := SmoothExistence ++ have ContDiff1ν : ContDiff ℝ 1 ν := by ++ exact ContDiffν.of_le (by simp) ++ have ν_nonneg : ∀ x > 0, 0 ≤ ν x := fun x _ ↦ ν_nonneg' x ++ have ν_massOne : ∫ x in Ioi 0, ν x / x = 1 := by ++ rwa [← integral_Ici_eq_integral_Ioi] ++ clear ContDiffν ν_nonneg' ν_massOne' ++ obtain ⟨c_close, c_close_pos, h_close⟩ := ++ SmoothedChebyshevClose ContDiff1ν ν_supp ν_nonneg ν_massOne ++ obtain ⟨ε_main, C_main, ε_main_pos, C_main_pos, h_main⟩ := MellinOfSmooth1cExplicit ContDiff1ν ν_supp ν_massOne ++ obtain ⟨A, C_bnd, C_bnd_pos, A_in_Ioc, zeta_bnd, holo1⟩ := LogDerivZetaBoundedAndHolo ++ obtain ⟨σ₂', σ₂'_lt_one, holo2'⟩ := LogDerivZetaHolcSmallT ++ let σ₂ : ℝ := max σ₂' (1 / 2) ++ have σ₂_pos : 0 < σ₂ := by bound ++ have σ₂_lt_one : σ₂ < 1 := by bound ++ have holo2 : HolomorphicOn (fun s ↦ ζ' s / ζ s) (uIcc σ₂ 2 ×ℂ uIcc (-3) 3 \ {1}) := by ++ apply holo2'.mono ++ intro s hs ++ simp [mem_reProdIm] at hs ⊢ ++ refine ⟨?_, hs.2⟩ ++ refine ⟨?_, hs.1.2⟩ ++ rcases hs.1.1 with ⟨left, right⟩ ++ constructor ++ · apply le_trans _ left ++ apply min_le_min_right ++ apply le_max_left ++ · rw [max_eq_right (by linarith)] at right ⊢ ++ exact right ++ ++ clear holo2' σ₂'_lt_one ++ ++ obtain ⟨c₁, c₁pos, hc₁⟩ := I1Bound ν_supp ContDiff1ν ν_nonneg ν_massOne ++ obtain ⟨c₂, c₂pos, hc₂⟩ := I2Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc ++ obtain ⟨c₃, c₃pos, hc₃⟩ := I3Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc ++ obtain ⟨c₅, c₅pos, hc₅⟩ := I5Bound ν_supp ContDiff1ν holo2 ⟨σ₂_pos, σ₂_lt_one⟩ ++ obtain ⟨c₇, c₇pos, hc₇⟩ := I7Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc ++ obtain ⟨c₈, c₈pos, hc₈⟩ := I8Bound ν_supp ContDiff1ν zeta_bnd C_bnd_pos A_in_Ioc ++ obtain ⟨c₉, c₉pos, hc₉⟩ := I9Bound ν_supp ContDiff1ν ν_nonneg ν_massOne ++ ++ obtain ⟨c₄, c₄pos, Tlb₄, Tlb₄bnd, hc₄⟩ := I4Bound ν_supp ContDiff1ν ++ holo2 ⟨σ₂_pos, σ₂_lt_one⟩ A_in_Ioc ++ ++ obtain ⟨c₆, c₆pos, Tlb₆, Tlb₆bnd, hc₆⟩ := I6Bound ν_supp ContDiff1ν ++ holo2 ⟨σ₂_pos, σ₂_lt_one⟩ A_in_Ioc ++ ++ let C' := c_close + C_main ++ let C'' := c₁ + c₂ + c₈ + c₉ ++ let C''' := c₃ + c₄ + c₆ + c₇ ++ ++ let c : ℝ := A ^ ((1 : ℝ) / 2) / 4 ++ have cpos : 0 < c := by ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, ++ mem_Ioc, lt_sup_iff, ++ inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, ++ div_pos_iff_of_pos_right, σ₂, c] ++ obtain ⟨left, right⟩ := A_in_Ioc ++ positivity ++ refine ⟨c, cpos, ?_⟩ ++ rw [Asymptotics.isBigO_iff] ++ let C : ℝ := C' + C'' + C''' + c₅ ++ refine ⟨C, ?_⟩ ++ ++ let c_εx : ℝ := A ^ ((1 : ℝ) / 2) / 2 ++ have c_εx_pos : 0 < c_εx := by ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, ++ mem_Ioc, lt_sup_iff, ++ inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, ++ div_pos_iff_of_pos_right, σ₂, c, c_εx] ++ let c_Tx : ℝ := A ^ ((1 : ℝ) / 2) ++ have c_Tx_pos : 0 < c_Tx := by ++ simp_all only [one_div, support_subset_iff, ne_eq, mem_Icc, gt_iff_lt, mem_Ioo, and_imp, ++ mem_Ioc, lt_sup_iff, ++ inv_pos, Nat.ofNat_pos, or_true, sup_lt_iff, neg_le_self_iff, Nat.ofNat_nonneg, uIcc_of_le, ++ div_pos_iff_of_pos_right, σ₂, c, c_εx, c_Tx] ++ ++ let εx := (fun x ↦ Real.exp (-c_εx * (Real.log x) ^ ((1 : ℝ) / 2))) ++ let Tx := (fun x ↦ Real.exp (c_Tx * (Real.log x) ^ ((1 : ℝ) / 2))) ++ ++ have coeff_to_zero {B : ℝ} (B_le : B < 1) : ++ Tendsto (fun x ↦ Real.log x ^ (B - 1)) atTop (𝓝 0) := by ++ have B_minus_1_neg : B - 1 < 0 := by linarith ++ rw [← Real.zero_rpow (ne_of_lt B_minus_1_neg)] ++ rw [zero_rpow (ne_of_lt B_minus_1_neg)] ++ have one_minus_B_pos : 0 < 1 - B := by linarith ++ rw [show B - 1 = -(1 - B) by ring] ++ have : ∀ᶠ (x : ℝ) in atTop, Real.log x ^ (-(1 - B)) = (Real.log x ^ ((1 - B)))⁻¹ := by ++ filter_upwards [eventually_ge_atTop (1 : ℝ)] with x hx ++ apply Real.rpow_neg ++ exact Real.log_nonneg hx ++ rw [tendsto_congr' this] ++ apply tendsto_inv_atTop_zero.comp ++ apply (tendsto_rpow_atTop one_minus_B_pos).comp ++ exact tendsto_log_atTop ++ ++ have log_sub_log_pow_inf (c : ℝ) {B : ℝ} (B_le : B < 1) : ++ Tendsto (fun (x : ℝ) ↦ Real.log x - c * Real.log x ^ B) atTop atTop := by ++ have factor_form : ∀ x > 1, Real.log x - c * Real.log x ^ B = ++ Real.log x * (1 - c * Real.log x ^ (B - 1)) := by ++ intro x hx ++ ring_nf ++ congr! 1 ++ rw [mul_assoc, mul_comm (Real.log x), mul_assoc] ++ congr! 1 ++ have log_pos : 0 < Real.log x := Real.log_pos hx ++ rw [(by simp : Real.log x ^ (-1 + B) * Real.log x = ++ Real.log x ^ (-1 + B) * (Real.log x) ^ (1 : ℝ))] ++ rw [← Real.rpow_add log_pos] ++ ring_nf ++ have B_minus_1_neg : B - 1 < 0 := by linarith ++ have coeff_to_one : Tendsto (fun x ↦ 1 - c * Real.log x ^ (B - 1)) atTop (𝓝 1) := by ++ specialize coeff_to_zero B_le ++ apply Tendsto.const_mul c at coeff_to_zero ++ convert (tendsto_const_nhds (x := (1 : ℝ)) (f := (atTop : Filter ℝ))).sub coeff_to_zero ++ ring ++ ++ have eventually_pos : ∀ᶠ x in atTop, 0 < 1 - c * Real.log x ^ (B - 1) := by ++ apply (tendsto_order.mp coeff_to_one).1 ++ norm_num ++ ++ have eventually_factored : ∀ᶠ x in atTop, Real.log x - c * Real.log x ^ B = ++ Real.log x * (1 - c * Real.log x ^ (B - 1)) := by ++ filter_upwards [eventually_gt_atTop (1 : ℝ)] with x hx ++ exact factor_form x hx ++ ++ rw [tendsto_congr' eventually_factored] ++ apply Tendsto.atTop_mul_pos (by norm_num : (0 : ℝ) < 1) tendsto_log_atTop coeff_to_one ++ ++ have x_εx_eq (c B : ℝ) : ∀ᶠ (x : ℝ) in atTop, x * rexp (-c * Real.log x ^ B) = ++ rexp (Real.log x - c * Real.log x ^ B) := by ++ filter_upwards [eventually_gt_atTop 0] with x hx_pos ++ conv => ++ enter [1, 1] ++ rw [(Real.exp_log hx_pos).symm] ++ rw [← Real.exp_add] ++ ring_nf ++ ++ have x_ε_to_inf (c : ℝ) {B : ℝ} (B_le : B < 1) : Tendsto ++ (fun x ↦ x * Real.exp (-c * (Real.log x) ^ B)) atTop atTop := by ++ rw [tendsto_congr' (x_εx_eq c B)] ++ exact tendsto_exp_atTop.comp (log_sub_log_pow_inf c B_le) ++ ++ have Tx_to_inf : Tendsto Tx atTop atTop := by ++ unfold Tx ++ apply tendsto_exp_atTop.comp ++ apply Tendsto.pos_mul_atTop c_Tx_pos tendsto_const_nhds ++ exact (tendsto_rpow_atTop (by norm_num : 0 < (1 : ℝ) / 2)).comp Real.tendsto_log_atTop ++ ++ have ex_to_zero : Tendsto εx atTop (𝓝 0) := by ++ unfold εx ++ apply Real.tendsto_exp_atBot.comp ++ have this (x : ℝ) : -c_εx * Real.log x ^ ((1 : ℝ) / 2) = -(c_εx * Real.log x ^ ((1 : ℝ) / 2)) := by ++ ring ++ simp_rw [this] ++ rw [tendsto_neg_atBot_iff] ++ apply Tendsto.const_mul_atTop c_εx_pos ++ apply (tendsto_rpow_atTop (by norm_num)).comp ++ exact tendsto_log_atTop ++ ++ have eventually_εx_lt_one : ∀ᶠ (x : ℝ) in atTop, εx x < 1 := by ++ apply (tendsto_order.mp ex_to_zero).2 ++ norm_num ++ ++ have eventually_2_lt : ∀ᶠ (x : ℝ) in atTop, 2 < x * εx x := by ++ have := x_ε_to_inf c_εx (by norm_num : (1 : ℝ) / 2 < 1) ++ exact this.eventually_gt_atTop 2 ++ ++ have eventually_T_gt_3 : ∀ᶠ (x : ℝ) in atTop, 3 < Tx x := by ++ exact Tx_to_inf.eventually_gt_atTop 3 ++ ++ have eventually_T_gt_Tlb₄ : ∀ᶠ (x : ℝ) in atTop, Tlb₄ < Tx x := by ++ exact Tx_to_inf.eventually_gt_atTop _ ++ have eventually_T_gt_Tlb₆ : ∀ᶠ (x : ℝ) in atTop, Tlb₆ < Tx x := by ++ exact Tx_to_inf.eventually_gt_atTop _ ++ ++ have eventually_σ₂_lt_σ₁ : ∀ᶠ (x : ℝ) in atTop, σ₂ < 1 - A / (Real.log (Tx x)) := by ++ ++ apply (tendsto_order.mp ?_).1 ++ · exact σ₂_lt_one ++ have := tendsto_inv_atTop_zero.comp ((tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 1)).comp ++ (tendsto_log_atTop.comp Tx_to_inf)) ++ have := Tendsto.const_mul (b := A) this ++ convert (tendsto_const_nhds (x := (1 : ℝ))).sub this using 2 ++ · simp [Function.comp, div_eq_mul_inv] ++ · simp ++ ++ have eventually_ε_lt_ε_main : ∀ᶠ (x : ℝ) in atTop, εx x < ε_main := by ++ apply (tendsto_order.mp ex_to_zero).2 ++ assumption ++ ++ have event_logX_ge : ∀ᶠ (x : ℝ) in atTop, 1 ≤ Real.log x := by ++ apply Real.tendsto_log_atTop.eventually_ge_atTop ++ ++ have event_1_aux_1 {const1 const2 : ℝ} (const1pos : 0 < const1) (const2pos : 0 < const2) : ++ ∀ᶠ (x : ℝ) in atTop, ++ rexp (-const1 * Real.log x ^ const2) * Real.log x ≤ ++ rexp 0 := by ++ have := ((isLittleO_log_rpow_atTop const2pos).bound const1pos) ++ have : ∀ᶠ (x : ℝ) in atTop, Real.log (Real.log x) ≤ ++ const1 * (Real.log x) ^ const2 := by ++ have := tendsto_log_atTop.eventually this ++ filter_upwards [this, eventually_gt_atTop 100] with x hx x_gt ++ convert hx using 1 ++ · rw [Real.norm_of_nonneg] ++ apply Real.log_nonneg ++ have : (1 : ℝ) = Real.log (rexp 1) := by ++ exact Eq.symm (Real.log_exp 1) ++ ++ rw [this] ++ apply Real.log_le_log ++ · exact Real.exp_pos _ ++ · have := Real.exp_one_lt_d9 ++ ++ linarith ++ · congr! 1 ++ rw [Real.norm_of_nonneg] ++ apply Real.rpow_nonneg ++ apply Real.log_nonneg ++ linarith ++ have loglogx : ∀ᶠ (x : ℝ) in atTop, ++ Real.log x = rexp (Real.log (Real.log x)) := by ++ filter_upwards [eventually_gt_atTop 3] with x hx ++ rw [Real.exp_log] ++ apply Real.log_pos ++ linarith ++ filter_upwards [loglogx, this] with x loglogx hx ++ conv => ++ enter [1, 2] ++ rw [loglogx] ++ rw [← Real.exp_add] ++ apply Real.exp_monotone ++ grw [hx] ++ simp ++ ++ have event_1_aux {const1 const1' const2 : ℝ} (const1bnds : const1' < const1) ++ (const2pos : 0 < const2) : ++ ∀ᶠ (x : ℝ) in atTop, ++ rexp (-const1 * Real.log x ^ const2) * Real.log x ≤ ++ rexp (-const1' * Real.log x ^ const2) := by ++ have : 0 < const1 - const1' := by linarith ++ filter_upwards [event_1_aux_1 this const2pos] with x hx ++ have : rexp (-const1 * Real.log x ^ const2) * Real.log x ++ = rexp (-(const1') * Real.log x ^ const2) ++ * rexp (-(const1 - const1') * Real.log x ^ const2) * Real.log x := by ++ congr! 1 ++ rw [← Real.exp_add] ++ congr! 1 ++ ring ++ rw [this] ++ rw [mul_assoc] ++ grw [hx] ++ simp ++ ++ have event_1 : ∀ᶠ (x : ℝ) in atTop, C' * (εx x) * x * Real.log x ≤ ++ C' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by ++ unfold c εx c_εx ++ have : 0 < (A ^ ((1 : ℝ) / 2) / 4) := by ++ positivity ++ have const1bnd : (A ^ ((1 : ℝ) / 2) / 4) < (A ^ ((1 : ℝ) / 2) / 2) := by ++ linarith ++ have const2bnd : (0 : ℝ) < 1 / 2 := by norm_num ++ have this (x : ℝ) : ++ C' * rexp (-(A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) * x * Real.log x = ++ C' * x * (rexp (-(A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) * Real.log x) := by ring ++ simp_rw [this] ++ filter_upwards [event_1_aux const1bnd const2bnd, eventually_gt_atTop 3] with x x_bnd x_gt ++ grw [x_bnd] ++ ++ have event_2 : ∀ᶠ (x : ℝ) in atTop, C'' * x * Real.log x / (εx x * Tx x) ≤ ++ C'' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by ++ unfold c εx c_εx Tx c_Tx ++ set const2 : ℝ := 1 / 2 ++ have const2bnd : 0 < const2 := by norm_num ++ set const1 := (A ^ const2 / 2) ++ set const1' := (A ^ const2 / 4) ++ have : 0 < A ^ const2 := by ++ unfold const2 ++ ++ apply Real.rpow_pos_of_pos ++ exact A_in_Ioc.1 ++ have this (x : ℝ) : -(-const1 * Real.log x ^ const2 + A ^ const2 * Real.log x ^ const2) = ++ -(A ^ const2 - const1) * Real.log x ^ const2 := by ring ++ simp_rw [← Real.exp_add, div_eq_mul_inv, ← Real.exp_neg, this] ++ have const1bnd : const1' < (A ^ const2 - const1) := by ++ unfold const1' const1 ++ linarith ++ filter_upwards [event_1_aux const1bnd const2bnd, eventually_gt_atTop 3] with x x_bnd x_gt ++ rw [mul_assoc] ++ conv => ++ enter [1, 2] ++ rw [mul_comm] ++ grw [x_bnd] ++ ++ have event_3_aux {const1 const1' const2 : ℝ} (const2_eq : const2 = 1 / 2) ++ (const1_eq : const1 = (A ^ const2 / 2)) (const1'_eq : const1' = (A ^ const2 / 4)) : ++ ∀ᶠ (x : ℝ) in atTop, ++ x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2)) ^ (1 : ℝ)) * ++ rexp (-(-const1 * Real.log x ^ const2)) ≤ ++ rexp (-const1' * Real.log x ^ const2) := by ++ have : ∀ᶠ (x : ℝ) in atTop, x = rexp (Real.log x) := by ++ filter_upwards [eventually_gt_atTop 0] with x hx ++ rw [Real.exp_log hx] ++ filter_upwards [this, eventually_gt_atTop 3] with x hx x_gt_3 ++ have logxpos : 0 < Real.log x := by apply Real.log_pos; linarith ++ conv => ++ enter [1, 1, 1] ++ rw [hx] ++ rw [← Real.exp_mul] ++ rw [Real.log_exp] ++ rw [Real.mul_rpow] ++ · have {y : ℝ} (ypos : 0 < y) : y / (y ^ const2) ^ (1 : ℝ) = y ^ const2 := by ++ rw [← Real.rpow_mul ypos.le] ++ rw [div_eq_mul_inv] ++ rw [← Real.rpow_neg ypos.le] ++ conv => ++ enter [1, 1] ++ rw [← Real.rpow_one y] ++ rw [← Real.rpow_add ypos] ++ rw [(by linarith : 1 + -(const2 * 1) = const2)] ++ rw [div_mul_eq_div_div] ++ rw [neg_div] ++ rw [this (A_in_Ioc.1)] ++ ++ rw [mul_div] ++ conv => ++ enter [1, 1, 1, 1] ++ rw [mul_comm] ++ rw [← mul_div] ++ ++ rw [this (y := Real.log x) logxpos] ++ ++ rw [← Real.exp_add] ++ apply Real.exp_monotone ++ ++ have : -A ^ const2 * Real.log x ^ const2 + -(-const1 * Real.log x ^ const2) ++ = (-(A ^ const2 - const1) * Real.log x ^ const2) := by ring ++ rw [this] ++ ++ gcongr ++ ++ rw [const1'_eq, const1_eq] ++ have : 0 ≤ A ^ const2 := by ++ apply Real.rpow_nonneg A_in_Ioc.1.le ++ linarith ++ · rw [const2_eq] ++ rw [←Real.sqrt_eq_rpow] ++ apply Real.sqrt_nonneg ++ ++ · apply Real.rpow_nonneg ++ apply Real.log_nonneg ++ linarith ++ ++ have event_3 : ∀ᶠ (x : ℝ) in atTop, C''' * x * x ^ (-A / Real.log (Tx x) ) / (εx x) ≤ ++ C''' * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by ++ unfold c Tx c_Tx εx c_εx ++ set const2 : ℝ := 1 / 2 ++ have const2eq : const2 = 1 / 2 := by rfl ++ have const2bnd : 0 < const2 := by norm_num ++ set const1 := (A ^ const2 / 2) ++ have const1eq : const1 = (A ^ const2 / 2) := by rfl ++ set const1' := (A ^ const2 / 4) ++ have const1'eq : const1' = (A ^ const2 / 4) := by rfl ++ have A_pow_pos : 0 < A ^ const2 := by ++ unfold const2 ++ apply Real.rpow_pos_of_pos ++ exact A_in_Ioc.1 ++ ++ conv => ++ enter [1, x, 1] ++ rw [div_eq_mul_inv, ← Real.exp_neg] ++ ++ filter_upwards [event_3_aux const2eq const1eq const1'eq, ++ eventually_gt_atTop 3] with x x_bnd x_gt ++ ++ have this (x : ℝ) : C''' * x * x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2))) ++ * rexp (-(-const1 * Real.log x ^ const2)) ++ = C''' * x * (x ^ (-A / Real.log (rexp (A ^ const2 * Real.log x ^ const2))) ++ * rexp (-(-const1 * Real.log x ^ const2))) := by ++ ring ++ rw [this] ++ rw [rpow_one] at x_bnd ++ grw [x_bnd] ++ ++ have event_4_aux4 {pow2 : ℝ} (pow2_neg : pow2 < 0) {c : ℝ} (cpos : 0 < c) (c' : ℝ) : ++ Tendsto (fun x ↦ c' * Real.log x ^ pow2) atTop (𝓝 0) := by ++ rw [← mul_zero c'] ++ apply Tendsto.const_mul ++ have := tendsto_rpow_neg_atTop (y := -pow2) (by linarith) ++ rw [neg_neg] at this ++ apply this.comp ++ exact Real.tendsto_log_atTop ++ ++ have event_4_aux3 {pow2 : ℝ} (pow2_neg : pow2 < 0) {c : ℝ} (cpos : 0 < c) (c' : ℝ) : ++ ∀ᶠ (x : ℝ) in atTop, c' * (Real.log x) ^ pow2 < c := by ++ apply (event_4_aux4 pow2_neg cpos c').eventually_lt_const ++ exact cpos ++ ++ have event_4_aux2 {c1 : ℝ} (c1pos : 0 < c1) (c2 : ℝ) {pow1 : ℝ} (pow1_lt : pow1 < 1) : ++ ∀ᶠ (x : ℝ) in atTop, 0 ≤ Real.log x * (c1 - c2 * (Real.log x) ^ (pow1 - 1)) := by ++ filter_upwards [eventually_gt_atTop 3 , event_4_aux3 (by linarith : pow1 - 1 < 0) ++ (by linarith : 0 < c1 / 2) c2] with x x_gt hx ++ have : 0 ≤ Real.log x := by ++ apply Real.log_nonneg ++ linarith ++ apply mul_nonneg this ++ linarith ++ ++ have event_4_aux1 {const1 : ℝ} (const1_lt : const1 < 1) (const2 const3 : ℝ) ++ {pow1 : ℝ} (pow1_lt : pow1 < 1) : ∀ᶠ (x : ℝ) in atTop, ++ const1 * Real.log x + const2 * Real.log x ^ pow1 ++ ≤ Real.log x - const3 * Real.log x ^ pow1 := by ++ filter_upwards [event_4_aux2 (by linarith : 0 < 1 - const1) (const2 + const3) pow1_lt, ++ eventually_gt_atTop 3] with x hx x_gt ++ rw [← sub_nonneg] ++ have : ++ Real.log x - const3 * Real.log x ^ pow1 - (const1 * Real.log x + const2 * Real.log x ^ pow1) ++ = (1 - const1) * Real.log x - (const2 + const3) * Real.log x ^ pow1 := by ring ++ rw [this] ++ convert hx using 1 ++ ring_nf ++ congr! 1 ++ have : Real.log x * const2 * Real.log x ^ (-1 + pow1) ++ = const2 * Real.log x ^ pow1 := by ++ rw [mul_assoc, mul_comm, mul_assoc] ++ congr! 1 ++ conv => ++ enter [1, 2] ++ rw [← Real.rpow_one (Real.log x)] ++ rw [← Real.rpow_add (Real.log_pos (by linarith))] ++ ring_nf ++ rw [this] ++ have : Real.log x * const3 * Real.log x ^ (-1 + pow1) ++ = const3 * Real.log x ^ pow1 := by ++ rw [mul_assoc, mul_comm, mul_assoc] ++ congr! 1 ++ conv => ++ enter [1, 2] ++ rw [← Real.rpow_one (Real.log x)] ++ rw [← Real.rpow_add (Real.log_pos (by linarith))] ++ ring_nf ++ rw [this] ++ ++ have event_4_aux : ∀ᶠ (x : ℝ) in atTop, ++ c₅ * rexp (σ₂ * Real.log x + (A ^ ((1 : ℝ) / 2) / 2) * Real.log x ^ ((1 : ℝ) / 2)) ≤ ++ c₅ * rexp (Real.log x - (A ^ ((1 : ℝ) / 2) / 4) * Real.log x ^ ((1 : ℝ) / 2)) := by ++ filter_upwards [eventually_gt_atTop 3, event_4_aux1 σ₂_lt_one (A ^ ((1 : ℝ) / 2) / 2) ++ (A ^ ((1 : ℝ) / 2) / 4) (by norm_num : (1 : ℝ) / 2 < 1)] with x x_gt hx ++ rw [mul_le_mul_iff_right₀ c₅pos] ++ apply Real.exp_monotone ++ convert hx ++ ++ have event_4 : ∀ᶠ (x : ℝ) in atTop, c₅ * x ^ σ₂ / (εx x) ≤ ++ c₅ * x * rexp (-c * Real.log x ^ ((1 : ℝ) / 2)) := by ++ unfold εx c_εx c ++ filter_upwards [event_4_aux, eventually_gt_atTop 0] with x hx xpos ++ convert hx using 1 ++ · rw [← mul_div] ++ congr! 1 ++ rw [div_eq_mul_inv, ← Real.exp_neg] ++ conv => ++ enter [1, 1, 1] ++ rw [← Real.exp_log xpos] ++ rw [← exp_mul, ← Real.exp_add] ++ ring_nf ++ ++ · rw [mul_assoc] ++ congr! 1 ++ conv => ++ enter [1, 1] ++ rw [← Real.exp_log xpos] ++ rw [← Real.exp_add] ++ ring_nf ++ ++ filter_upwards [eventually_gt_atTop 3, eventually_εx_lt_one, eventually_2_lt, ++ eventually_T_gt_3, eventually_T_gt_Tlb₄, eventually_T_gt_Tlb₆, ++ eventually_σ₂_lt_σ₁, eventually_ε_lt_ε_main, event_logX_ge, event_1, event_2, ++ event_3, event_4] with X X_gt_3 ε_lt_one ε_X T_gt_3 T_gt_Tlb₄ T_gt_Tlb₆ ++ σ₂_lt_σ₁ ε_lt_ε_main logX_ge event_1 event_2 event_3 event_4 ++ ++ clear eventually_εx_lt_one eventually_2_lt eventually_T_gt_3 eventually_T_gt_Tlb₄ ++ eventually_T_gt_Tlb₆ eventually_σ₂_lt_σ₁ eventually_ε_lt_ε_main event_logX_ge zeta_bnd ++ ++ let ε : ℝ := εx X ++ have ε_pos : 0 < ε := by positivity ++ specialize h_close X X_gt_3 ε ε_pos ε_lt_one ε_X ++ let ψ_ε_of_X := SmoothedChebyshev ν ε X ++ ++ let T : ℝ := Tx X ++ specialize holo1 T T_gt_3.le ++ let σ₁ : ℝ := 1 - A / (Real.log T) ++ have σ₁pos : 0 < σ₁ := by calc ++ 1 - A / (Real.log T) >= 1 - (1/2) / 1 := by ++ gcongr ++ · exact A_in_Ioc.2 ++ · apply (Real.le_log_iff_exp_le (by positivity)).mpr ++ linarith[Real.exp_one_lt_d9] ++ _ > 0 := by norm_num ++ have σ₁_lt_one : σ₁ < 1 := by ++ apply sub_lt_self ++ apply div_pos A_in_Ioc.1 ++ bound ++ ++ rw [uIcc_of_le (by linarith), uIcc_of_le (by linarith)] at holo2 ++ ++ have holo1_compat : HolomorphicOn (ζ' / ζ) (Icc σ₁ 2 ×ℂ Icc (-T) T \ {1}) := by ++ ++ simpa [σ₁, pow_one] using! holo1 ++ ++ have holo2a : HolomorphicOn (SmoothedChebyshevIntegrand ν ε X) ++ (Icc σ₂ 2 ×ℂ Icc (-3) 3 \ {1}) := by ++ apply DifferentiableOn.mul ++ · apply DifferentiableOn.mul ++ · rw [(by ext; ring : (fun s ↦ -ζ' s / ζ s) = (fun s ↦ -(ζ' s / ζ s)))] ++ apply DifferentiableOn.neg holo2 ++ · intro s hs ++ apply DifferentiableAt.differentiableWithinAt ++ apply Smooth1MellinDifferentiable ContDiff1ν ν_supp ⟨ε_pos, ε_lt_one⟩ ν_nonneg ν_massOne ++ linarith[mem_reProdIm.mp hs.1 |>.1.1] ++ · intro s hs ++ apply DifferentiableAt.differentiableWithinAt ++ apply DifferentiableAt.const_cpow (by fun_prop) ++ left ++ norm_cast ++ linarith ++ have ψ_ε_diff : ‖ψ_ε_of_X - 𝓜 ((Smooth1 ν ε) ·) 1 * X‖ ≤ ‖I₁ ν ε X T‖ + ‖I₂ ν ε T X σ₁‖ ++ + ‖I₃ ν ε T X σ₁‖ + ‖I₄ ν ε X σ₁ σ₂‖ + ‖I₅ ν ε X σ₂‖ + ‖I₆ ν ε X σ₁ σ₂‖ + ‖I₇ ν ε T X σ₁‖ ++ + ‖I₈ ν ε T X σ₁‖ + ‖I₉ ν ε X T‖ := by ++ unfold ψ_ε_of_X ++ rw [SmoothedChebyshevPull1 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith) ++ σ₁pos σ₁_lt_one holo1_compat ν_supp ν_nonneg ν_massOne ContDiff1ν] ++ rw [SmoothedChebyshevPull2 ε_pos ε_lt_one X X_gt_3 (T := T) (by linarith) ++ σ₂_pos σ₁_lt_one σ₂_lt_σ₁ holo1_compat holo2a ν_supp ν_nonneg ν_massOne ContDiff1ν] ++ ring_nf ++ iterate 5 ++ apply le_trans (by apply norm_add_le) ++ gcongr ++ exact (norm_sub_le _ _).trans ++ (add_le_add ((norm_add_le _ _).trans ++ (add_le_add (norm_sub_le _ _) le_rfl)) le_rfl) ++ ++ specialize h_main ε ⟨ε_pos, ε_lt_ε_main⟩ ++ have main : ‖𝓜 ((Smooth1 ν ε) ·) 1 * X - X‖ ≤ C_main * ε * X := by ++ nth_rewrite 2 [← one_mul X] ++ push_cast ++ rw [← sub_mul, norm_mul] ++ gcongr ++ rw [norm_real, norm_of_nonneg (by linarith)] ++ specialize hc₁ ε ε_pos ε_lt_one X X_gt_3 T_gt_3 ++ specialize hc₂ X X_gt_3 ε_pos ε_lt_one T_gt_3 ++ specialize hc₃ X X_gt_3 ε_pos ε_lt_one T_gt_3 ++ specialize hc₅ X X_gt_3 ε_pos ε_lt_one ++ specialize hc₇ X X_gt_3 ε_pos ε_lt_one T_gt_3 ++ specialize hc₈ X X_gt_3 ε_pos ε_lt_one T_gt_3 ++ specialize hc₉ ε_pos ε_lt_one X X_gt_3 T_gt_3 ++ specialize hc₄ X X_gt_3 ε_pos ε_lt_one T_gt_Tlb₄ ++ specialize hc₆ X X_gt_3 ε_pos ε_lt_one T_gt_Tlb₆ ++ ++ clear ν_nonneg ν_massOne ContDiff1ν ν_supp holo2 ++ ++ have C'bnd : c_close * ε * X * Real.log X + C_main * ε * X ≤ C' * ε * X * Real.log X := by ++ have : C_main * ε * X * 1 ≤ C_main * ε * X * Real.log X := by ++ gcongr ++ linarith ++ ++ have C''bnd : c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) + c₈ * X / (ε * T) ++ + c₉ * X * Real.log X / (ε * T) ≤ C'' * X * Real.log X / (ε * T) := by ++ unfold C'' ++ rw [(by ring : (c₁ + c₂ + c₈ + c₉) * X * Real.log X / (ε * T) ++ = c₁ * X * Real.log X / (ε * T) + c₂ * X * Real.log X / (ε * T) ++ + c₈ * X * Real.log X / (ε * T) + c₉ * X * Real.log X / (ε * T))] ++ have : c₂ * X / (ε * T) * 1 ≤ c₂ * X / (ε * T) * Real.log X := by ++ gcongr ++ have : c₂ * X / (ε * T) ≤ c₂ * X * Real.log X / (ε * T) := by ++ ring_nf at this ⊢ ++ linarith ++ grw [this] ++ have : c₈ * X / (ε * T) * 1 ≤ c₈ * X / (ε * T) * Real.log X := by ++ gcongr ++ have : c₈ * X / (ε * T) ≤ c₈ * X * Real.log X / (ε * T) := by ++ ring_nf at this ⊢ ++ linarith ++ grw [this] ++ ++ have C'''bnd : c₃ * X * X ^ (-A / Real.log T) / ε ++ + c₄ * X * X ^ (-A / Real.log T) / ε ++ + c₆ * X * X ^ (-A / Real.log T) / ε ++ + c₇ * X * X ^ (-A / Real.log T) / ε ++ ≤ C''' * X * X ^ (-A / Real.log T) / ε := by ++ apply le_of_eq ++ ring ++ ++ calc ++ _ = ‖(ψ X - ψ_ε_of_X) + (ψ_ε_of_X - X)‖ := by ring_nf; norm_cast ++ _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖ψ_ε_of_X - X‖ := norm_add_le _ _ ++ _ = ‖ψ X - ψ_ε_of_X‖ + ‖(ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X) ++ + (𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X)‖ := by ring_nf ++ _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X‖ ++ + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ := by ++ rw [add_assoc] ++ gcongr ++ apply norm_add_le ++ _ = ‖ψ X - ψ_ε_of_X‖ + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ ++ + ‖ψ_ε_of_X - 𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X‖ := by ring ++ _ ≤ ‖ψ X - ψ_ε_of_X‖ + ‖𝓜 (fun x ↦ (Smooth1 ν ε x)) 1 * X - X‖ ++ + (‖I₁ ν ε X T‖ + ‖I₂ ν ε T X σ₁‖ + ‖I₃ ν ε T X σ₁‖ + ‖I₄ ν ε X σ₁ σ₂‖ ++ + ‖I₅ ν ε X σ₂‖ + ‖I₆ ν ε X σ₁ σ₂‖ + ‖I₇ ν ε T X σ₁‖ + ‖I₈ ν ε T X σ₁‖ ++ + ‖I₉ ν ε X T‖) := by gcongr ++ _ ≤ c_close * ε * X * Real.log X + C_main * ε * X ++ + (c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) ++ + c₃ * X * X ^ (-A / Real.log T) / ε ++ + c₄ * X * X ^ (-A / Real.log T) / ε ++ + c₅ * X ^ σ₂ / ε ++ + c₆ * X * X ^ (-A / Real.log T) / ε ++ + c₇ * X * X ^ (-A / Real.log T) / ε ++ + c₈ * X / (ε * T) ++ + c₉ * X * Real.log X / (ε * T)) := by ++ gcongr ++ convert! h_close using 1 ++ rw [← norm_neg] ++ congr ++ ring ++ ++ change ‖I₂ ν ε (Tx X) X σ₁‖ ≤ c₂ * X / (ε * (Tx X)) ++ dsimp at hc₂ ++ dsimp [σ₁] ++ ++ unfold sigma1Of at hc₂ ++ ++ exact hc₂ ++ ++ _ = (c_close * ε * X * Real.log X + C_main * ε * X) ++ + ((c₁ * X * Real.log X / (ε * T) + c₂ * X / (ε * T) ++ + c₈ * X / (ε * T) ++ + c₉ * X * Real.log X / (ε * T)) ++ + (c₃ * X * X ^ (-A / Real.log T) / ε ++ + c₄ * X * X ^ (-A / Real.log T) / ε ++ + c₆ * X * X ^ (-A / Real.log T) / ε ++ + c₇ * X * X ^ (-A / Real.log T) / ε) ++ + c₅ * X ^ σ₂ / ε ++ ) := by ring ++ _ ≤ C' * ε * X * Real.log X ++ + (C'' * X * Real.log X / (ε * T) ++ + C''' * X * X ^ (-A / Real.log T) / ε ++ + c₅ * X ^ σ₂ / ε ++ ) := by ++ gcongr ++ _ = C' * ε * X * Real.log X ++ + C'' * X * Real.log X / (ε * T) ++ + C''' * X * X ^ (-A / Real.log T) / ε ++ + c₅ * X ^ σ₂ / ε ++ := by ring ++ _ ≤ C' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) ++ + C'' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) ++ + C''' * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) ++ + c₅ * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) ++ := by ++ gcongr ++ _ = C * X * rexp (-c * Real.log X ^ ((1 : ℝ) / 2)) ++ := by ring ++ _ = _ := by ++ rw [Real.norm_of_nonneg] ++ · rw [← mul_assoc] ++ · positivity ++ ++end Erdos970 +diff --git a/StrongPNT/Erdos970/Z0.lean b/StrongPNT/Erdos970/Z0.lean +new file mode 100644 +index 0000000..093671d +--- /dev/null ++++ b/StrongPNT/Erdos970/Z0.lean +@@ -0,0 +1,60 @@ ++import PrimeNumberTheoremAnd.Erdos970.ZetaBounds ++import StrongPNT.Erdos970.PNT3_RiemannZeta ++ ++namespace Erdos970 ++ ++open _root_.Complex Topology Filter Interval _root_.Set Asymptotics ++ ++local notation (name := riemannzeta1) "ζ" => riemannZeta ++local notation (name := derivriemannzeta1) "ζ'" => deriv riemannZeta ++ ++lemma Z0bound_aux : ++ Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => -(ζ' / ζ) ((1 : ℂ) + delta) - (1 / (delta : ℂ))) (fun _ => (1 : ℂ)) := by ++ ++ let F := fun s : ℂ => -(ζ' / ζ) s - (s - 1)⁻¹ ++ ++ have h_F_bigO : F =O[𝓝[≠] 1] (1 : ℂ → ℂ) := by ++ have h_fun_eq : F = (-ζ' / ζ - fun z ↦ (z - 1)⁻¹) := by ++ ext s ++ simp only [F, Pi.sub_apply, Pi.neg_apply, Pi.div_apply, neg_div] ++ rw [h_fun_eq] ++ exact riemannZetaLogDerivResidueBigO ++ ++ let u := fun (delta : ℝ) => (1 : ℂ) + delta ++ have h_tendsto : Tendsto u (nhdsWithin 0 (Set.Ioi 0)) (𝓝[≠] 1) := by ++ ++ apply tendsto_inf.mpr ++ constructor ++ · ++ have h_cont : Continuous u := continuous_const.add continuous_ofReal ++ ++ have h_tendsto_nhds : Tendsto u (𝓝 0) (𝓝 (u 0)) := h_cont.continuousAt.tendsto ++ ++ simp only [u, Complex.ofReal_zero, add_zero] at h_tendsto_nhds ++ ++ exact h_tendsto_nhds.mono_left nhdsWithin_le_nhds ++ · ++ ++ simp ++ ++ filter_upwards [self_mem_nhdsWithin] with delta h_delta_pos ++ simp only [u] ++ ++ refine add_ne_left.mpr ?_ ++ rw [Complex.ofReal_ne_zero] ++ exact ne_of_gt h_delta_pos ++ ++ have h_comp := h_F_bigO.comp_tendsto h_tendsto ++ ++ convert h_comp using 1 ++ ext delta ++ ++ simp only [F, u, Function.comp_apply, Pi.div_apply] ++ rw [inv_eq_one_div] ++ aesop ++ all_goals rfl ++ ++lemma Z0bound : ++ Asymptotics.IsBigO (nhdsWithin 0 (Set.Ioi 0)) (fun (delta : ℝ) => -logDerivZeta ((1 : ℂ) + delta) - (1 / (delta : ℂ))) (fun _ => (1 : ℂ)) := Z0bound_aux ++ ++end Erdos970 +diff --git a/StrongPNT/Erdos970/ZetaZeroFree.lean b/StrongPNT/Erdos970/ZetaZeroFree.lean +new file mode 100644 +index 0000000..10f11b5 +--- /dev/null ++++ b/StrongPNT/Erdos970/ZetaZeroFree.lean +@@ -0,0 +1,240 @@ ++import StrongPNT.Erdos970.PNT4_ZeroFreeRegion ++import Mathlib.Analysis.Calculus.ContDiff.Defs ++import Mathlib.Analysis.Asymptotics.Defs ++import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic ++import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus ++import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts ++import Mathlib.Analysis.Calculus.Deriv.Basic ++import Mathlib.NumberTheory.LSeries.RiemannZeta ++import Mathlib.Algebra.Group.Basic ++import PrimeNumberTheoremAnd.Erdos970.ResidueCalcOnRectangles ++import PrimeNumberTheoremAnd.Erdos970.MellinCalculus ++import Mathlib.MeasureTheory.Function.Floor ++import Mathlib.Analysis.Complex.CauchyIntegral ++import Mathlib.NumberTheory.Harmonic.Bounds ++import Mathlib.MeasureTheory.Order.Group.Lattice ++import PrimeNumberTheoremAnd.Erdos970.Mathlib.Analysis.SpecialFunctions.Log.Basic ++import Mathlib.Tactic.Bound ++import Mathlib.NumberTheory.LSeries.PrimesInAP ++import Mathlib.Tactic.FunProp ++import PrimeNumberTheoremAnd.Erdos970.Fourier ++import PrimeNumberTheoremAnd.Erdos970.ZetaBounds ++ ++namespace Erdos970 ++ ++open _root_.Complex Topology _root_.Filter Interval _root_.Set Asymptotics ++local notation (name := riemannzeta') "ζ" => riemannZeta ++local notation (name := derivriemannzeta') "ζ'" => deriv riemannZeta ++ ++local notation "I" => Complex.I ++ ++lemma ZetaNoZerosOn1Line' (t : ℝ) : ζ (1 + t * I) ≠ 0 := by ++ refine riemannZeta_ne_zero_of_one_le_re ?_ ++ simp ++ ++lemma ZetaCont' : ContinuousOn ζ (univ \ {1}) := by ++ apply continuousOn_of_forall_continuousAt (fun x hx ↦ ?_) ++ apply DifferentiableAt.continuousAt (𝕜 := ℂ) ++ convert differentiableAt_riemannZeta ?_ ++ simp only [Set.mem_sdiff, mem_univ, mem_singleton_iff, true_and] at hx ++ exact hx ++ ++lemma ZetaNoZerosInBox' (T : ℝ) : ++ ∃ (σ : ℝ) (_ : σ < 1), ∀ (t : ℝ) (_ : |t| ≤ T) ++ (σ' : ℝ) (_ : σ' ≥ σ), ζ (σ' + t * I) ≠ 0 := by ++ by_contra h ++ push Not at h ++ ++ have hn (n : ℕ) := h (σ := 1 - 1 / (n + 1)) (sub_lt_self _ (by positivity)) ++ ++ have : ∃ (tn : ℕ → ℝ) (σn : ℕ → ℝ), (∀ n, σn n ≤ 1) ∧ ++ (∀ n, (1 : ℝ) - 1 / (n + 1) ≤ σn n) ∧ (∀ n, |tn n| ≤ T) ∧ ++ (∀ n, ζ (σn n + tn n * I) = 0) := by ++ choose t ht σ' hσ' hζ using hn ++ refine ⟨t, σ', ?_, hσ', ht, hζ⟩ ++ intro n ++ by_contra hσn ++ push Not at hσn ++ have := riemannZeta_ne_zero_of_one_lt_re (s := σ' n + t n * I) ++ simp only [add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, sub_self, ++ add_zero, ne_eq] at this ++ exact this hσn (hζ n) ++ ++ choose t σ' hσ'_le hσ'_ge ht hζ using this ++ ++ have σTo1 : Filter.Tendsto σ' Filter.atTop (𝓝 1) := by ++ have hlow : Tendsto (fun n : ℕ => (1 : ℝ) - 1 / (n + 1)) atTop (𝓝 1) := by ++ simpa using! (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).const_sub 1 ++ exact tendsto_of_tendsto_of_tendsto_of_le_of_le hlow tendsto_const_nhds hσ'_ge hσ'_le ++ ++ have : ∃ (t₀ : ℝ) (subseq : ℕ → ℕ), ++ Filter.Tendsto (t ∘ subseq) Filter.atTop (𝓝 t₀) ∧ ++ Filter.Tendsto subseq Filter.atTop Filter.atTop := by ++ refine (isCompact_Icc.isSeqCompact fun and => abs_le.1 (ht and)).imp fun and ⟨x, A, B, _⟩ => ?_ ++ use A, by valid, B.tendsto_atTop ++ ++ obtain ⟨t₀, subseq, tTendsto, subseqTendsto⟩ := this ++ ++ have σTo1 : Filter.Tendsto (σ' ∘ subseq) Filter.atTop (𝓝 1) := ++ σTo1.comp subseqTendsto ++ ++ have (n : ℕ) : ζ (σ' (subseq n) + I * (t (subseq n))) = 0 := by ++ convert hζ (subseq n) using 3 ++ ring ++ ++ have ToOneT0 : Filter.Tendsto (fun n ↦ (σ' (subseq n) : ℂ) + Complex.I * (t (subseq n))) Filter.atTop ++ (𝓝[≠]((1 : ℂ) + I * t₀)) := by ++ simp_rw [tendsto_nhdsWithin_iff, Function.comp_def] at tTendsto ⊢ ++ constructor ++ · exact (σTo1.ofReal.add (tTendsto.ofReal.const_mul _)).trans (by simp) ++ · filter_upwards with n ++ apply ne_of_apply_ne ζ ++ rw [this] ++ apply Ne.symm ++ apply riemannZeta_ne_zero_of_one_le_re ++ simp only [add_re, one_re, mul_re, I_re, ofReal_re, zero_mul, I_im, ofReal_im, mul_zero, ++ sub_self, add_zero, le_refl] ++ ++ by_cases ht₀ : t₀ = 0 ++ · have ZetaBlowsUp : ∀ᶠ s in 𝓝[≠](1 : ℂ), ‖ζ s‖ ≥ 1 := by ++ have hprod : Tendsto (fun s : ℂ => ‖(s - 1) * ζ s‖) (𝓝[≠] 1) (𝓝 1) := by ++ simpa only [norm_one] using! riemannZeta_residue_one.norm ++ have hid : Tendsto (fun s : ℂ => s) (𝓝[≠] 1) (𝓝 1) := ++ tendsto_id.mono_left nhdsWithin_le_nhds ++ have hdist : Tendsto (fun s : ℂ => ‖s - 1‖) (𝓝[≠] 1) (𝓝 0) := by ++ simpa only [sub_self, norm_zero] using! (hid.sub_const 1).norm ++ filter_upwards [hprod.eventually_const_lt (by norm_num : (1 / 2 : ℝ) < 1), ++ hdist.eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 2)] with s hp hs ++ by_contra h ++ have hlt : ‖ζ s‖ < 1 := lt_of_not_ge h ++ have hm := mul_le_mul_of_nonneg_left hlt.le (norm_nonneg (s - 1)) ++ rw [norm_mul] at hp ++ rw [mul_one] at hm ++ linarith ++ ++ have ZetaNonZ : ∀ᶠ s in 𝓝[≠](1 : ℂ), ζ s ≠ 0 := by ++ filter_upwards [ZetaBlowsUp] ++ intro s hs hfalse ++ rw [hfalse] at hs ++ simp only [norm_zero, ge_iff_le] at hs ++ linarith ++ ++ rw [ht₀] at ToOneT0 ++ simp only [ofReal_zero, mul_zero, add_zero] at ToOneT0 ++ rcases (ToOneT0.eventually ZetaNonZ).exists with ⟨n, hn⟩ ++ exact hn (this n) ++ ++ · have zetaIsZero : ζ (1 + Complex.I * t₀) = 0 := by ++ have hpoint : (1 + Complex.I * t₀ : ℂ) ≠ 1 := by ++ intro heq ++ have him := congrArg Complex.im heq ++ have htzero : t₀ = 0 := by simpa using him ++ exact ht₀ htzero ++ have hcont := (differentiableAt_riemannZeta hpoint).continuousAt ++ have hlim : Tendsto (fun n : ℕ => ζ (σ' (subseq n) + I * t (subseq n))) atTop ++ (𝓝 (ζ (1 + I * t₀))) := by ++ simpa only [Function.comp_def] using! ++ hcont.tendsto.comp (ToOneT0.mono_right nhdsWithin_le_nhds) ++ have hfun : (fun n : ℕ => ζ (σ' (subseq n) + I * t (subseq n))) = (fun _ => 0) := ++ funext this ++ rw [hfun] at hlim ++ exact tendsto_nhds_unique hlim tendsto_const_nhds ++ ++ exact riemannZeta_ne_zero_of_one_le_re (s := 1 + I * t₀) (by simp) zetaIsZero ++ ++lemma LogDerivZetaHoloOn' {S : Set ℂ} (s_ne_one : 1 ∉ S) ++ (nonzero : ∀ s ∈ S, ζ s ≠ 0) : ++ HolomorphicOn (fun s ↦ ζ' s / ζ s) S := by ++ apply DifferentiableOn.div _ _ nonzero <;> intro s hs <;> apply DifferentiableAt.differentiableWithinAt ++ · apply differentiableAt_deriv_riemannZeta ++ exact ne_of_mem_of_not_mem hs s_ne_one ++ · apply differentiableAt_riemannZeta ++ exact ne_of_mem_of_not_mem hs s_ne_one ++ ++theorem LogDerivZetaHolcSmallT' : ++ ∃ (σ₂ : ℝ) (_ : σ₂ < 1), HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) ++ (( [[ σ₂, 2 ]] ×ℂ [[ -3, 3 ]]) \ {1}) := by ++ obtain ⟨σ₂, hσ₂_lt_one, hζ_ne_zero⟩ := ZetaNoZerosInBox 3 ++ refine ⟨σ₂, hσ₂_lt_one, ?_⟩ ++ let U := ([[σ₂, 2]] ×ℂ [[-3, 3]]) \ {1} ++ have s_in_U_im_le3 : ∀ s ∈ U, |s.im| ≤ 3 := by ++ intro s hs ++ rw [mem_sdiff_singleton] at hs ++ rcases hs with ⟨hbox, _hne⟩ ++ rcases hbox with ⟨hre, him⟩ ++ simp only [Set.mem_preimage] at him ++ obtain ⟨him_lower, him_upper⟩ := him ++ apply abs_le.2 ++ simp at him_lower ++ simp at him_upper ++ constructor ++ · exact him_lower ++ · exact him_upper ++ ++ have s_in_U_re_ges2 : ∀ s ∈ U, σ₂ ≤ s.re := by ++ intro s hs ++ rw [mem_sdiff_singleton] at hs ++ rcases hs with ⟨hbox, _hne⟩ ++ rcases hbox with ⟨hre, _him⟩ ++ simp only [Set.mem_preimage] at hre ++ obtain ⟨hre_lower, hre_upper⟩ := hre ++ have : min σ₂ 2 = σ₂ := by ++ apply min_eq_left ++ linarith [hσ₂_lt_one] ++ rw[this] at hre_lower ++ exact hre_lower ++ ++ apply LogDerivZetaHoloOn ++ · exact notMem_sdiff_of_mem rfl ++ · intro s hs ++ rw[← re_add_im s] ++ apply hζ_ne_zero ++ apply s_in_U_im_le3 _ hs ++ apply s_in_U_re_ges2 _ hs ++ ++theorem LogDerivZetaHolcLargeT' : ++ ∃ (A : ℝ) (_ : A ∈ Ioc 0 (1 / 2)), ∀ (T : ℝ) (_ : 3 ≤ T), ++ HolomorphicOn (fun (s : ℂ) ↦ ζ' s / (ζ s)) ++ (( (Icc ((1 : ℝ) - A / Real.log T ^ 1) 2) ×ℂ (Icc (-T) T) ) \ {1}) := by ++ obtain ⟨A, A_inter, restOfZetaZeroFree⟩ := ZetaZeroFree_p ++ obtain ⟨σ₁, σ₁_lt_one, noZerosInBox⟩ := ZetaNoZerosInBox' 3 ++ let A₀ := min A ((1 - σ₁) * Real.log 3 ^ 1) ++ refine ⟨A₀, ?_, ?_⟩ ++ · constructor ++ · apply lt_min A_inter.1 ++ bound ++ · exact le_trans (min_le_left _ _) A_inter.2 ++ intro T hT ++ apply LogDerivZetaHoloOn ++ · exact notMem_sdiff_of_mem rfl ++ intro s hs ++ rcases le_or_gt 1 s.re with one_le|lt_one ++ · exact riemannZeta_ne_zero_of_one_le_re one_le ++ rw [← re_add_im s] ++ have := Complex.mem_reProdIm.mp hs.1 ++ rcases lt_or_ge 3 |s.im| with gt3|le3 ++ · apply restOfZetaZeroFree _ _ gt3 ++ refine ⟨?_, lt_one⟩ ++ calc ++ _ ≤ 1 - A₀ / Real.log T ^ 1 := by ++ gcongr ++ · exact A_inter.1.le ++ · bound ++ · bound ++ · bound ++ · exact abs_le.mpr ⟨this.2.1, this.2.2⟩ ++ _ ≤ _:= by exact this.1.1 ++ ++ · apply noZerosInBox _ le3 ++ calc ++ _ ≥ 1 - A₀ / Real.log T ^ 1 := by exact this.1.1 ++ _ ≥ 1 - A₀ / Real.log 3 ^ 1 := by ++ gcongr ++ apply le_min A_inter.1.le ++ bound ++ _ ≥ 1 - (((1 - σ₁) * Real.log 3 ^ 1)) / Real.log 3 ^ 1:= by ++ gcongr ++ apply min_le_right ++ _ = _ := by field_simp; ring ++ ++end Erdos970 +diff --git a/lakefile.toml b/lakefile.toml +index 3bf8290..2fecc18 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -1,16 +1,6 @@ +- +-name = "StrongPNT" +-version = "0.1.0" +-defaultTargets = ["StrongPNT"] +- +-[leanOptions] +-pp.unicode.fun = true +-autoImplicit = false +-relaxedAutoImplicit = false +-linter.unusedVariables = false +- +-[[lean_lib]] + name = "StrongPNT" ++version = "0.1.0" ++defaultTargets = ["StrongPNTErdos970"] + + [[require]] + name = "mathlib" +@@ -30,3 +20,8 @@ git = "https://github.com/PatrickMassot/checkdecls.git" + name = "«doc-gen4»" + git = "https://github.com/leanprover/doc-gen4" + rev = "v4.21.0" ++ ++[[lean_lib]] ++name = "StrongPNTErdos970" ++roots = ["StrongPNT.Erdos970"] ++globs = ["StrongPNT.Erdos970.*"] +diff --git a/lean-toolchain b/lean-toolchain +index 980709b..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.21.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/Zeta3Irrational-lean4341.patch b/lean/patches/Zeta3Irrational-lean4341.patch index 9ba38ea93de4d1ac245b874b7e7d776d63cdb54e..01fc1060d47bfa6886175de566cbdac633bc6858 100644 --- a/lean/patches/Zeta3Irrational-lean4341.patch +++ b/lean/patches/Zeta3Irrational-lean4341.patch @@ -1,3240 +1,3240 @@ -diff --git a/Zeta3Irrational.lean b/Zeta3Irrational.lean -index c779005..5298524 100644 ---- a/Zeta3Irrational.lean -+++ b/Zeta3Irrational.lean -@@ -1,7 +1,8 @@ - import Zeta3Irrational.Basic - import Zeta3Irrational.Bound --import Zeta3Irrational.Equality - import Zeta3Irrational.Integral - import Zeta3Irrational.LegendrePoly - import Zeta3Irrational.LinearForm - import Zeta3Irrational.d -+import Zeta3Irrational.Equality -+import Zeta3Irrational.PrimeCounting -diff --git a/Zeta3Irrational/Basic.lean b/Zeta3Irrational/Basic.lean -index 3583719..8014ec5 100644 ---- a/Zeta3Irrational/Basic.lean -+++ b/Zeta3Irrational/Basic.lean -@@ -2,42 +2,49 @@ - A formal proof of the irrationality of Riemann-Zeta(3). - Author: Junqi Liu and Jujian Zhang. - -/ --import Mathlib.Data.Int.Star - import Mathlib.NumberTheory.LSeries.HurwitzZetaValues --import Mathlib.Order.CompletePartialOrder --import Mathlib.RingTheory.DedekindDomain.Dvr --import PrimeNumberTheoremAnd.Consequences -+import Zeta3Irrational.PrimeCounting - import Zeta3Irrational.Bound - import Zeta3Irrational.LegendrePoly - import Zeta3Irrational.LinearForm - -+/-! # Apéry's irrationality proof for ζ(3) -+ -+Port of the Apache-2.0 source by Junqi Liu and Jujian Zhang. -+-/ -+ - open scoped Nat - open BigOperators Polynomial - -+/-- The logarithmic double integral weighted by two real shifted Legendre polynomials. -/ - noncomputable abbrev JJ (n : ℕ) : ℝ := - ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- (-(x.1 * x.2).log / (1 - x.1 * x.2) * (shiftedLegendre n).eval x.1 * (shiftedLegendre n).eval x.2) -+ (-(x.1 * x.2).log / (1 - x.1 * x.2) * (aperyShiftedLegendre n).eval x.1 * -+ (aperyShiftedLegendre n).eval x.2) - -+/-- The equivalent positive triple integral in the Apéry identity. -/ - noncomputable abbrev JJ' (n : ℕ) : ℝ := - ∫ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / - (1 - (1 - x.2.1 * x.2.2) * x.1)) ^ n / (1 - (1 - x.2.1 * x.2.2) * x.1) - -+/-- The nonnegative extended-real integral of the positive Apéry integrand. -/ - noncomputable abbrev JJENN (n : ℕ) : ENNReal := - ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ENNReal.ofReal - ((x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / - (1 - (1 - x.2.1 * x.2.2) * x.1)) ^ n / (1 - (1 - x.2.1 * x.2.2) * x.1)) - -+/-- The Apéry double integral multiplied by the cube of the least common multiple. -/ - noncomputable abbrev fun1 (n : ℕ) : ℝ := (d (Finset.Icc 1 n)) ^ 3 * JJ n - - theorem linear_int (n : ℕ) : ∃ a b : ℕ → ℤ, - fun1 n = a n + b n * (d (Finset.Icc 1 n) : ℤ) ^ 3 * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 := by - delta fun1 JJ - obtain ⟨c, hc⟩ := shiftedLegendre_eq_int_poly n -- simp_rw [hc, Polynomial.eval_finset_sum, mul_assoc, Finset.sum_mul_sum, Finset.mul_sum] -- simp only [zsmul_eq_mul, eval_mul, eval_intCast, eval_pow, eval_X] -+ simp_rw [hc, Polynomial.eval_finsetSum, mul_assoc, Finset.sum_mul_sum, Finset.mul_sum] -+ simp only [eval_mul, eval_intCast, eval_pow, eval_X] - simp_rw [← mul_assoc, multi_integral_sum_comm, multi_integral_mul_const] -- simp only [← Finset.sum_neg_distrib, Finset.mul_sum] -+ simp only [Finset.mul_sum] - obtain ⟨qq', ⟨pp', hqq'⟩⟩ := linear_int_aux - use fun n => ∑ x ∈ Finset.range (n + 1), ∑ i ∈ Finset.range (n + 1), - d (Finset.Icc 1 n) ^ 3 * c x * c i * qq' x i / d (Finset.Icc 1 (Nat.max x i)) ^ 3 -@@ -70,10 +77,10 @@ theorem linear_int (n : ℕ) : ∃ a b : ℕ → ℤ, - simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, IsIntegrallyClosed.pow_dvd_pow_iff] - norm_cast - apply d_dvd_d_of_le -- simp_all only [zsmul_eq_mul, Finset.mem_range, Finset.le_eq_subset] -+ simp_all only [Finset.mem_range] - intro a b - simp_all only [Finset.mem_Icc, true_and] -- simp only [one_div, le_max_iff] at b -+ simp only [le_max_iff] at b - rcases b with ⟨_ ,(c | c)⟩ - <;> - linarith -@@ -83,7 +90,8 @@ theorem linear_int (n : ℕ) : ∃ a b : ℕ → ℤ, - simp - · ring - --lemma pos_aux (x : ℝ × ℝ × ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ (0 < x.2.1 ∧ x.2.1 < 1) ∧ 0 < x.2.2 ∧ x.2.2 < 1) : -+lemma pos_aux (x : ℝ × ℝ × ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ (0 < x.2.1 ∧ x.2.1 < 1) ∧ 0 < x.2.2 ∧ -+ x.2.2 < 1) : - 0 < (1 - (1 - x.2.1 * x.2.2) * x.1) := by - simp only [sub_pos] - suffices (1 - x.2.1 * x.2.2) * x.1 < x.1 by linarith -@@ -120,7 +128,8 @@ lemma JJENN_upper (n : ℕ) : JJENN n ≤ - apply bound' <;> linarith - · exact pos_aux x h - · simp only [h, ↓reduceIte, le_refl] -- _ = ENNReal.ofReal ((1 / 24) ^ n) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+ _ = ENNReal.ofReal ((1 / 24) ^ n) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ -+ Set.Ioo 0 1, - ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by - rw [← MeasureTheory.lintegral_const_mul] - · rw [← MeasureTheory.lintegral_indicator (by measurability), -@@ -139,8 +148,8 @@ lemma JJENN_upper (n : ℕ) : JJENN n ≤ - apply Measurable.mul _ measurable_fst - apply Measurable.const_sub - apply Measurable.mul -- apply Measurable.comp' measurable_fst measurable_snd -- apply Measurable.comp' measurable_snd measurable_snd -+ · exact measurable_fst.comp measurable_snd -+ · exact measurable_snd.comp measurable_snd - _ = ENNReal.ofReal (2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3) := by - have h := JENN_eq_triple 0 0 - simp only [pow_zero, mul_one] at h -@@ -151,40 +160,14 @@ lemma JJENN_upper (n : ℕ) : JJENN n ≤ - nth_rw 2 [mul_comm] - - lemma integrableOn_JJ' (n : ℕ) : MeasureTheory.Integrable (fun (x : ℝ × ℝ × ℝ) ↦ -- (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / (1 - (1 - x.2.1 * x.2.2) * x.1)) ^ n / -- (1 - (1 - x.2.1 * x.2.2) * x.1)) (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1)) := by -+ (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / (1 - (1 - x.2.1 * x.2.2) * -+ x.1)) ^ n / -+ (1 - (1 - x.2.1 * x.2.2) * x.1)) (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 -+ ×ˢ Set.Ioo 0 1)) := by - rw [MeasureTheory.Integrable] - constructor -- · apply AEMeasurable.aestronglyMeasurable -- rw [← aemeasurable_indicator_iff (by measurability)] -- apply AEMeasurable.indicator _ (by measurability) -- apply AEMeasurable.div -- · apply AEMeasurable.pow_const -- apply AEMeasurable.div -- · apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.fst (f := id) aemeasurable_id) _) -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) _) -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) _) -- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) -- · apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) -- · apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) -+ · apply Measurable.aestronglyMeasurable -+ fun_prop - · rw [MeasureTheory.hasFiniteIntegral_iff_norm] - set k := _ - change k < ⊤ -@@ -196,16 +179,16 @@ lemma integrableOn_JJ' (n : ℕ) : MeasureTheory.Integrable (fun (x : ℝ × ℝ - ext x - rw [Set.indicator_apply, Set.indicator_apply] - by_cases hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 -- · simp only [hx, ↓reduceIte, norm_mul, norm_div, norm_neg, Real.norm_eq_abs, norm_pow] -+ · simp only [hx, ↓reduceIte, norm_mul, norm_div, Real.norm_eq_abs, norm_pow] - simp only [Set.mem_prod, Set.mem_Ioo] at hx - rw [ENNReal.ofReal_eq_ofReal_iff] - · congr 3 - · rw [abs_eq_self.2, abs_eq_self.2, abs_eq_self.2, abs_eq_self.2, abs_eq_self.2, - abs_eq_self.2] <;> nlinarith - · simp only [abs_eq_self, sub_nonneg] -- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) -+ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) - · simp only [abs_eq_self, sub_nonneg] -- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) -+ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) - · positivity - · apply div_nonneg - · apply pow_nonneg -@@ -223,13 +206,14 @@ lemma integrableOn_JJ' (n : ℕ) : MeasureTheory.Integrable (fun (x : ℝ × ℝ - simp only [one_div, inv_pow, ENNReal.ofReal_lt_top] - - lemma shiftedLegendre_bound (n : ℕ) (x : ℝ) (hx : 0 < x ∧ x < 1) : -- |eval x (shiftedLegendre n)| ≤ ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + x_1).choose n) := by -- simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul, eval_finset_sum, -+ |eval x (aperyShiftedLegendre n)| ≤ ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + -+ x_1).choose n) := by -+ simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, eval_finsetSum, - eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- have := Finset.abs_sum_le_sum_abs (f := fun y => (-1) ^ y * ↑(n.choose y) * ↑((n + y).choose n) * x ^ y) -+ have := Finset.abs_sum_le_sum_abs (f := fun y => (-1) ^ y * ↑(n.choose y) * ↑((n + y).choose -+ n) * x ^ y) - (s := Finset.range (n + 1)) -- trans -- apply this -+ refine this.trans ?_ - apply Finset.sum_le_sum - intro i _ - simp only [abs_mul, abs_pow, abs_neg, abs_one, one_pow, Nat.abs_cast, one_mul] -@@ -243,51 +227,24 @@ lemma shiftedLegendre_bound (n : ℕ) (x : ℝ) (hx : 0 < x ∧ x < 1) : - - lemma Measurable_one_div_aux : - Measurable fun (x : ℝ × ℝ × ℝ) ↦ ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by -- apply Measurable.ennreal_ofReal -- apply Measurable.const_div -- apply Measurable.const_sub -- apply Measurable.mul _ measurable_fst -- apply Measurable.const_sub -- apply Measurable.mul -- apply Measurable.comp' measurable_fst measurable_snd -- apply Measurable.comp' measurable_snd measurable_snd -+ fun_prop - - lemma integrableOn_JJ1 (n : ℕ) : MeasureTheory.Integrable -- (Function.uncurry fun z x ↦ eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) -- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1))) := by -- rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Integrable] -+ (Function.uncurry fun z x ↦ eval x.1 (aperyShiftedLegendre n) * eval x.2 -+ (aperyShiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) -+ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 -+ 1 ×ˢ Set.Ioo 0 1))) := by -+ rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, -+ MeasureTheory.Integrable] - constructor -- · apply AEMeasurable.aestronglyMeasurable -- rw [← aemeasurable_indicator_iff (by measurability)] -- apply AEMeasurable.indicator _ (by measurability) -- simp_rw [mul_one_div] -- apply AEMeasurable.div -- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] -- apply AEMeasurable.mul -- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- apply Finset.aemeasurable_sum -- intro i _ -- apply AEMeasurable.const_mul -- apply AEMeasurable.pow_const (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) _) -- apply AEMeasurable.fst (f := id) aemeasurable_id -- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- apply Finset.aemeasurable_sum -- intro i _ -- apply AEMeasurable.const_mul -- apply AEMeasurable.pow_const (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) _) -- apply AEMeasurable.snd (f := id) aemeasurable_id -- · apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) -+ · apply Measurable.aestronglyMeasurable -+ fun_prop - · rw [MeasureTheory.hasFiniteIntegral_iff_norm] - set k := _ - set C := ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + x_1).choose n) - change k < ⊤ -- have : k ≤ ENNReal.ofReal (C ^ 2) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+ have : k ≤ ENNReal.ofReal (C ^ 2) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ -+ Set.Ioo 0 1, - ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by - simp only [k] - rw [← MeasureTheory.lintegral_const_mul _ Measurable_one_div_aux] -@@ -323,46 +280,21 @@ lemma integrableOn_JJ1 (n : ℕ) : MeasureTheory.Integrable - · positivity - - lemma integrableOn_JJ2 (n : ℕ) : MeasureTheory.Integrable (Function.uncurry fun z x ↦ -- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1)) -- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1))) := by -- rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Integrable] -+ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * -+ x.2) * z) ^ (n + 1)) -+ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 -+ 1 ×ˢ Set.Ioo 0 1))) := by -+ rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, -+ MeasureTheory.Integrable] - constructor -- · apply AEMeasurable.aestronglyMeasurable -- rw [← aemeasurable_indicator_iff (by measurability)] -- apply AEMeasurable.indicator _ (by measurability) -- apply AEMeasurable.div -- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] -- apply AEMeasurable.mul -- · apply AEMeasurable.mul -- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- apply Finset.aemeasurable_sum -- intro i _ -- apply AEMeasurable.const_mul -- apply AEMeasurable.pow_const (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) _) -- apply AEMeasurable.fst (f := id) aemeasurable_id -- · apply AEMeasurable.pow_const -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- apply AEMeasurable.fst (f := id) aemeasurable_id -- · apply AEMeasurable.pow_const -- apply AEMeasurable.const_sub -- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id) -- · apply AEMeasurable.pow_const -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- apply AEMeasurable.fst (f := id) aemeasurable_id -+ · apply Measurable.aestronglyMeasurable -+ fun_prop - · rw [MeasureTheory.hasFiniteIntegral_iff_norm] - set k := _ - set C := ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + x_1).choose n) - change k < ⊤ -- have : k ≤ ENNReal.ofReal (|C|) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+ have : k ≤ ENNReal.ofReal (|C|) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ -+ Set.Ioo 0 1, - ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by - simp only [k] - rw [← MeasureTheory.lintegral_const_mul _ Measurable_one_div_aux] -@@ -376,7 +308,8 @@ lemma integrableOn_JJ2 (n : ℕ) : MeasureTheory.Integrable (Function.uncurry fu - simp only [Set.mem_prod, Set.mem_Ioo] at hx - rw [← ENNReal.ofReal_mul] - · rw [ENNReal.ofReal_le_ofReal_iff] -- · rw [Function.uncurry_apply_pair, pow_add, ← div_div, abs_div,mul_one_div, div_le_div_iff₀] -+ · rw [Function.uncurry_apply_pair, pow_add, ← div_div, abs_div,mul_one_div, -+ div_le_div_iff₀] - · apply mul_le_mul _ _ (by linarith [pos_aux x hx]) (by positivity) - · rw [← mul_div, mul_assoc, abs_mul, ← mul_one (a := |C|)] - apply mul_le_mul _ _ (by positivity) (by positivity) -@@ -406,16 +339,10 @@ lemma integrableOn_JJ2 (n : ℕ) : MeasureTheory.Integrable (Function.uncurry fu - · linarith - · linarith - · exact ineq -- · rw [div_add_one] -+ · rw [div_add_one (by positivity)] - intro r - rw [_root_.div_eq_zero_iff] at r -- · refine ineq <| r.resolve_right ?_ -- apply mul_ne_zero -- · apply mul_ne_zero <;> linarith -- · linarith -- · apply mul_ne_zero -- · apply mul_ne_zero <;> linarith -- · linarith, abs_div] -+ exact ineq (r.resolve_right (by positivity)), abs_div] - trans |1 - z| - · apply div_le_self (abs_nonneg _) - rw [abs_of_nonneg, le_add_iff_nonneg_left] -@@ -446,46 +373,25 @@ lemma integrableOn_JJ2 (n : ℕ) : MeasureTheory.Integrable (Function.uncurry fu - have h := JENN_eq_triple 0 0 - simp only [pow_zero, mul_one] at h - rw [← h, J_ENN_rr, ← ENNReal.ofReal_mul] -- · simp -+ · finiteness - · positivity - - lemma integrableOn_JJ3 (n : ℕ) : MeasureTheory.Integrable -- (Function.uncurry fun z x ↦ eval x.1 (shiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z)) -- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1))) := by -- rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Integrable] -+ (Function.uncurry fun z x ↦ eval x.1 (aperyShiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / -+ (1 - (1 - x.1 * x.2) * z)) -+ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 -+ 1 ×ˢ Set.Ioo 0 1))) := by -+ rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, -+ MeasureTheory.Integrable] - constructor -- · apply AEMeasurable.aestronglyMeasurable -- rw [← aemeasurable_indicator_iff (by measurability)] -- apply AEMeasurable.indicator _ (by measurability) -- apply AEMeasurable.div -- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] -- apply AEMeasurable.mul -- · apply AEMeasurable.mul -- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- apply Finset.aemeasurable_sum -- intro i _ -- apply AEMeasurable.const_mul -- apply AEMeasurable.pow_const (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) _) -- apply AEMeasurable.fst (f := id) aemeasurable_id -- · apply AEMeasurable.pow_const -- apply AEMeasurable.const_sub -- apply AEMeasurable.fst (f := id) aemeasurable_id -- · apply AEMeasurable.pow_const -- apply AEMeasurable.const_sub -- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id) -- · apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- apply AEMeasurable.fst (f := id) aemeasurable_id -+ · apply Measurable.aestronglyMeasurable -+ fun_prop - · rw [MeasureTheory.hasFiniteIntegral_iff_norm] - set k := _ - set C := ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + x_1).choose n) - change k < ⊤ -- have : k ≤ ENNReal.ofReal (|C|) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+ have : k ≤ ENNReal.ofReal (|C|) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ -+ Set.Ioo 0 1, - ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by - simp only [k] - rw [← MeasureTheory.lintegral_const_mul _ Measurable_one_div_aux] -@@ -532,37 +438,78 @@ lemma integrableOn_JJ3 (n : ℕ) : MeasureTheory.Integrable - have h := JENN_eq_triple 0 0 - simp only [pow_zero, mul_one] at h - rw [← h, J_ENN_rr, ← ENNReal.ofReal_mul] -- · simp -+ · finiteness - · positivity - - lemma eq1_integrableOn_aux1 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : MeasureTheory.Integrable -- (fun x ↦ eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) -- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1))) := by -+ (fun x ↦ eval x.1 (aperyShiftedLegendre n) * eval x.2 (aperyShiftedLegendre n) * (1 / (1 - -+ (1 - x.1 * x.2) * z))) -+ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo -+ 0 1))) := by - rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] - apply MeasureTheory.IntegrableOn.integrable - apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) -- apply ContinuousOn.integrableOn_compact -- · simp only [Set.mem_Ioo, Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] -- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] -- apply ContinuousOn.mul -- · apply ContinuousOn.mul -- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- apply continuousOn_finset_sum -- intro i _ -- apply ContinuousOn.mul continuousOn_const -- apply ContinuousOn.pow continuousOn_fst -- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- apply continuousOn_finset_sum -- intro i _ -- apply ContinuousOn.mul continuousOn_const -- apply ContinuousOn.pow continuousOn_snd -- · apply ContinuousOn.div continuousOn_const -- · apply ContinuousOn.sub continuousOn_const -+ · apply ContinuousOn.integrableOn_compact -+ · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] -+ · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one] -+ apply ContinuousOn.mul -+ · apply ContinuousOn.mul -+ · simp only [eval_finsetSum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -+ apply continuousOn_finsetSum -+ intro i _ -+ apply ContinuousOn.mul continuousOn_const -+ apply ContinuousOn.pow continuousOn_fst -+ · simp only [eval_finsetSum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -+ apply continuousOn_finsetSum -+ intro i _ -+ apply ContinuousOn.mul continuousOn_const -+ apply ContinuousOn.pow continuousOn_snd -+ · apply ContinuousOn.div continuousOn_const -+ · apply ContinuousOn.sub continuousOn_const -+ apply ContinuousOn.mul _ continuousOn_const -+ apply ContinuousOn.sub continuousOn_const -+ apply ContinuousOn.mul continuousOn_fst continuousOn_snd -+ · intro x hx -+ suffices 1 - (1 - x.1 * x.2) * z > 0 by linarith -+ simp only [Set.mem_prod, Set.mem_Icc] at hx -+ simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ -+ suffices (1 - x.1 * x.2) * z ≤ z by linarith -+ apply mul_le_of_le_one_left (by linarith) -+ simp only [tsub_le_iff_right, le_add_iff_nonneg_right] -+ nlinarith -+ · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self -+ -+lemma eq1_integrableOn_aux2 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : MeasureTheory.Integrable -+ (fun x ↦ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 -+ - x.1 * x.2) * z) ^ (n + 1)) -+ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo -+ 0 1))) := by -+ rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] -+ apply MeasureTheory.IntegrableOn.integrable -+ apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) -+ · apply ContinuousOn.integrableOn_compact -+ · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] -+ · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one] -+ apply ContinuousOn.div -+ · apply ContinuousOn.mul -+ · apply ContinuousOn.mul -+ · simp only [eval_finsetSum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -+ apply continuousOn_finsetSum -+ intro i _ -+ apply ContinuousOn.mul continuousOn_const -+ apply ContinuousOn.pow continuousOn_fst -+ · apply ContinuousOn.pow -+ apply ContinuousOn.mul _ continuousOn_const -+ apply ContinuousOn.mul continuousOn_fst continuousOn_snd -+ · apply ContinuousOn.pow -+ apply ContinuousOn.sub continuousOn_const continuousOn_snd -+ · apply ContinuousOn.pow -+ apply ContinuousOn.sub continuousOn_const - apply ContinuousOn.mul _ continuousOn_const - apply ContinuousOn.sub continuousOn_const - apply ContinuousOn.mul continuousOn_fst continuousOn_snd - · intro x hx -- suffices 1 - (1 - x.1 * x.2) * z > 0 by linarith -+ suffices 1 - (1 - x.1 * x.2) * z > 0 by positivity - simp only [Set.mem_prod, Set.mem_Icc] at hx - simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ - suffices (1 - x.1 * x.2) * z ≤ z by linarith -@@ -571,88 +518,62 @@ lemma eq1_integrableOn_aux1 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : Measu - nlinarith - · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self - --lemma eq1_integrableOn_aux2 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : MeasureTheory.Integrable -- (fun x ↦ eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1)) -- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1))) := by -- rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] -- apply MeasureTheory.IntegrableOn.integrable -- apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) -- apply ContinuousOn.integrableOn_compact -- · simp only [Set.mem_Ioo, Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] -- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] -- apply ContinuousOn.div -- · apply ContinuousOn.mul -- · apply ContinuousOn.mul -- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- apply continuousOn_finset_sum -- intro i _ -- apply ContinuousOn.mul continuousOn_const -- apply ContinuousOn.pow continuousOn_fst -- · apply ContinuousOn.pow -- apply ContinuousOn.mul _ continuousOn_const -- apply ContinuousOn.mul continuousOn_fst continuousOn_snd -- · apply ContinuousOn.pow -- apply ContinuousOn.sub continuousOn_const continuousOn_snd -- · apply ContinuousOn.pow -- apply ContinuousOn.sub continuousOn_const -- apply ContinuousOn.mul _ continuousOn_const -- apply ContinuousOn.sub continuousOn_const -- apply ContinuousOn.mul continuousOn_fst continuousOn_snd -- · intro x hx -- suffices 1 - (1 - x.1 * x.2) * z > 0 by positivity -- simp only [Set.mem_prod, Set.mem_Icc] at hx -- simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ -- suffices (1 - x.1 * x.2) * z ≤ z by linarith -- apply mul_le_of_le_one_left (by linarith) -- simp only [tsub_le_iff_right, le_add_iff_nonneg_right] -- nlinarith -- · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self -- --lemma double_integral_eq1 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z)) = -+lemma double_integral_eq1 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 -+ ×ˢ Set.Ioo 0 1, -+ eval x.1 (aperyShiftedLegendre n) * eval x.2 (aperyShiftedLegendre n) * (1 / (1 - (1 - x.1 -+ * x.2) * z)) = - ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by -+ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * -+ x.2) * z) ^ (n + 1) := by - calc -- _ = ∫ (x : ℝ) in Set.Ioo 0 1, eval x (shiftedLegendre n) * ∫ (y : ℝ) in Set.Ioo 0 1, -- eval y (shiftedLegendre n) * (1 / (1 - (1 - x * y) * z)) := by -+ _ = ∫ (x : ℝ) in Set.Ioo 0 1, eval x (aperyShiftedLegendre n) * ∫ (y : ℝ) in Set.Ioo 0 1, -+ eval y (aperyShiftedLegendre n) * (1 / (1 - (1 - x * y) * z)) := by - rw [MeasureTheory.Measure.volume_eq_prod, ← MeasureTheory.Measure.prod_restrict, - MeasureTheory.integral_prod] - · apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro x _ - simp only -- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), -- ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), -+ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num), -+ ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num), - ← intervalIntegral.integral_const_mul] - simp only [one_div, ← mul_assoc] - · exact eq1_integrableOn_aux1 n z hz -- _ = ∫ (x : ℝ) in Set.Ioo 0 1, eval x (shiftedLegendre n) * ∫ (y : ℝ) in Set.Ioo 0 1, -+ _ = ∫ (x : ℝ) in Set.Ioo 0 1, eval x (aperyShiftedLegendre n) * ∫ (y : ℝ) in Set.Ioo 0 1, - (x * y * z) ^ n * (1 - y) ^ n / (1 - (1 - x * y) * z) ^ (n + 1) := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro x hx - simp only - congr 1 -- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), -- ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num)] -+ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num), -+ ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num)] - rw [legendre_integral_special n hx hz] - _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by -+ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * -+ x.2) * z) ^ (n + 1) := by - rw [MeasureTheory.Measure.volume_eq_prod, ← MeasureTheory.Measure.prod_restrict, - MeasureTheory.integral_prod] - · apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro x _ - simp only -- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), -- ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), -+ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num), -+ ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num), - ← intervalIntegral.integral_const_mul] - simp only [mul_div, ← mul_assoc] - · exact eq1_integrableOn_aux2 n z hz - --lemma ineq_aux (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hz : 0 ≤ z ∧ z ≤ 1) : -+lemma ineq_aux (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hz : 0 ≤ z ∧ -+ z ≤ 1) : - 0 ≤ (1 - z) / (1 - (1 - x.1 * x.2) * z) ∧ (1 - z) / (1 - (1 - x.1 * x.2) * z) ≤ 1 := by - constructor - · apply div_nonneg (by linarith) - simp only [sub_nonneg] -- apply mul_le_one₀ _ (by linarith) (by linarith) -+ refine (mul_le_of_le_one_left (by linarith) ?_).trans (by linarith) - simp only [tsub_le_iff_right, le_add_iff_nonneg_right] - nlinarith - · rw [div_le_iff₀] -@@ -670,18 +591,20 @@ lemma ineq_aux (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x. - suffices z * (1 - x.1 * x.2) ≤ (1 - x.1 * x.2) by nlinarith - apply mul_le_of_le_one_left (by nlinarith) hz.2 - --lemma ineq_aux1 (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hz : 0 ≤ z ∧ z ≤ 1) : -+lemma ineq_aux1 (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hz : 0 ≤ z -+ ∧ z ≤ 1) : - 1 - (1 - x.1 * x.2) * z ≠ 0 := by - suffices (1 - x.1 * x.2) * z < 1 by linarith - rw [mul_comm] - suffices z * (1 - x.1 * x.2) ≤ (1 - x.1 * x.2) by nlinarith - apply mul_le_of_le_one_left (by nlinarith) hz.2 - --lemma fun_eq_aux (x : ℝ × ℝ) (y : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hy : 0 ≤ y ∧ y ≤ 1) : -+lemma fun_eq_aux (x : ℝ × ℝ) (y : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hy : 0 ≤ y -+ ∧ y ≤ 1) : - deriv (fun z => (1 - z) / (1 - (1 - x.1 * x.2) * z)) y = - (fun z => - x.1 * x.2 / (1 - (1 - x.1 * x.2) * z) ^ 2) y := by -- rw [deriv_div] -- · rw [deriv_const_sub, deriv_const_sub, deriv_const_mul _ differentiableAt_id'] -+ rw [deriv_fun_div] -+ · rw [deriv_const_sub, deriv_const_sub, deriv_const_mul _ differentiableAt_id] - simp only [deriv_id'', neg_mul, one_mul, neg_sub, mul_one] - congr - ring -@@ -689,9 +612,12 @@ lemma fun_eq_aux (x : ℝ × ℝ) (y : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < - · apply DifferentiableAt.const_sub (DifferentiableAt.const_mul differentiableAt_id _) - · exact ineq_aux1 x y hx hy - --lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : ∫ (z : ℝ) in Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) = -- ∫ (z : ℝ) in Set.Ioo 0 1, eval x.1 (shiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) := by -+lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : ∫ (z : ℝ) -+ in Set.Ioo 0 1, -+ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * -+ x.2) * z) ^ (n + 1) = -+ ∫ (z : ℝ) in Set.Ioo 0 1, eval x.1 (aperyShiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / -+ (1 - (1 - x.1 * x.2) * z) := by - rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), - ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num)] - simp only [← mul_div, mul_assoc] -@@ -712,7 +638,7 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × - apply ContinuousOn.mul continuousOn_const continuousOn_id - · intro y hy - simp only [Set.mem_prod, Set.mem_Ioo, zero_le_one, Set.uIcc_of_le, Set.mem_Icc, -- OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff] at hx hy ⊢ -+ ] at hx hy ⊢ - apply pow_ne_zero - exact ineq_aux1 x y hx hy - · intro y hy -@@ -754,7 +680,8 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × - 1 - (1 - y) / (1 - (1 - x.1 * x.2) * y) := by - rw [sub_div, div_self (ineq_aux1 x y hx hy)] - have eq2 : ((1 - (1 - x.1 * x.2) * y) - (1 - x.1 * x.2) * (1 - y)) / -- (1 - (1 - x.1 * x.2) * y) = 1 - (1 - x.1 * x.2) * ((1 - y) / (1 - (1 - x.1 * x.2) * y)) := by -+ (1 - (1 - x.1 * x.2) * y) = 1 - (1 - x.1 * x.2) * ((1 - y) / (1 - (1 - x.1 * x.2) -+ * y)) := by - rw [sub_div, div_self (ineq_aux1 x y hx hy), mul_div] - rw [div_eq_iff] - · rw [← eq1, ← eq2, mul_div, div_eq_div_iff (ineq_aux1 x y hx hy) (ineq_aux1 x y hx hy)] -@@ -774,14 +701,15 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × - · intro y hy - simp only [Set.mem_Icc] at hy - exact ineq_aux1 x y hx hy -- _ = ∫ (y : ℝ) in (0)..1, x.1 * x.2 / (1 - (1 - x.1 * x.2) * y) ^ 2 * (1 - g y) ^ n / (1 - (1 - x.1 * x.2) * g y) := by -+ _ = ∫ (y : ℝ) in (0)..1, x.1 * x.2 / (1 - (1 - x.1 * x.2) * y) ^ 2 * (1 - g y) ^ n / (1 - (1 -+ - x.1 * x.2) * g y) := by - rw [← intervalIntegral.integral_neg] - apply intervalIntegral.integral_congr - intro y hy - simp only [zero_le_one, Set.uIcc_of_le, Set.mem_Icc] at hy ⊢ -- simp only [g, g'] -+ simp only [g] - rw [fun_eq_aux x y hx hy] -- simp [g, g', neg_div] -+ ring - _ = ∫ (y : ℝ) in (0)..1, (x.1 * x.2 * y) ^ n / (1 - (1 - x.1 * x.2) * y) ^ (n + 1) := by - apply intervalIntegral.integral_congr - intro y hy -@@ -795,7 +723,7 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × - rw [div_mul_eq_mul_div, div_div, div_eq_div_iff] - · simp only [← eq1, sub_sub_sub_cancel_left, div_pow, ← eq2, g] - rw [mul_div, mul_comm, mul_div, mul_div, mul_div, div_eq_div_iff] -- ring -+ · ring - · apply pow_ne_zero - exact ineq_aux1 x y hx hy - · exact ineq_aux1 x y hx hy -@@ -812,39 +740,43 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × - exact ineq_aux1 x y hx hy - - lemma eq3_integrableOn_aux (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : -- MeasureTheory.Integrable (fun x ↦ eval x.1 (shiftedLegendre n) * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z)) -- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1))) := by -+ MeasureTheory.Integrable (fun x ↦ eval x.1 (aperyShiftedLegendre n) * (1 - x.2) ^ n / (1 - -+ (1 - x.1 * x.2) * z)) -+ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo -+ 0 1))) := by - rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] - apply MeasureTheory.IntegrableOn.integrable - apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) -- apply ContinuousOn.integrableOn_compact -- · simp only [Set.mem_Ioo, Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] -- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] -- apply ContinuousOn.div -- · apply ContinuousOn.mul -- simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -- apply continuousOn_finset_sum -- intro i _ -- apply ContinuousOn.mul continuousOn_const -- apply ContinuousOn.pow continuousOn_fst -- apply ContinuousOn.pow (ContinuousOn.sub continuousOn_const continuousOn_snd) -- · apply ContinuousOn.sub continuousOn_const -- apply ContinuousOn.mul _ continuousOn_const -- apply ContinuousOn.sub continuousOn_const -- apply ContinuousOn.mul continuousOn_fst continuousOn_snd -- · intro x hx -- suffices 1 - (1 - x.1 * x.2) * z > 0 by linarith -- simp only [Set.mem_prod, Set.mem_Icc] at hx -- simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ -- suffices (1 - x.1 * x.2) * z ≤ z by linarith -- apply mul_le_of_le_one_left (by linarith) -- simp only [tsub_le_iff_right, le_add_iff_nonneg_right] -- nlinarith -+ · apply ContinuousOn.integrableOn_compact -+ · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] -+ · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one] -+ apply ContinuousOn.div -+ · apply ContinuousOn.mul -+ · simp only [eval_finsetSum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] -+ apply continuousOn_finsetSum -+ intro i _ -+ apply ContinuousOn.mul continuousOn_const -+ apply ContinuousOn.pow continuousOn_fst -+ · apply ContinuousOn.pow (ContinuousOn.sub continuousOn_const continuousOn_snd) -+ · apply ContinuousOn.sub continuousOn_const -+ apply ContinuousOn.mul _ continuousOn_const -+ apply ContinuousOn.sub continuousOn_const -+ apply ContinuousOn.mul continuousOn_fst continuousOn_snd -+ · intro x hx -+ suffices 1 - (1 - x.1 * x.2) * z > 0 by linarith -+ simp only [Set.mem_prod, Set.mem_Icc] at hx -+ simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ -+ suffices (1 - x.1 * x.2) * z ≤ z by linarith -+ apply mul_le_of_le_one_left (by linarith) -+ simp only [tsub_le_iff_right, le_add_iff_nonneg_right] -+ nlinarith - · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self - --lemma double_integral_eq3 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+lemma double_integral_eq3 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 -+ ×ˢ Set.Ioo 0 1, - (x.1 * x.2 * z * (1 - x.1) * (1 - x.2)) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) = -- ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, eval x.1 (shiftedLegendre n) * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) := by -+ ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, eval x.1 (aperyShiftedLegendre n) * (1 - x.2) -+ ^ n / (1 - (1 - x.1 * x.2) * z) := by - symm - rw [MeasureTheory.Measure.volume_eq_prod, ← MeasureTheory.Measure.prod_restrict, - MeasureTheory.integral_prod, MeasureTheory.integral_integral_swap] -@@ -852,25 +784,30 @@ lemma double_integral_eq3 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x - simp only - calc - _ = ∫ (y : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * ∫ (x : ℝ) in Set.Ioo 0 1, -- eval x (shiftedLegendre n) / (1 - (1 - x * y) * z) := by -+ eval x (aperyShiftedLegendre n) / (1 - (1 - x * y) * z) := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro y hy -- simp at hy ⊢ -- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), -- ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), -+ simp only at hy ⊢ -+ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num), -+ ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num), - ← intervalIntegral.integral_const_mul] - simp [mul_div, mul_comm] -- _ = ∫ (y : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * ∫ (x : ℝ) in (0)..1, (y * x * z) ^ n * (1 - x) ^ n / (1 - (1 - y * x) * z) ^ (n + 1) := by -+ _ = ∫ (y : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * ∫ (x : ℝ) in (0)..1, (y * x * z) ^ n * (1 - x) -+ ^ n / (1 - (1 - y * x) * z) ^ (n + 1) := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro y hy - simp only - congr 1 -- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num)] -+ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by -+ norm_num)] - have := legendre_integral_special n hy hz - simp only [mul_one_div] at this - simp only [← this] - simp only [mul_comm] -- _ = ∫ (y : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * (y * x * z) ^ n * (1 - x) ^ n / (1 - (1 - y * x) * z) ^ (n + 1) := by -+ _ = ∫ (y : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * (y * x * z) ^ n * (1 -+ - x) ^ n / (1 - (1 - y * x) * z) ^ (n + 1) := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro y _ - simp only -@@ -885,26 +822,26 @@ lemma double_integral_eq3 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x - · rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] - apply MeasureTheory.IntegrableOn.integrable - apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) -- apply ContinuousOn.integrableOn_compact -- · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one, isCompact_Icc] -- · apply ContinuousOn.div -- · apply ContinuousOn.pow -- apply ContinuousOn.mul _ (ContinuousOn.sub continuousOn_const continuousOn_snd) -- apply ContinuousOn.mul _ (ContinuousOn.sub continuousOn_const continuousOn_fst) -- apply ContinuousOn.mul _ continuousOn_const -- apply ContinuousOn.mul continuousOn_fst continuousOn_snd -- · apply ContinuousOn.pow -- apply ContinuousOn.sub continuousOn_const _ -- apply ContinuousOn.mul _ continuousOn_const -- apply ContinuousOn.sub continuousOn_const _ -- apply ContinuousOn.mul continuousOn_fst continuousOn_snd -- · intro x hx -- simp only [Set.mem_prod, Set.mem_Icc, Set.mem_Ioo] at hx hz -- apply pow_ne_zero -- suffices (1 - x.1 * x.2) * z ≤ z by linarith -- apply mul_le_of_le_one_left (by linarith) -- simp only [tsub_le_iff_right, le_add_iff_nonneg_right] -- nlinarith -+ · apply ContinuousOn.integrableOn_compact -+ · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one, isCompact_Icc] -+ · apply ContinuousOn.div -+ · apply ContinuousOn.pow -+ apply ContinuousOn.mul _ (ContinuousOn.sub continuousOn_const continuousOn_snd) -+ apply ContinuousOn.mul _ (ContinuousOn.sub continuousOn_const continuousOn_fst) -+ apply ContinuousOn.mul _ continuousOn_const -+ apply ContinuousOn.mul continuousOn_fst continuousOn_snd -+ · apply ContinuousOn.pow -+ apply ContinuousOn.sub continuousOn_const _ -+ apply ContinuousOn.mul _ continuousOn_const -+ apply ContinuousOn.sub continuousOn_const _ -+ apply ContinuousOn.mul continuousOn_fst continuousOn_snd -+ · intro x hx -+ simp only [Set.mem_prod, Set.mem_Icc, Set.mem_Ioo] at hx hz -+ apply pow_ne_zero -+ suffices (1 - x.1 * x.2) * z ≤ z by linarith -+ apply mul_le_of_le_one_left (by linarith) -+ simp only [tsub_le_iff_right, le_add_iff_nonneg_right] -+ nlinarith - · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self - · exact eq3_integrableOn_aux n z hz - · exact eq3_integrableOn_aux n z hz -@@ -913,35 +850,42 @@ theorem JJ_eq_form (n : ℕ) : JJ n = JJ' n := by - simp only [JJ, JJ'] - calc - _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- (∫ (z : ℝ) in Set.Ioo 0 1, eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) := by -+ (∫ (z : ℝ) in Set.Ioo 0 1, eval x.1 (aperyShiftedLegendre n) * eval x.2 -+ (aperyShiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro x hx - simp only [Set.mem_prod, Set.mem_Ioo] at hx ⊢ - rw [mul_assoc, mul_comm, ← integral1, ← MeasureTheory.integral_Ioc_eq_integral_Ioo, -- ← intervalIntegral.integral_of_le (by norm_num), intervalIntegral.integral_const_mul] <;> nlinarith -+ ← intervalIntegral.integral_of_le (by norm_num), intervalIntegral.integral_const_mul] <;> -+ nlinarith - _ = ∫ (z : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z)) := by -+ eval x.1 (aperyShiftedLegendre n) * eval x.2 (aperyShiftedLegendre n) * (1 / (1 - (1 - x.1 -+ * x.2) * z)) := by - symm - rw [MeasureTheory.integral_integral_swap] - exact integrableOn_JJ1 n - _ = ∫ (z : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by -+ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * -+ x.2) * z) ^ (n + 1) := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro z hz - simp only - exact double_integral_eq1 n z hz - _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ∫ (z : ℝ) in Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by -+ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * -+ x.2) * z) ^ (n + 1) := by - rw [MeasureTheory.integral_integral_swap] - exact integrableOn_JJ2 n - _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ∫ (z : ℝ) in Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) := by -+ eval x.1 (aperyShiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) -+ := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro x hx - simp only - exact double_integral_eq2 n x hx - _ = ∫ (z : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- eval x.1 (shiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) := by -+ eval x.1 (aperyShiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) -+ := by - symm - rw [MeasureTheory.integral_integral_swap] - exact integrableOn_JJ3 n -@@ -957,7 +901,8 @@ theorem JJ_eq_form (n : ℕ) : JJ n = JJ' n := by - rw [smul_eq_mul] - ring - _ = ∫ (z : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- (x.1 * x.2 * z * (1 - x.1) * (1 - x.2) * (1 - z)) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by -+ (x.1 * x.2 * z * (1 - x.1) * (1 - x.2) * (1 - z)) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) -+ := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro z hz - simp only -@@ -968,7 +913,8 @@ theorem JJ_eq_form (n : ℕ) : JJ n = JJ' n := by - rw [smul_eq_mul, mul_comm, mul_div, ← mul_pow] - ring - _ = ∫ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -- (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / (1 - (1 - x.2.1 * x.2.2) * x.1)) ^ n / -+ (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / (1 - (1 - x.2.1 * x.2.2) * -+ x.1)) ^ n / - (1 - (1 - x.2.1 * x.2.2) * x.1) := by - symm - rw [MeasureTheory.Measure.volume_eq_prod, ← MeasureTheory.Measure.prod_restrict, -@@ -992,38 +938,16 @@ theorem JJ_pos (n : ℕ) : 0 < JJ n := by - have subset : Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ⊆ Function.support F := by - intro a ha - change F a ≠ 0 -- simp only [div_pow, ne_eq, _root_.div_eq_zero_iff, pow_eq_zero_iff', mul_eq_zero, not_or, -- not_and, Decidable.not_not, F] -+ have hden := pos_aux a (by simpa only [Set.mem_prod, Set.mem_Ioo] using ha) - simp only [Set.mem_prod, Set.mem_Ioo] at ha - rcases ha with ⟨⟨hx0, hx1⟩, ⟨hy0, hy1⟩, hz0, hz1⟩ -- constructor -- · constructor -- · intro h -- rcases h with (h | h); swap; nlinarith -- rcases h with (h | h); swap; nlinarith -- rcases h with (h | h); swap; nlinarith -- rcases h with (h | h); swap; nlinarith -- rcases h with (h | h) <;> nlinarith -- · intro h -- suffices ¬1 - (1 - a.2.1 * a.2.2) * a.1 = 0 by tauto -- suffices 1 - (1 - a.2.1 * a.2.2) * a.1 > 0 by linarith -- simp only [gt_iff_lt, sub_pos] -- suffices (1 - a.2.1 * a.2.2) * a.1 < a.1 by linarith -- rw [mul_lt_iff_lt_one_left] -- · simp only [sub_lt_self_iff] -- nlinarith -- · exact hx0 -- · suffices 1 - (1 - a.2.1 * a.2.2) * a.1 > 0 by linarith -- simp only [gt_iff_lt, sub_pos] -- suffices (1 - a.2.1 * a.2.2) * a.1 < a.1 by linarith -- rw [mul_lt_iff_lt_one_left] -- · simp only [sub_lt_self_iff] -- nlinarith -- · exact hx0 -+ apply ne_of_gt -+ dsimp only [F] -+ positivity - rw [MeasureTheory.Measure.restrict_apply'] -- rw [Set.inter_eq_right.2 subset] -- simp only [MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Measure.prod_prod] -- simp only [Real.volume_Ioo, sub_zero, ENNReal.ofReal_one, mul_one, zero_lt_one] -+ · rw [Set.inter_eq_right.2 subset] -+ simp only [MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Measure.prod_prod] -+ simp only [Real.volume_Ioo, sub_zero, ENNReal.ofReal_one, mul_one, zero_lt_one] - · measurability - · apply MeasureTheory.ae_nonneg_restrict_of_forall_setIntegral_nonneg_inter - · rw [MeasureTheory.IntegrableOn] -@@ -1041,10 +965,10 @@ theorem JJ_pos (n : ℕ) : 0 < JJ n := by - apply mul_nonneg _ (by linarith) - apply mul_nonneg _ (by linarith) - apply mul_nonneg (by linarith) (by linarith) -- · simp only [abs_eq_self, sub_nonneg] -- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) -- · simp only [abs_eq_self, sub_nonneg] -- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) -+ · simp only [sub_nonneg] -+ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) -+ · simp only [sub_nonneg] -+ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) - · rw [Set.mem_inter_iff] at hx - tauto - · exact integrableOn_JJ' n -@@ -1078,12 +1002,13 @@ lemma Summable_of_zeta_two' : Summable (fun (n : ℕ) ↦ 1 / ((n : ℝ) + 1) ^ - exact h - - lemma zeta_3_pos : 0 < ∑' (n : ℕ), 1 / ((n : ℝ) + 1) ^ 3 := by -- apply tsum_pos (ι := ℕ) (g := fun n => 1 / ((n : ℝ) + 1) ^ 3) (i := 1) -+ apply Summable.tsum_pos (ι := ℕ) (g := fun n => 1 / ((n : ℝ) + 1) ^ 3) (i := 1) - · apply summable_of_sum_range_le (c := Real.pi ^ 2 / 6) - · intro _ - positivity - · intro n -- suffices ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 3 ≤ ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 2 by -+ suffices ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 3 ≤ -+ ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 2 by - have : ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 2 ≤ Real.pi ^ 2 / 6 := by - suffices ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 2 ≤ ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 2 by - have h : ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 2 = (riemannZeta 2).re := by -@@ -1092,10 +1017,10 @@ lemma zeta_3_pos : 0 < ∑' (n : ℕ), 1 / ((n : ℝ) + 1) ^ 3 := by - norm_cast - rw [h, riemannZeta_two] at this - norm_cast at * -- apply sum_le_tsum (s := Finset.range n) -- intro i _ -- positivity -- exact Summable_of_zeta_two' -+ apply Summable.sum_le_tsum (s := Finset.range n) -+ · intro i _ -+ positivity -+ · exact Summable_of_zeta_two' - linarith - apply Finset.sum_le_sum - intro i _ -@@ -1104,7 +1029,7 @@ lemma zeta_3_pos : 0 < ∑' (n : ℕ), 1 / ((n : ℝ) + 1) ^ 3 := by - · positivity - · positivity - · intro m -- simp only [one_div, pow_succ, add_comm, add_left_comm] -+ simp only [one_div, pow_succ] - positivity - · positivity - -@@ -1133,45 +1058,18 @@ theorem JJ_upper (n : ℕ) : JJ n ≤ 2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n - apply mul_nonneg _ (by linarith) - apply mul_nonneg _ (by linarith) - apply mul_nonneg (by linarith) (by linarith) -- · simp only [abs_eq_self, sub_nonneg] -- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) -- · simp only [abs_eq_self, sub_nonneg] -- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) -+ · simp only [sub_nonneg] -+ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) -+ · simp only [sub_nonneg] -+ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) - · rw [Set.mem_inter_iff] at hx - tauto -- · apply AEMeasurable.aestronglyMeasurable -- rw [← aemeasurable_indicator_iff (by measurability)] -- apply AEMeasurable.indicator _ (by measurability) -- apply AEMeasurable.div -- · apply AEMeasurable.pow_const -- apply AEMeasurable.div -- · apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.fst (f := id) aemeasurable_id) _) -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) _) -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) _) -- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) -- · apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) -- · apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- (AEMeasurable.snd (f := id) aemeasurable_id)) -- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- (AEMeasurable.fst (f := id) aemeasurable_id)) -+ · apply Measurable.aestronglyMeasurable -+ fun_prop - - lemma zeta3_le_zeta2 : ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 < ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 2 := by -- apply tsum_lt_tsum_of_nonneg (f := fun n => 1 / ((n : ℝ) + 1) ^ 3) (g := fun n => 1 / ((n : ℝ) + 1) ^ 2) (i := 2) -+ apply Summable.tsum_lt_tsum_of_nonneg (f := fun n => 1 / ((n : ℝ) + 1) ^ 3) -+ (g := fun n => 1 / ((n : ℝ) + 1) ^ 2) (i := 2) - · intro n - positivity - · intro n -@@ -1182,9 +1080,10 @@ lemma zeta3_le_zeta2 : ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 < ∑' n : ℕ , 1 - · norm_num - · exact Summable_of_zeta_two' - --lemma ε_N_def_of_pi_alt : ∀ ε > (0 : ℝ), ∃ N : ℕ, ∀ n : ℕ, n ≥ N → n.primeCounting ≤ (1 + ε) * (n : ℝ) / (n : ℝ).log := by -+lemma ε_N_def_of_pi_alt : ∀ ε > (0 : ℝ), ∃ N : ℕ, ∀ n : ℕ, -+ n ≥ N → n.primeCounting ≤ (1 + ε) * (n : ℝ) / (n : ℝ).log := by - intro ε hε -- obtain ⟨c,⟨hc0, hc1⟩⟩ := pi_alt -+ obtain ⟨c,⟨hc0, hc1⟩⟩ := AperyPNT.pi_alt - rw [Asymptotics.isLittleO_const_iff (by simp), tendsto_atTop_nhds] at hc0 - specialize hc0 (Set.Ioo (-ε) ε) (by simp only [Set.mem_Ioo, Left.neg_neg_iff, hε, and_self]) - (by exact isOpen_Ioo) -@@ -1193,26 +1092,27 @@ lemma ε_N_def_of_pi_alt : ∀ ε > (0 : ℝ), ∃ N : ℕ, ∀ n : ℕ, n ≥ N - intro n hn - have hn' : n ≥ N := by - trans (⌈N⌉₊ : ℝ) -- norm_cast -- linarith -- exact Nat.le_ceil N -+ · norm_cast -+ linarith -+ · exact Nat.le_ceil N - specialize hN n hn' - specialize hc1 n - simp only [Nat.floor_natCast] at hc1 - simp only [Set.mem_Ioo] at hN -- rw [hc1, ← mul_div, ← mul_div, mul_le_mul_right] -- linarith -- apply div_pos -- norm_cast -- omega -- apply Real.log_pos -- norm_cast -- omega -+ rw [hc1, ← mul_div, ← mul_div, mul_le_mul_iff_of_pos_right] -+ · linarith -+ · apply div_pos -+ · norm_cast -+ omega -+ · apply Real.log_pos -+ norm_cast -+ omega - - lemma eventuallyN_of_le : ∃ N : ℕ, ∀ n : ℕ, n ≥ N → ↑(d (Finset.Icc 1 n)) ^ 3 ≤ (21 : ℝ) ^ n := by - have h1 : (Real.exp 1) ^ 3 < (21 : ℝ) := by - suffices (2.7182818286) ^ 3 < (21 : ℝ) by -- exact pow_lt_pow_left₀ Real.exp_one_lt_d9 (n := 3) (by linarith [Real.exp_pos 1]) (by simp) |>.trans this -+ exact pow_lt_pow_left₀ Real.exp_one_lt_d9 (n := 3) -+ (by linarith [Real.exp_pos 1]) (by simp) |>.trans this - norm_num - have h : Real.log (21 ^ (1 / 3 : ℝ)) - 1 > 0 := by - simp only [gt_iff_lt, sub_pos] -@@ -1232,13 +1132,14 @@ lemma eventuallyN_of_le : ∃ N : ℕ, ∀ n : ℕ, n ≥ N → ↑(d (Finset.Ic - _ ≤ (n ^ (1 / 3 * Real.log 21 * ↑n / Real.log ↑n)) ^ 3 := by - apply pow_le_pow_left₀ (by simp) - rw [← Real.rpow_natCast, Real.rpow_le_rpow_left_iff] -- exact hN -- simp only [Nat.one_lt_cast] -- omega -+ · exact hN -+ · simp only [Nat.one_lt_cast] -+ omega - _ ≤ (21 : ℝ) ^ n := by - rw [← Real.rpow_natCast, ← Real.rpow_mul (by simp), mul_comm] - nth_rewrite 1 [← Real.exp_log (x := n) (by simp only [Nat.cast_pos]; omega)] -- have h2 : Real.log ↑n * (↑3 * (1 / 3 * Real.log 21 * ↑n / Real.log ↑n)) = Real.log 21 * ↑n := by -+ have h2 : Real.log ↑n * (↑3 * (1 / 3 * Real.log 21 * ↑n / Real.log ↑n)) = -+ Real.log 21 * ↑n := by - rw [← mul_assoc, mul_div, ← mul_assoc, ← mul_assoc] - simp only [one_div, isUnit_iff_ne_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, - IsUnit.mul_inv_cancel_right] -@@ -1249,10 +1150,12 @@ lemma eventuallyN_of_le : ∃ N : ℕ, ∀ n : ℕ, n ≥ N → ↑(d (Finset.Ic - constructor <;> omega - rw [← Real.exp_one_rpow, ← Real.rpow_mul (by exact Real.exp_nonneg 1)] - norm_cast -- rw [h2, Real.rpow_mul (by exact Real.exp_nonneg 1), Real.exp_one_rpow, Real.exp_log (by norm_num)] -+ rw [h2, Real.rpow_mul (by exact Real.exp_nonneg 1), Real.exp_one_rpow, -+ Real.exp_log (by norm_num)] - norm_cast - --theorem fun1_tendsto_zero : Filter.Tendsto (fun n ↦ ENNReal.ofReal (fun1 n)) Filter.atTop (nhds 0) := by -+theorem fun1_tendsto_zero : Filter.Tendsto (fun n ↦ ENNReal.ofReal (fun1 n)) Filter.atTop (nhds -+ 0) := by - rw [ENNReal.tendsto_atTop_zero] - intro ε hε - if h : ε = ⊤ then simp [h] -@@ -1270,13 +1173,13 @@ theorem fun1_tendsto_zero : Filter.Tendsto (fun n ↦ ENNReal.ofReal (fun1 n)) F - use N.max N1 - intro n hn - rw [ENNReal.ofReal_le_ofReal_iff (by simp)] -- suffices ↑(d (Finset.Icc 1 n)) ^ 3 * 2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 ≤ ε.toReal by -+ suffices ↑(d (Finset.Icc 1 n)) ^ 3 * 2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 ≤ -+ ε.toReal by - trans ↑(d (Finset.Icc 1 n)) ^ 3 * 2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 -- swap -- exact this -- rw [mul_assoc, mul_assoc] -- apply mul_le_mul_of_nonneg_left _ (by simp) -- linarith [JJ_upper n] -+ · rw [mul_assoc, mul_assoc] -+ apply mul_le_mul_of_nonneg_left _ (by simp) -+ linarith [JJ_upper n] -+ · exact this - calc - _ ≤ 2 * (21 / 24 : ℝ) ^ n * (∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3) := by - apply mul_le_mul_of_nonneg_right _ (by linarith[zeta_3_pos]) -@@ -1287,7 +1190,8 @@ theorem fun1_tendsto_zero : Filter.Tendsto (fun n ↦ ENNReal.ofReal (fun1 n)) F - exact hN n (le_of_max_le_left hn) - _ ≤ ε.toReal := by - specialize hN1 n (le_of_max_le_right hn) -- rw [← ENNReal.ofReal_toReal_eq_iff.2 h, ← ENNReal.ofReal_div_of_pos (by linarith [zeta_3_pos]), -+ rw [← ENNReal.ofReal_toReal_eq_iff.2 h, ← ENNReal.ofReal_div_of_pos (by linarith -+ [zeta_3_pos]), - ← ENNReal.ofReal_pow (by norm_num), ENNReal.ofReal_le_ofReal_iff] at hN1 - · rw [le_div_iff₀ (by linarith [zeta_3_pos])] at hN1 - linarith -@@ -1301,7 +1205,7 @@ theorem zeta_3_irratoinal : ¬ ∃ r : ℚ , r = riemannZeta 3 := by - norm_cast - simp_rw [Nat.cast_pow, Nat.cast_add, Nat.cast_one] - by_contra! r -- cases' r with r hr -+ obtain ⟨r, hr⟩ := r - let q := r.den - let hq := Rat.den_nz r - have prop1 := ENNReal.Tendsto.mul_const (b := (q : ENNReal)) (fun1_tendsto_zero) (by simp) -@@ -1324,21 +1228,18 @@ theorem zeta_3_irratoinal : ¬ ∃ r : ℚ , r = riemannZeta 3 := by - norm_cast at this ⊢ - rw [ENNReal.tendsto_atTop_zero] at prop1 - specialize prop1 (1/2) (by simp) -- simp only [one_div, Ico_mem_nhds_iff, Set.mem_Ioo, inv_pos, Nat.ofNat_pos, and_true, Set.mem_Ico, -- Filter.eventually_top] at prop1 -+ simp only [one_div] at prop1 - rw [← one_div] at prop1 -- simp only [Filter.eventually_atTop, ge_iff_le] at prop1 -- cases' prop1 with a ha -+ simp only [ge_iff_le] at prop1 -+ obtain ⟨a, ha⟩ := prop1 - specialize prop2 (a + 1) - specialize ha (a + 1) (by simp) - rw [gt_iff_lt, ← ENNReal.ofReal_lt_ofReal_iff, ENNReal.ofReal_mul' (by simp)] at prop2 -- · suffices ENNReal.ofReal (fun1 (a + 1)) * ↑q < ENNReal.ofReal (fun1 (a + 1)) * ↑q by -- simp only [mul_neg, eval_mul, one_div, eval_C, Function.iterate_succ, Function.comp_apply, -- derivative_mul, derivative_X_pow, Nat.cast_add, Nat.cast_one, map_add, map_natCast, map_one, -- add_tsub_cancel_right, iterate_map_add, eval_add, lt_self_iff_false] at this -- rw [show ENNReal.ofReal ↑q = (q : ENNReal) by simp only [ENNReal.ofReal_natCast], -- show ENNReal.ofReal (1 / 2) = 1 / 2 by rw [ENNReal.ofReal_div_of_pos (by norm_num)]; simp] at prop2 -- apply LE.le.trans_lt (b := (1 / 2 : ENNReal)) ha prop2 -+ · have hhalf : ENNReal.ofReal (1 / 2 : ℝ) = (1 / 2 : ENNReal) := by -+ rw [ENNReal.ofReal_div_of_pos (by norm_num)] -+ simp -+ rw [ENNReal.ofReal_natCast, hhalf] at prop2 -+ exact not_lt_of_ge ha prop2 - · apply mul_pos _ (by simp; omega) - apply mul_pos _ (JJ_pos (a + 1)) - apply pow_pos -diff --git a/Zeta3Irrational/Bound.lean b/Zeta3Irrational/Bound.lean -index 56b2726..bb10351 100644 ---- a/Zeta3Irrational/Bound.lean -+++ b/Zeta3Irrational/Bound.lean -@@ -1,12 +1,15 @@ - import Mathlib.Analysis.RCLike.Basic --import Mathlib.Data.Real.StarOrdered -+import Mathlib.Analysis.Real.Sqrt -+ -+/-! Elementary bounds for the Apéry integral, ported from the Apache-2.0 proof by -+Junqi Liu and Jujian Zhang. -/ - - open scoped Nat - open BigOperators - - lemma max_value {x : ℝ} (x0 : 0 < x) (x1 : x < 1) : √x * √(1 - x) ≤ ((1 / 2) : ℝ) := by - rw [← Real.sqrt_mul, le_div_iff₀, ← show √4 = 2 by rw [Real.sqrt_eq_iff_eq_sq] <;> linarith, -- ← Real.sqrt_mul, Real.sqrt_le_one, show x * (1 - x) * 4= 1 - (2 * x - 1)^2 by ring] <;> -+ ← Real.sqrt_mul, Real.sqrt_le_one, show x * (1 - x) * 4 = 1 - (2 * x - 1) ^ 2 by ring] <;> - nlinarith [mul_self_nonneg (2 * x - 1)] - - lemma max_value' {x : ℝ} (x0 : 0 < x) (x1 : x < 1) : √x * (1 - x) ≤ ((2 / 5) : ℝ) := by -@@ -22,7 +25,7 @@ lemma max_value' {x : ℝ} (x0 : 0 < x) (x1 : x < 1) : √x * (1 - x) ≤ ((2 / - _ ≤ ((2 / 5) : ℝ) := by - rw [Real.sqrt_le_left] <;> norm_num - --lemma nonneg {x : ℝ} (_ : 0 < x) (_ : x < 1) : (0 : ℝ) ≤ √x * √(1 -x) := -+lemma nonneg {x : ℝ} (_ : 0 < x) (_ : x < 1) : (0 : ℝ) ≤ √x * √(1 - x) := - mul_nonneg (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) - - lemma bound_aux (x z : ℝ) (x0 : 0 < x) (x1 : x < 1) (z0 : 0 < z) (_ : z < 1) : -@@ -36,8 +39,9 @@ lemma bound_aux (x z : ℝ) (x0 : 0 < x) (x1 : x < 1) (z0 : 0 < z) (_ : z < 1) : - _ = √(1 - x) * √(1 - x) + √(x * z) * √(x * z) := by ring - _ = 1 - x + x * z := by rw [Real.mul_self_sqrt, Real.mul_self_sqrt] <;> linarith - --lemma bound (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z0 : 0 < z) (z1 : z < 1) : -- x * (1 -x) * y * (1 - y) * z * (1 - z) / ((1 - (1 - z) * x) * (1 - y * z)) < (1 / 30 : ℝ) := by -+lemma bound (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) -+ (z0 : 0 < z) (z1 : z < 1) : -+ x * (1 - x) * y * (1 - y) * z * (1 - z) / ((1 - (1 - z) * x) * (1 - y * z)) < (1 / 30 : ℝ) := by - have := mul_pos x0 z0 - have h1 : 2 * √(1 - x) * √(x * z) ≤ 1 - (1 - z) * x := by apply bound_aux <;> assumption - have h2 : 2 * √(1 - y) * √((1 - z) * y) ≤ 1 - y * z := by -@@ -52,22 +56,24 @@ lemma bound (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z - have : 0 ≤ x.sqrt * (1 - x).sqrt := nonneg (by assumption) (by linarith) - have : 0 ≤ y.sqrt * (1 - y).sqrt := nonneg (by assumption) (by linarith) - calc -- _ ≤ x * (1 -x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - x) * √(x * z) * (1 - y * z)) := by -+ _ ≤ x * (1 - x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - x) * √(x * z) * (1 - y * z)) := by - refine div_le_div₀ (by positivity) (le_refl _) (by positivity) ?_ - rwa [mul_le_mul_iff_of_pos_right] - linarith -- _ ≤ x * (1 -x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - x) * √(x * z) * 2 * √(1 - y) * √((1 - z) * y)) := by -+ _ ≤ x * (1 - x) * y * (1 - y) * z * (1 - z) / -+ (2 * √(1 - x) * √(x * z) * 2 * √(1 - y) * √((1 - z) * y)) := by - refine div_le_div₀ (by positivity) (le_refl _) (by positivity) ?_ - rw [mul_assoc, mul_assoc] - rw [mul_assoc] at h2 - exact mul_le_mul_of_nonneg_left h2 (le_of_lt <| by positivity) -- _ = √x * √(1 -x) * (√y * √(1 - y)) * (√z * √(1 - z)) / 4 := by -- rw [Real.sqrt_mul, Real.sqrt_mul] -- calc _ -- _ = ((x * (1 - x)) * (y * (1 - y)) * (z * (1 - z))) / (4 * (√x * √(1 - x)) * (√y * √(1 - y)) * (√z * √(1 - z))) := by ring -- _ = (x / √x) * ((1 - x) / √(1 - x)) * (y / √y) * ((1 - y) / √(1 -y)) * (z / √z) * ((1 - z) / √(1 - z)) / 4 := by ring -+ _ = √x * √(1 - x) * (√y * √(1 - y)) * (√z * √(1 - z)) / 4 := by -+ rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity)] -+ calc -+ _ = ((x * (1 - x)) * (y * (1 - y)) * (z * (1 - z))) / -+ (4 * (√x * √(1 - x)) * (√y * √(1 - y)) * (√z * √(1 - z))) := by ring -+ _ = (x / √x) * ((1 - x) / √(1 - x)) * (y / √y) * -+ ((1 - y) / √(1 - y)) * (z / √z) * ((1 - z) / √(1 - z)) / 4 := by ring - _ = _ := by simpa only [Real.div_sqrt] using (by ring) -- all_goals linarith - _ ≤ (1 / 2) * (1 / 2) * (1 / 2) / 4 := by - refine div_le_div₀ (by norm_num) - (mul_le_mul_of_nonneg (mul_le_mul_of_nonneg (max_value ?_ ?_) (max_value ?_ ?_) ?_ ?_) -@@ -75,7 +81,8 @@ lemma bound (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z - linarith - _ < (1 / 30 : ℝ) := by norm_num - --lemma bound_aux' (x y z : ℝ) (x0 : 0 < x) (_ : x < 1) (y0 : 0 < y) (_ : y < 1) (z0 : 0 < z) (z1 : z < 1) : -+lemma bound_aux' (x y z : ℝ) (x0 : 0 < x) (_ : x < 1) (y0 : 0 < y) (_ : y < 1) -+ (z0 : 0 < z) (z1 : z < 1) : - 2 * √(1 - z) * √(x * y * z) ≤ 1 - (1 - x * y) * z := by - rw [← sub_pos] at z1 - have := mul_pos x0 (mul_pos y0 z0) -@@ -86,7 +93,8 @@ lemma bound_aux' (x y z : ℝ) (x0 : 0 < x) (_ : x < 1) (y0 : 0 < y) (_ : y < 1) - _ = √(1 - z) * √(1 - z) + √(x * y * z) * √(x * y * z) := by ring - _ = 1 - z + x * y * z := by rw [Real.mul_self_sqrt, Real.mul_self_sqrt] <;> linarith - --lemma bound' (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z0 : 0 < z) (z1 : z < 1) : -+lemma bound' (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) -+ (z0 : 0 < z) (z1 : z < 1) : - x * (1 - x) * y * (1 - y) * z * (1 - z) / (1 - (1 - x * y) * z) < (1 / 24 : ℝ) := by - have := mul_pos x0 z0 - have h1 : 2 * √(1 - x) * √(x * z) ≤ 1 - (1 - z) * x := by apply bound_aux <;> assumption -@@ -102,16 +110,17 @@ lemma bound' (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) ( - have : 0 ≤ x.sqrt * (1 - x) := mul_nonneg (Real.sqrt_nonneg _) (by linarith) - have : 0 ≤ y.sqrt * (1 - y) := mul_nonneg (Real.sqrt_nonneg _) (by linarith) - calc -- _ ≤ x * (1 -x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - z) * √(x * y * z)) := by -+ _ ≤ x * (1 - x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - z) * √(x * y * z)) := by - refine div_le_div₀ (by positivity) (le_refl _) (by positivity) ?_ - apply bound_aux' <;> linarith - _ = √x * (1 - x) * (√y * (1 - y)) * (√z * √(1 - z)) / 2 := by -- rw [Real.sqrt_mul, Real.sqrt_mul] -- calc _ -- _ = ((x * (1 - x)) * (y * (1 - y)) * (z * (1 - z))) / (2 * √x * √y * (√z * √(1 - z))) := by ring -- _ = (x / √x) * (1 - x) * (y / √y) * (1 - y) * (z / √z) * ((1 - z) / √(1 - z)) / 2 := by ring -+ rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity)] -+ calc -+ _ = ((x * (1 - x)) * (y * (1 - y)) * (z * (1 - z))) / -+ (2 * √x * √y * (√z * √(1 - z))) := by ring -+ _ = (x / √x) * (1 - x) * (y / √y) * (1 - y) * (z / √z) * -+ ((1 - z) / √(1 - z)) / 2 := by ring - _ = _ := by simpa only [Real.div_sqrt] using (by ring) -- all_goals nlinarith - _ ≤ (2 / 5) * (2 / 5) * (1 / 2) / 2 := by - refine div_le_div₀ (by norm_num) - (mul_le_mul_of_nonneg (mul_le_mul_of_nonneg (max_value' ?_ ?_) (max_value' ?_ ?_) ?_ ?_) -diff --git a/Zeta3Irrational/Equality.lean b/Zeta3Irrational/Equality.lean -index 4fc5c29..0beb8e6 100644 ---- a/Zeta3Irrational/Equality.lean -+++ b/Zeta3Irrational/Equality.lean -@@ -27,10 +27,10 @@ lemma integral_equality_help (s t : ℝ) (s0 : 0 < s) (s1 : s < 1) (t0 : 0 < t) - · ring_nf - · have _ : 0 < (1 - (1 - s) * t) * ((1 - (1 - u) * s) * (1 - (1 - t) * u)) := by - rw[mul_pos_iff_of_pos_left, mul_pos_iff_of_pos_left] <;> linarith -- positivity -+ linarith - · have _ : 0 < (1 - (1 - u) * s) * (1 - (1 - t) * u) := by - rw[mul_pos_iff_of_pos_left] <;> linarith -- positivity -+ linarith - · linarith - · linarith - rw[← intervalIntegral.integral_congr] -@@ -39,22 +39,16 @@ lemma integral_equality_help (s t : ℝ) (s0 : 0 < s) (s1 : s < 1) (t0 : 0 < t) - rw[inv_eq_one_div, inv_eq_one_div, inv_eq_one_div, one_div_mul_one_div] - simp at b - rcases b with ⟨b1, b2⟩ -- rw[← not_lt] at b1 -- cases' eq_or_lt_of_not_lt b1 with b11 b12 -- · rw[b11] -- field_simp -- rw[div_eq_one_iff_eq] -- ring_nf -- have _ : 0 < 1 - (1 - s) * t := by linarith -- positivity -- · rw[← not_lt] at b2 -- cases' eq_or_lt_of_not_lt b2 with b21 b22 -- · rw[← b21] -- field_simp -- rw[div_eq_one_iff_eq] -- ring_nf -- have _ : 0 < 1 - (1 - s) * t := by linarith -- positivity -+ rcases eq_or_lt_of_le b1 with b11 | b12 -+ · rw[← b11] -+ norm_num -+ field_simp [ne_of_gt s1, ne_of_gt (sub_pos.mpr h2)] -+ ring -+ · rcases eq_or_lt_of_le b2 with b21 | b22 -+ · rw[b21] -+ norm_num -+ field_simp [ne_of_gt t0, ne_of_gt (sub_pos.mpr h2)] -+ ring - · obtain b00 := eq1 a b12 b22 - rw[b00, mul_comm] - -@@ -99,7 +93,7 @@ lemma integral_equality (s t : ℝ) (s0 : 0 < s) (s1 : s < 1) (t0 : 0 < t) (t1 : - apply IntervalIntegrable.continuousOn_mul (hg := continuousOn_const) - apply intervalIntegral.intervalIntegrable_inv - · intros x hx -- simp only [ge_iff_le, zero_le_one, Set.uIcc_of_le, Set.mem_Icc] at hx -+ simp only [zero_le_one, Set.uIcc_of_le, Set.mem_Icc] at hx - intro r - rw [sub_eq_zero] at r - have ineq3 : (1 - x) * s ≤ 1 * s := by -diff --git a/Zeta3Irrational/Integral.lean b/Zeta3Irrational/Integral.lean -index 15c6253..c732e9c 100644 ---- a/Zeta3Irrational/Integral.lean -+++ b/Zeta3Irrational/Integral.lean -@@ -2,23 +2,26 @@ - A formal proof of the irrationality of Riemann-Zeta(3). - Author: Junqi Liu and Jujian Zhang. - -/ --import Mathlib.Analysis.Normed.Field.Instances - import Mathlib.Analysis.PSeries --import Mathlib.Analysis.SpecialFunctions.Integrals --import Mathlib.Data.Real.StarOrdered -+import Mathlib.Analysis.SpecialFunctions.Integrals.Basic -+import Mathlib.Analysis.Real.Sqrt - import Mathlib.MeasureTheory.Function.AEEqOfIntegral - import Mathlib.MeasureTheory.Integral.IntegralEqImproper - import Mathlib.Topology.Algebra.Module.ModuleTopology --import Mathlib.Topology.Compactness.PseudometrizableLindelof -+import Mathlib.Topology.Metrizable.Basic -+ -+/-! Integral identities in the Apache-2.0 Apéry proof of Junqi Liu and Jujian Zhang. -/ - - open scoped Nat - open BigOperators Finset - -+/-- The real Apéry double integral with monomial weights of degrees `r` and `s`. -/ - noncomputable abbrev J (r s : ℕ) : ℝ := - ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - -(x.1 * x.2).log / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s - --noncomputable abbrev J_ENN (r s : ℕ) : ENNReal := -+/-- The nonnegative extended-real Apéry double integral with weights of degrees `r` and `s`. -/ -+noncomputable abbrev jENN (r s : ℕ) : ENNReal := - ∫⁻ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - ENNReal.ofReal (- (x.1 * x.2).log / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s) - -@@ -26,7 +29,7 @@ lemma log_rpow_integral_aux (n : ℝ) (a : ℝ) (ha : 0 < a ∧ a ≤ 1) : - ∫ (x : ℝ) in Set.Ioc a 1, |-x.log * x ^ n| = ∫ (x : ℝ) in Set.Ioc a 1, -x.log * x ^ n := by - apply MeasureTheory.setIntegral_congr_fun (by measurability) - intro x hx -- simp only [gt_iff_lt, Set.mem_Ioc, neg_mul, abs_neg, abs_eq_neg_self] at * -+ simp only [Set.mem_Ioc, neg_mul, abs_neg, abs_eq_neg_self] at * - rw [mul_nonpos_iff] - right - constructor -@@ -42,7 +45,7 @@ lemma log_rpow_integral' (n : ℝ) (hn : n > -1) (a : ℝ) (ha : 0 < a ∧ a ≤ - f 1 - f a by simp[f], ← intervalIntegral.integral_of_le ha.2] - refine intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le ha.2 (a := a) (b := 1) (f := f) - (f' := fun x : ℝ => -x.log * x ^ n ) ?_ ?_ ?_ -- · simp [f] -+ · simp only [f] - refine ContinuousOn.sub (ContinuousOn.div_const ?_ (((n : ℝ) + 1) ^ 2)) ?_ - · apply ContinuousOn.rpow_const continuousOn_id - intro x hx -@@ -77,7 +80,8 @@ lemma log_rpow_integral' (n : ℝ) (hn : n > -1) (a : ℝ) (ha : 0 < a ∧ a ≤ - norm_cast - apply Real.hasDerivAt_rpow_const - left ; linarith -- · have h : x ^ n * x.log + x ^ n / (↑n + 1) = ((↑n + 1) * x ^ n * x.log + x ^ n) / (↑n + 1) := by -+ · have h : x ^ n * x.log + x ^ n / (↑n + 1) = -+ ((↑n + 1) * x ^ n * x.log + x ^ n) / (↑n + 1) := by - rw [add_div] - congr 1 - rw [eq_div_iff (by linarith)] -@@ -104,12 +108,14 @@ lemma log_rpow_integral' (n : ℝ) (hn : n > -1) (a : ℝ) (ha : 0 < a ∧ a ≤ - simp only [Set.mem_Icc, id_eq, ne_eq] at hx ⊢ - nlinarith - --lemma log_rpow_integrable (n : ℝ) (hn : n > -1) : IntervalIntegrable (fun x ↦ -Real.log x * x ^ n) MeasureTheory.volume 0 1 := by -+lemma log_rpow_integrable (n : ℝ) (hn : n > -1) : -+ IntervalIntegrable (fun x ↦ -Real.log x * x ^ n) MeasureTheory.volume 0 1 := by - let f := fun (x : ℝ) => -x.log * x ^ n - apply MeasureTheory.IntegrableOn.intervalIntegrable - rw [Set.uIcc_of_le (by norm_num), integrableOn_Icc_iff_integrableOn_Ioc] - apply MeasureTheory.integrableOn_Ioc_of_intervalIntegral_norm_bounded_left (f := f) -- (l := Filter.atTop) (a := fun (n : ℕ) => 1 / (n + 1 : ℝ)) (a₀ := 0) (b := 1) (I := 1 / (n + 1) ^ 2) -+ (l := Filter.atTop) (a := fun (n : ℕ) => 1 / (n + 1 : ℝ)) (a₀ := 0) (b := 1) -+ (I := 1 / (n + 1) ^ 2) - · intro i - simp only [one_div, f] - have hi : 0 < ((i : ℝ) + 1)⁻¹ ∧ ((i : ℝ) + 1)⁻¹ ≤ 1 := by -@@ -137,7 +143,7 @@ lemma log_rpow_integrable (n : ℝ) (hn : n > -1) : IntervalIntegrable (fun x - · rw [log_rpow_integral' n hn] - · set k := _ - change _ - k ≤ _ -- simp only [Real.log_inv, tsub_le_iff_right, le_add_iff_nonneg_right, -+ simp only [tsub_le_iff_right, le_add_iff_nonneg_right, - sub_nonneg, k] - rw [div_le_div_iff₀ (by linarith) (by nlinarith), mul_assoc, mul_le_mul_iff_of_pos_left] - · trans 0 -@@ -164,7 +170,8 @@ lemma log_rpow_integral (n : ℝ) (hn : n > -1) : - ∫ (x : ℝ) in (0)..1, -x.log * x ^ n = 1 / (n + 1) ^ 2 := by - let F := fun (x : ℝ) => x ^ (n + 1) * (1 - (n + 1) * x.log) / (n + 1) ^ 2 - have h1 : 1 /(n + 1) ^ 2 = F 1 - F 0 := by -- simp [F] -+ simp only [F, Real.one_rpow, Real.log_one, mul_zero, sub_zero, -+ Real.log_zero, mul_one] - rw [Real.zero_rpow (by linarith), zero_div, sub_zero] - rw [h1] - refine intervalIntegral.integral_eq_sub_of_hasDerivAt_of_tendsto (by norm_num) (a := 0) (b := 1) -@@ -211,7 +218,7 @@ lemma log_rpow_integral (n : ℝ) (hn : n > -1) : - exact fun ⦃U⦄ a ↦ a - · right; linarith - · apply Filter.Tendsto.div_const -- simp [← mul_assoc, ← mul_rotate (c := n + 1)] -+ simp only [← mul_assoc, ← mul_rotate (c := n + 1)] - nth_rw 3 [show (0 : ℝ) = 0 * (n + 1) by simp] - apply Filter.Tendsto.mul_const - apply tendsto_log_mul_rpow_nhdsGT_zero -@@ -303,42 +310,22 @@ lemma ENN_pow_integral (n : ℕ) : ∫⁻ (x : ℝ) in Set.Ioo 0 1, - · tauto - · omega - --lemma AEMeasurable_aux : AEMeasurable (fun (x : ℝ × ℝ × ℝ) ↦ -+lemma AEMeasurable_aux {r s : ℕ} : AEMeasurable (fun (x : ℝ × ℝ × ℝ) ↦ - 1 / (1 - (1 - x.2.1 * x.2.2) * x.1) * x.2.1 ^ r * x.2.2 ^ s) MeasureTheory.volume := by -- apply AEMeasurable.mul -- · apply AEMeasurable.mul -- · apply AEMeasurable.const_div -- apply AEMeasurable.const_sub -- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) -- · apply AEMeasurable.const_sub -- apply AEMeasurable.mul -- · apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- exact AEMeasurable.fst (f := id) aemeasurable_id -- · apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- exact AEMeasurable.snd (f := id) aemeasurable_id -- · apply AEMeasurable.pow_const -- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) -- exact AEMeasurable.fst (f := id) aemeasurable_id -- · apply AEMeasurable.pow_const -- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) -- exact AEMeasurable.snd (f := id) aemeasurable_id -+ fun_prop - - lemma integral1 {a : ℝ} (ha : 0 < a) (ha1 : a < 1) : - ∫ (z : ℝ) in (0)..1, 1 / (1 - (1 - a) * z) = - a.log / (1 - a) := by - rw[← sub_pos] at ha1 - have eq1 := intervalIntegral.integral_comp_mul_left (a := 0) (b := 1) (c := 1 - a) - (f := fun z ↦ (1 - z)⁻¹) (by positivity) -- have eq2 := intervalIntegral.mul_integral_comp_sub_mul (a := 0) (b := 1 - a) (f := fun x ↦ (x)⁻¹) -- (c := 1) (d := 1) - have eq3 := integral_inv_of_pos (a := a) (b := 1) ha (by norm_num) - simp only [mul_zero, mul_one, smul_eq_mul] at eq1 - simp only [one_div] - rw [eq1, inv_mul_eq_div] - field_simp - simp only [one_div] -- simp only [one_mul, intervalIntegral.integral_comp_sub_left, sub_sub_cancel, sub_zero, -- mul_zero] at eq2 -- rw[eq3] -+ rw [intervalIntegral.integral_comp_sub_left, sub_sub_cancel, sub_zero, eq3] - simp - - lemma sub_mul_mul_ne_zero (y : ℝ) (x : ℝ × ℝ) -@@ -348,7 +335,7 @@ lemma sub_mul_mul_ne_zero (y : ℝ) (x : ℝ × ℝ) - by_cases hy' : y = 0 - · rw [hy'] - simp -- · simp only [Set.mem_prod, Set.mem_Ioo, sub_pos, Set.mem_Icc, gt_iff_lt, sub_pos] at * -+ · simp only [sub_pos, Set.mem_Icc] at * - suffices (1 - x.1 * x.2) * y < y by linarith - rwa [mul_lt_iff_lt_one_left] - rcases hy with ⟨hy1, _⟩ -@@ -357,7 +344,7 @@ lemma sub_mul_mul_ne_zero (y : ℝ) (x : ℝ × ℝ) - linarith - - lemma integrableOn_aux (x : ℝ × ℝ) -- (h1 : 0 < 1 - (1 - x.1 * x.2)) (h2 : 1 - (1 - x.1 * x.2) < 1): -+ (h1 : 0 < 1 - (1 - x.1 * x.2)) (h2 : 1 - (1 - x.1 * x.2) < 1) : - MeasureTheory.IntegrableOn (fun t ↦ 1 / (1 - (1 - x.1 * x.2) * t)) - (Set.Ioo 0 1) MeasureTheory.volume := by - rw [← integrableOn_Ioc_iff_integrableOn_Ioo] -@@ -392,8 +379,7 @@ lemma integrableOn_aux (x : ℝ × ℝ) - simp at hy - apply div_nonneg (by norm_num) - simp only [sub_nonneg] -- apply mul_le_one₀ _ (by linarith) (by linarith) -- linarith -+ exact (mul_le_of_le_one_left (by linarith) (by linarith)).trans (by linarith) - - lemma JENN_eq_triple_aux' (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : - ∫⁻ (w : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (1 / (1 - (1 - x.1 * x.2) * w)) = -@@ -423,11 +409,10 @@ lemma JENN_eq_triple_aux' (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo - · simp only [h, true_and] at hs - apply div_nonneg (by norm_num) - simp only [sub_nonneg] -- apply mul_le_one₀ _ (by linarith) (by linarith) -- linarith -+ exact (mul_le_of_le_one_left (by linarith) (by linarith)).trans (by linarith) - · tauto - --lemma JENN_eq_triple_aux (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : -+lemma JENN_eq_triple_aux {r s : ℕ} (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : - ∫⁻ (w : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (1 / (1 - (1 - x.1 * x.2) * w) * x.1 ^ r * x.2 ^ s) = - ENNReal.ofReal (-Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s) := by - calc -@@ -454,11 +439,11 @@ lemma JENN_eq_triple_aux (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 - · simp only [Left.nonneg_neg_iff] - apply Real.log_nonpos - · apply mul_nonneg (by linarith) (by linarith) -- · apply mul_le_one₀ (by linarith) (by linarith) (by linarith) -+ · exact (mul_le_of_le_one_left (by linarith) (by linarith)).trans (by linarith) - · simp only [sub_nonneg] -- apply mul_le_one₀ (by linarith) (by linarith) (by linarith) -+ exact (mul_le_of_le_one_left (by linarith) (by linarith)).trans (by linarith) - --lemma JENN_eq_triple (r s : ℕ) : J_ENN r s = -+lemma JENN_eq_triple (r s : ℕ) : jENN r s = - ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1) * x.2.1 ^ r * x.2.2 ^ s) := by - symm -@@ -480,11 +465,12 @@ lemma JENN_eq_triple (r s : ℕ) : J_ENN r s = - exact AEMeasurable_aux - _ = ∫⁻ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - ENNReal.ofReal (- (x.1 * x.2).log / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s) := by -- apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ -+ apply MeasureTheory.setLIntegral_congr_fun (by measurability) - intro x hx -+ dsimp only - rw [JENN_eq_triple_aux _ hx] - --lemma AEMeasurable_aux' : AEMeasurable -+lemma AEMeasurable_aux' {k r s : ℕ} : AEMeasurable - (fun x ↦ ENNReal.ofReal (-Real.log (x.1 * x.2) * x.1 ^ (k + r) * x.2 ^ (k + s))) - (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1)) := by - apply AEMeasurable.ennreal_ofReal -@@ -551,10 +537,12 @@ lemma aux_lintegral3 (k r s : ℕ) : ∫⁻ (x : ℝ) in Set.Ioo 0 1, - ENNReal.ofReal (-x.log * x ^ (k + r) / (k + s + 1)) - = ENNReal.ofReal (1 / ((k + r + 1) ^ 2 * (k + s + 1))) := by - calc -- _ = (∫⁻ (x : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (-x.log * x ^ (k + r))) * ENNReal.ofReal (1 / (k + s + 1)) := by -+ _ = (∫⁻ (x : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (-x.log * x ^ (k + r))) * -+ ENNReal.ofReal (1 / (k + s + 1)) := by - rw [← MeasureTheory.lintegral_mul_const] -- · apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ -+ · apply MeasureTheory.setLIntegral_congr_fun (by measurability) - rintro y ⟨hy1, hy2⟩ -+ dsimp only - rw [← ENNReal.ofReal_mul] - · field_simp - simp only [neg_mul, Left.nonneg_neg_iff] -@@ -575,10 +563,12 @@ lemma aux_lintegral4 (k r s : ℕ) : ∫⁻ (x : ℝ) in Set.Ioo 0 1, - ENNReal.ofReal (x ^ (k + r) / (k + s + 1) ^ 2) - = ENNReal.ofReal (1 / ((k + r + 1) * (k + s + 1) ^ 2)) := - calc -- _ = (∫⁻ (x : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (x ^ (k + r))) * ENNReal.ofReal (1 / (k + s + 1) ^ 2) := by -+ _ = (∫⁻ (x : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (x ^ (k + r))) * -+ ENNReal.ofReal (1 / (k + s + 1) ^ 2) := by - rw [← MeasureTheory.lintegral_mul_const] -- · apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ -+ · apply MeasureTheory.setLIntegral_congr_fun (by measurability) - rintro y ⟨hy1, hy2⟩ -+ dsimp only - rw [← ENNReal.ofReal_mul] - · field_simp - positivity -@@ -588,7 +578,7 @@ lemma aux_lintegral4 (k r s : ℕ) : ∫⁻ (x : ℝ) in Set.Ioo 0 1, - · norm_cast - · positivity - --lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): -+lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ) : - ∫⁻ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - ENNReal.ofReal (- (x.1 * x.2).log * x.1 ^ (k + r) * x.2 ^ (k + s)) = ENNReal.ofReal - (1 / ((k + r + 1) ^ 2 * (k + s + 1)) + 1 / ((k + r + 1) * (k + s + 1) ^ 2)) := by -@@ -597,14 +587,17 @@ lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): - · calc - _ = ∫⁻ (x : ℝ) in Set.Ioo 0 1, - ENNReal.ofReal (- x.log * x ^ (k + r) / (k + s + 1) + x ^ (k + r) / (k + s + 1) ^ 2) := by -- apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ -+ apply MeasureTheory.setLIntegral_congr_fun (by measurability) - intro x hx -+ dsimp only - simp only [neg_mul] -- have h2 : ∫⁻ (y : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (-((x * y).log * x ^ (k + r) * y ^ (k + s))) -+ have h2 : ∫⁻ (y : ℝ) in Set.Ioo 0 1, -+ ENNReal.ofReal (-((x * y).log * x ^ (k + r) * y ^ (k + s))) - = ∫⁻ (y : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (-(x.log * x ^ (k + r) * y ^ (k + s))) + - ENNReal.ofReal (-(y.log * x ^ (k + r) * y ^ (k + s))) := by -- apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ -+ apply MeasureTheory.setLIntegral_congr_fun (by measurability) - intro y hy -+ dsimp only - simp only [← neg_mul] - simp only [Set.mem_Ioo] at hx hy - rw [Real.log_mul (by linarith) (by linarith), neg_add, add_mul, add_mul, -@@ -639,9 +632,11 @@ lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): - have h2 : ∫⁻ (x : ℝ) in Set.Ioo 0 1, - ENNReal.ofReal (- x.log * x ^ (k + r) / (k + s + 1) + x ^ (k + r) / (k + s + 1) ^ 2) - = ∫⁻ (x : ℝ) in Set.Ioo 0 1, -- ENNReal.ofReal (-x.log * x ^ (k + r) / (k + s + 1)) + ENNReal.ofReal (x ^ (k + r) / (k + s + 1) ^ 2) := by -- apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ -+ ENNReal.ofReal (-x.log * x ^ (k + r) / (k + s + 1)) + -+ ENNReal.ofReal (x ^ (k + r) / (k + s + 1) ^ 2) := by -+ apply MeasureTheory.setLIntegral_congr_fun (by measurability) - rintro x ⟨hx1, hx2⟩ -+ dsimp only - rw [ENNReal.ofReal_add] - · apply div_nonneg _ (by positivity) - apply mul_nonneg _ (by apply pow_nonneg (by linarith)) -@@ -649,10 +644,8 @@ lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): - apply Real.log_nonpos (by nlinarith) (by nlinarith) - · apply div_nonneg _ (by positivity) - apply pow_nonneg (by linarith) -- - rw [h2, MeasureTheory.lintegral_add_left'] -- · simp only [Set.mem_Ioo] at h2 -- rw [aux_lintegral3 k r s, aux_lintegral4 k r s, ENNReal.ofReal_add] -+ · rw [aux_lintegral3 k r s, aux_lintegral4 k r s, ENNReal.ofReal_add] - · apply div_nonneg (by norm_num) (by positivity) - · apply div_nonneg (by norm_num) (by positivity) - · apply AEMeasurable.ennreal_ofReal -@@ -665,12 +658,12 @@ lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): - · rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] - exact AEMeasurable_aux' - --lemma J_ENN_rs_eq_tsum (r s : ℕ) : J_ENN r s = ∑' (k : ℕ), ENNReal.ofReal -+lemma J_ENN_rs_eq_tsum (r s : ℕ) : jENN r s = ∑' (k : ℕ), ENNReal.ofReal - (1 / ((k + r + 1) ^ 2 * (k + s + 1)) + 1 / ((k + r + 1) * (k + s + 1) ^ 2)) := by - calc - _ = ∫⁻ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - ∑' (k : ℕ), ENNReal.ofReal (- (x.1 * x.2).log * x.1 ^ (k + r) * x.2 ^ (k + s)) := by -- rw [J_ENN, ← MeasureTheory.lintegral_indicator (by measurability), -+ rw [jENN, ← MeasureTheory.lintegral_indicator (by measurability), - ← MeasureTheory.lintegral_indicator (by measurability)] - congr - ext y -@@ -711,9 +704,9 @@ lemma J_ENN_rs_eq_tsum (r s : ℕ) : J_ENN r s = ∑' (k : ℕ), ENNReal.ofReal - (1 / ((k + r + 1) ^ 2 * (k + s + 1)) + 1 / ((k + r + 1) * (k + s + 1) ^ 2)) := by - simp_rw [J_ENN_rs_eq_tsum_aux_intergal r s] - --lemma J_ENN_rr (r : ℕ) : J_ENN r r = ENNReal.ofReal -+lemma J_ENN_rr (r : ℕ) : jENN r r = ENNReal.ofReal - (2 * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 - 2 * ∑ m ∈ Finset.Icc 1 r, 1 / (m : ℝ) ^ 3) := by -- have h : J_ENN r r = ∑' (k : ℕ), ENNReal.ofReal (2 / ((k + r + 1) ^ 3)) := by -+ have h : jENN r r = ∑' (k : ℕ), ENNReal.ofReal (2 / ((k + r + 1) ^ 3)) := by - rw [J_ENN_rs_eq_tsum r r] - congr - ext k -@@ -724,13 +717,13 @@ lemma J_ENN_rr (r : ℕ) : J_ENN r r = ENNReal.ofReal - 2 * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 - 2 * ∑ m ∈ Finset.Icc 1 r, 1 / (m : ℝ) ^ 3 := by - symm - apply sub_eq_of_eq_add -- rw [← sum_add_tsum_nat_add' (k := r) (f := fun k => 1 / ((k : ℝ) + 1) ^ 3), mul_add, add_comm, -- ← tsum_mul_left] -- · simp only [mul_one_div, ← two_mul, ← mul_assoc, ← mul_add] -+ rw [← Summable.sum_add_tsum_nat_add' (k := r) (f := fun k => 1 / ((k : ℝ) + 1) ^ 3), -+ mul_add, add_comm, ← tsum_mul_left] -+ · simp only [mul_one_div] - congr 1 - · norm_cast - · congr 1 -- rw [← Nat.Ico_succ_right, Nat.succ_eq_add_one] -+ rw [← Finset.Ico_add_one_right_eq_Icc] - have h1 := Finset.sum_Ico_eq_sum_range (m := 1) (n := r + 1) (f := fun k => 1 / (k : ℝ) ^ 3) - simp only [add_tsub_cancel_right, Nat.cast_add, Nat.cast_one] at h1 - simp only [h1, add_comm] -@@ -746,13 +739,13 @@ lemma J_ENN_rr (r : ℕ) : J_ENN r r = ENNReal.ofReal - simp only [add_assoc, Nat.cast_pow] - rw [summable_nat_add_iff (k := r + 1) (f := fun k => 2 / (k ^ 3 : ℝ))] - have h2 := Real.summable_one_div_nat_pow (p := 3) -- simp only [Real.summable_nat_pow_inv, Nat.one_lt_ofNat] at h2 -+ simp only [Nat.one_lt_ofNat] at h2 - apply Iff.symm at h2 - rw [true_iff, ← summable_mul_left_iff (a := 2) (by norm_num)] at h2 - simp only [mul_one_div] at h2 - exact h2 - --lemma fun_of_J_nonneg (r s: ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : -+lemma fun_of_J_nonneg (r s : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : - 0 ≤ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s := by - simp only [Set.mem_prod, Set.mem_Ioo] at hx - apply mul_nonneg -@@ -770,7 +763,7 @@ lemma integrableOn_J_rr (r : ℕ) : MeasureTheory.IntegrableOn - (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ r) - (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) MeasureTheory.volume := by - have h := J_ENN_rr r -- simp only [J_ENN] at h -+ simp only [jENN] at h - rw [MeasureTheory.IntegrableOn, MeasureTheory.Integrable] - constructor - · apply AEMeasurable.aestronglyMeasurable -@@ -811,17 +804,18 @@ lemma integrableOn_J_rr (r : ℕ) : MeasureTheory.IntegrableOn - theorem J_rr (r : ℕ) : - J r r = 2 * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 - 2 * ∑ m ∈ Finset.Icc 1 r, 1 / (m : ℝ) ^ 3 := by - have h := J_ENN_rr r -- simp only [J_ENN] at h -+ simp only [jENN] at h - rw [J, MeasureTheory.integral_eq_lintegral_of_nonneg_ae, h, ENNReal.toReal_ofReal_eq_iff] -- · simp only [sub_nonneg, Nat.ofNat_pos, mul_le_mul_left] -- rw [← Nat.Ico_succ_right, Nat.succ_eq_add_one] -+ · simp only [sub_nonneg] -+ apply mul_le_mul_of_nonneg_left ?_ (by norm_num) -+ rw [← Finset.Ico_add_one_right_eq_Icc] - nth_rw 1 [← zero_add (a := 1)] - rw [← Finset.sum_Ico_add' (c := 1)] - norm_cast -- apply sum_le_tsum -+ apply Summable.sum_le_tsum - · intro i _; positivity - · norm_cast -- simp only [add_assoc, Nat.cast_pow] -+ simp only [Nat.cast_pow] - rw [summable_nat_add_iff (k := 1) (f := fun k => 1 / (k ^ 3 : ℝ)), - Real.summable_one_div_nat_pow (p := 3)] - norm_num -@@ -868,7 +862,7 @@ lemma summable_aux (r : ℕ) : Summable fun (b : ℕ) ↦ 1 / ((b : ℝ) + r + 1 - norm_num - - lemma J_ENN_rs (r s : ℕ) (h : r > s) : -- J_ENN r s = ENNReal.ofReal ((∑ k ∈ Finset.Ioc s r, 1 / (k : ℝ) ^ 2) / (r - s)) := by -+ jENN r s = ENNReal.ofReal ((∑ k ∈ Finset.Ioc s r, 1 / (k : ℝ) ^ 2) / (r - s)) := by - calc - _ = ∑' (k : ℕ), ENNReal.ofReal (1 / (r - s) * (1 / (k + s + 1) ^ 2 - 1 / (k + r + 1) ^ 2)) := by - rw [J_ENN_rs_eq_tsum] -@@ -906,15 +900,17 @@ lemma J_ENN_rs (r s : ℕ) (h : r > s) : - rw [← ENNReal.ofReal_tsum_of_nonneg] - · rw [ENNReal.ofReal_eq_ofReal_iff] - · simp only [mul_sub] -- · rw [tsum_sub] -+ · rw [Summable.tsum_sub] - · simp only [sum_div, div_div, ← one_div_mul_one_div_rev] - apply sub_eq_of_eq_add -- rw [← sum_add_tsum_nat_add' (f := fun n => 1 / (r - s) * (1 / (n + (s : ℝ) + 1) ^ 2)) (k := r - s)] -+ rw [← Summable.sum_add_tsum_nat_add' -+ (f := fun n => 1 / (r - s) * (1 / (n + (s : ℝ) + 1) ^ 2)) (k := r - s)] - · congr 1 - · simp only [← Nat.cast_add, add_comm] - rw [← Finset.sum_Ico_eq_sum_range (n := r) (m := s) -- (f := fun k => 1 / (r - s) * (1 / ((k : ℝ) + 1) ^ 2)), ← Nat.Ico_succ_succ, -- Nat.succ_eq_add_one, ← Finset.sum_Ico_add' (c := 1) (b := r) (a := s)] -+ (f := fun k => 1 / (r - s) * (1 / ((k : ℝ) + 1) ^ 2)), -+ ← Finset.Ico_add_one_add_one_eq_Ioc, -+ ← Finset.sum_Ico_add' (c := 1) (b := r) (a := s)] - norm_cast - · congr - ext n -@@ -954,7 +950,7 @@ lemma integrableOn_J_rs' (r s : ℕ) (h : r > s) : MeasureTheory.IntegrableOn - (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s) - (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) MeasureTheory.volume := by - have h₀ := J_ENN_rs r s h -- simp only [J_ENN] at h₀ -+ simp only [jENN] at h₀ - rw [MeasureTheory.IntegrableOn, MeasureTheory.Integrable] - constructor - · apply AEMeasurable.aestronglyMeasurable -@@ -995,7 +991,7 @@ lemma integrableOn_J_rs' (r s : ℕ) (h : r > s) : MeasureTheory.IntegrableOn - lemma J_rs' (r s : ℕ) (h : r > s) : - J r s = (∑ k ∈ Finset.Ioc s r, 1 / (k : ℝ) ^ 2) / (r - s) := by - have h₀ := J_ENN_rs r s h -- simp only [J_ENN] at h₀ -+ simp only [jENN] at h₀ - rw [J, MeasureTheory.integral_eq_lintegral_of_nonneg_ae, h₀, ENNReal.toReal_ofReal_eq_iff] - · rw [sum_div] - apply sum_nonneg -@@ -1024,7 +1020,7 @@ lemma J_rs' (r s : ℕ) (h : r > s) : - · apply Measurable.pow measurable_fst measurable_const - · apply Measurable.pow measurable_snd measurable_const - --lemma J_ENN_rs_symm (r s : ℕ) : J_ENN r s = J_ENN s r := by -+lemma J_ENN_rs_symm (r s : ℕ) : jENN r s = jENN s r := by - simp only [J_ENN_rs_eq_tsum, add_comm, mul_comm] - - lemma integrableOn_J_rs (r s : ℕ) : MeasureTheory.IntegrableOn -@@ -1073,12 +1069,12 @@ lemma integrableOn_J_rs (r s : ℕ) : MeasureTheory.IntegrableOn - · simp only [hx, ↓reduceIte] - have h₀ := J_ENN_rs s r h2 - rw [J_ENN_rs_symm s r] at h₀ -- simp only [J_ENN] at h₀ -+ simp only [jENN] at h₀ - rw [h1, h₀] - simp only [one_div, ENNReal.ofReal_lt_top] - --lemma J_eq_toReal_J_ENN (r s : ℕ) : J r s = (J_ENN r s).toReal := by -- rw [J, J_ENN, MeasureTheory.integral_eq_lintegral_of_nonneg_ae] -+lemma J_eq_toReal_J_ENN (r s : ℕ) : J r s = (jENN r s).toReal := by -+ rw [J, jENN, MeasureTheory.integral_eq_lintegral_of_nonneg_ae] - · apply MeasureTheory.ae_nonneg_restrict_of_forall_setIntegral_nonneg_inter - · exact integrableOn_J_rs r s - · rintro x hx - -@@ -1105,16 +1101,16 @@ theorem J_rs {r s : ℕ} (h : r ≠ s) : J r s = - (∑ m ∈ Icc 1 r, 1 / (m : ℝ) ^ 2 - ∑ m ∈ Icc 1 s, 1 / (m : ℝ) ^ 2) / (r - s) := by - by_cases h1 : r > s - · simp only [J_rs' r s h1, sub_div, sum_div] -- rw [← Nat.Ico_succ_succ, Finset.sum_Ico_eq_sub] -+ rw [← Finset.Ico_add_one_add_one_eq_Ioc, Finset.sum_Ico_eq_sub] - · congr 1 - · rw [← Finset.sum_range_add_sum_Ico (n := r + 1) (m := 1) _ (by omega)] - simp only [range_one, one_div, sum_singleton, CharP.cast_eq_zero, ne_eq, - OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_div, zero_add] -- rw [ Nat.Ico_succ_right] -+ rw [ Finset.Ico_add_one_right_eq_Icc] - · rw [← Finset.sum_range_add_sum_Ico (n := s + 1) (m := 1) _ (by omega)] - simp only [range_one, one_div, sum_singleton, CharP.cast_eq_zero, ne_eq, - OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_div, zero_add] -- rw [ Nat.Ico_succ_right] -+ rw [ Finset.Ico_add_one_right_eq_Icc] - · linarith - · simp only [gt_iff_lt, not_lt] at h1 - have h2 : s > r := by -@@ -1123,14 +1119,14 @@ theorem J_rs {r s : ℕ} (h : r ≠ s) : J r s = - nth_rw 2 [← neg_div_neg_eq] - simp only [neg_sub] - congr 1 -- rw [← Nat.Ico_succ_succ, Finset.sum_Ico_eq_sub] -+ rw [← Finset.Ico_add_one_add_one_eq_Ioc, Finset.sum_Ico_eq_sub] - · congr 1 - · rw [← Finset.sum_range_add_sum_Ico (n := s + 1) (m := 1) _ (by omega)] - simp only [range_one, one_div, sum_singleton, CharP.cast_eq_zero, ne_eq, -- OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_div, zero_add] -- rw [ Nat.Ico_succ_right] -+ OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_add] -+ rw [ Finset.Ico_add_one_right_eq_Icc] - · rw [← Finset.sum_range_add_sum_Ico (n := r + 1) (m := 1) _ (by omega)] - simp only [range_one, one_div, sum_singleton, CharP.cast_eq_zero, ne_eq, -- OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_div, zero_add] -- rw [ Nat.Ico_succ_right] -+ OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_add] -+ rw [ Finset.Ico_add_one_right_eq_Icc] - · linarith -diff --git a/Zeta3Irrational/LegendrePoly.lean b/Zeta3Irrational/LegendrePoly.lean -index d682b28..9541b4c 100644 ---- a/Zeta3Irrational/LegendrePoly.lean -+++ b/Zeta3Irrational/LegendrePoly.lean -@@ -1,16 +1,18 @@ --import Mathlib.Algebra.Lie.OfAssociative - import Mathlib.Algebra.Polynomial.Derivative - import Mathlib.Algebra.Polynomial.Eval.SMul -+import Mathlib.RingTheory.Polynomial.ShiftedLegendre - import Mathlib.Analysis.Calculus.Deriv.Inv - import Mathlib.Analysis.Calculus.Deriv.Pow --import Mathlib.Data.Real.StarOrdered --import Mathlib.MeasureTheory.Integral.IntegrationByParts -+import Mathlib.Analysis.Calculus.Deriv.Polynomial -+import Mathlib.Analysis.Real.Sqrt -+import Mathlib.Topology.Algebra.Polynomial -+import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts - - /-! - # Legendre Polynomials - --In this file, we define the shiftedLegendre polynomials `shiftedLegendre n` for `n : ℕ` as a --polynomial in `ℤ[X]`. We prove some basic properties of the shiftedLegendre polynomials. -+We use the real shifted Legendre polynomials `aperyShiftedLegendre n` for `n : ℕ` as -+a polynomial in `ℝ[X]`. We prove some basic properties of the aperyShiftedLegendre polynomials. - - -/ - -@@ -21,71 +23,42 @@ variable {R : Type*} - - namespace Polynomial - --/-- `shiftedLegendre n` is the polynomial defined in terms of derivatives of order n. -/ --noncomputable def shiftedLegendre (n : ℕ) : ℝ[X] := -- C (n ! : ℝ)⁻¹ * derivative^[n] (X ^ n * (1 - X) ^ n) -+/-- The real shifted Legendre polynomial, obtained from Mathlib's integer polynomial. -/ -+noncomputable def aperyShiftedLegendre (n : ℕ) : ℝ[X] := -+ (shiftedLegendre n).map (Int.castRingHom ℝ) -+ -+/-- The canonical polynomial has exactly the Rodrigues normalization used in the source. -/ -+lemma aperyShiftedLegendre_eq_rodrigues (n : ℕ) : -+ aperyShiftedLegendre n = C (n ! : ℝ)⁻¹ * derivative^[n] (X ^ n * (1 - X) ^ n) := by -+ have h := congrArg (Polynomial.map (Int.castRingHom ℝ)) -+ (factorial_mul_shiftedLegendre_eq n) -+ have h' : C (n ! : ℝ) * aperyShiftedLegendre n = -+ derivative^[n] (X ^ n * (1 - X) ^ n) := by -+ simpa only [aperyShiftedLegendre, Polynomial.map_mul, Polynomial.map_natCast, -+ ← iterate_derivative_map, Polynomial.map_pow, Polynomial.map_sub, -+ Polynomial.map_one, Polynomial.map_X, C_eq_natCast] using h -+ rw [← h', ← mul_assoc, ← C_mul, inv_mul_cancel₀ (by positivity), C_1, one_mul] - - lemma Finsum_iterate_deriv [CommRing R] (k : ℕ) (h : ℕ → ℕ) : - derivative^[k] (∑ m ∈ Finset.range (k + 1), (h m) • ((-1) ^ m : R[X]) * X ^ (k + m)) = - ∑ m ∈ Finset.range (k + 1), (h m) • (-1) ^ m * derivative^[k] (X ^ (k + m)) := by -- induction' k + 1 with n hn -- · simp only [Nat.zero_eq, Finset.range_zero, Finset.sum_empty, iterate_map_zero] -- · rw[Finset.sum_range, Finset.sum_range, Fin.sum_univ_castSucc, Fin.sum_univ_castSucc] at * -- simp only [Fin.coe_castSucc, Fin.val_last, iterate_map_add, hn, add_right_inj] -- rw [nsmul_eq_mul, mul_assoc, ← nsmul_eq_mul, Polynomial.iterate_derivative_smul, nsmul_eq_mul, -- mul_assoc] -- rcases n.even_or_odd with (hn1 | hn2) -- · simp_all only [nsmul_eq_mul, Int.even_coe_nat, Even.neg_pow, one_pow, one_mul] -- · rw [Odd.neg_one_pow] -- simp only [neg_mul, one_mul, iterate_map_neg, mul_neg] -- exact_mod_cast hn2 -+ simp only [iterate_derivative_sum] -+ congr! 1 with m _ -+ rw [show (h m) • ((-1) ^ m : R[X]) = C ((h m : R) * (-1) ^ m) by simp, -+ iterate_derivative_C_mul] - --/-- The expand of `shiftedLegendre n`. -/ --theorem shiftedLegendre_eq_sum (n : ℕ) : shiftedLegendre n = ∑ k ∈ Finset.range (n + 1), -- C ((-1) ^ k : ℝ) * (Nat.choose n k : ℝ[X]) * (Nat.choose (n + k) n : ℝ[X]) * X ^ k := by -- have h : ((X : ℝ[X]) - X ^ 2) ^ n = -- ∑ m ∈ range (n + 1), n.choose m • (- 1) ^ m * X ^ (n + m) := by -- rw[sub_eq_add_neg, add_comm, add_pow] -- congr! 1 with m hm -- rw[neg_pow, pow_two, mul_pow,← mul_assoc, mul_comm, mul_assoc, pow_mul_pow_sub, mul_assoc, -- ← pow_add, ← mul_assoc, nsmul_eq_mul, add_comm] -- rw[Finset.mem_range] at hm -- linarith -- rw [shiftedLegendre, ← mul_pow, mul_one_sub, ← pow_two, h, Finsum_iterate_deriv, -- Finset.mul_sum] -- congr! 1 with x _ -- rw [← mul_assoc, Polynomial.iterate_derivative_X_pow_eq_smul, Nat.descFactorial_eq_div -- (by omega), show n + x - n = x by omega, nsmul_eq_mul, ← mul_assoc, mul_assoc, -- mul_comm] -- simp only [Int.reduceNeg, map_pow, map_neg, map_one] -- rw [Algebra.smul_def, algebraMap_eq, map_natCast, ← mul_assoc, ← mul_assoc, add_comm, -- Nat.add_choose, mul_assoc, mul_assoc, mul_assoc, mul_assoc, mul_assoc, mul_comm] -- nth_rewrite 5 [mul_comm] -- congr 1 -- nth_rewrite 2 [mul_comm] -- rw [← mul_assoc, ← mul_assoc, ← mul_assoc] -- congr 1 -- nth_rewrite 3 [mul_comm] -- congr 1 -- apply Polynomial.ext -- intro m -- simp only [one_div, coeff_mul_C, coeff_natCast_ite, Nat.cast_ite, CharP.cast_eq_zero, ite_mul, -- zero_mul] -- by_cases h : m = 0 -- · simp [h] -- rw [Nat.cast_div] -- · rw [← one_div, ← div_mul_eq_div_mul_one_div] -- norm_cast -- rw [Nat.cast_div] -- · exact Nat.factorial_mul_factorial_dvd_factorial_add x n -- · norm_cast -- apply mul_ne_zero (Nat.factorial_ne_zero x) (Nat.factorial_ne_zero n) -- · exact Nat.factorial_dvd_factorial (by omega) -- · norm_cast; exact Nat.factorial_ne_zero x -- · simp only [h, ↓reduceIte] -+/-- The expand of `aperyShiftedLegendre n`. -/ -+theorem shiftedLegendre_eq_sum (n : ℕ) : aperyShiftedLegendre n = -+ ∑ k ∈ Finset.range (n + 1), -+ C ((-1) ^ k : ℝ) * (Nat.choose n k : ℝ[X]) * -+ (Nat.choose (n + k) n : ℝ[X]) * X ^ k := by -+ simp only [aperyShiftedLegendre, shiftedLegendre, Polynomial.map_sum, -+ Polynomial.map_mul, Polynomial.map_pow, Polynomial.map_X, -+ map_mul, map_pow, map_neg, map_one, map_natCast, -+ Polynomial.map_neg, Polynomial.map_one, Polynomial.map_natCast] - --/-- `shiftedLegendre n` is an integer polynomial. -/ --lemma shiftedLegendre_eq_int_poly (n : ℕ) : ∃ a : ℕ → ℤ, shiftedLegendre n = -+/-- `aperyShiftedLegendre n` is an integer polynomial. -/ -+lemma shiftedLegendre_eq_int_poly (n : ℕ) : ∃ a : ℕ → ℤ, aperyShiftedLegendre n = - ∑ k ∈ Finset.range (n + 1), (a k : ℝ[X]) * X ^ k := by - simp_rw [shiftedLegendre_eq_sum] - use fun k => (- 1) ^ k * (Nat.choose n k) * (Nat.choose (n + k) n) -@@ -99,40 +72,14 @@ lemma deriv_one_sub_X {n i : ℕ} : (⇑derivative)^[i] ((1 - X) ^ n : ℝ[X]) = - Polynomial.iterate_derivative_X_pow_eq_smul, Algebra.smul_def, algebraMap_eq, map_natCast] - simp - --/-- The values ​​of the shiftedLegendre polynomial at x and 1-x differ by a factor (-1)ⁿ. -/ ---- lemma shiftedLegendre_eval_symm (n : ℕ) (x : ℝ) : ---- eval x (shiftedLegendre n) = (-1) ^ n * eval (1 - x) (shiftedLegendre n) := by ---- rw [mul_comm] ---- simp only [shiftedLegendre, eval_mul, one_div, eval_C] ---- rw [mul_assoc] ---- simp only [mul_eq_mul_left_iff, inv_eq_zero, Nat.cast_eq_zero]; left ---- rw [Polynomial.iterate_derivative_mul] ---- simp only [Nat.succ_eq_add_one, nsmul_eq_mul] ---- rw [Polynomial.eval_finset_sum, Polynomial.eval_finset_sum, ← Finset.sum_flip, Finset.sum_mul] ---- congr! 1 with i hi ---- simp only [Polynomial.iterate_derivative_X_pow_eq_smul, eval_mul, eval_natCast, ---- Algebra.smul_mul_assoc, eval_smul, eval_mul, eval_pow, eval_X, smul_eq_mul] ---- simp only [Finset.mem_range, Nat.lt_add_one_iff] at hi ---- rw [Nat.choose_symm hi, deriv_one_sub_X, deriv_one_sub_X] ---- simp only [nsmul_eq_mul, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_sub, eval_X, ---- sub_sub_cancel] ---- rw [mul_assoc] ---- simp only [mul_eq_mul_left_iff, Nat.cast_eq_zero]; left ---- rw [show n - (n - i) = i by omega, ← mul_assoc, ← mul_assoc, mul_comm, ← mul_assoc] ---- symm ---- rw [← mul_assoc] ---- nth_rewrite 4 [mul_comm] ---- rw [← mul_assoc, ← mul_assoc, mul_assoc] ---- congr 1 ---- rw [← pow_add, show i + n = n - i + 2 * i by omega, pow_add] ---- simp only [even_two, Even.mul_right, Even.neg_pow, one_pow, mul_one] -- - theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} - (ha : a > 0) (hx : 1 - a * x = 0) : - ¬DifferentiableAt ℝ (fun x ↦ ↑n ! * a ^ n / (1 - a * x) ^ (n + 1)) x := by - intro h - obtain q := h.continuousAt -- simp [Metric.continuousAt_iff, Real.dist_eq, hx] at q -+ simp only [Metric.continuousAt_iff, gt_iff_lt, Real.dist_eq, hx, ne_eq, -+ Nat.add_eq_zero_iff, one_ne_zero, and_false, not_false_eq_true, zero_pow, div_zero, -+ dist_zero_right, norm_div, norm_mul, RCLike.norm_natCast, norm_pow, Real.norm_eq_abs] at q - have h₁ : ↑n ! * |a| ^ n > 0 := by - apply mul_pos - · simp only [Nat.cast_pos] -@@ -150,19 +97,20 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} - suffices 0 < q * a * q by linarith - exact mul_pos (mul_pos qq ha) qq - _ < 1 / 2 * q := by -- rw [mul_lt_mul_right (a := q) qq] -+ rw [mul_lt_mul_iff_left₀ qq] - linarith - _ < q := by linarith - specialize qqq this - rw [div_lt_iff₀] at qqq - · have : 1 < |1 - a * (a * q / 2 * q + x)| ^ (n + 1) := by -- rwa [← mul_lt_mul_left (a := ↑n ! * |a| ^ n) h₁, mul_one] -+ rwa [← mul_lt_mul_iff_right₀ h₁, mul_one] - rw [mul_add, add_comm, ← sub_sub, hx, zero_sub, abs_neg] at this - have : |a * (a * q / 2 * q)| ^ (n + 1) < 1 := by -- apply pow_lt_one₀ (by simp) _ (by omega) -+ apply pow_lt_one₀ (abs_nonneg _) _ (by omega) - · nth_rewrite 2 [mul_comm] - rw [← mul_assoc, ← mul_div_assoc, ← pow_two] -- rw [show |((a * q) ^ 2 / 2 : ℝ)| = ((a * q) ^ 2 / 2 : ℝ) by exact abs_eq_self.2 (by positivity)] -+ rw [show |((a * q) ^ 2 / 2 : ℝ)| = ((a * q) ^ 2 / 2 : ℝ) by -+ exact abs_eq_self.2 (by positivity)] - trans 1 / 2 - · rw [div_lt_div_iff_of_pos_right (by norm_num), ← one_pow (n := 2)] - apply pow_lt_pow_left₀ <;> nlinarith -@@ -175,13 +123,13 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} - rw [← mul_assoc, ← mul_div_assoc, ← pow_two] - positivity - · have : |q / 2 + x - x| < q := by -- simp only [one_div, add_sub_cancel_right] -+ simp only [add_sub_cancel_right] - rw [show |(q / 2 : ℝ)| = (q / 2 : ℝ) by exact abs_eq_self.2 (by linarith)] - linarith - specialize qqq this - rw [div_lt_iff₀] at qqq - · have : 1 < |1 - a * (q / 2 + x)| ^ (n + 1) := by -- rwa [← mul_lt_mul_left (a := ↑n ! * |a| ^ n) h₁, mul_one] -+ rwa [← mul_lt_mul_iff_right₀ h₁, mul_one] - rw [mul_add, add_comm, ← sub_sub, hx, zero_sub, abs_neg, ← mul_div_assoc, h2] at this - have : 1 < (1 / 2 : ℝ) := by - suffices (1 : ℝ) ≥ |(1 / 2 : ℝ)| ^ (n + 1) by linarith -@@ -192,8 +140,7 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} - rw [abs_pos] - linarith - · have : |1 / a + x - x| < q := by -- simp only [one_div, add_sub_cancel_right] -- rw [← one_div] -+ simp only [add_sub_cancel_right] - have : |(1 / a : ℝ)| = (1 / a : ℝ) := by - rw [abs_eq_self, one_div_nonneg] - linarith -@@ -201,7 +148,7 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} - specialize qqq this - rw [div_lt_iff₀] at qqq - · have : 1 < |1 - a * (1 / a + x)| ^ (n + 1) := by -- rwa [← mul_lt_mul_left (a := ↑n ! * |a| ^ n) h₁, mul_one] -+ rwa [← mul_lt_mul_iff_right₀ h₁, mul_one] - rw [mul_add, add_comm, ← sub_sub, hx, zero_sub, abs_neg, ← mul_div_assoc, mul_one, - div_self (by linarith)] at this - simp only [abs_one, one_pow, lt_self_iff_false] at this -@@ -211,20 +158,20 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} - - lemma n_derivative {a : ℝ} (n : ℕ) (ha : a > 0) : deriv^[n] (fun x ↦ 1 / (1 - a * x)) = - fun x ↦ (n) ! * (a ^ n) / (1 - a * x) ^ (n + 1) := by -- induction' n with n hn -- · simp -- · ext x -+ induction n with -+ | zero => simp -+ | succ n hn => -+ ext x - rcases eq_or_ne (1 - a * x) 0 with (h | hne) - · simp only [h, ne_eq, add_eq_zero, one_ne_zero, and_false, not_false_eq_true, - zero_pow, div_zero] - rw [Function.iterate_succ_apply', hn] - apply deriv_zero_of_not_differentiableAt - exact differentiableAt_inv_special ha h -- · rw [Function.iterate_succ_apply', hn, deriv_div] -- · simp only [differentiableAt_const, deriv_mul, deriv_const', zero_mul, deriv_pow'', -- mul_zero, add_zero, zero_sub] -+ · rw [Function.iterate_succ_apply', hn, deriv_fun_div] -+ · simp only [deriv_const', zero_mul, zero_sub] - rw [div_eq_div_iff] -- · rw [deriv_pow'', deriv_const_sub, deriv_const_mul] -+ · rw [deriv_fun_pow, deriv_const_sub, deriv_const_mul] - · simp only [Nat.cast_add, Nat.cast_one, add_tsub_cancel_right, deriv_id'', mul_one, - mul_neg, neg_neg] - norm_cast -@@ -253,7 +200,9 @@ theorem differentiableAt_inv_special' (c x y z : ℝ) (n : ℕ) (hc : c ≠ 0) ( - ¬DifferentiableAt ℝ (fun y ↦ c / (1 - (1 - x * y) * z) ^ (n + 1)) y := by - intro h - obtain q := h.continuousAt -- simp [Metric.continuousAt_iff, Real.dist_eq, h1] at q -+ simp only [Metric.continuousAt_iff, gt_iff_lt, Real.dist_eq, h1, ne_eq, -+ Nat.add_eq_zero_iff, one_ne_zero, and_false, not_false_eq_true, zero_pow, div_zero, -+ dist_zero_right, norm_div, Real.norm_eq_abs, norm_pow] at q - simp only [Set.mem_Ioo] at hx hz - have h₁ : |c| > 0 := by simp [hc] - specialize q (|c|) h₁ -@@ -270,9 +219,9 @@ theorem differentiableAt_inv_special' (c x y z : ℝ) (n : ℕ) (hc : c ≠ 0) ( - exact min_le_left (q / 2) (1 / |x * z|) - have hd' : 1 - (1 - x * d) * z ≠ 0 := by - suffices 1 - (1 - x * d) * z > 0 by linarith -- rw [h', show 1 - (1 - x * (d' + y)) * z = 1 - (1 - x * y) * z + x * z * d' by ring, h1, zero_add] -- apply mul_pos -- apply mul_pos (by linarith) (by linarith) -+ rw [h', show 1 - (1 - x * (d' + y)) * z = -+ 1 - (1 - x * y) * z + x * z * d' by ring, h1, zero_add] -+ refine mul_pos (mul_pos (by linarith) (by linarith)) ?_ - simp only [d'] - apply lt_min (by positivity) - simp only [one_div, inv_pos, abs_pos, ne_eq, mul_eq_zero, not_or] -@@ -290,9 +239,8 @@ theorem differentiableAt_inv_special' (c x y z : ℝ) (n : ℕ) (hc : c ≠ 0) ( - rw [← abs_one_div] - apply abs_le_abs_of_nonneg (by positivity) - simp only [d'] -- rw [abs_of_nonneg (a := x * z)] -+ rw [abs_of_nonneg (mul_nonneg (by linarith) (by linarith) : 0 ≤ x * z)] - exact min_le_right (q / 2) (1 / (x * z)) -- exact mul_nonneg (by linarith) (by linarith) - _ = 1 := by - rw [mul_div, mul_one, div_self] - simp only [ne_eq, abs_eq_zero, mul_eq_zero, not_or] -@@ -305,13 +253,14 @@ theorem differentiableAt_inv_special' (c x y z : ℝ) (n : ℕ) (hc : c ≠ 0) ( - lemma n_derivative' {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : - (deriv^[n] fun y ↦ 1 / (1 - (1 - x * y) * z)) = - (fun y ↦ (-1) ^ n * (n) ! * (x * z) ^ n / (1 - (1 - x * y) * z) ^ (n + 1)) := by -- induction' n with n hn -- · simp -- · ext y -+ induction n with -+ | zero => simp -+ | succ n hn => -+ ext y - rcases eq_or_ne (1 - (1 - x * y) * z) 0 with (h | hne) - · simp only [h, ne_eq, add_eq_zero, one_ne_zero, and_false, not_false_eq_true, - zero_pow, div_zero] -- simp only [Set.mem_Ioo, Set.mem_Icc] at hx hz -+ simp only [Set.mem_Ioo] at hx hz - rw [Function.iterate_succ_apply', hn] - apply deriv_zero_of_not_differentiableAt - set c := (-1) ^ n * ↑n ! * (x * z) ^ n -@@ -323,17 +272,18 @@ lemma n_derivative' {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ S - · apply pow_ne_zero - nlinarith - exact differentiableAt_inv_special' c x y z n hc hx hz h -- · rw [Function.iterate_succ_apply', hn, deriv_div] -- · simp only [differentiableAt_const, deriv_mul, deriv_const', zero_mul, deriv_pow'', -- mul_zero, add_zero, zero_sub] -- have h : (fun y ↦ (1 - (1 - x * y) * z) ^ (n + 1)) = fun y ↦ (1 - z + x * z * y) ^ (n + 1) := by -+ · rw [Function.iterate_succ_apply', hn, deriv_fun_div] -+ · simp only [deriv_const', zero_mul, zero_sub] -+ have h : (fun y ↦ (1 - (1 - x * y) * z) ^ (n + 1)) = -+ fun y ↦ (1 - z + x * z * y) ^ (n + 1) := by - ext _; ring - rw [div_eq_div_iff] -- · rw [h, deriv_pow'', deriv_const_add, deriv_const_mul] -+ · rw [h, deriv_fun_pow, deriv_const_add, deriv_const_mul] - · simp only [Nat.cast_add, Nat.cast_one, add_tsub_cancel_right, deriv_id'', mul_one, - ← neg_mul] - rw [show -(-1) ^ n = (-1 : ℝ) ^ (n + 1) by ring, -- show ((n + 1)! : ℝ) = (((n : ℕ) + 1) : ℝ) * (n !) by rw [Nat.factorial_succ]; norm_cast] -+ show ((n + 1)! : ℝ) = (((n : ℕ) + 1) : ℝ) * (n !) by -+ rw [Nat.factorial_succ]; norm_cast] - ring - · apply differentiableAt_id - · apply DifferentiableAt.add -@@ -352,16 +302,17 @@ lemma n_derivative' {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ S - apply DifferentiableAt.const_mul differentiableAt_id - · exact pow_ne_zero (n + 1) hne - --lemma shiftedLegendre_poly_eval_zero_eq_zero {m : ℕ} (h : m < n) : -+lemma shiftedLegendre_poly_eval_zero_eq_zero {n m : ℕ} (h : m < n) : - eval 0 ((⇑derivative)^[m] (X ^ n * (1 - X) ^ n) : ℝ[X]) = 0 := by -- rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] -+ rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finsetSum] - apply Finset.sum_eq_zero - intro x hx - simp_all only [Nat.succ_eq_add_one, Finset.mem_range, nsmul_eq_mul, eval_mul, eval_natCast, - mul_eq_zero, Nat.cast_eq_zero] - right; left - simp only [Polynomial.iterate_derivative_X_pow_eq_smul, eval_smul, eval_pow, eval_X, smul_eq_mul, -- mul_eq_zero, Nat.cast_eq_zero, Nat.descFactorial_eq_zero_iff_lt, pow_eq_zero_iff', ne_eq, true_and] -+ mul_eq_zero, Nat.cast_eq_zero, Nat.descFactorial_eq_zero_iff_lt, pow_eq_zero_iff', -+ ne_eq, true_and] - right - suffices n - (m - x) > 0 by linarith - simp only [gt_iff_lt, tsub_pos_iff_lt] -@@ -370,9 +321,9 @@ lemma shiftedLegendre_poly_eval_zero_eq_zero {m : ℕ} (h : m < n) : - m - x ≤ m := by simp - _ < n := by exact h - --lemma shiftedLegendre_poly_eval_one_eq_zero {m : ℕ} (h : m < n) : -+lemma shiftedLegendre_poly_eval_one_eq_zero {n m : ℕ} (h : m < n) : - eval 1 ((⇑derivative)^[m] (X ^ n * (1 - X) ^ n) : ℝ[X]) = 0 := by -- rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] -+ rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finsetSum] - apply Finset.sum_eq_zero - intro x hx - simp_all only [Nat.succ_eq_add_one, Finset.mem_range, nsmul_eq_mul, eval_mul, eval_natCast, -@@ -391,29 +342,11 @@ lemma shiftedLegendre_poly_eval_one_eq_zero {m : ℕ} (h : m < n) : - linarith - - lemma shiftedLegendre_continuousOn {n m : ℕ} : ContinuousOn -- (fun x ↦ eval x ((⇑derivative)^[n - m] (X ^ n * (1 - X) ^ n : ℝ[X]))) (Set.uIcc 0 1) := by -- simp_rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] -- apply continuousOn_finset_sum -- intro i _ -- simp_rw [Algebra.smul_def, eval_mul] -- apply ContinuousOn.mul -- · simp only [eq_natCast, eval_natCast, ge_iff_le, zero_le_one, Set.uIcc_of_le] -- apply continuousOn_const -- · apply ContinuousOn.mul -- · simp_rw [Polynomial.iterate_derivative_X_pow_eq_smul] -- simp only [eval_smul, eval_pow, eval_X, smul_eq_mul, ge_iff_le, zero_le_one, -- Set.uIcc_of_le] -- apply ContinuousOn.mul continuousOn_const (ContinuousOn.pow continuousOn_id _) -- · rw [show (1 - X : ℝ[X]) ^ n = (X ^ n : ℝ[X]).comp (1 - X) by simp, -- Polynomial.iterate_derivative_comp_one_sub_X (p := X ^ n), -- Polynomial.iterate_derivative_X_pow_eq_smul] -- simp only [smul_comp, pow_comp, X_comp, Algebra.mul_smul_comm, eval_smul, eval_mul, -- eval_pow, eval_neg, eval_one, eval_sub, eval_X, smul_eq_mul, ge_iff_le, zero_le_one, -- Set.uIcc_of_le] -- refine ContinuousOn.mul continuousOn_const (ContinuousOn.mul continuousOn_const ?_) -- apply ContinuousOn.pow (ContinuousOn.sub continuousOn_const continuousOn_id) -+ (fun x ↦ eval x ((⇑derivative)^[n - m] (X ^ n * (1 - X) ^ n : ℝ[X]))) (Set.uIcc 0 1) := -+ (Polynomial.continuous _).continuousOn - --lemma special_deriv_div_continuousOn {m : ℕ} {x z: ℝ} (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : -+lemma special_deriv_div_continuousOn {m : ℕ} {x z : ℝ} -+ (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : - ContinuousOn (fun u ↦ (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)) u) (Set.uIcc 0 1) := by - simp_rw [n_derivative' m hx hz] - apply ContinuousOn.div continuousOn_const -@@ -437,58 +370,26 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m - eval y ((⇑derivative)^[n] (X ^ n * (1 - X) ^ n)) * (fun y ↦ 1 / (1 - (1 - x * y) * z)) y = - (- 1) ^ m * ∫ (y : ℝ) in (0)..1, eval y ((⇑derivative)^[n - m] (X ^ n * (1 - X) ^ n)) * - (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)) y:= by -- induction' m with m hm -- · simp -- · have h₀ : m < n := by linarith -+ induction m with -+ | zero => simp -+ | succ m hm => -+ have h₀ : m < n := by linarith - have h₁ : n - (m + 1) < n := by omega - rw [hm (LT.lt.le h₀), pow_add, pow_one, mul_assoc] - congr - symm - rw [show n - m = n - (m + 1) + 1 by omega, Function.iterate_succ_apply'] -- rw [neg_one_mul, neg_eq_iff_eq_neg, intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt -+ rw [neg_one_mul, neg_eq_iff_eq_neg, -+ intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt - (u := fun u ↦ eval u ((⇑derivative)^[n - (m + 1)] (X ^ n * (1 - X) ^ n : ℝ[X]))) - (u' := fun u ↦ eval u (derivative ((⇑derivative)^[n - (m + 1)] (X ^ n * (1 - X) ^ n : ℝ[X])))) - (v := fun u ↦ (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)) u)] - · rw [shiftedLegendre_poly_eval_one_eq_zero h₁, shiftedLegendre_poly_eval_zero_eq_zero h₁] -- simp only [one_mul, one_div, zero_mul, sub_zero, sub_self, zero_sub, -- Function.iterate_succ_apply', neg_inj] -+ simp only [one_div, zero_mul, sub_self, zero_sub, Function.iterate_succ_apply'] - · apply shiftedLegendre_continuousOn - · apply special_deriv_div_continuousOn hx hz -- · intro x _ -- simp_rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] -- simp only [Nat.succ_eq_add_one, nsmul_eq_mul, eval_mul, eval_natCast, map_sum, eval_finset_sum] -- apply HasDerivAt.sum -- intro i _ -- simp only [derivative_mul, derivative_natCast, zero_mul, zero_add, eval_mul, eval_natCast, -- eval_add] -- apply HasDerivAt.const_mul -- apply HasDerivAt.mul -- · rw [Polynomial.iterate_derivative_X_pow_eq_smul] -- simp only [eval_smul, eval_pow, eval_X, smul_eq_mul, LinearMapClass.map_smul, -- derivative_X_pow, map_natCast, eval_mul, eval_natCast] -- apply HasDerivAt.const_mul -- apply hasDerivAt_pow -- · rw [show (1 - X : ℝ[X]) ^ n = (X ^ n : ℝ[X]).comp (1 - X) by simp, -- Polynomial.iterate_derivative_comp_one_sub_X (p := X ^ n), -- Polynomial.iterate_derivative_X_pow_eq_smul] -- simp only [smul_comp, pow_comp, X_comp, Algebra.mul_smul_comm, eval_smul, eval_mul, -- eval_pow, eval_neg, eval_one, eval_sub, eval_X, smul_eq_mul, LinearMapClass.map_smul] -- apply HasDerivAt.const_mul -- simp only [derivative_mul, eval_add, eval_mul, eval_pow, eval_sub, eval_one, eval_X, -- eval_neg] -- have h1 : (derivative ((-1) ^ i : ℝ[X])) = 0 := by -- rw [show ((-1) ^ i : ℝ[X]) = C ((-1) ^ i) by simp, derivative_C] -- rw [h1, eval_zero, zero_mul, zero_add] -- apply HasDerivAt.const_mul -- rw [show (1 - X : ℝ[X]) ^ (n - i) = (X ^ (n - i) : ℝ[X]).comp (1 - X) by simp, -- Polynomial.derivative_comp_one_sub_X (p := X ^ (n - i)), -- Polynomial.derivative_X_pow] -- simp only [mul_comp, pow_comp, X_comp, eval_mul, map_natCast, natCast_comp, eval_neg, -- eval_mul, eval_natCast, eval_pow, eval_sub, eval_one, eval_X] -- rw [← mul_neg_one] -- apply HasDerivAt.pow -- apply HasDerivAt.const_sub -- apply hasDerivAt_id -+ · intro u _ -+ exact Polynomial.hasDerivAt _ u - · intro y hy - simp only [Set.mem_Ioo, zero_le_one, min_eq_left, max_eq_right] at hx hy hz - have hh : 1 - (1 - x * y) * z ≠ 0 := by -@@ -502,7 +403,8 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m - Function.eval u (deriv (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z))) := by - simp only [one_div, Function.eval] - simp_rw [this] -- simp_rw [← Function.iterate_succ_apply', Nat.succ_eq_add_one, Function.eval, n_derivative' _ hx hz] -+ simp_rw [← Function.iterate_succ_apply', Nat.succ_eq_add_one, Function.eval, -+ n_derivative' _ hx hz] - have : (-1) ^ (m + 1) * ↑(m + 1)! * (x * z) ^ (m + 1) / (1 - (1 - x * y) * z) ^ (m + 1 + 1) - = (0 * (1 - (1 - x * y) * z) ^ (m + 1) - - (-1) ^ m * ↑m ! * (x * z) ^ m * ((m + 1) * (x * z) * (1 - (1 - x * y) * z) ^ m)) / -@@ -519,14 +421,16 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m - rw [this] - apply HasDerivAt.div - · apply hasDerivAt_const -- · have : (↑m + 1) * (x * z) * (1 - (1 - x * y) * z) ^ m = deriv (fun y ↦ (1 - (1 - x * y) * z) ^ (m + 1)) y := by -+ · have : (↑m + 1) * (x * z) * (1 - (1 - x * y) * z) ^ m = -+ deriv (fun y ↦ (1 - (1 - x * y) * z) ^ (m + 1)) y := by - simp only [show 1 - (1 - x * y) * z = 1 - z + x * z * y by ring] -- rw [deriv_pow'', show (fun y ↦ 1 - (1 - x * y) * z) = (fun y ↦ 1 - z + x * z * y) by ext _; ring] -- · rw[deriv_const_add, deriv_const_mul] -+ rw [deriv_fun_pow, show (fun y ↦ 1 - (1 - x * y) * z) = -+ (fun y ↦ 1 - z + x * z * y) by ext _; ring] -+ · rw [deriv_const_add, deriv_const_mul] - · simp only [Nat.cast_add, Nat.cast_one, add_tsub_cancel_right, deriv_id'', mul_one] - norm_cast - ring -- · exact differentiableAt_id' -+ · exact differentiableAt_id - · apply DifferentiableAt.const_sub - apply DifferentiableAt.mul_const - · apply DifferentiableAt.const_sub -@@ -538,24 +442,7 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m - · apply DifferentiableAt.const_sub - apply DifferentiableAt.const_mul differentiableAt_id - · apply pow_ne_zero _ hh -- · simp_rw [← Function.iterate_succ_apply', Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] -- simp only [Nat.succ_eq_add_one, nsmul_eq_mul, eval_mul, eval_natCast] -- apply ContinuousOn.intervalIntegrable_of_Icc (by norm_num) -- apply continuousOn_finset_sum -- intro i _ -- apply ContinuousOn.mul continuousOn_const -- · apply ContinuousOn.mul -- · simp_rw [Polynomial.iterate_derivative_X_pow_eq_smul] -- simp only [eval_smul, eval_pow, eval_X, smul_eq_mul] -- apply ContinuousOn.mul continuousOn_const (ContinuousOn.pow continuousOn_id _) -- · rw [show (1 - X : ℝ[X]) ^ n = (X ^ n : ℝ[X]).comp (1 - X) by simp, -- Polynomial.iterate_derivative_comp_one_sub_X (p := X ^ n), -- Polynomial.iterate_derivative_X_pow_eq_smul] -- simp only [smul_comp, pow_comp, X_comp, Algebra.mul_smul_comm, eval_smul, eval_mul, -- eval_pow, eval_neg, eval_one, eval_sub, eval_X, smul_eq_mul, ge_iff_le, zero_le_one, -- Set.uIcc_of_le] -- refine ContinuousOn.mul continuousOn_const (ContinuousOn.mul continuousOn_const ?_) -- apply ContinuousOn.pow (ContinuousOn.sub continuousOn_const continuousOn_id) -+ · exact (Polynomial.continuous _).intervalIntegrable _ _ - · have : deriv (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)) = - (Function.eval · (deriv (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)))) := by - ext x -@@ -566,24 +453,25 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m - rw [← Set.uIcc_of_le (by norm_num)] - apply special_deriv_div_continuousOn hx hz - --lemma integral_legendre_mul_smooth_eq {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : -- ∫ (y : ℝ) in (0)..1, eval y (shiftedLegendre n) * (fun y ↦ 1 / (1 - (1 - x * y) * z)) y = -+lemma integral_legendre_mul_smooth_eq {x z : ℝ} (n : ℕ) -+ (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : -+ ∫ (y : ℝ) in (0)..1, eval y (aperyShiftedLegendre n) * (fun y ↦ 1 / (1 - (1 - x * y) * z)) y = - (- 1) ^ n / n ! * ∫ (y : ℝ) in (0)..1, y ^ n * (1 - y) ^ n * - (deriv^[n] fun y ↦ 1 / (1 - (1 - x * y) * z)) y := by -- simp only [eval_mul, one_div, eval_C, shiftedLegendre] -+ simp only [eval_mul, one_div, eval_C, aperyShiftedLegendre_eq_rodrigues] - simp_rw [mul_assoc, intervalIntegral.integral_const_mul] - rw [← mul_one_div, one_div] - nth_rw 4 [mul_comm] - rw [mul_assoc] - congr - obtain h := integral_shiftedLegendre_mul_smooth_eq_aux (n := n) (m := n) (by norm_num) hx hz -- simp only [one_div, ge_iff_le, le_refl, tsub_eq_zero_of_le, Function.iterate_zero, id_eq, -+ simp only [one_div, le_refl, tsub_eq_zero_of_le, Function.iterate_zero, id_eq, - eval_mul, eval_pow, eval_X, eval_sub, eval_one] at h - rw [h] - simp_rw [← mul_assoc] - - lemma legendre_integral_special {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : -- ∫ (y : ℝ) in (0)..1, eval y (shiftedLegendre n) * (1 / (1 - (1 - x * y) * z)) = -+ ∫ (y : ℝ) in (0)..1, eval y (aperyShiftedLegendre n) * (1 / (1 - (1 - x * y) * z)) = - ∫ (y : ℝ) in (0)..1, (x * y * z) ^ n * (1 - y) ^ n / (1 - (1 - x * y) * z) ^ (n + 1) := by - rw [integral_legendre_mul_smooth_eq n hx hz, ← intervalIntegral.integral_const_mul, - intervalIntegral.integral_of_le (by norm_num), intervalIntegral.integral_of_le (by norm_num), -@@ -622,3 +510,5 @@ lemma legendre_integral_special {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) ( - apply mul_le_of_le_one_left (by linarith) - simp only [tsub_le_iff_right, le_add_iff_nonneg_right] - nlinarith -+ -+end Polynomial -diff --git a/Zeta3Irrational/LinearForm.lean b/Zeta3Irrational/LinearForm.lean -index e90d872..4c678c9 100644 ---- a/Zeta3Irrational/LinearForm.lean -+++ b/Zeta3Irrational/LinearForm.lean -@@ -1,6 +1,8 @@ - import Zeta3Irrational.Integral - import Zeta3Irrational.d - -+/-! # Integer linear forms for the Apéry integrals -/ -+ - open scoped Nat - open BigOperators - -@@ -17,7 +19,7 @@ lemma J_rr_linear (r : ℕ) : - simp only [sub_right_inj] - simp_rw [eq_div_iff d_cube_ne_zero, Finset.mul_sum, Finset.sum_mul] - use ∑ i ∈ Finset.Icc 1 r, 2 * ↑(d (Finset.Icc 1 r)) ^ 3 / ↑i ^ 3 -- simp only [Int.cast_sum, Int.cast_mul, Int.cast_ofNat, Int.cast_pow, Int.cast_natCast] -+ simp only [Int.cast_sum] - apply Finset.sum_congr rfl - intro x hx - rw [mul_assoc] -@@ -33,7 +35,8 @@ lemma J_rr_linear (r : ℕ) : - not_false_eq_true, pow_eq_zero_iff, Nat.cast_eq_zero] - linarith - --lemma Icc_diff_Icc {r s : ℕ} (_ : r > s) (_ : ¬s = 0) : Finset.Icc 1 r \ Finset.Icc 1 s = Finset.Icc (s + 1) r := by -+lemma Icc_diff_Icc {r s : ℕ} (_ : r > s) (_ : ¬s = 0) : -+ Finset.Icc 1 r \ Finset.Icc 1 s = Finset.Icc (s + 1) r := by - ext x - constructor - · intro hx -@@ -54,9 +57,9 @@ lemma one_div_sum_eq {r s : ℕ} (h : r > s) : - simp_all - else - simp_rw [← Nat.cast_add] -- rw [Icc_diff_Icc h h1, ← Nat.Ico_succ_right, ← Nat.Ico_succ_right, -- Finset.sum_Ico_add (f := fun (x : ℕ) => 1 / ((x ^ 2) : ℝ)) (c := s), Nat.succ_eq_add_one, -- Nat.succ_eq_add_one, add_comm, show r - s + 1 + s = r + 1 by omega] -+ rw [Icc_diff_Icc h h1, ← Finset.Ico_add_one_right_eq_Icc, ← Finset.Ico_add_one_right_eq_Icc, -+ Finset.sum_Ico_add (f := fun (x : ℕ) => 1 / ((x ^ 2) : ℝ)) (c := s), add_comm, -+ show r - s + 1 + s = r + 1 by omega] - · exact Finset.Icc_subset_Icc_right (LT.lt.le (gt_iff_lt.1 h)) - - lemma J_rs_linear {r s : ℕ} (h : r > s) : ∃ a : ℤ, J r s = a / (d (Finset.Icc 1 r)) ^ 3 := by -@@ -76,7 +79,7 @@ lemma J_rs_linear {r s : ℕ} (h : r > s) : ∃ a : ℤ, J r s = a / (d (Finset. - · norm_cast - rw [d_sq'] - apply dvd_d_of_mem -- simp_all only [gt_iff_lt, Finset.mem_Icc, Finset.mem_image, ge_iff_le, zero_le, ne_eq, -+ simp_all only [gt_iff_lt, Finset.mem_Icc, Finset.mem_image, zero_le, ne_eq, - OfNat.ofNat_ne_zero, not_false_eq_true, pow_left_inj₀, exists_eq_right] - omega - · simp_all only [gt_iff_lt, Finset.mem_Icc, Int.cast_pow, Int.cast_add, Int.cast_natCast, -@@ -94,38 +97,44 @@ lemma J_rs_linear {r s : ℕ} (h : r > s) : ∃ a : ℤ, J r s = a / (d (Finset. - rw [← Nat.cast_sub (by linarith)] - norm_cast; linarith - --lemma multi_integral_sum_comm (c : ℕ → ℤ) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+lemma multi_integral_sum_comm {n : ℕ} (c : ℕ → ℤ) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), - -(x.1 * x.2).log / (1 - x.1 * x.2) * ↑(c x_1) * x.1 ^ x_1 * ↑(c x_2) * x.2 ^ x_2 -- = ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+ = ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), -+ ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - -(x.1 * x.2).log / (1 - x.1 * x.2) * ↑(c x_1) * x.1 ^ x_1 * ↑(c x_2) * x.2 ^ x_2 := by - symm - calc -- _ = ∑ x_1 ∈ Finset.range (n + 1), ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ∑ x_2 ∈ Finset.range (n + 1), -+ _ = ∑ x_1 ∈ Finset.range (n + 1), ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+ ∑ x_2 ∈ Finset.range (n + 1), - -(x.1 * x.2).log / (1 - x.1 * x.2) * ↑(c x_1) * x.1 ^ x_1 * ↑(c x_2) * x.2 ^ x_2 := by - congr! 1 with a _ -- rw [← MeasureTheory.integral_finset_sum] -+ rw [← MeasureTheory.integral_finsetSum] - intro i _ - have h : (fun (x : ℝ × ℝ) ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * ↑(c a) * x.1 ^ a * -- ↑(c i) * x.2 ^ i) = (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ a * x.2 ^ i * (↑(c i) * ↑(c a))) := by -+ ↑(c i) * x.2 ^ i) = (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * -+ x.1 ^ a * x.2 ^ i * (↑(c i) * ↑(c a))) := by - ext x; ring - rw [h] - apply MeasureTheory.Integrable.mul_const - exact integrableOn_J_rs a i -- _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), -+ _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+ ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), - -(x.1 * x.2).log / (1 - x.1 * x.2) * ↑(c x_1) * x.1 ^ x_1 * ↑(c x_2) * x.2 ^ x_2 := by -- rw [← MeasureTheory.integral_finset_sum] -+ rw [← MeasureTheory.integral_finsetSum] - intro i _ -- apply MeasureTheory.integrable_finset_sum -+ apply MeasureTheory.integrable_finsetSum - intro j _ - have h : (fun (x : ℝ × ℝ) ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * ↑(c i) * x.1 ^ i * -- ↑(c j) * x.2 ^ j) = (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ i * x.2 ^ j * (↑(c i) * ↑(c j))) := by -+ ↑(c j) * x.2 ^ j) = (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * -+ x.1 ^ i * x.2 ^ j * (↑(c i) * ↑(c j))) := by - ext x; ring - rw [h] - apply MeasureTheory.Integrable.mul_const - exact integrableOn_J_rs i j - --lemma multi_integral_mul_const (c d : ℕ) (p q : ℝ): ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, -+lemma multi_integral_mul_const (c d : ℕ) (p q : ℝ) : -+ ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, - -(x.1 * x.2).log / (1 - x.1 * x.2) * p * x.1 ^ c * q * x.2 ^ d = p * q * J c d := by - simp only [J] - symm -@@ -135,11 +144,13 @@ lemma multi_integral_mul_const (c d : ℕ) (p q : ℝ): ∫ (x : ℝ × ℝ) in - simp only [smul_eq_mul] - ring - -+/-- Integer correction coefficient selected from the proved integral identities. -/ - noncomputable def p (r s : ℕ) : ℤ := - if h : r > s then (J_rs_linear h).choose - else if h : r < s then (J_rs_linear h).choose - else -(J_rr_linear r).choose - -+/-- The zeta coefficient: two on the diagonal and zero off the diagonal. -/ - noncomputable def q (r s : ℕ) : ℤ := - if r > s then 0 - else if r < s then 0 -@@ -156,27 +167,27 @@ lemma linear_int_aux : ∃ a b : ℕ → ℕ → ℤ, ∀ r s : ℕ, J r s = - use q - intro x y - if h : x > y then -- cases' (J_rs_linear h) with a ha -+ obtain ⟨a, ha⟩ := J_rs_linear h - simp only [p, q] -- simp_all only [gt_iff_lt, one_div, dite_eq_ite, ite_true, Int.cast_zero, zero_mul, dite_true, -+ simp_all only [gt_iff_lt, one_div, ite_true, Int.cast_zero, zero_mul, dite_true, - zero_add] - rw [(J_rs_linear h).choose_spec] at ha - rw [show x.max y = x by exact max_eq_left_iff.2 (LT.lt.le h)] - simp_all - else if h1 : x < y then -- cases' (J_rs_linear h1) with a ha -+ obtain ⟨a, ha⟩ := J_rs_linear h1 - simp only [p, q] - obtain h2 := J_symm x y -- simp_all only [gt_iff_lt, one_div, dite_eq_ite, ite_true, ite_self, Int.cast_zero, -- zero_mul, dite_true, zero_add, not_false_eq_true, dite_false] -+ simp_all only [gt_iff_lt, one_div, ite_true, ite_self, Int.cast_zero, -+ zero_mul, dite_true, zero_add, dite_false] - rw [(J_rs_linear h1).choose_spec] at ha - simp only [not_lt] at h - simp_all - else - have h : x = y := by linarith -- cases' (J_rr_linear y) with a ha -+ obtain ⟨a, ha⟩ := J_rr_linear y - simp only [p, q] -- simp_all only [gt_iff_lt, lt_self_iff_false, not_false_eq_true, dite_eq_ite, ite_false, -+ simp_all only [gt_iff_lt, lt_self_iff_false, not_false_eq_true, ite_false, - Int.cast_ofNat, not_isEmpty_of_nonempty, tsum_empty, mul_zero, zero_sub, sub_right_inj, - dite_false, Int.cast_neg, max_self] - rw [(J_rr_linear y).choose_spec, ← Mathlib.Tactic.RingNF.add_neg, ← neg_div] at ha -diff --git a/Zeta3Irrational/PrimeCounting.lean b/Zeta3Irrational/PrimeCounting.lean -new file mode 100644 -index 0000000..07a6c45 ---- /dev/null -+++ b/Zeta3Irrational/PrimeCounting.lean -@@ -0,0 +1,48 @@ -+import PrimeNumberTheoremAnd.ZetaFive.Consequences -+ -+/-! -+# Prime counting asymptotics from the proved prime number theorem -+ -+The current Mathlib Chebyshev remainder estimate converts the proved theta asymptotic -+into the exact all-real prime-counting formula used by the Apéry proof. -+-/ -+ -+open Filter Real Asymptotics -+open scoped Chebyshev -+ -+namespace AperyPNT -+ -+/-- The prime-counting function is asymptotic to `x / log x`. -/ -+theorem primeCounting_asymptotic : -+ (fun x : ℝ ↦ (Nat.primeCounting ⌊x⌋₊ : ℝ)) ~[atTop] (fun x ↦ x / log x) := by -+ have h := ZetaFivePNT.chebyshev_asymptotic.div (IsEquivalent.refl (u := Real.log)) -+ have h' := h.add_isLittleO Chebyshev.integral_theta_div_log_sq_isLittleO -+ apply h'.congr' ?_ (Filter.EventuallyEq.refl _ _) -+ filter_upwards [eventually_ge_atTop (2 : ℝ)] with x hx -+ simp only [Pi.sub_apply, Pi.add_apply, Pi.div_apply, id_eq] -+ rw [Chebyshev.primeCounting_eq_theta_div_log_add_integral hx] -+ -+/-- The exact prime-counting consequence, with an error tending to zero. -/ -+theorem pi_alt : ∃ c : ℝ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ -+ ∀ x : ℝ, Nat.primeCounting ⌊x⌋₊ = (1 + c x) * x / log x := by -+ refine ⟨fun x ↦ (Nat.primeCounting ⌊x⌋₊ : ℝ) / (x / log x) - 1, ?_, ?_⟩ -+ · rw [isLittleO_one_iff] -+ have h := (isEquivalent_iff_tendsto_one ?_).mp primeCounting_asymptotic -+ · simpa using h.sub (tendsto_const_nhds (x := (1 : ℝ))) -+ · filter_upwards [eventually_gt_atTop (1 : ℝ)] with x hx -+ exact div_ne_zero (by positivity) (log_pos hx).ne' -+ · intro x -+ by_cases hx : x = 0 -+ · simp [hx] -+ by_cases hl : log x = 0 -+ · have hp : Nat.primeCounting ⌊x⌋₊ = 0 := by -+ apply Nat.primeCounting_eq_zero_iff.mpr -+ rcases log_eq_zero.mp hl with h | h | h -+ · exact (hx h).elim -+ · simp [h] -+ · simp [h, Nat.floor_of_nonpos] -+ simp [hl, hp] -+ · field_simp -+ ring -+ -+end AperyPNT -diff --git a/Zeta3Irrational/d.lean b/Zeta3Irrational/d.lean -index 027628c..343f95f 100644 ---- a/Zeta3Irrational/d.lean -+++ b/Zeta3Irrational/d.lean -@@ -4,32 +4,23 @@ Author: Junqi Liu and Jujian Zhang. - -/ - import Mathlib.Algebra.GCDMonoid.Finset - import Mathlib.Algebra.GCDMonoid.Nat -+import Mathlib.Data.Nat.GCD.Prime - import Mathlib.Analysis.SpecialFunctions.Log.Base - import Mathlib.Data.Nat.Choose.Factorization --import Mathlib.Data.Real.StarOrdered -+import Mathlib.Analysis.Real.Sqrt - import Mathlib.NumberTheory.PrimeCounting - -+/-! -+# Least common multiples for the Apéry irrationality proof -+ -+We bound the least common multiple of the integers from one to `n` using prime counting. -+The natural-number normalization and GCD structures are Mathlib's canonical instances. -+-/ -+ - open scoped Nat - open BigOperators - --instance : NormalizedGCDMonoid ℕ where -- normUnit _ := 1 -- normUnit_zero := rfl -- normUnit_mul := by simp -- normUnit_coe_units n := by -- rw [Nat.units_eq_one n] -- simp -- gcd := Nat.gcd -- lcm := Nat.lcm -- gcd_dvd_left := Nat.gcd_dvd_left -- gcd_dvd_right := Nat.gcd_dvd_right -- dvd_gcd := Nat.dvd_gcd -- gcd_mul_lcm m n := by rw [Nat.gcd_mul_lcm]; rfl -- lcm_zero_left := Nat.lcm_zero_left -- lcm_zero_right := Nat.lcm_zero_right -- normalize_gcd := by simp -- normalize_lcm := by simp -- -+/-- The least common multiple of the natural numbers in the finite set s. -/ - def d (s : Finset ℕ) : ℕ := s.lcm id - - theorem d_insert (s : Finset ℕ) (n : ℕ) : d (insert n s) = Nat.lcm n (d s) := by -@@ -57,10 +48,6 @@ theorem d_eq_zero (s : Finset ℕ) (hs : 0 ∈ s) : d s = 0 := by - rw [Finset.lcm_eq_zero_iff] - simpa - --theorem Nat.Prime.dvd_lcm {p} (hp : Nat.Prime p) (a b) (h : p ∣ Nat.lcm a b) : p ∣ a ∨ p ∣ b := by -- have := h.trans <| Nat.lcm_dvd_mul a b -- rwa [Nat.Prime.dvd_mul hp] at this -- - theorem Nat.primeFactors_lcm {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) : - (a.lcm b).primeFactors = a.primeFactors ∪ b.primeFactors := by - ext p -@@ -69,7 +56,7 @@ theorem Nat.primeFactors_lcm {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) : - simp only [mem_primeFactorsList', ne_eq] - constructor - · rintro ⟨hp1, hp2, hp3⟩ -- obtain hp4|hp4 := hp1.dvd_lcm a b hp2 -+ obtain hp4|hp4 := hp1.dvd_or_dvd_of_dvd_lcm hp2 - · left; refine ⟨hp1, hp4, ?_⟩ - contrapose! hp3 - subst hp3 -@@ -88,240 +75,17 @@ theorem Nat.primeFactors_lcm {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) : - erw [lcm_eq_zero_iff] at hp3 - refine hp3.elim (fun ha' => absurd ha' ha) id - --theorem d_sq (s : Finset ℕ) : (d s)^2 = d (s.image (· ^ 2)) := by -+theorem d_sq (s : Finset ℕ) : (d s) ^ 2 = d (s.image (· ^ 2)) := by - induction s using Finset.induction_on with - | empty => simp [d] -- | @insert i s hi ih => -- rw [d_insert, Finset.image_insert, d_insert, ← ih] -- refine dvd_antisymm ?_ ?_ -- · if hi : i = 0 -- then -- subst hi -- simp -- else -- if hs' : 0 ∈ s -- then -- rw [d_eq_zero _ hs'] -- simp -- else -- have hds : d s ≠ 0 := d_ne_zero s hs' -- have hi' : i^2 ≠ 0 := by simpa using hi -- have hds' : (d s)^2 ≠ 0 := by simpa using hds -- rw [← Nat.factorizationLCMLeft_mul_factorizationLCMRight, -- ← Nat.factorizationLCMLeft_mul_factorizationLCMRight, mul_pow] <;> try assumption -- -- apply mul_dvd_mul -- · delta Nat.factorizationLCMLeft -- erw [← Finset.prod_pow] -- dsimp only -- have eq1 := -- calc ∏ x ∈ (i.lcm (d s)).factorization.support, -- (if (d s).factorization x ≤ i.factorization x -- then x ^ (i.lcm (d s)).factorization x else 1) ^ 2 -- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), -- (if (d s).factorization x ≤ i.factorization x -- then x ^ (i.lcm (d s)).factorization x else 1) ^ 2 := by -- apply Finset.prod_congr ?_ (fun _ _ => rfl) -- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> assumption -- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), -- if (d s).factorization x ≤ i.factorization x -- then (x ^ (i.lcm (d s)).factorization x) ^ 2 else 1 := by -- refine Finset.prod_congr rfl fun x _ => ?_ -- split_ifs <;> simp -- rw [eq1] -- have eq2 := calc ((i ^ 2).lcm (d s ^ 2)).factorization.prod fun p n ↦ -- if (d s ^ 2).factorization p ≤ (i ^ 2).factorization p then p ^ n else 1 -- _ = ∏ i ∈ ((i ^ 2).lcm (d s ^ 2)).factorization.support, _ := rfl -- _ = ∏ i ∈ (i.primeFactors ∪ (d s).primeFactors), _ := by -- apply Finset.prod_congr ?_ (fun _ _ => rfl) -- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> try assumption -- congr 1 <;> -- · rw [pow_two, Nat.primeFactors_mul] <;> aesop -- -- simp_rw [eq2, Nat.factorization_pow] -- simp only [Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, gt_iff_lt, Nat.ofNat_pos, -- mul_le_mul_left] -- apply Finset.prod_dvd_prod_of_dvd -- intro p _ -- split_ifs -- · rw [← pow_mul] -- apply pow_dvd_pow -- rw [Nat.factorization_lcm, Nat.factorization_lcm] <;> try assumption -- -- simp only [Finsupp.sup_apply, Nat.factorization_pow, Finsupp.coe_smul, Pi.smul_apply, -- smul_eq_mul] -- have eq : 2 * i.factorization p ⊔ 2 * (d s).factorization p = -- 2 * (i.factorization p ⊔ (d s).factorization p) := by -- change Nat.max _ _ = 2 * Nat.max _ _ -- rw [mul_max_of_nonneg] -- norm_num -- rw [eq, mul_comm] -- -- · exact one_dvd _ -- · delta Nat.factorizationLCMRight -- erw [← Finset.prod_pow] -- dsimp only -- have eq1 := -- calc ∏ x ∈ (i.lcm (d s)).factorization.support, -- (if (d s).factorization x ≤ i.factorization x -- then 1 else x ^ (i.lcm (d s)).factorization x) ^ 2 -- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), -- (if (d s).factorization x ≤ i.factorization x -- then 1 else x ^ (i.lcm (d s)).factorization x) ^ 2 := by -- apply Finset.prod_congr ?_ (fun _ _ => rfl) -- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> assumption -- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), -- if (d s).factorization x ≤ i.factorization x -- then 1 else (x ^ (i.lcm (d s)).factorization x) ^ 2 := by -- refine Finset.prod_congr rfl fun x _ => ?_ -- split_ifs <;> simp -- rw [eq1] -- have eq2 := calc ((i ^ 2).lcm (d s ^ 2)).factorization.prod fun p n ↦ -- if (d s ^ 2).factorization p ≤ (i ^ 2).factorization p then 1 else p ^ n -- _ = ∏ i ∈ ((i ^ 2).lcm (d s ^ 2)).factorization.support, _ := rfl -- _ = ∏ i ∈ (i.primeFactors ∪ (d s).primeFactors), _ := by -- apply Finset.prod_congr ?_ (fun _ _ => rfl) -- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> try assumption -- congr 1 <;> -- · rw [pow_two, Nat.primeFactors_mul] <;> aesop -- simp_rw [eq2, Nat.factorization_pow] -- simp only [Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, gt_iff_lt, Nat.ofNat_pos, -- mul_le_mul_left] -- apply Finset.prod_dvd_prod_of_dvd -- intro p _ -- split_ifs -- · exact one_dvd _ -- · rw [← pow_mul] -- apply pow_dvd_pow -- rw [Nat.factorization_lcm, Nat.factorization_lcm] <;> try assumption -+ | @insert i s _ ih => -+ rw [d_insert, Finset.image_insert, d_insert, ← ih, Nat.pow_lcm_pow] - -- simp only [Finsupp.sup_apply, Nat.factorization_pow, Finsupp.coe_smul, Pi.smul_apply, -- smul_eq_mul] -- have eq : 2 * i.factorization p ⊔ 2 * (d s).factorization p = -- 2 * (i.factorization p ⊔ (d s).factorization p) := by -- change Nat.max _ _ = 2 * Nat.max _ _ -- rw [mul_max_of_nonneg] -- norm_num -- rw [eq, mul_comm] -- -- · rw [Nat.lcm_dvd_iff] -- exact ⟨pow_dvd_pow_of_dvd (Nat.dvd_lcm_left _ _) 2, -- pow_dvd_pow_of_dvd (Nat.dvd_lcm_right _ _) 2⟩ -- --theorem d_cube (s : Finset ℕ) : (d s)^3 = d (s.image (· ^ 3)) := by -+theorem d_cube (s : Finset ℕ) : (d s) ^ 3 = d (s.image (· ^ 3)) := by - induction s using Finset.induction_on with - | empty => simp [d] -- | @insert i s hi ih => -- rw [d_insert, Finset.image_insert, d_insert, ← ih] -- refine dvd_antisymm ?_ ?_ -- · if hi : i = 0 -- then -- subst hi -- simp -- else -- if hs' : 0 ∈ s -- then -- rw [d_eq_zero _ hs'] -- simp -- else -- have hds : d s ≠ 0 := d_ne_zero s hs' -- have hi' : i^3 ≠ 0 := by simpa using hi -- have hds' : (d s)^3 ≠ 0 := by simpa using hds -- rw [← Nat.factorizationLCMLeft_mul_factorizationLCMRight, -- ← Nat.factorizationLCMLeft_mul_factorizationLCMRight, mul_pow] <;> try assumption -- -- apply mul_dvd_mul -- · delta Nat.factorizationLCMLeft -- erw [← Finset.prod_pow] -- dsimp only -- have eq1 := -- calc ∏ x ∈ (i.lcm (d s)).factorization.support, -- (if (d s).factorization x ≤ i.factorization x -- then x ^ (i.lcm (d s)).factorization x else 1) ^ 3 -- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), -- (if (d s).factorization x ≤ i.factorization x -- then x ^ (i.lcm (d s)).factorization x else 1) ^ 3 := by -- apply Finset.prod_congr ?_ (fun _ _ => rfl) -- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> assumption -- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), -- if (d s).factorization x ≤ i.factorization x -- then (x ^ (i.lcm (d s)).factorization x) ^ 3 else 1 := by -- refine Finset.prod_congr rfl fun x _ => ?_ -- split_ifs <;> simp -- rw [eq1] -- have eq2 := calc ((i ^ 3).lcm (d s ^ 3)).factorization.prod fun p n ↦ -- if (d s ^ 3).factorization p ≤ (i ^ 3).factorization p then p ^ n else 1 -- _ = ∏ i ∈ ((i ^ 3).lcm (d s ^ 3)).factorization.support, _ := rfl -- _ = ∏ i ∈ (i.primeFactors ∪ (d s).primeFactors), _ := by -- apply Finset.prod_congr ?_ (fun _ _ => rfl) -- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> try assumption -- congr 1 <;> -- · rw [show 3 = 2 + 1 by omega, pow_add, pow_two, pow_one, Nat.primeFactors_mul, -- Nat.primeFactors_mul] <;> aesop -- -- simp_rw [eq2, Nat.factorization_pow] -- simp only [Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, gt_iff_lt, Nat.ofNat_pos, -- mul_le_mul_left] -- apply Finset.prod_dvd_prod_of_dvd -- intro p _ -- split_ifs -- · rw [← pow_mul] -- apply pow_dvd_pow -- rw [Nat.factorization_lcm, Nat.factorization_lcm] <;> try assumption -- -- simp only [Finsupp.sup_apply, Nat.factorization_pow, Finsupp.coe_smul, Pi.smul_apply, -- smul_eq_mul] -- have eq : 3 * i.factorization p ⊔ 3 * (d s).factorization p = -- 3 * (i.factorization p ⊔ (d s).factorization p) := by -- change Nat.max _ _ = 3 * Nat.max _ _ -- rw [mul_max_of_nonneg] -- norm_num -- rw [eq, mul_comm] -- · exact one_dvd _ -- -- · delta Nat.factorizationLCMRight -- erw [← Finset.prod_pow] -- simp only [Nat.support_factorization, ite_pow, one_pow, Nat.factorization_pow, -- Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, gt_iff_lt, Nat.ofNat_pos, mul_le_mul_left] -- have eq1 := -- calc ∏ x ∈ (i.lcm (d s)).primeFactors, -- if (d s).factorization x ≤ i.factorization x -- then 1 else (x ^ (i.lcm (d s)).factorization x) ^ 3 -- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), -- if (d s).factorization x ≤ i.factorization x -- then 1 else (x ^ (i.lcm (d s)).factorization x) ^ 3 := by -- apply Finset.prod_congr ?_ fun _ _ => rfl -- rw [Nat.primeFactors_lcm] <;> assumption -- rw [eq1] -- have eq2 := calc ((i ^ 3).lcm (d s ^ 3)).factorization.prod fun p n ↦ -- if (d s).factorization p ≤ i.factorization p then 1 else p ^ n -- _ = ∏ i ∈ ((i ^ 3).lcm (d s ^ 3)).factorization.support, _ := rfl -- _ = ∏ i ∈ (i.primeFactors ∪ (d s).primeFactors), _ := by -- apply Finset.prod_congr ?_ fun _ _ => rfl -- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> try assumption -- congr 1 <;> -- · rw [show 3 = 2 + 1 by omega, pow_add, pow_two, pow_one, Nat.primeFactors_mul, -- Nat.primeFactors_mul] <;> aesop -- rw [eq2] -- apply Finset.prod_dvd_prod_of_dvd -- intro p _ -- simp only -- split_ifs -- · simp -- · rw [← pow_mul] -- apply pow_dvd_pow -- rw [Nat.factorization_lcm, Nat.factorization_lcm] <;> try assumption -- simp only [Finsupp.sup_apply, Nat.factorization_pow, Finsupp.coe_smul, Pi.smul_apply, -- smul_eq_mul] -- have eq : 3 * i.factorization p ⊔ 3 * (d s).factorization p = -- 3 * (i.factorization p ⊔ (d s).factorization p) := by -- change Nat.max _ _ = 3 * Nat.max _ _ -- rw [mul_max_of_nonneg] -- norm_num -- rw [eq, mul_comm] -- · rw [Nat.lcm_dvd_iff] -- exact ⟨pow_dvd_pow_of_dvd (Nat.dvd_lcm_left _ _) 3, -- pow_dvd_pow_of_dvd (Nat.dvd_lcm_right _ _) 3⟩ -+ | @insert i s _ ih => -+ rw [d_insert, Finset.image_insert, d_insert, ← ih, Nat.pow_lcm_pow] - - theorem d_sq' (n : ℕ) : - d (Finset.Icc 1 n)^2 = d (Finset.Icc 1 n |>.image (· ^ 2)) := d_sq _ -@@ -339,12 +103,6 @@ theorem lcm_factorization (m n p : ℕ) (hm : m ≠ 0) (hn : n ≠ 0) : - rw [Nat.factorization_lcm hm hn] - aesop - ---- lemma lcm_eq_prod (m n : ℕ) : m.lcm n = ---- ∏ p ∈ (max m n).primesBelow, p ^ (max (m.factorization p) (n.factorization p)) := by -- ---- sorry -- -- - theorem d_factorization (s : Finset ℕ) (hs : s.Nonempty) (p : ℕ) (hs₁ : 0 ∉ s) : - (d s).factorization p = - (s.image fun i => i.factorization p).max' (by aesop) := by -@@ -356,15 +114,11 @@ theorem d_factorization (s : Finset ℕ) (hs : s.Nonempty) (p : ℕ) (hs₁ : 0 - then - simp only [Finset.image_insert] - rw [Finset.max'_insert (H := by aesop)] -- rw [max_comm] -- congr 1 -- rw [ih hs] -- aesop -+ rw [ih hs (by aesop)] - else - simp only [Finset.not_nonempty_iff_eq_empty] at hs - subst hs -- simp only [d_empty, Nat.factorization_one, Finsupp.coe_zero, Pi.zero_apply, zero_le, -- max_eq_left, insert_emptyc_eq, Finset.image_singleton, Finset.max'_singleton] -+ simp [d_empty] - · aesop - · apply d_ne_zero - aesop -@@ -431,14 +185,16 @@ theorem d_factorization_eq_div_log' (n p : ℕ) (hp : Nat.Prime p) : - · by_contra! h - rw [Finset.max'_le_iff] at h - set y := (Finset.image (fun i ↦ i.factorization p) (Finset.Icc 1 (n + 1))).max' (by aesop) -- have hy : (y : ℝ) ∈ (Finset.image (fun i ↦ (i.factorization p : ℝ)) (Finset.Icc 1 (n + 1))) := by -+ have hy : (y : ℝ) ∈ -+ (Finset.image (fun i ↦ (i.factorization p : ℝ)) (Finset.Icc 1 (n + 1))) := by - simp only [Finset.mem_image, Finset.mem_Icc, Nat.cast_inj] - simp_rw [← Finset.mem_Icc] - rw [← Finset.mem_image] - exact Finset.max'_mem _ _ - specialize h (y : ℝ) hy - rw [le_sub_iff_add_le, Real.le_logb_iff_rpow_le] at h -- · have h2 : y + 1 ∉ (Finset.image (fun i ↦ i.factorization p) (Finset.Icc 1 (n + 1))) := by -+ · have h2 : y + 1 ∉ -+ (Finset.image (fun i ↦ i.factorization p) (Finset.Icc 1 (n + 1))) := by - by_contra! hy1 - suffices y + 1 ≤ y by linarith - exact Finset.le_max' _ _ hy1 -@@ -450,8 +206,8 @@ theorem d_factorization_eq_div_log' (n p : ℕ) (hp : Nat.Prime p) : - exact Nat.Prime.one_lt hp - · norm_cast - omega -- · aesop - · aesop -+ · simp - · apply Real.logb_nonneg - · norm_cast - exact Nat.Prime.one_lt hp -@@ -464,31 +220,20 @@ theorem d_factorization_eq_div_log (n p : ℕ) (hp : Nat.Prime p) : - cases n - · simp only [zero_lt_one, Finset.Icc_eq_empty_of_lt, d_empty, Nat.factorization_one, - Finsupp.coe_zero, Pi.zero_apply, CharP.cast_eq_zero, Real.log_zero, zero_div, Nat.floor_zero] -- - · rw [d_factorization_eq_div_log' (hp := hp)] - simp - ---- lemma d_eq_prod (s : Finset ℕ) (hs : s.Nonempty) : ---- d s = ---- ∏ p ∈ Nat.primesBelow (s.max' hs), ---- p ^ (s.image fun i => i.factorization p).max' (by aesop) := by ---- induction s using Finset.induction_on with ---- | empty => simp only [Finset.not_nonempty_empty] at hs ---- | @insert m s hm ih => ---- sorry -- - theorem d_eq_prod_pow' (n : ℕ) : - d (Finset.Icc 1 (n + 1)) = - ∏ p ∈ (((n + 1) + 1).primesBelow), - p ^ ((Finset.Icc 1 (n + 1)).image (fun i => i.factorization p)).max' (by aesop) := by -- rw [← Nat.factorization_prod_pow_eq_self (n := d (Finset.Icc 1 (n + 1)))] -+ rw [← Nat.prod_factorization_pow_eq_self (n := d (Finset.Icc 1 (n + 1)))] - · simp only [Finsupp.prod, Nat.support_factorization] - rw [d_primeFactors _ (by aesop)] - refine Finset.prod_congr ?_ ?_ - · ext p -- constructor <;> intro hp <;> simp only at hp ⊢ -+ constructor <;> intro hp - · rw [Finset.mem_sup] at hp -- - obtain ⟨m, H, h⟩ := hp - simp only [Finset.mem_Icc] at H - rw [Nat.mem_primesBelow] -@@ -541,41 +286,39 @@ theorem d_le_pow_counting (n : ℕ) : d (Finset.Icc 1 n) ≤ n ^ (n.primeCountin - calc - _ ≤ ∏ _ ∈ ((n + 1).primesBelow), n := by - apply Finset.prod_le_prod -- · intro p _ -- simp only [zero_le] -- · intro p hp -- rw [Nat.mem_primesBelow] at hp -- have h2 : 1 ≤ p := by -- by_contra! h -- have : p = 0 := by omega -- aesop -- suffices p ^ (⌊(Real.log (n : ℝ)) / (Real.log (p : ℝ))⌋₊ : ℝ) ≤ (n : ℝ) by norm_cast at this -- trans p ^ ((Real.log (n : ℝ)) / (Real.log (p : ℝ))) -- · apply Real.rpow_le_rpow_of_exponent_le (by norm_cast) -- · apply Nat.floor_le (α := ℝ) -- if h2 : n = 1 ∨ p = 1 then -- rcases h2 with (rfl | rfl) <;> simp -- else -- rcases (not_or.1 h2) with ⟨_, h2⟩ -- have h1 : 1 < n := by omega -- have h2 : 1 < p := by omega -- suffices 0 < Real.log (n : ℝ) / Real.log (p : ℝ) by linarith -- apply div_pos <;> -- exact Real.log_pos (by norm_cast) -- · nth_rewrite 1 [← Real.exp_log (x := (p : ℝ)) (by norm_cast), ← Real.exp_one_rpow, -- ← Real.rpow_mul (by exact Real.exp_nonneg 1), mul_div, mul_comm, ← mul_div] -- if hp : p = 1 then -- rw [hp]; simp only [Nat.cast_one, Real.log_one, div_zero, mul_zero, Real.rpow_zero, -- Nat.one_le_cast, h1] -+ intro p hp -+ rw [Nat.mem_primesBelow] at hp -+ have h2 : 1 ≤ p := by -+ by_contra! h -+ have : p = 0 := by omega -+ aesop -+ suffices p ^ (⌊(Real.log (n : ℝ)) / (Real.log (p : ℝ))⌋₊ : ℝ) ≤ (n : ℝ) by norm_cast at this -+ trans p ^ ((Real.log (n : ℝ)) / (Real.log (p : ℝ))) -+ · apply Real.rpow_le_rpow_of_exponent_le (by norm_cast) -+ · apply Nat.floor_le (R := ℝ) -+ if h2 : n = 1 ∨ p = 1 then -+ rcases h2 with (rfl | rfl) <;> simp - else -- rw [div_self, mul_one, Real.exp_one_rpow, Real.exp_log (by norm_cast)] -- rw [Real.log_ne_zero] -- norm_cast -- simp only [not_false_eq_true, and_true] -- omega -+ rcases (not_or.1 h2) with ⟨_, h2⟩ -+ have h1 : 1 < n := by omega -+ have h2 : 1 < p := by omega -+ suffices 0 < Real.log (n : ℝ) / Real.log (p : ℝ) by linarith -+ apply div_pos <;> -+ exact Real.log_pos (by norm_cast) -+ · nth_rewrite 1 [← Real.exp_log (x := (p : ℝ)) (by norm_cast), ← Real.exp_one_rpow, -+ ← Real.rpow_mul (by exact Real.exp_nonneg 1), mul_div, mul_comm, ← mul_div] -+ if hp : p = 1 then -+ rw [hp]; simp only [Nat.cast_one, Real.log_one, div_zero, mul_zero, Real.rpow_zero, -+ Nat.one_le_cast, h1] -+ else -+ rw [div_self, mul_one, Real.exp_one_rpow, Real.exp_log (by norm_cast)] -+ rw [Real.log_ne_zero] -+ norm_cast -+ simp only [not_false_eq_true, and_true] -+ omega - _ ≤ n ^ (n.primeCounting) := by - rw [Finset.prod_const] -- suffices ((n + 1).primesBelow).card = n.primeCounting by apply Nat.pow_le_pow_right <;> linarith -+ suffices ((n + 1).primesBelow).card = n.primeCounting by -+ apply Nat.pow_le_pow_right <;> linarith - rw [Nat.primeCounting, ← Nat.primesBelow_card_eq_primeCounting'] - --#min_imports -diff --git a/lakefile.lean b/lakefile.lean -index 6276b4a..38f6ff4 100644 ---- a/lakefile.lean -+++ b/lakefile.lean -@@ -11,7 +11,10 @@ package «Zeta3Irrational» where - - @[default_target] - lean_lib «Zeta3Irrational» where -- -- add any library configuration options here -+ roots := #[`Zeta3Irrational] -+ globs := #[`Zeta3Irrational, `Zeta3Irrational.Basic, `Zeta3Irrational.Bound, -+ `Zeta3Irrational.Integral, `Zeta3Irrational.LegendrePoly, `Zeta3Irrational.LinearForm, -+ `Zeta3Irrational.d, `Zeta3Irrational.Equality, `Zeta3Irrational.PrimeCounting] - - require «PrimeNumberTheoremAnd» from git - "https://github.com/AlexKontorovich/PrimeNumberTheoremAnd.git" @ "main" -diff --git a/lean-toolchain b/lean-toolchain -index b2153cd..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.18.0 -+leanprover/lean4:v4.34.1 +diff --git a/Zeta3Irrational.lean b/Zeta3Irrational.lean +index c779005..5298524 100644 +--- a/Zeta3Irrational.lean ++++ b/Zeta3Irrational.lean +@@ -1,7 +1,8 @@ + import Zeta3Irrational.Basic + import Zeta3Irrational.Bound +-import Zeta3Irrational.Equality + import Zeta3Irrational.Integral + import Zeta3Irrational.LegendrePoly + import Zeta3Irrational.LinearForm + import Zeta3Irrational.d ++import Zeta3Irrational.Equality ++import Zeta3Irrational.PrimeCounting +diff --git a/Zeta3Irrational/Basic.lean b/Zeta3Irrational/Basic.lean +index 3583719..8014ec5 100644 +--- a/Zeta3Irrational/Basic.lean ++++ b/Zeta3Irrational/Basic.lean +@@ -2,42 +2,49 @@ + A formal proof of the irrationality of Riemann-Zeta(3). + Author: Junqi Liu and Jujian Zhang. + -/ +-import Mathlib.Data.Int.Star + import Mathlib.NumberTheory.LSeries.HurwitzZetaValues +-import Mathlib.Order.CompletePartialOrder +-import Mathlib.RingTheory.DedekindDomain.Dvr +-import PrimeNumberTheoremAnd.Consequences ++import Zeta3Irrational.PrimeCounting + import Zeta3Irrational.Bound + import Zeta3Irrational.LegendrePoly + import Zeta3Irrational.LinearForm + ++/-! # Apéry's irrationality proof for ζ(3) ++ ++Port of the Apache-2.0 source by Junqi Liu and Jujian Zhang. ++-/ ++ + open scoped Nat + open BigOperators Polynomial + ++/-- The logarithmic double integral weighted by two real shifted Legendre polynomials. -/ + noncomputable abbrev JJ (n : ℕ) : ℝ := + ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- (-(x.1 * x.2).log / (1 - x.1 * x.2) * (shiftedLegendre n).eval x.1 * (shiftedLegendre n).eval x.2) ++ (-(x.1 * x.2).log / (1 - x.1 * x.2) * (aperyShiftedLegendre n).eval x.1 * ++ (aperyShiftedLegendre n).eval x.2) + ++/-- The equivalent positive triple integral in the Apéry identity. -/ + noncomputable abbrev JJ' (n : ℕ) : ℝ := + ∫ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / + (1 - (1 - x.2.1 * x.2.2) * x.1)) ^ n / (1 - (1 - x.2.1 * x.2.2) * x.1) + ++/-- The nonnegative extended-real integral of the positive Apéry integrand. -/ + noncomputable abbrev JJENN (n : ℕ) : ENNReal := + ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ENNReal.ofReal + ((x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / + (1 - (1 - x.2.1 * x.2.2) * x.1)) ^ n / (1 - (1 - x.2.1 * x.2.2) * x.1)) + ++/-- The Apéry double integral multiplied by the cube of the least common multiple. -/ + noncomputable abbrev fun1 (n : ℕ) : ℝ := (d (Finset.Icc 1 n)) ^ 3 * JJ n + + theorem linear_int (n : ℕ) : ∃ a b : ℕ → ℤ, + fun1 n = a n + b n * (d (Finset.Icc 1 n) : ℤ) ^ 3 * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 := by + delta fun1 JJ + obtain ⟨c, hc⟩ := shiftedLegendre_eq_int_poly n +- simp_rw [hc, Polynomial.eval_finset_sum, mul_assoc, Finset.sum_mul_sum, Finset.mul_sum] +- simp only [zsmul_eq_mul, eval_mul, eval_intCast, eval_pow, eval_X] ++ simp_rw [hc, Polynomial.eval_finsetSum, mul_assoc, Finset.sum_mul_sum, Finset.mul_sum] ++ simp only [eval_mul, eval_intCast, eval_pow, eval_X] + simp_rw [← mul_assoc, multi_integral_sum_comm, multi_integral_mul_const] +- simp only [← Finset.sum_neg_distrib, Finset.mul_sum] ++ simp only [Finset.mul_sum] + obtain ⟨qq', ⟨pp', hqq'⟩⟩ := linear_int_aux + use fun n => ∑ x ∈ Finset.range (n + 1), ∑ i ∈ Finset.range (n + 1), + d (Finset.Icc 1 n) ^ 3 * c x * c i * qq' x i / d (Finset.Icc 1 (Nat.max x i)) ^ 3 +@@ -70,10 +77,10 @@ theorem linear_int (n : ℕ) : ∃ a b : ℕ → ℤ, + simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, IsIntegrallyClosed.pow_dvd_pow_iff] + norm_cast + apply d_dvd_d_of_le +- simp_all only [zsmul_eq_mul, Finset.mem_range, Finset.le_eq_subset] ++ simp_all only [Finset.mem_range] + intro a b + simp_all only [Finset.mem_Icc, true_and] +- simp only [one_div, le_max_iff] at b ++ simp only [le_max_iff] at b + rcases b with ⟨_ ,(c | c)⟩ + <;> + linarith +@@ -83,7 +90,8 @@ theorem linear_int (n : ℕ) : ∃ a b : ℕ → ℤ, + simp + · ring + +-lemma pos_aux (x : ℝ × ℝ × ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ (0 < x.2.1 ∧ x.2.1 < 1) ∧ 0 < x.2.2 ∧ x.2.2 < 1) : ++lemma pos_aux (x : ℝ × ℝ × ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ (0 < x.2.1 ∧ x.2.1 < 1) ∧ 0 < x.2.2 ∧ ++ x.2.2 < 1) : + 0 < (1 - (1 - x.2.1 * x.2.2) * x.1) := by + simp only [sub_pos] + suffices (1 - x.2.1 * x.2.2) * x.1 < x.1 by linarith +@@ -120,7 +128,8 @@ lemma JJENN_upper (n : ℕ) : JJENN n ≤ + apply bound' <;> linarith + · exact pos_aux x h + · simp only [h, ↓reduceIte, le_refl] +- _ = ENNReal.ofReal ((1 / 24) ^ n) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++ _ = ENNReal.ofReal ((1 / 24) ^ n) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ ++ Set.Ioo 0 1, + ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by + rw [← MeasureTheory.lintegral_const_mul] + · rw [← MeasureTheory.lintegral_indicator (by measurability), +@@ -139,8 +148,8 @@ lemma JJENN_upper (n : ℕ) : JJENN n ≤ + apply Measurable.mul _ measurable_fst + apply Measurable.const_sub + apply Measurable.mul +- apply Measurable.comp' measurable_fst measurable_snd +- apply Measurable.comp' measurable_snd measurable_snd ++ · exact measurable_fst.comp measurable_snd ++ · exact measurable_snd.comp measurable_snd + _ = ENNReal.ofReal (2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3) := by + have h := JENN_eq_triple 0 0 + simp only [pow_zero, mul_one] at h +@@ -151,40 +160,14 @@ lemma JJENN_upper (n : ℕ) : JJENN n ≤ + nth_rw 2 [mul_comm] + + lemma integrableOn_JJ' (n : ℕ) : MeasureTheory.Integrable (fun (x : ℝ × ℝ × ℝ) ↦ +- (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / (1 - (1 - x.2.1 * x.2.2) * x.1)) ^ n / +- (1 - (1 - x.2.1 * x.2.2) * x.1)) (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1)) := by ++ (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / (1 - (1 - x.2.1 * x.2.2) * ++ x.1)) ^ n / ++ (1 - (1 - x.2.1 * x.2.2) * x.1)) (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ++ ×ˢ Set.Ioo 0 1)) := by + rw [MeasureTheory.Integrable] + constructor +- · apply AEMeasurable.aestronglyMeasurable +- rw [← aemeasurable_indicator_iff (by measurability)] +- apply AEMeasurable.indicator _ (by measurability) +- apply AEMeasurable.div +- · apply AEMeasurable.pow_const +- apply AEMeasurable.div +- · apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.fst (f := id) aemeasurable_id) _) +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) _) +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) _) +- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) +- · apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) +- · apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) ++ · apply Measurable.aestronglyMeasurable ++ fun_prop + · rw [MeasureTheory.hasFiniteIntegral_iff_norm] + set k := _ + change k < ⊤ +@@ -196,16 +179,16 @@ lemma integrableOn_JJ' (n : ℕ) : MeasureTheory.Integrable (fun (x : ℝ × ℝ + ext x + rw [Set.indicator_apply, Set.indicator_apply] + by_cases hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 +- · simp only [hx, ↓reduceIte, norm_mul, norm_div, norm_neg, Real.norm_eq_abs, norm_pow] ++ · simp only [hx, ↓reduceIte, norm_mul, norm_div, Real.norm_eq_abs, norm_pow] + simp only [Set.mem_prod, Set.mem_Ioo] at hx + rw [ENNReal.ofReal_eq_ofReal_iff] + · congr 3 + · rw [abs_eq_self.2, abs_eq_self.2, abs_eq_self.2, abs_eq_self.2, abs_eq_self.2, + abs_eq_self.2] <;> nlinarith + · simp only [abs_eq_self, sub_nonneg] +- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) ++ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) + · simp only [abs_eq_self, sub_nonneg] +- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) ++ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) + · positivity + · apply div_nonneg + · apply pow_nonneg +@@ -223,13 +206,14 @@ lemma integrableOn_JJ' (n : ℕ) : MeasureTheory.Integrable (fun (x : ℝ × ℝ + simp only [one_div, inv_pow, ENNReal.ofReal_lt_top] + + lemma shiftedLegendre_bound (n : ℕ) (x : ℝ) (hx : 0 < x ∧ x < 1) : +- |eval x (shiftedLegendre n)| ≤ ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + x_1).choose n) := by +- simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul, eval_finset_sum, ++ |eval x (aperyShiftedLegendre n)| ≤ ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + ++ x_1).choose n) := by ++ simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, eval_finsetSum, + eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- have := Finset.abs_sum_le_sum_abs (f := fun y => (-1) ^ y * ↑(n.choose y) * ↑((n + y).choose n) * x ^ y) ++ have := Finset.abs_sum_le_sum_abs (f := fun y => (-1) ^ y * ↑(n.choose y) * ↑((n + y).choose ++ n) * x ^ y) + (s := Finset.range (n + 1)) +- trans +- apply this ++ refine this.trans ?_ + apply Finset.sum_le_sum + intro i _ + simp only [abs_mul, abs_pow, abs_neg, abs_one, one_pow, Nat.abs_cast, one_mul] +@@ -243,51 +227,24 @@ lemma shiftedLegendre_bound (n : ℕ) (x : ℝ) (hx : 0 < x ∧ x < 1) : + + lemma Measurable_one_div_aux : + Measurable fun (x : ℝ × ℝ × ℝ) ↦ ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by +- apply Measurable.ennreal_ofReal +- apply Measurable.const_div +- apply Measurable.const_sub +- apply Measurable.mul _ measurable_fst +- apply Measurable.const_sub +- apply Measurable.mul +- apply Measurable.comp' measurable_fst measurable_snd +- apply Measurable.comp' measurable_snd measurable_snd ++ fun_prop + + lemma integrableOn_JJ1 (n : ℕ) : MeasureTheory.Integrable +- (Function.uncurry fun z x ↦ eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) +- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1))) := by +- rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Integrable] ++ (Function.uncurry fun z x ↦ eval x.1 (aperyShiftedLegendre n) * eval x.2 ++ (aperyShiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) ++ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 ++ 1 ×ˢ Set.Ioo 0 1))) := by ++ rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, ++ MeasureTheory.Integrable] + constructor +- · apply AEMeasurable.aestronglyMeasurable +- rw [← aemeasurable_indicator_iff (by measurability)] +- apply AEMeasurable.indicator _ (by measurability) +- simp_rw [mul_one_div] +- apply AEMeasurable.div +- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] +- apply AEMeasurable.mul +- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- apply Finset.aemeasurable_sum +- intro i _ +- apply AEMeasurable.const_mul +- apply AEMeasurable.pow_const (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) _) +- apply AEMeasurable.fst (f := id) aemeasurable_id +- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- apply Finset.aemeasurable_sum +- intro i _ +- apply AEMeasurable.const_mul +- apply AEMeasurable.pow_const (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) _) +- apply AEMeasurable.snd (f := id) aemeasurable_id +- · apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) ++ · apply Measurable.aestronglyMeasurable ++ fun_prop + · rw [MeasureTheory.hasFiniteIntegral_iff_norm] + set k := _ + set C := ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + x_1).choose n) + change k < ⊤ +- have : k ≤ ENNReal.ofReal (C ^ 2) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++ have : k ≤ ENNReal.ofReal (C ^ 2) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ ++ Set.Ioo 0 1, + ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by + simp only [k] + rw [← MeasureTheory.lintegral_const_mul _ Measurable_one_div_aux] +@@ -323,46 +280,21 @@ lemma integrableOn_JJ1 (n : ℕ) : MeasureTheory.Integrable + · positivity + + lemma integrableOn_JJ2 (n : ℕ) : MeasureTheory.Integrable (Function.uncurry fun z x ↦ +- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1)) +- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1))) := by +- rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Integrable] ++ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * ++ x.2) * z) ^ (n + 1)) ++ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 ++ 1 ×ˢ Set.Ioo 0 1))) := by ++ rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, ++ MeasureTheory.Integrable] + constructor +- · apply AEMeasurable.aestronglyMeasurable +- rw [← aemeasurable_indicator_iff (by measurability)] +- apply AEMeasurable.indicator _ (by measurability) +- apply AEMeasurable.div +- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] +- apply AEMeasurable.mul +- · apply AEMeasurable.mul +- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- apply Finset.aemeasurable_sum +- intro i _ +- apply AEMeasurable.const_mul +- apply AEMeasurable.pow_const (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) _) +- apply AEMeasurable.fst (f := id) aemeasurable_id +- · apply AEMeasurable.pow_const +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- apply AEMeasurable.fst (f := id) aemeasurable_id +- · apply AEMeasurable.pow_const +- apply AEMeasurable.const_sub +- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id) +- · apply AEMeasurable.pow_const +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- apply AEMeasurable.fst (f := id) aemeasurable_id ++ · apply Measurable.aestronglyMeasurable ++ fun_prop + · rw [MeasureTheory.hasFiniteIntegral_iff_norm] + set k := _ + set C := ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + x_1).choose n) + change k < ⊤ +- have : k ≤ ENNReal.ofReal (|C|) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++ have : k ≤ ENNReal.ofReal (|C|) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ ++ Set.Ioo 0 1, + ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by + simp only [k] + rw [← MeasureTheory.lintegral_const_mul _ Measurable_one_div_aux] +@@ -376,7 +308,8 @@ lemma integrableOn_JJ2 (n : ℕ) : MeasureTheory.Integrable (Function.uncurry fu + simp only [Set.mem_prod, Set.mem_Ioo] at hx + rw [← ENNReal.ofReal_mul] + · rw [ENNReal.ofReal_le_ofReal_iff] +- · rw [Function.uncurry_apply_pair, pow_add, ← div_div, abs_div,mul_one_div, div_le_div_iff₀] ++ · rw [Function.uncurry_apply_pair, pow_add, ← div_div, abs_div,mul_one_div, ++ div_le_div_iff₀] + · apply mul_le_mul _ _ (by linarith [pos_aux x hx]) (by positivity) + · rw [← mul_div, mul_assoc, abs_mul, ← mul_one (a := |C|)] + apply mul_le_mul _ _ (by positivity) (by positivity) +@@ -406,16 +339,10 @@ lemma integrableOn_JJ2 (n : ℕ) : MeasureTheory.Integrable (Function.uncurry fu + · linarith + · linarith + · exact ineq +- · rw [div_add_one] ++ · rw [div_add_one (by positivity)] + intro r + rw [_root_.div_eq_zero_iff] at r +- · refine ineq <| r.resolve_right ?_ +- apply mul_ne_zero +- · apply mul_ne_zero <;> linarith +- · linarith +- · apply mul_ne_zero +- · apply mul_ne_zero <;> linarith +- · linarith, abs_div] ++ exact ineq (r.resolve_right (by positivity)), abs_div] + trans |1 - z| + · apply div_le_self (abs_nonneg _) + rw [abs_of_nonneg, le_add_iff_nonneg_left] +@@ -446,46 +373,25 @@ lemma integrableOn_JJ2 (n : ℕ) : MeasureTheory.Integrable (Function.uncurry fu + have h := JENN_eq_triple 0 0 + simp only [pow_zero, mul_one] at h + rw [← h, J_ENN_rr, ← ENNReal.ofReal_mul] +- · simp ++ · finiteness + · positivity + + lemma integrableOn_JJ3 (n : ℕ) : MeasureTheory.Integrable +- (Function.uncurry fun z x ↦ eval x.1 (shiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z)) +- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1))) := by +- rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Integrable] ++ (Function.uncurry fun z x ↦ eval x.1 (aperyShiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / ++ (1 - (1 - x.1 * x.2) * z)) ++ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 ++ 1 ×ˢ Set.Ioo 0 1))) := by ++ rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod, ++ MeasureTheory.Integrable] + constructor +- · apply AEMeasurable.aestronglyMeasurable +- rw [← aemeasurable_indicator_iff (by measurability)] +- apply AEMeasurable.indicator _ (by measurability) +- apply AEMeasurable.div +- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] +- apply AEMeasurable.mul +- · apply AEMeasurable.mul +- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- apply Finset.aemeasurable_sum +- intro i _ +- apply AEMeasurable.const_mul +- apply AEMeasurable.pow_const (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) _) +- apply AEMeasurable.fst (f := id) aemeasurable_id +- · apply AEMeasurable.pow_const +- apply AEMeasurable.const_sub +- apply AEMeasurable.fst (f := id) aemeasurable_id +- · apply AEMeasurable.pow_const +- apply AEMeasurable.const_sub +- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id) +- · apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- apply AEMeasurable.fst (f := id) aemeasurable_id ++ · apply Measurable.aestronglyMeasurable ++ fun_prop + · rw [MeasureTheory.hasFiniteIntegral_iff_norm] + set k := _ + set C := ∑ x_1 ∈ Finset.range (n + 1), (n.choose x_1 : ℝ) * ((n + x_1).choose n) + change k < ⊤ +- have : k ≤ ENNReal.ofReal (|C|) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++ have : k ≤ ENNReal.ofReal (|C|) * ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ ++ Set.Ioo 0 1, + ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1)) := by + simp only [k] + rw [← MeasureTheory.lintegral_const_mul _ Measurable_one_div_aux] +@@ -532,37 +438,78 @@ lemma integrableOn_JJ3 (n : ℕ) : MeasureTheory.Integrable + have h := JENN_eq_triple 0 0 + simp only [pow_zero, mul_one] at h + rw [← h, J_ENN_rr, ← ENNReal.ofReal_mul] +- · simp ++ · finiteness + · positivity + + lemma eq1_integrableOn_aux1 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : MeasureTheory.Integrable +- (fun x ↦ eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) +- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1))) := by ++ (fun x ↦ eval x.1 (aperyShiftedLegendre n) * eval x.2 (aperyShiftedLegendre n) * (1 / (1 - ++ (1 - x.1 * x.2) * z))) ++ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo ++ 0 1))) := by + rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] + apply MeasureTheory.IntegrableOn.integrable + apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) +- apply ContinuousOn.integrableOn_compact +- · simp only [Set.mem_Ioo, Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] +- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] +- apply ContinuousOn.mul +- · apply ContinuousOn.mul +- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- apply continuousOn_finset_sum +- intro i _ +- apply ContinuousOn.mul continuousOn_const +- apply ContinuousOn.pow continuousOn_fst +- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- apply continuousOn_finset_sum +- intro i _ +- apply ContinuousOn.mul continuousOn_const +- apply ContinuousOn.pow continuousOn_snd +- · apply ContinuousOn.div continuousOn_const +- · apply ContinuousOn.sub continuousOn_const ++ · apply ContinuousOn.integrableOn_compact ++ · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] ++ · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one] ++ apply ContinuousOn.mul ++ · apply ContinuousOn.mul ++ · simp only [eval_finsetSum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] ++ apply continuousOn_finsetSum ++ intro i _ ++ apply ContinuousOn.mul continuousOn_const ++ apply ContinuousOn.pow continuousOn_fst ++ · simp only [eval_finsetSum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] ++ apply continuousOn_finsetSum ++ intro i _ ++ apply ContinuousOn.mul continuousOn_const ++ apply ContinuousOn.pow continuousOn_snd ++ · apply ContinuousOn.div continuousOn_const ++ · apply ContinuousOn.sub continuousOn_const ++ apply ContinuousOn.mul _ continuousOn_const ++ apply ContinuousOn.sub continuousOn_const ++ apply ContinuousOn.mul continuousOn_fst continuousOn_snd ++ · intro x hx ++ suffices 1 - (1 - x.1 * x.2) * z > 0 by linarith ++ simp only [Set.mem_prod, Set.mem_Icc] at hx ++ simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ ++ suffices (1 - x.1 * x.2) * z ≤ z by linarith ++ apply mul_le_of_le_one_left (by linarith) ++ simp only [tsub_le_iff_right, le_add_iff_nonneg_right] ++ nlinarith ++ · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self ++ ++lemma eq1_integrableOn_aux2 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : MeasureTheory.Integrable ++ (fun x ↦ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 ++ - x.1 * x.2) * z) ^ (n + 1)) ++ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo ++ 0 1))) := by ++ rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] ++ apply MeasureTheory.IntegrableOn.integrable ++ apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) ++ · apply ContinuousOn.integrableOn_compact ++ · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] ++ · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one] ++ apply ContinuousOn.div ++ · apply ContinuousOn.mul ++ · apply ContinuousOn.mul ++ · simp only [eval_finsetSum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] ++ apply continuousOn_finsetSum ++ intro i _ ++ apply ContinuousOn.mul continuousOn_const ++ apply ContinuousOn.pow continuousOn_fst ++ · apply ContinuousOn.pow ++ apply ContinuousOn.mul _ continuousOn_const ++ apply ContinuousOn.mul continuousOn_fst continuousOn_snd ++ · apply ContinuousOn.pow ++ apply ContinuousOn.sub continuousOn_const continuousOn_snd ++ · apply ContinuousOn.pow ++ apply ContinuousOn.sub continuousOn_const + apply ContinuousOn.mul _ continuousOn_const + apply ContinuousOn.sub continuousOn_const + apply ContinuousOn.mul continuousOn_fst continuousOn_snd + · intro x hx +- suffices 1 - (1 - x.1 * x.2) * z > 0 by linarith ++ suffices 1 - (1 - x.1 * x.2) * z > 0 by positivity + simp only [Set.mem_prod, Set.mem_Icc] at hx + simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ + suffices (1 - x.1 * x.2) * z ≤ z by linarith +@@ -571,88 +518,62 @@ lemma eq1_integrableOn_aux1 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : Measu + nlinarith + · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self + +-lemma eq1_integrableOn_aux2 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : MeasureTheory.Integrable +- (fun x ↦ eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1)) +- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1))) := by +- rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] +- apply MeasureTheory.IntegrableOn.integrable +- apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) +- apply ContinuousOn.integrableOn_compact +- · simp only [Set.mem_Ioo, Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] +- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] +- apply ContinuousOn.div +- · apply ContinuousOn.mul +- · apply ContinuousOn.mul +- · simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- apply continuousOn_finset_sum +- intro i _ +- apply ContinuousOn.mul continuousOn_const +- apply ContinuousOn.pow continuousOn_fst +- · apply ContinuousOn.pow +- apply ContinuousOn.mul _ continuousOn_const +- apply ContinuousOn.mul continuousOn_fst continuousOn_snd +- · apply ContinuousOn.pow +- apply ContinuousOn.sub continuousOn_const continuousOn_snd +- · apply ContinuousOn.pow +- apply ContinuousOn.sub continuousOn_const +- apply ContinuousOn.mul _ continuousOn_const +- apply ContinuousOn.sub continuousOn_const +- apply ContinuousOn.mul continuousOn_fst continuousOn_snd +- · intro x hx +- suffices 1 - (1 - x.1 * x.2) * z > 0 by positivity +- simp only [Set.mem_prod, Set.mem_Icc] at hx +- simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ +- suffices (1 - x.1 * x.2) * z ≤ z by linarith +- apply mul_le_of_le_one_left (by linarith) +- simp only [tsub_le_iff_right, le_add_iff_nonneg_right] +- nlinarith +- · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self +- +-lemma double_integral_eq1 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z)) = ++lemma double_integral_eq1 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ++ ×ˢ Set.Ioo 0 1, ++ eval x.1 (aperyShiftedLegendre n) * eval x.2 (aperyShiftedLegendre n) * (1 / (1 - (1 - x.1 ++ * x.2) * z)) = + ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by ++ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * ++ x.2) * z) ^ (n + 1) := by + calc +- _ = ∫ (x : ℝ) in Set.Ioo 0 1, eval x (shiftedLegendre n) * ∫ (y : ℝ) in Set.Ioo 0 1, +- eval y (shiftedLegendre n) * (1 / (1 - (1 - x * y) * z)) := by ++ _ = ∫ (x : ℝ) in Set.Ioo 0 1, eval x (aperyShiftedLegendre n) * ∫ (y : ℝ) in Set.Ioo 0 1, ++ eval y (aperyShiftedLegendre n) * (1 / (1 - (1 - x * y) * z)) := by + rw [MeasureTheory.Measure.volume_eq_prod, ← MeasureTheory.Measure.prod_restrict, + MeasureTheory.integral_prod] + · apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro x _ + simp only +- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), +- ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), ++ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num), ++ ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num), + ← intervalIntegral.integral_const_mul] + simp only [one_div, ← mul_assoc] + · exact eq1_integrableOn_aux1 n z hz +- _ = ∫ (x : ℝ) in Set.Ioo 0 1, eval x (shiftedLegendre n) * ∫ (y : ℝ) in Set.Ioo 0 1, ++ _ = ∫ (x : ℝ) in Set.Ioo 0 1, eval x (aperyShiftedLegendre n) * ∫ (y : ℝ) in Set.Ioo 0 1, + (x * y * z) ^ n * (1 - y) ^ n / (1 - (1 - x * y) * z) ^ (n + 1) := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro x hx + simp only + congr 1 +- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), +- ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num)] ++ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num), ++ ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num)] + rw [legendre_integral_special n hx hz] + _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by ++ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * ++ x.2) * z) ^ (n + 1) := by + rw [MeasureTheory.Measure.volume_eq_prod, ← MeasureTheory.Measure.prod_restrict, + MeasureTheory.integral_prod] + · apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro x _ + simp only +- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), +- ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), ++ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num), ++ ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num), + ← intervalIntegral.integral_const_mul] + simp only [mul_div, ← mul_assoc] + · exact eq1_integrableOn_aux2 n z hz + +-lemma ineq_aux (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hz : 0 ≤ z ∧ z ≤ 1) : ++lemma ineq_aux (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hz : 0 ≤ z ∧ ++ z ≤ 1) : + 0 ≤ (1 - z) / (1 - (1 - x.1 * x.2) * z) ∧ (1 - z) / (1 - (1 - x.1 * x.2) * z) ≤ 1 := by + constructor + · apply div_nonneg (by linarith) + simp only [sub_nonneg] +- apply mul_le_one₀ _ (by linarith) (by linarith) ++ refine (mul_le_of_le_one_left (by linarith) ?_).trans (by linarith) + simp only [tsub_le_iff_right, le_add_iff_nonneg_right] + nlinarith + · rw [div_le_iff₀] +@@ -670,18 +591,20 @@ lemma ineq_aux (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x. + suffices z * (1 - x.1 * x.2) ≤ (1 - x.1 * x.2) by nlinarith + apply mul_le_of_le_one_left (by nlinarith) hz.2 + +-lemma ineq_aux1 (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hz : 0 ≤ z ∧ z ≤ 1) : ++lemma ineq_aux1 (x : ℝ × ℝ) (z : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hz : 0 ≤ z ++ ∧ z ≤ 1) : + 1 - (1 - x.1 * x.2) * z ≠ 0 := by + suffices (1 - x.1 * x.2) * z < 1 by linarith + rw [mul_comm] + suffices z * (1 - x.1 * x.2) ≤ (1 - x.1 * x.2) by nlinarith + apply mul_le_of_le_one_left (by nlinarith) hz.2 + +-lemma fun_eq_aux (x : ℝ × ℝ) (y : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hy : 0 ≤ y ∧ y ≤ 1) : ++lemma fun_eq_aux (x : ℝ × ℝ) (y : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < x.2 ∧ x.2 < 1) (hy : 0 ≤ y ++ ∧ y ≤ 1) : + deriv (fun z => (1 - z) / (1 - (1 - x.1 * x.2) * z)) y = + (fun z => - x.1 * x.2 / (1 - (1 - x.1 * x.2) * z) ^ 2) y := by +- rw [deriv_div] +- · rw [deriv_const_sub, deriv_const_sub, deriv_const_mul _ differentiableAt_id'] ++ rw [deriv_fun_div] ++ · rw [deriv_const_sub, deriv_const_sub, deriv_const_mul _ differentiableAt_id] + simp only [deriv_id'', neg_mul, one_mul, neg_sub, mul_one] + congr + ring +@@ -689,9 +612,12 @@ lemma fun_eq_aux (x : ℝ × ℝ) (y : ℝ) (hx : (0 < x.1 ∧ x.1 < 1) ∧ 0 < + · apply DifferentiableAt.const_sub (DifferentiableAt.const_mul differentiableAt_id _) + · exact ineq_aux1 x y hx hy + +-lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : ∫ (z : ℝ) in Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) = +- ∫ (z : ℝ) in Set.Ioo 0 1, eval x.1 (shiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) := by ++lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : ∫ (z : ℝ) ++ in Set.Ioo 0 1, ++ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * ++ x.2) * z) ^ (n + 1) = ++ ∫ (z : ℝ) in Set.Ioo 0 1, eval x.1 (aperyShiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / ++ (1 - (1 - x.1 * x.2) * z) := by + rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), + ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num)] + simp only [← mul_div, mul_assoc] +@@ -712,7 +638,7 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × + apply ContinuousOn.mul continuousOn_const continuousOn_id + · intro y hy + simp only [Set.mem_prod, Set.mem_Ioo, zero_le_one, Set.uIcc_of_le, Set.mem_Icc, +- OfNat.ofNat_ne_zero, not_false_eq_true, pow_eq_zero_iff] at hx hy ⊢ ++ ] at hx hy ⊢ + apply pow_ne_zero + exact ineq_aux1 x y hx hy + · intro y hy +@@ -754,7 +680,8 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × + 1 - (1 - y) / (1 - (1 - x.1 * x.2) * y) := by + rw [sub_div, div_self (ineq_aux1 x y hx hy)] + have eq2 : ((1 - (1 - x.1 * x.2) * y) - (1 - x.1 * x.2) * (1 - y)) / +- (1 - (1 - x.1 * x.2) * y) = 1 - (1 - x.1 * x.2) * ((1 - y) / (1 - (1 - x.1 * x.2) * y)) := by ++ (1 - (1 - x.1 * x.2) * y) = 1 - (1 - x.1 * x.2) * ((1 - y) / (1 - (1 - x.1 * x.2) ++ * y)) := by + rw [sub_div, div_self (ineq_aux1 x y hx hy), mul_div] + rw [div_eq_iff] + · rw [← eq1, ← eq2, mul_div, div_eq_div_iff (ineq_aux1 x y hx hy) (ineq_aux1 x y hx hy)] +@@ -774,14 +701,15 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × + · intro y hy + simp only [Set.mem_Icc] at hy + exact ineq_aux1 x y hx hy +- _ = ∫ (y : ℝ) in (0)..1, x.1 * x.2 / (1 - (1 - x.1 * x.2) * y) ^ 2 * (1 - g y) ^ n / (1 - (1 - x.1 * x.2) * g y) := by ++ _ = ∫ (y : ℝ) in (0)..1, x.1 * x.2 / (1 - (1 - x.1 * x.2) * y) ^ 2 * (1 - g y) ^ n / (1 - (1 ++ - x.1 * x.2) * g y) := by + rw [← intervalIntegral.integral_neg] + apply intervalIntegral.integral_congr + intro y hy + simp only [zero_le_one, Set.uIcc_of_le, Set.mem_Icc] at hy ⊢ +- simp only [g, g'] ++ simp only [g] + rw [fun_eq_aux x y hx hy] +- simp [g, g', neg_div] ++ ring + _ = ∫ (y : ℝ) in (0)..1, (x.1 * x.2 * y) ^ n / (1 - (1 - x.1 * x.2) * y) ^ (n + 1) := by + apply intervalIntegral.integral_congr + intro y hy +@@ -795,7 +723,7 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × + rw [div_mul_eq_mul_div, div_div, div_eq_div_iff] + · simp only [← eq1, sub_sub_sub_cancel_left, div_pow, ← eq2, g] + rw [mul_div, mul_comm, mul_div, mul_div, mul_div, div_eq_div_iff] +- ring ++ · ring + · apply pow_ne_zero + exact ineq_aux1 x y hx hy + · exact ineq_aux1 x y hx hy +@@ -812,39 +740,43 @@ lemma double_integral_eq2 (n : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 × + exact ineq_aux1 x y hx hy + + lemma eq3_integrableOn_aux (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : +- MeasureTheory.Integrable (fun x ↦ eval x.1 (shiftedLegendre n) * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z)) +- ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo 0 1))) := by ++ MeasureTheory.Integrable (fun x ↦ eval x.1 (aperyShiftedLegendre n) * (1 - x.2) ^ n / (1 - ++ (1 - x.1 * x.2) * z)) ++ ((MeasureTheory.volume.restrict (Set.Ioo 0 1)).prod (MeasureTheory.volume.restrict (Set.Ioo ++ 0 1))) := by + rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] + apply MeasureTheory.IntegrableOn.integrable + apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) +- apply ContinuousOn.integrableOn_compact +- · simp only [Set.mem_Ioo, Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] +- · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one, smul_eq_mul] +- apply ContinuousOn.div +- · apply ContinuousOn.mul +- simp only [eval_finset_sum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] +- apply continuousOn_finset_sum +- intro i _ +- apply ContinuousOn.mul continuousOn_const +- apply ContinuousOn.pow continuousOn_fst +- apply ContinuousOn.pow (ContinuousOn.sub continuousOn_const continuousOn_snd) +- · apply ContinuousOn.sub continuousOn_const +- apply ContinuousOn.mul _ continuousOn_const +- apply ContinuousOn.sub continuousOn_const +- apply ContinuousOn.mul continuousOn_fst continuousOn_snd +- · intro x hx +- suffices 1 - (1 - x.1 * x.2) * z > 0 by linarith +- simp only [Set.mem_prod, Set.mem_Icc] at hx +- simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ +- suffices (1 - x.1 * x.2) * z ≤ z by linarith +- apply mul_le_of_le_one_left (by linarith) +- simp only [tsub_le_iff_right, le_add_iff_nonneg_right] +- nlinarith ++ · apply ContinuousOn.integrableOn_compact ++ · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one,isCompact_Icc] ++ · simp only [shiftedLegendre_eq_sum, map_pow, map_neg, map_one] ++ apply ContinuousOn.div ++ · apply ContinuousOn.mul ++ · simp only [eval_finsetSum, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_X] ++ apply continuousOn_finsetSum ++ intro i _ ++ apply ContinuousOn.mul continuousOn_const ++ apply ContinuousOn.pow continuousOn_fst ++ · apply ContinuousOn.pow (ContinuousOn.sub continuousOn_const continuousOn_snd) ++ · apply ContinuousOn.sub continuousOn_const ++ apply ContinuousOn.mul _ continuousOn_const ++ apply ContinuousOn.sub continuousOn_const ++ apply ContinuousOn.mul continuousOn_fst continuousOn_snd ++ · intro x hx ++ suffices 1 - (1 - x.1 * x.2) * z > 0 by linarith ++ simp only [Set.mem_prod, Set.mem_Icc] at hx ++ simp only [Set.mem_Ioo, gt_iff_lt, sub_pos] at hz ⊢ ++ suffices (1 - x.1 * x.2) * z ≤ z by linarith ++ apply mul_le_of_le_one_left (by linarith) ++ simp only [tsub_le_iff_right, le_add_iff_nonneg_right] ++ nlinarith + · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self + +-lemma double_integral_eq3 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++lemma double_integral_eq3 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ++ ×ˢ Set.Ioo 0 1, + (x.1 * x.2 * z * (1 - x.1) * (1 - x.2)) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) = +- ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, eval x.1 (shiftedLegendre n) * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) := by ++ ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, eval x.1 (aperyShiftedLegendre n) * (1 - x.2) ++ ^ n / (1 - (1 - x.1 * x.2) * z) := by + symm + rw [MeasureTheory.Measure.volume_eq_prod, ← MeasureTheory.Measure.prod_restrict, + MeasureTheory.integral_prod, MeasureTheory.integral_integral_swap] +@@ -852,25 +784,30 @@ lemma double_integral_eq3 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x + simp only + calc + _ = ∫ (y : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * ∫ (x : ℝ) in Set.Ioo 0 1, +- eval x (shiftedLegendre n) / (1 - (1 - x * y) * z) := by ++ eval x (aperyShiftedLegendre n) / (1 - (1 - x * y) * z) := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro y hy +- simp at hy ⊢ +- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), +- ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num), ++ simp only at hy ⊢ ++ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num), ++ ← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num), + ← intervalIntegral.integral_const_mul] + simp [mul_div, mul_comm] +- _ = ∫ (y : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * ∫ (x : ℝ) in (0)..1, (y * x * z) ^ n * (1 - x) ^ n / (1 - (1 - y * x) * z) ^ (n + 1) := by ++ _ = ∫ (y : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * ∫ (x : ℝ) in (0)..1, (y * x * z) ^ n * (1 - x) ++ ^ n / (1 - (1 - y * x) * z) ^ (n + 1) := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro y hy + simp only + congr 1 +- rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by norm_num)] ++ rw [← MeasureTheory.integral_Ioc_eq_integral_Ioo, ← intervalIntegral.integral_of_le (by ++ norm_num)] + have := legendre_integral_special n hy hz + simp only [mul_one_div] at this + simp only [← this] + simp only [mul_comm] +- _ = ∫ (y : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * (y * x * z) ^ n * (1 - x) ^ n / (1 - (1 - y * x) * z) ^ (n + 1) := by ++ _ = ∫ (y : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ) in Set.Ioo 0 1, (1 - y) ^ n * (y * x * z) ^ n * (1 ++ - x) ^ n / (1 - (1 - y * x) * z) ^ (n + 1) := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro y _ + simp only +@@ -885,26 +822,26 @@ lemma double_integral_eq3 (n : ℕ) (z : ℝ) (hz : z ∈ Set.Ioo 0 1) : ∫ (x + · rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] + apply MeasureTheory.IntegrableOn.integrable + apply MeasureTheory.IntegrableOn.mono_set (t := Set.Icc 0 1 ×ˢ Set.Icc 0 1) +- apply ContinuousOn.integrableOn_compact +- · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one, isCompact_Icc] +- · apply ContinuousOn.div +- · apply ContinuousOn.pow +- apply ContinuousOn.mul _ (ContinuousOn.sub continuousOn_const continuousOn_snd) +- apply ContinuousOn.mul _ (ContinuousOn.sub continuousOn_const continuousOn_fst) +- apply ContinuousOn.mul _ continuousOn_const +- apply ContinuousOn.mul continuousOn_fst continuousOn_snd +- · apply ContinuousOn.pow +- apply ContinuousOn.sub continuousOn_const _ +- apply ContinuousOn.mul _ continuousOn_const +- apply ContinuousOn.sub continuousOn_const _ +- apply ContinuousOn.mul continuousOn_fst continuousOn_snd +- · intro x hx +- simp only [Set.mem_prod, Set.mem_Icc, Set.mem_Ioo] at hx hz +- apply pow_ne_zero +- suffices (1 - x.1 * x.2) * z ≤ z by linarith +- apply mul_le_of_le_one_left (by linarith) +- simp only [tsub_le_iff_right, le_add_iff_nonneg_right] +- nlinarith ++ · apply ContinuousOn.integrableOn_compact ++ · simp only [Set.Icc_prod_Icc, Prod.mk_zero_zero, Prod.mk_one_one, isCompact_Icc] ++ · apply ContinuousOn.div ++ · apply ContinuousOn.pow ++ apply ContinuousOn.mul _ (ContinuousOn.sub continuousOn_const continuousOn_snd) ++ apply ContinuousOn.mul _ (ContinuousOn.sub continuousOn_const continuousOn_fst) ++ apply ContinuousOn.mul _ continuousOn_const ++ apply ContinuousOn.mul continuousOn_fst continuousOn_snd ++ · apply ContinuousOn.pow ++ apply ContinuousOn.sub continuousOn_const _ ++ apply ContinuousOn.mul _ continuousOn_const ++ apply ContinuousOn.sub continuousOn_const _ ++ apply ContinuousOn.mul continuousOn_fst continuousOn_snd ++ · intro x hx ++ simp only [Set.mem_prod, Set.mem_Icc, Set.mem_Ioo] at hx hz ++ apply pow_ne_zero ++ suffices (1 - x.1 * x.2) * z ≤ z by linarith ++ apply mul_le_of_le_one_left (by linarith) ++ simp only [tsub_le_iff_right, le_add_iff_nonneg_right] ++ nlinarith + · apply Set.prod_mono Set.Ioo_subset_Icc_self Set.Ioo_subset_Icc_self + · exact eq3_integrableOn_aux n z hz + · exact eq3_integrableOn_aux n z hz +@@ -913,35 +850,42 @@ theorem JJ_eq_form (n : ℕ) : JJ n = JJ' n := by + simp only [JJ, JJ'] + calc + _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- (∫ (z : ℝ) in Set.Ioo 0 1, eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) := by ++ (∫ (z : ℝ) in Set.Ioo 0 1, eval x.1 (aperyShiftedLegendre n) * eval x.2 ++ (aperyShiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z))) := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro x hx + simp only [Set.mem_prod, Set.mem_Ioo] at hx ⊢ + rw [mul_assoc, mul_comm, ← integral1, ← MeasureTheory.integral_Ioc_eq_integral_Ioo, +- ← intervalIntegral.integral_of_le (by norm_num), intervalIntegral.integral_const_mul] <;> nlinarith ++ ← intervalIntegral.integral_of_le (by norm_num), intervalIntegral.integral_const_mul] <;> ++ nlinarith + _ = ∫ (z : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * eval x.2 (shiftedLegendre n) * (1 / (1 - (1 - x.1 * x.2) * z)) := by ++ eval x.1 (aperyShiftedLegendre n) * eval x.2 (aperyShiftedLegendre n) * (1 / (1 - (1 - x.1 ++ * x.2) * z)) := by + symm + rw [MeasureTheory.integral_integral_swap] + exact integrableOn_JJ1 n + _ = ∫ (z : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by ++ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * ++ x.2) * z) ^ (n + 1) := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro z hz + simp only + exact double_integral_eq1 n z hz + _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ∫ (z : ℝ) in Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by ++ eval x.1 (aperyShiftedLegendre n) * (x.1 * x.2 * z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * ++ x.2) * z) ^ (n + 1) := by + rw [MeasureTheory.integral_integral_swap] + exact integrableOn_JJ2 n + _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ∫ (z : ℝ) in Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) := by ++ eval x.1 (aperyShiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ++ := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro x hx + simp only + exact double_integral_eq2 n x hx + _ = ∫ (z : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- eval x.1 (shiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) := by ++ eval x.1 (aperyShiftedLegendre n) * (1 - z) ^ n * (1 - x.2) ^ n / (1 - (1 - x.1 * x.2) * z) ++ := by + symm + rw [MeasureTheory.integral_integral_swap] + exact integrableOn_JJ3 n +@@ -957,7 +901,8 @@ theorem JJ_eq_form (n : ℕ) : JJ n = JJ' n := by + rw [smul_eq_mul] + ring + _ = ∫ (z : ℝ) in Set.Ioo 0 1, ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- (x.1 * x.2 * z * (1 - x.1) * (1 - x.2) * (1 - z)) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) := by ++ (x.1 * x.2 * z * (1 - x.1) * (1 - x.2) * (1 - z)) ^ n / (1 - (1 - x.1 * x.2) * z) ^ (n + 1) ++ := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro z hz + simp only +@@ -968,7 +913,8 @@ theorem JJ_eq_form (n : ℕ) : JJ n = JJ' n := by + rw [smul_eq_mul, mul_comm, mul_div, ← mul_pow] + ring + _ = ∫ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, +- (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / (1 - (1 - x.2.1 * x.2.2) * x.1)) ^ n / ++ (x.2.1 * (1 - x.2.1) * x.2.2 * (1 - x.2.2) * x.1 * (1 - x.1) / (1 - (1 - x.2.1 * x.2.2) * ++ x.1)) ^ n / + (1 - (1 - x.2.1 * x.2.2) * x.1) := by + symm + rw [MeasureTheory.Measure.volume_eq_prod, ← MeasureTheory.Measure.prod_restrict, +@@ -992,38 +938,16 @@ theorem JJ_pos (n : ℕ) : 0 < JJ n := by + have subset : Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ⊆ Function.support F := by + intro a ha + change F a ≠ 0 +- simp only [div_pow, ne_eq, _root_.div_eq_zero_iff, pow_eq_zero_iff', mul_eq_zero, not_or, +- not_and, Decidable.not_not, F] ++ have hden := pos_aux a (by simpa only [Set.mem_prod, Set.mem_Ioo] using ha) + simp only [Set.mem_prod, Set.mem_Ioo] at ha + rcases ha with ⟨⟨hx0, hx1⟩, ⟨hy0, hy1⟩, hz0, hz1⟩ +- constructor +- · constructor +- · intro h +- rcases h with (h | h); swap; nlinarith +- rcases h with (h | h); swap; nlinarith +- rcases h with (h | h); swap; nlinarith +- rcases h with (h | h); swap; nlinarith +- rcases h with (h | h) <;> nlinarith +- · intro h +- suffices ¬1 - (1 - a.2.1 * a.2.2) * a.1 = 0 by tauto +- suffices 1 - (1 - a.2.1 * a.2.2) * a.1 > 0 by linarith +- simp only [gt_iff_lt, sub_pos] +- suffices (1 - a.2.1 * a.2.2) * a.1 < a.1 by linarith +- rw [mul_lt_iff_lt_one_left] +- · simp only [sub_lt_self_iff] +- nlinarith +- · exact hx0 +- · suffices 1 - (1 - a.2.1 * a.2.2) * a.1 > 0 by linarith +- simp only [gt_iff_lt, sub_pos] +- suffices (1 - a.2.1 * a.2.2) * a.1 < a.1 by linarith +- rw [mul_lt_iff_lt_one_left] +- · simp only [sub_lt_self_iff] +- nlinarith +- · exact hx0 ++ apply ne_of_gt ++ dsimp only [F] ++ positivity + rw [MeasureTheory.Measure.restrict_apply'] +- rw [Set.inter_eq_right.2 subset] +- simp only [MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Measure.prod_prod] +- simp only [Real.volume_Ioo, sub_zero, ENNReal.ofReal_one, mul_one, zero_lt_one] ++ · rw [Set.inter_eq_right.2 subset] ++ simp only [MeasureTheory.Measure.volume_eq_prod, MeasureTheory.Measure.prod_prod] ++ simp only [Real.volume_Ioo, sub_zero, ENNReal.ofReal_one, mul_one, zero_lt_one] + · measurability + · apply MeasureTheory.ae_nonneg_restrict_of_forall_setIntegral_nonneg_inter + · rw [MeasureTheory.IntegrableOn] +@@ -1041,10 +965,10 @@ theorem JJ_pos (n : ℕ) : 0 < JJ n := by + apply mul_nonneg _ (by linarith) + apply mul_nonneg _ (by linarith) + apply mul_nonneg (by linarith) (by linarith) +- · simp only [abs_eq_self, sub_nonneg] +- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) +- · simp only [abs_eq_self, sub_nonneg] +- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) ++ · simp only [sub_nonneg] ++ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) ++ · simp only [sub_nonneg] ++ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) + · rw [Set.mem_inter_iff] at hx + tauto + · exact integrableOn_JJ' n +@@ -1078,12 +1002,13 @@ lemma Summable_of_zeta_two' : Summable (fun (n : ℕ) ↦ 1 / ((n : ℝ) + 1) ^ + exact h + + lemma zeta_3_pos : 0 < ∑' (n : ℕ), 1 / ((n : ℝ) + 1) ^ 3 := by +- apply tsum_pos (ι := ℕ) (g := fun n => 1 / ((n : ℝ) + 1) ^ 3) (i := 1) ++ apply Summable.tsum_pos (ι := ℕ) (g := fun n => 1 / ((n : ℝ) + 1) ^ 3) (i := 1) + · apply summable_of_sum_range_le (c := Real.pi ^ 2 / 6) + · intro _ + positivity + · intro n +- suffices ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 3 ≤ ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 2 by ++ suffices ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 3 ≤ ++ ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 2 by + have : ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 2 ≤ Real.pi ^ 2 / 6 := by + suffices ∑ i ∈ Finset.range n, 1 / ((i : ℝ) + 1) ^ 2 ≤ ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 2 by + have h : ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 2 = (riemannZeta 2).re := by +@@ -1092,10 +1017,10 @@ lemma zeta_3_pos : 0 < ∑' (n : ℕ), 1 / ((n : ℝ) + 1) ^ 3 := by + norm_cast + rw [h, riemannZeta_two] at this + norm_cast at * +- apply sum_le_tsum (s := Finset.range n) +- intro i _ +- positivity +- exact Summable_of_zeta_two' ++ apply Summable.sum_le_tsum (s := Finset.range n) ++ · intro i _ ++ positivity ++ · exact Summable_of_zeta_two' + linarith + apply Finset.sum_le_sum + intro i _ +@@ -1104,7 +1029,7 @@ lemma zeta_3_pos : 0 < ∑' (n : ℕ), 1 / ((n : ℝ) + 1) ^ 3 := by + · positivity + · positivity + · intro m +- simp only [one_div, pow_succ, add_comm, add_left_comm] ++ simp only [one_div, pow_succ] + positivity + · positivity + +@@ -1133,45 +1058,18 @@ theorem JJ_upper (n : ℕ) : JJ n ≤ 2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n + apply mul_nonneg _ (by linarith) + apply mul_nonneg _ (by linarith) + apply mul_nonneg (by linarith) (by linarith) +- · simp only [abs_eq_self, sub_nonneg] +- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) +- · simp only [abs_eq_self, sub_nonneg] +- apply mul_le_one₀ (by nlinarith) (by linarith) (by linarith) ++ · simp only [sub_nonneg] ++ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) ++ · simp only [sub_nonneg] ++ exact (mul_le_of_le_one_left (by linarith) (by nlinarith)).trans (by linarith) + · rw [Set.mem_inter_iff] at hx + tauto +- · apply AEMeasurable.aestronglyMeasurable +- rw [← aemeasurable_indicator_iff (by measurability)] +- apply AEMeasurable.indicator _ (by measurability) +- apply AEMeasurable.div +- · apply AEMeasurable.pow_const +- apply AEMeasurable.div +- · apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.fst (f := id) aemeasurable_id) _) +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) _) +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- apply AEMeasurable.mul _ (AEMeasurable.const_sub (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) _) +- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) +- · apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) +- · apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- (AEMeasurable.snd (f := id) aemeasurable_id)) +- exact (AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- (AEMeasurable.fst (f := id) aemeasurable_id)) ++ · apply Measurable.aestronglyMeasurable ++ fun_prop + + lemma zeta3_le_zeta2 : ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 < ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 2 := by +- apply tsum_lt_tsum_of_nonneg (f := fun n => 1 / ((n : ℝ) + 1) ^ 3) (g := fun n => 1 / ((n : ℝ) + 1) ^ 2) (i := 2) ++ apply Summable.tsum_lt_tsum_of_nonneg (f := fun n => 1 / ((n : ℝ) + 1) ^ 3) ++ (g := fun n => 1 / ((n : ℝ) + 1) ^ 2) (i := 2) + · intro n + positivity + · intro n +@@ -1182,9 +1080,10 @@ lemma zeta3_le_zeta2 : ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 < ∑' n : ℕ , 1 + · norm_num + · exact Summable_of_zeta_two' + +-lemma ε_N_def_of_pi_alt : ∀ ε > (0 : ℝ), ∃ N : ℕ, ∀ n : ℕ, n ≥ N → n.primeCounting ≤ (1 + ε) * (n : ℝ) / (n : ℝ).log := by ++lemma ε_N_def_of_pi_alt : ∀ ε > (0 : ℝ), ∃ N : ℕ, ∀ n : ℕ, ++ n ≥ N → n.primeCounting ≤ (1 + ε) * (n : ℝ) / (n : ℝ).log := by + intro ε hε +- obtain ⟨c,⟨hc0, hc1⟩⟩ := pi_alt ++ obtain ⟨c,⟨hc0, hc1⟩⟩ := AperyPNT.pi_alt + rw [Asymptotics.isLittleO_const_iff (by simp), tendsto_atTop_nhds] at hc0 + specialize hc0 (Set.Ioo (-ε) ε) (by simp only [Set.mem_Ioo, Left.neg_neg_iff, hε, and_self]) + (by exact isOpen_Ioo) +@@ -1193,26 +1092,27 @@ lemma ε_N_def_of_pi_alt : ∀ ε > (0 : ℝ), ∃ N : ℕ, ∀ n : ℕ, n ≥ N + intro n hn + have hn' : n ≥ N := by + trans (⌈N⌉₊ : ℝ) +- norm_cast +- linarith +- exact Nat.le_ceil N ++ · norm_cast ++ linarith ++ · exact Nat.le_ceil N + specialize hN n hn' + specialize hc1 n + simp only [Nat.floor_natCast] at hc1 + simp only [Set.mem_Ioo] at hN +- rw [hc1, ← mul_div, ← mul_div, mul_le_mul_right] +- linarith +- apply div_pos +- norm_cast +- omega +- apply Real.log_pos +- norm_cast +- omega ++ rw [hc1, ← mul_div, ← mul_div, mul_le_mul_iff_of_pos_right] ++ · linarith ++ · apply div_pos ++ · norm_cast ++ omega ++ · apply Real.log_pos ++ norm_cast ++ omega + + lemma eventuallyN_of_le : ∃ N : ℕ, ∀ n : ℕ, n ≥ N → ↑(d (Finset.Icc 1 n)) ^ 3 ≤ (21 : ℝ) ^ n := by + have h1 : (Real.exp 1) ^ 3 < (21 : ℝ) := by + suffices (2.7182818286) ^ 3 < (21 : ℝ) by +- exact pow_lt_pow_left₀ Real.exp_one_lt_d9 (n := 3) (by linarith [Real.exp_pos 1]) (by simp) |>.trans this ++ exact pow_lt_pow_left₀ Real.exp_one_lt_d9 (n := 3) ++ (by linarith [Real.exp_pos 1]) (by simp) |>.trans this + norm_num + have h : Real.log (21 ^ (1 / 3 : ℝ)) - 1 > 0 := by + simp only [gt_iff_lt, sub_pos] +@@ -1232,13 +1132,14 @@ lemma eventuallyN_of_le : ∃ N : ℕ, ∀ n : ℕ, n ≥ N → ↑(d (Finset.Ic + _ ≤ (n ^ (1 / 3 * Real.log 21 * ↑n / Real.log ↑n)) ^ 3 := by + apply pow_le_pow_left₀ (by simp) + rw [← Real.rpow_natCast, Real.rpow_le_rpow_left_iff] +- exact hN +- simp only [Nat.one_lt_cast] +- omega ++ · exact hN ++ · simp only [Nat.one_lt_cast] ++ omega + _ ≤ (21 : ℝ) ^ n := by + rw [← Real.rpow_natCast, ← Real.rpow_mul (by simp), mul_comm] + nth_rewrite 1 [← Real.exp_log (x := n) (by simp only [Nat.cast_pos]; omega)] +- have h2 : Real.log ↑n * (↑3 * (1 / 3 * Real.log 21 * ↑n / Real.log ↑n)) = Real.log 21 * ↑n := by ++ have h2 : Real.log ↑n * (↑3 * (1 / 3 * Real.log 21 * ↑n / Real.log ↑n)) = ++ Real.log 21 * ↑n := by + rw [← mul_assoc, mul_div, ← mul_assoc, ← mul_assoc] + simp only [one_div, isUnit_iff_ne_zero, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, + IsUnit.mul_inv_cancel_right] +@@ -1249,10 +1150,12 @@ lemma eventuallyN_of_le : ∃ N : ℕ, ∀ n : ℕ, n ≥ N → ↑(d (Finset.Ic + constructor <;> omega + rw [← Real.exp_one_rpow, ← Real.rpow_mul (by exact Real.exp_nonneg 1)] + norm_cast +- rw [h2, Real.rpow_mul (by exact Real.exp_nonneg 1), Real.exp_one_rpow, Real.exp_log (by norm_num)] ++ rw [h2, Real.rpow_mul (by exact Real.exp_nonneg 1), Real.exp_one_rpow, ++ Real.exp_log (by norm_num)] + norm_cast + +-theorem fun1_tendsto_zero : Filter.Tendsto (fun n ↦ ENNReal.ofReal (fun1 n)) Filter.atTop (nhds 0) := by ++theorem fun1_tendsto_zero : Filter.Tendsto (fun n ↦ ENNReal.ofReal (fun1 n)) Filter.atTop (nhds ++ 0) := by + rw [ENNReal.tendsto_atTop_zero] + intro ε hε + if h : ε = ⊤ then simp [h] +@@ -1270,13 +1173,13 @@ theorem fun1_tendsto_zero : Filter.Tendsto (fun n ↦ ENNReal.ofReal (fun1 n)) F + use N.max N1 + intro n hn + rw [ENNReal.ofReal_le_ofReal_iff (by simp)] +- suffices ↑(d (Finset.Icc 1 n)) ^ 3 * 2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 ≤ ε.toReal by ++ suffices ↑(d (Finset.Icc 1 n)) ^ 3 * 2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 ≤ ++ ε.toReal by + trans ↑(d (Finset.Icc 1 n)) ^ 3 * 2 * (1 / 24) ^ n * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 +- swap +- exact this +- rw [mul_assoc, mul_assoc] +- apply mul_le_mul_of_nonneg_left _ (by simp) +- linarith [JJ_upper n] ++ · rw [mul_assoc, mul_assoc] ++ apply mul_le_mul_of_nonneg_left _ (by simp) ++ linarith [JJ_upper n] ++ · exact this + calc + _ ≤ 2 * (21 / 24 : ℝ) ^ n * (∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3) := by + apply mul_le_mul_of_nonneg_right _ (by linarith[zeta_3_pos]) +@@ -1287,7 +1190,8 @@ theorem fun1_tendsto_zero : Filter.Tendsto (fun n ↦ ENNReal.ofReal (fun1 n)) F + exact hN n (le_of_max_le_left hn) + _ ≤ ε.toReal := by + specialize hN1 n (le_of_max_le_right hn) +- rw [← ENNReal.ofReal_toReal_eq_iff.2 h, ← ENNReal.ofReal_div_of_pos (by linarith [zeta_3_pos]), ++ rw [← ENNReal.ofReal_toReal_eq_iff.2 h, ← ENNReal.ofReal_div_of_pos (by linarith ++ [zeta_3_pos]), + ← ENNReal.ofReal_pow (by norm_num), ENNReal.ofReal_le_ofReal_iff] at hN1 + · rw [le_div_iff₀ (by linarith [zeta_3_pos])] at hN1 + linarith +@@ -1301,7 +1205,7 @@ theorem zeta_3_irratoinal : ¬ ∃ r : ℚ , r = riemannZeta 3 := by + norm_cast + simp_rw [Nat.cast_pow, Nat.cast_add, Nat.cast_one] + by_contra! r +- cases' r with r hr ++ obtain ⟨r, hr⟩ := r + let q := r.den + let hq := Rat.den_nz r + have prop1 := ENNReal.Tendsto.mul_const (b := (q : ENNReal)) (fun1_tendsto_zero) (by simp) +@@ -1324,21 +1228,18 @@ theorem zeta_3_irratoinal : ¬ ∃ r : ℚ , r = riemannZeta 3 := by + norm_cast at this ⊢ + rw [ENNReal.tendsto_atTop_zero] at prop1 + specialize prop1 (1/2) (by simp) +- simp only [one_div, Ico_mem_nhds_iff, Set.mem_Ioo, inv_pos, Nat.ofNat_pos, and_true, Set.mem_Ico, +- Filter.eventually_top] at prop1 ++ simp only [one_div] at prop1 + rw [← one_div] at prop1 +- simp only [Filter.eventually_atTop, ge_iff_le] at prop1 +- cases' prop1 with a ha ++ simp only [ge_iff_le] at prop1 ++ obtain ⟨a, ha⟩ := prop1 + specialize prop2 (a + 1) + specialize ha (a + 1) (by simp) + rw [gt_iff_lt, ← ENNReal.ofReal_lt_ofReal_iff, ENNReal.ofReal_mul' (by simp)] at prop2 +- · suffices ENNReal.ofReal (fun1 (a + 1)) * ↑q < ENNReal.ofReal (fun1 (a + 1)) * ↑q by +- simp only [mul_neg, eval_mul, one_div, eval_C, Function.iterate_succ, Function.comp_apply, +- derivative_mul, derivative_X_pow, Nat.cast_add, Nat.cast_one, map_add, map_natCast, map_one, +- add_tsub_cancel_right, iterate_map_add, eval_add, lt_self_iff_false] at this +- rw [show ENNReal.ofReal ↑q = (q : ENNReal) by simp only [ENNReal.ofReal_natCast], +- show ENNReal.ofReal (1 / 2) = 1 / 2 by rw [ENNReal.ofReal_div_of_pos (by norm_num)]; simp] at prop2 +- apply LE.le.trans_lt (b := (1 / 2 : ENNReal)) ha prop2 ++ · have hhalf : ENNReal.ofReal (1 / 2 : ℝ) = (1 / 2 : ENNReal) := by ++ rw [ENNReal.ofReal_div_of_pos (by norm_num)] ++ simp ++ rw [ENNReal.ofReal_natCast, hhalf] at prop2 ++ exact not_lt_of_ge ha prop2 + · apply mul_pos _ (by simp; omega) + apply mul_pos _ (JJ_pos (a + 1)) + apply pow_pos +diff --git a/Zeta3Irrational/Bound.lean b/Zeta3Irrational/Bound.lean +index 56b2726..bb10351 100644 +--- a/Zeta3Irrational/Bound.lean ++++ b/Zeta3Irrational/Bound.lean +@@ -1,12 +1,15 @@ + import Mathlib.Analysis.RCLike.Basic +-import Mathlib.Data.Real.StarOrdered ++import Mathlib.Analysis.Real.Sqrt ++ ++/-! Elementary bounds for the Apéry integral, ported from the Apache-2.0 proof by ++Junqi Liu and Jujian Zhang. -/ + + open scoped Nat + open BigOperators + + lemma max_value {x : ℝ} (x0 : 0 < x) (x1 : x < 1) : √x * √(1 - x) ≤ ((1 / 2) : ℝ) := by + rw [← Real.sqrt_mul, le_div_iff₀, ← show √4 = 2 by rw [Real.sqrt_eq_iff_eq_sq] <;> linarith, +- ← Real.sqrt_mul, Real.sqrt_le_one, show x * (1 - x) * 4= 1 - (2 * x - 1)^2 by ring] <;> ++ ← Real.sqrt_mul, Real.sqrt_le_one, show x * (1 - x) * 4 = 1 - (2 * x - 1) ^ 2 by ring] <;> + nlinarith [mul_self_nonneg (2 * x - 1)] + + lemma max_value' {x : ℝ} (x0 : 0 < x) (x1 : x < 1) : √x * (1 - x) ≤ ((2 / 5) : ℝ) := by +@@ -22,7 +25,7 @@ lemma max_value' {x : ℝ} (x0 : 0 < x) (x1 : x < 1) : √x * (1 - x) ≤ ((2 / + _ ≤ ((2 / 5) : ℝ) := by + rw [Real.sqrt_le_left] <;> norm_num + +-lemma nonneg {x : ℝ} (_ : 0 < x) (_ : x < 1) : (0 : ℝ) ≤ √x * √(1 -x) := ++lemma nonneg {x : ℝ} (_ : 0 < x) (_ : x < 1) : (0 : ℝ) ≤ √x * √(1 - x) := + mul_nonneg (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) + + lemma bound_aux (x z : ℝ) (x0 : 0 < x) (x1 : x < 1) (z0 : 0 < z) (_ : z < 1) : +@@ -36,8 +39,9 @@ lemma bound_aux (x z : ℝ) (x0 : 0 < x) (x1 : x < 1) (z0 : 0 < z) (_ : z < 1) : + _ = √(1 - x) * √(1 - x) + √(x * z) * √(x * z) := by ring + _ = 1 - x + x * z := by rw [Real.mul_self_sqrt, Real.mul_self_sqrt] <;> linarith + +-lemma bound (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z0 : 0 < z) (z1 : z < 1) : +- x * (1 -x) * y * (1 - y) * z * (1 - z) / ((1 - (1 - z) * x) * (1 - y * z)) < (1 / 30 : ℝ) := by ++lemma bound (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) ++ (z0 : 0 < z) (z1 : z < 1) : ++ x * (1 - x) * y * (1 - y) * z * (1 - z) / ((1 - (1 - z) * x) * (1 - y * z)) < (1 / 30 : ℝ) := by + have := mul_pos x0 z0 + have h1 : 2 * √(1 - x) * √(x * z) ≤ 1 - (1 - z) * x := by apply bound_aux <;> assumption + have h2 : 2 * √(1 - y) * √((1 - z) * y) ≤ 1 - y * z := by +@@ -52,22 +56,24 @@ lemma bound (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z + have : 0 ≤ x.sqrt * (1 - x).sqrt := nonneg (by assumption) (by linarith) + have : 0 ≤ y.sqrt * (1 - y).sqrt := nonneg (by assumption) (by linarith) + calc +- _ ≤ x * (1 -x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - x) * √(x * z) * (1 - y * z)) := by ++ _ ≤ x * (1 - x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - x) * √(x * z) * (1 - y * z)) := by + refine div_le_div₀ (by positivity) (le_refl _) (by positivity) ?_ + rwa [mul_le_mul_iff_of_pos_right] + linarith +- _ ≤ x * (1 -x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - x) * √(x * z) * 2 * √(1 - y) * √((1 - z) * y)) := by ++ _ ≤ x * (1 - x) * y * (1 - y) * z * (1 - z) / ++ (2 * √(1 - x) * √(x * z) * 2 * √(1 - y) * √((1 - z) * y)) := by + refine div_le_div₀ (by positivity) (le_refl _) (by positivity) ?_ + rw [mul_assoc, mul_assoc] + rw [mul_assoc] at h2 + exact mul_le_mul_of_nonneg_left h2 (le_of_lt <| by positivity) +- _ = √x * √(1 -x) * (√y * √(1 - y)) * (√z * √(1 - z)) / 4 := by +- rw [Real.sqrt_mul, Real.sqrt_mul] +- calc _ +- _ = ((x * (1 - x)) * (y * (1 - y)) * (z * (1 - z))) / (4 * (√x * √(1 - x)) * (√y * √(1 - y)) * (√z * √(1 - z))) := by ring +- _ = (x / √x) * ((1 - x) / √(1 - x)) * (y / √y) * ((1 - y) / √(1 -y)) * (z / √z) * ((1 - z) / √(1 - z)) / 4 := by ring ++ _ = √x * √(1 - x) * (√y * √(1 - y)) * (√z * √(1 - z)) / 4 := by ++ rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity)] ++ calc ++ _ = ((x * (1 - x)) * (y * (1 - y)) * (z * (1 - z))) / ++ (4 * (√x * √(1 - x)) * (√y * √(1 - y)) * (√z * √(1 - z))) := by ring ++ _ = (x / √x) * ((1 - x) / √(1 - x)) * (y / √y) * ++ ((1 - y) / √(1 - y)) * (z / √z) * ((1 - z) / √(1 - z)) / 4 := by ring + _ = _ := by simpa only [Real.div_sqrt] using (by ring) +- all_goals linarith + _ ≤ (1 / 2) * (1 / 2) * (1 / 2) / 4 := by + refine div_le_div₀ (by norm_num) + (mul_le_mul_of_nonneg (mul_le_mul_of_nonneg (max_value ?_ ?_) (max_value ?_ ?_) ?_ ?_) +@@ -75,7 +81,8 @@ lemma bound (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z + linarith + _ < (1 / 30 : ℝ) := by norm_num + +-lemma bound_aux' (x y z : ℝ) (x0 : 0 < x) (_ : x < 1) (y0 : 0 < y) (_ : y < 1) (z0 : 0 < z) (z1 : z < 1) : ++lemma bound_aux' (x y z : ℝ) (x0 : 0 < x) (_ : x < 1) (y0 : 0 < y) (_ : y < 1) ++ (z0 : 0 < z) (z1 : z < 1) : + 2 * √(1 - z) * √(x * y * z) ≤ 1 - (1 - x * y) * z := by + rw [← sub_pos] at z1 + have := mul_pos x0 (mul_pos y0 z0) +@@ -86,7 +93,8 @@ lemma bound_aux' (x y z : ℝ) (x0 : 0 < x) (_ : x < 1) (y0 : 0 < y) (_ : y < 1) + _ = √(1 - z) * √(1 - z) + √(x * y * z) * √(x * y * z) := by ring + _ = 1 - z + x * y * z := by rw [Real.mul_self_sqrt, Real.mul_self_sqrt] <;> linarith + +-lemma bound' (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z0 : 0 < z) (z1 : z < 1) : ++lemma bound' (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) ++ (z0 : 0 < z) (z1 : z < 1) : + x * (1 - x) * y * (1 - y) * z * (1 - z) / (1 - (1 - x * y) * z) < (1 / 24 : ℝ) := by + have := mul_pos x0 z0 + have h1 : 2 * √(1 - x) * √(x * z) ≤ 1 - (1 - z) * x := by apply bound_aux <;> assumption +@@ -102,16 +110,17 @@ lemma bound' (x y z : ℝ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) ( + have : 0 ≤ x.sqrt * (1 - x) := mul_nonneg (Real.sqrt_nonneg _) (by linarith) + have : 0 ≤ y.sqrt * (1 - y) := mul_nonneg (Real.sqrt_nonneg _) (by linarith) + calc +- _ ≤ x * (1 -x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - z) * √(x * y * z)) := by ++ _ ≤ x * (1 - x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - z) * √(x * y * z)) := by + refine div_le_div₀ (by positivity) (le_refl _) (by positivity) ?_ + apply bound_aux' <;> linarith + _ = √x * (1 - x) * (√y * (1 - y)) * (√z * √(1 - z)) / 2 := by +- rw [Real.sqrt_mul, Real.sqrt_mul] +- calc _ +- _ = ((x * (1 - x)) * (y * (1 - y)) * (z * (1 - z))) / (2 * √x * √y * (√z * √(1 - z))) := by ring +- _ = (x / √x) * (1 - x) * (y / √y) * (1 - y) * (z / √z) * ((1 - z) / √(1 - z)) / 2 := by ring ++ rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (by positivity)] ++ calc ++ _ = ((x * (1 - x)) * (y * (1 - y)) * (z * (1 - z))) / ++ (2 * √x * √y * (√z * √(1 - z))) := by ring ++ _ = (x / √x) * (1 - x) * (y / √y) * (1 - y) * (z / √z) * ++ ((1 - z) / √(1 - z)) / 2 := by ring + _ = _ := by simpa only [Real.div_sqrt] using (by ring) +- all_goals nlinarith + _ ≤ (2 / 5) * (2 / 5) * (1 / 2) / 2 := by + refine div_le_div₀ (by norm_num) + (mul_le_mul_of_nonneg (mul_le_mul_of_nonneg (max_value' ?_ ?_) (max_value' ?_ ?_) ?_ ?_) +diff --git a/Zeta3Irrational/Equality.lean b/Zeta3Irrational/Equality.lean +index 4fc5c29..0beb8e6 100644 +--- a/Zeta3Irrational/Equality.lean ++++ b/Zeta3Irrational/Equality.lean +@@ -27,10 +27,10 @@ lemma integral_equality_help (s t : ℝ) (s0 : 0 < s) (s1 : s < 1) (t0 : 0 < t) + · ring_nf + · have _ : 0 < (1 - (1 - s) * t) * ((1 - (1 - u) * s) * (1 - (1 - t) * u)) := by + rw[mul_pos_iff_of_pos_left, mul_pos_iff_of_pos_left] <;> linarith +- positivity ++ linarith + · have _ : 0 < (1 - (1 - u) * s) * (1 - (1 - t) * u) := by + rw[mul_pos_iff_of_pos_left] <;> linarith +- positivity ++ linarith + · linarith + · linarith + rw[← intervalIntegral.integral_congr] +@@ -39,22 +39,16 @@ lemma integral_equality_help (s t : ℝ) (s0 : 0 < s) (s1 : s < 1) (t0 : 0 < t) + rw[inv_eq_one_div, inv_eq_one_div, inv_eq_one_div, one_div_mul_one_div] + simp at b + rcases b with ⟨b1, b2⟩ +- rw[← not_lt] at b1 +- cases' eq_or_lt_of_not_lt b1 with b11 b12 +- · rw[b11] +- field_simp +- rw[div_eq_one_iff_eq] +- ring_nf +- have _ : 0 < 1 - (1 - s) * t := by linarith +- positivity +- · rw[← not_lt] at b2 +- cases' eq_or_lt_of_not_lt b2 with b21 b22 +- · rw[← b21] +- field_simp +- rw[div_eq_one_iff_eq] +- ring_nf +- have _ : 0 < 1 - (1 - s) * t := by linarith +- positivity ++ rcases eq_or_lt_of_le b1 with b11 | b12 ++ · rw[← b11] ++ norm_num ++ field_simp [ne_of_gt s1, ne_of_gt (sub_pos.mpr h2)] ++ ring ++ · rcases eq_or_lt_of_le b2 with b21 | b22 ++ · rw[b21] ++ norm_num ++ field_simp [ne_of_gt t0, ne_of_gt (sub_pos.mpr h2)] ++ ring + · obtain b00 := eq1 a b12 b22 + rw[b00, mul_comm] + +@@ -99,7 +93,7 @@ lemma integral_equality (s t : ℝ) (s0 : 0 < s) (s1 : s < 1) (t0 : 0 < t) (t1 : + apply IntervalIntegrable.continuousOn_mul (hg := continuousOn_const) + apply intervalIntegral.intervalIntegrable_inv + · intros x hx +- simp only [ge_iff_le, zero_le_one, Set.uIcc_of_le, Set.mem_Icc] at hx ++ simp only [zero_le_one, Set.uIcc_of_le, Set.mem_Icc] at hx + intro r + rw [sub_eq_zero] at r + have ineq3 : (1 - x) * s ≤ 1 * s := by +diff --git a/Zeta3Irrational/Integral.lean b/Zeta3Irrational/Integral.lean +index 15c6253..c732e9c 100644 +--- a/Zeta3Irrational/Integral.lean ++++ b/Zeta3Irrational/Integral.lean +@@ -2,23 +2,26 @@ + A formal proof of the irrationality of Riemann-Zeta(3). + Author: Junqi Liu and Jujian Zhang. + -/ +-import Mathlib.Analysis.Normed.Field.Instances + import Mathlib.Analysis.PSeries +-import Mathlib.Analysis.SpecialFunctions.Integrals +-import Mathlib.Data.Real.StarOrdered ++import Mathlib.Analysis.SpecialFunctions.Integrals.Basic ++import Mathlib.Analysis.Real.Sqrt + import Mathlib.MeasureTheory.Function.AEEqOfIntegral + import Mathlib.MeasureTheory.Integral.IntegralEqImproper + import Mathlib.Topology.Algebra.Module.ModuleTopology +-import Mathlib.Topology.Compactness.PseudometrizableLindelof ++import Mathlib.Topology.Metrizable.Basic ++ ++/-! Integral identities in the Apache-2.0 Apéry proof of Junqi Liu and Jujian Zhang. -/ + + open scoped Nat + open BigOperators Finset + ++/-- The real Apéry double integral with monomial weights of degrees `r` and `s`. -/ + noncomputable abbrev J (r s : ℕ) : ℝ := + ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + -(x.1 * x.2).log / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s + +-noncomputable abbrev J_ENN (r s : ℕ) : ENNReal := ++/-- The nonnegative extended-real Apéry double integral with weights of degrees `r` and `s`. -/ ++noncomputable abbrev jENN (r s : ℕ) : ENNReal := + ∫⁻ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + ENNReal.ofReal (- (x.1 * x.2).log / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s) + +@@ -26,7 +29,7 @@ lemma log_rpow_integral_aux (n : ℝ) (a : ℝ) (ha : 0 < a ∧ a ≤ 1) : + ∫ (x : ℝ) in Set.Ioc a 1, |-x.log * x ^ n| = ∫ (x : ℝ) in Set.Ioc a 1, -x.log * x ^ n := by + apply MeasureTheory.setIntegral_congr_fun (by measurability) + intro x hx +- simp only [gt_iff_lt, Set.mem_Ioc, neg_mul, abs_neg, abs_eq_neg_self] at * ++ simp only [Set.mem_Ioc, neg_mul, abs_neg, abs_eq_neg_self] at * + rw [mul_nonpos_iff] + right + constructor +@@ -42,7 +45,7 @@ lemma log_rpow_integral' (n : ℝ) (hn : n > -1) (a : ℝ) (ha : 0 < a ∧ a ≤ + f 1 - f a by simp[f], ← intervalIntegral.integral_of_le ha.2] + refine intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le ha.2 (a := a) (b := 1) (f := f) + (f' := fun x : ℝ => -x.log * x ^ n ) ?_ ?_ ?_ +- · simp [f] ++ · simp only [f] + refine ContinuousOn.sub (ContinuousOn.div_const ?_ (((n : ℝ) + 1) ^ 2)) ?_ + · apply ContinuousOn.rpow_const continuousOn_id + intro x hx +@@ -77,7 +80,8 @@ lemma log_rpow_integral' (n : ℝ) (hn : n > -1) (a : ℝ) (ha : 0 < a ∧ a ≤ + norm_cast + apply Real.hasDerivAt_rpow_const + left ; linarith +- · have h : x ^ n * x.log + x ^ n / (↑n + 1) = ((↑n + 1) * x ^ n * x.log + x ^ n) / (↑n + 1) := by ++ · have h : x ^ n * x.log + x ^ n / (↑n + 1) = ++ ((↑n + 1) * x ^ n * x.log + x ^ n) / (↑n + 1) := by + rw [add_div] + congr 1 + rw [eq_div_iff (by linarith)] +@@ -104,12 +108,14 @@ lemma log_rpow_integral' (n : ℝ) (hn : n > -1) (a : ℝ) (ha : 0 < a ∧ a ≤ + simp only [Set.mem_Icc, id_eq, ne_eq] at hx ⊢ + nlinarith + +-lemma log_rpow_integrable (n : ℝ) (hn : n > -1) : IntervalIntegrable (fun x ↦ -Real.log x * x ^ n) MeasureTheory.volume 0 1 := by ++lemma log_rpow_integrable (n : ℝ) (hn : n > -1) : ++ IntervalIntegrable (fun x ↦ -Real.log x * x ^ n) MeasureTheory.volume 0 1 := by + let f := fun (x : ℝ) => -x.log * x ^ n + apply MeasureTheory.IntegrableOn.intervalIntegrable + rw [Set.uIcc_of_le (by norm_num), integrableOn_Icc_iff_integrableOn_Ioc] + apply MeasureTheory.integrableOn_Ioc_of_intervalIntegral_norm_bounded_left (f := f) +- (l := Filter.atTop) (a := fun (n : ℕ) => 1 / (n + 1 : ℝ)) (a₀ := 0) (b := 1) (I := 1 / (n + 1) ^ 2) ++ (l := Filter.atTop) (a := fun (n : ℕ) => 1 / (n + 1 : ℝ)) (a₀ := 0) (b := 1) ++ (I := 1 / (n + 1) ^ 2) + · intro i + simp only [one_div, f] + have hi : 0 < ((i : ℝ) + 1)⁻¹ ∧ ((i : ℝ) + 1)⁻¹ ≤ 1 := by +@@ -137,7 +143,7 @@ lemma log_rpow_integrable (n : ℝ) (hn : n > -1) : IntervalIntegrable (fun x + · rw [log_rpow_integral' n hn] + · set k := _ + change _ - k ≤ _ +- simp only [Real.log_inv, tsub_le_iff_right, le_add_iff_nonneg_right, ++ simp only [tsub_le_iff_right, le_add_iff_nonneg_right, + sub_nonneg, k] + rw [div_le_div_iff₀ (by linarith) (by nlinarith), mul_assoc, mul_le_mul_iff_of_pos_left] + · trans 0 +@@ -164,7 +170,8 @@ lemma log_rpow_integral (n : ℝ) (hn : n > -1) : + ∫ (x : ℝ) in (0)..1, -x.log * x ^ n = 1 / (n + 1) ^ 2 := by + let F := fun (x : ℝ) => x ^ (n + 1) * (1 - (n + 1) * x.log) / (n + 1) ^ 2 + have h1 : 1 /(n + 1) ^ 2 = F 1 - F 0 := by +- simp [F] ++ simp only [F, Real.one_rpow, Real.log_one, mul_zero, sub_zero, ++ Real.log_zero, mul_one] + rw [Real.zero_rpow (by linarith), zero_div, sub_zero] + rw [h1] + refine intervalIntegral.integral_eq_sub_of_hasDerivAt_of_tendsto (by norm_num) (a := 0) (b := 1) +@@ -211,7 +218,7 @@ lemma log_rpow_integral (n : ℝ) (hn : n > -1) : + exact fun ⦃U⦄ a ↦ a + · right; linarith + · apply Filter.Tendsto.div_const +- simp [← mul_assoc, ← mul_rotate (c := n + 1)] ++ simp only [← mul_assoc, ← mul_rotate (c := n + 1)] + nth_rw 3 [show (0 : ℝ) = 0 * (n + 1) by simp] + apply Filter.Tendsto.mul_const + apply tendsto_log_mul_rpow_nhdsGT_zero +@@ -303,42 +310,22 @@ lemma ENN_pow_integral (n : ℕ) : ∫⁻ (x : ℝ) in Set.Ioo 0 1, + · tauto + · omega + +-lemma AEMeasurable_aux : AEMeasurable (fun (x : ℝ × ℝ × ℝ) ↦ ++lemma AEMeasurable_aux {r s : ℕ} : AEMeasurable (fun (x : ℝ × ℝ × ℝ) ↦ + 1 / (1 - (1 - x.2.1 * x.2.2) * x.1) * x.2.1 ^ r * x.2.2 ^ s) MeasureTheory.volume := by +- apply AEMeasurable.mul +- · apply AEMeasurable.mul +- · apply AEMeasurable.const_div +- apply AEMeasurable.const_sub +- apply AEMeasurable.mul _ (AEMeasurable.fst (f := id) aemeasurable_id) +- · apply AEMeasurable.const_sub +- apply AEMeasurable.mul +- · apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- exact AEMeasurable.fst (f := id) aemeasurable_id +- · apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- exact AEMeasurable.snd (f := id) aemeasurable_id +- · apply AEMeasurable.pow_const +- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.1) +- exact AEMeasurable.fst (f := id) aemeasurable_id +- · apply AEMeasurable.pow_const +- apply AEMeasurable.snd (f := fun (x : ℝ × ℝ) => x.2) +- exact AEMeasurable.snd (f := id) aemeasurable_id ++ fun_prop + + lemma integral1 {a : ℝ} (ha : 0 < a) (ha1 : a < 1) : + ∫ (z : ℝ) in (0)..1, 1 / (1 - (1 - a) * z) = - a.log / (1 - a) := by + rw[← sub_pos] at ha1 + have eq1 := intervalIntegral.integral_comp_mul_left (a := 0) (b := 1) (c := 1 - a) + (f := fun z ↦ (1 - z)⁻¹) (by positivity) +- have eq2 := intervalIntegral.mul_integral_comp_sub_mul (a := 0) (b := 1 - a) (f := fun x ↦ (x)⁻¹) +- (c := 1) (d := 1) + have eq3 := integral_inv_of_pos (a := a) (b := 1) ha (by norm_num) + simp only [mul_zero, mul_one, smul_eq_mul] at eq1 + simp only [one_div] + rw [eq1, inv_mul_eq_div] + field_simp + simp only [one_div] +- simp only [one_mul, intervalIntegral.integral_comp_sub_left, sub_sub_cancel, sub_zero, +- mul_zero] at eq2 +- rw[eq3] ++ rw [intervalIntegral.integral_comp_sub_left, sub_sub_cancel, sub_zero, eq3] + simp + + lemma sub_mul_mul_ne_zero (y : ℝ) (x : ℝ × ℝ) +@@ -348,7 +335,7 @@ lemma sub_mul_mul_ne_zero (y : ℝ) (x : ℝ × ℝ) + by_cases hy' : y = 0 + · rw [hy'] + simp +- · simp only [Set.mem_prod, Set.mem_Ioo, sub_pos, Set.mem_Icc, gt_iff_lt, sub_pos] at * ++ · simp only [sub_pos, Set.mem_Icc] at * + suffices (1 - x.1 * x.2) * y < y by linarith + rwa [mul_lt_iff_lt_one_left] + rcases hy with ⟨hy1, _⟩ +@@ -357,7 +344,7 @@ lemma sub_mul_mul_ne_zero (y : ℝ) (x : ℝ × ℝ) + linarith + + lemma integrableOn_aux (x : ℝ × ℝ) +- (h1 : 0 < 1 - (1 - x.1 * x.2)) (h2 : 1 - (1 - x.1 * x.2) < 1): ++ (h1 : 0 < 1 - (1 - x.1 * x.2)) (h2 : 1 - (1 - x.1 * x.2) < 1) : + MeasureTheory.IntegrableOn (fun t ↦ 1 / (1 - (1 - x.1 * x.2) * t)) + (Set.Ioo 0 1) MeasureTheory.volume := by + rw [← integrableOn_Ioc_iff_integrableOn_Ioo] +@@ -392,8 +379,7 @@ lemma integrableOn_aux (x : ℝ × ℝ) + simp at hy + apply div_nonneg (by norm_num) + simp only [sub_nonneg] +- apply mul_le_one₀ _ (by linarith) (by linarith) +- linarith ++ exact (mul_le_of_le_one_left (by linarith) (by linarith)).trans (by linarith) + + lemma JENN_eq_triple_aux' (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : + ∫⁻ (w : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (1 / (1 - (1 - x.1 * x.2) * w)) = +@@ -423,11 +409,10 @@ lemma JENN_eq_triple_aux' (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo + · simp only [h, true_and] at hs + apply div_nonneg (by norm_num) + simp only [sub_nonneg] +- apply mul_le_one₀ _ (by linarith) (by linarith) +- linarith ++ exact (mul_le_of_le_one_left (by linarith) (by linarith)).trans (by linarith) + · tauto + +-lemma JENN_eq_triple_aux (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : ++lemma JENN_eq_triple_aux {r s : ℕ} (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : + ∫⁻ (w : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (1 / (1 - (1 - x.1 * x.2) * w) * x.1 ^ r * x.2 ^ s) = + ENNReal.ofReal (-Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s) := by + calc +@@ -454,11 +439,11 @@ lemma JENN_eq_triple_aux (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 + · simp only [Left.nonneg_neg_iff] + apply Real.log_nonpos + · apply mul_nonneg (by linarith) (by linarith) +- · apply mul_le_one₀ (by linarith) (by linarith) (by linarith) ++ · exact (mul_le_of_le_one_left (by linarith) (by linarith)).trans (by linarith) + · simp only [sub_nonneg] +- apply mul_le_one₀ (by linarith) (by linarith) (by linarith) ++ exact (mul_le_of_le_one_left (by linarith) (by linarith)).trans (by linarith) + +-lemma JENN_eq_triple (r s : ℕ) : J_ENN r s = ++lemma JENN_eq_triple (r s : ℕ) : jENN r s = + ∫⁻ (x : ℝ × ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + ENNReal.ofReal (1 / (1 - (1 - x.2.1 * x.2.2) * x.1) * x.2.1 ^ r * x.2.2 ^ s) := by + symm +@@ -480,11 +465,12 @@ lemma JENN_eq_triple (r s : ℕ) : J_ENN r s = + exact AEMeasurable_aux + _ = ∫⁻ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + ENNReal.ofReal (- (x.1 * x.2).log / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s) := by +- apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ ++ apply MeasureTheory.setLIntegral_congr_fun (by measurability) + intro x hx ++ dsimp only + rw [JENN_eq_triple_aux _ hx] + +-lemma AEMeasurable_aux' : AEMeasurable ++lemma AEMeasurable_aux' {k r s : ℕ} : AEMeasurable + (fun x ↦ ENNReal.ofReal (-Real.log (x.1 * x.2) * x.1 ^ (k + r) * x.2 ^ (k + s))) + (MeasureTheory.volume.restrict (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1)) := by + apply AEMeasurable.ennreal_ofReal +@@ -551,10 +537,12 @@ lemma aux_lintegral3 (k r s : ℕ) : ∫⁻ (x : ℝ) in Set.Ioo 0 1, + ENNReal.ofReal (-x.log * x ^ (k + r) / (k + s + 1)) + = ENNReal.ofReal (1 / ((k + r + 1) ^ 2 * (k + s + 1))) := by + calc +- _ = (∫⁻ (x : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (-x.log * x ^ (k + r))) * ENNReal.ofReal (1 / (k + s + 1)) := by ++ _ = (∫⁻ (x : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (-x.log * x ^ (k + r))) * ++ ENNReal.ofReal (1 / (k + s + 1)) := by + rw [← MeasureTheory.lintegral_mul_const] +- · apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ ++ · apply MeasureTheory.setLIntegral_congr_fun (by measurability) + rintro y ⟨hy1, hy2⟩ ++ dsimp only + rw [← ENNReal.ofReal_mul] + · field_simp + simp only [neg_mul, Left.nonneg_neg_iff] +@@ -575,10 +563,12 @@ lemma aux_lintegral4 (k r s : ℕ) : ∫⁻ (x : ℝ) in Set.Ioo 0 1, + ENNReal.ofReal (x ^ (k + r) / (k + s + 1) ^ 2) + = ENNReal.ofReal (1 / ((k + r + 1) * (k + s + 1) ^ 2)) := + calc +- _ = (∫⁻ (x : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (x ^ (k + r))) * ENNReal.ofReal (1 / (k + s + 1) ^ 2) := by ++ _ = (∫⁻ (x : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (x ^ (k + r))) * ++ ENNReal.ofReal (1 / (k + s + 1) ^ 2) := by + rw [← MeasureTheory.lintegral_mul_const] +- · apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ ++ · apply MeasureTheory.setLIntegral_congr_fun (by measurability) + rintro y ⟨hy1, hy2⟩ ++ dsimp only + rw [← ENNReal.ofReal_mul] + · field_simp + positivity +@@ -588,7 +578,7 @@ lemma aux_lintegral4 (k r s : ℕ) : ∫⁻ (x : ℝ) in Set.Ioo 0 1, + · norm_cast + · positivity + +-lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): ++lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ) : + ∫⁻ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + ENNReal.ofReal (- (x.1 * x.2).log * x.1 ^ (k + r) * x.2 ^ (k + s)) = ENNReal.ofReal + (1 / ((k + r + 1) ^ 2 * (k + s + 1)) + 1 / ((k + r + 1) * (k + s + 1) ^ 2)) := by +@@ -597,14 +587,17 @@ lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): + · calc + _ = ∫⁻ (x : ℝ) in Set.Ioo 0 1, + ENNReal.ofReal (- x.log * x ^ (k + r) / (k + s + 1) + x ^ (k + r) / (k + s + 1) ^ 2) := by +- apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ ++ apply MeasureTheory.setLIntegral_congr_fun (by measurability) + intro x hx ++ dsimp only + simp only [neg_mul] +- have h2 : ∫⁻ (y : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (-((x * y).log * x ^ (k + r) * y ^ (k + s))) ++ have h2 : ∫⁻ (y : ℝ) in Set.Ioo 0 1, ++ ENNReal.ofReal (-((x * y).log * x ^ (k + r) * y ^ (k + s))) + = ∫⁻ (y : ℝ) in Set.Ioo 0 1, ENNReal.ofReal (-(x.log * x ^ (k + r) * y ^ (k + s))) + + ENNReal.ofReal (-(y.log * x ^ (k + r) * y ^ (k + s))) := by +- apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ ++ apply MeasureTheory.setLIntegral_congr_fun (by measurability) + intro y hy ++ dsimp only + simp only [← neg_mul] + simp only [Set.mem_Ioo] at hx hy + rw [Real.log_mul (by linarith) (by linarith), neg_add, add_mul, add_mul, +@@ -639,9 +632,11 @@ lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): + have h2 : ∫⁻ (x : ℝ) in Set.Ioo 0 1, + ENNReal.ofReal (- x.log * x ^ (k + r) / (k + s + 1) + x ^ (k + r) / (k + s + 1) ^ 2) + = ∫⁻ (x : ℝ) in Set.Ioo 0 1, +- ENNReal.ofReal (-x.log * x ^ (k + r) / (k + s + 1)) + ENNReal.ofReal (x ^ (k + r) / (k + s + 1) ^ 2) := by +- apply MeasureTheory.setLIntegral_congr_fun (by measurability) <| Filter.Eventually.of_forall ?_ ++ ENNReal.ofReal (-x.log * x ^ (k + r) / (k + s + 1)) + ++ ENNReal.ofReal (x ^ (k + r) / (k + s + 1) ^ 2) := by ++ apply MeasureTheory.setLIntegral_congr_fun (by measurability) + rintro x ⟨hx1, hx2⟩ ++ dsimp only + rw [ENNReal.ofReal_add] + · apply div_nonneg _ (by positivity) + apply mul_nonneg _ (by apply pow_nonneg (by linarith)) +@@ -649,10 +644,8 @@ lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): + apply Real.log_nonpos (by nlinarith) (by nlinarith) + · apply div_nonneg _ (by positivity) + apply pow_nonneg (by linarith) +- + rw [h2, MeasureTheory.lintegral_add_left'] +- · simp only [Set.mem_Ioo] at h2 +- rw [aux_lintegral3 k r s, aux_lintegral4 k r s, ENNReal.ofReal_add] ++ · rw [aux_lintegral3 k r s, aux_lintegral4 k r s, ENNReal.ofReal_add] + · apply div_nonneg (by norm_num) (by positivity) + · apply div_nonneg (by norm_num) (by positivity) + · apply AEMeasurable.ennreal_ofReal +@@ -665,12 +658,12 @@ lemma J_ENN_rs_eq_tsum_aux_intergal (r s k : ℕ): + · rw [MeasureTheory.Measure.prod_restrict, ← MeasureTheory.Measure.volume_eq_prod] + exact AEMeasurable_aux' + +-lemma J_ENN_rs_eq_tsum (r s : ℕ) : J_ENN r s = ∑' (k : ℕ), ENNReal.ofReal ++lemma J_ENN_rs_eq_tsum (r s : ℕ) : jENN r s = ∑' (k : ℕ), ENNReal.ofReal + (1 / ((k + r + 1) ^ 2 * (k + s + 1)) + 1 / ((k + r + 1) * (k + s + 1) ^ 2)) := by + calc + _ = ∫⁻ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + ∑' (k : ℕ), ENNReal.ofReal (- (x.1 * x.2).log * x.1 ^ (k + r) * x.2 ^ (k + s)) := by +- rw [J_ENN, ← MeasureTheory.lintegral_indicator (by measurability), ++ rw [jENN, ← MeasureTheory.lintegral_indicator (by measurability), + ← MeasureTheory.lintegral_indicator (by measurability)] + congr + ext y +@@ -711,9 +704,9 @@ lemma J_ENN_rs_eq_tsum (r s : ℕ) : J_ENN r s = ∑' (k : ℕ), ENNReal.ofReal + (1 / ((k + r + 1) ^ 2 * (k + s + 1)) + 1 / ((k + r + 1) * (k + s + 1) ^ 2)) := by + simp_rw [J_ENN_rs_eq_tsum_aux_intergal r s] + +-lemma J_ENN_rr (r : ℕ) : J_ENN r r = ENNReal.ofReal ++lemma J_ENN_rr (r : ℕ) : jENN r r = ENNReal.ofReal + (2 * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 - 2 * ∑ m ∈ Finset.Icc 1 r, 1 / (m : ℝ) ^ 3) := by +- have h : J_ENN r r = ∑' (k : ℕ), ENNReal.ofReal (2 / ((k + r + 1) ^ 3)) := by ++ have h : jENN r r = ∑' (k : ℕ), ENNReal.ofReal (2 / ((k + r + 1) ^ 3)) := by + rw [J_ENN_rs_eq_tsum r r] + congr + ext k +@@ -724,13 +717,13 @@ lemma J_ENN_rr (r : ℕ) : J_ENN r r = ENNReal.ofReal + 2 * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 - 2 * ∑ m ∈ Finset.Icc 1 r, 1 / (m : ℝ) ^ 3 := by + symm + apply sub_eq_of_eq_add +- rw [← sum_add_tsum_nat_add' (k := r) (f := fun k => 1 / ((k : ℝ) + 1) ^ 3), mul_add, add_comm, +- ← tsum_mul_left] +- · simp only [mul_one_div, ← two_mul, ← mul_assoc, ← mul_add] ++ rw [← Summable.sum_add_tsum_nat_add' (k := r) (f := fun k => 1 / ((k : ℝ) + 1) ^ 3), ++ mul_add, add_comm, ← tsum_mul_left] ++ · simp only [mul_one_div] + congr 1 + · norm_cast + · congr 1 +- rw [← Nat.Ico_succ_right, Nat.succ_eq_add_one] ++ rw [← Finset.Ico_add_one_right_eq_Icc] + have h1 := Finset.sum_Ico_eq_sum_range (m := 1) (n := r + 1) (f := fun k => 1 / (k : ℝ) ^ 3) + simp only [add_tsub_cancel_right, Nat.cast_add, Nat.cast_one] at h1 + simp only [h1, add_comm] +@@ -746,13 +739,13 @@ lemma J_ENN_rr (r : ℕ) : J_ENN r r = ENNReal.ofReal + simp only [add_assoc, Nat.cast_pow] + rw [summable_nat_add_iff (k := r + 1) (f := fun k => 2 / (k ^ 3 : ℝ))] + have h2 := Real.summable_one_div_nat_pow (p := 3) +- simp only [Real.summable_nat_pow_inv, Nat.one_lt_ofNat] at h2 ++ simp only [Nat.one_lt_ofNat] at h2 + apply Iff.symm at h2 + rw [true_iff, ← summable_mul_left_iff (a := 2) (by norm_num)] at h2 + simp only [mul_one_div] at h2 + exact h2 + +-lemma fun_of_J_nonneg (r s: ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : ++lemma fun_of_J_nonneg (r s : ℕ) (x : ℝ × ℝ) (hx : x ∈ Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) : + 0 ≤ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s := by + simp only [Set.mem_prod, Set.mem_Ioo] at hx + apply mul_nonneg +@@ -770,7 +763,7 @@ lemma integrableOn_J_rr (r : ℕ) : MeasureTheory.IntegrableOn + (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ r) + (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) MeasureTheory.volume := by + have h := J_ENN_rr r +- simp only [J_ENN] at h ++ simp only [jENN] at h + rw [MeasureTheory.IntegrableOn, MeasureTheory.Integrable] + constructor + · apply AEMeasurable.aestronglyMeasurable +@@ -811,17 +804,18 @@ lemma integrableOn_J_rr (r : ℕ) : MeasureTheory.IntegrableOn + theorem J_rr (r : ℕ) : + J r r = 2 * ∑' n : ℕ , 1 / ((n : ℝ) + 1) ^ 3 - 2 * ∑ m ∈ Finset.Icc 1 r, 1 / (m : ℝ) ^ 3 := by + have h := J_ENN_rr r +- simp only [J_ENN] at h ++ simp only [jENN] at h + rw [J, MeasureTheory.integral_eq_lintegral_of_nonneg_ae, h, ENNReal.toReal_ofReal_eq_iff] +- · simp only [sub_nonneg, Nat.ofNat_pos, mul_le_mul_left] +- rw [← Nat.Ico_succ_right, Nat.succ_eq_add_one] ++ · simp only [sub_nonneg] ++ apply mul_le_mul_of_nonneg_left ?_ (by norm_num) ++ rw [← Finset.Ico_add_one_right_eq_Icc] + nth_rw 1 [← zero_add (a := 1)] + rw [← Finset.sum_Ico_add' (c := 1)] + norm_cast +- apply sum_le_tsum ++ apply Summable.sum_le_tsum + · intro i _; positivity + · norm_cast +- simp only [add_assoc, Nat.cast_pow] ++ simp only [Nat.cast_pow] + rw [summable_nat_add_iff (k := 1) (f := fun k => 1 / (k ^ 3 : ℝ)), + Real.summable_one_div_nat_pow (p := 3)] + norm_num +@@ -868,7 +862,7 @@ lemma summable_aux (r : ℕ) : Summable fun (b : ℕ) ↦ 1 / ((b : ℝ) + r + 1 + norm_num + + lemma J_ENN_rs (r s : ℕ) (h : r > s) : +- J_ENN r s = ENNReal.ofReal ((∑ k ∈ Finset.Ioc s r, 1 / (k : ℝ) ^ 2) / (r - s)) := by ++ jENN r s = ENNReal.ofReal ((∑ k ∈ Finset.Ioc s r, 1 / (k : ℝ) ^ 2) / (r - s)) := by + calc + _ = ∑' (k : ℕ), ENNReal.ofReal (1 / (r - s) * (1 / (k + s + 1) ^ 2 - 1 / (k + r + 1) ^ 2)) := by + rw [J_ENN_rs_eq_tsum] +@@ -906,15 +900,17 @@ lemma J_ENN_rs (r s : ℕ) (h : r > s) : + rw [← ENNReal.ofReal_tsum_of_nonneg] + · rw [ENNReal.ofReal_eq_ofReal_iff] + · simp only [mul_sub] +- · rw [tsum_sub] ++ · rw [Summable.tsum_sub] + · simp only [sum_div, div_div, ← one_div_mul_one_div_rev] + apply sub_eq_of_eq_add +- rw [← sum_add_tsum_nat_add' (f := fun n => 1 / (r - s) * (1 / (n + (s : ℝ) + 1) ^ 2)) (k := r - s)] ++ rw [← Summable.sum_add_tsum_nat_add' ++ (f := fun n => 1 / (r - s) * (1 / (n + (s : ℝ) + 1) ^ 2)) (k := r - s)] + · congr 1 + · simp only [← Nat.cast_add, add_comm] + rw [← Finset.sum_Ico_eq_sum_range (n := r) (m := s) +- (f := fun k => 1 / (r - s) * (1 / ((k : ℝ) + 1) ^ 2)), ← Nat.Ico_succ_succ, +- Nat.succ_eq_add_one, ← Finset.sum_Ico_add' (c := 1) (b := r) (a := s)] ++ (f := fun k => 1 / (r - s) * (1 / ((k : ℝ) + 1) ^ 2)), ++ ← Finset.Ico_add_one_add_one_eq_Ioc, ++ ← Finset.sum_Ico_add' (c := 1) (b := r) (a := s)] + norm_cast + · congr + ext n +@@ -954,7 +950,7 @@ lemma integrableOn_J_rs' (r s : ℕ) (h : r > s) : MeasureTheory.IntegrableOn + (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ r * x.2 ^ s) + (Set.Ioo 0 1 ×ˢ Set.Ioo 0 1) MeasureTheory.volume := by + have h₀ := J_ENN_rs r s h +- simp only [J_ENN] at h₀ ++ simp only [jENN] at h₀ + rw [MeasureTheory.IntegrableOn, MeasureTheory.Integrable] + constructor + · apply AEMeasurable.aestronglyMeasurable +@@ -995,7 +991,7 @@ lemma integrableOn_J_rs' (r s : ℕ) (h : r > s) : MeasureTheory.IntegrableOn + lemma J_rs' (r s : ℕ) (h : r > s) : + J r s = (∑ k ∈ Finset.Ioc s r, 1 / (k : ℝ) ^ 2) / (r - s) := by + have h₀ := J_ENN_rs r s h +- simp only [J_ENN] at h₀ ++ simp only [jENN] at h₀ + rw [J, MeasureTheory.integral_eq_lintegral_of_nonneg_ae, h₀, ENNReal.toReal_ofReal_eq_iff] + · rw [sum_div] + apply sum_nonneg +@@ -1024,7 +1020,7 @@ lemma J_rs' (r s : ℕ) (h : r > s) : + · apply Measurable.pow measurable_fst measurable_const + · apply Measurable.pow measurable_snd measurable_const + +-lemma J_ENN_rs_symm (r s : ℕ) : J_ENN r s = J_ENN s r := by ++lemma J_ENN_rs_symm (r s : ℕ) : jENN r s = jENN s r := by + simp only [J_ENN_rs_eq_tsum, add_comm, mul_comm] + + lemma integrableOn_J_rs (r s : ℕ) : MeasureTheory.IntegrableOn +@@ -1073,12 +1069,12 @@ lemma integrableOn_J_rs (r s : ℕ) : MeasureTheory.IntegrableOn + · simp only [hx, ↓reduceIte] + have h₀ := J_ENN_rs s r h2 + rw [J_ENN_rs_symm s r] at h₀ +- simp only [J_ENN] at h₀ ++ simp only [jENN] at h₀ + rw [h1, h₀] + simp only [one_div, ENNReal.ofReal_lt_top] + +-lemma J_eq_toReal_J_ENN (r s : ℕ) : J r s = (J_ENN r s).toReal := by +- rw [J, J_ENN, MeasureTheory.integral_eq_lintegral_of_nonneg_ae] ++lemma J_eq_toReal_J_ENN (r s : ℕ) : J r s = (jENN r s).toReal := by ++ rw [J, jENN, MeasureTheory.integral_eq_lintegral_of_nonneg_ae] + · apply MeasureTheory.ae_nonneg_restrict_of_forall_setIntegral_nonneg_inter + · exact integrableOn_J_rs r s + · rintro x hx - +@@ -1105,16 +1101,16 @@ theorem J_rs {r s : ℕ} (h : r ≠ s) : J r s = + (∑ m ∈ Icc 1 r, 1 / (m : ℝ) ^ 2 - ∑ m ∈ Icc 1 s, 1 / (m : ℝ) ^ 2) / (r - s) := by + by_cases h1 : r > s + · simp only [J_rs' r s h1, sub_div, sum_div] +- rw [← Nat.Ico_succ_succ, Finset.sum_Ico_eq_sub] ++ rw [← Finset.Ico_add_one_add_one_eq_Ioc, Finset.sum_Ico_eq_sub] + · congr 1 + · rw [← Finset.sum_range_add_sum_Ico (n := r + 1) (m := 1) _ (by omega)] + simp only [range_one, one_div, sum_singleton, CharP.cast_eq_zero, ne_eq, + OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_div, zero_add] +- rw [ Nat.Ico_succ_right] ++ rw [ Finset.Ico_add_one_right_eq_Icc] + · rw [← Finset.sum_range_add_sum_Ico (n := s + 1) (m := 1) _ (by omega)] + simp only [range_one, one_div, sum_singleton, CharP.cast_eq_zero, ne_eq, + OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_div, zero_add] +- rw [ Nat.Ico_succ_right] ++ rw [ Finset.Ico_add_one_right_eq_Icc] + · linarith + · simp only [gt_iff_lt, not_lt] at h1 + have h2 : s > r := by +@@ -1123,14 +1119,14 @@ theorem J_rs {r s : ℕ} (h : r ≠ s) : J r s = + nth_rw 2 [← neg_div_neg_eq] + simp only [neg_sub] + congr 1 +- rw [← Nat.Ico_succ_succ, Finset.sum_Ico_eq_sub] ++ rw [← Finset.Ico_add_one_add_one_eq_Ioc, Finset.sum_Ico_eq_sub] + · congr 1 + · rw [← Finset.sum_range_add_sum_Ico (n := s + 1) (m := 1) _ (by omega)] + simp only [range_one, one_div, sum_singleton, CharP.cast_eq_zero, ne_eq, +- OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_div, zero_add] +- rw [ Nat.Ico_succ_right] ++ OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_add] ++ rw [ Finset.Ico_add_one_right_eq_Icc] + · rw [← Finset.sum_range_add_sum_Ico (n := r + 1) (m := 1) _ (by omega)] + simp only [range_one, one_div, sum_singleton, CharP.cast_eq_zero, ne_eq, +- OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_div, zero_add] +- rw [ Nat.Ico_succ_right] ++ OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, inv_zero, zero_add] ++ rw [ Finset.Ico_add_one_right_eq_Icc] + · linarith +diff --git a/Zeta3Irrational/LegendrePoly.lean b/Zeta3Irrational/LegendrePoly.lean +index d682b28..9541b4c 100644 +--- a/Zeta3Irrational/LegendrePoly.lean ++++ b/Zeta3Irrational/LegendrePoly.lean +@@ -1,16 +1,18 @@ +-import Mathlib.Algebra.Lie.OfAssociative + import Mathlib.Algebra.Polynomial.Derivative + import Mathlib.Algebra.Polynomial.Eval.SMul ++import Mathlib.RingTheory.Polynomial.ShiftedLegendre + import Mathlib.Analysis.Calculus.Deriv.Inv + import Mathlib.Analysis.Calculus.Deriv.Pow +-import Mathlib.Data.Real.StarOrdered +-import Mathlib.MeasureTheory.Integral.IntegrationByParts ++import Mathlib.Analysis.Calculus.Deriv.Polynomial ++import Mathlib.Analysis.Real.Sqrt ++import Mathlib.Topology.Algebra.Polynomial ++import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts + + /-! + # Legendre Polynomials + +-In this file, we define the shiftedLegendre polynomials `shiftedLegendre n` for `n : ℕ` as a +-polynomial in `ℤ[X]`. We prove some basic properties of the shiftedLegendre polynomials. ++We use the real shifted Legendre polynomials `aperyShiftedLegendre n` for `n : ℕ` as ++a polynomial in `ℝ[X]`. We prove some basic properties of the aperyShiftedLegendre polynomials. + + -/ + +@@ -21,71 +23,42 @@ variable {R : Type*} + + namespace Polynomial + +-/-- `shiftedLegendre n` is the polynomial defined in terms of derivatives of order n. -/ +-noncomputable def shiftedLegendre (n : ℕ) : ℝ[X] := +- C (n ! : ℝ)⁻¹ * derivative^[n] (X ^ n * (1 - X) ^ n) ++/-- The real shifted Legendre polynomial, obtained from Mathlib's integer polynomial. -/ ++noncomputable def aperyShiftedLegendre (n : ℕ) : ℝ[X] := ++ (shiftedLegendre n).map (Int.castRingHom ℝ) ++ ++/-- The canonical polynomial has exactly the Rodrigues normalization used in the source. -/ ++lemma aperyShiftedLegendre_eq_rodrigues (n : ℕ) : ++ aperyShiftedLegendre n = C (n ! : ℝ)⁻¹ * derivative^[n] (X ^ n * (1 - X) ^ n) := by ++ have h := congrArg (Polynomial.map (Int.castRingHom ℝ)) ++ (factorial_mul_shiftedLegendre_eq n) ++ have h' : C (n ! : ℝ) * aperyShiftedLegendre n = ++ derivative^[n] (X ^ n * (1 - X) ^ n) := by ++ simpa only [aperyShiftedLegendre, Polynomial.map_mul, Polynomial.map_natCast, ++ ← iterate_derivative_map, Polynomial.map_pow, Polynomial.map_sub, ++ Polynomial.map_one, Polynomial.map_X, C_eq_natCast] using h ++ rw [← h', ← mul_assoc, ← C_mul, inv_mul_cancel₀ (by positivity), C_1, one_mul] + + lemma Finsum_iterate_deriv [CommRing R] (k : ℕ) (h : ℕ → ℕ) : + derivative^[k] (∑ m ∈ Finset.range (k + 1), (h m) • ((-1) ^ m : R[X]) * X ^ (k + m)) = + ∑ m ∈ Finset.range (k + 1), (h m) • (-1) ^ m * derivative^[k] (X ^ (k + m)) := by +- induction' k + 1 with n hn +- · simp only [Nat.zero_eq, Finset.range_zero, Finset.sum_empty, iterate_map_zero] +- · rw[Finset.sum_range, Finset.sum_range, Fin.sum_univ_castSucc, Fin.sum_univ_castSucc] at * +- simp only [Fin.coe_castSucc, Fin.val_last, iterate_map_add, hn, add_right_inj] +- rw [nsmul_eq_mul, mul_assoc, ← nsmul_eq_mul, Polynomial.iterate_derivative_smul, nsmul_eq_mul, +- mul_assoc] +- rcases n.even_or_odd with (hn1 | hn2) +- · simp_all only [nsmul_eq_mul, Int.even_coe_nat, Even.neg_pow, one_pow, one_mul] +- · rw [Odd.neg_one_pow] +- simp only [neg_mul, one_mul, iterate_map_neg, mul_neg] +- exact_mod_cast hn2 ++ simp only [iterate_derivative_sum] ++ congr! 1 with m _ ++ rw [show (h m) • ((-1) ^ m : R[X]) = C ((h m : R) * (-1) ^ m) by simp, ++ iterate_derivative_C_mul] + +-/-- The expand of `shiftedLegendre n`. -/ +-theorem shiftedLegendre_eq_sum (n : ℕ) : shiftedLegendre n = ∑ k ∈ Finset.range (n + 1), +- C ((-1) ^ k : ℝ) * (Nat.choose n k : ℝ[X]) * (Nat.choose (n + k) n : ℝ[X]) * X ^ k := by +- have h : ((X : ℝ[X]) - X ^ 2) ^ n = +- ∑ m ∈ range (n + 1), n.choose m • (- 1) ^ m * X ^ (n + m) := by +- rw[sub_eq_add_neg, add_comm, add_pow] +- congr! 1 with m hm +- rw[neg_pow, pow_two, mul_pow,← mul_assoc, mul_comm, mul_assoc, pow_mul_pow_sub, mul_assoc, +- ← pow_add, ← mul_assoc, nsmul_eq_mul, add_comm] +- rw[Finset.mem_range] at hm +- linarith +- rw [shiftedLegendre, ← mul_pow, mul_one_sub, ← pow_two, h, Finsum_iterate_deriv, +- Finset.mul_sum] +- congr! 1 with x _ +- rw [← mul_assoc, Polynomial.iterate_derivative_X_pow_eq_smul, Nat.descFactorial_eq_div +- (by omega), show n + x - n = x by omega, nsmul_eq_mul, ← mul_assoc, mul_assoc, +- mul_comm] +- simp only [Int.reduceNeg, map_pow, map_neg, map_one] +- rw [Algebra.smul_def, algebraMap_eq, map_natCast, ← mul_assoc, ← mul_assoc, add_comm, +- Nat.add_choose, mul_assoc, mul_assoc, mul_assoc, mul_assoc, mul_assoc, mul_comm] +- nth_rewrite 5 [mul_comm] +- congr 1 +- nth_rewrite 2 [mul_comm] +- rw [← mul_assoc, ← mul_assoc, ← mul_assoc] +- congr 1 +- nth_rewrite 3 [mul_comm] +- congr 1 +- apply Polynomial.ext +- intro m +- simp only [one_div, coeff_mul_C, coeff_natCast_ite, Nat.cast_ite, CharP.cast_eq_zero, ite_mul, +- zero_mul] +- by_cases h : m = 0 +- · simp [h] +- rw [Nat.cast_div] +- · rw [← one_div, ← div_mul_eq_div_mul_one_div] +- norm_cast +- rw [Nat.cast_div] +- · exact Nat.factorial_mul_factorial_dvd_factorial_add x n +- · norm_cast +- apply mul_ne_zero (Nat.factorial_ne_zero x) (Nat.factorial_ne_zero n) +- · exact Nat.factorial_dvd_factorial (by omega) +- · norm_cast; exact Nat.factorial_ne_zero x +- · simp only [h, ↓reduceIte] ++/-- The expand of `aperyShiftedLegendre n`. -/ ++theorem shiftedLegendre_eq_sum (n : ℕ) : aperyShiftedLegendre n = ++ ∑ k ∈ Finset.range (n + 1), ++ C ((-1) ^ k : ℝ) * (Nat.choose n k : ℝ[X]) * ++ (Nat.choose (n + k) n : ℝ[X]) * X ^ k := by ++ simp only [aperyShiftedLegendre, shiftedLegendre, Polynomial.map_sum, ++ Polynomial.map_mul, Polynomial.map_pow, Polynomial.map_X, ++ map_mul, map_pow, map_neg, map_one, map_natCast, ++ Polynomial.map_neg, Polynomial.map_one, Polynomial.map_natCast] + +-/-- `shiftedLegendre n` is an integer polynomial. -/ +-lemma shiftedLegendre_eq_int_poly (n : ℕ) : ∃ a : ℕ → ℤ, shiftedLegendre n = ++/-- `aperyShiftedLegendre n` is an integer polynomial. -/ ++lemma shiftedLegendre_eq_int_poly (n : ℕ) : ∃ a : ℕ → ℤ, aperyShiftedLegendre n = + ∑ k ∈ Finset.range (n + 1), (a k : ℝ[X]) * X ^ k := by + simp_rw [shiftedLegendre_eq_sum] + use fun k => (- 1) ^ k * (Nat.choose n k) * (Nat.choose (n + k) n) +@@ -99,40 +72,14 @@ lemma deriv_one_sub_X {n i : ℕ} : (⇑derivative)^[i] ((1 - X) ^ n : ℝ[X]) = + Polynomial.iterate_derivative_X_pow_eq_smul, Algebra.smul_def, algebraMap_eq, map_natCast] + simp + +-/-- The values ​​of the shiftedLegendre polynomial at x and 1-x differ by a factor (-1)ⁿ. -/ +--- lemma shiftedLegendre_eval_symm (n : ℕ) (x : ℝ) : +--- eval x (shiftedLegendre n) = (-1) ^ n * eval (1 - x) (shiftedLegendre n) := by +--- rw [mul_comm] +--- simp only [shiftedLegendre, eval_mul, one_div, eval_C] +--- rw [mul_assoc] +--- simp only [mul_eq_mul_left_iff, inv_eq_zero, Nat.cast_eq_zero]; left +--- rw [Polynomial.iterate_derivative_mul] +--- simp only [Nat.succ_eq_add_one, nsmul_eq_mul] +--- rw [Polynomial.eval_finset_sum, Polynomial.eval_finset_sum, ← Finset.sum_flip, Finset.sum_mul] +--- congr! 1 with i hi +--- simp only [Polynomial.iterate_derivative_X_pow_eq_smul, eval_mul, eval_natCast, +--- Algebra.smul_mul_assoc, eval_smul, eval_mul, eval_pow, eval_X, smul_eq_mul] +--- simp only [Finset.mem_range, Nat.lt_add_one_iff] at hi +--- rw [Nat.choose_symm hi, deriv_one_sub_X, deriv_one_sub_X] +--- simp only [nsmul_eq_mul, eval_mul, eval_pow, eval_neg, eval_one, eval_natCast, eval_sub, eval_X, +--- sub_sub_cancel] +--- rw [mul_assoc] +--- simp only [mul_eq_mul_left_iff, Nat.cast_eq_zero]; left +--- rw [show n - (n - i) = i by omega, ← mul_assoc, ← mul_assoc, mul_comm, ← mul_assoc] +--- symm +--- rw [← mul_assoc] +--- nth_rewrite 4 [mul_comm] +--- rw [← mul_assoc, ← mul_assoc, mul_assoc] +--- congr 1 +--- rw [← pow_add, show i + n = n - i + 2 * i by omega, pow_add] +--- simp only [even_two, Even.mul_right, Even.neg_pow, one_pow, mul_one] +- + theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} + (ha : a > 0) (hx : 1 - a * x = 0) : + ¬DifferentiableAt ℝ (fun x ↦ ↑n ! * a ^ n / (1 - a * x) ^ (n + 1)) x := by + intro h + obtain q := h.continuousAt +- simp [Metric.continuousAt_iff, Real.dist_eq, hx] at q ++ simp only [Metric.continuousAt_iff, gt_iff_lt, Real.dist_eq, hx, ne_eq, ++ Nat.add_eq_zero_iff, one_ne_zero, and_false, not_false_eq_true, zero_pow, div_zero, ++ dist_zero_right, norm_div, norm_mul, RCLike.norm_natCast, norm_pow, Real.norm_eq_abs] at q + have h₁ : ↑n ! * |a| ^ n > 0 := by + apply mul_pos + · simp only [Nat.cast_pos] +@@ -150,19 +97,20 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} + suffices 0 < q * a * q by linarith + exact mul_pos (mul_pos qq ha) qq + _ < 1 / 2 * q := by +- rw [mul_lt_mul_right (a := q) qq] ++ rw [mul_lt_mul_iff_left₀ qq] + linarith + _ < q := by linarith + specialize qqq this + rw [div_lt_iff₀] at qqq + · have : 1 < |1 - a * (a * q / 2 * q + x)| ^ (n + 1) := by +- rwa [← mul_lt_mul_left (a := ↑n ! * |a| ^ n) h₁, mul_one] ++ rwa [← mul_lt_mul_iff_right₀ h₁, mul_one] + rw [mul_add, add_comm, ← sub_sub, hx, zero_sub, abs_neg] at this + have : |a * (a * q / 2 * q)| ^ (n + 1) < 1 := by +- apply pow_lt_one₀ (by simp) _ (by omega) ++ apply pow_lt_one₀ (abs_nonneg _) _ (by omega) + · nth_rewrite 2 [mul_comm] + rw [← mul_assoc, ← mul_div_assoc, ← pow_two] +- rw [show |((a * q) ^ 2 / 2 : ℝ)| = ((a * q) ^ 2 / 2 : ℝ) by exact abs_eq_self.2 (by positivity)] ++ rw [show |((a * q) ^ 2 / 2 : ℝ)| = ((a * q) ^ 2 / 2 : ℝ) by ++ exact abs_eq_self.2 (by positivity)] + trans 1 / 2 + · rw [div_lt_div_iff_of_pos_right (by norm_num), ← one_pow (n := 2)] + apply pow_lt_pow_left₀ <;> nlinarith +@@ -175,13 +123,13 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} + rw [← mul_assoc, ← mul_div_assoc, ← pow_two] + positivity + · have : |q / 2 + x - x| < q := by +- simp only [one_div, add_sub_cancel_right] ++ simp only [add_sub_cancel_right] + rw [show |(q / 2 : ℝ)| = (q / 2 : ℝ) by exact abs_eq_self.2 (by linarith)] + linarith + specialize qqq this + rw [div_lt_iff₀] at qqq + · have : 1 < |1 - a * (q / 2 + x)| ^ (n + 1) := by +- rwa [← mul_lt_mul_left (a := ↑n ! * |a| ^ n) h₁, mul_one] ++ rwa [← mul_lt_mul_iff_right₀ h₁, mul_one] + rw [mul_add, add_comm, ← sub_sub, hx, zero_sub, abs_neg, ← mul_div_assoc, h2] at this + have : 1 < (1 / 2 : ℝ) := by + suffices (1 : ℝ) ≥ |(1 / 2 : ℝ)| ^ (n + 1) by linarith +@@ -192,8 +140,7 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} + rw [abs_pos] + linarith + · have : |1 / a + x - x| < q := by +- simp only [one_div, add_sub_cancel_right] +- rw [← one_div] ++ simp only [add_sub_cancel_right] + have : |(1 / a : ℝ)| = (1 / a : ℝ) := by + rw [abs_eq_self, one_div_nonneg] + linarith +@@ -201,7 +148,7 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} + specialize qqq this + rw [div_lt_iff₀] at qqq + · have : 1 < |1 - a * (1 / a + x)| ^ (n + 1) := by +- rwa [← mul_lt_mul_left (a := ↑n ! * |a| ^ n) h₁, mul_one] ++ rwa [← mul_lt_mul_iff_right₀ h₁, mul_one] + rw [mul_add, add_comm, ← sub_sub, hx, zero_sub, abs_neg, ← mul_div_assoc, mul_one, + div_self (by linarith)] at this + simp only [abs_one, one_pow, lt_self_iff_false] at this +@@ -211,20 +158,20 @@ theorem differentiableAt_inv_special {x a : ℝ} {n : ℕ} + + lemma n_derivative {a : ℝ} (n : ℕ) (ha : a > 0) : deriv^[n] (fun x ↦ 1 / (1 - a * x)) = + fun x ↦ (n) ! * (a ^ n) / (1 - a * x) ^ (n + 1) := by +- induction' n with n hn +- · simp +- · ext x ++ induction n with ++ | zero => simp ++ | succ n hn => ++ ext x + rcases eq_or_ne (1 - a * x) 0 with (h | hne) + · simp only [h, ne_eq, add_eq_zero, one_ne_zero, and_false, not_false_eq_true, + zero_pow, div_zero] + rw [Function.iterate_succ_apply', hn] + apply deriv_zero_of_not_differentiableAt + exact differentiableAt_inv_special ha h +- · rw [Function.iterate_succ_apply', hn, deriv_div] +- · simp only [differentiableAt_const, deriv_mul, deriv_const', zero_mul, deriv_pow'', +- mul_zero, add_zero, zero_sub] ++ · rw [Function.iterate_succ_apply', hn, deriv_fun_div] ++ · simp only [deriv_const', zero_mul, zero_sub] + rw [div_eq_div_iff] +- · rw [deriv_pow'', deriv_const_sub, deriv_const_mul] ++ · rw [deriv_fun_pow, deriv_const_sub, deriv_const_mul] + · simp only [Nat.cast_add, Nat.cast_one, add_tsub_cancel_right, deriv_id'', mul_one, + mul_neg, neg_neg] + norm_cast +@@ -253,7 +200,9 @@ theorem differentiableAt_inv_special' (c x y z : ℝ) (n : ℕ) (hc : c ≠ 0) ( + ¬DifferentiableAt ℝ (fun y ↦ c / (1 - (1 - x * y) * z) ^ (n + 1)) y := by + intro h + obtain q := h.continuousAt +- simp [Metric.continuousAt_iff, Real.dist_eq, h1] at q ++ simp only [Metric.continuousAt_iff, gt_iff_lt, Real.dist_eq, h1, ne_eq, ++ Nat.add_eq_zero_iff, one_ne_zero, and_false, not_false_eq_true, zero_pow, div_zero, ++ dist_zero_right, norm_div, Real.norm_eq_abs, norm_pow] at q + simp only [Set.mem_Ioo] at hx hz + have h₁ : |c| > 0 := by simp [hc] + specialize q (|c|) h₁ +@@ -270,9 +219,9 @@ theorem differentiableAt_inv_special' (c x y z : ℝ) (n : ℕ) (hc : c ≠ 0) ( + exact min_le_left (q / 2) (1 / |x * z|) + have hd' : 1 - (1 - x * d) * z ≠ 0 := by + suffices 1 - (1 - x * d) * z > 0 by linarith +- rw [h', show 1 - (1 - x * (d' + y)) * z = 1 - (1 - x * y) * z + x * z * d' by ring, h1, zero_add] +- apply mul_pos +- apply mul_pos (by linarith) (by linarith) ++ rw [h', show 1 - (1 - x * (d' + y)) * z = ++ 1 - (1 - x * y) * z + x * z * d' by ring, h1, zero_add] ++ refine mul_pos (mul_pos (by linarith) (by linarith)) ?_ + simp only [d'] + apply lt_min (by positivity) + simp only [one_div, inv_pos, abs_pos, ne_eq, mul_eq_zero, not_or] +@@ -290,9 +239,8 @@ theorem differentiableAt_inv_special' (c x y z : ℝ) (n : ℕ) (hc : c ≠ 0) ( + rw [← abs_one_div] + apply abs_le_abs_of_nonneg (by positivity) + simp only [d'] +- rw [abs_of_nonneg (a := x * z)] ++ rw [abs_of_nonneg (mul_nonneg (by linarith) (by linarith) : 0 ≤ x * z)] + exact min_le_right (q / 2) (1 / (x * z)) +- exact mul_nonneg (by linarith) (by linarith) + _ = 1 := by + rw [mul_div, mul_one, div_self] + simp only [ne_eq, abs_eq_zero, mul_eq_zero, not_or] +@@ -305,13 +253,14 @@ theorem differentiableAt_inv_special' (c x y z : ℝ) (n : ℕ) (hc : c ≠ 0) ( + lemma n_derivative' {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : + (deriv^[n] fun y ↦ 1 / (1 - (1 - x * y) * z)) = + (fun y ↦ (-1) ^ n * (n) ! * (x * z) ^ n / (1 - (1 - x * y) * z) ^ (n + 1)) := by +- induction' n with n hn +- · simp +- · ext y ++ induction n with ++ | zero => simp ++ | succ n hn => ++ ext y + rcases eq_or_ne (1 - (1 - x * y) * z) 0 with (h | hne) + · simp only [h, ne_eq, add_eq_zero, one_ne_zero, and_false, not_false_eq_true, + zero_pow, div_zero] +- simp only [Set.mem_Ioo, Set.mem_Icc] at hx hz ++ simp only [Set.mem_Ioo] at hx hz + rw [Function.iterate_succ_apply', hn] + apply deriv_zero_of_not_differentiableAt + set c := (-1) ^ n * ↑n ! * (x * z) ^ n +@@ -323,17 +272,18 @@ lemma n_derivative' {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ S + · apply pow_ne_zero + nlinarith + exact differentiableAt_inv_special' c x y z n hc hx hz h +- · rw [Function.iterate_succ_apply', hn, deriv_div] +- · simp only [differentiableAt_const, deriv_mul, deriv_const', zero_mul, deriv_pow'', +- mul_zero, add_zero, zero_sub] +- have h : (fun y ↦ (1 - (1 - x * y) * z) ^ (n + 1)) = fun y ↦ (1 - z + x * z * y) ^ (n + 1) := by ++ · rw [Function.iterate_succ_apply', hn, deriv_fun_div] ++ · simp only [deriv_const', zero_mul, zero_sub] ++ have h : (fun y ↦ (1 - (1 - x * y) * z) ^ (n + 1)) = ++ fun y ↦ (1 - z + x * z * y) ^ (n + 1) := by + ext _; ring + rw [div_eq_div_iff] +- · rw [h, deriv_pow'', deriv_const_add, deriv_const_mul] ++ · rw [h, deriv_fun_pow, deriv_const_add, deriv_const_mul] + · simp only [Nat.cast_add, Nat.cast_one, add_tsub_cancel_right, deriv_id'', mul_one, + ← neg_mul] + rw [show -(-1) ^ n = (-1 : ℝ) ^ (n + 1) by ring, +- show ((n + 1)! : ℝ) = (((n : ℕ) + 1) : ℝ) * (n !) by rw [Nat.factorial_succ]; norm_cast] ++ show ((n + 1)! : ℝ) = (((n : ℕ) + 1) : ℝ) * (n !) by ++ rw [Nat.factorial_succ]; norm_cast] + ring + · apply differentiableAt_id + · apply DifferentiableAt.add +@@ -352,16 +302,17 @@ lemma n_derivative' {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ S + apply DifferentiableAt.const_mul differentiableAt_id + · exact pow_ne_zero (n + 1) hne + +-lemma shiftedLegendre_poly_eval_zero_eq_zero {m : ℕ} (h : m < n) : ++lemma shiftedLegendre_poly_eval_zero_eq_zero {n m : ℕ} (h : m < n) : + eval 0 ((⇑derivative)^[m] (X ^ n * (1 - X) ^ n) : ℝ[X]) = 0 := by +- rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] ++ rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finsetSum] + apply Finset.sum_eq_zero + intro x hx + simp_all only [Nat.succ_eq_add_one, Finset.mem_range, nsmul_eq_mul, eval_mul, eval_natCast, + mul_eq_zero, Nat.cast_eq_zero] + right; left + simp only [Polynomial.iterate_derivative_X_pow_eq_smul, eval_smul, eval_pow, eval_X, smul_eq_mul, +- mul_eq_zero, Nat.cast_eq_zero, Nat.descFactorial_eq_zero_iff_lt, pow_eq_zero_iff', ne_eq, true_and] ++ mul_eq_zero, Nat.cast_eq_zero, Nat.descFactorial_eq_zero_iff_lt, pow_eq_zero_iff', ++ ne_eq, true_and] + right + suffices n - (m - x) > 0 by linarith + simp only [gt_iff_lt, tsub_pos_iff_lt] +@@ -370,9 +321,9 @@ lemma shiftedLegendre_poly_eval_zero_eq_zero {m : ℕ} (h : m < n) : + m - x ≤ m := by simp + _ < n := by exact h + +-lemma shiftedLegendre_poly_eval_one_eq_zero {m : ℕ} (h : m < n) : ++lemma shiftedLegendre_poly_eval_one_eq_zero {n m : ℕ} (h : m < n) : + eval 1 ((⇑derivative)^[m] (X ^ n * (1 - X) ^ n) : ℝ[X]) = 0 := by +- rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] ++ rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finsetSum] + apply Finset.sum_eq_zero + intro x hx + simp_all only [Nat.succ_eq_add_one, Finset.mem_range, nsmul_eq_mul, eval_mul, eval_natCast, +@@ -391,29 +342,11 @@ lemma shiftedLegendre_poly_eval_one_eq_zero {m : ℕ} (h : m < n) : + linarith + + lemma shiftedLegendre_continuousOn {n m : ℕ} : ContinuousOn +- (fun x ↦ eval x ((⇑derivative)^[n - m] (X ^ n * (1 - X) ^ n : ℝ[X]))) (Set.uIcc 0 1) := by +- simp_rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] +- apply continuousOn_finset_sum +- intro i _ +- simp_rw [Algebra.smul_def, eval_mul] +- apply ContinuousOn.mul +- · simp only [eq_natCast, eval_natCast, ge_iff_le, zero_le_one, Set.uIcc_of_le] +- apply continuousOn_const +- · apply ContinuousOn.mul +- · simp_rw [Polynomial.iterate_derivative_X_pow_eq_smul] +- simp only [eval_smul, eval_pow, eval_X, smul_eq_mul, ge_iff_le, zero_le_one, +- Set.uIcc_of_le] +- apply ContinuousOn.mul continuousOn_const (ContinuousOn.pow continuousOn_id _) +- · rw [show (1 - X : ℝ[X]) ^ n = (X ^ n : ℝ[X]).comp (1 - X) by simp, +- Polynomial.iterate_derivative_comp_one_sub_X (p := X ^ n), +- Polynomial.iterate_derivative_X_pow_eq_smul] +- simp only [smul_comp, pow_comp, X_comp, Algebra.mul_smul_comm, eval_smul, eval_mul, +- eval_pow, eval_neg, eval_one, eval_sub, eval_X, smul_eq_mul, ge_iff_le, zero_le_one, +- Set.uIcc_of_le] +- refine ContinuousOn.mul continuousOn_const (ContinuousOn.mul continuousOn_const ?_) +- apply ContinuousOn.pow (ContinuousOn.sub continuousOn_const continuousOn_id) ++ (fun x ↦ eval x ((⇑derivative)^[n - m] (X ^ n * (1 - X) ^ n : ℝ[X]))) (Set.uIcc 0 1) := ++ (Polynomial.continuous _).continuousOn + +-lemma special_deriv_div_continuousOn {m : ℕ} {x z: ℝ} (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : ++lemma special_deriv_div_continuousOn {m : ℕ} {x z : ℝ} ++ (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : + ContinuousOn (fun u ↦ (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)) u) (Set.uIcc 0 1) := by + simp_rw [n_derivative' m hx hz] + apply ContinuousOn.div continuousOn_const +@@ -437,58 +370,26 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m + eval y ((⇑derivative)^[n] (X ^ n * (1 - X) ^ n)) * (fun y ↦ 1 / (1 - (1 - x * y) * z)) y = + (- 1) ^ m * ∫ (y : ℝ) in (0)..1, eval y ((⇑derivative)^[n - m] (X ^ n * (1 - X) ^ n)) * + (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)) y:= by +- induction' m with m hm +- · simp +- · have h₀ : m < n := by linarith ++ induction m with ++ | zero => simp ++ | succ m hm => ++ have h₀ : m < n := by linarith + have h₁ : n - (m + 1) < n := by omega + rw [hm (LT.lt.le h₀), pow_add, pow_one, mul_assoc] + congr + symm + rw [show n - m = n - (m + 1) + 1 by omega, Function.iterate_succ_apply'] +- rw [neg_one_mul, neg_eq_iff_eq_neg, intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt ++ rw [neg_one_mul, neg_eq_iff_eq_neg, ++ intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt + (u := fun u ↦ eval u ((⇑derivative)^[n - (m + 1)] (X ^ n * (1 - X) ^ n : ℝ[X]))) + (u' := fun u ↦ eval u (derivative ((⇑derivative)^[n - (m + 1)] (X ^ n * (1 - X) ^ n : ℝ[X])))) + (v := fun u ↦ (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)) u)] + · rw [shiftedLegendre_poly_eval_one_eq_zero h₁, shiftedLegendre_poly_eval_zero_eq_zero h₁] +- simp only [one_mul, one_div, zero_mul, sub_zero, sub_self, zero_sub, +- Function.iterate_succ_apply', neg_inj] ++ simp only [one_div, zero_mul, sub_self, zero_sub, Function.iterate_succ_apply'] + · apply shiftedLegendre_continuousOn + · apply special_deriv_div_continuousOn hx hz +- · intro x _ +- simp_rw [Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] +- simp only [Nat.succ_eq_add_one, nsmul_eq_mul, eval_mul, eval_natCast, map_sum, eval_finset_sum] +- apply HasDerivAt.sum +- intro i _ +- simp only [derivative_mul, derivative_natCast, zero_mul, zero_add, eval_mul, eval_natCast, +- eval_add] +- apply HasDerivAt.const_mul +- apply HasDerivAt.mul +- · rw [Polynomial.iterate_derivative_X_pow_eq_smul] +- simp only [eval_smul, eval_pow, eval_X, smul_eq_mul, LinearMapClass.map_smul, +- derivative_X_pow, map_natCast, eval_mul, eval_natCast] +- apply HasDerivAt.const_mul +- apply hasDerivAt_pow +- · rw [show (1 - X : ℝ[X]) ^ n = (X ^ n : ℝ[X]).comp (1 - X) by simp, +- Polynomial.iterate_derivative_comp_one_sub_X (p := X ^ n), +- Polynomial.iterate_derivative_X_pow_eq_smul] +- simp only [smul_comp, pow_comp, X_comp, Algebra.mul_smul_comm, eval_smul, eval_mul, +- eval_pow, eval_neg, eval_one, eval_sub, eval_X, smul_eq_mul, LinearMapClass.map_smul] +- apply HasDerivAt.const_mul +- simp only [derivative_mul, eval_add, eval_mul, eval_pow, eval_sub, eval_one, eval_X, +- eval_neg] +- have h1 : (derivative ((-1) ^ i : ℝ[X])) = 0 := by +- rw [show ((-1) ^ i : ℝ[X]) = C ((-1) ^ i) by simp, derivative_C] +- rw [h1, eval_zero, zero_mul, zero_add] +- apply HasDerivAt.const_mul +- rw [show (1 - X : ℝ[X]) ^ (n - i) = (X ^ (n - i) : ℝ[X]).comp (1 - X) by simp, +- Polynomial.derivative_comp_one_sub_X (p := X ^ (n - i)), +- Polynomial.derivative_X_pow] +- simp only [mul_comp, pow_comp, X_comp, eval_mul, map_natCast, natCast_comp, eval_neg, +- eval_mul, eval_natCast, eval_pow, eval_sub, eval_one, eval_X] +- rw [← mul_neg_one] +- apply HasDerivAt.pow +- apply HasDerivAt.const_sub +- apply hasDerivAt_id ++ · intro u _ ++ exact Polynomial.hasDerivAt _ u + · intro y hy + simp only [Set.mem_Ioo, zero_le_one, min_eq_left, max_eq_right] at hx hy hz + have hh : 1 - (1 - x * y) * z ≠ 0 := by +@@ -502,7 +403,8 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m + Function.eval u (deriv (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z))) := by + simp only [one_div, Function.eval] + simp_rw [this] +- simp_rw [← Function.iterate_succ_apply', Nat.succ_eq_add_one, Function.eval, n_derivative' _ hx hz] ++ simp_rw [← Function.iterate_succ_apply', Nat.succ_eq_add_one, Function.eval, ++ n_derivative' _ hx hz] + have : (-1) ^ (m + 1) * ↑(m + 1)! * (x * z) ^ (m + 1) / (1 - (1 - x * y) * z) ^ (m + 1 + 1) + = (0 * (1 - (1 - x * y) * z) ^ (m + 1) - + (-1) ^ m * ↑m ! * (x * z) ^ m * ((m + 1) * (x * z) * (1 - (1 - x * y) * z) ^ m)) / +@@ -519,14 +421,16 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m + rw [this] + apply HasDerivAt.div + · apply hasDerivAt_const +- · have : (↑m + 1) * (x * z) * (1 - (1 - x * y) * z) ^ m = deriv (fun y ↦ (1 - (1 - x * y) * z) ^ (m + 1)) y := by ++ · have : (↑m + 1) * (x * z) * (1 - (1 - x * y) * z) ^ m = ++ deriv (fun y ↦ (1 - (1 - x * y) * z) ^ (m + 1)) y := by + simp only [show 1 - (1 - x * y) * z = 1 - z + x * z * y by ring] +- rw [deriv_pow'', show (fun y ↦ 1 - (1 - x * y) * z) = (fun y ↦ 1 - z + x * z * y) by ext _; ring] +- · rw[deriv_const_add, deriv_const_mul] ++ rw [deriv_fun_pow, show (fun y ↦ 1 - (1 - x * y) * z) = ++ (fun y ↦ 1 - z + x * z * y) by ext _; ring] ++ · rw [deriv_const_add, deriv_const_mul] + · simp only [Nat.cast_add, Nat.cast_one, add_tsub_cancel_right, deriv_id'', mul_one] + norm_cast + ring +- · exact differentiableAt_id' ++ · exact differentiableAt_id + · apply DifferentiableAt.const_sub + apply DifferentiableAt.mul_const + · apply DifferentiableAt.const_sub +@@ -538,24 +442,7 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m + · apply DifferentiableAt.const_sub + apply DifferentiableAt.const_mul differentiableAt_id + · apply pow_ne_zero _ hh +- · simp_rw [← Function.iterate_succ_apply', Polynomial.iterate_derivative_mul, Polynomial.eval_finset_sum] +- simp only [Nat.succ_eq_add_one, nsmul_eq_mul, eval_mul, eval_natCast] +- apply ContinuousOn.intervalIntegrable_of_Icc (by norm_num) +- apply continuousOn_finset_sum +- intro i _ +- apply ContinuousOn.mul continuousOn_const +- · apply ContinuousOn.mul +- · simp_rw [Polynomial.iterate_derivative_X_pow_eq_smul] +- simp only [eval_smul, eval_pow, eval_X, smul_eq_mul] +- apply ContinuousOn.mul continuousOn_const (ContinuousOn.pow continuousOn_id _) +- · rw [show (1 - X : ℝ[X]) ^ n = (X ^ n : ℝ[X]).comp (1 - X) by simp, +- Polynomial.iterate_derivative_comp_one_sub_X (p := X ^ n), +- Polynomial.iterate_derivative_X_pow_eq_smul] +- simp only [smul_comp, pow_comp, X_comp, Algebra.mul_smul_comm, eval_smul, eval_mul, +- eval_pow, eval_neg, eval_one, eval_sub, eval_X, smul_eq_mul, ge_iff_le, zero_le_one, +- Set.uIcc_of_le] +- refine ContinuousOn.mul continuousOn_const (ContinuousOn.mul continuousOn_const ?_) +- apply ContinuousOn.pow (ContinuousOn.sub continuousOn_const continuousOn_id) ++ · exact (Polynomial.continuous _).intervalIntegrable _ _ + · have : deriv (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)) = + (Function.eval · (deriv (deriv^[m] fun y ↦ 1 / (1 - (1 - x * y) * z)))) := by + ext x +@@ -566,24 +453,25 @@ lemma integral_shiftedLegendre_mul_smooth_eq_aux {x z : ℝ} (n m : ℕ) (h : m + rw [← Set.uIcc_of_le (by norm_num)] + apply special_deriv_div_continuousOn hx hz + +-lemma integral_legendre_mul_smooth_eq {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : +- ∫ (y : ℝ) in (0)..1, eval y (shiftedLegendre n) * (fun y ↦ 1 / (1 - (1 - x * y) * z)) y = ++lemma integral_legendre_mul_smooth_eq {x z : ℝ} (n : ℕ) ++ (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : ++ ∫ (y : ℝ) in (0)..1, eval y (aperyShiftedLegendre n) * (fun y ↦ 1 / (1 - (1 - x * y) * z)) y = + (- 1) ^ n / n ! * ∫ (y : ℝ) in (0)..1, y ^ n * (1 - y) ^ n * + (deriv^[n] fun y ↦ 1 / (1 - (1 - x * y) * z)) y := by +- simp only [eval_mul, one_div, eval_C, shiftedLegendre] ++ simp only [eval_mul, one_div, eval_C, aperyShiftedLegendre_eq_rodrigues] + simp_rw [mul_assoc, intervalIntegral.integral_const_mul] + rw [← mul_one_div, one_div] + nth_rw 4 [mul_comm] + rw [mul_assoc] + congr + obtain h := integral_shiftedLegendre_mul_smooth_eq_aux (n := n) (m := n) (by norm_num) hx hz +- simp only [one_div, ge_iff_le, le_refl, tsub_eq_zero_of_le, Function.iterate_zero, id_eq, ++ simp only [one_div, le_refl, tsub_eq_zero_of_le, Function.iterate_zero, id_eq, + eval_mul, eval_pow, eval_X, eval_sub, eval_one] at h + rw [h] + simp_rw [← mul_assoc] + + lemma legendre_integral_special {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) (hz : z ∈ Set.Ioo 0 1) : +- ∫ (y : ℝ) in (0)..1, eval y (shiftedLegendre n) * (1 / (1 - (1 - x * y) * z)) = ++ ∫ (y : ℝ) in (0)..1, eval y (aperyShiftedLegendre n) * (1 / (1 - (1 - x * y) * z)) = + ∫ (y : ℝ) in (0)..1, (x * y * z) ^ n * (1 - y) ^ n / (1 - (1 - x * y) * z) ^ (n + 1) := by + rw [integral_legendre_mul_smooth_eq n hx hz, ← intervalIntegral.integral_const_mul, + intervalIntegral.integral_of_le (by norm_num), intervalIntegral.integral_of_le (by norm_num), +@@ -622,3 +510,5 @@ lemma legendre_integral_special {x z : ℝ} (n : ℕ) (hx : x ∈ Set.Ioo 0 1) ( + apply mul_le_of_le_one_left (by linarith) + simp only [tsub_le_iff_right, le_add_iff_nonneg_right] + nlinarith ++ ++end Polynomial +diff --git a/Zeta3Irrational/LinearForm.lean b/Zeta3Irrational/LinearForm.lean +index e90d872..4c678c9 100644 +--- a/Zeta3Irrational/LinearForm.lean ++++ b/Zeta3Irrational/LinearForm.lean +@@ -1,6 +1,8 @@ + import Zeta3Irrational.Integral + import Zeta3Irrational.d + ++/-! # Integer linear forms for the Apéry integrals -/ ++ + open scoped Nat + open BigOperators + +@@ -17,7 +19,7 @@ lemma J_rr_linear (r : ℕ) : + simp only [sub_right_inj] + simp_rw [eq_div_iff d_cube_ne_zero, Finset.mul_sum, Finset.sum_mul] + use ∑ i ∈ Finset.Icc 1 r, 2 * ↑(d (Finset.Icc 1 r)) ^ 3 / ↑i ^ 3 +- simp only [Int.cast_sum, Int.cast_mul, Int.cast_ofNat, Int.cast_pow, Int.cast_natCast] ++ simp only [Int.cast_sum] + apply Finset.sum_congr rfl + intro x hx + rw [mul_assoc] +@@ -33,7 +35,8 @@ lemma J_rr_linear (r : ℕ) : + not_false_eq_true, pow_eq_zero_iff, Nat.cast_eq_zero] + linarith + +-lemma Icc_diff_Icc {r s : ℕ} (_ : r > s) (_ : ¬s = 0) : Finset.Icc 1 r \ Finset.Icc 1 s = Finset.Icc (s + 1) r := by ++lemma Icc_diff_Icc {r s : ℕ} (_ : r > s) (_ : ¬s = 0) : ++ Finset.Icc 1 r \ Finset.Icc 1 s = Finset.Icc (s + 1) r := by + ext x + constructor + · intro hx +@@ -54,9 +57,9 @@ lemma one_div_sum_eq {r s : ℕ} (h : r > s) : + simp_all + else + simp_rw [← Nat.cast_add] +- rw [Icc_diff_Icc h h1, ← Nat.Ico_succ_right, ← Nat.Ico_succ_right, +- Finset.sum_Ico_add (f := fun (x : ℕ) => 1 / ((x ^ 2) : ℝ)) (c := s), Nat.succ_eq_add_one, +- Nat.succ_eq_add_one, add_comm, show r - s + 1 + s = r + 1 by omega] ++ rw [Icc_diff_Icc h h1, ← Finset.Ico_add_one_right_eq_Icc, ← Finset.Ico_add_one_right_eq_Icc, ++ Finset.sum_Ico_add (f := fun (x : ℕ) => 1 / ((x ^ 2) : ℝ)) (c := s), add_comm, ++ show r - s + 1 + s = r + 1 by omega] + · exact Finset.Icc_subset_Icc_right (LT.lt.le (gt_iff_lt.1 h)) + + lemma J_rs_linear {r s : ℕ} (h : r > s) : ∃ a : ℤ, J r s = a / (d (Finset.Icc 1 r)) ^ 3 := by +@@ -76,7 +79,7 @@ lemma J_rs_linear {r s : ℕ} (h : r > s) : ∃ a : ℤ, J r s = a / (d (Finset. + · norm_cast + rw [d_sq'] + apply dvd_d_of_mem +- simp_all only [gt_iff_lt, Finset.mem_Icc, Finset.mem_image, ge_iff_le, zero_le, ne_eq, ++ simp_all only [gt_iff_lt, Finset.mem_Icc, Finset.mem_image, zero_le, ne_eq, + OfNat.ofNat_ne_zero, not_false_eq_true, pow_left_inj₀, exists_eq_right] + omega + · simp_all only [gt_iff_lt, Finset.mem_Icc, Int.cast_pow, Int.cast_add, Int.cast_natCast, +@@ -94,38 +97,44 @@ lemma J_rs_linear {r s : ℕ} (h : r > s) : ∃ a : ℤ, J r s = a / (d (Finset. + rw [← Nat.cast_sub (by linarith)] + norm_cast; linarith + +-lemma multi_integral_sum_comm (c : ℕ → ℤ) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++lemma multi_integral_sum_comm {n : ℕ} (c : ℕ → ℤ) : ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), + -(x.1 * x.2).log / (1 - x.1 * x.2) * ↑(c x_1) * x.1 ^ x_1 * ↑(c x_2) * x.2 ^ x_2 +- = ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++ = ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), ++ ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + -(x.1 * x.2).log / (1 - x.1 * x.2) * ↑(c x_1) * x.1 ^ x_1 * ↑(c x_2) * x.2 ^ x_2 := by + symm + calc +- _ = ∑ x_1 ∈ Finset.range (n + 1), ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ∑ x_2 ∈ Finset.range (n + 1), ++ _ = ∑ x_1 ∈ Finset.range (n + 1), ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++ ∑ x_2 ∈ Finset.range (n + 1), + -(x.1 * x.2).log / (1 - x.1 * x.2) * ↑(c x_1) * x.1 ^ x_1 * ↑(c x_2) * x.2 ^ x_2 := by + congr! 1 with a _ +- rw [← MeasureTheory.integral_finset_sum] ++ rw [← MeasureTheory.integral_finsetSum] + intro i _ + have h : (fun (x : ℝ × ℝ) ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * ↑(c a) * x.1 ^ a * +- ↑(c i) * x.2 ^ i) = (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ a * x.2 ^ i * (↑(c i) * ↑(c a))) := by ++ ↑(c i) * x.2 ^ i) = (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * ++ x.1 ^ a * x.2 ^ i * (↑(c i) * ↑(c a))) := by + ext x; ring + rw [h] + apply MeasureTheory.Integrable.mul_const + exact integrableOn_J_rs a i +- _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), ++ _ = ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++ ∑ x_1 ∈ Finset.range (n + 1), ∑ x_2 ∈ Finset.range (n + 1), + -(x.1 * x.2).log / (1 - x.1 * x.2) * ↑(c x_1) * x.1 ^ x_1 * ↑(c x_2) * x.2 ^ x_2 := by +- rw [← MeasureTheory.integral_finset_sum] ++ rw [← MeasureTheory.integral_finsetSum] + intro i _ +- apply MeasureTheory.integrable_finset_sum ++ apply MeasureTheory.integrable_finsetSum + intro j _ + have h : (fun (x : ℝ × ℝ) ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * ↑(c i) * x.1 ^ i * +- ↑(c j) * x.2 ^ j) = (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * x.1 ^ i * x.2 ^ j * (↑(c i) * ↑(c j))) := by ++ ↑(c j) * x.2 ^ j) = (fun x ↦ -Real.log (x.1 * x.2) / (1 - x.1 * x.2) * ++ x.1 ^ i * x.2 ^ j * (↑(c i) * ↑(c j))) := by + ext x; ring + rw [h] + apply MeasureTheory.Integrable.mul_const + exact integrableOn_J_rs i j + +-lemma multi_integral_mul_const (c d : ℕ) (p q : ℝ): ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, ++lemma multi_integral_mul_const (c d : ℕ) (p q : ℝ) : ++ ∫ (x : ℝ × ℝ) in Set.Ioo 0 1 ×ˢ Set.Ioo 0 1, + -(x.1 * x.2).log / (1 - x.1 * x.2) * p * x.1 ^ c * q * x.2 ^ d = p * q * J c d := by + simp only [J] + symm +@@ -135,11 +144,13 @@ lemma multi_integral_mul_const (c d : ℕ) (p q : ℝ): ∫ (x : ℝ × ℝ) in + simp only [smul_eq_mul] + ring + ++/-- Integer correction coefficient selected from the proved integral identities. -/ + noncomputable def p (r s : ℕ) : ℤ := + if h : r > s then (J_rs_linear h).choose + else if h : r < s then (J_rs_linear h).choose + else -(J_rr_linear r).choose + ++/-- The zeta coefficient: two on the diagonal and zero off the diagonal. -/ + noncomputable def q (r s : ℕ) : ℤ := + if r > s then 0 + else if r < s then 0 +@@ -156,27 +167,27 @@ lemma linear_int_aux : ∃ a b : ℕ → ℕ → ℤ, ∀ r s : ℕ, J r s = + use q + intro x y + if h : x > y then +- cases' (J_rs_linear h) with a ha ++ obtain ⟨a, ha⟩ := J_rs_linear h + simp only [p, q] +- simp_all only [gt_iff_lt, one_div, dite_eq_ite, ite_true, Int.cast_zero, zero_mul, dite_true, ++ simp_all only [gt_iff_lt, one_div, ite_true, Int.cast_zero, zero_mul, dite_true, + zero_add] + rw [(J_rs_linear h).choose_spec] at ha + rw [show x.max y = x by exact max_eq_left_iff.2 (LT.lt.le h)] + simp_all + else if h1 : x < y then +- cases' (J_rs_linear h1) with a ha ++ obtain ⟨a, ha⟩ := J_rs_linear h1 + simp only [p, q] + obtain h2 := J_symm x y +- simp_all only [gt_iff_lt, one_div, dite_eq_ite, ite_true, ite_self, Int.cast_zero, +- zero_mul, dite_true, zero_add, not_false_eq_true, dite_false] ++ simp_all only [gt_iff_lt, one_div, ite_true, ite_self, Int.cast_zero, ++ zero_mul, dite_true, zero_add, dite_false] + rw [(J_rs_linear h1).choose_spec] at ha + simp only [not_lt] at h + simp_all + else + have h : x = y := by linarith +- cases' (J_rr_linear y) with a ha ++ obtain ⟨a, ha⟩ := J_rr_linear y + simp only [p, q] +- simp_all only [gt_iff_lt, lt_self_iff_false, not_false_eq_true, dite_eq_ite, ite_false, ++ simp_all only [gt_iff_lt, lt_self_iff_false, not_false_eq_true, ite_false, + Int.cast_ofNat, not_isEmpty_of_nonempty, tsum_empty, mul_zero, zero_sub, sub_right_inj, + dite_false, Int.cast_neg, max_self] + rw [(J_rr_linear y).choose_spec, ← Mathlib.Tactic.RingNF.add_neg, ← neg_div] at ha +diff --git a/Zeta3Irrational/PrimeCounting.lean b/Zeta3Irrational/PrimeCounting.lean +new file mode 100644 +index 0000000..07a6c45 +--- /dev/null ++++ b/Zeta3Irrational/PrimeCounting.lean +@@ -0,0 +1,48 @@ ++import PrimeNumberTheoremAnd.ZetaFive.Consequences ++ ++/-! ++# Prime counting asymptotics from the proved prime number theorem ++ ++The current Mathlib Chebyshev remainder estimate converts the proved theta asymptotic ++into the exact all-real prime-counting formula used by the Apéry proof. ++-/ ++ ++open Filter Real Asymptotics ++open scoped Chebyshev ++ ++namespace AperyPNT ++ ++/-- The prime-counting function is asymptotic to `x / log x`. -/ ++theorem primeCounting_asymptotic : ++ (fun x : ℝ ↦ (Nat.primeCounting ⌊x⌋₊ : ℝ)) ~[atTop] (fun x ↦ x / log x) := by ++ have h := ZetaFivePNT.chebyshev_asymptotic.div (IsEquivalent.refl (u := Real.log)) ++ have h' := h.add_isLittleO Chebyshev.integral_theta_div_log_sq_isLittleO ++ apply h'.congr' ?_ (Filter.EventuallyEq.refl _ _) ++ filter_upwards [eventually_ge_atTop (2 : ℝ)] with x hx ++ simp only [Pi.sub_apply, Pi.add_apply, Pi.div_apply, id_eq] ++ rw [Chebyshev.primeCounting_eq_theta_div_log_add_integral hx] ++ ++/-- The exact prime-counting consequence, with an error tending to zero. -/ ++theorem pi_alt : ∃ c : ℝ → ℝ, c =o[atTop] (fun _ ↦ (1 : ℝ)) ∧ ++ ∀ x : ℝ, Nat.primeCounting ⌊x⌋₊ = (1 + c x) * x / log x := by ++ refine ⟨fun x ↦ (Nat.primeCounting ⌊x⌋₊ : ℝ) / (x / log x) - 1, ?_, ?_⟩ ++ · rw [isLittleO_one_iff] ++ have h := (isEquivalent_iff_tendsto_one ?_).mp primeCounting_asymptotic ++ · simpa using h.sub (tendsto_const_nhds (x := (1 : ℝ))) ++ · filter_upwards [eventually_gt_atTop (1 : ℝ)] with x hx ++ exact div_ne_zero (by positivity) (log_pos hx).ne' ++ · intro x ++ by_cases hx : x = 0 ++ · simp [hx] ++ by_cases hl : log x = 0 ++ · have hp : Nat.primeCounting ⌊x⌋₊ = 0 := by ++ apply Nat.primeCounting_eq_zero_iff.mpr ++ rcases log_eq_zero.mp hl with h | h | h ++ · exact (hx h).elim ++ · simp [h] ++ · simp [h, Nat.floor_of_nonpos] ++ simp [hl, hp] ++ · field_simp ++ ring ++ ++end AperyPNT +diff --git a/Zeta3Irrational/d.lean b/Zeta3Irrational/d.lean +index 027628c..343f95f 100644 +--- a/Zeta3Irrational/d.lean ++++ b/Zeta3Irrational/d.lean +@@ -4,32 +4,23 @@ Author: Junqi Liu and Jujian Zhang. + -/ + import Mathlib.Algebra.GCDMonoid.Finset + import Mathlib.Algebra.GCDMonoid.Nat ++import Mathlib.Data.Nat.GCD.Prime + import Mathlib.Analysis.SpecialFunctions.Log.Base + import Mathlib.Data.Nat.Choose.Factorization +-import Mathlib.Data.Real.StarOrdered ++import Mathlib.Analysis.Real.Sqrt + import Mathlib.NumberTheory.PrimeCounting + ++/-! ++# Least common multiples for the Apéry irrationality proof ++ ++We bound the least common multiple of the integers from one to `n` using prime counting. ++The natural-number normalization and GCD structures are Mathlib's canonical instances. ++-/ ++ + open scoped Nat + open BigOperators + +-instance : NormalizedGCDMonoid ℕ where +- normUnit _ := 1 +- normUnit_zero := rfl +- normUnit_mul := by simp +- normUnit_coe_units n := by +- rw [Nat.units_eq_one n] +- simp +- gcd := Nat.gcd +- lcm := Nat.lcm +- gcd_dvd_left := Nat.gcd_dvd_left +- gcd_dvd_right := Nat.gcd_dvd_right +- dvd_gcd := Nat.dvd_gcd +- gcd_mul_lcm m n := by rw [Nat.gcd_mul_lcm]; rfl +- lcm_zero_left := Nat.lcm_zero_left +- lcm_zero_right := Nat.lcm_zero_right +- normalize_gcd := by simp +- normalize_lcm := by simp +- ++/-- The least common multiple of the natural numbers in the finite set s. -/ + def d (s : Finset ℕ) : ℕ := s.lcm id + + theorem d_insert (s : Finset ℕ) (n : ℕ) : d (insert n s) = Nat.lcm n (d s) := by +@@ -57,10 +48,6 @@ theorem d_eq_zero (s : Finset ℕ) (hs : 0 ∈ s) : d s = 0 := by + rw [Finset.lcm_eq_zero_iff] + simpa + +-theorem Nat.Prime.dvd_lcm {p} (hp : Nat.Prime p) (a b) (h : p ∣ Nat.lcm a b) : p ∣ a ∨ p ∣ b := by +- have := h.trans <| Nat.lcm_dvd_mul a b +- rwa [Nat.Prime.dvd_mul hp] at this +- + theorem Nat.primeFactors_lcm {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) : + (a.lcm b).primeFactors = a.primeFactors ∪ b.primeFactors := by + ext p +@@ -69,7 +56,7 @@ theorem Nat.primeFactors_lcm {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) : + simp only [mem_primeFactorsList', ne_eq] + constructor + · rintro ⟨hp1, hp2, hp3⟩ +- obtain hp4|hp4 := hp1.dvd_lcm a b hp2 ++ obtain hp4|hp4 := hp1.dvd_or_dvd_of_dvd_lcm hp2 + · left; refine ⟨hp1, hp4, ?_⟩ + contrapose! hp3 + subst hp3 +@@ -88,240 +75,17 @@ theorem Nat.primeFactors_lcm {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) : + erw [lcm_eq_zero_iff] at hp3 + refine hp3.elim (fun ha' => absurd ha' ha) id + +-theorem d_sq (s : Finset ℕ) : (d s)^2 = d (s.image (· ^ 2)) := by ++theorem d_sq (s : Finset ℕ) : (d s) ^ 2 = d (s.image (· ^ 2)) := by + induction s using Finset.induction_on with + | empty => simp [d] +- | @insert i s hi ih => +- rw [d_insert, Finset.image_insert, d_insert, ← ih] +- refine dvd_antisymm ?_ ?_ +- · if hi : i = 0 +- then +- subst hi +- simp +- else +- if hs' : 0 ∈ s +- then +- rw [d_eq_zero _ hs'] +- simp +- else +- have hds : d s ≠ 0 := d_ne_zero s hs' +- have hi' : i^2 ≠ 0 := by simpa using hi +- have hds' : (d s)^2 ≠ 0 := by simpa using hds +- rw [← Nat.factorizationLCMLeft_mul_factorizationLCMRight, +- ← Nat.factorizationLCMLeft_mul_factorizationLCMRight, mul_pow] <;> try assumption +- +- apply mul_dvd_mul +- · delta Nat.factorizationLCMLeft +- erw [← Finset.prod_pow] +- dsimp only +- have eq1 := +- calc ∏ x ∈ (i.lcm (d s)).factorization.support, +- (if (d s).factorization x ≤ i.factorization x +- then x ^ (i.lcm (d s)).factorization x else 1) ^ 2 +- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), +- (if (d s).factorization x ≤ i.factorization x +- then x ^ (i.lcm (d s)).factorization x else 1) ^ 2 := by +- apply Finset.prod_congr ?_ (fun _ _ => rfl) +- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> assumption +- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), +- if (d s).factorization x ≤ i.factorization x +- then (x ^ (i.lcm (d s)).factorization x) ^ 2 else 1 := by +- refine Finset.prod_congr rfl fun x _ => ?_ +- split_ifs <;> simp +- rw [eq1] +- have eq2 := calc ((i ^ 2).lcm (d s ^ 2)).factorization.prod fun p n ↦ +- if (d s ^ 2).factorization p ≤ (i ^ 2).factorization p then p ^ n else 1 +- _ = ∏ i ∈ ((i ^ 2).lcm (d s ^ 2)).factorization.support, _ := rfl +- _ = ∏ i ∈ (i.primeFactors ∪ (d s).primeFactors), _ := by +- apply Finset.prod_congr ?_ (fun _ _ => rfl) +- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> try assumption +- congr 1 <;> +- · rw [pow_two, Nat.primeFactors_mul] <;> aesop +- +- simp_rw [eq2, Nat.factorization_pow] +- simp only [Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, gt_iff_lt, Nat.ofNat_pos, +- mul_le_mul_left] +- apply Finset.prod_dvd_prod_of_dvd +- intro p _ +- split_ifs +- · rw [← pow_mul] +- apply pow_dvd_pow +- rw [Nat.factorization_lcm, Nat.factorization_lcm] <;> try assumption +- +- simp only [Finsupp.sup_apply, Nat.factorization_pow, Finsupp.coe_smul, Pi.smul_apply, +- smul_eq_mul] +- have eq : 2 * i.factorization p ⊔ 2 * (d s).factorization p = +- 2 * (i.factorization p ⊔ (d s).factorization p) := by +- change Nat.max _ _ = 2 * Nat.max _ _ +- rw [mul_max_of_nonneg] +- norm_num +- rw [eq, mul_comm] +- +- · exact one_dvd _ +- · delta Nat.factorizationLCMRight +- erw [← Finset.prod_pow] +- dsimp only +- have eq1 := +- calc ∏ x ∈ (i.lcm (d s)).factorization.support, +- (if (d s).factorization x ≤ i.factorization x +- then 1 else x ^ (i.lcm (d s)).factorization x) ^ 2 +- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), +- (if (d s).factorization x ≤ i.factorization x +- then 1 else x ^ (i.lcm (d s)).factorization x) ^ 2 := by +- apply Finset.prod_congr ?_ (fun _ _ => rfl) +- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> assumption +- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), +- if (d s).factorization x ≤ i.factorization x +- then 1 else (x ^ (i.lcm (d s)).factorization x) ^ 2 := by +- refine Finset.prod_congr rfl fun x _ => ?_ +- split_ifs <;> simp +- rw [eq1] +- have eq2 := calc ((i ^ 2).lcm (d s ^ 2)).factorization.prod fun p n ↦ +- if (d s ^ 2).factorization p ≤ (i ^ 2).factorization p then 1 else p ^ n +- _ = ∏ i ∈ ((i ^ 2).lcm (d s ^ 2)).factorization.support, _ := rfl +- _ = ∏ i ∈ (i.primeFactors ∪ (d s).primeFactors), _ := by +- apply Finset.prod_congr ?_ (fun _ _ => rfl) +- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> try assumption +- congr 1 <;> +- · rw [pow_two, Nat.primeFactors_mul] <;> aesop +- simp_rw [eq2, Nat.factorization_pow] +- simp only [Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, gt_iff_lt, Nat.ofNat_pos, +- mul_le_mul_left] +- apply Finset.prod_dvd_prod_of_dvd +- intro p _ +- split_ifs +- · exact one_dvd _ +- · rw [← pow_mul] +- apply pow_dvd_pow +- rw [Nat.factorization_lcm, Nat.factorization_lcm] <;> try assumption ++ | @insert i s _ ih => ++ rw [d_insert, Finset.image_insert, d_insert, ← ih, Nat.pow_lcm_pow] + +- simp only [Finsupp.sup_apply, Nat.factorization_pow, Finsupp.coe_smul, Pi.smul_apply, +- smul_eq_mul] +- have eq : 2 * i.factorization p ⊔ 2 * (d s).factorization p = +- 2 * (i.factorization p ⊔ (d s).factorization p) := by +- change Nat.max _ _ = 2 * Nat.max _ _ +- rw [mul_max_of_nonneg] +- norm_num +- rw [eq, mul_comm] +- +- · rw [Nat.lcm_dvd_iff] +- exact ⟨pow_dvd_pow_of_dvd (Nat.dvd_lcm_left _ _) 2, +- pow_dvd_pow_of_dvd (Nat.dvd_lcm_right _ _) 2⟩ +- +-theorem d_cube (s : Finset ℕ) : (d s)^3 = d (s.image (· ^ 3)) := by ++theorem d_cube (s : Finset ℕ) : (d s) ^ 3 = d (s.image (· ^ 3)) := by + induction s using Finset.induction_on with + | empty => simp [d] +- | @insert i s hi ih => +- rw [d_insert, Finset.image_insert, d_insert, ← ih] +- refine dvd_antisymm ?_ ?_ +- · if hi : i = 0 +- then +- subst hi +- simp +- else +- if hs' : 0 ∈ s +- then +- rw [d_eq_zero _ hs'] +- simp +- else +- have hds : d s ≠ 0 := d_ne_zero s hs' +- have hi' : i^3 ≠ 0 := by simpa using hi +- have hds' : (d s)^3 ≠ 0 := by simpa using hds +- rw [← Nat.factorizationLCMLeft_mul_factorizationLCMRight, +- ← Nat.factorizationLCMLeft_mul_factorizationLCMRight, mul_pow] <;> try assumption +- +- apply mul_dvd_mul +- · delta Nat.factorizationLCMLeft +- erw [← Finset.prod_pow] +- dsimp only +- have eq1 := +- calc ∏ x ∈ (i.lcm (d s)).factorization.support, +- (if (d s).factorization x ≤ i.factorization x +- then x ^ (i.lcm (d s)).factorization x else 1) ^ 3 +- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), +- (if (d s).factorization x ≤ i.factorization x +- then x ^ (i.lcm (d s)).factorization x else 1) ^ 3 := by +- apply Finset.prod_congr ?_ (fun _ _ => rfl) +- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> assumption +- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), +- if (d s).factorization x ≤ i.factorization x +- then (x ^ (i.lcm (d s)).factorization x) ^ 3 else 1 := by +- refine Finset.prod_congr rfl fun x _ => ?_ +- split_ifs <;> simp +- rw [eq1] +- have eq2 := calc ((i ^ 3).lcm (d s ^ 3)).factorization.prod fun p n ↦ +- if (d s ^ 3).factorization p ≤ (i ^ 3).factorization p then p ^ n else 1 +- _ = ∏ i ∈ ((i ^ 3).lcm (d s ^ 3)).factorization.support, _ := rfl +- _ = ∏ i ∈ (i.primeFactors ∪ (d s).primeFactors), _ := by +- apply Finset.prod_congr ?_ (fun _ _ => rfl) +- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> try assumption +- congr 1 <;> +- · rw [show 3 = 2 + 1 by omega, pow_add, pow_two, pow_one, Nat.primeFactors_mul, +- Nat.primeFactors_mul] <;> aesop +- +- simp_rw [eq2, Nat.factorization_pow] +- simp only [Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, gt_iff_lt, Nat.ofNat_pos, +- mul_le_mul_left] +- apply Finset.prod_dvd_prod_of_dvd +- intro p _ +- split_ifs +- · rw [← pow_mul] +- apply pow_dvd_pow +- rw [Nat.factorization_lcm, Nat.factorization_lcm] <;> try assumption +- +- simp only [Finsupp.sup_apply, Nat.factorization_pow, Finsupp.coe_smul, Pi.smul_apply, +- smul_eq_mul] +- have eq : 3 * i.factorization p ⊔ 3 * (d s).factorization p = +- 3 * (i.factorization p ⊔ (d s).factorization p) := by +- change Nat.max _ _ = 3 * Nat.max _ _ +- rw [mul_max_of_nonneg] +- norm_num +- rw [eq, mul_comm] +- · exact one_dvd _ +- +- · delta Nat.factorizationLCMRight +- erw [← Finset.prod_pow] +- simp only [Nat.support_factorization, ite_pow, one_pow, Nat.factorization_pow, +- Finsupp.coe_smul, Pi.smul_apply, smul_eq_mul, gt_iff_lt, Nat.ofNat_pos, mul_le_mul_left] +- have eq1 := +- calc ∏ x ∈ (i.lcm (d s)).primeFactors, +- if (d s).factorization x ≤ i.factorization x +- then 1 else (x ^ (i.lcm (d s)).factorization x) ^ 3 +- _ = ∏ x ∈ (i.primeFactors ∪ (d s).primeFactors), +- if (d s).factorization x ≤ i.factorization x +- then 1 else (x ^ (i.lcm (d s)).factorization x) ^ 3 := by +- apply Finset.prod_congr ?_ fun _ _ => rfl +- rw [Nat.primeFactors_lcm] <;> assumption +- rw [eq1] +- have eq2 := calc ((i ^ 3).lcm (d s ^ 3)).factorization.prod fun p n ↦ +- if (d s).factorization p ≤ i.factorization p then 1 else p ^ n +- _ = ∏ i ∈ ((i ^ 3).lcm (d s ^ 3)).factorization.support, _ := rfl +- _ = ∏ i ∈ (i.primeFactors ∪ (d s).primeFactors), _ := by +- apply Finset.prod_congr ?_ fun _ _ => rfl +- rw [Nat.support_factorization, Nat.primeFactors_lcm] <;> try assumption +- congr 1 <;> +- · rw [show 3 = 2 + 1 by omega, pow_add, pow_two, pow_one, Nat.primeFactors_mul, +- Nat.primeFactors_mul] <;> aesop +- rw [eq2] +- apply Finset.prod_dvd_prod_of_dvd +- intro p _ +- simp only +- split_ifs +- · simp +- · rw [← pow_mul] +- apply pow_dvd_pow +- rw [Nat.factorization_lcm, Nat.factorization_lcm] <;> try assumption +- simp only [Finsupp.sup_apply, Nat.factorization_pow, Finsupp.coe_smul, Pi.smul_apply, +- smul_eq_mul] +- have eq : 3 * i.factorization p ⊔ 3 * (d s).factorization p = +- 3 * (i.factorization p ⊔ (d s).factorization p) := by +- change Nat.max _ _ = 3 * Nat.max _ _ +- rw [mul_max_of_nonneg] +- norm_num +- rw [eq, mul_comm] +- · rw [Nat.lcm_dvd_iff] +- exact ⟨pow_dvd_pow_of_dvd (Nat.dvd_lcm_left _ _) 3, +- pow_dvd_pow_of_dvd (Nat.dvd_lcm_right _ _) 3⟩ ++ | @insert i s _ ih => ++ rw [d_insert, Finset.image_insert, d_insert, ← ih, Nat.pow_lcm_pow] + + theorem d_sq' (n : ℕ) : + d (Finset.Icc 1 n)^2 = d (Finset.Icc 1 n |>.image (· ^ 2)) := d_sq _ +@@ -339,12 +103,6 @@ theorem lcm_factorization (m n p : ℕ) (hm : m ≠ 0) (hn : n ≠ 0) : + rw [Nat.factorization_lcm hm hn] + aesop + +--- lemma lcm_eq_prod (m n : ℕ) : m.lcm n = +--- ∏ p ∈ (max m n).primesBelow, p ^ (max (m.factorization p) (n.factorization p)) := by +- +--- sorry +- +- + theorem d_factorization (s : Finset ℕ) (hs : s.Nonempty) (p : ℕ) (hs₁ : 0 ∉ s) : + (d s).factorization p = + (s.image fun i => i.factorization p).max' (by aesop) := by +@@ -356,15 +114,11 @@ theorem d_factorization (s : Finset ℕ) (hs : s.Nonempty) (p : ℕ) (hs₁ : 0 + then + simp only [Finset.image_insert] + rw [Finset.max'_insert (H := by aesop)] +- rw [max_comm] +- congr 1 +- rw [ih hs] +- aesop ++ rw [ih hs (by aesop)] + else + simp only [Finset.not_nonempty_iff_eq_empty] at hs + subst hs +- simp only [d_empty, Nat.factorization_one, Finsupp.coe_zero, Pi.zero_apply, zero_le, +- max_eq_left, insert_emptyc_eq, Finset.image_singleton, Finset.max'_singleton] ++ simp [d_empty] + · aesop + · apply d_ne_zero + aesop +@@ -431,14 +185,16 @@ theorem d_factorization_eq_div_log' (n p : ℕ) (hp : Nat.Prime p) : + · by_contra! h + rw [Finset.max'_le_iff] at h + set y := (Finset.image (fun i ↦ i.factorization p) (Finset.Icc 1 (n + 1))).max' (by aesop) +- have hy : (y : ℝ) ∈ (Finset.image (fun i ↦ (i.factorization p : ℝ)) (Finset.Icc 1 (n + 1))) := by ++ have hy : (y : ℝ) ∈ ++ (Finset.image (fun i ↦ (i.factorization p : ℝ)) (Finset.Icc 1 (n + 1))) := by + simp only [Finset.mem_image, Finset.mem_Icc, Nat.cast_inj] + simp_rw [← Finset.mem_Icc] + rw [← Finset.mem_image] + exact Finset.max'_mem _ _ + specialize h (y : ℝ) hy + rw [le_sub_iff_add_le, Real.le_logb_iff_rpow_le] at h +- · have h2 : y + 1 ∉ (Finset.image (fun i ↦ i.factorization p) (Finset.Icc 1 (n + 1))) := by ++ · have h2 : y + 1 ∉ ++ (Finset.image (fun i ↦ i.factorization p) (Finset.Icc 1 (n + 1))) := by + by_contra! hy1 + suffices y + 1 ≤ y by linarith + exact Finset.le_max' _ _ hy1 +@@ -450,8 +206,8 @@ theorem d_factorization_eq_div_log' (n p : ℕ) (hp : Nat.Prime p) : + exact Nat.Prime.one_lt hp + · norm_cast + omega +- · aesop + · aesop ++ · simp + · apply Real.logb_nonneg + · norm_cast + exact Nat.Prime.one_lt hp +@@ -464,31 +220,20 @@ theorem d_factorization_eq_div_log (n p : ℕ) (hp : Nat.Prime p) : + cases n + · simp only [zero_lt_one, Finset.Icc_eq_empty_of_lt, d_empty, Nat.factorization_one, + Finsupp.coe_zero, Pi.zero_apply, CharP.cast_eq_zero, Real.log_zero, zero_div, Nat.floor_zero] +- + · rw [d_factorization_eq_div_log' (hp := hp)] + simp + +--- lemma d_eq_prod (s : Finset ℕ) (hs : s.Nonempty) : +--- d s = +--- ∏ p ∈ Nat.primesBelow (s.max' hs), +--- p ^ (s.image fun i => i.factorization p).max' (by aesop) := by +--- induction s using Finset.induction_on with +--- | empty => simp only [Finset.not_nonempty_empty] at hs +--- | @insert m s hm ih => +--- sorry +- + theorem d_eq_prod_pow' (n : ℕ) : + d (Finset.Icc 1 (n + 1)) = + ∏ p ∈ (((n + 1) + 1).primesBelow), + p ^ ((Finset.Icc 1 (n + 1)).image (fun i => i.factorization p)).max' (by aesop) := by +- rw [← Nat.factorization_prod_pow_eq_self (n := d (Finset.Icc 1 (n + 1)))] ++ rw [← Nat.prod_factorization_pow_eq_self (n := d (Finset.Icc 1 (n + 1)))] + · simp only [Finsupp.prod, Nat.support_factorization] + rw [d_primeFactors _ (by aesop)] + refine Finset.prod_congr ?_ ?_ + · ext p +- constructor <;> intro hp <;> simp only at hp ⊢ ++ constructor <;> intro hp + · rw [Finset.mem_sup] at hp +- + obtain ⟨m, H, h⟩ := hp + simp only [Finset.mem_Icc] at H + rw [Nat.mem_primesBelow] +@@ -541,41 +286,39 @@ theorem d_le_pow_counting (n : ℕ) : d (Finset.Icc 1 n) ≤ n ^ (n.primeCountin + calc + _ ≤ ∏ _ ∈ ((n + 1).primesBelow), n := by + apply Finset.prod_le_prod +- · intro p _ +- simp only [zero_le] +- · intro p hp +- rw [Nat.mem_primesBelow] at hp +- have h2 : 1 ≤ p := by +- by_contra! h +- have : p = 0 := by omega +- aesop +- suffices p ^ (⌊(Real.log (n : ℝ)) / (Real.log (p : ℝ))⌋₊ : ℝ) ≤ (n : ℝ) by norm_cast at this +- trans p ^ ((Real.log (n : ℝ)) / (Real.log (p : ℝ))) +- · apply Real.rpow_le_rpow_of_exponent_le (by norm_cast) +- · apply Nat.floor_le (α := ℝ) +- if h2 : n = 1 ∨ p = 1 then +- rcases h2 with (rfl | rfl) <;> simp +- else +- rcases (not_or.1 h2) with ⟨_, h2⟩ +- have h1 : 1 < n := by omega +- have h2 : 1 < p := by omega +- suffices 0 < Real.log (n : ℝ) / Real.log (p : ℝ) by linarith +- apply div_pos <;> +- exact Real.log_pos (by norm_cast) +- · nth_rewrite 1 [← Real.exp_log (x := (p : ℝ)) (by norm_cast), ← Real.exp_one_rpow, +- ← Real.rpow_mul (by exact Real.exp_nonneg 1), mul_div, mul_comm, ← mul_div] +- if hp : p = 1 then +- rw [hp]; simp only [Nat.cast_one, Real.log_one, div_zero, mul_zero, Real.rpow_zero, +- Nat.one_le_cast, h1] ++ intro p hp ++ rw [Nat.mem_primesBelow] at hp ++ have h2 : 1 ≤ p := by ++ by_contra! h ++ have : p = 0 := by omega ++ aesop ++ suffices p ^ (⌊(Real.log (n : ℝ)) / (Real.log (p : ℝ))⌋₊ : ℝ) ≤ (n : ℝ) by norm_cast at this ++ trans p ^ ((Real.log (n : ℝ)) / (Real.log (p : ℝ))) ++ · apply Real.rpow_le_rpow_of_exponent_le (by norm_cast) ++ · apply Nat.floor_le (R := ℝ) ++ if h2 : n = 1 ∨ p = 1 then ++ rcases h2 with (rfl | rfl) <;> simp + else +- rw [div_self, mul_one, Real.exp_one_rpow, Real.exp_log (by norm_cast)] +- rw [Real.log_ne_zero] +- norm_cast +- simp only [not_false_eq_true, and_true] +- omega ++ rcases (not_or.1 h2) with ⟨_, h2⟩ ++ have h1 : 1 < n := by omega ++ have h2 : 1 < p := by omega ++ suffices 0 < Real.log (n : ℝ) / Real.log (p : ℝ) by linarith ++ apply div_pos <;> ++ exact Real.log_pos (by norm_cast) ++ · nth_rewrite 1 [← Real.exp_log (x := (p : ℝ)) (by norm_cast), ← Real.exp_one_rpow, ++ ← Real.rpow_mul (by exact Real.exp_nonneg 1), mul_div, mul_comm, ← mul_div] ++ if hp : p = 1 then ++ rw [hp]; simp only [Nat.cast_one, Real.log_one, div_zero, mul_zero, Real.rpow_zero, ++ Nat.one_le_cast, h1] ++ else ++ rw [div_self, mul_one, Real.exp_one_rpow, Real.exp_log (by norm_cast)] ++ rw [Real.log_ne_zero] ++ norm_cast ++ simp only [not_false_eq_true, and_true] ++ omega + _ ≤ n ^ (n.primeCounting) := by + rw [Finset.prod_const] +- suffices ((n + 1).primesBelow).card = n.primeCounting by apply Nat.pow_le_pow_right <;> linarith ++ suffices ((n + 1).primesBelow).card = n.primeCounting by ++ apply Nat.pow_le_pow_right <;> linarith + rw [Nat.primeCounting, ← Nat.primesBelow_card_eq_primeCounting'] + +-#min_imports +diff --git a/lakefile.lean b/lakefile.lean +index 6276b4a..38f6ff4 100644 +--- a/lakefile.lean ++++ b/lakefile.lean +@@ -11,7 +11,10 @@ package «Zeta3Irrational» where + + @[default_target] + lean_lib «Zeta3Irrational» where +- -- add any library configuration options here ++ roots := #[`Zeta3Irrational] ++ globs := #[`Zeta3Irrational, `Zeta3Irrational.Basic, `Zeta3Irrational.Bound, ++ `Zeta3Irrational.Integral, `Zeta3Irrational.LegendrePoly, `Zeta3Irrational.LinearForm, ++ `Zeta3Irrational.d, `Zeta3Irrational.Equality, `Zeta3Irrational.PrimeCounting] + + require «PrimeNumberTheoremAnd» from git + "https://github.com/AlexKontorovich/PrimeNumberTheoremAnd.git" @ "main" +diff --git a/lean-toolchain b/lean-toolchain +index b2153cd..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.18.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/belyi-lean4341.patch b/lean/patches/belyi-lean4341.patch index a4754edce99f5e901aaebd905491d73f1b0266ab..82cdea551412b8ca4e1ca95b936bb9b30008c3c2 100644 --- a/lean/patches/belyi-lean4341.patch +++ b/lean/patches/belyi-lean4341.patch @@ -1,408 +1,408 @@ -diff --git a/Belyi/Converse/ConstantFamily.lean b/Belyi/Converse/ConstantFamily.lean -index 2692f69b67ac443907d301f353162ead0303dd55..4b1a073bae874e42d95ebc1324b536786358832c 100644 ---- a/Belyi/Converse/ConstantFamily.lean -+++ b/Belyi/Converse/ConstantFamily.lean -@@ -129,16 +129,14 @@ theorem isBaseChangeAlong_fibre (s : A →ₐ[k] k) (M : Type u) [CommRing M] [A - rw [Algebra.algebraMap_eq_smul_one (A := B), ← TensorProduct.smul_tmul, Algebra.smul_def, - mul_one] - haveI : IsScalarTower (A ⊗[k] R) R (M ⊗[k] R) := .of_algebraMap_eq fun x ↦ by -- induction x with -- | zero => simp -+ induction x using TensorProduct.inductionOn with - | add x y hx hy => simp only [map_add, hx, hy] - | tmul a r => - change algebraMap k M (s a) ⊗ₜ r = 1 ⊗ₜ (s a • r) - rw [Algebra.algebraMap_eq_smul_one, TensorProduct.smul_tmul] - have hT : IsScalarTower (A ⊗[k] R) (M ⊗[k] R) (M ⊗[k] B₀) := by - refine .of_algebraMap_eq fun x ↦ ?_ -- induction x with -- | zero => simp -+ induction x using TensorProduct.inductionOn with - | add x y hx hy => simp only [map_add, hx, hy] - | tmul a r => - change (1 : M) ⊗ₜ ((1 : R) ⊗ₜ algebraMap (A ⊗[k] R) B (a ⊗ₜ r) : B₀) = -@@ -178,8 +176,7 @@ theorem isBaseChangeAlong_map (φ : A →ₐ[k] L) (B₀ : Type u) [CommRing B - IsScalarTower.of_algebraMap_eq fun _ ↦ rfl - have hT : IsScalarTower (A ⊗[k] R) (L ⊗[k] R) (L ⊗[k] B₀) := by - refine .of_algebraMap_eq fun x ↦ ?_ -- induction x with -- | zero => simp -+ induction x using TensorProduct.inductionOn with - | add x y hx hy => simp only [map_add, hx, hy] - | tmul a r => rfl - refine ⟨hT, ?_⟩ -diff --git a/Belyi/Converse/HomDescent.lean b/Belyi/Converse/HomDescent.lean -index d6124c0fc6852061bb796402c0790f7b6f908c1e..0b5e604e97ff450339613f7607dc3def5ae3f287 100644 ---- a/Belyi/Converse/HomDescent.lean -+++ b/Belyi/Converse/HomDescent.lean -@@ -47,8 +47,7 @@ variable {A : Type*} [CommRing A] {Ω : Type*} [CommRing Ω] [Algebra A Ω] - lemma map_id_eq_rTensor {D E : Type*} [CommRing D] [Algebra A D] [CommRing E] [Algebra A E] - (f : D →ₐ[A] E) (t : D ⊗[A] N) : - Algebra.TensorProduct.map f (AlgHom.id A N) t = LinearMap.rTensor N f.toLinearMap t := by -- induction t with -- | zero => simp -+ induction t using TensorProduct.inductionOn with - | tmul x y => simp - | add x y hx hy => rw [map_add, map_add, hx, hy] - -@@ -57,8 +56,7 @@ lemma map_inclusion_inclusion {C D E : Subalgebra A Ω} (h₁ : C ≤ D) (h₂ : - Algebra.TensorProduct.map (Subalgebra.inclusion h₂) (AlgHom.id A N) - (Algebra.TensorProduct.map (Subalgebra.inclusion h₁) (AlgHom.id A N) t) = - Algebra.TensorProduct.map (Subalgebra.inclusion (h₁.trans h₂)) (AlgHom.id A N) t := by -- induction t with -- | zero => simp -+ induction t using TensorProduct.inductionOn with - | tmul x y => simp - | add x y hx hy => rw [map_add, map_add, map_add, hx, hy] - -@@ -66,8 +64,7 @@ lemma map_val_inclusion {C D : Subalgebra A Ω} (h : C ≤ D) (t : C ⊗[A] N) : - Algebra.TensorProduct.map D.val (AlgHom.id A N) - (Algebra.TensorProduct.map (Subalgebra.inclusion h) (AlgHom.id A N) t) = - Algebra.TensorProduct.map C.val (AlgHom.id A N) t := by -- induction t with -- | zero => simp -+ induction t using TensorProduct.inductionOn with - | tmul x y => simp - | add x y hx hy => rw [map_add, map_add, map_add, hx, hy] - -@@ -232,8 +229,7 @@ lemma pushHom_apply (σ : D →ₐ[A] E) (F : B₁ →ₐ[A] D ⊗[A] B₂) (b : - lemma map_baseChangeHom (σ : D →ₐ[A] E) (F : B₁ →ₐ[A] D ⊗[A] B₂) (t : D ⊗[A] B₁) : - Algebra.TensorProduct.map σ (AlgHom.id A B₂) (baseChangeHom F t) = - baseChangeHom (pushHom σ F) (Algebra.TensorProduct.map σ (AlgHom.id A B₁) t) := by -- induction t with -- | zero => simp -+ induction t using TensorProduct.inductionOn with - | tmul d b => simp - | add x y hx hy => rw [map_add, map_add, map_add, hx, hy, map_add] - -@@ -300,8 +296,7 @@ theorem exists_algEquiv_of_fg [Algebra.FinitePresentation P B₁] - rw [← hF₂']; ext b; exact map_val_inclusion _ _ - have hbc₁ : ∀ t, baseChangeHom F₁ t = e t := by - intro t -- induction t with -- | zero => simp -+ induction t using TensorProduct.inductionOn with - | tmul ω b => - have : (ω ⊗ₜ[A] b : Ω ⊗[A] _) = algebraMap Ω _ ω * (1 ⊗ₜ b) := by simp - rw [baseChangeHom_tmul, this, map_mul, AlgEquiv.commutes] -@@ -309,8 +304,7 @@ theorem exists_algEquiv_of_fg [Algebra.FinitePresentation P B₁] - | add x y hx hy => rw [map_add, map_add, hx, hy] - have hbc₂ : ∀ t, baseChangeHom F₂ t = e.symm t := by - intro t -- induction t with -- | zero => simp -+ induction t using TensorProduct.inductionOn with - | tmul ω b => - have : (ω ⊗ₜ[A] b : Ω ⊗[A] _) = algebraMap Ω _ ω * (1 ⊗ₜ b) := by simp - rw [baseChangeHom_tmul, this, map_mul, AlgEquiv.commutes] -diff --git a/Belyi/Converse/IsoDescent.lean b/Belyi/Converse/IsoDescent.lean -index 69f7f51ad3d9f227c7df08169cb7b04eefc34974..65e59a91e3175df6b2b2050a60bb36b26b3bd87e 100644 ---- a/Belyi/Converse/IsoDescent.lean -+++ b/Belyi/Converse/IsoDescent.lean -@@ -186,8 +186,7 @@ theorem nonempty_algEquiv_of_isBaseChangeAlong - -- back to `B₁K ≃ B₂K` - let E : B₁K ≃+* B₂K := (Ψ₁.symm.trans eK.toRingEquiv).trans Ψ₂ - refine ⟨AlgEquiv.ofRingEquiv (f := E) fun x ↦ ?_⟩ -- induction x with -- | zero => simp -+ induction x using TensorProduct.inductionOn with - | add x y hx hy => rw [map_add, map_add, hx, hy, map_add] - | tmul l r => - have key₁ : algebraMap (K ⊗[k] R) B₁K (l ⊗ₜ r) = -diff --git a/Belyi/Converse/Points.lean b/Belyi/Converse/Points.lean -index 285770c889d3277896e9487be32a0d79010bc690..53fbc6cd9681ff1388451f8729394b1a2d6eaaf5 100644 ---- a/Belyi/Converse/Points.lean -+++ b/Belyi/Converse/Points.lean -@@ -100,7 +100,7 @@ theorem exists_injective_algHom (k Ω A : Type u) [Field k] [Countable k] - obtain ⟨s, hs⟩ := exists_isTranscendenceBasis k A - have hsfin : #s < ℵ₀ := by - have h1 := hs.lift_cardinalMk_eq_trdeg -- have h2 := trdeg_lt_aleph0 (R := k) (S := A) -+ have h2 := trdeg_lt_aleph0_of_finiteType (R := k) (S := A) - simp only [lift_id] at h1 - rwa [h1] - obtain ⟨t, ht⟩ := exists_isTranscendenceBasis k Ω -diff --git a/Belyi/Converse/Spread.lean b/Belyi/Converse/Spread.lean -index f76bb9ae3e7ec6dfe89f98ef62b25a70df7e5812..7a8378c2d0663f913cac6277bdc1ce0f39bb53dc 100644 ---- a/Belyi/Converse/Spread.lean -+++ b/Belyi/Converse/Spread.lean -@@ -148,8 +148,7 @@ theorem injective_map_val (A : Subalgebra k K) : - theorem exists_fg_mem_range (x : K ⊗[k] R) : - ∃ A : Subalgebra k K, A.FG ∧ - x ∈ Set.range (Algebra.TensorProduct.map A.val (AlgHom.id k R)) := by -- induction x with -- | zero => exact ⟨⊥, Subalgebra.fg_bot, 0, map_zero _⟩ -+ induction x using TensorProduct.inductionOn with - | tmul a r => - refine ⟨Algebra.adjoin k ((({a} : Finset K)) : Set K), Subalgebra.fg_adjoin_finset {a}, ?_⟩ - exact ⟨⟨a, Algebra.subset_adjoin (by simp)⟩ ⊗ₜ r, rfl⟩ -diff --git a/Belyi/Curve/Descent.lean b/Belyi/Curve/Descent.lean -index 6b9f7a650d4dff22de4e56c486d24466fefb81cb..a2cce2df8151aeccc4e8f80b01eb00aebcb3879b 100644 ---- a/Belyi/Curve/Descent.lean -+++ b/Belyi/Curve/Descent.lean -@@ -5,6 +5,7 @@ Authors: The Belyi project contributors - -/ - import Mathlib.AlgebraicGeometry.Morphisms.Separated - import Mathlib.AlgebraicGeometry.Morphisms.Proper -+import Mathlib.AlgebraicGeometry.Morphisms.Immersion - import Mathlib.AlgebraicGeometry.Morphisms.FlatDescent - import Mathlib.AlgebraicGeometry.Morphisms.LocalFlatDescent - -diff --git a/Belyi/CurveField/KummerStep.lean b/Belyi/CurveField/KummerStep.lean -index f076a063d7f186ca0b78435c5861ba1d4cc41535..97aaee48ba1c670e92e3b024255997d5e11d5883 100644 ---- a/Belyi/CurveField/KummerStep.lean -+++ b/Belyi/CurveField/KummerStep.lean -@@ -210,7 +210,7 @@ theorem exists_mem_conductor_notMem (x : chartRingExt K L t) - have hle : conductor (chartRing t) x * differentIdeal (chartRing t) (chartRingExt K L t) ≤ - (heightOneBelow (R := chartRingExt K L t) Q.1 Q.ne_top - (algebraMap_chartRingExt_mem t Q htQ)).asIdeal := -- Ideal.mul_le_right.trans fun c hc ↦ mem_heightOneBelow.mpr (h c hc) -+ Ideal.mul_le_left.trans fun c hc ↦ mem_heightOneBelow.mpr (h c hc) - rw [hcd] at hle - exact hunit (mem_heightOneBelow.mp (hle (Ideal.mem_span_singleton_self _))) - -diff --git a/Belyi/CurveField/Point.lean b/Belyi/CurveField/Point.lean -index 2dc6d8369c43f30a75c9ed06321882a01ecc8aa8..70d055182fd8f8b08de4c4d9f4debc97e0959f9a 100644 ---- a/Belyi/CurveField/Point.lean -+++ b/Belyi/CurveField/Point.lean -@@ -169,7 +169,7 @@ theorem exists_P_eq (P : Place K) : ∃ x : QbarPoint K, x.P = P := - rfl⟩ - - instance (P : Place K) : Finite (P.ResidueField →+* AlgebraicClosure ℚ) := -- Finite.of_equiv _ RingHom.equivRatAlgHom.symm -+ Finite.of_equiv _ (RingHom.equivRatAlgHom P.ResidueField (AlgebraicClosure ℚ)).symm - - /-- Only finitely many points lie over a finite set of places. -/ - theorem finite_setOf_mem {S : Set (Place K)} (hS : S.Finite) : -diff --git a/Belyi/P1/BaseChange.lean b/Belyi/P1/BaseChange.lean -index 67e8ea29c3b37ccb5050567dfc607f393ae525bc..45353c4786ceb7486db5baacea394e5cb22b7a7e 100644 ---- a/Belyi/P1/BaseChange.lean -+++ b/Belyi/P1/BaseChange.lean -@@ -152,7 +152,7 @@ lemma irrelevant_le_map_gradedMapOfAlgebra : - have h := Ideal.mem_map_of_mem (f := gradedMapOfAlgebra k₀ K) - (show X j ∈ (HomogeneousIdeal.irrelevant (P1Grading k₀)).toIdeal from hXj) - rwa [gradedMapOfAlgebra_apply, MvPolynomial.map_X] at h -- have hdvd : (X j : MvPolynomial (Fin 2) K) ∣ monomial d (coeff d p) := by -+ have hdvd : (X j : MvPolynomial (Fin 2) K) ∣ monomial d (p.coeff d) := by - rw [X, MvPolynomial.monomial_dvd_monomial] - exact ⟨Or.inr (by simpa [Finsupp.single_le_iff] using Nat.one_le_iff_ne_zero.mpr hj), - one_dvd _⟩ -diff --git a/Belyi/P1/BaseChangeIso.lean b/Belyi/P1/BaseChangeIso.lean -index 21faa2ba37302121df279eba05eeaaee970939e3..68d7005cb52f1ce424a12482d49efa03fc2f6a42 100644 ---- a/Belyi/P1/BaseChangeIso.lean -+++ b/Belyi/P1/BaseChangeIso.lean -@@ -217,7 +217,7 @@ lemma irrelevant_le_span_X (k : Type u) [CommRing k] : - have hXj : (X j : MvPolynomial (Fin 2) k) ∈ - Ideal.span (Set.range (fun i : Fin 2 => (X i : MvPolynomial (Fin 2) k))) := - Ideal.subset_span ⟨j, rfl⟩ -- have hdvd : (X j : MvPolynomial (Fin 2) k) ∣ monomial d (coeff d p) := by -+ have hdvd : (X j : MvPolynomial (Fin 2) k) ∣ monomial d (p.coeff d) := by - rw [X, MvPolynomial.monomial_dvd_monomial] - exact ⟨Or.inr (by simpa [Finsupp.single_le_iff] using Nat.one_le_iff_ne_zero.mpr hj), - one_dvd _⟩ -diff --git a/Belyi/P1/PointsBaseChange.lean b/Belyi/P1/PointsBaseChange.lean -index 45a48c5d2f6fd9d5ce64b3dc5c6069d12a3ec505..2e91534e2218acc5817e46cefa8ddca786948591 100644 ---- a/Belyi/P1/PointsBaseChange.lean -+++ b/Belyi/P1/PointsBaseChange.lean -@@ -39,9 +39,9 @@ variable {σ : Type*} {R S : Type*} [CommRing R] [CommRing S] - /-- `x` is divisible by `monomial s 1` iff every coefficient at a multi-index not `≥ s` - vanishes. -/ - lemma monomial_one_dvd_iff_forall_coeff (x : MvPolynomial σ R) (s : σ →₀ ℕ) : -- (monomial s 1) ∣ x ↔ ∀ d, ¬ s ≤ d → coeff d x = 0 := by -+ (monomial s 1) ∣ x ↔ ∀ d, ¬ s ≤ d → x.coeff d = 0 := by - rw [monomial_one_dvd_iff_modMonomial_eq_zero, MvPolynomial.ext_iff] -- simp only [coeff_zero] -+ simp only [AddMonoidAlgebra.coeff_zero, Finsupp.zero_apply] - constructor - · intro h d hd - rw [← coeff_modMonomial_of_not_le x hd] -diff --git a/Belyi/P1/PolynomialMap.lean b/Belyi/P1/PolynomialMap.lean -index 42a9a639fb8f479e712e560ea9ab9d3b0ba9b574..68e923dda9fa8a991b8fbbcece70bc63e7424c47 100644 ---- a/Belyi/P1/PolynomialMap.lean -+++ b/Belyi/P1/PolynomialMap.lean -@@ -64,7 +64,7 @@ lemma X1_dvd_homogInput_sub : - homogInput k g - C (g.coeff g.natDegree) * X 0 ^ g.natDegree := by - rw [MvPolynomial.X_dvd_iff_modMonomial_eq_zero] - ext m -- rw [coeff_zero] -+ rw [AddMonoidAlgebra.coeff_zero, Finsupp.zero_apply] - by_cases hm : Finsupp.single (1 : Fin 2) 1 ≤ m - · exact MvPolynomial.coeff_modMonomial_of_le _ hm - · rw [MvPolynomial.coeff_modMonomial_of_not_le _ hm] -@@ -122,7 +122,7 @@ lemma X1_notMem_or_homogInput_notMem (hd : 0 < g.natDegree) - obtain ⟨j, hj⟩ : ∃ j, dd j ≠ 0 := by - by_contra hcon - exact hd0 (by ext j; simpa using not_not.mp (not_exists.mp hcon j)) -- have hdvd : (X j : MvPolynomial (Fin 2) k) ∣ monomial dd (coeff dd p) := by -+ have hdvd : (X j : MvPolynomial (Fin 2) k) ∣ monomial dd (p.coeff dd) := by - rw [MvPolynomial.X, MvPolynomial.monomial_dvd_monomial] - exact ⟨Or.inr (by simpa [Finsupp.single_le_iff] using Nat.one_le_iff_ne_zero.mpr hj), - one_dvd _⟩ -diff --git a/lake-manifest.json b/lake-manifest.json -index 5353a1a61ba8bdc45abdead73e0e5baa1c450bb7..7f84303cb861125f4c4a0499e51c10f46933cd33 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,31 +1,51 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/lana-agents/oka.git", -+ [{"url": "https://github.com/lana-agents/belyi.git", - "type": "git", - "subDir": null, - "scope": "", -- "rev": "da228a2cf9671aaba08ddc96274d75e098b28f67", -+ "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "name": "belyi", -+ "manifestFile": "lake-manifest.json", -+ "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "inherited": true, -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/oka.git", -+ "type": "git", -+ "subDir": null, -+ "scope": "", -+ "rev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", - "name": "oka", - "manifestFile": "lake-manifest.json", -- "inputRev": "da228a2cf9671aaba08ddc96274d75e098b28f67", -+ "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", - "inherited": false, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/mathlib4", -+ {"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, -+ {"url": "https://github.com/lana-agents/heights.git", -+ "type": "git", -+ "subDir": null, -+ "scope": "", -+ "rev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", -+ "name": "heights", -+ "manifestFile": "lake-manifest.json", -+ "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", -+ "inherited": true, -+ "configFile": "lakefile.toml"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -35,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -65,7 +85,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -75,7 +95,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -85,7 +105,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -95,10 +115,10 @@ - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "belyi", -diff --git a/lakefile.toml b/lakefile.toml -index 070a3d25f5ff8b83defe14d6e08e25b0eaa46449..28c618d17067766cc8d57c5a2dca9f227227c1ee 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,6 +4,8 @@ keywords = ["math"] - defaultTargets = ["Belyi"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true -@@ -11,13 +13,13 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[require]] - name = "oka" - git = "https://github.com/lana-agents/oka.git" --rev = "da228a2cf9671aaba08ddc96274d75e098b28f67" -+rev = "75dcdc3faadd10b986afb9283e89902bcdddecd4" - - [[lean_lib]] - name = "Belyi" -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/Belyi/Converse/ConstantFamily.lean b/Belyi/Converse/ConstantFamily.lean +index 2692f69b67ac443907d301f353162ead0303dd55..4b1a073bae874e42d95ebc1324b536786358832c 100644 +--- a/Belyi/Converse/ConstantFamily.lean ++++ b/Belyi/Converse/ConstantFamily.lean +@@ -129,16 +129,14 @@ theorem isBaseChangeAlong_fibre (s : A →ₐ[k] k) (M : Type u) [CommRing M] [A + rw [Algebra.algebraMap_eq_smul_one (A := B), ← TensorProduct.smul_tmul, Algebra.smul_def, + mul_one] + haveI : IsScalarTower (A ⊗[k] R) R (M ⊗[k] R) := .of_algebraMap_eq fun x ↦ by +- induction x with +- | zero => simp ++ induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a r => + change algebraMap k M (s a) ⊗ₜ r = 1 ⊗ₜ (s a • r) + rw [Algebra.algebraMap_eq_smul_one, TensorProduct.smul_tmul] + have hT : IsScalarTower (A ⊗[k] R) (M ⊗[k] R) (M ⊗[k] B₀) := by + refine .of_algebraMap_eq fun x ↦ ?_ +- induction x with +- | zero => simp ++ induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a r => + change (1 : M) ⊗ₜ ((1 : R) ⊗ₜ algebraMap (A ⊗[k] R) B (a ⊗ₜ r) : B₀) = +@@ -178,8 +176,7 @@ theorem isBaseChangeAlong_map (φ : A →ₐ[k] L) (B₀ : Type u) [CommRing B + IsScalarTower.of_algebraMap_eq fun _ ↦ rfl + have hT : IsScalarTower (A ⊗[k] R) (L ⊗[k] R) (L ⊗[k] B₀) := by + refine .of_algebraMap_eq fun x ↦ ?_ +- induction x with +- | zero => simp ++ induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a r => rfl + refine ⟨hT, ?_⟩ +diff --git a/Belyi/Converse/HomDescent.lean b/Belyi/Converse/HomDescent.lean +index d6124c0fc6852061bb796402c0790f7b6f908c1e..0b5e604e97ff450339613f7607dc3def5ae3f287 100644 +--- a/Belyi/Converse/HomDescent.lean ++++ b/Belyi/Converse/HomDescent.lean +@@ -47,8 +47,7 @@ variable {A : Type*} [CommRing A] {Ω : Type*} [CommRing Ω] [Algebra A Ω] + lemma map_id_eq_rTensor {D E : Type*} [CommRing D] [Algebra A D] [CommRing E] [Algebra A E] + (f : D →ₐ[A] E) (t : D ⊗[A] N) : + Algebra.TensorProduct.map f (AlgHom.id A N) t = LinearMap.rTensor N f.toLinearMap t := by +- induction t with +- | zero => simp ++ induction t using TensorProduct.inductionOn with + | tmul x y => simp + | add x y hx hy => rw [map_add, map_add, hx, hy] + +@@ -57,8 +56,7 @@ lemma map_inclusion_inclusion {C D E : Subalgebra A Ω} (h₁ : C ≤ D) (h₂ : + Algebra.TensorProduct.map (Subalgebra.inclusion h₂) (AlgHom.id A N) + (Algebra.TensorProduct.map (Subalgebra.inclusion h₁) (AlgHom.id A N) t) = + Algebra.TensorProduct.map (Subalgebra.inclusion (h₁.trans h₂)) (AlgHom.id A N) t := by +- induction t with +- | zero => simp ++ induction t using TensorProduct.inductionOn with + | tmul x y => simp + | add x y hx hy => rw [map_add, map_add, map_add, hx, hy] + +@@ -66,8 +64,7 @@ lemma map_val_inclusion {C D : Subalgebra A Ω} (h : C ≤ D) (t : C ⊗[A] N) : + Algebra.TensorProduct.map D.val (AlgHom.id A N) + (Algebra.TensorProduct.map (Subalgebra.inclusion h) (AlgHom.id A N) t) = + Algebra.TensorProduct.map C.val (AlgHom.id A N) t := by +- induction t with +- | zero => simp ++ induction t using TensorProduct.inductionOn with + | tmul x y => simp + | add x y hx hy => rw [map_add, map_add, map_add, hx, hy] + +@@ -232,8 +229,7 @@ lemma pushHom_apply (σ : D →ₐ[A] E) (F : B₁ →ₐ[A] D ⊗[A] B₂) (b : + lemma map_baseChangeHom (σ : D →ₐ[A] E) (F : B₁ →ₐ[A] D ⊗[A] B₂) (t : D ⊗[A] B₁) : + Algebra.TensorProduct.map σ (AlgHom.id A B₂) (baseChangeHom F t) = + baseChangeHom (pushHom σ F) (Algebra.TensorProduct.map σ (AlgHom.id A B₁) t) := by +- induction t with +- | zero => simp ++ induction t using TensorProduct.inductionOn with + | tmul d b => simp + | add x y hx hy => rw [map_add, map_add, map_add, hx, hy, map_add] + +@@ -300,8 +296,7 @@ theorem exists_algEquiv_of_fg [Algebra.FinitePresentation P B₁] + rw [← hF₂']; ext b; exact map_val_inclusion _ _ + have hbc₁ : ∀ t, baseChangeHom F₁ t = e t := by + intro t +- induction t with +- | zero => simp ++ induction t using TensorProduct.inductionOn with + | tmul ω b => + have : (ω ⊗ₜ[A] b : Ω ⊗[A] _) = algebraMap Ω _ ω * (1 ⊗ₜ b) := by simp + rw [baseChangeHom_tmul, this, map_mul, AlgEquiv.commutes] +@@ -309,8 +304,7 @@ theorem exists_algEquiv_of_fg [Algebra.FinitePresentation P B₁] + | add x y hx hy => rw [map_add, map_add, hx, hy] + have hbc₂ : ∀ t, baseChangeHom F₂ t = e.symm t := by + intro t +- induction t with +- | zero => simp ++ induction t using TensorProduct.inductionOn with + | tmul ω b => + have : (ω ⊗ₜ[A] b : Ω ⊗[A] _) = algebraMap Ω _ ω * (1 ⊗ₜ b) := by simp + rw [baseChangeHom_tmul, this, map_mul, AlgEquiv.commutes] +diff --git a/Belyi/Converse/IsoDescent.lean b/Belyi/Converse/IsoDescent.lean +index 69f7f51ad3d9f227c7df08169cb7b04eefc34974..65e59a91e3175df6b2b2050a60bb36b26b3bd87e 100644 +--- a/Belyi/Converse/IsoDescent.lean ++++ b/Belyi/Converse/IsoDescent.lean +@@ -186,8 +186,7 @@ theorem nonempty_algEquiv_of_isBaseChangeAlong + -- back to `B₁K ≃ B₂K` + let E : B₁K ≃+* B₂K := (Ψ₁.symm.trans eK.toRingEquiv).trans Ψ₂ + refine ⟨AlgEquiv.ofRingEquiv (f := E) fun x ↦ ?_⟩ +- induction x with +- | zero => simp ++ induction x using TensorProduct.inductionOn with + | add x y hx hy => rw [map_add, map_add, hx, hy, map_add] + | tmul l r => + have key₁ : algebraMap (K ⊗[k] R) B₁K (l ⊗ₜ r) = +diff --git a/Belyi/Converse/Points.lean b/Belyi/Converse/Points.lean +index 285770c889d3277896e9487be32a0d79010bc690..53fbc6cd9681ff1388451f8729394b1a2d6eaaf5 100644 +--- a/Belyi/Converse/Points.lean ++++ b/Belyi/Converse/Points.lean +@@ -100,7 +100,7 @@ theorem exists_injective_algHom (k Ω A : Type u) [Field k] [Countable k] + obtain ⟨s, hs⟩ := exists_isTranscendenceBasis k A + have hsfin : #s < ℵ₀ := by + have h1 := hs.lift_cardinalMk_eq_trdeg +- have h2 := trdeg_lt_aleph0 (R := k) (S := A) ++ have h2 := trdeg_lt_aleph0_of_finiteType (R := k) (S := A) + simp only [lift_id] at h1 + rwa [h1] + obtain ⟨t, ht⟩ := exists_isTranscendenceBasis k Ω +diff --git a/Belyi/Converse/Spread.lean b/Belyi/Converse/Spread.lean +index f76bb9ae3e7ec6dfe89f98ef62b25a70df7e5812..7a8378c2d0663f913cac6277bdc1ce0f39bb53dc 100644 +--- a/Belyi/Converse/Spread.lean ++++ b/Belyi/Converse/Spread.lean +@@ -148,8 +148,7 @@ theorem injective_map_val (A : Subalgebra k K) : + theorem exists_fg_mem_range (x : K ⊗[k] R) : + ∃ A : Subalgebra k K, A.FG ∧ + x ∈ Set.range (Algebra.TensorProduct.map A.val (AlgHom.id k R)) := by +- induction x with +- | zero => exact ⟨⊥, Subalgebra.fg_bot, 0, map_zero _⟩ ++ induction x using TensorProduct.inductionOn with + | tmul a r => + refine ⟨Algebra.adjoin k ((({a} : Finset K)) : Set K), Subalgebra.fg_adjoin_finset {a}, ?_⟩ + exact ⟨⟨a, Algebra.subset_adjoin (by simp)⟩ ⊗ₜ r, rfl⟩ +diff --git a/Belyi/Curve/Descent.lean b/Belyi/Curve/Descent.lean +index 6b9f7a650d4dff22de4e56c486d24466fefb81cb..a2cce2df8151aeccc4e8f80b01eb00aebcb3879b 100644 +--- a/Belyi/Curve/Descent.lean ++++ b/Belyi/Curve/Descent.lean +@@ -5,6 +5,7 @@ Authors: The Belyi project contributors + -/ + import Mathlib.AlgebraicGeometry.Morphisms.Separated + import Mathlib.AlgebraicGeometry.Morphisms.Proper ++import Mathlib.AlgebraicGeometry.Morphisms.Immersion + import Mathlib.AlgebraicGeometry.Morphisms.FlatDescent + import Mathlib.AlgebraicGeometry.Morphisms.LocalFlatDescent + +diff --git a/Belyi/CurveField/KummerStep.lean b/Belyi/CurveField/KummerStep.lean +index f076a063d7f186ca0b78435c5861ba1d4cc41535..97aaee48ba1c670e92e3b024255997d5e11d5883 100644 +--- a/Belyi/CurveField/KummerStep.lean ++++ b/Belyi/CurveField/KummerStep.lean +@@ -210,7 +210,7 @@ theorem exists_mem_conductor_notMem (x : chartRingExt K L t) + have hle : conductor (chartRing t) x * differentIdeal (chartRing t) (chartRingExt K L t) ≤ + (heightOneBelow (R := chartRingExt K L t) Q.1 Q.ne_top + (algebraMap_chartRingExt_mem t Q htQ)).asIdeal := +- Ideal.mul_le_right.trans fun c hc ↦ mem_heightOneBelow.mpr (h c hc) ++ Ideal.mul_le_left.trans fun c hc ↦ mem_heightOneBelow.mpr (h c hc) + rw [hcd] at hle + exact hunit (mem_heightOneBelow.mp (hle (Ideal.mem_span_singleton_self _))) + +diff --git a/Belyi/CurveField/Point.lean b/Belyi/CurveField/Point.lean +index 2dc6d8369c43f30a75c9ed06321882a01ecc8aa8..70d055182fd8f8b08de4c4d9f4debc97e0959f9a 100644 +--- a/Belyi/CurveField/Point.lean ++++ b/Belyi/CurveField/Point.lean +@@ -169,7 +169,7 @@ theorem exists_P_eq (P : Place K) : ∃ x : QbarPoint K, x.P = P := + rfl⟩ + + instance (P : Place K) : Finite (P.ResidueField →+* AlgebraicClosure ℚ) := +- Finite.of_equiv _ RingHom.equivRatAlgHom.symm ++ Finite.of_equiv _ (RingHom.equivRatAlgHom P.ResidueField (AlgebraicClosure ℚ)).symm + + /-- Only finitely many points lie over a finite set of places. -/ + theorem finite_setOf_mem {S : Set (Place K)} (hS : S.Finite) : +diff --git a/Belyi/P1/BaseChange.lean b/Belyi/P1/BaseChange.lean +index 67e8ea29c3b37ccb5050567dfc607f393ae525bc..45353c4786ceb7486db5baacea394e5cb22b7a7e 100644 +--- a/Belyi/P1/BaseChange.lean ++++ b/Belyi/P1/BaseChange.lean +@@ -152,7 +152,7 @@ lemma irrelevant_le_map_gradedMapOfAlgebra : + have h := Ideal.mem_map_of_mem (f := gradedMapOfAlgebra k₀ K) + (show X j ∈ (HomogeneousIdeal.irrelevant (P1Grading k₀)).toIdeal from hXj) + rwa [gradedMapOfAlgebra_apply, MvPolynomial.map_X] at h +- have hdvd : (X j : MvPolynomial (Fin 2) K) ∣ monomial d (coeff d p) := by ++ have hdvd : (X j : MvPolynomial (Fin 2) K) ∣ monomial d (p.coeff d) := by + rw [X, MvPolynomial.monomial_dvd_monomial] + exact ⟨Or.inr (by simpa [Finsupp.single_le_iff] using Nat.one_le_iff_ne_zero.mpr hj), + one_dvd _⟩ +diff --git a/Belyi/P1/BaseChangeIso.lean b/Belyi/P1/BaseChangeIso.lean +index 21faa2ba37302121df279eba05eeaaee970939e3..68d7005cb52f1ce424a12482d49efa03fc2f6a42 100644 +--- a/Belyi/P1/BaseChangeIso.lean ++++ b/Belyi/P1/BaseChangeIso.lean +@@ -217,7 +217,7 @@ lemma irrelevant_le_span_X (k : Type u) [CommRing k] : + have hXj : (X j : MvPolynomial (Fin 2) k) ∈ + Ideal.span (Set.range (fun i : Fin 2 => (X i : MvPolynomial (Fin 2) k))) := + Ideal.subset_span ⟨j, rfl⟩ +- have hdvd : (X j : MvPolynomial (Fin 2) k) ∣ monomial d (coeff d p) := by ++ have hdvd : (X j : MvPolynomial (Fin 2) k) ∣ monomial d (p.coeff d) := by + rw [X, MvPolynomial.monomial_dvd_monomial] + exact ⟨Or.inr (by simpa [Finsupp.single_le_iff] using Nat.one_le_iff_ne_zero.mpr hj), + one_dvd _⟩ +diff --git a/Belyi/P1/PointsBaseChange.lean b/Belyi/P1/PointsBaseChange.lean +index 45a48c5d2f6fd9d5ce64b3dc5c6069d12a3ec505..2e91534e2218acc5817e46cefa8ddca786948591 100644 +--- a/Belyi/P1/PointsBaseChange.lean ++++ b/Belyi/P1/PointsBaseChange.lean +@@ -39,9 +39,9 @@ variable {σ : Type*} {R S : Type*} [CommRing R] [CommRing S] + /-- `x` is divisible by `monomial s 1` iff every coefficient at a multi-index not `≥ s` + vanishes. -/ + lemma monomial_one_dvd_iff_forall_coeff (x : MvPolynomial σ R) (s : σ →₀ ℕ) : +- (monomial s 1) ∣ x ↔ ∀ d, ¬ s ≤ d → coeff d x = 0 := by ++ (monomial s 1) ∣ x ↔ ∀ d, ¬ s ≤ d → x.coeff d = 0 := by + rw [monomial_one_dvd_iff_modMonomial_eq_zero, MvPolynomial.ext_iff] +- simp only [coeff_zero] ++ simp only [AddMonoidAlgebra.coeff_zero, Finsupp.zero_apply] + constructor + · intro h d hd + rw [← coeff_modMonomial_of_not_le x hd] +diff --git a/Belyi/P1/PolynomialMap.lean b/Belyi/P1/PolynomialMap.lean +index 42a9a639fb8f479e712e560ea9ab9d3b0ba9b574..68e923dda9fa8a991b8fbbcece70bc63e7424c47 100644 +--- a/Belyi/P1/PolynomialMap.lean ++++ b/Belyi/P1/PolynomialMap.lean +@@ -64,7 +64,7 @@ lemma X1_dvd_homogInput_sub : + homogInput k g - C (g.coeff g.natDegree) * X 0 ^ g.natDegree := by + rw [MvPolynomial.X_dvd_iff_modMonomial_eq_zero] + ext m +- rw [coeff_zero] ++ rw [AddMonoidAlgebra.coeff_zero, Finsupp.zero_apply] + by_cases hm : Finsupp.single (1 : Fin 2) 1 ≤ m + · exact MvPolynomial.coeff_modMonomial_of_le _ hm + · rw [MvPolynomial.coeff_modMonomial_of_not_le _ hm] +@@ -122,7 +122,7 @@ lemma X1_notMem_or_homogInput_notMem (hd : 0 < g.natDegree) + obtain ⟨j, hj⟩ : ∃ j, dd j ≠ 0 := by + by_contra hcon + exact hd0 (by ext j; simpa using not_not.mp (not_exists.mp hcon j)) +- have hdvd : (X j : MvPolynomial (Fin 2) k) ∣ monomial dd (coeff dd p) := by ++ have hdvd : (X j : MvPolynomial (Fin 2) k) ∣ monomial dd (p.coeff dd) := by + rw [MvPolynomial.X, MvPolynomial.monomial_dvd_monomial] + exact ⟨Or.inr (by simpa [Finsupp.single_le_iff] using Nat.one_le_iff_ne_zero.mpr hj), + one_dvd _⟩ +diff --git a/lake-manifest.json b/lake-manifest.json +index 5353a1a61ba8bdc45abdead73e0e5baa1c450bb7..7f84303cb861125f4c4a0499e51c10f46933cd33 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,31 +1,51 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/lana-agents/oka.git", ++ [{"url": "https://github.com/lana-agents/belyi.git", + "type": "git", + "subDir": null, + "scope": "", +- "rev": "da228a2cf9671aaba08ddc96274d75e098b28f67", ++ "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "name": "belyi", ++ "manifestFile": "lake-manifest.json", ++ "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "inherited": true, ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/oka.git", ++ "type": "git", ++ "subDir": null, ++ "scope": "", ++ "rev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", + "name": "oka", + "manifestFile": "lake-manifest.json", +- "inputRev": "da228a2cf9671aaba08ddc96274d75e098b28f67", ++ "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", + "inherited": false, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/mathlib4", ++ {"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, ++ {"url": "https://github.com/lana-agents/heights.git", ++ "type": "git", ++ "subDir": null, ++ "scope": "", ++ "rev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", ++ "name": "heights", ++ "manifestFile": "lake-manifest.json", ++ "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", ++ "inherited": true, ++ "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -35,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -65,7 +85,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -75,7 +95,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -85,7 +105,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -95,10 +115,10 @@ + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "belyi", +diff --git a/lakefile.toml b/lakefile.toml +index 070a3d25f5ff8b83defe14d6e08e25b0eaa46449..28c618d17067766cc8d57c5a2dca9f227227c1ee 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,6 +4,8 @@ keywords = ["math"] + defaultTargets = ["Belyi"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true +@@ -11,13 +13,13 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[require]] + name = "oka" + git = "https://github.com/lana-agents/oka.git" +-rev = "da228a2cf9671aaba08ddc96274d75e098b28f67" ++rev = "75dcdc3faadd10b986afb9283e89902bcdddecd4" + + [[lean_lib]] + name = "Belyi" +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/carleson-lean4341.patch b/lean/patches/carleson-lean4341.patch index cd2c5058a88ee0bfd1881ca64cc63852f9245b25..7185ab1aedd905bbdc034200f6690267becaf279 100644 --- a/lean/patches/carleson-lean4341.patch +++ b/lean/patches/carleson-lean4341.patch @@ -1,4374 +1,4374 @@ -diff --git a/Carleson/Calculations.lean b/Carleson/Calculations.lean -index 6eb7367..259674d 100644 ---- a/Carleson/Calculations.lean -+++ b/Carleson/Calculations.lean -@@ -1,4 +1,7 @@ --/- -+import Carleson.ProofData -+import Mathlib.Tactic.Rify -+ -+/-! - This is a file for arithmetical lemmas - - lemmas that don't depend on any of Carleson's project definitions, or, really, - on any fancy definitions period. -@@ -7,9 +10,6 @@ Roughly speaking, if a lemma is in this file, it should be purely calculational/ - e.g. `lemma calculation_1 : 2 + 2 = 4`. - All lemmas are prepended with a prefix `calculation_`. - -/ --import Carleson.ProofData --import Mathlib.Tactic.Rify -- - open ShortVariables - open scoped NNReal ENNReal - variable {X : Type*} {a : ℕ} {q : ℝ} {K : X → X → ℂ} {σ₁ σ₂ : X → ℤ} {F G : Set X} -@@ -80,7 +80,8 @@ lemma calculation_10 (h : (100 : ℝ) < D) : - _ < _ := by norm_num - - lemma calculation_3 [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F G] {x y : ℤ} (h : x + 3 < y) : -- 100 * D ^ (x + 3) + ((4 * D ^ (-2 : ℝ)) * D ^ (x + 3)) + (((8 : ℝ)⁻¹ * D ^ (-3 : ℝ)) * D ^ (x + 3)) + 8 * D ^ y < 10 * D ^ y := by -+ 100 * D ^ (x + 3) + ((4 * D ^ (-2 : ℝ)) * D ^ (x + 3)) + -+ (((8 : ℝ)⁻¹ * D ^ (-3 : ℝ)) * D ^ (x + 3)) + 8 * D ^ y < 10 * D ^ y := by - rw [← show (2 : ℝ) + 8 = 10 by norm_num, right_distrib] - gcongr - rw [← distrib_three_right ..] -@@ -120,9 +121,11 @@ lemma calculation_4 [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F G] - gcongr - _ ≤ 100 * D ^ (s_1 + 3) + 4 * D ^ (s_1 + 1) + 8⁻¹ * D ^ s_1 + 8 * D ^ s_3 := by - gcongr -- _ = 100 * D ^ (s_1 + 3) + ((4 * D ^ (- 2 : ℝ)) * D ^ (s_1 + 3)) + 8⁻¹ * D ^ s_1 + 8 * D ^ s_3 := by -+ _ = 100 * D ^ (s_1 + 3) + ((4 * D ^ (- 2 : ℝ)) * D ^ (s_1 + 3)) + -+ 8⁻¹ * D ^ s_1 + 8 * D ^ s_3 := by - rw [calculation_1 (s := s_1)] -- _ = 100 * D ^ (s_1 + 3) + ((4 * D ^ (- 2 : ℝ)) * D ^ (s_1 + 3)) + (((8 : ℝ)⁻¹ * D ^ (- 3 : ℝ)) * D ^ (s_1 + 3)) + 8 * D ^ s_3 := by -+ _ = 100 * D ^ (s_1 + 3) + ((4 * D ^ (- 2 : ℝ)) * D ^ (s_1 + 3)) + -+ (((8 : ℝ)⁻¹ * D ^ (- 3 : ℝ)) * D ^ (s_1 + 3)) + 8 * D ^ s_3 := by - rw [calculation_2 (s := s_1)] - _ < 10 * D ^ s_3 := by - exact calculation_3 (h := three) (X := X) -@@ -271,7 +274,6 @@ lemma calculation_7_7_4 [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F G] - trans 2 ^ 12 - · norm_num - gcongr -- · norm_num - lia - exact Nat.mul_le_mul this (Nat.le_add_left 1 n) - -diff --git a/Carleson/Defs.lean b/Carleson/Defs.lean -index a78a398..9da62ec 100644 ---- a/Carleson/Defs.lean -+++ b/Carleson/Defs.lean -@@ -4,11 +4,6 @@ import Carleson.ToMathlib.WeakType - import Mathlib.Analysis.CStarAlgebra.Classes - import Mathlib.Analysis.Fourier.AddCircle - --open MeasureTheory Measure Metric Complex Set Function ENNReal --open scoped NNReal -- --noncomputable section -- - /-! # Main statements of the Carleson project - - This file contains the statements of the main theorems from the Carleson formalization project: -@@ -31,6 +26,11 @@ Fourier sums for continous functions (Theorem 1.0.1 in the blueprint). - - -/ - -+open MeasureTheory Measure Metric Complex Set Function ENNReal -+open scoped NNReal -+ -+noncomputable section -+ - section DoublingMeasure - - universe u -@@ -74,15 +74,12 @@ variable [FunctionDistances 𝕜 X] - instance : Coe (Θ X) C(X, 𝕜) := ⟨FunctionDistances.coeΘ⟩ - instance : FunLike (Θ X) X 𝕜 where - coe := fun f ↦ (f : C(X, 𝕜)) -- coe_injective' _ _ hfg := FunctionDistances.coeΘ_injective fun x ↦ congrFun hfg x -- --set_option linter.unusedVariables false in -+ coe_injective _ _ hfg := FunctionDistances.coeΘ_injective fun x ↦ congrFun hfg x - /-- Class used to endow `Θ X` with a pseudometric space structure. -/ --@[nolint unusedArguments] --def WithFunctionDistance (x : X) (r : ℝ) := Θ X -+def WithFunctionDistance (_x : X) (_r : ℝ) := Θ X - --instance {x : X} {r : ℝ} [d : FunctionDistances 𝕜 X] : -- PseudoMetricSpace (WithFunctionDistance x r) := d.metric x r -+instance {x : X} {r : ℝ} : -+ PseudoMetricSpace (WithFunctionDistance x r) := FunctionDistances.metric x r - - end FunctionDistances - -@@ -228,8 +225,6 @@ This section contains the statements of the main theorems from the project: Theo - (classical Carleson), Theorem 1.1.1 (metric space Carleson) and Theorem 1.1.2 (linearised metric - Carleson). -/ - --set_option linter.unusedVariables false -- - open Real - - /-- The Nᵗʰ partial Fourier sum of `f : ℝ → ℂ` for `N : ℕ`. -/ -@@ -242,7 +237,7 @@ local notation "S_" => partialFourierSum - continous functions. - For the proof, see `classical_carleson` in the file `Carleson.Classical.ClassicalCarleson`. -/ - def ClassicalCarleson : Prop := -- ∀ {f : ℝ → ℂ} (cont_f : Continuous f) (periodic_f : f.Periodic (2 * π)), -+ ∀ {f : ℝ → ℂ} (_cont_f : Continuous f) (_periodic_f : f.Periodic (2 * π)), - ∀ᵐ x, Filter.Tendsto (S_ · f x) Filter.atTop (nhds (f x)) - - /-- The constant used in `MetricSpaceCarleson` and `LinearizedMetricCarleson`. -@@ -253,10 +248,10 @@ def C1_0_2 (a : ℕ) (q : ℝ≥0) : ℝ≥0 := 2 ^ ((3 * 𝕔 + 18 + 5 * (𝕔 - For the proof, see `metric_carleson` in the file `Carleson.MetricCarleson.Main`. -/ - def MetricSpaceCarleson : Prop := - ∀ {X : Type*} {a : ℕ} [MetricSpace X] {q q' : ℝ≥0} {F G : Set X} {K : X → X → ℂ} -- [KernelProofData a K] {f : X → ℂ} [IsCancellative X (defaultτ a)] (hq : q ∈ Ioc 1 2) -- (hqq' : q.HolderConjugate q') (mF : MeasurableSet F) (mG : MeasurableSet G) -- (mf : Measurable f) (nf : (‖f ·‖) ≤ F.indicator 1) -- (hT : HasBoundedStrongType (nontangentialOperator K · ·) 2 2 volume volume (C_Ts a)), -+ [KernelProofData a K] {f : X → ℂ} [IsCancellative X (defaultτ a)] (_hq : q ∈ Ioc 1 2) -+ (_hqq' : q.HolderConjugate q') (_mF : MeasurableSet F) (_mG : MeasurableSet G) -+ (_mf : Measurable f) (_nf : (‖f ·‖) ≤ F.indicator 1) -+ (_hT : HasBoundedStrongType (nontangentialOperator K · ·) 2 2 volume volume (C_Ts a)), - ∫⁻ x in G, carlesonOperator K f x ≤ C1_0_2 a q * volume G ^ (q' : ℝ)⁻¹ * volume F ^ (q : ℝ)⁻¹ - - /-- Theorem 1.1.2. -@@ -264,9 +259,10 @@ For the proof, see `linearized_metric_carleson` in the file `Carleson.MetricCarl - def LinearizedMetricCarleson : Prop := - ∀ {X : Type*} {a : ℕ} [MetricSpace X] {q q' : ℝ≥0} {F G : Set X} {K : X → X → ℂ} - [KernelProofData a K] {Q : SimpleFunc X (Θ X)} {f : X → ℂ} [IsCancellative X (defaultτ a)] -- (hq : q ∈ Ioc 1 2) (hqq' : q.HolderConjugate q') (mF : MeasurableSet F) (mG : MeasurableSet G) -- (mf : Measurable f) (nf : (‖f ·‖) ≤ F.indicator 1) -- (hT : ∀ θ : Θ X, HasBoundedStrongType (linearizedNontangentialOperator Q θ K · ·) -+ (_hq : q ∈ Ioc 1 2) (_hqq' : q.HolderConjugate q') -+ (_mF : MeasurableSet F) (_mG : MeasurableSet G) -+ (_mf : Measurable f) (_nf : (‖f ·‖) ≤ F.indicator 1) -+ (_hT : ∀ θ : Θ X, HasBoundedStrongType (linearizedNontangentialOperator Q θ K · ·) - 2 2 volume volume (C_Ts a)), - ∫⁻ x in G, linearizedCarlesonOperator Q K f x ≤ - C1_0_2 a q * volume G ^ (q' : ℝ)⁻¹ * volume F ^ (q : ℝ)⁻¹ -diff --git a/Carleson/DoublingMeasure.lean b/Carleson/DoublingMeasure.lean -index e571aff..f186a8a 100644 ---- a/Carleson/DoublingMeasure.lean -+++ b/Carleson/DoublingMeasure.lean -@@ -2,12 +2,6 @@ import Carleson.Defs - import Carleson.LipschitzNorm - import Carleson.ToMathlib.Data.ENNReal - --open MeasureTheory Measure Metric Complex Set Bornology Function --open ENNReal hiding one_lt_two --open scoped NNReal -- --noncomputable section -- - /-! # Basic definitions and lemmas - - This file contains definitions from Section 2 of the blueprint and used throughout the proof -@@ -18,6 +12,12 @@ provided for them (as well as for the constants `a` and `tau`). - - -/ - -+open MeasureTheory Measure Metric Complex Set Bornology Function -+open ENNReal hiding one_lt_two -+open scoped NNReal -+ -+noncomputable section -+ - lemma seven_le_c : 7 ≤ 𝕔 := by simp [𝕔] - - lemma c_le_100 : 𝕔 ≤ 100 := by simp [𝕔] -@@ -76,8 +76,7 @@ lemma hundred_lt_D : 100 < defaultD a := by - have : 16 ≤ a ^ 2 := by nlinarith [four_le_a X] - simp only [defaultD] - gcongr -- · norm_num -- · nlinarith [seven_le_c] -+ nlinarith [seven_le_c] - - -- used in 7.5.6 (`limited_scale_impact`) - lemma hundred_lt_realD : (100 : ℝ) < defaultD a := mod_cast hundred_lt_D X -@@ -190,7 +189,7 @@ variable [FunctionDistances 𝕜 X] - - instance : ContinuousMapClass (Θ X) X 𝕜 := ⟨fun f ↦ (f : C(X, 𝕜)).2⟩ - --def toWithFunctionDistance {x : X} {r : ℝ} [FunctionDistances 𝕜 X] : -+def toWithFunctionDistance {x : X} {r : ℝ} : - Θ X ≃ WithFunctionDistance x r := .refl _ - - end FunctionDistances -@@ -219,12 +218,12 @@ lemma oscillation_le_cdist [CompatibleFunctions 𝕜 X A] (x : X) (r : ℝ) (f g - (hy : y ∈ ball x r) (hz : z ∈ ball x r) : - ‖coeΘ f y - coeΘ g y - coeΘ f z + coeΘ g z‖ ≤ dist_{x, r} f g := by - apply le_trans <| le_localOscillation x r f g hy hz -- rw [← ENNReal.toReal_ofReal dist_nonneg] -+ erw [← ENNReal.toReal_ofReal dist_nonneg] - exact ENNReal.toReal_mono ENNReal.ofReal_ne_top CompatibleFunctions.localOscillation_le_cdist - - export CompatibleFunctions (localOscillation_le_cdist cdist_mono cdist_le le_cdist) - --lemma dist_congr [FunctionDistances 𝕜 X] {x₁ x₂ : X} {r₁ r₂ : ℝ} {f g : Θ X} -+lemma cdist_congr [FunctionDistances 𝕜 X] {x₁ x₂ : X} {r₁ r₂ : ℝ} {f g : Θ X} - (e₁ : x₁ = x₂) (e₂ : r₁ = r₂) : dist_{x₁, r₁} f g = dist_{x₂, r₂} f g := by congr - - variable (X) in -@@ -253,7 +252,9 @@ lemma enorm_integral_exp_le [CompatibleFunctions ℝ X A] {τ : ℝ} [IsCancella - rcases eq_or_ne (iLipENorm φ x r) ∞ with h1 | h1 - · apply le_top.trans_eq - symm -- simp [h1, edist_ne_top, hA, (measure_ball_pos volume x hr).ne'] -+ have finite_dist : edist_{x, r} f g ≠ ∞ := edist_ne_top -+ (toWithFunctionDistance f) (toWithFunctionDistance g) -+ simp [h1, finite_dist, hA, (measure_ball_pos volume x hr).ne'] - exact IsCancellative.enorm_integral_exp_le' hr h1 h2 - - /-- Constructor of `IsCancellative` in terms of real norms instead of extended reals. -/ -@@ -266,7 +267,7 @@ lemma isCancellative_of_norm_integral_exp_le (τ : ℝ) [CompatibleFunctions ℝ - constructor - intro x r φ hr h1 h2 f g - convert ENNReal.ofReal_le_ofReal (h (x := x) (r := r) (φ := φ) hr h1 h2 (f := f) (g := g)) -- · rw [ofReal_norm_eq_enorm] -+ · rw [ofReal_norm] - congr 1 - rw [setIntegral_eq_integral_of_forall_compl_eq_zero (fun y hy ↦ ?_)] - have : φ y = 0 := by -@@ -280,10 +281,10 @@ lemma isCancellative_of_norm_integral_exp_le (τ : ℝ) [CompatibleFunctions ℝ - · simp - · simp only [Measure.real, ofReal_toReal measure_ball_ne_top] - · simp [iLipNNNorm, coe_toNNReal h1] -- · rw [← ENNReal.ofReal_rpow_of_pos (by positivity)] -+ · have nonneg_dist : 0 ≤ dist_{x, r} f g := dist_nonneg -+ rw [← ENNReal.ofReal_rpow_of_pos (by linarith)] - congr -- rw [ENNReal.ofReal_add zero_le_one dist_nonneg] -- simp [edist_dist] -+ erw [ENNReal.ofReal_add zero_le_one dist_nonneg, ENNReal.ofReal_one, edist_dist] - - /-- The "volume function" `V`. We will need to assume - `IsFiniteMeasureOnCompacts` and `ProperSpace` to actually know that this volume is finite. -/ -@@ -492,25 +493,28 @@ variable [CompatibleFunctions ℝ X (defaultA a)] - lemma le_cdist_iterate {x : X} {r : ℝ} (hr : 0 ≤ r) (f g : Θ X) (k : ℕ) : - 2 ^ k * dist_{x, r} f g ≤ dist_{x, (defaultA a) ^ k * r} f g := by - induction k with -- | zero => rw [pow_zero, one_mul]; congr! <;> simp -+ | zero => -+ rw [pow_zero, one_mul] -+ exact (cdist_congr rfl (by simp)).le - | succ k ih => - trans 2 * dist_{x, (defaultA a) ^ k * r} f g - · rw [pow_succ', mul_assoc] - exact (mul_le_mul_iff_right₀ zero_lt_two).mpr ih - · convert le_cdist (ball_subset_ball _) using 1 -- · exact dist_congr rfl (by rw [← mul_assoc, pow_succ']) -+ · exact cdist_congr rfl (by rw [← mul_assoc, pow_succ']) - · nth_rw 1 [← one_mul ((defaultA a) ^ k * r)]; gcongr - rw [← Nat.cast_one, Nat.cast_le]; exact Nat.one_le_two_pow - - lemma cdist_le_iterate {x : X} {r : ℝ} (hr : 0 < r) (f g : Θ X) (k : ℕ) : - dist_{x, 2 ^ k * r} f g ≤ (defaultA a) ^ k * dist_{x, r} f g := by - induction k with -- | zero => simp_rw [pow_zero, one_mul]; congr! <;> simp -+ | zero => -+ rw [pow_zero, one_mul, pow_zero, one_mul] - | succ k ih => - trans defaultA a * dist_{x, 2 ^ k * r} f g -- · convert cdist_le _ using 1 -- · exact dist_congr rfl (by ring) -- · rw [dist_self]; positivity -+ · convert cdist_le (x₁ := x) (x₂ := x) (f := f) (g := g) -+ (r := 2 ^ k * r) (by rw [dist_self]; positivity) using 1 -+ exact cdist_congr rfl (by ring) - · replace ih := (mul_le_mul_iff_right₀ (show 0 < (defaultA a : ℝ) by positivity)).mpr ih - rwa [← mul_assoc, ← pow_succ'] at ih - -diff --git a/Carleson/LipschitzNorm.lean b/Carleson/LipschitzNorm.lean -index 7c1a823..39c29c5 100644 ---- a/Carleson/LipschitzNorm.lean -+++ b/Carleson/LipschitzNorm.lean -@@ -2,9 +2,6 @@ import Mathlib.Analysis.Normed.Field.Basic - import Mathlib.Topology.EMetricSpace.Lipschitz - import Carleson.Defs - --open Metric Function ENNReal --open scoped NNReal -- - /-! - # Inhomogeneous Lipschitz norm - -@@ -14,6 +11,9 @@ Lemmas about this norm that are proven in Carleson are collected here. - TODO: Assess Mathlib-readiness, complete basic results, optimize imports. - -/ - -+open Metric Function ENNReal -+open scoped NNReal -+ - noncomputable section - - section Def -@@ -54,7 +54,7 @@ lemma iLipENorm_le_add (h : ∀ x ∈ ball z R, ‖φ x‖ ≤ C) - have W := h' x hx x' hx' hne - rw [ENNReal.div_le_iff (by simpa only [ne_eq, edist_eq_zero] using hne) (edist_ne_top x x')] - convert ENNReal.ofReal_le_ofReal W -- · exact (ofReal_norm_eq_enorm (φ x - φ x')).symm -+ · exact (ofReal_norm (φ x - φ x')).symm - · rw [ENNReal.ofReal_div_of_pos hR, ENNReal.ofReal_mul NNReal.zero_le_coe, edist_dist, - ENNReal.mul_div_right_comm, ENNReal.ofReal_coe_nnreal] - -diff --git a/Carleson/ProofData.lean b/Carleson/ProofData.lean -index 0046632..1582b2d 100644 ---- a/Carleson/ProofData.lean -+++ b/Carleson/ProofData.lean -@@ -1,10 +1,5 @@ - import Carleson.DoublingMeasure - --open MeasureTheory Measure Metric Complex Set TopologicalSpace Bornology Function --open ENNReal hiding one_lt_two --open scoped NNReal --noncomputable section -- - /-! # ProofData. - - This file introduces the class `ProofData`, used to bundle data common through most of -@@ -12,6 +7,11 @@ chapters 2-7 (except 3), and provides API for it. - - -/ - -+open MeasureTheory Measure Metric Complex Set TopologicalSpace Bornology Function -+open ENNReal hiding one_lt_two -+open scoped NNReal -+noncomputable section -+ - /-- Data common through most of chapters 2-7 (except 3). -/ - class ProofData {X : Type*} (a : outParam ℕ) (q : outParam ℝ) (K : outParam (X → X → ℂ)) - (σ₁ σ₂ : outParam (X → ℤ)) (F G : outParam (Set X)) [PseudoMetricSpace X] extends -@@ -180,7 +180,6 @@ lemma DκZ_le_two_rpow_100 [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F - _ ≤ 1 * 4 ^ 2 * 2 ^ (2 * 4) := by norm_num - _ ≤ _ := by - gcongr -- norm_num - - lemma four_le_Z [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F G] : 4 ≤ Z := by - rw [defaultZ, show 4 = 2 ^ 2 by rfl] -diff --git a/Carleson/ToMathlib/Annulus.lean b/Carleson/ToMathlib/Annulus.lean -index 207eb52..09d38d0 100644 ---- a/Carleson/ToMathlib/Annulus.lean -+++ b/Carleson/ToMathlib/Annulus.lean -@@ -183,67 +183,67 @@ lemma cc_subset_closedBall {x : X} {r R : ℝ} : cc x r R ⊆ closedBall x R := - lemma oc_union_oo {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' < R) : - oc x r r' ∪ oo x r' R = oo x r R := by - -- XXX: should this proof be written as `ext; grind [oc, oo]` instead? Same question below. -- ext; simp_rw [oc, oo, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioo_eq_Ioo h₁ h₂] -+ ext; simp_rw [oc, oo, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioo_eq_Ioo h₁ h₂] - - @[simp] - lemma oc_union_oc {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' ≤ R) : - oc x r r' ∪ oc x r' R = oc x r R := by -- ext; simp_rw [oc, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioc_eq_Ioc h₁ h₂] -+ ext; simp_rw [oc, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioc_eq_Ioc h₁ h₂] - - @[simp] - lemma oo_union_co {x : X} {r r' R : ℝ} (h₁ : r < r') (h₂ : r' ≤ R) : - oo x r r' ∪ co x r' R = oo x r R := by -- ext; simp_rw [oo, co, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Ico_eq_Ioo h₁ h₂] -+ ext; simp_rw [oo, co, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Ico_eq_Ioo h₁ h₂] - - @[simp] - lemma oo_union_cc {x : X} {r r' R : ℝ} (h₁ : r < r') (h₂ : r' ≤ R) : - oo x r r' ∪ cc x r' R = oc x r R := by -- ext; simp_rw [oo, cc, oc, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Icc_eq_Ioc h₁ h₂] -+ ext; simp_rw [oo, cc, oc, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Icc_eq_Ioc h₁ h₂] - - @[simp] - lemma cc_union_oo {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' < R) : - cc x r r' ∪ oo x r' R = co x r R := by -- ext; simp_rw [cc, oo, co, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioo_eq_Ico h₁ h₂] -+ ext; simp_rw [cc, oo, co, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioo_eq_Ico h₁ h₂] - - @[simp] - lemma cc_union_oc {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' ≤ R) : - cc x r r' ∪ oc x r' R = cc x r R := by -- ext; simp_rw [cc, oc, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioc_eq_Icc h₁ h₂] -+ ext; simp_rw [cc, oc, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioc_eq_Icc h₁ h₂] - - @[simp] - lemma co_union_co {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' ≤ R) : - co x r r' ∪ co x r' R = co x r R := by -- ext; simp_rw [co, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Ico_eq_Ico h₁ h₂] -+ ext; simp_rw [co, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Ico_eq_Ico h₁ h₂] - - @[simp] - lemma co_union_cc {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' ≤ R) : - co x r r' ∪ cc x r' R = cc x r R := by -- ext; simp_rw [co, cc, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Icc_eq_Icc h₁ h₂] -+ ext; simp_rw [co, cc, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Icc_eq_Icc h₁ h₂] - - @[simp] - lemma oc_union_oi {x : X} {r R : ℝ} (h : r ≤ R) : oc x r R ∪ oi x R = oi x r := by -- ext; simp_rw [oc, oi, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioi_eq_Ioi h] -+ ext; simp_rw [oc, oi, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioi_eq_Ioi h] - - @[simp] - lemma oo_union_ci {x : X} {r R : ℝ} (h : r < R) : - oo x r R ∪ ci x R = oi x r := by -- ext; simp_rw [oo, ci, oi, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Ici_eq_Ioi h] -+ ext; simp_rw [oo, ci, oi, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Ici_eq_Ioi h] - - @[simp] - lemma cc_union_oi {x : X} {r R : ℝ} (h : r ≤ R) : cc x r R ∪ oi x R = ci x r := by -- ext; simp_rw [cc, oi, ci, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioi_eq_Ici h] -+ ext; simp_rw [cc, oi, ci, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioi_eq_Ici h] - - @[simp] - lemma co_union_ci {x : X} {r R : ℝ} (h : r ≤ R) : co x r R ∪ ci x R = ci x r := by -- ext; simp_rw [co, ci, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Ici_eq_Ici h] -+ ext; simp_rw [co, ci, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Ici_eq_Ici h] - - theorem iUnion_co_eq_ci {x : X} {f : ℕ → ℝ} (hf : ∀ n, f 0 ≤ f n) (h2f : ¬BddAbove (range f)) : - ⋃ (i : Nat), co x (f i) (f (i+1)) = ci x (f 0) := by -- simp [co, ci, iUnion_setOf, ← iUnion_Ico_eq_Ici hf h2f] -+ simp [co, ci, iUnion_ofPred, ← iUnion_Ico_eq_Ici hf h2f] - - theorem iUnion_oc_eq_oi {x : X} {f : ℕ → ℝ} (hf : ∀ n, f 0 ≤ f n) (h2f : ¬BddAbove (range f)) : - ⋃ (i : Nat), oc x (f i) (f (i+1)) = oi x (f 0) := by -- simp [oc, oi, iUnion_setOf, ← iUnion_Ioc_eq_Ioi hf h2f] -+ simp [oc, oi, iUnion_ofPred, ← iUnion_Ioc_eq_Ioi hf h2f] - - variable {ι : Type*} [LinearOrder ι] [SuccOrder ι] - -@@ -501,59 +501,59 @@ lemma cc_subset_ci {x : X} {r₁ R₁ r₂ : ℝ≥0∞} (hr : r₂ ≤ r₁) : - @[simp] - lemma oc_union_oo {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' < R) : - oc x r r' ∪ oo x r' R = oo x r R := by -- ext; simp_rw [oc, oo, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioo_eq_Ioo h₁ h₂] -+ ext; simp_rw [oc, oo, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioo_eq_Ioo h₁ h₂] - - @[simp] - lemma oc_union_oc {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' ≤ R) : - oc x r r' ∪ oc x r' R = oc x r R := by -- ext; simp_rw [oc, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioc_eq_Ioc h₁ h₂] -+ ext; simp_rw [oc, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioc_eq_Ioc h₁ h₂] - - @[simp] - lemma oo_union_co {x : X} {r r' R : ℝ≥0∞} (h₁ : r < r') (h₂ : r' ≤ R) : - oo x r r' ∪ co x r' R = oo x r R := by -- ext; simp_rw [oo, co, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Ico_eq_Ioo h₁ h₂] -+ ext; simp_rw [oo, co, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Ico_eq_Ioo h₁ h₂] - - @[simp] - lemma oo_union_cc {x : X} {r r' R : ℝ≥0∞} (h₁ : r < r') (h₂ : r' ≤ R) : - oo x r r' ∪ cc x r' R = oc x r R := by -- ext; simp_rw [oo, cc, oc, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Icc_eq_Ioc h₁ h₂] -+ ext; simp_rw [oo, cc, oc, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Icc_eq_Ioc h₁ h₂] - - @[simp] - lemma cc_union_oo {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' < R) : - cc x r r' ∪ oo x r' R = co x r R := by -- ext; simp_rw [cc, oo, co, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioo_eq_Ico h₁ h₂] -+ ext; simp_rw [cc, oo, co, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioo_eq_Ico h₁ h₂] - - @[simp] - lemma cc_union_oc {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' ≤ R) : - cc x r r' ∪ oc x r' R = cc x r R := by -- ext; simp_rw [cc, oc, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioc_eq_Icc h₁ h₂] -+ ext; simp_rw [cc, oc, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioc_eq_Icc h₁ h₂] - - @[simp] - lemma co_union_co {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' ≤ R) : - co x r r' ∪ co x r' R = co x r R := by -- ext; simp_rw [co, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Ico_eq_Ico h₁ h₂] -+ ext; simp_rw [co, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Ico_eq_Ico h₁ h₂] - - @[simp] - lemma co_union_cc {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' ≤ R) : - co x r r' ∪ cc x r' R = cc x r R := by -- ext; simp_rw [co, cc, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Icc_eq_Icc h₁ h₂] -+ ext; simp_rw [co, cc, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Icc_eq_Icc h₁ h₂] - - @[simp] - lemma oc_union_oi {x : X} {r R : ℝ≥0∞} (h : r ≤ R) : oc x r R ∪ oi x R = oi x r := by -- ext; simp_rw [oc, oi, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioi_eq_Ioi h] -+ ext; simp_rw [oc, oi, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioi_eq_Ioi h] - - @[simp] - lemma oo_union_ci {x : X} {r R : ℝ≥0∞} (h : r < R) : - oo x r R ∪ ci x R = oi x r := by -- ext; simp_rw [oo, ci, oi, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Ici_eq_Ioi h] -+ ext; simp_rw [oo, ci, oi, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Ici_eq_Ioi h] - - @[simp] - lemma cc_union_oi {x : X} {r R : ℝ≥0∞} (h : r ≤ R) : cc x r R ∪ oi x R = ci x r := by -- ext; simp_rw [cc, oi, ci, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioi_eq_Ici h] -+ ext; simp_rw [cc, oi, ci, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioi_eq_Ici h] - - @[simp] - lemma co_union_ci {x : X} {r R : ℝ≥0∞} (h : r ≤ R) : co x r R ∪ ci x R = ci x r := by -- ext; simp_rw [co, ci, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Ici_eq_Ici h] -+ ext; simp_rw [co, ci, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Ici_eq_Ici h] - - - variable [MeasurableSpace X] [OpensMeasurableSpace X] -diff --git a/Carleson/ToMathlib/BoundedFiniteSupport.lean b/Carleson/ToMathlib/BoundedFiniteSupport.lean -index 0d70eec..13329c5 100644 ---- a/Carleson/ToMathlib/BoundedFiniteSupport.lean -+++ b/Carleson/ToMathlib/BoundedFiniteSupport.lean -@@ -1,5 +1,7 @@ - import Mathlib.MeasureTheory.Function.L1Space.Integrable - -+/-! # Bounded functions with support of finite measure -/ -+ - /- - This file defines BoundedFiniteSupport. - -diff --git a/Carleson/ToMathlib/CoveredByBalls.lean b/Carleson/ToMathlib/CoveredByBalls.lean -index f763c0c..ad367d9 100644 ---- a/Carleson/ToMathlib/CoveredByBalls.lean -+++ b/Carleson/ToMathlib/CoveredByBalls.lean -@@ -1,5 +1,7 @@ - import Carleson.ToMathlib.Misc - -+/-! Covers by finitely many metric balls. -/ -+ - -- Upstreaming status: ready to go; two lemmas need to move to different files - -- and the remainder could go into a new file - -@@ -8,8 +10,6 @@ open scoped NNReal - - variable {X : Type*} [PseudoMetricSpace X] - {s t : Set X} {n m : ℕ} {r r' r₁ r₂ r₃ : ℝ} -- --set_option linter.unusedVariables false in - /-- `s` can be covered by at most `N` balls with radius `r`. -/ - @[mk_iff] - class inductive CoveredByBalls (s : Set X) (n : ℕ) (r : ℝ) : Prop where -@@ -123,7 +123,7 @@ lemma pow {a : ℝ} {k : ℕ} (h : AllBallsCoverBalls X a n) : - AllBallsCoverBalls X (a ^ k) (n ^ k) := by - intro r - induction k with -- | zero => simpa using fun x ↦ .ball x r -+ | zero => simpa [BallsCoverBalls] using fun x ↦ CoveredByBalls.ball x r - | succ m h2 => - specialize h (r * a^m) - rw [← mul_assoc, mul_comm, ← mul_assoc] at h -diff --git a/Carleson/ToMathlib/Data/ENNReal.lean b/Carleson/ToMathlib/Data/ENNReal.lean -index 9884494..ede2520 100644 ---- a/Carleson/ToMathlib/Data/ENNReal.lean -+++ b/Carleson/ToMathlib/Data/ENNReal.lean -@@ -20,15 +20,6 @@ namespace ENNReal - attribute [simp] ofReal_of_nonpos - -- protect ENNReal.mul_le_mul_left - --theorem ofReal_inv_le {x : ℝ} : ENNReal.ofReal x⁻¹ ≤ (ENNReal.ofReal x)⁻¹ := by -- obtain hx|hx := lt_or_ge 0 x <;> simp [ofReal_inv_of_pos, hx] -- --theorem ofReal_div_le {x y : ℝ} (hy : 0 ≤ y) : -- ENNReal.ofReal (x / y) ≤ ENNReal.ofReal x / ENNReal.ofReal y := by -- simp_rw [div_eq_mul_inv, ofReal_mul' (inv_nonneg.2 hy)] -- gcongr -- exact ofReal_inv_le -- - theorem coe_lt_iff_lt_toNNReal {a : ℝ≥0∞} {t : ℝ≥0} (ha : a ≠ ⊤) : - t < a ↔ t < a.toNNReal := by - rw [← ENNReal.toNNReal_coe t, ENNReal.toNNReal_lt_toNNReal ENNReal.coe_ne_top ha] -@@ -110,7 +101,8 @@ lemma enorm_sum_eq_sum_enorm {f : α → ℝ} (hf : ∀ i ∈ t, 0 ≤ f i) : - - /-- The reverse triangle inequality for `enorm`. -/ - -- TODO: does a seminormed abelian additive group also have an ENormedAddMonoid structure? --lemma enorm_enorm_sub_enorm_le {E} [NormedAddCommGroup E] {x y : E} : ‖‖x‖ₑ - ‖y‖ₑ‖ₑ ≤ ‖x - y‖ₑ := by -+lemma enorm_enorm_sub_enorm_le {E} [NormedAddCommGroup E] {x y : E} : -+ ‖‖x‖ₑ - ‖y‖ₑ‖ₑ ≤ ‖x - y‖ₑ := by - rw [enorm_eq_self, tsub_le_iff_right] - nth_rw 1 [← sub_add_cancel x y] - exact enorm_add_le (x - y) y -diff --git a/Carleson/ToMathlib/ENorm.lean b/Carleson/ToMathlib/ENorm.lean -index 92cb8f3..71b852b 100644 ---- a/Carleson/ToMathlib/ENorm.lean -+++ b/Carleson/ToMathlib/ENorm.lean -@@ -1,6 +1,8 @@ - import Mathlib.MeasureTheory.Function.LpSeminorm.Monotonicity - import Carleson.ToMathlib.Data.ENNReal - -+/-! # Extended norms and scalar multiplication of Lebesgue seminorms -/ -+ - -- Upstreaming status: can be upstreamed/being worked on - -- Many remaining declarations require PRing a new enorm class to mathlib first, - -- i.e. are not a good first target. -@@ -11,10 +13,11 @@ open ENNReal NNReal Function Set - - variable {α α' E E₁ E₂ : Type*} - --@[simp] lemma enorm_toReal_le {x : ℝ≥0∞} : ‖x.toReal‖ₑ ≤ x := by simp [← ofReal_norm, ofReal_toReal_le] -+@[simp] lemma enorm_toReal_le {x : ℝ≥0∞} : ‖x.toReal‖ₑ ≤ x := by -+ simp [← ofReal_norm, ofReal_toReal_le] - - @[simp] lemma enorm_toReal {x : ℝ≥0∞} (hx : x ≠ ⊤) : ‖x.toReal‖ₑ = x := by -- simp [hx, ← ofReal_norm_eq_enorm] -+ simp [hx, ← ofReal_norm] - - @[simp] lemma enorm_NNReal {x : ℝ≥0} : ‖x‖ₑ = x := by rfl - -@@ -24,14 +27,16 @@ variable {α α' E E₁ E₂ : Type*} - - /-- An enormed monoid is an additive monoid endowed with a continuous enorm. - Note: not sure if this is the "right" class to add to Mathlib. -/ --class ENormedAddCommSubMonoid (E : Type*) [TopologicalSpace E] extends ENormedAddCommMonoid E, Sub E where -+class ENormedAddCommSubMonoid (E : Type*) [TopologicalSpace E] -+ extends ENormedAddCommMonoid E, Sub E where - sub_add_cancel_of_enorm_le : ∀ ⦃x y : E⦄, ‖y‖ₑ ≤ ‖x‖ₑ → x - y + y = x - add_right_cancel_of_enorm_lt_top : ∀ ⦃x : E⦄, ‖x‖ₑ < ⊤ → ∀ {y z : E}, y + x = z + x → y = z - esub_self : ∀ x : E, x - x = 0 - - /-- An enormed space is an additive monoid endowed with a continuous enorm. - Note: not sure if this is the "right" class to add to Mathlib. -/ --class ENormedSpace (E : Type*) [TopologicalSpace E] extends ENormedAddCommMonoid E, Module ℝ≥0 E where -+class ENormedSpace (E : Type*) [TopologicalSpace E] -+ extends ENormedAddCommMonoid E, Module ℝ≥0 E where - enorm_smul_eq_smul : ∀ (c : ℝ≥0) (x : E), ‖c • x‖ₑ = c • ‖x‖ₑ - - export ENormedAddCommSubMonoid -@@ -96,14 +101,63 @@ instance : ContinuousConstSMul ℝ≥0 ℝ≥0∞ where - - open MeasureTheory - -+/-- The norm-formula functional, without a strong-measurability requirement. -/ -+def eLpNormFormula {α ε : Type*} [MeasurableSpace α] [ENorm ε] (f : α → ε) (p : ℝ≥0∞) -+ (μ : Measure α) : ℝ≥0∞ := -+ if p = 0 then 0 else if p = ∞ then eLpNormEssSup f μ else eLpNorm' f p.toReal μ -+ -+theorem eLpNorm_eq_eLpNormFormula {α ε : Type*} [MeasurableSpace α] [TopologicalSpace ε] -+ [ENorm ε] {f : α → ε} -+ {p : ℝ≥0∞} {μ : Measure α} (hf : AEStronglyMeasurable f μ) : -+ eLpNorm f p μ = eLpNormFormula f p μ := by -+ simp [eLpNorm, eLpNormFormula, hf] -+ -+theorem eLpNormFormula_const_nnreal_smul_le {α : Type*} [MeasurableSpace α] -+ {p : ℝ≥0∞} {μ : Measure α} {c : ℝ≥0} {f : α → ε} : -+ eLpNormFormula (c • f) p μ ≤ ‖c‖ₑ * eLpNormFormula f p μ := by -+ have hbound : ∀ᵐ x ∂μ, ‖(c • f) x‖ₑ ≤ c * ‖f x‖ₑ := by -+ filter_upwards with point using by simp [ENNReal.smul_def] -+ by_cases hp : p = 0 -+ · simp [eLpNormFormula, hp] -+ by_cases htop : p = ∞ -+ · simpa [eLpNormFormula, hp, htop, ENNReal.smul_def] using -+ eLpNormEssSup_le_nnreal_smul_eLpNormEssSup_of_ae_le_mul' hbound -+ simpa [eLpNormFormula, hp, htop, ENNReal.smul_def] using -+ eLpNorm'_le_nnreal_smul_eLpNorm'_of_ae_le_mul' hbound (ENNReal.toReal_pos hp htop) -+ -+theorem eLpNormFormula_const_nnreal_smul {α : Type*} [MeasurableSpace α] -+ {p : ℝ≥0∞} {μ : Measure α} {c : ℝ≥0} {f : α → ε} : -+ eLpNormFormula (c • f) p μ = ‖c‖ₑ * eLpNormFormula f p μ := by -+ obtain rfl | hc := eq_or_ne c 0 -+ · rw [zero_smul, ← eLpNorm_eq_eLpNormFormula aestronglyMeasurable_zero] -+ simp -+ refine le_antisymm eLpNormFormula_const_nnreal_smul_le <| ENNReal.mul_le_of_le_div' ?_ -+ simpa [ENNReal.div_eq_inv_mul, hc] using -+ eLpNormFormula_const_nnreal_smul_le (c := c⁻¹) (f := c • f) -+ -+theorem eLpNorm_const_nnreal_smul_of_aestronglyMeasurable -+ {α : Type*} [MeasurableSpace α] {p : ℝ≥0∞} {μ : Measure α} {c : ℝ≥0} {f : α → ε} -+ (hf : AEStronglyMeasurable f μ) (hcf : AEStronglyMeasurable (c • f) μ) : -+ eLpNorm (c • f) p μ = ‖c‖ₑ * eLpNorm f p μ := by -+ rw [eLpNorm_eq_eLpNormFormula hf, eLpNorm_eq_eLpNormFormula hcf] -+ exact eLpNormFormula_const_nnreal_smul -+ - -- TODO: put next to MeasureTheory.eLpNorm_const_smul_le (which perhaps can stay) --theorem eLpNorm_const_nnreal_smul_le {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} -- {μ : Measure α} {c : ℝ≥0} {f : α → ε} : eLpNorm (c • f) p μ ≤ ‖c‖ₑ * eLpNorm f p μ := by -- apply eLpNorm_le_nnreal_smul_eLpNorm_of_ae_le_mul' (p := p) ?_ -- filter_upwards with x using by simp [ENNReal.smul_def] -+theorem eLpNorm_const_nnreal_smul_le [ContinuousConstSMul ℝ≥0 ε] -+ {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} -+ {μ : Measure α} {c : ℝ≥0} {f : α → ε} : -+ eLpNorm (c • f) p μ ≤ ‖c‖ₑ * eLpNorm f p μ := by -+ by_cases hf : AEStronglyMeasurable f μ -+ · exact (eLpNorm_const_nnreal_smul_of_aestronglyMeasurable hf (hf.const_smul c)).le -+ rw [eLpNorm_of_not_aestronglyMeasurable hf] -+ obtain rfl | hc := eq_or_ne c 0 -+ · simp -+ · rw [ENNReal.mul_top (by simpa)] -+ exact le_top - - -- TODO: put next to eLpNorm_const_smul --theorem eLpNorm_const_smul' {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} -+theorem eLpNorm_const_smul' [ContinuousConstSMul ℝ≥0 ε] -+ {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} - {μ : Measure α} {c : ℝ≥0} {f : α → ε} : - eLpNorm (c • f) p μ = ‖c‖ₑ * eLpNorm f p μ := by - obtain rfl | hc := eq_or_ne c 0 -@@ -113,21 +167,24 @@ theorem eLpNorm_const_smul' {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0 - - set_option backward.isDefEq.respectTransparency false in - theorem eLpNorm_top_smul {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} -- {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEStronglyMeasurable f μ) : eLpNorm (∞ • f) p μ = ⊤ * eLpNorm f p μ := by -+ {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEStronglyMeasurable f μ) : -+ eLpNorm (∞ • f) p μ = ⊤ * eLpNorm f p μ := by -+ have htop : AEStronglyMeasurable (∞ • f) μ := -+ (hf.aemeasurable.const_mul ∞).aestronglyMeasurable - by_cases hp : p = 0 -- · simp [hp] -+ · simp [hp, hf, htop] - by_cases h : f =ᶠ[ae μ] 0 - · rw [eLpNorm_eq_zero_of_ae_zero h, mul_zero] - apply eLpNorm_eq_zero_of_ae_zero - filter_upwards [h] with x hx - simpa - · have : ¬ eLpNorm f p μ = 0 := by -- rwa [eLpNorm_eq_zero_iff hf hp] -+ rwa [eLpNorm_eq_zero_iff hp] - by_cases h' : eLpNorm f p μ = ⊤ - · simp only [h', ne_eq, top_ne_zero, not_false_eq_true, mul_top] - rw [eq_top_iff] at * - apply h'.trans -- apply eLpNorm_mono_enorm -+ apply eLpNorm_mono_enorm hf - intro x - simp only [enorm_eq_self, Pi.smul_apply, smul_eq_mul] - exact ENNReal.le_mul_top_self -@@ -145,7 +202,7 @@ theorem eLpNorm_top_smul {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} - congr - exact Eq.symm (coe_toNNReal h') - _ ≤ eLpNorm (∞ • f) p μ := by -- apply eLpNorm_mono_enorm -+ apply eLpNorm_mono_enorm (hf.const_smul _) - intro x - simp only [toNNReal_div, toNNReal_coe, Pi.smul_apply, enorm_smul_eq_smul, enorm_eq_self, - smul_eq_mul] -diff --git a/Carleson/ToMathlib/HardyLittlewood.lean b/Carleson/ToMathlib/HardyLittlewood.lean -index 5982df5..e3d46e3 100644 ---- a/Carleson/ToMathlib/HardyLittlewood.lean -+++ b/Carleson/ToMathlib/HardyLittlewood.lean -@@ -5,13 +5,13 @@ import Carleson.ToMathlib.Order.ConditionallyCompleteLattice.Indexed - import Mathlib.MeasureTheory.Covering.Vitali - import Mathlib.Tactic.Field - -+/-! This should roughly contain the contents of chapter 9. -/ -+ - open MeasureTheory Metric Bornology Set TopologicalSpace Vitali Filter Pointwise - open ENNReal hiding one_lt_two - open scoped NNReal - noncomputable section - --/-! This should roughly contain the contents of chapter 9. -/ -- - -- Upstreaming status: aside from getting the real interpolation theorem merged, - -- this file needs a bunch of clean-up before it can be upstreamed: - -- moving preliminary lemmas to their appropriate homes (some of these lemmas do not belong in -@@ -46,7 +46,8 @@ lemma exists_ball_subset_ball_two (c : X) {r : ℝ} (hr : 0 < r) : - exact (Real.rpow_intCast 2 m).symm - _ = _ := Real.rpow_logb zero_lt_two (OfNat.one_ne_ofNat 2).symm hr - have hm' : r < 2 ^ (m + 1) := by -- calc _ = (2 : ℝ) ^ Real.logb 2 r := (Real.rpow_logb zero_lt_two (OfNat.one_ne_ofNat 2).symm hr).symm -+ calc _ = (2 : ℝ) ^ Real.logb 2 r := -+ (Real.rpow_logb zero_lt_two (OfNat.one_ne_ofNat 2).symm hr).symm - _ < _ := by - rw [← Real.rpow_intCast 2 (m + 1)] - refine Real.strictMono_rpow_of_base_gt_one one_lt_two ?_ -@@ -87,7 +88,8 @@ variable {X E : Type*} {A : ℝ≥0} [MetricSpace X] [MeasurableSpace X] - open scoped Topology in - -- unused in Carleson - -- move to separate file (not sure where) --lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] (hf2 : AEStronglyMeasurable f μ) : -+lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] -+ (hf2 : AEStronglyMeasurable f μ) : - LowerSemicontinuousOn (fun x : X × ℝ ↦ ∫⁻ y in ball x.1 x.2, ‖f y‖ₑ ∂μ) (univ ×ˢ Ioi 0) := by - refine lowerSemicontinuousOn_iff_le_liminf.mpr fun x hx ↦ _root_.le_of_forall_pos_le_add ?_ - intro δ hδ -@@ -98,7 +100,7 @@ lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] (hf2 : AEStro - (𝓝[univ ×ˢ Ioi 0] x) < M := lt_add_right htop hδ.ne' - have : ∃ᶠ (z : X × ℝ) in 𝓝[univ ×ˢ Ioi 0] x, ∫⁻ (y : X) in ball z.1 z.2, ‖f y‖ₑ ∂μ < M := by - refine frequently_lt_of_liminf_lt ?_ hM -- simp only [IsCoboundedUnder, Filter.IsCobounded, ge_iff_le, eventually_map] -+ simp only [IsCoboundedUnder, Filter.IsCobounded, eventually_map] - use ∫⁻ (y : X) in ball x.1 x.2, ‖f y‖ₑ ∂μ - intro a ha; apply Eventually.self_of_nhdsWithin ha hx - obtain ⟨ns, hns₀, hns₁⟩ := -@@ -117,7 +119,8 @@ lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] (hf2 : AEStro - have : ∀ᶠ (n : ℕ) in atTop, dist z (ns n).1 - (ns n).2 < 0 := by - rw [mem_ball, ← sub_lt_zero] at hz; exact Tendsto.eventually_lt_const hz this - filter_upwards [this]; simp -- filter_upwards [hz2]; intro a ha; split_ifs; rfl -+ filter_upwards [hz2] with index hindex -+ simp only [hindex, ↓reduceIte, le_refl] - · simp - calc - ∫⁻ (y : X) in ball x.1 x.2, ‖f y‖ₑ ∂μ -@@ -129,7 +132,7 @@ lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] (hf2 : AEStro - _ ≤ M := by - apply liminf_le_of_le (f := atTop) - intro b hb -- simp only [eventually_atTop, ge_iff_le] at hb -+ simp only [eventually_atTop] at hb - obtain ⟨a, ha⟩ := hb - exact le_of_lt <| lt_of_le_of_lt (ha a le_rfl) <| - by unfold g; rw [lintegral_indicator measurableSet_ball]; exact hns₁ a -@@ -199,11 +202,11 @@ lemma continuous_integral_ball [OpensMeasurableSpace X] - have hz' : Tendsto z atTop (𝓝 x) := tendsto_nhds_of_tendsto_nhdsWithin hz - have := isBounded_range_of_tendsto z hz' - obtain ⟨r, hr⟩ := Bornology.IsBounded.subset_ball this x -- simp only [range, ball, setOf_subset_setOf, forall_exists_index, forall_apply_eq_imp_iff] at hr -+ simp only [range, ball, ofPred_subset_ofPred, forall_exists_index, forall_apply_eq_imp_iff] at hr - simp_rw [Prod.dist_eq] at hr - have hsub (n : ℕ) : ball (z n).1 (z n).2 ⊆ ball x.1 (x.2 + 2 * r) := by - intro y hy -- simp only [ball, mem_setOf_eq] at hy ⊢ -+ simp only [ball, mem_ofPred_eq] at hy ⊢ - calc dist y x.1 - _ ≤ dist y (z n).1 + dist (z n).1 x.1 := dist_triangle y (z n).1 x.1 - _ ≤ (z n).2 + dist (z n).1 x.1 := by gcongr -@@ -246,11 +249,10 @@ lemma continuous_integral_ball [OpensMeasurableSpace X] - linarith - · have : ∀ᵐ z : X ∂μ, dist z x.1 ≠ x.2 := by - change (μ ({z | ¬ (dist z x.1 ≠ x.2)}) = 0) -- simpa only [ne_eq, Decidable.not_not] using hμ x.1 x.2 hx_pos -+ simpa only [sphere, ne_eq, Decidable.not_not] using hμ x.1 x.2 hx_pos - filter_upwards [this] with y hy - by_cases hy2 : dist y x.1 < x.2 -- · simp only [indicator, ball, mem_setOf_eq] -- split_ifs -+ · simp only [indicator, ball, mem_ofPred_eq] - apply tendsto_nhds_of_eventually_eq - have hz2 : ∀ᶠ n : ℕ in atTop, dist y (z n).1 < (z n).2 := by - let dist_sub (a : X × ℝ) := dist y a.1 - a.2 -@@ -259,24 +261,27 @@ lemma continuous_integral_ball [OpensMeasurableSpace X] - have : ∀ᶠ (n : ℕ) in atTop, dist y (z n).1 - (z n).2 < 0 := by - rw [← sub_lt_zero] at hy2; exact Tendsto.eventually_lt_const hy2 this - filter_upwards [this]; simp -- filter_upwards [hz2]; intro a ha; split_ifs; rfl -+ filter_upwards [hz2] with index hindex -+ simp only [hindex, hy2, ↓reduceIte] - · have hz2 : ∀ᶠ n : ℕ in atTop, dist y (z n).1 > (z n).2 := by - let dist_sub (a : X × ℝ) := dist y a.1 - a.2 - have : ContinuousOn dist_sub (univ ×ˢ Ioi 0) := by fun_prop - have hcmp : Tendsto (dist_sub ∘ z) atTop (𝓝 (dist_sub x)) := Tendsto.comp (this x hx) hz - have hy2 : dist y x.1 > x.2 := by order - have hy2 : 0 < dist y x.1 - x.2 := sub_pos.mpr hy2 -- have : ∀ᶠ (n : ℕ) in atTop, 0 < dist y (z n).1 - (z n).2 := Tendsto.eventually_const_lt hy2 hcmp -+ have : ∀ᶠ (n : ℕ) in atTop, 0 < dist y (z n).1 - (z n).2 := -+ Tendsto.eventually_const_lt hy2 hcmp - filter_upwards [this]; simp -- simp only [indicator, ball, mem_setOf_eq] -+ simp only [indicator, ball, mem_ofPred_eq] - apply tendsto_nhds_of_eventually_eq - filter_upwards [hz2] with n hn - have : ¬ (dist y (z n).1 < (z n).2) := by linarith -- split_ifs; rfl -+ simp only [this, hy2, ↓reduceIte] - - -- unused in Carleson - -- move to separate file (not sure where) --lemma continuous_average_ball [μ.IsOpenPosMeasure] [IsFiniteMeasureOnCompacts μ] [OpensMeasurableSpace X] -+lemma continuous_average_ball [μ.IsOpenPosMeasure] [IsFiniteMeasureOnCompacts μ] -+ [OpensMeasurableSpace X] - [ProperSpace X] (hf : LocallyIntegrable f μ) - (hμ : ∀ z : X, ∀ r > (0 : ℝ), μ (sphere z r) = 0) : - ContinuousOn (fun x : X × ℝ ↦ ⨍⁻ y in ball x.1 x.2, ‖f y‖ₑ ∂μ) (univ ×ˢ Ioi 0) := by -@@ -368,7 +373,7 @@ theorem exists_disjoint_subfamily_covering_enlargement_closedBall' {α} [MetricS - exact h'a.le.trans <| by positivity - - -- move to Vitali --theorem Vitali.exists_disjoint_subfamily_covering_enlargement_ball {α} [MetricSpace α] (t : Set ι) -+theorem Vitali.exists_disjoint_subfamily_covering_enlargement_ball' {α} [MetricSpace α] (t : Set ι) - (x : ι → α) (r : ι → ℝ) (R : ℝ) (hr : ∀ a ∈ t, r a ≤ R) (τ : ℝ) (hτ : 3 < τ) : - ∃ u ⊆ t, - (u.PairwiseDisjoint fun a => ball (x a) (r a)) ∧ -@@ -402,7 +407,7 @@ theorem Set.Countable.measure_biUnion_le_lintegral [OpensMeasurableSpace X] (h - (l : ℝ≥0∞) (u : X → ℝ≥0∞) (R : ℝ) (hR : ∀ a ∈ 𝓑, r a ≤ R) - (h2u : ∀ i ∈ 𝓑, l * μ (ball (c i) (r i)) ≤ ∫⁻ x in ball (c i) (r i), u x ∂μ) : - l * μ (⋃ i ∈ 𝓑, ball (c i) (r i)) ≤ A ^ 2 * ∫⁻ x, u x ∂μ := by -- obtain ⟨B, hB𝓑, hB, h2B⟩ := Vitali.exists_disjoint_subfamily_covering_enlargement_ball -+ obtain ⟨B, hB𝓑, hB, h2B⟩ := Vitali.exists_disjoint_subfamily_covering_enlargement_ball' - 𝓑 c r R hR (2 ^ 2) (by norm_num) - have : Countable B := h𝓑.mono hB𝓑 - have disj := fun i j hij ↦ -@@ -473,20 +478,22 @@ theorem MB_le_eLpNormEssSup {u : X → E} {x : X} : MB μ 𝓑 c r u x ≤ eLpNo - - protected theorem HasStrongType.MB_top [BorelSpace X] : - HasStrongType (fun (u : X → E) (x : X) ↦ MB μ 𝓑 c r u x) ⊤ ⊤ μ μ 1 := by -- intro f _ -+ intro f hf - use Measurable.maximalFunction.aestronglyMeasurable -- simp only [one_mul, eLpNorm_exponent_top] -+ rw [one_mul, eLpNorm_exponent_top Measurable.maximalFunction.aestronglyMeasurable, -+ eLpNorm_exponent_top hf.aestronglyMeasurable] - exact essSup_le_of_ae_le _ (Eventually.of_forall fun x ↦ MB_le_eLpNormEssSup) - - /- The proof is roughly between (9.0.12)-(9.0.22). -/ - protected theorem HasWeakType.MB_one [BorelSpace X] (h𝓑 : 𝓑.Countable) - {R : ℝ} (hR : ∀ i ∈ 𝓑, r i ≤ R) : - HasWeakType (MB (E := E) μ 𝓑 c r) 1 1 μ μ (A ^ 2) := by -- intro f _ -+ intro f hf - use Measurable.maximalFunction.aestronglyMeasurable - let Bₗ (ℓ : ℝ≥0∞) := { i ∈ 𝓑 | ∫⁻ y in (ball (c i) (r i)), ‖f y‖ₑ ∂μ ≥ ℓ * μ (ball (c i) (r i)) } -- simp only [wnorm, one_ne_top, wnorm', toReal_one, inv_one, ENNReal.rpow_one, reduceIte, eLpNorm, -- one_ne_zero, eLpNorm', ne_eq, not_false_eq_true, div_self, iSup_le_iff] -+ rw [eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable] -+ simp only [wnorm, one_ne_top, wnorm', toReal_one, inv_one, ENNReal.rpow_one, reduceIte, -+ iSup_le_iff] - intro t - by_cases ht : t = 0 - · simp [ht] -@@ -495,17 +502,19 @@ protected theorem HasWeakType.MB_one [BorelSpace X] (h𝓑 : 𝓑.Countable) - (u := fun x ↦ ‖f x‖ₑ) (R := R) ?_ ?_) - · refine mul_right_mono <| μ.mono (fun x hx ↦ mem_iUnion₂.mpr ?_) - -- We need a ball in `Bₗ t` containing `x`. Since `MB μ 𝓑 c r f x` is large, such a ball exists -- simp only [mem_setOf_eq] at hx -+ simp only [mem_ofPred_eq] at hx - -- replace hx := lt_of_lt_of_le hx coe_toNNReal_le_self - simp only [MB, maximalFunction, ENNReal.rpow_one, inv_one] at hx - obtain ⟨i, ht⟩ := lt_iSup_iff.mp hx -- replace hx : x ∈ ball (c i) (r i) := -- by_contradiction <| fun h ↦ not_lt_of_ge (zero_le t) (ENNReal.coe_lt_coe.mp <| by simp [h] at ht) -+ replace hx : x ∈ ball (c i) (r i) := by -+ by_contra hball -+ simp [hball] at ht - refine ⟨i, ?_, hx⟩ - -- It remains only to confirm that the chosen ball is actually in `Bₗ t` -- simp only [ge_iff_le, mem_setOf_eq, Bₗ] -- have hi : i ∈ 𝓑 := -- by_contradiction <| fun h ↦ not_lt_of_ge (zero_le t) (ENNReal.coe_lt_coe.mp <| by simp [h] at ht) -+ simp only [ge_iff_le, mem_ofPred_eq, Bₗ] -+ have hi : i ∈ 𝓑 := by -+ by_contra hindex -+ simp [hindex] at ht - exact ⟨hi, mul_le_of_le_div <| le_of_lt (by simpa [setLAverage_eq, hi, hx] using ht)⟩ - · exact fun i hi ↦ hR i (mem_of_mem_inter_left hi) - · exact fun i hi ↦ hi.2.trans (setLIntegral_mono' measurableSet_ball fun x _ ↦ by simp) -@@ -519,8 +528,8 @@ theorem MB_ae_ne_top [BorelSpace X] (h𝓑 : 𝓑.Countable) - -- move - lemma MeasureTheory.MemLp.eLpNormEssSup_lt_top {α} [MeasurableSpace α] {μ : Measure α} - {u : α → E} (hu : MemLp u ⊤ μ) : eLpNormEssSup u μ < ⊤ := by -- simp_rw [MemLp, eLpNorm_exponent_top] at hu -- exact hu.2 -+ rw [← eLpNorm_exponent_top hu.aestronglyMeasurable] -+ exact hu - - include A in - theorem MB_ae_ne_top' [BorelSpace X] (h𝓑 : 𝓑.Countable) -@@ -626,7 +635,8 @@ This is a special case of `hasStrongType_maximalFunction` below, which doesn't h - `hR` (but uses this result in its proof). -/ - theorem hasStrongType_maximalFunction_aux - [BorelSpace X] [IsFiniteMeasureOnCompacts μ] [ProperSpace X] [Nonempty X] [μ.IsOpenPosMeasure] -- {p₁ p₂ : ℝ≥0} (h𝓑 : 𝓑.Countable) {R : ℝ} (hR : ∀ i ∈ 𝓑, r i ≤ R) (hp₁ : 0 < p₁) (hp₁₂ : p₁ < p₂) : -+ {p₁ p₂ : ℝ≥0} (h𝓑 : 𝓑.Countable) {R : ℝ} (hR : ∀ i ∈ 𝓑, r i ≤ R) -+ (hp₁ : 0 < p₁) (hp₁₂ : p₁ < p₂) : - HasStrongType (fun (u : X → E) (x : X) ↦ maximalFunction μ 𝓑 c r p₁ u x) - p₂ p₂ μ μ (C2_0_6 A p₁ p₂) := fun v mlpv ↦ by - refine ⟨Measurable.maximalFunction.aestronglyMeasurable, ?_⟩; dsimp only -@@ -635,7 +645,8 @@ theorem hasStrongType_maximalFunction_aux - conv_lhs => - enter [1, x] - rw [maximalFunction_eq_MB cp₁p, ← enorm_eq_self (MB ..)] -- rw [eLpNorm_enorm_rpow _ (by positivity), ENNReal.ofReal_inv_of_pos cp₁p, -+ rw [eLpNorm_enorm_rpow _ Measurable.maximalFunction.aestronglyMeasurable (by positivity), -+ ENNReal.ofReal_inv_of_pos cp₁p, - ENNReal.ofReal_coe_nnreal, ← div_eq_mul_inv, ← ENNReal.coe_div p₁n] - calc - _ ≤ (CMB A (p₂ / p₁) * eLpNorm (fun y ↦ ‖v y‖ ^ (p₁ : ℝ)) (p₂ / p₁) μ) ^ p₁.toReal⁻¹ := by -@@ -645,7 +656,8 @@ theorem hasStrongType_maximalFunction_aux - · rwa [lt_div_iff₀, one_mul]; exact cp₁p - · rw [ENNReal.coe_div p₁n]; exact mlpv.norm_rpow_div p₁ - _ = _ := by -- rw [ENNReal.mul_rpow_of_nonneg _ _ (by positivity), eLpNorm_norm_rpow _ cp₁p, -+ rw [ENNReal.mul_rpow_of_nonneg _ _ (by positivity), -+ eLpNorm_norm_rpow _ mlpv.aestronglyMeasurable cp₁p, - ENNReal.ofReal_coe_nnreal, ENNReal.div_mul_cancel (by positivity) (by simp), - ENNReal.rpow_rpow_inv (by positivity), ← ENNReal.coe_rpow_of_nonneg _ (by positivity), - C2_0_6] -@@ -680,7 +692,8 @@ lemma maximalFunction_seq_mono {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {p : ℝ - obtain ⟨w, hw⟩ := Hi - exact ⟨w, hw.1.trans hmn, hw.2⟩ - --lemma maximalFunction_seq_eq {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {p : ℝ≥0} (hp : 0 < p) (u : X → E) (x : X) : -+lemma maximalFunction_seq_eq {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {p : ℝ≥0} -+ (hp : 0 < p) (u : X → E) (x : X) : - maximalFunction μ 𝓑 c r (↑p) u x = - ⨆ k : ℕ, maximalFunction_seq μ h𝓑 c r (↑p) u k x := by - let g := Classical.choose (Set.countable_iff_exists_injective.mp h𝓑) -@@ -694,7 +707,7 @@ lemma maximalFunction_seq_eq {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {p : ℝ - let k₀ := g ⟨i, Hi⟩ - have k₀large : i ∈ 𝓑' k₀ := by - unfold 𝓑' -- simp only [preimage_setOf_eq, mem_image, mem_setOf_eq, Subtype.exists, exists_and_right, -+ simp only [preimage_ofPred_eq, mem_image, mem_ofPred_eq, Subtype.exists, exists_and_right, - exists_eq_right] - use Hi - calc -@@ -733,13 +746,10 @@ theorem hasStrongType_maximalFunction - obtain ⟨R, hR⟩ := Finite.exists_image_le (tr_finite h𝓑 k) r - exact (hasStrongType_maximalFunction_aux (c := c) - (Finite.countable (tr_finite h𝓑 k)) hR hp₁ hp₁₂ v mlpv).2 -- unfold eLpNorm -- split_ifs with h₀ -- · simp -- · have h : ENNReal.ofNNReal p₂ = ⊤ := by assumption -- simp at h -- · unfold eLpNorm' -- calc -+ rw [eLpNorm_eq_eLpNorm' (coe_ne_zero.mpr (ne_zero_of_lt hp₁₂)) coe_ne_top -+ Measurable.maximalFunction.aestronglyMeasurable] -+ unfold eLpNorm' -+ calc - _ = (∫⁻ (a : X), (⨆ k, maximalFunction_seq μ h𝓑 c r (↑p₁) v k a) ^ (ofNNReal p₂).toReal ∂μ) - ^ (1 / (ofNNReal p₂).toReal) := by - congr; ext x; congr; exact maximalFunction_seq_eq h𝓑 hp₁ v x -@@ -771,11 +781,11 @@ theorem hasStrongType_maximalFunction - intro k - apply (rpow_le_rpow_iff hp₂inv_pos).mp - rw [ENNReal.rpow_rpow_inv hp₂neq_zero] -- unfold eLpNorm at hestfin -- split_ifs at hestfin -- unfold eLpNorm' at hestfin -- rw [one_div] at hestfin -- exact hestfin k -+ have hest := hestfin k -+ simp only [maximalFunction_seq] at hest -+ rw [eLpNorm_eq_eLpNorm' (coe_ne_zero.mpr (ne_zero_of_lt hp₁₂)) coe_ne_top -+ Measurable.maximalFunction.aestronglyMeasurable, eLpNorm', one_div] at hest -+ simpa only [maximalFunction_seq, enorm_eq_self] using hest - - theorem hasWeakType_maximalFunction_equal_exponents₀ [BorelSpace X] - {p : ℝ≥0} (h𝓑 : 𝓑.Countable) {R : ℝ} (hR : ∀ i ∈ 𝓑, r i ≤ R) (hp : 0 < p) : -@@ -789,11 +799,12 @@ theorem hasWeakType_maximalFunction_equal_exponents₀ [BorelSpace X] - conv_lhs => - enter [1, x] - rw [maximalFunction_eq_MB cp] -- have hmb_one : wnorm (MB μ 𝓑 c r fun x ↦ ‖v x‖ ^ (p : ℝ)) 1 μ ≤ ↑A ^ 2 * eLpNorm (fun x ↦ ‖v x‖ ^ (p : ℝ)) 1 μ := by -+ have hmb_one : wnorm (MB μ 𝓑 c r fun x ↦ ‖v x‖ ^ (p : ℝ)) 1 μ ≤ -+ ↑A ^ 2 * eLpNorm (fun x ↦ ‖v x‖ ^ (p : ℝ)) 1 μ := by - apply (HasWeakType.MB_one h𝓑 hR - (fun x : X ↦ ‖v x‖ ^ (p : ℝ)) _).2 -- convert MemLp.norm_rpow_div mlpv p -- exact Eq.symm (ENNReal.div_self (coe_ne_zero.mpr p₁n) coe_ne_top) -+ simpa only [coe_toReal, ENNReal.div_self (coe_ne_zero.mpr p₁n) coe_ne_top] -+ using mlpv.norm_rpow_div p - unfold wnorm wnorm' distribution at hmb_one ⊢ - simp only [one_ne_top, ↓reduceIte, enorm_eq_self, toReal_one, inv_one, rpow_one, iSup_le_iff, - coe_ne_top, coe_toReal] at hmb_one ⊢ -@@ -806,7 +817,8 @@ theorem hasWeakType_maximalFunction_equal_exponents₀ [BorelSpace X] - · exact Eq.symm (coe_rpow_of_ne_zero ht ↑p) - · rw [rpow_inv_rpow (NNReal.coe_ne_zero.mpr p₁n)] - congr; ext x; rw [coe_rpow_of_ne_zero ht ↑p]; exact (lt_rpow_inv_iff cp) -- · rw [eLpNorm_norm_rpow v cp, ENNReal.mul_rpow_of_nonneg _ _ NNReal.zero_le_coe, -+ · rw [eLpNorm_norm_rpow v mlpv.aestronglyMeasurable cp, -+ ENNReal.mul_rpow_of_nonneg _ _ NNReal.zero_le_coe, - div_eq_mul_inv, rpow_mul, rpow_inv_rpow (NNReal.coe_ne_zero.mpr p₁n), rpow_two]; simp - - theorem hasWeakType_maximalFunction_equal_exponents -@@ -839,13 +851,14 @@ theorem hasWeakType_maximalFunction_equal_exponents - have f_mon : Monotone f := by - refine fun a b hab x ↦ iSup₂_le fun i Hi ↦ ?_ - apply le_iSup₂ (f := fun j _ ↦ (ball (c j) (r j)).indicator -- (fun x ↦ (⨍⁻ (y : X) in ball (c j) (r j), ‖v y‖ₑ ^ (ofNNReal p).toReal ∂μ) ^ (ofNNReal p).toReal⁻¹) x) -+ (fun x ↦ (⨍⁻ (y : X) in ball (c j) (r j), ‖v y‖ₑ ^ (ofNNReal p).toReal ∂μ) ^ -+ (ofNNReal p).toReal⁻¹) x) - obtain ⟨w, hw⟩ := Hi; use w; exact ⟨hw.1.trans hab, hw.2⟩ - intro t - have hm : - Monotone (fun k ↦ {x | (t : ℝ≥0∞) < ‖maximalFunction μ (tr h𝓑 k) c r p v x‖ₑ}) := by - intro m n hmn x -- simp only [enorm_eq_self, mem_setOf_eq] -+ simp only [enorm_eq_self, mem_ofPred_eq] - exact fun ht ↦ ht.trans_le (f_mon hmn x) - apply (rpow_le_rpow_iff p_pos).mp - rw [ENNReal.mul_rpow_of_nonneg _ _ (by positivity), rpow_inv_rpow p_pos.ne'] -@@ -884,7 +897,7 @@ theorem hasWeakType_maximalFunction - split_ifs with hps - · rw [← hps] - exact hasWeakType_maximalFunction_equal_exponents (A := A) h𝓑 hp₁ -- · apply HasStrongType.hasWeakType (coe_lt_coe_of_lt (hp₁.trans_le hp₁₂)) -+ · apply HasStrongType.hasWeakType (coe_lt_coe.mpr (hp₁.trans_le hp₁₂)) - exact hasStrongType_maximalFunction h𝓑 hp₁ (lt_of_le_of_ne hp₁₂ hps) - - section GMF -@@ -894,8 +907,8 @@ variable [ProperSpace X] - variable (μ) in - /-- The transformation `M` characterized in Proposition 2.0.6. - `p` is `1` in the blueprint, and `globalMaximalFunction μ p u = (M (u ^ p)) ^ p⁻¹ ` -/ --@[nolint unusedArguments] --def globalMaximalFunction [μ.IsDoubling A] (p : ℝ) (u : X → E) (x : X) : ℝ≥0∞ := -+def globalMaximalFunction (p : ℝ) (u : X → E) (x : X) : ℝ≥0∞ := -+ let _ := ‹μ.IsDoubling A› - A ^ 2 * maximalFunction μ ((covering_separable_space X).choose ×ˢ (univ : Set ℤ)) - (·.1) (fun x ↦ 2 ^ (x.2)) p u x - -@@ -930,7 +943,8 @@ theorem laverage_le_globalMaximalFunction [IsFiniteMeasureOnCompacts μ] [μ.IsO - refine (le_iSup₂ (c, m) hc).trans_eq' ?_ - simp [laverage, indicator_of_mem (h_subset h)] - --theorem lintegral_ball_le_volume_globalMaximalFunction [IsFiniteMeasureOnCompacts μ] [μ.IsOpenPosMeasure] -+theorem lintegral_ball_le_volume_globalMaximalFunction [IsFiniteMeasureOnCompacts μ] -+ [μ.IsOpenPosMeasure] - {u : X → E} {z x : X} {r : ℝ} (h : dist x z < r) : - ∫⁻ y in (ball z r), ‖u y‖ₑ ∂μ ≤ μ (ball z r) * globalMaximalFunction μ 1 u x := by - have : IsFiniteMeasure (μ.restrict (ball z r)) := isFiniteMeasure_restrict.mpr (by finiteness) -@@ -942,7 +956,8 @@ theorem lintegral_ball_le_volume_globalMaximalFunction [IsFiniteMeasureOnCompact - /-- The constant factor in the statement that `M` has strong type. -/ - def C2_0_6' (A p₁ p₂ : ℝ≥0) : ℝ≥0 := A ^ 2 * C2_0_6 A p₁ p₂ - --lemma C2_0_6'_defaultA_one_two_eq {a : ℕ} : C2_0_6' (defaultA a) 1 2 = 2 ^ (3 * a + 3 / (2 : ℝ)) := by -+lemma C2_0_6'_defaultA_one_two_eq {a : ℕ} : -+ C2_0_6' (defaultA a) 1 2 = 2 ^ (3 * a + 3 / (2 : ℝ)) := by - simp_rw [C2_0_6', C2_0_6, div_one, CMB_defaultA_two_eq, defaultA, Nat.cast_pow, Nat.cast_ofNat, - NNReal.coe_one, inv_one, NNReal.rpow_one, ← pow_mul, ← NNReal.rpow_natCast] - rw [← NNReal.rpow_add (by simp)] -@@ -984,9 +999,12 @@ theorem hasWeakType_globalMaximalFunction [BorelSpace X] [IsFiniteMeasureOnCompa - [μ.IsOpenPosMeasure] {p₁ p₂ : ℝ≥0} (hp₁ : 0 < p₁) (hp₁₂ : p₁ ≤ p₂) : - HasWeakType (globalMaximalFunction μ p₁ (E := E)) - p₂ p₂ μ μ (C_weakType_globalMaximalFunction A p₁ p₂) := by -- convert HasWeakType.const_mul (c := C_weakType_maximalFunction A p₁ p₂) (e := A ^ 2) -- (coe_ne_zero.mpr (hp₁.trans_le hp₁₂).ne') _ -- exact hasWeakType_maximalFunction countable_globalMaximalFunction hp₁ hp₁₂ -+ convert -+ (hasWeakType_maximalFunction (μ := μ) (E := E) (c := (·.1)) (r := fun x ↦ 2 ^ x.2) -+ countable_globalMaximalFunction hp₁ hp₁₂).const_mul -+ (coe_ne_zero.mpr (hp₁.trans_le hp₁₂).ne') (A ^ 2) using 1 <;> -+ simp only [C_weakType_globalMaximalFunction, ENNReal.coe_pow] -+ rfl - - /-- Use `lowerSemiContinuous_MB` -/ - lemma lowerSemiContinuous_globalMaximalFunction : -diff --git a/Carleson/ToMathlib/Interval.lean b/Carleson/ToMathlib/Interval.lean -index 948f0cd..a07c341 100644 ---- a/Carleson/ToMathlib/Interval.lean -+++ b/Carleson/ToMathlib/Interval.lean -@@ -1,7 +1,13 @@ --import Mathlib.Data.Set.Lattice -+import Mathlib.Data.Set.Lattice.Bounded -+import Mathlib.Data.Set.Lattice.Disjoint -+import Mathlib.Data.Set.Lattice.Image -+import Mathlib.Data.Set.Lattice.Indexed -+import Mathlib.Data.Set.Lattice.Order - import Mathlib.Order.SuccPred.Basic - import Mathlib.Tactic.Common - -+/-! # Interval inclusions, unions, and disjointness -/ -+ - -- Upstreaming status: results seem useful in general, some should be generalised - - open Function Order Set -diff --git a/Carleson/ToMathlib/MeasureTheory/Integral/Average.lean b/Carleson/ToMathlib/MeasureTheory/Integral/Average.lean -index 2e68964..0188672 100644 ---- a/Carleson/ToMathlib/MeasureTheory/Integral/Average.lean -+++ b/Carleson/ToMathlib/MeasureTheory/Integral/Average.lean -@@ -1,5 +1,7 @@ - import Mathlib.MeasureTheory.Integral.Average - -+/-! # Monotonicity and essential supremum bounds for lower averages -/ -+ - -- Upstreaming status: upstreamed in https://github.com/leanprover-community/mathlib4/pull/37551 - - open MeasureTheory MeasureTheory.Measure Filter Set -@@ -12,22 +14,23 @@ lemma laverage_mono_ae {f g : α → ℝ≥0∞} (h : ∀ᵐ a ∂μ, f a ≤ g - ⨍⁻ a, f a ∂μ ≤ ⨍⁻ a, g a ∂μ := - lintegral_mono_ae <| h.filter_mono <| Measure.ae_mono' Measure.smul_absolutelyContinuous - --@[gcongr] -+@[gcongr only] - lemma setLAverage_mono_ae {f g : α → ℝ≥0∞} (h : ∀ᵐ a ∂μ, f a ≤ g a) : - ⨍⁻ a in s, f a ∂μ ≤ ⨍⁻ a in s, g a ∂μ := -- laverage_mono_ae <| h.filter_mono <| ae_mono Measure.restrict_le_self -+ _root_.laverage_mono_ae <| h.filter_mono <| ae_mono Measure.restrict_le_self - - lemma setLAverage_le_essSup (f : α → ℝ≥0∞) : ⨍⁻ x in s, f x ∂μ ≤ essSup f μ := by - by_cases hμ : IsFiniteMeasure (μ.restrict s); swap - · simp [laverage, not_isFiniteMeasure_iff.mp hμ] - by_cases hμ0 : μ s = 0 - · rw [laverage, ← setLIntegral_univ] -- exact le_of_eq_of_le (setLIntegral_measure_zero univ f <| by simp [hμ0]) (zero_le (essSup f μ)) -- apply le_of_le_of_eq (laverage_mono_ae <| Eventually.filter_mono ae_restrict_le ae_le_essSup) -+ exact le_of_eq_of_le (setLIntegral_measure_zero univ f <| by simp [hμ0]) zero_le -+ apply le_of_le_of_eq (_root_.laverage_mono_ae <| -+ Eventually.filter_mono ae_restrict_le ae_le_essSup) - have : NeZero (μ.restrict s) := - have : NeZero (μ s) := { out := hμ0 } - restrict.neZero - exact laverage_const (μ.restrict s) _ - - lemma laverage_le_essSup (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ ≤ essSup f μ := by -- simpa using setLAverage_le_essSup (s := univ) f -+ simpa using _root_.setLAverage_le_essSup (s := univ) f -diff --git a/Carleson/ToMathlib/MeasureTheory/Integral/IntegrableOn.lean b/Carleson/ToMathlib/MeasureTheory/Integral/IntegrableOn.lean -index 09f5019..6cadf14 100644 ---- a/Carleson/ToMathlib/MeasureTheory/Integral/IntegrableOn.lean -+++ b/Carleson/ToMathlib/MeasureTheory/Integral/IntegrableOn.lean -@@ -1,5 +1,7 @@ - import Mathlib.MeasureTheory.Integral.IntegrableOn - -+/-! # Integrability on a set from integrability on the support -/ -+ - open Set Filter TopologicalSpace MeasureTheory Function - - open scoped Topology Interval Filter ENNReal MeasureTheory -@@ -11,18 +13,6 @@ open scoped Topology Interval Filter ENNReal MeasureTheory - - variable {α β ε ε' E F : Type*} [MeasurableSpace α] - --namespace MeasureTheory -- --protected theorem IntegrableAtFilter.congr'_enorm {μ : Measure α} [TopologicalSpace ε] -- [TopologicalSpace ε'] [ContinuousENorm ε] [ContinuousENorm ε'] -- {l : Filter α} {f : α → ε} {g : α → ε'} -- (hf : IntegrableAtFilter f l μ) (hg : AEStronglyMeasurable g μ) -- (h : ∀ᵐ a ∂μ, ‖f a‖ₑ = ‖g a‖ₑ) : -- IntegrableAtFilter g l μ := -- Exists.casesOn hf fun s hs ↦ ⟨s, hs.1, hs.2.congr'_enorm hg.restrict (ae_restrict_le h)⟩ -- --end MeasureTheory -- - section NormedAddCommGroup - - variable [NormedAddCommGroup E] {f g : α → ε'} {s t : Set α} {μ ν : Measure α} -@@ -31,7 +21,7 @@ variable [TopologicalSpace ε'] [ENormedAddMonoid ε'] - theorem integrableOn_of_integrableOn_inter_support [PseudoMetrizableSpace ε'] {f : α → ε'} - (hs : MeasurableSet s) (hf : IntegrableOn f (s ∩ support f) μ) : - IntegrableOn f s μ := by -- apply IntegrableOn.of_forall_diff_eq_zero hf hs -+ apply IntegrableOn.of_forall_sdiff_eq_zero hf hs - simp - - end NormedAddCommGroup -diff --git a/Carleson/ToMathlib/MeasureTheory/Integral/Lebesgue.lean b/Carleson/ToMathlib/MeasureTheory/Integral/Lebesgue.lean -index 58ff6bf..48fca65 100644 ---- a/Carleson/ToMathlib/MeasureTheory/Integral/Lebesgue.lean -+++ b/Carleson/ToMathlib/MeasureTheory/Integral/Lebesgue.lean -@@ -1,5 +1,7 @@ - import Mathlib.MeasureTheory.Measure.Lebesgue.Basic - -+/-! # Changes of variables and monotonicity for lower integrals -/ -+ - -- Upstreaming status: `lintegral_eq_iSup_eapprox_lintegral'` and `lintegral_comp'` - -- upstreamed in https://github.com/leanprover-community/mathlib4/pull/37558 - -- Remaining lemmas: shift/scaling aliases, `lintegral_set_mono_fn` -@@ -73,33 +75,6 @@ lemma lintegral_scale_constant' {f : ℝ → ENNReal} {a : ℝ} (h : a ≠ 0) : - simp - - --open SimpleFunc -- --/-- Generalization of `MeasureTheory.lintegral_eq_iSup_eapprox_lintegral` assuming a.e. --measurability of `f` -/ --theorem lintegral_eq_iSup_eapprox_lintegral' {α : Type*} {m : MeasurableSpace α} {μ : Measure α} -- {f : α → ENNReal} (hf : AEMeasurable f μ) : -- ∫⁻ (a : α), f a ∂μ = ⨆ (n : ℕ), (eapprox (hf.mk f) n).lintegral μ := -- calc -- _ = ∫⁻ a, hf.mk f a ∂μ := lintegral_congr_ae hf.ae_eq_mk -- _ = ∫⁻ a, ⨆ n, (eapprox (hf.mk f) n : α → ℝ≥0∞) a ∂μ := by -- simp [iSup_eapprox_apply hf.measurable_mk] -- _ = ⨆ n, ∫⁻ a, eapprox (hf.mk f) n a ∂μ := -- lintegral_iSup (fun _ ↦ SimpleFunc.measurable _) (fun _ _ h ↦ monotone_eapprox (hf.mk f) h) -- _ = ⨆ n, (eapprox (hf.mk f) n).lintegral μ := by simp [lintegral_eq_lintegral] -- --/-- Generalization of `MeasureTheory.lintegral_comp` assuming a.e. measurability of `f` and `g` -/ --theorem lintegral_comp' {α : Type*} {β : Type*} {m : MeasurableSpace α} {μ : Measure α} -- [MeasurableSpace β] {f : β → ENNReal} {g : α → β} (hf : AEMeasurable f (μ.map g)) -- (hg : AEMeasurable g μ) : lintegral μ (f ∘ g) = ∫⁻ a, f a ∂μ.map g := by -- rw [μ.map_congr hg.ae_eq_mk] at hf ⊢ -- calc ∫⁻ a, (f ∘ g) a ∂μ -- _ = ∫⁻ a, (hf.mk f ∘ hg.mk g) a ∂μ := by -- rw [lintegral_congr_ae (hg.ae_eq_mk.fun_comp f)] -- exact lintegral_congr_ae (ae_of_ae_map hg.measurable_mk.aemeasurable hf.ae_eq_mk) -- _ = ∫⁻ a, hf.mk f a ∂μ.map (hg.mk g) := lintegral_comp hf.measurable_mk hg.measurable_mk -- _ = ∫⁻ a, f a ∂μ.map (hg.mk g) := lintegral_congr_ae hf.ae_eq_mk.symm -- - lemma lintegral_set_mono_fn {α : Type*} {m : MeasurableSpace α} {μ : Measure α} {s : Set α} - (hs : MeasurableSet s) ⦃f g : α → ℝ≥0∞⦄ (hfg : ∀ x ∈ s, f x ≤ g x) : - ∫⁻ (a : α) in s, f a ∂μ ≤ ∫⁻ (a : α) in s, g a ∂μ := by -diff --git a/Carleson/ToMathlib/MeasureTheory/Measure/IsDoubling.lean b/Carleson/ToMathlib/MeasureTheory/Measure/IsDoubling.lean -index 06a6caa..2a9f2fd 100644 ---- a/Carleson/ToMathlib/MeasureTheory/Measure/IsDoubling.lean -+++ b/Carleson/ToMathlib/MeasureTheory/Measure/IsDoubling.lean -@@ -1,9 +1,12 @@ - import Carleson.ToMathlib.Misc - import Carleson.ToMathlib.CoveredByBalls --import Mathlib.Data.Real.StarOrdered -+import Mathlib.Analysis.Real.Sqrt -+import Mathlib.Tactic.ContinuousFunctionalCalculus - import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls - import Mathlib.Order.CompletePartialOrder - -+/-! # Doubling measures and uniform local doubling -/ -+ - open MeasureTheory Measure NNReal Metric Filter Topology TopologicalSpace - open ENNReal hiding one_lt_two - noncomputable section -@@ -151,9 +154,9 @@ instance : IsUnifLocDoublingMeasure (μ : Measure X) where - use max 1 A^2, Set.univ, by simp, Set.univ - simp only [mem_principal, Set.subset_univ, Set.inter_self, true_and] - ext r -- simp only [ENNReal.coe_pow, Set.mem_setOf_eq, Set.mem_univ, iff_true] -+ simp only [ENNReal.coe_pow, Set.mem_ofPred_eq, Set.mem_univ, iff_true] - intro x -- letI : Nonempty X := ⟨x⟩ -+ let : Nonempty X := ⟨x⟩ - by_cases hr : r ≤ 0 - · have cball_eq : closedBall x (2 * r) = closedBall x r:= by - by_cases! hr' : r < 0 -diff --git a/Carleson/ToMathlib/MeasureTheory/Measure/NNReal.lean b/Carleson/ToMathlib/MeasureTheory/Measure/NNReal.lean -index 1c0dd1c..4c7cfd2 100644 ---- a/Carleson/ToMathlib/MeasureTheory/Measure/NNReal.lean -+++ b/Carleson/ToMathlib/MeasureTheory/Measure/NNReal.lean -@@ -2,6 +2,8 @@ import Mathlib.MeasureTheory.Measure.Haar.OfBasis - import Mathlib.MeasureTheory.Measure.Lebesgue.Basic - import Carleson.ToMathlib.MeasureTheory.Integral.Lebesgue - -+/-! # Lebesgue measure on nonnegative and extended nonnegative reals -/ -+ - open MeasureTheory NNReal ENNReal Set - - noncomputable -@@ -29,7 +31,7 @@ instance : MeasureSpace ℝ≥0∞ where - lemma ENNReal.ofNNReal_preimage {s : Set ℝ≥0∞} : - ENNReal.ofNNReal ⁻¹' s = ENNReal.toNNReal '' (s \ {⊤}) := by - ext x -- simp only [mem_image, mem_diff, mem_singleton_iff, mem_preimage] -+ simp only [mem_image, mem_sdiff, mem_singleton_iff, mem_preimage] - constructor - · intro h - use ENNReal.ofNNReal x -@@ -41,7 +43,7 @@ lemma ENNReal.ofNNReal_preimage {s : Set ℝ≥0∞} : - --TODO: move these lemmas somewhere else? - lemma ENNReal.map_toReal_eq_map_toReal_comap_ofReal {s : Set ℝ≥0∞} (h : ∞ ∉ s) : - ENNReal.toReal '' s = NNReal.toReal '' (ENNReal.ofNNReal ⁻¹' s) := by -- rw [ofNNReal_preimage, image_image, diff_singleton_eq_self h] -+ rw [ofNNReal_preimage, image_image, sdiff_singleton_eq_self h] - congr - - lemma ENNReal.map_toReal_eq_map_toReal_comap_ofReal' {s : Set ℝ≥0∞} (h : ∞ ∈ s) : -@@ -77,7 +79,8 @@ lemma ENNReal.volume_val {s : Set ℝ≥0∞} (hs : MeasurableSet s) : - _ = volume (ENNReal.ofNNReal ⁻¹' s) := - MeasureTheory.Measure.map_apply_of_aemeasurable (by fun_prop) hs - _ = volume (NNReal.toReal '' (ENNReal.ofNNReal ⁻¹' s)) := NNReal.volume_val -- _ = volume (ENNReal.toReal '' s) := Eq.symm (measure_congr ENNReal.map_toReal_ae_eq_map_toReal_comap_ofReal) -+ _ = volume (ENNReal.toReal '' s) := -+ Eq.symm (measure_congr ENNReal.map_toReal_ae_eq_map_toReal_comap_ofReal) - - lemma NNReal.volume_eq_volume_ennreal {s : Set ℝ≥0} (hs : MeasurableSet (ofNNReal '' s)) : - volume s = volume (ENNReal.ofNNReal '' s) := by -@@ -227,7 +230,6 @@ lemma ENNReal.toReal_Icc_eq_Icc {a b : ℝ≥0∞} (ha : a ≠ ∞) (hb : b ≠ - rw [← hxy] - constructor <;> gcongr - · exact ne_top_of_le_ne_top hb hy₂ -- · assumption - · rintro hx - use ENNReal.ofReal x - constructor -@@ -245,7 +247,6 @@ lemma ENNReal.toReal_Ioo_eq_Ioo {a b : ℝ≥0∞} (ha : a ≠ ∞) (hb : b ≠ - rw [← hyx] - constructor <;> gcongr - · finiteness -- · assumption - · rintro hx - use ENNReal.ofReal x - constructor -@@ -280,7 +281,7 @@ lemma ENNReal.toReal_Ioi_eq_Ioi {a : ℝ≥0∞} (ha : a ≠ ∞) : - rw [← hyx, h, ENNReal.toReal_top] - right - rw [← hyx] -- gcongr; assumption -+ gcongr - · rintro (x_zero | hxa) - · exact ⟨⊤, by finiteness, by simp [x_zero]⟩ - use ENNReal.ofReal x -@@ -355,7 +356,8 @@ lemma ENNReal.volume_Ioo {a b : ℝ≥0∞} (ha : a ≠ ∞) : - · have : ⊤ - ⊤ = (0 : ENNReal) := by simp only [tsub_self] - rw [hb, ENNReal.top_sub ha, ENNReal.toReal_Ioo_top_eq_Ioi ha] - apply Real.volume_Ioi -- rw [toReal_Ioo_eq_Ioo ha hb, Real.volume_Ioo, ofReal_sub _ (by simp), ofReal_toReal hb, ofReal_toReal ha] -+ rw [toReal_Ioo_eq_Ioo ha hb, Real.volume_Ioo, ofReal_sub _ (by simp), ofReal_toReal hb, -+ ofReal_toReal ha] - - -- sanity check: this measure is what you expect - example : volume (Set.Icc (3 : ℝ≥0∞) 42) = 39 := by -@@ -382,7 +384,7 @@ instance : Measure.IsOpenPosMeasure (@volume ℝ≥0 _) where - rw [NNReal.volume_Ioo] - simpa - --instance : NoAtoms (@volume ℝ≥0∞ _) where -+instance : NullSingletonClass (@volume ℝ≥0∞ _) where - measure_singleton := by - intro x - rw [ENNReal.volume_val (measurableSet_singleton _), image_singleton] -@@ -390,8 +392,9 @@ instance : NoAtoms (@volume ℝ≥0∞ _) where - - -- TODO: move this general result to an appropriate place - -- TODO: maybe generalize further to general measures restricted to a subtype --lemma Measure.Subtype.noAtoms {δ : Type*} [MeasureSpace δ] [NoAtoms (volume : Measure δ)] {p : δ → Prop} (hp : MeasurableSet p) : -- NoAtoms (Measure.Subtype.measureSpace.volume : Measure (Subtype p)) where -+lemma Measure.Subtype.noAtoms {δ : Type*} [MeasureSpace δ] -+ [NullSingletonClass (volume : Measure δ)] {p : δ → Prop} (hp : MeasurableSet p) : -+ NullSingletonClass (Measure.Subtype.measureSpace.volume : Measure (Subtype p)) where - measure_singleton := by - intro x - calc _ -@@ -400,11 +403,12 @@ lemma Measure.Subtype.noAtoms {δ : Type*} [MeasureSpace δ] [NoAtoms (volume : - _ = 0 := by - simp - --instance : NoAtoms (@volume ℝ≥0 _) := Measure.Subtype.noAtoms measurableSet_Ici -+instance : NullSingletonClass (@volume ℝ≥0 _) := Measure.Subtype.noAtoms measurableSet_Ici - - --TODO: move this general result to an appropriate place - --TODO: maybe generalize further to general measures restricted to a subtype --lemma Measure.Subtype.sigmaFinite {δ : Type*} [MeasureSpace δ] [sf : SigmaFinite (@volume δ _)] {p : δ → Prop} (hp : MeasurableSet p) : -+lemma Measure.Subtype.sigmaFinite {δ : Type*} [MeasureSpace δ] -+ [sf : SigmaFinite (@volume δ _)] {p : δ → Prop} (hp : MeasurableSet p) : - SigmaFinite (Measure.Subtype.measureSpace.volume : Measure (Subtype p)) where - out' := by - refine Nonempty.intro ?_ -@@ -431,11 +435,12 @@ lemma Measure.Subtype.sigmaFinite {δ : Type*} [MeasureSpace δ] [sf : SigmaFini - instance : SigmaFinite (@volume ℝ≥0 _) := Measure.Subtype.sigmaFinite measurableSet_Ici - - --lemma lintegral_nnreal_eq_lintegral_Ici_ofReal {f : ℝ≥0 → ℝ≥0∞} : ∫⁻ x : ℝ≥0, f x = ∫⁻ x in Ici (0 : ℝ), f x.toNNReal := by -+lemma lintegral_nnreal_eq_lintegral_Ici_ofReal {f : ℝ≥0 → ℝ≥0∞} : -+ ∫⁻ x : ℝ≥0, f x = ∫⁻ x in Ici (0 : ℝ), f x.toNNReal := by - change ∫⁻ (x : ℝ≥0), f x = ∫⁻ (x : ℝ) in Ici 0, (f ∘ Real.toNNReal) x - rw [← lintegral_subtype_comap measurableSet_Ici] -- simp -- rfl -+ change ∫⁻ x : ℝ≥0, f x = ∫⁻ x : ℝ≥0, f (x : ℝ).toNNReal -+ simp only [Real.toNNReal_coe] - - lemma lintegral_nnreal_Ici_eq_lintegral_Ici_ofReal {f : ℝ≥0 → ℝ≥0∞} {a : ℝ≥0} : - ∫⁻ x in Ici a, f x = ∫⁻ x in Ici (a : ℝ), f x.toNNReal := by -@@ -446,7 +451,8 @@ lemma lintegral_nnreal_Ici_eq_lintegral_Ici_ofReal {f : ℝ≥0 → ℝ≥0∞} - apply setLIntegral_congr - rw [NNReal.Ici_eq] - --lemma lintegral_nnreal_eq_lintegral_Ioi_ofReal {f : ℝ≥0∞ → ℝ≥0∞} : ∫⁻ x : ℝ≥0, f x = ∫⁻ x in Ioi (0 : ℝ), f (.ofReal x) := by -+lemma lintegral_nnreal_eq_lintegral_Ioi_ofReal {f : ℝ≥0∞ → ℝ≥0∞} : -+ ∫⁻ x : ℝ≥0, f x = ∫⁻ x in Ioi (0 : ℝ), f (.ofReal x) := by - rw [lintegral_nnreal_eq_lintegral_Ici_ofReal] - exact setLIntegral_congr Ioi_ae_eq_Ici.symm - -@@ -500,7 +506,8 @@ lemma lintegral_nnreal_scale_constant' {f : ℝ≥0 → ℝ≥0∞} {a : ℝ≥0 - a * ∫⁻ x : ℝ≥0, f (a*x) = ∫⁻ x, f x := by - rw [lintegral_nnreal_eq_lintegral_toNNReal_Ioi, lintegral_nnreal_eq_lintegral_toNNReal_Ioi] - symm -- rw [← lintegral_scale_constant_halfspace' (a:=a) (by rw [NNReal.coe_pos, pos_iff_ne_zero]; exact h)] -+ rw [← lintegral_scale_constant_halfspace' (a := a) -+ (by rw [NNReal.coe_pos, pos_iff_ne_zero]; exact h)] - congr 1 - · simp - apply setLIntegral_congr_fun measurableSet_Ioi -diff --git a/Carleson/ToMathlib/Misc.lean b/Carleson/ToMathlib/Misc.lean -index a58676b..75f2ec6 100644 ---- a/Carleson/ToMathlib/Misc.lean -+++ b/Carleson/ToMathlib/Misc.lean -@@ -4,7 +4,7 @@ import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds - import Mathlib.MeasureTheory.Integral.Average - import Mathlib.MeasureTheory.Measure.Haar.OfBasis - --/- -+/-! - * This file can import all ToMathlib files. - * If adding more than a few results, please put them in a more appropriate file in ToMathlib. - -@@ -130,21 +130,19 @@ end support - end Function - - namespace MeasureTheory -- --set_option linter.style.refine false in - variable {α : Type*} {β : Type*} {s : Set α} {f g : α → β} - {m : MeasurableSpace α} {mβ : MeasurableSpace β} {μ : Measure α} in --@[measurability, fun_prop] -+@[fun_prop] - protected theorem _root_.AEMeasurable.piecewise {d : DecidablePred (· ∈ s)} (hs : MeasurableSet s) - (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) : AEMeasurable (piecewise s f g) μ := by -- refine' ⟨_, hf.measurable_mk.piecewise hs hg.measurable_mk, ?_⟩ -- · assumption -+ refine ⟨s.piecewise (hf.mk f) (hg.mk g), hf.measurable_mk.piecewise hs hg.measurable_mk, -+ ?_⟩ - filter_upwards [hf.ae_eq_mk, hg.ae_eq_mk] with x hfx hgx - simp_rw [Set.piecewise, ← hfx, ← hgx] - - variable {α : Type*} {β : Type*} {p : α → Prop} {f g : α → β} - {m : MeasurableSpace α} {mβ : MeasurableSpace β} {μ : Measure α} in --@[measurability, fun_prop] -+@[fun_prop] - protected theorem _root_.AEMeasurable.ite {d : DecidablePred p} (hp : MeasurableSet {a | p a}) - (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) : - AEMeasurable (fun x => ite (p x) (f x) (g x)) μ := -@@ -253,7 +251,7 @@ theorem eLpNormEssSup_lt_top_of_ae_ennnorm_bound {f : α → F} {C : ℝ≥0∞} - (hfC : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ C) : eLpNormEssSup f μ ≤ C := essSup_le_of_ae_le C hfC - - theorem restrict_absolutelyContinuous : μ.restrict s ≪ μ := -- fun s hs ↦ Measure.restrict_le_self s |>.trans hs.le |>.antisymm <| zero_le _ -+ fun s hs ↦ Measure.restrict_le_self s |>.trans hs.le |>.antisymm <| zero_le - - section eLpNorm - -@@ -290,7 +288,12 @@ lemma eLpNorm'_toReal_eq {f : α → ℝ≥0∞} {p : ℝ} (hf : ∀ᵐ x ∂μ, - - lemma eLpNorm_toReal_le {f : α → ℝ≥0∞} : - eLpNorm (ENNReal.toReal ∘ f) p μ ≤ eLpNorm f p μ := by -- simp_rw [eLpNorm] -+ by_cases hmeas : AEStronglyMeasurable f μ -+ swap -+ · simp [eLpNorm_of_not_aestronglyMeasurable hmeas] -+ have hreal : AEStronglyMeasurable (ENNReal.toReal ∘ f) μ := hmeas.ennreal_toReal -+ rw [eLpNorm_eq_eLpNormFormula hreal, eLpNorm_eq_eLpNormFormula hmeas] -+ simp_rw [eLpNormFormula] - split_ifs - · rfl - · exact eLpNormEssSup_toReal_le -@@ -298,15 +301,31 @@ lemma eLpNorm_toReal_le {f : α → ℝ≥0∞} : - - lemma eLpNorm_toReal_eq {f : α → ℝ≥0∞} (hf : ∀ᵐ x ∂μ, f x ≠ ∞) : - eLpNorm (ENNReal.toReal ∘ f) p μ = eLpNorm f p μ := by -- simp_rw [eLpNorm] -+ have hmeas : AEStronglyMeasurable (ENNReal.toReal ∘ f) μ ↔ -+ AEStronglyMeasurable f μ := by -+ refine ⟨fun hreal ↦ ?_, fun hfun ↦ hfun.ennreal_toReal⟩ -+ apply hreal.aemeasurable.ennreal_ofReal.aestronglyMeasurable.congr -+ filter_upwards [hf] with point hpoint -+ simp [ENNReal.ofReal_toReal hpoint] -+ by_cases hfun : AEStronglyMeasurable f μ -+ swap -+ · simp [eLpNorm, hfun, hmeas] -+ rw [eLpNorm_eq_eLpNormFormula (hmeas.mpr hfun), eLpNorm_eq_eLpNormFormula hfun] -+ simp_rw [eLpNormFormula] - split_ifs - · rfl - · exact eLpNormEssSup_toReal_eq hf - · exact eLpNorm'_toReal_eq hf - --lemma sq_eLpNorm_two {ε : Type*} [ENorm ε] {f : α → ε} : -+lemma sq_eLpNormFormula_two {ε : Type*} [ENorm ε] {f : α → ε} : -+ eLpNormFormula f 2 μ ^ 2 = ∫⁻ x, ‖f x‖ₑ ^ 2 ∂μ := by -+ simpa [eLpNormFormula] using -+ (lintegral_rpow_enorm_eq_rpow_eLpNorm' (f := f) (μ := μ) (by norm_num : (0 : ℝ) < 2)).symm -+ -+lemma sq_eLpNorm_two {ε : Type*} [TopologicalSpace ε] [ENorm ε] {f : α → ε} -+ (hf : AEStronglyMeasurable f μ) : - eLpNorm f 2 μ ^ 2 = ∫⁻ x, ‖f x‖ₑ ^ 2 ∂μ := by -- simpa using eLpNorm_nnreal_pow_eq_lintegral (f := f) two_ne_zero -+ rw [eLpNorm_eq_eLpNormFormula hf, sq_eLpNormFormula_two] - - open ComplexConjugate in - /-- One of the very few cases where a norm can be moved _out of_ an integral. -/ -@@ -317,7 +336,7 @@ lemma eLpNorm_two_eq_enorm_integral_mul_conj {f : α → ℂ} (lpf : MemLp f 2 - rw [integral_eq_lintegral_of_nonneg_ae (.of_forall fun _ ↦ by simp)]; swap - · exact lpf.aestronglyMeasurable.norm.pow 2 - conv_rhs => enter [1, 1, 1, 2, x]; rw [ENNReal.ofReal_pow (norm_nonneg _), ofReal_norm] -- rw [← sq_eLpNorm_two, ← enorm_norm] -+ rw [← sq_eLpNorm_two lpf.aestronglyMeasurable, ← enorm_norm] - simp_rw [Complex.coe_algebraMap, Complex.norm_real, enorm_norm] - rw [toReal_pow, enorm_pow, enorm_toReal lpf.eLpNorm_ne_top] - -@@ -327,8 +346,7 @@ namespace MemLp - - variable {p : ℝ≥0∞} - theorem toReal {f : α → ℝ≥0∞} (hf : MemLp f p μ) : MemLp (f · |>.toReal) p μ := -- ⟨hf.aestronglyMeasurable.aemeasurable.ennreal_toReal.aestronglyMeasurable, -- eLpNorm_toReal_le.trans_lt hf.eLpNorm_lt_top⟩ -+ eLpNorm_toReal_le.trans_lt hf.eLpNorm_lt_top - - end MemLp - -@@ -389,24 +407,24 @@ protected noncomputable def out (x : α) : α := - if hx : x ∈ s then (Quotient.out (s := hr.setoid) ⟦⟨x, hx⟩⟧ : s) else x - - lemma out_mem (hx : x ∈ s) : hr.out x ∈ s := by -- rw [EquivalenceOn.out, dif_pos hx] -+ rw [EquivalenceOn.out, dite_eq_left hx] - apply Subtype.prop - - @[simp] - lemma out_mem_iff : hr.out x ∈ s ↔ x ∈ s := by - refine ⟨fun h ↦ ?_, out_mem⟩ - by_contra hx -- rw [EquivalenceOn.out, dif_neg hx] at h -+ rw [EquivalenceOn.out, dite_eq_right hx] at h - exact hx h - - lemma out_rel (hx : x ∈ s) : r (hr.out x) x := by -- rw [EquivalenceOn.out, dif_pos hx] -+ rw [EquivalenceOn.out, dite_eq_left hx] - exact @Quotient.mk_out _ (hr.setoid) ⟨x, hx⟩ - - lemma rel_out (hx : x ∈ s) : r x (hr.out x) := hr.symm (out_mem hx) hx (out_rel hx) - - lemma out_inj (hx : x ∈ s) (hy : y ∈ s) (h : r x y) : hr.out x = hr.out y := by -- simp_rw [EquivalenceOn.out, dif_pos hx, dif_pos hy] -+ simp_rw [EquivalenceOn.out, dite_eq_left hx, dite_eq_left hy] - congr 1 - simp_rw [Quotient.out_inj, Quotient.eq] - exact h -@@ -488,9 +506,10 @@ section Indicator - - open ComplexConjugate - --attribute [gcongr] Set.indicator_le_indicator mulIndicator_le_mulIndicator_of_subset -+attribute [gcongr only] Set.indicator_le_indicator mulIndicator_le_mulIndicator_of_subset - --lemma indicator_eq_indicator' {α : Type*} {M : Type*} [Zero M] {s : Set α} {f g : α → M} (h : ∀ x ∈ s, f x = g x) : -+lemma indicator_eq_indicator' {α : Type*} {M : Type*} [Zero M] {s : Set α} {f g : α → M} -+ (h : ∀ x ∈ s, f x = g x) : - s.indicator f = s.indicator g := by - ext x - unfold indicator -@@ -669,16 +688,16 @@ theorem setIntegral_biUnion_le_sum_setIntegral {X : Type*} {ι : Type*} [Measura - have meas : MeasurableSet {x | 0 ≤ g x} := - have : {x | 0 ≤ g x} = g ⁻¹' (Ici 0) := by simp [preimage, mem_Ici] - this ▸ (AEMeasurable.measurable_mk int_f.aemeasurable) measurableSet_Ici -- rw [← integral_finset_sum_measure int_g] -+ rw [← integral_finsetSum_measure int_g] - set μ₀ : ι → Measure X := fun i ↦ ite (i ∈ s) (μ.restrict (S i)) 0 -- refine integral_mono_measure ?_ ?_ (integrable_finset_sum_measure.mpr int_g) -+ refine integral_mono_measure ?_ ?_ (integrable_finsetSum_measure.mpr int_g) - · refine Measure.le_iff.mpr (fun T hT ↦ ?_) -- simp_rw [μ.restrict_apply hT, Measure.coe_finset_sum, s.sum_apply, inter_iUnion] -+ simp_rw [μ.restrict_apply hT, Measure.coe_finsetSum, s.sum_apply, inter_iUnion] - apply le_trans <| measure_biUnion_finset_le s (T ∩ S ·) - exact s.sum_le_sum (fun _ _ ↦ ge_of_eq (μ.restrict_apply hT)) - · have : ∑ i ∈ s, μ.restrict (S i) = Measure.sum μ₀ := by - ext T hT -- simp only [Measure.sum_apply (hs := hT), Measure.coe_finset_sum, s.sum_apply, μ₀] -+ simp only [Measure.sum_apply (hs := hT), Measure.coe_finsetSum, s.sum_apply, μ₀] - rw [tsum_eq_sum (s := s) (fun b hb ↦ by simp [hb])] - exact Finset.sum_congr rfl (fun i hi ↦ by simp [hi]) - rw [Filter.EventuallyLE, this, Measure.ae_sum_iff' (by exact meas)] -@@ -689,7 +708,7 @@ theorem setIntegral_biUnion_le_sum_setIntegral {X : Type*} {ι : Type*} [Measura - · simp [hi, μ₀] - - -- Analogous to `MeasureTheory.integral_smul_const` in Mathlib --theorem average_smul_const {X : Type*} {E : Type*} [MeasurableSpace X] -+theorem average_smul_const_carleson {X : Type*} {E : Type*} [MeasurableSpace X] - {μ : MeasureTheory.Measure X} [NormedAddCommGroup E] [NormedSpace ℝ E] {𝕜 : Type*} - [RCLike 𝕜] [NormedSpace 𝕜 E] [CompleteSpace E] (f : X → 𝕜) (c : E) : - ⨍ (x : X), f x • c ∂μ = (⨍ (x : X), f x ∂μ) • c := -@@ -770,12 +789,12 @@ lemma Finset.pow_sum_comm {ι R : Type*} [Semiring R] {s : Finset ι} {f : ι - - namespace MeasureTheory - --lemma sum_sq_eLpNorm_indicator_le_of_pairwiseDisjoint -+lemma sum_sq_eLpNormFormula_indicator_le_of_pairwiseDisjoint - {α ι F : Type*} [MeasurableSpace α] [NormedAddCommGroup F] {μ : Measure α} - {s : Finset ι} {f : α → F} {t : ι → Set α} (meast : ∀ i, MeasurableSet (t i)) - (hpd : PairwiseDisjoint s t) : -- ∑ i ∈ s, eLpNorm ((t i).indicator f) 2 μ ^ 2 ≤ eLpNorm f 2 μ ^ 2 := by -- simp_rw [sq_eLpNorm_two] -+ ∑ i ∈ s, eLpNormFormula ((t i).indicator f) 2 μ ^ 2 ≤ eLpNormFormula f 2 μ ^ 2 := by -+ simp_rw [sq_eLpNormFormula_two] - conv_lhs => - enter [2, i, 2, x] - rw [enorm_indicator_eq_indicator_enorm, sq, ← inter_indicator_mul, inter_self] -@@ -784,13 +803,24 @@ lemma sum_sq_eLpNorm_indicator_le_of_pairwiseDisjoint - rw [← lintegral_biUnion_finset hpd fun _ _ ↦ meast _] - exact setLIntegral_le_lintegral _ _ - -+lemma sum_sq_eLpNorm_indicator_le_of_pairwiseDisjoint -+ {α ι F : Type*} [MeasurableSpace α] [NormedAddCommGroup F] {μ : Measure α} -+ {s : Finset ι} {f : α → F} {t : ι → Set α} (meast : ∀ i, MeasurableSet (t i)) -+ (hpd : PairwiseDisjoint s t) : -+ ∑ i ∈ s, eLpNorm ((t i).indicator f) 2 μ ^ 2 ≤ eLpNorm f 2 μ ^ 2 := by -+ by_cases hf : AEStronglyMeasurable f μ -+ · simp_rw [eLpNorm_eq_eLpNormFormula (hf.indicator (meast _)), -+ eLpNorm_eq_eLpNormFormula hf] -+ exact sum_sq_eLpNormFormula_indicator_le_of_pairwiseDisjoint meast hpd -+ · simp [eLpNorm_of_not_aestronglyMeasurable hf] -+ - theorem measurable_measure_ball {α : Type*} [PseudoMetricSpace α] [SecondCountableTopology α] - [MeasurableSpace α] [OpensMeasurableSpace α] {μ : Measure α} [SFinite μ] : - Measurable fun (a, r) ↦ μ (Metric.ball a r) := by -- let s : Set (α × α × ℝ) := setOf fun (b, a, r) ↦ b ∈ Metric.ball a r -+ let s : Set (α × α × ℝ) := {point | point.1 ∈ Metric.ball point.2.1 point.2.2} - apply measurable_measure_prodMk_right (s := s) - unfold s Metric.ball -- simp_rw [mem_setOf] -+ simp_rw [mem_ofPred] - apply measurableSet_lt - · fun_prop - · fun_prop -diff --git a/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Basic.lean b/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Basic.lean -index 28c0164..1e50b97 100644 ---- a/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Basic.lean -+++ b/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Basic.lean -@@ -1,6 +1,8 @@ - import Mathlib.Order.ConditionallyCompleteLattice.Basic - import Mathlib.Order.ConditionallyCompleteLattice.Indexed - -+/-! # Comparison of conditionally complete suprema -/ -+ - -- Upstreaming status: under active development by @ldiedering - -- Wait for the file to stabilise first. - -@@ -57,7 +59,8 @@ theorem ciSup_eq_ciSup {α : Type*} {ι ι' : Sort*} [ConditionallyCompleteLinea - rw [iSup_of_empty', iSup_of_empty'] - - @[simp] --theorem WithTop.iSup_coe_eq_top' {α : Type*} [ConditionallyCompleteLinearOrderBot α] [NoTopOrder α] : -+theorem WithTop.iSup_coe_eq_top' {α : Type*} [ConditionallyCompleteLinearOrderBot α] -+ [NoTopOrder α] : - ⨆ (i : α), ↑i = (⊤ : WithTop α) := by - rw [WithTop.iSup_coe_eq_top] - simp -diff --git a/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Indexed.lean b/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Indexed.lean -index fdec970..6d9b0cf 100644 ---- a/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Indexed.lean -+++ b/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Indexed.lean -@@ -1,16 +1,6 @@ - import Mathlib.Order.ConditionallyCompleteLattice.Indexed - --section ConditionallyCompleteLinearOrderBot -+/-! # Indexed suprema in conditionally complete lattices - --variable {α : Type*} {ι : Sort*} {κ : ι → Sort*} --variable [ConditionallyCompleteLinearOrderBot α] {a : α} -- --theorem ciSup₂_le' {f : ∀ i, κ i → α} (h : ∀ i j, f i j ≤ a) : ⨆ (i) (j), f i j ≤ a := -- ciSup_le' fun i => ciSup_le' <| h i -- --theorem exists_lt_of_lt_ciSup₂' {f : ∀ i, κ i → α} (h : a < ⨆ (i) (j), f i j) : -- ∃ i j, a < f i j := by -- contrapose! h -- exact ciSup₂_le' h -- --end ConditionallyCompleteLinearOrderBot -+The bounds `ciSup₂_le'` and `exists_lt_of_lt_ciSup₂'` are supplied by Mathlib. -+-/ -diff --git a/Carleson/ToMathlib/RealInterpolation/InterpolatedExponents.lean b/Carleson/ToMathlib/RealInterpolation/InterpolatedExponents.lean -index 9f25cc1..5f8bbb2 100644 ---- a/Carleson/ToMathlib/RealInterpolation/InterpolatedExponents.lean -+++ b/Carleson/ToMathlib/RealInterpolation/InterpolatedExponents.lean -@@ -77,7 +77,7 @@ lemma ne_top_of_Ioc {p q r : ℝ≥0∞} (hq : q ∈ Ioc p r) (hr : r < ⊤) : q - hq.2.trans_lt hr |>.ne_top - - lemma pos_of_rb_Ioc {p q r : ℝ≥0∞} (hr : q ∈ Ioc p r) : 0 < r := -- zero_le p |>.trans_lt hr.1 |>.trans_le hr.2 -+ zero_le.trans_lt hr.1 |>.trans_le hr.2 - - lemma pos_of_Ioo {p q r : ℝ≥0∞} (hq : q ∈ Ioo p r) : 0 < q := pos_of_gt hq.1 - -@@ -113,8 +113,8 @@ lemma preservation_positivity₀ (ht : t ∈ Ioo 0 1) (hpq : p ≠ ⊤ ∨ q ≠ - 0 < (1 - t) * p⁻¹ + t * q⁻¹ := by - obtain dir|dir := hpq - · exact Left.add_pos_of_pos_of_nonneg (mul_pos ((tsub_pos_of_lt ht.2).ne') -- (ENNReal.inv_ne_zero.mpr dir)) (zero_le _) -- · exact Right.add_pos_of_nonneg_of_pos (zero_le _) -+ (ENNReal.inv_ne_zero.mpr dir)) zero_le -+ · exact Right.add_pos_of_nonneg_of_pos zero_le - <| ENNReal.mul_pos ht.1.ne' (ENNReal.inv_ne_zero.mpr dir) - - lemma preservation_positivity (ht : t ∈ Ioo 0 1) (hpq : p ≠ q) : -@@ -156,7 +156,8 @@ lemma rpow_apply_coe' {x : ℝ≥0∞} {y : ℝ} (hx : x ≠ ⊤) : - · rw [ENNReal.toNNReal_eq_zero_iff] - simp [hx] - --lemma rpow_lt_rpow_iff_neg {x y : ℝ≥0∞} (hx : x ≠ 0) (hy : y ≠ ∞) (hxy : x < y) {z : ℝ} (hz : z < 0) : -+lemma rpow_lt_rpow_iff_neg {x y : ℝ≥0∞} (hx : x ≠ 0) (hy : y ≠ ∞) (hxy : x < y) -+ {z : ℝ} (hz : z < 0) : - y ^ z < x ^ z := by - rw [ENNReal.rpow_apply_coe' hy, ENNReal.rpow_apply_coe' hxy.ne_top] - simpa [(pos_of_gt hxy).ne', hx] using -@@ -216,12 +217,13 @@ lemma rpow_le_rpow_of_exponent_le_base_le {a b t γ : ℝ} (ht : 0 < t) (htγ : - - -- Note: this lemma is false if t = γ = ∞ and a < 0 ≤ b, as then t ^ a = ∞ ^ a = 0 and - -- the statement becomes ∞ ≤ 0 * ∞ = 0. --lemma rpow_le_rpow_of_exponent_le_base_le_enorm {a b : ℝ} {t γ : ℝ≥0∞} (ht : 0 < t) (ht' : t ≠ ∞) (htγ : t ≤ γ) (hab : a ≤ b) : -+lemma rpow_le_rpow_of_exponent_le_base_le_enorm {a b : ℝ} {t γ : ℝ≥0∞} -+ (ht : 0 < t) (ht' : t ≠ ∞) (htγ : t ≤ γ) (hab : a ≤ b) : - t ^ b ≤ t ^ a * γ ^ (b - a) := by - calc - _ = t ^ (a + (b - a)) := by ring_nf - _ = t ^ a * t ^ (b - a) := by rw [ENNReal.rpow_add _ _ ht.ne' ht'] -- _ ≤ t ^ a * γ ^ (b - a) := by gcongr; linarith -+ _ ≤ t ^ a * γ ^ (b - a) := by gcongr - - -- TODO: there is a lot of overlap between above proof and below - lemma rpow_le_rpow_of_exponent_le_base_ge {a b t γ : ℝ} (hγ : 0 < γ) (htγ : γ ≤ t) (hab : a ≤ b) : -@@ -242,7 +244,8 @@ lemma rpow_le_rpow_of_exponent_le_base_ge {a b t γ : ℝ} (hγ : 0 < γ) (htγ - rw [Real.rpow_mul, Real.rpow_neg_one, ← Real.mul_rpow, ← div_eq_mul_inv] <;> try positivity - exact ofReal_le_ofReal (Real.rpow_le_rpow_of_exponent_le ((one_le_div hγ).mpr htγ) hab) - --lemma rpow_le_rpow_of_exponent_le_base_ge_enorm {a b : ℝ} {t γ : ℝ≥0∞} (hγ : 0 < γ) (hγ' : γ ≠ ∞) (htγ : γ ≤ t) (hab : a ≤ b) : -+lemma rpow_le_rpow_of_exponent_le_base_ge_enorm {a b : ℝ} {t γ : ℝ≥0∞} -+ (hγ : 0 < γ) (hγ' : γ ≠ ∞) (htγ : γ ≤ t) (hab : a ≤ b) : - t ^ a ≤ (t ^ b) * (γ ^ (a - b)) := by - by_cases ht' : t = ∞ - · simp_all only [le_top, top_rpow_def, ite_mul, sub_zero, one_mul, zero_mul] -@@ -254,7 +257,7 @@ lemma rpow_le_rpow_of_exponent_le_base_ge_enorm {a b : ℝ} {t γ : ℝ≥0∞} - · simp_all - · simpa using by order - · rw [ENNReal.top_mul] -- · exact zero_le ⊤ -+ · exact zero_le - simp_all - · positivity - · simp -@@ -318,7 +321,6 @@ lemma interp_exp_between (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) - gcongr - · finiteness - · exact ht.1.ne' -- · exact ht' - · rw [hp] - have : p₁⁻¹ = (1 - t) * p₁⁻¹ + t * p₁⁻¹ := by - rw [← add_mul, tsub_add_eq_max, max_eq_left_of_lt, one_mul] -@@ -433,7 +435,8 @@ lemma ne_inv_toReal_exponents (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp₀p₁ : - ← ofReal_toReal_eq_iff.mpr (inv_ne_top.mpr hp₁.ne')] - exact congrArg ENNReal.ofReal h - --lemma ne_inv_toReal_exp_interp_exp (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp₀p₁ : p₀ ≠ p₁) -+lemma ne_inv_toReal_exp_interp_exp (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) -+ (hp₀p₁ : p₀ ≠ p₁) - (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) : p₀⁻¹.toReal ≠ p⁻¹.toReal := by - rw [preservation_interpolation ht hp₀ hp₁ hp, ← sub_ne_zero] - convert mul_ne_zero (toReal_ne_zero_of_Ioo ht) -@@ -461,7 +464,8 @@ lemma ne_toReal_exp_interp_exp (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : - lemma ne_toReal_exp_interp_exp₁ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp₀p₁ : p₀ ≠ p₁) - (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) : - p.toReal ≠ p₁.toReal := -- (ne_toReal_exp_interp_exp (mem_sub_Ioo one_ne_top ht) hp₁ hp₀ hp₀p₁.symm (switch_exponents ht hp)).symm -+ (ne_toReal_exp_interp_exp (mem_sub_Ioo one_ne_top ht) hp₁ hp₀ hp₀p₁.symm -+ (switch_exponents ht hp)).symm - - lemma ofReal_inv_interp_sub_exp_pos₁ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) - (hq₀q₁ : q₀ ≠ q₁) -@@ -482,7 +486,8 @@ lemma exp_lt_iff (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp - · exact ⟨fun h ↦ (not_le_of_gt h (le_of_lt (interp_exp_between hp₀ hp₁ p₀lt_p₁ ht hp).1)).elim, - fun h ↦ (not_le_of_gt h p₀lt_p₁.le).elim⟩ - · exact ⟨fun _ ↦ p₁lt_p₀, -- fun _ ↦ (interp_exp_between hp₁ hp₀ p₁lt_p₀ (mem_sub_Ioo one_ne_top ht) (switch_exponents ht hp)).2⟩ -+ fun _ ↦ (interp_exp_between hp₁ hp₀ p₁lt_p₀ (mem_sub_Ioo one_ne_top ht) -+ (switch_exponents ht hp)).2⟩ - - lemma exp_gt_iff (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp₀p₁ : p₀ ≠ p₁) - (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) : -@@ -568,21 +573,21 @@ lemma ζ_equality₂ (ht : t ∈ Ioo 0 1) : - - lemma ζ_symm (ht : t ∈ Ioo 0 1) : ζ p₀ q₀ p₁ q₁ t.toReal = ζ p₁ q₁ p₀ q₀ (1 - t).toReal := by - unfold ζ -- rw [← mul_div_mul_right (c := - 1), mul_assoc _ _ (-1), mul_assoc _ _ (-1)]; on_goal 2 => positivity -+ rw [← mul_div_mul_right (c := - 1), mul_assoc _ _ (-1), mul_assoc _ _ (-1)] -+ on_goal 2 => positivity - simp only [mul_neg, mul_one, neg_sub] - nth_rewrite 1 [add_comm]; nth_rw 2 [add_comm] - rw [sub_toReal_of_le ht.2.le, sub_sub_toReal_of_le ht.2.le, - sub_sub_toReal_of_le (mem_sub_Ioo (by finiteness) ht).2.le] -- --set_option linter.style.multiGoal false in --set_option linter.flexible false in - lemma ζ_equality₃ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) - (hp₀p₁ : p₀ ≠ p₁) (hq₀q₁ : q₀ ≠ q₁) - (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) - (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hp₀' : p₀ ≠ ⊤) - (hq₀' : q₀ ≠ ⊤) : -- ζ p₀ q₀ p₁ q₁ t.toReal = (p₀.toReal * (q₀.toReal - q.toReal)) / (q₀.toReal * (p₀.toReal - p.toReal)) := by -- rw [ζ_equality₁ ht, ← preservation_interpolation, ← preservation_interpolation] -+ ζ p₀ q₀ p₁ q₁ t.toReal = (p₀.toReal * (q₀.toReal - q.toReal)) / -+ (q₀.toReal * (p₀.toReal - p.toReal)) := by -+ rw [ζ_equality₁ ht, ← preservation_interpolation ht hp₀ hp₁ hp, -+ ← preservation_interpolation ht hq₀ hq₁ hq] - have q_pos : 0 < q := interpolated_pos' hq₀ hq₁ (ne_top_of_Ioo ht) hq - have p_pos : 0 < p := interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp - have aux := mul_pos (interp_exp_toReal_pos ht hp₀ hp₁ hp₀p₁ hp) -@@ -600,12 +605,10 @@ lemma ζ_equality₃ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) - (p₀⁻¹.toReal * p₀.toReal) * p.toReal) := by ring - rw [eq₁, eq₂, ← @toReal_mul q⁻¹ q, ← @toReal_mul p⁻¹ p, ← @toReal_mul p₀⁻¹ p₀, - ← @toReal_mul q₀⁻¹ q₀] -- all_goals try assumption -- -- TODO: why can below goals not be discharged? -- repeat rw [ENNReal.inv_mul_cancel] <;> try positivity -- all_goals simp <;> try assumption -- · apply interp_exp_ne_top hq₀q₁ ht hq -- · apply interp_exp_ne_top hp₀p₁ ht hp -+ rw [ENNReal.inv_mul_cancel q_pos.ne' (interp_exp_ne_top hq₀q₁ ht hq), -+ ENNReal.inv_mul_cancel p_pos.ne' (interp_exp_ne_top hp₀p₁ ht hp), -+ ENNReal.inv_mul_cancel hp₀.ne' hp₀', ENNReal.inv_mul_cancel hq₀.ne' hq₀'] -+ simp - - lemma ζ_equality₄ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) - (hp₀p₁ : p₀ ≠ p₁) (hq₀q₁ : q₀ ≠ q₁) -@@ -620,12 +623,14 @@ lemma ζ_equality₄ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) - · rw [hp, add_comm, ENNReal.sub_sub_cancel one_ne_top ht.2.le] - · rw [hq, add_comm, ENNReal.sub_sub_cancel one_ne_top ht.2.le] - --lemma ζ_equality₅ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) -+lemma ζ_equality₅ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) -+ (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) - (hp₀p₁ : p₀ ≠ p₁) (hq₀q₁ : q₀ ≠ q₁) - (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) - (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hp₀' : p₀ ≠ ⊤) - (hq₀' : q₀ ≠ ⊤) : -- p₀.toReal + (ζ p₀ q₀ p₁ q₁ t.toReal)⁻¹ * (q.toReal - q₀.toReal) * (p₀.toReal / q₀.toReal) = p.toReal := by -+ p₀.toReal + (ζ p₀ q₀ p₁ q₁ t.toReal)⁻¹ * (q.toReal - q₀.toReal) * -+ (p₀.toReal / q₀.toReal) = p.toReal := by - rw [ζ_equality₃ ht] <;> try assumption - simp only [inv_div] - rw [div_eq_mul_inv, div_eq_mul_inv, mul_inv] -@@ -639,12 +644,14 @@ lemma ζ_equality₅ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (h - · exact (exp_toReal_pos hp₀ hp₀').ne' - · exact (exp_toReal_pos hq₀ hq₀').ne' - --lemma ζ_equality₆ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) -+lemma ζ_equality₆ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) -+ (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) - (hp₀p₁ : p₀ ≠ p₁) (hq₀q₁ : q₀ ≠ q₁) - (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) - (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hp₁' : p₁ ≠ ⊤) - (hq₁' : q₁ ≠ ⊤) : -- p₁.toReal + (ζ p₀ q₀ p₁ q₁ t.toReal)⁻¹ * (q.toReal - q₁.toReal) * (p₁.toReal / q₁.toReal) = p.toReal := by -+ p₁.toReal + (ζ p₀ q₀ p₁ q₁ t.toReal)⁻¹ * (q.toReal - q₁.toReal) * -+ (p₁.toReal / q₁.toReal) = p.toReal := by - rw [ζ_symm ht] - apply ζ_equality₅ (mem_sub_Ioo one_ne_top ht) hp₁ hq₁ hp₀ hq₀ hp₀p₁.symm hq₀q₁.symm _ _ hp₁' hq₁' - · rw [add_comm, one_sub_one_sub_eq ht]; apply hp -@@ -1010,9 +1017,11 @@ lemma eq_exponents₂ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) - - lemma eq_exponents₁ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) (hq₀q₁ : q₀ ≠ q₁) - (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hq₀' : q₀ ≠ ⊤) : -- (q₀⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal)) * (q.toReal - q₀.toReal) = - t.toReal * q.toReal := by -+ (q₀⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal)) * (q.toReal - q₀.toReal) = -+ - t.toReal * q.toReal := by - rw [mul_comm_div, ← mul_div_assoc] -- have : q₀⁻¹.toReal * (q.toReal - q₀.toReal) = - t.toReal * q.toReal * (q₁⁻¹.toReal - q₀⁻¹.toReal) := by -+ have : q₀⁻¹.toReal * (q.toReal - q₀.toReal) = -+ - t.toReal * q.toReal * (q₁⁻¹.toReal - q₀⁻¹.toReal) := by - calc - _ = (q₀⁻¹.toReal * q.toReal - q₀⁻¹.toReal * q₀.toReal) := by ring - _ = (q₀⁻¹.toReal * q.toReal - 1) := by -@@ -1052,7 +1061,8 @@ lemma eq_exponents₃ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) - exact ne_sub_toReal_exp hq₀ hq₁ hq₀q₁ - - lemma eq_exponents₄ : -- q₀⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal) = - (q₀⁻¹.toReal / (q₀⁻¹.toReal - q₁⁻¹.toReal)) := calc -+ q₀⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal) = -+ - (q₀⁻¹.toReal / (q₀⁻¹.toReal - q₁⁻¹.toReal)) := calc - _ = - (q₀⁻¹.toReal * (-(q₁⁻¹.toReal - q₀⁻¹.toReal)⁻¹)) := by - rw [div_eq_mul_inv]; ring - _ = _ := by congr; rw [neg_inv, neg_sub] -@@ -1066,7 +1076,8 @@ lemma eq_exponents₅ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) - - lemma eq_exponents₆ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) (hq₀q₁ : q₀ ≠ q₁) - (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hq₁' : q₁ ≠ ⊤) : -- q₁⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal) * (q.toReal - q₁.toReal) = (1 - t).toReal * q.toReal := by -+ q₁⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal) * (q.toReal - q₁.toReal) = -+ (1 - t).toReal * q.toReal := by - rw [← neg_neg (a := q₁⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal)), ← eq_exponents₄, neg_mul, - eq_exponents₁ (mem_sub_Ioo one_ne_top ht) hq₁ hq₀ hq₀q₁.symm (switch_exponents ht hq) hq₁', - neg_mul, neg_neg] -diff --git a/Carleson/ToMathlib/RealInterpolation/Main.lean b/Carleson/ToMathlib/RealInterpolation/Main.lean -index 9bff6d4..3dce337 100644 ---- a/Carleson/ToMathlib/RealInterpolation/Main.lean -+++ b/Carleson/ToMathlib/RealInterpolation/Main.lean -@@ -50,7 +50,8 @@ variable {α α' ε E E₁ E₂ E₃ : Type*} {m : MeasurableSpace α} {m' : Mea - ## Definitions -/ - namespace MeasureTheory - --variable {ε₁ ε₂ : Type*} [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] [TopologicalSpace ε₂] [ESeminormedAddMonoid ε₂] -+variable {ε₁ ε₂ : Type*} [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] -+ [TopologicalSpace ε₂] [ESeminormedAddMonoid ε₂] - - def Subadditive [ENorm ε] (T : (α → ε₁) → α' → ε) : Prop := - ∃ A ≠ ⊤, ∀ (f g : α → ε₁) (x : α'), ‖T (f + g) x‖ₑ ≤ A * (‖T f x‖ₑ + ‖T g x‖ₑ) -@@ -116,7 +117,8 @@ lemma biSup {ι : Type*} {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {T : ι → ( - specialize h f hf g hg - simp_rw [enorm_eq_self] at h ⊢ - filter_upwards [hT f hf, hT g hg, (ae_ball_iff h𝓑).mpr h, (ae_ball_iff h𝓑).mpr (hT' f hf), -- (ae_ball_iff h𝓑).mpr (hT' g hg), (ae_ball_iff h𝓑).mpr (hT' (f + g) (hP hf hg))] with x hTfx hTgx hx hT'fx hT'gx hT'fgx -+ (ae_ball_iff h𝓑).mpr (hT' g hg), (ae_ball_iff h𝓑).mpr (hT' (f + g) (hP hf hg))] -+ with x hTfx hTgx hx hT'fx hT'gx hT'fgx - simp_rw [iSup_le_iff] - intro i hi - specialize hx i hi -@@ -173,7 +175,8 @@ lemma biSup {ι : Type*} {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {T : ι → ( - conv at hT' => enter [i]; rw [forall_comm] - rw [forall_comm] at hT'; simp_rw [imp.swap, ← imp_forall_iff] at hT' - filter_upwards [(ae_ball_iff h𝓑).mpr (fun i hi ↦ (h i hi).2 f c hf), -- (ae_ball_iff h𝓑).mpr (hT' f hf), (ae_ball_iff h𝓑).mpr (hT' (c • f) (h_smul hf))] with x hx hT'fx hT'cfx -+ (ae_ball_iff h𝓑).mpr (hT' f hf), (ae_ball_iff h𝓑).mpr (hT' (c • f) (h_smul hf))] -+ with x hx hT'fx hT'cfx - simp_rw [Pi.smul_apply, ENNReal.smul_iSup] - refine biSup_congr (fun i hi ↦ ?_) - specialize hx i hi -@@ -272,7 +275,8 @@ variable {α α' E E₁ E₂ E₃ : Type*} {m : MeasurableSpace α} {m' : Measur - -/ - namespace MeasureTheory - --variable {ε₁ ε₂ : Type*} [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] [TopologicalSpace ε₂] [ESeminormedAddMonoid ε₂] -+variable {ε₁ ε₂ : Type*} [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] -+ [TopologicalSpace ε₂] [ESeminormedAddMonoid ε₂] - - /-- Proposition that expresses that the map `T` map between function spaces preserves - AE strong measurability on L^p. -/ -@@ -322,7 +326,8 @@ lemma rewrite_norm_func {q : ℝ} {g : α' → E} - rw [ENNReal.ofReal_rpow_of_pos ha, ENNReal.ofReal_mul (by positivity)] - - lemma estimate_norm_rpow_range_operator {q : ℝ} {f : α → E₁} -- [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [TopologicalSpace E₂] [ESeminormedAddCommMonoid E₂] -+ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] -+ [TopologicalSpace E₂] [ESeminormedAddCommMonoid E₂] - (hq : 0 < q) (tc : StrictRangeToneCouple) {A : ℝ≥0} (hA : 0 < A) - (ht : Subadditive_trunc T A f ν) (hTf : AEStronglyMeasurable (T f) ν) : - ∫⁻ x : α', ‖T f x‖ₑ ^ q ∂ν ≤ -@@ -336,8 +341,9 @@ lemma estimate_norm_rpow_range_operator {q : ℝ} {f : α → E₁} - convert estimate_distribution_Subadditive_trunc (tc.ran_ton a ha).1 ht <;> simp - - -- TODO: the infrastructure can perhaps be improved here --@[measurability, fun_prop] --theorem ton_measurable_eLpNorm_trunc [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (tc : ToneCouple) : -+@[fun_prop] -+theorem ton_measurable_eLpNorm_trunc [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] -+ (tc : ToneCouple) : - Measurable (fun x ↦ eLpNorm (trunc f (tc.ton x)) p₁ μ) := by - change Measurable ((fun t : ℝ≥0∞ ↦ eLpNorm (trunc f t) p₁ μ) ∘ (tc.ton)) - have tone := tc.ton_is_ton -@@ -405,7 +411,8 @@ lemma estimate_norm_rpow_range_operator' - apply lintegral_congr_ae - filter_upwards [ae_in_Ioo_zero_top] with s ⟨s_pos, s_lt_top⟩ - have is_q₀top : ¬ q₀ < ⊤ := by assumption -- rw [hq₀' (not_lt_top.mp is_q₀top) s s_pos, hq₁' (not_lt_top.mp is_q₁top) s s_pos, zero_mul, add_zero] -+ rw [hq₀' (not_lt_top.mp is_q₀top) s s_pos, hq₁' (not_lt_top.mp is_q₁top) s s_pos, -+ zero_mul, add_zero] - - lemma simplify_factor_rw_aux₀ (a b c d e f : ℝ≥0∞) : - a * b * c * d * e * f = a * c * e * (b * d * f) := by ring -@@ -561,7 +568,7 @@ def finite_spanning_sets_from_lintegrable {g : α → ℝ≥0∞} (hg : AEMeasur - simp only [one_div] - split_ifs with is_n_zero - · simp [is_n_zero] at wn -- · simp only [mem_setOf_eq] -+ · simp only [mem_ofPred_eq] - refine inv_le_iff_inv_le.mpr ?_ - apply le_of_lt - refine lt_trans wn ?_ -@@ -584,7 +591,7 @@ lemma support_sigma_finite_from_MemLp - unfold Function.support g - ext x - simp only [ne_eq, ENNReal.rpow_eq_zero_iff, enorm_eq_zero, not_or, not_and, not_lt, -- toReal_nonneg, implies_true, and_true, mem_setOf_eq] -+ toReal_nonneg, implies_true, and_true, mem_ofPred_eq] - constructor - · contrapose - simp [Classical.not_imp, not_le, toReal_pos hp' hp] -@@ -592,13 +599,11 @@ lemma support_sigma_finite_from_MemLp - contradiction - rw [← this] - apply support_sigma_finite_of_lintegrable -- · exact hf.1.enorm.pow_const _ -+ · exact hf.aestronglyMeasurable.enorm.pow_const _ - · unfold g -- have obs := hf.2 -- unfold eLpNorm eLpNorm' at obs -- split_ifs at obs -- · contradiction -- · exact lintegral_rpow_enorm_lt_top_of_eLpNorm'_lt_top (toReal_pos hp' hp) obs -+ apply lintegral_rpow_enorm_lt_top_of_eLpNorm'_lt_top (toReal_pos hp' hp) -+ rw [← eLpNorm_eq_eLpNorm' hp' hp hf.aestronglyMeasurable] -+ exact hf - - -- lemma support_sfinite_from_MemLp - -- [MeasurableSpace E₁] [NormedAddCommGroup E₁] [BorelSpace E₁] (hf : MemLp f p μ) -@@ -656,7 +661,8 @@ lemma combine_estimates₀ {A : ℝ≥0} (hA : 0 < A) - eLpNorm (truncCompl f (tc.ton s)) p₀ μ ^ q₀.toReal * - s ^ (q.toReal - q₀.toReal - 1))) := by - gcongr -- apply estimate_norm_rpow_range_operator' (p := p) (tc := tc) p₀pos q₀pos q₁pos <;> try assumption -+ apply estimate_norm_rpow_range_operator' (p := p) (tc := tc) p₀pos q₀pos q₁pos <;> -+ try assumption - · exact (interp_exp_between p₀pos p₁pos hp₀p₁ ht hp).2 - · exact (interp_exp_between p₀pos p₁pos hp₀p₁ ht hp).1 - · intro q₀top s (hs : 0 < s) -@@ -709,7 +715,7 @@ lemma combine_estimates₀ {A : ℝ≥0} (hA : 0 < A) - · exact hp₁.2 - · exact ne_top_of_Ioc hp₁ is_q₁top - · exact is_q₁top.ne_top -- · exact hf.1 -+ · exact hf.aestronglyMeasurable - · rw [hspf]; rfl - · simp - · split_ifs with is_q₀top -@@ -719,7 +725,7 @@ lemma combine_estimates₀ {A : ℝ≥0} (hA : 0 < A) - · exact hp₀.2 - · exact ne_top_of_Ioc hp₀ is_q₀top - · exact is_q₀top.ne_top -- · exact hf.1 -+ · exact hf.aestronglyMeasurable - · rw [hspf]; rfl - · simp - _ = (if q₁ < ⊤ then 1 else 0) * -@@ -784,8 +790,8 @@ lemma combine_estimates₁ {A : ℝ≥0} (hA : 0 < A) - refine le_of_rpow_le q'pos ?_ - calc - _ = ∫⁻ x , ‖T f x‖ₑ ^ q.toReal ∂ν := by -- unfold eLpNorm eLpNorm' -- split_ifs <;> [contradiction; rw [one_div, ENNReal.rpow_inv_rpow q'pos.ne']] -+ rw [eLpNorm_eq_eLpNorm' q_ne_zero q_ne_top (h₂T hf), eLpNorm', one_div, -+ ENNReal.rpow_inv_rpow q'pos.ne'] - _ ≤ _ := by - apply combine_estimates₀ (hT := hT) (p := p) <;> try assumption - _ = _ := by -@@ -798,7 +804,8 @@ lemma combine_estimates₁ {A : ℝ≥0} (hA : 0 < A) - exact ofReal_toReal_eq_iff.mpr q_ne_top - · rw [toReal_inv, ENNReal.rpow_inv_rpow q'pos.ne'] - --lemma simplify_factor₃ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hp₀ : 0 < p₀) (hp₀' : p₀ ≠ ⊤) (ht : t ∈ Ioo 0 1) -+lemma simplify_factor₃ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] -+ (hp₀ : 0 < p₀) (hp₀' : p₀ ≠ ⊤) (ht : t ∈ Ioo 0 1) - (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) (hp₀p₁ : p₀ = p₁) : - C₀ ^ q₀.toReal * (eLpNorm f p μ ^ p.toReal) ^ (q₀.toReal / p₀.toReal) = - (↑C₀ * eLpNorm f p μ) ^ q₀.toReal := by -@@ -811,9 +818,11 @@ lemma simplify_factor_aux₄ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E - (hp₀ : p₀ ∈ Ioc 0 q₀) (ht : t ∈ Ioo 0 1) - (hp₀p₁ : p₀ = p₁) (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) - (hF : eLpNorm f p μ ∈ Ioo 0 ⊤) : -- ↑C₀ ^ ((1 - t).toReal * q.toReal) * (eLpNorm f p μ ^ p.toReal) ^ ((1 - t).toReal * p₀⁻¹.toReal * q.toReal) * -+ ↑C₀ ^ ((1 - t).toReal * q.toReal) * -+ (eLpNorm f p μ ^ p.toReal) ^ ((1 - t).toReal * p₀⁻¹.toReal * q.toReal) * - ↑C₁ ^ (t.toReal * q.toReal) * -- (eLpNorm f p μ ^ p.toReal) ^ (t.toReal * p₁⁻¹.toReal * q.toReal) = C₀ ^ ((1 - t).toReal * q.toReal) * -+ (eLpNorm f p μ ^ p.toReal) ^ (t.toReal * p₁⁻¹.toReal * q.toReal) = -+ C₀ ^ ((1 - t).toReal * q.toReal) * - C₁ ^ (t.toReal * q.toReal) * eLpNorm f p μ ^ q.toReal := by - have hp' : p₀ = p := (interp_exp_eq hp₀p₁ ht hp) - have p₀ne_top : p₀ ≠ ⊤ := ne_top_of_le_ne_top hq₀' hp₀.2 -@@ -835,7 +844,8 @@ lemma simplify_factor_aux₄ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E - · exact hp' ▸ d_pos_aux₀ hF |>.ne' - · exact hp' ▸ d_ne_top_aux₀ hF - --lemma simplify_factor₄ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hq₀' : q₀ ≠ ⊤) -+lemma simplify_factor₄ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] -+ (hq₀' : q₀ ≠ ⊤) - (hp₀ : p₀ ∈ Ioc 0 q₀) (hp₁ : p₁ ∈ Ioc 0 q₁) (ht : t ∈ Ioo 0 1) - (hp₀p₁ : p₀ = p₁) - (hq₀q₁ : q₀ ≠ q₁) (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) -@@ -851,7 +861,8 @@ lemma simplify_factor₄ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAd - rw [simplify_factor₀ (ht := ht) (hD := hD)] <;> assumption - - --lemma simplify_factor₅ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hq₁' : q₁ ≠ ⊤) -+lemma simplify_factor₅ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] -+ (hq₁' : q₁ ≠ ⊤) - (hp₀ : p₀ ∈ Ioc 0 q₀) (hp₁ : p₁ ∈ Ioc 0 q₁) - (ht : t ∈ Ioo 0 1) - (hp₀p₁ : p₀ = p₁) -@@ -864,7 +875,8 @@ lemma simplify_factor₅ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAd - C₀ ^ ((1 - t).toReal * q.toReal) * C₁ ^ (t.toReal * q.toReal) * eLpNorm f p μ ^ q.toReal := by - have p₁pos : 0 < p₁ := hp₁.1 - have p₁ne_top : p₁ ≠ ⊤ := ne_top_of_le_ne_top hq₁' hp₁.2 -- rw [← simplify_factor₃ p₁pos p₁ne_top (mem_sub_Ioo one_ne_top ht) (switch_exponents ht hp) hp₀p₁.symm, -+ rw [← simplify_factor₃ p₁pos p₁ne_top (mem_sub_Ioo one_ne_top ht) -+ (switch_exponents ht hp) hp₀p₁.symm, - simplify_factor₁ hq₁' hp₀ hp₁ ht hq₀q₁ hp hq hC₀ hC₁ hF hD] - - /-- The trivial case for the estimate in the real interpolation theorem -@@ -876,7 +888,7 @@ lemma exists_hasStrongType_real_interpolation_aux₀ {p₀ p₁ q₀ q₁ p q : - (hp : p⁻¹ = (1 - t) / p₀ + t / p₁) - (hq : q⁻¹ = (1 - t) / q₀ + t / q₁) - (h₀T : HasWeakType T p₀ q₀ μ ν C₀) -- (h₂T : PreservesAEStrongMeasurability (μ := μ) (ν := ν) T p) (hf : MemLp f p μ) -+ (_h₂T : PreservesAEStrongMeasurability (μ := μ) (ν := ν) T p) (_hf : MemLp f p μ) - (hF : eLpNorm f p μ = 0) : - eLpNorm (T f) q ν = 0 := by - unfold HasWeakType at h₀T -@@ -884,14 +896,14 @@ lemma exists_hasStrongType_real_interpolation_aux₀ {p₀ p₁ q₀ q₁ p q : - have q₀pos : 0 < q₀ := pos_of_rb_Ioc hp₀ - have q₁pos : 0 < q₁ := pos_of_rb_Ioc hp₁ - have q_pos : 0 < q := interpolated_pos' q₀pos q₁pos (ne_top_of_Ioo ht) hq -- have f_ae_0 : f =ᵐ[μ] 0 := (eLpNorm_eq_zero_iff hf.1 p_pos.ne').mp hF -- have hf₂ : eLpNorm f p₀ μ = 0 := (eLpNorm_eq_zero_iff hf.1 hp₀.1.ne').mpr f_ae_0 -- have hf₁ : MemLp f p₀ μ := ⟨hf.1, by rw [hf₂]; exact zero_lt_top⟩ -+ have f_ae_0 : f =ᵐ[μ] 0 := (eLpNorm_eq_zero_iff p_pos.ne').mp hF -+ have hf₂ : eLpNorm f p₀ μ = 0 := (eLpNorm_eq_zero_iff hp₀.1.ne').mpr f_ae_0 -+ have hf₁ : MemLp f p₀ μ := by rw [MemLp, hf₂]; exact zero_lt_top - have := (h₀T f hf₁).2 - rw [hf₂, mul_zero] at this - have wnorm_0 : wnorm (T f) q₀ ν = 0 := nonpos_iff_eq_zero.mp this - have : (T f) =ᵐ[ν] 0 := (wnorm_eq_zero_iff q₀pos.ne').mp wnorm_0 -- exact (eLpNorm_eq_zero_iff (h₂T hf) q_pos.ne').mpr this -+ exact (eLpNorm_eq_zero_iff q_pos.ne').mpr this - - /-- The estimate for the real interpolation theorem in case `p₀ < p₁`. -/ - lemma exists_hasStrongType_real_interpolation_aux {p₀ p₁ q₀ q₁ p q : ℝ≥0∞} {A : ℝ≥0} -@@ -913,9 +925,9 @@ lemma exists_hasStrongType_real_interpolation_aux {p₀ p₁ q₀ q₁ p q : ℝ - have hq₀ : 0 < q₀ := pos_of_rb_Ioc hp₀ - have hq₁ : 0 < q₁ := pos_of_rb_Ioc hp₁ - rcases (eq_zero_or_pos (eLpNorm f p μ)) with hF | hF -- · refine le_of_eq_of_le ?_ (zero_le _) -+ · refine le_of_eq_of_le ?_ zero_le - apply exists_hasStrongType_real_interpolation_aux₀ (hp := hp) (hq := hq) <;> try assumption -- · let spf := spf_ch (toReal_mem_Ioo ht) hq₀q₁ hp₀.1 hq₀ hp₁.1 hq₁ hp₀p₁.ne hC₀ hC₁ ⟨hF, hf.2⟩ -+ · let spf := spf_ch (toReal_mem_Ioo ht) hq₀q₁ hp₀.1 hq₀ hp₁.1 hq₁ hp₀p₁.ne hC₀ hC₁ ⟨hF, hf⟩ - apply combine_estimates₁ <;> try assumption - on_goal 1 => unfold spf - rfl -@@ -966,9 +978,11 @@ lemma exists_hasStrongType_real_interpolation_aux₁ {f : α → E₁} - ENNReal.ofReal (t ^ (q.toReal - q₁.toReal - 1))) * - if q₁ = ⊤ then 0 else 1)) ^ - q.toReal⁻¹ = (ENNReal.ofReal q.toReal * -- (↑C₀ ^ ((1 - t).toReal * q.toReal) * ↑C₁ ^ (t.toReal * q.toReal) * eLpNorm f p μ ^ q.toReal * -+ (↑C₀ ^ ((1 - t).toReal * q.toReal) * ↑C₁ ^ (t.toReal * q.toReal) * -+ eLpNorm f p μ ^ q.toReal * - ENNReal.ofReal |q.toReal - q₀.toReal|⁻¹ * (if q₀ = ⊤ then 0 else 1) + -- ↑C₀ ^ ((1 - t).toReal * q.toReal) * ↑C₁ ^ (t.toReal * q.toReal) * eLpNorm f p μ ^ q.toReal * -+ ↑C₀ ^ ((1 - t).toReal * q.toReal) * ↑C₁ ^ (t.toReal * q.toReal) * -+ eLpNorm f p μ ^ q.toReal * - ENNReal.ofReal |q.toReal - q₁.toReal|⁻¹ * if q₁ = ⊤ then 0 else 1)) ^ - q.toReal⁻¹ := by - congr 3 -@@ -976,9 +990,7 @@ lemma exists_hasStrongType_real_interpolation_aux₁ {f : α → E₁} - div_eq_mul_inv, ← ofReal_inv_of_pos, ← ENNReal.ofReal_rpow_of_pos] <;> try positivity - rw [← mul_assoc, simplify_factor₄ (ht := ht) (hC₁ := hC₁) (hq₀' := hq₀q₁.ne_top)] - <;> try assumption -- · rw [abs_of_pos] <;> linarith -- · rw [abs_of_pos] <;> linarith -- · linarith -+ linarith - · split_ifs with is_q₁top - · rw [mul_zero, mul_zero] - · have q_lt_q₁toReal : q.toReal < q₁.toReal := -@@ -1025,9 +1037,9 @@ lemma exists_hasStrongType_real_interpolation_aux₂ {f : α → E₁} - (interp_exp_toReal_pos' ht q₀pos q₁pos hq (Or.inl hq₀q₁.ne_top)).ne' - have p_eq_p₀ : p = p₀ := (interp_exp_eq hp₀p₁ ht hp).symm - rcases (eq_zero_or_pos (eLpNorm f p μ)) with hF | snorm_pos -- · refine le_of_eq_of_le ?_ (zero_le _) -+ · refine le_of_eq_of_le ?_ zero_le - apply exists_hasStrongType_real_interpolation_aux₀ (hp := hp) (hq := hq) <;> try assumption -- · have hF : eLpNorm f p μ ∈ Ioo 0 ⊤ := ⟨snorm_pos, hf.2⟩ -+ · have hF : eLpNorm f p μ ∈ Ioo 0 ⊤ := ⟨snorm_pos, hf⟩ - have M_pos : 0 < M := toReal_pos (d_pos hC₀ hC₁ hF).ne' (d_ne_top hC₀ hC₁ hF) - have coe_q : ENNReal.ofReal q.toReal = q := - ofReal_toReal_eq_iff.mpr (interp_exp_ne_top hq₀q₁.ne ht hq) -@@ -1036,10 +1048,13 @@ lemma exists_hasStrongType_real_interpolation_aux₂ {f : α → E₁} - (interp_exp_toReal_pos ht q₀pos q₁pos hq₀q₁.ne hq)] - calc - (ENNReal.ofReal q.toReal * -- ∫⁻ (t : ℝ) in Ioi 0, distribution (T f) (ENNReal.ofReal t) ν * ENNReal.ofReal (t ^ (q.toReal - 1))) ^ q.toReal⁻¹ -+ ∫⁻ (t : ℝ) in Ioi 0, distribution (T f) (ENNReal.ofReal t) ν * -+ ENNReal.ofReal (t ^ (q.toReal - 1))) ^ q.toReal⁻¹ - ≤ (ENNReal.ofReal q.toReal * ( -- (∫⁻ (t : ℝ) in Ioo 0 M, distribution (T f) (ENNReal.ofReal t) ν * ENNReal.ofReal (t ^ (q.toReal - 1))) + -- (∫⁻ (t : ℝ) in Ici M, distribution (T f) (ENNReal.ofReal t) ν * ENNReal.ofReal (t ^ (q.toReal - 1)))) -+ (∫⁻ (t : ℝ) in Ioo 0 M, distribution (T f) (ENNReal.ofReal t) ν * -+ ENNReal.ofReal (t ^ (q.toReal - 1))) + -+ (∫⁻ (t : ℝ) in Ici M, distribution (T f) (ENNReal.ofReal t) ν * -+ ENNReal.ofReal (t ^ (q.toReal - 1)))) - ) ^ q.toReal⁻¹ := by - gcongr - rw [← Ioo_union_Ici_eq_Ioi (M_pos)] -@@ -1325,7 +1340,8 @@ lemma Subadditive_trunc_from_SubadditiveOn_Lp₀p₁ {p₀ p₁ p : ℝ≥0∞} - apply hT - · rcases lt_trichotomy p₀ p₁ with p₀lt_p₁ | (p₀eq_p₁ | p₁lt_p₀) - · refine Or.inr (trunc_Lp_Lq_higher (p := p) ?_ hf ha) -- exact ⟨interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp, (interp_exp_between hp₀ hp₁ p₀lt_p₁ ht hp).2.le⟩ -+ exact ⟨interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp, -+ (interp_exp_between hp₀ hp₁ p₀lt_p₁ ht hp).2.le⟩ - · exact Or.inl <| interp_exp_eq p₀eq_p₁ ht hp ▸ hf.trunc - · refine Or.inl (trunc_Lp_Lq_higher (p := p) ?_ hf ha) - exact ⟨interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp, -diff --git a/Carleson/ToMathlib/RealInterpolation/Minkowski.lean b/Carleson/ToMathlib/RealInterpolation/Minkowski.lean -index 43184f4..632342e 100644 ---- a/Carleson/ToMathlib/RealInterpolation/Minkowski.lean -+++ b/Carleson/ToMathlib/RealInterpolation/Minkowski.lean -@@ -42,8 +42,8 @@ lemma truncCut_mono {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} ( - · exact min_le_min_left (f x) (Nat.cast_le.mpr hmn) - · contrapose! is_fx_le_n - exact monotone_spanningSets _ hmn is_fx_le_m -- · exact zero_le _ -- · exact zero_le _ -+ · exact zero_le -+ · exact zero_le - - lemma truncCut_mono₀ {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} : - Monotone (truncCut f μ) := by -@@ -57,7 +57,7 @@ lemma truncCut_sup {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} (x - · intro n; unfold truncCut indicator - split_ifs - · exact min_le_left (f x) ↑n -- · exact zero_le _ -+ · exact zero_le - · intro w hw - unfold truncCut - have : ∃ m : ℕ, x ∈ spanningSets μ m := by -@@ -77,8 +77,6 @@ lemma truncCut_sup {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} (x - _ = _ := (Nat.cast_add m n).symm - · contrapose! is_x_in_Ampn - exact monotone_spanningSets _ (Nat.le_add_right m n) wm -- --set_option linter.flexible false in - /-- Characterization of `∫⁻ x : α, f x ^ p ∂μ` by a duality argument. -/ - lemma representationLp {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} - (hf : AEMeasurable f μ) {p q : ℝ} (hp : p > 1) (hq : q ≥ 1) -@@ -140,7 +138,7 @@ lemma representationLp {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞ - intro n - rcases eq_or_ne (∫⁻ x : α, (g n x) ^ p ∂μ) 0 with int_eq_zero | int_ne_zero - · rw [int_eq_zero, ENNReal.zero_rpow_of_pos] -- · exact zero_le _ -+ · exact zero_le - · exact inv_pos_of_pos (by positivity) - · calc - _ = (∫⁻ x : α, (f x) * (g n x) ^ (p - 1) ∂μ) * ( -@@ -173,7 +171,9 @@ lemma representationLp {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞ - apply Monotone.map_iSup_of_continuousAt (f := fun (x : ℝ≥0∞) ↦ x ^ (1 / p)) - · fun_prop - · apply ENNReal.monotone_rpow_of_nonneg (by positivity) -- · simp; positivity -+ · simp only [bot_eq_zero', one_div, ENNReal.rpow_eq_zero_iff, inv_pos, true_and, -+ zero_ne_top, inv_neg'', false_and, or_false] -+ positivity - let h := fun n : ℕ ↦ (fun x ↦ g n x ^ (p - 1) / (∫⁻ y : α, ((g n y) ^ (p - 1)) ^ q ∂μ) ^ q⁻¹) - have comp_sup : (⨆ n : ℕ, ∫⁻ (x : α), f x * h n x ∂μ) ≤ - ⨆ g ∈ {g' : α → ℝ≥0∞ | AEMeasurable g' μ ∧ ∫⁻ (z : α), (g' z) ^ q ∂μ ≤ 1}, -@@ -250,9 +250,9 @@ lemma aemeasurability_prod₂ {α : Type u_1} {β : Type u_3} - ∀ᵐ y : β ∂ν, AEMeasurable (f ∘ (fun x ↦ Prod.mk x y)) μ := by - have : AEMeasurable (f ∘ Prod.swap) (ν.prod μ) := by - refine AEMeasurable.comp_measurable ?_ measurable_swap -- rw [Measure.prod_swap] -- assumption -+ rwa [Measure.prod_swap] - convert aemeasurability_prod₁ this -- perf: convert is faster than exact -+ rfl - - -- TODO: better name! - @[fun_prop] -@@ -324,7 +324,7 @@ lemma lintegral_lintegral_pow_swap_rpow {α : Type u_1} {β : Type u_3} {p : ℝ - /-! ## Apply Minkowski's integral inequality to truncations - -/ - --@[measurability, fun_prop] -+@[fun_prop] - theorem aemeasurable_ton (tc : ToneCouple) : AEMeasurable tc.ton (volume.restrict (Ioi 0)) := by - -- ton is either increasing or decreasing - have tone := tc.ton_is_ton -@@ -336,8 +336,10 @@ theorem aemeasurable_ton (tc : ToneCouple) : AEMeasurable tc.ton (volume.restric - @[measurability] - lemma indicator_ton_measurable {g : α → E₁} [MeasurableSpace E₁] - [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] -+ [SFinite μ] - (hg : AEMeasurable g μ) (tc : ToneCouple) : -- NullMeasurableSet {(s, x) : ℝ≥0∞ × α | ‖g x‖ₑ ≤ tc.ton s } ((volume.restrict (Ioi 0)).prod μ) := by -+ NullMeasurableSet {(s, x) : ℝ≥0∞ × α | ‖g x‖ₑ ≤ tc.ton s } -+ ((volume.restrict (Ioi 0)).prod μ) := by - apply nullMeasurableSet_le hg.comp_snd.enorm - apply AEMeasurable.comp_fst (f := fun a ↦ tc.ton a) - refine AEMeasurable.comp_aemeasurable ?_ aemeasurable_id' -@@ -347,7 +349,7 @@ lemma indicator_ton_measurable {g : α → E₁} [MeasurableSpace E₁] - @[measurability] - lemma indicator_ton_measurable_lt {g : α → E₁} [MeasurableSpace E₁] - [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] -- [BorelSpace E₁] (hg : AEMeasurable g μ) (tc : ToneCouple) : -+ [BorelSpace E₁] [SFinite μ] (hg : AEMeasurable g μ) (tc : ToneCouple) : - NullMeasurableSet {(s, x) : ℝ≥0∞ × α | tc.ton s < ‖g x‖ₑ } - ((volume.restrict (Ioi 0)).prod μ) := by - refine nullMeasurableSet_lt ?_ hg.comp_snd.enorm -@@ -355,9 +357,10 @@ lemma indicator_ton_measurable_lt {g : α → E₁} [MeasurableSpace E₁] - refine AEMeasurable.comp_aemeasurable ?_ aemeasurable_id' - simp only [Measure.map_id', aemeasurable_ton] - --@[measurability, fun_prop] -+@[fun_prop] - lemma AEMeasurable.trunc_ton {f : α → E₁} - [MeasurableSpace E₁] [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] -+ [SFinite (μ.restrict f.support)] - (hf : AEMeasurable f μ) (tc : ToneCouple) : - AEMeasurable (fun a : ℝ≥0∞ × α ↦ (trunc f (tc.ton a.1)) a.2) - ((volume.restrict (Ioi 0)).prod (μ.restrict f.support)) := by -@@ -369,49 +372,54 @@ lemma AEMeasurable.trunc_ton {f : α → E₁} - exact (aemeasurable_indicator_iff₀ (indicator_ton_measurable (AEMeasurable.restrict hf) _)).mpr - hf.restrict.comp_snd.restrict - --@[measurability, fun_prop] -+@[fun_prop] - lemma AEMeasurable.truncCompl_ton {f : α → E₁} - [MeasurableSpace E₁] [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] -+ [SFinite (μ.restrict f.support)] - (hf : AEMeasurable f μ) (tc : ToneCouple) : - AEMeasurable (fun a : ℝ≥0∞ × α ↦ ((truncCompl f (tc.ton a.1))) a.2) - ((volume.restrict (Ioi 0)).prod (μ.restrict f.support )) := by - let A := {(s, x) : ℝ≥0∞ × α | tc.ton s < ‖f x‖ₑ} -- have : (fun z : ℝ≥0∞ × α ↦ (truncCompl f (tc.ton z.1)) z.2) = Set.indicator A (fun z : ℝ≥0∞ × α ↦ f z.2) := by -+ have : (fun z : ℝ≥0∞ × α ↦ (truncCompl f (tc.ton z.1)) z.2) = -+ Set.indicator A (fun z : ℝ≥0∞ × α ↦ f z.2) := by - ext z; rw [truncCompl_eq]; simp [A, indicator] - rw [this] - exact (aemeasurable_indicator_iff₀ (indicator_ton_measurable_lt hf.restrict _)).mpr - hf.restrict.comp_snd.restrict - - -- TODO: better name! --lemma restrict_to_support {p : ℝ} (hp : 0 < p) [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (f : α → E₁) : -+lemma restrict_to_support {p : ℝ} (hp : 0 < p) [TopologicalSpace E₁] -+ [ESeminormedAddCommMonoid E₁] (f : α → E₁) : - ∫⁻ x : α in f.support, ‖trunc f t x‖ₑ ^ p ∂ μ = ∫⁻ x : α, ‖trunc f t x‖ₑ ^ p ∂μ := by - apply setLIntegral_eq_of_support_subset - unfold Function.support trunc -- rw [setOf_subset_setOf] -+ rw [ofPred_subset_ofPred] - intro x - contrapose! - intro f_zero - simp_rw [f_zero]; simp [hp] - - -- TODO: better name! --lemma restrict_to_support_truncCompl {p : ℝ} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hp : 0 < p) (f : α → E₁) : -+lemma restrict_to_support_truncCompl {p : ℝ} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] -+ (hp : 0 < p) (f : α → E₁) : - ∫⁻ x : α in f.support, ‖(truncCompl f t) x‖ₑ ^ p ∂μ = - ∫⁻ x : α, ‖(truncCompl f t) x‖ₑ ^ p ∂μ := by - apply setLIntegral_eq_of_support_subset - unfold Function.support -- rw [truncCompl_eq, setOf_subset_setOf] -+ rw [truncCompl_eq, ofPred_subset_ofPred] - intro x - contrapose! - intro f_zero - simp [hp, f_zero] - - -- TODO: better name! --lemma restrict_to_support_trnc {p : ℝ} {j : Bool} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hp : 0 < p) (f : α → E₁) : -+lemma restrict_to_support_trnc {p : ℝ} {j : Bool} [TopologicalSpace E₁] -+ [ESeminormedAddCommMonoid E₁] (hp : 0 < p) (f : α → E₁) : - ∫⁻ x : α in f.support, ‖trnc j f t x‖ₑ ^ p ∂μ = - ∫⁻ x : α, ‖trnc j f t x‖ₑ ^ p ∂μ := by - apply setLIntegral_eq_of_support_subset - unfold Function.support trnc trunc truncCompl -- rw [setOf_subset_setOf] -+ rw [ofPred_subset_ofPred] - intro x - contrapose! - intro f_zero -@@ -420,7 +428,9 @@ lemma restrict_to_support_trnc {p : ℝ} {j : Bool} [TopologicalSpace E₁] [ESe - - @[fun_prop] - theorem AEMeasurable.trnc_restrict -- [MeasurableSpace E₁] [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] {j : Bool} -+ [MeasurableSpace E₁] [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] -+ {j : Bool} -+ [SFinite (μ.restrict f.support)] - (hf : AEMeasurable f μ) (tc : ToneCouple) : - AEMeasurable (fun a ↦ trnc j f (tc.ton a.1) a.2) - ((volume.restrict (Ioi 0)).prod (μ.restrict f.support)) := by -@@ -442,14 +452,15 @@ lemma lintegral_lintegral_pow_swap_truncCompl {q q₀ p₀ : ℝ} [MeasurableSpa - (∫⁻ a : α in f.support, - (∫⁻ (s : ℝ) in Ioi 0, - (ENNReal.ofReal (s ^ (q - q₀ - 1)) ^ (p₀⁻¹ * q₀)⁻¹ * -- ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀) ^ (p₀⁻¹ * q₀)) ^ (p₀⁻¹ * q₀)⁻¹ ∂μ) ^ (p₀⁻¹ * q₀) := by -+ ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀) ^ (p₀⁻¹ * q₀)) ^ -+ (p₀⁻¹ * q₀)⁻¹ ∂μ) ^ (p₀⁻¹ * q₀) := by - apply lintegral_lintegral_pow_swap_rpow - · apply le_of_mul_le_mul_left _ hp₀ - field_simp - exact hp₀q₀ - · unfold Function.uncurry - -- TODO: this is quite some effort, somehow the infrastructure may need to be better -- apply AEMeasurable.mul' -+ apply AEMeasurable.mul - · fun_prop - · have : (fun a ↦ ‖trnc j f (tc.ton (ENNReal.ofReal a.1)) a.2‖ₑ ^ p₀) = - (fun a ↦ ‖trnc j f (tc.ton a.1) a.2‖ₑ ^ p₀ ) ∘ -@@ -458,10 +469,13 @@ lemma lintegral_lintegral_pow_swap_truncCompl {q q₀ p₀ : ℝ} [MeasurableSpa - apply AEMeasurable.comp_aemeasurable - · rw [← Measure.map_prod_map] - · simp only [Measure.map_id'] -- have : Measure.map (fun a ↦ ENNReal.ofReal a) (volume.restrict (Ioi 0)) = volume.restrict (Ioi 0) := by -+ have : Measure.map (fun a ↦ ENNReal.ofReal a) (volume.restrict (Ioi 0)) = -+ volume.restrict (Ioi 0) := by - simp [map_restrict_Ioi_eq_restrict_Ioi] - rw [this] -- have : (fun a ↦ ‖trnc j f (tc.ton a.1) a.2‖ₑ ^ p₀) = (fun z : E₁ ↦ ‖ z ‖ₑ ^ p₀) ∘ (fun a : ℝ≥0∞ × α ↦ trnc j f (tc.ton a.1) a.2) := rfl -+ have : (fun a ↦ ‖trnc j f (tc.ton a.1) a.2‖ₑ ^ p₀) = -+ (fun z : E₁ ↦ ‖z‖ₑ ^ p₀) ∘ -+ (fun a : ℝ≥0∞ × α ↦ trnc j f (tc.ton a.1) a.2) := rfl - rw [this] - apply AEMeasurable.comp_aemeasurable - · fun_prop -@@ -478,13 +492,13 @@ lemma lintegral_congr_support {f : α → E₁} {g h : α → ENNReal} - rw [Measure.restrict_apply₀'] - · refine measure_mono_null (fun x h₀ ↦ ?_) measure_empty - have : g x = h x := hgh _ (mem_of_mem_inter_right h₀) -- have : x ∈ {a | ¬g a = h a} := mem_of_mem_diff h₀ -+ have : x ∈ {a | ¬g a = h a} := mem_of_mem_sdiff h₀ - change ¬ (g x = h x) at this - contradiction - · have : f.support = (fun x ↦ ‖f x‖ₑ).support := by - unfold Function.support - ext x -- simp only [ne_eq, mem_setOf_eq, enorm_eq_zero] -+ simp only [ne_eq, mem_ofPred_eq, enorm_eq_zero] - rw [this] - exact (aestronglyMeasurable_iff_aemeasurable.mpr hf.enorm).nullMeasurableSet_support - -@@ -504,24 +518,21 @@ lemma estimate_trnc {p₀ q₀ q : ℝ} {spf : ScaledPowerFunction} {j : Bool} - (∫⁻ (a : α) in f.support, - ‖f a‖ₑ ^ (p₀ + spf.σ⁻¹ * (q - q₀) * (p₀ / q₀)) ∂μ) ^ (p₀⁻¹ * q₀) := by - have := spf.hd -- unfold eLpNorm eLpNorm' -+ simp_rw [eLpNorm_eq_eLpNorm' (ofReal_pos.mpr hp₀).ne' coe_ne_top -+ (aestronglyMeasurable_trnc hf), eLpNorm', toReal_ofReal hp₀.le] - set tc := (spf_to_tc spf).toToneCouple -- split_ifs with is_p₀pos is_p₀top -- · have : p₀ ≤ 0 := ofReal_eq_zero.mp is_p₀pos -- contrapose! this; exact hp₀ -- · contrapose! is_p₀top; exact coe_ne_top -- · rw [toReal_ofReal hp₀.le] -- calc -+ calc - _ = ∫⁻ s : ℝ in Ioi 0, ENNReal.ofReal (s ^ (q - q₀ - 1)) * -- ((∫⁻ (a : α), ↑‖trnc j f ((spf_to_tc spf).ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ (1 / p₀)) ^ q₀ := by -+ ((∫⁻ (a : α), ↑‖trnc j f ((spf_to_tc spf).ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ -+ (1 / p₀)) ^ q₀ := by - congr 1 - ext x - rw [mul_comm] - _ = ∫⁻ (s : ℝ) in Ioi 0, - (ENNReal.ofReal (s ^ (q - q₀ - 1)) ^ (p₀⁻¹ * q₀)⁻¹) ^ (p₀⁻¹ * q₀) * -- (∫⁻ (a : α) in f.support, ↑‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ (p₀⁻¹ * q₀) := by -+ (∫⁻ (a : α) in f.support, ↑‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ -+ (p₀⁻¹ * q₀) := by - refine setLIntegral_congr_fun measurableSet_Ioi fun s hs ↦ ?_ -- dsimp - rw [ENNReal.rpow_inv_rpow] - · rw [one_div, ← ENNReal.rpow_mul, restrict_to_support_trnc hp₀] - · positivity -@@ -530,14 +541,14 @@ lemma estimate_trnc {p₀ q₀ q : ℝ} {spf : ScaledPowerFunction} {j : Bool} - ENNReal.ofReal (s ^ (q - q₀ - 1)) ^ (p₀⁻¹ * q₀)⁻¹ * - ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ (p₀⁻¹ * q₀) := by - refine setLIntegral_congr_fun measurableSet_Ioi fun s hs ↦ ?_ -- dsimp - rw [lintegral_const_mul', ENNReal.mul_rpow_of_nonneg] - · positivity - · exact (ENNReal.rpow_lt_top_of_nonneg (by positivity) coe_ne_top).ne - _ ≤ (∫⁻ a : α in f.support, - (∫⁻ (s : ℝ) in Ioi 0, - (ENNReal.ofReal (s ^ (q - q₀ - 1)) ^ (p₀⁻¹ * q₀)⁻¹ * -- ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀) ^ (p₀⁻¹ * q₀)) ^ (p₀⁻¹ * q₀)⁻¹ ∂μ) ^ (p₀⁻¹ * q₀) := by -+ ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀) ^ (p₀⁻¹ * q₀)) ^ -+ (p₀⁻¹ * q₀)⁻¹ ∂μ) ^ (p₀⁻¹ * q₀) := by - -- This is a consequence of Minkowski's integral inequality - apply lintegral_lintegral_pow_swap_truncCompl hp₀ hp₀q₀ hf tc; assumption - _ = (∫⁻ a : α in f.support, -@@ -549,7 +560,6 @@ lemma estimate_trnc {p₀ q₀ q : ℝ} {spf : ScaledPowerFunction} {j : Bool} - intro x _ - congr 1 - refine setLIntegral_congr_fun measurableSet_Ioi fun s hs ↦ ?_ -- dsimp - rw [ENNReal.mul_rpow_of_nonneg, ENNReal.rpow_inv_rpow, ← ENNReal.rpow_mul] <;> try positivity - congr - field_simp -@@ -636,7 +646,8 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} - (hf : AEStronglyMeasurable f μ) (hf₂ : SigmaFinite (μ.restrict f.support)) - (hspf : spf.σ = ζ p₀ q₀ p₁ q₁ t.toReal) : - ∫⁻ s : ℝ in Ioi 0, -- eLpNorm (trnc j f ((spf_to_tc spf).ton (ENNReal.ofReal s))) (sel j p₀ p₁) μ ^ (sel j q₀ q₁).toReal * -+ eLpNorm (trnc j f ((spf_to_tc spf).ton (ENNReal.ofReal s))) (sel j p₀ p₁) μ ^ -+ (sel j q₀ q₁).toReal * - ENNReal.ofReal (s ^ (q.toReal - (sel j q₀ q₁).toReal - 1)) ≤ - (spf.d ^ (q.toReal - (sel j q₀ q₁).toReal)) * - ENNReal.ofReal |q.toReal - (sel j q₀ q₁).toReal|⁻¹ * -@@ -670,7 +681,8 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} - ‖f a‖ₑ ^ ((sel j p₀ p₁).toReal + spf.σ⁻¹ * (q.toReal - (sel j q₀ q₁).toReal) * - ((sel j p₀ p₁).toReal / (sel j q₀ q₁).toReal)) ∂μ) ^ - ((sel j p₀ p₁).toReal ⁻¹ * (sel j q₀ q₁).toReal) := by -- have coe_p' : ENNReal.ofReal (sel j p₀ p₁).toReal = (sel j p₀ p₁) := ofReal_toReal_eq_iff.mpr hp' -+ have coe_p' : ENNReal.ofReal (sel j p₀ p₁).toReal = (sel j p₀ p₁) := -+ ofReal_toReal_eq_iff.mpr hp' - nth_rw 1 [← coe_p'] - apply estimate_trnc - · apply toReal_pos -@@ -690,7 +702,7 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} - cases j - · unfold sel - dsimp only -- simp only [hspf, Bool.if_false_right, Bool.and_true, Bool.false_bne, decide_eq_true_eq] -+ simp only [hspf, Bool.ite_false_right, Bool.and_true, Bool.false_bne, decide_eq_true_eq] - split_ifs with is_ζ_pos - · apply toReal_strict_mono - · exact interp_exp_ne_top hq₀q₁ ht hq -@@ -700,7 +712,7 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} - (le_of_not_gt is_ζ_pos) - · unfold sel - dsimp only -- simp only [hspf, Bool.if_false_right, Bool.and_true, Bool.true_bne, Bool.not_eq_true', -+ simp only [hspf, Bool.ite_false_right, Bool.and_true, Bool.true_bne, Bool.not_eq_true', - decide_eq_false_iff_not] - split_ifs with is_ζ_pos - · apply toReal_strict_mono hq' -@@ -737,7 +749,7 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} - ((sel j p₀ p₁).toReal ⁻¹ * (sel j q₀ q₁).toReal) := by - congr - rw [← one_div] -- refine (eLpNorm_eq_lintegral_rpow_enorm_toReal (ε := E₁) ?_ ?_).symm -+ refine (eLpNorm_eq_lintegral_rpow_enorm_toReal (ε := E₁) ?_ ?_ hf).symm - · exact (interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp).ne' - · exact interp_exp_ne_top hp₀p₁.ne ht hp - -@@ -774,20 +786,27 @@ lemma wnorm_eq_zero_iff [ENormedAddMonoid ε] {f : α → ε} {p : ℝ≥0∞} ( - exact iSup_wnorm b.toNNReal - exact meas_ne_zero this - · refine iSup_eq_zero.mpr fun t ↦ mul_eq_zero.mpr -- (Or.inr ((rpow_eq_zero_iff_of_pos (inv_pos_of_pos (toReal_pos hp h₀))).mpr (nonpos_iff_eq_zero.mp ?_))) -+ (Or.inr ((rpow_eq_zero_iff_of_pos (inv_pos_of_pos (toReal_pos hp h₀))).mpr -+ (nonpos_iff_eq_zero.mp ?_))) - calc -- _ ≤ distribution f 0 μ := by gcongr; exact zero_le _ -+ _ ≤ distribution f 0 μ := by gcongr; exact zero_le - _ = distribution f (eLpNormEssSup f μ) μ := by congr; exact h.symm - _ = 0 := distribution_snormEssSup - - - /-! ## Weaktype estimates applied to truncations -/ - --variable [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [TopologicalSpace E₂] [ESeminormedAddCommMonoid E₂] -- {E₁' E₂' : Type*} [TopologicalSpace E₁'] [ENormedAddCommMonoid E₁'] [TopologicalSpace E₂'] [ENormedAddCommMonoid E₂'] -+variable [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] -+ [TopologicalSpace E₂] [ESeminormedAddCommMonoid E₂] -+ {E₁' E₂' : Type*} [TopologicalSpace E₁'] [ENormedAddCommMonoid E₁'] -+ [TopologicalSpace E₂'] [ENormedAddCommMonoid E₂'] - - lemma eLpNorm_trnc_est {f : α → E₁} {j : Bool} : -- eLpNorm (trnc j f t) p μ ≤ eLpNorm f p μ := eLpNorm_mono_enorm fun _x ↦ trnc_le_func -+ eLpNorm (trnc j f t) p μ ≤ eLpNorm f p μ := by -+ by_cases hf : AEStronglyMeasurable f μ -+ · exact eLpNorm_mono_enorm (aestronglyMeasurable_trnc hf) fun _x ↦ trnc_le_func -+ · rw [eLpNorm_of_not_aestronglyMeasurable hf] -+ exact le_top - - variable [ContinuousENorm ε₁] [ContinuousENorm ε₂] {T : (α → ε₁) → (α' → ε₂)} in - lemma weaktype_estimate {C₀ : ℝ≥0} {p : ℝ≥0∞} {q : ℝ≥0∞} {f : α → ε₁} -@@ -826,15 +845,18 @@ variable [ENormedAddMonoid ε₁] [ENormedAddMonoid ε₂] in - lemma weaktype_aux₀ {f : α → ε₁} {T : (α → ε₁) → (α' → ε₂)} - {p₀ q₀ p q : ℝ≥0∞} (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp : 0 < p) (hq : 0 < q) - {C₀ : ℝ≥0} (h₀T : HasWeakType T p₀ q₀ μ ν C₀) -- (hf : AEStronglyMeasurable f μ) (hF : eLpNorm f p μ = 0) : eLpNorm (T f) q ν = 0 := by -- have f_ae_0 : f =ᵐ[μ] 0 := (eLpNorm_eq_zero_iff hf hp.ne').mp hF -- have hf₂ : eLpNorm f p₀ μ = 0 := (eLpNorm_eq_zero_iff hf hp₀.ne').mpr f_ae_0 -- have hf₁ : MemLp f p₀ μ := ⟨hf, by rw [hf₂]; exact zero_lt_top⟩ -+ (_hf : AEStronglyMeasurable f μ) (hF : eLpNorm f p μ = 0) : eLpNorm (T f) q ν = 0 := by -+ have f_ae_0 : f =ᵐ[μ] 0 := (eLpNorm_eq_zero_iff hp.ne').mp hF -+ have hf₂ : eLpNorm f p₀ μ = 0 := (eLpNorm_eq_zero_iff hp₀.ne').mpr f_ae_0 -+ have hf₁ : MemLp f p₀ μ := by -+ change eLpNorm f p₀ μ < ∞ -+ rw [hf₂] -+ exact zero_lt_top - have := (h₀T f hf₁).2 - rw [hf₂, mul_zero] at this - have wnorm_0 : wnorm (T f) q₀ ν = 0 := nonpos_iff_eq_zero.mp this - have : (T f) =ᵐ[ν] 0 := (wnorm_eq_zero_iff hq₀.ne').mp wnorm_0 -- exact (eLpNorm_eq_zero_iff (h₀T _ hf₁).1 hq.ne').mpr this -+ exact (eLpNorm_eq_zero_iff hq.ne').mpr this - - -- for the remaining lemmas we use too much measure theory that is just for normed spaces - -- try to generalize to ENorm-classes after Mathlib refactor -@@ -867,7 +889,8 @@ lemma weaktype_estimate_trunc_top_top {a : ℝ≥0∞} {C₁ : ℝ≥0} - rw [ha] - have obs : MemLp (trunc f (t / C₁)) p₁ μ := trunc_Lp_Lq_higher ⟨hp, hp₁p⟩ hf (by finiteness) - have wt_est := (h₁T (trunc f (t / C₁)) obs).2 -- simp only [wnorm, eLpNorm, hq₁, ↓reduceIte, hp₁, top_ne_zero] at wt_est -+ simp only [wnorm, hq₁, ↓reduceIte, hp₁, -+ eLpNorm_exponent_top obs.aestronglyMeasurable] at wt_est - apply nonpos_iff_eq_zero.mp - have ineq : eLpNormEssSup (T' (trunc f (t / C₁))) ν ≤ t := calc - _ ≤ C₁ * eLpNormEssSup (trunc f (t / C₁)) μ := wt_est -@@ -875,7 +898,7 @@ lemma weaktype_estimate_trunc_top_top {a : ℝ≥0∞} {C₁ : ℝ≥0} - gcongr - exact trunc_eLpNormEssSup_le _ - _ ≤ _ := by -- rw [max_eq_right (zero_le _), -+ rw [max_eq_right zero_le, - ENNReal.mul_div_cancel (ENNReal.coe_ne_zero.mpr hC₁.ne') (by finiteness)] - calc - _ ≤ distribution (T' (trunc f (t / C₁))) (eLpNormEssSup (T' (trunc f (t / C₁))) ν) ν := -@@ -893,15 +916,16 @@ lemma weaktype_estimate_truncCompl_top {C₀ : ℝ≥0} (hC₀ : 0 < C₀) {p p - rcases (eq_zero_or_pos (eLpNormEssSup f μ)) with snorm_zero | snorm_pos - · have : eLpNorm (trnc ⊥ f a) ⊤ μ = 0 := by - apply nonpos_iff_eq_zero.mp -- rw [← snorm_zero] -+ rw [← snorm_zero, ← eLpNorm_exponent_top hf.aestronglyMeasurable] - exact eLpNorm_trnc_est (p := ⊤) - have obs : eLpNorm (T' (trnc ⊥ f a)) ⊤ ν = 0 := -- weaktype_aux₀ hp₀ (hq₀ ▸ zero_lt_top) zero_lt_top zero_lt_top h₀T hf.1.truncCompl this -- exact nonpos_iff_eq_zero.mp (Trans.trans (distribution_mono_right (Trans.trans obs -- (zero_le t))) meas_eLpNormEssSup_lt) -+ weaktype_aux₀ hp₀ (hq₀ ▸ zero_lt_top) zero_lt_top zero_lt_top h₀T -+ hf.aestronglyMeasurable.truncCompl this -+ exact nonpos_iff_eq_zero.mp ((distribution_mono_right -+ (eLpNormEssSup_le_eLpNorm_top.trans (obs ▸ zero_le))).trans meas_eLpNormEssSup_lt.le) - · have p_pos : 0 < p := hp₀.trans hp₀p - have snorm_p_pos : eLpNorm f p μ ≠ 0 := fun snorm_0 ↦ snorm_pos.ne' <| -- eLpNormEssSup_eq_zero_iff.mpr <| (eLpNorm_eq_zero_iff hf.1 p_pos.ne').mp snorm_0 -+ eLpNormEssSup_eq_zero_iff.mpr <| (eLpNorm_eq_zero_iff p_pos.ne').mp snorm_0 - have term_pos : (ENNReal.ofNNReal C₀) ^ p₀.toReal * eLpNorm f p μ ^ p.toReal > 0 := by - apply ENNReal.mul_pos <;> exact (rpow_pos_of_nonneg (by positivity) (by positivity)).ne' - have d_pos : 0 < d := hdeq ▸ ENNReal.rpow_pos term_pos (by finiteness) -@@ -919,7 +943,7 @@ lemma weaktype_estimate_truncCompl_top {C₀ : ℝ≥0} (hC₀ : 0 < C₀) {p p - eLpNorm f p μ ^ p.toReal) := by - rw [ENNReal.mul_rpow_of_nonneg _ _ toReal_nonneg] - gcongr -- exact estimate_eLpNorm_truncCompl hp ⟨hp₀, hp₀p.le⟩ hf.1 a_pos -+ exact estimate_eLpNorm_truncCompl hp ⟨hp₀, hp₀p.le⟩ hf.aestronglyMeasurable a_pos - _ = (↑C₀) ^ p₀.toReal * eLpNorm f p μ ^ p.toReal * (d ^ p₀.toReal)⁻¹ * (t ^ p₀.toReal) := by - rw [ha, ← ENNReal.rpow_mul, div_mul_cancel₀] - · -- FIXME: can/should this be shared with the lemma below? -@@ -968,7 +992,7 @@ lemma weaktype_estimate_trunc_top {C₁ : ℝ≥0} (hC₁ : 0 < C₁) {p p₁ q - calc - _ ≤ (ENNReal.ofNNReal C₁) * eLpNorm f p₁ μ := by - gcongr -- apply eLpNorm_mono_enorm (fun x ↦ trunc_le_func) -+ exact eLpNorm_mono_enorm obs.aestronglyMeasurable (fun _x ↦ trunc_le_func) - _ ≤ _ := by - have : eLpNorm f p₁ μ = 0 := Trans.trans (eLpNorm_congr_ae - (eLpNormEssSup_eq_zero_iff.mp snorm_zero)) eLpNorm_zero -@@ -977,7 +1001,7 @@ lemma weaktype_estimate_trunc_top {C₁ : ℝ≥0} (hC₁ : 0 < C₁) {p p₁ q - intro snorm_0 - apply snorm_pos.ne' - apply eLpNormEssSup_eq_zero_iff.mpr -- exact (eLpNorm_eq_zero_iff hf.1 hp.ne').mp snorm_0 -+ exact (eLpNorm_eq_zero_iff hp.ne').mp snorm_0 - -- XXX: these lines are the same as in the lemma above - have term_pos : (ENNReal.ofNNReal C₁) ^ p₁.toReal * eLpNorm f p μ ^ p.toReal > 0 := by - apply ENNReal.mul_pos <;> exact (rpow_pos_of_nonneg (by positivity) (by positivity)).ne' -@@ -985,7 +1009,7 @@ lemma weaktype_estimate_trunc_top {C₁ : ℝ≥0} (hC₁ : 0 < C₁) {p p₁ q - _ ≤ ↑C₁ ^ p₁.toReal * (((a ^ (p₁.toReal - p.toReal))) * eLpNorm f p μ ^ p.toReal) := by - rw [ENNReal.mul_rpow_of_nonneg _ _ (by positivity)] - gcongr -- exact estimate_eLpNorm_trunc hp₁.ne_top ⟨hp, hp₁p.le⟩ hf.1 -+ exact estimate_eLpNorm_trunc hp₁.ne_top ⟨hp, hp₁p.le⟩ hf.aestronglyMeasurable - _ = ↑C₁ ^ p₁.toReal * eLpNorm f p μ ^ p.toReal * (d ^ p₁.toReal)⁻¹ * (t ^ p₁.toReal) := by - rw [ha, ← ENNReal.rpow_mul, div_mul_cancel₀] - · rw [ENNReal.div_rpow_of_nonneg, div_eq_mul_inv] <;> try positivity -@@ -994,7 +1018,8 @@ lemma weaktype_estimate_trunc_top {C₁ : ℝ≥0} (hC₁ : 0 < C₁) {p p₁ q - _ = _ := by - nth_rw 2 [← one_mul (t ^ p₁.toReal)] - congr -- rw [hdeq, ENNReal.rpow_inv_rpow hp₁' _, ENNReal.mul_inv_cancel term_pos.ne' (by finiteness)] -+ rw [hdeq, ENNReal.rpow_inv_rpow hp₁' _, -+ ENNReal.mul_inv_cancel term_pos.ne' (by finiteness)] - apply nonpos_iff_eq_zero.mp - calc - _ ≤ distribution (T' (trunc f a)) (eLpNormEssSup (T' (trunc f a)) ν) ν := by gcongr -diff --git a/Carleson/ToMathlib/RealInterpolation/Misc.lean b/Carleson/ToMathlib/RealInterpolation/Misc.lean -index d72de05..d2ea11e 100644 ---- a/Carleson/ToMathlib/RealInterpolation/Misc.lean -+++ b/Carleson/ToMathlib/RealInterpolation/Misc.lean -@@ -90,7 +90,6 @@ def spf_to_tc (spf : ScaledPowerFunction) : StrictRangeToneCouple where - intro s t hst - beta_reduce - gcongr -- exact this - · simp only [Bool.false_eq_true, ↓reduceIte] - intro s t hst - rcases spf.hσ with σ_pos | σ_neg -@@ -196,7 +195,8 @@ lemma d_ne_top_aux₃ {C : ℝ≥0} {b c : ℝ} (hC : 0 < C) - C ^ c * (eLpNorm f p μ ^ p.toReal) ^ b ≠ ⊤ := - mul_ne_top (d_ne_top_aux₁ hC) (d_ne_top_aux₂ hF) - --lemma d_ne_zero_aux₃ {b₀ c₀ b₁ c₁ : ℝ} (hC₀ : 0 < C₀) (hC₁ : 0 < C₁) (hF : eLpNorm f p μ ∈ Ioo 0 ⊤) : -+lemma d_ne_zero_aux₃ {b₀ c₀ b₁ c₁ : ℝ} (hC₀ : 0 < C₀) (hC₁ : 0 < C₁) -+ (hF : eLpNorm f p μ ∈ Ioo 0 ⊤) : - (C₀ ^ c₀ * (eLpNorm f p μ ^ p.toReal) ^ b₀) / - (C₁ ^ c₁ * (eLpNorm f p μ ^ p.toReal) ^ b₁) ≠ 0 := by - refine ENNReal.div_ne_zero.mpr ⟨?_, ?_⟩ -@@ -312,7 +312,7 @@ lemma lintegral_double_restrict_set {A B : Set α} {f : α → ℝ≥0∞} (hA : - (hB : MeasurableSet B) (hf : ∀ᵐ (x : α) ∂μ, x ∈ A \ B → f x ≤ 0) : - ∫⁻ x in A, f x ∂μ = ∫⁻ x in A ∩ B, f x ∂μ := by - have h₀ := setLIntegral_mono_ae' (MeasurableSet.diff hA hB) hf; rw [lintegral_zero] at h₀ -- rw [← lintegral_inter_add_diff (hB := hB), nonpos_iff_eq_zero.mp h₀, add_zero] -+ rw [← lintegral_inter_add_sdiff (hB := hB), nonpos_iff_eq_zero.mp h₀, add_zero] - - -- local convenience function - lemma lintegral_rw_aux {g : ℝ → ℝ≥0∞} {f₁ f₂ : ℝ → ℝ≥0∞} {A : Set ℝ} -@@ -336,10 +336,10 @@ lemma power_aux_2 {p q : ℝ} : - lemma power_aux_3 {p q : ℝ} : - (fun s : ℝ≥0∞ ↦ s ^ (p + q)) =ᶠ[ae volume] (fun s ↦ s ^ p * s ^ q ) := by - filter_upwards [Ioo_zero_top_ae_eq_univ] with a ha -- unfold Ioo at ha -+ have ha' : a ∈ Ioo 0 ∞ := ha.mpr (mem_univ a) - refine ENNReal.rpow_add p q ?_ ?_ -- · simp [pos_iff_ne_zero] at ha; by_contra; have := (ha.mpr trivial).1; tauto -- · simp [lt_top_iff_ne_top] at ha; by_contra; have := (ha.mpr trivial).2; tauto -+ · exact ha'.1.ne' -+ · exact ha'.2.ne - - lemma power_aux_4 {p : ℝ} : - (fun s ↦ ENNReal.ofReal (s ^ p)) =ᶠ[ae (volume.restrict (Ioi (0 : ℝ)))] -@@ -402,7 +402,9 @@ namespace MeasureTheory - def trunc (f : α → ε) (t : ℝ≥0∞) (x : α) : ε := if ‖f x‖ₑ ≤ t then f x else 0 - - lemma trunc_eq_indicator : trunc f t = {x | ‖f x‖ₑ ≤ t}.indicator f := by -- ext x; simp_rw [trunc, Set.indicator, mem_setOf_eq, ite_eq_ite] -+ funext x -+ simp only [trunc, Set.indicator, mem_ofPred_eq] -+ split_ifs <;> rfl - - @[simp] - lemma trunc_top : trunc f ∞ = f := by simp [trunc_eq_indicator] -@@ -412,7 +414,7 @@ def truncCompl (f : α → ε) (t : ℝ≥0∞) (x : α) : ε := if ‖f x‖ₑ - - lemma truncCompl_eq_indicator : truncCompl f t = {x | ‖f x‖ₑ ≤ t}ᶜ.indicator f := by - ext x -- simp only [truncCompl, Set.indicator, mem_compl_iff, mem_setOf_eq, ite_not] -+ simp only [truncCompl, Set.indicator, mem_compl_iff, mem_ofPred_eq, ite_not] - - @[simp] - lemma truncCompl_top : truncCompl f ∞ = (fun _ ↦ 0) := by simp [truncCompl_eq_indicator] -@@ -462,7 +464,6 @@ function itself. -/ - lemma truncCompl_of_nonpos {f : α → ε'} (ht : t ≤ 0) : truncCompl f t = f := by - rw [truncCompl_eq] - ext x -- dsimp only [Pi.zero_apply] - split_ifs - · rfl - · apply (enorm_eq_zero.mp ?_).symm -@@ -485,17 +486,18 @@ lemma truncCompl_of_nonpos {f : α → ε'} (ht : t ≤ 0) : truncCompl f t = f - -- apply Measurable.ite ?_ hf measurable_const - -- exact measurableSet_lt measurable_const hf.norm - --@[measurability] -+@[fun_prop] - protected lemma StronglyMeasurable.trunc (hf : StronglyMeasurable f) : - StronglyMeasurable (trunc f t) := - StronglyMeasurable.ite (measurableSet_le hf.enorm.stronglyMeasurable stronglyMeasurable_const) hf - stronglyMeasurable_const - --@[measurability] -+@[fun_prop] - protected lemma StronglyMeasurable.truncCompl (hf : StronglyMeasurable f) : - StronglyMeasurable (truncCompl f t) := by - rw [truncCompl_eq] -- exact hf.ite (measurableSet_lt stronglyMeasurable_const hf.enorm.stronglyMeasurable) stronglyMeasurable_const -+ exact hf.ite (measurableSet_lt stronglyMeasurable_const hf.enorm.stronglyMeasurable) -+ stronglyMeasurable_const - - -- @[measurability, fun_prop] - -- lemma AEMeasurable.trunc [MeasurableSpace E₁] [NormedAddCommGroup E₁] [BorelSpace E₁] -@@ -528,7 +530,7 @@ protected lemma StronglyMeasurable.truncCompl (hf : StronglyMeasurable f) : - -- simp only [mem_compl_iff, mem_setOf_eq, not_not] - -- intro f_eq_g; unfold truncCompl; unfold trunc; dsimp only [Pi.sub_apply]; rw [f_eq_g] - --@[measurability] -+@[fun_prop] - nonrec lemma AEStronglyMeasurable.trunc (hf : AEStronglyMeasurable f μ) : - AEStronglyMeasurable (trunc f t) μ := by - rcases hf with ⟨g, ⟨wg1, wg2⟩⟩ -@@ -538,7 +540,7 @@ nonrec lemma AEStronglyMeasurable.trunc (hf : AEStronglyMeasurable f μ) : - exact wg1.indicator (s := {x | ‖g x‖ₑ ≤ t}) (measurableSet_le wg1.enorm (by fun_prop)) - · exact measure_mono_null (fun x ↦ by contrapose!; simp_all [trunc]) wg2 - --@[measurability] -+@[fun_prop] - nonrec lemma AEStronglyMeasurable.truncCompl - (hf : AEStronglyMeasurable f μ) : AEStronglyMeasurable (truncCompl f t) μ := by - rcases hf with ⟨g, ⟨wg1, wg2⟩⟩ -@@ -551,7 +553,7 @@ nonrec lemma AEStronglyMeasurable.truncCompl - · exact measure_mono_null (fun x ↦ by contrapose!; simp_all [truncCompl]) wg2 - - --@[measurability] -+@[fun_prop] - lemma aestronglyMeasurable_trnc {j : Bool} (hf : AEStronglyMeasurable f μ) : - AEStronglyMeasurable (trnc j f t) μ := - j.rec (.truncCompl hf) (.trunc hf) -@@ -571,7 +573,8 @@ lemma trunc_eLpNormEssSup_le {f : α → ε} (a : ℝ≥0∞) : - eLpNormEssSup (trunc f a) μ ≤ (max 0 a) := - essSup_le_of_ae_le _ (ae_of_all _ fun x ↦ trunc_le x) - --lemma trunc_mono {f : α → ε} {a b : ℝ≥0∞} (hab : a ≤ b) {x : α} : ‖trunc f a x‖ₑ ≤ ‖trunc f b x‖ₑ := by -+lemma trunc_mono {f : α → ε} {a b : ℝ≥0∞} (hab : a ≤ b) {x : α} : -+ ‖trunc f a x‖ₑ ≤ ‖trunc f b x‖ₑ := by - unfold trunc - split_ifs - · rfl -@@ -579,10 +582,28 @@ lemma trunc_mono {f : α → ε} {a b : ℝ≥0∞} (hab : a ≤ b) {x : α} : - · rw [enorm_zero]; positivity - · exact le_rfl - -+lemma eLpNormFormula_trunc_mono : -+ Monotone fun s ↦ eLpNormFormula (trunc f s) p μ := by -+ intro lower upper hle -+ unfold eLpNormFormula -+ split_ifs -+ · exact le_rfl -+ · exact eLpNormEssSup_mono_enorm_ae (ae_of_all _ fun _ ↦ trunc_mono hle) -+ · exact eLpNorm'_mono_enorm_ae toReal_nonneg (ae_of_all _ fun _ ↦ trunc_mono hle) -+ - /-- The norm of the truncation is monotone in the truncation parameter -/ - lemma eLpNorm_trunc_mono : -- Monotone fun s ↦ eLpNorm (trunc f s) p μ := -- fun _a _b hab ↦ eLpNorm_mono_enorm fun _x ↦ trunc_mono hab -+ Monotone fun s ↦ eLpNorm (trunc f s) p μ := by -+ intro lower upper hle -+ by_cases hupper : AEStronglyMeasurable (trunc f upper) μ -+ · have heq : trunc (trunc f upper) lower = trunc f lower := by -+ ext point -+ by_cases hpoint : ‖f point‖ₑ ≤ upper -+ · simp [trunc, hpoint] -+ · have hlower : ¬‖f point‖ₑ ≤ lower := fun hbound ↦ hpoint (hbound.trans hle) -+ simp [trunc, hpoint, hlower] -+ exact eLpNorm_mono_enorm (heq ▸ hupper.trunc) fun _ ↦ trunc_mono hle -+ · simp [eLpNorm, hupper] - - lemma trunc_buildup_enorm {x : α} : - ‖trunc f t x‖ₑ + ‖truncCompl f t x‖ₑ = ‖f x‖ₑ := by -@@ -613,22 +634,22 @@ lemma eLpNorm_truncCompl_anti (hf : eLpNorm f 1 μ ≠ ⊤) (mf : AEStronglyMeas - Antitone (fun s ↦ eLpNorm (truncCompl f s) p μ) := by - intro a _b hab - have : ∀ᵐ x ∂μ, ‖f x‖ₑ ≠ ⊤ := by -- rw [eLpNorm_one_eq_lintegral_enorm] at hf -+ rw [eLpNorm_one_eq_lintegral_enorm mf] at hf - simp_rw [ae_iff, not_ne_iff]; exact measure_eq_top_of_lintegral_ne_top mf.enorm hf - have : ∀ᵐ x ∂μ, ‖trunc f a x‖ₑ ≠ ⊤ := by - refine this.mono fun x hx ↦ ?_ - rw [trunc] - split_ifs; exacts [hx, by simp] -- exact eLpNorm_mono_enorm_ae <| this.mono fun x hx ↦ truncCompl_anti hab hx -+ exact eLpNorm_mono_enorm_ae mf.truncCompl <| this.mono fun x hx ↦ truncCompl_anti hab hx - - /-- The norm of the truncation is meaurable in the truncation parameter -/ --@[measurability, fun_prop] -+@[fun_prop] - lemma eLpNorm_trunc_measurable : - Measurable (fun s ↦ eLpNorm (trunc f s) p μ) := - eLpNorm_trunc_mono.measurable - - /-- The norm of the complement of the truncation is measurable in the truncation parameter -/ --@[measurability, fun_prop] -+@[fun_prop] - lemma eLpNorm_truncCompl_measurable (hf : eLpNorm f 1 μ ≠ ⊤) (mf : AEStronglyMeasurable f μ) : - Measurable (fun s ↦ eLpNorm (truncCompl f s) p μ) := - eLpNorm_truncCompl_anti hf mf |>.measurable -@@ -655,10 +676,7 @@ lemma trnc_le_func {j : Bool} {a : ℝ≥0∞} {x : α} : - /-! ## Truncations and L-p spaces -/ - - lemma MemLp.trunc {p : ℝ≥0∞} (hf : MemLp f p μ) : MemLp (trunc f t) p μ := by -- refine ⟨hf.1.trunc, lt_of_le_of_lt (eLpNorm_mono_ae' (ae_of_all _ ?_)) hf.2⟩ -- intro x -- unfold MeasureTheory.trunc -- split_ifs with is_fx_le_a <;> simp -+ exact (eLpNorm_mono_enorm hf.aestronglyMeasurable.trunc fun _ ↦ trunc_le_func).trans_lt hf - - -- lemma eLpNorm_truncCompl_le {p : ℝ≥0∞} : - -- eLpNorm (truncCompl f t) p μ ≤ eLpNorm f p μ := -@@ -666,26 +684,24 @@ lemma MemLp.trunc {p : ℝ≥0∞} (hf : MemLp f p μ) : MemLp (trunc f t) p μ - - lemma MemLp.truncCompl {p : ℝ≥0∞} (hf : MemLp f p μ) : - MemLp (truncCompl f t) p μ := by -- refine ⟨hf.1.truncCompl, lt_of_le_of_lt (eLpNorm_mono_ae' (ae_of_all _ ?_)) hf.2⟩ -- intro x -- unfold MeasureTheory.truncCompl -- split_ifs with is_fx_le_a <;> simp -+ exact (eLpNorm_mono_enorm hf.aestronglyMeasurable.truncCompl -+ fun _ ↦ truncCompl_le_func).trans_lt hf - --lemma eLpNorm_truncCompl_le {q : ℝ≥0∞} -+lemma eLpNormFormula_truncCompl_le {q : ℝ≥0∞} - (q_ne_zero : ¬ q = 0) (q_ne_top : q ≠ ⊤) : -- eLpNorm (truncCompl f t) q μ ^ q.toReal ≤ -+ eLpNormFormula (truncCompl f t) q μ ^ q.toReal ≤ - ∫⁻ x : α in {x | t < ‖f x‖ₑ}, ‖f x‖ₑ ^ q.toReal ∂μ := by -- unfold eLpNorm eLpNorm' -+ simp only [eLpNormFormula, q_ne_zero, q_ne_top, ↓reduceIte, eLpNorm'] - have q_toReal_pos : 0 < q.toReal := toReal_pos q_ne_zero q_ne_top -- split_ifs - calc - _ = ∫⁻ x : α in {x | t < ‖f x‖ₑ}, ‖(truncCompl f t) x‖ₑ ^ q.toReal ∂μ := by - rw [one_div, ENNReal.rpow_inv_rpow] - · apply (setLIntegral_eq_of_support_subset _).symm - unfold Function.support - intro x -- rw [truncCompl_eq, mem_setOf_eq] -- dsimp only [Pi.sub_apply] -+ change ‖truncCompl f t x‖ₑ ^ q.toReal ≠ 0 → t < ‖f x‖ₑ -+ rw [truncCompl_eq] -+ dsimp only - split_ifs with is_a_lt_fx - · exact fun _ ↦ is_a_lt_fx - · contrapose; intro _; simpa [enorm_eq_nnnorm] -@@ -694,6 +710,13 @@ lemma eLpNorm_truncCompl_le {q : ℝ≥0∞} - gcongr with x - exact trnc_le_func (j := ⊥) - -+lemma eLpNorm_truncCompl_le {q : ℝ≥0∞} -+ (q_ne_zero : q ≠ 0) (q_ne_top : q ≠ ⊤) (hf : AEStronglyMeasurable f μ) : -+ eLpNorm (truncCompl f t) q μ ^ q.toReal ≤ -+ ∫⁻ x : α in {x | t < ‖f x‖ₑ}, ‖f x‖ₑ ^ q.toReal ∂μ := by -+ rw [eLpNorm_eq_eLpNormFormula hf.truncCompl] -+ exact eLpNormFormula_truncCompl_le q_ne_zero q_ne_top -+ - -- TODO: better name! - lemma estimate_eLpNorm_truncCompl {p q : ℝ≥0∞} - (p_ne_top : p ≠ ⊤) (hpq : q ∈ Ioc 0 p) (hf : AEStronglyMeasurable f μ) (ht : 0 < t) : -@@ -701,7 +724,7 @@ lemma estimate_eLpNorm_truncCompl {p q : ℝ≥0∞} - (t ^ (q.toReal - p.toReal)) * eLpNorm f p μ ^ p.toReal := by - have q_ne_top: q ≠ ⊤ := ne_top_of_le_ne_top p_ne_top hpq.2 - have p_ne_zero : p ≠ 0 := (hpq.1.trans_le hpq.2).ne' -- apply le_trans (eLpNorm_truncCompl_le hpq.1.ne' (ne_top_of_le_ne_top p_ne_top hpq.2)) -+ apply le_trans (eLpNorm_truncCompl_le hpq.1.ne' (ne_top_of_le_ne_top p_ne_top hpq.2) hf) - calc - _ ≤ (t ^ (q.toReal - p.toReal)) * ∫⁻ x : α in {x | t < ‖f x‖ₑ}, - ‖f x‖ₑ ^ p.toReal ∂μ := by -@@ -709,7 +732,8 @@ lemma estimate_eLpNorm_truncCompl {p q : ℝ≥0∞} - · apply setLIntegral_mono_ae (AEMeasurable.restrict (by fun_prop)) - filter_upwards with x hx - rw [mul_comm] -- exact rpow_le_rpow_of_exponent_le_base_ge_enorm ht hx.ne_top hx.le (toReal_mono p_ne_top hpq.2) -+ exact rpow_le_rpow_of_exponent_le_base_ge_enorm ht hx.ne_top hx.le -+ (toReal_mono p_ne_top hpq.2) - · by_cases ht' : t = ⊤ - · simp_all - · finiteness -@@ -718,7 +742,8 @@ lemma estimate_eLpNorm_truncCompl {p q : ℝ≥0∞} - exact Measure.restrict_le_self - _ = _ := by - congr -- rw [eLpNorm_eq_lintegral_rpow_enorm_toReal p_ne_zero p_ne_top, one_div, ENNReal.rpow_inv_rpow] -+ rw [eLpNorm_eq_lintegral_rpow_enorm_toReal p_ne_zero p_ne_top hf, one_div, -+ ENNReal.rpow_inv_rpow] - exact (toReal_pos p_ne_zero p_ne_top).ne' - - -- TODO: better name! -@@ -731,17 +756,15 @@ lemma estimate_eLpNorm_trunc {p q : ℝ≥0∞} - by_cases ht : t = ⊤ - · by_cases hf' : eLpNorm f p μ ^ p.toReal = 0 - · have : f =ᵐ[μ] 0 := by -- rw [← eLpNorm_eq_zero_iff hf] -+ rw [← eLpNorm_eq_zero_iff hpq.1.ne'] - · rwa [← ENNReal.rpow_eq_zero_iff_of_pos (toReal_pos hpq.1.ne' p_ne_top)] -- exact hpq.1.ne' - -- Thus, the left hand side vanishes and conclusion is trivially true. -- refine le_of_eq_of_le ?_ (zero_le _) -+ refine le_of_eq_of_le ?_ zero_le - rw [rpow_eq_zero_iff_of_pos] -- · rw [eLpNorm_eq_zero_iff _ hq'.ne'] -+ · rw [eLpNorm_eq_zero_iff hq'.ne'] - · -- TODO: missing API lemma - rw [trunc_eq_indicator] - exact Filter.EventuallyEq.indicator_zero this -- · fun_prop - · rw [toReal_pos_iff] - exact ⟨hq', hq.lt_top⟩ - · -- The right hand side is `∞`, hence the statement is always true. -@@ -752,19 +775,17 @@ lemma estimate_eLpNorm_trunc {p q : ℝ≥0∞} - · apply le_top - rw [sub_pos, toReal_lt_toReal p_ne_top hq] - exact lt_of_le_of_ne hpq.2 p_eq_q -- unfold eLpNorm eLpNorm' -- have : p ≠ 0 := hpq.1.ne' -- split_ifs with h -- · exfalso -- exact hq'.ne' h -- · calc -+ rw [eLpNorm_eq_eLpNorm' hq'.ne' hq hf.trunc, -+ eLpNorm_eq_eLpNorm' hpq.1.ne' p_ne_top hf] -+ unfold eLpNorm' -+ calc - _ = ∫⁻ (x : α) in {x | 0 < ‖f x‖ₑ ∧ ‖f x‖ₑ ≤ t}, ‖trunc f t x‖ₑ ^ q.toReal ∂μ := by - rw [one_div, ENNReal.rpow_inv_rpow] - · apply Eq.symm - apply setLIntegral_eq_of_support_subset - unfold Function.support - intro x -- dsimp only [Pi.sub_apply, mem_setOf_eq] -+ change ‖trunc f t x‖ₑ ^ q.toReal ≠ 0 → 0 < ‖f x‖ₑ ∧ ‖f x‖ₑ ≤ t - unfold trunc - split_ifs with is_fx_le_a - · intro fx_rpow_ne_zero -@@ -783,7 +804,8 @@ lemma estimate_eLpNorm_trunc {p q : ℝ≥0∞} - · apply setLIntegral_mono_ae (AEMeasurable.restrict (by fun_prop)) - · filter_upwards with x hx - rw [mul_comm] -- exact rpow_le_rpow_of_exponent_le_base_le_enorm hx.1 (ne_top_of_le_ne_top ht hx.2) hx.2 <| toReal_mono hq hpq.2 -+ exact rpow_le_rpow_of_exponent_le_base_le_enorm hx.1 -+ (ne_top_of_le_ne_top ht hx.2) hx.2 <| toReal_mono hq hpq.2 - · simp_all - _ ≤ _ := by - gcongr -@@ -795,16 +817,16 @@ lemma estimate_eLpNorm_trunc {p q : ℝ≥0∞} - /-- If `f` is in `Lp`, the truncation is element of `Lq` for `q ≥ p`. -/ - lemma trunc_Lp_Lq_higher (hpq : p ∈ Ioc 0 q) {f : α → ε'} (hf : MemLp f p μ) (ht : t ≠ ∞) : - MemLp (trnc ⊤ f t) q μ := by -- refine ⟨aestronglyMeasurable_trnc hf.1, ?_⟩ -+ change eLpNorm (trnc ⊤ f t) q μ < ∞ - rcases (eq_or_ne q ⊤) with q_eq_top | q_ne_top -- · rw [q_eq_top, eLpNorm_exponent_top] -+ · rw [q_eq_top, eLpNorm_exponent_top (aestronglyMeasurable_trnc hf.aestronglyMeasurable)] - simp only [trnc] - calc _ - _ ≤ max 0 t := trunc_eLpNormEssSup_le t - _ < ∞ := by finiteness - · have p_ne_top := ne_top_of_le_ne_top q_ne_top hpq.2 - rw [← rpow_lt_top_iff_of_pos (toReal_pos (hpq.1.trans_le hpq.2).ne' q_ne_top)] -- apply lt_of_le_of_lt (estimate_eLpNorm_trunc q_ne_top hpq hf.1) -+ apply lt_of_le_of_lt (estimate_eLpNorm_trunc q_ne_top hpq hf.aestronglyMeasurable) - apply mul_lt_top ?_ ?_ - · by_cases ht'' : t = 0 - · rw [ht''] -@@ -813,7 +835,7 @@ lemma trunc_Lp_Lq_higher (hpq : p ∈ Ioc 0 q) {f : α → ε'} (hf : MemLp f p - rw [toReal_le_toReal p_ne_top q_ne_top] - exact hpq.2 - · finiteness -- · exact (rpow_lt_top_iff_of_pos (toReal_pos hpq.1.ne' p_ne_top)).mpr hf.2 -+ · exact (rpow_lt_top_iff_of_pos (toReal_pos hpq.1.ne' p_ne_top)).mpr hf - - lemma memLp_truncCompl_of_memLp_top (hf : MemLp f ⊤ μ) (h : μ {x | t < ‖f x‖ₑ} < ⊤) : - MemLp (trnc ⊥ f t) p μ := by -@@ -821,7 +843,7 @@ lemma memLp_truncCompl_of_memLp_top (hf : MemLp f ⊤ μ) (h : μ {x | t < ‖f - · rw [hp_top] - simp only [bot_eq_false, trnc_false] - exact hf.truncCompl -- obtain ⟨hf_m, hf_lt_top⟩ := hf -+ have hf_m := hf.aestronglyMeasurable - by_cases hp0 : p = 0 - · rw [hp0, memLp_zero_iff_aestronglyMeasurable] - exact aestronglyMeasurable_trnc hf_m -@@ -843,34 +865,33 @@ lemma memLp_truncCompl_of_memLp_top (hf : MemLp f ⊤ μ) (h : μ {x | t < ‖f - split_ifs with hx hx' hx'' - · exact hfgs hs - · exfalso -- simp only [mem_compl_iff, mem_setOf_eq, not_le, not_lt, hfgs hs] at hx hx' -+ simp only [mem_compl_iff, mem_ofPred_eq, not_le, not_lt, hfgs hs] at hx hx' - order - · exfalso -- simp only [mem_compl_iff, mem_setOf_eq, not_le, not_lt, hfgs hs] at hx hx'' -+ simp only [mem_compl_iff, mem_ofPred_eq, not_le, not_lt, hfgs hs] at hx hx'' - order - · rfl - apply MemLp.ae_eq ae_eq_trunc.symm -- use aestronglyMeasurable_trnc wg1.aestronglyMeasurable -+ change eLpNorm (trnc ⊥ g t) p μ < ∞ - simp only [bot_eq_false, trnc_false] - rw [truncCompl_eq_indicator, - eLpNorm_indicator_eq_eLpNorm_restrict -- (by rw [compl_setOf]; simp only [not_le]; exact measurableSet_lt measurable_const (by fun_prop))] -- rw [eLpNorm_eq_eLpNorm' hp0 hp_top] -+ (by rw [compl_ofPred]; simp only [not_le] -+ exact measurableSet_lt measurable_const (by fun_prop))] -+ rw [eLpNorm_eq_eLpNorm' hp0 hp_top wg1.aestronglyMeasurable.restrict] - apply (eLpNorm'_le_eLpNormEssSup_mul_rpow_measure_univ hp_pos).trans_lt - apply ENNReal.mul_lt_top -- · rw [← eLpNorm_exponent_top] -+ · rw [← eLpNorm_exponent_top wg1.aestronglyMeasurable.restrict] - apply (eLpNorm_restrict_le _ _ _ _).trans_lt - rwa [eLpNorm_congr_ae wg2.symm] - apply ENNReal.rpow_lt_top_of_nonneg (by simp [hp_pos.le]) - simp only [MeasurableSet.univ, Measure.restrict_apply, univ_inter] -- rw [← lt_top_iff_ne_top, compl_setOf] -+ rw [← lt_top_iff_ne_top, compl_ofPred] - calc - _ = μ {a | t < ‖f a‖ₑ} := by - apply measure_congr -- rw [Filter.eventuallyEq_iff_exists_mem] at wg2 -- rcases wg2 with ⟨s, hs, hfgs⟩ -- rw [Filter.eventuallyEq_iff_exists_mem] -- exact ⟨s, hs, fun a ha ↦ by simp [setOf, hfgs.symm ha]⟩ -+ filter_upwards [wg2] with a ha -+ simp only [not_le, ha] - _ < ∞ := h - - -- is there a better name? -@@ -881,14 +902,14 @@ lemma truncCompl_Lp_Lq_lower - have q_ne_top : q ≠ ∞ := ne_top_of_le_ne_top hp hpq.2 - by_cases ht' : t = ∞ - · simp [trnc, ht'] -- refine ⟨aestronglyMeasurable_trnc hf.1, ?_⟩ -+ change eLpNorm (trnc ⊥ f t) q μ < ∞ - have : 0 < q.toReal := toReal_pos hpq.left.ne' q_ne_top - refine (rpow_lt_top_iff_of_pos this).mp ?_ -- refine lt_of_le_of_lt (estimate_eLpNorm_truncCompl hp hpq hf.1 ht) ?_ -+ refine lt_of_le_of_lt (estimate_eLpNorm_truncCompl hp hpq hf.aestronglyMeasurable ht) ?_ - apply mul_lt_top - · push Not at ht' - finiteness -- refine (rpow_lt_top_iff_of_pos ?_).mpr hf.2 -+ refine (rpow_lt_top_iff_of_pos ?_).mpr hf - exact toReal_pos (hpq.1.trans_le hpq.2).ne' hp - - -- Lemma 6.10 in Folland -@@ -906,7 +927,8 @@ lemma memLp_of_memLp_le_of_memLp_ge {f : α → ε'} [ContinuousAdd ε'] - have h : MemLp (trnc ⊤ f C) q μ := trunc_Lp_Lq_higher ⟨hp, hr'.1⟩ hf (by norm_num) - have h' : MemLp (trnc ⊥ f C) q μ := by - by_cases hr : r = ⊤ -- · exact memLp_truncCompl_of_memLp_top (hr ▸ hf') <| distribution_lt_top hf hp p_ne_top (by norm_num) -+ · exact memLp_truncCompl_of_memLp_top (hr ▸ hf') <| -+ distribution_lt_top hf hp p_ne_top (by norm_num) - exact truncCompl_Lp_Lq_lower hr ⟨hp.trans_le hr'.1, hr'.2⟩ (by norm_num) hf' - have : f = (trnc ⊤ f C) + (trnc ⊥ f C) := trunc_add_truncCompl.symm - rw [this] -@@ -950,7 +972,7 @@ lemma res_subset_Ioi {j : Bool} {β : ℝ≥0∞} : res j β ⊆ Ioi 0 := by - · simp - · simp only [Ioi] - intro s hs -- rw [mem_setOf] -+ rw [mem_ofPred] - exact hs.1 - · exact Ioi_subset_Ioi toReal_nonneg - -@@ -968,7 +990,7 @@ lemma res'comp₀ (j : Bool) (β : ℝ≥0∞) (hβ : 0 < β) : - split_ifs with h₀ h₁ h₂ - on_goal 6 => - ext x -- simp only [mem_diff, mem_Ioi, mem_Ioc, not_and, not_le] -+ simp only [Set.mem_sdiff, mem_Ioi, mem_Ioc, not_and, not_le] - exact ⟨by tauto, fun h ↦ ⟨(toReal_pos (hβ.ne') h₀).trans h, fun x ↦ h⟩⟩ - all_goals simp_all - -@@ -978,7 +1000,7 @@ lemma res'comp (j : Bool) (β : ℝ≥0∞) : - split_ifs with h₀ h₁ h₂ - on_goal 6 => - ext x -- simp only [mem_diff, mem_Ioi, mem_Ioc, not_and, not_le] -+ simp only [Set.mem_sdiff, mem_Ioi, mem_Ioc, not_and, not_le] - refine ⟨by tauto, fun hβ ↦ ?_⟩ - have : 0 ≤ β.toReal := toReal_nonneg - exact ⟨by order, fun _ ↦ hβ⟩ -@@ -1056,8 +1078,10 @@ lemma lintegral_trunc_mul₀ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {tc : - · simp [hp] - - lemma lintegral_trunc_mul₁ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {p : ℝ} {tc : ToneCouple} : -- ∫⁻ s : ℝ in res' (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = -- ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p := by -+ ∫⁻ s : ℝ in res' (xor j tc.mon) (tc.inv ‖f x‖ₑ), -+ (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = -+ ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), -+ (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p := by - apply setLIntegral_congr - unfold res res' - split_ifs -@@ -1071,7 +1095,8 @@ lemma lintegral_trunc_mul₁ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {p : - exact Ne.symm (ne_of_apply_ne ENNReal.toReal fun a ↦ h (id (Eq.symm a))) - - lemma lintegral_trunc_mul₂ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {p : ℝ} {tc : ToneCouple} : -- ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = -+ ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), -+ (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = - ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s) * ‖f x‖ₑ ^ p := by - apply setLIntegral_congr_fun measurableSet_res - unfold res trnc trunc truncCompl -@@ -1114,7 +1139,8 @@ lemma lintegral_trunc_mul₂ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {p : - · have := (mon_pf (.ofReal s) ‖f x‖ₑ).2.mpr <| (ofReal_lt_iff_lt_toReal hs.1.le h).mpr hs.2 - order - --lemma lintegral_trunc_mul {g : ℝ → ℝ≥0∞} (hg : AEMeasurable g) {j : Bool} {x : α} {tc : ToneCouple} {p : ℝ} -+lemma lintegral_trunc_mul {g : ℝ → ℝ≥0∞} (hg : AEMeasurable g) -+ {j : Bool} {x : α} {tc : ToneCouple} {p : ℝ} - (hp : 0 < p) : - ∫⁻ s : ℝ in Ioi 0, (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = - (∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s)) * ‖f x‖ₑ ^ p := by -@@ -1172,7 +1198,7 @@ lemma value_lintegral_res₀ {j : Bool} {β : ℝ≥0∞} {γ : ℝ} (hγ : if j - rw [lintegral_rpow_of_gt_abs htcinv.le hγ, ENNReal.ofReal_div_of_pos - (by rw [abs_pos]; linarith), ← ENNReal.ofReal_rpow_of_pos htcinv, - ofReal_toReal_eq_iff.mpr htop] -- · simp only [eq_false_of_ne_true xor_split, Bool.false_eq_true, ↓reduceIte] -+ · simp only [Bool.eq_false_of_ne_true xor_split, Bool.false_eq_true, ↓reduceIte] - split_ifs with htop - · rw [htop, top_rpow_of_neg (by linarith)]; simp - · by_cases hzero : β = 0 -@@ -1209,9 +1235,11 @@ lemma value_lintegral_res₂ {γ p' : ℝ} {spf : ScaledPowerFunction} (ht : 0 < - top_div_of_lt_top ofReal_lt_top] - - -- TODO: move to a lower-level file! --lemma AEStronglyMeasurable.induction {α : Type*} {β : Type*} {mα : MeasurableSpace α} [TopologicalSpace β] -+lemma AEStronglyMeasurable.induction {α : Type*} {β : Type*} -+ {mα : MeasurableSpace α} [TopologicalSpace β] - {μ : Measure α} {motive : (α → β) → Prop} -- (ae_eq_implies : ∀ ⦃f g : α → β⦄ (_ : StronglyMeasurable f) (_ : f =ᶠ[ae μ] g), motive f → motive g) -+ (ae_eq_implies : ∀ ⦃f g : α → β⦄ (_ : StronglyMeasurable f) (_ : f =ᶠ[ae μ] g), -+ motive f → motive g) - (measurable : ∀ ⦃f : α → β⦄ (_ : StronglyMeasurable f), motive f) - ⦃f : α → β⦄ (hf : AEStronglyMeasurable f μ) : motive f := by - have hg := hf.choose_spec -diff --git a/Carleson/ToMathlib/WeakType.lean b/Carleson/ToMathlib/WeakType.lean -index 2e6b4bc..29f925a 100644 ---- a/Carleson/ToMathlib/WeakType.lean -+++ b/Carleson/ToMathlib/WeakType.lean -@@ -4,6 +4,8 @@ import Carleson.ToMathlib.Order.ConditionallyCompleteLattice.Basic - import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals - import Mathlib.Analysis.SpecialFunctions.Pow.Integral - -+/-! # Distribution functions and weak-type operator estimates -/ -+ - -- Upstreaming status: all of this should go into mathlib, eventually. - -- Most lemmas have the right form, but proofs can often be golfed. - -- Some enorm lemmas require some mathlib refactoring first, so they can be unified with their -@@ -45,11 +47,11 @@ lemma distribution_mono_right (h : t ≤ s) : distribution f s μ ≤ distributi - lemma distribution_mono_right' : Antitone (fun t ↦ distribution f t μ) := - fun _ _ h ↦ distribution_mono_right h - --@[measurability, fun_prop] -+@[fun_prop] - lemma distribution_measurable₀ : Measurable (fun t ↦ distribution f t μ) := - Antitone.measurable (distribution_mono_right' (f := f) (μ := μ)) - --@[measurability, fun_prop] -+@[fun_prop] - lemma distribution_measurable {g : α' → ℝ≥0∞} (hg : Measurable g) : - Measurable (fun y : α' ↦ distribution f (g y) μ) := by - fun_prop -@@ -147,14 +149,15 @@ lemma continuousWithinAt_distribution (t₀ : ℝ≥0∞) : - rw [db_zero] at h₂ - change Icc 0 ε (distribution f z μ) - rw [nonpos_iff_eq_zero.mp h₂] -- exact ⟨zero_le 0, zero_le ε⟩ -+ exact ⟨zero_le, zero_le⟩ - -- Case: 0 < distribution f t₀ μ - · obtain ⟨n, wn⟩ := - select_neighborhood_distribution t₀ _ - (ENNReal.sub_lt_self db_not_top.ne_top db_not_zero.ne' ε_gt_0.ne') - use Iio (t₀ + (↑n)⁻¹) - constructor -- · exact Iio_mem_nhds (lt_add_right t₀nottop.ne_top (ENNReal.inv_ne_zero.mpr (by finiteness))) -+ · exact Iio_mem_nhds -+ (lt_add_right t₀nottop.ne_top (ENNReal.inv_ne_zero.mpr (by finiteness))) - · refine ⟨Ioi t₀, by simp, fun z h ↦ ⟨?_, ?_⟩⟩ - · calc - distribution f t₀ μ - ε -@@ -172,27 +175,27 @@ lemma distribution_pow (ε : Type*) [SeminormedRing ε] [NormOneClass ε] [NormM - distribution (f ^ n) (t ^ n) μ = distribution f t μ := by - simp_rw [distribution, Pi.pow_apply] - refine congrArg μ <| ext fun x ↦ ⟨fun hx ↦ ?_, fun hx ↦ ?_⟩ -- · rw [mem_setOf_eq, enorm_pow (f x) n] at hx; simpa using lt_of_pow_lt_pow_left' n hx -- · rw [mem_setOf_eq, enorm_pow (f x) n]; exact ENNReal.pow_right_strictMono hn hx -+ · rw [mem_ofPred_eq, enorm_pow (f x) n] at hx; simpa using lt_of_pow_lt_pow_left' n hx -+ · rw [mem_ofPred_eq, enorm_pow (f x) n]; exact ENNReal.pow_right_strictMono hn hx - - - section distribution - - variable {ε' : Type*} [ENorm ε'] {f : α → ε} {g : α → ε'} - --@[gcongr] -+@[gcongr only] - lemma distribution_mono_left (h : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖g x‖ₑ) : - distribution f t μ ≤ distribution g t μ := by - have h₀ : {x | t < ‖f x‖ₑ} \ {x | t < ‖g x‖ₑ} ⊆ {x | ¬‖f x‖ₑ ≤ ‖g x‖ₑ} := fun x ↦ by -- simp_rw [mem_diff, mem_setOf_eq, not_lt, not_le, and_imp] -+ simp_rw [Set.mem_sdiff, mem_ofPred_eq, not_lt, not_le, and_imp] - intro i₁ i₂; simpa using i₂.trans_lt i₁ - calc - _ ≤ μ ({x | t < ‖f x‖ₑ} ∩ {x | t < ‖g x‖ₑ}) -- + μ ({x | t < ‖f x‖ₑ} \ {x | t < ‖g x‖ₑ}) := measure_le_inter_add_diff μ _ _ -+ + μ ({x | t < ‖f x‖ₑ} \ {x | t < ‖g x‖ₑ}) := measure_le_inter_add_sdiff μ _ _ - _ = μ ({x | t < ‖f x‖ₑ} ∩ {x | t < ‖g x‖ₑ}) := by rw [measure_mono_null h₀ h, add_zero] - _ ≤ _ := by apply measure_mono; simp - --@[gcongr] -+@[gcongr only] - lemma distribution_mono (h₁ : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖g x‖ₑ) (h₂ : t ≤ s) : - distribution f s μ ≤ distribution g t μ := - (distribution_mono_left h₁).trans (distribution_mono_right h₂) -@@ -211,7 +214,7 @@ lemma distribution_add_le {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] { - calc - _ ≤ μ ({x | t < ‖f x‖ₑ} ∪ {x | s < ‖g x‖ₑ}) := by - refine measure_mono fun x h ↦ ?_ -- simp only [mem_union, mem_setOf_eq, Pi.add_apply] at h ⊢ -+ simp only [mem_union, mem_ofPred_eq, Pi.add_apply] at h ⊢ - contrapose! h - exact (enorm_add_le _ _).trans (add_le_add h.1 h.2) - _ ≤ _ := measure_union_le _ _ -@@ -225,7 +228,7 @@ lemma distribution_zero_enorm {f : α → ε} (h : enorm ∘ f =ᵐ[μ] 0) : - _ ≤ μ {x | 0 < ‖f x‖ₑ} := by - apply measure_mono - intro x hx -- simp only [Set.mem_setOf_eq] at hx -+ simp only [Set.mem_ofPred_eq] at hx - exact pos_of_gt hx - _ = μ {x | ‖f x‖ₑ ≠ 0} := by - congr -@@ -234,14 +237,17 @@ lemma distribution_zero_enorm {f : α → ε} (h : enorm ∘ f =ᵐ[μ] 0) : - _ = 0 := by - exact ae_iff.mp h - --lemma distribution_zero {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {f : α → ε} (h : f =ᵐ[μ] 0) : -+lemma distribution_zero {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {f : α → ε} -+ (h : f =ᵐ[μ] 0) : - distribution f t μ = 0 := by - apply distribution_zero_enorm - simp only [EventuallyEq, comp_apply, Pi.ofNat_apply] - filter_upwards [h] with x hx using (by simp [hx]) - --lemma distribution_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {s : Set α} {a : ε} : -- distribution (s.indicator (Function.const α a)) t μ = (Set.Iio ‖a‖ₑ).indicator (fun _ ↦ μ s) t := by -+lemma distribution_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] -+ {s : Set α} {a : ε} : -+ distribution (s.indicator (Function.const α a)) t μ = -+ (Set.Iio ‖a‖ₑ).indicator (fun _ ↦ μ s) t := by - unfold distribution indicator - split_ifs with h - · simp only [const_apply] -@@ -257,12 +263,12 @@ lemma distribution_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMon - exfalso - exact ENNReal.not_lt_zero h'' - · intro hx -- rwa [ite_cond_eq_true] -+ rwa [ite_eq_left_of_eq_true] - simpa only [eq_iff_iff, iff_true] - · convert measure_empty (μ := μ) - apply eq_empty_of_subset_empty - intro x -- simp only [const_apply, mem_setOf_eq, mem_empty_iff_false, imp_false, not_lt] -+ simp only [const_apply, mem_ofPred_eq, mem_empty_iff_false, imp_false, not_lt] - split_ifs - · simp only [mem_Iio, not_lt] at h - exact h -@@ -272,12 +278,10 @@ lemma distribution_eq_zero_iff {ε} [TopologicalSpace ε] [ESeminormedAddMonoid - distribution f t μ = 0 ↔ eLpNormEssSup f μ ≤ t := by - rw [distribution, eLpNormEssSup] - rw [← compl_compl {x | t < ‖f x‖ₑ}, ← mem_ae_iff, compl_def] -- simp only [mem_setOf_eq, not_lt] -+ simp only [mem_ofPred_eq, not_lt] - constructor - · intro h -- apply essSup_le_of_ae_le -- filter_upwards [h] -- simp -+ exact essSup_le_of_ae_le t h - · rw [essSup] - intro h - rw [← Filter.Eventually] -@@ -301,7 +305,7 @@ lemma distribution_add {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {f g - rw [← measure_union₀] - · congr 1 - ext x -- simp only [Pi.add_apply, mem_setOf_eq, mem_union] -+ simp only [Pi.add_apply, mem_ofPred_eq, mem_union] - rcases (@or_not (x ∈ support f)) with hxf | hxf - · have := disjoint_left.mp h hxf - simp only [mem_support, ne_eq, not_not] at this -@@ -314,14 +318,14 @@ lemma distribution_add {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {f g - · apply Disjoint.aedisjoint - apply disjoint_of_subset _ _ h - · intro x -- simp only [mem_setOf_eq, mem_support, ne_eq] -+ simp only [mem_ofPred_eq, mem_support, ne_eq] - intro h' - have := LT.lt.ne_bot h' - rw [ENNReal.bot_eq_zero] at this - contrapose! this - rw [this, enorm_zero] - · intro x -- simp only [mem_setOf_eq, mem_support, ne_eq] -+ simp only [mem_ofPred_eq, mem_support, ne_eq] - intro h' - have := LT.lt.ne_bot h' - rw [ENNReal.bot_eq_zero] at this -@@ -342,11 +346,12 @@ lemma distribution_indicator_add_of_support_subset {ε} [TopologicalSpace ε] [E - (enorm_add : ∀ a b : ε, ‖a + b‖ₑ = ‖a‖ₑ + ‖b‖ₑ) --TODO: new type class for this property? - {f : α → ε} {c : ε} (hc : ‖c‖ₑ ≠ ⊤) {s : Set α} - (hfs : Function.support f ⊆ s) : -- distribution (f + s.indicator (Function.const α c)) t μ = if t < ‖c‖ₑ then μ s else distribution f (t - ‖c‖ₑ) μ := by -+ distribution (f + s.indicator (Function.const α c)) t μ = -+ if t < ‖c‖ₑ then μ s else distribution f (t - ‖c‖ₑ) μ := by - unfold distribution - split_ifs with ht - · congr 1 with x -- simp only [Pi.add_apply, mem_setOf_eq] -+ simp only [Pi.add_apply, mem_ofPred_eq] - constructor - · intro h - contrapose! h -@@ -357,11 +362,11 @@ lemma distribution_indicator_add_of_support_subset {ε} [TopologicalSpace ε] [E - unfold indicator - rw [enorm_add, add_comm] - split_ifs -- apply lt_add_of_lt_of_nonneg _ (zero_le _) -+ apply lt_add_of_lt_of_nonneg _ (zero_le) - simpa [h] - · push Not at ht - congr 1 with x -- simp only [Pi.add_apply, mem_setOf_eq] -+ simp only [Pi.add_apply, mem_ofPred_eq] - rw [enorm_add, ENNReal.sub_lt_iff_lt_right hc ht] - constructor - · intro h -@@ -411,9 +416,9 @@ lemma wnorm'_zero (f : α → ε) (μ : Measure α) : wnorm' f 0 μ = ∞ := by - - lemma wnorm'_toReal_le {f : α → ℝ≥0∞} {p : ℝ} (hp : 0 ≤ p) : - wnorm' (ENNReal.toReal ∘ f) p μ ≤ wnorm' f p μ := by -- refine iSup_mono fun x ↦ ?_ -- gcongr -- simp -+ refine iSup_mono fun threshold ↦ ?_ -+ exact mul_le_mul_right -+ (ENNReal.rpow_le_rpow distribution_toReal_le (inv_nonneg.mpr hp)) _ - - lemma wnorm'_toReal_eq {f : α → ℝ≥0∞} {p : ℝ} (hf : ∀ᵐ x ∂μ, f x ≠ ∞) : - wnorm' (ENNReal.toReal ∘ f) p μ = wnorm' f p μ := by -@@ -455,8 +460,8 @@ lemma wnorm'_mono_enorm_ae {ε' : Type*} [ENorm ε'] {f : α → ε} {g : α → - intro t - calc _ - _ ≤ ↑t * distribution g (↑t) μ ^ p⁻¹ := by -- gcongr -- assumption -+ exact mul_le_mul_right -+ (ENNReal.rpow_le_rpow (distribution_mono_left h) (inv_nonneg.mpr hp)) _ - apply le_iSup _ t - - lemma wnorm_mono_enorm_ae {ε' : Type*} [ENorm ε'] {f : α → ε} {g : α → ε'} -@@ -511,14 +516,14 @@ theorem wnorm_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMonoid - intro b hb - use ‖a‖ₑ.toNNReal / 2 - simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, coe_div, coe_ofNat] -- rwa [ENNReal.coe_toNNReal ha', indicator, ite_cond_eq_true, ENNReal.top_rpow_of_pos hp, ENNReal.mul_top] -+ rwa [ENNReal.coe_toNNReal ha', indicator, ite_eq_left_of_eq_true, -+ ENNReal.top_rpow_of_pos hp, ENNReal.mul_top] - · simpa - · simp only [mem_Iio, eq_iff_iff, iff_true] - apply ENNReal.div_lt_of_lt_mul' - nth_rw 1 [← one_mul ‖a‖ₑ] - gcongr -- · exact ha' -- · norm_num -+ norm_num - apply le_of_forall_lt_imp_le_of_dense - intro c hc - apply le_iSup_of_le (c / (μ s ^ p.toReal⁻¹)).toNNReal -@@ -530,7 +535,7 @@ theorem wnorm_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMonoid - contradiction - · rw [hc.1] - exact le_top -- rw [indicator_apply, ite_cond_eq_true, ENNReal.coe_toNNReal hc', ENNReal.div_mul_cancel] -+ rw [indicator_apply, ite_eq_left_of_eq_true, ENNReal.coe_toNNReal hc', ENNReal.div_mul_cancel] - · simp only [ne_eq, ENNReal.rpow_eq_zero_iff, inv_pos, inv_neg'', not_or, not_and, not_lt, - toReal_nonneg, implies_true, and_true] - intro h -@@ -551,7 +556,8 @@ def MemWLp [TopologicalSpace ε] (f : α → ε) (p : ℝ≥0∞) (μ : Measure - lemma MemWLp_zero [TopologicalSpace ε] : ¬ MemWLp f 0 μ := by - simp [MemWLp, wnorm_zero] - --lemma MemWLp.aeStronglyMeasurable [TopologicalSpace ε] (hf : MemWLp f p μ) : AEStronglyMeasurable f μ := hf.1 -+lemma MemWLp.aeStronglyMeasurable [TopologicalSpace ε] (hf : MemWLp f p μ) : -+ AEStronglyMeasurable f μ := hf.1 - - lemma MemWLp.wnorm_lt_top [TopologicalSpace ε] (hf : MemWLp f p μ) : wnorm f p μ < ⊤ := hf.2 - -@@ -572,18 +578,18 @@ theorem MemWLp.ae_ne_top [TopologicalSpace ε] (hf : MemWLp f p μ) : ∀ᵐ x - set A := {x | ‖f x‖ₑ = ∞} with hA - simp only [MemWLp, wnorm, wnorm', hp_inf] at hf - rw [Filter.eventually_iff, mem_ae_iff] -- simp only [ne_eq, compl_def, mem_setOf_eq, Decidable.not_not, ← hA] -+ simp only [ne_eq, compl_def, mem_ofPred_eq, Decidable.not_not, ← hA] - have hp_toReal_zero := toReal_ne_zero.mpr ⟨hp_zero, hp_inf⟩ - have h1 (t : ℝ≥0) : μ A ≤ distribution f t μ := by - refine μ.mono ?_ -- simp_all only [setOf_subset_setOf, coe_lt_top, implies_true, A] -+ simp_all only [ofPred_subset_ofPred, coe_lt_top, implies_true, A] - set C := ⨆ t : ℝ≥0, t * distribution f t μ ^ p.toReal⁻¹ - by_cases hC_zero : C = 0 - · simp only [ENNReal.iSup_eq_zero, mul_eq_zero, ENNReal.rpow_eq_zero_iff, inv_neg'', C] at hC_zero - specialize hC_zero 1 - simp only [one_ne_zero, ENNReal.coe_one, toReal_nonneg.not_gt, and_false, or_false, - false_or] at hC_zero -- exact measure_mono_null (setOf_subset_setOf.mpr fun x hx => hx ▸ one_lt_top) hC_zero.1 -+ exact measure_mono_null (ofPred_subset_ofPred.mpr fun x hx => hx ▸ one_lt_top) hC_zero.1 - by_contra h - have h2 : C < ∞ := by aesop - have h3 (t : ℝ≥0) : distribution f t μ ≤ (C / t) ^ p.toReal := by -@@ -620,10 +626,9 @@ lemma distribution_le [MeasurableSpace ε] [OpensMeasurableSpace ε] - apply (mul_le_iff_le_inv hc hc_top).mp - simp_rw [distribution, ← setLIntegral_one, ← lintegral_const_mul' _ _ hc_top, mul_one] - refine le_trans (lintegral_mono_ae ?_) (setLIntegral_le_lintegral _ _) -- simp only [Filter.Eventually, ae, mem_ofCountableUnion] -- rw [Measure.restrict_apply₀'] -- · convert measure_empty (μ := μ); ext; simpa using le_of_lt -- · exact hf.enorm.nullMeasurableSet_preimage measurableSet_Ioi -+ filter_upwards [ae_restrict_mem₀ -+ (hf.enorm.nullMeasurableSet_preimage measurableSet_Ioi)] with point hpoint -+ exact le_of_lt hpoint - - lemma wnorm'_le_eLpNorm' (hf : AEStronglyMeasurable f μ) {p : ℝ} (p0 : 0 < p) : - wnorm' f p μ ≤ eLpNorm' f p μ := by -@@ -642,9 +647,9 @@ lemma wnorm'_le_eLpNorm' (hf : AEStronglyMeasurable f μ) {p : ℝ} (p0 : 0 < p) - lemma distribution_lt_top (hf : MemLp f p μ) (p_pos : 0 < p) (p_ne_top : p ≠ ∞) - {t : ℝ≥0} (ht : 0 < t) : - distribution f t μ < ∞ := by -- have := wnorm'_le_eLpNorm' hf.1 (toReal_pos p_pos.ne' p_ne_top) -- rw [← eLpNorm_eq_eLpNorm' p_pos.ne' p_ne_top] at this -- have := this.trans_lt hf.2 -+ have := wnorm'_le_eLpNorm' hf.aestronglyMeasurable (toReal_pos p_pos.ne' p_ne_top) -+ rw [← eLpNorm_eq_eLpNorm' p_pos.ne' p_ne_top hf.aestronglyMeasurable] at this -+ have := this.trans_lt hf - rw [wnorm', iSup_lt_iff] at this - rcases this with ⟨b,b_lt_top, h⟩ - have := (h t).trans_lt b_lt_top -@@ -656,18 +661,19 @@ lemma distribution_lt_top (hf : MemLp f p μ) (p_pos : 0 < p) (p_ne_top : p ≠ - · rw [ENNReal.coe_eq_zero] at t_zero - exfalso - exact ht.ne' t_zero -- · rw [ENNReal.rpow_eq_zero_iff_of_pos (by simp only [inv_pos]; exact toReal_pos p_pos.ne' p_ne_top)] at h -+ · rw [ENNReal.rpow_eq_zero_iff_of_pos -+ (by simp only [inv_pos]; exact toReal_pos p_pos.ne' p_ne_top)] at h - rw [h] - simp only [zero_lt_top] - - lemma wnorm_le_eLpNorm (hf : AEStronglyMeasurable f μ) {p : ℝ≥0∞} (hp : 0 < p) : - wnorm f p μ ≤ eLpNorm f p μ := by - by_cases h : p = ⊤ -- · simp [h, wnorm, eLpNorm] -- · simpa [h, wnorm, eLpNorm, hp.ne'] using wnorm'_le_eLpNorm' hf (toReal_pos hp.ne' h) -+ · simp [h, wnorm, eLpNorm, hf] -+ · simpa [h, wnorm, eLpNorm, hp.ne', hf] using wnorm'_le_eLpNorm' hf (toReal_pos hp.ne' h) - - lemma MemLp.memWLp (hp : 0 < p) (hf : MemLp f p μ) : MemWLp f p μ := -- ⟨hf.1, wnorm_le_eLpNorm hf.1 hp |>.trans_lt hf.2⟩ -+ ⟨hf.aestronglyMeasurable, wnorm_le_eLpNorm hf.aestronglyMeasurable hp |>.trans_lt hf⟩ - - end ContinuousENorm - -@@ -717,7 +723,7 @@ variable [TopologicalSpace ε₁] [ContinuousENorm ε₁] [TopologicalSpace ε - - lemma HasWeakType.memWLp (h : HasWeakType T p p' μ ν c) (hf₁ : MemLp f₁ p μ) - (hc : c < ⊤ := by finiteness) : MemWLp (T f₁) p' ν := -- ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc hf₁.2⟩ -+ ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc hf₁⟩ - - lemma HasWeakType.toReal {T : (α → ε₁) → (α' → ℝ≥0∞)} (h : HasWeakType T p p' μ ν c) : - HasWeakType (T · · |>.toReal) p p' μ ν c := -@@ -746,7 +752,7 @@ lemma aestronglyMeasurable_ennreal_toReal_iff {f : α → ℝ≥0∞} - rw [toReal_ofReal_preimage (s := s)] - split_ifs - · exact this -- · simp_rw [preimage_diff] -+ · simp_rw [preimage_sdiff] - exact this.diff hf - · simp_rw [preimage_union] - exact this.union hf -@@ -762,7 +768,8 @@ lemma hasWeakType_toReal_iff {T : (α → ε₁) → (α' → ℝ≥0∞)} - filter_upwards [hT f hf] with x hx - simp [hx] - ---- lemma comp_left [MeasurableSpace ε₂] {ν' : Measure ε₂} {f : ε₂ → ε₃} (h : HasWeakType T p p' μ ν c) -+-- lemma comp_left [MeasurableSpace ε₂] {ν' : Measure ε₂} {f : ε₂ → ε₃} -+-- (h : HasWeakType T p p' μ ν c) - -- (hf : MemLp f p' ν') : - -- HasWeakType (f ∘ T ·) p p' μ ν c := by - -- intro u hu -@@ -780,7 +787,7 @@ variable [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] [TopologicalSpace - lemma HasBoundedWeakType.memWLp (h : HasBoundedWeakType T p p' μ ν c) - (hf₁ : BoundedFiniteSupport f₁ μ) (hc : c < ⊤ := by finiteness) : - MemWLp (T f₁) p' ν := -- ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc (hf₁.memLp p).2⟩ -+ ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc (hf₁.memLp p)⟩ - - lemma HasWeakType.hasBoundedWeakType (h : HasWeakType T p p' μ ν c) : - HasBoundedWeakType T p p' μ ν c := -@@ -797,7 +804,7 @@ variable [TopologicalSpace ε₁] [ContinuousENorm ε₁] [TopologicalSpace ε - - lemma HasStrongType.memLp (h : HasStrongType T p p' μ ν c) (hf₁ : MemLp f₁ p μ) - (hc : c < ⊤ := by finiteness) : MemLp (T f₁) p' ν := -- ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc hf₁.2⟩ -+ (h f₁ hf₁).2.trans_lt <| mul_lt_top hc hf₁ - - lemma HasStrongType.hasWeakType (hp' : 0 < p') - (h : HasStrongType T p p' μ ν c) : HasWeakType T p p' μ ν c := -@@ -830,7 +837,7 @@ variable [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] [TopologicalSpace - lemma HasBoundedStrongType.memLp (h : HasBoundedStrongType T p p' μ ν c) - (hf₁ : BoundedFiniteSupport f₁ μ) (hc : c < ⊤ := by finiteness) : - MemLp (T f₁) p' ν := -- ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc (hf₁.memLp _).2⟩ -+ (h f₁ hf₁).2.trans_lt <| mul_lt_top hc (hf₁.memLp _) - - lemma HasStrongType.hasBoundedStrongType (h : HasStrongType T p p' μ ν c) : - HasBoundedStrongType T p p' μ ν c := -@@ -897,7 +904,8 @@ lemma HasStrongType.const_smul [ContinuousConstSMul ℝ≥0 ε'] - - -- TODO: do we want to unify this lemma with its unprimed version, perhaps using an - -- `ENormedSemiring` class? --variable {𝕜 E' : Type*} [NormedRing 𝕜] [NormedAddCommGroup E'] [MulActionWithZero 𝕜 E'] [IsBoundedSMul 𝕜 E'] in -+variable {𝕜 E' : Type*} [NormedRing 𝕜] [NormedAddCommGroup E'] [MulActionWithZero 𝕜 E'] -+ [IsBoundedSMul 𝕜 E'] in - lemma HasStrongType.const_smul' - {T : (α → ε) → (α' → E')} {c : ℝ≥0∞} (h : HasStrongType T p p' μ ν c) (k : 𝕜) : - HasStrongType (k • T) p p' μ ν (‖k‖ₑ * c) := by -@@ -1009,12 +1017,13 @@ section NormedGroup - variable [NormedAddCommGroup E₁] [NormedSpace 𝕜 E₁] [NormedAddCommGroup E₂] [NormedSpace 𝕜 E₂] - [NormedAddCommGroup E₃] [NormedSpace 𝕜 E₃] - --lemma _root_.ContinuousLinearMap.distribution_le {f : α → E₁} {g : α → E₂} (L : E₁ →L[𝕜] E₂ →L[𝕜] E₃) : -+lemma _root_.ContinuousLinearMap.distribution_le {f : α → E₁} {g : α → E₂} -+ (L : E₁ →L[𝕜] E₂ →L[𝕜] E₃) : - distribution (fun x ↦ L (f x) (g x)) (‖L‖ₑ * t * s) μ ≤ - distribution f t μ + distribution g s μ := by - have h₀ : {x | ‖L‖ₑ * t * s < ‖(fun x ↦ (L (f x)) (g x)) x‖ₑ} ⊆ - {x | t < ‖f x‖ₑ} ∪ {x | s < ‖g x‖ₑ} := fun z hz ↦ by -- simp only [mem_union, mem_setOf_eq] at hz ⊢ -+ simp only [mem_union, mem_ofPred_eq] at hz ⊢ - contrapose! hz - calc - ‖(L (f z)) (g z)‖ₑ ≤ ‖L‖ₑ * ‖f z‖ₑ * ‖g z‖ₑ := by calc -@@ -1034,7 +1043,8 @@ variable [TopologicalSpace ε] [ContinuousENorm ε] - - /-- The layer-cake theorem, or Cavalieri's principle for functions into a space with a continuous - enorm. -/ --lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ} (hp : 0 < p) : -+lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ} -+ (hp : 0 < p) : - ∫⁻ x, ‖f x‖ₑ ^ p ∂μ = - ∫⁻ t in Ioi (0 : ℝ), ENNReal.ofReal (p * t ^ (p - 1)) * distribution f (.ofReal t) μ := by - have := lintegral_rpow_eq_lintegral_meas_lt_mul μ (f := fun x ↦ ENNReal.toReal ‖f x‖ₑ) -@@ -1048,7 +1058,7 @@ lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasura - · apply lintegral_congr_ae - rw [Filter.eventuallyEq_iff_exists_mem] - use {x | ‖f x‖ₑ ≠ ∞} -- rw [mem_ae_iff, compl_setOf] -+ rw [mem_ae_iff, compl_ofPred] - simp only [ne_eq, Decidable.not_not] - use ae_finite - intro x hx -@@ -1059,9 +1069,9 @@ lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasura - dsimp only - congr 1 - symm -- apply measure_eq_measure_of_null_diff -+ apply measure_eq_measure_of_null_sdiff - · intro x hx -- simp only [mem_setOf_eq] at * -+ simp only [mem_ofPred_eq] at * - rwa [ofReal_lt_iff_lt_toReal ht.le] - by_contra hfx - rw [hfx] at hx -@@ -1070,10 +1080,8 @@ lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasura - dsimp [sdiff, Set.diff] - apply measure_mono_null _ ae_finite - intro x hx -- dsimp only [mem_setOf_eq] at * - by_contra hf_top -- rw [ofReal_lt_iff_lt_toReal ht.le hf_top] at hx -- exact hx.2 hx.1 -+ exact hx.2 ((ofReal_lt_iff_lt_toReal ht.le hf_top).mp hx.1) - · rw [lintegral_eq_top_of_measure_eq_top_ne_zero] - · symm - rw [← enorm_pos] at ae_finite -@@ -1101,11 +1109,12 @@ lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasura - exact ae_finite - - /-- The layer-cake theorem, or Cavalieri's principle, written using `eLpNorm`. -/ --lemma eLpNorm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ≥0} (hp : 0 < p) : -+lemma eLpNorm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ≥0} -+ (hp : 0 < p) : - eLpNorm f p μ ^ (p : ℝ) = - ∫⁻ t in Ioi (0 : ℝ), p * ENNReal.ofReal (t ^ ((p : ℝ) - 1)) * distribution f (.ofReal t) μ := by - have h2p : 0 < (p : ℝ) := hp -- simp_rw [eLpNorm_nnreal_eq_eLpNorm' hp.ne', eLpNorm', one_div, ← ENNReal.rpow_mul, -+ simp_rw [eLpNorm_nnreal_eq_eLpNorm' hp.ne' hf, eLpNorm', one_div, ← ENNReal.rpow_mul, - inv_mul_cancel₀ h2p.ne', ENNReal.rpow_one, lintegral_norm_pow_eq_distribution hf h2p, - ENNReal.ofReal_mul zero_le_coe, ofReal_coe_nnreal] - -@@ -1115,17 +1124,15 @@ lemma eLpNorm_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) { - eLpNorm f (.ofReal p) μ = - (ENNReal.ofReal p * ∫⁻ t in Ioi (0 : ℝ), distribution f (.ofReal t) μ * - ENNReal.ofReal (t ^ (p - 1)) ) ^ p⁻¹ := by -- unfold eLpNorm -- split_ifs with sgn_p sz_p -- · exact False.elim (not_le_of_gt hp (ofReal_eq_zero.mp sgn_p)) -- · exact False.elim (coe_ne_top sz_p) -- · unfold eLpNorm' -- rw [toReal_ofReal hp.le, one_div] -- congr 1 -- rw [← lintegral_const_mul' _ _ (by finiteness), lintegral_norm_pow_eq_distribution hf hp] -- congr 1 with x; rw [ofReal_mul] <;> [ring; positivity] -- --lemma lintegral_pow_mul_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ} (hp : -1 < p) : -+ rw [eLpNorm_eq_eLpNorm' (ENNReal.ofReal_pos.mpr hp).ne' ENNReal.ofReal_ne_top hf] -+ unfold eLpNorm' -+ rw [toReal_ofReal hp.le, one_div] -+ congr 1 -+ rw [← lintegral_const_mul' _ _ (by finiteness), lintegral_norm_pow_eq_distribution hf hp] -+ congr 1 with point; rw [ofReal_mul] <;> [ring; positivity] -+ -+lemma lintegral_pow_mul_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ} -+ (hp : -1 < p) : - ∫⁻ t in Ioi (0 : ℝ), ENNReal.ofReal (t ^ p) * distribution f (.ofReal t) μ = - ENNReal.ofReal (p + 1)⁻¹ * ∫⁻ x, ‖f x‖ₑ ^ (p + 1) ∂μ := by - have h2p : 0 < p + 1 := by linarith -diff --git a/Carleson/TwoSidedCarleson/Basic.lean b/Carleson/TwoSidedCarleson/Basic.lean -index 13df8e0..e1d1620 100644 ---- a/Carleson/TwoSidedCarleson/Basic.lean -+++ b/Carleson/TwoSidedCarleson/Basic.lean -@@ -1,6 +1,8 @@ - import Carleson.Calculations - import Carleson.ToMathlib.MeasureTheory.Integral.IntegrableOn - -+/-! # The two-sided Calderon–Zygmund operator -/ -+ - open MeasureTheory Set Metric Function Topology NNReal ENNReal - - variable {X : Type*} {a : ℕ} [MetricSpace X] [DoublingMeasure X (defaultA a : ℕ)] -@@ -20,7 +22,7 @@ lemma czOperator_bound {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : 0 < r - · let M1 := (C_K a / volume (ball x r)).toNNReal - let M2 := (eLpNorm g ∞).toNNReal - have : { y | ¬‖K x y * g y‖ ≤ M0} ⊆ { y | ¬‖K x y‖ ≤ M1 ∨ ¬‖g y‖ ≤ M2} := by -- rw [setOf_subset_setOf] -+ rw [ofPred_subset_ofPred] - intro y - contrapose! - intro hy -@@ -33,7 +35,8 @@ lemma czOperator_bound {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : 0 < r - rw [← toNNReal_mul] - rw [← Measure.restrict_apply₀'] - · apply measure_mono_null_ae this.eventuallyLE -- rw [setOf_or] -+ change (volume.restrict (ball x r)ᶜ) -+ ({y | ¬‖K x y‖ ≤ M1} ∪ {y | ¬‖g y‖ ≤ M2}) = 0 - apply measure_union_null - · rw [← ae_iff] - apply ae_restrict_of_forall_mem measurableSet_ball.compl -@@ -43,7 +46,8 @@ lemma czOperator_bound {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : 0 < r - · apply enorm_K_le_ball_complement hy - · exact (div_lt_top coe_ne_top ((measure_ball_pos volume x hr).ne.symm)).ne - · simp_rw [← ae_iff, M2, ← ENNReal.toReal.eq_1, ← toReal_enorm, -- (ENNReal.toReal_le_toReal enorm_lt_top.ne (hg.eLpNorm_lt_top).ne), eLpNorm_exponent_top] -+ (ENNReal.toReal_le_toReal enorm_lt_top.ne (hg.eLpNorm_lt_top).ne), -+ eLpNorm_exponent_top hg.aestronglyMeasurable] - apply ae_restrict_of_ae ae_le_eLpNormEssSup - · exact measurableSet_ball.compl.nullMeasurableSet - · exact measurableSet_ball.compl.nullMeasurableSet -@@ -101,7 +105,7 @@ lemma czOperator_welldefined {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : - rw [← inter_assoc] - refine Eq.symm (left_eq_inter.mpr ?_) - · apply inter_subset_left.trans -- apply setOf_subset.mpr -+ apply ofPred_subset.mpr - apply tmp_Kxg - rw [← Measure.restrict_apply₀' (by measurability), ← ae_iff] - exact hM -@@ -118,7 +122,8 @@ lemma czOperator_welldefined {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : - · exact support_mul_subset_right (K x) g - - -- This could be adapted to state T_r is a linear operator but maybe it's not worth the effort --lemma czOperator_sub {f g : X → ℂ} (hf : BoundedFiniteSupport f) (hg : BoundedFiniteSupport g) (hr : 0 < r) : -+lemma czOperator_sub {f g : X → ℂ} (hf : BoundedFiniteSupport f) -+ (hg : BoundedFiniteSupport g) (hr : 0 < r) : - czOperator K r (f - g) = czOperator K r f - czOperator K r g := by - ext x - unfold czOperator -diff --git a/Carleson/TwoSidedCarleson/WeakCalderonZygmund.lean b/Carleson/TwoSidedCarleson/WeakCalderonZygmund.lean -index 50aab7b..b9ec606 100644 ---- a/Carleson/TwoSidedCarleson/WeakCalderonZygmund.lean -+++ b/Carleson/TwoSidedCarleson/WeakCalderonZygmund.lean -@@ -2,6 +2,10 @@ import Mathlib.Analysis.Normed.Group.Basic - import Carleson.ToMathlib.HardyLittlewood - import Carleson.TwoSidedCarleson.Basic - -+/-! ## Section 10.2 and Lemma 10.0.3 -+ -+Question: -/ -+ - open MeasureTheory Set Bornology Function Metric Filter Topology - open ENNReal hiding one_lt_two - open scoped NNReal -@@ -24,10 +28,6 @@ variable {F G : Set X} - variable {K : X → X → ℂ} {x x' : X} [IsTwoSidedKernel a K] - variable {f : X → ℂ} {α : ℝ≥0∞} - --/-! ## Section 10.2 and Lemma 10.0.3 -- --Question: -/ -- - /-- The constant used in `nontangential_from_simple`. - I(F) think the constant needs to be fixed in the blueprint. -/ - irreducible_def C10_2_1 (a : ℕ) : ℝ≥0 := 2 ^ (4 * a) -@@ -150,7 +150,7 @@ lemma depth_lt_iff_not_disjoint {d : ℝ} : - simp_rw [depth, iSup_lt_iff, iSup_le_iff] at hd; obtain ⟨d', ld', hd'⟩ := hd - have ns := (hd' d.toNNReal).mt; rw [not_le] at ns; specialize ns ld' - rw [not_subset_iff_exists_mem_notMem] at ns; obtain ⟨y, my, ny⟩ := ns -- have pd := (zero_le _).trans_lt ld' -+ have pd := zero_le.trans_lt ld' - rw [ofReal_pos] at pd; replace pd := Real.coe_toNNReal d pd.le - rw [pd] at my; exact not_disjoint_iff.mpr ⟨y, my, ny⟩ - mpr hd := by -@@ -185,7 +185,7 @@ lemma depth_lt_top_iff_ne_univ : depth O x < ⊤ ↔ O ≠ univ := by - constructor <;> intro h - · contrapose! h; simp_rw [top_le_iff, depth, iSup₂_eq_top, h, subset_univ, exists_const] - intro r rlt; lift r to ℝ≥0 using rlt.ne -- use r + 1; exact coe_lt_coe_of_lt (lt_add_one r) -+ use r + 1; exact coe_lt_coe.mpr (lt_add_one r) - · obtain ⟨p, np⟩ := (ne_univ_iff_exists_notMem _).mp h - calc - _ ≤ edist x p := by -@@ -271,8 +271,10 @@ lemma depth_bound_3 (hO : O ≠ univ) (h : x ∈ ball y (3 * ((depth O y).toReal - gcongr; rw [edist_dist]; apply ofReal_le_of_le_toReal - rw [toReal_div, toReal_ofNat]; linarith - calc -- _ ≤ (2 * depth O x).toReal / 6 + 3 * ((depth O y).toReal / 6) := by gcongr; have := @dnt x; finiteness -- _ ≤ (2 * depth O x).toReal / 6 + 3 * ((2 * depth O x).toReal / 6) := by gcongr; have := @dnt x; finiteness -+ _ ≤ (2 * depth O x).toReal / 6 + 3 * ((depth O y).toReal / 6) := by -+ gcongr; have := @dnt x; finiteness -+ _ ≤ (2 * depth O x).toReal / 6 + 3 * ((2 * depth O x).toReal / 6) := by -+ gcongr; have := @dnt x; finiteness - _ = _ := by rw [toReal_mul, toReal_ofNat]; ring - - lemma ball_covering_bounded_intersection -@@ -299,7 +301,7 @@ lemma ball_covering_bounded_intersection - apply measure_ball_two_le_same_iterate - _ = 2 ^ (3 * a) * volume (⋃ v : V, ball v.1 ((depth O v.1).toReal / 6)) := by - have VsU : V ⊆ U := sep_subset .. -- haveI : Countable V := by rw [countable_coe_iff]; exact countU.mono VsU -+ have : Countable V := by rw [countable_coe_iff]; exact countU.mono VsU - congr 1 - refine (measure_iUnion (fun ⟨v₁, mv₁⟩ ⟨v₂, mv₂⟩ hn ↦ ?_) (fun _ ↦ measurableSet_ball)).symm - rw [ne_eq, Subtype.mk.injEq] at hn -@@ -320,7 +322,7 @@ lemma ball_covering' (hO : IsOpen O ∧ O ≠ univ) : - let W : Set (Set X) := {U | U ⊆ O ∧ U.PairwiseDisjoint fun c ↦ ball c ((depth O c).toReal / 6)} - obtain ⟨U, maxU⟩ : ∃ U, Maximal (· ∈ W) U := by - refine zorn_subset _ fun U sU cU ↦ ⟨⋃₀ U, ?_, fun _ ↦ subset_sUnion_of_mem⟩ -- simp only [W, sUnion_subset_iff, mem_setOf_eq] -+ simp only [W, sUnion_subset_iff, mem_ofPred_eq] - exact ⟨fun u hu ↦ (sU hu).1, (pairwiseDisjoint_sUnion cU.directedOn).2 fun u hu ↦ (sU hu).2⟩ - have countU : U.Countable := by - refine maxU.1.2.countable_of_isOpen (fun _ _ ↦ isOpen_ball) (fun u mu ↦ ?_) -@@ -408,7 +410,7 @@ lemma ball_covering_finite (hO : IsOpen O ∧ O ≠ univ) {U : Set X} {r' : X - · exact disjoint_left.mpr fun i mi₁ mi₂ ↦ mi₁.1 mi₂.1 - _ = 0 + {u ∈ SetLike.coe U | x ∈ ball u (3 * r' u)}.encard := by - congr -- · simp_rw [encard_eq_zero, eq_empty_iff_forall_notMem, mem_setOf_eq, not_and]; intro i hi -+ · simp_rw [encard_eq_zero, eq_empty_iff_forall_notMem, mem_ofPred_eq, not_and]; intro i hi - simp [r, hi] - · set A := {i | i < U.card ∧ x ∈ ball (c i) (3 * r i)} - set B := {u ∈ SetLike.coe U | x ∈ ball u (3 * r' u)} -@@ -416,7 +418,7 @@ lemma ball_covering_finite (hO : IsOpen O ∧ O ≠ univ) {U : Set X} {r' : X - refine ⟨Subtype.coe_prop _, ?_⟩ - have := i.2.2; simp_rw [r, c, i.2.1, dite_true] at this; exact this⟩ - let g (u : B) : A := ⟨e ⟨u.1, u.2.1⟩, by -- simp_rw [A, r, c, mem_setOf_eq, Fin.is_lt, dite_true, Fin.eta, Equiv.symm_apply_apply, -+ simp_rw [A, r, c, mem_ofPred_eq, Fin.is_lt, dite_true, Fin.eta, Equiv.symm_apply_apply, - u.2.2, true_and]⟩ - let eqv : A ≃ B := ⟨f, g, fun i ↦ by simp [f, g], fun u ↦ by simp [f, g]⟩ - exact encard_congr eqv -@@ -455,9 +457,9 @@ theorem ball_covering (hO : IsOpen O ∧ O ≠ univ) : - set B := {u ∈ U | x ∈ ball u (3 * r' u)} - let f (i : A) : B := ⟨e.symm i, by - refine ⟨Subtype.coe_prop _, ?_⟩ -- have := i.2; simp_rw [A, mem_setOf_eq, r, c] at this; exact this⟩ -+ have := i.2; simp_rw [A, mem_ofPred_eq, r, c] at this; exact this⟩ - let g (u : B) : A := ⟨e ⟨u.1, u.2.1⟩, by -- simp_rw [A, r, c, mem_setOf_eq, Equiv.symm_apply_apply, u.2.2]⟩ -+ simp_rw [A, r, c, mem_ofPred_eq, Equiv.symm_apply_apply, u.2.2]⟩ - let eqv : A ≃ B := ⟨f, g, fun i ↦ by simp [f, g], fun u ↦ by simp [f, g]⟩ - exact encard_congr eqv - _ ≤ _ := Ubi x mx -@@ -573,17 +575,17 @@ lemma czBall_subset_czPartition {hX : GeneralCase f α} {i : ℕ} : - intro r hr - rw [mem_ball] at hr - unfold czPartition -- apply mem_diff_of_mem (by rw [mem_ball]; linarith [dist_nonneg.trans_lt hr]) -+ apply mem_sdiff_of_mem (by rw [mem_ball]; linarith [dist_nonneg.trans_lt hr]) - simp only [mem_union, mem_iUnion, mem_ball, not_or, not_exists, not_lt] - refine ⟨?_, fun j hj ↦ by - refine le_of_not_gt (disjoint_left.mp (czBall_pairwiseDisjoint ?_ ?_ hj.ne) hr) <;> tauto⟩ - unfold czPartition -- simp only [mem_diff, mem_ball, mem_union, mem_iUnion, not_or, not_and, not_not] -+ simp only [Set.mem_sdiff, mem_ball, mem_union, mem_iUnion, not_or, not_and, not_not] - exact fun _ _ _ _ ↦ by use i - - lemma czPartition_subset_czBall3 {hX : GeneralCase f α} {i : ℕ} : - czPartition hX i ⊆ czBall3 hX i := by -- rw [czPartition]; exact diff_subset -+ rw [czPartition]; exact sdiff_subset - - private lemma czPartition_subset_czBall7 {hX : GeneralCase f α} {i : ℕ} : - czPartition hX i ⊆ czBall7 hX i := -@@ -597,7 +599,7 @@ lemma czPartition_pairwiseDisjoint {hX : GeneralCase f α} : - have (t d) (hx : x ∈ czPartition hX t) (hd : t < d) : x ∉ czPartition hX d := by - have : czPartition hX t ⊆ ⋃ j < d, czPartition hX j := subset_biUnion_of_mem hd - rw [czPartition] -- exact notMem_diff_of_mem <| mem_union_left _ (this hx) -+ exact notMem_sdiff_of_mem <| mem_union_left _ (this hx) - have : _ ∧ _ := ⟨this i k hxi |>.mt (· hxk), this k i hxk |>.mt (· hxi)⟩ - lia - -@@ -626,7 +628,7 @@ lemma iUnion_czPartition {hX : GeneralCase f α} : - have ⟨t, ht⟩ : ∃ i, x ∈ (⋃ j < i, czPartition hX j) ∪ ⋃ j > i, czBall hX j := by - by_contra! hb - absurd hp g -- rw [czPartition, mem_diff] -+ rw [czPartition, Set.mem_sdiff] - exact ⟨hg, hb g⟩ - have : ⋃ j > t, czBall hX j ⊆ ⋃ j > t, czPartition hX j := - iUnion₂_mono fun i j ↦ czBall_subset_czPartition (i := i) -@@ -647,7 +649,8 @@ private lemma globalMaximalFunction_preimage_finite - refine le_trans (setLIntegral_mono_ae ?_ ?_) (setLIntegral_le_lintegral s _) - · exact AEStronglyMeasurable.globalMaximalFunction.aemeasurable.pow_const 2 |>.restrict - · exact Eventually.of_forall fun x hx ↦ pow_le_pow_left' (le_of_lt <| by simpa [s] using hx) 2 -- _ = eLpNorm (globalMaximalFunction volume 1 f) 2 volume := by simp [eLpNorm, eLpNorm'] -+ _ = eLpNorm (globalMaximalFunction volume 1 f) 2 volume := by -+ simp [eLpNorm, eLpNorm', AEStronglyMeasurable.globalMaximalFunction] - - private lemma volume_czPartition_lt_top (hX : GeneralCase f α) (i : ℕ) : - volume (czPartition hX i) < ∞ := -@@ -760,7 +763,7 @@ lemma aemeasurable_czApproximation {hf : AEMeasurable f} : AEMeasurable (czAppro - simpa [czA, hx] using h - · exact Or.inl ⟨hx, by simpa [czA, hx, hX] using h⟩ - · cases h with -- | inl h => simpa [czA, mem_setOf_eq ▸ mem_setOf_eq ▸ h.1] using h.2 -+ | inl h => simpa [czA, mem_ofPred_eq ▸ mem_ofPred_eq ▸ h.1] using h.2 - | inr h => obtain ⟨_, ⟨⟨i, ⟨hi, rfl⟩⟩, hxi⟩⟩ := h - have hx : ∃ j, x ∈ czPartition hX j := ⟨i, hxi⟩ - simpa [czA, hx, czPartition_pairwiseDisjoint' hx.choose_spec hxi] using hi -@@ -782,8 +785,10 @@ protected lemma BoundedFiniteSupport.czApproximation {α : ℝ≥0∞} (hα : 0 - by_cases h : Nonempty X; swap - · have := not_nonempty_iff.mp h; constructor <;> simp - constructor -- · use (aemeasurable_czApproximation (hf := aemeasurable hf)).aestronglyMeasurable -+ · rw [MemLp, eLpNorm_exponent_top -+ (aemeasurable_czApproximation (hf := hf.aemeasurable)).aestronglyMeasurable] - refine lt_of_le_of_lt ?_ hf.eLpNorm_lt_top -+ rw [eLpNorm_exponent_top hf.aestronglyMeasurable] - apply essSup_le_of_ae_le _ <| (ENNReal.ae_le_essSup (‖f ·‖ₑ)).mono (fun x h ↦ ?_) - by_cases hX : GeneralCase f α - · by_cases hx : ∃ j, x ∈ czPartition hX j -@@ -792,7 +797,7 @@ protected lemma BoundedFiniteSupport.czApproximation {α : ℝ≥0∞} (hα : 0 - exact (enorm_integral_le_lintegral_enorm _).trans (setLAverage_le_essSup _) - · simp [czApproximation, eLpNormEssSup, hX, hx, h] - · simp only [czApproximation, hX, reduceDIte] -- exact (enorm_integral_le_lintegral_enorm _).trans (laverage_le_essSup _) -+ exact (enorm_integral_le_lintegral_enorm _).trans (MeasureTheory.laverage_le_essSup _) - · by_cases hX : GeneralCase f α; swap - · exact lt_of_le_of_lt (measure_mono (subset_univ _)) <| volume_lt_of_not_GeneralCase hf hX hα - calc volume (support (czApproximation f α)) -@@ -883,16 +888,17 @@ private lemma eLpNorm_czApproximation_le_finite - _ ≤ (⨍⁻ x, ‖f x‖ₑ ∂volume) * volume (univ : Set X) := - mul_le_mul_left (enorm_integral_le_lintegral_enorm f) _ - _ = eLpNorm f 1 volume := by -- simp [mul_comm _ (volume univ), eLpNorm, eLpNorm', laverage, ← mul_assoc, -+ simp [mul_comm _ (volume univ), eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable, -+ laverage, ← mul_assoc, - ENNReal.mul_inv_cancel (NeZero.ne (volume univ)) (volume_lt_of_not_GeneralCase hf hX hα).ne] - - -- Equation (10.2.18), infinite case --private lemma eLpNorm_czApproximation_le_infinite (hX : GeneralCase f α) : -- eLpNorm (czApproximation f α) 1 volume ≤ eLpNorm f 1 volume := by -- simp only [eLpNorm, one_ne_zero, reduceIte, one_ne_top, eLpNorm', toReal_one, rpow_one, -+private lemma eLpNormFormula_czApproximation_le_infinite (hX : GeneralCase f α) : -+ eLpNormFormula (czApproximation f α) 1 volume ≤ eLpNormFormula f 1 volume := by -+ simp only [eLpNormFormula, one_ne_zero, reduceIte, one_ne_top, eLpNorm', toReal_one, rpow_one, - ne_eq, not_false_eq_true, div_self] - have hmeas : MeasurableSet (univ \ ⋃ i, czPartition hX i) := by measurability -- have := union_univ _ ▸ @union_diff_self X (⋃ i, czPartition hX i) univ -+ have := union_univ _ ▸ @union_sdiff_self X (⋃ i, czPartition hX i) univ - repeat rw [← setLIntegral_univ (μ := volume), ← this, lintegral_union hmeas disjoint_sdiff_right, - lintegral_iUnion (MeasurableSet.czPartition hX) <| czPartition_pairwise_disjoint_on] - -- gcongr tsum ?_ + ?_ -@@ -900,10 +906,19 @@ private lemma eLpNorm_czApproximation_le_infinite (hX : GeneralCase f α) : - · apply ENNReal.tsum_le_tsum - intro _ - apply lintegral_czPartition_le -- · simp only [union_diff_self, union_univ] -+ · simp only [union_sdiff_self, union_univ] - apply le_of_eq ∘ setLIntegral_congr_fun_ae (by measurability) - exact Eventually.of_forall (fun x hx ↦ by simp_all [czApproximation]) - -+private lemma eLpNorm_czApproximation_le_infinite (hX : GeneralCase f α) : -+ eLpNorm (czApproximation f α) 1 volume ≤ eLpNorm f 1 volume := by -+ by_cases hf : AEStronglyMeasurable f volume -+ · rw [eLpNorm_eq_eLpNormFormula hf, eLpNorm_eq_eLpNormFormula -+ (aemeasurable_czApproximation (hf := hf.aemeasurable)).aestronglyMeasurable] -+ exact eLpNormFormula_czApproximation_le_infinite hX -+ · rw [eLpNorm_of_not_aestronglyMeasurable hf] -+ exact le_top -+ - /-- Part of Lemma 10.2.5, equation (10.2.18) (both cases). -/ - lemma eLpNorm_czApproximation_le - {hf : BoundedFiniteSupport f} (hα : 0 < α) : -@@ -938,7 +953,9 @@ private lemma ineq_10_2_32 (hf : BoundedFiniteSupport f) {hX : GeneralCase f α} - {i : ℕ} : - eLpNorm (czRemainder' hX i) 1 volume ≤ 2 * (∫⁻ x in czPartition hX i, ‖f x‖ₑ) := calc - _ = ∫⁻ x in czPartition hX i, ‖f x - czApproximation f α x‖ₑ := by -- simp [czRemainder', eLpNorm, eLpNorm', enorm_indicator_eq_indicator_enorm, -+ rw [eLpNorm_one_eq_lintegral_enorm -+ (AEMeasurable.czRemainder' (hf := hf.aemeasurable) hX i).aestronglyMeasurable] -+ simp [czRemainder', enorm_indicator_eq_indicator_enorm, - lintegral_indicator <| MeasurableSet.czPartition hX i] - _ ≤ ∫⁻ x in czPartition hX i, ‖f x‖ₑ + ‖czApproximation f α x‖ₑ := - lintegral_mono (fun x ↦ enorm_sub_le) -@@ -971,16 +988,22 @@ private lemma eLpNorm_restrict_czRemainder'_le {hf : BoundedFiniteSupport f} {hX - {i : ℕ} : - ∫⁻ y in czBall3 hX i, ‖czRemainder' hX i y‖ₑ ≤ 2 ^ (2 * a + 1) * α * volume (czBall3 hX i) := by - apply le_trans (setLIntegral_le_lintegral _ _) -- rw [← eLpNorm_one_eq_lintegral_enorm] -+ rw [← eLpNorm_one_eq_lintegral_enorm -+ (AEMeasurable.czRemainder' (hf := hf.aemeasurable) hX i).aestronglyMeasurable] - exact eLpNorm_czRemainder'_le (hf := hf) - - -- Used to prove `eLpNorm_czRemainder_le` and `tsum_eLpNorm_czRemainder_le` - private lemma eLpNorm_czRemainder_le' - (hf : BoundedFiniteSupport f) (hX : ¬ GeneralCase f α) (hα : ⨍⁻ x, ‖f x‖ₑ < α) : - eLpNorm (czRemainder f α) 1 volume ≤ 2 * ∫⁻ x, ‖f x‖ₑ := -- have := isFiniteMeasure_of_not_generalCase hf hX (lt_of_le_of_lt (zero_le _) hα) -+ have := isFiniteMeasure_of_not_generalCase hf hX (lt_of_le_of_lt zero_le hα) - calc -- _ = ∫⁻ x, ‖f x - ⨍ y, f y‖ₑ := by simp [czRemainder, eLpNorm, eLpNorm', czApproximation, hX] -+ _ = ∫⁻ x, ‖f x - ⨍ y, f y‖ₑ := by -+ change eLpNorm (f - czApproximation f α) 1 volume = _ -+ rw [eLpNorm_one_eq_lintegral_enorm -+ (hf.aestronglyMeasurable.sub -+ (aemeasurable_czApproximation (hf := hf.aemeasurable)).aestronglyMeasurable)] -+ simp [czApproximation, hX] - _ ≤ ∫⁻ x, (‖f x‖ₑ + ‖⨍ y, f y‖ₑ) := lintegral_mono (fun x ↦ enorm_sub_le) - _ = (∫⁻ x, ‖f x‖ₑ) + ∫⁻ (x : X), ‖⨍ y, f y‖ₑ := lintegral_add_right' _ aemeasurable_const - _ ≤ (∫⁻ x, ‖f x‖ₑ) + ∫⁻ (x : X), ⨍⁻ y, ‖f y‖ₑ := by -@@ -993,7 +1016,7 @@ lemma eLpNorm_czRemainder_le {hf : BoundedFiniteSupport f} - eLpNorm (czRemainder f α) 1 volume ≤ 2 ^ (2 * a + 1) * α * volume (univ : Set X) := by - by_cases h : Nonempty X; swap - · have := not_nonempty_iff.mp h; simp -- have := isFiniteMeasure_of_not_generalCase hf hX (lt_of_le_of_lt (zero_le _) hα) -+ have := isFiniteMeasure_of_not_generalCase hf hX (lt_of_le_of_lt zero_le hα) - calc - _ ≤ 2 * ∫⁻ x, ‖f x‖ₑ := eLpNorm_czRemainder_le' hf hX hα - _ ≤ 2 * (α * volume (univ : Set X)) := by -@@ -1034,13 +1057,15 @@ lemma tsum_eLpNorm_czRemainder'_le {hf : BoundedFiniteSupport f} (hX : GeneralCa - simp_rw [← smul_eq_mul, ENNReal.tsum_const_smul] - gcongr - rw [← lintegral_iUnion (MeasurableSet.czPartition hX) czPartition_pairwise_disjoint_on] -- simpa [eLpNorm, eLpNorm'] using (lintegral_mono_set (subset_univ _)) -+ simpa [eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable] using -+ (lintegral_mono_set (subset_univ _)) - - /-- Part of Lemma 10.2.5, equation (10.2.23) (finite case). -/ - lemma tsum_eLpNorm_czRemainder_le - {hf : BoundedFiniteSupport f} (hX : ¬ GeneralCase f α) (hα : ⨍⁻ x, ‖f x‖ₑ < α) : - eLpNorm (czRemainder f α) 1 volume ≤ 2 * eLpNorm f 1 volume := by -- simpa [eLpNorm, eLpNorm'] using (eLpNorm_czRemainder_le' hf hX hα) -+ simpa [eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable] using -+ (eLpNorm_czRemainder_le' hf hX hα) - - /- ### Lemmas 10.2.6 - 10.2.9 -/ - -@@ -1092,7 +1117,7 @@ lemma estimate_good (hf : BoundedFiniteSupport f) (hα : ⨍⁻ x, ‖f x‖ₑ - · simp [hα_top, top_div_of_lt_top ENNReal.ofNat_lt_top] - have ne0 : (c10_0_3 a : ℝ≥0∞) ≠ 0 := by simp [c10_0_3] - have hα' : 0 < α' a α := α'_pos (pos_of_gt hα) -- have hα'' := ((zero_le _).trans_lt hα).ne' -+ have hα'' := (zero_le.trans_lt hα).ne' - calc distribution ((czOperator K r (czApproximation f (α' a α)))) (α / 2) volume - _ = distribution ((czOperator K r (czApproximation f (α' a α))) ^ 2) ((α / 2) ^ 2) volume := - (distribution_pow _ _ _ _ two_pos.ne').symm -@@ -1112,8 +1137,11 @@ lemma estimate_good (hf : BoundedFiniteSupport f) (hα : ⨍⁻ x, ‖f x‖ₑ - have half_pos : 0 < (2 : ℝ)⁻¹ := by norm_num - refine mul_le_mul_right (ENNReal.le_of_rpow_le half_pos ?_) (2 ^ 2 / α ^ 2) - rw [ENNReal.mul_rpow_of_nonneg _ _ half_pos.le, ← ENNReal.rpow_natCast_mul] -- convert hT _ (hf.czApproximation hα') |>.2 -- all_goals simp [eLpNorm, eLpNorm', α'] -+ have hstrong := (hT _ (hf.czApproximation hα')).2 -+ rw [eLpNorm_eq_eLpNorm' (by norm_num) (by norm_num) (hT _ (hf.czApproximation hα')).1, -+ eLpNorm_eq_eLpNorm' (by norm_num) (by norm_num) -+ (hf.czApproximation hα').aestronglyMeasurable] at hstrong -+ convert hstrong using 1 <;> simp [eLpNorm', α'] - _ ≤ 2^2/α^2 * ((C_Ts a) ^ 2 * ∫⁻ y, 2^(3*a) * c10_0_3 a * α * ‖czApproximation f _ y‖ₑ) := by - gcongr _ * (_ * ?_) - suffices ∀ᵐ x, ‖czApproximation f (α' a α) x‖ₑ ≤ 2 ^ (3 * a) * c10_0_3 a * α by -@@ -1125,7 +1153,9 @@ lemma estimate_good (hf : BoundedFiniteSupport f) (hα : ⨍⁻ x, ‖f x‖ₑ - _ = 2^2/α^2 * ((C_Ts a)^2 * (2^(3*a) * c10_0_3 a * α * ∫⁻ y, ‖czApproximation f _ y‖ₑ)) := by - rw [lintegral_const_mul' _ _ (by finiteness)] - _ ≤ 2 ^ 2 / α ^ 2 * ((C_Ts a) ^ 2 * (2 ^ (3 * a) * c10_0_3 a * α * eLpNorm f 1 volume)) := by -- gcongr; simpa [eLpNorm, eLpNorm'] using eLpNorm_czApproximation_le (hf := hf) hα' -+ gcongr -+ simpa only [eLpNorm_one_eq_lintegral_enorm (hf.czApproximation hα').aestronglyMeasurable] -+ using eLpNorm_czApproximation_le (hf := hf) hα' - _ = 2 ^ 2 / α^2 * ((C_Ts a) ^ 2 * (2 ^ (3 * a) * c10_0_3 a * α)) * eLpNorm f 1 volume := by ring - _ = (2 ^ 2 * (C_Ts a) ^ 2 * 2 ^ (3 * a) * c10_0_3 a * α) / α ^ 2 * eLpNorm f 1 volume := by - rw [ENNReal.mul_comm_div, mul_div]; ring_nf -@@ -1220,12 +1250,12 @@ private lemma 𝒥₁_bound (hf : BoundedFiniteSupport f) (hα : 0 < α) (hx : x - ‖czOperator K r (czRemainder' hX j) x‖ₑ ≤ czOperatorBoundSummand hX j x := calc - _ = ‖∫ y in czBall3 hX j, K x y * (czRemainder' hX j y)‖ₑ := by - apply congrArg -- apply setIntegral_eq_of_subset_of_ae_diff_eq_zero measurableSet_ball.compl.nullMeasurableSet -+ apply setIntegral_eq_of_subset_of_ae_sdiff_eq_zero measurableSet_ball.compl.nullMeasurableSet - · intro y hy -- simp only [𝒥₁, mem_setOf_eq, mem_ball, mem_compl_iff] at hj hy ⊢ -+ simp only [𝒥₁, mem_ofPred_eq, mem_ball, mem_compl_iff] at hj hy ⊢ - linarith [dist_triangle_left x (czCenter hX j) y] - · refine Eventually.of_forall (fun y hy ↦ mul_eq_zero_of_right (K x y) ?_) -- exact notMem_support.mp <| notMem_subset support_czRemainder'_subset (notMem_of_mem_diff hy) -+ exact notMem_support.mp <| notMem_subset support_czRemainder'_subset (notMem_of_mem_sdiff hy) - _ ≤ _ := by - apply lemma_10_2_7_bound hx hX j (hf.czRemainder' (α'_pos hα) hX j).integrable.restrict - · rw [setIntegral_eq_integral_of_forall_compl_eq_zero, integral_czRemainder'] -@@ -1299,7 +1329,9 @@ private lemma integral_g (hf : BoundedFiniteSupport f) (hα : 0 < α) (hX : Gene - by_cases! hj : czRadius hX j ≤ 0 - · simp [Metric.ball_eq_empty.mpr <| mul_nonpos_of_nonneg_of_nonpos three_pos.le hj] - rw [integral_sub (integrableOn_g₀ hf hα hX j) (integrableOn_d hX j)] -- simp [d, setAverage_eq, smul_smul, mul_inv_cancel₀ (measureReal_ball_pos (czCenter hX j) (mul_pos three_pos hj)).ne'] -+ have hmeasure : (volume.real (czBall3 hX j) : ℂ) ≠ 0 := by -+ exact_mod_cast (measureReal_ball_pos (czCenter hX j) (mul_pos three_pos hj)).ne' -+ simp [d, setAverage_eq, hmeasure] - - private lemma lintegral_enorm_half_g (hf : BoundedFiniteSupport f) (hα : 0 < α) - (hX : GeneralCase f (α' a α)) (j : ℕ) : -@@ -1307,7 +1339,7 @@ private lemma lintegral_enorm_half_g (hf : BoundedFiniteSupport f) (hα : 0 < α - 2 ^ (2 * a + 1) * α' a α * volume (czBall3 hX j) := calc - _ = 2⁻¹ * ∫⁻ y in czBall3 hX j, ‖g r x hX j y‖ₑ := by - simp_rw [enorm_mul] -- rw [lintegral_const_mul' _ _ enorm_ne_top, enorm_inv (NeZero.ne 2), ← ofReal_norm_eq_enorm] -+ rw [lintegral_const_mul' _ _ enorm_ne_top, enorm_inv (NeZero.ne 2), ← ofReal_norm] - simp - _ ≤ 2⁻¹ * ∫⁻ y in czBall3 hX j, ‖g₀ r x hX j y‖ₑ + ‖d r x hX j‖ₑ := by gcongr; exact enorm_sub_le - _ = _ := by rw [lintegral_add_left' (integrableOn_g₀ hf hα hX j).aemeasurable.enorm] -@@ -1362,7 +1394,7 @@ private lemma 𝒥₂_bound (hf : BoundedFiniteSupport f) (hα : 0 < α) (hx : x - rw [← enorm_mul] - _ ≤ _ := by - gcongr -- · simp [← ofReal_norm_eq_enorm] -+ · simp [← ofReal_norm] - · apply lemma_10_2_7_bound hx hX j ((integrableOn_g r x hα hf hX j).const_mul 2⁻¹) - · have h : - ∫ (y : X) in czBall3 hX j, 2⁻¹ * g r x hX j y = -@@ -1385,7 +1417,7 @@ private lemma A_subset (hx : x ∈ (Ω f (α' a α))ᶜ) (hX : GeneralCase f (α - rw [mem_ball'] at hy - have : 6 * czRadius hX j ≤ dist x (czCenter hX j) := six_mul_czRadius_le_of_mem_Ω hx hX j - have hj := Subtype.coe_prop j -- simp only [𝒥₂, tsub_le_iff_right, mem_setOf_eq] at hj -+ simp only [𝒥₂, tsub_le_iff_right, mem_ofPred_eq] at hj - constructor - · linarith [dist_triangle_right x (czCenter hX j) y] - · linarith [dist_triangle x (czCenter hX j) y] -@@ -1507,7 +1539,7 @@ lemma czOperatorBound_inner_le (ha : 4 ≤ a) (hX : GeneralCase f (α' a α)) {i - rcases le_or_gt r 0 with hr | hr - · simp_rw [Real.toNNReal_of_nonpos hr, coe_zero, ENNReal.zero_div] - rw [ENNReal.zero_rpow_of_pos (by rw [inv_pos, Nat.cast_pos]; exact zero_lt_four.trans_le ha)] -- simp_rw [ENNReal.zero_div, lintegral_zero]; exact zero_le _ -+ simp_rw [ENNReal.zero_div, lintegral_zero]; exact zero_le - calc - _ ≤ ∫⁻ x in (czBall6 hX i)ᶜ, - (r.toNNReal / edist x c) ^ (a : ℝ)⁻¹ / volume (ball x (dist x c)) := by -@@ -1534,7 +1566,7 @@ lemma czOperatorBound_inner_le (ha : 4 ≤ a) (hX : GeneralCase f (α' a α)) {i - rw [czBall6, mem_compl_iff, mem_ball, not_lt, show (6 : ℝ) = 2 * 3 by norm_num, - mul_assoc] at mx - change 2 * r ≤ dist x c at mx -- rw [mem_iUnion]; use ⌊Real.logb 2 (dist x c / r)⌋₊; simp_rw [mem_diff, mem_ball, not_lt] -+ rw [mem_iUnion]; use ⌊Real.logb 2 (dist x c / r)⌋₊; simp_rw [Set.mem_sdiff, mem_ball, not_lt] - have dxcpos : 0 < dist x c := lt_of_lt_of_le (by positivity) mx - have dxceq : dist x c = 2 ^ (Real.logb 2 (dist x c / r)) * r := by - rw [Real.rpow_logb zero_lt_two (by norm_num) (by positivity), div_mul_cancel₀ _ hr.ne'] -@@ -1552,7 +1584,7 @@ lemma czOperatorBound_inner_le (ha : 4 ≤ a) (hX : GeneralCase f (α' a α)) {i - (2 ^ n)⁻¹ ^ (a : ℝ)⁻¹ / volume (ball c (2 ^ n * r)) := by - gcongr 2 ^ a * ∑' n, ?_ with n - refine setLIntegral_mono' (measurableSet_ball.diff measurableSet_ball) fun x mx ↦ ?_ -- simp_rw [mem_diff, mem_ball, not_lt] at mx -+ simp_rw [Set.mem_sdiff, mem_ball, not_lt] at mx - gcongr - · change ENNReal.ofReal r / _ ≤ _ - have dxcpos : 0 < dist x c := lt_of_lt_of_le (by positivity) mx.2 -@@ -1569,7 +1601,7 @@ lemma czOperatorBound_inner_le (ha : 4 ≤ a) (hX : GeneralCase f (α' a α)) {i - gcongr with n; apply div_le_of_le_mul - calc - _ ≤ volume (ball c (2 * (2 ^ n * r))) := by -- rw [← mul_assoc 2, ← pow_succ']; exact measure_mono diff_subset -+ rw [← mul_assoc 2, ← pow_succ']; exact measure_mono sdiff_subset - _ ≤ _ := by - convert measure_ball_two_le_same (μ := volume) c (2 ^ n * r) - unfold defaultA; norm_cast -@@ -1590,16 +1622,16 @@ lemma distribution_czOperatorBound (ha : 4 ≤ a) (hf : BoundedFiniteSupport f) - rcases eq_top_or_lt_top α with rfl | αlt - · have : czOperatorBound hX ⁻¹' Ioi (⊤ / 8) = ∅ := by - rw [top_div_of_ne_top (by norm_num), isMax_top.Ioi_eq, preimage_empty] -- rw [this, inter_empty, measure_empty]; exact zero_le _ -+ rw [this, inter_empty, measure_empty]; exact zero_le - calc - _ ≤ (volume.restrict (Ω f (α' a α))ᶜ) {x | α / 8 ≤ czOperatorBound hX x} := by - rw [inter_comm, ← Measure.restrict_apply']; swap - · apply MeasurableSet.compl; simp_rw [Ω, hX, dite_true] - exact MeasurableSet.iUnion fun _ ↦ measurableSet_ball -- gcongr; intro x mx; simp only [mem_preimage, mem_Ioi, mem_setOf_eq] at mx ⊢; exact mx.le -+ gcongr; intro x mx; simp only [mem_preimage, mem_Ioi, mem_ofPred_eq] at mx ⊢; exact mx.le - _ ≤ (∫⁻ x in (Ω f (α' a α))ᶜ, czOperatorBound hX x) / (α / 8) := by - apply meas_ge_le_lintegral_div -- · refine ((AEMeasurable.ennreal_tsum fun i ↦ ?_).const_mul _).restrict -+ · refine ((AEMeasurable.tsum fun i ↦ ?_).const_mul _).restrict - refine AEMeasurable.div ?_ measurable_vol₁.aemeasurable - refine ((AEMeasurable.const_div ?_ _).pow_const _).mul_const _ - simp only [coe_nnreal_ennreal_nndist] -@@ -1647,8 +1679,8 @@ lemma estimate_bad (ha : 4 ≤ a) (hr : 0 < r) - _ ≤ volume (Ω f (α' a α) ∪ - {x ∈ (Ω f (α' a α))ᶜ | α / 2 < ‖czOperator K r (czRemainder f (α' a α)) x‖ₑ}) := by - refine measure_mono fun x mx ↦ ?_ -- rw [mem_setOf_eq] at mx -- simp_rw [mem_union, mem_setOf_eq, mx, and_true, mem_compl_iff]; tauto -+ rw [mem_ofPred_eq] at mx -+ simp_rw [mem_union, mem_ofPred_eq, mx, and_true, mem_compl_iff]; tauto - _ ≤ volume (Ω f (α' a α)) + - volume {x ∈ (Ω f (α' a α))ᶜ | α / 2 < ‖czOperator K r (czRemainder f (α' a α)) x‖ₑ} := - measure_union_le _ _ -@@ -1656,7 +1688,7 @@ lemma estimate_bad (ha : 4 ≤ a) (hr : 0 < r) - volume ((Ω f (α' a α))ᶜ ∩ czOperatorBound hX ⁻¹' Ioi (α / 8)) := by - gcongr - · simp_rw [Ω, hX, dite_true]; exact measure_iUnion_le _ -- · intro x mx; simp_rw [mem_setOf_eq, mem_inter_iff, mem_preimage, mem_Ioi] at mx ⊢ -+ · intro x mx; simp_rw [mem_ofPred_eq, mem_inter_iff, mem_preimage, mem_Ioi] at mx ⊢ - obtain ⟨mx₁, mx₂⟩ := mx; refine ⟨mx₁, ?_⟩; contrapose! mx₂ - calc - _ ≤ 3 * czOperatorBound hX x + α / 8 := estimate_bad_partial hf hr hα mx₁ hX -@@ -1698,17 +1730,18 @@ lemma estimate_czOperator (ha : 4 ≤ a) (hr : 0 < r) (hf : BoundedFiniteSupport - rcases le_or_gt α (⨍⁻ x, ‖f x‖ₑ / c10_0_3 a) with hα | hα - · rw [laverage_eq] at hα - rcases eq_zero_or_pos (eLpNorm f 1) with hf₂ | hf₂ -- · rw [eLpNorm_eq_zero_iff hf.aestronglyMeasurable one_ne_zero] at hf₂ -+ · rw [eLpNorm_eq_zero_iff one_ne_zero] at hf₂ - have op0 : czOperator K r f = 0 := by - ext x; rw [czOperator, integral_eq_zero_of_ae]; swap - · have := (EventuallyEq.rfl (f := (K x ·))).mul hf₂ - simp only [mul_zero] at this; exact this.restrict - simp -- simp_rw [op0, distribution, Pi.zero_apply, enorm_zero, not_lt_zero, setOf_false, -+ simp_rw [op0, distribution, Pi.zero_apply, enorm_zero, not_lt_zero, ofPred_false, - measure_empty, zero_le] - conv_rhs at hα => - enter [1, 2, x]; rw [div_eq_mul_inv, c10_0_3, coe_inv (by positivity), inv_inv] -- rw [lintegral_mul_const' _ _ (by finiteness), ← eLpNorm_one_eq_lintegral_enorm] at hα -+ rw [lintegral_mul_const' _ _ (by finiteness), -+ ← eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable] at hα - replace hα := mul_le_of_le_div' hα - rw [← ENNReal.le_div_iff_mul_le] at hα; rotate_left - · right; positivity -@@ -1723,7 +1756,7 @@ lemma estimate_czOperator (ha : 4 ≤ a) (hr : 0 < r) (hf : BoundedFiniteSupport - _ ≤ distribution (czOperator K r (czApproximation f (α' a α))) (α / 2) volume + - distribution (czOperator K r (czRemainder f (α' a α))) (α / 2) volume := by - refine le_trans (measure_mono fun x mx ↦ ?_) (measure_union_le _ _) -- simp only [mem_union, mem_setOf_eq] at mx ⊢; contrapose! mx -+ simp only [mem_union, mem_ofPred_eq] at mx ⊢; contrapose! mx - calc - _ = ‖czOperator K r (czApproximation f (α' a α)) x + - czOperator K r (czRemainder f (α' a α)) x‖ₑ := by -@@ -1768,4 +1801,27 @@ theorem czOperator_weak_1_1 (ha : 4 ≤ a) (hr : 0 < r) - intro α; apply mul_le_of_le_div'; rw [ENNReal.mul_div_right_comm] - exact estimate_czOperator ha hr hf hT - -+/-! Public access to three already-proved decomposition/cancellation helpers. -+Added by the LeanBlast port; no upstream declaration or proof is changed. -/ -+ -+abbrev carlesonCzOperatorBoundSummand -+ (hX : GeneralCase f (c10_0_3 a * α)) (j : ℕ) (x : X) : ℝ≥0∞ := -+ czOperatorBoundSummand hX j x -+ -+theorem carlesonCzOperatorBound_eq -+ (hX : GeneralCase f (c10_0_3 a * α)) (x : X) : -+ czOperatorBound hX x = ∑' j, carlesonCzOperatorBoundSummand hX j x := -+ czOperatorBound_eq hX x -+ -+theorem carlesonCzCancellation_bound -+ (hx : x ∈ (Ω f (c10_0_3 a * α))ᶜ) -+ (hX : GeneralCase f (c10_0_3 a * α)) (j : ℕ) -+ {g : X → ℂ} (g_int : IntegrableOn g (czBall3 hX j)) -+ (hg0 : ∫ y in czBall3 hX j, g y = 0) -+ (hg : ∫⁻ y in czBall3 hX j, ‖g y‖ₑ ≤ -+ 2 ^ (2 * a + 1) * (c10_0_3 a * α) * volume (czBall3 hX j)) : -+ ‖∫ y in czBall3 hX j, K x y * g y‖ₑ ≤ carlesonCzOperatorBoundSummand hX j x := -+ lemma_10_2_7_bound hx hX j g_int hg0 hg -+ -+ - end -diff --git a/lakefile.toml b/lakefile.toml -index a6d2c69..b16709c 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -9,12 +9,11 @@ autoImplicit = false - weak.linter.flexible = true # no rigid tactic (e.g. `exact`) after a flexible tactic (e.g. `simp`) - # Enable all mathlib linters: automatically matches what mathlib uses. - weak.linter.mathlibStandardSet = true --# Disable the long line linter, for now. --weak.linter.style.longLine = false - - [[require]] - name = "mathlib" - git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[require]] - name = "checkdecls" -diff --git a/lean-toolchain b/lean-toolchain -index d324cad..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.29.0 -\ No newline at end of file -+leanprover/lean4:v4.34.1 +diff --git a/Carleson/Calculations.lean b/Carleson/Calculations.lean +index 6eb7367..259674d 100644 +--- a/Carleson/Calculations.lean ++++ b/Carleson/Calculations.lean +@@ -1,4 +1,7 @@ +-/- ++import Carleson.ProofData ++import Mathlib.Tactic.Rify ++ ++/-! + This is a file for arithmetical lemmas - + lemmas that don't depend on any of Carleson's project definitions, or, really, + on any fancy definitions period. +@@ -7,9 +10,6 @@ Roughly speaking, if a lemma is in this file, it should be purely calculational/ + e.g. `lemma calculation_1 : 2 + 2 = 4`. + All lemmas are prepended with a prefix `calculation_`. + -/ +-import Carleson.ProofData +-import Mathlib.Tactic.Rify +- + open ShortVariables + open scoped NNReal ENNReal + variable {X : Type*} {a : ℕ} {q : ℝ} {K : X → X → ℂ} {σ₁ σ₂ : X → ℤ} {F G : Set X} +@@ -80,7 +80,8 @@ lemma calculation_10 (h : (100 : ℝ) < D) : + _ < _ := by norm_num + + lemma calculation_3 [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F G] {x y : ℤ} (h : x + 3 < y) : +- 100 * D ^ (x + 3) + ((4 * D ^ (-2 : ℝ)) * D ^ (x + 3)) + (((8 : ℝ)⁻¹ * D ^ (-3 : ℝ)) * D ^ (x + 3)) + 8 * D ^ y < 10 * D ^ y := by ++ 100 * D ^ (x + 3) + ((4 * D ^ (-2 : ℝ)) * D ^ (x + 3)) + ++ (((8 : ℝ)⁻¹ * D ^ (-3 : ℝ)) * D ^ (x + 3)) + 8 * D ^ y < 10 * D ^ y := by + rw [← show (2 : ℝ) + 8 = 10 by norm_num, right_distrib] + gcongr + rw [← distrib_three_right ..] +@@ -120,9 +121,11 @@ lemma calculation_4 [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F G] + gcongr + _ ≤ 100 * D ^ (s_1 + 3) + 4 * D ^ (s_1 + 1) + 8⁻¹ * D ^ s_1 + 8 * D ^ s_3 := by + gcongr +- _ = 100 * D ^ (s_1 + 3) + ((4 * D ^ (- 2 : ℝ)) * D ^ (s_1 + 3)) + 8⁻¹ * D ^ s_1 + 8 * D ^ s_3 := by ++ _ = 100 * D ^ (s_1 + 3) + ((4 * D ^ (- 2 : ℝ)) * D ^ (s_1 + 3)) + ++ 8⁻¹ * D ^ s_1 + 8 * D ^ s_3 := by + rw [calculation_1 (s := s_1)] +- _ = 100 * D ^ (s_1 + 3) + ((4 * D ^ (- 2 : ℝ)) * D ^ (s_1 + 3)) + (((8 : ℝ)⁻¹ * D ^ (- 3 : ℝ)) * D ^ (s_1 + 3)) + 8 * D ^ s_3 := by ++ _ = 100 * D ^ (s_1 + 3) + ((4 * D ^ (- 2 : ℝ)) * D ^ (s_1 + 3)) + ++ (((8 : ℝ)⁻¹ * D ^ (- 3 : ℝ)) * D ^ (s_1 + 3)) + 8 * D ^ s_3 := by + rw [calculation_2 (s := s_1)] + _ < 10 * D ^ s_3 := by + exact calculation_3 (h := three) (X := X) +@@ -271,7 +274,6 @@ lemma calculation_7_7_4 [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F G] + trans 2 ^ 12 + · norm_num + gcongr +- · norm_num + lia + exact Nat.mul_le_mul this (Nat.le_add_left 1 n) + +diff --git a/Carleson/Defs.lean b/Carleson/Defs.lean +index a78a398..9da62ec 100644 +--- a/Carleson/Defs.lean ++++ b/Carleson/Defs.lean +@@ -4,11 +4,6 @@ import Carleson.ToMathlib.WeakType + import Mathlib.Analysis.CStarAlgebra.Classes + import Mathlib.Analysis.Fourier.AddCircle + +-open MeasureTheory Measure Metric Complex Set Function ENNReal +-open scoped NNReal +- +-noncomputable section +- + /-! # Main statements of the Carleson project + + This file contains the statements of the main theorems from the Carleson formalization project: +@@ -31,6 +26,11 @@ Fourier sums for continous functions (Theorem 1.0.1 in the blueprint). + + -/ + ++open MeasureTheory Measure Metric Complex Set Function ENNReal ++open scoped NNReal ++ ++noncomputable section ++ + section DoublingMeasure + + universe u +@@ -74,15 +74,12 @@ variable [FunctionDistances 𝕜 X] + instance : Coe (Θ X) C(X, 𝕜) := ⟨FunctionDistances.coeΘ⟩ + instance : FunLike (Θ X) X 𝕜 where + coe := fun f ↦ (f : C(X, 𝕜)) +- coe_injective' _ _ hfg := FunctionDistances.coeΘ_injective fun x ↦ congrFun hfg x +- +-set_option linter.unusedVariables false in ++ coe_injective _ _ hfg := FunctionDistances.coeΘ_injective fun x ↦ congrFun hfg x + /-- Class used to endow `Θ X` with a pseudometric space structure. -/ +-@[nolint unusedArguments] +-def WithFunctionDistance (x : X) (r : ℝ) := Θ X ++def WithFunctionDistance (_x : X) (_r : ℝ) := Θ X + +-instance {x : X} {r : ℝ} [d : FunctionDistances 𝕜 X] : +- PseudoMetricSpace (WithFunctionDistance x r) := d.metric x r ++instance {x : X} {r : ℝ} : ++ PseudoMetricSpace (WithFunctionDistance x r) := FunctionDistances.metric x r + + end FunctionDistances + +@@ -228,8 +225,6 @@ This section contains the statements of the main theorems from the project: Theo + (classical Carleson), Theorem 1.1.1 (metric space Carleson) and Theorem 1.1.2 (linearised metric + Carleson). -/ + +-set_option linter.unusedVariables false +- + open Real + + /-- The Nᵗʰ partial Fourier sum of `f : ℝ → ℂ` for `N : ℕ`. -/ +@@ -242,7 +237,7 @@ local notation "S_" => partialFourierSum + continous functions. + For the proof, see `classical_carleson` in the file `Carleson.Classical.ClassicalCarleson`. -/ + def ClassicalCarleson : Prop := +- ∀ {f : ℝ → ℂ} (cont_f : Continuous f) (periodic_f : f.Periodic (2 * π)), ++ ∀ {f : ℝ → ℂ} (_cont_f : Continuous f) (_periodic_f : f.Periodic (2 * π)), + ∀ᵐ x, Filter.Tendsto (S_ · f x) Filter.atTop (nhds (f x)) + + /-- The constant used in `MetricSpaceCarleson` and `LinearizedMetricCarleson`. +@@ -253,10 +248,10 @@ def C1_0_2 (a : ℕ) (q : ℝ≥0) : ℝ≥0 := 2 ^ ((3 * 𝕔 + 18 + 5 * (𝕔 + For the proof, see `metric_carleson` in the file `Carleson.MetricCarleson.Main`. -/ + def MetricSpaceCarleson : Prop := + ∀ {X : Type*} {a : ℕ} [MetricSpace X] {q q' : ℝ≥0} {F G : Set X} {K : X → X → ℂ} +- [KernelProofData a K] {f : X → ℂ} [IsCancellative X (defaultτ a)] (hq : q ∈ Ioc 1 2) +- (hqq' : q.HolderConjugate q') (mF : MeasurableSet F) (mG : MeasurableSet G) +- (mf : Measurable f) (nf : (‖f ·‖) ≤ F.indicator 1) +- (hT : HasBoundedStrongType (nontangentialOperator K · ·) 2 2 volume volume (C_Ts a)), ++ [KernelProofData a K] {f : X → ℂ} [IsCancellative X (defaultτ a)] (_hq : q ∈ Ioc 1 2) ++ (_hqq' : q.HolderConjugate q') (_mF : MeasurableSet F) (_mG : MeasurableSet G) ++ (_mf : Measurable f) (_nf : (‖f ·‖) ≤ F.indicator 1) ++ (_hT : HasBoundedStrongType (nontangentialOperator K · ·) 2 2 volume volume (C_Ts a)), + ∫⁻ x in G, carlesonOperator K f x ≤ C1_0_2 a q * volume G ^ (q' : ℝ)⁻¹ * volume F ^ (q : ℝ)⁻¹ + + /-- Theorem 1.1.2. +@@ -264,9 +259,10 @@ For the proof, see `linearized_metric_carleson` in the file `Carleson.MetricCarl + def LinearizedMetricCarleson : Prop := + ∀ {X : Type*} {a : ℕ} [MetricSpace X] {q q' : ℝ≥0} {F G : Set X} {K : X → X → ℂ} + [KernelProofData a K] {Q : SimpleFunc X (Θ X)} {f : X → ℂ} [IsCancellative X (defaultτ a)] +- (hq : q ∈ Ioc 1 2) (hqq' : q.HolderConjugate q') (mF : MeasurableSet F) (mG : MeasurableSet G) +- (mf : Measurable f) (nf : (‖f ·‖) ≤ F.indicator 1) +- (hT : ∀ θ : Θ X, HasBoundedStrongType (linearizedNontangentialOperator Q θ K · ·) ++ (_hq : q ∈ Ioc 1 2) (_hqq' : q.HolderConjugate q') ++ (_mF : MeasurableSet F) (_mG : MeasurableSet G) ++ (_mf : Measurable f) (_nf : (‖f ·‖) ≤ F.indicator 1) ++ (_hT : ∀ θ : Θ X, HasBoundedStrongType (linearizedNontangentialOperator Q θ K · ·) + 2 2 volume volume (C_Ts a)), + ∫⁻ x in G, linearizedCarlesonOperator Q K f x ≤ + C1_0_2 a q * volume G ^ (q' : ℝ)⁻¹ * volume F ^ (q : ℝ)⁻¹ +diff --git a/Carleson/DoublingMeasure.lean b/Carleson/DoublingMeasure.lean +index e571aff..f186a8a 100644 +--- a/Carleson/DoublingMeasure.lean ++++ b/Carleson/DoublingMeasure.lean +@@ -2,12 +2,6 @@ import Carleson.Defs + import Carleson.LipschitzNorm + import Carleson.ToMathlib.Data.ENNReal + +-open MeasureTheory Measure Metric Complex Set Bornology Function +-open ENNReal hiding one_lt_two +-open scoped NNReal +- +-noncomputable section +- + /-! # Basic definitions and lemmas + + This file contains definitions from Section 2 of the blueprint and used throughout the proof +@@ -18,6 +12,12 @@ provided for them (as well as for the constants `a` and `tau`). + + -/ + ++open MeasureTheory Measure Metric Complex Set Bornology Function ++open ENNReal hiding one_lt_two ++open scoped NNReal ++ ++noncomputable section ++ + lemma seven_le_c : 7 ≤ 𝕔 := by simp [𝕔] + + lemma c_le_100 : 𝕔 ≤ 100 := by simp [𝕔] +@@ -76,8 +76,7 @@ lemma hundred_lt_D : 100 < defaultD a := by + have : 16 ≤ a ^ 2 := by nlinarith [four_le_a X] + simp only [defaultD] + gcongr +- · norm_num +- · nlinarith [seven_le_c] ++ nlinarith [seven_le_c] + + -- used in 7.5.6 (`limited_scale_impact`) + lemma hundred_lt_realD : (100 : ℝ) < defaultD a := mod_cast hundred_lt_D X +@@ -190,7 +189,7 @@ variable [FunctionDistances 𝕜 X] + + instance : ContinuousMapClass (Θ X) X 𝕜 := ⟨fun f ↦ (f : C(X, 𝕜)).2⟩ + +-def toWithFunctionDistance {x : X} {r : ℝ} [FunctionDistances 𝕜 X] : ++def toWithFunctionDistance {x : X} {r : ℝ} : + Θ X ≃ WithFunctionDistance x r := .refl _ + + end FunctionDistances +@@ -219,12 +218,12 @@ lemma oscillation_le_cdist [CompatibleFunctions 𝕜 X A] (x : X) (r : ℝ) (f g + (hy : y ∈ ball x r) (hz : z ∈ ball x r) : + ‖coeΘ f y - coeΘ g y - coeΘ f z + coeΘ g z‖ ≤ dist_{x, r} f g := by + apply le_trans <| le_localOscillation x r f g hy hz +- rw [← ENNReal.toReal_ofReal dist_nonneg] ++ erw [← ENNReal.toReal_ofReal dist_nonneg] + exact ENNReal.toReal_mono ENNReal.ofReal_ne_top CompatibleFunctions.localOscillation_le_cdist + + export CompatibleFunctions (localOscillation_le_cdist cdist_mono cdist_le le_cdist) + +-lemma dist_congr [FunctionDistances 𝕜 X] {x₁ x₂ : X} {r₁ r₂ : ℝ} {f g : Θ X} ++lemma cdist_congr [FunctionDistances 𝕜 X] {x₁ x₂ : X} {r₁ r₂ : ℝ} {f g : Θ X} + (e₁ : x₁ = x₂) (e₂ : r₁ = r₂) : dist_{x₁, r₁} f g = dist_{x₂, r₂} f g := by congr + + variable (X) in +@@ -253,7 +252,9 @@ lemma enorm_integral_exp_le [CompatibleFunctions ℝ X A] {τ : ℝ} [IsCancella + rcases eq_or_ne (iLipENorm φ x r) ∞ with h1 | h1 + · apply le_top.trans_eq + symm +- simp [h1, edist_ne_top, hA, (measure_ball_pos volume x hr).ne'] ++ have finite_dist : edist_{x, r} f g ≠ ∞ := edist_ne_top ++ (toWithFunctionDistance f) (toWithFunctionDistance g) ++ simp [h1, finite_dist, hA, (measure_ball_pos volume x hr).ne'] + exact IsCancellative.enorm_integral_exp_le' hr h1 h2 + + /-- Constructor of `IsCancellative` in terms of real norms instead of extended reals. -/ +@@ -266,7 +267,7 @@ lemma isCancellative_of_norm_integral_exp_le (τ : ℝ) [CompatibleFunctions ℝ + constructor + intro x r φ hr h1 h2 f g + convert ENNReal.ofReal_le_ofReal (h (x := x) (r := r) (φ := φ) hr h1 h2 (f := f) (g := g)) +- · rw [ofReal_norm_eq_enorm] ++ · rw [ofReal_norm] + congr 1 + rw [setIntegral_eq_integral_of_forall_compl_eq_zero (fun y hy ↦ ?_)] + have : φ y = 0 := by +@@ -280,10 +281,10 @@ lemma isCancellative_of_norm_integral_exp_le (τ : ℝ) [CompatibleFunctions ℝ + · simp + · simp only [Measure.real, ofReal_toReal measure_ball_ne_top] + · simp [iLipNNNorm, coe_toNNReal h1] +- · rw [← ENNReal.ofReal_rpow_of_pos (by positivity)] ++ · have nonneg_dist : 0 ≤ dist_{x, r} f g := dist_nonneg ++ rw [← ENNReal.ofReal_rpow_of_pos (by linarith)] + congr +- rw [ENNReal.ofReal_add zero_le_one dist_nonneg] +- simp [edist_dist] ++ erw [ENNReal.ofReal_add zero_le_one dist_nonneg, ENNReal.ofReal_one, edist_dist] + + /-- The "volume function" `V`. We will need to assume + `IsFiniteMeasureOnCompacts` and `ProperSpace` to actually know that this volume is finite. -/ +@@ -492,25 +493,28 @@ variable [CompatibleFunctions ℝ X (defaultA a)] + lemma le_cdist_iterate {x : X} {r : ℝ} (hr : 0 ≤ r) (f g : Θ X) (k : ℕ) : + 2 ^ k * dist_{x, r} f g ≤ dist_{x, (defaultA a) ^ k * r} f g := by + induction k with +- | zero => rw [pow_zero, one_mul]; congr! <;> simp ++ | zero => ++ rw [pow_zero, one_mul] ++ exact (cdist_congr rfl (by simp)).le + | succ k ih => + trans 2 * dist_{x, (defaultA a) ^ k * r} f g + · rw [pow_succ', mul_assoc] + exact (mul_le_mul_iff_right₀ zero_lt_two).mpr ih + · convert le_cdist (ball_subset_ball _) using 1 +- · exact dist_congr rfl (by rw [← mul_assoc, pow_succ']) ++ · exact cdist_congr rfl (by rw [← mul_assoc, pow_succ']) + · nth_rw 1 [← one_mul ((defaultA a) ^ k * r)]; gcongr + rw [← Nat.cast_one, Nat.cast_le]; exact Nat.one_le_two_pow + + lemma cdist_le_iterate {x : X} {r : ℝ} (hr : 0 < r) (f g : Θ X) (k : ℕ) : + dist_{x, 2 ^ k * r} f g ≤ (defaultA a) ^ k * dist_{x, r} f g := by + induction k with +- | zero => simp_rw [pow_zero, one_mul]; congr! <;> simp ++ | zero => ++ rw [pow_zero, one_mul, pow_zero, one_mul] + | succ k ih => + trans defaultA a * dist_{x, 2 ^ k * r} f g +- · convert cdist_le _ using 1 +- · exact dist_congr rfl (by ring) +- · rw [dist_self]; positivity ++ · convert cdist_le (x₁ := x) (x₂ := x) (f := f) (g := g) ++ (r := 2 ^ k * r) (by rw [dist_self]; positivity) using 1 ++ exact cdist_congr rfl (by ring) + · replace ih := (mul_le_mul_iff_right₀ (show 0 < (defaultA a : ℝ) by positivity)).mpr ih + rwa [← mul_assoc, ← pow_succ'] at ih + +diff --git a/Carleson/LipschitzNorm.lean b/Carleson/LipschitzNorm.lean +index 7c1a823..39c29c5 100644 +--- a/Carleson/LipschitzNorm.lean ++++ b/Carleson/LipschitzNorm.lean +@@ -2,9 +2,6 @@ import Mathlib.Analysis.Normed.Field.Basic + import Mathlib.Topology.EMetricSpace.Lipschitz + import Carleson.Defs + +-open Metric Function ENNReal +-open scoped NNReal +- + /-! + # Inhomogeneous Lipschitz norm + +@@ -14,6 +11,9 @@ Lemmas about this norm that are proven in Carleson are collected here. + TODO: Assess Mathlib-readiness, complete basic results, optimize imports. + -/ + ++open Metric Function ENNReal ++open scoped NNReal ++ + noncomputable section + + section Def +@@ -54,7 +54,7 @@ lemma iLipENorm_le_add (h : ∀ x ∈ ball z R, ‖φ x‖ ≤ C) + have W := h' x hx x' hx' hne + rw [ENNReal.div_le_iff (by simpa only [ne_eq, edist_eq_zero] using hne) (edist_ne_top x x')] + convert ENNReal.ofReal_le_ofReal W +- · exact (ofReal_norm_eq_enorm (φ x - φ x')).symm ++ · exact (ofReal_norm (φ x - φ x')).symm + · rw [ENNReal.ofReal_div_of_pos hR, ENNReal.ofReal_mul NNReal.zero_le_coe, edist_dist, + ENNReal.mul_div_right_comm, ENNReal.ofReal_coe_nnreal] + +diff --git a/Carleson/ProofData.lean b/Carleson/ProofData.lean +index 0046632..1582b2d 100644 +--- a/Carleson/ProofData.lean ++++ b/Carleson/ProofData.lean +@@ -1,10 +1,5 @@ + import Carleson.DoublingMeasure + +-open MeasureTheory Measure Metric Complex Set TopologicalSpace Bornology Function +-open ENNReal hiding one_lt_two +-open scoped NNReal +-noncomputable section +- + /-! # ProofData. + + This file introduces the class `ProofData`, used to bundle data common through most of +@@ -12,6 +7,11 @@ chapters 2-7 (except 3), and provides API for it. + + -/ + ++open MeasureTheory Measure Metric Complex Set TopologicalSpace Bornology Function ++open ENNReal hiding one_lt_two ++open scoped NNReal ++noncomputable section ++ + /-- Data common through most of chapters 2-7 (except 3). -/ + class ProofData {X : Type*} (a : outParam ℕ) (q : outParam ℝ) (K : outParam (X → X → ℂ)) + (σ₁ σ₂ : outParam (X → ℤ)) (F G : outParam (Set X)) [PseudoMetricSpace X] extends +@@ -180,7 +180,6 @@ lemma DκZ_le_two_rpow_100 [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F + _ ≤ 1 * 4 ^ 2 * 2 ^ (2 * 4) := by norm_num + _ ≤ _ := by + gcongr +- norm_num + + lemma four_le_Z [PseudoMetricSpace X] [ProofData a q K σ₁ σ₂ F G] : 4 ≤ Z := by + rw [defaultZ, show 4 = 2 ^ 2 by rfl] +diff --git a/Carleson/ToMathlib/Annulus.lean b/Carleson/ToMathlib/Annulus.lean +index 207eb52..09d38d0 100644 +--- a/Carleson/ToMathlib/Annulus.lean ++++ b/Carleson/ToMathlib/Annulus.lean +@@ -183,67 +183,67 @@ lemma cc_subset_closedBall {x : X} {r R : ℝ} : cc x r R ⊆ closedBall x R := + lemma oc_union_oo {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' < R) : + oc x r r' ∪ oo x r' R = oo x r R := by + -- XXX: should this proof be written as `ext; grind [oc, oo]` instead? Same question below. +- ext; simp_rw [oc, oo, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioo_eq_Ioo h₁ h₂] ++ ext; simp_rw [oc, oo, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioo_eq_Ioo h₁ h₂] + + @[simp] + lemma oc_union_oc {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' ≤ R) : + oc x r r' ∪ oc x r' R = oc x r R := by +- ext; simp_rw [oc, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioc_eq_Ioc h₁ h₂] ++ ext; simp_rw [oc, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioc_eq_Ioc h₁ h₂] + + @[simp] + lemma oo_union_co {x : X} {r r' R : ℝ} (h₁ : r < r') (h₂ : r' ≤ R) : + oo x r r' ∪ co x r' R = oo x r R := by +- ext; simp_rw [oo, co, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Ico_eq_Ioo h₁ h₂] ++ ext; simp_rw [oo, co, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Ico_eq_Ioo h₁ h₂] + + @[simp] + lemma oo_union_cc {x : X} {r r' R : ℝ} (h₁ : r < r') (h₂ : r' ≤ R) : + oo x r r' ∪ cc x r' R = oc x r R := by +- ext; simp_rw [oo, cc, oc, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Icc_eq_Ioc h₁ h₂] ++ ext; simp_rw [oo, cc, oc, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Icc_eq_Ioc h₁ h₂] + + @[simp] + lemma cc_union_oo {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' < R) : + cc x r r' ∪ oo x r' R = co x r R := by +- ext; simp_rw [cc, oo, co, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioo_eq_Ico h₁ h₂] ++ ext; simp_rw [cc, oo, co, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioo_eq_Ico h₁ h₂] + + @[simp] + lemma cc_union_oc {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' ≤ R) : + cc x r r' ∪ oc x r' R = cc x r R := by +- ext; simp_rw [cc, oc, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioc_eq_Icc h₁ h₂] ++ ext; simp_rw [cc, oc, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioc_eq_Icc h₁ h₂] + + @[simp] + lemma co_union_co {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' ≤ R) : + co x r r' ∪ co x r' R = co x r R := by +- ext; simp_rw [co, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Ico_eq_Ico h₁ h₂] ++ ext; simp_rw [co, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Ico_eq_Ico h₁ h₂] + + @[simp] + lemma co_union_cc {x : X} {r r' R : ℝ} (h₁ : r ≤ r') (h₂ : r' ≤ R) : + co x r r' ∪ cc x r' R = cc x r R := by +- ext; simp_rw [co, cc, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Icc_eq_Icc h₁ h₂] ++ ext; simp_rw [co, cc, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Icc_eq_Icc h₁ h₂] + + @[simp] + lemma oc_union_oi {x : X} {r R : ℝ} (h : r ≤ R) : oc x r R ∪ oi x R = oi x r := by +- ext; simp_rw [oc, oi, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioi_eq_Ioi h] ++ ext; simp_rw [oc, oi, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioi_eq_Ioi h] + + @[simp] + lemma oo_union_ci {x : X} {r R : ℝ} (h : r < R) : + oo x r R ∪ ci x R = oi x r := by +- ext; simp_rw [oo, ci, oi, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Ici_eq_Ioi h] ++ ext; simp_rw [oo, ci, oi, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Ici_eq_Ioi h] + + @[simp] + lemma cc_union_oi {x : X} {r R : ℝ} (h : r ≤ R) : cc x r R ∪ oi x R = ci x r := by +- ext; simp_rw [cc, oi, ci, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioi_eq_Ici h] ++ ext; simp_rw [cc, oi, ci, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioi_eq_Ici h] + + @[simp] + lemma co_union_ci {x : X} {r R : ℝ} (h : r ≤ R) : co x r R ∪ ci x R = ci x r := by +- ext; simp_rw [co, ci, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Ici_eq_Ici h] ++ ext; simp_rw [co, ci, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Ici_eq_Ici h] + + theorem iUnion_co_eq_ci {x : X} {f : ℕ → ℝ} (hf : ∀ n, f 0 ≤ f n) (h2f : ¬BddAbove (range f)) : + ⋃ (i : Nat), co x (f i) (f (i+1)) = ci x (f 0) := by +- simp [co, ci, iUnion_setOf, ← iUnion_Ico_eq_Ici hf h2f] ++ simp [co, ci, iUnion_ofPred, ← iUnion_Ico_eq_Ici hf h2f] + + theorem iUnion_oc_eq_oi {x : X} {f : ℕ → ℝ} (hf : ∀ n, f 0 ≤ f n) (h2f : ¬BddAbove (range f)) : + ⋃ (i : Nat), oc x (f i) (f (i+1)) = oi x (f 0) := by +- simp [oc, oi, iUnion_setOf, ← iUnion_Ioc_eq_Ioi hf h2f] ++ simp [oc, oi, iUnion_ofPred, ← iUnion_Ioc_eq_Ioi hf h2f] + + variable {ι : Type*} [LinearOrder ι] [SuccOrder ι] + +@@ -501,59 +501,59 @@ lemma cc_subset_ci {x : X} {r₁ R₁ r₂ : ℝ≥0∞} (hr : r₂ ≤ r₁) : + @[simp] + lemma oc_union_oo {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' < R) : + oc x r r' ∪ oo x r' R = oo x r R := by +- ext; simp_rw [oc, oo, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioo_eq_Ioo h₁ h₂] ++ ext; simp_rw [oc, oo, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioo_eq_Ioo h₁ h₂] + + @[simp] + lemma oc_union_oc {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' ≤ R) : + oc x r r' ∪ oc x r' R = oc x r R := by +- ext; simp_rw [oc, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioc_eq_Ioc h₁ h₂] ++ ext; simp_rw [oc, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioc_eq_Ioc h₁ h₂] + + @[simp] + lemma oo_union_co {x : X} {r r' R : ℝ≥0∞} (h₁ : r < r') (h₂ : r' ≤ R) : + oo x r r' ∪ co x r' R = oo x r R := by +- ext; simp_rw [oo, co, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Ico_eq_Ioo h₁ h₂] ++ ext; simp_rw [oo, co, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Ico_eq_Ioo h₁ h₂] + + @[simp] + lemma oo_union_cc {x : X} {r r' R : ℝ≥0∞} (h₁ : r < r') (h₂ : r' ≤ R) : + oo x r r' ∪ cc x r' R = oc x r R := by +- ext; simp_rw [oo, cc, oc, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Icc_eq_Ioc h₁ h₂] ++ ext; simp_rw [oo, cc, oc, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Icc_eq_Ioc h₁ h₂] + + @[simp] + lemma cc_union_oo {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' < R) : + cc x r r' ∪ oo x r' R = co x r R := by +- ext; simp_rw [cc, oo, co, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioo_eq_Ico h₁ h₂] ++ ext; simp_rw [cc, oo, co, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioo_eq_Ico h₁ h₂] + + @[simp] + lemma cc_union_oc {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' ≤ R) : + cc x r r' ∪ oc x r' R = cc x r R := by +- ext; simp_rw [cc, oc, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioc_eq_Icc h₁ h₂] ++ ext; simp_rw [cc, oc, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioc_eq_Icc h₁ h₂] + + @[simp] + lemma co_union_co {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' ≤ R) : + co x r r' ∪ co x r' R = co x r R := by +- ext; simp_rw [co, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Ico_eq_Ico h₁ h₂] ++ ext; simp_rw [co, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Ico_eq_Ico h₁ h₂] + + @[simp] + lemma co_union_cc {x : X} {r r' R : ℝ≥0∞} (h₁ : r ≤ r') (h₂ : r' ≤ R) : + co x r r' ∪ cc x r' R = cc x r R := by +- ext; simp_rw [co, cc, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Icc_eq_Icc h₁ h₂] ++ ext; simp_rw [co, cc, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Icc_eq_Icc h₁ h₂] + + @[simp] + lemma oc_union_oi {x : X} {r R : ℝ≥0∞} (h : r ≤ R) : oc x r R ∪ oi x R = oi x r := by +- ext; simp_rw [oc, oi, mem_union, mem_setOf_eq, ← mem_union, Ioc_union_Ioi_eq_Ioi h] ++ ext; simp_rw [oc, oi, mem_union, mem_ofPred_eq, ← mem_union, Ioc_union_Ioi_eq_Ioi h] + + @[simp] + lemma oo_union_ci {x : X} {r R : ℝ≥0∞} (h : r < R) : + oo x r R ∪ ci x R = oi x r := by +- ext; simp_rw [oo, ci, oi, mem_union, mem_setOf_eq, ← mem_union, Ioo_union_Ici_eq_Ioi h] ++ ext; simp_rw [oo, ci, oi, mem_union, mem_ofPred_eq, ← mem_union, Ioo_union_Ici_eq_Ioi h] + + @[simp] + lemma cc_union_oi {x : X} {r R : ℝ≥0∞} (h : r ≤ R) : cc x r R ∪ oi x R = ci x r := by +- ext; simp_rw [cc, oi, ci, mem_union, mem_setOf_eq, ← mem_union, Icc_union_Ioi_eq_Ici h] ++ ext; simp_rw [cc, oi, ci, mem_union, mem_ofPred_eq, ← mem_union, Icc_union_Ioi_eq_Ici h] + + @[simp] + lemma co_union_ci {x : X} {r R : ℝ≥0∞} (h : r ≤ R) : co x r R ∪ ci x R = ci x r := by +- ext; simp_rw [co, ci, mem_union, mem_setOf_eq, ← mem_union, Ico_union_Ici_eq_Ici h] ++ ext; simp_rw [co, ci, mem_union, mem_ofPred_eq, ← mem_union, Ico_union_Ici_eq_Ici h] + + + variable [MeasurableSpace X] [OpensMeasurableSpace X] +diff --git a/Carleson/ToMathlib/BoundedFiniteSupport.lean b/Carleson/ToMathlib/BoundedFiniteSupport.lean +index 0d70eec..13329c5 100644 +--- a/Carleson/ToMathlib/BoundedFiniteSupport.lean ++++ b/Carleson/ToMathlib/BoundedFiniteSupport.lean +@@ -1,5 +1,7 @@ + import Mathlib.MeasureTheory.Function.L1Space.Integrable + ++/-! # Bounded functions with support of finite measure -/ ++ + /- + This file defines BoundedFiniteSupport. + +diff --git a/Carleson/ToMathlib/CoveredByBalls.lean b/Carleson/ToMathlib/CoveredByBalls.lean +index f763c0c..ad367d9 100644 +--- a/Carleson/ToMathlib/CoveredByBalls.lean ++++ b/Carleson/ToMathlib/CoveredByBalls.lean +@@ -1,5 +1,7 @@ + import Carleson.ToMathlib.Misc + ++/-! Covers by finitely many metric balls. -/ ++ + -- Upstreaming status: ready to go; two lemmas need to move to different files + -- and the remainder could go into a new file + +@@ -8,8 +10,6 @@ open scoped NNReal + + variable {X : Type*} [PseudoMetricSpace X] + {s t : Set X} {n m : ℕ} {r r' r₁ r₂ r₃ : ℝ} +- +-set_option linter.unusedVariables false in + /-- `s` can be covered by at most `N` balls with radius `r`. -/ + @[mk_iff] + class inductive CoveredByBalls (s : Set X) (n : ℕ) (r : ℝ) : Prop where +@@ -123,7 +123,7 @@ lemma pow {a : ℝ} {k : ℕ} (h : AllBallsCoverBalls X a n) : + AllBallsCoverBalls X (a ^ k) (n ^ k) := by + intro r + induction k with +- | zero => simpa using fun x ↦ .ball x r ++ | zero => simpa [BallsCoverBalls] using fun x ↦ CoveredByBalls.ball x r + | succ m h2 => + specialize h (r * a^m) + rw [← mul_assoc, mul_comm, ← mul_assoc] at h +diff --git a/Carleson/ToMathlib/Data/ENNReal.lean b/Carleson/ToMathlib/Data/ENNReal.lean +index 9884494..ede2520 100644 +--- a/Carleson/ToMathlib/Data/ENNReal.lean ++++ b/Carleson/ToMathlib/Data/ENNReal.lean +@@ -20,15 +20,6 @@ namespace ENNReal + attribute [simp] ofReal_of_nonpos + -- protect ENNReal.mul_le_mul_left + +-theorem ofReal_inv_le {x : ℝ} : ENNReal.ofReal x⁻¹ ≤ (ENNReal.ofReal x)⁻¹ := by +- obtain hx|hx := lt_or_ge 0 x <;> simp [ofReal_inv_of_pos, hx] +- +-theorem ofReal_div_le {x y : ℝ} (hy : 0 ≤ y) : +- ENNReal.ofReal (x / y) ≤ ENNReal.ofReal x / ENNReal.ofReal y := by +- simp_rw [div_eq_mul_inv, ofReal_mul' (inv_nonneg.2 hy)] +- gcongr +- exact ofReal_inv_le +- + theorem coe_lt_iff_lt_toNNReal {a : ℝ≥0∞} {t : ℝ≥0} (ha : a ≠ ⊤) : + t < a ↔ t < a.toNNReal := by + rw [← ENNReal.toNNReal_coe t, ENNReal.toNNReal_lt_toNNReal ENNReal.coe_ne_top ha] +@@ -110,7 +101,8 @@ lemma enorm_sum_eq_sum_enorm {f : α → ℝ} (hf : ∀ i ∈ t, 0 ≤ f i) : + + /-- The reverse triangle inequality for `enorm`. -/ + -- TODO: does a seminormed abelian additive group also have an ENormedAddMonoid structure? +-lemma enorm_enorm_sub_enorm_le {E} [NormedAddCommGroup E] {x y : E} : ‖‖x‖ₑ - ‖y‖ₑ‖ₑ ≤ ‖x - y‖ₑ := by ++lemma enorm_enorm_sub_enorm_le {E} [NormedAddCommGroup E] {x y : E} : ++ ‖‖x‖ₑ - ‖y‖ₑ‖ₑ ≤ ‖x - y‖ₑ := by + rw [enorm_eq_self, tsub_le_iff_right] + nth_rw 1 [← sub_add_cancel x y] + exact enorm_add_le (x - y) y +diff --git a/Carleson/ToMathlib/ENorm.lean b/Carleson/ToMathlib/ENorm.lean +index 92cb8f3..71b852b 100644 +--- a/Carleson/ToMathlib/ENorm.lean ++++ b/Carleson/ToMathlib/ENorm.lean +@@ -1,6 +1,8 @@ + import Mathlib.MeasureTheory.Function.LpSeminorm.Monotonicity + import Carleson.ToMathlib.Data.ENNReal + ++/-! # Extended norms and scalar multiplication of Lebesgue seminorms -/ ++ + -- Upstreaming status: can be upstreamed/being worked on + -- Many remaining declarations require PRing a new enorm class to mathlib first, + -- i.e. are not a good first target. +@@ -11,10 +13,11 @@ open ENNReal NNReal Function Set + + variable {α α' E E₁ E₂ : Type*} + +-@[simp] lemma enorm_toReal_le {x : ℝ≥0∞} : ‖x.toReal‖ₑ ≤ x := by simp [← ofReal_norm, ofReal_toReal_le] ++@[simp] lemma enorm_toReal_le {x : ℝ≥0∞} : ‖x.toReal‖ₑ ≤ x := by ++ simp [← ofReal_norm, ofReal_toReal_le] + + @[simp] lemma enorm_toReal {x : ℝ≥0∞} (hx : x ≠ ⊤) : ‖x.toReal‖ₑ = x := by +- simp [hx, ← ofReal_norm_eq_enorm] ++ simp [hx, ← ofReal_norm] + + @[simp] lemma enorm_NNReal {x : ℝ≥0} : ‖x‖ₑ = x := by rfl + +@@ -24,14 +27,16 @@ variable {α α' E E₁ E₂ : Type*} + + /-- An enormed monoid is an additive monoid endowed with a continuous enorm. + Note: not sure if this is the "right" class to add to Mathlib. -/ +-class ENormedAddCommSubMonoid (E : Type*) [TopologicalSpace E] extends ENormedAddCommMonoid E, Sub E where ++class ENormedAddCommSubMonoid (E : Type*) [TopologicalSpace E] ++ extends ENormedAddCommMonoid E, Sub E where + sub_add_cancel_of_enorm_le : ∀ ⦃x y : E⦄, ‖y‖ₑ ≤ ‖x‖ₑ → x - y + y = x + add_right_cancel_of_enorm_lt_top : ∀ ⦃x : E⦄, ‖x‖ₑ < ⊤ → ∀ {y z : E}, y + x = z + x → y = z + esub_self : ∀ x : E, x - x = 0 + + /-- An enormed space is an additive monoid endowed with a continuous enorm. + Note: not sure if this is the "right" class to add to Mathlib. -/ +-class ENormedSpace (E : Type*) [TopologicalSpace E] extends ENormedAddCommMonoid E, Module ℝ≥0 E where ++class ENormedSpace (E : Type*) [TopologicalSpace E] ++ extends ENormedAddCommMonoid E, Module ℝ≥0 E where + enorm_smul_eq_smul : ∀ (c : ℝ≥0) (x : E), ‖c • x‖ₑ = c • ‖x‖ₑ + + export ENormedAddCommSubMonoid +@@ -96,14 +101,63 @@ instance : ContinuousConstSMul ℝ≥0 ℝ≥0∞ where + + open MeasureTheory + ++/-- The norm-formula functional, without a strong-measurability requirement. -/ ++def eLpNormFormula {α ε : Type*} [MeasurableSpace α] [ENorm ε] (f : α → ε) (p : ℝ≥0∞) ++ (μ : Measure α) : ℝ≥0∞ := ++ if p = 0 then 0 else if p = ∞ then eLpNormEssSup f μ else eLpNorm' f p.toReal μ ++ ++theorem eLpNorm_eq_eLpNormFormula {α ε : Type*} [MeasurableSpace α] [TopologicalSpace ε] ++ [ENorm ε] {f : α → ε} ++ {p : ℝ≥0∞} {μ : Measure α} (hf : AEStronglyMeasurable f μ) : ++ eLpNorm f p μ = eLpNormFormula f p μ := by ++ simp [eLpNorm, eLpNormFormula, hf] ++ ++theorem eLpNormFormula_const_nnreal_smul_le {α : Type*} [MeasurableSpace α] ++ {p : ℝ≥0∞} {μ : Measure α} {c : ℝ≥0} {f : α → ε} : ++ eLpNormFormula (c • f) p μ ≤ ‖c‖ₑ * eLpNormFormula f p μ := by ++ have hbound : ∀ᵐ x ∂μ, ‖(c • f) x‖ₑ ≤ c * ‖f x‖ₑ := by ++ filter_upwards with point using by simp [ENNReal.smul_def] ++ by_cases hp : p = 0 ++ · simp [eLpNormFormula, hp] ++ by_cases htop : p = ∞ ++ · simpa [eLpNormFormula, hp, htop, ENNReal.smul_def] using ++ eLpNormEssSup_le_nnreal_smul_eLpNormEssSup_of_ae_le_mul' hbound ++ simpa [eLpNormFormula, hp, htop, ENNReal.smul_def] using ++ eLpNorm'_le_nnreal_smul_eLpNorm'_of_ae_le_mul' hbound (ENNReal.toReal_pos hp htop) ++ ++theorem eLpNormFormula_const_nnreal_smul {α : Type*} [MeasurableSpace α] ++ {p : ℝ≥0∞} {μ : Measure α} {c : ℝ≥0} {f : α → ε} : ++ eLpNormFormula (c • f) p μ = ‖c‖ₑ * eLpNormFormula f p μ := by ++ obtain rfl | hc := eq_or_ne c 0 ++ · rw [zero_smul, ← eLpNorm_eq_eLpNormFormula aestronglyMeasurable_zero] ++ simp ++ refine le_antisymm eLpNormFormula_const_nnreal_smul_le <| ENNReal.mul_le_of_le_div' ?_ ++ simpa [ENNReal.div_eq_inv_mul, hc] using ++ eLpNormFormula_const_nnreal_smul_le (c := c⁻¹) (f := c • f) ++ ++theorem eLpNorm_const_nnreal_smul_of_aestronglyMeasurable ++ {α : Type*} [MeasurableSpace α] {p : ℝ≥0∞} {μ : Measure α} {c : ℝ≥0} {f : α → ε} ++ (hf : AEStronglyMeasurable f μ) (hcf : AEStronglyMeasurable (c • f) μ) : ++ eLpNorm (c • f) p μ = ‖c‖ₑ * eLpNorm f p μ := by ++ rw [eLpNorm_eq_eLpNormFormula hf, eLpNorm_eq_eLpNormFormula hcf] ++ exact eLpNormFormula_const_nnreal_smul ++ + -- TODO: put next to MeasureTheory.eLpNorm_const_smul_le (which perhaps can stay) +-theorem eLpNorm_const_nnreal_smul_le {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} +- {μ : Measure α} {c : ℝ≥0} {f : α → ε} : eLpNorm (c • f) p μ ≤ ‖c‖ₑ * eLpNorm f p μ := by +- apply eLpNorm_le_nnreal_smul_eLpNorm_of_ae_le_mul' (p := p) ?_ +- filter_upwards with x using by simp [ENNReal.smul_def] ++theorem eLpNorm_const_nnreal_smul_le [ContinuousConstSMul ℝ≥0 ε] ++ {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} ++ {μ : Measure α} {c : ℝ≥0} {f : α → ε} : ++ eLpNorm (c • f) p μ ≤ ‖c‖ₑ * eLpNorm f p μ := by ++ by_cases hf : AEStronglyMeasurable f μ ++ · exact (eLpNorm_const_nnreal_smul_of_aestronglyMeasurable hf (hf.const_smul c)).le ++ rw [eLpNorm_of_not_aestronglyMeasurable hf] ++ obtain rfl | hc := eq_or_ne c 0 ++ · simp ++ · rw [ENNReal.mul_top (by simpa)] ++ exact le_top + + -- TODO: put next to eLpNorm_const_smul +-theorem eLpNorm_const_smul' {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} ++theorem eLpNorm_const_smul' [ContinuousConstSMul ℝ≥0 ε] ++ {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} + {μ : Measure α} {c : ℝ≥0} {f : α → ε} : + eLpNorm (c • f) p μ = ‖c‖ₑ * eLpNorm f p μ := by + obtain rfl | hc := eq_or_ne c 0 +@@ -113,21 +167,24 @@ theorem eLpNorm_const_smul' {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0 + + set_option backward.isDefEq.respectTransparency false in + theorem eLpNorm_top_smul {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} +- {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEStronglyMeasurable f μ) : eLpNorm (∞ • f) p μ = ⊤ * eLpNorm f p μ := by ++ {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEStronglyMeasurable f μ) : ++ eLpNorm (∞ • f) p μ = ⊤ * eLpNorm f p μ := by ++ have htop : AEStronglyMeasurable (∞ • f) μ := ++ (hf.aemeasurable.const_mul ∞).aestronglyMeasurable + by_cases hp : p = 0 +- · simp [hp] ++ · simp [hp, hf, htop] + by_cases h : f =ᶠ[ae μ] 0 + · rw [eLpNorm_eq_zero_of_ae_zero h, mul_zero] + apply eLpNorm_eq_zero_of_ae_zero + filter_upwards [h] with x hx + simpa + · have : ¬ eLpNorm f p μ = 0 := by +- rwa [eLpNorm_eq_zero_iff hf hp] ++ rwa [eLpNorm_eq_zero_iff hp] + by_cases h' : eLpNorm f p μ = ⊤ + · simp only [h', ne_eq, top_ne_zero, not_false_eq_true, mul_top] + rw [eq_top_iff] at * + apply h'.trans +- apply eLpNorm_mono_enorm ++ apply eLpNorm_mono_enorm hf + intro x + simp only [enorm_eq_self, Pi.smul_apply, smul_eq_mul] + exact ENNReal.le_mul_top_self +@@ -145,7 +202,7 @@ theorem eLpNorm_top_smul {α : Type*} {m0 : MeasurableSpace α} {p : ℝ≥0∞} + congr + exact Eq.symm (coe_toNNReal h') + _ ≤ eLpNorm (∞ • f) p μ := by +- apply eLpNorm_mono_enorm ++ apply eLpNorm_mono_enorm (hf.const_smul _) + intro x + simp only [toNNReal_div, toNNReal_coe, Pi.smul_apply, enorm_smul_eq_smul, enorm_eq_self, + smul_eq_mul] +diff --git a/Carleson/ToMathlib/HardyLittlewood.lean b/Carleson/ToMathlib/HardyLittlewood.lean +index 5982df5..e3d46e3 100644 +--- a/Carleson/ToMathlib/HardyLittlewood.lean ++++ b/Carleson/ToMathlib/HardyLittlewood.lean +@@ -5,13 +5,13 @@ import Carleson.ToMathlib.Order.ConditionallyCompleteLattice.Indexed + import Mathlib.MeasureTheory.Covering.Vitali + import Mathlib.Tactic.Field + ++/-! This should roughly contain the contents of chapter 9. -/ ++ + open MeasureTheory Metric Bornology Set TopologicalSpace Vitali Filter Pointwise + open ENNReal hiding one_lt_two + open scoped NNReal + noncomputable section + +-/-! This should roughly contain the contents of chapter 9. -/ +- + -- Upstreaming status: aside from getting the real interpolation theorem merged, + -- this file needs a bunch of clean-up before it can be upstreamed: + -- moving preliminary lemmas to their appropriate homes (some of these lemmas do not belong in +@@ -46,7 +46,8 @@ lemma exists_ball_subset_ball_two (c : X) {r : ℝ} (hr : 0 < r) : + exact (Real.rpow_intCast 2 m).symm + _ = _ := Real.rpow_logb zero_lt_two (OfNat.one_ne_ofNat 2).symm hr + have hm' : r < 2 ^ (m + 1) := by +- calc _ = (2 : ℝ) ^ Real.logb 2 r := (Real.rpow_logb zero_lt_two (OfNat.one_ne_ofNat 2).symm hr).symm ++ calc _ = (2 : ℝ) ^ Real.logb 2 r := ++ (Real.rpow_logb zero_lt_two (OfNat.one_ne_ofNat 2).symm hr).symm + _ < _ := by + rw [← Real.rpow_intCast 2 (m + 1)] + refine Real.strictMono_rpow_of_base_gt_one one_lt_two ?_ +@@ -87,7 +88,8 @@ variable {X E : Type*} {A : ℝ≥0} [MetricSpace X] [MeasurableSpace X] + open scoped Topology in + -- unused in Carleson + -- move to separate file (not sure where) +-lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] (hf2 : AEStronglyMeasurable f μ) : ++lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] ++ (hf2 : AEStronglyMeasurable f μ) : + LowerSemicontinuousOn (fun x : X × ℝ ↦ ∫⁻ y in ball x.1 x.2, ‖f y‖ₑ ∂μ) (univ ×ˢ Ioi 0) := by + refine lowerSemicontinuousOn_iff_le_liminf.mpr fun x hx ↦ _root_.le_of_forall_pos_le_add ?_ + intro δ hδ +@@ -98,7 +100,7 @@ lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] (hf2 : AEStro + (𝓝[univ ×ˢ Ioi 0] x) < M := lt_add_right htop hδ.ne' + have : ∃ᶠ (z : X × ℝ) in 𝓝[univ ×ˢ Ioi 0] x, ∫⁻ (y : X) in ball z.1 z.2, ‖f y‖ₑ ∂μ < M := by + refine frequently_lt_of_liminf_lt ?_ hM +- simp only [IsCoboundedUnder, Filter.IsCobounded, ge_iff_le, eventually_map] ++ simp only [IsCoboundedUnder, Filter.IsCobounded, eventually_map] + use ∫⁻ (y : X) in ball x.1 x.2, ‖f y‖ₑ ∂μ + intro a ha; apply Eventually.self_of_nhdsWithin ha hx + obtain ⟨ns, hns₀, hns₁⟩ := +@@ -117,7 +119,8 @@ lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] (hf2 : AEStro + have : ∀ᶠ (n : ℕ) in atTop, dist z (ns n).1 - (ns n).2 < 0 := by + rw [mem_ball, ← sub_lt_zero] at hz; exact Tendsto.eventually_lt_const hz this + filter_upwards [this]; simp +- filter_upwards [hz2]; intro a ha; split_ifs; rfl ++ filter_upwards [hz2] with index hindex ++ simp only [hindex, ↓reduceIte, le_refl] + · simp + calc + ∫⁻ (y : X) in ball x.1 x.2, ‖f y‖ₑ ∂μ +@@ -129,7 +132,7 @@ lemma lowerSemiContinuousOn_integral_ball [OpensMeasurableSpace X] (hf2 : AEStro + _ ≤ M := by + apply liminf_le_of_le (f := atTop) + intro b hb +- simp only [eventually_atTop, ge_iff_le] at hb ++ simp only [eventually_atTop] at hb + obtain ⟨a, ha⟩ := hb + exact le_of_lt <| lt_of_le_of_lt (ha a le_rfl) <| + by unfold g; rw [lintegral_indicator measurableSet_ball]; exact hns₁ a +@@ -199,11 +202,11 @@ lemma continuous_integral_ball [OpensMeasurableSpace X] + have hz' : Tendsto z atTop (𝓝 x) := tendsto_nhds_of_tendsto_nhdsWithin hz + have := isBounded_range_of_tendsto z hz' + obtain ⟨r, hr⟩ := Bornology.IsBounded.subset_ball this x +- simp only [range, ball, setOf_subset_setOf, forall_exists_index, forall_apply_eq_imp_iff] at hr ++ simp only [range, ball, ofPred_subset_ofPred, forall_exists_index, forall_apply_eq_imp_iff] at hr + simp_rw [Prod.dist_eq] at hr + have hsub (n : ℕ) : ball (z n).1 (z n).2 ⊆ ball x.1 (x.2 + 2 * r) := by + intro y hy +- simp only [ball, mem_setOf_eq] at hy ⊢ ++ simp only [ball, mem_ofPred_eq] at hy ⊢ + calc dist y x.1 + _ ≤ dist y (z n).1 + dist (z n).1 x.1 := dist_triangle y (z n).1 x.1 + _ ≤ (z n).2 + dist (z n).1 x.1 := by gcongr +@@ -246,11 +249,10 @@ lemma continuous_integral_ball [OpensMeasurableSpace X] + linarith + · have : ∀ᵐ z : X ∂μ, dist z x.1 ≠ x.2 := by + change (μ ({z | ¬ (dist z x.1 ≠ x.2)}) = 0) +- simpa only [ne_eq, Decidable.not_not] using hμ x.1 x.2 hx_pos ++ simpa only [sphere, ne_eq, Decidable.not_not] using hμ x.1 x.2 hx_pos + filter_upwards [this] with y hy + by_cases hy2 : dist y x.1 < x.2 +- · simp only [indicator, ball, mem_setOf_eq] +- split_ifs ++ · simp only [indicator, ball, mem_ofPred_eq] + apply tendsto_nhds_of_eventually_eq + have hz2 : ∀ᶠ n : ℕ in atTop, dist y (z n).1 < (z n).2 := by + let dist_sub (a : X × ℝ) := dist y a.1 - a.2 +@@ -259,24 +261,27 @@ lemma continuous_integral_ball [OpensMeasurableSpace X] + have : ∀ᶠ (n : ℕ) in atTop, dist y (z n).1 - (z n).2 < 0 := by + rw [← sub_lt_zero] at hy2; exact Tendsto.eventually_lt_const hy2 this + filter_upwards [this]; simp +- filter_upwards [hz2]; intro a ha; split_ifs; rfl ++ filter_upwards [hz2] with index hindex ++ simp only [hindex, hy2, ↓reduceIte] + · have hz2 : ∀ᶠ n : ℕ in atTop, dist y (z n).1 > (z n).2 := by + let dist_sub (a : X × ℝ) := dist y a.1 - a.2 + have : ContinuousOn dist_sub (univ ×ˢ Ioi 0) := by fun_prop + have hcmp : Tendsto (dist_sub ∘ z) atTop (𝓝 (dist_sub x)) := Tendsto.comp (this x hx) hz + have hy2 : dist y x.1 > x.2 := by order + have hy2 : 0 < dist y x.1 - x.2 := sub_pos.mpr hy2 +- have : ∀ᶠ (n : ℕ) in atTop, 0 < dist y (z n).1 - (z n).2 := Tendsto.eventually_const_lt hy2 hcmp ++ have : ∀ᶠ (n : ℕ) in atTop, 0 < dist y (z n).1 - (z n).2 := ++ Tendsto.eventually_const_lt hy2 hcmp + filter_upwards [this]; simp +- simp only [indicator, ball, mem_setOf_eq] ++ simp only [indicator, ball, mem_ofPred_eq] + apply tendsto_nhds_of_eventually_eq + filter_upwards [hz2] with n hn + have : ¬ (dist y (z n).1 < (z n).2) := by linarith +- split_ifs; rfl ++ simp only [this, hy2, ↓reduceIte] + + -- unused in Carleson + -- move to separate file (not sure where) +-lemma continuous_average_ball [μ.IsOpenPosMeasure] [IsFiniteMeasureOnCompacts μ] [OpensMeasurableSpace X] ++lemma continuous_average_ball [μ.IsOpenPosMeasure] [IsFiniteMeasureOnCompacts μ] ++ [OpensMeasurableSpace X] + [ProperSpace X] (hf : LocallyIntegrable f μ) + (hμ : ∀ z : X, ∀ r > (0 : ℝ), μ (sphere z r) = 0) : + ContinuousOn (fun x : X × ℝ ↦ ⨍⁻ y in ball x.1 x.2, ‖f y‖ₑ ∂μ) (univ ×ˢ Ioi 0) := by +@@ -368,7 +373,7 @@ theorem exists_disjoint_subfamily_covering_enlargement_closedBall' {α} [MetricS + exact h'a.le.trans <| by positivity + + -- move to Vitali +-theorem Vitali.exists_disjoint_subfamily_covering_enlargement_ball {α} [MetricSpace α] (t : Set ι) ++theorem Vitali.exists_disjoint_subfamily_covering_enlargement_ball' {α} [MetricSpace α] (t : Set ι) + (x : ι → α) (r : ι → ℝ) (R : ℝ) (hr : ∀ a ∈ t, r a ≤ R) (τ : ℝ) (hτ : 3 < τ) : + ∃ u ⊆ t, + (u.PairwiseDisjoint fun a => ball (x a) (r a)) ∧ +@@ -402,7 +407,7 @@ theorem Set.Countable.measure_biUnion_le_lintegral [OpensMeasurableSpace X] (h + (l : ℝ≥0∞) (u : X → ℝ≥0∞) (R : ℝ) (hR : ∀ a ∈ 𝓑, r a ≤ R) + (h2u : ∀ i ∈ 𝓑, l * μ (ball (c i) (r i)) ≤ ∫⁻ x in ball (c i) (r i), u x ∂μ) : + l * μ (⋃ i ∈ 𝓑, ball (c i) (r i)) ≤ A ^ 2 * ∫⁻ x, u x ∂μ := by +- obtain ⟨B, hB𝓑, hB, h2B⟩ := Vitali.exists_disjoint_subfamily_covering_enlargement_ball ++ obtain ⟨B, hB𝓑, hB, h2B⟩ := Vitali.exists_disjoint_subfamily_covering_enlargement_ball' + 𝓑 c r R hR (2 ^ 2) (by norm_num) + have : Countable B := h𝓑.mono hB𝓑 + have disj := fun i j hij ↦ +@@ -473,20 +478,22 @@ theorem MB_le_eLpNormEssSup {u : X → E} {x : X} : MB μ 𝓑 c r u x ≤ eLpNo + + protected theorem HasStrongType.MB_top [BorelSpace X] : + HasStrongType (fun (u : X → E) (x : X) ↦ MB μ 𝓑 c r u x) ⊤ ⊤ μ μ 1 := by +- intro f _ ++ intro f hf + use Measurable.maximalFunction.aestronglyMeasurable +- simp only [one_mul, eLpNorm_exponent_top] ++ rw [one_mul, eLpNorm_exponent_top Measurable.maximalFunction.aestronglyMeasurable, ++ eLpNorm_exponent_top hf.aestronglyMeasurable] + exact essSup_le_of_ae_le _ (Eventually.of_forall fun x ↦ MB_le_eLpNormEssSup) + + /- The proof is roughly between (9.0.12)-(9.0.22). -/ + protected theorem HasWeakType.MB_one [BorelSpace X] (h𝓑 : 𝓑.Countable) + {R : ℝ} (hR : ∀ i ∈ 𝓑, r i ≤ R) : + HasWeakType (MB (E := E) μ 𝓑 c r) 1 1 μ μ (A ^ 2) := by +- intro f _ ++ intro f hf + use Measurable.maximalFunction.aestronglyMeasurable + let Bₗ (ℓ : ℝ≥0∞) := { i ∈ 𝓑 | ∫⁻ y in (ball (c i) (r i)), ‖f y‖ₑ ∂μ ≥ ℓ * μ (ball (c i) (r i)) } +- simp only [wnorm, one_ne_top, wnorm', toReal_one, inv_one, ENNReal.rpow_one, reduceIte, eLpNorm, +- one_ne_zero, eLpNorm', ne_eq, not_false_eq_true, div_self, iSup_le_iff] ++ rw [eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable] ++ simp only [wnorm, one_ne_top, wnorm', toReal_one, inv_one, ENNReal.rpow_one, reduceIte, ++ iSup_le_iff] + intro t + by_cases ht : t = 0 + · simp [ht] +@@ -495,17 +502,19 @@ protected theorem HasWeakType.MB_one [BorelSpace X] (h𝓑 : 𝓑.Countable) + (u := fun x ↦ ‖f x‖ₑ) (R := R) ?_ ?_) + · refine mul_right_mono <| μ.mono (fun x hx ↦ mem_iUnion₂.mpr ?_) + -- We need a ball in `Bₗ t` containing `x`. Since `MB μ 𝓑 c r f x` is large, such a ball exists +- simp only [mem_setOf_eq] at hx ++ simp only [mem_ofPred_eq] at hx + -- replace hx := lt_of_lt_of_le hx coe_toNNReal_le_self + simp only [MB, maximalFunction, ENNReal.rpow_one, inv_one] at hx + obtain ⟨i, ht⟩ := lt_iSup_iff.mp hx +- replace hx : x ∈ ball (c i) (r i) := +- by_contradiction <| fun h ↦ not_lt_of_ge (zero_le t) (ENNReal.coe_lt_coe.mp <| by simp [h] at ht) ++ replace hx : x ∈ ball (c i) (r i) := by ++ by_contra hball ++ simp [hball] at ht + refine ⟨i, ?_, hx⟩ + -- It remains only to confirm that the chosen ball is actually in `Bₗ t` +- simp only [ge_iff_le, mem_setOf_eq, Bₗ] +- have hi : i ∈ 𝓑 := +- by_contradiction <| fun h ↦ not_lt_of_ge (zero_le t) (ENNReal.coe_lt_coe.mp <| by simp [h] at ht) ++ simp only [ge_iff_le, mem_ofPred_eq, Bₗ] ++ have hi : i ∈ 𝓑 := by ++ by_contra hindex ++ simp [hindex] at ht + exact ⟨hi, mul_le_of_le_div <| le_of_lt (by simpa [setLAverage_eq, hi, hx] using ht)⟩ + · exact fun i hi ↦ hR i (mem_of_mem_inter_left hi) + · exact fun i hi ↦ hi.2.trans (setLIntegral_mono' measurableSet_ball fun x _ ↦ by simp) +@@ -519,8 +528,8 @@ theorem MB_ae_ne_top [BorelSpace X] (h𝓑 : 𝓑.Countable) + -- move + lemma MeasureTheory.MemLp.eLpNormEssSup_lt_top {α} [MeasurableSpace α] {μ : Measure α} + {u : α → E} (hu : MemLp u ⊤ μ) : eLpNormEssSup u μ < ⊤ := by +- simp_rw [MemLp, eLpNorm_exponent_top] at hu +- exact hu.2 ++ rw [← eLpNorm_exponent_top hu.aestronglyMeasurable] ++ exact hu + + include A in + theorem MB_ae_ne_top' [BorelSpace X] (h𝓑 : 𝓑.Countable) +@@ -626,7 +635,8 @@ This is a special case of `hasStrongType_maximalFunction` below, which doesn't h + `hR` (but uses this result in its proof). -/ + theorem hasStrongType_maximalFunction_aux + [BorelSpace X] [IsFiniteMeasureOnCompacts μ] [ProperSpace X] [Nonempty X] [μ.IsOpenPosMeasure] +- {p₁ p₂ : ℝ≥0} (h𝓑 : 𝓑.Countable) {R : ℝ} (hR : ∀ i ∈ 𝓑, r i ≤ R) (hp₁ : 0 < p₁) (hp₁₂ : p₁ < p₂) : ++ {p₁ p₂ : ℝ≥0} (h𝓑 : 𝓑.Countable) {R : ℝ} (hR : ∀ i ∈ 𝓑, r i ≤ R) ++ (hp₁ : 0 < p₁) (hp₁₂ : p₁ < p₂) : + HasStrongType (fun (u : X → E) (x : X) ↦ maximalFunction μ 𝓑 c r p₁ u x) + p₂ p₂ μ μ (C2_0_6 A p₁ p₂) := fun v mlpv ↦ by + refine ⟨Measurable.maximalFunction.aestronglyMeasurable, ?_⟩; dsimp only +@@ -635,7 +645,8 @@ theorem hasStrongType_maximalFunction_aux + conv_lhs => + enter [1, x] + rw [maximalFunction_eq_MB cp₁p, ← enorm_eq_self (MB ..)] +- rw [eLpNorm_enorm_rpow _ (by positivity), ENNReal.ofReal_inv_of_pos cp₁p, ++ rw [eLpNorm_enorm_rpow _ Measurable.maximalFunction.aestronglyMeasurable (by positivity), ++ ENNReal.ofReal_inv_of_pos cp₁p, + ENNReal.ofReal_coe_nnreal, ← div_eq_mul_inv, ← ENNReal.coe_div p₁n] + calc + _ ≤ (CMB A (p₂ / p₁) * eLpNorm (fun y ↦ ‖v y‖ ^ (p₁ : ℝ)) (p₂ / p₁) μ) ^ p₁.toReal⁻¹ := by +@@ -645,7 +656,8 @@ theorem hasStrongType_maximalFunction_aux + · rwa [lt_div_iff₀, one_mul]; exact cp₁p + · rw [ENNReal.coe_div p₁n]; exact mlpv.norm_rpow_div p₁ + _ = _ := by +- rw [ENNReal.mul_rpow_of_nonneg _ _ (by positivity), eLpNorm_norm_rpow _ cp₁p, ++ rw [ENNReal.mul_rpow_of_nonneg _ _ (by positivity), ++ eLpNorm_norm_rpow _ mlpv.aestronglyMeasurable cp₁p, + ENNReal.ofReal_coe_nnreal, ENNReal.div_mul_cancel (by positivity) (by simp), + ENNReal.rpow_rpow_inv (by positivity), ← ENNReal.coe_rpow_of_nonneg _ (by positivity), + C2_0_6] +@@ -680,7 +692,8 @@ lemma maximalFunction_seq_mono {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {p : ℝ + obtain ⟨w, hw⟩ := Hi + exact ⟨w, hw.1.trans hmn, hw.2⟩ + +-lemma maximalFunction_seq_eq {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {p : ℝ≥0} (hp : 0 < p) (u : X → E) (x : X) : ++lemma maximalFunction_seq_eq {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {p : ℝ≥0} ++ (hp : 0 < p) (u : X → E) (x : X) : + maximalFunction μ 𝓑 c r (↑p) u x = + ⨆ k : ℕ, maximalFunction_seq μ h𝓑 c r (↑p) u k x := by + let g := Classical.choose (Set.countable_iff_exists_injective.mp h𝓑) +@@ -694,7 +707,7 @@ lemma maximalFunction_seq_eq {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {p : ℝ + let k₀ := g ⟨i, Hi⟩ + have k₀large : i ∈ 𝓑' k₀ := by + unfold 𝓑' +- simp only [preimage_setOf_eq, mem_image, mem_setOf_eq, Subtype.exists, exists_and_right, ++ simp only [preimage_ofPred_eq, mem_image, mem_ofPred_eq, Subtype.exists, exists_and_right, + exists_eq_right] + use Hi + calc +@@ -733,13 +746,10 @@ theorem hasStrongType_maximalFunction + obtain ⟨R, hR⟩ := Finite.exists_image_le (tr_finite h𝓑 k) r + exact (hasStrongType_maximalFunction_aux (c := c) + (Finite.countable (tr_finite h𝓑 k)) hR hp₁ hp₁₂ v mlpv).2 +- unfold eLpNorm +- split_ifs with h₀ +- · simp +- · have h : ENNReal.ofNNReal p₂ = ⊤ := by assumption +- simp at h +- · unfold eLpNorm' +- calc ++ rw [eLpNorm_eq_eLpNorm' (coe_ne_zero.mpr (ne_zero_of_lt hp₁₂)) coe_ne_top ++ Measurable.maximalFunction.aestronglyMeasurable] ++ unfold eLpNorm' ++ calc + _ = (∫⁻ (a : X), (⨆ k, maximalFunction_seq μ h𝓑 c r (↑p₁) v k a) ^ (ofNNReal p₂).toReal ∂μ) + ^ (1 / (ofNNReal p₂).toReal) := by + congr; ext x; congr; exact maximalFunction_seq_eq h𝓑 hp₁ v x +@@ -771,11 +781,11 @@ theorem hasStrongType_maximalFunction + intro k + apply (rpow_le_rpow_iff hp₂inv_pos).mp + rw [ENNReal.rpow_rpow_inv hp₂neq_zero] +- unfold eLpNorm at hestfin +- split_ifs at hestfin +- unfold eLpNorm' at hestfin +- rw [one_div] at hestfin +- exact hestfin k ++ have hest := hestfin k ++ simp only [maximalFunction_seq] at hest ++ rw [eLpNorm_eq_eLpNorm' (coe_ne_zero.mpr (ne_zero_of_lt hp₁₂)) coe_ne_top ++ Measurable.maximalFunction.aestronglyMeasurable, eLpNorm', one_div] at hest ++ simpa only [maximalFunction_seq, enorm_eq_self] using hest + + theorem hasWeakType_maximalFunction_equal_exponents₀ [BorelSpace X] + {p : ℝ≥0} (h𝓑 : 𝓑.Countable) {R : ℝ} (hR : ∀ i ∈ 𝓑, r i ≤ R) (hp : 0 < p) : +@@ -789,11 +799,12 @@ theorem hasWeakType_maximalFunction_equal_exponents₀ [BorelSpace X] + conv_lhs => + enter [1, x] + rw [maximalFunction_eq_MB cp] +- have hmb_one : wnorm (MB μ 𝓑 c r fun x ↦ ‖v x‖ ^ (p : ℝ)) 1 μ ≤ ↑A ^ 2 * eLpNorm (fun x ↦ ‖v x‖ ^ (p : ℝ)) 1 μ := by ++ have hmb_one : wnorm (MB μ 𝓑 c r fun x ↦ ‖v x‖ ^ (p : ℝ)) 1 μ ≤ ++ ↑A ^ 2 * eLpNorm (fun x ↦ ‖v x‖ ^ (p : ℝ)) 1 μ := by + apply (HasWeakType.MB_one h𝓑 hR + (fun x : X ↦ ‖v x‖ ^ (p : ℝ)) _).2 +- convert MemLp.norm_rpow_div mlpv p +- exact Eq.symm (ENNReal.div_self (coe_ne_zero.mpr p₁n) coe_ne_top) ++ simpa only [coe_toReal, ENNReal.div_self (coe_ne_zero.mpr p₁n) coe_ne_top] ++ using mlpv.norm_rpow_div p + unfold wnorm wnorm' distribution at hmb_one ⊢ + simp only [one_ne_top, ↓reduceIte, enorm_eq_self, toReal_one, inv_one, rpow_one, iSup_le_iff, + coe_ne_top, coe_toReal] at hmb_one ⊢ +@@ -806,7 +817,8 @@ theorem hasWeakType_maximalFunction_equal_exponents₀ [BorelSpace X] + · exact Eq.symm (coe_rpow_of_ne_zero ht ↑p) + · rw [rpow_inv_rpow (NNReal.coe_ne_zero.mpr p₁n)] + congr; ext x; rw [coe_rpow_of_ne_zero ht ↑p]; exact (lt_rpow_inv_iff cp) +- · rw [eLpNorm_norm_rpow v cp, ENNReal.mul_rpow_of_nonneg _ _ NNReal.zero_le_coe, ++ · rw [eLpNorm_norm_rpow v mlpv.aestronglyMeasurable cp, ++ ENNReal.mul_rpow_of_nonneg _ _ NNReal.zero_le_coe, + div_eq_mul_inv, rpow_mul, rpow_inv_rpow (NNReal.coe_ne_zero.mpr p₁n), rpow_two]; simp + + theorem hasWeakType_maximalFunction_equal_exponents +@@ -839,13 +851,14 @@ theorem hasWeakType_maximalFunction_equal_exponents + have f_mon : Monotone f := by + refine fun a b hab x ↦ iSup₂_le fun i Hi ↦ ?_ + apply le_iSup₂ (f := fun j _ ↦ (ball (c j) (r j)).indicator +- (fun x ↦ (⨍⁻ (y : X) in ball (c j) (r j), ‖v y‖ₑ ^ (ofNNReal p).toReal ∂μ) ^ (ofNNReal p).toReal⁻¹) x) ++ (fun x ↦ (⨍⁻ (y : X) in ball (c j) (r j), ‖v y‖ₑ ^ (ofNNReal p).toReal ∂μ) ^ ++ (ofNNReal p).toReal⁻¹) x) + obtain ⟨w, hw⟩ := Hi; use w; exact ⟨hw.1.trans hab, hw.2⟩ + intro t + have hm : + Monotone (fun k ↦ {x | (t : ℝ≥0∞) < ‖maximalFunction μ (tr h𝓑 k) c r p v x‖ₑ}) := by + intro m n hmn x +- simp only [enorm_eq_self, mem_setOf_eq] ++ simp only [enorm_eq_self, mem_ofPred_eq] + exact fun ht ↦ ht.trans_le (f_mon hmn x) + apply (rpow_le_rpow_iff p_pos).mp + rw [ENNReal.mul_rpow_of_nonneg _ _ (by positivity), rpow_inv_rpow p_pos.ne'] +@@ -884,7 +897,7 @@ theorem hasWeakType_maximalFunction + split_ifs with hps + · rw [← hps] + exact hasWeakType_maximalFunction_equal_exponents (A := A) h𝓑 hp₁ +- · apply HasStrongType.hasWeakType (coe_lt_coe_of_lt (hp₁.trans_le hp₁₂)) ++ · apply HasStrongType.hasWeakType (coe_lt_coe.mpr (hp₁.trans_le hp₁₂)) + exact hasStrongType_maximalFunction h𝓑 hp₁ (lt_of_le_of_ne hp₁₂ hps) + + section GMF +@@ -894,8 +907,8 @@ variable [ProperSpace X] + variable (μ) in + /-- The transformation `M` characterized in Proposition 2.0.6. + `p` is `1` in the blueprint, and `globalMaximalFunction μ p u = (M (u ^ p)) ^ p⁻¹ ` -/ +-@[nolint unusedArguments] +-def globalMaximalFunction [μ.IsDoubling A] (p : ℝ) (u : X → E) (x : X) : ℝ≥0∞ := ++def globalMaximalFunction (p : ℝ) (u : X → E) (x : X) : ℝ≥0∞ := ++ let _ := ‹μ.IsDoubling A› + A ^ 2 * maximalFunction μ ((covering_separable_space X).choose ×ˢ (univ : Set ℤ)) + (·.1) (fun x ↦ 2 ^ (x.2)) p u x + +@@ -930,7 +943,8 @@ theorem laverage_le_globalMaximalFunction [IsFiniteMeasureOnCompacts μ] [μ.IsO + refine (le_iSup₂ (c, m) hc).trans_eq' ?_ + simp [laverage, indicator_of_mem (h_subset h)] + +-theorem lintegral_ball_le_volume_globalMaximalFunction [IsFiniteMeasureOnCompacts μ] [μ.IsOpenPosMeasure] ++theorem lintegral_ball_le_volume_globalMaximalFunction [IsFiniteMeasureOnCompacts μ] ++ [μ.IsOpenPosMeasure] + {u : X → E} {z x : X} {r : ℝ} (h : dist x z < r) : + ∫⁻ y in (ball z r), ‖u y‖ₑ ∂μ ≤ μ (ball z r) * globalMaximalFunction μ 1 u x := by + have : IsFiniteMeasure (μ.restrict (ball z r)) := isFiniteMeasure_restrict.mpr (by finiteness) +@@ -942,7 +956,8 @@ theorem lintegral_ball_le_volume_globalMaximalFunction [IsFiniteMeasureOnCompact + /-- The constant factor in the statement that `M` has strong type. -/ + def C2_0_6' (A p₁ p₂ : ℝ≥0) : ℝ≥0 := A ^ 2 * C2_0_6 A p₁ p₂ + +-lemma C2_0_6'_defaultA_one_two_eq {a : ℕ} : C2_0_6' (defaultA a) 1 2 = 2 ^ (3 * a + 3 / (2 : ℝ)) := by ++lemma C2_0_6'_defaultA_one_two_eq {a : ℕ} : ++ C2_0_6' (defaultA a) 1 2 = 2 ^ (3 * a + 3 / (2 : ℝ)) := by + simp_rw [C2_0_6', C2_0_6, div_one, CMB_defaultA_two_eq, defaultA, Nat.cast_pow, Nat.cast_ofNat, + NNReal.coe_one, inv_one, NNReal.rpow_one, ← pow_mul, ← NNReal.rpow_natCast] + rw [← NNReal.rpow_add (by simp)] +@@ -984,9 +999,12 @@ theorem hasWeakType_globalMaximalFunction [BorelSpace X] [IsFiniteMeasureOnCompa + [μ.IsOpenPosMeasure] {p₁ p₂ : ℝ≥0} (hp₁ : 0 < p₁) (hp₁₂ : p₁ ≤ p₂) : + HasWeakType (globalMaximalFunction μ p₁ (E := E)) + p₂ p₂ μ μ (C_weakType_globalMaximalFunction A p₁ p₂) := by +- convert HasWeakType.const_mul (c := C_weakType_maximalFunction A p₁ p₂) (e := A ^ 2) +- (coe_ne_zero.mpr (hp₁.trans_le hp₁₂).ne') _ +- exact hasWeakType_maximalFunction countable_globalMaximalFunction hp₁ hp₁₂ ++ convert ++ (hasWeakType_maximalFunction (μ := μ) (E := E) (c := (·.1)) (r := fun x ↦ 2 ^ x.2) ++ countable_globalMaximalFunction hp₁ hp₁₂).const_mul ++ (coe_ne_zero.mpr (hp₁.trans_le hp₁₂).ne') (A ^ 2) using 1 <;> ++ simp only [C_weakType_globalMaximalFunction, ENNReal.coe_pow] ++ rfl + + /-- Use `lowerSemiContinuous_MB` -/ + lemma lowerSemiContinuous_globalMaximalFunction : +diff --git a/Carleson/ToMathlib/Interval.lean b/Carleson/ToMathlib/Interval.lean +index 948f0cd..a07c341 100644 +--- a/Carleson/ToMathlib/Interval.lean ++++ b/Carleson/ToMathlib/Interval.lean +@@ -1,7 +1,13 @@ +-import Mathlib.Data.Set.Lattice ++import Mathlib.Data.Set.Lattice.Bounded ++import Mathlib.Data.Set.Lattice.Disjoint ++import Mathlib.Data.Set.Lattice.Image ++import Mathlib.Data.Set.Lattice.Indexed ++import Mathlib.Data.Set.Lattice.Order + import Mathlib.Order.SuccPred.Basic + import Mathlib.Tactic.Common + ++/-! # Interval inclusions, unions, and disjointness -/ ++ + -- Upstreaming status: results seem useful in general, some should be generalised + + open Function Order Set +diff --git a/Carleson/ToMathlib/MeasureTheory/Integral/Average.lean b/Carleson/ToMathlib/MeasureTheory/Integral/Average.lean +index 2e68964..0188672 100644 +--- a/Carleson/ToMathlib/MeasureTheory/Integral/Average.lean ++++ b/Carleson/ToMathlib/MeasureTheory/Integral/Average.lean +@@ -1,5 +1,7 @@ + import Mathlib.MeasureTheory.Integral.Average + ++/-! # Monotonicity and essential supremum bounds for lower averages -/ ++ + -- Upstreaming status: upstreamed in https://github.com/leanprover-community/mathlib4/pull/37551 + + open MeasureTheory MeasureTheory.Measure Filter Set +@@ -12,22 +14,23 @@ lemma laverage_mono_ae {f g : α → ℝ≥0∞} (h : ∀ᵐ a ∂μ, f a ≤ g + ⨍⁻ a, f a ∂μ ≤ ⨍⁻ a, g a ∂μ := + lintegral_mono_ae <| h.filter_mono <| Measure.ae_mono' Measure.smul_absolutelyContinuous + +-@[gcongr] ++@[gcongr only] + lemma setLAverage_mono_ae {f g : α → ℝ≥0∞} (h : ∀ᵐ a ∂μ, f a ≤ g a) : + ⨍⁻ a in s, f a ∂μ ≤ ⨍⁻ a in s, g a ∂μ := +- laverage_mono_ae <| h.filter_mono <| ae_mono Measure.restrict_le_self ++ _root_.laverage_mono_ae <| h.filter_mono <| ae_mono Measure.restrict_le_self + + lemma setLAverage_le_essSup (f : α → ℝ≥0∞) : ⨍⁻ x in s, f x ∂μ ≤ essSup f μ := by + by_cases hμ : IsFiniteMeasure (μ.restrict s); swap + · simp [laverage, not_isFiniteMeasure_iff.mp hμ] + by_cases hμ0 : μ s = 0 + · rw [laverage, ← setLIntegral_univ] +- exact le_of_eq_of_le (setLIntegral_measure_zero univ f <| by simp [hμ0]) (zero_le (essSup f μ)) +- apply le_of_le_of_eq (laverage_mono_ae <| Eventually.filter_mono ae_restrict_le ae_le_essSup) ++ exact le_of_eq_of_le (setLIntegral_measure_zero univ f <| by simp [hμ0]) zero_le ++ apply le_of_le_of_eq (_root_.laverage_mono_ae <| ++ Eventually.filter_mono ae_restrict_le ae_le_essSup) + have : NeZero (μ.restrict s) := + have : NeZero (μ s) := { out := hμ0 } + restrict.neZero + exact laverage_const (μ.restrict s) _ + + lemma laverage_le_essSup (f : α → ℝ≥0∞) : ⨍⁻ x, f x ∂μ ≤ essSup f μ := by +- simpa using setLAverage_le_essSup (s := univ) f ++ simpa using _root_.setLAverage_le_essSup (s := univ) f +diff --git a/Carleson/ToMathlib/MeasureTheory/Integral/IntegrableOn.lean b/Carleson/ToMathlib/MeasureTheory/Integral/IntegrableOn.lean +index 09f5019..6cadf14 100644 +--- a/Carleson/ToMathlib/MeasureTheory/Integral/IntegrableOn.lean ++++ b/Carleson/ToMathlib/MeasureTheory/Integral/IntegrableOn.lean +@@ -1,5 +1,7 @@ + import Mathlib.MeasureTheory.Integral.IntegrableOn + ++/-! # Integrability on a set from integrability on the support -/ ++ + open Set Filter TopologicalSpace MeasureTheory Function + + open scoped Topology Interval Filter ENNReal MeasureTheory +@@ -11,18 +13,6 @@ open scoped Topology Interval Filter ENNReal MeasureTheory + + variable {α β ε ε' E F : Type*} [MeasurableSpace α] + +-namespace MeasureTheory +- +-protected theorem IntegrableAtFilter.congr'_enorm {μ : Measure α} [TopologicalSpace ε] +- [TopologicalSpace ε'] [ContinuousENorm ε] [ContinuousENorm ε'] +- {l : Filter α} {f : α → ε} {g : α → ε'} +- (hf : IntegrableAtFilter f l μ) (hg : AEStronglyMeasurable g μ) +- (h : ∀ᵐ a ∂μ, ‖f a‖ₑ = ‖g a‖ₑ) : +- IntegrableAtFilter g l μ := +- Exists.casesOn hf fun s hs ↦ ⟨s, hs.1, hs.2.congr'_enorm hg.restrict (ae_restrict_le h)⟩ +- +-end MeasureTheory +- + section NormedAddCommGroup + + variable [NormedAddCommGroup E] {f g : α → ε'} {s t : Set α} {μ ν : Measure α} +@@ -31,7 +21,7 @@ variable [TopologicalSpace ε'] [ENormedAddMonoid ε'] + theorem integrableOn_of_integrableOn_inter_support [PseudoMetrizableSpace ε'] {f : α → ε'} + (hs : MeasurableSet s) (hf : IntegrableOn f (s ∩ support f) μ) : + IntegrableOn f s μ := by +- apply IntegrableOn.of_forall_diff_eq_zero hf hs ++ apply IntegrableOn.of_forall_sdiff_eq_zero hf hs + simp + + end NormedAddCommGroup +diff --git a/Carleson/ToMathlib/MeasureTheory/Integral/Lebesgue.lean b/Carleson/ToMathlib/MeasureTheory/Integral/Lebesgue.lean +index 58ff6bf..48fca65 100644 +--- a/Carleson/ToMathlib/MeasureTheory/Integral/Lebesgue.lean ++++ b/Carleson/ToMathlib/MeasureTheory/Integral/Lebesgue.lean +@@ -1,5 +1,7 @@ + import Mathlib.MeasureTheory.Measure.Lebesgue.Basic + ++/-! # Changes of variables and monotonicity for lower integrals -/ ++ + -- Upstreaming status: `lintegral_eq_iSup_eapprox_lintegral'` and `lintegral_comp'` + -- upstreamed in https://github.com/leanprover-community/mathlib4/pull/37558 + -- Remaining lemmas: shift/scaling aliases, `lintegral_set_mono_fn` +@@ -73,33 +75,6 @@ lemma lintegral_scale_constant' {f : ℝ → ENNReal} {a : ℝ} (h : a ≠ 0) : + simp + + +-open SimpleFunc +- +-/-- Generalization of `MeasureTheory.lintegral_eq_iSup_eapprox_lintegral` assuming a.e. +-measurability of `f` -/ +-theorem lintegral_eq_iSup_eapprox_lintegral' {α : Type*} {m : MeasurableSpace α} {μ : Measure α} +- {f : α → ENNReal} (hf : AEMeasurable f μ) : +- ∫⁻ (a : α), f a ∂μ = ⨆ (n : ℕ), (eapprox (hf.mk f) n).lintegral μ := +- calc +- _ = ∫⁻ a, hf.mk f a ∂μ := lintegral_congr_ae hf.ae_eq_mk +- _ = ∫⁻ a, ⨆ n, (eapprox (hf.mk f) n : α → ℝ≥0∞) a ∂μ := by +- simp [iSup_eapprox_apply hf.measurable_mk] +- _ = ⨆ n, ∫⁻ a, eapprox (hf.mk f) n a ∂μ := +- lintegral_iSup (fun _ ↦ SimpleFunc.measurable _) (fun _ _ h ↦ monotone_eapprox (hf.mk f) h) +- _ = ⨆ n, (eapprox (hf.mk f) n).lintegral μ := by simp [lintegral_eq_lintegral] +- +-/-- Generalization of `MeasureTheory.lintegral_comp` assuming a.e. measurability of `f` and `g` -/ +-theorem lintegral_comp' {α : Type*} {β : Type*} {m : MeasurableSpace α} {μ : Measure α} +- [MeasurableSpace β] {f : β → ENNReal} {g : α → β} (hf : AEMeasurable f (μ.map g)) +- (hg : AEMeasurable g μ) : lintegral μ (f ∘ g) = ∫⁻ a, f a ∂μ.map g := by +- rw [μ.map_congr hg.ae_eq_mk] at hf ⊢ +- calc ∫⁻ a, (f ∘ g) a ∂μ +- _ = ∫⁻ a, (hf.mk f ∘ hg.mk g) a ∂μ := by +- rw [lintegral_congr_ae (hg.ae_eq_mk.fun_comp f)] +- exact lintegral_congr_ae (ae_of_ae_map hg.measurable_mk.aemeasurable hf.ae_eq_mk) +- _ = ∫⁻ a, hf.mk f a ∂μ.map (hg.mk g) := lintegral_comp hf.measurable_mk hg.measurable_mk +- _ = ∫⁻ a, f a ∂μ.map (hg.mk g) := lintegral_congr_ae hf.ae_eq_mk.symm +- + lemma lintegral_set_mono_fn {α : Type*} {m : MeasurableSpace α} {μ : Measure α} {s : Set α} + (hs : MeasurableSet s) ⦃f g : α → ℝ≥0∞⦄ (hfg : ∀ x ∈ s, f x ≤ g x) : + ∫⁻ (a : α) in s, f a ∂μ ≤ ∫⁻ (a : α) in s, g a ∂μ := by +diff --git a/Carleson/ToMathlib/MeasureTheory/Measure/IsDoubling.lean b/Carleson/ToMathlib/MeasureTheory/Measure/IsDoubling.lean +index 06a6caa..2a9f2fd 100644 +--- a/Carleson/ToMathlib/MeasureTheory/Measure/IsDoubling.lean ++++ b/Carleson/ToMathlib/MeasureTheory/Measure/IsDoubling.lean +@@ -1,9 +1,12 @@ + import Carleson.ToMathlib.Misc + import Carleson.ToMathlib.CoveredByBalls +-import Mathlib.Data.Real.StarOrdered ++import Mathlib.Analysis.Real.Sqrt ++import Mathlib.Tactic.ContinuousFunctionalCalculus + import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls + import Mathlib.Order.CompletePartialOrder + ++/-! # Doubling measures and uniform local doubling -/ ++ + open MeasureTheory Measure NNReal Metric Filter Topology TopologicalSpace + open ENNReal hiding one_lt_two + noncomputable section +@@ -151,9 +154,9 @@ instance : IsUnifLocDoublingMeasure (μ : Measure X) where + use max 1 A^2, Set.univ, by simp, Set.univ + simp only [mem_principal, Set.subset_univ, Set.inter_self, true_and] + ext r +- simp only [ENNReal.coe_pow, Set.mem_setOf_eq, Set.mem_univ, iff_true] ++ simp only [ENNReal.coe_pow, Set.mem_ofPred_eq, Set.mem_univ, iff_true] + intro x +- letI : Nonempty X := ⟨x⟩ ++ let : Nonempty X := ⟨x⟩ + by_cases hr : r ≤ 0 + · have cball_eq : closedBall x (2 * r) = closedBall x r:= by + by_cases! hr' : r < 0 +diff --git a/Carleson/ToMathlib/MeasureTheory/Measure/NNReal.lean b/Carleson/ToMathlib/MeasureTheory/Measure/NNReal.lean +index 1c0dd1c..4c7cfd2 100644 +--- a/Carleson/ToMathlib/MeasureTheory/Measure/NNReal.lean ++++ b/Carleson/ToMathlib/MeasureTheory/Measure/NNReal.lean +@@ -2,6 +2,8 @@ import Mathlib.MeasureTheory.Measure.Haar.OfBasis + import Mathlib.MeasureTheory.Measure.Lebesgue.Basic + import Carleson.ToMathlib.MeasureTheory.Integral.Lebesgue + ++/-! # Lebesgue measure on nonnegative and extended nonnegative reals -/ ++ + open MeasureTheory NNReal ENNReal Set + + noncomputable +@@ -29,7 +31,7 @@ instance : MeasureSpace ℝ≥0∞ where + lemma ENNReal.ofNNReal_preimage {s : Set ℝ≥0∞} : + ENNReal.ofNNReal ⁻¹' s = ENNReal.toNNReal '' (s \ {⊤}) := by + ext x +- simp only [mem_image, mem_diff, mem_singleton_iff, mem_preimage] ++ simp only [mem_image, mem_sdiff, mem_singleton_iff, mem_preimage] + constructor + · intro h + use ENNReal.ofNNReal x +@@ -41,7 +43,7 @@ lemma ENNReal.ofNNReal_preimage {s : Set ℝ≥0∞} : + --TODO: move these lemmas somewhere else? + lemma ENNReal.map_toReal_eq_map_toReal_comap_ofReal {s : Set ℝ≥0∞} (h : ∞ ∉ s) : + ENNReal.toReal '' s = NNReal.toReal '' (ENNReal.ofNNReal ⁻¹' s) := by +- rw [ofNNReal_preimage, image_image, diff_singleton_eq_self h] ++ rw [ofNNReal_preimage, image_image, sdiff_singleton_eq_self h] + congr + + lemma ENNReal.map_toReal_eq_map_toReal_comap_ofReal' {s : Set ℝ≥0∞} (h : ∞ ∈ s) : +@@ -77,7 +79,8 @@ lemma ENNReal.volume_val {s : Set ℝ≥0∞} (hs : MeasurableSet s) : + _ = volume (ENNReal.ofNNReal ⁻¹' s) := + MeasureTheory.Measure.map_apply_of_aemeasurable (by fun_prop) hs + _ = volume (NNReal.toReal '' (ENNReal.ofNNReal ⁻¹' s)) := NNReal.volume_val +- _ = volume (ENNReal.toReal '' s) := Eq.symm (measure_congr ENNReal.map_toReal_ae_eq_map_toReal_comap_ofReal) ++ _ = volume (ENNReal.toReal '' s) := ++ Eq.symm (measure_congr ENNReal.map_toReal_ae_eq_map_toReal_comap_ofReal) + + lemma NNReal.volume_eq_volume_ennreal {s : Set ℝ≥0} (hs : MeasurableSet (ofNNReal '' s)) : + volume s = volume (ENNReal.ofNNReal '' s) := by +@@ -227,7 +230,6 @@ lemma ENNReal.toReal_Icc_eq_Icc {a b : ℝ≥0∞} (ha : a ≠ ∞) (hb : b ≠ + rw [← hxy] + constructor <;> gcongr + · exact ne_top_of_le_ne_top hb hy₂ +- · assumption + · rintro hx + use ENNReal.ofReal x + constructor +@@ -245,7 +247,6 @@ lemma ENNReal.toReal_Ioo_eq_Ioo {a b : ℝ≥0∞} (ha : a ≠ ∞) (hb : b ≠ + rw [← hyx] + constructor <;> gcongr + · finiteness +- · assumption + · rintro hx + use ENNReal.ofReal x + constructor +@@ -280,7 +281,7 @@ lemma ENNReal.toReal_Ioi_eq_Ioi {a : ℝ≥0∞} (ha : a ≠ ∞) : + rw [← hyx, h, ENNReal.toReal_top] + right + rw [← hyx] +- gcongr; assumption ++ gcongr + · rintro (x_zero | hxa) + · exact ⟨⊤, by finiteness, by simp [x_zero]⟩ + use ENNReal.ofReal x +@@ -355,7 +356,8 @@ lemma ENNReal.volume_Ioo {a b : ℝ≥0∞} (ha : a ≠ ∞) : + · have : ⊤ - ⊤ = (0 : ENNReal) := by simp only [tsub_self] + rw [hb, ENNReal.top_sub ha, ENNReal.toReal_Ioo_top_eq_Ioi ha] + apply Real.volume_Ioi +- rw [toReal_Ioo_eq_Ioo ha hb, Real.volume_Ioo, ofReal_sub _ (by simp), ofReal_toReal hb, ofReal_toReal ha] ++ rw [toReal_Ioo_eq_Ioo ha hb, Real.volume_Ioo, ofReal_sub _ (by simp), ofReal_toReal hb, ++ ofReal_toReal ha] + + -- sanity check: this measure is what you expect + example : volume (Set.Icc (3 : ℝ≥0∞) 42) = 39 := by +@@ -382,7 +384,7 @@ instance : Measure.IsOpenPosMeasure (@volume ℝ≥0 _) where + rw [NNReal.volume_Ioo] + simpa + +-instance : NoAtoms (@volume ℝ≥0∞ _) where ++instance : NullSingletonClass (@volume ℝ≥0∞ _) where + measure_singleton := by + intro x + rw [ENNReal.volume_val (measurableSet_singleton _), image_singleton] +@@ -390,8 +392,9 @@ instance : NoAtoms (@volume ℝ≥0∞ _) where + + -- TODO: move this general result to an appropriate place + -- TODO: maybe generalize further to general measures restricted to a subtype +-lemma Measure.Subtype.noAtoms {δ : Type*} [MeasureSpace δ] [NoAtoms (volume : Measure δ)] {p : δ → Prop} (hp : MeasurableSet p) : +- NoAtoms (Measure.Subtype.measureSpace.volume : Measure (Subtype p)) where ++lemma Measure.Subtype.noAtoms {δ : Type*} [MeasureSpace δ] ++ [NullSingletonClass (volume : Measure δ)] {p : δ → Prop} (hp : MeasurableSet p) : ++ NullSingletonClass (Measure.Subtype.measureSpace.volume : Measure (Subtype p)) where + measure_singleton := by + intro x + calc _ +@@ -400,11 +403,12 @@ lemma Measure.Subtype.noAtoms {δ : Type*} [MeasureSpace δ] [NoAtoms (volume : + _ = 0 := by + simp + +-instance : NoAtoms (@volume ℝ≥0 _) := Measure.Subtype.noAtoms measurableSet_Ici ++instance : NullSingletonClass (@volume ℝ≥0 _) := Measure.Subtype.noAtoms measurableSet_Ici + + --TODO: move this general result to an appropriate place + --TODO: maybe generalize further to general measures restricted to a subtype +-lemma Measure.Subtype.sigmaFinite {δ : Type*} [MeasureSpace δ] [sf : SigmaFinite (@volume δ _)] {p : δ → Prop} (hp : MeasurableSet p) : ++lemma Measure.Subtype.sigmaFinite {δ : Type*} [MeasureSpace δ] ++ [sf : SigmaFinite (@volume δ _)] {p : δ → Prop} (hp : MeasurableSet p) : + SigmaFinite (Measure.Subtype.measureSpace.volume : Measure (Subtype p)) where + out' := by + refine Nonempty.intro ?_ +@@ -431,11 +435,12 @@ lemma Measure.Subtype.sigmaFinite {δ : Type*} [MeasureSpace δ] [sf : SigmaFini + instance : SigmaFinite (@volume ℝ≥0 _) := Measure.Subtype.sigmaFinite measurableSet_Ici + + +-lemma lintegral_nnreal_eq_lintegral_Ici_ofReal {f : ℝ≥0 → ℝ≥0∞} : ∫⁻ x : ℝ≥0, f x = ∫⁻ x in Ici (0 : ℝ), f x.toNNReal := by ++lemma lintegral_nnreal_eq_lintegral_Ici_ofReal {f : ℝ≥0 → ℝ≥0∞} : ++ ∫⁻ x : ℝ≥0, f x = ∫⁻ x in Ici (0 : ℝ), f x.toNNReal := by + change ∫⁻ (x : ℝ≥0), f x = ∫⁻ (x : ℝ) in Ici 0, (f ∘ Real.toNNReal) x + rw [← lintegral_subtype_comap measurableSet_Ici] +- simp +- rfl ++ change ∫⁻ x : ℝ≥0, f x = ∫⁻ x : ℝ≥0, f (x : ℝ).toNNReal ++ simp only [Real.toNNReal_coe] + + lemma lintegral_nnreal_Ici_eq_lintegral_Ici_ofReal {f : ℝ≥0 → ℝ≥0∞} {a : ℝ≥0} : + ∫⁻ x in Ici a, f x = ∫⁻ x in Ici (a : ℝ), f x.toNNReal := by +@@ -446,7 +451,8 @@ lemma lintegral_nnreal_Ici_eq_lintegral_Ici_ofReal {f : ℝ≥0 → ℝ≥0∞} + apply setLIntegral_congr + rw [NNReal.Ici_eq] + +-lemma lintegral_nnreal_eq_lintegral_Ioi_ofReal {f : ℝ≥0∞ → ℝ≥0∞} : ∫⁻ x : ℝ≥0, f x = ∫⁻ x in Ioi (0 : ℝ), f (.ofReal x) := by ++lemma lintegral_nnreal_eq_lintegral_Ioi_ofReal {f : ℝ≥0∞ → ℝ≥0∞} : ++ ∫⁻ x : ℝ≥0, f x = ∫⁻ x in Ioi (0 : ℝ), f (.ofReal x) := by + rw [lintegral_nnreal_eq_lintegral_Ici_ofReal] + exact setLIntegral_congr Ioi_ae_eq_Ici.symm + +@@ -500,7 +506,8 @@ lemma lintegral_nnreal_scale_constant' {f : ℝ≥0 → ℝ≥0∞} {a : ℝ≥0 + a * ∫⁻ x : ℝ≥0, f (a*x) = ∫⁻ x, f x := by + rw [lintegral_nnreal_eq_lintegral_toNNReal_Ioi, lintegral_nnreal_eq_lintegral_toNNReal_Ioi] + symm +- rw [← lintegral_scale_constant_halfspace' (a:=a) (by rw [NNReal.coe_pos, pos_iff_ne_zero]; exact h)] ++ rw [← lintegral_scale_constant_halfspace' (a := a) ++ (by rw [NNReal.coe_pos, pos_iff_ne_zero]; exact h)] + congr 1 + · simp + apply setLIntegral_congr_fun measurableSet_Ioi +diff --git a/Carleson/ToMathlib/Misc.lean b/Carleson/ToMathlib/Misc.lean +index a58676b..75f2ec6 100644 +--- a/Carleson/ToMathlib/Misc.lean ++++ b/Carleson/ToMathlib/Misc.lean +@@ -4,7 +4,7 @@ import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds + import Mathlib.MeasureTheory.Integral.Average + import Mathlib.MeasureTheory.Measure.Haar.OfBasis + +-/- ++/-! + * This file can import all ToMathlib files. + * If adding more than a few results, please put them in a more appropriate file in ToMathlib. + +@@ -130,21 +130,19 @@ end support + end Function + + namespace MeasureTheory +- +-set_option linter.style.refine false in + variable {α : Type*} {β : Type*} {s : Set α} {f g : α → β} + {m : MeasurableSpace α} {mβ : MeasurableSpace β} {μ : Measure α} in +-@[measurability, fun_prop] ++@[fun_prop] + protected theorem _root_.AEMeasurable.piecewise {d : DecidablePred (· ∈ s)} (hs : MeasurableSet s) + (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) : AEMeasurable (piecewise s f g) μ := by +- refine' ⟨_, hf.measurable_mk.piecewise hs hg.measurable_mk, ?_⟩ +- · assumption ++ refine ⟨s.piecewise (hf.mk f) (hg.mk g), hf.measurable_mk.piecewise hs hg.measurable_mk, ++ ?_⟩ + filter_upwards [hf.ae_eq_mk, hg.ae_eq_mk] with x hfx hgx + simp_rw [Set.piecewise, ← hfx, ← hgx] + + variable {α : Type*} {β : Type*} {p : α → Prop} {f g : α → β} + {m : MeasurableSpace α} {mβ : MeasurableSpace β} {μ : Measure α} in +-@[measurability, fun_prop] ++@[fun_prop] + protected theorem _root_.AEMeasurable.ite {d : DecidablePred p} (hp : MeasurableSet {a | p a}) + (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) : + AEMeasurable (fun x => ite (p x) (f x) (g x)) μ := +@@ -253,7 +251,7 @@ theorem eLpNormEssSup_lt_top_of_ae_ennnorm_bound {f : α → F} {C : ℝ≥0∞} + (hfC : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ C) : eLpNormEssSup f μ ≤ C := essSup_le_of_ae_le C hfC + + theorem restrict_absolutelyContinuous : μ.restrict s ≪ μ := +- fun s hs ↦ Measure.restrict_le_self s |>.trans hs.le |>.antisymm <| zero_le _ ++ fun s hs ↦ Measure.restrict_le_self s |>.trans hs.le |>.antisymm <| zero_le + + section eLpNorm + +@@ -290,7 +288,12 @@ lemma eLpNorm'_toReal_eq {f : α → ℝ≥0∞} {p : ℝ} (hf : ∀ᵐ x ∂μ, + + lemma eLpNorm_toReal_le {f : α → ℝ≥0∞} : + eLpNorm (ENNReal.toReal ∘ f) p μ ≤ eLpNorm f p μ := by +- simp_rw [eLpNorm] ++ by_cases hmeas : AEStronglyMeasurable f μ ++ swap ++ · simp [eLpNorm_of_not_aestronglyMeasurable hmeas] ++ have hreal : AEStronglyMeasurable (ENNReal.toReal ∘ f) μ := hmeas.ennreal_toReal ++ rw [eLpNorm_eq_eLpNormFormula hreal, eLpNorm_eq_eLpNormFormula hmeas] ++ simp_rw [eLpNormFormula] + split_ifs + · rfl + · exact eLpNormEssSup_toReal_le +@@ -298,15 +301,31 @@ lemma eLpNorm_toReal_le {f : α → ℝ≥0∞} : + + lemma eLpNorm_toReal_eq {f : α → ℝ≥0∞} (hf : ∀ᵐ x ∂μ, f x ≠ ∞) : + eLpNorm (ENNReal.toReal ∘ f) p μ = eLpNorm f p μ := by +- simp_rw [eLpNorm] ++ have hmeas : AEStronglyMeasurable (ENNReal.toReal ∘ f) μ ↔ ++ AEStronglyMeasurable f μ := by ++ refine ⟨fun hreal ↦ ?_, fun hfun ↦ hfun.ennreal_toReal⟩ ++ apply hreal.aemeasurable.ennreal_ofReal.aestronglyMeasurable.congr ++ filter_upwards [hf] with point hpoint ++ simp [ENNReal.ofReal_toReal hpoint] ++ by_cases hfun : AEStronglyMeasurable f μ ++ swap ++ · simp [eLpNorm, hfun, hmeas] ++ rw [eLpNorm_eq_eLpNormFormula (hmeas.mpr hfun), eLpNorm_eq_eLpNormFormula hfun] ++ simp_rw [eLpNormFormula] + split_ifs + · rfl + · exact eLpNormEssSup_toReal_eq hf + · exact eLpNorm'_toReal_eq hf + +-lemma sq_eLpNorm_two {ε : Type*} [ENorm ε] {f : α → ε} : ++lemma sq_eLpNormFormula_two {ε : Type*} [ENorm ε] {f : α → ε} : ++ eLpNormFormula f 2 μ ^ 2 = ∫⁻ x, ‖f x‖ₑ ^ 2 ∂μ := by ++ simpa [eLpNormFormula] using ++ (lintegral_rpow_enorm_eq_rpow_eLpNorm' (f := f) (μ := μ) (by norm_num : (0 : ℝ) < 2)).symm ++ ++lemma sq_eLpNorm_two {ε : Type*} [TopologicalSpace ε] [ENorm ε] {f : α → ε} ++ (hf : AEStronglyMeasurable f μ) : + eLpNorm f 2 μ ^ 2 = ∫⁻ x, ‖f x‖ₑ ^ 2 ∂μ := by +- simpa using eLpNorm_nnreal_pow_eq_lintegral (f := f) two_ne_zero ++ rw [eLpNorm_eq_eLpNormFormula hf, sq_eLpNormFormula_two] + + open ComplexConjugate in + /-- One of the very few cases where a norm can be moved _out of_ an integral. -/ +@@ -317,7 +336,7 @@ lemma eLpNorm_two_eq_enorm_integral_mul_conj {f : α → ℂ} (lpf : MemLp f 2 + rw [integral_eq_lintegral_of_nonneg_ae (.of_forall fun _ ↦ by simp)]; swap + · exact lpf.aestronglyMeasurable.norm.pow 2 + conv_rhs => enter [1, 1, 1, 2, x]; rw [ENNReal.ofReal_pow (norm_nonneg _), ofReal_norm] +- rw [← sq_eLpNorm_two, ← enorm_norm] ++ rw [← sq_eLpNorm_two lpf.aestronglyMeasurable, ← enorm_norm] + simp_rw [Complex.coe_algebraMap, Complex.norm_real, enorm_norm] + rw [toReal_pow, enorm_pow, enorm_toReal lpf.eLpNorm_ne_top] + +@@ -327,8 +346,7 @@ namespace MemLp + + variable {p : ℝ≥0∞} + theorem toReal {f : α → ℝ≥0∞} (hf : MemLp f p μ) : MemLp (f · |>.toReal) p μ := +- ⟨hf.aestronglyMeasurable.aemeasurable.ennreal_toReal.aestronglyMeasurable, +- eLpNorm_toReal_le.trans_lt hf.eLpNorm_lt_top⟩ ++ eLpNorm_toReal_le.trans_lt hf.eLpNorm_lt_top + + end MemLp + +@@ -389,24 +407,24 @@ protected noncomputable def out (x : α) : α := + if hx : x ∈ s then (Quotient.out (s := hr.setoid) ⟦⟨x, hx⟩⟧ : s) else x + + lemma out_mem (hx : x ∈ s) : hr.out x ∈ s := by +- rw [EquivalenceOn.out, dif_pos hx] ++ rw [EquivalenceOn.out, dite_eq_left hx] + apply Subtype.prop + + @[simp] + lemma out_mem_iff : hr.out x ∈ s ↔ x ∈ s := by + refine ⟨fun h ↦ ?_, out_mem⟩ + by_contra hx +- rw [EquivalenceOn.out, dif_neg hx] at h ++ rw [EquivalenceOn.out, dite_eq_right hx] at h + exact hx h + + lemma out_rel (hx : x ∈ s) : r (hr.out x) x := by +- rw [EquivalenceOn.out, dif_pos hx] ++ rw [EquivalenceOn.out, dite_eq_left hx] + exact @Quotient.mk_out _ (hr.setoid) ⟨x, hx⟩ + + lemma rel_out (hx : x ∈ s) : r x (hr.out x) := hr.symm (out_mem hx) hx (out_rel hx) + + lemma out_inj (hx : x ∈ s) (hy : y ∈ s) (h : r x y) : hr.out x = hr.out y := by +- simp_rw [EquivalenceOn.out, dif_pos hx, dif_pos hy] ++ simp_rw [EquivalenceOn.out, dite_eq_left hx, dite_eq_left hy] + congr 1 + simp_rw [Quotient.out_inj, Quotient.eq] + exact h +@@ -488,9 +506,10 @@ section Indicator + + open ComplexConjugate + +-attribute [gcongr] Set.indicator_le_indicator mulIndicator_le_mulIndicator_of_subset ++attribute [gcongr only] Set.indicator_le_indicator mulIndicator_le_mulIndicator_of_subset + +-lemma indicator_eq_indicator' {α : Type*} {M : Type*} [Zero M] {s : Set α} {f g : α → M} (h : ∀ x ∈ s, f x = g x) : ++lemma indicator_eq_indicator' {α : Type*} {M : Type*} [Zero M] {s : Set α} {f g : α → M} ++ (h : ∀ x ∈ s, f x = g x) : + s.indicator f = s.indicator g := by + ext x + unfold indicator +@@ -669,16 +688,16 @@ theorem setIntegral_biUnion_le_sum_setIntegral {X : Type*} {ι : Type*} [Measura + have meas : MeasurableSet {x | 0 ≤ g x} := + have : {x | 0 ≤ g x} = g ⁻¹' (Ici 0) := by simp [preimage, mem_Ici] + this ▸ (AEMeasurable.measurable_mk int_f.aemeasurable) measurableSet_Ici +- rw [← integral_finset_sum_measure int_g] ++ rw [← integral_finsetSum_measure int_g] + set μ₀ : ι → Measure X := fun i ↦ ite (i ∈ s) (μ.restrict (S i)) 0 +- refine integral_mono_measure ?_ ?_ (integrable_finset_sum_measure.mpr int_g) ++ refine integral_mono_measure ?_ ?_ (integrable_finsetSum_measure.mpr int_g) + · refine Measure.le_iff.mpr (fun T hT ↦ ?_) +- simp_rw [μ.restrict_apply hT, Measure.coe_finset_sum, s.sum_apply, inter_iUnion] ++ simp_rw [μ.restrict_apply hT, Measure.coe_finsetSum, s.sum_apply, inter_iUnion] + apply le_trans <| measure_biUnion_finset_le s (T ∩ S ·) + exact s.sum_le_sum (fun _ _ ↦ ge_of_eq (μ.restrict_apply hT)) + · have : ∑ i ∈ s, μ.restrict (S i) = Measure.sum μ₀ := by + ext T hT +- simp only [Measure.sum_apply (hs := hT), Measure.coe_finset_sum, s.sum_apply, μ₀] ++ simp only [Measure.sum_apply (hs := hT), Measure.coe_finsetSum, s.sum_apply, μ₀] + rw [tsum_eq_sum (s := s) (fun b hb ↦ by simp [hb])] + exact Finset.sum_congr rfl (fun i hi ↦ by simp [hi]) + rw [Filter.EventuallyLE, this, Measure.ae_sum_iff' (by exact meas)] +@@ -689,7 +708,7 @@ theorem setIntegral_biUnion_le_sum_setIntegral {X : Type*} {ι : Type*} [Measura + · simp [hi, μ₀] + + -- Analogous to `MeasureTheory.integral_smul_const` in Mathlib +-theorem average_smul_const {X : Type*} {E : Type*} [MeasurableSpace X] ++theorem average_smul_const_carleson {X : Type*} {E : Type*} [MeasurableSpace X] + {μ : MeasureTheory.Measure X} [NormedAddCommGroup E] [NormedSpace ℝ E] {𝕜 : Type*} + [RCLike 𝕜] [NormedSpace 𝕜 E] [CompleteSpace E] (f : X → 𝕜) (c : E) : + ⨍ (x : X), f x • c ∂μ = (⨍ (x : X), f x ∂μ) • c := +@@ -770,12 +789,12 @@ lemma Finset.pow_sum_comm {ι R : Type*} [Semiring R] {s : Finset ι} {f : ι + + namespace MeasureTheory + +-lemma sum_sq_eLpNorm_indicator_le_of_pairwiseDisjoint ++lemma sum_sq_eLpNormFormula_indicator_le_of_pairwiseDisjoint + {α ι F : Type*} [MeasurableSpace α] [NormedAddCommGroup F] {μ : Measure α} + {s : Finset ι} {f : α → F} {t : ι → Set α} (meast : ∀ i, MeasurableSet (t i)) + (hpd : PairwiseDisjoint s t) : +- ∑ i ∈ s, eLpNorm ((t i).indicator f) 2 μ ^ 2 ≤ eLpNorm f 2 μ ^ 2 := by +- simp_rw [sq_eLpNorm_two] ++ ∑ i ∈ s, eLpNormFormula ((t i).indicator f) 2 μ ^ 2 ≤ eLpNormFormula f 2 μ ^ 2 := by ++ simp_rw [sq_eLpNormFormula_two] + conv_lhs => + enter [2, i, 2, x] + rw [enorm_indicator_eq_indicator_enorm, sq, ← inter_indicator_mul, inter_self] +@@ -784,13 +803,24 @@ lemma sum_sq_eLpNorm_indicator_le_of_pairwiseDisjoint + rw [← lintegral_biUnion_finset hpd fun _ _ ↦ meast _] + exact setLIntegral_le_lintegral _ _ + ++lemma sum_sq_eLpNorm_indicator_le_of_pairwiseDisjoint ++ {α ι F : Type*} [MeasurableSpace α] [NormedAddCommGroup F] {μ : Measure α} ++ {s : Finset ι} {f : α → F} {t : ι → Set α} (meast : ∀ i, MeasurableSet (t i)) ++ (hpd : PairwiseDisjoint s t) : ++ ∑ i ∈ s, eLpNorm ((t i).indicator f) 2 μ ^ 2 ≤ eLpNorm f 2 μ ^ 2 := by ++ by_cases hf : AEStronglyMeasurable f μ ++ · simp_rw [eLpNorm_eq_eLpNormFormula (hf.indicator (meast _)), ++ eLpNorm_eq_eLpNormFormula hf] ++ exact sum_sq_eLpNormFormula_indicator_le_of_pairwiseDisjoint meast hpd ++ · simp [eLpNorm_of_not_aestronglyMeasurable hf] ++ + theorem measurable_measure_ball {α : Type*} [PseudoMetricSpace α] [SecondCountableTopology α] + [MeasurableSpace α] [OpensMeasurableSpace α] {μ : Measure α} [SFinite μ] : + Measurable fun (a, r) ↦ μ (Metric.ball a r) := by +- let s : Set (α × α × ℝ) := setOf fun (b, a, r) ↦ b ∈ Metric.ball a r ++ let s : Set (α × α × ℝ) := {point | point.1 ∈ Metric.ball point.2.1 point.2.2} + apply measurable_measure_prodMk_right (s := s) + unfold s Metric.ball +- simp_rw [mem_setOf] ++ simp_rw [mem_ofPred] + apply measurableSet_lt + · fun_prop + · fun_prop +diff --git a/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Basic.lean b/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Basic.lean +index 28c0164..1e50b97 100644 +--- a/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Basic.lean ++++ b/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Basic.lean +@@ -1,6 +1,8 @@ + import Mathlib.Order.ConditionallyCompleteLattice.Basic + import Mathlib.Order.ConditionallyCompleteLattice.Indexed + ++/-! # Comparison of conditionally complete suprema -/ ++ + -- Upstreaming status: under active development by @ldiedering + -- Wait for the file to stabilise first. + +@@ -57,7 +59,8 @@ theorem ciSup_eq_ciSup {α : Type*} {ι ι' : Sort*} [ConditionallyCompleteLinea + rw [iSup_of_empty', iSup_of_empty'] + + @[simp] +-theorem WithTop.iSup_coe_eq_top' {α : Type*} [ConditionallyCompleteLinearOrderBot α] [NoTopOrder α] : ++theorem WithTop.iSup_coe_eq_top' {α : Type*} [ConditionallyCompleteLinearOrderBot α] ++ [NoTopOrder α] : + ⨆ (i : α), ↑i = (⊤ : WithTop α) := by + rw [WithTop.iSup_coe_eq_top] + simp +diff --git a/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Indexed.lean b/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Indexed.lean +index fdec970..6d9b0cf 100644 +--- a/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Indexed.lean ++++ b/Carleson/ToMathlib/Order/ConditionallyCompleteLattice/Indexed.lean +@@ -1,16 +1,6 @@ + import Mathlib.Order.ConditionallyCompleteLattice.Indexed + +-section ConditionallyCompleteLinearOrderBot ++/-! # Indexed suprema in conditionally complete lattices + +-variable {α : Type*} {ι : Sort*} {κ : ι → Sort*} +-variable [ConditionallyCompleteLinearOrderBot α] {a : α} +- +-theorem ciSup₂_le' {f : ∀ i, κ i → α} (h : ∀ i j, f i j ≤ a) : ⨆ (i) (j), f i j ≤ a := +- ciSup_le' fun i => ciSup_le' <| h i +- +-theorem exists_lt_of_lt_ciSup₂' {f : ∀ i, κ i → α} (h : a < ⨆ (i) (j), f i j) : +- ∃ i j, a < f i j := by +- contrapose! h +- exact ciSup₂_le' h +- +-end ConditionallyCompleteLinearOrderBot ++The bounds `ciSup₂_le'` and `exists_lt_of_lt_ciSup₂'` are supplied by Mathlib. ++-/ +diff --git a/Carleson/ToMathlib/RealInterpolation/InterpolatedExponents.lean b/Carleson/ToMathlib/RealInterpolation/InterpolatedExponents.lean +index 9f25cc1..5f8bbb2 100644 +--- a/Carleson/ToMathlib/RealInterpolation/InterpolatedExponents.lean ++++ b/Carleson/ToMathlib/RealInterpolation/InterpolatedExponents.lean +@@ -77,7 +77,7 @@ lemma ne_top_of_Ioc {p q r : ℝ≥0∞} (hq : q ∈ Ioc p r) (hr : r < ⊤) : q + hq.2.trans_lt hr |>.ne_top + + lemma pos_of_rb_Ioc {p q r : ℝ≥0∞} (hr : q ∈ Ioc p r) : 0 < r := +- zero_le p |>.trans_lt hr.1 |>.trans_le hr.2 ++ zero_le.trans_lt hr.1 |>.trans_le hr.2 + + lemma pos_of_Ioo {p q r : ℝ≥0∞} (hq : q ∈ Ioo p r) : 0 < q := pos_of_gt hq.1 + +@@ -113,8 +113,8 @@ lemma preservation_positivity₀ (ht : t ∈ Ioo 0 1) (hpq : p ≠ ⊤ ∨ q ≠ + 0 < (1 - t) * p⁻¹ + t * q⁻¹ := by + obtain dir|dir := hpq + · exact Left.add_pos_of_pos_of_nonneg (mul_pos ((tsub_pos_of_lt ht.2).ne') +- (ENNReal.inv_ne_zero.mpr dir)) (zero_le _) +- · exact Right.add_pos_of_nonneg_of_pos (zero_le _) ++ (ENNReal.inv_ne_zero.mpr dir)) zero_le ++ · exact Right.add_pos_of_nonneg_of_pos zero_le + <| ENNReal.mul_pos ht.1.ne' (ENNReal.inv_ne_zero.mpr dir) + + lemma preservation_positivity (ht : t ∈ Ioo 0 1) (hpq : p ≠ q) : +@@ -156,7 +156,8 @@ lemma rpow_apply_coe' {x : ℝ≥0∞} {y : ℝ} (hx : x ≠ ⊤) : + · rw [ENNReal.toNNReal_eq_zero_iff] + simp [hx] + +-lemma rpow_lt_rpow_iff_neg {x y : ℝ≥0∞} (hx : x ≠ 0) (hy : y ≠ ∞) (hxy : x < y) {z : ℝ} (hz : z < 0) : ++lemma rpow_lt_rpow_iff_neg {x y : ℝ≥0∞} (hx : x ≠ 0) (hy : y ≠ ∞) (hxy : x < y) ++ {z : ℝ} (hz : z < 0) : + y ^ z < x ^ z := by + rw [ENNReal.rpow_apply_coe' hy, ENNReal.rpow_apply_coe' hxy.ne_top] + simpa [(pos_of_gt hxy).ne', hx] using +@@ -216,12 +217,13 @@ lemma rpow_le_rpow_of_exponent_le_base_le {a b t γ : ℝ} (ht : 0 < t) (htγ : + + -- Note: this lemma is false if t = γ = ∞ and a < 0 ≤ b, as then t ^ a = ∞ ^ a = 0 and + -- the statement becomes ∞ ≤ 0 * ∞ = 0. +-lemma rpow_le_rpow_of_exponent_le_base_le_enorm {a b : ℝ} {t γ : ℝ≥0∞} (ht : 0 < t) (ht' : t ≠ ∞) (htγ : t ≤ γ) (hab : a ≤ b) : ++lemma rpow_le_rpow_of_exponent_le_base_le_enorm {a b : ℝ} {t γ : ℝ≥0∞} ++ (ht : 0 < t) (ht' : t ≠ ∞) (htγ : t ≤ γ) (hab : a ≤ b) : + t ^ b ≤ t ^ a * γ ^ (b - a) := by + calc + _ = t ^ (a + (b - a)) := by ring_nf + _ = t ^ a * t ^ (b - a) := by rw [ENNReal.rpow_add _ _ ht.ne' ht'] +- _ ≤ t ^ a * γ ^ (b - a) := by gcongr; linarith ++ _ ≤ t ^ a * γ ^ (b - a) := by gcongr + + -- TODO: there is a lot of overlap between above proof and below + lemma rpow_le_rpow_of_exponent_le_base_ge {a b t γ : ℝ} (hγ : 0 < γ) (htγ : γ ≤ t) (hab : a ≤ b) : +@@ -242,7 +244,8 @@ lemma rpow_le_rpow_of_exponent_le_base_ge {a b t γ : ℝ} (hγ : 0 < γ) (htγ + rw [Real.rpow_mul, Real.rpow_neg_one, ← Real.mul_rpow, ← div_eq_mul_inv] <;> try positivity + exact ofReal_le_ofReal (Real.rpow_le_rpow_of_exponent_le ((one_le_div hγ).mpr htγ) hab) + +-lemma rpow_le_rpow_of_exponent_le_base_ge_enorm {a b : ℝ} {t γ : ℝ≥0∞} (hγ : 0 < γ) (hγ' : γ ≠ ∞) (htγ : γ ≤ t) (hab : a ≤ b) : ++lemma rpow_le_rpow_of_exponent_le_base_ge_enorm {a b : ℝ} {t γ : ℝ≥0∞} ++ (hγ : 0 < γ) (hγ' : γ ≠ ∞) (htγ : γ ≤ t) (hab : a ≤ b) : + t ^ a ≤ (t ^ b) * (γ ^ (a - b)) := by + by_cases ht' : t = ∞ + · simp_all only [le_top, top_rpow_def, ite_mul, sub_zero, one_mul, zero_mul] +@@ -254,7 +257,7 @@ lemma rpow_le_rpow_of_exponent_le_base_ge_enorm {a b : ℝ} {t γ : ℝ≥0∞} + · simp_all + · simpa using by order + · rw [ENNReal.top_mul] +- · exact zero_le ⊤ ++ · exact zero_le + simp_all + · positivity + · simp +@@ -318,7 +321,6 @@ lemma interp_exp_between (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) + gcongr + · finiteness + · exact ht.1.ne' +- · exact ht' + · rw [hp] + have : p₁⁻¹ = (1 - t) * p₁⁻¹ + t * p₁⁻¹ := by + rw [← add_mul, tsub_add_eq_max, max_eq_left_of_lt, one_mul] +@@ -433,7 +435,8 @@ lemma ne_inv_toReal_exponents (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp₀p₁ : + ← ofReal_toReal_eq_iff.mpr (inv_ne_top.mpr hp₁.ne')] + exact congrArg ENNReal.ofReal h + +-lemma ne_inv_toReal_exp_interp_exp (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp₀p₁ : p₀ ≠ p₁) ++lemma ne_inv_toReal_exp_interp_exp (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) ++ (hp₀p₁ : p₀ ≠ p₁) + (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) : p₀⁻¹.toReal ≠ p⁻¹.toReal := by + rw [preservation_interpolation ht hp₀ hp₁ hp, ← sub_ne_zero] + convert mul_ne_zero (toReal_ne_zero_of_Ioo ht) +@@ -461,7 +464,8 @@ lemma ne_toReal_exp_interp_exp (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : + lemma ne_toReal_exp_interp_exp₁ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp₀p₁ : p₀ ≠ p₁) + (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) : + p.toReal ≠ p₁.toReal := +- (ne_toReal_exp_interp_exp (mem_sub_Ioo one_ne_top ht) hp₁ hp₀ hp₀p₁.symm (switch_exponents ht hp)).symm ++ (ne_toReal_exp_interp_exp (mem_sub_Ioo one_ne_top ht) hp₁ hp₀ hp₀p₁.symm ++ (switch_exponents ht hp)).symm + + lemma ofReal_inv_interp_sub_exp_pos₁ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) + (hq₀q₁ : q₀ ≠ q₁) +@@ -482,7 +486,8 @@ lemma exp_lt_iff (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp + · exact ⟨fun h ↦ (not_le_of_gt h (le_of_lt (interp_exp_between hp₀ hp₁ p₀lt_p₁ ht hp).1)).elim, + fun h ↦ (not_le_of_gt h p₀lt_p₁.le).elim⟩ + · exact ⟨fun _ ↦ p₁lt_p₀, +- fun _ ↦ (interp_exp_between hp₁ hp₀ p₁lt_p₀ (mem_sub_Ioo one_ne_top ht) (switch_exponents ht hp)).2⟩ ++ fun _ ↦ (interp_exp_between hp₁ hp₀ p₁lt_p₀ (mem_sub_Ioo one_ne_top ht) ++ (switch_exponents ht hp)).2⟩ + + lemma exp_gt_iff (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hp₁ : 0 < p₁) (hp₀p₁ : p₀ ≠ p₁) + (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) : +@@ -568,21 +573,21 @@ lemma ζ_equality₂ (ht : t ∈ Ioo 0 1) : + + lemma ζ_symm (ht : t ∈ Ioo 0 1) : ζ p₀ q₀ p₁ q₁ t.toReal = ζ p₁ q₁ p₀ q₀ (1 - t).toReal := by + unfold ζ +- rw [← mul_div_mul_right (c := - 1), mul_assoc _ _ (-1), mul_assoc _ _ (-1)]; on_goal 2 => positivity ++ rw [← mul_div_mul_right (c := - 1), mul_assoc _ _ (-1), mul_assoc _ _ (-1)] ++ on_goal 2 => positivity + simp only [mul_neg, mul_one, neg_sub] + nth_rewrite 1 [add_comm]; nth_rw 2 [add_comm] + rw [sub_toReal_of_le ht.2.le, sub_sub_toReal_of_le ht.2.le, + sub_sub_toReal_of_le (mem_sub_Ioo (by finiteness) ht).2.le] +- +-set_option linter.style.multiGoal false in +-set_option linter.flexible false in + lemma ζ_equality₃ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) + (hp₀p₁ : p₀ ≠ p₁) (hq₀q₁ : q₀ ≠ q₁) + (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) + (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hp₀' : p₀ ≠ ⊤) + (hq₀' : q₀ ≠ ⊤) : +- ζ p₀ q₀ p₁ q₁ t.toReal = (p₀.toReal * (q₀.toReal - q.toReal)) / (q₀.toReal * (p₀.toReal - p.toReal)) := by +- rw [ζ_equality₁ ht, ← preservation_interpolation, ← preservation_interpolation] ++ ζ p₀ q₀ p₁ q₁ t.toReal = (p₀.toReal * (q₀.toReal - q.toReal)) / ++ (q₀.toReal * (p₀.toReal - p.toReal)) := by ++ rw [ζ_equality₁ ht, ← preservation_interpolation ht hp₀ hp₁ hp, ++ ← preservation_interpolation ht hq₀ hq₁ hq] + have q_pos : 0 < q := interpolated_pos' hq₀ hq₁ (ne_top_of_Ioo ht) hq + have p_pos : 0 < p := interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp + have aux := mul_pos (interp_exp_toReal_pos ht hp₀ hp₁ hp₀p₁ hp) +@@ -600,12 +605,10 @@ lemma ζ_equality₃ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) + (p₀⁻¹.toReal * p₀.toReal) * p.toReal) := by ring + rw [eq₁, eq₂, ← @toReal_mul q⁻¹ q, ← @toReal_mul p⁻¹ p, ← @toReal_mul p₀⁻¹ p₀, + ← @toReal_mul q₀⁻¹ q₀] +- all_goals try assumption +- -- TODO: why can below goals not be discharged? +- repeat rw [ENNReal.inv_mul_cancel] <;> try positivity +- all_goals simp <;> try assumption +- · apply interp_exp_ne_top hq₀q₁ ht hq +- · apply interp_exp_ne_top hp₀p₁ ht hp ++ rw [ENNReal.inv_mul_cancel q_pos.ne' (interp_exp_ne_top hq₀q₁ ht hq), ++ ENNReal.inv_mul_cancel p_pos.ne' (interp_exp_ne_top hp₀p₁ ht hp), ++ ENNReal.inv_mul_cancel hp₀.ne' hp₀', ENNReal.inv_mul_cancel hq₀.ne' hq₀'] ++ simp + + lemma ζ_equality₄ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) + (hp₀p₁ : p₀ ≠ p₁) (hq₀q₁ : q₀ ≠ q₁) +@@ -620,12 +623,14 @@ lemma ζ_equality₄ (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) + · rw [hp, add_comm, ENNReal.sub_sub_cancel one_ne_top ht.2.le] + · rw [hq, add_comm, ENNReal.sub_sub_cancel one_ne_top ht.2.le] + +-lemma ζ_equality₅ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) ++lemma ζ_equality₅ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) ++ (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) + (hp₀p₁ : p₀ ≠ p₁) (hq₀q₁ : q₀ ≠ q₁) + (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) + (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hp₀' : p₀ ≠ ⊤) + (hq₀' : q₀ ≠ ⊤) : +- p₀.toReal + (ζ p₀ q₀ p₁ q₁ t.toReal)⁻¹ * (q.toReal - q₀.toReal) * (p₀.toReal / q₀.toReal) = p.toReal := by ++ p₀.toReal + (ζ p₀ q₀ p₁ q₁ t.toReal)⁻¹ * (q.toReal - q₀.toReal) * ++ (p₀.toReal / q₀.toReal) = p.toReal := by + rw [ζ_equality₃ ht] <;> try assumption + simp only [inv_div] + rw [div_eq_mul_inv, div_eq_mul_inv, mul_inv] +@@ -639,12 +644,14 @@ lemma ζ_equality₅ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (h + · exact (exp_toReal_pos hp₀ hp₀').ne' + · exact (exp_toReal_pos hq₀ hq₀').ne' + +-lemma ζ_equality₆ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) ++lemma ζ_equality₆ {t : ℝ≥0∞} (ht : t ∈ Ioo 0 1) (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) ++ (hp₁ : 0 < p₁) (hq₁ : 0 < q₁) + (hp₀p₁ : p₀ ≠ p₁) (hq₀q₁ : q₀ ≠ q₁) + (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) + (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hp₁' : p₁ ≠ ⊤) + (hq₁' : q₁ ≠ ⊤) : +- p₁.toReal + (ζ p₀ q₀ p₁ q₁ t.toReal)⁻¹ * (q.toReal - q₁.toReal) * (p₁.toReal / q₁.toReal) = p.toReal := by ++ p₁.toReal + (ζ p₀ q₀ p₁ q₁ t.toReal)⁻¹ * (q.toReal - q₁.toReal) * ++ (p₁.toReal / q₁.toReal) = p.toReal := by + rw [ζ_symm ht] + apply ζ_equality₅ (mem_sub_Ioo one_ne_top ht) hp₁ hq₁ hp₀ hq₀ hp₀p₁.symm hq₀q₁.symm _ _ hp₁' hq₁' + · rw [add_comm, one_sub_one_sub_eq ht]; apply hp +@@ -1010,9 +1017,11 @@ lemma eq_exponents₂ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) + + lemma eq_exponents₁ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) (hq₀q₁ : q₀ ≠ q₁) + (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hq₀' : q₀ ≠ ⊤) : +- (q₀⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal)) * (q.toReal - q₀.toReal) = - t.toReal * q.toReal := by ++ (q₀⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal)) * (q.toReal - q₀.toReal) = ++ - t.toReal * q.toReal := by + rw [mul_comm_div, ← mul_div_assoc] +- have : q₀⁻¹.toReal * (q.toReal - q₀.toReal) = - t.toReal * q.toReal * (q₁⁻¹.toReal - q₀⁻¹.toReal) := by ++ have : q₀⁻¹.toReal * (q.toReal - q₀.toReal) = ++ - t.toReal * q.toReal * (q₁⁻¹.toReal - q₀⁻¹.toReal) := by + calc + _ = (q₀⁻¹.toReal * q.toReal - q₀⁻¹.toReal * q₀.toReal) := by ring + _ = (q₀⁻¹.toReal * q.toReal - 1) := by +@@ -1052,7 +1061,8 @@ lemma eq_exponents₃ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) + exact ne_sub_toReal_exp hq₀ hq₁ hq₀q₁ + + lemma eq_exponents₄ : +- q₀⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal) = - (q₀⁻¹.toReal / (q₀⁻¹.toReal - q₁⁻¹.toReal)) := calc ++ q₀⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal) = ++ - (q₀⁻¹.toReal / (q₀⁻¹.toReal - q₁⁻¹.toReal)) := calc + _ = - (q₀⁻¹.toReal * (-(q₁⁻¹.toReal - q₀⁻¹.toReal)⁻¹)) := by + rw [div_eq_mul_inv]; ring + _ = _ := by congr; rw [neg_inv, neg_sub] +@@ -1066,7 +1076,8 @@ lemma eq_exponents₅ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) + + lemma eq_exponents₆ (ht : t ∈ Ioo 0 1) (hq₀ : 0 < q₀) (hq₁ : 0 < q₁) (hq₀q₁ : q₀ ≠ q₁) + (hq : q⁻¹ = (1 - t) * q₀⁻¹ + t * q₁⁻¹) (hq₁' : q₁ ≠ ⊤) : +- q₁⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal) * (q.toReal - q₁.toReal) = (1 - t).toReal * q.toReal := by ++ q₁⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal) * (q.toReal - q₁.toReal) = ++ (1 - t).toReal * q.toReal := by + rw [← neg_neg (a := q₁⁻¹.toReal / (q₁⁻¹.toReal - q₀⁻¹.toReal)), ← eq_exponents₄, neg_mul, + eq_exponents₁ (mem_sub_Ioo one_ne_top ht) hq₁ hq₀ hq₀q₁.symm (switch_exponents ht hq) hq₁', + neg_mul, neg_neg] +diff --git a/Carleson/ToMathlib/RealInterpolation/Main.lean b/Carleson/ToMathlib/RealInterpolation/Main.lean +index 9bff6d4..3dce337 100644 +--- a/Carleson/ToMathlib/RealInterpolation/Main.lean ++++ b/Carleson/ToMathlib/RealInterpolation/Main.lean +@@ -50,7 +50,8 @@ variable {α α' ε E E₁ E₂ E₃ : Type*} {m : MeasurableSpace α} {m' : Mea + ## Definitions -/ + namespace MeasureTheory + +-variable {ε₁ ε₂ : Type*} [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] [TopologicalSpace ε₂] [ESeminormedAddMonoid ε₂] ++variable {ε₁ ε₂ : Type*} [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] ++ [TopologicalSpace ε₂] [ESeminormedAddMonoid ε₂] + + def Subadditive [ENorm ε] (T : (α → ε₁) → α' → ε) : Prop := + ∃ A ≠ ⊤, ∀ (f g : α → ε₁) (x : α'), ‖T (f + g) x‖ₑ ≤ A * (‖T f x‖ₑ + ‖T g x‖ₑ) +@@ -116,7 +117,8 @@ lemma biSup {ι : Type*} {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {T : ι → ( + specialize h f hf g hg + simp_rw [enorm_eq_self] at h ⊢ + filter_upwards [hT f hf, hT g hg, (ae_ball_iff h𝓑).mpr h, (ae_ball_iff h𝓑).mpr (hT' f hf), +- (ae_ball_iff h𝓑).mpr (hT' g hg), (ae_ball_iff h𝓑).mpr (hT' (f + g) (hP hf hg))] with x hTfx hTgx hx hT'fx hT'gx hT'fgx ++ (ae_ball_iff h𝓑).mpr (hT' g hg), (ae_ball_iff h𝓑).mpr (hT' (f + g) (hP hf hg))] ++ with x hTfx hTgx hx hT'fx hT'gx hT'fgx + simp_rw [iSup_le_iff] + intro i hi + specialize hx i hi +@@ -173,7 +175,8 @@ lemma biSup {ι : Type*} {𝓑 : Set ι} (h𝓑 : 𝓑.Countable) {T : ι → ( + conv at hT' => enter [i]; rw [forall_comm] + rw [forall_comm] at hT'; simp_rw [imp.swap, ← imp_forall_iff] at hT' + filter_upwards [(ae_ball_iff h𝓑).mpr (fun i hi ↦ (h i hi).2 f c hf), +- (ae_ball_iff h𝓑).mpr (hT' f hf), (ae_ball_iff h𝓑).mpr (hT' (c • f) (h_smul hf))] with x hx hT'fx hT'cfx ++ (ae_ball_iff h𝓑).mpr (hT' f hf), (ae_ball_iff h𝓑).mpr (hT' (c • f) (h_smul hf))] ++ with x hx hT'fx hT'cfx + simp_rw [Pi.smul_apply, ENNReal.smul_iSup] + refine biSup_congr (fun i hi ↦ ?_) + specialize hx i hi +@@ -272,7 +275,8 @@ variable {α α' E E₁ E₂ E₃ : Type*} {m : MeasurableSpace α} {m' : Measur + -/ + namespace MeasureTheory + +-variable {ε₁ ε₂ : Type*} [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] [TopologicalSpace ε₂] [ESeminormedAddMonoid ε₂] ++variable {ε₁ ε₂ : Type*} [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] ++ [TopologicalSpace ε₂] [ESeminormedAddMonoid ε₂] + + /-- Proposition that expresses that the map `T` map between function spaces preserves + AE strong measurability on L^p. -/ +@@ -322,7 +326,8 @@ lemma rewrite_norm_func {q : ℝ} {g : α' → E} + rw [ENNReal.ofReal_rpow_of_pos ha, ENNReal.ofReal_mul (by positivity)] + + lemma estimate_norm_rpow_range_operator {q : ℝ} {f : α → E₁} +- [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [TopologicalSpace E₂] [ESeminormedAddCommMonoid E₂] ++ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] ++ [TopologicalSpace E₂] [ESeminormedAddCommMonoid E₂] + (hq : 0 < q) (tc : StrictRangeToneCouple) {A : ℝ≥0} (hA : 0 < A) + (ht : Subadditive_trunc T A f ν) (hTf : AEStronglyMeasurable (T f) ν) : + ∫⁻ x : α', ‖T f x‖ₑ ^ q ∂ν ≤ +@@ -336,8 +341,9 @@ lemma estimate_norm_rpow_range_operator {q : ℝ} {f : α → E₁} + convert estimate_distribution_Subadditive_trunc (tc.ran_ton a ha).1 ht <;> simp + + -- TODO: the infrastructure can perhaps be improved here +-@[measurability, fun_prop] +-theorem ton_measurable_eLpNorm_trunc [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (tc : ToneCouple) : ++@[fun_prop] ++theorem ton_measurable_eLpNorm_trunc [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] ++ (tc : ToneCouple) : + Measurable (fun x ↦ eLpNorm (trunc f (tc.ton x)) p₁ μ) := by + change Measurable ((fun t : ℝ≥0∞ ↦ eLpNorm (trunc f t) p₁ μ) ∘ (tc.ton)) + have tone := tc.ton_is_ton +@@ -405,7 +411,8 @@ lemma estimate_norm_rpow_range_operator' + apply lintegral_congr_ae + filter_upwards [ae_in_Ioo_zero_top] with s ⟨s_pos, s_lt_top⟩ + have is_q₀top : ¬ q₀ < ⊤ := by assumption +- rw [hq₀' (not_lt_top.mp is_q₀top) s s_pos, hq₁' (not_lt_top.mp is_q₁top) s s_pos, zero_mul, add_zero] ++ rw [hq₀' (not_lt_top.mp is_q₀top) s s_pos, hq₁' (not_lt_top.mp is_q₁top) s s_pos, ++ zero_mul, add_zero] + + lemma simplify_factor_rw_aux₀ (a b c d e f : ℝ≥0∞) : + a * b * c * d * e * f = a * c * e * (b * d * f) := by ring +@@ -561,7 +568,7 @@ def finite_spanning_sets_from_lintegrable {g : α → ℝ≥0∞} (hg : AEMeasur + simp only [one_div] + split_ifs with is_n_zero + · simp [is_n_zero] at wn +- · simp only [mem_setOf_eq] ++ · simp only [mem_ofPred_eq] + refine inv_le_iff_inv_le.mpr ?_ + apply le_of_lt + refine lt_trans wn ?_ +@@ -584,7 +591,7 @@ lemma support_sigma_finite_from_MemLp + unfold Function.support g + ext x + simp only [ne_eq, ENNReal.rpow_eq_zero_iff, enorm_eq_zero, not_or, not_and, not_lt, +- toReal_nonneg, implies_true, and_true, mem_setOf_eq] ++ toReal_nonneg, implies_true, and_true, mem_ofPred_eq] + constructor + · contrapose + simp [Classical.not_imp, not_le, toReal_pos hp' hp] +@@ -592,13 +599,11 @@ lemma support_sigma_finite_from_MemLp + contradiction + rw [← this] + apply support_sigma_finite_of_lintegrable +- · exact hf.1.enorm.pow_const _ ++ · exact hf.aestronglyMeasurable.enorm.pow_const _ + · unfold g +- have obs := hf.2 +- unfold eLpNorm eLpNorm' at obs +- split_ifs at obs +- · contradiction +- · exact lintegral_rpow_enorm_lt_top_of_eLpNorm'_lt_top (toReal_pos hp' hp) obs ++ apply lintegral_rpow_enorm_lt_top_of_eLpNorm'_lt_top (toReal_pos hp' hp) ++ rw [← eLpNorm_eq_eLpNorm' hp' hp hf.aestronglyMeasurable] ++ exact hf + + -- lemma support_sfinite_from_MemLp + -- [MeasurableSpace E₁] [NormedAddCommGroup E₁] [BorelSpace E₁] (hf : MemLp f p μ) +@@ -656,7 +661,8 @@ lemma combine_estimates₀ {A : ℝ≥0} (hA : 0 < A) + eLpNorm (truncCompl f (tc.ton s)) p₀ μ ^ q₀.toReal * + s ^ (q.toReal - q₀.toReal - 1))) := by + gcongr +- apply estimate_norm_rpow_range_operator' (p := p) (tc := tc) p₀pos q₀pos q₁pos <;> try assumption ++ apply estimate_norm_rpow_range_operator' (p := p) (tc := tc) p₀pos q₀pos q₁pos <;> ++ try assumption + · exact (interp_exp_between p₀pos p₁pos hp₀p₁ ht hp).2 + · exact (interp_exp_between p₀pos p₁pos hp₀p₁ ht hp).1 + · intro q₀top s (hs : 0 < s) +@@ -709,7 +715,7 @@ lemma combine_estimates₀ {A : ℝ≥0} (hA : 0 < A) + · exact hp₁.2 + · exact ne_top_of_Ioc hp₁ is_q₁top + · exact is_q₁top.ne_top +- · exact hf.1 ++ · exact hf.aestronglyMeasurable + · rw [hspf]; rfl + · simp + · split_ifs with is_q₀top +@@ -719,7 +725,7 @@ lemma combine_estimates₀ {A : ℝ≥0} (hA : 0 < A) + · exact hp₀.2 + · exact ne_top_of_Ioc hp₀ is_q₀top + · exact is_q₀top.ne_top +- · exact hf.1 ++ · exact hf.aestronglyMeasurable + · rw [hspf]; rfl + · simp + _ = (if q₁ < ⊤ then 1 else 0) * +@@ -784,8 +790,8 @@ lemma combine_estimates₁ {A : ℝ≥0} (hA : 0 < A) + refine le_of_rpow_le q'pos ?_ + calc + _ = ∫⁻ x , ‖T f x‖ₑ ^ q.toReal ∂ν := by +- unfold eLpNorm eLpNorm' +- split_ifs <;> [contradiction; rw [one_div, ENNReal.rpow_inv_rpow q'pos.ne']] ++ rw [eLpNorm_eq_eLpNorm' q_ne_zero q_ne_top (h₂T hf), eLpNorm', one_div, ++ ENNReal.rpow_inv_rpow q'pos.ne'] + _ ≤ _ := by + apply combine_estimates₀ (hT := hT) (p := p) <;> try assumption + _ = _ := by +@@ -798,7 +804,8 @@ lemma combine_estimates₁ {A : ℝ≥0} (hA : 0 < A) + exact ofReal_toReal_eq_iff.mpr q_ne_top + · rw [toReal_inv, ENNReal.rpow_inv_rpow q'pos.ne'] + +-lemma simplify_factor₃ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hp₀ : 0 < p₀) (hp₀' : p₀ ≠ ⊤) (ht : t ∈ Ioo 0 1) ++lemma simplify_factor₃ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] ++ (hp₀ : 0 < p₀) (hp₀' : p₀ ≠ ⊤) (ht : t ∈ Ioo 0 1) + (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) (hp₀p₁ : p₀ = p₁) : + C₀ ^ q₀.toReal * (eLpNorm f p μ ^ p.toReal) ^ (q₀.toReal / p₀.toReal) = + (↑C₀ * eLpNorm f p μ) ^ q₀.toReal := by +@@ -811,9 +818,11 @@ lemma simplify_factor_aux₄ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E + (hp₀ : p₀ ∈ Ioc 0 q₀) (ht : t ∈ Ioo 0 1) + (hp₀p₁ : p₀ = p₁) (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) + (hF : eLpNorm f p μ ∈ Ioo 0 ⊤) : +- ↑C₀ ^ ((1 - t).toReal * q.toReal) * (eLpNorm f p μ ^ p.toReal) ^ ((1 - t).toReal * p₀⁻¹.toReal * q.toReal) * ++ ↑C₀ ^ ((1 - t).toReal * q.toReal) * ++ (eLpNorm f p μ ^ p.toReal) ^ ((1 - t).toReal * p₀⁻¹.toReal * q.toReal) * + ↑C₁ ^ (t.toReal * q.toReal) * +- (eLpNorm f p μ ^ p.toReal) ^ (t.toReal * p₁⁻¹.toReal * q.toReal) = C₀ ^ ((1 - t).toReal * q.toReal) * ++ (eLpNorm f p μ ^ p.toReal) ^ (t.toReal * p₁⁻¹.toReal * q.toReal) = ++ C₀ ^ ((1 - t).toReal * q.toReal) * + C₁ ^ (t.toReal * q.toReal) * eLpNorm f p μ ^ q.toReal := by + have hp' : p₀ = p := (interp_exp_eq hp₀p₁ ht hp) + have p₀ne_top : p₀ ≠ ⊤ := ne_top_of_le_ne_top hq₀' hp₀.2 +@@ -835,7 +844,8 @@ lemma simplify_factor_aux₄ [TopologicalSpace E₁] [ESeminormedAddCommMonoid E + · exact hp' ▸ d_pos_aux₀ hF |>.ne' + · exact hp' ▸ d_ne_top_aux₀ hF + +-lemma simplify_factor₄ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hq₀' : q₀ ≠ ⊤) ++lemma simplify_factor₄ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] ++ (hq₀' : q₀ ≠ ⊤) + (hp₀ : p₀ ∈ Ioc 0 q₀) (hp₁ : p₁ ∈ Ioc 0 q₁) (ht : t ∈ Ioo 0 1) + (hp₀p₁ : p₀ = p₁) + (hq₀q₁ : q₀ ≠ q₁) (hp : p⁻¹ = (1 - t) * p₀⁻¹ + t * p₁⁻¹) +@@ -851,7 +861,8 @@ lemma simplify_factor₄ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAd + rw [simplify_factor₀ (ht := ht) (hD := hD)] <;> assumption + + +-lemma simplify_factor₅ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hq₁' : q₁ ≠ ⊤) ++lemma simplify_factor₅ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] ++ (hq₁' : q₁ ≠ ⊤) + (hp₀ : p₀ ∈ Ioc 0 q₀) (hp₁ : p₁ ∈ Ioc 0 q₁) + (ht : t ∈ Ioo 0 1) + (hp₀p₁ : p₀ = p₁) +@@ -864,7 +875,8 @@ lemma simplify_factor₅ {D : ℝ≥0∞} [TopologicalSpace E₁] [ESeminormedAd + C₀ ^ ((1 - t).toReal * q.toReal) * C₁ ^ (t.toReal * q.toReal) * eLpNorm f p μ ^ q.toReal := by + have p₁pos : 0 < p₁ := hp₁.1 + have p₁ne_top : p₁ ≠ ⊤ := ne_top_of_le_ne_top hq₁' hp₁.2 +- rw [← simplify_factor₃ p₁pos p₁ne_top (mem_sub_Ioo one_ne_top ht) (switch_exponents ht hp) hp₀p₁.symm, ++ rw [← simplify_factor₃ p₁pos p₁ne_top (mem_sub_Ioo one_ne_top ht) ++ (switch_exponents ht hp) hp₀p₁.symm, + simplify_factor₁ hq₁' hp₀ hp₁ ht hq₀q₁ hp hq hC₀ hC₁ hF hD] + + /-- The trivial case for the estimate in the real interpolation theorem +@@ -876,7 +888,7 @@ lemma exists_hasStrongType_real_interpolation_aux₀ {p₀ p₁ q₀ q₁ p q : + (hp : p⁻¹ = (1 - t) / p₀ + t / p₁) + (hq : q⁻¹ = (1 - t) / q₀ + t / q₁) + (h₀T : HasWeakType T p₀ q₀ μ ν C₀) +- (h₂T : PreservesAEStrongMeasurability (μ := μ) (ν := ν) T p) (hf : MemLp f p μ) ++ (_h₂T : PreservesAEStrongMeasurability (μ := μ) (ν := ν) T p) (_hf : MemLp f p μ) + (hF : eLpNorm f p μ = 0) : + eLpNorm (T f) q ν = 0 := by + unfold HasWeakType at h₀T +@@ -884,14 +896,14 @@ lemma exists_hasStrongType_real_interpolation_aux₀ {p₀ p₁ q₀ q₁ p q : + have q₀pos : 0 < q₀ := pos_of_rb_Ioc hp₀ + have q₁pos : 0 < q₁ := pos_of_rb_Ioc hp₁ + have q_pos : 0 < q := interpolated_pos' q₀pos q₁pos (ne_top_of_Ioo ht) hq +- have f_ae_0 : f =ᵐ[μ] 0 := (eLpNorm_eq_zero_iff hf.1 p_pos.ne').mp hF +- have hf₂ : eLpNorm f p₀ μ = 0 := (eLpNorm_eq_zero_iff hf.1 hp₀.1.ne').mpr f_ae_0 +- have hf₁ : MemLp f p₀ μ := ⟨hf.1, by rw [hf₂]; exact zero_lt_top⟩ ++ have f_ae_0 : f =ᵐ[μ] 0 := (eLpNorm_eq_zero_iff p_pos.ne').mp hF ++ have hf₂ : eLpNorm f p₀ μ = 0 := (eLpNorm_eq_zero_iff hp₀.1.ne').mpr f_ae_0 ++ have hf₁ : MemLp f p₀ μ := by rw [MemLp, hf₂]; exact zero_lt_top + have := (h₀T f hf₁).2 + rw [hf₂, mul_zero] at this + have wnorm_0 : wnorm (T f) q₀ ν = 0 := nonpos_iff_eq_zero.mp this + have : (T f) =ᵐ[ν] 0 := (wnorm_eq_zero_iff q₀pos.ne').mp wnorm_0 +- exact (eLpNorm_eq_zero_iff (h₂T hf) q_pos.ne').mpr this ++ exact (eLpNorm_eq_zero_iff q_pos.ne').mpr this + + /-- The estimate for the real interpolation theorem in case `p₀ < p₁`. -/ + lemma exists_hasStrongType_real_interpolation_aux {p₀ p₁ q₀ q₁ p q : ℝ≥0∞} {A : ℝ≥0} +@@ -913,9 +925,9 @@ lemma exists_hasStrongType_real_interpolation_aux {p₀ p₁ q₀ q₁ p q : ℝ + have hq₀ : 0 < q₀ := pos_of_rb_Ioc hp₀ + have hq₁ : 0 < q₁ := pos_of_rb_Ioc hp₁ + rcases (eq_zero_or_pos (eLpNorm f p μ)) with hF | hF +- · refine le_of_eq_of_le ?_ (zero_le _) ++ · refine le_of_eq_of_le ?_ zero_le + apply exists_hasStrongType_real_interpolation_aux₀ (hp := hp) (hq := hq) <;> try assumption +- · let spf := spf_ch (toReal_mem_Ioo ht) hq₀q₁ hp₀.1 hq₀ hp₁.1 hq₁ hp₀p₁.ne hC₀ hC₁ ⟨hF, hf.2⟩ ++ · let spf := spf_ch (toReal_mem_Ioo ht) hq₀q₁ hp₀.1 hq₀ hp₁.1 hq₁ hp₀p₁.ne hC₀ hC₁ ⟨hF, hf⟩ + apply combine_estimates₁ <;> try assumption + on_goal 1 => unfold spf + rfl +@@ -966,9 +978,11 @@ lemma exists_hasStrongType_real_interpolation_aux₁ {f : α → E₁} + ENNReal.ofReal (t ^ (q.toReal - q₁.toReal - 1))) * + if q₁ = ⊤ then 0 else 1)) ^ + q.toReal⁻¹ = (ENNReal.ofReal q.toReal * +- (↑C₀ ^ ((1 - t).toReal * q.toReal) * ↑C₁ ^ (t.toReal * q.toReal) * eLpNorm f p μ ^ q.toReal * ++ (↑C₀ ^ ((1 - t).toReal * q.toReal) * ↑C₁ ^ (t.toReal * q.toReal) * ++ eLpNorm f p μ ^ q.toReal * + ENNReal.ofReal |q.toReal - q₀.toReal|⁻¹ * (if q₀ = ⊤ then 0 else 1) + +- ↑C₀ ^ ((1 - t).toReal * q.toReal) * ↑C₁ ^ (t.toReal * q.toReal) * eLpNorm f p μ ^ q.toReal * ++ ↑C₀ ^ ((1 - t).toReal * q.toReal) * ↑C₁ ^ (t.toReal * q.toReal) * ++ eLpNorm f p μ ^ q.toReal * + ENNReal.ofReal |q.toReal - q₁.toReal|⁻¹ * if q₁ = ⊤ then 0 else 1)) ^ + q.toReal⁻¹ := by + congr 3 +@@ -976,9 +990,7 @@ lemma exists_hasStrongType_real_interpolation_aux₁ {f : α → E₁} + div_eq_mul_inv, ← ofReal_inv_of_pos, ← ENNReal.ofReal_rpow_of_pos] <;> try positivity + rw [← mul_assoc, simplify_factor₄ (ht := ht) (hC₁ := hC₁) (hq₀' := hq₀q₁.ne_top)] + <;> try assumption +- · rw [abs_of_pos] <;> linarith +- · rw [abs_of_pos] <;> linarith +- · linarith ++ linarith + · split_ifs with is_q₁top + · rw [mul_zero, mul_zero] + · have q_lt_q₁toReal : q.toReal < q₁.toReal := +@@ -1025,9 +1037,9 @@ lemma exists_hasStrongType_real_interpolation_aux₂ {f : α → E₁} + (interp_exp_toReal_pos' ht q₀pos q₁pos hq (Or.inl hq₀q₁.ne_top)).ne' + have p_eq_p₀ : p = p₀ := (interp_exp_eq hp₀p₁ ht hp).symm + rcases (eq_zero_or_pos (eLpNorm f p μ)) with hF | snorm_pos +- · refine le_of_eq_of_le ?_ (zero_le _) ++ · refine le_of_eq_of_le ?_ zero_le + apply exists_hasStrongType_real_interpolation_aux₀ (hp := hp) (hq := hq) <;> try assumption +- · have hF : eLpNorm f p μ ∈ Ioo 0 ⊤ := ⟨snorm_pos, hf.2⟩ ++ · have hF : eLpNorm f p μ ∈ Ioo 0 ⊤ := ⟨snorm_pos, hf⟩ + have M_pos : 0 < M := toReal_pos (d_pos hC₀ hC₁ hF).ne' (d_ne_top hC₀ hC₁ hF) + have coe_q : ENNReal.ofReal q.toReal = q := + ofReal_toReal_eq_iff.mpr (interp_exp_ne_top hq₀q₁.ne ht hq) +@@ -1036,10 +1048,13 @@ lemma exists_hasStrongType_real_interpolation_aux₂ {f : α → E₁} + (interp_exp_toReal_pos ht q₀pos q₁pos hq₀q₁.ne hq)] + calc + (ENNReal.ofReal q.toReal * +- ∫⁻ (t : ℝ) in Ioi 0, distribution (T f) (ENNReal.ofReal t) ν * ENNReal.ofReal (t ^ (q.toReal - 1))) ^ q.toReal⁻¹ ++ ∫⁻ (t : ℝ) in Ioi 0, distribution (T f) (ENNReal.ofReal t) ν * ++ ENNReal.ofReal (t ^ (q.toReal - 1))) ^ q.toReal⁻¹ + ≤ (ENNReal.ofReal q.toReal * ( +- (∫⁻ (t : ℝ) in Ioo 0 M, distribution (T f) (ENNReal.ofReal t) ν * ENNReal.ofReal (t ^ (q.toReal - 1))) + +- (∫⁻ (t : ℝ) in Ici M, distribution (T f) (ENNReal.ofReal t) ν * ENNReal.ofReal (t ^ (q.toReal - 1)))) ++ (∫⁻ (t : ℝ) in Ioo 0 M, distribution (T f) (ENNReal.ofReal t) ν * ++ ENNReal.ofReal (t ^ (q.toReal - 1))) + ++ (∫⁻ (t : ℝ) in Ici M, distribution (T f) (ENNReal.ofReal t) ν * ++ ENNReal.ofReal (t ^ (q.toReal - 1)))) + ) ^ q.toReal⁻¹ := by + gcongr + rw [← Ioo_union_Ici_eq_Ioi (M_pos)] +@@ -1325,7 +1340,8 @@ lemma Subadditive_trunc_from_SubadditiveOn_Lp₀p₁ {p₀ p₁ p : ℝ≥0∞} + apply hT + · rcases lt_trichotomy p₀ p₁ with p₀lt_p₁ | (p₀eq_p₁ | p₁lt_p₀) + · refine Or.inr (trunc_Lp_Lq_higher (p := p) ?_ hf ha) +- exact ⟨interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp, (interp_exp_between hp₀ hp₁ p₀lt_p₁ ht hp).2.le⟩ ++ exact ⟨interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp, ++ (interp_exp_between hp₀ hp₁ p₀lt_p₁ ht hp).2.le⟩ + · exact Or.inl <| interp_exp_eq p₀eq_p₁ ht hp ▸ hf.trunc + · refine Or.inl (trunc_Lp_Lq_higher (p := p) ?_ hf ha) + exact ⟨interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp, +diff --git a/Carleson/ToMathlib/RealInterpolation/Minkowski.lean b/Carleson/ToMathlib/RealInterpolation/Minkowski.lean +index 43184f4..632342e 100644 +--- a/Carleson/ToMathlib/RealInterpolation/Minkowski.lean ++++ b/Carleson/ToMathlib/RealInterpolation/Minkowski.lean +@@ -42,8 +42,8 @@ lemma truncCut_mono {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} ( + · exact min_le_min_left (f x) (Nat.cast_le.mpr hmn) + · contrapose! is_fx_le_n + exact monotone_spanningSets _ hmn is_fx_le_m +- · exact zero_le _ +- · exact zero_le _ ++ · exact zero_le ++ · exact zero_le + + lemma truncCut_mono₀ {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} : + Monotone (truncCut f μ) := by +@@ -57,7 +57,7 @@ lemma truncCut_sup {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} (x + · intro n; unfold truncCut indicator + split_ifs + · exact min_le_left (f x) ↑n +- · exact zero_le _ ++ · exact zero_le + · intro w hw + unfold truncCut + have : ∃ m : ℕ, x ∈ spanningSets μ m := by +@@ -77,8 +77,6 @@ lemma truncCut_sup {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} (x + _ = _ := (Nat.cast_add m n).symm + · contrapose! is_x_in_Ampn + exact monotone_spanningSets _ (Nat.le_add_right m n) wm +- +-set_option linter.flexible false in + /-- Characterization of `∫⁻ x : α, f x ^ p ∂μ` by a duality argument. -/ + lemma representationLp {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞} + (hf : AEMeasurable f μ) {p q : ℝ} (hp : p > 1) (hq : q ≥ 1) +@@ -140,7 +138,7 @@ lemma representationLp {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞ + intro n + rcases eq_or_ne (∫⁻ x : α, (g n x) ^ p ∂μ) 0 with int_eq_zero | int_ne_zero + · rw [int_eq_zero, ENNReal.zero_rpow_of_pos] +- · exact zero_le _ ++ · exact zero_le + · exact inv_pos_of_pos (by positivity) + · calc + _ = (∫⁻ x : α, (f x) * (g n x) ^ (p - 1) ∂μ) * ( +@@ -173,7 +171,9 @@ lemma representationLp {μ : Measure α} [SigmaFinite μ] {f : α → ℝ≥0∞ + apply Monotone.map_iSup_of_continuousAt (f := fun (x : ℝ≥0∞) ↦ x ^ (1 / p)) + · fun_prop + · apply ENNReal.monotone_rpow_of_nonneg (by positivity) +- · simp; positivity ++ · simp only [bot_eq_zero', one_div, ENNReal.rpow_eq_zero_iff, inv_pos, true_and, ++ zero_ne_top, inv_neg'', false_and, or_false] ++ positivity + let h := fun n : ℕ ↦ (fun x ↦ g n x ^ (p - 1) / (∫⁻ y : α, ((g n y) ^ (p - 1)) ^ q ∂μ) ^ q⁻¹) + have comp_sup : (⨆ n : ℕ, ∫⁻ (x : α), f x * h n x ∂μ) ≤ + ⨆ g ∈ {g' : α → ℝ≥0∞ | AEMeasurable g' μ ∧ ∫⁻ (z : α), (g' z) ^ q ∂μ ≤ 1}, +@@ -250,9 +250,9 @@ lemma aemeasurability_prod₂ {α : Type u_1} {β : Type u_3} + ∀ᵐ y : β ∂ν, AEMeasurable (f ∘ (fun x ↦ Prod.mk x y)) μ := by + have : AEMeasurable (f ∘ Prod.swap) (ν.prod μ) := by + refine AEMeasurable.comp_measurable ?_ measurable_swap +- rw [Measure.prod_swap] +- assumption ++ rwa [Measure.prod_swap] + convert aemeasurability_prod₁ this -- perf: convert is faster than exact ++ rfl + + -- TODO: better name! + @[fun_prop] +@@ -324,7 +324,7 @@ lemma lintegral_lintegral_pow_swap_rpow {α : Type u_1} {β : Type u_3} {p : ℝ + /-! ## Apply Minkowski's integral inequality to truncations + -/ + +-@[measurability, fun_prop] ++@[fun_prop] + theorem aemeasurable_ton (tc : ToneCouple) : AEMeasurable tc.ton (volume.restrict (Ioi 0)) := by + -- ton is either increasing or decreasing + have tone := tc.ton_is_ton +@@ -336,8 +336,10 @@ theorem aemeasurable_ton (tc : ToneCouple) : AEMeasurable tc.ton (volume.restric + @[measurability] + lemma indicator_ton_measurable {g : α → E₁} [MeasurableSpace E₁] + [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] ++ [SFinite μ] + (hg : AEMeasurable g μ) (tc : ToneCouple) : +- NullMeasurableSet {(s, x) : ℝ≥0∞ × α | ‖g x‖ₑ ≤ tc.ton s } ((volume.restrict (Ioi 0)).prod μ) := by ++ NullMeasurableSet {(s, x) : ℝ≥0∞ × α | ‖g x‖ₑ ≤ tc.ton s } ++ ((volume.restrict (Ioi 0)).prod μ) := by + apply nullMeasurableSet_le hg.comp_snd.enorm + apply AEMeasurable.comp_fst (f := fun a ↦ tc.ton a) + refine AEMeasurable.comp_aemeasurable ?_ aemeasurable_id' +@@ -347,7 +349,7 @@ lemma indicator_ton_measurable {g : α → E₁} [MeasurableSpace E₁] + @[measurability] + lemma indicator_ton_measurable_lt {g : α → E₁} [MeasurableSpace E₁] + [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] +- [BorelSpace E₁] (hg : AEMeasurable g μ) (tc : ToneCouple) : ++ [BorelSpace E₁] [SFinite μ] (hg : AEMeasurable g μ) (tc : ToneCouple) : + NullMeasurableSet {(s, x) : ℝ≥0∞ × α | tc.ton s < ‖g x‖ₑ } + ((volume.restrict (Ioi 0)).prod μ) := by + refine nullMeasurableSet_lt ?_ hg.comp_snd.enorm +@@ -355,9 +357,10 @@ lemma indicator_ton_measurable_lt {g : α → E₁} [MeasurableSpace E₁] + refine AEMeasurable.comp_aemeasurable ?_ aemeasurable_id' + simp only [Measure.map_id', aemeasurable_ton] + +-@[measurability, fun_prop] ++@[fun_prop] + lemma AEMeasurable.trunc_ton {f : α → E₁} + [MeasurableSpace E₁] [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] ++ [SFinite (μ.restrict f.support)] + (hf : AEMeasurable f μ) (tc : ToneCouple) : + AEMeasurable (fun a : ℝ≥0∞ × α ↦ (trunc f (tc.ton a.1)) a.2) + ((volume.restrict (Ioi 0)).prod (μ.restrict f.support)) := by +@@ -369,49 +372,54 @@ lemma AEMeasurable.trunc_ton {f : α → E₁} + exact (aemeasurable_indicator_iff₀ (indicator_ton_measurable (AEMeasurable.restrict hf) _)).mpr + hf.restrict.comp_snd.restrict + +-@[measurability, fun_prop] ++@[fun_prop] + lemma AEMeasurable.truncCompl_ton {f : α → E₁} + [MeasurableSpace E₁] [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] ++ [SFinite (μ.restrict f.support)] + (hf : AEMeasurable f μ) (tc : ToneCouple) : + AEMeasurable (fun a : ℝ≥0∞ × α ↦ ((truncCompl f (tc.ton a.1))) a.2) + ((volume.restrict (Ioi 0)).prod (μ.restrict f.support )) := by + let A := {(s, x) : ℝ≥0∞ × α | tc.ton s < ‖f x‖ₑ} +- have : (fun z : ℝ≥0∞ × α ↦ (truncCompl f (tc.ton z.1)) z.2) = Set.indicator A (fun z : ℝ≥0∞ × α ↦ f z.2) := by ++ have : (fun z : ℝ≥0∞ × α ↦ (truncCompl f (tc.ton z.1)) z.2) = ++ Set.indicator A (fun z : ℝ≥0∞ × α ↦ f z.2) := by + ext z; rw [truncCompl_eq]; simp [A, indicator] + rw [this] + exact (aemeasurable_indicator_iff₀ (indicator_ton_measurable_lt hf.restrict _)).mpr + hf.restrict.comp_snd.restrict + + -- TODO: better name! +-lemma restrict_to_support {p : ℝ} (hp : 0 < p) [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (f : α → E₁) : ++lemma restrict_to_support {p : ℝ} (hp : 0 < p) [TopologicalSpace E₁] ++ [ESeminormedAddCommMonoid E₁] (f : α → E₁) : + ∫⁻ x : α in f.support, ‖trunc f t x‖ₑ ^ p ∂ μ = ∫⁻ x : α, ‖trunc f t x‖ₑ ^ p ∂μ := by + apply setLIntegral_eq_of_support_subset + unfold Function.support trunc +- rw [setOf_subset_setOf] ++ rw [ofPred_subset_ofPred] + intro x + contrapose! + intro f_zero + simp_rw [f_zero]; simp [hp] + + -- TODO: better name! +-lemma restrict_to_support_truncCompl {p : ℝ} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hp : 0 < p) (f : α → E₁) : ++lemma restrict_to_support_truncCompl {p : ℝ} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] ++ (hp : 0 < p) (f : α → E₁) : + ∫⁻ x : α in f.support, ‖(truncCompl f t) x‖ₑ ^ p ∂μ = + ∫⁻ x : α, ‖(truncCompl f t) x‖ₑ ^ p ∂μ := by + apply setLIntegral_eq_of_support_subset + unfold Function.support +- rw [truncCompl_eq, setOf_subset_setOf] ++ rw [truncCompl_eq, ofPred_subset_ofPred] + intro x + contrapose! + intro f_zero + simp [hp, f_zero] + + -- TODO: better name! +-lemma restrict_to_support_trnc {p : ℝ} {j : Bool} [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] (hp : 0 < p) (f : α → E₁) : ++lemma restrict_to_support_trnc {p : ℝ} {j : Bool} [TopologicalSpace E₁] ++ [ESeminormedAddCommMonoid E₁] (hp : 0 < p) (f : α → E₁) : + ∫⁻ x : α in f.support, ‖trnc j f t x‖ₑ ^ p ∂μ = + ∫⁻ x : α, ‖trnc j f t x‖ₑ ^ p ∂μ := by + apply setLIntegral_eq_of_support_subset + unfold Function.support trnc trunc truncCompl +- rw [setOf_subset_setOf] ++ rw [ofPred_subset_ofPred] + intro x + contrapose! + intro f_zero +@@ -420,7 +428,9 @@ lemma restrict_to_support_trnc {p : ℝ} {j : Bool} [TopologicalSpace E₁] [ESe + + @[fun_prop] + theorem AEMeasurable.trnc_restrict +- [MeasurableSpace E₁] [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] {j : Bool} ++ [MeasurableSpace E₁] [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [BorelSpace E₁] ++ {j : Bool} ++ [SFinite (μ.restrict f.support)] + (hf : AEMeasurable f μ) (tc : ToneCouple) : + AEMeasurable (fun a ↦ trnc j f (tc.ton a.1) a.2) + ((volume.restrict (Ioi 0)).prod (μ.restrict f.support)) := by +@@ -442,14 +452,15 @@ lemma lintegral_lintegral_pow_swap_truncCompl {q q₀ p₀ : ℝ} [MeasurableSpa + (∫⁻ a : α in f.support, + (∫⁻ (s : ℝ) in Ioi 0, + (ENNReal.ofReal (s ^ (q - q₀ - 1)) ^ (p₀⁻¹ * q₀)⁻¹ * +- ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀) ^ (p₀⁻¹ * q₀)) ^ (p₀⁻¹ * q₀)⁻¹ ∂μ) ^ (p₀⁻¹ * q₀) := by ++ ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀) ^ (p₀⁻¹ * q₀)) ^ ++ (p₀⁻¹ * q₀)⁻¹ ∂μ) ^ (p₀⁻¹ * q₀) := by + apply lintegral_lintegral_pow_swap_rpow + · apply le_of_mul_le_mul_left _ hp₀ + field_simp + exact hp₀q₀ + · unfold Function.uncurry + -- TODO: this is quite some effort, somehow the infrastructure may need to be better +- apply AEMeasurable.mul' ++ apply AEMeasurable.mul + · fun_prop + · have : (fun a ↦ ‖trnc j f (tc.ton (ENNReal.ofReal a.1)) a.2‖ₑ ^ p₀) = + (fun a ↦ ‖trnc j f (tc.ton a.1) a.2‖ₑ ^ p₀ ) ∘ +@@ -458,10 +469,13 @@ lemma lintegral_lintegral_pow_swap_truncCompl {q q₀ p₀ : ℝ} [MeasurableSpa + apply AEMeasurable.comp_aemeasurable + · rw [← Measure.map_prod_map] + · simp only [Measure.map_id'] +- have : Measure.map (fun a ↦ ENNReal.ofReal a) (volume.restrict (Ioi 0)) = volume.restrict (Ioi 0) := by ++ have : Measure.map (fun a ↦ ENNReal.ofReal a) (volume.restrict (Ioi 0)) = ++ volume.restrict (Ioi 0) := by + simp [map_restrict_Ioi_eq_restrict_Ioi] + rw [this] +- have : (fun a ↦ ‖trnc j f (tc.ton a.1) a.2‖ₑ ^ p₀) = (fun z : E₁ ↦ ‖ z ‖ₑ ^ p₀) ∘ (fun a : ℝ≥0∞ × α ↦ trnc j f (tc.ton a.1) a.2) := rfl ++ have : (fun a ↦ ‖trnc j f (tc.ton a.1) a.2‖ₑ ^ p₀) = ++ (fun z : E₁ ↦ ‖z‖ₑ ^ p₀) ∘ ++ (fun a : ℝ≥0∞ × α ↦ trnc j f (tc.ton a.1) a.2) := rfl + rw [this] + apply AEMeasurable.comp_aemeasurable + · fun_prop +@@ -478,13 +492,13 @@ lemma lintegral_congr_support {f : α → E₁} {g h : α → ENNReal} + rw [Measure.restrict_apply₀'] + · refine measure_mono_null (fun x h₀ ↦ ?_) measure_empty + have : g x = h x := hgh _ (mem_of_mem_inter_right h₀) +- have : x ∈ {a | ¬g a = h a} := mem_of_mem_diff h₀ ++ have : x ∈ {a | ¬g a = h a} := mem_of_mem_sdiff h₀ + change ¬ (g x = h x) at this + contradiction + · have : f.support = (fun x ↦ ‖f x‖ₑ).support := by + unfold Function.support + ext x +- simp only [ne_eq, mem_setOf_eq, enorm_eq_zero] ++ simp only [ne_eq, mem_ofPred_eq, enorm_eq_zero] + rw [this] + exact (aestronglyMeasurable_iff_aemeasurable.mpr hf.enorm).nullMeasurableSet_support + +@@ -504,24 +518,21 @@ lemma estimate_trnc {p₀ q₀ q : ℝ} {spf : ScaledPowerFunction} {j : Bool} + (∫⁻ (a : α) in f.support, + ‖f a‖ₑ ^ (p₀ + spf.σ⁻¹ * (q - q₀) * (p₀ / q₀)) ∂μ) ^ (p₀⁻¹ * q₀) := by + have := spf.hd +- unfold eLpNorm eLpNorm' ++ simp_rw [eLpNorm_eq_eLpNorm' (ofReal_pos.mpr hp₀).ne' coe_ne_top ++ (aestronglyMeasurable_trnc hf), eLpNorm', toReal_ofReal hp₀.le] + set tc := (spf_to_tc spf).toToneCouple +- split_ifs with is_p₀pos is_p₀top +- · have : p₀ ≤ 0 := ofReal_eq_zero.mp is_p₀pos +- contrapose! this; exact hp₀ +- · contrapose! is_p₀top; exact coe_ne_top +- · rw [toReal_ofReal hp₀.le] +- calc ++ calc + _ = ∫⁻ s : ℝ in Ioi 0, ENNReal.ofReal (s ^ (q - q₀ - 1)) * +- ((∫⁻ (a : α), ↑‖trnc j f ((spf_to_tc spf).ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ (1 / p₀)) ^ q₀ := by ++ ((∫⁻ (a : α), ↑‖trnc j f ((spf_to_tc spf).ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ ++ (1 / p₀)) ^ q₀ := by + congr 1 + ext x + rw [mul_comm] + _ = ∫⁻ (s : ℝ) in Ioi 0, + (ENNReal.ofReal (s ^ (q - q₀ - 1)) ^ (p₀⁻¹ * q₀)⁻¹) ^ (p₀⁻¹ * q₀) * +- (∫⁻ (a : α) in f.support, ↑‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ (p₀⁻¹ * q₀) := by ++ (∫⁻ (a : α) in f.support, ↑‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ ++ (p₀⁻¹ * q₀) := by + refine setLIntegral_congr_fun measurableSet_Ioi fun s hs ↦ ?_ +- dsimp + rw [ENNReal.rpow_inv_rpow] + · rw [one_div, ← ENNReal.rpow_mul, restrict_to_support_trnc hp₀] + · positivity +@@ -530,14 +541,14 @@ lemma estimate_trnc {p₀ q₀ q : ℝ} {spf : ScaledPowerFunction} {j : Bool} + ENNReal.ofReal (s ^ (q - q₀ - 1)) ^ (p₀⁻¹ * q₀)⁻¹ * + ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀ ∂μ) ^ (p₀⁻¹ * q₀) := by + refine setLIntegral_congr_fun measurableSet_Ioi fun s hs ↦ ?_ +- dsimp + rw [lintegral_const_mul', ENNReal.mul_rpow_of_nonneg] + · positivity + · exact (ENNReal.rpow_lt_top_of_nonneg (by positivity) coe_ne_top).ne + _ ≤ (∫⁻ a : α in f.support, + (∫⁻ (s : ℝ) in Ioi 0, + (ENNReal.ofReal (s ^ (q - q₀ - 1)) ^ (p₀⁻¹ * q₀)⁻¹ * +- ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀) ^ (p₀⁻¹ * q₀)) ^ (p₀⁻¹ * q₀)⁻¹ ∂μ) ^ (p₀⁻¹ * q₀) := by ++ ‖trnc j f (tc.ton (ENNReal.ofReal s)) a‖ₑ ^ p₀) ^ (p₀⁻¹ * q₀)) ^ ++ (p₀⁻¹ * q₀)⁻¹ ∂μ) ^ (p₀⁻¹ * q₀) := by + -- This is a consequence of Minkowski's integral inequality + apply lintegral_lintegral_pow_swap_truncCompl hp₀ hp₀q₀ hf tc; assumption + _ = (∫⁻ a : α in f.support, +@@ -549,7 +560,6 @@ lemma estimate_trnc {p₀ q₀ q : ℝ} {spf : ScaledPowerFunction} {j : Bool} + intro x _ + congr 1 + refine setLIntegral_congr_fun measurableSet_Ioi fun s hs ↦ ?_ +- dsimp + rw [ENNReal.mul_rpow_of_nonneg, ENNReal.rpow_inv_rpow, ← ENNReal.rpow_mul] <;> try positivity + congr + field_simp +@@ -636,7 +646,8 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} + (hf : AEStronglyMeasurable f μ) (hf₂ : SigmaFinite (μ.restrict f.support)) + (hspf : spf.σ = ζ p₀ q₀ p₁ q₁ t.toReal) : + ∫⁻ s : ℝ in Ioi 0, +- eLpNorm (trnc j f ((spf_to_tc spf).ton (ENNReal.ofReal s))) (sel j p₀ p₁) μ ^ (sel j q₀ q₁).toReal * ++ eLpNorm (trnc j f ((spf_to_tc spf).ton (ENNReal.ofReal s))) (sel j p₀ p₁) μ ^ ++ (sel j q₀ q₁).toReal * + ENNReal.ofReal (s ^ (q.toReal - (sel j q₀ q₁).toReal - 1)) ≤ + (spf.d ^ (q.toReal - (sel j q₀ q₁).toReal)) * + ENNReal.ofReal |q.toReal - (sel j q₀ q₁).toReal|⁻¹ * +@@ -670,7 +681,8 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} + ‖f a‖ₑ ^ ((sel j p₀ p₁).toReal + spf.σ⁻¹ * (q.toReal - (sel j q₀ q₁).toReal) * + ((sel j p₀ p₁).toReal / (sel j q₀ q₁).toReal)) ∂μ) ^ + ((sel j p₀ p₁).toReal ⁻¹ * (sel j q₀ q₁).toReal) := by +- have coe_p' : ENNReal.ofReal (sel j p₀ p₁).toReal = (sel j p₀ p₁) := ofReal_toReal_eq_iff.mpr hp' ++ have coe_p' : ENNReal.ofReal (sel j p₀ p₁).toReal = (sel j p₀ p₁) := ++ ofReal_toReal_eq_iff.mpr hp' + nth_rw 1 [← coe_p'] + apply estimate_trnc + · apply toReal_pos +@@ -690,7 +702,7 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} + cases j + · unfold sel + dsimp only +- simp only [hspf, Bool.if_false_right, Bool.and_true, Bool.false_bne, decide_eq_true_eq] ++ simp only [hspf, Bool.ite_false_right, Bool.and_true, Bool.false_bne, decide_eq_true_eq] + split_ifs with is_ζ_pos + · apply toReal_strict_mono + · exact interp_exp_ne_top hq₀q₁ ht hq +@@ -700,7 +712,7 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} + (le_of_not_gt is_ζ_pos) + · unfold sel + dsimp only +- simp only [hspf, Bool.if_false_right, Bool.and_true, Bool.true_bne, Bool.not_eq_true', ++ simp only [hspf, Bool.ite_false_right, Bool.and_true, Bool.true_bne, Bool.not_eq_true', + decide_eq_false_iff_not] + split_ifs with is_ζ_pos + · apply toReal_strict_mono hq' +@@ -737,7 +749,7 @@ lemma estimate_trnc₁ {spf : ScaledPowerFunction} {j : Bool} + ((sel j p₀ p₁).toReal ⁻¹ * (sel j q₀ q₁).toReal) := by + congr + rw [← one_div] +- refine (eLpNorm_eq_lintegral_rpow_enorm_toReal (ε := E₁) ?_ ?_).symm ++ refine (eLpNorm_eq_lintegral_rpow_enorm_toReal (ε := E₁) ?_ ?_ hf).symm + · exact (interpolated_pos' hp₀ hp₁ (ne_top_of_Ioo ht) hp).ne' + · exact interp_exp_ne_top hp₀p₁.ne ht hp + +@@ -774,20 +786,27 @@ lemma wnorm_eq_zero_iff [ENormedAddMonoid ε] {f : α → ε} {p : ℝ≥0∞} ( + exact iSup_wnorm b.toNNReal + exact meas_ne_zero this + · refine iSup_eq_zero.mpr fun t ↦ mul_eq_zero.mpr +- (Or.inr ((rpow_eq_zero_iff_of_pos (inv_pos_of_pos (toReal_pos hp h₀))).mpr (nonpos_iff_eq_zero.mp ?_))) ++ (Or.inr ((rpow_eq_zero_iff_of_pos (inv_pos_of_pos (toReal_pos hp h₀))).mpr ++ (nonpos_iff_eq_zero.mp ?_))) + calc +- _ ≤ distribution f 0 μ := by gcongr; exact zero_le _ ++ _ ≤ distribution f 0 μ := by gcongr; exact zero_le + _ = distribution f (eLpNormEssSup f μ) μ := by congr; exact h.symm + _ = 0 := distribution_snormEssSup + + + /-! ## Weaktype estimates applied to truncations -/ + +-variable [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] [TopologicalSpace E₂] [ESeminormedAddCommMonoid E₂] +- {E₁' E₂' : Type*} [TopologicalSpace E₁'] [ENormedAddCommMonoid E₁'] [TopologicalSpace E₂'] [ENormedAddCommMonoid E₂'] ++variable [TopologicalSpace E₁] [ESeminormedAddCommMonoid E₁] ++ [TopologicalSpace E₂] [ESeminormedAddCommMonoid E₂] ++ {E₁' E₂' : Type*} [TopologicalSpace E₁'] [ENormedAddCommMonoid E₁'] ++ [TopologicalSpace E₂'] [ENormedAddCommMonoid E₂'] + + lemma eLpNorm_trnc_est {f : α → E₁} {j : Bool} : +- eLpNorm (trnc j f t) p μ ≤ eLpNorm f p μ := eLpNorm_mono_enorm fun _x ↦ trnc_le_func ++ eLpNorm (trnc j f t) p μ ≤ eLpNorm f p μ := by ++ by_cases hf : AEStronglyMeasurable f μ ++ · exact eLpNorm_mono_enorm (aestronglyMeasurable_trnc hf) fun _x ↦ trnc_le_func ++ · rw [eLpNorm_of_not_aestronglyMeasurable hf] ++ exact le_top + + variable [ContinuousENorm ε₁] [ContinuousENorm ε₂] {T : (α → ε₁) → (α' → ε₂)} in + lemma weaktype_estimate {C₀ : ℝ≥0} {p : ℝ≥0∞} {q : ℝ≥0∞} {f : α → ε₁} +@@ -826,15 +845,18 @@ variable [ENormedAddMonoid ε₁] [ENormedAddMonoid ε₂] in + lemma weaktype_aux₀ {f : α → ε₁} {T : (α → ε₁) → (α' → ε₂)} + {p₀ q₀ p q : ℝ≥0∞} (hp₀ : 0 < p₀) (hq₀ : 0 < q₀) (hp : 0 < p) (hq : 0 < q) + {C₀ : ℝ≥0} (h₀T : HasWeakType T p₀ q₀ μ ν C₀) +- (hf : AEStronglyMeasurable f μ) (hF : eLpNorm f p μ = 0) : eLpNorm (T f) q ν = 0 := by +- have f_ae_0 : f =ᵐ[μ] 0 := (eLpNorm_eq_zero_iff hf hp.ne').mp hF +- have hf₂ : eLpNorm f p₀ μ = 0 := (eLpNorm_eq_zero_iff hf hp₀.ne').mpr f_ae_0 +- have hf₁ : MemLp f p₀ μ := ⟨hf, by rw [hf₂]; exact zero_lt_top⟩ ++ (_hf : AEStronglyMeasurable f μ) (hF : eLpNorm f p μ = 0) : eLpNorm (T f) q ν = 0 := by ++ have f_ae_0 : f =ᵐ[μ] 0 := (eLpNorm_eq_zero_iff hp.ne').mp hF ++ have hf₂ : eLpNorm f p₀ μ = 0 := (eLpNorm_eq_zero_iff hp₀.ne').mpr f_ae_0 ++ have hf₁ : MemLp f p₀ μ := by ++ change eLpNorm f p₀ μ < ∞ ++ rw [hf₂] ++ exact zero_lt_top + have := (h₀T f hf₁).2 + rw [hf₂, mul_zero] at this + have wnorm_0 : wnorm (T f) q₀ ν = 0 := nonpos_iff_eq_zero.mp this + have : (T f) =ᵐ[ν] 0 := (wnorm_eq_zero_iff hq₀.ne').mp wnorm_0 +- exact (eLpNorm_eq_zero_iff (h₀T _ hf₁).1 hq.ne').mpr this ++ exact (eLpNorm_eq_zero_iff hq.ne').mpr this + + -- for the remaining lemmas we use too much measure theory that is just for normed spaces + -- try to generalize to ENorm-classes after Mathlib refactor +@@ -867,7 +889,8 @@ lemma weaktype_estimate_trunc_top_top {a : ℝ≥0∞} {C₁ : ℝ≥0} + rw [ha] + have obs : MemLp (trunc f (t / C₁)) p₁ μ := trunc_Lp_Lq_higher ⟨hp, hp₁p⟩ hf (by finiteness) + have wt_est := (h₁T (trunc f (t / C₁)) obs).2 +- simp only [wnorm, eLpNorm, hq₁, ↓reduceIte, hp₁, top_ne_zero] at wt_est ++ simp only [wnorm, hq₁, ↓reduceIte, hp₁, ++ eLpNorm_exponent_top obs.aestronglyMeasurable] at wt_est + apply nonpos_iff_eq_zero.mp + have ineq : eLpNormEssSup (T' (trunc f (t / C₁))) ν ≤ t := calc + _ ≤ C₁ * eLpNormEssSup (trunc f (t / C₁)) μ := wt_est +@@ -875,7 +898,7 @@ lemma weaktype_estimate_trunc_top_top {a : ℝ≥0∞} {C₁ : ℝ≥0} + gcongr + exact trunc_eLpNormEssSup_le _ + _ ≤ _ := by +- rw [max_eq_right (zero_le _), ++ rw [max_eq_right zero_le, + ENNReal.mul_div_cancel (ENNReal.coe_ne_zero.mpr hC₁.ne') (by finiteness)] + calc + _ ≤ distribution (T' (trunc f (t / C₁))) (eLpNormEssSup (T' (trunc f (t / C₁))) ν) ν := +@@ -893,15 +916,16 @@ lemma weaktype_estimate_truncCompl_top {C₀ : ℝ≥0} (hC₀ : 0 < C₀) {p p + rcases (eq_zero_or_pos (eLpNormEssSup f μ)) with snorm_zero | snorm_pos + · have : eLpNorm (trnc ⊥ f a) ⊤ μ = 0 := by + apply nonpos_iff_eq_zero.mp +- rw [← snorm_zero] ++ rw [← snorm_zero, ← eLpNorm_exponent_top hf.aestronglyMeasurable] + exact eLpNorm_trnc_est (p := ⊤) + have obs : eLpNorm (T' (trnc ⊥ f a)) ⊤ ν = 0 := +- weaktype_aux₀ hp₀ (hq₀ ▸ zero_lt_top) zero_lt_top zero_lt_top h₀T hf.1.truncCompl this +- exact nonpos_iff_eq_zero.mp (Trans.trans (distribution_mono_right (Trans.trans obs +- (zero_le t))) meas_eLpNormEssSup_lt) ++ weaktype_aux₀ hp₀ (hq₀ ▸ zero_lt_top) zero_lt_top zero_lt_top h₀T ++ hf.aestronglyMeasurable.truncCompl this ++ exact nonpos_iff_eq_zero.mp ((distribution_mono_right ++ (eLpNormEssSup_le_eLpNorm_top.trans (obs ▸ zero_le))).trans meas_eLpNormEssSup_lt.le) + · have p_pos : 0 < p := hp₀.trans hp₀p + have snorm_p_pos : eLpNorm f p μ ≠ 0 := fun snorm_0 ↦ snorm_pos.ne' <| +- eLpNormEssSup_eq_zero_iff.mpr <| (eLpNorm_eq_zero_iff hf.1 p_pos.ne').mp snorm_0 ++ eLpNormEssSup_eq_zero_iff.mpr <| (eLpNorm_eq_zero_iff p_pos.ne').mp snorm_0 + have term_pos : (ENNReal.ofNNReal C₀) ^ p₀.toReal * eLpNorm f p μ ^ p.toReal > 0 := by + apply ENNReal.mul_pos <;> exact (rpow_pos_of_nonneg (by positivity) (by positivity)).ne' + have d_pos : 0 < d := hdeq ▸ ENNReal.rpow_pos term_pos (by finiteness) +@@ -919,7 +943,7 @@ lemma weaktype_estimate_truncCompl_top {C₀ : ℝ≥0} (hC₀ : 0 < C₀) {p p + eLpNorm f p μ ^ p.toReal) := by + rw [ENNReal.mul_rpow_of_nonneg _ _ toReal_nonneg] + gcongr +- exact estimate_eLpNorm_truncCompl hp ⟨hp₀, hp₀p.le⟩ hf.1 a_pos ++ exact estimate_eLpNorm_truncCompl hp ⟨hp₀, hp₀p.le⟩ hf.aestronglyMeasurable a_pos + _ = (↑C₀) ^ p₀.toReal * eLpNorm f p μ ^ p.toReal * (d ^ p₀.toReal)⁻¹ * (t ^ p₀.toReal) := by + rw [ha, ← ENNReal.rpow_mul, div_mul_cancel₀] + · -- FIXME: can/should this be shared with the lemma below? +@@ -968,7 +992,7 @@ lemma weaktype_estimate_trunc_top {C₁ : ℝ≥0} (hC₁ : 0 < C₁) {p p₁ q + calc + _ ≤ (ENNReal.ofNNReal C₁) * eLpNorm f p₁ μ := by + gcongr +- apply eLpNorm_mono_enorm (fun x ↦ trunc_le_func) ++ exact eLpNorm_mono_enorm obs.aestronglyMeasurable (fun _x ↦ trunc_le_func) + _ ≤ _ := by + have : eLpNorm f p₁ μ = 0 := Trans.trans (eLpNorm_congr_ae + (eLpNormEssSup_eq_zero_iff.mp snorm_zero)) eLpNorm_zero +@@ -977,7 +1001,7 @@ lemma weaktype_estimate_trunc_top {C₁ : ℝ≥0} (hC₁ : 0 < C₁) {p p₁ q + intro snorm_0 + apply snorm_pos.ne' + apply eLpNormEssSup_eq_zero_iff.mpr +- exact (eLpNorm_eq_zero_iff hf.1 hp.ne').mp snorm_0 ++ exact (eLpNorm_eq_zero_iff hp.ne').mp snorm_0 + -- XXX: these lines are the same as in the lemma above + have term_pos : (ENNReal.ofNNReal C₁) ^ p₁.toReal * eLpNorm f p μ ^ p.toReal > 0 := by + apply ENNReal.mul_pos <;> exact (rpow_pos_of_nonneg (by positivity) (by positivity)).ne' +@@ -985,7 +1009,7 @@ lemma weaktype_estimate_trunc_top {C₁ : ℝ≥0} (hC₁ : 0 < C₁) {p p₁ q + _ ≤ ↑C₁ ^ p₁.toReal * (((a ^ (p₁.toReal - p.toReal))) * eLpNorm f p μ ^ p.toReal) := by + rw [ENNReal.mul_rpow_of_nonneg _ _ (by positivity)] + gcongr +- exact estimate_eLpNorm_trunc hp₁.ne_top ⟨hp, hp₁p.le⟩ hf.1 ++ exact estimate_eLpNorm_trunc hp₁.ne_top ⟨hp, hp₁p.le⟩ hf.aestronglyMeasurable + _ = ↑C₁ ^ p₁.toReal * eLpNorm f p μ ^ p.toReal * (d ^ p₁.toReal)⁻¹ * (t ^ p₁.toReal) := by + rw [ha, ← ENNReal.rpow_mul, div_mul_cancel₀] + · rw [ENNReal.div_rpow_of_nonneg, div_eq_mul_inv] <;> try positivity +@@ -994,7 +1018,8 @@ lemma weaktype_estimate_trunc_top {C₁ : ℝ≥0} (hC₁ : 0 < C₁) {p p₁ q + _ = _ := by + nth_rw 2 [← one_mul (t ^ p₁.toReal)] + congr +- rw [hdeq, ENNReal.rpow_inv_rpow hp₁' _, ENNReal.mul_inv_cancel term_pos.ne' (by finiteness)] ++ rw [hdeq, ENNReal.rpow_inv_rpow hp₁' _, ++ ENNReal.mul_inv_cancel term_pos.ne' (by finiteness)] + apply nonpos_iff_eq_zero.mp + calc + _ ≤ distribution (T' (trunc f a)) (eLpNormEssSup (T' (trunc f a)) ν) ν := by gcongr +diff --git a/Carleson/ToMathlib/RealInterpolation/Misc.lean b/Carleson/ToMathlib/RealInterpolation/Misc.lean +index d72de05..d2ea11e 100644 +--- a/Carleson/ToMathlib/RealInterpolation/Misc.lean ++++ b/Carleson/ToMathlib/RealInterpolation/Misc.lean +@@ -90,7 +90,6 @@ def spf_to_tc (spf : ScaledPowerFunction) : StrictRangeToneCouple where + intro s t hst + beta_reduce + gcongr +- exact this + · simp only [Bool.false_eq_true, ↓reduceIte] + intro s t hst + rcases spf.hσ with σ_pos | σ_neg +@@ -196,7 +195,8 @@ lemma d_ne_top_aux₃ {C : ℝ≥0} {b c : ℝ} (hC : 0 < C) + C ^ c * (eLpNorm f p μ ^ p.toReal) ^ b ≠ ⊤ := + mul_ne_top (d_ne_top_aux₁ hC) (d_ne_top_aux₂ hF) + +-lemma d_ne_zero_aux₃ {b₀ c₀ b₁ c₁ : ℝ} (hC₀ : 0 < C₀) (hC₁ : 0 < C₁) (hF : eLpNorm f p μ ∈ Ioo 0 ⊤) : ++lemma d_ne_zero_aux₃ {b₀ c₀ b₁ c₁ : ℝ} (hC₀ : 0 < C₀) (hC₁ : 0 < C₁) ++ (hF : eLpNorm f p μ ∈ Ioo 0 ⊤) : + (C₀ ^ c₀ * (eLpNorm f p μ ^ p.toReal) ^ b₀) / + (C₁ ^ c₁ * (eLpNorm f p μ ^ p.toReal) ^ b₁) ≠ 0 := by + refine ENNReal.div_ne_zero.mpr ⟨?_, ?_⟩ +@@ -312,7 +312,7 @@ lemma lintegral_double_restrict_set {A B : Set α} {f : α → ℝ≥0∞} (hA : + (hB : MeasurableSet B) (hf : ∀ᵐ (x : α) ∂μ, x ∈ A \ B → f x ≤ 0) : + ∫⁻ x in A, f x ∂μ = ∫⁻ x in A ∩ B, f x ∂μ := by + have h₀ := setLIntegral_mono_ae' (MeasurableSet.diff hA hB) hf; rw [lintegral_zero] at h₀ +- rw [← lintegral_inter_add_diff (hB := hB), nonpos_iff_eq_zero.mp h₀, add_zero] ++ rw [← lintegral_inter_add_sdiff (hB := hB), nonpos_iff_eq_zero.mp h₀, add_zero] + + -- local convenience function + lemma lintegral_rw_aux {g : ℝ → ℝ≥0∞} {f₁ f₂ : ℝ → ℝ≥0∞} {A : Set ℝ} +@@ -336,10 +336,10 @@ lemma power_aux_2 {p q : ℝ} : + lemma power_aux_3 {p q : ℝ} : + (fun s : ℝ≥0∞ ↦ s ^ (p + q)) =ᶠ[ae volume] (fun s ↦ s ^ p * s ^ q ) := by + filter_upwards [Ioo_zero_top_ae_eq_univ] with a ha +- unfold Ioo at ha ++ have ha' : a ∈ Ioo 0 ∞ := ha.mpr (mem_univ a) + refine ENNReal.rpow_add p q ?_ ?_ +- · simp [pos_iff_ne_zero] at ha; by_contra; have := (ha.mpr trivial).1; tauto +- · simp [lt_top_iff_ne_top] at ha; by_contra; have := (ha.mpr trivial).2; tauto ++ · exact ha'.1.ne' ++ · exact ha'.2.ne + + lemma power_aux_4 {p : ℝ} : + (fun s ↦ ENNReal.ofReal (s ^ p)) =ᶠ[ae (volume.restrict (Ioi (0 : ℝ)))] +@@ -402,7 +402,9 @@ namespace MeasureTheory + def trunc (f : α → ε) (t : ℝ≥0∞) (x : α) : ε := if ‖f x‖ₑ ≤ t then f x else 0 + + lemma trunc_eq_indicator : trunc f t = {x | ‖f x‖ₑ ≤ t}.indicator f := by +- ext x; simp_rw [trunc, Set.indicator, mem_setOf_eq, ite_eq_ite] ++ funext x ++ simp only [trunc, Set.indicator, mem_ofPred_eq] ++ split_ifs <;> rfl + + @[simp] + lemma trunc_top : trunc f ∞ = f := by simp [trunc_eq_indicator] +@@ -412,7 +414,7 @@ def truncCompl (f : α → ε) (t : ℝ≥0∞) (x : α) : ε := if ‖f x‖ₑ + + lemma truncCompl_eq_indicator : truncCompl f t = {x | ‖f x‖ₑ ≤ t}ᶜ.indicator f := by + ext x +- simp only [truncCompl, Set.indicator, mem_compl_iff, mem_setOf_eq, ite_not] ++ simp only [truncCompl, Set.indicator, mem_compl_iff, mem_ofPred_eq, ite_not] + + @[simp] + lemma truncCompl_top : truncCompl f ∞ = (fun _ ↦ 0) := by simp [truncCompl_eq_indicator] +@@ -462,7 +464,6 @@ function itself. -/ + lemma truncCompl_of_nonpos {f : α → ε'} (ht : t ≤ 0) : truncCompl f t = f := by + rw [truncCompl_eq] + ext x +- dsimp only [Pi.zero_apply] + split_ifs + · rfl + · apply (enorm_eq_zero.mp ?_).symm +@@ -485,17 +486,18 @@ lemma truncCompl_of_nonpos {f : α → ε'} (ht : t ≤ 0) : truncCompl f t = f + -- apply Measurable.ite ?_ hf measurable_const + -- exact measurableSet_lt measurable_const hf.norm + +-@[measurability] ++@[fun_prop] + protected lemma StronglyMeasurable.trunc (hf : StronglyMeasurable f) : + StronglyMeasurable (trunc f t) := + StronglyMeasurable.ite (measurableSet_le hf.enorm.stronglyMeasurable stronglyMeasurable_const) hf + stronglyMeasurable_const + +-@[measurability] ++@[fun_prop] + protected lemma StronglyMeasurable.truncCompl (hf : StronglyMeasurable f) : + StronglyMeasurable (truncCompl f t) := by + rw [truncCompl_eq] +- exact hf.ite (measurableSet_lt stronglyMeasurable_const hf.enorm.stronglyMeasurable) stronglyMeasurable_const ++ exact hf.ite (measurableSet_lt stronglyMeasurable_const hf.enorm.stronglyMeasurable) ++ stronglyMeasurable_const + + -- @[measurability, fun_prop] + -- lemma AEMeasurable.trunc [MeasurableSpace E₁] [NormedAddCommGroup E₁] [BorelSpace E₁] +@@ -528,7 +530,7 @@ protected lemma StronglyMeasurable.truncCompl (hf : StronglyMeasurable f) : + -- simp only [mem_compl_iff, mem_setOf_eq, not_not] + -- intro f_eq_g; unfold truncCompl; unfold trunc; dsimp only [Pi.sub_apply]; rw [f_eq_g] + +-@[measurability] ++@[fun_prop] + nonrec lemma AEStronglyMeasurable.trunc (hf : AEStronglyMeasurable f μ) : + AEStronglyMeasurable (trunc f t) μ := by + rcases hf with ⟨g, ⟨wg1, wg2⟩⟩ +@@ -538,7 +540,7 @@ nonrec lemma AEStronglyMeasurable.trunc (hf : AEStronglyMeasurable f μ) : + exact wg1.indicator (s := {x | ‖g x‖ₑ ≤ t}) (measurableSet_le wg1.enorm (by fun_prop)) + · exact measure_mono_null (fun x ↦ by contrapose!; simp_all [trunc]) wg2 + +-@[measurability] ++@[fun_prop] + nonrec lemma AEStronglyMeasurable.truncCompl + (hf : AEStronglyMeasurable f μ) : AEStronglyMeasurable (truncCompl f t) μ := by + rcases hf with ⟨g, ⟨wg1, wg2⟩⟩ +@@ -551,7 +553,7 @@ nonrec lemma AEStronglyMeasurable.truncCompl + · exact measure_mono_null (fun x ↦ by contrapose!; simp_all [truncCompl]) wg2 + + +-@[measurability] ++@[fun_prop] + lemma aestronglyMeasurable_trnc {j : Bool} (hf : AEStronglyMeasurable f μ) : + AEStronglyMeasurable (trnc j f t) μ := + j.rec (.truncCompl hf) (.trunc hf) +@@ -571,7 +573,8 @@ lemma trunc_eLpNormEssSup_le {f : α → ε} (a : ℝ≥0∞) : + eLpNormEssSup (trunc f a) μ ≤ (max 0 a) := + essSup_le_of_ae_le _ (ae_of_all _ fun x ↦ trunc_le x) + +-lemma trunc_mono {f : α → ε} {a b : ℝ≥0∞} (hab : a ≤ b) {x : α} : ‖trunc f a x‖ₑ ≤ ‖trunc f b x‖ₑ := by ++lemma trunc_mono {f : α → ε} {a b : ℝ≥0∞} (hab : a ≤ b) {x : α} : ++ ‖trunc f a x‖ₑ ≤ ‖trunc f b x‖ₑ := by + unfold trunc + split_ifs + · rfl +@@ -579,10 +582,28 @@ lemma trunc_mono {f : α → ε} {a b : ℝ≥0∞} (hab : a ≤ b) {x : α} : + · rw [enorm_zero]; positivity + · exact le_rfl + ++lemma eLpNormFormula_trunc_mono : ++ Monotone fun s ↦ eLpNormFormula (trunc f s) p μ := by ++ intro lower upper hle ++ unfold eLpNormFormula ++ split_ifs ++ · exact le_rfl ++ · exact eLpNormEssSup_mono_enorm_ae (ae_of_all _ fun _ ↦ trunc_mono hle) ++ · exact eLpNorm'_mono_enorm_ae toReal_nonneg (ae_of_all _ fun _ ↦ trunc_mono hle) ++ + /-- The norm of the truncation is monotone in the truncation parameter -/ + lemma eLpNorm_trunc_mono : +- Monotone fun s ↦ eLpNorm (trunc f s) p μ := +- fun _a _b hab ↦ eLpNorm_mono_enorm fun _x ↦ trunc_mono hab ++ Monotone fun s ↦ eLpNorm (trunc f s) p μ := by ++ intro lower upper hle ++ by_cases hupper : AEStronglyMeasurable (trunc f upper) μ ++ · have heq : trunc (trunc f upper) lower = trunc f lower := by ++ ext point ++ by_cases hpoint : ‖f point‖ₑ ≤ upper ++ · simp [trunc, hpoint] ++ · have hlower : ¬‖f point‖ₑ ≤ lower := fun hbound ↦ hpoint (hbound.trans hle) ++ simp [trunc, hpoint, hlower] ++ exact eLpNorm_mono_enorm (heq ▸ hupper.trunc) fun _ ↦ trunc_mono hle ++ · simp [eLpNorm, hupper] + + lemma trunc_buildup_enorm {x : α} : + ‖trunc f t x‖ₑ + ‖truncCompl f t x‖ₑ = ‖f x‖ₑ := by +@@ -613,22 +634,22 @@ lemma eLpNorm_truncCompl_anti (hf : eLpNorm f 1 μ ≠ ⊤) (mf : AEStronglyMeas + Antitone (fun s ↦ eLpNorm (truncCompl f s) p μ) := by + intro a _b hab + have : ∀ᵐ x ∂μ, ‖f x‖ₑ ≠ ⊤ := by +- rw [eLpNorm_one_eq_lintegral_enorm] at hf ++ rw [eLpNorm_one_eq_lintegral_enorm mf] at hf + simp_rw [ae_iff, not_ne_iff]; exact measure_eq_top_of_lintegral_ne_top mf.enorm hf + have : ∀ᵐ x ∂μ, ‖trunc f a x‖ₑ ≠ ⊤ := by + refine this.mono fun x hx ↦ ?_ + rw [trunc] + split_ifs; exacts [hx, by simp] +- exact eLpNorm_mono_enorm_ae <| this.mono fun x hx ↦ truncCompl_anti hab hx ++ exact eLpNorm_mono_enorm_ae mf.truncCompl <| this.mono fun x hx ↦ truncCompl_anti hab hx + + /-- The norm of the truncation is meaurable in the truncation parameter -/ +-@[measurability, fun_prop] ++@[fun_prop] + lemma eLpNorm_trunc_measurable : + Measurable (fun s ↦ eLpNorm (trunc f s) p μ) := + eLpNorm_trunc_mono.measurable + + /-- The norm of the complement of the truncation is measurable in the truncation parameter -/ +-@[measurability, fun_prop] ++@[fun_prop] + lemma eLpNorm_truncCompl_measurable (hf : eLpNorm f 1 μ ≠ ⊤) (mf : AEStronglyMeasurable f μ) : + Measurable (fun s ↦ eLpNorm (truncCompl f s) p μ) := + eLpNorm_truncCompl_anti hf mf |>.measurable +@@ -655,10 +676,7 @@ lemma trnc_le_func {j : Bool} {a : ℝ≥0∞} {x : α} : + /-! ## Truncations and L-p spaces -/ + + lemma MemLp.trunc {p : ℝ≥0∞} (hf : MemLp f p μ) : MemLp (trunc f t) p μ := by +- refine ⟨hf.1.trunc, lt_of_le_of_lt (eLpNorm_mono_ae' (ae_of_all _ ?_)) hf.2⟩ +- intro x +- unfold MeasureTheory.trunc +- split_ifs with is_fx_le_a <;> simp ++ exact (eLpNorm_mono_enorm hf.aestronglyMeasurable.trunc fun _ ↦ trunc_le_func).trans_lt hf + + -- lemma eLpNorm_truncCompl_le {p : ℝ≥0∞} : + -- eLpNorm (truncCompl f t) p μ ≤ eLpNorm f p μ := +@@ -666,26 +684,24 @@ lemma MemLp.trunc {p : ℝ≥0∞} (hf : MemLp f p μ) : MemLp (trunc f t) p μ + + lemma MemLp.truncCompl {p : ℝ≥0∞} (hf : MemLp f p μ) : + MemLp (truncCompl f t) p μ := by +- refine ⟨hf.1.truncCompl, lt_of_le_of_lt (eLpNorm_mono_ae' (ae_of_all _ ?_)) hf.2⟩ +- intro x +- unfold MeasureTheory.truncCompl +- split_ifs with is_fx_le_a <;> simp ++ exact (eLpNorm_mono_enorm hf.aestronglyMeasurable.truncCompl ++ fun _ ↦ truncCompl_le_func).trans_lt hf + +-lemma eLpNorm_truncCompl_le {q : ℝ≥0∞} ++lemma eLpNormFormula_truncCompl_le {q : ℝ≥0∞} + (q_ne_zero : ¬ q = 0) (q_ne_top : q ≠ ⊤) : +- eLpNorm (truncCompl f t) q μ ^ q.toReal ≤ ++ eLpNormFormula (truncCompl f t) q μ ^ q.toReal ≤ + ∫⁻ x : α in {x | t < ‖f x‖ₑ}, ‖f x‖ₑ ^ q.toReal ∂μ := by +- unfold eLpNorm eLpNorm' ++ simp only [eLpNormFormula, q_ne_zero, q_ne_top, ↓reduceIte, eLpNorm'] + have q_toReal_pos : 0 < q.toReal := toReal_pos q_ne_zero q_ne_top +- split_ifs + calc + _ = ∫⁻ x : α in {x | t < ‖f x‖ₑ}, ‖(truncCompl f t) x‖ₑ ^ q.toReal ∂μ := by + rw [one_div, ENNReal.rpow_inv_rpow] + · apply (setLIntegral_eq_of_support_subset _).symm + unfold Function.support + intro x +- rw [truncCompl_eq, mem_setOf_eq] +- dsimp only [Pi.sub_apply] ++ change ‖truncCompl f t x‖ₑ ^ q.toReal ≠ 0 → t < ‖f x‖ₑ ++ rw [truncCompl_eq] ++ dsimp only + split_ifs with is_a_lt_fx + · exact fun _ ↦ is_a_lt_fx + · contrapose; intro _; simpa [enorm_eq_nnnorm] +@@ -694,6 +710,13 @@ lemma eLpNorm_truncCompl_le {q : ℝ≥0∞} + gcongr with x + exact trnc_le_func (j := ⊥) + ++lemma eLpNorm_truncCompl_le {q : ℝ≥0∞} ++ (q_ne_zero : q ≠ 0) (q_ne_top : q ≠ ⊤) (hf : AEStronglyMeasurable f μ) : ++ eLpNorm (truncCompl f t) q μ ^ q.toReal ≤ ++ ∫⁻ x : α in {x | t < ‖f x‖ₑ}, ‖f x‖ₑ ^ q.toReal ∂μ := by ++ rw [eLpNorm_eq_eLpNormFormula hf.truncCompl] ++ exact eLpNormFormula_truncCompl_le q_ne_zero q_ne_top ++ + -- TODO: better name! + lemma estimate_eLpNorm_truncCompl {p q : ℝ≥0∞} + (p_ne_top : p ≠ ⊤) (hpq : q ∈ Ioc 0 p) (hf : AEStronglyMeasurable f μ) (ht : 0 < t) : +@@ -701,7 +724,7 @@ lemma estimate_eLpNorm_truncCompl {p q : ℝ≥0∞} + (t ^ (q.toReal - p.toReal)) * eLpNorm f p μ ^ p.toReal := by + have q_ne_top: q ≠ ⊤ := ne_top_of_le_ne_top p_ne_top hpq.2 + have p_ne_zero : p ≠ 0 := (hpq.1.trans_le hpq.2).ne' +- apply le_trans (eLpNorm_truncCompl_le hpq.1.ne' (ne_top_of_le_ne_top p_ne_top hpq.2)) ++ apply le_trans (eLpNorm_truncCompl_le hpq.1.ne' (ne_top_of_le_ne_top p_ne_top hpq.2) hf) + calc + _ ≤ (t ^ (q.toReal - p.toReal)) * ∫⁻ x : α in {x | t < ‖f x‖ₑ}, + ‖f x‖ₑ ^ p.toReal ∂μ := by +@@ -709,7 +732,8 @@ lemma estimate_eLpNorm_truncCompl {p q : ℝ≥0∞} + · apply setLIntegral_mono_ae (AEMeasurable.restrict (by fun_prop)) + filter_upwards with x hx + rw [mul_comm] +- exact rpow_le_rpow_of_exponent_le_base_ge_enorm ht hx.ne_top hx.le (toReal_mono p_ne_top hpq.2) ++ exact rpow_le_rpow_of_exponent_le_base_ge_enorm ht hx.ne_top hx.le ++ (toReal_mono p_ne_top hpq.2) + · by_cases ht' : t = ⊤ + · simp_all + · finiteness +@@ -718,7 +742,8 @@ lemma estimate_eLpNorm_truncCompl {p q : ℝ≥0∞} + exact Measure.restrict_le_self + _ = _ := by + congr +- rw [eLpNorm_eq_lintegral_rpow_enorm_toReal p_ne_zero p_ne_top, one_div, ENNReal.rpow_inv_rpow] ++ rw [eLpNorm_eq_lintegral_rpow_enorm_toReal p_ne_zero p_ne_top hf, one_div, ++ ENNReal.rpow_inv_rpow] + exact (toReal_pos p_ne_zero p_ne_top).ne' + + -- TODO: better name! +@@ -731,17 +756,15 @@ lemma estimate_eLpNorm_trunc {p q : ℝ≥0∞} + by_cases ht : t = ⊤ + · by_cases hf' : eLpNorm f p μ ^ p.toReal = 0 + · have : f =ᵐ[μ] 0 := by +- rw [← eLpNorm_eq_zero_iff hf] ++ rw [← eLpNorm_eq_zero_iff hpq.1.ne'] + · rwa [← ENNReal.rpow_eq_zero_iff_of_pos (toReal_pos hpq.1.ne' p_ne_top)] +- exact hpq.1.ne' + -- Thus, the left hand side vanishes and conclusion is trivially true. +- refine le_of_eq_of_le ?_ (zero_le _) ++ refine le_of_eq_of_le ?_ zero_le + rw [rpow_eq_zero_iff_of_pos] +- · rw [eLpNorm_eq_zero_iff _ hq'.ne'] ++ · rw [eLpNorm_eq_zero_iff hq'.ne'] + · -- TODO: missing API lemma + rw [trunc_eq_indicator] + exact Filter.EventuallyEq.indicator_zero this +- · fun_prop + · rw [toReal_pos_iff] + exact ⟨hq', hq.lt_top⟩ + · -- The right hand side is `∞`, hence the statement is always true. +@@ -752,19 +775,17 @@ lemma estimate_eLpNorm_trunc {p q : ℝ≥0∞} + · apply le_top + rw [sub_pos, toReal_lt_toReal p_ne_top hq] + exact lt_of_le_of_ne hpq.2 p_eq_q +- unfold eLpNorm eLpNorm' +- have : p ≠ 0 := hpq.1.ne' +- split_ifs with h +- · exfalso +- exact hq'.ne' h +- · calc ++ rw [eLpNorm_eq_eLpNorm' hq'.ne' hq hf.trunc, ++ eLpNorm_eq_eLpNorm' hpq.1.ne' p_ne_top hf] ++ unfold eLpNorm' ++ calc + _ = ∫⁻ (x : α) in {x | 0 < ‖f x‖ₑ ∧ ‖f x‖ₑ ≤ t}, ‖trunc f t x‖ₑ ^ q.toReal ∂μ := by + rw [one_div, ENNReal.rpow_inv_rpow] + · apply Eq.symm + apply setLIntegral_eq_of_support_subset + unfold Function.support + intro x +- dsimp only [Pi.sub_apply, mem_setOf_eq] ++ change ‖trunc f t x‖ₑ ^ q.toReal ≠ 0 → 0 < ‖f x‖ₑ ∧ ‖f x‖ₑ ≤ t + unfold trunc + split_ifs with is_fx_le_a + · intro fx_rpow_ne_zero +@@ -783,7 +804,8 @@ lemma estimate_eLpNorm_trunc {p q : ℝ≥0∞} + · apply setLIntegral_mono_ae (AEMeasurable.restrict (by fun_prop)) + · filter_upwards with x hx + rw [mul_comm] +- exact rpow_le_rpow_of_exponent_le_base_le_enorm hx.1 (ne_top_of_le_ne_top ht hx.2) hx.2 <| toReal_mono hq hpq.2 ++ exact rpow_le_rpow_of_exponent_le_base_le_enorm hx.1 ++ (ne_top_of_le_ne_top ht hx.2) hx.2 <| toReal_mono hq hpq.2 + · simp_all + _ ≤ _ := by + gcongr +@@ -795,16 +817,16 @@ lemma estimate_eLpNorm_trunc {p q : ℝ≥0∞} + /-- If `f` is in `Lp`, the truncation is element of `Lq` for `q ≥ p`. -/ + lemma trunc_Lp_Lq_higher (hpq : p ∈ Ioc 0 q) {f : α → ε'} (hf : MemLp f p μ) (ht : t ≠ ∞) : + MemLp (trnc ⊤ f t) q μ := by +- refine ⟨aestronglyMeasurable_trnc hf.1, ?_⟩ ++ change eLpNorm (trnc ⊤ f t) q μ < ∞ + rcases (eq_or_ne q ⊤) with q_eq_top | q_ne_top +- · rw [q_eq_top, eLpNorm_exponent_top] ++ · rw [q_eq_top, eLpNorm_exponent_top (aestronglyMeasurable_trnc hf.aestronglyMeasurable)] + simp only [trnc] + calc _ + _ ≤ max 0 t := trunc_eLpNormEssSup_le t + _ < ∞ := by finiteness + · have p_ne_top := ne_top_of_le_ne_top q_ne_top hpq.2 + rw [← rpow_lt_top_iff_of_pos (toReal_pos (hpq.1.trans_le hpq.2).ne' q_ne_top)] +- apply lt_of_le_of_lt (estimate_eLpNorm_trunc q_ne_top hpq hf.1) ++ apply lt_of_le_of_lt (estimate_eLpNorm_trunc q_ne_top hpq hf.aestronglyMeasurable) + apply mul_lt_top ?_ ?_ + · by_cases ht'' : t = 0 + · rw [ht''] +@@ -813,7 +835,7 @@ lemma trunc_Lp_Lq_higher (hpq : p ∈ Ioc 0 q) {f : α → ε'} (hf : MemLp f p + rw [toReal_le_toReal p_ne_top q_ne_top] + exact hpq.2 + · finiteness +- · exact (rpow_lt_top_iff_of_pos (toReal_pos hpq.1.ne' p_ne_top)).mpr hf.2 ++ · exact (rpow_lt_top_iff_of_pos (toReal_pos hpq.1.ne' p_ne_top)).mpr hf + + lemma memLp_truncCompl_of_memLp_top (hf : MemLp f ⊤ μ) (h : μ {x | t < ‖f x‖ₑ} < ⊤) : + MemLp (trnc ⊥ f t) p μ := by +@@ -821,7 +843,7 @@ lemma memLp_truncCompl_of_memLp_top (hf : MemLp f ⊤ μ) (h : μ {x | t < ‖f + · rw [hp_top] + simp only [bot_eq_false, trnc_false] + exact hf.truncCompl +- obtain ⟨hf_m, hf_lt_top⟩ := hf ++ have hf_m := hf.aestronglyMeasurable + by_cases hp0 : p = 0 + · rw [hp0, memLp_zero_iff_aestronglyMeasurable] + exact aestronglyMeasurable_trnc hf_m +@@ -843,34 +865,33 @@ lemma memLp_truncCompl_of_memLp_top (hf : MemLp f ⊤ μ) (h : μ {x | t < ‖f + split_ifs with hx hx' hx'' + · exact hfgs hs + · exfalso +- simp only [mem_compl_iff, mem_setOf_eq, not_le, not_lt, hfgs hs] at hx hx' ++ simp only [mem_compl_iff, mem_ofPred_eq, not_le, not_lt, hfgs hs] at hx hx' + order + · exfalso +- simp only [mem_compl_iff, mem_setOf_eq, not_le, not_lt, hfgs hs] at hx hx'' ++ simp only [mem_compl_iff, mem_ofPred_eq, not_le, not_lt, hfgs hs] at hx hx'' + order + · rfl + apply MemLp.ae_eq ae_eq_trunc.symm +- use aestronglyMeasurable_trnc wg1.aestronglyMeasurable ++ change eLpNorm (trnc ⊥ g t) p μ < ∞ + simp only [bot_eq_false, trnc_false] + rw [truncCompl_eq_indicator, + eLpNorm_indicator_eq_eLpNorm_restrict +- (by rw [compl_setOf]; simp only [not_le]; exact measurableSet_lt measurable_const (by fun_prop))] +- rw [eLpNorm_eq_eLpNorm' hp0 hp_top] ++ (by rw [compl_ofPred]; simp only [not_le] ++ exact measurableSet_lt measurable_const (by fun_prop))] ++ rw [eLpNorm_eq_eLpNorm' hp0 hp_top wg1.aestronglyMeasurable.restrict] + apply (eLpNorm'_le_eLpNormEssSup_mul_rpow_measure_univ hp_pos).trans_lt + apply ENNReal.mul_lt_top +- · rw [← eLpNorm_exponent_top] ++ · rw [← eLpNorm_exponent_top wg1.aestronglyMeasurable.restrict] + apply (eLpNorm_restrict_le _ _ _ _).trans_lt + rwa [eLpNorm_congr_ae wg2.symm] + apply ENNReal.rpow_lt_top_of_nonneg (by simp [hp_pos.le]) + simp only [MeasurableSet.univ, Measure.restrict_apply, univ_inter] +- rw [← lt_top_iff_ne_top, compl_setOf] ++ rw [← lt_top_iff_ne_top, compl_ofPred] + calc + _ = μ {a | t < ‖f a‖ₑ} := by + apply measure_congr +- rw [Filter.eventuallyEq_iff_exists_mem] at wg2 +- rcases wg2 with ⟨s, hs, hfgs⟩ +- rw [Filter.eventuallyEq_iff_exists_mem] +- exact ⟨s, hs, fun a ha ↦ by simp [setOf, hfgs.symm ha]⟩ ++ filter_upwards [wg2] with a ha ++ simp only [not_le, ha] + _ < ∞ := h + + -- is there a better name? +@@ -881,14 +902,14 @@ lemma truncCompl_Lp_Lq_lower + have q_ne_top : q ≠ ∞ := ne_top_of_le_ne_top hp hpq.2 + by_cases ht' : t = ∞ + · simp [trnc, ht'] +- refine ⟨aestronglyMeasurable_trnc hf.1, ?_⟩ ++ change eLpNorm (trnc ⊥ f t) q μ < ∞ + have : 0 < q.toReal := toReal_pos hpq.left.ne' q_ne_top + refine (rpow_lt_top_iff_of_pos this).mp ?_ +- refine lt_of_le_of_lt (estimate_eLpNorm_truncCompl hp hpq hf.1 ht) ?_ ++ refine lt_of_le_of_lt (estimate_eLpNorm_truncCompl hp hpq hf.aestronglyMeasurable ht) ?_ + apply mul_lt_top + · push Not at ht' + finiteness +- refine (rpow_lt_top_iff_of_pos ?_).mpr hf.2 ++ refine (rpow_lt_top_iff_of_pos ?_).mpr hf + exact toReal_pos (hpq.1.trans_le hpq.2).ne' hp + + -- Lemma 6.10 in Folland +@@ -906,7 +927,8 @@ lemma memLp_of_memLp_le_of_memLp_ge {f : α → ε'} [ContinuousAdd ε'] + have h : MemLp (trnc ⊤ f C) q μ := trunc_Lp_Lq_higher ⟨hp, hr'.1⟩ hf (by norm_num) + have h' : MemLp (trnc ⊥ f C) q μ := by + by_cases hr : r = ⊤ +- · exact memLp_truncCompl_of_memLp_top (hr ▸ hf') <| distribution_lt_top hf hp p_ne_top (by norm_num) ++ · exact memLp_truncCompl_of_memLp_top (hr ▸ hf') <| ++ distribution_lt_top hf hp p_ne_top (by norm_num) + exact truncCompl_Lp_Lq_lower hr ⟨hp.trans_le hr'.1, hr'.2⟩ (by norm_num) hf' + have : f = (trnc ⊤ f C) + (trnc ⊥ f C) := trunc_add_truncCompl.symm + rw [this] +@@ -950,7 +972,7 @@ lemma res_subset_Ioi {j : Bool} {β : ℝ≥0∞} : res j β ⊆ Ioi 0 := by + · simp + · simp only [Ioi] + intro s hs +- rw [mem_setOf] ++ rw [mem_ofPred] + exact hs.1 + · exact Ioi_subset_Ioi toReal_nonneg + +@@ -968,7 +990,7 @@ lemma res'comp₀ (j : Bool) (β : ℝ≥0∞) (hβ : 0 < β) : + split_ifs with h₀ h₁ h₂ + on_goal 6 => + ext x +- simp only [mem_diff, mem_Ioi, mem_Ioc, not_and, not_le] ++ simp only [Set.mem_sdiff, mem_Ioi, mem_Ioc, not_and, not_le] + exact ⟨by tauto, fun h ↦ ⟨(toReal_pos (hβ.ne') h₀).trans h, fun x ↦ h⟩⟩ + all_goals simp_all + +@@ -978,7 +1000,7 @@ lemma res'comp (j : Bool) (β : ℝ≥0∞) : + split_ifs with h₀ h₁ h₂ + on_goal 6 => + ext x +- simp only [mem_diff, mem_Ioi, mem_Ioc, not_and, not_le] ++ simp only [Set.mem_sdiff, mem_Ioi, mem_Ioc, not_and, not_le] + refine ⟨by tauto, fun hβ ↦ ?_⟩ + have : 0 ≤ β.toReal := toReal_nonneg + exact ⟨by order, fun _ ↦ hβ⟩ +@@ -1056,8 +1078,10 @@ lemma lintegral_trunc_mul₀ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {tc : + · simp [hp] + + lemma lintegral_trunc_mul₁ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {p : ℝ} {tc : ToneCouple} : +- ∫⁻ s : ℝ in res' (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = +- ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p := by ++ ∫⁻ s : ℝ in res' (xor j tc.mon) (tc.inv ‖f x‖ₑ), ++ (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = ++ ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), ++ (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p := by + apply setLIntegral_congr + unfold res res' + split_ifs +@@ -1071,7 +1095,8 @@ lemma lintegral_trunc_mul₁ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {p : + exact Ne.symm (ne_of_apply_ne ENNReal.toReal fun a ↦ h (id (Eq.symm a))) + + lemma lintegral_trunc_mul₂ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {p : ℝ} {tc : ToneCouple} : +- ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = ++ ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), ++ (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = + ∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s) * ‖f x‖ₑ ^ p := by + apply setLIntegral_congr_fun measurableSet_res + unfold res trnc trunc truncCompl +@@ -1114,7 +1139,8 @@ lemma lintegral_trunc_mul₂ {g : ℝ → ℝ≥0∞} {j : Bool} {x : α} {p : + · have := (mon_pf (.ofReal s) ‖f x‖ₑ).2.mpr <| (ofReal_lt_iff_lt_toReal hs.1.le h).mpr hs.2 + order + +-lemma lintegral_trunc_mul {g : ℝ → ℝ≥0∞} (hg : AEMeasurable g) {j : Bool} {x : α} {tc : ToneCouple} {p : ℝ} ++lemma lintegral_trunc_mul {g : ℝ → ℝ≥0∞} (hg : AEMeasurable g) ++ {j : Bool} {x : α} {tc : ToneCouple} {p : ℝ} + (hp : 0 < p) : + ∫⁻ s : ℝ in Ioi 0, (g s) * ‖trnc j f (tc.ton (ENNReal.ofReal s)) x‖ₑ ^ p = + (∫⁻ s : ℝ in res (xor j tc.mon) (tc.inv ‖f x‖ₑ), (g s)) * ‖f x‖ₑ ^ p := by +@@ -1172,7 +1198,7 @@ lemma value_lintegral_res₀ {j : Bool} {β : ℝ≥0∞} {γ : ℝ} (hγ : if j + rw [lintegral_rpow_of_gt_abs htcinv.le hγ, ENNReal.ofReal_div_of_pos + (by rw [abs_pos]; linarith), ← ENNReal.ofReal_rpow_of_pos htcinv, + ofReal_toReal_eq_iff.mpr htop] +- · simp only [eq_false_of_ne_true xor_split, Bool.false_eq_true, ↓reduceIte] ++ · simp only [Bool.eq_false_of_ne_true xor_split, Bool.false_eq_true, ↓reduceIte] + split_ifs with htop + · rw [htop, top_rpow_of_neg (by linarith)]; simp + · by_cases hzero : β = 0 +@@ -1209,9 +1235,11 @@ lemma value_lintegral_res₂ {γ p' : ℝ} {spf : ScaledPowerFunction} (ht : 0 < + top_div_of_lt_top ofReal_lt_top] + + -- TODO: move to a lower-level file! +-lemma AEStronglyMeasurable.induction {α : Type*} {β : Type*} {mα : MeasurableSpace α} [TopologicalSpace β] ++lemma AEStronglyMeasurable.induction {α : Type*} {β : Type*} ++ {mα : MeasurableSpace α} [TopologicalSpace β] + {μ : Measure α} {motive : (α → β) → Prop} +- (ae_eq_implies : ∀ ⦃f g : α → β⦄ (_ : StronglyMeasurable f) (_ : f =ᶠ[ae μ] g), motive f → motive g) ++ (ae_eq_implies : ∀ ⦃f g : α → β⦄ (_ : StronglyMeasurable f) (_ : f =ᶠ[ae μ] g), ++ motive f → motive g) + (measurable : ∀ ⦃f : α → β⦄ (_ : StronglyMeasurable f), motive f) + ⦃f : α → β⦄ (hf : AEStronglyMeasurable f μ) : motive f := by + have hg := hf.choose_spec +diff --git a/Carleson/ToMathlib/WeakType.lean b/Carleson/ToMathlib/WeakType.lean +index 2e6b4bc..29f925a 100644 +--- a/Carleson/ToMathlib/WeakType.lean ++++ b/Carleson/ToMathlib/WeakType.lean +@@ -4,6 +4,8 @@ import Carleson.ToMathlib.Order.ConditionallyCompleteLattice.Basic + import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals + import Mathlib.Analysis.SpecialFunctions.Pow.Integral + ++/-! # Distribution functions and weak-type operator estimates -/ ++ + -- Upstreaming status: all of this should go into mathlib, eventually. + -- Most lemmas have the right form, but proofs can often be golfed. + -- Some enorm lemmas require some mathlib refactoring first, so they can be unified with their +@@ -45,11 +47,11 @@ lemma distribution_mono_right (h : t ≤ s) : distribution f s μ ≤ distributi + lemma distribution_mono_right' : Antitone (fun t ↦ distribution f t μ) := + fun _ _ h ↦ distribution_mono_right h + +-@[measurability, fun_prop] ++@[fun_prop] + lemma distribution_measurable₀ : Measurable (fun t ↦ distribution f t μ) := + Antitone.measurable (distribution_mono_right' (f := f) (μ := μ)) + +-@[measurability, fun_prop] ++@[fun_prop] + lemma distribution_measurable {g : α' → ℝ≥0∞} (hg : Measurable g) : + Measurable (fun y : α' ↦ distribution f (g y) μ) := by + fun_prop +@@ -147,14 +149,15 @@ lemma continuousWithinAt_distribution (t₀ : ℝ≥0∞) : + rw [db_zero] at h₂ + change Icc 0 ε (distribution f z μ) + rw [nonpos_iff_eq_zero.mp h₂] +- exact ⟨zero_le 0, zero_le ε⟩ ++ exact ⟨zero_le, zero_le⟩ + -- Case: 0 < distribution f t₀ μ + · obtain ⟨n, wn⟩ := + select_neighborhood_distribution t₀ _ + (ENNReal.sub_lt_self db_not_top.ne_top db_not_zero.ne' ε_gt_0.ne') + use Iio (t₀ + (↑n)⁻¹) + constructor +- · exact Iio_mem_nhds (lt_add_right t₀nottop.ne_top (ENNReal.inv_ne_zero.mpr (by finiteness))) ++ · exact Iio_mem_nhds ++ (lt_add_right t₀nottop.ne_top (ENNReal.inv_ne_zero.mpr (by finiteness))) + · refine ⟨Ioi t₀, by simp, fun z h ↦ ⟨?_, ?_⟩⟩ + · calc + distribution f t₀ μ - ε +@@ -172,27 +175,27 @@ lemma distribution_pow (ε : Type*) [SeminormedRing ε] [NormOneClass ε] [NormM + distribution (f ^ n) (t ^ n) μ = distribution f t μ := by + simp_rw [distribution, Pi.pow_apply] + refine congrArg μ <| ext fun x ↦ ⟨fun hx ↦ ?_, fun hx ↦ ?_⟩ +- · rw [mem_setOf_eq, enorm_pow (f x) n] at hx; simpa using lt_of_pow_lt_pow_left' n hx +- · rw [mem_setOf_eq, enorm_pow (f x) n]; exact ENNReal.pow_right_strictMono hn hx ++ · rw [mem_ofPred_eq, enorm_pow (f x) n] at hx; simpa using lt_of_pow_lt_pow_left' n hx ++ · rw [mem_ofPred_eq, enorm_pow (f x) n]; exact ENNReal.pow_right_strictMono hn hx + + + section distribution + + variable {ε' : Type*} [ENorm ε'] {f : α → ε} {g : α → ε'} + +-@[gcongr] ++@[gcongr only] + lemma distribution_mono_left (h : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖g x‖ₑ) : + distribution f t μ ≤ distribution g t μ := by + have h₀ : {x | t < ‖f x‖ₑ} \ {x | t < ‖g x‖ₑ} ⊆ {x | ¬‖f x‖ₑ ≤ ‖g x‖ₑ} := fun x ↦ by +- simp_rw [mem_diff, mem_setOf_eq, not_lt, not_le, and_imp] ++ simp_rw [Set.mem_sdiff, mem_ofPred_eq, not_lt, not_le, and_imp] + intro i₁ i₂; simpa using i₂.trans_lt i₁ + calc + _ ≤ μ ({x | t < ‖f x‖ₑ} ∩ {x | t < ‖g x‖ₑ}) +- + μ ({x | t < ‖f x‖ₑ} \ {x | t < ‖g x‖ₑ}) := measure_le_inter_add_diff μ _ _ ++ + μ ({x | t < ‖f x‖ₑ} \ {x | t < ‖g x‖ₑ}) := measure_le_inter_add_sdiff μ _ _ + _ = μ ({x | t < ‖f x‖ₑ} ∩ {x | t < ‖g x‖ₑ}) := by rw [measure_mono_null h₀ h, add_zero] + _ ≤ _ := by apply measure_mono; simp + +-@[gcongr] ++@[gcongr only] + lemma distribution_mono (h₁ : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖g x‖ₑ) (h₂ : t ≤ s) : + distribution f s μ ≤ distribution g t μ := + (distribution_mono_left h₁).trans (distribution_mono_right h₂) +@@ -211,7 +214,7 @@ lemma distribution_add_le {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] { + calc + _ ≤ μ ({x | t < ‖f x‖ₑ} ∪ {x | s < ‖g x‖ₑ}) := by + refine measure_mono fun x h ↦ ?_ +- simp only [mem_union, mem_setOf_eq, Pi.add_apply] at h ⊢ ++ simp only [mem_union, mem_ofPred_eq, Pi.add_apply] at h ⊢ + contrapose! h + exact (enorm_add_le _ _).trans (add_le_add h.1 h.2) + _ ≤ _ := measure_union_le _ _ +@@ -225,7 +228,7 @@ lemma distribution_zero_enorm {f : α → ε} (h : enorm ∘ f =ᵐ[μ] 0) : + _ ≤ μ {x | 0 < ‖f x‖ₑ} := by + apply measure_mono + intro x hx +- simp only [Set.mem_setOf_eq] at hx ++ simp only [Set.mem_ofPred_eq] at hx + exact pos_of_gt hx + _ = μ {x | ‖f x‖ₑ ≠ 0} := by + congr +@@ -234,14 +237,17 @@ lemma distribution_zero_enorm {f : α → ε} (h : enorm ∘ f =ᵐ[μ] 0) : + _ = 0 := by + exact ae_iff.mp h + +-lemma distribution_zero {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {f : α → ε} (h : f =ᵐ[μ] 0) : ++lemma distribution_zero {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {f : α → ε} ++ (h : f =ᵐ[μ] 0) : + distribution f t μ = 0 := by + apply distribution_zero_enorm + simp only [EventuallyEq, comp_apply, Pi.ofNat_apply] + filter_upwards [h] with x hx using (by simp [hx]) + +-lemma distribution_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {s : Set α} {a : ε} : +- distribution (s.indicator (Function.const α a)) t μ = (Set.Iio ‖a‖ₑ).indicator (fun _ ↦ μ s) t := by ++lemma distribution_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] ++ {s : Set α} {a : ε} : ++ distribution (s.indicator (Function.const α a)) t μ = ++ (Set.Iio ‖a‖ₑ).indicator (fun _ ↦ μ s) t := by + unfold distribution indicator + split_ifs with h + · simp only [const_apply] +@@ -257,12 +263,12 @@ lemma distribution_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMon + exfalso + exact ENNReal.not_lt_zero h'' + · intro hx +- rwa [ite_cond_eq_true] ++ rwa [ite_eq_left_of_eq_true] + simpa only [eq_iff_iff, iff_true] + · convert measure_empty (μ := μ) + apply eq_empty_of_subset_empty + intro x +- simp only [const_apply, mem_setOf_eq, mem_empty_iff_false, imp_false, not_lt] ++ simp only [const_apply, mem_ofPred_eq, mem_empty_iff_false, imp_false, not_lt] + split_ifs + · simp only [mem_Iio, not_lt] at h + exact h +@@ -272,12 +278,10 @@ lemma distribution_eq_zero_iff {ε} [TopologicalSpace ε] [ESeminormedAddMonoid + distribution f t μ = 0 ↔ eLpNormEssSup f μ ≤ t := by + rw [distribution, eLpNormEssSup] + rw [← compl_compl {x | t < ‖f x‖ₑ}, ← mem_ae_iff, compl_def] +- simp only [mem_setOf_eq, not_lt] ++ simp only [mem_ofPred_eq, not_lt] + constructor + · intro h +- apply essSup_le_of_ae_le +- filter_upwards [h] +- simp ++ exact essSup_le_of_ae_le t h + · rw [essSup] + intro h + rw [← Filter.Eventually] +@@ -301,7 +305,7 @@ lemma distribution_add {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {f g + rw [← measure_union₀] + · congr 1 + ext x +- simp only [Pi.add_apply, mem_setOf_eq, mem_union] ++ simp only [Pi.add_apply, mem_ofPred_eq, mem_union] + rcases (@or_not (x ∈ support f)) with hxf | hxf + · have := disjoint_left.mp h hxf + simp only [mem_support, ne_eq, not_not] at this +@@ -314,14 +318,14 @@ lemma distribution_add {ε} [TopologicalSpace ε] [ESeminormedAddMonoid ε] {f g + · apply Disjoint.aedisjoint + apply disjoint_of_subset _ _ h + · intro x +- simp only [mem_setOf_eq, mem_support, ne_eq] ++ simp only [mem_ofPred_eq, mem_support, ne_eq] + intro h' + have := LT.lt.ne_bot h' + rw [ENNReal.bot_eq_zero] at this + contrapose! this + rw [this, enorm_zero] + · intro x +- simp only [mem_setOf_eq, mem_support, ne_eq] ++ simp only [mem_ofPred_eq, mem_support, ne_eq] + intro h' + have := LT.lt.ne_bot h' + rw [ENNReal.bot_eq_zero] at this +@@ -342,11 +346,12 @@ lemma distribution_indicator_add_of_support_subset {ε} [TopologicalSpace ε] [E + (enorm_add : ∀ a b : ε, ‖a + b‖ₑ = ‖a‖ₑ + ‖b‖ₑ) --TODO: new type class for this property? + {f : α → ε} {c : ε} (hc : ‖c‖ₑ ≠ ⊤) {s : Set α} + (hfs : Function.support f ⊆ s) : +- distribution (f + s.indicator (Function.const α c)) t μ = if t < ‖c‖ₑ then μ s else distribution f (t - ‖c‖ₑ) μ := by ++ distribution (f + s.indicator (Function.const α c)) t μ = ++ if t < ‖c‖ₑ then μ s else distribution f (t - ‖c‖ₑ) μ := by + unfold distribution + split_ifs with ht + · congr 1 with x +- simp only [Pi.add_apply, mem_setOf_eq] ++ simp only [Pi.add_apply, mem_ofPred_eq] + constructor + · intro h + contrapose! h +@@ -357,11 +362,11 @@ lemma distribution_indicator_add_of_support_subset {ε} [TopologicalSpace ε] [E + unfold indicator + rw [enorm_add, add_comm] + split_ifs +- apply lt_add_of_lt_of_nonneg _ (zero_le _) ++ apply lt_add_of_lt_of_nonneg _ (zero_le) + simpa [h] + · push Not at ht + congr 1 with x +- simp only [Pi.add_apply, mem_setOf_eq] ++ simp only [Pi.add_apply, mem_ofPred_eq] + rw [enorm_add, ENNReal.sub_lt_iff_lt_right hc ht] + constructor + · intro h +@@ -411,9 +416,9 @@ lemma wnorm'_zero (f : α → ε) (μ : Measure α) : wnorm' f 0 μ = ∞ := by + + lemma wnorm'_toReal_le {f : α → ℝ≥0∞} {p : ℝ} (hp : 0 ≤ p) : + wnorm' (ENNReal.toReal ∘ f) p μ ≤ wnorm' f p μ := by +- refine iSup_mono fun x ↦ ?_ +- gcongr +- simp ++ refine iSup_mono fun threshold ↦ ?_ ++ exact mul_le_mul_right ++ (ENNReal.rpow_le_rpow distribution_toReal_le (inv_nonneg.mpr hp)) _ + + lemma wnorm'_toReal_eq {f : α → ℝ≥0∞} {p : ℝ} (hf : ∀ᵐ x ∂μ, f x ≠ ∞) : + wnorm' (ENNReal.toReal ∘ f) p μ = wnorm' f p μ := by +@@ -455,8 +460,8 @@ lemma wnorm'_mono_enorm_ae {ε' : Type*} [ENorm ε'] {f : α → ε} {g : α → + intro t + calc _ + _ ≤ ↑t * distribution g (↑t) μ ^ p⁻¹ := by +- gcongr +- assumption ++ exact mul_le_mul_right ++ (ENNReal.rpow_le_rpow (distribution_mono_left h) (inv_nonneg.mpr hp)) _ + apply le_iSup _ t + + lemma wnorm_mono_enorm_ae {ε' : Type*} [ENorm ε'] {f : α → ε} {g : α → ε'} +@@ -511,14 +516,14 @@ theorem wnorm_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMonoid + intro b hb + use ‖a‖ₑ.toNNReal / 2 + simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, coe_div, coe_ofNat] +- rwa [ENNReal.coe_toNNReal ha', indicator, ite_cond_eq_true, ENNReal.top_rpow_of_pos hp, ENNReal.mul_top] ++ rwa [ENNReal.coe_toNNReal ha', indicator, ite_eq_left_of_eq_true, ++ ENNReal.top_rpow_of_pos hp, ENNReal.mul_top] + · simpa + · simp only [mem_Iio, eq_iff_iff, iff_true] + apply ENNReal.div_lt_of_lt_mul' + nth_rw 1 [← one_mul ‖a‖ₑ] + gcongr +- · exact ha' +- · norm_num ++ norm_num + apply le_of_forall_lt_imp_le_of_dense + intro c hc + apply le_iSup_of_le (c / (μ s ^ p.toReal⁻¹)).toNNReal +@@ -530,7 +535,7 @@ theorem wnorm_indicator_const {ε} [TopologicalSpace ε] [ESeminormedAddMonoid + contradiction + · rw [hc.1] + exact le_top +- rw [indicator_apply, ite_cond_eq_true, ENNReal.coe_toNNReal hc', ENNReal.div_mul_cancel] ++ rw [indicator_apply, ite_eq_left_of_eq_true, ENNReal.coe_toNNReal hc', ENNReal.div_mul_cancel] + · simp only [ne_eq, ENNReal.rpow_eq_zero_iff, inv_pos, inv_neg'', not_or, not_and, not_lt, + toReal_nonneg, implies_true, and_true] + intro h +@@ -551,7 +556,8 @@ def MemWLp [TopologicalSpace ε] (f : α → ε) (p : ℝ≥0∞) (μ : Measure + lemma MemWLp_zero [TopologicalSpace ε] : ¬ MemWLp f 0 μ := by + simp [MemWLp, wnorm_zero] + +-lemma MemWLp.aeStronglyMeasurable [TopologicalSpace ε] (hf : MemWLp f p μ) : AEStronglyMeasurable f μ := hf.1 ++lemma MemWLp.aeStronglyMeasurable [TopologicalSpace ε] (hf : MemWLp f p μ) : ++ AEStronglyMeasurable f μ := hf.1 + + lemma MemWLp.wnorm_lt_top [TopologicalSpace ε] (hf : MemWLp f p μ) : wnorm f p μ < ⊤ := hf.2 + +@@ -572,18 +578,18 @@ theorem MemWLp.ae_ne_top [TopologicalSpace ε] (hf : MemWLp f p μ) : ∀ᵐ x + set A := {x | ‖f x‖ₑ = ∞} with hA + simp only [MemWLp, wnorm, wnorm', hp_inf] at hf + rw [Filter.eventually_iff, mem_ae_iff] +- simp only [ne_eq, compl_def, mem_setOf_eq, Decidable.not_not, ← hA] ++ simp only [ne_eq, compl_def, mem_ofPred_eq, Decidable.not_not, ← hA] + have hp_toReal_zero := toReal_ne_zero.mpr ⟨hp_zero, hp_inf⟩ + have h1 (t : ℝ≥0) : μ A ≤ distribution f t μ := by + refine μ.mono ?_ +- simp_all only [setOf_subset_setOf, coe_lt_top, implies_true, A] ++ simp_all only [ofPred_subset_ofPred, coe_lt_top, implies_true, A] + set C := ⨆ t : ℝ≥0, t * distribution f t μ ^ p.toReal⁻¹ + by_cases hC_zero : C = 0 + · simp only [ENNReal.iSup_eq_zero, mul_eq_zero, ENNReal.rpow_eq_zero_iff, inv_neg'', C] at hC_zero + specialize hC_zero 1 + simp only [one_ne_zero, ENNReal.coe_one, toReal_nonneg.not_gt, and_false, or_false, + false_or] at hC_zero +- exact measure_mono_null (setOf_subset_setOf.mpr fun x hx => hx ▸ one_lt_top) hC_zero.1 ++ exact measure_mono_null (ofPred_subset_ofPred.mpr fun x hx => hx ▸ one_lt_top) hC_zero.1 + by_contra h + have h2 : C < ∞ := by aesop + have h3 (t : ℝ≥0) : distribution f t μ ≤ (C / t) ^ p.toReal := by +@@ -620,10 +626,9 @@ lemma distribution_le [MeasurableSpace ε] [OpensMeasurableSpace ε] + apply (mul_le_iff_le_inv hc hc_top).mp + simp_rw [distribution, ← setLIntegral_one, ← lintegral_const_mul' _ _ hc_top, mul_one] + refine le_trans (lintegral_mono_ae ?_) (setLIntegral_le_lintegral _ _) +- simp only [Filter.Eventually, ae, mem_ofCountableUnion] +- rw [Measure.restrict_apply₀'] +- · convert measure_empty (μ := μ); ext; simpa using le_of_lt +- · exact hf.enorm.nullMeasurableSet_preimage measurableSet_Ioi ++ filter_upwards [ae_restrict_mem₀ ++ (hf.enorm.nullMeasurableSet_preimage measurableSet_Ioi)] with point hpoint ++ exact le_of_lt hpoint + + lemma wnorm'_le_eLpNorm' (hf : AEStronglyMeasurable f μ) {p : ℝ} (p0 : 0 < p) : + wnorm' f p μ ≤ eLpNorm' f p μ := by +@@ -642,9 +647,9 @@ lemma wnorm'_le_eLpNorm' (hf : AEStronglyMeasurable f μ) {p : ℝ} (p0 : 0 < p) + lemma distribution_lt_top (hf : MemLp f p μ) (p_pos : 0 < p) (p_ne_top : p ≠ ∞) + {t : ℝ≥0} (ht : 0 < t) : + distribution f t μ < ∞ := by +- have := wnorm'_le_eLpNorm' hf.1 (toReal_pos p_pos.ne' p_ne_top) +- rw [← eLpNorm_eq_eLpNorm' p_pos.ne' p_ne_top] at this +- have := this.trans_lt hf.2 ++ have := wnorm'_le_eLpNorm' hf.aestronglyMeasurable (toReal_pos p_pos.ne' p_ne_top) ++ rw [← eLpNorm_eq_eLpNorm' p_pos.ne' p_ne_top hf.aestronglyMeasurable] at this ++ have := this.trans_lt hf + rw [wnorm', iSup_lt_iff] at this + rcases this with ⟨b,b_lt_top, h⟩ + have := (h t).trans_lt b_lt_top +@@ -656,18 +661,19 @@ lemma distribution_lt_top (hf : MemLp f p μ) (p_pos : 0 < p) (p_ne_top : p ≠ + · rw [ENNReal.coe_eq_zero] at t_zero + exfalso + exact ht.ne' t_zero +- · rw [ENNReal.rpow_eq_zero_iff_of_pos (by simp only [inv_pos]; exact toReal_pos p_pos.ne' p_ne_top)] at h ++ · rw [ENNReal.rpow_eq_zero_iff_of_pos ++ (by simp only [inv_pos]; exact toReal_pos p_pos.ne' p_ne_top)] at h + rw [h] + simp only [zero_lt_top] + + lemma wnorm_le_eLpNorm (hf : AEStronglyMeasurable f μ) {p : ℝ≥0∞} (hp : 0 < p) : + wnorm f p μ ≤ eLpNorm f p μ := by + by_cases h : p = ⊤ +- · simp [h, wnorm, eLpNorm] +- · simpa [h, wnorm, eLpNorm, hp.ne'] using wnorm'_le_eLpNorm' hf (toReal_pos hp.ne' h) ++ · simp [h, wnorm, eLpNorm, hf] ++ · simpa [h, wnorm, eLpNorm, hp.ne', hf] using wnorm'_le_eLpNorm' hf (toReal_pos hp.ne' h) + + lemma MemLp.memWLp (hp : 0 < p) (hf : MemLp f p μ) : MemWLp f p μ := +- ⟨hf.1, wnorm_le_eLpNorm hf.1 hp |>.trans_lt hf.2⟩ ++ ⟨hf.aestronglyMeasurable, wnorm_le_eLpNorm hf.aestronglyMeasurable hp |>.trans_lt hf⟩ + + end ContinuousENorm + +@@ -717,7 +723,7 @@ variable [TopologicalSpace ε₁] [ContinuousENorm ε₁] [TopologicalSpace ε + + lemma HasWeakType.memWLp (h : HasWeakType T p p' μ ν c) (hf₁ : MemLp f₁ p μ) + (hc : c < ⊤ := by finiteness) : MemWLp (T f₁) p' ν := +- ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc hf₁.2⟩ ++ ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc hf₁⟩ + + lemma HasWeakType.toReal {T : (α → ε₁) → (α' → ℝ≥0∞)} (h : HasWeakType T p p' μ ν c) : + HasWeakType (T · · |>.toReal) p p' μ ν c := +@@ -746,7 +752,7 @@ lemma aestronglyMeasurable_ennreal_toReal_iff {f : α → ℝ≥0∞} + rw [toReal_ofReal_preimage (s := s)] + split_ifs + · exact this +- · simp_rw [preimage_diff] ++ · simp_rw [preimage_sdiff] + exact this.diff hf + · simp_rw [preimage_union] + exact this.union hf +@@ -762,7 +768,8 @@ lemma hasWeakType_toReal_iff {T : (α → ε₁) → (α' → ℝ≥0∞)} + filter_upwards [hT f hf] with x hx + simp [hx] + +--- lemma comp_left [MeasurableSpace ε₂] {ν' : Measure ε₂} {f : ε₂ → ε₃} (h : HasWeakType T p p' μ ν c) ++-- lemma comp_left [MeasurableSpace ε₂] {ν' : Measure ε₂} {f : ε₂ → ε₃} ++-- (h : HasWeakType T p p' μ ν c) + -- (hf : MemLp f p' ν') : + -- HasWeakType (f ∘ T ·) p p' μ ν c := by + -- intro u hu +@@ -780,7 +787,7 @@ variable [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] [TopologicalSpace + lemma HasBoundedWeakType.memWLp (h : HasBoundedWeakType T p p' μ ν c) + (hf₁ : BoundedFiniteSupport f₁ μ) (hc : c < ⊤ := by finiteness) : + MemWLp (T f₁) p' ν := +- ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc (hf₁.memLp p).2⟩ ++ ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc (hf₁.memLp p)⟩ + + lemma HasWeakType.hasBoundedWeakType (h : HasWeakType T p p' μ ν c) : + HasBoundedWeakType T p p' μ ν c := +@@ -797,7 +804,7 @@ variable [TopologicalSpace ε₁] [ContinuousENorm ε₁] [TopologicalSpace ε + + lemma HasStrongType.memLp (h : HasStrongType T p p' μ ν c) (hf₁ : MemLp f₁ p μ) + (hc : c < ⊤ := by finiteness) : MemLp (T f₁) p' ν := +- ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc hf₁.2⟩ ++ (h f₁ hf₁).2.trans_lt <| mul_lt_top hc hf₁ + + lemma HasStrongType.hasWeakType (hp' : 0 < p') + (h : HasStrongType T p p' μ ν c) : HasWeakType T p p' μ ν c := +@@ -830,7 +837,7 @@ variable [TopologicalSpace ε₁] [ESeminormedAddMonoid ε₁] [TopologicalSpace + lemma HasBoundedStrongType.memLp (h : HasBoundedStrongType T p p' μ ν c) + (hf₁ : BoundedFiniteSupport f₁ μ) (hc : c < ⊤ := by finiteness) : + MemLp (T f₁) p' ν := +- ⟨(h f₁ hf₁).1, h f₁ hf₁ |>.2.trans_lt <| mul_lt_top hc (hf₁.memLp _).2⟩ ++ (h f₁ hf₁).2.trans_lt <| mul_lt_top hc (hf₁.memLp _) + + lemma HasStrongType.hasBoundedStrongType (h : HasStrongType T p p' μ ν c) : + HasBoundedStrongType T p p' μ ν c := +@@ -897,7 +904,8 @@ lemma HasStrongType.const_smul [ContinuousConstSMul ℝ≥0 ε'] + + -- TODO: do we want to unify this lemma with its unprimed version, perhaps using an + -- `ENormedSemiring` class? +-variable {𝕜 E' : Type*} [NormedRing 𝕜] [NormedAddCommGroup E'] [MulActionWithZero 𝕜 E'] [IsBoundedSMul 𝕜 E'] in ++variable {𝕜 E' : Type*} [NormedRing 𝕜] [NormedAddCommGroup E'] [MulActionWithZero 𝕜 E'] ++ [IsBoundedSMul 𝕜 E'] in + lemma HasStrongType.const_smul' + {T : (α → ε) → (α' → E')} {c : ℝ≥0∞} (h : HasStrongType T p p' μ ν c) (k : 𝕜) : + HasStrongType (k • T) p p' μ ν (‖k‖ₑ * c) := by +@@ -1009,12 +1017,13 @@ section NormedGroup + variable [NormedAddCommGroup E₁] [NormedSpace 𝕜 E₁] [NormedAddCommGroup E₂] [NormedSpace 𝕜 E₂] + [NormedAddCommGroup E₃] [NormedSpace 𝕜 E₃] + +-lemma _root_.ContinuousLinearMap.distribution_le {f : α → E₁} {g : α → E₂} (L : E₁ →L[𝕜] E₂ →L[𝕜] E₃) : ++lemma _root_.ContinuousLinearMap.distribution_le {f : α → E₁} {g : α → E₂} ++ (L : E₁ →L[𝕜] E₂ →L[𝕜] E₃) : + distribution (fun x ↦ L (f x) (g x)) (‖L‖ₑ * t * s) μ ≤ + distribution f t μ + distribution g s μ := by + have h₀ : {x | ‖L‖ₑ * t * s < ‖(fun x ↦ (L (f x)) (g x)) x‖ₑ} ⊆ + {x | t < ‖f x‖ₑ} ∪ {x | s < ‖g x‖ₑ} := fun z hz ↦ by +- simp only [mem_union, mem_setOf_eq] at hz ⊢ ++ simp only [mem_union, mem_ofPred_eq] at hz ⊢ + contrapose! hz + calc + ‖(L (f z)) (g z)‖ₑ ≤ ‖L‖ₑ * ‖f z‖ₑ * ‖g z‖ₑ := by calc +@@ -1034,7 +1043,8 @@ variable [TopologicalSpace ε] [ContinuousENorm ε] + + /-- The layer-cake theorem, or Cavalieri's principle for functions into a space with a continuous + enorm. -/ +-lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ} (hp : 0 < p) : ++lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ} ++ (hp : 0 < p) : + ∫⁻ x, ‖f x‖ₑ ^ p ∂μ = + ∫⁻ t in Ioi (0 : ℝ), ENNReal.ofReal (p * t ^ (p - 1)) * distribution f (.ofReal t) μ := by + have := lintegral_rpow_eq_lintegral_meas_lt_mul μ (f := fun x ↦ ENNReal.toReal ‖f x‖ₑ) +@@ -1048,7 +1058,7 @@ lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasura + · apply lintegral_congr_ae + rw [Filter.eventuallyEq_iff_exists_mem] + use {x | ‖f x‖ₑ ≠ ∞} +- rw [mem_ae_iff, compl_setOf] ++ rw [mem_ae_iff, compl_ofPred] + simp only [ne_eq, Decidable.not_not] + use ae_finite + intro x hx +@@ -1059,9 +1069,9 @@ lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasura + dsimp only + congr 1 + symm +- apply measure_eq_measure_of_null_diff ++ apply measure_eq_measure_of_null_sdiff + · intro x hx +- simp only [mem_setOf_eq] at * ++ simp only [mem_ofPred_eq] at * + rwa [ofReal_lt_iff_lt_toReal ht.le] + by_contra hfx + rw [hfx] at hx +@@ -1070,10 +1080,8 @@ lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasura + dsimp [sdiff, Set.diff] + apply measure_mono_null _ ae_finite + intro x hx +- dsimp only [mem_setOf_eq] at * + by_contra hf_top +- rw [ofReal_lt_iff_lt_toReal ht.le hf_top] at hx +- exact hx.2 hx.1 ++ exact hx.2 ((ofReal_lt_iff_lt_toReal ht.le hf_top).mp hx.1) + · rw [lintegral_eq_top_of_measure_eq_top_ne_zero] + · symm + rw [← enorm_pos] at ae_finite +@@ -1101,11 +1109,12 @@ lemma lintegral_norm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasura + exact ae_finite + + /-- The layer-cake theorem, or Cavalieri's principle, written using `eLpNorm`. -/ +-lemma eLpNorm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ≥0} (hp : 0 < p) : ++lemma eLpNorm_pow_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ≥0} ++ (hp : 0 < p) : + eLpNorm f p μ ^ (p : ℝ) = + ∫⁻ t in Ioi (0 : ℝ), p * ENNReal.ofReal (t ^ ((p : ℝ) - 1)) * distribution f (.ofReal t) μ := by + have h2p : 0 < (p : ℝ) := hp +- simp_rw [eLpNorm_nnreal_eq_eLpNorm' hp.ne', eLpNorm', one_div, ← ENNReal.rpow_mul, ++ simp_rw [eLpNorm_nnreal_eq_eLpNorm' hp.ne' hf, eLpNorm', one_div, ← ENNReal.rpow_mul, + inv_mul_cancel₀ h2p.ne', ENNReal.rpow_one, lintegral_norm_pow_eq_distribution hf h2p, + ENNReal.ofReal_mul zero_le_coe, ofReal_coe_nnreal] + +@@ -1115,17 +1124,15 @@ lemma eLpNorm_eq_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) { + eLpNorm f (.ofReal p) μ = + (ENNReal.ofReal p * ∫⁻ t in Ioi (0 : ℝ), distribution f (.ofReal t) μ * + ENNReal.ofReal (t ^ (p - 1)) ) ^ p⁻¹ := by +- unfold eLpNorm +- split_ifs with sgn_p sz_p +- · exact False.elim (not_le_of_gt hp (ofReal_eq_zero.mp sgn_p)) +- · exact False.elim (coe_ne_top sz_p) +- · unfold eLpNorm' +- rw [toReal_ofReal hp.le, one_div] +- congr 1 +- rw [← lintegral_const_mul' _ _ (by finiteness), lintegral_norm_pow_eq_distribution hf hp] +- congr 1 with x; rw [ofReal_mul] <;> [ring; positivity] +- +-lemma lintegral_pow_mul_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ} (hp : -1 < p) : ++ rw [eLpNorm_eq_eLpNorm' (ENNReal.ofReal_pos.mpr hp).ne' ENNReal.ofReal_ne_top hf] ++ unfold eLpNorm' ++ rw [toReal_ofReal hp.le, one_div] ++ congr 1 ++ rw [← lintegral_const_mul' _ _ (by finiteness), lintegral_norm_pow_eq_distribution hf hp] ++ congr 1 with point; rw [ofReal_mul] <;> [ring; positivity] ++ ++lemma lintegral_pow_mul_distribution {f : α → ε} (hf : AEStronglyMeasurable f μ) {p : ℝ} ++ (hp : -1 < p) : + ∫⁻ t in Ioi (0 : ℝ), ENNReal.ofReal (t ^ p) * distribution f (.ofReal t) μ = + ENNReal.ofReal (p + 1)⁻¹ * ∫⁻ x, ‖f x‖ₑ ^ (p + 1) ∂μ := by + have h2p : 0 < p + 1 := by linarith +diff --git a/Carleson/TwoSidedCarleson/Basic.lean b/Carleson/TwoSidedCarleson/Basic.lean +index 13df8e0..e1d1620 100644 +--- a/Carleson/TwoSidedCarleson/Basic.lean ++++ b/Carleson/TwoSidedCarleson/Basic.lean +@@ -1,6 +1,8 @@ + import Carleson.Calculations + import Carleson.ToMathlib.MeasureTheory.Integral.IntegrableOn + ++/-! # The two-sided Calderon–Zygmund operator -/ ++ + open MeasureTheory Set Metric Function Topology NNReal ENNReal + + variable {X : Type*} {a : ℕ} [MetricSpace X] [DoublingMeasure X (defaultA a : ℕ)] +@@ -20,7 +22,7 @@ lemma czOperator_bound {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : 0 < r + · let M1 := (C_K a / volume (ball x r)).toNNReal + let M2 := (eLpNorm g ∞).toNNReal + have : { y | ¬‖K x y * g y‖ ≤ M0} ⊆ { y | ¬‖K x y‖ ≤ M1 ∨ ¬‖g y‖ ≤ M2} := by +- rw [setOf_subset_setOf] ++ rw [ofPred_subset_ofPred] + intro y + contrapose! + intro hy +@@ -33,7 +35,8 @@ lemma czOperator_bound {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : 0 < r + rw [← toNNReal_mul] + rw [← Measure.restrict_apply₀'] + · apply measure_mono_null_ae this.eventuallyLE +- rw [setOf_or] ++ change (volume.restrict (ball x r)ᶜ) ++ ({y | ¬‖K x y‖ ≤ M1} ∪ {y | ¬‖g y‖ ≤ M2}) = 0 + apply measure_union_null + · rw [← ae_iff] + apply ae_restrict_of_forall_mem measurableSet_ball.compl +@@ -43,7 +46,8 @@ lemma czOperator_bound {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : 0 < r + · apply enorm_K_le_ball_complement hy + · exact (div_lt_top coe_ne_top ((measure_ball_pos volume x hr).ne.symm)).ne + · simp_rw [← ae_iff, M2, ← ENNReal.toReal.eq_1, ← toReal_enorm, +- (ENNReal.toReal_le_toReal enorm_lt_top.ne (hg.eLpNorm_lt_top).ne), eLpNorm_exponent_top] ++ (ENNReal.toReal_le_toReal enorm_lt_top.ne (hg.eLpNorm_lt_top).ne), ++ eLpNorm_exponent_top hg.aestronglyMeasurable] + apply ae_restrict_of_ae ae_le_eLpNormEssSup + · exact measurableSet_ball.compl.nullMeasurableSet + · exact measurableSet_ball.compl.nullMeasurableSet +@@ -101,7 +105,7 @@ lemma czOperator_welldefined {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : + rw [← inter_assoc] + refine Eq.symm (left_eq_inter.mpr ?_) + · apply inter_subset_left.trans +- apply setOf_subset.mpr ++ apply ofPred_subset.mpr + apply tmp_Kxg + rw [← Measure.restrict_apply₀' (by measurability), ← ae_iff] + exact hM +@@ -118,7 +122,8 @@ lemma czOperator_welldefined {g : X → ℂ} (hg : BoundedFiniteSupport g) (hr : + · exact support_mul_subset_right (K x) g + + -- This could be adapted to state T_r is a linear operator but maybe it's not worth the effort +-lemma czOperator_sub {f g : X → ℂ} (hf : BoundedFiniteSupport f) (hg : BoundedFiniteSupport g) (hr : 0 < r) : ++lemma czOperator_sub {f g : X → ℂ} (hf : BoundedFiniteSupport f) ++ (hg : BoundedFiniteSupport g) (hr : 0 < r) : + czOperator K r (f - g) = czOperator K r f - czOperator K r g := by + ext x + unfold czOperator +diff --git a/Carleson/TwoSidedCarleson/WeakCalderonZygmund.lean b/Carleson/TwoSidedCarleson/WeakCalderonZygmund.lean +index 50aab7b..b9ec606 100644 +--- a/Carleson/TwoSidedCarleson/WeakCalderonZygmund.lean ++++ b/Carleson/TwoSidedCarleson/WeakCalderonZygmund.lean +@@ -2,6 +2,10 @@ import Mathlib.Analysis.Normed.Group.Basic + import Carleson.ToMathlib.HardyLittlewood + import Carleson.TwoSidedCarleson.Basic + ++/-! ## Section 10.2 and Lemma 10.0.3 ++ ++Question: -/ ++ + open MeasureTheory Set Bornology Function Metric Filter Topology + open ENNReal hiding one_lt_two + open scoped NNReal +@@ -24,10 +28,6 @@ variable {F G : Set X} + variable {K : X → X → ℂ} {x x' : X} [IsTwoSidedKernel a K] + variable {f : X → ℂ} {α : ℝ≥0∞} + +-/-! ## Section 10.2 and Lemma 10.0.3 +- +-Question: -/ +- + /-- The constant used in `nontangential_from_simple`. + I(F) think the constant needs to be fixed in the blueprint. -/ + irreducible_def C10_2_1 (a : ℕ) : ℝ≥0 := 2 ^ (4 * a) +@@ -150,7 +150,7 @@ lemma depth_lt_iff_not_disjoint {d : ℝ} : + simp_rw [depth, iSup_lt_iff, iSup_le_iff] at hd; obtain ⟨d', ld', hd'⟩ := hd + have ns := (hd' d.toNNReal).mt; rw [not_le] at ns; specialize ns ld' + rw [not_subset_iff_exists_mem_notMem] at ns; obtain ⟨y, my, ny⟩ := ns +- have pd := (zero_le _).trans_lt ld' ++ have pd := zero_le.trans_lt ld' + rw [ofReal_pos] at pd; replace pd := Real.coe_toNNReal d pd.le + rw [pd] at my; exact not_disjoint_iff.mpr ⟨y, my, ny⟩ + mpr hd := by +@@ -185,7 +185,7 @@ lemma depth_lt_top_iff_ne_univ : depth O x < ⊤ ↔ O ≠ univ := by + constructor <;> intro h + · contrapose! h; simp_rw [top_le_iff, depth, iSup₂_eq_top, h, subset_univ, exists_const] + intro r rlt; lift r to ℝ≥0 using rlt.ne +- use r + 1; exact coe_lt_coe_of_lt (lt_add_one r) ++ use r + 1; exact coe_lt_coe.mpr (lt_add_one r) + · obtain ⟨p, np⟩ := (ne_univ_iff_exists_notMem _).mp h + calc + _ ≤ edist x p := by +@@ -271,8 +271,10 @@ lemma depth_bound_3 (hO : O ≠ univ) (h : x ∈ ball y (3 * ((depth O y).toReal + gcongr; rw [edist_dist]; apply ofReal_le_of_le_toReal + rw [toReal_div, toReal_ofNat]; linarith + calc +- _ ≤ (2 * depth O x).toReal / 6 + 3 * ((depth O y).toReal / 6) := by gcongr; have := @dnt x; finiteness +- _ ≤ (2 * depth O x).toReal / 6 + 3 * ((2 * depth O x).toReal / 6) := by gcongr; have := @dnt x; finiteness ++ _ ≤ (2 * depth O x).toReal / 6 + 3 * ((depth O y).toReal / 6) := by ++ gcongr; have := @dnt x; finiteness ++ _ ≤ (2 * depth O x).toReal / 6 + 3 * ((2 * depth O x).toReal / 6) := by ++ gcongr; have := @dnt x; finiteness + _ = _ := by rw [toReal_mul, toReal_ofNat]; ring + + lemma ball_covering_bounded_intersection +@@ -299,7 +301,7 @@ lemma ball_covering_bounded_intersection + apply measure_ball_two_le_same_iterate + _ = 2 ^ (3 * a) * volume (⋃ v : V, ball v.1 ((depth O v.1).toReal / 6)) := by + have VsU : V ⊆ U := sep_subset .. +- haveI : Countable V := by rw [countable_coe_iff]; exact countU.mono VsU ++ have : Countable V := by rw [countable_coe_iff]; exact countU.mono VsU + congr 1 + refine (measure_iUnion (fun ⟨v₁, mv₁⟩ ⟨v₂, mv₂⟩ hn ↦ ?_) (fun _ ↦ measurableSet_ball)).symm + rw [ne_eq, Subtype.mk.injEq] at hn +@@ -320,7 +322,7 @@ lemma ball_covering' (hO : IsOpen O ∧ O ≠ univ) : + let W : Set (Set X) := {U | U ⊆ O ∧ U.PairwiseDisjoint fun c ↦ ball c ((depth O c).toReal / 6)} + obtain ⟨U, maxU⟩ : ∃ U, Maximal (· ∈ W) U := by + refine zorn_subset _ fun U sU cU ↦ ⟨⋃₀ U, ?_, fun _ ↦ subset_sUnion_of_mem⟩ +- simp only [W, sUnion_subset_iff, mem_setOf_eq] ++ simp only [W, sUnion_subset_iff, mem_ofPred_eq] + exact ⟨fun u hu ↦ (sU hu).1, (pairwiseDisjoint_sUnion cU.directedOn).2 fun u hu ↦ (sU hu).2⟩ + have countU : U.Countable := by + refine maxU.1.2.countable_of_isOpen (fun _ _ ↦ isOpen_ball) (fun u mu ↦ ?_) +@@ -408,7 +410,7 @@ lemma ball_covering_finite (hO : IsOpen O ∧ O ≠ univ) {U : Set X} {r' : X + · exact disjoint_left.mpr fun i mi₁ mi₂ ↦ mi₁.1 mi₂.1 + _ = 0 + {u ∈ SetLike.coe U | x ∈ ball u (3 * r' u)}.encard := by + congr +- · simp_rw [encard_eq_zero, eq_empty_iff_forall_notMem, mem_setOf_eq, not_and]; intro i hi ++ · simp_rw [encard_eq_zero, eq_empty_iff_forall_notMem, mem_ofPred_eq, not_and]; intro i hi + simp [r, hi] + · set A := {i | i < U.card ∧ x ∈ ball (c i) (3 * r i)} + set B := {u ∈ SetLike.coe U | x ∈ ball u (3 * r' u)} +@@ -416,7 +418,7 @@ lemma ball_covering_finite (hO : IsOpen O ∧ O ≠ univ) {U : Set X} {r' : X + refine ⟨Subtype.coe_prop _, ?_⟩ + have := i.2.2; simp_rw [r, c, i.2.1, dite_true] at this; exact this⟩ + let g (u : B) : A := ⟨e ⟨u.1, u.2.1⟩, by +- simp_rw [A, r, c, mem_setOf_eq, Fin.is_lt, dite_true, Fin.eta, Equiv.symm_apply_apply, ++ simp_rw [A, r, c, mem_ofPred_eq, Fin.is_lt, dite_true, Fin.eta, Equiv.symm_apply_apply, + u.2.2, true_and]⟩ + let eqv : A ≃ B := ⟨f, g, fun i ↦ by simp [f, g], fun u ↦ by simp [f, g]⟩ + exact encard_congr eqv +@@ -455,9 +457,9 @@ theorem ball_covering (hO : IsOpen O ∧ O ≠ univ) : + set B := {u ∈ U | x ∈ ball u (3 * r' u)} + let f (i : A) : B := ⟨e.symm i, by + refine ⟨Subtype.coe_prop _, ?_⟩ +- have := i.2; simp_rw [A, mem_setOf_eq, r, c] at this; exact this⟩ ++ have := i.2; simp_rw [A, mem_ofPred_eq, r, c] at this; exact this⟩ + let g (u : B) : A := ⟨e ⟨u.1, u.2.1⟩, by +- simp_rw [A, r, c, mem_setOf_eq, Equiv.symm_apply_apply, u.2.2]⟩ ++ simp_rw [A, r, c, mem_ofPred_eq, Equiv.symm_apply_apply, u.2.2]⟩ + let eqv : A ≃ B := ⟨f, g, fun i ↦ by simp [f, g], fun u ↦ by simp [f, g]⟩ + exact encard_congr eqv + _ ≤ _ := Ubi x mx +@@ -573,17 +575,17 @@ lemma czBall_subset_czPartition {hX : GeneralCase f α} {i : ℕ} : + intro r hr + rw [mem_ball] at hr + unfold czPartition +- apply mem_diff_of_mem (by rw [mem_ball]; linarith [dist_nonneg.trans_lt hr]) ++ apply mem_sdiff_of_mem (by rw [mem_ball]; linarith [dist_nonneg.trans_lt hr]) + simp only [mem_union, mem_iUnion, mem_ball, not_or, not_exists, not_lt] + refine ⟨?_, fun j hj ↦ by + refine le_of_not_gt (disjoint_left.mp (czBall_pairwiseDisjoint ?_ ?_ hj.ne) hr) <;> tauto⟩ + unfold czPartition +- simp only [mem_diff, mem_ball, mem_union, mem_iUnion, not_or, not_and, not_not] ++ simp only [Set.mem_sdiff, mem_ball, mem_union, mem_iUnion, not_or, not_and, not_not] + exact fun _ _ _ _ ↦ by use i + + lemma czPartition_subset_czBall3 {hX : GeneralCase f α} {i : ℕ} : + czPartition hX i ⊆ czBall3 hX i := by +- rw [czPartition]; exact diff_subset ++ rw [czPartition]; exact sdiff_subset + + private lemma czPartition_subset_czBall7 {hX : GeneralCase f α} {i : ℕ} : + czPartition hX i ⊆ czBall7 hX i := +@@ -597,7 +599,7 @@ lemma czPartition_pairwiseDisjoint {hX : GeneralCase f α} : + have (t d) (hx : x ∈ czPartition hX t) (hd : t < d) : x ∉ czPartition hX d := by + have : czPartition hX t ⊆ ⋃ j < d, czPartition hX j := subset_biUnion_of_mem hd + rw [czPartition] +- exact notMem_diff_of_mem <| mem_union_left _ (this hx) ++ exact notMem_sdiff_of_mem <| mem_union_left _ (this hx) + have : _ ∧ _ := ⟨this i k hxi |>.mt (· hxk), this k i hxk |>.mt (· hxi)⟩ + lia + +@@ -626,7 +628,7 @@ lemma iUnion_czPartition {hX : GeneralCase f α} : + have ⟨t, ht⟩ : ∃ i, x ∈ (⋃ j < i, czPartition hX j) ∪ ⋃ j > i, czBall hX j := by + by_contra! hb + absurd hp g +- rw [czPartition, mem_diff] ++ rw [czPartition, Set.mem_sdiff] + exact ⟨hg, hb g⟩ + have : ⋃ j > t, czBall hX j ⊆ ⋃ j > t, czPartition hX j := + iUnion₂_mono fun i j ↦ czBall_subset_czPartition (i := i) +@@ -647,7 +649,8 @@ private lemma globalMaximalFunction_preimage_finite + refine le_trans (setLIntegral_mono_ae ?_ ?_) (setLIntegral_le_lintegral s _) + · exact AEStronglyMeasurable.globalMaximalFunction.aemeasurable.pow_const 2 |>.restrict + · exact Eventually.of_forall fun x hx ↦ pow_le_pow_left' (le_of_lt <| by simpa [s] using hx) 2 +- _ = eLpNorm (globalMaximalFunction volume 1 f) 2 volume := by simp [eLpNorm, eLpNorm'] ++ _ = eLpNorm (globalMaximalFunction volume 1 f) 2 volume := by ++ simp [eLpNorm, eLpNorm', AEStronglyMeasurable.globalMaximalFunction] + + private lemma volume_czPartition_lt_top (hX : GeneralCase f α) (i : ℕ) : + volume (czPartition hX i) < ∞ := +@@ -760,7 +763,7 @@ lemma aemeasurable_czApproximation {hf : AEMeasurable f} : AEMeasurable (czAppro + simpa [czA, hx] using h + · exact Or.inl ⟨hx, by simpa [czA, hx, hX] using h⟩ + · cases h with +- | inl h => simpa [czA, mem_setOf_eq ▸ mem_setOf_eq ▸ h.1] using h.2 ++ | inl h => simpa [czA, mem_ofPred_eq ▸ mem_ofPred_eq ▸ h.1] using h.2 + | inr h => obtain ⟨_, ⟨⟨i, ⟨hi, rfl⟩⟩, hxi⟩⟩ := h + have hx : ∃ j, x ∈ czPartition hX j := ⟨i, hxi⟩ + simpa [czA, hx, czPartition_pairwiseDisjoint' hx.choose_spec hxi] using hi +@@ -782,8 +785,10 @@ protected lemma BoundedFiniteSupport.czApproximation {α : ℝ≥0∞} (hα : 0 + by_cases h : Nonempty X; swap + · have := not_nonempty_iff.mp h; constructor <;> simp + constructor +- · use (aemeasurable_czApproximation (hf := aemeasurable hf)).aestronglyMeasurable ++ · rw [MemLp, eLpNorm_exponent_top ++ (aemeasurable_czApproximation (hf := hf.aemeasurable)).aestronglyMeasurable] + refine lt_of_le_of_lt ?_ hf.eLpNorm_lt_top ++ rw [eLpNorm_exponent_top hf.aestronglyMeasurable] + apply essSup_le_of_ae_le _ <| (ENNReal.ae_le_essSup (‖f ·‖ₑ)).mono (fun x h ↦ ?_) + by_cases hX : GeneralCase f α + · by_cases hx : ∃ j, x ∈ czPartition hX j +@@ -792,7 +797,7 @@ protected lemma BoundedFiniteSupport.czApproximation {α : ℝ≥0∞} (hα : 0 + exact (enorm_integral_le_lintegral_enorm _).trans (setLAverage_le_essSup _) + · simp [czApproximation, eLpNormEssSup, hX, hx, h] + · simp only [czApproximation, hX, reduceDIte] +- exact (enorm_integral_le_lintegral_enorm _).trans (laverage_le_essSup _) ++ exact (enorm_integral_le_lintegral_enorm _).trans (MeasureTheory.laverage_le_essSup _) + · by_cases hX : GeneralCase f α; swap + · exact lt_of_le_of_lt (measure_mono (subset_univ _)) <| volume_lt_of_not_GeneralCase hf hX hα + calc volume (support (czApproximation f α)) +@@ -883,16 +888,17 @@ private lemma eLpNorm_czApproximation_le_finite + _ ≤ (⨍⁻ x, ‖f x‖ₑ ∂volume) * volume (univ : Set X) := + mul_le_mul_left (enorm_integral_le_lintegral_enorm f) _ + _ = eLpNorm f 1 volume := by +- simp [mul_comm _ (volume univ), eLpNorm, eLpNorm', laverage, ← mul_assoc, ++ simp [mul_comm _ (volume univ), eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable, ++ laverage, ← mul_assoc, + ENNReal.mul_inv_cancel (NeZero.ne (volume univ)) (volume_lt_of_not_GeneralCase hf hX hα).ne] + + -- Equation (10.2.18), infinite case +-private lemma eLpNorm_czApproximation_le_infinite (hX : GeneralCase f α) : +- eLpNorm (czApproximation f α) 1 volume ≤ eLpNorm f 1 volume := by +- simp only [eLpNorm, one_ne_zero, reduceIte, one_ne_top, eLpNorm', toReal_one, rpow_one, ++private lemma eLpNormFormula_czApproximation_le_infinite (hX : GeneralCase f α) : ++ eLpNormFormula (czApproximation f α) 1 volume ≤ eLpNormFormula f 1 volume := by ++ simp only [eLpNormFormula, one_ne_zero, reduceIte, one_ne_top, eLpNorm', toReal_one, rpow_one, + ne_eq, not_false_eq_true, div_self] + have hmeas : MeasurableSet (univ \ ⋃ i, czPartition hX i) := by measurability +- have := union_univ _ ▸ @union_diff_self X (⋃ i, czPartition hX i) univ ++ have := union_univ _ ▸ @union_sdiff_self X (⋃ i, czPartition hX i) univ + repeat rw [← setLIntegral_univ (μ := volume), ← this, lintegral_union hmeas disjoint_sdiff_right, + lintegral_iUnion (MeasurableSet.czPartition hX) <| czPartition_pairwise_disjoint_on] + -- gcongr tsum ?_ + ?_ +@@ -900,10 +906,19 @@ private lemma eLpNorm_czApproximation_le_infinite (hX : GeneralCase f α) : + · apply ENNReal.tsum_le_tsum + intro _ + apply lintegral_czPartition_le +- · simp only [union_diff_self, union_univ] ++ · simp only [union_sdiff_self, union_univ] + apply le_of_eq ∘ setLIntegral_congr_fun_ae (by measurability) + exact Eventually.of_forall (fun x hx ↦ by simp_all [czApproximation]) + ++private lemma eLpNorm_czApproximation_le_infinite (hX : GeneralCase f α) : ++ eLpNorm (czApproximation f α) 1 volume ≤ eLpNorm f 1 volume := by ++ by_cases hf : AEStronglyMeasurable f volume ++ · rw [eLpNorm_eq_eLpNormFormula hf, eLpNorm_eq_eLpNormFormula ++ (aemeasurable_czApproximation (hf := hf.aemeasurable)).aestronglyMeasurable] ++ exact eLpNormFormula_czApproximation_le_infinite hX ++ · rw [eLpNorm_of_not_aestronglyMeasurable hf] ++ exact le_top ++ + /-- Part of Lemma 10.2.5, equation (10.2.18) (both cases). -/ + lemma eLpNorm_czApproximation_le + {hf : BoundedFiniteSupport f} (hα : 0 < α) : +@@ -938,7 +953,9 @@ private lemma ineq_10_2_32 (hf : BoundedFiniteSupport f) {hX : GeneralCase f α} + {i : ℕ} : + eLpNorm (czRemainder' hX i) 1 volume ≤ 2 * (∫⁻ x in czPartition hX i, ‖f x‖ₑ) := calc + _ = ∫⁻ x in czPartition hX i, ‖f x - czApproximation f α x‖ₑ := by +- simp [czRemainder', eLpNorm, eLpNorm', enorm_indicator_eq_indicator_enorm, ++ rw [eLpNorm_one_eq_lintegral_enorm ++ (AEMeasurable.czRemainder' (hf := hf.aemeasurable) hX i).aestronglyMeasurable] ++ simp [czRemainder', enorm_indicator_eq_indicator_enorm, + lintegral_indicator <| MeasurableSet.czPartition hX i] + _ ≤ ∫⁻ x in czPartition hX i, ‖f x‖ₑ + ‖czApproximation f α x‖ₑ := + lintegral_mono (fun x ↦ enorm_sub_le) +@@ -971,16 +988,22 @@ private lemma eLpNorm_restrict_czRemainder'_le {hf : BoundedFiniteSupport f} {hX + {i : ℕ} : + ∫⁻ y in czBall3 hX i, ‖czRemainder' hX i y‖ₑ ≤ 2 ^ (2 * a + 1) * α * volume (czBall3 hX i) := by + apply le_trans (setLIntegral_le_lintegral _ _) +- rw [← eLpNorm_one_eq_lintegral_enorm] ++ rw [← eLpNorm_one_eq_lintegral_enorm ++ (AEMeasurable.czRemainder' (hf := hf.aemeasurable) hX i).aestronglyMeasurable] + exact eLpNorm_czRemainder'_le (hf := hf) + + -- Used to prove `eLpNorm_czRemainder_le` and `tsum_eLpNorm_czRemainder_le` + private lemma eLpNorm_czRemainder_le' + (hf : BoundedFiniteSupport f) (hX : ¬ GeneralCase f α) (hα : ⨍⁻ x, ‖f x‖ₑ < α) : + eLpNorm (czRemainder f α) 1 volume ≤ 2 * ∫⁻ x, ‖f x‖ₑ := +- have := isFiniteMeasure_of_not_generalCase hf hX (lt_of_le_of_lt (zero_le _) hα) ++ have := isFiniteMeasure_of_not_generalCase hf hX (lt_of_le_of_lt zero_le hα) + calc +- _ = ∫⁻ x, ‖f x - ⨍ y, f y‖ₑ := by simp [czRemainder, eLpNorm, eLpNorm', czApproximation, hX] ++ _ = ∫⁻ x, ‖f x - ⨍ y, f y‖ₑ := by ++ change eLpNorm (f - czApproximation f α) 1 volume = _ ++ rw [eLpNorm_one_eq_lintegral_enorm ++ (hf.aestronglyMeasurable.sub ++ (aemeasurable_czApproximation (hf := hf.aemeasurable)).aestronglyMeasurable)] ++ simp [czApproximation, hX] + _ ≤ ∫⁻ x, (‖f x‖ₑ + ‖⨍ y, f y‖ₑ) := lintegral_mono (fun x ↦ enorm_sub_le) + _ = (∫⁻ x, ‖f x‖ₑ) + ∫⁻ (x : X), ‖⨍ y, f y‖ₑ := lintegral_add_right' _ aemeasurable_const + _ ≤ (∫⁻ x, ‖f x‖ₑ) + ∫⁻ (x : X), ⨍⁻ y, ‖f y‖ₑ := by +@@ -993,7 +1016,7 @@ lemma eLpNorm_czRemainder_le {hf : BoundedFiniteSupport f} + eLpNorm (czRemainder f α) 1 volume ≤ 2 ^ (2 * a + 1) * α * volume (univ : Set X) := by + by_cases h : Nonempty X; swap + · have := not_nonempty_iff.mp h; simp +- have := isFiniteMeasure_of_not_generalCase hf hX (lt_of_le_of_lt (zero_le _) hα) ++ have := isFiniteMeasure_of_not_generalCase hf hX (lt_of_le_of_lt zero_le hα) + calc + _ ≤ 2 * ∫⁻ x, ‖f x‖ₑ := eLpNorm_czRemainder_le' hf hX hα + _ ≤ 2 * (α * volume (univ : Set X)) := by +@@ -1034,13 +1057,15 @@ lemma tsum_eLpNorm_czRemainder'_le {hf : BoundedFiniteSupport f} (hX : GeneralCa + simp_rw [← smul_eq_mul, ENNReal.tsum_const_smul] + gcongr + rw [← lintegral_iUnion (MeasurableSet.czPartition hX) czPartition_pairwise_disjoint_on] +- simpa [eLpNorm, eLpNorm'] using (lintegral_mono_set (subset_univ _)) ++ simpa [eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable] using ++ (lintegral_mono_set (subset_univ _)) + + /-- Part of Lemma 10.2.5, equation (10.2.23) (finite case). -/ + lemma tsum_eLpNorm_czRemainder_le + {hf : BoundedFiniteSupport f} (hX : ¬ GeneralCase f α) (hα : ⨍⁻ x, ‖f x‖ₑ < α) : + eLpNorm (czRemainder f α) 1 volume ≤ 2 * eLpNorm f 1 volume := by +- simpa [eLpNorm, eLpNorm'] using (eLpNorm_czRemainder_le' hf hX hα) ++ simpa [eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable] using ++ (eLpNorm_czRemainder_le' hf hX hα) + + /- ### Lemmas 10.2.6 - 10.2.9 -/ + +@@ -1092,7 +1117,7 @@ lemma estimate_good (hf : BoundedFiniteSupport f) (hα : ⨍⁻ x, ‖f x‖ₑ + · simp [hα_top, top_div_of_lt_top ENNReal.ofNat_lt_top] + have ne0 : (c10_0_3 a : ℝ≥0∞) ≠ 0 := by simp [c10_0_3] + have hα' : 0 < α' a α := α'_pos (pos_of_gt hα) +- have hα'' := ((zero_le _).trans_lt hα).ne' ++ have hα'' := (zero_le.trans_lt hα).ne' + calc distribution ((czOperator K r (czApproximation f (α' a α)))) (α / 2) volume + _ = distribution ((czOperator K r (czApproximation f (α' a α))) ^ 2) ((α / 2) ^ 2) volume := + (distribution_pow _ _ _ _ two_pos.ne').symm +@@ -1112,8 +1137,11 @@ lemma estimate_good (hf : BoundedFiniteSupport f) (hα : ⨍⁻ x, ‖f x‖ₑ + have half_pos : 0 < (2 : ℝ)⁻¹ := by norm_num + refine mul_le_mul_right (ENNReal.le_of_rpow_le half_pos ?_) (2 ^ 2 / α ^ 2) + rw [ENNReal.mul_rpow_of_nonneg _ _ half_pos.le, ← ENNReal.rpow_natCast_mul] +- convert hT _ (hf.czApproximation hα') |>.2 +- all_goals simp [eLpNorm, eLpNorm', α'] ++ have hstrong := (hT _ (hf.czApproximation hα')).2 ++ rw [eLpNorm_eq_eLpNorm' (by norm_num) (by norm_num) (hT _ (hf.czApproximation hα')).1, ++ eLpNorm_eq_eLpNorm' (by norm_num) (by norm_num) ++ (hf.czApproximation hα').aestronglyMeasurable] at hstrong ++ convert hstrong using 1 <;> simp [eLpNorm', α'] + _ ≤ 2^2/α^2 * ((C_Ts a) ^ 2 * ∫⁻ y, 2^(3*a) * c10_0_3 a * α * ‖czApproximation f _ y‖ₑ) := by + gcongr _ * (_ * ?_) + suffices ∀ᵐ x, ‖czApproximation f (α' a α) x‖ₑ ≤ 2 ^ (3 * a) * c10_0_3 a * α by +@@ -1125,7 +1153,9 @@ lemma estimate_good (hf : BoundedFiniteSupport f) (hα : ⨍⁻ x, ‖f x‖ₑ + _ = 2^2/α^2 * ((C_Ts a)^2 * (2^(3*a) * c10_0_3 a * α * ∫⁻ y, ‖czApproximation f _ y‖ₑ)) := by + rw [lintegral_const_mul' _ _ (by finiteness)] + _ ≤ 2 ^ 2 / α ^ 2 * ((C_Ts a) ^ 2 * (2 ^ (3 * a) * c10_0_3 a * α * eLpNorm f 1 volume)) := by +- gcongr; simpa [eLpNorm, eLpNorm'] using eLpNorm_czApproximation_le (hf := hf) hα' ++ gcongr ++ simpa only [eLpNorm_one_eq_lintegral_enorm (hf.czApproximation hα').aestronglyMeasurable] ++ using eLpNorm_czApproximation_le (hf := hf) hα' + _ = 2 ^ 2 / α^2 * ((C_Ts a) ^ 2 * (2 ^ (3 * a) * c10_0_3 a * α)) * eLpNorm f 1 volume := by ring + _ = (2 ^ 2 * (C_Ts a) ^ 2 * 2 ^ (3 * a) * c10_0_3 a * α) / α ^ 2 * eLpNorm f 1 volume := by + rw [ENNReal.mul_comm_div, mul_div]; ring_nf +@@ -1220,12 +1250,12 @@ private lemma 𝒥₁_bound (hf : BoundedFiniteSupport f) (hα : 0 < α) (hx : x + ‖czOperator K r (czRemainder' hX j) x‖ₑ ≤ czOperatorBoundSummand hX j x := calc + _ = ‖∫ y in czBall3 hX j, K x y * (czRemainder' hX j y)‖ₑ := by + apply congrArg +- apply setIntegral_eq_of_subset_of_ae_diff_eq_zero measurableSet_ball.compl.nullMeasurableSet ++ apply setIntegral_eq_of_subset_of_ae_sdiff_eq_zero measurableSet_ball.compl.nullMeasurableSet + · intro y hy +- simp only [𝒥₁, mem_setOf_eq, mem_ball, mem_compl_iff] at hj hy ⊢ ++ simp only [𝒥₁, mem_ofPred_eq, mem_ball, mem_compl_iff] at hj hy ⊢ + linarith [dist_triangle_left x (czCenter hX j) y] + · refine Eventually.of_forall (fun y hy ↦ mul_eq_zero_of_right (K x y) ?_) +- exact notMem_support.mp <| notMem_subset support_czRemainder'_subset (notMem_of_mem_diff hy) ++ exact notMem_support.mp <| notMem_subset support_czRemainder'_subset (notMem_of_mem_sdiff hy) + _ ≤ _ := by + apply lemma_10_2_7_bound hx hX j (hf.czRemainder' (α'_pos hα) hX j).integrable.restrict + · rw [setIntegral_eq_integral_of_forall_compl_eq_zero, integral_czRemainder'] +@@ -1299,7 +1329,9 @@ private lemma integral_g (hf : BoundedFiniteSupport f) (hα : 0 < α) (hX : Gene + by_cases! hj : czRadius hX j ≤ 0 + · simp [Metric.ball_eq_empty.mpr <| mul_nonpos_of_nonneg_of_nonpos three_pos.le hj] + rw [integral_sub (integrableOn_g₀ hf hα hX j) (integrableOn_d hX j)] +- simp [d, setAverage_eq, smul_smul, mul_inv_cancel₀ (measureReal_ball_pos (czCenter hX j) (mul_pos three_pos hj)).ne'] ++ have hmeasure : (volume.real (czBall3 hX j) : ℂ) ≠ 0 := by ++ exact_mod_cast (measureReal_ball_pos (czCenter hX j) (mul_pos three_pos hj)).ne' ++ simp [d, setAverage_eq, hmeasure] + + private lemma lintegral_enorm_half_g (hf : BoundedFiniteSupport f) (hα : 0 < α) + (hX : GeneralCase f (α' a α)) (j : ℕ) : +@@ -1307,7 +1339,7 @@ private lemma lintegral_enorm_half_g (hf : BoundedFiniteSupport f) (hα : 0 < α + 2 ^ (2 * a + 1) * α' a α * volume (czBall3 hX j) := calc + _ = 2⁻¹ * ∫⁻ y in czBall3 hX j, ‖g r x hX j y‖ₑ := by + simp_rw [enorm_mul] +- rw [lintegral_const_mul' _ _ enorm_ne_top, enorm_inv (NeZero.ne 2), ← ofReal_norm_eq_enorm] ++ rw [lintegral_const_mul' _ _ enorm_ne_top, enorm_inv (NeZero.ne 2), ← ofReal_norm] + simp + _ ≤ 2⁻¹ * ∫⁻ y in czBall3 hX j, ‖g₀ r x hX j y‖ₑ + ‖d r x hX j‖ₑ := by gcongr; exact enorm_sub_le + _ = _ := by rw [lintegral_add_left' (integrableOn_g₀ hf hα hX j).aemeasurable.enorm] +@@ -1362,7 +1394,7 @@ private lemma 𝒥₂_bound (hf : BoundedFiniteSupport f) (hα : 0 < α) (hx : x + rw [← enorm_mul] + _ ≤ _ := by + gcongr +- · simp [← ofReal_norm_eq_enorm] ++ · simp [← ofReal_norm] + · apply lemma_10_2_7_bound hx hX j ((integrableOn_g r x hα hf hX j).const_mul 2⁻¹) + · have h : + ∫ (y : X) in czBall3 hX j, 2⁻¹ * g r x hX j y = +@@ -1385,7 +1417,7 @@ private lemma A_subset (hx : x ∈ (Ω f (α' a α))ᶜ) (hX : GeneralCase f (α + rw [mem_ball'] at hy + have : 6 * czRadius hX j ≤ dist x (czCenter hX j) := six_mul_czRadius_le_of_mem_Ω hx hX j + have hj := Subtype.coe_prop j +- simp only [𝒥₂, tsub_le_iff_right, mem_setOf_eq] at hj ++ simp only [𝒥₂, tsub_le_iff_right, mem_ofPred_eq] at hj + constructor + · linarith [dist_triangle_right x (czCenter hX j) y] + · linarith [dist_triangle x (czCenter hX j) y] +@@ -1507,7 +1539,7 @@ lemma czOperatorBound_inner_le (ha : 4 ≤ a) (hX : GeneralCase f (α' a α)) {i + rcases le_or_gt r 0 with hr | hr + · simp_rw [Real.toNNReal_of_nonpos hr, coe_zero, ENNReal.zero_div] + rw [ENNReal.zero_rpow_of_pos (by rw [inv_pos, Nat.cast_pos]; exact zero_lt_four.trans_le ha)] +- simp_rw [ENNReal.zero_div, lintegral_zero]; exact zero_le _ ++ simp_rw [ENNReal.zero_div, lintegral_zero]; exact zero_le + calc + _ ≤ ∫⁻ x in (czBall6 hX i)ᶜ, + (r.toNNReal / edist x c) ^ (a : ℝ)⁻¹ / volume (ball x (dist x c)) := by +@@ -1534,7 +1566,7 @@ lemma czOperatorBound_inner_le (ha : 4 ≤ a) (hX : GeneralCase f (α' a α)) {i + rw [czBall6, mem_compl_iff, mem_ball, not_lt, show (6 : ℝ) = 2 * 3 by norm_num, + mul_assoc] at mx + change 2 * r ≤ dist x c at mx +- rw [mem_iUnion]; use ⌊Real.logb 2 (dist x c / r)⌋₊; simp_rw [mem_diff, mem_ball, not_lt] ++ rw [mem_iUnion]; use ⌊Real.logb 2 (dist x c / r)⌋₊; simp_rw [Set.mem_sdiff, mem_ball, not_lt] + have dxcpos : 0 < dist x c := lt_of_lt_of_le (by positivity) mx + have dxceq : dist x c = 2 ^ (Real.logb 2 (dist x c / r)) * r := by + rw [Real.rpow_logb zero_lt_two (by norm_num) (by positivity), div_mul_cancel₀ _ hr.ne'] +@@ -1552,7 +1584,7 @@ lemma czOperatorBound_inner_le (ha : 4 ≤ a) (hX : GeneralCase f (α' a α)) {i + (2 ^ n)⁻¹ ^ (a : ℝ)⁻¹ / volume (ball c (2 ^ n * r)) := by + gcongr 2 ^ a * ∑' n, ?_ with n + refine setLIntegral_mono' (measurableSet_ball.diff measurableSet_ball) fun x mx ↦ ?_ +- simp_rw [mem_diff, mem_ball, not_lt] at mx ++ simp_rw [Set.mem_sdiff, mem_ball, not_lt] at mx + gcongr + · change ENNReal.ofReal r / _ ≤ _ + have dxcpos : 0 < dist x c := lt_of_lt_of_le (by positivity) mx.2 +@@ -1569,7 +1601,7 @@ lemma czOperatorBound_inner_le (ha : 4 ≤ a) (hX : GeneralCase f (α' a α)) {i + gcongr with n; apply div_le_of_le_mul + calc + _ ≤ volume (ball c (2 * (2 ^ n * r))) := by +- rw [← mul_assoc 2, ← pow_succ']; exact measure_mono diff_subset ++ rw [← mul_assoc 2, ← pow_succ']; exact measure_mono sdiff_subset + _ ≤ _ := by + convert measure_ball_two_le_same (μ := volume) c (2 ^ n * r) + unfold defaultA; norm_cast +@@ -1590,16 +1622,16 @@ lemma distribution_czOperatorBound (ha : 4 ≤ a) (hf : BoundedFiniteSupport f) + rcases eq_top_or_lt_top α with rfl | αlt + · have : czOperatorBound hX ⁻¹' Ioi (⊤ / 8) = ∅ := by + rw [top_div_of_ne_top (by norm_num), isMax_top.Ioi_eq, preimage_empty] +- rw [this, inter_empty, measure_empty]; exact zero_le _ ++ rw [this, inter_empty, measure_empty]; exact zero_le + calc + _ ≤ (volume.restrict (Ω f (α' a α))ᶜ) {x | α / 8 ≤ czOperatorBound hX x} := by + rw [inter_comm, ← Measure.restrict_apply']; swap + · apply MeasurableSet.compl; simp_rw [Ω, hX, dite_true] + exact MeasurableSet.iUnion fun _ ↦ measurableSet_ball +- gcongr; intro x mx; simp only [mem_preimage, mem_Ioi, mem_setOf_eq] at mx ⊢; exact mx.le ++ gcongr; intro x mx; simp only [mem_preimage, mem_Ioi, mem_ofPred_eq] at mx ⊢; exact mx.le + _ ≤ (∫⁻ x in (Ω f (α' a α))ᶜ, czOperatorBound hX x) / (α / 8) := by + apply meas_ge_le_lintegral_div +- · refine ((AEMeasurable.ennreal_tsum fun i ↦ ?_).const_mul _).restrict ++ · refine ((AEMeasurable.tsum fun i ↦ ?_).const_mul _).restrict + refine AEMeasurable.div ?_ measurable_vol₁.aemeasurable + refine ((AEMeasurable.const_div ?_ _).pow_const _).mul_const _ + simp only [coe_nnreal_ennreal_nndist] +@@ -1647,8 +1679,8 @@ lemma estimate_bad (ha : 4 ≤ a) (hr : 0 < r) + _ ≤ volume (Ω f (α' a α) ∪ + {x ∈ (Ω f (α' a α))ᶜ | α / 2 < ‖czOperator K r (czRemainder f (α' a α)) x‖ₑ}) := by + refine measure_mono fun x mx ↦ ?_ +- rw [mem_setOf_eq] at mx +- simp_rw [mem_union, mem_setOf_eq, mx, and_true, mem_compl_iff]; tauto ++ rw [mem_ofPred_eq] at mx ++ simp_rw [mem_union, mem_ofPred_eq, mx, and_true, mem_compl_iff]; tauto + _ ≤ volume (Ω f (α' a α)) + + volume {x ∈ (Ω f (α' a α))ᶜ | α / 2 < ‖czOperator K r (czRemainder f (α' a α)) x‖ₑ} := + measure_union_le _ _ +@@ -1656,7 +1688,7 @@ lemma estimate_bad (ha : 4 ≤ a) (hr : 0 < r) + volume ((Ω f (α' a α))ᶜ ∩ czOperatorBound hX ⁻¹' Ioi (α / 8)) := by + gcongr + · simp_rw [Ω, hX, dite_true]; exact measure_iUnion_le _ +- · intro x mx; simp_rw [mem_setOf_eq, mem_inter_iff, mem_preimage, mem_Ioi] at mx ⊢ ++ · intro x mx; simp_rw [mem_ofPred_eq, mem_inter_iff, mem_preimage, mem_Ioi] at mx ⊢ + obtain ⟨mx₁, mx₂⟩ := mx; refine ⟨mx₁, ?_⟩; contrapose! mx₂ + calc + _ ≤ 3 * czOperatorBound hX x + α / 8 := estimate_bad_partial hf hr hα mx₁ hX +@@ -1698,17 +1730,18 @@ lemma estimate_czOperator (ha : 4 ≤ a) (hr : 0 < r) (hf : BoundedFiniteSupport + rcases le_or_gt α (⨍⁻ x, ‖f x‖ₑ / c10_0_3 a) with hα | hα + · rw [laverage_eq] at hα + rcases eq_zero_or_pos (eLpNorm f 1) with hf₂ | hf₂ +- · rw [eLpNorm_eq_zero_iff hf.aestronglyMeasurable one_ne_zero] at hf₂ ++ · rw [eLpNorm_eq_zero_iff one_ne_zero] at hf₂ + have op0 : czOperator K r f = 0 := by + ext x; rw [czOperator, integral_eq_zero_of_ae]; swap + · have := (EventuallyEq.rfl (f := (K x ·))).mul hf₂ + simp only [mul_zero] at this; exact this.restrict + simp +- simp_rw [op0, distribution, Pi.zero_apply, enorm_zero, not_lt_zero, setOf_false, ++ simp_rw [op0, distribution, Pi.zero_apply, enorm_zero, not_lt_zero, ofPred_false, + measure_empty, zero_le] + conv_rhs at hα => + enter [1, 2, x]; rw [div_eq_mul_inv, c10_0_3, coe_inv (by positivity), inv_inv] +- rw [lintegral_mul_const' _ _ (by finiteness), ← eLpNorm_one_eq_lintegral_enorm] at hα ++ rw [lintegral_mul_const' _ _ (by finiteness), ++ ← eLpNorm_one_eq_lintegral_enorm hf.aestronglyMeasurable] at hα + replace hα := mul_le_of_le_div' hα + rw [← ENNReal.le_div_iff_mul_le] at hα; rotate_left + · right; positivity +@@ -1723,7 +1756,7 @@ lemma estimate_czOperator (ha : 4 ≤ a) (hr : 0 < r) (hf : BoundedFiniteSupport + _ ≤ distribution (czOperator K r (czApproximation f (α' a α))) (α / 2) volume + + distribution (czOperator K r (czRemainder f (α' a α))) (α / 2) volume := by + refine le_trans (measure_mono fun x mx ↦ ?_) (measure_union_le _ _) +- simp only [mem_union, mem_setOf_eq] at mx ⊢; contrapose! mx ++ simp only [mem_union, mem_ofPred_eq] at mx ⊢; contrapose! mx + calc + _ = ‖czOperator K r (czApproximation f (α' a α)) x + + czOperator K r (czRemainder f (α' a α)) x‖ₑ := by +@@ -1768,4 +1801,27 @@ theorem czOperator_weak_1_1 (ha : 4 ≤ a) (hr : 0 < r) + intro α; apply mul_le_of_le_div'; rw [ENNReal.mul_div_right_comm] + exact estimate_czOperator ha hr hf hT + ++/-! Public access to three already-proved decomposition/cancellation helpers. ++Added by the LeanBlast port; no upstream declaration or proof is changed. -/ ++ ++abbrev carlesonCzOperatorBoundSummand ++ (hX : GeneralCase f (c10_0_3 a * α)) (j : ℕ) (x : X) : ℝ≥0∞ := ++ czOperatorBoundSummand hX j x ++ ++theorem carlesonCzOperatorBound_eq ++ (hX : GeneralCase f (c10_0_3 a * α)) (x : X) : ++ czOperatorBound hX x = ∑' j, carlesonCzOperatorBoundSummand hX j x := ++ czOperatorBound_eq hX x ++ ++theorem carlesonCzCancellation_bound ++ (hx : x ∈ (Ω f (c10_0_3 a * α))ᶜ) ++ (hX : GeneralCase f (c10_0_3 a * α)) (j : ℕ) ++ {g : X → ℂ} (g_int : IntegrableOn g (czBall3 hX j)) ++ (hg0 : ∫ y in czBall3 hX j, g y = 0) ++ (hg : ∫⁻ y in czBall3 hX j, ‖g y‖ₑ ≤ ++ 2 ^ (2 * a + 1) * (c10_0_3 a * α) * volume (czBall3 hX j)) : ++ ‖∫ y in czBall3 hX j, K x y * g y‖ₑ ≤ carlesonCzOperatorBoundSummand hX j x := ++ lemma_10_2_7_bound hx hX j g_int hg0 hg ++ ++ + end +diff --git a/lakefile.toml b/lakefile.toml +index a6d2c69..b16709c 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -9,12 +9,11 @@ autoImplicit = false + weak.linter.flexible = true # no rigid tactic (e.g. `exact`) after a flexible tactic (e.g. `simp`) + # Enable all mathlib linters: automatically matches what mathlib uses. + weak.linter.mathlibStandardSet = true +-# Disable the long line linter, for now. +-weak.linter.style.longLine = false + + [[require]] + name = "mathlib" + git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[require]] + name = "checkdecls" +diff --git a/lean-toolchain b/lean-toolchain +index d324cad..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.29.0 +\ No newline at end of file ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/elliptic-curves-lean4341.patch b/lean/patches/elliptic-curves-lean4341.patch index 8a3da3c0a9ad56cb330b1b4c22fa75a8d4813fbe..fab72b9b04063c5c96f792f6d0b584d229b436ea 100644 --- a/lean/patches/elliptic-curves-lean4341.patch +++ b/lean/patches/elliptic-curves-lean4341.patch @@ -1,668 +1,668 @@ -diff --git a/EllipticCurves/FormalGroup/DividedDiffDiagonal.lean b/EllipticCurves/FormalGroup/DividedDiffDiagonal.lean -index 83a0c99107040dc9d9cd9679e970521b0f0c926f..84163f3a94a1ff49633771c646cc814e5143085a 100644 ---- a/EllipticCurves/FormalGroup/DividedDiffDiagonal.lean -+++ b/EllipticCurves/FormalGroup/DividedDiffDiagonal.lean -@@ -27,7 +27,7 @@ the Weierstrass formal group addition law (Silverman AEC IV.1). - ## Main result - - * `PowerSeries.adicEvalMv_dividedDiff_diagonal` : -- `adicEvalMv I ![x, x] (dividedDiff f) = adicEval I hx (derivativeFun f)`. -+ `adicEvalMv I ![x, x] (dividedDiff f) = adicEval I hx (derivative f)`. - -/ - - open MvPowerSeries -@@ -43,9 +43,9 @@ theorem diag_mem {x : A} (hx : x ∈ I) : ∀ s : Fin 2, (![x, x] : Fin 2 → A) - - /-- **The divided difference on the diagonal is the formal derivative.** Evaluating the bivariate - divided difference `Δf` at the diagonal point `(x, x)` (with `x ∈ I`, in the `I`-adically complete --ring `A`) yields the `I`-adic evaluation of the formal derivative `f′ = derivativeFun f` at `x`. -/ -+ring `A`) yields the `I`-adic evaluation of the formal derivative `f′ = derivative f` at `x`. -/ - theorem adicEvalMv_dividedDiff_diagonal {x : A} (hx : x ∈ I) (f : PowerSeries A) : -- adicEvalMv I (diag_mem I hx) (dividedDiff f) = adicEval I hx (derivativeFun f) := by -+ adicEvalMv I (diag_mem I hx) (dividedDiff f) = adicEval I hx (derivative f) := by - classical - letI : WithIdeal A := ⟨I⟩ - haveI : CompleteSpace A := ((IsAdic.isAdicComplete_iff (I := I) rfl).mp ‹_›).1 -@@ -94,7 +94,7 @@ theorem adicEvalMv_dividedDiff_diagonal {x : A} (hx : x ∈ I) (f : PowerSeries - have hsig := hP.sigma hfib - -- Match the derivative coefficient shape. - have hfun2 : (fun n : ℕ ↦ (n + 1) • (coeff (n + 1) f * x ^ n)) = -- fun n : ℕ ↦ coeff n (derivativeFun f) * x ^ n := by -+ fun n : ℕ ↦ coeff n (derivative f) * x ^ n := by - funext n - rw [coeff_derivativeFun, nsmul_eq_mul] - push_cast -@@ -103,7 +103,7 @@ theorem adicEvalMv_dividedDiff_diagonal {x : A} (hx : x ∈ I) (f : PowerSeries - -- The right-hand side, `f′(x)`, as a convergent sum with the *same* summand. - have hxnil : PowerSeries.HasEval x := WithIdeal.isTopologicallyNilpotent_of_mem hx - have hR := PowerSeries.hasSum_eval₂ (φ := RingHom.id A) (a := x) continuous_id hxnil -- (derivativeFun f) -+ (derivative f) - simp only [RingHom.id_apply] at hR - -- Conclude by uniqueness of sums. - rw [coe_adicEvalMv I (diag_mem I hx), coe_adicEval hx, ← hLdef] -diff --git a/EllipticCurves/FormalGroup/InvariantDifferentialInvariance.lean b/EllipticCurves/FormalGroup/InvariantDifferentialInvariance.lean -index 30d26f1960722fdf925dde3db9703aa5ec3c9cc2..9079ac48793bac2aa4cb8e485aa330885a244859 100644 ---- a/EllipticCurves/FormalGroup/InvariantDifferentialInvariance.lean -+++ b/EllipticCurves/FormalGroup/InvariantDifferentialInvariance.lean -@@ -90,10 +90,8 @@ variable {R : Type*} [CommRing R] (W : WeierstrassCurve R) - /-- The formal derivative of `z³` is `3z²`. -/ - private theorem derivativeFun_X_pow_three : - derivativeFun (X ^ 3 : R⟦X⟧) = 3 * X ^ 2 := by -- have h := PowerSeries.derivative_pow R (X : R⟦X⟧) 3 -- rw [PowerSeries.derivative_X, mul_one] at h -- rw [show derivativeFun (X ^ 3 : R⟦X⟧) = PowerSeries.derivative R (X ^ 3) from rfl, h] -- norm_num -+ change PowerSeries.derivative (X ^ 3 : R⟦X⟧) = 3 * X ^ 2 -+ simpa using PowerSeries.derivative_pow (X : R⟦X⟧) 3 - - /-- **Step 1 (`Eq.Ω`).** The pole-cleared defining identity of the invariant differential: - `ω_E · (w·(-2 + a₁z + a₃w)) = w − z·w'` in `R⟦z⟧`, with `w = W.formalW`. -@@ -113,6 +111,9 @@ theorem invariantDifferential_mul_clear [Algebra ℚ R] : - have ha : X ^ 3 * W.invDiffDen = W.formalW * (-2 + C W.a₁ * X + C W.a₃ * W.formalW) := by - rw [invDiffDen, ← mul_assoc, ← W.formalW_eq_X_pow_mul_wCofactor] - have hb : X ^ 3 * W.invDiffNum = W.formalW - X * derivativeFun W.formalW := by -+ change PowerSeries.derivative W.formalW = -+ X ^ 3 * PowerSeries.derivative W.wCofactor + 3 * X ^ 2 * W.wCofactor at hderiv -+ change X ^ 3 * W.invDiffNum = W.formalW - X * PowerSeries.derivative W.formalW - rw [invDiffNum, hderiv, W.formalW_eq_X_pow_mul_wCofactor] - ring - calc W.invariantDifferential * (W.formalW * (-2 + C W.a₁ * X + C W.a₃ * W.formalW)) -@@ -159,6 +160,9 @@ theorem invariantDifferential_mul_clear_subst_mul_pderivSnd [Algebra ℚ R] : - * MvPowerSeries.pderivSnd (W.formalW.subst W.formalGroupZW) := by - have hΩF := W.invariantDifferential_mul_clear_subst - have hchain := MvPowerSeries.pderivSnd_subst W.constantCoeff_formalGroupZW W.formalW -+ change MvPowerSeries.pderivSnd (W.formalW.subst W.formalGroupZW) = -+ W.formalW.derivativeFun.subst W.formalGroupZW * -+ MvPowerSeries.pderivSnd W.formalGroupZW at hchain - linear_combination MvPowerSeries.pderivSnd W.formalGroupZW * hΩF + W.formalGroupZW * hchain - - end WeierstrassCurve -diff --git a/EllipticCurves/FormalGroup/LogAdditivity.lean b/EllipticCurves/FormalGroup/LogAdditivity.lean -index 4b07889c1f9ae0f936f78bed2821b39d65834f13..3885dc976aabf531f43ea7a6f80a2fb377e168e6 100644 ---- a/EllipticCurves/FormalGroup/LogAdditivity.lean -+++ b/EllipticCurves/FormalGroup/LogAdditivity.lean -@@ -130,6 +130,7 @@ theorem eq_C_of_derivativeFun_eq_zero {g : S⟦X⟧} (h : g.derivativeFun = 0) : - | succ m => - have hcoeff : coeff (m + 1) g * ((m : S) + 1) = 0 := by - have hm := congrArg (coeff m) h -+ change coeff m (derivative g) = coeff m 0 at hm - rwa [coeff_derivativeFun, map_zero] at hm - have hu : IsUnit ((m : S) + 1) := by - have hcast : ((m : S) + 1) = algebraMap ℚ S ((m : ℚ) + 1) := by push_cast; ring -@@ -359,6 +360,7 @@ theorem derivativeFun_curry_formalLogAdditivityDefect_of_star [Algebra ℚ R] - (hstar : W.invariantDifferential.subst W.formalGroupZW * pderivSnd W.formalGroupZW - = W.invariantDifferential.subst (X 1)) : - (mvPowerSeriesFinTwoCurry W.formalLogAdditivityDefect).derivativeFun = 0 := by -+ change (mvPowerSeriesFinTwoCurry W.formalLogAdditivityDefect).derivative = 0 - rw [← curry_pderivSnd, W.pderivSnd_formalLogAdditivityDefect, hstar, sub_self, map_zero] - - /-- **Log-additivity, reduced to the two geometric facts.** Combining the two reductions, the full -diff --git a/EllipticCurves/FormalGroup/Logarithm.lean b/EllipticCurves/FormalGroup/Logarithm.lean -index 341610c8b12a0f043d599c1dad58e0fcd883b502..714bb409df9c9b7875ba12029b21be0e57fb49f7 100644 ---- a/EllipticCurves/FormalGroup/Logarithm.lean -+++ b/EllipticCurves/FormalGroup/Logarithm.lean -@@ -55,7 +55,7 @@ variable {R : Type*} [CommRing R] (W : WeierstrassCurve R) - /-- The numerator of the invariant differential after cancelling the pole: - `-(2·v + z·v')` with `v = W.wCofactor`. It has constant term `-2`. -/ - noncomputable def invDiffNum : R⟦X⟧ := -- -(2 * W.wCofactor + X * derivativeFun W.wCofactor) -+ -(2 * W.wCofactor + X * derivative W.wCofactor) - - /-- The denominator of the invariant differential after cancelling the pole: - `v · (-2 + a₁ z + a₃ w)` with `v = W.wCofactor`, `w = W.formalW`. It has constant term `-2`. -/ -@@ -126,7 +126,7 @@ theorem coeff_formalLog_succ [Algebra ℚ R] (n : ℕ) : - - /-- **`log_E'(z) = ω_E(z)`.** The formal logarithm is a primitive of the invariant differential. -/ - theorem derivativeFun_formalLog [Algebra ℚ R] : -- derivativeFun W.formalLog = W.invariantDifferential := by -+ derivative W.formalLog = W.invariantDifferential := by - ext n - rw [coeff_derivativeFun, coeff_formalLog_succ] - have key : algebraMap ℚ R ((n : ℚ) + 1)⁻¹ * ((n : R) + 1) = 1 := by -diff --git a/EllipticCurves/FormalGroup/MvPowerSeriesCurry.lean b/EllipticCurves/FormalGroup/MvPowerSeriesCurry.lean -index 1b76092dceb54adc2d1b95e45b0bb220bec2646d..16c02edfa4e94e6723eeb65ff28cf888e067dd6d 100644 ---- a/EllipticCurves/FormalGroup/MvPowerSeriesCurry.lean -+++ b/EllipticCurves/FormalGroup/MvPowerSeriesCurry.lean -@@ -183,10 +183,12 @@ theorem curryFinTwoRingHom_bijective : - using this - · -- surjective - intro F -- refine ⟨fun d => PowerSeries.coeff (d 0) (PowerSeries.coeff (d 1) F), ?_⟩ -+ let φ : MvPowerSeries (Fin 2) R := -+ fun d => PowerSeries.coeff (d 0) (PowerSeries.coeff (d 1) F) -+ refine ⟨φ, ?_⟩ - refine PowerSeries.ext fun n => PowerSeries.ext fun m => ?_ -- rw [curryFinTwoRingHom_apply, coeff_coeff_curryFinTwoFun, coeff_eval, -- single_add_apply_zero, single_add_apply_one] -+ rw [curryFinTwoRingHom_apply, coeff_coeff_curryFinTwoFun, coeff_eval] -+ simp only [φ, single_add_apply_zero, single_add_apply_one] - - /-- **The currying ring isomorphism** `MvPowerSeries (Fin 2) R ≃+* PowerSeries (PowerSeries R)`. -/ - noncomputable def mvPowerSeriesFinTwoCurry : -diff --git a/EllipticCurves/FormalGroup/MvPowerSeriesPderiv.lean b/EllipticCurves/FormalGroup/MvPowerSeriesPderiv.lean -index 1861a2978b87de99d7f483f8e0b313a77cef7c7f..e3782524c382f1642d6b8c952f81b8a026bf69d3 100644 ---- a/EllipticCurves/FormalGroup/MvPowerSeriesPderiv.lean -+++ b/EllipticCurves/FormalGroup/MvPowerSeriesPderiv.lean -@@ -12,13 +12,13 @@ import EllipticCurves.FormalGroup.MvPowerSeriesCurry - # The `z₂`-partial derivative on `MvPowerSeries (Fin 2) R` - - This Mathlib pin provides the univariate formal derivative --`PowerSeries.derivativeFun` / `PowerSeries.derivative : Derivation R R⟦X⟧ R⟦X⟧` --but has **no** partial-derivative operator on `MvPowerSeries`. For the invariant-differential -+`PowerSeries.derivative : Derivation R R⟦X⟧ R⟦X⟧` -+and the multivariate partial derivative `MvPowerSeries.pderiv`. For the invariant-differential - argument behind log-additivity of the Weierstrass formal group - (`EllipticCurves.FormalGroup.LogAdditivity`, Silverman AEC IV.5) we need to differentiate a - bivariate series in its *second* variable `z₂`. - --We obtain such an operator for free by transporting the univariate `derivativeFun` on the outer -+We obtain such an operator for free by transporting the univariate `derivative` on the outer - `z₂`-variable across the currying ring isomorphism - `mvPowerSeriesFinTwoCurry : MvPowerSeries (Fin 2) R ≃+* R⟦z₁⟧⟦z₂⟧` - (`EllipticCurves.FormalGroup.MvPowerSeriesCurry`; the *outer* index `1` is `z₂`, the *inner* -@@ -27,7 +27,7 @@ index `0` is `z₁`). - ## Main definitions and results - - * `MvPowerSeries.pderivSnd : MvPowerSeries (Fin 2) R → MvPowerSeries (Fin 2) R` — the `z₂`-partial -- derivative, `curry.symm ∘ derivativeFun ∘ curry`. -+ derivative, `curry.symm ∘ derivative ∘ curry`. - * `MvPowerSeries.coeff_coeff_pderivSnd` — its bigraded coefficient formula: the `z₂`-degree `n` is - bumped to `n + 1` and scaled by `n + 1`. - * Transported `Derivation`-style API: `pderivSnd_add`, `pderivSnd_zero`, `pderivSnd_smul`, -@@ -45,7 +45,7 @@ index `0` is `z₁`). - substitutable `G`, `∂_{z₂}(p(G)) = p'(G) · ∂_{z₂}G` (via `Derivation.comp_aeval_eq`). - * `MvPowerSeries.pderivSnd_subst` — the **substitution chain rule** in full generality: for a - univariate `f : R⟦X⟧` and a substitutable bivariate `G` (`constantCoeff G = 0`), -- `∂_{z₂}(f.subst G) = (f.derivativeFun.subst G) · ∂_{z₂}G`. This is the `Fin 2`-graded analogue of -+ `∂_{z₂}(f.subst G) = (f.derivative.subst G) · ∂_{z₂}G`. This is the `Fin 2`-graded analogue of - `PowerSeries.derivative_subst`, and the key calculus input for the invariant-differential form of - log-additivity (`EllipticCurves.FormalGroup.LogAdditivity`, `#315`). - -@@ -61,13 +61,13 @@ namespace MvPowerSeries - variable {R : Type*} [CommRing R] - - /-- The **`z₂`-partial derivative** on `MvPowerSeries (Fin 2) R`, defined by transporting the --univariate `PowerSeries.derivativeFun` on the outer (`z₂`) variable across the currying ring -+univariate `PowerSeries.derivative` on the outer (`z₂`) variable across the currying ring - isomorphism `mvPowerSeriesFinTwoCurry`. -/ - noncomputable def pderivSnd (φ : MvPowerSeries (Fin 2) R) : MvPowerSeries (Fin 2) R := -- mvPowerSeriesFinTwoCurry.symm (mvPowerSeriesFinTwoCurry φ).derivativeFun -+ mvPowerSeriesFinTwoCurry.symm (mvPowerSeriesFinTwoCurry φ).derivative - - theorem curry_pderivSnd (φ : MvPowerSeries (Fin 2) R) : -- mvPowerSeriesFinTwoCurry (pderivSnd φ) = (mvPowerSeriesFinTwoCurry φ).derivativeFun := by -+ mvPowerSeriesFinTwoCurry (pderivSnd φ) = (mvPowerSeriesFinTwoCurry φ).derivative := by - rw [pderivSnd, RingEquiv.apply_symm_apply] - - /-- The bigraded coefficient of the `z₂`-partial derivative: the `z₂`-degree `n` is bumped to -@@ -75,7 +75,7 @@ theorem curry_pderivSnd (φ : MvPowerSeries (Fin 2) R) : - theorem coeff_coeff_pderivSnd (φ : MvPowerSeries (Fin 2) R) (n m : ℕ) : - PowerSeries.coeff m (PowerSeries.coeff n (mvPowerSeriesFinTwoCurry (pderivSnd φ))) - = MvPowerSeries.coeff (Finsupp.single 0 m + Finsupp.single 1 (n + 1)) φ * ((n : R) + 1) := by -- rw [curry_pderivSnd, PowerSeries.coeff_derivativeFun, -+ rw [curry_pderivSnd, PowerSeries.coeff_derivative, - show ((n : PowerSeries R) + 1) = PowerSeries.C ((n : R) + 1) by - rw [map_add, map_natCast, map_one], - PowerSeries.coeff_mul_C, coeff_coeff_mvPowerSeriesFinTwoCurry] -@@ -90,7 +90,7 @@ theorem ext_coeff_coeff {φ ψ : MvPowerSeries (Fin 2) R} - - theorem pderivSnd_add (φ ψ : MvPowerSeries (Fin 2) R) : - pderivSnd (φ + ψ) = pderivSnd φ + pderivSnd ψ := by -- rw [pderivSnd, pderivSnd, pderivSnd, map_add, PowerSeries.derivativeFun_add, map_add] -+ rw [pderivSnd, pderivSnd, pderivSnd, map_add, map_add, map_add] - - @[simp] - theorem pderivSnd_zero : pderivSnd (0 : MvPowerSeries (Fin 2) R) = 0 := by -@@ -101,12 +101,14 @@ theorem pderivSnd_zero : pderivSnd (0 : MvPowerSeries (Fin 2) R) = 0 := by - - @[simp] - theorem pderivSnd_one : pderivSnd (1 : MvPowerSeries (Fin 2) R) = 0 := by -- rw [pderivSnd, map_one, PowerSeries.derivativeFun_one, map_zero] -+ rw [pderivSnd, map_one, PowerSeries.derivative_one, map_zero] - - /-- **Leibniz rule** for the `z₂`-partial derivative. -/ - theorem pderivSnd_mul (φ ψ : MvPowerSeries (Fin 2) R) : - pderivSnd (φ * ψ) = φ * pderivSnd ψ + ψ * pderivSnd φ := by -- rw [pderivSnd, pderivSnd, pderivSnd, map_mul, PowerSeries.derivativeFun_mul, -+ -- Differentiate in the outer variable, treating inner series as coefficients. -+ let : Algebra (PowerSeries R) (PowerSeries (PowerSeries R)) := MvPowerSeries.instAlgebra -+ rw [pderivSnd, pderivSnd, pderivSnd, map_mul, Derivation.leibniz, - smul_eq_mul, smul_eq_mul, map_add, map_mul, map_mul, RingEquiv.symm_apply_apply, - RingEquiv.symm_apply_apply] - -@@ -195,7 +197,7 @@ theorem coe_pderivSndDerivation : - - /-- **Power rule** for the `z₂`-partial derivative: `∂_{z₂}(φ ^ n) = n • φ ^ (n-1) • ∂_{z₂}φ`. - This is the inductive core of the substitution chain rule `∂_{z₂}(f.subst G) --= (f.derivativeFun.subst G) · ∂_{z₂}G`. -/ -+= (f.derivative.subst G) · ∂_{z₂}G`. -/ - theorem pderivSnd_pow (φ : MvPowerSeries (Fin 2) R) (n : ℕ) : - pderivSnd (φ ^ n) = n • φ ^ (n - 1) • pderivSnd φ := by - have h := pderivSndDerivation.leibniz_pow (a := φ) n -@@ -211,7 +213,7 @@ theorem coeff_pderivSnd (φ : MvPowerSeries (Fin 2) R) (m n : ℕ) : - - /-! ### The substitution chain rule - --`pderivSnd (f.subst G) = (f.derivativeFun.subst G) * pderivSnd G` for a univariate `f : R⟦X⟧` and a -+`pderivSnd (f.subst G) = (f.derivative.subst G) * pderivSnd G` for a univariate `f : R⟦X⟧` and a - substitutable bivariate `G` (`constantCoeff G = 0`, i.e. `PowerSeries.HasSubst G`). We follow the - model of Mathlib's `PowerSeries.derivative_subst`: first the polynomial case via - `Derivation.comp_aeval_eq` on `pderivSndDerivation`, then the general case by a finite-truncation -@@ -225,8 +227,8 @@ derivative of `p(G)` obeys the chain rule. Immediate from `Derivation.comp_aeva - theorem pderivSnd_subst_coe {G : MvPowerSeries (Fin 2) R} (hG : PowerSeries.HasSubst G) - (p : Polynomial R) : - pderivSnd ((p : R⟦X⟧).subst G) -- = ((p : R⟦X⟧).derivativeFun.subst G) * pderivSnd G := by -- rw [PowerSeries.subst_coe hG, PowerSeries.derivativeFun_coe, PowerSeries.subst_coe hG] -+ = ((p : R⟦X⟧).derivative.subst G) * pderivSnd G := by -+ rw [PowerSeries.subst_coe hG, PowerSeries.derivative_coe, PowerSeries.subst_coe hG] - have h := pderivSndDerivation.comp_aeval_eq (a := G) p - simpa only [pderivSndDerivation_apply, smul_eq_mul] using h - -@@ -247,7 +249,7 @@ fixed bidegree to a finite truncation of `f`, apply the polynomial case `pderivS - match coefficients. -/ - theorem pderivSnd_subst {G : MvPowerSeries (Fin 2) R} (hG0 : MvPowerSeries.constantCoeff G = 0) - (f : R⟦X⟧) : -- pderivSnd (f.subst G) = f.derivativeFun.subst G * pderivSnd G := by -+ pderivSnd (f.subst G) = f.derivative.subst G * pderivSnd G := by - classical - have hG : PowerSeries.HasSubst G := PowerSeries.HasSubst.of_constantCoeff_zero hG0 - -- Replacing `h` by a high truncation does not change any coefficient of `h.subst G` in a -@@ -269,17 +271,17 @@ theorem pderivSnd_subst {G : MvPowerSeries (Fin 2) R} (hG0 : MvPowerSeries.const - obtain ⟨m, n, rfl⟩ : ∃ m n, e = Finsupp.single 0 m + Finsupp.single 1 n := - ⟨e 0, e 1, by ext i; fin_cases i <;> simp⟩ - set N := m + n + 2 with hN -- -- Coefficients of the two `derivativeFun`s agree up to degree `N - 1`. -+ -- Coefficients of the two `derivative`s agree up to degree `N - 1`. - have hder_eq : ∀ d : ℕ, d < N - 1 → -- PowerSeries.coeff d ((↑(PowerSeries.trunc N f) : R⟦X⟧).derivativeFun) -- = PowerSeries.coeff d f.derivativeFun := by -+ PowerSeries.coeff d ((↑(PowerSeries.trunc N f) : R⟦X⟧).derivative) -+ = PowerSeries.coeff d f.derivative := by - intro d hd -- rw [PowerSeries.coeff_derivativeFun, PowerSeries.coeff_derivativeFun, -+ rw [PowerSeries.coeff_derivative, PowerSeries.coeff_derivative, - PowerSeries.coeff_coe_trunc_of_lt (show d + 1 < N by omega)] - -- Hence substituting the truncated derivative agrees on small bidegrees. - have hRHSterm : ∀ e₁ : Fin 2 →₀ ℕ, Finsupp.degree e₁ ≤ m + n → -- MvPowerSeries.coeff e₁ ((↑(PowerSeries.trunc N f) : R⟦X⟧).derivativeFun.subst G) -- = MvPowerSeries.coeff e₁ (f.derivativeFun.subst G) := by -+ MvPowerSeries.coeff e₁ ((↑(PowerSeries.trunc N f) : R⟦X⟧).derivative.subst G) -+ = MvPowerSeries.coeff e₁ (f.derivative.subst G) := by - intro e₁ he₁ - rw [PowerSeries.coeff_subst hG, PowerSeries.coeff_subst hG] - refine finsum_congr fun d => ?_ -diff --git a/EllipticCurves/FormalGroup/VietaDifferential.lean b/EllipticCurves/FormalGroup/VietaDifferential.lean -index 1374be0b83aa5d36b643ea0ed18e5e1811f69c00..9ca9e822e771b49cfef19341b0055bd3fc49a42f 100644 ---- a/EllipticCurves/FormalGroup/VietaDifferential.lean -+++ b/EllipticCurves/FormalGroup/VietaDifferential.lean -@@ -67,8 +67,9 @@ theorem derivative_ofPowerSeries (f : PowerSeries R) : - simp - · lift n to ℕ using hn with m - have hidx : ((m : ℤ) + 1) = ((m + 1 : ℕ) : ℤ) := by push_cast; ring -- rw [hidx, LaurentSeries.coeff_coe_powerSeries, LaurentSeries.coeff_coe_powerSeries, -- PowerSeries.coeff_derivativeFun, zsmul_eq_mul] -+ rw [hidx, LaurentSeries.coeff_coe_powerSeries, LaurentSeries.coeff_coe_powerSeries] -+ change _ = PowerSeries.coeff m (PowerSeries.derivative f) -+ rw [PowerSeries.coeff_derivative, zsmul_eq_mul] - push_cast - ring - -diff --git a/EllipticCurves/FunctionField/CoordinateRingBaseChange.lean b/EllipticCurves/FunctionField/CoordinateRingBaseChange.lean -index d8e43bf3359d82d4e7bb541ad775d95cf81d8d33..97a3ea5a4f605ddb5146aaa1b49cea333e75a16f 100644 ---- a/EllipticCurves/FunctionField/CoordinateRingBaseChange.lean -+++ b/EllipticCurves/FunctionField/CoordinateRingBaseChange.lean -@@ -98,14 +98,18 @@ private lemma e1_trans_e2_includeRight (a : W.CoordinateRing) : - refine AdjoinRoot.ringHom_ext (RingHom.ext fun r => ?_) ?_ - · simp only [RingHom.comp_apply, AlgEquiv.coe_toAlgHom, - AlgHom.toRingHom_eq_coe, RingHom.coe_coe, AlgEquiv.trans_apply, -- Algebra.TensorProduct.includeRight_apply, e1, AdjoinRoot.tensorAlgEquiv_of, e2, -- AdjoinRoot.coe_mapAlgEquiv, AdjoinRoot.map_of, coe_polyEquivTensor'_symm, -- polyEquivTensor_symm_apply_tmul_eq_smul, one_smul, CoordinateRing.map, -+ Algebra.TensorProduct.includeRight_apply, e1, e2, -+ AdjoinRoot.coe_mapAlgEquiv, CoordinateRing.map, - AdjoinRoot.lift_of, Polynomial.coe_mapRingHom] -+ erw [AdjoinRoot.tensorAlgEquiv_of] -+ erw [AdjoinRoot.map_of, coe_polyEquivTensor'_symm, -+ polyEquivTensor_symm_apply_tmul_eq_smul, one_smul] - · simp only [RingHom.comp_apply, AlgEquiv.coe_toAlgHom, - AlgHom.toRingHom_eq_coe, RingHom.coe_coe, AlgEquiv.trans_apply, -- Algebra.TensorProduct.includeRight_apply, e1, AdjoinRoot.tensorAlgEquiv_root, e2, -- AdjoinRoot.coe_mapAlgEquiv, AdjoinRoot.map_root, CoordinateRing.map, AdjoinRoot.lift_root] -+ Algebra.TensorProduct.includeRight_apply, e1, e2, -+ AdjoinRoot.coe_mapAlgEquiv, CoordinateRing.map, AdjoinRoot.lift_root] -+ erw [AdjoinRoot.tensorAlgEquiv_root] -+ rw [AdjoinRoot.map_root] - have h := DFunLike.congr_fun key a - simp only [RingHom.comp_apply, AlgEquiv.coe_toAlgHom, - AlgHom.toRingHom_eq_coe, RingHom.coe_coe, Algebra.TensorProduct.includeRight_apply] at h -@@ -128,8 +132,7 @@ noncomputable instance instAlgebraCoordinateRingMap : - private lemma comm_one_tmul_mul (a : W.CoordinateRing) (y : K ⊗[F] W.CoordinateRing) : - (TensorProduct.comm F K W.CoordinateRing) (((1 : K) ⊗ₜ[F] a) * y) - = a • (TensorProduct.comm F K W.CoordinateRing) y := by -- induction y with -- | zero => simp -+ induction y using TensorProduct.inductionOn with - | tmul k x => - rw [Algebra.TensorProduct.tmul_mul_tmul, one_mul, TensorProduct.comm_tmul, - TensorProduct.comm_tmul, TensorProduct.smul_tmul', smul_eq_mul] -diff --git a/EllipticCurves/FunctionField/CoordinateRingNormalAlgClosed.lean b/EllipticCurves/FunctionField/CoordinateRingNormalAlgClosed.lean -index 4fd18a022c6ba3585e9061b6cd14ca120e320e0a..f26a3d417978aef34f16d51bb57dbd757e4d266e 100644 ---- a/EllipticCurves/FunctionField/CoordinateRingNormalAlgClosed.lean -+++ b/EllipticCurves/FunctionField/CoordinateRingNormalAlgClosed.lean -@@ -153,7 +153,7 @@ theorem isIntegrallyClosed_of_isAlgClosed : IsIntegrallyClosed W.CoordinateRing - IsLocalization.isNoetherianRing (XYIdeal W a (C b)).primeCompl _ inferInstance - have htfae := tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain - (R := Localization.AtPrime (XYIdeal W a (C b))) -- exact ((htfae.out 4 3 rfl rfl).mp hprin).1 -+ exact ((htfae.out 5 4 rfl rfl).mp hprin).1 - - /-- **The coordinate ring of an elliptic curve over an algebraically closed field is a Dedekind - domain.** -/ -diff --git a/EllipticCurves/FunctionField/FunctionFieldGaloisDescent.lean b/EllipticCurves/FunctionField/FunctionFieldGaloisDescent.lean -index 7a2f87f15869ede95b9c7ec9d4e87318951373bd..4d4e5bc8457e7fa1e84da581b190c6205dc59417 100644 ---- a/EllipticCurves/FunctionField/FunctionFieldGaloisDescent.lean -+++ b/EllipticCurves/FunctionField/FunctionFieldGaloisDescent.lean -@@ -8,6 +8,7 @@ import EllipticCurves.FunctionField.FunctionFieldBaseChange - import EllipticCurves.FunctionField.GaloisFunctoriality - import EllipticCurves.FunctionField.MulByNPullback - import Mathlib.FieldTheory.Finite.GaloisField -+import Mathlib.FieldTheory.Galois.Infinite - - /-! - # Galois descent for the function field of a Weierstrass curve -diff --git a/EllipticCurves/FunctionField/LocalRingNormal.lean b/EllipticCurves/FunctionField/LocalRingNormal.lean -index a9ff5a72e2e72b56f9cfbf62c4ff08ccf0fb56f8..508ab6ac07eb89f058bcfcbfbc3bb9c4c24fd087 100644 ---- a/EllipticCurves/FunctionField/LocalRingNormal.lean -+++ b/EllipticCurves/FunctionField/LocalRingNormal.lean -@@ -107,7 +107,7 @@ theorem isIntegrallyClosed_localization_of_nonsingular (h : W.Nonsingular x y) - [(XYIdeal W x (C y)).IsPrime] : - IsIntegrallyClosed (Localization.AtPrime (XYIdeal W x (C y))) := by - have hiff := (tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain -- (Localization.AtPrime (XYIdeal W x (C y)))).out 4 3 -+ (Localization.AtPrime (XYIdeal W x (C y)))).out 5 4 - exact (hiff.mp (maximalIdeal_isPrincipal_of_nonsingular W x y h)).1 - - /-- **Integral closedness of the coordinate ring from the closed-point classification.** If every -diff --git a/EllipticCurves/FunctionField/PlaceDegreeComparison.lean b/EllipticCurves/FunctionField/PlaceDegreeComparison.lean -index 5dc4a8a5312cfc487920d7ad47efa1186d976ab5..fa0bc9cd1c3f68a59c431e9c905c6310fab1640c 100644 ---- a/EllipticCurves/FunctionField/PlaceDegreeComparison.lean -+++ b/EllipticCurves/FunctionField/PlaceDegreeComparison.lean -@@ -254,7 +254,8 @@ theorem degPt_eq_residueDegreeProj (v : HeightOneSpectrum W.CoordinateRing) : - degPt v = residueDegreeProj W (some v) := by - haveI : v.asIdeal.IsMaximal := v.isMaximal - haveI hpmax : (v.asIdeal.under F[X]).IsMaximal := -- Ideal.isMaximal_comap_of_isIntegral_of_isMaximal v.asIdeal -+ Ideal.isMaximal_comap_of_isIntegral_of_isMaximal (algebraMap F[X] W.CoordinateRing) -+ (algebraMap_isIntegral_iff.mpr inferInstance) v.asIdeal - haveI : v.asIdeal.LiesOver (v.asIdeal.under F[X]) := ⟨rfl⟩ - haveI : IsGalois (FractionRing F[X]) W.FunctionField := isGalois_fractionRing_polynomial - have hp0 : v.asIdeal.under F[X] ≠ 0 := -diff --git a/EllipticCurves/FunctionField/PlaceOrder.lean b/EllipticCurves/FunctionField/PlaceOrder.lean -index 5ffe055ed91af3d57e10ae3ce582ec20e5c7de4c..db82cacc5f573c7013df06aa5810e115c0769884 100644 ---- a/EllipticCurves/FunctionField/PlaceOrder.lean -+++ b/EllipticCurves/FunctionField/PlaceOrder.lean -@@ -356,7 +356,8 @@ theorem divisorProj_algEquiv {f : W.FunctionField} (hf : f ≠ 0) : - divisorProj W (σ f) = (divisorProj W f).mapDomain (mapProjPoint W σ) := by - ext q - obtain ⟨p, rfl⟩ := (mapProjPoint W σ).surjective q -- rw [Finsupp.mapDomain_apply (mapProjPoint W σ).injective, divisorProj_algEquiv_apply σ hf p] -+ rw [Finsupp.mapDomain_apply_of_injective (mapProjPoint W σ).injective, -+ divisorProj_algEquiv_apply σ hf p] - - end Transport - -diff --git a/EllipticCurves/FunctionField/ProjectiveDivisor.lean b/EllipticCurves/FunctionField/ProjectiveDivisor.lean -index b6957fd3da22f2e3487c111c3718e674c15d67eb..13dd0143b5fd8c724bd12e65a638a57be3d08ba2 100644 ---- a/EllipticCurves/FunctionField/ProjectiveDivisor.lean -+++ b/EllipticCurves/FunctionField/ProjectiveDivisor.lean -@@ -138,13 +138,14 @@ noncomputable def divisorProj (f : W.FunctionField) : ProjPoint W →₀ ℤ := - @[simp] - lemma divisorProj_apply_some (f : W.FunctionField) (v : HeightOneSpectrum W.CoordinateRing) : - divisorProj W f (some v) = ord v f := by -- rw [divisorProj, Finsupp.add_apply, Finsupp.mapDomain_apply (some_injective_projPoint W), -+ rw [divisorProj, Finsupp.add_apply, -+ Finsupp.mapDomain_apply_of_injective (some_injective_projPoint W), - Finsupp.single_apply, if_neg (by simp), add_zero, divisor_apply] - - @[simp] - lemma divisorProj_apply_none (f : W.FunctionField) : - divisorProj W f none = ordInfty W f := by -- rw [divisorProj, Finsupp.add_apply, Finsupp.mapDomain_notin_range _ _ (by simp), -+ rw [divisorProj, Finsupp.add_apply, Finsupp.mapDomain_of_notMem_range _ _ (by simp), - Finsupp.single_eq_same, zero_add] - - /-- The projective divisor determines, and is determined by, the affine divisor and the order at -diff --git a/EllipticCurves/Reduction/FormalGroupTangent.lean b/EllipticCurves/Reduction/FormalGroupTangent.lean -index b4fca14466daa0a5da09bba03a588a44ab462a75..1d4cef6c9fdb2bda5a143378d73bfcf71569c1ba 100644 ---- a/EllipticCurves/Reduction/FormalGroupTangent.lean -+++ b/EllipticCurves/Reduction/FormalGroupTangent.lean -@@ -71,15 +71,15 @@ open scoped PowerSeries - yields the tangency identity for `w′ = d⁄dX w`: - `w′ = 3z² + (a₁ + 2a₂z)w + (a₁z + a₂z²)w′ + a₄w² + 2(a₃ + a₄z)w·w′ + 3a₆w²·w′`. -/ - theorem derivative_formalW : -- derivative R W.formalW -+ derivative W.formalW - = 3 * PowerSeries.X ^ 2 - + (PowerSeries.C W.a₁ + 2 * (PowerSeries.C W.a₂ * PowerSeries.X)) * W.formalW - + (PowerSeries.C W.a₁ * PowerSeries.X + PowerSeries.C W.a₂ * PowerSeries.X ^ 2) -- * derivative R W.formalW -+ * derivative W.formalW - + PowerSeries.C W.a₄ * W.formalW ^ 2 - + 2 * (PowerSeries.C W.a₃ + PowerSeries.C W.a₄ * PowerSeries.X) * W.formalW -- * derivative R W.formalW -- + 3 * (PowerSeries.C W.a₆ * W.formalW ^ 2) * derivative R W.formalW := by -+ * derivative W.formalW -+ + 3 * (PowerSeries.C W.a₆ * W.formalW ^ 2) * derivative W.formalW := by - conv_lhs => rw [W.formalW_eq, WeierstrassCurve.wOp] - simp only [map_add, Derivation.leibniz, Derivation.leibniz_pow, PowerSeries.derivative_C, - PowerSeries.derivative_X, smul_eq_mul, nsmul_eq_mul, mul_one, mul_zero, add_zero, zero_add, -@@ -100,7 +100,7 @@ variable (W : WeierstrassCurve K) [IsIntegral R W] {z : R} - /-- The `𝔪`-adic value of the formal derivative `w′` of the Weierstrass expansion at `z`, - i.e. `w′(z) = adicEval z (d⁄dX formalW)`. -/ - noncomputable def wParamDeriv (hz : z ∈ (maximalIdeal R).asIdeal) : R := -- adicEval (maximalIdeal R).asIdeal hz (PowerSeries.derivative R (integralModel R W).formalW) -+ adicEval (maximalIdeal R).asIdeal hz (PowerSeries.derivative (integralModel R W).formalW) - - omit [IsFractionRing R K] in - /-- **The tangent slope is the derivative.** On the diagonal `z₁ = z₂ = z`, the numeric chord slope -@@ -190,4 +190,3 @@ theorem thirdChordPoint_functional_eq_diag (hz : z ∈ (maximalIdeal R).asIdeal) - end Diagonal - - end WeierstrassCurve -- -diff --git a/EllipticCurves/TateModule/Continuity.lean b/EllipticCurves/TateModule/Continuity.lean -index b9af90db4906f3bd3990e43c1abbb3221f541807..cc7700b7536bc30182acaa060503881f05eeb8b1 100644 ---- a/EllipticCurves/TateModule/Continuity.lean -+++ b/EllipticCurves/TateModule/Continuity.lean -@@ -195,14 +195,14 @@ theorem Point.stabilizer_some_eq (x y : F) (h : (W'⁄F).Nonsingular x y) : - simp only [SetLike.mem_coe, MulAction.mem_stabilizer_iff, Set.mem_inter_iff] - constructor - · intro hσ -- have h' : Point.some (σ x) (σ y) -+ have h' : Point.some ((σ : F →ₐ[S] F) x) ((σ : F →ₐ[S] F) y) - ((W'.baseChange_nonsingular (σ : F →ₐ[S] F).injective ..).mpr h) = Point.some x y h := hσ -- have h₂ : σ x = x ∧ σ y = y := by simpa only [Point.some.injEq] using h' -- exact h₂ -+ exact Point.some.inj h' - · rintro ⟨hx, hy⟩ -- change Point.some (σ x) (σ y) _ = _ -- simp only [Point.some.injEq] -- exact ⟨hx, hy⟩ -+ change (σ : F →ₐ[S] F) x = x at hx -+ change (σ : F →ₐ[S] F) y = y at hy -+ change Point.some ((σ : F →ₐ[S] F) x) ((σ : F →ₐ[S] F) y) _ = _ -+ simp only [hx, hy] - - /-- **The stabiliser of a point of `E(F)` is open in the Krull topology.** This is the one fact the - whole file rests on. For the point at infinity the stabiliser is all of `G`; for an affine point it -diff --git a/EllipticCurves/Torsion/NormEDSHomogeneous.lean b/EllipticCurves/Torsion/NormEDSHomogeneous.lean -index 64dd51c0a69bc09095d1965b1b496b03fcc64373..a174cff420b4c84425fa26329a4075c12b5ab523 100644 ---- a/EllipticCurves/Torsion/NormEDSHomogeneous.lean -+++ b/EllipticCurves/Torsion/NormEDSHomogeneous.lean -@@ -4,6 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: The Elliptic Curves formalisation contributors - -/ - import Mathlib.NumberTheory.EllipticDivisibilitySequence -+import Mathlib.Tactic.LinearCombination -+import Mathlib.Tactic.Ring - - /-! - # `normEDS` is weighted-homogeneous: the scaling law of a normalised EDS -diff --git a/EllipticCurves/Torsion/TwoTorsionSplittingField.lean b/EllipticCurves/Torsion/TwoTorsionSplittingField.lean -index 777c85ff15f0e13eb77b78de23039b6516b45871..672913ad140239a059242e6f40c4622f3304de79 100644 ---- a/EllipticCurves/Torsion/TwoTorsionSplittingField.lean -+++ b/EllipticCurves/Torsion/TwoTorsionSplittingField.lean -@@ -129,7 +129,8 @@ theorem separable_Ψ₂Sq [W.IsElliptic] (h2 : (2 : F) ≠ 0) : W.Ψ₂Sq.Separa - (W.Ψ₂Sq_ne_zero (four_ne_zero_of_two_ne_zero h2)) hsplits).mp ?_ - have hnodup := (Cubic.discr_ne_zero_iff_roots_nodup - (φ := algebraMap F W.Ψ₂Sq.SplittingField) ha (by rw [← Ψ₂Sq_eq]; exact hsplits)).mp hd -- simpa [Polynomial.aroots, Cubic.roots, Cubic.map_toPoly, Ψ₂Sq_eq] using hnodup -+ rw [Cubic.map_roots] at hnodup -+ simpa only [Polynomial.aroots, Ψ₂Sq_eq] using hnodup - - /-! ## A splitting field of the `2`-torsion cubic -/ - -diff --git a/EllipticCurves/Torsion/WardR1.lean b/EllipticCurves/Torsion/WardR1.lean -index c65eb7cc2ff727ff8c7595d7a62e7839b5f2de42..137ae92b5b6b3f9eafe49e350246dd04c5efb00b 100644 ---- a/EllipticCurves/Torsion/WardR1.lean -+++ b/EllipticCurves/Torsion/WardR1.lean -@@ -332,7 +332,7 @@ lemma normEDS_univ_ne_zero (n : ℤ) (hn : n ≠ 0) : - have hφ := map_normEDS (aeval ![(2 : ℤ), 3, 2] : UnivEDS →ₐ[ℤ] ℤ) (X 0 : UnivEDS) (X 1) (X 2) n - rw [h, map_zero] at hφ - norm_num [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.head_cons] at hφ -- rw [show (![(2 : ℤ), 3, 2] 2) = 2 from rfl, normEDS_two_three_two] at hφ -+ rw [normEDS_two_three_two] at hφ - exact hn hφ.symm - - end Universal -diff --git a/lake-manifest.json b/lake-manifest.json -index e2a21bd49d1aada1485597e9d77ae656791a657a..61f2046f73871c3929c5d81e209ef36dcc8bb0e5 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,21 +1,21 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/leanprover-community/mathlib4", -+ [{"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -25,7 +25,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -35,7 +35,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +45,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -65,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -75,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -85,10 +85,10 @@ - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "elliptic_curves", -diff --git a/lakefile.toml b/lakefile.toml -index dadf0adbfa50fd51667ecfe8437532db8e80d3ad..0b302539c60ea7bfa08b95792c32bf7ab7d94de2 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -13,6 +13,8 @@ defaultTargets = ["EllipticCurves"] - lintDriver = "batteries/runLinter" - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true -@@ -20,8 +22,8 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "EllipticCurves" -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/EllipticCurves/FormalGroup/DividedDiffDiagonal.lean b/EllipticCurves/FormalGroup/DividedDiffDiagonal.lean +index 83a0c99107040dc9d9cd9679e970521b0f0c926f..84163f3a94a1ff49633771c646cc814e5143085a 100644 +--- a/EllipticCurves/FormalGroup/DividedDiffDiagonal.lean ++++ b/EllipticCurves/FormalGroup/DividedDiffDiagonal.lean +@@ -27,7 +27,7 @@ the Weierstrass formal group addition law (Silverman AEC IV.1). + ## Main result + + * `PowerSeries.adicEvalMv_dividedDiff_diagonal` : +- `adicEvalMv I ![x, x] (dividedDiff f) = adicEval I hx (derivativeFun f)`. ++ `adicEvalMv I ![x, x] (dividedDiff f) = adicEval I hx (derivative f)`. + -/ + + open MvPowerSeries +@@ -43,9 +43,9 @@ theorem diag_mem {x : A} (hx : x ∈ I) : ∀ s : Fin 2, (![x, x] : Fin 2 → A) + + /-- **The divided difference on the diagonal is the formal derivative.** Evaluating the bivariate + divided difference `Δf` at the diagonal point `(x, x)` (with `x ∈ I`, in the `I`-adically complete +-ring `A`) yields the `I`-adic evaluation of the formal derivative `f′ = derivativeFun f` at `x`. -/ ++ring `A`) yields the `I`-adic evaluation of the formal derivative `f′ = derivative f` at `x`. -/ + theorem adicEvalMv_dividedDiff_diagonal {x : A} (hx : x ∈ I) (f : PowerSeries A) : +- adicEvalMv I (diag_mem I hx) (dividedDiff f) = adicEval I hx (derivativeFun f) := by ++ adicEvalMv I (diag_mem I hx) (dividedDiff f) = adicEval I hx (derivative f) := by + classical + letI : WithIdeal A := ⟨I⟩ + haveI : CompleteSpace A := ((IsAdic.isAdicComplete_iff (I := I) rfl).mp ‹_›).1 +@@ -94,7 +94,7 @@ theorem adicEvalMv_dividedDiff_diagonal {x : A} (hx : x ∈ I) (f : PowerSeries + have hsig := hP.sigma hfib + -- Match the derivative coefficient shape. + have hfun2 : (fun n : ℕ ↦ (n + 1) • (coeff (n + 1) f * x ^ n)) = +- fun n : ℕ ↦ coeff n (derivativeFun f) * x ^ n := by ++ fun n : ℕ ↦ coeff n (derivative f) * x ^ n := by + funext n + rw [coeff_derivativeFun, nsmul_eq_mul] + push_cast +@@ -103,7 +103,7 @@ theorem adicEvalMv_dividedDiff_diagonal {x : A} (hx : x ∈ I) (f : PowerSeries + -- The right-hand side, `f′(x)`, as a convergent sum with the *same* summand. + have hxnil : PowerSeries.HasEval x := WithIdeal.isTopologicallyNilpotent_of_mem hx + have hR := PowerSeries.hasSum_eval₂ (φ := RingHom.id A) (a := x) continuous_id hxnil +- (derivativeFun f) ++ (derivative f) + simp only [RingHom.id_apply] at hR + -- Conclude by uniqueness of sums. + rw [coe_adicEvalMv I (diag_mem I hx), coe_adicEval hx, ← hLdef] +diff --git a/EllipticCurves/FormalGroup/InvariantDifferentialInvariance.lean b/EllipticCurves/FormalGroup/InvariantDifferentialInvariance.lean +index 30d26f1960722fdf925dde3db9703aa5ec3c9cc2..9079ac48793bac2aa4cb8e485aa330885a244859 100644 +--- a/EllipticCurves/FormalGroup/InvariantDifferentialInvariance.lean ++++ b/EllipticCurves/FormalGroup/InvariantDifferentialInvariance.lean +@@ -90,10 +90,8 @@ variable {R : Type*} [CommRing R] (W : WeierstrassCurve R) + /-- The formal derivative of `z³` is `3z²`. -/ + private theorem derivativeFun_X_pow_three : + derivativeFun (X ^ 3 : R⟦X⟧) = 3 * X ^ 2 := by +- have h := PowerSeries.derivative_pow R (X : R⟦X⟧) 3 +- rw [PowerSeries.derivative_X, mul_one] at h +- rw [show derivativeFun (X ^ 3 : R⟦X⟧) = PowerSeries.derivative R (X ^ 3) from rfl, h] +- norm_num ++ change PowerSeries.derivative (X ^ 3 : R⟦X⟧) = 3 * X ^ 2 ++ simpa using PowerSeries.derivative_pow (X : R⟦X⟧) 3 + + /-- **Step 1 (`Eq.Ω`).** The pole-cleared defining identity of the invariant differential: + `ω_E · (w·(-2 + a₁z + a₃w)) = w − z·w'` in `R⟦z⟧`, with `w = W.formalW`. +@@ -113,6 +111,9 @@ theorem invariantDifferential_mul_clear [Algebra ℚ R] : + have ha : X ^ 3 * W.invDiffDen = W.formalW * (-2 + C W.a₁ * X + C W.a₃ * W.formalW) := by + rw [invDiffDen, ← mul_assoc, ← W.formalW_eq_X_pow_mul_wCofactor] + have hb : X ^ 3 * W.invDiffNum = W.formalW - X * derivativeFun W.formalW := by ++ change PowerSeries.derivative W.formalW = ++ X ^ 3 * PowerSeries.derivative W.wCofactor + 3 * X ^ 2 * W.wCofactor at hderiv ++ change X ^ 3 * W.invDiffNum = W.formalW - X * PowerSeries.derivative W.formalW + rw [invDiffNum, hderiv, W.formalW_eq_X_pow_mul_wCofactor] + ring + calc W.invariantDifferential * (W.formalW * (-2 + C W.a₁ * X + C W.a₃ * W.formalW)) +@@ -159,6 +160,9 @@ theorem invariantDifferential_mul_clear_subst_mul_pderivSnd [Algebra ℚ R] : + * MvPowerSeries.pderivSnd (W.formalW.subst W.formalGroupZW) := by + have hΩF := W.invariantDifferential_mul_clear_subst + have hchain := MvPowerSeries.pderivSnd_subst W.constantCoeff_formalGroupZW W.formalW ++ change MvPowerSeries.pderivSnd (W.formalW.subst W.formalGroupZW) = ++ W.formalW.derivativeFun.subst W.formalGroupZW * ++ MvPowerSeries.pderivSnd W.formalGroupZW at hchain + linear_combination MvPowerSeries.pderivSnd W.formalGroupZW * hΩF + W.formalGroupZW * hchain + + end WeierstrassCurve +diff --git a/EllipticCurves/FormalGroup/LogAdditivity.lean b/EllipticCurves/FormalGroup/LogAdditivity.lean +index 4b07889c1f9ae0f936f78bed2821b39d65834f13..3885dc976aabf531f43ea7a6f80a2fb377e168e6 100644 +--- a/EllipticCurves/FormalGroup/LogAdditivity.lean ++++ b/EllipticCurves/FormalGroup/LogAdditivity.lean +@@ -130,6 +130,7 @@ theorem eq_C_of_derivativeFun_eq_zero {g : S⟦X⟧} (h : g.derivativeFun = 0) : + | succ m => + have hcoeff : coeff (m + 1) g * ((m : S) + 1) = 0 := by + have hm := congrArg (coeff m) h ++ change coeff m (derivative g) = coeff m 0 at hm + rwa [coeff_derivativeFun, map_zero] at hm + have hu : IsUnit ((m : S) + 1) := by + have hcast : ((m : S) + 1) = algebraMap ℚ S ((m : ℚ) + 1) := by push_cast; ring +@@ -359,6 +360,7 @@ theorem derivativeFun_curry_formalLogAdditivityDefect_of_star [Algebra ℚ R] + (hstar : W.invariantDifferential.subst W.formalGroupZW * pderivSnd W.formalGroupZW + = W.invariantDifferential.subst (X 1)) : + (mvPowerSeriesFinTwoCurry W.formalLogAdditivityDefect).derivativeFun = 0 := by ++ change (mvPowerSeriesFinTwoCurry W.formalLogAdditivityDefect).derivative = 0 + rw [← curry_pderivSnd, W.pderivSnd_formalLogAdditivityDefect, hstar, sub_self, map_zero] + + /-- **Log-additivity, reduced to the two geometric facts.** Combining the two reductions, the full +diff --git a/EllipticCurves/FormalGroup/Logarithm.lean b/EllipticCurves/FormalGroup/Logarithm.lean +index 341610c8b12a0f043d599c1dad58e0fcd883b502..714bb409df9c9b7875ba12029b21be0e57fb49f7 100644 +--- a/EllipticCurves/FormalGroup/Logarithm.lean ++++ b/EllipticCurves/FormalGroup/Logarithm.lean +@@ -55,7 +55,7 @@ variable {R : Type*} [CommRing R] (W : WeierstrassCurve R) + /-- The numerator of the invariant differential after cancelling the pole: + `-(2·v + z·v')` with `v = W.wCofactor`. It has constant term `-2`. -/ + noncomputable def invDiffNum : R⟦X⟧ := +- -(2 * W.wCofactor + X * derivativeFun W.wCofactor) ++ -(2 * W.wCofactor + X * derivative W.wCofactor) + + /-- The denominator of the invariant differential after cancelling the pole: + `v · (-2 + a₁ z + a₃ w)` with `v = W.wCofactor`, `w = W.formalW`. It has constant term `-2`. -/ +@@ -126,7 +126,7 @@ theorem coeff_formalLog_succ [Algebra ℚ R] (n : ℕ) : + + /-- **`log_E'(z) = ω_E(z)`.** The formal logarithm is a primitive of the invariant differential. -/ + theorem derivativeFun_formalLog [Algebra ℚ R] : +- derivativeFun W.formalLog = W.invariantDifferential := by ++ derivative W.formalLog = W.invariantDifferential := by + ext n + rw [coeff_derivativeFun, coeff_formalLog_succ] + have key : algebraMap ℚ R ((n : ℚ) + 1)⁻¹ * ((n : R) + 1) = 1 := by +diff --git a/EllipticCurves/FormalGroup/MvPowerSeriesCurry.lean b/EllipticCurves/FormalGroup/MvPowerSeriesCurry.lean +index 1b76092dceb54adc2d1b95e45b0bb220bec2646d..16c02edfa4e94e6723eeb65ff28cf888e067dd6d 100644 +--- a/EllipticCurves/FormalGroup/MvPowerSeriesCurry.lean ++++ b/EllipticCurves/FormalGroup/MvPowerSeriesCurry.lean +@@ -183,10 +183,12 @@ theorem curryFinTwoRingHom_bijective : + using this + · -- surjective + intro F +- refine ⟨fun d => PowerSeries.coeff (d 0) (PowerSeries.coeff (d 1) F), ?_⟩ ++ let φ : MvPowerSeries (Fin 2) R := ++ fun d => PowerSeries.coeff (d 0) (PowerSeries.coeff (d 1) F) ++ refine ⟨φ, ?_⟩ + refine PowerSeries.ext fun n => PowerSeries.ext fun m => ?_ +- rw [curryFinTwoRingHom_apply, coeff_coeff_curryFinTwoFun, coeff_eval, +- single_add_apply_zero, single_add_apply_one] ++ rw [curryFinTwoRingHom_apply, coeff_coeff_curryFinTwoFun, coeff_eval] ++ simp only [φ, single_add_apply_zero, single_add_apply_one] + + /-- **The currying ring isomorphism** `MvPowerSeries (Fin 2) R ≃+* PowerSeries (PowerSeries R)`. -/ + noncomputable def mvPowerSeriesFinTwoCurry : +diff --git a/EllipticCurves/FormalGroup/MvPowerSeriesPderiv.lean b/EllipticCurves/FormalGroup/MvPowerSeriesPderiv.lean +index 1861a2978b87de99d7f483f8e0b313a77cef7c7f..e3782524c382f1642d6b8c952f81b8a026bf69d3 100644 +--- a/EllipticCurves/FormalGroup/MvPowerSeriesPderiv.lean ++++ b/EllipticCurves/FormalGroup/MvPowerSeriesPderiv.lean +@@ -12,13 +12,13 @@ import EllipticCurves.FormalGroup.MvPowerSeriesCurry + # The `z₂`-partial derivative on `MvPowerSeries (Fin 2) R` + + This Mathlib pin provides the univariate formal derivative +-`PowerSeries.derivativeFun` / `PowerSeries.derivative : Derivation R R⟦X⟧ R⟦X⟧` +-but has **no** partial-derivative operator on `MvPowerSeries`. For the invariant-differential ++`PowerSeries.derivative : Derivation R R⟦X⟧ R⟦X⟧` ++and the multivariate partial derivative `MvPowerSeries.pderiv`. For the invariant-differential + argument behind log-additivity of the Weierstrass formal group + (`EllipticCurves.FormalGroup.LogAdditivity`, Silverman AEC IV.5) we need to differentiate a + bivariate series in its *second* variable `z₂`. + +-We obtain such an operator for free by transporting the univariate `derivativeFun` on the outer ++We obtain such an operator for free by transporting the univariate `derivative` on the outer + `z₂`-variable across the currying ring isomorphism + `mvPowerSeriesFinTwoCurry : MvPowerSeries (Fin 2) R ≃+* R⟦z₁⟧⟦z₂⟧` + (`EllipticCurves.FormalGroup.MvPowerSeriesCurry`; the *outer* index `1` is `z₂`, the *inner* +@@ -27,7 +27,7 @@ index `0` is `z₁`). + ## Main definitions and results + + * `MvPowerSeries.pderivSnd : MvPowerSeries (Fin 2) R → MvPowerSeries (Fin 2) R` — the `z₂`-partial +- derivative, `curry.symm ∘ derivativeFun ∘ curry`. ++ derivative, `curry.symm ∘ derivative ∘ curry`. + * `MvPowerSeries.coeff_coeff_pderivSnd` — its bigraded coefficient formula: the `z₂`-degree `n` is + bumped to `n + 1` and scaled by `n + 1`. + * Transported `Derivation`-style API: `pderivSnd_add`, `pderivSnd_zero`, `pderivSnd_smul`, +@@ -45,7 +45,7 @@ index `0` is `z₁`). + substitutable `G`, `∂_{z₂}(p(G)) = p'(G) · ∂_{z₂}G` (via `Derivation.comp_aeval_eq`). + * `MvPowerSeries.pderivSnd_subst` — the **substitution chain rule** in full generality: for a + univariate `f : R⟦X⟧` and a substitutable bivariate `G` (`constantCoeff G = 0`), +- `∂_{z₂}(f.subst G) = (f.derivativeFun.subst G) · ∂_{z₂}G`. This is the `Fin 2`-graded analogue of ++ `∂_{z₂}(f.subst G) = (f.derivative.subst G) · ∂_{z₂}G`. This is the `Fin 2`-graded analogue of + `PowerSeries.derivative_subst`, and the key calculus input for the invariant-differential form of + log-additivity (`EllipticCurves.FormalGroup.LogAdditivity`, `#315`). + +@@ -61,13 +61,13 @@ namespace MvPowerSeries + variable {R : Type*} [CommRing R] + + /-- The **`z₂`-partial derivative** on `MvPowerSeries (Fin 2) R`, defined by transporting the +-univariate `PowerSeries.derivativeFun` on the outer (`z₂`) variable across the currying ring ++univariate `PowerSeries.derivative` on the outer (`z₂`) variable across the currying ring + isomorphism `mvPowerSeriesFinTwoCurry`. -/ + noncomputable def pderivSnd (φ : MvPowerSeries (Fin 2) R) : MvPowerSeries (Fin 2) R := +- mvPowerSeriesFinTwoCurry.symm (mvPowerSeriesFinTwoCurry φ).derivativeFun ++ mvPowerSeriesFinTwoCurry.symm (mvPowerSeriesFinTwoCurry φ).derivative + + theorem curry_pderivSnd (φ : MvPowerSeries (Fin 2) R) : +- mvPowerSeriesFinTwoCurry (pderivSnd φ) = (mvPowerSeriesFinTwoCurry φ).derivativeFun := by ++ mvPowerSeriesFinTwoCurry (pderivSnd φ) = (mvPowerSeriesFinTwoCurry φ).derivative := by + rw [pderivSnd, RingEquiv.apply_symm_apply] + + /-- The bigraded coefficient of the `z₂`-partial derivative: the `z₂`-degree `n` is bumped to +@@ -75,7 +75,7 @@ theorem curry_pderivSnd (φ : MvPowerSeries (Fin 2) R) : + theorem coeff_coeff_pderivSnd (φ : MvPowerSeries (Fin 2) R) (n m : ℕ) : + PowerSeries.coeff m (PowerSeries.coeff n (mvPowerSeriesFinTwoCurry (pderivSnd φ))) + = MvPowerSeries.coeff (Finsupp.single 0 m + Finsupp.single 1 (n + 1)) φ * ((n : R) + 1) := by +- rw [curry_pderivSnd, PowerSeries.coeff_derivativeFun, ++ rw [curry_pderivSnd, PowerSeries.coeff_derivative, + show ((n : PowerSeries R) + 1) = PowerSeries.C ((n : R) + 1) by + rw [map_add, map_natCast, map_one], + PowerSeries.coeff_mul_C, coeff_coeff_mvPowerSeriesFinTwoCurry] +@@ -90,7 +90,7 @@ theorem ext_coeff_coeff {φ ψ : MvPowerSeries (Fin 2) R} + + theorem pderivSnd_add (φ ψ : MvPowerSeries (Fin 2) R) : + pderivSnd (φ + ψ) = pderivSnd φ + pderivSnd ψ := by +- rw [pderivSnd, pderivSnd, pderivSnd, map_add, PowerSeries.derivativeFun_add, map_add] ++ rw [pderivSnd, pderivSnd, pderivSnd, map_add, map_add, map_add] + + @[simp] + theorem pderivSnd_zero : pderivSnd (0 : MvPowerSeries (Fin 2) R) = 0 := by +@@ -101,12 +101,14 @@ theorem pderivSnd_zero : pderivSnd (0 : MvPowerSeries (Fin 2) R) = 0 := by + + @[simp] + theorem pderivSnd_one : pderivSnd (1 : MvPowerSeries (Fin 2) R) = 0 := by +- rw [pderivSnd, map_one, PowerSeries.derivativeFun_one, map_zero] ++ rw [pderivSnd, map_one, PowerSeries.derivative_one, map_zero] + + /-- **Leibniz rule** for the `z₂`-partial derivative. -/ + theorem pderivSnd_mul (φ ψ : MvPowerSeries (Fin 2) R) : + pderivSnd (φ * ψ) = φ * pderivSnd ψ + ψ * pderivSnd φ := by +- rw [pderivSnd, pderivSnd, pderivSnd, map_mul, PowerSeries.derivativeFun_mul, ++ -- Differentiate in the outer variable, treating inner series as coefficients. ++ let : Algebra (PowerSeries R) (PowerSeries (PowerSeries R)) := MvPowerSeries.instAlgebra ++ rw [pderivSnd, pderivSnd, pderivSnd, map_mul, Derivation.leibniz, + smul_eq_mul, smul_eq_mul, map_add, map_mul, map_mul, RingEquiv.symm_apply_apply, + RingEquiv.symm_apply_apply] + +@@ -195,7 +197,7 @@ theorem coe_pderivSndDerivation : + + /-- **Power rule** for the `z₂`-partial derivative: `∂_{z₂}(φ ^ n) = n • φ ^ (n-1) • ∂_{z₂}φ`. + This is the inductive core of the substitution chain rule `∂_{z₂}(f.subst G) +-= (f.derivativeFun.subst G) · ∂_{z₂}G`. -/ ++= (f.derivative.subst G) · ∂_{z₂}G`. -/ + theorem pderivSnd_pow (φ : MvPowerSeries (Fin 2) R) (n : ℕ) : + pderivSnd (φ ^ n) = n • φ ^ (n - 1) • pderivSnd φ := by + have h := pderivSndDerivation.leibniz_pow (a := φ) n +@@ -211,7 +213,7 @@ theorem coeff_pderivSnd (φ : MvPowerSeries (Fin 2) R) (m n : ℕ) : + + /-! ### The substitution chain rule + +-`pderivSnd (f.subst G) = (f.derivativeFun.subst G) * pderivSnd G` for a univariate `f : R⟦X⟧` and a ++`pderivSnd (f.subst G) = (f.derivative.subst G) * pderivSnd G` for a univariate `f : R⟦X⟧` and a + substitutable bivariate `G` (`constantCoeff G = 0`, i.e. `PowerSeries.HasSubst G`). We follow the + model of Mathlib's `PowerSeries.derivative_subst`: first the polynomial case via + `Derivation.comp_aeval_eq` on `pderivSndDerivation`, then the general case by a finite-truncation +@@ -225,8 +227,8 @@ derivative of `p(G)` obeys the chain rule. Immediate from `Derivation.comp_aeva + theorem pderivSnd_subst_coe {G : MvPowerSeries (Fin 2) R} (hG : PowerSeries.HasSubst G) + (p : Polynomial R) : + pderivSnd ((p : R⟦X⟧).subst G) +- = ((p : R⟦X⟧).derivativeFun.subst G) * pderivSnd G := by +- rw [PowerSeries.subst_coe hG, PowerSeries.derivativeFun_coe, PowerSeries.subst_coe hG] ++ = ((p : R⟦X⟧).derivative.subst G) * pderivSnd G := by ++ rw [PowerSeries.subst_coe hG, PowerSeries.derivative_coe, PowerSeries.subst_coe hG] + have h := pderivSndDerivation.comp_aeval_eq (a := G) p + simpa only [pderivSndDerivation_apply, smul_eq_mul] using h + +@@ -247,7 +249,7 @@ fixed bidegree to a finite truncation of `f`, apply the polynomial case `pderivS + match coefficients. -/ + theorem pderivSnd_subst {G : MvPowerSeries (Fin 2) R} (hG0 : MvPowerSeries.constantCoeff G = 0) + (f : R⟦X⟧) : +- pderivSnd (f.subst G) = f.derivativeFun.subst G * pderivSnd G := by ++ pderivSnd (f.subst G) = f.derivative.subst G * pderivSnd G := by + classical + have hG : PowerSeries.HasSubst G := PowerSeries.HasSubst.of_constantCoeff_zero hG0 + -- Replacing `h` by a high truncation does not change any coefficient of `h.subst G` in a +@@ -269,17 +271,17 @@ theorem pderivSnd_subst {G : MvPowerSeries (Fin 2) R} (hG0 : MvPowerSeries.const + obtain ⟨m, n, rfl⟩ : ∃ m n, e = Finsupp.single 0 m + Finsupp.single 1 n := + ⟨e 0, e 1, by ext i; fin_cases i <;> simp⟩ + set N := m + n + 2 with hN +- -- Coefficients of the two `derivativeFun`s agree up to degree `N - 1`. ++ -- Coefficients of the two `derivative`s agree up to degree `N - 1`. + have hder_eq : ∀ d : ℕ, d < N - 1 → +- PowerSeries.coeff d ((↑(PowerSeries.trunc N f) : R⟦X⟧).derivativeFun) +- = PowerSeries.coeff d f.derivativeFun := by ++ PowerSeries.coeff d ((↑(PowerSeries.trunc N f) : R⟦X⟧).derivative) ++ = PowerSeries.coeff d f.derivative := by + intro d hd +- rw [PowerSeries.coeff_derivativeFun, PowerSeries.coeff_derivativeFun, ++ rw [PowerSeries.coeff_derivative, PowerSeries.coeff_derivative, + PowerSeries.coeff_coe_trunc_of_lt (show d + 1 < N by omega)] + -- Hence substituting the truncated derivative agrees on small bidegrees. + have hRHSterm : ∀ e₁ : Fin 2 →₀ ℕ, Finsupp.degree e₁ ≤ m + n → +- MvPowerSeries.coeff e₁ ((↑(PowerSeries.trunc N f) : R⟦X⟧).derivativeFun.subst G) +- = MvPowerSeries.coeff e₁ (f.derivativeFun.subst G) := by ++ MvPowerSeries.coeff e₁ ((↑(PowerSeries.trunc N f) : R⟦X⟧).derivative.subst G) ++ = MvPowerSeries.coeff e₁ (f.derivative.subst G) := by + intro e₁ he₁ + rw [PowerSeries.coeff_subst hG, PowerSeries.coeff_subst hG] + refine finsum_congr fun d => ?_ +diff --git a/EllipticCurves/FormalGroup/VietaDifferential.lean b/EllipticCurves/FormalGroup/VietaDifferential.lean +index 1374be0b83aa5d36b643ea0ed18e5e1811f69c00..9ca9e822e771b49cfef19341b0055bd3fc49a42f 100644 +--- a/EllipticCurves/FormalGroup/VietaDifferential.lean ++++ b/EllipticCurves/FormalGroup/VietaDifferential.lean +@@ -67,8 +67,9 @@ theorem derivative_ofPowerSeries (f : PowerSeries R) : + simp + · lift n to ℕ using hn with m + have hidx : ((m : ℤ) + 1) = ((m + 1 : ℕ) : ℤ) := by push_cast; ring +- rw [hidx, LaurentSeries.coeff_coe_powerSeries, LaurentSeries.coeff_coe_powerSeries, +- PowerSeries.coeff_derivativeFun, zsmul_eq_mul] ++ rw [hidx, LaurentSeries.coeff_coe_powerSeries, LaurentSeries.coeff_coe_powerSeries] ++ change _ = PowerSeries.coeff m (PowerSeries.derivative f) ++ rw [PowerSeries.coeff_derivative, zsmul_eq_mul] + push_cast + ring + +diff --git a/EllipticCurves/FunctionField/CoordinateRingBaseChange.lean b/EllipticCurves/FunctionField/CoordinateRingBaseChange.lean +index d8e43bf3359d82d4e7bb541ad775d95cf81d8d33..97a3ea5a4f605ddb5146aaa1b49cea333e75a16f 100644 +--- a/EllipticCurves/FunctionField/CoordinateRingBaseChange.lean ++++ b/EllipticCurves/FunctionField/CoordinateRingBaseChange.lean +@@ -98,14 +98,18 @@ private lemma e1_trans_e2_includeRight (a : W.CoordinateRing) : + refine AdjoinRoot.ringHom_ext (RingHom.ext fun r => ?_) ?_ + · simp only [RingHom.comp_apply, AlgEquiv.coe_toAlgHom, + AlgHom.toRingHom_eq_coe, RingHom.coe_coe, AlgEquiv.trans_apply, +- Algebra.TensorProduct.includeRight_apply, e1, AdjoinRoot.tensorAlgEquiv_of, e2, +- AdjoinRoot.coe_mapAlgEquiv, AdjoinRoot.map_of, coe_polyEquivTensor'_symm, +- polyEquivTensor_symm_apply_tmul_eq_smul, one_smul, CoordinateRing.map, ++ Algebra.TensorProduct.includeRight_apply, e1, e2, ++ AdjoinRoot.coe_mapAlgEquiv, CoordinateRing.map, + AdjoinRoot.lift_of, Polynomial.coe_mapRingHom] ++ erw [AdjoinRoot.tensorAlgEquiv_of] ++ erw [AdjoinRoot.map_of, coe_polyEquivTensor'_symm, ++ polyEquivTensor_symm_apply_tmul_eq_smul, one_smul] + · simp only [RingHom.comp_apply, AlgEquiv.coe_toAlgHom, + AlgHom.toRingHom_eq_coe, RingHom.coe_coe, AlgEquiv.trans_apply, +- Algebra.TensorProduct.includeRight_apply, e1, AdjoinRoot.tensorAlgEquiv_root, e2, +- AdjoinRoot.coe_mapAlgEquiv, AdjoinRoot.map_root, CoordinateRing.map, AdjoinRoot.lift_root] ++ Algebra.TensorProduct.includeRight_apply, e1, e2, ++ AdjoinRoot.coe_mapAlgEquiv, CoordinateRing.map, AdjoinRoot.lift_root] ++ erw [AdjoinRoot.tensorAlgEquiv_root] ++ rw [AdjoinRoot.map_root] + have h := DFunLike.congr_fun key a + simp only [RingHom.comp_apply, AlgEquiv.coe_toAlgHom, + AlgHom.toRingHom_eq_coe, RingHom.coe_coe, Algebra.TensorProduct.includeRight_apply] at h +@@ -128,8 +132,7 @@ noncomputable instance instAlgebraCoordinateRingMap : + private lemma comm_one_tmul_mul (a : W.CoordinateRing) (y : K ⊗[F] W.CoordinateRing) : + (TensorProduct.comm F K W.CoordinateRing) (((1 : K) ⊗ₜ[F] a) * y) + = a • (TensorProduct.comm F K W.CoordinateRing) y := by +- induction y with +- | zero => simp ++ induction y using TensorProduct.inductionOn with + | tmul k x => + rw [Algebra.TensorProduct.tmul_mul_tmul, one_mul, TensorProduct.comm_tmul, + TensorProduct.comm_tmul, TensorProduct.smul_tmul', smul_eq_mul] +diff --git a/EllipticCurves/FunctionField/CoordinateRingNormalAlgClosed.lean b/EllipticCurves/FunctionField/CoordinateRingNormalAlgClosed.lean +index 4fd18a022c6ba3585e9061b6cd14ca120e320e0a..f26a3d417978aef34f16d51bb57dbd757e4d266e 100644 +--- a/EllipticCurves/FunctionField/CoordinateRingNormalAlgClosed.lean ++++ b/EllipticCurves/FunctionField/CoordinateRingNormalAlgClosed.lean +@@ -153,7 +153,7 @@ theorem isIntegrallyClosed_of_isAlgClosed : IsIntegrallyClosed W.CoordinateRing + IsLocalization.isNoetherianRing (XYIdeal W a (C b)).primeCompl _ inferInstance + have htfae := tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain + (R := Localization.AtPrime (XYIdeal W a (C b))) +- exact ((htfae.out 4 3 rfl rfl).mp hprin).1 ++ exact ((htfae.out 5 4 rfl rfl).mp hprin).1 + + /-- **The coordinate ring of an elliptic curve over an algebraically closed field is a Dedekind + domain.** -/ +diff --git a/EllipticCurves/FunctionField/FunctionFieldGaloisDescent.lean b/EllipticCurves/FunctionField/FunctionFieldGaloisDescent.lean +index 7a2f87f15869ede95b9c7ec9d4e87318951373bd..4d4e5bc8457e7fa1e84da581b190c6205dc59417 100644 +--- a/EllipticCurves/FunctionField/FunctionFieldGaloisDescent.lean ++++ b/EllipticCurves/FunctionField/FunctionFieldGaloisDescent.lean +@@ -8,6 +8,7 @@ import EllipticCurves.FunctionField.FunctionFieldBaseChange + import EllipticCurves.FunctionField.GaloisFunctoriality + import EllipticCurves.FunctionField.MulByNPullback + import Mathlib.FieldTheory.Finite.GaloisField ++import Mathlib.FieldTheory.Galois.Infinite + + /-! + # Galois descent for the function field of a Weierstrass curve +diff --git a/EllipticCurves/FunctionField/LocalRingNormal.lean b/EllipticCurves/FunctionField/LocalRingNormal.lean +index a9ff5a72e2e72b56f9cfbf62c4ff08ccf0fb56f8..508ab6ac07eb89f058bcfcbfbc3bb9c4c24fd087 100644 +--- a/EllipticCurves/FunctionField/LocalRingNormal.lean ++++ b/EllipticCurves/FunctionField/LocalRingNormal.lean +@@ -107,7 +107,7 @@ theorem isIntegrallyClosed_localization_of_nonsingular (h : W.Nonsingular x y) + [(XYIdeal W x (C y)).IsPrime] : + IsIntegrallyClosed (Localization.AtPrime (XYIdeal W x (C y))) := by + have hiff := (tfae_of_isNoetherianRing_of_isLocalRing_of_isDomain +- (Localization.AtPrime (XYIdeal W x (C y)))).out 4 3 ++ (Localization.AtPrime (XYIdeal W x (C y)))).out 5 4 + exact (hiff.mp (maximalIdeal_isPrincipal_of_nonsingular W x y h)).1 + + /-- **Integral closedness of the coordinate ring from the closed-point classification.** If every +diff --git a/EllipticCurves/FunctionField/PlaceDegreeComparison.lean b/EllipticCurves/FunctionField/PlaceDegreeComparison.lean +index 5dc4a8a5312cfc487920d7ad47efa1186d976ab5..fa0bc9cd1c3f68a59c431e9c905c6310fab1640c 100644 +--- a/EllipticCurves/FunctionField/PlaceDegreeComparison.lean ++++ b/EllipticCurves/FunctionField/PlaceDegreeComparison.lean +@@ -254,7 +254,8 @@ theorem degPt_eq_residueDegreeProj (v : HeightOneSpectrum W.CoordinateRing) : + degPt v = residueDegreeProj W (some v) := by + haveI : v.asIdeal.IsMaximal := v.isMaximal + haveI hpmax : (v.asIdeal.under F[X]).IsMaximal := +- Ideal.isMaximal_comap_of_isIntegral_of_isMaximal v.asIdeal ++ Ideal.isMaximal_comap_of_isIntegral_of_isMaximal (algebraMap F[X] W.CoordinateRing) ++ (algebraMap_isIntegral_iff.mpr inferInstance) v.asIdeal + haveI : v.asIdeal.LiesOver (v.asIdeal.under F[X]) := ⟨rfl⟩ + haveI : IsGalois (FractionRing F[X]) W.FunctionField := isGalois_fractionRing_polynomial + have hp0 : v.asIdeal.under F[X] ≠ 0 := +diff --git a/EllipticCurves/FunctionField/PlaceOrder.lean b/EllipticCurves/FunctionField/PlaceOrder.lean +index 5ffe055ed91af3d57e10ae3ce582ec20e5c7de4c..db82cacc5f573c7013df06aa5810e115c0769884 100644 +--- a/EllipticCurves/FunctionField/PlaceOrder.lean ++++ b/EllipticCurves/FunctionField/PlaceOrder.lean +@@ -356,7 +356,8 @@ theorem divisorProj_algEquiv {f : W.FunctionField} (hf : f ≠ 0) : + divisorProj W (σ f) = (divisorProj W f).mapDomain (mapProjPoint W σ) := by + ext q + obtain ⟨p, rfl⟩ := (mapProjPoint W σ).surjective q +- rw [Finsupp.mapDomain_apply (mapProjPoint W σ).injective, divisorProj_algEquiv_apply σ hf p] ++ rw [Finsupp.mapDomain_apply_of_injective (mapProjPoint W σ).injective, ++ divisorProj_algEquiv_apply σ hf p] + + end Transport + +diff --git a/EllipticCurves/FunctionField/ProjectiveDivisor.lean b/EllipticCurves/FunctionField/ProjectiveDivisor.lean +index b6957fd3da22f2e3487c111c3718e674c15d67eb..13dd0143b5fd8c724bd12e65a638a57be3d08ba2 100644 +--- a/EllipticCurves/FunctionField/ProjectiveDivisor.lean ++++ b/EllipticCurves/FunctionField/ProjectiveDivisor.lean +@@ -138,13 +138,14 @@ noncomputable def divisorProj (f : W.FunctionField) : ProjPoint W →₀ ℤ := + @[simp] + lemma divisorProj_apply_some (f : W.FunctionField) (v : HeightOneSpectrum W.CoordinateRing) : + divisorProj W f (some v) = ord v f := by +- rw [divisorProj, Finsupp.add_apply, Finsupp.mapDomain_apply (some_injective_projPoint W), ++ rw [divisorProj, Finsupp.add_apply, ++ Finsupp.mapDomain_apply_of_injective (some_injective_projPoint W), + Finsupp.single_apply, if_neg (by simp), add_zero, divisor_apply] + + @[simp] + lemma divisorProj_apply_none (f : W.FunctionField) : + divisorProj W f none = ordInfty W f := by +- rw [divisorProj, Finsupp.add_apply, Finsupp.mapDomain_notin_range _ _ (by simp), ++ rw [divisorProj, Finsupp.add_apply, Finsupp.mapDomain_of_notMem_range _ _ (by simp), + Finsupp.single_eq_same, zero_add] + + /-- The projective divisor determines, and is determined by, the affine divisor and the order at +diff --git a/EllipticCurves/Reduction/FormalGroupTangent.lean b/EllipticCurves/Reduction/FormalGroupTangent.lean +index b4fca14466daa0a5da09bba03a588a44ab462a75..1d4cef6c9fdb2bda5a143378d73bfcf71569c1ba 100644 +--- a/EllipticCurves/Reduction/FormalGroupTangent.lean ++++ b/EllipticCurves/Reduction/FormalGroupTangent.lean +@@ -71,15 +71,15 @@ open scoped PowerSeries + yields the tangency identity for `w′ = d⁄dX w`: + `w′ = 3z² + (a₁ + 2a₂z)w + (a₁z + a₂z²)w′ + a₄w² + 2(a₃ + a₄z)w·w′ + 3a₆w²·w′`. -/ + theorem derivative_formalW : +- derivative R W.formalW ++ derivative W.formalW + = 3 * PowerSeries.X ^ 2 + + (PowerSeries.C W.a₁ + 2 * (PowerSeries.C W.a₂ * PowerSeries.X)) * W.formalW + + (PowerSeries.C W.a₁ * PowerSeries.X + PowerSeries.C W.a₂ * PowerSeries.X ^ 2) +- * derivative R W.formalW ++ * derivative W.formalW + + PowerSeries.C W.a₄ * W.formalW ^ 2 + + 2 * (PowerSeries.C W.a₃ + PowerSeries.C W.a₄ * PowerSeries.X) * W.formalW +- * derivative R W.formalW +- + 3 * (PowerSeries.C W.a₆ * W.formalW ^ 2) * derivative R W.formalW := by ++ * derivative W.formalW ++ + 3 * (PowerSeries.C W.a₆ * W.formalW ^ 2) * derivative W.formalW := by + conv_lhs => rw [W.formalW_eq, WeierstrassCurve.wOp] + simp only [map_add, Derivation.leibniz, Derivation.leibniz_pow, PowerSeries.derivative_C, + PowerSeries.derivative_X, smul_eq_mul, nsmul_eq_mul, mul_one, mul_zero, add_zero, zero_add, +@@ -100,7 +100,7 @@ variable (W : WeierstrassCurve K) [IsIntegral R W] {z : R} + /-- The `𝔪`-adic value of the formal derivative `w′` of the Weierstrass expansion at `z`, + i.e. `w′(z) = adicEval z (d⁄dX formalW)`. -/ + noncomputable def wParamDeriv (hz : z ∈ (maximalIdeal R).asIdeal) : R := +- adicEval (maximalIdeal R).asIdeal hz (PowerSeries.derivative R (integralModel R W).formalW) ++ adicEval (maximalIdeal R).asIdeal hz (PowerSeries.derivative (integralModel R W).formalW) + + omit [IsFractionRing R K] in + /-- **The tangent slope is the derivative.** On the diagonal `z₁ = z₂ = z`, the numeric chord slope +@@ -190,4 +190,3 @@ theorem thirdChordPoint_functional_eq_diag (hz : z ∈ (maximalIdeal R).asIdeal) + end Diagonal + + end WeierstrassCurve +- +diff --git a/EllipticCurves/TateModule/Continuity.lean b/EllipticCurves/TateModule/Continuity.lean +index b9af90db4906f3bd3990e43c1abbb3221f541807..cc7700b7536bc30182acaa060503881f05eeb8b1 100644 +--- a/EllipticCurves/TateModule/Continuity.lean ++++ b/EllipticCurves/TateModule/Continuity.lean +@@ -195,14 +195,14 @@ theorem Point.stabilizer_some_eq (x y : F) (h : (W'⁄F).Nonsingular x y) : + simp only [SetLike.mem_coe, MulAction.mem_stabilizer_iff, Set.mem_inter_iff] + constructor + · intro hσ +- have h' : Point.some (σ x) (σ y) ++ have h' : Point.some ((σ : F →ₐ[S] F) x) ((σ : F →ₐ[S] F) y) + ((W'.baseChange_nonsingular (σ : F →ₐ[S] F).injective ..).mpr h) = Point.some x y h := hσ +- have h₂ : σ x = x ∧ σ y = y := by simpa only [Point.some.injEq] using h' +- exact h₂ ++ exact Point.some.inj h' + · rintro ⟨hx, hy⟩ +- change Point.some (σ x) (σ y) _ = _ +- simp only [Point.some.injEq] +- exact ⟨hx, hy⟩ ++ change (σ : F →ₐ[S] F) x = x at hx ++ change (σ : F →ₐ[S] F) y = y at hy ++ change Point.some ((σ : F →ₐ[S] F) x) ((σ : F →ₐ[S] F) y) _ = _ ++ simp only [hx, hy] + + /-- **The stabiliser of a point of `E(F)` is open in the Krull topology.** This is the one fact the + whole file rests on. For the point at infinity the stabiliser is all of `G`; for an affine point it +diff --git a/EllipticCurves/Torsion/NormEDSHomogeneous.lean b/EllipticCurves/Torsion/NormEDSHomogeneous.lean +index 64dd51c0a69bc09095d1965b1b496b03fcc64373..a174cff420b4c84425fa26329a4075c12b5ab523 100644 +--- a/EllipticCurves/Torsion/NormEDSHomogeneous.lean ++++ b/EllipticCurves/Torsion/NormEDSHomogeneous.lean +@@ -4,6 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: The Elliptic Curves formalisation contributors + -/ + import Mathlib.NumberTheory.EllipticDivisibilitySequence ++import Mathlib.Tactic.LinearCombination ++import Mathlib.Tactic.Ring + + /-! + # `normEDS` is weighted-homogeneous: the scaling law of a normalised EDS +diff --git a/EllipticCurves/Torsion/TwoTorsionSplittingField.lean b/EllipticCurves/Torsion/TwoTorsionSplittingField.lean +index 777c85ff15f0e13eb77b78de23039b6516b45871..672913ad140239a059242e6f40c4622f3304de79 100644 +--- a/EllipticCurves/Torsion/TwoTorsionSplittingField.lean ++++ b/EllipticCurves/Torsion/TwoTorsionSplittingField.lean +@@ -129,7 +129,8 @@ theorem separable_Ψ₂Sq [W.IsElliptic] (h2 : (2 : F) ≠ 0) : W.Ψ₂Sq.Separa + (W.Ψ₂Sq_ne_zero (four_ne_zero_of_two_ne_zero h2)) hsplits).mp ?_ + have hnodup := (Cubic.discr_ne_zero_iff_roots_nodup + (φ := algebraMap F W.Ψ₂Sq.SplittingField) ha (by rw [← Ψ₂Sq_eq]; exact hsplits)).mp hd +- simpa [Polynomial.aroots, Cubic.roots, Cubic.map_toPoly, Ψ₂Sq_eq] using hnodup ++ rw [Cubic.map_roots] at hnodup ++ simpa only [Polynomial.aroots, Ψ₂Sq_eq] using hnodup + + /-! ## A splitting field of the `2`-torsion cubic -/ + +diff --git a/EllipticCurves/Torsion/WardR1.lean b/EllipticCurves/Torsion/WardR1.lean +index c65eb7cc2ff727ff8c7595d7a62e7839b5f2de42..137ae92b5b6b3f9eafe49e350246dd04c5efb00b 100644 +--- a/EllipticCurves/Torsion/WardR1.lean ++++ b/EllipticCurves/Torsion/WardR1.lean +@@ -332,7 +332,7 @@ lemma normEDS_univ_ne_zero (n : ℤ) (hn : n ≠ 0) : + have hφ := map_normEDS (aeval ![(2 : ℤ), 3, 2] : UnivEDS →ₐ[ℤ] ℤ) (X 0 : UnivEDS) (X 1) (X 2) n + rw [h, map_zero] at hφ + norm_num [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.head_cons] at hφ +- rw [show (![(2 : ℤ), 3, 2] 2) = 2 from rfl, normEDS_two_three_two] at hφ ++ rw [normEDS_two_three_two] at hφ + exact hn hφ.symm + + end Universal +diff --git a/lake-manifest.json b/lake-manifest.json +index e2a21bd49d1aada1485597e9d77ae656791a657a..61f2046f73871c3929c5d81e209ef36dcc8bb0e5 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,21 +1,21 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/leanprover-community/mathlib4", ++ [{"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -25,7 +25,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -35,7 +35,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +45,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -65,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -75,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -85,10 +85,10 @@ + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "elliptic_curves", +diff --git a/lakefile.toml b/lakefile.toml +index dadf0adbfa50fd51667ecfe8437532db8e80d3ad..0b302539c60ea7bfa08b95792c32bf7ab7d94de2 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -13,6 +13,8 @@ defaultTargets = ["EllipticCurves"] + lintDriver = "batteries/runLinter" + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true +@@ -20,8 +22,8 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "EllipticCurves" +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/fixed-point-theorems-lean4341.patch b/lean/patches/fixed-point-theorems-lean4341.patch index 0768f6230000f65206a0aab892a78e9981f9045f..1213fb0a7a24f0be2ba1b9a8db5af1434f02c4ec 100644 --- a/lean/patches/fixed-point-theorems-lean4341.patch +++ b/lean/patches/fixed-point-theorems-lean4341.patch @@ -1,640 +1,640 @@ -diff --git a/FixedPointTheorems/apply_cubical_sperner.lean b/FixedPointTheorems/apply_cubical_sperner.lean -index ffbbbcd..5737a7c 100644 ---- a/FixedPointTheorems/apply_cubical_sperner.lean -+++ b/FixedPointTheorems/apply_cubical_sperner.lean -@@ -1,17 +1,17 @@ -- -- --import Mathlib.Analysis.Convex.Intrinsic --import Mathlib.Topology.Defs.Basic -+import Mathlib - import FixedPointTheorems.cubical_sperner - --open Classical -+/-! -+# Fixed points in the unit cube - --/- --shows the fixed-point theorem for the unit cube --by applying the cubical sperner's lemma -+Reduced labels encode coordinatewise displacement of a continuous cube map. -+Cubical Sperner simplices on finer grids yield approximate fixed points, and -+compactness of the cube supplies a genuine fixed point. - -/ - - -+open Classical -+ - variable {n : ℕ} - - def unit_cube := { v : Fin n → ℝ | 0 ≤ v ∧ v ≤ 1 } -@@ -131,7 +131,7 @@ lemma reduced_label_props_3 (f : @unit_cube n → @unit_cube n) (x : @unit_cube - noncomputable def discrete_map (p : ℕ ) (v : Fin n → Fin (p+1)) : @unit_cube n := - ⟨ fun i ↦ ((v i).1 : ℝ ) / p , by { - unfold unit_cube -- simp only [Set.mem_setOf_eq] -+ simp only [Set.mem_ofPred_eq] - rw [Pi.le_def, Pi.le_def, ←forall_and] - intro i - simp only [Pi.zero_apply, Pi.one_apply] -@@ -228,7 +228,6 @@ lemma nearby_points (f : @unit_cube n → @unit_cube n) (p0:ℕ): - exact ⟨h5 i0 ik k, h5 ik i0 k⟩ - } - -- - theorem fixed_point_unit_cube (f : C(@unit_cube n, @unit_cube n)) : ∃ x, f x = x := by { - obtain ⟨x0s, hx0⟩ := axiomOfChoice (nearby_points f) - have hc1 : ∃ xx : @unit_cube n, ∃ (φ:ℕ → ℕ ), StrictMono φ ∧ -@@ -281,7 +280,6 @@ theorem fixed_point_unit_cube (f : C(@unit_cube n, @unit_cube n)) : ∃ x, f x = - apply le_antisymm (h4 k) (h3 k) - } - --/-- The cubical fixed-point theorem stated with mathlib's `Function.IsFixedPt` vocabulary. -/ - theorem fixed_point_unit_cube_isFixedPt (f : C(@unit_cube n, @unit_cube n)) : - ∃ x, Function.IsFixedPt f x := by -- simpa [Function.IsFixedPt] using fixed_point_unit_cube f -+ simpa [Function.IsFixedPt] using! fixed_point_unit_cube f -diff --git a/FixedPointTheorems/brouwer.lean b/FixedPointTheorems/brouwer.lean -index 7384d5b..23eaf4b 100644 ---- a/FixedPointTheorems/brouwer.lean -+++ b/FixedPointTheorems/brouwer.lean -@@ -1,16 +1,13 @@ -- -- -+import Mathlib - import FixedPointTheorems.apply_cubical_sperner - import FixedPointTheorems.convex_homeos --import Mathlib.Dynamics.FixedPoints.Basic -- -- - --/- Brouwer fixed-point theorem: --Every continuous function mapping a nonempty compact convex set to itself has a fixed point --(the set should be a subset of a finite dimensional vector space). -+/-! -+# Brouwer's fixed-point theorem - --https://en.wikipedia.org/wiki/Brouwer_fixed-point_theorem -+The unit-cube fixed-point theorem is transported along a homeomorphism of a -+nonempty compact convex set. The resulting theorem is also expressed using -+`Function.IsFixedPt` and the set of fixed points. - -/ - - -@@ -27,15 +24,13 @@ theorem brouwer_fixed_point {V : Type*} - rwa [e.symm_apply_apply] at h1 - } - --/-- Brouwer's fixed-point theorem stated with mathlib's `Function.IsFixedPt` vocabulary. -/ - theorem brouwer_fixed_point_isFixedPt {V : Type*} - [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] - (s : Set V) (hcvx : Convex ℝ s) (hcmpct : IsCompact s) (hne : Set.Nonempty s) - (f : C(s, s)) : - ∃ x, Function.IsFixedPt f x := by -- simpa [Function.IsFixedPt] using brouwer_fixed_point s hcvx hcmpct hne f -+ simpa [Function.IsFixedPt] using! brouwer_fixed_point s hcvx hcmpct hne f - --/-- The fixed-point set of a continuous self-map on a Brouwer domain is nonempty. -/ - theorem brouwer_fixedPoints_nonempty {V : Type*} - [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] - (s : Set V) (hcvx : Convex ℝ s) (hcmpct : IsCompact s) (hne : Set.Nonempty s) -diff --git a/FixedPointTheorems/convex_homeos.lean b/FixedPointTheorems/convex_homeos.lean -index 944544a..947627c 100644 ---- a/FixedPointTheorems/convex_homeos.lean -+++ b/FixedPointTheorems/convex_homeos.lean -@@ -1,10 +1,11 @@ -+import Mathlib - --import Mathlib.Analysis.Convex.Intrinsic --import Mathlib.Analysis.Convex.GaugeRescale -+/-! -+# Homeomorphisms of compact convex sets - -- --/- --some helper lemmas involving homeomorphisms. -+Compact convex sets are reduced to unit balls in their affine spans and then to -+finite-dimensional cubes. These homeomorphisms transfer the cubical fixed-point -+theorem to arbitrary nonempty compact convex domains. - -/ - - -@@ -24,7 +25,6 @@ lemma homeo_unit_ball {V : Type*} - exact Nonempty.intro e2 - } - -- - theorem homeo_of_finrank_eq {V W : Type*} - [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] - [NormedAddCommGroup W] [NormedSpace ℝ W] [FiniteDimensional ℝ W] -@@ -58,7 +58,6 @@ theorem homeo_of_finrank_eq {V W : Type*} - exact e2.symm.trans e1 - } - -- - lemma unit_cube_homeo_unit_ball {n} - : Nonempty (Set.Icc (0 : Fin n → ℝ) 1 ≃ₜ Metric.closedBall (0 : Fin n → ℝ) 1 ) := by - apply homeo_unit_ball _ (convex_Icc 0 1) isCompact_Icc -@@ -72,7 +71,7 @@ lemma homeo_unit_cube_of_convex_compact {V : Type*} - [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] - (s: Set V) (hcvx : Convex ℝ s) (hcmpct : IsCompact s) (hne : s.Nonempty) - : ∃ k, Nonempty (s ≃ₜ Set.Icc (0 : Fin k → ℝ) 1) := by { -- haveI := hne.coe_sort -+ have := hne.coe_sort - let W := affineSpan ℝ s - obtain ⟨ps, hps⟩ := hne - let pss : W := ⟨ps, mem_affineSpan ℝ hps⟩ -diff --git a/FixedPointTheorems/cubical_sperner.lean b/FixedPointTheorems/cubical_sperner.lean -index 0380c46..9bc9535 100644 ---- a/FixedPointTheorems/cubical_sperner.lean -+++ b/FixedPointTheorems/cubical_sperner.lean -@@ -1,19 +1,25 @@ -- -+import Mathlib - import FixedPointTheorems.cubical_sperner_prep - -+/-! -+# The cubical Sperner lemma - --open Classical -+Boundary incidence counts give an odd number of completely labelled simplices. -+The induction restricts a labelled cube to its boundary face; the resulting -+existence theorem supplies the simplices used in the fixed-point argument. -+-/ - - -+open Classical - - section completeness - - lemma complete_simplex_iff {SC} m I(hs : simplex SC m I) : -- complete_simplex SC m I ↔ ∀ c, c≤m → ∃ i, SC.RL (I i) = c := by { -+ complete_simplex SC m I ↔ ∀ c, c ≤ m → ∃ i, SC.RL (I i) = c := by { - apply Iff.intro - { - intro h1 c hc -- rwa [← Set.mem_range, h1.2, Set.mem_setOf_eq] -+ rwa [← Set.mem_range, h1.2, Set.mem_ofPred_eq] - } - { - intro c1 -@@ -33,7 +39,7 @@ lemma complete_simplex_iff {SC} m I(hs : simplex SC m I) : - Set.mem_range] at h1 - obtain ⟨ i, hi⟩ := h1 - use i -- simp only [Set.coe_toFinset, Set.mem_setOf_eq] -+ simp only [Set.coe_toFinset, Set.mem_ofPred_eq] - apply And.intro (Fin.is_le i) - unfold f1 - rw [← hi] -@@ -41,7 +47,6 @@ lemma complete_simplex_iff {SC} m I(hs : simplex SC m I) : - } - } - -- - lemma rl_inj_of_complete {SC} m I (hcs : complete_simplex SC m I): - ∀ i1 i2, SC.RL (I i1) = SC.RL (I i2) → i1 = i2 := by { - let f1 : Fin (m+1) → Fin (m+1) := fun j ↦ Fin.ofNat _ (SC.RL (I j)) -@@ -63,7 +68,6 @@ lemma rl_inj_of_complete {SC} m I (hcs : complete_simplex SC m I): - exact Fin.cast_val_eq_self c - } - -- - lemma char_complete_face {SC n1 hn1} I J (hs : simplex SC SC.n J) : - complete_simplex SC n1 I ∧ is_face SC I J - ↔ ∃ i, I = @delete_vertex SC n1 hn1 i J -@@ -107,12 +111,11 @@ lemma char_complete_face {SC n1 hn1} I J (hs : simplex SC SC.n J) : - } - } - -- - lemma complete_child_uniq {SC n1} {hn1 : n1 + 1 = SC.n} J (hcs : complete_simplex SC SC.n J) : - ∃! (I : Fin (n1+1) → SC.G), complete_simplex SC n1 I ∧ is_face SC I J := by { - have h4 : ∃ i, SC.RL (J i) = SC.n := by { - rw [← Set.mem_range, hcs.2] -- simp only [Set.mem_setOf_eq, le_refl] -+ simp only [Set.mem_ofPred_eq, le_refl] - } - obtain ⟨ i, hi⟩ := h4 - let I := @delete_vertex SC n1 hn1 i J -@@ -168,7 +171,6 @@ lemma complete_child_uniq {SC n1} {hn1 : n1 + 1 = SC.n} J (hcs : complete_simple - exact (Eq.symm hi) - } - -- - lemma incomplete_childs {SC n1} {hn1 : n1 + 1 = SC.n} J (hs : simplex SC SC.n J) - (hnc : ¬ complete_simplex SC SC.n J): - Even (Finset.card { I : Fin (n1 + 1) → SC.G | complete_simplex SC n1 I ∧ is_face SC I J}) := by { -@@ -282,7 +284,6 @@ lemma incomplete_childs {SC n1} {hn1 : n1 + 1 = SC.n} J (hs : simplex SC SC.n J) - } - } - -- - lemma complete_boundary_face_last {SC n1} {hn1 : n1 + 1 = SC.n} (I : Fin (n1 + 1) → SC.G) - (hcbf : complete_boundary_face SC I) : - ∀ i, ∀ j, j.1 + 1 = SC.n → (I i j).1 = SC.p := by { -@@ -293,7 +294,7 @@ lemma complete_boundary_face_last {SC n1} {hn1 : n1 + 1 = SC.n} (I : Fin (n1 + 1 - have h4 : ∀ n2, n2 ≤ n1 → ∃ i, SC.RL (I i) = n2 := by { - intro n2 hn2 - rw [← Set.mem_range, hcbf.2.2] -- simp only [Set.mem_setOf_eq, hn2] -+ simp only [Set.mem_ofPred_eq, hn2] - } - have h6 (j2 : Fin SC.n) : j2.1 ≤ n1 := by omega - cases h3 -@@ -328,8 +329,6 @@ lemma complete_boundary_face_last {SC n1} {hn1 : n1 + 1 = SC.n} (I : Fin (n1 + 1 - - end completeness - -- -- - section handshake - - variable {A B : Type*} -@@ -385,7 +384,7 @@ lemma handshake_1 (r : A → B → Prop) - { - intro p2 - have p3 := h3 a (h6 a p1) -- simp only [Set.mem_setOf_eq] at p3 -+ simp only [Set.mem_ofPred_eq] at p3 - cases p3 - rename_i p4 - exact p4 -@@ -415,7 +414,7 @@ lemma handshake_1 (r : A → B → Prop) - intro p2 - have p5 : Finset.Nonempty {a | r2 a b} := by { - have p3 : Odd (Finset.card { a | r2 a b}) := by { -- convert p2 -+ convert! p2 - } - apply Finset.card_ne_zero.mp - intro p4 -@@ -432,15 +431,13 @@ lemma handshake_1 (r : A → B → Prop) - revert p2 - have p4 := h2 b p3 p1 - simp only [imp_false, Nat.not_odd_iff_even] -- convert p4 -+ convert! p4 - } - } - } - - end handshake - -- -- - lemma odd_of_boundary_faces SC {n1} {hn1 : n1 + 1 = SC.n}: - Odd (Finset.card { I : Fin (n1 + 1) → SC.G | complete_boundary_face SC I}) - → Odd (Finset.card { I | complete_simplex SC SC.n I}) := by { -@@ -456,13 +453,11 @@ lemma odd_of_boundary_faces SC {n1} {hn1 : n1 + 1 = SC.n}: - exact fun _ _ h1 ↦ h1.2.1 - } - -- - section induction_step - - variable (SC : SpernerCube) - variable {n1 : ℕ} - -- - def child_map (v : Fin n1 → Fin (SC.p+1) ) : SC.G := fun i ↦ - match n1 with - | 0 => Fin.last SC.p -@@ -587,10 +582,8 @@ def child_cube {hn1 : n1 + 1 = SC.n}: SpernerCube where - exact hn1 - } - -- - end induction_step - -- - lemma induction_start (SC : SpernerCube) (h0 : 0 = SC.n) - : Odd (Finset.card { I | complete_simplex SC SC.n I}) := by { - use 0 -@@ -625,7 +618,7 @@ lemma induction_start (SC : SpernerCube) (h0 : 0 = SC.n) - { - ext i - simp only [← h0] -- simp only [Set.mem_range, nonpos_iff_eq_zero, Set.setOf_eq_eq_singleton, Set.mem_singleton_iff] -+ simp only [Set.mem_range, nonpos_iff_eq_zero, Set.ofPred_eq_eq_singleton, Set.mem_singleton_iff] - have h3 : ∀ c, SC.RL (a c) = 0 := by { - intro c - have h2 := (SC.rl_proper (a c)).1 -@@ -727,6 +720,9 @@ theorem strong_cubical_sperner (k: ℕ ) : ∀ (SC : SpernerCube), k = SC.n → - rw [← hk1] - rfl - } -+ change (I (Fin.ofNat (k + 1) i) j).val ≤ -+ (I (Fin.ofNat (k + 1) (i + 1)) j).val ∧ -+ (I (Fin.last k) j).val ≤ (I 0 j).val + 1 - rw [← h6, ← h6, ←h6, ← h6] - exact h4 (Fin.ofNat _ j.1) - } -@@ -770,13 +766,16 @@ theorem strong_cubical_sperner (k: ℕ ) : ∀ (SC : SpernerCube), k = SC.n → - } - exact Eq.congr_right rfl - } -+ change ∀ I, complete_boundary_face SC1 (f2 I) ↔ complete_simplex SC2 k I at hcomp -+ change ({I : Fin (k + 1) → SC2.G | complete_simplex SC2 k I} : Finset _).card = -+ ({I : Fin (k + 1) → SC1.G | complete_boundary_face SC1 I} : Finset _).card - apply Finset.card_nbij f2 - { - intro I hI -- have hI' : complete_simplex SC2 SC2.n I := -- (Finset.mem_filter.mp (Finset.mem_coe.mp hI)).2 -- exact Finset.mem_coe.mpr -- (Finset.mem_filter.mpr ⟨Finset.mem_univ _, (hcomp I).mpr hI'⟩) -+ have hI' : complete_simplex SC2 k I := by -+ simpa only [Finset.mem_coe, Finset.mem_filter, Finset.mem_univ, true_and] using hI -+ simpa only [Finset.mem_coe, Finset.mem_filter, Finset.mem_univ, true_and] -+ using (hcomp I).mpr hI' - } - { - intro I1 h41 I2 h42 h5 -@@ -787,7 +786,7 @@ theorem strong_cubical_sperner (k: ℕ ) : ∀ (SC : SpernerCube), k = SC.n → - { - simp only [Finset.coe_filter, Finset.mem_univ, true_and] - intro J -- simp only [Set.mem_setOf_eq, Set.mem_image] -+ simp only [Set.mem_ofPred_eq, Set.mem_image] - intro h3 - have h4 : ∃ I, f2 I = J := by { - suffices h6 : ∀ i, ∃ ii, f1 ii = J i by { -@@ -804,8 +803,8 @@ theorem strong_cubical_sperner (k: ℕ ) : ∀ (SC : SpernerCube), k = SC.n → - obtain ⟨I, h4⟩ := h4 - use I - simp only [h4, and_true] -- exact Finset.mem_coe.mpr (Finset.mem_filter.mpr -- ⟨Finset.mem_univ I, (hcomp I).mp (h4 ▸ h3)⟩) -+ simpa only [Finset.mem_coe, Finset.mem_filter, Finset.mem_univ, true_and] -+ using (hcomp I).mp (h4 ▸ h3) - } - } - -diff --git a/FixedPointTheorems/cubical_sperner_prep.lean b/FixedPointTheorems/cubical_sperner_prep.lean -index 243b3db..4edc1b7 100644 ---- a/FixedPointTheorems/cubical_sperner_prep.lean -+++ b/FixedPointTheorems/cubical_sperner_prep.lean -@@ -1,15 +1,15 @@ -+import Mathlib - --import Mathlib.Combinatorics.Enumerative.DoubleCounting --import Mathlib.Algebra.BigOperators.Ring.Nat --import Mathlib.Tactic -+/-! -+# Cubical simplices and boundary incidence - --open Classical -+The grid simplices of a labelled cube are classified by their boundary coordinates. -+Coordinate-change counts order their vertices and determine the number of parent simplices, -+providing the incidence identities used in the cubical Sperner argument. -+-/ - - --/- --The Cubical Sperner's Lemma. --We mostly follow Kuhn 1960 "Some Combinatorial Lemmas in Topology" ---/ -+open Classical - - structure SpernerCube where - n : ℕ -@@ -32,7 +32,6 @@ variable (SC : SpernerCube) - variable {n1 : ℕ} - variable {hn1 : n1 + 1 = SC.n} - -- - def simplex (m:ℕ ) (I : Fin (m+1)→ SC.G) := Function.Injective I - ∧ ∀ i < m, ∀ j : Fin SC.n, (I (Fin.ofNat _ i) j).1 ≤ (I (Fin.ofNat _ (i+1)) j).1 - ∧ (I (Fin.last m) j).1 ≤ (I 0 j).1 + 1 -@@ -56,7 +55,6 @@ def case_C (I : Fin (n1 +1) → SC.G) := - - def case_D (I : Fin (n1 +1) → SC.G) := ∀ j, ∀ q, ∃ k,I k j ≠ q - -- - lemma one_of_ABCD (I : Fin (n1 +1) → SC.G) : - case_A SC I ∨ case_B SC I ∨ case_C SC I ∨ case_D SC I := by { - by_cases h1 : case_D SC I -@@ -83,10 +81,8 @@ lemma one_of_ABCD (I : Fin (n1 +1) → SC.G) : - use j, q - } - -- - section simplex_properties - -- - lemma monotone_1_of_simplex {m:ℕ } (I : Fin (m+1)→ SC.G) (hs : simplex SC m I) (i1 i2 : Fin (m+1)) - (h1 : i1 ≤ i2) : ∀ j, I i1 j ≤ I i2 j := by { - intro j -@@ -98,7 +94,7 @@ lemma monotone_1_of_simplex {m:ℕ } (I : Fin (m+1)→ SC.G) (hs : simplex SC m - intro i1 - have h3 := (hs.2 i1.1 i1.2 j).1 - simp only [Fin.val_fin_le] at h3 -- convert h3 <;> ext <;> simp [Fin.ofNat_eq_cast, Nat.mod_eq_of_lt] -+ convert! h3 <;> ext <;> simp [Fin.ofNat_eq_cast, Nat.mod_eq_of_lt] - } - - lemma monotone_2_of_simplex {m:ℕ } (I : Fin (m+1)→ SC.G) (hs : simplex SC m I) (i1 i2 : Fin (m+1)) : -@@ -141,7 +137,6 @@ lemma le_add_one_of_simplex {m: ℕ} I (hs : simplex SC m I) (i1 i2 : Fin (m+1)) - - end simplex_properties - -- - lemma p_ne_zero_of_cube {hn1 : n1 + 1 = SC.n}: Fin.last SC.p ≠ 0 := by { - simp only [ne_eq, Fin.last_eq_zero_iff] - intro h1 -@@ -156,10 +151,8 @@ lemma p_ne_zero_of_cube {hn1 : n1 + 1 = SC.n}: Fin.last SC.p ≠ 0 := by { - exact h2.1 h4 (h2.2 h4) - } - -- - section simplex_child - -- - def insert_index (j : Fin (SC.n+1)) (a: Fin (n1 +1 )) : Fin (SC.n+1) := - { val := if a.val < j.val then a.val else a.val+1, - isLt := by { -@@ -271,7 +264,6 @@ lemma insert_index_inj j : Function.Injective (@insert_index SC n1 hn1 j) := by - apply insert_index_strict_mono - } - -- - lemma delete_vertex_inj J {hs : simplex SC SC.n J} i1 i2 - (h1 : @delete_vertex SC n1 hn1 i1 J = @delete_vertex SC n1 hn1 i2 J ) : i1 = i2 := by { - by_contra h2 -@@ -441,7 +433,6 @@ lemma child_simplex_char (I : Fin (n1 +1) → SC.G) J {hs : simplex SC SC.n J} - - end simplex_child - -- - section cases_ABCD - - lemma insert_vertex I (v : SC.G) j : -@@ -702,7 +693,7 @@ lemma parent_simplex_case_D I (hs : simplex SC n1 I) J j i - } - by_cases h8 : i2 = j.1 - { -- convert h5.2 -+ convert! h5.2 - simp only [h8, Fin.cast_val_eq_self] - have h11 : j ≠ Fin.last SC.n := by { - suffices h12 : j.1 ≠ SC.n by exact Ne.symm (Fin.ne_of_val_ne (Ne.symm h12)) -@@ -717,7 +708,7 @@ lemma parent_simplex_case_D I (hs : simplex SC n1 I) J j i - { - rw [←h9] at h6 - simp only [Nat.add_right_cancel_iff] at h6 -- convert h5.1 -+ convert! h5.1 - rw [←h6] - simp only [Fin.cast_val_eq_self] - rw [h9] -@@ -786,8 +777,7 @@ lemma parent_simplex_case_D I (hs : simplex SC n1 I) J j i - } - } - -- --def coord_change_count (v1 v2 : SC.G) := Finset.card {i | v1 i ≠ v2 i} -+noncomputable def coord_change_count (v1 v2 : SC.G) := Finset.card {i | v1 i ≠ v2 i} - - lemma ccc_add {m} I (hs : simplex SC m I) (i1 i2 i3) (h1 : i1 ≤ i2 ∧ i2 ≤ i3) : - coord_change_count SC (I i1) (I i3) = -@@ -842,7 +832,7 @@ lemma ccc_pos {m} I (hs : simplex SC m I) i1 i2 (h1 : i1 ≠ i2) - apply h2 - } - --def ccc_fun {m} (I : Fin (m+1)→ SC.G) (i : Fin (m+1)) : Fin (SC.n + 1 ) -+noncomputable def ccc_fun {m} (I : Fin (m+1)→ SC.G) (i : Fin (m+1)) : Fin (SC.n + 1 ) - := ⟨ coord_change_count SC (I 0) (I i), by { - refine Nat.lt_succ_of_le ?_ - exact card_finset_fin_le {i_1 | I 0 i_1 ≠ I i i_1} -@@ -865,18 +855,15 @@ lemma ccc_fun_is_insert_index I (hs : simplex SC n1 I) : - apply ccc_fun_strict_mono SC I hs - } - -- -- - lemma ccc_fun_case_D_iff {m} I (hs : simplex SC m I) : - case_D SC I ↔ ccc_fun SC I (Fin.last m) = Fin.last SC.n := by { - have h1 : (ccc_fun SC I (Fin.last m) = Fin.last SC.n) ↔ ∀ k, I 0 k ≠ I (Fin.last m) k := by { -- unfold ccc_fun coord_change_count -- rw [Fin.mk.inj_iff] -- have h3 : SC.n = Fintype.card (Fin SC.n) := by {exact Eq.symm (Fintype.card_fin SC.n)} -- simp only [ne_eq, Fin.val_last] -- nth_rewrite 7 [h3] -- rw [Finset.card_eq_iff_eq_univ, Finset.eq_univ_iff_forall] -- simp only [Finset.mem_filter, Finset.mem_univ, true_and] -+ rw [Fin.ext_iff] -+ change Finset.card {k : Fin SC.n | I 0 k ≠ I (Fin.last m) k} = SC.n ↔ _ -+ have hcard := Finset.card_eq_iff_eq_univ -+ {k : Fin SC.n | I 0 k ≠ I (Fin.last m) k} -+ simpa only [Fintype.card_fin, Finset.eq_univ_iff_forall, -+ Finset.mem_filter, Finset.mem_univ, true_and] using hcard - } - apply Iff.trans _ h1.symm - unfold case_D -@@ -1068,7 +1055,6 @@ lemma same_delete_index_eq_iff J1 J2 j - exact congrFun h1 i1 - } - -- - lemma case_D_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h1 : case_D SC I ) - : Finset.card { J : Fin (SC.n + 1) → SC.G | is_face SC I J} = 2 := by { - obtain ⟨ j1, hj1 ⟩ := @ccc_fun_is_insert_index SC n1 hn1 I hs -@@ -1115,7 +1101,7 @@ lemma case_D_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h1 : c - have h4 : ∃ k1, ∃ k2, k1 ≠ k2 ∧ {k | I i1 k ≠ I (i1 +1) k} = {k1, k2} := by { - unfold coord_change_count at h3 - rw [Finset.card_eq_two] at h3 -- convert h3 -+ convert! h3 - simp only [ne_eq] - rw [←Finset.coe_eq_pair] - simp only [Finset.coe_filter, Finset.mem_univ, true_and] -@@ -1304,7 +1290,6 @@ lemma case_D_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h1 : c - } - } - -- - lemma unique_const_ABC {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) k1 q1 - (h1 : ∀ i, I i k1 = q1): ∀ k2, k1 ≠ k2 → I 0 k2 ≠ I (Fin.last n1) k2 := by { - intro k2 h3 h2 -@@ -1336,7 +1321,6 @@ lemma unique_const_ABC {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) k1 q1 - simp only [Nat.not_ofNat_le_one] at h7 - } - -- - lemma case_AC_ex_unique I (hs : simplex SC n1 I) k1 q - (hABC : ∀ i, I i k1 = q) (hAC : q ≠ Fin.last SC.p) - : ∃! J, I = @delete_vertex SC n1 hn1 (Fin.last SC.n) J ∧ is_face SC I J := by { -@@ -1422,7 +1406,6 @@ lemma case_B_not_last I (h1 : case_B SC I) J - exact lt_add_one SC.p - } - -- - lemma case_BC_ex_unique I (hs : simplex SC n1 I) k1 q - (hABC : ∀ i, I i k1 = q) (hBC : q ≠ 0) - : ∃! J, I = @delete_vertex SC n1 hn1 0 J ∧ is_face SC I J := by { -@@ -1503,8 +1486,6 @@ lemma case_A_not_zero I (h1 : case_A SC I) J - rfl - } - -- -- - lemma case_ABC_count_disj {hn1 : n1 + 1 = SC.n} I k1 q - (hABC : ∀ i, I i k1 = q) : Finset.card { J | is_face SC I J} - = Finset.card {J | I = @delete_vertex SC n1 hn1 0 J ∧ is_face SC I J} -@@ -1546,7 +1527,6 @@ lemma case_ABC_count_disj {hn1 : n1 + 1 = SC.n} I k1 q - rw [←h2.1,←h3.1] - } - -- - lemma case_C_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h1 : case_C SC I ) - : Finset.card { J : Fin (SC.n + 1) → SC.G | is_face SC I J} = 2 := by { - obtain ⟨k1,q, h1⟩ := h1 -@@ -1587,7 +1567,6 @@ lemma case_A_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h2 : c - - end cases_ABCD - ---- used in other file - lemma boundary_is_A_or_B {hn1 : n1 + 1 = SC.n} I (hbf : @is_boundary_face SC n1 I) - : case_A SC I ∨ case_B SC I := by { - have hs : simplex SC n1 I := by { -@@ -1607,16 +1586,13 @@ lemma boundary_is_A_or_B {hn1 : n1 + 1 = SC.n} I (hbf : @is_boundary_face SC n1 - simp only [OfNat.ofNat_ne_one] at hbf - } - ---- used in other file - lemma case_B_boundary {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) - (h1 : case_B SC I) : is_boundary_face SC I := - (Fintype.existsUnique_iff_card_one _).mpr (@case_B_parent_count SC n1 hn1 I hs h1) - -- ---- used in other file - lemma parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) : - Finset.card { J : Fin (SC.n + 1) → SC.G | is_face SC I J} ∈ {c | c = 1 ∨ c = 2} := by { -- simp only [Set.mem_setOf_eq] -+ simp only [Set.mem_ofPred_eq] - have h1 := one_of_ABCD SC I - rw [←or_assoc] at h1 - cases' h1 with h1 h1 -diff --git a/lakefile.toml b/lakefile.toml -index 936ece4..186ed66 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -10,8 +10,8 @@ autoImplicit = false - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "FixedPointTheorems" -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f49..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/FixedPointTheorems/apply_cubical_sperner.lean b/FixedPointTheorems/apply_cubical_sperner.lean +index ffbbbcd..5737a7c 100644 +--- a/FixedPointTheorems/apply_cubical_sperner.lean ++++ b/FixedPointTheorems/apply_cubical_sperner.lean +@@ -1,17 +1,17 @@ +- +- +-import Mathlib.Analysis.Convex.Intrinsic +-import Mathlib.Topology.Defs.Basic ++import Mathlib + import FixedPointTheorems.cubical_sperner + +-open Classical ++/-! ++# Fixed points in the unit cube + +-/- +-shows the fixed-point theorem for the unit cube +-by applying the cubical sperner's lemma ++Reduced labels encode coordinatewise displacement of a continuous cube map. ++Cubical Sperner simplices on finer grids yield approximate fixed points, and ++compactness of the cube supplies a genuine fixed point. + -/ + + ++open Classical ++ + variable {n : ℕ} + + def unit_cube := { v : Fin n → ℝ | 0 ≤ v ∧ v ≤ 1 } +@@ -131,7 +131,7 @@ lemma reduced_label_props_3 (f : @unit_cube n → @unit_cube n) (x : @unit_cube + noncomputable def discrete_map (p : ℕ ) (v : Fin n → Fin (p+1)) : @unit_cube n := + ⟨ fun i ↦ ((v i).1 : ℝ ) / p , by { + unfold unit_cube +- simp only [Set.mem_setOf_eq] ++ simp only [Set.mem_ofPred_eq] + rw [Pi.le_def, Pi.le_def, ←forall_and] + intro i + simp only [Pi.zero_apply, Pi.one_apply] +@@ -228,7 +228,6 @@ lemma nearby_points (f : @unit_cube n → @unit_cube n) (p0:ℕ): + exact ⟨h5 i0 ik k, h5 ik i0 k⟩ + } + +- + theorem fixed_point_unit_cube (f : C(@unit_cube n, @unit_cube n)) : ∃ x, f x = x := by { + obtain ⟨x0s, hx0⟩ := axiomOfChoice (nearby_points f) + have hc1 : ∃ xx : @unit_cube n, ∃ (φ:ℕ → ℕ ), StrictMono φ ∧ +@@ -281,7 +280,6 @@ theorem fixed_point_unit_cube (f : C(@unit_cube n, @unit_cube n)) : ∃ x, f x = + apply le_antisymm (h4 k) (h3 k) + } + +-/-- The cubical fixed-point theorem stated with mathlib's `Function.IsFixedPt` vocabulary. -/ + theorem fixed_point_unit_cube_isFixedPt (f : C(@unit_cube n, @unit_cube n)) : + ∃ x, Function.IsFixedPt f x := by +- simpa [Function.IsFixedPt] using fixed_point_unit_cube f ++ simpa [Function.IsFixedPt] using! fixed_point_unit_cube f +diff --git a/FixedPointTheorems/brouwer.lean b/FixedPointTheorems/brouwer.lean +index 7384d5b..23eaf4b 100644 +--- a/FixedPointTheorems/brouwer.lean ++++ b/FixedPointTheorems/brouwer.lean +@@ -1,16 +1,13 @@ +- +- ++import Mathlib + import FixedPointTheorems.apply_cubical_sperner + import FixedPointTheorems.convex_homeos +-import Mathlib.Dynamics.FixedPoints.Basic +- +- + +-/- Brouwer fixed-point theorem: +-Every continuous function mapping a nonempty compact convex set to itself has a fixed point +-(the set should be a subset of a finite dimensional vector space). ++/-! ++# Brouwer's fixed-point theorem + +-https://en.wikipedia.org/wiki/Brouwer_fixed-point_theorem ++The unit-cube fixed-point theorem is transported along a homeomorphism of a ++nonempty compact convex set. The resulting theorem is also expressed using ++`Function.IsFixedPt` and the set of fixed points. + -/ + + +@@ -27,15 +24,13 @@ theorem brouwer_fixed_point {V : Type*} + rwa [e.symm_apply_apply] at h1 + } + +-/-- Brouwer's fixed-point theorem stated with mathlib's `Function.IsFixedPt` vocabulary. -/ + theorem brouwer_fixed_point_isFixedPt {V : Type*} + [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] + (s : Set V) (hcvx : Convex ℝ s) (hcmpct : IsCompact s) (hne : Set.Nonempty s) + (f : C(s, s)) : + ∃ x, Function.IsFixedPt f x := by +- simpa [Function.IsFixedPt] using brouwer_fixed_point s hcvx hcmpct hne f ++ simpa [Function.IsFixedPt] using! brouwer_fixed_point s hcvx hcmpct hne f + +-/-- The fixed-point set of a continuous self-map on a Brouwer domain is nonempty. -/ + theorem brouwer_fixedPoints_nonempty {V : Type*} + [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] + (s : Set V) (hcvx : Convex ℝ s) (hcmpct : IsCompact s) (hne : Set.Nonempty s) +diff --git a/FixedPointTheorems/convex_homeos.lean b/FixedPointTheorems/convex_homeos.lean +index 944544a..947627c 100644 +--- a/FixedPointTheorems/convex_homeos.lean ++++ b/FixedPointTheorems/convex_homeos.lean +@@ -1,10 +1,11 @@ ++import Mathlib + +-import Mathlib.Analysis.Convex.Intrinsic +-import Mathlib.Analysis.Convex.GaugeRescale ++/-! ++# Homeomorphisms of compact convex sets + +- +-/- +-some helper lemmas involving homeomorphisms. ++Compact convex sets are reduced to unit balls in their affine spans and then to ++finite-dimensional cubes. These homeomorphisms transfer the cubical fixed-point ++theorem to arbitrary nonempty compact convex domains. + -/ + + +@@ -24,7 +25,6 @@ lemma homeo_unit_ball {V : Type*} + exact Nonempty.intro e2 + } + +- + theorem homeo_of_finrank_eq {V W : Type*} + [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] + [NormedAddCommGroup W] [NormedSpace ℝ W] [FiniteDimensional ℝ W] +@@ -58,7 +58,6 @@ theorem homeo_of_finrank_eq {V W : Type*} + exact e2.symm.trans e1 + } + +- + lemma unit_cube_homeo_unit_ball {n} + : Nonempty (Set.Icc (0 : Fin n → ℝ) 1 ≃ₜ Metric.closedBall (0 : Fin n → ℝ) 1 ) := by + apply homeo_unit_ball _ (convex_Icc 0 1) isCompact_Icc +@@ -72,7 +71,7 @@ lemma homeo_unit_cube_of_convex_compact {V : Type*} + [NormedAddCommGroup V] [NormedSpace ℝ V] [FiniteDimensional ℝ V] + (s: Set V) (hcvx : Convex ℝ s) (hcmpct : IsCompact s) (hne : s.Nonempty) + : ∃ k, Nonempty (s ≃ₜ Set.Icc (0 : Fin k → ℝ) 1) := by { +- haveI := hne.coe_sort ++ have := hne.coe_sort + let W := affineSpan ℝ s + obtain ⟨ps, hps⟩ := hne + let pss : W := ⟨ps, mem_affineSpan ℝ hps⟩ +diff --git a/FixedPointTheorems/cubical_sperner.lean b/FixedPointTheorems/cubical_sperner.lean +index 0380c46..9bc9535 100644 +--- a/FixedPointTheorems/cubical_sperner.lean ++++ b/FixedPointTheorems/cubical_sperner.lean +@@ -1,19 +1,25 @@ +- ++import Mathlib + import FixedPointTheorems.cubical_sperner_prep + ++/-! ++# The cubical Sperner lemma + +-open Classical ++Boundary incidence counts give an odd number of completely labelled simplices. ++The induction restricts a labelled cube to its boundary face; the resulting ++existence theorem supplies the simplices used in the fixed-point argument. ++-/ + + ++open Classical + + section completeness + + lemma complete_simplex_iff {SC} m I(hs : simplex SC m I) : +- complete_simplex SC m I ↔ ∀ c, c≤m → ∃ i, SC.RL (I i) = c := by { ++ complete_simplex SC m I ↔ ∀ c, c ≤ m → ∃ i, SC.RL (I i) = c := by { + apply Iff.intro + { + intro h1 c hc +- rwa [← Set.mem_range, h1.2, Set.mem_setOf_eq] ++ rwa [← Set.mem_range, h1.2, Set.mem_ofPred_eq] + } + { + intro c1 +@@ -33,7 +39,7 @@ lemma complete_simplex_iff {SC} m I(hs : simplex SC m I) : + Set.mem_range] at h1 + obtain ⟨ i, hi⟩ := h1 + use i +- simp only [Set.coe_toFinset, Set.mem_setOf_eq] ++ simp only [Set.coe_toFinset, Set.mem_ofPred_eq] + apply And.intro (Fin.is_le i) + unfold f1 + rw [← hi] +@@ -41,7 +47,6 @@ lemma complete_simplex_iff {SC} m I(hs : simplex SC m I) : + } + } + +- + lemma rl_inj_of_complete {SC} m I (hcs : complete_simplex SC m I): + ∀ i1 i2, SC.RL (I i1) = SC.RL (I i2) → i1 = i2 := by { + let f1 : Fin (m+1) → Fin (m+1) := fun j ↦ Fin.ofNat _ (SC.RL (I j)) +@@ -63,7 +68,6 @@ lemma rl_inj_of_complete {SC} m I (hcs : complete_simplex SC m I): + exact Fin.cast_val_eq_self c + } + +- + lemma char_complete_face {SC n1 hn1} I J (hs : simplex SC SC.n J) : + complete_simplex SC n1 I ∧ is_face SC I J + ↔ ∃ i, I = @delete_vertex SC n1 hn1 i J +@@ -107,12 +111,11 @@ lemma char_complete_face {SC n1 hn1} I J (hs : simplex SC SC.n J) : + } + } + +- + lemma complete_child_uniq {SC n1} {hn1 : n1 + 1 = SC.n} J (hcs : complete_simplex SC SC.n J) : + ∃! (I : Fin (n1+1) → SC.G), complete_simplex SC n1 I ∧ is_face SC I J := by { + have h4 : ∃ i, SC.RL (J i) = SC.n := by { + rw [← Set.mem_range, hcs.2] +- simp only [Set.mem_setOf_eq, le_refl] ++ simp only [Set.mem_ofPred_eq, le_refl] + } + obtain ⟨ i, hi⟩ := h4 + let I := @delete_vertex SC n1 hn1 i J +@@ -168,7 +171,6 @@ lemma complete_child_uniq {SC n1} {hn1 : n1 + 1 = SC.n} J (hcs : complete_simple + exact (Eq.symm hi) + } + +- + lemma incomplete_childs {SC n1} {hn1 : n1 + 1 = SC.n} J (hs : simplex SC SC.n J) + (hnc : ¬ complete_simplex SC SC.n J): + Even (Finset.card { I : Fin (n1 + 1) → SC.G | complete_simplex SC n1 I ∧ is_face SC I J}) := by { +@@ -282,7 +284,6 @@ lemma incomplete_childs {SC n1} {hn1 : n1 + 1 = SC.n} J (hs : simplex SC SC.n J) + } + } + +- + lemma complete_boundary_face_last {SC n1} {hn1 : n1 + 1 = SC.n} (I : Fin (n1 + 1) → SC.G) + (hcbf : complete_boundary_face SC I) : + ∀ i, ∀ j, j.1 + 1 = SC.n → (I i j).1 = SC.p := by { +@@ -293,7 +294,7 @@ lemma complete_boundary_face_last {SC n1} {hn1 : n1 + 1 = SC.n} (I : Fin (n1 + 1 + have h4 : ∀ n2, n2 ≤ n1 → ∃ i, SC.RL (I i) = n2 := by { + intro n2 hn2 + rw [← Set.mem_range, hcbf.2.2] +- simp only [Set.mem_setOf_eq, hn2] ++ simp only [Set.mem_ofPred_eq, hn2] + } + have h6 (j2 : Fin SC.n) : j2.1 ≤ n1 := by omega + cases h3 +@@ -328,8 +329,6 @@ lemma complete_boundary_face_last {SC n1} {hn1 : n1 + 1 = SC.n} (I : Fin (n1 + 1 + + end completeness + +- +- + section handshake + + variable {A B : Type*} +@@ -385,7 +384,7 @@ lemma handshake_1 (r : A → B → Prop) + { + intro p2 + have p3 := h3 a (h6 a p1) +- simp only [Set.mem_setOf_eq] at p3 ++ simp only [Set.mem_ofPred_eq] at p3 + cases p3 + rename_i p4 + exact p4 +@@ -415,7 +414,7 @@ lemma handshake_1 (r : A → B → Prop) + intro p2 + have p5 : Finset.Nonempty {a | r2 a b} := by { + have p3 : Odd (Finset.card { a | r2 a b}) := by { +- convert p2 ++ convert! p2 + } + apply Finset.card_ne_zero.mp + intro p4 +@@ -432,15 +431,13 @@ lemma handshake_1 (r : A → B → Prop) + revert p2 + have p4 := h2 b p3 p1 + simp only [imp_false, Nat.not_odd_iff_even] +- convert p4 ++ convert! p4 + } + } + } + + end handshake + +- +- + lemma odd_of_boundary_faces SC {n1} {hn1 : n1 + 1 = SC.n}: + Odd (Finset.card { I : Fin (n1 + 1) → SC.G | complete_boundary_face SC I}) + → Odd (Finset.card { I | complete_simplex SC SC.n I}) := by { +@@ -456,13 +453,11 @@ lemma odd_of_boundary_faces SC {n1} {hn1 : n1 + 1 = SC.n}: + exact fun _ _ h1 ↦ h1.2.1 + } + +- + section induction_step + + variable (SC : SpernerCube) + variable {n1 : ℕ} + +- + def child_map (v : Fin n1 → Fin (SC.p+1) ) : SC.G := fun i ↦ + match n1 with + | 0 => Fin.last SC.p +@@ -587,10 +582,8 @@ def child_cube {hn1 : n1 + 1 = SC.n}: SpernerCube where + exact hn1 + } + +- + end induction_step + +- + lemma induction_start (SC : SpernerCube) (h0 : 0 = SC.n) + : Odd (Finset.card { I | complete_simplex SC SC.n I}) := by { + use 0 +@@ -625,7 +618,7 @@ lemma induction_start (SC : SpernerCube) (h0 : 0 = SC.n) + { + ext i + simp only [← h0] +- simp only [Set.mem_range, nonpos_iff_eq_zero, Set.setOf_eq_eq_singleton, Set.mem_singleton_iff] ++ simp only [Set.mem_range, nonpos_iff_eq_zero, Set.ofPred_eq_eq_singleton, Set.mem_singleton_iff] + have h3 : ∀ c, SC.RL (a c) = 0 := by { + intro c + have h2 := (SC.rl_proper (a c)).1 +@@ -727,6 +720,9 @@ theorem strong_cubical_sperner (k: ℕ ) : ∀ (SC : SpernerCube), k = SC.n → + rw [← hk1] + rfl + } ++ change (I (Fin.ofNat (k + 1) i) j).val ≤ ++ (I (Fin.ofNat (k + 1) (i + 1)) j).val ∧ ++ (I (Fin.last k) j).val ≤ (I 0 j).val + 1 + rw [← h6, ← h6, ←h6, ← h6] + exact h4 (Fin.ofNat _ j.1) + } +@@ -770,13 +766,16 @@ theorem strong_cubical_sperner (k: ℕ ) : ∀ (SC : SpernerCube), k = SC.n → + } + exact Eq.congr_right rfl + } ++ change ∀ I, complete_boundary_face SC1 (f2 I) ↔ complete_simplex SC2 k I at hcomp ++ change ({I : Fin (k + 1) → SC2.G | complete_simplex SC2 k I} : Finset _).card = ++ ({I : Fin (k + 1) → SC1.G | complete_boundary_face SC1 I} : Finset _).card + apply Finset.card_nbij f2 + { + intro I hI +- have hI' : complete_simplex SC2 SC2.n I := +- (Finset.mem_filter.mp (Finset.mem_coe.mp hI)).2 +- exact Finset.mem_coe.mpr +- (Finset.mem_filter.mpr ⟨Finset.mem_univ _, (hcomp I).mpr hI'⟩) ++ have hI' : complete_simplex SC2 k I := by ++ simpa only [Finset.mem_coe, Finset.mem_filter, Finset.mem_univ, true_and] using hI ++ simpa only [Finset.mem_coe, Finset.mem_filter, Finset.mem_univ, true_and] ++ using (hcomp I).mpr hI' + } + { + intro I1 h41 I2 h42 h5 +@@ -787,7 +786,7 @@ theorem strong_cubical_sperner (k: ℕ ) : ∀ (SC : SpernerCube), k = SC.n → + { + simp only [Finset.coe_filter, Finset.mem_univ, true_and] + intro J +- simp only [Set.mem_setOf_eq, Set.mem_image] ++ simp only [Set.mem_ofPred_eq, Set.mem_image] + intro h3 + have h4 : ∃ I, f2 I = J := by { + suffices h6 : ∀ i, ∃ ii, f1 ii = J i by { +@@ -804,8 +803,8 @@ theorem strong_cubical_sperner (k: ℕ ) : ∀ (SC : SpernerCube), k = SC.n → + obtain ⟨I, h4⟩ := h4 + use I + simp only [h4, and_true] +- exact Finset.mem_coe.mpr (Finset.mem_filter.mpr +- ⟨Finset.mem_univ I, (hcomp I).mp (h4 ▸ h3)⟩) ++ simpa only [Finset.mem_coe, Finset.mem_filter, Finset.mem_univ, true_and] ++ using (hcomp I).mp (h4 ▸ h3) + } + } + +diff --git a/FixedPointTheorems/cubical_sperner_prep.lean b/FixedPointTheorems/cubical_sperner_prep.lean +index 243b3db..4edc1b7 100644 +--- a/FixedPointTheorems/cubical_sperner_prep.lean ++++ b/FixedPointTheorems/cubical_sperner_prep.lean +@@ -1,15 +1,15 @@ ++import Mathlib + +-import Mathlib.Combinatorics.Enumerative.DoubleCounting +-import Mathlib.Algebra.BigOperators.Ring.Nat +-import Mathlib.Tactic ++/-! ++# Cubical simplices and boundary incidence + +-open Classical ++The grid simplices of a labelled cube are classified by their boundary coordinates. ++Coordinate-change counts order their vertices and determine the number of parent simplices, ++providing the incidence identities used in the cubical Sperner argument. ++-/ + + +-/- +-The Cubical Sperner's Lemma. +-We mostly follow Kuhn 1960 "Some Combinatorial Lemmas in Topology" +--/ ++open Classical + + structure SpernerCube where + n : ℕ +@@ -32,7 +32,6 @@ variable (SC : SpernerCube) + variable {n1 : ℕ} + variable {hn1 : n1 + 1 = SC.n} + +- + def simplex (m:ℕ ) (I : Fin (m+1)→ SC.G) := Function.Injective I + ∧ ∀ i < m, ∀ j : Fin SC.n, (I (Fin.ofNat _ i) j).1 ≤ (I (Fin.ofNat _ (i+1)) j).1 + ∧ (I (Fin.last m) j).1 ≤ (I 0 j).1 + 1 +@@ -56,7 +55,6 @@ def case_C (I : Fin (n1 +1) → SC.G) := + + def case_D (I : Fin (n1 +1) → SC.G) := ∀ j, ∀ q, ∃ k,I k j ≠ q + +- + lemma one_of_ABCD (I : Fin (n1 +1) → SC.G) : + case_A SC I ∨ case_B SC I ∨ case_C SC I ∨ case_D SC I := by { + by_cases h1 : case_D SC I +@@ -83,10 +81,8 @@ lemma one_of_ABCD (I : Fin (n1 +1) → SC.G) : + use j, q + } + +- + section simplex_properties + +- + lemma monotone_1_of_simplex {m:ℕ } (I : Fin (m+1)→ SC.G) (hs : simplex SC m I) (i1 i2 : Fin (m+1)) + (h1 : i1 ≤ i2) : ∀ j, I i1 j ≤ I i2 j := by { + intro j +@@ -98,7 +94,7 @@ lemma monotone_1_of_simplex {m:ℕ } (I : Fin (m+1)→ SC.G) (hs : simplex SC m + intro i1 + have h3 := (hs.2 i1.1 i1.2 j).1 + simp only [Fin.val_fin_le] at h3 +- convert h3 <;> ext <;> simp [Fin.ofNat_eq_cast, Nat.mod_eq_of_lt] ++ convert! h3 <;> ext <;> simp [Fin.ofNat_eq_cast, Nat.mod_eq_of_lt] + } + + lemma monotone_2_of_simplex {m:ℕ } (I : Fin (m+1)→ SC.G) (hs : simplex SC m I) (i1 i2 : Fin (m+1)) : +@@ -141,7 +137,6 @@ lemma le_add_one_of_simplex {m: ℕ} I (hs : simplex SC m I) (i1 i2 : Fin (m+1)) + + end simplex_properties + +- + lemma p_ne_zero_of_cube {hn1 : n1 + 1 = SC.n}: Fin.last SC.p ≠ 0 := by { + simp only [ne_eq, Fin.last_eq_zero_iff] + intro h1 +@@ -156,10 +151,8 @@ lemma p_ne_zero_of_cube {hn1 : n1 + 1 = SC.n}: Fin.last SC.p ≠ 0 := by { + exact h2.1 h4 (h2.2 h4) + } + +- + section simplex_child + +- + def insert_index (j : Fin (SC.n+1)) (a: Fin (n1 +1 )) : Fin (SC.n+1) := + { val := if a.val < j.val then a.val else a.val+1, + isLt := by { +@@ -271,7 +264,6 @@ lemma insert_index_inj j : Function.Injective (@insert_index SC n1 hn1 j) := by + apply insert_index_strict_mono + } + +- + lemma delete_vertex_inj J {hs : simplex SC SC.n J} i1 i2 + (h1 : @delete_vertex SC n1 hn1 i1 J = @delete_vertex SC n1 hn1 i2 J ) : i1 = i2 := by { + by_contra h2 +@@ -441,7 +433,6 @@ lemma child_simplex_char (I : Fin (n1 +1) → SC.G) J {hs : simplex SC SC.n J} + + end simplex_child + +- + section cases_ABCD + + lemma insert_vertex I (v : SC.G) j : +@@ -702,7 +693,7 @@ lemma parent_simplex_case_D I (hs : simplex SC n1 I) J j i + } + by_cases h8 : i2 = j.1 + { +- convert h5.2 ++ convert! h5.2 + simp only [h8, Fin.cast_val_eq_self] + have h11 : j ≠ Fin.last SC.n := by { + suffices h12 : j.1 ≠ SC.n by exact Ne.symm (Fin.ne_of_val_ne (Ne.symm h12)) +@@ -717,7 +708,7 @@ lemma parent_simplex_case_D I (hs : simplex SC n1 I) J j i + { + rw [←h9] at h6 + simp only [Nat.add_right_cancel_iff] at h6 +- convert h5.1 ++ convert! h5.1 + rw [←h6] + simp only [Fin.cast_val_eq_self] + rw [h9] +@@ -786,8 +777,7 @@ lemma parent_simplex_case_D I (hs : simplex SC n1 I) J j i + } + } + +- +-def coord_change_count (v1 v2 : SC.G) := Finset.card {i | v1 i ≠ v2 i} ++noncomputable def coord_change_count (v1 v2 : SC.G) := Finset.card {i | v1 i ≠ v2 i} + + lemma ccc_add {m} I (hs : simplex SC m I) (i1 i2 i3) (h1 : i1 ≤ i2 ∧ i2 ≤ i3) : + coord_change_count SC (I i1) (I i3) = +@@ -842,7 +832,7 @@ lemma ccc_pos {m} I (hs : simplex SC m I) i1 i2 (h1 : i1 ≠ i2) + apply h2 + } + +-def ccc_fun {m} (I : Fin (m+1)→ SC.G) (i : Fin (m+1)) : Fin (SC.n + 1 ) ++noncomputable def ccc_fun {m} (I : Fin (m+1)→ SC.G) (i : Fin (m+1)) : Fin (SC.n + 1 ) + := ⟨ coord_change_count SC (I 0) (I i), by { + refine Nat.lt_succ_of_le ?_ + exact card_finset_fin_le {i_1 | I 0 i_1 ≠ I i i_1} +@@ -865,18 +855,15 @@ lemma ccc_fun_is_insert_index I (hs : simplex SC n1 I) : + apply ccc_fun_strict_mono SC I hs + } + +- +- + lemma ccc_fun_case_D_iff {m} I (hs : simplex SC m I) : + case_D SC I ↔ ccc_fun SC I (Fin.last m) = Fin.last SC.n := by { + have h1 : (ccc_fun SC I (Fin.last m) = Fin.last SC.n) ↔ ∀ k, I 0 k ≠ I (Fin.last m) k := by { +- unfold ccc_fun coord_change_count +- rw [Fin.mk.inj_iff] +- have h3 : SC.n = Fintype.card (Fin SC.n) := by {exact Eq.symm (Fintype.card_fin SC.n)} +- simp only [ne_eq, Fin.val_last] +- nth_rewrite 7 [h3] +- rw [Finset.card_eq_iff_eq_univ, Finset.eq_univ_iff_forall] +- simp only [Finset.mem_filter, Finset.mem_univ, true_and] ++ rw [Fin.ext_iff] ++ change Finset.card {k : Fin SC.n | I 0 k ≠ I (Fin.last m) k} = SC.n ↔ _ ++ have hcard := Finset.card_eq_iff_eq_univ ++ {k : Fin SC.n | I 0 k ≠ I (Fin.last m) k} ++ simpa only [Fintype.card_fin, Finset.eq_univ_iff_forall, ++ Finset.mem_filter, Finset.mem_univ, true_and] using hcard + } + apply Iff.trans _ h1.symm + unfold case_D +@@ -1068,7 +1055,6 @@ lemma same_delete_index_eq_iff J1 J2 j + exact congrFun h1 i1 + } + +- + lemma case_D_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h1 : case_D SC I ) + : Finset.card { J : Fin (SC.n + 1) → SC.G | is_face SC I J} = 2 := by { + obtain ⟨ j1, hj1 ⟩ := @ccc_fun_is_insert_index SC n1 hn1 I hs +@@ -1115,7 +1101,7 @@ lemma case_D_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h1 : c + have h4 : ∃ k1, ∃ k2, k1 ≠ k2 ∧ {k | I i1 k ≠ I (i1 +1) k} = {k1, k2} := by { + unfold coord_change_count at h3 + rw [Finset.card_eq_two] at h3 +- convert h3 ++ convert! h3 + simp only [ne_eq] + rw [←Finset.coe_eq_pair] + simp only [Finset.coe_filter, Finset.mem_univ, true_and] +@@ -1304,7 +1290,6 @@ lemma case_D_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h1 : c + } + } + +- + lemma unique_const_ABC {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) k1 q1 + (h1 : ∀ i, I i k1 = q1): ∀ k2, k1 ≠ k2 → I 0 k2 ≠ I (Fin.last n1) k2 := by { + intro k2 h3 h2 +@@ -1336,7 +1321,6 @@ lemma unique_const_ABC {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) k1 q1 + simp only [Nat.not_ofNat_le_one] at h7 + } + +- + lemma case_AC_ex_unique I (hs : simplex SC n1 I) k1 q + (hABC : ∀ i, I i k1 = q) (hAC : q ≠ Fin.last SC.p) + : ∃! J, I = @delete_vertex SC n1 hn1 (Fin.last SC.n) J ∧ is_face SC I J := by { +@@ -1422,7 +1406,6 @@ lemma case_B_not_last I (h1 : case_B SC I) J + exact lt_add_one SC.p + } + +- + lemma case_BC_ex_unique I (hs : simplex SC n1 I) k1 q + (hABC : ∀ i, I i k1 = q) (hBC : q ≠ 0) + : ∃! J, I = @delete_vertex SC n1 hn1 0 J ∧ is_face SC I J := by { +@@ -1503,8 +1486,6 @@ lemma case_A_not_zero I (h1 : case_A SC I) J + rfl + } + +- +- + lemma case_ABC_count_disj {hn1 : n1 + 1 = SC.n} I k1 q + (hABC : ∀ i, I i k1 = q) : Finset.card { J | is_face SC I J} + = Finset.card {J | I = @delete_vertex SC n1 hn1 0 J ∧ is_face SC I J} +@@ -1546,7 +1527,6 @@ lemma case_ABC_count_disj {hn1 : n1 + 1 = SC.n} I k1 q + rw [←h2.1,←h3.1] + } + +- + lemma case_C_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h1 : case_C SC I ) + : Finset.card { J : Fin (SC.n + 1) → SC.G | is_face SC I J} = 2 := by { + obtain ⟨k1,q, h1⟩ := h1 +@@ -1587,7 +1567,6 @@ lemma case_A_parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) (h2 : c + + end cases_ABCD + +--- used in other file + lemma boundary_is_A_or_B {hn1 : n1 + 1 = SC.n} I (hbf : @is_boundary_face SC n1 I) + : case_A SC I ∨ case_B SC I := by { + have hs : simplex SC n1 I := by { +@@ -1607,16 +1586,13 @@ lemma boundary_is_A_or_B {hn1 : n1 + 1 = SC.n} I (hbf : @is_boundary_face SC n1 + simp only [OfNat.ofNat_ne_one] at hbf + } + +--- used in other file + lemma case_B_boundary {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) + (h1 : case_B SC I) : is_boundary_face SC I := + (Fintype.existsUnique_iff_card_one _).mpr (@case_B_parent_count SC n1 hn1 I hs h1) + +- +--- used in other file + lemma parent_count {hn1 : n1 + 1 = SC.n} I (hs : simplex SC n1 I) : + Finset.card { J : Fin (SC.n + 1) → SC.G | is_face SC I J} ∈ {c | c = 1 ∨ c = 2} := by { +- simp only [Set.mem_setOf_eq] ++ simp only [Set.mem_ofPred_eq] + have h1 := one_of_ABCD SC I + rw [←or_assoc] at h1 + cases' h1 with h1 h1 +diff --git a/lakefile.toml b/lakefile.toml +index 936ece4..186ed66 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -10,8 +10,8 @@ autoImplicit = false + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "FixedPointTheorems" +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f49..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/formal-schemes-lean4341.patch b/lean/patches/formal-schemes-lean4341.patch index c8a6d0f69af2045dc7637ebd023219ff6d26a833..9c11806b5836668ba59e4f485a30c6c5270e79eb 100644 --- a/lean/patches/formal-schemes-lean4341.patch +++ b/lean/patches/formal-schemes-lean4341.patch @@ -1,193 +1,193 @@ -diff --git a/FormalSchemes/AdicCompletionLimit.lean b/FormalSchemes/AdicCompletionLimit.lean -index d778fcade8f85bf6d12f3cccdf148af42c52c5dd..b1b66cd19c24e883c264f0adfac65aa0d853a48b 100644 ---- a/FormalSchemes/AdicCompletionLimit.lean -+++ b/FormalSchemes/AdicCompletionLimit.lean -@@ -79,7 +79,6 @@ theorem quotientTower_map {m n : ℕ} (hmn : m ≤ n) : - (homOfLE (Nat.le_add_right n 1)).op ≫ (homOfLE hmn).op from Subsingleton.elim _ _, - CategoryTheory.Functor.map_comp, quotientTower_map_succ, ih] - apply CommRingCat.hom_ext -- simp only [CommRingCat.hom_comp] - exact Ideal.Quotient.factor_comp (Ideal.pow_le_pow_right (Nat.le_succ n)) - (Ideal.pow_le_pow_right hmn) - -@@ -128,7 +127,6 @@ theorem factorPow_comp_limitProj {m n : ℕ} (hmn : m ≤ n) : - rw [quotientTower_map] at hw - refine RingHom.ext fun z => ?_ - have h := DFunLike.congr_fun (congrArg CommRingCat.Hom.hom hw) z -- rw [CommRingCat.hom_comp] at h - exact h - - /-- The ring homomorphism `limit (quotientTower I) →+* AdicCompletion I R` obtained from the -diff --git a/FormalSchemes/FormalSpectrum.lean b/FormalSchemes/FormalSpectrum.lean -index eaa51f03d448e0eb994047eb92258dd72617ad19..dd86085fe3841adc9919b73488167bb91fd0cf01 100644 ---- a/FormalSchemes/FormalSpectrum.lean -+++ b/FormalSchemes/FormalSpectrum.lean -@@ -192,6 +192,7 @@ theorem map_comp (φ : R →+* S) (ψ : S →+* T) (hIJ : I ≤ J.comap φ) (hJK - (Ideal.quotientMap K ψ hJK).comp (Ideal.quotientMap J φ hIJ) := - Ideal.Quotient.ringHom_ext (RingHom.ext fun x => by simp [Ideal.quotientMap_mk]) - funext x -+ change PrimeSpectrum (T ⧸ K) at x - change PrimeSpectrum.comap (Ideal.quotientMap K (ψ.comp φ) hIK) x = _ - rw [hq, PrimeSpectrum.comap_comp_apply] - rfl -@@ -208,6 +209,7 @@ Spec S → Spec R - commutes. -/ - theorem toPrimeSpectrum_map (φ : R →+* S) (h : I ≤ J.comap φ) (x : FormalSpectrum J) : - toPrimeSpectrum I (map I J φ h x) = PrimeSpectrum.comap φ (toPrimeSpectrum J x) := by -+ change PrimeSpectrum (S ⧸ J) at x - change PrimeSpectrum.comap (Ideal.Quotient.mk I) - (PrimeSpectrum.comap (Ideal.quotientMap J φ h) x) - = PrimeSpectrum.comap φ (PrimeSpectrum.comap (Ideal.Quotient.mk J) x) -@@ -278,6 +280,7 @@ theorem comap_factor_comp_toThickening {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0) - PrimeSpectrum.comap (Ideal.Quotient.factor (Ideal.pow_le_pow_right hmn)) ∘ - toThickening I m hm = toThickening I n hn := by - funext x -+ change PrimeSpectrum (R ⧸ I) at x - change PrimeSpectrum.comap (Ideal.Quotient.factor (Ideal.pow_le_pow_right hmn)) - (PrimeSpectrum.comap (Ideal.Quotient.factor (Ideal.pow_le_self hm)) x) = _ - rw [← PrimeSpectrum.comap_comp_apply, Ideal.Quotient.factor_comp] -@@ -289,6 +292,7 @@ compatibly. -/ - theorem comap_mk_toThickening (n : ℕ) (hn : n ≠ 0) (x : FormalSpectrum I) : - PrimeSpectrum.comap (Ideal.Quotient.mk (I ^ n)) (toThickening I n hn x) = - toPrimeSpectrum I x := by -+ change PrimeSpectrum (R ⧸ I) at x - rw [toThickening, toPrimeSpectrum, ← PrimeSpectrum.comap_comp_apply, - Ideal.Quotient.factor_comp_mk] - -@@ -299,6 +303,7 @@ theorem toThickening_preimage_basicOpen (n : ℕ) (hn : n ≠ 0) (f : R) : - (PrimeSpectrum.basicOpen (Ideal.Quotient.mk (I ^ n) f) : Set (PrimeSpectrum (R ⧸ I ^ n))) - = (basicOpen I f : Set (FormalSpectrum I)) := by - ext x -+ change PrimeSpectrum (R ⧸ I) at x - change Ideal.Quotient.mk (I ^ n) f ∉ (PrimeSpectrum.comap _ x).asIdeal ↔ _ - rw [PrimeSpectrum.comap_asIdeal, Ideal.mem_comap, Ideal.Quotient.factor_mk] - rfl -diff --git a/lake-manifest.json b/lake-manifest.json -index b1308febafec43a4ce2579e35c508f6b66654b88..4f22c9fbf687e031625e1f4ed2bc973e57446dcd 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,21 +1,21 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/leanprover-community/mathlib4", -+ [{"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -25,7 +25,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -35,7 +35,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +45,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -65,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -75,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -85,10 +85,10 @@ - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "«formal-schemes»", -diff --git a/lakefile.toml b/lakefile.toml -index 551af80eb4d69a8c4d63abf0cde6124936dc0b02..53ef215a48858b86da7776108148f74dbc3d4c73 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,6 +4,8 @@ keywords = ["math"] - defaultTargets = ["FormalSchemes"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true -@@ -11,8 +13,8 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "FormalSchemes" -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/FormalSchemes/AdicCompletionLimit.lean b/FormalSchemes/AdicCompletionLimit.lean +index d778fcade8f85bf6d12f3cccdf148af42c52c5dd..b1b66cd19c24e883c264f0adfac65aa0d853a48b 100644 +--- a/FormalSchemes/AdicCompletionLimit.lean ++++ b/FormalSchemes/AdicCompletionLimit.lean +@@ -79,7 +79,6 @@ theorem quotientTower_map {m n : ℕ} (hmn : m ≤ n) : + (homOfLE (Nat.le_add_right n 1)).op ≫ (homOfLE hmn).op from Subsingleton.elim _ _, + CategoryTheory.Functor.map_comp, quotientTower_map_succ, ih] + apply CommRingCat.hom_ext +- simp only [CommRingCat.hom_comp] + exact Ideal.Quotient.factor_comp (Ideal.pow_le_pow_right (Nat.le_succ n)) + (Ideal.pow_le_pow_right hmn) + +@@ -128,7 +127,6 @@ theorem factorPow_comp_limitProj {m n : ℕ} (hmn : m ≤ n) : + rw [quotientTower_map] at hw + refine RingHom.ext fun z => ?_ + have h := DFunLike.congr_fun (congrArg CommRingCat.Hom.hom hw) z +- rw [CommRingCat.hom_comp] at h + exact h + + /-- The ring homomorphism `limit (quotientTower I) →+* AdicCompletion I R` obtained from the +diff --git a/FormalSchemes/FormalSpectrum.lean b/FormalSchemes/FormalSpectrum.lean +index eaa51f03d448e0eb994047eb92258dd72617ad19..dd86085fe3841adc9919b73488167bb91fd0cf01 100644 +--- a/FormalSchemes/FormalSpectrum.lean ++++ b/FormalSchemes/FormalSpectrum.lean +@@ -192,6 +192,7 @@ theorem map_comp (φ : R →+* S) (ψ : S →+* T) (hIJ : I ≤ J.comap φ) (hJK + (Ideal.quotientMap K ψ hJK).comp (Ideal.quotientMap J φ hIJ) := + Ideal.Quotient.ringHom_ext (RingHom.ext fun x => by simp [Ideal.quotientMap_mk]) + funext x ++ change PrimeSpectrum (T ⧸ K) at x + change PrimeSpectrum.comap (Ideal.quotientMap K (ψ.comp φ) hIK) x = _ + rw [hq, PrimeSpectrum.comap_comp_apply] + rfl +@@ -208,6 +209,7 @@ Spec S → Spec R + commutes. -/ + theorem toPrimeSpectrum_map (φ : R →+* S) (h : I ≤ J.comap φ) (x : FormalSpectrum J) : + toPrimeSpectrum I (map I J φ h x) = PrimeSpectrum.comap φ (toPrimeSpectrum J x) := by ++ change PrimeSpectrum (S ⧸ J) at x + change PrimeSpectrum.comap (Ideal.Quotient.mk I) + (PrimeSpectrum.comap (Ideal.quotientMap J φ h) x) + = PrimeSpectrum.comap φ (PrimeSpectrum.comap (Ideal.Quotient.mk J) x) +@@ -278,6 +280,7 @@ theorem comap_factor_comp_toThickening {m n : ℕ} (hm : m ≠ 0) (hn : n ≠ 0) + PrimeSpectrum.comap (Ideal.Quotient.factor (Ideal.pow_le_pow_right hmn)) ∘ + toThickening I m hm = toThickening I n hn := by + funext x ++ change PrimeSpectrum (R ⧸ I) at x + change PrimeSpectrum.comap (Ideal.Quotient.factor (Ideal.pow_le_pow_right hmn)) + (PrimeSpectrum.comap (Ideal.Quotient.factor (Ideal.pow_le_self hm)) x) = _ + rw [← PrimeSpectrum.comap_comp_apply, Ideal.Quotient.factor_comp] +@@ -289,6 +292,7 @@ compatibly. -/ + theorem comap_mk_toThickening (n : ℕ) (hn : n ≠ 0) (x : FormalSpectrum I) : + PrimeSpectrum.comap (Ideal.Quotient.mk (I ^ n)) (toThickening I n hn x) = + toPrimeSpectrum I x := by ++ change PrimeSpectrum (R ⧸ I) at x + rw [toThickening, toPrimeSpectrum, ← PrimeSpectrum.comap_comp_apply, + Ideal.Quotient.factor_comp_mk] + +@@ -299,6 +303,7 @@ theorem toThickening_preimage_basicOpen (n : ℕ) (hn : n ≠ 0) (f : R) : + (PrimeSpectrum.basicOpen (Ideal.Quotient.mk (I ^ n) f) : Set (PrimeSpectrum (R ⧸ I ^ n))) + = (basicOpen I f : Set (FormalSpectrum I)) := by + ext x ++ change PrimeSpectrum (R ⧸ I) at x + change Ideal.Quotient.mk (I ^ n) f ∉ (PrimeSpectrum.comap _ x).asIdeal ↔ _ + rw [PrimeSpectrum.comap_asIdeal, Ideal.mem_comap, Ideal.Quotient.factor_mk] + rfl +diff --git a/lake-manifest.json b/lake-manifest.json +index b1308febafec43a4ce2579e35c508f6b66654b88..4f22c9fbf687e031625e1f4ed2bc973e57446dcd 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,21 +1,21 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/leanprover-community/mathlib4", ++ [{"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -25,7 +25,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -35,7 +35,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +45,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -65,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -75,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -85,10 +85,10 @@ + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "«formal-schemes»", +diff --git a/lakefile.toml b/lakefile.toml +index 551af80eb4d69a8c4d63abf0cde6124936dc0b02..53ef215a48858b86da7776108148f74dbc3d4c73 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,6 +4,8 @@ keywords = ["math"] + defaultTargets = ["FormalSchemes"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true +@@ -11,8 +13,8 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "FormalSchemes" +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/genl-lean4341.patch b/lean/patches/genl-lean4341.patch index 9982ef0a172ff62be15b45f8c9abcfaa9cafc0cb..d2ef990e3dab0d9d5ce8ad62ed08a559ab6a3cf9 100644 --- a/lean/patches/genl-lean4341.patch +++ b/lean/patches/genl-lean4341.patch @@ -1,189 +1,189 @@ -diff --git a/lake-manifest.json b/lake-manifest.json -index e8ffcb435b3b516c7e7e6f32008d4a78dcc9271c..5ba329fb1fb3ff704cdeabb2e0b58cda469ccdd3 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,7 +1,17 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/lana-agents/heights", -+ [{"url": "https://github.com/lana-agents/belyi.git", -+ "type": "git", -+ "subDir": null, -+ "scope": "", -+ "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "name": "belyi", -+ "manifestFile": "lake-manifest.json", -+ "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "inherited": false, -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/heights.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -11,31 +21,31 @@ - "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", - "inherited": false, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/mathlib4", -+ {"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, -- {"url": "https://github.com/lana-agents/belyi.git", -+ {"url": "https://github.com/lana-agents/oka.git", - "type": "git", - "subDir": null, - "scope": "", -- "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -- "name": "belyi", -+ "rev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", -+ "name": "oka", - "manifestFile": "lake-manifest.json", -- "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", - "inherited": true, - "configFile": "lakefile.toml"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -65,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -75,7 +85,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -85,7 +95,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -95,30 +105,20 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/lana-agents/oka.git", -- "type": "git", -- "subDir": null, -- "scope": "", -- "rev": "da228a2cf9671aaba08ddc96274d75e098b28f67", -- "name": "oka", -- "manifestFile": "lake-manifest.json", -- "inputRev": "da228a2cf9671aaba08ddc96274d75e098b28f67", -- "inherited": true, -- "configFile": "lakefile.toml"}, - {"url": "https://github.com/leanprover/lean4-cli", - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "genl", -diff --git a/lakefile.toml b/lakefile.toml -index 8be38dbd83af2475de6b65a66e460a7709cb702f..24cede3b9b7f23a9cfc2f4edd6d0e8cf2bb6c458 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,6 +4,8 @@ keywords = ["math"] - defaultTargets = ["Genl"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - autoImplicit = false - relaxedAutoImplicit = false -@@ -12,16 +14,22 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - # Heights on curves over number fields (the genuine height theory, Genl.Curves), which also - # brings lana-agents/belyi (curves as function fields). - [[require]] - name = "heights" --git = "https://github.com/lana-agents/heights" -+git = "https://github.com/lana-agents/heights.git" - rev = "721496ca4c158e511d25d8ccf6bfe8503eda73c1" - -+# Imported directly by the curve height and covering developments. -+[[require]] -+name = "belyi" -+git = "https://github.com/lana-agents/belyi.git" -+rev = "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8" -+ - [[lean_lib]] - name = "Genl" - -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/lake-manifest.json b/lake-manifest.json +index e8ffcb435b3b516c7e7e6f32008d4a78dcc9271c..5ba329fb1fb3ff704cdeabb2e0b58cda469ccdd3 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,7 +1,17 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/lana-agents/heights", ++ [{"url": "https://github.com/lana-agents/belyi.git", ++ "type": "git", ++ "subDir": null, ++ "scope": "", ++ "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "name": "belyi", ++ "manifestFile": "lake-manifest.json", ++ "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "inherited": false, ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/heights.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -11,31 +21,31 @@ + "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", + "inherited": false, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/mathlib4", ++ {"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, +- {"url": "https://github.com/lana-agents/belyi.git", ++ {"url": "https://github.com/lana-agents/oka.git", + "type": "git", + "subDir": null, + "scope": "", +- "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", +- "name": "belyi", ++ "rev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", ++ "name": "oka", + "manifestFile": "lake-manifest.json", +- "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", + "inherited": true, + "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -65,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -75,7 +85,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -85,7 +95,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -95,30 +105,20 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/lana-agents/oka.git", +- "type": "git", +- "subDir": null, +- "scope": "", +- "rev": "da228a2cf9671aaba08ddc96274d75e098b28f67", +- "name": "oka", +- "manifestFile": "lake-manifest.json", +- "inputRev": "da228a2cf9671aaba08ddc96274d75e098b28f67", +- "inherited": true, +- "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "genl", +diff --git a/lakefile.toml b/lakefile.toml +index 8be38dbd83af2475de6b65a66e460a7709cb702f..24cede3b9b7f23a9cfc2f4edd6d0e8cf2bb6c458 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,6 +4,8 @@ keywords = ["math"] + defaultTargets = ["Genl"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + autoImplicit = false + relaxedAutoImplicit = false +@@ -12,16 +14,22 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + # Heights on curves over number fields (the genuine height theory, Genl.Curves), which also + # brings lana-agents/belyi (curves as function fields). + [[require]] + name = "heights" +-git = "https://github.com/lana-agents/heights" ++git = "https://github.com/lana-agents/heights.git" + rev = "721496ca4c158e511d25d8ccf6bfe8503eda73c1" + ++# Imported directly by the curve height and covering developments. ++[[require]] ++name = "belyi" ++git = "https://github.com/lana-agents/belyi.git" ++rev = "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8" ++ + [[lean_lib]] + name = "Genl" + +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/gromov-lean4341.patch b/lean/patches/gromov-lean4341.patch index 2fad46559f57f199973e63d2790ae796f590dda7..60e39db95ff2e9abb30092d795d767763555b8c7 100644 --- a/lean/patches/gromov-lean4341.patch +++ b/lean/patches/gromov-lean4341.patch @@ -1,18638 +1,18638 @@ -diff --git a/Gromov/BoundedDoubling.lean b/Gromov/BoundedDoubling.lean -index 61fd0b4..ac55b91 100644 ---- a/Gromov/BoundedDoubling.lean -+++ b/Gromov/BoundedDoubling.lean -@@ -11,11 +11,6 @@ public import Gromov.Lemma326 - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -39,29 +34,62 @@ variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] - - variable {b : Module.Basis ι ℝ V} - --set_option maxHeartbeats 2500000 in --lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodule ℝ LipschitzH, U ≤ V ∧ dim V ≤ 2 * dim U ∧ ∀ f ∈ U, Q_R (16 * (R_2 data)) f f ≤ Real.exp (2 * (a data.d)) * Q_R ((R_2 data)) f f := by -+omit hGS v_wrapper_inst in -+private lemma diagonal_form_eval {E I : Type*} [AddCommGroup E] [Module ℝ E] -+ [Fintype I] [DecidableEq I] (b : Module.Basis I ℝ E) -+ (B : LinearMap.BilinForm ℝ E) (hB : B.IsOrthoᵢ b) (x : E) : -+ B x x = ∑ i, (b.repr x i)^2 * B (b i) (b i) := by -+ calc -+ B x x = B (∑ i, b.repr x i • b i) (∑ j, b.repr x j • b j) := by -+ rw [b.sum_repr] -+ _ = ∑ i, ∑ j, b.repr x i * b.repr x j * B (b j) (b i) := by -+ simp only [map_sum, LinearMap.sum_apply, map_smul, LinearMap.smul_apply, smul_eq_mul] -+ apply Finset.sum_congr rfl -+ intro i hi -+ rw [Finset.mul_sum] -+ apply Finset.sum_congr rfl -+ intro j hj -+ ring -+ _ = ∑ i, (b.repr x i)^2 * B (b i) (b i) := by -+ apply Finset.sum_congr rfl -+ intro i hi -+ rw [Finset.sum_eq_single i] -+ · ring -+ · intro j hj hji -+ rw [hB hji] -+ simp -+ · simp -+ -+omit hGS v_wrapper_inst in -+private lemma diagonal_forms_le {E I : Type*} [AddCommGroup E] [Module ℝ E] -+ [Fintype I] [DecidableEq I] (b : Module.Basis I ℝ E) -+ (B D : LinearMap.BilinForm ℝ E) (hB : B.IsOrthoᵢ b) (hD : D.IsOrthoᵢ b) -+ (x : E) (k : ℝ) -+ (hk : ∀ i ∈ (b.repr x).support, D (b i) (b i) ≤ k * B (b i) (b i)) : -+ D x x ≤ k * B x x := by -+ rw [diagonal_form_eval b B hB, diagonal_form_eval b D hD, Finset.mul_sum] -+ apply Finset.sum_le_sum -+ intro i hi -+ by_cases hx : i ∈ (b.repr x).support -+ · nlinarith [mul_le_mul_of_nonneg_left (hk i hx) (sq_nonneg (b.repr x i))] -+ · have hz : b.repr x i = 0 := Finsupp.notMem_support_iff.mp hx -+ simp [hz] -+ -+private lemma doubleScale_basis (R : ℕ) (h_R : R'_ V ≤ (R : ℝ)) : -+ ∃ v_orthonormal : Module.Basis (Fin (Module.finrank ℝ V)) ℝ V, -+ let _q_r_16_m := (Q_R_lin V (16 * R)).toMatrix₂ v_orthonormal v_orthonormal -+ let q_r_16_m_hermitian := Q_R_lin_hermetian v_orthonormal (16 * R) -+ let q_r_16_eigen := q_r_16_m_hermitian.eigenvectorBasis.toBasis -+ let eigen_basis_V := (WithLp.linearEquiv 2 ℝ (Fin (Module.finrank ℝ V) → ℝ)).trans v_orthonormal.equivFun.symm -+ let remapped_ortho := Module.Basis.map q_r_16_eigen eigen_basis_V -+ (Q_R_lin V R).IsOrthoᵢ remapped_ortho ∧ -+ (∀ i, Q_R_lin V R (remapped_ortho i) (remapped_ortho i) = 1) ∧ -+ (Q_R_lin V R).toMatrix₂ v_orthonormal v_orthonormal = 1 ∧ -+ (Q_R_lin_plain V (16 * R)).IsOrthoᵢ remapped_ortho := by - classical -- -- let R := 16 ^ ((GoodScales data).i_2) -- have h_R: R'_ V ≤ ↑R := R'_le_R_2 data -- -- have q_r_base_pos_def := (Q_R_matrix_pos_def_i₀ b (16 ^ ((GoodScales data).i_2)) (by -- simp [i₀] -- rw [pow_le_pow_iff_right₀] -- . have foo := (GoodScales data).i_2_ge -- simp [i₀] at foo -- exact foo -- . simp -- )) -- -- have det_succ_pos : 0 < (Q_R_matrix b (16 ^ ((GoodScales data).i_2 + 1))).det := -- (Q_R_matrix_pos_def b (16 ^ ((GoodScales data).i_2 + 1)) -- (le_trans h_R (by simp only [R]; push_cast; exact pow_le_pow_right₀ (by norm_num) (Nat.le_succ _)))).det_pos -- - -- Full (definite) inner product core, registered as a local instance so that - -- `toNormedAddCommGroup` / `ofCore` pick it up by inference. -- letI Q_R_inner_core: InnerProductSpace.Core ℝ V := { -+ let Q_R_inner_core: InnerProductSpace.Core ℝ V := { - inner := fun u v => Q_R R u.val v.val - conj_inner_symm := by - simp [Q_R] -@@ -93,11 +121,11 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - - -- Install the definite Q_R-derived NORM (not just a seminorm) *before* `ofCore`, so the - -- ambient LipschitzH norm on `↥V` is shadowed and `Q_R_inner` is over this `NormedAddCommGroup`. -- letI Q_R_norm : NormedAddCommGroup ↥V := InnerProductSpace.Core.toNormedAddCommGroup (𝕜 := ℝ) -+ let Q_R_norm : NormedAddCommGroup ↥V := InnerProductSpace.Core.toNormedAddCommGroup (𝕜 := ℝ) - -- Also expose the seminorm projection as a *direct* local instance, so it shadows the - -- ambient `V.seminormedAddCommGroup` (a bare `NormedAddCommGroup` letI does not). -- letI Q_R_seminorm : SeminormedAddCommGroup ↥V := Q_R_norm.toSeminormedAddCommGroup -- letI Q_R_inner : InnerProductSpace ℝ ↥V := -+ let Q_R_seminorm : SeminormedAddCommGroup ↥V := Q_R_norm.toSeminormedAddCommGroup -+ let Q_R_inner : InnerProductSpace ℝ ↥V := - InnerProductSpace.ofCore (inferInstance : PreInnerProductSpace.Core ℝ ↥V) - - have norm_eq_q_r : ∀ x : ↥V, ‖x‖ = Real.sqrt (Q_R R x x) := fun _ => rfl -@@ -163,7 +191,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - apply v_orthogonal_orig_eval _ _ hij - )] - -- ring -+ ring_nf - simp [norm_eq_q_r] - conv => - lhs -@@ -190,9 +218,9 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - intro i - simp [remapped_ortho] - simp [eigen_basis_V,] -- ring -+ ring_nf - field_simp -- simp only [eigen_basis_V, q_r_16_eigen] -+ simp only [q_r_16_eigen] - simp - simp_rw [Finset.mul_sum] - simp [v_orthonormal] -@@ -218,7 +246,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - apply v_orthogonal_orig_eval _ _ hij - )] - -- ring -+ ring_nf - simp [norm_eq_q_r] - conv => - lhs -@@ -288,36 +316,6 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - let Q_R_16_new_ortho := (Q_R_lin V (16 *R)).toMatrix₂ remapped_ortho remapped_ortho - have Q_R_16_new_ortho_hermitian: Q_R_16_new_ortho.IsHermitian := Q_R_lin_hermetian remapped_ortho (16 *R) - -- have det_Q_R_one: Q_R_ortho.det = 1 := by -- simp [Q_R_ortho_eq_1] -- -- have det_Q_R_16_ge: 1 ≤ Q_R_16_new_ortho.det := by -- rw [← det_Q_R_one] -- apply matrix_det_montone -- . -- simp [Q_R_ortho] -- apply Matrix.PosDef.of_dotProduct_mulVec_pos (?_) -- . -- intro x hx -- simp [Q_R_matrix] -- conv => -- rhs -- lhs -- equals (star x) => simp -- rw [star_dotProduct_toMatrix₂_mulVec] -- apply Q_R_pos_on_R' -- . rw [LinearEquiv.map_ne_zero_iff] -- exact hx -- . exact h_R -- . apply Q_R_ortho_m_hermitian -- . -- simp [Q_R_16_new_ortho, Q_R_ortho] -- rw [← map_sub] -- rw [← LinearMap.isPosSemidef_iff_posSemidef_toMatrix] -- apply Q_R_lin_sub_pos_semi_def -- norm_cast -- grind -- - have q_r_16_remapped_orthogonal : (Q_R_lin_plain V (16 * R)).IsOrthoᵢ remapped_ortho := by - simp [remapped_ortho] - rw [LinearMap.isOrthoᵢ_def] -@@ -357,7 +355,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - - have tobasis_lp: ∀ x, (q_r_16_m_hermitian.eigenvectorBasis.toBasis x).ofLp = (q_r_16_m_hermitian.eigenvectorBasis x).ofLp := by - simp -- simp [tobasis_lp] -+ simp - rw [Matrix.IsHermitian.mulVec_eigenvectorBasis q_r_16_m_hermitian] - simp - right -@@ -371,6 +369,51 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - apply OrthonormalBasis.inner_eq_zero - exact hxy.symm - -+ exact ⟨v_orthonormal, v_orthonormal_isortho, q_r_lin_remapped_one, -+ Q_R_v_orthonormal_eq_1, q_r_16_remapped_orthogonal⟩ -+ -+lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodule ℝ LipschitzH, U ≤ V ∧ dim V ≤ 2 * dim U ∧ ∀ f ∈ U, Q_R (16 * (R_2 data)) f f ≤ Real.exp (2 * (a data.d)) * Q_R ((R_2 data)) f f := by -+ classical -+ -+ let R := 16 ^ ((GoodScales data).i_2) -+ have h_R: R'_ V ≤ ↑R := R'_le_R_2 data -+ -+ have q_r_base_pos_def := (Q_R_matrix_pos_def_i₀ b (16 ^ ((GoodScales data).i_2)) (by -+ simp [i₀] -+ rw [pow_le_pow_iff_right₀] -+ . have foo := (GoodScales data).i_2_ge -+ simp [i₀] at foo -+ exact foo -+ . simp -+ )) -+ -+ have det_succ_pos : 0 < (Q_R_matrix b (16 ^ ((GoodScales data).i_2 + 1))).det := -+ (Q_R_matrix_pos_def b (16 ^ ((GoodScales data).i_2 + 1)) -+ (le_trans h_R (by simp only [R]; push_cast; exact pow_le_pow_right₀ (by norm_num) (Nat.le_succ _)))).det_pos -+ -+ obtain ⟨v_orthonormal, hb⟩ := doubleScale_basis R h_R -+ let q_r_16_m := (Q_R_lin V (16 * R)).toMatrix₂ v_orthonormal v_orthonormal -+ have q_r_16_m_hermitian : q_r_16_m.IsHermitian := Q_R_lin_hermetian v_orthonormal (16 * R) -+ let q_r_16_eigen := q_r_16_m_hermitian.eigenvectorBasis.toBasis -+ let eigen_basis_V := (WithLp.linearEquiv 2 ℝ (Fin (Module.finrank ℝ V) → ℝ)).trans v_orthonormal.equivFun.symm -+ let remapped_ortho := Module.Basis.map q_r_16_eigen eigen_basis_V -+ change (Q_R_lin V R).IsOrthoᵢ remapped_ortho ∧ -+ (∀ i, Q_R_lin V R (remapped_ortho i) (remapped_ortho i) = 1) ∧ -+ (Q_R_lin V R).toMatrix₂ v_orthonormal v_orthonormal = 1 ∧ -+ (Q_R_lin_plain V (16 * R)).IsOrthoᵢ remapped_ortho at hb -+ obtain ⟨v_orthonormal_isortho, q_r_lin_remapped_one, -+ Q_R_v_orthonormal_eq_1, q_r_16_remapped_orthogonal⟩ := hb -+ let q_r_v_orthonormal := (Q_R_lin V R).toMatrix₂ v_orthonormal v_orthonormal -+ let Q_R_ortho := (Q_R_lin V R).toMatrix₂ remapped_ortho remapped_ortho -+ have det_Q_R_one : Q_R_ortho.det = 1 := by -+ have hmat : Q_R_ortho = 1 := by -+ ext i j -+ by_cases hij : i = j -+ · subst j -+ simpa [Q_R_ortho] using q_r_lin_remapped_one i -+ · simpa [Q_R_ortho, Matrix.one_apply, hij] using v_orthonormal_isortho hij -+ simp [hmat] -+ - have new_growth := data.h_growth - have nonempty_fin: Nonempty (Fin (Module.finrank ℝ ↥V)) := by - use 0 -@@ -394,124 +437,18 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - . simp - apply Finset.card_le_card - apply Finset.pow_subset_pow_right -- . simp [one_mem] -+ . simp [Generates.one_mem] - . grind - - -- -- have inner_x_self (x: V) (k: ℝ) (hk: ∀ i ∈ (remapped_ortho.repr x).support, (Q_R_lin_plain V (16 * R) (remapped_ortho i) (remapped_ortho i)) ≤ k * (Q_R_lin_plain V (R) (remapped_ortho i) (remapped_ortho i))) : Q_R_lin_plain V (16 * R) x x ≤ k * Q_R_lin_plain V (R) x x := by -- rw [← Module.Basis.sum_repr remapped_ortho (u := x)] -- have inner_sum_eq: ∀ i, ∑ i_1, inner ℝ ((remapped_ortho.repr x) i_1 • remapped_ortho i_1) ((remapped_ortho.repr x) i • remapped_ortho i) = inner ℝ ((remapped_ortho.repr x) i • remapped_ortho i) ((remapped_ortho.repr x) i • remapped_ortho i) := by -- intro i -- rw [Finset.sum_eq_single i] -- . intro k hk k_neq -- rw [inner_eq_q_r] -- simp [map_smul] -- rw [LinearMap.isOrthoᵢ_def] at v_orthonormal_isortho -- specialize v_orthonormal_isortho k i k_neq -- simp [Q_R_lin] at v_orthonormal_isortho -- simp [Q_R] -- simp [Q_R] at v_orthonormal_isortho -- simp_rw [mul_assoc] -- rw [← Finset.mul_sum] -- simp_rw [mul_comm ((remapped_ortho.repr x) i)] -- simp_rw [← mul_assoc] -- rw [← Finset.sum_mul] -- simp [v_orthonormal_isortho] -- . -- intro hi -- simp at hi -- -- have q_r_16_sum_eq: ∀ i, ∑ i_1, Q_R_lin_plain V (16 * R) ((remapped_ortho.repr x) i_1 • remapped_ortho i_1) ((remapped_ortho.repr x) i • remapped_ortho i) = Q_R_lin_plain V (16 * R) ((remapped_ortho.repr x) i • remapped_ortho i) ((remapped_ortho.repr x) i • remapped_ortho i) := by -- intro i -- rw [Finset.sum_eq_single i] -- . intro k hk k_neq -- simp [map_smul] -- rw [LinearMap.isOrthoᵢ_def] at q_r_16_remapped_orthogonal -- specialize q_r_16_remapped_orthogonal k i k_neq -- simp [Q_R_lin_plain] at q_r_16_remapped_orthogonal -- simp [Q_R_lin_plain, Q_R] -- simp [Q_R] at q_r_16_remapped_orthogonal -- right -- right -- simp [q_r_16_remapped_orthogonal] -- . -- intro hi -- simp at hi -- -- rw [map_sum] -- simp_rw [map_sum] -- simp [Finset.sum_apply] -- conv => -- rhs -- rhs -- arg 2 -- intro i -- rw [Finset.sum_eq_single i (by -- intro k hk k_neq -- simp [map_smul] -- rw [LinearMap.isOrthoᵢ_def] at v_orthonormal_isortho -- right -- specialize v_orthonormal_isortho k i k_neq -- simp [Q_R_lin] at v_orthonormal_isortho -- simp [Q_R_lin_plain, Q_R] -- simp [Q_R] at v_orthonormal_isortho -- simp [v_orthonormal_isortho] -- ) (by -- intro hi -- simp at hi -- )] -- conv => -- rhs -- rw [← Module.Basis.sum_repr remapped_ortho (u := x)] -- -- simp_rw [map_sum] -- simp -- simp_rw [Finset.mul_sum] -- conv => -- lhs -- arg 2 -- intro i -- rw [Finset.sum_eq_single i (by -- intro k hk k_neq -- simp [map_smul] -- rw [LinearMap.isOrthoᵢ_def] at q_r_16_remapped_orthogonal -- specialize q_r_16_remapped_orthogonal k i k_neq -- simp [Q_R_lin_plain] at q_r_16_remapped_orthogonal -- simp [Q_R_lin_plain, Q_R] -- simp [Q_R] at q_r_16_remapped_orthogonal -- right -- right -- simp [q_r_16_remapped_orthogonal] -- ) (by -- intro hi -- simp at hi -- )] -- -- apply Finset.sum_le_sum -- intro i hi -- by_cases i_mem_inter: i ∈ (remapped_ortho.repr x).support -- . -- conv => -- lhs -- equals ((Q_R_lin_plain V (16 * ↑R)) (remapped_ortho i)) (remapped_ortho i) * (remapped_ortho.repr x) i * (remapped_ortho.repr x) i => -- ring -- -- conv => -- rhs -- equals k * ((Q_R_lin_plain V ↑R) (remapped_ortho i)) (remapped_ortho i) * (remapped_ortho.repr x) i * (remapped_ortho.repr x) i => -- ring -- -- rw [mul_assoc] -- nth_rw 2 [mul_assoc] -- specialize hk i i_mem_inter -- grw [hk] -- . ring -- simp -- . rw [← pow_two] -- positivity -- . -- simp at i_mem_inter -- simp [i_mem_inter] -+ have inner_x_self (x : V) (k : ℝ) -+ (hk : ∀ i ∈ (remapped_ortho.repr x).support, -+ Q_R_lin_plain V (16 * R) (remapped_ortho i) (remapped_ortho i) ≤ -+ k * Q_R_lin_plain V R (remapped_ortho i) (remapped_ortho i)) : -+ Q_R_lin_plain V (16 * R) x x ≤ k * Q_R_lin_plain V R x x := by -+ exact diagonal_forms_le remapped_ortho -+ (Q_R_lin_plain V R) (Q_R_lin_plain V (16 * R)) -+ v_orthonormal_isortho q_r_16_remapped_orthogonal x k hk - grw [← log_second] at a_gt - rw [Real.log_mul] at a_gt - . -@@ -564,7 +501,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - simp - rw [le_sub_iff_add_le'] - grw [dim_small] -- ring -+ ring_nf - simp - . - have all_le: ∀ f ∈ small_submodule, Q_R_lin V (16 * ↑(R_2 data)) f f ≤ Real.exp (2 * a data.d) * Q_R_lin V ↑(R_2 data) f f := by -@@ -590,11 +527,11 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - . intro k hk i_neq - simp - right -- simp [Finsupp.single_apply, i_neq] -+ simp [i_neq] - . intro k hk i_neq - simp - right -- simp [Finsupp.single_apply, i_neq] -+ simp [i_neq] - - simp [large_basis] at i_not_mem - simp [Q_R_lin_plain] -@@ -617,7 +554,6 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - field_simp at a_gt - unfold Q_R_ortho at det_Q_R_one - have foo := Q_R_v_orthonormal_eq_1 -- unfold q_r_v_orthonormal at Q_R_v_orthonormal_eq_1 - simp [R] at Q_R_v_orthonormal_eq_1 - simp [Q_R_v_orthonormal_eq_1] at a_gt - -@@ -628,7 +564,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - . - have foo := q_r_lin_remapped_one - simp [Q_R_lin, Q_R] at foo -- simp [finite_closed_ball] -+ simp - rw [foo] - . - simp -@@ -745,7 +681,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - apply Matrix.PosDef.of_dotProduct_mulVec_pos (?_) - . - intro x hx -- simp [Q_R_matrix] -+ simp - conv => - rhs - lhs -@@ -767,7 +703,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - apply Matrix.PosDef.eigenvalues_pos - apply Matrix.PosDef.of_dotProduct_mulVec_pos (?_) - . intro x hx -- simp [Q_R_matrix] -+ simp - conv => - rhs - lhs -@@ -793,7 +729,6 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul - grind - . exact (Real.rpow_pos_of_pos det_succ_pos _).ne' - --#print axioms exists_bounded_doubling_subspace - - end V_Wrapper_Section - -diff --git a/Gromov/Complexification.lean b/Gromov/Complexification.lean -index 71602f6..6ccd3ae 100644 ---- a/Gromov/Complexification.lean -+++ b/Gromov/Complexification.lean -@@ -41,11 +41,11 @@ def fst (p : Cx V) : V := (p : V × V).1 - @[expose] - def snd (p : Cx V) : V := (p : V × V).2 - --omit [InnerProductSpace ℝ V] in -+omit [NormedAddCommGroup V] [InnerProductSpace ℝ V] in - @[simp] lemma fst_mk (a b : V) : fst ((a, b) : Cx V) = a := rfl --omit [InnerProductSpace ℝ V] in -+omit [NormedAddCommGroup V] [InnerProductSpace ℝ V] in - @[simp] lemma snd_mk (a b : V) : snd ((a, b) : Cx V) = b := rfl --omit [InnerProductSpace ℝ V] in -+omit [NormedAddCommGroup V] [InnerProductSpace ℝ V] in - @[ext] lemma ext {p q : Cx V} (h1 : p.fst = q.fst) (h2 : p.snd = q.snd) : p = q := Prod.ext h1 h2 - - omit [InnerProductSpace ℝ V] in -@@ -92,7 +92,7 @@ lemma innerC_self_re (u : Cx V) : - Complex.I_im, Complex.ofReal_im, zero_mul, mul_zero, sub_zero, add_zero] - - /-- The inner product space core on the complexification. -/ --@[expose] -+@[expose, instance_reducible] - noncomputable def coreC : InnerProductSpace.Core ℂ (Cx V) where - inner := innerC - conj_inner_symm u v := by unfold innerC; simp [Complex.ext_iff, real_inner_comm] -diff --git a/Gromov/Convolution.lean b/Gromov/Convolution.lean -index 42fc819..4754eca 100644 ---- a/Gromov/Convolution.lean -+++ b/Gromov/Convolution.lean -@@ -14,8 +14,6 @@ public import Gromov.TendstoNhdsMul - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - attribute [local implicit_reducible] Additive - - namespace GeneratesNS -@@ -36,7 +34,7 @@ lemma conv_assoc_of_lp2 {f g h: G → ℝ} (hf: MemLp f 2 Measure.count) (hg: Me - funext x - - -- have h_lp_n (n: ℕ): MemLp h n myHaarAddOpp := by -+ have h_lp_n (n: ℕ): MemLp (fun x : Additive G => h x) n myHaarAddOpp := by - apply Continuous.memLp_of_hasCompactSupport (X := Additive G) (μ := myHaarAddOpp) - . apply continuous_of_discreteTopology - . -@@ -48,7 +46,6 @@ lemma conv_assoc_of_lp2 {f g h: G → ℝ} (hf: MemLp f 2 Measure.count) (hg: Me - conv => - lhs - arg 1 -- simp - eta_reduce - rw [MeasureTheory.convolution_assoc (L := ContinuousLinearMap.mul ℝ ℝ) (L₂ := ContinuousLinearMap.mul ℝ ℝ) (L₃ := ContinuousLinearMap.mul ℝ ℝ) (L₄ := ContinuousLinearMap.mul ℝ ℝ)] - . rfl -@@ -96,7 +93,6 @@ lemma conv_assoc_of_lp2 {f g h: G → ℝ} (hf: MemLp f 2 Measure.count) (hg: Me - exact hf - . - unfold MeasureTheory.MemLp -- refine ⟨by apply AEStronglyMeasurable.of_discrete, ?_⟩ - rw [← my_add_haar_eq_count] - grw [ENNReal.eLpNorm_convolution_le_enorm_mul' (p := 2) (q := 1)] - . -@@ -104,17 +100,13 @@ lemma conv_assoc_of_lp2 {f g h: G → ℝ} (hf: MemLp f 2 Measure.count) (hg: Me - apply ENNReal.mul_lt_top - . - simp_rw [← Real.norm_eq_abs] -- rw [MeasureTheory.eLpNorm_norm] -- rw [my_add_haar_eq_count] -- exact MemLp.eLpNorm_lt_top hg -+ have hg' : MemLp (fun x : Additive G => g x) 2 myHaarAddOpp := by -+ rw [my_add_haar_eq_count] -+ exact hg -+ exact hg'.norm.eLpNorm_lt_top - . - simp_rw [← Real.norm_eq_abs] -- rw [MeasureTheory.eLpNorm_norm] -- rw [my_add_haar_eq_count] -- rw [← my_add_haar_eq_count] -- have foo := h_lp_n 1 -- simp at foo -- exact MemLp.eLpNorm_lt_top foo -+ simpa only [Nat.cast_one] using (h_lp_n 1).norm.eLpNorm_lt_top - . simp - . simp - . simp -@@ -132,7 +124,6 @@ lemma conv_assoc {f g h: G → ℝ} (h_fg: ConvExists f g) (h_gh: ConvExists g h - conv => - lhs - arg 1 -- simp - eta_reduce - rw [MeasureTheory.convolution_assoc (L := ContinuousLinearMap.mul ℝ ℝ) (L₂ := ContinuousLinearMap.mul ℝ ℝ) (L₃ := ContinuousLinearMap.mul ℝ ℝ) (L₄ := ContinuousLinearMap.mul ℝ ℝ)] - . rfl -@@ -283,7 +274,6 @@ lemma conv_sum {T: Type*} (H: Finset T) (f: T → G → ℝ) (h: G → ℝ) (h_f - @[expose] - noncomputable def conv_finsupp_lp2 (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))) (g : G → ℝ) (hg : g.support.Finite): (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G))) := MeasureTheory.MemLp.toLp (Conv f g) (by - simp [MemLp] -- refine ⟨by apply AEStronglyMeasurable.of_discrete, ?_⟩ - have norm_bound := ENNReal.eLpNorm_convolution_le_enorm_mul (G := Additive G) (f := f) (g := g) (E' := ℝ) (E := ℝ) (F := ℝ) (𝕜 := ℝ) (p := 2) (q := 1) (r := 2) (μ := myHaarAddOpp) (ContinuousLinearMap.mul ℝ ℝ) - (by simp) (by simp) (by simp) (by simp) (by apply AEMeasurable.of_discrete) (by apply AEMeasurable.of_discrete) - -@@ -298,7 +288,7 @@ noncomputable def conv_finsupp_lp2 (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.vo - . apply WithTop.mul_lt_top - . exact enorm_lt_top - . rw [← my_add_haar_eq_count] -- apply (MeasureTheory.Lp.memLp f).2 -+ apply (MeasureTheory.Lp.memLp f).eLpNorm_lt_top - . - simp [eLpNorm, eLpNorm'] - rw [MeasureTheory.lintegral_count] -diff --git a/Gromov/CutoffInequality.lean b/Gromov/CutoffInequality.lean -index cb8c23e..6f8d0a7 100644 ---- a/Gromov/CutoffInequality.lean -+++ b/Gromov/CutoffInequality.lean -@@ -17,11 +17,6 @@ public import Gromov.ToMathlib.LinearAlgebra.Matrix.Det - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -43,7 +38,6 @@ include hGS - -- `deriv_sq (f ∘ (· * j)) x = deriv_sq f (x * j)`, which is what Lemma 3.25 (c) needs. - @[expose] noncomputable def deriv_sq (f: G → ℝ) (x: G) := ∑ s ∈ S, (f (s * x) - f x)^2 - --set_option maxHeartbeats 9000000 in - lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.support.Finite): - ∑' (x: G), ∑ s ∈ S, ((f x * φ x) - (f (s * x) * φ (s * x)))^2 ≤ ∑' (x: G), ∑ s ∈ S, (f x)^2 * (φ (s * x) - φ x)^2 := by - -@@ -97,7 +91,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor - simp - rw [← Finset.sum_neg_distrib] - simp_rw [← tsum_neg] -- ring -+ ring_nf - - have double {a b: ℝ} (hab: a = b): a = (a + b) / 2 := by - rw [hab] -@@ -187,7 +181,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor - field_simp - . simp - . -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - apply Set.Finite.inter_of_right -@@ -201,7 +195,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor - . intro x hx - simp - . -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - apply Set.Finite.inter_of_right -@@ -221,7 +215,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor - arg 2 - intro s - rw [Summable.tsum_add (by -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - apply Set.Finite.inter_of_right -@@ -235,7 +229,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor - . intro x hx - simp - ) (by -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - apply Set.Finite.inter_of_right -@@ -269,7 +263,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor - field_simp - rw [← Summable.tsum_finsetSum] - intro s hs -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - apply Set.Finite.inter_of_right -@@ -285,7 +279,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor - . simp [S_nonempty] - . - intro s hs -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - apply Set.Finite.inter_of_left -@@ -296,7 +290,6 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor - apply Set.Finite.inter_of_right - apply hφ - --#print axioms cutoff_inequality - - -- TODO - can we make WordNorm.instSemiNormedGroup and use norm notation - -diff --git a/Gromov/Defs.lean b/Gromov/Defs.lean -index 87a78bf..ddaa959 100644 ---- a/Gromov/Defs.lean -+++ b/Gromov/Defs.lean -@@ -15,10 +15,6 @@ structure, `LipschitzH` and the convolution API. - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false --set_option linter.style.whitespace false - - open Subgroup - open scoped Finset -@@ -121,19 +117,15 @@ lemma gAct_mul (g h : G) (f: LipschitzH ): gAct (g * h) f = gAct g (gAct h f) := - rw [← mul_assoc] - - --@[expose] --def gAct_const (g: G) (z: ℝ): gAct g (ConstLipschitzH z) = ConstLipschitzH z := by -+theorem gAct_const (g: G) (z: ℝ): gAct g (ConstLipschitzH z) = ConstLipschitzH z := by - unfold gAct - unfold ConstLipschitzH - ext x - simp [DFunLike.coe] - --#synth Module ℝ (LipschitzH) --#synth AddCommGroup (LipschitzH) - - abbrev W := (LipschitzH) ⧸ ConstF - --#synth Module ℝ (W) - - @[expose] - noncomputable def f_n (n: ℕ) (g: G): ℝ := ((1: ℝ) / ((n + 1): ℝ)) * ∑ m: Fin (n + 1), muConv (m.val) g -@@ -276,7 +268,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp - . - intro s hs - apply Summable.mul_left -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - clear foo -@@ -301,7 +293,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp - -- TODO - deduplicate this - intro s hs - apply Summable.mul_left -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - wlog hg: g.support.Finite -@@ -328,7 +320,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp - simp - . - apply Summable.sub -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - . - unfold Function.HasFiniteSupport - simp -@@ -343,7 +335,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp - simp_rw [Finset.mul_sum] - apply summable_sum - intro s hs -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - cases hgf -@@ -366,7 +358,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp - simp_rw [mul_sub] - apply Summable.sub - . -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - cases hgf -@@ -382,7 +374,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp - apply Set.Finite.inter_of_right - apply hg - . -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - unfold Function.HasFiniteSupport - simp - cases hgf -diff --git a/Gromov/Defs/Convolution.lean b/Gromov/Defs/Convolution.lean -index 46685e4..15d5656 100644 ---- a/Gromov/Defs/Convolution.lean -+++ b/Gromov/Defs/Convolution.lean -@@ -12,10 +12,6 @@ The convolution `Conv`, the measure `mu` and its iterates `muConv`, and the `Lp` - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false --set_option linter.style.whitespace false - - open Subgroup - open scoped Finset -@@ -62,12 +58,12 @@ abbrev opAdd (g : G) := Additive.ofMul g - lemma conv_eq_sum {f h: G → ℝ} (hconv: ConvExists f h) (g: G): Conv f h g = ∑' (a : Additive G), f (a) * h (g * (Additive.toMul a)⁻¹) := by - unfold Conv - unfold MeasureTheory.convolution -- rw [MeasureTheory.integral_countable'] -+ rw [MeasureTheory.integral_countable] - . - simp_rw [MeasureTheory.measureReal_def] - unfold myHaarAddOpp - simp_rw [MeasureTheory.Measure.addHaar_singleton] -- simp [MeasureTheory.Measure.addHaarMeasure_self] -+ simp - simp_rw [← singleton_carrier] - simp_rw [TopologicalSpace.PositiveCompacts.carrier_eq_coe] - simp [MeasureTheory.Measure.addHaarMeasure_self] -@@ -205,7 +201,6 @@ lemma mu_finsupp: (mu ).support.Finite := by - simp at foo - exact Finset.nonempty_iff_ne_empty.mp foo - --#print axioms mu_finsupp - - -- Proposition 3.12, item 2, in Vikman - lemma f_conv_mu (f: G → ℝ): (Conv f (mu )) = fun g => ((1 : ℝ) / (#(S) : ℝ)) * ∑ s ∈ S, f (s * g) := by -@@ -257,7 +252,7 @@ lemma f_conv_mu (f: G → ℝ): (Conv f (mu )) = fun g => ((1 : ℝ) / (#(S) : - intro x - rw [Summable.tsum_mul_left (hf := by ( - simp [Pi.single_apply] -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - apply Set.Finite.subset (s := {(opAdd ( x⁻¹ * g ))}) - . simp - . intro z hz -@@ -294,7 +289,7 @@ lemma f_conv_mu (f: G → ℝ): (Conv f (mu )) = fun g => ((1 : ℝ) / (#(S) : - . - -- TODO - deduplicate this - simp [Pi.single_apply] -- apply summable_of_finite_support -+ apply summable_of_hasFiniteSupport - apply Set.Finite.subset (s := {(opAdd (s⁻¹ * g ))}) - . simp - . intro z hz -@@ -312,11 +307,10 @@ lemma f_conv_mu (f: G → ℝ): (Conv f (mu )) = fun g => ((1 : ℝ) / (#(S) : - @[expose] - noncomputable def conv_mu_lp2 (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))): (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G))) := MeasureTheory.MemLp.toLp (Conv f (mu )) (by - rw [MeasureTheory.MemLp] -- refine ⟨MeasureTheory.AEStronglyMeasurable.of_discrete, ?_⟩ - simp [MeasureTheory.eLpNorm, MeasureTheory.eLpNorm'] - rw [f_conv_mu] - simp_rw [Finset.mul_sum] -- have other := MeasureTheory.memLp_finset_sum (μ := MeasureTheory.volume (α := G)) (s := S) (p := 2) (f := fun s a => ((1 : ℝ) / (#(S) : ℝ)) * f (s * a)) (by -+ have other := MeasureTheory.memLp_finsetSum (μ := MeasureTheory.volume (α := G)) (s := S) (p := 2) (f := fun s a => ((1 : ℝ) / (#(S) : ℝ)) * f (s * a)) (by - intro s hs - simp - apply MeasureTheory.MemLp.const_mul -@@ -331,10 +325,11 @@ noncomputable def conv_mu_lp2 (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume - exact mem_f - . apply AEMeasurable.of_discrete - ) -- have sum_norm := other.2 -+ have sum_norm := other.eLpNorm_lt_top - simp [eLpNorm, eLpNorm'] at sum_norm - field_simp at sum_norm - field_simp -+ simp only [AEStronglyMeasurable.of_discrete, ite_true] at sum_norm ⊢ - exact sum_norm - ) - -diff --git a/Gromov/Defs/LipschitzH.lean b/Gromov/Defs/LipschitzH.lean -index c83c23f..89933da 100644 ---- a/Gromov/Defs/LipschitzH.lean -+++ b/Gromov/Defs/LipschitzH.lean -@@ -12,10 +12,6 @@ structure, and finiteness of balls. - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false --set_option linter.style.whitespace false - - open Subgroup - open scoped Finset -@@ -149,7 +145,6 @@ instance lipschitzSMul: SMul ℝ (LipschitzH) := { - rw [mul_eq_mul_left_iff] - left - have hf := f.harmonic x -- unfold Harmonic at hf - simp at hf - field_simp at hf - exact hf -@@ -216,7 +211,6 @@ instance LipschitzH.addMonoid [Generates ] : AddMonoid (LipschitzH) := { - ext g - show (((n + 1 : ℕ) : ℝ) • f).toFun g = (((n : ℕ) : ℝ) • f).toFun g + f.toFun g - simp [lipschitz_smul_tofun] -- push_cast - ring - } - -@@ -231,32 +225,30 @@ instance LipschitzH.instAddCommGroup: AddCommGroup (LipschitzH) := { - sub_eq_add_neg := by - intro f h - ext g -- simp [lipschitz_sub_tofun, lipschitz_add_tofun, lipschitz_neg_tofun] -+ simp [lipschitz_sub_tofun, lipschitz_neg_tofun] - rfl - zsmul := fun n f => (n : ℝ) • f - zsmul_zero' := by - intro f - ext g -- simp only [HSMul.hSMul, SMul.smul, DFunLike.coe, Int.cast_zero, zero_mul] -+ simp only [HSMul.hSMul, SMul.smul, Int.cast_zero, zero_mul] - rfl - neg_add_cancel := by - intro f - ext g -- simp [negLipschitzH] -+ simp - rfl - zsmul_succ' := by - intro n f - ext g - show (((n + 1 : ℕ) : ℝ) • f).toFun g = (((n : ℕ) : ℝ) • f).toFun g + f.toFun g - simp [lipschitz_smul_tofun] -- push_cast - ring - zsmul_neg' := by - intro n hn - ext g - show ((Int.negSucc n : ℝ) • hn).toFun g = -((((n + 1 : ℕ) : ℝ)) • hn).toFun g - simp [lipschitz_smul_tofun] -- push_cast - ring - } - -@@ -309,12 +301,12 @@ instance lipschitzHVectorSpace : Module ℝ (LipschitzH) := { - zero_smul := by - intro a - ext g -- simp [HSMul.hSMul, SMul.smul, DFunLike.coe] -+ simp [HSMul.hSMul, SMul.smul] - } - - lemma finite_ball (x: G) (r: ℝ): Set.Finite (Metric.ball x r) := Set.Finite.of_finite_image (f := fun a => (word_norm_prod_self a).choose) (by - have foo := List.finite_length_le S (WordNorm x + ⌈r⌉₊) -- rw [← Set.finite_coe_iff, Set.coe_setOf] at foo -+ rw [← Set.finite_coe_iff, Set.coe_ofPred] at foo - apply Finite.of_injective (β := {l : List S // l.length ≤ WordNorm x + ⌈r⌉₊}) (fun a => ⟨a.val, by ( - have ha := a.prop - simp [-Subtype.coe_prop] at ha -@@ -349,7 +341,7 @@ lemma finite_ball (x: G) (r: ℝ): Set.Finite (Metric.ball x r) := Set.Finite.of - -- TODO - deduplicate 99% of this with finite_ball - lemma finite_closed_ball (x: G) (r: ℝ): Set.Finite (Metric.closedBall x r) := Set.Finite.of_finite_image (f := fun a => (word_norm_prod_self a).choose) (by - have foo := List.finite_length_le S (WordNorm x + ⌈r⌉₊) -- rw [← Set.finite_coe_iff, Set.coe_setOf] at foo -+ rw [← Set.finite_coe_iff, Set.coe_ofPred] at foo - apply Finite.of_injective (β := {l : List S // l.length ≤ WordNorm x + ⌈r⌉₊}) (fun a => ⟨a.val, by ( - have ha := a.prop - simp [-Subtype.coe_prop] at ha -diff --git a/Gromov/Defs/Measure.lean b/Gromov/Defs/Measure.lean -index 02450ef..2cf42d0 100644 ---- a/Gromov/Defs/Measure.lean -+++ b/Gromov/Defs/Measure.lean -@@ -12,10 +12,6 @@ measure-space instances and the resulting a.e.-triviality lemmas. - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false --set_option linter.style.whitespace false - - open Subgroup - open scoped Finset -@@ -146,7 +142,6 @@ lemma singleton_pairwise_disjoint {T: Type*} (s: Set (T)) : s.PairwiseDisjoint S - - - -- Use the fact that we have the discrete topology --set_option maxHeartbeats 500000 in - lemma my_add_haar_eq_count: (myHaarAddOpp) = MeasureTheory.Measure.count := by - ext s hs - by_cases s_finite: Set.Finite s -@@ -256,8 +251,7 @@ lemma count_ae_everywhere (p: G → Prop): (∀ᵐ g ∂(MeasureTheory.Measure.c - simp [MeasureTheory.Measure.count_eq_zero_iff] - -- TODO - there has to be a much simpler way of proving this - refine ⟨?_, ?_⟩ -- . intro h -- intro a -+ . intro h a - by_contra this - have a_in: a ∈ {a | ¬ p a} := by - simp [this] -diff --git a/Gromov/Defs/WordMetric.lean b/Gromov/Defs/WordMetric.lean -index 4746cfe..e9393b4 100644 ---- a/Gromov/Defs/WordMetric.lean -+++ b/Gromov/Defs/WordMetric.lean -@@ -13,10 +13,6 @@ instance. - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false --set_option linter.style.whitespace false - - open Subgroup - open scoped Finset -@@ -99,7 +95,7 @@ lemma mem_S_prod_list (x: G): ∃ l: List S, ProdS x l := by - -- https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Group.20.28.2FMonoid.2Fetc.29.20closures.20are.20a.20finite.20product.2Fsum/near/477951441 - have foo := Submonoid.exists_list_of_mem_closure (s := S ∪ S⁻¹) (x := x) - rw [← Subgroup.closure_toSubmonoid _] at foo -- simp only [mem_toSubmonoid, Finset.mem_coe] at foo -+ simp only [mem_toSubmonoid] at foo - specialize foo (mem_closure x) - norm_cast at foo - rw [s_union_sinv] at foo -@@ -123,7 +119,7 @@ lemma word_norm_prod (g: G) (n: ℕ) (hgn: WordNorm g = n): ∃ l: List S, ProdS - unfold ProdS at hl - rw [Set.nonempty_def] at foo - specialize foo ⟨l.length, ⟨l, ⟨by simp, hl⟩⟩⟩ -- simp only [Set.mem_setOf_eq] at foo -+ simp only [Set.mem_ofPred_eq] at foo - obtain ⟨l, ⟨hl, hl_prod⟩⟩ := foo - rw [← hgn] - exact ⟨l, ⟨hl_prod, hl⟩⟩ -@@ -147,7 +143,7 @@ lemma WordDist_self (x: G): WordDist x x = 0 := by - unfold WordDist - rw [mul_inv_cancel] - unfold WordNorm -- simp only [Nat.sInf_eq_zero, Set.mem_setOf_eq, List.length_eq_zero_iff, exists_eq_left] -+ simp only [Nat.sInf_eq_zero, Set.mem_ofPred_eq, List.length_eq_zero_iff, exists_eq_left] - left - rfl - -@@ -228,7 +224,7 @@ lemma word_norm_eq_zero {x y: G} (hdist: WordDist x y = 0): x = y := by - unfold ProdS at hl - have len_in_set: l.unattach.length ∈ (∅ : Set ℕ) := by - rw [← empty_set] -- simp only [List.length_unattach, Set.mem_setOf_eq] -+ simp only [List.length_unattach, Set.mem_ofPred_eq] - use l - refine ⟨rfl, hl⟩ - simp only [Set.mem_empty_iff_false] at len_in_set -@@ -356,7 +352,7 @@ lemma dist_word_le_mul {x y z : G} (hy: y ∈ S): WordDist x z ≤ (WordDist x ( - rw [mul_inv_eq_one] at l_prod - grind - | h::tail => -- use [ ⟨y⁻¹, by simp [hGS.has_inv, hy]⟩, ⟨h.val, by simp [hGS.has_inv]⟩,] ++ tail -+ use [ ⟨y⁻¹, by simp [hGS.has_inv, hy]⟩, ⟨h.val, by simp⟩,] ++ tail - simp [ProdS] - simp [← l_len] - simp [ProdS] at l_prod -diff --git a/Gromov/FormalConjecturesCheck.lean b/Gromov/FormalConjecturesCheck.lean -index 6c8c31e..52e4b65 100644 ---- a/Gromov/FormalConjecturesCheck.lean -+++ b/Gromov/FormalConjecturesCheck.lean -@@ -1,6 +1,7 @@ - module - - public import Gromov.Gromov -+public import Gromov.PolynomialGrowth - - /-! - # Cross-check of `main_gromov_theorem` against the `formal-conjectures` statement -@@ -34,34 +35,32 @@ public section - - set_option linter.style.longLine false - -+@[instance_reducible] -+private noncomputable def generatorsData {G : Type*} (gg : Group G) (de : DecidableEq G) -+ (T : Finset G) (hT : Nonempty T) -+ (hgen : (@Subgroup.closure G gg (T : Set G) : Set G) = Set.univ) -+ (h1 : @OfNat.ofNat G 1 (@One.toOfNat1 G gg.toOne) ∈ T) -+ (hinv : ∀ g ∈ T, @Inv.inv G gg.toInv g ∈ T) -+ (hi : Infinite G) (hp : @HasPolynomialGrowth G gg de T) : Generates := -+ @Generates.mk G gg de T hT hgen h1 hinv hi hp -+ -+private theorem gromovOfGeneratorData {G : Type*} (gg : Group G) (de : DecidableEq G) -+ (T : Finset G) (hT : Nonempty T) -+ (hgen : (@Subgroup.closure G gg (T : Set G) : Set G) = Set.univ) -+ (h1 : @OfNat.ofNat G 1 (@One.toOfNat1 G gg.toOne) ∈ T) -+ (hinv : ∀ g ∈ T, @Inv.inv G gg.toInv g ∈ T) -+ (hi : Infinite G) (hp : @HasPolynomialGrowth G gg de T) : -+ @Group.IsVirtuallyNilpotent G gg := by -+ let inst := generatorsData gg de T hT hgen h1 hinv hi hp -+ obtain ⟨n, hn⟩ := hp -+ exact GeneratesNS.main_gromov_theorem (hGS := inst) n hn -+ - namespace FormalConjecturesCheck - - open scoped Pointwise - - variable {G : Type*} [Group G] - --/-! ### Definitions copied from `formal-conjectures` -/ -- --/-- The `CayleyBall` is the ball of radius `n` in the Cayley graph of a group `G` with generating --set `S`. -/ --@[expose] --def CayleyBall (S : Set G) (n : ℕ) : Set G := -- {g : G | ∃ (l : List G), l.length ≤ n ∧ (∀ s ∈ l, s ∈ S ∨ s⁻¹ ∈ S) ∧ l.prod = g} -- --/-- The `GrowthFunction` of a group `G` with respect to a set `S` counts the number of group --elements that can be reached by words of length at most `n` in `S`. -/ --@[expose] --noncomputable def GrowthFunction (S : Set G) (n : ℕ) : ℕ := -- (CayleyBall S n).ncard -- --/-- A group has polynomial growth if there exists a finite generating set whose growth function is --bounded above by a polynomial. -/ --@[expose] --def HasPolynomialGrowth (G : Type*) [Group G] : Prop := -- ∃ (S : Set G), Set.Finite S ∧ Subgroup.closure S = ⊤ ∧ -- ∃ (C : ℝ) (d : ℕ), C > 0 ∧ -- ∀ n > 0, (GrowthFunction S n : ℝ) ≤ C * (n : ℝ) ^ d -- - /-! ### Normalizing the generating set -/ - - variable [DecidableEq G] -@@ -145,41 +144,59 @@ lemma card_normGen_pow (S : Set G) (hS : S.Finite) (n : ℕ) : - - /-! ### The forward direction of the reference statement -/ - --set_option maxHeartbeats 1000000 in -+private lemma normGen_polynomial (S : Set G) (hSfin : S.Finite) (C : ℝ) (d : ℕ) -+ (hbound : ∀ n : ℕ, 0 < n → (GrowthFunction S n : ℝ) ≤ C * (n : ℝ) ^ d) : -+ HasPolynomialGrowthD (normGen S hSfin) d := by -+ refine ⟨⌈C⌉₊, fun n hn => ?_⟩ -+ have hcard : ((normGen S hSfin) ^ n).card = GrowthFunction S n := card_normGen_pow S hSfin n -+ have hb := hbound n (by omega) -+ rw [← hcard] at hb -+ have h : (((normGen S hSfin) ^ n).card : ℝ) ≤ (⌈C⌉₊ : ℝ) * (n : ℝ) ^ d := -+ hb.trans (by gcongr; exact Nat.le_ceil C) -+ exact_mod_cast h -+ -+private lemma normGen_generates (S : Set G) (hSfin : S.Finite) -+ (hSgen : Subgroup.closure S = ⊤) : -+ (Subgroup.closure (normGen S hSfin : Set G) : Set G) = ⊤ := by -+ have hclosure : Subgroup.closure ((normGen S hSfin : Finset G) : Set G) = ⊤ := by -+ rw [eq_top_iff, ← hSgen] -+ exact Subgroup.closure_mono (subset_normGen S hSfin) -+ rw [hclosure] -+ rfl -+ -+private theorem normalized_data (S : Set G) (hSfin : S.Finite) -+ (hSgen : Subgroup.closure S = ⊤) (C : ℝ) (d : ℕ) -+ (hbound : ∀ n : ℕ, 0 < n → (GrowthFunction S n : ℝ) ≤ C * (n : ℝ) ^ d) : -+ ∃ T : Finset G, Nonempty T ∧ -+ (Subgroup.closure (T : Set G) : Set G) = Set.univ ∧ -+ (1 : G) ∈ T ∧ (∀ g ∈ T, g⁻¹ ∈ T) ∧ _root_.HasPolynomialGrowth T := by -+ refine ⟨normGen S hSfin, ⟨⟨1, one_mem_normGen S hSfin⟩⟩, -+ normGen_generates S hSfin hSgen, one_mem_normGen S hSfin, -+ fun _ hg => inv_mem_normGen S hSfin hg, d, ?_⟩ -+ exact normGen_polynomial S hSfin C d hbound -+ -+omit [Group G] [DecidableEq G] in -+private theorem infinite_forward (gg : Group G) (de : DecidableEq G) (S : Set G) -+ (hSfin : S.Finite) (hSgen : @Subgroup.closure G gg S = ⊤) (hinf : Infinite G) -+ (C : ℝ) (d : ℕ) -+ (hbound : ∀ n : ℕ, 0 < n → (@GrowthFunction G gg S n : ℝ) ≤ C * (n : ℝ) ^ d) : -+ @Group.IsVirtuallyNilpotent G gg := by -+ obtain ⟨T, hT, hgen, h1, hinv, hp⟩ := @normalized_data G gg de S hSfin hSgen C d hbound -+ exact @gromovOfGeneratorData G gg de T hT hgen h1 hinv hinf hp -+ -+omit [Group G] [DecidableEq G] in - /-- **The forward direction of `GromovPolynomialGrowth.GromovPolynomialGrowthTheorem`**, derived - from `GeneratesNS.main_gromov_theorem`: a finitely generated group of polynomial growth (in the - `formal-conjectures` formulation) is virtually nilpotent. -/ --theorem gromov_forward (G : Type*) [Group G] (h : HasPolynomialGrowth G) : -+theorem gromov_forward (G : Type*) [gg : Group G] (h : @HasPolynomialGrowth G gg) : - Group.IsVirtuallyNilpotent G := by - classical -- letI dec : DecidableEq G := Classical.decEq G - obtain ⟨S, hSfin, hSgen, C, d, hC, hbound⟩ := h - rcases finite_or_infinite G with hfin | hinf - · exact GeneratesNS.finite_virtually_nilpotent -- · have hclosure : Subgroup.closure ((normGen S hSfin : Finset G) : Set G) = ⊤ := by -- rw [eq_top_iff, ← hSgen] -- exact Subgroup.closure_mono (subset_normGen S hSfin) -- have hgrowth : HasPolynomialGrowthD (normGen S hSfin) d := by -- refine ⟨⌈C⌉₊, fun n hn => ?_⟩ -- have hcard : ((normGen S hSfin) ^ n).card = GrowthFunction S n := card_normGen_pow S hSfin n -- have hb := hbound n (by omega) -- rw [← hcard] at hb -- have : (((normGen S hSfin) ^ n).card : ℝ) ≤ (⌈C⌉₊ : ℝ) * (n : ℝ) ^ d := -- hb.trans (by gcongr; exact Nat.le_ceil C) -- exact_mod_cast this -- letI inst : Generates := -- { G := G -- g_group := ‹Group G› -- g_eq := dec -- S := normGen S hSfin -- hS := ⟨⟨1, one_mem_normGen S hSfin⟩⟩ -- generates := by rw [hclosure]; simp -- one_mem := one_mem_normGen S hSfin -- has_inv := fun _ hg => inv_mem_normGen S hSfin hg -- g_infinite := hinf -- g_growth := ⟨d, hgrowth⟩ } -- exact GeneratesNS.main_gromov_theorem (hGS := inst) d hgrowth -+ · exact infinite_forward gg (inferInstance : DecidableEq G) S hSfin hSgen hinf C d hbound - -+omit [Group G] [DecidableEq G] in - /-- The forward direction with the reference statement's exact signature, including the - `[Group.FG G]` hypothesis. That hypothesis is redundant here: `HasPolynomialGrowth G` already - supplies a finite generating set, so `gromov_forward` proves the same conclusion without it. -/ -diff --git a/Gromov/Gromov.lean b/Gromov/Gromov.lean -index 985ce00..bfc3ce3 100644 ---- a/Gromov/Gromov.lean -+++ b/Gromov/Gromov.lean -@@ -14,7 +14,6 @@ public section - - set_option linter.style.longLine false - set_option linter.style.cdot false --set_option linter.style.commandStart false - - open Subgroup - open scoped Finset -@@ -29,9 +28,7 @@ include hGS - - open scoped RealInnerProductSpace - --set_option synthInstance.maxHeartbeats 500000 - --set_option maxHeartbeats 1000000 - - open MeasureTheory - -@@ -39,12 +36,445 @@ open Additive - - attribute [local implicit_reducible] Additive Multiplicative - --set_option maxHeartbeats 2500000 in -+private def kernelInclusion (data : Theorem3_1_Input G) : -+ Multiplicative data.φ.ker →* data.G' := -+ AddMonoidHom.toMultiplicativeLeft data.φ.ker.subtype -+ -+private def kernelValue (data : Theorem3_1_Input G) -+ (N : Subgroup (Multiplicative data.φ.ker)) : N →* data.G' := -+ (AddMonoidHom.toMultiplicativeLeft data.φ.ker.subtype).comp N.subtype -+ -+private lemma conjugate_product_wordNorm (x y : G) (Lx Ly a b k : ℕ) -+ (hx : WordNorm x ≤ Lx) (hy : WordNorm y ≤ Ly) -+ (hk : 0 < k) (hb : 0 < b) (s : Finset (Finset.Ico a b)) : -+ WordNorm ((s.toList.map (fun i => y ^ (k * i.val) * x * -+ (y ^ (k * i.val))⁻¹)).prod) ≤ (b-a) * (max Lx Ly * (4*k*b)) := by -+ have hterm (i : Finset.Ico a b) : -+ WordNorm (y ^ (k*i.val) * x * (y ^ (k*i.val))⁻¹) ≤ -+ max Lx Ly * (4*k*b) := by -+ have hp : WordNorm (y ^ (k*i.val)) ≤ k*b*max Lx Ly := by -+ calc -+ _ ≤ (k*i.val) * WordNorm y := word_norm_pow _ _ -+ _ ≤ (k*b) * max Lx Ly := by gcongr; exact le_of_lt (Finset.mem_Ico.mp i.property).2; exact hy.trans (le_max_right _ _) -+ have h1 := word_norm_mul_le (hGS := hGS) (y ^ (k*i.val) * x) ((y ^ (k*i.val))⁻¹) -+ have h2 := word_norm_mul_le (hGS := hGS) (y ^ (k*i.val)) x -+ rw [← word_norm_inv (hGS := hGS)] at h1 -+ have hx' := hx.trans (le_max_left Lx Ly) -+ have hkb : 1 ≤ k*b := one_le_mul (by omega) (by omega) -+ have hM := Nat.mul_le_mul_left (max Lx Ly) hkb -+ nlinarith -+ calc -+ _ ≤ ((s.toList.map (fun i => y ^ (k*i.val) * x * -+ (y ^ (k*i.val))⁻¹)).map WordNorm).sum := word_norm_list_prod_le _ -+ _ ≤ (s.toList.map (fun _ => max Lx Ly * (4*k*b))).sum := by -+ rw [List.map_map] -+ exact List.sum_le_sum (fun i _ => hterm i) -+ _ = s.card * (max Lx Ly * (4*k*b)) := by simp -+ _ ≤ (b-a) * (max Lx Ly * (4*k*b)) := by -+ apply Nat.mul_le_mul_right -+ simpa using Finset.card_le_univ s -+ -+private lemma conjugate_subproducts_growth (data : Theorem3_1_Input G) -+ (N' : Subgroup (Multiplicative data.φ.ker)) (γ : Additive data.G') -+ (hγ : data.φ γ = 1) (gamma_conj_N' : MulAut N') -+ (conj_mem_ker : ∀ (n : ℕ) (g : N'), -+ Additive.ofMul (Additive.toMul γ ^ n * kernelValue data N' g * -+ (Additive.toMul γ ^ n)⁻¹) ∈ data.φ.ker) -+ (conj_mem_N' : ∀ (n : ℕ) (g : N'), -+ (Multiplicative.ofAdd (⟨Additive.ofMul (Additive.toMul γ ^ n * kernelValue data N' g * -+ (Additive.toMul γ ^ n)⁻¹), conj_mem_ker n g⟩ : data.φ.ker)) ∈ N') -+ (gamma_conj_iter : ∀ (n : ℕ) (g : N'), gamma_conj_N'^[n] g = -+ ⟨Multiplicative.ofAdd (⟨Additive.ofMul (Additive.toMul γ ^ n * kernelValue data N' g * -+ (Additive.toMul γ ^ n)⁻¹), conj_mem_ker n g⟩ : data.φ.ker), conj_mem_N' n g⟩) : -+∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → ((Finset.image (fun x ↦ (List.map (fun (i: Finset.Ico a b) ↦ (gamma_conj_N')^[k * ↑i] g) x.toList).prod)) -+ (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q := by -+ let N'_val := kernelValue data N' -+ -+ -+ have s_poly := hGS.g_growth -+ unfold HasPolynomialGrowth at s_poly -+ obtain ⟨q, hq⟩ := s_poly -+ unfold HasPolynomialGrowthD at hq -+ obtain ⟨p, hp⟩ := hq -+ intro k k_pos x -+ -+ -+ obtain ⟨x_list, x_prod, x_list_prod⟩ := -+ word_norm_prod_self (hGS := hGS) x.val.toAdd.val.toMul.val -+ obtain ⟨gamma_list, gamma_prod, gamma_list_prod⟩ := -+ word_norm_prod_self (hGS := hGS) (Additive.toMul γ).val -+ -+ -+ -- `(hGS := hGS)` is required: `new_generates` shadows the ambient instance here, -+ -- so a bare `S` would resolve to `new_generates.S`. -+ have p_pos: 0 < p := growth_const_pos (hGS := hGS) hp -+ -+ have q_pos: 0 < q := growth_exponent_pos (hGS := hGS) ⟨p, hp⟩ -+ use p * (((max x_list.length gamma_list.length) * (4 * k)) ^ q) -+ use q -+ -+ -+ have gamma_len_pos: 1 ≤ gamma_list.length := by -+ by_contra! -+ simp at this -+ simp [ProdS, this] at gamma_prod -+ have gamma_eq: γ = 0 := by -+ have gamma_coe := Subtype.coe_eq_of_eq_mk gamma_prod.symm -+ apply_fun (fun a => Additive.ofMul a) at gamma_coe -+ rw [ofMul_toMul] at gamma_coe -+ exact gamma_coe -+ simp [gamma_eq] at hγ -+ -+ refine ⟨?_, ?_⟩ -+ . -+ apply mul_pos -+ . exact p_pos -+ . -+ rw [pow_pos_iff] -+ . -+ positivity -+ . grind -+ -+ -+ intro b hb a ha hab -+ -+ have mul_nozero: 1 ≤ 2 * k * b := by -+ rw [mul_assoc] -+ apply one_le_mul -+ . simp -+ . apply one_le_mul -+ . grind -+ . grind -+ -+ -+ grw [← Finset.card_image_of_injOn (f := fun a => a.val.toAdd.val.toMul.val) (by simp)] -+ grw [Finset.card_le_card (t := hGS.S^((b - a) * ((max x_list.length gamma_list.length) * (4 * k * b)) ))] -+ · -+ -+ grw [hp] -+ . -+ rw [mul_pow] -+ ring_nf -+ simp -+ . -+ simp -+ apply one_le_mul -+ . grind -+ . -+ rw [Nat.one_le_iff_ne_zero, ← Nat.pos_iff_ne_zero] -+ -+ -+ positivity -+ -- side goal from `card_le_card`: the image is contained in `hGS.S` -+ · -+ let f : N' →* G := data.G'.subtype.comp (kernelValue data N') -+ have hf (n : ℕ) (g : N') : f (gamma_conj_N'^[n] g) = -+ (Additive.toMul γ).val ^ n * f g * ((Additive.toMul γ).val ^ n)⁻¹ := by -+ rw [gamma_conj_iter] -+ rfl -+ intro g hg -+ obtain ⟨z, hz, rfl⟩ := Finset.mem_image.mp hg -+ obtain ⟨s, hs, rfl⟩ := Finset.mem_image.mp hz -+ change f ((s.toList.map (fun i : Finset.Ico a b => gamma_conj_N'^[k*i.val] x)).prod) ∈ _ -+ rw [map_list_prod, List.map_map] -+ simp only [Function.comp_def] -+ simp_rw [hf] -+ rw [← closed_ball_eq_S_pow (hGS := hGS)] -+ simp only [Set.Finite.mem_toFinset, Metric.mem_closedBall, dist, WordDist_one] -+ norm_cast -+ exact conjugate_product_wordNorm (hGS := hGS) (f x) (Additive.toMul γ).val -+ x_list.length gamma_list.length a b k -+ (by change WordNorm x.val.toAdd.val.toMul.val ≤ _; rw [← x_list_prod]) -+ (by rw [← gamma_list_prod]) k_pos hb s -+ -+ -+ -+omit hGS in -+private lemma cyclic_kernel_sup {D : Type*} [Group D] -+ (φ : Additive D →+ ℤ) (γ : Additive D) (hγ : φ γ = 1) : -+ Subgroup.closure {γ.toMul} ⊔ φ.ker.toSubgroup' = ⊤ := by -+ apply top_unique -+ intro g _ -+ let z := φ (Additive.ofMul g) -+ have hk : Additive.toMul (-(z • γ) + Additive.ofMul g) ∈ φ.ker.toSubgroup' := by -+ change φ (-(z • γ) + Additive.ofMul g) = 0 -+ simp [z, hγ] -+ have ht : Additive.toMul (z • γ) ∈ Subgroup.closure {γ.toMul} := by -+ rw [Subgroup.mem_closure_singleton] -+ exact ⟨z, by simp⟩ -+ have he : g = Additive.toMul (z • γ) * -+ Additive.toMul (-(z • γ) + Additive.ofMul g) := by -+ rw [← toMul_add, add_neg_cancel_left] -+ rfl -+ rw [he] -+ exact Subgroup.mul_mem _ (Subgroup.mem_sup_left ht) (Subgroup.mem_sup_right hk) -+ -+private lemma cyclic_kernel_finiteIndex (data : Theorem3_1_Input G) -+ (γ : Additive data.G') (hγ : data.φ γ = 1) -+ (N' : Subgroup (Multiplicative data.φ.ker)) [N'.FiniteIndex] -+ (N'_fg : ∃ T : Finset (Multiplicative data.φ.ker), Subgroup.closure (↑T) = N') (α : ℕ) (alpha_nonzero : α ≠ 0) -+ (hinv : ∀ {n : ℕ}, ∀ b ∈ Subgroup.closure {γ.toMul ^ n}, -+ ∀ a ∈ Subgroup.map (kernelInclusion data) (Subgroup.closure (↑N'_fg.choose)), -+ b * a * b⁻¹ ∈ Subgroup.map (kernelInclusion data) (Subgroup.closure (↑N'_fg.choose))) : -+ (Subgroup.map data.G'.subtype -+ (Subgroup.closure (↑(Finset.image (kernelInclusion data) N'_fg.choose) ∪ -+ {γ.toMul ^ α}))).FiniteIndex := by -+ let new_N'_map := kernelInclusion data -+ have map_N'_invariant_gamma {n : ℕ} := hinv (n := n) -+ have map_N'_invariant_gamma_one := map_N'_invariant_gamma (n := 1) -+ simp only [pow_one] at map_N'_invariant_gamma_one -+ rw [Subgroup.finiteIndex_iff] -+ rw [Subgroup.index_map] -+ simp -+ refine ⟨?_, ?_⟩ -+ . -+ -+ simp_rw [Set.insert_eq] -+ -+ have gamma_alpha_le_gamma: (Subgroup.closure ({toMul γ ^ α} ∪ (new_N'_map '' (N'_fg.choose)) )) ≤ (Subgroup.closure ({toMul γ} ∪ (new_N'_map '' (N'_fg.choose)))) := by -+ simp -+ intro g hg -+ rw [Set.insert_eq] -+ cases hg -+ . rename_i g_eq_gamma -+ rw [Subgroup.closure_union] -+ apply Subgroup.mem_sup_left -+ rw [Subgroup.mem_closure_singleton] -+ use α -+ rw [g_eq_gamma] -+ simp -+ . rename_i g_mem_map -+ rw [Subgroup.closure_union] -+ apply Subgroup.mem_sup_right -+ apply Subgroup.mem_closure_of_mem -+ exact g_mem_map -+ -+ conv => -+ arg 1 -+ arg 1 -+ arg 1 -+ arg 1 -+ arg 2 -+ equals (new_N'_map '' (N'_fg.choose)) => rfl -+ rw [← Subgroup.relIndex_mul_index gamma_alpha_le_gamma] -+ simp -+ refine ⟨?_, ?_⟩ -+ . -+ unfold Subgroup.relIndex -+ rw [← ne_eq] -+ rw [← Subgroup.finiteIndex_iff] -+ apply Subgroup.finiteIndex_of_rightCoset_cover_const (s := Finset.Ioo (-α : ℤ) (α)) (g := fun a => ⟨a • γ, (by -+ rw [Set.insert_eq, Subgroup.closure_union] -+ apply Subgroup.mem_sup_left -+ rw [Subgroup.mem_closure_singleton] -+ use a -+ rfl -+ )⟩) -+ ext g -+ simp -+ have g_prop := g.property -+ simp_rw [Set.insert_eq, Subgroup.closure_union] at g_prop -+ rw [← MonoidHom.map_closure] at g_prop -+ simp at g_prop -+ rw [← SetLike.mem_coe] at g_prop -+ rw [sup_comm] at g_prop -+ -+ -+ rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ -+ (Subgroup.le_normalizer_of_conj_mem map_N'_invariant_gamma_one)] at g_prop -+ rw [Set.mem_mul] at g_prop -+ obtain ⟨b, hb, a, ha, g_eq⟩ := g_prop -+ simp at ha -+ rw [Subgroup.mem_closure_singleton] at ha -+ obtain ⟨z, hz⟩ := ha -+ use z % α -+ refine ⟨?_, ?_⟩ -+ . -+ have foo := Int.emod_lt_abs z (b := α) (by grind) -+ rw [lt_abs] at foo -+ refine ⟨?_, ?_⟩ -+ . -+ have bar := Int.emod_nonneg z (b := α) (by simpa using alpha_nonzero) -+ grind -+ . grind -+ . -+ rw [Set.mem_smul_set] -+ use ⟨(Additive.ofMul b) + (((α : ℤ) * (z / (α : ℤ))) • γ), ?_⟩ -+ . -+ refine ⟨?_, ?_⟩ -+ . -+ simp -+ rw [Subgroup.mem_subgroupOf] -+ simp_rw [Set.insert_eq, Subgroup.closure_union] -+ rw [← SetLike.mem_coe] -+ rw [sup_comm] -+ rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by -+ simp_rw [← MonoidHom.map_closure] -+ apply map_N'_invariant_gamma -+ ))] -+ apply Set.mul_mem_mul -+ . -+ simp -+ rw [← MonoidHom.map_closure] -+ exact hb -+ . -+ simp -+ rw [Subgroup.mem_closure_singleton] -+ use (z / (α : ℤ)) -+ conv => -+ lhs -+ arg 1 -+ equals toMul γ ^ (α : ℤ) => -+ simp -+ -+ rw [← zpow_mul] -+ . -+ simp -+ rw [Subtype.ext_iff] -+ simp -+ rw [← g_eq, ←hz] -+ nth_rw 3 [← Int.mul_ediv_add_emod (a := z) (b := α)] -+ rw [← toMul_zsmul] -+ conv => -+ lhs -+ equals (ofMul b) + ((↑α * (z / ↑α)) • γ) + ((z % ↑α) • γ) => -+ rfl -+ -+ -+ rw [add_zsmul] -+ rw [add_assoc] -+ rfl -+ . -+ simp_rw [Set.insert_eq, Subgroup.closure_union] -+ rw [sup_comm] -+ rw [← SetLike.mem_coe] -+ -+ rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by -+ simp_rw [← MonoidHom.map_closure] -+ apply map_N'_invariant_gamma_one -+ ))] -+ apply Set.mul_mem_mul -+ . -+ simp -+ rw [← MonoidHom.map_closure] -+ exact hb -+ . -+ simp [Subgroup.mem_closure_singleton] -+ . -+ obtain ⟨s, s_compl, s_cosets⟩ := Subgroup.exists_leftTransversal_of_FiniteIndex (D := N') (H := ⊤) (by simp) -+ simp at s_cosets -+ -+ rw [← ne_eq] -+ rw [← Subgroup.finiteIndex_iff] -+ apply Subgroup.finiteIndex_of_leftCoset_cover_const (s := s) (g := fun g => g.val.val.toMul) -+ simp_rw [Set.insert_eq, Subgroup.closure_union] -+ rename_bvar i → g -+ -+ -+ conv => -+ arg 1 -+ arg 1 -+ intro i -+ arg 1 -+ intro hi -+ rw [sup_comm] -+ rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by -+ intro gamma_pow h_gamma_pow n hn -+ simp_rw [← MonoidHom.map_closure] at hn -+ simp_rw [← MonoidHom.map_closure] -+ apply map_N'_invariant_gamma_one _ h_gamma_pow _ hn -+ ))] -+ rw [set_smul_eq_mul] -+ rw [← mul_assoc] -+ rw [← set_smul_eq_mul] -+ -+ -+ simp_rw [← Set.iUnion_mul] -+ conv => -+ arg 1 -+ arg 1 -+ equals Additive.toMul '' data.φ.ker => -+ apply_fun (fun s => Additive.toMul '' (Subtype.val '' s)) at s_cosets -+ conv at s_cosets => -+ rhs -+ equals Additive.toMul '' data.φ.ker => -+ ext a -+ simp -+ rw [← s_cosets] -+ conv => -+ arg 1 -+ arg 1 -+ intro i -+ arg 1 -+ intro hi -+ arg 2 -+ -+ simp_rw [← MonoidHom.map_closure] -+ -+ simp only [Set.image_image] -+ erw [Set.image_iUnion₂] -+ apply Set.iUnion_congr -+ intro i -+ apply Set.iUnion_congr -+ intro hi -+ ext z -+ simp only [coe_map] -+ rw [Set.mem_smul_set] -+ rw [Set.mem_image] -+ refine ⟨?_, ?_⟩ -+ . -+ intro hy -+ obtain ⟨a, ha⟩ := hy -+ have foo := ha.1 -+ rw [Set.mem_image] at foo -+ obtain ⟨b, b_mem, a_eq_b⟩ := foo -+ have N'_gen := N'_fg.choose_spec -+ rw [N'_gen] at b_mem -+ refine ⟨(↑i : Multiplicative ↥data.φ.ker) • b, Set.smul_mem_smul_set b_mem, ?_⟩ -+ rw [← ha.2, ← a_eq_b] -+ rfl -+ . -+ intro hx -+ obtain ⟨x, hx, x_eq⟩ := hx -+ erw [Set.mem_smul_set] at hx -+ obtain ⟨n, hn, x_eq_n⟩ := hx -+ refine ⟨new_N'_map n, ?_, ?_⟩ -+ . -+ rw [Set.mem_image] -+ have N'_gen := N'_fg.choose_spec -+ rw [← N'_gen] at hn -+ exact ⟨n, hn, rfl⟩ -+ . rw [← x_eq, ← x_eq_n] -+ rfl -+ -+ -+ conv => -+ arg 1 -+ lhs -+ equals ↑data.φ.ker.toSubgroup' => -+ ext a -+ simp -+ -+ rw [← Subgroup.coe_mul_of_right_le_normalizer_left _ _] -+ . -+ simpa [sup_comm] using cyclic_kernel_sup data.φ γ hγ -+ . -+ apply Subgroup.le_normalizer_of_conj_mem -+ intro b hb a ha -+ rw [Subgroup.mem_closure_singleton] at hb -+ obtain ⟨n, b_eq⟩ := hb -+ simp [← b_eq] -+ simp at ha -+ exact ha -+ . have foo := data.finite_index -+ rw [Subgroup.finiteIndex_iff] at foo -+ exact foo -+ - omit hGS in - lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) (hd: 1 ≤ d) (h_growth: HasPolynomialGrowthD S d) - (inductive_gromov: ∀ (Q_generates: Generates.{u}),(Q_growth : (HasPolynomialGrowthD (Q_generates.S)) (d - 1)) → Group.IsVirtuallyNilpotent Q_generates.G) - : Group.IsVirtuallyNilpotent G := by -- letI inst_dec_G : DecidableEq G := G_dec_eq -+ let inst_dec_G : DecidableEq G := G_dec_eq - - have G'_finite_index := data.finite_index - have G'_fg: Group.FG data.G' := by -@@ -224,14 +654,7 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( - let N' := Subgroup.closure (Set.range (fun (a: Multiplicative data.φ.ker) => a ^ N.index)) - - -- let new_N'_map : _ →* _ := { -- toFun := fun (g: (Multiplicative ↥data.φ.ker)) => Additive.toMul (data.φ.ker.subtype g) -- map_one' := rfl -- map_mul' := by -- intro x y -- rfl -- } -- -+ let new_N'_map := kernelInclusion (hGS := hGS) data - - let new_N': Subgroup (data.G') := Subgroup.map new_N'_map N' - -@@ -357,8 +780,7 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( - -- The underlying element of `data.G'` of an element of `N'`, with every `Additive` / - -- `Multiplicative` conversion spelled out instead of relying on definitional unfolding: - -- `↥N' → Multiplicative ↥data.φ.ker → ↥data.φ.ker → Additive ↥data.G' → ↥data.G'`. -- let N'_val : ↥N' →* ↥data.G' := -- (AddMonoidHom.toMultiplicativeLeft data.φ.ker.subtype).comp N'.subtype -+ let N'_val : ↥N' →* ↥data.G' := kernelValue (hGS := hGS) data N' - - have gamma_conj_ker_apply: ∀ a: ↥data.φ.ker, - data.φ.ker.subtype (gamma_conj_ker a) = γ + data.φ.ker.subtype a + -γ := by -@@ -369,11 +791,10 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( - have gamma_conj_step: ∀ g: ↥N', - N'_val (gamma_conj_N' g) = Additive.toMul γ * N'_val g * (Additive.toMul γ)⁻¹ := by - intro g -- simp only [N'_val, gamma_conj_N', gamma_conj_ker_mul, MonoidHom.coe_comp, Function.comp_apply, -+ simp only [N'_val, kernelValue, gamma_conj_N', gamma_conj_ker_mul, MonoidHom.coe_comp, Function.comp_apply, - AddMonoidHom.coe_toMultiplicativeLeft, Subgroup.coe_subtype, - MulAut.characteristic_apply_apply_coe, AddEquiv.toMultiplicative_apply_apply, -- AddEquiv.toAddMonoidHom_eq_coe, AddMonoidHom.toMultiplicative_apply_apply, -- AddMonoidHom.coe_coe, toAdd_ofAdd, gamma_conj_ker_apply, toMul_add, toMul_neg] -+ toAdd_ofAdd, gamma_conj_ker_apply, toMul_add, toMul_neg] - - have gamma_conj_iter_val: ∀ (n: ℕ), ∀ g: ↥N', - N'_val (gamma_conj_N'^[n] g) -@@ -424,146 +845,8 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( - intro n g - exact Subtype.ext (conj_val_eq n g).symm - -- have gamma_conj_card: ∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → ((Finset.image (fun x ↦ (List.map (fun (i: Finset.Ico a b) ↦ (gamma_conj_N')^[k * ↑i] g) x.toList).prod)) -- (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q := by -- -- have s_poly := hGS.g_growth -- unfold HasPolynomialGrowth at s_poly -- obtain ⟨q, hq⟩ := s_poly -- unfold HasPolynomialGrowthD at hq -- obtain ⟨p, hp⟩ := hq -- intro k k_pos x -- -- -- obtain ⟨x_list, x_prod, x_list_prod⟩ := -- word_norm_prod_self (hGS := hGS) x.val.toAdd.val.toMul.val -- obtain ⟨gamma_list, gamma_prod, gamma_list_prod⟩ := -- word_norm_prod_self (hGS := hGS) (Additive.toMul γ).val -- -- -- -- `(hGS := hGS)` is required: `new_generates` shadows the ambient instance here, -- -- so a bare `S` would resolve to `new_generates.S`. -- have p_pos: 0 < p := growth_const_pos (hGS := hGS) hp -- -- have q_pos: 0 < q := growth_exponent_pos (hGS := hGS) ⟨p, hp⟩ -- use p * (((max x_list.length gamma_list.length) * (4 * k)) ^ q) -- use q -- -- -- have gamma_len_pos: 1 ≤ gamma_list.length := by -- by_contra! -- simp at this -- simp [ProdS, this] at gamma_prod -- have gamma_eq: γ = 0 := by -- have gamma_coe := Subtype.coe_eq_of_eq_mk gamma_prod.symm -- apply_fun (fun a => Additive.ofMul a) at gamma_coe -- rw [ofMul_toMul] at gamma_coe -- exact gamma_coe -- simp [gamma_eq] at hγ -- -- refine ⟨?_, ?_⟩ -- . -- apply mul_pos -- . exact p_pos -- . -- rw [pow_pos_iff] -- . -- positivity -- . grind -- -- -- intro b hb -- intro a ha hab -- -- have mul_nozero: 1 ≤ 2 * k * b := by -- rw [mul_assoc] -- apply one_le_mul -- . simp -- . apply one_le_mul -- . grind -- . grind -- -- -- grw [← Finset.card_image_of_injOn (f := fun a => a.val.toAdd.val.toMul.val) (by simp)] -- grw [Finset.card_le_card (t := hGS.S^((b - a) * ((max x_list.length gamma_list.length) * (4 * k * b)) ))] -- · -- -- grw [hp] -- . -- rw [mul_pow] -- ring -- simp -- . -- simp -- apply one_le_mul -- . grind -- . -- rw [Nat.one_le_iff_ne_zero, ← Nat.pos_iff_ne_zero] -- -- -- positivity -- -- side goal from `card_le_card`: the image is contained in `hGS.S` -- · -- intro g hg -- simp at hg -- obtain ⟨s, hs, g_eq⟩ := hg -- simp [ProdS] at x_prod -- simp [ProdS] at gamma_prod -- rw [eq_comm] at x_prod -- rw [eq_comm] at gamma_prod -- have gamma_eq := Subtype.coe_eq_of_eq_mk gamma_prod -- apply_fun (fun a => Additive.ofMul a) at gamma_eq -- rw [ofMul_toMul] at gamma_eq -- -- have x_eq := Subtype.coe_eq_of_eq_mk x_prod -- apply_fun (fun a => Additive.ofMul a) at x_eq -- rw [ofMul_toMul] at x_eq -- have x_eq := Subtype.coe_eq_of_eq_mk x_eq -- apply_fun (fun a => Multiplicative.ofAdd a) at x_eq -- rw [ofAdd_toAdd] at x_eq -- have x_eq := Subtype.coe_eq_of_eq_mk x_eq -- simp_rw [x_eq] at g_eq -- simp_rw [gamma_conj_iter] at g_eq -- simp at g_eq -- simp_rw [gamma_eq] at g_eq -- rw [← g_eq] -- rw [← closed_ball_eq_S_pow (hGS := hGS)] -- simp [-le_sup_iff] -- simp only [dist, WordDist_one] -- norm_cast -- simp_rw [Function.comp_def] -- simp [-le_sup_iff] -- grw [word_norm_list_prod_le (hGS := hGS)] -- rw [List.unattach.eq_def (l := s.toList)] -- nth_rw 2 [List.map_map] -- grw [List.sum_le_sum (g := Function.const _ ((max x_list.length gamma_list.length) * (4 * k * b)))] -- . -- simp [-le_sup_iff] -- grw [Finset.card_le_univ] -- simp -- . -- intro y hy -- simp at hy -- obtain ⟨m, ⟨⟨m_range, m_mem⟩, y_eq⟩⟩ := hy -- rw [← y_eq] -- grw [word_norm_mul_le (hGS := hGS)] -- grw [word_norm_mul_le (hGS := hGS)] -- rw [← word_norm_inv (hGS := hGS)] -- grw [word_norm_pow (hGS := hGS)] -- rw [← gamma_prod, ← gamma_list_prod] -- simp [N'_val] -- rw [← x_prod, ← x_list_prod] -- grw [m_range.2] -- ring -- have four_eq: 4 = (2 + 2) := by norm_num -- rw [four_eq, mul_add] -- apply add_le_add -- . simp -- grw [le_max_right (b := gamma_list.length)] -- . grw [← le_max_left (a := x_list.length)] -- ring -- nlinarith -- -+ have gamma_conj_card := conjugate_subproducts_growth (hGS := hGS) data N' γ hγ -+ gamma_conj_N' conj_mem_ker conj_mem_N' gamma_conj_iter - - obtain ⟨α, m, alpha_nonzero, alpha_is_unipotent_conj⟩ := exists_gamma_n_unipotent_N' (N' := N') N'_nilpotent N'_fg gamma_conj_N' gamma_conj_card 1 (by simp) - simp_rw [mul_one] at alpha_is_unipotent_conj -@@ -608,7 +891,7 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( - } - - -- haveI : Subgroup.Characteristic N' := N'_char -+ have : Subgroup.Characteristic N' := N'_char - have alpha_nilpotent := unipotent_commutator_trivial (G := data.G') (H := data.φ.ker.toSubgroup') (N' := N') (N'_char := N'_char) (N'_nilpotent := by - exact N'_nilpotent - ) (γ.toMul^α) (by -@@ -680,300 +963,9 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( - . - exact alpha_nilpotent - . -- rw [Subgroup.finiteIndex_iff] -- rw [Subgroup.index_map] -- simp -- refine ⟨?_, ?_⟩ -- . -- -- simp_rw [Set.insert_eq] -+ exact cyclic_kernel_finiteIndex (hGS := hGS) data γ hγ N' N'_fg α alpha_nonzero -+ (fun {_} => map_N'_invariant_gamma) - -- have gamma_alpha_le_gamma: (Subgroup.closure ({toMul γ ^ α} ∪ (new_N'_map '' (N'_fg.choose)) )) ≤ (Subgroup.closure ({toMul γ} ∪ (new_N'_map '' (N'_fg.choose)))) := by -- simp -- intro g hg -- rw [Set.insert_eq] -- cases hg -- . rename_i g_eq_gamma -- rw [Subgroup.closure_union] -- apply Subgroup.mem_sup_left -- rw [Subgroup.mem_closure_singleton] -- use α -- rw [g_eq_gamma] -- simp -- . rename_i g_mem_map -- rw [Subgroup.closure_union] -- apply Subgroup.mem_sup_right -- apply Subgroup.mem_closure_of_mem -- exact g_mem_map -- -- conv => -- arg 1 -- arg 1 -- arg 1 -- arg 1 -- arg 2 -- equals (new_N'_map '' (N'_fg.choose)) => rfl -- rw [← Subgroup.relIndex_mul_index gamma_alpha_le_gamma] -- simp -- refine ⟨?_, ?_⟩ -- . -- unfold Subgroup.relIndex -- rw [← ne_eq] -- rw [← Subgroup.finiteIndex_iff] -- apply Subgroup.finiteIndex_of_rightCoset_cover_const (s := Finset.Ioo (-α : ℤ) (α)) (g := fun a => ⟨a • γ, (by -- rw [Set.insert_eq, Subgroup.closure_union] -- apply Subgroup.mem_sup_left -- rw [Subgroup.mem_closure_singleton] -- use a -- rfl -- )⟩) -- ext g -- simp -- have g_prop := g.property -- simp_rw [Set.insert_eq, Subgroup.closure_union] at g_prop -- rw [← MonoidHom.map_closure] at g_prop -- simp at g_prop -- rw [← SetLike.mem_coe] at g_prop -- rw [sup_comm] at g_prop -- -- -- rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ -- (Subgroup.le_normalizer_of_conj_mem map_N'_invariant_gamma_one)] at g_prop -- rw [Set.mem_mul] at g_prop -- obtain ⟨b, hb, a, ha, g_eq⟩ := g_prop -- simp at ha -- rw [Subgroup.mem_closure_singleton] at ha -- obtain ⟨z, hz⟩ := ha -- use z % α -- refine ⟨?_, ?_⟩ -- . -- have foo := Int.emod_lt_abs z (b := α) (by grind) -- rw [lt_abs] at foo -- refine ⟨?_, ?_⟩ -- . -- have bar := Int.emod_nonneg z (b := α) (by simpa using alpha_nonzero) -- grind -- . grind -- . -- rw [Set.mem_smul_set] -- use ⟨(Additive.ofMul b) + (((α : ℤ) * (z / (α : ℤ))) • γ), ?_⟩ -- . -- refine ⟨?_, ?_⟩ -- . -- simp -- rw [Subgroup.mem_subgroupOf] -- simp_rw [Set.insert_eq, Subgroup.closure_union] -- rw [← SetLike.mem_coe] -- rw [sup_comm] -- rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by -- simp_rw [← MonoidHom.map_closure] -- apply map_N'_invariant_gamma -- ))] -- apply Set.mul_mem_mul -- . -- simp -- rw [← MonoidHom.map_closure] -- exact hb -- . -- simp -- rw [Subgroup.mem_closure_singleton] -- use (z / (α : ℤ)) -- conv => -- lhs -- arg 1 -- equals toMul γ ^ (α : ℤ) => -- simp -- -- rw [← zpow_mul] -- . -- simp -- rw [Subtype.ext_iff] -- simp -- rw [← g_eq, ←hz] -- nth_rw 3 [← Int.mul_ediv_add_emod (a := z) (b := α)] -- rw [← toMul_zsmul] -- conv => -- lhs -- equals (ofMul b) + ((↑α * (z / ↑α)) • γ) + ((z % ↑α) • γ) => -- rfl -- -- -- rw [add_zsmul] -- rw [add_assoc] -- rfl -- . -- simp_rw [Set.insert_eq, Subgroup.closure_union] -- rw [sup_comm] -- rw [← SetLike.mem_coe] -- -- rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by -- simp_rw [← MonoidHom.map_closure] -- apply map_N'_invariant_gamma_one -- ))] -- apply Set.mul_mem_mul -- . -- simp -- rw [← MonoidHom.map_closure] -- exact hb -- . -- simp [Subgroup.mem_closure_singleton] -- . -- obtain ⟨s, s_compl, s_cosets⟩ := Subgroup.exists_leftTransversal_of_FiniteIndex (D := N') (H := ⊤) (by simp) -- simp at s_cosets -- -- rw [← ne_eq] -- rw [← Subgroup.finiteIndex_iff] -- apply Subgroup.finiteIndex_of_leftCoset_cover_const (s := s) (g := fun g => g.val.val.toMul) -- simp_rw [Set.insert_eq, Subgroup.closure_union] -- rename_bvar i → g -- -- -- conv => -- arg 1 -- arg 1 -- intro i -- arg 1 -- intro hi -- rw [sup_comm] -- rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by -- intro gamma_pow h_gamma_pow n hn -- simp_rw [← MonoidHom.map_closure] at hn -- simp_rw [← MonoidHom.map_closure] -- apply map_N'_invariant_gamma_one _ h_gamma_pow _ hn -- ))] -- rw [set_smul_eq_mul] -- rw [← mul_assoc] -- rw [← set_smul_eq_mul] -- -- -- simp_rw [← Set.iUnion_mul] -- conv => -- arg 1 -- arg 1 -- equals Additive.toMul '' data.φ.ker => -- apply_fun (fun s => Additive.toMul '' (Subtype.val '' s)) at s_cosets -- conv at s_cosets => -- rhs -- equals Additive.toMul '' data.φ.ker => -- ext a -- simp -- rw [← s_cosets] -- conv => -- arg 1 -- arg 1 -- intro i -- arg 1 -- intro hi -- arg 2 -- -- simp_rw [← MonoidHom.map_closure] -- -- simp only [Set.image_image] -- first -- | erw [Set.image_iUnion₂] -- | rw [Set.image_iUnion₂] -- | simp only [Set.image_iUnion] -- apply Set.iUnion_congr -- intro i -- apply Set.iUnion_congr -- intro hi -- ext z -- simp only [closure_eq, coe_map] -- rw [Set.mem_smul_set] -- rw [Set.mem_image] -- refine ⟨?_, ?_⟩ -- . -- intro hy -- obtain ⟨a, ha⟩ := hy -- have foo := ha.1 -- rw [Set.mem_image] at foo -- obtain ⟨b, b_mem, a_eq_b⟩ := foo -- have N'_gen := N'_fg.choose_spec -- rw [N'_gen] at b_mem -- refine ⟨(↑i : Multiplicative ↥data.φ.ker) • b, Set.smul_mem_smul_set b_mem, ?_⟩ -- rw [← ha.2, ← a_eq_b] -- rfl -- . -- intro hx -- obtain ⟨x, hx, x_eq⟩ := hx -- erw [Set.mem_smul_set] at hx -- obtain ⟨n, hn, x_eq_n⟩ := hx -- refine ⟨new_N'_map n, ?_, ?_⟩ -- . -- rw [Set.mem_image] -- have N'_gen := N'_fg.choose_spec -- rw [← N'_gen] at hn -- exact ⟨n, hn, rfl⟩ -- . rw [← x_eq, ← x_eq_n] -- rfl -- -- -- conv => -- arg 1 -- lhs -- equals ↑data.φ.ker.toSubgroup' => -- ext a -- simp -- -- rw [← Subgroup.coe_mul_of_right_le_normalizer_left _ _] -- . -- simp -- rw [eq_top_iff] -- have ker_gen := e_i_and_gamma_generates_G data.φ γ hγ -- have foo := new_generates.generates -- simp at foo -- rw [← foo, ← ker_gen] -- simp_rw [Subgroup.closure_union] -- conv => -- lhs -- arg 1 -- equals Subgroup.closure {γ.toMul} => -- simp [Subgroup.closure_union] -- conv => -- lhs -- arg 1 -- equals {γ.toMul, γ.toMul⁻¹} => rfl -- rw [Set.insert_eq] -- rw [Subgroup.closure_union] -- simp -- -- simp_rw [← Subgroup.closure_union] -- rw [Subgroup.closure_le] -- rw [Set.union_subset_iff] -- refine ⟨?_, ?_⟩ -- . -- intro a ha -- simp at ha -- simp -- apply Subgroup.mem_sup_right -- simp [ha] -- . -- intro a ha -- apply Subgroup.mem_sup_left -- simp -- simp at ha -- obtain ⟨p, hp, a_eq⟩ := ha -- simp [e_i_with_gamma] at a_eq -- rw [← a_eq] -- conv => -- arg 1 -- arg 2 -- equals (ofMul p) + -((data.φ (ofMul p)) • γ) => -- rfl -- -- -- simp [hγ] -- . -- apply Subgroup.le_normalizer_of_conj_mem -- intro b hb a ha -- rw [Subgroup.mem_closure_singleton] at hb -- obtain ⟨n, b_eq⟩ := hb -- simp [← b_eq] -- simp at ha -- exact ha -- . have foo := data.finite_index -- rw [Subgroup.finiteIndex_iff] at foo -- exact foo - - - -- Decompose list of {e_k, γ}: -@@ -988,8 +980,6 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( - -- * If the head is γ^n e_i for some n (collecting up adjacent γ), then choose γ_n,i = γ^n * e_i * γ^(-n) - -- * If the remaining list is just γ^n, then n must be 0 (since we maintained the invariant) - --#print axioms three_two_gamma_m_generates --#print axioms three_two_ker_fg - - -- NOTE: from https://www.numdam.org/item/PMIHES_1981__53__53_0.pdf - -- it looks like our definition of 'polynomial growth' should use `S ∪ S⁻¹` -@@ -1023,7 +1013,5 @@ theorem main_gromov_theorem (n: ℕ) (h: HasPolynomialGrowthD S n): Group.IsVirt - have prev := @ih Q_generates (n - 1) Q_poly (by omega) - exact prev - --#print sorries main_gromov_theorem --#print axioms main_gromov_theorem - - end GeneratesNS -diff --git a/Gromov/GrowthZero.lean b/Gromov/GrowthZero.lean -index 95e1ac0..95a2c15 100644 ---- a/Gromov/GrowthZero.lean -+++ b/Gromov/GrowthZero.lean -@@ -11,9 +11,6 @@ public import Gromov.ThreeTwoGenerates - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false - - open Subgroup - open scoped Finset -@@ -28,9 +25,7 @@ include hGS - - open scoped RealInnerProductSpace - --set_option synthInstance.maxHeartbeats 500000 - --set_option maxHeartbeats 1000000 - - open MeasureTheory - -@@ -48,13 +43,12 @@ structure GeneratesWithParam (G: Type*) [Group G] [DecidableEq G] where - has_inv: ∀ g ∈ S, g⁻¹ ∈ S - g_infinite: Infinite G - -+omit hGS in - lemma one_mem_S {G: Type*} [Group G] [DecidableEq G] {n: ℕ} (data: Theorem3_1_Input G) (hGS: GeneratesWithParam data.G') (γ: Additive data.G') (hγ: data.φ γ = 1): 0 ∈ S_n_ker_phi hGS.S data.φ γ hγ n := by - simp [S_n_ker_phi] - - ---- The generating set of `ker φ` used below, shared between the `new_g_growth` ---- hypothesis and the `S` field so that `g_growth := new_g_growth` is definitionally ---- trivial (avoids an expensive `whnf` on the two separately-elaborated `Finset`s). -+-- A symmetric generating set for the kernel of the homomorphism to ℤ. - omit hGS in - @[expose] - noncomputable def ker_S {G: Type*} [Group G] [DecidableEq G] (data: Theorem3_1_Input G) -@@ -63,9 +57,8 @@ noncomputable def ker_S {G: Type*} [Group G] [DecidableEq G] (data: Theorem3_1_I - (Finset.image Additive.toMul (S_n_ker_phi hGS.S data.φ γ hγ n)) ∪ - (Finset.image Additive.toMul ((S_n_ker_phi hGS.S data.φ γ hγ n)))⁻¹ - ---- TODO - figure out how to make this a 'let' without adding it to typeclass search - omit hGS in --@[expose] -+@[expose, instance_reducible] - noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (data: Theorem3_1_Input G) (hGS: GeneratesWithParam data.G') (γ: data.G') (hγ: data.φ γ = 1) - (ker_infinite: Infinite (Multiplicative data.φ.ker)) - (ker_generates: AddSubgroup.closure (Additive.ofMul '' (three_two_S_n hGS.S data.φ γ (n))) = data.φ.ker) -@@ -104,13 +97,9 @@ noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (d - simp at foo - unfold S_n_ker_phi - simp -- first -- | erw [Finset.coe_insert, Set.image_insert_eq, toMul_zero, Subgroup.closure_insert_one] -- | rw [Finset.coe_insert, Set.image_insert_eq, toMul_zero, Subgroup.closure_insert_one] -- | simp only [Finset.coe_insert, Set.image_insert_eq, toMul_zero, Subgroup.closure_insert_one] - rw [← Subgroup.mem_map_iff_mem (f := f)] -- . -- simp only [f, Subgroup.subtype_apply] -+ · -+ simp only [f] - rw [MonoidHom.map_closure] - simp - conv => -@@ -131,7 +120,7 @@ noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (d - have hbk : b ∈ three_two_S_n hGS.S data.φ γ n := by simpa using hb - exact ⟨_, ⟨_, ⟨⟨b, hbk⟩, rfl⟩, rfl⟩, rfl⟩ - exact foo -- . simp [f] -+ · simp [f] - intro x y hxy - simpa using hxy - simp -@@ -140,7 +129,6 @@ noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (d - rw [Finset.mem_image] - use 0 - simp -- -- TODO - figure out wht 'apply one_mem_S' is slow - exact one_mem_S data hGS γ hγ - - has_inv := by -@@ -156,6 +144,231 @@ noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (d - } - - -+private lemma kernel_thickening_card (n r : ℕ) (φ : (Additive G) →+ ℤ) (γ : G) (hγ : φ γ = 1) : -+ let mul_by_i := fun (g : G) (i : Fin r) => g * (γ ^ i.val); -+ #((((((S_n_ker_phi S φ γ hγ n) ∪ (-(S_n_ker_phi S φ γ hγ n))).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) = r * #(r • ((S_n_ker_phi S φ γ hγ n) ∪ -((S_n_ker_phi S φ γ hγ n)))) := by -+ dsimp only -+ let mul_by_i := fun (g: G) (i: Fin r) => g * (γ ^ i.val) -+ change #((((((S_n_ker_phi S φ γ hγ n) ∪ (-(S_n_ker_phi S φ γ hγ n))).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) = r * #(r • ((S_n_ker_phi S φ γ hγ n) ∪ -((S_n_ker_phi S φ γ hγ n)))) -+ have new_phi_gamma: φ (Additive.ofMul γ) = 1 := hγ -+ have card_mul_range (g: G): #(Finset.image (mul_by_i g) Finset.univ) = r := by -+ rw [Finset.card_image_of_injOn] -+ · simp -+ · -+ -+ intro j _ k _ mul_eq -+ simp [mul_by_i] at mul_eq -+ apply_fun φ ∘ (Additive.ofMul) at mul_eq -+ simp [new_phi_gamma] at mul_eq -+ rw [Fin.ext_iff] -+ exact mul_eq -+ -+ -+ rw [Finset.card_biUnion] -+ · -+ simp_rw [card_mul_range] -+ simp -+ rw [mul_comm] -+ conv => -+ lhs -+ arg 2 -+ arg 1 -+ equals r • ((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)) => -+ ext a -+ rw [Finset.mem_image] -+ simp_rw [Finset.mem_pow] -+ refine Iff.trans ?_ Finset.mem_nsmul.symm -+ refine ⟨?_, ?_⟩ -+ · intro h -+ obtain ⟨b, ⟨f, hf⟩, b_eq_a⟩ := h -+ use (fun i => ⟨(f i).val, (by -+ have f_prop := (f i).property -+ rw [Finset.mem_image] at f_prop -+ obtain ⟨g, g_mem, hg⟩ := f_prop -+ rw [← hg] -+ exact g_mem -+ )⟩) -+ rw [← b_eq_a] -+ rw [← hf] -+ rfl -+ · intro h -+ obtain ⟨f, hf⟩ := h -+ use a -+ refine ⟨?_, rfl⟩ -+ use (fun i => ⟨(f i).val, (by -+ have f_prop := (f i).property -+ rw [Finset.mem_image] -+ use (f i).val -+ refine ⟨f_prop, ?_⟩ -+ rfl -+ )⟩) -+ rw [← hf] -+ rfl -+ -+ -+ · -+ intro a ha b hb hab x h_first h_second -+ simp at h_first -+ simp at h_second -+ simp -+ -+ by_contra! -+ obtain ⟨p, hp⟩ := this -+ have orig_h_first := h_first hp -+ have orig_h_second := h_second hp -+ specialize h_first hp -+ specialize h_second hp -+ -+ simp at h_first -+ simp at h_second -+ -+ obtain ⟨y, hy⟩ := h_first -+ obtain ⟨z, hz⟩ := h_second -+ -+ have orig_hy := hy -+ have orig_hz := hz -+ -+ rw [← hz] at hy -+ simp [mul_by_i] at hy -+ apply_fun φ ∘ (Additive.ofMul) at hy -+ simp [new_phi_gamma] at hy -+ -+ have a_ker: a.val ∈ φ.ker := by -+ simp -+ -+ have b_ker: b.val ∈ φ.ker := by -+ simp -+ -+ rw [AddMonoidHom.mem_ker] at a_ker -+ rw [AddMonoidHom.mem_ker] at b_ker -+ simp [ofMul] at hy -+ simp [a_ker, b_ker] at hy -+ -+ rw [← Fin.ext_iff] at hy -+ rw [hy] at orig_hy -+ rw [← orig_hy] at orig_hz -+ simp [mul_by_i] at orig_hz -+ rw [eq_comm] at orig_hz -+ contradiction -+ -+ -+ -+private lemma kernel_thickening_bound (n r : ℕ) (φ : (Additive G) →+ ℤ) (γ : G) (hγ : φ γ = 1) : -+ let mul_by_i := fun (g : G) (i : Fin r) => g * (γ ^ i.val); -+ #((((((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) ≤ #(((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1}) ^ (2 * r)) := by -+ dsimp only -+ let mul_by_i := fun (g : G) (i : Fin r) => g * (γ ^ i.val) -+ change #((((((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) ≤ #(((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1}) ^ (2 * r)) -+ -+ grw [Finset.card_le_card] -+ intro a ha -+ rw [Finset.mem_biUnion] at ha -+ obtain ⟨s, s_mem, a_mem⟩ := ha -+ rw [Finset.mem_image] at a_mem -+ obtain ⟨k, _, hk⟩ := a_mem -+ simp [mul_by_i] at hk -+ rw [← hk] -+ rw [two_mul] -+ rw [pow_add] -+ apply Finset.mul_mem_mul -+ · -+ unfold S_n_ker_phi at s_mem -+ -+ rw [Finset.mem_image] at s_mem -+ obtain ⟨z, z_mem, hz⟩ := s_mem -+ rw [← hz] -+ -+ rw [Finset.mem_pow] at z_mem -+ obtain ⟨f, hf⟩ := z_mem -+ rw [Finset.mem_pow] -+ use (fun i => ⟨(f i).val.val, (by -+ have f_prop := (f i).property -+ rw [Finset.mem_image] at f_prop -+ obtain ⟨g, g_mem, hg⟩ := f_prop -+ rw [← hg] -+ simp at g_mem -+ cases g_mem -+ · -+ rename_i g_eq_zero -+ apply Finset.mem_union_right -+ rw [Finset.mem_singleton, g_eq_zero] -+ rfl -+ · rename_i g_eq_nonzero -+ cases g_eq_nonzero -+ · rename_i left -+ obtain ⟨z, z_mem, hz⟩ := left -+ rw [← hz] -+ apply Finset.mem_union_left -+ apply Finset.mem_union_left -+ apply Finset.mem_union_left -+ exact z_mem -+ · -+ rename_i right -+ obtain ⟨z, z_mem, hz⟩ := right -+ apply Finset.mem_union_left -+ apply Finset.mem_union_left -+ apply Finset.mem_union_right -+ simp -+ conv => -+ arg 2 -+ equals (-g).val => -+ rfl -+ rw [← hz] -+ exact z_mem -+ )⟩) -+ rw [← hf, ofMul_list_prod, List.map_ofFn] -+ erw [AddSubmonoidClass.coe_list_sum, List.map_ofFn] -+ rfl -+ · -+ -+ -+ have gamma_r_subset: ({γ, 1} : Finset G)^r ⊆ ((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1})^r := by -+ apply Finset.pow_subset_pow -+ · grind -+ · grind -+ · simp -+ -+ have gamma_subset: ({γ, 1} : Finset G)^k.val ⊆ ({γ, 1} : Finset G)^r := by -+ apply Finset.pow_subset_pow -+ · simp -+ · simp -+ · simp -+ -+ -+ have gamma_mem_self: γ^k.val ∈ ({γ, 1} : Finset G)^k.val := by -+ apply Finset.pow_mem_pow -+ simp -+ -+ grind -+ -+ -+ -+omit hGS in -+private lemma multiplicative_symm_pow {A : Type*} [AddGroup A] [DecidableEq A] -+ (s : Finset A) (r : ℕ) : -+ ((show Finset (Multiplicative A) from s) ∪ (show Finset (Multiplicative A) from s)⁻¹)^r = -+ (show Finset (Multiplicative A) from r • (s ∪ -s)) := by -+ ext a -+ rw [Finset.mem_pow] -+ refine Iff.trans ?_ (Finset.mem_nsmul (α := A) (s := s ∪ -s) (a := a.toAdd) (n := r)).symm -+ constructor -+ · rintro ⟨f, hf⟩ -+ exact ⟨f, hf⟩ -+ · rintro ⟨f, hf⟩ -+ exact ⟨f, hf⟩ -+ -+omit hGS in -+private lemma cancel_growth_factor {N r b d : ℕ} (hr : 0 < r) (hd : 1 ≤ d) -+ (h : r * N ≤ b * (2 * r)^d) : N ≤ (b * 2^d) * r^(d-1) := by -+ have hp : r^d = r * r^(d-1) := by -+ calc -+ r^d = r^((d-1)+1) := by rw [Nat.sub_add_cancel hd] -+ _ = r * r^(d-1) := by rw [pow_succ, mul_comm] -+ apply Nat.le_of_mul_le_mul_left (c := r) ?_ hr -+ calc -+ r * N ≤ b * (2*r)^d := h -+ _ = r * ((b * 2^d) * r^(d-1)) := by rw [mul_pow, hp]; ac_rfl -+ - lemma three_two_kernel_poly_growth (d: ℕ) (hd: d >= 1) (n: ℕ) (hG: HasPolynomialGrowthD S d ) (φ: (Additive G) →+ ℤ) (γ: G) (hγ : φ γ = 1) - : HasPolynomialGrowthD (G := Multiplicative φ.ker) (d - 1) (S := (S_n_ker_phi S φ γ hγ n) ∪ (S_n_ker_phi S φ γ hγ n)⁻¹) := by - -@@ -165,7 +378,7 @@ lemma three_two_kernel_poly_growth (d: ℕ) (hd: d >= 1) (n: ℕ) (hG: HasPolyn - obtain ⟨a, ha⟩ := hG - - by_cases a_eq_zero: a = 0 -- . -+ · - simp [a_eq_zero] at ha - specialize ha 1 (by simp) - simp at ha -@@ -186,236 +399,16 @@ lemma three_two_kernel_poly_growth (d: ℕ) (hd: d >= 1) (n: ℕ) (hG: HasPolyn - specialize ker_poly (2 * r) (by omega) - - -- let mul_by_i := fun (g: G) (i: Fin r) => g * (γ ^ i.val) -- have new_phi_gamma: φ (Additive.ofMul γ) = 1 := hγ -- have card_mul_range (g: G): #(Finset.image (mul_by_i g) Finset.univ) = r := by -- rw [Finset.card_image_of_injOn] -- . simp -- . -- -- intro j _ k _ mul_eq -- simp [mul_by_i] at mul_eq -- apply_fun φ ∘ (Additive.ofMul) at mul_eq -- simp [new_phi_gamma] at mul_eq -- rw [Fin.ext_iff] -- exact mul_eq -- -- have card_union: #((((((S_n_ker_phi S φ γ hγ n) ∪ (-(S_n_ker_phi S φ γ hγ n))).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) = r * #(r • ((S_n_ker_phi S φ γ hγ n) ∪ -((S_n_ker_phi S φ γ hγ n)))) := by -- rw [Finset.card_biUnion] -- . -- simp_rw [card_mul_range] -- simp -- rw [mul_comm] -- conv => -- lhs -- arg 2 -- arg 1 -- equals r • ((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)) => -- ext a -- rw [Finset.mem_image] -- simp_rw [Finset.mem_pow] -- refine Iff.trans ?_ Finset.mem_nsmul.symm -- refine ⟨?_, ?_⟩ -- . intro h -- obtain ⟨b, ⟨f, hf⟩, b_eq_a⟩ := h -- use (fun i => ⟨(f i).val, (by -- have f_prop := (f i).property -- rw [Finset.mem_image] at f_prop -- obtain ⟨g, g_mem, hg⟩ := f_prop -- rw [← hg] -- exact g_mem -- )⟩) -- rw [← b_eq_a] -- rw [← hf] -- rfl -- . intro h -- obtain ⟨f, hf⟩ := h -- use a -- refine ⟨?_, rfl⟩ -- use (fun i => ⟨(f i).val, (by -- have f_prop := (f i).property -- rw [Finset.mem_image] -- use (f i).val -- refine ⟨f_prop, ?_⟩ -- rfl -- )⟩) -- rw [← hf] -- rfl -- -- -- . -- intro a ha b hb hab x h_first h_second -- simp at h_first -- simp at h_second -- simp -- -- by_contra! -- obtain ⟨p, hp⟩ := this -- have orig_h_first := h_first hp -- have orig_h_second := h_second hp -- specialize h_first hp -- specialize h_second hp -- -- simp at h_first -- simp at h_second -- -- obtain ⟨y, hy⟩ := h_first -- obtain ⟨z, hz⟩ := h_second -- -- have orig_hy := hy -- have orig_hz := hz -- -- rw [← hz] at hy -- simp [mul_by_i] at hy -- apply_fun φ ∘ (Additive.ofMul) at hy -- simp [new_phi_gamma] at hy -- -- have a_ker: a.val ∈ φ.ker := by -- simp -- -- have b_ker: b.val ∈ φ.ker := by -- simp -- -- rw [AddMonoidHom.mem_ker] at a_ker -- rw [AddMonoidHom.mem_ker] at b_ker -- simp [ofMul] at hy -- simp [a_ker, b_ker] at hy -- -- rw [← Fin.ext_iff] at hy -- rw [hy] at orig_hy -- rw [← orig_hy] at orig_hz -- simp [mul_by_i] at orig_hz -- rw [eq_comm] at orig_hz -- contradiction -- -- -- have card_union_le: #((((((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) ≤ #(((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1}) ^ (2 * r)) := by -- grw [Finset.card_le_card] -- intro a ha -- rw [Finset.mem_biUnion] at ha -- obtain ⟨s, s_mem, a_mem⟩ := ha -- rw [Finset.mem_image] at a_mem -- obtain ⟨k, _, hk⟩ := a_mem -- simp [mul_by_i] at hk -- rw [← hk] -- rw [two_mul] -- rw [pow_add] -- apply Finset.mul_mem_mul -- . -- unfold S_n_ker_phi at s_mem -- -- rw [Finset.mem_image] at s_mem -- obtain ⟨z, z_mem, hz⟩ := s_mem -- rw [← hz] -- -- rw [Finset.mem_pow] at z_mem -- obtain ⟨f, hf⟩ := z_mem -- rw [Finset.mem_pow] -- use (fun i => ⟨(f i).val.val, (by -- have f_prop := (f i).property -- rw [Finset.mem_image] at f_prop -- obtain ⟨g, g_mem, hg⟩ := f_prop -- rw [← hg] -- simp at g_mem -- cases g_mem -- . -- rename_i g_eq_zero -- apply Finset.mem_union_right -- rw [Finset.mem_singleton, g_eq_zero] -- first | rfl | simp -- . rename_i g_eq_nonzero -- cases g_eq_nonzero -- . rename_i left -- obtain ⟨z, z_mem, hz⟩ := left -- rw [← hz] -- apply Finset.mem_union_left -- apply Finset.mem_union_left -- apply Finset.mem_union_left -- exact z_mem -- . -- rename_i right -- obtain ⟨z, z_mem, hz⟩ := right -- apply Finset.mem_union_left -- apply Finset.mem_union_left -- apply Finset.mem_union_right -- simp -- conv => -- arg 2 -- equals (-g).val => -- rfl -- rw [← hz] -- exact z_mem -- )⟩) -- rw [← hf, ofMul_list_prod, List.map_ofFn] -- first -- | (erw [AddSubmonoidClass.coe_list_sum, List.map_ofFn]; rfl) -- | (rw [AddSubmonoidClass.coe_list_sum, List.map_ofFn]; rfl) -- | (simp only [AddSubmonoidClass.coe_list_sum, List.map_ofFn]; rfl) -- . -- -- -- have gamma_r_subset: ({γ, 1} : Finset G)^r ⊆ ((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1})^r := by -- apply Finset.pow_subset_pow -- . grind -- . grind -- . simp -- -- have gamma_subset: ({γ, 1} : Finset G)^k.val ⊆ ({γ, 1} : Finset G)^r := by -- apply Finset.pow_subset_pow -- . simp -- . simp -- . simp -- -- -- have gamma_mem_self: γ^k.val ∈ ({γ, 1} : Finset G)^k.val := by -- apply Finset.pow_mem_pow -- simp -- -- grind -- -+ let mul_by_i := fun (g : G) (i : Fin r) => g * (γ ^ i.val) -+ have card_union := kernel_thickening_card n r φ γ hγ -+ have card_union_le := kernel_thickening_bound n r φ γ hγ -+ dsimp only at card_union card_union_le - - rw [card_union] at card_union_le -- grw [ker_poly] at card_union_le -- rw [mul_pow] at card_union_le -- rw [← mul_assoc] at card_union_le -- rw [mul_comm] at card_union_le -- rw [← Nat.le_div_iff_mul_le] at card_union_le -- . -- rw [Nat.mul_div_assoc] at card_union_le -- . -- nth_rw 3 [← pow_one (a := r)] at card_union_le -- rw [Nat.pow_div] at card_union_le -- . -- -- TODO - get rid of this obnoxious Additive/Multiplicative defeq abuse -- conv => -- lhs -- arg 1 -- equals r • ((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)) => -- ext a -- rw [Finset.mem_pow] -- -- TODO - why do we need explicit args here -- refine Iff.trans ?_ Finset.mem_nsmul.symm -- refine ⟨?_, ?_⟩ -- . -- intro hf -- obtain ⟨f, hf⟩ := hf -- use f -- exact hf -- . intro hf -- obtain ⟨f, hf⟩ := hf -- use f -- exact hf -- exact card_union_le -- . omega -- . omega -- -- . -- nth_rw 1 [← pow_one (a := r)] -- apply Nat.pow_dvd_pow -- omega -- . omega -- --#print axioms three_two_kernel_poly_growth -+ have hbound := cancel_growth_factor (by omega : 0 < r) hd (card_union_le.trans ker_poly) -+ rw [multiplicative_symm_pow] -+ exact hbound -+ - - - omit hGS in -@@ -436,7 +429,6 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by - have S_closure := hGS.generates - - let pow_cards := Set.range (fun (n: ℕ) => #(S ^ n)) -- -- TODO - this can probably be much simpler - have pow_cards_bounded: ∃ y, ∀ n ∈ pow_cards, n ≤ y := by - use a - intro n hn -@@ -445,9 +437,8 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by - rw [← hy] - - by_cases y_eq_zero: y = 0 -- . simp [y_eq_zero] -+ · simp [y_eq_zero] - -- -- TODO - deduplicate this - have a_ne_zero: a ≠ 0 := by - by_contra! - rw [this] at ha -@@ -458,20 +449,20 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by - simp at one_mem - - omega -- . by_cases y_eq_one: y = 1 -- . -+ · by_cases y_eq_one: y = 1 -+ · - simp [y_eq_one] - have card_mono := Finset.card_pow_mono (s := S) (m := 1) (n := 2) (by simp) (by simp) - have card_two_le := ha 2 (by simp) - simp at card_mono - linarith -- . -+ · - exact ha y (by omega) - - - classical - have max_card_mem := Nat.sSup_mem (s := pow_cards) ?_ ?_ -- . simp [pow_cards] at max_card_mem -+ · simp [pow_cards] at max_card_mem - obtain ⟨y, hy⟩ := max_card_mem - - -@@ -483,7 +474,7 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by - exact Generates.one_mem - | mem x hx => - by_cases y_eq_zero: y = 0 -- . -+ · - rw [y_eq_zero] - rw [y_eq_zero] at hy - simp at hy -@@ -492,27 +483,27 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by - have find_le := Nat.find_spec pow_cards_bounded - rw [← y_eq] at find_le - have S_one_le := find_le #(S) ?_ -- . -+ · - simp [pow_cards] at S_one_le - rw [← hy] at S_one_le - rw [Finset.card_le_one] at S_one_le - have one_mem: 1 ∈ S := by exact Generates.one_mem - have x_eq := S_one_le 1 one_mem x hx - apply x_eq.symm -- . simp [pow_cards] -+ · simp [pow_cards] - use 1 - simp -- . -+ · - have pow_mono := Finset.pow_subset_pow_right (s := S) (Generates.one_mem) (n := y) (m := 1) (by omega) - simp at pow_mono - apply pow_mono hx - | mul a b a_mem_closure b_mem_closure a_mem_pow b_mem_pow => - by_cases y_eq_zero: y = 0 -- . -+ · - simp [y_eq_zero] - simp [y_eq_zero] at a_mem_pow b_mem_pow - simp [a_mem_pow, b_mem_pow] -- . -+ · - by_contra! - have a_b_mem_two: a * b ∈ (S ^ (y * 2)) := by - have mem_mul := Finset.mul_mem_mul a_mem_pow b_mem_pow -@@ -535,10 +526,10 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by - have find_le := Nat.find_spec pow_cards_bounded - rw [← y_eq] at find_le - have reverse_le := find_le #(S ^ (y * 2)) ?_ -- . -+ · - simp [pow_cards] at reverse_le - linarith -- . simp [pow_cards] -+ · simp [pow_cards] - | inv a ha a_mem_pow => - rw [← Finset.mem_inv'] - rw [← inv_pow] -@@ -559,11 +550,11 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by - rw [← S_closure] - ext a - refine ⟨?_, ?_⟩ -- . intro ha -+ · intro ha - simp at ha - rw [← Finset.coe_pow] - exact all_closure_mem a ha -- . intro ha -+ · intro ha - simp - exact mem_closure a - -@@ -571,10 +562,10 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by - rw [← Finset.coe_pow] - exact Finset.finite_toSet (S ^ y) - exact G_finite -- . -+ · - simp [pow_cards] - apply Set.range_nonempty -- . -+ · - rw [bddAbove_def] - exact pow_cards_bounded - -@@ -599,6 +590,5 @@ lemma growth_exponent_pos {d : ℕ} (h: HasPolynomialGrowthD S d): 0 < d := by - have := hGS.g_infinite - exact (not_finite G) - ---- TODO - add an explicit top-level universe parameter to avoid this 'omit hGS' hack - - end GeneratesNS -diff --git a/Gromov/Harmonic.lean b/Gromov/Harmonic.lean -index 939cd59..b28dc07 100644 ---- a/Gromov/Harmonic.lean -+++ b/Gromov/Harmonic.lean -@@ -8,13 +8,10 @@ public import Gromov.Harmonic.CaseOne - - `nontrivial_harmonic_case_two` and the main result `exists_nontrivial_harmonic`. - --Root of the `Gromov.Harmonic` hierarchy. - -/ - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - attribute [local implicit_reducible] Additive - - namespace GeneratesNS -@@ -32,12 +29,10 @@ open MeasureTheory - - open scoped RealInnerProductSpace - --set_option maxHeartbeats 2000000 in - lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun n: ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0))): ∃ F: LipschitzH , ∀ z: ℝ, F ≠ ConstLipschitzH z := by - obtain ⟨s, hs⟩ := f_n_limit - let H_n := fun n g => if ((f_n n g⁻¹) - (Conv (f_n n) (delta s.val)) g⁻¹) ≠ 0 then ((f_n n g⁻¹) - (Conv (f_n n) (delta s.val)) g⁻¹) / |((f_n n g⁻¹) - (Conv (f_n n) (delta s.val)) g⁻¹)| else 1 - -- -- TODO - why can't we write '∞' here - have H_n_norm: ∀ n: ℕ, MeasureTheory.eLpNorm (H_n n) (p := ⊤) MeasureTheory.volume = 1 := by - intro n - simp [H_n] -@@ -49,24 +44,24 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - simp [H_n] - intro g - split_ifs -- . simp -- . -+ · simp -+ · - - rename_i foo - by_cases val_pos: 0 ≤ ((f_n n g⁻¹) - (Conv (f_n n) (delta s.val)) g⁻¹) -- . -+ · - rw [abs_of_nonneg val_pos] - rw [div_self] -- . simp -- . exact foo -- . -+ · simp -+ · exact foo -+ · - rw [abs_of_neg] -- . -+ · - rw [div_neg_self] -- . -+ · - simp -- . exact foo -- . linarith -+ · exact foo -+ · linarith - - unfold H_n at h_norm_one - simp at h_norm_one -@@ -78,21 +73,21 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - simp [H_n] - simp [f_conv_delta] - split_ifs -- . linarith -- . -+ · linarith -+ · - rename_i diff_zero - by_cases val_pos: 0 ≤ f_n n g - f_n n ((↑s)⁻¹ * g) -- . -+ · - rw [abs_of_nonneg val_pos] - rw [div_self] -- . linarith -- . assumption -- . -+ · linarith -+ · assumption -+ · - rw [abs_of_neg] -- . rw [div_neg_self] -- . linarith -- . assumption -- . -+ · rw [div_neg_self] -+ · linarith -+ · assumption -+ · - simpa using val_pos - - have fn_sub_norm: ∀ n: ℕ, eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 = ENNReal.ofReal |((Conv (H_n n) (f_n n)) 1) - ((Conv (H_n n) (f_n n)) s⁻¹)| := by -@@ -108,26 +103,26 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - equals (H_n n g⁻¹) * (f_n n g - (Conv (f_n n) (delta s.val)) g) => - simp [H_n] - split_ifs -- . -+ · - rename_i diff_eq_zero - simp [diff_eq_zero] -- . -+ · - rename_i diff_ne_zero - by_cases val_pos: 0 ≤ ((f_n n g) - (Conv (f_n n) (delta s.val)) g) -- . -+ · - rw [abs_of_nonneg] -- . -+ · - rw [div_self] - simp - apply diff_ne_zero -- . exact val_pos -- . -+ · exact val_pos -+ · - rw [abs_of_neg] -- . -+ · - rw [div_neg_self] - simp - exact diff_ne_zero -- . -+ · - simpa using val_pos - - rw [conv_eq_sum (by -@@ -138,8 +133,8 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - apply Set.Finite.inter_of_right - apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) - refine Set.Finite.biUnion' ?_ ?_ -- . exact Set.toFinite (Membership.mem Finset.univ.val) -- . intro m hm -+ · exact Set.toFinite (Membership.mem Finset.univ.val) -+ · intro m hm - apply mu_conv_finsupp - )] - -@@ -151,8 +146,8 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - apply Set.Finite.inter_of_right - apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) - refine Set.Finite.biUnion' ?_ ?_ -- . exact Set.toFinite (Membership.mem Finset.univ.val) -- . intro m hm -+ · exact Set.toFinite (Membership.mem Finset.univ.val) -+ · intro m hm - apply mu_conv_finsupp - )] - -@@ -171,14 +166,14 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - apply Set.Finite.inter_of_right - apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) - refine Set.Finite.biUnion' ?_ ?_ -- . exact Set.toFinite (Membership.mem Finset.univ.val) -- . -+ · exact Set.toFinite (Membership.mem Finset.univ.val) -+ · - intro m hm - apply Set.Finite.of_injOn (f := fun a => ((Additive.toMul a))⁻¹) (ht := mu_conv_finsupp m) -- . -+ · - intro a ha - exact ha -- . intro a ha b hb -+ · intro a ha b hb - simp - ) (by - apply summable_of_hasFiniteSupport -@@ -190,14 +185,14 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - apply Set.Finite.inter_of_right - apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) - refine Set.Finite.biUnion' ?_ ?_ -- . exact Set.toFinite (Membership.mem Finset.univ.val) -- . -+ · exact Set.toFinite (Membership.mem Finset.univ.val) -+ · - intro m hm - apply Set.Finite.of_injOn (f := fun a => s.val⁻¹ * ((Additive.toMul a))⁻¹ ) (ht := mu_conv_finsupp m) -- . -+ · - intro a ha - exact ha -- . intro a ha b hb -+ · intro a ha b hb - simp - )] - simp_rw [mul_sub] -@@ -208,25 +203,25 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - simp - rw [abs_of_nonneg] - rfl -- . -+ · - apply tsum_nonneg - apply H_n_diff_pos n -- . -+ · - simp - apply Function.Injective.comp -- . exact neg_injective -- . exact fun ⦃a₁ a₂⦄ a ↦ a -- . -+ · exact neg_injective -+ · exact fun ⦃a₁ a₂⦄ a ↦ a -+ · - simp - intro g hg - use g⁻¹ - simp -- . -+ · - apply tsum_nonneg - apply H_n_diff_pos n -- . simp -- . apply H_n_diff_pos n -- . -+ · simp -+ · apply H_n_diff_pos n -+ · - simp_rw [← mul_sub] - apply summable_of_hasFiniteSupport - change (Function.support _).Finite -@@ -235,12 +230,12 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - apply Set.Finite.subset (hs := ?_) (ht := Function.support_sub _ _) - simp - refine ⟨?_, ?_⟩ -- . apply f_n_fin_supp -- . -+ · apply f_n_fin_supp -+ · - apply Set.Finite.of_injOn (f := fun a => s.val⁻¹ * a) (ht := f_n_fin_supp n) -- . intro a ha -+ · intro a ha - simpa using ha -- . simp -+ · simp - - - have haar_eq_haar_add : myHaar = myHaarAddOpp := by -@@ -267,7 +262,7 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - - have conv_laplce_norm (n: ℕ): eLpNorm ((Laplace_b ((Conv (H_n n)) (f_n n)))) ⊤ (μ := volume (α := G)) ≤ eLpNorm (H_n n) ⊤ * (eLpNorm (Laplace_b (f_n n)) 1 (μ := volume (α := G))) := by - rw [laplace_conv_eq_laplace_right] -- . -+ · - unfold Conv - eta_reduce - simp only [volume] -@@ -288,12 +283,12 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - calc ‖ContinuousLinearMap.mul ℝ ℝ‖ₑ * eLpNorm (H_n n) ⊤ myHaarAddOpp * eLpNorm (Laplace_b (f_n n)) 1 myHaarAddOpp - ≤ 1 * eLpNorm (H_n n) ⊤ myHaarAddOpp * eLpNorm (Laplace_b (f_n n)) 1 myHaarAddOpp := by gcongr - _ = eLpNorm (H_n n) ⊤ myHaarAddOpp * eLpNorm (Laplace_b (f_n n)) 1 myHaarAddOpp := by rw [one_mul] -- . -+ · - apply conv_exists_fin_supp - right - exact f_n_fin_supp n -- . apply f_n_nonneg -- . exact f_n_fin_supp n -+ · apply f_n_nonneg -+ · exact f_n_fin_supp n - - - let conv_h_n_cont (n: ℕ): C(G, ℝ) := { -@@ -311,7 +306,6 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - rw [count_ae_everywhere] at ae_le - simp_rw [Real.enorm_eq_ofReal_abs] at ae_le - simp_rw [Real.enorm_eq_ofReal_abs] at norm_bound -- norm_cast at ae_le - simp [volume] at norm_bound - rw [my_haar_eq_count] at norm_bound - specialize ae_le g -@@ -323,8 +317,8 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - simp [LipschitzWith] - intro x y - by_cases x_eq_y: x = y -- . simp [x_eq_y] -- . -+ · simp [x_eq_y] -+ · - norm_cast - rw [edist_dist] - rw [Real.dist_eq] -@@ -333,10 +327,10 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - rhs - equals ENNReal.ofReal (2 * (dist x y)) => - rw [ENNReal.ofReal_mul] -- . simp -- . linarith -+ · simp -+ · linarith - rw [ENNReal.ofReal_le_ofReal_iff] -- . -+ · - grw [abs_sub] - grw [abs_conv_le_one x] - grw [abs_conv_le_one y] -@@ -347,7 +341,7 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - exact dist_ne_zero.mpr x_eq_y - simp [dist] at dist_ne_zero - omega -- . simp [dist] -+ · simp [dist] - - - have compact_closure_f: IsCompact (closure ( (Set.range (fun n => (Conv (H_n n) (f_n n)))))) := by -@@ -388,8 +382,8 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - obtain ⟨F, F_mem, seq, seq_mono, tendsto_F⟩ := h_n_pointwise_converge - let F_lipschitzh := nontrivial_harmonic_common 2 (eps_seq ∘ seq) (by - apply Filter.Tendsto.comp (x := Filter.atTop) (y := Filter.atTop) -- . exact StrictMono.tendsto_atTop mono_eps_seq -- . exact StrictMono.tendsto_atTop seq_mono -+ · exact StrictMono.tendsto_atTop mono_eps_seq -+ · exact StrictMono.tendsto_atTop seq_mono - ) F H_n conv_h_n_lipschitz tendsto_F H_n_norm - use F_lipschitzh - intro z -@@ -416,7 +410,6 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - contradiction - - by_contra! -- -- TODO - there must be a cleaner way - have app_one_eq: F_lipschitzh 1 = ConstLipschitzH z (1: G) := by - rw [this] - unfold F_lipschitzh ConstLipschitzH at app_one_eq -@@ -427,19 +420,17 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun - unfold F_lipschitzh ConstLipschitzH at app_s_inv_eq - simp [DFunLike.coe] at app_s_inv_eq - rw [← app_one_eq] at app_s_inv_eq -- norm_cast at app_s_inv_eq - rw [eq_comm] at app_s_inv_eq - simp [nontrivial_harmonic_common] at app_s_inv_eq - contradiction - - --#synth OrderTopology ENNReal - - -- Theorem 3.6 - a non-constant harmonic function exists on G - theorem exists_nontrivial_harmonic: ∃ F: LipschitzH , ∀ z: ℝ, F ≠ ConstLipschitzH z := by - by_cases f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun n: ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0)) -- . exact nontrivial_harmonic_case_two f_n_limit -- . -+ · exact nontrivial_harmonic_case_two f_n_limit -+ · - simp at f_n_limit - exact nontrivial_harmonic_case_one (by - intro s -diff --git a/Gromov/Harmonic/CaseOne.lean b/Gromov/Harmonic/CaseOne.lean -index 4363fa4..0b27514 100644 ---- a/Gromov/Harmonic/CaseOne.lean -+++ b/Gromov/Harmonic/CaseOne.lean -@@ -11,8 +11,6 @@ public import Gromov.Harmonic.Proposition318 - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - attribute [local implicit_reducible] Additive - - namespace GeneratesNS -@@ -30,8 +28,6 @@ open MeasureTheory - - open scoped RealInnerProductSpace - --set_option maxRecDepth 100000 in --set_option maxHeartbeats 1000000 in - lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0))): ∃ F: LipschitzH , ∀ z: ℝ, F ≠ ConstLipschitzH z := by - - -@@ -85,12 +81,12 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - rw [← conv_smul] - rw [ ← smul_conv] - rw [conv_assoc_of_lp2] -- . -+ · - rw [← conv_add_right] -- . -+ · - rw [← ENNReal.ofReal_le_ofReal_iff] -- . -- rw [ofReal_norm_eq_enorm] -+ · -+ rw [ofReal_norm] - grw [counting_le_essSup] - rw [essSup_eq_elpNorm_top] - simp only [volume] -@@ -110,10 +106,10 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - exact my_add_haar_eq_count.symm - - refine le_trans (ENNReal.eLpNorm_top_convolution_le (μ := myHaarAddOpp) (c := 1) (p := 2) (q := 2) (hpq := inferInstance) (by apply AEMeasurable.of_discrete) (by apply AEMeasurable.of_discrete) (by intro a b; simp)) ?_ -- . -- simp [norm, volume] at H_n_norm -+ · -+ simp [volume] at H_n_norm - rw [my_add_haar_eq_count] -- simp [H_n_norm] -+ simp - - have sum_norm := proposition_3_18 (G'_n f_n_limit) - have g_inner_laplace := MeasureTheory.L2.inner_def (Laplace (G'_n f_n_limit)) (G'_n f_n_limit) (𝕜 := ℝ) (α := G) -@@ -124,11 +120,11 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - rw [inv_mul_eq_div] at g_inner_laplace - rw [eq_div_iff_mul_eq] at g_inner_laplace - -- . -+ · - simp [eLpNorm, eLpNorm'] - simp [-AddSubgroupClass.coe_sub, -AddSubgroup.coe_sub, MeasureTheory.Lp.norm_def, eLpNorm, eLpNorm', conv_finsupp_lp2] at g_inner_laplace - rw [← ENNReal.ofReal_rpow_of_pos] -- . -+ · - have hkey : (∫⁻ (a : Additive G), ‖(H_n (seq n) s : Additive G → ℝ) a‖ₑ ^ 2 ∂Measure.count) ^ (2 : ℝ)⁻¹ = 1 := by - have h := H_n_norm n - show (∫⁻ (a : G), ‖(H_n (seq n) s : G → ℝ) a‖ₑ ^ 2 ∂Measure.count) ^ (2 : ℝ)⁻¹ = 1 -@@ -136,9 +132,8 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - my_haar_eq_count] using h - rw [hkey, one_mul] - apply ENNReal.rpow_le_rpow -- . -+ · - generalize_proofs p_1 p_2 p_3 -- -- TODO - make this less horrible - grw [Finset.single_le_sum (f := (fun g => ∫⁻ (a : Additive G), ‖(G_n ((seq n) + 1) (by simp) f_n_limit) a + Conv (-↑↑(G_n ((seq n) + 1) (by simp) f_n_limit)) (delta g) a‖ₑ ^ 2 ∂Measure.count)) (s := S) (hf := by simp) (h := (by rw [S_eq_Sinv]; simp [hy]))] - - -@@ -158,9 +153,8 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - apply_fun ENNReal.ofReal at g_inner_laplace - simp at g_inner_laplace - rw [g_inner_laplace] -- norm_cast - rw [ENNReal.ofReal_sum_of_nonneg] -- . -+ · - conv => - rhs - arg 2 -@@ -172,53 +166,53 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - ) (G_n ((seq n) + 1) (by simp) f_n_limit))) - rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] at g_norm - rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_compMeasurePreserving _ _)] at g_norm -- simp [eLpNorm, eLpNorm', Lp.compMeasurePreserving] at g_norm -+ simp [eLpNorm, eLpNorm'] at g_norm - rw [ENNReal.rpow_lt_top_iff_of_pos (by simp)] at g_norm - grind - )] - simp [volume] - simp_rw [my_haar_eq_count] - apply le_refl -- . simp -- . simp -- . -+ · simp -+ · simp -+ · - simpa using S_nonempty - - -- Finset.single_le_sum -- . simp -+ · simp - grind -- . -+ · - apply MeasureTheory.Integrable.of_integral_ne_zero - rw [← g_inner_laplace] - simp [G'_n] - have foo := g_n_conv_norm (seq (n) + 1) (by simp) f_n_limit - grind -- . -+ · - exact NNReal.coe_nonneg _ -- . -+ · - simp [ConvExists] - rw [my_add_haar_eq_count] - apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) -- . infer_instance -- . simp -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . rw [← my_add_haar_eq_count] -+ · infer_instance -+ · simp -+ · apply AEStronglyMeasurable.of_discrete -+ · apply AEStronglyMeasurable.of_discrete -+ · rw [← my_add_haar_eq_count] - apply Lp.memLp -- . rw [← my_add_haar_eq_count] -+ · rw [← my_add_haar_eq_count] - apply Lp.memLp -- . -+ · - simp [ConvExists] - rw [my_add_haar_eq_count] - apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) -- . infer_instance -- . simp -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . rw [← my_add_haar_eq_count] -+ · infer_instance -+ · simp -+ · apply AEStronglyMeasurable.of_discrete -+ · apply AEStronglyMeasurable.of_discrete -+ · rw [← my_add_haar_eq_count] - apply Lp.memLp -- . -- refine ⟨by apply AEStronglyMeasurable.of_discrete, ?_⟩ -+ · -+ unfold MemLp - rw [← my_add_haar_eq_count] - rw [← neg_one_smul ℝ] - rw [conv_smul] -@@ -227,7 +221,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - simp [Conv] - rw [← Function.comp_def (β := Additive G)] - rw [MeasureTheory.eLpNorm_comp_measurePreserving (ν := Measure.count)] -- . -+ · - conv => - arg 1 - arg 1 -@@ -244,44 +238,43 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - - rw [← my_add_haar_eq_count] - grw [ENNReal.eLpNorm_convolution_le_enorm_mul (p := 2) (q := 1)] -- . -+ · - refine ENNReal.mul_lt_top (ENNReal.mul_lt_top (by simp) ?_) ?_ - · exact MeasureTheory.MemLp.eLpNorm_lt_top (MeasureTheory.MemLp.comp_measurePreserving (ν := volume) (Lp.memLp _) measure_preserving_unop_tomul) - · refine MeasureTheory.MemLp.eLpNorm_lt_top (MeasureTheory.MemLp.comp_measurePreserving (ν := volume) ?_ measure_preserving_unop_tomul) - apply Continuous.memLp_of_hasCompactSupport - · fun_prop - · simp [HasCompactSupport, tsupport] -- . simp -- . simp -- . simp -- . simp -- . apply AEMeasurable.of_discrete -- . apply AEMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . rw [my_add_haar_eq_count] -+ · simp -+ · simp -+ · simp -+ · simp -+ · apply AEMeasurable.of_discrete -+ · apply AEMeasurable.of_discrete -+ · apply AEStronglyMeasurable.of_discrete -+ · rw [my_add_haar_eq_count] - apply MeasurePreserving.id -- . rw [← my_haar_eq_count] -+ · rw [← my_haar_eq_count] - apply Lp.memLp -- . rw [← my_haar_eq_count] -+ · rw [← my_haar_eq_count] - simp - apply MemLp.neg - apply Lp.memLp -- . simp -+ · simp - - -- Now rename Hn ∗Gn such that we have added a constant so that Hn ∗Gn(e) = 0 - let new_seq: ℕ → ℕ := seq - let H_G_conv_zero (n: ℕ) (g: G) := ((Conv (H_n ((new_seq n)) s) (G_n ((new_seq n) + 1) (by simp) f_n_limit)) g) - (Conv (H_n ((new_seq n)) s) (G_n ((new_seq n) + 1) (by simp) f_n_limit) 1) - - -- -- TODO - can the lipschitz constant can be improved? - have H_G_conv_zero_lipschitz: ∀ n: ℕ, LipschitzWith ((((2 * #(S))^((2 : ℝ)⁻¹))) + 0) (H_G_conv_zero n) := by - intro n - simp only [H_G_conv_zero] - simp only [new_seq] - apply LipschitzWith.sub -- . -+ · - apply h_n_f_lipschitz -- . apply LipschitzWith.const -+ · apply LipschitzWith.const - - - have H_n_conv_zero_eq: ∀ n: ℕ, (H_G_conv_zero (n) 1) - (H_G_conv_zero (n) s⁻¹) = ‖(G_n ((new_seq n) + 1) (by simp) f_n_limit) - (conv_finsupp_lp2 (((G_n ((new_seq n) + 1) (by simp) f_n_limit))) (delta s) (by simp [delta]))‖ := by -@@ -297,9 +290,9 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - rw [← conv_smul] - rw [ ← smul_conv] - rw [conv_assoc_of_lp2] -- . -+ · - rw [← conv_add_right] -- . -+ · - simp [H_n, conv_finsupp_lp2] - rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_smul _ _)] - rw [conv_smul] -@@ -313,7 +306,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_compMeasurePreserving _ _)] - rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_compMeasurePreserving _ _)] - simp only [convolution, -- ContinuousLinearMap.coe_sub', ContinuousLinearMap.mul_apply', Pi.smul_apply, smul_eq_mul] -+ ContinuousLinearMap.mul_apply', Pi.smul_apply, smul_eq_mul] - simp - have t_fake_inv: ∀ (t: G), (t: (Additive G))⁻¹ = -(Additive.ofMul t) := by - intro t -@@ -346,8 +339,8 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - rw [f_conv_delta_helper] - rw [← Function.comp_def] - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp -- . -+ · apply MeasureTheory.Lp.memLp -+ · - exact measurePreserving_mul_left volume s⁻¹ - )] - rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_neg _)] -@@ -373,8 +366,8 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - rw [f_conv_delta_helper] - rw [← Function.comp_def] - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp -- . -+ · apply MeasureTheory.Lp.memLp -+ · - exact measurePreserving_mul_left volume s⁻¹ - ))‖^2 => - rw [← real_inner_self_eq_norm_sq] -@@ -390,59 +383,58 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - · simp [h] - · field_simp - exact key _ -- . -+ · - simp [ConvExists] - rw [my_add_haar_eq_count] - apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) -- . infer_instance -- . simp -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . rw [← Function.comp_def] -+ · infer_instance -+ · simp -+ · apply AEStronglyMeasurable.of_discrete -+ · apply AEStronglyMeasurable.of_discrete -+ · rw [← Function.comp_def] - apply MeasureTheory.MemLp.comp_measurePreserving -- . apply Lp.memLp -- . simp [volume] -+ · apply Lp.memLp -+ · simp [volume] - rw [my_haar_eq_count] - apply MeasureTheory.MeasurePreserving.id -- . -+ · - apply MeasureTheory.MemLp.comp_measurePreserving -- . apply Lp.memLp -- . simp [volume] -+ · apply Lp.memLp -+ · simp [volume] - rw [my_haar_eq_count] - apply MeasureTheory.MeasurePreserving.id -- . -- -- TODO - deduplicate this -+ · - simp [f_conv_delta_helper] - simp [ConvExists] - rw [my_add_haar_eq_count] - apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) -- . infer_instance -- . simp -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . rw [← Function.comp_def] -+ · infer_instance -+ · simp -+ · apply AEStronglyMeasurable.of_discrete -+ · apply AEStronglyMeasurable.of_discrete -+ · rw [← Function.comp_def] - apply MeasureTheory.MemLp.comp_measurePreserving -- . apply Lp.memLp -- . simp [volume] -+ · apply Lp.memLp -+ · simp [volume] - rw [my_haar_eq_count] - apply MeasureTheory.MeasurePreserving.id -- . -+ · - apply MeasureTheory.MemLp.neg - rw [← Function.comp_def] - apply MeasureTheory.MemLp.comp_measurePreserving -- . apply Lp.memLp -- . -+ · apply Lp.memLp -+ · - simp [volume] - rw [my_haar_eq_count] - refine MeasurePreserving.mul_left Measure.count s⁻¹ ?_ - apply MeasureTheory.MeasurePreserving.id -- . rw [← my_haar_eq_count] -+ · rw [← my_haar_eq_count] - apply Lp.memLp -- . rw [← my_haar_eq_count] -+ · rw [← my_haar_eq_count] - simp - apply MemLp.neg - apply Lp.memLp -- . simp [delta] -+ · simp [delta] - - - have compact_with_fixed_g (g: G): IsCompact (closure ( (Set.range (fun n => H_G_conv_zero n g)))) := by -@@ -468,7 +460,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - rw [dist_comm] at bar - grw [bar] - simp [H_G_conv_zero] -- ring -+ ring_nf - simp - - have new_compact_closure: IsCompact (closure (Set.range (fun n => H_G_conv_zero n))) := by -@@ -494,7 +486,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - rw [dist_comm] at bar - grw [bar] - simp [H_G_conv_zero] -- ring -+ ring_nf - simp - - have arzela_tendsto := IsCompact.tendsto_subseq new_compact_closure (x := fun n => ( -@@ -528,9 +520,9 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - - have new_tendsto_sub := (abs_tendsto _).comp ((tendsto_arzela_lim x).sub (tendsto_arzela_lim y)) - have sub_le := le_of_tendsto new_tendsto_sub (b := ((↑(#S) * 2) ^ (2 : ℝ)⁻¹) * (dist x y)) ?_ -- . norm_cast -+ · norm_cast - norm_cast at sub_le -- . apply Filter.Eventually.of_forall -+ · apply Filter.Eventually.of_forall - intro n - have foo := (H_G_conv_zero_lipschitz (arzela_seq n)).dist_le_mul x y - rw [Real.dist_eq] at foo -@@ -547,7 +539,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - intro x - rw [← sub_eq_zero] - -- have sum_lim := tendsto_finset_sum (s := S) (fun s hs => tendsto_arzela_lim (s * x)) -+ have sum_lim := tendsto_finsetSum (s := S) (fun s hs => tendsto_arzela_lim (s * x)) - have tendsto_sub := (tendsto_arzela_lim x).sub (sum_lim.const_mul ((#S : ℝ))⁻¹) - norm_cast - -@@ -555,13 +547,13 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - (f := (fun x_1 ↦ |((fun n ↦ H_G_conv_zero n) ∘ arzela_seq) x_1 x - (↑(#S))⁻¹ * ∑ c ∈ S, ((fun n ↦ H_G_conv_zero n) ∘ arzela_seq) x_1 (c * x)|)) - (g := fun n => (1 / (n + 1))) - ?_ ?_ ?_ -- . -+ · - have target_eq_zero := tendsto_nhds_unique ((abs_tendsto _).comp tendsto_sub) (lim_zero) - rw [abs_eq_zero] at target_eq_zero - rw [sub_eq_zero] at target_eq_zero - simp [target_eq_zero] -- . simp -- . intro n -+ · simp -+ · intro n - simp - conv => - lhs -@@ -588,7 +580,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - grw [abs_add_le] - simp - rw [laplace_conv_eq_laplace_right_of_lp2] -- . -+ · - simp [Conv] - grw [ENNReal.ofReal_add_le] - rw [← Real.enorm_eq_ofReal_abs] -@@ -619,7 +611,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - · rw [ENNReal.inv_top, zero_add]; exact ENNReal.inv_two_add_inv_two - · apply AEMeasurable.of_discrete - · apply AEMeasurable.of_discrete -- . -+ · - conv => - lhs - arg 1 -@@ -661,32 +653,31 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: - - omega - -- . -- -- TODO - deduplicate this -+ · - simp [ConvExists] - rw [my_add_haar_eq_count] - apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) -- . infer_instance -- . simp -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . rw [← Function.comp_def] -+ · infer_instance -+ · simp -+ · apply AEStronglyMeasurable.of_discrete -+ · apply AEStronglyMeasurable.of_discrete -+ · rw [← Function.comp_def] - apply MeasureTheory.MemLp.comp_measurePreserving -- . apply Lp.memLp -- . simp [volume] -+ · apply Lp.memLp -+ · simp [volume] - rw [my_haar_eq_count] - apply MeasureTheory.MeasurePreserving.id -- . -+ · - apply MeasureTheory.MemLp.comp_measurePreserving -- . apply Lp.memLp -- . simp [volume] -+ · apply Lp.memLp -+ · simp [volume] - rw [my_haar_eq_count] - apply MeasureTheory.MeasurePreserving.id -- . rw [← my_haar_eq_count] -+ · rw [← my_haar_eq_count] - apply Lp.memLp -- . rw [← my_haar_eq_count] -+ · rw [← my_haar_eq_count] - apply Lp.memLp -- . -+ · - simp - simp_rw [inv_eq_one_div] - apply tendsto_one_div_add_atTop_nhds_zero_nat -diff --git a/Gromov/Harmonic/Convolution.lean b/Gromov/Harmonic/Convolution.lean -index 9721ae6..c14260c 100644 ---- a/Gromov/Harmonic/Convolution.lean -+++ b/Gromov/Harmonic/Convolution.lean -@@ -19,8 +19,6 @@ multiplication, and `laplace_conv_eq_laplace_right`. - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - attribute [local implicit_reducible] Additive - - namespace GeneratesNS -@@ -49,30 +47,28 @@ lemma harmonic_maximum_implies_const (f: G → ℝ) (hf: Laplace_b f = 0) (a: G - rw [ih] at f_at_l - field_simp at f_at_l - -- -- TODO - is there a 'Finset.expect' theorem we can use? -- -- TODO - upstream this to mathlib in some form - have f_s_eq: ∀ s: S, f a = f (s * (l.unattach.prod * a)) := by - by_contra! - simp at this - obtain ⟨s, s_mem_s, hs⟩ := this - by_cases val_le_max: f (s * (l.unattach.prod * a)) ≤ f a -- . -+ · - have val_lt_max: f (s * (l.unattach.prod * a)) < f a := by - exact lt_of_le_of_ne (h_max (↑s * (l.unattach.prod * a))) (id (Ne.symm hs)) - - have sum_strict_lt := Finset.sum_lt_sum (f := fun x => f (x * (l.unattach.prod * a))) (g := fun x => f a) (s := S) ?_ ?_ -- . -+ · - simp at sum_strict_lt - rw [mul_comm] at sum_strict_lt - rw [← div_lt_iff₀] at sum_strict_lt -- . -+ · - apply ne_of_gt at sum_strict_lt - contradiction -- . simpa using S_nonempty -- . intro s hs -+ · simpa using S_nonempty -+ · intro s hs - apply h_max -- . use s -- . -+ · use s -+ · - have val_gt := h_max (s * (l.unattach.prod * a)) - simp at val_le_max - linarith -@@ -102,7 +98,7 @@ open scoped Convolution - open MeasureTheory - - --lemma laplace_b_const (k: ℝ): Laplace_b (fun g => k) = 0 := by -+lemma laplace_b_const (k: ℝ): Laplace_b (fun _g => k) = 0 := by - simp [Laplace_b] - simp [f_conv_mu] - ext a -@@ -111,8 +107,8 @@ lemma laplace_b_const (k: ℝ): Laplace_b (fun g => k) = 0 := by - rw [← mul_assoc] - - rw [inv_mul_cancel₀] -- . simp -- . simp -+ · simp -+ · simp - have foo := S_nonempty - grind - -@@ -129,9 +125,9 @@ lemma conv_add_right {f g h: G → ℝ} (h_fg: ConvExists f g) (h_fh : ConvExist - rfl - - rw [MeasureTheory.ConvolutionExists.distrib_add] -- . rfl -- . exact h_fg -- . exact h_fh -+ · rfl -+ · exact h_fg -+ · exact h_fh - - lemma conv_add_left {f g h: G → ℝ} (h_fh: ConvExists f h) (h_gh : ConvExists g h): Conv (f + g) h = Conv f h + Conv g h := by - unfold Conv -@@ -143,9 +139,9 @@ lemma conv_add_left {f g h: G → ℝ} (h_fh: ConvExists f h) (h_gh : ConvExists - rfl - - rw [MeasureTheory.ConvolutionExists.add_distrib] -- . rfl -- . exact h_fh -- . exact h_gh -+ · rfl -+ · exact h_fh -+ · exact h_gh - - lemma conv_smul {f h: G → ℝ} (k: ℝ): Conv (k • f) h = k • Conv f h := by - funext g -@@ -176,7 +172,6 @@ lemma laplace_conv_eq_laplace_right_of_lp2 (f g: G → ℝ) (hfg: ConvExists f g - - nth_rw 2 [sub_eq_add_neg] - rw [conv_add_right] -- -- TODO - figure out how to do this without a 'conv' block - conv => - rhs - rhs -@@ -184,24 +179,24 @@ lemma laplace_conv_eq_laplace_right_of_lp2 (f g: G → ℝ) (hfg: ConvExists f g - simp - rw [smul_conv] - simp -- . rw [← sub_eq_add_neg] -- . exact hfg -- . -+ · rw [← sub_eq_add_neg] -+ · exact hfg -+ · - simp [ConvExists, MeasureTheory.ConvolutionExists, MeasureTheory.ConvolutionExistsAt] - intro a - simp_rw [f_conv_mu] - simp_rw [← mul_assoc, mul_comm, mul_assoc] - apply MeasureTheory.Integrable.const_mul - simp_rw [Finset.mul_sum] -- apply MeasureTheory.integrable_finset_sum -+ apply MeasureTheory.integrable_finsetSum - intro s hs - simp [ConvExists, MeasureTheory.ConvolutionExists, MeasureTheory.ConvolutionExistsAt] at hfg - specialize hfg (s * a) - simp_rw [mul_div] - exact hfg -- . exact hf -- . exact hg -- . apply mu_finsupp -+ · exact hf -+ · exact hg -+ · apply mu_finsupp - - - lemma laplace_conv_eq_laplace_right (f g: G → ℝ) (hfg: ConvExists f g) (g_nonneg: ∀ a: G, 0 ≤ g a) (g_finsupp: g.support.Finite): Laplace_b (Conv f g) = Conv f (Laplace_b g) := by -@@ -210,7 +205,6 @@ lemma laplace_conv_eq_laplace_right (f g: G → ℝ) (hfg: ConvExists f g) (g_no - - nth_rw 2 [sub_eq_add_neg] - rw [conv_add_right] -- -- TODO - figure out how to do this without a 'conv' block - conv => - rhs - rhs -@@ -218,34 +212,33 @@ lemma laplace_conv_eq_laplace_right (f g: G → ℝ) (hfg: ConvExists f g) (g_no - simp - rw [smul_conv] - simp -- . rw [← sub_eq_add_neg] -- . exact hfg -- . -+ · rw [← sub_eq_add_neg] -+ · exact hfg -+ · - simp [ConvExists, MeasureTheory.ConvolutionExists, MeasureTheory.ConvolutionExistsAt] - intro a - simp_rw [f_conv_mu] - simp_rw [← mul_assoc, mul_comm, mul_assoc] - apply MeasureTheory.Integrable.const_mul - simp_rw [Finset.mul_sum] -- apply MeasureTheory.integrable_finset_sum -+ apply MeasureTheory.integrable_finsetSum - intro s hs - simp [ConvExists, MeasureTheory.ConvolutionExists, MeasureTheory.ConvolutionExistsAt] at hfg - specialize hfg (s * a) - simp_rw [mul_div] - exact hfg -- . exact hfg -- . -+ · exact hfg -+ · - apply conv_exists_fin_supp - right - exact mu_finsupp -- . apply g_finsupp -- . exact g_nonneg -- . exact mu_finsupp -- . intro a -+ · apply g_finsupp -+ · exact g_nonneg -+ · exact mu_finsupp -+ · intro a - simp [mu] - positivity - --#print axioms laplace_conv_eq_laplace_right - - - -- simp_rw [tsum_eq_sum] -@@ -257,14 +250,13 @@ lemma f_n_fin_supp (n: ℕ): (f_n n).support.Finite := by - apply Set.Finite.inter_of_right - apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) - refine Set.Finite.biUnion' ?_ ?_ -- . exact Set.toFinite (Membership.mem Finset.univ.val) -- . intro m hm -+ · exact Set.toFinite (Membership.mem Finset.univ.val) -+ · intro m hm - apply mu_conv_finsupp - - - -- The expression 'Σ s_1, ..., s_n ∈ S, f(s_1 * ... * s_n)' - -- This is a sum over all n-tuples of elements in S, where each term in is f (s_1 * ... * s_n) ---- TODO - is there aless horrible way to write in in mathlib? - @[expose] - def NTupleSum (n: ℕ) (f: G → ℝ): ℝ := ∑ s : (Fin n → S), f ((List.ofFn s).unattach.prod) - -diff --git a/Gromov/Harmonic/LaplaceLinear.lean b/Gromov/Harmonic/LaplaceLinear.lean -index 81f7578..50a9795 100644 ---- a/Gromov/Harmonic/LaplaceLinear.lean -+++ b/Gromov/Harmonic/LaplaceLinear.lean -@@ -11,17 +11,15 @@ public import Gromov.Harmonic.MuConv - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - attribute [local implicit_reducible] Additive - - namespace GeneratesNS - open Generates - --variable [hGS: Generates] -+variable [hGS : Generates] - include hGS - --variable {V: Submodule ℝ LipschitzH} [V_finite: FiniteDimensional ℝ V] [Nontrivial V] -+variable {V : Submodule ℝ LipschitzH} [V_finite : FiniteDimensional ℝ V] [Nontrivial V] - - open scoped Finset - open scoped Pointwise -@@ -30,20 +28,20 @@ open MeasureTheory - - set_option maxHeartbeats 60000 in - @[expose] --noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: Filter.Tendsto seq Filter.atTop Filter.atTop) (F: G → ℝ) (H_n: ℕ → G → ℝ) (h_conv_lipschitz: ∀ n, LipschitzWith k (Conv (H_n n) (f_n n))) --(tendsto_F: Filter.Tendsto ((fun n ↦ Conv (H_n (seq n)) (f_n (seq n)))) Filter.atTop (nhds F)) --(H_n_norm: ∀ n: ℕ, MeasureTheory.eLpNorm (H_n n) (p := ⊤) MeasureTheory.volume = 1): LipschitzH := by -+noncomputable def nontrivial_harmonic_common (k : ℕ) (seq : ℕ → ℕ) (h_seq : Filter.Tendsto seq Filter.atTop Filter.atTop) (F : G → ℝ) (H_n : ℕ → G → ℝ) (h_conv_lipschitz : ∀ n, LipschitzWith k (Conv (H_n n) (f_n n))) -+(tendsto_F : Filter.Tendsto ((fun n ↦ Conv (H_n (seq n)) (f_n (seq n)))) Filter.atTop (nhds F)) -+(H_n_norm : ∀ n : ℕ, MeasureTheory.eLpNorm (H_n n) (p := ⊤) MeasureTheory.volume = 1) : LipschitzH := by - -- let conv_h_n_cont (n: ℕ): C(G, ℝ) := { -+ let conv_h_n_cont (n : ℕ) : C(G, ℝ) := { - toFun := Conv (H_n (seq n)) (f_n (seq n)), - continuous_toFun := by exact continuous_of_discreteTopology - } - -- let F_lipschitzh: LipschitzH := { -- toFun := (fun (g: G) => F g), -+ let F_lipschitzh : LipschitzH := { -+ toFun := (fun (g : G) => F g), - lipschitz := by - use k -- have closed_lipschitz := isClosed_setOf_lipschitzWith (α := G) (β := ℝ) k -+ have closed_lipschitz := isClosed_setOfPred_lipschitzWith (α := G) (β := ℝ) k - apply IsClosed.isSeqClosed at closed_lipschitz - simp [IsSeqClosed] at closed_lipschitz - have F_lipschitz := closed_lipschitz (p := F) (x := (fun n ↦ Conv (H_n (seq n)) (f_n (seq n)))) (by -@@ -55,20 +53,16 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: - simp [Harmonic] - intro g - rw [tendsto_pi_nhds] at tendsto_F -- have lim_f_sum := tendsto_finset_sum (ι := S) (M := ℝ) (s := Finset.univ) (a := fun s => F (s.val * g)) (f := (fun (s: S) n ↦ Conv (H_n (seq n)) (f_n (seq n)) (s.val *g))) (x := Filter.atTop (α := ℕ)) ?_ -- -- -- TODO - figure out why lean hangs without this -+ have lim_f_sum := tendsto_finsetSum (ι := S) (M := ℝ) (s := Finset.univ) (a := fun s => F (s.val * g)) (f := (fun (s : S) n ↦ Conv (H_n (seq n)) (f_n (seq n)) (s.val *g))) (x := Filter.atTop (α := ℕ)) ?_ - have my_mul : ContinuousMul ℝ := instIsTopologicalRingReal.toContinuousMul - have lim_f_mul_sum := Filter.Tendsto.const_mul ((#S) : ℝ)⁻¹ lim_f_sum -- . -- have lim_f_g := tendsto_F g -+ · have lim_f_g := tendsto_F g - have lim_f_g_sub := Filter.Tendsto.sub lim_f_g lim_f_mul_sum - -- have laplace_conv_tendsto_zero: Filter.Tendsto (fun n => eLpNorm (Laplace_b (Conv (H_n (seq n)) (f_n (seq n)))) ⊤) Filter.atTop (nhds 0) := by -- apply tendsto_of_tendsto_of_tendsto_of_le_of_le (g := fun n => 0) (h := fun (n: ℕ) => ENNReal.ofReal ((2: ℝ) / ((seq n) + 1) : ℝ)) -- . simp -- . -- rw [← ENNReal.tendsto_toReal_iff] -+ have laplace_conv_tendsto_zero : Filter.Tendsto (fun n => eLpNorm (Laplace_b (Conv (H_n (seq n)) (f_n (seq n)))) ⊤) Filter.atTop (nhds 0) := by -+ apply tendsto_of_tendsto_of_tendsto_of_le_of_le (g := fun n => 0) (h := fun (n : ℕ) => ENNReal.ofReal ((2 : ℝ) / ((seq n) + 1) : ℝ)) -+ · simp -+ · rw [← ENNReal.tendsto_toReal_iff] - conv => - arg 1 - intro n -@@ -80,36 +74,34 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: - arg 1 - intro n - rhs -- equals ((((((seq n) + 1): ℕ)) : ℕ ) : ℝ) => simp -+ equals ((((((seq n) + 1) : ℕ)) : ℕ ) : ℝ) => simp - conv => - arg 1 -- equals (fun (n: ℕ) => (2 : ℝ) / (n) ) ∘ (fun n => (seq n) + 1) => -+ equals (fun (n : ℕ) => (2 : ℝ) / (n) ) ∘ (fun n => (seq n) + 1) => - ext n - simp - apply Filter.Tendsto.comp -- . -- conv => -+ · conv => - arg 1 -- equals (fun (n: ℕ) => (2 : ℝ) / ((n) : ℕ)) => -+ equals (fun (n : ℕ) => (2 : ℝ) / ((n) : ℕ)) => - ext n - simp - apply tendsto_const_div_atTop_nhds_zero_nat -- . -- apply Filter.Tendsto.comp -- . conv => -+ · apply Filter.Tendsto.comp -+ · conv => - arg 1 - equals fun n => n + 1 => - simp - apply Filter.tendsto_add_atTop_nat - -- . simp -+ · simp - exact h_seq -- . simp -- . simp -- . rw [Pi.le_def] -+ · simp -+ · simp -+ · rw [Pi.le_def] - intro x - simp -- . rw [Pi.le_def] -+ · rw [Pi.le_def] - intro n - simp - have bound_by_norm_one := conv_laplce_norm (seq n) -@@ -118,7 +110,7 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: - simp at bound_by_norm_one - grw [bound_by_norm_one] - have h_norm := H_n_norm (seq n) -- simp [eLpNorm, eLpNorm'] at h_norm -+ simp [eLpNorm] at h_norm - rw [h_norm] - simp - simp_rw [Laplace_b] -@@ -127,33 +119,30 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: - - rw [← ENNReal.tendsto_toReal_iff] at laplace_conv_tendsto_zero - -- have laplace_real_tendsto_zero: Filter.Tendsto (fun n => |(Laplace_b (Conv (H_n (seq n)) (f_n (seq n))) (g))|) Filter.atTop (nhds 0) := by -+ have laplace_real_tendsto_zero : Filter.Tendsto (fun n => |(Laplace_b (Conv (H_n (seq n)) (f_n (seq n))) (g))|) Filter.atTop (nhds 0) := by - apply squeeze_zero (g := fun n => (eLpNorm (Laplace_b (Conv (H_n (seq n)) (f_n (seq n)))) ⊤ volume).toReal) -- . -- intro n -+ · intro n - simp -- . intro n -+ · intro n - have ae_le := ENNReal.ae_le_essSup (fun x ↦ ‖Laplace_b (Conv (H_n (seq n)) (f_n (seq n))) x‖ₑ) (μ := volume) - simp [volume] at ae_le - rw [my_haar_eq_count] at ae_le - rw [count_ae_everywhere] at ae_le - specialize ae_le g -- simp [eLpNorm, eLpNorm'] -+ simp [eLpNorm] - simp [eLpNormEssSup] - rw [← ENNReal.toReal_le_toReal] at ae_le -- simp only [toReal_enorm, Real.norm_eq_abs, OrderTop.bddAbove] at ae_le -+ simp only [toReal_enorm, Real.norm_eq_abs] at ae_le - simp [volume] - rw [my_haar_eq_count] - exact ae_le -- . simp -- . -- -- TODO - deduplicate this -- have bound_by_norm_one := conv_laplce_norm (seq n) H_n -+ · simp -+ · have bound_by_norm_one := conv_laplce_norm (seq n) H_n - have norm_le_two_div := f_n_sub_conv (seq n) - nth_rw 1 [eLpNorm] at bound_by_norm_one - simp at bound_by_norm_one - have h_norm := H_n_norm (seq n) -- simp [eLpNorm, eLpNorm'] at h_norm -+ simp [eLpNorm] at h_norm - rw [h_norm] at bound_by_norm_one - simp only [eLpNormEssSup] at bound_by_norm_one - simp [volume] at bound_by_norm_one -@@ -165,11 +154,10 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: - rw [my_haar_eq_count] at norm_le_two_div - grw [norm_le_two_div] - apply ENNReal.ofReal_lt_top -- . apply laplace_conv_tendsto_zero -+ · apply laplace_conv_tendsto_zero - - simp_rw [Laplace_b] at laplace_real_tendsto_zero - simp_rw [f_conv_mu] at laplace_real_tendsto_zero -- beta_reduce at laplace_real_tendsto_zero - conv at laplace_real_tendsto_zero => - arg 1 - rw [← Function.comp_def] -@@ -191,17 +179,15 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: - rw [eq_comm] at lim_eq - rw [sub_eq_zero] at lim_eq - rw [lim_eq] -- norm_cast - rw [← Finset.sum_subtype (s := S) (f := fun i => (F (i * g)))] - simp -- . intro n -- -- TODO - deduplicate this. I'm sure there's lots of other versions of it scattered around this file -+ · intro n - rw [← lt_top_iff_ne_top] - grw [conv_laplce_norm] - rw [H_n_norm] - simp - simp_rw [Laplace_b] -- grw [MeasureTheory.eLpNorm_sub_le] -+ grw [MeasureTheory.eLpNorm_sub_le (by norm_num)] - rw [f_n_norm_one] - simp_rw [f_conv_mu] - simp_rw [← smul_eq_mul] -@@ -216,8 +202,7 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: - funext g - simp - -- -- grw [MeasureTheory.eLpNorm_sum_le] -+ grw [MeasureTheory.eLpNorm_sum_le (by norm_num)] - simp_rw [← Function.comp_def] - conv => - lhs -@@ -241,26 +226,17 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: - norm_cast - rw [Real.enorm_eq_ofReal_abs] - simp -- norm_cast - apply ENNReal.mul_lt_top -- . simp -- . simp -- . -- intro s hs -- apply AEStronglyMeasurable.of_discrete -- . simp -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . simp -- -- -- . simp -- . intro s hs -+ · simp -+ · simp -+ -+ · simp -+ · intro s hs - apply tendsto_F - } - exact F_lipschitzh - --lemma counting_le_essSup (f: G → ℝ): ∀ g : G, ‖f g‖ₑ ≤ essSup (fun g => ‖f g‖ₑ) volume := by -+lemma counting_le_essSup (f : G → ℝ) : ∀ g : G, ‖f g‖ₑ ≤ essSup (fun g => ‖f g‖ₑ) volume := by - intro g - have ae_le := ENNReal.ae_le_essSup (fun g => ‖f g‖ₑ) (μ := volume) - simp [MeasureTheory.volume] at ae_le -@@ -272,12 +248,12 @@ lemma counting_le_essSup (f: G → ℝ): ∀ g : G, ‖f g‖ₑ ≤ essSup (fu - rw [my_haar_eq_count] - exact ae_le - --lemma essSup_eq_elpNorm_top (f: G → ℝ): (essSup (fun g => ‖f g‖ₑ) volume) = (eLpNorm f ⊤ volume) := by -+lemma essSup_eq_elpNorm_top (f : G → ℝ) : (essSup (fun g => ‖f g‖ₑ) volume) = (eLpNorm f ⊤ volume) := by -+ rw [MeasureTheory.eLpNorm_exponent_top (by apply AEStronglyMeasurable.of_discrete)] - rfl - -- - @[expose] --noncomputable def Laplace_linear: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G))) →ₗ[ℝ] (MeasureTheory.Lp ℝ 2 (μ := volume (α := G))) := { -+noncomputable def Laplace_linear : (MeasureTheory.Lp ℝ 2 (μ := volume (α := G))) →ₗ[ℝ] (MeasureTheory.Lp ℝ 2 (μ := volume (α := G))) := { - toFun := Laplace - map_add' := by - intro x y -@@ -300,13 +276,12 @@ noncomputable def Laplace_linear: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G - )] - - rw [MeasureTheory.MemLp.toLp_add] -- . abel -- . -- have foo := MeasureTheory.Lp.memLp (conv_mu_lp2 x) -+ · abel_nf -+ · have foo := MeasureTheory.Lp.memLp (conv_mu_lp2 x) - simp [conv_mu_lp2] at foo - rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] at foo - exact foo -- . have foo := MeasureTheory.Lp.memLp (conv_mu_lp2 y) -+ · have foo := MeasureTheory.Lp.memLp (conv_mu_lp2 y) - simp [conv_mu_lp2] at foo - rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] at foo - exact foo -@@ -321,9 +296,8 @@ noncomputable def Laplace_linear: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G - rw [smul_sub] - } - -- - @[expose] --instance volume_finite_compact: IsFiniteMeasureOnCompacts (volume (α := G)) := by -+instance volume_finite_compact : IsFiniteMeasureOnCompacts (volume (α := G)) := by - simp [volume] - rw [my_haar_eq_count] - exact { -@@ -333,18 +307,15 @@ instance volume_finite_compact: IsFiniteMeasureOnCompacts (volume (α := G)) := - exact Measure.count_apply_lt_top.mpr finite - } - -- --lemma finsupp_lp_top (f: G → ℝ) (hf: f.support.Finite) (p: ENNReal): MeasureTheory.MemLp f p (Measure.count) := by -+lemma finsupp_lp_top (f : G → ℝ) (hf : f.support.Finite) (p : ENNReal) : MeasureTheory.MemLp f p (Measure.count) := by - rw [← my_haar_eq_count] - apply Continuous.memLp_of_hasCompactSupport -- . apply continuous_of_discreteTopology -- . -- simp [HasCompactSupport] -+ · apply continuous_of_discreteTopology -+ · simp [HasCompactSupport] - rw [isCompact_iff_finite] - simp [tsupport] - exact hf - -- - @[expose] - noncomputable def F_n (n : ℕ) := Real.sqrt ∘ (f_n n) - @[expose] -@@ -354,32 +325,29 @@ noncomputable def F_n_lp2 (n : ℕ) := MeasureTheory.MemLp.toLp (F_n n) (by - apply finsupp_lp_top - simp [F_n] - apply Set.Finite.subset (s := (f_n n).support) -- . -- unfold f_n -+ · unfold f_n - apply f_n_fin_supp -- . -- apply Function.support_comp_subset -+ · apply Function.support_comp_subset - simp - ) (μ := volume (α := G)) (p := 2) - -- - @[expose] --instance volume_mul_left_invariant: (volume (α := G)).IsMulLeftInvariant := by -+instance volume_mul_left_invariant : (volume (α := G)).IsMulLeftInvariant := by - simp [volume] - rw [my_haar_eq_count] - infer_instance - - omit hGS in --lemma abs_sub_le_abs_add (a b: ℝ) (ha: 0 ≤ a) (hb: 0 ≤ b): |a - b| ≤ |a + b| := by -+lemma abs_sub_le_abs_add (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : |a - b| ≤ |a + b| := by - rw [abs_sub_le_iff] - refine ⟨?_, ?_⟩ -- . -- rw [le_abs] -+ · rw [le_abs] - grind -- . rw [le_abs] -+ · rw [le_abs] - grind - --lemma norm_sub_squared_le (a b : ℝ) (ha: 0 ≤ a) (hb: 0 ≤ b): (a - b)^2 ≤ |a^2 - b^2| := by -+omit hGS in -+lemma norm_sub_squared_le [_hGS : Generates] (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : (a - b)^2 ≤ |a^2 - b^2| := by - conv => - lhs - rw [← sq_abs] -@@ -388,56 +356,46 @@ lemma norm_sub_squared_le (a b : ℝ) (ha: 0 ≤ a) (hb: 0 ≤ b): (a - b)^2 ≤ - rw [sq_sub_sq] - rw [abs_mul] - nth_rw 2 [mul_comm] -- -- TODO - why doesn't grw work here? - apply mul_le_mul -- . simp -- . apply abs_sub_le_abs_add a b ha hb -- . simp -- . simp -- -+ · simp -+ · apply abs_sub_le_abs_add a b ha hb -+ · simp -+ · simp - - @[expose] --def f_n_conv_delta_tendsto: Prop := ∀ s: S, Filter.Tendsto (fun n: ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0) -- -+def f_n_conv_delta_tendsto : Prop := ∀ s : S, Filter.Tendsto (fun n : ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0) - --lemma f_conv_delta_helper (f: G → ℝ) (s: G): (Conv f (delta s)) = fun g => f (s⁻¹ * g) := by -+lemma f_conv_delta_helper (f : G → ℝ) (s : G) : (Conv f (delta s)) = fun g => f (s⁻¹ * g) := by - funext g - exact f_conv_delta f g s - -- - -- Lemma 3.16 in Vikman - - -- The case split statement in Vikman - --lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): -- Filter.Tendsto (fun n => ‖(F_n_lp2 n) - conv_mu_lp2 (F_n_lp2 n)‖ₑ) Filter.atTop (nhds 0) := by -+lemma F_n_conv_mu_lim (f_n_limit : f_n_conv_delta_tendsto) : Filter.Tendsto (fun n => ‖(F_n_lp2 n) - conv_mu_lp2 (F_n_lp2 n)‖ₑ) Filter.atTop (nhds 0) := by - -- have f_n_sub_norm: ∀ s ∈ S, ∀ (i : ℕ), ∑' (g : G), ‖f_n i g - f_n i (s * g)‖ₑ ≠ ⊤ := by -+ have f_n_sub_norm : ∀ s ∈ S, ∀ (i : ℕ), ∑' (g : G), ‖f_n i g - f_n i (s * g)‖ₑ ≠ ⊤ := by - intro s hs n - have foo := f_n_norm_one n - rw [← lt_top_iff_ne_top] -- rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (by simp) (by simp)] at foo -+ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (by simp) (by simp) (by apply AEStronglyMeasurable.of_discrete)] at foo - rw [lintegral_g_eq_add] at foo - simp at foo - grw [ENNReal.tsum_le_tsum (g := fun g => ‖f_n n g‖ₑ + ‖(f_n n (s * g))‖ₑ)] -- . -- rw [ENNReal.tsum_add] -+ · rw [ENNReal.tsum_add] - rw [ENNReal.add_lt_top] -- . refine ⟨?_, ?_⟩ -- . simp [foo] -- . -- grw [ENNReal.tsum_comp_le_tsum_of_injective (g := fun a => ‖f_n n a‖ₑ)] -- . -- simp [foo] -- . intro a b hab -+ · refine ⟨?_, ?_⟩ -+ · simp [foo] -+ · grw [ENNReal.tsum_comp_le_tsum_of_injective (g := fun a => ‖f_n n a‖ₑ)] -+ · simp [foo] -+ · intro a b hab - simpa using hab -- . -- intro a -+ · intro a - grw [enorm_sub_le] - - rw [← ENNReal.tendsto_toReal_iff] -- . -- have S_ne: (#S : ℝ) ≠ 0 := by -+ · have S_ne : (#S : ℝ) ≠ 0 := by - simp - have foo := hGS.hS - simp at foo -@@ -476,57 +434,38 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): - simp_rw [← Finset.sum_sub_distrib] - rw [ENNReal.toReal_zero] - -- -- apply squeeze_zero (g := fun n => (1 / ↑(#S : ℝ)) • ∑ x ∈ S, (eLpNorm ((F_n_lp2 n).val.cast - (fun (g: G) => (F_n_lp2 n) (x * g))) 2 volume).toReal) -- . simp -- . -- intro n -+ apply squeeze_zero (g := fun n => (1 / ↑(#S : ℝ)) • ∑ x ∈ S, (eLpNorm ((F_n_lp2 n).val.cast - (fun (g : G) => (F_n_lp2 n) (x * g))) 2 volume).toReal) -+ · simp -+ · intro n - rw [eLpNorm_const_smul] -- grw [eLpNorm_sum_le] -- . -- simp -+ grw [eLpNorm_sum_le (by norm_num)] -+ · simp - rw [ENNReal.toReal_sum] - intro s hs - rw [← lt_top_iff_ne_top] -- grw [eLpNorm_sub_le] -- . -- rw [ENNReal.add_lt_top] -- . refine ⟨?_, ?_⟩ -- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) -- . -- simp_rw [← Function.comp_def] -+ grw [eLpNorm_sub_le (by norm_num)] -+ · rw [ENNReal.add_lt_top] -+ · refine ⟨?_, ?_⟩ -+ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) -+ · simp_rw [← Function.comp_def] - rw [MeasureTheory.eLpNorm_comp_measurePreserving] -- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) -- . apply AEStronglyMeasurable.of_discrete -- . exact measurePreserving_mul_left volume s -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . simp -- . -- apply ENNReal.mul_ne_top (by simp) -+ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) -+ · apply AEStronglyMeasurable.of_discrete -+ · exact measurePreserving_mul_left volume s -+ · apply ENNReal.mul_ne_top (by simp) - rw [ENNReal.sum_ne_top] -- -- TODO - deduplicate this - intro s hs - rw [← lt_top_iff_ne_top] -- grw [eLpNorm_sub_le] -- . -- rw [ENNReal.add_lt_top] -- . refine ⟨?_, ?_⟩ -- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) -- . -- simp_rw [← Function.comp_def] -+ grw [eLpNorm_sub_le (by norm_num)] -+ · rw [ENNReal.add_lt_top] -+ · refine ⟨?_, ?_⟩ -+ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) -+ · simp_rw [← Function.comp_def] - rw [MeasureTheory.eLpNorm_comp_measurePreserving] -- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) -- . apply AEStronglyMeasurable.of_discrete -- . exact measurePreserving_mul_left volume s -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . simp -- . intro s hs -- apply AEStronglyMeasurable.of_discrete -- . simp -- . -- conv => -+ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) -+ · apply AEStronglyMeasurable.of_discrete -+ · exact measurePreserving_mul_left volume s -+ · conv => - rhs - equals nhds ((1 / ↑(#S : ℝ)) • 0) => - simp -@@ -534,7 +473,7 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): - apply Filter.Tendsto.const_smul - conv => - rhs -- equals nhds (∑ x_1 ∈ S⁻¹, (0: ℝ)) => -+ equals nhds (∑ x_1 ∈ S⁻¹, (0 : ℝ)) => - simp - conv => - arg 1 -@@ -542,30 +481,26 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): - arg 1 - equals S⁻¹ => - apply S_eq_Sinv -- apply tendsto_finset_sum -+ apply tendsto_finsetSum - intro s hs - conv => - arg 1 - intro n -- rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (by simp) (by simp)] -+ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (by simp) (by simp) (by apply AEStronglyMeasurable.of_discrete)] - rw [lintegral_g_eq_add] - - simp - apply squeeze_zero (g := (fun n ↦ ((∑' (g : G), ‖(f_n n) g - (f_n n) (s * g)‖ₑ) ^ (2 : ℝ)⁻¹).toReal)) -- . simp -- . -- intro n -+ · simp -+ · intro n - rw [ENNReal.toReal_le_toReal] -- . -- apply ENNReal.rpow_le_rpow -- . -- apply ENNReal.tsum_le_tsum -+ · apply ENNReal.rpow_le_rpow -+ · apply ENNReal.tsum_le_tsum - intro g - rw [Real.enorm_eq_ofReal_abs] - rw [Real.enorm_eq_ofReal_abs] - rw [← ENNReal.ofReal_pow] -- . -- apply ENNReal.ofReal_le_ofReal -+ · apply ENNReal.ofReal_le_ofReal - simp [F_n_lp2] - simp [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] - simp [F_n] -@@ -574,47 +509,39 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): - arg 1 - equals (Real.sqrt (f_n n g))^2 - (Real.sqrt (f_n n (s * g)))^2 => - rw [Real.sq_sqrt] -- . -- rw [Real.sq_sqrt] -- . apply f_n_nonneg -- . apply f_n_nonneg -+ · rw [Real.sq_sqrt] -+ · apply f_n_nonneg -+ · apply f_n_nonneg - - apply norm_sub_squared_le -- . simp -- . simp -- . simp -- . simp -- . -- rw [← lt_top_iff_ne_top] -- have norm_sub_lt: eLpNorm (((F_n_lp2 n).val.cast) - ((F_n_lp2 n) ∘ fun a ↦ s * a)) 2 volume < ⊤ := by -- grw [eLpNorm_sub_le] -+ · simp -+ · simp -+ · simp -+ · simp -+ · rw [← lt_top_iff_ne_top] -+ have norm_sub_lt : eLpNorm (((F_n_lp2 n).val.cast) - ((F_n_lp2 n) ∘ fun a ↦ s * a)) 2 volume < ⊤ := by -+ grw [eLpNorm_sub_le (by norm_num)] - rw [ENNReal.add_lt_top] - refine ⟨?_, ?_⟩ -- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) -- . -- rw [MeasureTheory.eLpNorm_comp_measurePreserving] -- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) -- . apply AEStronglyMeasurable.of_discrete -- . exact measurePreserving_mul_left volume s -- . apply AEStronglyMeasurable.of_discrete -- . apply AEStronglyMeasurable.of_discrete -- . simp -- rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (by simp) (by simp)] at norm_sub_lt -+ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) -+ · rw [MeasureTheory.eLpNorm_comp_measurePreserving] -+ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) -+ · apply AEStronglyMeasurable.of_discrete -+ · exact measurePreserving_mul_left volume s -+ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (by simp) (by simp) (by apply AEStronglyMeasurable.of_discrete)] at norm_sub_lt - rw [lintegral_g_eq_add] at norm_sub_lt - simp at norm_sub_lt - exact norm_sub_lt -- . -- apply ENNReal.rpow_ne_top_of_nonneg -- . simp -- . apply f_n_sub_norm s (by rw [S_eq_Sinv]; simp [hs]) -- . -- unfold f_n_conv_delta_tendsto at f_n_limit -+ · apply ENNReal.rpow_ne_top_of_nonneg -+ · simp -+ · apply f_n_sub_norm s (by rw [S_eq_Sinv]; simp [hs]) -+ · unfold f_n_conv_delta_tendsto at f_n_limit - simp at hs - specialize f_n_limit ⟨s⁻¹, hs⟩ - conv at f_n_limit => - arg 1 - intro n -- rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (by simp) (by simp)] -+ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (by simp) (by simp) (by apply AEStronglyMeasurable.of_discrete)] - rw [lintegral_g_eq_add] - - simp_rw [f_conv_delta_helper] at f_n_limit -@@ -625,20 +552,14 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): - simp - simp_rw [← ENNReal.toReal_rpow] - apply Filter.Tendsto.rpow_const -- . -- rw [← ENNReal.tendsto_toReal_iff] at f_n_limit -- . exact f_n_limit -- . -- apply f_n_sub_norm s (by rw [S_eq_Sinv]; simp [hs]) -- . simp -- . simp -- . intro n -+ · rw [← ENNReal.tendsto_toReal_iff] at f_n_limit -+ · exact f_n_limit -+ · apply f_n_sub_norm s (by rw [S_eq_Sinv]; simp [hs]) -+ · simp -+ · simp -+ · intro n - rw [MeasureTheory.Lp.enorm_def] - apply MeasureTheory.Lp.eLpNorm_ne_top -- . simp -- --#print axioms F_n_conv_mu_lim -- --#synth TopologicalSpace ↥(Lp ℝ 2 volume (α := G)) -+ · simp - - end GeneratesNS -diff --git a/Gromov/Harmonic/MuConv.lean b/Gromov/Harmonic/MuConv.lean -index 0524576..18a9cf4 100644 ---- a/Gromov/Harmonic/MuConv.lean -+++ b/Gromov/Harmonic/MuConv.lean -@@ -12,8 +12,6 @@ the telescoping identity `f_n_sub_conv`. - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - attribute [local implicit_reducible] Additive - - namespace GeneratesNS -@@ -35,7 +33,7 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) - funext g - simp [muConv, NTupleSum, mu, delta, Pi.single, Function.update] - by_cases g_in_s: g ∈ S -- . -+ · - simp [g_in_s] - conv => - rhs -@@ -46,21 +44,21 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) - ext a - simp - refine ⟨?_, ?_⟩ -- . intro a_zero_eq -+ · intro a_zero_eq - ext x - simp - have x_eq_zero: x = 0 := by - exact Fin.fin_one_eq_zero x - rw [x_eq_zero] - exact a_zero_eq -- . intro a_eq -+ · intro a_eq - simp [a_eq] - simp -- . -+ · - simp [g_in_s] - right - by_contra this -- . -+ · - simp at this - obtain ⟨x, hx⟩ := this - rw [← hx] at g_in_s -@@ -77,7 +75,7 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) - rw [Summable.tsum_mul_left] - simp_rw [Finset.sum_mul] - rw [Summable.tsum_finsetSum] -- . -+ · - conv => - lhs - rhs -@@ -85,11 +83,11 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) - intro x - equals (Conv (muConv n) (delta x) ) g => - rw [conv_eq_sum] -- . -+ · - unfold muConv - unfold delta - simp_rw [mul_comm] -- . -+ · - apply conv_exists_fin_supp - right - simp [delta] -@@ -116,51 +114,51 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) - nth_rw 2 [pow_succ] - simp - rw [mul_comm] -- simp only [mul_eq_mul_left_iff, inv_eq_zero, ne_eq, Nat.add_eq_zero, one_ne_zero, and_false, -+ simp only [mul_eq_mul_left_iff, inv_eq_zero, ne_eq, Nat.add_eq_zero_iff, one_ne_zero, and_false, - and_self, not_false_eq_true, pow_eq_zero_iff, Nat.cast_eq_zero, Finset.card_eq_zero] - left - rw [← Finset.sum_attach] - rw [← Finset.sum_product'] - apply Fintype.sum_bijective (e := fun (x) => (fun (i: Fin (n + 1 + 1)) => if hi: i.val = 0 then x.fst else x.snd ⟨i - 1, by omega⟩)) -- . -+ · - refine ⟨?_, ?_⟩ -- . -+ · - intro a b hab - simp at hab - ext p -- . -+ · - have fst_eq := congrFun hab (⟨0, by omega⟩) - simp at fst_eq - rw [fst_eq] - -- . -+ · - have p_lt_n_plus := p.prop - have p_val_neq: p.val ≠ n + 1 := by omega - - - have snd_eq := congrFun hab (⟨p + 1, by omega⟩) - by_cases p_eq_zero: p = 0 -- . -+ · - simp [p_eq_zero] at snd_eq - rw [p_eq_zero] - rw [snd_eq] -- . -+ · - simp [p_eq_zero] at snd_eq - rw [snd_eq] -- . -+ · - intro f - use ((f (⟨0, by omega⟩)), fun i => f (⟨i + 1, by omega⟩)) - funext i - simp - by_cases i_eq_zero: i = 0 -- . simp [i_eq_zero] -- . -+ · simp [i_eq_zero] -+ · - simp [i_eq_zero] - have i_val_neq_zero: i.val ≠ 0 := by - simp [i_eq_zero] - have one_le_i: 1 ≤ i.val := by omega - simp [Nat.sub_add_cancel one_le_i] -- . -+ · - intro x - simp only [delta] - rw [Pi.single_apply] -@@ -168,10 +166,10 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) - - - split_ifs -- . -+ · - rename _ => hi -- simp [hi] -- . -+ simp -+ · - rename_i g_eq g_mul_neq - apply_fun (fun y => (x.fst.val) * y ) at g_eq - rw [← mul_assoc] at g_eq -@@ -186,63 +184,62 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) - - - contradiction -- . rename_i g_mul_neq g_eq -+ · rename_i g_mul_neq g_eq - - simp [List.ofFn_succ] at g_eq - rw [← g_eq] at g_mul_neq - simp at g_mul_neq -- . rfl -- . intro s hs -+ · rfl -+ · intro s hs - simp [Pi.single_apply] - rw [← summable_norm_iff] - apply Summable.of_nonneg_of_le (f := fun a => ‖(fun f ↦ Conv f mu)^[n] mu ((Additive.toMul a))‖) -- . -+ · - intro x - simp -- . intro x -+ · intro x - split_ifs -- . rfl -- . simp -- . -+ · rfl -+ · simp -+ · - rw [summable_norm_iff] - have conv_finsupp := mu_conv_finsupp n - unfold muConv at conv_finsupp - - apply summable_of_hasFiniteSupport - apply Set.Finite.of_injOn (f := fun a => ( (Additive.toMul a))) (ht := conv_finsupp) -- . -+ · - intro a ha - exact ha -- . intro a ha b hb -+ · intro a ha b hb - simp -- -- TODO - deduplicate this with the above goal -- . -+ · - simp [Pi.single_apply] - rw [← summable_norm_iff] - apply Summable.of_nonneg_of_le (f := fun a => ‖(fun f ↦ Conv f mu)^[n] mu ((Additive.toMul a))‖) -- . -+ · - intro x - simp -- . intro x -+ · intro x - split_ifs -- . rfl -- . simp -- . -+ · rfl -+ · simp -+ · - rw [summable_norm_iff] - have conv_finsupp := mu_conv_finsupp n - unfold muConv at conv_finsupp - - apply summable_of_hasFiniteSupport - apply Set.Finite.of_injOn (f := fun a => ( (Additive.toMul a))) (ht := conv_finsupp) -- . -+ · - intro a ha - exact ha -- . intro a ha b hb -+ · intro a ha b hb - simp -- . -+ · - apply conv_exists_fin_supp - right -- simp [delta] -+ simp - apply Set.Finite.subset (ht := Function.support_const_smul_subset _ _) - have supp_sum := Finset.support_sum (s := S) (f := fun s => Pi.single (M := fun _ : G => ℝ) s (1: ℝ)) - conv => -@@ -262,34 +259,34 @@ lemma mu_conv_nonneg (n: ℕ): ∀ g, 0 ≤ muConv n g := by - | zero => - simp [muConv, mu] - split_ifs -- . simp -- . simp -+ · simp -+ · simp - | succ n ih => - rw [mu_conv_eq_sum] - apply mul_nonneg -- . simp -- . -+ · simp -+ · - simp [NTupleSum] - apply Finset.sum_nonneg - intro i hi - simp [delta, Pi.single_apply] - split_ifs -- . simp -- . simp -+ · simp -+ · simp - - - lemma f_n_nonneg: ∀ n: ℕ, ∀ g: G, 0 ≤ f_n n g := by - intro n g - simp [f_n] - apply mul_nonneg -- . positivity -- . apply Finset.sum_nonneg -+ · positivity -+ · apply Finset.sum_nonneg - intro i hi - apply mu_conv_nonneg - - lemma conv_laplce_norm (n: ℕ) (H_n: ℕ → G → ℝ): eLpNorm ((Laplace_b ((Conv (H_n n)) (f_n n)))) ⊤ (μ := volume (α := G)) ≤ eLpNorm (H_n n) ⊤ * (eLpNorm (Laplace_b (f_n n)) 1 (μ := volume (α := G))) := by - rw [laplace_conv_eq_laplace_right] -- . -+ · - unfold Conv - eta_reduce - simp only [volume] -@@ -307,16 +304,16 @@ lemma conv_laplce_norm (n: ℕ) (H_n: ℕ → G → ℝ): eLpNorm ((Laplace_b (( - - refine le_trans my_norm ?_ - have hmul : ‖ContinuousLinearMap.mul ℝ ℝ‖ₑ ≤ 1 := by -- rw [← ofReal_norm_eq_enorm, ENNReal.ofReal_le_one] -+ rw [← ofReal_norm, ENNReal.ofReal_le_one] - exact ContinuousLinearMap.opNorm_mul_le ℝ ℝ - rw [mul_assoc] - exact le_trans (mul_le_mul_left hmul _) (le_of_eq (one_mul _)) -- . -+ · - apply conv_exists_fin_supp - right - exact f_n_fin_supp n -- . apply f_n_nonneg -- . exact f_n_fin_supp n -+ · apply f_n_nonneg -+ · exact f_n_fin_supp n - - - lemma lintegral_g_eq_add (f: G → ENNReal): (∫⁻ (g: G), f g) = (∑' (g : G), f g) := by -@@ -325,11 +322,11 @@ lemma lintegral_g_eq_add (f: G → ENNReal): (∫⁻ (g: G), f g) = (∑' (g : G - - lemma integral_eq_eq_sum (f: G → ℝ) (hf: Integrable f): (∫ (g: G), f g) = (∑' (g : G), f g) := by - rw [MeasureTheory.integral_countable] -- . -+ · - simp [MeasureTheory.volume] - simp_rw [my_haar_eq_count] - simp -- . apply hf -+ · apply hf - - - lemma mu_norm_one (m: ℕ): MeasureTheory.eLpNorm (muConv m) 1 = 1 := by -@@ -349,35 +346,35 @@ lemma mu_norm_one (m: ℕ): MeasureTheory.eLpNorm (muConv m) 1 = 1 := by - rw [Real.enorm_of_nonneg (by - apply Finset.sum_nonneg - intro x hx -- simp [delta, Pi.single_apply] -+ simp [Pi.single_apply] - split_ifs -- . simp -- . simp -+ · simp -+ · simp - )] - - - rw [← ENNReal.ofReal_tsum_of_nonneg] - simp [Pi.single_apply] -- . intro g -+ · intro g - apply Finset.sum_nonneg - intro i - simp [Pi.single_apply] - split_ifs -- . simp -- . simp -- . -+ · simp -+ · simp -+ · - apply summable_sum - intro i hi - simp only [Pi.single_apply] - apply summable_of_hasFiniteSupport - apply Set.Finite.subset (s := {(List.ofFn i).unattach.prod}) -- . simp -- . intro a ha -+ · simp -+ · intro a ha - simp - simp at ha - rw [ha] - rw [Summable.tsum_finsetSum] -- . -+ · - conv => - lhs - rhs -@@ -394,19 +391,18 @@ lemma mu_norm_one (m: ℕ): MeasureTheory.eLpNorm (muConv m) 1 = 1 := by - rw [← ENNReal.ofReal_natCast] - rw [← ENNReal.ofReal_pow] - rw [← ENNReal.ofReal_mul] -- . -+ · - field_simp - simp - exact Finset.nonempty_iff_ne_empty.mp S_nonempty -- . simp -- . simp -- . -- -- TODO - deduplicate this with the above goal -+ · simp -+ · simp -+ · - intro a ha - apply summable_of_hasFiniteSupport - apply Set.Finite.subset (s := {(List.ofFn a).unattach.prod}) -- . simp -- . intro a ha -+ · simp -+ · intro a ha - simp - simp at ha - rw [ha] -@@ -444,7 +440,7 @@ theorem f_n_norm_one (n: ℕ): MeasureTheory.eLpNorm (f_n n) 1 = 1 := by - )] - - rw [Summable.tsum_finsetSum] -- . -+ · - have mu_norm := mu_norm_one - simp [MeasureTheory.eLpNorm, MeasureTheory.eLpNorm'] at mu_norm - simp_rw [lintegral_g_eq_add] at mu_norm -@@ -457,12 +453,12 @@ theorem f_n_norm_one (n: ℕ): MeasureTheory.eLpNorm (f_n n) 1 = 1 := by - )] - rw [← ENNReal.ofReal_natCast] - rw [← ENNReal.ofReal_mul] -- . -+ · - field_simp - simp -- . simp -+ · simp - linarith -- . -+ · - simp - - -@@ -507,7 +503,7 @@ theorem f_n_sub_conv (n: ℕ): MeasureTheory.eLpNorm ((f_n n) - (Conv (f_n n) - simp - - rw [conv_sum] -- . -+ · - rw [← smul_sub] - rw [← Finset.sum_sub_distrib] - conv => -@@ -553,8 +549,8 @@ theorem f_n_sub_conv (n: ℕ): MeasureTheory.eLpNorm ((f_n n) - (Conv (f_n n) - simp - simp at hx - split_ifs -- . simp -- . omega -+ · simp -+ · omega - )] - - -@@ -567,11 +563,8 @@ theorem f_n_sub_conv (n: ℕ): MeasureTheory.eLpNorm ((f_n n) - (Conv (f_n n) - _ ≤ ‖((n + 1): ℝ)⁻¹‖ₑ * MeasureTheory.eLpNorm ((mu - muConv (n + 1))) 1 MeasureTheory.volume := by - apply MeasureTheory.eLpNorm_const_smul_le - _ ≤ ‖((n + 1): ℝ)⁻¹‖ₑ * (MeasureTheory.eLpNorm ((mu)) 1 MeasureTheory.volume + (MeasureTheory.eLpNorm ((muConv (n + 1))) 1 MeasureTheory.volume)) := by -- have sub_le := MeasureTheory.eLpNorm_sub_le (p := 1) (f := mu ) (g := muConv (n + 1)) (μ := MeasureTheory.volume) ?_ ?_ (by simp) -- . -- apply mul_le_mul_right sub_le -- . apply MeasureTheory.AEStronglyMeasurable.of_discrete -- . apply MeasureTheory.AEStronglyMeasurable.of_discrete -+ exact mul_le_mul' le_rfl (MeasureTheory.eLpNorm_sub_le (p := 1) -+ (f := mu) (g := muConv (n + 1)) (μ := MeasureTheory.volume) (by simp)) - _ ≤ ENNReal.ofReal ((2: ℝ) / ((n + 1): ℝ)) := by - rw [mu_norm_one] - have mu_single_norm := mu_norm_one 0 -@@ -590,11 +583,8 @@ theorem f_n_sub_conv (n: ℕ): MeasureTheory.eLpNorm ((f_n n) - (Conv (f_n n) - field_simp - simp - positivity -- . exact mu_finsupp -+ · exact mu_finsupp - - --#print axioms mu_conv_eq_sum --#print axioms f_n_norm_one --#print axioms f_n_sub_conv - - end GeneratesNS -diff --git a/Gromov/Harmonic/Proposition318.lean b/Gromov/Harmonic/Proposition318.lean -index 7d7da9c..c36f3cc 100644 ---- a/Gromov/Harmonic/Proposition318.lean -+++ b/Gromov/Harmonic/Proposition318.lean -@@ -12,8 +12,6 @@ sequence. - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - attribute [local implicit_reducible] Additive - - namespace GeneratesNS -@@ -31,176 +29,164 @@ open MeasureTheory - - open scoped RealInnerProductSpace - --set_option maxHeartbeats 600000 in --lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp ℝ 2 volume (α := G)), ‖Laplace g‖ ≤ (1 : ℝ) / n ∧ ⟪Laplace g, g⟫ = 1 := by -- -- let eps := ((1: ℝ) / n)^2 -- -- selfAdjoint.mem_spectrum_eq_re -+private lemma laplace_spectrum_nonisolated (n : ℕ) (hn : 0 < n) -+ (hf : f_n_conv_delta_tendsto) : -+ spectrum ℝ (Laplace_linear.mkContinuous _ laplace_bounded') ∩ -+ Set.Ioo 0 (((1 : ℝ) / n)^2) ≠ ∅ := by -+ let eps := ((1 : ℝ) / n)^2 -+ let Δ := Laplace_linear.mkContinuous _ laplace_bounded' -+ change spectrum ℝ Δ ∩ Set.Ioo 0 eps ≠ ∅ - -- let P: Polynomial ℝ := (Polynomial.X^2 - eps • Polynomial.X) -+ by_contra! -+ have zero_isolated: spectrum ℝ Δ ∩ (Set.Ico 0 eps) = {0} := by -+ ext a -+ simp -+ refine ⟨?_, ?_⟩ -+ · -+ intro ha -+ obtain ⟨a_mem_spec, a_range⟩ := ha -+ by_contra a_nonzero -+ have a_mem: a ∈ Set.Ioo 0 eps := by -+ grind - -- let Δ := Laplace_linear.mkContinuous _ (laplace_bounded') -+ have a_mem_empty: a ∈ (∅ : Set ℝ) := by -+ rw [← this] -+ grind - -- have spec_inter: spectrum ℝ Δ ∩ Set.Ioo 0 eps ≠ ∅ := by -- by_contra! -- have zero_isolated: spectrum ℝ Δ ∩ (Set.Ico 0 eps) = {0} := by -- ext a -- simp -- refine ⟨?_, ?_⟩ -- . -- intro ha -- obtain ⟨a_mem_spec, a_range⟩ := ha -- by_contra a_nonzero -- have a_mem: a ∈ Set.Ioo 0 eps := by -- grind -+ simp at a_mem_empty -+ · -+ intro ha -+ simp [ha] -+ refine ⟨?_, by simp [eps, hn]⟩ -+ apply laplace_spectrum_contains_zero hf -+ -+ have zero_mem := laplace_spectrum_contains_zero hf -+ rw [spectrum.mem_iff] at zero_mem -+ simp at zero_mem -+ -+ let ramp: ℝ → ℝ := fun x => max 0 (min 1 (x / eps)) -+ -+ have self_adjoint_cx_del: IsSelfAdjoint (Cx.mapCLM Δ) := by -+ apply Cx.isSelfAdjoint_mapCLM -+ apply Δ_symmetric.isSelfAdjoint -+ -+ -+ let Q := cfc (1 - ramp) (Cx.mapCLM Δ) -+ have laplace_q: (Cx.mapCLM Δ) * Q = cfc (0: ℝ → ℝ) (Cx.mapCLM Δ) := by -+ unfold Q -+ nth_rw 1 [← cfc_id (a := Cx.mapCLM Δ) ℝ] -+ rw [← cfc_mul (hf := by exact continuousOn_id) (hg := by fun_prop)] -+ apply cfc_congr -+ intro x hx -+ simp [ramp, max_def'] -+ norm_num -+ split_ifs -+ · -+ rw [Cx.spectrum_mapCLM] at hx -+ rename_i x_div -+ apply Δ_spectrum_subset at hx -+ simp [eps] at x_div -+ have x_nonpos := nonpos_of_mul_nonpos_left x_div (by simp [hn]) -+ left -+ simp at hx -+ grind -+ · simp [min_def'] -+ split_ifs -+ · - -- have a_mem_empty: a ∈ (∅ : Set ℝ) := by -- rw [← this] -- grind -+ by_cases x_eq: x = eps -+ · simp [x_eq, eps] -+ field_simp -+ simp -+ · -+ rename_i x_div_le -+ rw [div_le_one₀ (by simp [eps]; positivity)] at x_div_le -+ have x_lt: x < eps := by -+ grind - -- simp at a_mem_empty -- . -- intro ha -- simp [ha] -- refine ⟨?_, by simp [eps, hn]⟩ -- apply laplace_spectrum_contains_zero hf -- -- have zero_mem := laplace_spectrum_contains_zero hf -- rw [spectrum.mem_iff] at zero_mem -- simp at zero_mem -- -- let ramp: ℝ → ℝ := fun x => max 0 (min 1 (x / eps)) -- -- have self_adjoint_cx_del: IsSelfAdjoint (Cx.mapCLM Δ) := by -- apply Cx.isSelfAdjoint_mapCLM -- apply Δ_symmetric.isSelfAdjoint -- -- -- let Q := cfc (1 - ramp) (Cx.mapCLM Δ) -- have laplace_q: (Cx.mapCLM Δ) * Q = cfc (0: ℝ → ℝ) (Cx.mapCLM Δ) := by -- unfold Q -- nth_rw 1 [← cfc_id (a := Cx.mapCLM Δ) ℝ] -- rw [← cfc_mul (hf := by exact continuousOn_id) (hg := by fun_prop)] -- apply cfc_congr -- intro x hx -- simp [ramp, max_def'] -- norm_num -- split_ifs -- . -- rw [Cx.spectrum_mapCLM] at hx -- rename_i x_div -- apply Δ_spectrum_subset at hx -- simp [eps] at x_div -- have x_nonpos := nonpos_of_mul_nonpos_left x_div (by simp [hn]) -- left -- simp at hx -- grind -- . simp [min_def'] -- split_ifs -- . - -- by_cases x_eq: x = eps -- . simp [x_eq, eps] -- field_simp -+ have x_mem_zero: x ∈ ({0} : Set ℝ) := by -+ rw [← zero_isolated] - simp -- . -- rename_i x_div_le -- rw [div_le_one₀ (by simp [eps]; positivity)] at x_div_le -- have x_lt: x < eps := by -+ refine ⟨?_, ?_⟩ -+ · -+ rw [Cx.spectrum_mapCLM] at hx -+ exact hx -+ · -+ rw [Cx.spectrum_mapCLM] at hx -+ apply Δ_spectrum_subset at hx -+ simp at hx - grind - -+ simp at x_mem_zero -+ simp [x_mem_zero] -+ · simp - -- have x_mem_zero: x ∈ ({0} : Set ℝ) := by -- rw [← zero_isolated] -- simp -- refine ⟨?_, ?_⟩ -- . -- rw [Cx.spectrum_mapCLM] at hx -- exact hx -- . -- rw [Cx.spectrum_mapCLM] at hx -- apply Δ_spectrum_subset at hx -- simp at hx -- grind -- -- simp at x_mem_zero -- simp [x_mem_zero] -- . simp -- -- -- simp at laplace_q -- have one_mem_q_spec: 1 ∈ spectrum ℝ Q := by -- rw [cfc_map_spectrum (hf := by fun_prop)] -- simp [ramp] -- use 0 -- rw [Cx.spectrum_mapCLM] -- refine ⟨laplace_spectrum_contains_zero hf, ?_⟩ -- right -- simp - -- have nontrivial_cx: Nontrivial (Cx ↥(Lp ℝ 2 volume (α := G)) →L[ℂ] Cx ↥(Lp ℝ 2 volume (α := G))) := by -+ simp at laplace_q -+ have one_mem_q_spec: 1 ∈ spectrum ℝ Q := by -+ rw [cfc_map_spectrum (hf := by fun_prop)] -+ simp [ramp] -+ use 0 -+ rw [Cx.spectrum_mapCLM] -+ refine ⟨laplace_spectrum_contains_zero hf, ?_⟩ -+ right -+ simp - -- use 1 -- use 0 -- simp -- rw [ContinuousLinearMap.ext_iff] -- simp -- let hf := (finsupp_lp_top (Pi.single 1 1) (by -- simp -- ) 2) -- rw [← my_haar_eq_count] at hf -- use (hf.toLp, 0) -- apply_fun (fun a => a.fst) -- simp -- rw [MeasureTheory.Lp.ext_iff] -- have haar_eq_volume: myHaar = volume := by -- simp [volume] -- simp_rw [haar_eq_volume] -- rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] -- simp -- rw [funext_iff] -- simp -- use 1 -+ have nontrivial_cx: Nontrivial (Cx ↥(Lp ℝ 2 volume (α := G)) →L[ℂ] Cx ↥(Lp ℝ 2 volume (α := G))) := by -+ -+ use 1 -+ use 0 -+ simp -+ rw [ContinuousLinearMap.ext_iff] -+ simp -+ let hf := (finsupp_lp_top (Pi.single 1 1) (by - simp -+ ) 2) -+ rw [← my_haar_eq_count] at hf -+ use (hf.toLp, 0) -+ apply_fun (fun a => a.fst) -+ simp -+ rw [MeasureTheory.Lp.ext_iff] -+ have haar_eq_volume: myHaar = volume := by -+ simp [volume] -+ simp_rw [haar_eq_volume] -+ rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] -+ simp -+ rw [funext_iff] -+ simp -+ use 1 -+ simp - -- have Q_nonzero: Q ≠ 0 := by -- by_contra! -- simp [this] at one_mem_q_spec -- -- apply ContinuousLinearMap.exists_ne_zero at Q_nonzero -- obtain ⟨x, hx⟩ := Q_nonzero -- have laplace_q_x: (Cx.mapCLM Δ) (Q x) = 0 := by -- rw [← ContinuousLinearMap.mul_apply] -- simp [laplace_q] -- -- by_cases fst_nonzero: (Q x).fst ≠ 0 -- . -- simp at laplace_q_x -- apply_fun (fun a => a.fst) at laplace_q_x -- simp at laplace_q_x -- simp [Δ, LinearMap.mkContinuous, Laplace_linear] at laplace_q_x -- apply laplace_zero_iff_zero at laplace_q_x -- contradiction -- . -- have snd_nonzero: (Q x).snd ≠ 0 := by -- by_contra! -- simp at fst_nonzero -- have Q_zero: (Q x) = 0 := by -- apply Cx.ext -- all_goals { -- simp -- grind -- } -- contradiction -+ have Q_nonzero: Q ≠ 0 := by -+ by_contra! -+ simp [this] at one_mem_q_spec -+ -+ apply ContinuousLinearMap.exists_ne_zero at Q_nonzero -+ obtain ⟨x, hx⟩ := Q_nonzero -+ have laplace_q_x: (Cx.mapCLM Δ) (Q x) = 0 := by -+ rw [← mul_apply_eq_comp] -+ simp [laplace_q] -+ -+ have hfst : Laplace (Q x).fst = 0 := by -+ have h := congrArg Cx.fst laplace_q_x -+ simpa [Δ, LinearMap.mkContinuous, Laplace_linear] using h -+ have hsnd : Laplace (Q x).snd = 0 := by -+ have h := congrArg Cx.snd laplace_q_x -+ simpa [Δ, LinearMap.mkContinuous, Laplace_linear] using h -+ have hz : Q x = 0 := Cx.ext (laplace_zero_iff_zero _ hfst) (laplace_zero_iff_zero _ hsnd) -+ exact hx hz -+ -+lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp ℝ 2 volume (α := G)), ‖Laplace g‖ ≤ (1 : ℝ) / n ∧ ⟪Laplace g, g⟫ = 1 := by - -- -- TODO - deduplicate this -- simp at laplace_q_x -- apply_fun (fun a => a.snd) at laplace_q_x -- simp at laplace_q_x -- simp [Δ, LinearMap.mkContinuous, Laplace_linear] at laplace_q_x -- apply laplace_zero_iff_zero at laplace_q_x -- contradiction -+ let eps := ((1: ℝ) / n)^2 -+ -- selfAdjoint.mem_spectrum_eq_re -+ -+ let P: Polynomial ℝ := (Polynomial.X^2 - eps • Polynomial.X) -+ -+ let Δ := Laplace_linear.mkContinuous _ (laplace_bounded') - -+ have spec_inter := laplace_spectrum_nonisolated n hn hf - - rw [← Set.nonempty_iff_ne_empty] at spec_inter - obtain ⟨a, ha⟩ := spec_inter -@@ -217,21 +203,21 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp - - have p_a_neg: P.eval a < 0 := by - simp [P] -- simp at ha -- nlinarith -+ change 0 < a ∧ a < eps at a_lt -+ nlinarith [a_lt.1, a_lt.2] - - have eval_symm: (((Polynomial.aeval Δ) P)).IsSymmetric := by - simp [P] - apply LinearMap.IsSymmetric.sub -- . apply LinearMap.IsSymmetric.pow -+ · apply LinearMap.IsSymmetric.pow - apply Δ_symmetric -- . apply LinearMap.IsSymmetric.smul -- . simp -- . apply Δ_symmetric -+ · apply LinearMap.IsSymmetric.smul -+ · simp -+ · apply Δ_symmetric - - - have not_pos := ContinuousLinearMap.IsPositive.spectrumRestricts (f := (Polynomial.aeval Δ P)).mt ?_ -- . -+ · - simp [ContinuousLinearMap.IsPositive, eval_symm] at not_pos - obtain ⟨x, hx, x_inner⟩ := not_pos - simp [ContinuousLinearMap.reApplyInnerSelf, P] at x_inner -@@ -253,7 +239,7 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp - use ((√⟪Laplace ⟨x, hx⟩, ⟨x, hx⟩⟫)⁻¹) • ⟨x, hx⟩ - rw [inner_sub_left] at x_inner - refine ⟨?_, ?_⟩ -- . -+ · - rw [norm_eq_sqrt_real_inner] - simp [Δ, LinearMap.mkContinuous, Laplace_linear] at x_inner - rw [← laplace_self_adjoint] at x_inner -@@ -263,19 +249,19 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp - rw [norm_smul] - simp - rw [← Real.lt_sqrt] at x_inner -- . grw [x_inner] -+ · grw [x_inner] - rw [Real.sqrt_mul] -- ring -+ ring_nf - rw [abs_of_nonneg] -- . -+ · - field_simp - simp [eps] - grind -- . simp -- . simp [eps] -- . simp -+ · simp -+ · simp [eps] -+ · simp - -- . -+ · - rw [laplace_smul] - rw [inner_smul_left, inner_smul_right] - simp -@@ -283,7 +269,7 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp - rw [Real.sq_sqrt] - rw [← laplace_self_adjoint] - apply laplace_positive_semidefinite -- . rw [SpectrumRestricts.nnreal_iff] -+ · rw [SpectrumRestricts.nnreal_iff] - simp - use P.eval a - -@@ -297,7 +283,6 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp - -- This whole proof is completely wrong - it needs to use the spectral theorem - - --#print axioms laplace_g_n - - - lemma measure_preserving_inv: MeasurePreserving Inv.inv ((MeasureTheory.volume (α := G))) (MeasureTheory.volume (α := G)) := { -@@ -318,7 +303,7 @@ noncomputable def G_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto) := Class - - - lemma lp_summable {p: ℕ} (hp: 0 < p) (f: (Lp ℝ p volume (α := G))): Summable (fun g: G => |(f g)|^p) := by -- have f_norm := (MeasureTheory.Lp.memLp f).2 -+ have f_norm := (MeasureTheory.Lp.memLp f).eLpNorm_lt_top - simp [eLpNorm, eLpNorm'] at f_norm - have not_le: ¬(p = 0) := by linarith - simp [not_le] at f_norm -@@ -353,9 +338,9 @@ lemma lp2_summable (f: (Lp ℝ 2 volume (α := G))): Summable (fun g: G => (f g) - - - lemma summable_f_mul_translate (f: (Lp ℝ 2 volume (α := G))) (i: G): Summable (fun x => (f x) * (f (i * x))) := by -- have lp_mul := (MeasureTheory.MemLp.mul (φ := f) (f := fun x => f (i * x)) (p := 2) (q := 2) (r := 1) (μ := volume) ?_ ?_).2 -- . -- simp [MemLp, eLpNorm, eLpNorm'] at lp_mul -+ have lp_mul := (MeasureTheory.MemLp.mul (φ := f) (f := fun x => f (i * x)) (p := 2) (q := 2) (r := 1) (μ := volume) ?_ ?_).eLpNorm_lt_top -+ · -+ simp [eLpNorm, eLpNorm'] at lp_mul - rw [lintegral_g_eq_add] at lp_mul - simp [Real.enorm_eq_ofReal_abs] at lp_mul - simp [← ENNReal.ofReal_mul] at lp_mul -@@ -366,23 +351,22 @@ lemma summable_f_mul_translate (f: (Lp ℝ 2 volume (α := G))) (i: G): Summable - intro x - rw [ENNReal.toReal_ofReal (by - apply mul_nonneg -- . simp -- . simp -+ · simp -+ · simp - )] - apply Summable.of_abs - simp_rw [abs_mul] - exact lp_mul -- . -+ · apply Lp.memLp f -+ · - rw [← Function.comp_def] - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp f -- . exact measurePreserving_mul_left volume i -- . apply Lp.memLp f -+ · apply MeasureTheory.Lp.memLp f -+ · exact measurePreserving_mul_left volume i - - - -- Note - this is stated incorrectly in Vikman - -- The RHS should have a squared norm --set_option maxRecDepth 40000 in - lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (Laplace f) g) = ((2) * (#(S) : ℝ))⁻¹ * ∑ s ∈ S, ‖(f - (conv_finsupp_lp2 f (delta s) (by simp [delta])))‖^2 := by - simp_rw [Laplace] - simp_rw [conv_mu_lp2] -@@ -431,7 +415,7 @@ lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (La - - rw [Summable.tsum_mul_left] - rw [Summable.tsum_mul_left] -- have f_norm := MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (p := 2) (by simp) (by simp) (f := f.val.cast) (μ := volume (α := G)) -+ have f_norm := MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (p := 2) (by simp) (by simp) (f := f.val.cast) (μ := volume (α := G)) (MeasureTheory.Lp.aestronglyMeasurable f) - simp_rw [lintegral_g_eq_add] at f_norm - simp [enorm] at f_norm - apply_fun ENNReal.toReal at f_norm -@@ -488,21 +472,19 @@ lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (La - conv at inner_f_conv => - intro a - rhs -- -- TODO - deduplicate this with the 'have lp_mul' block above - rw [MeasureTheory.integral_countable (by - simp [f_conv_delta] - simp [Integrable] -- refine ⟨by apply AEStronglyMeasurable.of_discrete, ?_⟩ - simp [HasFiniteIntegral] - simp [Real.enorm_eq_ofReal_abs] - rw [lintegral_g_eq_add] - rw [lt_top_iff_ne_top] - simp_rw [← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul] - rw [← ENNReal.ofReal_tsum_of_nonneg] -- . apply ENNReal.ofReal_ne_top -- . intro n -+ · apply ENNReal.ofReal_ne_top -+ · intro n - positivity -- . -+ · - apply Summable.abs - simp_rw [mul_comm] - apply summable_f_mul_translate -@@ -545,28 +527,28 @@ lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (La - rw [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] - eta_reduce - ring -- . apply summable_sum -+ · apply summable_sum - intro s hs - simp_rw [f_conv_delta] - apply summable_f_mul_translate -- . -+ · - apply tsum_nonneg - intro g - apply sq_nonneg -- . simp -- . apply summable_sum -+ · simp -+ · apply summable_sum - intro s hs - apply lp2_summable -- . -+ · - apply Summable.mul_left - apply summable_sum - intro s hs - apply lp2_summable -- . simp_rw [mul_assoc] -+ · simp_rw [mul_assoc] - apply Summable.mul_left - simp_rw [← pow_two] - apply lp2_summable -- . simp_rw [mul_assoc] -+ · simp_rw [mul_assoc] - apply Summable.mul_left - rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] - simp_rw [← mul_assoc] -@@ -578,14 +560,14 @@ lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (La - simp_rw [mul_assoc] - apply Summable.mul_left - apply summable_f_mul_translate -- . -+ · - apply Summable.mul_left - rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] - simp_rw [mul_sub] - apply Summable.sub -- . simp_rw [← pow_two] -+ · simp_rw [← pow_two] - apply lp2_summable -- . -+ · - simp_rw [← mul_assoc] - simp_rw [Finset.mul_sum] - apply summable_sum -@@ -611,8 +593,6 @@ lemma g_n_conv_norm (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ⟪Laplac - exact g_n_prop.2 - - --#print sorries proposition_3_18 --#print axioms proposition_3_18 - - - lemma g_sub_norm_gt (hf: f_n_conv_delta_tendsto) (n: ℕ) : ∃ s ∈ S, ‖(G_n (n + 1) (by simp) hf) - (conv_finsupp_lp2 (G_n (n + 1) (by simp) hf) (delta s) (by simp [delta]))‖^2 > 1 := by -@@ -623,7 +603,7 @@ lemma g_sub_norm_gt (hf: f_n_conv_delta_tendsto) (n: ℕ) : ∃ s ∈ S, ‖(G_n - have g_n_prop := (Classical.choose_spec (laplace_g_n (n + 1) (by simp) hf)).2 - have real_inner : ∀ a b : ℝ, ⟪a, b⟫ = b * a := fun a b => rfl - rw [integral_eq_eq_sum] at g_inner_laplace -- . -+ · - simp_rw [real_inner] at g_inner_laplace - simp_rw [← g_inner_laplace] at sum_norm - nth_rw 1 [G_n] at sum_norm -@@ -634,15 +614,15 @@ lemma g_sub_norm_gt (hf: f_n_conv_delta_tendsto) (n: ℕ) : ∃ s ∈ S, ‖(G_n - rw [← sum_norm] at card_le - simp at card_le - rw [mul_le_iff_le_one_left] at card_le -- . norm_num at card_le -- . simp -+ · norm_num at card_le -+ · simp - have foo := S_nonempty - grind -- . -+ · - simp - grind - -- . -+ · - rw [MeasureTheory.L2.inner_def] at g_n_prop - apply MeasureTheory.integrable_of_integral_eq_one at g_n_prop - exact g_n_prop -@@ -704,14 +684,14 @@ lemma laplace_b_sub (f g: G → ℝ): Laplace_b (f - g) = Laplace_b f - Laplace_ - simp [Laplace_b] - nth_rw 3 [sub_eq_add_neg] - rw [conv_add_left] -- . -+ · - rw [conv_neg_left] - ring_nf -- . -+ · - apply conv_exists_fin_supp - right - apply mu_finsupp -- . apply conv_exists_fin_supp -+ · apply conv_exists_fin_supp - right - apply mu_finsupp - -diff --git a/Gromov/Harmonic/SelfAdjoint.lean b/Gromov/Harmonic/SelfAdjoint.lean -index af09060..21e136c 100644 ---- a/Gromov/Harmonic/SelfAdjoint.lean -+++ b/Gromov/Harmonic/SelfAdjoint.lean -@@ -12,38 +12,34 @@ public import Gromov.Harmonic.LaplaceLinear - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - attribute [local implicit_reducible] Additive - - namespace GeneratesNS - open Generates - --variable [hGS: Generates] -+variable [hGS : Generates] - include hGS - --variable {V: Submodule ℝ LipschitzH} [V_finite: FiniteDimensional ℝ V] [Nontrivial V] -+variable {V : Submodule ℝ LipschitzH} [V_finite : FiniteDimensional ℝ V] [Nontrivial V] - - open scoped Finset - open scoped Pointwise - open scoped Convolution - open MeasureTheory - --lemma laplace_smul (k: ℝ) (f: (Lp ℝ 2 volume (α := G))): Laplace (k • f) = k • (Laplace f) := by -+lemma laplace_smul (k : ℝ) (f : (Lp ℝ 2 volume (α := G))) : Laplace (k • f) = k • (Laplace f) := by - simp [Laplace, conv_mu_lp2] - simp_rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_smul _ _)] - simp_rw [conv_smul] - rw [MeasureTheory.MemLp.toLp_const_smul] - rw [smul_sub] - -- --lemma norm_conv_mu_le (f: (Lp ℝ 2 volume (α := G))): ‖conv_mu_lp2 f‖ ≤ ‖f‖ := by -+lemma norm_conv_mu_le (f : (Lp ℝ 2 volume (α := G))) : ‖conv_mu_lp2 f‖ ≤ ‖f‖ := by - simp [conv_mu_lp2] - simp [f_conv_mu] - simp_rw [← smul_eq_mul] - rw [← Pi.smul_def] - rw [MeasureTheory.eLpNorm_const_smul] -- -- TODO - deduplicate this with 'laplace_bounded' - conv => - lhs - rhs -@@ -53,13 +49,13 @@ lemma norm_conv_mu_le (f: (Lp ℝ 2 volume (α := G))): ‖conv_mu_lp2 f‖ ≤ - funext g - simp - -- have card_s_ne: (#S : ℝ) ≠ 0 := by -+ have card_s_ne : (#S : ℝ) ≠ 0 := by - simp - have foo := hS - simp at foo - exact Finset.nonempty_iff_ne_empty.mp foo - -- grw [MeasureTheory.eLpNorm_sum_le] -+ grw [MeasureTheory.eLpNorm_sum_le (by norm_num)] - simp_rw [← Function.comp_def] - conv => - lhs -@@ -77,16 +73,13 @@ lemma norm_conv_mu_le (f: (Lp ℝ 2 volume (α := G))): ‖conv_mu_lp2 f‖ ≤ - simp [MeasureTheory.volume] - } - )] -- . simp -+ · simp - field_simp - rfl -- . -- apply WithTop.mul_ne_top -- . -- rw [Real.enorm_of_nonneg (by simp)] -+ · apply WithTop.mul_ne_top -+ · rw [Real.enorm_of_nonneg (by simp)] - apply ENNReal.ofReal_ne_top -- . -- apply ENNReal.sum_ne_top.mpr -+ · apply ENNReal.sum_ne_top.mpr - intro s hs - rw [← Function.comp_def] - conv => -@@ -101,19 +94,14 @@ lemma norm_conv_mu_le (f: (Lp ℝ 2 volume (α := G))): ‖conv_mu_lp2 f‖ ≤ - } - )] - rw [← lt_top_iff_ne_top] -- apply (MeasureTheory.Lp.memLp f).2 -- . intro s hs -- apply AEStronglyMeasurable.of_discrete -- . -- simp -+ exact MeasureTheory.Lp.eLpNorm_lt_top f - - open scoped RealInnerProductSpace --lemma inner_laplace_zero (f: (Lp ℝ 2 volume (α := G))) (hf: ⟪Laplace f, f⟫ = 0): Laplace f = 0 := by -+lemma inner_laplace_zero (f : (Lp ℝ 2 volume (α := G))) (hf : ⟪Laplace f, f⟫ = 0) : Laplace f = 0 := by - have inner_le := real_inner_le_norm (conv_mu_lp2 f) f - -- by_cases norm_f_zero: ‖f‖ = 0 -- . -- simp at norm_f_zero -+ by_cases norm_f_zero : ‖f‖ = 0 -+ · simp at norm_f_zero - simp [Laplace, conv_mu_lp2] - simp [f_conv_mu] - simp_rw [norm_f_zero] -@@ -132,7 +120,7 @@ lemma inner_laplace_zero (f: (Lp ℝ 2 volume (α := G))) (hf: ⟪Laplace f, f - nth_rw 2 [mul_comm] at inner_le - rw [mul_le_mul_iff_of_pos_left] at inner_le - have conv_le_f := norm_conv_mu_le f -- have f_norm_eq: ‖f‖ = ‖conv_mu_lp2 f‖ := by -+ have f_norm_eq : ‖f‖ = ‖conv_mu_lp2 f‖ := by - linarith - - have f_sub_norm := norm_sub_sq_real f (conv_mu_lp2 f) -@@ -147,8 +135,7 @@ lemma inner_laplace_zero (f: (Lp ℝ 2 volume (α := G))) (hf: ⟪Laplace f, f - simpa [Laplace] using f_sub_norm - simpa using norm_f_zero - -- --lemma F_n_norm_eq_one: ∀ n, MeasureTheory.eLpNorm (F_n n) 2 MeasureTheory.volume (α := G) = 1 := by -+lemma F_n_norm_eq_one : ∀ n, MeasureTheory.eLpNorm (F_n n) 2 MeasureTheory.volume (α := G) = 1 := by - simp [eLpNorm, eLpNorm', lintegral_g_eq_add] - simp [F_n, Real.enorm_eq_ofReal_abs, ← ENNReal.ofReal_pow] - -@@ -160,41 +147,36 @@ lemma F_n_norm_eq_one: ∀ n, MeasureTheory.eLpNorm (F_n n) 2 MeasureTheory.volu - simp [f_n_nonneg, abs_of_nonneg] at norm_one - simp [norm_one] - -- --lemma harmonic_abs_max_implies_const (f: G → ℝ) (hf: Laplace_b f = 0) (a: G) (h_max: ∀ g: G, |f g| ≤ |f a|): f = fun _ => f a := by -- by_cases f_a_pos: 0 ≤ f a -- . -- have lt_f_a: ∀ g: G, f g ≤ f a := by -+lemma harmonic_abs_max_implies_const (f : G → ℝ) (hf : Laplace_b f = 0) (a : G) (h_max : ∀ g : G, |f g| ≤ |f a|) : f = fun _ => f a := by -+ by_cases f_a_pos : 0 ≤ f a -+ · have lt_f_a : ∀ g : G, f g ≤ f a := by - intro g -- by_cases f_g_pos: 0 ≤ f g -- . specialize h_max g -+ by_cases f_g_pos : 0 ≤ f g -+ · specialize h_max g - rw [abs_eq_self.mpr ?_] at h_max - rw [abs_eq_self.mpr f_a_pos] at h_max -- . exact h_max -- . exact f_g_pos -- . linarith -+ · exact h_max -+ · exact f_g_pos -+ · linarith - exact harmonic_maximum_implies_const f hf a lt_f_a -- . -- have f_neg_le: ∀ g, (-f) g ≤ (-f) a := by -+ · have f_neg_le : ∀ g, (-f) g ≤ (-f) a := by - intro g - simp at f_a_pos - simp - specialize h_max g - rw [abs_of_neg f_a_pos] at h_max -- by_cases f_g_pos: 0 ≤ f g -- . rw [abs_of_nonneg f_g_pos] at h_max -+ by_cases f_g_pos : 0 ≤ f g -+ · rw [abs_of_nonneg f_g_pos] at h_max - linarith -- . simp at f_g_pos -+ · simp at f_g_pos - rw [abs_of_neg f_g_pos] at h_max - linarith - have neg_const := harmonic_maximum_implies_const (-f) ?_ a f_neg_le -- . -- apply_fun (fun h => -h) at neg_const -+ · apply_fun (fun h => -h) at neg_const - simp at neg_const - rw [Pi.neg_def] at neg_const - simpa using neg_const -- . -- simp_rw [Laplace_b] -+ · simp_rw [Laplace_b] - simp_rw [Laplace_b] at hf - conv => - lhs -@@ -210,13 +192,10 @@ lemma harmonic_abs_max_implies_const (f: G → ℝ) (hf: Laplace_b f = 0) (a: G - rw [sub_eq_zero] at hf - exact hf.symm - -- --set_option maxHeartbeats 500000 in --lemma laplace_zero_iff_zero (g: (Lp ℝ 2 volume (α := G))) (eq_zero: Laplace g = 0): g = 0 := by -- by_cases g_has_maximum: ∃ a: G, ∀ b: G, ‖g b‖ ≤ ‖g a‖ -- . -- obtain ⟨a, ha⟩ := g_has_maximum -- have laplace_b_zero: Laplace_b g = 0 := by -+lemma laplace_zero_iff_zero (g : (Lp ℝ 2 volume (α := G))) (eq_zero : Laplace g = 0) : g = 0 := by -+ by_cases g_has_maximum : ∃ a : G, ∀ b : G, ‖g b‖ ≤ ‖g a‖ -+ · obtain ⟨a, ha⟩ := g_has_maximum -+ have laplace_b_zero : Laplace_b g = 0 := by - simp [Laplace, conv_mu_lp2, f_conv_mu] at eq_zero - simp_rw [Laplace_b, f_conv_mu] - apply_fun (fun f => f.val.cast) at eq_zero -@@ -245,8 +224,7 @@ lemma laplace_zero_iff_zero (g: (Lp ℝ 2 volume (α := G))) (eq_zero: Laplace g - rw [← not_infinite_iff_finite] at new_g_const_zero - simp [hGS.g_infinite] at new_g_const_zero - -- -- have g_eq_zero: g.val.cast = 0 := by -+ have g_eq_zero : g.val.cast = 0 := by - rw [g_const] - rw [new_g_const_zero] - ext a -@@ -256,16 +234,15 @@ lemma laplace_zero_iff_zero (g: (Lp ℝ 2 volume (α := G))) (eq_zero: Laplace g - rw [ae_eq_everywhere] - rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_zero _ _ _)] - exact g_eq_zero -- . rename _ => g_no_maximum -+ · rename _ => g_no_maximum - simp at g_no_maximum -- have integrable_g := MeasureTheory.MemLp.integrable_sq (MeasureTheory.Lp.memLp g) -- simp [Integrable, HasFiniteIntegral] at integrable_g -- obtain ⟨_, integral_lt⟩ := integrable_g -+ have integral_lt := MeasureTheory.MemLp.integrable_sq (MeasureTheory.Lp.memLp g) -+ simp [Integrable, HasFiniteIntegral] at integral_lt - rw [lintegral_g_eq_add] at integral_lt - rw [lt_top_iff_ne_top] at integral_lt - by_contra g_ne_zero - simp at g_ne_zero -- have nonzero_val: ∃ a: G, g a ≠ 0 := by -+ have nonzero_val : ∃ a : G, g a ≠ 0 := by - rw [MeasureTheory.Lp.ext_iff] at g_ne_zero - rw [ae_eq_everywhere] at g_ne_zero - rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_zero _ _ _)] at g_ne_zero -@@ -284,26 +261,20 @@ lemma laplace_zero_iff_zero (g: (Lp ℝ 2 volume (α := G))) (eq_zero: Laplace g - -- Obtain an element greater than the maximum - obtain ⟨p, hp⟩ := g_no_maximum m - have p_gt := hm (j := p) ?_ ?_ -- . -- have not_g_le := not_lt_of_ge p_gt -+ · have not_g_le := not_lt_of_ge p_gt - contradiction -- . -- simp -+ · simp - grw [m_in_g] - rw [← ENNReal.toReal_le_toReal] -- . -- simp -+ · simp - rw [sq_le_sq] - linarith -- . simp -- . simp -+ · simp -+ · simp - linarith - -- ---- Proposition 3.17.1: "∆ is bounded" from Vikman ---- The paper also proves that the Laplace operator is self-adjoint as part of this step, ---- but we split it out --lemma laplace_bounded (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))): ‖(Laplace f)‖ₑ ≤ 2 * ‖f‖ₑ := by -+-- Proposition 3.17.1 : "∆ is bounded" from Vikman -+lemma laplace_bounded (f : (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))) : ‖(Laplace f)‖ₑ ≤ 2 * ‖f‖ₑ := by - unfold Laplace - unfold conv_mu_lp2 - simp_rw [f_conv_mu] -@@ -326,7 +297,7 @@ lemma laplace_bounded (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G - simp - - rw [MeasureTheory.Lp.enorm_toLp] -- grw [MeasureTheory.eLpNorm_sum_le] -+ grw [MeasureTheory.eLpNorm_sum_le (by norm_num)] - simp_rw [← Function.comp_def] - conv => - lhs -@@ -358,52 +329,38 @@ lemma laplace_bounded (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G - )] - simp - rw [two_mul] -- . rw [← MeasureTheory.Lp.enorm_def] -- -- TODO - inline these in the right places -- . simp -- . -- intro i hs -- apply MeasureTheory.AEStronglyMeasurable.of_discrete -- . norm_num -- . -- apply MeasureTheory.memLp_finsetSum -+ · rw [← MeasureTheory.Lp.enorm_def] -+ · simp -+ · apply MeasureTheory.memLp_finsetSum - intro s hs - rw [← Function.comp_def] - apply MeasureTheory.MemLp.comp_of_map -- . -- simp [MeasureTheory.volume] -+ · simp [MeasureTheory.volume] - apply MeasureTheory.Lp.memLp f -- . apply AEMeasurable.of_discrete -- -+ · apply AEMeasurable.of_discrete - --lemma laplace_bounded' (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))): ‖(Laplace f)‖ ≤ 2 * ‖f‖ := by -+lemma laplace_bounded' (f : (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))) : ‖(Laplace f)‖ ≤ 2 * ‖f‖ := by - have bounded := laplace_bounded f -- rw [← ofReal_norm_eq_enorm] at bounded -- rw [← ofReal_norm_eq_enorm] at bounded -+ rw [← ofReal_norm] at bounded -+ rw [← ofReal_norm] at bounded - simp_rw [← ENNReal.ofReal_ofNat] at bounded - rw [← ENNReal.ofReal_mul] at bounded -- . -- rw [ENNReal.ofReal_le_ofReal_iff] at bounded -- . exact bounded -- . simp -- . simp -+ · rw [ENNReal.ofReal_le_ofReal_iff] at bounded -+ · exact bounded -+ · simp -+ · simp - --lemma tolp_apply (f: G → ℝ) {p: ENNReal} (hf: MeasureTheory.MemLp f p) (g: G): (MeasureTheory.MemLp.toLp f hf) g = f g := by -+lemma tolp_apply (f : G → ℝ) {p : ENNReal} (hf : MeasureTheory.MemLp f p) (g : G) : (MeasureTheory.MemLp.toLp f hf) g = f g := by - have eq_fun := MeasureTheory.AEEqFun.coeFn_mk f (μ := MeasureTheory.volume (α := G)) (by apply MeasureTheory.AEStronglyMeasurable.of_discrete) - rw [ae_eq_everywhere] at eq_fun - nth_rw 2 [← eq_fun] - rfl - -- - open scoped RealInnerProductSpace --lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G)))): ⟪f, (Laplace h)⟫ = ⟪(Laplace f), h⟫ := by -+lemma laplace_self_adjoint (f h : (MeasureTheory.Lp ℝ 2 (μ := volume (α := G)))) : ⟪f, (Laplace h)⟫ = ⟪(Laplace f), h⟫ := by - - simp [MeasureTheory.L2.inner_def] - -- -- -- -- MeasureTheory.Lp.coeFn_smul -- - conv => - lhs - arg 2 -@@ -434,7 +391,6 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) - simp_rw [mul_assoc] - simp_rw [Finset.mul_sum] - -- - conv => - lhs - arg 2 -@@ -445,10 +401,9 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) - arg 1 - intro i - -- - simp_rw [tolp_apply] - rw [integral_sub] -- rw [MeasureTheory.integral_finset_sum] -+ rw [MeasureTheory.integral_finsetSum] - conv => - lhs - rhs -@@ -456,7 +411,7 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) - intro s - rw [← MeasureTheory.integral_mul_left_eq_self (g := s⁻¹)] - simp -- rw [← MeasureTheory.integral_finset_sum] -+ rw [← MeasureTheory.integral_finsetSum] - conv => - lhs - rhs -@@ -465,13 +420,13 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) - rw [← Finset.mul_sum] - rw [Finset.sum_bijective (s := S) (t := S) (e := fun s => s⁻¹) (g := fun i => (f (i * g) * (h g))) (by - refine ⟨?_, ?_⟩ -- . exact inv_injective -- . exact inv_surjective -+ · exact inv_injective -+ · exact inv_surjective - ) (by - intro a - refine ⟨?_, ?_⟩ -- . apply hGS.has_inv a -- . simpa using (hGS.has_inv a⁻¹) -+ · apply hGS.has_inv a -+ · simpa using (hGS.has_inv a⁻¹) - ) (by - simp - )] -@@ -488,7 +443,6 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) - rw [mul_comm] - rw [← mul_sub] - -- - conv => - rhs - arg 2 -@@ -499,67 +453,59 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) - simp [f_conv_mu] - rw [tolp_apply] - -- - simp_rw [Finset.mul_sum] -- . -- have prod_lp1 := MeasureTheory.MemLp.smul (φ := f) (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp h) (MeasureTheory.Lp.memLp f) -+ · have prod_lp1 := MeasureTheory.MemLp.smul (φ := f) (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) (MeasureTheory.Lp.memLp h) - rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 -- exact prod_lp1 -- . -- apply MeasureTheory.integrable_finset_sum -+ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 -+ · apply MeasureTheory.integrable_finsetSum - intro s hs - apply MeasureTheory.Integrable.const_mul -- have mem_lp_f_comp: MemLp (f ∘ (fun x => s * x)) 2 := by -+ have mem_lp_f_comp : MemLp (f ∘ (fun x => s * x)) 2 := by - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp f -- . exact measurePreserving_mul_left volume s -+ · apply MeasureTheory.Lp.memLp f -+ · exact measurePreserving_mul_left volume s - -- have prod_lp1 := MeasureTheory.MemLp.smul (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp h) mem_lp_f_comp -+ have prod_lp1 := MeasureTheory.MemLp.smul (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_f_comp (MeasureTheory.Lp.memLp h) - rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 -- exact prod_lp1 -- . -- intro s hs -+ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 -+ · intro s hs - apply MeasureTheory.Integrable.const_mul -- have mem_lp_f_comp: MemLp (f ∘ (fun x => s⁻¹ * x)) 2 := by -+ have mem_lp_f_comp : MemLp (f ∘ (fun x => s⁻¹ * x)) 2 := by - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp f -- . exact measurePreserving_mul_left volume s⁻¹ -- have prod_lp1 := MeasureTheory.MemLp.smul (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp h) mem_lp_f_comp -+ · apply MeasureTheory.Lp.memLp f -+ · exact measurePreserving_mul_left volume s⁻¹ -+ have prod_lp1 := MeasureTheory.MemLp.smul (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_f_comp (MeasureTheory.Lp.memLp h) - rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 -- exact prod_lp1 -- . -- intro s hs -+ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 -+ · intro s hs - apply MeasureTheory.Integrable.const_mul - -- have mem_lp_h_comp: MemLp (h ∘ (fun x => s * x)) 2 := by -+ have mem_lp_h_comp : MemLp (h ∘ (fun x => s * x)) 2 := by - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp h -- . exact measurePreserving_mul_left volume s -+ · apply MeasureTheory.Lp.memLp h -+ · exact measurePreserving_mul_left volume s - -- have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_h_comp (MeasureTheory.Lp.memLp f) -+ have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) mem_lp_h_comp - rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 -- exact prod_lp1 -- . -- have prod_lp1 := MeasureTheory.MemLp.smul (φ := f) (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp h) (MeasureTheory.Lp.memLp f) -+ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 -+ · have prod_lp1 := MeasureTheory.MemLp.smul (φ := f) (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) (MeasureTheory.Lp.memLp h) - rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 -- exact prod_lp1 -- . -- apply MeasureTheory.integrable_finset_sum -+ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 -+ · apply MeasureTheory.integrable_finsetSum - intro s hs - apply MeasureTheory.Integrable.const_mul - -- have mem_lp_h_comp: MemLp (h ∘ (fun x => s * x)) 2 := by -+ have mem_lp_h_comp : MemLp (h ∘ (fun x => s * x)) 2 := by - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp h -- . exact measurePreserving_mul_left volume s -+ · apply MeasureTheory.Lp.memLp h -+ · exact measurePreserving_mul_left volume s - -- have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_h_comp (MeasureTheory.Lp.memLp f) -+ have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) mem_lp_h_comp - rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 -- exact prod_lp1 -- -+ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 - - set_option maxHeartbeats 200000 in --lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G)))): 0 ≤ ⟪f, (Laplace f)⟫ := by -+lemma laplace_positive_semidefinite (f : (MeasureTheory.Lp ℝ 2 (μ := volume (α := G)))) : 0 ≤ ⟪f, (Laplace f)⟫ := by - unfold Laplace - rw [inner_sub_right] - rw [real_inner_self_eq_norm_sq] -@@ -571,23 +517,22 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( - simp_rw [inner_smul_right] - simp_rw [inner_sum] - rw [integral_const_mul] -- rw [MeasureTheory.integral_finset_sum] -+ rw [MeasureTheory.integral_finsetSum] - -- -- I couldn't figure how to to handle 'toLp (∑ x ∈ S), so I ended up manipulating the integral to avoid dealing with it -- have comp_smul_left (i: G) := MeasureTheory.Lp.coeFn_compMeasurePreserving (g := f) (f := fun a => i * a) (μ := volume) (by -+ -- Finite-sum integral identities express the quadratic form on L². -+ have comp_smul_left (i : G) := MeasureTheory.Lp.coeFn_compMeasurePreserving (g := f) (f := fun a => i * a) (μ := volume) (by - exact measurePreserving_mul_left volume i - ) - simp_rw [ae_eq_everywhere] at comp_smul_left -- have congr_comp (i: G) (x: G) := congrFun (comp_smul_left i) x -+ have congr_comp (i : G) (x : G) := congrFun (comp_smul_left i) x - simp only [Function.comp_apply] at congr_comp - simp_rw [smul_eq_mul] - simp_rw [← congr_comp] - simp_rw [← MeasureTheory.L2.inner_def] - -- let f_eq_coe: f = f := by rfl -+ let f_eq_coe : f = f := by rfl - nth_rw 1 [← MeasureTheory.Lp.toLp_coeFn (f := f) (hf := Lp.memLp f)] at f_eq_coe - -- - conv => - rhs - rhs -@@ -598,19 +543,15 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( - rw [MeasureTheory.Lp.toLp_compMeasurePreserving] - simp - -+ -- Translation invariance identifies the summands as L² inner products. - -- -- We've now packed everything back up in an inner product - -- -- we no longer need to deal with commuting toLp and Finset.sum -- -- -- let conv_f_delta_lp (i: G) := MemLp.toLp (Conv (f) (delta i⁻¹)) (μ := volume) (p := 2) (by -+ let conv_f_delta_lp (i : G) := MemLp.toLp (Conv (f) (delta i⁻¹)) (μ := volume) (p := 2) (by - simp_rw [f_conv_delta_helper] - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp f -- . exact measurePreserving_mul_left volume _ -+ · apply MeasureTheory.Lp.memLp f -+ · exact measurePreserving_mul_left volume _ - ) - -- - have sum_le := Finset.sum_le_sum (g := fun i => ‖f‖ * ‖conv_f_delta_lp i‖) (f := fun i => ⟪f, conv_f_delta_lp i⟫) (s := S) (by - intro s hs - have foo := norm_inner_le_norm (x := f) (y := conv_f_delta_lp s) (𝕜 := ℝ) -@@ -635,7 +576,6 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( - rw [f_conv_delta] - simp - -- - calc - _ ≥ ‖f‖ ^ 2 - 1 / ↑(#S) * ∑ i ∈ S, ‖f‖ * ‖conv_f_delta_lp i‖ := by - -@@ -656,11 +596,11 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( - simp - rw [← Function.comp_def] - rw [MeasureTheory.eLpNorm_comp_measurePreserving (ν := volume)] -- . simp [norm] -- . apply MeasureTheory.AEStronglyMeasurable.of_discrete -- . exact measurePreserving_mul_left volume x -+ · simp [norm] -+ · apply MeasureTheory.AEStronglyMeasurable.of_discrete -+ · exact measurePreserving_mul_left volume x - simp -- have s_card_ne_zero: (#S : ℝ) ≠ 0 := by -+ have s_card_ne_zero : (#S : ℝ) ≠ 0 := by - simp - have foo := hS - simp at foo -@@ -669,41 +609,36 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( - rw [← mul_assoc] - simp [s_card_ne_zero] - rw [pow_two] -- . -- intro s hs -+ · intro s hs - simp - -- have mem_lp_h_comp: MemLp (f ∘ (fun x => s * x)) 2 := by -+ have mem_lp_h_comp : MemLp (f ∘ (fun x => s * x)) 2 := by - apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) -- . apply MeasureTheory.Lp.memLp f -- . exact measurePreserving_mul_left volume s -+ · apply MeasureTheory.Lp.memLp f -+ · exact measurePreserving_mul_left volume s - -- have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) mem_lp_h_comp -+ have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_h_comp (MeasureTheory.Lp.memLp f) - rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 -- exact prod_lp1 -- -+ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 - - @[expose] - noncomputable def Δ := Laplace_linear.mkContinuous _ (laplace_bounded') - --lemma Δ_symmetric: Δ.IsSymmetric := by -+lemma Δ_symmetric : Δ.IsSymmetric := by - unfold LinearMap.IsSymmetric - intro x hx - unfold Δ -- -- TODO - why doesn't this fire automatically? - simp [LinearMap.mkContinuous] - simp [Laplace_linear] - rw [laplace_self_adjoint] - --lemma Δ_spectrum_subset: spectrum ℝ Δ ⊆ Set.Icc 0 2 := by -+lemma Δ_spectrum_subset : spectrum ℝ Δ ⊆ Set.Icc 0 2 := by - intro a ha - have restricts := ContinuousLinearMap.IsPositive.spectrumRestricts (f := Δ) (by - rw [ContinuousLinearMap.isPositive_def] - refine ⟨?_, ?_⟩ -- . -- apply Δ_symmetric -- . -- intro x -+ · apply Δ_symmetric -+ · intro x - simp [ContinuousLinearMap.reApplyInnerSelf_apply] - unfold Δ - simp [LinearMap.mkContinuous] -@@ -712,44 +647,39 @@ lemma Δ_spectrum_subset: spectrum ℝ Δ ⊆ Set.Icc 0 2 := by - apply laplace_positive_semidefinite - ) - simp -- have a_nonneg: 0 ≤ a := by -- have zero_eq: (0: ℝ) = (0: NNReal) := by -+ have a_nonneg : 0 ≤ a := by -+ have zero_eq : (0 : ℝ) = (0 : NNReal) := by - simp - rw [zero_eq] - apply (SpectrumRestricts.nnreal_le_iff restricts).mp -- . simp -- . exact ha -- -+ · simp -+ · exact ha - - refine ⟨?_, ?_⟩ -- . -- exact a_nonneg -- . -- have norm_le: ‖a‖ ≤ ‖(2: ℝ)‖ := by -+ · exact a_nonneg -+ · have norm_le : ‖a‖ ≤ ‖(2 : ℝ)‖ := by - have foo := spectrum.norm_le_norm_mul_of_mem ha - - simp at foo - simp [Δ] at foo - grw [← (ContinuousLinearMap.opNorm_le_iff (M := ‖2‖) (f := Δ) ?_).mpr] -- . -- have h := spectrum.norm_le_norm_mul_of_mem ha -+ · have h := spectrum.norm_le_norm_mul_of_mem ha - rw [ContinuousLinearMap.one_def] at h - grw [ContinuousLinearMap.norm_id_le] at h - simpa using h -- . intro x -+ · intro x - simp [Δ, LinearMap.mkContinuous, Laplace_linear] - have bound := laplace_bounded x - simp [enorm] at bound - norm_cast at bound -- . simp -+ · simp - - simp at norm_le - rw [abs_of_nonneg] at norm_le -- . exact norm_le -- . exact a_nonneg -+ · exact norm_le -+ · exact a_nonneg - -- --lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ spectrum ℝ Δ := by -+lemma laplace_spectrum_contains_zero (f_n_limit : f_n_conv_delta_tendsto) : 0 ∈ spectrum ℝ Δ := by - rw [spectrum.zero_mem_iff] - by_contra this - obtain ⟨f, hf⟩ := this -@@ -761,8 +691,8 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ - use 0 - use MemLp.toLp (Pi.single 1 1) (by - apply Continuous.memLp_of_hasCompactSupport -- . apply continuous_of_discreteTopology -- . simp [HasCompactSupport, tsupport] -+ · apply continuous_of_discreteTopology -+ · simp [HasCompactSupport, tsupport] - ) - simp - rw [MeasureTheory.Lp.ext_iff] -@@ -779,7 +709,7 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ - - have norm_mul_bound := ContinuousLinearEquiv.one_le_norm_mul_norm_symm (ContinuousLinearEquiv.ofUnit f) - -- have inv_norm_ge (n: ℕ) : (1 : ENNReal) / (eLpNorm (Laplace_b (F_n n)) 2 (μ := volume (α := G))) ≤ ENNReal.ofReal ‖f.inv‖ := by -+ have inv_norm_ge (n : ℕ) : (1 : ENNReal) / (eLpNorm (Laplace_b (F_n n)) 2 (μ := volume (α := G))) ≤ ENNReal.ofReal ‖f.inv‖ := by - - calc - _ = (eLpNorm (F_n n) 2 (μ := volume (α := G))) / ((eLpNorm (Laplace_b (F_n n)) 2 (μ := volume (α := G)))) := by -@@ -795,7 +725,6 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ - lhs - rw [Lp.norm_def] - -- - conv => - lhs - arg 1 -@@ -804,21 +733,20 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ - rhs - rhs - simp [hf, Δ, Laplace, Laplace_linear] -- simp [-AddSubgroupClass.coe_sub, -AddSubgroup.coe_sub, Laplace] -+ simp [-AddSubgroupClass.coe_sub, -AddSubgroup.coe_sub] - apply_fun ENNReal.ofReal at other -- -- TODO - consider removing @[simp] from 'AddSubgroupClass.coe_sub' - simp only [map_sub, ofReal_norm] at other - simp only [← Units.inv_eq_val_inv] -- simp only [F_n_lp2, Laplace_b, ← hf, conv_mu_lp2] -+ simp only [F_n_lp2, Laplace_b, conv_mu_lp2] - --simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] -- by_cases norm_f_eq_zero: ‖F_n_lp2 n - conv_mu_lp2 (F_n_lp2 n)‖ = 0 -- . rw [norm_eq_zero] at norm_f_eq_zero -+ by_cases norm_f_eq_zero : ‖F_n_lp2 n - conv_mu_lp2 (F_n_lp2 n)‖ = 0 -+ · rw [norm_eq_zero] at norm_f_eq_zero - have foo := laplace_zero_iff_zero (F_n_lp2 n) (by - simp [Laplace] - exact norm_f_eq_zero - ) - simp [F_n_lp2] at foo -- apply_fun (fun f => (f: (G → ℝ))) at foo -+ apply_fun (fun f => (f : (G → ℝ))) at foo - simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] at foo - conv at foo => - rhs -@@ -827,7 +755,7 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ - simp [foo] - unfold Conv - simp -- have const_zero: (fun (x: G) => (0 : ℝ)) = 0 := by rfl -+ have const_zero : (fun (x : G) => (0 : ℝ)) = 0 := by rfl - conv => - pattern MemLp.toLp _ _ - equals 0 => -@@ -839,32 +767,28 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ - simp_rw [ae_eq_everywhere.mp (MeasureTheory.AEEqFun.coeFn_zero)] - simp - rw [ENNReal.ofReal_div_of_pos] at other -- . -- simp only [ofReal_norm, Lp.enorm_def] at other -+ · simp only [ofReal_norm, Lp.enorm_def] at other - rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] at other - simp only [F_n_lp2, conv_mu_lp2] at other - simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] at other - rw [ENNReal.ofReal_toReal] at other -- . -- rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] -+ · rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] - rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] at other - simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] at other - simp at other - simp - simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] - exact other -- . -- rw [← ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] -+ · rw [← ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] - apply MeasureTheory.Lp.eLpNorm_ne_top -- . simpa using norm_f_eq_zero -- . exact ENNReal.ofReal_mono -- . -- rw [isBoundedLinearMap_iff] at inv_bounded -+ · simpa using norm_f_eq_zero -+ · exact ENNReal.ofReal_mono -+ · rw [isBoundedLinearMap_iff] at inv_bounded - obtain ⟨M, M_pos, le_M⟩ := inv_bounded.2 - - have foo := F_n_conv_mu_lim f_n_limit - rw [ENNReal.tendsto_atTop_zero] at foo -- obtain ⟨n, hn⟩ := foo ((1: ENNReal) /(2 * ‖f.inv‖ₑ)) (by -+ obtain ⟨n, hn⟩ := foo ((1 : ENNReal) /(2 * ‖f.inv‖ₑ)) (by - simp - rw [ENNReal.mul_eq_top] - simp -@@ -880,7 +804,7 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ - grw [hn] at inv_norm_ge - simp at inv_norm_ge - -- have norm_nonzero :‖f.inv‖ ≠ 0 := by -+ have norm_nonzero : ‖f.inv‖ ≠ 0 := by - by_contra! - simp at this - -diff --git a/Gromov/HarmonicR2.lean b/Gromov/HarmonicR2.lean -index 44f0aa9..752d6fd 100644 ---- a/Gromov/HarmonicR2.lean -+++ b/Gromov/HarmonicR2.lean -@@ -12,11 +12,6 @@ a ball of radius `2R`. - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -27,7 +22,200 @@ open Generates - variable [hGS: Generates] - include hGS - --set_option maxHeartbeats 9000000 in -+private noncomputable def harmonicCutoff (r : ℕ) (x : G) : ℝ := -+ if WordNorm x ≤ 2 * r + 1 then 1 -+ else if WordNorm x ≤ 4 * r then -(WordNorm x : ℝ) / (2 * (r : ℝ)) + 2 else 0 -+ -+private lemma harmonic_cutoff_step (f : G → ℝ) (r : ℕ) (hr : r ≠ 0) -+ (x : G) (hx : x ∈ Metric.closedBall 1 (4 * r)) (s : G) (hs : s ∈ S) : -+ (f x)^2 * (harmonicCutoff r (s * x) - harmonicCutoff r x)^2 ≤ -+ (1 : ℝ) / r^2 * (f x)^2 := by -+ simp [harmonicCutoff] -+ have norm_s_x := word_dist_mul_eq (x := 1) (y := s) (z := x) hs -+ simp_rw [WordDist_comm] at norm_s_x -+ simp_rw [WordDist_one] at norm_s_x -+ rw [← or_assoc] at norm_s_x -+ cases norm_s_x -+ . -+ rename_i norm_s_x_eq -+ cases norm_s_x_eq -+ . -+ rename_i s_lt -+ simp [dist] at hx -+ norm_cast at hx -+ rw [WordDist_one] at hx -+ by_cases s_x_le: WordNorm (s * x) ≤ 2 *r + 1 -+ . -+ simp [s_x_le] -+ simp [s_lt] -+ split_ifs -+ . simp -+ positivity -+ . -+ have s_x_eq: WordNorm (s * x) = 2 *r + 1 := by grind -+ simp [s_x_eq] -+ field_simp -+ apply mul_le_mul -+ . simp -+ . -+ norm_num -+ ring_nf -+ norm_num -+ . positivity -+ . positivity -+ . -+ grind -+ . -+ have sub_eq: (WordNorm x) - 1 = WordNorm (s * x) := by omega -+ have s_x_le_four: WordNorm (s * x) ≤ 4 * r := by -+ simp [s_lt] at hx -+ grind -+ simp [s_x_le, s_x_le_four] -+ split_ifs -+ . -+ grind -+ . -+ simp [← sub_eq] -+ rw [← sub_div] -+ simp -+ field_simp -+ conv => -+ lhs -+ rhs -+ lhs -+ equals 1 => -+ rw [sub_eq] -+ rw [s_lt] -+ push_cast -+ ring -+ simp -+ norm_num -+ -- TODO - surely this can be simplified -+ by_cases f_x_zero: (f x) ^2 = 0 -+ . simp [f_x_zero] -+ -+ rw [le_mul_iff_one_le_right] -+ . norm_num -+ . positivity -+ . -+ rename_i s_lt -+ simp [dist] at hx -+ norm_cast at hx -+ rw [WordDist_one] at hx -+ by_cases s_x_le: WordNorm (s * x) ≤ 2*r + 1 -+ . -+ simp [s_x_le] -+ split_ifs -+ . simp -+ positivity -+ . -+ have s_x_eq: WordNorm (s * x) = 2 *r := by grind -+ simp -+ rw [mul_comm] -+ apply mul_le_mul -+ . -+ ring_nf -+ norm_num -+ field_simp -+ rw [mul_sub] -+ rw [← pow_two] -+ rw [sub_mul] -+ conv => -+ lhs -+ equals (2 * r) * (2 * r) - (WordNorm x) * 2 * r * 2 + (WordNorm x)^2 => -+ ring -+ rename_i x_gt -+ simp at x_gt -+ omega -+ . simp -+ . positivity -+ . norm_num -+ . -+ by_cases norm_x_eq: WordNorm x = 4 * r -+ . -+ have not_le: ¬(WordNorm (s * x) ≤ (2 *r) + 1) := by grind -+ have not_le_four: ¬(WordNorm (s * x) ≤ (4 *r)) := by grind -+ have x_le: (WordNorm (x) ≤ (4 *r)) := by grind -+ have not_x_le: ¬(WordNorm (x) ≤ (2 *r) + 1) := by grind -+ simp [not_le, not_le_four, x_le, not_x_le] -+ rw [mul_comm] -+ -- TODO - surely this can be simplified -+ by_cases f_x_zero: (f x) ^2 = 0 -+ . simp [f_x_zero] -+ rw [mul_le_mul_iff_left₀] -+ . -+ field_simp -+ grw [x_le] -+ grind -+ simp -+ norm_num -+ simp [norm_x_eq] -+ . positivity -+ -+ have sub_eq: (WordNorm x) = WordNorm (s * x) - 1 := by omega -+ have s_x_le_four: WordNorm (s * x) ≤ 4 * r := by -+ rw [← s_lt] -+ grind -+ simp [s_x_le, s_x_le_four] -+ split_ifs -+ . -+ field_simp -+ -- TODO - surely this can be simplified -+ by_cases f_x_zero: (f x) ^2 = 0 -+ . simp [f_x_zero] -+ -+ rw [mul_le_mul_iff_right₀] -+ . -+ norm_num -+ field_simp -+ conv => -+ lhs -+ lhs -+ ring_nf -+ conv => -+ rhs -+ equals (2^2) => -+ norm_num -+ -+ have norm_x_eq: WordNorm x = 2 *r + 1 := by grind -+ rw [← s_lt, norm_x_eq] -+ conv => -+ lhs -+ lhs -+ simp -+ field_simp -+ ring_nf -+ norm_num -+ -+ . positivity -+ . -+ simp -+ rw [← sub_div] -+ simp -+ field_simp -+ conv => -+ lhs -+ rhs -+ lhs -+ equals -1 => -+ rw [sub_eq] -+ rw [Nat.cast_sub (by grind)] -+ ring -+ simp -+ norm_num -+ -- TODO - surely this can be simplified -+ by_cases f_x_zero: (f x) ^2 = 0 -+ . simp [f_x_zero] -+ -+ rw [le_mul_iff_one_le_right] -+ . norm_num -+ . positivity -+ -+ . -+ rename_i norm_eq -+ simp [← norm_eq] -+ positivity -+ - lemma harmonic_r2_inequality (f : G → ℝ) (hf : Laplace_b f = 0) (r: ℕ) (hr: r ≠ 0): - ∑ x ∈ Metric.closedBall 1 (2 * r), deriv_sq f x ≤ ((1: ℝ) / r^2) * #(S) * ∑ x ∈ Metric.closedBall 1 (4 * r), f x ^ 2 := by - -- `deriv_sq f x = ∑ s, (f (s*x) - f x)^2`; the proof below is written with the -@@ -43,30 +231,24 @@ lemma harmonic_r2_inequality (f : G → ℝ) (hf : Laplace_b f = 0) (r: ℕ) (hr - -- m * (2 *r) - * (4 * r * m) = 1 - -- 2rm - 4rm = 1 - -- m = -1/2 -- let φ := fun (x: G) => if WordNorm x ≤ (2 * r) + 1 then 1 else if (WordNorm x ≤ 4 * r) then (-(WordNorm x)/(2 * (r: ℝ))) + 2 else 0 -+ let φ := harmonicCutoff r - have phi_support : φ.support ⊆ Metric.ball 1 (4 * r) := by - intro s hs -- simp at hs -- rw [ite_eq_iff] at hs -- simp at hs -- by_cases s_gt: 2 * r + 1 < (WordNorm s) -- . -- specialize hs s_gt -- simp [dist] -- rw [WordDist_one] -- by_cases eq_four: WordNorm s = 4*r -- . -- simp [eq_four] at hs -- field_simp [hr] at hs -- norm_num at hs -- . -- norm_cast -- grind -- . -- simp at s_gt -- simp [dist, WordDist_one] -- norm_cast -- grind -+ have hsne : harmonicCutoff r s ≠ 0 := hs -+ have hslt : WordNorm s < 4 * r := by -+ by_contra h -+ have hge : 4 * r ≤ WordNorm s := by omega -+ have hshort : ¬ WordNorm s ≤ 2 * r + 1 := by omega -+ by_cases heq : WordNorm s = 4 * r -+ · apply hsne -+ rw [harmonicCutoff, ite_eq_right hshort, ite_eq_left heq.le, heq] -+ push_cast -+ field_simp [hr] -+ ring -+ · have hlong : ¬ WordNorm s ≤ 4 * r := by omega -+ exact hsne (by simp [harmonicCutoff, hshort, hlong]) -+ simp only [Metric.mem_ball, dist, WordDist_one] -+ exact_mod_cast hslt - - have foo := cutoff_inequality f φ hf ?_ - . -@@ -91,201 +273,13 @@ lemma harmonic_r2_inequality (f : G → ℝ) (hf : Laplace_b f = 0) (r: ℕ) (hr - rw [Finset.mul_sum] - apply Finset.sum_le_sum - intro s hs -- simp [φ] -- have norm_s_x := word_dist_mul_eq (x := 1) (y := s) (z := x) hs -- simp_rw [WordDist_comm] at norm_s_x -- simp_rw [WordDist_one] at norm_s_x -- rw [← or_assoc] at norm_s_x -- cases norm_s_x -- . -- rename_i norm_s_x_eq -- cases norm_s_x_eq -- . -- rename_i s_lt -- simp [dist] at hx -- norm_cast at hx -- rw [WordDist_one] at hx -- by_cases s_x_le: WordNorm (s * x) ≤ 2 *r + 1 -- . -- simp [s_x_le] -- simp [s_lt] -- split_ifs -- . simp -- positivity -- . -- have s_x_eq: WordNorm (s * x) = 2 *r + 1 := by grind -- simp [s_x_eq] -- field_simp -- apply mul_le_mul -- . simp -- . -- norm_num -- ring -- norm_num -- . positivity -- . positivity -- . -- grind -- . -- have sub_eq: (WordNorm x) - 1 = WordNorm (s * x) := by omega -- have s_x_le_four: WordNorm (s * x) ≤ 4 * r := by -- simp [s_lt] at hx -- grind -- simp [s_x_le, s_x_le_four] -- split_ifs -- . -- grind -- . -- simp [← sub_eq] -- rw [← sub_div] -- simp -- field_simp -- push_cast -- conv => -- lhs -- rhs -- lhs -- equals 1 => -- rw [sub_eq] -- rw [s_lt] -- push_cast -- ring -- simp -- norm_num -- -- TODO - surely this can be simplified -- by_cases f_x_zero: (f x) ^2 = 0 -- . simp [f_x_zero] -- -- rw [le_mul_iff_one_le_right] -- . norm_num -- . positivity -- . -- rename_i s_lt -- simp [dist] at hx -- norm_cast at hx -- rw [WordDist_one] at hx -- by_cases s_x_le: WordNorm (s * x) ≤ 2*r + 1 -- . -- simp [s_x_le] -- split_ifs -- . simp -- positivity -- . -- have s_x_eq: WordNorm (s * x) = 2 *r := by grind -- simp [s_x_eq] -- rw [mul_comm] -- apply mul_le_mul -- . -- norm_num -- ring -- norm_num -- field_simp -- rw [mul_sub] -- rw [← pow_two] -- rw [sub_mul] -- conv => -- lhs -- equals (2 * r) * (2 * r) - (WordNorm x) * 2 * r * 2 + (WordNorm x)^2 => -- ring -- rename_i x_gt -- simp at x_gt -- omega -- . simp -- . positivity -- . norm_num -- . -- by_cases norm_x_eq: WordNorm x = 4 * r -- . -- have not_le: ¬(WordNorm (s * x) ≤ (2 *r) + 1) := by grind -- have not_le_four: ¬(WordNorm (s * x) ≤ (4 *r)) := by grind -- have x_le: (WordNorm (x) ≤ (4 *r)) := by grind -- have not_x_le: ¬(WordNorm (x) ≤ (2 *r) + 1) := by grind -- simp [not_le, not_le_four, x_le, not_x_le] -- rw [mul_comm] -- -- TODO - surely this can be simplified -- by_cases f_x_zero: (f x) ^2 = 0 -- . simp [f_x_zero] -- rw [mul_le_mul_iff_left₀] -- . -- field_simp -- grw [x_le] -- grind -- simp -- norm_num -- simp [norm_x_eq] -- . positivity -- -- have sub_eq: (WordNorm x) = WordNorm (s * x) - 1 := by omega -- have s_x_le_four: WordNorm (s * x) ≤ 4 * r := by -- rw [← s_lt] -- grind -- simp [s_x_le, s_x_le_four] -- split_ifs -- . -- field_simp -- -- TODO - surely this can be simplified -- by_cases f_x_zero: (f x) ^2 = 0 -- . simp [f_x_zero] -- -- rw [mul_le_mul_iff_right₀] -- . -- norm_num -- field_simp -- conv => -- lhs -- lhs -- ring -- conv => -- rhs -- equals (2^2) => -- norm_num -- -- have norm_x_eq: WordNorm x = 2 *r + 1 := by grind -- rw [← s_lt, norm_x_eq] -- conv => -- lhs -- lhs -- simp -- field_simp -- ring -- norm_num -- -- . positivity -- . -- simp [← sub_eq] -- rw [← sub_div] -- simp -- field_simp -- push_cast -- conv => -- lhs -- rhs -- lhs -- equals -1 => -- rw [sub_eq] -- push_cast -- rw [Nat.cast_sub (by grind)] -- ring -- simp -- norm_num -- -- TODO - surely this can be simplified -- by_cases f_x_zero: (f x) ^2 = 0 -- . simp [f_x_zero] -- -- rw [le_mul_iff_one_le_right] -- . norm_num -- . positivity -- -- . -- rename_i norm_eq -- simp [← norm_eq] -- positivity -+ exact harmonic_cutoff_step f r hr x (by simpa using hx) s hs - . rfl - . intro x hx - apply Finset.sum_congr - . rfl - . intro s hs -- simp [φ] -+ simp [φ, harmonicCutoff] - simp [dist, WordDist_one] at hx - norm_cast at hx - have hx_le : WordNorm x ≤ 2 * r + 1 := by grind -@@ -367,6 +361,5 @@ lemma harmonic_r2_inequality (f : G → ℝ) (hf : Laplace_b f = 0) (r: ℕ) (hr - apply finite_ball - . exact phi_support - --#print axioms harmonic_r2_inequality - - end GeneratesNS -diff --git a/Gromov/Laplace.lean b/Gromov/Laplace.lean -index 4f525b7..afd4e3b 100644 ---- a/Gromov/Laplace.lean -+++ b/Gromov/Laplace.lean -@@ -23,7 +23,6 @@ set_option linter.style.longLine false - set_option linter.style.cdot false - -- TODO - vscode stops reporting underlines if there are too many total underlines / gutter messages - -- I've disabled some failing lints for now so that error underlines still sho up --set_option linter.style.commandStart false - - open Subgroup - open scoped Finset -diff --git a/Gromov/Lemma326.lean b/Gromov/Lemma326.lean -index 430b325..03cbd45 100644 ---- a/Gromov/Lemma326.lean -+++ b/Gromov/Lemma326.lean -@@ -12,11 +12,6 @@ basis. - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -62,7 +57,6 @@ noncomputable def phi (data: GoodScalesData b): V →ₗ[ℝ] EuclideanSpace ℝ - - @[expose] def C: ℝ := 32 * (#S) - --set_option maxHeartbeats 2500000 in - lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * (#(S^(R_1 data ))) * ‖(phi data u)‖^2 + C * (Real.exp ((2 * a data.d))) * (R_1 data + 1)^2 * (∑ x ∈ B_r (8 * R_2 data), deriv_sq u x) := by - - rw [Q_R] -@@ -132,7 +126,7 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( - rw [add_comm] - apply add_le_add - . -- ring -+ ring_nf - simp - - . -@@ -197,10 +191,10 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( - simp at foo - grind - grw [i_1_le] -- ring -+ ring_nf - . - rw [← le_sub_iff_add_le] -- ring -+ ring_nf - have i_2_pos := (GoodScales data).i_2_pos - have le_one: 1 ≤ (GoodScales data).i_2 := by grind - grw [← le_one] -@@ -229,7 +223,7 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( - equals (32 * ↑(#S) * (Real.exp (a data.d) * (↑(R_1 data) + 1) ^ 2)) * ((Real.exp (a data.d)) * ∑ x ∈ B_r (8 * ↑(R_2 data)), deriv_sq (⇑u.val) x) => - ring - apply mul_le_mul -- . ring -+ . ring_nf - simp - . - grw [Finset.sum_le_sum (g := fun x => Real.exp (a data.d) * (deriv_sq (u.val).toFun x))] -@@ -241,10 +235,10 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( - norm_cast - norm_cast at card_inter_le - grw [card_inter_le] -- simp [deriv_sq, ← pow_two] -+ simp [deriv_sq] - positivity - -- . simp [deriv_sq, ← pow_two] -+ . simp [deriv_sq] - apply Finset.sum_nonneg - intro i hi - norm_cast -@@ -280,7 +274,6 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( - rw [← pow_two] - positivity - --#print axioms lemma_3_26_a - - -- Controlled grwoth - -diff --git a/Gromov/LipschitzNorm.lean b/Gromov/LipschitzNorm.lean -index 8e23a57..64dd7bf 100644 ---- a/Gromov/LipschitzNorm.lean -+++ b/Gromov/LipschitzNorm.lean -@@ -21,8 +21,6 @@ seminormed space. The quotient space `W := LipschitzH ⧸ ConstF` is an actual n - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false - - namespace GeneratesNS - open Generates -@@ -43,7 +41,6 @@ lemma lipschiz_norm_zero: LipschitzSemiNorm (0) = 0 := by - exact nonpos_iff_eq_zero.mp sinf_le - - --#synth IsStrictOrderedRing NNReal - - -- TODO - upstream to mathlib - lemma lipschitz_attains_norm (f: G → ℝ) (hf: IsLipschitz f): LipschitzWith (LipschitzSemiNorm f) f := by -@@ -167,10 +164,9 @@ lemma lipschitzSemiNorm_neg (f : G → ℝ) : LipschitzSemiNorm (-f) = Lipschitz - unfold LipschitzSemiNorm - congr 1 - ext k -- simp only [Set.mem_setOf_eq, lipschitzWith_neg_iff] -+ simp only [Set.mem_ofPred_eq, lipschitzWith_neg_iff] - - --set_option maxHeartbeats 1000000 in - noncomputable instance LipschitzH_seminorm: SeminormedAddCommGroup (LipschitzH) where - norm := fun v => LipschitzSemiNorm v - dist_self := by -@@ -295,7 +291,7 @@ lemma iterated_lipschitz_bound (f: LipschitzH): ∀ g: G, ‖f g‖ ≤ (Lipschi - norm_cast - rw [Nat.add_sub_of_le (by grind)] - simp [DFunLike.coe] -- ring -+ ring_nf - norm_cast - conv => - lhs -diff --git a/Gromov/MatrixSubsum.lean b/Gromov/MatrixSubsum.lean -index ec60107..88c0b4b 100644 ---- a/Gromov/MatrixSubsum.lean -+++ b/Gromov/MatrixSubsum.lean -@@ -164,7 +164,7 @@ lemma eigen_nonzero {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ): ∀ (k : Modul - intro k - by_contra! - have eigen_zero := LinearMap.hasEigenvalue_zero_tfae ((A.val.map (Int.castRingHom ℂ)).toLin') -- have det_zero := (eigen_zero.out 0 3).mp -+ have det_zero := (eigen_zero.out 1 4).mp - have has_k := k.prop - conv at has_k => - lhs -@@ -195,8 +195,7 @@ lemma eigen_nonzero {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ): ∀ (k : Modul - . simp - exact Int.cast_injective - --@[expose] --def KroneckerPow_exists {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ) (k: Module.End.Eigenvalues (A.val.map (Int.castRingHom ℂ)).toLin') (eigen_one_complex: ∀ k : Module.End.Eigenvalues ((A.val.map (Int.castRingHom ℂ ))).toLin', ‖k.val‖ = 1) := Polynomial.pow_eq_one_of_mahlerMeasure_eq_one (by -+theorem KroneckerPow_exists {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ) (k: Module.End.Eigenvalues (A.val.map (Int.castRingHom ℂ)).toLin') (eigen_one_complex: ∀ k : Module.End.Eigenvalues ((A.val.map (Int.castRingHom ℂ ))).toLin', ‖k.val‖ = 1) : ∃ n : ℕ, 0 < n ∧ (k : ℂ) ^ n = 1 := Polynomial.pow_eq_one_of_mahlerMeasure_eq_one (by - rw [Polynomial.mahlerMeasure_eq_leadingCoeff_mul_prod_roots] - rw [Polynomial.Monic.leadingCoeff] - . -@@ -279,7 +278,7 @@ lemma int_matrix_unipotent {d: ℕ} (hd: 0 < d) (n: ℕ) (hn: 0 < n) (A: (Matrix - intro k - by_contra! - have eigen_zero := LinearMap.hasEigenvalue_zero_tfae (A_C.toLin') -- have det_zero := (eigen_zero.out 0 3).mp -+ have det_zero := (eigen_zero.out 1 4).mp - have has_k := k.prop - conv at has_k => - lhs -@@ -518,8 +517,6 @@ lemma int_matrix_unipotent {d: ℕ} (hd: 0 < d) (n: ℕ) (hn: 0 < n) (A: (Matrix - . exact Int.cast_injective - - --#print axioms int_matrix_unipotent --#print axioms int_matrix_poly_growth_eigenvalue - - - open scoped Pointwise Finset -diff --git a/Gromov/MatrixSubsum/Subsums.lean b/Gromov/MatrixSubsum/Subsums.lean -index 3f723a7..370ac6f 100644 ---- a/Gromov/MatrixSubsum/Subsums.lean -+++ b/Gromov/MatrixSubsum/Subsums.lean -@@ -19,8 +19,7 @@ structure DerivedSets {R: Type*} [NormedCommRing R] {n: ℕ} (A: Matrix (Fin n) - supp_disj: Disjoint (p \ q) (q \ p) - - --@[expose] --def poly_cancel {R: Type*} [NormedCommRing R] {n: ℕ} (A: Matrix (Fin n) (Fin n) R) (v: (Fin n) → R) (p q : Finset ℕ) (hpq: p.sum (fun k => A^k • v) = q.sum (fun k => A^k • v)) : DerivedSets A v p q := ({ -+theorem poly_cancel {R: Type*} [NormedCommRing R] {n: ℕ} (A: Matrix (Fin n) (Fin n) R) (v: (Fin n) → R) (p q : Finset ℕ) (hpq: p.sum (fun k => A^k • v) = q.sum (fun k => A^k • v)) : DerivedSets A v p q := ({ - h_prime := by - have p_inter_subset : p ∩ q ⊆ q := by - simp -@@ -118,15 +117,12 @@ lemma interval_sum_le {R: Type*} {d: ℕ} [RCLike R] [ NormSMulClass R (Fin d - simp - rw [Matrix.dotProduct_mulVec] - rw [mul_pow_exact A φ k hva] -- norm_cast -- - rw [Matrix.dotProduct_mulVec] at ih - rw [mul_pow_exact A φ k hva] at ih - apply_fun (fun x => x + ‖k‖ ^ n * ‖v‖) at ih - . - simp only [] at ih - -- norm_cast at ih - simp at ih - grw [ih] - simp -@@ -144,7 +140,6 @@ lemma interval_sum_le {R: Type*} {d: ℕ} [RCLike R] [ NormSMulClass R (Fin d - exact hab - . linarith - --#print axioms interval_sum_le - - - theorem hasEigenvalue_of_isRoot_charpoly {R : Type*} {M : Type*} [CommRing R] [AddCommGroup M] [Module R M] {f : Module.End R M} {μ : R} [IsDomain R] [Module.Finite R M] [Module.Free R M] (h : (f.charpoly).IsRoot μ) : f.HasEigenvalue μ := by -@@ -212,7 +207,7 @@ lemma int_matrix_eigenvalue {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ): - equals ∏ i ∈ A_C.charpoly.roots.toEnumFinset, 1 => - simp - -- apply Finset.prod_lt_prod -+ apply Finset.prod_lt_prod₀ - . - intro i hi - simp at hi -@@ -285,9 +280,7 @@ lemma int_matrix_eigenvalue {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ): - norm_num at roots_prod_le - - --#print axioms int_matrix_eigenvalue - --set_option maxHeartbeats 1200000 in - lemma subsums_unique {d: ℕ} (A: Matrix (Fin d) (Fin d) ℂ) (φ v: (Fin d) → ℂ) (N₀ N: ℕ) (hv: ‖φ ⬝ᵥ v‖ ≠ 0) (k: ℂ) (hk: 3 ≤ ‖k‖) (hva: A.vecMul φ = k • φ) (hn: N₀ ≤ N) (p q: Finset ℕ) - (hp: p ⊆ Finset.Ico N₀ N) (hq: q ⊆ Finset.Ico N₀ N) (hpq: p.sum (fun k => A^k • v) = q.sum (fun k => A^k • v)): - p = q := by -@@ -433,7 +426,6 @@ lemma subsums_unique {d: ℕ} (A: Matrix (Fin d) (Fin d) ℂ) (φ v: (Fin d) → - intro a ha b hb - grind - --#print axioms subsums_unique - - - lemma int_matrix_exponential_growth {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)) (φ : (Fin d) → ℂ) (v: Fin d → ℤ) (v_ne_zero: ‖φ ⬝ᵥ (Int.castRingHom ℂ) ∘ v‖ ≠ 0) (k: ℂ) (hv: (A.map (Int.castRingHom ℂ)).vecMul φ = (k • φ)) (k_gt: 1 < ‖k‖): -@@ -505,4 +497,3 @@ lemma int_matrix_exponential_growth {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)) ( - rw [Finset.sum_apply (a := v)] - rw [Finset.sum_apply (a := v)] - rw [hab] --#print axioms int_matrix_exponential_growth -diff --git a/Gromov/NilpotentFinite.lean b/Gromov/NilpotentFinite.lean -index ffe4196..541722a 100644 ---- a/Gromov/NilpotentFinite.lean -+++ b/Gromov/NilpotentFinite.lean -@@ -1,26 +1,20 @@ --/- --This file was edited by Aristotle. -+module - --Lean version: leanprover/lean4:v4.24.0 --Mathlib version: f897ebcf72cd16f89ab4577d0c826cd14afaafc7 --This project request had uuid: c7b9eaaf-b542-48c8-afcd-8a008aa813c3 -+public import Mathlib - --The following was proved by Aristotle: -+/-! # Finiteness of finitely generated nilpotent torsion groups - --- lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNilpotent G] (m: ℕ) (hm: 0 < m) (hg: ∀ g : G, g^m = 1): Finite G -+The proof is by induction on the nilpotency class, using the central quotient -+and finite generation of finite-index subgroups. Formalized by Aristotle. - -/ - --module -- --public import Mathlib -- - - public section - open scoped IsMulCommutative - --lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNilpotent G] (hG: Monoid.IsTorsion G): Finite G := by -+lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNilpotent G] (hG: IsMulTorsion G): Finite G := by - induction' n : Group.nilpotencyClass G with n ih generalizing G <;> simp_all +decide [ Group.nilpotencyClass ]; -- · rw [ eq_top_iff ] at n ; aesop; -+ · rw [ eq_top_iff ] at n; - -- Since the top subgroup is equal to the bottom subgroup, G must be trivial. - have h_trivial : ∀ g : G, g = 1 := by - simp_all +decide [ Subgroup.eq_bot_iff_forall ]; -@@ -40,7 +34,7 @@ lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNi - rw [← QuotientGroup.out_eq' (a := g)] - erw [ QuotientGroup.eq_one_iff ] - simp [hn.2] -- · have e := nilpotencyClass_quotient_center (G := G) -+ · have e := Group.nilpotencyClass_quotient_center (G := G) - have hq : Group.IsNilpotent (G ⧸ Subgroup.center G) := inferInstance - simp_all +decide [Group.nilpotencyClass] - -- Since $Z(G)$ is finitely generated and torsion, it is finite. -@@ -50,7 +44,7 @@ lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNi - convert Subgroup.fg_of_index_ne_zero ?_; - · infer_instance; - · exact Subgroup.finiteIndex_iff_finite_quotient.mpr h_quot_finite; -- have h_center_torsion : Monoid.IsTorsion (↥(Subgroup.center G)) := by -+ have h_center_torsion : IsMulTorsion (↥(Subgroup.center G)) := by - intro x; - rw [isOfFinOrder_iff_pow_eq_one] - specialize hG x -@@ -61,5 +55,5 @@ lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNi - rw [Subtype.ext_iff] - simp - exact hn.2 -- exact CommGroup.finite_of_fg_torsion (↥(Subgroup.center G)) h_center_torsion; -+ exact CommGroup.finite_of_fg_isMulTorsion (↥(Subgroup.center G)) h_center_torsion; - convert Finite.of_subgroup_quotient ( H := Subgroup.center G ) -diff --git a/Gromov/Packing.lean b/Gromov/Packing.lean -index 14de782..7d49b7c 100644 ---- a/Gromov/Packing.lean -+++ b/Gromov/Packing.lean -@@ -12,11 +12,6 @@ the intersection-multiplicity bound `card_B_le_exp_wa`. - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -55,8 +50,6 @@ noncomputable def GoodScales (data: GoodScalesData b) := Classical.choice (lemma - - @[expose] noncomputable def R_1 (data: GoodScalesData b) := 2 * 16^(GoodScales data).i_1 - @[expose] noncomputable def R_2 (data: GoodScalesData b) := 16^(GoodScales data).i_2 -- ---- TODO - does it matter than 'Metric.maximalSeparatedSet' uses 'R_1 < dist' instead of 'R_1 <= dist' ? - @[expose] def X_j (data: GoodScalesData b) := Metric.maximalSeparatedSet (R_1 data) ((Metric.closedBall (1: G) (R_2 data))) - -- A collection of disjoint balls that cover the ball R_2 - @[expose] def B (data: GoodScalesData b) := (fun a => Metric.closedBall a (R_1 data)) '' (X_j data) -@@ -87,10 +80,8 @@ lemma B_ball_injective_on (data: GoodScalesData b) (R: ℝ) (R_pos: 0 ≤ R) (hR - simp [edist, PseudoMetricSpace.edist] at sep - rw [dist_comm] at b_mem - simp [dist] at b_mem -- norm_cast at b_mem - rify at sep - grw [b_mem] at sep -- norm_cast at sep - grind - - lemma B_covers_R2 (data: GoodScalesData b): Metric.closedBall 1 (R_2 data) ⊆ ⋃₀ (B data) := by -@@ -100,44 +91,44 @@ lemma B_covers_R2 (data: GoodScalesData b): Metric.closedBall 1 (R_2 data) ⊆ - - -- Metric.maximalSeparatedSet_subset - have card_le := Metric.encard_le_of_isSeparated (C := (X_j data) ∪ {x}) (ε := (R_1 data)) (A := ( (Metric.closedBall 1 (R_2 data)))) ?_ ?_ ?_ -- . -+ · - simp [X_j] at card_le - rw [Set.encard_insert_of_notMem] at card_le - rw [Set.Finite.encard_eq_coe_toFinset_card] at card_le -- . norm_cast at card_le -+ · norm_cast at card_le - - grind -- . -+ · - apply Set.Finite.subset (s := Metric.closedBall 1 (R_2 data)) -- . apply finite_closed_ball -- . apply Metric.maximalSeparatedSet_subset -- . -+ · apply finite_closed_ball -+ · apply Metric.maximalSeparatedSet_subset -+ · - simp at x_not_mem - simp only [B, Set.mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, -- not_lt, X_j] at x_not_mem -+ X_j] at x_not_mem - - by_contra! - specialize x_not_mem x this - simp [R_1] at x_not_mem -- . -+ · - apply Set.union_subset -- . simp [X_j] -+ · simp [X_j] - grw [Metric.maximalSeparatedSet_subset] -- . -+ · - simp at x_mem - simpa using x_mem -- . -+ · - simp - apply Metric.IsSeparated.insert -- . simp [X_j] -+ · simp [X_j] - apply Metric.isSeparated_maximalSeparatedSet -- . intro y hy hxy -+ · intro y hy hxy - simp [B] at x_not_mem - specialize x_not_mem y hy - simp [edist, PseudoMetricSpace.edist] - simp [dist] at x_not_mem - exact x_not_mem -- . -+ · - rw [← lt_top_iff_ne_top] - grw [Metric.packingNumber_le_encard_self] - simp -@@ -152,7 +143,7 @@ lemma B_half_disjoint (data: GoodScalesData b): (B_half data).PairwiseDisjoint i - obtain ⟨y, y_mem, hy⟩ := hY - - by_cases x_eq_y : x = y -- . -+ · - rw [x_eq_y] at hx - rw [← hx, ← hy] - -@@ -171,7 +162,6 @@ lemma B_half_disjoint (data: GoodScalesData b): (B_half data).PairwiseDisjoint i - rw [dist_comm x a] at x_y_dist_bad - grw [a_dist_x, a_dist_y] at x_y_dist_bad - simp at x_y_dist_bad -- -- TODO - we need a lemma that edist = ↑dist - simp [edist, PseudoMetricSpace.edist] at x_sep - simp [dist] at x_y_dist_bad - grind -@@ -201,6 +191,7 @@ lemma ball_subset_smul_origin (a: G) (r: ℝ): Metric.closedBall a r ⊆ (MulOpp - simp at hx - simpa using hx - -+omit v_wrapper_inst in - lemma ball_smul_eq_origin (a: G) (r: ℝ): Metric.closedBall a r = (MulOpposite.op a) • Metric.closedBall 1 r := by - ext x - have foo := smul_origin_ball_subset a r -@@ -222,8 +213,6 @@ lemma B_half_finite (data: GoodScalesData b): (B_half data).Finite := by - apply finite_closed_ball - - @[expose] noncomputable def B_finsets (data: GoodScalesData b): Finset (Finset G) := Finset.image ((fun a => (finite_closed_ball a (R_1 data )).toFinset)) (X_j_finite data).toFinset -- ---- TODO - combine this with 'B_half' - @[expose] - noncomputable def B_half_finsets (data: GoodScalesData b): Finset (Finset G) := Finset.image ((fun a => (finite_closed_ball a (R_1 data / 2)).toFinset)) (X_j_finite data).toFinset - -@@ -240,10 +229,10 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( - apply Nat.mul_le_of_le_div - unfold InterMult - by_cases h_s: InterMult_f (B_3 data) = ∅ -- . simp [h_s] -- . -+ · simp [h_s] -+ · - rw [csSup_le_iff] -- . -+ · - intro n hn - simp [InterMult_f] at hn - obtain ⟨X, ⟨X_subset, X_inter⟩, X_card⟩ := hn -@@ -252,7 +241,7 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( - rw [Set.Finite.encard_eq_coe_toFinset_card X_finite] - simp - rw [Nat.le_div_iff_mul_le] -- . -+ · - have X_inner_nonempty: ∀ t ∈ X, ∃ a, a ∈ (X_j data) ∧ Metric.closedBall a (3 * (R_1 data + 1)) = t := by - intro t ht - specialize X_subset ht -@@ -264,11 +253,11 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( - rw [← Finset.sum_const] - - grw [Finset.sum_le_sum (g := fun a => if ha: a ∈ X then #(finite_closed_ball (X_inner_nonempty a ha).choose ((R_1 data) / 2)).toFinset else 0)] -- . -+ · - rw [← closed_ball_eq_S_pow] - rw [Finset.sum_dite] - rw [← Finset.card_biUnion] -- . -+ · - rw [← ne_eq, ← Set.nonempty_iff_ne_empty] at X_inter - obtain ⟨base, h_base⟩ := X_inter - -@@ -287,7 +276,7 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( - simp at ha - simp - obtain ⟨c, hc, a_dist⟩ := ha -- . -+ · - let q := (X_inner_nonempty c hc).choose - grw [dist_triangle _ q] - conv at a_dist => -@@ -307,7 +296,7 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( - simp [q] - grw [h_base] - grind -- . -+ · - rw [Finset.pairwiseDisjoint_iff] - intro a _ b _ hab - rw [Subtype.ext_iff] -@@ -328,23 +317,23 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( - simp only [Set.mem_image, id_eq, forall_exists_index, and_imp] at from_b - simp at hab - have inter_eq := from_b a_center a_center_mem (i := (Metric.closedBall a_center (↑(R_1 data) / 2) )) (?_) b_center b_center_mem (j := (Metric.closedBall b_center (↑(R_1 data) / 2) )) (?_) ?_ -- . -+ · - - rw [← a_eq, ← b_eq] - simp [a_center, b_center] at inter_eq - apply B_ball_injective_on data (R_1 data / 2) (by grind) (by simp [R_1]) at inter_eq -- . -+ · - simp [inter_eq] -- . grind -- . grind -- . rfl -- . rfl -- . simp [a_center, b_center] -+ · grind -+ · grind -+ · rfl -+ · rfl -+ · simp [a_center, b_center] - rw [← Finset.coe_nonempty] at hab - simp at hab - exact hab - -- . intro y hy -+ · intro y hy - simp at hy - simp only [hy, ↓reduceDIte] - nth_rw 1 [← Finset.card_smul_finset (MulOpposite.op (X_inner_nonempty y hy).choose)] -@@ -365,10 +354,10 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( - grw [Nat.cast_div_le] - simp - -- . simp -+ · simp - apply Finset.Nonempty.pow - simp [S_nonempty] -- . -+ · - unfold BddAbove - use (B_3 data).encard.toNat - rw [mem_upperBounds] -@@ -377,12 +366,12 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( - obtain ⟨a, b, x_eq⟩ := hx - rw [← x_eq] - apply ENat.toNat_le_toNat -- . -+ · - apply Set.encard_le_encard - grind -- . simp -+ · simp - apply B_3_finite -- . rw [Set.nonempty_iff_ne_empty] -+ · rw [Set.nonempty_iff_ne_empty] - grind - - @[expose] noncomputable def B_r (r: ℝ) := (finite_closed_ball 1 r).toFinset -@@ -401,9 +390,9 @@ lemma pack_center_helper (data: GoodScalesData b) (x: G): #{ c ∈ (X_j_finite d - - rw [← closed_ball_eq_S_pow] - grw [Finset.sum_le_sum (g := fun a => #(B_c_r a ↑((R_1 data : ℝ) / 2)))] -- . -+ · - rw [← Finset.card_biUnion] -- . -+ · - nth_rw 2 [← Finset.card_smul_finset (MulOpposite.op x)] - apply Finset.card_le_card - rw [← Finset.coe_subset] -@@ -424,9 +413,9 @@ lemma pack_center_helper (data: GoodScalesData b) (x: G): #{ c ∈ (X_j_finite d - rw [dist_comm] at x_mem - grw [x_mem] - rw [mul_add] -- ring -+ ring_nf - grind -- . -+ · - rw [Finset.pairwiseDisjoint_iff] - intro a ha b hb hab - -@@ -437,27 +426,28 @@ lemma pack_center_helper (data: GoodScalesData b) (x: G): #{ c ∈ (X_j_finite d - rw [Set.pairwiseDisjoint_iff] at from_b - simp only [Set.mem_image, id_eq, forall_exists_index, and_imp] at from_b - have inter_eq := from_b a ha.1 (i := (Metric.closedBall a ((↑(R_1 data) : ℝ) / 2) )) (?_) b hb.1 (j := (Metric.closedBall b (↑(R_1 data : ℝ) / 2) )) (?_) ?_ -- . -+ · - apply B_ball_injective_on data (R_1 data / 2) (by grind) (by simp [R_1]) at inter_eq -- . -+ · - simp [inter_eq] -- . grind -- . grind -- . rfl -- . rfl -- . -+ · grind -+ · grind -+ · rfl -+ · rfl -+ · - rw [← Finset.coe_nonempty] at hab - simp [B_c_r] at hab - simpa using hab -- . -+ · - intro a ha - simp at ha - simp [B_c_r_eq_smul, B_r] - rw [Nat.cast_div] -- . simp -- . simp [R_1] -- . simp -+ · simp -+ · simp [R_1] -+ · simp - -+omit [Nonempty ι] in - /-- Common step for Lemma 3.25 (a) and (b). - - `h i = log (#(S ^ 16 ^ i) * det (Q_{16 ^ i}) ^ (dim V)⁻¹)` splits into a log-cardinality term -@@ -483,8 +473,8 @@ lemma log_card_pow_sub_le {j k m n : ℕ} (hj : i₀ ≤ j) (hjk : j ≤ k) (hm0 - -- `h k - h j` is non-negative and may be discarded. - have det_le : (Q_R_matrix b ((16 ^ j : ℕ) : ℝ)).det ≤ (Q_R_matrix b ((16 ^ k : ℕ) : ℝ)).det := by - apply matrix_det_montone -- . exact pd_j -- . unfold Q_R_matrix -+ · exact pd_j -+ · unfold Q_R_matrix - rw [← map_sub] - rw [← LinearMap.isPosSemidef_iff_posSemidef_toMatrix] - apply Q_R_lin_sub_pos_semi_def -@@ -501,150 +491,147 @@ lemma log_card_pow_sub_le {j k m n : ℕ} (hj : i₀ ≤ j) (hjk : j ≤ k) (hm0 - Real.log ((#(S ^ m) : ℝ)) - Real.log ((#(S ^ n) : ℝ)) ≤ - Real.log ((#(S ^ 16 ^ k) : ℝ)) - Real.log ((#(S ^ 16 ^ j) : ℝ)) := by - apply sub_le_sub -- . apply Real.log_le_log (card_pos m) -+ · apply Real.log_le_log (card_pos m) - norm_cast - exact Finset.card_pow_mono hm0 hm -- . apply Real.log_le_log (card_pos (16 ^ j)) -+ · apply Real.log_le_log (card_pos (16 ^ j)) - norm_cast - exact Finset.card_pow_mono (by positivity) hn - simp only [h, f] - rw [Real.log_mul, Real.log_mul] -- . linarith -- . exact ne_of_gt (card_pos (16 ^ j)) -- . exact ne_of_gt (Real.rpow_pos_of_pos pd_j.det_pos _) -- . exact ne_of_gt (card_pos (16 ^ k)) -- . exact ne_of_gt (Real.rpow_pos_of_pos -+ · linarith -+ · exact ne_of_gt (card_pos (16 ^ j)) -+ · exact ne_of_gt (Real.rpow_pos_of_pos pd_j.det_pos _) -+ · exact ne_of_gt (card_pos (16 ^ k)) -+ · exact ne_of_gt (Real.rpow_pos_of_pos - (Q_R_matrix_pos_def_i₀ b _ i₀_le_k).det_pos _) - - -- Lemma 3.25 (a) - - lemma log_inter_mult_b3 (data: GoodScalesData b): InterMult (B_3 data) ≤ Real.exp (a data.d) := by - by_cases mult_zero: InterMult (B_3 data) = 0 -- . simp [mult_zero] -+ · simp [mult_zero] - positivity - - rw [← Real.log_le_iff_le_exp] - have foo := inter_mult_helper data - rw [← Nat.le_div_iff_mul_le] at foo - grw [foo] -- . -+ · - grw [Nat.cast_div_le] -- . -+ · - rw [Real.log_div] -- . -+ · - have bound := (GoodScales data).first_h_i - grw [← bound] - - apply log_card_pow_sub_le (GoodScales data).i_1_ge (Nat.le_succ _) -- . simp [R_1] -- . rw [pow_succ] -+ · simp [R_1] -+ · rw [pow_succ] - simp [R_1] -- ring -+ ring_nf - rw [← le_tsub_iff_right] -- . -+ · - rw [← Nat.mul_sub] - norm_num - grw [← Nat.one_le_pow] -- . simp -- . simp -- . simp -- . simp [R_1] -- . norm_cast -+ · simp -+ · simp -+ · simp -+ · simp [R_1] -+ · norm_cast - rw [Finset.card_eq_zero] - rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] - apply Finset.Nonempty.pow - simp [S_nonempty] -- . norm_cast -+ · norm_cast - rw [Finset.card_eq_zero] - rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] - apply Finset.Nonempty.pow - simp [S_nonempty] -- . simp -+ · simp - refine ⟨?_, ?_⟩ -- . apply Finset.Nonempty.pow -+ · apply Finset.Nonempty.pow - simp [S_nonempty] -- . -+ · - apply Finset.card_pow_mono -- . simp [R_1] -- . grind -- . -+ · simp [R_1] -+ · grind -+ · - simp - apply Finset.Nonempty.pow - simp [S_nonempty] -- . simp -+ · simp - grind - - lemma log_pack_center_helper (data: GoodScalesData b) (x: G): #{ c ∈ (X_j_finite data).toFinset | x ∈ B_c_r c (3 * (R_1 data + 1)) } ≤ Real.exp (a data.d) := by - by_cases inter_empty: { c ∈ (X_j_finite data).toFinset | x ∈ B_c_r c (3 * (R_1 data + 1)) } = ∅ -- . simp [inter_empty] -+ · simp [inter_empty] - apply Real.exp_nonneg - - rw [← Real.log_le_iff_le_exp] - have foo := pack_center_helper data x - rw [← Nat.le_div_iff_mul_le] at foo - grw [foo] -- . -+ · - grw [Nat.cast_div_le] -- . -+ · - rw [Real.log_div] -- . -+ · - have bound := (GoodScales data).first_h_i - grw [← bound] - - apply log_card_pow_sub_le (GoodScales data).i_1_ge (Nat.le_succ _) -- . simp [R_1] -- . rw [pow_succ] -+ · simp [R_1] -+ · rw [pow_succ] - simp [R_1] -- ring -+ ring_nf - rw [← le_tsub_iff_right] -- . -+ · - rw [← Nat.mul_sub] - norm_num - grw [← Nat.one_le_pow] -- . simp -- . simp -- . simp -- . simp [R_1] -- . norm_cast -+ · simp -+ · simp -+ · simp -+ · simp [R_1] -+ · norm_cast - rw [Finset.card_eq_zero] - rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] - apply Finset.Nonempty.pow - simp [S_nonempty] -- . norm_cast -+ · norm_cast - rw [Finset.card_eq_zero] - rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] - apply Finset.Nonempty.pow - simp [S_nonempty] -- . simp -+ · simp - refine ⟨?_, ?_⟩ -- . apply Finset.Nonempty.pow -+ · apply Finset.Nonempty.pow - simp [S_nonempty] -- . -+ · - apply Finset.card_pow_mono -- . simp [R_1] -- . grind -- . -+ · simp [R_1] -+ · grind -+ · - simp - rw [Finset.nonempty_iff_ne_empty] - simpa using inter_empty -- . simp -+ · simp - apply Finset.Nonempty.pow - simp [S_nonempty] -- . simp -+ · simp - rw [Finset.nonempty_iff_ne_empty] - simpa using inter_empty - --#print axioms inter_mult_helper --#print axioms log_inter_mult_b3 --#print axioms log_pack_center_helper - - -- Lemma 3.25 (b) - lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Real.exp (data.w * (a data.d)) := by - have B_union := Finset.card_biUnion (s := (B_half_finsets data)) (t := id) ?_ -- . -+ · - simp at B_union - have sum_le := Finset.sum_eq_card_nsmul (f := fun (u: Finset G) => #u) (s := B_half_finsets data) (b := #(S ^ (R_1 data / 2))) ?_ -- . -+ · - rw [← Nat.card_eq_card_finite_toFinset] - simp [B] - grw [Set.ncard_image_le (hs := by apply X_j_finite)] -@@ -676,33 +663,33 @@ lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Rea - grw [sum_le] - rw [← B_union] - grw [Finset.card_le_card (t := (finite_closed_ball (1: G) ↑(2 * (R_2 data))).toFinset)] -- . -+ · - grw [Nat.cast_div_le] - rw [card_closed_ball_eq] -- . -+ · - rw [← Real.log_lt_iff_lt_exp] -- . -+ · - apply lt_of_le_of_lt ?_ ((GoodScales data).h_diff_lt_w) - rw [Real.log_div (by simp; grind [S_nonempty]) (by simp; grind [S_nonempty])] - apply log_card_pow_sub_le (GoodScales data).i_1_ge -- . -- `i_2 - i_1 > w ≥ 0` forces `i_1 < i_2` -+ · -- `i_2 - i_1 > w ≥ 0` forces `i_1 < i_2` - have hdiff := (GoodScales data).i_diff_mem - simp [Set.mem_Ioo] at hdiff - omega -- . simp [R_2] -- . rw [pow_succ] -+ · simp [R_2] -+ · rw [pow_succ] - simp [R_2] - omega -- . simp [R_1] -- . -+ · simp [R_1] -+ · - apply div_pos -- . simp -+ · simp - apply Finset.Nonempty.pow - simp [S_nonempty] -- . simp -+ · simp - apply Finset.Nonempty.pow - simp [S_nonempty] -- . -+ · - intro a ha - simp at ha - obtain ⟨x, x_mem, hx⟩ := ha -@@ -723,10 +710,10 @@ lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Rea - simp at foo - grind - grw [i_1_le] -- . -+ · - grind -- . simp -- . -+ · simp -+ · - intro b hb - simp [B_half_finsets] at hb - obtain ⟨c, c_mem, b_eq⟩ := hb -@@ -734,8 +721,6 @@ lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Rea - rw [← Set.toFinite_toFinset] - rw [← Nat.card_eq_card_finite_toFinset] - rw [ball_smul_eq_origin] -- -- -- TODO - make the various finite/fintype/card conversion less awful - conv => - lhs - equals (MulOpposite.op c • (Metric.closedBall (1: G) (↑(R_1 data) / 2))).ncard => -@@ -750,8 +735,7 @@ lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Rea - simp [R_1] - rw [card_closed_ball_eq] - -- . -- -- TODO - there must be a less horrendous way of dealing with Finset here -+ · - simp [B_half_finsets] - have foo := B_half_disjoint data - simp [B_half] at foo -diff --git a/Gromov/Poincare.lean b/Gromov/Poincare.lean -index 81268ad..1b399d6 100644 ---- a/Gromov/Poincare.lean -+++ b/Gromov/Poincare.lean -@@ -11,11 +11,6 @@ public import Gromov.Packing - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -55,7 +50,7 @@ lemma deriv_sq_R_inv_comp (f: G → ℝ) (x: G): - apply Finset.sum_nbij' (i := fun s => s⁻¹) (j := fun s => s⁻¹) <;> - simp +contextual [hGS.has_inv, mul_inv_rev] - --omit v_wrapper_inst in -+omit hGS v_wrapper_inst in - lemma three_term_cs (a b: ℝ) (n: Type*) {s: Finset n} (f: n → ℝ): a + (∑ x ∈ s, f x) + b ≤ √(a^2 + (∑ x ∈ s, (f x)^2) + b^2) * √(2 + #(s)) := by - conv => - lhs -@@ -77,7 +72,7 @@ lemma ball_x_one_subset (x: G): (Metric.closedBall x 1) ⊆ ((x) • S) ∪ ((Mu - obtain ⟨l, l_prod, l_len⟩ := word_norm_prod_self (x * a⁻¹) - simp [ProdS] at l_prod - by_cases l_len_eq: l.length = 0 -- . -+ · - have l_eq: l = [] := by grind - simp [l_eq] at l_prod - rw [eq_comm, mul_inv_eq_one] at l_prod -@@ -85,7 +80,7 @@ lemma ball_x_one_subset (x: G): (Metric.closedBall x 1) ⊆ ((x) • S) ∪ ((Mu - use 1 - simp [one_mem] - grind -- . -+ · - rw [← l_len] at ha - have l_len_one: l.length = 1 := by grind - rw [List.length_eq_one_iff] at l_len_one -@@ -98,21 +93,22 @@ lemma ball_x_one_subset (x: G): (Metric.closedBall x 1) ⊆ ((x) • S) ∪ ((Mu - - rw [l_prod] - refine ⟨?_, ?_⟩ -- . -+ · - rw [← Finset.mem_inv'] - rw [← S_eq_Sinv] - simp -- . -- simp [l_prod] --omit v_wrapper_inst in -+ · -+ simp -+omit hGS v_wrapper_inst in - lemma le_of_sub_eq (a b c: ℝ) (ha: a = b - c) (hc: 0 ≤ c): a ≤ b := by - grind - -+omit v_wrapper_inst in - lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g): ∑ x ∈ B_r (↑(R - 1)), ∑ y ∈ (Metric.closedBall x 1), f y ≤ 2 * #S * ∑ x ∈ B_r R, f x := by - classical - - grw [Finset.sum_le_sum (g := fun x => ∑ y ∈ ((x) • S) ∪ ((MulOpposite.op x • S)), f y)] -- . -+ · - have union_sub (x: G) := Finset.sum_union_inter (f := f) (s₁ := x • S) (s₂ := (MulOpposite.op x • S)) - simp_rw [← eq_sub_iff_add_eq] at union_sub - have foo (x) := le_of_sub_eq _ _ _ (union_sub x) (by -@@ -131,12 +127,12 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) - - have card_le (i: G) : #({a ∈ B_r ↑(R - 1) ×ˢ S | a.1 • a.2 = i}) ≤ #S := by - apply Finset.card_le_card_of_injOn (f := fun p => p.1⁻¹ * i) -- . intro a ha -+ · intro a ha - simp at ha - simp - simp [← ha.2] - grind -- . intro a ha b hb hab -+ · intro a ha b hb hab - simp at hab - simp at ha - simp at hb -@@ -149,12 +145,12 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) - - have card_le_rev (i: G) : #({a ∈ B_r ↑(R - 1) ×ˢ S | a.2 * a.1 = i}) ≤ #S := by - apply Finset.card_le_card_of_injOn (f := fun p => i * p.1⁻¹) -- . intro a ha -+ · intro a ha - simp at ha - simp - simp [← ha.2] - grind -- . intro a ha b hb hab -+ · intro a ha b hb hab - simp at hab - simp at ha - simp at hb -@@ -170,31 +166,30 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) - rw [← Finset.sum_product'] - simp_rw [Finset.sum_comp] - grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r R)] -- . -+ · - grw [Finset.sum_le_sum (g := fun i => #S • f i)] -- . -+ · - simp - rw [← Finset.mul_sum] - rw [add_comm] - grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r R)] -- . -+ · - grw [Finset.sum_le_sum (g := fun i => #S • f i)] -- . -+ · - simp - rw [← Finset.mul_sum] - rw [← mul_add] - grind -- . -+ · - intro i hi - simp -- -- TODO - why doesn't grw work here - apply mul_le_mul -- . simp -+ · simp - apply card_le_rev -- . simp -- . apply hf -- . simp -- . -+ · simp -+ · apply hf -+ · simp -+ · - rw [Finset.image_subset_iff] - intro x hx - simp at hx -@@ -204,17 +199,17 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) - grw [hx.1] - have norm_s := word_norm_le x.2 [⟨x.2, hx.2⟩] (by simp [ProdS]) - grw [norm_s] -- simp [hR] -+ simp - grind -- . intros -+ · intros - apply mul_nonneg -- . simp -- . apply hf -- . intro i hi -+ · simp -+ · apply hf -+ · intro i hi - grw [card_le] - apply hf - -- . rw [Finset.image_subset_iff] -+ · rw [Finset.image_subset_iff] - intro x hx - simp at hx - simp [B_r, dist, WordDist_one] -@@ -224,79 +219,168 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) - have norm_s := word_norm_le x.2 [⟨x.2, hx.2⟩] (by simp [ProdS]) - grw [norm_s] - simp [hR] -- . intros -+ · intros - simp - apply mul_nonneg -- . simp -- . apply hf -- . intro i hi -+ · simp -+ · apply hf -+ · intro i hi - grw [Finset.sum_le_sum_of_subset_of_nonneg] -- . -+ · - simp - apply ball_x_one_subset -- . intros -+ · intros - apply hf - ---- TODO - get rid of some lemmas, since mathlib already has Metric.smul_closedBall defined -- ---- Theorem 3.20 --set_option maxHeartbeats 3500000 in --lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - (f_avg (R - 1) f)|^2 ≤ -- 16 * R^2 * #S * (#(B_r (2 * R - 2))) / #(B_r (R - 1)) * ∑ x ∈ (B_r (3 * R)), deriv_sq_R f x := by -+omit v_wrapper_inst in -+private lemma poincare_average_bound (R : ℕ) (f : G → ℝ) (R_nonpos : R ≠ 0) (x : G) : |f x - f_avg (R - 1) f| ≤ √((#((B_r (R - 1))) : ℝ)⁻¹ * (∑ y ∈ (B_r (R - 1)), (f x - f y)^2)) := by -+ rw [f_avg] -+ conv => -+ lhs -+ arg 1 -+ arg 1 -+ equals (#((B_r (↑R - 1))) : ℝ)⁻¹ * ∑ y ∈ (B_r (↑R - 1)), f x => -+ simp -+ rw [inv_mul_cancel_left₀] -+ simp [B_r] -+ exact Set.ncard_ne_zero_of_mem (a := 1) (by simp; grind) (finite_closed_ball 1 _) - -- by_cases R_nonpos: R = 0 -- . -- simp [R_nonpos, f_avg, B_r] -+ rw [B_r] -+ rw [← mul_sub] -+ rw [abs_mul] -+ rw [← Finset.sum_sub_distrib] -+ grw [Finset.abs_sum_le_sum_abs] -+ conv => -+ lhs -+ rhs -+ arg 2 -+ intro i -+ equals |f x - f i| * 1 => simp -+ grw [Real.sum_mul_le_sqrt_mul_sqrt] -+ simp [Real.sqrt_eq_rpow] -+ rw [← Real.rpow_neg_one] -+ rw [mul_comm] -+ rw [mul_assoc] -+ rw [← Real.rpow_add] -+ · -+ norm_num -+ simp -+ rw [Real.mul_rpow] -+ · -+ field_simp -+ rw [← Real.rpow_mul] -+ · -+ simp -+ · positivity -+ · positivity -+ · positivity - -- let δ_f (x: G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x -+ · simp -+ rw [Set.ncard_pos (finite_closed_ball 1 _)] -+ exact ⟨1, by simp; grind⟩ - -- have f_sub_le (x: G): |f x - f_avg (R - 1) f| ≤ √((#((B_r (R - 1))) : ℝ)⁻¹ * (∑ y ∈ (B_r (R - 1)), (f x - f y)^2)) := by -- rw [f_avg] -+omit v_wrapper_inst in -+private lemma poincare_path_sum (R : ℕ) (f : G → ℝ) (R_nonpos : R ≠ 0) : -+ let δ_f (x : G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x -+ let γ (z : G) (i : ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod -+ ∀ (z: G) (_hz: z ∈ B_r (2*R - 2)), ∑ x ∈ B_r (R - 1), ∑ i ∈ Finset.range (WordNorm z), δ_f (x * (γ z i)) ≤ 2 * R * ∑ x ∈ B_r (3*R - 1), δ_f x := by -+ dsimp only -+ let δ_f (x : G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x -+ let γ (z : G) (i : ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod -+ have gamma_zero (z: G): γ z 0 = 1 := by simp [γ] -+ have gamma_norm (z: G): γ z (WordNorm z) = z := by -+ simp [γ] -+ obtain ⟨prod, len_eq⟩ := (word_norm_prod_self z).choose_spec -+ simp [ProdS] at prod - conv => -- lhs -- arg 1 - arg 1 -- equals (#((B_r (↑R - 1))) : ℝ)⁻¹ * ∑ y ∈ (B_r (↑R - 1)), f x => -- simp -- rw [inv_mul_cancel_left₀] -- simp [B_r] -- exact Set.ncard_ne_zero_of_mem (a := 1) (by simp; grind) (finite_closed_ball 1 _) -+ pattern (WordNorm z) -+ rw [← len_eq] - -- rw [B_r] -- rw [← mul_sub] -- rw [abs_mul] -- rw [← Finset.sum_sub_distrib] -- grw [Finset.abs_sum_le_sum_abs] -- conv => -- lhs -- rhs -- arg 2 -- intro i -- equals |f x - f i| * 1 => simp -- grw [Real.sum_mul_le_sqrt_mul_sqrt] -- simp [Real.sqrt_eq_rpow] -- rw [← Real.rpow_neg_one] -- rw [mul_comm] -- rw [mul_assoc] -- rw [← Real.rpow_add] -- . -- norm_num -+ simp -+ exact prod -+ -+ have gamma_i_norm_le (z: G) (i: ℕ): WordNorm (γ z i) ≤ i := by -+ simp [γ] -+ -+ have i_le := word_norm_le ((word_norm_prod_self z).choose.take i).unattach.prod ((word_norm_prod_self z).choose.take i) (by simp [ProdS]) -+ grw [List.length_take_le] at i_le -+ exact i_le -+ -+ intro z hz -+ change ∑ x ∈ B_r (R - 1), ∑ i ∈ Finset.range (WordNorm z), δ_f (x * (γ z i)) ≤ 2 * R * ∑ x ∈ B_r (3*R - 1), δ_f x -+ -+ rw [← Finset.sum_product'] -+ rw [Finset.sum_comp] -+ simp -+ grw [Finset.sum_le_sum (g := fun a => (((2 * R) : ℝ) * (δ_f a)))] -+ · -+ rw [← Finset.mul_sum] -+ grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r (3*R - 1))] -+ · -+ intro p hp -+ simp at hp -+ obtain ⟨a, b, ⟨a_mem, b_lt⟩, p_eq⟩ := hp -+ rw [← p_eq] -+ simp [B_r, dist, WordDist_one] -+ grw [word_norm_mul_le] -+ simp [B_r, dist, WordDist_one] at a_mem -+ simp [B_r, dist, WordDist_one] at hz - simp -- rw [Real.mul_rpow] -- . -- field_simp -- rw [← Real.rpow_mul] -- . -- simp -- . positivity -- . positivity -- . positivity -+ grw [a_mem] -+ grw [gamma_i_norm_le] -+ grw [b_lt] -+ grw [hz] -+ grind -+ · intro p hp _ -+ simp [δ_f, deriv_sq_R] -+ positivity -+ · -+ intro b hb -+ simp at hb -+ obtain ⟨x, n, ⟨x_mem, n_lt⟩, b_eq⟩ := hb -+ grw [Finset.card_le_card (t := (Finset.range (2 * R)).image (fun n => (b * ((γ z n)⁻¹), n)))] -+ · -+ grw [Finset.card_image_le] -+ · simp -+ · simp [δ_f, deriv_sq_R] -+ positivity -+ · -+ simp [δ_f, deriv_sq_R] -+ positivity -+ · -+ intro p hp -+ simp at hp -+ simp -+ use p.2 -+ refine ⟨?_, ?_⟩ -+ · - -- . simp -- rw [Set.ncard_pos (finite_closed_ball 1 _)] -- exact ⟨1, by simp; grind⟩ -+ by_contra! -+ grw [hp.1.2] at this -+ simp [B_r, dist, WordDist_one] at hz -+ conv at hz => -+ rhs -+ equals ↑(2*R - 2) => -+ rw [Nat.cast_sub] -+ simp -+ grind - -- let γ (z: G) (i: ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod -+ norm_cast at hz -+ grind -+ · -+ ext -+ · simp [← hp.2] -+ · simp -+ -+omit v_wrapper_inst in -+private lemma poincare_difference_bound (R : ℕ) (f : G → ℝ) (R_nonpos : R ≠ 0) : -+ let δ_f (x : G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x -+ let γ (z : G) (i : ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod -+ ∀ (x y: G) (_hx: x ∈ B_r (R - 1)) (_hy: y ∈ B_r (R - 1)), |f y - f x| ≤ √((2 * R) * (∑ i ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * γ (x⁻¹ * y) i))) := by -+ dsimp only -+ let δ_f (x : G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x -+ let γ (z : G) (i : ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod - have gamma_zero (z: G): γ z 0 = 1 := by simp [γ] - have gamma_norm (z: G): γ z (WordNorm z) = z := by - simp [γ] -@@ -317,163 +401,118 @@ lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - grw [List.length_take_le] at i_le - exact i_le - -- have gamma_sum (z: G) (hz: z ∈ B_r (2*R - 2)): ∑ x ∈ B_r (R - 1), ∑ i ∈ Finset.range (WordNorm z), δ_f (x * (γ z i)) ≤ 2 * R * ∑ x ∈ B_r (3*R - 1), δ_f x := by -+ intro x y hx hy -+ change |f y - f x| ≤ √((2 * R) * (∑ i ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * γ (x⁻¹ * y) i))) - -- rw [← Finset.sum_product'] -- rw [Finset.sum_comp] -- simp -- grw [Finset.sum_le_sum (g := fun a => (((2 * R) : ℝ) * (δ_f a)))] -- . -- rw [← Finset.mul_sum] -- grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r (3*R - 1))] -- . -- intro p hp -- simp at hp -- obtain ⟨a, b, ⟨a_mem, b_lt⟩, p_eq⟩ := hp -- rw [← p_eq] -- simp [B_r, dist, WordDist_one] -- grw [word_norm_mul_le] -- simp [B_r, dist, WordDist_one] at a_mem -- simp [B_r, dist, WordDist_one] at hz -+ have inv_prod_le: WordNorm (x⁻¹ * y) ≤ 2*R - 2 := by -+ grw [word_norm_mul_le] -+ rw [← word_norm_inv] -+ simp [B_r, dist, WordDist_one] at hx hy -+ conv at hx => -+ rhs -+ equals ↑(R - 1) => -+ rw [Nat.cast_sub] - simp -- grw [a_mem] -- grw [gamma_i_norm_le] -- grw [b_lt] -- grw [hz] - grind -- . intro p hp _ -- simp [δ_f, deriv_sq_R] -- positivity -- . -- intro b hb -- simp at hb -- obtain ⟨x, n, ⟨x_mem, n_lt⟩, b_eq⟩ := hb -- grw [Finset.card_le_card (t := (Finset.range (2 * R)).image (fun n => (b * ((γ z n)⁻¹), n)))] -- . -- grw [Finset.card_image_le] -- . simp -- . simp [δ_f, deriv_sq_R] -- positivity -- . -- simp [δ_f, deriv_sq_R] -- positivity -- . -- intro p hp -- simp at hp -+ conv at hy => -+ rhs -+ equals ↑(R - 1) => -+ rw [Nat.cast_sub] - simp -- use p.2 -- refine ⟨?_, ?_⟩ -- . -- -- by_contra! -- grw [hp.1.2] at this -- simp [B_r, dist, WordDist_one] at hz -- conv at hz => -- rhs -- equals ↑(2*R - 2) => -- rw [Nat.cast_sub] -- simp -- grind -+ grind -+ norm_cast at hx hy -+ grw [hx, hy] -+ grind - -- norm_cast at hz -- grind -- . -- ext -- . simp [← hp.2] -- . simp -+ have root_le_R: √(WordNorm (x⁻¹ * y)) ≤ √(2*R) := by -+ rw [Real.sqrt_le_sqrt_iff] -+ · norm_cast -+ grw [inv_prod_le] -+ simp -+ · simp - -- have diff_le_delta_sum (x y: G) (hx: x ∈ B_r (R - 1)) (hy: y ∈ B_r (R - 1)): |f y - f x| ≤ √((2 * R) * (∑ i ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * γ (x⁻¹ * y) i))) := by -+ conv => -+ lhs -+ equals |(f (x * γ (x⁻¹ * y) (WordNorm (x⁻¹ * y)))) - f (x * γ (x⁻¹ * y) 0)| => -+ simp [gamma_zero, gamma_norm] - -- have inv_prod_le: WordNorm (x⁻¹ * y) ≤ 2*R - 2 := by -- grw [word_norm_mul_le] -- rw [← word_norm_inv] -- simp [B_r, dist, WordDist_one] at hx hy -- conv at hx => -- rhs -- equals ↑(R - 1) => -- rw [Nat.cast_sub] -- simp -- grind -- conv at hy => -- rhs -- equals ↑(R - 1) => -- rw [Nat.cast_sub] -- simp -- grind -- norm_cast at hx hy -- grw [hx, hy] -- grind -+ rw [← Finset.sum_range_sub (n := WordNorm (x⁻¹ * y)) (f := fun i => f (x * γ (x⁻¹ * y) i))] -+ grw [Finset.abs_sum_le_sum_abs] -+ conv => -+ lhs -+ arg 2 -+ intro i -+ rw [← mul_one (a := |_|)] - -- have root_le_R: √(WordNorm (x⁻¹ * y)) ≤ √(2*R) := by -- rw [Real.sqrt_le_sqrt_iff] -- . norm_cast -- grw [inv_prod_le] -- simp -- . simp -+ grw [Real.sum_mul_le_sqrt_mul_sqrt] -+ simp -+ grw [root_le_R] -+ -+ have sum_le_delta: ∑ x_1 ∈ Finset.range (WordNorm (x⁻¹ * y)), (f (x * γ (x⁻¹ * y) x_1) - f (x * γ (x⁻¹ * y) (x_1 + 1))) ^ 2 ≤ ∑ n ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * (γ (x⁻¹ * y) n)) := by -+ apply Finset.sum_le_sum -+ intro n hn -+ simp [δ_f, deriv_sq_R] -+ rw [← Finset.add_sum_erase (a := (x * γ (x⁻¹ * y) n))] -+ · -+ apply le_add_of_le_of_nonneg -+ · -+ let s := (word_norm_prod_self (x⁻¹ * y)).choose[n]?.getD ⟨1, one_mem⟩ -+ rw [← Finset.add_sum_erase (a := s.val) (h := by simp)] -+ apply le_add_of_le_of_nonneg -+ · -+ rw [sub_sq_comm] -+ conv => -+ rhs -+ lhs -+ arg 1 -+ arg 1 -+ equals x * γ (x⁻¹ * y) (n + 1) => -+ -+ rw [mul_assoc, mul_left_cancel_iff] -+ simp [γ, s] -+ by_cases n_add_lt: (n) < (word_norm_prod_self (x⁻¹ * y)).choose.length -+ · -+ simp [n_add_lt] -+ rw [List.take_add_one] -+ simp -+ rw [getElem?_pos] -+ · simp -+ · grind -+ · -+ simp [n_add_lt] -+ rw [List.take_add_one] -+ simp -+ rw [getElem?_neg] -+ · simp -+ · grind -+ · positivity -+ · positivity -+ · simp [dist, WordDist, word_norm_one] -+ -+ simp_rw [sub_sq_comm] -+ grw [sum_le_delta] -+ rw [mul_comm] -+ simp - -- conv => -- lhs -- equals |(f (x * γ (x⁻¹ * y) (WordNorm (x⁻¹ * y)))) - f (x * γ (x⁻¹ * y) 0)| => -- simp [gamma_zero, gamma_norm] -+-- Theorem 3.20 -+omit v_wrapper_inst in -+lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - (f_avg (R - 1) f)|^2 ≤ -+ 16 * R^2 * #S * (#(B_r (2 * R - 2))) / #(B_r (R - 1)) * ∑ x ∈ (B_r (3 * R)), deriv_sq_R f x := by - -- rw [← Finset.sum_range_sub (n := WordNorm (x⁻¹ * y)) (f := fun i => f (x * γ (x⁻¹ * y) i))] -- grw [Finset.abs_sum_le_sum_abs] -- conv => -- lhs -- arg 2 -- intro i -- rw [← mul_one (a := |_|)] -+ by_cases R_nonpos: R = 0 -+ · -+ simp [R_nonpos, f_avg, B_r] - -- grw [Real.sum_mul_le_sqrt_mul_sqrt] -- simp -- grw [root_le_R] -+ let δ_f (x: G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x - -- have sum_le_delta: ∑ x_1 ∈ Finset.range (WordNorm (x⁻¹ * y)), (f (x * γ (x⁻¹ * y) x_1) - f (x * γ (x⁻¹ * y) (x_1 + 1))) ^ 2 ≤ ∑ n ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * (γ (x⁻¹ * y) n)) := by -- apply Finset.sum_le_sum -- intro n hn -- simp [δ_f, deriv_sq_R] -- rw [← Finset.add_sum_erase (a := (x * γ (x⁻¹ * y) n))] -- . -- apply le_add_of_le_of_nonneg -- . -- let s := (word_norm_prod_self (x⁻¹ * y)).choose[n]?.getD ⟨1, one_mem⟩ -- rw [← Finset.add_sum_erase (a := s.val) (h := by simp)] -- apply le_add_of_le_of_nonneg -- . -- rw [sub_sq_comm] -- conv => -- rhs -- lhs -- arg 1 -- arg 1 -- equals x * γ (x⁻¹ * y) (n + 1) => -- -- rw [mul_assoc, mul_left_cancel_iff] -- simp [γ, s] -- -- TODO - we can probably use hn instead of this case split -- by_cases n_add_lt: (n) < (word_norm_prod_self (x⁻¹ * y)).choose.length -- . -- simp [n_add_lt] -- rw [List.take_add_one] -- simp -- rw [getElem?_pos] -- . simp -- . grind -- . -- simp [n_add_lt] -- rw [List.take_add_one] -- simp -- rw [getElem?_neg] -- . simp -- . grind -- . positivity -- . positivity -- . simp [dist, WordDist, word_norm_one] -- -- simp_rw [sub_sq_comm] -- grw [sum_le_delta] -- rw [mul_comm] -- simp -+ have f_sub_le := poincare_average_bound R f R_nonpos -+ -+ let γ (z: G) (i: ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod -+ have gamma_sum (z : G) (hz : z ∈ B_r (2*R - 2)) : ∑ x ∈ B_r (R - 1), ∑ i ∈ Finset.range (WordNorm z), δ_f (x * (γ z i)) ≤ 2 * R * ∑ x ∈ B_r (3*R - 1), δ_f x := -+ poincare_path_sum R f R_nonpos z hz -+ -+ have diff_le_delta_sum (x y : G) (hx : x ∈ B_r (R - 1)) (hy : y ∈ B_r (R - 1)) : |f y - f x| ≤ √((2 * R) * (∑ i ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * γ (x⁻¹ * y) i))) := -+ poincare_difference_bound R f R_nonpos x y hx hy - - conv at f_sub_le => - intro x -@@ -510,9 +549,8 @@ lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - rw [Finset.sum_product] - simp only [] - rw [Finset.sum_comm] -- -- TODO - use gcongr here - grw [Finset.sum_le_sum (g := fun z => ∑ x ∈ B_r (2*R - 2), ∑ i ∈ Finset.range (WordNorm x), δ_f (z * γ x i))] -- . -+ · - rw [Finset.sum_comm] - grw [Finset.sum_le_sum (h := gamma_sum)] - simp [δ_f] -@@ -534,37 +572,37 @@ lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - simp - grind - grw [double_ball_sum] -- . -+ · - norm_cast - - have four_le: (4: ℝ) ≤ 8 := by - grind - grw [four_le] - simp [deriv_sq_R] -- ring -+ ring_nf - simp - simp [deriv_sq_R] - positivity -- . simp -+ · simp - grind -- . intro g -+ · intro g - simp [deriv_sq_R] - positivity - -- . intro a ha -+ · intro a ha - rw [Finset.sum_comp (g := fun y => a⁻¹ * y) (f := fun x => ∑ x_1 ∈ Finset.range (WordNorm (x)), δ_f (a * γ (x) x_1))] - grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r (2*R - 2))] -- . -+ · - simp_rw [inv_mul_eq_iff_eq_mul] - simp_rw [Finset.card_filter] - simp - apply Finset.sum_le_sum - intro x hx - split_ifs -- . simp -- . simp [δ_f, deriv_sq_R] -+ · simp -+ · simp [δ_f, deriv_sq_R] - positivity -- . -+ · - rw [Finset.image_subset_iff] - intro x hx - simp [B_r, dist, WordDist_one] -@@ -574,22 +612,23 @@ lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - simp - grw [ha, hx] - grind -- . -+ · - intros - simp [δ_f, deriv_sq_R] - positivity - --#print axioms poincare_inequality - - -- `B_r` is centred at `1`, so it is closed under inversion (`word_norm_inv`). - omit v_wrapper_inst in - lemma mem_B_r_inv (r: ℝ) (x: G): x⁻¹ ∈ B_r r ↔ x ∈ B_r r := by - simp [B_r, dist, WordDist_one, ← word_norm_inv] - -+omit v_wrapper_inst in - lemma sum_B_r_inv (r: ℝ) (g: G → ℝ): ∑ x ∈ B_r r, g x⁻¹ = ∑ x ∈ B_r r, g x := by - apply Finset.sum_nbij' (i := fun x => x⁻¹) (j := fun x => x⁻¹) <;> - simp +contextual [mem_B_r_inv] - -+omit v_wrapper_inst in - lemma f_avg_inv (r: ℝ) (f: G → ℝ): f_avg r (fun y => f y⁻¹) = f_avg r f := by - unfold f_avg - rw [show (finite_closed_ball (1: G) r).toFinset = B_r r from rfl, sum_B_r_inv] -@@ -597,6 +636,7 @@ lemma f_avg_inv (r: ℝ) (f: G → ℝ): f_avg r (fun y => f y⁻¹) = f_avg r f - -- Theorem 3.20, restated for the *left* Cayley graph. Rather than mirroring the (long) proof of - -- `poincare_inequality`, we conjugate it by the inversion `x ↦ x⁻¹`: this is a bijection of every - -- `B_r r` (`mem_B_r_inv`) and carries `deriv_sq_R` to `deriv_sq` (`deriv_sq_R_inv_comp`). -+omit v_wrapper_inst in - lemma poincare_inequality_left (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - (f_avg (R - 1) f)|^2 ≤ - 16 * R^2 * #S * (#(B_r (2 * R - 2))) / #(B_r (R - 1)) * ∑ x ∈ (B_r (3 * R)), deriv_sq f x := by - have poincare := poincare_inequality R (fun y => f y⁻¹) -@@ -610,7 +650,6 @@ lemma poincare_inequality_left (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), - exact Finset.sum_congr rfl (fun x _ => deriv_sq_R_inv_comp f x)] at poincare - exact poincare - --#print axioms poincare_inequality_left - - omit v_wrapper_inst in - lemma card_B_r_eq (R: ℕ): #(B_r R) = #(S ^ R) := by -@@ -648,11 +687,11 @@ lemma lemma_3_25_poincare (data: GoodScalesData b) (j: (X_j data)) (f: G → ℝ - rw [B_c_r_eq_smul] - rw [← Finset.image_smul] - rw [Finset.sum_image] -- . -+ · - simp - left - simp [B_r] -- . simp -+ · simp - - simp_rw [sq_abs] - grw [poincare] -@@ -662,8 +701,8 @@ lemma lemma_3_25_poincare (data: GoodScalesData b) (j: (X_j data)) (f: G → ℝ - - - rw [← Real.log_le_iff_le_exp] -- . rw [Real.log_div] -- . -+ · rw [Real.log_div] -+ · - - - rw [card_B_r_eq] -@@ -678,42 +717,41 @@ lemma lemma_3_25_poincare (data: GoodScalesData b) (j: (X_j data)) (f: G → ℝ - simp - rw [card_B_r_eq] - grw [log_card_pow_sub_le (b := b) (k := (GoodScales data).i_1 + 1) (j := (GoodScales data).i_1)] -- . -+ · - grw [(GoodScales data).first_h_i] -- . -+ · - apply (GoodScales data).i_1_ge -- . simp -- . simp -+ · simp -+ · simp - grind -- . simp -+ · simp - have h_i_1 := (GoodScales data).i_1_ge - simp [i₀, R'] at h_i_1 - simp [R_1] -- ring -+ ring_nf - grind -- . -+ · - simp [R_1] -- . simp only [B_r, Set.toFinite_toFinset, ne_eq, Nat.cast_eq_zero] -+ · simp only [B_r, Set.toFinite_toFinset, ne_eq, Nat.cast_eq_zero] - apply Finset.card_ne_zero_of_mem (a := 1) - simp [R_1] -- . simp only [B_r, Set.toFinite_toFinset, ne_eq, Nat.cast_eq_zero] -+ · simp only [B_r, Set.toFinite_toFinset, ne_eq, Nat.cast_eq_zero] - apply Finset.card_ne_zero_of_mem (a := 1) - simp [R_1] -- . apply mul_pos -- . simp only [B_r, Set.toFinite_toFinset] -+ · apply mul_pos -+ · simp only [B_r, Set.toFinite_toFinset] - norm_cast - rw [Finset.card_pos] - use 1 - simp [R_1] -- . -+ · - simp [-Set.toFinset_card] - use 1 - simp [B_r, R_1] -- . -+ · - rw [mul_div_assoc] -- norm_num - grw [vol_frac_le] -- . -+ · - - conv => - lhs -@@ -729,7 +767,7 @@ lemma lemma_3_25_poincare (data: GoodScalesData b) (j: (X_j data)) (f: G → ℝ - simp [deriv_sq] - group - simp -- . simp [deriv_sq] -+ · simp [deriv_sq] - positivity - - -- Estimating functions relative to cover -diff --git a/Gromov/PolynomialGrowth.lean b/Gromov/PolynomialGrowth.lean -new file mode 100644 -index 0000000..43f2bfe ---- /dev/null -+++ b/Gromov/PolynomialGrowth.lean -@@ -0,0 +1,37 @@ -+module -+ -+public import Mathlib -+ -+/-! # Polynomial growth of Cayley balls -+ -+Cayley balls consist of products of at most a given number of generators or -+inverse generators. Their cardinalities define the growth function. -+-/ -+ -+public section -+namespace FormalConjecturesCheck -+variable {G : Type*} [Group G] -+ -+/-! The growth conventions follow the `formal-conjectures` library. -/ -+ -+/-- The `CayleyBall` is the ball of radius `n` in the Cayley graph of a group `G` with generating -+set `S`. -/ -+@[expose] -+def CayleyBall (S : Set G) (n : ℕ) : Set G := -+ {g : G | ∃ (l : List G), l.length ≤ n ∧ (∀ s ∈ l, s ∈ S ∨ s⁻¹ ∈ S) ∧ l.prod = g} -+ -+/-- The `GrowthFunction` of a group `G` with respect to a set `S` counts the number of group -+elements that can be reached by words of length at most `n` in `S`. -/ -+@[expose] -+noncomputable def GrowthFunction (S : Set G) (n : ℕ) : ℕ := -+ (CayleyBall S n).ncard -+ -+/-- A group has polynomial growth if there exists a finite generating set whose growth function is -+bounded above by a polynomial. -/ -+@[expose] -+def HasPolynomialGrowth (G : Type*) [Group G] : Prop := -+ ∃ (S : Set G), Set.Finite S ∧ Subgroup.closure S = ⊤ ∧ -+ ∃ (C : ℝ) (d : ℕ), C > 0 ∧ -+ ∀ n > 0, (GrowthFunction S n : ℝ) ≤ C * (n : ℝ) ^ d -+ -+end FormalConjecturesCheck -diff --git a/Gromov/QuadraticForm.lean b/Gromov/QuadraticForm.lean -index eda1274..8ebe2ff 100644 ---- a/Gromov/QuadraticForm.lean -+++ b/Gromov/QuadraticForm.lean -@@ -12,11 +12,6 @@ the determinant bound `det_bound` for a fixed finite-dimensional subspace `V`. - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -120,14 +115,14 @@ lemma Q_R_lin_hermetian {ι : Type*} [Fintype ι] [DecidableEq ι] {V: Submodule - lemma Q_R_lin_sub_pos_semi_def (V : Submodule ℝ LipschitzH) (R_1 R_2: ℝ) (hr: R_1 ≤ R_2): ((Q_R_lin V R_2) - Q_R_lin V R_1).IsPosSemidef := by - rw [LinearMap.isPosSemidef_def] - refine ⟨?_, ?_⟩ -- . -+ · - -- `Q_R_lin` lands in a nested linear-map type `V →ₗ⋆[ℝ] V →ₗ[ℝ] ℝ`; giving - -- `sub_eq_add_neg` its arguments explicitly avoids a metavariable whose `Sub` - -- instance would need a deeper `synthPending` than the default depth allows. - rw [sub_eq_add_neg (Q_R_lin V R_2) (Q_R_lin V R_1)] - apply LinearMap.IsSymm.add -- . apply Q_R_lin_symm -- . -+ · apply Q_R_lin_symm -+ · - -- TODO - add smul/neg lemmas so that we don't need to inline the proof here - exact { - eq := by -@@ -135,15 +130,15 @@ lemma Q_R_lin_sub_pos_semi_def (V : Submodule ℝ LipschitzH) (R_1 R_2: ℝ) (hr - simp [Q_R_lin, Q_R] - simp_rw [mul_comm] - } -- . -+ · - rw [LinearMap.isNonneg_def] - intro x - simp [Q_R_lin, Q_R] - apply Finset.sum_le_sum_of_subset_of_nonneg -- . -+ · - simp [Metric.closedBall] - grind -- . intro a ha a_not -+ · intro a ha a_not - rw [← pow_two] - positivity - -@@ -185,7 +180,7 @@ lemma v_r_all_nonzero (V: Submodule ℝ LipschitzH) [FiniteDimensional ℝ V]: - ext a - simp only [Submodule.mem_iInf, Submodule.zero_eq_bot, Submodule.mem_bot] - refine ⟨?_, ?_⟩ -- . -+ · - intro hi - ext g - specialize hi (WordNorm g) -@@ -193,11 +188,11 @@ lemma v_r_all_nonzero (V: Submodule ℝ LipschitzH) [FiniteDimensional ℝ V]: - specialize hi g - simp [dist, WordDist_one] at hi - simp [hi] -- . intro hi -+ · intro hi - simp [hi] - - rw [← Antitone.iInf_nat_add (k := n)] at inter_zero -- . -+ · - conv at inter_zero => - lhs - arg 1 -@@ -221,13 +216,12 @@ lemma v_r_all_nonzero (V: Submodule ℝ LipschitzH) [FiniteDimensional ℝ V]: - obtain ⟨x, h_x_1, h_x_2⟩ := inter_zero - use x - refine ⟨?_, ?_⟩ -- . right -+ · right - exact h_x_1 -- . exact h_x_2 -- . intro a b hab -+ · exact h_x_2 -+ · intro a b hab - simp [zero_ball] -- intro u hu hg -- intro g g_dist -+ intro u hu hg g g_dist - specialize hg g - grw [hab] at g_dist - specialize hg g_dist -@@ -242,23 +236,23 @@ lemma R'_pos (V: Submodule ℝ LipschitzH) [FiniteDimensional ℝ V]: 1 < R'_ V - lemma Q_R_pos_on_R' {V: Submodule ℝ LipschitzH} (v: V) (hv: v ≠ 0) [FiniteDimensional ℝ V] (R: ℝ) (hR: (R'_ V) ≤ R): 0 < Q_R R v v := by - simp [Q_R] - rw [Finset.sum_pos_iff_of_nonneg] -- . -+ · - by_contra! - simp_rw [← pow_two] at this - simp only [sq_nonpos_iff] at this - have foo := (v_r_all_nonzero V).choose_spec.2 (v) (by apply Submodule.coe_mem) ?_ -- . -+ · - obtain ⟨g, g_mem, x_g_nonzero⟩ := foo - specialize this g ?_ -- . -+ · - simp - unfold R'_ at hR - grw [hR] at g_mem - simpa using g_mem -- . -+ · - simp at x_g_nonzero - contradiction -- . -+ · - conv => - rhs - equals (0: V) => -@@ -267,7 +261,7 @@ lemma Q_R_pos_on_R' {V: Submodule ℝ LipschitzH} (v: V) (hv: v ≠ 0) [FiniteDi - rw [ne_eq, ← Subtype.ext_iff] - rw [← ne_eq] - exact hv -- . intro y hy -+ · intro y hy - rw [← pow_two] - positivity - -@@ -282,13 +276,11 @@ lemma Q_R_matrix_pos_def {ι : Type*} [Fintype ι] [DecidableEq ι] {V: Submodul - equals (star x) => simp - rw [star_dotProduct_toMatrix₂_mulVec] - apply Q_R_pos_on_R' -- . rw [LinearEquiv.map_ne_zero_iff] -+ · rw [LinearEquiv.map_ne_zero_iff] - exact hx -- . exact hR -+ · exact hR - --#print sorries Q_R_matrix_pos_def - ---- TODO - generalize and upstream - - section V_variable - -@@ -297,21 +289,20 @@ variable {V: Submodule ℝ LipschitzH} [V_finite: FiniteDimensional ℝ V] [Nont - @[expose] - instance nonempty_basis: Nonempty ↑(Module.Basis.ofVectorSpaceIndex ℝ ↥V) := Module.Basis.index_nonempty (Module.Basis.ofVectorSpace _ _) - ---- TODO - generalize and upstream - omit hGS in - lemma euclidean_of_lp_le {ι : Type*} [Fintype ι] (x: EuclideanSpace ℝ ι) (i: ι): - |x.ofLp i| ≤ ‖x‖ := by - - rw [EuclideanSpace.norm_eq] - rw [Real.le_sqrt] -- . -+ · - simp - apply Finset.single_le_sum (a := i) -- . intro i _ -+ · intro i _ - positivity -- . simp -- . simp -- . positivity -+ · simp -+ · simp -+ · positivity - - /-- The Lipschitz constant `‖(b i).val‖` of the `i`-th vector of the basis `b` of `V`. -/ - @[expose] -@@ -382,13 +373,13 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo - + (Module.finrank ℝ ↥V) * max_origin) * (1 + R)) ^ 2 from by - simp only [max_lipschitz, max_origin, det_bound_const]; ring] - rw [(Q_R_lin_hermetian b R).det_eq_prod_eigenvalues] -- grw [Finset.prod_le_prod (g := fun _ => m)] -- . -+ grw [Finset.prod_le_prod₀ (g := fun _ => m)] -+ · - simp - rw [← Module.finrank_eq_card_basis b] - rw [← Real.rpow_natCast] - rw [← Real.rpow_mul] -- . -+ · - have finrank_pos := Module.finrank_pos (R := ℝ) (M := V) - field_simp [finrank_pos] - simp -@@ -412,18 +403,17 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo - ext a - simp - rw [foo] -- simp only [Q_R_lin, Q_R, LipschitzH_apply, map_sum, -- map_smul, LinearMap.coe_mk, AddHom.coe_mk, LinearMap.coe_sum, LinearMap.coe_smul, -- Finset.sum_apply, Pi.smul_apply, smul_eq_mul, ge_iff_le] -+ simp only [Q_R_lin, Q_R, LipschitzH_apply, LinearMap.coe_mk, AddHom.coe_mk, -+ ge_iff_le] - simp_rw [← pow_two] - grw [Finset.sum_le_card_nsmul (n := (((((Module.finrank ℝ ↥V)) * max_lipschitz + ((Module.finrank ℝ ↥V) * max_origin)) * (1 + R)) ^ 2))] -- . -+ · - rw [← card_closed_ball_eq] - simp - rw [mul_comm] - field_simp - simp -- . -+ · - intro x hx - specialize hB x - simp -@@ -431,7 +421,7 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo - rw [← Real.sqrt_sq_eq_abs] at hB - rw [Real.sqrt_le_iff] at hB - have foo := hB.2 -- . -+ · - simp [dist, WordDist_one] at hx - grw [hx] at foo - conv => -@@ -451,10 +441,10 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo - grw [foo] - rw [mul_pow, mul_pow] - rw [mul_le_mul_iff_left₀] -- . -+ · - rw [pow_le_pow_iff_left₀] -- . apply add_le_add -- . -+ · apply add_le_add -+ · - simp [max_lipschitz] - have foo := (m_vec_V).val.lipschitz.choose_spec - conv at foo => -@@ -469,53 +459,52 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo - --grw [norm_sum_l] - grw [norm_sum_le] - grw [Finset.sum_le_card_nsmul (n := ↑max_lipschitz)] -- . -+ · - simp - rw [← Module.finrank_eq_card_basis b] -- . -+ · - intro i _ - simp [norm_smul] - grw [euclidean_of_lp_le] - simp [m_vec] - apply h_max_lipschitz -- . -+ · - simp [m_vec_V, m_vec] - rw [← LipschitzH_apply] - rw [LipschitzH.finset_sum_apply] - grw [Finset.abs_sum_le_sum_abs] - grw [Finset.sum_le_card_nsmul (n := max_origin)] -- . simp -+ · simp - rw [← Module.finrank_eq_card_basis b] -- . -+ · - intro i hi - simp - grw [euclidean_of_lp_le] - simp - apply h_max_origin -- . positivity -- . exact add_nonneg (mul_nonneg (by positivity) (max_lipschitz_nonneg b)) -+ · positivity -+ · exact add_nonneg (mul_nonneg (by positivity) (max_lipschitz_nonneg b)) - (mul_nonneg (by positivity) (max_origin_nonneg b)) -- . simp -- . positivity -+ · simp -+ · positivity - -- . unfold m -+ · unfold m - apply Matrix.PosSemidef.eigenvalues_nonneg - apply (Q_R_matrix_pos_def b R hR).posSemidef -- . -+ · - apply Finset.prod_nonneg - intro i _ - apply Matrix.PosSemidef.eigenvalues_nonneg - apply (Q_R_matrix_pos_def b R hR).posSemidef -- . -+ · - intro i _ - apply Matrix.PosSemidef.eigenvalues_nonneg - apply (Q_R_matrix_pos_def b R hR).posSemidef -- . intro i _ -+ · intro i _ - unfold m - have foo := (Finite.exists_max (Q_R_lin_hermetian b R).eigenvalues).choose_spec - apply foo i - --#print axioms det_bound - end V_variable - - end GeneratesNS -diff --git a/Gromov/Representation.lean b/Gromov/Representation.lean -index d856c0c..f91e742 100644 ---- a/Gromov/Representation.lean -+++ b/Gromov/Representation.lean -@@ -23,12 +23,6 @@ fact that it preserves the quotient norm. - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false ---- TODO - vscode stops reporting underlines if there are too many total underlines / gutter messages ---- I've disabled some failing lints for now so that error underlines still sho up --set_option linter.style.commandStart false -- - open Subgroup - open scoped Finset - open scoped Pointwise -@@ -42,8 +36,6 @@ include hGS - - open scoped RealInnerProductSpace - ---- `LipschitzH_seminorm` and `LipschitzH_normed` are public instances in ---- `Gromov.LipschitzNorm`, so they are already available here. - - -- The lift of LipschitzSemiNorm to W, using a proof that LipschitzSemiNorm doesn't depend on the choice representative - -- (adding a constant to a Lipschitz function doesn't change its Lipschitz constant) -@@ -63,13 +55,13 @@ lemma constf_eq_null: (ConstF : Set (LipschitzH)) = nullAddSubgroup (LipschitzH) - ext f - simp - refine ⟨?_, ?_⟩ -- . -+ · - intro hf - obtain ⟨z, hz⟩ := hf - rw [← hz] - simp [norm] - apply lipschitz_norm_const -- . -+ · - intro hf - simp [norm, LipschitzSemiNorm] at hf - have lipschitz_zero := lipschitz_attains_norm f (f.lipschitz) -@@ -88,14 +80,6 @@ instance const_isClosed: IsClosed (ConstF : Set (LipschitzH)) := by - exact isClosed_nullAddSubgroup - - --#synth NormedSpace ℝ (W ) --#synth NormedAddCommGroup (W ) -- --#synth TopologicalSpace (W) -- -- --set_option synthInstance.maxHeartbeats 400000 --set_option maxHeartbeats 9000000 - - -- The space 'GL(W)' of invertible continuous linear functions from W to W - abbrev GL_W := (W →L[ℝ] W)ˣ -@@ -103,26 +87,10 @@ abbrev GL_W := (W →L[ℝ] W)ˣ - -- The space 'GL(W)' of invertible continuous linear functions from W to W - - --#synth NormedRing (((W →L[ℝ] W))) -- --#synth NormedAddCommGroup (((W →L[ℝ] W))) -- -- --#synth FiniteDimensional ℝ (((W →L[ℝ] W))) -- ---- Homeomorph.isCompact_preimage -- - @[expose] - instance proper_linear_w: ProperSpace (((W →L[ℝ] W))) := FiniteDimensional.proper_rclike ℝ (((W →L[ℝ] W))) - - --#synth FiniteDimensional ℝ (LipschitzH) --#synth TopologicalSpace (LipschitzH) --#synth BorelSpace (((W →L[ℝ] W))) -- --#synth ProperSpace (((W →L[ℝ] W))) -- -- - @[expose] - def GRep: Representation ℝ G (LipschitzH) := { - toFun := fun g => { -@@ -151,8 +119,7 @@ def GRep: Representation ℝ G (LipschitzH) := { - -- We start with a map from G into the space of (not necessarily invertible) linear maps from W to W - @[expose] - def GRepW_non_invertible: Representation ℝ G (W) := Representation.quotient (GRep) ConstF (by -- intro g -- intro f hf -+ intro g f hf - simp - simp [ConstF] - simp [ConstF] at hf -@@ -186,9 +153,9 @@ lemma GRep_preserves_norm (g: G) (f: LipschitzH): ‖(GRep g) f‖ = ‖f‖ := - - have comp := LipschitzWith.comp (f := f.toFun) (g := fun y => (y * g)) (Kf := (LipschitzSemiNorm ⇑f)) (Kg := 1) ?_ ?_ - rotate_left 1 -- . apply lipschitz_attains_norm -+ · apply lipschitz_attains_norm - exact f.lipschitz -- . -+ · - simp [LipschitzWith] - - have norm_mem: (LipschitzSemiNorm f) ∈ { k: NNReal | LipschitzWith k (f.toFun ∘ (fun y => (y * g))) } := by -@@ -198,27 +165,27 @@ lemma GRep_preserves_norm (g: G) (f: LipschitzH): ‖(GRep g) f‖ = ‖f‖ := - - - apply le_antisymm -- . -+ · - apply csInf_le (by - simp [BddBelow] - apply Set.nonempty_of_mem (x := 0) - rw [mem_lowerBounds] - simp - ) norm_mem -- . -+ · - apply le_csInf -- . -+ · - apply Set.nonempty_of_mem (x := (LipschitzSemiNorm ⇑f)) norm_mem -- . intro b hb -+ · intro b hb - simp at hb - simp [LipschitzSemiNorm] - apply csInf_le -- . -+ · - simp [BddBelow] - apply Set.nonempty_of_mem (x := 0) - rw [mem_lowerBounds] - simp -- . simp -+ · simp - simp [LipschitzWith] at hb - simp [LipschitzWith] - intro x y -@@ -229,7 +196,9 @@ lemma GRep_preserves_norm (g: G) (f: LipschitzH): ‖(GRep g) f‖ = ‖f‖ := - - -- Takes in an invertible linear map from W to W, and produces a *continuous* linear map from W to W - @[expose] --noncomputable def GRepW: (W →ₗ[ℝ] W)ˣ →* (W →L[ℝ] W)ˣ := { -+noncomputable def linearUnitsToContinuous -+ (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] : -+ (E →ₗ[ℝ] E)ˣ →* (E →L[ℝ] E)ˣ := { - toFun := fun f => { - val := LinearMap.toContinuousLinearMap f.val - inv := LinearMap.toContinuousLinearMap f.inv -@@ -257,8 +226,9 @@ noncomputable def GRepW: (W →ₗ[ℝ] W)ˣ →* (W →L[ℝ] W)ˣ := { - simp - } - -- --#synth Group (GL_W) -+@[expose] -+noncomputable def GRepW : (W →ₗ[ℝ] W)ˣ →* (W →L[ℝ] W)ˣ := -+ linearUnitsToContinuous W - - lemma quotient_norm_eq_norm (f: LipschitzH): ‖(Submodule.Quotient.mk f : W)‖ = ‖f‖ := by - conv => -@@ -289,15 +259,12 @@ lemma quotient_norm_eq_norm (f: LipschitzH): ‖(Submodule.Quotient.mk f : W)‖ - rw [hinf] - simp - --#synth NormedRing (W →L[ℝ] W) --#synth TopologicalSpace (W →L[ℝ] W)ˣ -- - - lemma GLW_preseves_norm (g: G) (w: W): ‖(GRepW (GRepW_base g)).val w‖ = ‖w‖ := by - have exists_v: ∃ v, Submodule.Quotient.mk v = w := by - apply Quotient.exists_rep - obtain ⟨v, hv⟩ := exists_v -- simp [GRepW, GRepW_base, GRepW_non_invertible] -+ simp [GRepW, linearUnitsToContinuous, GRepW_base, GRepW_non_invertible] - nth_rw 1 [← hv] - rw [Representation.asGroupHom_apply] - simp only [Representation.quotient_apply, Submodule.mapQ_apply] -@@ -309,31 +276,30 @@ lemma GLW_preseves_norm (g: G) (w: W): ‖(GRepW (GRepW_base g)).val w‖ = ‖w - - lemma GRepW_norm_le (g: G): ‖(GRepW (GRepW_base g)).val‖ ≤ 1 := by - rw [ContinuousLinearMap.opNorm_le_iff] -- . simp [GLW_preseves_norm] -- . simp -+ · simp [GLW_preseves_norm] -+ · simp - - --set_option synthInstance.maxHeartbeats 500000 - - - @[expose] - noncomputable def rho_g := (GRepW_base).range - - --@[expose] --def isembedding_units_val := Units.isEmbedding_val_mk' (M := (W →L[ℝ] W)) (f := ContinuousLinearMap.inverse) (by -+theorem isembedding_units_val : -+ Topology.IsEmbedding (Units.val : (W →L[ℝ] W)ˣ → (W →L[ℝ] W)) := Units.isEmbedding_val_mk' (M := (W →L[ℝ] W)) (f := ContinuousLinearMap.inverse) (by - intro x hx - have foo := ContDiffAt.continuousAt (ContinuousLinearMap.IsInvertible.contDiffAt_map_inverse (e := x) (n := 0) (by - simp at hx - obtain ⟨u, hu⟩ := hx - apply ContinuousLinearMap.IsInvertible.of_inverse (g := u.inv) -- . -+ · - simp - have mul_inv := u.val_inv - dsimp [HMul.hMul, Mul.mul] at mul_inv - rw [hu] at mul_inv - exact mul_inv -- . simp -+ · simp - have inv_val := u.inv_val - dsimp [HMul.hMul, Mul.mul] at inv_val - rw [hu] at inv_val -@@ -341,19 +307,15 @@ def isembedding_units_val := Units.isEmbedding_val_mk' (M := (W →L[ℝ] W)) (f - )) - apply ContinuousAt.continuousWithinAt - exact foo -- -- ContinuousLinearMap.IsInvertible.contDiffAt_map_inverse - ) (by - intro u - have mul_inv := u.val_inv - dsimp [HMul.hMul, Mul.mul] at mul_inv - apply ContinuousLinearMap.inverse_eq -- . exact u.val_inv -- . exact u.inv_val -+ · exact u.val_inv -+ · exact u.inv_val - ) - --#synth NormedSpace ℝ (W →L[ℝ] W) --#synth MetricSpace (W →L[ℝ] W) -- - - -- All norms are equivalent on finite-dimensional spaces: - -- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Analysis/Normed/Module/FiniteDimension.html -@@ -363,22 +325,9 @@ def isembedding_units_val := Units.isEmbedding_val_mk' (M := (W →L[ℝ] W)) (f - -- ρ(G) contains an abelian subgroup of finite index - - ----borelize (W →L[ℝ] W)ˣ -- -- ---- (dropped a `#synth ContinuousMul (W →L[ℝ] W)` diagnostic here: it only resolves at a ---- raised `maxSynthPendingDepth`. The instance itself *is* needed -- see ---- `rho_g_contains_abelian`, which raises the depth for exactly this reason -- but a bare ---- `#synth` is not worth carrying a build-wide option for.) -- -- --#synth NormedAddCommGroup (W) - --#synth FiniteDimensional ℝ (W) - - --#synth TopologicalSpace (W) -- - - @[expose] - def FreshTopology (V: Type*) := V -@@ -388,20 +337,9 @@ instance (V: Type*) [AddCommGroup V] [base_module: Module ℝ V]: Module ℝ (Fr - @[expose] - instance (V: Type*) [AddCommGroup V] [Module ℝ V] [base_finite: FiniteDimensional ℝ V]: FiniteDimensional ℝ (FreshTopology V) := base_finite - -- --#synth CStarAlgebra ((ℂ →L[ℂ] ℂ)) -- --#synth AddCommMonoid (W) -- - @[expose] - instance T2_W: T2Space (W) := TopologicalSpace.t2Space_of_metrizableSpace - --#synth T2Space (W) -- -- --#synth TopologicalSpace (W →L[ℝ] W) --#synth FiniteDimensional ℝ (W →L[ℝ] W) -- - @[expose] - noncomputable def G_SPolyData {d: ℕ} (h_poly: HasPolynomialGrowthD hGS.S d): SPolyData (T := G) ⊤ := { - S := Subgroup.topEquiv.symm.toMonoidHom '' hGS.S -@@ -438,10 +376,10 @@ noncomputable def G_SPolyData {d: ℕ} (h_poly: HasPolynomialGrowthD hGS.S d): S - rw [Set.Finite.toFinset_image] - rw [← Finset.image_pow] - grw [Finset.card_image_le] -- . -+ · - specialize foo r hr - simpa using foo -- . simp -+ · simp - } - - -diff --git a/Gromov/RhoAbelian.lean b/Gromov/RhoAbelian.lean -index 480ffb6..24e4bba 100644 ---- a/Gromov/RhoAbelian.lean -+++ b/Gromov/RhoAbelian.lean -@@ -11,9 +11,6 @@ public import Gromov.Theorem38 - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false - - open Subgroup - open scoped Finset -@@ -28,23 +25,157 @@ include hGS - - open scoped RealInnerProductSpace - --set_option synthInstance.maxHeartbeats 500000 - --set_option maxHeartbeats 9000000 -+ -+private lemma rho_continuous_range_compact -+ [IsTopologicalGroup (W →L[ℝ] W)ˣ] : -+ CompactSpace ((GRepW.comp GRepW_base).range.topologicalClosure) := by -+ let my_new_range := (GRepW.comp GRepW_base).range -+ have continuous_mul : ContinuousMul (W →L[ℝ] W) := -+ (NonUnitalSeminormedRing.toIsTopologicalRing (α := W →L[ℝ] W)).toContinuousMul -+ have is_topological : IsTopologicalGroup (W →L[ℝ] W)ˣ := by infer_instance -+ let plain_units_metric : MetricSpace (W →L[ℝ] W)ˣ := -+ isembedding_units_val.comapMetricSpace Units.val -+ change CompactSpace my_new_range.topologicalClosure -+ -+ refine { isCompact_univ := ?_ } -+ rw [Subtype.isCompact_iff] -+ rw [Topology.IsEmbedding.isCompact_iff (f := Units.val) ?_] -+ · rw [Metric.isCompact_iff_isClosed_bounded (α := (W) →L[ℝ] (W))] -+ refine ⟨?_, ?_⟩ -+ · apply IsSeqClosed.isClosed -+ by_contra! -+ simp [IsSeqClosed] at this -+ obtain ⟨seq, seq_in, ⟨lim_seq, seq_tendsto_lim_seq, lim_seq_not_mem⟩⟩ := this -+ -+ by_cases lim_seq_invertible: IsUnit lim_seq.toLinearMap -+ · -+ -- If the limit (in the space of linear maps) is invertible, then the limit will also exist in the space -+ -- of units, which will then imply that the limit exists in the space of linear maps. -+ obtain ⟨u, hu⟩ := lim_seq_invertible -+ have closure_closed := Subgroup.isClosed_topologicalClosure my_new_range -+ apply IsClosed.isSeqClosed at closure_closed -+ dsimp [IsSeqClosed] at closure_closed -+ -+ have seq_units: ∀ n: ℕ, IsUnit (seq n) := by -+ intro n -+ obtain ⟨x, x_mem, seq_eq_x⟩ := (seq_in n) -+ rw [← seq_eq_x] -+ apply Units.isUnit -+ -+ have lim_units := closure_closed (x := fun n => (seq_units n).unit) (p := GRepW u) ?_ ?_ -+ · -+ specialize lim_seq_not_mem (GRepW u) lim_units -+ conv at lim_seq_not_mem => -+ arg 1 -+ lhs -+ equals u.val.toContinuousLinearMap => -+ rfl -+ rw [hu] at lim_seq_not_mem -+ conv at lim_seq_not_mem => -+ arg 1 -+ lhs -+ equals lim_seq => -+ rfl -+ simp at lim_seq_not_mem -+ · intro n -+ have seq_n := seq_in n -+ obtain ⟨x, x_mem, seq_eq_x⟩ := seq_n -+ simp_rw [← seq_eq_x] -+ simpa using x_mem -+ · -+ rw [Topology.IsEmbedding.tendsto_nhds_iff (g := Units.val)] -+ · -+ conv => -+ arg 1 -+ equals seq => -+ rfl -+ -+ have to_clm_u: GRepW u = u.val.toContinuousLinearMap := by -+ rfl -+ -+ have u_val_eq_lim: u.val.toContinuousLinearMap = lim_seq := by -+ rw [hu] -+ rfl -+ -+ rw [to_clm_u, u_val_eq_lim] -+ exact seq_tendsto_lim_seq -+ · -+ exact isembedding_units_val -+ -+ -+ -- If the limit (in the space of linear maps) is not invertible, then it has a non-trivial kernel. -+ rw [LinearMap.isUnit_iff_ker_eq_bot] at lim_seq_invertible -+ apply Submodule.exists_mem_ne_zero_of_ne_bot at lim_seq_invertible -+ obtain ⟨v, v_in_ker, v_ne_zero⟩ := lim_seq_invertible -+ simp at v_in_ker -+ -+ -+ have eval_at := Filter.Tendsto.eval_const seq_tendsto_lim_seq v -+ have norm_tendsto := Continuous.tendsto (f := fun (x: W) => ‖x‖) (by fun_prop) (lim_seq v) -+ have norm_seq_lim := Filter.Tendsto.comp norm_tendsto eval_at -+ rw [v_in_ker] at norm_seq_lim -+ rw [norm_zero] at norm_seq_lim -+ conv at norm_seq_lim => -+ arg 1 -+ -- Use the fact that the action preserves the euclidian norm (maybe just up to a constant), -+ -- so the sequence is actually constant -+ equals fun x => ‖v‖ => -+ funext n -+ simp -+ have seq_mem := seq_in n -+ obtain ⟨x, x_mem, seq_eq_x⟩ := seq_mem -+ rw [← seq_eq_x] -+ apply ContinuousWithinAt.eq_const_of_mem_closure (f := fun (x: ((W) →L[ℝ] (W))ˣ) => ‖x.val v‖) (c := ‖v‖) (x := x) (s := my_new_range) -+ · apply Continuous.continuousWithinAt -+ fun_prop -+ · exact x_mem -+ · intro y hy -+ simp [my_new_range] at hy -+ obtain ⟨g, rep_g_eq_y⟩ := hy -+ rw [← rep_g_eq_y] -+ apply GLW_preseves_norm -+ have r_t2: T2Space ℝ := TopologicalSpace.t2Space_of_metrizableSpace -+ -+ have tendsto_norm_v := tendsto_const_nhds (α := ℕ) (f := Filter.atTop) (x := ‖v‖) -+ have norm_v_zero := tendsto_nhds_unique tendsto_norm_v norm_seq_lim -+ simp at norm_v_zero -+ contradiction -+ · -+ simp -+ apply LipschitzWith.isBounded_image (f := Units.val) (K := 1) -+ · rw [lipschitzWith_iff_dist_le_mul] -+ intro a b -+ simp -+ rfl -+ · -+ apply Bornology.IsBounded.closure -+ rw [Metric.isBounded_iff_subset_ball 1] -+ use 3 -+ intro a ha -+ simp [my_new_range] at ha -+ obtain ⟨g, rep_g_eq_a⟩ := ha -+ simp -+ conv => -+ lhs -+ equals dist (a.val) (ContinuousLinearMap.id _ _) => -+ rfl -+ grw [dist_le_norm_add_norm (a.val) (ContinuousLinearMap.id ℝ W)] -+ grw [ContinuousLinearMap.norm_id_le] -+ rw [← rep_g_eq_a] -+ grw [GRepW_norm_le] -+ norm_num -+ -- Bornology.isBounded_image_subtype_val -+ · exact isembedding_units_val - - open scoped RealInnerProductSpace in - attribute [-simp] Subgroup.map_toSubmonoid in --set_option maxHeartbeats 2000000 in --set_option synthInstance.maxHeartbeats 600000 in ----set_option trace.Meta.synthInstance true in - lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Subgroup ((rho_g)), IsMulCommutative M ∧ M.FiniteIndex := by - classical - let my_map := Subgroup.subtype (rho_g) - have W_equiv: (W) ≃ₗ[ℝ] EuclideanSpace ℝ (Fin <| Module.finrank ℝ W) := LinearEquiv.ofFinrankEq _ _ finrank_euclideanSpace_fin.symm - - -- unfold GL_W at my_map -- -- TODO - is there a simpler way to get an arbitrary inner product space? - let inner_prod_core: InnerProductSpace.Core ℝ (FreshTopology (W)) := { - inner := fun v w => ⟪W_equiv v, W_equiv w⟫, - conj_inner_symm := by intro x y; simp [real_inner_comm], -@@ -75,118 +206,6 @@ lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Su - have fresh_t2: T2Space (FreshTopology (W)) := TopologicalSpace.t2Space_of_metrizableSpace - - -- let plain_linear_to_clm: (((W)) →ₗ[ℝ] ((W)))ˣ →* (((W)) →L[ℝ] ((W)))ˣ := { -- toFun := fun f => { -- val := LinearMap.toContinuousLinearMap f.val -- inv := LinearMap.toContinuousLinearMap f.inv -- val_inv := by -- have old_inv := f.val_inv -- ext a -- apply_fun (fun f => f a) at old_inv -- simp only [Units.inv_eq_val_inv, Module.End.one_apply] at old_inv -- apply old_inv -- inv_val := by -- have old_inv := f.inv_val -- ext a -- apply_fun (fun f => f a) at old_inv -- simp only [Units.inv_eq_val_inv, Module.End.one_apply] at old_inv -- apply old_inv -- } -- -- TODO - why is a normal `simp` so slow here? -- map_one' := by -- ext a -- simp only [] -- rfl -- map_mul' := by -- intro f g -- ext a -- simp only [] -- rfl -- } -- -- let linear_to_clm: ((FreshTopology (W)) →ₗ[ℝ] (FreshTopology (W)))ˣ →* ((FreshTopology (W)) →L[ℝ] (FreshTopology (W)))ˣ := { -- toFun := fun f => { -- val := LinearMap.toContinuousLinearMap f.val -- inv := LinearMap.toContinuousLinearMap f.inv -- val_inv := by -- have old_inv := f.val_inv -- ext a -- apply_fun (fun f => f a) at old_inv -- simp only [Units.inv_eq_val_inv, Module.End.one_apply] at old_inv -- apply old_inv -- inv_val := by -- have old_inv := f.inv_val -- ext a -- apply_fun (fun f => f a) at old_inv -- simp only [Units.inv_eq_val_inv, Module.End.one_apply] at old_inv -- apply old_inv -- } -- -- TODO - why is a normal `simp` so slow here? -- map_one' := by -- ext a -- simp only [] -- rfl -- map_mul' := by -- intro f g -- ext a -- simp only [] -- rfl -- } -- -- -- have plain_linear_to_clm_preserves_norm (g: G) (w: (W)): ‖(plain_linear_to_clm (GRepW_base g)).val w‖ = ‖w‖ := by -- simp [plain_linear_to_clm] -- have exists_v: ∃ v, Submodule.Quotient.mk v = w := by -- apply Quotient.exists_rep -- obtain ⟨v, hv⟩ := exists_v -- simp [GRepW, GRepW_base, GRepW_non_invertible] -- nth_rw 1 [← hv] -- rw [Representation.asGroupHom_apply] -- simp only [Representation.quotient_apply, Submodule.mapQ_apply] -- -- rw [quotient_norm_eq_norm] -- rw [GRep_preserves_norm] -- rw [← hv] -- rw [quotient_norm_eq_norm] -- -- -- let my_range := (linear_to_clm.comp GRepW_base).range -- -- have fresh_complete: CompleteSpace (FreshTopology (W)) := by apply complete_of_proper (α := FreshTopology (W)) -- -- -- -- -- TODO - generalize to LinearMap/ContinuousLinearMap -- have units_val_embedding: Topology.IsEmbedding (Units.val (α := ((FreshTopology (W)) →L[ℝ] (FreshTopology (W))))) := by -- apply Units.isEmbedding_val_mk' (f := fun g => g.inverse) -- . intro a ha -- apply (ContinuousLinearMap.IsInvertible.contDiffAt_map_inverse (n := 1) ?_).continuousAt.continuousWithinAt -- simp at ha -- obtain ⟨b, hb⟩ := ha -- use ContinuousLinearEquiv.ofUnit b -- rw [← hb] -- rfl -- . intro u -- apply ContinuousLinearMap.inverse_eq -- . -- have u_val_inv := u.val_inv -- rw [ContinuousLinearMap.mul_def] at u_val_inv -- -- TODO - avoid the unfold somehow -- unfold Inv.inv -- unfold Units.instInv -- simp only [] -- rw [u_val_inv] -- rfl -- . -- unfold Inv.inv -- unfold Units.instInv -- simp only [] -- have u_inv_val := u.inv_val -- rw [ContinuousLinearMap.mul_def] at u_inv_val -- rw [u_inv_val] -- rfl -- -- - let my_new_range := ((GRepW).comp GRepW_base).range - unfold rho_g - -@@ -200,15 +219,6 @@ lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Su - have is_topological: IsTopologicalGroup ((W) →L[ℝ] (W))ˣ := by - infer_instance - -- let plain_units_metric: MetricSpace (((W)) →L[ℝ] ((W)))ˣ := by -- apply Topology.IsEmbedding.comapMetricSpace (f := Units.val) -- exact isembedding_units_val -- -- let units_metric: MetricSpace ((FreshTopology (W)) →L[ℝ] (FreshTopology (W)))ˣ := by -- apply Topology.IsEmbedding.comapMetricSpace (f := Units.val) -- apply units_val_embedding -- -- - have fresh_equiv: W ≃L[ℝ] FreshTopology (W) := ContinuousLinearEquiv.ofFinrankEq (rfl) - - let to_fresh (f: (W) ≃ₗ[ℝ] (W)): (FreshTopology (W)) ≃ₗ[ℝ] (FreshTopology (W)) := f -@@ -287,147 +297,16 @@ lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Su - - let mapped_group := Subgroup.map new_map_hom.toMonoidHom my_new_range.topologicalClosure - -- have my_new_range_compact: CompactSpace my_new_range.topologicalClosure := by -- refine { isCompact_univ := ?_ } -- rw [Subtype.isCompact_iff] -- rw [Topology.IsEmbedding.isCompact_iff (f := Units.val) ?_] -- . rw [Metric.isCompact_iff_isClosed_bounded (α := (W) →L[ℝ] (W))] -- refine ⟨?_, ?_⟩ -- . apply IsSeqClosed.isClosed -- by_contra! -- simp [IsSeqClosed] at this -- obtain ⟨seq, seq_in, ⟨lim_seq, seq_tendsto_lim_seq, lim_seq_not_mem⟩⟩ := this -- -- by_cases lim_seq_invertible: IsUnit lim_seq.toLinearMap -- . -- -- If the limit (in the space of linear maps) is invertible, then the limit will also exist in the space -- -- of units, which will then imply that the limit exists in the space of linear maps. -- -- TODO - this probably can be a direct proof, rather than by contradiction -- obtain ⟨u, hu⟩ := lim_seq_invertible -- have closure_closed := Subgroup.isClosed_topologicalClosure my_new_range -- apply IsClosed.isSeqClosed at closure_closed -- dsimp [IsSeqClosed] at closure_closed -- -- have seq_units: ∀ n: ℕ, IsUnit (seq n) := by -- intro n -- obtain ⟨x, x_mem, seq_eq_x⟩ := (seq_in n) -- rw [← seq_eq_x] -- apply Units.isUnit -- -- have lim_units := closure_closed (x := fun n => (seq_units n).unit) (p := plain_linear_to_clm u) ?_ ?_ -- . -- specialize lim_seq_not_mem (plain_linear_to_clm u) lim_units -- conv at lim_seq_not_mem => -- arg 1 -- lhs -- equals u.val.toContinuousLinearMap => -- rfl -- rw [hu] at lim_seq_not_mem -- conv at lim_seq_not_mem => -- arg 1 -- lhs -- equals lim_seq => -- rfl -- simp at lim_seq_not_mem -- . intro n -- have seq_n := seq_in n -- obtain ⟨x, x_mem, seq_eq_x⟩ := seq_n -- simp_rw [← seq_eq_x] -- simpa using x_mem -- . -- rw [Topology.IsEmbedding.tendsto_nhds_iff (g := Units.val)] -- . -- conv => -- arg 1 -- equals seq => -- rfl -- -- have to_clm_u: plain_linear_to_clm u = u.val.toContinuousLinearMap := by -- rfl -- -- have u_val_eq_lim: u.val.toContinuousLinearMap = lim_seq := by -- rw [hu] -- rfl -- -- rw [to_clm_u, u_val_eq_lim] -- exact seq_tendsto_lim_seq -- . -- exact isembedding_units_val -- -- -- -- If the limit (in the space of linear maps) is not invertible, then it has a non-trivial kernel. -- rw [LinearMap.isUnit_iff_ker_eq_bot] at lim_seq_invertible -- apply Submodule.exists_mem_ne_zero_of_ne_bot at lim_seq_invertible -- obtain ⟨v, v_in_ker, v_ne_zero⟩ := lim_seq_invertible -- simp at v_in_ker -- -- -- have eval_at := Filter.Tendsto.eval_const seq_tendsto_lim_seq v -- have norm_tendsto := Continuous.tendsto (f := fun (x: W) => ‖x‖) (by fun_prop) (lim_seq v) -- have norm_seq_lim := Filter.Tendsto.comp norm_tendsto eval_at -- rw [v_in_ker] at norm_seq_lim -- rw [norm_zero] at norm_seq_lim -- conv at norm_seq_lim => -- arg 1 -- -- Use the fact that the action preserves the euclidian norm (maybe just up to a constant), -- -- so the sequence is actually constant -- equals fun x => ‖v‖ => -- funext n -- simp -- have seq_mem := seq_in n -- obtain ⟨x, x_mem, seq_eq_x⟩ := seq_mem -- rw [← seq_eq_x] -- apply ContinuousWithinAt.eq_const_of_mem_closure (f := fun (x: ((W) →L[ℝ] (W))ˣ) => ‖x.val v‖) (c := ‖v‖) (x := x) (s := my_new_range) -- . apply Continuous.continuousWithinAt -- fun_prop -- . exact x_mem -- . intro y hy -- simp [my_range] at hy -- obtain ⟨g, rep_g_eq_y⟩ := hy -- rw [← rep_g_eq_y] -- apply plain_linear_to_clm_preserves_norm -- -- -- TODO - why do we need this? -- have r_t2: T2Space ℝ := TopologicalSpace.t2Space_of_metrizableSpace -- -- have tendsto_norm_v := tendsto_const_nhds (α := ℕ) (f := Filter.atTop) (x := ‖v‖) -- have norm_v_zero := tendsto_nhds_unique tendsto_norm_v norm_seq_lim -- simp at norm_v_zero -- contradiction -- . -- simp -- apply LipschitzWith.isBounded_image (f := Units.val) (K := 1) -- . rw [lipschitzWith_iff_dist_le_mul] -- intro a b -- simp -- rfl -- . -- apply Bornology.IsBounded.closure -- rw [Metric.isBounded_iff_subset_ball 1] -- use 3 -- intro a ha -- simp [my_new_range] at ha -- obtain ⟨g, rep_g_eq_a⟩ := ha -- simp -- conv => -- lhs -- equals dist (a.val) (ContinuousLinearMap.id _ _) => -- rfl -- grw [dist_le_norm_add_norm (a.val) (ContinuousLinearMap.id ℝ W)] -- grw [ContinuousLinearMap.norm_id_le] -- rw [← rep_g_eq_a] -- grw [GRepW_norm_le] -- norm_num -- -- Bornology.isBounded_image_subtype_val -- . exact isembedding_units_val -+ have my_new_range_compact : CompactSpace my_new_range.topologicalClosure := -+ rho_continuous_range_compact - - - have continuous_new_map_entry: Continuous new_map_entry := by - simp [new_map_entry] - rw [Units.continuous_iff] - refine ⟨?_, ?_⟩ -- . fun_prop -- . fun_prop -+ · fun_prop -+ · fun_prop - - - have compact_mapped_group: CompactSpace mapped_group := by -@@ -456,169 +335,42 @@ lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Su - let data := theorem_3_8_real (H := mapped_group) compact_mapped_group ((Subgroup.map new_map_hom.toMonoidHom my_new_range).subgroupOf mapped_group) ?_ (final_data) - obtain ⟨B, B_abelian, B_finite_index⟩ := data - -- let reverse_hom: ((map new_map_hom.toMonoidHom my_new_range).subgroupOf mapped_group) →* (GRepW_base).range := { -- toFun := fun g => ( -- ((⟨Units.map (ContinuousLinearMap.toLinearMapRingHom.toMonoidHom) (new_map_hom.symm g.val), by ( -- simp -- have g_prop := g.property -- rw [Subgroup.mem_subgroupOf] at g_prop -- rw [Subgroup.mem_map] at g_prop -- obtain ⟨x, x_mem, g_eq⟩ := g_prop -- simp [my_new_range] at x_mem -- obtain ⟨a, ha⟩ := x_mem -- use a -- ext f -- simp -- apply_fun (fun h => Units.map (ContinuousLinearMap.toLinearMapRingHom.toMonoidHom) h) at ha -- simp [GRepW] at ha -- rw [ha] -- simp [new_map_hom, new_map_entry_inv] -- rw [← g_eq] -- simp [new_map_hom, new_map_entry] -- )⟩) : GRepW_base.range) -- ), -- map_one' := by -- simp [map_one] -- map_mul' := by -- intro a b -- apply Subtype.ext -- show (Units.map _) (new_map_hom.symm ↑↑(a * b)) = -- (Units.map _) (new_map_hom.symm ↑↑a) * (Units.map _) (new_map_hom.symm ↑↑b) -- rw [← map_mul (Units.map _), ← map_mul new_map_hom.symm] -- norm_cast -- } -- -- have reverse_hom_ker_bot: reverse_hom.ker = ⊥ := by -+ have hinj : Function.Injective GRepW := by -+ intro x y h -+ apply Units.ext -+ apply LinearMap.ext -+ intro v -+ have hval := congrArg (fun u : (W →L[ℝ] W)ˣ => u.val v) h -+ simpa [GRepW, linearUnitsToContinuous] using hval -+ let e₁ := Subgroup.equivMapOfInjective GRepW_base.range GRepW hinj -+ let e₂ := MulEquiv.subgroupCongr (MonoidHom.map_range GRepW GRepW_base) -+ let e₃ := MulEquiv.subgroupMap new_map_hom my_new_range -+ let e := ((e₁.trans e₂).trans e₃).trans map_sub_equiv -+ let reverse_hom := e.symm.toMonoidHom -+ have reverse_hom_ker_bot : reverse_hom.ker = ⊥ := by - rw [MonoidHom.ker_eq_bot_iff] -- intro a b hab -- simp only [reverse_hom, MonoidHom.coe_mk, OneHom.coe_mk, Subtype.mk.injEq] at hab -- apply Units.map_injective at hab -- . -- replace hab := new_map_hom.symm.injective hab -- exact Subtype.ext (Subtype.ext hab) -- . -- intro a b hab -- simpa using hab -- -- have reverse_hom_range_top: reverse_hom.range = ⊤ := by -- rw [Subgroup.eq_top_iff'] -- intro x -- have x_prop := x.property -- rw [MonoidHom.mem_range] at x_prop -- obtain ⟨g, hg⟩ := x_prop -- have mem_range: plain_linear_to_clm ↑x ∈ my_new_range := by -- refine MonoidHom.mem_range.mpr ⟨g, ?_⟩ -- rw [← hg] -- rfl -- have mem_closure: plain_linear_to_clm ↑x ∈ my_new_range.topologicalClosure := -- Subgroup.le_topologicalClosure my_new_range mem_range -- refine MonoidHom.mem_range.mpr -- ⟨⟨⟨new_map_entry (plain_linear_to_clm ↑x), -- Subgroup.mem_map_of_mem new_map_hom.toMonoidHom mem_closure⟩, ?_⟩, ?_⟩ -- . -- rw [Subgroup.mem_subgroupOf] -- exact Subgroup.mem_map_of_mem new_map_hom.toMonoidHom mem_range -- . -- have hrt : ∀ y, new_map_hom.symm (new_map_entry y) = y := new_map_hom.left_inv -- refine Subtype.ext ?_ -- change (Units.map (ContinuousLinearMap.toLinearMapRingHom (R₁ := ℝ) (M₁ := W)).toMonoidHom) -- (new_map_hom.symm (new_map_entry (plain_linear_to_clm ↑x))) = x.val -- rw [hrt] -- ext f -- rfl -- -+ exact e.symm.injective -+ have reverse_hom_range_top : reverse_hom.range = ⊤ := -+ MonoidHom.range_eq_top.mpr e.symm.surjective - - let B' := Subgroup.map reverse_hom B - use B' - refine ⟨?_, ?_⟩ -- . simp only [B'] -+ · simp only [B'] - apply Subgroup.map_isMulCommutative -- . simp only [B'] -+ · simp only [B'] - rw [Subgroup.finiteIndex_iff] - rw [Subgroup.index_map] - rw [reverse_hom_ker_bot, reverse_hom_range_top, sup_bot_eq, Subgroup.index_top, mul_one] - exact B_finite_index.index_ne_zero -- . -- have base_fg: (map new_map_hom.toMonoidHom my_new_range).FG := by -- apply group_fg_map -- simp [my_new_range] -- have group_fg: Group.FG (GRepW.comp (GRepW_base)).range := by -- apply Group.fg_range -- exact (Group.fg_iff_subgroup_fg (GRepW.comp GRepW_base).range).mp group_fg -- -- have base_le: (map new_map_hom.toMonoidHom my_new_range) ≤ mapped_group := by -- intro a ha -- simp at ha -- simp [mapped_group] -- obtain ⟨g, g_mem, g_eq_a⟩ := ha -- use g -- refine ⟨?_, g_eq_a⟩ -- apply Subgroup.le_topologicalClosure my_new_range g_mem -- -- -- rw [Subgroup.fg_iff] -- rw [Subgroup.fg_iff] at base_fg -- obtain ⟨S, S_eq, S_finite⟩ := base_fg -- -- have S_in_map: ∀ s ∈ S, s ∈ (map new_map_hom.toMonoidHom my_new_range) := by -- rw [Subgroup.ext_iff] at S_eq -- intro s hs -- apply (S_eq s).mp ?_ -- exact Subgroup.mem_closure.mpr fun K a ↦ a hs -- -- let S' := Set.range (fun (s: S) => (⟨s.val, base_le (S_in_map s s.property)⟩ : mapped_group)) -- use S' -- -- TODO - this is a huge mess. This can be a general proof about the closure of Subgroup.subgroupOf -- refine ⟨?_, ?_⟩ -- . -- simp only [S'] -- rw [← S_eq] -- ext a -- refine ⟨?_, ?_⟩ -- . intro ha -- rw [Subgroup.mem_subgroupOf] -- induction ha using Subgroup.closure_induction_left with -- | one => simp -- | mul_left y hy z hz h_other_z => -- simp -- apply Subgroup.mul_mem -- . simp at hy -- obtain ⟨p, p_mem, p_eq_y⟩ := hy -- rw [← p_eq_y] -- simp -- apply Subgroup.mem_closure_of_mem p_mem -- . exact h_other_z -- | inv_mul_cancel y hy z hz h_other_z => -- simp -- apply Subgroup.mul_mem -- . simp -- simp at hy -- obtain ⟨p, p_mem, p_eq_y⟩ := hy -- rw [← p_eq_y] -- simp -- apply Subgroup.mem_closure_of_mem p_mem -- . exact h_other_z -- . intro ha -- rw [Subgroup.mem_subgroupOf] at ha -- rw [Subgroup.mem_closure] -- intro K hK -- rw [Subgroup.mem_closure] at ha -- have a_mem := ha (Subgroup.map mapped_group.subtype K) ?_ -- . simpa using a_mem -- . simp -- intro s hs -- rw [Set.range_subset_iff] at hK -- have s_mem := hK ⟨s, hs⟩ -- simp -- simp at s_mem -- use ?_ -- apply base_le (S_in_map s hs) -- . -- simp [S'] -- rw [← Set.finite_coe_iff] at S_finite -- apply Set.finite_range -+ · let : Group.FG my_new_range := Group.fg_range (GRepW.comp GRepW_base) -+ let : Group.FG (Subgroup.map new_map_hom.toMonoidHom my_new_range) := -+ Group.fg_of_surjective (f := (MulEquiv.subgroupMap new_map_hom my_new_range).toMonoidHom) -+ (MulEquiv.subgroupMap new_map_hom my_new_range).surjective -+ let : Group.FG ((Subgroup.map new_map_hom.toMonoidHom my_new_range).subgroupOf mapped_group) := -+ Group.fg_of_surjective (f := map_sub_equiv.toMonoidHom) map_sub_equiv.surjective -+ exact (Group.fg_iff_subgroup_fg _).mp inferInstance - ---- We need this to work with Finset - - structure Theorem3_1_Input (G: Type*) [Group G] where - -- A finite index subgroup G' of G -@@ -629,15 +381,7 @@ structure Theorem3_1_Input (G: Type*) [Group G] where - hφ: Function.Surjective φ - - --#synth Group.FG (rho_g) -- -- - lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.FiniteIndex) (hom: A →* T) (hom_surjective: Function.Surjective hom) (H: Subgroup T) (H_infinite: Infinite H) (H_abeliean: IsMulCommutative H) (H_finite_index: H.FiniteIndex) (H_FG: Group.FG H): Nonempty (Theorem3_1_Input G) := by -- -- TODO - generalize this to a lemma: finite-index subgroup of an infinite group is infinite -- -- and upstream to mathlib -- -- -- -- TODO - figure out how to make instance inference work here - obtain ⟨i, j, i_fin, j_fin, p, p_prime, e, exists_iso⟩ := @CommGroup.equiv_free_prod_prod_multiplicative_zmod H (haveI := H_abeliean; { (inferInstance : Group H) with mul_comm := mul_comm' }) (H_FG) - have iso := Classical.choice exists_iso - -@@ -661,8 +405,6 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini - apply Finite.instProd - have no_finite := H_infinite.not_finite - contradiction -- -- -- TODO - can we get the comp '∘' syntax to give us a monoid hom, instead of a plain function? - let h_to_z := (Pi.evalMonoidHom _ (Classical.choice (by - exact j_nonempty - ))).comp ((MonoidHom.fst _ _).comp iso.toMonoidHom) -@@ -671,19 +413,17 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini - unfold h_to_z - simp - apply Function.Surjective.comp -- . -+ · - intro x - simp - use fun _ => x -- . apply Function.Surjective.comp -- . exact Prod.fst_surjective -- . exact iso.surjective -+ · apply Function.Surjective.comp -+ · exact Prod.fst_surjective -+ · exact iso.surjective - - - let G' := Subgroup.comap hom H - -- -- TODO - generalize this and PR to mathlib -- - - have G'_finite_index: G'.FiniteIndex := by - unfold G' -@@ -691,15 +431,10 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini - index_ne_zero := by - simp - rw [Subgroup.index_comap] -- -- apply somehow found this - how does it work??? - exact Subgroup.FiniteIndex.index_ne_zero - } -- -- -- -- TODO - there must be an easier way to do this - let g'_to_h: (map A.subtype G') →* H := { - toFun := fun g => ⟨hom ⟨g.val, by ( -- -- TODO - clean this up - have foo := g.property - rw [Subgroup.mem_map] at foo - obtain ⟨x, hx, a_subtype⟩ := foo -@@ -707,7 +442,7 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini - simp - )⟩, by ( - have g_prop := g.property -- simp only [G', Subgroup.mem_comap] at g_prop -+ simp only [G'] at g_prop - rw [Subgroup.mem_map] at g_prop - obtain ⟨x, hx, a_subtype⟩ := g_prop - simp_rw [← a_subtype] -@@ -748,18 +483,18 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini - rw [Subgroup.finiteIndex_iff] - simp [Subgroup.index_map_subtype] - refine ⟨?_, ?_⟩ -- . rw [← ne_eq] -+ · rw [← ne_eq] - rw [← Subgroup.finiteIndex_iff] - exact G'_finite_index -- . exact A_finite_index.index_ne_zero -+ · exact A_finite_index.index_ne_zero - -- G'_finite_index - φ := g_to_z, - hφ := by - simp [g_to_z, g_to_additive_z] - apply Function.Surjective.comp -- . simp [additive_h_to_z] -+ · simp [additive_h_to_z] - exact h_to_z_surjective -- . -+ · - simp [additive_g'_to_h, g'_to_h] - intro h - obtain ⟨a, hom_a⟩ := hom_surjective h -@@ -769,7 +504,6 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini - simp [G', hom_a] - } - --#print axioms g_hom_abelian - - -- Case 1 in Section 3.3 of Vikman, where the representation ρ(G) is infinite - lemma rho_g_case_infinite {d: ℕ} (hd: HasPolynomialGrowthD S d) (hr: Infinite (↥(rho_g))): Nonempty (Theorem3_1_Input G) := by -@@ -785,11 +519,11 @@ lemma rho_g_case_infinite {d: ℕ} (hd: HasPolynomialGrowthD S d) (hr: Infinite - - - have target := g_hom_abelian ⊤ (by infer_instance) (g_rho) ?_ (H) ?_ ?_ ?_ ?_ -- . exact target -- . -+ · exact target -+ · - simp [g_rho] - exact MonoidHom.rangeRestrict_surjective GRepW_base -- . -+ · - unfold rho_g at hr - have card_mul := Subgroup.card_mul_index H - unfold rho_g at card_mul -@@ -798,10 +532,9 @@ lemma rho_g_case_infinite {d: ℕ} (hd: HasPolynomialGrowthD S d) (hr: Infinite - replace card_mul := card_mul.resolve_right H_finite_index.index_ne_zero - rw [Nat.card_eq_zero] at card_mul - exact card_mul.resolve_left (fun h => h.false ⟨1, H.one_mem⟩) -- . exact H_abelian -- . exact H_finite_index -- . exact h_fg -+ · exact H_abelian -+ · exact H_finite_index -+ · exact h_fg - --#print axioms rho_g_case_infinite - - end GeneratesNS -diff --git a/Gromov/Theorem31Input.lean b/Gromov/Theorem31Input.lean -index 22f01cc..81b7985 100644 ---- a/Gromov/Theorem31Input.lean -+++ b/Gromov/Theorem31Input.lean -@@ -11,9 +11,6 @@ The finite-image case `rho_g_case_finite` and `exists_theorem_3_1_input`. - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false - - open Subgroup - open scoped Finset -@@ -28,24 +25,12 @@ include hGS - - open scoped RealInnerProductSpace - --set_option synthInstance.maxHeartbeats 500000 - --set_option maxHeartbeats 9000000 - - open MeasureTheory - - open MeasureTheory - ---- TODO - figure out why we need these -- -- --#print axioms laplace_bounded --#print axioms laplace_self_adjoint --#print axioms laplace_positive_semidefinite -- -- --#synth Module ℝ (Lp ℝ 2 (μ := MeasureTheory.volume (α := G))) -- - - omit hGS in - lemma rangeRestrict_range {A B: Type*} [Group A] [Group B] (f: A →* B): f.rangeRestrict.range = ⊤ := by -@@ -99,8 +84,6 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - simp [lambda_g] - rw [mul_sub] - } -- -- -- TODO - this could be much cleaner - have act_eq_lambda (g: G) (hg: g ∈ (GRepW_base).ker) (f: LipschitzH ): (gAct g f) = f + ConstLipschitzH (lambda_g ⟨g, hg⟩ f) := by - have act := act_v g hg f - simp [GRep, gAct, ConstF] at act -@@ -116,8 +99,8 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - apply eq_add_of_sub_eq at app_a - rw [app_a] - rw [add_comm] -- simp [LipschitzH_apply] -- simp [LipschitzH_apply] at hy -+ simp -+ simp at hy - have other_app := congrFun hy 1 - simp at other_app - rw [← other_app] -@@ -152,24 +135,23 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - } - - by_cases lambda_g_infinite: Infinite (lambda_g_hom.range) -- . -+ · - - apply g_hom_abelian G' ?_ lambda_g_hom.rangeRestrict ?_ lambda_g_hom.rangeRestrict.range ?_ ?_ ?_ ?_ -- . simp [G'] -+ · simp [G'] - exact ker_finite_index -- . exact MonoidHom.rangeRestrict_surjective lambda_g_hom -- . rw [rangeRestrict_range] -+ · exact MonoidHom.rangeRestrict_surjective lambda_g_hom -+ · rw [rangeRestrict_range] - simp -- -- TODO: PR this to mathlib - apply (Equiv.infinite_iff (α := lambda_g_hom.range) _).mp -- . exact lambda_g_infinite -- . exact { -+ · exact lambda_g_infinite -+ · exact { - toFun := fun g => ⟨g, trivial⟩ - invFun := fun g => g.val - left_inv := by simp [Function.LeftInverse] - right_inv := by simp [Function.RightInverse, Function.LeftInverse] - } -- . exact { -+ · exact { - is_comm := { - comm := by - intro a b -@@ -178,18 +160,16 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - rw [add_comm] - } - } -- . rw [Subgroup.finiteIndex_iff] -+ · rw [Subgroup.finiteIndex_iff] - rw [rangeRestrict_range] - simp -- . rw [rangeRestrict_range] -+ · rw [rangeRestrict_range] - simp - exact Group.FG.out -- . -+ · - simp only [not_infinite_iff_finite] at lambda_g_infinite - let G'' := lambda_g_hom.ker - have G''_finite_index := Subgroup.finiteIndex_ker lambda_g_hom -- -- -- TODO - this could be a lot cleaner - have G''_act_v (g: lambda_g_hom.ker) (x: G) (f: LipschitzH ): f (x * g) = f x := by - specialize act_v g - simp at act_v -@@ -224,8 +204,6 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - - -- View G'' as a subgroup of G - let G''_subgroup_G := (Subgroup.map G'.subtype lambda_g_hom.ker) -- -- -- TODO - clean up this proof - have G''_subgroup_finite_index: G''_subgroup_G.FiniteIndex := by - unfold G''_subgroup_G - rw [Subgroup.finiteIndex_iff] -@@ -244,7 +222,7 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - have f_range_eq (f: LipschitzH ): Set.range f = Set.range ((fun (x: G ⧸ G''_subgroup_G) => f (x.out))) := by - ext a - refine ⟨?_, ?_⟩ -- . intro ha -+ · intro ha - simp at ha - obtain ⟨y, hy⟩ := ha - have y_mem: y ∈ Set.univ := by simp -@@ -270,7 +248,7 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - use i - rw [← f_translate] - exact hy -- . intro ha -+ · intro ha - simp only [Set.mem_range] at ha - obtain ⟨y, hy⟩ := ha - simp -@@ -287,16 +265,16 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - simp at hp - obtain ⟨y, hy⟩ := hp - by_cases p_le_z: ‖p‖ ≤ ‖z‖ -- . exact p_le_z -- . simp at p_le_z -+ · exact p_le_z -+ · simp at p_le_z - - have f_le := hz (j := f.toFun y) ?_ ?_ -- . -+ · - simp at f_le - rw [← hy] - exact f_le -- . simp -- . simp -+ · simp -+ · simp - rw [← hy] at p_le_z - linarith - -@@ -326,22 +304,19 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) - have app := congrFun f_const_fn a - rw [app] - simp [ConstLipschitzH] -- . -+ · - rw [f_range_eq] - apply Set.finite_range -- . apply Set.range_nonempty -+ · apply Set.range_nonempty - - obtain ⟨f, nontrivial_f⟩ := exists_nontrivial_harmonic - obtain ⟨z, f_eq_const⟩ := all_f_const f - specialize nontrivial_f z - contradiction -- -- ---- TODO - upstream to mathlib - omit hGS in - lemma exists_theorem_3_1_input [hGS: Generates ] {d: ℕ} (hd: HasPolynomialGrowthD S d): Nonempty (Theorem3_1_Input G) := by - by_cases rho_g_infinite: Infinite (↥(rho_g)) -- . exact rho_g_case_infinite hd rho_g_infinite -- . exact rho_g_case_finite (by simpa using rho_g_infinite) -+ · exact rho_g_case_infinite hd rho_g_infinite -+ · exact rho_g_case_finite (by simpa using rho_g_infinite) - - end GeneratesNS -diff --git a/Gromov/Theorem323.lean b/Gromov/Theorem323.lean -index 0e1604a..8741f01 100644 ---- a/Gromov/Theorem323.lean -+++ b/Gromov/Theorem323.lean -@@ -9,17 +9,10 @@ public import Gromov.BoundedDoubling - `theorem_3_23` and the resulting finite-dimensionality of the space of Lipschitz harmonic - functions. - --Root of the Theorem 3.23 hierarchy: importing it pulls in the cutoff inequality, the quadratic --form, the packing argument and the Poincaré inequality. - -/ - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -30,7 +23,186 @@ open Generates - variable [hGS: Generates] - include hGS - --set_option maxHeartbeats 2500000 in -+private lemma scale_contraction_bound (d w : ℕ) -+ (hw : w = ⌈Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d))⌉₊) : -+ GeneratesNS.C * Real.exp (a d * 2) ^ 2 * (16 ^ (-↑w : ℝ)) ^ 2 * ↑(#S) -+ * 16 ≤ 2⁻¹ := by -+ have ha : (0:ℝ) ≤ a d := by simp only [a]; positivity -+ have hE1 : (1:ℝ) ≤ Real.exp (a d) := Real.one_le_exp ha -+ have hE4 : (1:ℝ) ≤ Real.exp (a d) ^ 4 := one_le_pow₀ hE1 -+ have hEpos : (0:ℝ) < Real.exp (a d) := Real.exp_pos _ -+ have he4 : Real.exp (4 * a d) = Real.exp (a d) ^ 4 := by -+ rw [← Real.exp_nat_mul]; norm_num -+ have he2 : Real.exp (a d * 2) = Real.exp (a d) ^ 2 := by -+ rw [show a d * 2 = 2 * a d from by ring, ← Real.exp_nat_mul]; norm_num -+ have he2sq : Real.exp (a d * 2) ^ 2 = Real.exp (a d) ^ 4 := by -+ rw [he2]; ring -+ have hS0 : (0:ℝ) < ↑(#S) := by exact_mod_cast Finset.card_pos.mpr S_nonempty -+ have hXpos : (0:ℝ) < 16 ^ 4 * ↑(#S) * Real.exp (a d) ^ 4 := by positivity -+ have h16w : (16:ℝ) ^ 4 * ↑(#S) * Real.exp (a d) ^ 4 ≤ (16:ℝ) ^ (↑w : ℝ) := by -+ rw [← he4] -+ have hlog : (16:ℝ) ^ Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d)) -+ = 16 ^ 4 * ↑(#S) * Real.exp (4 * a d) := -+ Real.rpow_logb (by norm_num) (by norm_num) (by rw [he4]; exact hXpos) -+ have hle : Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d)) ≤ (↑w : ℝ) := by -+ have hdef : w = ⌈Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d))⌉₊ := hw -+ rw [hdef]; exact_mod_cast Nat.le_ceil _ -+ calc 16 ^ 4 * ↑(#S) * Real.exp (4 * a d) -+ = (16:ℝ) ^ Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d)) := hlog.symm -+ _ ≤ (16:ℝ) ^ (↑w : ℝ) := Real.rpow_le_rpow_of_exponent_le (by norm_num) hle -+ have ht0 : (0:ℝ) ≤ (16:ℝ) ^ (-↑w : ℝ) := Real.rpow_nonneg (by norm_num) _ -+ have htX : (16:ℝ) ^ (-↑w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a d) ^ 4) ≤ 1 := by -+ calc (16:ℝ) ^ (-↑w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a d) ^ 4) -+ ≤ (16:ℝ) ^ (-↑w : ℝ) * (16:ℝ) ^ (↑w : ℝ) := -+ mul_le_mul_of_nonneg_left h16w ht0 -+ _ = 1 := by rw [← Real.rpow_add (by norm_num)]; simp -+ have hsq : ((16:ℝ) ^ (-↑w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a d) ^ 4)) ^ 2 ≤ 1 := by -+ nlinarith [htX, mul_nonneg ht0 (le_of_lt hXpos)] -+ have hM8 : (0:ℝ) ≤ ((16:ℝ) ^ (-↑w : ℝ)) ^ 2 * (↑(#S)) ^ 2 * Real.exp (a d) ^ 4 * 16 ^ 8 := by -+ positivity -+ have hP : ((16:ℝ) ^ (-↑w : ℝ)) ^ 2 * (↑(#S)) ^ 2 * Real.exp (a d) ^ 4 * 16 ^ 8 ≤ 1 := by -+ nlinarith [hsq, hE4, hM8] -+ have key : GeneratesNS.C * Real.exp (a d * 2) ^ 2 * (16 ^ (-↑w : ℝ)) ^ 2 * ↑(#S) -+ * 16 ≤ 2⁻¹ := by -+ rw [he2sq]; simp only [GeneratesNS.C] -+ nlinarith [hP, hM8] -+ exact key -+ -+private lemma phi_restrict_injective [v_data : V_Wrapper] -+ (data : GoodScalesData (V_basis v_data.V)) -+ (hw : data.w = ⌈Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d))⌉₊) -+ (U : Submodule ℝ LipschitzH) -+ (bounded_double : ∀ f ∈ U, Q_R (16 * R_2 data) f f ≤ -+ Real.exp (2 * a data.d) * Q_R (R_2 data) f f) : -+ Function.Injective ((phi data).domRestrict (U.submoduleOf v_data.V)) := by -+ -- Pinning the module types keeps this rewrite out of the instance diamond on -+ -- `↥(U.submoduleOf _)` (`Submodule…addCommMonoid` vs `AddCommGroup.toAddCommMonoid`), -+ -- which otherwise only reconciles at a raised `maxSynthPendingDepth`. -+ rw [← LinearMap.ker_eq_bot (M := ↥(U.submoduleOf v_data.V)) -+ (M₂ := EuclideanSpace ℝ ↥(B_finsets data))] -+ rw [LinearMap.ker_eq_bot' (M := ↥(U.submoduleOf v_data.V)) -+ (M₂ := EuclideanSpace ℝ ↥(B_finsets data))] -+ intro u hu -+ -+ have u_le := lemma_3_26_a data u -+ simp at hu -+ simp [hu] at u_le -+ -+ have u_bound := harmonic_r2_inequality u (by -+ have u_prop := u.val.val.harmonic -+ simp [Harmonic] at u_prop -+ simp [Laplace_b] -+ ext a -+ simp -+ nth_rw 1 [u_prop] -+ simp [f_conv_mu] -+ ) (4 * R_2 data) (by simp [R_2]) -+ simp [B_r] at u_le -+ conv at u_bound => -+ lhs -+ arg 1 -+ equals (Metric.closedBall 1 (8 * (R_2 data))).toFinset => -+ simp -+ ring_nf -+ -+ grw [u_bound] at u_le -+ · -+ have u_double := bounded_double u (by -+ exact u.prop -+ ) -+ conv at u_double => -+ lhs -+ simp [Q_R] -+ -+ simp_rw [← pow_two] at u_double -+ grw [Finset.sum_le_sum_of_subset_of_nonneg (t := (finite_closed_ball 1 (16 * (R_2 data))).toFinset)] at u_le -+ · -+ simp at u_le -+ grw [u_double] at u_le -+ · -+ by_cases u_zero: u = 0 -+ · exact u_zero -+ · -+ have r_pos := R'_pos v_data.V -+ have r_ratio_le: (R_1 data + 1) / (4 * R_2 data) ≤ 4 * ((16: ℝ) ^ (-(data.w : ℝ))) := by -+ simp [R_1, R_2] -+ field_simp -+ have i_diff := (GoodScales data).i_diff_mem -+ simp at i_diff -+ have one_le: (1: ℝ) ≤ 2*(16^((GoodScales data).i_1)) := by -+ apply one_le_mul_of_one_le_of_one_le -+ · simp -+ · rw [one_le_pow_iff_of_nonneg] -+ · simp -+ · simp -+ · simp -+ have h_i := (GoodScales data).i_1_pos -+ grind -+ grw [one_le] -+ rw [← mul_add] -+ rw [← two_mul] -+ ring_nf -+ rw [← pow_add] -+ apply mul_le_mul -+ · -+ rw [pow_le_pow_iff_right₀] -+ · grind -+ · simp -+ · norm_num -+ · simp -+ · simp -+ -+ conv at u_le => -+ rhs -+ equals GeneratesNS.C * Real.exp (2 * a data.d) * (((↑(R_1 data) + 1) / ((↑(4 * R_2 data : ℝ))))^2 * ↑(#S) * (Real.exp (2 * a data.d) * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val)) => -+ ring -+ -+ grw [r_ratio_le] at u_le -+ ring_nf at u_le -+ · -+ have le_half: Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val ≤ (2: ℝ)⁻¹ * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by -+ have qr_nonneg : 0 ≤ Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := -+ Q_R_self_nonneg _ _ -+ have key := scale_contraction_bound data.d data.w hw -+ calc Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val -+ ≤ (GeneratesNS.C * Real.exp (a data.d * 2) ^ 2 * (16 ^ (-↑data.w : ℝ)) ^ 2 * ↑(#S) -+ * 16) * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by nlinarith [u_le] -+ _ ≤ 2⁻¹ * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by nlinarith [key, qr_nonneg] -+ -+ have Q_r_zero: Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val = 0 := by -+ by_contra! -+ rw [mul_comm] at le_half -+ have foo := one_le_of_le_mul_left₀ (by -+ have nonneg: 0 ≤ Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := -+ Q_R_self_nonneg _ _ -+ grind -+ ) le_half -+ norm_num at foo -+ -+ rw [← Submodule.coe_eq_zero] -+ by_contra hne -+ exact absurd Q_r_zero (ne_of_gt (Q_R_pos_on_R' (↑u) hne _ (R'_le_R_2 data))) -+ · apply mul_nonneg (by positivity) -+ exact Q_R_self_nonneg _ _ -+ · simp [GeneratesNS.C] -+ positivity -+ -+ · simp [GeneratesNS.C] -+ positivity -+ · -+ simp [GeneratesNS.C] -+ positivity -+ · intro a ha -+ simp -+ simp at ha -+ grind -+ · intro i hi _ -+ positivity -+ · -+ simp [GeneratesNS.C] -+ positivity -+ -+ - lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, growth_bound (V_basis v_data.V) d → (Module.finrank ℝ v_data.V) < C := by - let w := ⌈Real.logb 16 ((16^4) * #(S) * Real.exp (4 * a (d)))⌉₊ - let C: ℕ := 1 + (⌈2 * Real.exp (w * (a d))⌉₊) -@@ -43,16 +215,16 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow - hw := by - simp - apply Real.logb_pos -- . simp -- . apply one_lt_mul -- . -+ · simp -+ · apply one_lt_mul -+ · - have card_s: 1 ≤ #(S) := by - simp - apply S_nonempty - grw [← card_s] - simp - norm_num -- . -+ · - norm_num - simp [a] - positivity -@@ -61,16 +233,16 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow - rw [Nat.lt_ceil] - simp - rw [Real.lt_logb_iff_rpow_lt] -- . -+ · - have mul_pos: 1 < ↑(#S) * Real.exp (4 * a d) := by - apply one_lt_mul -- . simp -+ · simp - apply S_nonempty -- . simp [a] -+ · simp [a] - positivity - linarith -- . simp -- . have S_ne: #(S) ≠ 0 := by -+ · simp -+ · have S_ne: #(S) ≠ 0 := by - have foo := S_card_ne_zero_re - simpa using foo - positivity -@@ -80,172 +252,7 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow - obtain ⟨U, U_sub_v, hU_dim, bounded_double⟩ := exists_bounded_doubling_subspace data - - let phi_u := (phi data).domRestrict (U.submoduleOf v_data.V) -- have phi_u_inj: Function.Injective phi_u := by -- -- Pinning the module types keeps this rewrite out of the instance diamond on -- -- `↥(U.submoduleOf _)` (`Submodule…addCommMonoid` vs `AddCommGroup.toAddCommMonoid`), -- -- which otherwise only reconciles at a raised `maxSynthPendingDepth`. -- rw [← LinearMap.ker_eq_bot (M := ↥(U.submoduleOf v_data.V)) -- (M₂ := EuclideanSpace ℝ ↥(B_finsets data))] -- rw [LinearMap.ker_eq_bot' (M := ↥(U.submoduleOf v_data.V)) -- (M₂ := EuclideanSpace ℝ ↥(B_finsets data))] -- intro u hu -- -- have u_le := lemma_3_26_a data u -- simp [phi_u] at hu -- simp [hu] at u_le -- -- have u_bound := harmonic_r2_inequality u (by -- have u_prop := u.val.val.harmonic -- simp [Harmonic] at u_prop -- simp [Laplace_b] -- ext a -- simp -- nth_rw 1 [u_prop] -- simp [f_conv_mu] -- ) (4 * R_2 data) (by simp [R_2]) -- simp [B_r] at u_le -- conv at u_bound => -- lhs -- arg 1 -- equals (Metric.closedBall 1 (8 * (R_2 data))).toFinset => -- simp -- ring -- -- grw [u_bound] at u_le -- . -- have u_double := bounded_double u (by -- exact u.prop -- ) -- conv at u_double => -- lhs -- simp [Q_R] -- -- simp_rw [← pow_two] at u_double -- grw [Finset.sum_le_sum_of_subset_of_nonneg (t := (finite_closed_ball 1 (16 * (R_2 data))).toFinset)] at u_le -- . -- simp [finite_closed_ball] at u_le -- grw [u_double] at u_le -- . -- by_cases u_zero: u = 0 -- . exact u_zero -- . -- have r_pos := R'_pos v_data.V -- have r_ratio_le: (R_1 data + 1) / (4 * R_2 data) ≤ 4 * ((16: ℝ) ^ (-(data.w : ℝ))) := by -- simp [R_1, R_2] -- field_simp -- have i_diff := (GoodScales data).i_diff_mem -- simp at i_diff -- have one_le: (1: ℝ) ≤ 2*(16^((GoodScales data).i_1)) := by -- norm_num -- apply one_le_mul_of_one_le_of_one_le -- . simp -- . rw [one_le_pow_iff_of_nonneg] -- . simp -- . simp -- . simp -- have h_i := (GoodScales data).i_1_pos -- grind -- grw [one_le] -- rw [← mul_add] -- rw [← two_mul] -- ring -- rw [← pow_add] -- apply mul_le_mul -- . -- rw [pow_le_pow_iff_right₀] -- . grind -- . simp -- . norm_num -- . simp -- . simp -- -- conv at u_le => -- rhs -- equals GeneratesNS.C * Real.exp (2 * a data.d) * (((↑(R_1 data) + 1) / ((↑(4 * R_2 data : ℝ))))^2 * ↑(#S) * (Real.exp (2 * a data.d) * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val)) => -- ring -- -- grw [r_ratio_le] at u_le -- ring_nf at u_le -- . -- have le_half: Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val ≤ (2: ℝ)⁻¹ * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by -- have qr_nonneg : 0 ≤ Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := -- Q_R_self_nonneg _ _ -- have ha : (0:ℝ) ≤ a data.d := by simp only [a]; positivity -- have hE1 : (1:ℝ) ≤ Real.exp (a data.d) := Real.one_le_exp ha -- have hE4 : (1:ℝ) ≤ Real.exp (a data.d) ^ 4 := one_le_pow₀ hE1 -- have hEpos : (0:ℝ) < Real.exp (a data.d) := Real.exp_pos _ -- have he4 : Real.exp (4 * a data.d) = Real.exp (a data.d) ^ 4 := by -- rw [← Real.exp_nat_mul]; norm_num -- have he2 : Real.exp (a data.d * 2) = Real.exp (a data.d) ^ 2 := by -- rw [show a data.d * 2 = 2 * a data.d from by ring, ← Real.exp_nat_mul]; norm_num -- have he2sq : Real.exp (a data.d * 2) ^ 2 = Real.exp (a data.d) ^ 4 := by -- rw [he2]; ring -- have hS0 : (0:ℝ) < ↑(#S) := by exact_mod_cast Finset.card_pos.mpr S_nonempty -- have hXpos : (0:ℝ) < 16 ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4 := by positivity -- have h16w : (16:ℝ) ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4 ≤ (16:ℝ) ^ (↑data.w : ℝ) := by -- rw [← he4] -- have hlog : (16:ℝ) ^ Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d)) -- = 16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d) := -- Real.rpow_logb (by norm_num) (by norm_num) (by rw [he4]; exact hXpos) -- have hle : Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d)) ≤ (↑data.w : ℝ) := by -- have hdef : data.w = ⌈Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d))⌉₊ := rfl -- rw [hdef]; exact_mod_cast Nat.le_ceil _ -- calc 16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d) -- = (16:ℝ) ^ Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d)) := hlog.symm -- _ ≤ (16:ℝ) ^ (↑data.w : ℝ) := Real.rpow_le_rpow_of_exponent_le (by norm_num) hle -- have ht0 : (0:ℝ) ≤ (16:ℝ) ^ (-↑data.w : ℝ) := Real.rpow_nonneg (by norm_num) _ -- have htX : (16:ℝ) ^ (-↑data.w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4) ≤ 1 := by -- calc (16:ℝ) ^ (-↑data.w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4) -- ≤ (16:ℝ) ^ (-↑data.w : ℝ) * (16:ℝ) ^ (↑data.w : ℝ) := -- mul_le_mul_of_nonneg_left h16w ht0 -- _ = 1 := by rw [← Real.rpow_add (by norm_num)]; simp -- have hsq : ((16:ℝ) ^ (-↑data.w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4)) ^ 2 ≤ 1 := by -- nlinarith [htX, mul_nonneg ht0 (le_of_lt hXpos)] -- have hM8 : (0:ℝ) ≤ ((16:ℝ) ^ (-↑data.w : ℝ)) ^ 2 * (↑(#S)) ^ 2 * Real.exp (a data.d) ^ 4 * 16 ^ 8 := by -- positivity -- have hP : ((16:ℝ) ^ (-↑data.w : ℝ)) ^ 2 * (↑(#S)) ^ 2 * Real.exp (a data.d) ^ 4 * 16 ^ 8 ≤ 1 := by -- nlinarith [hsq, hE4, hM8] -- have key : GeneratesNS.C * Real.exp (a data.d * 2) ^ 2 * (16 ^ (-↑data.w : ℝ)) ^ 2 * ↑(#S) -- * 16 ≤ 2⁻¹ := by -- rw [he2sq]; simp only [GeneratesNS.C] -- nlinarith [hP, hM8] -- calc Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val -- ≤ (GeneratesNS.C * Real.exp (a data.d * 2) ^ 2 * (16 ^ (-↑data.w : ℝ)) ^ 2 * ↑(#S) -- * 16) * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by nlinarith [u_le] -- _ ≤ 2⁻¹ * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by nlinarith [key, qr_nonneg] -- -- have Q_r_zero: Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val = 0 := by -- by_contra! -- rw [mul_comm] at le_half -- have foo := one_le_of_le_mul_left₀ (by -- have nonneg: 0 ≤ Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := -- Q_R_self_nonneg _ _ -- grind -- ) le_half -- norm_num at foo -- -- rw [← Submodule.coe_eq_zero] -- by_contra hne -- exact absurd Q_r_zero (ne_of_gt (Q_R_pos_on_R' (↑u) hne _ (R'_le_R_2 data))) -- . apply mul_nonneg (by positivity) -- exact Q_R_self_nonneg _ _ -- . simp [GeneratesNS.C] -- positivity -- -- . simp [GeneratesNS.C] -- positivity -- . -- simp [GeneratesNS.C] -- positivity -- . intro a ha -- simp -- simp at ha -- grind -- . intro i hi _ -- positivity -- . -- simp [GeneratesNS.C] -- positivity -+ have phi_u_inj : Function.Injective phi_u := phi_restrict_injective data rfl U bounded_double - - apply LinearMap.finrank_le_finrank_of_injective at phi_u_inj - simp at phi_u_inj -@@ -270,7 +277,7 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow - have hB : (B_finite data).toFinset - = Finset.image (fun a => Metric.closedBall a (↑(R_1 data):ℝ)) (X_j_finite data).toFinset := by - ext s -- simp only [Set.Finite.mem_toFinset, B, Set.mem_image, Finset.mem_image, Finset.mem_coe] -+ simp only [Set.Finite.mem_toFinset, B, Set.mem_image, Finset.mem_image] - rw [hB, B_finsets, Finset.card_image_of_injOn (hinj1.mono hcoe.le), - Finset.card_image_of_injOn (hinj2.mono hcoe.le)] - rw [← card_eq] -@@ -282,14 +289,11 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow - equals 0 + 2 * Real.exp (↑data.w * a data.d) => - simp - apply add_le_add -- . simp -- . apply Nat.le_ceil -+ · simp -+ · apply Nat.le_ceil - - open scoped Topology -- ---- TODO - do we really need the double by_contra here? - -- Theorem 3.19 --set_option maxHeartbeats 2500000 in - @[expose] - instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - classical -@@ -314,14 +318,14 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - V_finite := by infer_instance - V_even := by - rw [finrank_span_finset_eq_card] -- . -+ · - simp [fin_basis] - rw [Finset.card_image_of_injective] -- . grind -- . -+ · grind -+ · - - exact Module.Basis.injective B -- . -+ · - simp [fin_basis] - apply LinearIndepOn.id_image - exact Module.Basis.linearIndepOn B ↑fin_basis_idx -@@ -340,7 +344,7 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - -- `large_v.V` does not reduce on its own inside `rw`, so name the (definitional) equation. - have large_v_V: large_v.V = Submodule.span ℝ fin_basis := rfl - specialize V_bound large_v ?_ -- . -+ · - simp [growth_bound, my_expr] - - norm_cast -@@ -363,7 +367,7 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - equals (𝓝[>] (0 * 0)) => simp - - apply Filter.TendstoNhdsWithinIoi.mul (by simp) (by simp) -- . -+ · - unfold HasPolynomialGrowthD at hd - obtain ⟨a, s_growth⟩ := hd - simp -@@ -371,12 +375,11 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - rw [← Filter.tendsto_add_atTop_iff_nat R''] - -- Filter.tendsto_add_atTop_iff_nat - apply squeeze_zero_nhdsGT (g := (fun (R: ℕ) => (det_bound_const (V_basis large_v.V) * (1 + (R + R'')) ^ 2 * ((a * (R + R'')^d : ℝ))) / ((R + R'') ^ (↑d + 3) : ℝ))) -- . -+ · - rw [Filter.eventually_atTop] - use 1 - intro R R_pos - have det_pos := (Q_R_matrix_pos_def (V_basis large_v.V) (R + R'') (by -- -- TODO - why is this so messy? - simp [R''] - norm_cast - have foo := Nat.le_ceil (a := R'_ large_v.V) -@@ -386,7 +389,7 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - )).det_pos - norm_cast at det_pos - positivity -- . -+ · - apply Filter.Eventually.of_forall - intro R - have foo := det_bound (V_basis large_v.V) (R := R + R'') (by -@@ -402,7 +405,7 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - push_cast at foo - refine le_trans (mul_le_mul_of_nonneg_right foo (by positivity)) ?_ - by_cases const_zero: det_bound_const (V_basis large_v.V) = 0 -- . -+ · - simp [const_zero] - - field_simp -@@ -410,25 +413,25 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - rw [mul_div_assoc] - rw [mul_assoc] - rw [mul_le_mul_iff_right₀] -- . -+ · - by_cases r_zero: (R + R'') = 0 -- . -+ · - norm_cast - simp [r_zero] -- . -+ · - grw [s_growth (R + R'') (by grind)] - norm_cast - simp - rw [mul_div_assoc] -- . -+ · - have nonneg := det_bound_const_nonneg (V_basis large_v.V) - grind -- . poly_tendsto -- . -+ · poly_tendsto -+ · - unfold HasPolynomialGrowthD at hd - obtain ⟨a, s_growth⟩ := hd - apply squeeze_zero_nhdsGT (g := (fun (n: ℝ) => (a * n^d : ℝ) / (n ^ (↑d + 3))) ∘ (fun (n: ℕ) => (n: ℝ))) -- . -+ · - rw [Filter.eventually_atTop] - use 1 - intro n hn -@@ -439,32 +442,30 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by - - norm_cast - positivity -- . -+ · - apply Filter.Eventually.of_forall - intro n - by_cases hn: n = 0 -- . -+ · - simp [hn] -- . -+ · - grw [s_growth n (by grind)] - norm_cast - simp -- . poly_tendsto -- . -+ · poly_tendsto -+ · - rw [large_v_V, finrank_span_finset_eq_card] at V_bound -- . -+ · - simp [fin_basis] at V_bound - rw [Finset.card_image_of_injective] at V_bound -- . -+ · - simp [card_fin_basis_idx] at V_bound - grind -- . exact Module.Basis.injective B -- . -+ · exact Module.Basis.injective B -+ · - simp [fin_basis] - apply LinearIndepOn.id_image - exact Module.Basis.linearIndepOn B ↑fin_basis_idx - --#synth FiniteDimensional ℝ LipschitzH --#print axioms Lipschitz_finite_dimensional - - end GeneratesNS -diff --git a/Gromov/Theorem38.lean b/Gromov/Theorem38.lean -index f00df84..c132e22 100644 ---- a/Gromov/Theorem38.lean -+++ b/Gromov/Theorem38.lean -@@ -6,15 +6,12 @@ public import Gromov.Representation - /-! - # Theorem 3.8 - --`theorem_3_8` and its real form: a group of polynomial growth admits a nontrivial --finite-dimensional representation. -+A finitely generated polynomial-growth subgroup of a compact linear group is -+virtually abelian, over either the real or the complex numbers. - -/ - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false - - open Subgroup - open scoped Finset -@@ -29,12 +26,9 @@ include hGS - - open scoped RealInnerProductSpace - --set_option synthInstance.maxHeartbeats 500000 - --set_option maxHeartbeats 9000000 - - omit hGS in --set_option maxHeartbeats 500000 in - lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V] (H: Subgroup (V →L[ℂ] V)ˣ) [DecidableEq H] (h_compact: CompactSpace H) (G: Subgroup H) (G_fg: G.FG) (S_data: SPolyData G): ∃ A: Subgroup G, IsMulCommutative A ∧ A.FiniteIndex := by - obtain ⟨H', ⟨H_equiv_H'⟩⟩ := new_weyl_unitarian_trick (V := V) (H := H) - let G' := Subgroup.map H'.subtype (Subgroup.map H_equiv_H'.symm.toMonoidHom G) -@@ -105,18 +99,17 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F - exact G_fg - - by_cases dim_le_one: Module.finrank ℂ (V) ≤ 1 -- . -+ · - use ⊤ - refine ⟨?_, ?_⟩ -- . -+ · - - have map_dim := Module.finrank_linearMap ℂ ℂ V V -- -- TODO - is there an easier way to prove this? - have map_dim_le_one: Module.finrank ℂ (V →ₗ[ℂ] V) ≤ 1 := by - rw [map_dim] - by_cases dim_eq_zero: Module.finrank ℂ (V) = 0 -- . simp [dim_eq_zero] -- . have dim_eq_one: Module.finrank ℂ (V) = 1 := by omega -+ · simp [dim_eq_zero] -+ · have dim_eq_one: Module.finrank ℂ (V) = 1 := by omega - simp [dim_eq_one] - - rw [finrank_le_one_iff] at map_dim_le_one -@@ -128,8 +121,6 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F - simp - obtain ⟨p, hx⟩ := v_span x.val.val.val - obtain ⟨q, hy⟩ := v_span y.val.val.val -- -- -- TODO - upstream to mathlib - have clm_apply (f: V →L[ℂ] V) (v: V): f v = f.toLinearMap v := rfl - rw [clm_apply] - rw [clm_apply] -@@ -139,8 +130,8 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F - rw [← hx, ← hy] - simp - rw [smul_comm] -- . infer_instance -- . -+ · infer_instance -+ · - - let new_S_data := map_S_data G (f := H'.subtype.comp (H_equiv_H'.symm.toMonoidHom)) S_data - obtain ⟨N, N_comm, N_finite_index⟩ := compact_lie_virtually_abelian (Module.finrank ℂ V) (by omega) G' G'_fg (by -@@ -158,17 +149,17 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F - let new_N' := Subgroup.map G'_to_G N - use new_N' - refine ⟨?_, ?_⟩ -- . -+ · - simp [new_N'] - apply Subgroup.map_isMulCommutative -- . -+ · - simp [new_N'] - rw [Subgroup.finiteIndex_iff] - rw [Subgroup.index_map_of_injective] -- . simp -+ · simp - refine ⟨?_, ?_⟩ -- . exact N_finite_index.index_ne_zero -- . conv => -+ · exact N_finite_index.index_ne_zero -+ · conv => - arg 1 - arg 1 - arg 1 -@@ -180,20 +171,20 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F - use H'.subtype (H_equiv_H'.symm a) - simp [my_hom] - use ?_ -- . have key : (MonoidHom.ofInjective (subtype_injective H')).symm -+ · have key : (MonoidHom.ofInjective (subtype_injective H')).symm - ⟨↑(H_equiv_H'.symm (↑a : ↥H)), ⟨H_equiv_H'.symm (↑a : ↥H), rfl⟩⟩ - = H_equiv_H'.symm (↑a : ↥H) := - subtype_injective H' (MonoidHom.apply_ofInjective_symm _ _) - exact Subtype.ext ((congrArg H_equiv_H' key).trans - (H_equiv_H'.apply_symm_apply _)) -- . simp [G'] -+ · simp [G'] - use a.val - use ?_ -- . simp -- . simp -+ · simp -+ · simp - - simp -- . -+ · - simp [G'_to_G] - intro a b hab - simpa using hab -@@ -202,8 +193,6 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F - instance rho_g_FG: Group.FG (rho_g) := by - unfold rho_g - apply Group.fg_range -- ---- TODO - deduplicate with 'map_S_Data' - @[expose] - def map_range_S_data {G H: Type*} [Group G] [Group H] [DecidableEq G] [DecidableEq H] {f: G →* H} (S_data: SPolyData (T := G) ⊤): SPolyData f.range := { - S := (f.rangeRestrict.comp (Subgroup.topEquiv.toMonoidHom)) '' S_data.S -@@ -232,9 +221,9 @@ def map_range_S_data {G H: Type*} [Group G] [Group H] [DecidableEq G] [Decidable - rw [Set.Finite.toFinset_image] - rw [← Finset.image_pow] - grw [Finset.card_image_le] -- . -+ · - apply S_data.S_poly r hr -- . exact S_data.S_finite -+ · exact S_data.S_finite - } - - @[expose] -@@ -265,12 +254,13 @@ def map_equiv_S_data {A B: Type*} [Group A] [Group B] [DecidableEq A] [Decidable - rw [Set.Finite.toFinset_image] - rw [← Finset.image_pow] - grw [Finset.card_image_le] -- . -+ · - apply S_data.S_poly r hr -- . exact S_data.S_finite -+ · exact S_data.S_finite - } - - -+omit hGS in - /-- The real-inner-product-space version of `theorem_3_8`: a finitely generated, polynomial-growth - subgroup of the units of a compact linear group over `ℝ` is virtually abelian. We reduce to the - complex `theorem_3_8` by complexifying (`Cx.unitsMapHom`) just before the unitary machinery. -/ -diff --git a/Gromov/ThreeTwoGenerates.lean b/Gromov/ThreeTwoGenerates.lean -index 7187937..bb10b00 100644 ---- a/Gromov/ThreeTwoGenerates.lean -+++ b/Gromov/ThreeTwoGenerates.lean -@@ -12,9 +12,6 @@ kernel of `φ`. - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false - - open Subgroup - open scoped Finset -@@ -29,9 +26,7 @@ include hGS - - open scoped RealInnerProductSpace - --set_option synthInstance.maxHeartbeats 500000 - --set_option maxHeartbeats 9000000 - - open MeasureTheory - -@@ -63,8 +58,8 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - - have closure_enlarge: Subgroup.closure ({1, γ, γ⁻¹} ∪ (e_i '' Set.univ)) = Subgroup.closure (({1, γ, γ⁻¹} ∪ (e_i_regular '' Set.univ))^(max_phi + 1)) := by - rw [Subgroup.closure_pow] -- . simp -- . unfold max_phi -+ · simp -+ · unfold max_phi - simp - - conv => -@@ -76,10 +71,10 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - rfl - rw [closure_enlarge] - apply Subgroup.closure_eq_of_le -- . -+ · - rw [hGS.generates] - exact fun ⦃a⦄ a ↦ trivial -- . -+ · - simp - intro s hs - simp -@@ -87,14 +82,13 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - rw [Subgroup.closure_toSubmonoid] - dsimp [Membership.mem] - rw [Submonoid.closure_eq_image_prod] -- -- TODO - why do we need any of this? - show s ∈ List.prod '' _ - rw [Set.mem_image] - - - have foo := Submonoid.exists_list_of_mem_closure (s := ((S ∪ S⁻¹) : Set G)) (x := s) - rw [← Subgroup.closure_toSubmonoid _] at foo -- simp only [mem_toSubmonoid, Finset.mem_coe] at foo -+ simp only [mem_toSubmonoid] at foo - have generates := hGS.generates - have x_in_top: s ∈ (⊤: Set G) := by - simp -@@ -114,7 +108,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - - use new_list - refine ⟨?_, ?_⟩ -- . -+ · - simp - intro x hx - unfold new_list list_with_mem l_attach at hx -@@ -124,9 +118,9 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - - have gamma_phi_in_minus_plus: γ^(φ a) ∈ ({1, γ, γ⁻¹} ∪ Set.range e_i_regular) ^ (max_phi - 1 +1) := by - by_cases val_pos: 0 < φ a -- . -+ · - have eq_self: Int.natAbs (φ a) = φ a := by -- simp [val_pos] -+ simp - linarith - conv => - arg 2 -@@ -134,8 +128,8 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - nth_rw 1 [← eq_self] - norm_cast - apply Set.pow_subset_pow_right (m := Int.natAbs (φ a)) (n := max_phi - 1 + 1) -- . simp -- . -+ · simp -+ · - rw [cancel_add_minus] - unfold max_phi - simp -@@ -147,10 +141,10 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - conv => - pattern ofMul a - equals a => rfl -- . -+ · - apply Set.pow_mem_pow - simp -- . -+ · - have eq_neg_abs: (φ a) = -(φ a).natAbs := by - rw [← Int.abs_eq_natAbs] - simp at val_pos -@@ -165,8 +159,8 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - norm_cast - -- TOOD - deduplicate this with the positive case - apply Set.pow_subset_pow_right (m := Int.natAbs (φ a)) (n := max_phi - 1 + 1) -- . simp -- . -+ · simp -+ · - rw [cancel_add_minus] - unfold max_phi - simp -@@ -178,7 +172,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - conv => - pattern ofMul a - equals a => rfl -- . -+ · - apply Set.pow_mem_pow - simp - have a_mem_s: a ∈ S := by exact l_mem_s a ha -@@ -192,7 +186,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - simp - - have prod_eq_sum: e_i ⟨a, l_mem_s a ha⟩ + φ (ofMul a) • ofMul γ = (e_i_regular ⟨a, a_mem_s⟩) * (γ ^ φ (ofMul a)) := by -- simp [e_i, e_i_regular, cancel_add_minus] -+ simp [e_i, e_i_regular] - - - conv => -@@ -202,7 +196,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - simp - - apply_fun (fun x => x * (γ ^ (- φ (ofMul a)))) -- . -+ · - simp only - simp - conv => -@@ -222,7 +216,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - equals (a * γ ^ (-φ (ofMul a))) => - rfl - simp -- . -+ · - exact mul_left_injective (γ ^ (-φ (ofMul a))) - - -@@ -253,10 +247,8 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ - exact List.map_id l - - --#print axioms e_i_and_gamma_generates_G - - -- The kernel of `φ` is generated by {γ_m_i} --set_option maxHeartbeats 1000000 - lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ = 1) : Subgroup.closure (Set.range (Function.uncurry (gamma_m_helper (S := S) φ γ))) = AddSubgroup.toSubgroup φ.ker := by - have phi_ofmul: φ (ofMul γ) = 1 := by - exact hγ -@@ -281,8 +273,8 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - - have closure_enlarge: Subgroup.closure ({1, γ, γ⁻¹} ∪ (e_i '' Set.univ)) = Subgroup.closure (({1, γ, γ⁻¹} ∪ (e_i_regular '' Set.univ))^(max_phi + 1)) := by - rw [Subgroup.closure_pow] -- . simp -- . unfold max_phi -+ · simp -+ · unfold max_phi - simp - - -@@ -291,7 +283,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - have gamma_m_ker_phi: (Subgroup.closure (Set.range (Function.uncurry gamma_m))) = φ.ker.toSubgroup := by - ext z - refine ⟨?_, ?_⟩ -- . intro hz -+ · intro hz - have foo := Submonoid.exists_list_of_mem_closure (s := Set.range (Function.uncurry gamma_m) ∪ (Set.range (Function.uncurry gamma_m))⁻¹) (x := z) - rw [← Subgroup.closure_toSubmonoid _] at foo - specialize foo hz -@@ -325,7 +317,6 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - obtain ⟨n, val, val_in_s, prod_eq_a⟩ := a_eq_prod - apply_fun Inv.inv at prod_eq_a - simp at prod_eq_a -- -- TODO - deduplicate this with the branch above - rw [← prod_eq_a] - simp - have apply_mult := AddMonoidHom.toMultiplicative_apply_apply φ (toMul (e_i ⟨val, val_in_s⟩)) -@@ -336,7 +327,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - equals e_i ⟨val, val_in_s⟩ => rfl - rw [e_i_zero] at apply_mult - exact apply_mult -- . -+ · - intro hz - - -- We need to write 'γ^a (f⁻¹ )' as an element of e_i -@@ -351,7 +342,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - rw [← e_i_eq] at new_closure_e_i - rw [new_closure_e_i] at foo - rw [← Subgroup.closure_toSubmonoid _] at foo -- simp only [mem_toSubmonoid, Finset.mem_coe] at foo -+ simp only [mem_toSubmonoid] at foo - - conv at foo => - intro hz -@@ -386,7 +377,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - have eq_split: list = list.takeWhile is_gamma ++ list.dropWhile is_gamma := by - exact Eq.symm List.takeWhile_append_dropWhile - by_cases header_eq_full: list.takeWhile is_gamma = list -- . -+ · - have list_eq_gamma_m: ∃ m: ℤ, list.unattach.prod = γ ^ m := by - unfold is_gamma at header_eq_full - clear eq_split is_gamma is_gamma_prop hlist -@@ -400,21 +391,21 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - simp at header_eq_full - exact header_eq_full.1 - rw [List.takeWhile_cons_of_pos] at header_eq_full -- . -+ · - rw [List.cons_eq_cons] at header_eq_full - specialize ih header_eq_full.2 - obtain ⟨m, hm⟩ := ih - by_cases h_eq_gamma: h = γ -- . -+ · - use (m + 1) - simp [h_eq_gamma, hm] - exact mul_self_zpow γ m -- . use (-1 + m) -+ · use (-1 + m) - simp [h_eq_gamma] at h_gamma - simp [h_gamma, hm] - rw [← zpow_neg_one] - rw [zpow_add] -- . simp [h_gamma] -+ · simp [h_gamma] - - - have empty_prod_eq: list.unattach.prod = ([] : List E).unattach.prod := by -@@ -427,7 +418,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - simp [hlist] - - exact ⟨[], empty_prod_eq⟩ -- . -+ · - - have tail_nonempty: list.dropWhile is_gamma ≠ [] := by - rw [not_iff_not.mpr List.takeWhile_eq_self_iff] at header_eq_full -@@ -454,8 +445,6 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - rw [Set.mem_union] at drop_in_E - have not_in_left: (List.dropWhile is_gamma list)[0].val ∉ ({γ, γ⁻¹} : Set G) := by - simp [not_is_gamma_prop] -- -- -- TODO - why can't simp handle this? - have in_right := Or.resolve_left drop_in_E not_in_left - exact in_right - -@@ -507,13 +496,13 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - have gamma_copy_prod: gamma_copy.unattach.prod = γ^m := by - simp [gamma_copy] - by_cases m_ge: 0 ≤ m -- . -+ · - simp [m_ge] - rw [← zpow_natCast] - simp - rw [← abs_eq_self] at m_ge - rw [m_ge] -- . -+ · - simp [m_ge] - rw [← zpow_natCast] - simp -@@ -525,13 +514,13 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - have gamma_copy_inv_prod: gamma_copy_inv.unattach.prod = γ^(-m) := by - simp [gamma_copy_inv] - by_cases m_ge: 0 ≤ m -- . -+ · - simp [m_ge] - rw [← zpow_natCast] - simp - rw [← abs_eq_self] at m_ge - rw [m_ge] -- . -+ · - simp [m_ge] - rw [← zpow_natCast] - simp -@@ -546,9 +535,9 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - - have header_prod: (List.takeWhile is_gamma list).unattach.prod = γ^m := by - have my_lemma := take_count_sum_eq_exp (List.takeWhile is_gamma list) γ gamma_ne_inv ?_ -- . -+ · - rw [my_lemma] -- . -+ · - have foo (x: E) := List.mem_takeWhile_imp (p := fun (val: E) => (val = γ ∨ val = γ⁻¹)) (l := list) (x := x) - conv at foo => - intro x hx -@@ -569,7 +558,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - have dropwhile_not_nul : (List.dropWhile is_gamma list) ≠ [] := by - exact tail_nonempty - apply_fun (fun x => x * (List.dropWhile is_gamma list).unattach.prod⁻¹) -- . -+ · - simp - conv => - pattern _[0] -@@ -585,9 +574,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - have unattach_len_pos: 0 < (List.dropWhile is_gamma list).unattach.length := by - rw [List.length_unattach] - exact List.length_pos_iff.mpr dropwhile_not_nul -- -- -- TODO - this is gross, and should be removed -- letI : Inhabited G := { -+ let : Inhabited G := { - default := 1 - } - -@@ -604,10 +591,10 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - rw [list_tail_unattach] - - rw [List.headI_mul_tail_prod_of_ne_nil] -- . -+ · - simp - simp [header_prod] -- . -+ · - by_contra this - rw [List.eq_nil_iff_length_eq_zero] at this - rw [List.length_unattach] at this -@@ -615,7 +602,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - contradiction - - -- . exact mul_left_injective (List.dropWhile is_gamma list).unattach.prod⁻¹ -+ · exact mul_left_injective (List.dropWhile is_gamma list).unattach.prod⁻¹ - - have sublist_phi_zero: φ (gamma_copy ++ (List.dropWhile is_gamma list).tail).unattach.prod = 0 := by - rw [← mega_list_prod] at hlist -@@ -675,9 +662,9 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - | cons h t ih => - simp - split_ifs -- . omega -- . omega -- . omega -+ · omega -+ · omega -+ · omega - - let rewritten_sub_list := (rewrite_list (gamma_copy ++ (list.dropWhile is_gamma).tail) sublist_phi_zero) - let return_list := (⟨γ^m * (List.dropWhile is_gamma list)[0] * γ^(-m), in_range⟩) :: rewritten_sub_list.val -@@ -712,24 +699,24 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - decreasing_by { - simp - split_ifs -- . -+ · - simp - conv => - rhs - rw [← take_drop_len (p := fun (k: E) ↦ decide (↑k = γ) || decide (↑k = γ⁻¹))] - apply add_lt_add_of_le_of_lt -- . apply count_head_lt -- . simp [is_gamma] at dropwhile_len_gt -+ · apply count_head_lt -+ · simp [is_gamma] at dropwhile_len_gt - apply Nat.sub_one_lt - apply Nat.pos_iff_ne_zero.mp dropwhile_len_gt -- . -+ · - simp-- [count_gamma_copy] - conv => - rhs - rw [← take_drop_len (p := fun (k: E) ↦ decide (↑k = γ) || decide (↑k = γ⁻¹))] - apply add_lt_add_of_le_of_lt -- . apply count_head_lt -- . simp [is_gamma] at dropwhile_len_gt -+ · apply count_head_lt -+ · simp [is_gamma] at dropwhile_len_gt - apply Nat.sub_one_lt - apply Nat.pos_iff_ne_zero.mp dropwhile_len_gt - } -@@ -771,7 +758,6 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - - let my_res := rewrite_list ((z_list.filter (fun s ↦ !decide (s = 1))).attach.map (fun (g) => ⟨g.val, z_filter_mem_e g.val g.property⟩)) (by - simp -- -- TODO - there has to be a less awful way of doing this - conv => - arg 1 - arg 2 -@@ -783,8 +769,8 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - ext i q - simp - by_cases list_get: (List.filter (fun s ↦ !decide (s = 1)) z_list)[i]? = none -- . simp [list_get] -- . simp at list_get -+ · simp [list_get] -+ · simp at list_get - simp [list_get] - rw [← ofMul_list_prod] - rw [h_z_list.2] -@@ -800,12 +786,12 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - rw [Set.mem_image] - use my_res.val.unattach - refine ⟨?_, ?_⟩ -- . simp only [Set.mem_setOf_eq] -+ · simp only [Set.mem_ofPred_eq] - intro x hx - rw [List.mem_unattach] at hx - obtain ⟨x_prop, _⟩ := hx - exact x_prop -- . -+ · - rw [← my_res_prop] - conv => - pattern List.unattach _ -@@ -813,12 +799,13 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ - ext i q - simp - by_cases list_get: (List.filter (fun s ↦ !decide (s = 1)) z_list)[i]? = none -- . simp [list_get] -- . simp at list_get -+ · simp [list_get] -+ · simp at list_get - simp [list_get] - exact h_z_list.2 - exact gamma_m_ker_phi - -+omit hGS in - lemma three_two_S_n_subset_ker {G: Type*} [Group G] [DecidableEq G] (S: Finset G) (φ: (Additive G) →+ ℤ) (γ: G) (phi_gamma: φ γ = 1) (n: ℕ): - ↑(three_two_S_n S φ γ n) ⊆ Additive.toMul '' φ.ker.carrier := by - -@@ -846,12 +833,12 @@ lemma three_two_S_n_subset_ker {G: Type*} [Group G] [DecidableEq G] (S: Finset G - simp - exact id (Eq.symm prod_eq_x) - --lemma three_two_S_n_generates (d: ℕ) (hd: d >= 1) (hG: HasPolynomialGrowthD S d ) (φ: (Additive G) →+ ℤ) (γ : Additive G) (phi_gamma: φ γ = 1): ∃ n, AddSubgroup.closure (Additive.ofMul '' (three_two_S_n S φ γ (n))) = φ.ker := by -+lemma three_two_S_n_generates (d: ℕ) (_hd: d >= 1) (hG: HasPolynomialGrowthD S d ) (φ: (Additive G) →+ ℤ) (γ : Additive G) (phi_gamma: φ γ = 1): ∃ n, AddSubgroup.closure (Additive.ofMul '' (three_two_S_n S φ γ (n))) = φ.ker := by - obtain ⟨n, hn⟩ := three_poly_poly_growth_all_s_n d hG γ φ - use n - ext z - refine ⟨?_, ?_⟩ -- . intro hz -+ · intro hz - induction hz using AddSubgroup.closure_induction with - | mem x hx => - have x_mem: x ∈ three_two_S_n S φ γ n := by -@@ -867,7 +854,7 @@ lemma three_two_S_n_generates (d: ℕ) (hd: d >= 1) (hG: HasPolynomialGrowthD S - exact (AddSubgroup.add_mem_cancel_right φ.ker hz).mpr hy - | neg x x_mem hx => - exact AddSubgroup.neg_mem φ.ker hx -- . intro hz -+ · intro hz - have generates_ker := three_two_gamma_m_generates φ γ phi_gamma - - have hz' : z ∈ Subgroup.closure (Set.range (Function.uncurry (gamma_m_helper (S := S) φ γ))) := by -@@ -922,10 +909,10 @@ lemma three_two_ker_fg (d: ℕ) (hd: d >= 1) (hG: HasPolynomialGrowthD S d ) ( - use ofMul '' ↑(three_two_S_n S φ γ n) - refine ⟨hn, ?_⟩ - rw [Set.finite_image_iff] -- . -+ · - simp -- . intro a b hab -- simpa using hab -+ · intro a _ b _ hab -+ exact Additive.ofMul.injective hab - - - -- Extract a generatating set for the kernel of φ -@@ -941,8 +928,7 @@ lemma finite_virtually_nilpotent {G: Type*} [Group G] [Finite G]: Group.IsVirtua - rw [Group.IsVirtuallyNilpotent] - use ⊥ - refine ⟨?_, ?_⟩ -- . exact Group.isNilpotent_of_subsingleton -- -- TODO - prove that a finite group is nilpotent, and upstream to mathlib -- . infer_instance -+ · exact Group.isNilpotent_of_subsingleton -+ · infer_instance - - end GeneratesNS -diff --git a/Gromov/ThreeTwoGrowth.lean b/Gromov/ThreeTwoGrowth.lean -index 1fc3a86..5fd825b 100644 ---- a/Gromov/ThreeTwoGrowth.lean -+++ b/Gromov/ThreeTwoGrowth.lean -@@ -11,9 +11,6 @@ public import Gromov.Theorem31Input - - public section - --set_option linter.style.longLine false --set_option linter.style.cdot false --set_option linter.style.commandStart false - - open Subgroup - open scoped Finset -@@ -28,9 +25,7 @@ include hGS - - open scoped RealInnerProductSpace - --set_option synthInstance.maxHeartbeats 500000 - --set_option maxHeartbeats 9000000 - - open MeasureTheory - -@@ -45,27 +40,27 @@ lemma take_count_sum_eq_exp {T: Type*} [ht: Group T] [heq: DecidableEq T] {E: Se - | cons h t ih => - simp [countElemOrInv] - by_cases h_eq_g: h = g -- . -+ · - simp [h_eq_g] - rw [ih] -- . rw [← zpow_one_add] -- . simp at hl -+ · rw [← zpow_one_add] -+ · simp at hl - intro val hval - have hl_right := hl.2 val (by simp) (by simp [hval]) - exact hl_right -- . -+ · - have h_eq_inv: h = g⁻¹ := by - specialize hl h - simp at hl - simp [h_eq_g] at hl - exact hl -- simp [h_eq_g, h_eq_inv] -+ simp [h_eq_inv] - rw [ih] -- . -+ · - rw [← zpow_neg_one] - rw [← zpow_add] - simp [hg.symm] -- . -+ · - simp at hl - intro val hval - have hl_right := hl.2 val (by simp) (by simp [hval]) -@@ -82,10 +77,10 @@ lemma list_filter_one {T: Type*} [DecidableEq T] [Group T] (l: List T): (l.filte - | cons h t ih => - simp - by_cases h_eq_one: h = 1 -- . -+ · - simp [h_eq_one] - exact ih -- . -+ · - rw [List.filter_cons] - simp [h_eq_one] - exact ih -@@ -119,11 +114,7 @@ omit hGS in - @[expose] - noncomputable def three_two_B_n {G: Type*} [Group G] [DecidableEq G] (S: Finset G) (φ: (Additive G) →+ ℤ) (γ: G) (n: ℕ): Finset G := Finset.image (fun l => l.unattach.prod) (list_len_n S φ γ n ) - -- ----set_option maxHeartbeats 600000 -- - -- If G has polynomial growth, than we can find an N such that S_n ⊆ B_n * B_n⁻¹ --set_option maxHeartbeats 2000000 in - lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) (φ: (Additive G) →+ ℤ) (s: G) (s_mem: s ∈ S): ∃ n, three_two_S_n (S := {s}) φ γ (n + 1) ⊆ ((three_two_B_n (S := {s}) φ γ n) * (three_two_B_n (S := {s}) φ γ n)⁻¹) := by - by_contra! - simp [HasPolynomialGrowthD] at hG -@@ -163,7 +154,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - - have disjoint_smul (M: ℕ) (hM: N ≤ M) (p: G) (p_mem: p ∈ three_two_S_n (S := {s}) φ γ (M + 1)) (p_not_prod: p ∉ three_two_B_n (S := {s}) φ γ M * (three_two_B_n (S := {s}) φ γ M)⁻¹): (p • three_two_B_n (S := {s}) φ γ M) ∩ (three_two_B_n (S := {s}) φ γ M) = ∅ := by - rw [Finset.mem_mul.not] at p_not_prod -- push_neg at p_not_prod -+ push Not at p_not_prod - - ext a - simp only [Finset.mem_inter, Finset.notMem_empty, iff_false, not_and] -@@ -225,12 +216,12 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - exact s_n_subset M hM s.property - )⟩))) - refine ⟨?_, ?_⟩ -- . -- simp [list_len_n, list_mem] -+ · -+ simp [list_len_n] - simp [list_len_n] at list_mem - exact list_mem - -- . -+ · - simp - conv => - lhs -@@ -255,7 +246,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - - use (List.replicate m.natAbs m_list_choice).flatten ++ [⟨s, s_mem⟩] ++ (List.replicate (-(φ (ofMul s))).natAbs phi_list_choice).flatten ++ (List.replicate m.natAbs m_list_choice_inv).flatten - refine ⟨?_, ?_⟩ -- . -+ · - simp [phi_list_choice] - norm_cast - rw [← s_m_eq] -@@ -264,7 +255,6 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - rhs - arg 1 - arg 2 -- -- TODO - is there a tactic that can normalize the 'ofMul' stuff for us? - equals s * γ^(-(φ (ofMul s))) => - rw [← ofMul_zpow] - rw [← sub_eq_add_neg] -@@ -278,7 +268,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - simp - simp_rw [m_list_choice, m_list_choice_inv] - by_cases m_pos: 0 < m -- . -+ · - simp_rw [m_pos] - simp - have m_eq_abs : |m| = m := by -@@ -291,7 +281,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - rw [m_eq_abs] - group - by_cases phi_neg: (φ (ofMul s)) < 0 -- . -+ · - have phi_abs: |(φ (ofMul s))| = -φ (ofMul s) := by - rw [Int.abs_eq_natAbs] - omega -@@ -301,7 +291,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - rw [gamma_list_prod] - rw [m_eq_abs] - group -- . -+ · - have phi_abs: |(φ (ofMul s))| = φ (ofMul s) := by - rw [Int.abs_eq_natAbs] - omega -@@ -311,7 +301,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - rw [gamma_list_inv] - rw [m_eq_abs] - group -- . -+ · - simp_rw [m_pos] - simp - have neg_abs_m : |m| = - m := by -@@ -324,9 +314,8 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - group - rw [neg_abs_m] - group -- -- TODO - this can be deduplicated - by_cases phi_neg: (φ (ofMul s)) < 0 -- . -+ · - have phi_abs: |(φ (ofMul s))| = -φ (ofMul s) := by - rw [Int.abs_eq_natAbs] - omega -@@ -336,7 +325,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - rw [gamma_list_prod] - rw [neg_abs_m] - group -- . -+ · - have phi_abs: |(φ (ofMul s))| = φ (ofMul s) := by - rw [Int.abs_eq_natAbs] - omega -@@ -346,7 +335,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - rw [gamma_list_inv] - rw [neg_abs_m] - group -- . -+ · - - simp [m_list_choice, m_list_choice_inv] - simp_rw [apply_ite] -@@ -409,20 +398,19 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - simp [List.unattach, -List.map_subtype] - have my_spec := Exists.choose_spec ((s_n_bound M hM h h.property)) - have first_prop := my_spec.1 -- -- wtf - nth_rw 8 [← first_prop] - simp - - - have flat_list_len: nested_list.flatten.length ≤ nested_list.length • (4 * M^2) := by - simp -- have foo := List.sum_le_card_nsmul (l := (List.map List.length nested_list)) (4 * M^2) ?_ -- . -+ have foo := List.sum_le_length_nsmul (l := (List.map List.length nested_list)) (4 * M^2) ?_ -+ · - conv at foo => - rhs - simp - exact foo -- . -+ · - intro q hq - simp at hq - obtain ⟨s_list, h_s_prod, s_len⟩ := hq -@@ -443,8 +431,8 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - simp only [smul_eq_mul] at flat_list_len - have nested_list_le_n_squared: nested_list.flatten.length ≤ M * (4 * M^2) := by - apply le_mul_of_le_mul_right (b := l.length) -- . omega -- . omega -+ · omega -+ · omega - - - let filled_list := nested_list.flatten ++ (List.replicate ((M * (4 * M^2)) - nested_list.flatten.length) ⟨1, hGS.one_mem⟩) -@@ -484,8 +472,8 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - | base => - simp [three_two_B_n, list_len_n] - use [⟨(gamma_m_helper φ γ 0 ⟨s, s_mem⟩), ?_⟩] -- . simp [N] -- . -+ · simp [N] -+ · - simp [three_two_S_n] - use 0 - refine ⟨by omega, ?_⟩ -@@ -501,18 +489,18 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - - have union_subset_n_succ: three_two_B_n (S := {s}) φ γ k ∪ (p • three_two_B_n (S := {s}) φ γ k) ⊆ three_two_B_n (S := {s}) φ γ (k + 1) := by - apply Finset.union_subset -- . exact b_n_subset_b_n_succ k hk -- . exact smul_subset k hk p p_mem -+ · exact b_n_subset_b_n_succ k hk -+ · exact smul_subset k hk p p_mem - - - have card_le := Finset.card_le_card (union_subset_n_succ) - rw [Finset.card_union_of_disjoint ?_] at card_le -- . -+ · - simp at card_le - ring_nf at card_le - rw [add_comm] at card_le - omega -- . -+ · - specialize disjoint_smul k hk p p_mem p_not_prod - rw [Finset.inter_comm] at disjoint_smul - rw [Finset.disjoint_iff_inter_eq_empty] -@@ -577,13 +565,13 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) - - have strict_lt: a * 4 ^ d * (↑M ^ 3) ^ d < (((2 : ℝ) ^ N)⁻¹ * 2 ^ M) := by - apply helper_lemma (b := 2⁻¹) -- . -+ · - field_simp - positivity -- . simp -- . simp -- . exact m_pow_lt -- . norm_num -+ · simp -+ · simp -+ · exact m_pow_lt -+ · norm_num - - - conv at strict_lt => -@@ -616,8 +604,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - exact S_nonempty - ) - use r -- intro m -- intro x hx -+ intro m x hx - simp [gamma_m_helper] at hx - simp [three_two_S_n, gamma_m_helper] - obtain ⟨s, hs, x_eq_conj⟩ := hx -@@ -640,10 +627,10 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - have my_iter := closure_iterate_mulact γ (e_i_regular_helper φ γ ⟨s, hs⟩) (n + 1) - simp [three_two_S_n, gamma_m_helper] at s_n_subset - have closure_eq := my_iter ?_ ?_ -- . -+ · - have x_mem_closure_range: x ∈ Subgroup.closure (Set.range fun (m : ℤ) ↦ γ ^ m * e_i_regular_helper φ γ ⟨s, hs⟩ * γ ^ (-m : ℤ)) := by - by_cases m_pos: 0 < m -- . -+ · - have m_eq_natabs: m = m.natAbs := by - omega - apply Subgroup.subset_closure -@@ -651,14 +638,14 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - use m.natAbs - rw [m_eq_natabs] at x_eq_conj - rw [← x_eq_conj] -- . -+ · - apply Subgroup.subset_closure - simp - use m - - rw [← closure_eq] at x_mem_closure_range - apply Subgroup.closure_mono (h := ((fun (m : ℤ) ↦ γ ^ m * e_i_regular_helper φ γ ⟨s, hs⟩ * γ ^ (-m : ℤ)) '' (Set.Ioo (-(r + 1) : ℤ) (r + 1 : ℤ)))) -- . -+ · - intro p hp - simp at hp - simp -@@ -669,7 +656,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - use hs - rw [gamma_m_helper, zpow_neg] - exact p_eq -- . -+ · - apply (Subgroup.closure_mono _) x_mem_closure_range - intro z hz - simp at hz -@@ -677,13 +664,13 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - obtain ⟨a, ⟨a_gt, a_lt⟩, z_eq⟩ := hz - use a - refine ⟨⟨?_, ?_⟩, z_eq⟩ -- . -+ · - norm_cast at a_gt - omega -- . -+ · - norm_cast at a_lt - omega -- . -+ · - specialize s_n_subset (n + 1) (by omega) (by omega) s rfl - simp [three_two_B_n] at s_n_subset - rw [Finset.mem_mul] at s_n_subset -@@ -694,7 +681,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - simp [e_i_regular_helper] - rw [← prod_vals_eq] - apply Subgroup.mul_mem -- . -+ · - simp at val_in_image - obtain ⟨list, hlist, list_prod_eq⟩ := val_in_image - rw [← list_prod_eq] -@@ -713,7 +700,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - simp [gamma_m_helper] at e_i_eq - obtain ⟨q, q_mem, e_i_eq'⟩ := e_i_eq - simp [e_i_regular_helper] -- . -+ · - simp at other_val_in_image - obtain ⟨list, hlist, list_prod_eq⟩ := other_val_in_image - apply_fun Inv.inv at list_prod_eq -@@ -735,8 +722,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - simp [gamma_m_helper] at e_i_eq - obtain ⟨q, q_mem, e_i_eq'⟩ := e_i_eq - simp [e_i_regular_helper] -- . -- -- TODO - 99% of this can be deduplicated -+ · - specialize s_n_subset (-(n + 1)) (by omega) (by omega) s rfl - -- Deduplicate verything after here - simp [three_two_B_n] at s_n_subset -@@ -749,7 +735,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - simp [e_i_regular_helper] - rw [← prod_vals_eq] - apply Subgroup.mul_mem -- . -+ · - simp at val_in_image - obtain ⟨list, hlist, list_prod_eq⟩ := val_in_image - rw [← list_prod_eq] -@@ -768,7 +754,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( - simp [gamma_m_helper] at e_i_eq - obtain ⟨q, q_mem, e_i_eq'⟩ := e_i_eq - simp [e_i_regular_helper] -- . -+ · - simp at other_val_in_image - obtain ⟨list, hlist, list_prod_eq⟩ := other_val_in_image - apply_fun Inv.inv at list_prod_eq -diff --git a/Gromov/ToMathlib/Analysis/Matrix/StarNormalEigen.lean b/Gromov/ToMathlib/Analysis/Matrix/StarNormalEigen.lean -index a6918d7..5dbc2a0 100644 ---- a/Gromov/ToMathlib/Analysis/Matrix/StarNormalEigen.lean -+++ b/Gromov/ToMathlib/Analysis/Matrix/StarNormalEigen.lean -@@ -146,28 +146,33 @@ lemma star_normal_maxGenEigenspace_eq_eigenspace {A: Type*} [NormedAddCommGroup - f.maxGenEigenspace k = f.eigenspace k := by - apply le_antisymm; - · intro x hx -- aesop; -+ obtain ⟨w, hw⟩ := (Module.End.mem_maxGenEigenspace f k x).mp hx - -- Since $f$ is star-normal, we have $\ker((f - kI)^2) = \ker(f - kI)$. - have h_ker_sq_eq_ker : LinearMap.ker ((f - k • 1) ^ 2) = LinearMap.ker (f - k • 1) := by - apply IsStarNormal.ker_sq_eq_ker; - -- Since $f$ is star-normal, we have $f * star f = star f * f$. Therefore, $(f - k • 1) * star (f - k • 1) = star (f - k • 1) * (f - k • 1)$. - have h_star_normal : (f - k • 1) * star (f - k • 1) = star (f - k • 1) * (f - k • 1) := by -- simp_all +decide [ sub_mul, mul_sub, smul_sub, sub_smul ]; -- simp_all +decide [ sub_eq_iff_eq_add, IsStarNormal, smul_smul ]; -+ simp_all +decide [ sub_mul, mul_sub, smul_sub ]; -+ simp_all +decide [ sub_eq_iff_eq_add, smul_smul ]; - simp_all +decide [ mul_comm, sub_eq_add_neg, add_assoc, add_left_comm, add_comm ]; - exact Eq.symm (star_comm_self' f); - exact (isStarNormal_iff (f - k • 1)).mpr (id (Eq.symm h_star_normal)); - -- By induction on $w$, we can show that $\ker((f - kI)^w) = \ker(f - kI)$ for all $w \geq 1$. - have h_ker_pow_eq_ker : ∀ w ≥ 1, LinearMap.ker ((f - k • 1) ^ w) = LinearMap.ker (f - k • 1) := by - intro w hw -- induction' w, Nat.succ_le.mpr hw using Nat.le_induction with w hw ih; -+ induction' w, Nat.succ_le_iff.mpr hw using Nat.le_induction with w hw ih; - · simp +decide; -- · simp_all +decide [ pow_succ, LinearMap.ker_comp ]; -+ · simp_all +decide [ pow_succ ]; - simp_all +decide [ SetLike.ext_iff, LinearMap.mem_ker ]; -- intro x; specialize ih ( f x - k • x ) ; simp_all +decide [ sub_eq_iff_eq_add, pow_succ, mul_sub, sub_mul ] ; -- by_cases hw : 1 ≤ w <;> aesop; -- replace h_ker_pow_eq_ker := SetLike.ext_iff.mp ( h_ker_pow_eq_ker w hw ) x; aesop; -- exact eq_of_sub_eq_zero h_ker_pow_eq_ker; -+ intro x; specialize ih ( f x - k • x ) ; simp_all +decide [ sub_eq_iff_eq_add ] ; -+ by_cases hw' : 1 ≤ w -+ · have hxker : x ∈ LinearMap.ker ((f - k • 1) ^ w) := hw -+ rw [h_ker_pow_eq_ker w hw'] at hxker -+ simpa only [Module.End.eigenspace_def] using hxker -+ · have hw0 : w = 0 := by omega -+ subst w -+ simp only [pow_zero, Module.End.one_apply] at hw -+ subst x -+ exact (f.eigenspace k).zero_mem - · exact Module.End.eigenspace_le_maxGenEigenspace - --#print axioms star_normal_maxGenEigenspace_eq_eigenspace -diff --git a/Gromov/ToMathlib/Analysis/Matrix/Unitary.lean b/Gromov/ToMathlib/Analysis/Matrix/Unitary.lean -index fad106a..4cbb9ee 100644 ---- a/Gromov/ToMathlib/Analysis/Matrix/Unitary.lean -+++ b/Gromov/ToMathlib/Analysis/Matrix/Unitary.lean -@@ -12,14 +12,296 @@ direct sum of the eigenspaces of that element. - - public section - -+/-- A norm-preserving finite-dimensional endomorphism has a unitary matrix. -/ -+private lemma matrix_unitary_of_norm_map {E : Type*} [NormedAddCommGroup E] -+ [InnerProductSpace ℂ E] [FiniteDimensional ℂ E] {ι : Type*} -+ [Fintype ι] [DecidableEq ι] (b : OrthonormalBasis ι ℂ E) -+ (f : E →ₗ[ℂ] E) (hf : ∀ x, ‖f x‖ = ‖x‖) : -+ LinearMap.toMatrixOrthonormal b f ∈ Matrix.unitaryGroup ι ℂ := by -+ let i : E →ₗᵢ[ℂ] E := { toLinearMap := f, norm_map' := hf } -+ let e := LinearIsometryEquiv.ofSurjective i -+ ((LinearMap.injective_iff_surjective).mp i.injective) -+ exact e.toMatrix_mem_unitaryGroup b b -+ -+private lemma adjoint_comp_self_of_norm_map {E F : Type*} -+ [NormedAddCommGroup E] [InnerProductSpace ℂ E] [FiniteDimensional ℂ E] -+ [NormedAddCommGroup F] [InnerProductSpace ℂ F] [FiniteDimensional ℂ F] -+ (f : E →ₗ[ℂ] F) (hf : ∀ x, ‖f x‖ = ‖x‖) : -+ (LinearMap.adjoint f).comp f = 1 := by -+ apply LinearMap.ext -+ intro x -+ apply ext_inner_right ℂ -+ intro y -+ simp only [LinearMap.comp_apply, Module.End.one_apply, LinearMap.adjoint_inner_left] -+ exact (LinearMap.norm_map_iff_inner_map_map f).mp hf x y -+ -+/-- Restriction to two orthogonal invariant summands splits the unitary centralizer. -/ -+private lemma unitary_centralizer_blocks {n : ℕ} -+ (g : Matrix.unitaryGroup (Fin n) ℂ) -+ (p q : Submodule ℂ (EuclideanSpace ℂ (Fin n))) -+ (hcomp : IsCompl p q) (horth : p ⟂ q) -+ (hp : ∀ h : Subgroup.centralizer {g}, -+ Set.MapsTo h.val.val.toEuclideanLin p p) -+ (hq : ∀ h : Subgroup.centralizer {g}, -+ Set.MapsTo h.val.val.toEuclideanLin q q) -+ (hgp : Set.MapsTo g.val.toEuclideanLin p p) -+ (hqg : Set.MapsTo g.val.toEuclideanLin q q) : -+ ∃ (A : Subgroup (Matrix.unitaryGroup (Fin (Module.finrank ℂ p)) ℂ)) -+ (B : Subgroup (Matrix.unitaryGroup (Fin (Module.finrank ℂ q)) ℂ)), -+ Nonempty (Subgroup.centralizer {g} ≃* A × B) := by -+ have comm_g_h (h : Subgroup.centralizer {g}) : -+ Commute g.val.toEuclideanLin h.val.val.toEuclideanLin := by -+ have hh := h.property -+ rw [Subgroup.mem_centralizer_iff] at hh -+ have hg : g * h.val = h.val * g := hh g (by simp) -+ apply_fun (fun x => Matrix.toEuclideanLin x.val) at hg -+ rw [commute_iff_eq] -+ simpa only [Submonoid.coe_mul, Matrix.toEuclideanLin, Matrix.toLpLin_mul_same, -+ Module.End.mul_eq_comp] using hg -+ let map_first (h : Subgroup.centralizer {g}) := -+ h.val.val.toEuclideanLin.restrict (hp h) -+ -+ -+ let d := (Module.finrank ℂ ↥p) -+ let map_first_unitary (h: Subgroup.centralizer {g}): Matrix.unitaryGroup (Fin d) ℂ := { -+ val := LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥p) (map_first h) -+ property := by -+ apply matrix_unitary_of_norm_map -+ intro x -+ exact unitary_preserves_norm n h.val x.val -+ } -+ -+ -+ let map_first_hom: MonoidHom (Subgroup.centralizer {g}) _ := { -+ toFun := map_first_unitary -+ map_one' := by -+ have h_one : map_first 1 = 1 := by -+ apply LinearMap.ext -+ intro x -+ apply Subtype.ext -+ change Matrix.toEuclideanLin (1 : Matrix (Fin n) (Fin n) ℂ) x.val = x.val -+ simp [Matrix.toEuclideanLin_eq_toLin_orthonormal] -+ apply Subtype.ext -+ exact (congrArg (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥p)) h_one).trans (map_one _) -+ map_mul' := by -+ intro x y -+ have h_mul : map_first (x * y) = map_first x * map_first y := by -+ apply LinearMap.ext -+ intro z -+ apply Subtype.ext -+ change Matrix.toEuclideanLin (x.val.val * y.val.val) z.val = -+ Matrix.toEuclideanLin x.val.val (Matrix.toEuclideanLin y.val.val z.val) -+ simp only [Matrix.toEuclideanLin, Matrix.toLpLin_mul_same, LinearMap.comp_apply] -+ apply Subtype.ext -+ exact (congrArg (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥p)) h_mul).trans -+ (map_mul _ _ _) -+ } -+ -+ let first_range := map_first_hom.range -+ -+ -+ let map_second (h : Subgroup.centralizer {g}) := -+ h.val.val.toEuclideanLin.restrict (hq h) -+ -+ -+ let map_second_unitary (h: Subgroup.centralizer {g}): Matrix.unitaryGroup _ ℂ := { -+ val := LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥q) (map_second h) -+ property := by -+ apply matrix_unitary_of_norm_map -+ intro x -+ exact unitary_preserves_norm n h.val x.val -+ } -+ -+ let map_second_hom: MonoidHom (Subgroup.centralizer {g}) _ := { -+ toFun := map_second_unitary -+ -- TODO - deduplicate these with 'map_first_hom' -+ map_one' := by -+ have h_one : map_second 1 = 1 := by -+ apply LinearMap.ext -+ intro x -+ apply Subtype.ext -+ change Matrix.toEuclideanLin (1 : Matrix (Fin n) (Fin n) ℂ) x.val = x.val -+ simp [Matrix.toEuclideanLin_eq_toLin_orthonormal] -+ apply Subtype.ext -+ exact (congrArg (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥q)) h_one).trans (map_one _) -+ map_mul' := by -+ intro x y -+ have h_mul : map_second (x * y) = map_second x * map_second y := by -+ apply LinearMap.ext -+ intro z -+ apply Subtype.ext -+ change Matrix.toEuclideanLin (x.val.val * y.val.val) z.val = -+ Matrix.toEuclideanLin x.val.val (Matrix.toEuclideanLin y.val.val z.val) -+ simp only [Matrix.toEuclideanLin, Matrix.toLpLin_mul_same, LinearMap.comp_apply] -+ apply Subtype.ext -+ exact (congrArg (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥q)) h_mul).trans -+ (map_mul _ _ _) -+ } -+ -+ let prod_hom := MonoidHom.prod map_first_hom.rangeRestrict map_second_hom.rangeRestrict -+ let prod_iso := MulEquiv.ofBijective prod_hom (by -+ unfold Function.Bijective -+ refine ⟨?_, ?_⟩ -+ . -+ intro x y hxy -+ have hfirst : map_first_hom x = map_first_hom y := -+ congrArg (fun z => z.1.val) hxy -+ have hsecond : map_second_hom x = map_second_hom y := -+ congrArg (fun z => z.2.val) hxy -+ have hfirst' : map_first x = map_first y := -+ (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥p)).injective -+ (congrArg Subtype.val hfirst) -+ have hsecond' : map_second x = map_second y := -+ (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥q)).injective -+ (congrArg Subtype.val hsecond) -+ apply Subtype.ext -+ apply Subtype.ext -+ apply Matrix.toEuclideanLin.injective -+ apply LinearMap.ext -+ intro z -+ obtain ⟨zp, zq, hz, _⟩ := Submodule.existsUnique_add_of_isCompl hcomp z -+ rw [← hz, map_add, map_add] -+ exact congrArg₂ (· + ·) -+ (congrArg Subtype.val (DFunLike.congr_fun hfirst' zp)) -+ (congrArg Subtype.val (DFunLike.congr_fun hsecond' zq)) -+ . -+ intro a -+ have first_prop := a.fst.property -+ have second_prop := a.snd.property -+ simp only [prod_hom] -+ rw [MonoidHom.mem_range] at first_prop -+ rw [MonoidHom.mem_range] at second_prop -+ -+ obtain ⟨x, hx⟩ := first_prop -+ obtain ⟨y, hy⟩ := second_prop -+ -+ let map_first_x_new: p →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { -+ toFun := fun a => map_first x a -+ map_add' := by simp -+ map_smul' := by simp -+ } -+ -+ let map_second_y_new: ↑q →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { -+ toFun := fun a => map_second y a -+ map_add' := by simp -+ map_smul' := by simp -+ } -+ -+ have map_first_x_unitary : -+ (ContinuousLinearMap.adjoint (𝕜 := ℂ) (E := p) -+ (F := EuclideanSpace ℂ (Fin n)) map_first_x_new.toContinuousLinearMap).comp -+ map_first_x_new.toContinuousLinearMap = 1 := by -+ rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] -+ intro z -+ exact unitary_preserves_norm n x.val z.val -+ apply_fun (fun f => f.toLinearMap) at map_first_x_unitary -+ simp at map_first_x_unitary -+ have map_second_y_unitary : -+ (ContinuousLinearMap.adjoint (𝕜 := ℂ) (E := q) -+ (F := EuclideanSpace ℂ (Fin n)) map_second_y_new.toContinuousLinearMap).comp -+ map_second_y_new.toContinuousLinearMap = 1 := by -+ rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] -+ intro z -+ exact unitary_preserves_norm n y.val z.val -+ apply_fun (fun f => f.toLinearMap) at map_second_y_unitary -+ simp at map_second_y_unitary -+ -+ let new := LinearMap.ofIsCompl hcomp map_first_x_new map_second_y_new -+ use ⟨⟨(Matrix.toEuclideanLin.symm new), (by -+ simp [Matrix.mem_unitaryGroup_iff'] -+ apply_fun (fun f => Matrix.toEuclideanLin f) -+ . simp [-EmbeddingLike.apply_eq_iff_eq, new] -+ rw [Matrix.star_eq_conjTranspose] -+ simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -+ simp -+ rw [← LinearMap.toMatrix_adjoint] -+ simp -+ -+ -+ conv => -+ rhs -+ equals 1 => -+ ext z -+ simp -+ -+ -+ apply ofIsCompl_adjoint_comp -+ . exact horth -+ . -+ apply map_first_x_unitary -+ . intro v -+ exact (map_first x v).2 -+ . -+ apply map_second_y_unitary -+ . intro v -+ exact (map_second y v).2 -+ . intro x y hxy -+ simpa using hxy -+ )⟩, (by -+ rw [Subgroup.mem_centralizer_iff] -+ simp -+ apply_fun (fun f => Matrix.toEuclideanLin f.val) -+ simp only [] -+ simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -+ simp only [Matrix.toLin_symm, Submonoid.coe_mul] -+ rw [Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun (Fin n) ℂ).toBasis )] -+ simp -+ rw [Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun (Fin n) ℂ).toBasis )] -+ simp [new] -+ rw [eq_comm] -+ apply ofIsCompl_commute -+ . intro z -+ change x.val.val.toEuclideanLin (g.val.toEuclideanLin z.val) = -+ g.val.toEuclideanLin (x.val.val.toEuclideanLin z.val) -+ exact DFunLike.congr_fun (comm_g_h x).eq.symm z.val -+ . intro z -+ change y.val.val.toEuclideanLin (g.val.toEuclideanLin z.val) = -+ g.val.toEuclideanLin (y.val.val.toEuclideanLin z.val) -+ exact DFunLike.congr_fun (comm_g_h y).eq.symm z.val -+ . exact fun z => hgp z.property -+ . exact fun z => hqg z.property -+ . intro a b hab -+ simpa using hab -+ -+ )⟩ -+ -+ -+ apply Prod.ext -+ . -+ rw [Subtype.ext_iff] -+ conv => -+ rhs -+ rw [← hx] -+ simp -+ simp [map_first_hom, map_first_unitary] -+ apply LinearMap.ext -+ intro z -+ apply Subtype.ext -+ simp only [LinearMap.coe_restrict_apply, new, LinearEquiv.apply_symm_apply, -+ LinearMap.ofIsCompl_apply_left, map_first_x_new, map_first, LinearMap.coe_mk, -+ AddHom.coe_mk] -+ . -+ rw [Subtype.ext_iff] -+ conv => -+ rhs -+ rw [← hy] -+ simp -+ simp [map_second_hom, map_second_unitary] -+ simp [map_second] -+ rw [LinearMap.ext_iff] -+ intro z -+ rw [Subtype.ext_iff] -+ simp [new] -+ simp [map_second_y_new, map_second] -+ ) -+ exact ⟨map_first_hom.range, map_second_hom.range, ⟨prod_iso⟩⟩ -+ - -- The rewrites below name their scalar field, source and target explicitly. Left implicit, - -- each would leave a metavariable whose instances sit across a diamond on these spaces - -- (`Submodule`'s subtype/`addCommGroup`/`module` vs the `NormedAddCommGroup`/ - -- `InnerProductSpace` structures), which only reconciles at a raised `maxSynthPendingDepth`. - -- Note the two rewrites in each block act on *different* spaces: the restricted eigenspace - -- and the ambient `EuclideanSpace ℂ (Fin n)`. --set_option maxHeartbeats 4000000 in --set_option synthInstance.maxHeartbeats 100000 in - lemma centralizer_iso {n: ℕ} [hn: NeZero n] (G: Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) (g: G) (g_not: ∀ z: ℂ, g.val.val ≠ z • 1): - Nonempty (IsoData g) := by - -@@ -84,562 +366,34 @@ lemma centralizer_iso {n: ℕ} [hn: NeZero n] (G: Subgroup (Matrix.unitaryGroup - --simp_rw [Module.End.mem_invtSubmodule_iff_forall_mem_of_mem] at other_invariant - - -- let map_first (h: Subgroup.centralizer {g.val}) := h.val.val.toEuclideanLin.restrict (Module.End.mapsTo_genEigenspace_of_comm (f := g.val.val.toEuclideanLin) (g := h.val.val.toEuclideanLin) (by -- apply comm_g_h -- ) k ⊤) -- -- -- let d := (Module.finrank ℂ ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤)) -- let map_first_unitary (h: Subgroup.centralizer {g.val}): Matrix.unitaryGroup (Fin d) ℂ := { -- val := LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤)) (map_first h) -- property := by -- -- -- rw [Matrix.mem_unitaryGroup_iff'] -- -- conv => -- lhs -- lhs -- -- TODO - why does this timeout when not inside 'conv'? -- rw [Matrix.star_eq_conjTranspose] -- -- simp only [LinearMap.toMatrixOrthonormal_apply] -- simp [] -- conv => -- lhs -- lhs -- -- TODO - why does this timeout when not inside 'conv'? -- rw [← LinearMap.toMatrix_adjoint] -- arg 2 -- rw [← LinearMap.toMatrix_mul] -- -- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis -- rw [Matrix.toLin_toMatrix] -- rw [Matrix.toLin_one] -- conv => -- rhs -- equals 1 => -- ext a -- simp -- -- simp [map_first] -- have h_unitary := Unitary.star_mul_self_of_mem h.val.property -- apply_fun Matrix.toEuclideanLin at h_unitary -- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] at h_unitary -- conv at h_unitary => -- lhs -- equals (Matrix.toEuclideanLin (star h.val.val)) ∘ₗ (Matrix.toEuclideanLin (h.val.val)) => -- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- rw [← Matrix.toLin_mul] -- rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] at h_unitary -- rw [Matrix.star_eq_conjTranspose] at h_unitary -- rw [Matrix.toEuclideanLin_conjTranspose_eq_adjoint] at h_unitary -- conv at h_unitary => -- rhs -- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- equals 1 => -- ext z -- simp -- -- apply_fun (fun f => LinearMap.toContinuousLinearMap f) -- simp [-EmbeddingLike.apply_eq_iff_eq] -- conv => -- lhs -- rw [Module.End.mul_eq_comp] -- rw [linearmap_comp_toContinuousLinearMap] -- rw [ContinuousLinearMap.mul_def] -- lhs -- rw [LinearMap.adjoint_toContinuousLinearMap (𝕜 := ℂ) (E := ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤)) (F := ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤))] -- -- conv => -- rhs -- equals 1 => -- ext z -- simp -- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] -- simp only [LinearMap.coe_toContinuousLinearMap'] -- conv => -- intro x -- rw [LinearMap.restrict_apply (by -- apply Module.End.mapsTo_genEigenspace_of_comm (by -- apply comm_g_h -- ) -- )] -- simp -- rw [← LinearMap.coe_toContinuousLinearMap'] -- -- -- apply_fun (fun f => LinearMap.toContinuousLinearMap f) at h_unitary -- simp [-EmbeddingLike.apply_eq_iff_eq] at h_unitary -- conv at h_unitary => -- lhs -- rw [linearmap_comp_toContinuousLinearMap] -- rw [ContinuousLinearMap.mul_def] -- lhs -- rw [LinearMap.adjoint_toContinuousLinearMap (𝕜 := ℂ) (E := EuclideanSpace ℂ (Fin n)) (F := EuclideanSpace ℂ (Fin n))] -- -- conv at h_unitary => -- rhs -- equals 1 => -- ext x -- simp -- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] at h_unitary -+ let d := Module.finrank ℂ ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤) -+ have horth : (Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤ ⟂ -+ (⨆ i : ℂ, ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i) := by -+ change Module.End.maxGenEigenspace _ k ⟂ _ -+ rw [star_normal_maxGenEigenspace_eq_eigenspace (by simp)] -+ conv => -+ rhs -+ arg 1 - intro x -- specialize h_unitary x.val -- exact h_unitary -- . exact LinearEquiv.injective LinearMap.toContinuousLinearMap -- . intro x y hxy -- simpa using hxy -- } -- -- -- let map_first_hom: MonoidHom (Subgroup.centralizer {g.val}) _ := { -- toFun := map_first_unitary -- map_one' := by -- simp [map_first_unitary, map_first] -- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis -- . -- simp -- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- ext a -- rfl -- . intro x y hxy -- simpa using hxy -- map_mul' := by -- intro x y -- simp [map_first_unitary, map_first] -- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis -- . -- simp -- rw [LinearMap.ext_iff] -- intro a -- rw [← LinearMap.toMatrix_mul] -- simp -- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- conv => -- lhs -- arg 1 -- arg 1 -- -- TODO - figure out why toLin_mul doesn't work here -- equals ((Matrix.toLin (EuclideanSpace.basisFun (Fin n) ℂ).toBasis (EuclideanSpace.basisFun (Fin n) ℂ).toBasis) (↑↑↑x)) ∘ₗ (((Matrix.toLin (EuclideanSpace.basisFun (Fin n) ℂ).toBasis (EuclideanSpace.basisFun (Fin n) ℂ).toBasis) (↑↑↑y))) => -- rw [← Matrix.toLin_mul] -- -- rfl -- . intro x y hxy -- simpa using hxy -- } -- -- let first_range := map_first_hom.range -- -- -- let map_second (h: Subgroup.centralizer {g.val}) := h.val.val.toEuclideanLin.restrict -- (p := ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) -- (q := ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) -+ arg 1 -+ intro x -+ rw [star_normal_maxGenEigenspace_eq_eigenspace (by simp)] -+ simp -+ intro i hi -+ apply eigenspace_orthogonal -+ · simp -+ · omega -+ obtain ⟨A, B, ⟨prod_iso⟩⟩ := unitary_centralizer_blocks g.val _ _ a_b_compl horth -+ (fun h => Module.End.mapsTo_genEigenspace_of_comm (comm_g_h h) k ⊤) -+ (fun h => by -+ apply LinearMap.mapsTo_biSup_of_mapsTo -+ intro i -+ exact Module.End.mapsTo_maxGenEigenspace_of_comm (comm_g_h h) i) -+ (Module.End.mapsTo_genEigenspace_of_comm (by simp) k ⊤) - (by -- intro x hx - apply LinearMap.mapsTo_biSup_of_mapsTo -- . -- intro z -- apply Module.End.mapsTo_maxGenEigenspace_of_comm -- apply comm_g_h -- . exact hx -- ) -- -- -- let map_second_unitary (h: Subgroup.centralizer {g.val}): Matrix.unitaryGroup _ ℂ := { -- val := LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) (map_second h) -- property := by -- -- TODO - deduplicate this with 'map_first_unitary' -- rw [Matrix.mem_unitaryGroup_iff'] -- -- conv => -- lhs -- lhs -- -- TODO - why does this timeout when not inside 'conv'? -- rw [Matrix.star_eq_conjTranspose] -- -- simp only [LinearMap.toMatrixOrthonormal_apply] -- simp [] -- conv => -- lhs -- lhs -- -- TODO - why does this timeout when not inside 'conv'? -- rw [← LinearMap.toMatrix_adjoint] -- arg 2 -- rw [← LinearMap.toMatrix_mul] -- -- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis -- rw [Matrix.toLin_toMatrix] -- rw [Matrix.toLin_one] -- conv => -- rhs -- equals 1 => -- ext a -- simp -- -- simp [map_second] -- have h_unitary := Unitary.star_mul_self_of_mem h.val.property -- apply_fun Matrix.toEuclideanLin at h_unitary -- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] at h_unitary -- conv at h_unitary => -- lhs -- equals (Matrix.toEuclideanLin (star h.val.val)) ∘ₗ (Matrix.toEuclideanLin (h.val.val)) => -- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- rw [← Matrix.toLin_mul] -- rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] at h_unitary -- rw [Matrix.star_eq_conjTranspose] at h_unitary -- rw [Matrix.toEuclideanLin_conjTranspose_eq_adjoint] at h_unitary -- conv at h_unitary => -- rhs -- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- equals 1 => -- ext z -- simp -- -- apply_fun (fun f => LinearMap.toContinuousLinearMap f) -- simp [-EmbeddingLike.apply_eq_iff_eq] -- conv => -- lhs -- rw [Module.End.mul_eq_comp] -- rw [linearmap_comp_toContinuousLinearMap] -- rw [ContinuousLinearMap.mul_def] -- lhs -- rw [LinearMap.adjoint_toContinuousLinearMap (𝕜 := ℂ) (E := ↥((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) (F := ↥((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i)))] -- -- conv => -- rhs -- equals 1 => -- ext z -- simp -- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] -- simp only [LinearMap.coe_toContinuousLinearMap'] -- conv => -- intro x -- rw [LinearMap.restrict_apply (by -- apply LinearMap.mapsTo_biSup_of_mapsTo -- intro z -- apply Module.End.mapsTo_maxGenEigenspace_of_comm -- apply comm_g_h -- )] -- simp -- rw [← LinearMap.coe_toContinuousLinearMap'] -- -- -- apply_fun (fun f => LinearMap.toContinuousLinearMap f) at h_unitary -- simp [-EmbeddingLike.apply_eq_iff_eq] at h_unitary -- conv at h_unitary => -- lhs -- rw [linearmap_comp_toContinuousLinearMap] -- rw [ContinuousLinearMap.mul_def] -- lhs -- rw [LinearMap.adjoint_toContinuousLinearMap (𝕜 := ℂ) (E := EuclideanSpace ℂ (Fin n)) (F := EuclideanSpace ℂ (Fin n))] -- -- conv at h_unitary => -- rhs -- equals 1 => -- ext x -- simp -- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] at h_unitary -- intro x -- specialize h_unitary x.val -- exact h_unitary -- . exact LinearEquiv.injective LinearMap.toContinuousLinearMap -- . intro x y hxy -- simpa using hxy -- } -- -- let map_second_hom: MonoidHom (Subgroup.centralizer {g.val}) _ := { -- toFun := map_second_unitary -- -- TODO - deduplicate these with 'map_first_hom' -- map_one' := by -- simp [map_second_unitary, map_second] -- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis -- . -- simp -- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- ext a -- rfl -- . intro x y hxy -- simpa using hxy -- map_mul' := by -- intro x y -- simp [map_second_unitary, map_second] -- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis -- . -- simp -- rw [LinearMap.ext_iff] -- intro a -- rw [← LinearMap.toMatrix_mul] -- simp -- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- conv => -- lhs -- arg 1 -- arg 1 -- -- TODO - figure out why toLin_mul doesn't work here -- equals ((Matrix.toLin (EuclideanSpace.basisFun (Fin n) ℂ).toBasis (EuclideanSpace.basisFun (Fin n) ℂ).toBasis) (↑↑↑x)) ∘ₗ (((Matrix.toLin (EuclideanSpace.basisFun (Fin n) ℂ).toBasis (EuclideanSpace.basisFun (Fin n) ℂ).toBasis) (↑↑↑y))) => -- rw [← Matrix.toLin_mul] -- -- rfl -- . intro x y hxy -- simpa using hxy -- } -- -- let prod_hom := MonoidHom.prod map_first_hom.rangeRestrict map_second_hom.rangeRestrict -- let prod_iso := MulEquiv.ofBijective prod_hom (by -- unfold Function.Bijective -- refine ⟨?_, ?_⟩ -- . -- -- TODO - this can probably be much simpler -- simp [prod_hom] -- intro x y hxy -- simp at hxy -- obtain ⟨first_eq, second_eq⟩ := hxy -- -- let map_first_x_new: ((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { -- toFun := fun a => map_first x a -- map_add' := by simp -- map_smul' := by simp -- } -- -- let map_second_x_new: ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i)) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { -- toFun := fun a => map_second x a -- map_add' := by simp -- map_smul' := by simp -- } -- -- let x_map := LinearMap.ofIsCompl a_b_compl (map_first_x_new) (map_second_x_new) -- -- let map_first_y_new: ((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { -- toFun := fun a => map_first y a -- map_add' := by simp -- map_smul' := by simp -- } -- -- let map_second_y_new: ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i)) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { -- toFun := fun a => map_second y a -- map_add' := by simp -- map_smul' := by simp -- } -- -- let y_map := LinearMap.ofIsCompl a_b_compl (map_first_y_new) (map_second_y_new) -- -- have first_eq_second: x_map = y_map := by -- simp [x_map] -- apply LinearMap.ofIsCompl_eq -- . intro z -- simp [y_map] -- simp [map_first_x_new, map_first_y_new] -- apply_fun (fun f => f.val) at first_eq -- simp at first_eq -- simp [map_first_hom, map_first_unitary] at first_eq -- rw [first_eq] -- . intro z -- simp [y_map] -- simp [map_second_x_new, map_second_y_new] -- apply_fun (fun f => f.val) at second_eq -- simp at second_eq -- simp [map_second_hom, map_second_unitary] at second_eq -- congr -- -- -- have x_map_eq: x_map = x.val.val.toEuclideanLin := by -- simp [x_map] -- apply LinearMap.ofIsCompl_eq -- . intro z -- rfl -- . intro z -- rfl -- -- have y_map_eq: y_map = y.val.val.toEuclideanLin := by -- simp [y_map] -- apply LinearMap.ofIsCompl_eq -- . intro z -- rfl -- . intro z -- rfl -- -- -- rw [x_map_eq, y_map_eq] at first_eq_second -- simp at first_eq_second -- exact first_eq_second -- . -- intro a -- have first_prop := a.fst.property -- have second_prop := a.snd.property -- simp only [prod_hom] -- rw [MonoidHom.mem_range] at first_prop -- rw [MonoidHom.mem_range] at second_prop -- -- obtain ⟨x, hx⟩ := first_prop -- obtain ⟨y, hy⟩ := second_prop -- -- let map_first_x_new: ((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { -- toFun := fun a => map_first x a -- map_add' := by simp -- map_smul' := by simp -- } -- -- let map_second_y_new: ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i)) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { -- toFun := fun a => map_second y a -- map_add' := by simp -- map_smul' := by simp -- } -- -- have map_first_x_unitary: (ContinuousLinearMap.adjoint (𝕜 := ℂ) (E := ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤)) (F := EuclideanSpace ℂ (Fin n)) map_first_x_new.toContinuousLinearMap).comp map_first_x_new.toContinuousLinearMap = 1 := by -- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] -- intro z -- simp [map_first_x_new, map_first] -- apply unitary_preserves_norm -- -- apply_fun (fun f => f.toLinearMap) at map_first_x_unitary -- simp at map_first_x_unitary -- -- have map_second_y_unitary: (ContinuousLinearMap.adjoint (𝕜 := ℂ) (E := ↥((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) (F := EuclideanSpace ℂ (Fin n)) map_second_y_new.toContinuousLinearMap).comp map_second_y_new.toContinuousLinearMap = 1 := by -- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] -- intro z -- simp [map_second_y_new, map_second] -- apply unitary_preserves_norm -- -- apply_fun (fun f => f.toLinearMap) at map_second_y_unitary -- simp at map_second_y_unitary -- -- let new := LinearMap.ofIsCompl a_b_compl map_first_x_new map_second_y_new -- use ⟨⟨(Matrix.toEuclideanLin.symm new), (by -- simp [Matrix.mem_unitaryGroup_iff'] -- apply_fun (fun f => Matrix.toEuclideanLin f) -- . simp [-EmbeddingLike.apply_eq_iff_eq, new] -- rw [Matrix.star_eq_conjTranspose] -- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- simp -- rw [← LinearMap.toMatrix_adjoint] -- simp -- -- -- conv => -- rhs -- equals 1 => -- ext z -- simp -- -- -- apply ofIsCompl_adjoint_comp -- . -- rw [star_normal_maxGenEigenspace_eq_eigenspace (by simp)] -- conv => -- rhs -- arg 1 -- intro x -- arg 1 -- intro x -- rw [star_normal_maxGenEigenspace_eq_eigenspace (by simp)] -- simp -- intro i hi -- apply eigenspace_orthogonal -- . simp -- . omega -- . -- apply map_first_x_unitary -- . intro v -- exact (map_first x v).2 -- . -- apply map_second_y_unitary -- . intro v -- exact (map_second y v).2 -- . intro x y hxy -- simpa using hxy -- )⟩, (by -- rw [Subgroup.mem_centralizer_iff] -- simp -- apply_fun (fun f => Matrix.toEuclideanLin f.val) -- simp only [] -- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- simp only [Matrix.toLin_symm, Submonoid.coe_mul] -- rw [Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun (Fin n) ℂ).toBasis )] -- simp -- rw [Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun (Fin n) ℂ).toBasis )] -- simp [new] -- rw [eq_comm] -- apply ofIsCompl_commute -- . -- intro z -- simp [map_first_x_new, map_first] -- simp_rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] -- have x_prop := x.property -- rw [Subgroup.mem_centralizer_iff] at x_prop -- simp at x_prop -- rw [Subtype.ext_iff] at x_prop -- simp at x_prop -- show (Matrix.toEuclideanLin (↑↑x : Matrix (Fin n) (Fin n) ℂ)) -- ((Matrix.toEuclideanLin (↑↑g : Matrix (Fin n) (Fin n) ℂ)) (↑z : EuclideanSpace ℂ (Fin n))) -- = (Matrix.toEuclideanLin (↑↑g : Matrix (Fin n) (Fin n) ℂ)) -- ((Matrix.toEuclideanLin (↑↑x : Matrix (Fin n) (Fin n) ℂ)) (↑z : EuclideanSpace ℂ (Fin n))) -- simp only [Matrix.toEuclideanLin_apply, WithLp.ofLp_toLp, Matrix.mulVec_mulVec] -- rw [x_prop] -- . -- intro z -- simp [map_second_y_new, map_second] -- simp_rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] -- rw [Matrix.toEuclideanLin_apply] -- rw [Matrix.toEuclideanLin_apply] -- rw [Matrix.toEuclideanLin_apply] -- rw [Matrix.toEuclideanLin_apply] -- simp -- have y_prop := y.property -- rw [Subgroup.mem_centralizer_iff] at y_prop -- simp at y_prop -- rw [Subtype.ext_iff] at y_prop -- simp at y_prop -- rw [y_prop] -- . -- intro z -- apply Module.End.mapsTo_maxGenEigenspace_of_comm -- rw [commute_iff_eq] -- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- simp -- . -- intro x -- apply LinearMap.mapsTo_biSup_of_mapsTo -- . -- intro z -- apply Module.End.mapsTo_maxGenEigenspace_of_comm -- rw [commute_iff_eq] -- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] -- . simp -- . intro a b hab -- simpa using hab -- -- )⟩ -- -- -- apply Prod.ext -- . -- rw [Subtype.ext_iff] -- conv => -- rhs -- rw [← hx] -- simp -- simp [map_first_hom, map_first_unitary] -- apply LinearMap.ext -- intro z -- apply Subtype.ext -- simp only [LinearMap.restrict_coe_apply, new, LinearEquiv.apply_symm_apply, -- LinearMap.ofIsCompl_apply_left, map_first_x_new, map_first, LinearMap.coe_mk, -- AddHom.coe_mk] -- . -- rw [Subtype.ext_iff] -- conv => -- rhs -- rw [← hy] -- simp -- simp [map_second_hom, map_second_unitary] -- simp [map_second] -- rw [LinearMap.ext_iff] -- intro z -- rw [Subtype.ext_iff] -- simp [new] -- simp [map_second_y_new, map_second] -- ) -+ intro i -+ exact Module.End.mapsTo_maxGenEigenspace_of_comm (by simp) i) - -- Submodule.finrank_add_eq_of_isCompl - - -@@ -676,9 +430,8 @@ lemma centralizer_iso {n: ℕ} [hn: NeZero n] (G: Subgroup (Matrix.unitaryGroup - apply Submodule.finrank_lt at gen_eigenspace_top - rw [sum_eq] at gen_eigenspace_top - simp at gen_eigenspace_top -- A := _ -- B := _ -+ A := A -+ B := B - iso := prod_iso - } - --#print axioms centralizer_iso -diff --git a/Gromov/ToMathlib/Data/List/Infix.lean b/Gromov/ToMathlib/Data/List/Infix.lean -index aa5c209..d5a4ed5 100644 ---- a/Gromov/ToMathlib/Data/List/Infix.lean -+++ b/Gromov/ToMathlib/Data/List/Infix.lean -@@ -167,4 +167,3 @@ lemma list_adjacent_elements {A: Type*} (l: List A) (p: A → Bool) (n : ℕ): - rw [Nat.one_le_div_iff hn] - omega - --#print axioms list_adjacent_elements -diff --git a/Gromov/ToMathlib/GroupTheory/Closure.lean b/Gromov/ToMathlib/GroupTheory/Closure.lean -index 58aa14c..d01b3f7 100644 ---- a/Gromov/ToMathlib/GroupTheory/Closure.lean -+++ b/Gromov/ToMathlib/GroupTheory/Closure.lean -@@ -12,7 +12,6 @@ public section - - open scoped Pointwise Finset - --set_option maxHeartbeats 300000 in - lemma closure_iterate_mulact {T: Type*} [Group T] [DecidableEq T] (a b: T) (n: ℤ) - (conj_in: (a^n * b * a^(-n)) ∈ (Subgroup.closure (G := T) (Set.image (fun (m: ℤ) => a^m * b * a^(-m)) (Set.Ioo (-n.natAbs) n.natAbs)))) - (conj_inv_in: (a^(-n) * b * a^(n)) ∈ (Subgroup.closure (G := T) (Set.image (fun (m: ℤ) => a^m * b * a^(-m)) (Set.Ioo (-n.natAbs) n.natAbs)))) : -@@ -316,7 +315,6 @@ lemma closure_iterate_mulact {T: Type*} [Group T] [DecidableEq T] (a b: T) (n: - | inv y hy y_mem => - apply Subgroup.inv_mem _ y_mem - --#print axioms closure_iterate_mulact - - namespace Subgroup - -@@ -390,7 +388,6 @@ lemma closure_set_union_normal {G: Type*} [Group G] (S: Set G) (N: Subgroup G) ( - simp - group - --#print axioms closure_set_union_normal - - -- TODO - deduplicate with with 'mem_S_prod_list' - lemma mem_closure_prod_list {G: Type*} [Group G] (S: Set G) (S_eq_Sinv: S = S⁻¹) (x: G) (hx: x ∈ Subgroup.closure S): ∃ l: List S, l.unattach.prod = x := by -diff --git a/Gromov/ToMathlib/LinearAlgebra/Matrix/Det.lean b/Gromov/ToMathlib/LinearAlgebra/Matrix/Det.lean -index f9574a1..ce1739e 100644 ---- a/Gromov/ToMathlib/LinearAlgebra/Matrix/Det.lean -+++ b/Gromov/ToMathlib/LinearAlgebra/Matrix/Det.lean -@@ -7,17 +7,12 @@ public import Gromov.ToMathlib.LinearAlgebra.Matrix.ToMatrix - /-! - # Determinants of matrices of bilinear forms - --General-purpose material extracted from the Gromov development, destined for mathlib. -+Basis changes preserve determinant ratios; positive semidefinite comparison -+controls determinants of positive definite matrices. - -/ - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false -- - open scoped Finset - open scoped Pointwise - -@@ -50,19 +45,19 @@ theorem LinearMap.toMatrix₂_det_basis_change {M ι κ : Type*} [AddCommGroup M - Matrix.det_mul, Matrix.det_mul, Matrix.det_transpose, ← Module.Basis.det_apply] - ring - -- - open MatrixOrder in --lemma matrix_det_montone {n: Type*} [Fintype n] [DecidableEq n] (A B: Matrix n n ℝ) (hb: B.PosDef) (hab: (A - B).PosSemidef): B.det ≤ A.det := by -- -- have invert_sqrt: Invertible (CFC.sqrt B) := by -+lemma matrix_det_montone {n : Type*} [Fintype n] [DecidableEq n] -+ (A B : Matrix n n ℝ) (hb : B.PosDef) (hab : (A - B).PosSemidef) : -+ B.det ≤ A.det := by -+ have invert_sqrt : Invertible (CFC.sqrt B) := by - apply Matrix.invertibleOfIsUnitDet - rw [Matrix.PosSemidef.det_sqrt hb.posSemidef] - simp - rw [← ne_eq, Real.sqrt_ne_zero] -- . grind [hb.det_pos] -- . grind [hb.det_pos] -+ · grind [hb.det_pos] -+ · grind [hb.det_pos] - -- have det_prod_eq: A.det = B.det * ((CFC.sqrt B)⁻¹ * (A - B) * (CFC.sqrt B)⁻¹ + 1).det := by -+ have det_prod_eq : A.det = B.det * ((CFC.sqrt B)⁻¹ * (A - B) * (CFC.sqrt B)⁻¹ + 1).det := by - conv => - lhs - arg 1 -@@ -73,7 +68,7 @@ lemma matrix_det_montone {n: Type*} [Fintype n] [DecidableEq n] (A B: Matrix n n - rw [Matrix.det_mul] - rw [← mul_assoc, ← mul_assoc] - rw [Matrix.det_mul] -- ring -+ ring_nf - rw [hb.posSemidef.det_sqrt] - simp only [RCLike.sqrt_real] - rw [Real.sq_sqrt (by grind [hb.det_pos])] -@@ -93,7 +88,7 @@ lemma matrix_det_montone {n: Type*} [Fintype n] [DecidableEq n] (A B: Matrix n n - - rw [det_prod_eq] - rw [le_mul_iff_one_le_right] -- . -+ · - apply matrix_psd_det_one - rw [hb.posSemidef.inv_sqrt] - have foo := (CFC.sqrt_nonneg B⁻¹) -@@ -102,17 +97,17 @@ lemma matrix_det_montone {n: Type*} [Fintype n] [DecidableEq n] (A B: Matrix n n - nth_rw 2 [← foo.isHermitian.eq] - apply Matrix.PosSemidef.mul_mul_conjTranspose_same - exact hab -- . apply hb.det_pos -+ · apply hb.det_pos - ---- TODO - upstream. Mathlib only has `Finset.sum_biUnion` (which needs `PairwiseDisjoint`) ---- and the `ENNReal` `tsum` versions. --theorem Finset.sum_biUnion_le {κ α : Type*} [DecidableEq α] {s: Finset κ} {t: κ → Finset α} -- {f: α → ℝ} (hf: ∀ x, 0 ≤ f x): ∑ x ∈ s.biUnion t, f x ≤ ∑ i ∈ s, ∑ x ∈ t i, f x := by -+/-- The sum over a finite union is bounded by the sum over its possibly -+overlapping members when all summands are nonnegative. -/ -+theorem Finset.sum_biUnion_le {κ α : Type*} [DecidableEq α] {s : Finset κ} {t : κ → Finset α} -+ {f : α → ℝ} (hf : ∀ x, 0 ≤ f x) : ∑ x ∈ s.biUnion t, f x ≤ ∑ i ∈ s, ∑ x ∈ t i, f x := by - classical - induction s using Finset.induction with - | empty => simp - | insert a s ha ih => - rw [Finset.biUnion_insert, Finset.sum_insert ha] - have hunion := Finset.sum_union_inter (s₁ := t a) (s₂ := s.biUnion t) (f := f) -- have hnn: 0 ≤ ∑ x ∈ t a ∩ s.biUnion t, f x := Finset.sum_nonneg fun x _ => hf x -+ have hnn : 0 ≤ ∑ x ∈ t a ∩ s.biUnion t, f x := Finset.sum_nonneg fun x _ => hf x - linarith -diff --git a/Gromov/ToMathlib/LinearAlgebra/Matrix/PosDef.lean b/Gromov/ToMathlib/LinearAlgebra/Matrix/PosDef.lean -index f074374..76cb7dc 100644 ---- a/Gromov/ToMathlib/LinearAlgebra/Matrix/PosDef.lean -+++ b/Gromov/ToMathlib/LinearAlgebra/Matrix/PosDef.lean -@@ -29,7 +29,7 @@ lemma matrix_psd_det_one {n: Type*} [Fintype n] [DecidableEq n] (A: Matrix n n - rw [← Matrix.diagonal_one'] - rw [Matrix.diagonal_add] - simp -- apply Finset.one_le_prod -+ apply Finset.one_le_prod₀ - intro i _ - have foo := ha.eigenvalues_nonneg - grind -diff --git a/Gromov/Unipotent/Commutator.lean b/Gromov/Unipotent/Commutator.lean -index 394e1e4..9a0f3b3 100644 ---- a/Gromov/Unipotent/Commutator.lean -+++ b/Gromov/Unipotent/Commutator.lean -@@ -17,9 +17,6 @@ public import Gromov.ToMathlib.Order.Prod.Lex - - public section - --set_option linter.style.longLine false --set_option linter.style.commandStart false --set_option linter.style.cdot false - - open scoped commutatorElement IsMulCommutative Pointwise - -@@ -45,7 +42,7 @@ lemma iterate_comm_set_eq_fold {G: Type*} [Group G] [DecidableEq G] (S: Finset G - ext g - simp - refine ⟨?_, ?_⟩ -- . -+ · - intro h - obtain ⟨s, s_mem, ⟨x, x_mem, comm_eq⟩⟩ := h - rw [← Finset.mem_coe] at x_mem -@@ -56,12 +53,12 @@ lemma iterate_comm_set_eq_fold {G: Type*} [Group G] [DecidableEq G] (S: Finset G - refine ⟨t_mem, ?_⟩ - use (⟨s, s_mem⟩ :: l) - refine ⟨?_, ?_⟩ -- . grind -- . -+ · grind -+ · - simp - rw [← comm_eq] - rw [← l_fold_eq] -- . -+ · - intro h - obtain ⟨t, t_mem, l, l_len, l_fold_eq⟩ := h - have l_len_eq := l_len -@@ -84,16 +81,15 @@ lemma iterate_comm_set_eq_fold {G: Type*} [Group G] [DecidableEq G] (S: Finset G - - use List.foldr (fun x b ↦ ⁅b, x⁆) t tail.unattach - refine ⟨?_, ?_⟩ -- . -+ · - rw [← Finset.mem_coe] - rw [ih] - simp - use t - refine ⟨t_mem, ?_⟩ - use tail -- . exact l_fold_eq -+ · exact l_fold_eq - --#print axioms iterate_comm_set_eq_fold - - - lemma comm_prod {G: Type*} [Group G] (x y z: G): ⁅x * y, z⁆ = ⁅x, ⁅y, z⁆⁆ * ⁅y, z⁆ * ⁅x, z⁆ := by -@@ -129,12 +125,12 @@ lemma double_comm_mem {G: Type*} [DecidableEq G] [Group G] (S: Finset G) {l': G - simp - apply Subgroup.mem_closure_of_mem - apply Set.mem_union_right -- simp [mem_lowerCentralSeries_succ_iff] -+ simp - apply Subgroup.mem_closure_of_mem - simp - use ⁅g'.val, l'⁆ - refine ⟨?_, ?_⟩ -- . -+ · - - rw [← Subgroup.inv_mem_iff] - simp -@@ -142,27 +138,26 @@ lemma double_comm_mem {G: Type*} [DecidableEq G] [Group G] (S: Finset G) {l': G - simp - use l' - refine ⟨?_, ?_⟩ -- . rw [ih] -+ · rw [ih] - simp at l'_mem - cases l'_mem -- . -+ · - rename_i l'_mem_forward - apply Subgroup.mem_closure_of_mem - apply Set.mem_union_left - exact l'_mem_forward -- . rename_i l'_mem_inv -+ · rename_i l'_mem_inv - rw [← Subgroup.closure_inv] - apply Subgroup.mem_closure_of_mem - simp - left - exact l'_mem_inv -- . -+ · - use g' -- . -+ · - use l'⁻¹ - - --set_option maxHeartbeats 400000 in - lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} (n: ℕ) (ih: (⊤ : Subgroup G).lowerCentralSeries n = Subgroup.closure (iterate_comm_set (S ∪ S⁻¹) n ∪ ↑((⊤ : Subgroup G).lowerCentralSeries (n + 1)))) (g': ↑(S ∪ S⁻¹)) (l'_mem_comm: l' ∈ iterate_comm_set (S ∪ S⁻¹) n ∨ l'⁻¹ ∈ iterate_comm_set (S ∪ S⁻¹) n): ⁅l'⁻¹, ⁅g'.val, l'⁆⁆ * ⁅g'.val, l'⁆ ∈ Subgroup.closure (iterate_comm_set (S ∪ S⁻¹) (n + 1) ∪ ↑((⊤ : Subgroup G).lowerCentralSeries (n + 1 + 1))) := by - - -@@ -171,36 +166,36 @@ lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} - - - cases l'_mem_comm -- . -+ · - rw [← Subgroup.inv_mem_iff] - simp - rename_i l'_mem -- . apply Subgroup.mul_mem -- . -+ · apply Subgroup.mul_mem -+ · - apply Subgroup.mem_closure_of_mem - apply Set.mem_union_left - simp [iterate_comm_set] - use g' - refine ⟨by simpa using g'_prop, ?_⟩ - use l' -- . -+ · - rw [← Subgroup.inv_mem_iff] - simp - apply double_comm_mem -- . exact ih -- . simp [l'_mem] -+ · exact ih -+ · simp [l'_mem] - -- . -+ · - - rename_i l'_inv_mem -- . apply Subgroup.mul_mem -- . -+ · apply Subgroup.mul_mem -+ · - apply double_comm_mem - exact ih - simp [l'_inv_mem] - - -- . -+ · - rw [← Subgroup.inv_mem_iff] - simp - conv => -@@ -211,7 +206,7 @@ lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} - rw [comm_first_inv] - simp - apply Subgroup.mul_mem -- . -+ · - have foo := double_comm_mem (l' := l'⁻¹ ) _ _ ih g' (by - simp - left -@@ -219,7 +214,7 @@ lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} - ) - simp at foo - exact foo -- . -+ · - rw [← Subgroup.inv_mem_iff] - simp - apply Subgroup.mem_closure_of_mem -@@ -231,11 +226,9 @@ lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} - use l'⁻¹ - - --#print axioms triple_comm_mem - -- Lemma 13.44. in https://www.math.ucdavis.edu/~kapovich/EPR/ggt.pdf - -- Note - the book seems to implicitly assume that the generating set is symmetric - --set_option maxHeartbeats 400000 in - lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Finset G) (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - (⊤ : Subgroup G).lowerCentralSeries n = Subgroup.closure ((iterate_comm_set (S ∪ S⁻¹) n) ∪ ↑((⊤ : Subgroup G).lowerCentralSeries (n + 1))) := by - induction n with -@@ -247,9 +240,9 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - | succ n ih => - ext a - refine ⟨?_, ?_⟩ -- . -+ · - intro ha -- rw [mem_lowerCentralSeries_succ_iff] at ha -+ rw [Subgroup.mem_lowerCentralSeries_succ_iff] at ha - apply (Subgroup.closure_le _).mp ?_ ha - simp - intro p hp -@@ -266,7 +259,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - rw [comm_prod] - - have x_comm_mem: ⁅x.val, g⁆ ∈ (⊤ : Subgroup G).lowerCentralSeries (n + 1 + 1) := by -- rw [mem_lowerCentralSeries_succ_iff] -+ rw [Subgroup.mem_lowerCentralSeries_succ_iff] - apply Subgroup.mem_closure_of_mem - simp - use x -@@ -274,8 +267,8 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - - - apply Subgroup.mul_mem -- . apply Subgroup.mul_mem -- . -+ · apply Subgroup.mul_mem -+ · - - conv => - arg 2 -@@ -284,25 +277,25 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - - - apply Subgroup.mul_mem -- . -+ · - apply Subgroup.mem_closure_of_mem - apply Set.mem_union_right - simp - apply Subgroup.Normal.conj_mem -- . infer_instance -- . exact x_comm_mem -- . -+ · infer_instance -+ · exact x_comm_mem -+ · - apply Subgroup.mem_closure_of_mem - apply Set.mem_union_right - simp only [SetLike.mem_coe] - rw [Subgroup.inv_mem_iff] - apply x_comm_mem -- . -+ · - apply Subgroup.mem_closure_of_mem - apply Set.mem_union_right - simp only [SetLike.mem_coe] - apply x_comm_mem -- . -+ · - obtain ⟨g_list, g_prod⟩ := new_mem_S_prod_list (S := S) (x := g) (by simp [hS]) - --clear ha a p_eq_comm p c_prod c_mem c x_comm_mem - rw [← g_prod] -@@ -319,20 +312,20 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - - - by_cases g_list_zero: g_list.length = 0 -- . simp at g_list_zero -+ · simp at g_list_zero - simp [g_list_zero] -- . -+ · - simp at g_list_zero - - - by_cases l_len_ne_zero: l.unattach.length = 0 -- . have l_empty: l.unattach = [] := by -+ · have l_empty: l.unattach = [] := by - exact List.eq_nil_iff_length_eq_zero.mpr l_len_ne_zero - simp [l_empty] - - - by_cases both_eq_one: g_list.length = 1 ∧ l.unattach.length = 1 -- . -+ · - obtain ⟨g_len_one, l_len_one⟩ := both_eq_one - obtain ⟨g', h_g'⟩ := List.length_eq_one_iff.mp g_len_one - obtain ⟨l', h_l'⟩ := List.length_eq_one_iff.mp l_len_one -@@ -369,7 +362,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - - rw [not_and_or] at both_eq_one - cases both_eq_one -- . rename_i g_len_ne_one -+ · rename_i g_len_ne_one - - have g_len_ne_zero: g_list.length ≠ 0 := by - simp -@@ -385,16 +378,16 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - rw [List.unattach_append] - simp - rw [comm_prod_right] -- . apply Subgroup.mul_mem -- . apply Subgroup.mul_mem -- . -+ · apply Subgroup.mul_mem -+ · apply Subgroup.mul_mem -+ · - - have prev := hk k (by simp) l (List.take (g_list.length - 1) g_list) (by - simp - omega - ) - exact prev -- . -+ · - - - rw [← Subgroup.inv_mem_iff] -@@ -409,10 +402,10 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - simp at hx - obtain ⟨x_mem, x_subtype_mem⟩ := hx - cases x_mem -- . rename_i x_mem_forward -+ · rename_i x_mem_forward - apply Subgroup.mem_closure_of_mem - grind -- . rename_i x_mem_inv -+ · rename_i x_mem_inv - rw [← Subgroup.closure_inv] - apply Subgroup.mem_closure_of_mem - simp -@@ -421,7 +414,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - exact Subgroup.commutator_mem_commutator - (Subgroup.commutator_mem_commutator l_prod_mem (Subgroup.mem_top _)) - (Subgroup.mem_top _) -- . -+ · - - have prev := hk (l.length + 1) (by omega) l [(g_list.getLast g_list_zero)] (by - simp -@@ -430,7 +423,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - simp at prev - exact prev - -- . -+ · - rename_i l_len_ne_one - simp at l_len_ne_one - have l_ne_zero: l.length ≠ 0 := by -@@ -447,8 +440,8 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - rw [comm_prod] - simp at h_len - apply Subgroup.mul_mem -- . apply Subgroup.mul_mem -- . -+ · apply Subgroup.mul_mem -+ · - rw [← Subgroup.inv_mem_iff] - simp - apply Subgroup.mem_closure_of_mem -@@ -460,10 +453,10 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - have l_prop := (l.getLast (by simpa using l_ne_zero)).prop - rw [Set.mem_union] at l_prop - cases l_prop -- . rename_i l_prop_forward -+ · rename_i l_prop_forward - apply Subgroup.mem_closure_of_mem - grind -- . rename_i l_prop_inv -+ · rename_i l_prop_inv - rw [← Subgroup.closure_inv] - simp - apply Subgroup.mem_closure_of_mem -@@ -471,12 +464,12 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - exact Subgroup.commutator_mem_commutator - (Subgroup.commutator_mem_commutator last_mem (Subgroup.mem_top _)) - (Subgroup.mem_top _) -- . -+ · - - have foo := hk (g_list.length + 1) (by omega) [l.getLast (by simpa using l_ne_zero)] g_list (by simp) - simp at foo - exact foo -- . -+ · - have foo := hk k (by simp) (List.take (l.length - 1) l) g_list (by - simp - omega -@@ -484,7 +477,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - exact foo - - intro ha -- rw [mem_lowerCentralSeries_succ_iff] -+ rw [Subgroup.mem_lowerCentralSeries_succ_iff] - - - have closure_le: (Subgroup.closure ((iterate_comm_set (S ∪ S⁻¹) (n + 1)) ∪ ↑((⊤ : Subgroup G).lowerCentralSeries (n + 1 + 1)))) ≤ (Subgroup.closure {x | ∃ p ∈ (⊤ : Subgroup G).lowerCentralSeries n, ∃ q ∈ (⊤ : Subgroup G), ⁅p, q⁆ = x}) := by -@@ -492,7 +485,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - intro x hx - simp at hx - cases hx -- . -+ · - rename_i x_mem_comm - apply Subgroup.mem_closure_of_mem - simp -@@ -501,19 +494,18 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins - obtain ⟨s, s_mem, ⟨c, c_mem, c_comm⟩⟩ := x_mem_comm - use c - refine ⟨?_, ?_⟩ -- . apply Subgroup.mem_closure_of_mem -+ · apply Subgroup.mem_closure_of_mem - grind -- . use s -- . -+ · use s -+ · - rename_i x_mem_lower_two - have x_mem_lower_succ: x ∈ (⊤ : Subgroup G).lowerCentralSeries (n + 1) := - Subgroup.commutator_le_left _ _ x_mem_lower_two - - -- rw [mem_lowerCentralSeries_succ_iff] at x_mem_lower_succ -+ rw [Subgroup.mem_lowerCentralSeries_succ_iff] at x_mem_lower_succ - simpa using x_mem_lower_succ - - - apply closure_le ha - --#print axioms lower_central_generates_succ -diff --git a/Gromov/Unipotent/FG.lean b/Gromov/Unipotent/FG.lean -index 6a68e4d..f39faa3 100644 ---- a/Gromov/Unipotent/FG.lean -+++ b/Gromov/Unipotent/FG.lean -@@ -12,9 +12,6 @@ the supporting transfer lemmas along homomorphisms. - - public section - --set_option linter.style.longLine false --set_option linter.style.commandStart false --set_option linter.style.cdot false - - open scoped commutatorElement IsMulCommutative Pointwise - -@@ -38,10 +35,10 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - grw [closure_le] - apply Subgroup.closure_le_normalClosure - | succ n ih => -- simp [lowerCentralSeries] -+ simp - rw [le_antisymm_iff] - refine ⟨?_, ?_⟩ -- . -+ · - simp [Subgroup.normalClosure] - intro y hy - simp [Group.conjugatesOfSet, iterate_comm_set] at hy -@@ -50,10 +47,10 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - obtain ⟨x, x_mem⟩ := c_comm - rw [← x_mem] - apply Subgroup.Normal.conj_mem -- . infer_instance -- . -+ · infer_instance -+ · - apply Subgroup.commutator_mem_commutator -- . -+ · - rw [← ih] - apply Subgroup.mem_closure_of_mem - simp [Group.conjugatesOfSet] -@@ -62,8 +59,8 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - simp [conjugatesOf] - use 1 - simp -- . simp -- . -+ · simp -+ · - - have image_commute: ∀ s ∈ S, ∀ g ∈ (iterate_comm_set (S) n), QuotientGroup.mk' (((Subgroup.normalClosure (iterate_comm_set (S) (n + 1))))) (s * g) = QuotientGroup.mk' (((Subgroup.normalClosure (iterate_comm_set (S) (n + 1))))) (g * s) := by - intro s hs g hg -@@ -80,13 +77,13 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - simp only [conjugatesOf] - use g * s * g⁻¹ * s⁻¹ - refine ⟨?_, ?_⟩ -- . simp [iterate_comm_set] -+ · simp [iterate_comm_set] - use s - refine ⟨by simp [hs], ?_⟩ - use g - refine ⟨hg, ?_⟩ - simp [Bracket.bracket] -- . -+ · - simp - use s⁻¹ * g⁻¹ - group -@@ -113,7 +110,7 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - - -- TODO - figure out how to get the 'induction' tactic working here - apply Subgroup.closure_induction (p := fun y hy => a⁻¹ * y⁻¹ * (a * y) ∈ Subgroup.normalClosure (iterate_comm_set (S) (n + 1))) (hx := b_mem_top) -- . -+ · - intro s hs - have comm := image_commute s hs a a_mem - simp at comm -@@ -122,24 +119,24 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - rw [QuotientGroup.eq] at comm - simp at comm - exact comm -- . simp -- . intro y hy z hz y_mem z_mem -+ · simp -+ · intro y hy z hz y_mem z_mem - simp - conv => - arg 2 - equals (a⁻¹ * hy⁻¹ * a * hy) * (hy⁻¹ * a⁻¹ * y⁻¹ * a * y * hy) => - group - apply Subgroup.mul_mem -- . group -+ · group - group at z_mem - exact z_mem -- . -+ · - have foo := (Subgroup.normalClosure_normal).conj_mem _ y_mem hy⁻¹ - simp at foo - group at foo - group - exact foo -- . -+ · - intro y hy y_mem - rw [← Subgroup.inv_mem_iff] - simp -@@ -158,7 +155,7 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - rw [ih] at normal_le_center - simp - have a_mem_center := @normal_le_center a⁻¹ ?_ -- . -+ · - rw [Subgroup.mem_center_iff] at a_mem_center - specialize a_mem_center (QuotientGroup.mk b⁻¹) - rw [← QuotientGroup.mk_inv] at a_mem_center -@@ -170,14 +167,13 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): - group at a_mem_center - group - exact a_mem_center -- . simp -+ · simp - use a - - - simp - exact QuotientGroup.mk_surjective - --#print axioms iterate_comm_generates - - -- Lemma 13.55 from https://www.math.ucdavis.edu/~kapovich/EPR/ggt.pdf - lemma comm_trivial_implies_nilpotent {G: Type*} [DecidableEq G] [Group G] (S: Finset G) (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ) (h_comm: iterate_comm_set (S) (n) = {1}): -@@ -201,8 +197,8 @@ lemma normal_comm_mem {G: Type*} [Group G] {N: Subgroup G} (N_normal: N.Normal) - equals a * (b * a⁻¹ * b⁻¹) => group - - apply Subgroup.mul_mem -- . exact ha -- . exact conj_mem -+ · exact ha -+ · exact conj_mem - - - -- TODO - cleanup and upstream to mathlib -@@ -253,16 +249,16 @@ lemma fg_extension {A: Type*} [Group A] (N: Subgroup A) [N.Normal] (hN: N.FG) (h - rw [SQ_eq] at hS_Q - use S_N ∪ SQ_out - refine ⟨?_, ?_⟩ -- . -+ · - simp [SQ_out] - rw [Subgroup.closure_union] - simp [hS_N] - ext a - simp - by_cases mem_N: a ∈ N -- . apply Subgroup.mem_sup_left -+ · apply Subgroup.mem_sup_left - exact mem_N -- . -+ · - let a_map: (A ⧸ N) := a - have a_mem_top: a_map ∈ (⊤ : Subgroup (A ⧸ N)) := by - simp -@@ -277,14 +273,14 @@ lemma fg_extension {A: Type*} [Group A] (N: Subgroup A) [N.Normal] (hN: N.FG) (h - have a_eq := hk.2 - rw [QuotientGroup.eq] at a_eq - rw [← Subgroup.mul_mem_cancel_left (x := k⁻¹)] -- . -+ · - apply Subgroup.mem_sup_left - exact a_eq -- . apply Subgroup.mem_sup_right -+ · apply Subgroup.mem_sup_right - simp - exact hk.1 - -- . simp -+ · simp - - lemma fg_domain_of_ker_range {A B: Type*} [Group A] [Group B] (f : A →* B) (hA: Subgroup.FG f.ker) (hB: Subgroup.FG f.range): Group.FG A := by - have new_fg := fg_extension (f.ker) hA -@@ -300,7 +296,6 @@ lemma Group.FG.of_mulEquiv {G H : Type*} [Group G] [Group H] (e : G ≃* H) (h : - haveI := h - Group.fg_of_surjective (f := e.toMonoidHom) e.surjective - --set_option maxHeartbeats 5000000 in - lemma fg_of_subgroup_fg_nilpotent {A: Type*} [DecidableEq A] [Group A] [Group.IsNilpotent A] (A_fg: Group.FG A) (H: Subgroup A): H.FG := by - classical - revert H -@@ -320,9 +315,6 @@ lemma fg_of_subgroup_fg_nilpotent {A: Type*} [DecidableEq A] [Group A] [Group.Is - have comm_eq := Subgroup.lowerCentralSeries_succ (⊤ : Subgroup A) n - rw [← hn] at comm_eq - rw [Subgroup.lowerCentralSeries_nilpotencyClass] at comm_eq -- conv at comm_eq => -- rhs -- simp - rw [eq_comm, Subgroup.commutator_eq_bot_iff_le_centralizer] at comm_eq - simp [Subgroup.centralizer_univ] at comm_eq - have n_fg: (Subgroup.lowerCentralSeries (⊤ : Subgroup A) n).FG := by -@@ -366,7 +358,7 @@ lemma fg_of_subgroup_fg_nilpotent {A: Type*} [DecidableEq A] [Group A] [Group.Is - - rw [← Group.fg_iff_subgroup_fg] - apply fg_domain_of_ker_range ((QuotientGroup.mk' ((⊤: Subgroup A).lowerCentralSeries n)).comp H.subtype) -- . -+ · - -- The kernel is `N.subgroupOf H = (H ⊓ N).subgroupOf H`, which is the same abstract group as - -- `(H ⊓ N).subgroupOf N` — the version we proved FG using that `N` is abelian. - rw [← MonoidHom.comap_ker, QuotientGroup.ker_mk', Subgroup.comap_subtype, -@@ -375,7 +367,7 @@ lemma fg_of_subgroup_fg_nilpotent {A: Type*} [DecidableEq A] [Group A] [Group.Is - ((Subgroup.subgroupOfEquivOfLe inf_le_right).trans - (Subgroup.subgroupOfEquivOfLe inf_le_left).symm) - ((Group.fg_iff_subgroup_fg _).mpr h_inf_fg) -- . -+ · - -- The range is the image of `H` in `A ⧸ Cⁿ A`, which is FG by the induction hypothesis. - rw [MonoidHom.range_comp, Subgroup.range_subtype] - exact ih (Subgroup.map (QuotientGroup.mk' _) H) -diff --git a/Gromov/Unipotent/GammaN.lean b/Gromov/Unipotent/GammaN.lean -index b60722b..126c821 100644 ---- a/Gromov/Unipotent/GammaN.lean -+++ b/Gromov/Unipotent/GammaN.lean -@@ -11,9 +11,6 @@ public import Gromov.Unipotent.FG - - public section - --set_option linter.style.longLine false --set_option linter.style.commandStart false --set_option linter.style.cdot false - - open scoped commutatorElement IsMulCommutative Pointwise - -@@ -112,9 +109,252 @@ theorem log_pow_sq_lt_of_lt (M p q K : ℕ) (hp : 0 < p) - def gamma_conj_bound {H: Type*} [DecidableEq H] [Group H] {N': Subgroup H} (gamma: MulAut N') := ∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → ((Finset.image (fun x ↦ (List.map (fun (i: ↥(Finset.Ico a b)) ↦ (gamma)^[k * ↑i] g) x.toList).prod)) - (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q - --set_option maxHeartbeats 1000000 in --set_option synthInstance.maxHeartbeats 40000 in --lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N': Subgroup H} [N'_normal: N'.Normal] (N'_nilpotent: Group.IsNilpotent N') (hN': Subgroup.FG N') (gamma: MulAut N') -+/-- The finite-free abelian part of the argument, separated from torsion lifting. -/ -+private lemma free_abelian_gamma_unipotent {A : Type*} [CommGroup A] [DecidableEq A] -+ [Module.Finite ℤ (Additive A)] [Module.Free ℤ (Additive A)] -+ (gamma_lift : MulAut A) (r : ℕ) (hr : 0 < r) -+ (gamma_lift_conj : ∀ k : ℕ, 0 < k → ∀ g : A, ∃ p q : ℕ, 0 < p ∧ -+ ∀ b : ℕ, 0 < b → ∀ a : ℕ, 0 < a → a < b → -+ (Finset.image (fun x ↦ (List.map (fun i : ↥(Finset.Ico a b) ↦ -+ gamma_lift^[k * ↑i] g) x.toList).prod) (Finset.Ico a b).attach.powerset).card ≤ -+ p * b ^ q * (b - a) ^ q) : -+ ∃ a, 0 < a ∧ ∀ p : ℕ, 0 < p → ∃ n, ∀ g : A, -+ (fun x ↦ x * gamma_lift^[a * r * p] x⁻¹)^[n] g = 1 := by -+ classical -+ rcases subsingleton_or_nontrivial A with hA | hA -+ · exact ⟨1, by simp, fun p _ => ⟨1, fun g => Subsingleton.elim _ _⟩⟩ -+ let gamma_add := gamma_lift.toAdditive.toAddMonoidHom.toIntLinearMap -+ let B := (Module.finBasis ℤ (Additive (A))) -+ let gamma_matrix := gamma_add.toMatrix B B -+ have invertible_gamma: Invertible gamma_matrix := { -+ invOf := ((gamma_lift.toAdditive).symm.toAddMonoidHom).toIntLinearMap.toMatrix B B -+ invOf_mul_self := by -+ simp [gamma_matrix, gamma_add] -+ rw [← LinearMap.toMatrix_mul] -+ rw [← toIntLinearMap_comp_mul] -+ simp -+ mul_invOf_self := by -+ simp [gamma_matrix, gamma_add] -+ rw [← LinearMap.toMatrix_mul] -+ rw [← toIntLinearMap_comp_mul] -+ simp -+ } -+ -+ let dim := Module.finrank ℤ (Additive (A)) -+ let equiv (v: Fin _ → ℤ) := (Finsupp.linearEquivFunOnFinite ℤ _ (Fin dim)).symm v -+ let remap (v: Fin _ → ℤ) := Finsupp.linearCombination _ B (equiv v) -+ -+ have gamma_matrix_mulVec: ∀ v: (Fin dim) → ℤ , remap ((gamma_matrix).mulVec (equiv v)) = Additive.ofMul (gamma_lift (Additive.toMul (remap v))) := by -+ intro v -+ unfold gamma_matrix -+ rw [← Module.Basis.repr_linearCombination (v := (equiv v)) (b := B)] -+ rw [LinearMap.toMatrix_mulVec_repr] -+ simp [remap, gamma_add, equiv] -+ -+ -+ have gamma_matrix_mulVec_pow: ∀ n: ℕ, ∀ v: (Fin dim) → ℤ , remap ((gamma_matrix^n).mulVec (equiv v)) = Additive.ofMul (gamma_lift^[n] (Additive.toMul (remap v))) := by -+ intro n -+ induction n with -+ | zero => -+ intro v -+ simp [remap, equiv] -+ | succ n ih => -+ intro v -+ rw [Function.iterate_succ_apply', pow_succ', ← Matrix.mulVec_mulVec] -+ rw [show ((gamma_matrix ^ n).mulVec ⇑(equiv v)) -+ = ⇑(equiv ((gamma_matrix ^ n).mulVec ⇑(equiv v))) from rfl] -+ rw [gamma_matrix_mulVec, ih] -+ rfl -+ -+ -+ have rank_nonzero: NeZero (Module.finrank ℤ (Additive (A))) := by -+ apply NeZero.of_pos -+ apply Module.finrank_pos -+ -+ -+ have eigen_norm_one: ∀ (k : Module.End.Eigenvalues (Matrix.toLin' (((unitOfInvertible gamma_matrix).val).map (Int.castRingHom ℂ)))), ‖k.val‖ = 1 := by -+ apply int_matrix_poly_growth_eigenvalue -+ · -+ intro k hk v -+ -- name the (fixed) group element the iterates are applied to -+ set g : A := -+ Additive.toMul ((Finsupp.linearCombination ℤ ⇑B) -+ ((Finsupp.linearEquivFunOnFinite ℤ ℤ (Fin dim)).symm v)) with hg -+ -+ -+ obtain ⟨p, q, p_pos, hq⟩ := gamma_lift_conj ⌈Real.logb ‖k‖ 3⌉₊ (by -+ simp -+ apply Real.logb_pos -+ · grind -+ · grind -+ ) g -+ let K: ℕ := (⌈4 * ((8 * ↑q + Real.log ↑p) ^ 2 / Real.log 2 ^ 2) ^ 2⌉₊ + 2 * ⌈Real.logb ‖k‖ 3⌉₊) + 1 -+ -+ -+ have hpq := hq K (by simp [K]) ⌈Real.logb ‖k‖ 3⌉₊ (by -+ simp -+ apply Real.logb_pos -+ · grind -+ · grind -+ ) (by -+ simp [K] -+ rw [two_mul] -+ grw [Nat.le_ceil (a := Real.logb ‖k‖ 3)] -+ grind -+ ) -+ -+ use p * K ^ q -+ use q -+ use K -+ -+ refine ⟨?_, ?_, ?_, ?_⟩ -+ · apply mul_pos -+ · exact p_pos -+ · apply pow_pos -+ simp [K] -+ -+ · simp [K] -+ rw [two_mul] -+ grw [Nat.le_ceil (a := Real.logb ‖k‖ 3)] -+ grind -+ · -+ -- Isolate `K` on the right of -+ -- `X < Real.log 2 * (↑K - ↑⌈Real.logb ‖k‖ 3⌉₊) ^ (1/2)`. -+ -- Divide by `Real.log 2 > 0`, bound the LHS by its absolute value (so no sign -+ -- assumption on `X` is needed), rewrite `|y| = √(y ^ 2)` and use strict -+ -- monotonicity of `√`, then move the subtraction across. `K` is never unfolded. -+ have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) -+ rw [← Real.sqrt_eq_rpow, ← div_lt_iff₀' hlog2] -+ refine lt_of_le_of_lt (le_abs_self _) ?_ -+ rw [← Real.sqrt_sq_eq_abs] -+ refine Real.sqrt_lt_sqrt (sq_nonneg _) ?_ -+ rw [lt_sub_iff_add_lt] -+ -- `K` still occurs on the left inside `Real.log ↑(p * K ^ q)`. This splits that -+ -- logarithm and eliminates the resulting `Real.log ↑K`, leaving a goal in `ℕ` with -+ -- `K` alone on the right. -+ refine log_pow_sq_lt_of_lt _ p q K p_pos ?_ -+ -- ⊢ ⌈4 * ((8 * ↑q + Real.log ↑p) ^ 2 / Real.log 2 ^ 2) ^ 2⌉₊ -+ -- + 2 * ⌈Real.logb ‖k‖ 3⌉₊ < K -+ simp [K] -+ · -+ rw [← (Finset.card_image_iff (f := fun a => remap (Finsupp.equivFunOnFinite.symm a))).mpr] -+ · -+ rw [Finset.image_image] -+ simp [remap, equiv] -+ rw [Function.comp_def] -+ simp_rw [map_sum] -+ simp [remap, equiv] at gamma_matrix_mulVec_pow -+ simp_rw [← pow_mul] -+ simp_rw [gamma_matrix_mulVec_pow] -+ -- Turn each subsum into `Additive.ofMul` of a product in the group, keeping the -+ -- index set as the subtype `↥(Finset.Ico N_1 N_2)`. -+ simp_rw [← ofMul_prod] -+ -- `Additive.ofMul` is a bijection, so it does not affect the cardinality: pull it -+ -- out of the image and discard it. -+ rw [← Function.comp_def Additive.ofMul, ← Finset.image_image, -+ Finset.card_image_of_injective _ (Equiv.injective _)] -+ -+ -+ simp_rw [← Finset.prod_map_toList] -+ -+ grw [hpq] -+ -- TODO - we might be able to make the goal stronger, if we don't actually need the factor of 2 in it -+ rw [pow_mul'] -+ apply mul_le_mul -+ · simp -+ · apply Nat.le_pow -+ simp -+ · simp -+ · simp -+ · apply Function.Injective.injOn -+ intro a b hab -+ simp [remap, equiv] at hab -+ rw [Function.Injective.eq_iff (linearIndependent_iff_injective_finsuppLinearCombination.mp ?_)] at hab -+ · simpa using hab -+ · apply Module.Basis.linearIndependent -+ -+ -+ let a := KroneckerPow (unitOfInvertible gamma_matrix) eigen_norm_one -+ use a -+ refine ⟨(by -+ apply KroneckerPow_pos -+ ), ?_⟩ -+ intro p hp -+ -+ -+ have unipotent_gamma_matrix := int_matrix_unipotent (by -+ apply Module.finrank_pos -+ ) (unitOfInvertible gamma_matrix) (by -+ apply eigen_norm_one -+ ) (n := p * r) (hn := by positivity) -+ obtain ⟨n, hm⟩ := unipotent_gamma_matrix -+ -+ -+ use n -+ intro g -+ apply_fun (fun f => f.toLin (Module.finBasis _ _) (Module.finBasis _ _)) at hm -+ rw [LinearMap.ext_iff] at hm -+ specialize hm g -+ simp [gamma_matrix] at hm -+ simp [gamma_add] at hm -+ conv at hm => -+ rhs -+ equals 0 => rfl -+ -+ -+ apply_fun (fun f => (f).toMul) at hm -+ conv at hm => -+ rhs -+ equals 1 => rfl -+ -+ rw [← neg_sub] at hm -+ rw [neg_pow] at hm -+ simp at hm -+ rw [Module.End.mul_eq_comp] at hm -+ simp at hm -+ simp [Function.comp_def] at hm -+ apply (LinearMap.ker_eq_bot'.mp (by -+ ext a -+ clear hm -+ induction n with -+ | zero => simp -+ | succ n ih => -+ rw [pow_succ] -+ simp -+ simp at ih -+ exact ih -+ )) at hm -+ rw [← toMul_eq_one] at hm -+ rw [← hm] -+ clear hm -+ -+ have x_mul_gamma_eq: ∀ q: ℕ, (fun x => x * (⇑gamma_lift)^[q] x⁻¹) = Additive.toMul ∘ (-((MonoidHom.toAdditive gamma_lift.toMonoidHom).toIntLinearMap ^ (q) - LinearMap.id)).toFun ∘ (Additive.ofMul) := by -+ intro q -+ ext x -+ conv => -+ rhs -+ equals Additive.toMul ((-((MonoidHom.toAdditive gamma_lift.toMonoidHom).toIntLinearMap ^ (q) - LinearMap.id)).toFun (Additive.ofMul x)) => -+ rfl -+ simp -+ rw [toIntLinearMap_pow_apply] -+ simp -+ rw [Function.comp_def] -+ rw [div_eq_mul_inv] -+ simp -+ rfl -+ -+ rw [x_mul_gamma_eq] -+ simp -+ rw [Module.End.coe_pow] -+ -- collapse the `Matrix.toLin B B (LinearMap.toMatrix B B _)` round-trip, which plain -+ -- `rfl` cannot see through -+ rw [Matrix.toLin_toMatrix] -+ -+ have mul_eq: a * r * p = p * r * a := by ring -+ simp_rw [mul_eq] -+ rfl -+ -+lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N': Subgroup H} [_N'_normal: N'.Normal] (N'_nilpotent: Group.IsNilpotent N') (hN': Subgroup.FG N') (gamma: MulAut N') - (gamma_conj: gamma_conj_bound gamma): - ∃ a, a ≠ 0 ∧ ∀ k: ℕ, 0 < k → ∃ n, ∀ g ∈ Subgroup.center N', Nat.iterate (fun x => x * ((gamma^[a*k]) x⁻¹)) n g = 1 := by - -@@ -163,47 +403,6 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N - let gamma_center := MulAut.characteristic (Subgroup.center N') gamma - have t_char: torsion.Characteristic := torsion_characteristic - let torsion_N := Subgroup.map (Subgroup.subtype _) torsion -- let gamma_torsion := MonoidHom.domRestrict gamma.toMonoidHom torsion_N -- let new_gamma_torsion_hom := MonoidHom.codRestrict gamma_torsion torsion_N (by -- rw [Subgroup.characteristic_iff_map_le] at t_char -- specialize t_char -- intro x -- simp [torsion_N] -- use ?_ -- . -- rw [CommGroup.mem_torsion] -- simp [gamma_torsion] -- rw [isOfFinOrder_iff_pow_eq_one] -- simp -- rw [← isOfFinOrder_iff_pow_eq_one] -- conv => -- arg 1 -- equals gamma.toMonoidHom x => -- simp -- apply MonoidHom.isOfFinOrder -- have x_prop := x.prop -- unfold torsion_N at x_prop -- simp [-SetLike.coe_mem] at x_prop -- obtain ⟨x_mem, x_mem_torsion⟩ := x_prop -- rw [CommGroup.mem_torsion] at x_mem_torsion -- rw [isOfFinOrder_iff_pow_eq_one] at x_mem_torsion -- simp at x_mem_torsion -- rw [← isOfFinOrder_iff_pow_eq_one] at x_mem_torsion -- simpa using x_mem_torsion -- . -- simp [gamma_torsion] -- have char_center := Subgroup.centerCharacteristic (G := N') -- rw [Subgroup.characteristic_iff_map_eq] at char_center -- specialize char_center gamma -- rw [← char_center] -- simp -- have x_prop := x.prop -- unfold torsion_N at x_prop -- simp [-SetLike.coe_mem] at x_prop -- obtain ⟨x_center, hx⟩ := x_prop -- exact x_center -- ) -- - let new_gamma_torsion := MulAut.characteristic torsion_N gamma - - -@@ -225,7 +424,7 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N - rw [Function.iterate_succ] - simp - rw [ih] -- simp [new_gamma_torsion, new_gamma_torsion_hom, gamma_torsion] -+ simp [new_gamma_torsion] - - - let gamma_lift := QuotientGroup.congr (torsion) torsion gamma_center (by -@@ -275,284 +474,27 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N - simp_rw [Function.iterate_succ'] - simp - -- have unipotent_on_quot: ∃ a, 0 < a ∧ ∀ p: ℕ, 0 < p → ∃ n, ∀ g : (Subgroup.center ↥N') ⧸ torsion, Nat.iterate (fun x => x * ((gamma_lift^[a * orderOf new_gamma_torsion * p] x⁻¹))) n g = 1 := by -- wlog nontrivial_quot: Nontrivial ((Subgroup.center ↥N') ⧸ torsion) -- . -- clear this -- simp at nontrivial_quot -- use 1 -- refine ⟨by simp, ?_⟩ -- intro p hp -- use 1 -- simp -- intro g -- have quot_subsingelton: Subsingleton ((Subgroup.center ↥N') ⧸ torsion) := by -- rw [QuotientGroup.subsingleton_iff] -- exact nontrivial_quot -- -- have g_eq := Subsingleton.eq_one g -- simp [g_eq] -- -- -- let foo: CommGroup (Subgroup.center N') := by infer_instance -- -- if the additive picture is wanted, this is *definitionally* the same type: -- have add_torsion_free: IsAddTorsionFree -- (Additive ↥(Subgroup.center ↥N') ⧸ AddCommGroup.torsion (Additive ↥(Subgroup.center ↥N'))) := by -- infer_instance -- -- let add_quot := (Additive ↥(Subgroup.center ↥N') ⧸ AddCommGroup.torsion (Additive ↥(Subgroup.center ↥N'))) -- -- -- let fin_dim: Module.Finite ℤ add_quot := by infer_instance -- -- let gamma_add := gamma_lift.toAdditive.toAddMonoidHom.toIntLinearMap -- let B := (Module.finBasis ℤ (Additive (↥(Subgroup.center ↥N') ⧸ torsion))) -- let gamma_matrix := gamma_add.toMatrix B B -- have invertible_gamma: Invertible gamma_matrix := { -- invOf := ((gamma_lift.toAdditive).symm.toAddMonoidHom).toIntLinearMap.toMatrix B B -- invOf_mul_self := by -- simp [gamma_matrix, gamma_add] -- rw [← LinearMap.toMatrix_mul] -- rw [← toIntLinearMap_comp_mul] -- simp -- mul_invOf_self := by -- simp [gamma_matrix, gamma_add] -- rw [← LinearMap.toMatrix_mul] -- rw [← toIntLinearMap_comp_mul] -- simp -- } -- -- let dim := Module.finrank ℤ (Additive (↥(Subgroup.center ↥N') ⧸ torsion)) -- let equiv (v: Fin _ → ℤ) := (Finsupp.linearEquivFunOnFinite ℤ _ (Fin dim)).symm v -- let remap (v: Fin _ → ℤ) := Finsupp.linearCombination _ B (equiv v) -- -- have gamma_matrix_mulVec: ∀ v: (Fin dim) → ℤ , remap ((gamma_matrix).mulVec (equiv v)) = Additive.ofMul (gamma_lift (Additive.toMul (remap v))) := by -- intro v -- unfold gamma_matrix -- rw [← Module.Basis.repr_linearCombination (v := (equiv v)) (b := B)] -- rw [LinearMap.toMatrix_mulVec_repr] -- simp [remap, gamma_add, equiv] -- -- -- have gamma_matrix_mulVec_pow: ∀ n: ℕ, ∀ v: (Fin dim) → ℤ , remap ((gamma_matrix^n).mulVec (equiv v)) = Additive.ofMul (gamma_lift^[n] (Additive.toMul (remap v))) := by -- intro n -- induction n with -- | zero => -- intro v -- simp [remap, equiv] -- | succ n ih => -- intro v -- rw [Function.iterate_succ_apply', pow_succ', ← Matrix.mulVec_mulVec] -- rw [show ((gamma_matrix ^ n).mulVec ⇑(equiv v)) -- = ⇑(equiv ((gamma_matrix ^ n).mulVec ⇑(equiv v))) from rfl] -- rw [gamma_matrix_mulVec, ih] -- rfl -- -- -- have rank_nonzero: NeZero (Module.finrank ℤ (Additive (↥(Subgroup.center ↥N') ⧸ torsion))) := by -- apply NeZero.of_pos -- apply Module.finrank_pos -- -- -- have gamma_lift_conj: ∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → (Finset.image (fun x ↦ (List.map (fun (i: ↥(Finset.Ico a b)) ↦ (gamma_lift)^[k * ↑i] g) x.toList).prod) -- (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q := by -- -- -- Same shape as the `final_gamma` transport: the products live in -- -- `↥(Subgroup.center ↥N')`, mapped out injectively by `Subgroup.subtype` (where -- -- `gamma_conj` gives the bound) and surjectively by `QuotientGroup.mk'` (where it -- -- is wanted). -- classical -- exact conjBound_transport -- (fC := fun x : ↥(Subgroup.center ↥N') => -- (⟨gamma x, gamma_mem_center x⟩ : ↥(Subgroup.center ↥N'))) -- (fQ := ⇑gamma_lift) (fN := ⇑gamma) -- (QuotientGroup.mk' torsion) (QuotientGroup.mk'_surjective _) -- ((Subgroup.center ↥N').subtype) (Subgroup.subtype_injective _) -- (fun x => (swap_gamma_lift x).symm) (fun x => rfl) gamma_conj -- -- have eigen_norm_one: ∀ (k : Module.End.Eigenvalues (Matrix.toLin' (((unitOfInvertible gamma_matrix).val).map (Int.castRingHom ℂ)))), ‖k.val‖ = 1 := by -- apply int_matrix_poly_growth_eigenvalue -- . -- intro k hk v -- -- name the (fixed) group element the iterates are applied to -- set g : ↥(Subgroup.center ↥N') ⧸ torsion := -- Additive.toMul ((Finsupp.linearCombination ℤ ⇑B) -- ((Finsupp.linearEquivFunOnFinite ℤ ℤ (Fin dim)).symm v)) with hg -- -- -- obtain ⟨p, q, p_pos, hq⟩ := gamma_lift_conj ⌈Real.logb ‖k‖ 3⌉₊ (by -- simp -- apply Real.logb_pos -- . grind -- . grind -- ) g -- let K: ℕ := (⌈4 * ((8 * ↑q + Real.log ↑p) ^ 2 / Real.log 2 ^ 2) ^ 2⌉₊ + 2 * ⌈Real.logb ‖k‖ 3⌉₊) + 1 -- -- -- have hpq := hq K (by simp [K]) ⌈Real.logb ‖k‖ 3⌉₊ (by -- simp -- apply Real.logb_pos -- . grind -- . grind -- ) (by -- simp [K] -- rw [two_mul] -- grw [Nat.le_ceil (a := Real.logb ‖k‖ 3)] -- grind -- ) -- -- use p * K ^ q -- use q -- use K -- -- refine ⟨?_, ?_, ?_, ?_⟩ -- . apply mul_pos -- . exact p_pos -- . apply pow_pos -- simp [K] -- -- . simp [K] -- rw [two_mul] -- grw [Nat.le_ceil (a := Real.logb ‖k‖ 3)] -- grind -- . -- -- Isolate `K` on the right of -- -- `X < Real.log 2 * (↑K - ↑⌈Real.logb ‖k‖ 3⌉₊) ^ (1/2)`. -- -- Divide by `Real.log 2 > 0`, bound the LHS by its absolute value (so no sign -- -- assumption on `X` is needed), rewrite `|y| = √(y ^ 2)` and use strict -- -- monotonicity of `√`, then move the subtraction across. `K` is never unfolded. -- have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) -- rw [← Real.sqrt_eq_rpow, ← div_lt_iff₀' hlog2] -- refine lt_of_le_of_lt (le_abs_self _) ?_ -- rw [← Real.sqrt_sq_eq_abs] -- refine Real.sqrt_lt_sqrt (sq_nonneg _) ?_ -- rw [lt_sub_iff_add_lt] -- -- `K` still occurs on the left inside `Real.log ↑(p * K ^ q)`. This splits that -- -- logarithm and eliminates the resulting `Real.log ↑K`, leaving a goal in `ℕ` with -- -- `K` alone on the right. -- refine log_pow_sq_lt_of_lt _ p q K p_pos ?_ -- -- ⊢ ⌈4 * ((8 * ↑q + Real.log ↑p) ^ 2 / Real.log 2 ^ 2) ^ 2⌉₊ -- -- + 2 * ⌈Real.logb ‖k‖ 3⌉₊ < K -- simp [K] -- . -- rw [← (Finset.card_image_iff (f := fun a => remap (Finsupp.equivFunOnFinite.symm a))).mpr] -- . -- rw [Finset.image_image] -- simp [remap, equiv] -- rw [Function.comp_def] -- simp_rw [map_sum] -- simp [remap, equiv] at gamma_matrix_mulVec_pow -- simp_rw [← pow_mul] -- simp_rw [gamma_matrix_mulVec_pow] -- -- Turn each subsum into `Additive.ofMul` of a product in the group, keeping the -- -- index set as the subtype `↥(Finset.Ico N_1 N_2)`. -- simp_rw [← ofMul_prod] -- -- `Additive.ofMul` is a bijection, so it does not affect the cardinality: pull it -- -- out of the image and discard it. -- rw [← Function.comp_def Additive.ofMul, ← Finset.image_image, -- Finset.card_image_of_injective _ (Equiv.injective _)] -- -- -- simp_rw [← Finset.prod_map_toList] -- -- grw [hpq] -- -- TODO - we might be able to make the goal stronger, if we don't actually need the factor of 2 in it -- rw [pow_mul'] -- apply mul_le_mul -- . simp -- . apply Nat.le_pow -- simp -- . simp -- . simp -- . apply Function.Injective.injOn -- intro a b hab -- simp [remap, equiv] at hab -- rw [Function.Injective.eq_iff (linearIndependent_iff_injective_finsuppLinearCombination.mp ?_)] at hab -- . simpa using hab -- . apply Module.Basis.linearIndependent -- -- -- let a := KroneckerPow (unitOfInvertible gamma_matrix) eigen_norm_one -- use a -- refine ⟨(by -- apply KroneckerPow_pos -- ), ?_⟩ -- intro p hp -- -- -- have unipotent_gamma_matrix := int_matrix_unipotent (by -- apply Module.finrank_pos -- ) (unitOfInvertible gamma_matrix) (by -- apply eigen_norm_one -- ) (n := p * orderOf new_gamma_torsion) (hn := by positivity) -- obtain ⟨n, hm⟩ := unipotent_gamma_matrix -- -- -- use n -- intro g -- apply_fun (fun f => f.toLin (Module.finBasis _ _) (Module.finBasis _ _)) at hm -- rw [LinearMap.ext_iff] at hm -- specialize hm g -- simp [gamma_matrix] at hm -- simp [gamma_add] at hm -- conv at hm => -- rhs -- equals 0 => rfl -- -- -- apply_fun (fun f => (f).toMul) at hm -- conv at hm => -- rhs -- equals 1 => rfl -- -- rw [← neg_sub] at hm -- rw [neg_pow] at hm -- simp at hm -- rw [Module.End.mul_eq_comp] at hm -- simp at hm -- simp [Function.comp_def] at hm -- apply (LinearMap.ker_eq_bot'.mp (by -- ext a -- clear hm -- induction n with -- | zero => simp -- | succ n ih => -- rw [pow_succ] -- simp -- simp at ih -- exact ih -- )) at hm -- rw [← toMul_eq_one] at hm -- rw [← hm] -- clear hm -- -- have x_mul_gamma_eq: ∀ q: ℕ, (fun x => x * (⇑gamma_lift)^[q] x⁻¹) = Additive.toMul ∘ (-((MonoidHom.toAdditive gamma_lift.toMonoidHom).toIntLinearMap ^ (q) - LinearMap.id)).toFun ∘ (Additive.ofMul) := by -- intro q -- ext x -- conv => -- rhs -- equals Additive.toMul ((-((MonoidHom.toAdditive gamma_lift.toMonoidHom).toIntLinearMap ^ (q) - LinearMap.id)).toFun (Additive.ofMul x)) => -- rfl -- simp -- rw [toIntLinearMap_pow_apply] -- simp -- rw [Function.comp_def] -- rw [div_eq_mul_inv] -- simp -- rfl -- -- rw [x_mul_gamma_eq] -- simp -- rw [Module.End.coe_pow] -- -- collapse the `Matrix.toLin B B (LinearMap.toMatrix B B _)` round-trip, which plain -- -- `rfl` cannot see through -- rw [Matrix.toLin_toMatrix] -- -- -- TODO - figure out how the order gets swapped -- have mul_eq: a * orderOf new_gamma_torsion * p = p * orderOf new_gamma_torsion * a := by ring -- simp_rw [mul_eq] -- rfl -- -+ have gamma_lift_conj: ∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → (Finset.image (fun x ↦ (List.map (fun (i: ↥(Finset.Ico a b)) ↦ (gamma_lift)^[k * ↑i] g) x.toList).prod) -+ (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q := by -+ -+ -- Same shape as the `final_gamma` transport: the products live in -+ -- `↥(Subgroup.center ↥N')`, mapped out injectively by `Subgroup.subtype` (where -+ -- `gamma_conj` gives the bound) and surjectively by `QuotientGroup.mk'` (where it -+ -- is wanted). -+ classical -+ exact conjBound_transport -+ (fC := fun x : ↥(Subgroup.center ↥N') => -+ (⟨gamma x, gamma_mem_center x⟩ : ↥(Subgroup.center ↥N'))) -+ (fQ := ⇑gamma_lift) (fN := ⇑gamma) -+ (QuotientGroup.mk' torsion) (QuotientGroup.mk'_surjective _) -+ ((Subgroup.center ↥N').subtype) (Subgroup.subtype_injective _) -+ (fun x => (swap_gamma_lift x).symm) (fun x => rfl) gamma_conj -+ -+ have unipotent_on_quot : ∃ a, 0 < a ∧ ∀ p : ℕ, 0 < p → ∃ n, -+ ∀ g : (Subgroup.center ↥N') ⧸ torsion, -+ (fun x ↦ x * gamma_lift^[a * orderOf new_gamma_torsion * p] x⁻¹)^[n] g = 1 := -+ free_abelian_gamma_unipotent gamma_lift (orderOf new_gamma_torsion) order_pos -+ gamma_lift_conj - - obtain ⟨quot_pow, quot_pow_pos, h_quot_pow⟩ := unipotent_on_quot - use (quot_pow * ( orderOf new_gamma_torsion)) -@@ -587,8 +529,8 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N - simp - have mul_mem_center: (↑g * ((gamma ^ (quot_pow * orderOf new_gamma_torsion * p )) ↑g)⁻¹) ∈ Subgroup.center N' := by - apply Subgroup.mul_mem -- . simp -- . -+ · simp -+ · - simp - have center_char: (Subgroup.center N').Characteristic := by - infer_instance -@@ -639,8 +581,6 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N - -- OLD CODE - - --set_option maxHeartbeats 2000000 in --set_option synthInstance.maxHeartbeats 160000 in - /--{G: Type*} [DecidableEq G] [Group G] (H: Subgroup G) [H.Normal]--/ - lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subgroup H} [N'_normal: N'.Normal] (N'_nilpotent: Group.IsNilpotent N') (hN': Subgroup.FG N') (gamma: MulAut N') (gamma_conj: gamma_conj_bound gamma): - ∀ p: ℕ, 0 < p → ∃ a n, a ≠ 0 ∧ ∀ g : N', Nat.iterate (fun x => x * ((gamma^[a*p]) x⁻¹)) n g = 1 := by -@@ -648,7 +588,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg - - classical - by_cases N'_subsingle: Subsingleton N' -- . -+ · - intro p hp - use 1 - use 1 -@@ -656,7 +596,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg - intro a ha - have order := Subsingleton.orderOf_eq (⟨_, ha⟩ : N') - simp at order -- simp [order, iteratedCommutator] -+ simp [order] - rw [mul_aut_iterate] - simp - -@@ -679,7 +619,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg - let final_gamma := aut_transfer gamma_quot - - by_cases top_subsingle: Subsingleton (⊤ : Subgroup (↥N' ⧸ Subgroup.center ↥N')) -- . -+ · - intro p hp - obtain ⟨z_a, h_z_a, z_a_temp⟩ := exists_gamma_n_unipotent_center_N' (N' := N') (N'_nilpotent) (hN') gamma gamma_conj - obtain ⟨z_n, h_z_unipotent⟩ := z_a_temp p hp -@@ -702,12 +642,12 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg - - have foo := ih (Group.nilpotencyClass (⊤ : Subgroup (↥N' ⧸ Subgroup.center ↥N'))) (by - grw [Subgroup.nilpotencyClass_le] -- simp [nilpotencyClass_quotient_center] -+ simp [Group.nilpotencyClass_quotient_center] - rw [← hn] - simp - by_contra! - simp at this -- rw [nilpotencyClass_zero_iff_subsingleton] at this -+ rw [Group.nilpotencyClass_zero_iff_subsingleton] at this - contradiction - ) (H := N' ⧸ Subgroup.center N') (N' := ⊤) (by simp; apply Group.nilpotent_quotient_of_nilpotent) (by - have fg_quot: Group.FG (↥N' ⧸ Subgroup.center ↥N') := by -@@ -746,7 +686,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg - rw [Function.iterate_add_apply] - - specialize h_z_unipotent ((fun x ↦ x * ((gamma^[a*z_a*p]) (x⁻¹)))^[n] g) ?_ -- . -+ · - - have swap_gamma_base: ∀ x, (gamma) x = ((final_gamma) ⟨x, by simp⟩).val := by - intro x -@@ -787,7 +727,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg - simpa using h_prev - - -- . -+ · - simp_rw [mul_aut_iterate] at h_z_unipotent - rw [mul_aut_iterate] - simp_rw [← mul_assoc] at h_z_unipotent -diff --git a/Gromov/UnipotentGromov.lean b/Gromov/UnipotentGromov.lean -index f90d0aa..13fc5f8 100644 ---- a/Gromov/UnipotentGromov.lean -+++ b/Gromov/UnipotentGromov.lean -@@ -13,9 +13,6 @@ Root of the `Gromov.Unipotent` hierarchy. - - public section - --set_option linter.style.longLine false --set_option linter.style.commandStart false --set_option linter.style.cdot false - - open scoped commutatorElement IsMulCommutative Pointwise - -@@ -31,8 +28,8 @@ lemma normal_comm_mem_right {G: Type*} [Group G] {N: Subgroup G} (N_normal: N.No - equals (a * b * a⁻¹) * b⁻¹ => group - - apply Subgroup.mul_mem -- . exact conj_mem -- . simpa using hb -+ · exact conj_mem -+ · simpa using hb - - - lemma iterated_mem_iterated_set {G: Type*} [DecidableEq G] [Group G] (base right: G) (S: Finset G) (base_mem: base ∈ S) (right_mem: right ∈ S) (n: ℕ): iteratedCommutator base right n ∈ iterate_comm_set S n := by -@@ -63,19 +60,18 @@ lemma comm_subgroup_mem {G: Type*} [DecidableEq G] [Group G] {H: Subgroup G} (S: - simp - | succ n ih => - simp [iterate_comm_set] -- intro h h_mem h_mem_s -- intro a ha -+ intro h h_mem h_mem_s a ha - simp - have a_mem := ih ha - simp [Bracket.bracket] - apply Subgroup.mul_mem -- . apply Subgroup.mul_mem -- . apply Subgroup.mul_mem -- . exact a_mem -- . exact h_mem -- . simp -+ · apply Subgroup.mul_mem -+ · apply Subgroup.mul_mem -+ · exact a_mem -+ · exact h_mem -+ · simp - exact a_mem -- . simp -+ · simp - exact h_mem - - -@@ -88,39 +84,39 @@ lemma iterate_comm_subgroup {G: Type*} [DecidableEq G] [Group G] {H: Subgroup G} - dsimp [iterate_comm_set] - simp - refine ⟨?_, ?_⟩ -- . -+ · - intro h_mem - obtain ⟨b, b_mem, ⟨b_mem_S, a, h_eq⟩⟩ := h_mem - obtain ⟨a_mem_h, a_mem_comm, h_eq_comm⟩ := h_eq - use b - use ?_ -- . use a -+ · use a - refine ⟨?_, ?_⟩ -- . -+ · - rw [ih] at a_mem_comm - simp at a_mem_comm - exact a_mem_comm -- . rw [← h_eq_comm] -+ · rw [← h_eq_comm] - simp [Bracket.bracket] -- . use b_mem -- . intro data_mem -+ · use b_mem -+ · intro data_mem - obtain ⟨b, ⟨b_mem_H, b_mem_S⟩, ⟨a, a_mem_comm, h_eq⟩⟩ := data_mem - use b - use b_mem_H - refine ⟨?_, ?_⟩ -- . exact b_mem_S -- . use a -+ · exact b_mem_S -+ · use a - use ?_ -- . refine ⟨?_, ?_⟩ -- . -+ · refine ⟨?_, ?_⟩ -+ · - rw [ih] - simp - exact a_mem_comm -- . -+ · - ext - rw [← h_eq] - simp [Bracket.bracket] -- . -+ · - simp [Bracket.bracket] at h_eq - have iterate_subset := comm_subgroup_mem S n a_mem_comm - simpa using iterate_subset -@@ -171,29 +167,29 @@ lemma count_mem_group_implies_lowercentral {G: Type*} [Group G] {N': Subgroup G} - simp at l_nonempty - | cons head tail ih => - by_cases head_in_N': head ∈ N' -- . -- simp only [List.countP_cons, List.foldr_cons, head_in_N', decide_true, if_true, -+ · -+ simp only [List.countP_cons, List.foldr_cons, head_in_N', decide_true, ite_true, - Nat.add_sub_cancel] - by_cases tail_empty: tail = [] -- . -+ · - simp [tail_empty] - apply normal_comm_mem_right N'_normal - exact head_in_N' -- . -+ · - - by_cases count_eq_zero: (tail.countP (fun a => decide (a ∈ N'))) = 0 -- . -+ · - simp [count_eq_zero] - apply normal_comm_mem_right N'_normal - exact head_in_N' -- . -+ · - have count_sub_eq: (tail.countP (fun a => decide (a ∈ N'))) = (tail.countP (fun a => decide (a ∈ N'))) - 1 + 1 := by - omega - - rw [count_sub_eq] - specialize ih (by simpa using tail_empty) count_eq_zero - exact Subgroup.commutator_mem_commutator ih head_in_N' -- . rw [List.countP_cons] -+ · rw [List.countP_cons] - simp only [head_in_N', decide_false, Bool.false_eq_true, ↓reduceIte] - - -@@ -208,11 +204,10 @@ lemma count_mem_group_implies_lowercentral {G: Type*} [Group G] {N': Subgroup G} - specialize ih tail_nonempty count_ne_zero - rw [List.foldr_cons] - apply normal_comm_mem -- . infer_instance -- . exact ih -+ · infer_instance -+ · exact ih - - --#print axioms count_mem_group_implies_lowercentral - - - -- `Subgroup.map_toSubmonoid` rewrites the `.carrier` predicate of `Subgroup.map`, which breaks the -@@ -229,22 +224,22 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - classical - - by_cases m_eq: m = 0 -- . -+ · - simp [iteratedCommutator, m_eq] at h_gamma_alpha - have N'_bot: N' = ⊥ := by - rw [Subgroup.eq_bot_iff_forall] - simpa using h_gamma_alpha - - -- let foo := Subgroup.closureCommGroupOfComm (k := (↑(Finset.image (⇑H.subtype) S) ∪ {gamma_alpha})) ?_ -- . -+ have foo := Subgroup.isMulCommutative_closure (k := (↑(Finset.image (⇑H.subtype) S) ∪ {gamma_alpha})) ?_ -+ · - - apply CommGroup.isNilpotent -- . intro x hx y hy -+ · intro x hx y hy - by_cases S_empty: S = ∅ -- . simp [S_empty] at hx hy -+ · simp [S_empty] at hx hy - grind -- . -+ · - have S_eq: S = {1} := by - simp only [N'_bot, Subgroup.closure_eq_bot_iff] at hS - have S_subset: S ⊆ {1} := by -@@ -265,10 +260,10 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - - have nilpotent_map: Group.IsNilpotent ↥(Subgroup.map H.subtype N') := by - apply map_nilpotent -- . exact Subgroup.subtype_injective H -- . exact N'_nilpotent -+ · exact Subgroup.subtype_injective H -+ · exact N'_nilpotent - -- rw [nilpotent_iff_lowerCentralSeries] -+ rw [Subgroup.nilpotent_iff_lowerCentralSeries] - use ((1 + (Group.nilpotencyClass ↥(Subgroup.map H.subtype N'))) * (m + 1)) + 2 - - apply comm_trivial_implies_nilpotent (S := Finset.image (fun (a: ↑((Finset.image (Subgroup.subtype _) S) ∪ {gamma_alpha})) => ⟨a.val, by ( -@@ -278,7 +273,7 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - simp - exact a_prop - )⟩) Finset.univ) -- . -+ · - - - simp only [Finset.coe_image, Finset.coe_univ, Set.image_univ] -@@ -297,7 +292,7 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - · intro hg - exact ⟨⟨g, by apply Subgroup.mem_closure_of_mem; exact hg⟩, - ⟨⟨g, by simpa using hg⟩, rfl⟩, rfl⟩ -- . -+ · - ext a - rw [iterate_comm_subgroup] - -@@ -312,11 +307,11 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - exact Finset.attach_image_val - - refine ⟨?_, ?_⟩ -- . -+ · - intro a_mem - rw [← Finset.mem_coe] at a_mem - rw [iterate_comm_set_eq_fold] at a_mem -- simp only [Set.mem_setOf_eq] at a_mem -+ simp only [Set.mem_ofPred_eq] at a_mem - obtain ⟨s, l, l_length, a_eq⟩ := a_mem - - -- TODO - extract this to its own lemma -@@ -341,22 +336,21 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - rw [Function.iterate_succ'] - simp - apply normal_comm_mem -- . infer_instance -- . exact ih -+ · infer_instance -+ · exact ih - - have comm_in_N': (fun x ↦ ⁅x, gamma_alpha⁆)^[t] g ∈ (Subgroup.map (Subgroup.subtype _) N') := by - clear ht - induction t with - | zero => -- simpa using g_mem -+ simp - | succ t ih => - simp_rw [Function.iterate_succ'] -- simp only [Function.comp_apply, Subgroup.subtype_apply, -- Subtype.exists, exists_and_right, exists_eq_right] -+ simp only [Function.comp_apply] - apply normal_comm_mem -- . -+ · - infer_instance -- . exact ih -+ · exact ih - - simp at comm_in_N' - obtain ⟨foo, bar⟩ := comm_in_N' -@@ -367,7 +361,7 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - have adjacent_or_count := list_adjacent_elements l (fun x => decide (x = gamma_alpha)) (m + 1) - rw [l_length] at adjacent_or_count - cases adjacent_or_count -- . -+ · - rename_i adjancent_gamma - obtain ⟨gamma_list, h_gamma_list, gamma_list_len, eq_gamma_alpha⟩ := adjancent_gamma - -@@ -406,10 +400,10 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - have s_mem := s.property - rw [Finset.mem_union] at s_mem - cases s_mem -- . rename_i s_mem_N' -+ · rename_i s_mem_N' - rw [subsequent_comm_one] -- . rw [list_fold_comm_one] -- . -+ · rw [list_fold_comm_one] -+ · - clear h_list_eq - induction l_suffix with - | nil => -@@ -420,9 +414,9 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - | cons head tail ih => - simp - apply normal_comm_mem -- . infer_instance -- . exact ih -- . -+ · infer_instance -+ · exact ih -+ · - clear h_list_eq - rw [← Subgroup.mem_map_iff_mem (f := H.subtype) (Subgroup.subtype_injective H)] - induction l_suffix with -@@ -437,9 +431,9 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - simp [-Subgroup.mem_map] - apply normal_comm_mem (by infer_instance) - exact ih -- . rw [List.length_unattach] -+ · rw [List.length_unattach] - omega -- . -+ · - rename_i s_eq_gamma - simp at s_eq_gamma - rw [s_eq_gamma] -@@ -463,23 +457,23 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - rw [Finset.mem_union] at head_prop - - cases head_prop -- . -+ · - rename_i head_in_N - rw [Set.mem_union] at ih - apply Set.mem_union_left - apply normal_comm_mem (by infer_instance) - apply normal_comm_mem_right (by infer_instance) - exact image_sub_map _ head_in_N -- . rename_i head_gamma -+ · rename_i head_gamma - simp at head_gamma - cases ih -- . rename_i left -+ · rename_i left - simp only [List.unattach_cons, List.foldr_cons] - rw [head_gamma] - apply Set.mem_union_left - apply normal_comm_mem (by infer_instance) - exact left -- . -+ · - rename_i right - apply Set.mem_union_left - simp at right -@@ -490,17 +484,17 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - - rw [Set.mem_union] at fold_mem - cases fold_mem -- . rename_i fold_in_N -+ · rename_i fold_in_N - simp at fold_in_N - rw [subsequent_comm_one] -- . rw [list_fold_comm_one] -- . -+ · rw [list_fold_comm_one] -+ · - obtain ⟨foo, bar⟩ := fold_in_N - exact foo -- . obtain ⟨foo, bar⟩ := fold_in_N -+ · obtain ⟨foo, bar⟩ := fold_in_N - exact bar -- . omega -- . rename_i fold_eq_gamma -+ · omega -+ · rename_i fold_eq_gamma - simp at fold_eq_gamma - rw [fold_eq_gamma] - -@@ -512,13 +506,13 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - rw [nat_iterate_comm_one] - rw [list_fold_comm_one] - -- . -+ · - rename_i count_not_gamma - simp at count_not_gamma - rw [mul_comm] at count_not_gamma - rw [Nat.mul_add_div] at count_not_gamma - rw [Nat.div_eq_of_lt] at count_not_gamma -- . simp at count_not_gamma -+ · simp at count_not_gamma - - refine Finset.mem_singleton.mpr ?_ - ext -@@ -534,19 +528,19 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - congr - simp - refine ⟨?_, ?_⟩ -- . intro hx other -+ · intro hx other - rw [← hx] at gamma_not_n - simp at gamma_not_n - apply gamma_not_n other -- . intro hx -+ · intro hx - have x_prop := x.prop - rw [Finset.mem_union] at x_prop -- simp [hx] at x_prop -+ simp at x_prop - cases x_prop -- . rename_i mem_N' -+ · rename_i mem_N' - obtain ⟨mem_H, mem_N⟩ := mem_N' - exact absurd (S_sub_N' _ mem_N) (hx mem_H) -- . rename_i x_eq -+ · rename_i x_eq - exact x_eq - - -@@ -561,11 +555,11 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - - - have foo := count_mem_group_implies_lowercentral (N' := (Subgroup.map H.subtype N')) (by infer_instance) l.unattach s ?_ ?_ -- . -+ · - rw [Subgroup.lowerCentralSeries_eq_bot_of_nilpotencyClass_le (by omega)] at foo - simpa using foo - -- . -+ · - -- TODO - this is ridiculously overcomplicated - - have l_len_ne: l.length ≠ 0 := by -@@ -573,10 +567,10 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - - - grind -- . omega -- . omega -- . omega -- . -+ · omega -+ · omega -+ · omega -+ · - intro a_eq - replace a_eq : a = 1 := Finset.mem_singleton.mp a_eq - -- `S` need not contain `1`, so start the iterated commutator at `gamma_alpha` -@@ -593,4 +587,3 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg - rw [a_eq] - simpa using iterate_mem - --#print axioms unipotent_commutator_trivial -diff --git a/Gromov/Unitary/Basic.lean b/Gromov/Unitary/Basic.lean -index afa60f5..b159646 100644 ---- a/Gromov/Unitary/Basic.lean -+++ b/Gromov/Unitary/Basic.lean -@@ -16,8 +16,6 @@ public section - - open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace - --set_option linter.style.longLine false --set_option linter.style.commandStart false - - open Subgroup Pointwise Finset - open scoped Pointwise Finset -@@ -190,7 +188,6 @@ lemma poly_growth_equiv {G: Type*} [DecidableEq G] [Group G] (a d: ℕ) - exact Nat.one_le_pow d n hn - - --#print axioms poly_growth_equiv - - - -- Lemma 3.29 (Shrinking Conjugators) -@@ -247,7 +244,6 @@ instance unitary_proper (n : ℕ) : ProperSpace ↥(Matrix.unitaryGroup (Fin n) - apply ProperSpace.of_isClosed - apply unitary_closed - --#synth Nontrivial (Matrix (Fin 1) (Fin 1) ℂ) - - - @[expose] -@@ -363,16 +359,15 @@ lemma small_dist_matrix (n : ℕ) (hn : 2 ≤ n) : - linarith - · simp [dists] - apply Set.Finite.image -- apply Set.Finite.diff -+ apply Set.Finite.sdiff - apply Set.Finite.image - - - have finite_roots : Finite ↥(rootsOfUnity n ℂ) := by infer_instance -- -- TODO - how is this working??? - exact finite_roots -- · --have n_gt_one : 1 < n := by omega -+ · - simp [dists] -- rw [Set.diff_nonempty] -+ rw [Set.sdiff_nonempty] - simp - - let my_root : Units ℂ := { -@@ -413,6 +408,5 @@ lemma small_dist_matrix (n : ℕ) (hn : 2 ≤ n) : - norm_cast at abs_lt_one - linarith [Int.one_le_abs a_eq_zero] - --#print axioms small_dist_matrix - - -- Lemma 3.31 (Volume Packing) -diff --git a/Gromov/Unitary/CentralTrivial.lean b/Gromov/Unitary/CentralTrivial.lean -index 817f510..ade1ee0 100644 ---- a/Gromov/Unitary/CentralTrivial.lean -+++ b/Gromov/Unitary/CentralTrivial.lean -@@ -13,8 +13,6 @@ public section - - open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace - --set_option linter.style.longLine false --set_option linter.style.commandStart false - - open Subgroup Pointwise Finset - open scoped Pointwise Finset -@@ -48,23 +46,23 @@ lemma H_n_contradiction (data : HnData) - simp [c'] - rw [Nat.one_le_iff_ne_zero] - apply Nat.mul_ne_zero -- . apply Nat.mul_ne_zero -- . apply Nat.mul_ne_zero -- . simp -- . -+ · apply Nat.mul_ne_zero -+ · apply Nat.mul_ne_zero -+ · simp -+ · - simp - apply c_mul_pos -- . omega -- . simp -+ · omega -+ · simp - ) - have lower_bound := H_n_ball_S_card m_gt data c c_pos c_lt - have ineq := le_trans lower_bound upper_bound - rify at ineq - rw [← Real.log_le_log_iff] at ineq -- . -+ · - simp at ineq - rw [Real.log_mul] at ineq -- . -+ · - simp at ineq - rw [Real.log_mul] at ineq - simp at ineq -@@ -83,17 +81,17 @@ lemma H_n_contradiction (data : HnData) - have log_m_gt: ↑data.S_poly_deg < Real.log ↑m := by - rw [← Real.exp_lt_exp] - rw [Real.exp_log] -- . -+ · - unfold m - apply Nat.lt_of_ceil_lt - apply lt_max_of_lt_right - simp -- . simp -+ · simp - omega - - - rw [Real.log_mul] -- . -+ · - rw [mul_add] - rw [add_comm] - rw [← add_assoc] -@@ -109,87 +107,80 @@ lemma H_n_contradiction (data : HnData) - rw [← lt_tsub_iff_right] - rw [← mul_sub] - rw [← div_lt_iff₀] -- . -+ · - dsimp [m] - apply Nat.lt_of_ceil_lt - apply lt_max_of_lt_left - apply lt_max_of_lt_right - simp -- . -+ · - simp - rw [lt_tsub_iff_right] - rw [← Real.exp_lt_exp] - rw [Real.exp_log] -- . -- rw [← gt_iff_lt] -- grw [(Nat.sub_one_lt_floor _).gt] -- rw [gt_iff_lt] -- rw [lt_tsub_iff_right] -- field_simp -- rw [lt_div_iff₀'] -- rw [← lt_div_iff₀] -- . -- exact eps_div_lt -- . positivity -- . apply H_n_eps_pos -- . -+ · -+ apply lt_trans ?_ (Nat.sub_one_lt_floor _) -+ rw [← div_eq_mul_inv, lt_sub_iff_add_lt, -+ lt_div_iff₀ (H_n_eps_pos data.hd)] -+ simpa only [mul_comm] using -+ (lt_div_iff₀ (show 0 < Real.exp (4 + ↑data.S_poly_deg * Real.log 2) + 1 by positivity)).mp eps_div_lt -+ · - simp - rw [Nat.floor_pos] - exact c_mul_pos -- . simp -- . simp -- . simp -- . -+ · simp -+ · simp -+ · simp -+ · - simp - refine ⟨by simp [c'], ?_⟩ - exact c_mul_pos -- . simp -+ · simp - omega - - unfold swap_le at reverse_ineq -- . linarith -- . have m_ne_zero: m ≠ 0 := by -+ · linarith -+ · have m_ne_zero: m ≠ 0 := by - omega - simp [c', m_ne_zero] - exact c_mul_pos - -- . simp -+ · simp - - -- . -+ · - exact Nat.cast_ne_zero.mpr (id (Ne.symm data.S_poly_const_pos)) -- . -+ · - - - apply ne_zero_of_pos - apply pow_pos - simp - apply mul_pos -- . -+ · - simp [c'] - rw [Nat.floor_pos] - exact c_mul_pos -- . exact Nat.cast_pos'.mpr m_gt -- . -+ · exact Nat.cast_pos'.mpr m_gt -+ · - norm_cast - apply Nat.pow_pos - rw [Nat.floor_pos] - exact c_mul_pos -- . -+ · - apply mul_pos -- . simp -+ · simp - exact Nat.zero_lt_of_ne_zero (id (Ne.symm data.S_poly_const_pos)) -- . -+ · - apply pow_pos - simp [c'] - apply mul_pos -- . simp -+ · simp - rw [Nat.floor_pos] - exact c_mul_pos -- . exact Nat.cast_pos'.mpr m_gt -+ · exact Nat.cast_pos'.mpr m_gt - - --#print axioms H_n_contradiction - - -- Note - Vikman proves a much weaker statement (an upper boud n terms of 2^n) - -- The norms are actually bounded by a constant, which makes the rest of the proof easier -@@ -203,8 +194,302 @@ open scoped Pointwise - - - -- Theorem 3.8, case with only trivial elements in the center --set_option synthInstance.maxHeartbeats 100000 in --set_option maxHeartbeats 2200000 in -+private lemma small_finite_generators (n : ℕ) (hn : 2 ≤ n) -+ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) -+ (S_poly_data : SPolyData (G' n (H_n_eps hn) G)) : -+ ∃ S : Set G, (∀ s ∈ S, ‖s.val.val - 1‖ < H_n_eps hn) ∧ -+ S.Finite ∧ S = S⁻¹ ∧ Subgroup.closure S = G' n (H_n_eps hn) G ∧ 1 ∈ S := by -+ classical -+ let S' := S_poly_data.S -+ have S'_finite := S_poly_data.S_finite -+ -+ -- Add identity and inverses to S' to make things easier -+ let S'' := S' -+ have S''_finite: Set.Finite S'' := by -+ dsimp [S''] -+ apply S'_finite -+ -+ -+ have S''_eq_S''inv: S'' = S''⁻¹ := by -+ unfold S'' -+ apply S_poly_data.S_inv -+ -+ -+ have S''_generates: Subgroup.closure S'' = ⊤ := by -+ dsimp [S''] -+ apply S_poly_data.S_generates -+ -+ -+ have s_list (s: S'') := (mem_closure_prod_list ((Metric.ball (1 : G) (H_n_eps hn)) ∪ (Metric.ball (1 : G) (H_n_eps hn))⁻¹) (by -+ simp -+ rw [Set.union_comm] -+ ) s (by -+ have s_prop := s.val.property -+ simp only [G'] at s_prop -+ rw [Subgroup.closure_union] -+ simp [s_prop] -+ )) -+ -+ -- Write each element in S'' as a product of elements of S', and then collect all of the used elements into a set -+ -- We may need to manually union this with S⁻¹, since the inverse of the produces -+ -- could be chosen to be built with different elements (not the inverses of the ones in the original list) -+ let pre_S := ⋃ s : S''_finite.toFinset, ((s_list ⟨s, by ( -+ have foo := s.property -+ rw [Set.Finite.mem_toFinset] at foo -+ exact foo -+ )⟩).choose.unattach.toFinset : Set ↥G) ∪ {1} -+ let S := pre_S ∪ pre_S⁻¹ ∪ {1} -+ -+ have S_dist: ∀ s ∈ S, ‖s.val.val - 1‖ < H_n_eps hn := by -+ intro s hs -+ dsimp [S] at hs -+ -+ rw [Set.union_assoc] at hs -+ cases hs -+ · rename_i s_mem -+ dsimp [pre_S] at s_mem -+ rw [Set.mem_iUnion] at s_mem -+ obtain ⟨y, y_mem⟩ := s_mem -+ simp only [List.coe_toFinset, List.mem_unattach, Set.mem_union, Set.mem_inv, -+ Set.mem_ofPred_eq] at y_mem -+ obtain ⟨s_mem_S'', s_mem_choose⟩ := y_mem -+ simp at s_mem_S'' -+ simp only [Subtype.dist_eq, dist_eq_norm_sub] at s_mem_S'' -+ conv at s_mem_S'' => -+ right -+ arg 1 -+ arg 1 -+ equals (star s.val.val * 1 - (star s.val.val) * s.val.val) => -+ simp -+ -+ rw [← mul_sub] at s_mem_S'' -+ rw [← Unitary.coe_star] at s_mem_S'' -+ rw [CStarRing.norm_coe_unitary_mul] at s_mem_S'' -+ nth_rw 2 [norm_sub_rev] at s_mem_S'' -+ simp at s_mem_S'' -+ · exact s_mem_S'' -+ · -+ rename_i s_eq_one -+ simp at s_eq_one -+ simp [s_eq_one] -+ have foo := H_n_eps_pos hn -+ linarith -+ · -+ -- TODO - deduplicate most of this with the above case -+ rename_i s_mem -+ rw [Set.union_comm] at s_mem -+ cases s_mem -+ · rename_i s_mem_one -+ simp at s_mem_one -+ simp [s_mem_one] -+ apply H_n_eps_pos -+ -+ rename_i s_mem -+ dsimp [pre_S] at s_mem -+ rw [Set.iUnion_inv] at s_mem -+ rw [Set.mem_iUnion] at s_mem -+ obtain ⟨y, y_mem⟩ := s_mem -+ simp only [List.coe_toFinset, List.mem_unattach, Set.mem_union, Set.mem_inv, -+ Set.mem_ofPred_eq] at y_mem -+ obtain ⟨s_mem_S'', s_mem_choose⟩ := y_mem -+ simp at s_mem_S'' -+ simp only [Subtype.dist_eq, dist_eq_norm_sub] at s_mem_S'' -+ rw [or_comm] at s_mem_S'' -+ conv at s_mem_S'' => -+ right -+ arg 1 -+ arg 1 -+ equals (star s.val.val * 1 - (star s.val.val) * s.val.val) => -+ simp -+ -+ rw [← mul_sub] at s_mem_S'' -+ rw [← Unitary.coe_star] at s_mem_S'' -+ rw [CStarRing.norm_coe_unitary_mul] at s_mem_S'' -+ nth_rw 2 [norm_sub_rev] at s_mem_S'' -+ simp at s_mem_S'' -+ · exact s_mem_S'' -+ · -+ rename_i s_eq_one -+ simp at s_eq_one -+ simp [s_eq_one] -+ have foo := H_n_eps_pos hn -+ linarith -+ -+ -+ have S_finite: Set.Finite S := by -+ dsimp [S] -+ apply Set.Finite.union -+ · -+ simp -+ dsimp [pre_S] -+ apply Set.Finite.sUnion -+ · -+ apply Set.finite_range -+ · -+ intro y hy -+ rw [Set.mem_range] at hy -+ obtain ⟨x, x_mem, y_eq⟩ := hy -+ apply Set.Finite.union -+ · apply Finset.finite_toSet -+ · simp -+ · simp -+ -+ have S_union_Sinv: S ∪ S⁻¹ = S := by -+ dsimp [S] -+ simp [-Set.union_singleton] -+ grind -+ -+ have S_eq_Sinv: S = S⁻¹ := by -+ rw [← S_union_Sinv] -+ simp -+ rw [Set.union_comm] -+ -+ have S_generates : Subgroup.closure S = G' n (H_n_eps hn) G := by -+ apply le_antisymm -+ · apply (Subgroup.closure_le (K := G' n (H_n_eps hn) G)).2 -+ intro g hg -+ apply Subgroup.subset_closure -+ simpa only [Metric.mem_ball, Subtype.dist_eq, dist_eq_norm_sub, norm_sub_rev, -+ Subgroup.coe_one, Submonoid.coe_one] -+ using S_dist g hg -+ · have hgen : ∀ g : G' n (H_n_eps hn) G, g.val ∈ Subgroup.closure S := by -+ intro g -+ have hg : g ∈ Subgroup.closure S'' := by rw [S''_generates]; trivial -+ induction hg using Subgroup.closure_induction with -+ | mem g hg => -+ have hprod := (s_list ⟨g, hg⟩).choose_spec -+ rw [← hprod] -+ apply Subgroup.list_prod_mem -+ intro x hx -+ apply Subgroup.subset_closure -+ apply Set.mem_union_left -+ apply Set.mem_union_left -+ apply Set.mem_iUnion.mpr -+ refine ⟨⟨g, S''_finite.mem_toFinset.mpr hg⟩, Or.inl ?_⟩ -+ exact List.mem_toFinset.mpr hx -+ | one => exact Subgroup.one_mem _ -+ | mul x y hx hy hx' hy' => exact Subgroup.mul_mem _ hx' hy' -+ | inv x hx hx' => exact Subgroup.inv_mem _ hx' -+ intro g hg -+ exact hgen ⟨g, hg⟩ -+ -+ exact ⟨S, S_dist, S_finite, S_eq_Sinv, S_generates, by simp [S]⟩ -+ -+private lemma small_generators_growth (n : ℕ) (hn : 2 ≤ n) -+ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) -+ (S_poly_data : SPolyData (G' n (H_n_eps hn) G)) -+ (S : Set G) (S_finite : S.Finite) -+ (s_to_map : S_finite.toFinset → Subgroup.map G.subtype (G' n (H_n_eps hn) G)) -+ (h_map : ∀ a, (s_to_map a).val = a.val.val) : -+ ∃ a : ℕ, a ≥ 1 ∧ ∀ r ≥ 1, -+ #(Finset.image s_to_map S_finite.toFinset.attach ^ r) ≤ a * r ^ S_poly_data.S_poly_deg := by -+ classical -+ have poly_pos := S_poly_data.S_poly_const_pos -+ have new_try := poly_growth_equiv S_poly_data.S_poly_const S_poly_data.S_poly_deg (by omega) (S_poly_data.S_finite.toFinset) -+ (Finset.image (fun a => ⟨⟨(s_to_map a).val, by (rw [h_map]; exact a.val.property)⟩, by ( -+ have foo := (s_to_map a).property -+ rw [Subgroup.mem_map] at foo -+ obtain ⟨x, x_mem, x_eq⟩ := foo -+ simp_rw [← x_eq] -+ simp [x_mem] -+ )⟩) S_finite.toFinset.attach) ?_ ?_ ?_ ?_ -+ · -+ obtain ⟨b, b_pos, hb⟩ := new_try -+ use b -+ refine ⟨b_pos, ?_⟩ -+ intro r hr -+ rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] -+ rw [Finset.image_pow] -+ rw [Finset.image_image] -+ simp -+ conv => -+ arg 1 -+ arg 1 -+ arg 1 -+ equals Finset.image (Subgroup.subtype _) S_finite.toFinset => -+ ext a -+ rw [Finset.mem_image] -+ refine ⟨?_, ?_⟩ -+ · intro x -+ obtain ⟨y, y_mem, y_eq⟩ := x -+ rw [Finset.mem_image] -+ use y -+ rw [← y_eq] -+ simp [h_map] -+ · intro x_mem -+ rw [Finset.mem_image] at x_mem -+ obtain ⟨y, y_mem, y_eq⟩ := x_mem -+ use ⟨y, y_mem⟩ -+ simp [h_map] -+ exact y_eq -+ -+ -+ specialize hb r hr -+ rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] at hb -+ rw [Finset.image_pow] at hb -+ rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] at hb -+ rw [Finset.image_pow] at hb -+ conv at hb => -+ arg 1 -+ arg 1 -+ arg 1 -+ equals Finset.image (Subgroup.subtype _) S_finite.toFinset => -+ ext a -+ rw [Finset.mem_image] -+ refine ⟨?_, ?_⟩ -+ · intro x -+ obtain ⟨y, y_mem, y_eq⟩ := x -+ rw [Finset.mem_image] -+ use y -+ rw [← y_eq] -+ simp -+ rw [Finset.image_image] at y_mem -+ rw [Finset.mem_image] at y_mem -+ obtain ⟨z, z_mem, z_eq⟩ := y_mem -+ simp at z_eq -+ rw [← z_eq] -+ simp [h_map] -+ have z_prop := z.property -+ rw [Set.Finite.mem_toFinset] at z_prop -+ exact z_prop -+ · intro x_mem -+ rw [Finset.mem_image] at x_mem -+ obtain ⟨y, y_mem, y_eq⟩ := x_mem -+ use y -+ refine ⟨?_, y_eq⟩ -+ rw [Finset.image_image] -+ rw [Finset.mem_image] -+ simp at y_mem -+ use ⟨y, by simp [y_mem]⟩ -+ simp [h_map] -+ exact hb -+ · -+ have fintype_s: Fintype ↑S_poly_data.S := by -+ refine Set.Finite.fintype ?_ -+ exact S_poly_data.S_finite -+ -+ -+ simp -+ conv => -+ rhs -+ equals (S_poly_data.S).toFinset => -+ ext a -+ simp -+ nth_rw 1 [S_poly_data.S_inv] -+ simp -+ · -+ simp -+ apply S_poly_data.S_one -+ · -+ simp -+ exact S_poly_data.S_generates -+ · -+ intro n hn -+ have S_poly := S_poly_data.S_poly n hn -+ exact S_poly -+ -+ -+ - lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) (G_FG : G.FG) - (G'_central_trivial : ∀ g : (G' n (H_n_eps hn) G), g ∈ Set.center (G' n (H_n_eps hn) G) → ∃ z : ℂ, g.val.val.val = z • 1) - (G'_finite_index: (G' n (H_n_eps hn) G).FiniteIndex) -@@ -240,247 +525,12 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( - - - let S' := S_poly_data.S -- have S'_finite := S_poly_data.S_finite -- -- -- Add identity and inverses to S' to make things easier - let S'' := S' -- have S''_finite: Set.Finite S'' := by -- dsimp [S''] -- apply S'_finite -- -- -- have S''_eq_S''inv: S'' = S''⁻¹ := by -- unfold S'' -- apply S_poly_data.S_inv -- -- -- have S''_generates: Subgroup.closure S'' = ⊤ := by -- dsimp [S''] -- apply S_poly_data.S_generates -- -- -- have s_list (s: S'') := (mem_closure_prod_list ((Metric.ball (1 : G) (H_n_eps hn)) ∪ (Metric.ball (1 : G) (H_n_eps hn))⁻¹) (by -- simp -- rw [Set.union_comm] -- ) s (by -- have s_prop := s.val.property -- simp only [G'] at s_prop -- rw [Subgroup.closure_union] -- simp [s_prop] -- )) -- -- -- Write each element in S'' as a product of elements of S', and then collect all of the used elements into a set -- -- We may need to manually union this with S⁻¹, since the inverse of the produces -- -- could be chosen to be built with different elements (not the inverses of the ones in the original list) -- let pre_S := ⋃ s : S''_finite.toFinset, ((s_list ⟨s, by ( -- have foo := s.property -- rw [Set.Finite.mem_toFinset] at foo -- exact foo -- )⟩).choose.unattach.toFinset : Set ↥G) ∪ {1} -- let S := pre_S ∪ pre_S⁻¹ ∪ {1} -- -- have S_dist: ∀ s ∈ S, ‖s.val.val - 1‖ < H_n_eps hn := by -- intro s hs -- dsimp [S] at hs -- -- rw [Set.union_assoc] at hs -- cases hs -- . rename_i s_mem -- dsimp [pre_S] at s_mem -- rw [Set.mem_iUnion] at s_mem -- obtain ⟨y, y_mem⟩ := s_mem -- simp only [List.coe_toFinset, List.mem_unattach, Set.mem_union, Set.mem_inv, -- Set.mem_setOf_eq] at y_mem -- obtain ⟨s_mem_S'', s_mem_choose⟩ := y_mem -- simp at s_mem_S'' -- simp only [Subtype.dist_eq, dist_eq_norm_sub] at s_mem_S'' -- conv at s_mem_S'' => -- right -- arg 1 -- arg 1 -- equals (star s.val.val * 1 - (star s.val.val) * s.val.val) => -- simp -- -- rw [← mul_sub] at s_mem_S'' -- rw [← Unitary.coe_star] at s_mem_S'' -- rw [CStarRing.norm_coe_unitary_mul] at s_mem_S'' -- nth_rw 2 [norm_sub_rev] at s_mem_S'' -- simp at s_mem_S'' -- . exact s_mem_S'' -- . -- rename_i s_eq_one -- simp at s_eq_one -- simp [s_eq_one] -- have foo := H_n_eps_pos hn -- linarith -- . -- -- TODO - deduplicate most of this with the above case -- rename_i s_mem -- rw [Set.union_comm] at s_mem -- cases s_mem -- . rename_i s_mem_one -- simp at s_mem_one -- simp [s_mem_one] -- apply H_n_eps_pos -- -- rename_i s_mem -- dsimp [pre_S] at s_mem -- rw [Set.iUnion_inv] at s_mem -- rw [Set.mem_iUnion] at s_mem -- obtain ⟨y, y_mem⟩ := s_mem -- simp only [List.coe_toFinset, List.mem_unattach, Set.mem_union, Set.mem_inv, -- Set.mem_setOf_eq] at y_mem -- obtain ⟨s_mem_S'', s_mem_choose⟩ := y_mem -- simp at s_mem_S'' -- simp only [Subtype.dist_eq, dist_eq_norm_sub] at s_mem_S'' -- rw [or_comm] at s_mem_S'' -- conv at s_mem_S'' => -- right -- arg 1 -- arg 1 -- equals (star s.val.val * 1 - (star s.val.val) * s.val.val) => -- simp -- -- rw [← mul_sub] at s_mem_S'' -- rw [← Unitary.coe_star] at s_mem_S'' -- rw [CStarRing.norm_coe_unitary_mul] at s_mem_S'' -- nth_rw 2 [norm_sub_rev] at s_mem_S'' -- simp at s_mem_S'' -- . exact s_mem_S'' -- . -- rename_i s_eq_one -- simp at s_eq_one -- simp [s_eq_one] -- have foo := H_n_eps_pos hn -- linarith -- -- -- have S_finite: Set.Finite S := by -- dsimp [S] -- apply Set.Finite.union -- . -- simp -- dsimp [pre_S] -- apply Set.Finite.sUnion -- . -- apply Set.finite_range -- . -- intro y hy -- rw [Set.mem_range] at hy -- obtain ⟨x, x_mem, y_eq⟩ := hy -- apply Set.Finite.union -- . apply Finset.finite_toSet -- . simp -- . simp -- -- have S_union_Sinv: S ∪ S⁻¹ = S := by -- dsimp [S] -- simp [-Set.union_singleton] -- grind -- -- have S_eq_Sinv: S = S⁻¹ := by -- rw [← S_union_Sinv] -- simp -- rw [Set.union_comm] -- -- have S_generates: Subgroup.closure S = (G' n (H_n_eps hn) G) := by -- -- ext a -- unfold S -- rw [Subgroup.closure_union] -- simp -- rw [Subgroup.closure_union] -- simp -- unfold pre_S -- refine ⟨?_, ?_⟩ -- . intro ha -- -- TODO - only the 'mem' case is non-trivial. We probably don't actually need a full induction proof -- induction ha using Subgroup.closure_induction with -- | one => -- simp [G'] -- | mem x hx => -- rw [Set.mem_iUnion] at hx -- obtain ⟨y, y_mem⟩ := hx -- have y_prop := y.property -- rw [Set.Finite.mem_toFinset] at y_prop -- cases y_mem -- . -- rename_i y_mem -- simp at y_mem -- obtain ⟨x_dist, x_mem⟩ := y_mem -- simp [G'] -- apply Subgroup.mem_closure_of_mem -- simp -- cases x_dist -- . rename_i x_dist_le -- exact x_dist_le -- . rename_i x_inv_dist -- -- -- TODO - deduplicate this, in particular the 'CStarRing.norm_coe_unitary_mul' code -- simp only [Subtype.dist_eq, dist_eq_norm_sub] at x_inv_dist -- conv at x_inv_dist => -- lhs -- arg 1 -- equals (star x.val.val * 1 - (star x.val.val) * x.val.val) => -- simp -- -- rw [← mul_sub] at x_inv_dist -- rw [← Unitary.coe_star] at x_inv_dist -- rw [CStarRing.norm_coe_unitary_mul] at x_inv_dist -- rw [norm_sub_rev] at x_inv_dist -- simp only [Subtype.dist_eq, dist_eq_norm_sub] -- exact x_inv_dist -- . -- rename_i x_mem_one -- simp at x_mem_one -- simp [x_mem_one] -- | mul x y hx hy x_mem y_mem => -- apply Subgroup.mul_mem -- . exact x_mem -- . exact y_mem -- | inv x hx x_mem => -- apply Subgroup.inv_mem -- exact x_mem -- . -- intro ha -- apply_fun (Subgroup.map (G' n (H_n_eps hn) G).subtype) at S''_generates -- conv at S''_generates => -- rhs -- equals (G' n (H_n_eps hn) G) => -- ext a -- simp -- -- rw [← S''_generates] at ha -- simp at ha -- obtain ⟨a_mem_g', a_mem_closure⟩ := ha -- rw [← Subgroup.mem_toSubmonoid] at a_mem_closure -- rw [Subgroup.closure_toSubmonoid] at a_mem_closure -- obtain ⟨l, l_mem, l_prod_eq⟩ := Submonoid.exists_list_of_mem_closure a_mem_closure -- rw [Subtype.ext_iff] at l_prod_eq -- simp at l_prod_eq -- rw [← l_prod_eq] -- apply Subgroup.list_prod_mem -- intro x x_mem_l -- simp at x_mem_l -- obtain ⟨x_mem_g', x_mem_l⟩ := x_mem_l -- have x_mem_ball := l_mem _ x_mem_l -- -- rw [Subgroup.closure_iUnion] -- rw [← S''_eq_S''inv] at x_mem_ball -- simp at x_mem_ball -- apply Subgroup.mem_iSup_of_mem (i := ⟨⟨x, x_mem_g'⟩, (by simp; apply x_mem_ball)⟩) -- have my_spec := (s_list ⟨⟨x, x_mem_g'⟩, x_mem_ball⟩).choose_spec -- simp at my_spec -- conv => -- arg 2 -- rw [← my_spec] -- -- apply Subgroup.list_prod_mem -- intro b b_mem -- apply Subgroup.mem_closure_of_mem -- apply Set.mem_union_left -- simpa using b_mem -- -+ have S''_generates : Subgroup.closure S'' = ⊤ := S_poly_data.S_generates -+ have S''_eq_S''inv : S'' = S''⁻¹ := S_poly_data.S_inv -+ obtain ⟨S, S_dist, S_finite, S_eq_Sinv, S_generates, S_one⟩ := -+ small_finite_generators n hn G S_poly_data -+ have S_union_Sinv : S ∪ S⁻¹ = S := by rw [← S_eq_Sinv]; simp - - have nontrivial_h: ∃ h: S, ∀ z: ℂ, h.val.val.val ≠ z • 1 := by - by_contra! -@@ -497,7 +547,7 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( - - have list_prod_trivial: ∃ z: ℂ, l.unattach.unattach.prod = z • 1 := by - apply List.prod_induction (p := fun a => ∃ z: ℂ, a = z • 1) -- . -+ · - intro a b a_diag b_diag - obtain ⟨a_z, a_eq⟩ := a_diag - obtain ⟨b_z, b_eq⟩ := b_diag -@@ -505,9 +555,9 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( - rw [a_eq, b_eq] - rw [mul_smul] - simp -- . use 1 -+ · use 1 - simp -- . -+ · - intro x x_mem - rw [List.mem_unattach] at x_mem - obtain ⟨a, ha⟩ := x_mem -@@ -548,111 +598,8 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( - - have poly_pos := S_poly_data.S_poly_const_pos - -- have my_map: ∃ a: ℕ, a ≥ 1 ∧ ∀ r ≥ 1, #(Finset.image s_to_map S_finite.toFinset.attach ^ r) ≤ a * r ^ (S_poly_data.S_poly_deg) := by -- have new_try := poly_growth_equiv S_poly_data.S_poly_const S_poly_data.S_poly_deg (by omega) (S_poly_data.S_finite.toFinset) -- (Finset.image (fun a => ⟨⟨(s_to_map a).val, by (apply SetLike.coe_mem)⟩, by ( -- have foo := (s_to_map a).property -- rw [Subgroup.mem_map] at foo -- obtain ⟨x, x_mem, x_eq⟩ := foo -- simp_rw [← x_eq] -- simp [x_mem] -- )⟩) S_finite.toFinset.attach) ?_ ?_ ?_ ?_ -- . -- obtain ⟨b, b_pos, hb⟩ := new_try -- use b -- refine ⟨b_pos, ?_⟩ -- intro r hr -- rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] -- rw [Finset.image_pow] -- rw [Finset.image_image] -- simp -- conv => -- arg 1 -- arg 1 -- arg 1 -- equals Finset.image (Subgroup.subtype _) S_finite.toFinset => -- ext a -- rw [Finset.mem_image] -- refine ⟨?_, ?_⟩ -- . intro x -- obtain ⟨y, y_mem, y_eq⟩ := x -- rw [Finset.mem_image] -- use y -- rw [← y_eq] -- simp [s_to_map] -- . intro x_mem -- rw [Finset.mem_image] at x_mem -- obtain ⟨y, y_mem, y_eq⟩ := x_mem -- use ⟨y, y_mem⟩ -- simp [s_to_map] -- exact y_eq -- -- -- specialize hb r hr -- rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] at hb -- rw [Finset.image_pow] at hb -- rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] at hb -- rw [Finset.image_pow] at hb -- conv at hb => -- arg 1 -- arg 1 -- arg 1 -- equals Finset.image (Subgroup.subtype _) S_finite.toFinset => -- ext a -- rw [Finset.mem_image] -- refine ⟨?_, ?_⟩ -- . intro x -- obtain ⟨y, y_mem, y_eq⟩ := x -- rw [Finset.mem_image] -- use y -- rw [← y_eq] -- simp [s_to_map] -- rw [Finset.image_image] at y_mem -- rw [Finset.mem_image] at y_mem -- obtain ⟨z, z_mem, z_eq⟩ := y_mem -- simp at z_eq -- rw [← z_eq] -- simp [s_to_map] -- have z_prop := z.property -- rw [Set.Finite.mem_toFinset] at z_prop -- exact z_prop -- . intro x_mem -- rw [Finset.mem_image] at x_mem -- obtain ⟨y, y_mem, y_eq⟩ := x_mem -- use y -- refine ⟨?_, y_eq⟩ -- rw [Finset.image_image] -- rw [Finset.mem_image] -- simp at y_mem -- use ⟨y, by simp [y_mem]⟩ -- simp [s_to_map] -- exact hb -- . -- have fintype_s: Fintype ↑S_poly_data.S := by -- refine Set.Finite.fintype ?_ -- exact S_poly_data.S_finite -- -- -- simp -- conv => -- rhs -- unfold Set.Finite.toFinset -- equals (S_poly_data.S).toFinset => -- ext a -- simp -- nth_rw 1 [S_poly_data.S_inv] -- simp -- . -- simp -- apply S_poly_data.S_one -- . -- simp -- exact S_poly_data.S_generates -- . -- intro n hn -- have S_poly := S_poly_data.S_poly n hn -- exact S_poly -- -+ have my_map := small_generators_growth n hn G S_poly_data S S_finite -+ s_to_map (by intro a; rfl) - - obtain ⟨new_const, new_const_pos, h_poly_new_const⟩ := my_map - -@@ -700,146 +647,29 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( - - S := (((Finset.image s_to_map) S_finite.toFinset.attach : Finset _) : Set _) - S_generates := by -- simp -- have orig_S'' := S''_generates -- apply_fun (Subgroup.map (G' n (H_n_eps hn) G).subtype) at S''_generates -- conv at S''_generates => -- rhs -- equals (G' n (H_n_eps hn) G) => -- ext a -- simp -- -- apply_fun (Subgroup.map ({ -- toFun := fun a => (⟨a.val, (by -- have prop := a.property -- rw [Subgroup.mem_map] at prop -- obtain ⟨x, x_mem, x_eq⟩ := prop -- rw [← x_eq] -- simp -- )⟩ : G), -- map_one' := by -- simp -- map_mul' := by -- intro a b -- simp -- })) using (?_) -- . conv => -- rhs -- equals (G' n (H_n_eps hn) G) => -- ext a -- rw [Subgroup.mem_map] -- refine ⟨?_, ?_⟩ -- . -- intro exists_x -- obtain ⟨x, x_mem, a_eq⟩ := exists_x -- simp at a_eq -- have x_prop := x.property -- rw [Subgroup.mem_map] at x_prop -- obtain ⟨y, y_mem, x_eq_y⟩ := x_prop -- rw [← a_eq] -- conv => -- arg 2 -- simp [← x_eq_y] -- exact y_mem -- . intro a_mem -- use ⟨a, ?_⟩ -- . refine ⟨by simp, ?_⟩ -- simp -- . rw [Subgroup.mem_map] -- use ⟨a, ?_⟩ -- . refine ⟨by simp; apply a_mem, ?_⟩ -- simp -- . simp -- -- conv => -- rhs -- rw [← S''_generates] -- ext a -- rw [Subgroup.mem_map] -- refine ⟨?_, ?_⟩ -- . -- intro ha -- simp at ha -- simp -- obtain ⟨b, b_mem, a_mem_g, b_mem_closure, a_eq_b⟩ := ha -- use ?_ -- . conv => -- arg 2 -- simp only [← a_eq_b] -- -- rw [orig_S''] -- simp -- . obtain ⟨b_mem, b_mem_g'⟩ := a_mem_g -- rw [← a_eq_b] -- simp [b_mem_g'] -- . intro ha -- have a_val_mem: a.val ∈ Subgroup.map G.subtype (G' n (H_n_eps hn) G) := by -- simp at ha -- simp -- obtain ⟨a_mem_g', a_mem_closure⟩ := ha -- apply a_mem_g' -- -- use ⟨a, ?_⟩ -- . refine ⟨?_, by simp⟩ -- rw [← Subgroup.mem_toSubmonoid] -- rw [Subgroup.closure_toSubmonoid] -- rw [← SetLike.mem_coe] -- rw [Submonoid.closure_eq_image_prod] -- rw [Set.mem_image] -- rw [Subgroup.mem_map] at ha -- obtain ⟨b, b_mem, a_eq_b⟩ := ha -- have b_prop := b.property -- conv at b_prop => -- arg 1 -- rw [← S_generates] -- have b_list := mem_closure_prod_list S S_eq_Sinv b b_prop -- obtain ⟨l, l_prod⟩ := b_list -- use List.map (fun d => ⟨d.val, ?_⟩) l -- . -- refine ⟨?_, ?_⟩ -- . -- rw [Set.mem_setOf (a := List.map _ _)] -- intro p p_mem -- apply Set.mem_union_left -- rw [List.mem_map] at p_mem -- rw [Set.mem_range] -- obtain ⟨z, z_mem, z_eq_p⟩ := p_mem -- use ⟨z, by simp⟩ -- rw [← z_eq_p] -- . -- conv => -- rhs -- simp [← a_eq_b] -- conv => -- rhs -- simp [← l_prod] -- apply Subtype.ext -- simp -- rw [List.comp_map] -- simp -- apply congrArg -- ext i g -- simp -- -- . -- have my_mem := S_mem_G' d (by simp) -- apply Subgroup.mem_map_of_mem -- apply my_mem -- . exact a_val_mem -+ let L := Subgroup.map G.subtype (G' n (H_n_eps hn) G) -+ apply Subgroup.map_injective (f := L.subtype) Subtype.val_injective -+ rw [MonoidHom.map_closure] -+ have himg : L.subtype '' (Finset.image s_to_map S_finite.toFinset.attach : Set L) -+ = G.subtype '' S := by -+ ext u -+ constructor -+ · rintro ⟨t, ht, rfl⟩ -+ obtain ⟨a, ha, rfl⟩ := Finset.mem_image.mp ht -+ exact ⟨a.val, S_finite.mem_toFinset.mp a.property, rfl⟩ -+ · rintro ⟨g, hg, rfl⟩ -+ let a : S_finite.toFinset := ⟨g, S_finite.mem_toFinset.mpr hg⟩ -+ exact ⟨s_to_map a, Finset.mem_image.mpr ⟨a, by simp, rfl⟩, rfl⟩ -+ rw [himg, ← MonoidHom.map_closure, S_generates] -+ rw [← MonoidHom.range_eq_map, Subgroup.range_subtype] - - S_finite := by - simp - apply Set.finite_range - S_one := by -- simp -- dsimp [S] -- use 1 -- use (by simp) -- use (by apply Subgroup.one_mem) -- use ?_ -+ rw [Finset.mem_coe, Finset.mem_image] -+ refine ⟨⟨1, S_finite.mem_toFinset.mpr S_one⟩, by simp, ?_⟩ - simp [s_to_map] -- apply Set.mem_union_right -- simp - S_inv := by - intro s hs - rw [Finset.mem_coe] at hs -@@ -848,11 +678,11 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( - obtain ⟨x, x_mem, s_eq⟩ := hs - rw [Finset.mem_image] - use ⟨x⁻¹, ?_⟩ -- . -+ · - simp - rw [← s_eq] - rfl -- . simp -+ · simp - - nth_rw 1 [S_eq_Sinv] - simp -@@ -876,74 +706,31 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( - S_poly := by - simp - apply h_poly_new_const -- h := ⟨⟨h.val.val, by ( -- have h_prop := h.property -- simp only [S] at h_prop -- simp -- cases h_prop -- . rename_i h_mem -- . cases h_mem -- . rename_i h_prop -- dsimp [pre_S] at h_prop -- rw [Set.mem_iUnion] at h_prop -- obtain ⟨y, y_mem⟩ := h_prop -- simp [-Set.mem_inv] at y_mem -- have h_dist := S_dist h (by simp) -- simp [G'] -- apply Subgroup.mem_closure_of_mem -- simp -- simp only [Subtype.dist_eq, dist_eq_norm_sub] -- exact h_dist -- . rename_i h_prop -- -- TODo: deduplicate -- dsimp [pre_S] at h_prop -- simp_rw [Set.iUnion_inv] at h_prop -- rw [Set.mem_iUnion] at h_prop -- obtain ⟨y, y_mem⟩ := h_prop -- simp [-Set.mem_inv] at y_mem -- have h_dist := S_dist h (by simp) -- simp [G'] -- apply Subgroup.mem_closure_of_mem -- simp -- simp only [Subtype.dist_eq, dist_eq_norm_sub] -- exact h_dist -- . rename_i h_mem -- simp at h_mem -- simp [G'] -- simp [h_mem] -- )⟩, by -- rw [Finset.mem_coe] -- rw [Finset.mem_image] -- use ⟨h.val, by simp⟩ -- simp [s_to_map] -- ⟩ -+ h := ⟨⟨h.val.val, Subgroup.mem_map_of_mem G.subtype (S_mem_G' h.val h.property)⟩, by -+ rw [Finset.mem_coe, Finset.mem_image] -+ refine ⟨⟨h.val, S_finite.mem_toFinset.mpr h.property⟩, by simp, ?_⟩ -+ rfl⟩ - h_nontrivial := by - simpa using h_nontrivial - } -- . -- apply Subgroup.map_injective -- simp -- intro x y hxy -- simpa using hxy -- - have contra := H_n_contradiction h_n_data (1 / 50) ?_ ?_ ?_ ?_ -- . contradiction -- . simp -- . simp -+ · contradiction -+ · simp -+ · simp - norm_num -- . -+ · - rw [← div_le_iff₀'] -- . -+ · - rw [le_inv_comm₀] -- . -+ · - simp - simp [H_n_eps] - left - norm_num -- . simp -- . apply H_n_eps_pos -- . simp -- . -+ · simp -+ · apply H_n_eps_pos -+ · simp -+ · - simp - unfold H_n_eps - -@@ -954,10 +741,10 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( - simp [h_n_data] - norm_num - apply div_lt_div₀ -- . norm_num -- . apply le_refl -- . norm_num -- . positivity -+ · norm_num -+ · apply le_refl -+ · norm_num -+ · positivity - - end HnEpsData - -diff --git a/Gromov/Unitary/HnEps.lean b/Gromov/Unitary/HnEps.lean -index cfaf26d..83c61b0 100644 ---- a/Gromov/Unitary/HnEps.lean -+++ b/Gromov/Unitary/HnEps.lean -@@ -14,8 +14,6 @@ public section - - open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace - --set_option linter.style.longLine false --set_option linter.style.commandStart false - - open Subgroup Pointwise Finset - open scoped Pointwise Finset -@@ -198,7 +196,6 @@ theorem theorem_3_8_h_n_left_S (data: HnData) (prev: Theorem3_8_Data data): ∃ - - -- 'h' is our initial element - we define ε in terms of ‖h - 1‖, so that we can obtain the proper bound - -- for the commutators in the inductive case --set_option maxHeartbeats 500000 in - @[expose] - noncomputable def theorem_3_8_h_n (data : HnData) (n : ℕ): Theorem3_8_Data data := match hn : n with - | 0 => { -@@ -260,7 +257,6 @@ termination_by n - decreasing_by - simp - --#print axioms theorem_3_8_h_n - - omit h_n_eps_data in - lemma unitary_shrink {n : ℕ} (a b : Matrix.unitaryGroup (Fin n) ℂ): ‖(a * b).val - 1‖ ≤ ‖a.val - 1‖ + ‖b.val - 1‖ := by -@@ -326,10 +322,9 @@ lemma H_n_pow_le {a k : ℕ } {m : ℕ} (a_k_lt : a + k ≤ m) (pows : Fin m - | zero => - simp [List.ofFn, List.prod_nil] - | succ k ih => -- simp only [ne_eq, List.ofFn_succ'] -- simp only [Fin.coe_castSucc, Fin.val_last, List.concat_eq_append, List.prod_append, -- List.prod_cons, List.prod_nil, mul_one, Subgroup.val_list_prod, -- List.map_ofFn] -+ simp only [List.ofFn_succ'] -+ simp only [Fin.val_castSucc, Fin.val_last, List.concat_eq_append, List.prod_append, -+ List.prod_cons, List.prod_nil, mul_one] - - rw [Subgroup.coe_mul] - grw [unitary_shrink] -@@ -398,7 +393,7 @@ lemma H_n_prod_le_k {a k : ℕ } {m : ℕ} (a_k_lt : a + k + 1 ≤ m) (c : ℝ) - field_simp [eps_ne_zero] - - grw [c_lt] -- ring -+ ring_nf - rfl - · positivity - · grw [H_n_eps_lt data.hd] -@@ -418,8 +413,6 @@ lemma H_n_prod_le_k {a k : ℕ } {m : ℕ} (a_k_lt : a + k + 1 ≤ m) (c : ℝ) - grw [pows_le] - · omega - --#print axioms H_n_prod_le_k - --#synth Semiring (Matrix (Fin 2) (Fin 2) ℂ) - - end HnEpsData -diff --git a/Gromov/Unitary/HnLowerBound.lean b/Gromov/Unitary/HnLowerBound.lean -index 8c9b440..7ee4180 100644 ---- a/Gromov/Unitary/HnLowerBound.lean -+++ b/Gromov/Unitary/HnLowerBound.lean -@@ -13,8 +13,6 @@ public section - - open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace - --set_option linter.style.longLine false --set_option linter.style.commandStart false - - open Subgroup Pointwise Finset - open scoped Pointwise Finset -@@ -63,7 +61,8 @@ lemma f_deriv (a: ℝ) (ha: 0 < 1 + a) (x: ℝ): (deriv (f a)) x = 2*a - (Real.l - exact ha - - --lemma f_deriv_at_one (a: ℝ) (a_pos: 0 < a) (a_lt: a < 1) (ha: 0 < 1 + a): 0 < (deriv (f a) 1) := by -+omit h_n_eps_data in -+lemma f_deriv_at_one [_h_n_eps_data : HnEpsData] (a: ℝ) (a_pos: 0 < a) (a_lt: a < 1) (ha: 0 < 1 + a): 0 < (deriv (f a) 1) := by - rw [f_deriv _ ha] - grw [Real.log_le_sub_one_of_pos] - · have a_mul_self := mul_lt_of_lt_one_left (a := a) (b := a) (by linarith) (by linarith) -@@ -72,7 +71,8 @@ lemma f_deriv_at_one (a: ℝ) (a_pos: 0 < a) (a_lt: a < 1) (ha: 0 < 1 + a): 0 < - simp [ha] - - --lemma f_deriv_lower (a: ℝ) (ha: 0 < 1 + a) (a_pos: 0 < a) (x: ℝ) (f_zero: (deriv (f a)) x = 0): (Real.log 2) / a ≤ x := by -+omit h_n_eps_data in -+lemma f_deriv_lower [_h_n_eps_data : HnEpsData] (a: ℝ) (ha: 0 < 1 + a) (a_pos: 0 < a) (x: ℝ) (f_zero: (deriv (f a)) x = 0): (Real.log 2) / a ≤ x := by - have log_plus_le: Real.log (1 + a) ≤ a := by - grw [Real.log_le_sub_one_of_pos] - · simp -@@ -112,28 +112,28 @@ lemma f_pos_on (a: ℝ) (ha: 0 < 1 + a) (a_pos: 0 < a) (a_lt: a < 1) (a_lt_log: - - have one_lt : 1 < Real.log (2) / a := by - rw [lt_div_iff₀] -- . simp -+ · simp - exact a_lt_log -- . exact a_pos -+ · exact a_pos - - have f_strict := strictMonoOn_of_deriv_pos (f := f a) (D := Set.Icc 1 ((Real.log (2 )) / a)) (by apply convex_Icc) ?_ ?_ -- . -+ · - intro x hx - have f_lt := f_strict.lt_iff_lt (a := 1) (b := x) ?_ ?_ - rw [f_one_eq_zero] at f_lt - have x_prop := hx.left - simp [x_prop] at f_lt -- . exact f_lt -- . simp -+ · exact f_lt -+ · simp - linarith -- . simp -+ · simp - simp at hx - refine ⟨by linarith, hx.right⟩ -- . apply Continuous.continuousOn -+ · apply Continuous.continuousOn - unfold f - have one_plus: 1 + a ≠ 0 := by linarith - fun_prop (disch:=assumption) -- . -+ · - - intro x hx - simp at hx -@@ -154,30 +154,27 @@ lemma f_pos_on (a: ℝ) (ha: 0 < 1 + a) (a_pos: 0 < a) (a_lt: a < 1) (a_lt_log: - rw [Set.mem_image] at deriv_zero - obtain ⟨y, y_mem, y_deriv⟩ := deriv_zero - have y_nonzero := deriv_nonzero y y_mem -- . contradiction -- . apply Continuous.continuousOn -+ · contradiction -+ · apply Continuous.continuousOn - unfold f - have one_plus: ∀ x: ℝ, 1 + a ≠ 0 := by - intro x - linarith - fun_prop (disch:=assumption) -- . simp -+ · simp - refine ⟨by linarith, hx.right⟩ -- . simp -+ · simp - exact one_lt - - have not_zero := deriv_nonzero x ?_ -- . exact lt_of_le_of_ne deriv_pos (id (Ne.symm not_zero)) -- . simp -+ · exact lt_of_le_of_ne deriv_pos (id (Ne.symm not_zero)) -+ · simp - refine ⟨by linarith, hx.right⟩ - --#print axioms f_pos_on - - - lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnData) (m_lt: m < (1/2) / ‖(theorem_3_8_h_n data n).g.val.val - 1‖) : ‖((theorem_3_8_h_n data n).g.val.val^m) - 1‖ ≥ ‖((theorem_3_8_h_n data n).g.val).val - 1‖ := by - -- push_cast -- -- TODO: figure out how to get 'SubgroupClass.coe_zpow' to fire for Matrix.unitaryGroup - - conv => - lhs -@@ -227,15 +224,15 @@ lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnD - grw [norm_sum_le] - - grw [Finset.sum_le_sum (g := fun i => ‖((theorem_3_8_h_n data n).g.val.val - 1)‖ ^ (i + 1 + 1) * (m.choose (i + 1 + 1)))] -- . -+ · - rw [← my_pow] - - have S_le : (1 + ‖((theorem_3_8_h_n data n).g).val.val - 1‖)^m - ((‖(theorem_3_8_h_n data n).g.val.val - 1‖) * (m : ℝ) + 1) ≤ (m - 1) * ‖(theorem_3_8_h_n data n).g.val.val - 1‖ := by - by_cases m_eq_one: m = 1 -- . -+ · - simp [m_eq_one] - rw [add_comm] -- . -+ · - have my_bound := f_pos_on ‖((theorem_3_8_h_n data n).g.val.val - 1)‖ ?_ ?_ ?_ ?_ m ?_ - simp [f] at my_bound - rw [two_mul] at my_bound -@@ -248,23 +245,23 @@ lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnD - grw [my_bound] - simp - ring_nf -- . rfl -- . positivity -- . -+ · rfl -+ · positivity -+ · - have val_ne := (theorem_3_8_h_n data n).g_dist_nonzero - positivity -- . -+ · - have val_le := (theorem_3_8_h_n data n).g_dist - grw [val_le] - grw [H_n_eps_lt] - norm_num -- . -+ · - have val_le := (theorem_3_8_h_n data n).g_dist - grw [val_le] - grw [H_n_eps_lt] - norm_num - linarith [Real.log_two_gt_d9] -- . simp -+ · simp - refine ⟨by omega, ?_⟩ - grw [← ge_iff_le] - grw [Real.log_two_gt_d9.gt] -@@ -272,11 +269,11 @@ lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnD - grw [m_lt] - simp - apply div_le_div₀ -- . norm_num -- . norm_num -- . have ne_zero := (theorem_3_8_h_n data n).g_dist_nonzero -+ · norm_num -+ · norm_num -+ · have ne_zero := (theorem_3_8_h_n data n).g_dist_nonzero - positivity -- . rfl -+ · rfl - - - rw [add_comm] -@@ -300,29 +297,25 @@ lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnD - ring_nf - rfl - -- . intro i hi -+ · intro i hi - grw [norm_mul_le] - grw [norm_pow_le] - nth_rw 2 [Matrix.l2_opNorm_def] - grw [ContinuousLinearMap.opNorm_le_bound (M := m.choose (i + 1 + 1))] -- . simp -- . -+ · simp -+ · - intro x - simp -- rw [Matrix.toEuclideanLin_apply] -+ rw [Matrix.toLpLin_apply] - simp - rw [norm_smul] - simp - -- --apply_fun Norm.norm at my_pow - --#synth DivisionMonoid (Matrix.unitaryGroup (Fin 2) ℂ) - - --#synth DivInvMonoid (Matrix (Fin 2) (Fin 2) ℂ) - - ---- TODO: upstream to mathlib - omit h_n_eps_data in - lemma list_ofFn_drop {M: Type*} (a k: ℕ) (f: Fin (k + a) → M): (List.ofFn f).drop a = List.ofFn (fun (i: Fin k) => f ⟨a + i, by omega⟩) := by - induction a with -diff --git a/Gromov/Unitary/Packing.lean b/Gromov/Unitary/Packing.lean -index 2b64abe..1f804fe 100644 ---- a/Gromov/Unitary/Packing.lean -+++ b/Gromov/Unitary/Packing.lean -@@ -14,16 +14,100 @@ public section - - open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace - --set_option linter.style.longLine false --set_option linter.style.commandStart false - - open Subgroup Pointwise Finset - open scoped Pointwise Finset - open scoped commutatorElement IsMulCommutative - - --set_option synthInstance.maxHeartbeats 100000 in --set_option maxHeartbeats 500000 in -+private lemma unitary_separated_maximal (n : ℕ) -+ (A : Set (Matrix.unitaryGroup (Fin n) ℂ)) (ε : ℝ) : -+ ∃ I, Maximal (fun I => I ⊆ A ∧ -+ ∀ x ∈ I, ∀ y ∈ I, x ≠ y → ‖x.val - y.val‖ ≥ ε) I := by -+ let I_sets := { I | I ⊆ A ∧ -+ ∀ x ∈ I, ∀ y ∈ I, x ≠ y → ‖x.val - y.val‖ ≥ ε } -+ apply zorn_subset I_sets -+ intro S S_subset S_chain -+ refine ⟨S.sUnion, ?_, ?_⟩ -+ · simp only [ne_eq, ge_iff_le, Set.mem_ofPred_eq, -+ Set.sUnion_subset_iff, Set.mem_sUnion, forall_exists_index, and_imp, I_sets] -+ -+ refine ⟨?_, ?_⟩ -+ · intro s hs -+ simp [I_sets] at S_subset -+ specialize S_subset hs -+ simp at S_subset -+ exact S_subset.1 -+ · simp [I_sets] at S_subset -+ intro a M M_mem_S a_mem_M b N N_mem_S b_mem_N a_neq_b -+ simp [IsChain] at S_chain -+ specialize S_chain M_mem_S N_mem_S -+ by_cases M_eq_N : M = N -+ · rw [M_eq_N] at a_mem_M -+ specialize S_subset N_mem_S -+ simp at S_subset -+ exact S_subset.2 a (by simp) (by simp [a_mem_M]) b (by simp) (by simp [b_mem_N]) (by simp [a_neq_b]) -+ · specialize S_chain M_eq_N -+ match S_chain with -+ | .inl h => -+ have a_mem_N := h a_mem_M -+ specialize S_subset N_mem_S -+ simp at S_subset -+ exact S_subset.2 a (by simp) (by simp [a_mem_N]) b (by simp) (by simp [b_mem_N]) (by simp [a_neq_b]) -+ | .inr h => -+ have b_mem_M := h b_mem_N -+ specialize S_subset M_mem_S -+ simp at S_subset -+ exact S_subset.2 a (by simp) (by simp [a_mem_M]) b (by simp) (by simp [b_mem_M]) (by simp [a_neq_b]) -+ -+ -+ · intro s hs -+ exact Set.subset_sUnion_of_subset S s (fun ⦃a⦄ a ↦ a) hs -+ -+private lemma unitary_cosets_cover (n : ℕ) (ε : ℝ) -+ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) -+ (I : Set (Matrix.unitaryGroup (Fin n) ℂ)) [Fintype I] -+ (i_mem_G : ∀ i ∈ I, i ∈ G) -+ (balls_cover : G.carrier ⊆ ⋃ g ∈ I, Metric.ball g ε) -+ (inter_subset : ∀ g, g ∈ G.carrier → -+ Metric.ball g ε ∩ G.carrier ⊆ -+ (fun x => g * x.val) '' (G' n ε G).carrier) : -+ (⋃ i ∈ I.toFinset.attach, (((⟨i.val, i_mem_G i.val (Set.mem_toFinset.mp i.property)⟩ : G) • (((G' n ε G)) : Set G)) : (Set G))) = (Set.univ : Set G) := by -+ have balls_inter_cover : G.carrier ⊆ ⋃ g ∈ I, ((Metric.ball g ε) ∩ G.carrier) := by -+ intro g hg -+ specialize balls_cover hg -+ simp only [Set.mem_iUnion] at balls_cover -+ obtain ⟨i, i_mem, g_mem_i⟩ := balls_cover -+ simp only [Set.mem_iUnion] -+ use i -+ use i_mem -+ exact Set.mem_inter g_mem_i hg -+ -+ -+ simp -+ ext a -+ simp only [Set.mem_univ, iff_true] -+ have a_mem_g : a.val ∈ G.carrier := by simp -+ specialize balls_inter_cover a_mem_g -+ simp only [Set.mem_iUnion] at balls_inter_cover -+ obtain ⟨i, i_mem, a_mem_i⟩ := balls_inter_cover -+ have hiG : i ∈ G.carrier := i_mem_G i i_mem -+ specialize inter_subset i hiG -+ have a_mem := inter_subset a_mem_i -+ simp only [Set.mem_image] at a_mem -+ obtain ⟨x, hx, a_eq_mul⟩ := a_mem -+ simp only [Set.mem_iUnion] -+ have i_mem_finset : i ∈ I.toFinset := by -+ exact Set.mem_toFinset.mpr i_mem -+ use ⟨i, i_mem_finset⟩ -+ simp -+ rw [Set.mem_smul_set] -+ use x -+ refine ⟨?_, ?_⟩ -+ · exact hx -+ · rw [Subtype.ext_iff] -+ simp [a_eq_mul] -+ - open Pointwise in - lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : - ∃ C : ℝ, ∀ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)), (G' n ε G).FiniteIndex ∧ (G' n ε G).index ≤ C := by -@@ -43,13 +127,13 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : - let measure_haar : MeasureTheory.MeasureSpace (Matrix.unitaryGroup (Fin n) ℂ) := { - volume := MeasureTheory.Measure.haarMeasure compacts_univ - } -- haveI hinv : (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)).IsMulLeftInvariant := by -+ have hinv : (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)).IsMulLeftInvariant := by - show (MeasureTheory.Measure.haarMeasure compacts_univ).IsMulLeftInvariant - infer_instance -- haveI hfin : MeasureTheory.IsFiniteMeasure (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)) := by -+ have hfin : MeasureTheory.IsFiniteMeasure (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)) := by - show MeasureTheory.IsFiniteMeasure (MeasureTheory.Measure.haarMeasure compacts_univ) - infer_instance -- haveI hopen : (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)).IsOpenPosMeasure := by -+ have hopen : (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)).IsOpenPosMeasure := by - show (MeasureTheory.Measure.haarMeasure compacts_univ).IsOpenPosMeasure - infer_instance - -@@ -58,7 +142,7 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : - intro G - -- We can find a maximal subset I where ||a - b|| ≥ ε for distinct a, b in I - let I_sets := { S | S ⊆ G.carrier ∧ ∀ x ∈ S, ∀ y ∈ S, x ≠ y → ‖x.val - y.val‖ ≥ ε } -- have maximal_I := zorn_subset I_sets ?_ -+ have maximal_I := unitary_separated_maximal n G.carrier ε - · obtain ⟨I, hI⟩ := maximal_I - have balls_cover : G.carrier ⊆ ⋃ (g ∈ I), Metric.ball g ε := by - intro a ha -@@ -66,9 +150,8 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : - · have a_mem_I : a ∈ I := by - have enlarge_I : {a} ∪ I ∈ I_sets := by - simp [-Subtype.forall, I_sets] -- simp [Maximal] at hI -+ simp only [Maximal] at hI - have I_prop := hI.1 -- simp [-Subtype.forall, I_sets] at I_prop - refine ⟨?_, ?_⟩ - · apply Set.insert_subset ha I_prop.1 - · refine ⟨?_, ?_⟩ -@@ -105,9 +188,8 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : - -- Note - Vikman uses ε/2, but using ε/4 made things easier (it might actually be false for ε/2) - have disjoint_balls : I.PairwiseDisjoint (fun g => Metric.ball g ((ε/2)/2)) := by - intro a a_mem b b_mem a_neq_b -- simp [Maximal] at hI -+ simp only [Maximal] at hI - have I_prop := hI.1 -- simp [-Subtype.forall, I_sets] at I_prop - have dist_ge := I_prop.2 a a_mem b b_mem a_neq_b - simp [Disjoint] - intro X X_subset_A X_subset_B -@@ -228,58 +310,18 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : - - have i_mem_G : ∀ i ∈ I, i ∈ G := by - intro i i_mem -- simp [Maximal] at hI -+ simp only [Maximal] at hI - have I_prop := hI.1 -- simp [-Subtype.forall, I_sets] at I_prop - apply (I_prop.1 i_mem) - - -- have cosets_cover : (⋃ i ∈ I.toFinset.attach, (((⟨i.val, i_mem_G i.val (Set.mem_toFinset.mp i.property)⟩ : G) • (((G' n ε G)) : Set G)) : (Set G))) = (Set.univ : Set G) := by -- have balls_inter_cover : G.carrier ⊆ ⋃ g ∈ I, ((Metric.ball g ε) ∩ G.carrier) := by -- intro g hg -- specialize balls_cover hg -- simp only [Set.mem_iUnion] at balls_cover -- obtain ⟨i, i_mem, g_mem_i⟩ := balls_cover -- simp only [Set.mem_iUnion] -- use i -- use i_mem -- exact Set.mem_inter g_mem_i hg -- -- -- simp -- ext a -- simp only [Set.mem_univ, iff_true] -- have a_mem_g : a.val ∈ G.carrier := by simp -- specialize balls_inter_cover a_mem_g -- simp only [Set.mem_iUnion] at balls_inter_cover -- obtain ⟨i, i_mem, a_mem_i⟩ := balls_inter_cover -- have i_mem_G : i ∈ G.carrier := by -- simp [Maximal] at hI -- have I_prop := hI.1 -- simp [-Subtype.forall, I_sets] at I_prop -- apply (I_prop.1 i_mem) -- specialize inter_subset i i_mem_G -- have a_mem := inter_subset a_mem_i -- simp only [Set.mem_image] at a_mem -- obtain ⟨x, hx, a_eq_mul⟩ := a_mem -- simp only [Set.mem_iUnion] -- have i_mem_finset : i ∈ I.toFinset := by -- exact Set.mem_toFinset.mpr i_mem -- use ⟨i, i_mem_finset⟩ -- simp -- rw [Set.mem_smul_set] -- use x -- refine ⟨?_, ?_⟩ -- · exact hx -- · rw [Subtype.ext_iff] -- simp [a_eq_mul] -+ have cosets_cover := unitary_cosets_cover n ε G I i_mem_G balls_cover inter_subset - - refine ⟨?_, ?_⟩ - · apply Subgroup.finiteIndex_of_leftCoset_cover_const cosets_cover - · have I_subset_G : I ⊆ G := by -- simp [Maximal] at hI -+ simp only [Maximal] at hI - have i_mem := hI.1 -- simp [I_sets] at i_mem - exact i_mem.1 - - -@@ -306,44 +348,7 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : - MeasureTheory.measure_lt_top _ _⟩ - · exact cosets_cover - -- · intro S S_subset S_chain -- refine ⟨S.sUnion, ?_, ?_⟩ -- · simp only [ne_eq, ge_iff_le, Set.mem_setOf_eq, -- Set.sUnion_subset_iff, Set.mem_sUnion, forall_exists_index, and_imp, I_sets] -- -- refine ⟨?_, ?_⟩ -- · intro s hs -- simp [I_sets] at S_subset -- specialize S_subset hs -- simp at S_subset -- exact S_subset.1 -- · simp [I_sets] at S_subset -- intro a M M_mem_S a_mem_M b N N_mem_S b_mem_N a_neq_b -- simp [IsChain] at S_chain -- specialize S_chain M_mem_S N_mem_S -- by_cases M_eq_N : M = N -- · rw [M_eq_N] at a_mem_M -- specialize S_subset N_mem_S -- simp at S_subset -- exact S_subset.2 a (by simp) (by simp [a_mem_M]) b (by simp) (by simp [b_mem_N]) (by simp [a_neq_b]) -- · specialize S_chain M_eq_N -- match S_chain with -- | .inl h => -- have a_mem_N := h a_mem_M -- specialize S_subset N_mem_S -- simp at S_subset -- exact S_subset.2 a (by simp) (by simp [a_mem_N]) b (by simp) (by simp [b_mem_N]) (by simp [a_neq_b]) -- | .inr h => -- have b_mem_M := h b_mem_N -- specialize S_subset M_mem_S -- simp at S_subset -- exact S_subset.2 a (by simp) (by simp [a_mem_M]) b (by simp) (by simp [b_mem_M]) (by simp [a_neq_b]) -- -- -- · intro s hs -- exact Set.subset_sUnion_of_subset S s (fun ⦃a⦄ a ↦ a) hs - --#print axioms volume_packing - - - @[expose] -@@ -352,7 +357,6 @@ def FreshInnerProduct (V : Type*) := V - instance (V : Type*) [base_comm : AddCommGroup V]: AddCommGroup (FreshInnerProduct V) := base_comm - instance (V : Type*) [AddCommGroup V] [base_module : Module ℂ V]: Module ℂ (FreshInnerProduct V) := base_module - --#synth InnerProductSpace ℂ (EuclideanSpace ℂ (Fin 2)) - - - attribute [-simp] MeasureTheory.Measure.inv_eq_self -diff --git a/Gromov/Unitary/WeylTrick.lean b/Gromov/Unitary/WeylTrick.lean -index 8a2c528..7b5c66a 100644 ---- a/Gromov/Unitary/WeylTrick.lean -+++ b/Gromov/Unitary/WeylTrick.lean -@@ -13,8 +13,6 @@ public section - - open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace - --set_option linter.style.longLine false --set_option linter.style.commandStart false - - open Subgroup Pointwise Finset - open scoped Pointwise Finset -@@ -23,8 +21,36 @@ open scoped commutatorElement IsMulCommutative - - attribute [local implicit_reducible] FreshInnerProduct - --set_option maxHeartbeats 800000 in --set_option synthInstance.maxHeartbeats 500000 in -+private lemma unitary_of_faithful_inner_representation -+ {K W : Type*} [Group K] [NormedAddCommGroup W] -+ [InnerProductSpace ℂ W] [FiniteDimensional ℂ W] -+ (ρ : K →* Module.End ℂ W) (hρ : Function.Injective ρ) -+ (hinner : ∀ g x y, ⟪ρ g x, ρ g y⟫ = ⟪x, y⟫) : -+ ∃ S : Subgroup (Matrix.unitaryGroup (Fin (Module.finrank ℂ W)) ℂ), -+ Nonempty (S ≃* K) := by -+ let b := stdOrthonormalBasis ℂ W -+ have hu (g : K) : LinearMap.toMatrix b.toBasis b.toBasis (ρ g) ∈ -+ Matrix.unitaryGroup (Fin (Module.finrank ℂ W)) ℂ := by -+ let i : W →ₗᵢ[ℂ] W := { -+ toLinearMap := ρ g -+ norm_map' := (LinearMap.norm_map_iff_inner_map_map (ρ g)).mpr (hinner g) } -+ let e := LinearIsometryEquiv.ofSurjective i -+ ((LinearMap.injective_iff_surjective).mp i.injective) -+ exact e.toMatrix_mem_unitaryGroup b b -+ let f : K →* Matrix.unitaryGroup (Fin (Module.finrank ℂ W)) ℂ := { -+ toFun := fun g => ⟨LinearMap.toMatrix b.toBasis b.toBasis (ρ g), hu g⟩ -+ map_one' := by apply Subtype.ext; simp -+ map_mul' := by -+ intro g h -+ apply Subtype.ext -+ simp [LinearMap.toMatrix_mul] } -+ have hf : Function.Injective f := by -+ intro g h heq -+ apply hρ -+ apply (LinearMap.toMatrix b.toBasis b.toBasis).injective -+ exact congrArg Subtype.val heq -+ exact ⟨f.range, ⟨(MonoidHom.ofInjective hf).symm⟩⟩ -+ - lemma new_weyl_unitarian_trick {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V] (H : Subgroup (V →L[ℂ] V)ˣ) [LocallyCompactSpace H] [CompactSpace H]: ∃ S : Subgroup ↥(Matrix.unitaryGroup (Fin (Module.finrank ℂ V)) ℂ), Nonempty (S ≃* H) := by - let integrand := fun (v w : FreshInnerProduct V) (h : H) => ⟪(h.val.val v), (h.val.val w)⟫ - have continuous_integrand : ∀ v w : FreshInnerProduct V, Continuous fun h : H => integrand v w h := by -@@ -133,7 +159,7 @@ lemma new_weyl_unitarian_trick {V : Type*} [NormedAddCommGroup V] [InnerProductS - simp at inner_q_zero - have map_iff_zero := LinearMap.map_eq_zero_iff (f := q.val.val.toLinearMap) (x := x) ?_ - · exact map_iff_zero.mp inner_q_zero -- · -- TODO - find a better way of doing this -+ · - let my_map := (ContinuousLinearMap.toLinearMapRingHom (R₁ := ℂ) (M₁ := V)).toMonoidHom - let f_map := (Units.map my_map) q.val - let f_as_equiv := fun f => (LinearMap.GeneralLinearGroup.toLinearEquiv (R := ℂ) (M := V) f) -@@ -143,13 +169,12 @@ lemma new_weyl_unitarian_trick {V : Type*} [NormedAddCommGroup V] [InnerProductS - exact injective_f - · have foo := integrable_on x x - simp [integrand] at foo -- norm_cast - norm_cast at foo - apply MeasureTheory.Integrable.re at foo - norm_cast at foo - · rw [Pi.le_def] - intro y -- simpa using inner_self_nonneg (𝕜 := ℂ) (x := (y.val.val x)) -+ simp - } - · exact Ne.symm (NeZero.ne' (MeasureTheory.Measure.haar.inv Set.univ)) - -@@ -173,190 +198,21 @@ lemma new_weyl_unitarian_trick {V : Type*} [NormedAddCommGroup V] [InnerProductS - rfl - rw [hpt] - exact MeasureTheory.integral_mul_right_eq_self (integrand v w) h -- · -- finDimVectorspaceEquiv -- have rank_eq := Module.finrank_eq_rank' ℂ (FreshInnerProduct V) -- have V_equiv := (finDimVectorspaceEquiv (Module.finrank ℂ (FreshInnerProduct V)) rank_eq.symm).toContinuousLinearEquiv -- let V_equiv_fresh : V ≃L[ℂ] (FreshInnerProduct V) := ContinuousLinearEquiv.ofFinrankEq ?_ -- let V_fresh_arrow := ContinuousLinearEquiv.arrowCongr V_equiv_fresh V_equiv_fresh -- -- let new_H_matrix := ContinuousLinearMap.toLinearMap '' (Units.val '' H.carrier) -- -- Deliberate defeq abuse, so that things line up with our integral (which is over plain V) -- let new_H_coe : Set ((FreshInnerProduct V) →ₗ[ℂ] (FreshInnerProduct V)) := new_H_matrix -- -- -- -- have V_basis := stdOrthonormalBasis ℂ (FreshInnerProduct V) -- -- let H_matrix := (LinearMap.toMatrix V_basis.toBasis V_basis.toBasis) '' new_H_coe -- -- -- have H_mem_unitary : ∀ h ∈ H_matrix, h ∈ Matrix.unitaryGroup (Fin (Module.finrank ℂ (FreshInnerProduct V))) ℂ := by -- intro h h_mem -- simp [H_matrix, new_H_coe, new_H_matrix] at h_mem -- obtain ⟨u, u_mem, hu⟩ := h_mem -- let a : FreshInnerProduct V →ₗ[ℂ] FreshInnerProduct V := (↑↑u : V →ₗ[ℂ] V) -- have ha : (LinearMap.toMatrix V_basis.toBasis V_basis.toBasis) a = h := hu -- rw [← ha, Matrix.mem_unitaryGroup_iff'] -- -- `a` is the linear map underlying an element of `H`, so it preserves the new inner product. -- have preserves_inner : ∀ (x y : FreshInnerProduct V), ⟪a x, a y⟫ = ⟪x, y⟫ := by -- intro x y -- exact v_preserves_inner ⟨u, u_mem⟩ x y -- -- Preservation of the inner product means `adjoint a ∘ a = id`. -- have adj : a.adjoint ∘ₗ a = LinearMap.id := by -- apply LinearMap.ext -- intro x -- rw [LinearMap.comp_apply, LinearMap.id_apply] -- apply ext_inner_right ℂ -- intro y -- rw [LinearMap.adjoint_inner_left] -- exact preserves_inner x y -- have hmat : star (LinearMap.toMatrix V_basis.toBasis V_basis.toBasis a) * -- (LinearMap.toMatrix V_basis.toBasis V_basis.toBasis a) = 1 := by -- rw [Matrix.star_eq_conjTranspose, ← LinearMap.toMatrix_adjoint, ← LinearMap.toMatrix_comp, -- adj, LinearMap.toMatrix_id] -- exact hmat -- -- -- let H_matrix_subgroup : Subgroup (Matrix.unitaryGroup (Fin (Module.finrank ℂ V)) ℂ) := { -- carrier := Set.range (fun (h : H_matrix) => ⟨h.val, H_mem_unitary h (by simp)⟩), -- mul_mem' := by -- intro X Y hx hy -- simp -- use (X * Y).val -- simp -- simp at hx -- simp at hy -- simp [H_matrix] -- simp [H_matrix] at hx -- simp [H_matrix] at hy -- obtain ⟨a, ⟨p, p_mem, p_eq_a⟩, a_eq_x⟩ := hx -- obtain ⟨b, ⟨q, q_mem, q_eq_b⟩, b_eq_y⟩ := hy -- simp [new_H_coe, new_H_matrix] at q_mem -- simp [new_H_coe, new_H_matrix] at p_mem -- obtain ⟨y, y_mem, y_eq_q⟩ := q_mem -- obtain ⟨x, x_mem, x_eq_p⟩ := p_mem -- simp [new_H_coe, new_H_matrix] -- refine ⟨?_, rfl⟩ -- have hX : X.val = a := by rw [← a_eq_x] -- have hY : Y.val = b := by rw [← b_eq_y] -- refine ⟨x * y, H.mul_mem x_mem y_mem, ?_⟩ -- rw [hX, hY, ← p_eq_a, ← q_eq_b, ← LinearMap.toMatrix_mul, ← x_eq_p, ← y_eq_q] -- rfl -- one_mem' := by -- simp [H_matrix, new_H_coe, new_H_matrix] -- refine ⟨1, H.one_mem, ?_⟩ -- exact LinearMap.toMatrix_one _ -- inv_mem' := by -- simp -- intro a ha b hb a_eq_b -- refine ⟨a⁻¹, ?_, ?_⟩ -- · simp [H_matrix, new_H_coe, new_H_matrix] at ⊢ hb -- obtain ⟨u, u_mem, hz₀⟩ := hb -- refine ⟨u⁻¹, H.inv_mem u_mem, ?_⟩ -- rw [← a_eq_b, ← hz₀] -- refine (Matrix.inv_eq_left_inv ?_).symm -- rw [← LinearMap.toMatrix_mul] -- convert LinearMap.toMatrix_one (R := ℂ) V_basis.toBasis using 2 -- ext v -- change (↑(u⁻¹) : V →L[ℂ] V) ((↑u : V →L[ℂ] V) v) = v -- rw [← mul_apply_eq_comp, ← Units.val_mul, inv_mul_cancel, Units.val_one, -- one_apply_eq_self] -- · rw [Matrix.mem_unitaryGroup_iff] at ha -- apply Matrix.inv_eq_right_inv at ha -- rw [Subtype.ext_iff] -- show a⁻¹ = star a -- exact ha -- } -- -- let remove_fresh (h : FreshInnerProduct V →ₗ[ℂ] FreshInnerProduct V): (V →ₗ[ℂ] V) := h -- -- · use H_matrix_subgroup -- apply Nonempty.intro -- exact { -- toFun := fun h => ⟨{ -- val := ((remove_fresh (h.val.val.toLin V_basis.toBasis V_basis.toBasis)).toContinuousLinearMap), -- inv := ((remove_fresh (h.val.val⁻¹.toLin V_basis.toBasis V_basis.toBasis)).toContinuousLinearMap), -- val_inv := by -- simp [remove_fresh] -- ext a -- simp -- conv => -- lhs -- equals Matrix.toLin V_basis.toBasis V_basis.toBasis (h.val.val * h.val.val⁻¹) a => -- rw [eq_comm] -- exact Matrix.toLin_mul_apply (v₁ := V_basis.toBasis) (v₂ := V_basis.toBasis) (v₃ := V_basis.toBasis) _ _ _ -- rw [Matrix.mul_nonsing_inv] -- · exact LinearMap.congr_fun (Matrix.toLin_one (v₁ := V_basis.toBasis)) a -- · apply Matrix.UnitaryGroup.det_isUnit -- inv_val := by -- simp [remove_fresh] -- ext a -- simp -- conv => -- lhs -- equals Matrix.toLin V_basis.toBasis V_basis.toBasis (h.val.val⁻¹ * h.val.val) a => -- rw [eq_comm] -- exact Matrix.toLin_mul_apply (v₁ := V_basis.toBasis) (v₂ := V_basis.toBasis) (v₃ := V_basis.toBasis) _ _ _ -- rw [Matrix.nonsing_inv_mul] -- · exact LinearMap.congr_fun (Matrix.toLin_one (v₁ := V_basis.toBasis)) a -- · apply Matrix.UnitaryGroup.det_isUnit -- }, by ( -- simp [remove_fresh] -- have h_prop := h.property -- simp only [H_matrix_subgroup] at h_prop -- rw [← Subgroup.mem_carrier] at h_prop -- simp only [] at h_prop -- rw [Set.mem_range] at h_prop -- obtain ⟨a, ha⟩ := h_prop -- have a_prop := a.property -- simp only [H_matrix, new_H_coe, new_H_matrix] at a_prop -- rw [Set.mem_image] at a_prop -- obtain ⟨b, b_mem, b_eq_a⟩ := a_prop -- obtain ⟨c, ⟨d, d_mem, d_eq_c⟩, c_eq_b⟩ := b_mem -- simp_rw [← ha, ← b_eq_a] -- simp -- simp_rw [← c_eq_b, ← d_eq_c] -- conv => -- arg 2 -- arg 1 -- equals d.val => -- rfl -- -- simp -- rw [Subgroup.mem_carrier] at d_mem -- exact d_mem -- )⟩ -- invFun := fun h => ⟨⟨(LinearMap.toMatrix V_basis.toBasis V_basis.toBasis) h.val.val.toLinearMap, by ( -- apply H_mem_unitary -- exact ⟨h.val.val.toLinearMap, ⟨h.val.val, ⟨h.val, h.property, rfl⟩, rfl⟩, rfl⟩ -- )⟩, by ( -- refine ⟨⟨_, ⟨h.val.val.toLinearMap, ⟨h.val.val, ⟨h.val, h.property, rfl⟩, rfl⟩, rfl⟩⟩, rfl⟩ -- )⟩, -- left_inv := by -- intro h -- simp -- rw [Subtype.ext_iff] -- simp [remove_fresh] -- right_inv := by -- intro h -- simp -- simp [remove_fresh] -- ext a -- simp -- map_mul' := by -- intro x y -- simp [remove_fresh] -- ext a -- simp -- exact Matrix.toLin_mul_apply (v₁ := V_basis.toBasis) (v₂ := V_basis.toBasis) -- (v₃ := V_basis.toBasis) _ _ _ -- } -- · rfl -+ let ρ : H →* Module.End ℂ (FreshInnerProduct V) := { -+ toFun := fun h => h.val.val.toLinearMap -+ map_one' := rfl -+ map_mul' := fun _ _ => rfl } -+ have hρ : Function.Injective ρ := by -+ intro g h heq -+ apply Subtype.ext -+ apply Units.ext -+ ext v -+ exact DFunLike.congr_fun heq v -+ exact @unitary_of_faithful_inner_representation H (FreshInnerProduct V) -+ inferInstance normed_add new_inner finite_dimensional_fresh ρ hρ v_preserves_inner - - --#print axioms new_weyl_unitarian_trick - - -- A product of k unitary groups U(n_1) × U(n_2) × ... × U(n_k), where n_i < n for each n_i - - --#check Pi.commSemigroup -diff --git a/Gromov/Unitary/Words.lean b/Gromov/Unitary/Words.lean -index a8e8c75..5d00a13 100644 ---- a/Gromov/Unitary/Words.lean -+++ b/Gromov/Unitary/Words.lean -@@ -14,8 +14,6 @@ public section - - open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace - --set_option linter.style.longLine false --set_option linter.style.commandStart false - - open Subgroup Pointwise Finset - open scoped Pointwise Finset -@@ -26,8 +24,6 @@ namespace HnEpsData - - variable [h_n_eps_data: HnEpsData] - --set_option synthInstance.maxHeartbeats 80000 in --set_option maxHeartbeats 900000 in - lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < 1 / 40) - (data : HnData) - (pows_i : Fin m → ℕ) -@@ -43,7 +39,6 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < - - nth_rw 2 [← List.prod_take_mul_prod_drop (i := k)] at this - rw [← List.prod_take_mul_prod_drop (i := k)] at this -- -- TODO - generalize this and PR to mathlib - conv at this => - lhs - lhs -@@ -55,11 +50,11 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < - rw [List.getElem?_take] - simp - by_cases i_lt_k: i < k -- . -+ · - simp [i_lt_k] - have i_lt_m: i < m := by omega - simp [i_lt_m] -- . simp [i_lt_k] -+ · simp [i_lt_k] - - conv at this => - rhs -@@ -72,11 +67,11 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < - rw [List.getElem?_take] - simp - by_cases i_lt_k: i < k -- . -+ · - simp [i_lt_k] - have i_lt_m: i < m := by omega - simp [i_lt_m] -- . simp [i_lt_k] -+ · simp [i_lt_k] - - - conv at this => -@@ -156,7 +151,6 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < - rw [SubmonoidClass.coe_pow] - grw [H_n_single_pow_lower_bound] - -- -- TODO : figure out why we can't use 'simp_rw' here - conv => - lhs - rhs -@@ -191,17 +185,17 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < - group - - grw [H_n_prod_le_k (c := c)] -- . linarith -- . -+ · linarith -+ · - rw [add_assoc] - rw [m_minus_k] - simp -- . exact c_pos -- . exact c_lt -- . exact pows_i_le -- . -+ · exact c_pos -+ · exact c_lt -+ · exact pows_i_le -+ · - linarith -- . -+ · - conv => - lhs - equals (-((pows_j k) : ℝ) + ((pows_i k) : ℝ)) => -@@ -221,34 +215,34 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < - simp - grw [c_lt] - apply mul_le_mul -- . norm_num -- . -+ · norm_num -+ · - rw [inv_le_inv₀] -- . -+ · - have my_prop := (theorem_3_8_h_n data k).g_dist - exact my_prop -- . apply H_n_eps_pos -- . have my_prop := (theorem_3_8_h_n data k).g_dist_nonzero -+ · apply H_n_eps_pos -+ · have my_prop := (theorem_3_8_h_n data k).g_dist_nonzero - positivity -- . simp -+ · simp - exact (H_n_eps_pos data.hd).le -- . norm_num -- . simp -+ · norm_num -+ · simp - have foo := H_n_eps_pos data.hd - linarith -- . simp [-SubmonoidClass.coe_list_prod] -+ · simp [-SubmonoidClass.coe_list_prod] - - - rw [ge_iff_le] at lhs_ge - - have one_tenth_lt: 1 / 10 * ‖(theorem_3_8_h_n data ↑k).g.val.val - 1‖ < (9 / 10) * ‖(theorem_3_8_h_n data ↑k).g.val.val - 1‖ := by - apply mul_lt_mul -- . norm_num -- . simp -- . -+ · norm_num -+ · simp -+ · - have ne_zero := (theorem_3_8_h_n data ↑k).g_dist_nonzero - positivity -- . norm_num -+ · norm_num - - - have add_swap (a b : ℕ): 1 + a + b = 1 + b + a := by -@@ -281,7 +275,6 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < - simp at one_tenth_lt - - --#print axioms words_distinct - - -- ContinuousLinearMap.norm_id - -@@ -327,13 +320,13 @@ lemma H_n_pows_mem_ball_G {m : ℕ} - simp [nested_list, replicate_pow] - simp [Fin.sum_ofFn] - grw [Finset.sum_le_card_nsmul (n := ⌊ (c * (H_n_eps data.hd)⁻¹)⌋₊)] -- . simp -- . intro x _ -+ · simp -+ · intro x _ - apply pows_le - - - use (fun i => full_list (i.cast (by omega))) -- . -+ · - - - conv => -@@ -360,11 +353,10 @@ lemma H_n_pows_mem_ball_G {m : ℕ} - - dsimp [nested_list, replicate_pow] - rw [List.prod_append] -- . simp [-List.prod_flatten] -- . omega -+ · simp [-List.prod_flatten] -+ · omega - - --#print axioms H_n_pows_mem_ball_G - - -- Unfold the commutators from theorem_3_8_h_n as a list of elements - @[expose] -@@ -380,8 +372,6 @@ noncomputable def theorem_3_8_h_n_list (data: HnData) (m: ℕ): List (data.S) := - ++ (List.map (fun s => ⟨s.val⁻¹, by apply data.S_inv; simp⟩) (theorem_3_8_h_n_list data a)).reverse - - --set_option synthInstance.maxHeartbeats 80000 in --set_option maxHeartbeats 900000 in - lemma theorem_3_8_h_n_list_prod_eq (data: HnData) (m: ℕ): (theorem_3_8_h_n_list data m).unattach.prod = (theorem_3_8_h_n data m).g := by - induction m with - | zero => -@@ -409,7 +399,6 @@ lemma theorem_3_8_h_n_list_prod_eq (data: HnData) (m: ℕ): (theorem_3_8_h_n_lis - group - - -- Note - this is (2^(m - 1)) in Vikman, since the list in indexed starting at 1 in the paper --set_option synthInstance.maxHeartbeats 1000000 in - lemma theorem_3_8_h_n_list_length_initial_upper_bound (data: HnData) (m: ℕ): (theorem_3_8_h_n_list data (m)).length ≤ (3 * (2 ^ (m))) - 2 := by - induction m with - | zero => -@@ -417,26 +406,25 @@ lemma theorem_3_8_h_n_list_length_initial_upper_bound (data: HnData) (m: ℕ): - simp - | succ a ih => - unfold theorem_3_8_h_n_list -- -- TODO - can grind somehow solve all of this? - simp - grw [ih] -- ring -+ ring_nf - rw [Nat.sub_mul] -- ring -+ ring_nf - zify - rw [Nat.cast_sub] -- . -+ · - push_cast -- ring -+ ring_nf - rw [Nat.cast_sub] -- . push_cast -- ring -+ · push_cast -+ ring_nf - linarith -- . -+ · - by_cases a_eq_zero: a = 0 -- . -+ · - simp [a_eq_zero] -- . -+ · - have a_eq_sub_succ: a = (a - 1) + 1 := by omega - rw [a_eq_sub_succ] - rw [Nat.pow_succ] -@@ -445,18 +433,17 @@ lemma theorem_3_8_h_n_list_length_initial_upper_bound (data: HnData) (m: ℕ): - rw [mul_assoc] - apply Nat.le_mul_of_pos_right - positivity -- . -+ · - rw [← ge_iff_le] - grw [(Nat.one_le_pow _ _ ?_).ge] -- . norm_num -- . norm_num -+ · norm_num -+ · norm_num - - - -- The c' constant from Vikman - @[expose] - def c' := 3 - ---- TODO - figure out how to merge this with 'theorem_3_8_h_n_list_length_initial_upper_bound' - lemma theorem_3_8_h_n_list_length_upper_bound (data: HnData) (m: ℕ): (theorem_3_8_h_n_list data (m)).length ≤ c' * (2 ^ m) := by - grw [theorem_3_8_h_n_list_length_initial_upper_bound data m] - simp [c'] -@@ -468,10 +455,10 @@ lemma list_concat_unattach {T: Type*} {p: T → Prop} (l: List { x: T // p x}) ( - - - lemma H_n_pows_mem_ball_S {m : ℕ} -- (m_gt: 0 < m) (data : HnData) (pows : Fin m → ℕ) -+ (_m_gt: 0 < m) (data : HnData) (pows : Fin m → ℕ) - (c: ℝ) -- (c_pos: 0 < c) -- (c_lt: c < 1 / 40) -+ (_c_pos: 0 < c) -+ (_c_lt: c < 1 / 40) - (pows_le : ∀ i : Fin m, (pows i) ≤ ⌊c * (H_n_eps data.hd)⁻¹⌋₊): - (List.ofFn (fun (i : Fin (m)) => (theorem_3_8_h_n data i).g^(pows i))).prod.val ∈ Subtype.val '' (data.S ^ ( c' * (Nat.floor (c * (H_n_eps data.hd)⁻¹)) * m * (2 ^ m))) := by - -@@ -486,7 +473,7 @@ lemma H_n_pows_mem_ball_S {m : ℕ} - - have g_as_list_prod_eq_pow: g_as_s_list.unattach.prod = (List.ofFn (fun (i: Fin m) => (List.replicate (pows i) (theorem_3_8_h_n_list data i)).flatten.unattach.prod)).unattach.prod := by - dsimp [g_as_s_list] -- clear m_gt -+ clear _m_gt - induction m with - | zero => - simp -@@ -544,27 +531,26 @@ lemma H_n_pows_mem_ball_S {m : ℕ} - rw [List.sum_ofFn] - simp - grw [Finset.sum_le_sum (g := fun i => (pows i) * c' * (2 ^ m))] -- . -+ · - grw [Finset.sum_le_card_nsmul (n := ⌊c * (H_n_eps data.hd)⁻¹⌋₊ * c' * (2^m))] -- . -+ · - simp -- ring -+ ring_nf - rfl -- . -+ · - intro i _ - grw [pows_le] -- . intro i _ -+ · intro i _ - grw [theorem_3_8_h_n_list_length_upper_bound] -- ring -+ ring_nf - grw [i.isLt] -- simp - - - let padded_list := Fin.append (fun (i: Fin (g_as_s_list.length)) => g_as_s_list[i]) (fun (i: Fin (((c' * (Nat.floor (c * (H_n_eps data.hd)⁻¹)) * m * (2 ^ m)) - g_as_s_list.length))) => ⟨1, data.S_one⟩) - - - refine ⟨?_, rfl⟩ -- . -+ · - use (fun i => padded_list (i.cast (by omega))) - conv => - lhs -@@ -573,8 +559,8 @@ lemma H_n_pows_mem_ball_S {m : ℕ} - apply congr (rfl) - ext i g - nth_rw 2 [List.ofFn_congr (n := (c' * ⌊c * (H_n_eps data.hd)⁻¹⌋₊ * m * 2 ^ m))] -- . simp -- . omega -+ · simp -+ · omega - - - rw [List.ofFn_fin_append] -@@ -589,7 +575,6 @@ lemma H_n_pows_mem_ball_S {m : ℕ} - simp - rw [g_list_prod] - --#print axioms H_n_pows_mem_ball_S - - - -- In Vikman, this is (1 + ⌊c * (H_n_eps data.hd)⁻¹⌋₊) (since the powers include the upper bound of c*ε ⁻¹) -@@ -613,20 +598,19 @@ lemma H_n_ball_S_card {m : ℕ} - - rw [← my_card] - apply Finset.card_le_card_of_injOn (f := fun pows => (List.ofFn (fun (i : Fin (m)) => (theorem_3_8_h_n data (i)).g^((pows i).val))).prod) -- . -+ · - intro pows _ - simp -- -- TODO - modify H_n_pows_mem_ball_S so that this can just be 'apply' - have my_pows := H_n_pows_mem_ball_S m_gt data (fun i => (pows i).val) c c_pos c_lt ?_ -- . -+ · - rw [Set.mem_image] at my_pows - obtain ⟨g, g_mem, g_eq⟩ := my_pows - rw [← Subtype.ext_iff] at g_eq - rw [← g_eq] - exact g_mem -- . intro i -+ · intro i - simp -- . -+ · - intro pows_i _ pows_j _ - contrapose - intro pows_neq -@@ -635,10 +619,9 @@ lemma H_n_ball_S_card {m : ℕ} - - have exists_minimal_k := exists_minimal_of_wellFoundedLT (fun (i: Fin m) => pows_i i ≠ pows_j i) pows_neq - obtain ⟨k, k_minimal⟩ := exists_minimal_k -- -- TODO - figure out why this pushes a goal of 'False' if we don't use 'generalizing' - wlog pow_j_lt_i: (pows_j k).val < (pows_i k).val generalizing pows_i pows_j - -- . -+ · - conv at k_minimal => - arg 1 - intro i -@@ -646,42 +629,41 @@ lemma H_n_ball_S_card {m : ℕ} - - - have words_neq := this (pows_j := pows_i) (pows_i := pows_j) (by simp) (by simp) ?_ k_minimal ?_ -- . -+ · - rw [eq_comm] - exact words_neq -- . -+ · - obtain ⟨x, hx⟩ := pows_neq - use x - exact fun a ↦ hx (id (Eq.symm a)) -- . -+ · - have k_neq := k_minimal.prop - omega -- . -+ · - simp at k_minimal - - have eps_pos := H_n_eps_pos data.hd - - have prods_neq := words_distinct (m := m) k c c_pos c_lt data (fun i => pows_i i) (fun i => pows_j i) ?_ ?_ ?_ ?_ -- . simpa using prods_neq -- . -+ · simpa using prods_neq -+ · - intro i - rw [← Nat.le_floor_iff] - omega - positivity -- . intro i -+ · intro i - rw [← Nat.le_floor_iff] - omega - positivity -- . -+ · - intro j hk - have foo := Minimal.not_prop_of_lt k_minimal hk - simp at foo - exact congrArg Fin.val foo -- . -+ · - simpa using pow_j_lt_i - - --#print axioms H_n_ball_S_card - - abbrev swap_le {a b: ℝ} (_: a ≤ b): Prop := b < a - -diff --git a/Gromov/UnitaryGromov.lean b/Gromov/UnitaryGromov.lean -index 2becf72..68e5e46 100644 ---- a/Gromov/UnitaryGromov.lean -+++ b/Gromov/UnitaryGromov.lean -@@ -16,15 +16,238 @@ public section - open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace - - set_option linter.style.longLine false --set_option linter.style.commandStart false - - open Subgroup Pointwise Finset - open scoped Pointwise Finset - open scoped commutatorElement IsMulCommutative - - --set_option synthInstance.maxHeartbeats 100000 in --set_option maxHeartbeats 2000000 in -+private noncomputable def image_growth_data -+ {X Y : Type*} [Group X] [DecidableEq X] [Group Y] [DecidableEq Y] -+ {P : Subgroup X} (D : SPolyData P) (f : P →* Y) : SPolyData f.range where -+ S := f.rangeRestrict '' D.S -+ S_one := ⟨1, D.S_one, map_one _⟩ -+ S_inv := by rw [← Set.image_inv, ← D.S_inv] -+ S_finite := D.S_finite.image _ -+ S_generates := by -+ rw [← MonoidHom.map_closure, D.S_generates] -+ exact Subgroup.map_top_of_surjective _ f.rangeRestrict_surjective -+ S_poly_const := D.S_poly_const -+ S_poly_const_pos := D.S_poly_const_pos -+ S_poly_deg := D.S_poly_deg -+ S_poly := by -+ intro r hr -+ rw [Set.Finite.toFinset_image, ← Finset.image_pow] -+ · exact Finset.card_image_le.trans (D.S_poly r hr) -+ · exact D.S_finite -+ -+@[expose] -+def map_S_data {G H: Type*} [Group G] [Group H] [DecidableEq G] [DecidableEq H] (A: Subgroup G) {f: G →* H} (S_data: SPolyData A): SPolyData (Subgroup.map f A) := { -+ S := f.subgroupMap A '' S_data.S -+ S_finite := by -+ apply Set.Finite.image -+ apply S_data.S_finite -+ S_one := by -+ simp only [Set.mem_image] -+ use 1 -+ simp -+ apply S_data.S_one -+ S_inv := by -+ rw [← Set.image_inv] -+ rw [← S_data.S_inv] -+ S_generates := by -+ rw [← MonoidHom.map_closure] -+ rw [S_data.S_generates] -+ rw [Subgroup.map_top_of_surjective] -+ apply MonoidHom.subgroupMap_surjective -+ S_poly_const := S_data.S_poly_const -+ S_poly_const_pos := S_data.S_poly_const_pos -+ S_poly_deg := S_data.S_poly_deg -+ S_poly := by -+ intro r hr -+ rw [Set.Finite.toFinset_image] -+ rw [← Finset.image_pow] -+ grw [Finset.card_image_le] -+ . -+ apply S_data.S_poly r hr -+ . exact S_data.S_finite -+} -+ -+ -+private noncomputable def subgroup_growth_data -+ {X : Type*} [Group X] [DecidableEq X] {P : Subgroup X} -+ (D : SPolyData P) (H : Subgroup P) (S : Finset H) -+ (hS : Subgroup.closure (S : Set H) = ⊤) : SPolyData H := by -+ let T := S ∪ S⁻¹ ∪ {1} -+ have hsym : D.S_finite.toFinset = D.S_finite.toFinset⁻¹ := by -+ ext x -+ simp -+ nth_rw 1 [D.S_inv] -+ simp -+ let growth := poly_growth_equiv D.S_poly_const D.S_poly_deg -+ (Nat.pos_of_ne_zero D.S_poly_const_pos.symm) D.S_finite.toFinset -+ (T.image H.subtype) hsym (by simpa using D.S_one) -+ (by simpa using D.S_generates) D.S_poly -+ let b := growth.choose -+ have hb := growth.choose_spec.1 -+ have hg := growth.choose_spec.2 -+ refine { -+ S := (T : Set H) -+ S_finite := T.finite_toSet -+ S_one := by simp [T] -+ S_inv := by simp [T, Set.union_comm] -+ S_generates := by simp [T, Subgroup.closure_union, hS] -+ S_poly_const := b -+ S_poly_const_pos := by omega -+ S_poly_deg := D.S_poly_deg -+ S_poly := ?_ } -+ intro r hr -+ simpa only [b, Finset.finite_toSet_toFinset, ← Finset.image_pow, -+ Finset.card_image_of_injective _ H.subtype_injective] using hg r hr -+ -+private lemma central_element_virtually_abelian (n : ℕ) (hn : n ≠ 0) -+ (n_eq_one : n ≠ 1) -+ (ih : ∀ m, m < n → m ≠ 0 → ∀ H : Subgroup (Matrix.unitaryGroup (Fin m) ℂ), -+ H.FG → SPolyData H → ∃ N : Subgroup H, IsMulCommutative N ∧ N.FiniteIndex) -+ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) (G_FG : G.FG) -+ (S_data : SPolyData G) -+ (nontrivial_central : ∃ g : G, (∀ z : ℂ, g.val.val ≠ z • 1) ∧ g ∈ Set.center G) : -+ ∃ N : Subgroup G, IsMulCommutative N ∧ N.FiniteIndex := by -+ obtain ⟨g, g_not_multiple_I, g_central⟩ := nontrivial_central -+ -+ -+ have all_mem_central : ∀ a : G, a ∈ Subgroup.centralizer {g} := by -+ intro a b b_mem -+ simp at b_mem -+ rw [b_mem] -+ rw [Set.mem_center_iff] at g_central -+ have g_comm := g_central.comm a -+ exact g_comm -+ -+ have n_ge_two : 2 ≤ n := by -+ omega -+ -+ have n_ne_zero: NeZero n := by -+ exact { out := hn } -+ obtain ⟨data⟩ := centralizer_iso G g g_not_multiple_I -+ -+ -+ -- The abelian subgroup of G_i. -+ -- TODO - we need to construct a generating set for the smaller subgroup -+ -- TODO - is there existing API for this in mathlib? -+ let g_to_central: G →* (Subgroup.centralizer {g.val}) := { -+ toFun := fun a => ⟨a, by -+ rw [Subgroup.mem_centralizer_iff] -+ simp -+ rw [Set.mem_center_iff] at g_central -+ rw [isMulCentral_iff] at g_central -+ have foo := (g_central.1) a -+ rw [commute_iff_eq] at foo -+ rw [Subtype.ext_iff] at foo -+ simpa using foo -+ ⟩, -+ map_one' := by -+ simp -+ map_mul' := by -+ simp -+ } -+ -+ have ha := data.ha -+ -+ let new_A_map := (Subgroup.subtype _).comp ((MonoidHom.fst _ _).comp (data.iso.toMonoidHom.comp g_to_central)) -+ let new_B_map := (Subgroup.subtype _).comp ((MonoidHom.snd _ _).comp (data.iso.toMonoidHom.comp g_to_central)) -+ -+ let first_new_data := image_growth_data S_data new_A_map -+ -+ have data_b_pos: 0 < data.b := by -+ have hab := data.hb -+ omega -+ -+ -- TODO - deduplicate 'first_new_data' and 'second_new_data' -+ let second_new_data := image_growth_data S_data new_B_map -+ -+ obtain ⟨first_subgroup, first_subgroup_abelian, first_subgroup_finite_index⟩ := ih data.a (by have hab := data.hab; omega) (by grind) (new_A_map.range) (by -+ rw [← Group.fg_iff_subgroup_fg] -+ rw [← Group.fg_iff_subgroup_fg] at G_FG -+ apply Group.fg_range -+ ) (first_new_data) -+ obtain ⟨second_subgroup, second_subgroup_abelian, second_subgroup_finite_index⟩ := ih data.b (by have hab := data.hab; omega) (by grind) (new_B_map.range) (by -+ rw [← Group.fg_iff_subgroup_fg] -+ rw [← Group.fg_iff_subgroup_fg] at G_FG -+ apply Group.fg_range -+ ) (second_new_data) -+ -+ let iso := Subgroup.map data.iso.symm.toMonoidHom -+ -+ let G_1 := (Subgroup.comap new_A_map.rangeRestrict first_subgroup) -+ let G_2 := (Subgroup.comap new_B_map.rangeRestrict second_subgroup) -+ -+ have g_1_finite_index: G_1.FiniteIndex := by -+ unfold G_1 -+ rw [Subgroup.finiteIndex_iff] -+ rw [Subgroup.index_comap_of_surjective] -+ . -+ rw [← Subgroup.finiteIndex_iff] -+ apply first_subgroup_finite_index -+ . exact MonoidHom.rangeRestrict_surjective new_A_map -+ -+ have g_2_finite_index: G_2.FiniteIndex := by -+ unfold G_2 -+ rw [Subgroup.finiteIndex_iff] -+ rw [Subgroup.index_comap_of_surjective] -+ . -+ rw [← Subgroup.finiteIndex_iff] -+ apply second_subgroup_finite_index -+ . exact MonoidHom.rangeRestrict_surjective new_B_map -+ -+ -+ let G' := G_1 ⊓ G_2 -+ -+ have G'_finite_index : G'.FiniteIndex := by -+ unfold G' -+ infer_instance -+ -+ -+ have G'_abeliean : IsMulCommutative G' := by -+ unfold G' -+ refine { is_comm := ?_ } -+ refine { comm := ?_ } -+ intro a b -+ have a_mem := a.property -+ have b_mem := b.property -+ rw [Subgroup.mem_inf] at a_mem b_mem -+ have a_first := a_mem.1 -+ have b_first := b_mem.1 -+ have a_second := a_mem.2 -+ have b_second := b_mem.2 -+ unfold G_1 at a_first b_first -+ unfold G_2 at a_second b_second -+ -+ rw [Subgroup.mem_comap] at a_first b_first -+ -+ have first_comm := first_subgroup_abelian.is_comm.comm ⟨_, a_first⟩ ⟨_, b_first⟩ -+ have second_comm := second_subgroup_abelian.is_comm.comm ⟨_, a_second⟩ ⟨_, b_second⟩ -+ -+ apply Subtype.ext -+ have hcentral : Function.Injective g_to_central := by -+ intro (x : G) (y : G) h -+ exact Subtype.ext (congrArg (fun z : ↥(centralizer {g.val}) => z.val) h) -+ apply hcentral -+ apply data.iso.injective -+ apply Prod.ext -+ · apply Subtype.ext -+ change new_A_map (a.val * b.val) = new_A_map (b.val * a.val) -+ have h := congrArg (fun x : ↥first_subgroup => x.val.val) first_comm -+ change new_A_map a.val * new_A_map b.val = new_A_map b.val * new_A_map a.val at h -+ simpa only [map_mul] using h -+ · apply Subtype.ext -+ change new_B_map (a.val * b.val) = new_B_map (b.val * a.val) -+ have h := congrArg (fun x : ↥second_subgroup => x.val.val) second_comm -+ change new_B_map a.val * new_B_map b.val = new_B_map b.val * new_B_map a.val at h -+ simpa only [map_mul] using h -+ -+ use G' -+ - lemma compact_lie_virtually_abelian (n : ℕ) (hn : n ≠ 0) (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) (G_FG : G.FG) - (S_data: SPolyData G): ∃ N : Subgroup G, IsMulCommutative N ∧ N.FiniteIndex := by - -@@ -70,203 +293,8 @@ lemma compact_lie_virtually_abelian (n : ℕ) (hn : n ≠ 0) (G : Subgroup (Matr - } - } - · exact Subgroup.instFiniteIndexTop -- · have nontrivial_centrer_implies_virtual (G : Subgroup ↥(Matrix.unitaryGroup (Fin n) ℂ)) (G_FG : G.FG) (S_data: SPolyData G) (nontrivial_central : ∃ g : G, (∀ z : ℂ, g.val.val ≠ z • 1) ∧ g ∈ Set.center G): ∃ N : Subgroup G, IsMulCommutative ↥N ∧ N.FiniteIndex := by -- obtain ⟨g, g_not_multiple_I, g_central⟩ := nontrivial_central -- -- -- have all_mem_central : ∀ a : G, a ∈ Subgroup.centralizer {g} := by -- intro a b b_mem -- simp at b_mem -- rw [b_mem] -- rw [Set.mem_center_iff] at g_central -- have g_comm := g_central.comm a -- exact g_comm -- -- have n_ge_two : 2 ≤ n := by -- omega -- -- have n_ne_zero: NeZero n := by -- exact { out := hn } -- obtain ⟨data⟩ := centralizer_iso G g g_not_multiple_I -- -- -- -- The abelian subgroup of G_i. -- -- TODO - we need to construct a generating set for the smaller subgroup -- -- TODO - is there existing API for this in mathlib? -- let g_to_central: G →* (Subgroup.centralizer {g.val}) := { -- toFun := fun a => ⟨a, by -- rw [Subgroup.mem_centralizer_iff] -- simp -- rw [Set.mem_center_iff] at g_central -- rw [isMulCentral_iff] at g_central -- have foo := (g_central.1) a -- rw [commute_iff_eq] at foo -- rw [Subtype.ext_iff] at foo -- simpa using foo -- ⟩, -- map_one' := by -- simp -- map_mul' := by -- simp -- } -- -- have ha := data.ha -- -- let new_A_map := (Subgroup.subtype _).comp ((MonoidHom.fst _ _).comp (data.iso.toMonoidHom.comp g_to_central)) -- let new_B_map := (Subgroup.subtype _).comp ((MonoidHom.snd _ _).comp (data.iso.toMonoidHom.comp g_to_central)) -- -- let first_new_data: SPolyData (new_A_map.range) := { -- S := new_A_map.rangeRestrict '' S_data.S, -- S_one := by -- simp only [Set.mem_image] -- use 1 -- refine ⟨?_, ?_⟩ -- . apply S_data.S_one -- . exact map_one _ -- S_inv := by -- rw [← Set.image_inv] -- rw [← S_data.S_inv] -- S_finite := by -- apply Set.Finite.image -- apply S_data.S_finite -- S_generates := by -- rw [← MonoidHom.map_closure] -- rw [S_data.S_generates] -- rw [Subgroup.map_top_of_surjective] -- exact MonoidHom.rangeRestrict_surjective new_A_map -- S_poly_const := S_data.S_poly_const -- S_poly_const_pos := S_data.S_poly_const_pos -- S_poly_deg := S_data.S_poly_deg -- S_poly := by -- intro r hr -- rw [Set.Finite.toFinset_image] -- rw [← Finset.image_pow] -- grw [Finset.card_image_le] -- . -- apply S_data.S_poly r hr -- . exact S_data.S_finite -- } -- -- have data_b_pos: 0 < data.b := by -- have hab := data.hb -- omega -- -- -- TODO - deduplicate 'first_new_data' and 'second_new_data' -- let second_new_data: SPolyData (new_B_map.range) := { -- S := new_B_map.rangeRestrict '' S_data.S, -- S_one := by -- simp only [Set.mem_image] -- use 1 -- refine ⟨?_, ?_⟩ -- . apply S_data.S_one -- . exact map_one _ -- S_inv := by -- rw [← Set.image_inv] -- rw [← S_data.S_inv] -- S_finite := by -- apply Set.Finite.image -- apply S_data.S_finite -- S_generates := by -- rw [← MonoidHom.map_closure] -- rw [S_data.S_generates] -- rw [Subgroup.map_top_of_surjective] -- exact MonoidHom.rangeRestrict_surjective new_B_map -- S_poly_const := S_data.S_poly_const -- S_poly_const_pos := S_data.S_poly_const_pos -- S_poly_deg := S_data.S_poly_deg -- S_poly := by -- intro r hr -- rw [Set.Finite.toFinset_image] -- rw [← Finset.image_pow] -- grw [Finset.card_image_le] -- . -- apply S_data.S_poly r hr -- . exact S_data.S_finite -- } -- -- obtain ⟨first_subgroup, first_subgroup_abelian, first_subgroup_finite_index⟩ := compact_lie_virtually_abelian (data.a) (by grind) (new_A_map.range) (by -- rw [← Group.fg_iff_subgroup_fg] -- rw [← Group.fg_iff_subgroup_fg] at G_FG -- apply Group.fg_range -- ) (first_new_data) -- obtain ⟨second_subgroup, second_subgroup_abelian, second_subgroup_finite_index⟩ := compact_lie_virtually_abelian (data.b) (by grind) (new_B_map.range) (by -- rw [← Group.fg_iff_subgroup_fg] -- rw [← Group.fg_iff_subgroup_fg] at G_FG -- apply Group.fg_range -- ) (second_new_data) -- -- let iso := Subgroup.map data.iso.symm.toMonoidHom -- -- let G_1 := (Subgroup.comap new_A_map.rangeRestrict first_subgroup) -- let G_2 := (Subgroup.comap new_B_map.rangeRestrict second_subgroup) -- -- have g_1_finite_index: G_1.FiniteIndex := by -- unfold G_1 -- rw [Subgroup.finiteIndex_iff] -- rw [Subgroup.index_comap_of_surjective] -- . -- rw [← Subgroup.finiteIndex_iff] -- apply first_subgroup_finite_index -- . exact MonoidHom.rangeRestrict_surjective new_A_map -- -- have g_2_finite_index: G_2.FiniteIndex := by -- unfold G_2 -- rw [Subgroup.finiteIndex_iff] -- rw [Subgroup.index_comap_of_surjective] -- . -- rw [← Subgroup.finiteIndex_iff] -- apply second_subgroup_finite_index -- . exact MonoidHom.rangeRestrict_surjective new_B_map -- -- -- let G' := G_1 ⊓ G_2 -- -- have G'_finite_index : G'.FiniteIndex := by -- unfold G' -- infer_instance -- -- -- have G'_abeliean : IsMulCommutative G' := by -- unfold G' -- refine { is_comm := ?_ } -- refine { comm := ?_ } -- intro a b -- have a_mem := a.property -- have b_mem := b.property -- rw [Subgroup.mem_inf] at a_mem b_mem -- have a_first := a_mem.1 -- have b_first := b_mem.1 -- have a_second := a_mem.2 -- have b_second := b_mem.2 -- unfold G_1 at a_first b_first -- unfold G_2 at a_second b_second -- -- rw [Subgroup.mem_comap] at a_first b_first -- -- have first_comm := first_subgroup_abelian.is_comm.comm ⟨_, a_first⟩ ⟨_, b_first⟩ -- have second_comm := second_subgroup_abelian.is_comm.comm ⟨_, a_second⟩ ⟨_, b_second⟩ -- -- rw [Subtype.ext_iff] -- simp -- apply_fun g_to_central -- simp -- apply_fun data.iso -- . -- simp -- apply Prod.ext -- . simp -- rw [Subtype.ext_iff] -- simp -- exact congrArg (fun x : ↥first_subgroup => x.val.val) first_comm -- . simp -- rw [Subtype.ext_iff] -- simp -- exact congrArg (fun x : ↥second_subgroup => x.val.val) second_comm -- . intro a b hab -- simp [g_to_central] at hab -- simpa using hab -- -- use G' -+ · have nontrivial_centrer_implies_virtual := central_element_virtually_abelian n hn -+ n_eq_one (fun m hm hm0 H hH D => compact_lie_virtually_abelian m hm0 H hH D) - by_cases nontrivial_central : ∃ g : G, (∀ z : ℂ, g.val.val ≠ z • 1) ∧ g ∈ Set.center G - · exact nontrivial_centrer_implies_virtual G G_FG S_data nontrivial_central - · -- Case two - we have no non-trivial central elements -@@ -290,80 +318,11 @@ lemma compact_lie_virtually_abelian (n : ℕ) (hn : n ≠ 0) (G : Subgroup (Matr - - obtain ⟨pre_S, h_pre_S⟩ := G'_fg - -- have pos := S_data.S_poly_const_pos -- have my_equiv := poly_growth_equiv S_data.S_poly_const S_data.S_poly_deg (by omega) -- S_data.S_finite.toFinset (Finset.image (Subgroup.subtype _) (pre_S ∪ pre_S⁻¹ ∪ {1})) ?_ ?_ (by simp [S_data.S_generates]) S_data.S_poly -- -- obtain ⟨b, hb, new_poly⟩ := my_equiv -- -- let S_data_G': SPolyData ((G' n ε G)) := { -- S := pre_S ∪ pre_S⁻¹ ∪ {1}, -- S_finite := by simp, -- S_generates := by -- rw [Subgroup.closure_union] -- rw [Subgroup.closure_union] -- simp [h_pre_S] -- S_one := by -- simp -- S_inv := by -- simp -- rw [Set.union_comm] -- S_poly_const := b -- S_poly_const_pos := by omega -- S_poly_deg := S_data.S_poly_deg -- S_poly := by -- intro r hr -- unfold Set.Finite.toFinset -- specialize new_poly r hr -- rw [← Finset.image_pow] at new_poly -- rw [Finset.card_image_of_injective] at new_poly -- -- TODO(mathlib) - figure out what @[norm_cast] attribute to apply to make 'norm_cast' work with the {1} set -- have one_eq: ({1}: Set (G' n ε G)) = ({1}: Finset (G' n ε G)) := by simp -- norm_cast -- simp_rw [one_eq] -- norm_cast -- . simpa using new_poly -- . exact subtype_injective (G' n ε G) -- } -- -- let map_set (Q: Finset (G' n ε G)) := Finset.image (fun a => (⟨a.val, by simp⟩ : (Subgroup.map G.subtype (G' n ε G)))) Q -- let other := G.subtype '' (((G' n ε G).subtype) '' (pre_S)) -- -+ let S_data_G' := subgroup_growth_data S_data (G' n ε G) pre_S h_pre_S - - by_cases G'_nontrivial_central : ∃ g : (G' n ε G), (∀ z : ℂ, g.val.val.val ≠ z • 1) ∧ g ∈ Set.center (G' n ε G) - · -- let foo := S_data_G'.S -- let bar := G.subtype.subgroupMap (G' n ε G) -- have subtype_S_data: SPolyData (Subgroup.map G.subtype (G' n ε G)) := { -- S := (G.subtype.subgroupMap (G' n ε G)) '' S_data_G'.S -- S_finite := by -- apply Set.Finite.image -- apply S_data_G'.S_finite -- S_one := by -- simp only [Set.mem_image] -- use 1 -- simp -- apply S_data_G'.S_one -- S_inv := by -- rw [← Set.image_inv] -- rw [← S_data_G'.S_inv] -- S_generates := by -- rw [← MonoidHom.map_closure] -- rw [S_data_G'.S_generates] -- rw [Subgroup.map_top_of_surjective] -- exact MonoidHom.subgroupMap_surjective G.subtype (G' n ε G) -- S_poly_const := S_data_G'.S_poly_const -- S_poly_const_pos := S_data_G'.S_poly_const_pos -- S_poly_deg := S_data_G'.S_poly_deg -- S_poly := by -- intro r hr -- rw [Set.Finite.toFinset_image] -- rw [← Finset.image_pow] -- grw [Finset.card_image_le] -- . -- apply S_data_G'.S_poly r hr -- . exact S_data_G'.S_finite -- } -+ let subtype_S_data := map_S_data (f := G.subtype) (G' n ε G) S_data_G' - - have G'_virtual := nontrivial_centrer_implies_virtual (Subgroup.map G.subtype (G' n ε G)) (by - have G'_finite := G_eps.1 -@@ -415,59 +374,12 @@ lemma compact_lie_virtually_abelian (n : ℕ) (hn : n ≠ 0) (G : Subgroup (Matr - have target := HnEpsData.central_trivial_virtually_abelian n (by omega) G G_FG ?_ G_eps.1 S_data_G' ?_ - · exact target - · intro g hg -- simp only [ne_eq, not_exists, not_and] at G'_nontrivial_central -- specialize G'_nontrivial_central g -- rw [← not_imp_not] at G'_nontrivial_central -- simp at G'_nontrivial_central -- exact G'_nontrivial_central hg -- . rfl -- . -- ext a -- simp -- nth_rw 1 [S_data.S_inv] -- simp -- . simp -- apply S_data.S_one --termination_by (n, G.index) --decreasing_by -- · apply Prod.Lex.left -- have hab := data.hab -- grind -- . apply Prod.Lex.left -- have hab := data.hab -- grind --#print axioms compact_lie_virtually_abelian -- --@[expose] --def map_S_data {G H: Type*} [Group G] [Group H] [DecidableEq G] [DecidableEq H] (A: Subgroup G) {f: G →* H} (S_data: SPolyData A): SPolyData (Subgroup.map f A) := { -- S := f.subgroupMap A '' S_data.S -- S_finite := by -- apply Set.Finite.image -- apply S_data.S_finite -- S_one := by -- simp only [Set.mem_image] -- use 1 -- simp -- apply S_data.S_one -- S_inv := by -- rw [← Set.image_inv] -- rw [← S_data.S_inv] -- S_generates := by -- rw [← MonoidHom.map_closure] -- rw [S_data.S_generates] -- rw [Subgroup.map_top_of_surjective] -- apply MonoidHom.subgroupMap_surjective -- S_poly_const := S_data.S_poly_const -- S_poly_const_pos := S_data.S_poly_const_pos -- S_poly_deg := S_data.S_poly_deg -- S_poly := by -- intro r hr -- rw [Set.Finite.toFinset_image] -- rw [← Finset.image_pow] -- grw [Finset.card_image_le] -- . -- apply S_data.S_poly r hr -- . exact S_data.S_finite --} -- --#print axioms HnEpsData.central_trivial_virtually_abelian -+ by_contra hc -+ apply G'_nontrivial_central -+ refine ⟨g, ?_, hg⟩ -+ intro z hz -+ exact hc ⟨z, hz⟩ -+ · simp only [S_data_G', subgroup_growth_data] -+ rfl -+termination_by n -+decreasing_by exact hm -diff --git a/Gromov/VWrapper.lean b/Gromov/VWrapper.lean -index c37f7e3..847b5f4 100644 ---- a/Gromov/VWrapper.lean -+++ b/Gromov/VWrapper.lean -@@ -12,11 +12,6 @@ used to locate a scale at which the growth of `V` is almost multiplicative. - - public section - --set_option linter.style.cdot false --set_option linter.style.whitespace false --set_option linter.style.longLine false --set_option linter.flexible false --set_option linter.style.emptyLine false - - open scoped Finset - open scoped Pointwise -@@ -99,80 +94,82 @@ lemma f_monotone_on (bas : Module.Basis ι ℝ V): MonotoneOn (f bas) (Set.Ici - intro x hx y hy hxy - unfold f - grw [Finset.pow_subset_pow_right (n := y)] -- . -+ · - rw [mul_le_mul_iff_right₀] -- . -+ · - rw [Real.rpow_le_rpow_iff] -- . -+ · - apply matrix_det_montone -- . -+ · - apply Q_R_matrix_pos_def bas x (by simp [R'] at hx; exact hx) -- . -+ · - unfold Q_R_matrix - rw [← map_sub] - rw [← LinearMap.isPosSemidef_iff_posSemidef_toMatrix] - apply Q_R_lin_sub_pos_semi_def - simpa using hxy -- . -+ · - have foo := Q_R_matrix_pos_def bas x (by simp [R'] at hx; exact hx) - grind [foo.det_pos] -- . -+ · - have foo := Q_R_matrix_pos_def bas y (by simp [R'] at hy; exact hy) - grind [foo.det_pos] -- . simp [dim] -+ · simp [dim] - exact Module.finrank_pos -- . -+ · - simp - apply Finset.Nonempty.pow - apply S_nonempty - -- . apply Real.rpow_nonneg -+ · apply Real.rpow_nonneg - have foo := Q_R_matrix_pos_def bas x (by simp [R'] at hx; exact hx) - grind [foo.det_pos] -- . apply hGS.one_mem -- . exact hxy -+ · apply hGS.one_mem -+ · exact hxy - --lemma h_montone_on (bas : Module.Basis ι ℝ V): MonotoneOn (h bas) (Set.Ici i₀) := by -+omit [Nonempty ι] in -+lemma h_montone_on [_nonempty : Nonempty ι] (bas : Module.Basis ι ℝ V): MonotoneOn (h bas) (Set.Ici i₀) := by - unfold h - rw [← Function.comp_def] - apply MonotoneOn.comp -- . apply Real.strictMonoOn_log.monotoneOn -- . -+ · apply Real.strictMonoOn_log.monotoneOn -+ · - rw [← Function.comp_def] - apply MonotoneOn.comp -- . apply f_monotone_on bas -- . -+ · apply f_monotone_on bas -+ · - conv => - arg 1 - equals fun n => 16 ^ n => - simp - apply (pow_right_monotone (by simp)).monotoneOn -- . intro a ha -+ · intro a ha - simp [i₀] at ha - simp - rw [Nat.clog_le_iff_le_pow] at ha -- . -+ · - rify at ha - grw [Nat.le_ceil (a := R')] - exact ha -- . simp -- . -+ · simp -+ · - intro a ha - simp - simp at ha - simp [f] - apply mul_pos -- . simp -+ · simp - apply Finset.Nonempty.pow - apply S_nonempty -- . -+ · - apply Real.rpow_pos_of_pos - apply (Q_R_matrix_pos_def_i₀ bas _ ?_).det_pos - rw [pow_le_pow_iff_right₀] -- . exact ha -- . simp -+ · exact ha -+ · simp - --lemma growth_implies_lim_h (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growth_bound b d): Filter.Tendsto (fun (i: ℕ) => (h b i - d * i * Real.log 16)) Filter.atTop Filter.atBot := by -+omit [Nonempty ι] in -+lemma growth_implies_lim_h [_nonempty : Nonempty ι] (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growth_bound b d): Filter.Tendsto (fun (i: ℕ) => (h b i - d * i * Real.log 16)) Filter.atTop Filter.atBot := by - unfold growth_bound my_expr at h_growth - have pow_tendsto: Filter.Tendsto (fun n => 16 ^ n) Filter.atTop Filter.atTop := by - apply StrictMono.tendsto_atTop -@@ -191,9 +188,9 @@ lemma growth_implies_lim_h (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growt - rw [Real.log_div (by - rw [mul_ne_zero_iff] - refine ⟨?_, ?_⟩ -- . simp -+ · simp - grind [S_nonempty] -- . -+ · - have det_pos := (Q_R_matrix_pos_def_i₀ b (16 ^ (x + i₀)) (by - rw [add_comm] - rw [pow_add] -@@ -204,9 +201,9 @@ lemma growth_implies_lim_h (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growt - )).det_pos - - rw [Real.rpow_ne_zero] -- . grind -- . grind -- . -+ · grind -+ · grind -+ · - norm_cast - rw [inv_eq_zero] - norm_cast -@@ -220,7 +217,6 @@ lemma growth_implies_lim_h (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growt - simp - exact comp_log - --#print axioms growth_implies_lim_h - - @[expose] - noncomputable def a (d: ℕ) := 4 * d * Real.log 16 -@@ -234,11 +230,11 @@ lemma exists_j_0_for_h (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 - have h_gt (N: ℕ): h b (i₀ + (3 * w * N)) ≥ 4 * d * w * N * (Real.log 16) + h b i₀ := by - rw [h_sum] - grw [← Finset.card_nsmul_le_sum (n := w * (a d))] -- . -+ · - simp - simp [a] - grind -- . intro n hn -+ · intro n hn - apply this - - have h_diff_ge (N: ℕ): h b (i₀ + (3 * w * N)) - d * (i₀ + 3 * w * N) * Real.log 16 ≥ d * (w * N - i₀) * (Real.log 16) + h b i₀ := by -@@ -276,14 +272,14 @@ lemma exists_j_0_for_h (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 - lhs - equals 0 + negative_start => simp - apply Nat.add_le_add -- . simp -- . -+ · simp -+ · - conv => - lhs - equals 1 * negative_start => simp - apply Nat.mul_le_mul -- . grind -- . simp -+ · grind -+ · simp - ) - - have h_ge_one := h_diff_ge (max ⌈positive_start⌉₊ negative_start) -@@ -316,17 +312,17 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) - - have h_m_diff_le: h b (m + w) - h b (m) ≤ h b (i₀ + 3 * w * (j_0 + 1)) - h b (i₀ + 3 * w * (j_0)) := by - apply sub_le_sub -- . -+ · - apply h_montone_on b -- . simp [m] -+ · simp [m] - grind -- . simp -- . simp [m] -+ · simp -+ · simp [m] - grind -- . apply h_montone_on b -- . simp [m] -- . simp [m] -- . simp [m] -+ · apply h_montone_on b -+ · simp -+ · simp [m] -+ · simp [m] - - have h_le_w_a_d : h b (m + w) - h b m ≤ w * (a d) := by - grw [h_m_diff_le] -@@ -335,8 +331,8 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) - have w_a_le_h : w * (a d) ≤ h b (m + w) - h b m := by - rw [h_sum.symm] - grw [← Finset.card_nsmul_le_sum (n := (a d))] -- . simp -- . intro x hx -+ · simp -+ · intro x hx - apply this - simpa using hx - grind -@@ -346,22 +342,22 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) - by_contra! - - have h_sum (N: ℕ) := Finset.sum_Ico_sub (f := fun n => h b (m + n)) (m := (2 * w)) (n := (3 * w)) (by grind) -- simp only [Nat.Ico_zero_eq_range, add_zero, forall_const] at h_sum -+ simp only [forall_const] at h_sum - - have h_m_diff_le: h b (m + 3 * w) - h b (m + 2 * w) ≤ h b (i₀ + 3 * w * (j_0 + 1)) - h b (i₀ + 3 * w * (j_0)) := by - apply sub_le_sub -- . -+ · - apply h_montone_on b -- . simp [m] -+ · simp [m] - grind -- . simp -- . simp [m] -+ · simp -+ · simp [m] - grind -- . apply h_montone_on b -- . simp [m] -- . simp [m] -+ · apply h_montone_on b -+ · simp -+ · simp [m] - grind -- . simp [m] -+ · simp [m] - - have h_le_w_a_d : h b (m + 3 * w) - h b (m + 2 * w) ≤ w * (a d) := by - grw [h_m_diff_le] -@@ -371,10 +367,10 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) - - rw [h_sum.symm] - grw [← Finset.card_nsmul_le_sum (n := (a d))] -- . simp -+ · simp - rw [← Nat.sub_mul] - simp -- . intro x hx -+ · intro x hx - apply this - simp - simp at hx -@@ -385,20 +381,20 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) - obtain ⟨i_2, h_i_2⟩ := exists_i2 - have diff_i_lt: h b (i_2 + 1) - h b i_1 < w * (a d) := by - grw [h_montone_on b _ _ (b := i₀ + 3 * w * (j_0 + 1))] -- . -+ · - apply LE.le.trans_lt ?_ h_j_0 - apply sub_le_sub_left - apply h_montone_on b -- . simp -- . simp -+ · simp -+ · simp - grind -- . grind -- . simp at h_i_2 -+ · grind -+ · simp at h_i_2 - grind -- . simp -+ · simp - simp at h_i_2 - grind -- . simp [m] -+ · simp - - have foo := h_i_1.1 - simp at foo -@@ -407,8 +403,8 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) - have i_0_pos: 0 < i₀ := by - simp [i₀] - apply Nat.clog_pos -- . simp -- . simp [R'] -+ · simp -+ · simp [R'] - rw [Nat.lt_ceil] - simp [R'_] - have r_pos := R'_pos V -diff --git a/Gromov/Vendor/Carleson/ToMathlib/Analysis/Convolution.lean b/Gromov/Vendor/Carleson/ToMathlib/Analysis/Convolution.lean -index dd8200d..cc1fba1 100644 ---- a/Gromov/Vendor/Carleson/ToMathlib/Analysis/Convolution.lean -+++ b/Gromov/Vendor/Carleson/ToMathlib/Analysis/Convolution.lean -@@ -52,12 +52,13 @@ lemma lintegral_enorm_convolution_integrand_le_eLpNorm_mul_eLpNorm [AddGroup G] - hg.comp_quasiMeasurePreserving <| quasiMeasurePreserving_sub_left μ x₀ - have hL' : ∀ᵐ (x : G) ∂μ, ‖L (f x) (g (x₀ - x))‖ ≤ (1 : NNReal) * ‖f x‖ * ‖g (x₀ - x)‖ := by - simpa using Filter.Eventually.of_forall (fun x ↦ hL x (x₀ - x)) -- simpa [eLpNorm, eLpNorm', Function.comp_def] using -- eLpNorm_le_eLpNorm_mul_eLpNorm'_of_norm hf hg' (L ·) _ hL' (hpqr := hpq) -+ have bound := eLpNorm_le_eLpNorm_mul_eLpNorm_of_norm -+ (L ·) 1 (by fun_prop) hf hg' hL' (hpqr := hpq) -+ exact lintegral_enorm_le_eLpNorm_one.trans (by simpa only [Function.comp_def, ENNReal.coe_one, one_mul] using bound) - - /-- If `MemLp f p μ` and `MemLp g q μ`, where `p` and `q` are Hölder conjugates, then the - convolution of `f` and `g` exists everywhere. -/ --theorem ConvolutionExists.of_memLp_memLp [AddGroup G] [MeasurableAdd₂ G] -+theorem ConvolutionExists.of_memLp_memLp_legacy [AddGroup G] [MeasurableAdd₂ G] - [MeasurableNeg G] (μ : Measure G) [SFinite μ] [μ.IsNegInvariant] [μ.IsAddLeftInvariant] - [μ.IsAddRightInvariant] {p q : ENNReal} (hpq : p.HolderConjugate q) - (hL : ∀ (x y : G), ‖L (f x) (g y)‖ ≤ ‖f x‖ * ‖g y‖) (hf : AEStronglyMeasurable f μ) -diff --git a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Function/LpSeminorm/Basic.lean b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Function/LpSeminorm/Basic.lean -index df0289c..b18f60f 100644 ---- a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Function/LpSeminorm/Basic.lean -+++ b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Function/LpSeminorm/Basic.lean -@@ -25,6 +25,10 @@ set_option linter.style.header false - open MeasureTheory - open scoped ENNReal - -+-- On the countable discrete groups used below, the new measurability guard -+-- in Mathlib's eLpNorm is discharged by this existing theorem. -+attribute [simp] AEStronglyMeasurable.of_discrete -+ - variable {α ε E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α} - [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] [ENorm ε] - -@@ -34,25 +38,18 @@ section MapMeasure - - variable {β : Type*} {mβ : MeasurableSpace β} {f : α → β} {g : β → E} - --theorem eLpNormEssSup_map_measure' [MeasurableSpace E] [OpensMeasurableSpace E] -+theorem eLpNormEssSup_map_measure' [MeasurableSpace E] [OpensMeasurableSpace E] [SecondCountableTopology E] - (hg : AEMeasurable g (Measure.map f μ)) (hf : AEMeasurable f μ) : - eLpNormEssSup g (Measure.map f μ) = eLpNormEssSup (g ∘ f) μ := - essSup_map_measure hg.enorm hf - --theorem eLpNorm_map_measure' [MeasurableSpace E] [OpensMeasurableSpace E] -+theorem eLpNorm_map_measure' [MeasurableSpace E] [OpensMeasurableSpace E] [SecondCountableTopology E] - (hg : AEMeasurable g (Measure.map f μ)) (hf : AEMeasurable f μ) : - eLpNorm g p (Measure.map f μ) = eLpNorm (g ∘ f) p μ := by -- by_cases hp_zero : p = 0 -- · aesop -- by_cases hp_top : p = ∞ -- · rw [hp_top, eLpNorm_exponent_top] -- exact eLpNormEssSup_map_measure' hg hf -- simp_rw [eLpNorm_eq_lintegral_rpow_enorm hp_zero hp_top] -- rw [lintegral_map' (hg.enorm.pow_const p.toReal) hf] -- rfl -+ exact eLpNorm_map_measure hg.aestronglyMeasurable hf - - theorem eLpNorm_comp_measurePreserving' {ν : Measure β} [MeasurableSpace E] -- [OpensMeasurableSpace E] (hg : AEMeasurable g ν) (hf : MeasurePreserving f μ ν) : -+ [OpensMeasurableSpace E] [SecondCountableTopology E] (hg : AEMeasurable g ν) (hf : MeasurePreserving f μ ν) : - eLpNorm (g ∘ f) p μ = eLpNorm g p ν := - Eq.symm <| hf.map_eq ▸ eLpNorm_map_measure' (hf.map_eq ▸ hg) hf.aemeasurable - -diff --git a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean -index 40fc8a4..fb8ba6c 100644 ---- a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean -+++ b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean -@@ -13,19 +13,13 @@ public import Gromov.Vendor.Carleson.ToMathlib.MeasureTheory.Measure.Haar.Unique - public import Gromov.Vendor.Carleson.ToMathlib.MeasureTheory.Measure.Prod - - /-! --# Vendored from the Carleson project -+# Young's convolution inequality - --Port of `Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean` from -- (branch `young-add-group`, commit `3b35c86`), which is --the non-abelian generalization of Young's convolution inequality. -- --The `eLpNorm_Ioc_convolution_le_*` theorems at the end of the upstream file are omitted: they are --unused here and would drag in the whole `Carleson/ToMathlib/MeasureTheory/Integral/Periodic.lean` --(`liftIoc`) development. -+Non-abelian convolution inequalities, including Hölder and Minkowski estimates. -+Based on the Carleson project contributors' formalization of Young's inequality, -+, commit `3b35c86`. - -/ - --set_option linter.style.header false -- - @[expose] public section - - open NNReal ENNReal MeasureTheory Finset -@@ -51,7 +45,6 @@ theorem Lp_add_le_sum - Lp_add_le _ _ _ hp - _ ≤ _ := by gcongr - ---- Add after `lintegral_prod_norm_pow_le` - /-- A version of Hölder with multiple arguments, allowing `∞` as an exponent. -/ - theorem lintegral_prod_norm_pow_le' {α ι : Type*} [MeasurableSpace α] {μ : Measure α} - {s : Finset ι} {f : ι → α → ℝ≥0∞} (hf : ∀ i ∈ s, AEMeasurable (f i) μ) -@@ -69,7 +62,8 @@ theorem lintegral_prod_norm_pow_le' {α ι : Type*} [MeasurableSpace α] {μ : M - lintegral_congr (fun a ↦ (Finset.mul_prod_erase s (f · a) hi₀).symm) - _ ≤ eLpNorm (f i₀) (p i₀) μ * ∫⁻ (a : α), ∏ i ∈ s.erase i₀, f i a ∂μ := by - rw [← lintegral_const_mul'', pi₀_eq_top] -- · exact lintegral_mono_ae <| (ae_le_essSup (f i₀)).mono (fun a ha ↦ mul_le_mul_left ha _) -+ · rw [eLpNorm_exponent_top (hf i₀ hi₀).aestronglyMeasurable] -+ exact lintegral_mono_ae <| (ae_le_essSup (f i₀)).mono (fun a ha ↦ mul_le_mul_left ha _) - · exact Finset.aemeasurable_fun_prod _ (fun i hi ↦ hf i (Finset.mem_of_mem_erase hi)) - _ ≤ eLpNorm (f i₀) (p i₀) μ * ∏ i ∈ s.erase i₀, eLpNorm (f i) (p i) μ := by - apply mul_right_mono -@@ -91,15 +85,15 @@ theorem lintegral_prod_norm_pow_le' {α ι : Type*} [MeasurableSpace α] {μ : M - convert ENNReal.lintegral_prod_norm_pow_le s hf' hp₁ hp₂ with a i₀ hi₀ i hi - · rw [← ENNReal.rpow_mul, mul_inv_cancel₀, rpow_one] - exact ENNReal.toReal_ne_zero.mpr ⟨p_ne_0 i₀ hi₀, (exists_top ⟨i₀, hi₀, ·⟩)⟩ -- · simp [eLpNorm, eLpNorm', p_ne_0 i hi, p_ne_top i hi] -+ · simp [eLpNorm, eLpNorm', p_ne_0 i hi, p_ne_top i hi, (hf i hi).aestronglyMeasurable] - - /-- **Hölder's inequality** for functions `α → ℝ≥0∞`, using exponents in `ℝ≥0∞` -/ - theorem lintegral_mul_le_eLpNorm_mul_eLqNorm {p q : ℝ≥0∞} (hpq : p.HolderConjugate q) - {f g : α → ENNReal} (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) : - ∫⁻ (a : α), (f * g) a ∂μ ≤ eLpNorm f p μ * eLpNorm g q μ := by -- -- adaptation note: `ENNReal.HolderConjugate` is now a class (`HolderTriple p q 1`), so the -- -- upstream dot-notation API (`hpq.symm`, `hpq.conj_eq`, `hpq.toReal_of_ne_top`) is gone. -- haveI := hpq -+ have := hpq -+ have hfm := hf.aestronglyMeasurable -+ have hgm := hg.aestronglyMeasurable - simp_rw [Pi.mul_apply] - have hp0 : p ≠ 0 := HolderConjugate.ne_zero p q - have hq0 : q ≠ 0 := HolderConjugate.ne_zero q p -@@ -109,14 +103,14 @@ theorem lintegral_mul_le_eLpNorm_mul_eLqNorm {p q : ℝ≥0∞} (hpq : p.HolderC - _ ≤ ∫⁻ a, essSup f μ * g a ∂μ := - lintegral_mono_ae <| (ae_le_essSup f).mono fun a ha ↦ mul_le_mul_left ha _ - _ = essSup f μ * ∫⁻ a, g a ∂μ := lintegral_const_mul'' _ hg -- _ = _ := by simp [eLpNorm, eLpNorm', eLpNormEssSup, hp, hq1] -+ _ = _ := by simp [eLpNorm, eLpNorm', eLpNormEssSup, hp, hq1, hfm, hgm] - rcases eq_or_ne q ∞ with hq | hq - · have hp1 : p = 1 := (HolderConjugate.eq_top_iff_eq_one q p).mp hq - calc ∫⁻ a, f a * g a ∂μ - _ ≤ ∫⁻ a, f a * essSup g μ ∂μ := - lintegral_mono_ae <| (ae_le_essSup g).mono fun a ha ↦ mul_le_mul_right ha _ - _ = (∫⁻ a, f a ∂μ) * essSup g μ := lintegral_mul_const'' _ hf -- _ = _ := by simp [eLpNorm, eLpNorm', eLpNormEssSup, hp1, hq] -+ _ = _ := by simp [eLpNorm, eLpNorm', eLpNormEssSup, hp1, hq, hfm, hgm] - -- Both exponents are finite: reduce to the real-exponent version. - have hpt : 0 < p.toReal := ENNReal.toReal_pos hp0 hp - have hqt : 0 < q.toReal := ENNReal.toReal_pos hq0 hq -@@ -129,7 +123,7 @@ theorem lintegral_mul_le_eLpNorm_mul_eLqNorm {p q : ℝ≥0∞} (hpq : p.HolderC - have : 0 < q.toReal⁻¹ := by positivity - linarith - convert ENNReal.lintegral_mul_le_Lp_mul_Lq μ hpq' hf hg -- all_goals simp [eLpNorm, eLpNorm', hp, hq, hp0, hq0] -+ all_goals simp [eLpNorm, eLpNorm', hp, hq, hp0, hq0, hfm, hgm] - - /-- **Cauchy–Schwarz inequality** for functions `α → ℝ≥0∞` (Hölder's inequality squared). -/ - theorem sq_lintegral_mul_le_mul_lintegral_sq {f g : α → ℝ≥0∞} -@@ -168,15 +162,21 @@ universe u𝕜 uG uE uE' uF - variable {𝕜 : Type u𝕜} {G : Type uG} [MeasurableSpace G] {μ : Measure G} - {E : Type uE} {E' : Type uE'} {F : Type uF} - -+variable [Countable G] [MeasurableSingletonClass G] -+ -+private theorem discrete_aestronglyMeasurable {Y : Type*} [TopologicalSpace Y] -+ (f : G → Y) : AEStronglyMeasurable f μ := AEStronglyMeasurable.of_discrete -+ -+attribute [local simp] discrete_aestronglyMeasurable -+ - variable [NormedAddCommGroup E] [NormedAddCommGroup E'] [NormedAddCommGroup F] - {f : G → E} {g : G → E'} - - /-- If `MemLp f p μ` and `MemLp g q μ`, where `p` and `q` are Hölder conjugates, then the - convolution of `f` and `g` exists everywhere. - --This is `MeasureTheory.ConvolutionExists.of_memLp_memLp`, re-exported into the `ENNReal` --namespace to match the name used elsewhere in this development. -/ --alias ConvolutionExists.of_memLp_memLp := MeasureTheory.ConvolutionExists.of_memLp_memLp -+This follows from Hölder's inequality with the conjugate exponents. -/ -+alias ConvolutionExists.of_memLp_memLp := MeasureTheory.ConvolutionExists.of_memLp_memLp_legacy - - -- Used in the proof of `enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm` - open ENNReal in -@@ -191,9 +191,8 @@ private lemma eLpNorm_eq_eLpNorm_rpow (h : G → E) {r e : ℝ} (r0 : 0 < r) (e0 - have lt_top : ENNReal.ofReal (e * r) / ENNReal.ofReal (r - e) < ∞ := - div_lt_top ofReal_ne_top <| (not_iff_not.mpr ofReal_eq_zero).mpr r_sub_e_pos.not_ge - simp only [eLpNorm, eLpNorm', reduceIte, div_eq_zero_iff, ofReal_eq_zero, ofReal_ne_top, -- lt_top.ne, er_pos.not_ge, e0.not_ge, or_self, enorm_eq_self, ← rpow_mul] -- -- adaptation note: `field_simp` no longer sees through the `ENNReal.toReal` of the exponents, -- -- so we compute them by hand first. -+ lt_top.ne, er_pos.not_ge, e0.not_ge, or_self, enorm_eq_self, ← rpow_mul, -+ discrete_aestronglyMeasurable, ite_true] - have hrne : r - e ≠ 0 := r_sub_e_pos.ne' - have hene : e ≠ 0 := e0.ne' - have hrne0 : r ≠ 0 := r0.ne' -@@ -215,6 +214,7 @@ variable {L : E →L[𝕜] E' →L[𝕜] F} - - -- Used to handle trivial case `c ≤ 0` when proving versions of Young's convolution inequality - -- assuming `∀ (x y : G), ‖L (f x) (g y)‖ ≤ c * ‖f x‖ * ‖g y‖)` -+omit [Countable G] [MeasurableSingletonClass G] in - private theorem convolution_zero_of_c_nonpos [AddGroup G] {f : G → E} {g : G → E'} {c : ℝ} - (hL : ∀ (x y : G), ‖L (f x) (g y)‖ ≤ c * ‖f x‖ * ‖g y‖) (hc : c ≤ 0) : f ⋆[L, μ] g = 0 := by - have : ∀ (x y : G), L (f x) (g y) = 0 := -@@ -233,13 +233,13 @@ private theorem eLpNorm_top_convolution_le_aux [AddGroup G] {p q : ℝ≥0∞} - eLpNorm (f ⋆[L, μ] g) ∞ μ ≤ ENNReal.ofReal c * eLpNorm f p μ * eLpNorm g q μ := by - by_cases hc : c ≤ 0 - · simp [convolution_zero_of_c_nonpos hL hc] -- push_neg at hc -- rw [eLpNorm_exponent_top, eLpNormEssSup] -+ push Not at hc -+ rw [eLpNorm_exponent_top (discrete_aestronglyMeasurable _), eLpNormEssSup] - refine essSup_le_of_ae_le _ (Filter.Eventually.of_forall fun x ↦ ?_) - apply le_trans <| enorm_integral_le_lintegral_enorm _ - calc ∫⁻ y, ‖(L (f y)) (g (x - y))‖ₑ ∂μ - _ ≤ ∫⁻ y, ENNReal.ofReal c * ‖f y‖ₑ * ‖g (x - y)‖ₑ ∂μ := by -- simp_rw [← ofReal_norm_eq_enorm, ← ENNReal.ofReal_mul hc.le] -+ simp_rw [← ofReal_norm, ← ENNReal.ofReal_mul hc.le] - refine lintegral_mono (fun y ↦ ?_) - rw [← ENNReal.ofReal_mul <| mul_nonneg hc.le (norm_nonneg _)] - exact ENNReal.ofReal_le_ofReal <| hL y (x - y) -@@ -251,6 +251,7 @@ private theorem eLpNorm_top_convolution_le_aux [AddGroup G] {p q : ℝ≥0∞} - variable [AddGroup G] [TopologicalSpace G] [IsTopologicalAddGroup G] [BorelSpace G] - [μ.IsAddHaarMeasure] [LocallyCompactSpace G] [SecondCountableTopology G] - -+omit [LocallyCompactSpace G] in - /-- Special case of **Young's convolution inequality** when `r = ∞`. -/ - theorem eLpNorm_top_convolution_le [MeasurableSpace E] [OpensMeasurableSpace E] - [MeasurableSpace E'] [OpensMeasurableSpace E'] [μ.IsNegInvariant] {p q : ℝ≥0∞} -@@ -259,8 +260,9 @@ theorem eLpNorm_top_convolution_le [MeasurableSpace E] [OpensMeasurableSpace E] - eLpNorm (f ⋆[L, μ] g) ∞ μ ≤ ENNReal.ofReal c * eLpNorm f p μ * eLpNorm g q μ := by - refine eLpNorm_top_convolution_le_aux hpq hf.enorm ?_ ?_ c hL - · intro x; exact (hg.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub_left μ x)).enorm -- · intro x; exact eLpNorm_comp_measurePreserving' hg (μ.measurePreserving_sub_left x) -+ · intro x; exact eLpNorm_comp_measurePreserving hg.enorm.aestronglyMeasurable (μ.measurePreserving_sub_left x) - -+omit [LocallyCompactSpace G] in - /-- Special case of **Young's convolution inequality** when `r = ∞`. -/ - theorem eLpNorm_top_convolution_le' [μ.IsNegInvariant] {p q : ℝ≥0∞} - (hpq : p.HolderConjugate q) {f : G → E} {g : G → E'} -@@ -269,7 +271,7 @@ theorem eLpNorm_top_convolution_le' [μ.IsNegInvariant] {p q : ℝ≥0∞} - eLpNorm (f ⋆[L, μ] g) ∞ μ ≤ ENNReal.ofReal c * eLpNorm f p μ * eLpNorm g q μ := by - refine eLpNorm_top_convolution_le_aux hpq hf.enorm ?_ ?_ c hL - · intro x; exact (hg.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub_left μ x)).enorm -- · intro x; apply eLpNorm_comp_measurePreserving hg (Measure.measurePreserving_sub_left μ x) -+ · intro x; exact eLpNorm_comp_measurePreserving hg.enorm.aestronglyMeasurable (Measure.measurePreserving_sub_left μ x) - - -- Auxiliary inequality used to prove versions with simpler conditions on `f` and `g` - open ENNReal in -@@ -285,10 +287,10 @@ private theorem enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm_aux - (eLpNorm g (.ofReal q) μ) ^ ((r - q) / r)) := by - by_cases hc : c ≤ 0 - · simp [convolution_zero_of_c_nonpos hL hc] -- push_neg at hc -+ push Not at hc - by_cases μ0 : μ = 0 - · simp [μ0, convolution] -- push_neg at μ0 -+ push Not at μ0 - let F (i : Fin 3) : G → ℝ≥0∞ := - match i with - | 0 => fun y ↦ (‖f y‖ₑ ^ p * ‖g (x - y)‖ₑ ^ q) ^ (1 / r) -@@ -363,6 +365,7 @@ private theorem enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm_aux - simp [eLpNorm, eLpNorm', lintegral_sub_left_eq_self (‖g ·‖ₑ ^ (ENNReal.ofReal q).toReal) x] - - open ENNReal in -+omit [LocallyCompactSpace G] in - /-- This inequality is used in the proof of Young's convolution inequality - `eLpNorm_convolution_le_ofReal`. See `enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm'` for - a version assuming a.e. strong measurability instead. -/ -@@ -380,6 +383,7 @@ theorem enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm [MeasurableSpace E] - (fun x ↦ (hg.comp_quasiMeasurePreserving <| quasiMeasurePreserving_sub_left μ x).enorm) c hL x - - open ENNReal in -+omit [LocallyCompactSpace G] in - /-- This inequality is used in the proof of Young's convolution inequality - `eLpNorm_convolution_le_ofReal'`. -/ - theorem enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm' -@@ -520,7 +524,7 @@ theorem eLpNorm_convolution_le_of_norm_le_mul [MeasurableSpace E] [OpensMeasurab - eLpNorm (f ⋆[L, μ] g) r μ ≤ .ofReal c * eLpNorm f p μ * eLpNorm g q μ := by - refine eLpNorm_convolution_le_of_norm_le_mul_aux hp hq hr hpqr hf.enorm ?_ ?_ ?_ c hL - · intro x; exact hg.enorm.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub_left μ x) -- · intro x; exact eLpNorm_comp_measurePreserving' hg (μ.measurePreserving_sub_left x) -+ · intro x; exact eLpNorm_comp_measurePreserving hg.enorm.aestronglyMeasurable (μ.measurePreserving_sub_left x) - · exact hg.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub μ μ) |>.enorm.pow_const _ - - /-- **Young's convolution inequality**: the `L^r` seminorm of a convolution `(f ⋆[L, μ] g)` is -@@ -535,7 +539,7 @@ theorem eLpNorm_convolution_le_of_norm_le_mul' - eLpNorm (f ⋆[L, μ] g) r μ ≤ .ofReal c * eLpNorm f p μ * eLpNorm g q μ := by - refine eLpNorm_convolution_le_of_norm_le_mul_aux hp hq hr hpqr hf.enorm ?_ ?_ ?_ c hL - · intro x; exact hg.enorm.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub_left μ x) -- · intro x; apply eLpNorm_comp_measurePreserving hg (μ.measurePreserving_sub_left x) -+ · intro x; exact eLpNorm_comp_measurePreserving hg.enorm.aestronglyMeasurable (μ.measurePreserving_sub_left x) - · exact hg.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub μ μ) |>.enorm.pow_const _ - - /-- **Young's convolution inequality**: the `L^r` seminorm of a convolution `(f ⋆[L, μ] g)` is -diff --git a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Measure/Haar/Unique.lean b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Measure/Haar/Unique.lean -index 3cd8144..cfa394d 100644 ---- a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Measure/Haar/Unique.lean -+++ b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Measure/Haar/Unique.lean -@@ -40,7 +40,7 @@ instance (priority := 100) IsHaarMeasure.isInvInvariant_of_isMulRightInvariant ( - let c : ℝ≥0∞ := haarScalarFactor μ.inv μ - have hc : μ.inv = c • μ := isMulLeftInvariant_eq_smul_of_regular μ.inv μ - have : map Inv.inv (map Inv.inv μ) = c ^ 2 • μ := by -- rw [← inv_def μ, hc, Measure.map_smul, ← inv_def μ, hc, smul_smul, pow_two] -+ rw [← inv_def μ, hc, Measure.map_smul c (by fun_prop), ← inv_def μ, hc, smul_smul, pow_two] - have μeq : μ = c ^ 2 • μ := by - simpa [map_map continuous_inv.measurable continuous_inv.measurable] using this - have K : TopologicalSpace.PositiveCompacts G := Classical.arbitrary _ -diff --git a/lake-manifest.json b/lake-manifest.json -index d526394..69de6ca 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,96 +1,117 @@ --{"version": "1.2.0", -+{ -+ "version": "1.2.0", - "packagesDir": ".lake/packages", -- "packages": -- [{"url": "https://github.com/leanprover-community/mathlib4", -+ "packages": [ -+ { -+ "url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "a6180e1994004a7c705114bcbebaf5fff4b8384d", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "a6180e1994004a7c705114bcbebaf5fff4b8384d", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, -- "configFile": "lakefile.lean"}, -- {"url": "https://github.com/leanprover-community/plausible", -+ "configFile": "lakefile.lean" -+ }, -+ { -+ "url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "123d15766ba49356c02ebad2a4462dfe12d79899", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/LeanSearchClient", -+ "configFile": "lakefile.toml" -+ }, -+ { -+ "url": "https://github.com/leanprover-community/LeanSearchClient", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "f5c090429dff3cf66cb65562526c9ea6e8edfbcb", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/import-graph", -+ "configFile": "lakefile.toml" -+ }, -+ { -+ "url": "https://github.com/leanprover-community/import-graph", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "bb3469a87774349fe01898d8bf2fc6a1ce6411ca", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/ProofWidgets4", -+ "configFile": "lakefile.toml" -+ }, -+ { -+ "url": "https://github.com/leanprover-community/ProofWidgets4", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "222c58dad7706a6e7cae46c0edd65ea881d3ee27", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.lean"}, -- {"url": "https://github.com/leanprover-community/aesop", -+ "configFile": "lakefile.lean" -+ }, -+ { -+ "url": "https://github.com/leanprover-community/aesop", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7db8190085343afde2f5d2cdcc9bac719b6ec02c", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", - "inherited": true, -- "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/quote4", -+ "configFile": "lakefile.toml" -+ }, -+ { -+ "url": "https://github.com/leanprover-community/quote4", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "ef42f8944eaf5b6cbfbe75d1917d824c7dd6cf33", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", - "inherited": true, -- "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/batteries", -+ "configFile": "lakefile.toml" -+ }, -+ { -+ "url": "https://github.com/leanprover-community/batteries", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "76e1c118b0700b4ceafe99532e887d6431625e1a", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover/lean4-cli", -+ "configFile": "lakefile.toml" -+ }, -+ { -+ "url": "https://github.com/leanprover/lean4-cli", - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "1319485273bf87833fa472afbcefdedecb16b45f", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.33.0-rc2", -+ "inputRev": "v4.34.0", - "inherited": true, -- "configFile": "lakefile.toml"}], -+ "configFile": "lakefile.toml" -+ } -+ ], - "name": "gromov", - "lakeDir": ".lake", -- "fixedToolchain": false} -+ "fixedToolchain": false -+} -diff --git a/lakefile.toml b/lakefile.toml -index 1faeb69..893e40a 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -9,8 +9,8 @@ autoImplicit = false - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "a6180e1994004a7c705114bcbebaf5fff4b8384d" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "Gromov" -diff --git a/lean-toolchain b/lean-toolchain -index c084c7f..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.33.0-rc2 -+leanprover/lean4:v4.34.1 +diff --git a/Gromov/BoundedDoubling.lean b/Gromov/BoundedDoubling.lean +index 61fd0b4..ac55b91 100644 +--- a/Gromov/BoundedDoubling.lean ++++ b/Gromov/BoundedDoubling.lean +@@ -11,11 +11,6 @@ public import Gromov.Lemma326 + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -39,29 +34,62 @@ variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] + + variable {b : Module.Basis ι ℝ V} + +-set_option maxHeartbeats 2500000 in +-lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodule ℝ LipschitzH, U ≤ V ∧ dim V ≤ 2 * dim U ∧ ∀ f ∈ U, Q_R (16 * (R_2 data)) f f ≤ Real.exp (2 * (a data.d)) * Q_R ((R_2 data)) f f := by ++omit hGS v_wrapper_inst in ++private lemma diagonal_form_eval {E I : Type*} [AddCommGroup E] [Module ℝ E] ++ [Fintype I] [DecidableEq I] (b : Module.Basis I ℝ E) ++ (B : LinearMap.BilinForm ℝ E) (hB : B.IsOrthoᵢ b) (x : E) : ++ B x x = ∑ i, (b.repr x i)^2 * B (b i) (b i) := by ++ calc ++ B x x = B (∑ i, b.repr x i • b i) (∑ j, b.repr x j • b j) := by ++ rw [b.sum_repr] ++ _ = ∑ i, ∑ j, b.repr x i * b.repr x j * B (b j) (b i) := by ++ simp only [map_sum, LinearMap.sum_apply, map_smul, LinearMap.smul_apply, smul_eq_mul] ++ apply Finset.sum_congr rfl ++ intro i hi ++ rw [Finset.mul_sum] ++ apply Finset.sum_congr rfl ++ intro j hj ++ ring ++ _ = ∑ i, (b.repr x i)^2 * B (b i) (b i) := by ++ apply Finset.sum_congr rfl ++ intro i hi ++ rw [Finset.sum_eq_single i] ++ · ring ++ · intro j hj hji ++ rw [hB hji] ++ simp ++ · simp ++ ++omit hGS v_wrapper_inst in ++private lemma diagonal_forms_le {E I : Type*} [AddCommGroup E] [Module ℝ E] ++ [Fintype I] [DecidableEq I] (b : Module.Basis I ℝ E) ++ (B D : LinearMap.BilinForm ℝ E) (hB : B.IsOrthoᵢ b) (hD : D.IsOrthoᵢ b) ++ (x : E) (k : ℝ) ++ (hk : ∀ i ∈ (b.repr x).support, D (b i) (b i) ≤ k * B (b i) (b i)) : ++ D x x ≤ k * B x x := by ++ rw [diagonal_form_eval b B hB, diagonal_form_eval b D hD, Finset.mul_sum] ++ apply Finset.sum_le_sum ++ intro i hi ++ by_cases hx : i ∈ (b.repr x).support ++ · nlinarith [mul_le_mul_of_nonneg_left (hk i hx) (sq_nonneg (b.repr x i))] ++ · have hz : b.repr x i = 0 := Finsupp.notMem_support_iff.mp hx ++ simp [hz] ++ ++private lemma doubleScale_basis (R : ℕ) (h_R : R'_ V ≤ (R : ℝ)) : ++ ∃ v_orthonormal : Module.Basis (Fin (Module.finrank ℝ V)) ℝ V, ++ let _q_r_16_m := (Q_R_lin V (16 * R)).toMatrix₂ v_orthonormal v_orthonormal ++ let q_r_16_m_hermitian := Q_R_lin_hermetian v_orthonormal (16 * R) ++ let q_r_16_eigen := q_r_16_m_hermitian.eigenvectorBasis.toBasis ++ let eigen_basis_V := (WithLp.linearEquiv 2 ℝ (Fin (Module.finrank ℝ V) → ℝ)).trans v_orthonormal.equivFun.symm ++ let remapped_ortho := Module.Basis.map q_r_16_eigen eigen_basis_V ++ (Q_R_lin V R).IsOrthoᵢ remapped_ortho ∧ ++ (∀ i, Q_R_lin V R (remapped_ortho i) (remapped_ortho i) = 1) ∧ ++ (Q_R_lin V R).toMatrix₂ v_orthonormal v_orthonormal = 1 ∧ ++ (Q_R_lin_plain V (16 * R)).IsOrthoᵢ remapped_ortho := by + classical +- +- let R := 16 ^ ((GoodScales data).i_2) +- have h_R: R'_ V ≤ ↑R := R'_le_R_2 data +- +- have q_r_base_pos_def := (Q_R_matrix_pos_def_i₀ b (16 ^ ((GoodScales data).i_2)) (by +- simp [i₀] +- rw [pow_le_pow_iff_right₀] +- . have foo := (GoodScales data).i_2_ge +- simp [i₀] at foo +- exact foo +- . simp +- )) +- +- have det_succ_pos : 0 < (Q_R_matrix b (16 ^ ((GoodScales data).i_2 + 1))).det := +- (Q_R_matrix_pos_def b (16 ^ ((GoodScales data).i_2 + 1)) +- (le_trans h_R (by simp only [R]; push_cast; exact pow_le_pow_right₀ (by norm_num) (Nat.le_succ _)))).det_pos +- + -- Full (definite) inner product core, registered as a local instance so that + -- `toNormedAddCommGroup` / `ofCore` pick it up by inference. +- letI Q_R_inner_core: InnerProductSpace.Core ℝ V := { ++ let Q_R_inner_core: InnerProductSpace.Core ℝ V := { + inner := fun u v => Q_R R u.val v.val + conj_inner_symm := by + simp [Q_R] +@@ -93,11 +121,11 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + + -- Install the definite Q_R-derived NORM (not just a seminorm) *before* `ofCore`, so the + -- ambient LipschitzH norm on `↥V` is shadowed and `Q_R_inner` is over this `NormedAddCommGroup`. +- letI Q_R_norm : NormedAddCommGroup ↥V := InnerProductSpace.Core.toNormedAddCommGroup (𝕜 := ℝ) ++ let Q_R_norm : NormedAddCommGroup ↥V := InnerProductSpace.Core.toNormedAddCommGroup (𝕜 := ℝ) + -- Also expose the seminorm projection as a *direct* local instance, so it shadows the + -- ambient `V.seminormedAddCommGroup` (a bare `NormedAddCommGroup` letI does not). +- letI Q_R_seminorm : SeminormedAddCommGroup ↥V := Q_R_norm.toSeminormedAddCommGroup +- letI Q_R_inner : InnerProductSpace ℝ ↥V := ++ let Q_R_seminorm : SeminormedAddCommGroup ↥V := Q_R_norm.toSeminormedAddCommGroup ++ let Q_R_inner : InnerProductSpace ℝ ↥V := + InnerProductSpace.ofCore (inferInstance : PreInnerProductSpace.Core ℝ ↥V) + + have norm_eq_q_r : ∀ x : ↥V, ‖x‖ = Real.sqrt (Q_R R x x) := fun _ => rfl +@@ -163,7 +191,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + apply v_orthogonal_orig_eval _ _ hij + )] + +- ring ++ ring_nf + simp [norm_eq_q_r] + conv => + lhs +@@ -190,9 +218,9 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + intro i + simp [remapped_ortho] + simp [eigen_basis_V,] +- ring ++ ring_nf + field_simp +- simp only [eigen_basis_V, q_r_16_eigen] ++ simp only [q_r_16_eigen] + simp + simp_rw [Finset.mul_sum] + simp [v_orthonormal] +@@ -218,7 +246,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + apply v_orthogonal_orig_eval _ _ hij + )] + +- ring ++ ring_nf + simp [norm_eq_q_r] + conv => + lhs +@@ -288,36 +316,6 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + let Q_R_16_new_ortho := (Q_R_lin V (16 *R)).toMatrix₂ remapped_ortho remapped_ortho + have Q_R_16_new_ortho_hermitian: Q_R_16_new_ortho.IsHermitian := Q_R_lin_hermetian remapped_ortho (16 *R) + +- have det_Q_R_one: Q_R_ortho.det = 1 := by +- simp [Q_R_ortho_eq_1] +- +- have det_Q_R_16_ge: 1 ≤ Q_R_16_new_ortho.det := by +- rw [← det_Q_R_one] +- apply matrix_det_montone +- . +- simp [Q_R_ortho] +- apply Matrix.PosDef.of_dotProduct_mulVec_pos (?_) +- . +- intro x hx +- simp [Q_R_matrix] +- conv => +- rhs +- lhs +- equals (star x) => simp +- rw [star_dotProduct_toMatrix₂_mulVec] +- apply Q_R_pos_on_R' +- . rw [LinearEquiv.map_ne_zero_iff] +- exact hx +- . exact h_R +- . apply Q_R_ortho_m_hermitian +- . +- simp [Q_R_16_new_ortho, Q_R_ortho] +- rw [← map_sub] +- rw [← LinearMap.isPosSemidef_iff_posSemidef_toMatrix] +- apply Q_R_lin_sub_pos_semi_def +- norm_cast +- grind +- + have q_r_16_remapped_orthogonal : (Q_R_lin_plain V (16 * R)).IsOrthoᵢ remapped_ortho := by + simp [remapped_ortho] + rw [LinearMap.isOrthoᵢ_def] +@@ -357,7 +355,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + + have tobasis_lp: ∀ x, (q_r_16_m_hermitian.eigenvectorBasis.toBasis x).ofLp = (q_r_16_m_hermitian.eigenvectorBasis x).ofLp := by + simp +- simp [tobasis_lp] ++ simp + rw [Matrix.IsHermitian.mulVec_eigenvectorBasis q_r_16_m_hermitian] + simp + right +@@ -371,6 +369,51 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + apply OrthonormalBasis.inner_eq_zero + exact hxy.symm + ++ exact ⟨v_orthonormal, v_orthonormal_isortho, q_r_lin_remapped_one, ++ Q_R_v_orthonormal_eq_1, q_r_16_remapped_orthogonal⟩ ++ ++lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodule ℝ LipschitzH, U ≤ V ∧ dim V ≤ 2 * dim U ∧ ∀ f ∈ U, Q_R (16 * (R_2 data)) f f ≤ Real.exp (2 * (a data.d)) * Q_R ((R_2 data)) f f := by ++ classical ++ ++ let R := 16 ^ ((GoodScales data).i_2) ++ have h_R: R'_ V ≤ ↑R := R'_le_R_2 data ++ ++ have q_r_base_pos_def := (Q_R_matrix_pos_def_i₀ b (16 ^ ((GoodScales data).i_2)) (by ++ simp [i₀] ++ rw [pow_le_pow_iff_right₀] ++ . have foo := (GoodScales data).i_2_ge ++ simp [i₀] at foo ++ exact foo ++ . simp ++ )) ++ ++ have det_succ_pos : 0 < (Q_R_matrix b (16 ^ ((GoodScales data).i_2 + 1))).det := ++ (Q_R_matrix_pos_def b (16 ^ ((GoodScales data).i_2 + 1)) ++ (le_trans h_R (by simp only [R]; push_cast; exact pow_le_pow_right₀ (by norm_num) (Nat.le_succ _)))).det_pos ++ ++ obtain ⟨v_orthonormal, hb⟩ := doubleScale_basis R h_R ++ let q_r_16_m := (Q_R_lin V (16 * R)).toMatrix₂ v_orthonormal v_orthonormal ++ have q_r_16_m_hermitian : q_r_16_m.IsHermitian := Q_R_lin_hermetian v_orthonormal (16 * R) ++ let q_r_16_eigen := q_r_16_m_hermitian.eigenvectorBasis.toBasis ++ let eigen_basis_V := (WithLp.linearEquiv 2 ℝ (Fin (Module.finrank ℝ V) → ℝ)).trans v_orthonormal.equivFun.symm ++ let remapped_ortho := Module.Basis.map q_r_16_eigen eigen_basis_V ++ change (Q_R_lin V R).IsOrthoᵢ remapped_ortho ∧ ++ (∀ i, Q_R_lin V R (remapped_ortho i) (remapped_ortho i) = 1) ∧ ++ (Q_R_lin V R).toMatrix₂ v_orthonormal v_orthonormal = 1 ∧ ++ (Q_R_lin_plain V (16 * R)).IsOrthoᵢ remapped_ortho at hb ++ obtain ⟨v_orthonormal_isortho, q_r_lin_remapped_one, ++ Q_R_v_orthonormal_eq_1, q_r_16_remapped_orthogonal⟩ := hb ++ let q_r_v_orthonormal := (Q_R_lin V R).toMatrix₂ v_orthonormal v_orthonormal ++ let Q_R_ortho := (Q_R_lin V R).toMatrix₂ remapped_ortho remapped_ortho ++ have det_Q_R_one : Q_R_ortho.det = 1 := by ++ have hmat : Q_R_ortho = 1 := by ++ ext i j ++ by_cases hij : i = j ++ · subst j ++ simpa [Q_R_ortho] using q_r_lin_remapped_one i ++ · simpa [Q_R_ortho, Matrix.one_apply, hij] using v_orthonormal_isortho hij ++ simp [hmat] ++ + have new_growth := data.h_growth + have nonempty_fin: Nonempty (Fin (Module.finrank ℝ ↥V)) := by + use 0 +@@ -394,124 +437,18 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + . simp + apply Finset.card_le_card + apply Finset.pow_subset_pow_right +- . simp [one_mem] ++ . simp [Generates.one_mem] + . grind + + -- +- have inner_x_self (x: V) (k: ℝ) (hk: ∀ i ∈ (remapped_ortho.repr x).support, (Q_R_lin_plain V (16 * R) (remapped_ortho i) (remapped_ortho i)) ≤ k * (Q_R_lin_plain V (R) (remapped_ortho i) (remapped_ortho i))) : Q_R_lin_plain V (16 * R) x x ≤ k * Q_R_lin_plain V (R) x x := by +- rw [← Module.Basis.sum_repr remapped_ortho (u := x)] +- have inner_sum_eq: ∀ i, ∑ i_1, inner ℝ ((remapped_ortho.repr x) i_1 • remapped_ortho i_1) ((remapped_ortho.repr x) i • remapped_ortho i) = inner ℝ ((remapped_ortho.repr x) i • remapped_ortho i) ((remapped_ortho.repr x) i • remapped_ortho i) := by +- intro i +- rw [Finset.sum_eq_single i] +- . intro k hk k_neq +- rw [inner_eq_q_r] +- simp [map_smul] +- rw [LinearMap.isOrthoᵢ_def] at v_orthonormal_isortho +- specialize v_orthonormal_isortho k i k_neq +- simp [Q_R_lin] at v_orthonormal_isortho +- simp [Q_R] +- simp [Q_R] at v_orthonormal_isortho +- simp_rw [mul_assoc] +- rw [← Finset.mul_sum] +- simp_rw [mul_comm ((remapped_ortho.repr x) i)] +- simp_rw [← mul_assoc] +- rw [← Finset.sum_mul] +- simp [v_orthonormal_isortho] +- . +- intro hi +- simp at hi +- +- have q_r_16_sum_eq: ∀ i, ∑ i_1, Q_R_lin_plain V (16 * R) ((remapped_ortho.repr x) i_1 • remapped_ortho i_1) ((remapped_ortho.repr x) i • remapped_ortho i) = Q_R_lin_plain V (16 * R) ((remapped_ortho.repr x) i • remapped_ortho i) ((remapped_ortho.repr x) i • remapped_ortho i) := by +- intro i +- rw [Finset.sum_eq_single i] +- . intro k hk k_neq +- simp [map_smul] +- rw [LinearMap.isOrthoᵢ_def] at q_r_16_remapped_orthogonal +- specialize q_r_16_remapped_orthogonal k i k_neq +- simp [Q_R_lin_plain] at q_r_16_remapped_orthogonal +- simp [Q_R_lin_plain, Q_R] +- simp [Q_R] at q_r_16_remapped_orthogonal +- right +- right +- simp [q_r_16_remapped_orthogonal] +- . +- intro hi +- simp at hi +- +- rw [map_sum] +- simp_rw [map_sum] +- simp [Finset.sum_apply] +- conv => +- rhs +- rhs +- arg 2 +- intro i +- rw [Finset.sum_eq_single i (by +- intro k hk k_neq +- simp [map_smul] +- rw [LinearMap.isOrthoᵢ_def] at v_orthonormal_isortho +- right +- specialize v_orthonormal_isortho k i k_neq +- simp [Q_R_lin] at v_orthonormal_isortho +- simp [Q_R_lin_plain, Q_R] +- simp [Q_R] at v_orthonormal_isortho +- simp [v_orthonormal_isortho] +- ) (by +- intro hi +- simp at hi +- )] +- conv => +- rhs +- rw [← Module.Basis.sum_repr remapped_ortho (u := x)] +- +- simp_rw [map_sum] +- simp +- simp_rw [Finset.mul_sum] +- conv => +- lhs +- arg 2 +- intro i +- rw [Finset.sum_eq_single i (by +- intro k hk k_neq +- simp [map_smul] +- rw [LinearMap.isOrthoᵢ_def] at q_r_16_remapped_orthogonal +- specialize q_r_16_remapped_orthogonal k i k_neq +- simp [Q_R_lin_plain] at q_r_16_remapped_orthogonal +- simp [Q_R_lin_plain, Q_R] +- simp [Q_R] at q_r_16_remapped_orthogonal +- right +- right +- simp [q_r_16_remapped_orthogonal] +- ) (by +- intro hi +- simp at hi +- )] +- +- apply Finset.sum_le_sum +- intro i hi +- by_cases i_mem_inter: i ∈ (remapped_ortho.repr x).support +- . +- conv => +- lhs +- equals ((Q_R_lin_plain V (16 * ↑R)) (remapped_ortho i)) (remapped_ortho i) * (remapped_ortho.repr x) i * (remapped_ortho.repr x) i => +- ring +- +- conv => +- rhs +- equals k * ((Q_R_lin_plain V ↑R) (remapped_ortho i)) (remapped_ortho i) * (remapped_ortho.repr x) i * (remapped_ortho.repr x) i => +- ring +- +- rw [mul_assoc] +- nth_rw 2 [mul_assoc] +- specialize hk i i_mem_inter +- grw [hk] +- . ring +- simp +- . rw [← pow_two] +- positivity +- . +- simp at i_mem_inter +- simp [i_mem_inter] ++ have inner_x_self (x : V) (k : ℝ) ++ (hk : ∀ i ∈ (remapped_ortho.repr x).support, ++ Q_R_lin_plain V (16 * R) (remapped_ortho i) (remapped_ortho i) ≤ ++ k * Q_R_lin_plain V R (remapped_ortho i) (remapped_ortho i)) : ++ Q_R_lin_plain V (16 * R) x x ≤ k * Q_R_lin_plain V R x x := by ++ exact diagonal_forms_le remapped_ortho ++ (Q_R_lin_plain V R) (Q_R_lin_plain V (16 * R)) ++ v_orthonormal_isortho q_r_16_remapped_orthogonal x k hk + grw [← log_second] at a_gt + rw [Real.log_mul] at a_gt + . +@@ -564,7 +501,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + simp + rw [le_sub_iff_add_le'] + grw [dim_small] +- ring ++ ring_nf + simp + . + have all_le: ∀ f ∈ small_submodule, Q_R_lin V (16 * ↑(R_2 data)) f f ≤ Real.exp (2 * a data.d) * Q_R_lin V ↑(R_2 data) f f := by +@@ -590,11 +527,11 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + . intro k hk i_neq + simp + right +- simp [Finsupp.single_apply, i_neq] ++ simp [i_neq] + . intro k hk i_neq + simp + right +- simp [Finsupp.single_apply, i_neq] ++ simp [i_neq] + + simp [large_basis] at i_not_mem + simp [Q_R_lin_plain] +@@ -617,7 +554,6 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + field_simp at a_gt + unfold Q_R_ortho at det_Q_R_one + have foo := Q_R_v_orthonormal_eq_1 +- unfold q_r_v_orthonormal at Q_R_v_orthonormal_eq_1 + simp [R] at Q_R_v_orthonormal_eq_1 + simp [Q_R_v_orthonormal_eq_1] at a_gt + +@@ -628,7 +564,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + . + have foo := q_r_lin_remapped_one + simp [Q_R_lin, Q_R] at foo +- simp [finite_closed_ball] ++ simp + rw [foo] + . + simp +@@ -745,7 +681,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + apply Matrix.PosDef.of_dotProduct_mulVec_pos (?_) + . + intro x hx +- simp [Q_R_matrix] ++ simp + conv => + rhs + lhs +@@ -767,7 +703,7 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + apply Matrix.PosDef.eigenvalues_pos + apply Matrix.PosDef.of_dotProduct_mulVec_pos (?_) + . intro x hx +- simp [Q_R_matrix] ++ simp + conv => + rhs + lhs +@@ -793,7 +729,6 @@ lemma exists_bounded_doubling_subspace (data: GoodScalesData b): ∃ U: Submodul + grind + . exact (Real.rpow_pos_of_pos det_succ_pos _).ne' + +-#print axioms exists_bounded_doubling_subspace + + end V_Wrapper_Section + +diff --git a/Gromov/Complexification.lean b/Gromov/Complexification.lean +index 71602f6..6ccd3ae 100644 +--- a/Gromov/Complexification.lean ++++ b/Gromov/Complexification.lean +@@ -41,11 +41,11 @@ def fst (p : Cx V) : V := (p : V × V).1 + @[expose] + def snd (p : Cx V) : V := (p : V × V).2 + +-omit [InnerProductSpace ℝ V] in ++omit [NormedAddCommGroup V] [InnerProductSpace ℝ V] in + @[simp] lemma fst_mk (a b : V) : fst ((a, b) : Cx V) = a := rfl +-omit [InnerProductSpace ℝ V] in ++omit [NormedAddCommGroup V] [InnerProductSpace ℝ V] in + @[simp] lemma snd_mk (a b : V) : snd ((a, b) : Cx V) = b := rfl +-omit [InnerProductSpace ℝ V] in ++omit [NormedAddCommGroup V] [InnerProductSpace ℝ V] in + @[ext] lemma ext {p q : Cx V} (h1 : p.fst = q.fst) (h2 : p.snd = q.snd) : p = q := Prod.ext h1 h2 + + omit [InnerProductSpace ℝ V] in +@@ -92,7 +92,7 @@ lemma innerC_self_re (u : Cx V) : + Complex.I_im, Complex.ofReal_im, zero_mul, mul_zero, sub_zero, add_zero] + + /-- The inner product space core on the complexification. -/ +-@[expose] ++@[expose, instance_reducible] + noncomputable def coreC : InnerProductSpace.Core ℂ (Cx V) where + inner := innerC + conj_inner_symm u v := by unfold innerC; simp [Complex.ext_iff, real_inner_comm] +diff --git a/Gromov/Convolution.lean b/Gromov/Convolution.lean +index 42fc819..4754eca 100644 +--- a/Gromov/Convolution.lean ++++ b/Gromov/Convolution.lean +@@ -14,8 +14,6 @@ public import Gromov.TendstoNhdsMul + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + attribute [local implicit_reducible] Additive + + namespace GeneratesNS +@@ -36,7 +34,7 @@ lemma conv_assoc_of_lp2 {f g h: G → ℝ} (hf: MemLp f 2 Measure.count) (hg: Me + funext x + + +- have h_lp_n (n: ℕ): MemLp h n myHaarAddOpp := by ++ have h_lp_n (n: ℕ): MemLp (fun x : Additive G => h x) n myHaarAddOpp := by + apply Continuous.memLp_of_hasCompactSupport (X := Additive G) (μ := myHaarAddOpp) + . apply continuous_of_discreteTopology + . +@@ -48,7 +46,6 @@ lemma conv_assoc_of_lp2 {f g h: G → ℝ} (hf: MemLp f 2 Measure.count) (hg: Me + conv => + lhs + arg 1 +- simp + eta_reduce + rw [MeasureTheory.convolution_assoc (L := ContinuousLinearMap.mul ℝ ℝ) (L₂ := ContinuousLinearMap.mul ℝ ℝ) (L₃ := ContinuousLinearMap.mul ℝ ℝ) (L₄ := ContinuousLinearMap.mul ℝ ℝ)] + . rfl +@@ -96,7 +93,6 @@ lemma conv_assoc_of_lp2 {f g h: G → ℝ} (hf: MemLp f 2 Measure.count) (hg: Me + exact hf + . + unfold MeasureTheory.MemLp +- refine ⟨by apply AEStronglyMeasurable.of_discrete, ?_⟩ + rw [← my_add_haar_eq_count] + grw [ENNReal.eLpNorm_convolution_le_enorm_mul' (p := 2) (q := 1)] + . +@@ -104,17 +100,13 @@ lemma conv_assoc_of_lp2 {f g h: G → ℝ} (hf: MemLp f 2 Measure.count) (hg: Me + apply ENNReal.mul_lt_top + . + simp_rw [← Real.norm_eq_abs] +- rw [MeasureTheory.eLpNorm_norm] +- rw [my_add_haar_eq_count] +- exact MemLp.eLpNorm_lt_top hg ++ have hg' : MemLp (fun x : Additive G => g x) 2 myHaarAddOpp := by ++ rw [my_add_haar_eq_count] ++ exact hg ++ exact hg'.norm.eLpNorm_lt_top + . + simp_rw [← Real.norm_eq_abs] +- rw [MeasureTheory.eLpNorm_norm] +- rw [my_add_haar_eq_count] +- rw [← my_add_haar_eq_count] +- have foo := h_lp_n 1 +- simp at foo +- exact MemLp.eLpNorm_lt_top foo ++ simpa only [Nat.cast_one] using (h_lp_n 1).norm.eLpNorm_lt_top + . simp + . simp + . simp +@@ -132,7 +124,6 @@ lemma conv_assoc {f g h: G → ℝ} (h_fg: ConvExists f g) (h_gh: ConvExists g h + conv => + lhs + arg 1 +- simp + eta_reduce + rw [MeasureTheory.convolution_assoc (L := ContinuousLinearMap.mul ℝ ℝ) (L₂ := ContinuousLinearMap.mul ℝ ℝ) (L₃ := ContinuousLinearMap.mul ℝ ℝ) (L₄ := ContinuousLinearMap.mul ℝ ℝ)] + . rfl +@@ -283,7 +274,6 @@ lemma conv_sum {T: Type*} (H: Finset T) (f: T → G → ℝ) (h: G → ℝ) (h_f + @[expose] + noncomputable def conv_finsupp_lp2 (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))) (g : G → ℝ) (hg : g.support.Finite): (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G))) := MeasureTheory.MemLp.toLp (Conv f g) (by + simp [MemLp] +- refine ⟨by apply AEStronglyMeasurable.of_discrete, ?_⟩ + have norm_bound := ENNReal.eLpNorm_convolution_le_enorm_mul (G := Additive G) (f := f) (g := g) (E' := ℝ) (E := ℝ) (F := ℝ) (𝕜 := ℝ) (p := 2) (q := 1) (r := 2) (μ := myHaarAddOpp) (ContinuousLinearMap.mul ℝ ℝ) + (by simp) (by simp) (by simp) (by simp) (by apply AEMeasurable.of_discrete) (by apply AEMeasurable.of_discrete) + +@@ -298,7 +288,7 @@ noncomputable def conv_finsupp_lp2 (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.vo + . apply WithTop.mul_lt_top + . exact enorm_lt_top + . rw [← my_add_haar_eq_count] +- apply (MeasureTheory.Lp.memLp f).2 ++ apply (MeasureTheory.Lp.memLp f).eLpNorm_lt_top + . + simp [eLpNorm, eLpNorm'] + rw [MeasureTheory.lintegral_count] +diff --git a/Gromov/CutoffInequality.lean b/Gromov/CutoffInequality.lean +index cb8c23e..6f8d0a7 100644 +--- a/Gromov/CutoffInequality.lean ++++ b/Gromov/CutoffInequality.lean +@@ -17,11 +17,6 @@ public import Gromov.ToMathlib.LinearAlgebra.Matrix.Det + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -43,7 +38,6 @@ include hGS + -- `deriv_sq (f ∘ (· * j)) x = deriv_sq f (x * j)`, which is what Lemma 3.25 (c) needs. + @[expose] noncomputable def deriv_sq (f: G → ℝ) (x: G) := ∑ s ∈ S, (f (s * x) - f x)^2 + +-set_option maxHeartbeats 9000000 in + lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.support.Finite): + ∑' (x: G), ∑ s ∈ S, ((f x * φ x) - (f (s * x) * φ (s * x)))^2 ≤ ∑' (x: G), ∑ s ∈ S, (f x)^2 * (φ (s * x) - φ x)^2 := by + +@@ -97,7 +91,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor + simp + rw [← Finset.sum_neg_distrib] + simp_rw [← tsum_neg] +- ring ++ ring_nf + + have double {a b: ℝ} (hab: a = b): a = (a + b) / 2 := by + rw [hab] +@@ -187,7 +181,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor + field_simp + . simp + . +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + apply Set.Finite.inter_of_right +@@ -201,7 +195,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor + . intro x hx + simp + . +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + apply Set.Finite.inter_of_right +@@ -221,7 +215,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor + arg 2 + intro s + rw [Summable.tsum_add (by +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + apply Set.Finite.inter_of_right +@@ -235,7 +229,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor + . intro x hx + simp + ) (by +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + apply Set.Finite.inter_of_right +@@ -269,7 +263,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor + field_simp + rw [← Summable.tsum_finsetSum] + intro s hs +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + apply Set.Finite.inter_of_right +@@ -285,7 +279,7 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor + . simp [S_nonempty] + . + intro s hs +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + apply Set.Finite.inter_of_left +@@ -296,7 +290,6 @@ lemma cutoff_inequality (f φ : G → ℝ) (hf: Laplace_b f = 0) (hφ: φ.suppor + apply Set.Finite.inter_of_right + apply hφ + +-#print axioms cutoff_inequality + + -- TODO - can we make WordNorm.instSemiNormedGroup and use norm notation + +diff --git a/Gromov/Defs.lean b/Gromov/Defs.lean +index 87a78bf..ddaa959 100644 +--- a/Gromov/Defs.lean ++++ b/Gromov/Defs.lean +@@ -15,10 +15,6 @@ structure, `LipschitzH` and the convolution API. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false +-set_option linter.style.whitespace false + + open Subgroup + open scoped Finset +@@ -121,19 +117,15 @@ lemma gAct_mul (g h : G) (f: LipschitzH ): gAct (g * h) f = gAct g (gAct h f) := + rw [← mul_assoc] + + +-@[expose] +-def gAct_const (g: G) (z: ℝ): gAct g (ConstLipschitzH z) = ConstLipschitzH z := by ++theorem gAct_const (g: G) (z: ℝ): gAct g (ConstLipschitzH z) = ConstLipschitzH z := by + unfold gAct + unfold ConstLipschitzH + ext x + simp [DFunLike.coe] + +-#synth Module ℝ (LipschitzH) +-#synth AddCommGroup (LipschitzH) + + abbrev W := (LipschitzH) ⧸ ConstF + +-#synth Module ℝ (W) + + @[expose] + noncomputable def f_n (n: ℕ) (g: G): ℝ := ((1: ℝ) / ((n + 1): ℝ)) * ∑ m: Fin (n + 1), muConv (m.val) g +@@ -276,7 +268,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp + . + intro s hs + apply Summable.mul_left +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + clear foo +@@ -301,7 +293,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp + -- TODO - deduplicate this + intro s hs + apply Summable.mul_left +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + wlog hg: g.support.Finite +@@ -328,7 +320,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp + simp + . + apply Summable.sub +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + . + unfold Function.HasFiniteSupport + simp +@@ -343,7 +335,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp + simp_rw [Finset.mul_sum] + apply summable_sum + intro s hs +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + cases hgf +@@ -366,7 +358,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp + simp_rw [mul_sub] + apply Summable.sub + . +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + cases hgf +@@ -382,7 +374,7 @@ lemma laplace_sum_swap_helper {f g: G → ℝ} (hgf: f.support.Finite ∨ g.supp + apply Set.Finite.inter_of_right + apply hg + . +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + unfold Function.HasFiniteSupport + simp + cases hgf +diff --git a/Gromov/Defs/Convolution.lean b/Gromov/Defs/Convolution.lean +index 46685e4..15d5656 100644 +--- a/Gromov/Defs/Convolution.lean ++++ b/Gromov/Defs/Convolution.lean +@@ -12,10 +12,6 @@ The convolution `Conv`, the measure `mu` and its iterates `muConv`, and the `Lp` + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false +-set_option linter.style.whitespace false + + open Subgroup + open scoped Finset +@@ -62,12 +58,12 @@ abbrev opAdd (g : G) := Additive.ofMul g + lemma conv_eq_sum {f h: G → ℝ} (hconv: ConvExists f h) (g: G): Conv f h g = ∑' (a : Additive G), f (a) * h (g * (Additive.toMul a)⁻¹) := by + unfold Conv + unfold MeasureTheory.convolution +- rw [MeasureTheory.integral_countable'] ++ rw [MeasureTheory.integral_countable] + . + simp_rw [MeasureTheory.measureReal_def] + unfold myHaarAddOpp + simp_rw [MeasureTheory.Measure.addHaar_singleton] +- simp [MeasureTheory.Measure.addHaarMeasure_self] ++ simp + simp_rw [← singleton_carrier] + simp_rw [TopologicalSpace.PositiveCompacts.carrier_eq_coe] + simp [MeasureTheory.Measure.addHaarMeasure_self] +@@ -205,7 +201,6 @@ lemma mu_finsupp: (mu ).support.Finite := by + simp at foo + exact Finset.nonempty_iff_ne_empty.mp foo + +-#print axioms mu_finsupp + + -- Proposition 3.12, item 2, in Vikman + lemma f_conv_mu (f: G → ℝ): (Conv f (mu )) = fun g => ((1 : ℝ) / (#(S) : ℝ)) * ∑ s ∈ S, f (s * g) := by +@@ -257,7 +252,7 @@ lemma f_conv_mu (f: G → ℝ): (Conv f (mu )) = fun g => ((1 : ℝ) / (#(S) : + intro x + rw [Summable.tsum_mul_left (hf := by ( + simp [Pi.single_apply] +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + apply Set.Finite.subset (s := {(opAdd ( x⁻¹ * g ))}) + . simp + . intro z hz +@@ -294,7 +289,7 @@ lemma f_conv_mu (f: G → ℝ): (Conv f (mu )) = fun g => ((1 : ℝ) / (#(S) : + . + -- TODO - deduplicate this + simp [Pi.single_apply] +- apply summable_of_finite_support ++ apply summable_of_hasFiniteSupport + apply Set.Finite.subset (s := {(opAdd (s⁻¹ * g ))}) + . simp + . intro z hz +@@ -312,11 +307,10 @@ lemma f_conv_mu (f: G → ℝ): (Conv f (mu )) = fun g => ((1 : ℝ) / (#(S) : + @[expose] + noncomputable def conv_mu_lp2 (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))): (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G))) := MeasureTheory.MemLp.toLp (Conv f (mu )) (by + rw [MeasureTheory.MemLp] +- refine ⟨MeasureTheory.AEStronglyMeasurable.of_discrete, ?_⟩ + simp [MeasureTheory.eLpNorm, MeasureTheory.eLpNorm'] + rw [f_conv_mu] + simp_rw [Finset.mul_sum] +- have other := MeasureTheory.memLp_finset_sum (μ := MeasureTheory.volume (α := G)) (s := S) (p := 2) (f := fun s a => ((1 : ℝ) / (#(S) : ℝ)) * f (s * a)) (by ++ have other := MeasureTheory.memLp_finsetSum (μ := MeasureTheory.volume (α := G)) (s := S) (p := 2) (f := fun s a => ((1 : ℝ) / (#(S) : ℝ)) * f (s * a)) (by + intro s hs + simp + apply MeasureTheory.MemLp.const_mul +@@ -331,10 +325,11 @@ noncomputable def conv_mu_lp2 (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume + exact mem_f + . apply AEMeasurable.of_discrete + ) +- have sum_norm := other.2 ++ have sum_norm := other.eLpNorm_lt_top + simp [eLpNorm, eLpNorm'] at sum_norm + field_simp at sum_norm + field_simp ++ simp only [AEStronglyMeasurable.of_discrete, ite_true] at sum_norm ⊢ + exact sum_norm + ) + +diff --git a/Gromov/Defs/LipschitzH.lean b/Gromov/Defs/LipschitzH.lean +index c83c23f..89933da 100644 +--- a/Gromov/Defs/LipschitzH.lean ++++ b/Gromov/Defs/LipschitzH.lean +@@ -12,10 +12,6 @@ structure, and finiteness of balls. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false +-set_option linter.style.whitespace false + + open Subgroup + open scoped Finset +@@ -149,7 +145,6 @@ instance lipschitzSMul: SMul ℝ (LipschitzH) := { + rw [mul_eq_mul_left_iff] + left + have hf := f.harmonic x +- unfold Harmonic at hf + simp at hf + field_simp at hf + exact hf +@@ -216,7 +211,6 @@ instance LipschitzH.addMonoid [Generates ] : AddMonoid (LipschitzH) := { + ext g + show (((n + 1 : ℕ) : ℝ) • f).toFun g = (((n : ℕ) : ℝ) • f).toFun g + f.toFun g + simp [lipschitz_smul_tofun] +- push_cast + ring + } + +@@ -231,32 +225,30 @@ instance LipschitzH.instAddCommGroup: AddCommGroup (LipschitzH) := { + sub_eq_add_neg := by + intro f h + ext g +- simp [lipschitz_sub_tofun, lipschitz_add_tofun, lipschitz_neg_tofun] ++ simp [lipschitz_sub_tofun, lipschitz_neg_tofun] + rfl + zsmul := fun n f => (n : ℝ) • f + zsmul_zero' := by + intro f + ext g +- simp only [HSMul.hSMul, SMul.smul, DFunLike.coe, Int.cast_zero, zero_mul] ++ simp only [HSMul.hSMul, SMul.smul, Int.cast_zero, zero_mul] + rfl + neg_add_cancel := by + intro f + ext g +- simp [negLipschitzH] ++ simp + rfl + zsmul_succ' := by + intro n f + ext g + show (((n + 1 : ℕ) : ℝ) • f).toFun g = (((n : ℕ) : ℝ) • f).toFun g + f.toFun g + simp [lipschitz_smul_tofun] +- push_cast + ring + zsmul_neg' := by + intro n hn + ext g + show ((Int.negSucc n : ℝ) • hn).toFun g = -((((n + 1 : ℕ) : ℝ)) • hn).toFun g + simp [lipschitz_smul_tofun] +- push_cast + ring + } + +@@ -309,12 +301,12 @@ instance lipschitzHVectorSpace : Module ℝ (LipschitzH) := { + zero_smul := by + intro a + ext g +- simp [HSMul.hSMul, SMul.smul, DFunLike.coe] ++ simp [HSMul.hSMul, SMul.smul] + } + + lemma finite_ball (x: G) (r: ℝ): Set.Finite (Metric.ball x r) := Set.Finite.of_finite_image (f := fun a => (word_norm_prod_self a).choose) (by + have foo := List.finite_length_le S (WordNorm x + ⌈r⌉₊) +- rw [← Set.finite_coe_iff, Set.coe_setOf] at foo ++ rw [← Set.finite_coe_iff, Set.coe_ofPred] at foo + apply Finite.of_injective (β := {l : List S // l.length ≤ WordNorm x + ⌈r⌉₊}) (fun a => ⟨a.val, by ( + have ha := a.prop + simp [-Subtype.coe_prop] at ha +@@ -349,7 +341,7 @@ lemma finite_ball (x: G) (r: ℝ): Set.Finite (Metric.ball x r) := Set.Finite.of + -- TODO - deduplicate 99% of this with finite_ball + lemma finite_closed_ball (x: G) (r: ℝ): Set.Finite (Metric.closedBall x r) := Set.Finite.of_finite_image (f := fun a => (word_norm_prod_self a).choose) (by + have foo := List.finite_length_le S (WordNorm x + ⌈r⌉₊) +- rw [← Set.finite_coe_iff, Set.coe_setOf] at foo ++ rw [← Set.finite_coe_iff, Set.coe_ofPred] at foo + apply Finite.of_injective (β := {l : List S // l.length ≤ WordNorm x + ⌈r⌉₊}) (fun a => ⟨a.val, by ( + have ha := a.prop + simp [-Subtype.coe_prop] at ha +diff --git a/Gromov/Defs/Measure.lean b/Gromov/Defs/Measure.lean +index 02450ef..2cf42d0 100644 +--- a/Gromov/Defs/Measure.lean ++++ b/Gromov/Defs/Measure.lean +@@ -12,10 +12,6 @@ measure-space instances and the resulting a.e.-triviality lemmas. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false +-set_option linter.style.whitespace false + + open Subgroup + open scoped Finset +@@ -146,7 +142,6 @@ lemma singleton_pairwise_disjoint {T: Type*} (s: Set (T)) : s.PairwiseDisjoint S + + + -- Use the fact that we have the discrete topology +-set_option maxHeartbeats 500000 in + lemma my_add_haar_eq_count: (myHaarAddOpp) = MeasureTheory.Measure.count := by + ext s hs + by_cases s_finite: Set.Finite s +@@ -256,8 +251,7 @@ lemma count_ae_everywhere (p: G → Prop): (∀ᵐ g ∂(MeasureTheory.Measure.c + simp [MeasureTheory.Measure.count_eq_zero_iff] + -- TODO - there has to be a much simpler way of proving this + refine ⟨?_, ?_⟩ +- . intro h +- intro a ++ . intro h a + by_contra this + have a_in: a ∈ {a | ¬ p a} := by + simp [this] +diff --git a/Gromov/Defs/WordMetric.lean b/Gromov/Defs/WordMetric.lean +index 4746cfe..e9393b4 100644 +--- a/Gromov/Defs/WordMetric.lean ++++ b/Gromov/Defs/WordMetric.lean +@@ -13,10 +13,6 @@ instance. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false +-set_option linter.style.whitespace false + + open Subgroup + open scoped Finset +@@ -99,7 +95,7 @@ lemma mem_S_prod_list (x: G): ∃ l: List S, ProdS x l := by + -- https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Group.20.28.2FMonoid.2Fetc.29.20closures.20are.20a.20finite.20product.2Fsum/near/477951441 + have foo := Submonoid.exists_list_of_mem_closure (s := S ∪ S⁻¹) (x := x) + rw [← Subgroup.closure_toSubmonoid _] at foo +- simp only [mem_toSubmonoid, Finset.mem_coe] at foo ++ simp only [mem_toSubmonoid] at foo + specialize foo (mem_closure x) + norm_cast at foo + rw [s_union_sinv] at foo +@@ -123,7 +119,7 @@ lemma word_norm_prod (g: G) (n: ℕ) (hgn: WordNorm g = n): ∃ l: List S, ProdS + unfold ProdS at hl + rw [Set.nonempty_def] at foo + specialize foo ⟨l.length, ⟨l, ⟨by simp, hl⟩⟩⟩ +- simp only [Set.mem_setOf_eq] at foo ++ simp only [Set.mem_ofPred_eq] at foo + obtain ⟨l, ⟨hl, hl_prod⟩⟩ := foo + rw [← hgn] + exact ⟨l, ⟨hl_prod, hl⟩⟩ +@@ -147,7 +143,7 @@ lemma WordDist_self (x: G): WordDist x x = 0 := by + unfold WordDist + rw [mul_inv_cancel] + unfold WordNorm +- simp only [Nat.sInf_eq_zero, Set.mem_setOf_eq, List.length_eq_zero_iff, exists_eq_left] ++ simp only [Nat.sInf_eq_zero, Set.mem_ofPred_eq, List.length_eq_zero_iff, exists_eq_left] + left + rfl + +@@ -228,7 +224,7 @@ lemma word_norm_eq_zero {x y: G} (hdist: WordDist x y = 0): x = y := by + unfold ProdS at hl + have len_in_set: l.unattach.length ∈ (∅ : Set ℕ) := by + rw [← empty_set] +- simp only [List.length_unattach, Set.mem_setOf_eq] ++ simp only [List.length_unattach, Set.mem_ofPred_eq] + use l + refine ⟨rfl, hl⟩ + simp only [Set.mem_empty_iff_false] at len_in_set +@@ -356,7 +352,7 @@ lemma dist_word_le_mul {x y z : G} (hy: y ∈ S): WordDist x z ≤ (WordDist x ( + rw [mul_inv_eq_one] at l_prod + grind + | h::tail => +- use [ ⟨y⁻¹, by simp [hGS.has_inv, hy]⟩, ⟨h.val, by simp [hGS.has_inv]⟩,] ++ tail ++ use [ ⟨y⁻¹, by simp [hGS.has_inv, hy]⟩, ⟨h.val, by simp⟩,] ++ tail + simp [ProdS] + simp [← l_len] + simp [ProdS] at l_prod +diff --git a/Gromov/FormalConjecturesCheck.lean b/Gromov/FormalConjecturesCheck.lean +index 6c8c31e..52e4b65 100644 +--- a/Gromov/FormalConjecturesCheck.lean ++++ b/Gromov/FormalConjecturesCheck.lean +@@ -1,6 +1,7 @@ + module + + public import Gromov.Gromov ++public import Gromov.PolynomialGrowth + + /-! + # Cross-check of `main_gromov_theorem` against the `formal-conjectures` statement +@@ -34,34 +35,32 @@ public section + + set_option linter.style.longLine false + ++@[instance_reducible] ++private noncomputable def generatorsData {G : Type*} (gg : Group G) (de : DecidableEq G) ++ (T : Finset G) (hT : Nonempty T) ++ (hgen : (@Subgroup.closure G gg (T : Set G) : Set G) = Set.univ) ++ (h1 : @OfNat.ofNat G 1 (@One.toOfNat1 G gg.toOne) ∈ T) ++ (hinv : ∀ g ∈ T, @Inv.inv G gg.toInv g ∈ T) ++ (hi : Infinite G) (hp : @HasPolynomialGrowth G gg de T) : Generates := ++ @Generates.mk G gg de T hT hgen h1 hinv hi hp ++ ++private theorem gromovOfGeneratorData {G : Type*} (gg : Group G) (de : DecidableEq G) ++ (T : Finset G) (hT : Nonempty T) ++ (hgen : (@Subgroup.closure G gg (T : Set G) : Set G) = Set.univ) ++ (h1 : @OfNat.ofNat G 1 (@One.toOfNat1 G gg.toOne) ∈ T) ++ (hinv : ∀ g ∈ T, @Inv.inv G gg.toInv g ∈ T) ++ (hi : Infinite G) (hp : @HasPolynomialGrowth G gg de T) : ++ @Group.IsVirtuallyNilpotent G gg := by ++ let inst := generatorsData gg de T hT hgen h1 hinv hi hp ++ obtain ⟨n, hn⟩ := hp ++ exact GeneratesNS.main_gromov_theorem (hGS := inst) n hn ++ + namespace FormalConjecturesCheck + + open scoped Pointwise + + variable {G : Type*} [Group G] + +-/-! ### Definitions copied from `formal-conjectures` -/ +- +-/-- The `CayleyBall` is the ball of radius `n` in the Cayley graph of a group `G` with generating +-set `S`. -/ +-@[expose] +-def CayleyBall (S : Set G) (n : ℕ) : Set G := +- {g : G | ∃ (l : List G), l.length ≤ n ∧ (∀ s ∈ l, s ∈ S ∨ s⁻¹ ∈ S) ∧ l.prod = g} +- +-/-- The `GrowthFunction` of a group `G` with respect to a set `S` counts the number of group +-elements that can be reached by words of length at most `n` in `S`. -/ +-@[expose] +-noncomputable def GrowthFunction (S : Set G) (n : ℕ) : ℕ := +- (CayleyBall S n).ncard +- +-/-- A group has polynomial growth if there exists a finite generating set whose growth function is +-bounded above by a polynomial. -/ +-@[expose] +-def HasPolynomialGrowth (G : Type*) [Group G] : Prop := +- ∃ (S : Set G), Set.Finite S ∧ Subgroup.closure S = ⊤ ∧ +- ∃ (C : ℝ) (d : ℕ), C > 0 ∧ +- ∀ n > 0, (GrowthFunction S n : ℝ) ≤ C * (n : ℝ) ^ d +- + /-! ### Normalizing the generating set -/ + + variable [DecidableEq G] +@@ -145,41 +144,59 @@ lemma card_normGen_pow (S : Set G) (hS : S.Finite) (n : ℕ) : + + /-! ### The forward direction of the reference statement -/ + +-set_option maxHeartbeats 1000000 in ++private lemma normGen_polynomial (S : Set G) (hSfin : S.Finite) (C : ℝ) (d : ℕ) ++ (hbound : ∀ n : ℕ, 0 < n → (GrowthFunction S n : ℝ) ≤ C * (n : ℝ) ^ d) : ++ HasPolynomialGrowthD (normGen S hSfin) d := by ++ refine ⟨⌈C⌉₊, fun n hn => ?_⟩ ++ have hcard : ((normGen S hSfin) ^ n).card = GrowthFunction S n := card_normGen_pow S hSfin n ++ have hb := hbound n (by omega) ++ rw [← hcard] at hb ++ have h : (((normGen S hSfin) ^ n).card : ℝ) ≤ (⌈C⌉₊ : ℝ) * (n : ℝ) ^ d := ++ hb.trans (by gcongr; exact Nat.le_ceil C) ++ exact_mod_cast h ++ ++private lemma normGen_generates (S : Set G) (hSfin : S.Finite) ++ (hSgen : Subgroup.closure S = ⊤) : ++ (Subgroup.closure (normGen S hSfin : Set G) : Set G) = ⊤ := by ++ have hclosure : Subgroup.closure ((normGen S hSfin : Finset G) : Set G) = ⊤ := by ++ rw [eq_top_iff, ← hSgen] ++ exact Subgroup.closure_mono (subset_normGen S hSfin) ++ rw [hclosure] ++ rfl ++ ++private theorem normalized_data (S : Set G) (hSfin : S.Finite) ++ (hSgen : Subgroup.closure S = ⊤) (C : ℝ) (d : ℕ) ++ (hbound : ∀ n : ℕ, 0 < n → (GrowthFunction S n : ℝ) ≤ C * (n : ℝ) ^ d) : ++ ∃ T : Finset G, Nonempty T ∧ ++ (Subgroup.closure (T : Set G) : Set G) = Set.univ ∧ ++ (1 : G) ∈ T ∧ (∀ g ∈ T, g⁻¹ ∈ T) ∧ _root_.HasPolynomialGrowth T := by ++ refine ⟨normGen S hSfin, ⟨⟨1, one_mem_normGen S hSfin⟩⟩, ++ normGen_generates S hSfin hSgen, one_mem_normGen S hSfin, ++ fun _ hg => inv_mem_normGen S hSfin hg, d, ?_⟩ ++ exact normGen_polynomial S hSfin C d hbound ++ ++omit [Group G] [DecidableEq G] in ++private theorem infinite_forward (gg : Group G) (de : DecidableEq G) (S : Set G) ++ (hSfin : S.Finite) (hSgen : @Subgroup.closure G gg S = ⊤) (hinf : Infinite G) ++ (C : ℝ) (d : ℕ) ++ (hbound : ∀ n : ℕ, 0 < n → (@GrowthFunction G gg S n : ℝ) ≤ C * (n : ℝ) ^ d) : ++ @Group.IsVirtuallyNilpotent G gg := by ++ obtain ⟨T, hT, hgen, h1, hinv, hp⟩ := @normalized_data G gg de S hSfin hSgen C d hbound ++ exact @gromovOfGeneratorData G gg de T hT hgen h1 hinv hinf hp ++ ++omit [Group G] [DecidableEq G] in + /-- **The forward direction of `GromovPolynomialGrowth.GromovPolynomialGrowthTheorem`**, derived + from `GeneratesNS.main_gromov_theorem`: a finitely generated group of polynomial growth (in the + `formal-conjectures` formulation) is virtually nilpotent. -/ +-theorem gromov_forward (G : Type*) [Group G] (h : HasPolynomialGrowth G) : ++theorem gromov_forward (G : Type*) [gg : Group G] (h : @HasPolynomialGrowth G gg) : + Group.IsVirtuallyNilpotent G := by + classical +- letI dec : DecidableEq G := Classical.decEq G + obtain ⟨S, hSfin, hSgen, C, d, hC, hbound⟩ := h + rcases finite_or_infinite G with hfin | hinf + · exact GeneratesNS.finite_virtually_nilpotent +- · have hclosure : Subgroup.closure ((normGen S hSfin : Finset G) : Set G) = ⊤ := by +- rw [eq_top_iff, ← hSgen] +- exact Subgroup.closure_mono (subset_normGen S hSfin) +- have hgrowth : HasPolynomialGrowthD (normGen S hSfin) d := by +- refine ⟨⌈C⌉₊, fun n hn => ?_⟩ +- have hcard : ((normGen S hSfin) ^ n).card = GrowthFunction S n := card_normGen_pow S hSfin n +- have hb := hbound n (by omega) +- rw [← hcard] at hb +- have : (((normGen S hSfin) ^ n).card : ℝ) ≤ (⌈C⌉₊ : ℝ) * (n : ℝ) ^ d := +- hb.trans (by gcongr; exact Nat.le_ceil C) +- exact_mod_cast this +- letI inst : Generates := +- { G := G +- g_group := ‹Group G› +- g_eq := dec +- S := normGen S hSfin +- hS := ⟨⟨1, one_mem_normGen S hSfin⟩⟩ +- generates := by rw [hclosure]; simp +- one_mem := one_mem_normGen S hSfin +- has_inv := fun _ hg => inv_mem_normGen S hSfin hg +- g_infinite := hinf +- g_growth := ⟨d, hgrowth⟩ } +- exact GeneratesNS.main_gromov_theorem (hGS := inst) d hgrowth ++ · exact infinite_forward gg (inferInstance : DecidableEq G) S hSfin hSgen hinf C d hbound + ++omit [Group G] [DecidableEq G] in + /-- The forward direction with the reference statement's exact signature, including the + `[Group.FG G]` hypothesis. That hypothesis is redundant here: `HasPolynomialGrowth G` already + supplies a finite generating set, so `gromov_forward` proves the same conclusion without it. -/ +diff --git a/Gromov/Gromov.lean b/Gromov/Gromov.lean +index 985ce00..bfc3ce3 100644 +--- a/Gromov/Gromov.lean ++++ b/Gromov/Gromov.lean +@@ -14,7 +14,6 @@ public section + + set_option linter.style.longLine false + set_option linter.style.cdot false +-set_option linter.style.commandStart false + + open Subgroup + open scoped Finset +@@ -29,9 +28,7 @@ include hGS + + open scoped RealInnerProductSpace + +-set_option synthInstance.maxHeartbeats 500000 + +-set_option maxHeartbeats 1000000 + + open MeasureTheory + +@@ -39,12 +36,445 @@ open Additive + + attribute [local implicit_reducible] Additive Multiplicative + +-set_option maxHeartbeats 2500000 in ++private def kernelInclusion (data : Theorem3_1_Input G) : ++ Multiplicative data.φ.ker →* data.G' := ++ AddMonoidHom.toMultiplicativeLeft data.φ.ker.subtype ++ ++private def kernelValue (data : Theorem3_1_Input G) ++ (N : Subgroup (Multiplicative data.φ.ker)) : N →* data.G' := ++ (AddMonoidHom.toMultiplicativeLeft data.φ.ker.subtype).comp N.subtype ++ ++private lemma conjugate_product_wordNorm (x y : G) (Lx Ly a b k : ℕ) ++ (hx : WordNorm x ≤ Lx) (hy : WordNorm y ≤ Ly) ++ (hk : 0 < k) (hb : 0 < b) (s : Finset (Finset.Ico a b)) : ++ WordNorm ((s.toList.map (fun i => y ^ (k * i.val) * x * ++ (y ^ (k * i.val))⁻¹)).prod) ≤ (b-a) * (max Lx Ly * (4*k*b)) := by ++ have hterm (i : Finset.Ico a b) : ++ WordNorm (y ^ (k*i.val) * x * (y ^ (k*i.val))⁻¹) ≤ ++ max Lx Ly * (4*k*b) := by ++ have hp : WordNorm (y ^ (k*i.val)) ≤ k*b*max Lx Ly := by ++ calc ++ _ ≤ (k*i.val) * WordNorm y := word_norm_pow _ _ ++ _ ≤ (k*b) * max Lx Ly := by gcongr; exact le_of_lt (Finset.mem_Ico.mp i.property).2; exact hy.trans (le_max_right _ _) ++ have h1 := word_norm_mul_le (hGS := hGS) (y ^ (k*i.val) * x) ((y ^ (k*i.val))⁻¹) ++ have h2 := word_norm_mul_le (hGS := hGS) (y ^ (k*i.val)) x ++ rw [← word_norm_inv (hGS := hGS)] at h1 ++ have hx' := hx.trans (le_max_left Lx Ly) ++ have hkb : 1 ≤ k*b := one_le_mul (by omega) (by omega) ++ have hM := Nat.mul_le_mul_left (max Lx Ly) hkb ++ nlinarith ++ calc ++ _ ≤ ((s.toList.map (fun i => y ^ (k*i.val) * x * ++ (y ^ (k*i.val))⁻¹)).map WordNorm).sum := word_norm_list_prod_le _ ++ _ ≤ (s.toList.map (fun _ => max Lx Ly * (4*k*b))).sum := by ++ rw [List.map_map] ++ exact List.sum_le_sum (fun i _ => hterm i) ++ _ = s.card * (max Lx Ly * (4*k*b)) := by simp ++ _ ≤ (b-a) * (max Lx Ly * (4*k*b)) := by ++ apply Nat.mul_le_mul_right ++ simpa using Finset.card_le_univ s ++ ++private lemma conjugate_subproducts_growth (data : Theorem3_1_Input G) ++ (N' : Subgroup (Multiplicative data.φ.ker)) (γ : Additive data.G') ++ (hγ : data.φ γ = 1) (gamma_conj_N' : MulAut N') ++ (conj_mem_ker : ∀ (n : ℕ) (g : N'), ++ Additive.ofMul (Additive.toMul γ ^ n * kernelValue data N' g * ++ (Additive.toMul γ ^ n)⁻¹) ∈ data.φ.ker) ++ (conj_mem_N' : ∀ (n : ℕ) (g : N'), ++ (Multiplicative.ofAdd (⟨Additive.ofMul (Additive.toMul γ ^ n * kernelValue data N' g * ++ (Additive.toMul γ ^ n)⁻¹), conj_mem_ker n g⟩ : data.φ.ker)) ∈ N') ++ (gamma_conj_iter : ∀ (n : ℕ) (g : N'), gamma_conj_N'^[n] g = ++ ⟨Multiplicative.ofAdd (⟨Additive.ofMul (Additive.toMul γ ^ n * kernelValue data N' g * ++ (Additive.toMul γ ^ n)⁻¹), conj_mem_ker n g⟩ : data.φ.ker), conj_mem_N' n g⟩) : ++∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → ((Finset.image (fun x ↦ (List.map (fun (i: Finset.Ico a b) ↦ (gamma_conj_N')^[k * ↑i] g) x.toList).prod)) ++ (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q := by ++ let N'_val := kernelValue data N' ++ ++ ++ have s_poly := hGS.g_growth ++ unfold HasPolynomialGrowth at s_poly ++ obtain ⟨q, hq⟩ := s_poly ++ unfold HasPolynomialGrowthD at hq ++ obtain ⟨p, hp⟩ := hq ++ intro k k_pos x ++ ++ ++ obtain ⟨x_list, x_prod, x_list_prod⟩ := ++ word_norm_prod_self (hGS := hGS) x.val.toAdd.val.toMul.val ++ obtain ⟨gamma_list, gamma_prod, gamma_list_prod⟩ := ++ word_norm_prod_self (hGS := hGS) (Additive.toMul γ).val ++ ++ ++ -- `(hGS := hGS)` is required: `new_generates` shadows the ambient instance here, ++ -- so a bare `S` would resolve to `new_generates.S`. ++ have p_pos: 0 < p := growth_const_pos (hGS := hGS) hp ++ ++ have q_pos: 0 < q := growth_exponent_pos (hGS := hGS) ⟨p, hp⟩ ++ use p * (((max x_list.length gamma_list.length) * (4 * k)) ^ q) ++ use q ++ ++ ++ have gamma_len_pos: 1 ≤ gamma_list.length := by ++ by_contra! ++ simp at this ++ simp [ProdS, this] at gamma_prod ++ have gamma_eq: γ = 0 := by ++ have gamma_coe := Subtype.coe_eq_of_eq_mk gamma_prod.symm ++ apply_fun (fun a => Additive.ofMul a) at gamma_coe ++ rw [ofMul_toMul] at gamma_coe ++ exact gamma_coe ++ simp [gamma_eq] at hγ ++ ++ refine ⟨?_, ?_⟩ ++ . ++ apply mul_pos ++ . exact p_pos ++ . ++ rw [pow_pos_iff] ++ . ++ positivity ++ . grind ++ ++ ++ intro b hb a ha hab ++ ++ have mul_nozero: 1 ≤ 2 * k * b := by ++ rw [mul_assoc] ++ apply one_le_mul ++ . simp ++ . apply one_le_mul ++ . grind ++ . grind ++ ++ ++ grw [← Finset.card_image_of_injOn (f := fun a => a.val.toAdd.val.toMul.val) (by simp)] ++ grw [Finset.card_le_card (t := hGS.S^((b - a) * ((max x_list.length gamma_list.length) * (4 * k * b)) ))] ++ · ++ ++ grw [hp] ++ . ++ rw [mul_pow] ++ ring_nf ++ simp ++ . ++ simp ++ apply one_le_mul ++ . grind ++ . ++ rw [Nat.one_le_iff_ne_zero, ← Nat.pos_iff_ne_zero] ++ ++ ++ positivity ++ -- side goal from `card_le_card`: the image is contained in `hGS.S` ++ · ++ let f : N' →* G := data.G'.subtype.comp (kernelValue data N') ++ have hf (n : ℕ) (g : N') : f (gamma_conj_N'^[n] g) = ++ (Additive.toMul γ).val ^ n * f g * ((Additive.toMul γ).val ^ n)⁻¹ := by ++ rw [gamma_conj_iter] ++ rfl ++ intro g hg ++ obtain ⟨z, hz, rfl⟩ := Finset.mem_image.mp hg ++ obtain ⟨s, hs, rfl⟩ := Finset.mem_image.mp hz ++ change f ((s.toList.map (fun i : Finset.Ico a b => gamma_conj_N'^[k*i.val] x)).prod) ∈ _ ++ rw [map_list_prod, List.map_map] ++ simp only [Function.comp_def] ++ simp_rw [hf] ++ rw [← closed_ball_eq_S_pow (hGS := hGS)] ++ simp only [Set.Finite.mem_toFinset, Metric.mem_closedBall, dist, WordDist_one] ++ norm_cast ++ exact conjugate_product_wordNorm (hGS := hGS) (f x) (Additive.toMul γ).val ++ x_list.length gamma_list.length a b k ++ (by change WordNorm x.val.toAdd.val.toMul.val ≤ _; rw [← x_list_prod]) ++ (by rw [← gamma_list_prod]) k_pos hb s ++ ++ ++ ++omit hGS in ++private lemma cyclic_kernel_sup {D : Type*} [Group D] ++ (φ : Additive D →+ ℤ) (γ : Additive D) (hγ : φ γ = 1) : ++ Subgroup.closure {γ.toMul} ⊔ φ.ker.toSubgroup' = ⊤ := by ++ apply top_unique ++ intro g _ ++ let z := φ (Additive.ofMul g) ++ have hk : Additive.toMul (-(z • γ) + Additive.ofMul g) ∈ φ.ker.toSubgroup' := by ++ change φ (-(z • γ) + Additive.ofMul g) = 0 ++ simp [z, hγ] ++ have ht : Additive.toMul (z • γ) ∈ Subgroup.closure {γ.toMul} := by ++ rw [Subgroup.mem_closure_singleton] ++ exact ⟨z, by simp⟩ ++ have he : g = Additive.toMul (z • γ) * ++ Additive.toMul (-(z • γ) + Additive.ofMul g) := by ++ rw [← toMul_add, add_neg_cancel_left] ++ rfl ++ rw [he] ++ exact Subgroup.mul_mem _ (Subgroup.mem_sup_left ht) (Subgroup.mem_sup_right hk) ++ ++private lemma cyclic_kernel_finiteIndex (data : Theorem3_1_Input G) ++ (γ : Additive data.G') (hγ : data.φ γ = 1) ++ (N' : Subgroup (Multiplicative data.φ.ker)) [N'.FiniteIndex] ++ (N'_fg : ∃ T : Finset (Multiplicative data.φ.ker), Subgroup.closure (↑T) = N') (α : ℕ) (alpha_nonzero : α ≠ 0) ++ (hinv : ∀ {n : ℕ}, ∀ b ∈ Subgroup.closure {γ.toMul ^ n}, ++ ∀ a ∈ Subgroup.map (kernelInclusion data) (Subgroup.closure (↑N'_fg.choose)), ++ b * a * b⁻¹ ∈ Subgroup.map (kernelInclusion data) (Subgroup.closure (↑N'_fg.choose))) : ++ (Subgroup.map data.G'.subtype ++ (Subgroup.closure (↑(Finset.image (kernelInclusion data) N'_fg.choose) ∪ ++ {γ.toMul ^ α}))).FiniteIndex := by ++ let new_N'_map := kernelInclusion data ++ have map_N'_invariant_gamma {n : ℕ} := hinv (n := n) ++ have map_N'_invariant_gamma_one := map_N'_invariant_gamma (n := 1) ++ simp only [pow_one] at map_N'_invariant_gamma_one ++ rw [Subgroup.finiteIndex_iff] ++ rw [Subgroup.index_map] ++ simp ++ refine ⟨?_, ?_⟩ ++ . ++ ++ simp_rw [Set.insert_eq] ++ ++ have gamma_alpha_le_gamma: (Subgroup.closure ({toMul γ ^ α} ∪ (new_N'_map '' (N'_fg.choose)) )) ≤ (Subgroup.closure ({toMul γ} ∪ (new_N'_map '' (N'_fg.choose)))) := by ++ simp ++ intro g hg ++ rw [Set.insert_eq] ++ cases hg ++ . rename_i g_eq_gamma ++ rw [Subgroup.closure_union] ++ apply Subgroup.mem_sup_left ++ rw [Subgroup.mem_closure_singleton] ++ use α ++ rw [g_eq_gamma] ++ simp ++ . rename_i g_mem_map ++ rw [Subgroup.closure_union] ++ apply Subgroup.mem_sup_right ++ apply Subgroup.mem_closure_of_mem ++ exact g_mem_map ++ ++ conv => ++ arg 1 ++ arg 1 ++ arg 1 ++ arg 1 ++ arg 2 ++ equals (new_N'_map '' (N'_fg.choose)) => rfl ++ rw [← Subgroup.relIndex_mul_index gamma_alpha_le_gamma] ++ simp ++ refine ⟨?_, ?_⟩ ++ . ++ unfold Subgroup.relIndex ++ rw [← ne_eq] ++ rw [← Subgroup.finiteIndex_iff] ++ apply Subgroup.finiteIndex_of_rightCoset_cover_const (s := Finset.Ioo (-α : ℤ) (α)) (g := fun a => ⟨a • γ, (by ++ rw [Set.insert_eq, Subgroup.closure_union] ++ apply Subgroup.mem_sup_left ++ rw [Subgroup.mem_closure_singleton] ++ use a ++ rfl ++ )⟩) ++ ext g ++ simp ++ have g_prop := g.property ++ simp_rw [Set.insert_eq, Subgroup.closure_union] at g_prop ++ rw [← MonoidHom.map_closure] at g_prop ++ simp at g_prop ++ rw [← SetLike.mem_coe] at g_prop ++ rw [sup_comm] at g_prop ++ ++ ++ rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ ++ (Subgroup.le_normalizer_of_conj_mem map_N'_invariant_gamma_one)] at g_prop ++ rw [Set.mem_mul] at g_prop ++ obtain ⟨b, hb, a, ha, g_eq⟩ := g_prop ++ simp at ha ++ rw [Subgroup.mem_closure_singleton] at ha ++ obtain ⟨z, hz⟩ := ha ++ use z % α ++ refine ⟨?_, ?_⟩ ++ . ++ have foo := Int.emod_lt_abs z (b := α) (by grind) ++ rw [lt_abs] at foo ++ refine ⟨?_, ?_⟩ ++ . ++ have bar := Int.emod_nonneg z (b := α) (by simpa using alpha_nonzero) ++ grind ++ . grind ++ . ++ rw [Set.mem_smul_set] ++ use ⟨(Additive.ofMul b) + (((α : ℤ) * (z / (α : ℤ))) • γ), ?_⟩ ++ . ++ refine ⟨?_, ?_⟩ ++ . ++ simp ++ rw [Subgroup.mem_subgroupOf] ++ simp_rw [Set.insert_eq, Subgroup.closure_union] ++ rw [← SetLike.mem_coe] ++ rw [sup_comm] ++ rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by ++ simp_rw [← MonoidHom.map_closure] ++ apply map_N'_invariant_gamma ++ ))] ++ apply Set.mul_mem_mul ++ . ++ simp ++ rw [← MonoidHom.map_closure] ++ exact hb ++ . ++ simp ++ rw [Subgroup.mem_closure_singleton] ++ use (z / (α : ℤ)) ++ conv => ++ lhs ++ arg 1 ++ equals toMul γ ^ (α : ℤ) => ++ simp ++ ++ rw [← zpow_mul] ++ . ++ simp ++ rw [Subtype.ext_iff] ++ simp ++ rw [← g_eq, ←hz] ++ nth_rw 3 [← Int.mul_ediv_add_emod (a := z) (b := α)] ++ rw [← toMul_zsmul] ++ conv => ++ lhs ++ equals (ofMul b) + ((↑α * (z / ↑α)) • γ) + ((z % ↑α) • γ) => ++ rfl ++ ++ ++ rw [add_zsmul] ++ rw [add_assoc] ++ rfl ++ . ++ simp_rw [Set.insert_eq, Subgroup.closure_union] ++ rw [sup_comm] ++ rw [← SetLike.mem_coe] ++ ++ rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by ++ simp_rw [← MonoidHom.map_closure] ++ apply map_N'_invariant_gamma_one ++ ))] ++ apply Set.mul_mem_mul ++ . ++ simp ++ rw [← MonoidHom.map_closure] ++ exact hb ++ . ++ simp [Subgroup.mem_closure_singleton] ++ . ++ obtain ⟨s, s_compl, s_cosets⟩ := Subgroup.exists_leftTransversal_of_FiniteIndex (D := N') (H := ⊤) (by simp) ++ simp at s_cosets ++ ++ rw [← ne_eq] ++ rw [← Subgroup.finiteIndex_iff] ++ apply Subgroup.finiteIndex_of_leftCoset_cover_const (s := s) (g := fun g => g.val.val.toMul) ++ simp_rw [Set.insert_eq, Subgroup.closure_union] ++ rename_bvar i → g ++ ++ ++ conv => ++ arg 1 ++ arg 1 ++ intro i ++ arg 1 ++ intro hi ++ rw [sup_comm] ++ rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by ++ intro gamma_pow h_gamma_pow n hn ++ simp_rw [← MonoidHom.map_closure] at hn ++ simp_rw [← MonoidHom.map_closure] ++ apply map_N'_invariant_gamma_one _ h_gamma_pow _ hn ++ ))] ++ rw [set_smul_eq_mul] ++ rw [← mul_assoc] ++ rw [← set_smul_eq_mul] ++ ++ ++ simp_rw [← Set.iUnion_mul] ++ conv => ++ arg 1 ++ arg 1 ++ equals Additive.toMul '' data.φ.ker => ++ apply_fun (fun s => Additive.toMul '' (Subtype.val '' s)) at s_cosets ++ conv at s_cosets => ++ rhs ++ equals Additive.toMul '' data.φ.ker => ++ ext a ++ simp ++ rw [← s_cosets] ++ conv => ++ arg 1 ++ arg 1 ++ intro i ++ arg 1 ++ intro hi ++ arg 2 ++ ++ simp_rw [← MonoidHom.map_closure] ++ ++ simp only [Set.image_image] ++ erw [Set.image_iUnion₂] ++ apply Set.iUnion_congr ++ intro i ++ apply Set.iUnion_congr ++ intro hi ++ ext z ++ simp only [coe_map] ++ rw [Set.mem_smul_set] ++ rw [Set.mem_image] ++ refine ⟨?_, ?_⟩ ++ . ++ intro hy ++ obtain ⟨a, ha⟩ := hy ++ have foo := ha.1 ++ rw [Set.mem_image] at foo ++ obtain ⟨b, b_mem, a_eq_b⟩ := foo ++ have N'_gen := N'_fg.choose_spec ++ rw [N'_gen] at b_mem ++ refine ⟨(↑i : Multiplicative ↥data.φ.ker) • b, Set.smul_mem_smul_set b_mem, ?_⟩ ++ rw [← ha.2, ← a_eq_b] ++ rfl ++ . ++ intro hx ++ obtain ⟨x, hx, x_eq⟩ := hx ++ erw [Set.mem_smul_set] at hx ++ obtain ⟨n, hn, x_eq_n⟩ := hx ++ refine ⟨new_N'_map n, ?_, ?_⟩ ++ . ++ rw [Set.mem_image] ++ have N'_gen := N'_fg.choose_spec ++ rw [← N'_gen] at hn ++ exact ⟨n, hn, rfl⟩ ++ . rw [← x_eq, ← x_eq_n] ++ rfl ++ ++ ++ conv => ++ arg 1 ++ lhs ++ equals ↑data.φ.ker.toSubgroup' => ++ ext a ++ simp ++ ++ rw [← Subgroup.coe_mul_of_right_le_normalizer_left _ _] ++ . ++ simpa [sup_comm] using cyclic_kernel_sup data.φ γ hγ ++ . ++ apply Subgroup.le_normalizer_of_conj_mem ++ intro b hb a ha ++ rw [Subgroup.mem_closure_singleton] at hb ++ obtain ⟨n, b_eq⟩ := hb ++ simp [← b_eq] ++ simp at ha ++ exact ha ++ . have foo := data.finite_index ++ rw [Subgroup.finiteIndex_iff] at foo ++ exact foo ++ + omit hGS in + lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) (hd: 1 ≤ d) (h_growth: HasPolynomialGrowthD S d) + (inductive_gromov: ∀ (Q_generates: Generates.{u}),(Q_growth : (HasPolynomialGrowthD (Q_generates.S)) (d - 1)) → Group.IsVirtuallyNilpotent Q_generates.G) + : Group.IsVirtuallyNilpotent G := by +- letI inst_dec_G : DecidableEq G := G_dec_eq ++ let inst_dec_G : DecidableEq G := G_dec_eq + + have G'_finite_index := data.finite_index + have G'_fg: Group.FG data.G' := by +@@ -224,14 +654,7 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( + let N' := Subgroup.closure (Set.range (fun (a: Multiplicative data.φ.ker) => a ^ N.index)) + + +- let new_N'_map : _ →* _ := { +- toFun := fun (g: (Multiplicative ↥data.φ.ker)) => Additive.toMul (data.φ.ker.subtype g) +- map_one' := rfl +- map_mul' := by +- intro x y +- rfl +- } +- ++ let new_N'_map := kernelInclusion (hGS := hGS) data + + let new_N': Subgroup (data.G') := Subgroup.map new_N'_map N' + +@@ -357,8 +780,7 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( + -- The underlying element of `data.G'` of an element of `N'`, with every `Additive` / + -- `Multiplicative` conversion spelled out instead of relying on definitional unfolding: + -- `↥N' → Multiplicative ↥data.φ.ker → ↥data.φ.ker → Additive ↥data.G' → ↥data.G'`. +- let N'_val : ↥N' →* ↥data.G' := +- (AddMonoidHom.toMultiplicativeLeft data.φ.ker.subtype).comp N'.subtype ++ let N'_val : ↥N' →* ↥data.G' := kernelValue (hGS := hGS) data N' + + have gamma_conj_ker_apply: ∀ a: ↥data.φ.ker, + data.φ.ker.subtype (gamma_conj_ker a) = γ + data.φ.ker.subtype a + -γ := by +@@ -369,11 +791,10 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( + have gamma_conj_step: ∀ g: ↥N', + N'_val (gamma_conj_N' g) = Additive.toMul γ * N'_val g * (Additive.toMul γ)⁻¹ := by + intro g +- simp only [N'_val, gamma_conj_N', gamma_conj_ker_mul, MonoidHom.coe_comp, Function.comp_apply, ++ simp only [N'_val, kernelValue, gamma_conj_N', gamma_conj_ker_mul, MonoidHom.coe_comp, Function.comp_apply, + AddMonoidHom.coe_toMultiplicativeLeft, Subgroup.coe_subtype, + MulAut.characteristic_apply_apply_coe, AddEquiv.toMultiplicative_apply_apply, +- AddEquiv.toAddMonoidHom_eq_coe, AddMonoidHom.toMultiplicative_apply_apply, +- AddMonoidHom.coe_coe, toAdd_ofAdd, gamma_conj_ker_apply, toMul_add, toMul_neg] ++ toAdd_ofAdd, gamma_conj_ker_apply, toMul_add, toMul_neg] + + have gamma_conj_iter_val: ∀ (n: ℕ), ∀ g: ↥N', + N'_val (gamma_conj_N'^[n] g) +@@ -424,146 +845,8 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( + intro n g + exact Subtype.ext (conj_val_eq n g).symm + +- have gamma_conj_card: ∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → ((Finset.image (fun x ↦ (List.map (fun (i: Finset.Ico a b) ↦ (gamma_conj_N')^[k * ↑i] g) x.toList).prod)) +- (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q := by +- +- have s_poly := hGS.g_growth +- unfold HasPolynomialGrowth at s_poly +- obtain ⟨q, hq⟩ := s_poly +- unfold HasPolynomialGrowthD at hq +- obtain ⟨p, hp⟩ := hq +- intro k k_pos x +- +- +- obtain ⟨x_list, x_prod, x_list_prod⟩ := +- word_norm_prod_self (hGS := hGS) x.val.toAdd.val.toMul.val +- obtain ⟨gamma_list, gamma_prod, gamma_list_prod⟩ := +- word_norm_prod_self (hGS := hGS) (Additive.toMul γ).val +- +- +- -- `(hGS := hGS)` is required: `new_generates` shadows the ambient instance here, +- -- so a bare `S` would resolve to `new_generates.S`. +- have p_pos: 0 < p := growth_const_pos (hGS := hGS) hp +- +- have q_pos: 0 < q := growth_exponent_pos (hGS := hGS) ⟨p, hp⟩ +- use p * (((max x_list.length gamma_list.length) * (4 * k)) ^ q) +- use q +- +- +- have gamma_len_pos: 1 ≤ gamma_list.length := by +- by_contra! +- simp at this +- simp [ProdS, this] at gamma_prod +- have gamma_eq: γ = 0 := by +- have gamma_coe := Subtype.coe_eq_of_eq_mk gamma_prod.symm +- apply_fun (fun a => Additive.ofMul a) at gamma_coe +- rw [ofMul_toMul] at gamma_coe +- exact gamma_coe +- simp [gamma_eq] at hγ +- +- refine ⟨?_, ?_⟩ +- . +- apply mul_pos +- . exact p_pos +- . +- rw [pow_pos_iff] +- . +- positivity +- . grind +- +- +- intro b hb +- intro a ha hab +- +- have mul_nozero: 1 ≤ 2 * k * b := by +- rw [mul_assoc] +- apply one_le_mul +- . simp +- . apply one_le_mul +- . grind +- . grind +- +- +- grw [← Finset.card_image_of_injOn (f := fun a => a.val.toAdd.val.toMul.val) (by simp)] +- grw [Finset.card_le_card (t := hGS.S^((b - a) * ((max x_list.length gamma_list.length) * (4 * k * b)) ))] +- · +- +- grw [hp] +- . +- rw [mul_pow] +- ring +- simp +- . +- simp +- apply one_le_mul +- . grind +- . +- rw [Nat.one_le_iff_ne_zero, ← Nat.pos_iff_ne_zero] +- +- +- positivity +- -- side goal from `card_le_card`: the image is contained in `hGS.S` +- · +- intro g hg +- simp at hg +- obtain ⟨s, hs, g_eq⟩ := hg +- simp [ProdS] at x_prod +- simp [ProdS] at gamma_prod +- rw [eq_comm] at x_prod +- rw [eq_comm] at gamma_prod +- have gamma_eq := Subtype.coe_eq_of_eq_mk gamma_prod +- apply_fun (fun a => Additive.ofMul a) at gamma_eq +- rw [ofMul_toMul] at gamma_eq +- +- have x_eq := Subtype.coe_eq_of_eq_mk x_prod +- apply_fun (fun a => Additive.ofMul a) at x_eq +- rw [ofMul_toMul] at x_eq +- have x_eq := Subtype.coe_eq_of_eq_mk x_eq +- apply_fun (fun a => Multiplicative.ofAdd a) at x_eq +- rw [ofAdd_toAdd] at x_eq +- have x_eq := Subtype.coe_eq_of_eq_mk x_eq +- simp_rw [x_eq] at g_eq +- simp_rw [gamma_conj_iter] at g_eq +- simp at g_eq +- simp_rw [gamma_eq] at g_eq +- rw [← g_eq] +- rw [← closed_ball_eq_S_pow (hGS := hGS)] +- simp [-le_sup_iff] +- simp only [dist, WordDist_one] +- norm_cast +- simp_rw [Function.comp_def] +- simp [-le_sup_iff] +- grw [word_norm_list_prod_le (hGS := hGS)] +- rw [List.unattach.eq_def (l := s.toList)] +- nth_rw 2 [List.map_map] +- grw [List.sum_le_sum (g := Function.const _ ((max x_list.length gamma_list.length) * (4 * k * b)))] +- . +- simp [-le_sup_iff] +- grw [Finset.card_le_univ] +- simp +- . +- intro y hy +- simp at hy +- obtain ⟨m, ⟨⟨m_range, m_mem⟩, y_eq⟩⟩ := hy +- rw [← y_eq] +- grw [word_norm_mul_le (hGS := hGS)] +- grw [word_norm_mul_le (hGS := hGS)] +- rw [← word_norm_inv (hGS := hGS)] +- grw [word_norm_pow (hGS := hGS)] +- rw [← gamma_prod, ← gamma_list_prod] +- simp [N'_val] +- rw [← x_prod, ← x_list_prod] +- grw [m_range.2] +- ring +- have four_eq: 4 = (2 + 2) := by norm_num +- rw [four_eq, mul_add] +- apply add_le_add +- . simp +- grw [le_max_right (b := gamma_list.length)] +- . grw [← le_max_left (a := x_list.length)] +- ring +- nlinarith +- ++ have gamma_conj_card := conjugate_subproducts_growth (hGS := hGS) data N' γ hγ ++ gamma_conj_N' conj_mem_ker conj_mem_N' gamma_conj_iter + + obtain ⟨α, m, alpha_nonzero, alpha_is_unipotent_conj⟩ := exists_gamma_n_unipotent_N' (N' := N') N'_nilpotent N'_fg gamma_conj_N' gamma_conj_card 1 (by simp) + simp_rw [mul_one] at alpha_is_unipotent_conj +@@ -608,7 +891,7 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( + } + + +- haveI : Subgroup.Characteristic N' := N'_char ++ have : Subgroup.Characteristic N' := N'_char + have alpha_nilpotent := unipotent_commutator_trivial (G := data.G') (H := data.φ.ker.toSubgroup') (N' := N') (N'_char := N'_char) (N'_nilpotent := by + exact N'_nilpotent + ) (γ.toMul^α) (by +@@ -680,300 +963,9 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( + . + exact alpha_nilpotent + . +- rw [Subgroup.finiteIndex_iff] +- rw [Subgroup.index_map] +- simp +- refine ⟨?_, ?_⟩ +- . +- +- simp_rw [Set.insert_eq] ++ exact cyclic_kernel_finiteIndex (hGS := hGS) data γ hγ N' N'_fg α alpha_nonzero ++ (fun {_} => map_N'_invariant_gamma) + +- have gamma_alpha_le_gamma: (Subgroup.closure ({toMul γ ^ α} ∪ (new_N'_map '' (N'_fg.choose)) )) ≤ (Subgroup.closure ({toMul γ} ∪ (new_N'_map '' (N'_fg.choose)))) := by +- simp +- intro g hg +- rw [Set.insert_eq] +- cases hg +- . rename_i g_eq_gamma +- rw [Subgroup.closure_union] +- apply Subgroup.mem_sup_left +- rw [Subgroup.mem_closure_singleton] +- use α +- rw [g_eq_gamma] +- simp +- . rename_i g_mem_map +- rw [Subgroup.closure_union] +- apply Subgroup.mem_sup_right +- apply Subgroup.mem_closure_of_mem +- exact g_mem_map +- +- conv => +- arg 1 +- arg 1 +- arg 1 +- arg 1 +- arg 2 +- equals (new_N'_map '' (N'_fg.choose)) => rfl +- rw [← Subgroup.relIndex_mul_index gamma_alpha_le_gamma] +- simp +- refine ⟨?_, ?_⟩ +- . +- unfold Subgroup.relIndex +- rw [← ne_eq] +- rw [← Subgroup.finiteIndex_iff] +- apply Subgroup.finiteIndex_of_rightCoset_cover_const (s := Finset.Ioo (-α : ℤ) (α)) (g := fun a => ⟨a • γ, (by +- rw [Set.insert_eq, Subgroup.closure_union] +- apply Subgroup.mem_sup_left +- rw [Subgroup.mem_closure_singleton] +- use a +- rfl +- )⟩) +- ext g +- simp +- have g_prop := g.property +- simp_rw [Set.insert_eq, Subgroup.closure_union] at g_prop +- rw [← MonoidHom.map_closure] at g_prop +- simp at g_prop +- rw [← SetLike.mem_coe] at g_prop +- rw [sup_comm] at g_prop +- +- +- rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ +- (Subgroup.le_normalizer_of_conj_mem map_N'_invariant_gamma_one)] at g_prop +- rw [Set.mem_mul] at g_prop +- obtain ⟨b, hb, a, ha, g_eq⟩ := g_prop +- simp at ha +- rw [Subgroup.mem_closure_singleton] at ha +- obtain ⟨z, hz⟩ := ha +- use z % α +- refine ⟨?_, ?_⟩ +- . +- have foo := Int.emod_lt_abs z (b := α) (by grind) +- rw [lt_abs] at foo +- refine ⟨?_, ?_⟩ +- . +- have bar := Int.emod_nonneg z (b := α) (by simpa using alpha_nonzero) +- grind +- . grind +- . +- rw [Set.mem_smul_set] +- use ⟨(Additive.ofMul b) + (((α : ℤ) * (z / (α : ℤ))) • γ), ?_⟩ +- . +- refine ⟨?_, ?_⟩ +- . +- simp +- rw [Subgroup.mem_subgroupOf] +- simp_rw [Set.insert_eq, Subgroup.closure_union] +- rw [← SetLike.mem_coe] +- rw [sup_comm] +- rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by +- simp_rw [← MonoidHom.map_closure] +- apply map_N'_invariant_gamma +- ))] +- apply Set.mul_mem_mul +- . +- simp +- rw [← MonoidHom.map_closure] +- exact hb +- . +- simp +- rw [Subgroup.mem_closure_singleton] +- use (z / (α : ℤ)) +- conv => +- lhs +- arg 1 +- equals toMul γ ^ (α : ℤ) => +- simp +- +- rw [← zpow_mul] +- . +- simp +- rw [Subtype.ext_iff] +- simp +- rw [← g_eq, ←hz] +- nth_rw 3 [← Int.mul_ediv_add_emod (a := z) (b := α)] +- rw [← toMul_zsmul] +- conv => +- lhs +- equals (ofMul b) + ((↑α * (z / ↑α)) • γ) + ((z % ↑α) • γ) => +- rfl +- +- +- rw [add_zsmul] +- rw [add_assoc] +- rfl +- . +- simp_rw [Set.insert_eq, Subgroup.closure_union] +- rw [sup_comm] +- rw [← SetLike.mem_coe] +- +- rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by +- simp_rw [← MonoidHom.map_closure] +- apply map_N'_invariant_gamma_one +- ))] +- apply Set.mul_mem_mul +- . +- simp +- rw [← MonoidHom.map_closure] +- exact hb +- . +- simp [Subgroup.mem_closure_singleton] +- . +- obtain ⟨s, s_compl, s_cosets⟩ := Subgroup.exists_leftTransversal_of_FiniteIndex (D := N') (H := ⊤) (by simp) +- simp at s_cosets +- +- rw [← ne_eq] +- rw [← Subgroup.finiteIndex_iff] +- apply Subgroup.finiteIndex_of_leftCoset_cover_const (s := s) (g := fun g => g.val.val.toMul) +- simp_rw [Set.insert_eq, Subgroup.closure_union] +- rename_bvar i → g +- +- +- conv => +- arg 1 +- arg 1 +- intro i +- arg 1 +- intro hi +- rw [sup_comm] +- rw [Subgroup.coe_mul_of_right_le_normalizer_left _ _ (Subgroup.le_normalizer_of_conj_mem (by +- intro gamma_pow h_gamma_pow n hn +- simp_rw [← MonoidHom.map_closure] at hn +- simp_rw [← MonoidHom.map_closure] +- apply map_N'_invariant_gamma_one _ h_gamma_pow _ hn +- ))] +- rw [set_smul_eq_mul] +- rw [← mul_assoc] +- rw [← set_smul_eq_mul] +- +- +- simp_rw [← Set.iUnion_mul] +- conv => +- arg 1 +- arg 1 +- equals Additive.toMul '' data.φ.ker => +- apply_fun (fun s => Additive.toMul '' (Subtype.val '' s)) at s_cosets +- conv at s_cosets => +- rhs +- equals Additive.toMul '' data.φ.ker => +- ext a +- simp +- rw [← s_cosets] +- conv => +- arg 1 +- arg 1 +- intro i +- arg 1 +- intro hi +- arg 2 +- +- simp_rw [← MonoidHom.map_closure] +- +- simp only [Set.image_image] +- first +- | erw [Set.image_iUnion₂] +- | rw [Set.image_iUnion₂] +- | simp only [Set.image_iUnion] +- apply Set.iUnion_congr +- intro i +- apply Set.iUnion_congr +- intro hi +- ext z +- simp only [closure_eq, coe_map] +- rw [Set.mem_smul_set] +- rw [Set.mem_image] +- refine ⟨?_, ?_⟩ +- . +- intro hy +- obtain ⟨a, ha⟩ := hy +- have foo := ha.1 +- rw [Set.mem_image] at foo +- obtain ⟨b, b_mem, a_eq_b⟩ := foo +- have N'_gen := N'_fg.choose_spec +- rw [N'_gen] at b_mem +- refine ⟨(↑i : Multiplicative ↥data.φ.ker) • b, Set.smul_mem_smul_set b_mem, ?_⟩ +- rw [← ha.2, ← a_eq_b] +- rfl +- . +- intro hx +- obtain ⟨x, hx, x_eq⟩ := hx +- erw [Set.mem_smul_set] at hx +- obtain ⟨n, hn, x_eq_n⟩ := hx +- refine ⟨new_N'_map n, ?_, ?_⟩ +- . +- rw [Set.mem_image] +- have N'_gen := N'_fg.choose_spec +- rw [← N'_gen] at hn +- exact ⟨n, hn, rfl⟩ +- . rw [← x_eq, ← x_eq_n] +- rfl +- +- +- conv => +- arg 1 +- lhs +- equals ↑data.φ.ker.toSubgroup' => +- ext a +- simp +- +- rw [← Subgroup.coe_mul_of_right_le_normalizer_left _ _] +- . +- simp +- rw [eq_top_iff] +- have ker_gen := e_i_and_gamma_generates_G data.φ γ hγ +- have foo := new_generates.generates +- simp at foo +- rw [← foo, ← ker_gen] +- simp_rw [Subgroup.closure_union] +- conv => +- lhs +- arg 1 +- equals Subgroup.closure {γ.toMul} => +- simp [Subgroup.closure_union] +- conv => +- lhs +- arg 1 +- equals {γ.toMul, γ.toMul⁻¹} => rfl +- rw [Set.insert_eq] +- rw [Subgroup.closure_union] +- simp +- +- simp_rw [← Subgroup.closure_union] +- rw [Subgroup.closure_le] +- rw [Set.union_subset_iff] +- refine ⟨?_, ?_⟩ +- . +- intro a ha +- simp at ha +- simp +- apply Subgroup.mem_sup_right +- simp [ha] +- . +- intro a ha +- apply Subgroup.mem_sup_left +- simp +- simp at ha +- obtain ⟨p, hp, a_eq⟩ := ha +- simp [e_i_with_gamma] at a_eq +- rw [← a_eq] +- conv => +- arg 1 +- arg 2 +- equals (ofMul p) + -((data.φ (ofMul p)) • γ) => +- rfl +- +- +- simp [hγ] +- . +- apply Subgroup.le_normalizer_of_conj_mem +- intro b hb a ha +- rw [Subgroup.mem_closure_singleton] at hb +- obtain ⟨n, b_eq⟩ := hb +- simp [← b_eq] +- simp at ha +- exact ha +- . have foo := data.finite_index +- rw [Subgroup.finiteIndex_iff] at foo +- exact foo + + + -- Decompose list of {e_k, γ}: +@@ -988,8 +980,6 @@ lemma theorem_3_1.{u} [hGS: Generates.{u}] (data: Theorem3_1_Input G) (d: ℕ) ( + -- * If the head is γ^n e_i for some n (collecting up adjacent γ), then choose γ_n,i = γ^n * e_i * γ^(-n) + -- * If the remaining list is just γ^n, then n must be 0 (since we maintained the invariant) + +-#print axioms three_two_gamma_m_generates +-#print axioms three_two_ker_fg + + -- NOTE: from https://www.numdam.org/item/PMIHES_1981__53__53_0.pdf + -- it looks like our definition of 'polynomial growth' should use `S ∪ S⁻¹` +@@ -1023,7 +1013,5 @@ theorem main_gromov_theorem (n: ℕ) (h: HasPolynomialGrowthD S n): Group.IsVirt + have prev := @ih Q_generates (n - 1) Q_poly (by omega) + exact prev + +-#print sorries main_gromov_theorem +-#print axioms main_gromov_theorem + + end GeneratesNS +diff --git a/Gromov/GrowthZero.lean b/Gromov/GrowthZero.lean +index 95e1ac0..95a2c15 100644 +--- a/Gromov/GrowthZero.lean ++++ b/Gromov/GrowthZero.lean +@@ -11,9 +11,6 @@ public import Gromov.ThreeTwoGenerates + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false + + open Subgroup + open scoped Finset +@@ -28,9 +25,7 @@ include hGS + + open scoped RealInnerProductSpace + +-set_option synthInstance.maxHeartbeats 500000 + +-set_option maxHeartbeats 1000000 + + open MeasureTheory + +@@ -48,13 +43,12 @@ structure GeneratesWithParam (G: Type*) [Group G] [DecidableEq G] where + has_inv: ∀ g ∈ S, g⁻¹ ∈ S + g_infinite: Infinite G + ++omit hGS in + lemma one_mem_S {G: Type*} [Group G] [DecidableEq G] {n: ℕ} (data: Theorem3_1_Input G) (hGS: GeneratesWithParam data.G') (γ: Additive data.G') (hγ: data.φ γ = 1): 0 ∈ S_n_ker_phi hGS.S data.φ γ hγ n := by + simp [S_n_ker_phi] + + +--- The generating set of `ker φ` used below, shared between the `new_g_growth` +--- hypothesis and the `S` field so that `g_growth := new_g_growth` is definitionally +--- trivial (avoids an expensive `whnf` on the two separately-elaborated `Finset`s). ++-- A symmetric generating set for the kernel of the homomorphism to ℤ. + omit hGS in + @[expose] + noncomputable def ker_S {G: Type*} [Group G] [DecidableEq G] (data: Theorem3_1_Input G) +@@ -63,9 +57,8 @@ noncomputable def ker_S {G: Type*} [Group G] [DecidableEq G] (data: Theorem3_1_I + (Finset.image Additive.toMul (S_n_ker_phi hGS.S data.φ γ hγ n)) ∪ + (Finset.image Additive.toMul ((S_n_ker_phi hGS.S data.φ γ hγ n)))⁻¹ + +--- TODO - figure out how to make this a 'let' without adding it to typeclass search + omit hGS in +-@[expose] ++@[expose, instance_reducible] + noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (data: Theorem3_1_Input G) (hGS: GeneratesWithParam data.G') (γ: data.G') (hγ: data.φ γ = 1) + (ker_infinite: Infinite (Multiplicative data.φ.ker)) + (ker_generates: AddSubgroup.closure (Additive.ofMul '' (three_two_S_n hGS.S data.φ γ (n))) = data.φ.ker) +@@ -104,13 +97,9 @@ noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (d + simp at foo + unfold S_n_ker_phi + simp +- first +- | erw [Finset.coe_insert, Set.image_insert_eq, toMul_zero, Subgroup.closure_insert_one] +- | rw [Finset.coe_insert, Set.image_insert_eq, toMul_zero, Subgroup.closure_insert_one] +- | simp only [Finset.coe_insert, Set.image_insert_eq, toMul_zero, Subgroup.closure_insert_one] + rw [← Subgroup.mem_map_iff_mem (f := f)] +- . +- simp only [f, Subgroup.subtype_apply] ++ · ++ simp only [f] + rw [MonoidHom.map_closure] + simp + conv => +@@ -131,7 +120,7 @@ noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (d + have hbk : b ∈ three_two_S_n hGS.S data.φ γ n := by simpa using hb + exact ⟨_, ⟨_, ⟨⟨b, hbk⟩, rfl⟩, rfl⟩, rfl⟩ + exact foo +- . simp [f] ++ · simp [f] + intro x y hxy + simpa using hxy + simp +@@ -140,7 +129,6 @@ noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (d + rw [Finset.mem_image] + use 0 + simp +- -- TODO - figure out wht 'apply one_mem_S' is slow + exact one_mem_S data hGS γ hγ + + has_inv := by +@@ -156,6 +144,231 @@ noncomputable def ker_generates {n: ℕ} {G: Type*} [Group G] [DecidableEq G] (d + } + + ++private lemma kernel_thickening_card (n r : ℕ) (φ : (Additive G) →+ ℤ) (γ : G) (hγ : φ γ = 1) : ++ let mul_by_i := fun (g : G) (i : Fin r) => g * (γ ^ i.val); ++ #((((((S_n_ker_phi S φ γ hγ n) ∪ (-(S_n_ker_phi S φ γ hγ n))).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) = r * #(r • ((S_n_ker_phi S φ γ hγ n) ∪ -((S_n_ker_phi S φ γ hγ n)))) := by ++ dsimp only ++ let mul_by_i := fun (g: G) (i: Fin r) => g * (γ ^ i.val) ++ change #((((((S_n_ker_phi S φ γ hγ n) ∪ (-(S_n_ker_phi S φ γ hγ n))).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) = r * #(r • ((S_n_ker_phi S φ γ hγ n) ∪ -((S_n_ker_phi S φ γ hγ n)))) ++ have new_phi_gamma: φ (Additive.ofMul γ) = 1 := hγ ++ have card_mul_range (g: G): #(Finset.image (mul_by_i g) Finset.univ) = r := by ++ rw [Finset.card_image_of_injOn] ++ · simp ++ · ++ ++ intro j _ k _ mul_eq ++ simp [mul_by_i] at mul_eq ++ apply_fun φ ∘ (Additive.ofMul) at mul_eq ++ simp [new_phi_gamma] at mul_eq ++ rw [Fin.ext_iff] ++ exact mul_eq ++ ++ ++ rw [Finset.card_biUnion] ++ · ++ simp_rw [card_mul_range] ++ simp ++ rw [mul_comm] ++ conv => ++ lhs ++ arg 2 ++ arg 1 ++ equals r • ((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)) => ++ ext a ++ rw [Finset.mem_image] ++ simp_rw [Finset.mem_pow] ++ refine Iff.trans ?_ Finset.mem_nsmul.symm ++ refine ⟨?_, ?_⟩ ++ · intro h ++ obtain ⟨b, ⟨f, hf⟩, b_eq_a⟩ := h ++ use (fun i => ⟨(f i).val, (by ++ have f_prop := (f i).property ++ rw [Finset.mem_image] at f_prop ++ obtain ⟨g, g_mem, hg⟩ := f_prop ++ rw [← hg] ++ exact g_mem ++ )⟩) ++ rw [← b_eq_a] ++ rw [← hf] ++ rfl ++ · intro h ++ obtain ⟨f, hf⟩ := h ++ use a ++ refine ⟨?_, rfl⟩ ++ use (fun i => ⟨(f i).val, (by ++ have f_prop := (f i).property ++ rw [Finset.mem_image] ++ use (f i).val ++ refine ⟨f_prop, ?_⟩ ++ rfl ++ )⟩) ++ rw [← hf] ++ rfl ++ ++ ++ · ++ intro a ha b hb hab x h_first h_second ++ simp at h_first ++ simp at h_second ++ simp ++ ++ by_contra! ++ obtain ⟨p, hp⟩ := this ++ have orig_h_first := h_first hp ++ have orig_h_second := h_second hp ++ specialize h_first hp ++ specialize h_second hp ++ ++ simp at h_first ++ simp at h_second ++ ++ obtain ⟨y, hy⟩ := h_first ++ obtain ⟨z, hz⟩ := h_second ++ ++ have orig_hy := hy ++ have orig_hz := hz ++ ++ rw [← hz] at hy ++ simp [mul_by_i] at hy ++ apply_fun φ ∘ (Additive.ofMul) at hy ++ simp [new_phi_gamma] at hy ++ ++ have a_ker: a.val ∈ φ.ker := by ++ simp ++ ++ have b_ker: b.val ∈ φ.ker := by ++ simp ++ ++ rw [AddMonoidHom.mem_ker] at a_ker ++ rw [AddMonoidHom.mem_ker] at b_ker ++ simp [ofMul] at hy ++ simp [a_ker, b_ker] at hy ++ ++ rw [← Fin.ext_iff] at hy ++ rw [hy] at orig_hy ++ rw [← orig_hy] at orig_hz ++ simp [mul_by_i] at orig_hz ++ rw [eq_comm] at orig_hz ++ contradiction ++ ++ ++ ++private lemma kernel_thickening_bound (n r : ℕ) (φ : (Additive G) →+ ℤ) (γ : G) (hγ : φ γ = 1) : ++ let mul_by_i := fun (g : G) (i : Fin r) => g * (γ ^ i.val); ++ #((((((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) ≤ #(((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1}) ^ (2 * r)) := by ++ dsimp only ++ let mul_by_i := fun (g : G) (i : Fin r) => g * (γ ^ i.val) ++ change #((((((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) ≤ #(((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1}) ^ (2 * r)) ++ ++ grw [Finset.card_le_card] ++ intro a ha ++ rw [Finset.mem_biUnion] at ha ++ obtain ⟨s, s_mem, a_mem⟩ := ha ++ rw [Finset.mem_image] at a_mem ++ obtain ⟨k, _, hk⟩ := a_mem ++ simp [mul_by_i] at hk ++ rw [← hk] ++ rw [two_mul] ++ rw [pow_add] ++ apply Finset.mul_mem_mul ++ · ++ unfold S_n_ker_phi at s_mem ++ ++ rw [Finset.mem_image] at s_mem ++ obtain ⟨z, z_mem, hz⟩ := s_mem ++ rw [← hz] ++ ++ rw [Finset.mem_pow] at z_mem ++ obtain ⟨f, hf⟩ := z_mem ++ rw [Finset.mem_pow] ++ use (fun i => ⟨(f i).val.val, (by ++ have f_prop := (f i).property ++ rw [Finset.mem_image] at f_prop ++ obtain ⟨g, g_mem, hg⟩ := f_prop ++ rw [← hg] ++ simp at g_mem ++ cases g_mem ++ · ++ rename_i g_eq_zero ++ apply Finset.mem_union_right ++ rw [Finset.mem_singleton, g_eq_zero] ++ rfl ++ · rename_i g_eq_nonzero ++ cases g_eq_nonzero ++ · rename_i left ++ obtain ⟨z, z_mem, hz⟩ := left ++ rw [← hz] ++ apply Finset.mem_union_left ++ apply Finset.mem_union_left ++ apply Finset.mem_union_left ++ exact z_mem ++ · ++ rename_i right ++ obtain ⟨z, z_mem, hz⟩ := right ++ apply Finset.mem_union_left ++ apply Finset.mem_union_left ++ apply Finset.mem_union_right ++ simp ++ conv => ++ arg 2 ++ equals (-g).val => ++ rfl ++ rw [← hz] ++ exact z_mem ++ )⟩) ++ rw [← hf, ofMul_list_prod, List.map_ofFn] ++ erw [AddSubmonoidClass.coe_list_sum, List.map_ofFn] ++ rfl ++ · ++ ++ ++ have gamma_r_subset: ({γ, 1} : Finset G)^r ⊆ ((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1})^r := by ++ apply Finset.pow_subset_pow ++ · grind ++ · grind ++ · simp ++ ++ have gamma_subset: ({γ, 1} : Finset G)^k.val ⊆ ({γ, 1} : Finset G)^r := by ++ apply Finset.pow_subset_pow ++ · simp ++ · simp ++ · simp ++ ++ ++ have gamma_mem_self: γ^k.val ∈ ({γ, 1} : Finset G)^k.val := by ++ apply Finset.pow_mem_pow ++ simp ++ ++ grind ++ ++ ++ ++omit hGS in ++private lemma multiplicative_symm_pow {A : Type*} [AddGroup A] [DecidableEq A] ++ (s : Finset A) (r : ℕ) : ++ ((show Finset (Multiplicative A) from s) ∪ (show Finset (Multiplicative A) from s)⁻¹)^r = ++ (show Finset (Multiplicative A) from r • (s ∪ -s)) := by ++ ext a ++ rw [Finset.mem_pow] ++ refine Iff.trans ?_ (Finset.mem_nsmul (α := A) (s := s ∪ -s) (a := a.toAdd) (n := r)).symm ++ constructor ++ · rintro ⟨f, hf⟩ ++ exact ⟨f, hf⟩ ++ · rintro ⟨f, hf⟩ ++ exact ⟨f, hf⟩ ++ ++omit hGS in ++private lemma cancel_growth_factor {N r b d : ℕ} (hr : 0 < r) (hd : 1 ≤ d) ++ (h : r * N ≤ b * (2 * r)^d) : N ≤ (b * 2^d) * r^(d-1) := by ++ have hp : r^d = r * r^(d-1) := by ++ calc ++ r^d = r^((d-1)+1) := by rw [Nat.sub_add_cancel hd] ++ _ = r * r^(d-1) := by rw [pow_succ, mul_comm] ++ apply Nat.le_of_mul_le_mul_left (c := r) ?_ hr ++ calc ++ r * N ≤ b * (2*r)^d := h ++ _ = r * ((b * 2^d) * r^(d-1)) := by rw [mul_pow, hp]; ac_rfl ++ + lemma three_two_kernel_poly_growth (d: ℕ) (hd: d >= 1) (n: ℕ) (hG: HasPolynomialGrowthD S d ) (φ: (Additive G) →+ ℤ) (γ: G) (hγ : φ γ = 1) + : HasPolynomialGrowthD (G := Multiplicative φ.ker) (d - 1) (S := (S_n_ker_phi S φ γ hγ n) ∪ (S_n_ker_phi S φ γ hγ n)⁻¹) := by + +@@ -165,7 +378,7 @@ lemma three_two_kernel_poly_growth (d: ℕ) (hd: d >= 1) (n: ℕ) (hG: HasPolyn + obtain ⟨a, ha⟩ := hG + + by_cases a_eq_zero: a = 0 +- . ++ · + simp [a_eq_zero] at ha + specialize ha 1 (by simp) + simp at ha +@@ -186,236 +399,16 @@ lemma three_two_kernel_poly_growth (d: ℕ) (hd: d >= 1) (n: ℕ) (hG: HasPolyn + specialize ker_poly (2 * r) (by omega) + + +- let mul_by_i := fun (g: G) (i: Fin r) => g * (γ ^ i.val) +- have new_phi_gamma: φ (Additive.ofMul γ) = 1 := hγ +- have card_mul_range (g: G): #(Finset.image (mul_by_i g) Finset.univ) = r := by +- rw [Finset.card_image_of_injOn] +- . simp +- . +- +- intro j _ k _ mul_eq +- simp [mul_by_i] at mul_eq +- apply_fun φ ∘ (Additive.ofMul) at mul_eq +- simp [new_phi_gamma] at mul_eq +- rw [Fin.ext_iff] +- exact mul_eq +- +- have card_union: #((((((S_n_ker_phi S φ γ hγ n) ∪ (-(S_n_ker_phi S φ γ hγ n))).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) = r * #(r • ((S_n_ker_phi S φ γ hγ n) ∪ -((S_n_ker_phi S φ γ hγ n)))) := by +- rw [Finset.card_biUnion] +- . +- simp_rw [card_mul_range] +- simp +- rw [mul_comm] +- conv => +- lhs +- arg 2 +- arg 1 +- equals r • ((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)) => +- ext a +- rw [Finset.mem_image] +- simp_rw [Finset.mem_pow] +- refine Iff.trans ?_ Finset.mem_nsmul.symm +- refine ⟨?_, ?_⟩ +- . intro h +- obtain ⟨b, ⟨f, hf⟩, b_eq_a⟩ := h +- use (fun i => ⟨(f i).val, (by +- have f_prop := (f i).property +- rw [Finset.mem_image] at f_prop +- obtain ⟨g, g_mem, hg⟩ := f_prop +- rw [← hg] +- exact g_mem +- )⟩) +- rw [← b_eq_a] +- rw [← hf] +- rfl +- . intro h +- obtain ⟨f, hf⟩ := h +- use a +- refine ⟨?_, rfl⟩ +- use (fun i => ⟨(f i).val, (by +- have f_prop := (f i).property +- rw [Finset.mem_image] +- use (f i).val +- refine ⟨f_prop, ?_⟩ +- rfl +- )⟩) +- rw [← hf] +- rfl +- +- +- . +- intro a ha b hb hab x h_first h_second +- simp at h_first +- simp at h_second +- simp +- +- by_contra! +- obtain ⟨p, hp⟩ := this +- have orig_h_first := h_first hp +- have orig_h_second := h_second hp +- specialize h_first hp +- specialize h_second hp +- +- simp at h_first +- simp at h_second +- +- obtain ⟨y, hy⟩ := h_first +- obtain ⟨z, hz⟩ := h_second +- +- have orig_hy := hy +- have orig_hz := hz +- +- rw [← hz] at hy +- simp [mul_by_i] at hy +- apply_fun φ ∘ (Additive.ofMul) at hy +- simp [new_phi_gamma] at hy +- +- have a_ker: a.val ∈ φ.ker := by +- simp +- +- have b_ker: b.val ∈ φ.ker := by +- simp +- +- rw [AddMonoidHom.mem_ker] at a_ker +- rw [AddMonoidHom.mem_ker] at b_ker +- simp [ofMul] at hy +- simp [a_ker, b_ker] at hy +- +- rw [← Fin.ext_iff] at hy +- rw [hy] at orig_hy +- rw [← orig_hy] at orig_hz +- simp [mul_by_i] at orig_hz +- rw [eq_comm] at orig_hz +- contradiction +- +- +- have card_union_le: #((((((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)).image Multiplicative.ofAdd) ^ r).image ofMul).biUnion (fun a => Finset.image (mul_by_i a.val) Finset.univ)) ≤ #(((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1}) ^ (2 * r)) := by +- grw [Finset.card_le_card] +- intro a ha +- rw [Finset.mem_biUnion] at ha +- obtain ⟨s, s_mem, a_mem⟩ := ha +- rw [Finset.mem_image] at a_mem +- obtain ⟨k, _, hk⟩ := a_mem +- simp [mul_by_i] at hk +- rw [← hk] +- rw [two_mul] +- rw [pow_add] +- apply Finset.mul_mem_mul +- . +- unfold S_n_ker_phi at s_mem +- +- rw [Finset.mem_image] at s_mem +- obtain ⟨z, z_mem, hz⟩ := s_mem +- rw [← hz] +- +- rw [Finset.mem_pow] at z_mem +- obtain ⟨f, hf⟩ := z_mem +- rw [Finset.mem_pow] +- use (fun i => ⟨(f i).val.val, (by +- have f_prop := (f i).property +- rw [Finset.mem_image] at f_prop +- obtain ⟨g, g_mem, hg⟩ := f_prop +- rw [← hg] +- simp at g_mem +- cases g_mem +- . +- rename_i g_eq_zero +- apply Finset.mem_union_right +- rw [Finset.mem_singleton, g_eq_zero] +- first | rfl | simp +- . rename_i g_eq_nonzero +- cases g_eq_nonzero +- . rename_i left +- obtain ⟨z, z_mem, hz⟩ := left +- rw [← hz] +- apply Finset.mem_union_left +- apply Finset.mem_union_left +- apply Finset.mem_union_left +- exact z_mem +- . +- rename_i right +- obtain ⟨z, z_mem, hz⟩ := right +- apply Finset.mem_union_left +- apply Finset.mem_union_left +- apply Finset.mem_union_right +- simp +- conv => +- arg 2 +- equals (-g).val => +- rfl +- rw [← hz] +- exact z_mem +- )⟩) +- rw [← hf, ofMul_list_prod, List.map_ofFn] +- first +- | (erw [AddSubmonoidClass.coe_list_sum, List.map_ofFn]; rfl) +- | (rw [AddSubmonoidClass.coe_list_sum, List.map_ofFn]; rfl) +- | (simp only [AddSubmonoidClass.coe_list_sum, List.map_ofFn]; rfl) +- . +- +- +- have gamma_r_subset: ({γ, 1} : Finset G)^r ⊆ ((three_two_S_n S φ γ n) ∪ ((three_two_S_n S φ γ n)⁻¹) ∪ {γ} ∪ {1})^r := by +- apply Finset.pow_subset_pow +- . grind +- . grind +- . simp +- +- have gamma_subset: ({γ, 1} : Finset G)^k.val ⊆ ({γ, 1} : Finset G)^r := by +- apply Finset.pow_subset_pow +- . simp +- . simp +- . simp +- +- +- have gamma_mem_self: γ^k.val ∈ ({γ, 1} : Finset G)^k.val := by +- apply Finset.pow_mem_pow +- simp +- +- grind +- ++ let mul_by_i := fun (g : G) (i : Fin r) => g * (γ ^ i.val) ++ have card_union := kernel_thickening_card n r φ γ hγ ++ have card_union_le := kernel_thickening_bound n r φ γ hγ ++ dsimp only at card_union card_union_le + + rw [card_union] at card_union_le +- grw [ker_poly] at card_union_le +- rw [mul_pow] at card_union_le +- rw [← mul_assoc] at card_union_le +- rw [mul_comm] at card_union_le +- rw [← Nat.le_div_iff_mul_le] at card_union_le +- . +- rw [Nat.mul_div_assoc] at card_union_le +- . +- nth_rw 3 [← pow_one (a := r)] at card_union_le +- rw [Nat.pow_div] at card_union_le +- . +- -- TODO - get rid of this obnoxious Additive/Multiplicative defeq abuse +- conv => +- lhs +- arg 1 +- equals r • ((S_n_ker_phi S φ γ hγ n) ∪ -(S_n_ker_phi S φ γ hγ n)) => +- ext a +- rw [Finset.mem_pow] +- -- TODO - why do we need explicit args here +- refine Iff.trans ?_ Finset.mem_nsmul.symm +- refine ⟨?_, ?_⟩ +- . +- intro hf +- obtain ⟨f, hf⟩ := hf +- use f +- exact hf +- . intro hf +- obtain ⟨f, hf⟩ := hf +- use f +- exact hf +- exact card_union_le +- . omega +- . omega +- +- . +- nth_rw 1 [← pow_one (a := r)] +- apply Nat.pow_dvd_pow +- omega +- . omega +- +-#print axioms three_two_kernel_poly_growth ++ have hbound := cancel_growth_factor (by omega : 0 < r) hd (card_union_le.trans ker_poly) ++ rw [multiplicative_symm_pow] ++ exact hbound ++ + + + omit hGS in +@@ -436,7 +429,6 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by + have S_closure := hGS.generates + + let pow_cards := Set.range (fun (n: ℕ) => #(S ^ n)) +- -- TODO - this can probably be much simpler + have pow_cards_bounded: ∃ y, ∀ n ∈ pow_cards, n ≤ y := by + use a + intro n hn +@@ -445,9 +437,8 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by + rw [← hy] + + by_cases y_eq_zero: y = 0 +- . simp [y_eq_zero] ++ · simp [y_eq_zero] + +- -- TODO - deduplicate this + have a_ne_zero: a ≠ 0 := by + by_contra! + rw [this] at ha +@@ -458,20 +449,20 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by + simp at one_mem + + omega +- . by_cases y_eq_one: y = 1 +- . ++ · by_cases y_eq_one: y = 1 ++ · + simp [y_eq_one] + have card_mono := Finset.card_pow_mono (s := S) (m := 1) (n := 2) (by simp) (by simp) + have card_two_le := ha 2 (by simp) + simp at card_mono + linarith +- . ++ · + exact ha y (by omega) + + + classical + have max_card_mem := Nat.sSup_mem (s := pow_cards) ?_ ?_ +- . simp [pow_cards] at max_card_mem ++ · simp [pow_cards] at max_card_mem + obtain ⟨y, hy⟩ := max_card_mem + + +@@ -483,7 +474,7 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by + exact Generates.one_mem + | mem x hx => + by_cases y_eq_zero: y = 0 +- . ++ · + rw [y_eq_zero] + rw [y_eq_zero] at hy + simp at hy +@@ -492,27 +483,27 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by + have find_le := Nat.find_spec pow_cards_bounded + rw [← y_eq] at find_le + have S_one_le := find_le #(S) ?_ +- . ++ · + simp [pow_cards] at S_one_le + rw [← hy] at S_one_le + rw [Finset.card_le_one] at S_one_le + have one_mem: 1 ∈ S := by exact Generates.one_mem + have x_eq := S_one_le 1 one_mem x hx + apply x_eq.symm +- . simp [pow_cards] ++ · simp [pow_cards] + use 1 + simp +- . ++ · + have pow_mono := Finset.pow_subset_pow_right (s := S) (Generates.one_mem) (n := y) (m := 1) (by omega) + simp at pow_mono + apply pow_mono hx + | mul a b a_mem_closure b_mem_closure a_mem_pow b_mem_pow => + by_cases y_eq_zero: y = 0 +- . ++ · + simp [y_eq_zero] + simp [y_eq_zero] at a_mem_pow b_mem_pow + simp [a_mem_pow, b_mem_pow] +- . ++ · + by_contra! + have a_b_mem_two: a * b ∈ (S ^ (y * 2)) := by + have mem_mul := Finset.mul_mem_mul a_mem_pow b_mem_pow +@@ -535,10 +526,10 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by + have find_le := Nat.find_spec pow_cards_bounded + rw [← y_eq] at find_le + have reverse_le := find_le #(S ^ (y * 2)) ?_ +- . ++ · + simp [pow_cards] at reverse_le + linarith +- . simp [pow_cards] ++ · simp [pow_cards] + | inv a ha a_mem_pow => + rw [← Finset.mem_inv'] + rw [← inv_pow] +@@ -559,11 +550,11 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by + rw [← S_closure] + ext a + refine ⟨?_, ?_⟩ +- . intro ha ++ · intro ha + simp at ha + rw [← Finset.coe_pow] + exact all_closure_mem a ha +- . intro ha ++ · intro ha + simp + exact mem_closure a + +@@ -571,10 +562,10 @@ lemma finite_of_growth_zero (h: HasPolynomialGrowthD S 0): Finite G := by + rw [← Finset.coe_pow] + exact Finset.finite_toSet (S ^ y) + exact G_finite +- . ++ · + simp [pow_cards] + apply Set.range_nonempty +- . ++ · + rw [bddAbove_def] + exact pow_cards_bounded + +@@ -599,6 +590,5 @@ lemma growth_exponent_pos {d : ℕ} (h: HasPolynomialGrowthD S d): 0 < d := by + have := hGS.g_infinite + exact (not_finite G) + +--- TODO - add an explicit top-level universe parameter to avoid this 'omit hGS' hack + + end GeneratesNS +diff --git a/Gromov/Harmonic.lean b/Gromov/Harmonic.lean +index 939cd59..b28dc07 100644 +--- a/Gromov/Harmonic.lean ++++ b/Gromov/Harmonic.lean +@@ -8,13 +8,10 @@ public import Gromov.Harmonic.CaseOne + + `nontrivial_harmonic_case_two` and the main result `exists_nontrivial_harmonic`. + +-Root of the `Gromov.Harmonic` hierarchy. + -/ + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + attribute [local implicit_reducible] Additive + + namespace GeneratesNS +@@ -32,12 +29,10 @@ open MeasureTheory + + open scoped RealInnerProductSpace + +-set_option maxHeartbeats 2000000 in + lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun n: ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0))): ∃ F: LipschitzH , ∀ z: ℝ, F ≠ ConstLipschitzH z := by + obtain ⟨s, hs⟩ := f_n_limit + let H_n := fun n g => if ((f_n n g⁻¹) - (Conv (f_n n) (delta s.val)) g⁻¹) ≠ 0 then ((f_n n g⁻¹) - (Conv (f_n n) (delta s.val)) g⁻¹) / |((f_n n g⁻¹) - (Conv (f_n n) (delta s.val)) g⁻¹)| else 1 + +- -- TODO - why can't we write '∞' here + have H_n_norm: ∀ n: ℕ, MeasureTheory.eLpNorm (H_n n) (p := ⊤) MeasureTheory.volume = 1 := by + intro n + simp [H_n] +@@ -49,24 +44,24 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + simp [H_n] + intro g + split_ifs +- . simp +- . ++ · simp ++ · + + rename_i foo + by_cases val_pos: 0 ≤ ((f_n n g⁻¹) - (Conv (f_n n) (delta s.val)) g⁻¹) +- . ++ · + rw [abs_of_nonneg val_pos] + rw [div_self] +- . simp +- . exact foo +- . ++ · simp ++ · exact foo ++ · + rw [abs_of_neg] +- . ++ · + rw [div_neg_self] +- . ++ · + simp +- . exact foo +- . linarith ++ · exact foo ++ · linarith + + unfold H_n at h_norm_one + simp at h_norm_one +@@ -78,21 +73,21 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + simp [H_n] + simp [f_conv_delta] + split_ifs +- . linarith +- . ++ · linarith ++ · + rename_i diff_zero + by_cases val_pos: 0 ≤ f_n n g - f_n n ((↑s)⁻¹ * g) +- . ++ · + rw [abs_of_nonneg val_pos] + rw [div_self] +- . linarith +- . assumption +- . ++ · linarith ++ · assumption ++ · + rw [abs_of_neg] +- . rw [div_neg_self] +- . linarith +- . assumption +- . ++ · rw [div_neg_self] ++ · linarith ++ · assumption ++ · + simpa using val_pos + + have fn_sub_norm: ∀ n: ℕ, eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 = ENNReal.ofReal |((Conv (H_n n) (f_n n)) 1) - ((Conv (H_n n) (f_n n)) s⁻¹)| := by +@@ -108,26 +103,26 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + equals (H_n n g⁻¹) * (f_n n g - (Conv (f_n n) (delta s.val)) g) => + simp [H_n] + split_ifs +- . ++ · + rename_i diff_eq_zero + simp [diff_eq_zero] +- . ++ · + rename_i diff_ne_zero + by_cases val_pos: 0 ≤ ((f_n n g) - (Conv (f_n n) (delta s.val)) g) +- . ++ · + rw [abs_of_nonneg] +- . ++ · + rw [div_self] + simp + apply diff_ne_zero +- . exact val_pos +- . ++ · exact val_pos ++ · + rw [abs_of_neg] +- . ++ · + rw [div_neg_self] + simp + exact diff_ne_zero +- . ++ · + simpa using val_pos + + rw [conv_eq_sum (by +@@ -138,8 +133,8 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + apply Set.Finite.inter_of_right + apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) + refine Set.Finite.biUnion' ?_ ?_ +- . exact Set.toFinite (Membership.mem Finset.univ.val) +- . intro m hm ++ · exact Set.toFinite (Membership.mem Finset.univ.val) ++ · intro m hm + apply mu_conv_finsupp + )] + +@@ -151,8 +146,8 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + apply Set.Finite.inter_of_right + apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) + refine Set.Finite.biUnion' ?_ ?_ +- . exact Set.toFinite (Membership.mem Finset.univ.val) +- . intro m hm ++ · exact Set.toFinite (Membership.mem Finset.univ.val) ++ · intro m hm + apply mu_conv_finsupp + )] + +@@ -171,14 +166,14 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + apply Set.Finite.inter_of_right + apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) + refine Set.Finite.biUnion' ?_ ?_ +- . exact Set.toFinite (Membership.mem Finset.univ.val) +- . ++ · exact Set.toFinite (Membership.mem Finset.univ.val) ++ · + intro m hm + apply Set.Finite.of_injOn (f := fun a => ((Additive.toMul a))⁻¹) (ht := mu_conv_finsupp m) +- . ++ · + intro a ha + exact ha +- . intro a ha b hb ++ · intro a ha b hb + simp + ) (by + apply summable_of_hasFiniteSupport +@@ -190,14 +185,14 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + apply Set.Finite.inter_of_right + apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) + refine Set.Finite.biUnion' ?_ ?_ +- . exact Set.toFinite (Membership.mem Finset.univ.val) +- . ++ · exact Set.toFinite (Membership.mem Finset.univ.val) ++ · + intro m hm + apply Set.Finite.of_injOn (f := fun a => s.val⁻¹ * ((Additive.toMul a))⁻¹ ) (ht := mu_conv_finsupp m) +- . ++ · + intro a ha + exact ha +- . intro a ha b hb ++ · intro a ha b hb + simp + )] + simp_rw [mul_sub] +@@ -208,25 +203,25 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + simp + rw [abs_of_nonneg] + rfl +- . ++ · + apply tsum_nonneg + apply H_n_diff_pos n +- . ++ · + simp + apply Function.Injective.comp +- . exact neg_injective +- . exact fun ⦃a₁ a₂⦄ a ↦ a +- . ++ · exact neg_injective ++ · exact fun ⦃a₁ a₂⦄ a ↦ a ++ · + simp + intro g hg + use g⁻¹ + simp +- . ++ · + apply tsum_nonneg + apply H_n_diff_pos n +- . simp +- . apply H_n_diff_pos n +- . ++ · simp ++ · apply H_n_diff_pos n ++ · + simp_rw [← mul_sub] + apply summable_of_hasFiniteSupport + change (Function.support _).Finite +@@ -235,12 +230,12 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + apply Set.Finite.subset (hs := ?_) (ht := Function.support_sub _ _) + simp + refine ⟨?_, ?_⟩ +- . apply f_n_fin_supp +- . ++ · apply f_n_fin_supp ++ · + apply Set.Finite.of_injOn (f := fun a => s.val⁻¹ * a) (ht := f_n_fin_supp n) +- . intro a ha ++ · intro a ha + simpa using ha +- . simp ++ · simp + + + have haar_eq_haar_add : myHaar = myHaarAddOpp := by +@@ -267,7 +262,7 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + + have conv_laplce_norm (n: ℕ): eLpNorm ((Laplace_b ((Conv (H_n n)) (f_n n)))) ⊤ (μ := volume (α := G)) ≤ eLpNorm (H_n n) ⊤ * (eLpNorm (Laplace_b (f_n n)) 1 (μ := volume (α := G))) := by + rw [laplace_conv_eq_laplace_right] +- . ++ · + unfold Conv + eta_reduce + simp only [volume] +@@ -288,12 +283,12 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + calc ‖ContinuousLinearMap.mul ℝ ℝ‖ₑ * eLpNorm (H_n n) ⊤ myHaarAddOpp * eLpNorm (Laplace_b (f_n n)) 1 myHaarAddOpp + ≤ 1 * eLpNorm (H_n n) ⊤ myHaarAddOpp * eLpNorm (Laplace_b (f_n n)) 1 myHaarAddOpp := by gcongr + _ = eLpNorm (H_n n) ⊤ myHaarAddOpp * eLpNorm (Laplace_b (f_n n)) 1 myHaarAddOpp := by rw [one_mul] +- . ++ · + apply conv_exists_fin_supp + right + exact f_n_fin_supp n +- . apply f_n_nonneg +- . exact f_n_fin_supp n ++ · apply f_n_nonneg ++ · exact f_n_fin_supp n + + + let conv_h_n_cont (n: ℕ): C(G, ℝ) := { +@@ -311,7 +306,6 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + rw [count_ae_everywhere] at ae_le + simp_rw [Real.enorm_eq_ofReal_abs] at ae_le + simp_rw [Real.enorm_eq_ofReal_abs] at norm_bound +- norm_cast at ae_le + simp [volume] at norm_bound + rw [my_haar_eq_count] at norm_bound + specialize ae_le g +@@ -323,8 +317,8 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + simp [LipschitzWith] + intro x y + by_cases x_eq_y: x = y +- . simp [x_eq_y] +- . ++ · simp [x_eq_y] ++ · + norm_cast + rw [edist_dist] + rw [Real.dist_eq] +@@ -333,10 +327,10 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + rhs + equals ENNReal.ofReal (2 * (dist x y)) => + rw [ENNReal.ofReal_mul] +- . simp +- . linarith ++ · simp ++ · linarith + rw [ENNReal.ofReal_le_ofReal_iff] +- . ++ · + grw [abs_sub] + grw [abs_conv_le_one x] + grw [abs_conv_le_one y] +@@ -347,7 +341,7 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + exact dist_ne_zero.mpr x_eq_y + simp [dist] at dist_ne_zero + omega +- . simp [dist] ++ · simp [dist] + + + have compact_closure_f: IsCompact (closure ( (Set.range (fun n => (Conv (H_n n) (f_n n)))))) := by +@@ -388,8 +382,8 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + obtain ⟨F, F_mem, seq, seq_mono, tendsto_F⟩ := h_n_pointwise_converge + let F_lipschitzh := nontrivial_harmonic_common 2 (eps_seq ∘ seq) (by + apply Filter.Tendsto.comp (x := Filter.atTop) (y := Filter.atTop) +- . exact StrictMono.tendsto_atTop mono_eps_seq +- . exact StrictMono.tendsto_atTop seq_mono ++ · exact StrictMono.tendsto_atTop mono_eps_seq ++ · exact StrictMono.tendsto_atTop seq_mono + ) F H_n conv_h_n_lipschitz tendsto_F H_n_norm + use F_lipschitzh + intro z +@@ -416,7 +410,6 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + contradiction + + by_contra! +- -- TODO - there must be a cleaner way + have app_one_eq: F_lipschitzh 1 = ConstLipschitzH z (1: G) := by + rw [this] + unfold F_lipschitzh ConstLipschitzH at app_one_eq +@@ -427,19 +420,17 @@ lemma nontrivial_harmonic_case_two (f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun + unfold F_lipschitzh ConstLipschitzH at app_s_inv_eq + simp [DFunLike.coe] at app_s_inv_eq + rw [← app_one_eq] at app_s_inv_eq +- norm_cast at app_s_inv_eq + rw [eq_comm] at app_s_inv_eq + simp [nontrivial_harmonic_common] at app_s_inv_eq + contradiction + + +-#synth OrderTopology ENNReal + + -- Theorem 3.6 - a non-constant harmonic function exists on G + theorem exists_nontrivial_harmonic: ∃ F: LipschitzH , ∀ z: ℝ, F ≠ ConstLipschitzH z := by + by_cases f_n_limit: ∃ s: S, ¬(Filter.Tendsto (fun n: ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0)) +- . exact nontrivial_harmonic_case_two f_n_limit +- . ++ · exact nontrivial_harmonic_case_two f_n_limit ++ · + simp at f_n_limit + exact nontrivial_harmonic_case_one (by + intro s +diff --git a/Gromov/Harmonic/CaseOne.lean b/Gromov/Harmonic/CaseOne.lean +index 4363fa4..0b27514 100644 +--- a/Gromov/Harmonic/CaseOne.lean ++++ b/Gromov/Harmonic/CaseOne.lean +@@ -11,8 +11,6 @@ public import Gromov.Harmonic.Proposition318 + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + attribute [local implicit_reducible] Additive + + namespace GeneratesNS +@@ -30,8 +28,6 @@ open MeasureTheory + + open scoped RealInnerProductSpace + +-set_option maxRecDepth 100000 in +-set_option maxHeartbeats 1000000 in + lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0))): ∃ F: LipschitzH , ∀ z: ℝ, F ≠ ConstLipschitzH z := by + + +@@ -85,12 +81,12 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + rw [← conv_smul] + rw [ ← smul_conv] + rw [conv_assoc_of_lp2] +- . ++ · + rw [← conv_add_right] +- . ++ · + rw [← ENNReal.ofReal_le_ofReal_iff] +- . +- rw [ofReal_norm_eq_enorm] ++ · ++ rw [ofReal_norm] + grw [counting_le_essSup] + rw [essSup_eq_elpNorm_top] + simp only [volume] +@@ -110,10 +106,10 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + exact my_add_haar_eq_count.symm + + refine le_trans (ENNReal.eLpNorm_top_convolution_le (μ := myHaarAddOpp) (c := 1) (p := 2) (q := 2) (hpq := inferInstance) (by apply AEMeasurable.of_discrete) (by apply AEMeasurable.of_discrete) (by intro a b; simp)) ?_ +- . +- simp [norm, volume] at H_n_norm ++ · ++ simp [volume] at H_n_norm + rw [my_add_haar_eq_count] +- simp [H_n_norm] ++ simp + + have sum_norm := proposition_3_18 (G'_n f_n_limit) + have g_inner_laplace := MeasureTheory.L2.inner_def (Laplace (G'_n f_n_limit)) (G'_n f_n_limit) (𝕜 := ℝ) (α := G) +@@ -124,11 +120,11 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + rw [inv_mul_eq_div] at g_inner_laplace + rw [eq_div_iff_mul_eq] at g_inner_laplace + +- . ++ · + simp [eLpNorm, eLpNorm'] + simp [-AddSubgroupClass.coe_sub, -AddSubgroup.coe_sub, MeasureTheory.Lp.norm_def, eLpNorm, eLpNorm', conv_finsupp_lp2] at g_inner_laplace + rw [← ENNReal.ofReal_rpow_of_pos] +- . ++ · + have hkey : (∫⁻ (a : Additive G), ‖(H_n (seq n) s : Additive G → ℝ) a‖ₑ ^ 2 ∂Measure.count) ^ (2 : ℝ)⁻¹ = 1 := by + have h := H_n_norm n + show (∫⁻ (a : G), ‖(H_n (seq n) s : G → ℝ) a‖ₑ ^ 2 ∂Measure.count) ^ (2 : ℝ)⁻¹ = 1 +@@ -136,9 +132,8 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + my_haar_eq_count] using h + rw [hkey, one_mul] + apply ENNReal.rpow_le_rpow +- . ++ · + generalize_proofs p_1 p_2 p_3 +- -- TODO - make this less horrible + grw [Finset.single_le_sum (f := (fun g => ∫⁻ (a : Additive G), ‖(G_n ((seq n) + 1) (by simp) f_n_limit) a + Conv (-↑↑(G_n ((seq n) + 1) (by simp) f_n_limit)) (delta g) a‖ₑ ^ 2 ∂Measure.count)) (s := S) (hf := by simp) (h := (by rw [S_eq_Sinv]; simp [hy]))] + + +@@ -158,9 +153,8 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + apply_fun ENNReal.ofReal at g_inner_laplace + simp at g_inner_laplace + rw [g_inner_laplace] +- norm_cast + rw [ENNReal.ofReal_sum_of_nonneg] +- . ++ · + conv => + rhs + arg 2 +@@ -172,53 +166,53 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + ) (G_n ((seq n) + 1) (by simp) f_n_limit))) + rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] at g_norm + rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_compMeasurePreserving _ _)] at g_norm +- simp [eLpNorm, eLpNorm', Lp.compMeasurePreserving] at g_norm ++ simp [eLpNorm, eLpNorm'] at g_norm + rw [ENNReal.rpow_lt_top_iff_of_pos (by simp)] at g_norm + grind + )] + simp [volume] + simp_rw [my_haar_eq_count] + apply le_refl +- . simp +- . simp +- . ++ · simp ++ · simp ++ · + simpa using S_nonempty + + -- Finset.single_le_sum +- . simp ++ · simp + grind +- . ++ · + apply MeasureTheory.Integrable.of_integral_ne_zero + rw [← g_inner_laplace] + simp [G'_n] + have foo := g_n_conv_norm (seq (n) + 1) (by simp) f_n_limit + grind +- . ++ · + exact NNReal.coe_nonneg _ +- . ++ · + simp [ConvExists] + rw [my_add_haar_eq_count] + apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) +- . infer_instance +- . simp +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . rw [← my_add_haar_eq_count] ++ · infer_instance ++ · simp ++ · apply AEStronglyMeasurable.of_discrete ++ · apply AEStronglyMeasurable.of_discrete ++ · rw [← my_add_haar_eq_count] + apply Lp.memLp +- . rw [← my_add_haar_eq_count] ++ · rw [← my_add_haar_eq_count] + apply Lp.memLp +- . ++ · + simp [ConvExists] + rw [my_add_haar_eq_count] + apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) +- . infer_instance +- . simp +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . rw [← my_add_haar_eq_count] ++ · infer_instance ++ · simp ++ · apply AEStronglyMeasurable.of_discrete ++ · apply AEStronglyMeasurable.of_discrete ++ · rw [← my_add_haar_eq_count] + apply Lp.memLp +- . +- refine ⟨by apply AEStronglyMeasurable.of_discrete, ?_⟩ ++ · ++ unfold MemLp + rw [← my_add_haar_eq_count] + rw [← neg_one_smul ℝ] + rw [conv_smul] +@@ -227,7 +221,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + simp [Conv] + rw [← Function.comp_def (β := Additive G)] + rw [MeasureTheory.eLpNorm_comp_measurePreserving (ν := Measure.count)] +- . ++ · + conv => + arg 1 + arg 1 +@@ -244,44 +238,43 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + + rw [← my_add_haar_eq_count] + grw [ENNReal.eLpNorm_convolution_le_enorm_mul (p := 2) (q := 1)] +- . ++ · + refine ENNReal.mul_lt_top (ENNReal.mul_lt_top (by simp) ?_) ?_ + · exact MeasureTheory.MemLp.eLpNorm_lt_top (MeasureTheory.MemLp.comp_measurePreserving (ν := volume) (Lp.memLp _) measure_preserving_unop_tomul) + · refine MeasureTheory.MemLp.eLpNorm_lt_top (MeasureTheory.MemLp.comp_measurePreserving (ν := volume) ?_ measure_preserving_unop_tomul) + apply Continuous.memLp_of_hasCompactSupport + · fun_prop + · simp [HasCompactSupport, tsupport] +- . simp +- . simp +- . simp +- . simp +- . apply AEMeasurable.of_discrete +- . apply AEMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . rw [my_add_haar_eq_count] ++ · simp ++ · simp ++ · simp ++ · simp ++ · apply AEMeasurable.of_discrete ++ · apply AEMeasurable.of_discrete ++ · apply AEStronglyMeasurable.of_discrete ++ · rw [my_add_haar_eq_count] + apply MeasurePreserving.id +- . rw [← my_haar_eq_count] ++ · rw [← my_haar_eq_count] + apply Lp.memLp +- . rw [← my_haar_eq_count] ++ · rw [← my_haar_eq_count] + simp + apply MemLp.neg + apply Lp.memLp +- . simp ++ · simp + + -- Now rename Hn ∗Gn such that we have added a constant so that Hn ∗Gn(e) = 0 + let new_seq: ℕ → ℕ := seq + let H_G_conv_zero (n: ℕ) (g: G) := ((Conv (H_n ((new_seq n)) s) (G_n ((new_seq n) + 1) (by simp) f_n_limit)) g) - (Conv (H_n ((new_seq n)) s) (G_n ((new_seq n) + 1) (by simp) f_n_limit) 1) + + +- -- TODO - can the lipschitz constant can be improved? + have H_G_conv_zero_lipschitz: ∀ n: ℕ, LipschitzWith ((((2 * #(S))^((2 : ℝ)⁻¹))) + 0) (H_G_conv_zero n) := by + intro n + simp only [H_G_conv_zero] + simp only [new_seq] + apply LipschitzWith.sub +- . ++ · + apply h_n_f_lipschitz +- . apply LipschitzWith.const ++ · apply LipschitzWith.const + + + have H_n_conv_zero_eq: ∀ n: ℕ, (H_G_conv_zero (n) 1) - (H_G_conv_zero (n) s⁻¹) = ‖(G_n ((new_seq n) + 1) (by simp) f_n_limit) - (conv_finsupp_lp2 (((G_n ((new_seq n) + 1) (by simp) f_n_limit))) (delta s) (by simp [delta]))‖ := by +@@ -297,9 +290,9 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + rw [← conv_smul] + rw [ ← smul_conv] + rw [conv_assoc_of_lp2] +- . ++ · + rw [← conv_add_right] +- . ++ · + simp [H_n, conv_finsupp_lp2] + rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_smul _ _)] + rw [conv_smul] +@@ -313,7 +306,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_compMeasurePreserving _ _)] + rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_compMeasurePreserving _ _)] + simp only [convolution, +- ContinuousLinearMap.coe_sub', ContinuousLinearMap.mul_apply', Pi.smul_apply, smul_eq_mul] ++ ContinuousLinearMap.mul_apply', Pi.smul_apply, smul_eq_mul] + simp + have t_fake_inv: ∀ (t: G), (t: (Additive G))⁻¹ = -(Additive.ofMul t) := by + intro t +@@ -346,8 +339,8 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + rw [f_conv_delta_helper] + rw [← Function.comp_def] + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp +- . ++ · apply MeasureTheory.Lp.memLp ++ · + exact measurePreserving_mul_left volume s⁻¹ + )] + rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_neg _)] +@@ -373,8 +366,8 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + rw [f_conv_delta_helper] + rw [← Function.comp_def] + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp +- . ++ · apply MeasureTheory.Lp.memLp ++ · + exact measurePreserving_mul_left volume s⁻¹ + ))‖^2 => + rw [← real_inner_self_eq_norm_sq] +@@ -390,59 +383,58 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + · simp [h] + · field_simp + exact key _ +- . ++ · + simp [ConvExists] + rw [my_add_haar_eq_count] + apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) +- . infer_instance +- . simp +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . rw [← Function.comp_def] ++ · infer_instance ++ · simp ++ · apply AEStronglyMeasurable.of_discrete ++ · apply AEStronglyMeasurable.of_discrete ++ · rw [← Function.comp_def] + apply MeasureTheory.MemLp.comp_measurePreserving +- . apply Lp.memLp +- . simp [volume] ++ · apply Lp.memLp ++ · simp [volume] + rw [my_haar_eq_count] + apply MeasureTheory.MeasurePreserving.id +- . ++ · + apply MeasureTheory.MemLp.comp_measurePreserving +- . apply Lp.memLp +- . simp [volume] ++ · apply Lp.memLp ++ · simp [volume] + rw [my_haar_eq_count] + apply MeasureTheory.MeasurePreserving.id +- . +- -- TODO - deduplicate this ++ · + simp [f_conv_delta_helper] + simp [ConvExists] + rw [my_add_haar_eq_count] + apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) +- . infer_instance +- . simp +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . rw [← Function.comp_def] ++ · infer_instance ++ · simp ++ · apply AEStronglyMeasurable.of_discrete ++ · apply AEStronglyMeasurable.of_discrete ++ · rw [← Function.comp_def] + apply MeasureTheory.MemLp.comp_measurePreserving +- . apply Lp.memLp +- . simp [volume] ++ · apply Lp.memLp ++ · simp [volume] + rw [my_haar_eq_count] + apply MeasureTheory.MeasurePreserving.id +- . ++ · + apply MeasureTheory.MemLp.neg + rw [← Function.comp_def] + apply MeasureTheory.MemLp.comp_measurePreserving +- . apply Lp.memLp +- . ++ · apply Lp.memLp ++ · + simp [volume] + rw [my_haar_eq_count] + refine MeasurePreserving.mul_left Measure.count s⁻¹ ?_ + apply MeasureTheory.MeasurePreserving.id +- . rw [← my_haar_eq_count] ++ · rw [← my_haar_eq_count] + apply Lp.memLp +- . rw [← my_haar_eq_count] ++ · rw [← my_haar_eq_count] + simp + apply MemLp.neg + apply Lp.memLp +- . simp [delta] ++ · simp [delta] + + + have compact_with_fixed_g (g: G): IsCompact (closure ( (Set.range (fun n => H_G_conv_zero n g)))) := by +@@ -468,7 +460,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + rw [dist_comm] at bar + grw [bar] + simp [H_G_conv_zero] +- ring ++ ring_nf + simp + + have new_compact_closure: IsCompact (closure (Set.range (fun n => H_G_conv_zero n))) := by +@@ -494,7 +486,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + rw [dist_comm] at bar + grw [bar] + simp [H_G_conv_zero] +- ring ++ ring_nf + simp + + have arzela_tendsto := IsCompact.tendsto_subseq new_compact_closure (x := fun n => ( +@@ -528,9 +520,9 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + + have new_tendsto_sub := (abs_tendsto _).comp ((tendsto_arzela_lim x).sub (tendsto_arzela_lim y)) + have sub_le := le_of_tendsto new_tendsto_sub (b := ((↑(#S) * 2) ^ (2 : ℝ)⁻¹) * (dist x y)) ?_ +- . norm_cast ++ · norm_cast + norm_cast at sub_le +- . apply Filter.Eventually.of_forall ++ · apply Filter.Eventually.of_forall + intro n + have foo := (H_G_conv_zero_lipschitz (arzela_seq n)).dist_le_mul x y + rw [Real.dist_eq] at foo +@@ -547,7 +539,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + intro x + rw [← sub_eq_zero] + +- have sum_lim := tendsto_finset_sum (s := S) (fun s hs => tendsto_arzela_lim (s * x)) ++ have sum_lim := tendsto_finsetSum (s := S) (fun s hs => tendsto_arzela_lim (s * x)) + have tendsto_sub := (tendsto_arzela_lim x).sub (sum_lim.const_mul ((#S : ℝ))⁻¹) + norm_cast + +@@ -555,13 +547,13 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + (f := (fun x_1 ↦ |((fun n ↦ H_G_conv_zero n) ∘ arzela_seq) x_1 x - (↑(#S))⁻¹ * ∑ c ∈ S, ((fun n ↦ H_G_conv_zero n) ∘ arzela_seq) x_1 (c * x)|)) + (g := fun n => (1 / (n + 1))) + ?_ ?_ ?_ +- . ++ · + have target_eq_zero := tendsto_nhds_unique ((abs_tendsto _).comp tendsto_sub) (lim_zero) + rw [abs_eq_zero] at target_eq_zero + rw [sub_eq_zero] at target_eq_zero + simp [target_eq_zero] +- . simp +- . intro n ++ · simp ++ · intro n + simp + conv => + lhs +@@ -588,7 +580,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + grw [abs_add_le] + simp + rw [laplace_conv_eq_laplace_right_of_lp2] +- . ++ · + simp [Conv] + grw [ENNReal.ofReal_add_le] + rw [← Real.enorm_eq_ofReal_abs] +@@ -619,7 +611,7 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + · rw [ENNReal.inv_top, zero_add]; exact ENNReal.inv_two_add_inv_two + · apply AEMeasurable.of_discrete + · apply AEMeasurable.of_discrete +- . ++ · + conv => + lhs + arg 1 +@@ -661,32 +653,31 @@ lemma nontrivial_harmonic_case_one (f_n_limit: ∀ s: S, (Filter.Tendsto (fun n: + + omega + +- . +- -- TODO - deduplicate this ++ · + simp [ConvExists] + rw [my_add_haar_eq_count] + apply ENNReal.ConvolutionExists.of_memLp_memLp (p := 2) (q := 2) (μ := Measure.count) +- . infer_instance +- . simp +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . rw [← Function.comp_def] ++ · infer_instance ++ · simp ++ · apply AEStronglyMeasurable.of_discrete ++ · apply AEStronglyMeasurable.of_discrete ++ · rw [← Function.comp_def] + apply MeasureTheory.MemLp.comp_measurePreserving +- . apply Lp.memLp +- . simp [volume] ++ · apply Lp.memLp ++ · simp [volume] + rw [my_haar_eq_count] + apply MeasureTheory.MeasurePreserving.id +- . ++ · + apply MeasureTheory.MemLp.comp_measurePreserving +- . apply Lp.memLp +- . simp [volume] ++ · apply Lp.memLp ++ · simp [volume] + rw [my_haar_eq_count] + apply MeasureTheory.MeasurePreserving.id +- . rw [← my_haar_eq_count] ++ · rw [← my_haar_eq_count] + apply Lp.memLp +- . rw [← my_haar_eq_count] ++ · rw [← my_haar_eq_count] + apply Lp.memLp +- . ++ · + simp + simp_rw [inv_eq_one_div] + apply tendsto_one_div_add_atTop_nhds_zero_nat +diff --git a/Gromov/Harmonic/Convolution.lean b/Gromov/Harmonic/Convolution.lean +index 9721ae6..c14260c 100644 +--- a/Gromov/Harmonic/Convolution.lean ++++ b/Gromov/Harmonic/Convolution.lean +@@ -19,8 +19,6 @@ multiplication, and `laplace_conv_eq_laplace_right`. + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + attribute [local implicit_reducible] Additive + + namespace GeneratesNS +@@ -49,30 +47,28 @@ lemma harmonic_maximum_implies_const (f: G → ℝ) (hf: Laplace_b f = 0) (a: G + rw [ih] at f_at_l + field_simp at f_at_l + +- -- TODO - is there a 'Finset.expect' theorem we can use? +- -- TODO - upstream this to mathlib in some form + have f_s_eq: ∀ s: S, f a = f (s * (l.unattach.prod * a)) := by + by_contra! + simp at this + obtain ⟨s, s_mem_s, hs⟩ := this + by_cases val_le_max: f (s * (l.unattach.prod * a)) ≤ f a +- . ++ · + have val_lt_max: f (s * (l.unattach.prod * a)) < f a := by + exact lt_of_le_of_ne (h_max (↑s * (l.unattach.prod * a))) (id (Ne.symm hs)) + + have sum_strict_lt := Finset.sum_lt_sum (f := fun x => f (x * (l.unattach.prod * a))) (g := fun x => f a) (s := S) ?_ ?_ +- . ++ · + simp at sum_strict_lt + rw [mul_comm] at sum_strict_lt + rw [← div_lt_iff₀] at sum_strict_lt +- . ++ · + apply ne_of_gt at sum_strict_lt + contradiction +- . simpa using S_nonempty +- . intro s hs ++ · simpa using S_nonempty ++ · intro s hs + apply h_max +- . use s +- . ++ · use s ++ · + have val_gt := h_max (s * (l.unattach.prod * a)) + simp at val_le_max + linarith +@@ -102,7 +98,7 @@ open scoped Convolution + open MeasureTheory + + +-lemma laplace_b_const (k: ℝ): Laplace_b (fun g => k) = 0 := by ++lemma laplace_b_const (k: ℝ): Laplace_b (fun _g => k) = 0 := by + simp [Laplace_b] + simp [f_conv_mu] + ext a +@@ -111,8 +107,8 @@ lemma laplace_b_const (k: ℝ): Laplace_b (fun g => k) = 0 := by + rw [← mul_assoc] + + rw [inv_mul_cancel₀] +- . simp +- . simp ++ · simp ++ · simp + have foo := S_nonempty + grind + +@@ -129,9 +125,9 @@ lemma conv_add_right {f g h: G → ℝ} (h_fg: ConvExists f g) (h_fh : ConvExist + rfl + + rw [MeasureTheory.ConvolutionExists.distrib_add] +- . rfl +- . exact h_fg +- . exact h_fh ++ · rfl ++ · exact h_fg ++ · exact h_fh + + lemma conv_add_left {f g h: G → ℝ} (h_fh: ConvExists f h) (h_gh : ConvExists g h): Conv (f + g) h = Conv f h + Conv g h := by + unfold Conv +@@ -143,9 +139,9 @@ lemma conv_add_left {f g h: G → ℝ} (h_fh: ConvExists f h) (h_gh : ConvExists + rfl + + rw [MeasureTheory.ConvolutionExists.add_distrib] +- . rfl +- . exact h_fh +- . exact h_gh ++ · rfl ++ · exact h_fh ++ · exact h_gh + + lemma conv_smul {f h: G → ℝ} (k: ℝ): Conv (k • f) h = k • Conv f h := by + funext g +@@ -176,7 +172,6 @@ lemma laplace_conv_eq_laplace_right_of_lp2 (f g: G → ℝ) (hfg: ConvExists f g + + nth_rw 2 [sub_eq_add_neg] + rw [conv_add_right] +- -- TODO - figure out how to do this without a 'conv' block + conv => + rhs + rhs +@@ -184,24 +179,24 @@ lemma laplace_conv_eq_laplace_right_of_lp2 (f g: G → ℝ) (hfg: ConvExists f g + simp + rw [smul_conv] + simp +- . rw [← sub_eq_add_neg] +- . exact hfg +- . ++ · rw [← sub_eq_add_neg] ++ · exact hfg ++ · + simp [ConvExists, MeasureTheory.ConvolutionExists, MeasureTheory.ConvolutionExistsAt] + intro a + simp_rw [f_conv_mu] + simp_rw [← mul_assoc, mul_comm, mul_assoc] + apply MeasureTheory.Integrable.const_mul + simp_rw [Finset.mul_sum] +- apply MeasureTheory.integrable_finset_sum ++ apply MeasureTheory.integrable_finsetSum + intro s hs + simp [ConvExists, MeasureTheory.ConvolutionExists, MeasureTheory.ConvolutionExistsAt] at hfg + specialize hfg (s * a) + simp_rw [mul_div] + exact hfg +- . exact hf +- . exact hg +- . apply mu_finsupp ++ · exact hf ++ · exact hg ++ · apply mu_finsupp + + + lemma laplace_conv_eq_laplace_right (f g: G → ℝ) (hfg: ConvExists f g) (g_nonneg: ∀ a: G, 0 ≤ g a) (g_finsupp: g.support.Finite): Laplace_b (Conv f g) = Conv f (Laplace_b g) := by +@@ -210,7 +205,6 @@ lemma laplace_conv_eq_laplace_right (f g: G → ℝ) (hfg: ConvExists f g) (g_no + + nth_rw 2 [sub_eq_add_neg] + rw [conv_add_right] +- -- TODO - figure out how to do this without a 'conv' block + conv => + rhs + rhs +@@ -218,34 +212,33 @@ lemma laplace_conv_eq_laplace_right (f g: G → ℝ) (hfg: ConvExists f g) (g_no + simp + rw [smul_conv] + simp +- . rw [← sub_eq_add_neg] +- . exact hfg +- . ++ · rw [← sub_eq_add_neg] ++ · exact hfg ++ · + simp [ConvExists, MeasureTheory.ConvolutionExists, MeasureTheory.ConvolutionExistsAt] + intro a + simp_rw [f_conv_mu] + simp_rw [← mul_assoc, mul_comm, mul_assoc] + apply MeasureTheory.Integrable.const_mul + simp_rw [Finset.mul_sum] +- apply MeasureTheory.integrable_finset_sum ++ apply MeasureTheory.integrable_finsetSum + intro s hs + simp [ConvExists, MeasureTheory.ConvolutionExists, MeasureTheory.ConvolutionExistsAt] at hfg + specialize hfg (s * a) + simp_rw [mul_div] + exact hfg +- . exact hfg +- . ++ · exact hfg ++ · + apply conv_exists_fin_supp + right + exact mu_finsupp +- . apply g_finsupp +- . exact g_nonneg +- . exact mu_finsupp +- . intro a ++ · apply g_finsupp ++ · exact g_nonneg ++ · exact mu_finsupp ++ · intro a + simp [mu] + positivity + +-#print axioms laplace_conv_eq_laplace_right + + + -- simp_rw [tsum_eq_sum] +@@ -257,14 +250,13 @@ lemma f_n_fin_supp (n: ℕ): (f_n n).support.Finite := by + apply Set.Finite.inter_of_right + apply Set.Finite.subset (hs := ?_) (ht := Finset.support_sum _ _) + refine Set.Finite.biUnion' ?_ ?_ +- . exact Set.toFinite (Membership.mem Finset.univ.val) +- . intro m hm ++ · exact Set.toFinite (Membership.mem Finset.univ.val) ++ · intro m hm + apply mu_conv_finsupp + + + -- The expression 'Σ s_1, ..., s_n ∈ S, f(s_1 * ... * s_n)' + -- This is a sum over all n-tuples of elements in S, where each term in is f (s_1 * ... * s_n) +--- TODO - is there aless horrible way to write in in mathlib? + @[expose] + def NTupleSum (n: ℕ) (f: G → ℝ): ℝ := ∑ s : (Fin n → S), f ((List.ofFn s).unattach.prod) + +diff --git a/Gromov/Harmonic/LaplaceLinear.lean b/Gromov/Harmonic/LaplaceLinear.lean +index 81f7578..50a9795 100644 +--- a/Gromov/Harmonic/LaplaceLinear.lean ++++ b/Gromov/Harmonic/LaplaceLinear.lean +@@ -11,17 +11,15 @@ public import Gromov.Harmonic.MuConv + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + attribute [local implicit_reducible] Additive + + namespace GeneratesNS + open Generates + +-variable [hGS: Generates] ++variable [hGS : Generates] + include hGS + +-variable {V: Submodule ℝ LipschitzH} [V_finite: FiniteDimensional ℝ V] [Nontrivial V] ++variable {V : Submodule ℝ LipschitzH} [V_finite : FiniteDimensional ℝ V] [Nontrivial V] + + open scoped Finset + open scoped Pointwise +@@ -30,20 +28,20 @@ open MeasureTheory + + set_option maxHeartbeats 60000 in + @[expose] +-noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: Filter.Tendsto seq Filter.atTop Filter.atTop) (F: G → ℝ) (H_n: ℕ → G → ℝ) (h_conv_lipschitz: ∀ n, LipschitzWith k (Conv (H_n n) (f_n n))) +-(tendsto_F: Filter.Tendsto ((fun n ↦ Conv (H_n (seq n)) (f_n (seq n)))) Filter.atTop (nhds F)) +-(H_n_norm: ∀ n: ℕ, MeasureTheory.eLpNorm (H_n n) (p := ⊤) MeasureTheory.volume = 1): LipschitzH := by ++noncomputable def nontrivial_harmonic_common (k : ℕ) (seq : ℕ → ℕ) (h_seq : Filter.Tendsto seq Filter.atTop Filter.atTop) (F : G → ℝ) (H_n : ℕ → G → ℝ) (h_conv_lipschitz : ∀ n, LipschitzWith k (Conv (H_n n) (f_n n))) ++(tendsto_F : Filter.Tendsto ((fun n ↦ Conv (H_n (seq n)) (f_n (seq n)))) Filter.atTop (nhds F)) ++(H_n_norm : ∀ n : ℕ, MeasureTheory.eLpNorm (H_n n) (p := ⊤) MeasureTheory.volume = 1) : LipschitzH := by + +- let conv_h_n_cont (n: ℕ): C(G, ℝ) := { ++ let conv_h_n_cont (n : ℕ) : C(G, ℝ) := { + toFun := Conv (H_n (seq n)) (f_n (seq n)), + continuous_toFun := by exact continuous_of_discreteTopology + } + +- let F_lipschitzh: LipschitzH := { +- toFun := (fun (g: G) => F g), ++ let F_lipschitzh : LipschitzH := { ++ toFun := (fun (g : G) => F g), + lipschitz := by + use k +- have closed_lipschitz := isClosed_setOf_lipschitzWith (α := G) (β := ℝ) k ++ have closed_lipschitz := isClosed_setOfPred_lipschitzWith (α := G) (β := ℝ) k + apply IsClosed.isSeqClosed at closed_lipschitz + simp [IsSeqClosed] at closed_lipschitz + have F_lipschitz := closed_lipschitz (p := F) (x := (fun n ↦ Conv (H_n (seq n)) (f_n (seq n)))) (by +@@ -55,20 +53,16 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: + simp [Harmonic] + intro g + rw [tendsto_pi_nhds] at tendsto_F +- have lim_f_sum := tendsto_finset_sum (ι := S) (M := ℝ) (s := Finset.univ) (a := fun s => F (s.val * g)) (f := (fun (s: S) n ↦ Conv (H_n (seq n)) (f_n (seq n)) (s.val *g))) (x := Filter.atTop (α := ℕ)) ?_ +- +- -- TODO - figure out why lean hangs without this ++ have lim_f_sum := tendsto_finsetSum (ι := S) (M := ℝ) (s := Finset.univ) (a := fun s => F (s.val * g)) (f := (fun (s : S) n ↦ Conv (H_n (seq n)) (f_n (seq n)) (s.val *g))) (x := Filter.atTop (α := ℕ)) ?_ + have my_mul : ContinuousMul ℝ := instIsTopologicalRingReal.toContinuousMul + have lim_f_mul_sum := Filter.Tendsto.const_mul ((#S) : ℝ)⁻¹ lim_f_sum +- . +- have lim_f_g := tendsto_F g ++ · have lim_f_g := tendsto_F g + have lim_f_g_sub := Filter.Tendsto.sub lim_f_g lim_f_mul_sum + +- have laplace_conv_tendsto_zero: Filter.Tendsto (fun n => eLpNorm (Laplace_b (Conv (H_n (seq n)) (f_n (seq n)))) ⊤) Filter.atTop (nhds 0) := by +- apply tendsto_of_tendsto_of_tendsto_of_le_of_le (g := fun n => 0) (h := fun (n: ℕ) => ENNReal.ofReal ((2: ℝ) / ((seq n) + 1) : ℝ)) +- . simp +- . +- rw [← ENNReal.tendsto_toReal_iff] ++ have laplace_conv_tendsto_zero : Filter.Tendsto (fun n => eLpNorm (Laplace_b (Conv (H_n (seq n)) (f_n (seq n)))) ⊤) Filter.atTop (nhds 0) := by ++ apply tendsto_of_tendsto_of_tendsto_of_le_of_le (g := fun n => 0) (h := fun (n : ℕ) => ENNReal.ofReal ((2 : ℝ) / ((seq n) + 1) : ℝ)) ++ · simp ++ · rw [← ENNReal.tendsto_toReal_iff] + conv => + arg 1 + intro n +@@ -80,36 +74,34 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: + arg 1 + intro n + rhs +- equals ((((((seq n) + 1): ℕ)) : ℕ ) : ℝ) => simp ++ equals ((((((seq n) + 1) : ℕ)) : ℕ ) : ℝ) => simp + conv => + arg 1 +- equals (fun (n: ℕ) => (2 : ℝ) / (n) ) ∘ (fun n => (seq n) + 1) => ++ equals (fun (n : ℕ) => (2 : ℝ) / (n) ) ∘ (fun n => (seq n) + 1) => + ext n + simp + apply Filter.Tendsto.comp +- . +- conv => ++ · conv => + arg 1 +- equals (fun (n: ℕ) => (2 : ℝ) / ((n) : ℕ)) => ++ equals (fun (n : ℕ) => (2 : ℝ) / ((n) : ℕ)) => + ext n + simp + apply tendsto_const_div_atTop_nhds_zero_nat +- . +- apply Filter.Tendsto.comp +- . conv => ++ · apply Filter.Tendsto.comp ++ · conv => + arg 1 + equals fun n => n + 1 => + simp + apply Filter.tendsto_add_atTop_nat + +- . simp ++ · simp + exact h_seq +- . simp +- . simp +- . rw [Pi.le_def] ++ · simp ++ · simp ++ · rw [Pi.le_def] + intro x + simp +- . rw [Pi.le_def] ++ · rw [Pi.le_def] + intro n + simp + have bound_by_norm_one := conv_laplce_norm (seq n) +@@ -118,7 +110,7 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: + simp at bound_by_norm_one + grw [bound_by_norm_one] + have h_norm := H_n_norm (seq n) +- simp [eLpNorm, eLpNorm'] at h_norm ++ simp [eLpNorm] at h_norm + rw [h_norm] + simp + simp_rw [Laplace_b] +@@ -127,33 +119,30 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: + + rw [← ENNReal.tendsto_toReal_iff] at laplace_conv_tendsto_zero + +- have laplace_real_tendsto_zero: Filter.Tendsto (fun n => |(Laplace_b (Conv (H_n (seq n)) (f_n (seq n))) (g))|) Filter.atTop (nhds 0) := by ++ have laplace_real_tendsto_zero : Filter.Tendsto (fun n => |(Laplace_b (Conv (H_n (seq n)) (f_n (seq n))) (g))|) Filter.atTop (nhds 0) := by + apply squeeze_zero (g := fun n => (eLpNorm (Laplace_b (Conv (H_n (seq n)) (f_n (seq n)))) ⊤ volume).toReal) +- . +- intro n ++ · intro n + simp +- . intro n ++ · intro n + have ae_le := ENNReal.ae_le_essSup (fun x ↦ ‖Laplace_b (Conv (H_n (seq n)) (f_n (seq n))) x‖ₑ) (μ := volume) + simp [volume] at ae_le + rw [my_haar_eq_count] at ae_le + rw [count_ae_everywhere] at ae_le + specialize ae_le g +- simp [eLpNorm, eLpNorm'] ++ simp [eLpNorm] + simp [eLpNormEssSup] + rw [← ENNReal.toReal_le_toReal] at ae_le +- simp only [toReal_enorm, Real.norm_eq_abs, OrderTop.bddAbove] at ae_le ++ simp only [toReal_enorm, Real.norm_eq_abs] at ae_le + simp [volume] + rw [my_haar_eq_count] + exact ae_le +- . simp +- . +- -- TODO - deduplicate this +- have bound_by_norm_one := conv_laplce_norm (seq n) H_n ++ · simp ++ · have bound_by_norm_one := conv_laplce_norm (seq n) H_n + have norm_le_two_div := f_n_sub_conv (seq n) + nth_rw 1 [eLpNorm] at bound_by_norm_one + simp at bound_by_norm_one + have h_norm := H_n_norm (seq n) +- simp [eLpNorm, eLpNorm'] at h_norm ++ simp [eLpNorm] at h_norm + rw [h_norm] at bound_by_norm_one + simp only [eLpNormEssSup] at bound_by_norm_one + simp [volume] at bound_by_norm_one +@@ -165,11 +154,10 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: + rw [my_haar_eq_count] at norm_le_two_div + grw [norm_le_two_div] + apply ENNReal.ofReal_lt_top +- . apply laplace_conv_tendsto_zero ++ · apply laplace_conv_tendsto_zero + + simp_rw [Laplace_b] at laplace_real_tendsto_zero + simp_rw [f_conv_mu] at laplace_real_tendsto_zero +- beta_reduce at laplace_real_tendsto_zero + conv at laplace_real_tendsto_zero => + arg 1 + rw [← Function.comp_def] +@@ -191,17 +179,15 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: + rw [eq_comm] at lim_eq + rw [sub_eq_zero] at lim_eq + rw [lim_eq] +- norm_cast + rw [← Finset.sum_subtype (s := S) (f := fun i => (F (i * g)))] + simp +- . intro n +- -- TODO - deduplicate this. I'm sure there's lots of other versions of it scattered around this file ++ · intro n + rw [← lt_top_iff_ne_top] + grw [conv_laplce_norm] + rw [H_n_norm] + simp + simp_rw [Laplace_b] +- grw [MeasureTheory.eLpNorm_sub_le] ++ grw [MeasureTheory.eLpNorm_sub_le (by norm_num)] + rw [f_n_norm_one] + simp_rw [f_conv_mu] + simp_rw [← smul_eq_mul] +@@ -216,8 +202,7 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: + funext g + simp + +- +- grw [MeasureTheory.eLpNorm_sum_le] ++ grw [MeasureTheory.eLpNorm_sum_le (by norm_num)] + simp_rw [← Function.comp_def] + conv => + lhs +@@ -241,26 +226,17 @@ noncomputable def nontrivial_harmonic_common (k: ℕ) (seq: ℕ → ℕ) (h_seq: + norm_cast + rw [Real.enorm_eq_ofReal_abs] + simp +- norm_cast + apply ENNReal.mul_lt_top +- . simp +- . simp +- . +- intro s hs +- apply AEStronglyMeasurable.of_discrete +- . simp +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . simp +- +- +- . simp +- . intro s hs ++ · simp ++ · simp ++ ++ · simp ++ · intro s hs + apply tendsto_F + } + exact F_lipschitzh + +-lemma counting_le_essSup (f: G → ℝ): ∀ g : G, ‖f g‖ₑ ≤ essSup (fun g => ‖f g‖ₑ) volume := by ++lemma counting_le_essSup (f : G → ℝ) : ∀ g : G, ‖f g‖ₑ ≤ essSup (fun g => ‖f g‖ₑ) volume := by + intro g + have ae_le := ENNReal.ae_le_essSup (fun g => ‖f g‖ₑ) (μ := volume) + simp [MeasureTheory.volume] at ae_le +@@ -272,12 +248,12 @@ lemma counting_le_essSup (f: G → ℝ): ∀ g : G, ‖f g‖ₑ ≤ essSup (fu + rw [my_haar_eq_count] + exact ae_le + +-lemma essSup_eq_elpNorm_top (f: G → ℝ): (essSup (fun g => ‖f g‖ₑ) volume) = (eLpNorm f ⊤ volume) := by ++lemma essSup_eq_elpNorm_top (f : G → ℝ) : (essSup (fun g => ‖f g‖ₑ) volume) = (eLpNorm f ⊤ volume) := by ++ rw [MeasureTheory.eLpNorm_exponent_top (by apply AEStronglyMeasurable.of_discrete)] + rfl + +- + @[expose] +-noncomputable def Laplace_linear: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G))) →ₗ[ℝ] (MeasureTheory.Lp ℝ 2 (μ := volume (α := G))) := { ++noncomputable def Laplace_linear : (MeasureTheory.Lp ℝ 2 (μ := volume (α := G))) →ₗ[ℝ] (MeasureTheory.Lp ℝ 2 (μ := volume (α := G))) := { + toFun := Laplace + map_add' := by + intro x y +@@ -300,13 +276,12 @@ noncomputable def Laplace_linear: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G + )] + + rw [MeasureTheory.MemLp.toLp_add] +- . abel +- . +- have foo := MeasureTheory.Lp.memLp (conv_mu_lp2 x) ++ · abel_nf ++ · have foo := MeasureTheory.Lp.memLp (conv_mu_lp2 x) + simp [conv_mu_lp2] at foo + rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] at foo + exact foo +- . have foo := MeasureTheory.Lp.memLp (conv_mu_lp2 y) ++ · have foo := MeasureTheory.Lp.memLp (conv_mu_lp2 y) + simp [conv_mu_lp2] at foo + rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] at foo + exact foo +@@ -321,9 +296,8 @@ noncomputable def Laplace_linear: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G + rw [smul_sub] + } + +- + @[expose] +-instance volume_finite_compact: IsFiniteMeasureOnCompacts (volume (α := G)) := by ++instance volume_finite_compact : IsFiniteMeasureOnCompacts (volume (α := G)) := by + simp [volume] + rw [my_haar_eq_count] + exact { +@@ -333,18 +307,15 @@ instance volume_finite_compact: IsFiniteMeasureOnCompacts (volume (α := G)) := + exact Measure.count_apply_lt_top.mpr finite + } + +- +-lemma finsupp_lp_top (f: G → ℝ) (hf: f.support.Finite) (p: ENNReal): MeasureTheory.MemLp f p (Measure.count) := by ++lemma finsupp_lp_top (f : G → ℝ) (hf : f.support.Finite) (p : ENNReal) : MeasureTheory.MemLp f p (Measure.count) := by + rw [← my_haar_eq_count] + apply Continuous.memLp_of_hasCompactSupport +- . apply continuous_of_discreteTopology +- . +- simp [HasCompactSupport] ++ · apply continuous_of_discreteTopology ++ · simp [HasCompactSupport] + rw [isCompact_iff_finite] + simp [tsupport] + exact hf + +- + @[expose] + noncomputable def F_n (n : ℕ) := Real.sqrt ∘ (f_n n) + @[expose] +@@ -354,32 +325,29 @@ noncomputable def F_n_lp2 (n : ℕ) := MeasureTheory.MemLp.toLp (F_n n) (by + apply finsupp_lp_top + simp [F_n] + apply Set.Finite.subset (s := (f_n n).support) +- . +- unfold f_n ++ · unfold f_n + apply f_n_fin_supp +- . +- apply Function.support_comp_subset ++ · apply Function.support_comp_subset + simp + ) (μ := volume (α := G)) (p := 2) + +- + @[expose] +-instance volume_mul_left_invariant: (volume (α := G)).IsMulLeftInvariant := by ++instance volume_mul_left_invariant : (volume (α := G)).IsMulLeftInvariant := by + simp [volume] + rw [my_haar_eq_count] + infer_instance + + omit hGS in +-lemma abs_sub_le_abs_add (a b: ℝ) (ha: 0 ≤ a) (hb: 0 ≤ b): |a - b| ≤ |a + b| := by ++lemma abs_sub_le_abs_add (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : |a - b| ≤ |a + b| := by + rw [abs_sub_le_iff] + refine ⟨?_, ?_⟩ +- . +- rw [le_abs] ++ · rw [le_abs] + grind +- . rw [le_abs] ++ · rw [le_abs] + grind + +-lemma norm_sub_squared_le (a b : ℝ) (ha: 0 ≤ a) (hb: 0 ≤ b): (a - b)^2 ≤ |a^2 - b^2| := by ++omit hGS in ++lemma norm_sub_squared_le [_hGS : Generates] (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : (a - b)^2 ≤ |a^2 - b^2| := by + conv => + lhs + rw [← sq_abs] +@@ -388,56 +356,46 @@ lemma norm_sub_squared_le (a b : ℝ) (ha: 0 ≤ a) (hb: 0 ≤ b): (a - b)^2 ≤ + rw [sq_sub_sq] + rw [abs_mul] + nth_rw 2 [mul_comm] +- -- TODO - why doesn't grw work here? + apply mul_le_mul +- . simp +- . apply abs_sub_le_abs_add a b ha hb +- . simp +- . simp +- ++ · simp ++ · apply abs_sub_le_abs_add a b ha hb ++ · simp ++ · simp + + @[expose] +-def f_n_conv_delta_tendsto: Prop := ∀ s: S, Filter.Tendsto (fun n: ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0) +- ++def f_n_conv_delta_tendsto : Prop := ∀ s : S, Filter.Tendsto (fun n : ℕ => MeasureTheory.eLpNorm (f_n n - (Conv (f_n n) (delta s.val))) 1 MeasureTheory.volume) Filter.atTop (nhds 0) + +-lemma f_conv_delta_helper (f: G → ℝ) (s: G): (Conv f (delta s)) = fun g => f (s⁻¹ * g) := by ++lemma f_conv_delta_helper (f : G → ℝ) (s : G) : (Conv f (delta s)) = fun g => f (s⁻¹ * g) := by + funext g + exact f_conv_delta f g s + +- + -- Lemma 3.16 in Vikman + + -- The case split statement in Vikman + +-lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): +- Filter.Tendsto (fun n => ‖(F_n_lp2 n) - conv_mu_lp2 (F_n_lp2 n)‖ₑ) Filter.atTop (nhds 0) := by ++lemma F_n_conv_mu_lim (f_n_limit : f_n_conv_delta_tendsto) : Filter.Tendsto (fun n => ‖(F_n_lp2 n) - conv_mu_lp2 (F_n_lp2 n)‖ₑ) Filter.atTop (nhds 0) := by + +- have f_n_sub_norm: ∀ s ∈ S, ∀ (i : ℕ), ∑' (g : G), ‖f_n i g - f_n i (s * g)‖ₑ ≠ ⊤ := by ++ have f_n_sub_norm : ∀ s ∈ S, ∀ (i : ℕ), ∑' (g : G), ‖f_n i g - f_n i (s * g)‖ₑ ≠ ⊤ := by + intro s hs n + have foo := f_n_norm_one n + rw [← lt_top_iff_ne_top] +- rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (by simp) (by simp)] at foo ++ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (by simp) (by simp) (by apply AEStronglyMeasurable.of_discrete)] at foo + rw [lintegral_g_eq_add] at foo + simp at foo + grw [ENNReal.tsum_le_tsum (g := fun g => ‖f_n n g‖ₑ + ‖(f_n n (s * g))‖ₑ)] +- . +- rw [ENNReal.tsum_add] ++ · rw [ENNReal.tsum_add] + rw [ENNReal.add_lt_top] +- . refine ⟨?_, ?_⟩ +- . simp [foo] +- . +- grw [ENNReal.tsum_comp_le_tsum_of_injective (g := fun a => ‖f_n n a‖ₑ)] +- . +- simp [foo] +- . intro a b hab ++ · refine ⟨?_, ?_⟩ ++ · simp [foo] ++ · grw [ENNReal.tsum_comp_le_tsum_of_injective (g := fun a => ‖f_n n a‖ₑ)] ++ · simp [foo] ++ · intro a b hab + simpa using hab +- . +- intro a ++ · intro a + grw [enorm_sub_le] + + rw [← ENNReal.tendsto_toReal_iff] +- . +- have S_ne: (#S : ℝ) ≠ 0 := by ++ · have S_ne : (#S : ℝ) ≠ 0 := by + simp + have foo := hGS.hS + simp at foo +@@ -476,57 +434,38 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): + simp_rw [← Finset.sum_sub_distrib] + rw [ENNReal.toReal_zero] + +- +- apply squeeze_zero (g := fun n => (1 / ↑(#S : ℝ)) • ∑ x ∈ S, (eLpNorm ((F_n_lp2 n).val.cast - (fun (g: G) => (F_n_lp2 n) (x * g))) 2 volume).toReal) +- . simp +- . +- intro n ++ apply squeeze_zero (g := fun n => (1 / ↑(#S : ℝ)) • ∑ x ∈ S, (eLpNorm ((F_n_lp2 n).val.cast - (fun (g : G) => (F_n_lp2 n) (x * g))) 2 volume).toReal) ++ · simp ++ · intro n + rw [eLpNorm_const_smul] +- grw [eLpNorm_sum_le] +- . +- simp ++ grw [eLpNorm_sum_le (by norm_num)] ++ · simp + rw [ENNReal.toReal_sum] + intro s hs + rw [← lt_top_iff_ne_top] +- grw [eLpNorm_sub_le] +- . +- rw [ENNReal.add_lt_top] +- . refine ⟨?_, ?_⟩ +- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) +- . +- simp_rw [← Function.comp_def] ++ grw [eLpNorm_sub_le (by norm_num)] ++ · rw [ENNReal.add_lt_top] ++ · refine ⟨?_, ?_⟩ ++ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) ++ · simp_rw [← Function.comp_def] + rw [MeasureTheory.eLpNorm_comp_measurePreserving] +- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) +- . apply AEStronglyMeasurable.of_discrete +- . exact measurePreserving_mul_left volume s +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . simp +- . +- apply ENNReal.mul_ne_top (by simp) ++ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) ++ · apply AEStronglyMeasurable.of_discrete ++ · exact measurePreserving_mul_left volume s ++ · apply ENNReal.mul_ne_top (by simp) + rw [ENNReal.sum_ne_top] +- -- TODO - deduplicate this + intro s hs + rw [← lt_top_iff_ne_top] +- grw [eLpNorm_sub_le] +- . +- rw [ENNReal.add_lt_top] +- . refine ⟨?_, ?_⟩ +- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) +- . +- simp_rw [← Function.comp_def] ++ grw [eLpNorm_sub_le (by norm_num)] ++ · rw [ENNReal.add_lt_top] ++ · refine ⟨?_, ?_⟩ ++ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) ++ · simp_rw [← Function.comp_def] + rw [MeasureTheory.eLpNorm_comp_measurePreserving] +- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) +- . apply AEStronglyMeasurable.of_discrete +- . exact measurePreserving_mul_left volume s +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . simp +- . intro s hs +- apply AEStronglyMeasurable.of_discrete +- . simp +- . +- conv => ++ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) ++ · apply AEStronglyMeasurable.of_discrete ++ · exact measurePreserving_mul_left volume s ++ · conv => + rhs + equals nhds ((1 / ↑(#S : ℝ)) • 0) => + simp +@@ -534,7 +473,7 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): + apply Filter.Tendsto.const_smul + conv => + rhs +- equals nhds (∑ x_1 ∈ S⁻¹, (0: ℝ)) => ++ equals nhds (∑ x_1 ∈ S⁻¹, (0 : ℝ)) => + simp + conv => + arg 1 +@@ -542,30 +481,26 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): + arg 1 + equals S⁻¹ => + apply S_eq_Sinv +- apply tendsto_finset_sum ++ apply tendsto_finsetSum + intro s hs + conv => + arg 1 + intro n +- rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (by simp) (by simp)] ++ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (by simp) (by simp) (by apply AEStronglyMeasurable.of_discrete)] + rw [lintegral_g_eq_add] + + simp + apply squeeze_zero (g := (fun n ↦ ((∑' (g : G), ‖(f_n n) g - (f_n n) (s * g)‖ₑ) ^ (2 : ℝ)⁻¹).toReal)) +- . simp +- . +- intro n ++ · simp ++ · intro n + rw [ENNReal.toReal_le_toReal] +- . +- apply ENNReal.rpow_le_rpow +- . +- apply ENNReal.tsum_le_tsum ++ · apply ENNReal.rpow_le_rpow ++ · apply ENNReal.tsum_le_tsum + intro g + rw [Real.enorm_eq_ofReal_abs] + rw [Real.enorm_eq_ofReal_abs] + rw [← ENNReal.ofReal_pow] +- . +- apply ENNReal.ofReal_le_ofReal ++ · apply ENNReal.ofReal_le_ofReal + simp [F_n_lp2] + simp [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] + simp [F_n] +@@ -574,47 +509,39 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): + arg 1 + equals (Real.sqrt (f_n n g))^2 - (Real.sqrt (f_n n (s * g)))^2 => + rw [Real.sq_sqrt] +- . +- rw [Real.sq_sqrt] +- . apply f_n_nonneg +- . apply f_n_nonneg ++ · rw [Real.sq_sqrt] ++ · apply f_n_nonneg ++ · apply f_n_nonneg + + apply norm_sub_squared_le +- . simp +- . simp +- . simp +- . simp +- . +- rw [← lt_top_iff_ne_top] +- have norm_sub_lt: eLpNorm (((F_n_lp2 n).val.cast) - ((F_n_lp2 n) ∘ fun a ↦ s * a)) 2 volume < ⊤ := by +- grw [eLpNorm_sub_le] ++ · simp ++ · simp ++ · simp ++ · simp ++ · rw [← lt_top_iff_ne_top] ++ have norm_sub_lt : eLpNorm (((F_n_lp2 n).val.cast) - ((F_n_lp2 n) ∘ fun a ↦ s * a)) 2 volume < ⊤ := by ++ grw [eLpNorm_sub_le (by norm_num)] + rw [ENNReal.add_lt_top] + refine ⟨?_, ?_⟩ +- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) +- . +- rw [MeasureTheory.eLpNorm_comp_measurePreserving] +- . exact Lp.eLpNorm_lt_top (F_n_lp2 n) +- . apply AEStronglyMeasurable.of_discrete +- . exact measurePreserving_mul_left volume s +- . apply AEStronglyMeasurable.of_discrete +- . apply AEStronglyMeasurable.of_discrete +- . simp +- rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (by simp) (by simp)] at norm_sub_lt ++ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) ++ · rw [MeasureTheory.eLpNorm_comp_measurePreserving] ++ · exact Lp.eLpNorm_lt_top (F_n_lp2 n) ++ · apply AEStronglyMeasurable.of_discrete ++ · exact measurePreserving_mul_left volume s ++ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (by simp) (by simp) (by apply AEStronglyMeasurable.of_discrete)] at norm_sub_lt + rw [lintegral_g_eq_add] at norm_sub_lt + simp at norm_sub_lt + exact norm_sub_lt +- . +- apply ENNReal.rpow_ne_top_of_nonneg +- . simp +- . apply f_n_sub_norm s (by rw [S_eq_Sinv]; simp [hs]) +- . +- unfold f_n_conv_delta_tendsto at f_n_limit ++ · apply ENNReal.rpow_ne_top_of_nonneg ++ · simp ++ · apply f_n_sub_norm s (by rw [S_eq_Sinv]; simp [hs]) ++ · unfold f_n_conv_delta_tendsto at f_n_limit + simp at hs + specialize f_n_limit ⟨s⁻¹, hs⟩ + conv at f_n_limit => + arg 1 + intro n +- rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (by simp) (by simp)] ++ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (by simp) (by simp) (by apply AEStronglyMeasurable.of_discrete)] + rw [lintegral_g_eq_add] + + simp_rw [f_conv_delta_helper] at f_n_limit +@@ -625,20 +552,14 @@ lemma F_n_conv_mu_lim (f_n_limit: f_n_conv_delta_tendsto): + simp + simp_rw [← ENNReal.toReal_rpow] + apply Filter.Tendsto.rpow_const +- . +- rw [← ENNReal.tendsto_toReal_iff] at f_n_limit +- . exact f_n_limit +- . +- apply f_n_sub_norm s (by rw [S_eq_Sinv]; simp [hs]) +- . simp +- . simp +- . intro n ++ · rw [← ENNReal.tendsto_toReal_iff] at f_n_limit ++ · exact f_n_limit ++ · apply f_n_sub_norm s (by rw [S_eq_Sinv]; simp [hs]) ++ · simp ++ · simp ++ · intro n + rw [MeasureTheory.Lp.enorm_def] + apply MeasureTheory.Lp.eLpNorm_ne_top +- . simp +- +-#print axioms F_n_conv_mu_lim +- +-#synth TopologicalSpace ↥(Lp ℝ 2 volume (α := G)) ++ · simp + + end GeneratesNS +diff --git a/Gromov/Harmonic/MuConv.lean b/Gromov/Harmonic/MuConv.lean +index 0524576..18a9cf4 100644 +--- a/Gromov/Harmonic/MuConv.lean ++++ b/Gromov/Harmonic/MuConv.lean +@@ -12,8 +12,6 @@ the telescoping identity `f_n_sub_conv`. + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + attribute [local implicit_reducible] Additive + + namespace GeneratesNS +@@ -35,7 +33,7 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) + funext g + simp [muConv, NTupleSum, mu, delta, Pi.single, Function.update] + by_cases g_in_s: g ∈ S +- . ++ · + simp [g_in_s] + conv => + rhs +@@ -46,21 +44,21 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) + ext a + simp + refine ⟨?_, ?_⟩ +- . intro a_zero_eq ++ · intro a_zero_eq + ext x + simp + have x_eq_zero: x = 0 := by + exact Fin.fin_one_eq_zero x + rw [x_eq_zero] + exact a_zero_eq +- . intro a_eq ++ · intro a_eq + simp [a_eq] + simp +- . ++ · + simp [g_in_s] + right + by_contra this +- . ++ · + simp at this + obtain ⟨x, hx⟩ := this + rw [← hx] at g_in_s +@@ -77,7 +75,7 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) + rw [Summable.tsum_mul_left] + simp_rw [Finset.sum_mul] + rw [Summable.tsum_finsetSum] +- . ++ · + conv => + lhs + rhs +@@ -85,11 +83,11 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) + intro x + equals (Conv (muConv n) (delta x) ) g => + rw [conv_eq_sum] +- . ++ · + unfold muConv + unfold delta + simp_rw [mul_comm] +- . ++ · + apply conv_exists_fin_supp + right + simp [delta] +@@ -116,51 +114,51 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) + nth_rw 2 [pow_succ] + simp + rw [mul_comm] +- simp only [mul_eq_mul_left_iff, inv_eq_zero, ne_eq, Nat.add_eq_zero, one_ne_zero, and_false, ++ simp only [mul_eq_mul_left_iff, inv_eq_zero, ne_eq, Nat.add_eq_zero_iff, one_ne_zero, and_false, + and_self, not_false_eq_true, pow_eq_zero_iff, Nat.cast_eq_zero, Finset.card_eq_zero] + left + rw [← Finset.sum_attach] + rw [← Finset.sum_product'] + apply Fintype.sum_bijective (e := fun (x) => (fun (i: Fin (n + 1 + 1)) => if hi: i.val = 0 then x.fst else x.snd ⟨i - 1, by omega⟩)) +- . ++ · + refine ⟨?_, ?_⟩ +- . ++ · + intro a b hab + simp at hab + ext p +- . ++ · + have fst_eq := congrFun hab (⟨0, by omega⟩) + simp at fst_eq + rw [fst_eq] + +- . ++ · + have p_lt_n_plus := p.prop + have p_val_neq: p.val ≠ n + 1 := by omega + + + have snd_eq := congrFun hab (⟨p + 1, by omega⟩) + by_cases p_eq_zero: p = 0 +- . ++ · + simp [p_eq_zero] at snd_eq + rw [p_eq_zero] + rw [snd_eq] +- . ++ · + simp [p_eq_zero] at snd_eq + rw [snd_eq] +- . ++ · + intro f + use ((f (⟨0, by omega⟩)), fun i => f (⟨i + 1, by omega⟩)) + funext i + simp + by_cases i_eq_zero: i = 0 +- . simp [i_eq_zero] +- . ++ · simp [i_eq_zero] ++ · + simp [i_eq_zero] + have i_val_neq_zero: i.val ≠ 0 := by + simp [i_eq_zero] + have one_le_i: 1 ≤ i.val := by omega + simp [Nat.sub_add_cancel one_le_i] +- . ++ · + intro x + simp only [delta] + rw [Pi.single_apply] +@@ -168,10 +166,10 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) + + + split_ifs +- . ++ · + rename _ => hi +- simp [hi] +- . ++ simp ++ · + rename_i g_eq g_mul_neq + apply_fun (fun y => (x.fst.val) * y ) at g_eq + rw [← mul_assoc] at g_eq +@@ -186,63 +184,62 @@ theorem mu_conv_eq_sum (m: ℕ): muConv m = fun g => (((1 : ℝ) / (#(S) : ℝ)) + + + contradiction +- . rename_i g_mul_neq g_eq ++ · rename_i g_mul_neq g_eq + + simp [List.ofFn_succ] at g_eq + rw [← g_eq] at g_mul_neq + simp at g_mul_neq +- . rfl +- . intro s hs ++ · rfl ++ · intro s hs + simp [Pi.single_apply] + rw [← summable_norm_iff] + apply Summable.of_nonneg_of_le (f := fun a => ‖(fun f ↦ Conv f mu)^[n] mu ((Additive.toMul a))‖) +- . ++ · + intro x + simp +- . intro x ++ · intro x + split_ifs +- . rfl +- . simp +- . ++ · rfl ++ · simp ++ · + rw [summable_norm_iff] + have conv_finsupp := mu_conv_finsupp n + unfold muConv at conv_finsupp + + apply summable_of_hasFiniteSupport + apply Set.Finite.of_injOn (f := fun a => ( (Additive.toMul a))) (ht := conv_finsupp) +- . ++ · + intro a ha + exact ha +- . intro a ha b hb ++ · intro a ha b hb + simp +- -- TODO - deduplicate this with the above goal +- . ++ · + simp [Pi.single_apply] + rw [← summable_norm_iff] + apply Summable.of_nonneg_of_le (f := fun a => ‖(fun f ↦ Conv f mu)^[n] mu ((Additive.toMul a))‖) +- . ++ · + intro x + simp +- . intro x ++ · intro x + split_ifs +- . rfl +- . simp +- . ++ · rfl ++ · simp ++ · + rw [summable_norm_iff] + have conv_finsupp := mu_conv_finsupp n + unfold muConv at conv_finsupp + + apply summable_of_hasFiniteSupport + apply Set.Finite.of_injOn (f := fun a => ( (Additive.toMul a))) (ht := conv_finsupp) +- . ++ · + intro a ha + exact ha +- . intro a ha b hb ++ · intro a ha b hb + simp +- . ++ · + apply conv_exists_fin_supp + right +- simp [delta] ++ simp + apply Set.Finite.subset (ht := Function.support_const_smul_subset _ _) + have supp_sum := Finset.support_sum (s := S) (f := fun s => Pi.single (M := fun _ : G => ℝ) s (1: ℝ)) + conv => +@@ -262,34 +259,34 @@ lemma mu_conv_nonneg (n: ℕ): ∀ g, 0 ≤ muConv n g := by + | zero => + simp [muConv, mu] + split_ifs +- . simp +- . simp ++ · simp ++ · simp + | succ n ih => + rw [mu_conv_eq_sum] + apply mul_nonneg +- . simp +- . ++ · simp ++ · + simp [NTupleSum] + apply Finset.sum_nonneg + intro i hi + simp [delta, Pi.single_apply] + split_ifs +- . simp +- . simp ++ · simp ++ · simp + + + lemma f_n_nonneg: ∀ n: ℕ, ∀ g: G, 0 ≤ f_n n g := by + intro n g + simp [f_n] + apply mul_nonneg +- . positivity +- . apply Finset.sum_nonneg ++ · positivity ++ · apply Finset.sum_nonneg + intro i hi + apply mu_conv_nonneg + + lemma conv_laplce_norm (n: ℕ) (H_n: ℕ → G → ℝ): eLpNorm ((Laplace_b ((Conv (H_n n)) (f_n n)))) ⊤ (μ := volume (α := G)) ≤ eLpNorm (H_n n) ⊤ * (eLpNorm (Laplace_b (f_n n)) 1 (μ := volume (α := G))) := by + rw [laplace_conv_eq_laplace_right] +- . ++ · + unfold Conv + eta_reduce + simp only [volume] +@@ -307,16 +304,16 @@ lemma conv_laplce_norm (n: ℕ) (H_n: ℕ → G → ℝ): eLpNorm ((Laplace_b (( + + refine le_trans my_norm ?_ + have hmul : ‖ContinuousLinearMap.mul ℝ ℝ‖ₑ ≤ 1 := by +- rw [← ofReal_norm_eq_enorm, ENNReal.ofReal_le_one] ++ rw [← ofReal_norm, ENNReal.ofReal_le_one] + exact ContinuousLinearMap.opNorm_mul_le ℝ ℝ + rw [mul_assoc] + exact le_trans (mul_le_mul_left hmul _) (le_of_eq (one_mul _)) +- . ++ · + apply conv_exists_fin_supp + right + exact f_n_fin_supp n +- . apply f_n_nonneg +- . exact f_n_fin_supp n ++ · apply f_n_nonneg ++ · exact f_n_fin_supp n + + + lemma lintegral_g_eq_add (f: G → ENNReal): (∫⁻ (g: G), f g) = (∑' (g : G), f g) := by +@@ -325,11 +322,11 @@ lemma lintegral_g_eq_add (f: G → ENNReal): (∫⁻ (g: G), f g) = (∑' (g : G + + lemma integral_eq_eq_sum (f: G → ℝ) (hf: Integrable f): (∫ (g: G), f g) = (∑' (g : G), f g) := by + rw [MeasureTheory.integral_countable] +- . ++ · + simp [MeasureTheory.volume] + simp_rw [my_haar_eq_count] + simp +- . apply hf ++ · apply hf + + + lemma mu_norm_one (m: ℕ): MeasureTheory.eLpNorm (muConv m) 1 = 1 := by +@@ -349,35 +346,35 @@ lemma mu_norm_one (m: ℕ): MeasureTheory.eLpNorm (muConv m) 1 = 1 := by + rw [Real.enorm_of_nonneg (by + apply Finset.sum_nonneg + intro x hx +- simp [delta, Pi.single_apply] ++ simp [Pi.single_apply] + split_ifs +- . simp +- . simp ++ · simp ++ · simp + )] + + + rw [← ENNReal.ofReal_tsum_of_nonneg] + simp [Pi.single_apply] +- . intro g ++ · intro g + apply Finset.sum_nonneg + intro i + simp [Pi.single_apply] + split_ifs +- . simp +- . simp +- . ++ · simp ++ · simp ++ · + apply summable_sum + intro i hi + simp only [Pi.single_apply] + apply summable_of_hasFiniteSupport + apply Set.Finite.subset (s := {(List.ofFn i).unattach.prod}) +- . simp +- . intro a ha ++ · simp ++ · intro a ha + simp + simp at ha + rw [ha] + rw [Summable.tsum_finsetSum] +- . ++ · + conv => + lhs + rhs +@@ -394,19 +391,18 @@ lemma mu_norm_one (m: ℕ): MeasureTheory.eLpNorm (muConv m) 1 = 1 := by + rw [← ENNReal.ofReal_natCast] + rw [← ENNReal.ofReal_pow] + rw [← ENNReal.ofReal_mul] +- . ++ · + field_simp + simp + exact Finset.nonempty_iff_ne_empty.mp S_nonempty +- . simp +- . simp +- . +- -- TODO - deduplicate this with the above goal ++ · simp ++ · simp ++ · + intro a ha + apply summable_of_hasFiniteSupport + apply Set.Finite.subset (s := {(List.ofFn a).unattach.prod}) +- . simp +- . intro a ha ++ · simp ++ · intro a ha + simp + simp at ha + rw [ha] +@@ -444,7 +440,7 @@ theorem f_n_norm_one (n: ℕ): MeasureTheory.eLpNorm (f_n n) 1 = 1 := by + )] + + rw [Summable.tsum_finsetSum] +- . ++ · + have mu_norm := mu_norm_one + simp [MeasureTheory.eLpNorm, MeasureTheory.eLpNorm'] at mu_norm + simp_rw [lintegral_g_eq_add] at mu_norm +@@ -457,12 +453,12 @@ theorem f_n_norm_one (n: ℕ): MeasureTheory.eLpNorm (f_n n) 1 = 1 := by + )] + rw [← ENNReal.ofReal_natCast] + rw [← ENNReal.ofReal_mul] +- . ++ · + field_simp + simp +- . simp ++ · simp + linarith +- . ++ · + simp + + +@@ -507,7 +503,7 @@ theorem f_n_sub_conv (n: ℕ): MeasureTheory.eLpNorm ((f_n n) - (Conv (f_n n) + simp + + rw [conv_sum] +- . ++ · + rw [← smul_sub] + rw [← Finset.sum_sub_distrib] + conv => +@@ -553,8 +549,8 @@ theorem f_n_sub_conv (n: ℕ): MeasureTheory.eLpNorm ((f_n n) - (Conv (f_n n) + simp + simp at hx + split_ifs +- . simp +- . omega ++ · simp ++ · omega + )] + + +@@ -567,11 +563,8 @@ theorem f_n_sub_conv (n: ℕ): MeasureTheory.eLpNorm ((f_n n) - (Conv (f_n n) + _ ≤ ‖((n + 1): ℝ)⁻¹‖ₑ * MeasureTheory.eLpNorm ((mu - muConv (n + 1))) 1 MeasureTheory.volume := by + apply MeasureTheory.eLpNorm_const_smul_le + _ ≤ ‖((n + 1): ℝ)⁻¹‖ₑ * (MeasureTheory.eLpNorm ((mu)) 1 MeasureTheory.volume + (MeasureTheory.eLpNorm ((muConv (n + 1))) 1 MeasureTheory.volume)) := by +- have sub_le := MeasureTheory.eLpNorm_sub_le (p := 1) (f := mu ) (g := muConv (n + 1)) (μ := MeasureTheory.volume) ?_ ?_ (by simp) +- . +- apply mul_le_mul_right sub_le +- . apply MeasureTheory.AEStronglyMeasurable.of_discrete +- . apply MeasureTheory.AEStronglyMeasurable.of_discrete ++ exact mul_le_mul' le_rfl (MeasureTheory.eLpNorm_sub_le (p := 1) ++ (f := mu) (g := muConv (n + 1)) (μ := MeasureTheory.volume) (by simp)) + _ ≤ ENNReal.ofReal ((2: ℝ) / ((n + 1): ℝ)) := by + rw [mu_norm_one] + have mu_single_norm := mu_norm_one 0 +@@ -590,11 +583,8 @@ theorem f_n_sub_conv (n: ℕ): MeasureTheory.eLpNorm ((f_n n) - (Conv (f_n n) + field_simp + simp + positivity +- . exact mu_finsupp ++ · exact mu_finsupp + + +-#print axioms mu_conv_eq_sum +-#print axioms f_n_norm_one +-#print axioms f_n_sub_conv + + end GeneratesNS +diff --git a/Gromov/Harmonic/Proposition318.lean b/Gromov/Harmonic/Proposition318.lean +index 7d7da9c..c36f3cc 100644 +--- a/Gromov/Harmonic/Proposition318.lean ++++ b/Gromov/Harmonic/Proposition318.lean +@@ -12,8 +12,6 @@ sequence. + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + attribute [local implicit_reducible] Additive + + namespace GeneratesNS +@@ -31,176 +29,164 @@ open MeasureTheory + + open scoped RealInnerProductSpace + +-set_option maxHeartbeats 600000 in +-lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp ℝ 2 volume (α := G)), ‖Laplace g‖ ≤ (1 : ℝ) / n ∧ ⟪Laplace g, g⟫ = 1 := by +- +- let eps := ((1: ℝ) / n)^2 +- -- selfAdjoint.mem_spectrum_eq_re ++private lemma laplace_spectrum_nonisolated (n : ℕ) (hn : 0 < n) ++ (hf : f_n_conv_delta_tendsto) : ++ spectrum ℝ (Laplace_linear.mkContinuous _ laplace_bounded') ∩ ++ Set.Ioo 0 (((1 : ℝ) / n)^2) ≠ ∅ := by ++ let eps := ((1 : ℝ) / n)^2 ++ let Δ := Laplace_linear.mkContinuous _ laplace_bounded' ++ change spectrum ℝ Δ ∩ Set.Ioo 0 eps ≠ ∅ + +- let P: Polynomial ℝ := (Polynomial.X^2 - eps • Polynomial.X) ++ by_contra! ++ have zero_isolated: spectrum ℝ Δ ∩ (Set.Ico 0 eps) = {0} := by ++ ext a ++ simp ++ refine ⟨?_, ?_⟩ ++ · ++ intro ha ++ obtain ⟨a_mem_spec, a_range⟩ := ha ++ by_contra a_nonzero ++ have a_mem: a ∈ Set.Ioo 0 eps := by ++ grind + +- let Δ := Laplace_linear.mkContinuous _ (laplace_bounded') ++ have a_mem_empty: a ∈ (∅ : Set ℝ) := by ++ rw [← this] ++ grind + +- have spec_inter: spectrum ℝ Δ ∩ Set.Ioo 0 eps ≠ ∅ := by +- by_contra! +- have zero_isolated: spectrum ℝ Δ ∩ (Set.Ico 0 eps) = {0} := by +- ext a +- simp +- refine ⟨?_, ?_⟩ +- . +- intro ha +- obtain ⟨a_mem_spec, a_range⟩ := ha +- by_contra a_nonzero +- have a_mem: a ∈ Set.Ioo 0 eps := by +- grind ++ simp at a_mem_empty ++ · ++ intro ha ++ simp [ha] ++ refine ⟨?_, by simp [eps, hn]⟩ ++ apply laplace_spectrum_contains_zero hf ++ ++ have zero_mem := laplace_spectrum_contains_zero hf ++ rw [spectrum.mem_iff] at zero_mem ++ simp at zero_mem ++ ++ let ramp: ℝ → ℝ := fun x => max 0 (min 1 (x / eps)) ++ ++ have self_adjoint_cx_del: IsSelfAdjoint (Cx.mapCLM Δ) := by ++ apply Cx.isSelfAdjoint_mapCLM ++ apply Δ_symmetric.isSelfAdjoint ++ ++ ++ let Q := cfc (1 - ramp) (Cx.mapCLM Δ) ++ have laplace_q: (Cx.mapCLM Δ) * Q = cfc (0: ℝ → ℝ) (Cx.mapCLM Δ) := by ++ unfold Q ++ nth_rw 1 [← cfc_id (a := Cx.mapCLM Δ) ℝ] ++ rw [← cfc_mul (hf := by exact continuousOn_id) (hg := by fun_prop)] ++ apply cfc_congr ++ intro x hx ++ simp [ramp, max_def'] ++ norm_num ++ split_ifs ++ · ++ rw [Cx.spectrum_mapCLM] at hx ++ rename_i x_div ++ apply Δ_spectrum_subset at hx ++ simp [eps] at x_div ++ have x_nonpos := nonpos_of_mul_nonpos_left x_div (by simp [hn]) ++ left ++ simp at hx ++ grind ++ · simp [min_def'] ++ split_ifs ++ · + +- have a_mem_empty: a ∈ (∅ : Set ℝ) := by +- rw [← this] +- grind ++ by_cases x_eq: x = eps ++ · simp [x_eq, eps] ++ field_simp ++ simp ++ · ++ rename_i x_div_le ++ rw [div_le_one₀ (by simp [eps]; positivity)] at x_div_le ++ have x_lt: x < eps := by ++ grind + +- simp at a_mem_empty +- . +- intro ha +- simp [ha] +- refine ⟨?_, by simp [eps, hn]⟩ +- apply laplace_spectrum_contains_zero hf +- +- have zero_mem := laplace_spectrum_contains_zero hf +- rw [spectrum.mem_iff] at zero_mem +- simp at zero_mem +- +- let ramp: ℝ → ℝ := fun x => max 0 (min 1 (x / eps)) +- +- have self_adjoint_cx_del: IsSelfAdjoint (Cx.mapCLM Δ) := by +- apply Cx.isSelfAdjoint_mapCLM +- apply Δ_symmetric.isSelfAdjoint +- +- +- let Q := cfc (1 - ramp) (Cx.mapCLM Δ) +- have laplace_q: (Cx.mapCLM Δ) * Q = cfc (0: ℝ → ℝ) (Cx.mapCLM Δ) := by +- unfold Q +- nth_rw 1 [← cfc_id (a := Cx.mapCLM Δ) ℝ] +- rw [← cfc_mul (hf := by exact continuousOn_id) (hg := by fun_prop)] +- apply cfc_congr +- intro x hx +- simp [ramp, max_def'] +- norm_num +- split_ifs +- . +- rw [Cx.spectrum_mapCLM] at hx +- rename_i x_div +- apply Δ_spectrum_subset at hx +- simp [eps] at x_div +- have x_nonpos := nonpos_of_mul_nonpos_left x_div (by simp [hn]) +- left +- simp at hx +- grind +- . simp [min_def'] +- split_ifs +- . + +- by_cases x_eq: x = eps +- . simp [x_eq, eps] +- field_simp ++ have x_mem_zero: x ∈ ({0} : Set ℝ) := by ++ rw [← zero_isolated] + simp +- . +- rename_i x_div_le +- rw [div_le_one₀ (by simp [eps]; positivity)] at x_div_le +- have x_lt: x < eps := by ++ refine ⟨?_, ?_⟩ ++ · ++ rw [Cx.spectrum_mapCLM] at hx ++ exact hx ++ · ++ rw [Cx.spectrum_mapCLM] at hx ++ apply Δ_spectrum_subset at hx ++ simp at hx + grind + ++ simp at x_mem_zero ++ simp [x_mem_zero] ++ · simp + +- have x_mem_zero: x ∈ ({0} : Set ℝ) := by +- rw [← zero_isolated] +- simp +- refine ⟨?_, ?_⟩ +- . +- rw [Cx.spectrum_mapCLM] at hx +- exact hx +- . +- rw [Cx.spectrum_mapCLM] at hx +- apply Δ_spectrum_subset at hx +- simp at hx +- grind +- +- simp at x_mem_zero +- simp [x_mem_zero] +- . simp +- +- +- simp at laplace_q +- have one_mem_q_spec: 1 ∈ spectrum ℝ Q := by +- rw [cfc_map_spectrum (hf := by fun_prop)] +- simp [ramp] +- use 0 +- rw [Cx.spectrum_mapCLM] +- refine ⟨laplace_spectrum_contains_zero hf, ?_⟩ +- right +- simp + +- have nontrivial_cx: Nontrivial (Cx ↥(Lp ℝ 2 volume (α := G)) →L[ℂ] Cx ↥(Lp ℝ 2 volume (α := G))) := by ++ simp at laplace_q ++ have one_mem_q_spec: 1 ∈ spectrum ℝ Q := by ++ rw [cfc_map_spectrum (hf := by fun_prop)] ++ simp [ramp] ++ use 0 ++ rw [Cx.spectrum_mapCLM] ++ refine ⟨laplace_spectrum_contains_zero hf, ?_⟩ ++ right ++ simp + +- use 1 +- use 0 +- simp +- rw [ContinuousLinearMap.ext_iff] +- simp +- let hf := (finsupp_lp_top (Pi.single 1 1) (by +- simp +- ) 2) +- rw [← my_haar_eq_count] at hf +- use (hf.toLp, 0) +- apply_fun (fun a => a.fst) +- simp +- rw [MeasureTheory.Lp.ext_iff] +- have haar_eq_volume: myHaar = volume := by +- simp [volume] +- simp_rw [haar_eq_volume] +- rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] +- simp +- rw [funext_iff] +- simp +- use 1 ++ have nontrivial_cx: Nontrivial (Cx ↥(Lp ℝ 2 volume (α := G)) →L[ℂ] Cx ↥(Lp ℝ 2 volume (α := G))) := by ++ ++ use 1 ++ use 0 ++ simp ++ rw [ContinuousLinearMap.ext_iff] ++ simp ++ let hf := (finsupp_lp_top (Pi.single 1 1) (by + simp ++ ) 2) ++ rw [← my_haar_eq_count] at hf ++ use (hf.toLp, 0) ++ apply_fun (fun a => a.fst) ++ simp ++ rw [MeasureTheory.Lp.ext_iff] ++ have haar_eq_volume: myHaar = volume := by ++ simp [volume] ++ simp_rw [haar_eq_volume] ++ rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] ++ simp ++ rw [funext_iff] ++ simp ++ use 1 ++ simp + +- have Q_nonzero: Q ≠ 0 := by +- by_contra! +- simp [this] at one_mem_q_spec +- +- apply ContinuousLinearMap.exists_ne_zero at Q_nonzero +- obtain ⟨x, hx⟩ := Q_nonzero +- have laplace_q_x: (Cx.mapCLM Δ) (Q x) = 0 := by +- rw [← ContinuousLinearMap.mul_apply] +- simp [laplace_q] +- +- by_cases fst_nonzero: (Q x).fst ≠ 0 +- . +- simp at laplace_q_x +- apply_fun (fun a => a.fst) at laplace_q_x +- simp at laplace_q_x +- simp [Δ, LinearMap.mkContinuous, Laplace_linear] at laplace_q_x +- apply laplace_zero_iff_zero at laplace_q_x +- contradiction +- . +- have snd_nonzero: (Q x).snd ≠ 0 := by +- by_contra! +- simp at fst_nonzero +- have Q_zero: (Q x) = 0 := by +- apply Cx.ext +- all_goals { +- simp +- grind +- } +- contradiction ++ have Q_nonzero: Q ≠ 0 := by ++ by_contra! ++ simp [this] at one_mem_q_spec ++ ++ apply ContinuousLinearMap.exists_ne_zero at Q_nonzero ++ obtain ⟨x, hx⟩ := Q_nonzero ++ have laplace_q_x: (Cx.mapCLM Δ) (Q x) = 0 := by ++ rw [← mul_apply_eq_comp] ++ simp [laplace_q] ++ ++ have hfst : Laplace (Q x).fst = 0 := by ++ have h := congrArg Cx.fst laplace_q_x ++ simpa [Δ, LinearMap.mkContinuous, Laplace_linear] using h ++ have hsnd : Laplace (Q x).snd = 0 := by ++ have h := congrArg Cx.snd laplace_q_x ++ simpa [Δ, LinearMap.mkContinuous, Laplace_linear] using h ++ have hz : Q x = 0 := Cx.ext (laplace_zero_iff_zero _ hfst) (laplace_zero_iff_zero _ hsnd) ++ exact hx hz ++ ++lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp ℝ 2 volume (α := G)), ‖Laplace g‖ ≤ (1 : ℝ) / n ∧ ⟪Laplace g, g⟫ = 1 := by + +- -- TODO - deduplicate this +- simp at laplace_q_x +- apply_fun (fun a => a.snd) at laplace_q_x +- simp at laplace_q_x +- simp [Δ, LinearMap.mkContinuous, Laplace_linear] at laplace_q_x +- apply laplace_zero_iff_zero at laplace_q_x +- contradiction ++ let eps := ((1: ℝ) / n)^2 ++ -- selfAdjoint.mem_spectrum_eq_re ++ ++ let P: Polynomial ℝ := (Polynomial.X^2 - eps • Polynomial.X) ++ ++ let Δ := Laplace_linear.mkContinuous _ (laplace_bounded') + ++ have spec_inter := laplace_spectrum_nonisolated n hn hf + + rw [← Set.nonempty_iff_ne_empty] at spec_inter + obtain ⟨a, ha⟩ := spec_inter +@@ -217,21 +203,21 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp + + have p_a_neg: P.eval a < 0 := by + simp [P] +- simp at ha +- nlinarith ++ change 0 < a ∧ a < eps at a_lt ++ nlinarith [a_lt.1, a_lt.2] + + have eval_symm: (((Polynomial.aeval Δ) P)).IsSymmetric := by + simp [P] + apply LinearMap.IsSymmetric.sub +- . apply LinearMap.IsSymmetric.pow ++ · apply LinearMap.IsSymmetric.pow + apply Δ_symmetric +- . apply LinearMap.IsSymmetric.smul +- . simp +- . apply Δ_symmetric ++ · apply LinearMap.IsSymmetric.smul ++ · simp ++ · apply Δ_symmetric + + + have not_pos := ContinuousLinearMap.IsPositive.spectrumRestricts (f := (Polynomial.aeval Δ P)).mt ?_ +- . ++ · + simp [ContinuousLinearMap.IsPositive, eval_symm] at not_pos + obtain ⟨x, hx, x_inner⟩ := not_pos + simp [ContinuousLinearMap.reApplyInnerSelf, P] at x_inner +@@ -253,7 +239,7 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp + use ((√⟪Laplace ⟨x, hx⟩, ⟨x, hx⟩⟫)⁻¹) • ⟨x, hx⟩ + rw [inner_sub_left] at x_inner + refine ⟨?_, ?_⟩ +- . ++ · + rw [norm_eq_sqrt_real_inner] + simp [Δ, LinearMap.mkContinuous, Laplace_linear] at x_inner + rw [← laplace_self_adjoint] at x_inner +@@ -263,19 +249,19 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp + rw [norm_smul] + simp + rw [← Real.lt_sqrt] at x_inner +- . grw [x_inner] ++ · grw [x_inner] + rw [Real.sqrt_mul] +- ring ++ ring_nf + rw [abs_of_nonneg] +- . ++ · + field_simp + simp [eps] + grind +- . simp +- . simp [eps] +- . simp ++ · simp ++ · simp [eps] ++ · simp + +- . ++ · + rw [laplace_smul] + rw [inner_smul_left, inner_smul_right] + simp +@@ -283,7 +269,7 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp + rw [Real.sq_sqrt] + rw [← laplace_self_adjoint] + apply laplace_positive_semidefinite +- . rw [SpectrumRestricts.nnreal_iff] ++ · rw [SpectrumRestricts.nnreal_iff] + simp + use P.eval a + +@@ -297,7 +283,6 @@ lemma laplace_g_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ∃ g: (Lp + -- This whole proof is completely wrong - it needs to use the spectral theorem + + +-#print axioms laplace_g_n + + + lemma measure_preserving_inv: MeasurePreserving Inv.inv ((MeasureTheory.volume (α := G))) (MeasureTheory.volume (α := G)) := { +@@ -318,7 +303,7 @@ noncomputable def G_n (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto) := Class + + + lemma lp_summable {p: ℕ} (hp: 0 < p) (f: (Lp ℝ p volume (α := G))): Summable (fun g: G => |(f g)|^p) := by +- have f_norm := (MeasureTheory.Lp.memLp f).2 ++ have f_norm := (MeasureTheory.Lp.memLp f).eLpNorm_lt_top + simp [eLpNorm, eLpNorm'] at f_norm + have not_le: ¬(p = 0) := by linarith + simp [not_le] at f_norm +@@ -353,9 +338,9 @@ lemma lp2_summable (f: (Lp ℝ 2 volume (α := G))): Summable (fun g: G => (f g) + + + lemma summable_f_mul_translate (f: (Lp ℝ 2 volume (α := G))) (i: G): Summable (fun x => (f x) * (f (i * x))) := by +- have lp_mul := (MeasureTheory.MemLp.mul (φ := f) (f := fun x => f (i * x)) (p := 2) (q := 2) (r := 1) (μ := volume) ?_ ?_).2 +- . +- simp [MemLp, eLpNorm, eLpNorm'] at lp_mul ++ have lp_mul := (MeasureTheory.MemLp.mul (φ := f) (f := fun x => f (i * x)) (p := 2) (q := 2) (r := 1) (μ := volume) ?_ ?_).eLpNorm_lt_top ++ · ++ simp [eLpNorm, eLpNorm'] at lp_mul + rw [lintegral_g_eq_add] at lp_mul + simp [Real.enorm_eq_ofReal_abs] at lp_mul + simp [← ENNReal.ofReal_mul] at lp_mul +@@ -366,23 +351,22 @@ lemma summable_f_mul_translate (f: (Lp ℝ 2 volume (α := G))) (i: G): Summable + intro x + rw [ENNReal.toReal_ofReal (by + apply mul_nonneg +- . simp +- . simp ++ · simp ++ · simp + )] + apply Summable.of_abs + simp_rw [abs_mul] + exact lp_mul +- . ++ · apply Lp.memLp f ++ · + rw [← Function.comp_def] + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp f +- . exact measurePreserving_mul_left volume i +- . apply Lp.memLp f ++ · apply MeasureTheory.Lp.memLp f ++ · exact measurePreserving_mul_left volume i + + + -- Note - this is stated incorrectly in Vikman + -- The RHS should have a squared norm +-set_option maxRecDepth 40000 in + lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (Laplace f) g) = ((2) * (#(S) : ℝ))⁻¹ * ∑ s ∈ S, ‖(f - (conv_finsupp_lp2 f (delta s) (by simp [delta])))‖^2 := by + simp_rw [Laplace] + simp_rw [conv_mu_lp2] +@@ -431,7 +415,7 @@ lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (La + + rw [Summable.tsum_mul_left] + rw [Summable.tsum_mul_left] +- have f_norm := MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm (p := 2) (by simp) (by simp) (f := f.val.cast) (μ := volume (α := G)) ++ have f_norm := MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal (p := 2) (by simp) (by simp) (f := f.val.cast) (μ := volume (α := G)) (MeasureTheory.Lp.aestronglyMeasurable f) + simp_rw [lintegral_g_eq_add] at f_norm + simp [enorm] at f_norm + apply_fun ENNReal.toReal at f_norm +@@ -488,21 +472,19 @@ lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (La + conv at inner_f_conv => + intro a + rhs +- -- TODO - deduplicate this with the 'have lp_mul' block above + rw [MeasureTheory.integral_countable (by + simp [f_conv_delta] + simp [Integrable] +- refine ⟨by apply AEStronglyMeasurable.of_discrete, ?_⟩ + simp [HasFiniteIntegral] + simp [Real.enorm_eq_ofReal_abs] + rw [lintegral_g_eq_add] + rw [lt_top_iff_ne_top] + simp_rw [← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul] + rw [← ENNReal.ofReal_tsum_of_nonneg] +- . apply ENNReal.ofReal_ne_top +- . intro n ++ · apply ENNReal.ofReal_ne_top ++ · intro n + positivity +- . ++ · + apply Summable.abs + simp_rw [mul_comm] + apply summable_f_mul_translate +@@ -545,28 +527,28 @@ lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (La + rw [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum] + eta_reduce + ring +- . apply summable_sum ++ · apply summable_sum + intro s hs + simp_rw [f_conv_delta] + apply summable_f_mul_translate +- . ++ · + apply tsum_nonneg + intro g + apply sq_nonneg +- . simp +- . apply summable_sum ++ · simp ++ · apply summable_sum + intro s hs + apply lp2_summable +- . ++ · + apply Summable.mul_left + apply summable_sum + intro s hs + apply lp2_summable +- . simp_rw [mul_assoc] ++ · simp_rw [mul_assoc] + apply Summable.mul_left + simp_rw [← pow_two] + apply lp2_summable +- . simp_rw [mul_assoc] ++ · simp_rw [mul_assoc] + apply Summable.mul_left + rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] + simp_rw [← mul_assoc] +@@ -578,14 +560,14 @@ lemma proposition_3_18 (f: (Lp ℝ 2 volume (α := G))): (∑' g: G, (f g) * (La + simp_rw [mul_assoc] + apply Summable.mul_left + apply summable_f_mul_translate +- . ++ · + apply Summable.mul_left + rw [ae_eq_everywhere.mp (MeasureTheory.MemLp.coeFn_toLp _)] + simp_rw [mul_sub] + apply Summable.sub +- . simp_rw [← pow_two] ++ · simp_rw [← pow_two] + apply lp2_summable +- . ++ · + simp_rw [← mul_assoc] + simp_rw [Finset.mul_sum] + apply summable_sum +@@ -611,8 +593,6 @@ lemma g_n_conv_norm (n: ℕ) (hn: 0 < n) (hf: f_n_conv_delta_tendsto): ⟪Laplac + exact g_n_prop.2 + + +-#print sorries proposition_3_18 +-#print axioms proposition_3_18 + + + lemma g_sub_norm_gt (hf: f_n_conv_delta_tendsto) (n: ℕ) : ∃ s ∈ S, ‖(G_n (n + 1) (by simp) hf) - (conv_finsupp_lp2 (G_n (n + 1) (by simp) hf) (delta s) (by simp [delta]))‖^2 > 1 := by +@@ -623,7 +603,7 @@ lemma g_sub_norm_gt (hf: f_n_conv_delta_tendsto) (n: ℕ) : ∃ s ∈ S, ‖(G_n + have g_n_prop := (Classical.choose_spec (laplace_g_n (n + 1) (by simp) hf)).2 + have real_inner : ∀ a b : ℝ, ⟪a, b⟫ = b * a := fun a b => rfl + rw [integral_eq_eq_sum] at g_inner_laplace +- . ++ · + simp_rw [real_inner] at g_inner_laplace + simp_rw [← g_inner_laplace] at sum_norm + nth_rw 1 [G_n] at sum_norm +@@ -634,15 +614,15 @@ lemma g_sub_norm_gt (hf: f_n_conv_delta_tendsto) (n: ℕ) : ∃ s ∈ S, ‖(G_n + rw [← sum_norm] at card_le + simp at card_le + rw [mul_le_iff_le_one_left] at card_le +- . norm_num at card_le +- . simp ++ · norm_num at card_le ++ · simp + have foo := S_nonempty + grind +- . ++ · + simp + grind + +- . ++ · + rw [MeasureTheory.L2.inner_def] at g_n_prop + apply MeasureTheory.integrable_of_integral_eq_one at g_n_prop + exact g_n_prop +@@ -704,14 +684,14 @@ lemma laplace_b_sub (f g: G → ℝ): Laplace_b (f - g) = Laplace_b f - Laplace_ + simp [Laplace_b] + nth_rw 3 [sub_eq_add_neg] + rw [conv_add_left] +- . ++ · + rw [conv_neg_left] + ring_nf +- . ++ · + apply conv_exists_fin_supp + right + apply mu_finsupp +- . apply conv_exists_fin_supp ++ · apply conv_exists_fin_supp + right + apply mu_finsupp + +diff --git a/Gromov/Harmonic/SelfAdjoint.lean b/Gromov/Harmonic/SelfAdjoint.lean +index af09060..21e136c 100644 +--- a/Gromov/Harmonic/SelfAdjoint.lean ++++ b/Gromov/Harmonic/SelfAdjoint.lean +@@ -12,38 +12,34 @@ public import Gromov.Harmonic.LaplaceLinear + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + attribute [local implicit_reducible] Additive + + namespace GeneratesNS + open Generates + +-variable [hGS: Generates] ++variable [hGS : Generates] + include hGS + +-variable {V: Submodule ℝ LipschitzH} [V_finite: FiniteDimensional ℝ V] [Nontrivial V] ++variable {V : Submodule ℝ LipschitzH} [V_finite : FiniteDimensional ℝ V] [Nontrivial V] + + open scoped Finset + open scoped Pointwise + open scoped Convolution + open MeasureTheory + +-lemma laplace_smul (k: ℝ) (f: (Lp ℝ 2 volume (α := G))): Laplace (k • f) = k • (Laplace f) := by ++lemma laplace_smul (k : ℝ) (f : (Lp ℝ 2 volume (α := G))) : Laplace (k • f) = k • (Laplace f) := by + simp [Laplace, conv_mu_lp2] + simp_rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_smul _ _)] + simp_rw [conv_smul] + rw [MeasureTheory.MemLp.toLp_const_smul] + rw [smul_sub] + +- +-lemma norm_conv_mu_le (f: (Lp ℝ 2 volume (α := G))): ‖conv_mu_lp2 f‖ ≤ ‖f‖ := by ++lemma norm_conv_mu_le (f : (Lp ℝ 2 volume (α := G))) : ‖conv_mu_lp2 f‖ ≤ ‖f‖ := by + simp [conv_mu_lp2] + simp [f_conv_mu] + simp_rw [← smul_eq_mul] + rw [← Pi.smul_def] + rw [MeasureTheory.eLpNorm_const_smul] +- -- TODO - deduplicate this with 'laplace_bounded' + conv => + lhs + rhs +@@ -53,13 +49,13 @@ lemma norm_conv_mu_le (f: (Lp ℝ 2 volume (α := G))): ‖conv_mu_lp2 f‖ ≤ + funext g + simp + +- have card_s_ne: (#S : ℝ) ≠ 0 := by ++ have card_s_ne : (#S : ℝ) ≠ 0 := by + simp + have foo := hS + simp at foo + exact Finset.nonempty_iff_ne_empty.mp foo + +- grw [MeasureTheory.eLpNorm_sum_le] ++ grw [MeasureTheory.eLpNorm_sum_le (by norm_num)] + simp_rw [← Function.comp_def] + conv => + lhs +@@ -77,16 +73,13 @@ lemma norm_conv_mu_le (f: (Lp ℝ 2 volume (α := G))): ‖conv_mu_lp2 f‖ ≤ + simp [MeasureTheory.volume] + } + )] +- . simp ++ · simp + field_simp + rfl +- . +- apply WithTop.mul_ne_top +- . +- rw [Real.enorm_of_nonneg (by simp)] ++ · apply WithTop.mul_ne_top ++ · rw [Real.enorm_of_nonneg (by simp)] + apply ENNReal.ofReal_ne_top +- . +- apply ENNReal.sum_ne_top.mpr ++ · apply ENNReal.sum_ne_top.mpr + intro s hs + rw [← Function.comp_def] + conv => +@@ -101,19 +94,14 @@ lemma norm_conv_mu_le (f: (Lp ℝ 2 volume (α := G))): ‖conv_mu_lp2 f‖ ≤ + } + )] + rw [← lt_top_iff_ne_top] +- apply (MeasureTheory.Lp.memLp f).2 +- . intro s hs +- apply AEStronglyMeasurable.of_discrete +- . +- simp ++ exact MeasureTheory.Lp.eLpNorm_lt_top f + + open scoped RealInnerProductSpace +-lemma inner_laplace_zero (f: (Lp ℝ 2 volume (α := G))) (hf: ⟪Laplace f, f⟫ = 0): Laplace f = 0 := by ++lemma inner_laplace_zero (f : (Lp ℝ 2 volume (α := G))) (hf : ⟪Laplace f, f⟫ = 0) : Laplace f = 0 := by + have inner_le := real_inner_le_norm (conv_mu_lp2 f) f + +- by_cases norm_f_zero: ‖f‖ = 0 +- . +- simp at norm_f_zero ++ by_cases norm_f_zero : ‖f‖ = 0 ++ · simp at norm_f_zero + simp [Laplace, conv_mu_lp2] + simp [f_conv_mu] + simp_rw [norm_f_zero] +@@ -132,7 +120,7 @@ lemma inner_laplace_zero (f: (Lp ℝ 2 volume (α := G))) (hf: ⟪Laplace f, f + nth_rw 2 [mul_comm] at inner_le + rw [mul_le_mul_iff_of_pos_left] at inner_le + have conv_le_f := norm_conv_mu_le f +- have f_norm_eq: ‖f‖ = ‖conv_mu_lp2 f‖ := by ++ have f_norm_eq : ‖f‖ = ‖conv_mu_lp2 f‖ := by + linarith + + have f_sub_norm := norm_sub_sq_real f (conv_mu_lp2 f) +@@ -147,8 +135,7 @@ lemma inner_laplace_zero (f: (Lp ℝ 2 volume (α := G))) (hf: ⟪Laplace f, f + simpa [Laplace] using f_sub_norm + simpa using norm_f_zero + +- +-lemma F_n_norm_eq_one: ∀ n, MeasureTheory.eLpNorm (F_n n) 2 MeasureTheory.volume (α := G) = 1 := by ++lemma F_n_norm_eq_one : ∀ n, MeasureTheory.eLpNorm (F_n n) 2 MeasureTheory.volume (α := G) = 1 := by + simp [eLpNorm, eLpNorm', lintegral_g_eq_add] + simp [F_n, Real.enorm_eq_ofReal_abs, ← ENNReal.ofReal_pow] + +@@ -160,41 +147,36 @@ lemma F_n_norm_eq_one: ∀ n, MeasureTheory.eLpNorm (F_n n) 2 MeasureTheory.volu + simp [f_n_nonneg, abs_of_nonneg] at norm_one + simp [norm_one] + +- +-lemma harmonic_abs_max_implies_const (f: G → ℝ) (hf: Laplace_b f = 0) (a: G) (h_max: ∀ g: G, |f g| ≤ |f a|): f = fun _ => f a := by +- by_cases f_a_pos: 0 ≤ f a +- . +- have lt_f_a: ∀ g: G, f g ≤ f a := by ++lemma harmonic_abs_max_implies_const (f : G → ℝ) (hf : Laplace_b f = 0) (a : G) (h_max : ∀ g : G, |f g| ≤ |f a|) : f = fun _ => f a := by ++ by_cases f_a_pos : 0 ≤ f a ++ · have lt_f_a : ∀ g : G, f g ≤ f a := by + intro g +- by_cases f_g_pos: 0 ≤ f g +- . specialize h_max g ++ by_cases f_g_pos : 0 ≤ f g ++ · specialize h_max g + rw [abs_eq_self.mpr ?_] at h_max + rw [abs_eq_self.mpr f_a_pos] at h_max +- . exact h_max +- . exact f_g_pos +- . linarith ++ · exact h_max ++ · exact f_g_pos ++ · linarith + exact harmonic_maximum_implies_const f hf a lt_f_a +- . +- have f_neg_le: ∀ g, (-f) g ≤ (-f) a := by ++ · have f_neg_le : ∀ g, (-f) g ≤ (-f) a := by + intro g + simp at f_a_pos + simp + specialize h_max g + rw [abs_of_neg f_a_pos] at h_max +- by_cases f_g_pos: 0 ≤ f g +- . rw [abs_of_nonneg f_g_pos] at h_max ++ by_cases f_g_pos : 0 ≤ f g ++ · rw [abs_of_nonneg f_g_pos] at h_max + linarith +- . simp at f_g_pos ++ · simp at f_g_pos + rw [abs_of_neg f_g_pos] at h_max + linarith + have neg_const := harmonic_maximum_implies_const (-f) ?_ a f_neg_le +- . +- apply_fun (fun h => -h) at neg_const ++ · apply_fun (fun h => -h) at neg_const + simp at neg_const + rw [Pi.neg_def] at neg_const + simpa using neg_const +- . +- simp_rw [Laplace_b] ++ · simp_rw [Laplace_b] + simp_rw [Laplace_b] at hf + conv => + lhs +@@ -210,13 +192,10 @@ lemma harmonic_abs_max_implies_const (f: G → ℝ) (hf: Laplace_b f = 0) (a: G + rw [sub_eq_zero] at hf + exact hf.symm + +- +-set_option maxHeartbeats 500000 in +-lemma laplace_zero_iff_zero (g: (Lp ℝ 2 volume (α := G))) (eq_zero: Laplace g = 0): g = 0 := by +- by_cases g_has_maximum: ∃ a: G, ∀ b: G, ‖g b‖ ≤ ‖g a‖ +- . +- obtain ⟨a, ha⟩ := g_has_maximum +- have laplace_b_zero: Laplace_b g = 0 := by ++lemma laplace_zero_iff_zero (g : (Lp ℝ 2 volume (α := G))) (eq_zero : Laplace g = 0) : g = 0 := by ++ by_cases g_has_maximum : ∃ a : G, ∀ b : G, ‖g b‖ ≤ ‖g a‖ ++ · obtain ⟨a, ha⟩ := g_has_maximum ++ have laplace_b_zero : Laplace_b g = 0 := by + simp [Laplace, conv_mu_lp2, f_conv_mu] at eq_zero + simp_rw [Laplace_b, f_conv_mu] + apply_fun (fun f => f.val.cast) at eq_zero +@@ -245,8 +224,7 @@ lemma laplace_zero_iff_zero (g: (Lp ℝ 2 volume (α := G))) (eq_zero: Laplace g + rw [← not_infinite_iff_finite] at new_g_const_zero + simp [hGS.g_infinite] at new_g_const_zero + +- +- have g_eq_zero: g.val.cast = 0 := by ++ have g_eq_zero : g.val.cast = 0 := by + rw [g_const] + rw [new_g_const_zero] + ext a +@@ -256,16 +234,15 @@ lemma laplace_zero_iff_zero (g: (Lp ℝ 2 volume (α := G))) (eq_zero: Laplace g + rw [ae_eq_everywhere] + rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_zero _ _ _)] + exact g_eq_zero +- . rename _ => g_no_maximum ++ · rename _ => g_no_maximum + simp at g_no_maximum +- have integrable_g := MeasureTheory.MemLp.integrable_sq (MeasureTheory.Lp.memLp g) +- simp [Integrable, HasFiniteIntegral] at integrable_g +- obtain ⟨_, integral_lt⟩ := integrable_g ++ have integral_lt := MeasureTheory.MemLp.integrable_sq (MeasureTheory.Lp.memLp g) ++ simp [Integrable, HasFiniteIntegral] at integral_lt + rw [lintegral_g_eq_add] at integral_lt + rw [lt_top_iff_ne_top] at integral_lt + by_contra g_ne_zero + simp at g_ne_zero +- have nonzero_val: ∃ a: G, g a ≠ 0 := by ++ have nonzero_val : ∃ a : G, g a ≠ 0 := by + rw [MeasureTheory.Lp.ext_iff] at g_ne_zero + rw [ae_eq_everywhere] at g_ne_zero + rw [ae_eq_everywhere.mp (MeasureTheory.Lp.coeFn_zero _ _ _)] at g_ne_zero +@@ -284,26 +261,20 @@ lemma laplace_zero_iff_zero (g: (Lp ℝ 2 volume (α := G))) (eq_zero: Laplace g + -- Obtain an element greater than the maximum + obtain ⟨p, hp⟩ := g_no_maximum m + have p_gt := hm (j := p) ?_ ?_ +- . +- have not_g_le := not_lt_of_ge p_gt ++ · have not_g_le := not_lt_of_ge p_gt + contradiction +- . +- simp ++ · simp + grw [m_in_g] + rw [← ENNReal.toReal_le_toReal] +- . +- simp ++ · simp + rw [sq_le_sq] + linarith +- . simp +- . simp ++ · simp ++ · simp + linarith + +- +--- Proposition 3.17.1: "∆ is bounded" from Vikman +--- The paper also proves that the Laplace operator is self-adjoint as part of this step, +--- but we split it out +-lemma laplace_bounded (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))): ‖(Laplace f)‖ₑ ≤ 2 * ‖f‖ₑ := by ++-- Proposition 3.17.1 : "∆ is bounded" from Vikman ++lemma laplace_bounded (f : (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))) : ‖(Laplace f)‖ₑ ≤ 2 * ‖f‖ₑ := by + unfold Laplace + unfold conv_mu_lp2 + simp_rw [f_conv_mu] +@@ -326,7 +297,7 @@ lemma laplace_bounded (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G + simp + + rw [MeasureTheory.Lp.enorm_toLp] +- grw [MeasureTheory.eLpNorm_sum_le] ++ grw [MeasureTheory.eLpNorm_sum_le (by norm_num)] + simp_rw [← Function.comp_def] + conv => + lhs +@@ -358,52 +329,38 @@ lemma laplace_bounded (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G + )] + simp + rw [two_mul] +- . rw [← MeasureTheory.Lp.enorm_def] +- -- TODO - inline these in the right places +- . simp +- . +- intro i hs +- apply MeasureTheory.AEStronglyMeasurable.of_discrete +- . norm_num +- . +- apply MeasureTheory.memLp_finsetSum ++ · rw [← MeasureTheory.Lp.enorm_def] ++ · simp ++ · apply MeasureTheory.memLp_finsetSum + intro s hs + rw [← Function.comp_def] + apply MeasureTheory.MemLp.comp_of_map +- . +- simp [MeasureTheory.volume] ++ · simp [MeasureTheory.volume] + apply MeasureTheory.Lp.memLp f +- . apply AEMeasurable.of_discrete +- ++ · apply AEMeasurable.of_discrete + +-lemma laplace_bounded' (f: (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))): ‖(Laplace f)‖ ≤ 2 * ‖f‖ := by ++lemma laplace_bounded' (f : (MeasureTheory.Lp ℝ 2 (MeasureTheory.volume (α := G)))) : ‖(Laplace f)‖ ≤ 2 * ‖f‖ := by + have bounded := laplace_bounded f +- rw [← ofReal_norm_eq_enorm] at bounded +- rw [← ofReal_norm_eq_enorm] at bounded ++ rw [← ofReal_norm] at bounded ++ rw [← ofReal_norm] at bounded + simp_rw [← ENNReal.ofReal_ofNat] at bounded + rw [← ENNReal.ofReal_mul] at bounded +- . +- rw [ENNReal.ofReal_le_ofReal_iff] at bounded +- . exact bounded +- . simp +- . simp ++ · rw [ENNReal.ofReal_le_ofReal_iff] at bounded ++ · exact bounded ++ · simp ++ · simp + +-lemma tolp_apply (f: G → ℝ) {p: ENNReal} (hf: MeasureTheory.MemLp f p) (g: G): (MeasureTheory.MemLp.toLp f hf) g = f g := by ++lemma tolp_apply (f : G → ℝ) {p : ENNReal} (hf : MeasureTheory.MemLp f p) (g : G) : (MeasureTheory.MemLp.toLp f hf) g = f g := by + have eq_fun := MeasureTheory.AEEqFun.coeFn_mk f (μ := MeasureTheory.volume (α := G)) (by apply MeasureTheory.AEStronglyMeasurable.of_discrete) + rw [ae_eq_everywhere] at eq_fun + nth_rw 2 [← eq_fun] + rfl + +- + open scoped RealInnerProductSpace +-lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G)))): ⟪f, (Laplace h)⟫ = ⟪(Laplace f), h⟫ := by ++lemma laplace_self_adjoint (f h : (MeasureTheory.Lp ℝ 2 (μ := volume (α := G)))) : ⟪f, (Laplace h)⟫ = ⟪(Laplace f), h⟫ := by + + simp [MeasureTheory.L2.inner_def] + +- +- +- -- MeasureTheory.Lp.coeFn_smul +- + conv => + lhs + arg 2 +@@ -434,7 +391,6 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) + simp_rw [mul_assoc] + simp_rw [Finset.mul_sum] + +- + conv => + lhs + arg 2 +@@ -445,10 +401,9 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) + arg 1 + intro i + +- + simp_rw [tolp_apply] + rw [integral_sub] +- rw [MeasureTheory.integral_finset_sum] ++ rw [MeasureTheory.integral_finsetSum] + conv => + lhs + rhs +@@ -456,7 +411,7 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) + intro s + rw [← MeasureTheory.integral_mul_left_eq_self (g := s⁻¹)] + simp +- rw [← MeasureTheory.integral_finset_sum] ++ rw [← MeasureTheory.integral_finsetSum] + conv => + lhs + rhs +@@ -465,13 +420,13 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) + rw [← Finset.mul_sum] + rw [Finset.sum_bijective (s := S) (t := S) (e := fun s => s⁻¹) (g := fun i => (f (i * g) * (h g))) (by + refine ⟨?_, ?_⟩ +- . exact inv_injective +- . exact inv_surjective ++ · exact inv_injective ++ · exact inv_surjective + ) (by + intro a + refine ⟨?_, ?_⟩ +- . apply hGS.has_inv a +- . simpa using (hGS.has_inv a⁻¹) ++ · apply hGS.has_inv a ++ · simpa using (hGS.has_inv a⁻¹) + ) (by + simp + )] +@@ -488,7 +443,6 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) + rw [mul_comm] + rw [← mul_sub] + +- + conv => + rhs + arg 2 +@@ -499,67 +453,59 @@ lemma laplace_self_adjoint (f h: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G) + simp [f_conv_mu] + rw [tolp_apply] + +- + simp_rw [Finset.mul_sum] +- . +- have prod_lp1 := MeasureTheory.MemLp.smul (φ := f) (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp h) (MeasureTheory.Lp.memLp f) ++ · have prod_lp1 := MeasureTheory.MemLp.smul (φ := f) (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) (MeasureTheory.Lp.memLp h) + rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 +- exact prod_lp1 +- . +- apply MeasureTheory.integrable_finset_sum ++ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 ++ · apply MeasureTheory.integrable_finsetSum + intro s hs + apply MeasureTheory.Integrable.const_mul +- have mem_lp_f_comp: MemLp (f ∘ (fun x => s * x)) 2 := by ++ have mem_lp_f_comp : MemLp (f ∘ (fun x => s * x)) 2 := by + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp f +- . exact measurePreserving_mul_left volume s ++ · apply MeasureTheory.Lp.memLp f ++ · exact measurePreserving_mul_left volume s + +- have prod_lp1 := MeasureTheory.MemLp.smul (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp h) mem_lp_f_comp ++ have prod_lp1 := MeasureTheory.MemLp.smul (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_f_comp (MeasureTheory.Lp.memLp h) + rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 +- exact prod_lp1 +- . +- intro s hs ++ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 ++ · intro s hs + apply MeasureTheory.Integrable.const_mul +- have mem_lp_f_comp: MemLp (f ∘ (fun x => s⁻¹ * x)) 2 := by ++ have mem_lp_f_comp : MemLp (f ∘ (fun x => s⁻¹ * x)) 2 := by + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp f +- . exact measurePreserving_mul_left volume s⁻¹ +- have prod_lp1 := MeasureTheory.MemLp.smul (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp h) mem_lp_f_comp ++ · apply MeasureTheory.Lp.memLp f ++ · exact measurePreserving_mul_left volume s⁻¹ ++ have prod_lp1 := MeasureTheory.MemLp.smul (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_f_comp (MeasureTheory.Lp.memLp h) + rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 +- exact prod_lp1 +- . +- intro s hs ++ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 ++ · intro s hs + apply MeasureTheory.Integrable.const_mul + +- have mem_lp_h_comp: MemLp (h ∘ (fun x => s * x)) 2 := by ++ have mem_lp_h_comp : MemLp (h ∘ (fun x => s * x)) 2 := by + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp h +- . exact measurePreserving_mul_left volume s ++ · apply MeasureTheory.Lp.memLp h ++ · exact measurePreserving_mul_left volume s + +- have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_h_comp (MeasureTheory.Lp.memLp f) ++ have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) mem_lp_h_comp + rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 +- exact prod_lp1 +- . +- have prod_lp1 := MeasureTheory.MemLp.smul (φ := f) (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp h) (MeasureTheory.Lp.memLp f) ++ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 ++ · have prod_lp1 := MeasureTheory.MemLp.smul (φ := f) (f := h) (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) (MeasureTheory.Lp.memLp h) + rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 +- exact prod_lp1 +- . +- apply MeasureTheory.integrable_finset_sum ++ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 ++ · apply MeasureTheory.integrable_finsetSum + intro s hs + apply MeasureTheory.Integrable.const_mul + +- have mem_lp_h_comp: MemLp (h ∘ (fun x => s * x)) 2 := by ++ have mem_lp_h_comp : MemLp (h ∘ (fun x => s * x)) 2 := by + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp h +- . exact measurePreserving_mul_left volume s ++ · apply MeasureTheory.Lp.memLp h ++ · exact measurePreserving_mul_left volume s + +- have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_h_comp (MeasureTheory.Lp.memLp f) ++ have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) mem_lp_h_comp + rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 +- exact prod_lp1 +- ++ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 + + set_option maxHeartbeats 200000 in +-lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume (α := G)))): 0 ≤ ⟪f, (Laplace f)⟫ := by ++lemma laplace_positive_semidefinite (f : (MeasureTheory.Lp ℝ 2 (μ := volume (α := G)))) : 0 ≤ ⟪f, (Laplace f)⟫ := by + unfold Laplace + rw [inner_sub_right] + rw [real_inner_self_eq_norm_sq] +@@ -571,23 +517,22 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( + simp_rw [inner_smul_right] + simp_rw [inner_sum] + rw [integral_const_mul] +- rw [MeasureTheory.integral_finset_sum] ++ rw [MeasureTheory.integral_finsetSum] + +- -- I couldn't figure how to to handle 'toLp (∑ x ∈ S), so I ended up manipulating the integral to avoid dealing with it +- have comp_smul_left (i: G) := MeasureTheory.Lp.coeFn_compMeasurePreserving (g := f) (f := fun a => i * a) (μ := volume) (by ++ -- Finite-sum integral identities express the quadratic form on L². ++ have comp_smul_left (i : G) := MeasureTheory.Lp.coeFn_compMeasurePreserving (g := f) (f := fun a => i * a) (μ := volume) (by + exact measurePreserving_mul_left volume i + ) + simp_rw [ae_eq_everywhere] at comp_smul_left +- have congr_comp (i: G) (x: G) := congrFun (comp_smul_left i) x ++ have congr_comp (i : G) (x : G) := congrFun (comp_smul_left i) x + simp only [Function.comp_apply] at congr_comp + simp_rw [smul_eq_mul] + simp_rw [← congr_comp] + simp_rw [← MeasureTheory.L2.inner_def] + +- let f_eq_coe: f = f := by rfl ++ let f_eq_coe : f = f := by rfl + nth_rw 1 [← MeasureTheory.Lp.toLp_coeFn (f := f) (hf := Lp.memLp f)] at f_eq_coe + +- + conv => + rhs + rhs +@@ -598,19 +543,15 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( + rw [MeasureTheory.Lp.toLp_compMeasurePreserving] + simp + ++ -- Translation invariance identifies the summands as L² inner products. + +- -- We've now packed everything back up in an inner product - +- -- we no longer need to deal with commuting toLp and Finset.sum +- +- +- let conv_f_delta_lp (i: G) := MemLp.toLp (Conv (f) (delta i⁻¹)) (μ := volume) (p := 2) (by ++ let conv_f_delta_lp (i : G) := MemLp.toLp (Conv (f) (delta i⁻¹)) (μ := volume) (p := 2) (by + simp_rw [f_conv_delta_helper] + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp f +- . exact measurePreserving_mul_left volume _ ++ · apply MeasureTheory.Lp.memLp f ++ · exact measurePreserving_mul_left volume _ + ) + +- + have sum_le := Finset.sum_le_sum (g := fun i => ‖f‖ * ‖conv_f_delta_lp i‖) (f := fun i => ⟪f, conv_f_delta_lp i⟫) (s := S) (by + intro s hs + have foo := norm_inner_le_norm (x := f) (y := conv_f_delta_lp s) (𝕜 := ℝ) +@@ -635,7 +576,6 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( + rw [f_conv_delta] + simp + +- + calc + _ ≥ ‖f‖ ^ 2 - 1 / ↑(#S) * ∑ i ∈ S, ‖f‖ * ‖conv_f_delta_lp i‖ := by + +@@ -656,11 +596,11 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( + simp + rw [← Function.comp_def] + rw [MeasureTheory.eLpNorm_comp_measurePreserving (ν := volume)] +- . simp [norm] +- . apply MeasureTheory.AEStronglyMeasurable.of_discrete +- . exact measurePreserving_mul_left volume x ++ · simp [norm] ++ · apply MeasureTheory.AEStronglyMeasurable.of_discrete ++ · exact measurePreserving_mul_left volume x + simp +- have s_card_ne_zero: (#S : ℝ) ≠ 0 := by ++ have s_card_ne_zero : (#S : ℝ) ≠ 0 := by + simp + have foo := hS + simp at foo +@@ -669,41 +609,36 @@ lemma laplace_positive_semidefinite (f: (MeasureTheory.Lp ℝ 2 (μ := volume ( + rw [← mul_assoc] + simp [s_card_ne_zero] + rw [pow_two] +- . +- intro s hs ++ · intro s hs + simp + +- have mem_lp_h_comp: MemLp (f ∘ (fun x => s * x)) 2 := by ++ have mem_lp_h_comp : MemLp (f ∘ (fun x => s * x)) 2 := by + apply MeasureTheory.MemLp.comp_measurePreserving (ν := volume) +- . apply MeasureTheory.Lp.memLp f +- . exact measurePreserving_mul_left volume s ++ · apply MeasureTheory.Lp.memLp f ++ · exact measurePreserving_mul_left volume s + +- have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) (MeasureTheory.Lp.memLp f) mem_lp_h_comp ++ have prod_lp1 := MeasureTheory.MemLp.smul (p := 2) (q := 2) (r := 1) (μ := volume) mem_lp_h_comp (MeasureTheory.Lp.memLp f) + rw [MeasureTheory.memLp_one_iff_integrable] at prod_lp1 +- exact prod_lp1 +- ++ simpa only [Pi.smul_apply, smul_eq_mul, Pi.mul_def, Function.comp_apply] using prod_lp1 + + @[expose] + noncomputable def Δ := Laplace_linear.mkContinuous _ (laplace_bounded') + +-lemma Δ_symmetric: Δ.IsSymmetric := by ++lemma Δ_symmetric : Δ.IsSymmetric := by + unfold LinearMap.IsSymmetric + intro x hx + unfold Δ +- -- TODO - why doesn't this fire automatically? + simp [LinearMap.mkContinuous] + simp [Laplace_linear] + rw [laplace_self_adjoint] + +-lemma Δ_spectrum_subset: spectrum ℝ Δ ⊆ Set.Icc 0 2 := by ++lemma Δ_spectrum_subset : spectrum ℝ Δ ⊆ Set.Icc 0 2 := by + intro a ha + have restricts := ContinuousLinearMap.IsPositive.spectrumRestricts (f := Δ) (by + rw [ContinuousLinearMap.isPositive_def] + refine ⟨?_, ?_⟩ +- . +- apply Δ_symmetric +- . +- intro x ++ · apply Δ_symmetric ++ · intro x + simp [ContinuousLinearMap.reApplyInnerSelf_apply] + unfold Δ + simp [LinearMap.mkContinuous] +@@ -712,44 +647,39 @@ lemma Δ_spectrum_subset: spectrum ℝ Δ ⊆ Set.Icc 0 2 := by + apply laplace_positive_semidefinite + ) + simp +- have a_nonneg: 0 ≤ a := by +- have zero_eq: (0: ℝ) = (0: NNReal) := by ++ have a_nonneg : 0 ≤ a := by ++ have zero_eq : (0 : ℝ) = (0 : NNReal) := by + simp + rw [zero_eq] + apply (SpectrumRestricts.nnreal_le_iff restricts).mp +- . simp +- . exact ha +- ++ · simp ++ · exact ha + + refine ⟨?_, ?_⟩ +- . +- exact a_nonneg +- . +- have norm_le: ‖a‖ ≤ ‖(2: ℝ)‖ := by ++ · exact a_nonneg ++ · have norm_le : ‖a‖ ≤ ‖(2 : ℝ)‖ := by + have foo := spectrum.norm_le_norm_mul_of_mem ha + + simp at foo + simp [Δ] at foo + grw [← (ContinuousLinearMap.opNorm_le_iff (M := ‖2‖) (f := Δ) ?_).mpr] +- . +- have h := spectrum.norm_le_norm_mul_of_mem ha ++ · have h := spectrum.norm_le_norm_mul_of_mem ha + rw [ContinuousLinearMap.one_def] at h + grw [ContinuousLinearMap.norm_id_le] at h + simpa using h +- . intro x ++ · intro x + simp [Δ, LinearMap.mkContinuous, Laplace_linear] + have bound := laplace_bounded x + simp [enorm] at bound + norm_cast at bound +- . simp ++ · simp + + simp at norm_le + rw [abs_of_nonneg] at norm_le +- . exact norm_le +- . exact a_nonneg ++ · exact norm_le ++ · exact a_nonneg + +- +-lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ spectrum ℝ Δ := by ++lemma laplace_spectrum_contains_zero (f_n_limit : f_n_conv_delta_tendsto) : 0 ∈ spectrum ℝ Δ := by + rw [spectrum.zero_mem_iff] + by_contra this + obtain ⟨f, hf⟩ := this +@@ -761,8 +691,8 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ + use 0 + use MemLp.toLp (Pi.single 1 1) (by + apply Continuous.memLp_of_hasCompactSupport +- . apply continuous_of_discreteTopology +- . simp [HasCompactSupport, tsupport] ++ · apply continuous_of_discreteTopology ++ · simp [HasCompactSupport, tsupport] + ) + simp + rw [MeasureTheory.Lp.ext_iff] +@@ -779,7 +709,7 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ + + have norm_mul_bound := ContinuousLinearEquiv.one_le_norm_mul_norm_symm (ContinuousLinearEquiv.ofUnit f) + +- have inv_norm_ge (n: ℕ) : (1 : ENNReal) / (eLpNorm (Laplace_b (F_n n)) 2 (μ := volume (α := G))) ≤ ENNReal.ofReal ‖f.inv‖ := by ++ have inv_norm_ge (n : ℕ) : (1 : ENNReal) / (eLpNorm (Laplace_b (F_n n)) 2 (μ := volume (α := G))) ≤ ENNReal.ofReal ‖f.inv‖ := by + + calc + _ = (eLpNorm (F_n n) 2 (μ := volume (α := G))) / ((eLpNorm (Laplace_b (F_n n)) 2 (μ := volume (α := G)))) := by +@@ -795,7 +725,6 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ + lhs + rw [Lp.norm_def] + +- + conv => + lhs + arg 1 +@@ -804,21 +733,20 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ + rhs + rhs + simp [hf, Δ, Laplace, Laplace_linear] +- simp [-AddSubgroupClass.coe_sub, -AddSubgroup.coe_sub, Laplace] ++ simp [-AddSubgroupClass.coe_sub, -AddSubgroup.coe_sub] + apply_fun ENNReal.ofReal at other +- -- TODO - consider removing @[simp] from 'AddSubgroupClass.coe_sub' + simp only [map_sub, ofReal_norm] at other + simp only [← Units.inv_eq_val_inv] +- simp only [F_n_lp2, Laplace_b, ← hf, conv_mu_lp2] ++ simp only [F_n_lp2, Laplace_b, conv_mu_lp2] + --simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] +- by_cases norm_f_eq_zero: ‖F_n_lp2 n - conv_mu_lp2 (F_n_lp2 n)‖ = 0 +- . rw [norm_eq_zero] at norm_f_eq_zero ++ by_cases norm_f_eq_zero : ‖F_n_lp2 n - conv_mu_lp2 (F_n_lp2 n)‖ = 0 ++ · rw [norm_eq_zero] at norm_f_eq_zero + have foo := laplace_zero_iff_zero (F_n_lp2 n) (by + simp [Laplace] + exact norm_f_eq_zero + ) + simp [F_n_lp2] at foo +- apply_fun (fun f => (f: (G → ℝ))) at foo ++ apply_fun (fun f => (f : (G → ℝ))) at foo + simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] at foo + conv at foo => + rhs +@@ -827,7 +755,7 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ + simp [foo] + unfold Conv + simp +- have const_zero: (fun (x: G) => (0 : ℝ)) = 0 := by rfl ++ have const_zero : (fun (x : G) => (0 : ℝ)) = 0 := by rfl + conv => + pattern MemLp.toLp _ _ + equals 0 => +@@ -839,32 +767,28 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ + simp_rw [ae_eq_everywhere.mp (MeasureTheory.AEEqFun.coeFn_zero)] + simp + rw [ENNReal.ofReal_div_of_pos] at other +- . +- simp only [ofReal_norm, Lp.enorm_def] at other ++ · simp only [ofReal_norm, Lp.enorm_def] at other + rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] at other + simp only [F_n_lp2, conv_mu_lp2] at other + simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] at other + rw [ENNReal.ofReal_toReal] at other +- . +- rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] ++ · rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] + rw [ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] at other + simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] at other + simp at other + simp + simp_rw [ae_eq_everywhere.mp (MemLp.coeFn_toLp _)] + exact other +- . +- rw [← ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] ++ · rw [← ae_eq_everywhere.mp (Lp.coeFn_sub _ _)] + apply MeasureTheory.Lp.eLpNorm_ne_top +- . simpa using norm_f_eq_zero +- . exact ENNReal.ofReal_mono +- . +- rw [isBoundedLinearMap_iff] at inv_bounded ++ · simpa using norm_f_eq_zero ++ · exact ENNReal.ofReal_mono ++ · rw [isBoundedLinearMap_iff] at inv_bounded + obtain ⟨M, M_pos, le_M⟩ := inv_bounded.2 + + have foo := F_n_conv_mu_lim f_n_limit + rw [ENNReal.tendsto_atTop_zero] at foo +- obtain ⟨n, hn⟩ := foo ((1: ENNReal) /(2 * ‖f.inv‖ₑ)) (by ++ obtain ⟨n, hn⟩ := foo ((1 : ENNReal) /(2 * ‖f.inv‖ₑ)) (by + simp + rw [ENNReal.mul_eq_top] + simp +@@ -880,7 +804,7 @@ lemma laplace_spectrum_contains_zero (f_n_limit: f_n_conv_delta_tendsto): 0 ∈ + grw [hn] at inv_norm_ge + simp at inv_norm_ge + +- have norm_nonzero :‖f.inv‖ ≠ 0 := by ++ have norm_nonzero : ‖f.inv‖ ≠ 0 := by + by_contra! + simp at this + +diff --git a/Gromov/HarmonicR2.lean b/Gromov/HarmonicR2.lean +index 44f0aa9..752d6fd 100644 +--- a/Gromov/HarmonicR2.lean ++++ b/Gromov/HarmonicR2.lean +@@ -12,11 +12,6 @@ a ball of radius `2R`. + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -27,7 +22,200 @@ open Generates + variable [hGS: Generates] + include hGS + +-set_option maxHeartbeats 9000000 in ++private noncomputable def harmonicCutoff (r : ℕ) (x : G) : ℝ := ++ if WordNorm x ≤ 2 * r + 1 then 1 ++ else if WordNorm x ≤ 4 * r then -(WordNorm x : ℝ) / (2 * (r : ℝ)) + 2 else 0 ++ ++private lemma harmonic_cutoff_step (f : G → ℝ) (r : ℕ) (hr : r ≠ 0) ++ (x : G) (hx : x ∈ Metric.closedBall 1 (4 * r)) (s : G) (hs : s ∈ S) : ++ (f x)^2 * (harmonicCutoff r (s * x) - harmonicCutoff r x)^2 ≤ ++ (1 : ℝ) / r^2 * (f x)^2 := by ++ simp [harmonicCutoff] ++ have norm_s_x := word_dist_mul_eq (x := 1) (y := s) (z := x) hs ++ simp_rw [WordDist_comm] at norm_s_x ++ simp_rw [WordDist_one] at norm_s_x ++ rw [← or_assoc] at norm_s_x ++ cases norm_s_x ++ . ++ rename_i norm_s_x_eq ++ cases norm_s_x_eq ++ . ++ rename_i s_lt ++ simp [dist] at hx ++ norm_cast at hx ++ rw [WordDist_one] at hx ++ by_cases s_x_le: WordNorm (s * x) ≤ 2 *r + 1 ++ . ++ simp [s_x_le] ++ simp [s_lt] ++ split_ifs ++ . simp ++ positivity ++ . ++ have s_x_eq: WordNorm (s * x) = 2 *r + 1 := by grind ++ simp [s_x_eq] ++ field_simp ++ apply mul_le_mul ++ . simp ++ . ++ norm_num ++ ring_nf ++ norm_num ++ . positivity ++ . positivity ++ . ++ grind ++ . ++ have sub_eq: (WordNorm x) - 1 = WordNorm (s * x) := by omega ++ have s_x_le_four: WordNorm (s * x) ≤ 4 * r := by ++ simp [s_lt] at hx ++ grind ++ simp [s_x_le, s_x_le_four] ++ split_ifs ++ . ++ grind ++ . ++ simp [← sub_eq] ++ rw [← sub_div] ++ simp ++ field_simp ++ conv => ++ lhs ++ rhs ++ lhs ++ equals 1 => ++ rw [sub_eq] ++ rw [s_lt] ++ push_cast ++ ring ++ simp ++ norm_num ++ -- TODO - surely this can be simplified ++ by_cases f_x_zero: (f x) ^2 = 0 ++ . simp [f_x_zero] ++ ++ rw [le_mul_iff_one_le_right] ++ . norm_num ++ . positivity ++ . ++ rename_i s_lt ++ simp [dist] at hx ++ norm_cast at hx ++ rw [WordDist_one] at hx ++ by_cases s_x_le: WordNorm (s * x) ≤ 2*r + 1 ++ . ++ simp [s_x_le] ++ split_ifs ++ . simp ++ positivity ++ . ++ have s_x_eq: WordNorm (s * x) = 2 *r := by grind ++ simp ++ rw [mul_comm] ++ apply mul_le_mul ++ . ++ ring_nf ++ norm_num ++ field_simp ++ rw [mul_sub] ++ rw [← pow_two] ++ rw [sub_mul] ++ conv => ++ lhs ++ equals (2 * r) * (2 * r) - (WordNorm x) * 2 * r * 2 + (WordNorm x)^2 => ++ ring ++ rename_i x_gt ++ simp at x_gt ++ omega ++ . simp ++ . positivity ++ . norm_num ++ . ++ by_cases norm_x_eq: WordNorm x = 4 * r ++ . ++ have not_le: ¬(WordNorm (s * x) ≤ (2 *r) + 1) := by grind ++ have not_le_four: ¬(WordNorm (s * x) ≤ (4 *r)) := by grind ++ have x_le: (WordNorm (x) ≤ (4 *r)) := by grind ++ have not_x_le: ¬(WordNorm (x) ≤ (2 *r) + 1) := by grind ++ simp [not_le, not_le_four, x_le, not_x_le] ++ rw [mul_comm] ++ -- TODO - surely this can be simplified ++ by_cases f_x_zero: (f x) ^2 = 0 ++ . simp [f_x_zero] ++ rw [mul_le_mul_iff_left₀] ++ . ++ field_simp ++ grw [x_le] ++ grind ++ simp ++ norm_num ++ simp [norm_x_eq] ++ . positivity ++ ++ have sub_eq: (WordNorm x) = WordNorm (s * x) - 1 := by omega ++ have s_x_le_four: WordNorm (s * x) ≤ 4 * r := by ++ rw [← s_lt] ++ grind ++ simp [s_x_le, s_x_le_four] ++ split_ifs ++ . ++ field_simp ++ -- TODO - surely this can be simplified ++ by_cases f_x_zero: (f x) ^2 = 0 ++ . simp [f_x_zero] ++ ++ rw [mul_le_mul_iff_right₀] ++ . ++ norm_num ++ field_simp ++ conv => ++ lhs ++ lhs ++ ring_nf ++ conv => ++ rhs ++ equals (2^2) => ++ norm_num ++ ++ have norm_x_eq: WordNorm x = 2 *r + 1 := by grind ++ rw [← s_lt, norm_x_eq] ++ conv => ++ lhs ++ lhs ++ simp ++ field_simp ++ ring_nf ++ norm_num ++ ++ . positivity ++ . ++ simp ++ rw [← sub_div] ++ simp ++ field_simp ++ conv => ++ lhs ++ rhs ++ lhs ++ equals -1 => ++ rw [sub_eq] ++ rw [Nat.cast_sub (by grind)] ++ ring ++ simp ++ norm_num ++ -- TODO - surely this can be simplified ++ by_cases f_x_zero: (f x) ^2 = 0 ++ . simp [f_x_zero] ++ ++ rw [le_mul_iff_one_le_right] ++ . norm_num ++ . positivity ++ ++ . ++ rename_i norm_eq ++ simp [← norm_eq] ++ positivity ++ + lemma harmonic_r2_inequality (f : G → ℝ) (hf : Laplace_b f = 0) (r: ℕ) (hr: r ≠ 0): + ∑ x ∈ Metric.closedBall 1 (2 * r), deriv_sq f x ≤ ((1: ℝ) / r^2) * #(S) * ∑ x ∈ Metric.closedBall 1 (4 * r), f x ^ 2 := by + -- `deriv_sq f x = ∑ s, (f (s*x) - f x)^2`; the proof below is written with the +@@ -43,30 +231,24 @@ lemma harmonic_r2_inequality (f : G → ℝ) (hf : Laplace_b f = 0) (r: ℕ) (hr + -- m * (2 *r) - * (4 * r * m) = 1 + -- 2rm - 4rm = 1 + -- m = -1/2 +- let φ := fun (x: G) => if WordNorm x ≤ (2 * r) + 1 then 1 else if (WordNorm x ≤ 4 * r) then (-(WordNorm x)/(2 * (r: ℝ))) + 2 else 0 ++ let φ := harmonicCutoff r + have phi_support : φ.support ⊆ Metric.ball 1 (4 * r) := by + intro s hs +- simp at hs +- rw [ite_eq_iff] at hs +- simp at hs +- by_cases s_gt: 2 * r + 1 < (WordNorm s) +- . +- specialize hs s_gt +- simp [dist] +- rw [WordDist_one] +- by_cases eq_four: WordNorm s = 4*r +- . +- simp [eq_four] at hs +- field_simp [hr] at hs +- norm_num at hs +- . +- norm_cast +- grind +- . +- simp at s_gt +- simp [dist, WordDist_one] +- norm_cast +- grind ++ have hsne : harmonicCutoff r s ≠ 0 := hs ++ have hslt : WordNorm s < 4 * r := by ++ by_contra h ++ have hge : 4 * r ≤ WordNorm s := by omega ++ have hshort : ¬ WordNorm s ≤ 2 * r + 1 := by omega ++ by_cases heq : WordNorm s = 4 * r ++ · apply hsne ++ rw [harmonicCutoff, ite_eq_right hshort, ite_eq_left heq.le, heq] ++ push_cast ++ field_simp [hr] ++ ring ++ · have hlong : ¬ WordNorm s ≤ 4 * r := by omega ++ exact hsne (by simp [harmonicCutoff, hshort, hlong]) ++ simp only [Metric.mem_ball, dist, WordDist_one] ++ exact_mod_cast hslt + + have foo := cutoff_inequality f φ hf ?_ + . +@@ -91,201 +273,13 @@ lemma harmonic_r2_inequality (f : G → ℝ) (hf : Laplace_b f = 0) (r: ℕ) (hr + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro s hs +- simp [φ] +- have norm_s_x := word_dist_mul_eq (x := 1) (y := s) (z := x) hs +- simp_rw [WordDist_comm] at norm_s_x +- simp_rw [WordDist_one] at norm_s_x +- rw [← or_assoc] at norm_s_x +- cases norm_s_x +- . +- rename_i norm_s_x_eq +- cases norm_s_x_eq +- . +- rename_i s_lt +- simp [dist] at hx +- norm_cast at hx +- rw [WordDist_one] at hx +- by_cases s_x_le: WordNorm (s * x) ≤ 2 *r + 1 +- . +- simp [s_x_le] +- simp [s_lt] +- split_ifs +- . simp +- positivity +- . +- have s_x_eq: WordNorm (s * x) = 2 *r + 1 := by grind +- simp [s_x_eq] +- field_simp +- apply mul_le_mul +- . simp +- . +- norm_num +- ring +- norm_num +- . positivity +- . positivity +- . +- grind +- . +- have sub_eq: (WordNorm x) - 1 = WordNorm (s * x) := by omega +- have s_x_le_four: WordNorm (s * x) ≤ 4 * r := by +- simp [s_lt] at hx +- grind +- simp [s_x_le, s_x_le_four] +- split_ifs +- . +- grind +- . +- simp [← sub_eq] +- rw [← sub_div] +- simp +- field_simp +- push_cast +- conv => +- lhs +- rhs +- lhs +- equals 1 => +- rw [sub_eq] +- rw [s_lt] +- push_cast +- ring +- simp +- norm_num +- -- TODO - surely this can be simplified +- by_cases f_x_zero: (f x) ^2 = 0 +- . simp [f_x_zero] +- +- rw [le_mul_iff_one_le_right] +- . norm_num +- . positivity +- . +- rename_i s_lt +- simp [dist] at hx +- norm_cast at hx +- rw [WordDist_one] at hx +- by_cases s_x_le: WordNorm (s * x) ≤ 2*r + 1 +- . +- simp [s_x_le] +- split_ifs +- . simp +- positivity +- . +- have s_x_eq: WordNorm (s * x) = 2 *r := by grind +- simp [s_x_eq] +- rw [mul_comm] +- apply mul_le_mul +- . +- norm_num +- ring +- norm_num +- field_simp +- rw [mul_sub] +- rw [← pow_two] +- rw [sub_mul] +- conv => +- lhs +- equals (2 * r) * (2 * r) - (WordNorm x) * 2 * r * 2 + (WordNorm x)^2 => +- ring +- rename_i x_gt +- simp at x_gt +- omega +- . simp +- . positivity +- . norm_num +- . +- by_cases norm_x_eq: WordNorm x = 4 * r +- . +- have not_le: ¬(WordNorm (s * x) ≤ (2 *r) + 1) := by grind +- have not_le_four: ¬(WordNorm (s * x) ≤ (4 *r)) := by grind +- have x_le: (WordNorm (x) ≤ (4 *r)) := by grind +- have not_x_le: ¬(WordNorm (x) ≤ (2 *r) + 1) := by grind +- simp [not_le, not_le_four, x_le, not_x_le] +- rw [mul_comm] +- -- TODO - surely this can be simplified +- by_cases f_x_zero: (f x) ^2 = 0 +- . simp [f_x_zero] +- rw [mul_le_mul_iff_left₀] +- . +- field_simp +- grw [x_le] +- grind +- simp +- norm_num +- simp [norm_x_eq] +- . positivity +- +- have sub_eq: (WordNorm x) = WordNorm (s * x) - 1 := by omega +- have s_x_le_four: WordNorm (s * x) ≤ 4 * r := by +- rw [← s_lt] +- grind +- simp [s_x_le, s_x_le_four] +- split_ifs +- . +- field_simp +- -- TODO - surely this can be simplified +- by_cases f_x_zero: (f x) ^2 = 0 +- . simp [f_x_zero] +- +- rw [mul_le_mul_iff_right₀] +- . +- norm_num +- field_simp +- conv => +- lhs +- lhs +- ring +- conv => +- rhs +- equals (2^2) => +- norm_num +- +- have norm_x_eq: WordNorm x = 2 *r + 1 := by grind +- rw [← s_lt, norm_x_eq] +- conv => +- lhs +- lhs +- simp +- field_simp +- ring +- norm_num +- +- . positivity +- . +- simp [← sub_eq] +- rw [← sub_div] +- simp +- field_simp +- push_cast +- conv => +- lhs +- rhs +- lhs +- equals -1 => +- rw [sub_eq] +- push_cast +- rw [Nat.cast_sub (by grind)] +- ring +- simp +- norm_num +- -- TODO - surely this can be simplified +- by_cases f_x_zero: (f x) ^2 = 0 +- . simp [f_x_zero] +- +- rw [le_mul_iff_one_le_right] +- . norm_num +- . positivity +- +- . +- rename_i norm_eq +- simp [← norm_eq] +- positivity ++ exact harmonic_cutoff_step f r hr x (by simpa using hx) s hs + . rfl + . intro x hx + apply Finset.sum_congr + . rfl + . intro s hs +- simp [φ] ++ simp [φ, harmonicCutoff] + simp [dist, WordDist_one] at hx + norm_cast at hx + have hx_le : WordNorm x ≤ 2 * r + 1 := by grind +@@ -367,6 +361,5 @@ lemma harmonic_r2_inequality (f : G → ℝ) (hf : Laplace_b f = 0) (r: ℕ) (hr + apply finite_ball + . exact phi_support + +-#print axioms harmonic_r2_inequality + + end GeneratesNS +diff --git a/Gromov/Laplace.lean b/Gromov/Laplace.lean +index 4f525b7..afd4e3b 100644 +--- a/Gromov/Laplace.lean ++++ b/Gromov/Laplace.lean +@@ -23,7 +23,6 @@ set_option linter.style.longLine false + set_option linter.style.cdot false + -- TODO - vscode stops reporting underlines if there are too many total underlines / gutter messages + -- I've disabled some failing lints for now so that error underlines still sho up +-set_option linter.style.commandStart false + + open Subgroup + open scoped Finset +diff --git a/Gromov/Lemma326.lean b/Gromov/Lemma326.lean +index 430b325..03cbd45 100644 +--- a/Gromov/Lemma326.lean ++++ b/Gromov/Lemma326.lean +@@ -12,11 +12,6 @@ basis. + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -62,7 +57,6 @@ noncomputable def phi (data: GoodScalesData b): V →ₗ[ℝ] EuclideanSpace ℝ + + @[expose] def C: ℝ := 32 * (#S) + +-set_option maxHeartbeats 2500000 in + lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * (#(S^(R_1 data ))) * ‖(phi data u)‖^2 + C * (Real.exp ((2 * a data.d))) * (R_1 data + 1)^2 * (∑ x ∈ B_r (8 * R_2 data), deriv_sq u x) := by + + rw [Q_R] +@@ -132,7 +126,7 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( + rw [add_comm] + apply add_le_add + . +- ring ++ ring_nf + simp + + . +@@ -197,10 +191,10 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( + simp at foo + grind + grw [i_1_le] +- ring ++ ring_nf + . + rw [← le_sub_iff_add_le] +- ring ++ ring_nf + have i_2_pos := (GoodScales data).i_2_pos + have le_one: 1 ≤ (GoodScales data).i_2 := by grind + grw [← le_one] +@@ -229,7 +223,7 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( + equals (32 * ↑(#S) * (Real.exp (a data.d) * (↑(R_1 data) + 1) ^ 2)) * ((Real.exp (a data.d)) * ∑ x ∈ B_r (8 * ↑(R_2 data)), deriv_sq (⇑u.val) x) => + ring + apply mul_le_mul +- . ring ++ . ring_nf + simp + . + grw [Finset.sum_le_sum (g := fun x => Real.exp (a data.d) * (deriv_sq (u.val).toFun x))] +@@ -241,10 +235,10 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( + norm_cast + norm_cast at card_inter_le + grw [card_inter_le] +- simp [deriv_sq, ← pow_two] ++ simp [deriv_sq] + positivity + +- . simp [deriv_sq, ← pow_two] ++ . simp [deriv_sq] + apply Finset.sum_nonneg + intro i hi + norm_cast +@@ -280,7 +274,6 @@ lemma lemma_3_26_a (data: GoodScalesData b) (u: V): Q_R (R_2 data) u u ≤ 2 * ( + rw [← pow_two] + positivity + +-#print axioms lemma_3_26_a + + -- Controlled grwoth + +diff --git a/Gromov/LipschitzNorm.lean b/Gromov/LipschitzNorm.lean +index 8e23a57..64dd7bf 100644 +--- a/Gromov/LipschitzNorm.lean ++++ b/Gromov/LipschitzNorm.lean +@@ -21,8 +21,6 @@ seminormed space. The quotient space `W := LipschitzH ⧸ ConstF` is an actual n + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false + + namespace GeneratesNS + open Generates +@@ -43,7 +41,6 @@ lemma lipschiz_norm_zero: LipschitzSemiNorm (0) = 0 := by + exact nonpos_iff_eq_zero.mp sinf_le + + +-#synth IsStrictOrderedRing NNReal + + -- TODO - upstream to mathlib + lemma lipschitz_attains_norm (f: G → ℝ) (hf: IsLipschitz f): LipschitzWith (LipschitzSemiNorm f) f := by +@@ -167,10 +164,9 @@ lemma lipschitzSemiNorm_neg (f : G → ℝ) : LipschitzSemiNorm (-f) = Lipschitz + unfold LipschitzSemiNorm + congr 1 + ext k +- simp only [Set.mem_setOf_eq, lipschitzWith_neg_iff] ++ simp only [Set.mem_ofPred_eq, lipschitzWith_neg_iff] + + +-set_option maxHeartbeats 1000000 in + noncomputable instance LipschitzH_seminorm: SeminormedAddCommGroup (LipschitzH) where + norm := fun v => LipschitzSemiNorm v + dist_self := by +@@ -295,7 +291,7 @@ lemma iterated_lipschitz_bound (f: LipschitzH): ∀ g: G, ‖f g‖ ≤ (Lipschi + norm_cast + rw [Nat.add_sub_of_le (by grind)] + simp [DFunLike.coe] +- ring ++ ring_nf + norm_cast + conv => + lhs +diff --git a/Gromov/MatrixSubsum.lean b/Gromov/MatrixSubsum.lean +index ec60107..88c0b4b 100644 +--- a/Gromov/MatrixSubsum.lean ++++ b/Gromov/MatrixSubsum.lean +@@ -164,7 +164,7 @@ lemma eigen_nonzero {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ): ∀ (k : Modul + intro k + by_contra! + have eigen_zero := LinearMap.hasEigenvalue_zero_tfae ((A.val.map (Int.castRingHom ℂ)).toLin') +- have det_zero := (eigen_zero.out 0 3).mp ++ have det_zero := (eigen_zero.out 1 4).mp + have has_k := k.prop + conv at has_k => + lhs +@@ -195,8 +195,7 @@ lemma eigen_nonzero {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ): ∀ (k : Modul + . simp + exact Int.cast_injective + +-@[expose] +-def KroneckerPow_exists {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ) (k: Module.End.Eigenvalues (A.val.map (Int.castRingHom ℂ)).toLin') (eigen_one_complex: ∀ k : Module.End.Eigenvalues ((A.val.map (Int.castRingHom ℂ ))).toLin', ‖k.val‖ = 1) := Polynomial.pow_eq_one_of_mahlerMeasure_eq_one (by ++theorem KroneckerPow_exists {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ) (k: Module.End.Eigenvalues (A.val.map (Int.castRingHom ℂ)).toLin') (eigen_one_complex: ∀ k : Module.End.Eigenvalues ((A.val.map (Int.castRingHom ℂ ))).toLin', ‖k.val‖ = 1) : ∃ n : ℕ, 0 < n ∧ (k : ℂ) ^ n = 1 := Polynomial.pow_eq_one_of_mahlerMeasure_eq_one (by + rw [Polynomial.mahlerMeasure_eq_leadingCoeff_mul_prod_roots] + rw [Polynomial.Monic.leadingCoeff] + . +@@ -279,7 +278,7 @@ lemma int_matrix_unipotent {d: ℕ} (hd: 0 < d) (n: ℕ) (hn: 0 < n) (A: (Matrix + intro k + by_contra! + have eigen_zero := LinearMap.hasEigenvalue_zero_tfae (A_C.toLin') +- have det_zero := (eigen_zero.out 0 3).mp ++ have det_zero := (eigen_zero.out 1 4).mp + have has_k := k.prop + conv at has_k => + lhs +@@ -518,8 +517,6 @@ lemma int_matrix_unipotent {d: ℕ} (hd: 0 < d) (n: ℕ) (hn: 0 < n) (A: (Matrix + . exact Int.cast_injective + + +-#print axioms int_matrix_unipotent +-#print axioms int_matrix_poly_growth_eigenvalue + + + open scoped Pointwise Finset +diff --git a/Gromov/MatrixSubsum/Subsums.lean b/Gromov/MatrixSubsum/Subsums.lean +index 3f723a7..370ac6f 100644 +--- a/Gromov/MatrixSubsum/Subsums.lean ++++ b/Gromov/MatrixSubsum/Subsums.lean +@@ -19,8 +19,7 @@ structure DerivedSets {R: Type*} [NormedCommRing R] {n: ℕ} (A: Matrix (Fin n) + supp_disj: Disjoint (p \ q) (q \ p) + + +-@[expose] +-def poly_cancel {R: Type*} [NormedCommRing R] {n: ℕ} (A: Matrix (Fin n) (Fin n) R) (v: (Fin n) → R) (p q : Finset ℕ) (hpq: p.sum (fun k => A^k • v) = q.sum (fun k => A^k • v)) : DerivedSets A v p q := ({ ++theorem poly_cancel {R: Type*} [NormedCommRing R] {n: ℕ} (A: Matrix (Fin n) (Fin n) R) (v: (Fin n) → R) (p q : Finset ℕ) (hpq: p.sum (fun k => A^k • v) = q.sum (fun k => A^k • v)) : DerivedSets A v p q := ({ + h_prime := by + have p_inter_subset : p ∩ q ⊆ q := by + simp +@@ -118,15 +117,12 @@ lemma interval_sum_le {R: Type*} {d: ℕ} [RCLike R] [ NormSMulClass R (Fin d + simp + rw [Matrix.dotProduct_mulVec] + rw [mul_pow_exact A φ k hva] +- norm_cast +- + rw [Matrix.dotProduct_mulVec] at ih + rw [mul_pow_exact A φ k hva] at ih + apply_fun (fun x => x + ‖k‖ ^ n * ‖v‖) at ih + . + simp only [] at ih + +- norm_cast at ih + simp at ih + grw [ih] + simp +@@ -144,7 +140,6 @@ lemma interval_sum_le {R: Type*} {d: ℕ} [RCLike R] [ NormSMulClass R (Fin d + exact hab + . linarith + +-#print axioms interval_sum_le + + + theorem hasEigenvalue_of_isRoot_charpoly {R : Type*} {M : Type*} [CommRing R] [AddCommGroup M] [Module R M] {f : Module.End R M} {μ : R} [IsDomain R] [Module.Finite R M] [Module.Free R M] (h : (f.charpoly).IsRoot μ) : f.HasEigenvalue μ := by +@@ -212,7 +207,7 @@ lemma int_matrix_eigenvalue {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ): + equals ∏ i ∈ A_C.charpoly.roots.toEnumFinset, 1 => + simp + +- apply Finset.prod_lt_prod ++ apply Finset.prod_lt_prod₀ + . + intro i hi + simp at hi +@@ -285,9 +280,7 @@ lemma int_matrix_eigenvalue {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)ˣ): + norm_num at roots_prod_le + + +-#print axioms int_matrix_eigenvalue + +-set_option maxHeartbeats 1200000 in + lemma subsums_unique {d: ℕ} (A: Matrix (Fin d) (Fin d) ℂ) (φ v: (Fin d) → ℂ) (N₀ N: ℕ) (hv: ‖φ ⬝ᵥ v‖ ≠ 0) (k: ℂ) (hk: 3 ≤ ‖k‖) (hva: A.vecMul φ = k • φ) (hn: N₀ ≤ N) (p q: Finset ℕ) + (hp: p ⊆ Finset.Ico N₀ N) (hq: q ⊆ Finset.Ico N₀ N) (hpq: p.sum (fun k => A^k • v) = q.sum (fun k => A^k • v)): + p = q := by +@@ -433,7 +426,6 @@ lemma subsums_unique {d: ℕ} (A: Matrix (Fin d) (Fin d) ℂ) (φ v: (Fin d) → + intro a ha b hb + grind + +-#print axioms subsums_unique + + + lemma int_matrix_exponential_growth {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)) (φ : (Fin d) → ℂ) (v: Fin d → ℤ) (v_ne_zero: ‖φ ⬝ᵥ (Int.castRingHom ℂ) ∘ v‖ ≠ 0) (k: ℂ) (hv: (A.map (Int.castRingHom ℂ)).vecMul φ = (k • φ)) (k_gt: 1 < ‖k‖): +@@ -505,4 +497,3 @@ lemma int_matrix_exponential_growth {d: ℕ} (A: (Matrix (Fin d) (Fin d) ℤ)) ( + rw [Finset.sum_apply (a := v)] + rw [Finset.sum_apply (a := v)] + rw [hab] +-#print axioms int_matrix_exponential_growth +diff --git a/Gromov/NilpotentFinite.lean b/Gromov/NilpotentFinite.lean +index ffe4196..541722a 100644 +--- a/Gromov/NilpotentFinite.lean ++++ b/Gromov/NilpotentFinite.lean +@@ -1,26 +1,20 @@ +-/- +-This file was edited by Aristotle. ++module + +-Lean version: leanprover/lean4:v4.24.0 +-Mathlib version: f897ebcf72cd16f89ab4577d0c826cd14afaafc7 +-This project request had uuid: c7b9eaaf-b542-48c8-afcd-8a008aa813c3 ++public import Mathlib + +-The following was proved by Aristotle: ++/-! # Finiteness of finitely generated nilpotent torsion groups + +-- lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNilpotent G] (m: ℕ) (hm: 0 < m) (hg: ∀ g : G, g^m = 1): Finite G ++The proof is by induction on the nilpotency class, using the central quotient ++and finite generation of finite-index subgroups. Formalized by Aristotle. + -/ + +-module +- +-public import Mathlib +- + + public section + open scoped IsMulCommutative + +-lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNilpotent G] (hG: Monoid.IsTorsion G): Finite G := by ++lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNilpotent G] (hG: IsMulTorsion G): Finite G := by + induction' n : Group.nilpotencyClass G with n ih generalizing G <;> simp_all +decide [ Group.nilpotencyClass ]; +- · rw [ eq_top_iff ] at n ; aesop; ++ · rw [ eq_top_iff ] at n; + -- Since the top subgroup is equal to the bottom subgroup, G must be trivial. + have h_trivial : ∀ g : G, g = 1 := by + simp_all +decide [ Subgroup.eq_bot_iff_forall ]; +@@ -40,7 +34,7 @@ lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNi + rw [← QuotientGroup.out_eq' (a := g)] + erw [ QuotientGroup.eq_one_iff ] + simp [hn.2] +- · have e := nilpotencyClass_quotient_center (G := G) ++ · have e := Group.nilpotencyClass_quotient_center (G := G) + have hq : Group.IsNilpotent (G ⧸ Subgroup.center G) := inferInstance + simp_all +decide [Group.nilpotencyClass] + -- Since $Z(G)$ is finitely generated and torsion, it is finite. +@@ -50,7 +44,7 @@ lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNi + convert Subgroup.fg_of_index_ne_zero ?_; + · infer_instance; + · exact Subgroup.finiteIndex_iff_finite_quotient.mpr h_quot_finite; +- have h_center_torsion : Monoid.IsTorsion (↥(Subgroup.center G)) := by ++ have h_center_torsion : IsMulTorsion (↥(Subgroup.center G)) := by + intro x; + rw [isOfFinOrder_iff_pow_eq_one] + specialize hG x +@@ -61,5 +55,5 @@ lemma finite_of_nilpotent_fg_order {G: Type*} [Group G] [Group.FG G] [Group.IsNi + rw [Subtype.ext_iff] + simp + exact hn.2 +- exact CommGroup.finite_of_fg_torsion (↥(Subgroup.center G)) h_center_torsion; ++ exact CommGroup.finite_of_fg_isMulTorsion (↥(Subgroup.center G)) h_center_torsion; + convert Finite.of_subgroup_quotient ( H := Subgroup.center G ) +diff --git a/Gromov/Packing.lean b/Gromov/Packing.lean +index 14de782..7d49b7c 100644 +--- a/Gromov/Packing.lean ++++ b/Gromov/Packing.lean +@@ -12,11 +12,6 @@ the intersection-multiplicity bound `card_B_le_exp_wa`. + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -55,8 +50,6 @@ noncomputable def GoodScales (data: GoodScalesData b) := Classical.choice (lemma + + @[expose] noncomputable def R_1 (data: GoodScalesData b) := 2 * 16^(GoodScales data).i_1 + @[expose] noncomputable def R_2 (data: GoodScalesData b) := 16^(GoodScales data).i_2 +- +--- TODO - does it matter than 'Metric.maximalSeparatedSet' uses 'R_1 < dist' instead of 'R_1 <= dist' ? + @[expose] def X_j (data: GoodScalesData b) := Metric.maximalSeparatedSet (R_1 data) ((Metric.closedBall (1: G) (R_2 data))) + -- A collection of disjoint balls that cover the ball R_2 + @[expose] def B (data: GoodScalesData b) := (fun a => Metric.closedBall a (R_1 data)) '' (X_j data) +@@ -87,10 +80,8 @@ lemma B_ball_injective_on (data: GoodScalesData b) (R: ℝ) (R_pos: 0 ≤ R) (hR + simp [edist, PseudoMetricSpace.edist] at sep + rw [dist_comm] at b_mem + simp [dist] at b_mem +- norm_cast at b_mem + rify at sep + grw [b_mem] at sep +- norm_cast at sep + grind + + lemma B_covers_R2 (data: GoodScalesData b): Metric.closedBall 1 (R_2 data) ⊆ ⋃₀ (B data) := by +@@ -100,44 +91,44 @@ lemma B_covers_R2 (data: GoodScalesData b): Metric.closedBall 1 (R_2 data) ⊆ + + -- Metric.maximalSeparatedSet_subset + have card_le := Metric.encard_le_of_isSeparated (C := (X_j data) ∪ {x}) (ε := (R_1 data)) (A := ( (Metric.closedBall 1 (R_2 data)))) ?_ ?_ ?_ +- . ++ · + simp [X_j] at card_le + rw [Set.encard_insert_of_notMem] at card_le + rw [Set.Finite.encard_eq_coe_toFinset_card] at card_le +- . norm_cast at card_le ++ · norm_cast at card_le + + grind +- . ++ · + apply Set.Finite.subset (s := Metric.closedBall 1 (R_2 data)) +- . apply finite_closed_ball +- . apply Metric.maximalSeparatedSet_subset +- . ++ · apply finite_closed_ball ++ · apply Metric.maximalSeparatedSet_subset ++ · + simp at x_not_mem + simp only [B, Set.mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, +- not_lt, X_j] at x_not_mem ++ X_j] at x_not_mem + + by_contra! + specialize x_not_mem x this + simp [R_1] at x_not_mem +- . ++ · + apply Set.union_subset +- . simp [X_j] ++ · simp [X_j] + grw [Metric.maximalSeparatedSet_subset] +- . ++ · + simp at x_mem + simpa using x_mem +- . ++ · + simp + apply Metric.IsSeparated.insert +- . simp [X_j] ++ · simp [X_j] + apply Metric.isSeparated_maximalSeparatedSet +- . intro y hy hxy ++ · intro y hy hxy + simp [B] at x_not_mem + specialize x_not_mem y hy + simp [edist, PseudoMetricSpace.edist] + simp [dist] at x_not_mem + exact x_not_mem +- . ++ · + rw [← lt_top_iff_ne_top] + grw [Metric.packingNumber_le_encard_self] + simp +@@ -152,7 +143,7 @@ lemma B_half_disjoint (data: GoodScalesData b): (B_half data).PairwiseDisjoint i + obtain ⟨y, y_mem, hy⟩ := hY + + by_cases x_eq_y : x = y +- . ++ · + rw [x_eq_y] at hx + rw [← hx, ← hy] + +@@ -171,7 +162,6 @@ lemma B_half_disjoint (data: GoodScalesData b): (B_half data).PairwiseDisjoint i + rw [dist_comm x a] at x_y_dist_bad + grw [a_dist_x, a_dist_y] at x_y_dist_bad + simp at x_y_dist_bad +- -- TODO - we need a lemma that edist = ↑dist + simp [edist, PseudoMetricSpace.edist] at x_sep + simp [dist] at x_y_dist_bad + grind +@@ -201,6 +191,7 @@ lemma ball_subset_smul_origin (a: G) (r: ℝ): Metric.closedBall a r ⊆ (MulOpp + simp at hx + simpa using hx + ++omit v_wrapper_inst in + lemma ball_smul_eq_origin (a: G) (r: ℝ): Metric.closedBall a r = (MulOpposite.op a) • Metric.closedBall 1 r := by + ext x + have foo := smul_origin_ball_subset a r +@@ -222,8 +213,6 @@ lemma B_half_finite (data: GoodScalesData b): (B_half data).Finite := by + apply finite_closed_ball + + @[expose] noncomputable def B_finsets (data: GoodScalesData b): Finset (Finset G) := Finset.image ((fun a => (finite_closed_ball a (R_1 data )).toFinset)) (X_j_finite data).toFinset +- +--- TODO - combine this with 'B_half' + @[expose] + noncomputable def B_half_finsets (data: GoodScalesData b): Finset (Finset G) := Finset.image ((fun a => (finite_closed_ball a (R_1 data / 2)).toFinset)) (X_j_finite data).toFinset + +@@ -240,10 +229,10 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( + apply Nat.mul_le_of_le_div + unfold InterMult + by_cases h_s: InterMult_f (B_3 data) = ∅ +- . simp [h_s] +- . ++ · simp [h_s] ++ · + rw [csSup_le_iff] +- . ++ · + intro n hn + simp [InterMult_f] at hn + obtain ⟨X, ⟨X_subset, X_inter⟩, X_card⟩ := hn +@@ -252,7 +241,7 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( + rw [Set.Finite.encard_eq_coe_toFinset_card X_finite] + simp + rw [Nat.le_div_iff_mul_le] +- . ++ · + have X_inner_nonempty: ∀ t ∈ X, ∃ a, a ∈ (X_j data) ∧ Metric.closedBall a (3 * (R_1 data + 1)) = t := by + intro t ht + specialize X_subset ht +@@ -264,11 +253,11 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( + rw [← Finset.sum_const] + + grw [Finset.sum_le_sum (g := fun a => if ha: a ∈ X then #(finite_closed_ball (X_inner_nonempty a ha).choose ((R_1 data) / 2)).toFinset else 0)] +- . ++ · + rw [← closed_ball_eq_S_pow] + rw [Finset.sum_dite] + rw [← Finset.card_biUnion] +- . ++ · + rw [← ne_eq, ← Set.nonempty_iff_ne_empty] at X_inter + obtain ⟨base, h_base⟩ := X_inter + +@@ -287,7 +276,7 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( + simp at ha + simp + obtain ⟨c, hc, a_dist⟩ := ha +- . ++ · + let q := (X_inner_nonempty c hc).choose + grw [dist_triangle _ q] + conv at a_dist => +@@ -307,7 +296,7 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( + simp [q] + grw [h_base] + grind +- . ++ · + rw [Finset.pairwiseDisjoint_iff] + intro a _ b _ hab + rw [Subtype.ext_iff] +@@ -328,23 +317,23 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( + simp only [Set.mem_image, id_eq, forall_exists_index, and_imp] at from_b + simp at hab + have inter_eq := from_b a_center a_center_mem (i := (Metric.closedBall a_center (↑(R_1 data) / 2) )) (?_) b_center b_center_mem (j := (Metric.closedBall b_center (↑(R_1 data) / 2) )) (?_) ?_ +- . ++ · + + rw [← a_eq, ← b_eq] + simp [a_center, b_center] at inter_eq + apply B_ball_injective_on data (R_1 data / 2) (by grind) (by simp [R_1]) at inter_eq +- . ++ · + simp [inter_eq] +- . grind +- . grind +- . rfl +- . rfl +- . simp [a_center, b_center] ++ · grind ++ · grind ++ · rfl ++ · rfl ++ · simp [a_center, b_center] + rw [← Finset.coe_nonempty] at hab + simp at hab + exact hab + +- . intro y hy ++ · intro y hy + simp at hy + simp only [hy, ↓reduceDIte] + nth_rw 1 [← Finset.card_smul_finset (MulOpposite.op (X_inner_nonempty y hy).choose)] +@@ -365,10 +354,10 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( + grw [Nat.cast_div_le] + simp + +- . simp ++ · simp + apply Finset.Nonempty.pow + simp [S_nonempty] +- . ++ · + unfold BddAbove + use (B_3 data).encard.toNat + rw [mem_upperBounds] +@@ -377,12 +366,12 @@ lemma inter_mult_helper (data: GoodScalesData b): InterMult (B_3 data) * #(S ^ ( + obtain ⟨a, b, x_eq⟩ := hx + rw [← x_eq] + apply ENat.toNat_le_toNat +- . ++ · + apply Set.encard_le_encard + grind +- . simp ++ · simp + apply B_3_finite +- . rw [Set.nonempty_iff_ne_empty] ++ · rw [Set.nonempty_iff_ne_empty] + grind + + @[expose] noncomputable def B_r (r: ℝ) := (finite_closed_ball 1 r).toFinset +@@ -401,9 +390,9 @@ lemma pack_center_helper (data: GoodScalesData b) (x: G): #{ c ∈ (X_j_finite d + + rw [← closed_ball_eq_S_pow] + grw [Finset.sum_le_sum (g := fun a => #(B_c_r a ↑((R_1 data : ℝ) / 2)))] +- . ++ · + rw [← Finset.card_biUnion] +- . ++ · + nth_rw 2 [← Finset.card_smul_finset (MulOpposite.op x)] + apply Finset.card_le_card + rw [← Finset.coe_subset] +@@ -424,9 +413,9 @@ lemma pack_center_helper (data: GoodScalesData b) (x: G): #{ c ∈ (X_j_finite d + rw [dist_comm] at x_mem + grw [x_mem] + rw [mul_add] +- ring ++ ring_nf + grind +- . ++ · + rw [Finset.pairwiseDisjoint_iff] + intro a ha b hb hab + +@@ -437,27 +426,28 @@ lemma pack_center_helper (data: GoodScalesData b) (x: G): #{ c ∈ (X_j_finite d + rw [Set.pairwiseDisjoint_iff] at from_b + simp only [Set.mem_image, id_eq, forall_exists_index, and_imp] at from_b + have inter_eq := from_b a ha.1 (i := (Metric.closedBall a ((↑(R_1 data) : ℝ) / 2) )) (?_) b hb.1 (j := (Metric.closedBall b (↑(R_1 data : ℝ) / 2) )) (?_) ?_ +- . ++ · + apply B_ball_injective_on data (R_1 data / 2) (by grind) (by simp [R_1]) at inter_eq +- . ++ · + simp [inter_eq] +- . grind +- . grind +- . rfl +- . rfl +- . ++ · grind ++ · grind ++ · rfl ++ · rfl ++ · + rw [← Finset.coe_nonempty] at hab + simp [B_c_r] at hab + simpa using hab +- . ++ · + intro a ha + simp at ha + simp [B_c_r_eq_smul, B_r] + rw [Nat.cast_div] +- . simp +- . simp [R_1] +- . simp ++ · simp ++ · simp [R_1] ++ · simp + ++omit [Nonempty ι] in + /-- Common step for Lemma 3.25 (a) and (b). + + `h i = log (#(S ^ 16 ^ i) * det (Q_{16 ^ i}) ^ (dim V)⁻¹)` splits into a log-cardinality term +@@ -483,8 +473,8 @@ lemma log_card_pow_sub_le {j k m n : ℕ} (hj : i₀ ≤ j) (hjk : j ≤ k) (hm0 + -- `h k - h j` is non-negative and may be discarded. + have det_le : (Q_R_matrix b ((16 ^ j : ℕ) : ℝ)).det ≤ (Q_R_matrix b ((16 ^ k : ℕ) : ℝ)).det := by + apply matrix_det_montone +- . exact pd_j +- . unfold Q_R_matrix ++ · exact pd_j ++ · unfold Q_R_matrix + rw [← map_sub] + rw [← LinearMap.isPosSemidef_iff_posSemidef_toMatrix] + apply Q_R_lin_sub_pos_semi_def +@@ -501,150 +491,147 @@ lemma log_card_pow_sub_le {j k m n : ℕ} (hj : i₀ ≤ j) (hjk : j ≤ k) (hm0 + Real.log ((#(S ^ m) : ℝ)) - Real.log ((#(S ^ n) : ℝ)) ≤ + Real.log ((#(S ^ 16 ^ k) : ℝ)) - Real.log ((#(S ^ 16 ^ j) : ℝ)) := by + apply sub_le_sub +- . apply Real.log_le_log (card_pos m) ++ · apply Real.log_le_log (card_pos m) + norm_cast + exact Finset.card_pow_mono hm0 hm +- . apply Real.log_le_log (card_pos (16 ^ j)) ++ · apply Real.log_le_log (card_pos (16 ^ j)) + norm_cast + exact Finset.card_pow_mono (by positivity) hn + simp only [h, f] + rw [Real.log_mul, Real.log_mul] +- . linarith +- . exact ne_of_gt (card_pos (16 ^ j)) +- . exact ne_of_gt (Real.rpow_pos_of_pos pd_j.det_pos _) +- . exact ne_of_gt (card_pos (16 ^ k)) +- . exact ne_of_gt (Real.rpow_pos_of_pos ++ · linarith ++ · exact ne_of_gt (card_pos (16 ^ j)) ++ · exact ne_of_gt (Real.rpow_pos_of_pos pd_j.det_pos _) ++ · exact ne_of_gt (card_pos (16 ^ k)) ++ · exact ne_of_gt (Real.rpow_pos_of_pos + (Q_R_matrix_pos_def_i₀ b _ i₀_le_k).det_pos _) + + -- Lemma 3.25 (a) + + lemma log_inter_mult_b3 (data: GoodScalesData b): InterMult (B_3 data) ≤ Real.exp (a data.d) := by + by_cases mult_zero: InterMult (B_3 data) = 0 +- . simp [mult_zero] ++ · simp [mult_zero] + positivity + + rw [← Real.log_le_iff_le_exp] + have foo := inter_mult_helper data + rw [← Nat.le_div_iff_mul_le] at foo + grw [foo] +- . ++ · + grw [Nat.cast_div_le] +- . ++ · + rw [Real.log_div] +- . ++ · + have bound := (GoodScales data).first_h_i + grw [← bound] + + apply log_card_pow_sub_le (GoodScales data).i_1_ge (Nat.le_succ _) +- . simp [R_1] +- . rw [pow_succ] ++ · simp [R_1] ++ · rw [pow_succ] + simp [R_1] +- ring ++ ring_nf + rw [← le_tsub_iff_right] +- . ++ · + rw [← Nat.mul_sub] + norm_num + grw [← Nat.one_le_pow] +- . simp +- . simp +- . simp +- . simp [R_1] +- . norm_cast ++ · simp ++ · simp ++ · simp ++ · simp [R_1] ++ · norm_cast + rw [Finset.card_eq_zero] + rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] + apply Finset.Nonempty.pow + simp [S_nonempty] +- . norm_cast ++ · norm_cast + rw [Finset.card_eq_zero] + rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] + apply Finset.Nonempty.pow + simp [S_nonempty] +- . simp ++ · simp + refine ⟨?_, ?_⟩ +- . apply Finset.Nonempty.pow ++ · apply Finset.Nonempty.pow + simp [S_nonempty] +- . ++ · + apply Finset.card_pow_mono +- . simp [R_1] +- . grind +- . ++ · simp [R_1] ++ · grind ++ · + simp + apply Finset.Nonempty.pow + simp [S_nonempty] +- . simp ++ · simp + grind + + lemma log_pack_center_helper (data: GoodScalesData b) (x: G): #{ c ∈ (X_j_finite data).toFinset | x ∈ B_c_r c (3 * (R_1 data + 1)) } ≤ Real.exp (a data.d) := by + by_cases inter_empty: { c ∈ (X_j_finite data).toFinset | x ∈ B_c_r c (3 * (R_1 data + 1)) } = ∅ +- . simp [inter_empty] ++ · simp [inter_empty] + apply Real.exp_nonneg + + rw [← Real.log_le_iff_le_exp] + have foo := pack_center_helper data x + rw [← Nat.le_div_iff_mul_le] at foo + grw [foo] +- . ++ · + grw [Nat.cast_div_le] +- . ++ · + rw [Real.log_div] +- . ++ · + have bound := (GoodScales data).first_h_i + grw [← bound] + + apply log_card_pow_sub_le (GoodScales data).i_1_ge (Nat.le_succ _) +- . simp [R_1] +- . rw [pow_succ] ++ · simp [R_1] ++ · rw [pow_succ] + simp [R_1] +- ring ++ ring_nf + rw [← le_tsub_iff_right] +- . ++ · + rw [← Nat.mul_sub] + norm_num + grw [← Nat.one_le_pow] +- . simp +- . simp +- . simp +- . simp [R_1] +- . norm_cast ++ · simp ++ · simp ++ · simp ++ · simp [R_1] ++ · norm_cast + rw [Finset.card_eq_zero] + rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] + apply Finset.Nonempty.pow + simp [S_nonempty] +- . norm_cast ++ · norm_cast + rw [Finset.card_eq_zero] + rw [← ne_eq, ← Finset.nonempty_iff_ne_empty] + apply Finset.Nonempty.pow + simp [S_nonempty] +- . simp ++ · simp + refine ⟨?_, ?_⟩ +- . apply Finset.Nonempty.pow ++ · apply Finset.Nonempty.pow + simp [S_nonempty] +- . ++ · + apply Finset.card_pow_mono +- . simp [R_1] +- . grind +- . ++ · simp [R_1] ++ · grind ++ · + simp + rw [Finset.nonempty_iff_ne_empty] + simpa using inter_empty +- . simp ++ · simp + apply Finset.Nonempty.pow + simp [S_nonempty] +- . simp ++ · simp + rw [Finset.nonempty_iff_ne_empty] + simpa using inter_empty + +-#print axioms inter_mult_helper +-#print axioms log_inter_mult_b3 +-#print axioms log_pack_center_helper + + -- Lemma 3.25 (b) + lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Real.exp (data.w * (a data.d)) := by + have B_union := Finset.card_biUnion (s := (B_half_finsets data)) (t := id) ?_ +- . ++ · + simp at B_union + have sum_le := Finset.sum_eq_card_nsmul (f := fun (u: Finset G) => #u) (s := B_half_finsets data) (b := #(S ^ (R_1 data / 2))) ?_ +- . ++ · + rw [← Nat.card_eq_card_finite_toFinset] + simp [B] + grw [Set.ncard_image_le (hs := by apply X_j_finite)] +@@ -676,33 +663,33 @@ lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Rea + grw [sum_le] + rw [← B_union] + grw [Finset.card_le_card (t := (finite_closed_ball (1: G) ↑(2 * (R_2 data))).toFinset)] +- . ++ · + grw [Nat.cast_div_le] + rw [card_closed_ball_eq] +- . ++ · + rw [← Real.log_lt_iff_lt_exp] +- . ++ · + apply lt_of_le_of_lt ?_ ((GoodScales data).h_diff_lt_w) + rw [Real.log_div (by simp; grind [S_nonempty]) (by simp; grind [S_nonempty])] + apply log_card_pow_sub_le (GoodScales data).i_1_ge +- . -- `i_2 - i_1 > w ≥ 0` forces `i_1 < i_2` ++ · -- `i_2 - i_1 > w ≥ 0` forces `i_1 < i_2` + have hdiff := (GoodScales data).i_diff_mem + simp [Set.mem_Ioo] at hdiff + omega +- . simp [R_2] +- . rw [pow_succ] ++ · simp [R_2] ++ · rw [pow_succ] + simp [R_2] + omega +- . simp [R_1] +- . ++ · simp [R_1] ++ · + apply div_pos +- . simp ++ · simp + apply Finset.Nonempty.pow + simp [S_nonempty] +- . simp ++ · simp + apply Finset.Nonempty.pow + simp [S_nonempty] +- . ++ · + intro a ha + simp at ha + obtain ⟨x, x_mem, hx⟩ := ha +@@ -723,10 +710,10 @@ lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Rea + simp at foo + grind + grw [i_1_le] +- . ++ · + grind +- . simp +- . ++ · simp ++ · + intro b hb + simp [B_half_finsets] at hb + obtain ⟨c, c_mem, b_eq⟩ := hb +@@ -734,8 +721,6 @@ lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Rea + rw [← Set.toFinite_toFinset] + rw [← Nat.card_eq_card_finite_toFinset] + rw [ball_smul_eq_origin] +- +- -- TODO - make the various finite/fintype/card conversion less awful + conv => + lhs + equals (MulOpposite.op c • (Metric.closedBall (1: G) (↑(R_1 data) / 2))).ncard => +@@ -750,8 +735,7 @@ lemma card_B_le_exp_wa (data: GoodScalesData b): #(B_finite data).toFinset < Rea + simp [R_1] + rw [card_closed_ball_eq] + +- . +- -- TODO - there must be a less horrendous way of dealing with Finset here ++ · + simp [B_half_finsets] + have foo := B_half_disjoint data + simp [B_half] at foo +diff --git a/Gromov/Poincare.lean b/Gromov/Poincare.lean +index 81268ad..1b399d6 100644 +--- a/Gromov/Poincare.lean ++++ b/Gromov/Poincare.lean +@@ -11,11 +11,6 @@ public import Gromov.Packing + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -55,7 +50,7 @@ lemma deriv_sq_R_inv_comp (f: G → ℝ) (x: G): + apply Finset.sum_nbij' (i := fun s => s⁻¹) (j := fun s => s⁻¹) <;> + simp +contextual [hGS.has_inv, mul_inv_rev] + +-omit v_wrapper_inst in ++omit hGS v_wrapper_inst in + lemma three_term_cs (a b: ℝ) (n: Type*) {s: Finset n} (f: n → ℝ): a + (∑ x ∈ s, f x) + b ≤ √(a^2 + (∑ x ∈ s, (f x)^2) + b^2) * √(2 + #(s)) := by + conv => + lhs +@@ -77,7 +72,7 @@ lemma ball_x_one_subset (x: G): (Metric.closedBall x 1) ⊆ ((x) • S) ∪ ((Mu + obtain ⟨l, l_prod, l_len⟩ := word_norm_prod_self (x * a⁻¹) + simp [ProdS] at l_prod + by_cases l_len_eq: l.length = 0 +- . ++ · + have l_eq: l = [] := by grind + simp [l_eq] at l_prod + rw [eq_comm, mul_inv_eq_one] at l_prod +@@ -85,7 +80,7 @@ lemma ball_x_one_subset (x: G): (Metric.closedBall x 1) ⊆ ((x) • S) ∪ ((Mu + use 1 + simp [one_mem] + grind +- . ++ · + rw [← l_len] at ha + have l_len_one: l.length = 1 := by grind + rw [List.length_eq_one_iff] at l_len_one +@@ -98,21 +93,22 @@ lemma ball_x_one_subset (x: G): (Metric.closedBall x 1) ⊆ ((x) • S) ∪ ((Mu + + rw [l_prod] + refine ⟨?_, ?_⟩ +- . ++ · + rw [← Finset.mem_inv'] + rw [← S_eq_Sinv] + simp +- . +- simp [l_prod] +-omit v_wrapper_inst in ++ · ++ simp ++omit hGS v_wrapper_inst in + lemma le_of_sub_eq (a b c: ℝ) (ha: a = b - c) (hc: 0 ≤ c): a ≤ b := by + grind + ++omit v_wrapper_inst in + lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g): ∑ x ∈ B_r (↑(R - 1)), ∑ y ∈ (Metric.closedBall x 1), f y ≤ 2 * #S * ∑ x ∈ B_r R, f x := by + classical + + grw [Finset.sum_le_sum (g := fun x => ∑ y ∈ ((x) • S) ∪ ((MulOpposite.op x • S)), f y)] +- . ++ · + have union_sub (x: G) := Finset.sum_union_inter (f := f) (s₁ := x • S) (s₂ := (MulOpposite.op x • S)) + simp_rw [← eq_sub_iff_add_eq] at union_sub + have foo (x) := le_of_sub_eq _ _ _ (union_sub x) (by +@@ -131,12 +127,12 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) + + have card_le (i: G) : #({a ∈ B_r ↑(R - 1) ×ˢ S | a.1 • a.2 = i}) ≤ #S := by + apply Finset.card_le_card_of_injOn (f := fun p => p.1⁻¹ * i) +- . intro a ha ++ · intro a ha + simp at ha + simp + simp [← ha.2] + grind +- . intro a ha b hb hab ++ · intro a ha b hb hab + simp at hab + simp at ha + simp at hb +@@ -149,12 +145,12 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) + + have card_le_rev (i: G) : #({a ∈ B_r ↑(R - 1) ×ˢ S | a.2 * a.1 = i}) ≤ #S := by + apply Finset.card_le_card_of_injOn (f := fun p => i * p.1⁻¹) +- . intro a ha ++ · intro a ha + simp at ha + simp + simp [← ha.2] + grind +- . intro a ha b hb hab ++ · intro a ha b hb hab + simp at hab + simp at ha + simp at hb +@@ -170,31 +166,30 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) + rw [← Finset.sum_product'] + simp_rw [Finset.sum_comp] + grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r R)] +- . ++ · + grw [Finset.sum_le_sum (g := fun i => #S • f i)] +- . ++ · + simp + rw [← Finset.mul_sum] + rw [add_comm] + grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r R)] +- . ++ · + grw [Finset.sum_le_sum (g := fun i => #S • f i)] +- . ++ · + simp + rw [← Finset.mul_sum] + rw [← mul_add] + grind +- . ++ · + intro i hi + simp +- -- TODO - why doesn't grw work here + apply mul_le_mul +- . simp ++ · simp + apply card_le_rev +- . simp +- . apply hf +- . simp +- . ++ · simp ++ · apply hf ++ · simp ++ · + rw [Finset.image_subset_iff] + intro x hx + simp at hx +@@ -204,17 +199,17 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) + grw [hx.1] + have norm_s := word_norm_le x.2 [⟨x.2, hx.2⟩] (by simp [ProdS]) + grw [norm_s] +- simp [hR] ++ simp + grind +- . intros ++ · intros + apply mul_nonneg +- . simp +- . apply hf +- . intro i hi ++ · simp ++ · apply hf ++ · intro i hi + grw [card_le] + apply hf + +- . rw [Finset.image_subset_iff] ++ · rw [Finset.image_subset_iff] + intro x hx + simp at hx + simp [B_r, dist, WordDist_one] +@@ -224,79 +219,168 @@ lemma double_ball_sum (R: ℕ) (hR: 0 < R) (f: G → ℝ) (hf: ∀ g, 0 ≤ f g) + have norm_s := word_norm_le x.2 [⟨x.2, hx.2⟩] (by simp [ProdS]) + grw [norm_s] + simp [hR] +- . intros ++ · intros + simp + apply mul_nonneg +- . simp +- . apply hf +- . intro i hi ++ · simp ++ · apply hf ++ · intro i hi + grw [Finset.sum_le_sum_of_subset_of_nonneg] +- . ++ · + simp + apply ball_x_one_subset +- . intros ++ · intros + apply hf + +--- TODO - get rid of some lemmas, since mathlib already has Metric.smul_closedBall defined +- +--- Theorem 3.20 +-set_option maxHeartbeats 3500000 in +-lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - (f_avg (R - 1) f)|^2 ≤ +- 16 * R^2 * #S * (#(B_r (2 * R - 2))) / #(B_r (R - 1)) * ∑ x ∈ (B_r (3 * R)), deriv_sq_R f x := by ++omit v_wrapper_inst in ++private lemma poincare_average_bound (R : ℕ) (f : G → ℝ) (R_nonpos : R ≠ 0) (x : G) : |f x - f_avg (R - 1) f| ≤ √((#((B_r (R - 1))) : ℝ)⁻¹ * (∑ y ∈ (B_r (R - 1)), (f x - f y)^2)) := by ++ rw [f_avg] ++ conv => ++ lhs ++ arg 1 ++ arg 1 ++ equals (#((B_r (↑R - 1))) : ℝ)⁻¹ * ∑ y ∈ (B_r (↑R - 1)), f x => ++ simp ++ rw [inv_mul_cancel_left₀] ++ simp [B_r] ++ exact Set.ncard_ne_zero_of_mem (a := 1) (by simp; grind) (finite_closed_ball 1 _) + +- by_cases R_nonpos: R = 0 +- . +- simp [R_nonpos, f_avg, B_r] ++ rw [B_r] ++ rw [← mul_sub] ++ rw [abs_mul] ++ rw [← Finset.sum_sub_distrib] ++ grw [Finset.abs_sum_le_sum_abs] ++ conv => ++ lhs ++ rhs ++ arg 2 ++ intro i ++ equals |f x - f i| * 1 => simp ++ grw [Real.sum_mul_le_sqrt_mul_sqrt] ++ simp [Real.sqrt_eq_rpow] ++ rw [← Real.rpow_neg_one] ++ rw [mul_comm] ++ rw [mul_assoc] ++ rw [← Real.rpow_add] ++ · ++ norm_num ++ simp ++ rw [Real.mul_rpow] ++ · ++ field_simp ++ rw [← Real.rpow_mul] ++ · ++ simp ++ · positivity ++ · positivity ++ · positivity + +- let δ_f (x: G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x ++ · simp ++ rw [Set.ncard_pos (finite_closed_ball 1 _)] ++ exact ⟨1, by simp; grind⟩ + +- have f_sub_le (x: G): |f x - f_avg (R - 1) f| ≤ √((#((B_r (R - 1))) : ℝ)⁻¹ * (∑ y ∈ (B_r (R - 1)), (f x - f y)^2)) := by +- rw [f_avg] ++omit v_wrapper_inst in ++private lemma poincare_path_sum (R : ℕ) (f : G → ℝ) (R_nonpos : R ≠ 0) : ++ let δ_f (x : G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x ++ let γ (z : G) (i : ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod ++ ∀ (z: G) (_hz: z ∈ B_r (2*R - 2)), ∑ x ∈ B_r (R - 1), ∑ i ∈ Finset.range (WordNorm z), δ_f (x * (γ z i)) ≤ 2 * R * ∑ x ∈ B_r (3*R - 1), δ_f x := by ++ dsimp only ++ let δ_f (x : G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x ++ let γ (z : G) (i : ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod ++ have gamma_zero (z: G): γ z 0 = 1 := by simp [γ] ++ have gamma_norm (z: G): γ z (WordNorm z) = z := by ++ simp [γ] ++ obtain ⟨prod, len_eq⟩ := (word_norm_prod_self z).choose_spec ++ simp [ProdS] at prod + conv => +- lhs +- arg 1 + arg 1 +- equals (#((B_r (↑R - 1))) : ℝ)⁻¹ * ∑ y ∈ (B_r (↑R - 1)), f x => +- simp +- rw [inv_mul_cancel_left₀] +- simp [B_r] +- exact Set.ncard_ne_zero_of_mem (a := 1) (by simp; grind) (finite_closed_ball 1 _) ++ pattern (WordNorm z) ++ rw [← len_eq] + +- rw [B_r] +- rw [← mul_sub] +- rw [abs_mul] +- rw [← Finset.sum_sub_distrib] +- grw [Finset.abs_sum_le_sum_abs] +- conv => +- lhs +- rhs +- arg 2 +- intro i +- equals |f x - f i| * 1 => simp +- grw [Real.sum_mul_le_sqrt_mul_sqrt] +- simp [Real.sqrt_eq_rpow] +- rw [← Real.rpow_neg_one] +- rw [mul_comm] +- rw [mul_assoc] +- rw [← Real.rpow_add] +- . +- norm_num ++ simp ++ exact prod ++ ++ have gamma_i_norm_le (z: G) (i: ℕ): WordNorm (γ z i) ≤ i := by ++ simp [γ] ++ ++ have i_le := word_norm_le ((word_norm_prod_self z).choose.take i).unattach.prod ((word_norm_prod_self z).choose.take i) (by simp [ProdS]) ++ grw [List.length_take_le] at i_le ++ exact i_le ++ ++ intro z hz ++ change ∑ x ∈ B_r (R - 1), ∑ i ∈ Finset.range (WordNorm z), δ_f (x * (γ z i)) ≤ 2 * R * ∑ x ∈ B_r (3*R - 1), δ_f x ++ ++ rw [← Finset.sum_product'] ++ rw [Finset.sum_comp] ++ simp ++ grw [Finset.sum_le_sum (g := fun a => (((2 * R) : ℝ) * (δ_f a)))] ++ · ++ rw [← Finset.mul_sum] ++ grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r (3*R - 1))] ++ · ++ intro p hp ++ simp at hp ++ obtain ⟨a, b, ⟨a_mem, b_lt⟩, p_eq⟩ := hp ++ rw [← p_eq] ++ simp [B_r, dist, WordDist_one] ++ grw [word_norm_mul_le] ++ simp [B_r, dist, WordDist_one] at a_mem ++ simp [B_r, dist, WordDist_one] at hz + simp +- rw [Real.mul_rpow] +- . +- field_simp +- rw [← Real.rpow_mul] +- . +- simp +- . positivity +- . positivity +- . positivity ++ grw [a_mem] ++ grw [gamma_i_norm_le] ++ grw [b_lt] ++ grw [hz] ++ grind ++ · intro p hp _ ++ simp [δ_f, deriv_sq_R] ++ positivity ++ · ++ intro b hb ++ simp at hb ++ obtain ⟨x, n, ⟨x_mem, n_lt⟩, b_eq⟩ := hb ++ grw [Finset.card_le_card (t := (Finset.range (2 * R)).image (fun n => (b * ((γ z n)⁻¹), n)))] ++ · ++ grw [Finset.card_image_le] ++ · simp ++ · simp [δ_f, deriv_sq_R] ++ positivity ++ · ++ simp [δ_f, deriv_sq_R] ++ positivity ++ · ++ intro p hp ++ simp at hp ++ simp ++ use p.2 ++ refine ⟨?_, ?_⟩ ++ · + +- . simp +- rw [Set.ncard_pos (finite_closed_ball 1 _)] +- exact ⟨1, by simp; grind⟩ ++ by_contra! ++ grw [hp.1.2] at this ++ simp [B_r, dist, WordDist_one] at hz ++ conv at hz => ++ rhs ++ equals ↑(2*R - 2) => ++ rw [Nat.cast_sub] ++ simp ++ grind + +- let γ (z: G) (i: ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod ++ norm_cast at hz ++ grind ++ · ++ ext ++ · simp [← hp.2] ++ · simp ++ ++omit v_wrapper_inst in ++private lemma poincare_difference_bound (R : ℕ) (f : G → ℝ) (R_nonpos : R ≠ 0) : ++ let δ_f (x : G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x ++ let γ (z : G) (i : ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod ++ ∀ (x y: G) (_hx: x ∈ B_r (R - 1)) (_hy: y ∈ B_r (R - 1)), |f y - f x| ≤ √((2 * R) * (∑ i ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * γ (x⁻¹ * y) i))) := by ++ dsimp only ++ let δ_f (x : G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x ++ let γ (z : G) (i : ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod + have gamma_zero (z: G): γ z 0 = 1 := by simp [γ] + have gamma_norm (z: G): γ z (WordNorm z) = z := by + simp [γ] +@@ -317,163 +401,118 @@ lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x + grw [List.length_take_le] at i_le + exact i_le + +- have gamma_sum (z: G) (hz: z ∈ B_r (2*R - 2)): ∑ x ∈ B_r (R - 1), ∑ i ∈ Finset.range (WordNorm z), δ_f (x * (γ z i)) ≤ 2 * R * ∑ x ∈ B_r (3*R - 1), δ_f x := by ++ intro x y hx hy ++ change |f y - f x| ≤ √((2 * R) * (∑ i ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * γ (x⁻¹ * y) i))) + +- rw [← Finset.sum_product'] +- rw [Finset.sum_comp] +- simp +- grw [Finset.sum_le_sum (g := fun a => (((2 * R) : ℝ) * (δ_f a)))] +- . +- rw [← Finset.mul_sum] +- grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r (3*R - 1))] +- . +- intro p hp +- simp at hp +- obtain ⟨a, b, ⟨a_mem, b_lt⟩, p_eq⟩ := hp +- rw [← p_eq] +- simp [B_r, dist, WordDist_one] +- grw [word_norm_mul_le] +- simp [B_r, dist, WordDist_one] at a_mem +- simp [B_r, dist, WordDist_one] at hz ++ have inv_prod_le: WordNorm (x⁻¹ * y) ≤ 2*R - 2 := by ++ grw [word_norm_mul_le] ++ rw [← word_norm_inv] ++ simp [B_r, dist, WordDist_one] at hx hy ++ conv at hx => ++ rhs ++ equals ↑(R - 1) => ++ rw [Nat.cast_sub] + simp +- grw [a_mem] +- grw [gamma_i_norm_le] +- grw [b_lt] +- grw [hz] + grind +- . intro p hp _ +- simp [δ_f, deriv_sq_R] +- positivity +- . +- intro b hb +- simp at hb +- obtain ⟨x, n, ⟨x_mem, n_lt⟩, b_eq⟩ := hb +- grw [Finset.card_le_card (t := (Finset.range (2 * R)).image (fun n => (b * ((γ z n)⁻¹), n)))] +- . +- grw [Finset.card_image_le] +- . simp +- . simp [δ_f, deriv_sq_R] +- positivity +- . +- simp [δ_f, deriv_sq_R] +- positivity +- . +- intro p hp +- simp at hp ++ conv at hy => ++ rhs ++ equals ↑(R - 1) => ++ rw [Nat.cast_sub] + simp +- use p.2 +- refine ⟨?_, ?_⟩ +- . +- +- by_contra! +- grw [hp.1.2] at this +- simp [B_r, dist, WordDist_one] at hz +- conv at hz => +- rhs +- equals ↑(2*R - 2) => +- rw [Nat.cast_sub] +- simp +- grind ++ grind ++ norm_cast at hx hy ++ grw [hx, hy] ++ grind + +- norm_cast at hz +- grind +- . +- ext +- . simp [← hp.2] +- . simp ++ have root_le_R: √(WordNorm (x⁻¹ * y)) ≤ √(2*R) := by ++ rw [Real.sqrt_le_sqrt_iff] ++ · norm_cast ++ grw [inv_prod_le] ++ simp ++ · simp + +- have diff_le_delta_sum (x y: G) (hx: x ∈ B_r (R - 1)) (hy: y ∈ B_r (R - 1)): |f y - f x| ≤ √((2 * R) * (∑ i ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * γ (x⁻¹ * y) i))) := by ++ conv => ++ lhs ++ equals |(f (x * γ (x⁻¹ * y) (WordNorm (x⁻¹ * y)))) - f (x * γ (x⁻¹ * y) 0)| => ++ simp [gamma_zero, gamma_norm] + +- have inv_prod_le: WordNorm (x⁻¹ * y) ≤ 2*R - 2 := by +- grw [word_norm_mul_le] +- rw [← word_norm_inv] +- simp [B_r, dist, WordDist_one] at hx hy +- conv at hx => +- rhs +- equals ↑(R - 1) => +- rw [Nat.cast_sub] +- simp +- grind +- conv at hy => +- rhs +- equals ↑(R - 1) => +- rw [Nat.cast_sub] +- simp +- grind +- norm_cast at hx hy +- grw [hx, hy] +- grind ++ rw [← Finset.sum_range_sub (n := WordNorm (x⁻¹ * y)) (f := fun i => f (x * γ (x⁻¹ * y) i))] ++ grw [Finset.abs_sum_le_sum_abs] ++ conv => ++ lhs ++ arg 2 ++ intro i ++ rw [← mul_one (a := |_|)] + +- have root_le_R: √(WordNorm (x⁻¹ * y)) ≤ √(2*R) := by +- rw [Real.sqrt_le_sqrt_iff] +- . norm_cast +- grw [inv_prod_le] +- simp +- . simp ++ grw [Real.sum_mul_le_sqrt_mul_sqrt] ++ simp ++ grw [root_le_R] ++ ++ have sum_le_delta: ∑ x_1 ∈ Finset.range (WordNorm (x⁻¹ * y)), (f (x * γ (x⁻¹ * y) x_1) - f (x * γ (x⁻¹ * y) (x_1 + 1))) ^ 2 ≤ ∑ n ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * (γ (x⁻¹ * y) n)) := by ++ apply Finset.sum_le_sum ++ intro n hn ++ simp [δ_f, deriv_sq_R] ++ rw [← Finset.add_sum_erase (a := (x * γ (x⁻¹ * y) n))] ++ · ++ apply le_add_of_le_of_nonneg ++ · ++ let s := (word_norm_prod_self (x⁻¹ * y)).choose[n]?.getD ⟨1, one_mem⟩ ++ rw [← Finset.add_sum_erase (a := s.val) (h := by simp)] ++ apply le_add_of_le_of_nonneg ++ · ++ rw [sub_sq_comm] ++ conv => ++ rhs ++ lhs ++ arg 1 ++ arg 1 ++ equals x * γ (x⁻¹ * y) (n + 1) => ++ ++ rw [mul_assoc, mul_left_cancel_iff] ++ simp [γ, s] ++ by_cases n_add_lt: (n) < (word_norm_prod_self (x⁻¹ * y)).choose.length ++ · ++ simp [n_add_lt] ++ rw [List.take_add_one] ++ simp ++ rw [getElem?_pos] ++ · simp ++ · grind ++ · ++ simp [n_add_lt] ++ rw [List.take_add_one] ++ simp ++ rw [getElem?_neg] ++ · simp ++ · grind ++ · positivity ++ · positivity ++ · simp [dist, WordDist, word_norm_one] ++ ++ simp_rw [sub_sq_comm] ++ grw [sum_le_delta] ++ rw [mul_comm] ++ simp + +- conv => +- lhs +- equals |(f (x * γ (x⁻¹ * y) (WordNorm (x⁻¹ * y)))) - f (x * γ (x⁻¹ * y) 0)| => +- simp [gamma_zero, gamma_norm] ++-- Theorem 3.20 ++omit v_wrapper_inst in ++lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - (f_avg (R - 1) f)|^2 ≤ ++ 16 * R^2 * #S * (#(B_r (2 * R - 2))) / #(B_r (R - 1)) * ∑ x ∈ (B_r (3 * R)), deriv_sq_R f x := by + +- rw [← Finset.sum_range_sub (n := WordNorm (x⁻¹ * y)) (f := fun i => f (x * γ (x⁻¹ * y) i))] +- grw [Finset.abs_sum_le_sum_abs] +- conv => +- lhs +- arg 2 +- intro i +- rw [← mul_one (a := |_|)] ++ by_cases R_nonpos: R = 0 ++ · ++ simp [R_nonpos, f_avg, B_r] + +- grw [Real.sum_mul_le_sqrt_mul_sqrt] +- simp +- grw [root_le_R] ++ let δ_f (x: G) := ∑ x ∈ (finite_closed_ball x 1).toFinset, deriv_sq_R f x + +- have sum_le_delta: ∑ x_1 ∈ Finset.range (WordNorm (x⁻¹ * y)), (f (x * γ (x⁻¹ * y) x_1) - f (x * γ (x⁻¹ * y) (x_1 + 1))) ^ 2 ≤ ∑ n ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * (γ (x⁻¹ * y) n)) := by +- apply Finset.sum_le_sum +- intro n hn +- simp [δ_f, deriv_sq_R] +- rw [← Finset.add_sum_erase (a := (x * γ (x⁻¹ * y) n))] +- . +- apply le_add_of_le_of_nonneg +- . +- let s := (word_norm_prod_self (x⁻¹ * y)).choose[n]?.getD ⟨1, one_mem⟩ +- rw [← Finset.add_sum_erase (a := s.val) (h := by simp)] +- apply le_add_of_le_of_nonneg +- . +- rw [sub_sq_comm] +- conv => +- rhs +- lhs +- arg 1 +- arg 1 +- equals x * γ (x⁻¹ * y) (n + 1) => +- +- rw [mul_assoc, mul_left_cancel_iff] +- simp [γ, s] +- -- TODO - we can probably use hn instead of this case split +- by_cases n_add_lt: (n) < (word_norm_prod_self (x⁻¹ * y)).choose.length +- . +- simp [n_add_lt] +- rw [List.take_add_one] +- simp +- rw [getElem?_pos] +- . simp +- . grind +- . +- simp [n_add_lt] +- rw [List.take_add_one] +- simp +- rw [getElem?_neg] +- . simp +- . grind +- . positivity +- . positivity +- . simp [dist, WordDist, word_norm_one] +- +- simp_rw [sub_sq_comm] +- grw [sum_le_delta] +- rw [mul_comm] +- simp ++ have f_sub_le := poincare_average_bound R f R_nonpos ++ ++ let γ (z: G) (i: ℕ) := ((word_norm_prod_self z).choose.take i).unattach.prod ++ have gamma_sum (z : G) (hz : z ∈ B_r (2*R - 2)) : ∑ x ∈ B_r (R - 1), ∑ i ∈ Finset.range (WordNorm z), δ_f (x * (γ z i)) ≤ 2 * R * ∑ x ∈ B_r (3*R - 1), δ_f x := ++ poincare_path_sum R f R_nonpos z hz ++ ++ have diff_le_delta_sum (x y : G) (hx : x ∈ B_r (R - 1)) (hy : y ∈ B_r (R - 1)) : |f y - f x| ≤ √((2 * R) * (∑ i ∈ Finset.range (WordNorm (x⁻¹ * y)), δ_f (x * γ (x⁻¹ * y) i))) := ++ poincare_difference_bound R f R_nonpos x y hx hy + + conv at f_sub_le => + intro x +@@ -510,9 +549,8 @@ lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x + rw [Finset.sum_product] + simp only [] + rw [Finset.sum_comm] +- -- TODO - use gcongr here + grw [Finset.sum_le_sum (g := fun z => ∑ x ∈ B_r (2*R - 2), ∑ i ∈ Finset.range (WordNorm x), δ_f (z * γ x i))] +- . ++ · + rw [Finset.sum_comm] + grw [Finset.sum_le_sum (h := gamma_sum)] + simp [δ_f] +@@ -534,37 +572,37 @@ lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x + simp + grind + grw [double_ball_sum] +- . ++ · + norm_cast + + have four_le: (4: ℝ) ≤ 8 := by + grind + grw [four_le] + simp [deriv_sq_R] +- ring ++ ring_nf + simp + simp [deriv_sq_R] + positivity +- . simp ++ · simp + grind +- . intro g ++ · intro g + simp [deriv_sq_R] + positivity + +- . intro a ha ++ · intro a ha + rw [Finset.sum_comp (g := fun y => a⁻¹ * y) (f := fun x => ∑ x_1 ∈ Finset.range (WordNorm (x)), δ_f (a * γ (x) x_1))] + grw [Finset.sum_le_sum_of_subset_of_nonneg (t := B_r (2*R - 2))] +- . ++ · + simp_rw [inv_mul_eq_iff_eq_mul] + simp_rw [Finset.card_filter] + simp + apply Finset.sum_le_sum + intro x hx + split_ifs +- . simp +- . simp [δ_f, deriv_sq_R] ++ · simp ++ · simp [δ_f, deriv_sq_R] + positivity +- . ++ · + rw [Finset.image_subset_iff] + intro x hx + simp [B_r, dist, WordDist_one] +@@ -574,22 +612,23 @@ lemma poincare_inequality (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x + simp + grw [ha, hx] + grind +- . ++ · + intros + simp [δ_f, deriv_sq_R] + positivity + +-#print axioms poincare_inequality + + -- `B_r` is centred at `1`, so it is closed under inversion (`word_norm_inv`). + omit v_wrapper_inst in + lemma mem_B_r_inv (r: ℝ) (x: G): x⁻¹ ∈ B_r r ↔ x ∈ B_r r := by + simp [B_r, dist, WordDist_one, ← word_norm_inv] + ++omit v_wrapper_inst in + lemma sum_B_r_inv (r: ℝ) (g: G → ℝ): ∑ x ∈ B_r r, g x⁻¹ = ∑ x ∈ B_r r, g x := by + apply Finset.sum_nbij' (i := fun x => x⁻¹) (j := fun x => x⁻¹) <;> + simp +contextual [mem_B_r_inv] + ++omit v_wrapper_inst in + lemma f_avg_inv (r: ℝ) (f: G → ℝ): f_avg r (fun y => f y⁻¹) = f_avg r f := by + unfold f_avg + rw [show (finite_closed_ball (1: G) r).toFinset = B_r r from rfl, sum_B_r_inv] +@@ -597,6 +636,7 @@ lemma f_avg_inv (r: ℝ) (f: G → ℝ): f_avg r (fun y => f y⁻¹) = f_avg r f + -- Theorem 3.20, restated for the *left* Cayley graph. Rather than mirroring the (long) proof of + -- `poincare_inequality`, we conjugate it by the inversion `x ↦ x⁻¹`: this is a bijection of every + -- `B_r r` (`mem_B_r_inv`) and carries `deriv_sq_R` to `deriv_sq` (`deriv_sq_R_inv_comp`). ++omit v_wrapper_inst in + lemma poincare_inequality_left (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), |f x - (f_avg (R - 1) f)|^2 ≤ + 16 * R^2 * #S * (#(B_r (2 * R - 2))) / #(B_r (R - 1)) * ∑ x ∈ (B_r (3 * R)), deriv_sq f x := by + have poincare := poincare_inequality R (fun y => f y⁻¹) +@@ -610,7 +650,6 @@ lemma poincare_inequality_left (R: ℕ) (f: G → ℝ): ∑ x ∈ (B_r (R - 1)), + exact Finset.sum_congr rfl (fun x _ => deriv_sq_R_inv_comp f x)] at poincare + exact poincare + +-#print axioms poincare_inequality_left + + omit v_wrapper_inst in + lemma card_B_r_eq (R: ℕ): #(B_r R) = #(S ^ R) := by +@@ -648,11 +687,11 @@ lemma lemma_3_25_poincare (data: GoodScalesData b) (j: (X_j data)) (f: G → ℝ + rw [B_c_r_eq_smul] + rw [← Finset.image_smul] + rw [Finset.sum_image] +- . ++ · + simp + left + simp [B_r] +- . simp ++ · simp + + simp_rw [sq_abs] + grw [poincare] +@@ -662,8 +701,8 @@ lemma lemma_3_25_poincare (data: GoodScalesData b) (j: (X_j data)) (f: G → ℝ + + + rw [← Real.log_le_iff_le_exp] +- . rw [Real.log_div] +- . ++ · rw [Real.log_div] ++ · + + + rw [card_B_r_eq] +@@ -678,42 +717,41 @@ lemma lemma_3_25_poincare (data: GoodScalesData b) (j: (X_j data)) (f: G → ℝ + simp + rw [card_B_r_eq] + grw [log_card_pow_sub_le (b := b) (k := (GoodScales data).i_1 + 1) (j := (GoodScales data).i_1)] +- . ++ · + grw [(GoodScales data).first_h_i] +- . ++ · + apply (GoodScales data).i_1_ge +- . simp +- . simp ++ · simp ++ · simp + grind +- . simp ++ · simp + have h_i_1 := (GoodScales data).i_1_ge + simp [i₀, R'] at h_i_1 + simp [R_1] +- ring ++ ring_nf + grind +- . ++ · + simp [R_1] +- . simp only [B_r, Set.toFinite_toFinset, ne_eq, Nat.cast_eq_zero] ++ · simp only [B_r, Set.toFinite_toFinset, ne_eq, Nat.cast_eq_zero] + apply Finset.card_ne_zero_of_mem (a := 1) + simp [R_1] +- . simp only [B_r, Set.toFinite_toFinset, ne_eq, Nat.cast_eq_zero] ++ · simp only [B_r, Set.toFinite_toFinset, ne_eq, Nat.cast_eq_zero] + apply Finset.card_ne_zero_of_mem (a := 1) + simp [R_1] +- . apply mul_pos +- . simp only [B_r, Set.toFinite_toFinset] ++ · apply mul_pos ++ · simp only [B_r, Set.toFinite_toFinset] + norm_cast + rw [Finset.card_pos] + use 1 + simp [R_1] +- . ++ · + simp [-Set.toFinset_card] + use 1 + simp [B_r, R_1] +- . ++ · + rw [mul_div_assoc] +- norm_num + grw [vol_frac_le] +- . ++ · + + conv => + lhs +@@ -729,7 +767,7 @@ lemma lemma_3_25_poincare (data: GoodScalesData b) (j: (X_j data)) (f: G → ℝ + simp [deriv_sq] + group + simp +- . simp [deriv_sq] ++ · simp [deriv_sq] + positivity + + -- Estimating functions relative to cover +diff --git a/Gromov/PolynomialGrowth.lean b/Gromov/PolynomialGrowth.lean +new file mode 100644 +index 0000000..43f2bfe +--- /dev/null ++++ b/Gromov/PolynomialGrowth.lean +@@ -0,0 +1,37 @@ ++module ++ ++public import Mathlib ++ ++/-! # Polynomial growth of Cayley balls ++ ++Cayley balls consist of products of at most a given number of generators or ++inverse generators. Their cardinalities define the growth function. ++-/ ++ ++public section ++namespace FormalConjecturesCheck ++variable {G : Type*} [Group G] ++ ++/-! The growth conventions follow the `formal-conjectures` library. -/ ++ ++/-- The `CayleyBall` is the ball of radius `n` in the Cayley graph of a group `G` with generating ++set `S`. -/ ++@[expose] ++def CayleyBall (S : Set G) (n : ℕ) : Set G := ++ {g : G | ∃ (l : List G), l.length ≤ n ∧ (∀ s ∈ l, s ∈ S ∨ s⁻¹ ∈ S) ∧ l.prod = g} ++ ++/-- The `GrowthFunction` of a group `G` with respect to a set `S` counts the number of group ++elements that can be reached by words of length at most `n` in `S`. -/ ++@[expose] ++noncomputable def GrowthFunction (S : Set G) (n : ℕ) : ℕ := ++ (CayleyBall S n).ncard ++ ++/-- A group has polynomial growth if there exists a finite generating set whose growth function is ++bounded above by a polynomial. -/ ++@[expose] ++def HasPolynomialGrowth (G : Type*) [Group G] : Prop := ++ ∃ (S : Set G), Set.Finite S ∧ Subgroup.closure S = ⊤ ∧ ++ ∃ (C : ℝ) (d : ℕ), C > 0 ∧ ++ ∀ n > 0, (GrowthFunction S n : ℝ) ≤ C * (n : ℝ) ^ d ++ ++end FormalConjecturesCheck +diff --git a/Gromov/QuadraticForm.lean b/Gromov/QuadraticForm.lean +index eda1274..8ebe2ff 100644 +--- a/Gromov/QuadraticForm.lean ++++ b/Gromov/QuadraticForm.lean +@@ -12,11 +12,6 @@ the determinant bound `det_bound` for a fixed finite-dimensional subspace `V`. + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -120,14 +115,14 @@ lemma Q_R_lin_hermetian {ι : Type*} [Fintype ι] [DecidableEq ι] {V: Submodule + lemma Q_R_lin_sub_pos_semi_def (V : Submodule ℝ LipschitzH) (R_1 R_2: ℝ) (hr: R_1 ≤ R_2): ((Q_R_lin V R_2) - Q_R_lin V R_1).IsPosSemidef := by + rw [LinearMap.isPosSemidef_def] + refine ⟨?_, ?_⟩ +- . ++ · + -- `Q_R_lin` lands in a nested linear-map type `V →ₗ⋆[ℝ] V →ₗ[ℝ] ℝ`; giving + -- `sub_eq_add_neg` its arguments explicitly avoids a metavariable whose `Sub` + -- instance would need a deeper `synthPending` than the default depth allows. + rw [sub_eq_add_neg (Q_R_lin V R_2) (Q_R_lin V R_1)] + apply LinearMap.IsSymm.add +- . apply Q_R_lin_symm +- . ++ · apply Q_R_lin_symm ++ · + -- TODO - add smul/neg lemmas so that we don't need to inline the proof here + exact { + eq := by +@@ -135,15 +130,15 @@ lemma Q_R_lin_sub_pos_semi_def (V : Submodule ℝ LipschitzH) (R_1 R_2: ℝ) (hr + simp [Q_R_lin, Q_R] + simp_rw [mul_comm] + } +- . ++ · + rw [LinearMap.isNonneg_def] + intro x + simp [Q_R_lin, Q_R] + apply Finset.sum_le_sum_of_subset_of_nonneg +- . ++ · + simp [Metric.closedBall] + grind +- . intro a ha a_not ++ · intro a ha a_not + rw [← pow_two] + positivity + +@@ -185,7 +180,7 @@ lemma v_r_all_nonzero (V: Submodule ℝ LipschitzH) [FiniteDimensional ℝ V]: + ext a + simp only [Submodule.mem_iInf, Submodule.zero_eq_bot, Submodule.mem_bot] + refine ⟨?_, ?_⟩ +- . ++ · + intro hi + ext g + specialize hi (WordNorm g) +@@ -193,11 +188,11 @@ lemma v_r_all_nonzero (V: Submodule ℝ LipschitzH) [FiniteDimensional ℝ V]: + specialize hi g + simp [dist, WordDist_one] at hi + simp [hi] +- . intro hi ++ · intro hi + simp [hi] + + rw [← Antitone.iInf_nat_add (k := n)] at inter_zero +- . ++ · + conv at inter_zero => + lhs + arg 1 +@@ -221,13 +216,12 @@ lemma v_r_all_nonzero (V: Submodule ℝ LipschitzH) [FiniteDimensional ℝ V]: + obtain ⟨x, h_x_1, h_x_2⟩ := inter_zero + use x + refine ⟨?_, ?_⟩ +- . right ++ · right + exact h_x_1 +- . exact h_x_2 +- . intro a b hab ++ · exact h_x_2 ++ · intro a b hab + simp [zero_ball] +- intro u hu hg +- intro g g_dist ++ intro u hu hg g g_dist + specialize hg g + grw [hab] at g_dist + specialize hg g_dist +@@ -242,23 +236,23 @@ lemma R'_pos (V: Submodule ℝ LipschitzH) [FiniteDimensional ℝ V]: 1 < R'_ V + lemma Q_R_pos_on_R' {V: Submodule ℝ LipschitzH} (v: V) (hv: v ≠ 0) [FiniteDimensional ℝ V] (R: ℝ) (hR: (R'_ V) ≤ R): 0 < Q_R R v v := by + simp [Q_R] + rw [Finset.sum_pos_iff_of_nonneg] +- . ++ · + by_contra! + simp_rw [← pow_two] at this + simp only [sq_nonpos_iff] at this + have foo := (v_r_all_nonzero V).choose_spec.2 (v) (by apply Submodule.coe_mem) ?_ +- . ++ · + obtain ⟨g, g_mem, x_g_nonzero⟩ := foo + specialize this g ?_ +- . ++ · + simp + unfold R'_ at hR + grw [hR] at g_mem + simpa using g_mem +- . ++ · + simp at x_g_nonzero + contradiction +- . ++ · + conv => + rhs + equals (0: V) => +@@ -267,7 +261,7 @@ lemma Q_R_pos_on_R' {V: Submodule ℝ LipschitzH} (v: V) (hv: v ≠ 0) [FiniteDi + rw [ne_eq, ← Subtype.ext_iff] + rw [← ne_eq] + exact hv +- . intro y hy ++ · intro y hy + rw [← pow_two] + positivity + +@@ -282,13 +276,11 @@ lemma Q_R_matrix_pos_def {ι : Type*} [Fintype ι] [DecidableEq ι] {V: Submodul + equals (star x) => simp + rw [star_dotProduct_toMatrix₂_mulVec] + apply Q_R_pos_on_R' +- . rw [LinearEquiv.map_ne_zero_iff] ++ · rw [LinearEquiv.map_ne_zero_iff] + exact hx +- . exact hR ++ · exact hR + +-#print sorries Q_R_matrix_pos_def + +--- TODO - generalize and upstream + + section V_variable + +@@ -297,21 +289,20 @@ variable {V: Submodule ℝ LipschitzH} [V_finite: FiniteDimensional ℝ V] [Nont + @[expose] + instance nonempty_basis: Nonempty ↑(Module.Basis.ofVectorSpaceIndex ℝ ↥V) := Module.Basis.index_nonempty (Module.Basis.ofVectorSpace _ _) + +--- TODO - generalize and upstream + omit hGS in + lemma euclidean_of_lp_le {ι : Type*} [Fintype ι] (x: EuclideanSpace ℝ ι) (i: ι): + |x.ofLp i| ≤ ‖x‖ := by + + rw [EuclideanSpace.norm_eq] + rw [Real.le_sqrt] +- . ++ · + simp + apply Finset.single_le_sum (a := i) +- . intro i _ ++ · intro i _ + positivity +- . simp +- . simp +- . positivity ++ · simp ++ · simp ++ · positivity + + /-- The Lipschitz constant `‖(b i).val‖` of the `i`-th vector of the basis `b` of `V`. -/ + @[expose] +@@ -382,13 +373,13 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo + + (Module.finrank ℝ ↥V) * max_origin) * (1 + R)) ^ 2 from by + simp only [max_lipschitz, max_origin, det_bound_const]; ring] + rw [(Q_R_lin_hermetian b R).det_eq_prod_eigenvalues] +- grw [Finset.prod_le_prod (g := fun _ => m)] +- . ++ grw [Finset.prod_le_prod₀ (g := fun _ => m)] ++ · + simp + rw [← Module.finrank_eq_card_basis b] + rw [← Real.rpow_natCast] + rw [← Real.rpow_mul] +- . ++ · + have finrank_pos := Module.finrank_pos (R := ℝ) (M := V) + field_simp [finrank_pos] + simp +@@ -412,18 +403,17 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo + ext a + simp + rw [foo] +- simp only [Q_R_lin, Q_R, LipschitzH_apply, map_sum, +- map_smul, LinearMap.coe_mk, AddHom.coe_mk, LinearMap.coe_sum, LinearMap.coe_smul, +- Finset.sum_apply, Pi.smul_apply, smul_eq_mul, ge_iff_le] ++ simp only [Q_R_lin, Q_R, LipschitzH_apply, LinearMap.coe_mk, AddHom.coe_mk, ++ ge_iff_le] + simp_rw [← pow_two] + grw [Finset.sum_le_card_nsmul (n := (((((Module.finrank ℝ ↥V)) * max_lipschitz + ((Module.finrank ℝ ↥V) * max_origin)) * (1 + R)) ^ 2))] +- . ++ · + rw [← card_closed_ball_eq] + simp + rw [mul_comm] + field_simp + simp +- . ++ · + intro x hx + specialize hB x + simp +@@ -431,7 +421,7 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo + rw [← Real.sqrt_sq_eq_abs] at hB + rw [Real.sqrt_le_iff] at hB + have foo := hB.2 +- . ++ · + simp [dist, WordDist_one] at hx + grw [hx] at foo + conv => +@@ -451,10 +441,10 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo + grw [foo] + rw [mul_pow, mul_pow] + rw [mul_le_mul_iff_left₀] +- . ++ · + rw [pow_le_pow_iff_left₀] +- . apply add_le_add +- . ++ · apply add_le_add ++ · + simp [max_lipschitz] + have foo := (m_vec_V).val.lipschitz.choose_spec + conv at foo => +@@ -469,53 +459,52 @@ lemma det_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (b : Mo + --grw [norm_sum_l] + grw [norm_sum_le] + grw [Finset.sum_le_card_nsmul (n := ↑max_lipschitz)] +- . ++ · + simp + rw [← Module.finrank_eq_card_basis b] +- . ++ · + intro i _ + simp [norm_smul] + grw [euclidean_of_lp_le] + simp [m_vec] + apply h_max_lipschitz +- . ++ · + simp [m_vec_V, m_vec] + rw [← LipschitzH_apply] + rw [LipschitzH.finset_sum_apply] + grw [Finset.abs_sum_le_sum_abs] + grw [Finset.sum_le_card_nsmul (n := max_origin)] +- . simp ++ · simp + rw [← Module.finrank_eq_card_basis b] +- . ++ · + intro i hi + simp + grw [euclidean_of_lp_le] + simp + apply h_max_origin +- . positivity +- . exact add_nonneg (mul_nonneg (by positivity) (max_lipschitz_nonneg b)) ++ · positivity ++ · exact add_nonneg (mul_nonneg (by positivity) (max_lipschitz_nonneg b)) + (mul_nonneg (by positivity) (max_origin_nonneg b)) +- . simp +- . positivity ++ · simp ++ · positivity + +- . unfold m ++ · unfold m + apply Matrix.PosSemidef.eigenvalues_nonneg + apply (Q_R_matrix_pos_def b R hR).posSemidef +- . ++ · + apply Finset.prod_nonneg + intro i _ + apply Matrix.PosSemidef.eigenvalues_nonneg + apply (Q_R_matrix_pos_def b R hR).posSemidef +- . ++ · + intro i _ + apply Matrix.PosSemidef.eigenvalues_nonneg + apply (Q_R_matrix_pos_def b R hR).posSemidef +- . intro i _ ++ · intro i _ + unfold m + have foo := (Finite.exists_max (Q_R_lin_hermetian b R).eigenvalues).choose_spec + apply foo i + +-#print axioms det_bound + end V_variable + + end GeneratesNS +diff --git a/Gromov/Representation.lean b/Gromov/Representation.lean +index d856c0c..f91e742 100644 +--- a/Gromov/Representation.lean ++++ b/Gromov/Representation.lean +@@ -23,12 +23,6 @@ fact that it preserves the quotient norm. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +--- TODO - vscode stops reporting underlines if there are too many total underlines / gutter messages +--- I've disabled some failing lints for now so that error underlines still sho up +-set_option linter.style.commandStart false +- + open Subgroup + open scoped Finset + open scoped Pointwise +@@ -42,8 +36,6 @@ include hGS + + open scoped RealInnerProductSpace + +--- `LipschitzH_seminorm` and `LipschitzH_normed` are public instances in +--- `Gromov.LipschitzNorm`, so they are already available here. + + -- The lift of LipschitzSemiNorm to W, using a proof that LipschitzSemiNorm doesn't depend on the choice representative + -- (adding a constant to a Lipschitz function doesn't change its Lipschitz constant) +@@ -63,13 +55,13 @@ lemma constf_eq_null: (ConstF : Set (LipschitzH)) = nullAddSubgroup (LipschitzH) + ext f + simp + refine ⟨?_, ?_⟩ +- . ++ · + intro hf + obtain ⟨z, hz⟩ := hf + rw [← hz] + simp [norm] + apply lipschitz_norm_const +- . ++ · + intro hf + simp [norm, LipschitzSemiNorm] at hf + have lipschitz_zero := lipschitz_attains_norm f (f.lipschitz) +@@ -88,14 +80,6 @@ instance const_isClosed: IsClosed (ConstF : Set (LipschitzH)) := by + exact isClosed_nullAddSubgroup + + +-#synth NormedSpace ℝ (W ) +-#synth NormedAddCommGroup (W ) +- +-#synth TopologicalSpace (W) +- +- +-set_option synthInstance.maxHeartbeats 400000 +-set_option maxHeartbeats 9000000 + + -- The space 'GL(W)' of invertible continuous linear functions from W to W + abbrev GL_W := (W →L[ℝ] W)ˣ +@@ -103,26 +87,10 @@ abbrev GL_W := (W →L[ℝ] W)ˣ + -- The space 'GL(W)' of invertible continuous linear functions from W to W + + +-#synth NormedRing (((W →L[ℝ] W))) +- +-#synth NormedAddCommGroup (((W →L[ℝ] W))) +- +- +-#synth FiniteDimensional ℝ (((W →L[ℝ] W))) +- +--- Homeomorph.isCompact_preimage +- + @[expose] + instance proper_linear_w: ProperSpace (((W →L[ℝ] W))) := FiniteDimensional.proper_rclike ℝ (((W →L[ℝ] W))) + + +-#synth FiniteDimensional ℝ (LipschitzH) +-#synth TopologicalSpace (LipschitzH) +-#synth BorelSpace (((W →L[ℝ] W))) +- +-#synth ProperSpace (((W →L[ℝ] W))) +- +- + @[expose] + def GRep: Representation ℝ G (LipschitzH) := { + toFun := fun g => { +@@ -151,8 +119,7 @@ def GRep: Representation ℝ G (LipschitzH) := { + -- We start with a map from G into the space of (not necessarily invertible) linear maps from W to W + @[expose] + def GRepW_non_invertible: Representation ℝ G (W) := Representation.quotient (GRep) ConstF (by +- intro g +- intro f hf ++ intro g f hf + simp + simp [ConstF] + simp [ConstF] at hf +@@ -186,9 +153,9 @@ lemma GRep_preserves_norm (g: G) (f: LipschitzH): ‖(GRep g) f‖ = ‖f‖ := + + have comp := LipschitzWith.comp (f := f.toFun) (g := fun y => (y * g)) (Kf := (LipschitzSemiNorm ⇑f)) (Kg := 1) ?_ ?_ + rotate_left 1 +- . apply lipschitz_attains_norm ++ · apply lipschitz_attains_norm + exact f.lipschitz +- . ++ · + simp [LipschitzWith] + + have norm_mem: (LipschitzSemiNorm f) ∈ { k: NNReal | LipschitzWith k (f.toFun ∘ (fun y => (y * g))) } := by +@@ -198,27 +165,27 @@ lemma GRep_preserves_norm (g: G) (f: LipschitzH): ‖(GRep g) f‖ = ‖f‖ := + + + apply le_antisymm +- . ++ · + apply csInf_le (by + simp [BddBelow] + apply Set.nonempty_of_mem (x := 0) + rw [mem_lowerBounds] + simp + ) norm_mem +- . ++ · + apply le_csInf +- . ++ · + apply Set.nonempty_of_mem (x := (LipschitzSemiNorm ⇑f)) norm_mem +- . intro b hb ++ · intro b hb + simp at hb + simp [LipschitzSemiNorm] + apply csInf_le +- . ++ · + simp [BddBelow] + apply Set.nonempty_of_mem (x := 0) + rw [mem_lowerBounds] + simp +- . simp ++ · simp + simp [LipschitzWith] at hb + simp [LipschitzWith] + intro x y +@@ -229,7 +196,9 @@ lemma GRep_preserves_norm (g: G) (f: LipschitzH): ‖(GRep g) f‖ = ‖f‖ := + + -- Takes in an invertible linear map from W to W, and produces a *continuous* linear map from W to W + @[expose] +-noncomputable def GRepW: (W →ₗ[ℝ] W)ˣ →* (W →L[ℝ] W)ˣ := { ++noncomputable def linearUnitsToContinuous ++ (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] : ++ (E →ₗ[ℝ] E)ˣ →* (E →L[ℝ] E)ˣ := { + toFun := fun f => { + val := LinearMap.toContinuousLinearMap f.val + inv := LinearMap.toContinuousLinearMap f.inv +@@ -257,8 +226,9 @@ noncomputable def GRepW: (W →ₗ[ℝ] W)ˣ →* (W →L[ℝ] W)ˣ := { + simp + } + +- +-#synth Group (GL_W) ++@[expose] ++noncomputable def GRepW : (W →ₗ[ℝ] W)ˣ →* (W →L[ℝ] W)ˣ := ++ linearUnitsToContinuous W + + lemma quotient_norm_eq_norm (f: LipschitzH): ‖(Submodule.Quotient.mk f : W)‖ = ‖f‖ := by + conv => +@@ -289,15 +259,12 @@ lemma quotient_norm_eq_norm (f: LipschitzH): ‖(Submodule.Quotient.mk f : W)‖ + rw [hinf] + simp + +-#synth NormedRing (W →L[ℝ] W) +-#synth TopologicalSpace (W →L[ℝ] W)ˣ +- + + lemma GLW_preseves_norm (g: G) (w: W): ‖(GRepW (GRepW_base g)).val w‖ = ‖w‖ := by + have exists_v: ∃ v, Submodule.Quotient.mk v = w := by + apply Quotient.exists_rep + obtain ⟨v, hv⟩ := exists_v +- simp [GRepW, GRepW_base, GRepW_non_invertible] ++ simp [GRepW, linearUnitsToContinuous, GRepW_base, GRepW_non_invertible] + nth_rw 1 [← hv] + rw [Representation.asGroupHom_apply] + simp only [Representation.quotient_apply, Submodule.mapQ_apply] +@@ -309,31 +276,30 @@ lemma GLW_preseves_norm (g: G) (w: W): ‖(GRepW (GRepW_base g)).val w‖ = ‖w + + lemma GRepW_norm_le (g: G): ‖(GRepW (GRepW_base g)).val‖ ≤ 1 := by + rw [ContinuousLinearMap.opNorm_le_iff] +- . simp [GLW_preseves_norm] +- . simp ++ · simp [GLW_preseves_norm] ++ · simp + + +-set_option synthInstance.maxHeartbeats 500000 + + + @[expose] + noncomputable def rho_g := (GRepW_base).range + + +-@[expose] +-def isembedding_units_val := Units.isEmbedding_val_mk' (M := (W →L[ℝ] W)) (f := ContinuousLinearMap.inverse) (by ++theorem isembedding_units_val : ++ Topology.IsEmbedding (Units.val : (W →L[ℝ] W)ˣ → (W →L[ℝ] W)) := Units.isEmbedding_val_mk' (M := (W →L[ℝ] W)) (f := ContinuousLinearMap.inverse) (by + intro x hx + have foo := ContDiffAt.continuousAt (ContinuousLinearMap.IsInvertible.contDiffAt_map_inverse (e := x) (n := 0) (by + simp at hx + obtain ⟨u, hu⟩ := hx + apply ContinuousLinearMap.IsInvertible.of_inverse (g := u.inv) +- . ++ · + simp + have mul_inv := u.val_inv + dsimp [HMul.hMul, Mul.mul] at mul_inv + rw [hu] at mul_inv + exact mul_inv +- . simp ++ · simp + have inv_val := u.inv_val + dsimp [HMul.hMul, Mul.mul] at inv_val + rw [hu] at inv_val +@@ -341,19 +307,15 @@ def isembedding_units_val := Units.isEmbedding_val_mk' (M := (W →L[ℝ] W)) (f + )) + apply ContinuousAt.continuousWithinAt + exact foo +- -- ContinuousLinearMap.IsInvertible.contDiffAt_map_inverse + ) (by + intro u + have mul_inv := u.val_inv + dsimp [HMul.hMul, Mul.mul] at mul_inv + apply ContinuousLinearMap.inverse_eq +- . exact u.val_inv +- . exact u.inv_val ++ · exact u.val_inv ++ · exact u.inv_val + ) + +-#synth NormedSpace ℝ (W →L[ℝ] W) +-#synth MetricSpace (W →L[ℝ] W) +- + + -- All norms are equivalent on finite-dimensional spaces: + -- https://leanprover-community.github.io/mathlib4_docs/Mathlib/Analysis/Normed/Module/FiniteDimension.html +@@ -363,22 +325,9 @@ def isembedding_units_val := Units.isEmbedding_val_mk' (M := (W →L[ℝ] W)) (f + -- ρ(G) contains an abelian subgroup of finite index + + +---borelize (W →L[ℝ] W)ˣ +- +- +--- (dropped a `#synth ContinuousMul (W →L[ℝ] W)` diagnostic here: it only resolves at a +--- raised `maxSynthPendingDepth`. The instance itself *is* needed -- see +--- `rho_g_contains_abelian`, which raises the depth for exactly this reason -- but a bare +--- `#synth` is not worth carrying a build-wide option for.) +- +- +-#synth NormedAddCommGroup (W) + +-#synth FiniteDimensional ℝ (W) + + +-#synth TopologicalSpace (W) +- + + @[expose] + def FreshTopology (V: Type*) := V +@@ -388,20 +337,9 @@ instance (V: Type*) [AddCommGroup V] [base_module: Module ℝ V]: Module ℝ (Fr + @[expose] + instance (V: Type*) [AddCommGroup V] [Module ℝ V] [base_finite: FiniteDimensional ℝ V]: FiniteDimensional ℝ (FreshTopology V) := base_finite + +- +-#synth CStarAlgebra ((ℂ →L[ℂ] ℂ)) +- +-#synth AddCommMonoid (W) +- + @[expose] + instance T2_W: T2Space (W) := TopologicalSpace.t2Space_of_metrizableSpace + +-#synth T2Space (W) +- +- +-#synth TopologicalSpace (W →L[ℝ] W) +-#synth FiniteDimensional ℝ (W →L[ℝ] W) +- + @[expose] + noncomputable def G_SPolyData {d: ℕ} (h_poly: HasPolynomialGrowthD hGS.S d): SPolyData (T := G) ⊤ := { + S := Subgroup.topEquiv.symm.toMonoidHom '' hGS.S +@@ -438,10 +376,10 @@ noncomputable def G_SPolyData {d: ℕ} (h_poly: HasPolynomialGrowthD hGS.S d): S + rw [Set.Finite.toFinset_image] + rw [← Finset.image_pow] + grw [Finset.card_image_le] +- . ++ · + specialize foo r hr + simpa using foo +- . simp ++ · simp + } + + +diff --git a/Gromov/RhoAbelian.lean b/Gromov/RhoAbelian.lean +index 480ffb6..24e4bba 100644 +--- a/Gromov/RhoAbelian.lean ++++ b/Gromov/RhoAbelian.lean +@@ -11,9 +11,6 @@ public import Gromov.Theorem38 + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false + + open Subgroup + open scoped Finset +@@ -28,23 +25,157 @@ include hGS + + open scoped RealInnerProductSpace + +-set_option synthInstance.maxHeartbeats 500000 + +-set_option maxHeartbeats 9000000 ++ ++private lemma rho_continuous_range_compact ++ [IsTopologicalGroup (W →L[ℝ] W)ˣ] : ++ CompactSpace ((GRepW.comp GRepW_base).range.topologicalClosure) := by ++ let my_new_range := (GRepW.comp GRepW_base).range ++ have continuous_mul : ContinuousMul (W →L[ℝ] W) := ++ (NonUnitalSeminormedRing.toIsTopologicalRing (α := W →L[ℝ] W)).toContinuousMul ++ have is_topological : IsTopologicalGroup (W →L[ℝ] W)ˣ := by infer_instance ++ let plain_units_metric : MetricSpace (W →L[ℝ] W)ˣ := ++ isembedding_units_val.comapMetricSpace Units.val ++ change CompactSpace my_new_range.topologicalClosure ++ ++ refine { isCompact_univ := ?_ } ++ rw [Subtype.isCompact_iff] ++ rw [Topology.IsEmbedding.isCompact_iff (f := Units.val) ?_] ++ · rw [Metric.isCompact_iff_isClosed_bounded (α := (W) →L[ℝ] (W))] ++ refine ⟨?_, ?_⟩ ++ · apply IsSeqClosed.isClosed ++ by_contra! ++ simp [IsSeqClosed] at this ++ obtain ⟨seq, seq_in, ⟨lim_seq, seq_tendsto_lim_seq, lim_seq_not_mem⟩⟩ := this ++ ++ by_cases lim_seq_invertible: IsUnit lim_seq.toLinearMap ++ · ++ -- If the limit (in the space of linear maps) is invertible, then the limit will also exist in the space ++ -- of units, which will then imply that the limit exists in the space of linear maps. ++ obtain ⟨u, hu⟩ := lim_seq_invertible ++ have closure_closed := Subgroup.isClosed_topologicalClosure my_new_range ++ apply IsClosed.isSeqClosed at closure_closed ++ dsimp [IsSeqClosed] at closure_closed ++ ++ have seq_units: ∀ n: ℕ, IsUnit (seq n) := by ++ intro n ++ obtain ⟨x, x_mem, seq_eq_x⟩ := (seq_in n) ++ rw [← seq_eq_x] ++ apply Units.isUnit ++ ++ have lim_units := closure_closed (x := fun n => (seq_units n).unit) (p := GRepW u) ?_ ?_ ++ · ++ specialize lim_seq_not_mem (GRepW u) lim_units ++ conv at lim_seq_not_mem => ++ arg 1 ++ lhs ++ equals u.val.toContinuousLinearMap => ++ rfl ++ rw [hu] at lim_seq_not_mem ++ conv at lim_seq_not_mem => ++ arg 1 ++ lhs ++ equals lim_seq => ++ rfl ++ simp at lim_seq_not_mem ++ · intro n ++ have seq_n := seq_in n ++ obtain ⟨x, x_mem, seq_eq_x⟩ := seq_n ++ simp_rw [← seq_eq_x] ++ simpa using x_mem ++ · ++ rw [Topology.IsEmbedding.tendsto_nhds_iff (g := Units.val)] ++ · ++ conv => ++ arg 1 ++ equals seq => ++ rfl ++ ++ have to_clm_u: GRepW u = u.val.toContinuousLinearMap := by ++ rfl ++ ++ have u_val_eq_lim: u.val.toContinuousLinearMap = lim_seq := by ++ rw [hu] ++ rfl ++ ++ rw [to_clm_u, u_val_eq_lim] ++ exact seq_tendsto_lim_seq ++ · ++ exact isembedding_units_val ++ ++ ++ -- If the limit (in the space of linear maps) is not invertible, then it has a non-trivial kernel. ++ rw [LinearMap.isUnit_iff_ker_eq_bot] at lim_seq_invertible ++ apply Submodule.exists_mem_ne_zero_of_ne_bot at lim_seq_invertible ++ obtain ⟨v, v_in_ker, v_ne_zero⟩ := lim_seq_invertible ++ simp at v_in_ker ++ ++ ++ have eval_at := Filter.Tendsto.eval_const seq_tendsto_lim_seq v ++ have norm_tendsto := Continuous.tendsto (f := fun (x: W) => ‖x‖) (by fun_prop) (lim_seq v) ++ have norm_seq_lim := Filter.Tendsto.comp norm_tendsto eval_at ++ rw [v_in_ker] at norm_seq_lim ++ rw [norm_zero] at norm_seq_lim ++ conv at norm_seq_lim => ++ arg 1 ++ -- Use the fact that the action preserves the euclidian norm (maybe just up to a constant), ++ -- so the sequence is actually constant ++ equals fun x => ‖v‖ => ++ funext n ++ simp ++ have seq_mem := seq_in n ++ obtain ⟨x, x_mem, seq_eq_x⟩ := seq_mem ++ rw [← seq_eq_x] ++ apply ContinuousWithinAt.eq_const_of_mem_closure (f := fun (x: ((W) →L[ℝ] (W))ˣ) => ‖x.val v‖) (c := ‖v‖) (x := x) (s := my_new_range) ++ · apply Continuous.continuousWithinAt ++ fun_prop ++ · exact x_mem ++ · intro y hy ++ simp [my_new_range] at hy ++ obtain ⟨g, rep_g_eq_y⟩ := hy ++ rw [← rep_g_eq_y] ++ apply GLW_preseves_norm ++ have r_t2: T2Space ℝ := TopologicalSpace.t2Space_of_metrizableSpace ++ ++ have tendsto_norm_v := tendsto_const_nhds (α := ℕ) (f := Filter.atTop) (x := ‖v‖) ++ have norm_v_zero := tendsto_nhds_unique tendsto_norm_v norm_seq_lim ++ simp at norm_v_zero ++ contradiction ++ · ++ simp ++ apply LipschitzWith.isBounded_image (f := Units.val) (K := 1) ++ · rw [lipschitzWith_iff_dist_le_mul] ++ intro a b ++ simp ++ rfl ++ · ++ apply Bornology.IsBounded.closure ++ rw [Metric.isBounded_iff_subset_ball 1] ++ use 3 ++ intro a ha ++ simp [my_new_range] at ha ++ obtain ⟨g, rep_g_eq_a⟩ := ha ++ simp ++ conv => ++ lhs ++ equals dist (a.val) (ContinuousLinearMap.id _ _) => ++ rfl ++ grw [dist_le_norm_add_norm (a.val) (ContinuousLinearMap.id ℝ W)] ++ grw [ContinuousLinearMap.norm_id_le] ++ rw [← rep_g_eq_a] ++ grw [GRepW_norm_le] ++ norm_num ++ -- Bornology.isBounded_image_subtype_val ++ · exact isembedding_units_val + + open scoped RealInnerProductSpace in + attribute [-simp] Subgroup.map_toSubmonoid in +-set_option maxHeartbeats 2000000 in +-set_option synthInstance.maxHeartbeats 600000 in +---set_option trace.Meta.synthInstance true in + lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Subgroup ((rho_g)), IsMulCommutative M ∧ M.FiniteIndex := by + classical + let my_map := Subgroup.subtype (rho_g) + have W_equiv: (W) ≃ₗ[ℝ] EuclideanSpace ℝ (Fin <| Module.finrank ℝ W) := LinearEquiv.ofFinrankEq _ _ finrank_euclideanSpace_fin.symm + + +- unfold GL_W at my_map +- -- TODO - is there a simpler way to get an arbitrary inner product space? + let inner_prod_core: InnerProductSpace.Core ℝ (FreshTopology (W)) := { + inner := fun v w => ⟪W_equiv v, W_equiv w⟫, + conj_inner_symm := by intro x y; simp [real_inner_comm], +@@ -75,118 +206,6 @@ lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Su + have fresh_t2: T2Space (FreshTopology (W)) := TopologicalSpace.t2Space_of_metrizableSpace + + +- let plain_linear_to_clm: (((W)) →ₗ[ℝ] ((W)))ˣ →* (((W)) →L[ℝ] ((W)))ˣ := { +- toFun := fun f => { +- val := LinearMap.toContinuousLinearMap f.val +- inv := LinearMap.toContinuousLinearMap f.inv +- val_inv := by +- have old_inv := f.val_inv +- ext a +- apply_fun (fun f => f a) at old_inv +- simp only [Units.inv_eq_val_inv, Module.End.one_apply] at old_inv +- apply old_inv +- inv_val := by +- have old_inv := f.inv_val +- ext a +- apply_fun (fun f => f a) at old_inv +- simp only [Units.inv_eq_val_inv, Module.End.one_apply] at old_inv +- apply old_inv +- } +- -- TODO - why is a normal `simp` so slow here? +- map_one' := by +- ext a +- simp only [] +- rfl +- map_mul' := by +- intro f g +- ext a +- simp only [] +- rfl +- } +- +- let linear_to_clm: ((FreshTopology (W)) →ₗ[ℝ] (FreshTopology (W)))ˣ →* ((FreshTopology (W)) →L[ℝ] (FreshTopology (W)))ˣ := { +- toFun := fun f => { +- val := LinearMap.toContinuousLinearMap f.val +- inv := LinearMap.toContinuousLinearMap f.inv +- val_inv := by +- have old_inv := f.val_inv +- ext a +- apply_fun (fun f => f a) at old_inv +- simp only [Units.inv_eq_val_inv, Module.End.one_apply] at old_inv +- apply old_inv +- inv_val := by +- have old_inv := f.inv_val +- ext a +- apply_fun (fun f => f a) at old_inv +- simp only [Units.inv_eq_val_inv, Module.End.one_apply] at old_inv +- apply old_inv +- } +- -- TODO - why is a normal `simp` so slow here? +- map_one' := by +- ext a +- simp only [] +- rfl +- map_mul' := by +- intro f g +- ext a +- simp only [] +- rfl +- } +- +- +- have plain_linear_to_clm_preserves_norm (g: G) (w: (W)): ‖(plain_linear_to_clm (GRepW_base g)).val w‖ = ‖w‖ := by +- simp [plain_linear_to_clm] +- have exists_v: ∃ v, Submodule.Quotient.mk v = w := by +- apply Quotient.exists_rep +- obtain ⟨v, hv⟩ := exists_v +- simp [GRepW, GRepW_base, GRepW_non_invertible] +- nth_rw 1 [← hv] +- rw [Representation.asGroupHom_apply] +- simp only [Representation.quotient_apply, Submodule.mapQ_apply] +- +- rw [quotient_norm_eq_norm] +- rw [GRep_preserves_norm] +- rw [← hv] +- rw [quotient_norm_eq_norm] +- +- +- let my_range := (linear_to_clm.comp GRepW_base).range +- +- have fresh_complete: CompleteSpace (FreshTopology (W)) := by apply complete_of_proper (α := FreshTopology (W)) +- +- +- +- -- TODO - generalize to LinearMap/ContinuousLinearMap +- have units_val_embedding: Topology.IsEmbedding (Units.val (α := ((FreshTopology (W)) →L[ℝ] (FreshTopology (W))))) := by +- apply Units.isEmbedding_val_mk' (f := fun g => g.inverse) +- . intro a ha +- apply (ContinuousLinearMap.IsInvertible.contDiffAt_map_inverse (n := 1) ?_).continuousAt.continuousWithinAt +- simp at ha +- obtain ⟨b, hb⟩ := ha +- use ContinuousLinearEquiv.ofUnit b +- rw [← hb] +- rfl +- . intro u +- apply ContinuousLinearMap.inverse_eq +- . +- have u_val_inv := u.val_inv +- rw [ContinuousLinearMap.mul_def] at u_val_inv +- -- TODO - avoid the unfold somehow +- unfold Inv.inv +- unfold Units.instInv +- simp only [] +- rw [u_val_inv] +- rfl +- . +- unfold Inv.inv +- unfold Units.instInv +- simp only [] +- have u_inv_val := u.inv_val +- rw [ContinuousLinearMap.mul_def] at u_inv_val +- rw [u_inv_val] +- rfl +- +- + let my_new_range := ((GRepW).comp GRepW_base).range + unfold rho_g + +@@ -200,15 +219,6 @@ lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Su + have is_topological: IsTopologicalGroup ((W) →L[ℝ] (W))ˣ := by + infer_instance + +- let plain_units_metric: MetricSpace (((W)) →L[ℝ] ((W)))ˣ := by +- apply Topology.IsEmbedding.comapMetricSpace (f := Units.val) +- exact isembedding_units_val +- +- let units_metric: MetricSpace ((FreshTopology (W)) →L[ℝ] (FreshTopology (W)))ˣ := by +- apply Topology.IsEmbedding.comapMetricSpace (f := Units.val) +- apply units_val_embedding +- +- + have fresh_equiv: W ≃L[ℝ] FreshTopology (W) := ContinuousLinearEquiv.ofFinrankEq (rfl) + + let to_fresh (f: (W) ≃ₗ[ℝ] (W)): (FreshTopology (W)) ≃ₗ[ℝ] (FreshTopology (W)) := f +@@ -287,147 +297,16 @@ lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Su + + let mapped_group := Subgroup.map new_map_hom.toMonoidHom my_new_range.topologicalClosure + +- have my_new_range_compact: CompactSpace my_new_range.topologicalClosure := by +- refine { isCompact_univ := ?_ } +- rw [Subtype.isCompact_iff] +- rw [Topology.IsEmbedding.isCompact_iff (f := Units.val) ?_] +- . rw [Metric.isCompact_iff_isClosed_bounded (α := (W) →L[ℝ] (W))] +- refine ⟨?_, ?_⟩ +- . apply IsSeqClosed.isClosed +- by_contra! +- simp [IsSeqClosed] at this +- obtain ⟨seq, seq_in, ⟨lim_seq, seq_tendsto_lim_seq, lim_seq_not_mem⟩⟩ := this +- +- by_cases lim_seq_invertible: IsUnit lim_seq.toLinearMap +- . +- -- If the limit (in the space of linear maps) is invertible, then the limit will also exist in the space +- -- of units, which will then imply that the limit exists in the space of linear maps. +- -- TODO - this probably can be a direct proof, rather than by contradiction +- obtain ⟨u, hu⟩ := lim_seq_invertible +- have closure_closed := Subgroup.isClosed_topologicalClosure my_new_range +- apply IsClosed.isSeqClosed at closure_closed +- dsimp [IsSeqClosed] at closure_closed +- +- have seq_units: ∀ n: ℕ, IsUnit (seq n) := by +- intro n +- obtain ⟨x, x_mem, seq_eq_x⟩ := (seq_in n) +- rw [← seq_eq_x] +- apply Units.isUnit +- +- have lim_units := closure_closed (x := fun n => (seq_units n).unit) (p := plain_linear_to_clm u) ?_ ?_ +- . +- specialize lim_seq_not_mem (plain_linear_to_clm u) lim_units +- conv at lim_seq_not_mem => +- arg 1 +- lhs +- equals u.val.toContinuousLinearMap => +- rfl +- rw [hu] at lim_seq_not_mem +- conv at lim_seq_not_mem => +- arg 1 +- lhs +- equals lim_seq => +- rfl +- simp at lim_seq_not_mem +- . intro n +- have seq_n := seq_in n +- obtain ⟨x, x_mem, seq_eq_x⟩ := seq_n +- simp_rw [← seq_eq_x] +- simpa using x_mem +- . +- rw [Topology.IsEmbedding.tendsto_nhds_iff (g := Units.val)] +- . +- conv => +- arg 1 +- equals seq => +- rfl +- +- have to_clm_u: plain_linear_to_clm u = u.val.toContinuousLinearMap := by +- rfl +- +- have u_val_eq_lim: u.val.toContinuousLinearMap = lim_seq := by +- rw [hu] +- rfl +- +- rw [to_clm_u, u_val_eq_lim] +- exact seq_tendsto_lim_seq +- . +- exact isembedding_units_val +- +- +- -- If the limit (in the space of linear maps) is not invertible, then it has a non-trivial kernel. +- rw [LinearMap.isUnit_iff_ker_eq_bot] at lim_seq_invertible +- apply Submodule.exists_mem_ne_zero_of_ne_bot at lim_seq_invertible +- obtain ⟨v, v_in_ker, v_ne_zero⟩ := lim_seq_invertible +- simp at v_in_ker +- +- +- have eval_at := Filter.Tendsto.eval_const seq_tendsto_lim_seq v +- have norm_tendsto := Continuous.tendsto (f := fun (x: W) => ‖x‖) (by fun_prop) (lim_seq v) +- have norm_seq_lim := Filter.Tendsto.comp norm_tendsto eval_at +- rw [v_in_ker] at norm_seq_lim +- rw [norm_zero] at norm_seq_lim +- conv at norm_seq_lim => +- arg 1 +- -- Use the fact that the action preserves the euclidian norm (maybe just up to a constant), +- -- so the sequence is actually constant +- equals fun x => ‖v‖ => +- funext n +- simp +- have seq_mem := seq_in n +- obtain ⟨x, x_mem, seq_eq_x⟩ := seq_mem +- rw [← seq_eq_x] +- apply ContinuousWithinAt.eq_const_of_mem_closure (f := fun (x: ((W) →L[ℝ] (W))ˣ) => ‖x.val v‖) (c := ‖v‖) (x := x) (s := my_new_range) +- . apply Continuous.continuousWithinAt +- fun_prop +- . exact x_mem +- . intro y hy +- simp [my_range] at hy +- obtain ⟨g, rep_g_eq_y⟩ := hy +- rw [← rep_g_eq_y] +- apply plain_linear_to_clm_preserves_norm +- +- -- TODO - why do we need this? +- have r_t2: T2Space ℝ := TopologicalSpace.t2Space_of_metrizableSpace +- +- have tendsto_norm_v := tendsto_const_nhds (α := ℕ) (f := Filter.atTop) (x := ‖v‖) +- have norm_v_zero := tendsto_nhds_unique tendsto_norm_v norm_seq_lim +- simp at norm_v_zero +- contradiction +- . +- simp +- apply LipschitzWith.isBounded_image (f := Units.val) (K := 1) +- . rw [lipschitzWith_iff_dist_le_mul] +- intro a b +- simp +- rfl +- . +- apply Bornology.IsBounded.closure +- rw [Metric.isBounded_iff_subset_ball 1] +- use 3 +- intro a ha +- simp [my_new_range] at ha +- obtain ⟨g, rep_g_eq_a⟩ := ha +- simp +- conv => +- lhs +- equals dist (a.val) (ContinuousLinearMap.id _ _) => +- rfl +- grw [dist_le_norm_add_norm (a.val) (ContinuousLinearMap.id ℝ W)] +- grw [ContinuousLinearMap.norm_id_le] +- rw [← rep_g_eq_a] +- grw [GRepW_norm_le] +- norm_num +- -- Bornology.isBounded_image_subtype_val +- . exact isembedding_units_val ++ have my_new_range_compact : CompactSpace my_new_range.topologicalClosure := ++ rho_continuous_range_compact + + + have continuous_new_map_entry: Continuous new_map_entry := by + simp [new_map_entry] + rw [Units.continuous_iff] + refine ⟨?_, ?_⟩ +- . fun_prop +- . fun_prop ++ · fun_prop ++ · fun_prop + + + have compact_mapped_group: CompactSpace mapped_group := by +@@ -456,169 +335,42 @@ lemma rho_g_contains_abelian {d: ℕ} (hd: HasPolynomialGrowthD S d) : ∃ M: Su + let data := theorem_3_8_real (H := mapped_group) compact_mapped_group ((Subgroup.map new_map_hom.toMonoidHom my_new_range).subgroupOf mapped_group) ?_ (final_data) + obtain ⟨B, B_abelian, B_finite_index⟩ := data + +- let reverse_hom: ((map new_map_hom.toMonoidHom my_new_range).subgroupOf mapped_group) →* (GRepW_base).range := { +- toFun := fun g => ( +- ((⟨Units.map (ContinuousLinearMap.toLinearMapRingHom.toMonoidHom) (new_map_hom.symm g.val), by ( +- simp +- have g_prop := g.property +- rw [Subgroup.mem_subgroupOf] at g_prop +- rw [Subgroup.mem_map] at g_prop +- obtain ⟨x, x_mem, g_eq⟩ := g_prop +- simp [my_new_range] at x_mem +- obtain ⟨a, ha⟩ := x_mem +- use a +- ext f +- simp +- apply_fun (fun h => Units.map (ContinuousLinearMap.toLinearMapRingHom.toMonoidHom) h) at ha +- simp [GRepW] at ha +- rw [ha] +- simp [new_map_hom, new_map_entry_inv] +- rw [← g_eq] +- simp [new_map_hom, new_map_entry] +- )⟩) : GRepW_base.range) +- ), +- map_one' := by +- simp [map_one] +- map_mul' := by +- intro a b +- apply Subtype.ext +- show (Units.map _) (new_map_hom.symm ↑↑(a * b)) = +- (Units.map _) (new_map_hom.symm ↑↑a) * (Units.map _) (new_map_hom.symm ↑↑b) +- rw [← map_mul (Units.map _), ← map_mul new_map_hom.symm] +- norm_cast +- } +- +- have reverse_hom_ker_bot: reverse_hom.ker = ⊥ := by ++ have hinj : Function.Injective GRepW := by ++ intro x y h ++ apply Units.ext ++ apply LinearMap.ext ++ intro v ++ have hval := congrArg (fun u : (W →L[ℝ] W)ˣ => u.val v) h ++ simpa [GRepW, linearUnitsToContinuous] using hval ++ let e₁ := Subgroup.equivMapOfInjective GRepW_base.range GRepW hinj ++ let e₂ := MulEquiv.subgroupCongr (MonoidHom.map_range GRepW GRepW_base) ++ let e₃ := MulEquiv.subgroupMap new_map_hom my_new_range ++ let e := ((e₁.trans e₂).trans e₃).trans map_sub_equiv ++ let reverse_hom := e.symm.toMonoidHom ++ have reverse_hom_ker_bot : reverse_hom.ker = ⊥ := by + rw [MonoidHom.ker_eq_bot_iff] +- intro a b hab +- simp only [reverse_hom, MonoidHom.coe_mk, OneHom.coe_mk, Subtype.mk.injEq] at hab +- apply Units.map_injective at hab +- . +- replace hab := new_map_hom.symm.injective hab +- exact Subtype.ext (Subtype.ext hab) +- . +- intro a b hab +- simpa using hab +- +- have reverse_hom_range_top: reverse_hom.range = ⊤ := by +- rw [Subgroup.eq_top_iff'] +- intro x +- have x_prop := x.property +- rw [MonoidHom.mem_range] at x_prop +- obtain ⟨g, hg⟩ := x_prop +- have mem_range: plain_linear_to_clm ↑x ∈ my_new_range := by +- refine MonoidHom.mem_range.mpr ⟨g, ?_⟩ +- rw [← hg] +- rfl +- have mem_closure: plain_linear_to_clm ↑x ∈ my_new_range.topologicalClosure := +- Subgroup.le_topologicalClosure my_new_range mem_range +- refine MonoidHom.mem_range.mpr +- ⟨⟨⟨new_map_entry (plain_linear_to_clm ↑x), +- Subgroup.mem_map_of_mem new_map_hom.toMonoidHom mem_closure⟩, ?_⟩, ?_⟩ +- . +- rw [Subgroup.mem_subgroupOf] +- exact Subgroup.mem_map_of_mem new_map_hom.toMonoidHom mem_range +- . +- have hrt : ∀ y, new_map_hom.symm (new_map_entry y) = y := new_map_hom.left_inv +- refine Subtype.ext ?_ +- change (Units.map (ContinuousLinearMap.toLinearMapRingHom (R₁ := ℝ) (M₁ := W)).toMonoidHom) +- (new_map_hom.symm (new_map_entry (plain_linear_to_clm ↑x))) = x.val +- rw [hrt] +- ext f +- rfl +- ++ exact e.symm.injective ++ have reverse_hom_range_top : reverse_hom.range = ⊤ := ++ MonoidHom.range_eq_top.mpr e.symm.surjective + + let B' := Subgroup.map reverse_hom B + use B' + refine ⟨?_, ?_⟩ +- . simp only [B'] ++ · simp only [B'] + apply Subgroup.map_isMulCommutative +- . simp only [B'] ++ · simp only [B'] + rw [Subgroup.finiteIndex_iff] + rw [Subgroup.index_map] + rw [reverse_hom_ker_bot, reverse_hom_range_top, sup_bot_eq, Subgroup.index_top, mul_one] + exact B_finite_index.index_ne_zero +- . +- have base_fg: (map new_map_hom.toMonoidHom my_new_range).FG := by +- apply group_fg_map +- simp [my_new_range] +- have group_fg: Group.FG (GRepW.comp (GRepW_base)).range := by +- apply Group.fg_range +- exact (Group.fg_iff_subgroup_fg (GRepW.comp GRepW_base).range).mp group_fg +- +- have base_le: (map new_map_hom.toMonoidHom my_new_range) ≤ mapped_group := by +- intro a ha +- simp at ha +- simp [mapped_group] +- obtain ⟨g, g_mem, g_eq_a⟩ := ha +- use g +- refine ⟨?_, g_eq_a⟩ +- apply Subgroup.le_topologicalClosure my_new_range g_mem +- +- +- rw [Subgroup.fg_iff] +- rw [Subgroup.fg_iff] at base_fg +- obtain ⟨S, S_eq, S_finite⟩ := base_fg +- +- have S_in_map: ∀ s ∈ S, s ∈ (map new_map_hom.toMonoidHom my_new_range) := by +- rw [Subgroup.ext_iff] at S_eq +- intro s hs +- apply (S_eq s).mp ?_ +- exact Subgroup.mem_closure.mpr fun K a ↦ a hs +- +- let S' := Set.range (fun (s: S) => (⟨s.val, base_le (S_in_map s s.property)⟩ : mapped_group)) +- use S' +- -- TODO - this is a huge mess. This can be a general proof about the closure of Subgroup.subgroupOf +- refine ⟨?_, ?_⟩ +- . +- simp only [S'] +- rw [← S_eq] +- ext a +- refine ⟨?_, ?_⟩ +- . intro ha +- rw [Subgroup.mem_subgroupOf] +- induction ha using Subgroup.closure_induction_left with +- | one => simp +- | mul_left y hy z hz h_other_z => +- simp +- apply Subgroup.mul_mem +- . simp at hy +- obtain ⟨p, p_mem, p_eq_y⟩ := hy +- rw [← p_eq_y] +- simp +- apply Subgroup.mem_closure_of_mem p_mem +- . exact h_other_z +- | inv_mul_cancel y hy z hz h_other_z => +- simp +- apply Subgroup.mul_mem +- . simp +- simp at hy +- obtain ⟨p, p_mem, p_eq_y⟩ := hy +- rw [← p_eq_y] +- simp +- apply Subgroup.mem_closure_of_mem p_mem +- . exact h_other_z +- . intro ha +- rw [Subgroup.mem_subgroupOf] at ha +- rw [Subgroup.mem_closure] +- intro K hK +- rw [Subgroup.mem_closure] at ha +- have a_mem := ha (Subgroup.map mapped_group.subtype K) ?_ +- . simpa using a_mem +- . simp +- intro s hs +- rw [Set.range_subset_iff] at hK +- have s_mem := hK ⟨s, hs⟩ +- simp +- simp at s_mem +- use ?_ +- apply base_le (S_in_map s hs) +- . +- simp [S'] +- rw [← Set.finite_coe_iff] at S_finite +- apply Set.finite_range ++ · let : Group.FG my_new_range := Group.fg_range (GRepW.comp GRepW_base) ++ let : Group.FG (Subgroup.map new_map_hom.toMonoidHom my_new_range) := ++ Group.fg_of_surjective (f := (MulEquiv.subgroupMap new_map_hom my_new_range).toMonoidHom) ++ (MulEquiv.subgroupMap new_map_hom my_new_range).surjective ++ let : Group.FG ((Subgroup.map new_map_hom.toMonoidHom my_new_range).subgroupOf mapped_group) := ++ Group.fg_of_surjective (f := map_sub_equiv.toMonoidHom) map_sub_equiv.surjective ++ exact (Group.fg_iff_subgroup_fg _).mp inferInstance + +--- We need this to work with Finset + + structure Theorem3_1_Input (G: Type*) [Group G] where + -- A finite index subgroup G' of G +@@ -629,15 +381,7 @@ structure Theorem3_1_Input (G: Type*) [Group G] where + hφ: Function.Surjective φ + + +-#synth Group.FG (rho_g) +- +- + lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.FiniteIndex) (hom: A →* T) (hom_surjective: Function.Surjective hom) (H: Subgroup T) (H_infinite: Infinite H) (H_abeliean: IsMulCommutative H) (H_finite_index: H.FiniteIndex) (H_FG: Group.FG H): Nonempty (Theorem3_1_Input G) := by +- -- TODO - generalize this to a lemma: finite-index subgroup of an infinite group is infinite +- -- and upstream to mathlib +- +- +- -- TODO - figure out how to make instance inference work here + obtain ⟨i, j, i_fin, j_fin, p, p_prime, e, exists_iso⟩ := @CommGroup.equiv_free_prod_prod_multiplicative_zmod H (haveI := H_abeliean; { (inferInstance : Group H) with mul_comm := mul_comm' }) (H_FG) + have iso := Classical.choice exists_iso + +@@ -661,8 +405,6 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini + apply Finite.instProd + have no_finite := H_infinite.not_finite + contradiction +- +- -- TODO - can we get the comp '∘' syntax to give us a monoid hom, instead of a plain function? + let h_to_z := (Pi.evalMonoidHom _ (Classical.choice (by + exact j_nonempty + ))).comp ((MonoidHom.fst _ _).comp iso.toMonoidHom) +@@ -671,19 +413,17 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini + unfold h_to_z + simp + apply Function.Surjective.comp +- . ++ · + intro x + simp + use fun _ => x +- . apply Function.Surjective.comp +- . exact Prod.fst_surjective +- . exact iso.surjective ++ · apply Function.Surjective.comp ++ · exact Prod.fst_surjective ++ · exact iso.surjective + + + let G' := Subgroup.comap hom H + +- -- TODO - generalize this and PR to mathlib +- + + have G'_finite_index: G'.FiniteIndex := by + unfold G' +@@ -691,15 +431,10 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini + index_ne_zero := by + simp + rw [Subgroup.index_comap] +- -- apply somehow found this - how does it work??? + exact Subgroup.FiniteIndex.index_ne_zero + } +- +- +- -- TODO - there must be an easier way to do this + let g'_to_h: (map A.subtype G') →* H := { + toFun := fun g => ⟨hom ⟨g.val, by ( +- -- TODO - clean this up + have foo := g.property + rw [Subgroup.mem_map] at foo + obtain ⟨x, hx, a_subtype⟩ := foo +@@ -707,7 +442,7 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini + simp + )⟩, by ( + have g_prop := g.property +- simp only [G', Subgroup.mem_comap] at g_prop ++ simp only [G'] at g_prop + rw [Subgroup.mem_map] at g_prop + obtain ⟨x, hx, a_subtype⟩ := g_prop + simp_rw [← a_subtype] +@@ -748,18 +483,18 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini + rw [Subgroup.finiteIndex_iff] + simp [Subgroup.index_map_subtype] + refine ⟨?_, ?_⟩ +- . rw [← ne_eq] ++ · rw [← ne_eq] + rw [← Subgroup.finiteIndex_iff] + exact G'_finite_index +- . exact A_finite_index.index_ne_zero ++ · exact A_finite_index.index_ne_zero + -- G'_finite_index + φ := g_to_z, + hφ := by + simp [g_to_z, g_to_additive_z] + apply Function.Surjective.comp +- . simp [additive_h_to_z] ++ · simp [additive_h_to_z] + exact h_to_z_surjective +- . ++ · + simp [additive_g'_to_h, g'_to_h] + intro h + obtain ⟨a, hom_a⟩ := hom_surjective h +@@ -769,7 +504,6 @@ lemma g_hom_abelian {T: Type*} [Group T] (A: Subgroup G) (A_finite_index: A.Fini + simp [G', hom_a] + } + +-#print axioms g_hom_abelian + + -- Case 1 in Section 3.3 of Vikman, where the representation ρ(G) is infinite + lemma rho_g_case_infinite {d: ℕ} (hd: HasPolynomialGrowthD S d) (hr: Infinite (↥(rho_g))): Nonempty (Theorem3_1_Input G) := by +@@ -785,11 +519,11 @@ lemma rho_g_case_infinite {d: ℕ} (hd: HasPolynomialGrowthD S d) (hr: Infinite + + + have target := g_hom_abelian ⊤ (by infer_instance) (g_rho) ?_ (H) ?_ ?_ ?_ ?_ +- . exact target +- . ++ · exact target ++ · + simp [g_rho] + exact MonoidHom.rangeRestrict_surjective GRepW_base +- . ++ · + unfold rho_g at hr + have card_mul := Subgroup.card_mul_index H + unfold rho_g at card_mul +@@ -798,10 +532,9 @@ lemma rho_g_case_infinite {d: ℕ} (hd: HasPolynomialGrowthD S d) (hr: Infinite + replace card_mul := card_mul.resolve_right H_finite_index.index_ne_zero + rw [Nat.card_eq_zero] at card_mul + exact card_mul.resolve_left (fun h => h.false ⟨1, H.one_mem⟩) +- . exact H_abelian +- . exact H_finite_index +- . exact h_fg ++ · exact H_abelian ++ · exact H_finite_index ++ · exact h_fg + +-#print axioms rho_g_case_infinite + + end GeneratesNS +diff --git a/Gromov/Theorem31Input.lean b/Gromov/Theorem31Input.lean +index 22f01cc..81b7985 100644 +--- a/Gromov/Theorem31Input.lean ++++ b/Gromov/Theorem31Input.lean +@@ -11,9 +11,6 @@ The finite-image case `rho_g_case_finite` and `exists_theorem_3_1_input`. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false + + open Subgroup + open scoped Finset +@@ -28,24 +25,12 @@ include hGS + + open scoped RealInnerProductSpace + +-set_option synthInstance.maxHeartbeats 500000 + +-set_option maxHeartbeats 9000000 + + open MeasureTheory + + open MeasureTheory + +--- TODO - figure out why we need these +- +- +-#print axioms laplace_bounded +-#print axioms laplace_self_adjoint +-#print axioms laplace_positive_semidefinite +- +- +-#synth Module ℝ (Lp ℝ 2 (μ := MeasureTheory.volume (α := G))) +- + + omit hGS in + lemma rangeRestrict_range {A B: Type*} [Group A] [Group B] (f: A →* B): f.rangeRestrict.range = ⊤ := by +@@ -99,8 +84,6 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + simp [lambda_g] + rw [mul_sub] + } +- +- -- TODO - this could be much cleaner + have act_eq_lambda (g: G) (hg: g ∈ (GRepW_base).ker) (f: LipschitzH ): (gAct g f) = f + ConstLipschitzH (lambda_g ⟨g, hg⟩ f) := by + have act := act_v g hg f + simp [GRep, gAct, ConstF] at act +@@ -116,8 +99,8 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + apply eq_add_of_sub_eq at app_a + rw [app_a] + rw [add_comm] +- simp [LipschitzH_apply] +- simp [LipschitzH_apply] at hy ++ simp ++ simp at hy + have other_app := congrFun hy 1 + simp at other_app + rw [← other_app] +@@ -152,24 +135,23 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + } + + by_cases lambda_g_infinite: Infinite (lambda_g_hom.range) +- . ++ · + + apply g_hom_abelian G' ?_ lambda_g_hom.rangeRestrict ?_ lambda_g_hom.rangeRestrict.range ?_ ?_ ?_ ?_ +- . simp [G'] ++ · simp [G'] + exact ker_finite_index +- . exact MonoidHom.rangeRestrict_surjective lambda_g_hom +- . rw [rangeRestrict_range] ++ · exact MonoidHom.rangeRestrict_surjective lambda_g_hom ++ · rw [rangeRestrict_range] + simp +- -- TODO: PR this to mathlib + apply (Equiv.infinite_iff (α := lambda_g_hom.range) _).mp +- . exact lambda_g_infinite +- . exact { ++ · exact lambda_g_infinite ++ · exact { + toFun := fun g => ⟨g, trivial⟩ + invFun := fun g => g.val + left_inv := by simp [Function.LeftInverse] + right_inv := by simp [Function.RightInverse, Function.LeftInverse] + } +- . exact { ++ · exact { + is_comm := { + comm := by + intro a b +@@ -178,18 +160,16 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + rw [add_comm] + } + } +- . rw [Subgroup.finiteIndex_iff] ++ · rw [Subgroup.finiteIndex_iff] + rw [rangeRestrict_range] + simp +- . rw [rangeRestrict_range] ++ · rw [rangeRestrict_range] + simp + exact Group.FG.out +- . ++ · + simp only [not_infinite_iff_finite] at lambda_g_infinite + let G'' := lambda_g_hom.ker + have G''_finite_index := Subgroup.finiteIndex_ker lambda_g_hom +- +- -- TODO - this could be a lot cleaner + have G''_act_v (g: lambda_g_hom.ker) (x: G) (f: LipschitzH ): f (x * g) = f x := by + specialize act_v g + simp at act_v +@@ -224,8 +204,6 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + + -- View G'' as a subgroup of G + let G''_subgroup_G := (Subgroup.map G'.subtype lambda_g_hom.ker) +- +- -- TODO - clean up this proof + have G''_subgroup_finite_index: G''_subgroup_G.FiniteIndex := by + unfold G''_subgroup_G + rw [Subgroup.finiteIndex_iff] +@@ -244,7 +222,7 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + have f_range_eq (f: LipschitzH ): Set.range f = Set.range ((fun (x: G ⧸ G''_subgroup_G) => f (x.out))) := by + ext a + refine ⟨?_, ?_⟩ +- . intro ha ++ · intro ha + simp at ha + obtain ⟨y, hy⟩ := ha + have y_mem: y ∈ Set.univ := by simp +@@ -270,7 +248,7 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + use i + rw [← f_translate] + exact hy +- . intro ha ++ · intro ha + simp only [Set.mem_range] at ha + obtain ⟨y, hy⟩ := ha + simp +@@ -287,16 +265,16 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + simp at hp + obtain ⟨y, hy⟩ := hp + by_cases p_le_z: ‖p‖ ≤ ‖z‖ +- . exact p_le_z +- . simp at p_le_z ++ · exact p_le_z ++ · simp at p_le_z + + have f_le := hz (j := f.toFun y) ?_ ?_ +- . ++ · + simp at f_le + rw [← hy] + exact f_le +- . simp +- . simp ++ · simp ++ · simp + rw [← hy] at p_le_z + linarith + +@@ -326,22 +304,19 @@ lemma rho_g_case_finite (hr: Finite (↥(rho_g))): Nonempty (Theorem3_1_Input G) + have app := congrFun f_const_fn a + rw [app] + simp [ConstLipschitzH] +- . ++ · + rw [f_range_eq] + apply Set.finite_range +- . apply Set.range_nonempty ++ · apply Set.range_nonempty + + obtain ⟨f, nontrivial_f⟩ := exists_nontrivial_harmonic + obtain ⟨z, f_eq_const⟩ := all_f_const f + specialize nontrivial_f z + contradiction +- +- +--- TODO - upstream to mathlib + omit hGS in + lemma exists_theorem_3_1_input [hGS: Generates ] {d: ℕ} (hd: HasPolynomialGrowthD S d): Nonempty (Theorem3_1_Input G) := by + by_cases rho_g_infinite: Infinite (↥(rho_g)) +- . exact rho_g_case_infinite hd rho_g_infinite +- . exact rho_g_case_finite (by simpa using rho_g_infinite) ++ · exact rho_g_case_infinite hd rho_g_infinite ++ · exact rho_g_case_finite (by simpa using rho_g_infinite) + + end GeneratesNS +diff --git a/Gromov/Theorem323.lean b/Gromov/Theorem323.lean +index 0e1604a..8741f01 100644 +--- a/Gromov/Theorem323.lean ++++ b/Gromov/Theorem323.lean +@@ -9,17 +9,10 @@ public import Gromov.BoundedDoubling + `theorem_3_23` and the resulting finite-dimensionality of the space of Lipschitz harmonic + functions. + +-Root of the Theorem 3.23 hierarchy: importing it pulls in the cutoff inequality, the quadratic +-form, the packing argument and the Poincaré inequality. + -/ + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -30,7 +23,186 @@ open Generates + variable [hGS: Generates] + include hGS + +-set_option maxHeartbeats 2500000 in ++private lemma scale_contraction_bound (d w : ℕ) ++ (hw : w = ⌈Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d))⌉₊) : ++ GeneratesNS.C * Real.exp (a d * 2) ^ 2 * (16 ^ (-↑w : ℝ)) ^ 2 * ↑(#S) ++ * 16 ≤ 2⁻¹ := by ++ have ha : (0:ℝ) ≤ a d := by simp only [a]; positivity ++ have hE1 : (1:ℝ) ≤ Real.exp (a d) := Real.one_le_exp ha ++ have hE4 : (1:ℝ) ≤ Real.exp (a d) ^ 4 := one_le_pow₀ hE1 ++ have hEpos : (0:ℝ) < Real.exp (a d) := Real.exp_pos _ ++ have he4 : Real.exp (4 * a d) = Real.exp (a d) ^ 4 := by ++ rw [← Real.exp_nat_mul]; norm_num ++ have he2 : Real.exp (a d * 2) = Real.exp (a d) ^ 2 := by ++ rw [show a d * 2 = 2 * a d from by ring, ← Real.exp_nat_mul]; norm_num ++ have he2sq : Real.exp (a d * 2) ^ 2 = Real.exp (a d) ^ 4 := by ++ rw [he2]; ring ++ have hS0 : (0:ℝ) < ↑(#S) := by exact_mod_cast Finset.card_pos.mpr S_nonempty ++ have hXpos : (0:ℝ) < 16 ^ 4 * ↑(#S) * Real.exp (a d) ^ 4 := by positivity ++ have h16w : (16:ℝ) ^ 4 * ↑(#S) * Real.exp (a d) ^ 4 ≤ (16:ℝ) ^ (↑w : ℝ) := by ++ rw [← he4] ++ have hlog : (16:ℝ) ^ Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d)) ++ = 16 ^ 4 * ↑(#S) * Real.exp (4 * a d) := ++ Real.rpow_logb (by norm_num) (by norm_num) (by rw [he4]; exact hXpos) ++ have hle : Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d)) ≤ (↑w : ℝ) := by ++ have hdef : w = ⌈Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d))⌉₊ := hw ++ rw [hdef]; exact_mod_cast Nat.le_ceil _ ++ calc 16 ^ 4 * ↑(#S) * Real.exp (4 * a d) ++ = (16:ℝ) ^ Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a d)) := hlog.symm ++ _ ≤ (16:ℝ) ^ (↑w : ℝ) := Real.rpow_le_rpow_of_exponent_le (by norm_num) hle ++ have ht0 : (0:ℝ) ≤ (16:ℝ) ^ (-↑w : ℝ) := Real.rpow_nonneg (by norm_num) _ ++ have htX : (16:ℝ) ^ (-↑w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a d) ^ 4) ≤ 1 := by ++ calc (16:ℝ) ^ (-↑w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a d) ^ 4) ++ ≤ (16:ℝ) ^ (-↑w : ℝ) * (16:ℝ) ^ (↑w : ℝ) := ++ mul_le_mul_of_nonneg_left h16w ht0 ++ _ = 1 := by rw [← Real.rpow_add (by norm_num)]; simp ++ have hsq : ((16:ℝ) ^ (-↑w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a d) ^ 4)) ^ 2 ≤ 1 := by ++ nlinarith [htX, mul_nonneg ht0 (le_of_lt hXpos)] ++ have hM8 : (0:ℝ) ≤ ((16:ℝ) ^ (-↑w : ℝ)) ^ 2 * (↑(#S)) ^ 2 * Real.exp (a d) ^ 4 * 16 ^ 8 := by ++ positivity ++ have hP : ((16:ℝ) ^ (-↑w : ℝ)) ^ 2 * (↑(#S)) ^ 2 * Real.exp (a d) ^ 4 * 16 ^ 8 ≤ 1 := by ++ nlinarith [hsq, hE4, hM8] ++ have key : GeneratesNS.C * Real.exp (a d * 2) ^ 2 * (16 ^ (-↑w : ℝ)) ^ 2 * ↑(#S) ++ * 16 ≤ 2⁻¹ := by ++ rw [he2sq]; simp only [GeneratesNS.C] ++ nlinarith [hP, hM8] ++ exact key ++ ++private lemma phi_restrict_injective [v_data : V_Wrapper] ++ (data : GoodScalesData (V_basis v_data.V)) ++ (hw : data.w = ⌈Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d))⌉₊) ++ (U : Submodule ℝ LipschitzH) ++ (bounded_double : ∀ f ∈ U, Q_R (16 * R_2 data) f f ≤ ++ Real.exp (2 * a data.d) * Q_R (R_2 data) f f) : ++ Function.Injective ((phi data).domRestrict (U.submoduleOf v_data.V)) := by ++ -- Pinning the module types keeps this rewrite out of the instance diamond on ++ -- `↥(U.submoduleOf _)` (`Submodule…addCommMonoid` vs `AddCommGroup.toAddCommMonoid`), ++ -- which otherwise only reconciles at a raised `maxSynthPendingDepth`. ++ rw [← LinearMap.ker_eq_bot (M := ↥(U.submoduleOf v_data.V)) ++ (M₂ := EuclideanSpace ℝ ↥(B_finsets data))] ++ rw [LinearMap.ker_eq_bot' (M := ↥(U.submoduleOf v_data.V)) ++ (M₂ := EuclideanSpace ℝ ↥(B_finsets data))] ++ intro u hu ++ ++ have u_le := lemma_3_26_a data u ++ simp at hu ++ simp [hu] at u_le ++ ++ have u_bound := harmonic_r2_inequality u (by ++ have u_prop := u.val.val.harmonic ++ simp [Harmonic] at u_prop ++ simp [Laplace_b] ++ ext a ++ simp ++ nth_rw 1 [u_prop] ++ simp [f_conv_mu] ++ ) (4 * R_2 data) (by simp [R_2]) ++ simp [B_r] at u_le ++ conv at u_bound => ++ lhs ++ arg 1 ++ equals (Metric.closedBall 1 (8 * (R_2 data))).toFinset => ++ simp ++ ring_nf ++ ++ grw [u_bound] at u_le ++ · ++ have u_double := bounded_double u (by ++ exact u.prop ++ ) ++ conv at u_double => ++ lhs ++ simp [Q_R] ++ ++ simp_rw [← pow_two] at u_double ++ grw [Finset.sum_le_sum_of_subset_of_nonneg (t := (finite_closed_ball 1 (16 * (R_2 data))).toFinset)] at u_le ++ · ++ simp at u_le ++ grw [u_double] at u_le ++ · ++ by_cases u_zero: u = 0 ++ · exact u_zero ++ · ++ have r_pos := R'_pos v_data.V ++ have r_ratio_le: (R_1 data + 1) / (4 * R_2 data) ≤ 4 * ((16: ℝ) ^ (-(data.w : ℝ))) := by ++ simp [R_1, R_2] ++ field_simp ++ have i_diff := (GoodScales data).i_diff_mem ++ simp at i_diff ++ have one_le: (1: ℝ) ≤ 2*(16^((GoodScales data).i_1)) := by ++ apply one_le_mul_of_one_le_of_one_le ++ · simp ++ · rw [one_le_pow_iff_of_nonneg] ++ · simp ++ · simp ++ · simp ++ have h_i := (GoodScales data).i_1_pos ++ grind ++ grw [one_le] ++ rw [← mul_add] ++ rw [← two_mul] ++ ring_nf ++ rw [← pow_add] ++ apply mul_le_mul ++ · ++ rw [pow_le_pow_iff_right₀] ++ · grind ++ · simp ++ · norm_num ++ · simp ++ · simp ++ ++ conv at u_le => ++ rhs ++ equals GeneratesNS.C * Real.exp (2 * a data.d) * (((↑(R_1 data) + 1) / ((↑(4 * R_2 data : ℝ))))^2 * ↑(#S) * (Real.exp (2 * a data.d) * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val)) => ++ ring ++ ++ grw [r_ratio_le] at u_le ++ ring_nf at u_le ++ · ++ have le_half: Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val ≤ (2: ℝ)⁻¹ * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by ++ have qr_nonneg : 0 ≤ Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := ++ Q_R_self_nonneg _ _ ++ have key := scale_contraction_bound data.d data.w hw ++ calc Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val ++ ≤ (GeneratesNS.C * Real.exp (a data.d * 2) ^ 2 * (16 ^ (-↑data.w : ℝ)) ^ 2 * ↑(#S) ++ * 16) * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by nlinarith [u_le] ++ _ ≤ 2⁻¹ * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by nlinarith [key, qr_nonneg] ++ ++ have Q_r_zero: Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val = 0 := by ++ by_contra! ++ rw [mul_comm] at le_half ++ have foo := one_le_of_le_mul_left₀ (by ++ have nonneg: 0 ≤ Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := ++ Q_R_self_nonneg _ _ ++ grind ++ ) le_half ++ norm_num at foo ++ ++ rw [← Submodule.coe_eq_zero] ++ by_contra hne ++ exact absurd Q_r_zero (ne_of_gt (Q_R_pos_on_R' (↑u) hne _ (R'_le_R_2 data))) ++ · apply mul_nonneg (by positivity) ++ exact Q_R_self_nonneg _ _ ++ · simp [GeneratesNS.C] ++ positivity ++ ++ · simp [GeneratesNS.C] ++ positivity ++ · ++ simp [GeneratesNS.C] ++ positivity ++ · intro a ha ++ simp ++ simp at ha ++ grind ++ · intro i hi _ ++ positivity ++ · ++ simp [GeneratesNS.C] ++ positivity ++ ++ + lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, growth_bound (V_basis v_data.V) d → (Module.finrank ℝ v_data.V) < C := by + let w := ⌈Real.logb 16 ((16^4) * #(S) * Real.exp (4 * a (d)))⌉₊ + let C: ℕ := 1 + (⌈2 * Real.exp (w * (a d))⌉₊) +@@ -43,16 +215,16 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow + hw := by + simp + apply Real.logb_pos +- . simp +- . apply one_lt_mul +- . ++ · simp ++ · apply one_lt_mul ++ · + have card_s: 1 ≤ #(S) := by + simp + apply S_nonempty + grw [← card_s] + simp + norm_num +- . ++ · + norm_num + simp [a] + positivity +@@ -61,16 +233,16 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow + rw [Nat.lt_ceil] + simp + rw [Real.lt_logb_iff_rpow_lt] +- . ++ · + have mul_pos: 1 < ↑(#S) * Real.exp (4 * a d) := by + apply one_lt_mul +- . simp ++ · simp + apply S_nonempty +- . simp [a] ++ · simp [a] + positivity + linarith +- . simp +- . have S_ne: #(S) ≠ 0 := by ++ · simp ++ · have S_ne: #(S) ≠ 0 := by + have foo := S_card_ne_zero_re + simpa using foo + positivity +@@ -80,172 +252,7 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow + obtain ⟨U, U_sub_v, hU_dim, bounded_double⟩ := exists_bounded_doubling_subspace data + + let phi_u := (phi data).domRestrict (U.submoduleOf v_data.V) +- have phi_u_inj: Function.Injective phi_u := by +- -- Pinning the module types keeps this rewrite out of the instance diamond on +- -- `↥(U.submoduleOf _)` (`Submodule…addCommMonoid` vs `AddCommGroup.toAddCommMonoid`), +- -- which otherwise only reconciles at a raised `maxSynthPendingDepth`. +- rw [← LinearMap.ker_eq_bot (M := ↥(U.submoduleOf v_data.V)) +- (M₂ := EuclideanSpace ℝ ↥(B_finsets data))] +- rw [LinearMap.ker_eq_bot' (M := ↥(U.submoduleOf v_data.V)) +- (M₂ := EuclideanSpace ℝ ↥(B_finsets data))] +- intro u hu +- +- have u_le := lemma_3_26_a data u +- simp [phi_u] at hu +- simp [hu] at u_le +- +- have u_bound := harmonic_r2_inequality u (by +- have u_prop := u.val.val.harmonic +- simp [Harmonic] at u_prop +- simp [Laplace_b] +- ext a +- simp +- nth_rw 1 [u_prop] +- simp [f_conv_mu] +- ) (4 * R_2 data) (by simp [R_2]) +- simp [B_r] at u_le +- conv at u_bound => +- lhs +- arg 1 +- equals (Metric.closedBall 1 (8 * (R_2 data))).toFinset => +- simp +- ring +- +- grw [u_bound] at u_le +- . +- have u_double := bounded_double u (by +- exact u.prop +- ) +- conv at u_double => +- lhs +- simp [Q_R] +- +- simp_rw [← pow_two] at u_double +- grw [Finset.sum_le_sum_of_subset_of_nonneg (t := (finite_closed_ball 1 (16 * (R_2 data))).toFinset)] at u_le +- . +- simp [finite_closed_ball] at u_le +- grw [u_double] at u_le +- . +- by_cases u_zero: u = 0 +- . exact u_zero +- . +- have r_pos := R'_pos v_data.V +- have r_ratio_le: (R_1 data + 1) / (4 * R_2 data) ≤ 4 * ((16: ℝ) ^ (-(data.w : ℝ))) := by +- simp [R_1, R_2] +- field_simp +- have i_diff := (GoodScales data).i_diff_mem +- simp at i_diff +- have one_le: (1: ℝ) ≤ 2*(16^((GoodScales data).i_1)) := by +- norm_num +- apply one_le_mul_of_one_le_of_one_le +- . simp +- . rw [one_le_pow_iff_of_nonneg] +- . simp +- . simp +- . simp +- have h_i := (GoodScales data).i_1_pos +- grind +- grw [one_le] +- rw [← mul_add] +- rw [← two_mul] +- ring +- rw [← pow_add] +- apply mul_le_mul +- . +- rw [pow_le_pow_iff_right₀] +- . grind +- . simp +- . norm_num +- . simp +- . simp +- +- conv at u_le => +- rhs +- equals GeneratesNS.C * Real.exp (2 * a data.d) * (((↑(R_1 data) + 1) / ((↑(4 * R_2 data : ℝ))))^2 * ↑(#S) * (Real.exp (2 * a data.d) * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val)) => +- ring +- +- grw [r_ratio_le] at u_le +- ring_nf at u_le +- . +- have le_half: Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val ≤ (2: ℝ)⁻¹ * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by +- have qr_nonneg : 0 ≤ Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := +- Q_R_self_nonneg _ _ +- have ha : (0:ℝ) ≤ a data.d := by simp only [a]; positivity +- have hE1 : (1:ℝ) ≤ Real.exp (a data.d) := Real.one_le_exp ha +- have hE4 : (1:ℝ) ≤ Real.exp (a data.d) ^ 4 := one_le_pow₀ hE1 +- have hEpos : (0:ℝ) < Real.exp (a data.d) := Real.exp_pos _ +- have he4 : Real.exp (4 * a data.d) = Real.exp (a data.d) ^ 4 := by +- rw [← Real.exp_nat_mul]; norm_num +- have he2 : Real.exp (a data.d * 2) = Real.exp (a data.d) ^ 2 := by +- rw [show a data.d * 2 = 2 * a data.d from by ring, ← Real.exp_nat_mul]; norm_num +- have he2sq : Real.exp (a data.d * 2) ^ 2 = Real.exp (a data.d) ^ 4 := by +- rw [he2]; ring +- have hS0 : (0:ℝ) < ↑(#S) := by exact_mod_cast Finset.card_pos.mpr S_nonempty +- have hXpos : (0:ℝ) < 16 ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4 := by positivity +- have h16w : (16:ℝ) ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4 ≤ (16:ℝ) ^ (↑data.w : ℝ) := by +- rw [← he4] +- have hlog : (16:ℝ) ^ Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d)) +- = 16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d) := +- Real.rpow_logb (by norm_num) (by norm_num) (by rw [he4]; exact hXpos) +- have hle : Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d)) ≤ (↑data.w : ℝ) := by +- have hdef : data.w = ⌈Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d))⌉₊ := rfl +- rw [hdef]; exact_mod_cast Nat.le_ceil _ +- calc 16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d) +- = (16:ℝ) ^ Real.logb 16 (16 ^ 4 * ↑(#S) * Real.exp (4 * a data.d)) := hlog.symm +- _ ≤ (16:ℝ) ^ (↑data.w : ℝ) := Real.rpow_le_rpow_of_exponent_le (by norm_num) hle +- have ht0 : (0:ℝ) ≤ (16:ℝ) ^ (-↑data.w : ℝ) := Real.rpow_nonneg (by norm_num) _ +- have htX : (16:ℝ) ^ (-↑data.w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4) ≤ 1 := by +- calc (16:ℝ) ^ (-↑data.w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4) +- ≤ (16:ℝ) ^ (-↑data.w : ℝ) * (16:ℝ) ^ (↑data.w : ℝ) := +- mul_le_mul_of_nonneg_left h16w ht0 +- _ = 1 := by rw [← Real.rpow_add (by norm_num)]; simp +- have hsq : ((16:ℝ) ^ (-↑data.w : ℝ) * (16 ^ 4 * ↑(#S) * Real.exp (a data.d) ^ 4)) ^ 2 ≤ 1 := by +- nlinarith [htX, mul_nonneg ht0 (le_of_lt hXpos)] +- have hM8 : (0:ℝ) ≤ ((16:ℝ) ^ (-↑data.w : ℝ)) ^ 2 * (↑(#S)) ^ 2 * Real.exp (a data.d) ^ 4 * 16 ^ 8 := by +- positivity +- have hP : ((16:ℝ) ^ (-↑data.w : ℝ)) ^ 2 * (↑(#S)) ^ 2 * Real.exp (a data.d) ^ 4 * 16 ^ 8 ≤ 1 := by +- nlinarith [hsq, hE4, hM8] +- have key : GeneratesNS.C * Real.exp (a data.d * 2) ^ 2 * (16 ^ (-↑data.w : ℝ)) ^ 2 * ↑(#S) +- * 16 ≤ 2⁻¹ := by +- rw [he2sq]; simp only [GeneratesNS.C] +- nlinarith [hP, hM8] +- calc Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val +- ≤ (GeneratesNS.C * Real.exp (a data.d * 2) ^ 2 * (16 ^ (-↑data.w : ℝ)) ^ 2 * ↑(#S) +- * 16) * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by nlinarith [u_le] +- _ ≤ 2⁻¹ * Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := by nlinarith [key, qr_nonneg] +- +- have Q_r_zero: Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val = 0 := by +- by_contra! +- rw [mul_comm] at le_half +- have foo := one_le_of_le_mul_left₀ (by +- have nonneg: 0 ≤ Q_R ↑(R_2 data) ⇑u.val.val ⇑u.val.val := +- Q_R_self_nonneg _ _ +- grind +- ) le_half +- norm_num at foo +- +- rw [← Submodule.coe_eq_zero] +- by_contra hne +- exact absurd Q_r_zero (ne_of_gt (Q_R_pos_on_R' (↑u) hne _ (R'_le_R_2 data))) +- . apply mul_nonneg (by positivity) +- exact Q_R_self_nonneg _ _ +- . simp [GeneratesNS.C] +- positivity +- +- . simp [GeneratesNS.C] +- positivity +- . +- simp [GeneratesNS.C] +- positivity +- . intro a ha +- simp +- simp at ha +- grind +- . intro i hi _ +- positivity +- . +- simp [GeneratesNS.C] +- positivity ++ have phi_u_inj : Function.Injective phi_u := phi_restrict_injective data rfl U bounded_double + + apply LinearMap.finrank_le_finrank_of_injective at phi_u_inj + simp at phi_u_inj +@@ -270,7 +277,7 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow + have hB : (B_finite data).toFinset + = Finset.image (fun a => Metric.closedBall a (↑(R_1 data):ℝ)) (X_j_finite data).toFinset := by + ext s +- simp only [Set.Finite.mem_toFinset, B, Set.mem_image, Finset.mem_image, Finset.mem_coe] ++ simp only [Set.Finite.mem_toFinset, B, Set.mem_image, Finset.mem_image] + rw [hB, B_finsets, Finset.card_image_of_injOn (hinj1.mono hcoe.le), + Finset.card_image_of_injOn (hinj2.mono hcoe.le)] + rw [← card_eq] +@@ -282,14 +289,11 @@ lemma theorem_3_23 (d: ℕ) (hd: 0 < d): ∃ C: ℕ, ∀ v_data: V_Wrapper, grow + equals 0 + 2 * Real.exp (↑data.w * a data.d) => + simp + apply add_le_add +- . simp +- . apply Nat.le_ceil ++ · simp ++ · apply Nat.le_ceil + + open scoped Topology +- +--- TODO - do we really need the double by_contra here? + -- Theorem 3.19 +-set_option maxHeartbeats 2500000 in + @[expose] + instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + classical +@@ -314,14 +318,14 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + V_finite := by infer_instance + V_even := by + rw [finrank_span_finset_eq_card] +- . ++ · + simp [fin_basis] + rw [Finset.card_image_of_injective] +- . grind +- . ++ · grind ++ · + + exact Module.Basis.injective B +- . ++ · + simp [fin_basis] + apply LinearIndepOn.id_image + exact Module.Basis.linearIndepOn B ↑fin_basis_idx +@@ -340,7 +344,7 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + -- `large_v.V` does not reduce on its own inside `rw`, so name the (definitional) equation. + have large_v_V: large_v.V = Submodule.span ℝ fin_basis := rfl + specialize V_bound large_v ?_ +- . ++ · + simp [growth_bound, my_expr] + + norm_cast +@@ -363,7 +367,7 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + equals (𝓝[>] (0 * 0)) => simp + + apply Filter.TendstoNhdsWithinIoi.mul (by simp) (by simp) +- . ++ · + unfold HasPolynomialGrowthD at hd + obtain ⟨a, s_growth⟩ := hd + simp +@@ -371,12 +375,11 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + rw [← Filter.tendsto_add_atTop_iff_nat R''] + -- Filter.tendsto_add_atTop_iff_nat + apply squeeze_zero_nhdsGT (g := (fun (R: ℕ) => (det_bound_const (V_basis large_v.V) * (1 + (R + R'')) ^ 2 * ((a * (R + R'')^d : ℝ))) / ((R + R'') ^ (↑d + 3) : ℝ))) +- . ++ · + rw [Filter.eventually_atTop] + use 1 + intro R R_pos + have det_pos := (Q_R_matrix_pos_def (V_basis large_v.V) (R + R'') (by +- -- TODO - why is this so messy? + simp [R''] + norm_cast + have foo := Nat.le_ceil (a := R'_ large_v.V) +@@ -386,7 +389,7 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + )).det_pos + norm_cast at det_pos + positivity +- . ++ · + apply Filter.Eventually.of_forall + intro R + have foo := det_bound (V_basis large_v.V) (R := R + R'') (by +@@ -402,7 +405,7 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + push_cast at foo + refine le_trans (mul_le_mul_of_nonneg_right foo (by positivity)) ?_ + by_cases const_zero: det_bound_const (V_basis large_v.V) = 0 +- . ++ · + simp [const_zero] + + field_simp +@@ -410,25 +413,25 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + rw [mul_div_assoc] + rw [mul_assoc] + rw [mul_le_mul_iff_right₀] +- . ++ · + by_cases r_zero: (R + R'') = 0 +- . ++ · + norm_cast + simp [r_zero] +- . ++ · + grw [s_growth (R + R'') (by grind)] + norm_cast + simp + rw [mul_div_assoc] +- . ++ · + have nonneg := det_bound_const_nonneg (V_basis large_v.V) + grind +- . poly_tendsto +- . ++ · poly_tendsto ++ · + unfold HasPolynomialGrowthD at hd + obtain ⟨a, s_growth⟩ := hd + apply squeeze_zero_nhdsGT (g := (fun (n: ℝ) => (a * n^d : ℝ) / (n ^ (↑d + 3))) ∘ (fun (n: ℕ) => (n: ℝ))) +- . ++ · + rw [Filter.eventually_atTop] + use 1 + intro n hn +@@ -439,32 +442,30 @@ instance Lipschitz_finite_dimensional: FiniteDimensional ℝ LipschitzH := by + + norm_cast + positivity +- . ++ · + apply Filter.Eventually.of_forall + intro n + by_cases hn: n = 0 +- . ++ · + simp [hn] +- . ++ · + grw [s_growth n (by grind)] + norm_cast + simp +- . poly_tendsto +- . ++ · poly_tendsto ++ · + rw [large_v_V, finrank_span_finset_eq_card] at V_bound +- . ++ · + simp [fin_basis] at V_bound + rw [Finset.card_image_of_injective] at V_bound +- . ++ · + simp [card_fin_basis_idx] at V_bound + grind +- . exact Module.Basis.injective B +- . ++ · exact Module.Basis.injective B ++ · + simp [fin_basis] + apply LinearIndepOn.id_image + exact Module.Basis.linearIndepOn B ↑fin_basis_idx + +-#synth FiniteDimensional ℝ LipschitzH +-#print axioms Lipschitz_finite_dimensional + + end GeneratesNS +diff --git a/Gromov/Theorem38.lean b/Gromov/Theorem38.lean +index f00df84..c132e22 100644 +--- a/Gromov/Theorem38.lean ++++ b/Gromov/Theorem38.lean +@@ -6,15 +6,12 @@ public import Gromov.Representation + /-! + # Theorem 3.8 + +-`theorem_3_8` and its real form: a group of polynomial growth admits a nontrivial +-finite-dimensional representation. ++A finitely generated polynomial-growth subgroup of a compact linear group is ++virtually abelian, over either the real or the complex numbers. + -/ + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false + + open Subgroup + open scoped Finset +@@ -29,12 +26,9 @@ include hGS + + open scoped RealInnerProductSpace + +-set_option synthInstance.maxHeartbeats 500000 + +-set_option maxHeartbeats 9000000 + + omit hGS in +-set_option maxHeartbeats 500000 in + lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V] (H: Subgroup (V →L[ℂ] V)ˣ) [DecidableEq H] (h_compact: CompactSpace H) (G: Subgroup H) (G_fg: G.FG) (S_data: SPolyData G): ∃ A: Subgroup G, IsMulCommutative A ∧ A.FiniteIndex := by + obtain ⟨H', ⟨H_equiv_H'⟩⟩ := new_weyl_unitarian_trick (V := V) (H := H) + let G' := Subgroup.map H'.subtype (Subgroup.map H_equiv_H'.symm.toMonoidHom G) +@@ -105,18 +99,17 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F + exact G_fg + + by_cases dim_le_one: Module.finrank ℂ (V) ≤ 1 +- . ++ · + use ⊤ + refine ⟨?_, ?_⟩ +- . ++ · + + have map_dim := Module.finrank_linearMap ℂ ℂ V V +- -- TODO - is there an easier way to prove this? + have map_dim_le_one: Module.finrank ℂ (V →ₗ[ℂ] V) ≤ 1 := by + rw [map_dim] + by_cases dim_eq_zero: Module.finrank ℂ (V) = 0 +- . simp [dim_eq_zero] +- . have dim_eq_one: Module.finrank ℂ (V) = 1 := by omega ++ · simp [dim_eq_zero] ++ · have dim_eq_one: Module.finrank ℂ (V) = 1 := by omega + simp [dim_eq_one] + + rw [finrank_le_one_iff] at map_dim_le_one +@@ -128,8 +121,6 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F + simp + obtain ⟨p, hx⟩ := v_span x.val.val.val + obtain ⟨q, hy⟩ := v_span y.val.val.val +- +- -- TODO - upstream to mathlib + have clm_apply (f: V →L[ℂ] V) (v: V): f v = f.toLinearMap v := rfl + rw [clm_apply] + rw [clm_apply] +@@ -139,8 +130,8 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F + rw [← hx, ← hy] + simp + rw [smul_comm] +- . infer_instance +- . ++ · infer_instance ++ · + + let new_S_data := map_S_data G (f := H'.subtype.comp (H_equiv_H'.symm.toMonoidHom)) S_data + obtain ⟨N, N_comm, N_finite_index⟩ := compact_lie_virtually_abelian (Module.finrank ℂ V) (by omega) G' G'_fg (by +@@ -158,17 +149,17 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F + let new_N' := Subgroup.map G'_to_G N + use new_N' + refine ⟨?_, ?_⟩ +- . ++ · + simp [new_N'] + apply Subgroup.map_isMulCommutative +- . ++ · + simp [new_N'] + rw [Subgroup.finiteIndex_iff] + rw [Subgroup.index_map_of_injective] +- . simp ++ · simp + refine ⟨?_, ?_⟩ +- . exact N_finite_index.index_ne_zero +- . conv => ++ · exact N_finite_index.index_ne_zero ++ · conv => + arg 1 + arg 1 + arg 1 +@@ -180,20 +171,20 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F + use H'.subtype (H_equiv_H'.symm a) + simp [my_hom] + use ?_ +- . have key : (MonoidHom.ofInjective (subtype_injective H')).symm ++ · have key : (MonoidHom.ofInjective (subtype_injective H')).symm + ⟨↑(H_equiv_H'.symm (↑a : ↥H)), ⟨H_equiv_H'.symm (↑a : ↥H), rfl⟩⟩ + = H_equiv_H'.symm (↑a : ↥H) := + subtype_injective H' (MonoidHom.apply_ofInjective_symm _ _) + exact Subtype.ext ((congrArg H_equiv_H' key).trans + (H_equiv_H'.apply_symm_apply _)) +- . simp [G'] ++ · simp [G'] + use a.val + use ?_ +- . simp +- . simp ++ · simp ++ · simp + + simp +- . ++ · + simp [G'_to_G] + intro a b hab + simpa using hab +@@ -202,8 +193,6 @@ lemma theorem_3_8 {V: Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [F + instance rho_g_FG: Group.FG (rho_g) := by + unfold rho_g + apply Group.fg_range +- +--- TODO - deduplicate with 'map_S_Data' + @[expose] + def map_range_S_data {G H: Type*} [Group G] [Group H] [DecidableEq G] [DecidableEq H] {f: G →* H} (S_data: SPolyData (T := G) ⊤): SPolyData f.range := { + S := (f.rangeRestrict.comp (Subgroup.topEquiv.toMonoidHom)) '' S_data.S +@@ -232,9 +221,9 @@ def map_range_S_data {G H: Type*} [Group G] [Group H] [DecidableEq G] [Decidable + rw [Set.Finite.toFinset_image] + rw [← Finset.image_pow] + grw [Finset.card_image_le] +- . ++ · + apply S_data.S_poly r hr +- . exact S_data.S_finite ++ · exact S_data.S_finite + } + + @[expose] +@@ -265,12 +254,13 @@ def map_equiv_S_data {A B: Type*} [Group A] [Group B] [DecidableEq A] [Decidable + rw [Set.Finite.toFinset_image] + rw [← Finset.image_pow] + grw [Finset.card_image_le] +- . ++ · + apply S_data.S_poly r hr +- . exact S_data.S_finite ++ · exact S_data.S_finite + } + + ++omit hGS in + /-- The real-inner-product-space version of `theorem_3_8`: a finitely generated, polynomial-growth + subgroup of the units of a compact linear group over `ℝ` is virtually abelian. We reduce to the + complex `theorem_3_8` by complexifying (`Cx.unitsMapHom`) just before the unitary machinery. -/ +diff --git a/Gromov/ThreeTwoGenerates.lean b/Gromov/ThreeTwoGenerates.lean +index 7187937..bb10b00 100644 +--- a/Gromov/ThreeTwoGenerates.lean ++++ b/Gromov/ThreeTwoGenerates.lean +@@ -12,9 +12,6 @@ kernel of `φ`. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false + + open Subgroup + open scoped Finset +@@ -29,9 +26,7 @@ include hGS + + open scoped RealInnerProductSpace + +-set_option synthInstance.maxHeartbeats 500000 + +-set_option maxHeartbeats 9000000 + + open MeasureTheory + +@@ -63,8 +58,8 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + + have closure_enlarge: Subgroup.closure ({1, γ, γ⁻¹} ∪ (e_i '' Set.univ)) = Subgroup.closure (({1, γ, γ⁻¹} ∪ (e_i_regular '' Set.univ))^(max_phi + 1)) := by + rw [Subgroup.closure_pow] +- . simp +- . unfold max_phi ++ · simp ++ · unfold max_phi + simp + + conv => +@@ -76,10 +71,10 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + rfl + rw [closure_enlarge] + apply Subgroup.closure_eq_of_le +- . ++ · + rw [hGS.generates] + exact fun ⦃a⦄ a ↦ trivial +- . ++ · + simp + intro s hs + simp +@@ -87,14 +82,13 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + rw [Subgroup.closure_toSubmonoid] + dsimp [Membership.mem] + rw [Submonoid.closure_eq_image_prod] +- -- TODO - why do we need any of this? + show s ∈ List.prod '' _ + rw [Set.mem_image] + + + have foo := Submonoid.exists_list_of_mem_closure (s := ((S ∪ S⁻¹) : Set G)) (x := s) + rw [← Subgroup.closure_toSubmonoid _] at foo +- simp only [mem_toSubmonoid, Finset.mem_coe] at foo ++ simp only [mem_toSubmonoid] at foo + have generates := hGS.generates + have x_in_top: s ∈ (⊤: Set G) := by + simp +@@ -114,7 +108,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + + use new_list + refine ⟨?_, ?_⟩ +- . ++ · + simp + intro x hx + unfold new_list list_with_mem l_attach at hx +@@ -124,9 +118,9 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + + have gamma_phi_in_minus_plus: γ^(φ a) ∈ ({1, γ, γ⁻¹} ∪ Set.range e_i_regular) ^ (max_phi - 1 +1) := by + by_cases val_pos: 0 < φ a +- . ++ · + have eq_self: Int.natAbs (φ a) = φ a := by +- simp [val_pos] ++ simp + linarith + conv => + arg 2 +@@ -134,8 +128,8 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + nth_rw 1 [← eq_self] + norm_cast + apply Set.pow_subset_pow_right (m := Int.natAbs (φ a)) (n := max_phi - 1 + 1) +- . simp +- . ++ · simp ++ · + rw [cancel_add_minus] + unfold max_phi + simp +@@ -147,10 +141,10 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + conv => + pattern ofMul a + equals a => rfl +- . ++ · + apply Set.pow_mem_pow + simp +- . ++ · + have eq_neg_abs: (φ a) = -(φ a).natAbs := by + rw [← Int.abs_eq_natAbs] + simp at val_pos +@@ -165,8 +159,8 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + norm_cast + -- TOOD - deduplicate this with the positive case + apply Set.pow_subset_pow_right (m := Int.natAbs (φ a)) (n := max_phi - 1 + 1) +- . simp +- . ++ · simp ++ · + rw [cancel_add_minus] + unfold max_phi + simp +@@ -178,7 +172,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + conv => + pattern ofMul a + equals a => rfl +- . ++ · + apply Set.pow_mem_pow + simp + have a_mem_s: a ∈ S := by exact l_mem_s a ha +@@ -192,7 +186,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + simp + + have prod_eq_sum: e_i ⟨a, l_mem_s a ha⟩ + φ (ofMul a) • ofMul γ = (e_i_regular ⟨a, a_mem_s⟩) * (γ ^ φ (ofMul a)) := by +- simp [e_i, e_i_regular, cancel_add_minus] ++ simp [e_i, e_i_regular] + + + conv => +@@ -202,7 +196,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + simp + + apply_fun (fun x => x * (γ ^ (- φ (ofMul a)))) +- . ++ · + simp only + simp + conv => +@@ -222,7 +216,7 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + equals (a * γ ^ (-φ (ofMul a))) => + rfl + simp +- . ++ · + exact mul_left_injective (γ ^ (-φ (ofMul a))) + + +@@ -253,10 +247,8 @@ lemma e_i_and_gamma_generates_G (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ + exact List.map_id l + + +-#print axioms e_i_and_gamma_generates_G + + -- The kernel of `φ` is generated by {γ_m_i} +-set_option maxHeartbeats 1000000 + lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ γ = 1) : Subgroup.closure (Set.range (Function.uncurry (gamma_m_helper (S := S) φ γ))) = AddSubgroup.toSubgroup φ.ker := by + have phi_ofmul: φ (ofMul γ) = 1 := by + exact hγ +@@ -281,8 +273,8 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + + have closure_enlarge: Subgroup.closure ({1, γ, γ⁻¹} ∪ (e_i '' Set.univ)) = Subgroup.closure (({1, γ, γ⁻¹} ∪ (e_i_regular '' Set.univ))^(max_phi + 1)) := by + rw [Subgroup.closure_pow] +- . simp +- . unfold max_phi ++ · simp ++ · unfold max_phi + simp + + +@@ -291,7 +283,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + have gamma_m_ker_phi: (Subgroup.closure (Set.range (Function.uncurry gamma_m))) = φ.ker.toSubgroup := by + ext z + refine ⟨?_, ?_⟩ +- . intro hz ++ · intro hz + have foo := Submonoid.exists_list_of_mem_closure (s := Set.range (Function.uncurry gamma_m) ∪ (Set.range (Function.uncurry gamma_m))⁻¹) (x := z) + rw [← Subgroup.closure_toSubmonoid _] at foo + specialize foo hz +@@ -325,7 +317,6 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + obtain ⟨n, val, val_in_s, prod_eq_a⟩ := a_eq_prod + apply_fun Inv.inv at prod_eq_a + simp at prod_eq_a +- -- TODO - deduplicate this with the branch above + rw [← prod_eq_a] + simp + have apply_mult := AddMonoidHom.toMultiplicative_apply_apply φ (toMul (e_i ⟨val, val_in_s⟩)) +@@ -336,7 +327,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + equals e_i ⟨val, val_in_s⟩ => rfl + rw [e_i_zero] at apply_mult + exact apply_mult +- . ++ · + intro hz + + -- We need to write 'γ^a (f⁻¹ )' as an element of e_i +@@ -351,7 +342,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + rw [← e_i_eq] at new_closure_e_i + rw [new_closure_e_i] at foo + rw [← Subgroup.closure_toSubmonoid _] at foo +- simp only [mem_toSubmonoid, Finset.mem_coe] at foo ++ simp only [mem_toSubmonoid] at foo + + conv at foo => + intro hz +@@ -386,7 +377,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + have eq_split: list = list.takeWhile is_gamma ++ list.dropWhile is_gamma := by + exact Eq.symm List.takeWhile_append_dropWhile + by_cases header_eq_full: list.takeWhile is_gamma = list +- . ++ · + have list_eq_gamma_m: ∃ m: ℤ, list.unattach.prod = γ ^ m := by + unfold is_gamma at header_eq_full + clear eq_split is_gamma is_gamma_prop hlist +@@ -400,21 +391,21 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + simp at header_eq_full + exact header_eq_full.1 + rw [List.takeWhile_cons_of_pos] at header_eq_full +- . ++ · + rw [List.cons_eq_cons] at header_eq_full + specialize ih header_eq_full.2 + obtain ⟨m, hm⟩ := ih + by_cases h_eq_gamma: h = γ +- . ++ · + use (m + 1) + simp [h_eq_gamma, hm] + exact mul_self_zpow γ m +- . use (-1 + m) ++ · use (-1 + m) + simp [h_eq_gamma] at h_gamma + simp [h_gamma, hm] + rw [← zpow_neg_one] + rw [zpow_add] +- . simp [h_gamma] ++ · simp [h_gamma] + + + have empty_prod_eq: list.unattach.prod = ([] : List E).unattach.prod := by +@@ -427,7 +418,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + simp [hlist] + + exact ⟨[], empty_prod_eq⟩ +- . ++ · + + have tail_nonempty: list.dropWhile is_gamma ≠ [] := by + rw [not_iff_not.mpr List.takeWhile_eq_self_iff] at header_eq_full +@@ -454,8 +445,6 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + rw [Set.mem_union] at drop_in_E + have not_in_left: (List.dropWhile is_gamma list)[0].val ∉ ({γ, γ⁻¹} : Set G) := by + simp [not_is_gamma_prop] +- +- -- TODO - why can't simp handle this? + have in_right := Or.resolve_left drop_in_E not_in_left + exact in_right + +@@ -507,13 +496,13 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + have gamma_copy_prod: gamma_copy.unattach.prod = γ^m := by + simp [gamma_copy] + by_cases m_ge: 0 ≤ m +- . ++ · + simp [m_ge] + rw [← zpow_natCast] + simp + rw [← abs_eq_self] at m_ge + rw [m_ge] +- . ++ · + simp [m_ge] + rw [← zpow_natCast] + simp +@@ -525,13 +514,13 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + have gamma_copy_inv_prod: gamma_copy_inv.unattach.prod = γ^(-m) := by + simp [gamma_copy_inv] + by_cases m_ge: 0 ≤ m +- . ++ · + simp [m_ge] + rw [← zpow_natCast] + simp + rw [← abs_eq_self] at m_ge + rw [m_ge] +- . ++ · + simp [m_ge] + rw [← zpow_natCast] + simp +@@ -546,9 +535,9 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + + have header_prod: (List.takeWhile is_gamma list).unattach.prod = γ^m := by + have my_lemma := take_count_sum_eq_exp (List.takeWhile is_gamma list) γ gamma_ne_inv ?_ +- . ++ · + rw [my_lemma] +- . ++ · + have foo (x: E) := List.mem_takeWhile_imp (p := fun (val: E) => (val = γ ∨ val = γ⁻¹)) (l := list) (x := x) + conv at foo => + intro x hx +@@ -569,7 +558,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + have dropwhile_not_nul : (List.dropWhile is_gamma list) ≠ [] := by + exact tail_nonempty + apply_fun (fun x => x * (List.dropWhile is_gamma list).unattach.prod⁻¹) +- . ++ · + simp + conv => + pattern _[0] +@@ -585,9 +574,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + have unattach_len_pos: 0 < (List.dropWhile is_gamma list).unattach.length := by + rw [List.length_unattach] + exact List.length_pos_iff.mpr dropwhile_not_nul +- +- -- TODO - this is gross, and should be removed +- letI : Inhabited G := { ++ let : Inhabited G := { + default := 1 + } + +@@ -604,10 +591,10 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + rw [list_tail_unattach] + + rw [List.headI_mul_tail_prod_of_ne_nil] +- . ++ · + simp + simp [header_prod] +- . ++ · + by_contra this + rw [List.eq_nil_iff_length_eq_zero] at this + rw [List.length_unattach] at this +@@ -615,7 +602,7 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + contradiction + + +- . exact mul_left_injective (List.dropWhile is_gamma list).unattach.prod⁻¹ ++ · exact mul_left_injective (List.dropWhile is_gamma list).unattach.prod⁻¹ + + have sublist_phi_zero: φ (gamma_copy ++ (List.dropWhile is_gamma list).tail).unattach.prod = 0 := by + rw [← mega_list_prod] at hlist +@@ -675,9 +662,9 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + | cons h t ih => + simp + split_ifs +- . omega +- . omega +- . omega ++ · omega ++ · omega ++ · omega + + let rewritten_sub_list := (rewrite_list (gamma_copy ++ (list.dropWhile is_gamma).tail) sublist_phi_zero) + let return_list := (⟨γ^m * (List.dropWhile is_gamma list)[0] * γ^(-m), in_range⟩) :: rewritten_sub_list.val +@@ -712,24 +699,24 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + decreasing_by { + simp + split_ifs +- . ++ · + simp + conv => + rhs + rw [← take_drop_len (p := fun (k: E) ↦ decide (↑k = γ) || decide (↑k = γ⁻¹))] + apply add_lt_add_of_le_of_lt +- . apply count_head_lt +- . simp [is_gamma] at dropwhile_len_gt ++ · apply count_head_lt ++ · simp [is_gamma] at dropwhile_len_gt + apply Nat.sub_one_lt + apply Nat.pos_iff_ne_zero.mp dropwhile_len_gt +- . ++ · + simp-- [count_gamma_copy] + conv => + rhs + rw [← take_drop_len (p := fun (k: E) ↦ decide (↑k = γ) || decide (↑k = γ⁻¹))] + apply add_lt_add_of_le_of_lt +- . apply count_head_lt +- . simp [is_gamma] at dropwhile_len_gt ++ · apply count_head_lt ++ · simp [is_gamma] at dropwhile_len_gt + apply Nat.sub_one_lt + apply Nat.pos_iff_ne_zero.mp dropwhile_len_gt + } +@@ -771,7 +758,6 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + + let my_res := rewrite_list ((z_list.filter (fun s ↦ !decide (s = 1))).attach.map (fun (g) => ⟨g.val, z_filter_mem_e g.val g.property⟩)) (by + simp +- -- TODO - there has to be a less awful way of doing this + conv => + arg 1 + arg 2 +@@ -783,8 +769,8 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + ext i q + simp + by_cases list_get: (List.filter (fun s ↦ !decide (s = 1)) z_list)[i]? = none +- . simp [list_get] +- . simp at list_get ++ · simp [list_get] ++ · simp at list_get + simp [list_get] + rw [← ofMul_list_prod] + rw [h_z_list.2] +@@ -800,12 +786,12 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + rw [Set.mem_image] + use my_res.val.unattach + refine ⟨?_, ?_⟩ +- . simp only [Set.mem_setOf_eq] ++ · simp only [Set.mem_ofPred_eq] + intro x hx + rw [List.mem_unattach] at hx + obtain ⟨x_prop, _⟩ := hx + exact x_prop +- . ++ · + rw [← my_res_prop] + conv => + pattern List.unattach _ +@@ -813,12 +799,13 @@ lemma three_two_gamma_m_generates (φ: (Additive G) →+ ℤ) (γ: G) (hγ: φ + ext i q + simp + by_cases list_get: (List.filter (fun s ↦ !decide (s = 1)) z_list)[i]? = none +- . simp [list_get] +- . simp at list_get ++ · simp [list_get] ++ · simp at list_get + simp [list_get] + exact h_z_list.2 + exact gamma_m_ker_phi + ++omit hGS in + lemma three_two_S_n_subset_ker {G: Type*} [Group G] [DecidableEq G] (S: Finset G) (φ: (Additive G) →+ ℤ) (γ: G) (phi_gamma: φ γ = 1) (n: ℕ): + ↑(three_two_S_n S φ γ n) ⊆ Additive.toMul '' φ.ker.carrier := by + +@@ -846,12 +833,12 @@ lemma three_two_S_n_subset_ker {G: Type*} [Group G] [DecidableEq G] (S: Finset G + simp + exact id (Eq.symm prod_eq_x) + +-lemma three_two_S_n_generates (d: ℕ) (hd: d >= 1) (hG: HasPolynomialGrowthD S d ) (φ: (Additive G) →+ ℤ) (γ : Additive G) (phi_gamma: φ γ = 1): ∃ n, AddSubgroup.closure (Additive.ofMul '' (three_two_S_n S φ γ (n))) = φ.ker := by ++lemma three_two_S_n_generates (d: ℕ) (_hd: d >= 1) (hG: HasPolynomialGrowthD S d ) (φ: (Additive G) →+ ℤ) (γ : Additive G) (phi_gamma: φ γ = 1): ∃ n, AddSubgroup.closure (Additive.ofMul '' (three_two_S_n S φ γ (n))) = φ.ker := by + obtain ⟨n, hn⟩ := three_poly_poly_growth_all_s_n d hG γ φ + use n + ext z + refine ⟨?_, ?_⟩ +- . intro hz ++ · intro hz + induction hz using AddSubgroup.closure_induction with + | mem x hx => + have x_mem: x ∈ three_two_S_n S φ γ n := by +@@ -867,7 +854,7 @@ lemma three_two_S_n_generates (d: ℕ) (hd: d >= 1) (hG: HasPolynomialGrowthD S + exact (AddSubgroup.add_mem_cancel_right φ.ker hz).mpr hy + | neg x x_mem hx => + exact AddSubgroup.neg_mem φ.ker hx +- . intro hz ++ · intro hz + have generates_ker := three_two_gamma_m_generates φ γ phi_gamma + + have hz' : z ∈ Subgroup.closure (Set.range (Function.uncurry (gamma_m_helper (S := S) φ γ))) := by +@@ -922,10 +909,10 @@ lemma three_two_ker_fg (d: ℕ) (hd: d >= 1) (hG: HasPolynomialGrowthD S d ) ( + use ofMul '' ↑(three_two_S_n S φ γ n) + refine ⟨hn, ?_⟩ + rw [Set.finite_image_iff] +- . ++ · + simp +- . intro a b hab +- simpa using hab ++ · intro a _ b _ hab ++ exact Additive.ofMul.injective hab + + + -- Extract a generatating set for the kernel of φ +@@ -941,8 +928,7 @@ lemma finite_virtually_nilpotent {G: Type*} [Group G] [Finite G]: Group.IsVirtua + rw [Group.IsVirtuallyNilpotent] + use ⊥ + refine ⟨?_, ?_⟩ +- . exact Group.isNilpotent_of_subsingleton +- -- TODO - prove that a finite group is nilpotent, and upstream to mathlib +- . infer_instance ++ · exact Group.isNilpotent_of_subsingleton ++ · infer_instance + + end GeneratesNS +diff --git a/Gromov/ThreeTwoGrowth.lean b/Gromov/ThreeTwoGrowth.lean +index 1fc3a86..5fd825b 100644 +--- a/Gromov/ThreeTwoGrowth.lean ++++ b/Gromov/ThreeTwoGrowth.lean +@@ -11,9 +11,6 @@ public import Gromov.Theorem31Input + + public section + +-set_option linter.style.longLine false +-set_option linter.style.cdot false +-set_option linter.style.commandStart false + + open Subgroup + open scoped Finset +@@ -28,9 +25,7 @@ include hGS + + open scoped RealInnerProductSpace + +-set_option synthInstance.maxHeartbeats 500000 + +-set_option maxHeartbeats 9000000 + + open MeasureTheory + +@@ -45,27 +40,27 @@ lemma take_count_sum_eq_exp {T: Type*} [ht: Group T] [heq: DecidableEq T] {E: Se + | cons h t ih => + simp [countElemOrInv] + by_cases h_eq_g: h = g +- . ++ · + simp [h_eq_g] + rw [ih] +- . rw [← zpow_one_add] +- . simp at hl ++ · rw [← zpow_one_add] ++ · simp at hl + intro val hval + have hl_right := hl.2 val (by simp) (by simp [hval]) + exact hl_right +- . ++ · + have h_eq_inv: h = g⁻¹ := by + specialize hl h + simp at hl + simp [h_eq_g] at hl + exact hl +- simp [h_eq_g, h_eq_inv] ++ simp [h_eq_inv] + rw [ih] +- . ++ · + rw [← zpow_neg_one] + rw [← zpow_add] + simp [hg.symm] +- . ++ · + simp at hl + intro val hval + have hl_right := hl.2 val (by simp) (by simp [hval]) +@@ -82,10 +77,10 @@ lemma list_filter_one {T: Type*} [DecidableEq T] [Group T] (l: List T): (l.filte + | cons h t ih => + simp + by_cases h_eq_one: h = 1 +- . ++ · + simp [h_eq_one] + exact ih +- . ++ · + rw [List.filter_cons] + simp [h_eq_one] + exact ih +@@ -119,11 +114,7 @@ omit hGS in + @[expose] + noncomputable def three_two_B_n {G: Type*} [Group G] [DecidableEq G] (S: Finset G) (φ: (Additive G) →+ ℤ) (γ: G) (n: ℕ): Finset G := Finset.image (fun l => l.unattach.prod) (list_len_n S φ γ n ) + +- +---set_option maxHeartbeats 600000 +- + -- If G has polynomial growth, than we can find an N such that S_n ⊆ B_n * B_n⁻¹ +-set_option maxHeartbeats 2000000 in + lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) (φ: (Additive G) →+ ℤ) (s: G) (s_mem: s ∈ S): ∃ n, three_two_S_n (S := {s}) φ γ (n + 1) ⊆ ((three_two_B_n (S := {s}) φ γ n) * (three_two_B_n (S := {s}) φ γ n)⁻¹) := by + by_contra! + simp [HasPolynomialGrowthD] at hG +@@ -163,7 +154,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + + have disjoint_smul (M: ℕ) (hM: N ≤ M) (p: G) (p_mem: p ∈ three_two_S_n (S := {s}) φ γ (M + 1)) (p_not_prod: p ∉ three_two_B_n (S := {s}) φ γ M * (three_two_B_n (S := {s}) φ γ M)⁻¹): (p • three_two_B_n (S := {s}) φ γ M) ∩ (three_two_B_n (S := {s}) φ γ M) = ∅ := by + rw [Finset.mem_mul.not] at p_not_prod +- push_neg at p_not_prod ++ push Not at p_not_prod + + ext a + simp only [Finset.mem_inter, Finset.notMem_empty, iff_false, not_and] +@@ -225,12 +216,12 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + exact s_n_subset M hM s.property + )⟩))) + refine ⟨?_, ?_⟩ +- . +- simp [list_len_n, list_mem] ++ · ++ simp [list_len_n] + simp [list_len_n] at list_mem + exact list_mem + +- . ++ · + simp + conv => + lhs +@@ -255,7 +246,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + + use (List.replicate m.natAbs m_list_choice).flatten ++ [⟨s, s_mem⟩] ++ (List.replicate (-(φ (ofMul s))).natAbs phi_list_choice).flatten ++ (List.replicate m.natAbs m_list_choice_inv).flatten + refine ⟨?_, ?_⟩ +- . ++ · + simp [phi_list_choice] + norm_cast + rw [← s_m_eq] +@@ -264,7 +255,6 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + rhs + arg 1 + arg 2 +- -- TODO - is there a tactic that can normalize the 'ofMul' stuff for us? + equals s * γ^(-(φ (ofMul s))) => + rw [← ofMul_zpow] + rw [← sub_eq_add_neg] +@@ -278,7 +268,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + simp + simp_rw [m_list_choice, m_list_choice_inv] + by_cases m_pos: 0 < m +- . ++ · + simp_rw [m_pos] + simp + have m_eq_abs : |m| = m := by +@@ -291,7 +281,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + rw [m_eq_abs] + group + by_cases phi_neg: (φ (ofMul s)) < 0 +- . ++ · + have phi_abs: |(φ (ofMul s))| = -φ (ofMul s) := by + rw [Int.abs_eq_natAbs] + omega +@@ -301,7 +291,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + rw [gamma_list_prod] + rw [m_eq_abs] + group +- . ++ · + have phi_abs: |(φ (ofMul s))| = φ (ofMul s) := by + rw [Int.abs_eq_natAbs] + omega +@@ -311,7 +301,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + rw [gamma_list_inv] + rw [m_eq_abs] + group +- . ++ · + simp_rw [m_pos] + simp + have neg_abs_m : |m| = - m := by +@@ -324,9 +314,8 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + group + rw [neg_abs_m] + group +- -- TODO - this can be deduplicated + by_cases phi_neg: (φ (ofMul s)) < 0 +- . ++ · + have phi_abs: |(φ (ofMul s))| = -φ (ofMul s) := by + rw [Int.abs_eq_natAbs] + omega +@@ -336,7 +325,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + rw [gamma_list_prod] + rw [neg_abs_m] + group +- . ++ · + have phi_abs: |(φ (ofMul s))| = φ (ofMul s) := by + rw [Int.abs_eq_natAbs] + omega +@@ -346,7 +335,7 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + rw [gamma_list_inv] + rw [neg_abs_m] + group +- . ++ · + + simp [m_list_choice, m_list_choice_inv] + simp_rw [apply_ite] +@@ -409,20 +398,19 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + simp [List.unattach, -List.map_subtype] + have my_spec := Exists.choose_spec ((s_n_bound M hM h h.property)) + have first_prop := my_spec.1 +- -- wtf + nth_rw 8 [← first_prop] + simp + + + have flat_list_len: nested_list.flatten.length ≤ nested_list.length • (4 * M^2) := by + simp +- have foo := List.sum_le_card_nsmul (l := (List.map List.length nested_list)) (4 * M^2) ?_ +- . ++ have foo := List.sum_le_length_nsmul (l := (List.map List.length nested_list)) (4 * M^2) ?_ ++ · + conv at foo => + rhs + simp + exact foo +- . ++ · + intro q hq + simp at hq + obtain ⟨s_list, h_s_prod, s_len⟩ := hq +@@ -443,8 +431,8 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + simp only [smul_eq_mul] at flat_list_len + have nested_list_le_n_squared: nested_list.flatten.length ≤ M * (4 * M^2) := by + apply le_mul_of_le_mul_right (b := l.length) +- . omega +- . omega ++ · omega ++ · omega + + + let filled_list := nested_list.flatten ++ (List.replicate ((M * (4 * M^2)) - nested_list.flatten.length) ⟨1, hGS.one_mem⟩) +@@ -484,8 +472,8 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + | base => + simp [three_two_B_n, list_len_n] + use [⟨(gamma_m_helper φ γ 0 ⟨s, s_mem⟩), ?_⟩] +- . simp [N] +- . ++ · simp [N] ++ · + simp [three_two_S_n] + use 0 + refine ⟨by omega, ?_⟩ +@@ -501,18 +489,18 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + + have union_subset_n_succ: three_two_B_n (S := {s}) φ γ k ∪ (p • three_two_B_n (S := {s}) φ γ k) ⊆ three_two_B_n (S := {s}) φ γ (k + 1) := by + apply Finset.union_subset +- . exact b_n_subset_b_n_succ k hk +- . exact smul_subset k hk p p_mem ++ · exact b_n_subset_b_n_succ k hk ++ · exact smul_subset k hk p p_mem + + + have card_le := Finset.card_le_card (union_subset_n_succ) + rw [Finset.card_union_of_disjoint ?_] at card_le +- . ++ · + simp at card_le + ring_nf at card_le + rw [add_comm] at card_le + omega +- . ++ · + specialize disjoint_smul k hk p p_mem p_not_prod + rw [Finset.inter_comm] at disjoint_smul + rw [Finset.disjoint_iff_inter_eq_empty] +@@ -577,13 +565,13 @@ lemma new_three_two_poly_growth (d: ℕ) (hG: HasPolynomialGrowthD S d ) (γ: G) + + have strict_lt: a * 4 ^ d * (↑M ^ 3) ^ d < (((2 : ℝ) ^ N)⁻¹ * 2 ^ M) := by + apply helper_lemma (b := 2⁻¹) +- . ++ · + field_simp + positivity +- . simp +- . simp +- . exact m_pow_lt +- . norm_num ++ · simp ++ · simp ++ · exact m_pow_lt ++ · norm_num + + + conv at strict_lt => +@@ -616,8 +604,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + exact S_nonempty + ) + use r +- intro m +- intro x hx ++ intro m x hx + simp [gamma_m_helper] at hx + simp [three_two_S_n, gamma_m_helper] + obtain ⟨s, hs, x_eq_conj⟩ := hx +@@ -640,10 +627,10 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + have my_iter := closure_iterate_mulact γ (e_i_regular_helper φ γ ⟨s, hs⟩) (n + 1) + simp [three_two_S_n, gamma_m_helper] at s_n_subset + have closure_eq := my_iter ?_ ?_ +- . ++ · + have x_mem_closure_range: x ∈ Subgroup.closure (Set.range fun (m : ℤ) ↦ γ ^ m * e_i_regular_helper φ γ ⟨s, hs⟩ * γ ^ (-m : ℤ)) := by + by_cases m_pos: 0 < m +- . ++ · + have m_eq_natabs: m = m.natAbs := by + omega + apply Subgroup.subset_closure +@@ -651,14 +638,14 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + use m.natAbs + rw [m_eq_natabs] at x_eq_conj + rw [← x_eq_conj] +- . ++ · + apply Subgroup.subset_closure + simp + use m + + rw [← closure_eq] at x_mem_closure_range + apply Subgroup.closure_mono (h := ((fun (m : ℤ) ↦ γ ^ m * e_i_regular_helper φ γ ⟨s, hs⟩ * γ ^ (-m : ℤ)) '' (Set.Ioo (-(r + 1) : ℤ) (r + 1 : ℤ)))) +- . ++ · + intro p hp + simp at hp + simp +@@ -669,7 +656,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + use hs + rw [gamma_m_helper, zpow_neg] + exact p_eq +- . ++ · + apply (Subgroup.closure_mono _) x_mem_closure_range + intro z hz + simp at hz +@@ -677,13 +664,13 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + obtain ⟨a, ⟨a_gt, a_lt⟩, z_eq⟩ := hz + use a + refine ⟨⟨?_, ?_⟩, z_eq⟩ +- . ++ · + norm_cast at a_gt + omega +- . ++ · + norm_cast at a_lt + omega +- . ++ · + specialize s_n_subset (n + 1) (by omega) (by omega) s rfl + simp [three_two_B_n] at s_n_subset + rw [Finset.mem_mul] at s_n_subset +@@ -694,7 +681,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + simp [e_i_regular_helper] + rw [← prod_vals_eq] + apply Subgroup.mul_mem +- . ++ · + simp at val_in_image + obtain ⟨list, hlist, list_prod_eq⟩ := val_in_image + rw [← list_prod_eq] +@@ -713,7 +700,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + simp [gamma_m_helper] at e_i_eq + obtain ⟨q, q_mem, e_i_eq'⟩ := e_i_eq + simp [e_i_regular_helper] +- . ++ · + simp at other_val_in_image + obtain ⟨list, hlist, list_prod_eq⟩ := other_val_in_image + apply_fun Inv.inv at list_prod_eq +@@ -735,8 +722,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + simp [gamma_m_helper] at e_i_eq + obtain ⟨q, q_mem, e_i_eq'⟩ := e_i_eq + simp [e_i_regular_helper] +- . +- -- TODO - 99% of this can be deduplicated ++ · + specialize s_n_subset (-(n + 1)) (by omega) (by omega) s rfl + -- Deduplicate verything after here + simp [three_two_B_n] at s_n_subset +@@ -749,7 +735,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + simp [e_i_regular_helper] + rw [← prod_vals_eq] + apply Subgroup.mul_mem +- . ++ · + simp at val_in_image + obtain ⟨list, hlist, list_prod_eq⟩ := val_in_image + rw [← list_prod_eq] +@@ -768,7 +754,7 @@ lemma three_poly_poly_growth_all_s_n (d: ℕ) (hG: HasPolynomialGrowthD S d ) ( + simp [gamma_m_helper] at e_i_eq + obtain ⟨q, q_mem, e_i_eq'⟩ := e_i_eq + simp [e_i_regular_helper] +- . ++ · + simp at other_val_in_image + obtain ⟨list, hlist, list_prod_eq⟩ := other_val_in_image + apply_fun Inv.inv at list_prod_eq +diff --git a/Gromov/ToMathlib/Analysis/Matrix/StarNormalEigen.lean b/Gromov/ToMathlib/Analysis/Matrix/StarNormalEigen.lean +index a6918d7..5dbc2a0 100644 +--- a/Gromov/ToMathlib/Analysis/Matrix/StarNormalEigen.lean ++++ b/Gromov/ToMathlib/Analysis/Matrix/StarNormalEigen.lean +@@ -146,28 +146,33 @@ lemma star_normal_maxGenEigenspace_eq_eigenspace {A: Type*} [NormedAddCommGroup + f.maxGenEigenspace k = f.eigenspace k := by + apply le_antisymm; + · intro x hx +- aesop; ++ obtain ⟨w, hw⟩ := (Module.End.mem_maxGenEigenspace f k x).mp hx + -- Since $f$ is star-normal, we have $\ker((f - kI)^2) = \ker(f - kI)$. + have h_ker_sq_eq_ker : LinearMap.ker ((f - k • 1) ^ 2) = LinearMap.ker (f - k • 1) := by + apply IsStarNormal.ker_sq_eq_ker; + -- Since $f$ is star-normal, we have $f * star f = star f * f$. Therefore, $(f - k • 1) * star (f - k • 1) = star (f - k • 1) * (f - k • 1)$. + have h_star_normal : (f - k • 1) * star (f - k • 1) = star (f - k • 1) * (f - k • 1) := by +- simp_all +decide [ sub_mul, mul_sub, smul_sub, sub_smul ]; +- simp_all +decide [ sub_eq_iff_eq_add, IsStarNormal, smul_smul ]; ++ simp_all +decide [ sub_mul, mul_sub, smul_sub ]; ++ simp_all +decide [ sub_eq_iff_eq_add, smul_smul ]; + simp_all +decide [ mul_comm, sub_eq_add_neg, add_assoc, add_left_comm, add_comm ]; + exact Eq.symm (star_comm_self' f); + exact (isStarNormal_iff (f - k • 1)).mpr (id (Eq.symm h_star_normal)); + -- By induction on $w$, we can show that $\ker((f - kI)^w) = \ker(f - kI)$ for all $w \geq 1$. + have h_ker_pow_eq_ker : ∀ w ≥ 1, LinearMap.ker ((f - k • 1) ^ w) = LinearMap.ker (f - k • 1) := by + intro w hw +- induction' w, Nat.succ_le.mpr hw using Nat.le_induction with w hw ih; ++ induction' w, Nat.succ_le_iff.mpr hw using Nat.le_induction with w hw ih; + · simp +decide; +- · simp_all +decide [ pow_succ, LinearMap.ker_comp ]; ++ · simp_all +decide [ pow_succ ]; + simp_all +decide [ SetLike.ext_iff, LinearMap.mem_ker ]; +- intro x; specialize ih ( f x - k • x ) ; simp_all +decide [ sub_eq_iff_eq_add, pow_succ, mul_sub, sub_mul ] ; +- by_cases hw : 1 ≤ w <;> aesop; +- replace h_ker_pow_eq_ker := SetLike.ext_iff.mp ( h_ker_pow_eq_ker w hw ) x; aesop; +- exact eq_of_sub_eq_zero h_ker_pow_eq_ker; ++ intro x; specialize ih ( f x - k • x ) ; simp_all +decide [ sub_eq_iff_eq_add ] ; ++ by_cases hw' : 1 ≤ w ++ · have hxker : x ∈ LinearMap.ker ((f - k • 1) ^ w) := hw ++ rw [h_ker_pow_eq_ker w hw'] at hxker ++ simpa only [Module.End.eigenspace_def] using hxker ++ · have hw0 : w = 0 := by omega ++ subst w ++ simp only [pow_zero, Module.End.one_apply] at hw ++ subst x ++ exact (f.eigenspace k).zero_mem + · exact Module.End.eigenspace_le_maxGenEigenspace + +-#print axioms star_normal_maxGenEigenspace_eq_eigenspace +diff --git a/Gromov/ToMathlib/Analysis/Matrix/Unitary.lean b/Gromov/ToMathlib/Analysis/Matrix/Unitary.lean +index fad106a..4cbb9ee 100644 +--- a/Gromov/ToMathlib/Analysis/Matrix/Unitary.lean ++++ b/Gromov/ToMathlib/Analysis/Matrix/Unitary.lean +@@ -12,14 +12,296 @@ direct sum of the eigenspaces of that element. + + public section + ++/-- A norm-preserving finite-dimensional endomorphism has a unitary matrix. -/ ++private lemma matrix_unitary_of_norm_map {E : Type*} [NormedAddCommGroup E] ++ [InnerProductSpace ℂ E] [FiniteDimensional ℂ E] {ι : Type*} ++ [Fintype ι] [DecidableEq ι] (b : OrthonormalBasis ι ℂ E) ++ (f : E →ₗ[ℂ] E) (hf : ∀ x, ‖f x‖ = ‖x‖) : ++ LinearMap.toMatrixOrthonormal b f ∈ Matrix.unitaryGroup ι ℂ := by ++ let i : E →ₗᵢ[ℂ] E := { toLinearMap := f, norm_map' := hf } ++ let e := LinearIsometryEquiv.ofSurjective i ++ ((LinearMap.injective_iff_surjective).mp i.injective) ++ exact e.toMatrix_mem_unitaryGroup b b ++ ++private lemma adjoint_comp_self_of_norm_map {E F : Type*} ++ [NormedAddCommGroup E] [InnerProductSpace ℂ E] [FiniteDimensional ℂ E] ++ [NormedAddCommGroup F] [InnerProductSpace ℂ F] [FiniteDimensional ℂ F] ++ (f : E →ₗ[ℂ] F) (hf : ∀ x, ‖f x‖ = ‖x‖) : ++ (LinearMap.adjoint f).comp f = 1 := by ++ apply LinearMap.ext ++ intro x ++ apply ext_inner_right ℂ ++ intro y ++ simp only [LinearMap.comp_apply, Module.End.one_apply, LinearMap.adjoint_inner_left] ++ exact (LinearMap.norm_map_iff_inner_map_map f).mp hf x y ++ ++/-- Restriction to two orthogonal invariant summands splits the unitary centralizer. -/ ++private lemma unitary_centralizer_blocks {n : ℕ} ++ (g : Matrix.unitaryGroup (Fin n) ℂ) ++ (p q : Submodule ℂ (EuclideanSpace ℂ (Fin n))) ++ (hcomp : IsCompl p q) (horth : p ⟂ q) ++ (hp : ∀ h : Subgroup.centralizer {g}, ++ Set.MapsTo h.val.val.toEuclideanLin p p) ++ (hq : ∀ h : Subgroup.centralizer {g}, ++ Set.MapsTo h.val.val.toEuclideanLin q q) ++ (hgp : Set.MapsTo g.val.toEuclideanLin p p) ++ (hqg : Set.MapsTo g.val.toEuclideanLin q q) : ++ ∃ (A : Subgroup (Matrix.unitaryGroup (Fin (Module.finrank ℂ p)) ℂ)) ++ (B : Subgroup (Matrix.unitaryGroup (Fin (Module.finrank ℂ q)) ℂ)), ++ Nonempty (Subgroup.centralizer {g} ≃* A × B) := by ++ have comm_g_h (h : Subgroup.centralizer {g}) : ++ Commute g.val.toEuclideanLin h.val.val.toEuclideanLin := by ++ have hh := h.property ++ rw [Subgroup.mem_centralizer_iff] at hh ++ have hg : g * h.val = h.val * g := hh g (by simp) ++ apply_fun (fun x => Matrix.toEuclideanLin x.val) at hg ++ rw [commute_iff_eq] ++ simpa only [Submonoid.coe_mul, Matrix.toEuclideanLin, Matrix.toLpLin_mul_same, ++ Module.End.mul_eq_comp] using hg ++ let map_first (h : Subgroup.centralizer {g}) := ++ h.val.val.toEuclideanLin.restrict (hp h) ++ ++ ++ let d := (Module.finrank ℂ ↥p) ++ let map_first_unitary (h: Subgroup.centralizer {g}): Matrix.unitaryGroup (Fin d) ℂ := { ++ val := LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥p) (map_first h) ++ property := by ++ apply matrix_unitary_of_norm_map ++ intro x ++ exact unitary_preserves_norm n h.val x.val ++ } ++ ++ ++ let map_first_hom: MonoidHom (Subgroup.centralizer {g}) _ := { ++ toFun := map_first_unitary ++ map_one' := by ++ have h_one : map_first 1 = 1 := by ++ apply LinearMap.ext ++ intro x ++ apply Subtype.ext ++ change Matrix.toEuclideanLin (1 : Matrix (Fin n) (Fin n) ℂ) x.val = x.val ++ simp [Matrix.toEuclideanLin_eq_toLin_orthonormal] ++ apply Subtype.ext ++ exact (congrArg (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥p)) h_one).trans (map_one _) ++ map_mul' := by ++ intro x y ++ have h_mul : map_first (x * y) = map_first x * map_first y := by ++ apply LinearMap.ext ++ intro z ++ apply Subtype.ext ++ change Matrix.toEuclideanLin (x.val.val * y.val.val) z.val = ++ Matrix.toEuclideanLin x.val.val (Matrix.toEuclideanLin y.val.val z.val) ++ simp only [Matrix.toEuclideanLin, Matrix.toLpLin_mul_same, LinearMap.comp_apply] ++ apply Subtype.ext ++ exact (congrArg (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥p)) h_mul).trans ++ (map_mul _ _ _) ++ } ++ ++ let first_range := map_first_hom.range ++ ++ ++ let map_second (h : Subgroup.centralizer {g}) := ++ h.val.val.toEuclideanLin.restrict (hq h) ++ ++ ++ let map_second_unitary (h: Subgroup.centralizer {g}): Matrix.unitaryGroup _ ℂ := { ++ val := LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥q) (map_second h) ++ property := by ++ apply matrix_unitary_of_norm_map ++ intro x ++ exact unitary_preserves_norm n h.val x.val ++ } ++ ++ let map_second_hom: MonoidHom (Subgroup.centralizer {g}) _ := { ++ toFun := map_second_unitary ++ -- TODO - deduplicate these with 'map_first_hom' ++ map_one' := by ++ have h_one : map_second 1 = 1 := by ++ apply LinearMap.ext ++ intro x ++ apply Subtype.ext ++ change Matrix.toEuclideanLin (1 : Matrix (Fin n) (Fin n) ℂ) x.val = x.val ++ simp [Matrix.toEuclideanLin_eq_toLin_orthonormal] ++ apply Subtype.ext ++ exact (congrArg (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥q)) h_one).trans (map_one _) ++ map_mul' := by ++ intro x y ++ have h_mul : map_second (x * y) = map_second x * map_second y := by ++ apply LinearMap.ext ++ intro z ++ apply Subtype.ext ++ change Matrix.toEuclideanLin (x.val.val * y.val.val) z.val = ++ Matrix.toEuclideanLin x.val.val (Matrix.toEuclideanLin y.val.val z.val) ++ simp only [Matrix.toEuclideanLin, Matrix.toLpLin_mul_same, LinearMap.comp_apply] ++ apply Subtype.ext ++ exact (congrArg (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥q)) h_mul).trans ++ (map_mul _ _ _) ++ } ++ ++ let prod_hom := MonoidHom.prod map_first_hom.rangeRestrict map_second_hom.rangeRestrict ++ let prod_iso := MulEquiv.ofBijective prod_hom (by ++ unfold Function.Bijective ++ refine ⟨?_, ?_⟩ ++ . ++ intro x y hxy ++ have hfirst : map_first_hom x = map_first_hom y := ++ congrArg (fun z => z.1.val) hxy ++ have hsecond : map_second_hom x = map_second_hom y := ++ congrArg (fun z => z.2.val) hxy ++ have hfirst' : map_first x = map_first y := ++ (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥p)).injective ++ (congrArg Subtype.val hfirst) ++ have hsecond' : map_second x = map_second y := ++ (LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥q)).injective ++ (congrArg Subtype.val hsecond) ++ apply Subtype.ext ++ apply Subtype.ext ++ apply Matrix.toEuclideanLin.injective ++ apply LinearMap.ext ++ intro z ++ obtain ⟨zp, zq, hz, _⟩ := Submodule.existsUnique_add_of_isCompl hcomp z ++ rw [← hz, map_add, map_add] ++ exact congrArg₂ (· + ·) ++ (congrArg Subtype.val (DFunLike.congr_fun hfirst' zp)) ++ (congrArg Subtype.val (DFunLike.congr_fun hsecond' zq)) ++ . ++ intro a ++ have first_prop := a.fst.property ++ have second_prop := a.snd.property ++ simp only [prod_hom] ++ rw [MonoidHom.mem_range] at first_prop ++ rw [MonoidHom.mem_range] at second_prop ++ ++ obtain ⟨x, hx⟩ := first_prop ++ obtain ⟨y, hy⟩ := second_prop ++ ++ let map_first_x_new: p →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { ++ toFun := fun a => map_first x a ++ map_add' := by simp ++ map_smul' := by simp ++ } ++ ++ let map_second_y_new: ↑q →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { ++ toFun := fun a => map_second y a ++ map_add' := by simp ++ map_smul' := by simp ++ } ++ ++ have map_first_x_unitary : ++ (ContinuousLinearMap.adjoint (𝕜 := ℂ) (E := p) ++ (F := EuclideanSpace ℂ (Fin n)) map_first_x_new.toContinuousLinearMap).comp ++ map_first_x_new.toContinuousLinearMap = 1 := by ++ rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] ++ intro z ++ exact unitary_preserves_norm n x.val z.val ++ apply_fun (fun f => f.toLinearMap) at map_first_x_unitary ++ simp at map_first_x_unitary ++ have map_second_y_unitary : ++ (ContinuousLinearMap.adjoint (𝕜 := ℂ) (E := q) ++ (F := EuclideanSpace ℂ (Fin n)) map_second_y_new.toContinuousLinearMap).comp ++ map_second_y_new.toContinuousLinearMap = 1 := by ++ rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] ++ intro z ++ exact unitary_preserves_norm n y.val z.val ++ apply_fun (fun f => f.toLinearMap) at map_second_y_unitary ++ simp at map_second_y_unitary ++ ++ let new := LinearMap.ofIsCompl hcomp map_first_x_new map_second_y_new ++ use ⟨⟨(Matrix.toEuclideanLin.symm new), (by ++ simp [Matrix.mem_unitaryGroup_iff'] ++ apply_fun (fun f => Matrix.toEuclideanLin f) ++ . simp [-EmbeddingLike.apply_eq_iff_eq, new] ++ rw [Matrix.star_eq_conjTranspose] ++ simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] ++ simp ++ rw [← LinearMap.toMatrix_adjoint] ++ simp ++ ++ ++ conv => ++ rhs ++ equals 1 => ++ ext z ++ simp ++ ++ ++ apply ofIsCompl_adjoint_comp ++ . exact horth ++ . ++ apply map_first_x_unitary ++ . intro v ++ exact (map_first x v).2 ++ . ++ apply map_second_y_unitary ++ . intro v ++ exact (map_second y v).2 ++ . intro x y hxy ++ simpa using hxy ++ )⟩, (by ++ rw [Subgroup.mem_centralizer_iff] ++ simp ++ apply_fun (fun f => Matrix.toEuclideanLin f.val) ++ simp only [] ++ simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] ++ simp only [Matrix.toLin_symm, Submonoid.coe_mul] ++ rw [Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun (Fin n) ℂ).toBasis )] ++ simp ++ rw [Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun (Fin n) ℂ).toBasis )] ++ simp [new] ++ rw [eq_comm] ++ apply ofIsCompl_commute ++ . intro z ++ change x.val.val.toEuclideanLin (g.val.toEuclideanLin z.val) = ++ g.val.toEuclideanLin (x.val.val.toEuclideanLin z.val) ++ exact DFunLike.congr_fun (comm_g_h x).eq.symm z.val ++ . intro z ++ change y.val.val.toEuclideanLin (g.val.toEuclideanLin z.val) = ++ g.val.toEuclideanLin (y.val.val.toEuclideanLin z.val) ++ exact DFunLike.congr_fun (comm_g_h y).eq.symm z.val ++ . exact fun z => hgp z.property ++ . exact fun z => hqg z.property ++ . intro a b hab ++ simpa using hab ++ ++ )⟩ ++ ++ ++ apply Prod.ext ++ . ++ rw [Subtype.ext_iff] ++ conv => ++ rhs ++ rw [← hx] ++ simp ++ simp [map_first_hom, map_first_unitary] ++ apply LinearMap.ext ++ intro z ++ apply Subtype.ext ++ simp only [LinearMap.coe_restrict_apply, new, LinearEquiv.apply_symm_apply, ++ LinearMap.ofIsCompl_apply_left, map_first_x_new, map_first, LinearMap.coe_mk, ++ AddHom.coe_mk] ++ . ++ rw [Subtype.ext_iff] ++ conv => ++ rhs ++ rw [← hy] ++ simp ++ simp [map_second_hom, map_second_unitary] ++ simp [map_second] ++ rw [LinearMap.ext_iff] ++ intro z ++ rw [Subtype.ext_iff] ++ simp [new] ++ simp [map_second_y_new, map_second] ++ ) ++ exact ⟨map_first_hom.range, map_second_hom.range, ⟨prod_iso⟩⟩ ++ + -- The rewrites below name their scalar field, source and target explicitly. Left implicit, + -- each would leave a metavariable whose instances sit across a diamond on these spaces + -- (`Submodule`'s subtype/`addCommGroup`/`module` vs the `NormedAddCommGroup`/ + -- `InnerProductSpace` structures), which only reconciles at a raised `maxSynthPendingDepth`. + -- Note the two rewrites in each block act on *different* spaces: the restricted eigenspace + -- and the ambient `EuclideanSpace ℂ (Fin n)`. +-set_option maxHeartbeats 4000000 in +-set_option synthInstance.maxHeartbeats 100000 in + lemma centralizer_iso {n: ℕ} [hn: NeZero n] (G: Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) (g: G) (g_not: ∀ z: ℂ, g.val.val ≠ z • 1): + Nonempty (IsoData g) := by + +@@ -84,562 +366,34 @@ lemma centralizer_iso {n: ℕ} [hn: NeZero n] (G: Subgroup (Matrix.unitaryGroup + --simp_rw [Module.End.mem_invtSubmodule_iff_forall_mem_of_mem] at other_invariant + + +- let map_first (h: Subgroup.centralizer {g.val}) := h.val.val.toEuclideanLin.restrict (Module.End.mapsTo_genEigenspace_of_comm (f := g.val.val.toEuclideanLin) (g := h.val.val.toEuclideanLin) (by +- apply comm_g_h +- ) k ⊤) +- +- +- let d := (Module.finrank ℂ ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤)) +- let map_first_unitary (h: Subgroup.centralizer {g.val}): Matrix.unitaryGroup (Fin d) ℂ := { +- val := LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤)) (map_first h) +- property := by +- +- +- rw [Matrix.mem_unitaryGroup_iff'] +- +- conv => +- lhs +- lhs +- -- TODO - why does this timeout when not inside 'conv'? +- rw [Matrix.star_eq_conjTranspose] +- +- simp only [LinearMap.toMatrixOrthonormal_apply] +- simp [] +- conv => +- lhs +- lhs +- -- TODO - why does this timeout when not inside 'conv'? +- rw [← LinearMap.toMatrix_adjoint] +- arg 2 +- rw [← LinearMap.toMatrix_mul] +- +- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis +- rw [Matrix.toLin_toMatrix] +- rw [Matrix.toLin_one] +- conv => +- rhs +- equals 1 => +- ext a +- simp +- +- simp [map_first] +- have h_unitary := Unitary.star_mul_self_of_mem h.val.property +- apply_fun Matrix.toEuclideanLin at h_unitary +- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] at h_unitary +- conv at h_unitary => +- lhs +- equals (Matrix.toEuclideanLin (star h.val.val)) ∘ₗ (Matrix.toEuclideanLin (h.val.val)) => +- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- rw [← Matrix.toLin_mul] +- rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] at h_unitary +- rw [Matrix.star_eq_conjTranspose] at h_unitary +- rw [Matrix.toEuclideanLin_conjTranspose_eq_adjoint] at h_unitary +- conv at h_unitary => +- rhs +- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- equals 1 => +- ext z +- simp +- +- apply_fun (fun f => LinearMap.toContinuousLinearMap f) +- simp [-EmbeddingLike.apply_eq_iff_eq] +- conv => +- lhs +- rw [Module.End.mul_eq_comp] +- rw [linearmap_comp_toContinuousLinearMap] +- rw [ContinuousLinearMap.mul_def] +- lhs +- rw [LinearMap.adjoint_toContinuousLinearMap (𝕜 := ℂ) (E := ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤)) (F := ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤))] +- +- conv => +- rhs +- equals 1 => +- ext z +- simp +- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] +- simp only [LinearMap.coe_toContinuousLinearMap'] +- conv => +- intro x +- rw [LinearMap.restrict_apply (by +- apply Module.End.mapsTo_genEigenspace_of_comm (by +- apply comm_g_h +- ) +- )] +- simp +- rw [← LinearMap.coe_toContinuousLinearMap'] +- +- +- apply_fun (fun f => LinearMap.toContinuousLinearMap f) at h_unitary +- simp [-EmbeddingLike.apply_eq_iff_eq] at h_unitary +- conv at h_unitary => +- lhs +- rw [linearmap_comp_toContinuousLinearMap] +- rw [ContinuousLinearMap.mul_def] +- lhs +- rw [LinearMap.adjoint_toContinuousLinearMap (𝕜 := ℂ) (E := EuclideanSpace ℂ (Fin n)) (F := EuclideanSpace ℂ (Fin n))] +- +- conv at h_unitary => +- rhs +- equals 1 => +- ext x +- simp +- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] at h_unitary ++ let d := Module.finrank ℂ ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤) ++ have horth : (Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤ ⟂ ++ (⨆ i : ℂ, ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i) := by ++ change Module.End.maxGenEigenspace _ k ⟂ _ ++ rw [star_normal_maxGenEigenspace_eq_eigenspace (by simp)] ++ conv => ++ rhs ++ arg 1 + intro x +- specialize h_unitary x.val +- exact h_unitary +- . exact LinearEquiv.injective LinearMap.toContinuousLinearMap +- . intro x y hxy +- simpa using hxy +- } +- +- +- let map_first_hom: MonoidHom (Subgroup.centralizer {g.val}) _ := { +- toFun := map_first_unitary +- map_one' := by +- simp [map_first_unitary, map_first] +- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis +- . +- simp +- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- ext a +- rfl +- . intro x y hxy +- simpa using hxy +- map_mul' := by +- intro x y +- simp [map_first_unitary, map_first] +- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis +- . +- simp +- rw [LinearMap.ext_iff] +- intro a +- rw [← LinearMap.toMatrix_mul] +- simp +- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- conv => +- lhs +- arg 1 +- arg 1 +- -- TODO - figure out why toLin_mul doesn't work here +- equals ((Matrix.toLin (EuclideanSpace.basisFun (Fin n) ℂ).toBasis (EuclideanSpace.basisFun (Fin n) ℂ).toBasis) (↑↑↑x)) ∘ₗ (((Matrix.toLin (EuclideanSpace.basisFun (Fin n) ℂ).toBasis (EuclideanSpace.basisFun (Fin n) ℂ).toBasis) (↑↑↑y))) => +- rw [← Matrix.toLin_mul] +- +- rfl +- . intro x y hxy +- simpa using hxy +- } +- +- let first_range := map_first_hom.range +- +- +- let map_second (h: Subgroup.centralizer {g.val}) := h.val.val.toEuclideanLin.restrict +- (p := ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) +- (q := ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) ++ arg 1 ++ intro x ++ rw [star_normal_maxGenEigenspace_eq_eigenspace (by simp)] ++ simp ++ intro i hi ++ apply eigenspace_orthogonal ++ · simp ++ · omega ++ obtain ⟨A, B, ⟨prod_iso⟩⟩ := unitary_centralizer_blocks g.val _ _ a_b_compl horth ++ (fun h => Module.End.mapsTo_genEigenspace_of_comm (comm_g_h h) k ⊤) ++ (fun h => by ++ apply LinearMap.mapsTo_biSup_of_mapsTo ++ intro i ++ exact Module.End.mapsTo_maxGenEigenspace_of_comm (comm_g_h h) i) ++ (Module.End.mapsTo_genEigenspace_of_comm (by simp) k ⊤) + (by +- intro x hx + apply LinearMap.mapsTo_biSup_of_mapsTo +- . +- intro z +- apply Module.End.mapsTo_maxGenEigenspace_of_comm +- apply comm_g_h +- . exact hx +- ) +- +- +- let map_second_unitary (h: Subgroup.centralizer {g.val}): Matrix.unitaryGroup _ ℂ := { +- val := LinearMap.toMatrixOrthonormal (stdOrthonormalBasis ℂ ↥((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) (map_second h) +- property := by +- -- TODO - deduplicate this with 'map_first_unitary' +- rw [Matrix.mem_unitaryGroup_iff'] +- +- conv => +- lhs +- lhs +- -- TODO - why does this timeout when not inside 'conv'? +- rw [Matrix.star_eq_conjTranspose] +- +- simp only [LinearMap.toMatrixOrthonormal_apply] +- simp [] +- conv => +- lhs +- lhs +- -- TODO - why does this timeout when not inside 'conv'? +- rw [← LinearMap.toMatrix_adjoint] +- arg 2 +- rw [← LinearMap.toMatrix_mul] +- +- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis +- rw [Matrix.toLin_toMatrix] +- rw [Matrix.toLin_one] +- conv => +- rhs +- equals 1 => +- ext a +- simp +- +- simp [map_second] +- have h_unitary := Unitary.star_mul_self_of_mem h.val.property +- apply_fun Matrix.toEuclideanLin at h_unitary +- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] at h_unitary +- conv at h_unitary => +- lhs +- equals (Matrix.toEuclideanLin (star h.val.val)) ∘ₗ (Matrix.toEuclideanLin (h.val.val)) => +- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- rw [← Matrix.toLin_mul] +- rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] at h_unitary +- rw [Matrix.star_eq_conjTranspose] at h_unitary +- rw [Matrix.toEuclideanLin_conjTranspose_eq_adjoint] at h_unitary +- conv at h_unitary => +- rhs +- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- equals 1 => +- ext z +- simp +- +- apply_fun (fun f => LinearMap.toContinuousLinearMap f) +- simp [-EmbeddingLike.apply_eq_iff_eq] +- conv => +- lhs +- rw [Module.End.mul_eq_comp] +- rw [linearmap_comp_toContinuousLinearMap] +- rw [ContinuousLinearMap.mul_def] +- lhs +- rw [LinearMap.adjoint_toContinuousLinearMap (𝕜 := ℂ) (E := ↥((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) (F := ↥((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i)))] +- +- conv => +- rhs +- equals 1 => +- ext z +- simp +- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] +- simp only [LinearMap.coe_toContinuousLinearMap'] +- conv => +- intro x +- rw [LinearMap.restrict_apply (by +- apply LinearMap.mapsTo_biSup_of_mapsTo +- intro z +- apply Module.End.mapsTo_maxGenEigenspace_of_comm +- apply comm_g_h +- )] +- simp +- rw [← LinearMap.coe_toContinuousLinearMap'] +- +- +- apply_fun (fun f => LinearMap.toContinuousLinearMap f) at h_unitary +- simp [-EmbeddingLike.apply_eq_iff_eq] at h_unitary +- conv at h_unitary => +- lhs +- rw [linearmap_comp_toContinuousLinearMap] +- rw [ContinuousLinearMap.mul_def] +- lhs +- rw [LinearMap.adjoint_toContinuousLinearMap (𝕜 := ℂ) (E := EuclideanSpace ℂ (Fin n)) (F := EuclideanSpace ℂ (Fin n))] +- +- conv at h_unitary => +- rhs +- equals 1 => +- ext x +- simp +- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] at h_unitary +- intro x +- specialize h_unitary x.val +- exact h_unitary +- . exact LinearEquiv.injective LinearMap.toContinuousLinearMap +- . intro x y hxy +- simpa using hxy +- } +- +- let map_second_hom: MonoidHom (Subgroup.centralizer {g.val}) _ := { +- toFun := map_second_unitary +- -- TODO - deduplicate these with 'map_first_hom' +- map_one' := by +- simp [map_second_unitary, map_second] +- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis +- . +- simp +- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- ext a +- rfl +- . intro x y hxy +- simpa using hxy +- map_mul' := by +- intro x y +- simp [map_second_unitary, map_second] +- apply_fun Matrix.toLin (stdOrthonormalBasis ℂ _).toBasis (stdOrthonormalBasis ℂ _).toBasis +- . +- simp +- rw [LinearMap.ext_iff] +- intro a +- rw [← LinearMap.toMatrix_mul] +- simp +- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- conv => +- lhs +- arg 1 +- arg 1 +- -- TODO - figure out why toLin_mul doesn't work here +- equals ((Matrix.toLin (EuclideanSpace.basisFun (Fin n) ℂ).toBasis (EuclideanSpace.basisFun (Fin n) ℂ).toBasis) (↑↑↑x)) ∘ₗ (((Matrix.toLin (EuclideanSpace.basisFun (Fin n) ℂ).toBasis (EuclideanSpace.basisFun (Fin n) ℂ).toBasis) (↑↑↑y))) => +- rw [← Matrix.toLin_mul] +- +- rfl +- . intro x y hxy +- simpa using hxy +- } +- +- let prod_hom := MonoidHom.prod map_first_hom.rangeRestrict map_second_hom.rangeRestrict +- let prod_iso := MulEquiv.ofBijective prod_hom (by +- unfold Function.Bijective +- refine ⟨?_, ?_⟩ +- . +- -- TODO - this can probably be much simpler +- simp [prod_hom] +- intro x y hxy +- simp at hxy +- obtain ⟨first_eq, second_eq⟩ := hxy +- +- let map_first_x_new: ((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { +- toFun := fun a => map_first x a +- map_add' := by simp +- map_smul' := by simp +- } +- +- let map_second_x_new: ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i)) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { +- toFun := fun a => map_second x a +- map_add' := by simp +- map_smul' := by simp +- } +- +- let x_map := LinearMap.ofIsCompl a_b_compl (map_first_x_new) (map_second_x_new) +- +- let map_first_y_new: ((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { +- toFun := fun a => map_first y a +- map_add' := by simp +- map_smul' := by simp +- } +- +- let map_second_y_new: ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i)) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { +- toFun := fun a => map_second y a +- map_add' := by simp +- map_smul' := by simp +- } +- +- let y_map := LinearMap.ofIsCompl a_b_compl (map_first_y_new) (map_second_y_new) +- +- have first_eq_second: x_map = y_map := by +- simp [x_map] +- apply LinearMap.ofIsCompl_eq +- . intro z +- simp [y_map] +- simp [map_first_x_new, map_first_y_new] +- apply_fun (fun f => f.val) at first_eq +- simp at first_eq +- simp [map_first_hom, map_first_unitary] at first_eq +- rw [first_eq] +- . intro z +- simp [y_map] +- simp [map_second_x_new, map_second_y_new] +- apply_fun (fun f => f.val) at second_eq +- simp at second_eq +- simp [map_second_hom, map_second_unitary] at second_eq +- congr +- +- +- have x_map_eq: x_map = x.val.val.toEuclideanLin := by +- simp [x_map] +- apply LinearMap.ofIsCompl_eq +- . intro z +- rfl +- . intro z +- rfl +- +- have y_map_eq: y_map = y.val.val.toEuclideanLin := by +- simp [y_map] +- apply LinearMap.ofIsCompl_eq +- . intro z +- rfl +- . intro z +- rfl +- +- +- rw [x_map_eq, y_map_eq] at first_eq_second +- simp at first_eq_second +- exact first_eq_second +- . +- intro a +- have first_prop := a.fst.property +- have second_prop := a.snd.property +- simp only [prod_hom] +- rw [MonoidHom.mem_range] at first_prop +- rw [MonoidHom.mem_range] at second_prop +- +- obtain ⟨x, hx⟩ := first_prop +- obtain ⟨y, hy⟩ := second_prop +- +- let map_first_x_new: ((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { +- toFun := fun a => map_first x a +- map_add' := by simp +- map_smul' := by simp +- } +- +- let map_second_y_new: ↑((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i)) →ₗ[ℂ] (EuclideanSpace ℂ (Fin n)) := { +- toFun := fun a => map_second y a +- map_add' := by simp +- map_smul' := by simp +- } +- +- have map_first_x_unitary: (ContinuousLinearMap.adjoint (𝕜 := ℂ) (E := ↥((Module.End.genEigenspace (Matrix.toEuclideanLin g.val.val) k) ⊤)) (F := EuclideanSpace ℂ (Fin n)) map_first_x_new.toContinuousLinearMap).comp map_first_x_new.toContinuousLinearMap = 1 := by +- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] +- intro z +- simp [map_first_x_new, map_first] +- apply unitary_preserves_norm +- +- apply_fun (fun f => f.toLinearMap) at map_first_x_unitary +- simp at map_first_x_unitary +- +- have map_second_y_unitary: (ContinuousLinearMap.adjoint (𝕜 := ℂ) (E := ↥((iSup fun (i : ℂ) ↦ ⨆ (_ : i ≠ k), Module.End.maxGenEigenspace (Matrix.toEuclideanLin g.val.val) i))) (F := EuclideanSpace ℂ (Fin n)) map_second_y_new.toContinuousLinearMap).comp map_second_y_new.toContinuousLinearMap = 1 := by +- rw [← ContinuousLinearMap.norm_map_iff_adjoint_comp_self] +- intro z +- simp [map_second_y_new, map_second] +- apply unitary_preserves_norm +- +- apply_fun (fun f => f.toLinearMap) at map_second_y_unitary +- simp at map_second_y_unitary +- +- let new := LinearMap.ofIsCompl a_b_compl map_first_x_new map_second_y_new +- use ⟨⟨(Matrix.toEuclideanLin.symm new), (by +- simp [Matrix.mem_unitaryGroup_iff'] +- apply_fun (fun f => Matrix.toEuclideanLin f) +- . simp [-EmbeddingLike.apply_eq_iff_eq, new] +- rw [Matrix.star_eq_conjTranspose] +- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- simp +- rw [← LinearMap.toMatrix_adjoint] +- simp +- +- +- conv => +- rhs +- equals 1 => +- ext z +- simp +- +- +- apply ofIsCompl_adjoint_comp +- . +- rw [star_normal_maxGenEigenspace_eq_eigenspace (by simp)] +- conv => +- rhs +- arg 1 +- intro x +- arg 1 +- intro x +- rw [star_normal_maxGenEigenspace_eq_eigenspace (by simp)] +- simp +- intro i hi +- apply eigenspace_orthogonal +- . simp +- . omega +- . +- apply map_first_x_unitary +- . intro v +- exact (map_first x v).2 +- . +- apply map_second_y_unitary +- . intro v +- exact (map_second y v).2 +- . intro x y hxy +- simpa using hxy +- )⟩, (by +- rw [Subgroup.mem_centralizer_iff] +- simp +- apply_fun (fun f => Matrix.toEuclideanLin f.val) +- simp only [] +- simp_rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- simp only [Matrix.toLin_symm, Submonoid.coe_mul] +- rw [Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun (Fin n) ℂ).toBasis )] +- simp +- rw [Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun (Fin n) ℂ).toBasis )] +- simp [new] +- rw [eq_comm] +- apply ofIsCompl_commute +- . +- intro z +- simp [map_first_x_new, map_first] +- simp_rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] +- have x_prop := x.property +- rw [Subgroup.mem_centralizer_iff] at x_prop +- simp at x_prop +- rw [Subtype.ext_iff] at x_prop +- simp at x_prop +- show (Matrix.toEuclideanLin (↑↑x : Matrix (Fin n) (Fin n) ℂ)) +- ((Matrix.toEuclideanLin (↑↑g : Matrix (Fin n) (Fin n) ℂ)) (↑z : EuclideanSpace ℂ (Fin n))) +- = (Matrix.toEuclideanLin (↑↑g : Matrix (Fin n) (Fin n) ℂ)) +- ((Matrix.toEuclideanLin (↑↑x : Matrix (Fin n) (Fin n) ℂ)) (↑z : EuclideanSpace ℂ (Fin n))) +- simp only [Matrix.toEuclideanLin_apply, WithLp.ofLp_toLp, Matrix.mulVec_mulVec] +- rw [x_prop] +- . +- intro z +- simp [map_second_y_new, map_second] +- simp_rw [← Matrix.toEuclideanLin_eq_toLin_orthonormal] +- rw [Matrix.toEuclideanLin_apply] +- rw [Matrix.toEuclideanLin_apply] +- rw [Matrix.toEuclideanLin_apply] +- rw [Matrix.toEuclideanLin_apply] +- simp +- have y_prop := y.property +- rw [Subgroup.mem_centralizer_iff] at y_prop +- simp at y_prop +- rw [Subtype.ext_iff] at y_prop +- simp at y_prop +- rw [y_prop] +- . +- intro z +- apply Module.End.mapsTo_maxGenEigenspace_of_comm +- rw [commute_iff_eq] +- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- simp +- . +- intro x +- apply LinearMap.mapsTo_biSup_of_mapsTo +- . +- intro z +- apply Module.End.mapsTo_maxGenEigenspace_of_comm +- rw [commute_iff_eq] +- rw [Matrix.toEuclideanLin_eq_toLin_orthonormal] +- . simp +- . intro a b hab +- simpa using hab +- +- )⟩ +- +- +- apply Prod.ext +- . +- rw [Subtype.ext_iff] +- conv => +- rhs +- rw [← hx] +- simp +- simp [map_first_hom, map_first_unitary] +- apply LinearMap.ext +- intro z +- apply Subtype.ext +- simp only [LinearMap.restrict_coe_apply, new, LinearEquiv.apply_symm_apply, +- LinearMap.ofIsCompl_apply_left, map_first_x_new, map_first, LinearMap.coe_mk, +- AddHom.coe_mk] +- . +- rw [Subtype.ext_iff] +- conv => +- rhs +- rw [← hy] +- simp +- simp [map_second_hom, map_second_unitary] +- simp [map_second] +- rw [LinearMap.ext_iff] +- intro z +- rw [Subtype.ext_iff] +- simp [new] +- simp [map_second_y_new, map_second] +- ) ++ intro i ++ exact Module.End.mapsTo_maxGenEigenspace_of_comm (by simp) i) + -- Submodule.finrank_add_eq_of_isCompl + + +@@ -676,9 +430,8 @@ lemma centralizer_iso {n: ℕ} [hn: NeZero n] (G: Subgroup (Matrix.unitaryGroup + apply Submodule.finrank_lt at gen_eigenspace_top + rw [sum_eq] at gen_eigenspace_top + simp at gen_eigenspace_top +- A := _ +- B := _ ++ A := A ++ B := B + iso := prod_iso + } + +-#print axioms centralizer_iso +diff --git a/Gromov/ToMathlib/Data/List/Infix.lean b/Gromov/ToMathlib/Data/List/Infix.lean +index aa5c209..d5a4ed5 100644 +--- a/Gromov/ToMathlib/Data/List/Infix.lean ++++ b/Gromov/ToMathlib/Data/List/Infix.lean +@@ -167,4 +167,3 @@ lemma list_adjacent_elements {A: Type*} (l: List A) (p: A → Bool) (n : ℕ): + rw [Nat.one_le_div_iff hn] + omega + +-#print axioms list_adjacent_elements +diff --git a/Gromov/ToMathlib/GroupTheory/Closure.lean b/Gromov/ToMathlib/GroupTheory/Closure.lean +index 58aa14c..d01b3f7 100644 +--- a/Gromov/ToMathlib/GroupTheory/Closure.lean ++++ b/Gromov/ToMathlib/GroupTheory/Closure.lean +@@ -12,7 +12,6 @@ public section + + open scoped Pointwise Finset + +-set_option maxHeartbeats 300000 in + lemma closure_iterate_mulact {T: Type*} [Group T] [DecidableEq T] (a b: T) (n: ℤ) + (conj_in: (a^n * b * a^(-n)) ∈ (Subgroup.closure (G := T) (Set.image (fun (m: ℤ) => a^m * b * a^(-m)) (Set.Ioo (-n.natAbs) n.natAbs)))) + (conj_inv_in: (a^(-n) * b * a^(n)) ∈ (Subgroup.closure (G := T) (Set.image (fun (m: ℤ) => a^m * b * a^(-m)) (Set.Ioo (-n.natAbs) n.natAbs)))) : +@@ -316,7 +315,6 @@ lemma closure_iterate_mulact {T: Type*} [Group T] [DecidableEq T] (a b: T) (n: + | inv y hy y_mem => + apply Subgroup.inv_mem _ y_mem + +-#print axioms closure_iterate_mulact + + namespace Subgroup + +@@ -390,7 +388,6 @@ lemma closure_set_union_normal {G: Type*} [Group G] (S: Set G) (N: Subgroup G) ( + simp + group + +-#print axioms closure_set_union_normal + + -- TODO - deduplicate with with 'mem_S_prod_list' + lemma mem_closure_prod_list {G: Type*} [Group G] (S: Set G) (S_eq_Sinv: S = S⁻¹) (x: G) (hx: x ∈ Subgroup.closure S): ∃ l: List S, l.unattach.prod = x := by +diff --git a/Gromov/ToMathlib/LinearAlgebra/Matrix/Det.lean b/Gromov/ToMathlib/LinearAlgebra/Matrix/Det.lean +index f9574a1..ce1739e 100644 +--- a/Gromov/ToMathlib/LinearAlgebra/Matrix/Det.lean ++++ b/Gromov/ToMathlib/LinearAlgebra/Matrix/Det.lean +@@ -7,17 +7,12 @@ public import Gromov.ToMathlib.LinearAlgebra.Matrix.ToMatrix + /-! + # Determinants of matrices of bilinear forms + +-General-purpose material extracted from the Gromov development, destined for mathlib. ++Basis changes preserve determinant ratios; positive semidefinite comparison ++controls determinants of positive definite matrices. + -/ + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false +- + open scoped Finset + open scoped Pointwise + +@@ -50,19 +45,19 @@ theorem LinearMap.toMatrix₂_det_basis_change {M ι κ : Type*} [AddCommGroup M + Matrix.det_mul, Matrix.det_mul, Matrix.det_transpose, ← Module.Basis.det_apply] + ring + +- + open MatrixOrder in +-lemma matrix_det_montone {n: Type*} [Fintype n] [DecidableEq n] (A B: Matrix n n ℝ) (hb: B.PosDef) (hab: (A - B).PosSemidef): B.det ≤ A.det := by +- +- have invert_sqrt: Invertible (CFC.sqrt B) := by ++lemma matrix_det_montone {n : Type*} [Fintype n] [DecidableEq n] ++ (A B : Matrix n n ℝ) (hb : B.PosDef) (hab : (A - B).PosSemidef) : ++ B.det ≤ A.det := by ++ have invert_sqrt : Invertible (CFC.sqrt B) := by + apply Matrix.invertibleOfIsUnitDet + rw [Matrix.PosSemidef.det_sqrt hb.posSemidef] + simp + rw [← ne_eq, Real.sqrt_ne_zero] +- . grind [hb.det_pos] +- . grind [hb.det_pos] ++ · grind [hb.det_pos] ++ · grind [hb.det_pos] + +- have det_prod_eq: A.det = B.det * ((CFC.sqrt B)⁻¹ * (A - B) * (CFC.sqrt B)⁻¹ + 1).det := by ++ have det_prod_eq : A.det = B.det * ((CFC.sqrt B)⁻¹ * (A - B) * (CFC.sqrt B)⁻¹ + 1).det := by + conv => + lhs + arg 1 +@@ -73,7 +68,7 @@ lemma matrix_det_montone {n: Type*} [Fintype n] [DecidableEq n] (A B: Matrix n n + rw [Matrix.det_mul] + rw [← mul_assoc, ← mul_assoc] + rw [Matrix.det_mul] +- ring ++ ring_nf + rw [hb.posSemidef.det_sqrt] + simp only [RCLike.sqrt_real] + rw [Real.sq_sqrt (by grind [hb.det_pos])] +@@ -93,7 +88,7 @@ lemma matrix_det_montone {n: Type*} [Fintype n] [DecidableEq n] (A B: Matrix n n + + rw [det_prod_eq] + rw [le_mul_iff_one_le_right] +- . ++ · + apply matrix_psd_det_one + rw [hb.posSemidef.inv_sqrt] + have foo := (CFC.sqrt_nonneg B⁻¹) +@@ -102,17 +97,17 @@ lemma matrix_det_montone {n: Type*} [Fintype n] [DecidableEq n] (A B: Matrix n n + nth_rw 2 [← foo.isHermitian.eq] + apply Matrix.PosSemidef.mul_mul_conjTranspose_same + exact hab +- . apply hb.det_pos ++ · apply hb.det_pos + +--- TODO - upstream. Mathlib only has `Finset.sum_biUnion` (which needs `PairwiseDisjoint`) +--- and the `ENNReal` `tsum` versions. +-theorem Finset.sum_biUnion_le {κ α : Type*} [DecidableEq α] {s: Finset κ} {t: κ → Finset α} +- {f: α → ℝ} (hf: ∀ x, 0 ≤ f x): ∑ x ∈ s.biUnion t, f x ≤ ∑ i ∈ s, ∑ x ∈ t i, f x := by ++/-- The sum over a finite union is bounded by the sum over its possibly ++overlapping members when all summands are nonnegative. -/ ++theorem Finset.sum_biUnion_le {κ α : Type*} [DecidableEq α] {s : Finset κ} {t : κ → Finset α} ++ {f : α → ℝ} (hf : ∀ x, 0 ≤ f x) : ∑ x ∈ s.biUnion t, f x ≤ ∑ i ∈ s, ∑ x ∈ t i, f x := by + classical + induction s using Finset.induction with + | empty => simp + | insert a s ha ih => + rw [Finset.biUnion_insert, Finset.sum_insert ha] + have hunion := Finset.sum_union_inter (s₁ := t a) (s₂ := s.biUnion t) (f := f) +- have hnn: 0 ≤ ∑ x ∈ t a ∩ s.biUnion t, f x := Finset.sum_nonneg fun x _ => hf x ++ have hnn : 0 ≤ ∑ x ∈ t a ∩ s.biUnion t, f x := Finset.sum_nonneg fun x _ => hf x + linarith +diff --git a/Gromov/ToMathlib/LinearAlgebra/Matrix/PosDef.lean b/Gromov/ToMathlib/LinearAlgebra/Matrix/PosDef.lean +index f074374..76cb7dc 100644 +--- a/Gromov/ToMathlib/LinearAlgebra/Matrix/PosDef.lean ++++ b/Gromov/ToMathlib/LinearAlgebra/Matrix/PosDef.lean +@@ -29,7 +29,7 @@ lemma matrix_psd_det_one {n: Type*} [Fintype n] [DecidableEq n] (A: Matrix n n + rw [← Matrix.diagonal_one'] + rw [Matrix.diagonal_add] + simp +- apply Finset.one_le_prod ++ apply Finset.one_le_prod₀ + intro i _ + have foo := ha.eigenvalues_nonneg + grind +diff --git a/Gromov/Unipotent/Commutator.lean b/Gromov/Unipotent/Commutator.lean +index 394e1e4..9a0f3b3 100644 +--- a/Gromov/Unipotent/Commutator.lean ++++ b/Gromov/Unipotent/Commutator.lean +@@ -17,9 +17,6 @@ public import Gromov.ToMathlib.Order.Prod.Lex + + public section + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false +-set_option linter.style.cdot false + + open scoped commutatorElement IsMulCommutative Pointwise + +@@ -45,7 +42,7 @@ lemma iterate_comm_set_eq_fold {G: Type*} [Group G] [DecidableEq G] (S: Finset G + ext g + simp + refine ⟨?_, ?_⟩ +- . ++ · + intro h + obtain ⟨s, s_mem, ⟨x, x_mem, comm_eq⟩⟩ := h + rw [← Finset.mem_coe] at x_mem +@@ -56,12 +53,12 @@ lemma iterate_comm_set_eq_fold {G: Type*} [Group G] [DecidableEq G] (S: Finset G + refine ⟨t_mem, ?_⟩ + use (⟨s, s_mem⟩ :: l) + refine ⟨?_, ?_⟩ +- . grind +- . ++ · grind ++ · + simp + rw [← comm_eq] + rw [← l_fold_eq] +- . ++ · + intro h + obtain ⟨t, t_mem, l, l_len, l_fold_eq⟩ := h + have l_len_eq := l_len +@@ -84,16 +81,15 @@ lemma iterate_comm_set_eq_fold {G: Type*} [Group G] [DecidableEq G] (S: Finset G + + use List.foldr (fun x b ↦ ⁅b, x⁆) t tail.unattach + refine ⟨?_, ?_⟩ +- . ++ · + rw [← Finset.mem_coe] + rw [ih] + simp + use t + refine ⟨t_mem, ?_⟩ + use tail +- . exact l_fold_eq ++ · exact l_fold_eq + +-#print axioms iterate_comm_set_eq_fold + + + lemma comm_prod {G: Type*} [Group G] (x y z: G): ⁅x * y, z⁆ = ⁅x, ⁅y, z⁆⁆ * ⁅y, z⁆ * ⁅x, z⁆ := by +@@ -129,12 +125,12 @@ lemma double_comm_mem {G: Type*} [DecidableEq G] [Group G] (S: Finset G) {l': G + simp + apply Subgroup.mem_closure_of_mem + apply Set.mem_union_right +- simp [mem_lowerCentralSeries_succ_iff] ++ simp + apply Subgroup.mem_closure_of_mem + simp + use ⁅g'.val, l'⁆ + refine ⟨?_, ?_⟩ +- . ++ · + + rw [← Subgroup.inv_mem_iff] + simp +@@ -142,27 +138,26 @@ lemma double_comm_mem {G: Type*} [DecidableEq G] [Group G] (S: Finset G) {l': G + simp + use l' + refine ⟨?_, ?_⟩ +- . rw [ih] ++ · rw [ih] + simp at l'_mem + cases l'_mem +- . ++ · + rename_i l'_mem_forward + apply Subgroup.mem_closure_of_mem + apply Set.mem_union_left + exact l'_mem_forward +- . rename_i l'_mem_inv ++ · rename_i l'_mem_inv + rw [← Subgroup.closure_inv] + apply Subgroup.mem_closure_of_mem + simp + left + exact l'_mem_inv +- . ++ · + use g' +- . ++ · + use l'⁻¹ + + +-set_option maxHeartbeats 400000 in + lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} (n: ℕ) (ih: (⊤ : Subgroup G).lowerCentralSeries n = Subgroup.closure (iterate_comm_set (S ∪ S⁻¹) n ∪ ↑((⊤ : Subgroup G).lowerCentralSeries (n + 1)))) (g': ↑(S ∪ S⁻¹)) (l'_mem_comm: l' ∈ iterate_comm_set (S ∪ S⁻¹) n ∨ l'⁻¹ ∈ iterate_comm_set (S ∪ S⁻¹) n): ⁅l'⁻¹, ⁅g'.val, l'⁆⁆ * ⁅g'.val, l'⁆ ∈ Subgroup.closure (iterate_comm_set (S ∪ S⁻¹) (n + 1) ∪ ↑((⊤ : Subgroup G).lowerCentralSeries (n + 1 + 1))) := by + + +@@ -171,36 +166,36 @@ lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} + + + cases l'_mem_comm +- . ++ · + rw [← Subgroup.inv_mem_iff] + simp + rename_i l'_mem +- . apply Subgroup.mul_mem +- . ++ · apply Subgroup.mul_mem ++ · + apply Subgroup.mem_closure_of_mem + apply Set.mem_union_left + simp [iterate_comm_set] + use g' + refine ⟨by simpa using g'_prop, ?_⟩ + use l' +- . ++ · + rw [← Subgroup.inv_mem_iff] + simp + apply double_comm_mem +- . exact ih +- . simp [l'_mem] ++ · exact ih ++ · simp [l'_mem] + +- . ++ · + + rename_i l'_inv_mem +- . apply Subgroup.mul_mem +- . ++ · apply Subgroup.mul_mem ++ · + apply double_comm_mem + exact ih + simp [l'_inv_mem] + + +- . ++ · + rw [← Subgroup.inv_mem_iff] + simp + conv => +@@ -211,7 +206,7 @@ lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} + rw [comm_first_inv] + simp + apply Subgroup.mul_mem +- . ++ · + have foo := double_comm_mem (l' := l'⁻¹ ) _ _ ih g' (by + simp + left +@@ -219,7 +214,7 @@ lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} + ) + simp at foo + exact foo +- . ++ · + rw [← Subgroup.inv_mem_iff] + simp + apply Subgroup.mem_closure_of_mem +@@ -231,11 +226,9 @@ lemma triple_comm_mem {G: Type*} [Group G] [DecidableEq G] (S: Finset G) {l': G} + use l'⁻¹ + + +-#print axioms triple_comm_mem + -- Lemma 13.44. in https://www.math.ucdavis.edu/~kapovich/EPR/ggt.pdf + -- Note - the book seems to implicitly assume that the generating set is symmetric + +-set_option maxHeartbeats 400000 in + lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Finset G) (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + (⊤ : Subgroup G).lowerCentralSeries n = Subgroup.closure ((iterate_comm_set (S ∪ S⁻¹) n) ∪ ↑((⊤ : Subgroup G).lowerCentralSeries (n + 1))) := by + induction n with +@@ -247,9 +240,9 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + | succ n ih => + ext a + refine ⟨?_, ?_⟩ +- . ++ · + intro ha +- rw [mem_lowerCentralSeries_succ_iff] at ha ++ rw [Subgroup.mem_lowerCentralSeries_succ_iff] at ha + apply (Subgroup.closure_le _).mp ?_ ha + simp + intro p hp +@@ -266,7 +259,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + rw [comm_prod] + + have x_comm_mem: ⁅x.val, g⁆ ∈ (⊤ : Subgroup G).lowerCentralSeries (n + 1 + 1) := by +- rw [mem_lowerCentralSeries_succ_iff] ++ rw [Subgroup.mem_lowerCentralSeries_succ_iff] + apply Subgroup.mem_closure_of_mem + simp + use x +@@ -274,8 +267,8 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + + + apply Subgroup.mul_mem +- . apply Subgroup.mul_mem +- . ++ · apply Subgroup.mul_mem ++ · + + conv => + arg 2 +@@ -284,25 +277,25 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + + + apply Subgroup.mul_mem +- . ++ · + apply Subgroup.mem_closure_of_mem + apply Set.mem_union_right + simp + apply Subgroup.Normal.conj_mem +- . infer_instance +- . exact x_comm_mem +- . ++ · infer_instance ++ · exact x_comm_mem ++ · + apply Subgroup.mem_closure_of_mem + apply Set.mem_union_right + simp only [SetLike.mem_coe] + rw [Subgroup.inv_mem_iff] + apply x_comm_mem +- . ++ · + apply Subgroup.mem_closure_of_mem + apply Set.mem_union_right + simp only [SetLike.mem_coe] + apply x_comm_mem +- . ++ · + obtain ⟨g_list, g_prod⟩ := new_mem_S_prod_list (S := S) (x := g) (by simp [hS]) + --clear ha a p_eq_comm p c_prod c_mem c x_comm_mem + rw [← g_prod] +@@ -319,20 +312,20 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + + + by_cases g_list_zero: g_list.length = 0 +- . simp at g_list_zero ++ · simp at g_list_zero + simp [g_list_zero] +- . ++ · + simp at g_list_zero + + + by_cases l_len_ne_zero: l.unattach.length = 0 +- . have l_empty: l.unattach = [] := by ++ · have l_empty: l.unattach = [] := by + exact List.eq_nil_iff_length_eq_zero.mpr l_len_ne_zero + simp [l_empty] + + + by_cases both_eq_one: g_list.length = 1 ∧ l.unattach.length = 1 +- . ++ · + obtain ⟨g_len_one, l_len_one⟩ := both_eq_one + obtain ⟨g', h_g'⟩ := List.length_eq_one_iff.mp g_len_one + obtain ⟨l', h_l'⟩ := List.length_eq_one_iff.mp l_len_one +@@ -369,7 +362,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + + rw [not_and_or] at both_eq_one + cases both_eq_one +- . rename_i g_len_ne_one ++ · rename_i g_len_ne_one + + have g_len_ne_zero: g_list.length ≠ 0 := by + simp +@@ -385,16 +378,16 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + rw [List.unattach_append] + simp + rw [comm_prod_right] +- . apply Subgroup.mul_mem +- . apply Subgroup.mul_mem +- . ++ · apply Subgroup.mul_mem ++ · apply Subgroup.mul_mem ++ · + + have prev := hk k (by simp) l (List.take (g_list.length - 1) g_list) (by + simp + omega + ) + exact prev +- . ++ · + + + rw [← Subgroup.inv_mem_iff] +@@ -409,10 +402,10 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + simp at hx + obtain ⟨x_mem, x_subtype_mem⟩ := hx + cases x_mem +- . rename_i x_mem_forward ++ · rename_i x_mem_forward + apply Subgroup.mem_closure_of_mem + grind +- . rename_i x_mem_inv ++ · rename_i x_mem_inv + rw [← Subgroup.closure_inv] + apply Subgroup.mem_closure_of_mem + simp +@@ -421,7 +414,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + exact Subgroup.commutator_mem_commutator + (Subgroup.commutator_mem_commutator l_prod_mem (Subgroup.mem_top _)) + (Subgroup.mem_top _) +- . ++ · + + have prev := hk (l.length + 1) (by omega) l [(g_list.getLast g_list_zero)] (by + simp +@@ -430,7 +423,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + simp at prev + exact prev + +- . ++ · + rename_i l_len_ne_one + simp at l_len_ne_one + have l_ne_zero: l.length ≠ 0 := by +@@ -447,8 +440,8 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + rw [comm_prod] + simp at h_len + apply Subgroup.mul_mem +- . apply Subgroup.mul_mem +- . ++ · apply Subgroup.mul_mem ++ · + rw [← Subgroup.inv_mem_iff] + simp + apply Subgroup.mem_closure_of_mem +@@ -460,10 +453,10 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + have l_prop := (l.getLast (by simpa using l_ne_zero)).prop + rw [Set.mem_union] at l_prop + cases l_prop +- . rename_i l_prop_forward ++ · rename_i l_prop_forward + apply Subgroup.mem_closure_of_mem + grind +- . rename_i l_prop_inv ++ · rename_i l_prop_inv + rw [← Subgroup.closure_inv] + simp + apply Subgroup.mem_closure_of_mem +@@ -471,12 +464,12 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + exact Subgroup.commutator_mem_commutator + (Subgroup.commutator_mem_commutator last_mem (Subgroup.mem_top _)) + (Subgroup.mem_top _) +- . ++ · + + have foo := hk (g_list.length + 1) (by omega) [l.getLast (by simpa using l_ne_zero)] g_list (by simp) + simp at foo + exact foo +- . ++ · + have foo := hk k (by simp) (List.take (l.length - 1) l) g_list (by + simp + omega +@@ -484,7 +477,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + exact foo + + intro ha +- rw [mem_lowerCentralSeries_succ_iff] ++ rw [Subgroup.mem_lowerCentralSeries_succ_iff] + + + have closure_le: (Subgroup.closure ((iterate_comm_set (S ∪ S⁻¹) (n + 1)) ∪ ↑((⊤ : Subgroup G).lowerCentralSeries (n + 1 + 1)))) ≤ (Subgroup.closure {x | ∃ p ∈ (⊤ : Subgroup G).lowerCentralSeries n, ∃ q ∈ (⊤ : Subgroup G), ⁅p, q⁆ = x}) := by +@@ -492,7 +485,7 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + intro x hx + simp at hx + cases hx +- . ++ · + rename_i x_mem_comm + apply Subgroup.mem_closure_of_mem + simp +@@ -501,19 +494,18 @@ lemma lower_central_generates_succ {G: Type*} [Group G] [DecidableEq G] (S: Fins + obtain ⟨s, s_mem, ⟨c, c_mem, c_comm⟩⟩ := x_mem_comm + use c + refine ⟨?_, ?_⟩ +- . apply Subgroup.mem_closure_of_mem ++ · apply Subgroup.mem_closure_of_mem + grind +- . use s +- . ++ · use s ++ · + rename_i x_mem_lower_two + have x_mem_lower_succ: x ∈ (⊤ : Subgroup G).lowerCentralSeries (n + 1) := + Subgroup.commutator_le_left _ _ x_mem_lower_two + + +- rw [mem_lowerCentralSeries_succ_iff] at x_mem_lower_succ ++ rw [Subgroup.mem_lowerCentralSeries_succ_iff] at x_mem_lower_succ + simpa using x_mem_lower_succ + + + apply closure_le ha + +-#print axioms lower_central_generates_succ +diff --git a/Gromov/Unipotent/FG.lean b/Gromov/Unipotent/FG.lean +index 6a68e4d..f39faa3 100644 +--- a/Gromov/Unipotent/FG.lean ++++ b/Gromov/Unipotent/FG.lean +@@ -12,9 +12,6 @@ the supporting transfer lemmas along homomorphisms. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false +-set_option linter.style.cdot false + + open scoped commutatorElement IsMulCommutative Pointwise + +@@ -38,10 +35,10 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + grw [closure_le] + apply Subgroup.closure_le_normalClosure + | succ n ih => +- simp [lowerCentralSeries] ++ simp + rw [le_antisymm_iff] + refine ⟨?_, ?_⟩ +- . ++ · + simp [Subgroup.normalClosure] + intro y hy + simp [Group.conjugatesOfSet, iterate_comm_set] at hy +@@ -50,10 +47,10 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + obtain ⟨x, x_mem⟩ := c_comm + rw [← x_mem] + apply Subgroup.Normal.conj_mem +- . infer_instance +- . ++ · infer_instance ++ · + apply Subgroup.commutator_mem_commutator +- . ++ · + rw [← ih] + apply Subgroup.mem_closure_of_mem + simp [Group.conjugatesOfSet] +@@ -62,8 +59,8 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + simp [conjugatesOf] + use 1 + simp +- . simp +- . ++ · simp ++ · + + have image_commute: ∀ s ∈ S, ∀ g ∈ (iterate_comm_set (S) n), QuotientGroup.mk' (((Subgroup.normalClosure (iterate_comm_set (S) (n + 1))))) (s * g) = QuotientGroup.mk' (((Subgroup.normalClosure (iterate_comm_set (S) (n + 1))))) (g * s) := by + intro s hs g hg +@@ -80,13 +77,13 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + simp only [conjugatesOf] + use g * s * g⁻¹ * s⁻¹ + refine ⟨?_, ?_⟩ +- . simp [iterate_comm_set] ++ · simp [iterate_comm_set] + use s + refine ⟨by simp [hs], ?_⟩ + use g + refine ⟨hg, ?_⟩ + simp [Bracket.bracket] +- . ++ · + simp + use s⁻¹ * g⁻¹ + group +@@ -113,7 +110,7 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + + -- TODO - figure out how to get the 'induction' tactic working here + apply Subgroup.closure_induction (p := fun y hy => a⁻¹ * y⁻¹ * (a * y) ∈ Subgroup.normalClosure (iterate_comm_set (S) (n + 1))) (hx := b_mem_top) +- . ++ · + intro s hs + have comm := image_commute s hs a a_mem + simp at comm +@@ -122,24 +119,24 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + rw [QuotientGroup.eq] at comm + simp at comm + exact comm +- . simp +- . intro y hy z hz y_mem z_mem ++ · simp ++ · intro y hy z hz y_mem z_mem + simp + conv => + arg 2 + equals (a⁻¹ * hy⁻¹ * a * hy) * (hy⁻¹ * a⁻¹ * y⁻¹ * a * y * hy) => + group + apply Subgroup.mul_mem +- . group ++ · group + group at z_mem + exact z_mem +- . ++ · + have foo := (Subgroup.normalClosure_normal).conj_mem _ y_mem hy⁻¹ + simp at foo + group at foo + group + exact foo +- . ++ · + intro y hy y_mem + rw [← Subgroup.inv_mem_iff] + simp +@@ -158,7 +155,7 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + rw [ih] at normal_le_center + simp + have a_mem_center := @normal_le_center a⁻¹ ?_ +- . ++ · + rw [Subgroup.mem_center_iff] at a_mem_center + specialize a_mem_center (QuotientGroup.mk b⁻¹) + rw [← QuotientGroup.mk_inv] at a_mem_center +@@ -170,14 +167,13 @@ lemma iterate_comm_generates (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ): + group at a_mem_center + group + exact a_mem_center +- . simp ++ · simp + use a + + + simp + exact QuotientGroup.mk_surjective + +-#print axioms iterate_comm_generates + + -- Lemma 13.55 from https://www.math.ucdavis.edu/~kapovich/EPR/ggt.pdf + lemma comm_trivial_implies_nilpotent {G: Type*} [DecidableEq G] [Group G] (S: Finset G) (hS: Subgroup.closure (S: Set G) = ⊤) (n: ℕ) (h_comm: iterate_comm_set (S) (n) = {1}): +@@ -201,8 +197,8 @@ lemma normal_comm_mem {G: Type*} [Group G] {N: Subgroup G} (N_normal: N.Normal) + equals a * (b * a⁻¹ * b⁻¹) => group + + apply Subgroup.mul_mem +- . exact ha +- . exact conj_mem ++ · exact ha ++ · exact conj_mem + + + -- TODO - cleanup and upstream to mathlib +@@ -253,16 +249,16 @@ lemma fg_extension {A: Type*} [Group A] (N: Subgroup A) [N.Normal] (hN: N.FG) (h + rw [SQ_eq] at hS_Q + use S_N ∪ SQ_out + refine ⟨?_, ?_⟩ +- . ++ · + simp [SQ_out] + rw [Subgroup.closure_union] + simp [hS_N] + ext a + simp + by_cases mem_N: a ∈ N +- . apply Subgroup.mem_sup_left ++ · apply Subgroup.mem_sup_left + exact mem_N +- . ++ · + let a_map: (A ⧸ N) := a + have a_mem_top: a_map ∈ (⊤ : Subgroup (A ⧸ N)) := by + simp +@@ -277,14 +273,14 @@ lemma fg_extension {A: Type*} [Group A] (N: Subgroup A) [N.Normal] (hN: N.FG) (h + have a_eq := hk.2 + rw [QuotientGroup.eq] at a_eq + rw [← Subgroup.mul_mem_cancel_left (x := k⁻¹)] +- . ++ · + apply Subgroup.mem_sup_left + exact a_eq +- . apply Subgroup.mem_sup_right ++ · apply Subgroup.mem_sup_right + simp + exact hk.1 + +- . simp ++ · simp + + lemma fg_domain_of_ker_range {A B: Type*} [Group A] [Group B] (f : A →* B) (hA: Subgroup.FG f.ker) (hB: Subgroup.FG f.range): Group.FG A := by + have new_fg := fg_extension (f.ker) hA +@@ -300,7 +296,6 @@ lemma Group.FG.of_mulEquiv {G H : Type*} [Group G] [Group H] (e : G ≃* H) (h : + haveI := h + Group.fg_of_surjective (f := e.toMonoidHom) e.surjective + +-set_option maxHeartbeats 5000000 in + lemma fg_of_subgroup_fg_nilpotent {A: Type*} [DecidableEq A] [Group A] [Group.IsNilpotent A] (A_fg: Group.FG A) (H: Subgroup A): H.FG := by + classical + revert H +@@ -320,9 +315,6 @@ lemma fg_of_subgroup_fg_nilpotent {A: Type*} [DecidableEq A] [Group A] [Group.Is + have comm_eq := Subgroup.lowerCentralSeries_succ (⊤ : Subgroup A) n + rw [← hn] at comm_eq + rw [Subgroup.lowerCentralSeries_nilpotencyClass] at comm_eq +- conv at comm_eq => +- rhs +- simp + rw [eq_comm, Subgroup.commutator_eq_bot_iff_le_centralizer] at comm_eq + simp [Subgroup.centralizer_univ] at comm_eq + have n_fg: (Subgroup.lowerCentralSeries (⊤ : Subgroup A) n).FG := by +@@ -366,7 +358,7 @@ lemma fg_of_subgroup_fg_nilpotent {A: Type*} [DecidableEq A] [Group A] [Group.Is + + rw [← Group.fg_iff_subgroup_fg] + apply fg_domain_of_ker_range ((QuotientGroup.mk' ((⊤: Subgroup A).lowerCentralSeries n)).comp H.subtype) +- . ++ · + -- The kernel is `N.subgroupOf H = (H ⊓ N).subgroupOf H`, which is the same abstract group as + -- `(H ⊓ N).subgroupOf N` — the version we proved FG using that `N` is abelian. + rw [← MonoidHom.comap_ker, QuotientGroup.ker_mk', Subgroup.comap_subtype, +@@ -375,7 +367,7 @@ lemma fg_of_subgroup_fg_nilpotent {A: Type*} [DecidableEq A] [Group A] [Group.Is + ((Subgroup.subgroupOfEquivOfLe inf_le_right).trans + (Subgroup.subgroupOfEquivOfLe inf_le_left).symm) + ((Group.fg_iff_subgroup_fg _).mpr h_inf_fg) +- . ++ · + -- The range is the image of `H` in `A ⧸ Cⁿ A`, which is FG by the induction hypothesis. + rw [MonoidHom.range_comp, Subgroup.range_subtype] + exact ih (Subgroup.map (QuotientGroup.mk' _) H) +diff --git a/Gromov/Unipotent/GammaN.lean b/Gromov/Unipotent/GammaN.lean +index b60722b..126c821 100644 +--- a/Gromov/Unipotent/GammaN.lean ++++ b/Gromov/Unipotent/GammaN.lean +@@ -11,9 +11,6 @@ public import Gromov.Unipotent.FG + + public section + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false +-set_option linter.style.cdot false + + open scoped commutatorElement IsMulCommutative Pointwise + +@@ -112,9 +109,252 @@ theorem log_pow_sq_lt_of_lt (M p q K : ℕ) (hp : 0 < p) + def gamma_conj_bound {H: Type*} [DecidableEq H] [Group H] {N': Subgroup H} (gamma: MulAut N') := ∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → ((Finset.image (fun x ↦ (List.map (fun (i: ↥(Finset.Ico a b)) ↦ (gamma)^[k * ↑i] g) x.toList).prod)) + (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q + +-set_option maxHeartbeats 1000000 in +-set_option synthInstance.maxHeartbeats 40000 in +-lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N': Subgroup H} [N'_normal: N'.Normal] (N'_nilpotent: Group.IsNilpotent N') (hN': Subgroup.FG N') (gamma: MulAut N') ++/-- The finite-free abelian part of the argument, separated from torsion lifting. -/ ++private lemma free_abelian_gamma_unipotent {A : Type*} [CommGroup A] [DecidableEq A] ++ [Module.Finite ℤ (Additive A)] [Module.Free ℤ (Additive A)] ++ (gamma_lift : MulAut A) (r : ℕ) (hr : 0 < r) ++ (gamma_lift_conj : ∀ k : ℕ, 0 < k → ∀ g : A, ∃ p q : ℕ, 0 < p ∧ ++ ∀ b : ℕ, 0 < b → ∀ a : ℕ, 0 < a → a < b → ++ (Finset.image (fun x ↦ (List.map (fun i : ↥(Finset.Ico a b) ↦ ++ gamma_lift^[k * ↑i] g) x.toList).prod) (Finset.Ico a b).attach.powerset).card ≤ ++ p * b ^ q * (b - a) ^ q) : ++ ∃ a, 0 < a ∧ ∀ p : ℕ, 0 < p → ∃ n, ∀ g : A, ++ (fun x ↦ x * gamma_lift^[a * r * p] x⁻¹)^[n] g = 1 := by ++ classical ++ rcases subsingleton_or_nontrivial A with hA | hA ++ · exact ⟨1, by simp, fun p _ => ⟨1, fun g => Subsingleton.elim _ _⟩⟩ ++ let gamma_add := gamma_lift.toAdditive.toAddMonoidHom.toIntLinearMap ++ let B := (Module.finBasis ℤ (Additive (A))) ++ let gamma_matrix := gamma_add.toMatrix B B ++ have invertible_gamma: Invertible gamma_matrix := { ++ invOf := ((gamma_lift.toAdditive).symm.toAddMonoidHom).toIntLinearMap.toMatrix B B ++ invOf_mul_self := by ++ simp [gamma_matrix, gamma_add] ++ rw [← LinearMap.toMatrix_mul] ++ rw [← toIntLinearMap_comp_mul] ++ simp ++ mul_invOf_self := by ++ simp [gamma_matrix, gamma_add] ++ rw [← LinearMap.toMatrix_mul] ++ rw [← toIntLinearMap_comp_mul] ++ simp ++ } ++ ++ let dim := Module.finrank ℤ (Additive (A)) ++ let equiv (v: Fin _ → ℤ) := (Finsupp.linearEquivFunOnFinite ℤ _ (Fin dim)).symm v ++ let remap (v: Fin _ → ℤ) := Finsupp.linearCombination _ B (equiv v) ++ ++ have gamma_matrix_mulVec: ∀ v: (Fin dim) → ℤ , remap ((gamma_matrix).mulVec (equiv v)) = Additive.ofMul (gamma_lift (Additive.toMul (remap v))) := by ++ intro v ++ unfold gamma_matrix ++ rw [← Module.Basis.repr_linearCombination (v := (equiv v)) (b := B)] ++ rw [LinearMap.toMatrix_mulVec_repr] ++ simp [remap, gamma_add, equiv] ++ ++ ++ have gamma_matrix_mulVec_pow: ∀ n: ℕ, ∀ v: (Fin dim) → ℤ , remap ((gamma_matrix^n).mulVec (equiv v)) = Additive.ofMul (gamma_lift^[n] (Additive.toMul (remap v))) := by ++ intro n ++ induction n with ++ | zero => ++ intro v ++ simp [remap, equiv] ++ | succ n ih => ++ intro v ++ rw [Function.iterate_succ_apply', pow_succ', ← Matrix.mulVec_mulVec] ++ rw [show ((gamma_matrix ^ n).mulVec ⇑(equiv v)) ++ = ⇑(equiv ((gamma_matrix ^ n).mulVec ⇑(equiv v))) from rfl] ++ rw [gamma_matrix_mulVec, ih] ++ rfl ++ ++ ++ have rank_nonzero: NeZero (Module.finrank ℤ (Additive (A))) := by ++ apply NeZero.of_pos ++ apply Module.finrank_pos ++ ++ ++ have eigen_norm_one: ∀ (k : Module.End.Eigenvalues (Matrix.toLin' (((unitOfInvertible gamma_matrix).val).map (Int.castRingHom ℂ)))), ‖k.val‖ = 1 := by ++ apply int_matrix_poly_growth_eigenvalue ++ · ++ intro k hk v ++ -- name the (fixed) group element the iterates are applied to ++ set g : A := ++ Additive.toMul ((Finsupp.linearCombination ℤ ⇑B) ++ ((Finsupp.linearEquivFunOnFinite ℤ ℤ (Fin dim)).symm v)) with hg ++ ++ ++ obtain ⟨p, q, p_pos, hq⟩ := gamma_lift_conj ⌈Real.logb ‖k‖ 3⌉₊ (by ++ simp ++ apply Real.logb_pos ++ · grind ++ · grind ++ ) g ++ let K: ℕ := (⌈4 * ((8 * ↑q + Real.log ↑p) ^ 2 / Real.log 2 ^ 2) ^ 2⌉₊ + 2 * ⌈Real.logb ‖k‖ 3⌉₊) + 1 ++ ++ ++ have hpq := hq K (by simp [K]) ⌈Real.logb ‖k‖ 3⌉₊ (by ++ simp ++ apply Real.logb_pos ++ · grind ++ · grind ++ ) (by ++ simp [K] ++ rw [two_mul] ++ grw [Nat.le_ceil (a := Real.logb ‖k‖ 3)] ++ grind ++ ) ++ ++ use p * K ^ q ++ use q ++ use K ++ ++ refine ⟨?_, ?_, ?_, ?_⟩ ++ · apply mul_pos ++ · exact p_pos ++ · apply pow_pos ++ simp [K] ++ ++ · simp [K] ++ rw [two_mul] ++ grw [Nat.le_ceil (a := Real.logb ‖k‖ 3)] ++ grind ++ · ++ -- Isolate `K` on the right of ++ -- `X < Real.log 2 * (↑K - ↑⌈Real.logb ‖k‖ 3⌉₊) ^ (1/2)`. ++ -- Divide by `Real.log 2 > 0`, bound the LHS by its absolute value (so no sign ++ -- assumption on `X` is needed), rewrite `|y| = √(y ^ 2)` and use strict ++ -- monotonicity of `√`, then move the subtraction across. `K` is never unfolded. ++ have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) ++ rw [← Real.sqrt_eq_rpow, ← div_lt_iff₀' hlog2] ++ refine lt_of_le_of_lt (le_abs_self _) ?_ ++ rw [← Real.sqrt_sq_eq_abs] ++ refine Real.sqrt_lt_sqrt (sq_nonneg _) ?_ ++ rw [lt_sub_iff_add_lt] ++ -- `K` still occurs on the left inside `Real.log ↑(p * K ^ q)`. This splits that ++ -- logarithm and eliminates the resulting `Real.log ↑K`, leaving a goal in `ℕ` with ++ -- `K` alone on the right. ++ refine log_pow_sq_lt_of_lt _ p q K p_pos ?_ ++ -- ⊢ ⌈4 * ((8 * ↑q + Real.log ↑p) ^ 2 / Real.log 2 ^ 2) ^ 2⌉₊ ++ -- + 2 * ⌈Real.logb ‖k‖ 3⌉₊ < K ++ simp [K] ++ · ++ rw [← (Finset.card_image_iff (f := fun a => remap (Finsupp.equivFunOnFinite.symm a))).mpr] ++ · ++ rw [Finset.image_image] ++ simp [remap, equiv] ++ rw [Function.comp_def] ++ simp_rw [map_sum] ++ simp [remap, equiv] at gamma_matrix_mulVec_pow ++ simp_rw [← pow_mul] ++ simp_rw [gamma_matrix_mulVec_pow] ++ -- Turn each subsum into `Additive.ofMul` of a product in the group, keeping the ++ -- index set as the subtype `↥(Finset.Ico N_1 N_2)`. ++ simp_rw [← ofMul_prod] ++ -- `Additive.ofMul` is a bijection, so it does not affect the cardinality: pull it ++ -- out of the image and discard it. ++ rw [← Function.comp_def Additive.ofMul, ← Finset.image_image, ++ Finset.card_image_of_injective _ (Equiv.injective _)] ++ ++ ++ simp_rw [← Finset.prod_map_toList] ++ ++ grw [hpq] ++ -- TODO - we might be able to make the goal stronger, if we don't actually need the factor of 2 in it ++ rw [pow_mul'] ++ apply mul_le_mul ++ · simp ++ · apply Nat.le_pow ++ simp ++ · simp ++ · simp ++ · apply Function.Injective.injOn ++ intro a b hab ++ simp [remap, equiv] at hab ++ rw [Function.Injective.eq_iff (linearIndependent_iff_injective_finsuppLinearCombination.mp ?_)] at hab ++ · simpa using hab ++ · apply Module.Basis.linearIndependent ++ ++ ++ let a := KroneckerPow (unitOfInvertible gamma_matrix) eigen_norm_one ++ use a ++ refine ⟨(by ++ apply KroneckerPow_pos ++ ), ?_⟩ ++ intro p hp ++ ++ ++ have unipotent_gamma_matrix := int_matrix_unipotent (by ++ apply Module.finrank_pos ++ ) (unitOfInvertible gamma_matrix) (by ++ apply eigen_norm_one ++ ) (n := p * r) (hn := by positivity) ++ obtain ⟨n, hm⟩ := unipotent_gamma_matrix ++ ++ ++ use n ++ intro g ++ apply_fun (fun f => f.toLin (Module.finBasis _ _) (Module.finBasis _ _)) at hm ++ rw [LinearMap.ext_iff] at hm ++ specialize hm g ++ simp [gamma_matrix] at hm ++ simp [gamma_add] at hm ++ conv at hm => ++ rhs ++ equals 0 => rfl ++ ++ ++ apply_fun (fun f => (f).toMul) at hm ++ conv at hm => ++ rhs ++ equals 1 => rfl ++ ++ rw [← neg_sub] at hm ++ rw [neg_pow] at hm ++ simp at hm ++ rw [Module.End.mul_eq_comp] at hm ++ simp at hm ++ simp [Function.comp_def] at hm ++ apply (LinearMap.ker_eq_bot'.mp (by ++ ext a ++ clear hm ++ induction n with ++ | zero => simp ++ | succ n ih => ++ rw [pow_succ] ++ simp ++ simp at ih ++ exact ih ++ )) at hm ++ rw [← toMul_eq_one] at hm ++ rw [← hm] ++ clear hm ++ ++ have x_mul_gamma_eq: ∀ q: ℕ, (fun x => x * (⇑gamma_lift)^[q] x⁻¹) = Additive.toMul ∘ (-((MonoidHom.toAdditive gamma_lift.toMonoidHom).toIntLinearMap ^ (q) - LinearMap.id)).toFun ∘ (Additive.ofMul) := by ++ intro q ++ ext x ++ conv => ++ rhs ++ equals Additive.toMul ((-((MonoidHom.toAdditive gamma_lift.toMonoidHom).toIntLinearMap ^ (q) - LinearMap.id)).toFun (Additive.ofMul x)) => ++ rfl ++ simp ++ rw [toIntLinearMap_pow_apply] ++ simp ++ rw [Function.comp_def] ++ rw [div_eq_mul_inv] ++ simp ++ rfl ++ ++ rw [x_mul_gamma_eq] ++ simp ++ rw [Module.End.coe_pow] ++ -- collapse the `Matrix.toLin B B (LinearMap.toMatrix B B _)` round-trip, which plain ++ -- `rfl` cannot see through ++ rw [Matrix.toLin_toMatrix] ++ ++ have mul_eq: a * r * p = p * r * a := by ring ++ simp_rw [mul_eq] ++ rfl ++ ++lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N': Subgroup H} [_N'_normal: N'.Normal] (N'_nilpotent: Group.IsNilpotent N') (hN': Subgroup.FG N') (gamma: MulAut N') + (gamma_conj: gamma_conj_bound gamma): + ∃ a, a ≠ 0 ∧ ∀ k: ℕ, 0 < k → ∃ n, ∀ g ∈ Subgroup.center N', Nat.iterate (fun x => x * ((gamma^[a*k]) x⁻¹)) n g = 1 := by + +@@ -163,47 +403,6 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N + let gamma_center := MulAut.characteristic (Subgroup.center N') gamma + have t_char: torsion.Characteristic := torsion_characteristic + let torsion_N := Subgroup.map (Subgroup.subtype _) torsion +- let gamma_torsion := MonoidHom.domRestrict gamma.toMonoidHom torsion_N +- let new_gamma_torsion_hom := MonoidHom.codRestrict gamma_torsion torsion_N (by +- rw [Subgroup.characteristic_iff_map_le] at t_char +- specialize t_char +- intro x +- simp [torsion_N] +- use ?_ +- . +- rw [CommGroup.mem_torsion] +- simp [gamma_torsion] +- rw [isOfFinOrder_iff_pow_eq_one] +- simp +- rw [← isOfFinOrder_iff_pow_eq_one] +- conv => +- arg 1 +- equals gamma.toMonoidHom x => +- simp +- apply MonoidHom.isOfFinOrder +- have x_prop := x.prop +- unfold torsion_N at x_prop +- simp [-SetLike.coe_mem] at x_prop +- obtain ⟨x_mem, x_mem_torsion⟩ := x_prop +- rw [CommGroup.mem_torsion] at x_mem_torsion +- rw [isOfFinOrder_iff_pow_eq_one] at x_mem_torsion +- simp at x_mem_torsion +- rw [← isOfFinOrder_iff_pow_eq_one] at x_mem_torsion +- simpa using x_mem_torsion +- . +- simp [gamma_torsion] +- have char_center := Subgroup.centerCharacteristic (G := N') +- rw [Subgroup.characteristic_iff_map_eq] at char_center +- specialize char_center gamma +- rw [← char_center] +- simp +- have x_prop := x.prop +- unfold torsion_N at x_prop +- simp [-SetLike.coe_mem] at x_prop +- obtain ⟨x_center, hx⟩ := x_prop +- exact x_center +- ) +- + let new_gamma_torsion := MulAut.characteristic torsion_N gamma + + +@@ -225,7 +424,7 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N + rw [Function.iterate_succ] + simp + rw [ih] +- simp [new_gamma_torsion, new_gamma_torsion_hom, gamma_torsion] ++ simp [new_gamma_torsion] + + + let gamma_lift := QuotientGroup.congr (torsion) torsion gamma_center (by +@@ -275,284 +474,27 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N + simp_rw [Function.iterate_succ'] + simp + +- have unipotent_on_quot: ∃ a, 0 < a ∧ ∀ p: ℕ, 0 < p → ∃ n, ∀ g : (Subgroup.center ↥N') ⧸ torsion, Nat.iterate (fun x => x * ((gamma_lift^[a * orderOf new_gamma_torsion * p] x⁻¹))) n g = 1 := by +- wlog nontrivial_quot: Nontrivial ((Subgroup.center ↥N') ⧸ torsion) +- . +- clear this +- simp at nontrivial_quot +- use 1 +- refine ⟨by simp, ?_⟩ +- intro p hp +- use 1 +- simp +- intro g +- have quot_subsingelton: Subsingleton ((Subgroup.center ↥N') ⧸ torsion) := by +- rw [QuotientGroup.subsingleton_iff] +- exact nontrivial_quot +- +- have g_eq := Subsingleton.eq_one g +- simp [g_eq] +- +- +- let foo: CommGroup (Subgroup.center N') := by infer_instance +- -- if the additive picture is wanted, this is *definitionally* the same type: +- have add_torsion_free: IsAddTorsionFree +- (Additive ↥(Subgroup.center ↥N') ⧸ AddCommGroup.torsion (Additive ↥(Subgroup.center ↥N'))) := by +- infer_instance +- +- let add_quot := (Additive ↥(Subgroup.center ↥N') ⧸ AddCommGroup.torsion (Additive ↥(Subgroup.center ↥N'))) +- +- +- let fin_dim: Module.Finite ℤ add_quot := by infer_instance +- +- let gamma_add := gamma_lift.toAdditive.toAddMonoidHom.toIntLinearMap +- let B := (Module.finBasis ℤ (Additive (↥(Subgroup.center ↥N') ⧸ torsion))) +- let gamma_matrix := gamma_add.toMatrix B B +- have invertible_gamma: Invertible gamma_matrix := { +- invOf := ((gamma_lift.toAdditive).symm.toAddMonoidHom).toIntLinearMap.toMatrix B B +- invOf_mul_self := by +- simp [gamma_matrix, gamma_add] +- rw [← LinearMap.toMatrix_mul] +- rw [← toIntLinearMap_comp_mul] +- simp +- mul_invOf_self := by +- simp [gamma_matrix, gamma_add] +- rw [← LinearMap.toMatrix_mul] +- rw [← toIntLinearMap_comp_mul] +- simp +- } +- +- let dim := Module.finrank ℤ (Additive (↥(Subgroup.center ↥N') ⧸ torsion)) +- let equiv (v: Fin _ → ℤ) := (Finsupp.linearEquivFunOnFinite ℤ _ (Fin dim)).symm v +- let remap (v: Fin _ → ℤ) := Finsupp.linearCombination _ B (equiv v) +- +- have gamma_matrix_mulVec: ∀ v: (Fin dim) → ℤ , remap ((gamma_matrix).mulVec (equiv v)) = Additive.ofMul (gamma_lift (Additive.toMul (remap v))) := by +- intro v +- unfold gamma_matrix +- rw [← Module.Basis.repr_linearCombination (v := (equiv v)) (b := B)] +- rw [LinearMap.toMatrix_mulVec_repr] +- simp [remap, gamma_add, equiv] +- +- +- have gamma_matrix_mulVec_pow: ∀ n: ℕ, ∀ v: (Fin dim) → ℤ , remap ((gamma_matrix^n).mulVec (equiv v)) = Additive.ofMul (gamma_lift^[n] (Additive.toMul (remap v))) := by +- intro n +- induction n with +- | zero => +- intro v +- simp [remap, equiv] +- | succ n ih => +- intro v +- rw [Function.iterate_succ_apply', pow_succ', ← Matrix.mulVec_mulVec] +- rw [show ((gamma_matrix ^ n).mulVec ⇑(equiv v)) +- = ⇑(equiv ((gamma_matrix ^ n).mulVec ⇑(equiv v))) from rfl] +- rw [gamma_matrix_mulVec, ih] +- rfl +- +- +- have rank_nonzero: NeZero (Module.finrank ℤ (Additive (↥(Subgroup.center ↥N') ⧸ torsion))) := by +- apply NeZero.of_pos +- apply Module.finrank_pos +- +- +- have gamma_lift_conj: ∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → (Finset.image (fun x ↦ (List.map (fun (i: ↥(Finset.Ico a b)) ↦ (gamma_lift)^[k * ↑i] g) x.toList).prod) +- (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q := by +- +- -- Same shape as the `final_gamma` transport: the products live in +- -- `↥(Subgroup.center ↥N')`, mapped out injectively by `Subgroup.subtype` (where +- -- `gamma_conj` gives the bound) and surjectively by `QuotientGroup.mk'` (where it +- -- is wanted). +- classical +- exact conjBound_transport +- (fC := fun x : ↥(Subgroup.center ↥N') => +- (⟨gamma x, gamma_mem_center x⟩ : ↥(Subgroup.center ↥N'))) +- (fQ := ⇑gamma_lift) (fN := ⇑gamma) +- (QuotientGroup.mk' torsion) (QuotientGroup.mk'_surjective _) +- ((Subgroup.center ↥N').subtype) (Subgroup.subtype_injective _) +- (fun x => (swap_gamma_lift x).symm) (fun x => rfl) gamma_conj +- +- have eigen_norm_one: ∀ (k : Module.End.Eigenvalues (Matrix.toLin' (((unitOfInvertible gamma_matrix).val).map (Int.castRingHom ℂ)))), ‖k.val‖ = 1 := by +- apply int_matrix_poly_growth_eigenvalue +- . +- intro k hk v +- -- name the (fixed) group element the iterates are applied to +- set g : ↥(Subgroup.center ↥N') ⧸ torsion := +- Additive.toMul ((Finsupp.linearCombination ℤ ⇑B) +- ((Finsupp.linearEquivFunOnFinite ℤ ℤ (Fin dim)).symm v)) with hg +- +- +- obtain ⟨p, q, p_pos, hq⟩ := gamma_lift_conj ⌈Real.logb ‖k‖ 3⌉₊ (by +- simp +- apply Real.logb_pos +- . grind +- . grind +- ) g +- let K: ℕ := (⌈4 * ((8 * ↑q + Real.log ↑p) ^ 2 / Real.log 2 ^ 2) ^ 2⌉₊ + 2 * ⌈Real.logb ‖k‖ 3⌉₊) + 1 +- +- +- have hpq := hq K (by simp [K]) ⌈Real.logb ‖k‖ 3⌉₊ (by +- simp +- apply Real.logb_pos +- . grind +- . grind +- ) (by +- simp [K] +- rw [two_mul] +- grw [Nat.le_ceil (a := Real.logb ‖k‖ 3)] +- grind +- ) +- +- use p * K ^ q +- use q +- use K +- +- refine ⟨?_, ?_, ?_, ?_⟩ +- . apply mul_pos +- . exact p_pos +- . apply pow_pos +- simp [K] +- +- . simp [K] +- rw [two_mul] +- grw [Nat.le_ceil (a := Real.logb ‖k‖ 3)] +- grind +- . +- -- Isolate `K` on the right of +- -- `X < Real.log 2 * (↑K - ↑⌈Real.logb ‖k‖ 3⌉₊) ^ (1/2)`. +- -- Divide by `Real.log 2 > 0`, bound the LHS by its absolute value (so no sign +- -- assumption on `X` is needed), rewrite `|y| = √(y ^ 2)` and use strict +- -- monotonicity of `√`, then move the subtraction across. `K` is never unfolded. +- have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) +- rw [← Real.sqrt_eq_rpow, ← div_lt_iff₀' hlog2] +- refine lt_of_le_of_lt (le_abs_self _) ?_ +- rw [← Real.sqrt_sq_eq_abs] +- refine Real.sqrt_lt_sqrt (sq_nonneg _) ?_ +- rw [lt_sub_iff_add_lt] +- -- `K` still occurs on the left inside `Real.log ↑(p * K ^ q)`. This splits that +- -- logarithm and eliminates the resulting `Real.log ↑K`, leaving a goal in `ℕ` with +- -- `K` alone on the right. +- refine log_pow_sq_lt_of_lt _ p q K p_pos ?_ +- -- ⊢ ⌈4 * ((8 * ↑q + Real.log ↑p) ^ 2 / Real.log 2 ^ 2) ^ 2⌉₊ +- -- + 2 * ⌈Real.logb ‖k‖ 3⌉₊ < K +- simp [K] +- . +- rw [← (Finset.card_image_iff (f := fun a => remap (Finsupp.equivFunOnFinite.symm a))).mpr] +- . +- rw [Finset.image_image] +- simp [remap, equiv] +- rw [Function.comp_def] +- simp_rw [map_sum] +- simp [remap, equiv] at gamma_matrix_mulVec_pow +- simp_rw [← pow_mul] +- simp_rw [gamma_matrix_mulVec_pow] +- -- Turn each subsum into `Additive.ofMul` of a product in the group, keeping the +- -- index set as the subtype `↥(Finset.Ico N_1 N_2)`. +- simp_rw [← ofMul_prod] +- -- `Additive.ofMul` is a bijection, so it does not affect the cardinality: pull it +- -- out of the image and discard it. +- rw [← Function.comp_def Additive.ofMul, ← Finset.image_image, +- Finset.card_image_of_injective _ (Equiv.injective _)] +- +- +- simp_rw [← Finset.prod_map_toList] +- +- grw [hpq] +- -- TODO - we might be able to make the goal stronger, if we don't actually need the factor of 2 in it +- rw [pow_mul'] +- apply mul_le_mul +- . simp +- . apply Nat.le_pow +- simp +- . simp +- . simp +- . apply Function.Injective.injOn +- intro a b hab +- simp [remap, equiv] at hab +- rw [Function.Injective.eq_iff (linearIndependent_iff_injective_finsuppLinearCombination.mp ?_)] at hab +- . simpa using hab +- . apply Module.Basis.linearIndependent +- +- +- let a := KroneckerPow (unitOfInvertible gamma_matrix) eigen_norm_one +- use a +- refine ⟨(by +- apply KroneckerPow_pos +- ), ?_⟩ +- intro p hp +- +- +- have unipotent_gamma_matrix := int_matrix_unipotent (by +- apply Module.finrank_pos +- ) (unitOfInvertible gamma_matrix) (by +- apply eigen_norm_one +- ) (n := p * orderOf new_gamma_torsion) (hn := by positivity) +- obtain ⟨n, hm⟩ := unipotent_gamma_matrix +- +- +- use n +- intro g +- apply_fun (fun f => f.toLin (Module.finBasis _ _) (Module.finBasis _ _)) at hm +- rw [LinearMap.ext_iff] at hm +- specialize hm g +- simp [gamma_matrix] at hm +- simp [gamma_add] at hm +- conv at hm => +- rhs +- equals 0 => rfl +- +- +- apply_fun (fun f => (f).toMul) at hm +- conv at hm => +- rhs +- equals 1 => rfl +- +- rw [← neg_sub] at hm +- rw [neg_pow] at hm +- simp at hm +- rw [Module.End.mul_eq_comp] at hm +- simp at hm +- simp [Function.comp_def] at hm +- apply (LinearMap.ker_eq_bot'.mp (by +- ext a +- clear hm +- induction n with +- | zero => simp +- | succ n ih => +- rw [pow_succ] +- simp +- simp at ih +- exact ih +- )) at hm +- rw [← toMul_eq_one] at hm +- rw [← hm] +- clear hm +- +- have x_mul_gamma_eq: ∀ q: ℕ, (fun x => x * (⇑gamma_lift)^[q] x⁻¹) = Additive.toMul ∘ (-((MonoidHom.toAdditive gamma_lift.toMonoidHom).toIntLinearMap ^ (q) - LinearMap.id)).toFun ∘ (Additive.ofMul) := by +- intro q +- ext x +- conv => +- rhs +- equals Additive.toMul ((-((MonoidHom.toAdditive gamma_lift.toMonoidHom).toIntLinearMap ^ (q) - LinearMap.id)).toFun (Additive.ofMul x)) => +- rfl +- simp +- rw [toIntLinearMap_pow_apply] +- simp +- rw [Function.comp_def] +- rw [div_eq_mul_inv] +- simp +- rfl +- +- rw [x_mul_gamma_eq] +- simp +- rw [Module.End.coe_pow] +- -- collapse the `Matrix.toLin B B (LinearMap.toMatrix B B _)` round-trip, which plain +- -- `rfl` cannot see through +- rw [Matrix.toLin_toMatrix] +- +- -- TODO - figure out how the order gets swapped +- have mul_eq: a * orderOf new_gamma_torsion * p = p * orderOf new_gamma_torsion * a := by ring +- simp_rw [mul_eq] +- rfl +- ++ have gamma_lift_conj: ∀ k: ℕ, (0 < k) → ∀ g, ∃ p q: ℕ, 0 < p ∧ ∀ b: ℕ, 0 < b → ∀ a: ℕ, (0 < a) → (a < b) → (Finset.image (fun x ↦ (List.map (fun (i: ↥(Finset.Ico a b)) ↦ (gamma_lift)^[k * ↑i] g) x.toList).prod) ++ (Finset.Ico a b).attach.powerset).card ≤ p * (b^q) * (b - a)^q := by ++ ++ -- Same shape as the `final_gamma` transport: the products live in ++ -- `↥(Subgroup.center ↥N')`, mapped out injectively by `Subgroup.subtype` (where ++ -- `gamma_conj` gives the bound) and surjectively by `QuotientGroup.mk'` (where it ++ -- is wanted). ++ classical ++ exact conjBound_transport ++ (fC := fun x : ↥(Subgroup.center ↥N') => ++ (⟨gamma x, gamma_mem_center x⟩ : ↥(Subgroup.center ↥N'))) ++ (fQ := ⇑gamma_lift) (fN := ⇑gamma) ++ (QuotientGroup.mk' torsion) (QuotientGroup.mk'_surjective _) ++ ((Subgroup.center ↥N').subtype) (Subgroup.subtype_injective _) ++ (fun x => (swap_gamma_lift x).symm) (fun x => rfl) gamma_conj ++ ++ have unipotent_on_quot : ∃ a, 0 < a ∧ ∀ p : ℕ, 0 < p → ∃ n, ++ ∀ g : (Subgroup.center ↥N') ⧸ torsion, ++ (fun x ↦ x * gamma_lift^[a * orderOf new_gamma_torsion * p] x⁻¹)^[n] g = 1 := ++ free_abelian_gamma_unipotent gamma_lift (orderOf new_gamma_torsion) order_pos ++ gamma_lift_conj + + obtain ⟨quot_pow, quot_pow_pos, h_quot_pow⟩ := unipotent_on_quot + use (quot_pow * ( orderOf new_gamma_torsion)) +@@ -587,8 +529,8 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N + simp + have mul_mem_center: (↑g * ((gamma ^ (quot_pow * orderOf new_gamma_torsion * p )) ↑g)⁻¹) ∈ Subgroup.center N' := by + apply Subgroup.mul_mem +- . simp +- . ++ · simp ++ · + simp + have center_char: (Subgroup.center N').Characteristic := by + infer_instance +@@ -639,8 +581,6 @@ lemma exists_gamma_n_unipotent_center_N' {H: Type*} [DecidableEq H] [Group H] {N + -- OLD CODE + + +-set_option maxHeartbeats 2000000 in +-set_option synthInstance.maxHeartbeats 160000 in + /--{G: Type*} [DecidableEq G] [Group G] (H: Subgroup G) [H.Normal]--/ + lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subgroup H} [N'_normal: N'.Normal] (N'_nilpotent: Group.IsNilpotent N') (hN': Subgroup.FG N') (gamma: MulAut N') (gamma_conj: gamma_conj_bound gamma): + ∀ p: ℕ, 0 < p → ∃ a n, a ≠ 0 ∧ ∀ g : N', Nat.iterate (fun x => x * ((gamma^[a*p]) x⁻¹)) n g = 1 := by +@@ -648,7 +588,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg + + classical + by_cases N'_subsingle: Subsingleton N' +- . ++ · + intro p hp + use 1 + use 1 +@@ -656,7 +596,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg + intro a ha + have order := Subsingleton.orderOf_eq (⟨_, ha⟩ : N') + simp at order +- simp [order, iteratedCommutator] ++ simp [order] + rw [mul_aut_iterate] + simp + +@@ -679,7 +619,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg + let final_gamma := aut_transfer gamma_quot + + by_cases top_subsingle: Subsingleton (⊤ : Subgroup (↥N' ⧸ Subgroup.center ↥N')) +- . ++ · + intro p hp + obtain ⟨z_a, h_z_a, z_a_temp⟩ := exists_gamma_n_unipotent_center_N' (N' := N') (N'_nilpotent) (hN') gamma gamma_conj + obtain ⟨z_n, h_z_unipotent⟩ := z_a_temp p hp +@@ -702,12 +642,12 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg + + have foo := ih (Group.nilpotencyClass (⊤ : Subgroup (↥N' ⧸ Subgroup.center ↥N'))) (by + grw [Subgroup.nilpotencyClass_le] +- simp [nilpotencyClass_quotient_center] ++ simp [Group.nilpotencyClass_quotient_center] + rw [← hn] + simp + by_contra! + simp at this +- rw [nilpotencyClass_zero_iff_subsingleton] at this ++ rw [Group.nilpotencyClass_zero_iff_subsingleton] at this + contradiction + ) (H := N' ⧸ Subgroup.center N') (N' := ⊤) (by simp; apply Group.nilpotent_quotient_of_nilpotent) (by + have fg_quot: Group.FG (↥N' ⧸ Subgroup.center ↥N') := by +@@ -746,7 +686,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg + rw [Function.iterate_add_apply] + + specialize h_z_unipotent ((fun x ↦ x * ((gamma^[a*z_a*p]) (x⁻¹)))^[n] g) ?_ +- . ++ · + + have swap_gamma_base: ∀ x, (gamma) x = ((final_gamma) ⟨x, by simp⟩).val := by + intro x +@@ -787,7 +727,7 @@ lemma exists_gamma_n_unipotent_N' {H: Type*} [DecidableEq H] [Group H] {N': Subg + simpa using h_prev + + +- . ++ · + simp_rw [mul_aut_iterate] at h_z_unipotent + rw [mul_aut_iterate] + simp_rw [← mul_assoc] at h_z_unipotent +diff --git a/Gromov/UnipotentGromov.lean b/Gromov/UnipotentGromov.lean +index f90d0aa..13fc5f8 100644 +--- a/Gromov/UnipotentGromov.lean ++++ b/Gromov/UnipotentGromov.lean +@@ -13,9 +13,6 @@ Root of the `Gromov.Unipotent` hierarchy. + + public section + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false +-set_option linter.style.cdot false + + open scoped commutatorElement IsMulCommutative Pointwise + +@@ -31,8 +28,8 @@ lemma normal_comm_mem_right {G: Type*} [Group G] {N: Subgroup G} (N_normal: N.No + equals (a * b * a⁻¹) * b⁻¹ => group + + apply Subgroup.mul_mem +- . exact conj_mem +- . simpa using hb ++ · exact conj_mem ++ · simpa using hb + + + lemma iterated_mem_iterated_set {G: Type*} [DecidableEq G] [Group G] (base right: G) (S: Finset G) (base_mem: base ∈ S) (right_mem: right ∈ S) (n: ℕ): iteratedCommutator base right n ∈ iterate_comm_set S n := by +@@ -63,19 +60,18 @@ lemma comm_subgroup_mem {G: Type*} [DecidableEq G] [Group G] {H: Subgroup G} (S: + simp + | succ n ih => + simp [iterate_comm_set] +- intro h h_mem h_mem_s +- intro a ha ++ intro h h_mem h_mem_s a ha + simp + have a_mem := ih ha + simp [Bracket.bracket] + apply Subgroup.mul_mem +- . apply Subgroup.mul_mem +- . apply Subgroup.mul_mem +- . exact a_mem +- . exact h_mem +- . simp ++ · apply Subgroup.mul_mem ++ · apply Subgroup.mul_mem ++ · exact a_mem ++ · exact h_mem ++ · simp + exact a_mem +- . simp ++ · simp + exact h_mem + + +@@ -88,39 +84,39 @@ lemma iterate_comm_subgroup {G: Type*} [DecidableEq G] [Group G] {H: Subgroup G} + dsimp [iterate_comm_set] + simp + refine ⟨?_, ?_⟩ +- . ++ · + intro h_mem + obtain ⟨b, b_mem, ⟨b_mem_S, a, h_eq⟩⟩ := h_mem + obtain ⟨a_mem_h, a_mem_comm, h_eq_comm⟩ := h_eq + use b + use ?_ +- . use a ++ · use a + refine ⟨?_, ?_⟩ +- . ++ · + rw [ih] at a_mem_comm + simp at a_mem_comm + exact a_mem_comm +- . rw [← h_eq_comm] ++ · rw [← h_eq_comm] + simp [Bracket.bracket] +- . use b_mem +- . intro data_mem ++ · use b_mem ++ · intro data_mem + obtain ⟨b, ⟨b_mem_H, b_mem_S⟩, ⟨a, a_mem_comm, h_eq⟩⟩ := data_mem + use b + use b_mem_H + refine ⟨?_, ?_⟩ +- . exact b_mem_S +- . use a ++ · exact b_mem_S ++ · use a + use ?_ +- . refine ⟨?_, ?_⟩ +- . ++ · refine ⟨?_, ?_⟩ ++ · + rw [ih] + simp + exact a_mem_comm +- . ++ · + ext + rw [← h_eq] + simp [Bracket.bracket] +- . ++ · + simp [Bracket.bracket] at h_eq + have iterate_subset := comm_subgroup_mem S n a_mem_comm + simpa using iterate_subset +@@ -171,29 +167,29 @@ lemma count_mem_group_implies_lowercentral {G: Type*} [Group G] {N': Subgroup G} + simp at l_nonempty + | cons head tail ih => + by_cases head_in_N': head ∈ N' +- . +- simp only [List.countP_cons, List.foldr_cons, head_in_N', decide_true, if_true, ++ · ++ simp only [List.countP_cons, List.foldr_cons, head_in_N', decide_true, ite_true, + Nat.add_sub_cancel] + by_cases tail_empty: tail = [] +- . ++ · + simp [tail_empty] + apply normal_comm_mem_right N'_normal + exact head_in_N' +- . ++ · + + by_cases count_eq_zero: (tail.countP (fun a => decide (a ∈ N'))) = 0 +- . ++ · + simp [count_eq_zero] + apply normal_comm_mem_right N'_normal + exact head_in_N' +- . ++ · + have count_sub_eq: (tail.countP (fun a => decide (a ∈ N'))) = (tail.countP (fun a => decide (a ∈ N'))) - 1 + 1 := by + omega + + rw [count_sub_eq] + specialize ih (by simpa using tail_empty) count_eq_zero + exact Subgroup.commutator_mem_commutator ih head_in_N' +- . rw [List.countP_cons] ++ · rw [List.countP_cons] + simp only [head_in_N', decide_false, Bool.false_eq_true, ↓reduceIte] + + +@@ -208,11 +204,10 @@ lemma count_mem_group_implies_lowercentral {G: Type*} [Group G] {N': Subgroup G} + specialize ih tail_nonempty count_ne_zero + rw [List.foldr_cons] + apply normal_comm_mem +- . infer_instance +- . exact ih ++ · infer_instance ++ · exact ih + + +-#print axioms count_mem_group_implies_lowercentral + + + -- `Subgroup.map_toSubmonoid` rewrites the `.carrier` predicate of `Subgroup.map`, which breaks the +@@ -229,22 +224,22 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + classical + + by_cases m_eq: m = 0 +- . ++ · + simp [iteratedCommutator, m_eq] at h_gamma_alpha + have N'_bot: N' = ⊥ := by + rw [Subgroup.eq_bot_iff_forall] + simpa using h_gamma_alpha + + +- let foo := Subgroup.closureCommGroupOfComm (k := (↑(Finset.image (⇑H.subtype) S) ∪ {gamma_alpha})) ?_ +- . ++ have foo := Subgroup.isMulCommutative_closure (k := (↑(Finset.image (⇑H.subtype) S) ∪ {gamma_alpha})) ?_ ++ · + + apply CommGroup.isNilpotent +- . intro x hx y hy ++ · intro x hx y hy + by_cases S_empty: S = ∅ +- . simp [S_empty] at hx hy ++ · simp [S_empty] at hx hy + grind +- . ++ · + have S_eq: S = {1} := by + simp only [N'_bot, Subgroup.closure_eq_bot_iff] at hS + have S_subset: S ⊆ {1} := by +@@ -265,10 +260,10 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + + have nilpotent_map: Group.IsNilpotent ↥(Subgroup.map H.subtype N') := by + apply map_nilpotent +- . exact Subgroup.subtype_injective H +- . exact N'_nilpotent ++ · exact Subgroup.subtype_injective H ++ · exact N'_nilpotent + +- rw [nilpotent_iff_lowerCentralSeries] ++ rw [Subgroup.nilpotent_iff_lowerCentralSeries] + use ((1 + (Group.nilpotencyClass ↥(Subgroup.map H.subtype N'))) * (m + 1)) + 2 + + apply comm_trivial_implies_nilpotent (S := Finset.image (fun (a: ↑((Finset.image (Subgroup.subtype _) S) ∪ {gamma_alpha})) => ⟨a.val, by ( +@@ -278,7 +273,7 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + simp + exact a_prop + )⟩) Finset.univ) +- . ++ · + + + simp only [Finset.coe_image, Finset.coe_univ, Set.image_univ] +@@ -297,7 +292,7 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + · intro hg + exact ⟨⟨g, by apply Subgroup.mem_closure_of_mem; exact hg⟩, + ⟨⟨g, by simpa using hg⟩, rfl⟩, rfl⟩ +- . ++ · + ext a + rw [iterate_comm_subgroup] + +@@ -312,11 +307,11 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + exact Finset.attach_image_val + + refine ⟨?_, ?_⟩ +- . ++ · + intro a_mem + rw [← Finset.mem_coe] at a_mem + rw [iterate_comm_set_eq_fold] at a_mem +- simp only [Set.mem_setOf_eq] at a_mem ++ simp only [Set.mem_ofPred_eq] at a_mem + obtain ⟨s, l, l_length, a_eq⟩ := a_mem + + -- TODO - extract this to its own lemma +@@ -341,22 +336,21 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + rw [Function.iterate_succ'] + simp + apply normal_comm_mem +- . infer_instance +- . exact ih ++ · infer_instance ++ · exact ih + + have comm_in_N': (fun x ↦ ⁅x, gamma_alpha⁆)^[t] g ∈ (Subgroup.map (Subgroup.subtype _) N') := by + clear ht + induction t with + | zero => +- simpa using g_mem ++ simp + | succ t ih => + simp_rw [Function.iterate_succ'] +- simp only [Function.comp_apply, Subgroup.subtype_apply, +- Subtype.exists, exists_and_right, exists_eq_right] ++ simp only [Function.comp_apply] + apply normal_comm_mem +- . ++ · + infer_instance +- . exact ih ++ · exact ih + + simp at comm_in_N' + obtain ⟨foo, bar⟩ := comm_in_N' +@@ -367,7 +361,7 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + have adjacent_or_count := list_adjacent_elements l (fun x => decide (x = gamma_alpha)) (m + 1) + rw [l_length] at adjacent_or_count + cases adjacent_or_count +- . ++ · + rename_i adjancent_gamma + obtain ⟨gamma_list, h_gamma_list, gamma_list_len, eq_gamma_alpha⟩ := adjancent_gamma + +@@ -406,10 +400,10 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + have s_mem := s.property + rw [Finset.mem_union] at s_mem + cases s_mem +- . rename_i s_mem_N' ++ · rename_i s_mem_N' + rw [subsequent_comm_one] +- . rw [list_fold_comm_one] +- . ++ · rw [list_fold_comm_one] ++ · + clear h_list_eq + induction l_suffix with + | nil => +@@ -420,9 +414,9 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + | cons head tail ih => + simp + apply normal_comm_mem +- . infer_instance +- . exact ih +- . ++ · infer_instance ++ · exact ih ++ · + clear h_list_eq + rw [← Subgroup.mem_map_iff_mem (f := H.subtype) (Subgroup.subtype_injective H)] + induction l_suffix with +@@ -437,9 +431,9 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + simp [-Subgroup.mem_map] + apply normal_comm_mem (by infer_instance) + exact ih +- . rw [List.length_unattach] ++ · rw [List.length_unattach] + omega +- . ++ · + rename_i s_eq_gamma + simp at s_eq_gamma + rw [s_eq_gamma] +@@ -463,23 +457,23 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + rw [Finset.mem_union] at head_prop + + cases head_prop +- . ++ · + rename_i head_in_N + rw [Set.mem_union] at ih + apply Set.mem_union_left + apply normal_comm_mem (by infer_instance) + apply normal_comm_mem_right (by infer_instance) + exact image_sub_map _ head_in_N +- . rename_i head_gamma ++ · rename_i head_gamma + simp at head_gamma + cases ih +- . rename_i left ++ · rename_i left + simp only [List.unattach_cons, List.foldr_cons] + rw [head_gamma] + apply Set.mem_union_left + apply normal_comm_mem (by infer_instance) + exact left +- . ++ · + rename_i right + apply Set.mem_union_left + simp at right +@@ -490,17 +484,17 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + + rw [Set.mem_union] at fold_mem + cases fold_mem +- . rename_i fold_in_N ++ · rename_i fold_in_N + simp at fold_in_N + rw [subsequent_comm_one] +- . rw [list_fold_comm_one] +- . ++ · rw [list_fold_comm_one] ++ · + obtain ⟨foo, bar⟩ := fold_in_N + exact foo +- . obtain ⟨foo, bar⟩ := fold_in_N ++ · obtain ⟨foo, bar⟩ := fold_in_N + exact bar +- . omega +- . rename_i fold_eq_gamma ++ · omega ++ · rename_i fold_eq_gamma + simp at fold_eq_gamma + rw [fold_eq_gamma] + +@@ -512,13 +506,13 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + rw [nat_iterate_comm_one] + rw [list_fold_comm_one] + +- . ++ · + rename_i count_not_gamma + simp at count_not_gamma + rw [mul_comm] at count_not_gamma + rw [Nat.mul_add_div] at count_not_gamma + rw [Nat.div_eq_of_lt] at count_not_gamma +- . simp at count_not_gamma ++ · simp at count_not_gamma + + refine Finset.mem_singleton.mpr ?_ + ext +@@ -534,19 +528,19 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + congr + simp + refine ⟨?_, ?_⟩ +- . intro hx other ++ · intro hx other + rw [← hx] at gamma_not_n + simp at gamma_not_n + apply gamma_not_n other +- . intro hx ++ · intro hx + have x_prop := x.prop + rw [Finset.mem_union] at x_prop +- simp [hx] at x_prop ++ simp at x_prop + cases x_prop +- . rename_i mem_N' ++ · rename_i mem_N' + obtain ⟨mem_H, mem_N⟩ := mem_N' + exact absurd (S_sub_N' _ mem_N) (hx mem_H) +- . rename_i x_eq ++ · rename_i x_eq + exact x_eq + + +@@ -561,11 +555,11 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + + + have foo := count_mem_group_implies_lowercentral (N' := (Subgroup.map H.subtype N')) (by infer_instance) l.unattach s ?_ ?_ +- . ++ · + rw [Subgroup.lowerCentralSeries_eq_bot_of_nilpotencyClass_le (by omega)] at foo + simpa using foo + +- . ++ · + -- TODO - this is ridiculously overcomplicated + + have l_len_ne: l.length ≠ 0 := by +@@ -573,10 +567,10 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + + + grind +- . omega +- . omega +- . omega +- . ++ · omega ++ · omega ++ · omega ++ · + intro a_eq + replace a_eq : a = 1 := Finset.mem_singleton.mp a_eq + -- `S` need not contain `1`, so start the iterated commutator at `gamma_alpha` +@@ -593,4 +587,3 @@ lemma unipotent_commutator_trivial {G: Type*} [DecidableEq G] [Group G] (H: Subg + rw [a_eq] + simpa using iterate_mem + +-#print axioms unipotent_commutator_trivial +diff --git a/Gromov/Unitary/Basic.lean b/Gromov/Unitary/Basic.lean +index afa60f5..b159646 100644 +--- a/Gromov/Unitary/Basic.lean ++++ b/Gromov/Unitary/Basic.lean +@@ -16,8 +16,6 @@ public section + + open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false + + open Subgroup Pointwise Finset + open scoped Pointwise Finset +@@ -190,7 +188,6 @@ lemma poly_growth_equiv {G: Type*} [DecidableEq G] [Group G] (a d: ℕ) + exact Nat.one_le_pow d n hn + + +-#print axioms poly_growth_equiv + + + -- Lemma 3.29 (Shrinking Conjugators) +@@ -247,7 +244,6 @@ instance unitary_proper (n : ℕ) : ProperSpace ↥(Matrix.unitaryGroup (Fin n) + apply ProperSpace.of_isClosed + apply unitary_closed + +-#synth Nontrivial (Matrix (Fin 1) (Fin 1) ℂ) + + + @[expose] +@@ -363,16 +359,15 @@ lemma small_dist_matrix (n : ℕ) (hn : 2 ≤ n) : + linarith + · simp [dists] + apply Set.Finite.image +- apply Set.Finite.diff ++ apply Set.Finite.sdiff + apply Set.Finite.image + + + have finite_roots : Finite ↥(rootsOfUnity n ℂ) := by infer_instance +- -- TODO - how is this working??? + exact finite_roots +- · --have n_gt_one : 1 < n := by omega ++ · + simp [dists] +- rw [Set.diff_nonempty] ++ rw [Set.sdiff_nonempty] + simp + + let my_root : Units ℂ := { +@@ -413,6 +408,5 @@ lemma small_dist_matrix (n : ℕ) (hn : 2 ≤ n) : + norm_cast at abs_lt_one + linarith [Int.one_le_abs a_eq_zero] + +-#print axioms small_dist_matrix + + -- Lemma 3.31 (Volume Packing) +diff --git a/Gromov/Unitary/CentralTrivial.lean b/Gromov/Unitary/CentralTrivial.lean +index 817f510..ade1ee0 100644 +--- a/Gromov/Unitary/CentralTrivial.lean ++++ b/Gromov/Unitary/CentralTrivial.lean +@@ -13,8 +13,6 @@ public section + + open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false + + open Subgroup Pointwise Finset + open scoped Pointwise Finset +@@ -48,23 +46,23 @@ lemma H_n_contradiction (data : HnData) + simp [c'] + rw [Nat.one_le_iff_ne_zero] + apply Nat.mul_ne_zero +- . apply Nat.mul_ne_zero +- . apply Nat.mul_ne_zero +- . simp +- . ++ · apply Nat.mul_ne_zero ++ · apply Nat.mul_ne_zero ++ · simp ++ · + simp + apply c_mul_pos +- . omega +- . simp ++ · omega ++ · simp + ) + have lower_bound := H_n_ball_S_card m_gt data c c_pos c_lt + have ineq := le_trans lower_bound upper_bound + rify at ineq + rw [← Real.log_le_log_iff] at ineq +- . ++ · + simp at ineq + rw [Real.log_mul] at ineq +- . ++ · + simp at ineq + rw [Real.log_mul] at ineq + simp at ineq +@@ -83,17 +81,17 @@ lemma H_n_contradiction (data : HnData) + have log_m_gt: ↑data.S_poly_deg < Real.log ↑m := by + rw [← Real.exp_lt_exp] + rw [Real.exp_log] +- . ++ · + unfold m + apply Nat.lt_of_ceil_lt + apply lt_max_of_lt_right + simp +- . simp ++ · simp + omega + + + rw [Real.log_mul] +- . ++ · + rw [mul_add] + rw [add_comm] + rw [← add_assoc] +@@ -109,87 +107,80 @@ lemma H_n_contradiction (data : HnData) + rw [← lt_tsub_iff_right] + rw [← mul_sub] + rw [← div_lt_iff₀] +- . ++ · + dsimp [m] + apply Nat.lt_of_ceil_lt + apply lt_max_of_lt_left + apply lt_max_of_lt_right + simp +- . ++ · + simp + rw [lt_tsub_iff_right] + rw [← Real.exp_lt_exp] + rw [Real.exp_log] +- . +- rw [← gt_iff_lt] +- grw [(Nat.sub_one_lt_floor _).gt] +- rw [gt_iff_lt] +- rw [lt_tsub_iff_right] +- field_simp +- rw [lt_div_iff₀'] +- rw [← lt_div_iff₀] +- . +- exact eps_div_lt +- . positivity +- . apply H_n_eps_pos +- . ++ · ++ apply lt_trans ?_ (Nat.sub_one_lt_floor _) ++ rw [← div_eq_mul_inv, lt_sub_iff_add_lt, ++ lt_div_iff₀ (H_n_eps_pos data.hd)] ++ simpa only [mul_comm] using ++ (lt_div_iff₀ (show 0 < Real.exp (4 + ↑data.S_poly_deg * Real.log 2) + 1 by positivity)).mp eps_div_lt ++ · + simp + rw [Nat.floor_pos] + exact c_mul_pos +- . simp +- . simp +- . simp +- . ++ · simp ++ · simp ++ · simp ++ · + simp + refine ⟨by simp [c'], ?_⟩ + exact c_mul_pos +- . simp ++ · simp + omega + + unfold swap_le at reverse_ineq +- . linarith +- . have m_ne_zero: m ≠ 0 := by ++ · linarith ++ · have m_ne_zero: m ≠ 0 := by + omega + simp [c', m_ne_zero] + exact c_mul_pos + +- . simp ++ · simp + + +- . ++ · + exact Nat.cast_ne_zero.mpr (id (Ne.symm data.S_poly_const_pos)) +- . ++ · + + + apply ne_zero_of_pos + apply pow_pos + simp + apply mul_pos +- . ++ · + simp [c'] + rw [Nat.floor_pos] + exact c_mul_pos +- . exact Nat.cast_pos'.mpr m_gt +- . ++ · exact Nat.cast_pos'.mpr m_gt ++ · + norm_cast + apply Nat.pow_pos + rw [Nat.floor_pos] + exact c_mul_pos +- . ++ · + apply mul_pos +- . simp ++ · simp + exact Nat.zero_lt_of_ne_zero (id (Ne.symm data.S_poly_const_pos)) +- . ++ · + apply pow_pos + simp [c'] + apply mul_pos +- . simp ++ · simp + rw [Nat.floor_pos] + exact c_mul_pos +- . exact Nat.cast_pos'.mpr m_gt ++ · exact Nat.cast_pos'.mpr m_gt + + +-#print axioms H_n_contradiction + + -- Note - Vikman proves a much weaker statement (an upper boud n terms of 2^n) + -- The norms are actually bounded by a constant, which makes the rest of the proof easier +@@ -203,8 +194,302 @@ open scoped Pointwise + + + -- Theorem 3.8, case with only trivial elements in the center +-set_option synthInstance.maxHeartbeats 100000 in +-set_option maxHeartbeats 2200000 in ++private lemma small_finite_generators (n : ℕ) (hn : 2 ≤ n) ++ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) ++ (S_poly_data : SPolyData (G' n (H_n_eps hn) G)) : ++ ∃ S : Set G, (∀ s ∈ S, ‖s.val.val - 1‖ < H_n_eps hn) ∧ ++ S.Finite ∧ S = S⁻¹ ∧ Subgroup.closure S = G' n (H_n_eps hn) G ∧ 1 ∈ S := by ++ classical ++ let S' := S_poly_data.S ++ have S'_finite := S_poly_data.S_finite ++ ++ -- Add identity and inverses to S' to make things easier ++ let S'' := S' ++ have S''_finite: Set.Finite S'' := by ++ dsimp [S''] ++ apply S'_finite ++ ++ ++ have S''_eq_S''inv: S'' = S''⁻¹ := by ++ unfold S'' ++ apply S_poly_data.S_inv ++ ++ ++ have S''_generates: Subgroup.closure S'' = ⊤ := by ++ dsimp [S''] ++ apply S_poly_data.S_generates ++ ++ ++ have s_list (s: S'') := (mem_closure_prod_list ((Metric.ball (1 : G) (H_n_eps hn)) ∪ (Metric.ball (1 : G) (H_n_eps hn))⁻¹) (by ++ simp ++ rw [Set.union_comm] ++ ) s (by ++ have s_prop := s.val.property ++ simp only [G'] at s_prop ++ rw [Subgroup.closure_union] ++ simp [s_prop] ++ )) ++ ++ -- Write each element in S'' as a product of elements of S', and then collect all of the used elements into a set ++ -- We may need to manually union this with S⁻¹, since the inverse of the produces ++ -- could be chosen to be built with different elements (not the inverses of the ones in the original list) ++ let pre_S := ⋃ s : S''_finite.toFinset, ((s_list ⟨s, by ( ++ have foo := s.property ++ rw [Set.Finite.mem_toFinset] at foo ++ exact foo ++ )⟩).choose.unattach.toFinset : Set ↥G) ∪ {1} ++ let S := pre_S ∪ pre_S⁻¹ ∪ {1} ++ ++ have S_dist: ∀ s ∈ S, ‖s.val.val - 1‖ < H_n_eps hn := by ++ intro s hs ++ dsimp [S] at hs ++ ++ rw [Set.union_assoc] at hs ++ cases hs ++ · rename_i s_mem ++ dsimp [pre_S] at s_mem ++ rw [Set.mem_iUnion] at s_mem ++ obtain ⟨y, y_mem⟩ := s_mem ++ simp only [List.coe_toFinset, List.mem_unattach, Set.mem_union, Set.mem_inv, ++ Set.mem_ofPred_eq] at y_mem ++ obtain ⟨s_mem_S'', s_mem_choose⟩ := y_mem ++ simp at s_mem_S'' ++ simp only [Subtype.dist_eq, dist_eq_norm_sub] at s_mem_S'' ++ conv at s_mem_S'' => ++ right ++ arg 1 ++ arg 1 ++ equals (star s.val.val * 1 - (star s.val.val) * s.val.val) => ++ simp ++ ++ rw [← mul_sub] at s_mem_S'' ++ rw [← Unitary.coe_star] at s_mem_S'' ++ rw [CStarRing.norm_coe_unitary_mul] at s_mem_S'' ++ nth_rw 2 [norm_sub_rev] at s_mem_S'' ++ simp at s_mem_S'' ++ · exact s_mem_S'' ++ · ++ rename_i s_eq_one ++ simp at s_eq_one ++ simp [s_eq_one] ++ have foo := H_n_eps_pos hn ++ linarith ++ · ++ -- TODO - deduplicate most of this with the above case ++ rename_i s_mem ++ rw [Set.union_comm] at s_mem ++ cases s_mem ++ · rename_i s_mem_one ++ simp at s_mem_one ++ simp [s_mem_one] ++ apply H_n_eps_pos ++ ++ rename_i s_mem ++ dsimp [pre_S] at s_mem ++ rw [Set.iUnion_inv] at s_mem ++ rw [Set.mem_iUnion] at s_mem ++ obtain ⟨y, y_mem⟩ := s_mem ++ simp only [List.coe_toFinset, List.mem_unattach, Set.mem_union, Set.mem_inv, ++ Set.mem_ofPred_eq] at y_mem ++ obtain ⟨s_mem_S'', s_mem_choose⟩ := y_mem ++ simp at s_mem_S'' ++ simp only [Subtype.dist_eq, dist_eq_norm_sub] at s_mem_S'' ++ rw [or_comm] at s_mem_S'' ++ conv at s_mem_S'' => ++ right ++ arg 1 ++ arg 1 ++ equals (star s.val.val * 1 - (star s.val.val) * s.val.val) => ++ simp ++ ++ rw [← mul_sub] at s_mem_S'' ++ rw [← Unitary.coe_star] at s_mem_S'' ++ rw [CStarRing.norm_coe_unitary_mul] at s_mem_S'' ++ nth_rw 2 [norm_sub_rev] at s_mem_S'' ++ simp at s_mem_S'' ++ · exact s_mem_S'' ++ · ++ rename_i s_eq_one ++ simp at s_eq_one ++ simp [s_eq_one] ++ have foo := H_n_eps_pos hn ++ linarith ++ ++ ++ have S_finite: Set.Finite S := by ++ dsimp [S] ++ apply Set.Finite.union ++ · ++ simp ++ dsimp [pre_S] ++ apply Set.Finite.sUnion ++ · ++ apply Set.finite_range ++ · ++ intro y hy ++ rw [Set.mem_range] at hy ++ obtain ⟨x, x_mem, y_eq⟩ := hy ++ apply Set.Finite.union ++ · apply Finset.finite_toSet ++ · simp ++ · simp ++ ++ have S_union_Sinv: S ∪ S⁻¹ = S := by ++ dsimp [S] ++ simp [-Set.union_singleton] ++ grind ++ ++ have S_eq_Sinv: S = S⁻¹ := by ++ rw [← S_union_Sinv] ++ simp ++ rw [Set.union_comm] ++ ++ have S_generates : Subgroup.closure S = G' n (H_n_eps hn) G := by ++ apply le_antisymm ++ · apply (Subgroup.closure_le (K := G' n (H_n_eps hn) G)).2 ++ intro g hg ++ apply Subgroup.subset_closure ++ simpa only [Metric.mem_ball, Subtype.dist_eq, dist_eq_norm_sub, norm_sub_rev, ++ Subgroup.coe_one, Submonoid.coe_one] ++ using S_dist g hg ++ · have hgen : ∀ g : G' n (H_n_eps hn) G, g.val ∈ Subgroup.closure S := by ++ intro g ++ have hg : g ∈ Subgroup.closure S'' := by rw [S''_generates]; trivial ++ induction hg using Subgroup.closure_induction with ++ | mem g hg => ++ have hprod := (s_list ⟨g, hg⟩).choose_spec ++ rw [← hprod] ++ apply Subgroup.list_prod_mem ++ intro x hx ++ apply Subgroup.subset_closure ++ apply Set.mem_union_left ++ apply Set.mem_union_left ++ apply Set.mem_iUnion.mpr ++ refine ⟨⟨g, S''_finite.mem_toFinset.mpr hg⟩, Or.inl ?_⟩ ++ exact List.mem_toFinset.mpr hx ++ | one => exact Subgroup.one_mem _ ++ | mul x y hx hy hx' hy' => exact Subgroup.mul_mem _ hx' hy' ++ | inv x hx hx' => exact Subgroup.inv_mem _ hx' ++ intro g hg ++ exact hgen ⟨g, hg⟩ ++ ++ exact ⟨S, S_dist, S_finite, S_eq_Sinv, S_generates, by simp [S]⟩ ++ ++private lemma small_generators_growth (n : ℕ) (hn : 2 ≤ n) ++ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) ++ (S_poly_data : SPolyData (G' n (H_n_eps hn) G)) ++ (S : Set G) (S_finite : S.Finite) ++ (s_to_map : S_finite.toFinset → Subgroup.map G.subtype (G' n (H_n_eps hn) G)) ++ (h_map : ∀ a, (s_to_map a).val = a.val.val) : ++ ∃ a : ℕ, a ≥ 1 ∧ ∀ r ≥ 1, ++ #(Finset.image s_to_map S_finite.toFinset.attach ^ r) ≤ a * r ^ S_poly_data.S_poly_deg := by ++ classical ++ have poly_pos := S_poly_data.S_poly_const_pos ++ have new_try := poly_growth_equiv S_poly_data.S_poly_const S_poly_data.S_poly_deg (by omega) (S_poly_data.S_finite.toFinset) ++ (Finset.image (fun a => ⟨⟨(s_to_map a).val, by (rw [h_map]; exact a.val.property)⟩, by ( ++ have foo := (s_to_map a).property ++ rw [Subgroup.mem_map] at foo ++ obtain ⟨x, x_mem, x_eq⟩ := foo ++ simp_rw [← x_eq] ++ simp [x_mem] ++ )⟩) S_finite.toFinset.attach) ?_ ?_ ?_ ?_ ++ · ++ obtain ⟨b, b_pos, hb⟩ := new_try ++ use b ++ refine ⟨b_pos, ?_⟩ ++ intro r hr ++ rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] ++ rw [Finset.image_pow] ++ rw [Finset.image_image] ++ simp ++ conv => ++ arg 1 ++ arg 1 ++ arg 1 ++ equals Finset.image (Subgroup.subtype _) S_finite.toFinset => ++ ext a ++ rw [Finset.mem_image] ++ refine ⟨?_, ?_⟩ ++ · intro x ++ obtain ⟨y, y_mem, y_eq⟩ := x ++ rw [Finset.mem_image] ++ use y ++ rw [← y_eq] ++ simp [h_map] ++ · intro x_mem ++ rw [Finset.mem_image] at x_mem ++ obtain ⟨y, y_mem, y_eq⟩ := x_mem ++ use ⟨y, y_mem⟩ ++ simp [h_map] ++ exact y_eq ++ ++ ++ specialize hb r hr ++ rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] at hb ++ rw [Finset.image_pow] at hb ++ rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] at hb ++ rw [Finset.image_pow] at hb ++ conv at hb => ++ arg 1 ++ arg 1 ++ arg 1 ++ equals Finset.image (Subgroup.subtype _) S_finite.toFinset => ++ ext a ++ rw [Finset.mem_image] ++ refine ⟨?_, ?_⟩ ++ · intro x ++ obtain ⟨y, y_mem, y_eq⟩ := x ++ rw [Finset.mem_image] ++ use y ++ rw [← y_eq] ++ simp ++ rw [Finset.image_image] at y_mem ++ rw [Finset.mem_image] at y_mem ++ obtain ⟨z, z_mem, z_eq⟩ := y_mem ++ simp at z_eq ++ rw [← z_eq] ++ simp [h_map] ++ have z_prop := z.property ++ rw [Set.Finite.mem_toFinset] at z_prop ++ exact z_prop ++ · intro x_mem ++ rw [Finset.mem_image] at x_mem ++ obtain ⟨y, y_mem, y_eq⟩ := x_mem ++ use y ++ refine ⟨?_, y_eq⟩ ++ rw [Finset.image_image] ++ rw [Finset.mem_image] ++ simp at y_mem ++ use ⟨y, by simp [y_mem]⟩ ++ simp [h_map] ++ exact hb ++ · ++ have fintype_s: Fintype ↑S_poly_data.S := by ++ refine Set.Finite.fintype ?_ ++ exact S_poly_data.S_finite ++ ++ ++ simp ++ conv => ++ rhs ++ equals (S_poly_data.S).toFinset => ++ ext a ++ simp ++ nth_rw 1 [S_poly_data.S_inv] ++ simp ++ · ++ simp ++ apply S_poly_data.S_one ++ · ++ simp ++ exact S_poly_data.S_generates ++ · ++ intro n hn ++ have S_poly := S_poly_data.S_poly n hn ++ exact S_poly ++ ++ ++ + lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) (G_FG : G.FG) + (G'_central_trivial : ∀ g : (G' n (H_n_eps hn) G), g ∈ Set.center (G' n (H_n_eps hn) G) → ∃ z : ℂ, g.val.val.val = z • 1) + (G'_finite_index: (G' n (H_n_eps hn) G).FiniteIndex) +@@ -240,247 +525,12 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( + + + let S' := S_poly_data.S +- have S'_finite := S_poly_data.S_finite +- +- -- Add identity and inverses to S' to make things easier + let S'' := S' +- have S''_finite: Set.Finite S'' := by +- dsimp [S''] +- apply S'_finite +- +- +- have S''_eq_S''inv: S'' = S''⁻¹ := by +- unfold S'' +- apply S_poly_data.S_inv +- +- +- have S''_generates: Subgroup.closure S'' = ⊤ := by +- dsimp [S''] +- apply S_poly_data.S_generates +- +- +- have s_list (s: S'') := (mem_closure_prod_list ((Metric.ball (1 : G) (H_n_eps hn)) ∪ (Metric.ball (1 : G) (H_n_eps hn))⁻¹) (by +- simp +- rw [Set.union_comm] +- ) s (by +- have s_prop := s.val.property +- simp only [G'] at s_prop +- rw [Subgroup.closure_union] +- simp [s_prop] +- )) +- +- -- Write each element in S'' as a product of elements of S', and then collect all of the used elements into a set +- -- We may need to manually union this with S⁻¹, since the inverse of the produces +- -- could be chosen to be built with different elements (not the inverses of the ones in the original list) +- let pre_S := ⋃ s : S''_finite.toFinset, ((s_list ⟨s, by ( +- have foo := s.property +- rw [Set.Finite.mem_toFinset] at foo +- exact foo +- )⟩).choose.unattach.toFinset : Set ↥G) ∪ {1} +- let S := pre_S ∪ pre_S⁻¹ ∪ {1} +- +- have S_dist: ∀ s ∈ S, ‖s.val.val - 1‖ < H_n_eps hn := by +- intro s hs +- dsimp [S] at hs +- +- rw [Set.union_assoc] at hs +- cases hs +- . rename_i s_mem +- dsimp [pre_S] at s_mem +- rw [Set.mem_iUnion] at s_mem +- obtain ⟨y, y_mem⟩ := s_mem +- simp only [List.coe_toFinset, List.mem_unattach, Set.mem_union, Set.mem_inv, +- Set.mem_setOf_eq] at y_mem +- obtain ⟨s_mem_S'', s_mem_choose⟩ := y_mem +- simp at s_mem_S'' +- simp only [Subtype.dist_eq, dist_eq_norm_sub] at s_mem_S'' +- conv at s_mem_S'' => +- right +- arg 1 +- arg 1 +- equals (star s.val.val * 1 - (star s.val.val) * s.val.val) => +- simp +- +- rw [← mul_sub] at s_mem_S'' +- rw [← Unitary.coe_star] at s_mem_S'' +- rw [CStarRing.norm_coe_unitary_mul] at s_mem_S'' +- nth_rw 2 [norm_sub_rev] at s_mem_S'' +- simp at s_mem_S'' +- . exact s_mem_S'' +- . +- rename_i s_eq_one +- simp at s_eq_one +- simp [s_eq_one] +- have foo := H_n_eps_pos hn +- linarith +- . +- -- TODO - deduplicate most of this with the above case +- rename_i s_mem +- rw [Set.union_comm] at s_mem +- cases s_mem +- . rename_i s_mem_one +- simp at s_mem_one +- simp [s_mem_one] +- apply H_n_eps_pos +- +- rename_i s_mem +- dsimp [pre_S] at s_mem +- rw [Set.iUnion_inv] at s_mem +- rw [Set.mem_iUnion] at s_mem +- obtain ⟨y, y_mem⟩ := s_mem +- simp only [List.coe_toFinset, List.mem_unattach, Set.mem_union, Set.mem_inv, +- Set.mem_setOf_eq] at y_mem +- obtain ⟨s_mem_S'', s_mem_choose⟩ := y_mem +- simp at s_mem_S'' +- simp only [Subtype.dist_eq, dist_eq_norm_sub] at s_mem_S'' +- rw [or_comm] at s_mem_S'' +- conv at s_mem_S'' => +- right +- arg 1 +- arg 1 +- equals (star s.val.val * 1 - (star s.val.val) * s.val.val) => +- simp +- +- rw [← mul_sub] at s_mem_S'' +- rw [← Unitary.coe_star] at s_mem_S'' +- rw [CStarRing.norm_coe_unitary_mul] at s_mem_S'' +- nth_rw 2 [norm_sub_rev] at s_mem_S'' +- simp at s_mem_S'' +- . exact s_mem_S'' +- . +- rename_i s_eq_one +- simp at s_eq_one +- simp [s_eq_one] +- have foo := H_n_eps_pos hn +- linarith +- +- +- have S_finite: Set.Finite S := by +- dsimp [S] +- apply Set.Finite.union +- . +- simp +- dsimp [pre_S] +- apply Set.Finite.sUnion +- . +- apply Set.finite_range +- . +- intro y hy +- rw [Set.mem_range] at hy +- obtain ⟨x, x_mem, y_eq⟩ := hy +- apply Set.Finite.union +- . apply Finset.finite_toSet +- . simp +- . simp +- +- have S_union_Sinv: S ∪ S⁻¹ = S := by +- dsimp [S] +- simp [-Set.union_singleton] +- grind +- +- have S_eq_Sinv: S = S⁻¹ := by +- rw [← S_union_Sinv] +- simp +- rw [Set.union_comm] +- +- have S_generates: Subgroup.closure S = (G' n (H_n_eps hn) G) := by +- +- ext a +- unfold S +- rw [Subgroup.closure_union] +- simp +- rw [Subgroup.closure_union] +- simp +- unfold pre_S +- refine ⟨?_, ?_⟩ +- . intro ha +- -- TODO - only the 'mem' case is non-trivial. We probably don't actually need a full induction proof +- induction ha using Subgroup.closure_induction with +- | one => +- simp [G'] +- | mem x hx => +- rw [Set.mem_iUnion] at hx +- obtain ⟨y, y_mem⟩ := hx +- have y_prop := y.property +- rw [Set.Finite.mem_toFinset] at y_prop +- cases y_mem +- . +- rename_i y_mem +- simp at y_mem +- obtain ⟨x_dist, x_mem⟩ := y_mem +- simp [G'] +- apply Subgroup.mem_closure_of_mem +- simp +- cases x_dist +- . rename_i x_dist_le +- exact x_dist_le +- . rename_i x_inv_dist +- +- -- TODO - deduplicate this, in particular the 'CStarRing.norm_coe_unitary_mul' code +- simp only [Subtype.dist_eq, dist_eq_norm_sub] at x_inv_dist +- conv at x_inv_dist => +- lhs +- arg 1 +- equals (star x.val.val * 1 - (star x.val.val) * x.val.val) => +- simp +- +- rw [← mul_sub] at x_inv_dist +- rw [← Unitary.coe_star] at x_inv_dist +- rw [CStarRing.norm_coe_unitary_mul] at x_inv_dist +- rw [norm_sub_rev] at x_inv_dist +- simp only [Subtype.dist_eq, dist_eq_norm_sub] +- exact x_inv_dist +- . +- rename_i x_mem_one +- simp at x_mem_one +- simp [x_mem_one] +- | mul x y hx hy x_mem y_mem => +- apply Subgroup.mul_mem +- . exact x_mem +- . exact y_mem +- | inv x hx x_mem => +- apply Subgroup.inv_mem +- exact x_mem +- . +- intro ha +- apply_fun (Subgroup.map (G' n (H_n_eps hn) G).subtype) at S''_generates +- conv at S''_generates => +- rhs +- equals (G' n (H_n_eps hn) G) => +- ext a +- simp +- +- rw [← S''_generates] at ha +- simp at ha +- obtain ⟨a_mem_g', a_mem_closure⟩ := ha +- rw [← Subgroup.mem_toSubmonoid] at a_mem_closure +- rw [Subgroup.closure_toSubmonoid] at a_mem_closure +- obtain ⟨l, l_mem, l_prod_eq⟩ := Submonoid.exists_list_of_mem_closure a_mem_closure +- rw [Subtype.ext_iff] at l_prod_eq +- simp at l_prod_eq +- rw [← l_prod_eq] +- apply Subgroup.list_prod_mem +- intro x x_mem_l +- simp at x_mem_l +- obtain ⟨x_mem_g', x_mem_l⟩ := x_mem_l +- have x_mem_ball := l_mem _ x_mem_l +- +- rw [Subgroup.closure_iUnion] +- rw [← S''_eq_S''inv] at x_mem_ball +- simp at x_mem_ball +- apply Subgroup.mem_iSup_of_mem (i := ⟨⟨x, x_mem_g'⟩, (by simp; apply x_mem_ball)⟩) +- have my_spec := (s_list ⟨⟨x, x_mem_g'⟩, x_mem_ball⟩).choose_spec +- simp at my_spec +- conv => +- arg 2 +- rw [← my_spec] +- +- apply Subgroup.list_prod_mem +- intro b b_mem +- apply Subgroup.mem_closure_of_mem +- apply Set.mem_union_left +- simpa using b_mem +- ++ have S''_generates : Subgroup.closure S'' = ⊤ := S_poly_data.S_generates ++ have S''_eq_S''inv : S'' = S''⁻¹ := S_poly_data.S_inv ++ obtain ⟨S, S_dist, S_finite, S_eq_Sinv, S_generates, S_one⟩ := ++ small_finite_generators n hn G S_poly_data ++ have S_union_Sinv : S ∪ S⁻¹ = S := by rw [← S_eq_Sinv]; simp + + have nontrivial_h: ∃ h: S, ∀ z: ℂ, h.val.val.val ≠ z • 1 := by + by_contra! +@@ -497,7 +547,7 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( + + have list_prod_trivial: ∃ z: ℂ, l.unattach.unattach.prod = z • 1 := by + apply List.prod_induction (p := fun a => ∃ z: ℂ, a = z • 1) +- . ++ · + intro a b a_diag b_diag + obtain ⟨a_z, a_eq⟩ := a_diag + obtain ⟨b_z, b_eq⟩ := b_diag +@@ -505,9 +555,9 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( + rw [a_eq, b_eq] + rw [mul_smul] + simp +- . use 1 ++ · use 1 + simp +- . ++ · + intro x x_mem + rw [List.mem_unattach] at x_mem + obtain ⟨a, ha⟩ := x_mem +@@ -548,111 +598,8 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( + + have poly_pos := S_poly_data.S_poly_const_pos + +- have my_map: ∃ a: ℕ, a ≥ 1 ∧ ∀ r ≥ 1, #(Finset.image s_to_map S_finite.toFinset.attach ^ r) ≤ a * r ^ (S_poly_data.S_poly_deg) := by +- have new_try := poly_growth_equiv S_poly_data.S_poly_const S_poly_data.S_poly_deg (by omega) (S_poly_data.S_finite.toFinset) +- (Finset.image (fun a => ⟨⟨(s_to_map a).val, by (apply SetLike.coe_mem)⟩, by ( +- have foo := (s_to_map a).property +- rw [Subgroup.mem_map] at foo +- obtain ⟨x, x_mem, x_eq⟩ := foo +- simp_rw [← x_eq] +- simp [x_mem] +- )⟩) S_finite.toFinset.attach) ?_ ?_ ?_ ?_ +- . +- obtain ⟨b, b_pos, hb⟩ := new_try +- use b +- refine ⟨b_pos, ?_⟩ +- intro r hr +- rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] +- rw [Finset.image_pow] +- rw [Finset.image_image] +- simp +- conv => +- arg 1 +- arg 1 +- arg 1 +- equals Finset.image (Subgroup.subtype _) S_finite.toFinset => +- ext a +- rw [Finset.mem_image] +- refine ⟨?_, ?_⟩ +- . intro x +- obtain ⟨y, y_mem, y_eq⟩ := x +- rw [Finset.mem_image] +- use y +- rw [← y_eq] +- simp [s_to_map] +- . intro x_mem +- rw [Finset.mem_image] at x_mem +- obtain ⟨y, y_mem, y_eq⟩ := x_mem +- use ⟨y, y_mem⟩ +- simp [s_to_map] +- exact y_eq +- +- +- specialize hb r hr +- rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] at hb +- rw [Finset.image_pow] at hb +- rw [← Finset.card_image_of_injective (f := Subgroup.subtype _) _ (by apply subtype_injective)] at hb +- rw [Finset.image_pow] at hb +- conv at hb => +- arg 1 +- arg 1 +- arg 1 +- equals Finset.image (Subgroup.subtype _) S_finite.toFinset => +- ext a +- rw [Finset.mem_image] +- refine ⟨?_, ?_⟩ +- . intro x +- obtain ⟨y, y_mem, y_eq⟩ := x +- rw [Finset.mem_image] +- use y +- rw [← y_eq] +- simp [s_to_map] +- rw [Finset.image_image] at y_mem +- rw [Finset.mem_image] at y_mem +- obtain ⟨z, z_mem, z_eq⟩ := y_mem +- simp at z_eq +- rw [← z_eq] +- simp [s_to_map] +- have z_prop := z.property +- rw [Set.Finite.mem_toFinset] at z_prop +- exact z_prop +- . intro x_mem +- rw [Finset.mem_image] at x_mem +- obtain ⟨y, y_mem, y_eq⟩ := x_mem +- use y +- refine ⟨?_, y_eq⟩ +- rw [Finset.image_image] +- rw [Finset.mem_image] +- simp at y_mem +- use ⟨y, by simp [y_mem]⟩ +- simp [s_to_map] +- exact hb +- . +- have fintype_s: Fintype ↑S_poly_data.S := by +- refine Set.Finite.fintype ?_ +- exact S_poly_data.S_finite +- +- +- simp +- conv => +- rhs +- unfold Set.Finite.toFinset +- equals (S_poly_data.S).toFinset => +- ext a +- simp +- nth_rw 1 [S_poly_data.S_inv] +- simp +- . +- simp +- apply S_poly_data.S_one +- . +- simp +- exact S_poly_data.S_generates +- . +- intro n hn +- have S_poly := S_poly_data.S_poly n hn +- exact S_poly +- ++ have my_map := small_generators_growth n hn G S_poly_data S S_finite ++ s_to_map (by intro a; rfl) + + obtain ⟨new_const, new_const_pos, h_poly_new_const⟩ := my_map + +@@ -700,146 +647,29 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( + + S := (((Finset.image s_to_map) S_finite.toFinset.attach : Finset _) : Set _) + S_generates := by +- simp +- have orig_S'' := S''_generates +- apply_fun (Subgroup.map (G' n (H_n_eps hn) G).subtype) at S''_generates +- conv at S''_generates => +- rhs +- equals (G' n (H_n_eps hn) G) => +- ext a +- simp +- +- apply_fun (Subgroup.map ({ +- toFun := fun a => (⟨a.val, (by +- have prop := a.property +- rw [Subgroup.mem_map] at prop +- obtain ⟨x, x_mem, x_eq⟩ := prop +- rw [← x_eq] +- simp +- )⟩ : G), +- map_one' := by +- simp +- map_mul' := by +- intro a b +- simp +- })) using (?_) +- . conv => +- rhs +- equals (G' n (H_n_eps hn) G) => +- ext a +- rw [Subgroup.mem_map] +- refine ⟨?_, ?_⟩ +- . +- intro exists_x +- obtain ⟨x, x_mem, a_eq⟩ := exists_x +- simp at a_eq +- have x_prop := x.property +- rw [Subgroup.mem_map] at x_prop +- obtain ⟨y, y_mem, x_eq_y⟩ := x_prop +- rw [← a_eq] +- conv => +- arg 2 +- simp [← x_eq_y] +- exact y_mem +- . intro a_mem +- use ⟨a, ?_⟩ +- . refine ⟨by simp, ?_⟩ +- simp +- . rw [Subgroup.mem_map] +- use ⟨a, ?_⟩ +- . refine ⟨by simp; apply a_mem, ?_⟩ +- simp +- . simp +- +- conv => +- rhs +- rw [← S''_generates] +- ext a +- rw [Subgroup.mem_map] +- refine ⟨?_, ?_⟩ +- . +- intro ha +- simp at ha +- simp +- obtain ⟨b, b_mem, a_mem_g, b_mem_closure, a_eq_b⟩ := ha +- use ?_ +- . conv => +- arg 2 +- simp only [← a_eq_b] +- +- rw [orig_S''] +- simp +- . obtain ⟨b_mem, b_mem_g'⟩ := a_mem_g +- rw [← a_eq_b] +- simp [b_mem_g'] +- . intro ha +- have a_val_mem: a.val ∈ Subgroup.map G.subtype (G' n (H_n_eps hn) G) := by +- simp at ha +- simp +- obtain ⟨a_mem_g', a_mem_closure⟩ := ha +- apply a_mem_g' +- +- use ⟨a, ?_⟩ +- . refine ⟨?_, by simp⟩ +- rw [← Subgroup.mem_toSubmonoid] +- rw [Subgroup.closure_toSubmonoid] +- rw [← SetLike.mem_coe] +- rw [Submonoid.closure_eq_image_prod] +- rw [Set.mem_image] +- rw [Subgroup.mem_map] at ha +- obtain ⟨b, b_mem, a_eq_b⟩ := ha +- have b_prop := b.property +- conv at b_prop => +- arg 1 +- rw [← S_generates] +- have b_list := mem_closure_prod_list S S_eq_Sinv b b_prop +- obtain ⟨l, l_prod⟩ := b_list +- use List.map (fun d => ⟨d.val, ?_⟩) l +- . +- refine ⟨?_, ?_⟩ +- . +- rw [Set.mem_setOf (a := List.map _ _)] +- intro p p_mem +- apply Set.mem_union_left +- rw [List.mem_map] at p_mem +- rw [Set.mem_range] +- obtain ⟨z, z_mem, z_eq_p⟩ := p_mem +- use ⟨z, by simp⟩ +- rw [← z_eq_p] +- . +- conv => +- rhs +- simp [← a_eq_b] +- conv => +- rhs +- simp [← l_prod] +- apply Subtype.ext +- simp +- rw [List.comp_map] +- simp +- apply congrArg +- ext i g +- simp +- +- . +- have my_mem := S_mem_G' d (by simp) +- apply Subgroup.mem_map_of_mem +- apply my_mem +- . exact a_val_mem ++ let L := Subgroup.map G.subtype (G' n (H_n_eps hn) G) ++ apply Subgroup.map_injective (f := L.subtype) Subtype.val_injective ++ rw [MonoidHom.map_closure] ++ have himg : L.subtype '' (Finset.image s_to_map S_finite.toFinset.attach : Set L) ++ = G.subtype '' S := by ++ ext u ++ constructor ++ · rintro ⟨t, ht, rfl⟩ ++ obtain ⟨a, ha, rfl⟩ := Finset.mem_image.mp ht ++ exact ⟨a.val, S_finite.mem_toFinset.mp a.property, rfl⟩ ++ · rintro ⟨g, hg, rfl⟩ ++ let a : S_finite.toFinset := ⟨g, S_finite.mem_toFinset.mpr hg⟩ ++ exact ⟨s_to_map a, Finset.mem_image.mpr ⟨a, by simp, rfl⟩, rfl⟩ ++ rw [himg, ← MonoidHom.map_closure, S_generates] ++ rw [← MonoidHom.range_eq_map, Subgroup.range_subtype] + + S_finite := by + simp + apply Set.finite_range + S_one := by +- simp +- dsimp [S] +- use 1 +- use (by simp) +- use (by apply Subgroup.one_mem) +- use ?_ ++ rw [Finset.mem_coe, Finset.mem_image] ++ refine ⟨⟨1, S_finite.mem_toFinset.mpr S_one⟩, by simp, ?_⟩ + simp [s_to_map] +- apply Set.mem_union_right +- simp + S_inv := by + intro s hs + rw [Finset.mem_coe] at hs +@@ -848,11 +678,11 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( + obtain ⟨x, x_mem, s_eq⟩ := hs + rw [Finset.mem_image] + use ⟨x⁻¹, ?_⟩ +- . ++ · + simp + rw [← s_eq] + rfl +- . simp ++ · simp + + nth_rw 1 [S_eq_Sinv] + simp +@@ -876,74 +706,31 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( + S_poly := by + simp + apply h_poly_new_const +- h := ⟨⟨h.val.val, by ( +- have h_prop := h.property +- simp only [S] at h_prop +- simp +- cases h_prop +- . rename_i h_mem +- . cases h_mem +- . rename_i h_prop +- dsimp [pre_S] at h_prop +- rw [Set.mem_iUnion] at h_prop +- obtain ⟨y, y_mem⟩ := h_prop +- simp [-Set.mem_inv] at y_mem +- have h_dist := S_dist h (by simp) +- simp [G'] +- apply Subgroup.mem_closure_of_mem +- simp +- simp only [Subtype.dist_eq, dist_eq_norm_sub] +- exact h_dist +- . rename_i h_prop +- -- TODo: deduplicate +- dsimp [pre_S] at h_prop +- simp_rw [Set.iUnion_inv] at h_prop +- rw [Set.mem_iUnion] at h_prop +- obtain ⟨y, y_mem⟩ := h_prop +- simp [-Set.mem_inv] at y_mem +- have h_dist := S_dist h (by simp) +- simp [G'] +- apply Subgroup.mem_closure_of_mem +- simp +- simp only [Subtype.dist_eq, dist_eq_norm_sub] +- exact h_dist +- . rename_i h_mem +- simp at h_mem +- simp [G'] +- simp [h_mem] +- )⟩, by +- rw [Finset.mem_coe] +- rw [Finset.mem_image] +- use ⟨h.val, by simp⟩ +- simp [s_to_map] +- ⟩ ++ h := ⟨⟨h.val.val, Subgroup.mem_map_of_mem G.subtype (S_mem_G' h.val h.property)⟩, by ++ rw [Finset.mem_coe, Finset.mem_image] ++ refine ⟨⟨h.val, S_finite.mem_toFinset.mpr h.property⟩, by simp, ?_⟩ ++ rfl⟩ + h_nontrivial := by + simpa using h_nontrivial + } +- . +- apply Subgroup.map_injective +- simp +- intro x y hxy +- simpa using hxy +- + have contra := H_n_contradiction h_n_data (1 / 50) ?_ ?_ ?_ ?_ +- . contradiction +- . simp +- . simp ++ · contradiction ++ · simp ++ · simp + norm_num +- . ++ · + rw [← div_le_iff₀'] +- . ++ · + rw [le_inv_comm₀] +- . ++ · + simp + simp [H_n_eps] + left + norm_num +- . simp +- . apply H_n_eps_pos +- . simp +- . ++ · simp ++ · apply H_n_eps_pos ++ · simp ++ · + simp + unfold H_n_eps + +@@ -954,10 +741,10 @@ lemma central_trivial_virtually_abelian (n : ℕ) (hn : 2 ≤ n) (G : Subgroup ( + simp [h_n_data] + norm_num + apply div_lt_div₀ +- . norm_num +- . apply le_refl +- . norm_num +- . positivity ++ · norm_num ++ · apply le_refl ++ · norm_num ++ · positivity + + end HnEpsData + +diff --git a/Gromov/Unitary/HnEps.lean b/Gromov/Unitary/HnEps.lean +index cfaf26d..83c61b0 100644 +--- a/Gromov/Unitary/HnEps.lean ++++ b/Gromov/Unitary/HnEps.lean +@@ -14,8 +14,6 @@ public section + + open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false + + open Subgroup Pointwise Finset + open scoped Pointwise Finset +@@ -198,7 +196,6 @@ theorem theorem_3_8_h_n_left_S (data: HnData) (prev: Theorem3_8_Data data): ∃ + + -- 'h' is our initial element - we define ε in terms of ‖h - 1‖, so that we can obtain the proper bound + -- for the commutators in the inductive case +-set_option maxHeartbeats 500000 in + @[expose] + noncomputable def theorem_3_8_h_n (data : HnData) (n : ℕ): Theorem3_8_Data data := match hn : n with + | 0 => { +@@ -260,7 +257,6 @@ termination_by n + decreasing_by + simp + +-#print axioms theorem_3_8_h_n + + omit h_n_eps_data in + lemma unitary_shrink {n : ℕ} (a b : Matrix.unitaryGroup (Fin n) ℂ): ‖(a * b).val - 1‖ ≤ ‖a.val - 1‖ + ‖b.val - 1‖ := by +@@ -326,10 +322,9 @@ lemma H_n_pow_le {a k : ℕ } {m : ℕ} (a_k_lt : a + k ≤ m) (pows : Fin m + | zero => + simp [List.ofFn, List.prod_nil] + | succ k ih => +- simp only [ne_eq, List.ofFn_succ'] +- simp only [Fin.coe_castSucc, Fin.val_last, List.concat_eq_append, List.prod_append, +- List.prod_cons, List.prod_nil, mul_one, Subgroup.val_list_prod, +- List.map_ofFn] ++ simp only [List.ofFn_succ'] ++ simp only [Fin.val_castSucc, Fin.val_last, List.concat_eq_append, List.prod_append, ++ List.prod_cons, List.prod_nil, mul_one] + + rw [Subgroup.coe_mul] + grw [unitary_shrink] +@@ -398,7 +393,7 @@ lemma H_n_prod_le_k {a k : ℕ } {m : ℕ} (a_k_lt : a + k + 1 ≤ m) (c : ℝ) + field_simp [eps_ne_zero] + + grw [c_lt] +- ring ++ ring_nf + rfl + · positivity + · grw [H_n_eps_lt data.hd] +@@ -418,8 +413,6 @@ lemma H_n_prod_le_k {a k : ℕ } {m : ℕ} (a_k_lt : a + k + 1 ≤ m) (c : ℝ) + grw [pows_le] + · omega + +-#print axioms H_n_prod_le_k + +-#synth Semiring (Matrix (Fin 2) (Fin 2) ℂ) + + end HnEpsData +diff --git a/Gromov/Unitary/HnLowerBound.lean b/Gromov/Unitary/HnLowerBound.lean +index 8c9b440..7ee4180 100644 +--- a/Gromov/Unitary/HnLowerBound.lean ++++ b/Gromov/Unitary/HnLowerBound.lean +@@ -13,8 +13,6 @@ public section + + open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false + + open Subgroup Pointwise Finset + open scoped Pointwise Finset +@@ -63,7 +61,8 @@ lemma f_deriv (a: ℝ) (ha: 0 < 1 + a) (x: ℝ): (deriv (f a)) x = 2*a - (Real.l + exact ha + + +-lemma f_deriv_at_one (a: ℝ) (a_pos: 0 < a) (a_lt: a < 1) (ha: 0 < 1 + a): 0 < (deriv (f a) 1) := by ++omit h_n_eps_data in ++lemma f_deriv_at_one [_h_n_eps_data : HnEpsData] (a: ℝ) (a_pos: 0 < a) (a_lt: a < 1) (ha: 0 < 1 + a): 0 < (deriv (f a) 1) := by + rw [f_deriv _ ha] + grw [Real.log_le_sub_one_of_pos] + · have a_mul_self := mul_lt_of_lt_one_left (a := a) (b := a) (by linarith) (by linarith) +@@ -72,7 +71,8 @@ lemma f_deriv_at_one (a: ℝ) (a_pos: 0 < a) (a_lt: a < 1) (ha: 0 < 1 + a): 0 < + simp [ha] + + +-lemma f_deriv_lower (a: ℝ) (ha: 0 < 1 + a) (a_pos: 0 < a) (x: ℝ) (f_zero: (deriv (f a)) x = 0): (Real.log 2) / a ≤ x := by ++omit h_n_eps_data in ++lemma f_deriv_lower [_h_n_eps_data : HnEpsData] (a: ℝ) (ha: 0 < 1 + a) (a_pos: 0 < a) (x: ℝ) (f_zero: (deriv (f a)) x = 0): (Real.log 2) / a ≤ x := by + have log_plus_le: Real.log (1 + a) ≤ a := by + grw [Real.log_le_sub_one_of_pos] + · simp +@@ -112,28 +112,28 @@ lemma f_pos_on (a: ℝ) (ha: 0 < 1 + a) (a_pos: 0 < a) (a_lt: a < 1) (a_lt_log: + + have one_lt : 1 < Real.log (2) / a := by + rw [lt_div_iff₀] +- . simp ++ · simp + exact a_lt_log +- . exact a_pos ++ · exact a_pos + + have f_strict := strictMonoOn_of_deriv_pos (f := f a) (D := Set.Icc 1 ((Real.log (2 )) / a)) (by apply convex_Icc) ?_ ?_ +- . ++ · + intro x hx + have f_lt := f_strict.lt_iff_lt (a := 1) (b := x) ?_ ?_ + rw [f_one_eq_zero] at f_lt + have x_prop := hx.left + simp [x_prop] at f_lt +- . exact f_lt +- . simp ++ · exact f_lt ++ · simp + linarith +- . simp ++ · simp + simp at hx + refine ⟨by linarith, hx.right⟩ +- . apply Continuous.continuousOn ++ · apply Continuous.continuousOn + unfold f + have one_plus: 1 + a ≠ 0 := by linarith + fun_prop (disch:=assumption) +- . ++ · + + intro x hx + simp at hx +@@ -154,30 +154,27 @@ lemma f_pos_on (a: ℝ) (ha: 0 < 1 + a) (a_pos: 0 < a) (a_lt: a < 1) (a_lt_log: + rw [Set.mem_image] at deriv_zero + obtain ⟨y, y_mem, y_deriv⟩ := deriv_zero + have y_nonzero := deriv_nonzero y y_mem +- . contradiction +- . apply Continuous.continuousOn ++ · contradiction ++ · apply Continuous.continuousOn + unfold f + have one_plus: ∀ x: ℝ, 1 + a ≠ 0 := by + intro x + linarith + fun_prop (disch:=assumption) +- . simp ++ · simp + refine ⟨by linarith, hx.right⟩ +- . simp ++ · simp + exact one_lt + + have not_zero := deriv_nonzero x ?_ +- . exact lt_of_le_of_ne deriv_pos (id (Ne.symm not_zero)) +- . simp ++ · exact lt_of_le_of_ne deriv_pos (id (Ne.symm not_zero)) ++ · simp + refine ⟨by linarith, hx.right⟩ + +-#print axioms f_pos_on + + + lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnData) (m_lt: m < (1/2) / ‖(theorem_3_8_h_n data n).g.val.val - 1‖) : ‖((theorem_3_8_h_n data n).g.val.val^m) - 1‖ ≥ ‖((theorem_3_8_h_n data n).g.val).val - 1‖ := by + +- push_cast +- -- TODO: figure out how to get 'SubgroupClass.coe_zpow' to fire for Matrix.unitaryGroup + + conv => + lhs +@@ -227,15 +224,15 @@ lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnD + grw [norm_sum_le] + + grw [Finset.sum_le_sum (g := fun i => ‖((theorem_3_8_h_n data n).g.val.val - 1)‖ ^ (i + 1 + 1) * (m.choose (i + 1 + 1)))] +- . ++ · + rw [← my_pow] + + have S_le : (1 + ‖((theorem_3_8_h_n data n).g).val.val - 1‖)^m - ((‖(theorem_3_8_h_n data n).g.val.val - 1‖) * (m : ℝ) + 1) ≤ (m - 1) * ‖(theorem_3_8_h_n data n).g.val.val - 1‖ := by + by_cases m_eq_one: m = 1 +- . ++ · + simp [m_eq_one] + rw [add_comm] +- . ++ · + have my_bound := f_pos_on ‖((theorem_3_8_h_n data n).g.val.val - 1)‖ ?_ ?_ ?_ ?_ m ?_ + simp [f] at my_bound + rw [two_mul] at my_bound +@@ -248,23 +245,23 @@ lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnD + grw [my_bound] + simp + ring_nf +- . rfl +- . positivity +- . ++ · rfl ++ · positivity ++ · + have val_ne := (theorem_3_8_h_n data n).g_dist_nonzero + positivity +- . ++ · + have val_le := (theorem_3_8_h_n data n).g_dist + grw [val_le] + grw [H_n_eps_lt] + norm_num +- . ++ · + have val_le := (theorem_3_8_h_n data n).g_dist + grw [val_le] + grw [H_n_eps_lt] + norm_num + linarith [Real.log_two_gt_d9] +- . simp ++ · simp + refine ⟨by omega, ?_⟩ + grw [← ge_iff_le] + grw [Real.log_two_gt_d9.gt] +@@ -272,11 +269,11 @@ lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnD + grw [m_lt] + simp + apply div_le_div₀ +- . norm_num +- . norm_num +- . have ne_zero := (theorem_3_8_h_n data n).g_dist_nonzero ++ · norm_num ++ · norm_num ++ · have ne_zero := (theorem_3_8_h_n data n).g_dist_nonzero + positivity +- . rfl ++ · rfl + + + rw [add_comm] +@@ -300,29 +297,25 @@ lemma H_n_single_pow_lower_bound {n : ℕ} {m : ℕ} (m_gt: 1 ≤ m) (data : HnD + ring_nf + rfl + +- . intro i hi ++ · intro i hi + grw [norm_mul_le] + grw [norm_pow_le] + nth_rw 2 [Matrix.l2_opNorm_def] + grw [ContinuousLinearMap.opNorm_le_bound (M := m.choose (i + 1 + 1))] +- . simp +- . ++ · simp ++ · + intro x + simp +- rw [Matrix.toEuclideanLin_apply] ++ rw [Matrix.toLpLin_apply] + simp + rw [norm_smul] + simp + +- --apply_fun Norm.norm at my_pow + +-#synth DivisionMonoid (Matrix.unitaryGroup (Fin 2) ℂ) + + +-#synth DivInvMonoid (Matrix (Fin 2) (Fin 2) ℂ) + + +--- TODO: upstream to mathlib + omit h_n_eps_data in + lemma list_ofFn_drop {M: Type*} (a k: ℕ) (f: Fin (k + a) → M): (List.ofFn f).drop a = List.ofFn (fun (i: Fin k) => f ⟨a + i, by omega⟩) := by + induction a with +diff --git a/Gromov/Unitary/Packing.lean b/Gromov/Unitary/Packing.lean +index 2b64abe..1f804fe 100644 +--- a/Gromov/Unitary/Packing.lean ++++ b/Gromov/Unitary/Packing.lean +@@ -14,16 +14,100 @@ public section + + open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false + + open Subgroup Pointwise Finset + open scoped Pointwise Finset + open scoped commutatorElement IsMulCommutative + + +-set_option synthInstance.maxHeartbeats 100000 in +-set_option maxHeartbeats 500000 in ++private lemma unitary_separated_maximal (n : ℕ) ++ (A : Set (Matrix.unitaryGroup (Fin n) ℂ)) (ε : ℝ) : ++ ∃ I, Maximal (fun I => I ⊆ A ∧ ++ ∀ x ∈ I, ∀ y ∈ I, x ≠ y → ‖x.val - y.val‖ ≥ ε) I := by ++ let I_sets := { I | I ⊆ A ∧ ++ ∀ x ∈ I, ∀ y ∈ I, x ≠ y → ‖x.val - y.val‖ ≥ ε } ++ apply zorn_subset I_sets ++ intro S S_subset S_chain ++ refine ⟨S.sUnion, ?_, ?_⟩ ++ · simp only [ne_eq, ge_iff_le, Set.mem_ofPred_eq, ++ Set.sUnion_subset_iff, Set.mem_sUnion, forall_exists_index, and_imp, I_sets] ++ ++ refine ⟨?_, ?_⟩ ++ · intro s hs ++ simp [I_sets] at S_subset ++ specialize S_subset hs ++ simp at S_subset ++ exact S_subset.1 ++ · simp [I_sets] at S_subset ++ intro a M M_mem_S a_mem_M b N N_mem_S b_mem_N a_neq_b ++ simp [IsChain] at S_chain ++ specialize S_chain M_mem_S N_mem_S ++ by_cases M_eq_N : M = N ++ · rw [M_eq_N] at a_mem_M ++ specialize S_subset N_mem_S ++ simp at S_subset ++ exact S_subset.2 a (by simp) (by simp [a_mem_M]) b (by simp) (by simp [b_mem_N]) (by simp [a_neq_b]) ++ · specialize S_chain M_eq_N ++ match S_chain with ++ | .inl h => ++ have a_mem_N := h a_mem_M ++ specialize S_subset N_mem_S ++ simp at S_subset ++ exact S_subset.2 a (by simp) (by simp [a_mem_N]) b (by simp) (by simp [b_mem_N]) (by simp [a_neq_b]) ++ | .inr h => ++ have b_mem_M := h b_mem_N ++ specialize S_subset M_mem_S ++ simp at S_subset ++ exact S_subset.2 a (by simp) (by simp [a_mem_M]) b (by simp) (by simp [b_mem_M]) (by simp [a_neq_b]) ++ ++ ++ · intro s hs ++ exact Set.subset_sUnion_of_subset S s (fun ⦃a⦄ a ↦ a) hs ++ ++private lemma unitary_cosets_cover (n : ℕ) (ε : ℝ) ++ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) ++ (I : Set (Matrix.unitaryGroup (Fin n) ℂ)) [Fintype I] ++ (i_mem_G : ∀ i ∈ I, i ∈ G) ++ (balls_cover : G.carrier ⊆ ⋃ g ∈ I, Metric.ball g ε) ++ (inter_subset : ∀ g, g ∈ G.carrier → ++ Metric.ball g ε ∩ G.carrier ⊆ ++ (fun x => g * x.val) '' (G' n ε G).carrier) : ++ (⋃ i ∈ I.toFinset.attach, (((⟨i.val, i_mem_G i.val (Set.mem_toFinset.mp i.property)⟩ : G) • (((G' n ε G)) : Set G)) : (Set G))) = (Set.univ : Set G) := by ++ have balls_inter_cover : G.carrier ⊆ ⋃ g ∈ I, ((Metric.ball g ε) ∩ G.carrier) := by ++ intro g hg ++ specialize balls_cover hg ++ simp only [Set.mem_iUnion] at balls_cover ++ obtain ⟨i, i_mem, g_mem_i⟩ := balls_cover ++ simp only [Set.mem_iUnion] ++ use i ++ use i_mem ++ exact Set.mem_inter g_mem_i hg ++ ++ ++ simp ++ ext a ++ simp only [Set.mem_univ, iff_true] ++ have a_mem_g : a.val ∈ G.carrier := by simp ++ specialize balls_inter_cover a_mem_g ++ simp only [Set.mem_iUnion] at balls_inter_cover ++ obtain ⟨i, i_mem, a_mem_i⟩ := balls_inter_cover ++ have hiG : i ∈ G.carrier := i_mem_G i i_mem ++ specialize inter_subset i hiG ++ have a_mem := inter_subset a_mem_i ++ simp only [Set.mem_image] at a_mem ++ obtain ⟨x, hx, a_eq_mul⟩ := a_mem ++ simp only [Set.mem_iUnion] ++ have i_mem_finset : i ∈ I.toFinset := by ++ exact Set.mem_toFinset.mpr i_mem ++ use ⟨i, i_mem_finset⟩ ++ simp ++ rw [Set.mem_smul_set] ++ use x ++ refine ⟨?_, ?_⟩ ++ · exact hx ++ · rw [Subtype.ext_iff] ++ simp [a_eq_mul] ++ + open Pointwise in + lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, ∀ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)), (G' n ε G).FiniteIndex ∧ (G' n ε G).index ≤ C := by +@@ -43,13 +127,13 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : + let measure_haar : MeasureTheory.MeasureSpace (Matrix.unitaryGroup (Fin n) ℂ) := { + volume := MeasureTheory.Measure.haarMeasure compacts_univ + } +- haveI hinv : (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)).IsMulLeftInvariant := by ++ have hinv : (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)).IsMulLeftInvariant := by + show (MeasureTheory.Measure.haarMeasure compacts_univ).IsMulLeftInvariant + infer_instance +- haveI hfin : MeasureTheory.IsFiniteMeasure (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)) := by ++ have hfin : MeasureTheory.IsFiniteMeasure (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)) := by + show MeasureTheory.IsFiniteMeasure (MeasureTheory.Measure.haarMeasure compacts_univ) + infer_instance +- haveI hopen : (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)).IsOpenPosMeasure := by ++ have hopen : (MeasureTheory.volume : MeasureTheory.Measure ↥(Matrix.unitaryGroup (Fin n) ℂ)).IsOpenPosMeasure := by + show (MeasureTheory.Measure.haarMeasure compacts_univ).IsOpenPosMeasure + infer_instance + +@@ -58,7 +142,7 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : + intro G + -- We can find a maximal subset I where ||a - b|| ≥ ε for distinct a, b in I + let I_sets := { S | S ⊆ G.carrier ∧ ∀ x ∈ S, ∀ y ∈ S, x ≠ y → ‖x.val - y.val‖ ≥ ε } +- have maximal_I := zorn_subset I_sets ?_ ++ have maximal_I := unitary_separated_maximal n G.carrier ε + · obtain ⟨I, hI⟩ := maximal_I + have balls_cover : G.carrier ⊆ ⋃ (g ∈ I), Metric.ball g ε := by + intro a ha +@@ -66,9 +150,8 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : + · have a_mem_I : a ∈ I := by + have enlarge_I : {a} ∪ I ∈ I_sets := by + simp [-Subtype.forall, I_sets] +- simp [Maximal] at hI ++ simp only [Maximal] at hI + have I_prop := hI.1 +- simp [-Subtype.forall, I_sets] at I_prop + refine ⟨?_, ?_⟩ + · apply Set.insert_subset ha I_prop.1 + · refine ⟨?_, ?_⟩ +@@ -105,9 +188,8 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : + -- Note - Vikman uses ε/2, but using ε/4 made things easier (it might actually be false for ε/2) + have disjoint_balls : I.PairwiseDisjoint (fun g => Metric.ball g ((ε/2)/2)) := by + intro a a_mem b b_mem a_neq_b +- simp [Maximal] at hI ++ simp only [Maximal] at hI + have I_prop := hI.1 +- simp [-Subtype.forall, I_sets] at I_prop + have dist_ge := I_prop.2 a a_mem b b_mem a_neq_b + simp [Disjoint] + intro X X_subset_A X_subset_B +@@ -228,58 +310,18 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : + + have i_mem_G : ∀ i ∈ I, i ∈ G := by + intro i i_mem +- simp [Maximal] at hI ++ simp only [Maximal] at hI + have I_prop := hI.1 +- simp [-Subtype.forall, I_sets] at I_prop + apply (I_prop.1 i_mem) + + +- have cosets_cover : (⋃ i ∈ I.toFinset.attach, (((⟨i.val, i_mem_G i.val (Set.mem_toFinset.mp i.property)⟩ : G) • (((G' n ε G)) : Set G)) : (Set G))) = (Set.univ : Set G) := by +- have balls_inter_cover : G.carrier ⊆ ⋃ g ∈ I, ((Metric.ball g ε) ∩ G.carrier) := by +- intro g hg +- specialize balls_cover hg +- simp only [Set.mem_iUnion] at balls_cover +- obtain ⟨i, i_mem, g_mem_i⟩ := balls_cover +- simp only [Set.mem_iUnion] +- use i +- use i_mem +- exact Set.mem_inter g_mem_i hg +- +- +- simp +- ext a +- simp only [Set.mem_univ, iff_true] +- have a_mem_g : a.val ∈ G.carrier := by simp +- specialize balls_inter_cover a_mem_g +- simp only [Set.mem_iUnion] at balls_inter_cover +- obtain ⟨i, i_mem, a_mem_i⟩ := balls_inter_cover +- have i_mem_G : i ∈ G.carrier := by +- simp [Maximal] at hI +- have I_prop := hI.1 +- simp [-Subtype.forall, I_sets] at I_prop +- apply (I_prop.1 i_mem) +- specialize inter_subset i i_mem_G +- have a_mem := inter_subset a_mem_i +- simp only [Set.mem_image] at a_mem +- obtain ⟨x, hx, a_eq_mul⟩ := a_mem +- simp only [Set.mem_iUnion] +- have i_mem_finset : i ∈ I.toFinset := by +- exact Set.mem_toFinset.mpr i_mem +- use ⟨i, i_mem_finset⟩ +- simp +- rw [Set.mem_smul_set] +- use x +- refine ⟨?_, ?_⟩ +- · exact hx +- · rw [Subtype.ext_iff] +- simp [a_eq_mul] ++ have cosets_cover := unitary_cosets_cover n ε G I i_mem_G balls_cover inter_subset + + refine ⟨?_, ?_⟩ + · apply Subgroup.finiteIndex_of_leftCoset_cover_const cosets_cover + · have I_subset_G : I ⊆ G := by +- simp [Maximal] at hI ++ simp only [Maximal] at hI + have i_mem := hI.1 +- simp [I_sets] at i_mem + exact i_mem.1 + + +@@ -306,44 +348,7 @@ lemma volume_packing (n : ℕ) (hn : 0 < n) (ε : ℝ) (hε : 0 < ε) : + MeasureTheory.measure_lt_top _ _⟩ + · exact cosets_cover + +- · intro S S_subset S_chain +- refine ⟨S.sUnion, ?_, ?_⟩ +- · simp only [ne_eq, ge_iff_le, Set.mem_setOf_eq, +- Set.sUnion_subset_iff, Set.mem_sUnion, forall_exists_index, and_imp, I_sets] +- +- refine ⟨?_, ?_⟩ +- · intro s hs +- simp [I_sets] at S_subset +- specialize S_subset hs +- simp at S_subset +- exact S_subset.1 +- · simp [I_sets] at S_subset +- intro a M M_mem_S a_mem_M b N N_mem_S b_mem_N a_neq_b +- simp [IsChain] at S_chain +- specialize S_chain M_mem_S N_mem_S +- by_cases M_eq_N : M = N +- · rw [M_eq_N] at a_mem_M +- specialize S_subset N_mem_S +- simp at S_subset +- exact S_subset.2 a (by simp) (by simp [a_mem_M]) b (by simp) (by simp [b_mem_N]) (by simp [a_neq_b]) +- · specialize S_chain M_eq_N +- match S_chain with +- | .inl h => +- have a_mem_N := h a_mem_M +- specialize S_subset N_mem_S +- simp at S_subset +- exact S_subset.2 a (by simp) (by simp [a_mem_N]) b (by simp) (by simp [b_mem_N]) (by simp [a_neq_b]) +- | .inr h => +- have b_mem_M := h b_mem_N +- specialize S_subset M_mem_S +- simp at S_subset +- exact S_subset.2 a (by simp) (by simp [a_mem_M]) b (by simp) (by simp [b_mem_M]) (by simp [a_neq_b]) +- +- +- · intro s hs +- exact Set.subset_sUnion_of_subset S s (fun ⦃a⦄ a ↦ a) hs + +-#print axioms volume_packing + + + @[expose] +@@ -352,7 +357,6 @@ def FreshInnerProduct (V : Type*) := V + instance (V : Type*) [base_comm : AddCommGroup V]: AddCommGroup (FreshInnerProduct V) := base_comm + instance (V : Type*) [AddCommGroup V] [base_module : Module ℂ V]: Module ℂ (FreshInnerProduct V) := base_module + +-#synth InnerProductSpace ℂ (EuclideanSpace ℂ (Fin 2)) + + + attribute [-simp] MeasureTheory.Measure.inv_eq_self +diff --git a/Gromov/Unitary/WeylTrick.lean b/Gromov/Unitary/WeylTrick.lean +index 8a2c528..7b5c66a 100644 +--- a/Gromov/Unitary/WeylTrick.lean ++++ b/Gromov/Unitary/WeylTrick.lean +@@ -13,8 +13,6 @@ public section + + open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false + + open Subgroup Pointwise Finset + open scoped Pointwise Finset +@@ -23,8 +21,36 @@ open scoped commutatorElement IsMulCommutative + + attribute [local implicit_reducible] FreshInnerProduct + +-set_option maxHeartbeats 800000 in +-set_option synthInstance.maxHeartbeats 500000 in ++private lemma unitary_of_faithful_inner_representation ++ {K W : Type*} [Group K] [NormedAddCommGroup W] ++ [InnerProductSpace ℂ W] [FiniteDimensional ℂ W] ++ (ρ : K →* Module.End ℂ W) (hρ : Function.Injective ρ) ++ (hinner : ∀ g x y, ⟪ρ g x, ρ g y⟫ = ⟪x, y⟫) : ++ ∃ S : Subgroup (Matrix.unitaryGroup (Fin (Module.finrank ℂ W)) ℂ), ++ Nonempty (S ≃* K) := by ++ let b := stdOrthonormalBasis ℂ W ++ have hu (g : K) : LinearMap.toMatrix b.toBasis b.toBasis (ρ g) ∈ ++ Matrix.unitaryGroup (Fin (Module.finrank ℂ W)) ℂ := by ++ let i : W →ₗᵢ[ℂ] W := { ++ toLinearMap := ρ g ++ norm_map' := (LinearMap.norm_map_iff_inner_map_map (ρ g)).mpr (hinner g) } ++ let e := LinearIsometryEquiv.ofSurjective i ++ ((LinearMap.injective_iff_surjective).mp i.injective) ++ exact e.toMatrix_mem_unitaryGroup b b ++ let f : K →* Matrix.unitaryGroup (Fin (Module.finrank ℂ W)) ℂ := { ++ toFun := fun g => ⟨LinearMap.toMatrix b.toBasis b.toBasis (ρ g), hu g⟩ ++ map_one' := by apply Subtype.ext; simp ++ map_mul' := by ++ intro g h ++ apply Subtype.ext ++ simp [LinearMap.toMatrix_mul] } ++ have hf : Function.Injective f := by ++ intro g h heq ++ apply hρ ++ apply (LinearMap.toMatrix b.toBasis b.toBasis).injective ++ exact congrArg Subtype.val heq ++ exact ⟨f.range, ⟨(MonoidHom.ofInjective hf).symm⟩⟩ ++ + lemma new_weyl_unitarian_trick {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V] (H : Subgroup (V →L[ℂ] V)ˣ) [LocallyCompactSpace H] [CompactSpace H]: ∃ S : Subgroup ↥(Matrix.unitaryGroup (Fin (Module.finrank ℂ V)) ℂ), Nonempty (S ≃* H) := by + let integrand := fun (v w : FreshInnerProduct V) (h : H) => ⟪(h.val.val v), (h.val.val w)⟫ + have continuous_integrand : ∀ v w : FreshInnerProduct V, Continuous fun h : H => integrand v w h := by +@@ -133,7 +159,7 @@ lemma new_weyl_unitarian_trick {V : Type*} [NormedAddCommGroup V] [InnerProductS + simp at inner_q_zero + have map_iff_zero := LinearMap.map_eq_zero_iff (f := q.val.val.toLinearMap) (x := x) ?_ + · exact map_iff_zero.mp inner_q_zero +- · -- TODO - find a better way of doing this ++ · + let my_map := (ContinuousLinearMap.toLinearMapRingHom (R₁ := ℂ) (M₁ := V)).toMonoidHom + let f_map := (Units.map my_map) q.val + let f_as_equiv := fun f => (LinearMap.GeneralLinearGroup.toLinearEquiv (R := ℂ) (M := V) f) +@@ -143,13 +169,12 @@ lemma new_weyl_unitarian_trick {V : Type*} [NormedAddCommGroup V] [InnerProductS + exact injective_f + · have foo := integrable_on x x + simp [integrand] at foo +- norm_cast + norm_cast at foo + apply MeasureTheory.Integrable.re at foo + norm_cast at foo + · rw [Pi.le_def] + intro y +- simpa using inner_self_nonneg (𝕜 := ℂ) (x := (y.val.val x)) ++ simp + } + · exact Ne.symm (NeZero.ne' (MeasureTheory.Measure.haar.inv Set.univ)) + +@@ -173,190 +198,21 @@ lemma new_weyl_unitarian_trick {V : Type*} [NormedAddCommGroup V] [InnerProductS + rfl + rw [hpt] + exact MeasureTheory.integral_mul_right_eq_self (integrand v w) h +- · -- finDimVectorspaceEquiv +- have rank_eq := Module.finrank_eq_rank' ℂ (FreshInnerProduct V) +- have V_equiv := (finDimVectorspaceEquiv (Module.finrank ℂ (FreshInnerProduct V)) rank_eq.symm).toContinuousLinearEquiv +- let V_equiv_fresh : V ≃L[ℂ] (FreshInnerProduct V) := ContinuousLinearEquiv.ofFinrankEq ?_ +- let V_fresh_arrow := ContinuousLinearEquiv.arrowCongr V_equiv_fresh V_equiv_fresh +- +- let new_H_matrix := ContinuousLinearMap.toLinearMap '' (Units.val '' H.carrier) +- -- Deliberate defeq abuse, so that things line up with our integral (which is over plain V) +- let new_H_coe : Set ((FreshInnerProduct V) →ₗ[ℂ] (FreshInnerProduct V)) := new_H_matrix +- +- +- +- have V_basis := stdOrthonormalBasis ℂ (FreshInnerProduct V) +- +- let H_matrix := (LinearMap.toMatrix V_basis.toBasis V_basis.toBasis) '' new_H_coe +- +- +- have H_mem_unitary : ∀ h ∈ H_matrix, h ∈ Matrix.unitaryGroup (Fin (Module.finrank ℂ (FreshInnerProduct V))) ℂ := by +- intro h h_mem +- simp [H_matrix, new_H_coe, new_H_matrix] at h_mem +- obtain ⟨u, u_mem, hu⟩ := h_mem +- let a : FreshInnerProduct V →ₗ[ℂ] FreshInnerProduct V := (↑↑u : V →ₗ[ℂ] V) +- have ha : (LinearMap.toMatrix V_basis.toBasis V_basis.toBasis) a = h := hu +- rw [← ha, Matrix.mem_unitaryGroup_iff'] +- -- `a` is the linear map underlying an element of `H`, so it preserves the new inner product. +- have preserves_inner : ∀ (x y : FreshInnerProduct V), ⟪a x, a y⟫ = ⟪x, y⟫ := by +- intro x y +- exact v_preserves_inner ⟨u, u_mem⟩ x y +- -- Preservation of the inner product means `adjoint a ∘ a = id`. +- have adj : a.adjoint ∘ₗ a = LinearMap.id := by +- apply LinearMap.ext +- intro x +- rw [LinearMap.comp_apply, LinearMap.id_apply] +- apply ext_inner_right ℂ +- intro y +- rw [LinearMap.adjoint_inner_left] +- exact preserves_inner x y +- have hmat : star (LinearMap.toMatrix V_basis.toBasis V_basis.toBasis a) * +- (LinearMap.toMatrix V_basis.toBasis V_basis.toBasis a) = 1 := by +- rw [Matrix.star_eq_conjTranspose, ← LinearMap.toMatrix_adjoint, ← LinearMap.toMatrix_comp, +- adj, LinearMap.toMatrix_id] +- exact hmat +- +- +- let H_matrix_subgroup : Subgroup (Matrix.unitaryGroup (Fin (Module.finrank ℂ V)) ℂ) := { +- carrier := Set.range (fun (h : H_matrix) => ⟨h.val, H_mem_unitary h (by simp)⟩), +- mul_mem' := by +- intro X Y hx hy +- simp +- use (X * Y).val +- simp +- simp at hx +- simp at hy +- simp [H_matrix] +- simp [H_matrix] at hx +- simp [H_matrix] at hy +- obtain ⟨a, ⟨p, p_mem, p_eq_a⟩, a_eq_x⟩ := hx +- obtain ⟨b, ⟨q, q_mem, q_eq_b⟩, b_eq_y⟩ := hy +- simp [new_H_coe, new_H_matrix] at q_mem +- simp [new_H_coe, new_H_matrix] at p_mem +- obtain ⟨y, y_mem, y_eq_q⟩ := q_mem +- obtain ⟨x, x_mem, x_eq_p⟩ := p_mem +- simp [new_H_coe, new_H_matrix] +- refine ⟨?_, rfl⟩ +- have hX : X.val = a := by rw [← a_eq_x] +- have hY : Y.val = b := by rw [← b_eq_y] +- refine ⟨x * y, H.mul_mem x_mem y_mem, ?_⟩ +- rw [hX, hY, ← p_eq_a, ← q_eq_b, ← LinearMap.toMatrix_mul, ← x_eq_p, ← y_eq_q] +- rfl +- one_mem' := by +- simp [H_matrix, new_H_coe, new_H_matrix] +- refine ⟨1, H.one_mem, ?_⟩ +- exact LinearMap.toMatrix_one _ +- inv_mem' := by +- simp +- intro a ha b hb a_eq_b +- refine ⟨a⁻¹, ?_, ?_⟩ +- · simp [H_matrix, new_H_coe, new_H_matrix] at ⊢ hb +- obtain ⟨u, u_mem, hz₀⟩ := hb +- refine ⟨u⁻¹, H.inv_mem u_mem, ?_⟩ +- rw [← a_eq_b, ← hz₀] +- refine (Matrix.inv_eq_left_inv ?_).symm +- rw [← LinearMap.toMatrix_mul] +- convert LinearMap.toMatrix_one (R := ℂ) V_basis.toBasis using 2 +- ext v +- change (↑(u⁻¹) : V →L[ℂ] V) ((↑u : V →L[ℂ] V) v) = v +- rw [← mul_apply_eq_comp, ← Units.val_mul, inv_mul_cancel, Units.val_one, +- one_apply_eq_self] +- · rw [Matrix.mem_unitaryGroup_iff] at ha +- apply Matrix.inv_eq_right_inv at ha +- rw [Subtype.ext_iff] +- show a⁻¹ = star a +- exact ha +- } +- +- let remove_fresh (h : FreshInnerProduct V →ₗ[ℂ] FreshInnerProduct V): (V →ₗ[ℂ] V) := h +- +- · use H_matrix_subgroup +- apply Nonempty.intro +- exact { +- toFun := fun h => ⟨{ +- val := ((remove_fresh (h.val.val.toLin V_basis.toBasis V_basis.toBasis)).toContinuousLinearMap), +- inv := ((remove_fresh (h.val.val⁻¹.toLin V_basis.toBasis V_basis.toBasis)).toContinuousLinearMap), +- val_inv := by +- simp [remove_fresh] +- ext a +- simp +- conv => +- lhs +- equals Matrix.toLin V_basis.toBasis V_basis.toBasis (h.val.val * h.val.val⁻¹) a => +- rw [eq_comm] +- exact Matrix.toLin_mul_apply (v₁ := V_basis.toBasis) (v₂ := V_basis.toBasis) (v₃ := V_basis.toBasis) _ _ _ +- rw [Matrix.mul_nonsing_inv] +- · exact LinearMap.congr_fun (Matrix.toLin_one (v₁ := V_basis.toBasis)) a +- · apply Matrix.UnitaryGroup.det_isUnit +- inv_val := by +- simp [remove_fresh] +- ext a +- simp +- conv => +- lhs +- equals Matrix.toLin V_basis.toBasis V_basis.toBasis (h.val.val⁻¹ * h.val.val) a => +- rw [eq_comm] +- exact Matrix.toLin_mul_apply (v₁ := V_basis.toBasis) (v₂ := V_basis.toBasis) (v₃ := V_basis.toBasis) _ _ _ +- rw [Matrix.nonsing_inv_mul] +- · exact LinearMap.congr_fun (Matrix.toLin_one (v₁ := V_basis.toBasis)) a +- · apply Matrix.UnitaryGroup.det_isUnit +- }, by ( +- simp [remove_fresh] +- have h_prop := h.property +- simp only [H_matrix_subgroup] at h_prop +- rw [← Subgroup.mem_carrier] at h_prop +- simp only [] at h_prop +- rw [Set.mem_range] at h_prop +- obtain ⟨a, ha⟩ := h_prop +- have a_prop := a.property +- simp only [H_matrix, new_H_coe, new_H_matrix] at a_prop +- rw [Set.mem_image] at a_prop +- obtain ⟨b, b_mem, b_eq_a⟩ := a_prop +- obtain ⟨c, ⟨d, d_mem, d_eq_c⟩, c_eq_b⟩ := b_mem +- simp_rw [← ha, ← b_eq_a] +- simp +- simp_rw [← c_eq_b, ← d_eq_c] +- conv => +- arg 2 +- arg 1 +- equals d.val => +- rfl +- +- simp +- rw [Subgroup.mem_carrier] at d_mem +- exact d_mem +- )⟩ +- invFun := fun h => ⟨⟨(LinearMap.toMatrix V_basis.toBasis V_basis.toBasis) h.val.val.toLinearMap, by ( +- apply H_mem_unitary +- exact ⟨h.val.val.toLinearMap, ⟨h.val.val, ⟨h.val, h.property, rfl⟩, rfl⟩, rfl⟩ +- )⟩, by ( +- refine ⟨⟨_, ⟨h.val.val.toLinearMap, ⟨h.val.val, ⟨h.val, h.property, rfl⟩, rfl⟩, rfl⟩⟩, rfl⟩ +- )⟩, +- left_inv := by +- intro h +- simp +- rw [Subtype.ext_iff] +- simp [remove_fresh] +- right_inv := by +- intro h +- simp +- simp [remove_fresh] +- ext a +- simp +- map_mul' := by +- intro x y +- simp [remove_fresh] +- ext a +- simp +- exact Matrix.toLin_mul_apply (v₁ := V_basis.toBasis) (v₂ := V_basis.toBasis) +- (v₃ := V_basis.toBasis) _ _ _ +- } +- · rfl ++ let ρ : H →* Module.End ℂ (FreshInnerProduct V) := { ++ toFun := fun h => h.val.val.toLinearMap ++ map_one' := rfl ++ map_mul' := fun _ _ => rfl } ++ have hρ : Function.Injective ρ := by ++ intro g h heq ++ apply Subtype.ext ++ apply Units.ext ++ ext v ++ exact DFunLike.congr_fun heq v ++ exact @unitary_of_faithful_inner_representation H (FreshInnerProduct V) ++ inferInstance normed_add new_inner finite_dimensional_fresh ρ hρ v_preserves_inner + + +-#print axioms new_weyl_unitarian_trick + + -- A product of k unitary groups U(n_1) × U(n_2) × ... × U(n_k), where n_i < n for each n_i + + +-#check Pi.commSemigroup +diff --git a/Gromov/Unitary/Words.lean b/Gromov/Unitary/Words.lean +index a8e8c75..5d00a13 100644 +--- a/Gromov/Unitary/Words.lean ++++ b/Gromov/Unitary/Words.lean +@@ -14,8 +14,6 @@ public section + + open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace + +-set_option linter.style.longLine false +-set_option linter.style.commandStart false + + open Subgroup Pointwise Finset + open scoped Pointwise Finset +@@ -26,8 +24,6 @@ namespace HnEpsData + + variable [h_n_eps_data: HnEpsData] + +-set_option synthInstance.maxHeartbeats 80000 in +-set_option maxHeartbeats 900000 in + lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < 1 / 40) + (data : HnData) + (pows_i : Fin m → ℕ) +@@ -43,7 +39,6 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < + + nth_rw 2 [← List.prod_take_mul_prod_drop (i := k)] at this + rw [← List.prod_take_mul_prod_drop (i := k)] at this +- -- TODO - generalize this and PR to mathlib + conv at this => + lhs + lhs +@@ -55,11 +50,11 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < + rw [List.getElem?_take] + simp + by_cases i_lt_k: i < k +- . ++ · + simp [i_lt_k] + have i_lt_m: i < m := by omega + simp [i_lt_m] +- . simp [i_lt_k] ++ · simp [i_lt_k] + + conv at this => + rhs +@@ -72,11 +67,11 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < + rw [List.getElem?_take] + simp + by_cases i_lt_k: i < k +- . ++ · + simp [i_lt_k] + have i_lt_m: i < m := by omega + simp [i_lt_m] +- . simp [i_lt_k] ++ · simp [i_lt_k] + + + conv at this => +@@ -156,7 +151,6 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < + rw [SubmonoidClass.coe_pow] + grw [H_n_single_pow_lower_bound] + +- -- TODO : figure out why we can't use 'simp_rw' here + conv => + lhs + rhs +@@ -191,17 +185,17 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < + group + + grw [H_n_prod_le_k (c := c)] +- . linarith +- . ++ · linarith ++ · + rw [add_assoc] + rw [m_minus_k] + simp +- . exact c_pos +- . exact c_lt +- . exact pows_i_le +- . ++ · exact c_pos ++ · exact c_lt ++ · exact pows_i_le ++ · + linarith +- . ++ · + conv => + lhs + equals (-((pows_j k) : ℝ) + ((pows_i k) : ℝ)) => +@@ -221,34 +215,34 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < + simp + grw [c_lt] + apply mul_le_mul +- . norm_num +- . ++ · norm_num ++ · + rw [inv_le_inv₀] +- . ++ · + have my_prop := (theorem_3_8_h_n data k).g_dist + exact my_prop +- . apply H_n_eps_pos +- . have my_prop := (theorem_3_8_h_n data k).g_dist_nonzero ++ · apply H_n_eps_pos ++ · have my_prop := (theorem_3_8_h_n data k).g_dist_nonzero + positivity +- . simp ++ · simp + exact (H_n_eps_pos data.hd).le +- . norm_num +- . simp ++ · norm_num ++ · simp + have foo := H_n_eps_pos data.hd + linarith +- . simp [-SubmonoidClass.coe_list_prod] ++ · simp [-SubmonoidClass.coe_list_prod] + + + rw [ge_iff_le] at lhs_ge + + have one_tenth_lt: 1 / 10 * ‖(theorem_3_8_h_n data ↑k).g.val.val - 1‖ < (9 / 10) * ‖(theorem_3_8_h_n data ↑k).g.val.val - 1‖ := by + apply mul_lt_mul +- . norm_num +- . simp +- . ++ · norm_num ++ · simp ++ · + have ne_zero := (theorem_3_8_h_n data ↑k).g_dist_nonzero + positivity +- . norm_num ++ · norm_num + + + have add_swap (a b : ℕ): 1 + a + b = 1 + b + a := by +@@ -281,7 +275,6 @@ lemma words_distinct {m : ℕ} (k: Fin m) (c : ℝ) (c_pos : 0 < c) (c_lt : c < + simp at one_tenth_lt + + +-#print axioms words_distinct + + -- ContinuousLinearMap.norm_id + +@@ -327,13 +320,13 @@ lemma H_n_pows_mem_ball_G {m : ℕ} + simp [nested_list, replicate_pow] + simp [Fin.sum_ofFn] + grw [Finset.sum_le_card_nsmul (n := ⌊ (c * (H_n_eps data.hd)⁻¹)⌋₊)] +- . simp +- . intro x _ ++ · simp ++ · intro x _ + apply pows_le + + + use (fun i => full_list (i.cast (by omega))) +- . ++ · + + + conv => +@@ -360,11 +353,10 @@ lemma H_n_pows_mem_ball_G {m : ℕ} + + dsimp [nested_list, replicate_pow] + rw [List.prod_append] +- . simp [-List.prod_flatten] +- . omega ++ · simp [-List.prod_flatten] ++ · omega + + +-#print axioms H_n_pows_mem_ball_G + + -- Unfold the commutators from theorem_3_8_h_n as a list of elements + @[expose] +@@ -380,8 +372,6 @@ noncomputable def theorem_3_8_h_n_list (data: HnData) (m: ℕ): List (data.S) := + ++ (List.map (fun s => ⟨s.val⁻¹, by apply data.S_inv; simp⟩) (theorem_3_8_h_n_list data a)).reverse + + +-set_option synthInstance.maxHeartbeats 80000 in +-set_option maxHeartbeats 900000 in + lemma theorem_3_8_h_n_list_prod_eq (data: HnData) (m: ℕ): (theorem_3_8_h_n_list data m).unattach.prod = (theorem_3_8_h_n data m).g := by + induction m with + | zero => +@@ -409,7 +399,6 @@ lemma theorem_3_8_h_n_list_prod_eq (data: HnData) (m: ℕ): (theorem_3_8_h_n_lis + group + + -- Note - this is (2^(m - 1)) in Vikman, since the list in indexed starting at 1 in the paper +-set_option synthInstance.maxHeartbeats 1000000 in + lemma theorem_3_8_h_n_list_length_initial_upper_bound (data: HnData) (m: ℕ): (theorem_3_8_h_n_list data (m)).length ≤ (3 * (2 ^ (m))) - 2 := by + induction m with + | zero => +@@ -417,26 +406,25 @@ lemma theorem_3_8_h_n_list_length_initial_upper_bound (data: HnData) (m: ℕ): + simp + | succ a ih => + unfold theorem_3_8_h_n_list +- -- TODO - can grind somehow solve all of this? + simp + grw [ih] +- ring ++ ring_nf + rw [Nat.sub_mul] +- ring ++ ring_nf + zify + rw [Nat.cast_sub] +- . ++ · + push_cast +- ring ++ ring_nf + rw [Nat.cast_sub] +- . push_cast +- ring ++ · push_cast ++ ring_nf + linarith +- . ++ · + by_cases a_eq_zero: a = 0 +- . ++ · + simp [a_eq_zero] +- . ++ · + have a_eq_sub_succ: a = (a - 1) + 1 := by omega + rw [a_eq_sub_succ] + rw [Nat.pow_succ] +@@ -445,18 +433,17 @@ lemma theorem_3_8_h_n_list_length_initial_upper_bound (data: HnData) (m: ℕ): + rw [mul_assoc] + apply Nat.le_mul_of_pos_right + positivity +- . ++ · + rw [← ge_iff_le] + grw [(Nat.one_le_pow _ _ ?_).ge] +- . norm_num +- . norm_num ++ · norm_num ++ · norm_num + + + -- The c' constant from Vikman + @[expose] + def c' := 3 + +--- TODO - figure out how to merge this with 'theorem_3_8_h_n_list_length_initial_upper_bound' + lemma theorem_3_8_h_n_list_length_upper_bound (data: HnData) (m: ℕ): (theorem_3_8_h_n_list data (m)).length ≤ c' * (2 ^ m) := by + grw [theorem_3_8_h_n_list_length_initial_upper_bound data m] + simp [c'] +@@ -468,10 +455,10 @@ lemma list_concat_unattach {T: Type*} {p: T → Prop} (l: List { x: T // p x}) ( + + + lemma H_n_pows_mem_ball_S {m : ℕ} +- (m_gt: 0 < m) (data : HnData) (pows : Fin m → ℕ) ++ (_m_gt: 0 < m) (data : HnData) (pows : Fin m → ℕ) + (c: ℝ) +- (c_pos: 0 < c) +- (c_lt: c < 1 / 40) ++ (_c_pos: 0 < c) ++ (_c_lt: c < 1 / 40) + (pows_le : ∀ i : Fin m, (pows i) ≤ ⌊c * (H_n_eps data.hd)⁻¹⌋₊): + (List.ofFn (fun (i : Fin (m)) => (theorem_3_8_h_n data i).g^(pows i))).prod.val ∈ Subtype.val '' (data.S ^ ( c' * (Nat.floor (c * (H_n_eps data.hd)⁻¹)) * m * (2 ^ m))) := by + +@@ -486,7 +473,7 @@ lemma H_n_pows_mem_ball_S {m : ℕ} + + have g_as_list_prod_eq_pow: g_as_s_list.unattach.prod = (List.ofFn (fun (i: Fin m) => (List.replicate (pows i) (theorem_3_8_h_n_list data i)).flatten.unattach.prod)).unattach.prod := by + dsimp [g_as_s_list] +- clear m_gt ++ clear _m_gt + induction m with + | zero => + simp +@@ -544,27 +531,26 @@ lemma H_n_pows_mem_ball_S {m : ℕ} + rw [List.sum_ofFn] + simp + grw [Finset.sum_le_sum (g := fun i => (pows i) * c' * (2 ^ m))] +- . ++ · + grw [Finset.sum_le_card_nsmul (n := ⌊c * (H_n_eps data.hd)⁻¹⌋₊ * c' * (2^m))] +- . ++ · + simp +- ring ++ ring_nf + rfl +- . ++ · + intro i _ + grw [pows_le] +- . intro i _ ++ · intro i _ + grw [theorem_3_8_h_n_list_length_upper_bound] +- ring ++ ring_nf + grw [i.isLt] +- simp + + + let padded_list := Fin.append (fun (i: Fin (g_as_s_list.length)) => g_as_s_list[i]) (fun (i: Fin (((c' * (Nat.floor (c * (H_n_eps data.hd)⁻¹)) * m * (2 ^ m)) - g_as_s_list.length))) => ⟨1, data.S_one⟩) + + + refine ⟨?_, rfl⟩ +- . ++ · + use (fun i => padded_list (i.cast (by omega))) + conv => + lhs +@@ -573,8 +559,8 @@ lemma H_n_pows_mem_ball_S {m : ℕ} + apply congr (rfl) + ext i g + nth_rw 2 [List.ofFn_congr (n := (c' * ⌊c * (H_n_eps data.hd)⁻¹⌋₊ * m * 2 ^ m))] +- . simp +- . omega ++ · simp ++ · omega + + + rw [List.ofFn_fin_append] +@@ -589,7 +575,6 @@ lemma H_n_pows_mem_ball_S {m : ℕ} + simp + rw [g_list_prod] + +-#print axioms H_n_pows_mem_ball_S + + + -- In Vikman, this is (1 + ⌊c * (H_n_eps data.hd)⁻¹⌋₊) (since the powers include the upper bound of c*ε ⁻¹) +@@ -613,20 +598,19 @@ lemma H_n_ball_S_card {m : ℕ} + + rw [← my_card] + apply Finset.card_le_card_of_injOn (f := fun pows => (List.ofFn (fun (i : Fin (m)) => (theorem_3_8_h_n data (i)).g^((pows i).val))).prod) +- . ++ · + intro pows _ + simp +- -- TODO - modify H_n_pows_mem_ball_S so that this can just be 'apply' + have my_pows := H_n_pows_mem_ball_S m_gt data (fun i => (pows i).val) c c_pos c_lt ?_ +- . ++ · + rw [Set.mem_image] at my_pows + obtain ⟨g, g_mem, g_eq⟩ := my_pows + rw [← Subtype.ext_iff] at g_eq + rw [← g_eq] + exact g_mem +- . intro i ++ · intro i + simp +- . ++ · + intro pows_i _ pows_j _ + contrapose + intro pows_neq +@@ -635,10 +619,9 @@ lemma H_n_ball_S_card {m : ℕ} + + have exists_minimal_k := exists_minimal_of_wellFoundedLT (fun (i: Fin m) => pows_i i ≠ pows_j i) pows_neq + obtain ⟨k, k_minimal⟩ := exists_minimal_k +- -- TODO - figure out why this pushes a goal of 'False' if we don't use 'generalizing' + wlog pow_j_lt_i: (pows_j k).val < (pows_i k).val generalizing pows_i pows_j + +- . ++ · + conv at k_minimal => + arg 1 + intro i +@@ -646,42 +629,41 @@ lemma H_n_ball_S_card {m : ℕ} + + + have words_neq := this (pows_j := pows_i) (pows_i := pows_j) (by simp) (by simp) ?_ k_minimal ?_ +- . ++ · + rw [eq_comm] + exact words_neq +- . ++ · + obtain ⟨x, hx⟩ := pows_neq + use x + exact fun a ↦ hx (id (Eq.symm a)) +- . ++ · + have k_neq := k_minimal.prop + omega +- . ++ · + simp at k_minimal + + have eps_pos := H_n_eps_pos data.hd + + have prods_neq := words_distinct (m := m) k c c_pos c_lt data (fun i => pows_i i) (fun i => pows_j i) ?_ ?_ ?_ ?_ +- . simpa using prods_neq +- . ++ · simpa using prods_neq ++ · + intro i + rw [← Nat.le_floor_iff] + omega + positivity +- . intro i ++ · intro i + rw [← Nat.le_floor_iff] + omega + positivity +- . ++ · + intro j hk + have foo := Minimal.not_prop_of_lt k_minimal hk + simp at foo + exact congrArg Fin.val foo +- . ++ · + simpa using pow_j_lt_i + + +-#print axioms H_n_ball_S_card + + abbrev swap_le {a b: ℝ} (_: a ≤ b): Prop := b < a + +diff --git a/Gromov/UnitaryGromov.lean b/Gromov/UnitaryGromov.lean +index 2becf72..68e5e46 100644 +--- a/Gromov/UnitaryGromov.lean ++++ b/Gromov/UnitaryGromov.lean +@@ -16,15 +16,238 @@ public section + open scoped Matrix.Norms.L2Operator ComplexInnerProductSpace + + set_option linter.style.longLine false +-set_option linter.style.commandStart false + + open Subgroup Pointwise Finset + open scoped Pointwise Finset + open scoped commutatorElement IsMulCommutative + + +-set_option synthInstance.maxHeartbeats 100000 in +-set_option maxHeartbeats 2000000 in ++private noncomputable def image_growth_data ++ {X Y : Type*} [Group X] [DecidableEq X] [Group Y] [DecidableEq Y] ++ {P : Subgroup X} (D : SPolyData P) (f : P →* Y) : SPolyData f.range where ++ S := f.rangeRestrict '' D.S ++ S_one := ⟨1, D.S_one, map_one _⟩ ++ S_inv := by rw [← Set.image_inv, ← D.S_inv] ++ S_finite := D.S_finite.image _ ++ S_generates := by ++ rw [← MonoidHom.map_closure, D.S_generates] ++ exact Subgroup.map_top_of_surjective _ f.rangeRestrict_surjective ++ S_poly_const := D.S_poly_const ++ S_poly_const_pos := D.S_poly_const_pos ++ S_poly_deg := D.S_poly_deg ++ S_poly := by ++ intro r hr ++ rw [Set.Finite.toFinset_image, ← Finset.image_pow] ++ · exact Finset.card_image_le.trans (D.S_poly r hr) ++ · exact D.S_finite ++ ++@[expose] ++def map_S_data {G H: Type*} [Group G] [Group H] [DecidableEq G] [DecidableEq H] (A: Subgroup G) {f: G →* H} (S_data: SPolyData A): SPolyData (Subgroup.map f A) := { ++ S := f.subgroupMap A '' S_data.S ++ S_finite := by ++ apply Set.Finite.image ++ apply S_data.S_finite ++ S_one := by ++ simp only [Set.mem_image] ++ use 1 ++ simp ++ apply S_data.S_one ++ S_inv := by ++ rw [← Set.image_inv] ++ rw [← S_data.S_inv] ++ S_generates := by ++ rw [← MonoidHom.map_closure] ++ rw [S_data.S_generates] ++ rw [Subgroup.map_top_of_surjective] ++ apply MonoidHom.subgroupMap_surjective ++ S_poly_const := S_data.S_poly_const ++ S_poly_const_pos := S_data.S_poly_const_pos ++ S_poly_deg := S_data.S_poly_deg ++ S_poly := by ++ intro r hr ++ rw [Set.Finite.toFinset_image] ++ rw [← Finset.image_pow] ++ grw [Finset.card_image_le] ++ . ++ apply S_data.S_poly r hr ++ . exact S_data.S_finite ++} ++ ++ ++private noncomputable def subgroup_growth_data ++ {X : Type*} [Group X] [DecidableEq X] {P : Subgroup X} ++ (D : SPolyData P) (H : Subgroup P) (S : Finset H) ++ (hS : Subgroup.closure (S : Set H) = ⊤) : SPolyData H := by ++ let T := S ∪ S⁻¹ ∪ {1} ++ have hsym : D.S_finite.toFinset = D.S_finite.toFinset⁻¹ := by ++ ext x ++ simp ++ nth_rw 1 [D.S_inv] ++ simp ++ let growth := poly_growth_equiv D.S_poly_const D.S_poly_deg ++ (Nat.pos_of_ne_zero D.S_poly_const_pos.symm) D.S_finite.toFinset ++ (T.image H.subtype) hsym (by simpa using D.S_one) ++ (by simpa using D.S_generates) D.S_poly ++ let b := growth.choose ++ have hb := growth.choose_spec.1 ++ have hg := growth.choose_spec.2 ++ refine { ++ S := (T : Set H) ++ S_finite := T.finite_toSet ++ S_one := by simp [T] ++ S_inv := by simp [T, Set.union_comm] ++ S_generates := by simp [T, Subgroup.closure_union, hS] ++ S_poly_const := b ++ S_poly_const_pos := by omega ++ S_poly_deg := D.S_poly_deg ++ S_poly := ?_ } ++ intro r hr ++ simpa only [b, Finset.finite_toSet_toFinset, ← Finset.image_pow, ++ Finset.card_image_of_injective _ H.subtype_injective] using hg r hr ++ ++private lemma central_element_virtually_abelian (n : ℕ) (hn : n ≠ 0) ++ (n_eq_one : n ≠ 1) ++ (ih : ∀ m, m < n → m ≠ 0 → ∀ H : Subgroup (Matrix.unitaryGroup (Fin m) ℂ), ++ H.FG → SPolyData H → ∃ N : Subgroup H, IsMulCommutative N ∧ N.FiniteIndex) ++ (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) (G_FG : G.FG) ++ (S_data : SPolyData G) ++ (nontrivial_central : ∃ g : G, (∀ z : ℂ, g.val.val ≠ z • 1) ∧ g ∈ Set.center G) : ++ ∃ N : Subgroup G, IsMulCommutative N ∧ N.FiniteIndex := by ++ obtain ⟨g, g_not_multiple_I, g_central⟩ := nontrivial_central ++ ++ ++ have all_mem_central : ∀ a : G, a ∈ Subgroup.centralizer {g} := by ++ intro a b b_mem ++ simp at b_mem ++ rw [b_mem] ++ rw [Set.mem_center_iff] at g_central ++ have g_comm := g_central.comm a ++ exact g_comm ++ ++ have n_ge_two : 2 ≤ n := by ++ omega ++ ++ have n_ne_zero: NeZero n := by ++ exact { out := hn } ++ obtain ⟨data⟩ := centralizer_iso G g g_not_multiple_I ++ ++ ++ -- The abelian subgroup of G_i. ++ -- TODO - we need to construct a generating set for the smaller subgroup ++ -- TODO - is there existing API for this in mathlib? ++ let g_to_central: G →* (Subgroup.centralizer {g.val}) := { ++ toFun := fun a => ⟨a, by ++ rw [Subgroup.mem_centralizer_iff] ++ simp ++ rw [Set.mem_center_iff] at g_central ++ rw [isMulCentral_iff] at g_central ++ have foo := (g_central.1) a ++ rw [commute_iff_eq] at foo ++ rw [Subtype.ext_iff] at foo ++ simpa using foo ++ ⟩, ++ map_one' := by ++ simp ++ map_mul' := by ++ simp ++ } ++ ++ have ha := data.ha ++ ++ let new_A_map := (Subgroup.subtype _).comp ((MonoidHom.fst _ _).comp (data.iso.toMonoidHom.comp g_to_central)) ++ let new_B_map := (Subgroup.subtype _).comp ((MonoidHom.snd _ _).comp (data.iso.toMonoidHom.comp g_to_central)) ++ ++ let first_new_data := image_growth_data S_data new_A_map ++ ++ have data_b_pos: 0 < data.b := by ++ have hab := data.hb ++ omega ++ ++ -- TODO - deduplicate 'first_new_data' and 'second_new_data' ++ let second_new_data := image_growth_data S_data new_B_map ++ ++ obtain ⟨first_subgroup, first_subgroup_abelian, first_subgroup_finite_index⟩ := ih data.a (by have hab := data.hab; omega) (by grind) (new_A_map.range) (by ++ rw [← Group.fg_iff_subgroup_fg] ++ rw [← Group.fg_iff_subgroup_fg] at G_FG ++ apply Group.fg_range ++ ) (first_new_data) ++ obtain ⟨second_subgroup, second_subgroup_abelian, second_subgroup_finite_index⟩ := ih data.b (by have hab := data.hab; omega) (by grind) (new_B_map.range) (by ++ rw [← Group.fg_iff_subgroup_fg] ++ rw [← Group.fg_iff_subgroup_fg] at G_FG ++ apply Group.fg_range ++ ) (second_new_data) ++ ++ let iso := Subgroup.map data.iso.symm.toMonoidHom ++ ++ let G_1 := (Subgroup.comap new_A_map.rangeRestrict first_subgroup) ++ let G_2 := (Subgroup.comap new_B_map.rangeRestrict second_subgroup) ++ ++ have g_1_finite_index: G_1.FiniteIndex := by ++ unfold G_1 ++ rw [Subgroup.finiteIndex_iff] ++ rw [Subgroup.index_comap_of_surjective] ++ . ++ rw [← Subgroup.finiteIndex_iff] ++ apply first_subgroup_finite_index ++ . exact MonoidHom.rangeRestrict_surjective new_A_map ++ ++ have g_2_finite_index: G_2.FiniteIndex := by ++ unfold G_2 ++ rw [Subgroup.finiteIndex_iff] ++ rw [Subgroup.index_comap_of_surjective] ++ . ++ rw [← Subgroup.finiteIndex_iff] ++ apply second_subgroup_finite_index ++ . exact MonoidHom.rangeRestrict_surjective new_B_map ++ ++ ++ let G' := G_1 ⊓ G_2 ++ ++ have G'_finite_index : G'.FiniteIndex := by ++ unfold G' ++ infer_instance ++ ++ ++ have G'_abeliean : IsMulCommutative G' := by ++ unfold G' ++ refine { is_comm := ?_ } ++ refine { comm := ?_ } ++ intro a b ++ have a_mem := a.property ++ have b_mem := b.property ++ rw [Subgroup.mem_inf] at a_mem b_mem ++ have a_first := a_mem.1 ++ have b_first := b_mem.1 ++ have a_second := a_mem.2 ++ have b_second := b_mem.2 ++ unfold G_1 at a_first b_first ++ unfold G_2 at a_second b_second ++ ++ rw [Subgroup.mem_comap] at a_first b_first ++ ++ have first_comm := first_subgroup_abelian.is_comm.comm ⟨_, a_first⟩ ⟨_, b_first⟩ ++ have second_comm := second_subgroup_abelian.is_comm.comm ⟨_, a_second⟩ ⟨_, b_second⟩ ++ ++ apply Subtype.ext ++ have hcentral : Function.Injective g_to_central := by ++ intro (x : G) (y : G) h ++ exact Subtype.ext (congrArg (fun z : ↥(centralizer {g.val}) => z.val) h) ++ apply hcentral ++ apply data.iso.injective ++ apply Prod.ext ++ · apply Subtype.ext ++ change new_A_map (a.val * b.val) = new_A_map (b.val * a.val) ++ have h := congrArg (fun x : ↥first_subgroup => x.val.val) first_comm ++ change new_A_map a.val * new_A_map b.val = new_A_map b.val * new_A_map a.val at h ++ simpa only [map_mul] using h ++ · apply Subtype.ext ++ change new_B_map (a.val * b.val) = new_B_map (b.val * a.val) ++ have h := congrArg (fun x : ↥second_subgroup => x.val.val) second_comm ++ change new_B_map a.val * new_B_map b.val = new_B_map b.val * new_B_map a.val at h ++ simpa only [map_mul] using h ++ ++ use G' ++ + lemma compact_lie_virtually_abelian (n : ℕ) (hn : n ≠ 0) (G : Subgroup (Matrix.unitaryGroup (Fin n) ℂ)) (G_FG : G.FG) + (S_data: SPolyData G): ∃ N : Subgroup G, IsMulCommutative N ∧ N.FiniteIndex := by + +@@ -70,203 +293,8 @@ lemma compact_lie_virtually_abelian (n : ℕ) (hn : n ≠ 0) (G : Subgroup (Matr + } + } + · exact Subgroup.instFiniteIndexTop +- · have nontrivial_centrer_implies_virtual (G : Subgroup ↥(Matrix.unitaryGroup (Fin n) ℂ)) (G_FG : G.FG) (S_data: SPolyData G) (nontrivial_central : ∃ g : G, (∀ z : ℂ, g.val.val ≠ z • 1) ∧ g ∈ Set.center G): ∃ N : Subgroup G, IsMulCommutative ↥N ∧ N.FiniteIndex := by +- obtain ⟨g, g_not_multiple_I, g_central⟩ := nontrivial_central +- +- +- have all_mem_central : ∀ a : G, a ∈ Subgroup.centralizer {g} := by +- intro a b b_mem +- simp at b_mem +- rw [b_mem] +- rw [Set.mem_center_iff] at g_central +- have g_comm := g_central.comm a +- exact g_comm +- +- have n_ge_two : 2 ≤ n := by +- omega +- +- have n_ne_zero: NeZero n := by +- exact { out := hn } +- obtain ⟨data⟩ := centralizer_iso G g g_not_multiple_I +- +- +- -- The abelian subgroup of G_i. +- -- TODO - we need to construct a generating set for the smaller subgroup +- -- TODO - is there existing API for this in mathlib? +- let g_to_central: G →* (Subgroup.centralizer {g.val}) := { +- toFun := fun a => ⟨a, by +- rw [Subgroup.mem_centralizer_iff] +- simp +- rw [Set.mem_center_iff] at g_central +- rw [isMulCentral_iff] at g_central +- have foo := (g_central.1) a +- rw [commute_iff_eq] at foo +- rw [Subtype.ext_iff] at foo +- simpa using foo +- ⟩, +- map_one' := by +- simp +- map_mul' := by +- simp +- } +- +- have ha := data.ha +- +- let new_A_map := (Subgroup.subtype _).comp ((MonoidHom.fst _ _).comp (data.iso.toMonoidHom.comp g_to_central)) +- let new_B_map := (Subgroup.subtype _).comp ((MonoidHom.snd _ _).comp (data.iso.toMonoidHom.comp g_to_central)) +- +- let first_new_data: SPolyData (new_A_map.range) := { +- S := new_A_map.rangeRestrict '' S_data.S, +- S_one := by +- simp only [Set.mem_image] +- use 1 +- refine ⟨?_, ?_⟩ +- . apply S_data.S_one +- . exact map_one _ +- S_inv := by +- rw [← Set.image_inv] +- rw [← S_data.S_inv] +- S_finite := by +- apply Set.Finite.image +- apply S_data.S_finite +- S_generates := by +- rw [← MonoidHom.map_closure] +- rw [S_data.S_generates] +- rw [Subgroup.map_top_of_surjective] +- exact MonoidHom.rangeRestrict_surjective new_A_map +- S_poly_const := S_data.S_poly_const +- S_poly_const_pos := S_data.S_poly_const_pos +- S_poly_deg := S_data.S_poly_deg +- S_poly := by +- intro r hr +- rw [Set.Finite.toFinset_image] +- rw [← Finset.image_pow] +- grw [Finset.card_image_le] +- . +- apply S_data.S_poly r hr +- . exact S_data.S_finite +- } +- +- have data_b_pos: 0 < data.b := by +- have hab := data.hb +- omega +- +- -- TODO - deduplicate 'first_new_data' and 'second_new_data' +- let second_new_data: SPolyData (new_B_map.range) := { +- S := new_B_map.rangeRestrict '' S_data.S, +- S_one := by +- simp only [Set.mem_image] +- use 1 +- refine ⟨?_, ?_⟩ +- . apply S_data.S_one +- . exact map_one _ +- S_inv := by +- rw [← Set.image_inv] +- rw [← S_data.S_inv] +- S_finite := by +- apply Set.Finite.image +- apply S_data.S_finite +- S_generates := by +- rw [← MonoidHom.map_closure] +- rw [S_data.S_generates] +- rw [Subgroup.map_top_of_surjective] +- exact MonoidHom.rangeRestrict_surjective new_B_map +- S_poly_const := S_data.S_poly_const +- S_poly_const_pos := S_data.S_poly_const_pos +- S_poly_deg := S_data.S_poly_deg +- S_poly := by +- intro r hr +- rw [Set.Finite.toFinset_image] +- rw [← Finset.image_pow] +- grw [Finset.card_image_le] +- . +- apply S_data.S_poly r hr +- . exact S_data.S_finite +- } +- +- obtain ⟨first_subgroup, first_subgroup_abelian, first_subgroup_finite_index⟩ := compact_lie_virtually_abelian (data.a) (by grind) (new_A_map.range) (by +- rw [← Group.fg_iff_subgroup_fg] +- rw [← Group.fg_iff_subgroup_fg] at G_FG +- apply Group.fg_range +- ) (first_new_data) +- obtain ⟨second_subgroup, second_subgroup_abelian, second_subgroup_finite_index⟩ := compact_lie_virtually_abelian (data.b) (by grind) (new_B_map.range) (by +- rw [← Group.fg_iff_subgroup_fg] +- rw [← Group.fg_iff_subgroup_fg] at G_FG +- apply Group.fg_range +- ) (second_new_data) +- +- let iso := Subgroup.map data.iso.symm.toMonoidHom +- +- let G_1 := (Subgroup.comap new_A_map.rangeRestrict first_subgroup) +- let G_2 := (Subgroup.comap new_B_map.rangeRestrict second_subgroup) +- +- have g_1_finite_index: G_1.FiniteIndex := by +- unfold G_1 +- rw [Subgroup.finiteIndex_iff] +- rw [Subgroup.index_comap_of_surjective] +- . +- rw [← Subgroup.finiteIndex_iff] +- apply first_subgroup_finite_index +- . exact MonoidHom.rangeRestrict_surjective new_A_map +- +- have g_2_finite_index: G_2.FiniteIndex := by +- unfold G_2 +- rw [Subgroup.finiteIndex_iff] +- rw [Subgroup.index_comap_of_surjective] +- . +- rw [← Subgroup.finiteIndex_iff] +- apply second_subgroup_finite_index +- . exact MonoidHom.rangeRestrict_surjective new_B_map +- +- +- let G' := G_1 ⊓ G_2 +- +- have G'_finite_index : G'.FiniteIndex := by +- unfold G' +- infer_instance +- +- +- have G'_abeliean : IsMulCommutative G' := by +- unfold G' +- refine { is_comm := ?_ } +- refine { comm := ?_ } +- intro a b +- have a_mem := a.property +- have b_mem := b.property +- rw [Subgroup.mem_inf] at a_mem b_mem +- have a_first := a_mem.1 +- have b_first := b_mem.1 +- have a_second := a_mem.2 +- have b_second := b_mem.2 +- unfold G_1 at a_first b_first +- unfold G_2 at a_second b_second +- +- rw [Subgroup.mem_comap] at a_first b_first +- +- have first_comm := first_subgroup_abelian.is_comm.comm ⟨_, a_first⟩ ⟨_, b_first⟩ +- have second_comm := second_subgroup_abelian.is_comm.comm ⟨_, a_second⟩ ⟨_, b_second⟩ +- +- rw [Subtype.ext_iff] +- simp +- apply_fun g_to_central +- simp +- apply_fun data.iso +- . +- simp +- apply Prod.ext +- . simp +- rw [Subtype.ext_iff] +- simp +- exact congrArg (fun x : ↥first_subgroup => x.val.val) first_comm +- . simp +- rw [Subtype.ext_iff] +- simp +- exact congrArg (fun x : ↥second_subgroup => x.val.val) second_comm +- . intro a b hab +- simp [g_to_central] at hab +- simpa using hab +- +- use G' ++ · have nontrivial_centrer_implies_virtual := central_element_virtually_abelian n hn ++ n_eq_one (fun m hm hm0 H hH D => compact_lie_virtually_abelian m hm0 H hH D) + by_cases nontrivial_central : ∃ g : G, (∀ z : ℂ, g.val.val ≠ z • 1) ∧ g ∈ Set.center G + · exact nontrivial_centrer_implies_virtual G G_FG S_data nontrivial_central + · -- Case two - we have no non-trivial central elements +@@ -290,80 +318,11 @@ lemma compact_lie_virtually_abelian (n : ℕ) (hn : n ≠ 0) (G : Subgroup (Matr + + obtain ⟨pre_S, h_pre_S⟩ := G'_fg + +- have pos := S_data.S_poly_const_pos +- have my_equiv := poly_growth_equiv S_data.S_poly_const S_data.S_poly_deg (by omega) +- S_data.S_finite.toFinset (Finset.image (Subgroup.subtype _) (pre_S ∪ pre_S⁻¹ ∪ {1})) ?_ ?_ (by simp [S_data.S_generates]) S_data.S_poly +- +- obtain ⟨b, hb, new_poly⟩ := my_equiv +- +- let S_data_G': SPolyData ((G' n ε G)) := { +- S := pre_S ∪ pre_S⁻¹ ∪ {1}, +- S_finite := by simp, +- S_generates := by +- rw [Subgroup.closure_union] +- rw [Subgroup.closure_union] +- simp [h_pre_S] +- S_one := by +- simp +- S_inv := by +- simp +- rw [Set.union_comm] +- S_poly_const := b +- S_poly_const_pos := by omega +- S_poly_deg := S_data.S_poly_deg +- S_poly := by +- intro r hr +- unfold Set.Finite.toFinset +- specialize new_poly r hr +- rw [← Finset.image_pow] at new_poly +- rw [Finset.card_image_of_injective] at new_poly +- -- TODO(mathlib) - figure out what @[norm_cast] attribute to apply to make 'norm_cast' work with the {1} set +- have one_eq: ({1}: Set (G' n ε G)) = ({1}: Finset (G' n ε G)) := by simp +- norm_cast +- simp_rw [one_eq] +- norm_cast +- . simpa using new_poly +- . exact subtype_injective (G' n ε G) +- } +- +- let map_set (Q: Finset (G' n ε G)) := Finset.image (fun a => (⟨a.val, by simp⟩ : (Subgroup.map G.subtype (G' n ε G)))) Q +- let other := G.subtype '' (((G' n ε G).subtype) '' (pre_S)) +- ++ let S_data_G' := subgroup_growth_data S_data (G' n ε G) pre_S h_pre_S + + by_cases G'_nontrivial_central : ∃ g : (G' n ε G), (∀ z : ℂ, g.val.val.val ≠ z • 1) ∧ g ∈ Set.center (G' n ε G) + · +- let foo := S_data_G'.S +- let bar := G.subtype.subgroupMap (G' n ε G) +- have subtype_S_data: SPolyData (Subgroup.map G.subtype (G' n ε G)) := { +- S := (G.subtype.subgroupMap (G' n ε G)) '' S_data_G'.S +- S_finite := by +- apply Set.Finite.image +- apply S_data_G'.S_finite +- S_one := by +- simp only [Set.mem_image] +- use 1 +- simp +- apply S_data_G'.S_one +- S_inv := by +- rw [← Set.image_inv] +- rw [← S_data_G'.S_inv] +- S_generates := by +- rw [← MonoidHom.map_closure] +- rw [S_data_G'.S_generates] +- rw [Subgroup.map_top_of_surjective] +- exact MonoidHom.subgroupMap_surjective G.subtype (G' n ε G) +- S_poly_const := S_data_G'.S_poly_const +- S_poly_const_pos := S_data_G'.S_poly_const_pos +- S_poly_deg := S_data_G'.S_poly_deg +- S_poly := by +- intro r hr +- rw [Set.Finite.toFinset_image] +- rw [← Finset.image_pow] +- grw [Finset.card_image_le] +- . +- apply S_data_G'.S_poly r hr +- . exact S_data_G'.S_finite +- } ++ let subtype_S_data := map_S_data (f := G.subtype) (G' n ε G) S_data_G' + + have G'_virtual := nontrivial_centrer_implies_virtual (Subgroup.map G.subtype (G' n ε G)) (by + have G'_finite := G_eps.1 +@@ -415,59 +374,12 @@ lemma compact_lie_virtually_abelian (n : ℕ) (hn : n ≠ 0) (G : Subgroup (Matr + have target := HnEpsData.central_trivial_virtually_abelian n (by omega) G G_FG ?_ G_eps.1 S_data_G' ?_ + · exact target + · intro g hg +- simp only [ne_eq, not_exists, not_and] at G'_nontrivial_central +- specialize G'_nontrivial_central g +- rw [← not_imp_not] at G'_nontrivial_central +- simp at G'_nontrivial_central +- exact G'_nontrivial_central hg +- . rfl +- . +- ext a +- simp +- nth_rw 1 [S_data.S_inv] +- simp +- . simp +- apply S_data.S_one +-termination_by (n, G.index) +-decreasing_by +- · apply Prod.Lex.left +- have hab := data.hab +- grind +- . apply Prod.Lex.left +- have hab := data.hab +- grind +-#print axioms compact_lie_virtually_abelian +- +-@[expose] +-def map_S_data {G H: Type*} [Group G] [Group H] [DecidableEq G] [DecidableEq H] (A: Subgroup G) {f: G →* H} (S_data: SPolyData A): SPolyData (Subgroup.map f A) := { +- S := f.subgroupMap A '' S_data.S +- S_finite := by +- apply Set.Finite.image +- apply S_data.S_finite +- S_one := by +- simp only [Set.mem_image] +- use 1 +- simp +- apply S_data.S_one +- S_inv := by +- rw [← Set.image_inv] +- rw [← S_data.S_inv] +- S_generates := by +- rw [← MonoidHom.map_closure] +- rw [S_data.S_generates] +- rw [Subgroup.map_top_of_surjective] +- apply MonoidHom.subgroupMap_surjective +- S_poly_const := S_data.S_poly_const +- S_poly_const_pos := S_data.S_poly_const_pos +- S_poly_deg := S_data.S_poly_deg +- S_poly := by +- intro r hr +- rw [Set.Finite.toFinset_image] +- rw [← Finset.image_pow] +- grw [Finset.card_image_le] +- . +- apply S_data.S_poly r hr +- . exact S_data.S_finite +-} +- +-#print axioms HnEpsData.central_trivial_virtually_abelian ++ by_contra hc ++ apply G'_nontrivial_central ++ refine ⟨g, ?_, hg⟩ ++ intro z hz ++ exact hc ⟨z, hz⟩ ++ · simp only [S_data_G', subgroup_growth_data] ++ rfl ++termination_by n ++decreasing_by exact hm +diff --git a/Gromov/VWrapper.lean b/Gromov/VWrapper.lean +index c37f7e3..847b5f4 100644 +--- a/Gromov/VWrapper.lean ++++ b/Gromov/VWrapper.lean +@@ -12,11 +12,6 @@ used to locate a scale at which the growth of `V` is almost multiplicative. + + public section + +-set_option linter.style.cdot false +-set_option linter.style.whitespace false +-set_option linter.style.longLine false +-set_option linter.flexible false +-set_option linter.style.emptyLine false + + open scoped Finset + open scoped Pointwise +@@ -99,80 +94,82 @@ lemma f_monotone_on (bas : Module.Basis ι ℝ V): MonotoneOn (f bas) (Set.Ici + intro x hx y hy hxy + unfold f + grw [Finset.pow_subset_pow_right (n := y)] +- . ++ · + rw [mul_le_mul_iff_right₀] +- . ++ · + rw [Real.rpow_le_rpow_iff] +- . ++ · + apply matrix_det_montone +- . ++ · + apply Q_R_matrix_pos_def bas x (by simp [R'] at hx; exact hx) +- . ++ · + unfold Q_R_matrix + rw [← map_sub] + rw [← LinearMap.isPosSemidef_iff_posSemidef_toMatrix] + apply Q_R_lin_sub_pos_semi_def + simpa using hxy +- . ++ · + have foo := Q_R_matrix_pos_def bas x (by simp [R'] at hx; exact hx) + grind [foo.det_pos] +- . ++ · + have foo := Q_R_matrix_pos_def bas y (by simp [R'] at hy; exact hy) + grind [foo.det_pos] +- . simp [dim] ++ · simp [dim] + exact Module.finrank_pos +- . ++ · + simp + apply Finset.Nonempty.pow + apply S_nonempty + +- . apply Real.rpow_nonneg ++ · apply Real.rpow_nonneg + have foo := Q_R_matrix_pos_def bas x (by simp [R'] at hx; exact hx) + grind [foo.det_pos] +- . apply hGS.one_mem +- . exact hxy ++ · apply hGS.one_mem ++ · exact hxy + +-lemma h_montone_on (bas : Module.Basis ι ℝ V): MonotoneOn (h bas) (Set.Ici i₀) := by ++omit [Nonempty ι] in ++lemma h_montone_on [_nonempty : Nonempty ι] (bas : Module.Basis ι ℝ V): MonotoneOn (h bas) (Set.Ici i₀) := by + unfold h + rw [← Function.comp_def] + apply MonotoneOn.comp +- . apply Real.strictMonoOn_log.monotoneOn +- . ++ · apply Real.strictMonoOn_log.monotoneOn ++ · + rw [← Function.comp_def] + apply MonotoneOn.comp +- . apply f_monotone_on bas +- . ++ · apply f_monotone_on bas ++ · + conv => + arg 1 + equals fun n => 16 ^ n => + simp + apply (pow_right_monotone (by simp)).monotoneOn +- . intro a ha ++ · intro a ha + simp [i₀] at ha + simp + rw [Nat.clog_le_iff_le_pow] at ha +- . ++ · + rify at ha + grw [Nat.le_ceil (a := R')] + exact ha +- . simp +- . ++ · simp ++ · + intro a ha + simp + simp at ha + simp [f] + apply mul_pos +- . simp ++ · simp + apply Finset.Nonempty.pow + apply S_nonempty +- . ++ · + apply Real.rpow_pos_of_pos + apply (Q_R_matrix_pos_def_i₀ bas _ ?_).det_pos + rw [pow_le_pow_iff_right₀] +- . exact ha +- . simp ++ · exact ha ++ · simp + +-lemma growth_implies_lim_h (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growth_bound b d): Filter.Tendsto (fun (i: ℕ) => (h b i - d * i * Real.log 16)) Filter.atTop Filter.atBot := by ++omit [Nonempty ι] in ++lemma growth_implies_lim_h [_nonempty : Nonempty ι] (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growth_bound b d): Filter.Tendsto (fun (i: ℕ) => (h b i - d * i * Real.log 16)) Filter.atTop Filter.atBot := by + unfold growth_bound my_expr at h_growth + have pow_tendsto: Filter.Tendsto (fun n => 16 ^ n) Filter.atTop Filter.atTop := by + apply StrictMono.tendsto_atTop +@@ -191,9 +188,9 @@ lemma growth_implies_lim_h (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growt + rw [Real.log_div (by + rw [mul_ne_zero_iff] + refine ⟨?_, ?_⟩ +- . simp ++ · simp + grind [S_nonempty] +- . ++ · + have det_pos := (Q_R_matrix_pos_def_i₀ b (16 ^ (x + i₀)) (by + rw [add_comm] + rw [pow_add] +@@ -204,9 +201,9 @@ lemma growth_implies_lim_h (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growt + )).det_pos + + rw [Real.rpow_ne_zero] +- . grind +- . grind +- . ++ · grind ++ · grind ++ · + norm_cast + rw [inv_eq_zero] + norm_cast +@@ -220,7 +217,6 @@ lemma growth_implies_lim_h (b : Module.Basis ι ℝ V) (d: ℕ) (h_growth: growt + simp + exact comp_log + +-#print axioms growth_implies_lim_h + + @[expose] + noncomputable def a (d: ℕ) := 4 * d * Real.log 16 +@@ -234,11 +230,11 @@ lemma exists_j_0_for_h (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 + have h_gt (N: ℕ): h b (i₀ + (3 * w * N)) ≥ 4 * d * w * N * (Real.log 16) + h b i₀ := by + rw [h_sum] + grw [← Finset.card_nsmul_le_sum (n := w * (a d))] +- . ++ · + simp + simp [a] + grind +- . intro n hn ++ · intro n hn + apply this + + have h_diff_ge (N: ℕ): h b (i₀ + (3 * w * N)) - d * (i₀ + 3 * w * N) * Real.log 16 ≥ d * (w * N - i₀) * (Real.log 16) + h b i₀ := by +@@ -276,14 +272,14 @@ lemma exists_j_0_for_h (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 + lhs + equals 0 + negative_start => simp + apply Nat.add_le_add +- . simp +- . ++ · simp ++ · + conv => + lhs + equals 1 * negative_start => simp + apply Nat.mul_le_mul +- . grind +- . simp ++ · grind ++ · simp + ) + + have h_ge_one := h_diff_ge (max ⌈positive_start⌉₊ negative_start) +@@ -316,17 +312,17 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) + + have h_m_diff_le: h b (m + w) - h b (m) ≤ h b (i₀ + 3 * w * (j_0 + 1)) - h b (i₀ + 3 * w * (j_0)) := by + apply sub_le_sub +- . ++ · + apply h_montone_on b +- . simp [m] ++ · simp [m] + grind +- . simp +- . simp [m] ++ · simp ++ · simp [m] + grind +- . apply h_montone_on b +- . simp [m] +- . simp [m] +- . simp [m] ++ · apply h_montone_on b ++ · simp ++ · simp [m] ++ · simp [m] + + have h_le_w_a_d : h b (m + w) - h b m ≤ w * (a d) := by + grw [h_m_diff_le] +@@ -335,8 +331,8 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) + have w_a_le_h : w * (a d) ≤ h b (m + w) - h b m := by + rw [h_sum.symm] + grw [← Finset.card_nsmul_le_sum (n := (a d))] +- . simp +- . intro x hx ++ · simp ++ · intro x hx + apply this + simpa using hx + grind +@@ -346,22 +342,22 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) + by_contra! + + have h_sum (N: ℕ) := Finset.sum_Ico_sub (f := fun n => h b (m + n)) (m := (2 * w)) (n := (3 * w)) (by grind) +- simp only [Nat.Ico_zero_eq_range, add_zero, forall_const] at h_sum ++ simp only [forall_const] at h_sum + + have h_m_diff_le: h b (m + 3 * w) - h b (m + 2 * w) ≤ h b (i₀ + 3 * w * (j_0 + 1)) - h b (i₀ + 3 * w * (j_0)) := by + apply sub_le_sub +- . ++ · + apply h_montone_on b +- . simp [m] ++ · simp [m] + grind +- . simp +- . simp [m] ++ · simp ++ · simp [m] + grind +- . apply h_montone_on b +- . simp [m] +- . simp [m] ++ · apply h_montone_on b ++ · simp ++ · simp [m] + grind +- . simp [m] ++ · simp [m] + + have h_le_w_a_d : h b (m + 3 * w) - h b (m + 2 * w) ≤ w * (a d) := by + grw [h_m_diff_le] +@@ -371,10 +367,10 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) + + rw [h_sum.symm] + grw [← Finset.card_nsmul_le_sum (n := (a d))] +- . simp ++ · simp + rw [← Nat.sub_mul] + simp +- . intro x hx ++ · intro x hx + apply this + simp + simp at hx +@@ -385,20 +381,20 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) + obtain ⟨i_2, h_i_2⟩ := exists_i2 + have diff_i_lt: h b (i_2 + 1) - h b i_1 < w * (a d) := by + grw [h_montone_on b _ _ (b := i₀ + 3 * w * (j_0 + 1))] +- . ++ · + apply LE.le.trans_lt ?_ h_j_0 + apply sub_le_sub_left + apply h_montone_on b +- . simp +- . simp ++ · simp ++ · simp + grind +- . grind +- . simp at h_i_2 ++ · grind ++ · simp at h_i_2 + grind +- . simp ++ · simp + simp at h_i_2 + grind +- . simp [m] ++ · simp + + have foo := h_i_1.1 + simp at foo +@@ -407,8 +403,8 @@ lemma lemma_3_24 (b : Module.Basis ι ℝ V) (w d: ℕ) (hw: 0 < w) (hd: 0 < d) + have i_0_pos: 0 < i₀ := by + simp [i₀] + apply Nat.clog_pos +- . simp +- . simp [R'] ++ · simp ++ · simp [R'] + rw [Nat.lt_ceil] + simp [R'_] + have r_pos := R'_pos V +diff --git a/Gromov/Vendor/Carleson/ToMathlib/Analysis/Convolution.lean b/Gromov/Vendor/Carleson/ToMathlib/Analysis/Convolution.lean +index dd8200d..cc1fba1 100644 +--- a/Gromov/Vendor/Carleson/ToMathlib/Analysis/Convolution.lean ++++ b/Gromov/Vendor/Carleson/ToMathlib/Analysis/Convolution.lean +@@ -52,12 +52,13 @@ lemma lintegral_enorm_convolution_integrand_le_eLpNorm_mul_eLpNorm [AddGroup G] + hg.comp_quasiMeasurePreserving <| quasiMeasurePreserving_sub_left μ x₀ + have hL' : ∀ᵐ (x : G) ∂μ, ‖L (f x) (g (x₀ - x))‖ ≤ (1 : NNReal) * ‖f x‖ * ‖g (x₀ - x)‖ := by + simpa using Filter.Eventually.of_forall (fun x ↦ hL x (x₀ - x)) +- simpa [eLpNorm, eLpNorm', Function.comp_def] using +- eLpNorm_le_eLpNorm_mul_eLpNorm'_of_norm hf hg' (L ·) _ hL' (hpqr := hpq) ++ have bound := eLpNorm_le_eLpNorm_mul_eLpNorm_of_norm ++ (L ·) 1 (by fun_prop) hf hg' hL' (hpqr := hpq) ++ exact lintegral_enorm_le_eLpNorm_one.trans (by simpa only [Function.comp_def, ENNReal.coe_one, one_mul] using bound) + + /-- If `MemLp f p μ` and `MemLp g q μ`, where `p` and `q` are Hölder conjugates, then the + convolution of `f` and `g` exists everywhere. -/ +-theorem ConvolutionExists.of_memLp_memLp [AddGroup G] [MeasurableAdd₂ G] ++theorem ConvolutionExists.of_memLp_memLp_legacy [AddGroup G] [MeasurableAdd₂ G] + [MeasurableNeg G] (μ : Measure G) [SFinite μ] [μ.IsNegInvariant] [μ.IsAddLeftInvariant] + [μ.IsAddRightInvariant] {p q : ENNReal} (hpq : p.HolderConjugate q) + (hL : ∀ (x y : G), ‖L (f x) (g y)‖ ≤ ‖f x‖ * ‖g y‖) (hf : AEStronglyMeasurable f μ) +diff --git a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Function/LpSeminorm/Basic.lean b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Function/LpSeminorm/Basic.lean +index df0289c..b18f60f 100644 +--- a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Function/LpSeminorm/Basic.lean ++++ b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Function/LpSeminorm/Basic.lean +@@ -25,6 +25,10 @@ set_option linter.style.header false + open MeasureTheory + open scoped ENNReal + ++-- On the countable discrete groups used below, the new measurability guard ++-- in Mathlib's eLpNorm is discharged by this existing theorem. ++attribute [simp] AEStronglyMeasurable.of_discrete ++ + variable {α ε E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α} + [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] [ENorm ε] + +@@ -34,25 +38,18 @@ section MapMeasure + + variable {β : Type*} {mβ : MeasurableSpace β} {f : α → β} {g : β → E} + +-theorem eLpNormEssSup_map_measure' [MeasurableSpace E] [OpensMeasurableSpace E] ++theorem eLpNormEssSup_map_measure' [MeasurableSpace E] [OpensMeasurableSpace E] [SecondCountableTopology E] + (hg : AEMeasurable g (Measure.map f μ)) (hf : AEMeasurable f μ) : + eLpNormEssSup g (Measure.map f μ) = eLpNormEssSup (g ∘ f) μ := + essSup_map_measure hg.enorm hf + +-theorem eLpNorm_map_measure' [MeasurableSpace E] [OpensMeasurableSpace E] ++theorem eLpNorm_map_measure' [MeasurableSpace E] [OpensMeasurableSpace E] [SecondCountableTopology E] + (hg : AEMeasurable g (Measure.map f μ)) (hf : AEMeasurable f μ) : + eLpNorm g p (Measure.map f μ) = eLpNorm (g ∘ f) p μ := by +- by_cases hp_zero : p = 0 +- · aesop +- by_cases hp_top : p = ∞ +- · rw [hp_top, eLpNorm_exponent_top] +- exact eLpNormEssSup_map_measure' hg hf +- simp_rw [eLpNorm_eq_lintegral_rpow_enorm hp_zero hp_top] +- rw [lintegral_map' (hg.enorm.pow_const p.toReal) hf] +- rfl ++ exact eLpNorm_map_measure hg.aestronglyMeasurable hf + + theorem eLpNorm_comp_measurePreserving' {ν : Measure β} [MeasurableSpace E] +- [OpensMeasurableSpace E] (hg : AEMeasurable g ν) (hf : MeasurePreserving f μ ν) : ++ [OpensMeasurableSpace E] [SecondCountableTopology E] (hg : AEMeasurable g ν) (hf : MeasurePreserving f μ ν) : + eLpNorm (g ∘ f) p μ = eLpNorm g p ν := + Eq.symm <| hf.map_eq ▸ eLpNorm_map_measure' (hf.map_eq ▸ hg) hf.aemeasurable + +diff --git a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean +index 40fc8a4..fb8ba6c 100644 +--- a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean ++++ b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean +@@ -13,19 +13,13 @@ public import Gromov.Vendor.Carleson.ToMathlib.MeasureTheory.Measure.Haar.Unique + public import Gromov.Vendor.Carleson.ToMathlib.MeasureTheory.Measure.Prod + + /-! +-# Vendored from the Carleson project ++# Young's convolution inequality + +-Port of `Carleson/ToMathlib/MeasureTheory/Integral/MeanInequalities.lean` from +- (branch `young-add-group`, commit `3b35c86`), which is +-the non-abelian generalization of Young's convolution inequality. +- +-The `eLpNorm_Ioc_convolution_le_*` theorems at the end of the upstream file are omitted: they are +-unused here and would drag in the whole `Carleson/ToMathlib/MeasureTheory/Integral/Periodic.lean` +-(`liftIoc`) development. ++Non-abelian convolution inequalities, including Hölder and Minkowski estimates. ++Based on the Carleson project contributors' formalization of Young's inequality, ++, commit `3b35c86`. + -/ + +-set_option linter.style.header false +- + @[expose] public section + + open NNReal ENNReal MeasureTheory Finset +@@ -51,7 +45,6 @@ theorem Lp_add_le_sum + Lp_add_le _ _ _ hp + _ ≤ _ := by gcongr + +--- Add after `lintegral_prod_norm_pow_le` + /-- A version of Hölder with multiple arguments, allowing `∞` as an exponent. -/ + theorem lintegral_prod_norm_pow_le' {α ι : Type*} [MeasurableSpace α] {μ : Measure α} + {s : Finset ι} {f : ι → α → ℝ≥0∞} (hf : ∀ i ∈ s, AEMeasurable (f i) μ) +@@ -69,7 +62,8 @@ theorem lintegral_prod_norm_pow_le' {α ι : Type*} [MeasurableSpace α] {μ : M + lintegral_congr (fun a ↦ (Finset.mul_prod_erase s (f · a) hi₀).symm) + _ ≤ eLpNorm (f i₀) (p i₀) μ * ∫⁻ (a : α), ∏ i ∈ s.erase i₀, f i a ∂μ := by + rw [← lintegral_const_mul'', pi₀_eq_top] +- · exact lintegral_mono_ae <| (ae_le_essSup (f i₀)).mono (fun a ha ↦ mul_le_mul_left ha _) ++ · rw [eLpNorm_exponent_top (hf i₀ hi₀).aestronglyMeasurable] ++ exact lintegral_mono_ae <| (ae_le_essSup (f i₀)).mono (fun a ha ↦ mul_le_mul_left ha _) + · exact Finset.aemeasurable_fun_prod _ (fun i hi ↦ hf i (Finset.mem_of_mem_erase hi)) + _ ≤ eLpNorm (f i₀) (p i₀) μ * ∏ i ∈ s.erase i₀, eLpNorm (f i) (p i) μ := by + apply mul_right_mono +@@ -91,15 +85,15 @@ theorem lintegral_prod_norm_pow_le' {α ι : Type*} [MeasurableSpace α] {μ : M + convert ENNReal.lintegral_prod_norm_pow_le s hf' hp₁ hp₂ with a i₀ hi₀ i hi + · rw [← ENNReal.rpow_mul, mul_inv_cancel₀, rpow_one] + exact ENNReal.toReal_ne_zero.mpr ⟨p_ne_0 i₀ hi₀, (exists_top ⟨i₀, hi₀, ·⟩)⟩ +- · simp [eLpNorm, eLpNorm', p_ne_0 i hi, p_ne_top i hi] ++ · simp [eLpNorm, eLpNorm', p_ne_0 i hi, p_ne_top i hi, (hf i hi).aestronglyMeasurable] + + /-- **Hölder's inequality** for functions `α → ℝ≥0∞`, using exponents in `ℝ≥0∞` -/ + theorem lintegral_mul_le_eLpNorm_mul_eLqNorm {p q : ℝ≥0∞} (hpq : p.HolderConjugate q) + {f g : α → ENNReal} (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) : + ∫⁻ (a : α), (f * g) a ∂μ ≤ eLpNorm f p μ * eLpNorm g q μ := by +- -- adaptation note: `ENNReal.HolderConjugate` is now a class (`HolderTriple p q 1`), so the +- -- upstream dot-notation API (`hpq.symm`, `hpq.conj_eq`, `hpq.toReal_of_ne_top`) is gone. +- haveI := hpq ++ have := hpq ++ have hfm := hf.aestronglyMeasurable ++ have hgm := hg.aestronglyMeasurable + simp_rw [Pi.mul_apply] + have hp0 : p ≠ 0 := HolderConjugate.ne_zero p q + have hq0 : q ≠ 0 := HolderConjugate.ne_zero q p +@@ -109,14 +103,14 @@ theorem lintegral_mul_le_eLpNorm_mul_eLqNorm {p q : ℝ≥0∞} (hpq : p.HolderC + _ ≤ ∫⁻ a, essSup f μ * g a ∂μ := + lintegral_mono_ae <| (ae_le_essSup f).mono fun a ha ↦ mul_le_mul_left ha _ + _ = essSup f μ * ∫⁻ a, g a ∂μ := lintegral_const_mul'' _ hg +- _ = _ := by simp [eLpNorm, eLpNorm', eLpNormEssSup, hp, hq1] ++ _ = _ := by simp [eLpNorm, eLpNorm', eLpNormEssSup, hp, hq1, hfm, hgm] + rcases eq_or_ne q ∞ with hq | hq + · have hp1 : p = 1 := (HolderConjugate.eq_top_iff_eq_one q p).mp hq + calc ∫⁻ a, f a * g a ∂μ + _ ≤ ∫⁻ a, f a * essSup g μ ∂μ := + lintegral_mono_ae <| (ae_le_essSup g).mono fun a ha ↦ mul_le_mul_right ha _ + _ = (∫⁻ a, f a ∂μ) * essSup g μ := lintegral_mul_const'' _ hf +- _ = _ := by simp [eLpNorm, eLpNorm', eLpNormEssSup, hp1, hq] ++ _ = _ := by simp [eLpNorm, eLpNorm', eLpNormEssSup, hp1, hq, hfm, hgm] + -- Both exponents are finite: reduce to the real-exponent version. + have hpt : 0 < p.toReal := ENNReal.toReal_pos hp0 hp + have hqt : 0 < q.toReal := ENNReal.toReal_pos hq0 hq +@@ -129,7 +123,7 @@ theorem lintegral_mul_le_eLpNorm_mul_eLqNorm {p q : ℝ≥0∞} (hpq : p.HolderC + have : 0 < q.toReal⁻¹ := by positivity + linarith + convert ENNReal.lintegral_mul_le_Lp_mul_Lq μ hpq' hf hg +- all_goals simp [eLpNorm, eLpNorm', hp, hq, hp0, hq0] ++ all_goals simp [eLpNorm, eLpNorm', hp, hq, hp0, hq0, hfm, hgm] + + /-- **Cauchy–Schwarz inequality** for functions `α → ℝ≥0∞` (Hölder's inequality squared). -/ + theorem sq_lintegral_mul_le_mul_lintegral_sq {f g : α → ℝ≥0∞} +@@ -168,15 +162,21 @@ universe u𝕜 uG uE uE' uF + variable {𝕜 : Type u𝕜} {G : Type uG} [MeasurableSpace G] {μ : Measure G} + {E : Type uE} {E' : Type uE'} {F : Type uF} + ++variable [Countable G] [MeasurableSingletonClass G] ++ ++private theorem discrete_aestronglyMeasurable {Y : Type*} [TopologicalSpace Y] ++ (f : G → Y) : AEStronglyMeasurable f μ := AEStronglyMeasurable.of_discrete ++ ++attribute [local simp] discrete_aestronglyMeasurable ++ + variable [NormedAddCommGroup E] [NormedAddCommGroup E'] [NormedAddCommGroup F] + {f : G → E} {g : G → E'} + + /-- If `MemLp f p μ` and `MemLp g q μ`, where `p` and `q` are Hölder conjugates, then the + convolution of `f` and `g` exists everywhere. + +-This is `MeasureTheory.ConvolutionExists.of_memLp_memLp`, re-exported into the `ENNReal` +-namespace to match the name used elsewhere in this development. -/ +-alias ConvolutionExists.of_memLp_memLp := MeasureTheory.ConvolutionExists.of_memLp_memLp ++This follows from Hölder's inequality with the conjugate exponents. -/ ++alias ConvolutionExists.of_memLp_memLp := MeasureTheory.ConvolutionExists.of_memLp_memLp_legacy + + -- Used in the proof of `enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm` + open ENNReal in +@@ -191,9 +191,8 @@ private lemma eLpNorm_eq_eLpNorm_rpow (h : G → E) {r e : ℝ} (r0 : 0 < r) (e0 + have lt_top : ENNReal.ofReal (e * r) / ENNReal.ofReal (r - e) < ∞ := + div_lt_top ofReal_ne_top <| (not_iff_not.mpr ofReal_eq_zero).mpr r_sub_e_pos.not_ge + simp only [eLpNorm, eLpNorm', reduceIte, div_eq_zero_iff, ofReal_eq_zero, ofReal_ne_top, +- lt_top.ne, er_pos.not_ge, e0.not_ge, or_self, enorm_eq_self, ← rpow_mul] +- -- adaptation note: `field_simp` no longer sees through the `ENNReal.toReal` of the exponents, +- -- so we compute them by hand first. ++ lt_top.ne, er_pos.not_ge, e0.not_ge, or_self, enorm_eq_self, ← rpow_mul, ++ discrete_aestronglyMeasurable, ite_true] + have hrne : r - e ≠ 0 := r_sub_e_pos.ne' + have hene : e ≠ 0 := e0.ne' + have hrne0 : r ≠ 0 := r0.ne' +@@ -215,6 +214,7 @@ variable {L : E →L[𝕜] E' →L[𝕜] F} + + -- Used to handle trivial case `c ≤ 0` when proving versions of Young's convolution inequality + -- assuming `∀ (x y : G), ‖L (f x) (g y)‖ ≤ c * ‖f x‖ * ‖g y‖)` ++omit [Countable G] [MeasurableSingletonClass G] in + private theorem convolution_zero_of_c_nonpos [AddGroup G] {f : G → E} {g : G → E'} {c : ℝ} + (hL : ∀ (x y : G), ‖L (f x) (g y)‖ ≤ c * ‖f x‖ * ‖g y‖) (hc : c ≤ 0) : f ⋆[L, μ] g = 0 := by + have : ∀ (x y : G), L (f x) (g y) = 0 := +@@ -233,13 +233,13 @@ private theorem eLpNorm_top_convolution_le_aux [AddGroup G] {p q : ℝ≥0∞} + eLpNorm (f ⋆[L, μ] g) ∞ μ ≤ ENNReal.ofReal c * eLpNorm f p μ * eLpNorm g q μ := by + by_cases hc : c ≤ 0 + · simp [convolution_zero_of_c_nonpos hL hc] +- push_neg at hc +- rw [eLpNorm_exponent_top, eLpNormEssSup] ++ push Not at hc ++ rw [eLpNorm_exponent_top (discrete_aestronglyMeasurable _), eLpNormEssSup] + refine essSup_le_of_ae_le _ (Filter.Eventually.of_forall fun x ↦ ?_) + apply le_trans <| enorm_integral_le_lintegral_enorm _ + calc ∫⁻ y, ‖(L (f y)) (g (x - y))‖ₑ ∂μ + _ ≤ ∫⁻ y, ENNReal.ofReal c * ‖f y‖ₑ * ‖g (x - y)‖ₑ ∂μ := by +- simp_rw [← ofReal_norm_eq_enorm, ← ENNReal.ofReal_mul hc.le] ++ simp_rw [← ofReal_norm, ← ENNReal.ofReal_mul hc.le] + refine lintegral_mono (fun y ↦ ?_) + rw [← ENNReal.ofReal_mul <| mul_nonneg hc.le (norm_nonneg _)] + exact ENNReal.ofReal_le_ofReal <| hL y (x - y) +@@ -251,6 +251,7 @@ private theorem eLpNorm_top_convolution_le_aux [AddGroup G] {p q : ℝ≥0∞} + variable [AddGroup G] [TopologicalSpace G] [IsTopologicalAddGroup G] [BorelSpace G] + [μ.IsAddHaarMeasure] [LocallyCompactSpace G] [SecondCountableTopology G] + ++omit [LocallyCompactSpace G] in + /-- Special case of **Young's convolution inequality** when `r = ∞`. -/ + theorem eLpNorm_top_convolution_le [MeasurableSpace E] [OpensMeasurableSpace E] + [MeasurableSpace E'] [OpensMeasurableSpace E'] [μ.IsNegInvariant] {p q : ℝ≥0∞} +@@ -259,8 +260,9 @@ theorem eLpNorm_top_convolution_le [MeasurableSpace E] [OpensMeasurableSpace E] + eLpNorm (f ⋆[L, μ] g) ∞ μ ≤ ENNReal.ofReal c * eLpNorm f p μ * eLpNorm g q μ := by + refine eLpNorm_top_convolution_le_aux hpq hf.enorm ?_ ?_ c hL + · intro x; exact (hg.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub_left μ x)).enorm +- · intro x; exact eLpNorm_comp_measurePreserving' hg (μ.measurePreserving_sub_left x) ++ · intro x; exact eLpNorm_comp_measurePreserving hg.enorm.aestronglyMeasurable (μ.measurePreserving_sub_left x) + ++omit [LocallyCompactSpace G] in + /-- Special case of **Young's convolution inequality** when `r = ∞`. -/ + theorem eLpNorm_top_convolution_le' [μ.IsNegInvariant] {p q : ℝ≥0∞} + (hpq : p.HolderConjugate q) {f : G → E} {g : G → E'} +@@ -269,7 +271,7 @@ theorem eLpNorm_top_convolution_le' [μ.IsNegInvariant] {p q : ℝ≥0∞} + eLpNorm (f ⋆[L, μ] g) ∞ μ ≤ ENNReal.ofReal c * eLpNorm f p μ * eLpNorm g q μ := by + refine eLpNorm_top_convolution_le_aux hpq hf.enorm ?_ ?_ c hL + · intro x; exact (hg.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub_left μ x)).enorm +- · intro x; apply eLpNorm_comp_measurePreserving hg (Measure.measurePreserving_sub_left μ x) ++ · intro x; exact eLpNorm_comp_measurePreserving hg.enorm.aestronglyMeasurable (Measure.measurePreserving_sub_left μ x) + + -- Auxiliary inequality used to prove versions with simpler conditions on `f` and `g` + open ENNReal in +@@ -285,10 +287,10 @@ private theorem enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm_aux + (eLpNorm g (.ofReal q) μ) ^ ((r - q) / r)) := by + by_cases hc : c ≤ 0 + · simp [convolution_zero_of_c_nonpos hL hc] +- push_neg at hc ++ push Not at hc + by_cases μ0 : μ = 0 + · simp [μ0, convolution] +- push_neg at μ0 ++ push Not at μ0 + let F (i : Fin 3) : G → ℝ≥0∞ := + match i with + | 0 => fun y ↦ (‖f y‖ₑ ^ p * ‖g (x - y)‖ₑ ^ q) ^ (1 / r) +@@ -363,6 +365,7 @@ private theorem enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm_aux + simp [eLpNorm, eLpNorm', lintegral_sub_left_eq_self (‖g ·‖ₑ ^ (ENNReal.ofReal q).toReal) x] + + open ENNReal in ++omit [LocallyCompactSpace G] in + /-- This inequality is used in the proof of Young's convolution inequality + `eLpNorm_convolution_le_ofReal`. See `enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm'` for + a version assuming a.e. strong measurability instead. -/ +@@ -380,6 +383,7 @@ theorem enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm [MeasurableSpace E] + (fun x ↦ (hg.comp_quasiMeasurePreserving <| quasiMeasurePreserving_sub_left μ x).enorm) c hL x + + open ENNReal in ++omit [LocallyCompactSpace G] in + /-- This inequality is used in the proof of Young's convolution inequality + `eLpNorm_convolution_le_ofReal'`. -/ + theorem enorm_convolution_le_eLpNorm_mul_eLpNorm_mul_eLpNorm' +@@ -520,7 +524,7 @@ theorem eLpNorm_convolution_le_of_norm_le_mul [MeasurableSpace E] [OpensMeasurab + eLpNorm (f ⋆[L, μ] g) r μ ≤ .ofReal c * eLpNorm f p μ * eLpNorm g q μ := by + refine eLpNorm_convolution_le_of_norm_le_mul_aux hp hq hr hpqr hf.enorm ?_ ?_ ?_ c hL + · intro x; exact hg.enorm.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub_left μ x) +- · intro x; exact eLpNorm_comp_measurePreserving' hg (μ.measurePreserving_sub_left x) ++ · intro x; exact eLpNorm_comp_measurePreserving hg.enorm.aestronglyMeasurable (μ.measurePreserving_sub_left x) + · exact hg.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub μ μ) |>.enorm.pow_const _ + + /-- **Young's convolution inequality**: the `L^r` seminorm of a convolution `(f ⋆[L, μ] g)` is +@@ -535,7 +539,7 @@ theorem eLpNorm_convolution_le_of_norm_le_mul' + eLpNorm (f ⋆[L, μ] g) r μ ≤ .ofReal c * eLpNorm f p μ * eLpNorm g q μ := by + refine eLpNorm_convolution_le_of_norm_le_mul_aux hp hq hr hpqr hf.enorm ?_ ?_ ?_ c hL + · intro x; exact hg.enorm.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub_left μ x) +- · intro x; apply eLpNorm_comp_measurePreserving hg (μ.measurePreserving_sub_left x) ++ · intro x; exact eLpNorm_comp_measurePreserving hg.enorm.aestronglyMeasurable (μ.measurePreserving_sub_left x) + · exact hg.comp_quasiMeasurePreserving (quasiMeasurePreserving_sub μ μ) |>.enorm.pow_const _ + + /-- **Young's convolution inequality**: the `L^r` seminorm of a convolution `(f ⋆[L, μ] g)` is +diff --git a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Measure/Haar/Unique.lean b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Measure/Haar/Unique.lean +index 3cd8144..cfa394d 100644 +--- a/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Measure/Haar/Unique.lean ++++ b/Gromov/Vendor/Carleson/ToMathlib/MeasureTheory/Measure/Haar/Unique.lean +@@ -40,7 +40,7 @@ instance (priority := 100) IsHaarMeasure.isInvInvariant_of_isMulRightInvariant ( + let c : ℝ≥0∞ := haarScalarFactor μ.inv μ + have hc : μ.inv = c • μ := isMulLeftInvariant_eq_smul_of_regular μ.inv μ + have : map Inv.inv (map Inv.inv μ) = c ^ 2 • μ := by +- rw [← inv_def μ, hc, Measure.map_smul, ← inv_def μ, hc, smul_smul, pow_two] ++ rw [← inv_def μ, hc, Measure.map_smul c (by fun_prop), ← inv_def μ, hc, smul_smul, pow_two] + have μeq : μ = c ^ 2 • μ := by + simpa [map_map continuous_inv.measurable continuous_inv.measurable] using this + have K : TopologicalSpace.PositiveCompacts G := Classical.arbitrary _ +diff --git a/lake-manifest.json b/lake-manifest.json +index d526394..69de6ca 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,96 +1,117 @@ +-{"version": "1.2.0", ++{ ++ "version": "1.2.0", + "packagesDir": ".lake/packages", +- "packages": +- [{"url": "https://github.com/leanprover-community/mathlib4", ++ "packages": [ ++ { ++ "url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "a6180e1994004a7c705114bcbebaf5fff4b8384d", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "a6180e1994004a7c705114bcbebaf5fff4b8384d", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, +- "configFile": "lakefile.lean"}, +- {"url": "https://github.com/leanprover-community/plausible", ++ "configFile": "lakefile.lean" ++ }, ++ { ++ "url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "123d15766ba49356c02ebad2a4462dfe12d79899", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/LeanSearchClient", ++ "configFile": "lakefile.toml" ++ }, ++ { ++ "url": "https://github.com/leanprover-community/LeanSearchClient", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "f5c090429dff3cf66cb65562526c9ea6e8edfbcb", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/import-graph", ++ "configFile": "lakefile.toml" ++ }, ++ { ++ "url": "https://github.com/leanprover-community/import-graph", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "bb3469a87774349fe01898d8bf2fc6a1ce6411ca", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/ProofWidgets4", ++ "configFile": "lakefile.toml" ++ }, ++ { ++ "url": "https://github.com/leanprover-community/ProofWidgets4", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "222c58dad7706a6e7cae46c0edd65ea881d3ee27", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.lean"}, +- {"url": "https://github.com/leanprover-community/aesop", ++ "configFile": "lakefile.lean" ++ }, ++ { ++ "url": "https://github.com/leanprover-community/aesop", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7db8190085343afde2f5d2cdcc9bac719b6ec02c", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, +- "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/quote4", ++ "configFile": "lakefile.toml" ++ }, ++ { ++ "url": "https://github.com/leanprover-community/quote4", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "ef42f8944eaf5b6cbfbe75d1917d824c7dd6cf33", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, +- "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/batteries", ++ "configFile": "lakefile.toml" ++ }, ++ { ++ "url": "https://github.com/leanprover-community/batteries", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "76e1c118b0700b4ceafe99532e887d6431625e1a", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover/lean4-cli", ++ "configFile": "lakefile.toml" ++ }, ++ { ++ "url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "1319485273bf87833fa472afbcefdedecb16b45f", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.33.0-rc2", ++ "inputRev": "v4.34.0", + "inherited": true, +- "configFile": "lakefile.toml"}], ++ "configFile": "lakefile.toml" ++ } ++ ], + "name": "gromov", + "lakeDir": ".lake", +- "fixedToolchain": false} ++ "fixedToolchain": false ++} +diff --git a/lakefile.toml b/lakefile.toml +index 1faeb69..893e40a 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -9,8 +9,8 @@ autoImplicit = false + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "a6180e1994004a7c705114bcbebaf5fff4b8384d" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "Gromov" +diff --git a/lean-toolchain b/lean-toolchain +index c084c7f..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.33.0-rc2 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/heights-lean4341.patch b/lean/patches/heights-lean4341.patch index 9e6cd1903343bc9735ad238905de4e2b626a38da..0256e76da04bf980510c13b63f018088c5dd8580 100644 --- a/lean/patches/heights-lean4341.patch +++ b/lean/patches/heights-lean4341.patch @@ -1,494 +1,494 @@ -diff --git a/Heights/Absolute/Extension.lean b/Heights/Absolute/Extension.lean -index 6450f16..a242f46 100644 ---- a/Heights/Absolute/Extension.lean -+++ b/Heights/Absolute/Extension.lean -@@ -121,11 +121,7 @@ attribute [local instance] FractionRing.liftAlgebra in - /-- The absolute norm of an extended ideal is the `[K : k]`-th power of the absolute norm. -/ - lemma absNorm_map_algebraMap (I : Ideal (𝓞 k)) : - Ideal.absNorm (I.map (algebraMap (𝓞 k) (𝓞 K))) = Ideal.absNorm I ^ finrank k K := by -- rw [Ideal.absNorm_algebraMap, Algebra.finrank_eq_of_equiv_equiv -- (FractionRing.algEquiv (𝓞 k) k).toRingEquiv (FractionRing.algEquiv (𝓞 K) K).toRingEquiv] -- ext -- exact IsFractionRing.algEquiv_commutes (FractionRing.algEquiv (𝓞 k) k) -- (FractionRing.algEquiv (𝓞 K) K) _ -+ rw [Ideal.absNorm_algebraMap, ← IsFractionRing.finrank_eq (𝓞 k) k (𝓞 K) K] - - lemma finPart_algebraMap_of_integral {ι : Type*} [Finite ι] (z : ι → 𝓞 k) (hz : z ≠ 0) : - finPart (fun i => algebraMap k K (z i)) = finPart (fun i => (z i : k)) ^ finrank k K := by -diff --git a/Heights/Curve/Integrality.lean b/Heights/Curve/Integrality.lean -index f221058..cc3e3a8 100644 ---- a/Heights/Curve/Integrality.lean -+++ b/Heights/Curve/Integrality.lean -@@ -153,7 +153,7 @@ theorem apply_eval₂_le_nonarch (hw : ∀ a b, w (a + b) ≤ max (w a) (w b)) { - (zero_le_one.trans (one_le_coeffBound w Q)) fun m hm => ?_ - rw [map_mul, map_prod] - have hprod : ∏ i ∈ m.support, w (a i ^ m i) ≤ 1 := by -- refine Finset.prod_le_one (fun _ _ => w.nonneg _) fun i _ => ?_ -+ refine Finset.prod_le_one₀ (fun _ _ => w.nonneg _) fun i _ => ?_ - rw [map_pow] - exact pow_le_one₀ (w.nonneg _) (ha i) - calc w (Rat.castHom F (Q.coeff m)) * ∏ i ∈ m.support, w (a i ^ m i) -@@ -176,7 +176,7 @@ theorem apply_eval₂_le {a : κ → F} (ha : ∀ l, w (a l) ≤ 1) (Q : MvPolyn - refine Finset.sum_le_sum fun m hm => ?_ - rw [map_mul, map_prod] - have hprod : ∏ i ∈ m.support, w (a i ^ m i) ≤ 1 := by -- refine Finset.prod_le_one (fun _ _ => w.nonneg _) fun i _ => ?_ -+ refine Finset.prod_le_one₀ (fun _ _ => w.nonneg _) fun i _ => ?_ - rw [map_pow] - exact pow_le_one₀ (w.nonneg _) (ha i) - calc w (Rat.castHom F (Q.coeff m)) * ∏ i ∈ m.support, w (a i ^ m i) -diff --git a/Heights/Different/NumberField.lean b/Heights/Different/NumberField.lean -index 2136679..aae4cb0 100644 ---- a/Heights/Different/NumberField.lean -+++ b/Heights/Different/NumberField.lean -@@ -94,7 +94,7 @@ lemma multiplicity_le_of_not_pow_dvd {P I : Ideal R} [P.IsPrime] (hP : P ≠ ⊥ - - omit [IsDedekindDomain R] in - lemma multiplicity_eq_zero_of_not_dvd {P I : Ideal R} (h : ¬ P ∣ I) : multiplicity P I = 0 := -- multiplicity_eq_zero.mpr h -+ _root_.multiplicity_eq_zero_of_not_dvd h - - end Multiplicity - -diff --git a/Heights/Different/SerreBound.lean b/Heights/Different/SerreBound.lean -index 703d793..3c31aa0 100644 ---- a/Heights/Different/SerreBound.lean -+++ b/Heights/Different/SerreBound.lean -@@ -117,7 +117,7 @@ theorem exists_mem_pow_intTrace_notMem (h𝔭 : 𝔭 ≠ ⊥) (e κ : ℕ) (J : - refine Ideal.IsMaximal.eq_of_le inferInstance (Ideal.IsPrime.ne_top inferInstance) ?_ - change maximalIdeal Rₚ ≤ 𝔓ₚ.comap (algebraMap Rₚ Sₚ) - rw [← Ideal.map_le_iff_le_comap, hpSₚ] -- exact Ideal.mul_le_right.trans (Ideal.pow_le_self he) -+ exact Ideal.mul_le_left.trans (Ideal.pow_le_self he) - haveI : Finite (Rₚ ⧸ maximalIdeal Rₚ) := - Finite.of_equiv _ (IsLocalization.AtPrime.equivQuotMaximalIdeal 𝔭 Rₚ).toEquiv - -- the contraction of `𝔪^n` to `A` is `𝔭^n` -@@ -187,7 +187,7 @@ theorem exists_mem_pow_intTrace_notMem (h𝔭 : 𝔭 ≠ ⊥) (e κ : ℕ) (J : - ((Ideal.isCoprime_iff_sup_eq.mpr hJₚ').pow_left).pow_right - letI : Algebra (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) (Sₚ ⧸ Jₚ ^ (κ + 1)) := - Ideal.Quotient.algebraQuotientOfLEComap -- (by rw [← Ideal.map_le_iff_le_comap, hprod]; exact Ideal.mul_le_left) -+ (by rw [← Ideal.map_le_iff_le_comap, hprod]; exact Ideal.mul_le_right) - haveI : IsScalarTower Rₚ (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) (Sₚ ⧸ Jₚ ^ (κ + 1)) := - IsScalarTower.of_algebraMap_eq' rfl - haveI : IsScalarTower Rₚ (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) -diff --git a/Heights/Different/SerreCore.lean b/Heights/Different/SerreCore.lean -index f6972ba..9679716 100644 ---- a/Heights/Different/SerreCore.lean -+++ b/Heights/Different/SerreCore.lean -@@ -38,7 +38,7 @@ variable (e κ : ℕ) (J : Ideal B) - lemma pow_le_comap (hpB : 𝔭.map (algebraMap A B) = 𝔓 ^ e * J) : - 𝔭 ^ (κ + 1) ≤ (𝔓 ^ (e * (κ + 1))).comap (algebraMap A B) := by - rw [← Ideal.map_le_iff_le_comap, Ideal.map_pow, hpB, mul_pow, ← pow_mul] -- exact Ideal.mul_le_right -+ exact Ideal.mul_le_left - - /-- The `A/𝔭^{κ+1}`-algebra structure of `B/𝔓^{e(κ+1)}`. -/ - noncomputable def quotAlgebra (hpB : 𝔭.map (algebraMap A B) = 𝔓 ^ e * J) : -diff --git a/Heights/IdealFactorization.lean b/Heights/IdealFactorization.lean -index dcfa41a..0b9c902 100644 ---- a/Heights/IdealFactorization.lean -+++ b/Heights/IdealFactorization.lean -@@ -105,7 +105,7 @@ theorem ReducedPrincipalIdealData.denominator_eq - have hcount := (r.count_spanSingleton hx v).symm.trans - (s.count_spanSingleton hx v) - have htop : multiplicity v.asIdeal (⊤ : Ideal (𝓞 K)) = 0 := -- multiplicity_eq_zero.mpr (by -+ _root_.multiplicity_eq_zero_of_not_dvd (by - simpa only [← Ideal.one_eq_top] using v.prime.not_dvd_one) - have hr := v.multiplicity_sup (r.numerator_ne_bot hx) r.denominator_ne_bot - have hs := v.multiplicity_sup (s.numerator_ne_bot hx) s.denominator_ne_bot -@@ -203,7 +203,7 @@ lemma ReducedPrincipalIdealData.finitePlace_posLog_eq - (neg_nonpos.mpr (Int.natCast_nonneg _)) - have hA := r.numerator_ne_bot hx - have htop : multiplicity v.asIdeal (⊤ : Ideal (𝓞 K)) = 0 := -- multiplicity_eq_zero.mpr (by -+ _root_.multiplicity_eq_zero_of_not_dvd (by - simpa only [← Ideal.one_eq_top] using v.prime.not_dvd_one) - have hsup := v.multiplicity_sup hA r.denominator_ne_bot - rw [(Ideal.isCoprime_iff_sup_eq).mp r.coprime, htop] at hsup -@@ -319,7 +319,7 @@ lemma denominator_multiplicity_le_minimal - · have hD := (r.zero_normalization hj0).2 - rw [hD] - have htop : multiplicity v.asIdeal (⊤ : Ideal (𝓞 K)) = 0 := -- multiplicity_eq_zero.mpr (by -+ _root_.multiplicity_eq_zero_of_not_dvd (by - simpa only [← Ideal.one_eq_top] using v.prime.not_dvd_one) - rw [htop] - exact Nat.zero_le _ -@@ -327,7 +327,7 @@ lemma denominator_multiplicity_le_minimal - by_cases hD0 : multiplicity v.asIdeal r.denominator = 0 - · omega - have htop : multiplicity v.asIdeal (⊤ : Ideal (𝓞 K)) = 0 := -- multiplicity_eq_zero.mpr (by -+ _root_.multiplicity_eq_zero_of_not_dvd (by - simpa only [← Ideal.one_eq_top] using v.prime.not_dvd_one) - have hsup := v.multiplicity_sup hA r.denominator_ne_bot - rw [(Ideal.isCoprime_iff_sup_eq).mp r.coprime, htop] at hsup -diff --git a/Heights/LatticePointMapTopology.lean b/Heights/LatticePointMapTopology.lean -index 02e6b4e..6362309 100644 ---- a/Heights/LatticePointMapTopology.lean -+++ b/Heights/LatticePointMapTopology.lean -@@ -107,7 +107,7 @@ theorem continuousAt_latticeCurvePointMap_of_mem (τ : ℍ) (z : ℂ) - by_cases hz : z ∈ (periodPairOfUpperHalfPlane τ).lattice - · exact continuousAt_latticeCurvePointMap_of_mem τ z hz - · have hrestrict : Continuous -- ({z : ℂ | z ∉ (periodPairOfUpperHalfPlane τ).lattice}.restrict -+ ({z : ℂ | z ∉ (periodPairOfUpperHalfPlane τ).lattice}.domRestrict - (latticeCurvePointMap τ)) := by - change Continuous (fun w : LatticeComplement τ ↦ latticeCurvePointMap τ w) - apply (continuous_latticeAffineCurvePointMap τ).congr -@@ -116,7 +116,7 @@ theorem continuousAt_latticeCurvePointMap_of_mem (τ : ℍ) (z : ℂ) - exact (latticeAffineCurvePointMap_eq τ w).symm - have hon : ContinuousOn (latticeCurvePointMap τ) - ((periodPairOfUpperHalfPlane τ).lattice : Set ℂ)ᶜ := -- continuousOn_iff_continuous_restrict.mpr hrestrict -+ continuousOn_iff_continuous_domRestrict.mpr hrestrict - exact hon.continuousAt - ((periodPairOfUpperHalfPlane τ).isClosed_lattice.isOpen_compl.mem_nhds hz) - -diff --git a/Heights/ModularJ.lean b/Heights/ModularJ.lean -index b589e96..7b7ef38 100644 ---- a/Heights/ModularJ.lean -+++ b/Heights/ModularJ.lean -@@ -34,12 +34,12 @@ group. This is the reduction needed to move a preimage into the standard - fundamental domain. -/ - theorem modularJ_smul (γ : SL(2, ℤ)) (τ : ℍ) : modularJ (γ • τ) = modularJ τ := by - have hE : ModularForm.E₄ (γ • τ) = denom γ τ ^ (4 : ℤ) * ModularForm.E₄ τ := by -- letI : SlashInvariantFormClass (ModularForm 𝒮ℒ 4) Γ(1) 4 := -+ let : SlashInvariantFormClass (ModularForm 𝒮ℒ 4) Γ(1) 4 := - Gamma_one_coe_eq_SL ▸ inferInstance - exact SlashInvariantForm.slash_action_eqn_SL'' ModularForm.E₄ (mem_Gamma_one γ) τ - have hD : ModularForm.discriminant (γ • τ) = - denom γ τ ^ (12 : ℤ) * ModularForm.discriminant τ := by -- letI : SlashInvariantFormClass (CuspForm 𝒮ℒ 12) Γ(1) 12 := -+ let : SlashInvariantFormClass (CuspForm 𝒮ℒ 12) Γ(1) 12 := - Gamma_one_coe_eq_SL ▸ inferInstance - exact SlashInvariantForm.slash_action_eqn_SL'' CuspForm.discriminant (mem_Gamma_one γ) τ - rw [modularJ, modularJ, hE, hD] -diff --git a/Heights/PeriodPairScaling.lean b/Heights/PeriodPairScaling.lean -index 108bb60..41ec783 100644 ---- a/Heights/PeriodPairScaling.lean -+++ b/Heights/PeriodPairScaling.lean -@@ -167,9 +167,7 @@ private theorem eventually_hasDerivAt_reciprocalX (L : PeriodPair) : - rw [← hval] - exact hi - have hrhs : AnalyticAt ℂ (fun z ↦ 2 * reciprocalY L z) 0 := by -- convert (analyticAt_reciprocalY L).const_smul (c := (2 : ℂ)) using 1 -- ext z -- simp [Pi.smul_apply, smul_eq_mul] -+ exact (analyticAt_reciprocalY L).const_smul (c := (2 : ℂ)) - have hderiv : deriv (reciprocalX L) =ᶠ[𝓝 0] - (fun z ↦ 2 * reciprocalY L z) := - ((analyticAt_reciprocalX L).deriv.frequently_eq_iff_eventually_eq hrhs).mp -diff --git a/Heights/VariableChangeAnalytic.lean b/Heights/VariableChangeAnalytic.lean -index 67518e3..b86819f 100644 ---- a/Heights/VariableChangeAnalytic.lean -+++ b/Heights/VariableChangeAnalytic.lean -@@ -50,8 +50,8 @@ noncomputable def variableChangeAffineAmbientBiholomorph - fun_prop).contMDiff - contMDiff_invFun := (show ContDiff ℂ ω - (variableChangeAffineAmbientEquiv C).symm by -- dsimp [variableChangeAffineAmbientEquiv, -- WeierstrassCurve.VariableChange.inverseX, -+ change ContDiff ℂ ω (fun xy : ℂ × ℂ => (C.inverseX xy.1, C.inverseY xy.1 xy.2)) -+ dsimp [WeierstrassCurve.VariableChange.inverseX, - WeierstrassCurve.VariableChange.inverseY] - fun_prop).contMDiff - -diff --git a/Heights/WeierstrassFiniteAnalytic.lean b/Heights/WeierstrassFiniteAnalytic.lean -index 8833daf..258616d 100644 ---- a/Heights/WeierstrassFiniteAnalytic.lean -+++ b/Heights/WeierstrassFiniteAnalytic.lean -@@ -461,7 +461,7 @@ def complexWeierstrassImplicitYChart - have hright := e.right_inv x.2 - exact congrArg Prod.fst hright)⟩ - have hg : Continuous g := Continuous.subtype_mk hamb _ -- have heq : {x : ℂ | (0, x) ∈ e.target}.restrict inv = g := by -+ have heq : {x : ℂ | (0, x) ∈ e.target}.domRestrict inv = g := by - funext x - apply Subtype.ext - exact complexWeierstrassImplicitYChartInv_coe_of_mem -@@ -699,7 +699,7 @@ def complexWeierstrassImplicitXChart - have hright := e.right_inv y.2 - exact congrArg Prod.fst hright)⟩ - have hg : Continuous g := Continuous.subtype_mk hswap _ -- have heq : {y : ℂ | (0, y) ∈ e.target}.restrict inv = g := by -+ have heq : {y : ℂ | (0, y) ∈ e.target}.domRestrict inv = g := by - funext y - apply Subtype.ext - exact complexWeierstrassImplicitXChartInv_coe_of_mem -diff --git a/Heights/WeierstrassInfinityAnalytic.lean b/Heights/WeierstrassInfinityAnalytic.lean -index 3cf5a37..3fdc1c4 100644 ---- a/Heights/WeierstrassInfinityAnalytic.lean -+++ b/Heights/WeierstrassInfinityAnalytic.lean -@@ -312,7 +312,7 @@ def complexWeierstrassInfinityBranchChart (W : WeierstrassCurve ℂ) : - ⟨e.symm (inc u), by - exact congrArg Prod.fst (e.right_inv u.2)⟩ - have hg : Continuous g := Continuous.subtype_mk hamb _ -- have heq : {u : ℂ | (0, u) ∈ e.target}.restrict inv = g := by -+ have heq : {u : ℂ | (0, u) ∈ e.target}.domRestrict inv = g := by - funext u - apply Subtype.ext - exact complexWeierstrassInfinityChartInv_coe_of_mem W u.1 u.2 -diff --git a/Heights/WeierstrassPrincipalPart.lean b/Heights/WeierstrassPrincipalPart.lean -index cc8d3cc..6254a27 100644 ---- a/Heights/WeierstrassPrincipalPart.lean -+++ b/Heights/WeierstrassPrincipalPart.lean -@@ -187,27 +187,27 @@ theorem tendsto_weierstrass_secant_addX_zero (L : PeriodPair) (a b : ℂ) : - tendsto_const_nhds - have hea : Tendsto (fun z ↦ e z - a) (𝓝[≠] 0) (𝓝 (-a)) := by - convert he.sub ha using 1 -- all_goals ring -+ all_goals ring_nf - have hdb : Tendsto (fun z ↦ d z - b) (𝓝[≠] 0) (𝓝 (-b)) := by - convert hd.sub hb using 1 -- all_goals ring -+ all_goals ring_nf - have hA : Tendsto A (𝓝[≠] 0) (𝓝 1) := by - dsimp [A] - simpa using tendsto_const_nhds.add (hea.mul (hz.pow 2)) - have hC : Tendsto C (𝓝[≠] 0) (𝓝 (-2 * a)) := by - dsimp [C] - convert (hea.const_mul 2).add (hdb.mul hz) using 1 -- all_goals ring -+ all_goals ring_nf - have hD : Tendsto D (𝓝[≠] 0) (𝓝 (-4)) := by - dsimp [D] - convert (hnegfour.add (hdb.mul (hz.pow 3))).sub - ((hea.mul (hz.pow 2)).const_mul 2) using 1 - · funext z - ring -- · ring -+ · ring_nf - have hden : Tendsto (fun z ↦ 4 * A z ^ 2) (𝓝[≠] 0) (𝓝 4) := by - convert hfour.mul (hA.pow 2) using 1 -- all_goals ring -+ all_goals ring_nf - have hfrac : Tendsto (fun z ↦ D z * C z / (4 * A z ^ 2)) - (𝓝[≠] 0) (𝓝 (2 * a)) := by - have h := (hD.mul hC).div hden (by norm_num) -@@ -217,11 +217,11 @@ theorem tendsto_weierstrass_secant_addX_zero (L : PeriodPair) (a b : ℂ) : - filter_upwards with z - simp only [Pi.div_apply] - convert h' using 1 -- ring -+ ring_nf - have hG : Tendsto (fun z ↦ -e z - a + D z * C z / (4 * A z ^ 2)) - (𝓝[≠] 0) (𝓝 a) := by - convert (he.neg.sub ha).add hfrac using 1 -- all_goals ring -+ all_goals ring_nf - apply hG.congr' - have hAne : ∀ᶠ z in 𝓝[≠] (0 : ℂ), A z ≠ 0 := - hA (eventually_ne_nhds one_ne_zero) -@@ -300,11 +300,11 @@ theorem tendsto_weierstrass_secant_addY_zero (L : PeriodPair) (a b : ℂ) : - have h := hc.tendsto.comp hzed - convert h using 1 - · rfl -- · ring -+ · ring_nf - have hN : Tendsto N (𝓝[≠] 0) (𝓝 0) := by - dsimp [N] - convert ((hE.const_mul (-24)).sub (hd.const_mul 8)).add (hz.mul hS) using 1 -- all_goals ring -+ all_goals ring_nf - have hA : Tendsto A (𝓝[≠] 0) (𝓝 1) := by - dsimp [A] - simpa using tendsto_const_nhds.add -@@ -313,11 +313,8 @@ theorem tendsto_weierstrass_secant_addY_zero (L : PeriodPair) (a b : ℂ) : - simpa using (tendsto_const_nhds.mul (hA.pow 3)) - have hquot : Tendsto (fun z ↦ N z / (8 * A z ^ 3)) - (𝓝[≠] 0) (𝓝 0) := by -- have h := hN.div hden (by norm_num) -- convert h using 1 -- · funext z -- simp only [Pi.div_apply] -- · norm_num -+ change Tendsto (N / (fun z => 8 * A z ^ 3)) (𝓝[≠] 0) (𝓝 0) -+ simpa only [zero_div] using hN.div hden (by norm_num) - have hfinal : Tendsto (fun z ↦ b / 2 + N z / (8 * A z ^ 3)) - (𝓝[≠] 0) (𝓝 (b / 2)) := by - simpa using tendsto_const_nhds.add hquot -diff --git a/Heights/WeierstrassSurjectivity.lean b/Heights/WeierstrassSurjectivity.lean -index 37b20a6..72b3cfc 100644 ---- a/Heights/WeierstrassSurjectivity.lean -+++ b/Heights/WeierstrassSurjectivity.lean -@@ -66,7 +66,7 @@ private theorem reciprocalWeierstrassSub_analyticAt (L : PeriodPair) (a z : ℂ) - apply hraw.congr - filter_upwards [L.isClosed_lattice.isOpen_compl.mem_nhds hz] with w hw - have hw' : w ∉ L.lattice := hw -- rw [reciprocalWeierstrassSub, if_neg hw', Pi.inv_apply, Pi.sub_apply] -+ rw [reciprocalWeierstrassSub, ite_eq_right hw', Pi.inv_apply, Pi.sub_apply] - - private theorem reciprocalWeierstrassSub_add_lattice (L : PeriodPair) (a z : ℂ) - (l : L.lattice) : -@@ -97,7 +97,7 @@ theorem exists_notMem_lattice_weierstrassP_eq (L : PeriodPair) (a : ℂ) : - let z₀ : ℂ := L.ω₁ / 2 - have hz₀ : z₀ ∉ L.lattice := L.ω₁_div_two_notMem_lattice - have hne : reciprocalWeierstrassSub L a z₀ ≠ 0 := by -- rw [reciprocalWeierstrassSub, if_neg hz₀] -+ rw [reciprocalWeierstrassSub, ite_eq_right hz₀] - exact inv_ne_zero (sub_ne_zero.mpr (h z₀ hz₀)) - apply hne - exact (hdiff.apply_eq_apply_of_bounded hcompact.isBounded z₀ 0).trans (by -diff --git a/lake-manifest.json b/lake-manifest.json -index 5d54dbc..67ccad8 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,7 +1,17 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/lana-agents/belyi.git", -+ [{"url": "https://github.com/lana-agents/heights.git", -+ "type": "git", -+ "subDir": null, -+ "scope": "", -+ "rev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", -+ "name": "heights", -+ "manifestFile": "lake-manifest.json", -+ "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", -+ "inherited": true, -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/belyi.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -11,31 +21,31 @@ - "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", - "inherited": false, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/mathlib4", -+ {"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, - {"url": "https://github.com/lana-agents/oka.git", - "type": "git", - "subDir": null, - "scope": "", -- "rev": "da228a2cf9671aaba08ddc96274d75e098b28f67", -+ "rev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", - "name": "oka", - "manifestFile": "lake-manifest.json", -- "inputRev": "da228a2cf9671aaba08ddc96274d75e098b28f67", -+ "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", - "inherited": true, - "configFile": "lakefile.toml"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -65,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -75,7 +85,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -85,7 +95,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -95,7 +105,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -105,10 +115,10 @@ - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "heights", -diff --git a/lakefile.toml b/lakefile.toml -index a8e48a6..4d39ef8 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,6 +4,8 @@ keywords = ["math"] - defaultTargets = ["Heights", "Challenge", "Solution"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true -@@ -11,8 +13,8 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - # Curves over number fields as function fields (Belyi.CurveField), for the height machine on - # curves (GenEll height theory, branch wp-height-theory). -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f49..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/Heights/Absolute/Extension.lean b/Heights/Absolute/Extension.lean +index 6450f16..a242f46 100644 +--- a/Heights/Absolute/Extension.lean ++++ b/Heights/Absolute/Extension.lean +@@ -121,11 +121,7 @@ attribute [local instance] FractionRing.liftAlgebra in + /-- The absolute norm of an extended ideal is the `[K : k]`-th power of the absolute norm. -/ + lemma absNorm_map_algebraMap (I : Ideal (𝓞 k)) : + Ideal.absNorm (I.map (algebraMap (𝓞 k) (𝓞 K))) = Ideal.absNorm I ^ finrank k K := by +- rw [Ideal.absNorm_algebraMap, Algebra.finrank_eq_of_equiv_equiv +- (FractionRing.algEquiv (𝓞 k) k).toRingEquiv (FractionRing.algEquiv (𝓞 K) K).toRingEquiv] +- ext +- exact IsFractionRing.algEquiv_commutes (FractionRing.algEquiv (𝓞 k) k) +- (FractionRing.algEquiv (𝓞 K) K) _ ++ rw [Ideal.absNorm_algebraMap, ← IsFractionRing.finrank_eq (𝓞 k) k (𝓞 K) K] + + lemma finPart_algebraMap_of_integral {ι : Type*} [Finite ι] (z : ι → 𝓞 k) (hz : z ≠ 0) : + finPart (fun i => algebraMap k K (z i)) = finPart (fun i => (z i : k)) ^ finrank k K := by +diff --git a/Heights/Curve/Integrality.lean b/Heights/Curve/Integrality.lean +index f221058..cc3e3a8 100644 +--- a/Heights/Curve/Integrality.lean ++++ b/Heights/Curve/Integrality.lean +@@ -153,7 +153,7 @@ theorem apply_eval₂_le_nonarch (hw : ∀ a b, w (a + b) ≤ max (w a) (w b)) { + (zero_le_one.trans (one_le_coeffBound w Q)) fun m hm => ?_ + rw [map_mul, map_prod] + have hprod : ∏ i ∈ m.support, w (a i ^ m i) ≤ 1 := by +- refine Finset.prod_le_one (fun _ _ => w.nonneg _) fun i _ => ?_ ++ refine Finset.prod_le_one₀ (fun _ _ => w.nonneg _) fun i _ => ?_ + rw [map_pow] + exact pow_le_one₀ (w.nonneg _) (ha i) + calc w (Rat.castHom F (Q.coeff m)) * ∏ i ∈ m.support, w (a i ^ m i) +@@ -176,7 +176,7 @@ theorem apply_eval₂_le {a : κ → F} (ha : ∀ l, w (a l) ≤ 1) (Q : MvPolyn + refine Finset.sum_le_sum fun m hm => ?_ + rw [map_mul, map_prod] + have hprod : ∏ i ∈ m.support, w (a i ^ m i) ≤ 1 := by +- refine Finset.prod_le_one (fun _ _ => w.nonneg _) fun i _ => ?_ ++ refine Finset.prod_le_one₀ (fun _ _ => w.nonneg _) fun i _ => ?_ + rw [map_pow] + exact pow_le_one₀ (w.nonneg _) (ha i) + calc w (Rat.castHom F (Q.coeff m)) * ∏ i ∈ m.support, w (a i ^ m i) +diff --git a/Heights/Different/NumberField.lean b/Heights/Different/NumberField.lean +index 2136679..aae4cb0 100644 +--- a/Heights/Different/NumberField.lean ++++ b/Heights/Different/NumberField.lean +@@ -94,7 +94,7 @@ lemma multiplicity_le_of_not_pow_dvd {P I : Ideal R} [P.IsPrime] (hP : P ≠ ⊥ + + omit [IsDedekindDomain R] in + lemma multiplicity_eq_zero_of_not_dvd {P I : Ideal R} (h : ¬ P ∣ I) : multiplicity P I = 0 := +- multiplicity_eq_zero.mpr h ++ _root_.multiplicity_eq_zero_of_not_dvd h + + end Multiplicity + +diff --git a/Heights/Different/SerreBound.lean b/Heights/Different/SerreBound.lean +index 703d793..3c31aa0 100644 +--- a/Heights/Different/SerreBound.lean ++++ b/Heights/Different/SerreBound.lean +@@ -117,7 +117,7 @@ theorem exists_mem_pow_intTrace_notMem (h𝔭 : 𝔭 ≠ ⊥) (e κ : ℕ) (J : + refine Ideal.IsMaximal.eq_of_le inferInstance (Ideal.IsPrime.ne_top inferInstance) ?_ + change maximalIdeal Rₚ ≤ 𝔓ₚ.comap (algebraMap Rₚ Sₚ) + rw [← Ideal.map_le_iff_le_comap, hpSₚ] +- exact Ideal.mul_le_right.trans (Ideal.pow_le_self he) ++ exact Ideal.mul_le_left.trans (Ideal.pow_le_self he) + haveI : Finite (Rₚ ⧸ maximalIdeal Rₚ) := + Finite.of_equiv _ (IsLocalization.AtPrime.equivQuotMaximalIdeal 𝔭 Rₚ).toEquiv + -- the contraction of `𝔪^n` to `A` is `𝔭^n` +@@ -187,7 +187,7 @@ theorem exists_mem_pow_intTrace_notMem (h𝔭 : 𝔭 ≠ ⊥) (e κ : ℕ) (J : + ((Ideal.isCoprime_iff_sup_eq.mpr hJₚ').pow_left).pow_right + letI : Algebra (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) (Sₚ ⧸ Jₚ ^ (κ + 1)) := + Ideal.Quotient.algebraQuotientOfLEComap +- (by rw [← Ideal.map_le_iff_le_comap, hprod]; exact Ideal.mul_le_left) ++ (by rw [← Ideal.map_le_iff_le_comap, hprod]; exact Ideal.mul_le_right) + haveI : IsScalarTower Rₚ (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) (Sₚ ⧸ Jₚ ^ (κ + 1)) := + IsScalarTower.of_algebraMap_eq' rfl + haveI : IsScalarTower Rₚ (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) +diff --git a/Heights/Different/SerreCore.lean b/Heights/Different/SerreCore.lean +index f6972ba..9679716 100644 +--- a/Heights/Different/SerreCore.lean ++++ b/Heights/Different/SerreCore.lean +@@ -38,7 +38,7 @@ variable (e κ : ℕ) (J : Ideal B) + lemma pow_le_comap (hpB : 𝔭.map (algebraMap A B) = 𝔓 ^ e * J) : + 𝔭 ^ (κ + 1) ≤ (𝔓 ^ (e * (κ + 1))).comap (algebraMap A B) := by + rw [← Ideal.map_le_iff_le_comap, Ideal.map_pow, hpB, mul_pow, ← pow_mul] +- exact Ideal.mul_le_right ++ exact Ideal.mul_le_left + + /-- The `A/𝔭^{κ+1}`-algebra structure of `B/𝔓^{e(κ+1)}`. -/ + noncomputable def quotAlgebra (hpB : 𝔭.map (algebraMap A B) = 𝔓 ^ e * J) : +diff --git a/Heights/IdealFactorization.lean b/Heights/IdealFactorization.lean +index dcfa41a..0b9c902 100644 +--- a/Heights/IdealFactorization.lean ++++ b/Heights/IdealFactorization.lean +@@ -105,7 +105,7 @@ theorem ReducedPrincipalIdealData.denominator_eq + have hcount := (r.count_spanSingleton hx v).symm.trans + (s.count_spanSingleton hx v) + have htop : multiplicity v.asIdeal (⊤ : Ideal (𝓞 K)) = 0 := +- multiplicity_eq_zero.mpr (by ++ _root_.multiplicity_eq_zero_of_not_dvd (by + simpa only [← Ideal.one_eq_top] using v.prime.not_dvd_one) + have hr := v.multiplicity_sup (r.numerator_ne_bot hx) r.denominator_ne_bot + have hs := v.multiplicity_sup (s.numerator_ne_bot hx) s.denominator_ne_bot +@@ -203,7 +203,7 @@ lemma ReducedPrincipalIdealData.finitePlace_posLog_eq + (neg_nonpos.mpr (Int.natCast_nonneg _)) + have hA := r.numerator_ne_bot hx + have htop : multiplicity v.asIdeal (⊤ : Ideal (𝓞 K)) = 0 := +- multiplicity_eq_zero.mpr (by ++ _root_.multiplicity_eq_zero_of_not_dvd (by + simpa only [← Ideal.one_eq_top] using v.prime.not_dvd_one) + have hsup := v.multiplicity_sup hA r.denominator_ne_bot + rw [(Ideal.isCoprime_iff_sup_eq).mp r.coprime, htop] at hsup +@@ -319,7 +319,7 @@ lemma denominator_multiplicity_le_minimal + · have hD := (r.zero_normalization hj0).2 + rw [hD] + have htop : multiplicity v.asIdeal (⊤ : Ideal (𝓞 K)) = 0 := +- multiplicity_eq_zero.mpr (by ++ _root_.multiplicity_eq_zero_of_not_dvd (by + simpa only [← Ideal.one_eq_top] using v.prime.not_dvd_one) + rw [htop] + exact Nat.zero_le _ +@@ -327,7 +327,7 @@ lemma denominator_multiplicity_le_minimal + by_cases hD0 : multiplicity v.asIdeal r.denominator = 0 + · omega + have htop : multiplicity v.asIdeal (⊤ : Ideal (𝓞 K)) = 0 := +- multiplicity_eq_zero.mpr (by ++ _root_.multiplicity_eq_zero_of_not_dvd (by + simpa only [← Ideal.one_eq_top] using v.prime.not_dvd_one) + have hsup := v.multiplicity_sup hA r.denominator_ne_bot + rw [(Ideal.isCoprime_iff_sup_eq).mp r.coprime, htop] at hsup +diff --git a/Heights/LatticePointMapTopology.lean b/Heights/LatticePointMapTopology.lean +index 02e6b4e..6362309 100644 +--- a/Heights/LatticePointMapTopology.lean ++++ b/Heights/LatticePointMapTopology.lean +@@ -107,7 +107,7 @@ theorem continuousAt_latticeCurvePointMap_of_mem (τ : ℍ) (z : ℂ) + by_cases hz : z ∈ (periodPairOfUpperHalfPlane τ).lattice + · exact continuousAt_latticeCurvePointMap_of_mem τ z hz + · have hrestrict : Continuous +- ({z : ℂ | z ∉ (periodPairOfUpperHalfPlane τ).lattice}.restrict ++ ({z : ℂ | z ∉ (periodPairOfUpperHalfPlane τ).lattice}.domRestrict + (latticeCurvePointMap τ)) := by + change Continuous (fun w : LatticeComplement τ ↦ latticeCurvePointMap τ w) + apply (continuous_latticeAffineCurvePointMap τ).congr +@@ -116,7 +116,7 @@ theorem continuousAt_latticeCurvePointMap_of_mem (τ : ℍ) (z : ℂ) + exact (latticeAffineCurvePointMap_eq τ w).symm + have hon : ContinuousOn (latticeCurvePointMap τ) + ((periodPairOfUpperHalfPlane τ).lattice : Set ℂ)ᶜ := +- continuousOn_iff_continuous_restrict.mpr hrestrict ++ continuousOn_iff_continuous_domRestrict.mpr hrestrict + exact hon.continuousAt + ((periodPairOfUpperHalfPlane τ).isClosed_lattice.isOpen_compl.mem_nhds hz) + +diff --git a/Heights/ModularJ.lean b/Heights/ModularJ.lean +index b589e96..7b7ef38 100644 +--- a/Heights/ModularJ.lean ++++ b/Heights/ModularJ.lean +@@ -34,12 +34,12 @@ group. This is the reduction needed to move a preimage into the standard + fundamental domain. -/ + theorem modularJ_smul (γ : SL(2, ℤ)) (τ : ℍ) : modularJ (γ • τ) = modularJ τ := by + have hE : ModularForm.E₄ (γ • τ) = denom γ τ ^ (4 : ℤ) * ModularForm.E₄ τ := by +- letI : SlashInvariantFormClass (ModularForm 𝒮ℒ 4) Γ(1) 4 := ++ let : SlashInvariantFormClass (ModularForm 𝒮ℒ 4) Γ(1) 4 := + Gamma_one_coe_eq_SL ▸ inferInstance + exact SlashInvariantForm.slash_action_eqn_SL'' ModularForm.E₄ (mem_Gamma_one γ) τ + have hD : ModularForm.discriminant (γ • τ) = + denom γ τ ^ (12 : ℤ) * ModularForm.discriminant τ := by +- letI : SlashInvariantFormClass (CuspForm 𝒮ℒ 12) Γ(1) 12 := ++ let : SlashInvariantFormClass (CuspForm 𝒮ℒ 12) Γ(1) 12 := + Gamma_one_coe_eq_SL ▸ inferInstance + exact SlashInvariantForm.slash_action_eqn_SL'' CuspForm.discriminant (mem_Gamma_one γ) τ + rw [modularJ, modularJ, hE, hD] +diff --git a/Heights/PeriodPairScaling.lean b/Heights/PeriodPairScaling.lean +index 108bb60..41ec783 100644 +--- a/Heights/PeriodPairScaling.lean ++++ b/Heights/PeriodPairScaling.lean +@@ -167,9 +167,7 @@ private theorem eventually_hasDerivAt_reciprocalX (L : PeriodPair) : + rw [← hval] + exact hi + have hrhs : AnalyticAt ℂ (fun z ↦ 2 * reciprocalY L z) 0 := by +- convert (analyticAt_reciprocalY L).const_smul (c := (2 : ℂ)) using 1 +- ext z +- simp [Pi.smul_apply, smul_eq_mul] ++ exact (analyticAt_reciprocalY L).const_smul (c := (2 : ℂ)) + have hderiv : deriv (reciprocalX L) =ᶠ[𝓝 0] + (fun z ↦ 2 * reciprocalY L z) := + ((analyticAt_reciprocalX L).deriv.frequently_eq_iff_eventually_eq hrhs).mp +diff --git a/Heights/VariableChangeAnalytic.lean b/Heights/VariableChangeAnalytic.lean +index 67518e3..b86819f 100644 +--- a/Heights/VariableChangeAnalytic.lean ++++ b/Heights/VariableChangeAnalytic.lean +@@ -50,8 +50,8 @@ noncomputable def variableChangeAffineAmbientBiholomorph + fun_prop).contMDiff + contMDiff_invFun := (show ContDiff ℂ ω + (variableChangeAffineAmbientEquiv C).symm by +- dsimp [variableChangeAffineAmbientEquiv, +- WeierstrassCurve.VariableChange.inverseX, ++ change ContDiff ℂ ω (fun xy : ℂ × ℂ => (C.inverseX xy.1, C.inverseY xy.1 xy.2)) ++ dsimp [WeierstrassCurve.VariableChange.inverseX, + WeierstrassCurve.VariableChange.inverseY] + fun_prop).contMDiff + +diff --git a/Heights/WeierstrassFiniteAnalytic.lean b/Heights/WeierstrassFiniteAnalytic.lean +index 8833daf..258616d 100644 +--- a/Heights/WeierstrassFiniteAnalytic.lean ++++ b/Heights/WeierstrassFiniteAnalytic.lean +@@ -461,7 +461,7 @@ def complexWeierstrassImplicitYChart + have hright := e.right_inv x.2 + exact congrArg Prod.fst hright)⟩ + have hg : Continuous g := Continuous.subtype_mk hamb _ +- have heq : {x : ℂ | (0, x) ∈ e.target}.restrict inv = g := by ++ have heq : {x : ℂ | (0, x) ∈ e.target}.domRestrict inv = g := by + funext x + apply Subtype.ext + exact complexWeierstrassImplicitYChartInv_coe_of_mem +@@ -699,7 +699,7 @@ def complexWeierstrassImplicitXChart + have hright := e.right_inv y.2 + exact congrArg Prod.fst hright)⟩ + have hg : Continuous g := Continuous.subtype_mk hswap _ +- have heq : {y : ℂ | (0, y) ∈ e.target}.restrict inv = g := by ++ have heq : {y : ℂ | (0, y) ∈ e.target}.domRestrict inv = g := by + funext y + apply Subtype.ext + exact complexWeierstrassImplicitXChartInv_coe_of_mem +diff --git a/Heights/WeierstrassInfinityAnalytic.lean b/Heights/WeierstrassInfinityAnalytic.lean +index 3cf5a37..3fdc1c4 100644 +--- a/Heights/WeierstrassInfinityAnalytic.lean ++++ b/Heights/WeierstrassInfinityAnalytic.lean +@@ -312,7 +312,7 @@ def complexWeierstrassInfinityBranchChart (W : WeierstrassCurve ℂ) : + ⟨e.symm (inc u), by + exact congrArg Prod.fst (e.right_inv u.2)⟩ + have hg : Continuous g := Continuous.subtype_mk hamb _ +- have heq : {u : ℂ | (0, u) ∈ e.target}.restrict inv = g := by ++ have heq : {u : ℂ | (0, u) ∈ e.target}.domRestrict inv = g := by + funext u + apply Subtype.ext + exact complexWeierstrassInfinityChartInv_coe_of_mem W u.1 u.2 +diff --git a/Heights/WeierstrassPrincipalPart.lean b/Heights/WeierstrassPrincipalPart.lean +index cc8d3cc..6254a27 100644 +--- a/Heights/WeierstrassPrincipalPart.lean ++++ b/Heights/WeierstrassPrincipalPart.lean +@@ -187,27 +187,27 @@ theorem tendsto_weierstrass_secant_addX_zero (L : PeriodPair) (a b : ℂ) : + tendsto_const_nhds + have hea : Tendsto (fun z ↦ e z - a) (𝓝[≠] 0) (𝓝 (-a)) := by + convert he.sub ha using 1 +- all_goals ring ++ all_goals ring_nf + have hdb : Tendsto (fun z ↦ d z - b) (𝓝[≠] 0) (𝓝 (-b)) := by + convert hd.sub hb using 1 +- all_goals ring ++ all_goals ring_nf + have hA : Tendsto A (𝓝[≠] 0) (𝓝 1) := by + dsimp [A] + simpa using tendsto_const_nhds.add (hea.mul (hz.pow 2)) + have hC : Tendsto C (𝓝[≠] 0) (𝓝 (-2 * a)) := by + dsimp [C] + convert (hea.const_mul 2).add (hdb.mul hz) using 1 +- all_goals ring ++ all_goals ring_nf + have hD : Tendsto D (𝓝[≠] 0) (𝓝 (-4)) := by + dsimp [D] + convert (hnegfour.add (hdb.mul (hz.pow 3))).sub + ((hea.mul (hz.pow 2)).const_mul 2) using 1 + · funext z + ring +- · ring ++ · ring_nf + have hden : Tendsto (fun z ↦ 4 * A z ^ 2) (𝓝[≠] 0) (𝓝 4) := by + convert hfour.mul (hA.pow 2) using 1 +- all_goals ring ++ all_goals ring_nf + have hfrac : Tendsto (fun z ↦ D z * C z / (4 * A z ^ 2)) + (𝓝[≠] 0) (𝓝 (2 * a)) := by + have h := (hD.mul hC).div hden (by norm_num) +@@ -217,11 +217,11 @@ theorem tendsto_weierstrass_secant_addX_zero (L : PeriodPair) (a b : ℂ) : + filter_upwards with z + simp only [Pi.div_apply] + convert h' using 1 +- ring ++ ring_nf + have hG : Tendsto (fun z ↦ -e z - a + D z * C z / (4 * A z ^ 2)) + (𝓝[≠] 0) (𝓝 a) := by + convert (he.neg.sub ha).add hfrac using 1 +- all_goals ring ++ all_goals ring_nf + apply hG.congr' + have hAne : ∀ᶠ z in 𝓝[≠] (0 : ℂ), A z ≠ 0 := + hA (eventually_ne_nhds one_ne_zero) +@@ -300,11 +300,11 @@ theorem tendsto_weierstrass_secant_addY_zero (L : PeriodPair) (a b : ℂ) : + have h := hc.tendsto.comp hzed + convert h using 1 + · rfl +- · ring ++ · ring_nf + have hN : Tendsto N (𝓝[≠] 0) (𝓝 0) := by + dsimp [N] + convert ((hE.const_mul (-24)).sub (hd.const_mul 8)).add (hz.mul hS) using 1 +- all_goals ring ++ all_goals ring_nf + have hA : Tendsto A (𝓝[≠] 0) (𝓝 1) := by + dsimp [A] + simpa using tendsto_const_nhds.add +@@ -313,11 +313,8 @@ theorem tendsto_weierstrass_secant_addY_zero (L : PeriodPair) (a b : ℂ) : + simpa using (tendsto_const_nhds.mul (hA.pow 3)) + have hquot : Tendsto (fun z ↦ N z / (8 * A z ^ 3)) + (𝓝[≠] 0) (𝓝 0) := by +- have h := hN.div hden (by norm_num) +- convert h using 1 +- · funext z +- simp only [Pi.div_apply] +- · norm_num ++ change Tendsto (N / (fun z => 8 * A z ^ 3)) (𝓝[≠] 0) (𝓝 0) ++ simpa only [zero_div] using hN.div hden (by norm_num) + have hfinal : Tendsto (fun z ↦ b / 2 + N z / (8 * A z ^ 3)) + (𝓝[≠] 0) (𝓝 (b / 2)) := by + simpa using tendsto_const_nhds.add hquot +diff --git a/Heights/WeierstrassSurjectivity.lean b/Heights/WeierstrassSurjectivity.lean +index 37b20a6..72b3cfc 100644 +--- a/Heights/WeierstrassSurjectivity.lean ++++ b/Heights/WeierstrassSurjectivity.lean +@@ -66,7 +66,7 @@ private theorem reciprocalWeierstrassSub_analyticAt (L : PeriodPair) (a z : ℂ) + apply hraw.congr + filter_upwards [L.isClosed_lattice.isOpen_compl.mem_nhds hz] with w hw + have hw' : w ∉ L.lattice := hw +- rw [reciprocalWeierstrassSub, if_neg hw', Pi.inv_apply, Pi.sub_apply] ++ rw [reciprocalWeierstrassSub, ite_eq_right hw', Pi.inv_apply, Pi.sub_apply] + + private theorem reciprocalWeierstrassSub_add_lattice (L : PeriodPair) (a z : ℂ) + (l : L.lattice) : +@@ -97,7 +97,7 @@ theorem exists_notMem_lattice_weierstrassP_eq (L : PeriodPair) (a : ℂ) : + let z₀ : ℂ := L.ω₁ / 2 + have hz₀ : z₀ ∉ L.lattice := L.ω₁_div_two_notMem_lattice + have hne : reciprocalWeierstrassSub L a z₀ ≠ 0 := by +- rw [reciprocalWeierstrassSub, if_neg hz₀] ++ rw [reciprocalWeierstrassSub, ite_eq_right hz₀] + exact inv_ne_zero (sub_ne_zero.mpr (h z₀ hz₀)) + apply hne + exact (hdiff.apply_eq_apply_of_bounded hcompact.isBounded z₀ 0).trans (by +diff --git a/lake-manifest.json b/lake-manifest.json +index 5d54dbc..67ccad8 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,7 +1,17 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/lana-agents/belyi.git", ++ [{"url": "https://github.com/lana-agents/heights.git", ++ "type": "git", ++ "subDir": null, ++ "scope": "", ++ "rev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", ++ "name": "heights", ++ "manifestFile": "lake-manifest.json", ++ "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", ++ "inherited": true, ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/belyi.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -11,31 +21,31 @@ + "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", + "inherited": false, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/mathlib4", ++ {"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/lana-agents/oka.git", + "type": "git", + "subDir": null, + "scope": "", +- "rev": "da228a2cf9671aaba08ddc96274d75e098b28f67", ++ "rev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", + "name": "oka", + "manifestFile": "lake-manifest.json", +- "inputRev": "da228a2cf9671aaba08ddc96274d75e098b28f67", ++ "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", + "inherited": true, + "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -65,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -75,7 +85,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -85,7 +95,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -95,7 +105,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -105,10 +115,10 @@ + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "heights", +diff --git a/lakefile.toml b/lakefile.toml +index a8e48a6..4d39ef8 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,6 +4,8 @@ keywords = ["math"] + defaultTargets = ["Heights", "Challenge", "Solution"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true +@@ -11,8 +13,8 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + # Curves over number fields as function fields (Belyi.CurveField), for the height machine on + # curves (GenEll height theory, branch wp-height-theory). +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f49..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/iut-lean4341.patch b/lean/patches/iut-lean4341.patch index d2f1725902299577c0f8507857ff45ca70967dea..e8c30d8fb73f32d3091006e0c0d54423281d6c22 100644 --- a/lean/patches/iut-lean4341.patch +++ b/lean/patches/iut-lean4341.patch @@ -1,1164 +1,1164 @@ -diff --git a/Iut/Anabelian/Genuine/Homs.lean b/Iut/Anabelian/Genuine/Homs.lean -index 7de5889..2756b13 100644 ---- a/Iut/Anabelian/Genuine/Homs.lean -+++ b/Iut/Anabelian/Genuine/Homs.lean -@@ -418,10 +418,8 @@ lemma eIdx_tower {F L L' : IntermediateField (xLine E) (Ω E)} [FiniteDimensiona - lemma comap_isMaximal {F L : IntermediateField (xLine E) (Ω E)} (h : F ≤ L) - (w : Ideal (coordRing k (xG E) L)) [hw : w.IsMaximal] : - (w.comap (ringMap (xG E) h)).IsMaximal := by -- letI := algRing (xG E) h -- haveI : Algebra.IsIntegral (coordRing k (xG E) F) (coordRing k (xG E) L) := -- ⟨ringMap_isIntegral _ h⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap (xG E) h).toRingHom (ringMap_isIntegral _ h) w - - set_option maxHeartbeats 1000000 in - set_option synthInstance.maxHeartbeats 400000 in -diff --git a/Iut/Anabelian/Genuine/Punctured.lean b/Iut/Anabelian/Genuine/Punctured.lean -index 2810b7d..4106cbe 100644 ---- a/Iut/Anabelian/Genuine/Punctured.lean -+++ b/Iut/Anabelian/Genuine/Punctured.lean -@@ -176,7 +176,7 @@ lemma bijective_algebraMap_coarse : - rw [← hz] at h1 - haveI : IsScalarTower (A₀ k (xG E)) (K₀ k (xG E)) (Ω E) := - IsScalarTower.of_algebraMap_eq fun _ => rfl -- exact (isIntegral_algebraMap_iff (algebraMap (K₀ k (xG E)) (Ω E)).injective).mp h1 -+ exact isIntegral_algebraMap_iff.mp h1 - obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ k (xG E)) - (K := K₀ k (xG E))).mp hzint - refine ⟨a, Subtype.ext (Subtype.ext ?_)⟩ -diff --git a/Iut/Anabelian/Model.lean b/Iut/Anabelian/Model.lean -index 4145caa..3da2b3d 100644 ---- a/Iut/Anabelian/Model.lean -+++ b/Iut/Anabelian/Model.lean -@@ -149,7 +149,7 @@ lemma pointMap_mem_torsion (f : k →+* K) (X : Orbicurve k) {P : X.E.toAffine.P - /-- The map on torsion induced by base change. -/ - def mapTorsion (f : k →+* K) (X : Orbicurve k) : - ↥X.torsion →+ ↥(X.baseChange f).torsion := -- ((pointMap X.E f).restrict X.torsion).codRestrict _ fun P => by -+ ((pointMap X.E f).domRestrict X.torsion).codRestrict _ fun P => by - exact X.pointMap_mem_torsion f P.2 - - @[simp] lemma coe_mapTorsion (f : k →+* K) (X : Orbicurve k) (P : ↥X.torsion) : -diff --git a/Iut/Anabelian/Torsion.lean b/Iut/Anabelian/Torsion.lean -index df13fd4..23c1d3d 100644 ---- a/Iut/Anabelian/Torsion.lean -+++ b/Iut/Anabelian/Torsion.lean -@@ -93,7 +93,7 @@ lemma mem_TK_of_bcK {R : P.EK.toAffine.Point} (hR : P.bcK R ∈ P.TFbar) : R ∈ - - /-- **The ℓ-torsion is rational over `K`**: `E(K)[ℓ] ≃ E(F̄)[ℓ]`. -/ - def torsionEquiv : ↥P.TK ≃+ ↥P.TFbar := -- AddEquiv.ofBijective (P.bcK.restrict P.TK |>.codRestrict _ fun R => P.bcK_mem_TFbar R.2) -+ AddEquiv.ofBijective (P.bcK.domRestrict P.TK |>.codRestrict _ fun R => P.bcK_mem_TFbar R.2) - ⟨fun R R' h => Subtype.ext (P.bcK_injective (congrArg Subtype.val h)), - fun Q => by - obtain ⟨R, hR⟩ := P.exists_bcK_eq Q.1 Q.2 -@@ -150,7 +150,7 @@ lemma galK_mem_TK (σ : ↥P.torsionField ≃ₐ[F] ↥P.torsionField) {R : P.EK - - /-- The action of `Gal(K/F)` on the ℓ-torsion. -/ - def galTK (σ : ↥P.torsionField ≃ₐ[F] ↥P.torsionField) : ↥P.TK →+ ↥P.TK := -- (P.galK σ).restrict P.TK |>.codRestrict _ fun R => P.galK_mem_TK σ R.2 -+ (P.galK σ).domRestrict P.TK |>.codRestrict _ fun R => P.galK_mem_TK σ R.2 - - @[simp] lemma coe_galTK (σ : ↥P.torsionField ≃ₐ[F] ↥P.torsionField) (R : ↥P.TK) : - (P.galTK σ R : P.EK.toAffine.Point) = P.galK σ R := rfl -diff --git a/Iut/Concrete/LocalConstruct/ArchLogShell.lean b/Iut/Concrete/LocalConstruct/ArchLogShell.lean -index e078189..aa5d12e 100644 ---- a/Iut/Concrete/LocalConstruct/ArchLogShell.lean -+++ b/Iut/Concrete/LocalConstruct/ArchLogShell.lean -@@ -140,7 +140,7 @@ theorem archNorm_mapAlgHom_le (σ : ∀ j, ArchFactor K (c j) ≃ₐ[ℝ] ArchFa - refine (ContinuousLinearMap.le_opNorm _ _).trans ?_ - refine mul_le_of_le_one_left (norm_nonneg _) ?_ - refine (PiTensorProduct.opNorm_mapL _).trans ?_ -- exact Finset.prod_le_one (fun j _ => norm_nonneg _) fun j _ => norm_archAutCLM_le (c j) (σ j) -+ exact Finset.prod_le_one₀ (fun j _ => norm_nonneg _) fun j _ => norm_archAutCLM_le (c j) (σ j) - - /-- **IUT IV, Proposition 1.5(iii)**: the indeterminacy automorphisms preserve `B_I`. -/ - theorem mapAlgHom_image_archIntegral_subset -diff --git a/Iut/Concrete/LocalConstruct/Haar.lean b/Iut/Concrete/LocalConstruct/Haar.lean -index 8385d1b..2bf7745 100644 ---- a/Iut/Concrete/LocalConstruct/Haar.lean -+++ b/Iut/Concrete/LocalConstruct/Haar.lean -@@ -84,7 +84,7 @@ lemma closedBall_eq_iUnion_padicCoset : - obtain ⟨y, hy⟩ := hmem - have hy' : (p : ℚ_[p]) * x - (z.zmodRepr : ℚ_[p]) = (p : ℚ_[p]) * (y : ℚ_[p]) := by - have := congrArg (fun w : ℤ_[p] => (w : ℚ_[p])) hy -- simpa [z] using this -+ exact this - have : x - (z.zmodRepr : ℚ_[p]) / p = (y : ℚ_[p]) := by - field_simp - linear_combination hy' -diff --git a/Iut/Concrete/LocalConstruct/Integral.lean b/Iut/Concrete/LocalConstruct/Integral.lean -index 77cbfda..cf2a52d 100644 ---- a/Iut/Concrete/LocalConstruct/Integral.lean -+++ b/Iut/Concrete/LocalConstruct/Integral.lean -@@ -318,7 +318,7 @@ lemma exists_norm_tprodIntegral_le : - rw [Module.Basis.equivFun_apply] - unfold packetBasis tprodIntegral - rw [Basis.piTensorProduct_repr_tprod_apply, norm_prod] -- exact Finset.prod_le_prod (fun j _ => norm_nonneg _) fun j _ => hC j _ (a j).2 _ -+ exact Finset.prod_le_prod₀ (fun j _ => norm_nonneg _) fun j _ => hC j _ (a j).2 _ - - /-- **`R_I` is bounded.** -/ - lemma exists_order_subset_closedBall : -diff --git a/Iut/Concrete/LocalConstruct/LogShell.lean b/Iut/Concrete/LocalConstruct/LogShell.lean -index b0dfa96..88fac56 100644 ---- a/Iut/Concrete/LocalConstruct/LogShell.lean -+++ b/Iut/Concrete/LocalConstruct/LogShell.lean -@@ -404,7 +404,7 @@ lemma exists_norm_logShellSet_le : - rw [Module.Basis.equivFun_apply] - unfold packetBasis - rw [Basis.piTensorProduct_repr_tprod_apply, norm_prod] -- exact Finset.prod_le_prod (fun j _ => norm_nonneg _) fun j _ => hC j _ (a j).2 _ -+ exact Finset.prod_le_prod₀ (fun j _ => norm_nonneg _) fun j _ => hC j _ (a j).2 _ - - /-- The products of elements of `(R_I)^∼` with elementary tensors of elements of the factor - log-shells are bounded: `(R_I)^∼` is compact and the elementary tensors are bounded. -/ -diff --git a/Iut/Concrete/ModEllRepConstruct.lean b/Iut/Concrete/ModEllRepConstruct.lean -index 57f8a8e..3a0afaa 100644 ---- a/Iut/Concrete/ModEllRepConstruct.lean -+++ b/Iut/Concrete/ModEllRepConstruct.lean -@@ -53,7 +53,7 @@ endomorphism of the torsion subgroup. -/ - noncomputable def galTorsionHom (n : ℕ) (σ : Fbar ≃ₐ[F] Fbar) : - AddSubgroup.torsionBy (Affine.Point (Affine.baseChange E Fbar)) n →+ - AddSubgroup.torsionBy (Affine.Point (Affine.baseChange E Fbar)) n := -- ((galPointMap F E Fbar σ).restrict -+ ((galPointMap F E Fbar σ).domRestrict - (AddSubgroup.torsionBy (Affine.Point (Affine.baseChange E Fbar)) n)).codRestrict - (AddSubgroup.torsionBy (Affine.Point (Affine.baseChange E Fbar)) n) - (fun P => galPointMap_torsionBy F E Fbar σ P.2) -diff --git a/Iut/Concrete/ModEllRepGalois.lean b/Iut/Concrete/ModEllRepGalois.lean -index 7272069..34b4939 100644 ---- a/Iut/Concrete/ModEllRepGalois.lean -+++ b/Iut/Concrete/ModEllRepGalois.lean -@@ -98,7 +98,7 @@ lemma mem_TK_of_bcK {P : R.EK.toAffine.Point} (hP : R.bcK P ∈ TFbar C ℓ) : P - - /-- **The `ℓ`-torsion is rational over `K`**: `E(K)[ℓ] ≃ E(F̄)[ℓ]`. -/ - def torsionEquiv : ↥R.TK ≃+ ↥(TFbar C ℓ) := -- AddEquiv.ofBijective (R.bcK.restrict R.TK |>.codRestrict _ fun P => R.bcK_mem_TFbar P.2) -+ AddEquiv.ofBijective (R.bcK.domRestrict R.TK |>.codRestrict _ fun P => R.bcK_mem_TFbar P.2) - ⟨fun P P' h => Subtype.ext (R.bcK_injective (congrArg Subtype.val h)), - fun Q => by - obtain ⟨P, hP⟩ := R.exists_bcK_eq Q.1 Q.2 -diff --git a/Iut/Concrete/SL2Image.lean b/Iut/Concrete/SL2Image.lean -index a58f023..6a75976 100644 ---- a/Iut/Concrete/SL2Image.lean -+++ b/Iut/Concrete/SL2Image.lean -@@ -142,7 +142,7 @@ lemma card_torsion_curveKw_ge (w' : FinitePlace ↥R.torsionField) - [Finite ↥(TateStructure.torsion ℓ (curveKw C.E R.torsionField w'))] : - ℓ * ℓ ≤ Nat.card ↥(TateStructure.torsion ℓ (curveKw C.E R.torsionField w')) := by - let f : ↥R.TK →+ ↥(TateStructure.torsion ℓ (curveKw C.E R.torsionField w')) := -- ((pointMap (curveK C.E R.torsionField) (emb R.torsionField w')).restrict R.TK).codRestrict _ -+ ((pointMap (curveK C.E R.torsionField) (emb R.torsionField w')).domRestrict R.TK).codRestrict _ - fun P => by - rw [AddSubgroup.torsionBy.nsmul_iff] - have hP := AddSubgroup.torsionBy.nsmul_iff.mp P.2 -diff --git a/Iut/Cor312/ThetaData/PlacesOver.lean b/Iut/Cor312/ThetaData/PlacesOver.lean -index 54f5d7e..b81f51c 100644 ---- a/Iut/Cor312/ThetaData/PlacesOver.lean -+++ b/Iut/Cor312/ThetaData/PlacesOver.lean -@@ -45,14 +45,16 @@ lemma algebraMap_ringOfIntegers_injective : - /-- **Every finite place of `k` has a finite place of `K` over it.** -/ - theorem FinitePlace.exists_liesOver (v : FinitePlace k) : - ∃ w : FinitePlace K, FinitePlace.LiesOver w v := by -+ have : FaithfulSMul (𝓞 k) (𝓞 K) := -+ (faithfulSMul_iff_algebraMap_injective (𝓞 k) (𝓞 K)).mpr algebraMap_ringOfIntegers_injective - haveI : v.maximalIdeal.asIdeal.IsPrime := v.maximalIdeal.isPrime - obtain ⟨Q, -, hQ, hQv⟩ := Ideal.exists_ideal_over_prime_of_isIntegral (S := 𝓞 K) - v.maximalIdeal.asIdeal ⊥ (by -- rw [Ideal.comap_bot_of_injective _ algebraMap_ringOfIntegers_injective] -+ rw [Ideal.under_bot] - exact bot_le) - have hQne : Q ≠ ⊥ := by - rintro rfl -- rw [Ideal.comap_bot_of_injective _ algebraMap_ringOfIntegers_injective] at hQv -+ rw [Ideal.under_bot] at hQv - exact v.maximalIdeal.ne_bot hQv.symm - refine ⟨FinitePlace.mk ⟨Q, hQ, hQne⟩, ?_⟩ - unfold FinitePlace.LiesOver -@@ -138,10 +140,13 @@ lemma algebraMap_intClosure_injective : - theorem exists_prime_over (w : FinitePlace K) : - ∃ Q : Ideal (intClosure K Fbar), Q.IsPrime ∧ - Q.comap (algebraMap (𝓞 K) (intClosure K Fbar)) = w.maximalIdeal.asIdeal := by -+ have : FaithfulSMul (𝓞 K) (intClosure K Fbar) := -+ (faithfulSMul_iff_algebraMap_injective (𝓞 K) (intClosure K Fbar)).mpr -+ (algebraMap_intClosure_injective K Fbar) - haveI : w.maximalIdeal.asIdeal.IsPrime := w.maximalIdeal.isPrime - obtain ⟨Q, -, hQ, hQw⟩ := Ideal.exists_ideal_over_prime_of_isIntegral - (S := intClosure K Fbar) w.maximalIdeal.asIdeal ⊥ (by -- rw [Ideal.comap_bot_of_injective _ (algebraMap_intClosure_injective K Fbar)] -+ rw [Ideal.under_bot] - exact bot_le) - exact ⟨Q, hQ, hQw⟩ - -diff --git a/Iut/Cor312/ThetaData/TateStructureTransport.lean b/Iut/Cor312/ThetaData/TateStructureTransport.lean -index 0f98d1a..904c497 100644 ---- a/Iut/Cor312/ThetaData/TateStructureTransport.lean -+++ b/Iut/Cor312/ThetaData/TateStructureTransport.lean -@@ -132,7 +132,9 @@ def baseChange (S : TateStructure E) : TateStructure (E.map (algebraMap k k')) w - (Additive.ofMul (QuotientGroup.mk (unitsEquiv hbij u))) = - Additive.ofMul (QuotientGroup.mk u) := by - rw [← quotEquiv_mk] -- exact (MulEquiv.toAdditive (quotEquiv hbij S.t)).symm_apply_apply _ -+ change Additive.ofMul -+ ((quotEquiv hbij S.t).symm ((quotEquiv hbij S.t) (QuotientGroup.mk u))) = _ -+ rw [MulEquiv.symm_apply_apply] - simp only [AddEquiv.trans_apply] - rw [h1, pointMapEquiv_apply, xCoord_pointMap, S.iso_x u hu, S.t.algebraMap_X k'] - rfl -@@ -143,7 +145,9 @@ def baseChange (S : TateStructure E) : TateStructure (E.map (algebraMap k k')) w - (Additive.ofMul (QuotientGroup.mk (unitsEquiv hbij u))) = - Additive.ofMul (QuotientGroup.mk u) := by - rw [← quotEquiv_mk] -- exact (MulEquiv.toAdditive (quotEquiv hbij S.t)).symm_apply_apply _ -+ change Additive.ofMul -+ ((quotEquiv hbij S.t).symm ((quotEquiv hbij S.t) (QuotientGroup.mk u))) = _ -+ rw [MulEquiv.symm_apply_apply] - simp only [AddEquiv.trans_apply] - rw [h1, pointMapEquiv_apply, yCoord_pointMap, S.iso_y u hu, S.t.algebraMap_Y k'] - rfl -@@ -163,7 +167,9 @@ lemma baseChange_ofUnit (u : kˣ) : - (Additive.ofMul (QuotientGroup.mk (unitsEquiv hbij u))) = - Additive.ofMul (QuotientGroup.mk u) := by - rw [← quotEquiv_mk] -- exact (MulEquiv.toAdditive (quotEquiv hbij S.t)).symm_apply_apply _ -+ change Additive.ofMul -+ ((quotEquiv hbij S.t).symm ((quotEquiv hbij S.t) (QuotientGroup.mk u))) = _ -+ rw [MulEquiv.symm_apply_apply] - simp only [AddEquiv.trans_apply] - rw [h1] - rfl -diff --git a/Iut/Torsion/EDS.lean b/Iut/Torsion/EDS.lean -index 0785677..2caf952 100644 ---- a/Iut/Torsion/EDS.lean -+++ b/Iut/Torsion/EDS.lean -@@ -33,10 +33,11 @@ namespace Iut.Torsion - - open WeierstrassCurve WeierstrassCurve.Affine Polynomial - --open scoped Classical - - variable {F : Type*} [Field F] {W : Affine F} - -+noncomputable local instance : DecidableEq F := Classical.decEq F -+ - /-! ### The sequence `ψₙ(P)` -/ - - /-- The value `ψₙ(x, y)` of the `n`-division polynomial at `(x, y)`, as the normalised EDS with -@@ -155,7 +156,7 @@ theorem equation_iff₀ (x y : F) : - W.Equation x y ↔ y ^ 2 = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆ := by - rw [equation_iff, ha₁, ha₃]; simp - --omit [NeZero (2 : F)] in -+omit [NeZero (2 : F)] ha₃ in - theorem addX_eq (x₁ x₂ ℓ : F) : W.addX x₁ x₂ ℓ = ℓ ^ 2 - W.a₂ - x₁ - x₂ := by - simp [addX, ha₁] - -@@ -164,7 +165,7 @@ theorem addY_eq (x₁ x₂ y₁ ℓ : F) : - W.addY x₁ x₂ y₁ ℓ = -(ℓ * ((ℓ ^ 2 - W.a₂ - x₁ - x₂) - x₁) + y₁) := by - simp [addY, negY, negAddY, addX, ha₁, ha₃] - --omit [NeZero (2 : F)] in -+omit [NeZero (2 : F)] ha₁ ha₃ in - theorem slope_mul_of_X_ne {x₁ x₂ : F} (y₁ y₂ : F) (hx : x₁ ≠ x₂) : - W.slope x₁ x₂ y₁ y₂ * (x₁ - x₂) = y₁ - y₂ := by - rw [slope_of_X_ne hx, div_mul_cancel₀ _ (sub_ne_zero.mpr hx)] -@@ -223,6 +224,7 @@ def Good (n : ℕ) : Prop := - - variable {h} - -+omit [NeZero (2 : F)] in - theorem Good.smul_eq_zero_iff {n : ℕ} (hg : Good h n) : - n • Point.some x y h = 0 ↔ eds W x y n = 0 := by - refine ⟨fun h0 => ?_, hg.1⟩ -@@ -231,24 +233,29 @@ theorem Good.smul_eq_zero_iff {n : ℕ} (hg : Good h n) : - rw [hn] at h0 - exact Point.some_ne_zero hXY h0 - -+omit [NeZero (2 : F)] in - theorem Good.eds_ne_zero {n : ℕ} (hg : Good h n) (hn : n • Point.some x y h ≠ 0) : - eds W x y n ≠ 0 := - fun h0 => hn (hg.1 h0) - -+omit [NeZero (2 : F)] in - theorem Good.eds_eq_zero {n : ℕ} (hg : Good h n) (hn : n • Point.some x y h = 0) : - eds W x y n = 0 := - hg.smul_eq_zero_iff.mp hn - - variable (h) - -+omit [NeZero (2 : F)] in - theorem good_zero : Good h 0 := by - refine ⟨fun _ => zero_smul ℕ _, fun h0 => absurd (by simp) h0⟩ - -+omit [NeZero (2 : F)] in - theorem good_one : Good h 1 := by - refine ⟨fun h0 => absurd h0 (by simp), fun _ => ⟨x, y, h, one_smul ℕ _, by simp, by simp⟩⟩ - - include ha₁ ha₃ - -+omit [NeZero (2 : F)] in - theorem hQ_of (hXY : W.Nonsingular x y) : - y ^ 2 = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆ := - (equation_iff₀ ha₁ ha₃ x y).mp hXY.1 -@@ -267,7 +274,7 @@ theorem good_two (hy : y ≠ 0) : Good h 2 := by - have hI2 := Ident.double_X (hQ_of ha₁ ha₃ h) hμ hy - have hI3 := Ident.double_Y (hQ_of ha₁ ha₃ h) hμ hy - refine ⟨_, _, _, two_smul_eq ha₁ ha₃ h hy, ?_, ?_⟩ -- · rw [addX_eq ha₁ ha₃] -+ · rw [addX_eq ha₁] - simp only [Nat.cast_ofNat, eds_two, Int.reduceAdd, eds_three, Int.reduceSub, eds_one, - Ψ₃_eval ha₁ ha₃] - linear_combination hI2 -@@ -281,7 +288,7 @@ theorem two_smul_X (hy : y ≠ 0) : - W.addX x x (W.slope x x y y) * (2 * y) ^ 2 = x * (2 * y) ^ 2 - W.Ψ₃.eval x := by - have hμ := slope_mul_of_Y_ne ha₁ ha₃ (x₁ := x) hy - have hI2 := Ident.double_X (hQ_of ha₁ ha₃ h) hμ hy -- rw [addX_eq ha₁ ha₃, Ψ₃_eval ha₁ ha₃] -+ rw [addX_eq ha₁, Ψ₃_eval ha₁ ha₃] - linear_combination hI2 - - include h in -@@ -328,7 +335,7 @@ theorem good_three (hy : y ≠ 0) : Good h 3 := by - intro hX - apply hne - rw [← hc, hX, sub_self, zero_mul] -- have hp : W.slope X₂ x Y₂ y * (X₂ - x) = Y₂ - y := slope_mul_of_X_ne ha₁ ha₃ Y₂ y hXx -+ have hp : W.slope X₂ x Y₂ y * (X₂ - x) = Y₂ - y := slope_mul_of_X_ne Y₂ y hXx - have h3P : (3 : ℕ) • Point.some x y h = - Point.some (W.addX X₂ x (W.slope X₂ x Y₂ y)) (W.addY X₂ x Y₂ (W.slope X₂ x Y₂ y)) - (nonsingular_add h₂ h fun hxy => hXx hxy.1) := by -@@ -341,7 +348,7 @@ theorem good_three (hy : y ≠ 0) : Good h 3 := by - rw [← h2P, two_nsmul, add_neg_cancel_right] - rw [Point.neg_some, Point.add_of_X_ne hXx] at hsub - have hsubX : W.addX X₂ x (W.slope X₂ x Y₂ (W.negY x y)) = x := (Point.some.inj hsub).1 -- rw [addX_eq ha₁ ha₃] at hsubX -+ rw [addX_eq ha₁] at hsubX - have hD := Ident.chord_diff (a₂ := W.a₂) hXx hp hm - rw [hsubX] at hD - set lp := W.slope X₂ x Y₂ y with hlp -@@ -349,16 +356,16 @@ theorem good_three (hy : y ≠ 0) : Good h 3 := by - · -- the `x`-coordinate - have e4 : eds W x y (3 + 1) = W.preΨ₄.eval x * (2 * y) := by norm_num - have e2 : eds W x y (3 - 1) = 2 * y := by norm_num -- rw [Nat.cast_ofNat, eds_three, e4, e2, addX_eq ha₁ ha₃, ← hc, ← hY₂] -+ rw [Nat.cast_ofNat, eds_three, e4, e2, addX_eq ha₁, ← hc, ← hY₂] - linear_combination (-16 * y ^ 4) * hD - · -- the `y`-coordinate - have hQ₂ := hQ_of ha₁ ha₃ h₂ - have hT : Y₂ * (2 * y) = -2 * y ^ 2 - (3 * x ^ 2 + 2 * W.a₂ * x + W.a₄) * (X₂ - x) := by -- rw [hY₂def, hX₂def, addY_eq ha₁ ha₃, addX_eq ha₁ ha₃] -+ rw [hY₂def, hX₂def, addY_eq ha₁ ha₃, addX_eq ha₁] - linear_combination (-(μ ^ 2 - W.a₂ - x - x - x)) * hμ - have hD2 : X₂ * (4 * y ^ 2) = - (3 * x ^ 2 + 2 * W.a₂ * x + W.a₄) ^ 2 - 4 * y ^ 2 * (W.a₂ + 2 * x) := by -- rw [hX₂def, addX_eq ha₁ ha₃] -+ rw [hX₂def, addX_eq ha₁] - linear_combination (μ * (2 * y) + (3 * x ^ 2 + 2 * W.a₂ * x + W.a₄)) * hμ - have hG3 := Ident.three_Y (hQ_of ha₁ ha₃ h) hQ₂ hT hD2 hp hy - have hc3 : edsC W x y 3 = (2 * y) * (W.preΨ₄.eval x * (2 * y) ^ 4 - (W.Ψ₃.eval x) ^ 3) - -@@ -374,21 +381,22 @@ theorem good_three (hy : y ≠ 0) : Good h 3 := by - - /-! ### The even step -/ - --omit ha₁ ha₃ in -+omit [NeZero (2 : F)] ha₁ ha₃ in - /-- `Good n` when `eₙ = 0` and `n • P = 0`. -/ - theorem good_of_eq_zero {n : ℕ} (h0 : eds W x y n = 0) (hn : n • Point.some x y h = 0) : - Good h n := - ⟨fun _ => hn, fun hne => absurd h0 hne⟩ - --omit ha₁ ha₃ in -+omit [NeZero (2 : F)] ha₁ ha₃ in - theorem smul_succ (k : ℕ) : (k + 1) • Point.some x y h = k • Point.some x y h + Point.some x y h := - succ_nsmul _ _ - --omit ha₁ ha₃ in -+omit [NeZero (2 : F)] ha₁ ha₃ in - theorem smul_pred {k : ℕ} (hk : 1 ≤ k) : - (k - 1) • Point.some x y h = k • Point.some x y h - Point.some x y h := by - conv_rhs => rw [← Nat.sub_add_cancel hk, succ_nsmul, add_sub_cancel_right] - -+omit [NeZero (2 : F)] ha₁ ha₃ in - /-- Coordinates of `Q + P` for `X ≠ x`. -/ - theorem add_eq_of_X_ne {X Y : F} (hQ : W.Nonsingular X Y) (hX : X ≠ x) : - Point.some X Y hQ + Point.some x y h = -@@ -396,6 +404,7 @@ theorem add_eq_of_X_ne {X Y : F} (hQ : W.Nonsingular X Y) (hX : X ≠ x) : - (nonsingular_add hQ h fun hxy => hX hxy.1) := - Point.add_of_X_ne hX - -+omit [NeZero (2 : F)] ha₁ ha₃ in - /-- Coordinates of `Q − P` for `X ≠ x`. -/ - theorem sub_eq_of_X_ne {X Y : F} (hQ : W.Nonsingular X Y) (hX : X ≠ x) : - Point.some X Y hQ - Point.some x y h = -@@ -404,12 +413,14 @@ theorem sub_eq_of_X_ne {X Y : F} (hQ : W.Nonsingular X Y) (hX : X ≠ x) : - (nonsingular_add hQ ((nonsingular_neg ..).mpr h) fun hxy => hX hxy.1) := by - rw [sub_eq_add_neg, Point.neg_some, Point.add_of_X_ne hX] - -+omit [NeZero (2 : F)] in - /-- The slope of the chord through `Q` and `−P`. -/ - theorem slope_neg_mul {X Y : F} (hX : X ≠ x) : - W.slope X x Y (W.negY x y) * (X - x) = Y + y := by - rw [slope_of_X_ne hX, negY_eq ha₁ ha₃, div_mul_cancel₀ _ (sub_ne_zero.mpr hX)] - ring - -+omit [NeZero (2 : F)] ha₁ ha₃ in - /-- If `Q = m • P = (X, Y)` with `(m − 1) • P ≠ 0` and `(m + 1) • P ≠ 0`, then `X ≠ x`. -/ - theorem X_ne_of_smul {m : ℕ} (hm : 1 ≤ m) {X Y : F} {hQ : W.Nonsingular X Y} - (hmP : m • Point.some x y h = Point.some X Y hQ) -@@ -507,7 +518,7 @@ theorem good_even (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) - 2 * (-(μ * ((μ ^ 2 - W.a₂ - X - X) - X) + Y)) * eds W x y (2 * m) ^ 3 = - edsC W x y (2 * m) by - refine ⟨fun h0 => absurd h0 (by rwa [hcast]), fun _ => ⟨_, _, _, h2Q, ?_, ?_⟩⟩ -- · rw [hcast, addX_eq ha₁ ha₃]; exact key.1 -+ · rw [hcast, addX_eq ha₁]; exact key.1 - · rw [hcast, addY_eq ha₁ ha₃]; exact key.2 - have hc : (x - x₂) * (2 * y) ^ 2 = W.Ψ₃.eval x := by linear_combination -hX₂ - -- abbreviations -@@ -547,7 +558,7 @@ theorem good_even (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) - rw [hsmul, hmP, hQP0, smul_neg, hn2P] - rw [h2Q] at h2Q' - obtain ⟨hxq, hyq⟩ := Point.some.inj h2Q' -- rw [addX_eq ha₁ ha₃] at hxq -+ rw [addX_eq ha₁] at hxq - rw [addY_eq ha₁ ha₃] at hyq - rw [hyq, hxq, hny₂] - -- the sequence -@@ -593,7 +604,7 @@ theorem good_even (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) - rw [hsmul, hmP, hQP, h2P] - rw [h2Q] at h2Q' - obtain ⟨hxq, hyq⟩ := Point.some.inj h2Q' -- rw [addX_eq ha₁ ha₃] at hxq -+ rw [addX_eq ha₁] at hxq - rw [addY_eq ha₁ ha₃] at hyq - rw [hyq, hxq] - rw [hem1] at r_odd1 r_odd2 r_cm -@@ -631,18 +642,18 @@ theorem good_even (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) - obtain ⟨X', Y', h', hh, -, -⟩ := g₃.2 hep - rw [hh] at h0 - exact Point.some_ne_zero h' h0 -- have hXx : X ≠ x := X_ne_of_smul ha₁ ha₃ h (by omega) hmP hmm0 hpp0 -+ have hXx : X ≠ x := X_ne_of_smul h (by omega) hmP hmm0 hpp0 - obtain ⟨Xp, Yp, hQp, hpP, hXp, hYp⟩ := g₃.2 hep - obtain ⟨Xm, Ym, hQm, hmmP, hXm, hYm⟩ := g₁.2 hem1 - have hpP' := hpP -- rw [smul_succ h, hmP, add_eq_of_X_ne ha₁ ha₃ h hQ hXx] at hpP' -+ rw [smul_succ h, hmP, add_eq_of_X_ne h hQ hXx] at hpP' - obtain ⟨hXp', hYp'⟩ := Point.some.inj hpP' - have hmmP' := hmmP -- rw [smul_pred h (by omega), hmP, sub_eq_of_X_ne ha₁ ha₃ h hQ hXx] at hmmP' -+ rw [smul_pred h (by omega), hmP, sub_eq_of_X_ne h hQ hXx] at hmmP' - obtain ⟨hXm', hYm'⟩ := Point.some.inj hmmP' -- rw [addX_eq ha₁ ha₃] at hXp' hXm' -+ rw [addX_eq ha₁] at hXp' hXm' - rw [addY_eq ha₁ ha₃] at hYp' hYm' -- have hp : W.slope X x Y y * (X - x) = Y - y := slope_mul_of_X_ne ha₁ ha₃ Y y hXx -+ have hp : W.slope X x Y y * (X - x) = Y - y := slope_mul_of_X_ne Y y hXx - have hmn : W.slope X x Y (W.negY x y) * (X - x) = Y + y := slope_neg_mul ha₁ ha₃ hXx - have hI5 := Ident.double_X_sub (hQ_of ha₁ ha₃ hQ) (hQ_of ha₁ ha₃ h) hXx hp hmn hμ hY0 - have hI6 := Ident.double_Y_mul (hQ_of ha₁ ha₃ hQ) (hQ_of ha₁ ha₃ h) hXx hp hmn hμ hY0 -@@ -801,15 +812,15 @@ theorem good_odd (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) (g₁ : Good h (m - 1)) - -- `Q − Q⁺ = −P` and `Q⁺ − Q = P` - have hsub : Point.some X Y hQ - Point.some Xp Yp hQp = -Point.some x y h := by - rw [← hmP, ← hpP, smul_succ h]; abel -- rw [sub_eq_of_X_ne ha₁ ha₃ hQp hQ hXX, Point.neg_some] at hsub -+ rw [sub_eq_of_X_ne hQp hQ hXX, Point.neg_some] at hsub - obtain ⟨hsx, -⟩ := Point.some.inj hsub - have hsub' : Point.some Xp Yp hQp - Point.some X Y hQ = Point.some x y h := by - rw [← hmP, ← hpP, smul_succ h]; abel -- rw [sub_eq_of_X_ne ha₁ ha₃ hQ hQp (Ne.symm hXX)] at hsub' -+ rw [sub_eq_of_X_ne hQ hQp (Ne.symm hXX)] at hsub' - obtain ⟨hsx', hsy'⟩ := Point.some.inj hsub' -- rw [addX_eq ha₁ ha₃] at hsx hsx' -+ rw [addX_eq ha₁] at hsx hsx' - rw [addY_eq ha₁ ha₃] at hsy' -- have hl : W.slope X Xp Y Yp * (X - Xp) = Y - Yp := slope_mul_of_X_ne ha₁ ha₃ Y Yp hXX -+ have hl : W.slope X Xp Y Yp * (X - Xp) = Y - Yp := slope_mul_of_X_ne Y Yp hXX - have hn : W.slope Xp X Yp (W.negY X Y) * (Xp - X) = Yp + Y := - slope_neg_mul ha₁ ha₃ (Ne.symm hXX) - have hn' : W.slope X Xp Y (W.negY Xp Yp) * (X - Xp) = Y + Yp := slope_neg_mul ha₁ ha₃ hXX -@@ -838,7 +849,7 @@ theorem good_odd (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) (g₁ : Good h (m - 1)) - exact sub_eq_zero.mp ((mul_eq_zero.mp this).resolve_right - (mul_ne_zero (pow_ne_zero _ hem) hep)) - refine ⟨fun h0 => absurd h0 hEp0, fun _ => ⟨_, _, _, hQQ.symm, ?_, ?_⟩⟩ -- · rw [addX_eq ha₁ ha₃, h1, h4, h3] -+ · rw [addX_eq ha₁, h1, h4, h3] - linear_combination (-E1 ^ 4 * E2 ^ 4) * hD - · rw [addY_eq ha₁ ha₃, h1] - rw [h3, h4] at r_C -@@ -852,7 +863,7 @@ theorem good_odd (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) (g₁ : Good h (m - 1)) - - /-! ### The `2`-torsion points and the main theorem -/ - --omit ha₁ ha₃ in -+omit [NeZero (2 : F)] ha₁ ha₃ in - /-- The odd terms of the auxiliary sequence with `b = 0` are nonzero when `c ≠ 0`. -/ - theorem preNormEDS'_odd_ne_zero {c d : F} (hc : c ≠ 0) (k : ℕ) : - preNormEDS' (0 : F) c d (2 * k + 1) ≠ 0 := by -@@ -863,7 +874,7 @@ theorem preNormEDS'_odd_ne_zero {c d : F} (hc : c ≠ 0) (k : ℕ) : - · simpa using hc - · rw [show 2 * (j + 2) + 1 = 2 * (j + 2) + 1 from rfl, preNormEDS'_odd] - rcases Nat.even_or_odd' j with ⟨i, rfl | rfl⟩ -- · rw [if_pos (even_two_mul i), if_pos (even_two_mul i)] -+ · rw [ite_eq_left (even_two_mul i), ite_eq_left (even_two_mul i)] - have h1 := ih i (by omega) - have h2 := ih (i + 1) (by omega) - rw [show 2 * i + 1 = 2 * i + 1 from rfl] at h1 -@@ -872,7 +883,7 @@ theorem preNormEDS'_odd_ne_zero {c d : F} (hc : c ≠ 0) (k : ℕ) : - simp only [mul_zero, mul_one, zero_sub, neg_ne_zero] - exact mul_ne_zero h1 (pow_ne_zero _ h2) - · have hodd : ¬Even (2 * i + 1) := Nat.not_even_iff_odd.mpr ⟨i, rfl⟩ -- rw [if_neg hodd, if_neg hodd] -+ rw [ite_eq_right hodd, ite_eq_right hodd] - have h1 := ih (i + 1) (by omega) - have h2 := ih (i + 2) (by omega) - rw [show 2 * (i + 1) + 1 = 2 * i + 1 + 2 by ring] at h1 -@@ -883,8 +894,9 @@ theorem preNormEDS'_odd_ne_zero {c d : F} (hc : c ≠ 0) (k : ℕ) : - omit [NeZero (2 : F)] ha₁ ha₃ in - /-- The even terms of `eₙ` vanish at a `2`-torsion point. -/ - theorem eds_eq_zero_of_even (hy : y = 0) {n : ℤ} (hn : Even n) : eds W x y n = 0 := by -- rw [eds, normEDS, if_pos hn, hy]; ring -+ rw [eds, normEDS, ite_eq_left hn, hy]; ring - -+omit [NeZero (2 : F)] in - include h in - /-- `Ψ₃(x) ≠ 0` at a `2`-torsion point `(x, 0)`: `Ψ₃(x) = −f'(x)²` there. -/ - theorem Ψ₃_ne_zero_of_y_eq_zero (hy : y = 0) : W.Ψ₃.eval x ≠ 0 := by -@@ -904,15 +916,17 @@ theorem Ψ₃_ne_zero_of_y_eq_zero (hy : y = 0) : W.Ψ₃.eval x ≠ 0 := by - rw [this, ← hf, zero_pow two_ne_zero, mul_zero, zero_sub, neg_ne_zero] - exact pow_ne_zero _ hf' - -+omit [NeZero (2 : F)] in - include h in - /-- The odd terms of `eₙ` do not vanish at a `2`-torsion point. -/ - theorem eds_ne_zero_of_odd (hy : y = 0) (k : ℕ) : eds W x y (2 * k + 1) ≠ 0 := by - have hc := Ψ₃_ne_zero_of_y_eq_zero ha₁ ha₃ h hy - have hodd : ¬Even (2 * (k : ℤ) + 1) := Int.not_even_iff_odd.mpr ⟨k, rfl⟩ -- rw [eds, normEDS, if_neg hodd, mul_one, hy, mul_zero, -+ rw [eds, normEDS, ite_eq_right hodd, mul_one, hy, mul_zero, - show (2 * (k : ℤ) + 1) = ((2 * k + 1 : ℕ) : ℤ) by push_cast; ring, preNormEDS_ofNat] - simpa using preNormEDS'_odd_ne_zero hc k - -+omit [NeZero (2 : F)] in - /-- `Good n` for every `n` at a `2`-torsion point `(x, 0)`. -/ - theorem good_of_y_eq_zero (hy : y = 0) (n : ℕ) : Good h n := by - have h2P : 2 • Point.some x y h = 0 := by -@@ -922,12 +936,13 @@ theorem good_of_y_eq_zero (hy : y = 0) (n : ℕ) : Good h n := by - · refine good_of_eq_zero h (eds_eq_zero_of_even hy ⟨k, by push_cast; ring⟩) ?_ - rw [mul_nsmul, h2P, smul_zero] - · have hne := eds_ne_zero_of_odd ha₁ ha₃ h hy k -- refine ⟨fun h0 => absurd (by push_cast; exact h0) hne, fun _ => ⟨x, y, h, ?_, ?_, ?_⟩⟩ -+ refine ⟨fun h0 => absurd h0 hne, fun _ => ⟨x, y, h, ?_, ?_, ?_⟩⟩ - · rw [succ_nsmul, mul_nsmul, h2P, smul_zero, zero_add] - · have e1 : eds W x y (((2 * k + 1 : ℕ) : ℤ) + 1) = 0 := - eds_eq_zero_of_even hy ⟨k + 1, by push_cast; ring⟩ - rw [e1, zero_mul, sub_zero] -- · rw [hy, edsC, complEDS₂, if_neg (Int.not_even_iff_odd.mpr ⟨k, by push_cast; ring⟩)]; ring -+ · rw [hy, edsC, complEDS₂, ite_eq_right (Int.not_even_iff_odd.mpr ⟨k, by push_cast; ring⟩)] -+ ring - - /-- **The division polynomials describe the multiples of a point**: for every nonsingular point - `P = (x, y)` of `y² = x³ + a₂x² + a₄x + a₆` and every `n`, `eₙ = ψₙ(x, y) = 0` iff `nP = 0`, and -diff --git a/Iut/Tower/SerreBound.lean b/Iut/Tower/SerreBound.lean -index 0129e14..c0d4d87 100644 ---- a/Iut/Tower/SerreBound.lean -+++ b/Iut/Tower/SerreBound.lean -@@ -116,7 +116,7 @@ theorem exists_mem_pow_intTrace_notMem (h𝔭 : 𝔭 ≠ ⊥) (e κ : ℕ) (J : - refine Ideal.IsMaximal.eq_of_le inferInstance (Ideal.IsPrime.ne_top inferInstance) ?_ - change maximalIdeal Rₚ ≤ 𝔓ₚ.comap (algebraMap Rₚ Sₚ) - rw [← Ideal.map_le_iff_le_comap, hpSₚ] -- exact Ideal.mul_le_right.trans (Ideal.pow_le_self he) -+ exact Ideal.mul_le_left.trans (Ideal.pow_le_self he) - haveI : Finite (Rₚ ⧸ maximalIdeal Rₚ) := - Finite.of_equiv _ (IsLocalization.AtPrime.equivQuotMaximalIdeal 𝔭 Rₚ).toEquiv - -- the contraction of `𝔪^n` to `A` is `𝔭^n` -@@ -186,7 +186,7 @@ theorem exists_mem_pow_intTrace_notMem (h𝔭 : 𝔭 ≠ ⊥) (e κ : ℕ) (J : - ((Ideal.isCoprime_iff_sup_eq.mpr hJₚ').pow_left).pow_right - letI : Algebra (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) (Sₚ ⧸ Jₚ ^ (κ + 1)) := - Ideal.Quotient.algebraQuotientOfLEComap -- (by rw [← Ideal.map_le_iff_le_comap, hprod]; exact Ideal.mul_le_left) -+ (by rw [← Ideal.map_le_iff_le_comap, hprod]; exact Ideal.mul_le_right) - haveI : IsScalarTower Rₚ (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) (Sₚ ⧸ Jₚ ^ (κ + 1)) := - IsScalarTower.of_algebraMap_eq' rfl - haveI : IsScalarTower Rₚ (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) -diff --git a/Iut/Tower/SerreCore.lean b/Iut/Tower/SerreCore.lean -index 3d2a13f..ff3447b 100644 ---- a/Iut/Tower/SerreCore.lean -+++ b/Iut/Tower/SerreCore.lean -@@ -37,7 +37,7 @@ variable (e κ : ℕ) (J : Ideal B) - lemma pow_le_comap (hpB : 𝔭.map (algebraMap A B) = 𝔓 ^ e * J) : - 𝔭 ^ (κ + 1) ≤ (𝔓 ^ (e * (κ + 1))).comap (algebraMap A B) := by - rw [← Ideal.map_le_iff_le_comap, Ideal.map_pow, hpB, mul_pow, ← pow_mul] -- exact Ideal.mul_le_right -+ exact Ideal.mul_le_left - - /-- The `A/𝔭^{κ+1}`-algebra structure of `B/𝔓^{e(κ+1)}`. -/ - noncomputable def quotAlgebra (hpB : 𝔭.map (algebraMap A B) = 𝔓 ^ e * J) : -@@ -170,7 +170,7 @@ lemma exists_monic_root (he : e ≠ 0) (h𝔓 : 𝔓 ≠ ⊥) : - exact (hmemI _).mp hαa₀ - refine ⟨g, α, hgm, hgdeg.trans hg₀deg, hαg, fun y => ?_⟩ - have hy : y ∈ Algebra.adjoin (A ⧸ 𝔭) ({a₁} : Set (B ⧸ 𝔓)) := by -- rw [← IntermediateField.adjoin_simple_toSubalgebra_of_integral hint, ha₁] -+ rw [← IntermediateField.adjoin_simple_toSubalgebra_of_isAlgebraic hint.isAlgebraic, ha₁] - exact trivial - rw [Algebra.adjoin_singleton_eq_range_aeval] at hy - obtain ⟨q', hq'⟩ := hy -diff --git a/Iut/Tripod/Basic.lean b/Iut/Tripod/Basic.lean -index e7dc78f..4ab670d 100644 ---- a/Iut/Tripod/Basic.lean -+++ b/Iut/Tripod/Basic.lean -@@ -404,9 +404,9 @@ theorem finite_of_fieldOf_eq (F : IntermediateField ℚ Qbar) [FiniteDimensional - (fun x : Pt ↦ x.1) ⁻¹' (Subtype.val '' {y : F | Height.logHeight₁ y ≤ - max H 0 * Module.finrank ℚ F}) := by - rintro ⟨l, hl⟩ ⟨hFl, hH⟩ -- simp only [Set.mem_preimage, Set.mem_image, Set.mem_setOf_eq] - subst hFl - refine ⟨gen l, ?_, rfl⟩ -+ change Height.logHeight₁ (gen ((⟨l, hl⟩ : Pt) : Qbar)) ≤ _ - rw [← deg_mul_htCan ⟨l, hl⟩, ← deg_eq_finrank, mul_comm] - exact mul_le_mul_of_nonneg_right (hH.trans (le_max_left _ _)) (Nat.cast_nonneg _) - refine ((hF.image Subtype.val).preimage ?_).subset himg -diff --git a/Iut/Tripod/CyclicIsogeny.lean b/Iut/Tripod/CyclicIsogeny.lean -index cc96d31..9b14036 100644 ---- a/Iut/Tripod/CyclicIsogeny.lean -+++ b/Iut/Tripod/CyclicIsogeny.lean -@@ -556,7 +556,8 @@ lemma apply_genC_eq_one {v : FinitePlace (P.curve x).F} (hv : v ∉ (P.curve x). - /-- `|n|_v ≤ 1` at a finite place. -/ - lemma apply_natCast_le_one {T : Type*} [Field T] [NumberField T] (v : FinitePlace T) (n : ℕ) : - v (n : T) ≤ 1 := -- IsNonarchimedean.apply_natCast_le_one (f := v) (fun a b => FinitePlace.add_le v a b) -+ IsNonarchimedean.apply_natCast_le_one (f := v) (by simp) (by simp) -+ (fun a b => FinitePlace.add_le v a b) - - /-- `max(1, a)^d = max(1, a^d)` for `a ≥ 0`. -/ - lemma max_one_pow {a : ℝ} (ha : 0 ≤ a) (d : ℕ) : max 1 a ^ d = max 1 (a ^ d) := by -diff --git a/Iut/Tripod/CyclicLocal.lean b/Iut/Tripod/CyclicLocal.lean -index 52c4ce3..e876e7a 100644 ---- a/Iut/Tripod/CyclicLocal.lean -+++ b/Iut/Tripod/CyclicLocal.lean -@@ -349,6 +349,13 @@ variable {C : EllipticCurveData.{u}} {ℓ : ℕ} (R : C.ModEllRepData ℓ) - attribute [local instance 1100] Iut.EllipticCurveData.ModEllRepData.instDecidableEqTorsionFieldR - attribute [local instance] Iut.instGalRingOfIntegersAction Iut.instGalRingOfIntegersGaloisGroup - -+noncomputable local instance instTorsionFieldIdealAction : -+ MulAction (↥R.torsionField ≃ₐ[C.F] ↥R.torsionField) (Ideal (𝓞 ↥R.torsionField)) := by -+ letI : MulSemiringAction (↥R.torsionField ≃ₐ[C.F] ↥R.torsionField) (𝓞 ↥R.torsionField) := -+ Iut.instGalRingOfIntegersAction (k := C.F) (K := ↥R.torsionField) -+ exact (Ideal.pointwiseDistribMulAction : DistribMulAction -+ (↥R.torsionField ≃ₐ[C.F] ↥R.torsionField) (Ideal (𝓞 ↥R.torsionField))).toMulAction -+ - lemma graphLineAt_congrR {VBad : Set (FinitePlace ↥(fieldOfModuli C.F C.E))} - (TF : TateFamily C.E R.torsionField ℓ VBad) {w w' : FinitePlace ↥R.torsionField} (h : w = w') - (hw : IsBadPlace C.E R.torsionField VBad w) (hw' : IsBadPlace C.E R.torsionField VBad w') : -diff --git a/Iut/Tripod/CyclicTate.lean b/Iut/Tripod/CyclicTate.lean -index d899299..b1427c5 100644 ---- a/Iut/Tripod/CyclicTate.lean -+++ b/Iut/Tripod/CyclicTate.lean -@@ -132,7 +132,7 @@ theorem ratio_bound {ℓ : ℕ} (hℓ : Odd ℓ) (hcard : Fintype.card H = ℓ) - have hτ' : τ = -1 := Units.ext (by rw [hτ1]; simp) - have hρ' := half_class_minus_one S hRTm (hτ' ▸ hτ) hρ hρlo hρhi - rw [hr] -- refine Finset.prod_le_one (fun _ _ => by positivity) fun Q hQ => ?_ -+ refine Finset.prod_le_one₀ (fun _ _ => by positivity) fun Q hQ => ?_ - obtain ⟨hnum, hden⟩ := minus_one_bounds S.t h2 hρ' hℓ (hζℓ Q hQ) (hζ1 Q hQ) - rw [hτ'] - exact div_le_one_of_le₀ (hnum.trans hden) (norm_nonneg _) -@@ -142,7 +142,7 @@ theorem ratio_bound {ℓ : ℕ} (hℓ : Odd ℓ) (hcard : Fintype.card H = ℓ) - have hρ' := half_class_node S hRTm hτ hρ hτn hρlo hρhi - have hℓ0 : ℓ ≠ 0 := by rintro rfl; exact Nat.not_odd_zero hℓ - rw [hr, ← Finset.prod_pow, ← hcardnz, ← Finset.prod_const] -- refine Finset.prod_le_prod (fun _ _ => by positivity) fun Q hQ => ?_ -+ refine Finset.prod_le_prod₀ (fun _ _ => by positivity) fun Q hQ => ?_ - have hζn : ‖((ζ Q : kˣ) : k)‖ = 1 := by - have h := congrArg (fun u : kˣ => ‖(u : k)‖) (hζℓ Q hQ) - simp only [Units.val_pow_eq_pow_val, norm_pow, Units.val_one, norm_one] at h -diff --git a/Iut/Tripod/CyclicTorsion.lean b/Iut/Tripod/CyclicTorsion.lean -index 3d5a9fe..2b08938 100644 ---- a/Iut/Tripod/CyclicTorsion.lean -+++ b/Iut/Tripod/CyclicTorsion.lean -@@ -159,7 +159,7 @@ lemma mem_TKR_of_bcKR {P : (curveK C.E R.torsionField).toAffine.Point} - - /-- **The ℓ-torsion is rational over `K`**: `E(K)[ℓ] ≃ E(F̄)[ℓ]`. -/ - noncomputable def torsionEquivR : ↥R.TKR ≃+ ↥R.TFbarR := -- AddEquiv.ofBijective (R.bcKR.restrict R.TKR |>.codRestrict _ fun P => R.bcKR_mem_TFbarR P.2) -+ AddEquiv.ofBijective (R.bcKR.domRestrict R.TKR |>.codRestrict _ fun P => R.bcKR_mem_TFbarR P.2) - ⟨fun P P' h => Subtype.ext (R.bcKR_injective (congrArg Subtype.val h)), - fun Q => by - obtain ⟨P, hP⟩ := R.exists_bcKR_eq Q.1 Q.2 -diff --git a/Iut/Tripod/TorsionDegree.lean b/Iut/Tripod/TorsionDegree.lean -index 144d0f8..76a6b68 100644 ---- a/Iut/Tripod/TorsionDegree.lean -+++ b/Iut/Tripod/TorsionDegree.lean -@@ -75,7 +75,7 @@ theorem galAct_torsionBy (σ : Qbar ≃ₐ[K] Qbar) {n : ℕ} {P : (legendre l). - noncomputable def galTorsion (n : ℕ) (σ : Qbar ≃ₐ[K] Qbar) : - AddSubgroup.torsionBy (legendre l).toAffine.Point n →+ - AddSubgroup.torsionBy (legendre l).toAffine.Point n := -- ((galAct K hl σ).restrict (AddSubgroup.torsionBy (legendre l).toAffine.Point n)).codRestrict -+ ((galAct K hl σ).domRestrict (AddSubgroup.torsionBy (legendre l).toAffine.Point n)).codRestrict - (AddSubgroup.torsionBy (legendre l).toAffine.Point n) - (fun P => galAct_torsionBy K hl σ P.2) - -diff --git a/Iut/Tripod/TorsionNewton.lean b/Iut/Tripod/TorsionNewton.lean -index 9f2147f..103302e 100644 ---- a/Iut/Tripod/TorsionNewton.lean -+++ b/Iut/Tripod/TorsionNewton.lean -@@ -78,7 +78,8 @@ theorem apply_x_le {W : Affine K} (ha₁ : W.a₁ = 0) (ha₃ : W.a₃ = 0) (h - have h₃ : w W.a₃ ≤ 1 := by rw [ha₃, map_zero]; exact zero_le_one - have hroot : (W.ΨSq n).eval x = 0 := (Iut.Torsion.smul_eq_zero_iff_ΨSq ha₁ ha₃ h n).mp hP - have hn1 : (1 : ℝ) ≥ w (n : K) := -- IsNonarchimedean.apply_natCast_le_one (f := w) (fun a b => FinitePlace.add_le w a b) -+ IsNonarchimedean.apply_natCast_le_one (f := w) (map_zero_le w 1) (map_one w) -+ (fun a b => FinitePlace.add_le w a b) - by_cases hx : w x ≤ 1 - · exact mul_le_one₀ (pow_le_one₀ (n := 2) (apply_nonneg w _) hn1) (apply_nonneg w x) hx - rw [not_le] at hx -diff --git a/Iut/Tripod/TpdGalois.lean b/Iut/Tripod/TpdGalois.lean -index 2b4637c..ad28667 100644 ---- a/Iut/Tripod/TpdGalois.lean -+++ b/Iut/Tripod/TpdGalois.lean -@@ -168,11 +168,11 @@ noncomputable def tpdEquivAdjoinMod : - ↥(tpdC x h3 h5) ≃ₐ[modC x h3 h5] ↥((modC x h3 h5)⟮genC x h3 h5⟯) where - toFun t := ⟨t.1, (mem_adjoin_modC_iff x h3 h5 _).mpr ((mem_tpdC_iff x h3 h5 _).mp t.2)⟩ - invFun s := ⟨s.1, (mem_tpdC_iff x h3 h5 _).mpr ((mem_adjoin_modC_iff x h3 h5 _).mp s.2)⟩ -- left_inv _ := rfl -- right_inv _ := rfl -- map_mul' _ _ := rfl -- map_add' _ _ := rfl -- commutes' _ := rfl -+ left_inv _ := Subtype.ext rfl -+ right_inv _ := Subtype.ext rfl -+ map_mul' _ _ := Subtype.ext rfl -+ map_add' _ _ := Subtype.ext rfl -+ commutes' _ := Subtype.ext rfl - - /-- The sextic splits over `F_λ`. -/ - theorem sext_map_splits : -diff --git a/Iut/Tripod/TpdInertia.lean b/Iut/Tripod/TpdInertia.lean -index 78240c5..775a3dc 100644 ---- a/Iut/Tripod/TpdInertia.lean -+++ b/Iut/Tripod/TpdInertia.lean -@@ -131,7 +131,7 @@ theorem card_inertia_le_two_mul (w : FinitePlace (P.curve x).F) (f : (P.curve x) - 2 * Nat.card (inertiaPlus P x w) := by - haveI : IsGalois (tpd P x) (P.curve x).F := isGalois_tpd_curve' (P := P) (x := x) - set I := w.maximalIdeal.asIdeal.inertia ((P.curve x).F ≃ₐ[tpd P x] (P.curve x).F) with hI -- set ε := (signHom f hf hf0).restrict I with hε -+ set ε := (signHom f hf hf0).domRestrict I with hε - have h1 := Subgroup.card_mul_index ε.ker - have hidx : ε.ker.index ≤ 2 := by - rw [Subgroup.index_ker] -@@ -199,8 +199,8 @@ theorem card_inertiaPlus_le (w : FinitePlace (P.curve x).F) (h2 : residueChar w - haveI : Fact (Nat.Prime 5) := ⟨by norm_num⟩ - have hsub3 := torsionCoords_three_subset_fieldOf' x.1 - have hsub5 := torsionCoords_five_subset_fieldOf' x.1 -- set ρ₃ := (repF P x 3 hsub3).restrict (inertiaPlus P x w) with hρ₃ -- set ρ₅ := (repF P x 5 hsub5).restrict (inertiaPlus P x w) with hρ₅ -+ set ρ₃ := (repF P x 3 hsub3).domRestrict (inertiaPlus P x w) with hρ₃ -+ set ρ₅ := (repF P x 5 hsub5).domRestrict (inertiaPlus P x w) with hρ₅ - have hn3 : w.maximalIdeal.valuation _ ((3 : ℕ) : (P.curve x).F) = 1 := - (valuation_natCast_eq_one_iff w Nat.prime_three).2 h3 - have hn5 : w.maximalIdeal.valuation _ ((5 : ℕ) : (P.curve x).F) = 1 := -@@ -246,7 +246,7 @@ theorem card_inertiaPlus_le (w : FinitePlace (P.curve x).F) (h2 : residueChar w - card_le_of_forall_pow_eq_one ρ₃.range 3 16 hGL3 (by norm_num) fun τ hτ => by - obtain ⟨σ, rfl⟩ := hτ - exact hpow3 σ -- set ρ₅' := ρ₅.restrict ρ₃.ker with hρ₅' -+ set ρ₅' := ρ₅.domRestrict ρ₃.ker with hρ₅' - have hinj' : Function.Injective ρ₅' := by - intro σ τ h - have h' : ρ₅ σ.1 = ρ₅ τ.1 := h -diff --git a/Iut/Tripod/TpdTorsionRep.lean b/Iut/Tripod/TpdTorsionRep.lean -index 5b03838..bb36be0 100644 ---- a/Iut/Tripod/TpdTorsionRep.lean -+++ b/Iut/Tripod/TpdTorsionRep.lean -@@ -101,7 +101,7 @@ lemma toQbar_mem_torsionBy {R : (EF).Point} (hR : R ∈ AddSubgroup.torsionBy (E - noncomputable def torsionEquivF : - ↥(AddSubgroup.torsionBy (EF).Point n) ≃+ - ↥(AddSubgroup.torsionBy (legendre x.1).toAffine.Point n) := -- AddEquiv.ofBijective ((toQbar P x).restrict (AddSubgroup.torsionBy (EF).Point n) |>.codRestrict -+ AddEquiv.ofBijective ((toQbar P x).domRestrict (AddSubgroup.torsionBy (EF).Point n) |>.codRestrict - _ fun R => toQbar_mem_torsionBy P x n R.2) - ⟨fun R R' h => Subtype.ext (toQbar_injective P x (congrArg Subtype.val h)), - fun Q => by -@@ -145,7 +145,7 @@ lemma galF_mem_torsionBy (σ : (P.curve x).F ≃ₐ[tpd P x] (P.curve x).F) {R : - /-- The action on the `n`-torsion. -/ - noncomputable def galTorsionF (σ : (P.curve x).F ≃ₐ[tpd P x] (P.curve x).F) : - ↥(AddSubgroup.torsionBy (EF).Point n) →+ ↥(AddSubgroup.torsionBy (EF).Point n) := -- (galF P x σ).restrict _ |>.codRestrict _ fun R => galF_mem_torsionBy P x n σ R.2 -+ (galF P x σ).domRestrict _ |>.codRestrict _ fun R => galF_mem_torsionBy P x n σ R.2 - - omit [Fact n.Prime] hsub in - @[simp] lemma coe_galTorsionF (σ : (P.curve x).F ≃ₐ[tpd P x] (P.curve x).F) -diff --git a/lake-manifest.json b/lake-manifest.json -index c7312cb..819e49e 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,9 +1,7 @@ --{ -- "version": "1.2.0", -+{"version": "1.2.0", - "packagesDir": ".lake/packages", -- "packages": [ -- { -- "url": "https://github.com/lana-agents/tempered-fundamental-groups", -+ "packages": -+ [{"url": "https://github.com/lana-agents/tempered-fundamental-groups.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -12,10 +10,8 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "2006651f52b70ea2fe3388238c7d9db14d21748f", - "inherited": false, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/lana-agents/oka.git", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/oka.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -24,10 +20,8 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", - "inherited": false, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/lana-agents/orbicurve-cores", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/orbicurve-cores.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -36,10 +30,8 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "61616dcd77fbe45c083a8ebfa7cc80728f86e841", - "inherited": false, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/lana-agents/pi1", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/pi1.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -48,10 +40,8 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "ca7def953193f861a462aa0831eec8f0a31ff69f", - "inherited": false, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/lana-agents/heights", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/heights.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -60,10 +50,8 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", - "inherited": false, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/lana-agents/genl", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/genl.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -72,10 +60,8 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "ea2846c877d1e16d8f0b911a5fed07f5ee69eaaf", - "inherited": false, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/lana-agents/tate-curves-theta", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/tate-curves-theta.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -84,22 +70,18 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "ca6c2279d3cea0690cdb01328e727118d5485d68", - "inherited": false, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/leanprover-community/mathlib4", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, -- "configFile": "lakefile.lean" -- }, -- { -- "url": "https://github.com/lana-agents/elliptic-curves", -+ "configFile": "lakefile.lean"}, -+ {"url": "https://github.com/lana-agents/elliptic-curves.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -108,10 +90,8 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "bebec3fc9f2602e81c83e5236789572a541c85fb", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/lana-agents/belyi.git", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/belyi.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -120,10 +100,8 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/lana-agents/formal-schemes", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/formal-schemes.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -132,106 +110,87 @@ - "manifestFile": "lake-manifest.json", - "inputRev": "51aa935079537bf4dc580751a6e70727fb23ca93", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/leanprover-community/plausible", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/leanprover-community/LeanSearchClient", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/leanprover-community/LeanSearchClient", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/leanprover-community/import-graph", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/leanprover-community/import-graph", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/leanprover-community/ProofWidgets4", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/leanprover-community/ProofWidgets4", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.lean" -- }, -- { -- "url": "https://github.com/leanprover-community/aesop", -+ "configFile": "lakefile.lean"}, -+ {"url": "https://github.com/leanprover-community/aesop", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/leanprover-community/quote4", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/leanprover-community/quote4", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/leanprover-community/batteries", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/leanprover-community/batteries", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, -- "configFile": "lakefile.toml" -- }, -- { -- "url": "https://github.com/leanprover/lean4-cli", -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/leanprover/lean4-cli", - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, -- "configFile": "lakefile.toml" -- } -- ], -+ "configFile": "lakefile.toml"}], - "name": "iut", - "lakeDir": ".lake", -- "fixedToolchain": false --} -\ No newline at end of file -+ "fixedToolchain": false} -diff --git a/lakefile.toml b/lakefile.toml -index 46c5aaa..fee9e14 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,6 +4,8 @@ keywords = ["math"] - defaultTargets = ["Iut", "Iut4Sec1", "Challenge", "Solution"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true -@@ -12,14 +14,14 @@ warn.sorry = false # `sorry` is load-bearing in Comparator/Challenge.lean - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - # Tate q-parameters and the classical theta function (taxis #13/#37); consumed by - # the initial Θ-data and Corollary 3.12 variant strand (taxis #33). - [[require]] - name = "tate-curves-theta" --git = "https://github.com/lana-agents/tate-curves-theta" -+git = "https://github.com/lana-agents/tate-curves-theta.git" - rev = "ca6c2279d3cea0690cdb01328e727118d5485d68" - - # Arithmetic elliptic curves in general position (taxis #2): the height formalism and -@@ -28,7 +30,7 @@ rev = "ca6c2279d3cea0690cdb01328e727118d5485d68" - # curves over number fields and its proof package (Genl.Curves, branch wp-height-theory). - [[require]] - name = "genl" --git = "https://github.com/lana-agents/genl" -+git = "https://github.com/lana-agents/genl.git" - rev = "ea2846c877d1e16d8f0b911a5fed07f5ee69eaaf" - - # Heights and elliptic-curve height estimates (taxis #32): the complex uniformization of -@@ -36,7 +38,7 @@ rev = "ea2846c877d1e16d8f0b911a5fed07f5ee69eaaf" - # also the height machine on curves used by Genl.Curves (branch wp-integrate). - [[require]] - name = "heights" --git = "https://github.com/lana-agents/heights" -+git = "https://github.com/lana-agents/heights.git" - rev = "721496ca4c158e511d25d8ccf6bfe8503eda73c1" - - # Étale fundamental groups (Galois-theoretic π₁, inertia) and cores of orbicurves -@@ -45,18 +47,17 @@ rev = "721496ca4c158e511d25d8ccf6bfe8503eda73c1" - # branch wp-core-basechange). - [[require]] - name = "pi1" --git = "https://github.com/lana-agents/pi1" -+git = "https://github.com/lana-agents/pi1.git" - rev = "ca7def953193f861a462aa0831eec8f0a31ff69f" - - # [CanLift], Prop. 2.7 over ℂ (`OrbicurveCores.U2.canLift27C`, branch wp-u2), which together - # with `AffOrbicurve.canLift27_of_complex` discharges `AffOrbicurve.CanLift27`. - [[require]] - name = "orbicurve-cores" --git = "https://github.com/lana-agents/orbicurve-cores" -+git = "https://github.com/lana-agents/orbicurve-cores.git" - rev = "61616dcd77fbe45c083a8ebfa7cc80728f86e841" - --# Pinned directly so that one `oka` revision serves both `belyi` (which pins the ancestor --# da228a2) and `orbicurve-cores` (which pins this revision, branch wp-u2). -+# One `oka` revision serves both `belyi` and `orbicurve-cores` (branch wp-u2). - [[require]] - name = "oka" - git = "https://github.com/lana-agents/oka.git" -@@ -66,7 +67,7 @@ rev = "75dcdc3faadd10b986afb9283e89902bcdddecd4" - # `Iut.Anabelian.TemperedPi1Theory` in `Iut/Anabelian/Tempered.lean`. - [[require]] - name = "tempered-fundamental-groups" --git = "https://github.com/lana-agents/tempered-fundamental-groups" -+git = "https://github.com/lana-agents/tempered-fundamental-groups.git" - rev = "2006651f52b70ea2fe3388238c7d9db14d21748f" - - # Corollary 3.12 variant (IUT III) and the ABC target statement. -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f49..ba8ebf2 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/Iut/Anabelian/Genuine/Homs.lean b/Iut/Anabelian/Genuine/Homs.lean +index 7de5889..2756b13 100644 +--- a/Iut/Anabelian/Genuine/Homs.lean ++++ b/Iut/Anabelian/Genuine/Homs.lean +@@ -418,10 +418,8 @@ lemma eIdx_tower {F L L' : IntermediateField (xLine E) (Ω E)} [FiniteDimensiona + lemma comap_isMaximal {F L : IntermediateField (xLine E) (Ω E)} (h : F ≤ L) + (w : Ideal (coordRing k (xG E) L)) [hw : w.IsMaximal] : + (w.comap (ringMap (xG E) h)).IsMaximal := by +- letI := algRing (xG E) h +- haveI : Algebra.IsIntegral (coordRing k (xG E) F) (coordRing k (xG E) L) := +- ⟨ringMap_isIntegral _ h⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap (xG E) h).toRingHom (ringMap_isIntegral _ h) w + + set_option maxHeartbeats 1000000 in + set_option synthInstance.maxHeartbeats 400000 in +diff --git a/Iut/Anabelian/Genuine/Punctured.lean b/Iut/Anabelian/Genuine/Punctured.lean +index 2810b7d..4106cbe 100644 +--- a/Iut/Anabelian/Genuine/Punctured.lean ++++ b/Iut/Anabelian/Genuine/Punctured.lean +@@ -176,7 +176,7 @@ lemma bijective_algebraMap_coarse : + rw [← hz] at h1 + haveI : IsScalarTower (A₀ k (xG E)) (K₀ k (xG E)) (Ω E) := + IsScalarTower.of_algebraMap_eq fun _ => rfl +- exact (isIntegral_algebraMap_iff (algebraMap (K₀ k (xG E)) (Ω E)).injective).mp h1 ++ exact isIntegral_algebraMap_iff.mp h1 + obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ k (xG E)) + (K := K₀ k (xG E))).mp hzint + refine ⟨a, Subtype.ext (Subtype.ext ?_)⟩ +diff --git a/Iut/Anabelian/Model.lean b/Iut/Anabelian/Model.lean +index 4145caa..3da2b3d 100644 +--- a/Iut/Anabelian/Model.lean ++++ b/Iut/Anabelian/Model.lean +@@ -149,7 +149,7 @@ lemma pointMap_mem_torsion (f : k →+* K) (X : Orbicurve k) {P : X.E.toAffine.P + /-- The map on torsion induced by base change. -/ + def mapTorsion (f : k →+* K) (X : Orbicurve k) : + ↥X.torsion →+ ↥(X.baseChange f).torsion := +- ((pointMap X.E f).restrict X.torsion).codRestrict _ fun P => by ++ ((pointMap X.E f).domRestrict X.torsion).codRestrict _ fun P => by + exact X.pointMap_mem_torsion f P.2 + + @[simp] lemma coe_mapTorsion (f : k →+* K) (X : Orbicurve k) (P : ↥X.torsion) : +diff --git a/Iut/Anabelian/Torsion.lean b/Iut/Anabelian/Torsion.lean +index df13fd4..23c1d3d 100644 +--- a/Iut/Anabelian/Torsion.lean ++++ b/Iut/Anabelian/Torsion.lean +@@ -93,7 +93,7 @@ lemma mem_TK_of_bcK {R : P.EK.toAffine.Point} (hR : P.bcK R ∈ P.TFbar) : R ∈ + + /-- **The ℓ-torsion is rational over `K`**: `E(K)[ℓ] ≃ E(F̄)[ℓ]`. -/ + def torsionEquiv : ↥P.TK ≃+ ↥P.TFbar := +- AddEquiv.ofBijective (P.bcK.restrict P.TK |>.codRestrict _ fun R => P.bcK_mem_TFbar R.2) ++ AddEquiv.ofBijective (P.bcK.domRestrict P.TK |>.codRestrict _ fun R => P.bcK_mem_TFbar R.2) + ⟨fun R R' h => Subtype.ext (P.bcK_injective (congrArg Subtype.val h)), + fun Q => by + obtain ⟨R, hR⟩ := P.exists_bcK_eq Q.1 Q.2 +@@ -150,7 +150,7 @@ lemma galK_mem_TK (σ : ↥P.torsionField ≃ₐ[F] ↥P.torsionField) {R : P.EK + + /-- The action of `Gal(K/F)` on the ℓ-torsion. -/ + def galTK (σ : ↥P.torsionField ≃ₐ[F] ↥P.torsionField) : ↥P.TK →+ ↥P.TK := +- (P.galK σ).restrict P.TK |>.codRestrict _ fun R => P.galK_mem_TK σ R.2 ++ (P.galK σ).domRestrict P.TK |>.codRestrict _ fun R => P.galK_mem_TK σ R.2 + + @[simp] lemma coe_galTK (σ : ↥P.torsionField ≃ₐ[F] ↥P.torsionField) (R : ↥P.TK) : + (P.galTK σ R : P.EK.toAffine.Point) = P.galK σ R := rfl +diff --git a/Iut/Concrete/LocalConstruct/ArchLogShell.lean b/Iut/Concrete/LocalConstruct/ArchLogShell.lean +index e078189..aa5d12e 100644 +--- a/Iut/Concrete/LocalConstruct/ArchLogShell.lean ++++ b/Iut/Concrete/LocalConstruct/ArchLogShell.lean +@@ -140,7 +140,7 @@ theorem archNorm_mapAlgHom_le (σ : ∀ j, ArchFactor K (c j) ≃ₐ[ℝ] ArchFa + refine (ContinuousLinearMap.le_opNorm _ _).trans ?_ + refine mul_le_of_le_one_left (norm_nonneg _) ?_ + refine (PiTensorProduct.opNorm_mapL _).trans ?_ +- exact Finset.prod_le_one (fun j _ => norm_nonneg _) fun j _ => norm_archAutCLM_le (c j) (σ j) ++ exact Finset.prod_le_one₀ (fun j _ => norm_nonneg _) fun j _ => norm_archAutCLM_le (c j) (σ j) + + /-- **IUT IV, Proposition 1.5(iii)**: the indeterminacy automorphisms preserve `B_I`. -/ + theorem mapAlgHom_image_archIntegral_subset +diff --git a/Iut/Concrete/LocalConstruct/Haar.lean b/Iut/Concrete/LocalConstruct/Haar.lean +index 8385d1b..2bf7745 100644 +--- a/Iut/Concrete/LocalConstruct/Haar.lean ++++ b/Iut/Concrete/LocalConstruct/Haar.lean +@@ -84,7 +84,7 @@ lemma closedBall_eq_iUnion_padicCoset : + obtain ⟨y, hy⟩ := hmem + have hy' : (p : ℚ_[p]) * x - (z.zmodRepr : ℚ_[p]) = (p : ℚ_[p]) * (y : ℚ_[p]) := by + have := congrArg (fun w : ℤ_[p] => (w : ℚ_[p])) hy +- simpa [z] using this ++ exact this + have : x - (z.zmodRepr : ℚ_[p]) / p = (y : ℚ_[p]) := by + field_simp + linear_combination hy' +diff --git a/Iut/Concrete/LocalConstruct/Integral.lean b/Iut/Concrete/LocalConstruct/Integral.lean +index 77cbfda..cf2a52d 100644 +--- a/Iut/Concrete/LocalConstruct/Integral.lean ++++ b/Iut/Concrete/LocalConstruct/Integral.lean +@@ -318,7 +318,7 @@ lemma exists_norm_tprodIntegral_le : + rw [Module.Basis.equivFun_apply] + unfold packetBasis tprodIntegral + rw [Basis.piTensorProduct_repr_tprod_apply, norm_prod] +- exact Finset.prod_le_prod (fun j _ => norm_nonneg _) fun j _ => hC j _ (a j).2 _ ++ exact Finset.prod_le_prod₀ (fun j _ => norm_nonneg _) fun j _ => hC j _ (a j).2 _ + + /-- **`R_I` is bounded.** -/ + lemma exists_order_subset_closedBall : +diff --git a/Iut/Concrete/LocalConstruct/LogShell.lean b/Iut/Concrete/LocalConstruct/LogShell.lean +index b0dfa96..88fac56 100644 +--- a/Iut/Concrete/LocalConstruct/LogShell.lean ++++ b/Iut/Concrete/LocalConstruct/LogShell.lean +@@ -404,7 +404,7 @@ lemma exists_norm_logShellSet_le : + rw [Module.Basis.equivFun_apply] + unfold packetBasis + rw [Basis.piTensorProduct_repr_tprod_apply, norm_prod] +- exact Finset.prod_le_prod (fun j _ => norm_nonneg _) fun j _ => hC j _ (a j).2 _ ++ exact Finset.prod_le_prod₀ (fun j _ => norm_nonneg _) fun j _ => hC j _ (a j).2 _ + + /-- The products of elements of `(R_I)^∼` with elementary tensors of elements of the factor + log-shells are bounded: `(R_I)^∼` is compact and the elementary tensors are bounded. -/ +diff --git a/Iut/Concrete/ModEllRepConstruct.lean b/Iut/Concrete/ModEllRepConstruct.lean +index 57f8a8e..3a0afaa 100644 +--- a/Iut/Concrete/ModEllRepConstruct.lean ++++ b/Iut/Concrete/ModEllRepConstruct.lean +@@ -53,7 +53,7 @@ endomorphism of the torsion subgroup. -/ + noncomputable def galTorsionHom (n : ℕ) (σ : Fbar ≃ₐ[F] Fbar) : + AddSubgroup.torsionBy (Affine.Point (Affine.baseChange E Fbar)) n →+ + AddSubgroup.torsionBy (Affine.Point (Affine.baseChange E Fbar)) n := +- ((galPointMap F E Fbar σ).restrict ++ ((galPointMap F E Fbar σ).domRestrict + (AddSubgroup.torsionBy (Affine.Point (Affine.baseChange E Fbar)) n)).codRestrict + (AddSubgroup.torsionBy (Affine.Point (Affine.baseChange E Fbar)) n) + (fun P => galPointMap_torsionBy F E Fbar σ P.2) +diff --git a/Iut/Concrete/ModEllRepGalois.lean b/Iut/Concrete/ModEllRepGalois.lean +index 7272069..34b4939 100644 +--- a/Iut/Concrete/ModEllRepGalois.lean ++++ b/Iut/Concrete/ModEllRepGalois.lean +@@ -98,7 +98,7 @@ lemma mem_TK_of_bcK {P : R.EK.toAffine.Point} (hP : R.bcK P ∈ TFbar C ℓ) : P + + /-- **The `ℓ`-torsion is rational over `K`**: `E(K)[ℓ] ≃ E(F̄)[ℓ]`. -/ + def torsionEquiv : ↥R.TK ≃+ ↥(TFbar C ℓ) := +- AddEquiv.ofBijective (R.bcK.restrict R.TK |>.codRestrict _ fun P => R.bcK_mem_TFbar P.2) ++ AddEquiv.ofBijective (R.bcK.domRestrict R.TK |>.codRestrict _ fun P => R.bcK_mem_TFbar P.2) + ⟨fun P P' h => Subtype.ext (R.bcK_injective (congrArg Subtype.val h)), + fun Q => by + obtain ⟨P, hP⟩ := R.exists_bcK_eq Q.1 Q.2 +diff --git a/Iut/Concrete/SL2Image.lean b/Iut/Concrete/SL2Image.lean +index a58f023..6a75976 100644 +--- a/Iut/Concrete/SL2Image.lean ++++ b/Iut/Concrete/SL2Image.lean +@@ -142,7 +142,7 @@ lemma card_torsion_curveKw_ge (w' : FinitePlace ↥R.torsionField) + [Finite ↥(TateStructure.torsion ℓ (curveKw C.E R.torsionField w'))] : + ℓ * ℓ ≤ Nat.card ↥(TateStructure.torsion ℓ (curveKw C.E R.torsionField w')) := by + let f : ↥R.TK →+ ↥(TateStructure.torsion ℓ (curveKw C.E R.torsionField w')) := +- ((pointMap (curveK C.E R.torsionField) (emb R.torsionField w')).restrict R.TK).codRestrict _ ++ ((pointMap (curveK C.E R.torsionField) (emb R.torsionField w')).domRestrict R.TK).codRestrict _ + fun P => by + rw [AddSubgroup.torsionBy.nsmul_iff] + have hP := AddSubgroup.torsionBy.nsmul_iff.mp P.2 +diff --git a/Iut/Cor312/ThetaData/PlacesOver.lean b/Iut/Cor312/ThetaData/PlacesOver.lean +index 54f5d7e..b81f51c 100644 +--- a/Iut/Cor312/ThetaData/PlacesOver.lean ++++ b/Iut/Cor312/ThetaData/PlacesOver.lean +@@ -45,14 +45,16 @@ lemma algebraMap_ringOfIntegers_injective : + /-- **Every finite place of `k` has a finite place of `K` over it.** -/ + theorem FinitePlace.exists_liesOver (v : FinitePlace k) : + ∃ w : FinitePlace K, FinitePlace.LiesOver w v := by ++ have : FaithfulSMul (𝓞 k) (𝓞 K) := ++ (faithfulSMul_iff_algebraMap_injective (𝓞 k) (𝓞 K)).mpr algebraMap_ringOfIntegers_injective + haveI : v.maximalIdeal.asIdeal.IsPrime := v.maximalIdeal.isPrime + obtain ⟨Q, -, hQ, hQv⟩ := Ideal.exists_ideal_over_prime_of_isIntegral (S := 𝓞 K) + v.maximalIdeal.asIdeal ⊥ (by +- rw [Ideal.comap_bot_of_injective _ algebraMap_ringOfIntegers_injective] ++ rw [Ideal.under_bot] + exact bot_le) + have hQne : Q ≠ ⊥ := by + rintro rfl +- rw [Ideal.comap_bot_of_injective _ algebraMap_ringOfIntegers_injective] at hQv ++ rw [Ideal.under_bot] at hQv + exact v.maximalIdeal.ne_bot hQv.symm + refine ⟨FinitePlace.mk ⟨Q, hQ, hQne⟩, ?_⟩ + unfold FinitePlace.LiesOver +@@ -138,10 +140,13 @@ lemma algebraMap_intClosure_injective : + theorem exists_prime_over (w : FinitePlace K) : + ∃ Q : Ideal (intClosure K Fbar), Q.IsPrime ∧ + Q.comap (algebraMap (𝓞 K) (intClosure K Fbar)) = w.maximalIdeal.asIdeal := by ++ have : FaithfulSMul (𝓞 K) (intClosure K Fbar) := ++ (faithfulSMul_iff_algebraMap_injective (𝓞 K) (intClosure K Fbar)).mpr ++ (algebraMap_intClosure_injective K Fbar) + haveI : w.maximalIdeal.asIdeal.IsPrime := w.maximalIdeal.isPrime + obtain ⟨Q, -, hQ, hQw⟩ := Ideal.exists_ideal_over_prime_of_isIntegral + (S := intClosure K Fbar) w.maximalIdeal.asIdeal ⊥ (by +- rw [Ideal.comap_bot_of_injective _ (algebraMap_intClosure_injective K Fbar)] ++ rw [Ideal.under_bot] + exact bot_le) + exact ⟨Q, hQ, hQw⟩ + +diff --git a/Iut/Cor312/ThetaData/TateStructureTransport.lean b/Iut/Cor312/ThetaData/TateStructureTransport.lean +index 0f98d1a..904c497 100644 +--- a/Iut/Cor312/ThetaData/TateStructureTransport.lean ++++ b/Iut/Cor312/ThetaData/TateStructureTransport.lean +@@ -132,7 +132,9 @@ def baseChange (S : TateStructure E) : TateStructure (E.map (algebraMap k k')) w + (Additive.ofMul (QuotientGroup.mk (unitsEquiv hbij u))) = + Additive.ofMul (QuotientGroup.mk u) := by + rw [← quotEquiv_mk] +- exact (MulEquiv.toAdditive (quotEquiv hbij S.t)).symm_apply_apply _ ++ change Additive.ofMul ++ ((quotEquiv hbij S.t).symm ((quotEquiv hbij S.t) (QuotientGroup.mk u))) = _ ++ rw [MulEquiv.symm_apply_apply] + simp only [AddEquiv.trans_apply] + rw [h1, pointMapEquiv_apply, xCoord_pointMap, S.iso_x u hu, S.t.algebraMap_X k'] + rfl +@@ -143,7 +145,9 @@ def baseChange (S : TateStructure E) : TateStructure (E.map (algebraMap k k')) w + (Additive.ofMul (QuotientGroup.mk (unitsEquiv hbij u))) = + Additive.ofMul (QuotientGroup.mk u) := by + rw [← quotEquiv_mk] +- exact (MulEquiv.toAdditive (quotEquiv hbij S.t)).symm_apply_apply _ ++ change Additive.ofMul ++ ((quotEquiv hbij S.t).symm ((quotEquiv hbij S.t) (QuotientGroup.mk u))) = _ ++ rw [MulEquiv.symm_apply_apply] + simp only [AddEquiv.trans_apply] + rw [h1, pointMapEquiv_apply, yCoord_pointMap, S.iso_y u hu, S.t.algebraMap_Y k'] + rfl +@@ -163,7 +167,9 @@ lemma baseChange_ofUnit (u : kˣ) : + (Additive.ofMul (QuotientGroup.mk (unitsEquiv hbij u))) = + Additive.ofMul (QuotientGroup.mk u) := by + rw [← quotEquiv_mk] +- exact (MulEquiv.toAdditive (quotEquiv hbij S.t)).symm_apply_apply _ ++ change Additive.ofMul ++ ((quotEquiv hbij S.t).symm ((quotEquiv hbij S.t) (QuotientGroup.mk u))) = _ ++ rw [MulEquiv.symm_apply_apply] + simp only [AddEquiv.trans_apply] + rw [h1] + rfl +diff --git a/Iut/Torsion/EDS.lean b/Iut/Torsion/EDS.lean +index 0785677..2caf952 100644 +--- a/Iut/Torsion/EDS.lean ++++ b/Iut/Torsion/EDS.lean +@@ -33,10 +33,11 @@ namespace Iut.Torsion + + open WeierstrassCurve WeierstrassCurve.Affine Polynomial + +-open scoped Classical + + variable {F : Type*} [Field F] {W : Affine F} + ++noncomputable local instance : DecidableEq F := Classical.decEq F ++ + /-! ### The sequence `ψₙ(P)` -/ + + /-- The value `ψₙ(x, y)` of the `n`-division polynomial at `(x, y)`, as the normalised EDS with +@@ -155,7 +156,7 @@ theorem equation_iff₀ (x y : F) : + W.Equation x y ↔ y ^ 2 = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆ := by + rw [equation_iff, ha₁, ha₃]; simp + +-omit [NeZero (2 : F)] in ++omit [NeZero (2 : F)] ha₃ in + theorem addX_eq (x₁ x₂ ℓ : F) : W.addX x₁ x₂ ℓ = ℓ ^ 2 - W.a₂ - x₁ - x₂ := by + simp [addX, ha₁] + +@@ -164,7 +165,7 @@ theorem addY_eq (x₁ x₂ y₁ ℓ : F) : + W.addY x₁ x₂ y₁ ℓ = -(ℓ * ((ℓ ^ 2 - W.a₂ - x₁ - x₂) - x₁) + y₁) := by + simp [addY, negY, negAddY, addX, ha₁, ha₃] + +-omit [NeZero (2 : F)] in ++omit [NeZero (2 : F)] ha₁ ha₃ in + theorem slope_mul_of_X_ne {x₁ x₂ : F} (y₁ y₂ : F) (hx : x₁ ≠ x₂) : + W.slope x₁ x₂ y₁ y₂ * (x₁ - x₂) = y₁ - y₂ := by + rw [slope_of_X_ne hx, div_mul_cancel₀ _ (sub_ne_zero.mpr hx)] +@@ -223,6 +224,7 @@ def Good (n : ℕ) : Prop := + + variable {h} + ++omit [NeZero (2 : F)] in + theorem Good.smul_eq_zero_iff {n : ℕ} (hg : Good h n) : + n • Point.some x y h = 0 ↔ eds W x y n = 0 := by + refine ⟨fun h0 => ?_, hg.1⟩ +@@ -231,24 +233,29 @@ theorem Good.smul_eq_zero_iff {n : ℕ} (hg : Good h n) : + rw [hn] at h0 + exact Point.some_ne_zero hXY h0 + ++omit [NeZero (2 : F)] in + theorem Good.eds_ne_zero {n : ℕ} (hg : Good h n) (hn : n • Point.some x y h ≠ 0) : + eds W x y n ≠ 0 := + fun h0 => hn (hg.1 h0) + ++omit [NeZero (2 : F)] in + theorem Good.eds_eq_zero {n : ℕ} (hg : Good h n) (hn : n • Point.some x y h = 0) : + eds W x y n = 0 := + hg.smul_eq_zero_iff.mp hn + + variable (h) + ++omit [NeZero (2 : F)] in + theorem good_zero : Good h 0 := by + refine ⟨fun _ => zero_smul ℕ _, fun h0 => absurd (by simp) h0⟩ + ++omit [NeZero (2 : F)] in + theorem good_one : Good h 1 := by + refine ⟨fun h0 => absurd h0 (by simp), fun _ => ⟨x, y, h, one_smul ℕ _, by simp, by simp⟩⟩ + + include ha₁ ha₃ + ++omit [NeZero (2 : F)] in + theorem hQ_of (hXY : W.Nonsingular x y) : + y ^ 2 = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆ := + (equation_iff₀ ha₁ ha₃ x y).mp hXY.1 +@@ -267,7 +274,7 @@ theorem good_two (hy : y ≠ 0) : Good h 2 := by + have hI2 := Ident.double_X (hQ_of ha₁ ha₃ h) hμ hy + have hI3 := Ident.double_Y (hQ_of ha₁ ha₃ h) hμ hy + refine ⟨_, _, _, two_smul_eq ha₁ ha₃ h hy, ?_, ?_⟩ +- · rw [addX_eq ha₁ ha₃] ++ · rw [addX_eq ha₁] + simp only [Nat.cast_ofNat, eds_two, Int.reduceAdd, eds_three, Int.reduceSub, eds_one, + Ψ₃_eval ha₁ ha₃] + linear_combination hI2 +@@ -281,7 +288,7 @@ theorem two_smul_X (hy : y ≠ 0) : + W.addX x x (W.slope x x y y) * (2 * y) ^ 2 = x * (2 * y) ^ 2 - W.Ψ₃.eval x := by + have hμ := slope_mul_of_Y_ne ha₁ ha₃ (x₁ := x) hy + have hI2 := Ident.double_X (hQ_of ha₁ ha₃ h) hμ hy +- rw [addX_eq ha₁ ha₃, Ψ₃_eval ha₁ ha₃] ++ rw [addX_eq ha₁, Ψ₃_eval ha₁ ha₃] + linear_combination hI2 + + include h in +@@ -328,7 +335,7 @@ theorem good_three (hy : y ≠ 0) : Good h 3 := by + intro hX + apply hne + rw [← hc, hX, sub_self, zero_mul] +- have hp : W.slope X₂ x Y₂ y * (X₂ - x) = Y₂ - y := slope_mul_of_X_ne ha₁ ha₃ Y₂ y hXx ++ have hp : W.slope X₂ x Y₂ y * (X₂ - x) = Y₂ - y := slope_mul_of_X_ne Y₂ y hXx + have h3P : (3 : ℕ) • Point.some x y h = + Point.some (W.addX X₂ x (W.slope X₂ x Y₂ y)) (W.addY X₂ x Y₂ (W.slope X₂ x Y₂ y)) + (nonsingular_add h₂ h fun hxy => hXx hxy.1) := by +@@ -341,7 +348,7 @@ theorem good_three (hy : y ≠ 0) : Good h 3 := by + rw [← h2P, two_nsmul, add_neg_cancel_right] + rw [Point.neg_some, Point.add_of_X_ne hXx] at hsub + have hsubX : W.addX X₂ x (W.slope X₂ x Y₂ (W.negY x y)) = x := (Point.some.inj hsub).1 +- rw [addX_eq ha₁ ha₃] at hsubX ++ rw [addX_eq ha₁] at hsubX + have hD := Ident.chord_diff (a₂ := W.a₂) hXx hp hm + rw [hsubX] at hD + set lp := W.slope X₂ x Y₂ y with hlp +@@ -349,16 +356,16 @@ theorem good_three (hy : y ≠ 0) : Good h 3 := by + · -- the `x`-coordinate + have e4 : eds W x y (3 + 1) = W.preΨ₄.eval x * (2 * y) := by norm_num + have e2 : eds W x y (3 - 1) = 2 * y := by norm_num +- rw [Nat.cast_ofNat, eds_three, e4, e2, addX_eq ha₁ ha₃, ← hc, ← hY₂] ++ rw [Nat.cast_ofNat, eds_three, e4, e2, addX_eq ha₁, ← hc, ← hY₂] + linear_combination (-16 * y ^ 4) * hD + · -- the `y`-coordinate + have hQ₂ := hQ_of ha₁ ha₃ h₂ + have hT : Y₂ * (2 * y) = -2 * y ^ 2 - (3 * x ^ 2 + 2 * W.a₂ * x + W.a₄) * (X₂ - x) := by +- rw [hY₂def, hX₂def, addY_eq ha₁ ha₃, addX_eq ha₁ ha₃] ++ rw [hY₂def, hX₂def, addY_eq ha₁ ha₃, addX_eq ha₁] + linear_combination (-(μ ^ 2 - W.a₂ - x - x - x)) * hμ + have hD2 : X₂ * (4 * y ^ 2) = + (3 * x ^ 2 + 2 * W.a₂ * x + W.a₄) ^ 2 - 4 * y ^ 2 * (W.a₂ + 2 * x) := by +- rw [hX₂def, addX_eq ha₁ ha₃] ++ rw [hX₂def, addX_eq ha₁] + linear_combination (μ * (2 * y) + (3 * x ^ 2 + 2 * W.a₂ * x + W.a₄)) * hμ + have hG3 := Ident.three_Y (hQ_of ha₁ ha₃ h) hQ₂ hT hD2 hp hy + have hc3 : edsC W x y 3 = (2 * y) * (W.preΨ₄.eval x * (2 * y) ^ 4 - (W.Ψ₃.eval x) ^ 3) - +@@ -374,21 +381,22 @@ theorem good_three (hy : y ≠ 0) : Good h 3 := by + + /-! ### The even step -/ + +-omit ha₁ ha₃ in ++omit [NeZero (2 : F)] ha₁ ha₃ in + /-- `Good n` when `eₙ = 0` and `n • P = 0`. -/ + theorem good_of_eq_zero {n : ℕ} (h0 : eds W x y n = 0) (hn : n • Point.some x y h = 0) : + Good h n := + ⟨fun _ => hn, fun hne => absurd h0 hne⟩ + +-omit ha₁ ha₃ in ++omit [NeZero (2 : F)] ha₁ ha₃ in + theorem smul_succ (k : ℕ) : (k + 1) • Point.some x y h = k • Point.some x y h + Point.some x y h := + succ_nsmul _ _ + +-omit ha₁ ha₃ in ++omit [NeZero (2 : F)] ha₁ ha₃ in + theorem smul_pred {k : ℕ} (hk : 1 ≤ k) : + (k - 1) • Point.some x y h = k • Point.some x y h - Point.some x y h := by + conv_rhs => rw [← Nat.sub_add_cancel hk, succ_nsmul, add_sub_cancel_right] + ++omit [NeZero (2 : F)] ha₁ ha₃ in + /-- Coordinates of `Q + P` for `X ≠ x`. -/ + theorem add_eq_of_X_ne {X Y : F} (hQ : W.Nonsingular X Y) (hX : X ≠ x) : + Point.some X Y hQ + Point.some x y h = +@@ -396,6 +404,7 @@ theorem add_eq_of_X_ne {X Y : F} (hQ : W.Nonsingular X Y) (hX : X ≠ x) : + (nonsingular_add hQ h fun hxy => hX hxy.1) := + Point.add_of_X_ne hX + ++omit [NeZero (2 : F)] ha₁ ha₃ in + /-- Coordinates of `Q − P` for `X ≠ x`. -/ + theorem sub_eq_of_X_ne {X Y : F} (hQ : W.Nonsingular X Y) (hX : X ≠ x) : + Point.some X Y hQ - Point.some x y h = +@@ -404,12 +413,14 @@ theorem sub_eq_of_X_ne {X Y : F} (hQ : W.Nonsingular X Y) (hX : X ≠ x) : + (nonsingular_add hQ ((nonsingular_neg ..).mpr h) fun hxy => hX hxy.1) := by + rw [sub_eq_add_neg, Point.neg_some, Point.add_of_X_ne hX] + ++omit [NeZero (2 : F)] in + /-- The slope of the chord through `Q` and `−P`. -/ + theorem slope_neg_mul {X Y : F} (hX : X ≠ x) : + W.slope X x Y (W.negY x y) * (X - x) = Y + y := by + rw [slope_of_X_ne hX, negY_eq ha₁ ha₃, div_mul_cancel₀ _ (sub_ne_zero.mpr hX)] + ring + ++omit [NeZero (2 : F)] ha₁ ha₃ in + /-- If `Q = m • P = (X, Y)` with `(m − 1) • P ≠ 0` and `(m + 1) • P ≠ 0`, then `X ≠ x`. -/ + theorem X_ne_of_smul {m : ℕ} (hm : 1 ≤ m) {X Y : F} {hQ : W.Nonsingular X Y} + (hmP : m • Point.some x y h = Point.some X Y hQ) +@@ -507,7 +518,7 @@ theorem good_even (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) + 2 * (-(μ * ((μ ^ 2 - W.a₂ - X - X) - X) + Y)) * eds W x y (2 * m) ^ 3 = + edsC W x y (2 * m) by + refine ⟨fun h0 => absurd h0 (by rwa [hcast]), fun _ => ⟨_, _, _, h2Q, ?_, ?_⟩⟩ +- · rw [hcast, addX_eq ha₁ ha₃]; exact key.1 ++ · rw [hcast, addX_eq ha₁]; exact key.1 + · rw [hcast, addY_eq ha₁ ha₃]; exact key.2 + have hc : (x - x₂) * (2 * y) ^ 2 = W.Ψ₃.eval x := by linear_combination -hX₂ + -- abbreviations +@@ -547,7 +558,7 @@ theorem good_even (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) + rw [hsmul, hmP, hQP0, smul_neg, hn2P] + rw [h2Q] at h2Q' + obtain ⟨hxq, hyq⟩ := Point.some.inj h2Q' +- rw [addX_eq ha₁ ha₃] at hxq ++ rw [addX_eq ha₁] at hxq + rw [addY_eq ha₁ ha₃] at hyq + rw [hyq, hxq, hny₂] + -- the sequence +@@ -593,7 +604,7 @@ theorem good_even (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) + rw [hsmul, hmP, hQP, h2P] + rw [h2Q] at h2Q' + obtain ⟨hxq, hyq⟩ := Point.some.inj h2Q' +- rw [addX_eq ha₁ ha₃] at hxq ++ rw [addX_eq ha₁] at hxq + rw [addY_eq ha₁ ha₃] at hyq + rw [hyq, hxq] + rw [hem1] at r_odd1 r_odd2 r_cm +@@ -631,18 +642,18 @@ theorem good_even (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) + obtain ⟨X', Y', h', hh, -, -⟩ := g₃.2 hep + rw [hh] at h0 + exact Point.some_ne_zero h' h0 +- have hXx : X ≠ x := X_ne_of_smul ha₁ ha₃ h (by omega) hmP hmm0 hpp0 ++ have hXx : X ≠ x := X_ne_of_smul h (by omega) hmP hmm0 hpp0 + obtain ⟨Xp, Yp, hQp, hpP, hXp, hYp⟩ := g₃.2 hep + obtain ⟨Xm, Ym, hQm, hmmP, hXm, hYm⟩ := g₁.2 hem1 + have hpP' := hpP +- rw [smul_succ h, hmP, add_eq_of_X_ne ha₁ ha₃ h hQ hXx] at hpP' ++ rw [smul_succ h, hmP, add_eq_of_X_ne h hQ hXx] at hpP' + obtain ⟨hXp', hYp'⟩ := Point.some.inj hpP' + have hmmP' := hmmP +- rw [smul_pred h (by omega), hmP, sub_eq_of_X_ne ha₁ ha₃ h hQ hXx] at hmmP' ++ rw [smul_pred h (by omega), hmP, sub_eq_of_X_ne h hQ hXx] at hmmP' + obtain ⟨hXm', hYm'⟩ := Point.some.inj hmmP' +- rw [addX_eq ha₁ ha₃] at hXp' hXm' ++ rw [addX_eq ha₁] at hXp' hXm' + rw [addY_eq ha₁ ha₃] at hYp' hYm' +- have hp : W.slope X x Y y * (X - x) = Y - y := slope_mul_of_X_ne ha₁ ha₃ Y y hXx ++ have hp : W.slope X x Y y * (X - x) = Y - y := slope_mul_of_X_ne Y y hXx + have hmn : W.slope X x Y (W.negY x y) * (X - x) = Y + y := slope_neg_mul ha₁ ha₃ hXx + have hI5 := Ident.double_X_sub (hQ_of ha₁ ha₃ hQ) (hQ_of ha₁ ha₃ h) hXx hp hmn hμ hY0 + have hI6 := Ident.double_Y_mul (hQ_of ha₁ ha₃ hQ) (hQ_of ha₁ ha₃ h) hXx hp hmn hμ hY0 +@@ -801,15 +812,15 @@ theorem good_odd (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) (g₁ : Good h (m - 1)) + -- `Q − Q⁺ = −P` and `Q⁺ − Q = P` + have hsub : Point.some X Y hQ - Point.some Xp Yp hQp = -Point.some x y h := by + rw [← hmP, ← hpP, smul_succ h]; abel +- rw [sub_eq_of_X_ne ha₁ ha₃ hQp hQ hXX, Point.neg_some] at hsub ++ rw [sub_eq_of_X_ne hQp hQ hXX, Point.neg_some] at hsub + obtain ⟨hsx, -⟩ := Point.some.inj hsub + have hsub' : Point.some Xp Yp hQp - Point.some X Y hQ = Point.some x y h := by + rw [← hmP, ← hpP, smul_succ h]; abel +- rw [sub_eq_of_X_ne ha₁ ha₃ hQ hQp (Ne.symm hXX)] at hsub' ++ rw [sub_eq_of_X_ne hQ hQp (Ne.symm hXX)] at hsub' + obtain ⟨hsx', hsy'⟩ := Point.some.inj hsub' +- rw [addX_eq ha₁ ha₃] at hsx hsx' ++ rw [addX_eq ha₁] at hsx hsx' + rw [addY_eq ha₁ ha₃] at hsy' +- have hl : W.slope X Xp Y Yp * (X - Xp) = Y - Yp := slope_mul_of_X_ne ha₁ ha₃ Y Yp hXX ++ have hl : W.slope X Xp Y Yp * (X - Xp) = Y - Yp := slope_mul_of_X_ne Y Yp hXX + have hn : W.slope Xp X Yp (W.negY X Y) * (Xp - X) = Yp + Y := + slope_neg_mul ha₁ ha₃ (Ne.symm hXX) + have hn' : W.slope X Xp Y (W.negY Xp Yp) * (X - Xp) = Y + Yp := slope_neg_mul ha₁ ha₃ hXX +@@ -838,7 +849,7 @@ theorem good_odd (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) (g₁ : Good h (m - 1)) + exact sub_eq_zero.mp ((mul_eq_zero.mp this).resolve_right + (mul_ne_zero (pow_ne_zero _ hem) hep)) + refine ⟨fun h0 => absurd h0 hEp0, fun _ => ⟨_, _, _, hQQ.symm, ?_, ?_⟩⟩ +- · rw [addX_eq ha₁ ha₃, h1, h4, h3] ++ · rw [addX_eq ha₁, h1, h4, h3] + linear_combination (-E1 ^ 4 * E2 ^ 4) * hD + · rw [addY_eq ha₁ ha₃, h1] + rw [h3, h4] at r_C +@@ -852,7 +863,7 @@ theorem good_odd (hy : y ≠ 0) (m : ℕ) (hm : 2 ≤ m) (g₁ : Good h (m - 1)) + + /-! ### The `2`-torsion points and the main theorem -/ + +-omit ha₁ ha₃ in ++omit [NeZero (2 : F)] ha₁ ha₃ in + /-- The odd terms of the auxiliary sequence with `b = 0` are nonzero when `c ≠ 0`. -/ + theorem preNormEDS'_odd_ne_zero {c d : F} (hc : c ≠ 0) (k : ℕ) : + preNormEDS' (0 : F) c d (2 * k + 1) ≠ 0 := by +@@ -863,7 +874,7 @@ theorem preNormEDS'_odd_ne_zero {c d : F} (hc : c ≠ 0) (k : ℕ) : + · simpa using hc + · rw [show 2 * (j + 2) + 1 = 2 * (j + 2) + 1 from rfl, preNormEDS'_odd] + rcases Nat.even_or_odd' j with ⟨i, rfl | rfl⟩ +- · rw [if_pos (even_two_mul i), if_pos (even_two_mul i)] ++ · rw [ite_eq_left (even_two_mul i), ite_eq_left (even_two_mul i)] + have h1 := ih i (by omega) + have h2 := ih (i + 1) (by omega) + rw [show 2 * i + 1 = 2 * i + 1 from rfl] at h1 +@@ -872,7 +883,7 @@ theorem preNormEDS'_odd_ne_zero {c d : F} (hc : c ≠ 0) (k : ℕ) : + simp only [mul_zero, mul_one, zero_sub, neg_ne_zero] + exact mul_ne_zero h1 (pow_ne_zero _ h2) + · have hodd : ¬Even (2 * i + 1) := Nat.not_even_iff_odd.mpr ⟨i, rfl⟩ +- rw [if_neg hodd, if_neg hodd] ++ rw [ite_eq_right hodd, ite_eq_right hodd] + have h1 := ih (i + 1) (by omega) + have h2 := ih (i + 2) (by omega) + rw [show 2 * (i + 1) + 1 = 2 * i + 1 + 2 by ring] at h1 +@@ -883,8 +894,9 @@ theorem preNormEDS'_odd_ne_zero {c d : F} (hc : c ≠ 0) (k : ℕ) : + omit [NeZero (2 : F)] ha₁ ha₃ in + /-- The even terms of `eₙ` vanish at a `2`-torsion point. -/ + theorem eds_eq_zero_of_even (hy : y = 0) {n : ℤ} (hn : Even n) : eds W x y n = 0 := by +- rw [eds, normEDS, if_pos hn, hy]; ring ++ rw [eds, normEDS, ite_eq_left hn, hy]; ring + ++omit [NeZero (2 : F)] in + include h in + /-- `Ψ₃(x) ≠ 0` at a `2`-torsion point `(x, 0)`: `Ψ₃(x) = −f'(x)²` there. -/ + theorem Ψ₃_ne_zero_of_y_eq_zero (hy : y = 0) : W.Ψ₃.eval x ≠ 0 := by +@@ -904,15 +916,17 @@ theorem Ψ₃_ne_zero_of_y_eq_zero (hy : y = 0) : W.Ψ₃.eval x ≠ 0 := by + rw [this, ← hf, zero_pow two_ne_zero, mul_zero, zero_sub, neg_ne_zero] + exact pow_ne_zero _ hf' + ++omit [NeZero (2 : F)] in + include h in + /-- The odd terms of `eₙ` do not vanish at a `2`-torsion point. -/ + theorem eds_ne_zero_of_odd (hy : y = 0) (k : ℕ) : eds W x y (2 * k + 1) ≠ 0 := by + have hc := Ψ₃_ne_zero_of_y_eq_zero ha₁ ha₃ h hy + have hodd : ¬Even (2 * (k : ℤ) + 1) := Int.not_even_iff_odd.mpr ⟨k, rfl⟩ +- rw [eds, normEDS, if_neg hodd, mul_one, hy, mul_zero, ++ rw [eds, normEDS, ite_eq_right hodd, mul_one, hy, mul_zero, + show (2 * (k : ℤ) + 1) = ((2 * k + 1 : ℕ) : ℤ) by push_cast; ring, preNormEDS_ofNat] + simpa using preNormEDS'_odd_ne_zero hc k + ++omit [NeZero (2 : F)] in + /-- `Good n` for every `n` at a `2`-torsion point `(x, 0)`. -/ + theorem good_of_y_eq_zero (hy : y = 0) (n : ℕ) : Good h n := by + have h2P : 2 • Point.some x y h = 0 := by +@@ -922,12 +936,13 @@ theorem good_of_y_eq_zero (hy : y = 0) (n : ℕ) : Good h n := by + · refine good_of_eq_zero h (eds_eq_zero_of_even hy ⟨k, by push_cast; ring⟩) ?_ + rw [mul_nsmul, h2P, smul_zero] + · have hne := eds_ne_zero_of_odd ha₁ ha₃ h hy k +- refine ⟨fun h0 => absurd (by push_cast; exact h0) hne, fun _ => ⟨x, y, h, ?_, ?_, ?_⟩⟩ ++ refine ⟨fun h0 => absurd h0 hne, fun _ => ⟨x, y, h, ?_, ?_, ?_⟩⟩ + · rw [succ_nsmul, mul_nsmul, h2P, smul_zero, zero_add] + · have e1 : eds W x y (((2 * k + 1 : ℕ) : ℤ) + 1) = 0 := + eds_eq_zero_of_even hy ⟨k + 1, by push_cast; ring⟩ + rw [e1, zero_mul, sub_zero] +- · rw [hy, edsC, complEDS₂, if_neg (Int.not_even_iff_odd.mpr ⟨k, by push_cast; ring⟩)]; ring ++ · rw [hy, edsC, complEDS₂, ite_eq_right (Int.not_even_iff_odd.mpr ⟨k, by push_cast; ring⟩)] ++ ring + + /-- **The division polynomials describe the multiples of a point**: for every nonsingular point + `P = (x, y)` of `y² = x³ + a₂x² + a₄x + a₆` and every `n`, `eₙ = ψₙ(x, y) = 0` iff `nP = 0`, and +diff --git a/Iut/Tower/SerreBound.lean b/Iut/Tower/SerreBound.lean +index 0129e14..c0d4d87 100644 +--- a/Iut/Tower/SerreBound.lean ++++ b/Iut/Tower/SerreBound.lean +@@ -116,7 +116,7 @@ theorem exists_mem_pow_intTrace_notMem (h𝔭 : 𝔭 ≠ ⊥) (e κ : ℕ) (J : + refine Ideal.IsMaximal.eq_of_le inferInstance (Ideal.IsPrime.ne_top inferInstance) ?_ + change maximalIdeal Rₚ ≤ 𝔓ₚ.comap (algebraMap Rₚ Sₚ) + rw [← Ideal.map_le_iff_le_comap, hpSₚ] +- exact Ideal.mul_le_right.trans (Ideal.pow_le_self he) ++ exact Ideal.mul_le_left.trans (Ideal.pow_le_self he) + haveI : Finite (Rₚ ⧸ maximalIdeal Rₚ) := + Finite.of_equiv _ (IsLocalization.AtPrime.equivQuotMaximalIdeal 𝔭 Rₚ).toEquiv + -- the contraction of `𝔪^n` to `A` is `𝔭^n` +@@ -186,7 +186,7 @@ theorem exists_mem_pow_intTrace_notMem (h𝔭 : 𝔭 ≠ ⊥) (e κ : ℕ) (J : + ((Ideal.isCoprime_iff_sup_eq.mpr hJₚ').pow_left).pow_right + letI : Algebra (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) (Sₚ ⧸ Jₚ ^ (κ + 1)) := + Ideal.Quotient.algebraQuotientOfLEComap +- (by rw [← Ideal.map_le_iff_le_comap, hprod]; exact Ideal.mul_le_left) ++ (by rw [← Ideal.map_le_iff_le_comap, hprod]; exact Ideal.mul_le_right) + haveI : IsScalarTower Rₚ (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) (Sₚ ⧸ Jₚ ^ (κ + 1)) := + IsScalarTower.of_algebraMap_eq' rfl + haveI : IsScalarTower Rₚ (Rₚ ⧸ maximalIdeal Rₚ ^ (κ + 1)) +diff --git a/Iut/Tower/SerreCore.lean b/Iut/Tower/SerreCore.lean +index 3d2a13f..ff3447b 100644 +--- a/Iut/Tower/SerreCore.lean ++++ b/Iut/Tower/SerreCore.lean +@@ -37,7 +37,7 @@ variable (e κ : ℕ) (J : Ideal B) + lemma pow_le_comap (hpB : 𝔭.map (algebraMap A B) = 𝔓 ^ e * J) : + 𝔭 ^ (κ + 1) ≤ (𝔓 ^ (e * (κ + 1))).comap (algebraMap A B) := by + rw [← Ideal.map_le_iff_le_comap, Ideal.map_pow, hpB, mul_pow, ← pow_mul] +- exact Ideal.mul_le_right ++ exact Ideal.mul_le_left + + /-- The `A/𝔭^{κ+1}`-algebra structure of `B/𝔓^{e(κ+1)}`. -/ + noncomputable def quotAlgebra (hpB : 𝔭.map (algebraMap A B) = 𝔓 ^ e * J) : +@@ -170,7 +170,7 @@ lemma exists_monic_root (he : e ≠ 0) (h𝔓 : 𝔓 ≠ ⊥) : + exact (hmemI _).mp hαa₀ + refine ⟨g, α, hgm, hgdeg.trans hg₀deg, hαg, fun y => ?_⟩ + have hy : y ∈ Algebra.adjoin (A ⧸ 𝔭) ({a₁} : Set (B ⧸ 𝔓)) := by +- rw [← IntermediateField.adjoin_simple_toSubalgebra_of_integral hint, ha₁] ++ rw [← IntermediateField.adjoin_simple_toSubalgebra_of_isAlgebraic hint.isAlgebraic, ha₁] + exact trivial + rw [Algebra.adjoin_singleton_eq_range_aeval] at hy + obtain ⟨q', hq'⟩ := hy +diff --git a/Iut/Tripod/Basic.lean b/Iut/Tripod/Basic.lean +index e7dc78f..4ab670d 100644 +--- a/Iut/Tripod/Basic.lean ++++ b/Iut/Tripod/Basic.lean +@@ -404,9 +404,9 @@ theorem finite_of_fieldOf_eq (F : IntermediateField ℚ Qbar) [FiniteDimensional + (fun x : Pt ↦ x.1) ⁻¹' (Subtype.val '' {y : F | Height.logHeight₁ y ≤ + max H 0 * Module.finrank ℚ F}) := by + rintro ⟨l, hl⟩ ⟨hFl, hH⟩ +- simp only [Set.mem_preimage, Set.mem_image, Set.mem_setOf_eq] + subst hFl + refine ⟨gen l, ?_, rfl⟩ ++ change Height.logHeight₁ (gen ((⟨l, hl⟩ : Pt) : Qbar)) ≤ _ + rw [← deg_mul_htCan ⟨l, hl⟩, ← deg_eq_finrank, mul_comm] + exact mul_le_mul_of_nonneg_right (hH.trans (le_max_left _ _)) (Nat.cast_nonneg _) + refine ((hF.image Subtype.val).preimage ?_).subset himg +diff --git a/Iut/Tripod/CyclicIsogeny.lean b/Iut/Tripod/CyclicIsogeny.lean +index cc96d31..9b14036 100644 +--- a/Iut/Tripod/CyclicIsogeny.lean ++++ b/Iut/Tripod/CyclicIsogeny.lean +@@ -556,7 +556,8 @@ lemma apply_genC_eq_one {v : FinitePlace (P.curve x).F} (hv : v ∉ (P.curve x). + /-- `|n|_v ≤ 1` at a finite place. -/ + lemma apply_natCast_le_one {T : Type*} [Field T] [NumberField T] (v : FinitePlace T) (n : ℕ) : + v (n : T) ≤ 1 := +- IsNonarchimedean.apply_natCast_le_one (f := v) (fun a b => FinitePlace.add_le v a b) ++ IsNonarchimedean.apply_natCast_le_one (f := v) (by simp) (by simp) ++ (fun a b => FinitePlace.add_le v a b) + + /-- `max(1, a)^d = max(1, a^d)` for `a ≥ 0`. -/ + lemma max_one_pow {a : ℝ} (ha : 0 ≤ a) (d : ℕ) : max 1 a ^ d = max 1 (a ^ d) := by +diff --git a/Iut/Tripod/CyclicLocal.lean b/Iut/Tripod/CyclicLocal.lean +index 52c4ce3..e876e7a 100644 +--- a/Iut/Tripod/CyclicLocal.lean ++++ b/Iut/Tripod/CyclicLocal.lean +@@ -349,6 +349,13 @@ variable {C : EllipticCurveData.{u}} {ℓ : ℕ} (R : C.ModEllRepData ℓ) + attribute [local instance 1100] Iut.EllipticCurveData.ModEllRepData.instDecidableEqTorsionFieldR + attribute [local instance] Iut.instGalRingOfIntegersAction Iut.instGalRingOfIntegersGaloisGroup + ++noncomputable local instance instTorsionFieldIdealAction : ++ MulAction (↥R.torsionField ≃ₐ[C.F] ↥R.torsionField) (Ideal (𝓞 ↥R.torsionField)) := by ++ letI : MulSemiringAction (↥R.torsionField ≃ₐ[C.F] ↥R.torsionField) (𝓞 ↥R.torsionField) := ++ Iut.instGalRingOfIntegersAction (k := C.F) (K := ↥R.torsionField) ++ exact (Ideal.pointwiseDistribMulAction : DistribMulAction ++ (↥R.torsionField ≃ₐ[C.F] ↥R.torsionField) (Ideal (𝓞 ↥R.torsionField))).toMulAction ++ + lemma graphLineAt_congrR {VBad : Set (FinitePlace ↥(fieldOfModuli C.F C.E))} + (TF : TateFamily C.E R.torsionField ℓ VBad) {w w' : FinitePlace ↥R.torsionField} (h : w = w') + (hw : IsBadPlace C.E R.torsionField VBad w) (hw' : IsBadPlace C.E R.torsionField VBad w') : +diff --git a/Iut/Tripod/CyclicTate.lean b/Iut/Tripod/CyclicTate.lean +index d899299..b1427c5 100644 +--- a/Iut/Tripod/CyclicTate.lean ++++ b/Iut/Tripod/CyclicTate.lean +@@ -132,7 +132,7 @@ theorem ratio_bound {ℓ : ℕ} (hℓ : Odd ℓ) (hcard : Fintype.card H = ℓ) + have hτ' : τ = -1 := Units.ext (by rw [hτ1]; simp) + have hρ' := half_class_minus_one S hRTm (hτ' ▸ hτ) hρ hρlo hρhi + rw [hr] +- refine Finset.prod_le_one (fun _ _ => by positivity) fun Q hQ => ?_ ++ refine Finset.prod_le_one₀ (fun _ _ => by positivity) fun Q hQ => ?_ + obtain ⟨hnum, hden⟩ := minus_one_bounds S.t h2 hρ' hℓ (hζℓ Q hQ) (hζ1 Q hQ) + rw [hτ'] + exact div_le_one_of_le₀ (hnum.trans hden) (norm_nonneg _) +@@ -142,7 +142,7 @@ theorem ratio_bound {ℓ : ℕ} (hℓ : Odd ℓ) (hcard : Fintype.card H = ℓ) + have hρ' := half_class_node S hRTm hτ hρ hτn hρlo hρhi + have hℓ0 : ℓ ≠ 0 := by rintro rfl; exact Nat.not_odd_zero hℓ + rw [hr, ← Finset.prod_pow, ← hcardnz, ← Finset.prod_const] +- refine Finset.prod_le_prod (fun _ _ => by positivity) fun Q hQ => ?_ ++ refine Finset.prod_le_prod₀ (fun _ _ => by positivity) fun Q hQ => ?_ + have hζn : ‖((ζ Q : kˣ) : k)‖ = 1 := by + have h := congrArg (fun u : kˣ => ‖(u : k)‖) (hζℓ Q hQ) + simp only [Units.val_pow_eq_pow_val, norm_pow, Units.val_one, norm_one] at h +diff --git a/Iut/Tripod/CyclicTorsion.lean b/Iut/Tripod/CyclicTorsion.lean +index 3d5a9fe..2b08938 100644 +--- a/Iut/Tripod/CyclicTorsion.lean ++++ b/Iut/Tripod/CyclicTorsion.lean +@@ -159,7 +159,7 @@ lemma mem_TKR_of_bcKR {P : (curveK C.E R.torsionField).toAffine.Point} + + /-- **The ℓ-torsion is rational over `K`**: `E(K)[ℓ] ≃ E(F̄)[ℓ]`. -/ + noncomputable def torsionEquivR : ↥R.TKR ≃+ ↥R.TFbarR := +- AddEquiv.ofBijective (R.bcKR.restrict R.TKR |>.codRestrict _ fun P => R.bcKR_mem_TFbarR P.2) ++ AddEquiv.ofBijective (R.bcKR.domRestrict R.TKR |>.codRestrict _ fun P => R.bcKR_mem_TFbarR P.2) + ⟨fun P P' h => Subtype.ext (R.bcKR_injective (congrArg Subtype.val h)), + fun Q => by + obtain ⟨P, hP⟩ := R.exists_bcKR_eq Q.1 Q.2 +diff --git a/Iut/Tripod/TorsionDegree.lean b/Iut/Tripod/TorsionDegree.lean +index 144d0f8..76a6b68 100644 +--- a/Iut/Tripod/TorsionDegree.lean ++++ b/Iut/Tripod/TorsionDegree.lean +@@ -75,7 +75,7 @@ theorem galAct_torsionBy (σ : Qbar ≃ₐ[K] Qbar) {n : ℕ} {P : (legendre l). + noncomputable def galTorsion (n : ℕ) (σ : Qbar ≃ₐ[K] Qbar) : + AddSubgroup.torsionBy (legendre l).toAffine.Point n →+ + AddSubgroup.torsionBy (legendre l).toAffine.Point n := +- ((galAct K hl σ).restrict (AddSubgroup.torsionBy (legendre l).toAffine.Point n)).codRestrict ++ ((galAct K hl σ).domRestrict (AddSubgroup.torsionBy (legendre l).toAffine.Point n)).codRestrict + (AddSubgroup.torsionBy (legendre l).toAffine.Point n) + (fun P => galAct_torsionBy K hl σ P.2) + +diff --git a/Iut/Tripod/TorsionNewton.lean b/Iut/Tripod/TorsionNewton.lean +index 9f2147f..103302e 100644 +--- a/Iut/Tripod/TorsionNewton.lean ++++ b/Iut/Tripod/TorsionNewton.lean +@@ -78,7 +78,8 @@ theorem apply_x_le {W : Affine K} (ha₁ : W.a₁ = 0) (ha₃ : W.a₃ = 0) (h + have h₃ : w W.a₃ ≤ 1 := by rw [ha₃, map_zero]; exact zero_le_one + have hroot : (W.ΨSq n).eval x = 0 := (Iut.Torsion.smul_eq_zero_iff_ΨSq ha₁ ha₃ h n).mp hP + have hn1 : (1 : ℝ) ≥ w (n : K) := +- IsNonarchimedean.apply_natCast_le_one (f := w) (fun a b => FinitePlace.add_le w a b) ++ IsNonarchimedean.apply_natCast_le_one (f := w) (map_zero_le w 1) (map_one w) ++ (fun a b => FinitePlace.add_le w a b) + by_cases hx : w x ≤ 1 + · exact mul_le_one₀ (pow_le_one₀ (n := 2) (apply_nonneg w _) hn1) (apply_nonneg w x) hx + rw [not_le] at hx +diff --git a/Iut/Tripod/TpdGalois.lean b/Iut/Tripod/TpdGalois.lean +index 2b4637c..ad28667 100644 +--- a/Iut/Tripod/TpdGalois.lean ++++ b/Iut/Tripod/TpdGalois.lean +@@ -168,11 +168,11 @@ noncomputable def tpdEquivAdjoinMod : + ↥(tpdC x h3 h5) ≃ₐ[modC x h3 h5] ↥((modC x h3 h5)⟮genC x h3 h5⟯) where + toFun t := ⟨t.1, (mem_adjoin_modC_iff x h3 h5 _).mpr ((mem_tpdC_iff x h3 h5 _).mp t.2)⟩ + invFun s := ⟨s.1, (mem_tpdC_iff x h3 h5 _).mpr ((mem_adjoin_modC_iff x h3 h5 _).mp s.2)⟩ +- left_inv _ := rfl +- right_inv _ := rfl +- map_mul' _ _ := rfl +- map_add' _ _ := rfl +- commutes' _ := rfl ++ left_inv _ := Subtype.ext rfl ++ right_inv _ := Subtype.ext rfl ++ map_mul' _ _ := Subtype.ext rfl ++ map_add' _ _ := Subtype.ext rfl ++ commutes' _ := Subtype.ext rfl + + /-- The sextic splits over `F_λ`. -/ + theorem sext_map_splits : +diff --git a/Iut/Tripod/TpdInertia.lean b/Iut/Tripod/TpdInertia.lean +index 78240c5..775a3dc 100644 +--- a/Iut/Tripod/TpdInertia.lean ++++ b/Iut/Tripod/TpdInertia.lean +@@ -131,7 +131,7 @@ theorem card_inertia_le_two_mul (w : FinitePlace (P.curve x).F) (f : (P.curve x) + 2 * Nat.card (inertiaPlus P x w) := by + haveI : IsGalois (tpd P x) (P.curve x).F := isGalois_tpd_curve' (P := P) (x := x) + set I := w.maximalIdeal.asIdeal.inertia ((P.curve x).F ≃ₐ[tpd P x] (P.curve x).F) with hI +- set ε := (signHom f hf hf0).restrict I with hε ++ set ε := (signHom f hf hf0).domRestrict I with hε + have h1 := Subgroup.card_mul_index ε.ker + have hidx : ε.ker.index ≤ 2 := by + rw [Subgroup.index_ker] +@@ -199,8 +199,8 @@ theorem card_inertiaPlus_le (w : FinitePlace (P.curve x).F) (h2 : residueChar w + haveI : Fact (Nat.Prime 5) := ⟨by norm_num⟩ + have hsub3 := torsionCoords_three_subset_fieldOf' x.1 + have hsub5 := torsionCoords_five_subset_fieldOf' x.1 +- set ρ₃ := (repF P x 3 hsub3).restrict (inertiaPlus P x w) with hρ₃ +- set ρ₅ := (repF P x 5 hsub5).restrict (inertiaPlus P x w) with hρ₅ ++ set ρ₃ := (repF P x 3 hsub3).domRestrict (inertiaPlus P x w) with hρ₃ ++ set ρ₅ := (repF P x 5 hsub5).domRestrict (inertiaPlus P x w) with hρ₅ + have hn3 : w.maximalIdeal.valuation _ ((3 : ℕ) : (P.curve x).F) = 1 := + (valuation_natCast_eq_one_iff w Nat.prime_three).2 h3 + have hn5 : w.maximalIdeal.valuation _ ((5 : ℕ) : (P.curve x).F) = 1 := +@@ -246,7 +246,7 @@ theorem card_inertiaPlus_le (w : FinitePlace (P.curve x).F) (h2 : residueChar w + card_le_of_forall_pow_eq_one ρ₃.range 3 16 hGL3 (by norm_num) fun τ hτ => by + obtain ⟨σ, rfl⟩ := hτ + exact hpow3 σ +- set ρ₅' := ρ₅.restrict ρ₃.ker with hρ₅' ++ set ρ₅' := ρ₅.domRestrict ρ₃.ker with hρ₅' + have hinj' : Function.Injective ρ₅' := by + intro σ τ h + have h' : ρ₅ σ.1 = ρ₅ τ.1 := h +diff --git a/Iut/Tripod/TpdTorsionRep.lean b/Iut/Tripod/TpdTorsionRep.lean +index 5b03838..bb36be0 100644 +--- a/Iut/Tripod/TpdTorsionRep.lean ++++ b/Iut/Tripod/TpdTorsionRep.lean +@@ -101,7 +101,7 @@ lemma toQbar_mem_torsionBy {R : (EF).Point} (hR : R ∈ AddSubgroup.torsionBy (E + noncomputable def torsionEquivF : + ↥(AddSubgroup.torsionBy (EF).Point n) ≃+ + ↥(AddSubgroup.torsionBy (legendre x.1).toAffine.Point n) := +- AddEquiv.ofBijective ((toQbar P x).restrict (AddSubgroup.torsionBy (EF).Point n) |>.codRestrict ++ AddEquiv.ofBijective ((toQbar P x).domRestrict (AddSubgroup.torsionBy (EF).Point n) |>.codRestrict + _ fun R => toQbar_mem_torsionBy P x n R.2) + ⟨fun R R' h => Subtype.ext (toQbar_injective P x (congrArg Subtype.val h)), + fun Q => by +@@ -145,7 +145,7 @@ lemma galF_mem_torsionBy (σ : (P.curve x).F ≃ₐ[tpd P x] (P.curve x).F) {R : + /-- The action on the `n`-torsion. -/ + noncomputable def galTorsionF (σ : (P.curve x).F ≃ₐ[tpd P x] (P.curve x).F) : + ↥(AddSubgroup.torsionBy (EF).Point n) →+ ↥(AddSubgroup.torsionBy (EF).Point n) := +- (galF P x σ).restrict _ |>.codRestrict _ fun R => galF_mem_torsionBy P x n σ R.2 ++ (galF P x σ).domRestrict _ |>.codRestrict _ fun R => galF_mem_torsionBy P x n σ R.2 + + omit [Fact n.Prime] hsub in + @[simp] lemma coe_galTorsionF (σ : (P.curve x).F ≃ₐ[tpd P x] (P.curve x).F) +diff --git a/lake-manifest.json b/lake-manifest.json +index c7312cb..819e49e 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,9 +1,7 @@ +-{ +- "version": "1.2.0", ++{"version": "1.2.0", + "packagesDir": ".lake/packages", +- "packages": [ +- { +- "url": "https://github.com/lana-agents/tempered-fundamental-groups", ++ "packages": ++ [{"url": "https://github.com/lana-agents/tempered-fundamental-groups.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -12,10 +10,8 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "2006651f52b70ea2fe3388238c7d9db14d21748f", + "inherited": false, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/lana-agents/oka.git", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/oka.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -24,10 +20,8 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", + "inherited": false, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/lana-agents/orbicurve-cores", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/orbicurve-cores.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -36,10 +30,8 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "61616dcd77fbe45c083a8ebfa7cc80728f86e841", + "inherited": false, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/lana-agents/pi1", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/pi1.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -48,10 +40,8 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "ca7def953193f861a462aa0831eec8f0a31ff69f", + "inherited": false, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/lana-agents/heights", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/heights.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -60,10 +50,8 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", + "inherited": false, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/lana-agents/genl", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/genl.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -72,10 +60,8 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "ea2846c877d1e16d8f0b911a5fed07f5ee69eaaf", + "inherited": false, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/lana-agents/tate-curves-theta", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/tate-curves-theta.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -84,22 +70,18 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "ca6c2279d3cea0690cdb01328e727118d5485d68", + "inherited": false, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/leanprover-community/mathlib4", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, +- "configFile": "lakefile.lean" +- }, +- { +- "url": "https://github.com/lana-agents/elliptic-curves", ++ "configFile": "lakefile.lean"}, ++ {"url": "https://github.com/lana-agents/elliptic-curves.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -108,10 +90,8 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "bebec3fc9f2602e81c83e5236789572a541c85fb", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/lana-agents/belyi.git", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/belyi.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -120,10 +100,8 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/lana-agents/formal-schemes", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/formal-schemes.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -132,106 +110,87 @@ + "manifestFile": "lake-manifest.json", + "inputRev": "51aa935079537bf4dc580751a6e70727fb23ca93", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/leanprover-community/plausible", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/leanprover-community/LeanSearchClient", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/leanprover-community/LeanSearchClient", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/leanprover-community/import-graph", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/leanprover-community/import-graph", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/leanprover-community/ProofWidgets4", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/leanprover-community/ProofWidgets4", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.lean" +- }, +- { +- "url": "https://github.com/leanprover-community/aesop", ++ "configFile": "lakefile.lean"}, ++ {"url": "https://github.com/leanprover-community/aesop", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/leanprover-community/quote4", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/leanprover-community/quote4", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/leanprover-community/batteries", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/leanprover-community/batteries", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, +- "configFile": "lakefile.toml" +- }, +- { +- "url": "https://github.com/leanprover/lean4-cli", ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, +- "configFile": "lakefile.toml" +- } +- ], ++ "configFile": "lakefile.toml"}], + "name": "iut", + "lakeDir": ".lake", +- "fixedToolchain": false +-} +\ No newline at end of file ++ "fixedToolchain": false} +diff --git a/lakefile.toml b/lakefile.toml +index 46c5aaa..fee9e14 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,6 +4,8 @@ keywords = ["math"] + defaultTargets = ["Iut", "Iut4Sec1", "Challenge", "Solution"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true +@@ -12,14 +14,14 @@ warn.sorry = false # `sorry` is load-bearing in Comparator/Challenge.lean + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + # Tate q-parameters and the classical theta function (taxis #13/#37); consumed by + # the initial Θ-data and Corollary 3.12 variant strand (taxis #33). + [[require]] + name = "tate-curves-theta" +-git = "https://github.com/lana-agents/tate-curves-theta" ++git = "https://github.com/lana-agents/tate-curves-theta.git" + rev = "ca6c2279d3cea0690cdb01328e727118d5485d68" + + # Arithmetic elliptic curves in general position (taxis #2): the height formalism and +@@ -28,7 +30,7 @@ rev = "ca6c2279d3cea0690cdb01328e727118d5485d68" + # curves over number fields and its proof package (Genl.Curves, branch wp-height-theory). + [[require]] + name = "genl" +-git = "https://github.com/lana-agents/genl" ++git = "https://github.com/lana-agents/genl.git" + rev = "ea2846c877d1e16d8f0b911a5fed07f5ee69eaaf" + + # Heights and elliptic-curve height estimates (taxis #32): the complex uniformization of +@@ -36,7 +38,7 @@ rev = "ea2846c877d1e16d8f0b911a5fed07f5ee69eaaf" + # also the height machine on curves used by Genl.Curves (branch wp-integrate). + [[require]] + name = "heights" +-git = "https://github.com/lana-agents/heights" ++git = "https://github.com/lana-agents/heights.git" + rev = "721496ca4c158e511d25d8ccf6bfe8503eda73c1" + + # Étale fundamental groups (Galois-theoretic π₁, inertia) and cores of orbicurves +@@ -45,18 +47,17 @@ rev = "721496ca4c158e511d25d8ccf6bfe8503eda73c1" + # branch wp-core-basechange). + [[require]] + name = "pi1" +-git = "https://github.com/lana-agents/pi1" ++git = "https://github.com/lana-agents/pi1.git" + rev = "ca7def953193f861a462aa0831eec8f0a31ff69f" + + # [CanLift], Prop. 2.7 over ℂ (`OrbicurveCores.U2.canLift27C`, branch wp-u2), which together + # with `AffOrbicurve.canLift27_of_complex` discharges `AffOrbicurve.CanLift27`. + [[require]] + name = "orbicurve-cores" +-git = "https://github.com/lana-agents/orbicurve-cores" ++git = "https://github.com/lana-agents/orbicurve-cores.git" + rev = "61616dcd77fbe45c083a8ebfa7cc80728f86e841" + +-# Pinned directly so that one `oka` revision serves both `belyi` (which pins the ancestor +-# da228a2) and `orbicurve-cores` (which pins this revision, branch wp-u2). ++# One `oka` revision serves both `belyi` and `orbicurve-cores` (branch wp-u2). + [[require]] + name = "oka" + git = "https://github.com/lana-agents/oka.git" +@@ -66,7 +67,7 @@ rev = "75dcdc3faadd10b986afb9283e89902bcdddecd4" + # `Iut.Anabelian.TemperedPi1Theory` in `Iut/Anabelian/Tempered.lean`. + [[require]] + name = "tempered-fundamental-groups" +-git = "https://github.com/lana-agents/tempered-fundamental-groups" ++git = "https://github.com/lana-agents/tempered-fundamental-groups.git" + rev = "2006651f52b70ea2fe3388238c7d9db14d21748f" + + # Corollary 3.12 variant (IUT III) and the ABC target statement. +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f49..ba8ebf2 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/oka-lean4341.patch b/lean/patches/oka-lean4341.patch index b20f36aa681fc69e87757b3eca8976da4eb28b23..f397a61a148d22802ef59c2722aad8fdfad23f26 100644 --- a/lean/patches/oka-lean4341.patch +++ b/lean/patches/oka-lean4341.patch @@ -1,2014 +1,2014 @@ -diff --git a/Oka/Algebra/Category/ModuleCat/Presheaf/PullbackStalk.lean b/Oka/Algebra/Category/ModuleCat/Presheaf/PullbackStalk.lean -index 470291bb7f5683f53077d88b015bb1242d86c7bb..480b1ff77217a7f6a59a354985edfd5dbdcb259f 100644 ---- a/Oka/Algebra/Category/ModuleCat/Presheaf/PullbackStalk.lean -+++ b/Oka/Algebra/Category/ModuleCat/Presheaf/PullbackStalk.lean -@@ -100,7 +100,6 @@ lemma ringStalkMap_germ (V : Opens Y) (hx : f x ∈ V) (s : S.obj (op V)) : - ((TopCat.Presheaf.stalkFunctor CommRingCat.{u} (f x)).map φ (S.germ V (f x) hx s)) = _ - rw [TopCat.Presheaf.stalkFunctor_map_germ_apply (C := CommRingCat.{u}) V (f x) hx φ s] - erw [TopCat.Presheaf.stalkPushforward_germ_apply] -- rfl - - /-- The morphism of presheaves of rings, at the `RingCat` spelling `pushforward` consumes. -/ - abbrev forgetRingHom : -diff --git a/Oka/Algebra/Category/ModuleCat/Presheaf/Submodule.lean b/Oka/Algebra/Category/ModuleCat/Presheaf/Submodule.lean -index ef73b01ddcad6f17fd86f665bb9b06acc2eb7b1e..bbd9cacb14234680212985f990aeae24fc441313 100644 ---- a/Oka/Algebra/Category/ModuleCat/Presheaf/Submodule.lean -+++ b/Oka/Algebra/Category/ModuleCat/Presheaf/Submodule.lean -@@ -11,10 +11,8 @@ public import Mathlib.CategoryTheory.Subfunctor.Basic - /-! - # A submodule of a presheaf of modules, as a subfunctor of the underlying presheaf of types - --Material for `Mathlib/Algebra/Category/ModuleCat/Presheaf/Submodule.lean`; see `README.md` on the --mirror tree. That file does not currently import `Mathlib.CategoryTheory.Subfunctor.Basic`, which --the definition below names, so upstreaming it adds that import — **one** file to the target's own --transitive closure, measured rather than estimated. -+Mathlib now provides the declarations described here with the same signatures and definitions. -+This module preserves the Oka import path while re-exporting the Mathlib implementation. - - `PresheafOfModules.Submodule` is a submodule of `M.obj X` for each object `X`, closed under the - restriction maps. `PresheafOfModules.Submodule.toSubfunctor` forgets the module structure and -@@ -32,32 +30,3 @@ it has content. - - - `PresheafOfModules.Submodule.toSubfunctor` - -/ -- --@[expose] public section -- --universe v v₁ u₁ u -- --open CategoryTheory -- --namespace PresheafOfModules -- --variable {C : Type u₁} [Category.{v₁} C] {R : Cᵒᵖ ⥤ RingCat.{u}} -- --namespace Submodule -- --variable {M : PresheafOfModules.{v} R} (N : M.Submodule) -- --/-- The subfunctor of the underlying type-valued presheaf of `M` induced by a submodule `N`. -/ --def toSubfunctor : Subfunctor (M.presheaf ⋙ CategoryTheory.forget AddCommGrpCat.{v}) where -- obj X := {r : M.obj X | r ∈ N.obj X} -- map := fun {_ _} f _ hr ↦ N.map_mem f hr -- --/-- Membership in the subfunctor is membership in the submodule. This is `Iff.rfl`; see the --module docstring for why it is a `simp` lemma. -/ --@[simp] --lemma mem_toSubfunctor_obj {X : Cᵒᵖ} (r : M.obj X) : -- r ∈ N.toSubfunctor.obj X ↔ r ∈ N.obj X := Iff.rfl -- --end Submodule -- --end PresheafOfModules -diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/Annihilator.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/Annihilator.lean -index 5ba4d73f420e77a1d1f58f55892f9b80a3475901..633cee2c72818e73eb15f03d549ab4d5fd4b2d6d 100644 ---- a/Oka/Algebra/Category/ModuleCat/Sheaf/Annihilator.lean -+++ b/Oka/Algebra/Category/ModuleCat/Sheaf/Annihilator.lean -@@ -48,6 +48,7 @@ noncomputable def annihilator : (unit R).Submodule where - (Module.annihilator (R.obj Y) (M.obj Y)).comap (R.map f).hom - map {X Y} f := by - intro r hr -+ change R.obj X at r - rw [Submodule.mem_comap, restrictₛₗ_apply] - -- characterise membership in the defining `iInf` at the honest type `R.obj _` - have mem : ∀ {W : Cᵒᵖ} (s : R.obj W), -@@ -115,6 +116,7 @@ noncomputable def annihilator : (SheafOfModules.unit R).Submodule where - (isSheaf_iff_isSheaf_of_type J _).mp - (GrothendieckTopology.HasSheafCompose.isSheaf _ M.isSheaf) - intro X s hmem -+ change R.obj.obj X at s - refine (mem_annihilator s).mpr fun W φ m ↦ ?_ - -- It suffices, by separatedness, that every restriction of `R.map φ s • m` vanishes. - apply (hsep _ (J.pullback_stable φ.unop hmem)).isSeparatedFor.ext -diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Equivalence.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Equivalence.lean -index 33ffcac6dc3e20b079b039ba0814a3838c01efbc..2f4c90a80b2de7ed24accc9f6fd437aeeb84f98f 100644 ---- a/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Equivalence.lean -+++ b/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Equivalence.lean -@@ -145,7 +145,7 @@ lemma symm_H₁ : - rw [← Functor.map_comp, ← op_comp, Iso.inv_hom_id_app, op_id, - CategoryTheory.Functor.map_id] - have h' := h =≫ S.obj.map (eqv.unitInv.app X.unop).op -- rw [Category.assoc, Category.assoc] at h' -+ erw [Category.assoc, Category.assoc] at h' - erw [e] at h' - erw [Category.comp_id, Category.id_comp] at h' - exact h'.symm -@@ -164,7 +164,7 @@ lemma symm_H₂ : - 𝟙 _ := by - rw [← Functor.map_comp, ← op_comp, Iso.inv_hom_id_app, op_id, - CategoryTheory.Functor.map_id] -- rw [← Category.assoc, ← h] -+ erw [← Category.assoc, ← h] - exact e - - variable [HasPullbacks C] [HasPullbacks D] -diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Presentation.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Presentation.lean -index df229ae96f1a84b77a00a89fa12d4751fc21d93e..f78b8e026223edb5287b08645aa0ff5feaefd63c 100644 ---- a/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Presentation.lean -+++ b/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Presentation.lean -@@ -83,8 +83,12 @@ restriction preserves kernels (`SheafOfModules.overKernelIso`). Stated because i - generators of the relations *over `Y`* be read as relations of the restricted generators, which - is the whole of `SheafOfModules.GeneratingSections.presentationOver`. -/ - noncomputable def GeneratingSections.overKernelπIso (G : N.GeneratingSections) (Y : C) : -- (kernel G.π).over Y ≅ kernel ((G.map (overFunctor R Y) (Iso.refl _)).π) := -- overKernelIso G.π Y ≪≫ (kernelIsIsoComp _ _).symm ≪≫ -+ (kernel G.π).over Y ≅ kernel ((G.map (overFunctor R Y) (Iso.refl _)).π) := by -+ let e : free (R := R.over Y) G.I ≅ (overFunctor R Y).obj (free (R := R) G.I) := -+ mapFreeIso (overFunctor R Y) G.I (Iso.refl _) -+ have : IsIso e.hom := e.isIso_hom -+ exact overKernelIso G.π Y ≪≫ -+ (kernelIsIsoComp e.hom ((overFunctor R Y).map G.π)).symm ≪≫ - (kernelIsoOfEq (G.map_π_eq (overFunctor R Y) (Iso.refl _))).symm - - /-- **Generators of `N`, together with generators of their relations over `Y`, present -@@ -102,7 +106,7 @@ noncomputable def GeneratingSections.presentationOver (G : N.GeneratingSections) - instance GeneratingSections.isFinite_presentationOver (G : N.GeneratingSections) [G.IsFiniteType] - (Y : C) (H : ((kernel G.π).over Y).GeneratingSections) [H.IsFiniteType] : - (G.presentationOver Y H).IsFinite where -- isFiniteType_generators := inferInstanceAs (G.map (overFunctor R Y) (Iso.refl _)).IsFiniteType -+ isFiniteType_generators := ⟨inferInstanceAs (Finite G.I)⟩ - isFiniteType_relations := inferInstanceAs (H.ofEpi (G.overKernelπIso Y).hom).IsFiniteType - - /-- **Generators of `N` and a covering on which their relations are generated give quasicoherent -diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/PushforwardContinuous.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/PushforwardContinuous.lean -index 6524079cc07ddc7880524860d4e5c35bf7be03a0..cdf79485d4ab61e66b2d0f4fef4cf0cf2131f739 100644 ---- a/Oka/Algebra/Category/ModuleCat/Sheaf/PushforwardContinuous.lean -+++ b/Oka/Algebra/Category/ModuleCat/Sheaf/PushforwardContinuous.lean -@@ -167,8 +167,14 @@ section - variable {C : Type u} [SmallCategory C] {J : GrothendieckTopology C} {R : Sheaf J RingCat.{u}} - [HasWeakSheafify J AddCommGrpCat.{u}] [J.WEqualsLocallyBijective AddCommGrpCat.{u}] - --instance (X : C) : (overFunctor.{u} R X).IsRightAdjoint := -- inferInstanceAs (pushforward.{u} (𝟙 (R.over X))).IsRightAdjoint -+instance (X : C) : (overFunctor.{u} R X).IsRightAdjoint := by -+ let φ : R.over X ⟶ -+ ((Over.forget X).sheafPushforwardContinuous RingCat.{u} (J.over X) J).obj R := 𝟙 _ -+ let : (PresheafOfModules.pushforward.{u} φ.hom).IsRightAdjoint := -+ CategoryTheory.Functor.isRightAdjoint_of_leftAdjointObjIsDefined_eq_top -+ (PresheafOfModules.pullbackObjIsDefined_eq_top -+ (F := Over.forget X) (R := R.obj) φ.hom) -+ exact (PullbackConstruction.adjunction.{u} φ).isRightAdjoint - - variable [HasSheafify J AddCommGrpCat.{u}] [∀ (X : C), HasSheafify (J.over X) AddCommGrpCat.{u}] - [∀ (X : C), (J.over X).WEqualsLocallyBijective AddCommGrpCat.{u}] -diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/Submodule.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/Submodule.lean -index b10f8c3b43ddc016d77045b940899be8951c4c77..ed660d7db04c0e4b3d94ccb19b40ff6e1f7a4053 100644 ---- a/Oka/Algebra/Category/ModuleCat/Sheaf/Submodule.lean -+++ b/Oka/Algebra/Category/ModuleCat/Sheaf/Submodule.lean -@@ -6,7 +6,7 @@ Authors: Yuichiro Hoshi, Junnosuke Koizumi, Christian Merten - module - - public import Oka.Algebra.Category.ModuleCat.Presheaf.Submodule --public import Mathlib.Algebra.Category.ModuleCat.Sheaf -+public import Mathlib.Algebra.Category.ModuleCat.Sheaf.Submodule - - /-! - # Submodules of sheaves of modules -@@ -19,107 +19,6 @@ presheaf of modules whose membership condition is local. - - `SheafOfModules.Submodule`: a submodule of (the underlying presheaf of modules of) a sheaf of - modules whose membership is local. - - `SheafOfModules.Submodule.toSheafOfModules`: the associated sheaf of modules. ---/ -- --@[expose] public section -- --universe v v₁ u₁ u -- --open CategoryTheory Opposite -- --namespace SheafOfModules -- --open PresheafOfModules -- --variable {C : Type u₁} [Category.{v₁} C] {J : GrothendieckTopology C} -- {R : Sheaf J RingCat.{u}} -- --/-- A submodule of a sheaf of modules `M`: a submodule `N` of the underlying presheaf of modules --whose membership condition is local. -/ --structure Submodule (M : SheafOfModules.{v} R) extends M.val.Submodule where -- isSheaf ⦃X : Cᵒᵖ⦄ (s : M.val.obj X) : -- toSubmodule.toSubfunctor.sieveOfSection s ∈ J X.unop → s ∈ toSubmodule.obj X -- --namespace Submodule -- --variable {M : SheafOfModules.{v} R} (N : M.Submodule) -- --@[ext] --lemma ext {N₁ N₂ : M.Submodule} (h : N₁.toSubmodule = N₂.toSubmodule) : N₁ = N₂ := by -- cases N₁ -- cases N₂ -- subst h -- rfl -- --/-- The sheaf of modules associated to a submodule of a sheaf of modules. -/ --noncomputable def toSheafOfModules : SheafOfModules.{v} R where -- val := N.toPresheafOfModules -- isSheaf := by -- suffices Presieve.IsSheaf J N.toSubfunctor.toFunctor by -- apply Presheaf.isSheaf_of_isSheaf_comp J (s := CategoryTheory.forget AddCommGrpCat) -- rwa [isSheaf_iff_isSheaf_of_type] -- rw [N.toSubfunctor.isSheaf_iff] -- · exact N.isSheaf -- · rw [← isSheaf_iff_isSheaf_of_type] -- exact GrothendieckTopology.HasSheafCompose.isSheaf _ M.isSheaf -- --/-- The inclusion of the sheaf of modules associated to a submodule `N` into `M`. -/ --noncomputable def ι : N.toSheafOfModules ⟶ M := -- ⟨N.toSubmodule.ι⟩ - --@[simp] --lemma ι_val : N.ι.val = N.toSubmodule.ι := rfl -- --instance : Mono N.ι := -- (forget R).mono_of_mono_map <| inferInstanceAs (Mono N.toSubmodule.ι) -- --instance : PartialOrder M.Submodule := -- PartialOrder.lift toSubmodule fun _ _ ↦ ext -- --lemma le_iff {N₁ N₂ : M.Submodule} : N₁ ≤ N₂ ↔ N₁.toSubmodule ≤ N₂.toSubmodule := .rfl -- --instance : InfSet M.Submodule where -- sInf s := -- { toSubmodule := sInf ((·.toSubmodule) '' s) -- isSheaf X x hx := by -- simp only [PresheafOfModules.Submodule.sInf_obj, Submodule.mem_iInf] -- rintro _ ⟨N', hN', rfl⟩ -- refine N'.isSheaf x (J.superset_covering (fun V f hf ↦ ?_) hx) -- exact (sInf_le (Set.mem_image_of_mem (·.toSubmodule) hN')) (op V) hf } -- --instance : Min M.Submodule where -- min N₁ N₂ := -- { toSubmodule := N₁.toSubmodule ⊓ N₂.toSubmodule -- isSheaf := by -- rw [← sInf_pair, ← Set.image_pair (·.toSubmodule) N₁ N₂] -- exact (sInf {N₁, N₂}).isSheaf } -- --noncomputable instance : CompleteLattice M.Submodule where -- __ := completeLatticeOfInf M.Submodule fun s ↦ -- ⟨fun _ hN ↦ le_iff.mpr (sInf_le (Set.mem_image_of_mem _ hN)), -- fun _ hb ↦ le_iff.mpr <| le_sInf <| by -- rintro _ ⟨N', hN', rfl⟩ -- exact le_iff.mp (hb hN')⟩ -- inf := (· ⊓ ·) -- inf_le_left := fun _ _ ↦ le_iff.mpr inf_le_left -- inf_le_right := fun _ _ ↦ le_iff.mpr inf_le_right -- le_inf := fun _ _ _ h₁ h₂ ↦ le_iff.mpr (le_inf (le_iff.mp h₁) (le_iff.mp h₂)) -- --@[simp] --lemma toSubmodule_sInf (s : Set M.Submodule) : -- (sInf s).toSubmodule = sInf ((·.toSubmodule) '' s) := -- rfl -- --@[simp] --lemma toSubmodule_iInf {ι : Sort*} (N : ι → M.Submodule) : -- (⨅ i, N i).toSubmodule = ⨅ i, (N i).toSubmodule := by -- rw [iInf, toSubmodule_sInf, ← Set.range_comp, iInf, Function.comp_def] -- --@[simp] --lemma toSubmodule_inf (N₁ N₂ : M.Submodule) : -- (N₁ ⊓ N₂).toSubmodule = N₁.toSubmodule ⊓ N₂.toSubmodule := -- rfl -- --end Submodule -- --end SheafOfModules -+Mathlib now provides these declarations. This module re-exports them to preserve Oka's import path. -+-/ -diff --git a/Oka/Algebra/Category/ModuleCat/Stalk.lean b/Oka/Algebra/Category/ModuleCat/Stalk.lean -index 6a7f5c96778f62d63aeb9a38d3191b8411419e99..0d0b5e53df579ebea57660ac7c5568200967df9e 100644 ---- a/Oka/Algebra/Category/ModuleCat/Stalk.lean -+++ b/Oka/Algebra/Category/ModuleCat/Stalk.lean -@@ -60,18 +60,20 @@ def stalkFunctor : - map_add' a b := map_add _ a b - map_smul' := by - intro r m -+ change _ = r • _ - obtain ⟨U, hxU, r, rfl⟩ := TopCat.Presheaf.exists_germ_eq R r - obtain ⟨V, hxV, m, rfl⟩ := TopCat.Presheaf.exists_germ_eq M.presheaf m -+ have hxUV : x ∈ U ⊓ V := ⟨hxU, hxV⟩ - rw [← TopCat.Presheaf.germ_res_apply R (homOfLE (inf_le_left : U ⊓ V ≤ U)) x -- ⟨hxU, hxV⟩ r, -+ hxUV r, - ← TopCat.Presheaf.germ_res_apply M.presheaf (homOfLE (inf_le_right : U ⊓ V ≤ V)) x -- ⟨hxU, hxV⟩ m, -- ← germ_smul] -+ hxUV m] -+ erw [← germ_smul] - erw [TopCat.Presheaf.stalkFunctor_map_germ_apply (C := AddCommGrpCat.{u}) -- (F := M.presheaf) (G := N.presheaf) (U ⊓ V) x ⟨hxU, hxV⟩ ((toPresheaf _).map f), -+ (F := M.presheaf) (G := N.presheaf) (U ⊓ V) x hxUV ((toPresheaf _).map f), - TopCat.Presheaf.stalkFunctor_map_germ_apply (C := AddCommGrpCat.{u}) -- (F := M.presheaf) (G := N.presheaf) (U ⊓ V) x ⟨hxU, hxV⟩ ((toPresheaf _).map f)] -- rw [RingHom.id_apply, ← germ_smul] -+ (F := M.presheaf) (G := N.presheaf) (U ⊓ V) x hxUV ((toPresheaf _).map f)] -+ erw [← germ_smul] - congr 1 - exact (Hom.app f (op (U ⊓ V))).hom.map_smul _ _ } - map_id M := by -diff --git a/Oka/Algebra/Homology/DerivedCategory/Ext/MapNatTrans.lean b/Oka/Algebra/Homology/DerivedCategory/Ext/MapNatTrans.lean -index 351a850eb42d360471fadd3e1da31ae767498919..609b9c0608dedcfddbee558165c3f4311c5b3a69 100644 ---- a/Oka/Algebra/Homology/DerivedCategory/Ext/MapNatTrans.lean -+++ b/Oka/Algebra/Homology/DerivedCategory/Ext/MapNatTrans.lean -@@ -6,6 +6,7 @@ Authors: Christian Merten - import Mathlib.Algebra.Homology.DerivedCategory.Ext.EnoughInjectives - import Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences - import Mathlib.Algebra.Homology.DerivedCategory.Ext.Map -+import Mathlib.CategoryTheory.Abelian.Exact - - /-! - # Naturality of `Ext.mapExactFunctor` in the functor -diff --git a/Oka/Algebra/MvPolynomial/PDeriv.lean b/Oka/Algebra/MvPolynomial/PDeriv.lean -index 4d721a8d3638dc1b39f918f700d70cc0433780fb..e84717ba891d18bb45b82c193564ef64fb211145 100644 ---- a/Oka/Algebra/MvPolynomial/PDeriv.lean -+++ b/Oka/Algebra/MvPolynomial/PDeriv.lean -@@ -58,7 +58,7 @@ vanish. The induction is `MvPolynomial.induction_on`, so no monomial expansion a - `classical`; the statement needs no `DecidableEq σ` and the `unusedDecidableInType` linter is - what says so. -/ - theorem coeff_single_one_taylorAlgHom (z : σ → R) (i : σ) (p : MvPolynomial σ R) : -- coeff (Finsupp.single i 1) (taylorAlgHom z p) = eval z (pderiv i p) := by -+ (taylorAlgHom z p).coeff (Finsupp.single i 1) = eval z (pderiv i p) := by - classical - induction p using MvPolynomial.induction_on with - | C a => -@@ -66,7 +66,8 @@ theorem coeff_single_one_taylorAlgHom (z : σ → R) (i : σ) (p : MvPolynomial - exact if_neg fun h ↦ by simpa using h.symm - | add p q hp hq => simp [hp, hq] - | mul_X p j hp => -- rw [map_mul, taylorAlgHom_X, mul_add, coeff_add, coeff_mul_X', mul_comm _ (C (z j)), -+ rw [map_mul, taylorAlgHom_X, mul_add, AddMonoidAlgebra.coeff_add, Finsupp.add_apply, -+ coeff_mul_X', mul_comm _ (C (z j)), - coeff_C_mul, hp, pderiv_mul, map_add, eval_mul, eval_mul, eval_X] - by_cases h : j = i - · subst h -diff --git a/Oka/AlgebraicGeometry/AlgClosed/Basic.lean b/Oka/AlgebraicGeometry/AlgClosed/Basic.lean -index a9d62d93ad0e92cd25050114c7bc153e54e46385..e4d46502cc27945f8e90243a9b8ced9ea69f164a 100644 ---- a/Oka/AlgebraicGeometry/AlgClosed/Basic.lean -+++ b/Oka/AlgebraicGeometry/AlgClosed/Basic.lean -@@ -41,7 +41,12 @@ theorem ext_of_apply_eq_of_formallyUnramified {X Y Z : Scheme.{u}} {K : Type u} - have : JacobsonSpace X := LocallyOfFiniteType.jacobsonSpace (f ≫ s ≫ i) - refine ext_of_fromSpecResidueField_eq_of_formallyUnramified s h fun x hx ↦ ?_ - rw [← cancel_epi (Spec.map (residueFieldIsoBase (f ≫ s ≫ i) x hx).hom)] -- refine ext_of_apply_closedPoint_eq (s ≫ i) ?_ ?_ (by simpa using H x hx) -+ refine ext_of_apply_closedPoint_eq (s ≫ i) ?_ ?_ (by -+ let p : Spec (X.residueField x) := -+ Spec.map (residueFieldIsoBase (f ≫ s ≫ i) x hx).hom (IsLocalRing.closedPoint K) -+ change f (X.fromSpecResidueField x p) = g (X.fromSpecResidueField x p) -+ rw [Scheme.fromSpecResidueField_apply] -+ exact H x hx) - · simp only [Category.assoc, ← SpecMap_residueFieldIsoBase_inv (f ≫ s ≫ i) x hx, - ← Spec.map_comp, Iso.inv_hom_id, Spec.map_id] - · simp only [Category.assoc, ← reassoc_of% h, ← SpecMap_residueFieldIsoBase_inv (f ≫ s ≫ i) x hx, -diff --git a/Oka/AlgebraicGeometry/GraphClosure.lean b/Oka/AlgebraicGeometry/GraphClosure.lean -index 3b5043fbf8c34bba45b676805660cb88e8b93e39..ed888d852b67b08c834e5dc5bae6819826bd207d 100644 ---- a/Oka/AlgebraicGeometry/GraphClosure.lean -+++ b/Oka/AlgebraicGeometry/GraphClosure.lean -@@ -67,9 +67,10 @@ theorem isClosedImmersion_morphismRestrict_of_graph (c : X ⟶ pullback sY sP) - have key : u ≫ γ' = (X.isoOfEq (by rfl : c ⁻¹ᵁ O = _)).inv ≫ (c ∣_ O) := by - rw [← cancel_mono O.ι, Category.assoc, hγ', Category.assoc, morphismRestrict_ι] - apply pullback.hom_ext -- · simp only [γ, Category.assoc, pullback.lift_fst, hu₂, Scheme.isoOfEq_inv_ι_assoc] -- · simp only [γ, Category.assoc, pullback.lift_snd, reassoc_of% hu₁, morphismRestrict_ι, -- Scheme.isoOfEq_inv_ι_assoc] -+ · simp only [γ, Category.assoc, pullback.lift_fst, hu₂] -+ erw [Scheme.isoOfEq_inv_ι_assoc] -+ · simp only [γ, Category.assoc, pullback.lift_snd, reassoc_of% hu₁, morphismRestrict_ι] -+ erw [Scheme.isoOfEq_inv_ι_assoc] - have : IsClosedImmersion (u ≫ γ') := key ▸ inferInstance - exact IsClosedImmersion.of_comp u γ' - -diff --git a/Oka/AlgebraicGeometry/Modules/CocycleTwist.lean b/Oka/AlgebraicGeometry/Modules/CocycleTwist.lean -index 005529b17e2c6432b15ae17e316d9ed9052dbe17..458526882116f655a1594e315f741e612254098d 100644 ---- a/Oka/AlgebraicGeometry/Modules/CocycleTwist.lean -+++ b/Oka/AlgebraicGeometry/Modules/CocycleTwist.lean -@@ -3,6 +3,7 @@ Copyright (c) 2026 Yuichiro Hoshi, Junnosuke Koizumi, Christian Merten. All righ - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Yuichiro Hoshi, Junnosuke Koizumi, Christian Merten - -/ -+import Mathlib.AlgebraicGeometry.AffineScheme - import Mathlib.AlgebraicGeometry.Modules.Sheaf - - /-! -diff --git a/Oka/AlgebraicGeometry/Modules/Coherent.lean b/Oka/AlgebraicGeometry/Modules/Coherent.lean -index 2e9ce25cda45c59e74487ee0b2a3f85d5a465f17..6d2efe7e806b4c9f9a64438354c72395b31c271a 100644 ---- a/Oka/AlgebraicGeometry/Modules/Coherent.lean -+++ b/Oka/AlgebraicGeometry/Modules/Coherent.lean -@@ -127,7 +127,7 @@ nothing else; it is stated because the rest of the file mixes the two spellings - lemma algebraMap_basicOpen_eq_res {U : X.Opens} (f : Γ(X, U)) (r : Γ(X, U)) : - algebraMap Γ(X, U) Γ(X, X.basicOpen f) r = - X.toLocallyRingedSpace.res (X.basicOpen_le f) r := by -- rw [RingHom.algebraMap_toAlgebra]; rfl -+ rw [RingHom.algebraMap_toAlgebra] - - /-- **A locally noetherian scheme has locally finitely generated relations.** - -diff --git a/Oka/AlgebraicGeometry/ProjectiveSpace/BaseChange.lean b/Oka/AlgebraicGeometry/ProjectiveSpace/BaseChange.lean -index 11f850b1d8982aa6b3ec36f555507f53a52c17ee..9f90b56e8c2490ac17f3dea3eb9236ef14482649 100644 ---- a/Oka/AlgebraicGeometry/ProjectiveSpace/BaseChange.lean -+++ b/Oka/AlgebraicGeometry/ProjectiveSpace/BaseChange.lean -@@ -52,7 +52,7 @@ lemma mapGradedHom_apply (p : MvPolynomial (Fin (n + 1)) R) : - /-- A polynomial lies in the irrelevant ideal iff its constant coefficient vanishes. -/ - lemma mem_irrelevant_iff_coeff_zero {S : Type u} [CommRing S] - (a : MvPolynomial (Fin (n + 1)) S) : -- a ∈ HomogeneousIdeal.irrelevant (homogeneousSubmodule (Fin (n + 1)) S) ↔ coeff 0 a = 0 := by -+ a ∈ HomogeneousIdeal.irrelevant (homogeneousSubmodule (Fin (n + 1)) S) ↔ a.coeff 0 = 0 := by - rw [HomogeneousIdeal.mem_irrelevant_iff, GradedRing.proj_apply] - exact (congrArg (· = 0) (decomposition.decompose'_apply a 0)).to_iff.trans (by - rw [homogeneousComponent_zero, C_eq_zero]) -diff --git a/Oka/AlgebraicGeometry/Spec.lean b/Oka/AlgebraicGeometry/Spec.lean -index 4aaf23470bd3fe66532d65e904edd81451db7763..cc8ca808898dac8f18c2514e40d326d7edab535e 100644 ---- a/Oka/AlgebraicGeometry/Spec.lean -+++ b/Oka/AlgebraicGeometry/Spec.lean -@@ -51,6 +51,11 @@ noncomputable section - - namespace AlgebraicGeometry.StructureSheaf - -+-- Keep the point typed as `PrimeSpectrum R` while selecting the locally ringed space instance. -+local instance (R : Type u) [CommRing R] (p : PrimeSpectrum R) : -+ IsLocalRing ((Spec.locallyRingedSpaceObj (CommRingCat.of R)).presheaf.stalk p) := -+ (Spec.locallyRingedSpaceObj (CommRingCat.of R)).isLocalRing p -+ - /-- **The germ at `p` of the global section of `𝒪_{Spec R}` attached to `a : R` lies in the - maximal ideal of the stalk exactly when `a` lies in `p`.** - -diff --git a/Oka/Analysis/Calculus/Implicit.lean b/Oka/Analysis/Calculus/Implicit.lean -index 10af3babeca73146707010cb3b88e27511bf370a..1d88d506068c1c7bb66acb60329fa8a976354881 100644 ---- a/Oka/Analysis/Calculus/Implicit.lean -+++ b/Oka/Analysis/Calculus/Implicit.lean -@@ -271,7 +271,7 @@ theorem isLocalHomeomorph_coordProj_comp_of_isEmbedding - (φ.injOn_rightFun_levelSet (hsub y y.2) (hsub y' y'.2) hyy')) - · intro W hW - obtain ⟨W', hW'open, rfl⟩ := isOpen_induced_iff.1 hW -- have himg : U.restrict (fun t ↦ g t ∘ e) '' (Subtype.val ⁻¹' W') = -+ have himg : U.domRestrict (fun t ↦ g t ∘ e) '' (Subtype.val ⁻¹' W') = - (fun t ↦ g t ∘ e) '' (U ∩ W') := by - rw [Set.restrict_eq, Set.image_comp, Subtype.image_preimage_coe] - rw [himg] -diff --git a/Oka/Analytic/DifferentiableTsum.lean b/Oka/Analytic/DifferentiableTsum.lean -index 1cc7593e2113393328c8b4aed04a8c2b6d2c7bec..3cda1414e87bf18fea90d11236466b4e236a7f1f 100644 ---- a/Oka/Analytic/DifferentiableTsum.lean -+++ b/Oka/Analytic/DifferentiableTsum.lean -@@ -109,7 +109,7 @@ theorem differentiableOn_tsum_of_locally_summable {ι : Type*} [Countable ι] {m - ∏ i, (ρ - ‖y i‖)⁻¹ := by - intro θ - rw [norm_prod] -- refine Finset.prod_le_prod (fun i _ ↦ norm_nonneg _) fun i _ ↦ ?_ -+ refine Finset.prod_le_prod₀ (fun i _ ↦ norm_nonneg _) fun i _ ↦ ?_ - rw [norm_inv] - have h2 := norm_sub_norm_le (torusMap (0 : Fin m → ℂ) (fun _ ↦ ρ) θ i) (y i) - rw [hnorm] at h2 -diff --git a/Oka/Analytic/HartogsRegular.lean b/Oka/Analytic/HartogsRegular.lean -index 432a16f62ac5ad92a90eca0977114d4d53d60010..46de5fc3caa70fb03ad1ef71d55289203c64cee7 100644 ---- a/Oka/Analytic/HartogsRegular.lean -+++ b/Oka/Analytic/HartogsRegular.lean -@@ -120,6 +120,8 @@ theorem exists_ne_zero_incl_mem_span_pair {W : (LocalOkaRing (Fin n))[X]} - simp only [smul_eq_mul, ← map_mul, Ideal.Quotient.eq] at hab ⊢ - rw [hdvd] at hab ⊢ - exact hreg _ (by rwa [mul_sub]) -+ have : Algebra.IsIntegral (LocalOkaRing (Fin n)) (LocalOkaRing (Fin (n + 1)) ⧸ I) := -+ Algebra.IsIntegral.of_finite _ _ - obtain ⟨c, hc0, hc⟩ := exists_ne_zero_algebraMap_mem_span_singleton - (R := LocalOkaRing (Fin n)) hx - obtain ⟨a, ha⟩ := Ideal.mem_span_singleton'.mp hc -diff --git a/Oka/Analytic/Laurent/Several.lean b/Oka/Analytic/Laurent/Several.lean -index d7ba12c980a5df7d310c21b8920f868e8dda3da7..c5b2408becda75420165c2e2340a0866b4cfcffb 100644 ---- a/Oka/Analytic/Laurent/Several.lean -+++ b/Oka/Analytic/Laurent/Several.lean -@@ -340,7 +340,7 @@ theorem exists_summable_bound_mcoeff {f : (Fin n → ℂ) → ℂ} - (norm_nonneg _) _) - _ = M * ∏ i, (σ i ^ (-k i) * ‖z i‖ ^ k i) := by rw [Finset.prod_mul_distrib, mul_assoc] - _ ≤ M * ∏ i, β i (k i) := by -- refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod (fun i _ ↦ ?_) fun i _ ↦ ?_) hM0 -+ refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod₀ (fun i _ ↦ ?_) fun i _ ↦ ?_) hM0 - · exact mul_nonneg (zpow_nonneg (hσ i).pos.le _) (zpow_nonneg (norm_nonneg _) _) - · obtain ⟨hz2, hz1⟩ := hz i - rcases le_or_gt 0 (k i) with hk | hk -@@ -561,7 +561,7 @@ theorem differentiableOn_tsum_monomial {b : (Fin n → ℤ) → ℂ} - refine le_trans ?_ (Finset.single_le_sum (f := fun s ↦ ‖b k‖ * ∏ i, τ s i ^ k i) - (fun s _ ↦ mul_nonneg (norm_nonneg _) - (Finset.prod_nonneg fun i _ ↦ zpow_nonneg (hτ s i).pos.le _)) (Finset.mem_univ s₀)) -- refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod -+ refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod₀ - (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ ?_) (norm_nonneg _) - obtain ⟨hz2, hz1⟩ := hz i - rcases le_or_gt 0 (k i) with hki | hki -@@ -604,7 +604,7 @@ theorem differentiableOn_tsum_indicator_mcoeff {f : (Fin n → ℂ) → ℂ} - (Finset.prod_nonneg fun i _ ↦ zpow_nonneg (norm_nonneg _) _)) fun k ↦ ?_ - by_cases hkS : k ∈ S - · rw [Set.indicator_of_mem hkS, norm_mul, norm_monomial] -- refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod -+ refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod₀ - (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ ?_) (norm_nonneg _) - by_cases h : r' i = r i - · rw [hw'eq i h] -diff --git a/Oka/Analytic/Puiseux.lean b/Oka/Analytic/Puiseux.lean -index 05afbc2ddb7910756d06fff090cb1b235dbba8e2..9a5249ab6704717c82c7bebc6a6038bf36ecab97 100644 ---- a/Oka/Analytic/Puiseux.lean -+++ b/Oka/Analytic/Puiseux.lean -@@ -126,7 +126,7 @@ theorem exists_prod_eq_of_mem_base (hG : Convex ℝ G) (hGo : IsOpen G) - exact (Φ ⟨c, ⟨z, hz⟩⟩).2 - have hgcont (c : Cm) : ContinuousOn (g c) (base G) := by - rw [continuousOn_iff_continuous_restrict] -- have : (base G).restrict (g c) = fun z ↦ (Φ ⟨c, z⟩).1.2 := funext fun z ↦ hg c z.2 -+ have : (base G).domRestrict (g c) = fun z ↦ (Φ ⟨c, z⟩).1.2 := funext fun z ↦ hg c z.2 - rw [this] - exact continuous_snd.comp (continuous_subtype_val.comp (Φ.continuous.comp continuous_sigmaMk)) - have hmemk (c : Cm) {z : E × ℂ} (hz : z ∈ base G) : (z.1, z.2 ^ (k c : ℕ)) ∈ base G := by -diff --git a/Oka/AnalyticSpace/Continuity.lean b/Oka/AnalyticSpace/Continuity.lean -index 38d7a2cdc65f7306d3996c08559e74c967a3de6f..fad2deea61f58d9a8ab9baedb5ae754ed1d37d8a 100644 ---- a/Oka/AnalyticSpace/Continuity.lean -+++ b/Oka/AnalyticSpace/Continuity.lean -@@ -244,7 +244,7 @@ theorem continuousAt_eval (z₀ : U) : - ((complexAffineSpace.{u} n).toLocallyRingedSpace.restrict V.isOpenEmbedding)).1 : - ULift.{u} (Fin n) → ℂ) ∈ V.isOpenEmbedding.isOpenMap.functor.obj A := - fun z ↦ ⟨i.base ⟨z.1.1, hWU₀ _ z.2⟩, hB'A (hmemB' _ z.2), rfl⟩ -- have hrestrict : (S.restrict fun z : U ↦ Z.eval z.1 z.2 g) = -+ have hrestrict : (S.domRestrict fun z : U ↦ Z.eval z.1 z.2 g) = - (fun y : V.isOpenEmbedding.isOpenMap.functor.obj A ↦ OkaRing.evalHom y.2 u) ∘ - fun z : S ↦ (⟨_, hmaps z⟩ : V.isOpenEmbedding.isOpenMap.functor.obj A) := - funext fun z ↦ hval _ (hmemB' _ z.2) -diff --git a/Oka/AnalyticSpace/EmptyBase.lean b/Oka/AnalyticSpace/EmptyBase.lean -index 85d680812a7c71b40edd40a65671bd3808a3afcb..be71d82fca9502fa48a0bf324c64537c4a19ea03 100644 ---- a/Oka/AnalyticSpace/EmptyBase.lean -+++ b/Oka/AnalyticSpace/EmptyBase.lean -@@ -195,7 +195,7 @@ are interchangeable because that class is a `Prop`. -/ - theorem SeparatedFiniteEtaleOver.not_galoisCategory_of_isEmpty : - ¬ GaloisCategory (SeparatedFiniteEtaleOver.{u} X) := by - intro h -- obtain ⟨F, ⟨hF⟩⟩ := h.hasFiberFunctor -+ obtain ⟨F, hF⟩ := h.hasFiberFunctor - exact SeparatedFiniteEtaleOver.not_isFiberFunctor_of_isEmpty F hF - - end ComplexAnalytic.AnalyticSpace -diff --git a/Oka/AnalyticSpace/FundamentalGroup.lean b/Oka/AnalyticSpace/FundamentalGroup.lean -index 786c99e8481fb3cf5c9030c61b6b8dae27a74791..a5b9eac5e2d3ca49ef7e8e6124a3a59688d063b3 100644 ---- a/Oka/AnalyticSpace/FundamentalGroup.lean -+++ b/Oka/AnalyticSpace/FundamentalGroup.lean -@@ -338,12 +338,12 @@ Galois cover with a morphism to it. - **No point of the base appears in the statement either, and here that takes an argument.** - `CategoryTheory.PreGaloisCategory.exists_hom_from_galois_of_connected` takes the fibre functor - explicitly, and every fibre functor this repository has is taken at a point of the base; --`CategoryTheory.PreGaloisCategory.GaloisCategory.getFiberFunctor` is the one the class carries and -+`CategoryTheory.GaloisCategory.getFiberFunctor` is the one the class carries and - it takes none, so it is what this proof feeds the lemma. -/ - theorem SeparatedFiniteEtaleOver.exists_isGalois_hom (A : SeparatedFiniteEtaleOver.{u} X) - [PreGaloisCategory.IsConnected A] : - ∃ (B : SeparatedFiniteEtaleOver.{u} X) (_ : B ⟶ A), PreGaloisCategory.IsGalois B := - PreGaloisCategory.exists_hom_from_galois_of_connected -- (PreGaloisCategory.GaloisCategory.getFiberFunctor _) A -+ (GaloisCategory.getFiberFunctor _) A - - end ComplexAnalytic.AnalyticSpace -diff --git a/Oka/AnalyticSpace/GaloisCategory.lean b/Oka/AnalyticSpace/GaloisCategory.lean -index 98b350d8474d86cee8aa56421812b4cf3aef0f5c..5cc4b7f2ebbba6965005c32a4128b358452b2934 100644 ---- a/Oka/AnalyticSpace/GaloisCategory.lean -+++ b/Oka/AnalyticSpace/GaloisCategory.lean -@@ -338,8 +338,8 @@ of a fibre functor and is, at the commit that adds it, the whole of what this re - about that class. - - `hasFiberFunctor` is the only field. It is the instance above's fibre functor taken at --`Classical.arbitrary`, and the `Nonempty` half of the field is `inferInstance`, which finds that --instance: **the class asks for a functor and this repository's fibre functors ask for a point, so -+`Classical.arbitrary`, and `inferInstance` supplies its `FiberFunctor` instance: -+**the class asks for a functor and this repository's fibre functors ask for a point, so - `[Nonempty X]` is exactly the gap** and it is spent here and nowhere else in this file. - - **`[PreconnectedSpace X]` does not give the point**, `IsPreconnected` holding of the empty set, for -@@ -350,6 +350,6 @@ instance SeparatedFiniteEtaleOver.galoisCategory : - GaloisCategory (SeparatedFiniteEtaleOver.{u} X) where - hasFiberFunctor := - ⟨SeparatedFiniteEtaleOver.fintypeFiberFunctor.{u} (Classical.arbitrary (X : Type u)), -- ⟨inferInstance⟩⟩ -+ inferInstance⟩ - - end ComplexAnalytic.AnalyticSpace -diff --git a/Oka/AnalyticSpace/HartogsExtension.lean b/Oka/AnalyticSpace/HartogsExtension.lean -index a6f59b110183fd5e8670bd351e675f59c5ea33f8..67ea3ea9dbd892343a22425f0ebcf50dc6a76531 100644 ---- a/Oka/AnalyticSpace/HartogsExtension.lean -+++ b/Oka/AnalyticSpace/HartogsExtension.lean -@@ -76,7 +76,6 @@ theorem hasHartogsExtension_of_local {O : Z.Opens} - refine (res_res _ h₁ (hBΩ y hy.1) t).symm.trans ?_ - change Z.res h₁ (sectRes (SheafOfModules.unit Z.ringSheaf) (hBΩ y hy.1) t) = _ - rw [ht, hu] -- rfl - - /-- **Hartogs extension passes to larger opens.** -/ - theorem HasHartogsExtension.mono {O O' : Z.Opens} (h : HasHartogsExtension Z O) (hO : O ≤ O') : -diff --git a/Oka/AnalyticSpace/MonicSplitting.lean b/Oka/AnalyticSpace/MonicSplitting.lean -index 8af208f323257c36c0549e45b4c561e8c451a748..0dc537d129f8518ad5182bb16c8bcb866869a60a 100644 ---- a/Oka/AnalyticSpace/MonicSplitting.lean -+++ b/Oka/AnalyticSpace/MonicSplitting.lean -@@ -665,7 +665,7 @@ lemma isPiQuotient_germMap_zero (P : Fin 0 → (LocalOkaRing (Fin n))[X]) : - exact Ideal.zero_mem _ - · rw [MvPolynomial.eq_C_of_isEmpty f] - simp only [germMap_C, Ideal.mem_bot, MvPolynomial.C_eq_zero] -- exact ⟨fun h ↦ by rw [← h2 (MvPolynomial.coeff 0 f), h default, map_zero], -+ exact ⟨fun h ↦ by rw [← h2 (f.coeff 0), h default, map_zero], - fun h _ ↦ by rw [h, map_zero]⟩ - - /-- **Splitting in several variables**: for monic `P₁, …, P_m ∈ ℂ{x}[t]`, the germs at the -diff --git a/Oka/AnalyticSpace/MonoDirectSummand.lean b/Oka/AnalyticSpace/MonoDirectSummand.lean -index 05b2b984eec3188fca13ecbf990b502439105bf3..96dc86f474aef07e2fb8a15658cdda65c8b57cb9 100644 ---- a/Oka/AnalyticSpace/MonoDirectSummand.lean -+++ b/Oka/AnalyticSpace/MonoDirectSummand.lean -@@ -239,22 +239,17 @@ noncomputable def FiniteEtaleOver.selfProdSnd : FiniteEtaleOver.selfProd i ⟶ A - Its triangle over `X` is not `rfl` and is the one place the square is used at the level of - morphisms rather than of points: `A.hom` is `i.left ≫ B.hom` because `i` is a morphism over `X`, - and the two composites to `B.left` agree by --`ComplexAnalytic.AnalyticSpace.baseChange_square`. **The two `rfl`s after the rewrites are the --comma-category seam** — `A.hom`'s source is `(𝟭 ComplexAnalytic.AnalyticSpace).obj A.left` and not --`A.left`, and a rewrite leaves the goal in the second spelling. **The step before them is a --`change` and not a `show`**, for the reason `ComplexAnalytic.AnalyticSpace.mono_ofRestrict`'s --docstring gives: the two spellings are `rfl`-equal and not syntactically equal, so --`linter.style.show` fires and `lake build --wfail` turns the warning into an error, which --`lake env lean` on a scratch file does not. -/ -+`ComplexAnalytic.AnalyticSpace.baseChange_square`. The `change` aligns the comma-category spelling -+of the target before applying these identities. -/ - noncomputable def FiniteEtaleOver.selfProdFst : FiniteEtaleOver.selfProd i ⟶ A := - haveI : IsFiniteEtale i.left := FiniteEtaleOver.isFiniteEtale_left i - MorphismProperty.Over.homMk (baseChangeFst i.left i.left) (by - have hw : i.left ≫ B.hom = A.hom := MorphismProperty.Over.w i - change baseChangeFst i.left i.left ≫ A.hom = baseChangeSnd i.left i.left ≫ A.hom - have e1 : baseChangeFst i.left i.left ≫ A.hom -- = (baseChangeFst i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw]; rfl -+ = (baseChangeFst i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw] - have e2 : baseChangeSnd i.left i.left ≫ A.hom -- = (baseChangeSnd i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw]; rfl -+ = (baseChangeSnd i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw] - rw [e1, e2, baseChange_square]) - - /-- **A monomorphism of covers is injective on points**, when the target's total space is -diff --git a/Oka/AnalyticSpace/PushforwardStalkCoherent.lean b/Oka/AnalyticSpace/PushforwardStalkCoherent.lean -index 9bef8e578acabf034c54926a2dd6b1e8d7cd2962..8869167716a5e14b1b58d499c35fc7850f661eee 100644 ---- a/Oka/AnalyticSpace/PushforwardStalkCoherent.lean -+++ b/Oka/AnalyticSpace/PushforwardStalkCoherent.lean -@@ -222,7 +222,6 @@ theorem isCoherent_pushUnit_of_stalks - rw [stalkAlgMap_germ] - erw [map_mul] - rw [germ_res_pushforward f (h'.trans h₁W)] -- rfl - obtain ⟨c, hc⟩ := hrel y' hy'W _ hgerm - choose U hyU γ hγ using fun l ↦ Y.presheaf.exists_germ_eq (c l) - obtain ⟨W₂, hyW₂, hW₂⟩ := exists_open_forall Y y' (fun l V ↦ V ≤ U l) -diff --git a/Oka/AnalyticSpace/SeparatedFiniteEtale.lean b/Oka/AnalyticSpace/SeparatedFiniteEtale.lean -index fe033bee08bdb493773cd588fb632bbbf4490b00..835d18362e97be53a54e500d797c6a0cc3ec0c18 100644 ---- a/Oka/AnalyticSpace/SeparatedFiniteEtale.lean -+++ b/Oka/AnalyticSpace/SeparatedFiniteEtale.lean -@@ -409,10 +409,9 @@ noncomputable def SeparatedFiniteEtaleOver.selfProdSnd (i : A ⟶ B) : - - The triangle is `ComplexAnalytic.AnalyticSpace.FiniteEtaleOver.selfProdFst`'s and the proof is - that one read here: `A.hom` is `i.left ≫ B.hom` because `i` is a morphism over `X`, and the two --composites to `B.left` agree by `ComplexAnalytic.AnalyticSpace.baseChange_square`. **The `change` --is not a `show` and the two `rfl`s are the comma-category seam**, both for the reasons that --docstring gives; neither is a stylistic choice and `lake build --wfail` turns the second into an --error. -/ -+composites to `B.left` agree by `ComplexAnalytic.AnalyticSpace.baseChange_square`. The `change` -+exposes the equality of underlying morphisms, and rewriting by the structure triangle aligns the -+two composites. -/ - noncomputable def SeparatedFiniteEtaleOver.selfProdFst (i : A ⟶ B) : - SeparatedFiniteEtaleOver.selfProd i ⟶ A := - haveI : IsFiniteEtale i.left := SeparatedFiniteEtaleOver.isFiniteEtale_left i -@@ -420,9 +419,9 @@ noncomputable def SeparatedFiniteEtaleOver.selfProdFst (i : A ⟶ B) : - have hw : i.left ≫ B.hom = A.hom := MorphismProperty.Over.w i - change baseChangeFst i.left i.left ≫ A.hom = baseChangeSnd i.left i.left ≫ A.hom - have e1 : baseChangeFst i.left i.left ≫ A.hom -- = (baseChangeFst i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw]; rfl -+ = (baseChangeFst i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw] - have e2 : baseChangeSnd i.left i.left ≫ A.hom -- = (baseChangeSnd i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw]; rfl -+ = (baseChangeSnd i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw] - rw [e1, e2, baseChange_square]) - - /-- **A monomorphism of this category is injective on points**, over a Hausdorff base. -diff --git a/Oka/AnalyticSpace/SeparatedFiniteEtaleLimits.lean b/Oka/AnalyticSpace/SeparatedFiniteEtaleLimits.lean -index 8ff2c0ca4a569d5fcfd505a69f4ee81a59056fb8..76bc85f173d0ebc89e2811a8377f6b7107092b57 100644 ---- a/Oka/AnalyticSpace/SeparatedFiniteEtaleLimits.lean -+++ b/Oka/AnalyticSpace/SeparatedFiniteEtaleLimits.lean -@@ -290,13 +290,8 @@ def fibreProdSnd (i : A ⟶ C) (j : B ⟶ C) : fibreProd i j ⟶ B := - The triangle over `X` is where `ComplexAnalytic.AnalyticSpace.baseChange_square` is spent: `A.hom` - is `i.left ≫ C.hom` and `B.hom` is `j.left ≫ C.hom`, both because a morphism of this category - commutes with the structure maps, and the two composites into `C.left` agree by that square. --**The `change` is not a `show` and the two `rfl`s at the ends of `e1` and `e2` are the comma --category's seam**, for the reason --`ComplexAnalytic.AnalyticSpace.SeparatedFiniteEtaleOver.selfProdFst`'s docstring gives of the same --two lines: `CategoryTheory.MorphismProperty.Over` is a comma category over --`CategoryTheory.Functor.id`, so a structure morphism's source is `(𝟭 _).obj A.left` rather than --`A.left`, and a `rw` whose motive crosses that unifier fails on an instance argument rather than --on the equation. -/ -+The `change` exposes the equality of underlying morphisms, and rewriting by the two structure -+triangles aligns the composites with the base-change square. -/ - def fibreProdFst (i : A ⟶ C) (j : B ⟶ C) : fibreProd i j ⟶ A := - haveI : IsFiniteEtale i.left := isFiniteEtale_left i - MorphismProperty.Over.homMk (baseChangeFst i.left j.left) (by -@@ -304,9 +299,9 @@ def fibreProdFst (i : A ⟶ C) (j : B ⟶ C) : fibreProd i j ⟶ A := - have hj : j.left ≫ C.hom = B.hom := MorphismProperty.Over.w j - change baseChangeFst i.left j.left ≫ A.hom = baseChangeSnd i.left j.left ≫ B.hom - have e1 : baseChangeFst i.left j.left ≫ A.hom -- = (baseChangeFst i.left j.left ≫ i.left) ≫ C.hom := by rw [Category.assoc, hi]; rfl -+ = (baseChangeFst i.left j.left ≫ i.left) ≫ C.hom := by rw [Category.assoc, hi] - have e2 : baseChangeSnd i.left j.left ≫ B.hom -- = (baseChangeSnd i.left j.left ≫ j.left) ≫ C.hom := by rw [Category.assoc, hj]; rfl -+ = (baseChangeSnd i.left j.left ≫ j.left) ≫ C.hom := by rw [Category.assoc, hj] - rw [e1, e2, baseChange_square]) - - /-- **The square commutes in this category.** -diff --git a/Oka/Analytification/GAGA/CartanApprox.lean b/Oka/Analytification/GAGA/CartanApprox.lean -index 581b56da7387628e1e8cbd2d04a85b54a7b5f8f7..7ff68a39f4b23872a67738eedb69456f2f9bcbfc 100644 ---- a/Oka/Analytification/GAGA/CartanApprox.lean -+++ b/Oka/Analytification/GAGA/CartanApprox.lean -@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE. - Authors: Christian Merten - -/ - import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff -+import Mathlib.Topology.Algebra.Group.Units - import Oka.Analytification.GAGA.CartanNearOne - - /-! -diff --git a/Oka/Analytification/GAGA/CechProjectiveAn.lean b/Oka/Analytification/GAGA/CechProjectiveAn.lean -index ed2fc5a4c0c28f13f73dce5965442ec38dfa1e31..1ef973c306c5469e0aee642766c9e454801391cc 100644 ---- a/Oka/Analytification/GAGA/CechProjectiveAn.lean -+++ b/Oka/Analytification/GAGA/CechProjectiveAn.lean -@@ -213,7 +213,7 @@ lemma SummableAt.of_le {a b : Coeff n} {w w' : Fin (n + 1) → ℂ} (h : Summabl - by_cases hk : a k = 0 - · simp only [hk, norm_zero, zero_mul] - exact mul_nonneg (norm_nonneg _) (Finset.prod_nonneg fun i _ ↦ zpow_nonneg (norm_nonneg _) _) -- · exact mul_le_mul (hab k hk).1 (Finset.prod_le_prod -+ · exact mul_le_mul (hab k hk).1 (Finset.prod_le_prod₀ - (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ (hab k hk).2 i) - (Finset.prod_nonneg fun i _ ↦ zpow_nonneg (norm_nonneg _) _) (norm_nonneg _) - -diff --git a/Oka/Analytification/GAGA/MittagLeffler.lean b/Oka/Analytification/GAGA/MittagLeffler.lean -index 711b9c7df2560db92075615b89aebac7fd9690b7..52bdc81437280d285be3c9d6c4d6310947d15841 100644 ---- a/Oka/Analytification/GAGA/MittagLeffler.lean -+++ b/Oka/Analytification/GAGA/MittagLeffler.lean -@@ -77,7 +77,7 @@ theorem differentiableOn_of_tendstoLocallyUniformlyOn {ι : Type*} {l : Filter - have hKle : ∀ θ, ‖∏ i, (torusMap (0 : Fin m → ℂ) (fun _ ↦ ρ) θ i - y i)⁻¹‖ ≤ Cy := by - intro θ - rw [norm_prod] -- refine Finset.prod_le_prod (fun i _ ↦ norm_nonneg _) fun i _ ↦ ?_ -+ refine Finset.prod_le_prod₀ (fun i _ ↦ norm_nonneg _) fun i _ ↦ ?_ - rw [norm_inv] - have h2 := norm_sub_norm_le (torusMap (0 : Fin m → ℂ) (fun _ ↦ ρ) θ i) (y i) - rw [hnorm] at h2 -diff --git a/Oka/Analytification/GAGA/Proper/CechProjectiveBox.lean b/Oka/Analytification/GAGA/Proper/CechProjectiveBox.lean -index bf41f8f5c8ed23452192f3404e1795f9d43356a7..0cbb53b33705b6acdbbf9a6b154f188559745578 100644 ---- a/Oka/Analytification/GAGA/Proper/CechProjectiveBox.lean -+++ b/Oka/Analytification/GAGA/Proper/CechProjectiveBox.lean -@@ -225,7 +225,7 @@ lemma tsum_proj_toCoeff_eq - have hmono : ∀ k, negSupp k = N → ‖monomial k w‖ ≤ ‖monomial k w'‖ := by - intro k hk - rw [norm_monomial, norm_monomial] -- refine Finset.prod_le_prod (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ ?_ -+ refine Finset.prod_le_prod₀ (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ ?_ - by_cases hi : i ∈ I ∧ i ∉ N - · have : 0 ≤ k i := not_lt.1 fun h ↦ hi.2 (hk ▸ mem_negSupp.2 h) - simp only [w', hi, not_false_eq_true, and_self, if_true, Complex.norm_real, -diff --git a/Oka/Analytification/GAGA/Proper/GAGA3.lean b/Oka/Analytification/GAGA/Proper/GAGA3.lean -index d4040ca5b5330f7b491348fb1e5ad38b0c933989..ee911b977eabb89db35f547769f37bd039194b38 100644 ---- a/Oka/Analytification/GAGA/Proper/GAGA3.lean -+++ b/Oka/Analytification/GAGA/Proper/GAGA3.lean -@@ -194,14 +194,14 @@ theorem genericAlgebraization_of_isProperℂ (H : RelativeAnalyticSerre.{u}) - exact hw - have b₁ := fA.bijective_stalkFunctor_map_unit hf M - have b₂ := fA.bijective_stalkFunctor_map_pushforward hf _ hμ -- have b₃ := (((analytification.obj T).toLocallyRingedSpace.stalkFunctor -- (fA.base (ιA.base q))).mapIso -- (asIso (inv (analytificationPushforwardBaseChange π -- (twistAlong j G m))))).toLinearEquiv.bijective -+ have b₃ := ConcreteCategory.bijective_of_isIso -+ (((analytification.obj T).toLocallyRingedSpace.stalkFunctor -+ (fA.base (ιA.base q))).map -+ (inv (analytificationPushforwardBaseChange π (twistAlong j G m)))) - change Function.Bijective (((analytification.obj T).toLocallyRingedSpace.stalkFunctor - (fA.base (ιA.base q))).map ψ) -- simp only [ψ, Functor.map_comp, ConcreteCategory.coe_comp] -- exact b₃.comp (b₂.comp b₁) -+ simpa only [ψ, Functor.map_comp, ConcreteCategory.coe_comp, Function.comp_assoc] using -+ b₃.comp (b₂.comp b₁) - - variable (X) in - /-- **GAGA-3 for proper schemes**, assuming the analytic relative Serre theorem -diff --git a/Oka/Analytification/GAGA/Proper/RelativeBaseChangeTwist.lean b/Oka/Analytification/GAGA/Proper/RelativeBaseChangeTwist.lean -index e79d757c932d7223beb60e4a36231f3d6ac50ce6..83de59ad652db961074bfbd69a4aeb609aa7743f 100644 ---- a/Oka/Analytification/GAGA/Proper/RelativeBaseChangeTwist.lean -+++ b/Oka/Analytification/GAGA/Proper/RelativeBaseChangeTwist.lean -@@ -258,7 +258,7 @@ lemma eval₂_monoPoly {e : ℕ} (s : MonoExp N e) (y : Fin m → ℂ) (v : Fin - /-- **A homogeneous polynomial is the sum of its monomials.** -/ - lemma eq_sum_monoPoly {e : ℕ} (p : 𝒜 e) : - (p : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)) = -- ∑ s : MonoExp N e, C (coeff (monoExpFinsupp s) (p : MvPolynomial _ _)) * -+ ∑ s : MonoExp N e, C ((p : MvPolynomial _ _).coeff (monoExpFinsupp s)) * - (monoPoly.{u} (m := m) s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)) := by - refine MvPolynomial.ext _ _ fun d ↦ ?_ - simp only [monoPoly, coeff_sum, coeff_C_mul, coeff_monomial] -@@ -320,13 +320,14 @@ lemma globalSectionsEquiv_smul (hN : 1 ≤ N) (e : ℕ) (a : RelBase.{u} m) - `p = globalSectionsEquiv s`. -/ - lemma eq_sum_smul_monoSec (hN : 1 ≤ N) (e : ℕ) - (s : AlgSec (twistingSheaf N (RelBase.{u} m) e)) : -- s = ∑ t : MonoExp N e, coeff (monoExpFinsupp t) -- (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)) • monoSec hN t := by -+ s = ∑ t : MonoExp N e, -+ (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)).coeff -+ (monoExpFinsupp t) • monoSec hN t := by - apply (globalSectionsEquiv (R := RelBase.{u} m) hN e).injective - apply Subtype.ext - have h1 := map_sum (globalSectionsEquiv (R := RelBase.{u} m) hN e) -- (fun t ↦ coeff (monoExpFinsupp t) -- (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)) • monoSec hN t) -+ (fun t ↦ (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)).coeff -+ (monoExpFinsupp t) • monoSec hN t) - Finset.univ - refine Eq.trans ?_ (congrArg Subtype.val h1).symm - rw [Submodule.coe_sum] -@@ -373,8 +374,9 @@ lemma surjective_monoTensor (e : ℕ) : Function.Surjective (monoTensor.{u} D hN - induction x using TensorProduct.induction_on with - | zero => exact ⟨0, by simp [monoTensor]⟩ - | tmul f s => -- refine ⟨fun t ↦ polyToOka.{u} D (coeff (monoExpFinsupp t) -- (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m))) * f, ?_⟩ -+ refine ⟨fun t ↦ polyToOka.{u} D -+ ((globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)).coeff -+ (monoExpFinsupp t)) * f, ?_⟩ - conv_rhs => rw [eq_sum_smul_monoSec hN e s] - rw [TensorProduct.tmul_sum, monoTensor] - refine Finset.sum_congr rfl fun t _ ↦ ?_ -diff --git a/Oka/Analytification/RET/ES/BoundedSections.lean b/Oka/Analytification/RET/ES/BoundedSections.lean -index 1d5a6fa3eaecf2a4e1e242e0c0ca0386d022a1f4..323af19a698cee76c7cd2f63689e4af17ea83bd0 100644 ---- a/Oka/Analytification/RET/ES/BoundedSections.lean -+++ b/Oka/Analytification/RET/ES/BoundedSections.lean -@@ -153,7 +153,7 @@ lemma evalFun_of_mem {Z : AnalyticSpace.{u}} {O : Z.Opens} (a : Z.presheaf.obj ( - lemma continuousOn_evalFun {Z : AnalyticSpace.{u}} {O : Z.Opens} (a : Z.presheaf.obj (op O)) : - ContinuousOn (evalFun a) O := by - rw [continuousOn_iff_continuous_restrict] -- have : (O : Set Z).restrict (evalFun a) = fun z : O ↦ Z.eval z.1 z.2 a := -+ have : (O : Set Z).domRestrict (evalFun a) = fun z : O ↦ Z.eval z.1 z.2 a := - funext fun z ↦ evalFun_of_mem a z.2 - rw [this] - exact Z.continuous_eval a -@@ -391,7 +391,7 @@ theorem exists_local_sheets [T2Space W.left] {x₀ : Cn.{u} n} (hx₀ : x₀ ∈ - simp only [σ, dif_pos hxN, hG i _ hxU] - exact congrArg Subtype.val (hfG i _ hxU) - · rw [continuousOn_iff_continuous_restrict] -- have : B.restrict (σ i) = fun x : B ↦ -+ have : B.domRestrict (σ i) = fun x : B ↦ - (H.symm (⟨⟨x.1, (hB x.1 x.2).1⟩, (hB x.1 x.2).2⟩, i)).1 := by - funext x - simp only [Set.restrict_apply, σ, dif_pos (hB x.1 x.2).1, hG i _ (hB x.1 x.2).2] -diff --git a/Oka/Analytification/RET/ES/BoundedSectionsHartogs.lean b/Oka/Analytification/RET/ES/BoundedSectionsHartogs.lean -index b522e0bee17bfd58c8ad0c8d31227ee13ced1eee..374151aa665364f60f09866aa196f6254cdc5b57 100644 ---- a/Oka/Analytification/RET/ES/BoundedSectionsHartogs.lean -+++ b/Oka/Analytification/RET/ES/BoundedSectionsHartogs.lean -@@ -207,8 +207,8 @@ theorem mem_boundedSubring_of_map_mem [T2Space W.left] (hD : HasThinComplement N - obtain ⟨c', hc'⟩ := (bijective_map_of_regularPairFamily P hVU hV'V hV').2 (c k) - refine ⟨c', fun x hx hxN ↦ ?_⟩ - rw [← holFun_map hV'V c' hx, hc', hc k x hx hxN] -- congr 1 -- refine charPolyFun_congr W fun w hw ↦ ha' w ((mem_preim_iff h₀ W).2 (hw ▸ hx)) -+ exact congrArg (fun p : Polynomial ℂ ↦ p.coeff k) -+ (charPolyFun_congr W fun w hw ↦ ha' w ((mem_preim_iff h₀ W).2 (hw ▸ hx))) - choose c' hc' using hc' - -- a ball around `x₀` in `img V`, over which the number of sheets is constant - obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 (img V).isOpen x₀ hx₀ -diff --git a/Oka/Analytification/RET/ES/CapExtension/ChartReverse.lean b/Oka/Analytification/RET/ES/CapExtension/ChartReverse.lean -index 8a4d84a8547b1140fd711465a10c7e6618a6d2b4..519a5c78ebf048be99ce17661e14b605b44c4692 100644 ---- a/Oka/Analytification/RET/ES/CapExtension/ChartReverse.lean -+++ b/Oka/Analytification/RET/ES/CapExtension/ChartReverse.lean -@@ -67,7 +67,9 @@ theorem hasLocalModuleRelationsAt_of {z : Z} (hM : HasLocalModuleRelationsAt M ( - refine ⟨C.pre W, hpreV, k, fun l i ↦ C.ψ (C.pre W) (Y.res hWe.le (g l i)), hzW, - fun l ↦ ?_, fun W' hW' a ha y hy ↦ ?_⟩ - · have := congrArg (fun s ↦ C.φ (C.pre W) (sectRes M hWe.le s)) (hrel l) -- simp only [sectRes_sum, sectRes_smul, C.φ_sum, sectRes_zero, map_zero] at this -+ simp only [sectRes_sum, sectRes_smul, C.φ_sum, sectRes_zero] at this -+ have hzero : C.φ (C.pre W) 0 = 0 := (C.φ (C.pre W)).map_zero -+ rw [hzero] at this - rw [← this] - refine Finset.sum_congr rfl fun i _ ↦ ?_ - rw [C.φ_smul, sectRes_sectRes, C.φ_res hpreV, φ_φInv] -@@ -92,6 +94,8 @@ theorem hasLocalModuleRelationsAt_of {z : Z} (hM : HasLocalModuleRelationsAt M ( - rw [C.ψ_res hpre, ψ_ψInv] - rw [e₁, ← Y.res_res hW''e.le hW'', this] - refine Finset.sum_congr rfl fun l _ ↦ ?_ -+ change C.ψ (C.pre W'') (Y.res hW''e.le -+ (c l * Y.res (hW''.trans hW'e) (g l i))) = _ - rw [res_mul, map_mul, Y.res_res, C.ψ_res_res _ (hpre.trans hW') hWe.le] - - end AlgebraicGeometry.LocallyRingedSpace.ModuleChart -diff --git a/Oka/Analytification/RET/ES/Codim2/BPointConfig.lean b/Oka/Analytification/RET/ES/Codim2/BPointConfig.lean -index 42cbba4b625bf4eedd6512f31b175e5b96c88a8a..33f963d8779e62c9d631495ab0359703f3f4d5ef 100644 ---- a/Oka/Analytification/RET/ES/Codim2/BPointConfig.lean -+++ b/Oka/Analytification/RET/ES/Codim2/BPointConfig.lean -@@ -268,7 +268,7 @@ lemma sec_mem_region {p : Cn.{u} n × ℂ} (hp : p.1 ∈ d.G') (ht : ‖p.2‖ < - lemma differentiableOn_Q_coeff (k : ℕ) : - DifferentiableOn ℂ (d.Q.coeff k) (d.G' ×ˢ ball 0 d.r) := by - have hsec : Differentiable ℂ d.sec := differentiableOn_univ.1 -- (differentiableOn_update (fun e _ ↦ ((differentiable_baseProj (it := d.it) (iw := d.iw) -+ (differentiableOn_update (fun (e : Cn.{u} n × ℂ) _ ↦ ((differentiable_baseProj (it := d.it) (iw := d.iw) - e.1).comp e differentiableAt_fst).differentiableWithinAt) - differentiable_snd.differentiableOn d.it) - have : d.Q.coeff k = fun p ↦ d.P.coeff k (d.sec p) := funext (d.Q_coeff k) -diff --git a/Oka/Analytification/RET/ES/Codim2/NormalCrossingsBasis.lean b/Oka/Analytification/RET/ES/Codim2/NormalCrossingsBasis.lean -index ef039b72945947b5f998d5ae0388d3928a9a992a..6866f4cdc162bc7fa5eff6c06bb1eca0c406b212 100644 ---- a/Oka/Analytification/RET/ES/Codim2/NormalCrossingsBasis.lean -+++ b/Oka/Analytification/RET/ES/Codim2/NormalCrossingsBasis.lean -@@ -121,7 +121,7 @@ lemma norm_val_le (i : K.ι) (w : W.left) : ‖K.val i w‖ ≤ 1 := by - by_cases h : ∃ u, K.Φ i.1 u = w - · obtain ⟨u, hu⟩ := h - rw [K.val_eq i hu, KummerPi.monomial, norm_prod] -- refine Finset.prod_le_one (fun _ _ ↦ norm_nonneg _) fun k _ ↦ ?_ -+ refine Finset.prod_le_one₀ (fun _ _ ↦ norm_nonneg _) fun k _ ↦ ?_ - rw [norm_pow] - exact pow_le_one₀ (norm_nonneg _) ((KummerPi.mem_base.1 u.2).2 k).2.le - · rw [K.val_eq_zero i fun u hu ↦ h ⟨u, hu⟩, norm_zero] -@@ -164,7 +164,7 @@ theorem exists_eval_eq_val (i : K.ι) : - dif_pos hz - have hΦ'c : ContinuousOn Φ' (KummerPi.base χ.B r) := by - rw [continuousOn_iff_continuous_restrict] -- have : (KummerPi.base χ.B r).restrict Φ' = K.Φ c := funext fun z ↦ hΦ' z.1 z.2 -+ have : (KummerPi.base χ.B r).domRestrict Φ' = K.Φ c := funext fun z ↦ hΦ' z.1 z.2 - rw [this] - exact K.continuous c - obtain ⟨O₁, hwO₁, hinj, -⟩ := exists_sheet W w -diff --git a/Oka/Analytification/RET/ES/Codim2/PuiseuxCoord.lean b/Oka/Analytification/RET/ES/Codim2/PuiseuxCoord.lean -index 7b372bc3b5887bd9987d5c7557b18322f7eff199..11746c11c844207227ba398ed8db69828a17134f 100644 ---- a/Oka/Analytification/RET/ES/Codim2/PuiseuxCoord.lean -+++ b/Oka/Analytification/RET/ES/Codim2/PuiseuxCoord.lean -@@ -378,7 +378,7 @@ lemma exists_norm_sub_zeta_pow_mul_lt {s : ℕ} (hs : 0 < s) {a b : ℂ} {r : - rw [hζ.pow_sub_pow_eq_prod_sub_mul a b hs, norm_prod] - calc r ^ s = ∏ _μ ∈ Polynomial.nthRootsFinset s (1 : ℂ), r := by - rw [Finset.prod_const, hζ.card_nthRootsFinset] -- _ ≤ _ := Finset.prod_le_prod (fun _ _ ↦ hr.le) hle -+ _ ≤ _ := Finset.prod_le_prod₀ (fun _ _ ↦ hr.le) hle - exact absurd h (not_lt.2 this) - - /-- **The preimage of a small neighbourhood off `t = 0` splits into `s` pieces.** Let `y'` be a -diff --git a/Oka/Analytification/RET/ES/CurveEtale.lean b/Oka/Analytification/RET/ES/CurveEtale.lean -index 1f1cd2b0a5ea2b932ae4ed78e97c6c11ba0671cf..d0efa5d5eace75f3f0da7be0822b314e89f41db1 100644 ---- a/Oka/Analytification/RET/ES/CurveEtale.lean -+++ b/Oka/Analytification/RET/ES/CurveEtale.lean -@@ -173,16 +173,18 @@ lemma exists_ltSeries_of_isIntegral (hinj : Function.Injective (algebraMap R S)) - (l : LTSeries (PrimeSpectrum R)) : - ∃ L : LTSeries (PrimeSpectrum S), L.length = l.length ∧ - L.last.asIdeal.comap (algebraMap R S) = l.last.asIdeal := by -+ have : FaithfulSMul R S := (faithfulSMul_iff_algebraMap_injective R S).mpr hinj - induction l using RelSeries.inductionOn' with - | singleton p => - obtain ⟨Q, -, hQ, hQp⟩ := Ideal.exists_ideal_over_prime_of_isIntegral p.asIdeal (⊥ : Ideal S) -- (by rw [← RingHom.ker_eq_comap_bot, (RingHom.injective_iff_ker_eq_bot _).1 hinj] -+ (by rw [Ideal.under_bot] - exact bot_le) - exact ⟨RelSeries.singleton _ ⟨Q, hQ⟩, rfl, hQp⟩ - | snoc l p hlp ih => - obtain ⟨L, hL, hLl⟩ := ih -+ have hLl' : Ideal.under R L.last.asIdeal = l.last.asIdeal := hLl - obtain ⟨Q, hQL, hQ, hQp⟩ := Ideal.exists_ideal_over_prime_of_isIntegral_of_isPrime -- p.asIdeal L.last.asIdeal (by rw [hLl]; exact le_of_lt hlp) -+ p.asIdeal L.last.asIdeal (by rw [hLl']; exact le_of_lt hlp) - have hlp' : l.last < p := hlp - have hlt : L.last < ⟨Q, hQ⟩ := lt_of_le_of_ne hQL fun h ↦ hlp'.ne (PrimeSpectrum.ext - (hLl.symm.trans ((congrArg (fun P : PrimeSpectrum S ↦ P.asIdeal.comap (algebraMap R S)) -@@ -211,8 +213,8 @@ theorem exists_finite_injective_of_ringKrullDim_eq_one {k A : Type*} [Field k] [ - letI := g.toRingHom.toAlgebra - haveI : Module.Finite (MvPolynomial (Fin s) k) A := hfin - have hdimP : ringKrullDim (MvPolynomial (Fin s) k) = s := by -- rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field, -- Nat.card_eq_fintype_card, Fintype.card_fin, zero_add] -+ rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field] -+ simp - have h1 := ringKrullDim_le_of_isIntegral (R := MvPolynomial (Fin s) k) (S := A) - have h2 := ringKrullDim_le_of_isIntegral_of_injective (R := MvPolynomial (Fin s) k) (S := A) - hinj -diff --git a/Oka/Analytification/RET/ES/CurveSections.lean b/Oka/Analytification/RET/ES/CurveSections.lean -index df0b02dc61ad7a8299c7f6e2fd8147131fed5625..9caecf1061ad875322897d1ce7f6b30880f6775c 100644 ---- a/Oka/Analytification/RET/ES/CurveSections.lean -+++ b/Oka/Analytification/RET/ES/CurveSections.lean -@@ -298,6 +298,34 @@ lemma eval_growthVal (f : W.presheaf.obj (op ⊤)) (k : ℕ) {V : (projectiveSpa - rw [growthVal, map_mul, eval_presheaf_map, eval_presheaf_map, - eval_c_app _ (toProjectiveLine ρ₀).isCLinear] - -+private lemma norm_eval_growthVal (f : W.presheaf.obj (op ⊤)) (k : ℕ) -+ {V : (projectiveSpaceAn.{u} 1).Opens} -+ (t : (pbTwist πP (twistCocycle.{u} k)).val.obj (op V)) (w : W) -+ (hw : (toProjectiveLine ρ₀).toLRSHom.base w ∈ V) -+ (hw1 : (toProjectiveLine ρ₀).toLRSHom.base w ∈ V ⊓ preimOpen πP (stdU 1)) : -+ ‖W.eval w hw (growthVal ρ₀ f k t)‖ = -+ ‖coord (ρ₀.toLRSHom.base w) ^ (-(k : ℤ))‖ * -+ ‖(projectiveSpaceAn.{u} 1).eval _ hw1 (pbComp t 1)‖ * -+ ‖W.eval (U := ⊤) w trivial f‖ := by -+ let z := coord (ρ₀.toLRSHom.base w) -+ let q := pointOfVec.{u} ![1, z] (by simp) -+ have hpt : (toProjectiveLine ρ₀).toLRSHom.base w = q := -+ chart_zero_eq_pointOfVec _ -+ have hp0 : (toProjectiveLine ρ₀).toLRSHom.base w ∈ V ⊓ preimOpen πP (stdU 0) := -+ ⟨hw, πP_chart_mem 0 _⟩ -+ have hq0 : q ∈ V ⊓ preimOpen πP (stdU 0) := hpt ▸ hp0 -+ have hq1 : q ∈ V ⊓ preimOpen πP (stdU 1) := hpt ▸ hw1 -+ have e0 := eval_pbComp_zero k t z hq0 hq1 -+ have echart : (projectiveSpaceAn.{u} 1).eval _ hp0 (pbComp t 0) = -+ z ^ (-(k : ℤ)) * (projectiveSpaceAn.{u} 1).eval _ hw1 (pbComp t 1) := -+ (eval_congr_point hpt hp0 hq0 (pbComp t 0)).trans -+ (e0.trans (congrArg (fun a : ℂ ↦ z ^ (-(k : ℤ)) * a) -+ (eval_congr_point hpt hw1 hq1 (pbComp t 1)).symm)) -+ have egrowth := (eval_growthVal ρ₀ f k t w hw).trans -+ (congrArg (fun a : ℂ ↦ a * W.eval (U := ⊤) w trivial f) echart) -+ exact (congrArg norm egrowth).trans ((norm_mul _ _).trans -+ (congrArg (· * ‖W.eval (U := ⊤) w trivial f‖) (norm_mul _ _))) -+ - lemma isBoundedNear_growthVal (f : W.presheaf.obj (op ⊤)) (k : ℕ) (C R : ℝ) (hR : 0 < R) - (hf : ∀ w : W, R < ‖coord (ρ₀.toLRSHom.base w)‖ → - ‖W.eval (U := ⊤) w trivial f‖ ≤ C * ‖coord (ρ₀.toLRSHom.base w)‖ ^ k) -@@ -317,18 +345,13 @@ lemma isBoundedNear_growthVal (f : W.presheaf.obj (op ⊤)) (k : ℕ) (C R : ℝ - set z := coord (ρ₀.toLRSHom.base w) - have hzR : R < ‖z‖ := (chart_zero_mem_nbd_iff hR _).1 hwN.2 - have hz0 : z ≠ 0 := norm_pos_iff.1 (hR.trans hzR) -- have hpt : (toProjectiveLine ρ₀).toLRSHom.base w = pointOfVec.{u} ![1, z] (by simp) := -- chart_zero_eq_pointOfVec _ - have hw1 : (toProjectiveLine ρ₀).toLRSHom.base w ∈ V ⊓ preimOpen πP (stdU 1) := by - refine ⟨hw, ?_⟩ - have := πP_chart_mem 1 (ofCoord z⁻¹) - rw [← chart_zero_eq_chart_one _ hz0] at this - exact this - have hbdt := hwN.1 ⟨_, hw1⟩ rfl -- rw [eval_growthVal] -- have e0 := eval_pbComp_zero k t z (hpt ▸ ⟨hw, πP_chart_mem 0 _⟩) (hpt ▸ hw1) -- rw [eval_congr_point hpt _ (hpt ▸ ⟨hw, πP_chart_mem 0 _⟩), e0, norm_mul, norm_mul, -- ← eval_congr_point hpt hw1 (hpt ▸ hw1)] -+ rw [norm_eval_growthVal ρ₀ f k t w hw hw1] - have hzk : ‖z ^ (-(k : ℤ))‖ * ‖z‖ ^ k = 1 := by - rw [norm_zpow, zpow_neg, zpow_natCast, inv_mul_cancel₀ (pow_ne_zero _ (norm_ne_zero_iff.2 hz0))] - calc ‖z ^ (-(k : ℤ))‖ * ‖(projectiveSpaceAn.{u} 1).eval _ hw1 (pbComp t 1)‖ * -@@ -386,13 +409,9 @@ lemma growthVal_res {V V' : (projectiveSpaceAn.{u} 1).Opens} (h : V' ≤ V) - · have := c_app_res (M := W.toLocallyRingedSpace) (toProjectiveLine ρ₀).toLRSHom - (inf_le_inf_right _ h : V' ⊓ preimOpen πP (stdU 0) ≤ V ⊓ preimOpen πP (stdU 0)) (pbComp t 0) - refine (congrArg (W.presheaf.map _).hom this).trans ?_ -- change W.presheaf.map _ (W.presheaf.map _ _) = W.presheaf.map _ (W.presheaf.map _ _) -- rw [← ConcreteCategory.comp_apply, ← ConcreteCategory.comp_apply, ← W.presheaf.map_comp, -- ← W.presheaf.map_comp] -- rfl -- · change _ = W.presheaf.map _ (W.presheaf.map _ f) -- rw [← ConcreteCategory.comp_apply, ← W.presheaf.map_comp] -- rfl -+ exact (res_res W.toLocallyRingedSpace _ _ (ρPull ρ₀ (pbComp t 0))).trans -+ (res_res W.toLocallyRingedSpace _ _ (ρPull ρ₀ (pbComp t 0))).symm -+ · exact (res_res W.toLocallyRingedSpace _ _ f).symm - - include hR hf in - /-- The section of the extension given by `t₀ · f`. -/ -diff --git a/Oka/Analytification/RET/ES/CurveSetup.lean b/Oka/Analytification/RET/ES/CurveSetup.lean -index ab3d6f13647c172f21ff20674d9988789f2e5a2f..8c31a79e2c9b84ee720797942c18f4ffad9b6e60 100644 ---- a/Oka/Analytification/RET/ES/CurveSetup.lean -+++ b/Oka/Analytification/RET/ES/CurveSetup.lean -@@ -117,15 +117,14 @@ lemma etale_restrictι_comp_toAffineSpace (f : Γ(V.obj.left, ⊤)) - (Scheme.ΓSpecIso (.of (MvPolynomial (Fin N) (ULift.{u} ℂ)))).inv _).1 - ((RingHom.Etale.respectsIso.cancel_right_isIso _ U.topIso.hom).1 ?_) - convert hf using 2 -- · rfl -- · refine RingHom.ext fun p ↦ ?_ -- change U.topIso.hom (U.ι.appTop ((SchemeLFTℂ.toAffineSpace s hs).hom.left.appTop -- ((Scheme.ΓSpecIso (.of (MvPolynomial (Fin N) (ULift.{u} ℂ)))).inv p))) = _ -- rw [SchemeLFTℂ.toAffineSpace_appTop] -- change (U.ι.appTop ≫ U.topIso.hom) (s p) = V.obj.left.presheaf.map _ (s p) -- rw [Scheme.Opens.ι_appTop, Scheme.Opens.topIso_hom] -- erw [← Functor.map_comp] -- rfl -+ refine RingHom.ext fun p ↦ ?_ -+ change U.topIso.hom (U.ι.appTop ((SchemeLFTℂ.toAffineSpace s hs).hom.left.appTop -+ ((Scheme.ΓSpecIso (.of (MvPolynomial (Fin N) (ULift.{u} ℂ)))).inv p))) = _ -+ rw [SchemeLFTℂ.toAffineSpace_appTop] -+ change (U.ι.appTop ≫ U.topIso.hom) (s p) = V.obj.left.presheaf.map _ (s p) -+ rw [Scheme.Opens.ι_appTop, Scheme.Opens.topIso_hom] -+ erw [← Functor.map_comp] -+ rfl - - end Etale - -diff --git a/Oka/Analytification/RET/ES/FiniteCoherent.lean b/Oka/Analytification/RET/ES/FiniteCoherent.lean -index 8a7bd9900ee3dee401920de065d542498da41e09..59834fd242ae5c33dfdb49bab139118fa01eb22e 100644 ---- a/Oka/Analytification/RET/ES/FiniteCoherent.lean -+++ b/Oka/Analytification/RET/ES/FiniteCoherent.lean -@@ -157,7 +157,7 @@ theorem isCoherent_pushUnit_analytification_map {Y S : SchemeLFTℂ.{u}} [IsAffi - simp [π, Fintype.linearCombination_apply, Algebra.smul_def, RingHom.algebraMap_toAlgebra] - · obtain ⟨x, rfl⟩ := (hbij s').2 z - obtain ⟨r, rfl⟩ := TensorProduct.exists_eq_sum_tmul_of_span_eq_top hb x -- exact ⟨r, by simp only [map_sum, pushforwardStalkTensorMap_tmul]; rfl⟩ -+ exact ⟨r, by simp only [map_sum, pushforwardStalkTensorMap_tmul]⟩ - · have h0 : pushforwardStalkTensorMap (analytification.map q) (analytificationΓ Y) - (analytificationΓ_naturality q) s' (∑ j, r j ⊗ₜ b j) = 0 := by - simp only [map_sum, pushforwardStalkTensorMap_tmul] -diff --git a/Oka/Analytification/RET/ES/NormalToSmooth.lean b/Oka/Analytification/RET/ES/NormalToSmooth.lean -index 89e66a7c9ceea3f8305196a9240f6535038fcecf..17e405dfbe767f501fa42224bed4c1f12bdfd762 100644 ---- a/Oka/Analytification/RET/ES/NormalToSmooth.lean -+++ b/Oka/Analytification/RET/ES/NormalToSmooth.lean -@@ -619,7 +619,6 @@ theorem bijective_res_of_isLocalIso (Ω : Z.Opens) : - refine (LocallyRingedSpace.res_res _ h₁ (hNΩ y hy.1) t).symm.trans ?_ - change Z.res h₁ (LocallyRingedSpace.sectRes (SheafOfModules.unit Z.ringSheaf) (hNΩ y hy.1) t) = _ - rw [ht, hu] -- rfl - end Sheet - - /-! ### Hartogs extension and normalisation -/ -diff --git a/Oka/Analytification/RET/ES/Normalization.lean b/Oka/Analytification/RET/ES/Normalization.lean -index 810f32cd7a3a30f17b5a1e44d39a8a85c04e2254..c53e2f27b06b041e8c92d987cca0be88aa4ad1da 100644 ---- a/Oka/Analytification/RET/ES/Normalization.lean -+++ b/Oka/Analytification/RET/ES/Normalization.lean -@@ -507,7 +507,11 @@ lemma surjective_specAlgebraHom (x : analytification.obj X) : - exact zero_mem _ - obtain ⟨q, -, hq, hqc⟩ := Ideal.exists_ideal_over_prime_of_isIntegral (affinePt x).asIdeal ⊥ hker - have hqm : q.IsMaximal := -- Ideal.isMaximal_of_isIntegral_of_isMaximal_comap q (by rw [hqc]; infer_instance) -+ Ideal.isMaximal_of_isIntegral_of_isMaximal_comap (algebraMap Γ(X.obj.left, ⊤) S) -+ (algebraMap_isIntegral_iff.mpr inferInstance) q (by -+ change (q.under Γ(X.obj.left, ⊤)).IsMaximal -+ rw [hqc] -+ infer_instance) - obtain ⟨y, hy⟩ := exists_specPt_eq (X := X) ⟨q, hq⟩ hqm - refine ⟨y, affinePt_injective ?_⟩ - rw [affinePt_specAlgebraHom, hy] -diff --git a/Oka/Analytification/RET/ES/ReflexiveHull.lean b/Oka/Analytification/RET/ES/ReflexiveHull.lean -index 554dea1b47636c108ba7fa7d9d9e6493ff81c936..105051040478dbff1661fa6a6544411e35cb6b7b 100644 ---- a/Oka/Analytification/RET/ES/ReflexiveHull.lean -+++ b/Oka/Analytification/RET/ES/ReflexiveHull.lean -@@ -294,7 +294,6 @@ def reflexiveHullData {U : (space N).Opens} (P : RegularPairFamily (img U : Set - τ_smul j V hV r a := by rw [mulSec_smul, trace_smul] - τ_res j V hV V' h a := by - rw [← sectRes_sectRes (boundedModule h₀ W) h hV, ← mulSec_map, trace_map] -- rfl - eq_zero_of_τ V hV a ha := eq_zero_of_trace_mulSec_eq_zero h₀ W hD P s - (fun y hy hyZ ↦ exists_span_of_isFreeSpanAt (hfree y hy fun h ↦ hyZ (hS h))) hV a ha - injective_res V hV := -diff --git a/Oka/Analytification/RET/ES/SmoothLocus.lean b/Oka/Analytification/RET/ES/SmoothLocus.lean -index 2e60cb37b692ff02841ec16207db3964879a58c7..09196574d7f84aea25f25f74b61050b3fab44885 100644 ---- a/Oka/Analytification/RET/ES/SmoothLocus.lean -+++ b/Oka/Analytification/RET/ES/SmoothLocus.lean -@@ -151,7 +151,7 @@ lemma exists_ringKrullDim_le_natCast (X : SchemeLFTℂ.{u}) [IsAffine X.obj.left - obtain ⟨k, f, hf⟩ := Algebra.FiniteType.iff_quotient_mvPolynomial''.mp - (inferInstance : Algebra.FiniteType ℂ Γ(X.obj.left, ⊤)) - refine ⟨k, (ringKrullDim_le_of_surjective f.toRingHom hf).trans_eq ?_⟩ -- rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field, zero_add, -+ rw [MvPolynomial.ringKrullDim_of_isNoetherianRing_of_finite, ringKrullDim_eq_zero_of_field, zero_add, - Nat.card_eq_fintype_card, Fintype.card_fin] - - /-- A nontrivial ring of dimension at most a natural number has dimension a natural number. -/ -diff --git a/Oka/Analytification/RET/ES/SmoothSections.lean b/Oka/Analytification/RET/ES/SmoothSections.lean -index c6fc7b660664da1ebc77c4120d2a7e56c2280cbe..9161b7eef76650d4b64b48f4b82fa9fbd724e84c 100644 ---- a/Oka/Analytification/RET/ES/SmoothSections.lean -+++ b/Oka/Analytification/RET/ES/SmoothSections.lean -@@ -473,13 +473,9 @@ lemma growthVal_res {V V' : (projectiveSpaceAn.{u} n).Opens} (h : V' ≤ V) - · have := c_app_res (M := W.toLocallyRingedSpace) (toProj ρ₀).toLRSHom - (inf_le_inf_right _ h : V' ⊓ preimOpen πP (stdU 0) ≤ V ⊓ preimOpen πP (stdU 0)) (pbComp t 0) - refine (congrArg (W.presheaf.map _).hom this).trans ?_ -- change W.presheaf.map _ (W.presheaf.map _ _) = W.presheaf.map _ (W.presheaf.map _ _) -- rw [← ConcreteCategory.comp_apply, ← ConcreteCategory.comp_apply, ← W.presheaf.map_comp, -- ← W.presheaf.map_comp] -- rfl -- · change _ = W.presheaf.map _ (W.presheaf.map _ f) -- rw [← ConcreteCategory.comp_apply, ← W.presheaf.map_comp] -- rfl -+ exact (res_res W.toLocallyRingedSpace _ _ (ρPull ρ₀ (pbComp t 0))).trans -+ (res_res W.toLocallyRingedSpace _ _ (ρPull ρ₀ (pbComp t 0))).symm -+ · exact (res_res W.toLocallyRingedSpace _ _ f).symm - - include hR hf in - /-- The section of the extension given by `t₀ · f`. -/ -diff --git a/Oka/Analytification/RET/ES/SmoothSetup.lean b/Oka/Analytification/RET/ES/SmoothSetup.lean -index f5303cbdb348140ce6f5f8629a36ae0018566c00..c192325f00bad81579d32a3732d9bc496ad891aa 100644 ---- a/Oka/Analytification/RET/ES/SmoothSetup.lean -+++ b/Oka/Analytification/RET/ES/SmoothSetup.lean -@@ -48,7 +48,7 @@ theorem exists_finite_injective_of_ringKrullDim_eq {k A : Type*} [Field k] [Comm - letI := g.toRingHom.toAlgebra - haveI : Module.Finite (MvPolynomial (Fin s) k) A := hfin - have hdimP : ringKrullDim (MvPolynomial (Fin s) k) = s := by -- rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field, -+ rw [MvPolynomial.ringKrullDim_of_isNoetherianRing_of_finite, ringKrullDim_eq_zero_of_field, - Nat.card_eq_fintype_card, Fintype.card_fin, zero_add] - have h1 := ringKrullDim_le_of_isIntegral (R := MvPolynomial (Fin s) k) (S := A) - have h2 := ringKrullDim_le_of_isIntegral_of_injective (R := MvPolynomial (Fin s) k) (S := A) -diff --git a/Oka/CategoryTheory/GlueData.lean b/Oka/CategoryTheory/GlueData.lean -index 850eece1ecb877738a92c5f04bca8f077ea535c1..abec33f687ac099fb2322275fa2c3be21cc1af5d 100644 ---- a/Oka/CategoryTheory/GlueData.lean -+++ b/Oka/CategoryTheory/GlueData.lean -@@ -233,7 +233,7 @@ theorem GlueData.ofGlueData'_comm {Y : C} (fY : ∀ i, D.U i ⟶ Y) - rcases eq_or_ne i j with rfl | hij - · rw [GlueData.ofGlueData'_f_self, GlueData.ofGlueData'_t_self] - simp -- · rw [← Category.assoc, GlueData.ofGlueData'_t_comp_f_of_ne D hij, -+ · erw [← Category.assoc, GlueData.ofGlueData'_t_comp_f_of_ne D hij, - GlueData.ofGlueData'_f_of_ne D hij] - dsimp only [GlueData.ofGlueData'] - rw [Category.assoc, Category.assoc, cancel_epi, Category.assoc] -@@ -253,7 +253,7 @@ theorem GlueData.comm_of_ofGlueData'_comm {Y : C} (fY : ∀ i, D.U i ⟶ Y) - {i j : D.J} (hij : i ≠ j) : - D.f i j hij ≫ fY i = D.t i j hij ≫ D.f j i hij.symm ≫ fY j := by - have hij' := h i j -- rw [← Category.assoc, GlueData.ofGlueData'_t_comp_f_of_ne D hij, -+ erw [← Category.assoc, GlueData.ofGlueData'_t_comp_f_of_ne D hij, - GlueData.ofGlueData'_f_of_ne D hij] at hij' - dsimp only [GlueData.ofGlueData'] at hij' - rw [Category.assoc, Category.assoc, cancel_epi, Category.assoc] at hij' -diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace.lean -index cbaafe504f2ecccafef096383cbcf4420f804956..3040fbcf45bf5ef15160f54058407d35989ffc7c 100644 ---- a/Oka/Geometry/RingedSpace/LocallyRingedSpace.lean -+++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace.lean -@@ -294,6 +294,7 @@ lemma restrictStalkIso_hom_stalkAlgMap {R : Type*} [NonAssocSemiring R] - (X.restrictStalkIso U.isOpenEmbedding x).hom - ((X.restrict U.isOpenEmbedding).stalkAlgMap (X.resAlgMap α U) x c) = - X.stalkAlgMap α x.1 c := by -+ change U at x - change (X.restrictStalkIso U.isOpenEmbedding x).hom - ((X.restrict U.isOpenEmbedding).presheaf.germ ⊤ x trivial - ((X.presheaf.map (homOfLE le_top).op).hom (α c))) = _ -@@ -432,6 +433,7 @@ lemma germ_Γ_map_ofRestrict (X : LocallyRingedSpace.{u}) (U : Opens X) - ((X.restrict U.isOpenEmbedding).presheaf.germ ⊤ x trivial - ((Γ.map (X.ofRestrict U.isOpenEmbedding).op).hom s)) = - X.presheaf.germ ⊤ x.1 trivial s := by -+ change U at x - rw [Γ_map_ofRestrict_apply, restrictStalkIso_hom_eq_germ_apply] - exact X.presheaf.germ_res_apply (homOfLE le_top) x.1 _ s - -@@ -510,7 +512,7 @@ lemma germ_eq_stalkMap_ofRestrict (X : LocallyRingedSpace.{u}) (U : Opens X) - (homOfLE (U.isOpenEmbedding.isOpenMap.adjunction.unit.app O).le) w hO _) - refine congrArg ((X.restrict U.isOpenEmbedding).presheaf.germ O w hO) ?_ - change b = (X.presheaf.map _).hom ((X.presheaf.map _).hom b) -- rw [← ConcreteCategory.comp_apply, ← X.presheaf.map_comp] -+ erw [← ConcreteCategory.comp_apply, ← X.presheaf.map_comp] - exact (hid _).symm - - /-- `germ_eq_stalkMap_ofRestrict` at the top open, for a section written as a -@@ -673,7 +675,7 @@ lemma resAlgMap_eq_comp {R : Type*} [NonAssocSemiring R] (α : R →+* X.preshea - RingHom.ext fun c ↦ by - change (X.presheaf.map _).hom _ = (X.presheaf.map _).hom ((X.presheaf.map _).hom (α c)) - change _ = ((X.presheaf.map _) ≫ (X.presheaf.map _)).hom _ -- rw [← X.presheaf.map_comp] -+ erw [← X.presheaf.map_comp] - congr 2 - - section GlueAlgMap -@@ -718,7 +720,7 @@ lemma resAlgMap_glueAlgMap (i : ι) : - change (X.presheaf.map _).hom _ = (X.presheaf.map _).hom ((α i) c) - rw [← map_glueAlgMap hU α h i c] - change _ = ((X.presheaf.map _) ≫ (X.presheaf.map _)).hom _ -- rw [← X.presheaf.map_comp] -+ erw [← X.presheaf.map_comp] - congr 2 - - end GlueAlgMap -@@ -932,7 +934,8 @@ lemma exists_localLift_family (hsurj : ∀ x, Function.Surjective (i.stalkMap x) - ⟨hx, Set.mem_iInter.2 hxB⟩, fun j ↦ ?_⟩ - rw [c_app_res] - have h1 := congrArg (M.res (hB'j j)) (hres j) -- simp only [res_res] at h1 ⊢ -+ simp only [res_res] at h1 -+ erw [res_res] - exact h1 - - end LocalModel -diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleOpenEmbedding.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleOpenEmbedding.lean -index c13cca0af65e6aabe5d8da5ff556d645ee89ef62..f292e79aad03fe01a387d0a21341a56c2486d5df 100644 ---- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleOpenEmbedding.lean -+++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleOpenEmbedding.lean -@@ -251,7 +251,9 @@ theorem hasLocalModuleRelationsAt {z : Z} (hK : HasLocalModuleRelationsAt K z) : - let a' : Fin m → Z.presheaf.obj (op (C.pre W₁)) := fun i ↦ C.ψ (C.pre W₁) (Y.res hW₁e.le (a i)) - have ha' : ∑ i, a' i • sectRes K (hpre.trans hW'V) (f' i) = 0 := by - have := congrArg (fun s ↦ C.φ (C.pre W₁) (sectRes M hW₁e.le s)) ha -- simp only [sectRes_sum, sectRes_smul, C.φ_sum, sectRes_zero, map_zero] at this -+ simp only [sectRes_sum, sectRes_smul, C.φ_sum, sectRes_zero] at this -+ have hzero : C.φ (C.pre W₁) 0 = 0 := (C.φ (C.pre W₁)).map_zero -+ rw [hzero] at this - rw [← this] - refine Finset.sum_congr rfl fun i _ ↦ ?_ - rw [C.φ_smul, sectRes_sectRes, C.φ_sectRes_sectRes _ (hpre.trans hW'V) hVe.le] -diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleSections.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleSections.lean -index 67de23265671ee899a5af4b661675acde8970d8d..c61b5b8108007c7c7459ebd6cca5d69171428db4 100644 ---- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleSections.lean -+++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleSections.lean -@@ -169,7 +169,6 @@ theorem hasLocalModuleRelations_of_isCoherent [M.IsCoherent] : HasLocalModuleRel - refine (key Z' b).trans (Eq.trans ?_ hrel) - refine Finset.sum_congr rfl (fun i _ ↦ ?_) - simp only [b, freeEval_freeEvalSymm] -- rfl - obtain ⟨n, hn⟩ := hlift (op Z') b hb - obtain ⟨S, hS, hS'⟩ := hs a Z' (Over.homMk (homOfLE hW') (Subsingleton.elim _ _)) n - rw [GrothendieckTopology.mem_over_iff] at hS -diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentPushforwardClosedEmbedding.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentPushforwardClosedEmbedding.lean -index 50c1e96197465808bd065e51dd056b87d17a2b93..af3ce55bab52e432570e82a5447fb45f9f1dd3b0 100644 ---- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentPushforwardClosedEmbedding.lean -+++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentPushforwardClosedEmbedding.lean -@@ -355,9 +355,7 @@ lemma Hom.hasLocalModuleRelations_pushforward_of_mem (hf : IsClosedEmbedding f.b - erw [map_sub, map_sum, sub_eq_zero] - refine Eq.trans ?_ (e₂.trans (Finset.sum_congr rfl fun l _ ↦ ?_)) - · erw [Hom.c_app_res] -- rfl - · erw [map_mul, Hom.c_app_res, Hom.c_app_res, hc3, hd, res_res, res_res] -- rfl - -- Step 2: the remainder is locally a combination of the `h_j` - have hy'WI : y' ∈ WI := hWWI (hW' hy') - let b : Fin m → Y.presheaf.obj (op W4) := fun i ↦ Y.res h4 (a i) - -diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/HomSheafCoherent.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/HomSheafCoherent.lean -index fb2ad81de60335236986de07b9f65b27cde369b7..5e6457c2fa7e9c37867489314b79903a9057e60b 100644 ---- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/HomSheafCoherent.lean -+++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/HomSheafCoherent.lean -@@ -90,7 +90,10 @@ def homSheafBiprodIso (A B : SheafOfModules.{u} Y.ringSheaf) : - inr_fst := by rw [← homSheafMap_comp, biprod.inl_snd, homSheafMap_zero] - inr_snd := by rw [← homSheafMap_comp, biprod.inr_snd, homSheafMap_id] } - (by -- dsimp -+ change homSheafMap G (biprod.inl : A ⟶ A ⊞ B) ≫ -+ homSheafMap G (biprod.fst : A ⊞ B ⟶ A) + -+ homSheafMap G (biprod.inr : B ⟶ A ⊞ B) ≫ -+ homSheafMap G (biprod.snd : A ⊞ B ⟶ B) = 𝟙 (homSheaf (A ⊞ B) G) - rw [← homSheafMap_comp G biprod.fst biprod.inl, ← homSheafMap_comp G biprod.snd biprod.inr, - ← homSheafMap_add, biprod.total, homSheafMap_id])) - -diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/Modules.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/Modules.lean -index 6d24d3bd90eb97ba8a0d60eec06f5517462a125f..71e83aa11c65abbe4699efcdee9586416d06d42d 100644 ---- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/Modules.lean -+++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/Modules.lean -@@ -134,6 +134,16 @@ noncomputable def Hom.toRingSheafHom {X : LocallyRingedSpace.{u}} (f : X ⟶ Y) - RingCat.{u} _ _).obj X.ringSheaf where - hom := Functor.whiskerRight f.c _ - -+instance isRightAdjoint_pushforwardModules {X : LocallyRingedSpace.{u}} (f : X ⟶ Y) : -+ (SheafOfModules.pushforward.{u} f.toRingSheafHom).IsRightAdjoint := by -+ let φ : Y.ringSheaf ⟶ ((Opens.map f.base).sheafPushforwardContinuous -+ RingCat.{u} _ _).obj X.ringSheaf := f.toRingSheafHom -+ let : (PresheafOfModules.pushforward.{u} φ.hom).IsRightAdjoint := -+ CategoryTheory.Functor.isRightAdjoint_of_leftAdjointObjIsDefined_eq_top -+ (PresheafOfModules.pullbackObjIsDefined_eq_top -+ (F := Opens.map f.base) (R := X.ringSheaf.obj) φ.hom) -+ exact (SheafOfModules.PullbackConstruction.adjunction.{u} φ).isRightAdjoint -+ - variable {Y} in - /-- **Pullback of `𝒪`-modules along a morphism of locally ringed spaces.** - -diff --git a/Oka/Geometry/RingedSpace/ZeroLocus.lean b/Oka/Geometry/RingedSpace/ZeroLocus.lean -index a91f2e3a06bc79c15ebf6482a55919a21a2474aa..dcd61241e002bed47d0d244fe0687eab5b85effe 100644 ---- a/Oka/Geometry/RingedSpace/ZeroLocus.lean -+++ b/Oka/Geometry/RingedSpace/ZeroLocus.lean -@@ -278,7 +278,7 @@ theorem stalkMap_zeroLocusιHom (z : Y.zeroLocusSpace f) : - -- `TopCat.Presheaf` is a `def`, so `rw` refuses to look inside its category instance; `erw` - -- does. The final `rfl` is `stalkPullbackHom` unfolding to its definition. - erw [Functor.map_comp, Functor.map_comp, Functor.map_comp] -- rw [Category.assoc, Category.assoc, Category.assoc] -+ erw [Category.assoc, Category.assoc, Category.assoc] - erw [TopCat.Presheaf.stalkPushforward_naturality] - rfl - -@@ -325,9 +325,14 @@ modulo the ideal generated by the germs of the `f i`. -/ - def zeroLocusStalkQuotientEquiv (z : Y.zeroLocusSpace f) : - (Y.presheaf.stalk (Y.zeroLocusι f z) ⧸ - Ideal.span (Set.range fun i ↦ Y.presheaf.Γgerm (Y.zeroLocusι f z) (f i))) ≃+* -- (Y.zeroLocusPresheaf f).stalk z := -- (Ideal.quotEquivOfEq (Y.ker_stalkMap_zeroLocusιHom f z).symm).trans -- (RingHom.quotientKerEquivOfSurjective (Y.surjective_stalkMap_zeroLocusιHom f z)) -+ (Y.zeroLocusPresheaf f).stalk z := by -+ let q : Y.presheaf.stalk (Y.zeroLocusι f z) →+* (Y.zeroLocusPresheaf f).stalk z := -+ ((Y.zeroLocusιHom f).stalkMap z).hom -+ have hker : RingHom.ker q = -+ Ideal.span (Set.range fun i ↦ Y.presheaf.Γgerm (Y.zeroLocusι f z) (f i)) := -+ Y.ker_stalkMap_zeroLocusιHom f z -+ have hsurj : Function.Surjective q := Y.surjective_stalkMap_zeroLocusιHom f z -+ exact (Ideal.quotEquivOfEq hker.symm).trans (RingHom.quotientKerEquivOfSurjective hsurj) - - /-- The stalks of the structure sheaf of the zero locus are nonzero rings. -/ - instance nontrivial_zeroLocusPresheaf_stalk (z : Y.zeroLocusSpace f) : -diff --git a/Oka/LocalOkaRing.lean b/Oka/LocalOkaRing.lean -index eb90e4f2cb26c1972f2d281c91c366fa1b485ec1..e1eee2176b31a391fbb8fe5d8917cb3015eacba6 100644 ---- a/Oka/LocalOkaRing.lean -+++ b/Oka/LocalOkaRing.lean -@@ -304,7 +304,7 @@ omit [Fintype ι] in - lemma norm_evalMonomial_le (h : ∀ i, ‖x i‖ ≤ ‖y i‖) (d : ι →₀ ℕ) : - ‖evalMonomial d x‖ ≤ ‖evalMonomial d y‖ := by - simp only [evalMonomial, Finsupp.prod, norm_prod, norm_pow] -- exact Finset.prod_le_prod (fun i _ ↦ by positivity) -+ exact Finset.prod_le_prod₀ (fun i _ ↦ by positivity) - fun i _ ↦ pow_le_pow_left₀ (norm_nonneg _) (h i) _ - - omit [Fintype ι] in -@@ -418,7 +418,7 @@ lemma norm_monomialCMM_le (d : ι →₀ ℕ) (n : ℕ) : ‖monomialCMM d n‖ - rw [one_mul, ContinuousMultilinearMap.compContinuousLinearMap_apply, - ContinuousMultilinearMap.mkPiAlgebra_apply, norm_prod] - simp only [ContinuousLinearMap.proj_apply] -- exact Finset.prod_le_prod (fun _ _ ↦ norm_nonneg _) fun k _ ↦ norm_le_pi_norm _ _ -+ exact Finset.prod_le_prod₀ (fun _ _ ↦ norm_nonneg _) fun k _ ↦ norm_le_pi_norm _ _ - · simp - - variable (P) in -@@ -565,7 +565,7 @@ lemma norm_fpsCoeff_le (p : FormalMultilinearSeries ℂ (ι → ℂ) ℂ) (n : - refine Finset.sum_le_sum fun s _ ↦ ?_ - refine ((p n).le_opNorm _).trans ?_ - refine mul_le_of_le_one_right (norm_nonneg _) ?_ -- exact Finset.prod_le_one (fun _ _ ↦ norm_nonneg _) fun k _ ↦ norm_basisVec_le _ -+ exact Finset.prod_le_one₀ (fun _ _ ↦ norm_nonneg _) fun k _ ↦ norm_basisVec_le _ - - lemma sum_card_fibers (n : ℕ) : - ∑ d ∈ degFinset ι n, ((tupleFinset n d).card : ℝ) = (Fintype.card ι : ℝ) ^ n := by -@@ -578,7 +578,7 @@ lemma norm_evalMonomial_le_pow {ρ : ℝ} {y : ι → ℂ} (hy : ‖y‖ ≤ ρ) - (hd : d ∈ degFinset ι n) : ‖evalMonomial d y‖ ≤ ρ ^ n := by - have h1 : ∀ i, ‖y i‖ ≤ ρ := fun i ↦ (norm_le_pi_norm y i).trans hy - rw [norm_evalMonomial, ← mem_degFinset.mp hd, ← Finset.prod_pow_eq_pow_sum] -- exact Finset.prod_le_prod (fun i _ ↦ by positivity) -+ exact Finset.prod_le_prod₀ (fun i _ ↦ by positivity) - fun i _ ↦ pow_le_pow_left₀ (norm_nonneg _) (h1 i) _ - - /-- Absolute convergence can be checked after regrouping by total degree. -/ -@@ -802,7 +802,7 @@ theorem eq_zero_of_represents_zero [Finite ι] {R : MvPowerSeries ι ℂ} (hR : - refine MvPolynomial.funext fun y ↦ ?_ - rw [map_zero, map_sum] - simpa [MvPolynomial.eval_monomial, evalMonomial] using hall (∑ i, d i) y -- have h3 := congrArg (MvPolynomial.coeff d) hΦ -+ have h3 := congrArg (fun p : MvPolynomial ι ℂ ↦ p.coeff d) hΦ - rw [MvPolynomial.coeff_sum] at h3 - simp only [MvPolynomial.coeff_monomial, MvPolynomial.coeff_zero] at h3 - rw [Finset.sum_ite_eq' (degFinset ι (∑ i, d i)) d (fun e ↦ coeff e R)] at h3 -diff --git a/Oka/Nullstellensatz/Germ.lean b/Oka/Nullstellensatz/Germ.lean -index 9c3d3babe4e2f03cfb934f671a57c00197c8668f..a630f76a02023e4cb32970d26d51ecfb15ea43db 100644 ---- a/Oka/Nullstellensatz/Germ.lean -+++ b/Oka/Nullstellensatz/Germ.lean -@@ -62,7 +62,7 @@ theorem exists_incl_sub_mul_mem {W : (LocalOkaRing (Fin n))[X]} - (Ideal.Quotient.factorₐ (LocalOkaRing (Fin n)) hle).toLinearMap - (Ideal.Quotient.factor_surjective hle) - have hint : IsIntegral (LocalOkaRing (Fin n)) (Ideal.Quotient.mk P g) := -- Algebra.IsIntegral.isIntegral _ -+ IsIntegral.of_finite _ _ - have hne : Ideal.Quotient.mk P g ≠ 0 := by rwa [Ne, Ideal.Quotient.eq_zero_iff_mem] - have hlt := Ideal.comap_lt_comap_of_integral_mem_sdiff (R := LocalOkaRing (Fin n)) - (I := (⊥ : Ideal (LocalOkaRing (Fin (n + 1)) ⧸ P))) -diff --git a/Oka/OkaLemma.lean b/Oka/OkaLemma.lean -index e17e8fa32fdd36fb3f5750413c3146acc734e7f2..1e06a52aa9232b16a68b1d800a0f478a40601c7b 100644 ---- a/Oka/OkaLemma.lean -+++ b/Oka/OkaLemma.lean -@@ -167,10 +167,11 @@ lemma mapDomain_finInit_add_single_last (u : Fin (n + 1) →₀ ℕ) : - ext j - induction j using Fin.lastCases with - | last => -- rw [Finsupp.add_apply, Finsupp.mapDomain_notin_range _ _ (by simp), -+ rw [Finsupp.add_apply, Finsupp.mapDomain_of_notMem_range _ _ (by simp), - Finsupp.single_eq_same, zero_add] - | cast i => -- rw [Finsupp.add_apply, Finsupp.mapDomain_apply (Fin.castSucc_injective n), finInit_apply] -+ rw [Finsupp.add_apply, Finsupp.mapDomain_apply_of_injective (Fin.castSucc_injective n), -+ finInit_apply] - simp [(Fin.castSucc_lt_last i).ne] - - /-- The coefficients of `MvPowerSeries.fromPolynomial' Q` at an arbitrary exponent. -/ -diff --git a/Oka/RingTheory/IntegralClosureEtale.lean b/Oka/RingTheory/IntegralClosureEtale.lean -index 22d620ad0eed1f59e3d12d8706f3b7f5c5e7b1f0..37b331c92c9c51497a6e815ff6c4cb90cc8ccc30 100644 ---- a/Oka/RingTheory/IntegralClosureEtale.lean -+++ b/Oka/RingTheory/IntegralClosureEtale.lean -@@ -87,8 +87,7 @@ theorem exists_algebraMap_eq_of_isIntegral_tensor [Algebra.Smooth R S] - (congrArg Subtype.val ht).symm - rw [hy'] - clear ht hy' -- induction t with -- | zero => exact ⟨0, by simp⟩ -+ induction t using TensorProduct.inductionOn with - | add x y hx hy => - obtain ⟨a, ha⟩ := hx - obtain ⟨b, hb⟩ := hy -diff --git a/Oka/RingTheory/MilnorPatching.lean b/Oka/RingTheory/MilnorPatching.lean -index ef94de2518e2352d530fbfeeb8fde8803bf0a1b7..4edb36e268453696d149d78197669d80146167d5 100644 ---- a/Oka/RingTheory/MilnorPatching.lean -+++ b/Oka/RingTheory/MilnorPatching.lean -@@ -244,7 +244,6 @@ include hφ in - lemma surjective_of_isBaseChange : Function.Surjective φ := by - intro y - induction y using hφ.inductionOn with -- | zero => exact ⟨0, map_zero φ⟩ - | tmul m => exact ⟨m, rfl⟩ - | smul s n hn => - obtain ⟨m, rfl⟩ := hn -@@ -310,7 +309,6 @@ lemma mem_span_range_fst (p : P) : - exact Submodule.smul_mem _ s hx - have hq : φ p ∈ Submodule.span (S ⧸ I.map (algebraMap R S)) (Set.range ψ) := by - induction φ p using hψ.inductionOn with -- | zero => exact zero_mem _ - | tmul m => exact Submodule.subset_span ⟨m, rfl⟩ - | smul s n hn => exact Submodule.smul_mem _ s hn - | add n₁ n₂ h₁ h₂ => exact add_mem h₁ h₂ -diff --git a/Oka/RingTheory/MvPolynomial/LaurentAway.lean b/Oka/RingTheory/MvPolynomial/LaurentAway.lean -index 88222b85c4cbfe701696f5ee995643a918e53037..b2f15d3d79d4197f3dca8719c49c249ba766eed3 100644 ---- a/Oka/RingTheory/MvPolynomial/LaurentAway.lean -+++ b/Oka/RingTheory/MvPolynomial/LaurentAway.lean -@@ -86,8 +86,7 @@ lemma toLaurent_apply (p : MvPolynomial ι R) : toLaurent ι R p = mapDomain exp - - lemma coeff_toLaurent_expInt (p : MvPolynomial ι R) (e : ι →₀ ℕ) : - (toLaurent ι R p).coeff (expInt e) = p.coeff e := by -- rw [toLaurent_apply, coeff_mapDomain, Finsupp.mapDomain_apply expInt_injective] -- rfl -+ rw [toLaurent_apply, coeff_mapDomain, Finsupp.mapDomain_apply_of_injective expInt_injective] - - lemma coeff_toLaurent_eq_zero (p : MvPolynomial ι R) {a : ι →₀ ℤ} (ha : ¬ ∀ j, 0 ≤ a j) : - (toLaurent ι R p).coeff a = 0 := by -diff --git a/Oka/RingTheory/MvPolynomial/Localization.lean b/Oka/RingTheory/MvPolynomial/Localization.lean -index eadf5f3f75d156a3e2d13b0f324d502f614469d0..75ac33618a8ace657f0ec9458095bd494e4452bb 100644 ---- a/Oka/RingTheory/MvPolynomial/Localization.lean -+++ b/Oka/RingTheory/MvPolynomial/Localization.lean -@@ -185,7 +185,7 @@ theorem awayLift_awayBaseHom (a : MvPolynomial σ R ⧸ I) : - obtain ⟨p, rfl⟩ := Ideal.Quotient.mk_surjective a - have h := congrArg (fun φ : MvPolynomial σ R →ₐ[R] _ ↦ φ p) (awayAeval_comp_rename I f) - simp only [AlgHom.coe_comp, Function.comp_apply] at h -- simpa [awayLift, awayBaseHom] using h -+ exact h - - theorem awayLift_comp_awayInv : (awayLift I f).comp (awayInv I f) = AlgHom.id R _ := by - ext a -@@ -202,8 +202,14 @@ theorem awayInv_comp_awayLift : (awayInv I f).comp (awayLift I f) = AlgHom.id R - exact congrFun (congrArg DFunLike.coe h) p - apply MvPolynomial.algHom_ext - rintro (_ | i) -- · simp [awayLift, awayAeval, awayInv_invSelf] -- · simp [awayLift, awayAeval, awayInv_algebraMap, awayBaseHom] -+ · simp only [AlgHom.coe_comp, Function.comp_apply, Ideal.Quotient.mkₐ_eq_mk, -+ awayLift, Ideal.Quotient.liftₐ_apply] -+ erw [Ideal.Quotient.lift_mk] -+ simp [awayAeval, awayInv_invSelf] -+ · simp only [AlgHom.coe_comp, Function.comp_apply, Ideal.Quotient.mkₐ_eq_mk, -+ awayLift, Ideal.Quotient.liftₐ_apply] -+ erw [Ideal.Quotient.lift_mk] -+ simp [awayAeval, awayInv_algebraMap, awayBaseHom] - - /-- **The isomorphism with `Localization.Away`**, over `R`. This is the shape a consumer that - renames variables wants; `MvPolynomial.isLocalization_away_quotient_awayIdeal` is the shape a -diff --git a/Oka/RingTheory/SmoothCodimOne.lean b/Oka/RingTheory/SmoothCodimOne.lean -index b8bcdd3d26553ed2d056f92b823260a8c8f3fa0d..6983111ee22074dbd8f1abf53f03cc36488a2b2a 100644 ---- a/Oka/RingTheory/SmoothCodimOne.lean -+++ b/Oka/RingTheory/SmoothCodimOne.lean -@@ -80,7 +80,7 @@ theorem isSmoothAt_of_ringKrullDim_le_one {K A : Type*} [Field K] [CharZero K] [ - haveI : Ring.DimensionLEOne S := - ⟨fun hp hp' ↦ Ring.krullDimLE_one_iff_of_isPrime_bot.mp inferInstance _ hp hp'⟩ - haveI : IsDedekindDomain S := {} -- obtain ⟨ϖ, hϖ⟩ := ((IsDiscreteValuationRing.TFAE S hS).out 2 4).mp ‹IsDedekindDomain S› -+ obtain ⟨ϖ, hϖ⟩ := ((IsDiscreteValuationRing.TFAE S hS).out 3 5).mp ‹IsDedekindDomain S› - obtain ⟨a, s, rfl⟩ := IsLocalization.exists_mk'_eq q.primeCompl ϖ - have hm : maximalIdeal S = Ideal.span {algebraMap A S a} := by - rw [hϖ, Ideal.submodule_span_eq, IsLocalization.mk'_eq_mul_mk'_one, -diff --git a/Oka/Topology/Sheaves/Cohomology/ClosedEmbedding.lean b/Oka/Topology/Sheaves/Cohomology/ClosedEmbedding.lean -index 4ec3d7043c0523150fc12e8c8d9574317675f9ea..06ce561ad0ab99e36d9e3d1c39d49851d3f84fde 100644 ---- a/Oka/Topology/Sheaves/Cohomology/ClosedEmbedding.lean -+++ b/Oka/Topology/Sheaves/Cohomology/ClosedEmbedding.lean -@@ -118,7 +118,7 @@ theorem map_exact_pushforwardAb (hf : IsClosedEmbedding f) (S : ShortComplex (Ab - /-- Pushforward along a closed embedding preserves finite limits and finite colimits. -/ - theorem preservesFiniteLimitsAndColimits_pushforwardAb (hf : IsClosedEmbedding f) : - PreservesFiniteLimits (pushforwardAb f) ∧ PreservesFiniteColimits (pushforwardAb f) := -- ((Functor.exact_tfae (pushforwardAb f)).out 1 3).1 (map_exact_pushforwardAb hf) -+ ((Functor.exact_tfae (pushforwardAb f)).out 2 4).1 (map_exact_pushforwardAb hf) - - /-- **Pushforward along a closed embedding preserves finite colimits.** -/ - theorem preservesFiniteColimits_pushforwardAb (hf : IsClosedEmbedding f) : -diff --git a/Oka/Topology/Sheaves/Cohomology/MayerVietoris.lean b/Oka/Topology/Sheaves/Cohomology/MayerVietoris.lean -index e66d8343132ec9ac44817c1bd3f2a8a26c6b99e1..5b481b1e326399dfde46b19b5bee0e3439b2e79f 100644 ---- a/Oka/Topology/Sheaves/Cohomology/MayerVietoris.lean -+++ b/Oka/Topology/Sheaves/Cohomology/MayerVietoris.lean -@@ -88,14 +88,12 @@ theorem extComparison_bijective - simp only [AddMonoidHom.coe_comp, Function.comp_apply, extComparison_apply, - AddCommGrpCat.hom_ofHom, Ext.postcomp, AddMonoidHom.flip_apply, - Ext.bilinearComp_apply_apply, Ext.mapExactFunctor_comp, Ext.mapExactFunctor_mk₀] -- erw [AddMonoidHom.flip_apply, Ext.bilinearComp_apply_apply] - exact Ext.comp_assoc_of_third_deg_zero _ _ _ _) - (by - ext x - simp only [AddMonoidHom.coe_comp, Function.comp_apply, extComparison_apply, - AddCommGrpCat.hom_ofHom, Ext.postcomp, AddMonoidHom.flip_apply, - Ext.bilinearComp_apply_apply, Ext.mapExactFunctor_comp, Ext.mapExactFunctor_extClass] -- erw [AddMonoidHom.flip_apply, Ext.bilinearComp_apply_apply] - exact Ext.comp_assoc _ _ _ (zero_add n) rfl (by omega)) - ((ShortComplex.ab_exact_iff_function_exact _).mp - (Ext.covariant_sequence_exact₃' Z hS n (n + 1) rfl)) -@@ -125,7 +123,9 @@ noncomputable def freeYonedaHomEquiv (B : AbSheaf X) : - lemma freeYonedaHomEquiv_comp {B B' : AbSheaf X} (x : freeYoneda U ⟶ B) (g : B ⟶ B') : - freeYonedaHomEquiv U B' (x ≫ g) = g.hom.app (op U) (freeYonedaHomEquiv U B x) := by - simp only [freeYonedaHomEquiv, Equiv.trans_apply] -- erw [Adjunction.homEquiv_naturality_right, Equiv.trans_apply] -+ rw [(sheafificationAdjunction _ _).homEquiv_naturality_right x g, -+ Adjunction.homEquiv_naturality_right, yonedaEquiv_comp] -+ rfl - - - /-- Morphisms out of `ℤ_Y` are global sections. -/ -diff --git a/Oka/Topology/Sheaves/Cohomology/MayerVietorisNatural.lean b/Oka/Topology/Sheaves/Cohomology/MayerVietorisNatural.lean -index d429c3076f4d3efc98ca2c3b2e3f24ff02f4c58c..7b26d4091f364a803957a2a34fdec4bf35e8d219 100644 ---- a/Oka/Topology/Sheaves/Cohomology/MayerVietorisNatural.lean -+++ b/Oka/Topology/Sheaves/Cohomology/MayerVietorisNatural.lean -@@ -98,7 +98,7 @@ lemma freeYonedaHomEquiv_incl_comp (h : V ≤ U) {B : AbSheaf X} (s : freeYoneda - B.obj.map (homOfLE h).op (freeYonedaHomEquiv U B s) := by - simp only [freeYonedaHomEquiv, incl, Equiv.trans_apply] - erw [Adjunction.homEquiv_naturality_left] -- erw [Equiv.trans_apply, Equiv.trans_apply, Adjunction.homEquiv_naturality_left] -+ erw [Adjunction.homEquiv_naturality_left] - exact (yonedaEquiv_naturality _ _).symm - - /-- `(ℤ[U] ⟶ B) ≃ B(U)` is evaluation at the canonical section of `ℤ[U]` over `U`. -/ -diff --git a/Oka/Topology/Sheaves/Cohomology/PushforwardAcyclic.lean b/Oka/Topology/Sheaves/Cohomology/PushforwardAcyclic.lean -index 93347d22054fef6aa2b36c779c75e457204d38eb..9bf1b273f3aa47740e6d647856c113b6d027f5d8 100644 ---- a/Oka/Topology/Sheaves/Cohomology/PushforwardAcyclic.lean -+++ b/Oka/Topology/Sheaves/Cohomology/PushforwardAcyclic.lean -@@ -360,7 +360,6 @@ lemma pullbackAb_map_pullbackPushforwardBaseChangeApp_comp_pushforwardCounit (G - symm - erw [Category.assoc, Category.assoc, ← n₁, ← Functor.map_comp_assoc, ← n₂, Functor.map_comp, - ← Category.assoc, ← Category.assoc, t, Category.id_comp] -- rfl - - /-- The pullback maps along the two composites of a commutative square `f' ≫ g = g' ≫ f` agree - up to `f'⁻¹ g⁻¹ F ⟶ g'⁻¹ f⁻¹ F`. -/ -diff --git a/Oka/Topology/Sheaves/QuotientPresheaf.lean b/Oka/Topology/Sheaves/QuotientPresheaf.lean -index eaae9c85d5347893c8677fd16faf3a8be457f1e5..235fa9056abcc9db6122b96449720442dbeb4d24 100644 ---- a/Oka/Topology/Sheaves/QuotientPresheaf.lean -+++ b/Oka/Topology/Sheaves/QuotientPresheaf.lean -@@ -189,10 +189,17 @@ generated by the `f i`. -/ - theorem ker_stalkFunctor_map_toQuotientSpan : - RingHom.ker ((stalkFunctor CommRingCat.{u} y).map (F.toQuotientSpan f)).hom = - Ideal.span (Set.range fun i ↦ F.Γgerm y (f i)) := by -+ let q : F.stalk y →+* (F.quotientSpan f).stalk y := -+ ((stalkFunctor CommRingCat.{u} y).map (F.toQuotientSpan f)).hom -+ change RingHom.ker q = Ideal.span (Set.range fun i ↦ F.Γgerm y (f i)) - apply le_antisymm - · intro t ht -+ have ht : q t = 0 := RingHom.mem_ker.mp ht - obtain ⟨U, hy, s, rfl⟩ := F.exists_germ_eq t -- rw [RingHom.mem_ker, stalkFunctor_map_germ_apply U y hy _ s] at ht -+ have hq : q (F.germ U y hy s) = -+ (F.quotientSpan f).germ U y hy ((F.toQuotientSpan f).app (op U) s) := -+ stalkFunctor_map_germ_apply U y hy _ s -+ rw [hq] at ht - have ht0 : (F.quotientSpan f).germ U y hy ((F.toQuotientSpan f).app (op U) s) = - (F.quotientSpan f).germ U y hy 0 := by rw [map_zero]; exact ht - obtain ⟨W, hyW, iU, iV, hW⟩ := (F.quotientSpan f).germ_eq y hy hy _ _ ht0 -@@ -210,19 +217,25 @@ theorem ker_stalkFunctor_map_toQuotientSpan : - have h0 : ((F.toQuotientSpan f).app (op ⊤)) (f i) = 0 := - (F.toQuotientSpan_app_eq_zero_iff f (f i)).2 (by simpa using F.res_mem_spanIdeal f ⊤ i) - refine RingHom.mem_ker.2 ?_ -- change ((stalkFunctor CommRingCat.{u} y).map (F.toQuotientSpan f)).hom -- (F.Γgerm y (f i)) = 0 -- rw [show F.Γgerm y (f i) = F.germ ⊤ y True.intro (f i) from rfl, -- stalkFunctor_map_germ_apply ⊤ y True.intro _ (f i), h0, map_zero] -- rfl -+ change q (F.Γgerm y (f i)) = 0 -+ calc -+ q (F.Γgerm y (f i)) = -+ (F.quotientSpan f).germ ⊤ y True.intro ((F.toQuotientSpan f).app (op ⊤) (f i)) := -+ stalkFunctor_map_germ_apply ⊤ y True.intro _ (f i) -+ _ = 0 := by rw [h0, map_zero] - - /-- The stalk of the quotient presheaf at `y` is the quotient of the stalk of `F` at `y` by the - ideal generated by the germs at `y` of the `f i`. -/ - noncomputable def stalkQuotientSpanEquiv : - (F.stalk y ⧸ Ideal.span (Set.range fun i ↦ F.Γgerm y (f i))) ≃+* -- (F.quotientSpan f).stalk y := -- (Ideal.quotEquivOfEq (F.ker_stalkFunctor_map_toQuotientSpan f y).symm).trans -- (RingHom.quotientKerEquivOfSurjective (F.surjective_stalkFunctor_map_toQuotientSpan f y)) -+ (F.quotientSpan f).stalk y := by -+ let q : F.stalk y →+* (F.quotientSpan f).stalk y := -+ ((stalkFunctor CommRingCat.{u} y).map (F.toQuotientSpan f)).hom -+ have hker : RingHom.ker q = Ideal.span (Set.range fun i ↦ F.Γgerm y (f i)) := -+ F.ker_stalkFunctor_map_toQuotientSpan f y -+ exact (Ideal.quotEquivOfEq hker.symm).trans -+ (RingHom.quotientKerEquivOfSurjective (show Function.Surjective q from -+ F.surjective_stalkFunctor_map_toQuotientSpan f y)) - - @[simp] - lemma stalkQuotientSpanEquiv_mk (t : F.stalk y) : -diff --git a/Oka/Topology/Sheaves/Stalks.lean b/Oka/Topology/Sheaves/Stalks.lean -index a1c31610e9fc3530826868f7ee7d6c04dfaf9eca..53b30d4e0ca4a41d637049bf2ef3fe8aa120ea9b 100644 ---- a/Oka/Topology/Sheaves/Stalks.lean -+++ b/Oka/Topology/Sheaves/Stalks.lean -@@ -47,8 +47,8 @@ lemma stalkPushforward_naturality {X Y : TopCat.{v}} (g : X ⟶ Y) {F G : X.Pres - refine TopCat.Presheaf.stalk_hom_ext ((pushforward C g).obj F) fun U hU ↦ ?_ - -- `rw` cannot see through the definition of `TopCat.Presheaf` here, hence `erw`. - erw [stalkFunctor_map_germ_assoc] -- simp only [pushforward_map_app, stalkFunctor_obj, stalkPushforward_germ, -- stalkPushforward_germ_assoc] -+ simp only [pushforward_map_app, stalkFunctor_obj, stalkPushforward_germ] -+ erw [stalkPushforward_germ_assoc] - exact (stalkFunctor_map_germ (C := C) ((Opens.map g).obj U) x hU T).symm - - /-- **The specialization map between the stalks at two points which are in fact equal is an -diff --git a/Oka/Uniformization/CoveringLift.lean b/Oka/Uniformization/CoveringLift.lean -index a5ccc621c90bc562cfa5525f2f2e7e3b6616027a..ef64822db3f38d25a0c2c8a452b3ea44149f85f9 100644 ---- a/Oka/Uniformization/CoveringLift.lean -+++ b/Oka/Uniformization/CoveringLift.lean -@@ -89,12 +89,12 @@ theorem IsCoveringMapOn.eqOn_of_lift {f : E → X} {V : Set X} (hf : IsCoveringM - ⟨σ₁ a₀, hV a₀ ha₀⟩ - have hτ₁ : ContinuousOn τ₁ D := by - rw [continuousOn_iff_continuous_restrict] -- have : D.restrict τ₁ = fun a : D ↦ ⟨σ₁ a, hV a a.2⟩ := by funext a; simp [τ₁, a.2] -+ have : D.domRestrict τ₁ = fun a : D ↦ ⟨σ₁ a, hV a a.2⟩ := by funext a; simp [τ₁, a.2] - rw [this] - exact (h₁.restrict).subtype_mk _ - have hτ₂ : ContinuousOn τ₂ D := by - rw [continuousOn_iff_continuous_restrict] -- have : D.restrict τ₂ = fun a : D ↦ ⟨σ₂ a, hV₂ a a.2⟩ := by -+ have : D.domRestrict τ₂ = fun a : D ↦ ⟨σ₂ a, hV₂ a a.2⟩ := by - funext a; simp [τ₂, a.2] - rw [this] - exact (h₂.restrict).subtype_mk _ -@@ -119,8 +119,8 @@ theorem eqOn_of_sections [T2Space E] {f : E → X} {V : Set X} (hV : IsPreconnec - (hinj : ∀ v ∈ V, ∃ W ∈ 𝓝 (s₁ v), InjOn f W) {v₀ : X} (hv₀ : v₀ ∈ V) - (h₀ : s₁ v₀ = s₂ v₀) : EqOn s₁ s₂ V := by - haveI : PreconnectedSpace V := Subtype.preconnectedSpace hV -- set g₁ : V → E := V.restrict s₁ -- set g₂ : V → E := V.restrict s₂ -+ set g₁ : V → E := V.domRestrict s₁ -+ set g₂ : V → E := V.domRestrict s₂ - have hg₁ : Continuous g₁ := h₁.restrict - have hg₂ : Continuous g₂ := h₂.restrict - set A : Set V := {v | g₁ v = g₂ v} -@@ -243,6 +243,6 @@ theorem isCoveringMapOn_of_sections [T2Space E] {f : E → X} {B : Set X} - have := hsame (i := i) ht htf x hxV (hsx i) - refine mem_iUnion.mpr ⟨i, f e, he, ?_⟩ - rw [this he, hte]) -- exact .to_isEvenlyCovered_preimage (.of_trivialization (t := T) (by simpa [T] using hxV)) -+ exact .to_isEvenlyCovered_preimage (.of_trivialization (t := T) hxV) - - end Uniformization -diff --git a/Oka/Uniformization/Depth.lean b/Oka/Uniformization/Depth.lean -index 14e263fde75c44a64a19af5f2712d44c44e87368..70965c1739ea09fd21e3885d327ce5671dcb8b45 100644 ---- a/Oka/Uniformization/Depth.lean -+++ b/Oka/Uniformization/Depth.lean -@@ -214,7 +214,8 @@ theorem relIndex_ne_zero_of_mem_commensurator {G : Type*} [Group G] {Γ : Subgro - (Γ ⊓ Γ.comap (MulAut.conj δ).toMonoidHom).relIndex Γ ≠ 0 := by - have hδ' : δ⁻¹ ∈ Subgroup.Commensurable.commensurator Γ := inv_mem hδ - rw [Subgroup.Commensurable.commensurator_mem_iff] at hδ' -- have h := hδ'.1 -+ have h := hδ'.1.relIndex_ne_zero -+ change (ConjAct.toConjAct δ⁻¹ • Γ).relIndex Γ ≠ 0 at h - have heq : (ConjAct.toConjAct δ⁻¹ • Γ : Subgroup G) ⊓ Γ = - Γ ⊓ Γ.comap (MulAut.conj δ).toMonoidHom := by - ext x -diff --git a/Oka/Uniformization/FEtTransitive.lean b/Oka/Uniformization/FEtTransitive.lean -index fee3b419f88285966fd31025b20f086f5346fad7..bf78ec61adbdbf0dff71fd857bce4d2dbf891d54 100644 ---- a/Oka/Uniformization/FEtTransitive.lean -+++ b/Oka/Uniformization/FEtTransitive.lean -@@ -235,7 +235,7 @@ theorem exists_smul_eq (hhol : ∀ a, Unif.HolH (ι₀ a)) {n : ℕ} - · refine (PolyBdd.prod S (u := fun _ τ ↦ 1 + R τ) (fun _ _ ↦ (PolyBdd.const 1).add hR) - fun _ _ τ ↦ by positivity).mono fun τ ↦ ?_ - refine (norm_coeff_prod_X_sub_C_le _ _ k).trans ?_ -- exact Finset.prod_le_prod (fun _ _ ↦ by positivity) fun f hf ↦ by linarith [hfR f hf τ] -+ exact Finset.prod_le_prod₀ (fun _ _ ↦ by positivity) fun f hf ↦ by linarith [hfR f hf τ] - choose a ha using hcoeff - set Q : A[X] := X ^ m + ∑ i : Fin m, C (a i) * X ^ (i : ℕ) - have hQm : Q.Monic := monic_X_pow_add (degree_sum_fin_lt _) -diff --git a/Oka/Uniformization/Integrality.lean b/Oka/Uniformization/Integrality.lean -index fd22073e989755defe2b3e014904682fb5d0fe10..0c55e5b1349c97d3215c969e913da79ac779ccfa 100644 ---- a/Oka/Uniformization/Integrality.lean -+++ b/Oka/Uniformization/Integrality.lean -@@ -202,6 +202,7 @@ theorem le_commensurator {G : Type*} [Group G] (Γ : Subgroup G) : - Γ ≤ Subgroup.Commensurable.commensurator Γ := by - intro g hg - rw [Subgroup.Commensurable.commensurator_mem_iff] -+ change (ConjAct.toConjAct g • Γ).Commensurable Γ - have : ConjAct.toConjAct g • Γ = Γ := by - ext x - rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, ← map_inv, ConjAct.smul_def, -@@ -268,7 +269,7 @@ theorem exists_monic_wpΨ_smul {δ : SL(2, ℝ)} - have hw1 : 1 ≤ 2 + w := by linarith [norm_nonneg (wpΨ U τ)] - refine (norm_coeff_prod_X_sub_C_le _ _ k).trans ?_ - rw [← Finset.prod_pow_eq_pow_sum, ← Finset.prod_mul_distrib] -- refine Finset.prod_le_prod (fun q _ ↦ by positivity) fun q _ ↦ ?_ -+ refine Finset.prod_le_prod₀ (fun q _ ↦ by positivity) fun q _ ↦ ?_ - have h1 : 1 ≤ (2 + w) ^ Nq q := one_le_pow₀ hw1 - have h2 := hq q τ - have h3 : Cq q * (2 + w) ^ Nq q ≤ |Cq q| * (2 + w) ^ Nq q := -diff --git a/Oka/Uniformization/PmDeck.lean b/Oka/Uniformization/PmDeck.lean -index b1d47aa62e690548727ab235db59d1bd60fff16e..c1bda015ad02de12045536b9ecdb9b1bef5bf8e7 100644 ---- a/Oka/Uniformization/PmDeck.lean -+++ b/Oka/Uniformization/PmDeck.lean -@@ -166,7 +166,9 @@ theorem relIndex_deckGroup_pmDeck_ne_zero : U.deckGroup.relIndex U.pmDeck ≠ 0 - theorem commensurator_pmDeck : - Subgroup.Commensurable.commensurator U.pmDeck = - Subgroup.Commensurable.commensurator U.deckGroup := by -- refine Subgroup.Commensurable.eq ⟨?_, U.relIndex_deckGroup_pmDeck_ne_zero⟩ -+ refine Subgroup.Commensurable.eq ⟨?_, -+ Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr U.relIndex_deckGroup_pmDeck_ne_zero⟩ -+ apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr - rw [Subgroup.relIndex_eq_one.mpr (U.deckGroup_le_pmDeck)]; exact one_ne_zero - - /-- A `Γ̃`-invariant function on `ℍ` as a function on `ℂ ∖ Λ` (and `0` on `Λ`). -/ -diff --git a/Oka/Uniformization/R3.lean b/Oka/Uniformization/R3.lean -index 20629bda471772eb929b2c64251022295155b93f..421e9b56a0c7fd31f7d5c113499f34a922cd9b51 100644 ---- a/Oka/Uniformization/R3.lean -+++ b/Oka/Uniformization/R3.lean -@@ -315,7 +315,7 @@ theorem exists_cosetPoly (hΓN : U.pmDeck ≤ N) - have hw1 : 1 ≤ 2 + w := by linarith [norm_nonneg (wpΨ U τ)] - refine (norm_coeff_prod_X_sub_C_le _ _ k).trans ?_ - rw [← Finset.prod_pow_eq_pow_sum, ← Finset.prod_mul_distrib] -- refine Finset.prod_le_prod (fun q _ ↦ by positivity) fun q _ ↦ ?_ -+ refine Finset.prod_le_prod₀ (fun q _ ↦ by positivity) fun q _ ↦ ?_ - have h1 : 1 ≤ (2 + w) ^ Nq q := one_le_pow₀ hw1 - have h2 := hq q τ - have h3 : Cq q * (2 + w) ^ Nq q ≤ |Cq q| * (2 + w) ^ Nq q := -diff --git a/Oka/Uniformization/SL2Facts.lean b/Oka/Uniformization/SL2Facts.lean -index aaf4432cb8f98dd785743a87b19f3eb4415475f3..9d0eb99ffd04bfe3a520ad32f40b43a85db3f7b3 100644 ---- a/Oka/Uniformization/SL2Facts.lean -+++ b/Oka/Uniformization/SL2Facts.lean -@@ -145,6 +145,8 @@ def conjFix (η : ℝ) : SL(2, ℝ) := - theorem conjFix_lowerLeft (η : ℝ) (g : SL(2, ℝ)) : - ((conjFix η)⁻¹ * g * conjFix η) 1 0 = - g 1 0 * η ^ 2 + (g 1 1 - g 0 0) * η - g 0 1 := by -+ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul, -+ Matrix.SpecialLinearGroup.coe_inv] - simp [conjFix, Matrix.SpecialLinearGroup.coe_inv, Matrix.adjugate_fin_two, - Matrix.mul_apply, Fin.sum_univ_two, Matrix.vecMul, dotProduct] - ring -diff --git a/Oka/Uniformization/Uniqueness.lean b/Oka/Uniformization/Uniqueness.lean -index 57dd1eaca047eeaa4fa695db65f084adf79d64c0..eafbb89b7c83435aa070624a25cd2e644111846f 100644 ---- a/Oka/Uniformization/Uniqueness.lean -+++ b/Oka/Uniformization/Uniqueness.lean -@@ -179,16 +179,16 @@ theorem exists_section_of_graph (h : IsUniformization W A B π) (z : ℍ) {pr pr - refine (convex_ball a₀ ε).isPreconnected.image φ ?_ - rw [continuousOn_iff_continuous_restrict] - refine continuous_induced_rng.mpr ?_ -- have : (fun a : ball a₀ ε ↦ ((ball a₀ ε).restrict φ a).1) = fun a ↦ π (σ a.1) := by -+ have : (fun a : ball a₀ ε ↦ ((ball a₀ ε).domRestrict φ a).1) = fun a ↦ π (σ a.1) := by - funext a; exact hφ a a.2 - rw [Function.comp_def, this] - refine ContinuousOn.comp_continuous (s := {w : ℂ | 0 < w.im}) h.differentiableOn.continuousOn - ((hσc.mono hb₁).comp_continuous continuous_subtype_val fun a ↦ a.2) fun a ↦ (hb₂ a a.2).1 - · rw [continuousOn_iff_continuous_restrict] - refine isOpenEmbedding_coe.isInducing.continuous_iff.mpr ?_ -- have : (fun q : N ↦ ((N.restrict s q : ℍ) : ℂ)) = fun q : N ↦ σ (pr q.1.1) := by -+ have : (fun q : N ↦ ((N.domRestrict s q : ℍ) : ℂ)) = fun q : N ↦ σ (pr q.1.1) := by - funext q; exact hs_val q q.2 -- rw [Function.comp_def]; simp only [restrict_apply] at this ⊢ -+ rw [Function.comp_def]; simp only [domRestrict_apply] at this ⊢ - rw [this] - exact (hσc.mono hb₁).comp_continuous ((hpr.comp continuous_subtype_val).comp - continuous_subtype_val) fun q ↦ q.2.1 -diff --git a/Oka/Weierstrass.lean b/Oka/Weierstrass.lean -index 0d471db0ce70845ecde33a5dc724eb00556b9315..76d64d708f7ac1b75b2e5cbc9381946442169388 100644 ---- a/Oka/Weierstrass.lean -+++ b/Oka/Weierstrass.lean -@@ -3358,7 +3358,7 @@ theorem MvPowerSeries.exists_direction {p : ℕ} - ∑ e ∈ degFinset (Fin (n + 1)) (k i), MvPolynomial.monomial e (coeff e (P i)) with hhp - have hh : ∀ i, hpol i ≠ 0 := by - intro i hzero -- have h3 := congrArg (MvPolynomial.coeff (D i)) hzero -+ have h3 := congrArg (fun f : MvPolynomial (Fin (n + 1)) ℂ ↦ f.coeff (D i)) hzero - rw [hhp] at h3 - simp only [MvPolynomial.coeff_sum, MvPolynomial.coeff_monomial, - MvPolynomial.coeff_zero] at h3 -diff --git a/lake-manifest.json b/lake-manifest.json -index c1d5a66d8ec064b00b58871d4139a8628f14f416..497d95b2b92486861c747fc3d9e39301bc54a72a 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,31 +1,51 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/lana-agents/heights.git", -+ [{"url": "https://github.com/lana-agents/oka.git", - "type": "git", - "subDir": null, - "scope": "", -- "rev": "3539e2a12dd3470c057a4eb531dc3fd627d4c97b", -+ "rev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", -+ "name": "oka", -+ "manifestFile": "lake-manifest.json", -+ "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", -+ "inherited": true, -+ "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/heights.git", -+ "type": "git", -+ "subDir": null, -+ "scope": "", -+ "rev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", - "name": "heights", - "manifestFile": "lake-manifest.json", -- "inputRev": "3539e2a12dd3470c057a4eb531dc3fd627d4c97b", -+ "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", - "inherited": false, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/mathlib4", -+ {"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, -+ {"url": "https://github.com/lana-agents/belyi.git", -+ "type": "git", -+ "subDir": null, -+ "scope": "", -+ "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "name": "belyi", -+ "manifestFile": "lake-manifest.json", -+ "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "inherited": true, -+ "configFile": "lakefile.toml"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -35,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -65,7 +85,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -75,7 +95,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -85,7 +105,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -95,10 +115,10 @@ - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "oka", -diff --git a/lakefile.toml b/lakefile.toml -index d0589c058d6ab8b11ca5591af6f63caecb1850c9..d22800380c12ce35a302e598325148e01d56f365 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -8,6 +8,8 @@ lintDriver = "batteries/runLinter" - lintDriverArgs = ["Oka"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - autoImplicit = false - relaxedAutoImplicit = false -@@ -16,8 +18,8 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "Oka" -@@ -27,4 +29,4 @@ name = "Oka" - [[require]] - name = "heights" - git = "https://github.com/lana-agents/heights.git" --rev = "3539e2a12dd3470c057a4eb531dc3fd627d4c97b" -+rev = "721496ca4c158e511d25d8ccf6bfe8503eda73c1" -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/Oka/Algebra/Category/ModuleCat/Presheaf/PullbackStalk.lean b/Oka/Algebra/Category/ModuleCat/Presheaf/PullbackStalk.lean +index 470291bb7f5683f53077d88b015bb1242d86c7bb..480b1ff77217a7f6a59a354985edfd5dbdcb259f 100644 +--- a/Oka/Algebra/Category/ModuleCat/Presheaf/PullbackStalk.lean ++++ b/Oka/Algebra/Category/ModuleCat/Presheaf/PullbackStalk.lean +@@ -100,7 +100,6 @@ lemma ringStalkMap_germ (V : Opens Y) (hx : f x ∈ V) (s : S.obj (op V)) : + ((TopCat.Presheaf.stalkFunctor CommRingCat.{u} (f x)).map φ (S.germ V (f x) hx s)) = _ + rw [TopCat.Presheaf.stalkFunctor_map_germ_apply (C := CommRingCat.{u}) V (f x) hx φ s] + erw [TopCat.Presheaf.stalkPushforward_germ_apply] +- rfl + + /-- The morphism of presheaves of rings, at the `RingCat` spelling `pushforward` consumes. -/ + abbrev forgetRingHom : +diff --git a/Oka/Algebra/Category/ModuleCat/Presheaf/Submodule.lean b/Oka/Algebra/Category/ModuleCat/Presheaf/Submodule.lean +index ef73b01ddcad6f17fd86f665bb9b06acc2eb7b1e..bbd9cacb14234680212985f990aeae24fc441313 100644 +--- a/Oka/Algebra/Category/ModuleCat/Presheaf/Submodule.lean ++++ b/Oka/Algebra/Category/ModuleCat/Presheaf/Submodule.lean +@@ -11,10 +11,8 @@ public import Mathlib.CategoryTheory.Subfunctor.Basic + /-! + # A submodule of a presheaf of modules, as a subfunctor of the underlying presheaf of types + +-Material for `Mathlib/Algebra/Category/ModuleCat/Presheaf/Submodule.lean`; see `README.md` on the +-mirror tree. That file does not currently import `Mathlib.CategoryTheory.Subfunctor.Basic`, which +-the definition below names, so upstreaming it adds that import — **one** file to the target's own +-transitive closure, measured rather than estimated. ++Mathlib now provides the declarations described here with the same signatures and definitions. ++This module preserves the Oka import path while re-exporting the Mathlib implementation. + + `PresheafOfModules.Submodule` is a submodule of `M.obj X` for each object `X`, closed under the + restriction maps. `PresheafOfModules.Submodule.toSubfunctor` forgets the module structure and +@@ -32,32 +30,3 @@ it has content. + + - `PresheafOfModules.Submodule.toSubfunctor` + -/ +- +-@[expose] public section +- +-universe v v₁ u₁ u +- +-open CategoryTheory +- +-namespace PresheafOfModules +- +-variable {C : Type u₁} [Category.{v₁} C] {R : Cᵒᵖ ⥤ RingCat.{u}} +- +-namespace Submodule +- +-variable {M : PresheafOfModules.{v} R} (N : M.Submodule) +- +-/-- The subfunctor of the underlying type-valued presheaf of `M` induced by a submodule `N`. -/ +-def toSubfunctor : Subfunctor (M.presheaf ⋙ CategoryTheory.forget AddCommGrpCat.{v}) where +- obj X := {r : M.obj X | r ∈ N.obj X} +- map := fun {_ _} f _ hr ↦ N.map_mem f hr +- +-/-- Membership in the subfunctor is membership in the submodule. This is `Iff.rfl`; see the +-module docstring for why it is a `simp` lemma. -/ +-@[simp] +-lemma mem_toSubfunctor_obj {X : Cᵒᵖ} (r : M.obj X) : +- r ∈ N.toSubfunctor.obj X ↔ r ∈ N.obj X := Iff.rfl +- +-end Submodule +- +-end PresheafOfModules +diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/Annihilator.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/Annihilator.lean +index 5ba4d73f420e77a1d1f58f55892f9b80a3475901..633cee2c72818e73eb15f03d549ab4d5fd4b2d6d 100644 +--- a/Oka/Algebra/Category/ModuleCat/Sheaf/Annihilator.lean ++++ b/Oka/Algebra/Category/ModuleCat/Sheaf/Annihilator.lean +@@ -48,6 +48,7 @@ noncomputable def annihilator : (unit R).Submodule where + (Module.annihilator (R.obj Y) (M.obj Y)).comap (R.map f).hom + map {X Y} f := by + intro r hr ++ change R.obj X at r + rw [Submodule.mem_comap, restrictₛₗ_apply] + -- characterise membership in the defining `iInf` at the honest type `R.obj _` + have mem : ∀ {W : Cᵒᵖ} (s : R.obj W), +@@ -115,6 +116,7 @@ noncomputable def annihilator : (SheafOfModules.unit R).Submodule where + (isSheaf_iff_isSheaf_of_type J _).mp + (GrothendieckTopology.HasSheafCompose.isSheaf _ M.isSheaf) + intro X s hmem ++ change R.obj.obj X at s + refine (mem_annihilator s).mpr fun W φ m ↦ ?_ + -- It suffices, by separatedness, that every restriction of `R.map φ s • m` vanishes. + apply (hsep _ (J.pullback_stable φ.unop hmem)).isSeparatedFor.ext +diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Equivalence.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Equivalence.lean +index 33ffcac6dc3e20b079b039ba0814a3838c01efbc..2f4c90a80b2de7ed24accc9f6fd437aeeb84f98f 100644 +--- a/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Equivalence.lean ++++ b/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Equivalence.lean +@@ -145,7 +145,7 @@ lemma symm_H₁ : + rw [← Functor.map_comp, ← op_comp, Iso.inv_hom_id_app, op_id, + CategoryTheory.Functor.map_id] + have h' := h =≫ S.obj.map (eqv.unitInv.app X.unop).op +- rw [Category.assoc, Category.assoc] at h' ++ erw [Category.assoc, Category.assoc] at h' + erw [e] at h' + erw [Category.comp_id, Category.id_comp] at h' + exact h'.symm +@@ -164,7 +164,7 @@ lemma symm_H₂ : + 𝟙 _ := by + rw [← Functor.map_comp, ← op_comp, Iso.inv_hom_id_app, op_id, + CategoryTheory.Functor.map_id] +- rw [← Category.assoc, ← h] ++ erw [← Category.assoc, ← h] + exact e + + variable [HasPullbacks C] [HasPullbacks D] +diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Presentation.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Presentation.lean +index df229ae96f1a84b77a00a89fa12d4751fc21d93e..f78b8e026223edb5287b08645aa0ff5feaefd63c 100644 +--- a/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Presentation.lean ++++ b/Oka/Algebra/Category/ModuleCat/Sheaf/Coherent/Presentation.lean +@@ -83,8 +83,12 @@ restriction preserves kernels (`SheafOfModules.overKernelIso`). Stated because i + generators of the relations *over `Y`* be read as relations of the restricted generators, which + is the whole of `SheafOfModules.GeneratingSections.presentationOver`. -/ + noncomputable def GeneratingSections.overKernelπIso (G : N.GeneratingSections) (Y : C) : +- (kernel G.π).over Y ≅ kernel ((G.map (overFunctor R Y) (Iso.refl _)).π) := +- overKernelIso G.π Y ≪≫ (kernelIsIsoComp _ _).symm ≪≫ ++ (kernel G.π).over Y ≅ kernel ((G.map (overFunctor R Y) (Iso.refl _)).π) := by ++ let e : free (R := R.over Y) G.I ≅ (overFunctor R Y).obj (free (R := R) G.I) := ++ mapFreeIso (overFunctor R Y) G.I (Iso.refl _) ++ have : IsIso e.hom := e.isIso_hom ++ exact overKernelIso G.π Y ≪≫ ++ (kernelIsIsoComp e.hom ((overFunctor R Y).map G.π)).symm ≪≫ + (kernelIsoOfEq (G.map_π_eq (overFunctor R Y) (Iso.refl _))).symm + + /-- **Generators of `N`, together with generators of their relations over `Y`, present +@@ -102,7 +106,7 @@ noncomputable def GeneratingSections.presentationOver (G : N.GeneratingSections) + instance GeneratingSections.isFinite_presentationOver (G : N.GeneratingSections) [G.IsFiniteType] + (Y : C) (H : ((kernel G.π).over Y).GeneratingSections) [H.IsFiniteType] : + (G.presentationOver Y H).IsFinite where +- isFiniteType_generators := inferInstanceAs (G.map (overFunctor R Y) (Iso.refl _)).IsFiniteType ++ isFiniteType_generators := ⟨inferInstanceAs (Finite G.I)⟩ + isFiniteType_relations := inferInstanceAs (H.ofEpi (G.overKernelπIso Y).hom).IsFiniteType + + /-- **Generators of `N` and a covering on which their relations are generated give quasicoherent +diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/PushforwardContinuous.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/PushforwardContinuous.lean +index 6524079cc07ddc7880524860d4e5c35bf7be03a0..cdf79485d4ab61e66b2d0f4fef4cf0cf2131f739 100644 +--- a/Oka/Algebra/Category/ModuleCat/Sheaf/PushforwardContinuous.lean ++++ b/Oka/Algebra/Category/ModuleCat/Sheaf/PushforwardContinuous.lean +@@ -167,8 +167,14 @@ section + variable {C : Type u} [SmallCategory C] {J : GrothendieckTopology C} {R : Sheaf J RingCat.{u}} + [HasWeakSheafify J AddCommGrpCat.{u}] [J.WEqualsLocallyBijective AddCommGrpCat.{u}] + +-instance (X : C) : (overFunctor.{u} R X).IsRightAdjoint := +- inferInstanceAs (pushforward.{u} (𝟙 (R.over X))).IsRightAdjoint ++instance (X : C) : (overFunctor.{u} R X).IsRightAdjoint := by ++ let φ : R.over X ⟶ ++ ((Over.forget X).sheafPushforwardContinuous RingCat.{u} (J.over X) J).obj R := 𝟙 _ ++ let : (PresheafOfModules.pushforward.{u} φ.hom).IsRightAdjoint := ++ CategoryTheory.Functor.isRightAdjoint_of_leftAdjointObjIsDefined_eq_top ++ (PresheafOfModules.pullbackObjIsDefined_eq_top ++ (F := Over.forget X) (R := R.obj) φ.hom) ++ exact (PullbackConstruction.adjunction.{u} φ).isRightAdjoint + + variable [HasSheafify J AddCommGrpCat.{u}] [∀ (X : C), HasSheafify (J.over X) AddCommGrpCat.{u}] + [∀ (X : C), (J.over X).WEqualsLocallyBijective AddCommGrpCat.{u}] +diff --git a/Oka/Algebra/Category/ModuleCat/Sheaf/Submodule.lean b/Oka/Algebra/Category/ModuleCat/Sheaf/Submodule.lean +index b10f8c3b43ddc016d77045b940899be8951c4c77..ed660d7db04c0e4b3d94ccb19b40ff6e1f7a4053 100644 +--- a/Oka/Algebra/Category/ModuleCat/Sheaf/Submodule.lean ++++ b/Oka/Algebra/Category/ModuleCat/Sheaf/Submodule.lean +@@ -6,7 +6,7 @@ Authors: Yuichiro Hoshi, Junnosuke Koizumi, Christian Merten + module + + public import Oka.Algebra.Category.ModuleCat.Presheaf.Submodule +-public import Mathlib.Algebra.Category.ModuleCat.Sheaf ++public import Mathlib.Algebra.Category.ModuleCat.Sheaf.Submodule + + /-! + # Submodules of sheaves of modules +@@ -19,107 +19,6 @@ presheaf of modules whose membership condition is local. + - `SheafOfModules.Submodule`: a submodule of (the underlying presheaf of modules of) a sheaf of + modules whose membership is local. + - `SheafOfModules.Submodule.toSheafOfModules`: the associated sheaf of modules. +--/ +- +-@[expose] public section +- +-universe v v₁ u₁ u +- +-open CategoryTheory Opposite +- +-namespace SheafOfModules +- +-open PresheafOfModules +- +-variable {C : Type u₁} [Category.{v₁} C] {J : GrothendieckTopology C} +- {R : Sheaf J RingCat.{u}} +- +-/-- A submodule of a sheaf of modules `M`: a submodule `N` of the underlying presheaf of modules +-whose membership condition is local. -/ +-structure Submodule (M : SheafOfModules.{v} R) extends M.val.Submodule where +- isSheaf ⦃X : Cᵒᵖ⦄ (s : M.val.obj X) : +- toSubmodule.toSubfunctor.sieveOfSection s ∈ J X.unop → s ∈ toSubmodule.obj X +- +-namespace Submodule +- +-variable {M : SheafOfModules.{v} R} (N : M.Submodule) +- +-@[ext] +-lemma ext {N₁ N₂ : M.Submodule} (h : N₁.toSubmodule = N₂.toSubmodule) : N₁ = N₂ := by +- cases N₁ +- cases N₂ +- subst h +- rfl +- +-/-- The sheaf of modules associated to a submodule of a sheaf of modules. -/ +-noncomputable def toSheafOfModules : SheafOfModules.{v} R where +- val := N.toPresheafOfModules +- isSheaf := by +- suffices Presieve.IsSheaf J N.toSubfunctor.toFunctor by +- apply Presheaf.isSheaf_of_isSheaf_comp J (s := CategoryTheory.forget AddCommGrpCat) +- rwa [isSheaf_iff_isSheaf_of_type] +- rw [N.toSubfunctor.isSheaf_iff] +- · exact N.isSheaf +- · rw [← isSheaf_iff_isSheaf_of_type] +- exact GrothendieckTopology.HasSheafCompose.isSheaf _ M.isSheaf +- +-/-- The inclusion of the sheaf of modules associated to a submodule `N` into `M`. -/ +-noncomputable def ι : N.toSheafOfModules ⟶ M := +- ⟨N.toSubmodule.ι⟩ + +-@[simp] +-lemma ι_val : N.ι.val = N.toSubmodule.ι := rfl +- +-instance : Mono N.ι := +- (forget R).mono_of_mono_map <| inferInstanceAs (Mono N.toSubmodule.ι) +- +-instance : PartialOrder M.Submodule := +- PartialOrder.lift toSubmodule fun _ _ ↦ ext +- +-lemma le_iff {N₁ N₂ : M.Submodule} : N₁ ≤ N₂ ↔ N₁.toSubmodule ≤ N₂.toSubmodule := .rfl +- +-instance : InfSet M.Submodule where +- sInf s := +- { toSubmodule := sInf ((·.toSubmodule) '' s) +- isSheaf X x hx := by +- simp only [PresheafOfModules.Submodule.sInf_obj, Submodule.mem_iInf] +- rintro _ ⟨N', hN', rfl⟩ +- refine N'.isSheaf x (J.superset_covering (fun V f hf ↦ ?_) hx) +- exact (sInf_le (Set.mem_image_of_mem (·.toSubmodule) hN')) (op V) hf } +- +-instance : Min M.Submodule where +- min N₁ N₂ := +- { toSubmodule := N₁.toSubmodule ⊓ N₂.toSubmodule +- isSheaf := by +- rw [← sInf_pair, ← Set.image_pair (·.toSubmodule) N₁ N₂] +- exact (sInf {N₁, N₂}).isSheaf } +- +-noncomputable instance : CompleteLattice M.Submodule where +- __ := completeLatticeOfInf M.Submodule fun s ↦ +- ⟨fun _ hN ↦ le_iff.mpr (sInf_le (Set.mem_image_of_mem _ hN)), +- fun _ hb ↦ le_iff.mpr <| le_sInf <| by +- rintro _ ⟨N', hN', rfl⟩ +- exact le_iff.mp (hb hN')⟩ +- inf := (· ⊓ ·) +- inf_le_left := fun _ _ ↦ le_iff.mpr inf_le_left +- inf_le_right := fun _ _ ↦ le_iff.mpr inf_le_right +- le_inf := fun _ _ _ h₁ h₂ ↦ le_iff.mpr (le_inf (le_iff.mp h₁) (le_iff.mp h₂)) +- +-@[simp] +-lemma toSubmodule_sInf (s : Set M.Submodule) : +- (sInf s).toSubmodule = sInf ((·.toSubmodule) '' s) := +- rfl +- +-@[simp] +-lemma toSubmodule_iInf {ι : Sort*} (N : ι → M.Submodule) : +- (⨅ i, N i).toSubmodule = ⨅ i, (N i).toSubmodule := by +- rw [iInf, toSubmodule_sInf, ← Set.range_comp, iInf, Function.comp_def] +- +-@[simp] +-lemma toSubmodule_inf (N₁ N₂ : M.Submodule) : +- (N₁ ⊓ N₂).toSubmodule = N₁.toSubmodule ⊓ N₂.toSubmodule := +- rfl +- +-end Submodule +- +-end SheafOfModules ++Mathlib now provides these declarations. This module re-exports them to preserve Oka's import path. ++-/ +diff --git a/Oka/Algebra/Category/ModuleCat/Stalk.lean b/Oka/Algebra/Category/ModuleCat/Stalk.lean +index 6a7f5c96778f62d63aeb9a38d3191b8411419e99..0d0b5e53df579ebea57660ac7c5568200967df9e 100644 +--- a/Oka/Algebra/Category/ModuleCat/Stalk.lean ++++ b/Oka/Algebra/Category/ModuleCat/Stalk.lean +@@ -60,18 +60,20 @@ def stalkFunctor : + map_add' a b := map_add _ a b + map_smul' := by + intro r m ++ change _ = r • _ + obtain ⟨U, hxU, r, rfl⟩ := TopCat.Presheaf.exists_germ_eq R r + obtain ⟨V, hxV, m, rfl⟩ := TopCat.Presheaf.exists_germ_eq M.presheaf m ++ have hxUV : x ∈ U ⊓ V := ⟨hxU, hxV⟩ + rw [← TopCat.Presheaf.germ_res_apply R (homOfLE (inf_le_left : U ⊓ V ≤ U)) x +- ⟨hxU, hxV⟩ r, ++ hxUV r, + ← TopCat.Presheaf.germ_res_apply M.presheaf (homOfLE (inf_le_right : U ⊓ V ≤ V)) x +- ⟨hxU, hxV⟩ m, +- ← germ_smul] ++ hxUV m] ++ erw [← germ_smul] + erw [TopCat.Presheaf.stalkFunctor_map_germ_apply (C := AddCommGrpCat.{u}) +- (F := M.presheaf) (G := N.presheaf) (U ⊓ V) x ⟨hxU, hxV⟩ ((toPresheaf _).map f), ++ (F := M.presheaf) (G := N.presheaf) (U ⊓ V) x hxUV ((toPresheaf _).map f), + TopCat.Presheaf.stalkFunctor_map_germ_apply (C := AddCommGrpCat.{u}) +- (F := M.presheaf) (G := N.presheaf) (U ⊓ V) x ⟨hxU, hxV⟩ ((toPresheaf _).map f)] +- rw [RingHom.id_apply, ← germ_smul] ++ (F := M.presheaf) (G := N.presheaf) (U ⊓ V) x hxUV ((toPresheaf _).map f)] ++ erw [← germ_smul] + congr 1 + exact (Hom.app f (op (U ⊓ V))).hom.map_smul _ _ } + map_id M := by +diff --git a/Oka/Algebra/Homology/DerivedCategory/Ext/MapNatTrans.lean b/Oka/Algebra/Homology/DerivedCategory/Ext/MapNatTrans.lean +index 351a850eb42d360471fadd3e1da31ae767498919..609b9c0608dedcfddbee558165c3f4311c5b3a69 100644 +--- a/Oka/Algebra/Homology/DerivedCategory/Ext/MapNatTrans.lean ++++ b/Oka/Algebra/Homology/DerivedCategory/Ext/MapNatTrans.lean +@@ -6,6 +6,7 @@ Authors: Christian Merten + import Mathlib.Algebra.Homology.DerivedCategory.Ext.EnoughInjectives + import Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences + import Mathlib.Algebra.Homology.DerivedCategory.Ext.Map ++import Mathlib.CategoryTheory.Abelian.Exact + + /-! + # Naturality of `Ext.mapExactFunctor` in the functor +diff --git a/Oka/Algebra/MvPolynomial/PDeriv.lean b/Oka/Algebra/MvPolynomial/PDeriv.lean +index 4d721a8d3638dc1b39f918f700d70cc0433780fb..e84717ba891d18bb45b82c193564ef64fb211145 100644 +--- a/Oka/Algebra/MvPolynomial/PDeriv.lean ++++ b/Oka/Algebra/MvPolynomial/PDeriv.lean +@@ -58,7 +58,7 @@ vanish. The induction is `MvPolynomial.induction_on`, so no monomial expansion a + `classical`; the statement needs no `DecidableEq σ` and the `unusedDecidableInType` linter is + what says so. -/ + theorem coeff_single_one_taylorAlgHom (z : σ → R) (i : σ) (p : MvPolynomial σ R) : +- coeff (Finsupp.single i 1) (taylorAlgHom z p) = eval z (pderiv i p) := by ++ (taylorAlgHom z p).coeff (Finsupp.single i 1) = eval z (pderiv i p) := by + classical + induction p using MvPolynomial.induction_on with + | C a => +@@ -66,7 +66,8 @@ theorem coeff_single_one_taylorAlgHom (z : σ → R) (i : σ) (p : MvPolynomial + exact if_neg fun h ↦ by simpa using h.symm + | add p q hp hq => simp [hp, hq] + | mul_X p j hp => +- rw [map_mul, taylorAlgHom_X, mul_add, coeff_add, coeff_mul_X', mul_comm _ (C (z j)), ++ rw [map_mul, taylorAlgHom_X, mul_add, AddMonoidAlgebra.coeff_add, Finsupp.add_apply, ++ coeff_mul_X', mul_comm _ (C (z j)), + coeff_C_mul, hp, pderiv_mul, map_add, eval_mul, eval_mul, eval_X] + by_cases h : j = i + · subst h +diff --git a/Oka/AlgebraicGeometry/AlgClosed/Basic.lean b/Oka/AlgebraicGeometry/AlgClosed/Basic.lean +index a9d62d93ad0e92cd25050114c7bc153e54e46385..e4d46502cc27945f8e90243a9b8ced9ea69f164a 100644 +--- a/Oka/AlgebraicGeometry/AlgClosed/Basic.lean ++++ b/Oka/AlgebraicGeometry/AlgClosed/Basic.lean +@@ -41,7 +41,12 @@ theorem ext_of_apply_eq_of_formallyUnramified {X Y Z : Scheme.{u}} {K : Type u} + have : JacobsonSpace X := LocallyOfFiniteType.jacobsonSpace (f ≫ s ≫ i) + refine ext_of_fromSpecResidueField_eq_of_formallyUnramified s h fun x hx ↦ ?_ + rw [← cancel_epi (Spec.map (residueFieldIsoBase (f ≫ s ≫ i) x hx).hom)] +- refine ext_of_apply_closedPoint_eq (s ≫ i) ?_ ?_ (by simpa using H x hx) ++ refine ext_of_apply_closedPoint_eq (s ≫ i) ?_ ?_ (by ++ let p : Spec (X.residueField x) := ++ Spec.map (residueFieldIsoBase (f ≫ s ≫ i) x hx).hom (IsLocalRing.closedPoint K) ++ change f (X.fromSpecResidueField x p) = g (X.fromSpecResidueField x p) ++ rw [Scheme.fromSpecResidueField_apply] ++ exact H x hx) + · simp only [Category.assoc, ← SpecMap_residueFieldIsoBase_inv (f ≫ s ≫ i) x hx, + ← Spec.map_comp, Iso.inv_hom_id, Spec.map_id] + · simp only [Category.assoc, ← reassoc_of% h, ← SpecMap_residueFieldIsoBase_inv (f ≫ s ≫ i) x hx, +diff --git a/Oka/AlgebraicGeometry/GraphClosure.lean b/Oka/AlgebraicGeometry/GraphClosure.lean +index 3b5043fbf8c34bba45b676805660cb88e8b93e39..ed888d852b67b08c834e5dc5bae6819826bd207d 100644 +--- a/Oka/AlgebraicGeometry/GraphClosure.lean ++++ b/Oka/AlgebraicGeometry/GraphClosure.lean +@@ -67,9 +67,10 @@ theorem isClosedImmersion_morphismRestrict_of_graph (c : X ⟶ pullback sY sP) + have key : u ≫ γ' = (X.isoOfEq (by rfl : c ⁻¹ᵁ O = _)).inv ≫ (c ∣_ O) := by + rw [← cancel_mono O.ι, Category.assoc, hγ', Category.assoc, morphismRestrict_ι] + apply pullback.hom_ext +- · simp only [γ, Category.assoc, pullback.lift_fst, hu₂, Scheme.isoOfEq_inv_ι_assoc] +- · simp only [γ, Category.assoc, pullback.lift_snd, reassoc_of% hu₁, morphismRestrict_ι, +- Scheme.isoOfEq_inv_ι_assoc] ++ · simp only [γ, Category.assoc, pullback.lift_fst, hu₂] ++ erw [Scheme.isoOfEq_inv_ι_assoc] ++ · simp only [γ, Category.assoc, pullback.lift_snd, reassoc_of% hu₁, morphismRestrict_ι] ++ erw [Scheme.isoOfEq_inv_ι_assoc] + have : IsClosedImmersion (u ≫ γ') := key ▸ inferInstance + exact IsClosedImmersion.of_comp u γ' + +diff --git a/Oka/AlgebraicGeometry/Modules/CocycleTwist.lean b/Oka/AlgebraicGeometry/Modules/CocycleTwist.lean +index 005529b17e2c6432b15ae17e316d9ed9052dbe17..458526882116f655a1594e315f741e612254098d 100644 +--- a/Oka/AlgebraicGeometry/Modules/CocycleTwist.lean ++++ b/Oka/AlgebraicGeometry/Modules/CocycleTwist.lean +@@ -3,6 +3,7 @@ Copyright (c) 2026 Yuichiro Hoshi, Junnosuke Koizumi, Christian Merten. All righ + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Yuichiro Hoshi, Junnosuke Koizumi, Christian Merten + -/ ++import Mathlib.AlgebraicGeometry.AffineScheme + import Mathlib.AlgebraicGeometry.Modules.Sheaf + + /-! +diff --git a/Oka/AlgebraicGeometry/Modules/Coherent.lean b/Oka/AlgebraicGeometry/Modules/Coherent.lean +index 2e9ce25cda45c59e74487ee0b2a3f85d5a465f17..6d2efe7e806b4c9f9a64438354c72395b31c271a 100644 +--- a/Oka/AlgebraicGeometry/Modules/Coherent.lean ++++ b/Oka/AlgebraicGeometry/Modules/Coherent.lean +@@ -127,7 +127,7 @@ nothing else; it is stated because the rest of the file mixes the two spellings + lemma algebraMap_basicOpen_eq_res {U : X.Opens} (f : Γ(X, U)) (r : Γ(X, U)) : + algebraMap Γ(X, U) Γ(X, X.basicOpen f) r = + X.toLocallyRingedSpace.res (X.basicOpen_le f) r := by +- rw [RingHom.algebraMap_toAlgebra]; rfl ++ rw [RingHom.algebraMap_toAlgebra] + + /-- **A locally noetherian scheme has locally finitely generated relations.** + +diff --git a/Oka/AlgebraicGeometry/ProjectiveSpace/BaseChange.lean b/Oka/AlgebraicGeometry/ProjectiveSpace/BaseChange.lean +index 11f850b1d8982aa6b3ec36f555507f53a52c17ee..9f90b56e8c2490ac17f3dea3eb9236ef14482649 100644 +--- a/Oka/AlgebraicGeometry/ProjectiveSpace/BaseChange.lean ++++ b/Oka/AlgebraicGeometry/ProjectiveSpace/BaseChange.lean +@@ -52,7 +52,7 @@ lemma mapGradedHom_apply (p : MvPolynomial (Fin (n + 1)) R) : + /-- A polynomial lies in the irrelevant ideal iff its constant coefficient vanishes. -/ + lemma mem_irrelevant_iff_coeff_zero {S : Type u} [CommRing S] + (a : MvPolynomial (Fin (n + 1)) S) : +- a ∈ HomogeneousIdeal.irrelevant (homogeneousSubmodule (Fin (n + 1)) S) ↔ coeff 0 a = 0 := by ++ a ∈ HomogeneousIdeal.irrelevant (homogeneousSubmodule (Fin (n + 1)) S) ↔ a.coeff 0 = 0 := by + rw [HomogeneousIdeal.mem_irrelevant_iff, GradedRing.proj_apply] + exact (congrArg (· = 0) (decomposition.decompose'_apply a 0)).to_iff.trans (by + rw [homogeneousComponent_zero, C_eq_zero]) +diff --git a/Oka/AlgebraicGeometry/Spec.lean b/Oka/AlgebraicGeometry/Spec.lean +index 4aaf23470bd3fe66532d65e904edd81451db7763..cc8ca808898dac8f18c2514e40d326d7edab535e 100644 +--- a/Oka/AlgebraicGeometry/Spec.lean ++++ b/Oka/AlgebraicGeometry/Spec.lean +@@ -51,6 +51,11 @@ noncomputable section + + namespace AlgebraicGeometry.StructureSheaf + ++-- Keep the point typed as `PrimeSpectrum R` while selecting the locally ringed space instance. ++local instance (R : Type u) [CommRing R] (p : PrimeSpectrum R) : ++ IsLocalRing ((Spec.locallyRingedSpaceObj (CommRingCat.of R)).presheaf.stalk p) := ++ (Spec.locallyRingedSpaceObj (CommRingCat.of R)).isLocalRing p ++ + /-- **The germ at `p` of the global section of `𝒪_{Spec R}` attached to `a : R` lies in the + maximal ideal of the stalk exactly when `a` lies in `p`.** + +diff --git a/Oka/Analysis/Calculus/Implicit.lean b/Oka/Analysis/Calculus/Implicit.lean +index 10af3babeca73146707010cb3b88e27511bf370a..1d88d506068c1c7bb66acb60329fa8a976354881 100644 +--- a/Oka/Analysis/Calculus/Implicit.lean ++++ b/Oka/Analysis/Calculus/Implicit.lean +@@ -271,7 +271,7 @@ theorem isLocalHomeomorph_coordProj_comp_of_isEmbedding + (φ.injOn_rightFun_levelSet (hsub y y.2) (hsub y' y'.2) hyy')) + · intro W hW + obtain ⟨W', hW'open, rfl⟩ := isOpen_induced_iff.1 hW +- have himg : U.restrict (fun t ↦ g t ∘ e) '' (Subtype.val ⁻¹' W') = ++ have himg : U.domRestrict (fun t ↦ g t ∘ e) '' (Subtype.val ⁻¹' W') = + (fun t ↦ g t ∘ e) '' (U ∩ W') := by + rw [Set.restrict_eq, Set.image_comp, Subtype.image_preimage_coe] + rw [himg] +diff --git a/Oka/Analytic/DifferentiableTsum.lean b/Oka/Analytic/DifferentiableTsum.lean +index 1cc7593e2113393328c8b4aed04a8c2b6d2c7bec..3cda1414e87bf18fea90d11236466b4e236a7f1f 100644 +--- a/Oka/Analytic/DifferentiableTsum.lean ++++ b/Oka/Analytic/DifferentiableTsum.lean +@@ -109,7 +109,7 @@ theorem differentiableOn_tsum_of_locally_summable {ι : Type*} [Countable ι] {m + ∏ i, (ρ - ‖y i‖)⁻¹ := by + intro θ + rw [norm_prod] +- refine Finset.prod_le_prod (fun i _ ↦ norm_nonneg _) fun i _ ↦ ?_ ++ refine Finset.prod_le_prod₀ (fun i _ ↦ norm_nonneg _) fun i _ ↦ ?_ + rw [norm_inv] + have h2 := norm_sub_norm_le (torusMap (0 : Fin m → ℂ) (fun _ ↦ ρ) θ i) (y i) + rw [hnorm] at h2 +diff --git a/Oka/Analytic/HartogsRegular.lean b/Oka/Analytic/HartogsRegular.lean +index 432a16f62ac5ad92a90eca0977114d4d53d60010..46de5fc3caa70fb03ad1ef71d55289203c64cee7 100644 +--- a/Oka/Analytic/HartogsRegular.lean ++++ b/Oka/Analytic/HartogsRegular.lean +@@ -120,6 +120,8 @@ theorem exists_ne_zero_incl_mem_span_pair {W : (LocalOkaRing (Fin n))[X]} + simp only [smul_eq_mul, ← map_mul, Ideal.Quotient.eq] at hab ⊢ + rw [hdvd] at hab ⊢ + exact hreg _ (by rwa [mul_sub]) ++ have : Algebra.IsIntegral (LocalOkaRing (Fin n)) (LocalOkaRing (Fin (n + 1)) ⧸ I) := ++ Algebra.IsIntegral.of_finite _ _ + obtain ⟨c, hc0, hc⟩ := exists_ne_zero_algebraMap_mem_span_singleton + (R := LocalOkaRing (Fin n)) hx + obtain ⟨a, ha⟩ := Ideal.mem_span_singleton'.mp hc +diff --git a/Oka/Analytic/Laurent/Several.lean b/Oka/Analytic/Laurent/Several.lean +index d7ba12c980a5df7d310c21b8920f868e8dda3da7..c5b2408becda75420165c2e2340a0866b4cfcffb 100644 +--- a/Oka/Analytic/Laurent/Several.lean ++++ b/Oka/Analytic/Laurent/Several.lean +@@ -340,7 +340,7 @@ theorem exists_summable_bound_mcoeff {f : (Fin n → ℂ) → ℂ} + (norm_nonneg _) _) + _ = M * ∏ i, (σ i ^ (-k i) * ‖z i‖ ^ k i) := by rw [Finset.prod_mul_distrib, mul_assoc] + _ ≤ M * ∏ i, β i (k i) := by +- refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod (fun i _ ↦ ?_) fun i _ ↦ ?_) hM0 ++ refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod₀ (fun i _ ↦ ?_) fun i _ ↦ ?_) hM0 + · exact mul_nonneg (zpow_nonneg (hσ i).pos.le _) (zpow_nonneg (norm_nonneg _) _) + · obtain ⟨hz2, hz1⟩ := hz i + rcases le_or_gt 0 (k i) with hk | hk +@@ -561,7 +561,7 @@ theorem differentiableOn_tsum_monomial {b : (Fin n → ℤ) → ℂ} + refine le_trans ?_ (Finset.single_le_sum (f := fun s ↦ ‖b k‖ * ∏ i, τ s i ^ k i) + (fun s _ ↦ mul_nonneg (norm_nonneg _) + (Finset.prod_nonneg fun i _ ↦ zpow_nonneg (hτ s i).pos.le _)) (Finset.mem_univ s₀)) +- refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod ++ refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod₀ + (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ ?_) (norm_nonneg _) + obtain ⟨hz2, hz1⟩ := hz i + rcases le_or_gt 0 (k i) with hki | hki +@@ -604,7 +604,7 @@ theorem differentiableOn_tsum_indicator_mcoeff {f : (Fin n → ℂ) → ℂ} + (Finset.prod_nonneg fun i _ ↦ zpow_nonneg (norm_nonneg _) _)) fun k ↦ ?_ + by_cases hkS : k ∈ S + · rw [Set.indicator_of_mem hkS, norm_mul, norm_monomial] +- refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod ++ refine mul_le_mul_of_nonneg_left (Finset.prod_le_prod₀ + (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ ?_) (norm_nonneg _) + by_cases h : r' i = r i + · rw [hw'eq i h] +diff --git a/Oka/Analytic/Puiseux.lean b/Oka/Analytic/Puiseux.lean +index 05afbc2ddb7910756d06fff090cb1b235dbba8e2..9a5249ab6704717c82c7bebc6a6038bf36ecab97 100644 +--- a/Oka/Analytic/Puiseux.lean ++++ b/Oka/Analytic/Puiseux.lean +@@ -126,7 +126,7 @@ theorem exists_prod_eq_of_mem_base (hG : Convex ℝ G) (hGo : IsOpen G) + exact (Φ ⟨c, ⟨z, hz⟩⟩).2 + have hgcont (c : Cm) : ContinuousOn (g c) (base G) := by + rw [continuousOn_iff_continuous_restrict] +- have : (base G).restrict (g c) = fun z ↦ (Φ ⟨c, z⟩).1.2 := funext fun z ↦ hg c z.2 ++ have : (base G).domRestrict (g c) = fun z ↦ (Φ ⟨c, z⟩).1.2 := funext fun z ↦ hg c z.2 + rw [this] + exact continuous_snd.comp (continuous_subtype_val.comp (Φ.continuous.comp continuous_sigmaMk)) + have hmemk (c : Cm) {z : E × ℂ} (hz : z ∈ base G) : (z.1, z.2 ^ (k c : ℕ)) ∈ base G := by +diff --git a/Oka/AnalyticSpace/Continuity.lean b/Oka/AnalyticSpace/Continuity.lean +index 38d7a2cdc65f7306d3996c08559e74c967a3de6f..fad2deea61f58d9a8ab9baedb5ae754ed1d37d8a 100644 +--- a/Oka/AnalyticSpace/Continuity.lean ++++ b/Oka/AnalyticSpace/Continuity.lean +@@ -244,7 +244,7 @@ theorem continuousAt_eval (z₀ : U) : + ((complexAffineSpace.{u} n).toLocallyRingedSpace.restrict V.isOpenEmbedding)).1 : + ULift.{u} (Fin n) → ℂ) ∈ V.isOpenEmbedding.isOpenMap.functor.obj A := + fun z ↦ ⟨i.base ⟨z.1.1, hWU₀ _ z.2⟩, hB'A (hmemB' _ z.2), rfl⟩ +- have hrestrict : (S.restrict fun z : U ↦ Z.eval z.1 z.2 g) = ++ have hrestrict : (S.domRestrict fun z : U ↦ Z.eval z.1 z.2 g) = + (fun y : V.isOpenEmbedding.isOpenMap.functor.obj A ↦ OkaRing.evalHom y.2 u) ∘ + fun z : S ↦ (⟨_, hmaps z⟩ : V.isOpenEmbedding.isOpenMap.functor.obj A) := + funext fun z ↦ hval _ (hmemB' _ z.2) +diff --git a/Oka/AnalyticSpace/EmptyBase.lean b/Oka/AnalyticSpace/EmptyBase.lean +index 85d680812a7c71b40edd40a65671bd3808a3afcb..be71d82fca9502fa48a0bf324c64537c4a19ea03 100644 +--- a/Oka/AnalyticSpace/EmptyBase.lean ++++ b/Oka/AnalyticSpace/EmptyBase.lean +@@ -195,7 +195,7 @@ are interchangeable because that class is a `Prop`. -/ + theorem SeparatedFiniteEtaleOver.not_galoisCategory_of_isEmpty : + ¬ GaloisCategory (SeparatedFiniteEtaleOver.{u} X) := by + intro h +- obtain ⟨F, ⟨hF⟩⟩ := h.hasFiberFunctor ++ obtain ⟨F, hF⟩ := h.hasFiberFunctor + exact SeparatedFiniteEtaleOver.not_isFiberFunctor_of_isEmpty F hF + + end ComplexAnalytic.AnalyticSpace +diff --git a/Oka/AnalyticSpace/FundamentalGroup.lean b/Oka/AnalyticSpace/FundamentalGroup.lean +index 786c99e8481fb3cf5c9030c61b6b8dae27a74791..a5b9eac5e2d3ca49ef7e8e6124a3a59688d063b3 100644 +--- a/Oka/AnalyticSpace/FundamentalGroup.lean ++++ b/Oka/AnalyticSpace/FundamentalGroup.lean +@@ -338,12 +338,12 @@ Galois cover with a morphism to it. + **No point of the base appears in the statement either, and here that takes an argument.** + `CategoryTheory.PreGaloisCategory.exists_hom_from_galois_of_connected` takes the fibre functor + explicitly, and every fibre functor this repository has is taken at a point of the base; +-`CategoryTheory.PreGaloisCategory.GaloisCategory.getFiberFunctor` is the one the class carries and ++`CategoryTheory.GaloisCategory.getFiberFunctor` is the one the class carries and + it takes none, so it is what this proof feeds the lemma. -/ + theorem SeparatedFiniteEtaleOver.exists_isGalois_hom (A : SeparatedFiniteEtaleOver.{u} X) + [PreGaloisCategory.IsConnected A] : + ∃ (B : SeparatedFiniteEtaleOver.{u} X) (_ : B ⟶ A), PreGaloisCategory.IsGalois B := + PreGaloisCategory.exists_hom_from_galois_of_connected +- (PreGaloisCategory.GaloisCategory.getFiberFunctor _) A ++ (GaloisCategory.getFiberFunctor _) A + + end ComplexAnalytic.AnalyticSpace +diff --git a/Oka/AnalyticSpace/GaloisCategory.lean b/Oka/AnalyticSpace/GaloisCategory.lean +index 98b350d8474d86cee8aa56421812b4cf3aef0f5c..5cc4b7f2ebbba6965005c32a4128b358452b2934 100644 +--- a/Oka/AnalyticSpace/GaloisCategory.lean ++++ b/Oka/AnalyticSpace/GaloisCategory.lean +@@ -338,8 +338,8 @@ of a fibre functor and is, at the commit that adds it, the whole of what this re + about that class. + + `hasFiberFunctor` is the only field. It is the instance above's fibre functor taken at +-`Classical.arbitrary`, and the `Nonempty` half of the field is `inferInstance`, which finds that +-instance: **the class asks for a functor and this repository's fibre functors ask for a point, so ++`Classical.arbitrary`, and `inferInstance` supplies its `FiberFunctor` instance: ++**the class asks for a functor and this repository's fibre functors ask for a point, so + `[Nonempty X]` is exactly the gap** and it is spent here and nowhere else in this file. + + **`[PreconnectedSpace X]` does not give the point**, `IsPreconnected` holding of the empty set, for +@@ -350,6 +350,6 @@ instance SeparatedFiniteEtaleOver.galoisCategory : + GaloisCategory (SeparatedFiniteEtaleOver.{u} X) where + hasFiberFunctor := + ⟨SeparatedFiniteEtaleOver.fintypeFiberFunctor.{u} (Classical.arbitrary (X : Type u)), +- ⟨inferInstance⟩⟩ ++ inferInstance⟩ + + end ComplexAnalytic.AnalyticSpace +diff --git a/Oka/AnalyticSpace/HartogsExtension.lean b/Oka/AnalyticSpace/HartogsExtension.lean +index a6f59b110183fd5e8670bd351e675f59c5ea33f8..67ea3ea9dbd892343a22425f0ebcf50dc6a76531 100644 +--- a/Oka/AnalyticSpace/HartogsExtension.lean ++++ b/Oka/AnalyticSpace/HartogsExtension.lean +@@ -76,7 +76,6 @@ theorem hasHartogsExtension_of_local {O : Z.Opens} + refine (res_res _ h₁ (hBΩ y hy.1) t).symm.trans ?_ + change Z.res h₁ (sectRes (SheafOfModules.unit Z.ringSheaf) (hBΩ y hy.1) t) = _ + rw [ht, hu] +- rfl + + /-- **Hartogs extension passes to larger opens.** -/ + theorem HasHartogsExtension.mono {O O' : Z.Opens} (h : HasHartogsExtension Z O) (hO : O ≤ O') : +diff --git a/Oka/AnalyticSpace/MonicSplitting.lean b/Oka/AnalyticSpace/MonicSplitting.lean +index 8af208f323257c36c0549e45b4c561e8c451a748..0dc537d129f8518ad5182bb16c8bcb866869a60a 100644 +--- a/Oka/AnalyticSpace/MonicSplitting.lean ++++ b/Oka/AnalyticSpace/MonicSplitting.lean +@@ -665,7 +665,7 @@ lemma isPiQuotient_germMap_zero (P : Fin 0 → (LocalOkaRing (Fin n))[X]) : + exact Ideal.zero_mem _ + · rw [MvPolynomial.eq_C_of_isEmpty f] + simp only [germMap_C, Ideal.mem_bot, MvPolynomial.C_eq_zero] +- exact ⟨fun h ↦ by rw [← h2 (MvPolynomial.coeff 0 f), h default, map_zero], ++ exact ⟨fun h ↦ by rw [← h2 (f.coeff 0), h default, map_zero], + fun h _ ↦ by rw [h, map_zero]⟩ + + /-- **Splitting in several variables**: for monic `P₁, …, P_m ∈ ℂ{x}[t]`, the germs at the +diff --git a/Oka/AnalyticSpace/MonoDirectSummand.lean b/Oka/AnalyticSpace/MonoDirectSummand.lean +index 05b2b984eec3188fca13ecbf990b502439105bf3..96dc86f474aef07e2fb8a15658cdda65c8b57cb9 100644 +--- a/Oka/AnalyticSpace/MonoDirectSummand.lean ++++ b/Oka/AnalyticSpace/MonoDirectSummand.lean +@@ -239,22 +239,17 @@ noncomputable def FiniteEtaleOver.selfProdSnd : FiniteEtaleOver.selfProd i ⟶ A + Its triangle over `X` is not `rfl` and is the one place the square is used at the level of + morphisms rather than of points: `A.hom` is `i.left ≫ B.hom` because `i` is a morphism over `X`, + and the two composites to `B.left` agree by +-`ComplexAnalytic.AnalyticSpace.baseChange_square`. **The two `rfl`s after the rewrites are the +-comma-category seam** — `A.hom`'s source is `(𝟭 ComplexAnalytic.AnalyticSpace).obj A.left` and not +-`A.left`, and a rewrite leaves the goal in the second spelling. **The step before them is a +-`change` and not a `show`**, for the reason `ComplexAnalytic.AnalyticSpace.mono_ofRestrict`'s +-docstring gives: the two spellings are `rfl`-equal and not syntactically equal, so +-`linter.style.show` fires and `lake build --wfail` turns the warning into an error, which +-`lake env lean` on a scratch file does not. -/ ++`ComplexAnalytic.AnalyticSpace.baseChange_square`. The `change` aligns the comma-category spelling ++of the target before applying these identities. -/ + noncomputable def FiniteEtaleOver.selfProdFst : FiniteEtaleOver.selfProd i ⟶ A := + haveI : IsFiniteEtale i.left := FiniteEtaleOver.isFiniteEtale_left i + MorphismProperty.Over.homMk (baseChangeFst i.left i.left) (by + have hw : i.left ≫ B.hom = A.hom := MorphismProperty.Over.w i + change baseChangeFst i.left i.left ≫ A.hom = baseChangeSnd i.left i.left ≫ A.hom + have e1 : baseChangeFst i.left i.left ≫ A.hom +- = (baseChangeFst i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw]; rfl ++ = (baseChangeFst i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw] + have e2 : baseChangeSnd i.left i.left ≫ A.hom +- = (baseChangeSnd i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw]; rfl ++ = (baseChangeSnd i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw] + rw [e1, e2, baseChange_square]) + + /-- **A monomorphism of covers is injective on points**, when the target's total space is +diff --git a/Oka/AnalyticSpace/PushforwardStalkCoherent.lean b/Oka/AnalyticSpace/PushforwardStalkCoherent.lean +index 9bef8e578acabf034c54926a2dd6b1e8d7cd2962..8869167716a5e14b1b58d499c35fc7850f661eee 100644 +--- a/Oka/AnalyticSpace/PushforwardStalkCoherent.lean ++++ b/Oka/AnalyticSpace/PushforwardStalkCoherent.lean +@@ -222,7 +222,6 @@ theorem isCoherent_pushUnit_of_stalks + rw [stalkAlgMap_germ] + erw [map_mul] + rw [germ_res_pushforward f (h'.trans h₁W)] +- rfl + obtain ⟨c, hc⟩ := hrel y' hy'W _ hgerm + choose U hyU γ hγ using fun l ↦ Y.presheaf.exists_germ_eq (c l) + obtain ⟨W₂, hyW₂, hW₂⟩ := exists_open_forall Y y' (fun l V ↦ V ≤ U l) +diff --git a/Oka/AnalyticSpace/SeparatedFiniteEtale.lean b/Oka/AnalyticSpace/SeparatedFiniteEtale.lean +index fe033bee08bdb493773cd588fb632bbbf4490b00..835d18362e97be53a54e500d797c6a0cc3ec0c18 100644 +--- a/Oka/AnalyticSpace/SeparatedFiniteEtale.lean ++++ b/Oka/AnalyticSpace/SeparatedFiniteEtale.lean +@@ -409,10 +409,9 @@ noncomputable def SeparatedFiniteEtaleOver.selfProdSnd (i : A ⟶ B) : + + The triangle is `ComplexAnalytic.AnalyticSpace.FiniteEtaleOver.selfProdFst`'s and the proof is + that one read here: `A.hom` is `i.left ≫ B.hom` because `i` is a morphism over `X`, and the two +-composites to `B.left` agree by `ComplexAnalytic.AnalyticSpace.baseChange_square`. **The `change` +-is not a `show` and the two `rfl`s are the comma-category seam**, both for the reasons that +-docstring gives; neither is a stylistic choice and `lake build --wfail` turns the second into an +-error. -/ ++composites to `B.left` agree by `ComplexAnalytic.AnalyticSpace.baseChange_square`. The `change` ++exposes the equality of underlying morphisms, and rewriting by the structure triangle aligns the ++two composites. -/ + noncomputable def SeparatedFiniteEtaleOver.selfProdFst (i : A ⟶ B) : + SeparatedFiniteEtaleOver.selfProd i ⟶ A := + haveI : IsFiniteEtale i.left := SeparatedFiniteEtaleOver.isFiniteEtale_left i +@@ -420,9 +419,9 @@ noncomputable def SeparatedFiniteEtaleOver.selfProdFst (i : A ⟶ B) : + have hw : i.left ≫ B.hom = A.hom := MorphismProperty.Over.w i + change baseChangeFst i.left i.left ≫ A.hom = baseChangeSnd i.left i.left ≫ A.hom + have e1 : baseChangeFst i.left i.left ≫ A.hom +- = (baseChangeFst i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw]; rfl ++ = (baseChangeFst i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw] + have e2 : baseChangeSnd i.left i.left ≫ A.hom +- = (baseChangeSnd i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw]; rfl ++ = (baseChangeSnd i.left i.left ≫ i.left) ≫ B.hom := by rw [Category.assoc, hw] + rw [e1, e2, baseChange_square]) + + /-- **A monomorphism of this category is injective on points**, over a Hausdorff base. +diff --git a/Oka/AnalyticSpace/SeparatedFiniteEtaleLimits.lean b/Oka/AnalyticSpace/SeparatedFiniteEtaleLimits.lean +index 8ff2c0ca4a569d5fcfd505a69f4ee81a59056fb8..76bc85f173d0ebc89e2811a8377f6b7107092b57 100644 +--- a/Oka/AnalyticSpace/SeparatedFiniteEtaleLimits.lean ++++ b/Oka/AnalyticSpace/SeparatedFiniteEtaleLimits.lean +@@ -290,13 +290,8 @@ def fibreProdSnd (i : A ⟶ C) (j : B ⟶ C) : fibreProd i j ⟶ B := + The triangle over `X` is where `ComplexAnalytic.AnalyticSpace.baseChange_square` is spent: `A.hom` + is `i.left ≫ C.hom` and `B.hom` is `j.left ≫ C.hom`, both because a morphism of this category + commutes with the structure maps, and the two composites into `C.left` agree by that square. +-**The `change` is not a `show` and the two `rfl`s at the ends of `e1` and `e2` are the comma +-category's seam**, for the reason +-`ComplexAnalytic.AnalyticSpace.SeparatedFiniteEtaleOver.selfProdFst`'s docstring gives of the same +-two lines: `CategoryTheory.MorphismProperty.Over` is a comma category over +-`CategoryTheory.Functor.id`, so a structure morphism's source is `(𝟭 _).obj A.left` rather than +-`A.left`, and a `rw` whose motive crosses that unifier fails on an instance argument rather than +-on the equation. -/ ++The `change` exposes the equality of underlying morphisms, and rewriting by the two structure ++triangles aligns the composites with the base-change square. -/ + def fibreProdFst (i : A ⟶ C) (j : B ⟶ C) : fibreProd i j ⟶ A := + haveI : IsFiniteEtale i.left := isFiniteEtale_left i + MorphismProperty.Over.homMk (baseChangeFst i.left j.left) (by +@@ -304,9 +299,9 @@ def fibreProdFst (i : A ⟶ C) (j : B ⟶ C) : fibreProd i j ⟶ A := + have hj : j.left ≫ C.hom = B.hom := MorphismProperty.Over.w j + change baseChangeFst i.left j.left ≫ A.hom = baseChangeSnd i.left j.left ≫ B.hom + have e1 : baseChangeFst i.left j.left ≫ A.hom +- = (baseChangeFst i.left j.left ≫ i.left) ≫ C.hom := by rw [Category.assoc, hi]; rfl ++ = (baseChangeFst i.left j.left ≫ i.left) ≫ C.hom := by rw [Category.assoc, hi] + have e2 : baseChangeSnd i.left j.left ≫ B.hom +- = (baseChangeSnd i.left j.left ≫ j.left) ≫ C.hom := by rw [Category.assoc, hj]; rfl ++ = (baseChangeSnd i.left j.left ≫ j.left) ≫ C.hom := by rw [Category.assoc, hj] + rw [e1, e2, baseChange_square]) + + /-- **The square commutes in this category.** +diff --git a/Oka/Analytification/GAGA/CartanApprox.lean b/Oka/Analytification/GAGA/CartanApprox.lean +index 581b56da7387628e1e8cbd2d04a85b54a7b5f8f7..7ff68a39f4b23872a67738eedb69456f2f9bcbfc 100644 +--- a/Oka/Analytification/GAGA/CartanApprox.lean ++++ b/Oka/Analytification/GAGA/CartanApprox.lean +@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE. + Authors: Christian Merten + -/ + import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff ++import Mathlib.Topology.Algebra.Group.Units + import Oka.Analytification.GAGA.CartanNearOne + + /-! +diff --git a/Oka/Analytification/GAGA/CechProjectiveAn.lean b/Oka/Analytification/GAGA/CechProjectiveAn.lean +index ed2fc5a4c0c28f13f73dce5965442ec38dfa1e31..1ef973c306c5469e0aee642766c9e454801391cc 100644 +--- a/Oka/Analytification/GAGA/CechProjectiveAn.lean ++++ b/Oka/Analytification/GAGA/CechProjectiveAn.lean +@@ -213,7 +213,7 @@ lemma SummableAt.of_le {a b : Coeff n} {w w' : Fin (n + 1) → ℂ} (h : Summabl + by_cases hk : a k = 0 + · simp only [hk, norm_zero, zero_mul] + exact mul_nonneg (norm_nonneg _) (Finset.prod_nonneg fun i _ ↦ zpow_nonneg (norm_nonneg _) _) +- · exact mul_le_mul (hab k hk).1 (Finset.prod_le_prod ++ · exact mul_le_mul (hab k hk).1 (Finset.prod_le_prod₀ + (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ (hab k hk).2 i) + (Finset.prod_nonneg fun i _ ↦ zpow_nonneg (norm_nonneg _) _) (norm_nonneg _) + +diff --git a/Oka/Analytification/GAGA/MittagLeffler.lean b/Oka/Analytification/GAGA/MittagLeffler.lean +index 711b9c7df2560db92075615b89aebac7fd9690b7..52bdc81437280d285be3c9d6c4d6310947d15841 100644 +--- a/Oka/Analytification/GAGA/MittagLeffler.lean ++++ b/Oka/Analytification/GAGA/MittagLeffler.lean +@@ -77,7 +77,7 @@ theorem differentiableOn_of_tendstoLocallyUniformlyOn {ι : Type*} {l : Filter + have hKle : ∀ θ, ‖∏ i, (torusMap (0 : Fin m → ℂ) (fun _ ↦ ρ) θ i - y i)⁻¹‖ ≤ Cy := by + intro θ + rw [norm_prod] +- refine Finset.prod_le_prod (fun i _ ↦ norm_nonneg _) fun i _ ↦ ?_ ++ refine Finset.prod_le_prod₀ (fun i _ ↦ norm_nonneg _) fun i _ ↦ ?_ + rw [norm_inv] + have h2 := norm_sub_norm_le (torusMap (0 : Fin m → ℂ) (fun _ ↦ ρ) θ i) (y i) + rw [hnorm] at h2 +diff --git a/Oka/Analytification/GAGA/Proper/CechProjectiveBox.lean b/Oka/Analytification/GAGA/Proper/CechProjectiveBox.lean +index bf41f8f5c8ed23452192f3404e1795f9d43356a7..0cbb53b33705b6acdbbf9a6b154f188559745578 100644 +--- a/Oka/Analytification/GAGA/Proper/CechProjectiveBox.lean ++++ b/Oka/Analytification/GAGA/Proper/CechProjectiveBox.lean +@@ -225,7 +225,7 @@ lemma tsum_proj_toCoeff_eq + have hmono : ∀ k, negSupp k = N → ‖monomial k w‖ ≤ ‖monomial k w'‖ := by + intro k hk + rw [norm_monomial, norm_monomial] +- refine Finset.prod_le_prod (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ ?_ ++ refine Finset.prod_le_prod₀ (fun i _ ↦ zpow_nonneg (norm_nonneg _) _) fun i _ ↦ ?_ + by_cases hi : i ∈ I ∧ i ∉ N + · have : 0 ≤ k i := not_lt.1 fun h ↦ hi.2 (hk ▸ mem_negSupp.2 h) + simp only [w', hi, not_false_eq_true, and_self, if_true, Complex.norm_real, +diff --git a/Oka/Analytification/GAGA/Proper/GAGA3.lean b/Oka/Analytification/GAGA/Proper/GAGA3.lean +index d4040ca5b5330f7b491348fb1e5ad38b0c933989..ee911b977eabb89db35f547769f37bd039194b38 100644 +--- a/Oka/Analytification/GAGA/Proper/GAGA3.lean ++++ b/Oka/Analytification/GAGA/Proper/GAGA3.lean +@@ -194,14 +194,14 @@ theorem genericAlgebraization_of_isProperℂ (H : RelativeAnalyticSerre.{u}) + exact hw + have b₁ := fA.bijective_stalkFunctor_map_unit hf M + have b₂ := fA.bijective_stalkFunctor_map_pushforward hf _ hμ +- have b₃ := (((analytification.obj T).toLocallyRingedSpace.stalkFunctor +- (fA.base (ιA.base q))).mapIso +- (asIso (inv (analytificationPushforwardBaseChange π +- (twistAlong j G m))))).toLinearEquiv.bijective ++ have b₃ := ConcreteCategory.bijective_of_isIso ++ (((analytification.obj T).toLocallyRingedSpace.stalkFunctor ++ (fA.base (ιA.base q))).map ++ (inv (analytificationPushforwardBaseChange π (twistAlong j G m)))) + change Function.Bijective (((analytification.obj T).toLocallyRingedSpace.stalkFunctor + (fA.base (ιA.base q))).map ψ) +- simp only [ψ, Functor.map_comp, ConcreteCategory.coe_comp] +- exact b₃.comp (b₂.comp b₁) ++ simpa only [ψ, Functor.map_comp, ConcreteCategory.coe_comp, Function.comp_assoc] using ++ b₃.comp (b₂.comp b₁) + + variable (X) in + /-- **GAGA-3 for proper schemes**, assuming the analytic relative Serre theorem +diff --git a/Oka/Analytification/GAGA/Proper/RelativeBaseChangeTwist.lean b/Oka/Analytification/GAGA/Proper/RelativeBaseChangeTwist.lean +index e79d757c932d7223beb60e4a36231f3d6ac50ce6..83de59ad652db961074bfbd69a4aeb609aa7743f 100644 +--- a/Oka/Analytification/GAGA/Proper/RelativeBaseChangeTwist.lean ++++ b/Oka/Analytification/GAGA/Proper/RelativeBaseChangeTwist.lean +@@ -258,7 +258,7 @@ lemma eval₂_monoPoly {e : ℕ} (s : MonoExp N e) (y : Fin m → ℂ) (v : Fin + /-- **A homogeneous polynomial is the sum of its monomials.** -/ + lemma eq_sum_monoPoly {e : ℕ} (p : 𝒜 e) : + (p : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)) = +- ∑ s : MonoExp N e, C (coeff (monoExpFinsupp s) (p : MvPolynomial _ _)) * ++ ∑ s : MonoExp N e, C ((p : MvPolynomial _ _).coeff (monoExpFinsupp s)) * + (monoPoly.{u} (m := m) s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)) := by + refine MvPolynomial.ext _ _ fun d ↦ ?_ + simp only [monoPoly, coeff_sum, coeff_C_mul, coeff_monomial] +@@ -320,13 +320,14 @@ lemma globalSectionsEquiv_smul (hN : 1 ≤ N) (e : ℕ) (a : RelBase.{u} m) + `p = globalSectionsEquiv s`. -/ + lemma eq_sum_smul_monoSec (hN : 1 ≤ N) (e : ℕ) + (s : AlgSec (twistingSheaf N (RelBase.{u} m) e)) : +- s = ∑ t : MonoExp N e, coeff (monoExpFinsupp t) +- (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)) • monoSec hN t := by ++ s = ∑ t : MonoExp N e, ++ (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)).coeff ++ (monoExpFinsupp t) • monoSec hN t := by + apply (globalSectionsEquiv (R := RelBase.{u} m) hN e).injective + apply Subtype.ext + have h1 := map_sum (globalSectionsEquiv (R := RelBase.{u} m) hN e) +- (fun t ↦ coeff (monoExpFinsupp t) +- (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)) • monoSec hN t) ++ (fun t ↦ (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)).coeff ++ (monoExpFinsupp t) • monoSec hN t) + Finset.univ + refine Eq.trans ?_ (congrArg Subtype.val h1).symm + rw [Submodule.coe_sum] +@@ -373,8 +374,9 @@ lemma surjective_monoTensor (e : ℕ) : Function.Surjective (monoTensor.{u} D hN + induction x using TensorProduct.induction_on with + | zero => exact ⟨0, by simp [monoTensor]⟩ + | tmul f s => +- refine ⟨fun t ↦ polyToOka.{u} D (coeff (monoExpFinsupp t) +- (globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m))) * f, ?_⟩ ++ refine ⟨fun t ↦ polyToOka.{u} D ++ ((globalSectionsEquiv hN e s : MvPolynomial (Fin (N + 1)) (RelBase.{u} m)).coeff ++ (monoExpFinsupp t)) * f, ?_⟩ + conv_rhs => rw [eq_sum_smul_monoSec hN e s] + rw [TensorProduct.tmul_sum, monoTensor] + refine Finset.sum_congr rfl fun t _ ↦ ?_ +diff --git a/Oka/Analytification/RET/ES/BoundedSections.lean b/Oka/Analytification/RET/ES/BoundedSections.lean +index 1d5a6fa3eaecf2a4e1e242e0c0ca0386d022a1f4..323af19a698cee76c7cd2f63689e4af17ea83bd0 100644 +--- a/Oka/Analytification/RET/ES/BoundedSections.lean ++++ b/Oka/Analytification/RET/ES/BoundedSections.lean +@@ -153,7 +153,7 @@ lemma evalFun_of_mem {Z : AnalyticSpace.{u}} {O : Z.Opens} (a : Z.presheaf.obj ( + lemma continuousOn_evalFun {Z : AnalyticSpace.{u}} {O : Z.Opens} (a : Z.presheaf.obj (op O)) : + ContinuousOn (evalFun a) O := by + rw [continuousOn_iff_continuous_restrict] +- have : (O : Set Z).restrict (evalFun a) = fun z : O ↦ Z.eval z.1 z.2 a := ++ have : (O : Set Z).domRestrict (evalFun a) = fun z : O ↦ Z.eval z.1 z.2 a := + funext fun z ↦ evalFun_of_mem a z.2 + rw [this] + exact Z.continuous_eval a +@@ -391,7 +391,7 @@ theorem exists_local_sheets [T2Space W.left] {x₀ : Cn.{u} n} (hx₀ : x₀ ∈ + simp only [σ, dif_pos hxN, hG i _ hxU] + exact congrArg Subtype.val (hfG i _ hxU) + · rw [continuousOn_iff_continuous_restrict] +- have : B.restrict (σ i) = fun x : B ↦ ++ have : B.domRestrict (σ i) = fun x : B ↦ + (H.symm (⟨⟨x.1, (hB x.1 x.2).1⟩, (hB x.1 x.2).2⟩, i)).1 := by + funext x + simp only [Set.restrict_apply, σ, dif_pos (hB x.1 x.2).1, hG i _ (hB x.1 x.2).2] +diff --git a/Oka/Analytification/RET/ES/BoundedSectionsHartogs.lean b/Oka/Analytification/RET/ES/BoundedSectionsHartogs.lean +index b522e0bee17bfd58c8ad0c8d31227ee13ced1eee..374151aa665364f60f09866aa196f6254cdc5b57 100644 +--- a/Oka/Analytification/RET/ES/BoundedSectionsHartogs.lean ++++ b/Oka/Analytification/RET/ES/BoundedSectionsHartogs.lean +@@ -207,8 +207,8 @@ theorem mem_boundedSubring_of_map_mem [T2Space W.left] (hD : HasThinComplement N + obtain ⟨c', hc'⟩ := (bijective_map_of_regularPairFamily P hVU hV'V hV').2 (c k) + refine ⟨c', fun x hx hxN ↦ ?_⟩ + rw [← holFun_map hV'V c' hx, hc', hc k x hx hxN] +- congr 1 +- refine charPolyFun_congr W fun w hw ↦ ha' w ((mem_preim_iff h₀ W).2 (hw ▸ hx)) ++ exact congrArg (fun p : Polynomial ℂ ↦ p.coeff k) ++ (charPolyFun_congr W fun w hw ↦ ha' w ((mem_preim_iff h₀ W).2 (hw ▸ hx))) + choose c' hc' using hc' + -- a ball around `x₀` in `img V`, over which the number of sheets is constant + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 (img V).isOpen x₀ hx₀ +diff --git a/Oka/Analytification/RET/ES/CapExtension/ChartReverse.lean b/Oka/Analytification/RET/ES/CapExtension/ChartReverse.lean +index 8a4d84a8547b1140fd711465a10c7e6618a6d2b4..519a5c78ebf048be99ce17661e14b605b44c4692 100644 +--- a/Oka/Analytification/RET/ES/CapExtension/ChartReverse.lean ++++ b/Oka/Analytification/RET/ES/CapExtension/ChartReverse.lean +@@ -67,7 +67,9 @@ theorem hasLocalModuleRelationsAt_of {z : Z} (hM : HasLocalModuleRelationsAt M ( + refine ⟨C.pre W, hpreV, k, fun l i ↦ C.ψ (C.pre W) (Y.res hWe.le (g l i)), hzW, + fun l ↦ ?_, fun W' hW' a ha y hy ↦ ?_⟩ + · have := congrArg (fun s ↦ C.φ (C.pre W) (sectRes M hWe.le s)) (hrel l) +- simp only [sectRes_sum, sectRes_smul, C.φ_sum, sectRes_zero, map_zero] at this ++ simp only [sectRes_sum, sectRes_smul, C.φ_sum, sectRes_zero] at this ++ have hzero : C.φ (C.pre W) 0 = 0 := (C.φ (C.pre W)).map_zero ++ rw [hzero] at this + rw [← this] + refine Finset.sum_congr rfl fun i _ ↦ ?_ + rw [C.φ_smul, sectRes_sectRes, C.φ_res hpreV, φ_φInv] +@@ -92,6 +94,8 @@ theorem hasLocalModuleRelationsAt_of {z : Z} (hM : HasLocalModuleRelationsAt M ( + rw [C.ψ_res hpre, ψ_ψInv] + rw [e₁, ← Y.res_res hW''e.le hW'', this] + refine Finset.sum_congr rfl fun l _ ↦ ?_ ++ change C.ψ (C.pre W'') (Y.res hW''e.le ++ (c l * Y.res (hW''.trans hW'e) (g l i))) = _ + rw [res_mul, map_mul, Y.res_res, C.ψ_res_res _ (hpre.trans hW') hWe.le] + + end AlgebraicGeometry.LocallyRingedSpace.ModuleChart +diff --git a/Oka/Analytification/RET/ES/Codim2/BPointConfig.lean b/Oka/Analytification/RET/ES/Codim2/BPointConfig.lean +index 42cbba4b625bf4eedd6512f31b175e5b96c88a8a..33f963d8779e62c9d631495ab0359703f3f4d5ef 100644 +--- a/Oka/Analytification/RET/ES/Codim2/BPointConfig.lean ++++ b/Oka/Analytification/RET/ES/Codim2/BPointConfig.lean +@@ -268,7 +268,7 @@ lemma sec_mem_region {p : Cn.{u} n × ℂ} (hp : p.1 ∈ d.G') (ht : ‖p.2‖ < + lemma differentiableOn_Q_coeff (k : ℕ) : + DifferentiableOn ℂ (d.Q.coeff k) (d.G' ×ˢ ball 0 d.r) := by + have hsec : Differentiable ℂ d.sec := differentiableOn_univ.1 +- (differentiableOn_update (fun e _ ↦ ((differentiable_baseProj (it := d.it) (iw := d.iw) ++ (differentiableOn_update (fun (e : Cn.{u} n × ℂ) _ ↦ ((differentiable_baseProj (it := d.it) (iw := d.iw) + e.1).comp e differentiableAt_fst).differentiableWithinAt) + differentiable_snd.differentiableOn d.it) + have : d.Q.coeff k = fun p ↦ d.P.coeff k (d.sec p) := funext (d.Q_coeff k) +diff --git a/Oka/Analytification/RET/ES/Codim2/NormalCrossingsBasis.lean b/Oka/Analytification/RET/ES/Codim2/NormalCrossingsBasis.lean +index ef039b72945947b5f998d5ae0388d3928a9a992a..6866f4cdc162bc7fa5eff6c06bb1eca0c406b212 100644 +--- a/Oka/Analytification/RET/ES/Codim2/NormalCrossingsBasis.lean ++++ b/Oka/Analytification/RET/ES/Codim2/NormalCrossingsBasis.lean +@@ -121,7 +121,7 @@ lemma norm_val_le (i : K.ι) (w : W.left) : ‖K.val i w‖ ≤ 1 := by + by_cases h : ∃ u, K.Φ i.1 u = w + · obtain ⟨u, hu⟩ := h + rw [K.val_eq i hu, KummerPi.monomial, norm_prod] +- refine Finset.prod_le_one (fun _ _ ↦ norm_nonneg _) fun k _ ↦ ?_ ++ refine Finset.prod_le_one₀ (fun _ _ ↦ norm_nonneg _) fun k _ ↦ ?_ + rw [norm_pow] + exact pow_le_one₀ (norm_nonneg _) ((KummerPi.mem_base.1 u.2).2 k).2.le + · rw [K.val_eq_zero i fun u hu ↦ h ⟨u, hu⟩, norm_zero] +@@ -164,7 +164,7 @@ theorem exists_eval_eq_val (i : K.ι) : + dif_pos hz + have hΦ'c : ContinuousOn Φ' (KummerPi.base χ.B r) := by + rw [continuousOn_iff_continuous_restrict] +- have : (KummerPi.base χ.B r).restrict Φ' = K.Φ c := funext fun z ↦ hΦ' z.1 z.2 ++ have : (KummerPi.base χ.B r).domRestrict Φ' = K.Φ c := funext fun z ↦ hΦ' z.1 z.2 + rw [this] + exact K.continuous c + obtain ⟨O₁, hwO₁, hinj, -⟩ := exists_sheet W w +diff --git a/Oka/Analytification/RET/ES/Codim2/PuiseuxCoord.lean b/Oka/Analytification/RET/ES/Codim2/PuiseuxCoord.lean +index 7b372bc3b5887bd9987d5c7557b18322f7eff199..11746c11c844207227ba398ed8db69828a17134f 100644 +--- a/Oka/Analytification/RET/ES/Codim2/PuiseuxCoord.lean ++++ b/Oka/Analytification/RET/ES/Codim2/PuiseuxCoord.lean +@@ -378,7 +378,7 @@ lemma exists_norm_sub_zeta_pow_mul_lt {s : ℕ} (hs : 0 < s) {a b : ℂ} {r : + rw [hζ.pow_sub_pow_eq_prod_sub_mul a b hs, norm_prod] + calc r ^ s = ∏ _μ ∈ Polynomial.nthRootsFinset s (1 : ℂ), r := by + rw [Finset.prod_const, hζ.card_nthRootsFinset] +- _ ≤ _ := Finset.prod_le_prod (fun _ _ ↦ hr.le) hle ++ _ ≤ _ := Finset.prod_le_prod₀ (fun _ _ ↦ hr.le) hle + exact absurd h (not_lt.2 this) + + /-- **The preimage of a small neighbourhood off `t = 0` splits into `s` pieces.** Let `y'` be a +diff --git a/Oka/Analytification/RET/ES/CurveEtale.lean b/Oka/Analytification/RET/ES/CurveEtale.lean +index 1f1cd2b0a5ea2b932ae4ed78e97c6c11ba0671cf..d0efa5d5eace75f3f0da7be0822b314e89f41db1 100644 +--- a/Oka/Analytification/RET/ES/CurveEtale.lean ++++ b/Oka/Analytification/RET/ES/CurveEtale.lean +@@ -173,16 +173,18 @@ lemma exists_ltSeries_of_isIntegral (hinj : Function.Injective (algebraMap R S)) + (l : LTSeries (PrimeSpectrum R)) : + ∃ L : LTSeries (PrimeSpectrum S), L.length = l.length ∧ + L.last.asIdeal.comap (algebraMap R S) = l.last.asIdeal := by ++ have : FaithfulSMul R S := (faithfulSMul_iff_algebraMap_injective R S).mpr hinj + induction l using RelSeries.inductionOn' with + | singleton p => + obtain ⟨Q, -, hQ, hQp⟩ := Ideal.exists_ideal_over_prime_of_isIntegral p.asIdeal (⊥ : Ideal S) +- (by rw [← RingHom.ker_eq_comap_bot, (RingHom.injective_iff_ker_eq_bot _).1 hinj] ++ (by rw [Ideal.under_bot] + exact bot_le) + exact ⟨RelSeries.singleton _ ⟨Q, hQ⟩, rfl, hQp⟩ + | snoc l p hlp ih => + obtain ⟨L, hL, hLl⟩ := ih ++ have hLl' : Ideal.under R L.last.asIdeal = l.last.asIdeal := hLl + obtain ⟨Q, hQL, hQ, hQp⟩ := Ideal.exists_ideal_over_prime_of_isIntegral_of_isPrime +- p.asIdeal L.last.asIdeal (by rw [hLl]; exact le_of_lt hlp) ++ p.asIdeal L.last.asIdeal (by rw [hLl']; exact le_of_lt hlp) + have hlp' : l.last < p := hlp + have hlt : L.last < ⟨Q, hQ⟩ := lt_of_le_of_ne hQL fun h ↦ hlp'.ne (PrimeSpectrum.ext + (hLl.symm.trans ((congrArg (fun P : PrimeSpectrum S ↦ P.asIdeal.comap (algebraMap R S)) +@@ -211,8 +213,8 @@ theorem exists_finite_injective_of_ringKrullDim_eq_one {k A : Type*} [Field k] [ + letI := g.toRingHom.toAlgebra + haveI : Module.Finite (MvPolynomial (Fin s) k) A := hfin + have hdimP : ringKrullDim (MvPolynomial (Fin s) k) = s := by +- rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field, +- Nat.card_eq_fintype_card, Fintype.card_fin, zero_add] ++ rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field] ++ simp + have h1 := ringKrullDim_le_of_isIntegral (R := MvPolynomial (Fin s) k) (S := A) + have h2 := ringKrullDim_le_of_isIntegral_of_injective (R := MvPolynomial (Fin s) k) (S := A) + hinj +diff --git a/Oka/Analytification/RET/ES/CurveSections.lean b/Oka/Analytification/RET/ES/CurveSections.lean +index df0b02dc61ad7a8299c7f6e2fd8147131fed5625..9caecf1061ad875322897d1ce7f6b30880f6775c 100644 +--- a/Oka/Analytification/RET/ES/CurveSections.lean ++++ b/Oka/Analytification/RET/ES/CurveSections.lean +@@ -298,6 +298,34 @@ lemma eval_growthVal (f : W.presheaf.obj (op ⊤)) (k : ℕ) {V : (projectiveSpa + rw [growthVal, map_mul, eval_presheaf_map, eval_presheaf_map, + eval_c_app _ (toProjectiveLine ρ₀).isCLinear] + ++private lemma norm_eval_growthVal (f : W.presheaf.obj (op ⊤)) (k : ℕ) ++ {V : (projectiveSpaceAn.{u} 1).Opens} ++ (t : (pbTwist πP (twistCocycle.{u} k)).val.obj (op V)) (w : W) ++ (hw : (toProjectiveLine ρ₀).toLRSHom.base w ∈ V) ++ (hw1 : (toProjectiveLine ρ₀).toLRSHom.base w ∈ V ⊓ preimOpen πP (stdU 1)) : ++ ‖W.eval w hw (growthVal ρ₀ f k t)‖ = ++ ‖coord (ρ₀.toLRSHom.base w) ^ (-(k : ℤ))‖ * ++ ‖(projectiveSpaceAn.{u} 1).eval _ hw1 (pbComp t 1)‖ * ++ ‖W.eval (U := ⊤) w trivial f‖ := by ++ let z := coord (ρ₀.toLRSHom.base w) ++ let q := pointOfVec.{u} ![1, z] (by simp) ++ have hpt : (toProjectiveLine ρ₀).toLRSHom.base w = q := ++ chart_zero_eq_pointOfVec _ ++ have hp0 : (toProjectiveLine ρ₀).toLRSHom.base w ∈ V ⊓ preimOpen πP (stdU 0) := ++ ⟨hw, πP_chart_mem 0 _⟩ ++ have hq0 : q ∈ V ⊓ preimOpen πP (stdU 0) := hpt ▸ hp0 ++ have hq1 : q ∈ V ⊓ preimOpen πP (stdU 1) := hpt ▸ hw1 ++ have e0 := eval_pbComp_zero k t z hq0 hq1 ++ have echart : (projectiveSpaceAn.{u} 1).eval _ hp0 (pbComp t 0) = ++ z ^ (-(k : ℤ)) * (projectiveSpaceAn.{u} 1).eval _ hw1 (pbComp t 1) := ++ (eval_congr_point hpt hp0 hq0 (pbComp t 0)).trans ++ (e0.trans (congrArg (fun a : ℂ ↦ z ^ (-(k : ℤ)) * a) ++ (eval_congr_point hpt hw1 hq1 (pbComp t 1)).symm)) ++ have egrowth := (eval_growthVal ρ₀ f k t w hw).trans ++ (congrArg (fun a : ℂ ↦ a * W.eval (U := ⊤) w trivial f) echart) ++ exact (congrArg norm egrowth).trans ((norm_mul _ _).trans ++ (congrArg (· * ‖W.eval (U := ⊤) w trivial f‖) (norm_mul _ _))) ++ + lemma isBoundedNear_growthVal (f : W.presheaf.obj (op ⊤)) (k : ℕ) (C R : ℝ) (hR : 0 < R) + (hf : ∀ w : W, R < ‖coord (ρ₀.toLRSHom.base w)‖ → + ‖W.eval (U := ⊤) w trivial f‖ ≤ C * ‖coord (ρ₀.toLRSHom.base w)‖ ^ k) +@@ -317,18 +345,13 @@ lemma isBoundedNear_growthVal (f : W.presheaf.obj (op ⊤)) (k : ℕ) (C R : ℝ + set z := coord (ρ₀.toLRSHom.base w) + have hzR : R < ‖z‖ := (chart_zero_mem_nbd_iff hR _).1 hwN.2 + have hz0 : z ≠ 0 := norm_pos_iff.1 (hR.trans hzR) +- have hpt : (toProjectiveLine ρ₀).toLRSHom.base w = pointOfVec.{u} ![1, z] (by simp) := +- chart_zero_eq_pointOfVec _ + have hw1 : (toProjectiveLine ρ₀).toLRSHom.base w ∈ V ⊓ preimOpen πP (stdU 1) := by + refine ⟨hw, ?_⟩ + have := πP_chart_mem 1 (ofCoord z⁻¹) + rw [← chart_zero_eq_chart_one _ hz0] at this + exact this + have hbdt := hwN.1 ⟨_, hw1⟩ rfl +- rw [eval_growthVal] +- have e0 := eval_pbComp_zero k t z (hpt ▸ ⟨hw, πP_chart_mem 0 _⟩) (hpt ▸ hw1) +- rw [eval_congr_point hpt _ (hpt ▸ ⟨hw, πP_chart_mem 0 _⟩), e0, norm_mul, norm_mul, +- ← eval_congr_point hpt hw1 (hpt ▸ hw1)] ++ rw [norm_eval_growthVal ρ₀ f k t w hw hw1] + have hzk : ‖z ^ (-(k : ℤ))‖ * ‖z‖ ^ k = 1 := by + rw [norm_zpow, zpow_neg, zpow_natCast, inv_mul_cancel₀ (pow_ne_zero _ (norm_ne_zero_iff.2 hz0))] + calc ‖z ^ (-(k : ℤ))‖ * ‖(projectiveSpaceAn.{u} 1).eval _ hw1 (pbComp t 1)‖ * +@@ -386,13 +409,9 @@ lemma growthVal_res {V V' : (projectiveSpaceAn.{u} 1).Opens} (h : V' ≤ V) + · have := c_app_res (M := W.toLocallyRingedSpace) (toProjectiveLine ρ₀).toLRSHom + (inf_le_inf_right _ h : V' ⊓ preimOpen πP (stdU 0) ≤ V ⊓ preimOpen πP (stdU 0)) (pbComp t 0) + refine (congrArg (W.presheaf.map _).hom this).trans ?_ +- change W.presheaf.map _ (W.presheaf.map _ _) = W.presheaf.map _ (W.presheaf.map _ _) +- rw [← ConcreteCategory.comp_apply, ← ConcreteCategory.comp_apply, ← W.presheaf.map_comp, +- ← W.presheaf.map_comp] +- rfl +- · change _ = W.presheaf.map _ (W.presheaf.map _ f) +- rw [← ConcreteCategory.comp_apply, ← W.presheaf.map_comp] +- rfl ++ exact (res_res W.toLocallyRingedSpace _ _ (ρPull ρ₀ (pbComp t 0))).trans ++ (res_res W.toLocallyRingedSpace _ _ (ρPull ρ₀ (pbComp t 0))).symm ++ · exact (res_res W.toLocallyRingedSpace _ _ f).symm + + include hR hf in + /-- The section of the extension given by `t₀ · f`. -/ +diff --git a/Oka/Analytification/RET/ES/CurveSetup.lean b/Oka/Analytification/RET/ES/CurveSetup.lean +index ab3d6f13647c172f21ff20674d9988789f2e5a2f..8c31a79e2c9b84ee720797942c18f4ffad9b6e60 100644 +--- a/Oka/Analytification/RET/ES/CurveSetup.lean ++++ b/Oka/Analytification/RET/ES/CurveSetup.lean +@@ -117,15 +117,14 @@ lemma etale_restrictι_comp_toAffineSpace (f : Γ(V.obj.left, ⊤)) + (Scheme.ΓSpecIso (.of (MvPolynomial (Fin N) (ULift.{u} ℂ)))).inv _).1 + ((RingHom.Etale.respectsIso.cancel_right_isIso _ U.topIso.hom).1 ?_) + convert hf using 2 +- · rfl +- · refine RingHom.ext fun p ↦ ?_ +- change U.topIso.hom (U.ι.appTop ((SchemeLFTℂ.toAffineSpace s hs).hom.left.appTop +- ((Scheme.ΓSpecIso (.of (MvPolynomial (Fin N) (ULift.{u} ℂ)))).inv p))) = _ +- rw [SchemeLFTℂ.toAffineSpace_appTop] +- change (U.ι.appTop ≫ U.topIso.hom) (s p) = V.obj.left.presheaf.map _ (s p) +- rw [Scheme.Opens.ι_appTop, Scheme.Opens.topIso_hom] +- erw [← Functor.map_comp] +- rfl ++ refine RingHom.ext fun p ↦ ?_ ++ change U.topIso.hom (U.ι.appTop ((SchemeLFTℂ.toAffineSpace s hs).hom.left.appTop ++ ((Scheme.ΓSpecIso (.of (MvPolynomial (Fin N) (ULift.{u} ℂ)))).inv p))) = _ ++ rw [SchemeLFTℂ.toAffineSpace_appTop] ++ change (U.ι.appTop ≫ U.topIso.hom) (s p) = V.obj.left.presheaf.map _ (s p) ++ rw [Scheme.Opens.ι_appTop, Scheme.Opens.topIso_hom] ++ erw [← Functor.map_comp] ++ rfl + + end Etale + +diff --git a/Oka/Analytification/RET/ES/FiniteCoherent.lean b/Oka/Analytification/RET/ES/FiniteCoherent.lean +index 8a7bd9900ee3dee401920de065d542498da41e09..59834fd242ae5c33dfdb49bab139118fa01eb22e 100644 +--- a/Oka/Analytification/RET/ES/FiniteCoherent.lean ++++ b/Oka/Analytification/RET/ES/FiniteCoherent.lean +@@ -157,7 +157,7 @@ theorem isCoherent_pushUnit_analytification_map {Y S : SchemeLFTℂ.{u}} [IsAffi + simp [π, Fintype.linearCombination_apply, Algebra.smul_def, RingHom.algebraMap_toAlgebra] + · obtain ⟨x, rfl⟩ := (hbij s').2 z + obtain ⟨r, rfl⟩ := TensorProduct.exists_eq_sum_tmul_of_span_eq_top hb x +- exact ⟨r, by simp only [map_sum, pushforwardStalkTensorMap_tmul]; rfl⟩ ++ exact ⟨r, by simp only [map_sum, pushforwardStalkTensorMap_tmul]⟩ + · have h0 : pushforwardStalkTensorMap (analytification.map q) (analytificationΓ Y) + (analytificationΓ_naturality q) s' (∑ j, r j ⊗ₜ b j) = 0 := by + simp only [map_sum, pushforwardStalkTensorMap_tmul] +diff --git a/Oka/Analytification/RET/ES/NormalToSmooth.lean b/Oka/Analytification/RET/ES/NormalToSmooth.lean +index 89e66a7c9ceea3f8305196a9240f6535038fcecf..17e405dfbe767f501fa42224bed4c1f12bdfd762 100644 +--- a/Oka/Analytification/RET/ES/NormalToSmooth.lean ++++ b/Oka/Analytification/RET/ES/NormalToSmooth.lean +@@ -619,7 +619,6 @@ theorem bijective_res_of_isLocalIso (Ω : Z.Opens) : + refine (LocallyRingedSpace.res_res _ h₁ (hNΩ y hy.1) t).symm.trans ?_ + change Z.res h₁ (LocallyRingedSpace.sectRes (SheafOfModules.unit Z.ringSheaf) (hNΩ y hy.1) t) = _ + rw [ht, hu] +- rfl + end Sheet + + /-! ### Hartogs extension and normalisation -/ +diff --git a/Oka/Analytification/RET/ES/Normalization.lean b/Oka/Analytification/RET/ES/Normalization.lean +index 810f32cd7a3a30f17b5a1e44d39a8a85c04e2254..c53e2f27b06b041e8c92d987cca0be88aa4ad1da 100644 +--- a/Oka/Analytification/RET/ES/Normalization.lean ++++ b/Oka/Analytification/RET/ES/Normalization.lean +@@ -507,7 +507,11 @@ lemma surjective_specAlgebraHom (x : analytification.obj X) : + exact zero_mem _ + obtain ⟨q, -, hq, hqc⟩ := Ideal.exists_ideal_over_prime_of_isIntegral (affinePt x).asIdeal ⊥ hker + have hqm : q.IsMaximal := +- Ideal.isMaximal_of_isIntegral_of_isMaximal_comap q (by rw [hqc]; infer_instance) ++ Ideal.isMaximal_of_isIntegral_of_isMaximal_comap (algebraMap Γ(X.obj.left, ⊤) S) ++ (algebraMap_isIntegral_iff.mpr inferInstance) q (by ++ change (q.under Γ(X.obj.left, ⊤)).IsMaximal ++ rw [hqc] ++ infer_instance) + obtain ⟨y, hy⟩ := exists_specPt_eq (X := X) ⟨q, hq⟩ hqm + refine ⟨y, affinePt_injective ?_⟩ + rw [affinePt_specAlgebraHom, hy] +diff --git a/Oka/Analytification/RET/ES/ReflexiveHull.lean b/Oka/Analytification/RET/ES/ReflexiveHull.lean +index 554dea1b47636c108ba7fa7d9d9e6493ff81c936..105051040478dbff1661fa6a6544411e35cb6b7b 100644 +--- a/Oka/Analytification/RET/ES/ReflexiveHull.lean ++++ b/Oka/Analytification/RET/ES/ReflexiveHull.lean +@@ -294,7 +294,6 @@ def reflexiveHullData {U : (space N).Opens} (P : RegularPairFamily (img U : Set + τ_smul j V hV r a := by rw [mulSec_smul, trace_smul] + τ_res j V hV V' h a := by + rw [← sectRes_sectRes (boundedModule h₀ W) h hV, ← mulSec_map, trace_map] +- rfl + eq_zero_of_τ V hV a ha := eq_zero_of_trace_mulSec_eq_zero h₀ W hD P s + (fun y hy hyZ ↦ exists_span_of_isFreeSpanAt (hfree y hy fun h ↦ hyZ (hS h))) hV a ha + injective_res V hV := +diff --git a/Oka/Analytification/RET/ES/SmoothLocus.lean b/Oka/Analytification/RET/ES/SmoothLocus.lean +index 2e60cb37b692ff02841ec16207db3964879a58c7..09196574d7f84aea25f25f74b61050b3fab44885 100644 +--- a/Oka/Analytification/RET/ES/SmoothLocus.lean ++++ b/Oka/Analytification/RET/ES/SmoothLocus.lean +@@ -151,7 +151,7 @@ lemma exists_ringKrullDim_le_natCast (X : SchemeLFTℂ.{u}) [IsAffine X.obj.left + obtain ⟨k, f, hf⟩ := Algebra.FiniteType.iff_quotient_mvPolynomial''.mp + (inferInstance : Algebra.FiniteType ℂ Γ(X.obj.left, ⊤)) + refine ⟨k, (ringKrullDim_le_of_surjective f.toRingHom hf).trans_eq ?_⟩ +- rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field, zero_add, ++ rw [MvPolynomial.ringKrullDim_of_isNoetherianRing_of_finite, ringKrullDim_eq_zero_of_field, zero_add, + Nat.card_eq_fintype_card, Fintype.card_fin] + + /-- A nontrivial ring of dimension at most a natural number has dimension a natural number. -/ +diff --git a/Oka/Analytification/RET/ES/SmoothSections.lean b/Oka/Analytification/RET/ES/SmoothSections.lean +index c6fc7b660664da1ebc77c4120d2a7e56c2280cbe..9161b7eef76650d4b64b48f4b82fa9fbd724e84c 100644 +--- a/Oka/Analytification/RET/ES/SmoothSections.lean ++++ b/Oka/Analytification/RET/ES/SmoothSections.lean +@@ -473,13 +473,9 @@ lemma growthVal_res {V V' : (projectiveSpaceAn.{u} n).Opens} (h : V' ≤ V) + · have := c_app_res (M := W.toLocallyRingedSpace) (toProj ρ₀).toLRSHom + (inf_le_inf_right _ h : V' ⊓ preimOpen πP (stdU 0) ≤ V ⊓ preimOpen πP (stdU 0)) (pbComp t 0) + refine (congrArg (W.presheaf.map _).hom this).trans ?_ +- change W.presheaf.map _ (W.presheaf.map _ _) = W.presheaf.map _ (W.presheaf.map _ _) +- rw [← ConcreteCategory.comp_apply, ← ConcreteCategory.comp_apply, ← W.presheaf.map_comp, +- ← W.presheaf.map_comp] +- rfl +- · change _ = W.presheaf.map _ (W.presheaf.map _ f) +- rw [← ConcreteCategory.comp_apply, ← W.presheaf.map_comp] +- rfl ++ exact (res_res W.toLocallyRingedSpace _ _ (ρPull ρ₀ (pbComp t 0))).trans ++ (res_res W.toLocallyRingedSpace _ _ (ρPull ρ₀ (pbComp t 0))).symm ++ · exact (res_res W.toLocallyRingedSpace _ _ f).symm + + include hR hf in + /-- The section of the extension given by `t₀ · f`. -/ +diff --git a/Oka/Analytification/RET/ES/SmoothSetup.lean b/Oka/Analytification/RET/ES/SmoothSetup.lean +index f5303cbdb348140ce6f5f8629a36ae0018566c00..c192325f00bad81579d32a3732d9bc496ad891aa 100644 +--- a/Oka/Analytification/RET/ES/SmoothSetup.lean ++++ b/Oka/Analytification/RET/ES/SmoothSetup.lean +@@ -48,7 +48,7 @@ theorem exists_finite_injective_of_ringKrullDim_eq {k A : Type*} [Field k] [Comm + letI := g.toRingHom.toAlgebra + haveI : Module.Finite (MvPolynomial (Fin s) k) A := hfin + have hdimP : ringKrullDim (MvPolynomial (Fin s) k) = s := by +- rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field, ++ rw [MvPolynomial.ringKrullDim_of_isNoetherianRing_of_finite, ringKrullDim_eq_zero_of_field, + Nat.card_eq_fintype_card, Fintype.card_fin, zero_add] + have h1 := ringKrullDim_le_of_isIntegral (R := MvPolynomial (Fin s) k) (S := A) + have h2 := ringKrullDim_le_of_isIntegral_of_injective (R := MvPolynomial (Fin s) k) (S := A) +diff --git a/Oka/CategoryTheory/GlueData.lean b/Oka/CategoryTheory/GlueData.lean +index 850eece1ecb877738a92c5f04bca8f077ea535c1..abec33f687ac099fb2322275fa2c3be21cc1af5d 100644 +--- a/Oka/CategoryTheory/GlueData.lean ++++ b/Oka/CategoryTheory/GlueData.lean +@@ -233,7 +233,7 @@ theorem GlueData.ofGlueData'_comm {Y : C} (fY : ∀ i, D.U i ⟶ Y) + rcases eq_or_ne i j with rfl | hij + · rw [GlueData.ofGlueData'_f_self, GlueData.ofGlueData'_t_self] + simp +- · rw [← Category.assoc, GlueData.ofGlueData'_t_comp_f_of_ne D hij, ++ · erw [← Category.assoc, GlueData.ofGlueData'_t_comp_f_of_ne D hij, + GlueData.ofGlueData'_f_of_ne D hij] + dsimp only [GlueData.ofGlueData'] + rw [Category.assoc, Category.assoc, cancel_epi, Category.assoc] +@@ -253,7 +253,7 @@ theorem GlueData.comm_of_ofGlueData'_comm {Y : C} (fY : ∀ i, D.U i ⟶ Y) + {i j : D.J} (hij : i ≠ j) : + D.f i j hij ≫ fY i = D.t i j hij ≫ D.f j i hij.symm ≫ fY j := by + have hij' := h i j +- rw [← Category.assoc, GlueData.ofGlueData'_t_comp_f_of_ne D hij, ++ erw [← Category.assoc, GlueData.ofGlueData'_t_comp_f_of_ne D hij, + GlueData.ofGlueData'_f_of_ne D hij] at hij' + dsimp only [GlueData.ofGlueData'] at hij' + rw [Category.assoc, Category.assoc, cancel_epi, Category.assoc] at hij' +diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace.lean +index cbaafe504f2ecccafef096383cbcf4420f804956..3040fbcf45bf5ef15160f54058407d35989ffc7c 100644 +--- a/Oka/Geometry/RingedSpace/LocallyRingedSpace.lean ++++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace.lean +@@ -294,6 +294,7 @@ lemma restrictStalkIso_hom_stalkAlgMap {R : Type*} [NonAssocSemiring R] + (X.restrictStalkIso U.isOpenEmbedding x).hom + ((X.restrict U.isOpenEmbedding).stalkAlgMap (X.resAlgMap α U) x c) = + X.stalkAlgMap α x.1 c := by ++ change U at x + change (X.restrictStalkIso U.isOpenEmbedding x).hom + ((X.restrict U.isOpenEmbedding).presheaf.germ ⊤ x trivial + ((X.presheaf.map (homOfLE le_top).op).hom (α c))) = _ +@@ -432,6 +433,7 @@ lemma germ_Γ_map_ofRestrict (X : LocallyRingedSpace.{u}) (U : Opens X) + ((X.restrict U.isOpenEmbedding).presheaf.germ ⊤ x trivial + ((Γ.map (X.ofRestrict U.isOpenEmbedding).op).hom s)) = + X.presheaf.germ ⊤ x.1 trivial s := by ++ change U at x + rw [Γ_map_ofRestrict_apply, restrictStalkIso_hom_eq_germ_apply] + exact X.presheaf.germ_res_apply (homOfLE le_top) x.1 _ s + +@@ -510,7 +512,7 @@ lemma germ_eq_stalkMap_ofRestrict (X : LocallyRingedSpace.{u}) (U : Opens X) + (homOfLE (U.isOpenEmbedding.isOpenMap.adjunction.unit.app O).le) w hO _) + refine congrArg ((X.restrict U.isOpenEmbedding).presheaf.germ O w hO) ?_ + change b = (X.presheaf.map _).hom ((X.presheaf.map _).hom b) +- rw [← ConcreteCategory.comp_apply, ← X.presheaf.map_comp] ++ erw [← ConcreteCategory.comp_apply, ← X.presheaf.map_comp] + exact (hid _).symm + + /-- `germ_eq_stalkMap_ofRestrict` at the top open, for a section written as a +@@ -673,7 +675,7 @@ lemma resAlgMap_eq_comp {R : Type*} [NonAssocSemiring R] (α : R →+* X.preshea + RingHom.ext fun c ↦ by + change (X.presheaf.map _).hom _ = (X.presheaf.map _).hom ((X.presheaf.map _).hom (α c)) + change _ = ((X.presheaf.map _) ≫ (X.presheaf.map _)).hom _ +- rw [← X.presheaf.map_comp] ++ erw [← X.presheaf.map_comp] + congr 2 + + section GlueAlgMap +@@ -718,7 +720,7 @@ lemma resAlgMap_glueAlgMap (i : ι) : + change (X.presheaf.map _).hom _ = (X.presheaf.map _).hom ((α i) c) + rw [← map_glueAlgMap hU α h i c] + change _ = ((X.presheaf.map _) ≫ (X.presheaf.map _)).hom _ +- rw [← X.presheaf.map_comp] ++ erw [← X.presheaf.map_comp] + congr 2 + + end GlueAlgMap +@@ -932,7 +934,8 @@ lemma exists_localLift_family (hsurj : ∀ x, Function.Surjective (i.stalkMap x) + ⟨hx, Set.mem_iInter.2 hxB⟩, fun j ↦ ?_⟩ + rw [c_app_res] + have h1 := congrArg (M.res (hB'j j)) (hres j) +- simp only [res_res] at h1 ⊢ ++ simp only [res_res] at h1 ++ erw [res_res] + exact h1 + + end LocalModel +diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleOpenEmbedding.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleOpenEmbedding.lean +index c13cca0af65e6aabe5d8da5ff556d645ee89ef62..f292e79aad03fe01a387d0a21341a56c2486d5df 100644 +--- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleOpenEmbedding.lean ++++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleOpenEmbedding.lean +@@ -251,7 +251,9 @@ theorem hasLocalModuleRelationsAt {z : Z} (hK : HasLocalModuleRelationsAt K z) : + let a' : Fin m → Z.presheaf.obj (op (C.pre W₁)) := fun i ↦ C.ψ (C.pre W₁) (Y.res hW₁e.le (a i)) + have ha' : ∑ i, a' i • sectRes K (hpre.trans hW'V) (f' i) = 0 := by + have := congrArg (fun s ↦ C.φ (C.pre W₁) (sectRes M hW₁e.le s)) ha +- simp only [sectRes_sum, sectRes_smul, C.φ_sum, sectRes_zero, map_zero] at this ++ simp only [sectRes_sum, sectRes_smul, C.φ_sum, sectRes_zero] at this ++ have hzero : C.φ (C.pre W₁) 0 = 0 := (C.φ (C.pre W₁)).map_zero ++ rw [hzero] at this + rw [← this] + refine Finset.sum_congr rfl fun i _ ↦ ?_ + rw [C.φ_smul, sectRes_sectRes, C.φ_sectRes_sectRes _ (hpre.trans hW'V) hVe.le] +diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleSections.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleSections.lean +index 67de23265671ee899a5af4b661675acde8970d8d..c61b5b8108007c7c7459ebd6cca5d69171428db4 100644 +--- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleSections.lean ++++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentModuleSections.lean +@@ -169,7 +169,6 @@ theorem hasLocalModuleRelations_of_isCoherent [M.IsCoherent] : HasLocalModuleRel + refine (key Z' b).trans (Eq.trans ?_ hrel) + refine Finset.sum_congr rfl (fun i _ ↦ ?_) + simp only [b, freeEval_freeEvalSymm] +- rfl + obtain ⟨n, hn⟩ := hlift (op Z') b hb + obtain ⟨S, hS, hS'⟩ := hs a Z' (Over.homMk (homOfLE hW') (Subsingleton.elim _ _)) n + rw [GrothendieckTopology.mem_over_iff] at hS +diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentPushforwardClosedEmbedding.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentPushforwardClosedEmbedding.lean +index 50c1e96197465808bd065e51dd056b87d17a2b93..af3ce55bab52e432570e82a5447fb45f9f1dd3b0 100644 +--- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentPushforwardClosedEmbedding.lean ++++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/CoherentPushforwardClosedEmbedding.lean +@@ -355,9 +355,7 @@ lemma Hom.hasLocalModuleRelations_pushforward_of_mem (hf : IsClosedEmbedding f.b + erw [map_sub, map_sum, sub_eq_zero] + refine Eq.trans ?_ (e₂.trans (Finset.sum_congr rfl fun l _ ↦ ?_)) + · erw [Hom.c_app_res] +- rfl + · erw [map_mul, Hom.c_app_res, Hom.c_app_res, hc3, hd, res_res, res_res] +- rfl + -- Step 2: the remainder is locally a combination of the `h_j` + have hy'WI : y' ∈ WI := hWWI (hW' hy') + let b : Fin m → Y.presheaf.obj (op W4) := fun i ↦ Y.res h4 (a i) - +diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/HomSheafCoherent.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/HomSheafCoherent.lean +index fb2ad81de60335236986de07b9f65b27cde369b7..5e6457c2fa7e9c37867489314b79903a9057e60b 100644 +--- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/HomSheafCoherent.lean ++++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/HomSheafCoherent.lean +@@ -90,7 +90,10 @@ def homSheafBiprodIso (A B : SheafOfModules.{u} Y.ringSheaf) : + inr_fst := by rw [← homSheafMap_comp, biprod.inl_snd, homSheafMap_zero] + inr_snd := by rw [← homSheafMap_comp, biprod.inr_snd, homSheafMap_id] } + (by +- dsimp ++ change homSheafMap G (biprod.inl : A ⟶ A ⊞ B) ≫ ++ homSheafMap G (biprod.fst : A ⊞ B ⟶ A) + ++ homSheafMap G (biprod.inr : B ⟶ A ⊞ B) ≫ ++ homSheafMap G (biprod.snd : A ⊞ B ⟶ B) = 𝟙 (homSheaf (A ⊞ B) G) + rw [← homSheafMap_comp G biprod.fst biprod.inl, ← homSheafMap_comp G biprod.snd biprod.inr, + ← homSheafMap_add, biprod.total, homSheafMap_id])) + +diff --git a/Oka/Geometry/RingedSpace/LocallyRingedSpace/Modules.lean b/Oka/Geometry/RingedSpace/LocallyRingedSpace/Modules.lean +index 6d24d3bd90eb97ba8a0d60eec06f5517462a125f..71e83aa11c65abbe4699efcdee9586416d06d42d 100644 +--- a/Oka/Geometry/RingedSpace/LocallyRingedSpace/Modules.lean ++++ b/Oka/Geometry/RingedSpace/LocallyRingedSpace/Modules.lean +@@ -134,6 +134,16 @@ noncomputable def Hom.toRingSheafHom {X : LocallyRingedSpace.{u}} (f : X ⟶ Y) + RingCat.{u} _ _).obj X.ringSheaf where + hom := Functor.whiskerRight f.c _ + ++instance isRightAdjoint_pushforwardModules {X : LocallyRingedSpace.{u}} (f : X ⟶ Y) : ++ (SheafOfModules.pushforward.{u} f.toRingSheafHom).IsRightAdjoint := by ++ let φ : Y.ringSheaf ⟶ ((Opens.map f.base).sheafPushforwardContinuous ++ RingCat.{u} _ _).obj X.ringSheaf := f.toRingSheafHom ++ let : (PresheafOfModules.pushforward.{u} φ.hom).IsRightAdjoint := ++ CategoryTheory.Functor.isRightAdjoint_of_leftAdjointObjIsDefined_eq_top ++ (PresheafOfModules.pullbackObjIsDefined_eq_top ++ (F := Opens.map f.base) (R := X.ringSheaf.obj) φ.hom) ++ exact (SheafOfModules.PullbackConstruction.adjunction.{u} φ).isRightAdjoint ++ + variable {Y} in + /-- **Pullback of `𝒪`-modules along a morphism of locally ringed spaces.** + +diff --git a/Oka/Geometry/RingedSpace/ZeroLocus.lean b/Oka/Geometry/RingedSpace/ZeroLocus.lean +index a91f2e3a06bc79c15ebf6482a55919a21a2474aa..dcd61241e002bed47d0d244fe0687eab5b85effe 100644 +--- a/Oka/Geometry/RingedSpace/ZeroLocus.lean ++++ b/Oka/Geometry/RingedSpace/ZeroLocus.lean +@@ -278,7 +278,7 @@ theorem stalkMap_zeroLocusιHom (z : Y.zeroLocusSpace f) : + -- `TopCat.Presheaf` is a `def`, so `rw` refuses to look inside its category instance; `erw` + -- does. The final `rfl` is `stalkPullbackHom` unfolding to its definition. + erw [Functor.map_comp, Functor.map_comp, Functor.map_comp] +- rw [Category.assoc, Category.assoc, Category.assoc] ++ erw [Category.assoc, Category.assoc, Category.assoc] + erw [TopCat.Presheaf.stalkPushforward_naturality] + rfl + +@@ -325,9 +325,14 @@ modulo the ideal generated by the germs of the `f i`. -/ + def zeroLocusStalkQuotientEquiv (z : Y.zeroLocusSpace f) : + (Y.presheaf.stalk (Y.zeroLocusι f z) ⧸ + Ideal.span (Set.range fun i ↦ Y.presheaf.Γgerm (Y.zeroLocusι f z) (f i))) ≃+* +- (Y.zeroLocusPresheaf f).stalk z := +- (Ideal.quotEquivOfEq (Y.ker_stalkMap_zeroLocusιHom f z).symm).trans +- (RingHom.quotientKerEquivOfSurjective (Y.surjective_stalkMap_zeroLocusιHom f z)) ++ (Y.zeroLocusPresheaf f).stalk z := by ++ let q : Y.presheaf.stalk (Y.zeroLocusι f z) →+* (Y.zeroLocusPresheaf f).stalk z := ++ ((Y.zeroLocusιHom f).stalkMap z).hom ++ have hker : RingHom.ker q = ++ Ideal.span (Set.range fun i ↦ Y.presheaf.Γgerm (Y.zeroLocusι f z) (f i)) := ++ Y.ker_stalkMap_zeroLocusιHom f z ++ have hsurj : Function.Surjective q := Y.surjective_stalkMap_zeroLocusιHom f z ++ exact (Ideal.quotEquivOfEq hker.symm).trans (RingHom.quotientKerEquivOfSurjective hsurj) + + /-- The stalks of the structure sheaf of the zero locus are nonzero rings. -/ + instance nontrivial_zeroLocusPresheaf_stalk (z : Y.zeroLocusSpace f) : +diff --git a/Oka/LocalOkaRing.lean b/Oka/LocalOkaRing.lean +index eb90e4f2cb26c1972f2d281c91c366fa1b485ec1..e1eee2176b31a391fbb8fe5d8917cb3015eacba6 100644 +--- a/Oka/LocalOkaRing.lean ++++ b/Oka/LocalOkaRing.lean +@@ -304,7 +304,7 @@ omit [Fintype ι] in + lemma norm_evalMonomial_le (h : ∀ i, ‖x i‖ ≤ ‖y i‖) (d : ι →₀ ℕ) : + ‖evalMonomial d x‖ ≤ ‖evalMonomial d y‖ := by + simp only [evalMonomial, Finsupp.prod, norm_prod, norm_pow] +- exact Finset.prod_le_prod (fun i _ ↦ by positivity) ++ exact Finset.prod_le_prod₀ (fun i _ ↦ by positivity) + fun i _ ↦ pow_le_pow_left₀ (norm_nonneg _) (h i) _ + + omit [Fintype ι] in +@@ -418,7 +418,7 @@ lemma norm_monomialCMM_le (d : ι →₀ ℕ) (n : ℕ) : ‖monomialCMM d n‖ + rw [one_mul, ContinuousMultilinearMap.compContinuousLinearMap_apply, + ContinuousMultilinearMap.mkPiAlgebra_apply, norm_prod] + simp only [ContinuousLinearMap.proj_apply] +- exact Finset.prod_le_prod (fun _ _ ↦ norm_nonneg _) fun k _ ↦ norm_le_pi_norm _ _ ++ exact Finset.prod_le_prod₀ (fun _ _ ↦ norm_nonneg _) fun k _ ↦ norm_le_pi_norm _ _ + · simp + + variable (P) in +@@ -565,7 +565,7 @@ lemma norm_fpsCoeff_le (p : FormalMultilinearSeries ℂ (ι → ℂ) ℂ) (n : + refine Finset.sum_le_sum fun s _ ↦ ?_ + refine ((p n).le_opNorm _).trans ?_ + refine mul_le_of_le_one_right (norm_nonneg _) ?_ +- exact Finset.prod_le_one (fun _ _ ↦ norm_nonneg _) fun k _ ↦ norm_basisVec_le _ ++ exact Finset.prod_le_one₀ (fun _ _ ↦ norm_nonneg _) fun k _ ↦ norm_basisVec_le _ + + lemma sum_card_fibers (n : ℕ) : + ∑ d ∈ degFinset ι n, ((tupleFinset n d).card : ℝ) = (Fintype.card ι : ℝ) ^ n := by +@@ -578,7 +578,7 @@ lemma norm_evalMonomial_le_pow {ρ : ℝ} {y : ι → ℂ} (hy : ‖y‖ ≤ ρ) + (hd : d ∈ degFinset ι n) : ‖evalMonomial d y‖ ≤ ρ ^ n := by + have h1 : ∀ i, ‖y i‖ ≤ ρ := fun i ↦ (norm_le_pi_norm y i).trans hy + rw [norm_evalMonomial, ← mem_degFinset.mp hd, ← Finset.prod_pow_eq_pow_sum] +- exact Finset.prod_le_prod (fun i _ ↦ by positivity) ++ exact Finset.prod_le_prod₀ (fun i _ ↦ by positivity) + fun i _ ↦ pow_le_pow_left₀ (norm_nonneg _) (h1 i) _ + + /-- Absolute convergence can be checked after regrouping by total degree. -/ +@@ -802,7 +802,7 @@ theorem eq_zero_of_represents_zero [Finite ι] {R : MvPowerSeries ι ℂ} (hR : + refine MvPolynomial.funext fun y ↦ ?_ + rw [map_zero, map_sum] + simpa [MvPolynomial.eval_monomial, evalMonomial] using hall (∑ i, d i) y +- have h3 := congrArg (MvPolynomial.coeff d) hΦ ++ have h3 := congrArg (fun p : MvPolynomial ι ℂ ↦ p.coeff d) hΦ + rw [MvPolynomial.coeff_sum] at h3 + simp only [MvPolynomial.coeff_monomial, MvPolynomial.coeff_zero] at h3 + rw [Finset.sum_ite_eq' (degFinset ι (∑ i, d i)) d (fun e ↦ coeff e R)] at h3 +diff --git a/Oka/Nullstellensatz/Germ.lean b/Oka/Nullstellensatz/Germ.lean +index 9c3d3babe4e2f03cfb934f671a57c00197c8668f..a630f76a02023e4cb32970d26d51ecfb15ea43db 100644 +--- a/Oka/Nullstellensatz/Germ.lean ++++ b/Oka/Nullstellensatz/Germ.lean +@@ -62,7 +62,7 @@ theorem exists_incl_sub_mul_mem {W : (LocalOkaRing (Fin n))[X]} + (Ideal.Quotient.factorₐ (LocalOkaRing (Fin n)) hle).toLinearMap + (Ideal.Quotient.factor_surjective hle) + have hint : IsIntegral (LocalOkaRing (Fin n)) (Ideal.Quotient.mk P g) := +- Algebra.IsIntegral.isIntegral _ ++ IsIntegral.of_finite _ _ + have hne : Ideal.Quotient.mk P g ≠ 0 := by rwa [Ne, Ideal.Quotient.eq_zero_iff_mem] + have hlt := Ideal.comap_lt_comap_of_integral_mem_sdiff (R := LocalOkaRing (Fin n)) + (I := (⊥ : Ideal (LocalOkaRing (Fin (n + 1)) ⧸ P))) +diff --git a/Oka/OkaLemma.lean b/Oka/OkaLemma.lean +index e17e8fa32fdd36fb3f5750413c3146acc734e7f2..1e06a52aa9232b16a68b1d800a0f478a40601c7b 100644 +--- a/Oka/OkaLemma.lean ++++ b/Oka/OkaLemma.lean +@@ -167,10 +167,11 @@ lemma mapDomain_finInit_add_single_last (u : Fin (n + 1) →₀ ℕ) : + ext j + induction j using Fin.lastCases with + | last => +- rw [Finsupp.add_apply, Finsupp.mapDomain_notin_range _ _ (by simp), ++ rw [Finsupp.add_apply, Finsupp.mapDomain_of_notMem_range _ _ (by simp), + Finsupp.single_eq_same, zero_add] + | cast i => +- rw [Finsupp.add_apply, Finsupp.mapDomain_apply (Fin.castSucc_injective n), finInit_apply] ++ rw [Finsupp.add_apply, Finsupp.mapDomain_apply_of_injective (Fin.castSucc_injective n), ++ finInit_apply] + simp [(Fin.castSucc_lt_last i).ne] + + /-- The coefficients of `MvPowerSeries.fromPolynomial' Q` at an arbitrary exponent. -/ +diff --git a/Oka/RingTheory/IntegralClosureEtale.lean b/Oka/RingTheory/IntegralClosureEtale.lean +index 22d620ad0eed1f59e3d12d8706f3b7f5c5e7b1f0..37b331c92c9c51497a6e815ff6c4cb90cc8ccc30 100644 +--- a/Oka/RingTheory/IntegralClosureEtale.lean ++++ b/Oka/RingTheory/IntegralClosureEtale.lean +@@ -87,8 +87,7 @@ theorem exists_algebraMap_eq_of_isIntegral_tensor [Algebra.Smooth R S] + (congrArg Subtype.val ht).symm + rw [hy'] + clear ht hy' +- induction t with +- | zero => exact ⟨0, by simp⟩ ++ induction t using TensorProduct.inductionOn with + | add x y hx hy => + obtain ⟨a, ha⟩ := hx + obtain ⟨b, hb⟩ := hy +diff --git a/Oka/RingTheory/MilnorPatching.lean b/Oka/RingTheory/MilnorPatching.lean +index ef94de2518e2352d530fbfeeb8fde8803bf0a1b7..4edb36e268453696d149d78197669d80146167d5 100644 +--- a/Oka/RingTheory/MilnorPatching.lean ++++ b/Oka/RingTheory/MilnorPatching.lean +@@ -244,7 +244,6 @@ include hφ in + lemma surjective_of_isBaseChange : Function.Surjective φ := by + intro y + induction y using hφ.inductionOn with +- | zero => exact ⟨0, map_zero φ⟩ + | tmul m => exact ⟨m, rfl⟩ + | smul s n hn => + obtain ⟨m, rfl⟩ := hn +@@ -310,7 +309,6 @@ lemma mem_span_range_fst (p : P) : + exact Submodule.smul_mem _ s hx + have hq : φ p ∈ Submodule.span (S ⧸ I.map (algebraMap R S)) (Set.range ψ) := by + induction φ p using hψ.inductionOn with +- | zero => exact zero_mem _ + | tmul m => exact Submodule.subset_span ⟨m, rfl⟩ + | smul s n hn => exact Submodule.smul_mem _ s hn + | add n₁ n₂ h₁ h₂ => exact add_mem h₁ h₂ +diff --git a/Oka/RingTheory/MvPolynomial/LaurentAway.lean b/Oka/RingTheory/MvPolynomial/LaurentAway.lean +index 88222b85c4cbfe701696f5ee995643a918e53037..b2f15d3d79d4197f3dca8719c49c249ba766eed3 100644 +--- a/Oka/RingTheory/MvPolynomial/LaurentAway.lean ++++ b/Oka/RingTheory/MvPolynomial/LaurentAway.lean +@@ -86,8 +86,7 @@ lemma toLaurent_apply (p : MvPolynomial ι R) : toLaurent ι R p = mapDomain exp + + lemma coeff_toLaurent_expInt (p : MvPolynomial ι R) (e : ι →₀ ℕ) : + (toLaurent ι R p).coeff (expInt e) = p.coeff e := by +- rw [toLaurent_apply, coeff_mapDomain, Finsupp.mapDomain_apply expInt_injective] +- rfl ++ rw [toLaurent_apply, coeff_mapDomain, Finsupp.mapDomain_apply_of_injective expInt_injective] + + lemma coeff_toLaurent_eq_zero (p : MvPolynomial ι R) {a : ι →₀ ℤ} (ha : ¬ ∀ j, 0 ≤ a j) : + (toLaurent ι R p).coeff a = 0 := by +diff --git a/Oka/RingTheory/MvPolynomial/Localization.lean b/Oka/RingTheory/MvPolynomial/Localization.lean +index eadf5f3f75d156a3e2d13b0f324d502f614469d0..75ac33618a8ace657f0ec9458095bd494e4452bb 100644 +--- a/Oka/RingTheory/MvPolynomial/Localization.lean ++++ b/Oka/RingTheory/MvPolynomial/Localization.lean +@@ -185,7 +185,7 @@ theorem awayLift_awayBaseHom (a : MvPolynomial σ R ⧸ I) : + obtain ⟨p, rfl⟩ := Ideal.Quotient.mk_surjective a + have h := congrArg (fun φ : MvPolynomial σ R →ₐ[R] _ ↦ φ p) (awayAeval_comp_rename I f) + simp only [AlgHom.coe_comp, Function.comp_apply] at h +- simpa [awayLift, awayBaseHom] using h ++ exact h + + theorem awayLift_comp_awayInv : (awayLift I f).comp (awayInv I f) = AlgHom.id R _ := by + ext a +@@ -202,8 +202,14 @@ theorem awayInv_comp_awayLift : (awayInv I f).comp (awayLift I f) = AlgHom.id R + exact congrFun (congrArg DFunLike.coe h) p + apply MvPolynomial.algHom_ext + rintro (_ | i) +- · simp [awayLift, awayAeval, awayInv_invSelf] +- · simp [awayLift, awayAeval, awayInv_algebraMap, awayBaseHom] ++ · simp only [AlgHom.coe_comp, Function.comp_apply, Ideal.Quotient.mkₐ_eq_mk, ++ awayLift, Ideal.Quotient.liftₐ_apply] ++ erw [Ideal.Quotient.lift_mk] ++ simp [awayAeval, awayInv_invSelf] ++ · simp only [AlgHom.coe_comp, Function.comp_apply, Ideal.Quotient.mkₐ_eq_mk, ++ awayLift, Ideal.Quotient.liftₐ_apply] ++ erw [Ideal.Quotient.lift_mk] ++ simp [awayAeval, awayInv_algebraMap, awayBaseHom] + + /-- **The isomorphism with `Localization.Away`**, over `R`. This is the shape a consumer that + renames variables wants; `MvPolynomial.isLocalization_away_quotient_awayIdeal` is the shape a +diff --git a/Oka/RingTheory/SmoothCodimOne.lean b/Oka/RingTheory/SmoothCodimOne.lean +index b8bcdd3d26553ed2d056f92b823260a8c8f3fa0d..6983111ee22074dbd8f1abf53f03cc36488a2b2a 100644 +--- a/Oka/RingTheory/SmoothCodimOne.lean ++++ b/Oka/RingTheory/SmoothCodimOne.lean +@@ -80,7 +80,7 @@ theorem isSmoothAt_of_ringKrullDim_le_one {K A : Type*} [Field K] [CharZero K] [ + haveI : Ring.DimensionLEOne S := + ⟨fun hp hp' ↦ Ring.krullDimLE_one_iff_of_isPrime_bot.mp inferInstance _ hp hp'⟩ + haveI : IsDedekindDomain S := {} +- obtain ⟨ϖ, hϖ⟩ := ((IsDiscreteValuationRing.TFAE S hS).out 2 4).mp ‹IsDedekindDomain S› ++ obtain ⟨ϖ, hϖ⟩ := ((IsDiscreteValuationRing.TFAE S hS).out 3 5).mp ‹IsDedekindDomain S› + obtain ⟨a, s, rfl⟩ := IsLocalization.exists_mk'_eq q.primeCompl ϖ + have hm : maximalIdeal S = Ideal.span {algebraMap A S a} := by + rw [hϖ, Ideal.submodule_span_eq, IsLocalization.mk'_eq_mul_mk'_one, +diff --git a/Oka/Topology/Sheaves/Cohomology/ClosedEmbedding.lean b/Oka/Topology/Sheaves/Cohomology/ClosedEmbedding.lean +index 4ec3d7043c0523150fc12e8c8d9574317675f9ea..06ce561ad0ab99e36d9e3d1c39d49851d3f84fde 100644 +--- a/Oka/Topology/Sheaves/Cohomology/ClosedEmbedding.lean ++++ b/Oka/Topology/Sheaves/Cohomology/ClosedEmbedding.lean +@@ -118,7 +118,7 @@ theorem map_exact_pushforwardAb (hf : IsClosedEmbedding f) (S : ShortComplex (Ab + /-- Pushforward along a closed embedding preserves finite limits and finite colimits. -/ + theorem preservesFiniteLimitsAndColimits_pushforwardAb (hf : IsClosedEmbedding f) : + PreservesFiniteLimits (pushforwardAb f) ∧ PreservesFiniteColimits (pushforwardAb f) := +- ((Functor.exact_tfae (pushforwardAb f)).out 1 3).1 (map_exact_pushforwardAb hf) ++ ((Functor.exact_tfae (pushforwardAb f)).out 2 4).1 (map_exact_pushforwardAb hf) + + /-- **Pushforward along a closed embedding preserves finite colimits.** -/ + theorem preservesFiniteColimits_pushforwardAb (hf : IsClosedEmbedding f) : +diff --git a/Oka/Topology/Sheaves/Cohomology/MayerVietoris.lean b/Oka/Topology/Sheaves/Cohomology/MayerVietoris.lean +index e66d8343132ec9ac44817c1bd3f2a8a26c6b99e1..5b481b1e326399dfde46b19b5bee0e3439b2e79f 100644 +--- a/Oka/Topology/Sheaves/Cohomology/MayerVietoris.lean ++++ b/Oka/Topology/Sheaves/Cohomology/MayerVietoris.lean +@@ -88,14 +88,12 @@ theorem extComparison_bijective + simp only [AddMonoidHom.coe_comp, Function.comp_apply, extComparison_apply, + AddCommGrpCat.hom_ofHom, Ext.postcomp, AddMonoidHom.flip_apply, + Ext.bilinearComp_apply_apply, Ext.mapExactFunctor_comp, Ext.mapExactFunctor_mk₀] +- erw [AddMonoidHom.flip_apply, Ext.bilinearComp_apply_apply] + exact Ext.comp_assoc_of_third_deg_zero _ _ _ _) + (by + ext x + simp only [AddMonoidHom.coe_comp, Function.comp_apply, extComparison_apply, + AddCommGrpCat.hom_ofHom, Ext.postcomp, AddMonoidHom.flip_apply, + Ext.bilinearComp_apply_apply, Ext.mapExactFunctor_comp, Ext.mapExactFunctor_extClass] +- erw [AddMonoidHom.flip_apply, Ext.bilinearComp_apply_apply] + exact Ext.comp_assoc _ _ _ (zero_add n) rfl (by omega)) + ((ShortComplex.ab_exact_iff_function_exact _).mp + (Ext.covariant_sequence_exact₃' Z hS n (n + 1) rfl)) +@@ -125,7 +123,9 @@ noncomputable def freeYonedaHomEquiv (B : AbSheaf X) : + lemma freeYonedaHomEquiv_comp {B B' : AbSheaf X} (x : freeYoneda U ⟶ B) (g : B ⟶ B') : + freeYonedaHomEquiv U B' (x ≫ g) = g.hom.app (op U) (freeYonedaHomEquiv U B x) := by + simp only [freeYonedaHomEquiv, Equiv.trans_apply] +- erw [Adjunction.homEquiv_naturality_right, Equiv.trans_apply] ++ rw [(sheafificationAdjunction _ _).homEquiv_naturality_right x g, ++ Adjunction.homEquiv_naturality_right, yonedaEquiv_comp] ++ rfl + + + /-- Morphisms out of `ℤ_Y` are global sections. -/ +diff --git a/Oka/Topology/Sheaves/Cohomology/MayerVietorisNatural.lean b/Oka/Topology/Sheaves/Cohomology/MayerVietorisNatural.lean +index d429c3076f4d3efc98ca2c3b2e3f24ff02f4c58c..7b26d4091f364a803957a2a34fdec4bf35e8d219 100644 +--- a/Oka/Topology/Sheaves/Cohomology/MayerVietorisNatural.lean ++++ b/Oka/Topology/Sheaves/Cohomology/MayerVietorisNatural.lean +@@ -98,7 +98,7 @@ lemma freeYonedaHomEquiv_incl_comp (h : V ≤ U) {B : AbSheaf X} (s : freeYoneda + B.obj.map (homOfLE h).op (freeYonedaHomEquiv U B s) := by + simp only [freeYonedaHomEquiv, incl, Equiv.trans_apply] + erw [Adjunction.homEquiv_naturality_left] +- erw [Equiv.trans_apply, Equiv.trans_apply, Adjunction.homEquiv_naturality_left] ++ erw [Adjunction.homEquiv_naturality_left] + exact (yonedaEquiv_naturality _ _).symm + + /-- `(ℤ[U] ⟶ B) ≃ B(U)` is evaluation at the canonical section of `ℤ[U]` over `U`. -/ +diff --git a/Oka/Topology/Sheaves/Cohomology/PushforwardAcyclic.lean b/Oka/Topology/Sheaves/Cohomology/PushforwardAcyclic.lean +index 93347d22054fef6aa2b36c779c75e457204d38eb..9bf1b273f3aa47740e6d647856c113b6d027f5d8 100644 +--- a/Oka/Topology/Sheaves/Cohomology/PushforwardAcyclic.lean ++++ b/Oka/Topology/Sheaves/Cohomology/PushforwardAcyclic.lean +@@ -360,7 +360,6 @@ lemma pullbackAb_map_pullbackPushforwardBaseChangeApp_comp_pushforwardCounit (G + symm + erw [Category.assoc, Category.assoc, ← n₁, ← Functor.map_comp_assoc, ← n₂, Functor.map_comp, + ← Category.assoc, ← Category.assoc, t, Category.id_comp] +- rfl + + /-- The pullback maps along the two composites of a commutative square `f' ≫ g = g' ≫ f` agree + up to `f'⁻¹ g⁻¹ F ⟶ g'⁻¹ f⁻¹ F`. -/ +diff --git a/Oka/Topology/Sheaves/QuotientPresheaf.lean b/Oka/Topology/Sheaves/QuotientPresheaf.lean +index eaae9c85d5347893c8677fd16faf3a8be457f1e5..235fa9056abcc9db6122b96449720442dbeb4d24 100644 +--- a/Oka/Topology/Sheaves/QuotientPresheaf.lean ++++ b/Oka/Topology/Sheaves/QuotientPresheaf.lean +@@ -189,10 +189,17 @@ generated by the `f i`. -/ + theorem ker_stalkFunctor_map_toQuotientSpan : + RingHom.ker ((stalkFunctor CommRingCat.{u} y).map (F.toQuotientSpan f)).hom = + Ideal.span (Set.range fun i ↦ F.Γgerm y (f i)) := by ++ let q : F.stalk y →+* (F.quotientSpan f).stalk y := ++ ((stalkFunctor CommRingCat.{u} y).map (F.toQuotientSpan f)).hom ++ change RingHom.ker q = Ideal.span (Set.range fun i ↦ F.Γgerm y (f i)) + apply le_antisymm + · intro t ht ++ have ht : q t = 0 := RingHom.mem_ker.mp ht + obtain ⟨U, hy, s, rfl⟩ := F.exists_germ_eq t +- rw [RingHom.mem_ker, stalkFunctor_map_germ_apply U y hy _ s] at ht ++ have hq : q (F.germ U y hy s) = ++ (F.quotientSpan f).germ U y hy ((F.toQuotientSpan f).app (op U) s) := ++ stalkFunctor_map_germ_apply U y hy _ s ++ rw [hq] at ht + have ht0 : (F.quotientSpan f).germ U y hy ((F.toQuotientSpan f).app (op U) s) = + (F.quotientSpan f).germ U y hy 0 := by rw [map_zero]; exact ht + obtain ⟨W, hyW, iU, iV, hW⟩ := (F.quotientSpan f).germ_eq y hy hy _ _ ht0 +@@ -210,19 +217,25 @@ theorem ker_stalkFunctor_map_toQuotientSpan : + have h0 : ((F.toQuotientSpan f).app (op ⊤)) (f i) = 0 := + (F.toQuotientSpan_app_eq_zero_iff f (f i)).2 (by simpa using F.res_mem_spanIdeal f ⊤ i) + refine RingHom.mem_ker.2 ?_ +- change ((stalkFunctor CommRingCat.{u} y).map (F.toQuotientSpan f)).hom +- (F.Γgerm y (f i)) = 0 +- rw [show F.Γgerm y (f i) = F.germ ⊤ y True.intro (f i) from rfl, +- stalkFunctor_map_germ_apply ⊤ y True.intro _ (f i), h0, map_zero] +- rfl ++ change q (F.Γgerm y (f i)) = 0 ++ calc ++ q (F.Γgerm y (f i)) = ++ (F.quotientSpan f).germ ⊤ y True.intro ((F.toQuotientSpan f).app (op ⊤) (f i)) := ++ stalkFunctor_map_germ_apply ⊤ y True.intro _ (f i) ++ _ = 0 := by rw [h0, map_zero] + + /-- The stalk of the quotient presheaf at `y` is the quotient of the stalk of `F` at `y` by the + ideal generated by the germs at `y` of the `f i`. -/ + noncomputable def stalkQuotientSpanEquiv : + (F.stalk y ⧸ Ideal.span (Set.range fun i ↦ F.Γgerm y (f i))) ≃+* +- (F.quotientSpan f).stalk y := +- (Ideal.quotEquivOfEq (F.ker_stalkFunctor_map_toQuotientSpan f y).symm).trans +- (RingHom.quotientKerEquivOfSurjective (F.surjective_stalkFunctor_map_toQuotientSpan f y)) ++ (F.quotientSpan f).stalk y := by ++ let q : F.stalk y →+* (F.quotientSpan f).stalk y := ++ ((stalkFunctor CommRingCat.{u} y).map (F.toQuotientSpan f)).hom ++ have hker : RingHom.ker q = Ideal.span (Set.range fun i ↦ F.Γgerm y (f i)) := ++ F.ker_stalkFunctor_map_toQuotientSpan f y ++ exact (Ideal.quotEquivOfEq hker.symm).trans ++ (RingHom.quotientKerEquivOfSurjective (show Function.Surjective q from ++ F.surjective_stalkFunctor_map_toQuotientSpan f y)) + + @[simp] + lemma stalkQuotientSpanEquiv_mk (t : F.stalk y) : +diff --git a/Oka/Topology/Sheaves/Stalks.lean b/Oka/Topology/Sheaves/Stalks.lean +index a1c31610e9fc3530826868f7ee7d6c04dfaf9eca..53b30d4e0ca4a41d637049bf2ef3fe8aa120ea9b 100644 +--- a/Oka/Topology/Sheaves/Stalks.lean ++++ b/Oka/Topology/Sheaves/Stalks.lean +@@ -47,8 +47,8 @@ lemma stalkPushforward_naturality {X Y : TopCat.{v}} (g : X ⟶ Y) {F G : X.Pres + refine TopCat.Presheaf.stalk_hom_ext ((pushforward C g).obj F) fun U hU ↦ ?_ + -- `rw` cannot see through the definition of `TopCat.Presheaf` here, hence `erw`. + erw [stalkFunctor_map_germ_assoc] +- simp only [pushforward_map_app, stalkFunctor_obj, stalkPushforward_germ, +- stalkPushforward_germ_assoc] ++ simp only [pushforward_map_app, stalkFunctor_obj, stalkPushforward_germ] ++ erw [stalkPushforward_germ_assoc] + exact (stalkFunctor_map_germ (C := C) ((Opens.map g).obj U) x hU T).symm + + /-- **The specialization map between the stalks at two points which are in fact equal is an +diff --git a/Oka/Uniformization/CoveringLift.lean b/Oka/Uniformization/CoveringLift.lean +index a5ccc621c90bc562cfa5525f2f2e7e3b6616027a..ef64822db3f38d25a0c2c8a452b3ea44149f85f9 100644 +--- a/Oka/Uniformization/CoveringLift.lean ++++ b/Oka/Uniformization/CoveringLift.lean +@@ -89,12 +89,12 @@ theorem IsCoveringMapOn.eqOn_of_lift {f : E → X} {V : Set X} (hf : IsCoveringM + ⟨σ₁ a₀, hV a₀ ha₀⟩ + have hτ₁ : ContinuousOn τ₁ D := by + rw [continuousOn_iff_continuous_restrict] +- have : D.restrict τ₁ = fun a : D ↦ ⟨σ₁ a, hV a a.2⟩ := by funext a; simp [τ₁, a.2] ++ have : D.domRestrict τ₁ = fun a : D ↦ ⟨σ₁ a, hV a a.2⟩ := by funext a; simp [τ₁, a.2] + rw [this] + exact (h₁.restrict).subtype_mk _ + have hτ₂ : ContinuousOn τ₂ D := by + rw [continuousOn_iff_continuous_restrict] +- have : D.restrict τ₂ = fun a : D ↦ ⟨σ₂ a, hV₂ a a.2⟩ := by ++ have : D.domRestrict τ₂ = fun a : D ↦ ⟨σ₂ a, hV₂ a a.2⟩ := by + funext a; simp [τ₂, a.2] + rw [this] + exact (h₂.restrict).subtype_mk _ +@@ -119,8 +119,8 @@ theorem eqOn_of_sections [T2Space E] {f : E → X} {V : Set X} (hV : IsPreconnec + (hinj : ∀ v ∈ V, ∃ W ∈ 𝓝 (s₁ v), InjOn f W) {v₀ : X} (hv₀ : v₀ ∈ V) + (h₀ : s₁ v₀ = s₂ v₀) : EqOn s₁ s₂ V := by + haveI : PreconnectedSpace V := Subtype.preconnectedSpace hV +- set g₁ : V → E := V.restrict s₁ +- set g₂ : V → E := V.restrict s₂ ++ set g₁ : V → E := V.domRestrict s₁ ++ set g₂ : V → E := V.domRestrict s₂ + have hg₁ : Continuous g₁ := h₁.restrict + have hg₂ : Continuous g₂ := h₂.restrict + set A : Set V := {v | g₁ v = g₂ v} +@@ -243,6 +243,6 @@ theorem isCoveringMapOn_of_sections [T2Space E] {f : E → X} {B : Set X} + have := hsame (i := i) ht htf x hxV (hsx i) + refine mem_iUnion.mpr ⟨i, f e, he, ?_⟩ + rw [this he, hte]) +- exact .to_isEvenlyCovered_preimage (.of_trivialization (t := T) (by simpa [T] using hxV)) ++ exact .to_isEvenlyCovered_preimage (.of_trivialization (t := T) hxV) + + end Uniformization +diff --git a/Oka/Uniformization/Depth.lean b/Oka/Uniformization/Depth.lean +index 14e263fde75c44a64a19af5f2712d44c44e87368..70965c1739ea09fd21e3885d327ce5671dcb8b45 100644 +--- a/Oka/Uniformization/Depth.lean ++++ b/Oka/Uniformization/Depth.lean +@@ -214,7 +214,8 @@ theorem relIndex_ne_zero_of_mem_commensurator {G : Type*} [Group G] {Γ : Subgro + (Γ ⊓ Γ.comap (MulAut.conj δ).toMonoidHom).relIndex Γ ≠ 0 := by + have hδ' : δ⁻¹ ∈ Subgroup.Commensurable.commensurator Γ := inv_mem hδ + rw [Subgroup.Commensurable.commensurator_mem_iff] at hδ' +- have h := hδ'.1 ++ have h := hδ'.1.relIndex_ne_zero ++ change (ConjAct.toConjAct δ⁻¹ • Γ).relIndex Γ ≠ 0 at h + have heq : (ConjAct.toConjAct δ⁻¹ • Γ : Subgroup G) ⊓ Γ = + Γ ⊓ Γ.comap (MulAut.conj δ).toMonoidHom := by + ext x +diff --git a/Oka/Uniformization/FEtTransitive.lean b/Oka/Uniformization/FEtTransitive.lean +index fee3b419f88285966fd31025b20f086f5346fad7..bf78ec61adbdbf0dff71fd857bce4d2dbf891d54 100644 +--- a/Oka/Uniformization/FEtTransitive.lean ++++ b/Oka/Uniformization/FEtTransitive.lean +@@ -235,7 +235,7 @@ theorem exists_smul_eq (hhol : ∀ a, Unif.HolH (ι₀ a)) {n : ℕ} + · refine (PolyBdd.prod S (u := fun _ τ ↦ 1 + R τ) (fun _ _ ↦ (PolyBdd.const 1).add hR) + fun _ _ τ ↦ by positivity).mono fun τ ↦ ?_ + refine (norm_coeff_prod_X_sub_C_le _ _ k).trans ?_ +- exact Finset.prod_le_prod (fun _ _ ↦ by positivity) fun f hf ↦ by linarith [hfR f hf τ] ++ exact Finset.prod_le_prod₀ (fun _ _ ↦ by positivity) fun f hf ↦ by linarith [hfR f hf τ] + choose a ha using hcoeff + set Q : A[X] := X ^ m + ∑ i : Fin m, C (a i) * X ^ (i : ℕ) + have hQm : Q.Monic := monic_X_pow_add (degree_sum_fin_lt _) +diff --git a/Oka/Uniformization/Integrality.lean b/Oka/Uniformization/Integrality.lean +index fd22073e989755defe2b3e014904682fb5d0fe10..0c55e5b1349c97d3215c969e913da79ac779ccfa 100644 +--- a/Oka/Uniformization/Integrality.lean ++++ b/Oka/Uniformization/Integrality.lean +@@ -202,6 +202,7 @@ theorem le_commensurator {G : Type*} [Group G] (Γ : Subgroup G) : + Γ ≤ Subgroup.Commensurable.commensurator Γ := by + intro g hg + rw [Subgroup.Commensurable.commensurator_mem_iff] ++ change (ConjAct.toConjAct g • Γ).Commensurable Γ + have : ConjAct.toConjAct g • Γ = Γ := by + ext x + rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, ← map_inv, ConjAct.smul_def, +@@ -268,7 +269,7 @@ theorem exists_monic_wpΨ_smul {δ : SL(2, ℝ)} + have hw1 : 1 ≤ 2 + w := by linarith [norm_nonneg (wpΨ U τ)] + refine (norm_coeff_prod_X_sub_C_le _ _ k).trans ?_ + rw [← Finset.prod_pow_eq_pow_sum, ← Finset.prod_mul_distrib] +- refine Finset.prod_le_prod (fun q _ ↦ by positivity) fun q _ ↦ ?_ ++ refine Finset.prod_le_prod₀ (fun q _ ↦ by positivity) fun q _ ↦ ?_ + have h1 : 1 ≤ (2 + w) ^ Nq q := one_le_pow₀ hw1 + have h2 := hq q τ + have h3 : Cq q * (2 + w) ^ Nq q ≤ |Cq q| * (2 + w) ^ Nq q := +diff --git a/Oka/Uniformization/PmDeck.lean b/Oka/Uniformization/PmDeck.lean +index b1d47aa62e690548727ab235db59d1bd60fff16e..c1bda015ad02de12045536b9ecdb9b1bef5bf8e7 100644 +--- a/Oka/Uniformization/PmDeck.lean ++++ b/Oka/Uniformization/PmDeck.lean +@@ -166,7 +166,9 @@ theorem relIndex_deckGroup_pmDeck_ne_zero : U.deckGroup.relIndex U.pmDeck ≠ 0 + theorem commensurator_pmDeck : + Subgroup.Commensurable.commensurator U.pmDeck = + Subgroup.Commensurable.commensurator U.deckGroup := by +- refine Subgroup.Commensurable.eq ⟨?_, U.relIndex_deckGroup_pmDeck_ne_zero⟩ ++ refine Subgroup.Commensurable.eq ⟨?_, ++ Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr U.relIndex_deckGroup_pmDeck_ne_zero⟩ ++ apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr + rw [Subgroup.relIndex_eq_one.mpr (U.deckGroup_le_pmDeck)]; exact one_ne_zero + + /-- A `Γ̃`-invariant function on `ℍ` as a function on `ℂ ∖ Λ` (and `0` on `Λ`). -/ +diff --git a/Oka/Uniformization/R3.lean b/Oka/Uniformization/R3.lean +index 20629bda471772eb929b2c64251022295155b93f..421e9b56a0c7fd31f7d5c113499f34a922cd9b51 100644 +--- a/Oka/Uniformization/R3.lean ++++ b/Oka/Uniformization/R3.lean +@@ -315,7 +315,7 @@ theorem exists_cosetPoly (hΓN : U.pmDeck ≤ N) + have hw1 : 1 ≤ 2 + w := by linarith [norm_nonneg (wpΨ U τ)] + refine (norm_coeff_prod_X_sub_C_le _ _ k).trans ?_ + rw [← Finset.prod_pow_eq_pow_sum, ← Finset.prod_mul_distrib] +- refine Finset.prod_le_prod (fun q _ ↦ by positivity) fun q _ ↦ ?_ ++ refine Finset.prod_le_prod₀ (fun q _ ↦ by positivity) fun q _ ↦ ?_ + have h1 : 1 ≤ (2 + w) ^ Nq q := one_le_pow₀ hw1 + have h2 := hq q τ + have h3 : Cq q * (2 + w) ^ Nq q ≤ |Cq q| * (2 + w) ^ Nq q := +diff --git a/Oka/Uniformization/SL2Facts.lean b/Oka/Uniformization/SL2Facts.lean +index aaf4432cb8f98dd785743a87b19f3eb4415475f3..9d0eb99ffd04bfe3a520ad32f40b43a85db3f7b3 100644 +--- a/Oka/Uniformization/SL2Facts.lean ++++ b/Oka/Uniformization/SL2Facts.lean +@@ -145,6 +145,8 @@ def conjFix (η : ℝ) : SL(2, ℝ) := + theorem conjFix_lowerLeft (η : ℝ) (g : SL(2, ℝ)) : + ((conjFix η)⁻¹ * g * conjFix η) 1 0 = + g 1 0 * η ^ 2 + (g 1 1 - g 0 0) * η - g 0 1 := by ++ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul, ++ Matrix.SpecialLinearGroup.coe_inv] + simp [conjFix, Matrix.SpecialLinearGroup.coe_inv, Matrix.adjugate_fin_two, + Matrix.mul_apply, Fin.sum_univ_two, Matrix.vecMul, dotProduct] + ring +diff --git a/Oka/Uniformization/Uniqueness.lean b/Oka/Uniformization/Uniqueness.lean +index 57dd1eaca047eeaa4fa695db65f084adf79d64c0..eafbb89b7c83435aa070624a25cd2e644111846f 100644 +--- a/Oka/Uniformization/Uniqueness.lean ++++ b/Oka/Uniformization/Uniqueness.lean +@@ -179,16 +179,16 @@ theorem exists_section_of_graph (h : IsUniformization W A B π) (z : ℍ) {pr pr + refine (convex_ball a₀ ε).isPreconnected.image φ ?_ + rw [continuousOn_iff_continuous_restrict] + refine continuous_induced_rng.mpr ?_ +- have : (fun a : ball a₀ ε ↦ ((ball a₀ ε).restrict φ a).1) = fun a ↦ π (σ a.1) := by ++ have : (fun a : ball a₀ ε ↦ ((ball a₀ ε).domRestrict φ a).1) = fun a ↦ π (σ a.1) := by + funext a; exact hφ a a.2 + rw [Function.comp_def, this] + refine ContinuousOn.comp_continuous (s := {w : ℂ | 0 < w.im}) h.differentiableOn.continuousOn + ((hσc.mono hb₁).comp_continuous continuous_subtype_val fun a ↦ a.2) fun a ↦ (hb₂ a a.2).1 + · rw [continuousOn_iff_continuous_restrict] + refine isOpenEmbedding_coe.isInducing.continuous_iff.mpr ?_ +- have : (fun q : N ↦ ((N.restrict s q : ℍ) : ℂ)) = fun q : N ↦ σ (pr q.1.1) := by ++ have : (fun q : N ↦ ((N.domRestrict s q : ℍ) : ℂ)) = fun q : N ↦ σ (pr q.1.1) := by + funext q; exact hs_val q q.2 +- rw [Function.comp_def]; simp only [restrict_apply] at this ⊢ ++ rw [Function.comp_def]; simp only [domRestrict_apply] at this ⊢ + rw [this] + exact (hσc.mono hb₁).comp_continuous ((hpr.comp continuous_subtype_val).comp + continuous_subtype_val) fun q ↦ q.2.1 +diff --git a/Oka/Weierstrass.lean b/Oka/Weierstrass.lean +index 0d471db0ce70845ecde33a5dc724eb00556b9315..76d64d708f7ac1b75b2e5cbc9381946442169388 100644 +--- a/Oka/Weierstrass.lean ++++ b/Oka/Weierstrass.lean +@@ -3358,7 +3358,7 @@ theorem MvPowerSeries.exists_direction {p : ℕ} + ∑ e ∈ degFinset (Fin (n + 1)) (k i), MvPolynomial.monomial e (coeff e (P i)) with hhp + have hh : ∀ i, hpol i ≠ 0 := by + intro i hzero +- have h3 := congrArg (MvPolynomial.coeff (D i)) hzero ++ have h3 := congrArg (fun f : MvPolynomial (Fin (n + 1)) ℂ ↦ f.coeff (D i)) hzero + rw [hhp] at h3 + simp only [MvPolynomial.coeff_sum, MvPolynomial.coeff_monomial, + MvPolynomial.coeff_zero] at h3 +diff --git a/lake-manifest.json b/lake-manifest.json +index c1d5a66d8ec064b00b58871d4139a8628f14f416..497d95b2b92486861c747fc3d9e39301bc54a72a 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,31 +1,51 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/lana-agents/heights.git", ++ [{"url": "https://github.com/lana-agents/oka.git", + "type": "git", + "subDir": null, + "scope": "", +- "rev": "3539e2a12dd3470c057a4eb531dc3fd627d4c97b", ++ "rev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", ++ "name": "oka", ++ "manifestFile": "lake-manifest.json", ++ "inputRev": "75dcdc3faadd10b986afb9283e89902bcdddecd4", ++ "inherited": true, ++ "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/heights.git", ++ "type": "git", ++ "subDir": null, ++ "scope": "", ++ "rev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", + "name": "heights", + "manifestFile": "lake-manifest.json", +- "inputRev": "3539e2a12dd3470c057a4eb531dc3fd627d4c97b", ++ "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", + "inherited": false, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/mathlib4", ++ {"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, ++ {"url": "https://github.com/lana-agents/belyi.git", ++ "type": "git", ++ "subDir": null, ++ "scope": "", ++ "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "name": "belyi", ++ "manifestFile": "lake-manifest.json", ++ "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "inherited": true, ++ "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -35,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -65,7 +85,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -75,7 +95,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -85,7 +105,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -95,10 +115,10 @@ + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "oka", +diff --git a/lakefile.toml b/lakefile.toml +index d0589c058d6ab8b11ca5591af6f63caecb1850c9..d22800380c12ce35a302e598325148e01d56f365 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -8,6 +8,8 @@ lintDriver = "batteries/runLinter" + lintDriverArgs = ["Oka"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + autoImplicit = false + relaxedAutoImplicit = false +@@ -16,8 +18,8 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "Oka" +@@ -27,4 +29,4 @@ name = "Oka" + [[require]] + name = "heights" + git = "https://github.com/lana-agents/heights.git" +-rev = "3539e2a12dd3470c057a4eb531dc3fd627d4c97b" ++rev = "721496ca4c158e511d25d8ccf6bfe8503eda73c1" +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/orbicurve-cores-lean4341.patch b/lean/patches/orbicurve-cores-lean4341.patch index 1a21d9462474a261e43d234d2d098e64dce6e7d3..59f729289d198a5295e17890cb4dee307f31cebc 100644 --- a/lean/patches/orbicurve-cores-lean4341.patch +++ b/lean/patches/orbicurve-cores-lean4341.patch @@ -1,695 +1,695 @@ -diff --git a/OrbicurveCores/ArithTraces.lean b/OrbicurveCores/ArithTraces.lean -index c3a654502b15d737f9dfe7b668eda835b78264f1..6e00fbdb9aa6a8d6f1eaf5e95798a0919e5373ea 100644 ---- a/OrbicurveCores/ArithTraces.lean -+++ b/OrbicurveCores/ArithTraces.lean -@@ -57,12 +57,11 @@ lemma trace_int_of_mem_SL {M : GL (Fin 2) ℝ} (hM : M ∈ 𝒮ℒ) : - into `𝒮ℒ` by `g`. -/ - lemma exists_conj_pow_mem {g : GL (Fin 2) ℝ} (hg : g ∈ commensurator 𝒮ℒ) {u : GL (Fin 2) ℝ} - (hu : u ∈ 𝒮ℒ) : ∃ n : ℕ, 0 < n ∧ g⁻¹ * u ^ n * g ∈ 𝒮ℒ := by -- obtain ⟨n, hn, -, hmem⟩ := exists_pow_mem_of_relIndex_ne_zero hg.1 hu -+ obtain ⟨n, hn, -, hmem⟩ := exists_pow_mem_of_relIndex_ne_zero hg.1.relIndex_ne_zero hu - refine ⟨n, hn, ?_⟩ - have h := (Subgroup.mem_inf.mp hmem).1 - rw [mem_pointwise_smul_iff_inv_smul_mem] at h -- simpa only [MulEquiv.coe_toMonoidHom, ← ConjAct.toConjAct_inv, ConjAct.toConjAct_smul, -- inv_inv] using h -+ exact h - - /-- The lower unipotent generator of `SL(2, ℤ)`. -/ - def lowerL : SL(2, ℤ) := ⟨!![1, 0; 1, 1], by simp [det_fin_two]⟩ -@@ -85,6 +84,7 @@ lemma mapGL_lowerL_pow (n : ℕ) : - | zero => simp [Matrix.one_fin_two] - | succ n ih => - rw [pow_succ, map_mul, Units.val_mul, ih] -+ rw [mapGL_coe_matrix] - ext i j - fin_cases i <;> fin_cases j <;> simp [lowerL, mul_apply, Fin.sum_univ_two] - -@@ -215,7 +215,7 @@ theorem IsArithmeticSL.sq_tr_int {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithmeticS - -- `γ'` commensurates `𝒮ℒ` - have hγ'comm : γ' ∈ commensurator 𝒮ℒ := by - rw [← Commensurable.eq hcomm, Commensurable.commensurator_mem_iff, -- conjAct_pointwise_smul_eq_self (le_normalizer hγ')] -+ conj_smul_eq_self_of_mem hγ'] - -- traces - have trγ' : trace (γ' : Matrix (Fin 2) (Fin 2) ℝ) = tr γ := by - simp only [hγ'def, Units.val_mul, coe_GL_coe_matrix, tr] -@@ -229,7 +229,7 @@ theorem IsArithmeticSL.sq_tr_int {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithmeticS - have := tr_mul_tr_inv_mem_rat hγ'comm - rwa [trγ', trγ'inv, ← pow_two] at this - -- integrality -- obtain ⟨n, hn, -, hpow⟩ := exists_pow_mem_of_relIndex_ne_zero hcomm.2 hγ' -+ obtain ⟨n, hn, -, hpow⟩ := exists_pow_mem_of_relIndex_ne_zero hcomm.2.relIndex_ne_zero hγ' - obtain ⟨m, hm⟩ := trace_int_of_mem_SL hpow.1 - have hpow' : γ' ^ n = g * toGL (γ ^ n) * g⁻¹ := by - rw [hγ'def, conj_pow, map_pow] -@@ -240,7 +240,7 @@ theorem IsArithmeticSL.sq_tr_int {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithmeticS - have hint : IsIntegral ℤ (tr γ ^ 2) := (isIntegral_of_lucas_eq hn htr).pow 2 - obtain ⟨q, hq⟩ := hrat - have hq' : IsIntegral ℤ q := by -- rw [← isIntegral_algebraMap_iff (A := ℚ) (B := ℝ) (algebraMap ℚ ℝ).injective] -+ rw [← isIntegral_algebraMap_iff (A := ℚ) (B := ℝ)] - simpa [← hq] using hint - obtain ⟨k, hk⟩ := IsIntegrallyClosed.isIntegral_iff.mp hq' - refine ⟨k, ?_⟩ -diff --git a/OrbicurveCores/Core.lean b/OrbicurveCores/Core.lean -index 5805d0f2a3cfc2729ecf8b0b2f9fe8b6358590b6..d855d04e82d60840d7ffab8a100b04ead7035132 100644 ---- a/OrbicurveCores/Core.lean -+++ b/OrbicurveCores/Core.lean -@@ -65,8 +65,10 @@ lemma map_conjAct_smul (f : G →* H) (x : G) (K : Subgroup G) : - /-- Commensurators are transported along injective homomorphisms. -/ - lemma mem_commensurator_map_iff {f : G →* H} (hf : Function.Injective f) {x : G} - {K : Subgroup G} : f x ∈ commensurator (K.map f) ↔ x ∈ commensurator K := by -- simp only [Commensurable.commensurator_mem_iff, Commensurable, ← map_conjAct_smul, -- relIndex_map_map_of_injective _ _ hf] -+ rw [Commensurable.commensurator_mem_iff, Commensurable.commensurator_mem_iff] -+ change Commensurable (ConjAct.toConjAct (f x) • K.map f) (K.map f) ↔ -+ Commensurable (ConjAct.toConjAct x • K) K -+ rw [← map_conjAct_smul, Commensurable.map_injective_iff hf] - - end conj - -@@ -140,7 +142,7 @@ theorem IsArithmeticSL.not_admitsCore {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithm - hΓ'.is_commensurable.symm - -- `s = g⁻¹ r g` commensurates `Γ.map toGL` - have hsC : Commensurable (ConjAct.toConjAct s • ΓGL) ΓGL := by -- rw [Commensurable.commensurable_conj (ConjAct.toConjAct g)] -+ rw [← Commensurable.smul_iff (φ := ConjAct.toConjAct g)] - have e : ConjAct.toConjAct g • ConjAct.toConjAct s • ΓGL = ConjAct.toConjAct r • Γ' := by - simp only [Γ', ← mul_smul, ← map_mul, hs] - congr 2 -@@ -163,7 +165,9 @@ theorem IsArithmeticSL.not_admitsCore {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithm - c • (s : Matrix (Fin 2) (Fin 2) ℝ) := rfl - have hσC : σ ∈ commensurator Γ := by - rw [← mem_commensurator_map_iff (f := toGL) toGL_injective, -- Commensurable.commensurator_mem_iff, conjAct_smul_eq_of_scalar hc0 hσs] -+ Commensurable.commensurator_mem_iff] -+ change Commensurable (ConjAct.toConjAct (toGL σ) • Γ.map toGL) (Γ.map toGL) -+ rw [conjAct_smul_eq_of_scalar hc0 hσs] - exact hsC - -- no positive power of `σ` lies in `Γ` - obtain ⟨n, hn, hσn⟩ := hcore.exists_pow_mem hσC -diff --git a/OrbicurveCores/ForMathlib/ComplexEmbedding.lean b/OrbicurveCores/ForMathlib/ComplexEmbedding.lean -index d36a4269ff942b77372fe6e37dd3aff87fa7cafe..f980b285e995d7ed336db45c47898180a39fded4 100644 ---- a/OrbicurveCores/ForMathlib/ComplexEmbedding.lean -+++ b/OrbicurveCores/ForMathlib/ComplexEmbedding.lean -@@ -105,4 +105,6 @@ theorem exists_ringHom_real_complex_ne {x : ℝ} (hx : x ∉ Set.range ((↑) : - have h := RingHom.congr_fun he (Ideal.Quotient.mk I X) - simp only [RingHom.coe_comp, Function.comp_apply, f, g, Ideal.Quotient.lift_mk] at h - simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, aeval_X] at h -- simpa [h] using hne -+ change e (x : ℂ) = y at h -+ change e (x : ℂ) ≠ (x : ℂ) -+ rwa [h] -diff --git a/OrbicurveCores/Fuchsian/Commensurator.lean b/OrbicurveCores/Fuchsian/Commensurator.lean -index 8726267371001ef40e3411ee8cddc0d7e78a184b..0114ed0e8da5893971ad0156d82151f0b8381341 100644 ---- a/OrbicurveCores/Fuchsian/Commensurator.lean -+++ b/OrbicurveCores/Fuchsian/Commensurator.lean -@@ -35,8 +35,9 @@ namespace Fuchsian - - lemma le_commensurator (Γ : Subgroup SL(2, ℝ)) : Γ ≤ commensurator Γ := by - intro γ hγ -- rw [Subgroup.Commensurable.commensurator_mem_iff, -- Subgroup.conjAct_pointwise_smul_eq_self (Subgroup.le_normalizer hγ)] -+ rw [Subgroup.Commensurable.commensurator_mem_iff] -+ change Subgroup.Commensurable (ConjAct.toConjAct γ • Γ) Γ -+ rw [Subgroup.conjAct_pointwise_smul_eq_self (Subgroup.le_normalizer hγ)] - - /-- If `1` is isolated in a subgroup, the subgroup is discrete. -/ - lemma discreteTopology_of_nhdsWithin_eq_bot {H : Subgroup SL(2, ℝ)} -diff --git a/OrbicurveCores/Fuchsian/DenseSubgroup.lean b/OrbicurveCores/Fuchsian/DenseSubgroup.lean -index bd64d8c57078a8fd5d6809339d6c2624ac8ceefc..7e4d97090814d1257d8f68300fc808fcae61fc32 100644 ---- a/OrbicurveCores/Fuchsian/DenseSubgroup.lean -+++ b/OrbicurveCores/Fuchsian/DenseSubgroup.lean -@@ -242,7 +242,9 @@ def wS : SL(2, ℝ) := ⟨!![0, -1; 1, 0], by simp [det_fin_two]⟩ - - lemma wS_conj_uU (t : ℝ) : wS * uU t * wS⁻¹ = uL (-t) := by - ext i j -- simp only [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_inv, wS, coe_uU, -+ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul, -+ Matrix.SpecialLinearGroup.coe_inv] -+ simp only [wS, coe_uU, - coe_uL, adjugate_fin_two] - fin_cases i <;> fin_cases j <;> simp [Matrix.mul_apply, Fin.sum_univ_two] - -@@ -262,7 +264,9 @@ theorem uL_mem_of_tendsto {K : Subgroup SL(2, ℝ)} (hK : IsClosed (K : Set SL(2 - change wS * D * wS⁻¹ ∈ K - have : wS * D * wS⁻¹ = D⁻¹ := by - ext i j -- simp only [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_inv, wS, hD, -+ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul, -+ Matrix.SpecialLinearGroup.coe_inv, Matrix.SpecialLinearGroup.coe_inv] -+ simp only [wS, hD, - adjugate_fin_two] - fin_cases i <;> fin_cases j <;> simp [Matrix.mul_apply, Fin.sum_univ_two] - rw [this]; exact inv_mem hDK -@@ -275,7 +279,9 @@ theorem uL_mem_of_tendsto {K : Subgroup SL(2, ℝ)} (hK : IsClosed (K : Set SL(2 - simpa [Function.comp_def] using this - have h01' : ∀ n, ((wS⁻¹ * g n * wS : SL(2, ℝ)) : Matrix (Fin 2) (Fin 2) ℝ) 0 1 ≠ 0 := by - intro n -- simp only [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_inv, wS, -+ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul, -+ Matrix.SpecialLinearGroup.coe_inv] -+ simp only [wS, - adjugate_fin_two] - rw [eta_fin_two (g n : Matrix (Fin 2) (Fin 2) ℝ)] - simp only [Matrix.mul_fin_two] -diff --git a/OrbicurveCores/M2/BoundaryMeasure.lean b/OrbicurveCores/M2/BoundaryMeasure.lean -index 1e9c086241e6d946c523d37338a53a1d38d296a8..820fe96d4ad126e959e5d49ea1044d219ef6c9f0 100644 ---- a/OrbicurveCores/M2/BoundaryMeasure.lean -+++ b/OrbicurveCores/M2/BoundaryMeasure.lean -@@ -268,7 +268,8 @@ theorem tendsto_lintegral_comp_smul {F : OnePoint ℝ → ℝ} (hF : Measurable - rw [Real.norm_eq_abs]; exact hb x) - obtain ⟨φ, hφ, -⟩ := hmem.exists_boundedContinuous_eLpNorm_sub_le ENNReal.one_ne_top - (ENNReal.ofReal_pos.2 hη).ne' -- rw [eLpNorm_one_eq_lintegral_enorm] at hφ -+ rw [eLpNorm_one_eq_lintegral_enorm -+ (hF.sub φ.continuous.measurable).aestronglyMeasurable] at hφ - have hFφ : Measurable fun x ↦ ‖F x - φ x‖ₑ := (hF.sub φ.continuous.measurable).enorm - have hφφ : ∀ n, Measurable fun x ↦ ‖φ (g n • x) - φ (g₀ • x)‖ₑ := fun n ↦ - ((φ.continuous.measurable.comp (measurable_smul_bdry _)).sub -diff --git a/OrbicurveCores/M2/Final.lean b/OrbicurveCores/M2/Final.lean -index 67fd5f5954e86363fed1e27dfe19196db7074661..736750a0ecfd5825501624bbdd2d5dfffd7607fc 100644 ---- a/OrbicurveCores/M2/Final.lean -+++ b/OrbicurveCores/M2/Final.lean -@@ -119,6 +119,7 @@ end general - - lemma neg_one_mem_commensurator (Γ : Subgroup SL(2, ℝ)) : (-1 : SL(2, ℝ)) ∈ commensurator Γ := by - rw [Subgroup.Commensurable.commensurator_mem_iff] -+ change (ConjAct.toConjAct (-1 : SL(2, ℝ)) • Γ).Commensurable Γ - have : ConjAct.toConjAct (-1 : SL(2, ℝ)) • Γ = Γ := by - ext g - rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, ConjAct.smul_def] -@@ -604,8 +605,11 @@ theorem margulisDenseOneInfty : MargulisDenseOneInfty := by - have hc := commensurable_signs hA'' hB'' - rw [hcl] at hc - have hinj := Matrix.SpecialLinearGroup.toGL_injective (n := Fin 2) (R := ℝ) -- exact ⟨by simpa [Subgroup.relIndex_map_map_of_injective _ _ hinj] using hc.1, -- by simpa [Subgroup.relIndex_map_map_of_injective _ _ hinj] using hc.2⟩ -+ constructor -+ · apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr -+ simpa [Subgroup.relIndex_map_map_of_injective _ _ hinj] using hc.1.relIndex_ne_zero -+ · apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr -+ simpa [Subgroup.relIndex_map_map_of_injective _ _ hinj] using hc.2.relIndex_ne_zero - have hcommeq : commensurator H'' = commensurator H := Subgroup.Commensurable.eq hcomm'' - -- conjugation - set P : Matrix (Fin 2) (Fin 2) ℝ := g.1 -diff --git a/OrbicurveCores/M2/Furstenberg.lean b/OrbicurveCores/M2/Furstenberg.lean -index 48ebc6847143f8eb47d97b8c781f2e0d2d052f72..1e1a7ed1ece0920854283d5f28998b52803d9134 100644 ---- a/OrbicurveCores/M2/Furstenberg.lean -+++ b/OrbicurveCores/M2/Furstenberg.lean -@@ -330,7 +330,7 @@ lemma integral_theta [OpensMeasurableSpace Y] (n : ℕ) (g : SL(2, ℝ)) (f : Y - - lemma theta_mul [BorelSpace Y] (n : ℕ) (γ₀ : Γ) (g : SL(2, ℝ)) : - theta D α y₀ n ((γ₀ : SL(2, ℝ)) * g) = -- (theta D α y₀ n g).map (α γ₀).continuous.measurable.aemeasurable := by -+ (theta D α y₀ n g).map (α γ₀) := by - apply ProbabilityMeasure.toMeasure_injective - ext A hA - rw [ProbabilityMeasure.toMeasure_map, Measure.map_apply (α γ₀).continuous.measurable hA, -@@ -509,7 +509,7 @@ lemma tendsto_comb_theta_mul_iff {p : SL(2, ℝ)} (hp : IsP p) (g : SL(2, ℝ)) - - lemma comb_theta_mul (γ₀ : Γ) (g : SL(2, ℝ)) (m : ℕ) : - (W.comb m fun k ↦ theta D α y₀ k ((γ₀ : SL(2, ℝ)) * g)) = -- (W.comb m fun k ↦ theta D α y₀ k g).map (α γ₀).continuous.measurable.aemeasurable := by -+ (W.comb m fun k ↦ theta D α y₀ k g).map (α γ₀) := by - rw [W.comb_map _ _ (α γ₀).continuous.measurable] - simp_rw [theta_mul] - -@@ -517,7 +517,7 @@ lemma comb_theta_mul (γ₀ : Γ) (g : SL(2, ℝ)) (m : ℕ) : - lemma tendsto_comb_theta_mul {γ₀ : Γ} {g : SL(2, ℝ)} {ν : ProbabilityMeasure Y} - (h : Tendsto (fun m ↦ W.comb m fun k ↦ theta D α y₀ k g) atTop (𝓝 ν)) : - Tendsto (fun m ↦ W.comb m fun k ↦ theta D α y₀ k ((γ₀ : SL(2, ℝ)) * g)) atTop -- (𝓝 (ν.map (α γ₀).continuous.measurable.aemeasurable)) := by -+ (𝓝 (ν.map (α γ₀))) := by - simp_rw [comb_theta_mul] - exact ((ProbabilityMeasure.continuous_map (α γ₀).continuous).tendsto ν).comp h - -@@ -615,7 +615,7 @@ theorem GoodLattice.exists_boundaryMap {Γ : Subgroup SL(2, ℝ)} (h : GoodLatti - have h3 := tendsto_nhds_unique (W.tendsto_lim ν₀ hy) h2 - rw [hsmul] - change (ψℝ y : Measure Y) = (ψℝ x : Measure Y).map (α γ) -- have h4 : ψℝ y = (ψℝ x).map (α γ).continuous.measurable.aemeasurable := h3 -+ have h4 : ψℝ y = (ψℝ x).map (α γ) := h3 - rw [h4, ProbabilityMeasure.toMeasure_map] - - /-- `GoodLattice.exists_boundaryMap` with the boundary map packaged as a Markov kernel. -/ -diff --git a/OrbicurveCores/M2/FurstenbergLimit.lean b/OrbicurveCores/M2/FurstenbergLimit.lean -index 7de16b7217602dbfe81c4aa7d071659763c52f94..59abb2f8652f171992b39f706598cf8b220f84ef 100644 ---- a/OrbicurveCores/M2/FurstenbergLimit.lean -+++ b/OrbicurveCores/M2/FurstenbergLimit.lean -@@ -80,7 +80,7 @@ lemma integral_comb [TopologicalSpace Y] [OpensMeasurableSpace Y] (n : ℕ) - - lemma comb_map {Z : Type*} [MeasurableSpace Z] (n : ℕ) (θ : ℕ → ProbabilityMeasure Y) - {h : Y → Z} (hh : Measurable h) : -- (W.comb n θ).map hh.aemeasurable = W.comb n fun k ↦ (θ k).map hh.aemeasurable := by -+ (W.comb n θ).map h = W.comb n fun k ↦ (θ k).map h := by - apply ProbabilityMeasure.toMeasure_injective - ext s hs - simp only [ProbabilityMeasure.toMeasure_map, coe_comb, combMeasure_apply, -diff --git a/OrbicurveCores/M2/HopfCoords.lean b/OrbicurveCores/M2/HopfCoords.lean -index fd3f5c06753b4d6541de6ffea2958e1c09c0b66c..55efd387b2954792580927d58f67ef652e56a38a 100644 ---- a/OrbicurveCores/M2/HopfCoords.lean -+++ b/OrbicurveCores/M2/HopfCoords.lean -@@ -80,6 +80,7 @@ lemma hopf_mul_diagA (p : ℝ × ℝ × ℝ) (σ : ℝ) : hopf p * diagA σ = ho - - lemma diagA_mul_unip (σ t : ℝ) : diagA σ * unip t = unip (exp (2 * σ) * t) * diagA σ := by - ext i j -+ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul] - have h := exp_mul_exp_neg σ - fin_cases i <;> fin_cases j <;> - simp [diagA, unip, Matrix.mul_apply, Fin.sum_univ_two, exp_two_mul'] -diff --git a/OrbicurveCores/M2/Superrigid.lean b/OrbicurveCores/M2/Superrigid.lean -index 5afbfbbdec312eb205a6fe8f2d2ce74c4a14f800..dbc9b35a55b180f8b99c246ab18aa8c4690ca164 100644 ---- a/OrbicurveCores/M2/Superrigid.lean -+++ b/OrbicurveCores/M2/Superrigid.lean -@@ -81,7 +81,8 @@ theorem equivariant_commensurator {Γ Δ : Subgroup SL(2, ℝ)} (hΓΔ : Γ ≤ - simpa using this - have hfi : Γδ.relIndex Γ ≠ 0 := by - rw [Subgroup.inf_relIndex_right] -- exact (Subgroup.Commensurable.commensurator_mem_iff _ _).1 (inv_mem (hΔ hδ)) |>.1 -+ exact ((Subgroup.Commensurable.commensurator_mem_iff _ _).1 -+ (inv_mem (hΔ hδ))).1.relIndex_ne_zero - haveI : Countable Γδ := Set.Countable.to_subtype - ((Set.countable_coe_iff.1 ‹Countable Γ›).mono hle) - have hactδ : ActsOn Γδ a := hact.mono (hle.trans hΓΔ) -diff --git a/OrbicurveCores/M2/TraceField.lean b/OrbicurveCores/M2/TraceField.lean -index 611fcf2484e214940a56d559b25224ed665f2f60..69e24da9759dc8424a2ce2fa2a784fb3226e7911 100644 ---- a/OrbicurveCores/M2/TraceField.lean -+++ b/OrbicurveCores/M2/TraceField.lean -@@ -132,7 +132,9 @@ theorem slIn_of_mem_closure {A B : SL(2, ℝ)} (hA : SLIn F A) (hB : SLIn F B) { - /-- A power of each element of `Γ` is conjugated into `Γ` by a commensurating element. -/ - theorem exists_pow_conj_mem {Γ : Subgroup SL(2, ℝ)} {δ : SL(2, ℝ)} (hδ : δ ∈ commensurator Γ) - {P : SL(2, ℝ)} (hP : P ∈ Γ) : ∃ n, 0 < n ∧ δ⁻¹ * P ^ n * δ ∈ Γ := by -- obtain ⟨n, hn, -, hmem⟩ := Subgroup.exists_pow_mem_of_relIndex_ne_zero hδ.1 hP -+ have hδ' := hδ.1.relIndex_ne_zero -+ change (ConjAct.toConjAct δ • Γ).relIndex Γ ≠ 0 at hδ' -+ obtain ⟨n, hn, -, hmem⟩ := Subgroup.exists_pow_mem_of_relIndex_ne_zero hδ' hP - refine ⟨n, hn, ?_⟩ - have h := (Subgroup.mem_inf.mp hmem).1 - rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, ConjAct.smul_def] at h -diff --git a/OrbicurveCores/S1/OrbLift.lean b/OrbicurveCores/S1/OrbLift.lean -index 302eeaa5a9d749cb10f7958c550cbb128ba59721..c250449c73aa675033e95bbb63dd3ef5904f55f6 100644 ---- a/OrbicurveCores/S1/OrbLift.lean -+++ b/OrbicurveCores/S1/OrbLift.lean -@@ -209,7 +209,7 @@ lemma exists_section {S : Set (ℂ × ℂ × ℂ)} {V : Set ℂ} {H : ℂ → - refine ⟨fun z ↦ if hz : z ∈ V then ⟨jet H z, hS z hz⟩ else q, ?_, fun z hz ↦ by simp [hz], - Subtype.ext (by simp [hq, hqH.symm])⟩ - rw [continuousOn_iff_continuous_restrict] -- have : V.restrict (fun z ↦ if hz : z ∈ V then (⟨jet H z, hS z hz⟩ : S) else q) = -+ have : V.domRestrict (fun z ↦ if hz : z ∈ V then (⟨jet H z, hS z hz⟩ : S) else q) = - fun z : V ↦ ⟨jet H z, hS z z.2⟩ := funext fun z ↦ dif_pos z.2 - rw [this] - exact (continuousOn_jet hd hV).restrict.subtype_mk _ -diff --git a/OrbicurveCores/S1/Rigidity/Lift.lean b/OrbicurveCores/S1/Rigidity/Lift.lean -index 87f401f9f9461b1ce08f50d15476c112a9ffa84a..ba7fdcaf2e0af119b662b0c1d8412ab8fbb971eb 100644 ---- a/OrbicurveCores/S1/Rigidity/Lift.lean -+++ b/OrbicurveCores/S1/Rigidity/Lift.lean -@@ -61,7 +61,7 @@ theorem exists_isLatticeLift {τ : ℍ} {A B : SL(2, ℝ)} - else Heights.latticeCurvePointInfinity τ - have hgc : ContinuousOn g {z : ℂ | 0 < z.im} := by - rw [continuousOn_iff_continuous_restrict] -- have : {z : ℂ | 0 < z.im}.restrict g = -+ have : {z : ℂ | 0 < z.im}.domRestrict g = - fun z : {z : ℂ | 0 < z.im} ↦ Heights.latticeCurvePointOfAffine τ ⟨π z, heq' z z.2⟩ := by - funext z - exact dif_pos z.2 -diff --git a/OrbicurveCores/Sharpness.lean b/OrbicurveCores/Sharpness.lean -index 3703e52b4d0bc57eb925d06d2f279f092716ed83..59c2d5e531a8f95280a905ac4fb0f1432754e6b7 100644 ---- a/OrbicurveCores/Sharpness.lean -+++ b/OrbicurveCores/Sharpness.lean -@@ -563,8 +563,10 @@ theorem isArithmeticSL_of_certs {C : CoverCert} {D : TransCert} - IsArithmeticSL (Subgroup.closure {A, B}) := - ⟨1, ⟨by - rw [map_one, one_smul] -- exact ⟨relIndex_ne_zero_of_coverOK hn hk hA hB hC, -- relIndex_ne_zero_of_transOK hn hk hA hB hD⟩⟩⟩ -+ exact ⟨Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr -+ (relIndex_ne_zero_of_coverOK hn hk hA hB hC), -+ Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr -+ (relIndex_ne_zero_of_transOK hn hk hA hB hD)⟩⟩⟩ - - end transversal - -diff --git a/OrbicurveCores/Takeuchi.lean b/OrbicurveCores/Takeuchi.lean -index 26c95a85ade249e67e71a93989b9463c922e218b..46ae78db9677953849e05966b17341ed8b24e864 100644 ---- a/OrbicurveCores/Takeuchi.lean -+++ b/OrbicurveCores/Takeuchi.lean -@@ -287,7 +287,8 @@ power of `T = [[1, 1], [0, 1]]`), in particular one with `γ⁴ ≠ 1`. -/ - lemma IsArithmeticSL.exists_pow_four_ne_one {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithmeticSL Γ) : - ∃ γ ∈ Γ, γ ^ 4 ≠ 1 := by - obtain ⟨g, hΓ'⟩ := hΓ -- obtain ⟨n, hn, -, hmem⟩ := exists_pow_mem_of_relIndex_ne_zero hΓ'.is_commensurable.1 -+ obtain ⟨n, hn, -, hmem⟩ := exists_pow_mem_of_relIndex_ne_zero -+ hΓ'.is_commensurable.1.relIndex_ne_zero - (⟨ModularGroup.T, rfl⟩ : mapGL ℝ ModularGroup.T ∈ 𝒮ℒ) - have h := (Subgroup.mem_inf.mp hmem).1 - rw [mem_pointwise_smul_iff_inv_smul_mem] at h -diff --git a/OrbicurveCores/U2/Assembly.lean b/OrbicurveCores/U2/Assembly.lean -index aba3d4e66450e6859f89fd1acd39a4f318244598..306edf8acd3ee21ece5a7c115ea0017b7eccfa84 100644 ---- a/OrbicurveCores/U2/Assembly.lean -+++ b/OrbicurveCores/U2/Assembly.lean -@@ -303,7 +303,7 @@ theorem toHemi_etale_aux (w : Ideal (puncturedRing E)) (hw : w.IsMaximal) : - w.ramificationIdx ℂ[X] = (hemi E).mult (w.comap (algebraMap ℂ[X] (puncturedRing E))) := by - haveI := hw - have hv : (w.comap (algebraMap ℂ[X] (puncturedRing E))).IsMaximal := -- Ideal.isMaximal_comap_of_isIntegral_of_isMaximal (R := ℂ[X]) w -+ Ideal.isMaximal_under_of_isIntegral_of_isMaximal (R := ℂ[X]) w - obtain ⟨c, hc⟩ := exists_eq_ker_aeval (w.comap (algebraMap ℂ[X] (puncturedRing E))) - have hlies : w ∈ (RingHom.ker (aeval c : ℂ[X] →ₐ[ℂ] ℂ)).primesOver (puncturedRing E) := - ⟨hw.isPrime, ⟨hc.symm⟩⟩ -@@ -361,7 +361,8 @@ theorem hom_hemi_f_X (hj : ∀ c ∈ excJ, E.j ≠ (c : ℂ)) {Y Z : AffOrbicurv - have hpC : p = C (p.coeff 0) := eq_C_of_natDegree_le_zero h0 - have := H.injective (a₁ := X - C (p.coeff 0)) (a₂ := 0) (by - change aeval (R := ℂ) p (X - C (p.coeff 0)) = aeval (R := ℂ) p 0 -- rw [map_sub, aeval_X, aeval_C, map_zero, algebraMap_eq, ← hpC, sub_self]) -+ rw [map_sub, aeval_X, aeval_C, map_zero (aeval (R := ℂ) p), algebraMap_eq, ← hpC, -+ sub_self]) - exact X_sub_C_ne_zero _ this - have hcond : ∀ w : ℂ, Uniformization.RatFuncPoly.ramIdx p w * - Uniformization.RatFuncPoly.mult (E₂ E) w = -diff --git a/OrbicurveCores/U2/CoreMap.lean b/OrbicurveCores/U2/CoreMap.lean -index 29feb2b8eba4b63afbeabc96bc3841473dc1dc81..5b4ab0325344fd50eca74764c05c4b5570fb4411 100644 ---- a/OrbicurveCores/U2/CoreMap.lean -+++ b/OrbicurveCores/U2/CoreMap.lean -@@ -138,7 +138,8 @@ theorem theoremG (hj : ∀ c ∈ excJ, E.j ≠ (c : ℂ)) {Y Z : AffOrbicurve - intro w hw - letI := algRing tΩ hLM - haveI : Algebra.IsIntegral (coordRing ℂ tΩ L) B := ⟨ringMap_isIntegral tΩ hLM⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal (R := coordRing ℂ tΩ L) w -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap tΩ hLM).toRingHom (ringMap_isIntegral tΩ hLM) w - have hmaxZ : ∀ w : Ideal (coordRing ℂ tΩ L), w.IsMaximal → - (w.comap ψZ.toRingEquiv.toRingHom).IsMaximal := fun w hw ↦ - Ideal.comap_isMaximal_of_surjective _ ψZ.surjective -diff --git a/OrbicurveCores/U2/GaloisClosure.lean b/OrbicurveCores/U2/GaloisClosure.lean -index cb16f5db6a239c8df9159254e0f67e80bdeae42d..a3ef69922a9718d5c3e9980b907f6e349a223e7c 100644 ---- a/OrbicurveCores/U2/GaloisClosure.lean -+++ b/OrbicurveCores/U2/GaloisClosure.lean -@@ -213,11 +213,13 @@ theorem ramificationIdx_closure_eq_one (ht : Transcendental k t) (hFL : F ≤ L) - letI := algRing t hLN - haveI : Algebra.IsIntegral (coordRing k t L) (coordRing k t N) := - ⟨ringMap_isIntegral t hLN⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal u' -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t hLN).toRingHom (ringMap_isIntegral t hLN) u' - haveI : (u.comap (ringMap t hLN)).IsMaximal := by - letI := algRing t hLN - haveI : Algebra.IsIntegral (coordRing k t L) (coordRing k t N) := ⟨ringMap_isIntegral t hLN⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal u -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t hLN).toRingHom (ringMap_isIntegral t hLN) u - rw [hm _ inferInstance, hm _ inferInstance, hcomap, hcomap, hover] - have E1 := ramificationIdx_mul_card t ht hFL hLN u - have E1' := ramificationIdx_mul_card t ht hFL hLN u' -@@ -316,9 +318,9 @@ theorem isIntegral_smul_toN (σ : N ≃ₐ[K₀ k t] N) (b : coordRing k t (clos - have h1 := isIntegral_of_mem_coordRing t b - haveI : IsScalarTower (A₀ k t) N Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl - have h2 : IsIntegral (A₀ k t) (toN t b) := -- (isIntegral_algebraMap_iff (A := N) (B := Ω) (algebraMap N Ω).injective).mp h1 -+ (isIntegral_algebraMap_iff (A := N) (B := Ω)).mp h1 - have h3 := h2.map ((σ : N →ₐ[K₀ k t] N).restrictScalars (A₀ k t)) -- exact (isIntegral_algebraMap_iff (A := N) (B := Ω) (algebraMap N Ω).injective).mpr h3 -+ exact (isIntegral_algebraMap_iff (A := N) (B := Ω)).mpr h3 - - theorem toN_injective : Function.Injective (toN t (F := F) (L := L) (N := N)) := by - intro a b h -diff --git a/OrbicurveCores/U2/Noether.lean b/OrbicurveCores/U2/Noether.lean -index c775bc4196f4848ef28c3f7cb6c38774ea973ed1..79ee9a4f2dc7186f8427467bd6b4797daf5a3b46 100644 ---- a/OrbicurveCores/U2/Noether.lean -+++ b/OrbicurveCores/U2/Noether.lean -@@ -99,7 +99,10 @@ theorem exists_transcendental_isIntegral (hA : ¬ IsField A) : - have hP₁0 : P₁ ≠ ⊥ := by - intro h0 - apply MvPolynomial.X_ne_zero (R := k) i0 -- have : MvPolynomial.X i0 ∈ Ideal.comap (algebraMap R A) P₁ := hP₁q ▸ hX0 -+ have : MvPolynomial.X i0 ∈ Ideal.comap (algebraMap R A) P₁ := by -+ change MvPolynomial.X i0 ∈ P₁.under R -+ rw [hP₁q] -+ exact hX0 - rw [h0, Ideal.mem_comap, Ideal.mem_bot, hmap] at this - exact hinj (this.trans (map_zero g).symm) - have hmax : P₁.IsMaximal := hP₁.isMaximal hP₁0 -diff --git a/OrbicurveCores/U2/R3.lean b/OrbicurveCores/U2/R3.lean -index a3b8ce873bbd66079505f67a3663c5193d4c7929..4fc66ed0f4fe09c5735dc64b5f96565b8d01af75 100644 ---- a/OrbicurveCores/U2/R3.lean -+++ b/OrbicurveCores/U2/R3.lean -@@ -38,8 +38,11 @@ variable {G : Type*} [Group G] - lemma commensurator_smul (g : G) (H : Subgroup G) : - commensurator (ConjAct.toConjAct g • H) = ConjAct.toConjAct g • commensurator H := by - ext x -- rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, commensurator_mem_iff, commensurator_mem_iff, -- commensurable_conj (ConjAct.toConjAct g)⁻¹, inv_smul_smul] -+ rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, commensurator_mem_iff, commensurator_mem_iff] -+ change (ConjAct.toConjAct x • ConjAct.toConjAct g • H).Commensurable -+ (ConjAct.toConjAct g • H) ↔ -+ (ConjAct.toConjAct ((ConjAct.toConjAct g)⁻¹ • x) • H).Commensurable H -+ rw [← Subgroup.Commensurable.smul_iff (φ := (ConjAct.toConjAct g)⁻¹), inv_smul_smul] - have e : (ConjAct.toConjAct g)⁻¹ • x = g⁻¹ * x * g := by - rw [ConjAct.smul_def, map_inv, ConjAct.ofConjAct_toConjAct, inv_inv] - rw [e, map_mul, map_mul, map_inv, mul_smul, mul_smul] -@@ -47,8 +50,11 @@ lemma commensurator_smul (g : G) (H : Subgroup G) : - lemma relIndex_commensurator_of_le {H K : Subgroup G} (hHK : H ≤ K) (hi : H.relIndex K ≠ 0) - (h : H.relIndex (commensurator H) ≠ 0) : K.relIndex (commensurator K) ≠ 0 := by - have hc : Subgroup.Commensurable H K := by -- refine ⟨?_, ?_⟩ <;> -- first | exact hi | (rw [Subgroup.relIndex_eq_one.mpr hHK]; exact one_ne_zero) -+ constructor -+ · exact Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr hi -+ · apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr -+ rw [Subgroup.relIndex_eq_one.mpr hHK] -+ exact one_ne_zero - rw [← eq hc] - exact fun h0 ↦ h (Nat.eq_zero_of_zero_dvd (h0 ▸ Subgroup.relIndex_dvd_of_le_left _ hHK)) - -@@ -166,10 +172,13 @@ theorem r3 {A B : SL(2, ℝ)} {π : ℂ → ℂ × ℂ} (hπ : IsUniformization - intro δ hδ z - -- `g δ g⁻¹ ∈ Comm Γ = Comm Γ̃ = Γ̃` - have hcommP : commensurator (Subgroup.closure {A, B}) = commensurator P := by -- refine eq ⟨?_, ?_⟩ <;> -- first | exact relIndex_closure_pmGroup_ne_zero A B | -- (rw [Subgroup.relIndex_eq_one.mpr (IsUniformization.closure_le_pmGroup A B)]; -- exact one_ne_zero) -+ apply eq -+ constructor -+ · exact Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr -+ (relIndex_closure_pmGroup_ne_zero A B) -+ · apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr -+ rw [Subgroup.relIndex_eq_one.mpr (IsUniformization.closure_le_pmGroup A B)] -+ exact one_ne_zero - have hmem : g * δ * g⁻¹ ∈ U.pmDeck := by - rw [← hR, U.commensurator_pmDeck, hD, commensurator_smul, - Subgroup.mem_smul_pointwise_iff_exists] -diff --git a/OrbicurveCores/U2/Realize.lean b/OrbicurveCores/U2/Realize.lean -index 9f6e1525c8541a53cf902094f3627a11ae11d182..b1847524a44797940a7343e209a5d991756211a7 100644 ---- a/OrbicurveCores/U2/Realize.lean -+++ b/OrbicurveCores/U2/Realize.lean -@@ -53,7 +53,7 @@ theorem bijective_algebraMap_bot : - have h1 := isIntegral_of_mem_coordRing tΩ b - rw [← hz] at h1 - haveI : IsScalarTower (A₀ ℂ tΩ) (K₀ ℂ tΩ) Ωt := IsScalarTower.of_algebraMap_eq fun _ => rfl -- exact (isIntegral_algebraMap_iff (algebraMap (K₀ ℂ tΩ) Ωt).injective).mp h1 -+ exact isIntegral_algebraMap_iff.mp h1 - obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ ℂ tΩ) (K := K₀ ℂ tΩ)).mp hzint - refine ⟨a, Subtype.ext (Subtype.ext ?_)⟩ - rw [← hz, ← ha] -diff --git a/OrbicurveCores/U2/TheoremG.lean b/OrbicurveCores/U2/TheoremG.lean -index df55e79122374a4286211abdb9d73e8f46974e4d..6ab2f68a70e9d68b91847d911ade083f094d0d36 100644 ---- a/OrbicurveCores/U2/TheoremG.lean -+++ b/OrbicurveCores/U2/TheoremG.lean -@@ -100,7 +100,9 @@ theorem mobius_mem_commensurator [W.IsElliptic] (h : IsUniformization W G₁ G - intro τ b - rw [mul_smul, mul_smul, hg', hδ, ← hg, AlgEquiv.apply_symm_apply] - have hgS : g ∈ Subgroup.Commensurable.commensurator S := by -- rw [Subgroup.Commensurable.commensurator_mem_iff, hconj] -+ rw [Subgroup.Commensurable.commensurator_mem_iff] -+ change (ConjAct.toConjAct g • S).Commensurable S -+ rw [hconj] - -- `Γ`-invariance of `ι₀` - have hΓ : ∀ γ ∈ Γ, ∀ (a : A) (τ : ℍ), ι₀ a (γ • τ) = ι₀ a τ := by - intro γ hγ a τ -@@ -147,7 +149,9 @@ theorem mobius_mem_commensurator [W.IsElliptic] (h : IsUniformization W G₁ G - exact Subgroup.index_ne_zero_of_finite - have hΓS : Γ.relIndex S ≠ 0 := fun h0 ↦ - relIndex_closure_pmGroup_ne_zero G₁ G₂ (Subgroup.relIndex_eq_zero_of_le_right hSpm h0) -- have hcomm : Subgroup.Commensurable S Γ := ⟨hSΓ, hΓS⟩ -+ have hcomm : Subgroup.Commensurable S Γ := -+ ⟨Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr hSΓ, -+ Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr hΓS⟩ - rwa [← Subgroup.Commensurable.eq hcomm] - - end Commensurator -diff --git a/lake-manifest.json b/lake-manifest.json -index 6f40b5794c7780f797aa603a89b70a2304f2ca0e..9f8e5f69b8288de7b36c38564cb680d224db498f 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -15,37 +15,37 @@ - "type": "git", - "subDir": null, - "scope": "", -- "rev": "e0266a572e2ef7c144227c2703c450e466984528", -+ "rev": "ca7def953193f861a462aa0831eec8f0a31ff69f", - "name": "pi1", - "manifestFile": "lake-manifest.json", -- "inputRev": "e0266a572e2ef7c144227c2703c450e466984528", -+ "inputRev": "ca7def953193f861a462aa0831eec8f0a31ff69f", - "inherited": false, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/mathlib4", -+ {"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, - {"url": "https://github.com/lana-agents/heights.git", - "type": "git", - "subDir": null, - "scope": "", -- "rev": "3539e2a12dd3470c057a4eb531dc3fd627d4c97b", -+ "rev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", - "name": "heights", - "manifestFile": "lake-manifest.json", -- "inputRev": "3539e2a12dd3470c057a4eb531dc3fd627d4c97b", -+ "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", - "inherited": true, - "configFile": "lakefile.toml"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -65,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -75,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -85,7 +85,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -95,7 +95,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -105,20 +105,30 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", - "inherited": true, - "configFile": "lakefile.toml"}, -+ {"url": "https://github.com/lana-agents/belyi.git", -+ "type": "git", -+ "subDir": null, -+ "scope": "", -+ "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "name": "belyi", -+ "manifestFile": "lake-manifest.json", -+ "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", -+ "inherited": true, -+ "configFile": "lakefile.toml"}, - {"url": "https://github.com/leanprover/lean4-cli", - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "«orbicurve-cores»", -diff --git a/lakefile.toml b/lakefile.toml -index 54266d79c4524636ec1eb9099976f85816fe20af..af2e31383dbd51980ef00ad33ccb069254a4e3a7 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,6 +4,8 @@ keywords = ["math"] - defaultTargets = ["OrbicurveCores"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true -@@ -11,8 +13,8 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "OrbicurveCores" -@@ -20,10 +22,10 @@ name = "OrbicurveCores" - [[require]] - name = "pi1" - git = "https://github.com/lana-agents/pi1.git" --rev = "e0266a572e2ef7c144227c2703c450e466984528" -+rev = "ca7def953193f861a462aa0831eec8f0a31ff69f" - - # Uniformisation of once-punctured elliptic curves (U1): `Uniformization.uniformization_oncePunctured`. --# `oka` pins `lana-agents/heights` at 3539e2a; this is the only `heights` revision in this project. -+# The patched `oka` package uses `heights` at 721496ca, shared with the IUT dependency graph. - [[require]] - name = "oka" - git = "https://github.com/lana-agents/oka.git" -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/OrbicurveCores/ArithTraces.lean b/OrbicurveCores/ArithTraces.lean +index c3a654502b15d737f9dfe7b668eda835b78264f1..6e00fbdb9aa6a8d6f1eaf5e95798a0919e5373ea 100644 +--- a/OrbicurveCores/ArithTraces.lean ++++ b/OrbicurveCores/ArithTraces.lean +@@ -57,12 +57,11 @@ lemma trace_int_of_mem_SL {M : GL (Fin 2) ℝ} (hM : M ∈ 𝒮ℒ) : + into `𝒮ℒ` by `g`. -/ + lemma exists_conj_pow_mem {g : GL (Fin 2) ℝ} (hg : g ∈ commensurator 𝒮ℒ) {u : GL (Fin 2) ℝ} + (hu : u ∈ 𝒮ℒ) : ∃ n : ℕ, 0 < n ∧ g⁻¹ * u ^ n * g ∈ 𝒮ℒ := by +- obtain ⟨n, hn, -, hmem⟩ := exists_pow_mem_of_relIndex_ne_zero hg.1 hu ++ obtain ⟨n, hn, -, hmem⟩ := exists_pow_mem_of_relIndex_ne_zero hg.1.relIndex_ne_zero hu + refine ⟨n, hn, ?_⟩ + have h := (Subgroup.mem_inf.mp hmem).1 + rw [mem_pointwise_smul_iff_inv_smul_mem] at h +- simpa only [MulEquiv.coe_toMonoidHom, ← ConjAct.toConjAct_inv, ConjAct.toConjAct_smul, +- inv_inv] using h ++ exact h + + /-- The lower unipotent generator of `SL(2, ℤ)`. -/ + def lowerL : SL(2, ℤ) := ⟨!![1, 0; 1, 1], by simp [det_fin_two]⟩ +@@ -85,6 +84,7 @@ lemma mapGL_lowerL_pow (n : ℕ) : + | zero => simp [Matrix.one_fin_two] + | succ n ih => + rw [pow_succ, map_mul, Units.val_mul, ih] ++ rw [mapGL_coe_matrix] + ext i j + fin_cases i <;> fin_cases j <;> simp [lowerL, mul_apply, Fin.sum_univ_two] + +@@ -215,7 +215,7 @@ theorem IsArithmeticSL.sq_tr_int {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithmeticS + -- `γ'` commensurates `𝒮ℒ` + have hγ'comm : γ' ∈ commensurator 𝒮ℒ := by + rw [← Commensurable.eq hcomm, Commensurable.commensurator_mem_iff, +- conjAct_pointwise_smul_eq_self (le_normalizer hγ')] ++ conj_smul_eq_self_of_mem hγ'] + -- traces + have trγ' : trace (γ' : Matrix (Fin 2) (Fin 2) ℝ) = tr γ := by + simp only [hγ'def, Units.val_mul, coe_GL_coe_matrix, tr] +@@ -229,7 +229,7 @@ theorem IsArithmeticSL.sq_tr_int {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithmeticS + have := tr_mul_tr_inv_mem_rat hγ'comm + rwa [trγ', trγ'inv, ← pow_two] at this + -- integrality +- obtain ⟨n, hn, -, hpow⟩ := exists_pow_mem_of_relIndex_ne_zero hcomm.2 hγ' ++ obtain ⟨n, hn, -, hpow⟩ := exists_pow_mem_of_relIndex_ne_zero hcomm.2.relIndex_ne_zero hγ' + obtain ⟨m, hm⟩ := trace_int_of_mem_SL hpow.1 + have hpow' : γ' ^ n = g * toGL (γ ^ n) * g⁻¹ := by + rw [hγ'def, conj_pow, map_pow] +@@ -240,7 +240,7 @@ theorem IsArithmeticSL.sq_tr_int {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithmeticS + have hint : IsIntegral ℤ (tr γ ^ 2) := (isIntegral_of_lucas_eq hn htr).pow 2 + obtain ⟨q, hq⟩ := hrat + have hq' : IsIntegral ℤ q := by +- rw [← isIntegral_algebraMap_iff (A := ℚ) (B := ℝ) (algebraMap ℚ ℝ).injective] ++ rw [← isIntegral_algebraMap_iff (A := ℚ) (B := ℝ)] + simpa [← hq] using hint + obtain ⟨k, hk⟩ := IsIntegrallyClosed.isIntegral_iff.mp hq' + refine ⟨k, ?_⟩ +diff --git a/OrbicurveCores/Core.lean b/OrbicurveCores/Core.lean +index 5805d0f2a3cfc2729ecf8b0b2f9fe8b6358590b6..d855d04e82d60840d7ffab8a100b04ead7035132 100644 +--- a/OrbicurveCores/Core.lean ++++ b/OrbicurveCores/Core.lean +@@ -65,8 +65,10 @@ lemma map_conjAct_smul (f : G →* H) (x : G) (K : Subgroup G) : + /-- Commensurators are transported along injective homomorphisms. -/ + lemma mem_commensurator_map_iff {f : G →* H} (hf : Function.Injective f) {x : G} + {K : Subgroup G} : f x ∈ commensurator (K.map f) ↔ x ∈ commensurator K := by +- simp only [Commensurable.commensurator_mem_iff, Commensurable, ← map_conjAct_smul, +- relIndex_map_map_of_injective _ _ hf] ++ rw [Commensurable.commensurator_mem_iff, Commensurable.commensurator_mem_iff] ++ change Commensurable (ConjAct.toConjAct (f x) • K.map f) (K.map f) ↔ ++ Commensurable (ConjAct.toConjAct x • K) K ++ rw [← map_conjAct_smul, Commensurable.map_injective_iff hf] + + end conj + +@@ -140,7 +142,7 @@ theorem IsArithmeticSL.not_admitsCore {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithm + hΓ'.is_commensurable.symm + -- `s = g⁻¹ r g` commensurates `Γ.map toGL` + have hsC : Commensurable (ConjAct.toConjAct s • ΓGL) ΓGL := by +- rw [Commensurable.commensurable_conj (ConjAct.toConjAct g)] ++ rw [← Commensurable.smul_iff (φ := ConjAct.toConjAct g)] + have e : ConjAct.toConjAct g • ConjAct.toConjAct s • ΓGL = ConjAct.toConjAct r • Γ' := by + simp only [Γ', ← mul_smul, ← map_mul, hs] + congr 2 +@@ -163,7 +165,9 @@ theorem IsArithmeticSL.not_admitsCore {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithm + c • (s : Matrix (Fin 2) (Fin 2) ℝ) := rfl + have hσC : σ ∈ commensurator Γ := by + rw [← mem_commensurator_map_iff (f := toGL) toGL_injective, +- Commensurable.commensurator_mem_iff, conjAct_smul_eq_of_scalar hc0 hσs] ++ Commensurable.commensurator_mem_iff] ++ change Commensurable (ConjAct.toConjAct (toGL σ) • Γ.map toGL) (Γ.map toGL) ++ rw [conjAct_smul_eq_of_scalar hc0 hσs] + exact hsC + -- no positive power of `σ` lies in `Γ` + obtain ⟨n, hn, hσn⟩ := hcore.exists_pow_mem hσC +diff --git a/OrbicurveCores/ForMathlib/ComplexEmbedding.lean b/OrbicurveCores/ForMathlib/ComplexEmbedding.lean +index d36a4269ff942b77372fe6e37dd3aff87fa7cafe..f980b285e995d7ed336db45c47898180a39fded4 100644 +--- a/OrbicurveCores/ForMathlib/ComplexEmbedding.lean ++++ b/OrbicurveCores/ForMathlib/ComplexEmbedding.lean +@@ -105,4 +105,6 @@ theorem exists_ringHom_real_complex_ne {x : ℝ} (hx : x ∉ Set.range ((↑) : + have h := RingHom.congr_fun he (Ideal.Quotient.mk I X) + simp only [RingHom.coe_comp, Function.comp_apply, f, g, Ideal.Quotient.lift_mk] at h + simp only [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, aeval_X] at h +- simpa [h] using hne ++ change e (x : ℂ) = y at h ++ change e (x : ℂ) ≠ (x : ℂ) ++ rwa [h] +diff --git a/OrbicurveCores/Fuchsian/Commensurator.lean b/OrbicurveCores/Fuchsian/Commensurator.lean +index 8726267371001ef40e3411ee8cddc0d7e78a184b..0114ed0e8da5893971ad0156d82151f0b8381341 100644 +--- a/OrbicurveCores/Fuchsian/Commensurator.lean ++++ b/OrbicurveCores/Fuchsian/Commensurator.lean +@@ -35,8 +35,9 @@ namespace Fuchsian + + lemma le_commensurator (Γ : Subgroup SL(2, ℝ)) : Γ ≤ commensurator Γ := by + intro γ hγ +- rw [Subgroup.Commensurable.commensurator_mem_iff, +- Subgroup.conjAct_pointwise_smul_eq_self (Subgroup.le_normalizer hγ)] ++ rw [Subgroup.Commensurable.commensurator_mem_iff] ++ change Subgroup.Commensurable (ConjAct.toConjAct γ • Γ) Γ ++ rw [Subgroup.conjAct_pointwise_smul_eq_self (Subgroup.le_normalizer hγ)] + + /-- If `1` is isolated in a subgroup, the subgroup is discrete. -/ + lemma discreteTopology_of_nhdsWithin_eq_bot {H : Subgroup SL(2, ℝ)} +diff --git a/OrbicurveCores/Fuchsian/DenseSubgroup.lean b/OrbicurveCores/Fuchsian/DenseSubgroup.lean +index bd64d8c57078a8fd5d6809339d6c2624ac8ceefc..7e4d97090814d1257d8f68300fc808fcae61fc32 100644 +--- a/OrbicurveCores/Fuchsian/DenseSubgroup.lean ++++ b/OrbicurveCores/Fuchsian/DenseSubgroup.lean +@@ -242,7 +242,9 @@ def wS : SL(2, ℝ) := ⟨!![0, -1; 1, 0], by simp [det_fin_two]⟩ + + lemma wS_conj_uU (t : ℝ) : wS * uU t * wS⁻¹ = uL (-t) := by + ext i j +- simp only [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_inv, wS, coe_uU, ++ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul, ++ Matrix.SpecialLinearGroup.coe_inv] ++ simp only [wS, coe_uU, + coe_uL, adjugate_fin_two] + fin_cases i <;> fin_cases j <;> simp [Matrix.mul_apply, Fin.sum_univ_two] + +@@ -262,7 +264,9 @@ theorem uL_mem_of_tendsto {K : Subgroup SL(2, ℝ)} (hK : IsClosed (K : Set SL(2 + change wS * D * wS⁻¹ ∈ K + have : wS * D * wS⁻¹ = D⁻¹ := by + ext i j +- simp only [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_inv, wS, hD, ++ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul, ++ Matrix.SpecialLinearGroup.coe_inv, Matrix.SpecialLinearGroup.coe_inv] ++ simp only [wS, hD, + adjugate_fin_two] + fin_cases i <;> fin_cases j <;> simp [Matrix.mul_apply, Fin.sum_univ_two] + rw [this]; exact inv_mem hDK +@@ -275,7 +279,9 @@ theorem uL_mem_of_tendsto {K : Subgroup SL(2, ℝ)} (hK : IsClosed (K : Set SL(2 + simpa [Function.comp_def] using this + have h01' : ∀ n, ((wS⁻¹ * g n * wS : SL(2, ℝ)) : Matrix (Fin 2) (Fin 2) ℝ) 0 1 ≠ 0 := by + intro n +- simp only [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_inv, wS, ++ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul, ++ Matrix.SpecialLinearGroup.coe_inv] ++ simp only [wS, + adjugate_fin_two] + rw [eta_fin_two (g n : Matrix (Fin 2) (Fin 2) ℝ)] + simp only [Matrix.mul_fin_two] +diff --git a/OrbicurveCores/M2/BoundaryMeasure.lean b/OrbicurveCores/M2/BoundaryMeasure.lean +index 1e9c086241e6d946c523d37338a53a1d38d296a8..820fe96d4ad126e959e5d49ea1044d219ef6c9f0 100644 +--- a/OrbicurveCores/M2/BoundaryMeasure.lean ++++ b/OrbicurveCores/M2/BoundaryMeasure.lean +@@ -268,7 +268,8 @@ theorem tendsto_lintegral_comp_smul {F : OnePoint ℝ → ℝ} (hF : Measurable + rw [Real.norm_eq_abs]; exact hb x) + obtain ⟨φ, hφ, -⟩ := hmem.exists_boundedContinuous_eLpNorm_sub_le ENNReal.one_ne_top + (ENNReal.ofReal_pos.2 hη).ne' +- rw [eLpNorm_one_eq_lintegral_enorm] at hφ ++ rw [eLpNorm_one_eq_lintegral_enorm ++ (hF.sub φ.continuous.measurable).aestronglyMeasurable] at hφ + have hFφ : Measurable fun x ↦ ‖F x - φ x‖ₑ := (hF.sub φ.continuous.measurable).enorm + have hφφ : ∀ n, Measurable fun x ↦ ‖φ (g n • x) - φ (g₀ • x)‖ₑ := fun n ↦ + ((φ.continuous.measurable.comp (measurable_smul_bdry _)).sub +diff --git a/OrbicurveCores/M2/Final.lean b/OrbicurveCores/M2/Final.lean +index 67fd5f5954e86363fed1e27dfe19196db7074661..736750a0ecfd5825501624bbdd2d5dfffd7607fc 100644 +--- a/OrbicurveCores/M2/Final.lean ++++ b/OrbicurveCores/M2/Final.lean +@@ -119,6 +119,7 @@ end general + + lemma neg_one_mem_commensurator (Γ : Subgroup SL(2, ℝ)) : (-1 : SL(2, ℝ)) ∈ commensurator Γ := by + rw [Subgroup.Commensurable.commensurator_mem_iff] ++ change (ConjAct.toConjAct (-1 : SL(2, ℝ)) • Γ).Commensurable Γ + have : ConjAct.toConjAct (-1 : SL(2, ℝ)) • Γ = Γ := by + ext g + rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, ConjAct.smul_def] +@@ -604,8 +605,11 @@ theorem margulisDenseOneInfty : MargulisDenseOneInfty := by + have hc := commensurable_signs hA'' hB'' + rw [hcl] at hc + have hinj := Matrix.SpecialLinearGroup.toGL_injective (n := Fin 2) (R := ℝ) +- exact ⟨by simpa [Subgroup.relIndex_map_map_of_injective _ _ hinj] using hc.1, +- by simpa [Subgroup.relIndex_map_map_of_injective _ _ hinj] using hc.2⟩ ++ constructor ++ · apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr ++ simpa [Subgroup.relIndex_map_map_of_injective _ _ hinj] using hc.1.relIndex_ne_zero ++ · apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr ++ simpa [Subgroup.relIndex_map_map_of_injective _ _ hinj] using hc.2.relIndex_ne_zero + have hcommeq : commensurator H'' = commensurator H := Subgroup.Commensurable.eq hcomm'' + -- conjugation + set P : Matrix (Fin 2) (Fin 2) ℝ := g.1 +diff --git a/OrbicurveCores/M2/Furstenberg.lean b/OrbicurveCores/M2/Furstenberg.lean +index 48ebc6847143f8eb47d97b8c781f2e0d2d052f72..1e1a7ed1ece0920854283d5f28998b52803d9134 100644 +--- a/OrbicurveCores/M2/Furstenberg.lean ++++ b/OrbicurveCores/M2/Furstenberg.lean +@@ -330,7 +330,7 @@ lemma integral_theta [OpensMeasurableSpace Y] (n : ℕ) (g : SL(2, ℝ)) (f : Y + + lemma theta_mul [BorelSpace Y] (n : ℕ) (γ₀ : Γ) (g : SL(2, ℝ)) : + theta D α y₀ n ((γ₀ : SL(2, ℝ)) * g) = +- (theta D α y₀ n g).map (α γ₀).continuous.measurable.aemeasurable := by ++ (theta D α y₀ n g).map (α γ₀) := by + apply ProbabilityMeasure.toMeasure_injective + ext A hA + rw [ProbabilityMeasure.toMeasure_map, Measure.map_apply (α γ₀).continuous.measurable hA, +@@ -509,7 +509,7 @@ lemma tendsto_comb_theta_mul_iff {p : SL(2, ℝ)} (hp : IsP p) (g : SL(2, ℝ)) + + lemma comb_theta_mul (γ₀ : Γ) (g : SL(2, ℝ)) (m : ℕ) : + (W.comb m fun k ↦ theta D α y₀ k ((γ₀ : SL(2, ℝ)) * g)) = +- (W.comb m fun k ↦ theta D α y₀ k g).map (α γ₀).continuous.measurable.aemeasurable := by ++ (W.comb m fun k ↦ theta D α y₀ k g).map (α γ₀) := by + rw [W.comb_map _ _ (α γ₀).continuous.measurable] + simp_rw [theta_mul] + +@@ -517,7 +517,7 @@ lemma comb_theta_mul (γ₀ : Γ) (g : SL(2, ℝ)) (m : ℕ) : + lemma tendsto_comb_theta_mul {γ₀ : Γ} {g : SL(2, ℝ)} {ν : ProbabilityMeasure Y} + (h : Tendsto (fun m ↦ W.comb m fun k ↦ theta D α y₀ k g) atTop (𝓝 ν)) : + Tendsto (fun m ↦ W.comb m fun k ↦ theta D α y₀ k ((γ₀ : SL(2, ℝ)) * g)) atTop +- (𝓝 (ν.map (α γ₀).continuous.measurable.aemeasurable)) := by ++ (𝓝 (ν.map (α γ₀))) := by + simp_rw [comb_theta_mul] + exact ((ProbabilityMeasure.continuous_map (α γ₀).continuous).tendsto ν).comp h + +@@ -615,7 +615,7 @@ theorem GoodLattice.exists_boundaryMap {Γ : Subgroup SL(2, ℝ)} (h : GoodLatti + have h3 := tendsto_nhds_unique (W.tendsto_lim ν₀ hy) h2 + rw [hsmul] + change (ψℝ y : Measure Y) = (ψℝ x : Measure Y).map (α γ) +- have h4 : ψℝ y = (ψℝ x).map (α γ).continuous.measurable.aemeasurable := h3 ++ have h4 : ψℝ y = (ψℝ x).map (α γ) := h3 + rw [h4, ProbabilityMeasure.toMeasure_map] + + /-- `GoodLattice.exists_boundaryMap` with the boundary map packaged as a Markov kernel. -/ +diff --git a/OrbicurveCores/M2/FurstenbergLimit.lean b/OrbicurveCores/M2/FurstenbergLimit.lean +index 7de16b7217602dbfe81c4aa7d071659763c52f94..59abb2f8652f171992b39f706598cf8b220f84ef 100644 +--- a/OrbicurveCores/M2/FurstenbergLimit.lean ++++ b/OrbicurveCores/M2/FurstenbergLimit.lean +@@ -80,7 +80,7 @@ lemma integral_comb [TopologicalSpace Y] [OpensMeasurableSpace Y] (n : ℕ) + + lemma comb_map {Z : Type*} [MeasurableSpace Z] (n : ℕ) (θ : ℕ → ProbabilityMeasure Y) + {h : Y → Z} (hh : Measurable h) : +- (W.comb n θ).map hh.aemeasurable = W.comb n fun k ↦ (θ k).map hh.aemeasurable := by ++ (W.comb n θ).map h = W.comb n fun k ↦ (θ k).map h := by + apply ProbabilityMeasure.toMeasure_injective + ext s hs + simp only [ProbabilityMeasure.toMeasure_map, coe_comb, combMeasure_apply, +diff --git a/OrbicurveCores/M2/HopfCoords.lean b/OrbicurveCores/M2/HopfCoords.lean +index fd3f5c06753b4d6541de6ffea2958e1c09c0b66c..55efd387b2954792580927d58f67ef652e56a38a 100644 +--- a/OrbicurveCores/M2/HopfCoords.lean ++++ b/OrbicurveCores/M2/HopfCoords.lean +@@ -80,6 +80,7 @@ lemma hopf_mul_diagA (p : ℝ × ℝ × ℝ) (σ : ℝ) : hopf p * diagA σ = ho + + lemma diagA_mul_unip (σ t : ℝ) : diagA σ * unip t = unip (exp (2 * σ) * t) * diagA σ := by + ext i j ++ rw [Matrix.SpecialLinearGroup.coe_mul, Matrix.SpecialLinearGroup.coe_mul] + have h := exp_mul_exp_neg σ + fin_cases i <;> fin_cases j <;> + simp [diagA, unip, Matrix.mul_apply, Fin.sum_univ_two, exp_two_mul'] +diff --git a/OrbicurveCores/M2/Superrigid.lean b/OrbicurveCores/M2/Superrigid.lean +index 5afbfbbdec312eb205a6fe8f2d2ce74c4a14f800..dbc9b35a55b180f8b99c246ab18aa8c4690ca164 100644 +--- a/OrbicurveCores/M2/Superrigid.lean ++++ b/OrbicurveCores/M2/Superrigid.lean +@@ -81,7 +81,8 @@ theorem equivariant_commensurator {Γ Δ : Subgroup SL(2, ℝ)} (hΓΔ : Γ ≤ + simpa using this + have hfi : Γδ.relIndex Γ ≠ 0 := by + rw [Subgroup.inf_relIndex_right] +- exact (Subgroup.Commensurable.commensurator_mem_iff _ _).1 (inv_mem (hΔ hδ)) |>.1 ++ exact ((Subgroup.Commensurable.commensurator_mem_iff _ _).1 ++ (inv_mem (hΔ hδ))).1.relIndex_ne_zero + haveI : Countable Γδ := Set.Countable.to_subtype + ((Set.countable_coe_iff.1 ‹Countable Γ›).mono hle) + have hactδ : ActsOn Γδ a := hact.mono (hle.trans hΓΔ) +diff --git a/OrbicurveCores/M2/TraceField.lean b/OrbicurveCores/M2/TraceField.lean +index 611fcf2484e214940a56d559b25224ed665f2f60..69e24da9759dc8424a2ce2fa2a784fb3226e7911 100644 +--- a/OrbicurveCores/M2/TraceField.lean ++++ b/OrbicurveCores/M2/TraceField.lean +@@ -132,7 +132,9 @@ theorem slIn_of_mem_closure {A B : SL(2, ℝ)} (hA : SLIn F A) (hB : SLIn F B) { + /-- A power of each element of `Γ` is conjugated into `Γ` by a commensurating element. -/ + theorem exists_pow_conj_mem {Γ : Subgroup SL(2, ℝ)} {δ : SL(2, ℝ)} (hδ : δ ∈ commensurator Γ) + {P : SL(2, ℝ)} (hP : P ∈ Γ) : ∃ n, 0 < n ∧ δ⁻¹ * P ^ n * δ ∈ Γ := by +- obtain ⟨n, hn, -, hmem⟩ := Subgroup.exists_pow_mem_of_relIndex_ne_zero hδ.1 hP ++ have hδ' := hδ.1.relIndex_ne_zero ++ change (ConjAct.toConjAct δ • Γ).relIndex Γ ≠ 0 at hδ' ++ obtain ⟨n, hn, -, hmem⟩ := Subgroup.exists_pow_mem_of_relIndex_ne_zero hδ' hP + refine ⟨n, hn, ?_⟩ + have h := (Subgroup.mem_inf.mp hmem).1 + rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, ConjAct.smul_def] at h +diff --git a/OrbicurveCores/S1/OrbLift.lean b/OrbicurveCores/S1/OrbLift.lean +index 302eeaa5a9d749cb10f7958c550cbb128ba59721..c250449c73aa675033e95bbb63dd3ef5904f55f6 100644 +--- a/OrbicurveCores/S1/OrbLift.lean ++++ b/OrbicurveCores/S1/OrbLift.lean +@@ -209,7 +209,7 @@ lemma exists_section {S : Set (ℂ × ℂ × ℂ)} {V : Set ℂ} {H : ℂ → + refine ⟨fun z ↦ if hz : z ∈ V then ⟨jet H z, hS z hz⟩ else q, ?_, fun z hz ↦ by simp [hz], + Subtype.ext (by simp [hq, hqH.symm])⟩ + rw [continuousOn_iff_continuous_restrict] +- have : V.restrict (fun z ↦ if hz : z ∈ V then (⟨jet H z, hS z hz⟩ : S) else q) = ++ have : V.domRestrict (fun z ↦ if hz : z ∈ V then (⟨jet H z, hS z hz⟩ : S) else q) = + fun z : V ↦ ⟨jet H z, hS z z.2⟩ := funext fun z ↦ dif_pos z.2 + rw [this] + exact (continuousOn_jet hd hV).restrict.subtype_mk _ +diff --git a/OrbicurveCores/S1/Rigidity/Lift.lean b/OrbicurveCores/S1/Rigidity/Lift.lean +index 87f401f9f9461b1ce08f50d15476c112a9ffa84a..ba7fdcaf2e0af119b662b0c1d8412ab8fbb971eb 100644 +--- a/OrbicurveCores/S1/Rigidity/Lift.lean ++++ b/OrbicurveCores/S1/Rigidity/Lift.lean +@@ -61,7 +61,7 @@ theorem exists_isLatticeLift {τ : ℍ} {A B : SL(2, ℝ)} + else Heights.latticeCurvePointInfinity τ + have hgc : ContinuousOn g {z : ℂ | 0 < z.im} := by + rw [continuousOn_iff_continuous_restrict] +- have : {z : ℂ | 0 < z.im}.restrict g = ++ have : {z : ℂ | 0 < z.im}.domRestrict g = + fun z : {z : ℂ | 0 < z.im} ↦ Heights.latticeCurvePointOfAffine τ ⟨π z, heq' z z.2⟩ := by + funext z + exact dif_pos z.2 +diff --git a/OrbicurveCores/Sharpness.lean b/OrbicurveCores/Sharpness.lean +index 3703e52b4d0bc57eb925d06d2f279f092716ed83..59c2d5e531a8f95280a905ac4fb0f1432754e6b7 100644 +--- a/OrbicurveCores/Sharpness.lean ++++ b/OrbicurveCores/Sharpness.lean +@@ -563,8 +563,10 @@ theorem isArithmeticSL_of_certs {C : CoverCert} {D : TransCert} + IsArithmeticSL (Subgroup.closure {A, B}) := + ⟨1, ⟨by + rw [map_one, one_smul] +- exact ⟨relIndex_ne_zero_of_coverOK hn hk hA hB hC, +- relIndex_ne_zero_of_transOK hn hk hA hB hD⟩⟩⟩ ++ exact ⟨Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr ++ (relIndex_ne_zero_of_coverOK hn hk hA hB hC), ++ Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr ++ (relIndex_ne_zero_of_transOK hn hk hA hB hD)⟩⟩⟩ + + end transversal + +diff --git a/OrbicurveCores/Takeuchi.lean b/OrbicurveCores/Takeuchi.lean +index 26c95a85ade249e67e71a93989b9463c922e218b..46ae78db9677953849e05966b17341ed8b24e864 100644 +--- a/OrbicurveCores/Takeuchi.lean ++++ b/OrbicurveCores/Takeuchi.lean +@@ -287,7 +287,8 @@ power of `T = [[1, 1], [0, 1]]`), in particular one with `γ⁴ ≠ 1`. -/ + lemma IsArithmeticSL.exists_pow_four_ne_one {Γ : Subgroup SL(2, ℝ)} (hΓ : IsArithmeticSL Γ) : + ∃ γ ∈ Γ, γ ^ 4 ≠ 1 := by + obtain ⟨g, hΓ'⟩ := hΓ +- obtain ⟨n, hn, -, hmem⟩ := exists_pow_mem_of_relIndex_ne_zero hΓ'.is_commensurable.1 ++ obtain ⟨n, hn, -, hmem⟩ := exists_pow_mem_of_relIndex_ne_zero ++ hΓ'.is_commensurable.1.relIndex_ne_zero + (⟨ModularGroup.T, rfl⟩ : mapGL ℝ ModularGroup.T ∈ 𝒮ℒ) + have h := (Subgroup.mem_inf.mp hmem).1 + rw [mem_pointwise_smul_iff_inv_smul_mem] at h +diff --git a/OrbicurveCores/U2/Assembly.lean b/OrbicurveCores/U2/Assembly.lean +index aba3d4e66450e6859f89fd1acd39a4f318244598..306edf8acd3ee21ece5a7c115ea0017b7eccfa84 100644 +--- a/OrbicurveCores/U2/Assembly.lean ++++ b/OrbicurveCores/U2/Assembly.lean +@@ -303,7 +303,7 @@ theorem toHemi_etale_aux (w : Ideal (puncturedRing E)) (hw : w.IsMaximal) : + w.ramificationIdx ℂ[X] = (hemi E).mult (w.comap (algebraMap ℂ[X] (puncturedRing E))) := by + haveI := hw + have hv : (w.comap (algebraMap ℂ[X] (puncturedRing E))).IsMaximal := +- Ideal.isMaximal_comap_of_isIntegral_of_isMaximal (R := ℂ[X]) w ++ Ideal.isMaximal_under_of_isIntegral_of_isMaximal (R := ℂ[X]) w + obtain ⟨c, hc⟩ := exists_eq_ker_aeval (w.comap (algebraMap ℂ[X] (puncturedRing E))) + have hlies : w ∈ (RingHom.ker (aeval c : ℂ[X] →ₐ[ℂ] ℂ)).primesOver (puncturedRing E) := + ⟨hw.isPrime, ⟨hc.symm⟩⟩ +@@ -361,7 +361,8 @@ theorem hom_hemi_f_X (hj : ∀ c ∈ excJ, E.j ≠ (c : ℂ)) {Y Z : AffOrbicurv + have hpC : p = C (p.coeff 0) := eq_C_of_natDegree_le_zero h0 + have := H.injective (a₁ := X - C (p.coeff 0)) (a₂ := 0) (by + change aeval (R := ℂ) p (X - C (p.coeff 0)) = aeval (R := ℂ) p 0 +- rw [map_sub, aeval_X, aeval_C, map_zero, algebraMap_eq, ← hpC, sub_self]) ++ rw [map_sub, aeval_X, aeval_C, map_zero (aeval (R := ℂ) p), algebraMap_eq, ← hpC, ++ sub_self]) + exact X_sub_C_ne_zero _ this + have hcond : ∀ w : ℂ, Uniformization.RatFuncPoly.ramIdx p w * + Uniformization.RatFuncPoly.mult (E₂ E) w = +diff --git a/OrbicurveCores/U2/CoreMap.lean b/OrbicurveCores/U2/CoreMap.lean +index 29feb2b8eba4b63afbeabc96bc3841473dc1dc81..5b4ab0325344fd50eca74764c05c4b5570fb4411 100644 +--- a/OrbicurveCores/U2/CoreMap.lean ++++ b/OrbicurveCores/U2/CoreMap.lean +@@ -138,7 +138,8 @@ theorem theoremG (hj : ∀ c ∈ excJ, E.j ≠ (c : ℂ)) {Y Z : AffOrbicurve + intro w hw + letI := algRing tΩ hLM + haveI : Algebra.IsIntegral (coordRing ℂ tΩ L) B := ⟨ringMap_isIntegral tΩ hLM⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal (R := coordRing ℂ tΩ L) w ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap tΩ hLM).toRingHom (ringMap_isIntegral tΩ hLM) w + have hmaxZ : ∀ w : Ideal (coordRing ℂ tΩ L), w.IsMaximal → + (w.comap ψZ.toRingEquiv.toRingHom).IsMaximal := fun w hw ↦ + Ideal.comap_isMaximal_of_surjective _ ψZ.surjective +diff --git a/OrbicurveCores/U2/GaloisClosure.lean b/OrbicurveCores/U2/GaloisClosure.lean +index cb16f5db6a239c8df9159254e0f67e80bdeae42d..a3ef69922a9718d5c3e9980b907f6e349a223e7c 100644 +--- a/OrbicurveCores/U2/GaloisClosure.lean ++++ b/OrbicurveCores/U2/GaloisClosure.lean +@@ -213,11 +213,13 @@ theorem ramificationIdx_closure_eq_one (ht : Transcendental k t) (hFL : F ≤ L) + letI := algRing t hLN + haveI : Algebra.IsIntegral (coordRing k t L) (coordRing k t N) := + ⟨ringMap_isIntegral t hLN⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal u' ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t hLN).toRingHom (ringMap_isIntegral t hLN) u' + haveI : (u.comap (ringMap t hLN)).IsMaximal := by + letI := algRing t hLN + haveI : Algebra.IsIntegral (coordRing k t L) (coordRing k t N) := ⟨ringMap_isIntegral t hLN⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal u ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t hLN).toRingHom (ringMap_isIntegral t hLN) u + rw [hm _ inferInstance, hm _ inferInstance, hcomap, hcomap, hover] + have E1 := ramificationIdx_mul_card t ht hFL hLN u + have E1' := ramificationIdx_mul_card t ht hFL hLN u' +@@ -316,9 +318,9 @@ theorem isIntegral_smul_toN (σ : N ≃ₐ[K₀ k t] N) (b : coordRing k t (clos + have h1 := isIntegral_of_mem_coordRing t b + haveI : IsScalarTower (A₀ k t) N Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl + have h2 : IsIntegral (A₀ k t) (toN t b) := +- (isIntegral_algebraMap_iff (A := N) (B := Ω) (algebraMap N Ω).injective).mp h1 ++ (isIntegral_algebraMap_iff (A := N) (B := Ω)).mp h1 + have h3 := h2.map ((σ : N →ₐ[K₀ k t] N).restrictScalars (A₀ k t)) +- exact (isIntegral_algebraMap_iff (A := N) (B := Ω) (algebraMap N Ω).injective).mpr h3 ++ exact (isIntegral_algebraMap_iff (A := N) (B := Ω)).mpr h3 + + theorem toN_injective : Function.Injective (toN t (F := F) (L := L) (N := N)) := by + intro a b h +diff --git a/OrbicurveCores/U2/Noether.lean b/OrbicurveCores/U2/Noether.lean +index c775bc4196f4848ef28c3f7cb6c38774ea973ed1..79ee9a4f2dc7186f8427467bd6b4797daf5a3b46 100644 +--- a/OrbicurveCores/U2/Noether.lean ++++ b/OrbicurveCores/U2/Noether.lean +@@ -99,7 +99,10 @@ theorem exists_transcendental_isIntegral (hA : ¬ IsField A) : + have hP₁0 : P₁ ≠ ⊥ := by + intro h0 + apply MvPolynomial.X_ne_zero (R := k) i0 +- have : MvPolynomial.X i0 ∈ Ideal.comap (algebraMap R A) P₁ := hP₁q ▸ hX0 ++ have : MvPolynomial.X i0 ∈ Ideal.comap (algebraMap R A) P₁ := by ++ change MvPolynomial.X i0 ∈ P₁.under R ++ rw [hP₁q] ++ exact hX0 + rw [h0, Ideal.mem_comap, Ideal.mem_bot, hmap] at this + exact hinj (this.trans (map_zero g).symm) + have hmax : P₁.IsMaximal := hP₁.isMaximal hP₁0 +diff --git a/OrbicurveCores/U2/R3.lean b/OrbicurveCores/U2/R3.lean +index a3b8ce873bbd66079505f67a3663c5193d4c7929..4fc66ed0f4fe09c5735dc64b5f96565b8d01af75 100644 +--- a/OrbicurveCores/U2/R3.lean ++++ b/OrbicurveCores/U2/R3.lean +@@ -38,8 +38,11 @@ variable {G : Type*} [Group G] + lemma commensurator_smul (g : G) (H : Subgroup G) : + commensurator (ConjAct.toConjAct g • H) = ConjAct.toConjAct g • commensurator H := by + ext x +- rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, commensurator_mem_iff, commensurator_mem_iff, +- commensurable_conj (ConjAct.toConjAct g)⁻¹, inv_smul_smul] ++ rw [Subgroup.mem_pointwise_smul_iff_inv_smul_mem, commensurator_mem_iff, commensurator_mem_iff] ++ change (ConjAct.toConjAct x • ConjAct.toConjAct g • H).Commensurable ++ (ConjAct.toConjAct g • H) ↔ ++ (ConjAct.toConjAct ((ConjAct.toConjAct g)⁻¹ • x) • H).Commensurable H ++ rw [← Subgroup.Commensurable.smul_iff (φ := (ConjAct.toConjAct g)⁻¹), inv_smul_smul] + have e : (ConjAct.toConjAct g)⁻¹ • x = g⁻¹ * x * g := by + rw [ConjAct.smul_def, map_inv, ConjAct.ofConjAct_toConjAct, inv_inv] + rw [e, map_mul, map_mul, map_inv, mul_smul, mul_smul] +@@ -47,8 +50,11 @@ lemma commensurator_smul (g : G) (H : Subgroup G) : + lemma relIndex_commensurator_of_le {H K : Subgroup G} (hHK : H ≤ K) (hi : H.relIndex K ≠ 0) + (h : H.relIndex (commensurator H) ≠ 0) : K.relIndex (commensurator K) ≠ 0 := by + have hc : Subgroup.Commensurable H K := by +- refine ⟨?_, ?_⟩ <;> +- first | exact hi | (rw [Subgroup.relIndex_eq_one.mpr hHK]; exact one_ne_zero) ++ constructor ++ · exact Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr hi ++ · apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr ++ rw [Subgroup.relIndex_eq_one.mpr hHK] ++ exact one_ne_zero + rw [← eq hc] + exact fun h0 ↦ h (Nat.eq_zero_of_zero_dvd (h0 ▸ Subgroup.relIndex_dvd_of_le_left _ hHK)) + +@@ -166,10 +172,13 @@ theorem r3 {A B : SL(2, ℝ)} {π : ℂ → ℂ × ℂ} (hπ : IsUniformization + intro δ hδ z + -- `g δ g⁻¹ ∈ Comm Γ = Comm Γ̃ = Γ̃` + have hcommP : commensurator (Subgroup.closure {A, B}) = commensurator P := by +- refine eq ⟨?_, ?_⟩ <;> +- first | exact relIndex_closure_pmGroup_ne_zero A B | +- (rw [Subgroup.relIndex_eq_one.mpr (IsUniformization.closure_le_pmGroup A B)]; +- exact one_ne_zero) ++ apply eq ++ constructor ++ · exact Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr ++ (relIndex_closure_pmGroup_ne_zero A B) ++ · apply Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr ++ rw [Subgroup.relIndex_eq_one.mpr (IsUniformization.closure_le_pmGroup A B)] ++ exact one_ne_zero + have hmem : g * δ * g⁻¹ ∈ U.pmDeck := by + rw [← hR, U.commensurator_pmDeck, hD, commensurator_smul, + Subgroup.mem_smul_pointwise_iff_exists] +diff --git a/OrbicurveCores/U2/Realize.lean b/OrbicurveCores/U2/Realize.lean +index 9f6e1525c8541a53cf902094f3627a11ae11d182..b1847524a44797940a7343e209a5d991756211a7 100644 +--- a/OrbicurveCores/U2/Realize.lean ++++ b/OrbicurveCores/U2/Realize.lean +@@ -53,7 +53,7 @@ theorem bijective_algebraMap_bot : + have h1 := isIntegral_of_mem_coordRing tΩ b + rw [← hz] at h1 + haveI : IsScalarTower (A₀ ℂ tΩ) (K₀ ℂ tΩ) Ωt := IsScalarTower.of_algebraMap_eq fun _ => rfl +- exact (isIntegral_algebraMap_iff (algebraMap (K₀ ℂ tΩ) Ωt).injective).mp h1 ++ exact isIntegral_algebraMap_iff.mp h1 + obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ ℂ tΩ) (K := K₀ ℂ tΩ)).mp hzint + refine ⟨a, Subtype.ext (Subtype.ext ?_)⟩ + rw [← hz, ← ha] +diff --git a/OrbicurveCores/U2/TheoremG.lean b/OrbicurveCores/U2/TheoremG.lean +index df55e79122374a4286211abdb9d73e8f46974e4d..6ab2f68a70e9d68b91847d911ade083f094d0d36 100644 +--- a/OrbicurveCores/U2/TheoremG.lean ++++ b/OrbicurveCores/U2/TheoremG.lean +@@ -100,7 +100,9 @@ theorem mobius_mem_commensurator [W.IsElliptic] (h : IsUniformization W G₁ G + intro τ b + rw [mul_smul, mul_smul, hg', hδ, ← hg, AlgEquiv.apply_symm_apply] + have hgS : g ∈ Subgroup.Commensurable.commensurator S := by +- rw [Subgroup.Commensurable.commensurator_mem_iff, hconj] ++ rw [Subgroup.Commensurable.commensurator_mem_iff] ++ change (ConjAct.toConjAct g • S).Commensurable S ++ rw [hconj] + -- `Γ`-invariance of `ι₀` + have hΓ : ∀ γ ∈ Γ, ∀ (a : A) (τ : ℍ), ι₀ a (γ • τ) = ι₀ a τ := by + intro γ hγ a τ +@@ -147,7 +149,9 @@ theorem mobius_mem_commensurator [W.IsElliptic] (h : IsUniformization W G₁ G + exact Subgroup.index_ne_zero_of_finite + have hΓS : Γ.relIndex S ≠ 0 := fun h0 ↦ + relIndex_closure_pmGroup_ne_zero G₁ G₂ (Subgroup.relIndex_eq_zero_of_le_right hSpm h0) +- have hcomm : Subgroup.Commensurable S Γ := ⟨hSΓ, hΓS⟩ ++ have hcomm : Subgroup.Commensurable S Γ := ++ ⟨Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr hSΓ, ++ Subgroup.isFiniteRelIndex_iff_relIndex_ne_zero.mpr hΓS⟩ + rwa [← Subgroup.Commensurable.eq hcomm] + + end Commensurator +diff --git a/lake-manifest.json b/lake-manifest.json +index 6f40b5794c7780f797aa603a89b70a2304f2ca0e..9f8e5f69b8288de7b36c38564cb680d224db498f 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -15,37 +15,37 @@ + "type": "git", + "subDir": null, + "scope": "", +- "rev": "e0266a572e2ef7c144227c2703c450e466984528", ++ "rev": "ca7def953193f861a462aa0831eec8f0a31ff69f", + "name": "pi1", + "manifestFile": "lake-manifest.json", +- "inputRev": "e0266a572e2ef7c144227c2703c450e466984528", ++ "inputRev": "ca7def953193f861a462aa0831eec8f0a31ff69f", + "inherited": false, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/mathlib4", ++ {"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/lana-agents/heights.git", + "type": "git", + "subDir": null, + "scope": "", +- "rev": "3539e2a12dd3470c057a4eb531dc3fd627d4c97b", ++ "rev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", + "name": "heights", + "manifestFile": "lake-manifest.json", +- "inputRev": "3539e2a12dd3470c057a4eb531dc3fd627d4c97b", ++ "inputRev": "721496ca4c158e511d25d8ccf6bfe8503eda73c1", + "inherited": true, + "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -65,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -75,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -85,7 +85,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -95,7 +95,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -105,20 +105,30 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml"}, ++ {"url": "https://github.com/lana-agents/belyi.git", ++ "type": "git", ++ "subDir": null, ++ "scope": "", ++ "rev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "name": "belyi", ++ "manifestFile": "lake-manifest.json", ++ "inputRev": "9ce4d3f793d3bc831f2fc7214b7dbad90ea012d8", ++ "inherited": true, ++ "configFile": "lakefile.toml"}, + {"url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "«orbicurve-cores»", +diff --git a/lakefile.toml b/lakefile.toml +index 54266d79c4524636ec1eb9099976f85816fe20af..af2e31383dbd51980ef00ad33ccb069254a4e3a7 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,6 +4,8 @@ keywords = ["math"] + defaultTargets = ["OrbicurveCores"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true +@@ -11,8 +13,8 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "OrbicurveCores" +@@ -20,10 +22,10 @@ name = "OrbicurveCores" + [[require]] + name = "pi1" + git = "https://github.com/lana-agents/pi1.git" +-rev = "e0266a572e2ef7c144227c2703c450e466984528" ++rev = "ca7def953193f861a462aa0831eec8f0a31ff69f" + + # Uniformisation of once-punctured elliptic curves (U1): `Uniformization.uniformization_oncePunctured`. +-# `oka` pins `lana-agents/heights` at 3539e2a; this is the only `heights` revision in this project. ++# The patched `oka` package uses `heights` at 721496ca, shared with the IUT dependency graph. + [[require]] + name = "oka" + git = "https://github.com/lana-agents/oka.git" +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/pi1-lean4341.patch b/lean/patches/pi1-lean4341.patch index 736ef7b5d82a19e114fe8e3f535d63ee9cf89e60..407aac2b2dc9d042a7204eaa41da56fecde5137c 100644 --- a/lean/patches/pi1-lean4341.patch +++ b/lean/patches/pi1-lean4341.patch @@ -1,418 +1,418 @@ -diff --git a/Pi1/FundamentalGroup/Galois.lean b/Pi1/FundamentalGroup/Galois.lean -index a2c4ab3051407e7c32f0e383f2490e0e8ff9c9fc..9eac7f2196a24cc78ef1cf86c36e14067de3a6ce 100644 ---- a/Pi1/FundamentalGroup/Galois.lean -+++ b/Pi1/FundamentalGroup/Galois.lean -@@ -610,7 +610,7 @@ instance galoisCategory [ConnectedSpace X] : GaloisCategory (FiniteEtale X) wher - let Ω : Type u := AlgebraicClosure k - let ξ : Spec (.of Ω) ⟶ X := - Spec.map (CommRingCat.ofHom <| algebraMap k Ω) ≫ X.fromSpecResidueField x -- exact ⟨fiber ξ, ⟨inferInstance⟩⟩ -+ exact ⟨fiber ξ, inferInstance⟩ - - /-- The étale fundamental group of a connected scheme `X` at the geometric point `ξ` is - the automorphism group of the fiber functor at `ξ`. -/ -diff --git a/Pi1/Mathlib/RingTheory/Geometric.lean b/Pi1/Mathlib/RingTheory/Geometric.lean -index 508409f0ad5c389ea2f281277c3d23a26112a5e1..334e49ce6706a1bd3e6957dd93c9bb89ad0a33aa 100644 ---- a/Pi1/Mathlib/RingTheory/Geometric.lean -+++ b/Pi1/Mathlib/RingTheory/Geometric.lean -@@ -37,8 +37,7 @@ lemma Algebra.TensorProduct.exists_intermediateField_isSeparable_and_mem_range - ∃ (K : IntermediateField k Ω), Algebra.IsSeparable k K ∧ Module.Finite k K ∧ - x ∈ Set.range - (Algebra.TensorProduct.map (IsScalarTower.toAlgHom k K Ω) (AlgHom.id k R)) := by -- induction x with -- | zero => exact ⟨⊥, inferInstance, inferInstance, 0, by simp⟩ -+ induction x using TensorProduct.inductionOn with - | add x y hx hy => - obtain ⟨K, hK₁, hK₂, ⟨x, rfl⟩⟩ := hx - obtain ⟨L, hL₁, hL₂, ⟨y, rfl⟩⟩ := hy -diff --git a/Pi1/Mathlib/RingTheory/TensorProduct/Basic.lean b/Pi1/Mathlib/RingTheory/TensorProduct/Basic.lean -index 5ce0f465a46056184814f3f8659a071e1d9f3479..8e0d9e5862786f9212862e26ec8a0327384f351d 100644 ---- a/Pi1/Mathlib/RingTheory/TensorProduct/Basic.lean -+++ b/Pi1/Mathlib/RingTheory/TensorProduct/Basic.lean -@@ -12,8 +12,7 @@ noncomputable def Algebra.TensorProduct.comm' {R S T : Type*} [CommRing R] - S ⊗[R] T ≃ₗ[S] T ⊗[R] S := - (_root_.TensorProduct.comm ..).toAddEquiv.toLinearEquiv <| by - intro c x -- induction x with -- | zero => simp -+ induction x using TensorProduct.inductionOn with - | add x y hx hy => - simp only [LinearEquiv.coe_toAddEquiv, LinearEquiv.coe_addEquiv_apply] at hx hy - simp [hx, hy] -diff --git a/Pi1/Orbicurve/BaseChange.lean b/Pi1/Orbicurve/BaseChange.lean -index 090ba0a7bd9ece77432f149024b04a0d97ae7b6b..70fdb5887ae555de87ccd0f44cfb88f8d4c60564 100644 ---- a/Pi1/Orbicurve/BaseChange.lean -+++ b/Pi1/Orbicurve/BaseChange.lean -@@ -662,8 +662,7 @@ theorem mem_K₀_of_isAlgebraic (htK : Transcendental K t) {x : Ω} (hx : x ∈ - obtain ⟨P, hP⟩ : ∃ P : K[X], aeval t P = g := by - have h1 : IsIntegral (A₀ K t) (⟨g, hgK⟩ : K₀ K t) := by - haveI : IsScalarTower (A₀ K t) (K₀ K t) Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl -- exact (isIntegral_algebraMap_iff (algebraMap (K₀ K t) Ω).injective).mp -- (isIntegral_A₀_of t hgint) -+ exact isIntegral_algebraMap_iff.mp (isIntegral_A₀_of t hgint) - obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ K t) (K := K₀ K t)).mp h1 - refine ⟨eK.symm a, ?_⟩ - rw [← coe_algEquivOfTranscendental htK, AlgEquiv.apply_symm_apply] -@@ -871,7 +870,8 @@ theorem ramificationIdx_bc (htK : Transcendental K t) - haveI hum : u.IsMaximal := Ideal.IsPrime.isMaximal inferInstance hune - refine ⟨?_, ?_⟩ - · rw [hwu] -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal' _ (ringMap_isIntegral t _) u -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t hF₂N).toRingHom (ringMap_isIntegral t hF₂N) u - · have hmc := ramificationIdx_mul_card t htk h hF₂N u - rw [← hwu] at hmc - have c1 := card_inertia_inf_fixSub hNN' htK (le_of_eq hN') (h.trans hF₂N) h₁ h₁' u' hune -@@ -954,7 +954,8 @@ theorem exists_comap_bc_eq [IsAlgClosed k] (htK : Transcendental K t) - letI := algRing t hbotN - haveI : Algebra.IsIntegral (coordRing k t (⊥ : IntermediateField (K₀ k t) Ω)) - (coordRing k t N) := ⟨ringMap_isIntegral t _⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal u -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t hbotN).toRingHom (ringMap_isIntegral t hbotN) u - set ek := coordRingBotEquiv (Ω := Ω) htk - set eK := coordRingBotEquiv (Ω := Ω) htK - set P : Ideal k[X] := p.comap ek.toRingEquiv.toRingHom -@@ -1028,7 +1029,8 @@ theorem exists_comap_bc_eq [IsAlgClosed k] (htK : Transcendental K t) - ← bcMap_smul] - exact Iff.rfl - refine ⟨u'.comap (ringMap t hF'N'), -- Ideal.isMaximal_comap_of_isIntegral_of_isMaximal' _ (ringMap_isIntegral t _) u', ?_⟩ -+ Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t hF'N').toRingHom (ringMap_isIntegral t hF'N') u', ?_⟩ - rw [← huw, ← hu'u] - ext x - exact Iff.rfl -diff --git a/Pi1/Orbicurve/CoreCriterion.lean b/Pi1/Orbicurve/CoreCriterion.lean -index f3abee6eff68fe5d793cd80047d547c57863272a..3acb520602d01e1d875e8f9ff8991245aa225db5 100644 ---- a/Pi1/Orbicurve/CoreCriterion.lean -+++ b/Pi1/Orbicurve/CoreCriterion.lean -@@ -87,7 +87,10 @@ lemma le_one_of_integral_mvPolynomial {R : Type*} [CommRing R] [IsDomain R] [Alg - exact zero_mem _ - haveI : (⊥ : Ideal R).IsPrime := Ideal.isPrime_bot - obtain ⟨Q1, -, hQ1, hQ1c⟩ := Ideal.exists_ideal_over_prime_of_isIntegral_of_isPrime p1 ⊥ hbot -- have hQ1c' : Q1.comap (algebraMap (MvPolynomial (Fin s) k) R) ≤ p2 := hQ1c ▸ hp12 -+ have hQ1c' : Q1.comap (algebraMap (MvPolynomial (Fin s) k) R) ≤ p2 := by -+ change Q1.under (MvPolynomial (Fin s) k) ≤ p2 -+ rw [hQ1c] -+ exact hp12 - obtain ⟨Q2, hQ12, hQ2, hQ2c⟩ := Ideal.exists_ideal_over_prime_of_isIntegral_of_isPrime p2 Q1 hQ1c' - have hQ1ne : Q1 ≠ ⊥ := by - rintro rfl -@@ -150,11 +153,10 @@ lemma bijective_algebraMap_coordRing_bot : - IsScalarTower.of_algebraMap_eq fun _ => rfl - have := b.2 - rw [mem_integralClosure_iff] at this -- exact (isIntegral_algebraMap_iff (A := (⊥ : IntermediateField (K₀ k t) Ω)) (B := Ω) -- (algebraMap (⊥ : IntermediateField (K₀ k t) Ω) Ω).injective).mpr this -+ exact (isIntegral_algebraMap_iff (A := (⊥ : IntermediateField (K₀ k t) Ω)) (B := Ω)).mpr this - rw [← hz] at h1 - haveI : IsScalarTower (A₀ k t) (K₀ k t) Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl -- exact (isIntegral_algebraMap_iff (algebraMap (K₀ k t) Ω).injective).mp h1 -+ exact isIntegral_algebraMap_iff.mp h1 - obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ k t) (K := K₀ k t)).mp hzint - refine ⟨a, Subtype.ext (Subtype.ext ?_)⟩ - rw [← hz, ← ha] -diff --git a/Pi1/Orbicurve/Descent.lean b/Pi1/Orbicurve/Descent.lean -index cc144f5107305081c45a2ab530aa2c977feaf399..441506695c68758cd178a77c46fcfad3f6f87e3d 100644 ---- a/Pi1/Orbicurve/Descent.lean -+++ b/Pi1/Orbicurve/Descent.lean -@@ -162,7 +162,7 @@ theorem isIntegral_A₀_of_bc [IsAlgClosed k] (htK : Transcendental K t) {x : Ω - haveI := isPrincipalIdealRing_A₀ htK - have h1 : IsIntegral (A₀ K t) (⟨_, hK⟩ : K₀ K t) := by - haveI : IsScalarTower (A₀ K t) (K₀ K t) Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl -- exact (isIntegral_algebraMap_iff (algebraMap (K₀ K t) Ω).injective).mp hR -+ exact isIntegral_algebraMap_iff.mp hR - obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ K t) (K := K₀ K t)).mp h1 - have hA : ((p.coeff i : K₀ k t) : Ω) ∈ A₀ K t := by - rw [← congrArg Subtype.val ha]; exact a.2 -diff --git a/Pi1/Orbicurve/EllipticSubfield.lean b/Pi1/Orbicurve/EllipticSubfield.lean -index bd714eb726fcb5b45f2ddebd2b9f4f0649373075..0f89de5c7e5d2cfe82e5cf3691fb1d3d9a86e2c5 100644 ---- a/Pi1/Orbicurve/EllipticSubfield.lean -+++ b/Pi1/Orbicurve/EllipticSubfield.lean -@@ -290,7 +290,9 @@ lemma multE_eq (w : Ideal (coordRing k (tE j) (fnFieldE j))) [hw : w.IsMaximal] - letI iR := algRing (tE j) (bot_le_fnFieldE j) - haveI : Algebra.IsIntegral (coordRing k (tE j) (⊥ : IntermediateField (K₀ k (tE j)) Ω)) - (coordRing k (tE j) (fnFieldE j)) := ⟨ringMap_isIntegral _ _⟩ -- haveI hv : v.IsMaximal := Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w -+ haveI hv : v.IsMaximal := Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap (tE j) (bot_le_fnFieldE j)).toRingHom -+ (ringMap_isIntegral (tE j) (bot_le_fnFieldE j)) w - have hex : ∃ P : Ideal (coordRing k (tE j) (fnFieldE j)), P.IsPrime ∧ P.LiesOver v := - ⟨w, hw.isPrime, ⟨rfl⟩⟩ - unfold multE -diff --git a/Pi1/Orbicurve/Embed.lean b/Pi1/Orbicurve/Embed.lean -index 2ecb512486f83f0bcb61cf889da57aa497b42d2b..dd4cf874658c96a8958dd4c5230a07df02544d07 100644 ---- a/Pi1/Orbicurve/Embed.lean -+++ b/Pi1/Orbicurve/Embed.lean -@@ -47,7 +47,7 @@ lemma mem_coordRing_of_isIntegral {L : IntermediateField (K₀ k t) Ω} {x : Ω} - (h : IsIntegral (A₀ k t) x) : (⟨x, hx⟩ : L) ∈ coordRing k t L := by - haveI : IsScalarTower (A₀ k t) L Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl - rw [mem_integralClosure_iff] -- exact (isIntegral_algebraMap_iff (A := L) (B := Ω) (algebraMap L Ω).injective).mp h -+ exact (isIntegral_algebraMap_iff (A := L) (B := Ω)).mp h - - omit [IsAlgClosed Ω] [FiniteDimensional (K₀ k t) B] in - lemma isIntegral_of_mem_coordRing {L : IntermediateField (K₀ k t) Ω} -@@ -55,7 +55,7 @@ lemma isIntegral_of_mem_coordRing {L : IntermediateField (K₀ k t) Ω} - haveI : IsScalarTower (A₀ k t) L Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl - have := x.2 - rw [mem_integralClosure_iff] at this -- exact (isIntegral_algebraMap_iff (A := L) (B := Ω) (algebraMap L Ω).injective).mpr this -+ exact (isIntegral_algebraMap_iff (A := L) (B := Ω)).mpr this - - set_option maxHeartbeats 1000000 in - theorem exists_algEquiv_coordRing (g : coordRing k t B →ₐ[k] Z) (hg : Function.Injective g) -diff --git a/Pi1/Orbicurve/HemiTY.lean b/Pi1/Orbicurve/HemiTY.lean -index 8d0bcd5489998284c34d9df61cb0111351673942..72f5f321a530b773de7272af239e41dc17b4705b 100644 ---- a/Pi1/Orbicurve/HemiTY.lean -+++ b/Pi1/Orbicurve/HemiTY.lean -@@ -162,7 +162,8 @@ lemma multTY_eq (w : Ideal (coordRing F t (fnTY F t y))) [hw : w.IsMaximal] : - letI iR := algRing t hle - haveI : Algebra.IsIntegral (coordRing F t (⊥ : IntermediateField (K₀ F t) Ω)) - (coordRing F t (fnTY F t y)) := ⟨ringMap_isIntegral _ _⟩ -- haveI hv : v.IsMaximal := Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w -+ haveI hv : v.IsMaximal := Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t hle).toRingHom (ringMap_isIntegral t hle) w - have hex : ∃ P : Ideal (coordRing F t (fnTY F t y)), P.IsPrime ∧ P.LiesOver v := - ⟨w, hw.isPrime, ⟨rfl⟩⟩ - unfold multTY -diff --git a/Pi1/Orbicurve/Lefschetz.lean b/Pi1/Orbicurve/Lefschetz.lean -index 4c16c738ccab27bf389bd2a04fd6c9cb85335eae..aecad2b4d42fe8de49372021ccacad5c5f3b7306 100644 ---- a/Pi1/Orbicurve/Lefschetz.lean -+++ b/Pi1/Orbicurve/Lefschetz.lean -@@ -162,7 +162,8 @@ theorem etale_bc - letI := algRing t h' - haveI : Algebra.IsIntegral (coordRing K t F₁') (coordRing K t F₂') := - ⟨ringMap_isIntegral t _⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w' -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t h').toRingHom (ringMap_isIntegral t h') w' - by_cases hw : w = ⊥ - · rw [hbot hw, one_mul, hm₂ w' hw' hw, hm₁ _ inferInstance (by - rw [hv, hw]; exact Ideal.comap_bot_of_injective _ (ringMap_injective t h))] -@@ -199,7 +200,8 @@ theorem etale_of_bc [IsAlgClosed k] - letI := algRing t h' - haveI : Algebra.IsIntegral (coordRing K t F₁') (coordRing K t F₂') := - ⟨ringMap_isIntegral t _⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w' -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t h').toRingHom (ringMap_isIntegral t h') w' - have hv0 : w.comap (ringMap t h) ≠ ⊥ := by - letI := algRing t h - haveI : Algebra.IsIntegral (coordRing k t F₁) (coordRing k t F₂) := -@@ -295,8 +297,9 @@ lemma coe_coordRingRangeEquiv {u : Ω} (L : IntermediateField (K₀ k u) Ω) (a - over `k[t]` and `t` over `k[s]`. -/ - noncomputable def rebaseEquiv (hst : IsIntegral (A₀ k t) s) (hts : IsIntegral (A₀ k s) t) : - coordRing k t F ≃+* coordRing k s (rebase F hs) := -- (coordRingRangeEquiv F).trans ((RingEquiv.subringCongr (range_coordRingVal_rebase hst hts)).trans -- (coordRingRangeEquiv (rebase F hs)).symm) -+ (coordRingRangeEquiv F).trans ((RingEquiv.subringCongr -+ (range_coordRingVal_rebase (F := F) (hs := hs) hst hts)).trans -+ (coordRingRangeEquiv (rebase F hs)).symm) - - lemma coordRingVal_rebaseEquiv (hst : IsIntegral (A₀ k t) s) (hts : IsIntegral (A₀ k s) t) - (a : coordRing k t F) : -diff --git a/Pi1/Orbicurve/Morphisms.lean b/Pi1/Orbicurve/Morphisms.lean -index 3acbb75d5d6f01f5f792e046904553b44a21bc6a..e56607fcfb6e87a1dbb76e3d8c92f6d1d5142cbf 100644 ---- a/Pi1/Orbicurve/Morphisms.lean -+++ b/Pi1/Orbicurve/Morphisms.lean -@@ -65,9 +65,7 @@ def Hom.comp {Z Y C : AffOrbicurve k} (φ : Hom Z Y) (ψ : Hom Y C) : Hom Z C wh - etale w hw := by - have h1 := ramificationIdx_comp ψ.f.toRingHom φ.f.toRingHom φ.injective w - have hq : (w.comap φ.f).IsMaximal := by -- letI := φ.f.toRingHom.toAlgebra -- haveI : Algebra.IsIntegral Y.A Z.A := ⟨φ.isIntegral⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal φ.f.toRingHom φ.isIntegral w - rw [show (φ.f.comp ψ.f).toRingHom = φ.f.toRingHom.comp ψ.f.toRingHom from rfl, h1, mul_assoc, - φ.etale w hw] - exact ψ.etale _ hq -diff --git a/Pi1/Orbicurve/Pullback.lean b/Pi1/Orbicurve/Pullback.lean -index b44d8bfacd13e025fbfca01c9825b1670a30f1d6..65649013234a4e1a00a57d4e30524f55cb954d3b 100644 ---- a/Pi1/Orbicurve/Pullback.lean -+++ b/Pi1/Orbicurve/Pullback.lean -@@ -259,9 +259,8 @@ theorem exists_pullback_subfield {B A Z : IntermediateField (K₀ k t) Ω} - have hmax : ∀ {F F' : IntermediateField (K₀ k t) Ω} (h : F ≤ F') (w : Ideal (coordRing k t F')), - w.IsMaximal → (w.comap (ringMap t h)).IsMaximal := by - intro F F' h w hw -- letI := algRing t h -- haveI : Algebra.IsIntegral (coordRing k t F) (coordRing k t F') := ⟨ringMap_isIntegral t h⟩ -- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal (R := coordRing k t F) w -+ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal -+ (ringMap t h).toRingHom (ringMap_isIntegral t h) w - -- the key divisibility - have hdiv : ∀ w : Ideal (coordRing k t L), w.IsMaximal → - eL w ∣ mB (w.comap (ringMap t hBL)) := by -diff --git a/Pi1/Orbicurve/SubfieldGalois.lean b/Pi1/Orbicurve/SubfieldGalois.lean -index cdf1cd9a59b1babed4ec0f7e6cba5b4dc4ffe77e..4a7f20bb7d45cf270c4af8a0742e6d29fcf8f46d 100644 ---- a/Pi1/Orbicurve/SubfieldGalois.lean -+++ b/Pi1/Orbicurve/SubfieldGalois.lean -@@ -125,6 +125,8 @@ theorem isGaloisGroup_fixSub (ht : Transcendental k t) : - Algebra.IsSeparable.of_algHom (F := K₀ k t) (E := F) (E' := N) (IntermediateField.inclusion hFN) - haveI := isDedekindDomain_ring t ht F - haveI : Algebra.IsIntegral (coordRing k t F) (coordRing k t N) := ⟨ringMap_isIntegral t hFN⟩ -+ have : FaithfulSMul F N := -+ (faithfulSMul_iff_algebraMap_injective F N).mpr (algebraMap F N).injective - haveI hG : IsGaloisGroup (fixSub t N F) F N := by - rw [fixSub_eq_fixingSubgroup_range t hFN] - exact IsGaloisGroup.of_isScalarTower (N ≃ₐ[K₀ k t] N) (K₀ k t) N F -diff --git a/Pi1/Orbicurve/ValuationInertia.lean b/Pi1/Orbicurve/ValuationInertia.lean -index 0ec7ebb8c00870e8772c67b93b3491957fc7a80c..d2f800ca2206762421dd68a3ccae78d6dcfece9f 100644 ---- a/Pi1/Orbicurve/ValuationInertia.lean -+++ b/Pi1/Orbicurve/ValuationInertia.lean -@@ -380,7 +380,7 @@ theorem exists_isInertialOn_restrictNormal_eq [IsGalois (K₀ k t) Ω] (ht : Tra - by rw [fixSub_bot]; trivial⟩ - rw [hr] - exact (mem_inertia_centerIdeal_iff hW M x).mp hx.1 (ringMap t hNM b) -- let f : H →* H' := (r.restrict H).codRestrict H' fun x => hmap x.1 x.2 -+ let f : H →* H' := (r.domRestrict H).codRestrict H' fun x => hmap x.1 x.2 - have hf : Function.Surjective f := by - apply MonoidHom.surjective_of_card_ker_le_div - rw [hcard, Nat.mul_div_cancel_left _ Nat.card_pos] -diff --git a/Pi1/RingTheory/FiniteEtale/Basic.lean b/Pi1/RingTheory/FiniteEtale/Basic.lean -index 5bac8ad46412db0bc8d51fc107aa78a9baae2a3a..665745890a7055fbd133742c1d0ab5a19f1c3294 100644 ---- a/Pi1/RingTheory/FiniteEtale/Basic.lean -+++ b/Pi1/RingTheory/FiniteEtale/Basic.lean -@@ -2,6 +2,7 @@ module - - public import Mathlib.Algebra.Lie.OfAssociative - public import Mathlib.RingTheory.RingHom.Etale -+public import Mathlib.RingTheory.RingHom.Finite - public import Mathlib.RingTheory.TotallySplit - public import Pi1.Mathlib.RingTheory.RingHom.Finite - -diff --git a/Pi1/RingTheory/UnramifiedValuation.lean b/Pi1/RingTheory/UnramifiedValuation.lean -index e3052f76fd99bb8c09ed2c8364190ac6ba3f3e93..59f7901ee950991de6a61672712368b0aa193c7d 100644 ---- a/Pi1/RingTheory/UnramifiedValuation.lean -+++ b/Pi1/RingTheory/UnramifiedValuation.lean -@@ -31,8 +31,7 @@ theorem algHom_eq_of_valuation [FormallyUnramified R B] [EssFiniteType R B] - let F : B ⊗[R] B →ₐ[R] K := Algebra.TensorProduct.lift f g fun _ _ => Commute.all _ _ - have key : ∀ x : B ⊗[R] B, F x ∈ W ∧ W.valuation (F x - f (TensorProduct.lmul' R x)) < 1 := by - intro x -- induction x with -- | zero => simp -+ induction x using TensorProduct.inductionOn with - | tmul a b => - refine ⟨?_, ?_⟩ - · simp only [F, Algebra.TensorProduct.lift_tmul] -diff --git a/lake-manifest.json b/lake-manifest.json -index b559cbefeef96f6d55a8eeb1843117b696d3b13d..10f9c460beb405874e4ad6663b1e9d96aed961ea 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,21 +1,21 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/leanprover-community/mathlib4", -+ [{"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -25,7 +25,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -35,7 +35,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +45,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -65,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -75,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -85,10 +85,10 @@ - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "pi1", -diff --git a/lakefile.toml b/lakefile.toml -index c40e8fb8855e624ac19e0d4228b417b7f6ed8cd8..173ffbb273086f7536c3ff500e6577634f3e5da3 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -16,8 +16,8 @@ backward.defeqAttrib.useBackward = true - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "Pi1" -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/Pi1/FundamentalGroup/Galois.lean b/Pi1/FundamentalGroup/Galois.lean +index a2c4ab3051407e7c32f0e383f2490e0e8ff9c9fc..9eac7f2196a24cc78ef1cf86c36e14067de3a6ce 100644 +--- a/Pi1/FundamentalGroup/Galois.lean ++++ b/Pi1/FundamentalGroup/Galois.lean +@@ -610,7 +610,7 @@ instance galoisCategory [ConnectedSpace X] : GaloisCategory (FiniteEtale X) wher + let Ω : Type u := AlgebraicClosure k + let ξ : Spec (.of Ω) ⟶ X := + Spec.map (CommRingCat.ofHom <| algebraMap k Ω) ≫ X.fromSpecResidueField x +- exact ⟨fiber ξ, ⟨inferInstance⟩⟩ ++ exact ⟨fiber ξ, inferInstance⟩ + + /-- The étale fundamental group of a connected scheme `X` at the geometric point `ξ` is + the automorphism group of the fiber functor at `ξ`. -/ +diff --git a/Pi1/Mathlib/RingTheory/Geometric.lean b/Pi1/Mathlib/RingTheory/Geometric.lean +index 508409f0ad5c389ea2f281277c3d23a26112a5e1..334e49ce6706a1bd3e6957dd93c9bb89ad0a33aa 100644 +--- a/Pi1/Mathlib/RingTheory/Geometric.lean ++++ b/Pi1/Mathlib/RingTheory/Geometric.lean +@@ -37,8 +37,7 @@ lemma Algebra.TensorProduct.exists_intermediateField_isSeparable_and_mem_range + ∃ (K : IntermediateField k Ω), Algebra.IsSeparable k K ∧ Module.Finite k K ∧ + x ∈ Set.range + (Algebra.TensorProduct.map (IsScalarTower.toAlgHom k K Ω) (AlgHom.id k R)) := by +- induction x with +- | zero => exact ⟨⊥, inferInstance, inferInstance, 0, by simp⟩ ++ induction x using TensorProduct.inductionOn with + | add x y hx hy => + obtain ⟨K, hK₁, hK₂, ⟨x, rfl⟩⟩ := hx + obtain ⟨L, hL₁, hL₂, ⟨y, rfl⟩⟩ := hy +diff --git a/Pi1/Mathlib/RingTheory/TensorProduct/Basic.lean b/Pi1/Mathlib/RingTheory/TensorProduct/Basic.lean +index 5ce0f465a46056184814f3f8659a071e1d9f3479..8e0d9e5862786f9212862e26ec8a0327384f351d 100644 +--- a/Pi1/Mathlib/RingTheory/TensorProduct/Basic.lean ++++ b/Pi1/Mathlib/RingTheory/TensorProduct/Basic.lean +@@ -12,8 +12,7 @@ noncomputable def Algebra.TensorProduct.comm' {R S T : Type*} [CommRing R] + S ⊗[R] T ≃ₗ[S] T ⊗[R] S := + (_root_.TensorProduct.comm ..).toAddEquiv.toLinearEquiv <| by + intro c x +- induction x with +- | zero => simp ++ induction x using TensorProduct.inductionOn with + | add x y hx hy => + simp only [LinearEquiv.coe_toAddEquiv, LinearEquiv.coe_addEquiv_apply] at hx hy + simp [hx, hy] +diff --git a/Pi1/Orbicurve/BaseChange.lean b/Pi1/Orbicurve/BaseChange.lean +index 090ba0a7bd9ece77432f149024b04a0d97ae7b6b..70fdb5887ae555de87ccd0f44cfb88f8d4c60564 100644 +--- a/Pi1/Orbicurve/BaseChange.lean ++++ b/Pi1/Orbicurve/BaseChange.lean +@@ -662,8 +662,7 @@ theorem mem_K₀_of_isAlgebraic (htK : Transcendental K t) {x : Ω} (hx : x ∈ + obtain ⟨P, hP⟩ : ∃ P : K[X], aeval t P = g := by + have h1 : IsIntegral (A₀ K t) (⟨g, hgK⟩ : K₀ K t) := by + haveI : IsScalarTower (A₀ K t) (K₀ K t) Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl +- exact (isIntegral_algebraMap_iff (algebraMap (K₀ K t) Ω).injective).mp +- (isIntegral_A₀_of t hgint) ++ exact isIntegral_algebraMap_iff.mp (isIntegral_A₀_of t hgint) + obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ K t) (K := K₀ K t)).mp h1 + refine ⟨eK.symm a, ?_⟩ + rw [← coe_algEquivOfTranscendental htK, AlgEquiv.apply_symm_apply] +@@ -871,7 +870,8 @@ theorem ramificationIdx_bc (htK : Transcendental K t) + haveI hum : u.IsMaximal := Ideal.IsPrime.isMaximal inferInstance hune + refine ⟨?_, ?_⟩ + · rw [hwu] +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal' _ (ringMap_isIntegral t _) u ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t hF₂N).toRingHom (ringMap_isIntegral t hF₂N) u + · have hmc := ramificationIdx_mul_card t htk h hF₂N u + rw [← hwu] at hmc + have c1 := card_inertia_inf_fixSub hNN' htK (le_of_eq hN') (h.trans hF₂N) h₁ h₁' u' hune +@@ -954,7 +954,8 @@ theorem exists_comap_bc_eq [IsAlgClosed k] (htK : Transcendental K t) + letI := algRing t hbotN + haveI : Algebra.IsIntegral (coordRing k t (⊥ : IntermediateField (K₀ k t) Ω)) + (coordRing k t N) := ⟨ringMap_isIntegral t _⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal u ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t hbotN).toRingHom (ringMap_isIntegral t hbotN) u + set ek := coordRingBotEquiv (Ω := Ω) htk + set eK := coordRingBotEquiv (Ω := Ω) htK + set P : Ideal k[X] := p.comap ek.toRingEquiv.toRingHom +@@ -1028,7 +1029,8 @@ theorem exists_comap_bc_eq [IsAlgClosed k] (htK : Transcendental K t) + ← bcMap_smul] + exact Iff.rfl + refine ⟨u'.comap (ringMap t hF'N'), +- Ideal.isMaximal_comap_of_isIntegral_of_isMaximal' _ (ringMap_isIntegral t _) u', ?_⟩ ++ Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t hF'N').toRingHom (ringMap_isIntegral t hF'N') u', ?_⟩ + rw [← huw, ← hu'u] + ext x + exact Iff.rfl +diff --git a/Pi1/Orbicurve/CoreCriterion.lean b/Pi1/Orbicurve/CoreCriterion.lean +index f3abee6eff68fe5d793cd80047d547c57863272a..3acb520602d01e1d875e8f9ff8991245aa225db5 100644 +--- a/Pi1/Orbicurve/CoreCriterion.lean ++++ b/Pi1/Orbicurve/CoreCriterion.lean +@@ -87,7 +87,10 @@ lemma le_one_of_integral_mvPolynomial {R : Type*} [CommRing R] [IsDomain R] [Alg + exact zero_mem _ + haveI : (⊥ : Ideal R).IsPrime := Ideal.isPrime_bot + obtain ⟨Q1, -, hQ1, hQ1c⟩ := Ideal.exists_ideal_over_prime_of_isIntegral_of_isPrime p1 ⊥ hbot +- have hQ1c' : Q1.comap (algebraMap (MvPolynomial (Fin s) k) R) ≤ p2 := hQ1c ▸ hp12 ++ have hQ1c' : Q1.comap (algebraMap (MvPolynomial (Fin s) k) R) ≤ p2 := by ++ change Q1.under (MvPolynomial (Fin s) k) ≤ p2 ++ rw [hQ1c] ++ exact hp12 + obtain ⟨Q2, hQ12, hQ2, hQ2c⟩ := Ideal.exists_ideal_over_prime_of_isIntegral_of_isPrime p2 Q1 hQ1c' + have hQ1ne : Q1 ≠ ⊥ := by + rintro rfl +@@ -150,11 +153,10 @@ lemma bijective_algebraMap_coordRing_bot : + IsScalarTower.of_algebraMap_eq fun _ => rfl + have := b.2 + rw [mem_integralClosure_iff] at this +- exact (isIntegral_algebraMap_iff (A := (⊥ : IntermediateField (K₀ k t) Ω)) (B := Ω) +- (algebraMap (⊥ : IntermediateField (K₀ k t) Ω) Ω).injective).mpr this ++ exact (isIntegral_algebraMap_iff (A := (⊥ : IntermediateField (K₀ k t) Ω)) (B := Ω)).mpr this + rw [← hz] at h1 + haveI : IsScalarTower (A₀ k t) (K₀ k t) Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl +- exact (isIntegral_algebraMap_iff (algebraMap (K₀ k t) Ω).injective).mp h1 ++ exact isIntegral_algebraMap_iff.mp h1 + obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ k t) (K := K₀ k t)).mp hzint + refine ⟨a, Subtype.ext (Subtype.ext ?_)⟩ + rw [← hz, ← ha] +diff --git a/Pi1/Orbicurve/Descent.lean b/Pi1/Orbicurve/Descent.lean +index cc144f5107305081c45a2ab530aa2c977feaf399..441506695c68758cd178a77c46fcfad3f6f87e3d 100644 +--- a/Pi1/Orbicurve/Descent.lean ++++ b/Pi1/Orbicurve/Descent.lean +@@ -162,7 +162,7 @@ theorem isIntegral_A₀_of_bc [IsAlgClosed k] (htK : Transcendental K t) {x : Ω + haveI := isPrincipalIdealRing_A₀ htK + have h1 : IsIntegral (A₀ K t) (⟨_, hK⟩ : K₀ K t) := by + haveI : IsScalarTower (A₀ K t) (K₀ K t) Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl +- exact (isIntegral_algebraMap_iff (algebraMap (K₀ K t) Ω).injective).mp hR ++ exact isIntegral_algebraMap_iff.mp hR + obtain ⟨a, ha⟩ := (IsIntegrallyClosed.isIntegral_iff (R := A₀ K t) (K := K₀ K t)).mp h1 + have hA : ((p.coeff i : K₀ k t) : Ω) ∈ A₀ K t := by + rw [← congrArg Subtype.val ha]; exact a.2 +diff --git a/Pi1/Orbicurve/EllipticSubfield.lean b/Pi1/Orbicurve/EllipticSubfield.lean +index bd714eb726fcb5b45f2ddebd2b9f4f0649373075..0f89de5c7e5d2cfe82e5cf3691fb1d3d9a86e2c5 100644 +--- a/Pi1/Orbicurve/EllipticSubfield.lean ++++ b/Pi1/Orbicurve/EllipticSubfield.lean +@@ -290,7 +290,9 @@ lemma multE_eq (w : Ideal (coordRing k (tE j) (fnFieldE j))) [hw : w.IsMaximal] + letI iR := algRing (tE j) (bot_le_fnFieldE j) + haveI : Algebra.IsIntegral (coordRing k (tE j) (⊥ : IntermediateField (K₀ k (tE j)) Ω)) + (coordRing k (tE j) (fnFieldE j)) := ⟨ringMap_isIntegral _ _⟩ +- haveI hv : v.IsMaximal := Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w ++ haveI hv : v.IsMaximal := Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap (tE j) (bot_le_fnFieldE j)).toRingHom ++ (ringMap_isIntegral (tE j) (bot_le_fnFieldE j)) w + have hex : ∃ P : Ideal (coordRing k (tE j) (fnFieldE j)), P.IsPrime ∧ P.LiesOver v := + ⟨w, hw.isPrime, ⟨rfl⟩⟩ + unfold multE +diff --git a/Pi1/Orbicurve/Embed.lean b/Pi1/Orbicurve/Embed.lean +index 2ecb512486f83f0bcb61cf889da57aa497b42d2b..dd4cf874658c96a8958dd4c5230a07df02544d07 100644 +--- a/Pi1/Orbicurve/Embed.lean ++++ b/Pi1/Orbicurve/Embed.lean +@@ -47,7 +47,7 @@ lemma mem_coordRing_of_isIntegral {L : IntermediateField (K₀ k t) Ω} {x : Ω} + (h : IsIntegral (A₀ k t) x) : (⟨x, hx⟩ : L) ∈ coordRing k t L := by + haveI : IsScalarTower (A₀ k t) L Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl + rw [mem_integralClosure_iff] +- exact (isIntegral_algebraMap_iff (A := L) (B := Ω) (algebraMap L Ω).injective).mp h ++ exact (isIntegral_algebraMap_iff (A := L) (B := Ω)).mp h + + omit [IsAlgClosed Ω] [FiniteDimensional (K₀ k t) B] in + lemma isIntegral_of_mem_coordRing {L : IntermediateField (K₀ k t) Ω} +@@ -55,7 +55,7 @@ lemma isIntegral_of_mem_coordRing {L : IntermediateField (K₀ k t) Ω} + haveI : IsScalarTower (A₀ k t) L Ω := IsScalarTower.of_algebraMap_eq fun _ => rfl + have := x.2 + rw [mem_integralClosure_iff] at this +- exact (isIntegral_algebraMap_iff (A := L) (B := Ω) (algebraMap L Ω).injective).mpr this ++ exact (isIntegral_algebraMap_iff (A := L) (B := Ω)).mpr this + + set_option maxHeartbeats 1000000 in + theorem exists_algEquiv_coordRing (g : coordRing k t B →ₐ[k] Z) (hg : Function.Injective g) +diff --git a/Pi1/Orbicurve/HemiTY.lean b/Pi1/Orbicurve/HemiTY.lean +index 8d0bcd5489998284c34d9df61cb0111351673942..72f5f321a530b773de7272af239e41dc17b4705b 100644 +--- a/Pi1/Orbicurve/HemiTY.lean ++++ b/Pi1/Orbicurve/HemiTY.lean +@@ -162,7 +162,8 @@ lemma multTY_eq (w : Ideal (coordRing F t (fnTY F t y))) [hw : w.IsMaximal] : + letI iR := algRing t hle + haveI : Algebra.IsIntegral (coordRing F t (⊥ : IntermediateField (K₀ F t) Ω)) + (coordRing F t (fnTY F t y)) := ⟨ringMap_isIntegral _ _⟩ +- haveI hv : v.IsMaximal := Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w ++ haveI hv : v.IsMaximal := Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t hle).toRingHom (ringMap_isIntegral t hle) w + have hex : ∃ P : Ideal (coordRing F t (fnTY F t y)), P.IsPrime ∧ P.LiesOver v := + ⟨w, hw.isPrime, ⟨rfl⟩⟩ + unfold multTY +diff --git a/Pi1/Orbicurve/Lefschetz.lean b/Pi1/Orbicurve/Lefschetz.lean +index 4c16c738ccab27bf389bd2a04fd6c9cb85335eae..aecad2b4d42fe8de49372021ccacad5c5f3b7306 100644 +--- a/Pi1/Orbicurve/Lefschetz.lean ++++ b/Pi1/Orbicurve/Lefschetz.lean +@@ -162,7 +162,8 @@ theorem etale_bc + letI := algRing t h' + haveI : Algebra.IsIntegral (coordRing K t F₁') (coordRing K t F₂') := + ⟨ringMap_isIntegral t _⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w' ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t h').toRingHom (ringMap_isIntegral t h') w' + by_cases hw : w = ⊥ + · rw [hbot hw, one_mul, hm₂ w' hw' hw, hm₁ _ inferInstance (by + rw [hv, hw]; exact Ideal.comap_bot_of_injective _ (ringMap_injective t h))] +@@ -199,7 +200,8 @@ theorem etale_of_bc [IsAlgClosed k] + letI := algRing t h' + haveI : Algebra.IsIntegral (coordRing K t F₁') (coordRing K t F₂') := + ⟨ringMap_isIntegral t _⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w' ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t h').toRingHom (ringMap_isIntegral t h') w' + have hv0 : w.comap (ringMap t h) ≠ ⊥ := by + letI := algRing t h + haveI : Algebra.IsIntegral (coordRing k t F₁) (coordRing k t F₂) := +@@ -295,8 +297,9 @@ lemma coe_coordRingRangeEquiv {u : Ω} (L : IntermediateField (K₀ k u) Ω) (a + over `k[t]` and `t` over `k[s]`. -/ + noncomputable def rebaseEquiv (hst : IsIntegral (A₀ k t) s) (hts : IsIntegral (A₀ k s) t) : + coordRing k t F ≃+* coordRing k s (rebase F hs) := +- (coordRingRangeEquiv F).trans ((RingEquiv.subringCongr (range_coordRingVal_rebase hst hts)).trans +- (coordRingRangeEquiv (rebase F hs)).symm) ++ (coordRingRangeEquiv F).trans ((RingEquiv.subringCongr ++ (range_coordRingVal_rebase (F := F) (hs := hs) hst hts)).trans ++ (coordRingRangeEquiv (rebase F hs)).symm) + + lemma coordRingVal_rebaseEquiv (hst : IsIntegral (A₀ k t) s) (hts : IsIntegral (A₀ k s) t) + (a : coordRing k t F) : +diff --git a/Pi1/Orbicurve/Morphisms.lean b/Pi1/Orbicurve/Morphisms.lean +index 3acbb75d5d6f01f5f792e046904553b44a21bc6a..e56607fcfb6e87a1dbb76e3d8c92f6d1d5142cbf 100644 +--- a/Pi1/Orbicurve/Morphisms.lean ++++ b/Pi1/Orbicurve/Morphisms.lean +@@ -65,9 +65,7 @@ def Hom.comp {Z Y C : AffOrbicurve k} (φ : Hom Z Y) (ψ : Hom Y C) : Hom Z C wh + etale w hw := by + have h1 := ramificationIdx_comp ψ.f.toRingHom φ.f.toRingHom φ.injective w + have hq : (w.comap φ.f).IsMaximal := by +- letI := φ.f.toRingHom.toAlgebra +- haveI : Algebra.IsIntegral Y.A Z.A := ⟨φ.isIntegral⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal w ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal φ.f.toRingHom φ.isIntegral w + rw [show (φ.f.comp ψ.f).toRingHom = φ.f.toRingHom.comp ψ.f.toRingHom from rfl, h1, mul_assoc, + φ.etale w hw] + exact ψ.etale _ hq +diff --git a/Pi1/Orbicurve/Pullback.lean b/Pi1/Orbicurve/Pullback.lean +index b44d8bfacd13e025fbfca01c9825b1670a30f1d6..65649013234a4e1a00a57d4e30524f55cb954d3b 100644 +--- a/Pi1/Orbicurve/Pullback.lean ++++ b/Pi1/Orbicurve/Pullback.lean +@@ -259,9 +259,8 @@ theorem exists_pullback_subfield {B A Z : IntermediateField (K₀ k t) Ω} + have hmax : ∀ {F F' : IntermediateField (K₀ k t) Ω} (h : F ≤ F') (w : Ideal (coordRing k t F')), + w.IsMaximal → (w.comap (ringMap t h)).IsMaximal := by + intro F F' h w hw +- letI := algRing t h +- haveI : Algebra.IsIntegral (coordRing k t F) (coordRing k t F') := ⟨ringMap_isIntegral t h⟩ +- exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal (R := coordRing k t F) w ++ exact Ideal.isMaximal_comap_of_isIntegral_of_isMaximal ++ (ringMap t h).toRingHom (ringMap_isIntegral t h) w + -- the key divisibility + have hdiv : ∀ w : Ideal (coordRing k t L), w.IsMaximal → + eL w ∣ mB (w.comap (ringMap t hBL)) := by +diff --git a/Pi1/Orbicurve/SubfieldGalois.lean b/Pi1/Orbicurve/SubfieldGalois.lean +index cdf1cd9a59b1babed4ec0f7e6cba5b4dc4ffe77e..4a7f20bb7d45cf270c4af8a0742e6d29fcf8f46d 100644 +--- a/Pi1/Orbicurve/SubfieldGalois.lean ++++ b/Pi1/Orbicurve/SubfieldGalois.lean +@@ -125,6 +125,8 @@ theorem isGaloisGroup_fixSub (ht : Transcendental k t) : + Algebra.IsSeparable.of_algHom (F := K₀ k t) (E := F) (E' := N) (IntermediateField.inclusion hFN) + haveI := isDedekindDomain_ring t ht F + haveI : Algebra.IsIntegral (coordRing k t F) (coordRing k t N) := ⟨ringMap_isIntegral t hFN⟩ ++ have : FaithfulSMul F N := ++ (faithfulSMul_iff_algebraMap_injective F N).mpr (algebraMap F N).injective + haveI hG : IsGaloisGroup (fixSub t N F) F N := by + rw [fixSub_eq_fixingSubgroup_range t hFN] + exact IsGaloisGroup.of_isScalarTower (N ≃ₐ[K₀ k t] N) (K₀ k t) N F +diff --git a/Pi1/Orbicurve/ValuationInertia.lean b/Pi1/Orbicurve/ValuationInertia.lean +index 0ec7ebb8c00870e8772c67b93b3491957fc7a80c..d2f800ca2206762421dd68a3ccae78d6dcfece9f 100644 +--- a/Pi1/Orbicurve/ValuationInertia.lean ++++ b/Pi1/Orbicurve/ValuationInertia.lean +@@ -380,7 +380,7 @@ theorem exists_isInertialOn_restrictNormal_eq [IsGalois (K₀ k t) Ω] (ht : Tra + by rw [fixSub_bot]; trivial⟩ + rw [hr] + exact (mem_inertia_centerIdeal_iff hW M x).mp hx.1 (ringMap t hNM b) +- let f : H →* H' := (r.restrict H).codRestrict H' fun x => hmap x.1 x.2 ++ let f : H →* H' := (r.domRestrict H).codRestrict H' fun x => hmap x.1 x.2 + have hf : Function.Surjective f := by + apply MonoidHom.surjective_of_card_ker_le_div + rw [hcard, Nat.mul_div_cancel_left _ Nat.card_pos] +diff --git a/Pi1/RingTheory/FiniteEtale/Basic.lean b/Pi1/RingTheory/FiniteEtale/Basic.lean +index 5bac8ad46412db0bc8d51fc107aa78a9baae2a3a..665745890a7055fbd133742c1d0ab5a19f1c3294 100644 +--- a/Pi1/RingTheory/FiniteEtale/Basic.lean ++++ b/Pi1/RingTheory/FiniteEtale/Basic.lean +@@ -2,6 +2,7 @@ module + + public import Mathlib.Algebra.Lie.OfAssociative + public import Mathlib.RingTheory.RingHom.Etale ++public import Mathlib.RingTheory.RingHom.Finite + public import Mathlib.RingTheory.TotallySplit + public import Pi1.Mathlib.RingTheory.RingHom.Finite + +diff --git a/Pi1/RingTheory/UnramifiedValuation.lean b/Pi1/RingTheory/UnramifiedValuation.lean +index e3052f76fd99bb8c09ed2c8364190ac6ba3f3e93..59f7901ee950991de6a61672712368b0aa193c7d 100644 +--- a/Pi1/RingTheory/UnramifiedValuation.lean ++++ b/Pi1/RingTheory/UnramifiedValuation.lean +@@ -31,8 +31,7 @@ theorem algHom_eq_of_valuation [FormallyUnramified R B] [EssFiniteType R B] + let F : B ⊗[R] B →ₐ[R] K := Algebra.TensorProduct.lift f g fun _ _ => Commute.all _ _ + have key : ∀ x : B ⊗[R] B, F x ∈ W ∧ W.valuation (F x - f (TensorProduct.lmul' R x)) < 1 := by + intro x +- induction x with +- | zero => simp ++ induction x using TensorProduct.inductionOn with + | tmul a b => + refine ⟨?_, ?_⟩ + · simp only [F, Algebra.TensorProduct.lift_tmul] +diff --git a/lake-manifest.json b/lake-manifest.json +index b559cbefeef96f6d55a8eeb1843117b696d3b13d..10f9c460beb405874e4ad6663b1e9d96aed961ea 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,21 +1,21 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/leanprover-community/mathlib4", ++ [{"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -25,7 +25,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -35,7 +35,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +45,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -65,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -75,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -85,10 +85,10 @@ + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "pi1", +diff --git a/lakefile.toml b/lakefile.toml +index c40e8fb8855e624ac19e0d4228b417b7f6ed8cd8..173ffbb273086f7536c3ff500e6577634f3e5da3 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -16,8 +16,8 @@ backward.defeqAttrib.useBackward = true + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "Pi1" +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/rellich-kondrachov-lean4341.patch b/lean/patches/rellich-kondrachov-lean4341.patch index 212c832f65e69bad30f91ae888b20d80ae29ac5f..43600843a74f7736b17db51af4783dc7ba69f6a2 100644 --- a/lean/patches/rellich-kondrachov-lean4341.patch +++ b/lean/patches/rellich-kondrachov-lean4341.patch @@ -1,2697 +1,2697 @@ -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/H1.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/H1.lean -index fcec4d8..6fa9227 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/H1.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/H1.lean -@@ -1,3 +1,9 @@ -+/- -+Copyright (c) 2026 Adam Benenson. All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Adam Benenson -+-/ -+ - import Mathlib.Analysis.Calculus.ContDiff.Operations - import Mathlib.Analysis.Calculus.FDeriv.Const - import Mathlib.Analysis.InnerProductSpace.Dual -@@ -5,12 +11,6 @@ import Mathlib.MeasureTheory.Function.LpSpace.Complete - import Mathlib.MeasureTheory.Function.LpSpace.Indicator - import Mathlib.Topology.Algebra.Support - --/- --Copyright (c) 2026 Adam Benenson. All rights reserved. --Released under Apache 2.0 license as described in the file LICENSE. --Authors: Adam Benenson ---/ -- - /-! - # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1` - -@@ -55,15 +55,19 @@ section - variable - {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] - --local instance : MeasurableSpace E := borel E --local instance : BorelSpace E := ⟨rfl⟩ --local instance : OpensMeasurableSpace E := by infer_instance -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceH1 : MeasurableSpace E := borel E -+local instance instBorelSpaceH1 : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceH1 : OpensMeasurableSpace E := by infer_instance - - variable (μ : Measure E) [IsFiniteMeasureOnCompacts μ] - --private abbrev L2ℝ : Type _ := ↥(E →₂[μ] ℝ) --private abbrev L2E : Type _ := ↥(E →₂[μ] E) --private abbrev H1Target : Type _ := L2ℝ (μ := μ) × L2E (μ := μ) -+/-- The space of square-integrable real-valued functions. -/ -+abbrev L2ℝ : Type _ := ↥(E →₂[μ] ℝ) -+/-- The space of square-integrable vector-valued functions. -/ -+abbrev L2E : Type _ := ↥(E →₂[μ] E) -+/-- The product space containing a function and its first derivative. -/ -+abbrev H1Target : Type _ := L2ℝ (μ := μ) × L2E (μ := μ) - - /-- `C¹` real-valued functions on `E` with compact support, as a submodule of `E → ℝ`. -/ - def C1c : Submodule ℝ (E → ℝ) where -@@ -78,7 +82,7 @@ def C1c : Submodule ℝ (E → ℝ) where - intro c f hf - refine ⟨hf.1.const_smul c, ?_⟩ - -- `HasCompactSupport` is stable under pointwise scalar multiplication. -- simpa using (HasCompactSupport.smul_left (f := fun _ : E => c) hf.2) -+ exact (HasCompactSupport.smul_left (f := fun _ : E => c) hf.2) - - /-- The pointwise gradient (as an `E`-valued function), via Riesz representation. -/ - noncomputable def grad (f : E → ℝ) : E → E := -@@ -88,21 +92,21 @@ lemma continuous_grad {f : E → ℝ} (hf : ContDiff ℝ 1 f) : Continuous (grad - have hcont : Continuous (fderiv ℝ f) := hf.continuous_fderiv one_ne_zero - have : Continuous fun x => (InnerProductSpace.toDual ℝ E).symm (fderiv ℝ f x) := - (InnerProductSpace.toDual ℝ E).symm.continuous.comp hcont -- simpa [grad] using this -+ exact this - - lemma hasCompactSupport_grad {f : E → ℝ} (hf : HasCompactSupport f) : - HasCompactSupport (grad (E := E) f) := by - -- Outside the support of `f`, `fderiv` is identically `0`, hence so is `grad`. - have hf' : HasCompactSupport (fderiv ℝ f) := hf.fderiv ℝ - -- `grad` is composition with a linear map sending `0` to `0`. -- simpa [grad] using -+ exact - (HasCompactSupport.comp_left (f := fderiv ℝ f) (g := (InnerProductSpace.toDual ℝ E).symm) - hf' (by simp)) - - lemma tsupport_grad_subset (f : E → ℝ) : tsupport (grad (E := E) f) ⊆ tsupport f := by - have hcomp : - tsupport (grad (E := E) f) ⊆ tsupport (fderiv ℝ f) := by -- simpa [grad, Function.comp] using -+ exact - (tsupport_comp_subset - (g := (InnerProductSpace.toDual ℝ E).symm) (hg := by simp) - (f := fderiv ℝ f)) -@@ -165,8 +169,8 @@ private lemma toL2_smul (c : ℝ) (f : ↥(C1c (E := E))) : - /-- Linear map sending `C¹_c` functions to their `L²` classes. -/ - noncomputable def toL2Linear : ↥(C1c (E := E)) →ₗ[ℝ] L2ℝ (μ := μ) where - toFun := toL2 (μ := μ) (E := E) -- map_add' := toL2_add (μ := μ) (E := E) -- map_smul' := toL2_smul (μ := μ) (E := E) -+ map_add' := by exact toL2_add (μ := μ) (E := E) -+ map_smul' := by exact toL2_smul (μ := μ) (E := E) - - private lemma toL2Grad_add (f g : ↥(C1c (E := E))) : - toL2Grad (μ := μ) (E := E) (f + g) = -@@ -226,8 +230,8 @@ private lemma toL2Grad_smul (c : ℝ) (f : ↥(C1c (E := E))) : - /-- Linear map sending `C¹_c` functions to the `L²` class of their gradient. -/ - noncomputable def toL2GradLinear : ↥(C1c (E := E)) →ₗ[ℝ] L2E (μ := μ) where - toFun := toL2Grad (μ := μ) (E := E) -- map_add' := toL2Grad_add (μ := μ) (E := E) -- map_smul' := toL2Grad_smul (μ := μ) (E := E) -+ map_add' := by exact toL2Grad_add (μ := μ) (E := E) -+ map_smul' := by exact toL2Grad_smul (μ := μ) (E := E) - - /-- The graph map `f ↦ (f, ∇f)` into `L² × L²(E)`. -/ - noncomputable def graph : ↥(C1c (E := E)) →ₗ[ℝ] H1Target (μ := μ) := -@@ -243,7 +247,7 @@ theorem isClosed_h1 : IsClosed (h1 (μ := μ) (E := E) : Set (H1Target (μ := μ - exact Submodule.isClosed_topologicalClosure (LinearMap.range (graph (μ := μ) (E := E))) - - /-- `H¹` is complete (a Hilbert space once the ambient `L²` spaces are). -/ --instance instCompleteSpace_h1 : CompleteSpace (↥(h1 (μ := μ) (E := E))) := by -+instance instCompleteSpaceh1 : CompleteSpace (↥(h1 (μ := μ) (E := E))) := by - classical - exact (isClosed_h1 (μ := μ) (E := E)).isComplete.completeSpace_coe - -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Approximation.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Approximation.lean -index 1ae0860..e44c3dc 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Approximation.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Approximation.lean -@@ -1,3 +1,9 @@ -+/- -+Copyright (c) 2026 Adam Benenson. All rights reserved. -+Released under Apache 2.0 license as described in the file LICENSE. -+Authors: Adam Benenson -+-/ -+ - import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation - import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Smoothing - import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap -@@ -10,12 +16,6 @@ import Mathlib.MeasureTheory.Measure.Haar.Unique - import Mathlib.MeasureTheory.Function.L2Space - import Mathlib.Probability.Moments.Variance - --/- --Copyright (c) 2026 Adam Benenson. All rights reserved. --Released under Apache 2.0 license as described in the file LICENSE. --Authors: Adam Benenson ---/ -- - /-! - # `L²` compactness criterion: approximation-by-translation bounds (Euclidean) - -@@ -44,13 +44,14 @@ section Volume - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - --local instance : MeasurableSpace E := borel E --local instance : BorelSpace E := ⟨rfl⟩ --local instance : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceApproximation : MeasurableSpace E := borel E -+local instance instBorelSpaceApproximation : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceApproximation : OpensMeasurableSpace E := by - infer_instance --local instance : MeasurableAdd E := by -+local instance instMeasurableAddApproximation : MeasurableAdd E := by - infer_instance --local instance : MeasurableNeg E := by -+local instance instMeasurableNegApproximation : MeasurableNeg E := by - infer_instance - - variable {K : Set E} (hK : IsCompact K) (hKm : MeasurableSet K) -@@ -81,7 +82,9 @@ lemma kernelMeasure_univ (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) ( - -- Conclude using `∫ ψ = 1`. - simpa [hψint] using (hwd.trans hlin) - --local instance instIsProbabilityMeasure_kernelMeasure -+/-- The kernel measure `kernelMeasure ψ` is a probability measure when `ψ` is a continuous, -+compactly supported, nonnegative density integrating to `1`. -/ -+lemma isProbabilityMeasure_kernelMeasure - (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) - (hψ0 : ∀ x, 0 ≤ ψ x) - (hψint : ∫ x, ψ x ∂(volume : Measure E) = 1) : -@@ -96,7 +99,7 @@ lemma integral_kernelMeasure_eq_integral_smul (hψc : Continuous ψ) (hψ0 : ∀ - (hψc.measurable.ennreal_ofReal : Measurable fun x => ENNReal.ofReal (ψ x)) - have htop : - (MeasureTheory.ae (volume : Measure E)).Eventually -- (fun x => ENNReal.ofReal (ψ x) < ∞) := -+ (fun x => ENNReal.ofReal (ψ x) < (⊤ : ℝ≥0∞)) := - Filter.Eventually.of_forall (fun _ => by simp) - have hwd := - (integral_withDensity_eq_integral_toReal_smul (μ := (volume : Measure E)) -@@ -189,7 +192,7 @@ lemma norm_sq_translateL2_sub_extendByZeroL2_eq_integral_sq (t : E) - MeasureTheory.MeasurePreserving (fun x : E => x - t) - (volume : Measure E) (volume : Measure E) := - MeasureTheory.measurePreserving_sub_right (μ := (volume : Measure E)) t -- simpa [Function.comp] using (hmp.quasiMeasurePreserving.ae_eq_comp hF_ae) -+ exact (hmp.quasiMeasurePreserving.ae_eq_comp hF_ae) - -- TranslateL2 gives `F(x - t)` a.e. - have htrans : - ((translateL2 (μ := (volume : Measure E)) (-t)) F : E → ℝ) =ᵐ[(volume : Measure E)] -@@ -221,7 +224,7 @@ lemma norm_sq_translateL2_sub_extendByZeroL2_eq_integral_sq (t : E) - ∂(volume : Measure E) = - ∫ x, (f (x - t) - f x) ^ 2 ∂(volume : Measure E) := by - refine MeasureTheory.integral_congr_ae ?_ -- simpa using hdiff.pow_const 2 -+ exact hdiff.pow_const 2 - exact h1.trans h2 - simpa [F, f] using hcalc - -@@ -242,7 +245,7 @@ private lemma kernelMeasure_le_smul_volume (hψc : Continuous ψ) (hψcs : HasCo - simpa [Real.norm_eq_abs, abs_of_nonneg (hψ0 x)] using hx' - exact ENNReal.ofReal_le_ofReal hx - -- Unfold `withDensity` and bound the density by the constant `ENNReal.ofReal C`. -- simp [kernelMeasure, MeasureTheory.withDensity_apply, hs] -+ simp only [kernelMeasure, MeasureTheory.withDensity_apply, hs] - have hle : - (∫⁻ x in s, ENNReal.ofReal (ψ x) ∂(volume : Measure E)) ≤ - ∫⁻ x in s, ENNReal.ofReal C ∂(volume : Measure E) := by -@@ -262,9 +265,9 @@ lemma smoothFun_sub_extendByZeroFun_sq_le_integral_sq - ∂kernelMeasure (E := E) ψ := by - classical - let μ : Measure E := kernelMeasure (E := E) ψ -- haveI : MeasureTheory.IsProbabilityMeasure μ := -- instIsProbabilityMeasure_kernelMeasure (E := E) (ψ := ψ) hψc hψcs hψ0 hψint -- haveI : MeasureTheory.IsFiniteMeasure μ := by infer_instance -+ have : MeasureTheory.IsProbabilityMeasure μ := -+ isProbabilityMeasure_kernelMeasure (E := E) (ψ := ψ) hψc hψcs hψ0 hψint -+ have : MeasureTheory.IsFiniteMeasure μ := by infer_instance - rcases kernelMeasure_le_smul_volume (E := E) (ψ := ψ) hψc hψcs hψ0 with ⟨c, hc_top, hμle⟩ - let f : E → ℝ := extendByZeroFun (E := E) (K := K) u - have hf_vol : MeasureTheory.MemLp f (2 : ℝ≥0∞) (volume : Measure E) := by -@@ -288,7 +291,11 @@ lemma smoothFun_sub_extendByZeroFun_sq_le_integral_sq - (volume : Measure E) (volume : Measure E) := - MeasureTheory.measurePreserving_add_right - (μ := (volume : Measure E)) x -- simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hadd.comp hneg -+ have hcomp : ((fun y : E => y + x) ∘ fun t : E => -t) = fun t : E => x - t := by -+ funext t -+ simp [sub_eq_add_neg, add_comm] -+ have := hadd.comp hneg -+ rwa [hcomp] at this - have hf_shift_vol : - MeasureTheory.MemLp (fun t : E => f (x - t)) - (2 : ℝ≥0∞) (volume : Measure E) := -@@ -334,10 +341,10 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex - ∂kernelMeasure (E := E) ψ := by - classical - let μ : Measure E := kernelMeasure (E := E) ψ -- haveI : MeasureTheory.IsProbabilityMeasure μ := -- instIsProbabilityMeasure_kernelMeasure (E := E) (ψ := ψ) hψc hψcs hψ0 hψint -- haveI : MeasureTheory.IsFiniteMeasure μ := by infer_instance -- haveI : MeasureTheory.SFinite μ := by infer_instance -+ have : MeasureTheory.IsProbabilityMeasure μ := -+ isProbabilityMeasure_kernelMeasure (E := E) (ψ := ψ) hψc hψcs hψ0 hψint -+ have : MeasureTheory.IsFiniteMeasure μ := by infer_instance -+ have : MeasureTheory.SFinite μ := by infer_instance - let F : (E →₂[(volume : Measure E)] ℝ) := extendByZeroL2 (E := E) (K := K) hKm u - let f : E → ℝ := extendByZeroFun (E := E) (K := K) u - let S : (E →₂[(volume : Measure E)] ℝ) := smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u -@@ -361,7 +368,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex - (∫ x, ((S - F) x) ^ 2 ∂(volume : Measure E)) = - ∫ x, (smoothFun (E := E) (K := K) ψ u x - f x) ^ 2 ∂(volume : Measure E) := by - refine MeasureTheory.integral_congr_ae ?_ -- simpa using hSF_ae.pow_const 2 -+ exact hSF_ae.pow_const 2 - exact h1.trans h2 - have hLHS_int : - MeasureTheory.Integrable (fun x : E => (smoothFun (E := E) (K := K) ψ u x - f x) ^ 2) -@@ -414,7 +421,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex - MeasureTheory.Integrable (fun z : E × E => (f (z.1 - z.2)) ^ 2) - ((volume : Measure E).prod μ) := by - have := (hsub.integrable_comp hf_fst_sq_prod.aestronglyMeasurable).2 hf_fst_sq_prod -- simpa [Function.comp] using this -+ exact this - have hdom : - MeasureTheory.Integrable (fun z : E × E => (2 : ℝ) * ((f (z.1 - z.2)) ^ 2 + (f z.1) ^ 2)) - ((volume : Measure E).prod μ) := by -@@ -426,7 +433,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex - MeasureTheory.AEStronglyMeasurable f - (Measure.map Prod.fst - ((volume : Measure E).prod μ)) := by -- simpa [Measure.map_fst_prod] using hf_mem.1 -+ simpa [Measure.map_fst_prod] using hf_mem.aestronglyMeasurable - exact MeasureTheory.AEStronglyMeasurable.comp_measurable - (μ := (volume : Measure E).prod μ) (f := Prod.fst) - (g := f) hf_map measurable_fst -@@ -436,7 +443,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex - ((volume : Measure E).prod μ) := by - have := MeasureTheory.AEStronglyMeasurable.comp_measurePreserving (g := fun z : E × E => f z.1) - hf_fst_aesm hsub -- simpa [Function.comp] using this -+ exact this - have h_aesm : - MeasureTheory.AEStronglyMeasurable h ((volume : Measure E).prod μ) := by - -- Build up AE-strong measurability from the two components. -@@ -444,7 +451,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex - MeasureTheory.AEStronglyMeasurable (fun z : E × E => f (z.1 - z.2) - f z.1) - ((volume : Measure E).prod μ) := - hf_shift_aesm.sub hf_fst_aesm -- simpa [h] using (hsub'.pow 2) -+ exact (hsub'.pow 2) - have hint_h : MeasureTheory.Integrable h ((volume : Measure E).prod μ) := by - refine MeasureTheory.Integrable.mono (μ := (volume : Measure E).prod μ) hdom h_aesm ?_ - refine Filter.Eventually.of_forall ?_ -@@ -507,7 +514,6 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex - -- Restore the original statement. - simpa [S, F, μ] using hmain - -- - end Volume - - end -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/ArzelaAscoli.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/ArzelaAscoli.lean -index 37fe123..ff15e73 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/ArzelaAscoli.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/ArzelaAscoli.lean -@@ -1,15 +1,15 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Compactness --import Mathlib.Analysis.Normed.Group.Bounded --import Mathlib.Topology.ContinuousMap.Bounded.ArzelaAscoli --import Mathlib.MeasureTheory.Function.L2Space --import Mathlib.MeasureTheory.Integral.Bochner.Set -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Compactness -+import Mathlib.Analysis.Normed.Group.Bounded -+import Mathlib.Topology.ContinuousMap.Bounded.ArzelaAscoli -+import Mathlib.MeasureTheory.Function.L2Space -+import Mathlib.MeasureTheory.Integral.Bochner.Set -+ - /-! - # `L²` compactness criterion: Arzelà–Ascoli for the smoothing operator (Euclidean) - -@@ -42,13 +42,14 @@ section Volume - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - --local instance instMeasurableSpaceE_L2CompactnessArzelaAscoli : MeasurableSpace E := borel E --local instance instBorelSpaceE_L2CompactnessArzelaAscoli : BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_L2CompactnessArzelaAscoli : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceEL2CompactnessArzelaAscoli : MeasurableSpace E := borel E -+local instance instBorelSpaceEL2CompactnessArzelaAscoli : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceEL2CompactnessArzelaAscoli : OpensMeasurableSpace E := by - infer_instance --local instance instMeasurableAddE_L2CompactnessArzelaAscoli : MeasurableAdd E := by -+local instance instMeasurableAddEL2CompactnessArzelaAscoli : MeasurableAdd E := by - infer_instance --local instance instMeasurableNegE_L2CompactnessArzelaAscoli : MeasurableNeg E := by -+local instance instMeasurableNegEL2CompactnessArzelaAscoli : MeasurableNeg E := by - infer_instance - - variable {K : Set E} {ψ : E → ℝ} -@@ -110,8 +111,309 @@ private lemma exists_norm_ψ_bound_on_diffSet (hK : IsCompact K) (hψc : Continu - exact ⟨hx, ht⟩ - exact hne ⟨(x : E) - t, this⟩ - -+private lemma smoothFun_image_mem_closedBall (hK : IsCompact K) -+ (hKm : MeasurableSet K) (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) {R : ℝ} -+ (hRpos : 0 < R) (Cψ : ℝ) (hCψ_nonneg : 0 ≤ Cψ) -+ (hψ_bound : ∀ x : ↥(Kψ (K := K) (ψ := ψ)), ∀ t : E, t ∈ K → ‖ψ ((x : E) - t)‖ ≤ Cψ) : -+ let mK : ℝ := -+ (MeasureTheory.measureUnivNNReal (volume.restrict K)) ^ ((2 : ℝ≥0∞).toReal⁻¹) -+ ∀ (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) (x : ↥(Kψ (K := K) (ψ := ψ))), -+ f ∈ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs '' -+ Metric.closedBall (0 : _) R) → -+ f x ∈ Metric.closedBall (0 : ℝ) (R * (mK * Cψ)) := by -+ intro mK -+ classical -+ have hR : 0 ≤ R := hRpos.le -+ have hμK : (volume : Measure E) K < (⊤ : ℝ≥0∞) := hK.measure_lt_top (μ := (volume : Measure E)) -+ have : Fact ((volume : Measure E) K < (⊤ : ℝ≥0∞)) := ⟨hμK⟩ -+ have : IsFiniteMeasure ((volume : Measure E).restrict K) := by infer_instance -+ let μ : Measure E := (volume : Measure E).restrict K -+ have hmK : 0 ≤ mK := by -+ have : 0 ≤ (MeasureTheory.measureUnivNNReal (volume.restrict K)) := by simp -+ exact Real.rpow_nonneg this _ -+ intro f x hfA -+ rcases hfA with ⟨u, hu_ball, rfl⟩ -+ have hu_norm : ‖u‖ ≤ R := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hu_ball -+ -- Build the `L²(K)` kernel element. -+ have hker : -+ MemLp (fun t : E => ψ ((x : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by -+ refine MemLp.of_bound (μ := (volume.restrict K)) -+ (hf := (hψc.aestronglyMeasurable.comp_measurable -+ (measurable_const.sub measurable_id))) Cψ ?_ -+ filter_upwards -+ [MeasureTheory.ae_restrict_mem -+ (μ := (volume : Measure E)) hKm] with t ht -+ exact hψ_bound x t ht -+ let kx : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := -+ hker.toLp (fun t : E => ψ ((x : E) - t)) -+ have hkx_norm : ‖kx‖ ≤ mK * Cψ := by -+ have h_ae : -+ ∀ᵐ t ∂(volume.restrict K), ‖(fun t : E => ψ ((x : E) - t)) t‖ ≤ Cψ := by -+ filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm] with t ht -+ exact hψ_bound x t ht -+ have := (MeasureTheory.Lp.norm_le_of_ae_bound -+ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -+ (f := kx) (hC := hCψ_nonneg) (by -+ -- transport the bound through the `toLp` representative -+ filter_upwards [h_ae, -+ MeasureTheory.MemLp.coeFn_toLp -+ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -+ (f := fun t : E => ψ ((x : E) - t)) -+ hker] with t ht hrep -+ simpa [kx, hrep] using ht)) -+ simpa [mK] using this -+ -- Express the smoothing value as an `L²` inner product, then apply Cauchy–Schwarz. -+ have hsmooth : -+ smoothFun (E := E) (K := K) ψ u (x : E) = -+ ∫ t, u t * kx t ∂(volume.restrict K) := by -+ have h_ae : -+ (fun t : E => u t * kx t) =ᵐ[volume.restrict K] fun t : E => u t * ψ ((x : E) - t) := by -+ filter_upwards [MeasureTheory.MemLp.coeFn_toLp -+ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -+ (f := fun t : E => ψ ((x : E) - t)) -+ hker] with t ht -+ simp [kx, ht] -+ -- rewrite `smoothFun` as an integral on `volume.restrict K` -+ rw [smoothFun_eq_integral_restrict -+ (E := E) (K := K) (ψ := ψ) (hKm := hKm) u (x : E)] -+ exact (MeasureTheory.integral_congr_ae h_ae.symm) -+ have hsmooth' : -+ smoothFun (E := E) (K := K) ψ u (x : E) = -+ ∫ t, kx t * u t ∂(volume.restrict K) := by -+ simp [hsmooth, mul_comm] -+ have hinner : -+ smoothFun (E := E) (K := K) ψ u (x : E) = -+ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) kx := by -+ erw [MeasureTheory.L2.inner_def]; exact hsmooth' -+ have habs : -+ |smoothFun (E := E) (K := K) ψ u (x : E)| ≤ ‖u‖ * ‖kx‖ := by -+ simpa [hinner] using -+ (abs_real_inner_le_norm (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) kx) -+ have habs' : |smoothFun (E := E) (K := K) ψ u (x : E)| ≤ R * (mK * Cψ) := by -+ calc -+ |smoothFun (E := E) (K := K) ψ u (x : E)| -+ ≤ ‖u‖ * ‖kx‖ := habs -+ _ ≤ R * (mK * Cψ) := by -+ exact mul_le_mul hu_norm hkx_norm (norm_nonneg _) hR -+ have : dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) 0 ≤ R * (mK * Cψ) := by -+ simpa [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x, -+ dist_eq_norm, Real.norm_eq_abs] using habs' -+ simpa [Metric.mem_closedBall, dist_eq_norm] using this -+ - /-- Arzelà--Ascoli: smoothing maps `L²(K)` bounded sets into a precompact set - in `BCF(K + tsupport ψ)`. -/ -+private lemma uniformEquicontinuous_smoothBCF_closedBall (hK : IsCompact K) -+ (hKm : MeasurableSet K) (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) {R : ℝ} -+ (hRpos : 0 < R) (Cψ : ℝ) (hCψ_nonneg : 0 ≤ Cψ) -+ (hψ_bound : ∀ x : ↥(Kψ (K := K) (ψ := ψ)), ∀ t : E, t ∈ K → ‖ψ ((x : E) - t)‖ ≤ Cψ) : -+ let A : Set (BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) := -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs '' Metric.closedBall (0 : _) R -+ UniformEquicontinuous ((↑) : A → ↥(Kψ (K := K) (ψ := ψ)) → ℝ) := by -+ intro A -+ classical -+ have hR : 0 ≤ R := hRpos.le -+ have hR0 : R ≠ 0 := ne_of_gt hRpos -+ have hμK : (volume : Measure E) K < (⊤ : ℝ≥0∞) := hK.measure_lt_top (μ := (volume : Measure E)) -+ have : Fact ((volume : Measure E) K < (⊤ : ℝ≥0∞)) := ⟨hμK⟩ -+ have : IsFiniteMeasure ((volume : Measure E).restrict K) := by infer_instance -+ let μ : Measure E := (volume : Measure E).restrict K -+ let mK : ℝ := -+ (MeasureTheory.measureUnivNNReal (volume.restrict K)) ^ ((2 : ℝ≥0∞).toReal⁻¹) -+ have hmK : 0 ≤ mK := Real.rpow_nonneg (by simp) _ -+ let s : Set ℝ := Metric.closedBall (0 : ℝ) (R * (mK * Cψ)) -+ have in_s := -+ smoothFun_image_mem_closedBall (K := K) (ψ := ψ) hK hKm hψc hψcs -+ (R := R) hRpos Cψ hCψ_nonneg hψ_bound -+ rw [Metric.uniformEquicontinuous_iff] -+ intro ε hε -+ -- Handle the zero-measure case separately (then `mK = 0` and everything is constant). -+ by_cases hmK0 : mK = 0 -+ · refine ⟨1, by norm_num, ?_⟩ -+ intro x y _ f -+ -- With `mK = 0`, the range bound forces all values to be `0`. -+ set F : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ := -+ (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) with hF -+ have hzero : ∀ z, F z = 0 := by -+ intro z -+ have hmem : F z ∈ s := in_s (f := F) z f.property -+ have hle : dist (F z) 0 ≤ 0 := by -+ have : dist (F z) 0 ≤ R * (mK * Cψ) := by simpa [s, Metric.mem_closedBall] using hmem -+ simpa [hmK0] using this -+ exact dist_eq_zero.1 (le_antisymm hle dist_nonneg) -+ simpa [hzero x, hzero y] using hε -+ · have hRmK_ne : R * mK ≠ 0 := mul_ne_zero hR0 hmK0 -+ let ε2 : ℝ := ε / 2 -+ have hε2pos : 0 < ε2 := by -+ simpa [ε2] using half_pos hε -+ let ε' : ℝ := ε2 / (R * mK) -+ have hε'pos : 0 < ε' := -+ div_pos hε2pos (mul_pos hRpos (lt_of_le_of_ne hmK (Ne.symm hmK0))) -+ have hε'lt : R * mK * ε' = ε2 := by -+ dsimp [ε'] -+ field_simp [hRmK_ne, mul_assoc, mul_left_comm, mul_comm] -+ -- Use uniform continuity of `ψ` to get `deltaLoss`. -+ have hUC : UniformContinuous ψ := uniformContinuous_ψ (E := E) (ψ := ψ) hψc hψcs -+ rcases (Metric.uniformContinuous_iff.1 hUC) ε' hε'pos with ⟨deltaLoss, hδpos, hδ⟩ -+ refine ⟨deltaLoss, hδpos, ?_⟩ -+ intro x y hxy f -+ -- Work with the `smoothBCF` representative of `f`. -+ rcases f.property with ⟨u, hu_ball, hu_eq⟩ -+ have hu_eq' : -+ (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) = -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u := by -+ simpa using hu_eq.symm -+ have hu_norm : ‖u‖ ≤ R := by -+ simpa [Metric.mem_closedBall, dist_eq_norm] using hu_ball -+ -- Kernel elements at `x` and `y`. -+ have hkerx : -+ MemLp (fun t : E => ψ ((x : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by -+ refine MemLp.of_bound (μ := (volume.restrict K)) -+ (hf := (hψc.aestronglyMeasurable.comp_measurable -+ (measurable_const.sub measurable_id))) Cψ ?_ -+ filter_upwards -+ [MeasureTheory.ae_restrict_mem -+ (μ := (volume : Measure E)) hKm] with t ht -+ exact hψ_bound x t ht -+ have hkery : -+ MemLp (fun t : E => ψ ((y : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by -+ refine MemLp.of_bound (μ := (volume.restrict K)) -+ (hf := (hψc.aestronglyMeasurable.comp_measurable -+ (measurable_const.sub measurable_id))) Cψ ?_ -+ filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm] with t ht -+ exact hψ_bound y t ht -+ let kx : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := -+ hkerx.toLp (fun t : E => ψ ((x : E) - t)) -+ let ky : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := -+ hkery.toLp (fun t : E => ψ ((y : E) - t)) -+ -- AE bound on `‖kx - ky‖` by `ε'`. -+ have h_ae : -+ ∀ᵐ t ∂(volume.restrict K), ‖(kx - ky) t‖ ≤ ε' := by -+ filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm, -+ MeasureTheory.MemLp.coeFn_toLp (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -+ (f := fun t : E => ψ ((x : E) - t)) hkerx, -+ MeasureTheory.MemLp.coeFn_toLp (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -+ (f := fun t : E => ψ ((y : E) - t)) hkery, -+ (MeasureTheory.Lp.coeFn_sub (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) kx ky)] with -+ t ht hx_t hy_t hsub -+ have hxy' : dist ((x : E) - t) ((y : E) - t) < deltaLoss := by -+ rw [dist_sub_right] -+ exact hxy -+ have hψxy : dist (ψ ((x : E) - t)) (ψ ((y : E) - t)) < ε' := -+ hδ (a := (x : E) - t) (b := (y : E) - t) hxy' -+ have : ‖ψ ((x : E) - t) - ψ ((y : E) - t)‖ ≤ ε' := by -+ simpa [dist_eq_norm, sub_eq_add_neg] using le_of_lt hψxy -+ have hx' : kx t = ψ ((x : E) - t) := by simpa [kx] using hx_t -+ have hy' : ky t = ψ ((y : E) - t) := by simpa [ky] using hy_t -+ have hnorm : ‖kx t - ky t‖ ≤ ε' := by -+ simpa [hx', hy'] using this -+ have hsub' : (kx - ky) t = kx t - ky t := by -+ simpa [Pi.sub_apply] using hsub -+ simpa [hsub'.symm] using hnorm -+ have hkdiff : ‖kx - ky‖ ≤ mK * ε' := by -+ have := (MeasureTheory.Lp.norm_le_of_ae_bound (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -+ (f := (kx - ky : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ)) (hC := le_of_lt hε'pos) h_ae) -+ simpa [mK, mul_comm, mul_left_comm, mul_assoc] using this -+ -- Bound the difference of values using Cauchy–Schwarz. -+ have hdist : -+ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -+ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) -+ ≤ ‖u‖ * ‖kx - ky‖ := by -+ -- Express each value as an inner product. -+ have hx_val : -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x = -+ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) kx := by -+ have hsmooth : -+ smoothFun (E := E) (K := K) ψ u (x : E) = -+ ∫ t, u t * kx t ∂(volume.restrict K) := by -+ have h_ae' : -+ (fun t : E => u t * kx t) =ᵐ[volume.restrict K] -+ fun t : E => u t * ψ ((x : E) - t) := by -+ filter_upwards [MeasureTheory.MemLp.coeFn_toLp -+ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -+ (f := fun t : E => ψ ((x : E) - t)) -+ hkerx] with t ht -+ simp [kx, ht] -+ rw [smoothFun_eq_integral_restrict -+ (E := E) (K := K) (ψ := ψ) (hKm := hKm) -+ u (x : E)] -+ exact (MeasureTheory.integral_congr_ae h_ae'.symm) -+ have hsmooth' : -+ smoothFun (E := E) (K := K) ψ u (x : E) = -+ ∫ t, kx t * u t ∂(volume.restrict K) := by -+ simp [hsmooth, mul_comm] -+ erw [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x, -+ MeasureTheory.L2.inner_def]; exact hsmooth' -+ have hy_val : -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y = -+ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) ky := by -+ have hsmooth : -+ smoothFun (E := E) (K := K) ψ u (y : E) = -+ ∫ t, u t * ky t ∂(volume.restrict K) := by -+ have h_ae' : -+ (fun t : E => u t * ky t) =ᵐ[volume.restrict K] -+ fun t : E => u t * ψ ((y : E) - t) := by -+ filter_upwards [MeasureTheory.MemLp.coeFn_toLp -+ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -+ (f := fun t : E => ψ ((y : E) - t)) -+ hkery] with t ht -+ simp [ky, ht] -+ rw [smoothFun_eq_integral_restrict -+ (E := E) (K := K) (ψ := ψ) (hKm := hKm) -+ u (y : E)] -+ exact (MeasureTheory.integral_congr_ae h_ae'.symm) -+ have hsmooth' : -+ smoothFun (E := E) (K := K) ψ u (y : E) = -+ ∫ t, ky t * u t ∂(volume.restrict K) := by -+ simp [hsmooth, mul_comm] -+ erw [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y, -+ MeasureTheory.L2.inner_def]; exact hsmooth' -+ have : -+ ‖smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x - -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y‖ ≤ -+ ‖u‖ * ‖kx - ky‖ := by -+ have : -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x - -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y = -+ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky) := by -+ simp [hx_val, hy_val, inner_sub_right] -+ have this' : -+ smoothFun (E := E) (K := K) ψ u (x : E) - smoothFun (E := E) (K := K) ψ u (y : E) = -+ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky) := by -+ simpa [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs] using this -+ have hCS := -+ (abs_real_inner_le_norm (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky)) -+ simpa [this', dist_eq_norm, Real.norm_eq_abs] using hCS -+ simpa [dist_eq_norm] using this -+ have hle : -+ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -+ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) -+ ≤ R * (mK * ε') := by -+ calc -+ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -+ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) -+ ≤ ‖u‖ * ‖kx - ky‖ := hdist -+ _ ≤ ‖u‖ * (mK * ε') := by -+ exact mul_le_mul_of_nonneg_left hkdiff (norm_nonneg _) -+ _ ≤ R * (mK * ε') := by -+ have hmKε' : 0 ≤ mK * ε' := mul_nonneg hmK (le_of_lt hε'pos) -+ exact mul_le_mul_of_nonneg_right hu_norm hmKε' -+ have hRmkε' : R * (mK * ε') = ε2 := by -+ have : R * mK * ε' = ε2 := by -+ simpa [ε', mul_assoc] using hε'lt -+ simpa [mul_assoc] using this -+ have hle' : -+ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -+ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) ≤ ε2 := by -+ simpa [hRmkε'] using hle -+ have hε2lt : ε2 < ε := by -+ simpa [ε2] using half_lt_self hε -+ have : -+ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -+ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) < ε := -+ lt_of_le_of_lt hle' hε2lt -+ simpa [hu_eq'] using this -+ - theorem smoothBCF_image_closedBall_isCompact (hK : IsCompact K) (hKm : MeasurableSet K) - (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) {R : ℝ} (hR : 0 ≤ R) : - IsCompact -@@ -130,15 +432,15 @@ theorem smoothBCF_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurabl - simp [hball] - · have hRpos : 0 < R := lt_of_le_of_ne hR (Ne.symm hR0) - -- Compactness of the codomain. -- letI : CompactSpace ↥(Kψ (K := K) (ψ := ψ)) := -+ let : CompactSpace ↥(Kψ (K := K) (ψ := ψ)) := - isCompact_iff_compactSpace.1 (isCompact_Kψ (K := K) (ψ := ψ) hK hψcs) - let A : - Set (BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) := - smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs '' Metric.closedBall (0 : _) R - -- `volume.restrict K` is finite since `K` is compact. -- have hμK : (volume : Measure E) K < ∞ := hK.measure_lt_top (μ := (volume : Measure E)) -- letI : Fact ((volume : Measure E) K < ∞) := ⟨hμK⟩ -- haveI : IsFiniteMeasure (volume.restrict K) := by -+ have hμK : (volume : Measure E) K < (⊤ : ℝ≥0∞) := hK.measure_lt_top (μ := (volume : Measure E)) -+ let : Fact ((volume : Measure E) K < (⊤ : ℝ≥0∞)) := ⟨hμK⟩ -+ have : IsFiniteMeasure (volume.restrict K) := by - infer_instance - let μ : Measure E := (volume : Measure E).restrict K - let mK : ℝ := -@@ -227,211 +529,10 @@ theorem smoothBCF_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurabl - dist_eq_norm, Real.norm_eq_abs] using habs' - simpa [s, Metric.mem_closedBall, dist_eq_norm] using this - -- Equicontinuity for `A`. -- have H' : UniformEquicontinuous ((↑) : A → ↥(Kψ (K := K) (ψ := ψ)) → ℝ) := by -- rw [Metric.uniformEquicontinuous_iff] -- intro ε hε -- -- Handle the zero-measure case separately (then `mK = 0` and everything is constant). -- by_cases hmK0 : mK = 0 -- · refine ⟨1, by norm_num, ?_⟩ -- intro x y _ f -- -- With `mK = 0`, the range bound forces all values to be `0`. -- have hx0 : dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x) 0 ≤ -- R * (mK * Cψ) := by -- have : -- (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x ∈ s := -- in_s (f := (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ)) x f.property -- simpa [s, Metric.mem_closedBall] using this -- have hy0 : dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y) 0 ≤ -- R * (mK * Cψ) := by -- have : -- (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y ∈ s := -- in_s (f := (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ)) y f.property -- simpa [s, Metric.mem_closedBall] using this -- have hx0' : -- dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x) 0 = 0 := by -- have : dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x) 0 ≤ 0 := by -- simpa [hmK0] using hx0 -- exact le_antisymm this dist_nonneg -- have hy0' : -- dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y) 0 = 0 := by -- have : dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y) 0 ≤ 0 := by -- simpa [hmK0] using hy0 -- exact le_antisymm this dist_nonneg -- have hx : (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x = 0 := -- dist_eq_zero.1 hx0' -- have hy : (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y = 0 := -- dist_eq_zero.1 hy0' -- simpa [hx, hy] using hε -- · have hRmK_ne : R * mK ≠ 0 := mul_ne_zero hR0 hmK0 -- let ε2 : ℝ := ε / 2 -- have hε2pos : 0 < ε2 := by -- simpa [ε2] using half_pos hε -- let ε' : ℝ := ε2 / (R * mK) -- have hε'pos : 0 < ε' := -- div_pos hε2pos (mul_pos hRpos (lt_of_le_of_ne hmK (Ne.symm hmK0))) -- have hε'lt : R * mK * ε' = ε2 := by -- dsimp [ε'] -- field_simp [hRmK_ne, mul_assoc, mul_left_comm, mul_comm] -- -- Use uniform continuity of `ψ` to get `δ`. -- have hUC : UniformContinuous ψ := uniformContinuous_ψ (E := E) (ψ := ψ) hψc hψcs -- rcases (Metric.uniformContinuous_iff.1 hUC) ε' hε'pos with ⟨δ, hδpos, hδ⟩ -- refine ⟨δ, hδpos, ?_⟩ -- intro x y hxy f -- -- Work with the `smoothBCF` representative of `f`. -- rcases f.property with ⟨u, hu_ball, hu_eq⟩ -- have hu_eq' : -- (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) = -- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u := by -- simpa using hu_eq.symm -- have hu_norm : ‖u‖ ≤ R := by -- simpa [Metric.mem_closedBall, dist_eq_norm] using hu_ball -- -- Kernel elements at `x` and `y`. -- have hkerx : -- MemLp (fun t : E => ψ ((x : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by -- refine MemLp.of_bound (μ := (volume.restrict K)) -- (hf := (hψc.aestronglyMeasurable.comp_measurable -- (measurable_const.sub measurable_id))) Cψ ?_ -- filter_upwards -- [MeasureTheory.ae_restrict_mem -- (μ := (volume : Measure E)) hKm] with t ht -- exact hψ_bound x t ht -- have hkery : -- MemLp (fun t : E => ψ ((y : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by -- refine MemLp.of_bound (μ := (volume.restrict K)) -- (hf := (hψc.aestronglyMeasurable.comp_measurable -- (measurable_const.sub measurable_id))) Cψ ?_ -- filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm] with t ht -- exact hψ_bound y t ht -- let kx : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := -- hkerx.toLp (fun t : E => ψ ((x : E) - t)) -- let ky : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := -- hkery.toLp (fun t : E => ψ ((y : E) - t)) -- -- AE bound on `‖kx - ky‖` by `ε'`. -- have h_ae : -- ∀ᵐ t ∂(volume.restrict K), ‖(kx - ky) t‖ ≤ ε' := by -- filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm, -- MeasureTheory.MemLp.coeFn_toLp (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -- (f := fun t : E => ψ ((x : E) - t)) hkerx, -- MeasureTheory.MemLp.coeFn_toLp (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -- (f := fun t : E => ψ ((y : E) - t)) hkery, -- (MeasureTheory.Lp.coeFn_sub (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) kx ky)] with -- t ht hx_t hy_t hsub -- have hxy' : dist ((x : E) - t) ((y : E) - t) < δ := by -- simpa [sub_eq_add_neg, add_assoc] using hxy -- have hψxy : dist (ψ ((x : E) - t)) (ψ ((y : E) - t)) < ε' := -- hδ (a := (x : E) - t) (b := (y : E) - t) hxy' -- have : ‖ψ ((x : E) - t) - ψ ((y : E) - t)‖ ≤ ε' := by -- simpa [dist_eq_norm, sub_eq_add_neg] using le_of_lt hψxy -- have hx' : kx t = ψ ((x : E) - t) := by simpa [kx] using hx_t -- have hy' : ky t = ψ ((y : E) - t) := by simpa [ky] using hy_t -- have hnorm : ‖kx t - ky t‖ ≤ ε' := by -- simpa [hx', hy'] using this -- have hsub' : (kx - ky) t = kx t - ky t := by -- simpa [Pi.sub_apply] using hsub -- simpa [hsub'.symm] using hnorm -- have hkdiff : ‖kx - ky‖ ≤ mK * ε' := by -- have := (MeasureTheory.Lp.norm_le_of_ae_bound (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -- (f := (kx - ky : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ)) (hC := le_of_lt hε'pos) h_ae) -- simpa [mK, mul_comm, mul_left_comm, mul_assoc] using this -- -- Bound the difference of values using Cauchy–Schwarz. -- have hdist : -- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) -- ≤ ‖u‖ * ‖kx - ky‖ := by -- -- Express each value as an inner product. -- have hx_val : -- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x = -- inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) kx := by -- have hsmooth : -- smoothFun (E := E) (K := K) ψ u (x : E) = -- ∫ t, u t * kx t ∂(volume.restrict K) := by -- have h_ae' : -- (fun t : E => u t * kx t) =ᵐ[volume.restrict K] -- fun t : E => u t * ψ ((x : E) - t) := by -- filter_upwards [MeasureTheory.MemLp.coeFn_toLp -- (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -- (f := fun t : E => ψ ((x : E) - t)) -- hkerx] with t ht -- simp [kx, ht] -- rw [smoothFun_eq_integral_restrict -- (E := E) (K := K) (ψ := ψ) (hKm := hKm) -- u (x : E)] -- exact (MeasureTheory.integral_congr_ae h_ae'.symm) -- have hsmooth' : -- smoothFun (E := E) (K := K) ψ u (x : E) = -- ∫ t, kx t * u t ∂(volume.restrict K) := by -- simp [hsmooth, mul_comm] -- erw [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x, -- MeasureTheory.L2.inner_def]; exact hsmooth' -- have hy_val : -- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y = -- inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) ky := by -- have hsmooth : -- smoothFun (E := E) (K := K) ψ u (y : E) = -- ∫ t, u t * ky t ∂(volume.restrict K) := by -- have h_ae' : -- (fun t : E => u t * ky t) =ᵐ[volume.restrict K] -- fun t : E => u t * ψ ((y : E) - t) := by -- filter_upwards [MeasureTheory.MemLp.coeFn_toLp -- (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) -- (f := fun t : E => ψ ((y : E) - t)) -- hkery] with t ht -- simp [ky, ht] -- rw [smoothFun_eq_integral_restrict -- (E := E) (K := K) (ψ := ψ) (hKm := hKm) -- u (y : E)] -- exact (MeasureTheory.integral_congr_ae h_ae'.symm) -- have hsmooth' : -- smoothFun (E := E) (K := K) ψ u (y : E) = -- ∫ t, ky t * u t ∂(volume.restrict K) := by -- simp [hsmooth, mul_comm] -- erw [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y, -- MeasureTheory.L2.inner_def]; exact hsmooth' -- have : -- ‖smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x - -- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y‖ ≤ -- ‖u‖ * ‖kx - ky‖ := by -- have : -- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x - -- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y = -- inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky) := by -- simp [hx_val, hy_val, inner_sub_right] -- have this' : -- smoothFun (E := E) (K := K) ψ u (x : E) - smoothFun (E := E) (K := K) ψ u (y : E) = -- inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky) := by -- simpa [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs] using this -- have hCS := -- (abs_real_inner_le_norm (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky)) -- simpa [this', dist_eq_norm, Real.norm_eq_abs] using hCS -- simpa [dist_eq_norm] using this -- have hle : -- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) -- ≤ R * (mK * ε') := by -- calc -- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) -- ≤ ‖u‖ * ‖kx - ky‖ := hdist -- _ ≤ ‖u‖ * (mK * ε') := by -- exact mul_le_mul_of_nonneg_left hkdiff (norm_nonneg _) -- _ ≤ R * (mK * ε') := by -- have hmKε' : 0 ≤ mK * ε' := mul_nonneg hmK (le_of_lt hε'pos) -- exact mul_le_mul_of_nonneg_right hu_norm hmKε' -- have hRmkε' : R * (mK * ε') = ε2 := by -- have : R * mK * ε' = ε2 := by -- simpa [ε', mul_assoc] using hε'lt -- simpa [mul_assoc] using this -- have hle' : -- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) ≤ ε2 := by -- simpa [hRmkε'] using hle -- have hε2lt : ε2 < ε := by -- simpa [ε2] using half_lt_self hε -- have : -- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) -- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) < ε := -- lt_of_le_of_lt hle' hε2lt -- simpa [hu_eq'] using this -+ have H' : -+ UniformEquicontinuous ((↑) : A → ↥(Kψ (K := K) (ψ := ψ)) → ℝ) := -+ uniformEquicontinuous_smoothBCF_closedBall (K := K) (ψ := ψ) hK hKm hψc hψcs -+ (R := R) hRpos Cψ hCψ_nonneg hψ_bound - have H : Equicontinuous ((↑) : A → ↥(Kψ (K := K) (ψ := ψ)) → ℝ) := H'.equicontinuous - -- Apply Arzelà–Ascoli. - simpa [A, s] using -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Compactness.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Compactness.lean -index 00cba3a..70360de 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Compactness.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Compactness.lean -@@ -1,15 +1,15 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Smoothing --import Mathlib.MeasureTheory.Function.LpSeminorm.CompareExp --import Mathlib.MeasureTheory.Measure.Typeclasses.Finite --import Mathlib.Topology.Algebra.Monoid --import Mathlib.Topology.UniformSpace.HeineCantor -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Smoothing -+import Mathlib.MeasureTheory.Function.LpSeminorm.CompareExp -+import Mathlib.MeasureTheory.Measure.Typeclasses.Finite -+import Mathlib.Topology.Algebra.Monoid -+import Mathlib.Topology.UniformSpace.HeineCantor -+ - /-! - # `L²` compactness criterion: compact smoothing operator (Euclidean) - -@@ -44,13 +44,14 @@ section Volume - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - --local instance instMeasurableSpaceE_L2CompactnessCompactness : MeasurableSpace E := borel E --local instance instBorelSpaceE_L2CompactnessCompactness : BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_L2CompactnessCompactness : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceEL2CompactnessCompactness : MeasurableSpace E := borel E -+local instance instBorelSpaceEL2CompactnessCompactness : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceEL2CompactnessCompactness : OpensMeasurableSpace E := by - infer_instance --local instance instMeasurableAddE_L2CompactnessCompactness : MeasurableAdd E := by -+local instance instMeasurableAddEL2CompactnessCompactness : MeasurableAdd E := by - infer_instance --local instance instMeasurableNegE_L2CompactnessCompactness : MeasurableNeg E := by -+local instance instMeasurableNegEL2CompactnessCompactness : MeasurableNeg E := by - infer_instance - - variable {K : Set E} -@@ -65,14 +66,15 @@ lemma isCompact_Kψ (hK : IsCompact K) (hψcs : HasCompactSupport ψ) : - IsCompact (Kψ (K := K) (ψ := ψ)) := - IsCompact.add hK hψcs.isCompact - --private def smoothOn (hKm : MeasurableSet K) (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) -+/-- Restrict the smoothed function to its compact domain as a continuous map. -/ -+def smoothOn (hKm : MeasurableSet K) (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) - (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume.restrict K)) : - C(↥(Kψ (K := K) (ψ := ψ)), ℝ) where - toFun x := smoothFun (E := E) (K := K) ψ u x - continuous_toFun := by - have : Continuous (smoothFun (E := E) (K := K) ψ u) := - continuous_smoothFun (E := E) (K := K) (ψ := ψ) (hKm := hKm) hψc hψcs u -- simpa using this.comp continuous_subtype_val -+ exact this.comp continuous_subtype_val - - /-- `smoothFun` packaged as a `BoundedContinuousFunction` on the compact set `K + tsupport ψ`. -/ - def smoothBCF (hK : IsCompact K) (hKm : MeasurableSet K) (hψc : Continuous ψ) -@@ -106,7 +108,7 @@ lemma uniformContinuous_ψ (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) - -- If `ψ x` is `ε`-far from `0`, then `ψ x ≠ 0`, hence `x` belongs to the support and therefore - -- to the topological support. - have hx' : ¬ dist (ψ x) 0 < ε := by -- simpa [Set.mem_compl_iff, Set.mem_setOf_eq] using hx -+ simpa [Set.mem_compl_iff, Set.mem_ofPred_eq] using hx - have hxε : ε ≤ dist (ψ x) 0 := le_of_not_gt (by simpa [gt_iff_lt] using hx') - have hx0 : ψ x ≠ 0 := by - intro hψ0 -@@ -130,10 +132,10 @@ private lemma integrable_norm_L2_restrict (hK : IsCompact K) - Integrable (fun x : E => ‖u x‖) (volume.restrict K) := by - classical - -- On a finite measure space, `L² ⊆ L¹`. -- have hμ : (volume : Measure E) K < ∞ := -+ have hμ : (volume : Measure E) K < (⊤ : ℝ≥0∞) := - (hK.measure_lt_top (μ := (volume : Measure E))) -- letI : Fact ((volume : Measure E) K < ∞) := ⟨hμ⟩ -- haveI : IsFiniteMeasure (volume.restrict K) := by -+ let : Fact ((volume : Measure E) K < (⊤ : ℝ≥0∞)) := ⟨hμ⟩ -+ have : IsFiniteMeasure (volume.restrict K) := by - infer_instance - have hu2 : MemLp (fun x : E => u x) (2 : ℝ≥0∞) (volume.restrict K) := - MeasureTheory.Lp.memLp u -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/FrechetKolmogorov.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/FrechetKolmogorov.lean -index 6af8031..35c2ec0 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/FrechetKolmogorov.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/FrechetKolmogorov.lean -@@ -1,13 +1,13 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Approximation --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Transfer --import Mathlib.Topology.UniformSpace.Cauchy -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Approximation -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Transfer -+import Mathlib.Topology.UniformSpace.Cauchy -+ - /-! - # `L²` compactness criterion: Fréchet–Kolmogorov (Euclidean, compact support case) - -@@ -52,13 +52,14 @@ section Volume - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - --local instance instMeasurableSpaceE_L2CompactnessFrechetKolmogorov : MeasurableSpace E := borel E --local instance instBorelSpaceE_L2CompactnessFrechetKolmogorov : BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_L2CompactnessFrechetKolmogorov : -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceEL2CompactnessFrechetKolmogorov : MeasurableSpace E := borel E -+local instance instBorelSpaceEL2CompactnessFrechetKolmogorov : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceEL2CompactnessFrechetKolmogorov : - OpensMeasurableSpace E := by infer_instance --local instance instMeasurableAddE_L2CompactnessFrechetKolmogorov : MeasurableAdd E := by -+local instance instMeasurableAddEL2CompactnessFrechetKolmogorov : MeasurableAdd E := by - infer_instance --local instance instMeasurableNegE_L2CompactnessFrechetKolmogorov : MeasurableNeg E := by -+local instance instMeasurableNegEL2CompactnessFrechetKolmogorov : MeasurableNeg E := by - infer_instance - - variable {K : Set E} {ψ : E → ℝ} -@@ -125,7 +126,7 @@ theorem totallyBounded_extendByZeroL2_image_of_forall_exists_translationIntegral - rcases Set.mem_iUnion.1 hSu_cover with ⟨y, hy⟩ - rcases Set.mem_iUnion.1 hy with ⟨hyT, hyBall⟩ - have hyDist : dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) y < ε / 2 := by -- simpa [Metric.ball, Set.mem_setOf_eq] using hyBall -+ simpa [Metric.ball, Set.mem_ofPred_eq] using hyBall - have hdist_smooth_ext : - dist (extendByZeroL2 (E := E) (K := K) hKm u) - (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) ≤ ε / 2 := by -@@ -156,7 +157,7 @@ theorem totallyBounded_extendByZeroL2_image_of_forall_exists_translationIntegral - lt_of_le_of_lt htri hlt - simpa [add_halves ε] using htmp - have hxBall : extendByZeroL2 (E := E) (K := K) hKm u ∈ Metric.ball y ε := by -- simpa [Metric.ball, Set.mem_setOf_eq] using hxDist -+ simpa [Metric.ball, Set.mem_ofPred_eq] using hxDist - exact Set.mem_iUnion.2 ⟨y, Set.mem_iUnion.2 ⟨hyT, hxBall⟩⟩ - - theorem isCompact_closure_extendByZeroL2_image_of_forall_exists_translationIntegral_small -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Kernels.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Kernels.lean -index 833b243..8543986 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Kernels.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Kernels.lean -@@ -1,22 +1,22 @@ --import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension --import Mathlib.MeasureTheory.Integral.Bochner.Set --import Mathlib.Topology.Algebra.Support -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension -+import Mathlib.MeasureTheory.Integral.Bochner.Set -+import Mathlib.Topology.Algebra.Support -+ - /-! - # `L²` compactness criterion: existence of small-support probability kernels (Euclidean) - - This file provides a “kernel factory” for the Euclidean Fréchet–Kolmogorov / Riesz–Kolmogorov --criterion: for any radius `δ > 0`, produce a continuous compactly supported function `ψ : E → ℝ` -+criterion: for any radius `deltaLoss > 0`, produce a continuous compactly supported function `ψ : E → ℝ` - such that: - - - `ψ ≥ 0`, --- `tsupport ψ ⊆ Metric.ball 0 δ`, -+- `tsupport ψ ⊆ Metric.ball 0 deltaLoss`, - - `∫ ψ = 1` (so `kernelMeasure ψ` is a probability measure). - - The construction uses mathlib’s `exists_smooth_tsupport_subset` bump-function lemma and normalizes -@@ -41,21 +41,22 @@ section Volume - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - --local instance instMeasurableSpaceE_L2CompactnessKernels : MeasurableSpace E := borel E --local instance instBorelSpaceE_L2CompactnessKernels : BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_L2CompactnessKernels : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceEL2CompactnessKernels : MeasurableSpace E := borel E -+local instance instBorelSpaceEL2CompactnessKernels : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceEL2CompactnessKernels : OpensMeasurableSpace E := by - infer_instance - --/-- For any `δ > 0`, there exists a continuous compactly supported kernel `ψ` supported in --`Metric.ball 0 δ`, with `ψ ≥ 0` and `∫ ψ = 1` (w.r.t. Lebesgue measure). -/ --theorem exists_kernel_tsupport_subset_ball_integral_eq_one {δ : ℝ} (hδ : 0 < δ) : -+/-- For any `deltaLoss > 0`, there exists a continuous compactly supported kernel `ψ` supported in -+`Metric.ball 0 deltaLoss`, with `ψ ≥ 0` and `∫ ψ = 1` (w.r.t. Lebesgue measure). -/ -+theorem exists_kernel_tsupport_subset_ball_integral_eq_one {deltaLoss : ℝ} (hδ : 0 < deltaLoss) : - ∃ ψ : E → ℝ, Continuous ψ ∧ HasCompactSupport ψ ∧ (∀ x, 0 ≤ ψ x) ∧ -- (∫ x, ψ x ∂(volume : Measure E) = 1) ∧ tsupport ψ ⊆ Metric.ball (0 : E) δ := by -+ (∫ x, ψ x ∂(volume : Measure E) = 1) ∧ tsupport ψ ⊆ Metric.ball (0 : E) deltaLoss := by - classical -- -- Start from a smooth bump supported in `ball 0 δ` with value `1` at `0`. -- have hs : (Metric.ball (0 : E) δ) ∈ 𝓝 (0 : E) := Metric.ball_mem_nhds _ hδ -+ -- Start from a smooth bump supported in `ball 0 deltaLoss` with value `1` at `0`. -+ have hs : (Metric.ball (0 : E) deltaLoss) ∈ 𝓝 (0 : E) := Metric.ball_mem_nhds _ hδ - rcases exists_contDiff_tsupport_subset (n := ⊤) -- (E := E) (s := Metric.ball (0 : E) δ) (x := (0 : E)) hs with -+ (E := E) (s := Metric.ball (0 : E) deltaLoss) (x := (0 : E)) hs with - ⟨f, hf_tsupp, hf_cs, hf_smooth, hf_range, hf0⟩ - have hf_cont : Continuous f := hf_smooth.continuous - have hf_nonneg : ∀ x, 0 ≤ f x := by -@@ -77,9 +78,9 @@ theorem exists_kernel_tsupport_subset_ball_integral_eq_one {δ : ℝ} (hδ : 0 < - -- Normalize: `ψ = I⁻¹ • f`. - let ψ : E → ℝ := fun x => I⁻¹ * f x - have hψc : Continuous ψ := by -- simpa [ψ] using (continuous_const.mul hf_cont) -+ exact (continuous_const.mul hf_cont) - have hψcs : HasCompactSupport ψ := by -- simpa [ψ, smul_eq_mul] using -+ exact - (HasCompactSupport.smul_left (f := fun _x : E => I⁻¹) (f' := f) hf_cs) - have hψ0 : ∀ x, 0 ≤ ψ x := by - intro x -@@ -93,7 +94,7 @@ theorem exists_kernel_tsupport_subset_ball_integral_eq_one {δ : ℝ} (hδ : 0 < - simpa [ψ, I] using - (MeasureTheory.integral_const_mul (μ := (volume : Measure E)) (r := I⁻¹) (f := f)) - simp [this, hI0] -- have hψ_tsupp : tsupport ψ ⊆ Metric.ball (0 : E) δ := by -+ have hψ_tsupp : tsupport ψ ⊆ Metric.ball (0 : E) deltaLoss := by - -- Scaling does not enlarge topological support; use the bump support inclusion. - have hsub : tsupport ψ ⊆ tsupport f := by - simpa [ψ, smul_eq_mul] using (tsupport_smul_subset_right (f := fun _x : E => I⁻¹) (g := f)) -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Smoothing.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Smoothing.lean -index 3543832..8d6b0bb 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Smoothing.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Smoothing.lean -@@ -1,13 +1,13 @@ --import RellichKondrachov.MeasureTheory.Function.LpSpace.Restrict --import Mathlib.Analysis.Convolution --import Mathlib.Topology.Algebra.Support -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.MeasureTheory.Function.LpSpace.Restrict -+import Mathlib.Analysis.Convolution -+import Mathlib.Topology.Algebra.Support -+ - /-! - # `L²` compactness criterion: smoothing setup (Euclidean) - -@@ -38,11 +38,12 @@ section - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] - --local instance : MeasurableSpace E := borel E --local instance : BorelSpace E := ⟨rfl⟩ --local instance : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceSmoothing : MeasurableSpace E := borel E -+local instance instBorelSpaceSmoothing : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceSmoothing : OpensMeasurableSpace E := by - infer_instance --local instance : MeasurableAdd E := by -+local instance instMeasurableAddSmoothing : MeasurableAdd E := by - infer_instance - - omit [InnerProductSpace ℝ E] [CompleteSpace E] in -@@ -68,11 +69,12 @@ section Volume - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - - -- `volume` is the canonical Haar measure on finite-dimensional real vector spaces. --local instance : MeasurableSpace E := borel E --local instance : BorelSpace E := ⟨rfl⟩ --local instance : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceSmoothing1 : MeasurableSpace E := borel E -+local instance instBorelSpaceSmoothing1 : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceSmoothing1 : OpensMeasurableSpace E := by - infer_instance --local instance : MeasurableAdd E := by -+local instance instMeasurableAddSmoothing1 : MeasurableAdd E := by - infer_instance - - variable {K : Set E} -@@ -116,7 +118,7 @@ lemma extendByZeroL2_eq_extendByZeroₗᵢ (hKm : MeasurableSet K) - (MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) - (s := K) hKm) u := by - classical -- letI : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ -+ let : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ - refine MeasureTheory.Lp.ext ?_ - have h1 : - (extendByZeroL2 (E := E) (K := K) hKm u : E → ℝ) =ᵐ[(volume : Measure E)] -@@ -126,7 +128,6 @@ lemma extendByZeroL2_eq_extendByZeroₗᵢ (hKm : MeasurableSet K) - ((MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) - (s := K) hKm) u : E → ℝ) =ᵐ[(volume : Measure E)] - extendByZeroFun (E := E) (K := K) u := by -- simp [extendByZeroFun] - exact - (MeasureTheory.Lp.extendByZeroₗᵢ_ae_eq (μ := (volume : Measure E)) (E := ℝ) - (p := (2 : ℝ≥0∞)) (s := K) hKm u) -@@ -136,7 +137,7 @@ lemma norm_extendByZeroL2 (hKm : MeasurableSet K) - (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume.restrict K)) : - ‖extendByZeroL2 (E := E) (K := K) hKm u‖ = ‖u‖ := by - classical -- letI : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ -+ let : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ - calc - ‖extendByZeroL2 (E := E) (K := K) hKm u‖ = - ‖(MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) -@@ -172,7 +173,7 @@ lemma continuous_smoothFun - exact hf_memLp.locallyIntegrable h12 - simpa [smoothFun] using - (hψcs.continuous_convolution_right -- (L := ContinuousLinearMap.lsmul ℝ ℝ) -+ («L» := ContinuousLinearMap.lsmul ℝ ℝ) - (μ := (volume : Measure E)) hf_loc hψc) - - lemma hasCompactSupport_smoothFun (hK : IsCompact K) (hψcs : HasCompactSupport ψ) -@@ -181,7 +182,7 @@ lemma hasCompactSupport_smoothFun (hK : IsCompact K) (hψcs : HasCompactSupport - have hf : HasCompactSupport (extendByZeroFun (K := K) u) := - hasCompactSupport_extendByZeroFun (K := K) hK u - simpa [smoothFun] using -- (hf.convolution (L := ContinuousLinearMap.lsmul ℝ ℝ) -+ (hf.convolution («L» := ContinuousLinearMap.lsmul ℝ ℝ) - (μ := (volume : Measure E)) hψcs) - - lemma support_smoothFun_subset_add_tsupport -@@ -192,7 +193,7 @@ lemma support_smoothFun_subset_add_tsupport - Function.support (smoothFun (E := E) (K := K) ψ u) ⊆ - Function.support (extendByZeroFun (E := E) (K := K) u) + Function.support ψ := by - simpa [smoothFun] using -- (support_convolution_subset (L := ContinuousLinearMap.lsmul ℝ ℝ) (μ := (volume : Measure E)) -+ (support_convolution_subset («L» := ContinuousLinearMap.lsmul ℝ ℝ) (μ := (volume : Measure E)) - (f := extendByZeroFun (E := E) (K := K) u) (g := ψ)) - have h1 : Function.support (extendByZeroFun (E := E) (K := K) u) ⊆ K := by - simp [extendByZeroFun] -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Transfer.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Transfer.lean -index 51414a8..2be859b 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Transfer.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Transfer.lean -@@ -1,13 +1,13 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.ArzelaAscoli --import Mathlib.MeasureTheory.Function.LpSpace.Basic --import Mathlib.Topology.MetricSpace.Pseudo.Basic -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.ArzelaAscoli -+import Mathlib.MeasureTheory.Function.LpSpace.Basic -+import Mathlib.Topology.MetricSpace.Pseudo.Basic -+ - /-! - # `L²` compactness criterion: transfer from `BCF` compactness to `L²` (Euclidean) - -@@ -39,32 +39,217 @@ section Volume - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - --local instance instMeasurableSpaceE_L2CompactnessTransfer : MeasurableSpace E := borel E --local instance instBorelSpaceE_L2CompactnessTransfer : BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_L2CompactnessTransfer : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceEL2CompactnessTransfer : MeasurableSpace E := borel E -+local instance instBorelSpaceEL2CompactnessTransfer : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceEL2CompactnessTransfer : OpensMeasurableSpace E := by - infer_instance --local instance instMeasurableAddE_L2CompactnessTransfer : MeasurableAdd E := by -+local instance instMeasurableAddEL2CompactnessTransfer : MeasurableAdd E := by - infer_instance --local instance instMeasurableNegE_L2CompactnessTransfer : MeasurableNeg E := by -+local instance instMeasurableNegEL2CompactnessTransfer : MeasurableNeg E := by - infer_instance - - variable {K : Set E} {ψ : E → ℝ} - -+private lemma dist_smoothL2_le_mul_dist_smoothBCF (hK : IsCompact K) (hKm : MeasurableSet K) -+ (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) : -+ ∀ u v : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume.restrict K), -+ dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) -+ (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs v) ≤ -+ (MeasureTheory.measureUnivNNReal ((volume : Measure E).restrict (Kψ (K := K) (ψ := ψ)))) ^ -+ ((2 : ℝ≥0∞).toReal⁻¹) * -+ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) -+ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs v) := by -+ classical -+ let : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ -+ let s : Set E := Kψ (K := K) (ψ := ψ) -+ have hs_compact : IsCompact s := isCompact_Kψ (K := K) (ψ := ψ) hK hψcs -+ have hs : MeasurableSet s := hs_compact.measurableSet -+ have hs_lt_top : (volume : Measure E) s < (⊤ : ℝ≥0∞) := -+ hs_compact.measure_lt_top (μ := (volume : Measure E)) -+ let μs : Measure E := (volume : Measure E).restrict s -+ have : Fact ((volume : Measure E) s < (⊤ : ℝ≥0∞)) := ⟨hs_lt_top⟩ -+ have : IsFiniteMeasure μs := by -+ infer_instance -+ let mS : ℝ := (MeasureTheory.measureUnivNNReal μs) ^ ((2 : ℝ≥0∞).toReal⁻¹) -+ intro u v -+ set Su := -+ smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u -+ set Sv := -+ smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs v -+ set Bu := -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u -+ set Bv := -+ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs v -+ have hBuBv : 0 ≤ ‖Bu - Bv‖ := norm_nonneg _ -+ -- Work on `F := Su - Sv` and restrict to the finite-measure set `s`. -+ let F : (E →₂[(volume : Measure E)] ℝ) := Su - Sv -+ let g : E → ℝ := fun x => (F : E → ℝ) x -+ have hg : MeasureTheory.MemLp g (2 : ℝ≥0∞) (volume : Measure E) := MeasureTheory.Lp.memLp F -+ have hg_restrict : MeasureTheory.MemLp g (2 : ℝ≥0∞) μs := hg.restrict s -+ let Fs : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μs := hg_restrict.toLp g -+ -- Show `Fs` is pointwise bounded by `‖Bu - Bv‖` on `μs`. -+ have hF_ae : -+ (g =ᵐ[μs] fun x : E => -+ smoothFun (E := E) (K := K) ψ u x - -+ smoothFun (E := E) (K := K) ψ v x) := by -+ have hsub : -+ (F : E → ℝ) =ᵐ[(volume : Measure E)] (Su : E → ℝ) - (Sv : E → ℝ) := by -+ simpa [F, g, Su, Sv] using -+ (MeasureTheory.Lp.coeFn_sub (μ := (volume : Measure E)) Su Sv) -+ have hu : -+ (Su : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ u := -+ smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs u -+ have hv : -+ (Sv : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ v := -+ smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs v -+ have hF : -+ (F : E → ℝ) =ᵐ[(volume : Measure E)] -+ fun x : E => -+ smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x := by -+ have h := hsub.trans (hu.sub hv) -+ filter_upwards [h] with x hx -+ simpa [Pi.sub_apply] using hx -+ exact MeasureTheory.ae_restrict_of_ae (μ := (volume : Measure E)) (s := s) hF -+ have hFs_ae : ((Fs : E → ℝ) =ᵐ[μs] g) := by -+ simpa [Fs, g] using -+ (MeasureTheory.MemLp.coeFn_toLp (μ := μs) (p := (2 : ℝ≥0∞)) (f := g) hg_restrict) -+ have hbound : -+ ∀ᵐ x ∂μs, ‖Fs x‖ ≤ ‖Bu - Bv‖ := by -+ have hpoint : -+ ∀ x : E, x ∈ s → ‖smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x‖ ≤ -+ ‖Bu - Bv‖ := by -+ intro x hx -+ let x' : ↥(Kψ (K := K) (ψ := ψ)) := ⟨x, hx⟩ -+ have hBu : Bu x' = smoothFun (E := E) (K := K) ψ u x := by -+ simp [Bu, x'] -+ have hBv : Bv x' = smoothFun (E := E) (K := K) ψ v x := by -+ simp [Bv, x'] -+ have : ‖(Bu - Bv) x'‖ ≤ ‖Bu - Bv‖ := -+ (Bu - Bv).norm_coe_le_norm x' -+ simpa [hBu, hBv] using this -+ filter_upwards -+ [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hs, -+ hFs_ae, hF_ae] with x hx hFs hF -+ have := hpoint x hx -+ -- rewrite through the AE equalities -+ simpa [hFs, hF] using this -+ have hnorm_Fs : ‖Fs‖ ≤ mS * ‖Bu - Bv‖ := by -+ have := (MeasureTheory.Lp.norm_le_of_ae_bound (μ := μs) (p := (2 : ℝ≥0∞)) -+ (f := Fs) (hC := hBuBv) hbound) -+ simpa [mS] using this -+ -- Relate the `L²` norm on `volume` to the restricted norm on `μs` using extension-by-zero. -+ have hsupport : -+ ∀ x : E, x ∉ s → -+ smoothFun (E := E) (K := K) ψ u x - -+ smoothFun (E := E) (K := K) ψ v x = 0 := by -+ intro x hx -+ have hu_supp : Function.support (smoothFun (E := E) (K := K) ψ u) ⊆ s := by -+ exact -+ (support_smoothFun_subset_add_tsupport (E := E) (K := K) (ψ := ψ) u) -+ have hv_supp : Function.support (smoothFun (E := E) (K := K) ψ v) ⊆ s := by -+ exact -+ (support_smoothFun_subset_add_tsupport (E := E) (K := K) (ψ := ψ) v) -+ have hu0 : smoothFun (E := E) (K := K) ψ u x = 0 := by -+ have : x ∉ Function.support (smoothFun (E := E) (K := K) ψ u) := fun hx' => hx (hu_supp hx') -+ simpa [Function.support] using this -+ have hv0 : smoothFun (E := E) (K := K) ψ v x = 0 := by -+ have : x ∉ Function.support (smoothFun (E := E) (K := K) ψ v) := fun hx' => hx (hv_supp hx') -+ simpa [Function.support] using this -+ simp [hu0, hv0] -+ have hF0 : -+ ∀ᵐ x ∂(volume : Measure E), x ∉ s → g x = 0 := by -+ have hF_ae_full : -+ (g =ᵐ[(volume : Measure E)] -+ fun x : E => -+ smoothFun (E := E) (K := K) ψ u x - -+ smoothFun (E := E) (K := K) ψ v x) := by -+ have hsub : -+ (F : E → ℝ) =ᵐ[(volume : Measure E)] (Su : E → ℝ) - (Sv : E → ℝ) := by -+ simpa [F, g, Su, Sv] using -+ (MeasureTheory.Lp.coeFn_sub (μ := (volume : Measure E)) Su Sv) -+ have hu : -+ (Su : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ u := -+ smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs u -+ have hv : -+ (Sv : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ v := -+ smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs v -+ have hF : -+ (F : E → ℝ) =ᵐ[(volume : Measure E)] -+ fun x : E => -+ smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x := by -+ have h := hsub.trans (hu.sub hv) -+ filter_upwards [h] with x hx -+ simpa [Pi.sub_apply] using hx -+ simpa [g] using hF -+ filter_upwards [hF_ae_full] with x hx -+ intro hxnot -+ have : smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x = 0 := -+ hsupport x hxnot -+ simpa [hx] using this -+ have hF_ind : -+ (s.indicator g =ᵐ[(volume : Measure E)] g) := by -+ filter_upwards [hF0] with x hx -+ by_cases hxmem : x ∈ s -+ · simp [g, hxmem] -+ · have : g x = 0 := hx hxmem -+ simp [g, hxmem, this] -+ -- Conclude `‖F‖ = ‖Fs‖` using `extendByZeroₗᵢ` and the indicator identity. -+ let Fext : -+ MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume : Measure E) := -+ (MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) -+ (s := s) hs) Fs -+ have hFext_ae : -+ ((Fext : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume : Measure E)) : -+ E → ℝ) =ᵐ[(volume : Measure E)] -+ s.indicator fun x : E => (Fs : E → ℝ) x := by -+ simpa [Fext] using -+ (MeasureTheory.Lp.extendByZeroₗᵢ_ae_eq -+ (μ := (volume : Measure E)) (p := (2 : ℝ≥0∞)) -+ (s := s) hs Fs) -+ have hFs_on : -+ ∀ᵐ x ∂(volume : Measure E), x ∈ s → (Fs : E → ℝ) x = g x := by -+ -- rewrite the AE equality `Fs = g` on the restricted measure as an implication on `volume` -+ have := (MeasureTheory.ae_restrict_iff' (μ := (volume : Measure E)) (s := s) hs).1 hFs_ae -+ simpa [g] using this -+ have hindicator : -+ (s.indicator (fun x : E => (Fs : E → ℝ) x) =ᵐ[(volume : Measure E)] s.indicator g) := by -+ filter_upwards [hFs_on] with x hx -+ by_cases hxmem : x ∈ s -+ · simp [hxmem, hx hxmem] -+ · simp [hxmem] -+ have hFext_ae' : -+ (Fext : E → ℝ) =ᵐ[(volume : Measure E)] g := by -+ exact hFext_ae.trans (hindicator.trans hF_ind) -+ have hFext_eq : Fext = F := by -+ refine MeasureTheory.Lp.ext ?_ -+ simpa [g, F] using hFext_ae' -+ have hnorm_F : ‖F‖ ≤ mS * ‖Bu - Bv‖ := by -+ -- use `‖F‖ = ‖Fs‖` via the isometry. -+ have hnorm_ext : ‖Fext‖ = ‖Fs‖ := by -+ simp [Fext] -+ -- `Fext = F` and `Fs` is bounded. -+ have : ‖Fext‖ ≤ mS * ‖Bu - Bv‖ := by -+ simpa [hnorm_ext] using hnorm_Fs -+ simpa [hFext_eq] using this -+ -- Convert to the `dist` statement. -+ simpa [Su, Sv, Bu, Bv, F, dist_eq_norm, mS, mul_assoc] using hnorm_F -+ - theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : MeasurableSet K) - (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) {R : ℝ} (hR : 0 ≤ R) : - IsCompact - (closure - (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs '' Metric.closedBall (0 : _) R)) := by - classical -- letI : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ -+ let : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ - let s : Set E := Kψ (K := K) (ψ := ψ) - have hs_compact : IsCompact s := isCompact_Kψ (K := K) (ψ := ψ) hK hψcs - have hs : MeasurableSet s := hs_compact.measurableSet -- have hs_lt_top : (volume : Measure E) s < ∞ := -+ have hs_lt_top : (volume : Measure E) s < (⊤ : ℝ≥0∞) := - hs_compact.measure_lt_top (μ := (volume : Measure E)) - let μs : Measure E := (volume : Measure E).restrict s -- haveI : Fact ((volume : Measure E) s < ∞) := ⟨hs_lt_top⟩ -- haveI : IsFiniteMeasure μs := by -+ have : Fact ((volume : Measure E) s < (⊤ : ℝ≥0∞)) := ⟨hs_lt_top⟩ -+ have : IsFiniteMeasure μs := by - infer_instance - let mS : ℝ := (MeasureTheory.measureUnivNNReal μs) ^ ((2 : ℝ≥0∞).toReal⁻¹) - have hmS : 0 ≤ mS := by -@@ -79,178 +264,14 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable - smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs '' U - have hA_compact : IsCompact (closure A) := - smoothBCF_image_closedBall_isCompact (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (R := R) hR -- have hdist_smoothL2_le : -- ∀ u v : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume.restrict K), -- dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) -- (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs v) ≤ -- mS * -- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) -- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs v) := by -- intro u v -- set Su := -- smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u -- set Sv := -- smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs v -- set Bu := -- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u -- set Bv := -- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs v -- have hBuBv : 0 ≤ ‖Bu - Bv‖ := norm_nonneg _ -- -- Work on `F := Su - Sv` and restrict to the finite-measure set `s`. -- let F : (E →₂[(volume : Measure E)] ℝ) := Su - Sv -- let g : E → ℝ := fun x => (F : E → ℝ) x -- have hg : MeasureTheory.MemLp g (2 : ℝ≥0∞) (volume : Measure E) := MeasureTheory.Lp.memLp F -- have hg_restrict : MeasureTheory.MemLp g (2 : ℝ≥0∞) μs := hg.restrict s -- let Fs : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μs := hg_restrict.toLp g -- -- Show `Fs` is pointwise bounded by `‖Bu - Bv‖` on `μs`. -- have hF_ae : -- (g =ᵐ[μs] fun x : E => -- smoothFun (E := E) (K := K) ψ u x - -- smoothFun (E := E) (K := K) ψ v x) := by -- have hsub : -- (F : E → ℝ) =ᵐ[(volume : Measure E)] (Su : E → ℝ) - (Sv : E → ℝ) := by -- simpa [F, g, Su, Sv] using -- (MeasureTheory.Lp.coeFn_sub (μ := (volume : Measure E)) Su Sv) -- have hu : -- (Su : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ u := -- smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs u -- have hv : -- (Sv : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ v := -- smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs v -- have hF : -- (F : E → ℝ) =ᵐ[(volume : Measure E)] -- fun x : E => -- smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x := by -- simpa [Pi.sub_apply] using hsub.trans (hu.sub hv) -- exact MeasureTheory.ae_restrict_of_ae (μ := (volume : Measure E)) (s := s) hF -- have hFs_ae : ((Fs : E → ℝ) =ᵐ[μs] g) := by -- simpa [Fs, g] using -- (MeasureTheory.MemLp.coeFn_toLp (μ := μs) (p := (2 : ℝ≥0∞)) (f := g) hg_restrict) -- have hbound : -- ∀ᵐ x ∂μs, ‖Fs x‖ ≤ ‖Bu - Bv‖ := by -- have hpoint : -- ∀ x : E, x ∈ s → ‖smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x‖ ≤ -- ‖Bu - Bv‖ := by -- intro x hx -- let x' : ↥(Kψ (K := K) (ψ := ψ)) := ⟨x, hx⟩ -- have hBu : Bu x' = smoothFun (E := E) (K := K) ψ u x := by -- simp [Bu, x'] -- have hBv : Bv x' = smoothFun (E := E) (K := K) ψ v x := by -- simp [Bv, x'] -- have : ‖(Bu - Bv) x'‖ ≤ ‖Bu - Bv‖ := -- (Bu - Bv).norm_coe_le_norm x' -- simpa [hBu, hBv] using this -- filter_upwards -- [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hs, -- hFs_ae, hF_ae] with x hx hFs hF -- have := hpoint x hx -- -- rewrite through the AE equalities -- simpa [hFs, hF] using this -- have hnorm_Fs : ‖Fs‖ ≤ mS * ‖Bu - Bv‖ := by -- have := (MeasureTheory.Lp.norm_le_of_ae_bound (μ := μs) (p := (2 : ℝ≥0∞)) -- (f := Fs) (hC := hBuBv) hbound) -- simpa [mS] using this -- -- Relate the `L²` norm on `volume` to the restricted norm on `μs` using extension-by-zero. -- have hsupport : -- ∀ x : E, x ∉ s → -- smoothFun (E := E) (K := K) ψ u x - -- smoothFun (E := E) (K := K) ψ v x = 0 := by -- intro x hx -- have hu_supp : Function.support (smoothFun (E := E) (K := K) ψ u) ⊆ s := by -- simpa [s] using -- (support_smoothFun_subset_add_tsupport (E := E) (K := K) (ψ := ψ) u) -- have hv_supp : Function.support (smoothFun (E := E) (K := K) ψ v) ⊆ s := by -- simpa [s] using -- (support_smoothFun_subset_add_tsupport (E := E) (K := K) (ψ := ψ) v) -- have hu0 : smoothFun (E := E) (K := K) ψ u x = 0 := by -- have : x ∉ Function.support (smoothFun (E := E) (K := K) ψ u) := fun hx' => hx (hu_supp hx') -- simpa [Function.support] using this -- have hv0 : smoothFun (E := E) (K := K) ψ v x = 0 := by -- have : x ∉ Function.support (smoothFun (E := E) (K := K) ψ v) := fun hx' => hx (hv_supp hx') -- simpa [Function.support] using this -- simp [hu0, hv0] -- have hF0 : -- ∀ᵐ x ∂(volume : Measure E), x ∉ s → g x = 0 := by -- have hF_ae_full : -- (g =ᵐ[(volume : Measure E)] -- fun x : E => -- smoothFun (E := E) (K := K) ψ u x - -- smoothFun (E := E) (K := K) ψ v x) := by -- have hsub : -- (F : E → ℝ) =ᵐ[(volume : Measure E)] (Su : E → ℝ) - (Sv : E → ℝ) := by -- simpa [F, g, Su, Sv] using -- (MeasureTheory.Lp.coeFn_sub (μ := (volume : Measure E)) Su Sv) -- have hu : -- (Su : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ u := -- smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs u -- have hv : -- (Sv : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ v := -- smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs v -- have hF : -- (F : E → ℝ) =ᵐ[(volume : Measure E)] -- fun x : E => -- smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x := by -- simpa [Pi.sub_apply] using hsub.trans (hu.sub hv) -- simpa [g] using hF -- filter_upwards [hF_ae_full] with x hx -- intro hxnot -- have : smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x = 0 := -- hsupport x hxnot -- simpa [hx] using this -- have hF_ind : -- (s.indicator g =ᵐ[(volume : Measure E)] g) := by -- filter_upwards [hF0] with x hx -- by_cases hxmem : x ∈ s -- · simp [g, hxmem] -- · have : g x = 0 := hx hxmem -- simp [g, hxmem, this] -- -- Conclude `‖F‖ = ‖Fs‖` using `extendByZeroₗᵢ` and the indicator identity. -- let Fext : -- MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume : Measure E) := -- (MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) -- (s := s) hs) Fs -- have hFext_ae : -- ((Fext : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume : Measure E)) : -- E → ℝ) =ᵐ[(volume : Measure E)] -- s.indicator fun x : E => (Fs : E → ℝ) x := by -- simpa [Fext] using -- (MeasureTheory.Lp.extendByZeroₗᵢ_ae_eq -- (μ := (volume : Measure E)) (p := (2 : ℝ≥0∞)) -- (s := s) hs Fs) -- have hFs_on : -- ∀ᵐ x ∂(volume : Measure E), x ∈ s → (Fs : E → ℝ) x = g x := by -- -- rewrite the AE equality `Fs = g` on the restricted measure as an implication on `volume` -- have := (MeasureTheory.ae_restrict_iff' (μ := (volume : Measure E)) (s := s) hs).1 hFs_ae -- simpa [g] using this -- have hindicator : -- (s.indicator (fun x : E => (Fs : E → ℝ) x) =ᵐ[(volume : Measure E)] s.indicator g) := by -- filter_upwards [hFs_on] with x hx -- by_cases hxmem : x ∈ s -- · simp [hxmem, hx hxmem] -- · simp [hxmem] -- have hFext_ae' : -- (Fext : E → ℝ) =ᵐ[(volume : Measure E)] g := by -- exact hFext_ae.trans (hindicator.trans hF_ind) -- have hFext_eq : Fext = F := by -- refine MeasureTheory.Lp.ext ?_ -- simpa [g, F] using hFext_ae' -- have hnorm_F : ‖F‖ ≤ mS * ‖Bu - Bv‖ := by -- -- use `‖F‖ = ‖Fs‖` via the isometry. -- have hnorm_ext : ‖Fext‖ = ‖Fs‖ := by -- simp [Fext] -- -- `Fext = F` and `Fs` is bounded. -- have : ‖Fext‖ ≤ mS * ‖Bu - Bv‖ := by -- simpa [hnorm_ext] using hnorm_Fs -- simpa [hFext_eq] using this -- -- Convert to the `dist` statement. -- simpa [Su, Sv, Bu, Bv, F, dist_eq_norm, mS, mul_assoc] using hnorm_F -+ have hdist_smoothL2_le := -+ dist_smoothL2_le_mul_dist_smoothBCF (K := K) (ψ := ψ) hK hKm hψc hψcs - have hTB_B : TotallyBounded B := by - -- Use a finite `BCF` ε-net for `A` with centers in the image, then transfer to `L²`. - rw [Metric.totallyBounded_iff] - intro ε hε - by_cases hmS0 : mS = 0 -- · -- let c : (E →₂[(volume : Measure E)] ℝ) := -+ · let c : (E →₂[(volume : Measure E)] ℝ) := - smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs (0 : _) - refine ⟨{c}, by simp [c], ?_⟩ - intro w hw -@@ -260,9 +281,15 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable - have hdist0 : - dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) - c = 0 := by -+ have hmS0' : -+ (MeasureTheory.measureUnivNNReal ((volume : Measure E).restrict s) : ℝ) ^ -+ ((2 : ℝ≥0∞).toReal⁻¹) = 0 := hmS0 - have : - dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) c ≤ 0 := by -- simpa [c, hmS0] using hle -+ have hle' := hle -+ simp only [s] at hmS0' -+ rw [hmS0', zero_mul] at hle' -+ simpa [c] using hle' - exact le_antisymm this dist_nonneg - refine mem_iUnion.2 ?_ - refine ⟨c, mem_iUnion.2 ?_⟩ -@@ -270,10 +297,10 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable - -- membership in the open ball follows from `dist = 0` and `ε > 0` - simpa [Metric.mem_ball, hdist0] using hε - · have hmSpos : 0 < mS := lt_of_le_of_ne hmS (Ne.symm hmS0) -- let δ : ℝ := ε / mS -- have hδpos : 0 < δ := div_pos hε hmSpos -+ let deltaLoss : ℝ := ε / mS -+ have hδpos : 0 < deltaLoss := div_pos hε hmSpos - obtain ⟨t, htAsub, htFin, htCover⟩ := -- exists_finite_cover_balls_of_isCompact_closure (s := A) (ε := δ) hA_compact hδpos -+ exists_finite_cover_balls_of_isCompact_closure (s := A) (ε := deltaLoss) hA_compact hδpos - let tFin : Finset (BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) := - htFin.toFinset - have htFin_mem : -@@ -300,14 +327,14 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable - rcases hw with ⟨u, huU, rfl⟩ - have hBu : (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) ∈ A := by - exact ⟨u, huU, rfl⟩ -- have : smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u ∈ ⋃ x ∈ t, Metric.ball x δ := -+ have : smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u ∈ ⋃ x ∈ t, Metric.ball x deltaLoss := - htCover hBu - rcases mem_iUnion.1 this with ⟨f, hf⟩ - rcases mem_iUnion.1 hf with ⟨hf_t, hf_ball⟩ - have hf_tFin : f ∈ tFin := (htFin_mem (f := f)).2 hf_t - let f' : ι := ⟨f, hf_tFin⟩ - have hf_ball' : -- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) f < δ := hf_ball -+ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) f < deltaLoss := hf_ball - have hdist : - dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) - (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs (uOf f')) < ε := by -@@ -317,17 +344,17 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable - simpa [f'] using huOfEq f' - have hdist' : - dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) -- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < δ := by -+ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < deltaLoss := by - simpa [hf_eq] using hf_ball' - have : mS * dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) - (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < ε := by - have : mS * dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) -- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < mS * δ := by -+ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < mS * deltaLoss := by - exact mul_lt_mul_of_pos_left hdist' hmSpos -- have hmul : mS * δ = ε := by -+ have hmul : mS * deltaLoss = ε := by - have hmS_ne : mS ≠ 0 := ne_of_gt hmSpos - calc -- mS * δ = mS * (ε / mS) := by simp [δ] -+ mS * deltaLoss = mS * (ε / mS) := by simp [deltaLoss] - _ = mS * ε / mS := (mul_div_assoc mS ε mS).symm - _ = ε := by simpa using (mul_div_cancel_left₀ ε hmS_ne) - simpa [hmul] using this -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/TranslationIntegral.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/TranslationIntegral.lean -index cdb4346..6914c2a 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/TranslationIntegral.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/TranslationIntegral.lean -@@ -1,13 +1,13 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Approximation --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation --import Mathlib.MeasureTheory.Integral.Bochner.Basic -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Approximation -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation -+import Mathlib.MeasureTheory.Integral.Bochner.Basic -+ - /-! - # `L²` compactness criterion: bounding the translation-integral by a translation modulus - -@@ -38,59 +38,60 @@ section Volume - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - --local instance instMeasurableSpaceE_L2CompactnessTranslationIntegral : MeasurableSpace E := borel E --local instance instBorelSpaceE_L2CompactnessTranslationIntegral : BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_L2CompactnessTranslationIntegral : -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceEL2CompactnessTranslationIntegral : MeasurableSpace E := borel E -+local instance instBorelSpaceEL2CompactnessTranslationIntegral : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceEL2CompactnessTranslationIntegral : - OpensMeasurableSpace E := by infer_instance --local instance instMeasurableAddE_L2CompactnessTranslationIntegral : MeasurableAdd E := by -+local instance instMeasurableAddEL2CompactnessTranslationIntegral : MeasurableAdd E := by - infer_instance --local instance instMeasurableNegE_L2CompactnessTranslationIntegral : MeasurableNeg E := by -+local instance instMeasurableNegEL2CompactnessTranslationIntegral : MeasurableNeg E := by - infer_instance - - variable {ψ : E → ℝ} - --private lemma kernelMeasure_compl_ball_eq_zero_of_tsupport_subset {δ : ℝ} -- (hψsupp : tsupport ψ ⊆ Metric.ball (0 : E) δ) : -- kernelMeasure (E := E) ψ ((Metric.ball (0 : E) δ)ᶜ) = 0 := by -+private lemma kernelMeasure_compl_ball_eq_zero_of_tsupport_subset {deltaLoss : ℝ} -+ (hψsupp : tsupport ψ ⊆ Metric.ball (0 : E) deltaLoss) : -+ kernelMeasure (E := E) ψ ((Metric.ball (0 : E) deltaLoss)ᶜ) = 0 := by - classical -- have hψzero : ∀ x : E, x ∈ (Metric.ball (0 : E) δ)ᶜ → ψ x = 0 := by -+ have hψzero : ∀ x : E, x ∈ (Metric.ball (0 : E) deltaLoss)ᶜ → ψ x = 0 := by - intro x hx - have hx' : x ∉ tsupport ψ := by - intro hx_ts - exact hx (hψsupp hx_ts) - exact image_eq_zero_of_notMem_tsupport (f := ψ) hx' -- have hmeas : MeasurableSet ((Metric.ball (0 : E) δ)ᶜ) := -- (measurableSet_ball : MeasurableSet (Metric.ball (0 : E) δ)).compl -+ have hmeas : MeasurableSet ((Metric.ball (0 : E) deltaLoss)ᶜ) := -+ (measurableSet_ball : MeasurableSet (Metric.ball (0 : E) deltaLoss)).compl - have hEq : -- Set.EqOn (fun x : E => ENNReal.ofReal (ψ x)) 0 ((Metric.ball (0 : E) δ)ᶜ) := by -+ Set.EqOn (fun x : E => ENNReal.ofReal (ψ x)) 0 ((Metric.ball (0 : E) deltaLoss)ᶜ) := by - intro x hx - simp [hψzero x hx] - -- Expand `kernelMeasure` and note the density is identically `0` on the set. - simp [kernelMeasure, MeasureTheory.withDensity_apply, hmeas, - MeasureTheory.setLIntegral_eq_zero - (μ := (volume : Measure E)) -- (s := (Metric.ball (0 : E) δ)ᶜ) hmeas hEq] -+ (s := (Metric.ball (0 : E) deltaLoss)ᶜ) hmeas hEq] - - theorem integral_norm_sq_translateL2_sub_le_sq_of_tsupport_subset_ball - (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) (hψ0 : ∀ x, 0 ≤ ψ x) - (hψint : ∫ x, ψ x ∂(volume : Measure E) = 1) -- {δ η : ℝ} (hη : 0 ≤ η) (hψsupp : tsupport ψ ⊆ Metric.ball (0 : E) δ) -+ {deltaLoss η : ℝ} (hη : 0 ≤ η) (hψsupp : tsupport ψ ⊆ Metric.ball (0 : E) deltaLoss) - (F : (E →₂[(volume : Measure E)] ℝ)) - (hmod : -- ∀ t : E, t ∈ Metric.ball (0 : E) δ → -+ ∀ t : E, t ∈ Metric.ball (0 : E) deltaLoss → - ‖(translateL2 (μ := (volume : Measure E)) (-t)) F - F‖ ≤ η) : - ∫ t, - ‖(translateL2 (μ := (volume : Measure E)) (-t)) F - F‖ ^ 2 - ∂kernelMeasure (E := E) ψ ≤ η ^ 2 := by - classical - let μ : Measure E := kernelMeasure (E := E) ψ -- haveI : MeasureTheory.IsProbabilityMeasure μ := -+ have : MeasureTheory.IsProbabilityMeasure μ := - ⟨kernelMeasure_univ (E := E) (ψ := ψ) hψc hψcs hψ0 hψint⟩ -- have hμzero : μ ((Metric.ball (0 : E) δ)ᶜ) = 0 := by -+ have hμzero : μ ((Metric.ball (0 : E) deltaLoss)ᶜ) = 0 := by - simpa [μ] using kernelMeasure_compl_ball_eq_zero_of_tsupport_subset (E := E) (ψ := ψ) hψsupp -- have hAE_ball : (Metric.ball (0 : E) δ) ∈ MeasureTheory.ae μ := -+ have hAE_ball : (Metric.ball (0 : E) deltaLoss) ∈ MeasureTheory.ae μ := - (MeasureTheory.mem_ae_iff.2 hμzero) -- -- On `Metric.ball 0 δ`, the squared translation error is bounded by `η²`. -+ -- On `Metric.ball 0 deltaLoss`, the squared translation error is bounded by `η²`. - have hAE_bound : - ∀ᵐ t : E ∂μ, - ‖‖(translateL2 (μ := (volume : Measure E)) (-t)) F - F‖ ^ 2‖ ≤ η ^ 2 := by -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Rellich.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Rellich.lean -index 4cd9bb3..b133aa6 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Rellich.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Rellich.lean -@@ -1,19 +1,16 @@ --import Mathlib.Analysis.Normed.Operator.Compact --import Mathlib.MeasureTheory.Measure.Lebesgue.Basic --import Mathlib.MeasureTheory.Function.LpSpace.Complete --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateH1 --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.FrechetKolmogorov --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Kernels --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.TranslationIntegral -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - --set_option linter.unusedTactic false --set_option linter.unreachableTactic false -+import Mathlib.Analysis.Normed.Operator.Compact.Basic -+import Mathlib.MeasureTheory.Measure.Lebesgue.Basic -+import Mathlib.MeasureTheory.Function.LpSpace.Complete -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateH1 -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.FrechetKolmogorov -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Kernels -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.TranslationIntegral - - /-! - # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Rellich` -@@ -59,15 +56,16 @@ section Volume - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] - [CompleteSpace E] - --local instance instMeasurableSpaceE_SobolevEuclideanRellich : MeasurableSpace E := borel E --local instance instBorelSpaceE_SobolevEuclideanRellich : BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_SobolevEuclideanRellich : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceRellich : MeasurableSpace E := borel E -+local instance instBorelSpaceRellich : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceRellich : OpensMeasurableSpace E := by - infer_instance --local instance instMeasurableAddE_SobolevEuclideanRellich : MeasurableAdd E := by -+local instance instMeasurableAddRellich : MeasurableAdd E := by - infer_instance --local instance instMeasurableNegE_SobolevEuclideanRellich : MeasurableNeg E := by -+local instance instMeasurableNegRellich : MeasurableNeg E := by - infer_instance --local instance instFactOneLeTwo_SobolevEuclideanRellich : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ -+local instance instFactOneLeTwoSobolevEuclideanRellich : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ - - /-! ### Supported `H¹` subspace -/ - -@@ -90,7 +88,6 @@ noncomputable def h1OnToL2 (K : Set E) (hKm : MeasurableSet K) : - - /-! ### Euclidean Rellich on fixed compact support -/ - --set_option maxHeartbeats 2000000 in - /-- Euclidean Rellich–Kondrachov compactness (Lebesgue): on a fixed compact support `K`, the - inclusion `H¹ → L²` is a compact operator. -/ - theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : MeasurableSet K) : -@@ -105,10 +102,9 @@ theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : Measur - L2Compactness.extendByZeroL2 (E := E) (K := K) hKm u ∈ - T '' Metric.closedBall (0 : ↥(h1On (E := E) K hKm)) 1} - let C : ℝ := -- (h1ToL2 (μ := (volume : Measure E)) (E := E)).opNorm -+ ‖h1ToL2 (μ := (volume : Measure E)) (E := E)‖ - have hCnonneg : 0 ≤ C := by -- dsimp [C] -- exact (h1ToL2 (μ := (volume : Measure E)) (E := E)).opNorm_nonneg -+ exact norm_nonneg (h1ToL2 (μ := (volume : Measure E)) (E := E)) - have hA_ball : - A ⊆ - Metric.closedBall -@@ -119,7 +115,7 @@ theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : Measur - have hx' : ‖(x : H1vol)‖ ≤ (1 : ℝ) := by - -- `h1On` inherits the ambient norm, so this is definitional. - change ‖x‖ ≤ (1 : ℝ) -- exact (mem_closedBall_zero_iff.mp hx) -+ simpa only [Metric.mem_closedBall,dist_zero_right x] using hx - have hTx' : ‖T x‖ ≤ C := by - have hTx : ‖T x‖ ≤ C * ‖(x : H1vol)‖ := by - have h := -@@ -150,20 +146,20 @@ theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : Measur - have hδ : 0 < ε / 2 := by linarith - rcases - L2Compactness.exists_kernel_tsupport_subset_ball_integral_eq_one -- (E := E) (δ := ε / 2) hδ with -+ (E := E) (deltaLoss := ε / 2) hδ with - ⟨ψ, hψc, hψcs, hψ0, hψint, hψsupp⟩ - refine ⟨ψ, hψc, hψcs, hψ0, hψint, ?_⟩ - intro u huA - rcases huA with ⟨x, hx, hxEq⟩ - have hxH1 : ‖(x : H1vol)‖ ≤ (1 : ℝ) := by - change ‖x‖ ≤ (1 : ℝ) -- exact (mem_closedBall_zero_iff.mp hx) -+ simpa only [Metric.mem_closedBall,dist_zero_right x] using hx - have hmod : - ∀ t : E, t ∈ Metric.ball (0 : E) (ε / 2) → - ‖(translateL2 (μ := (volume : Measure E)) (-t)) (T x) - T x‖ ≤ ε / 2 := by - intro t ht - have ht' : ‖t‖ ≤ ε / 2 := le_of_lt (by -- simpa [Metric.ball, dist_eq_norm, mem_setOf_eq] using ht) -+ simpa [Metric.ball, dist_eq_norm, mem_ofPred_eq] using ht) - have hgrad_le : - ‖h1ToL2Grad (μ := (volume : Measure E)) (E := E) (x : H1vol)‖ ≤ ‖(x : H1vol)‖ := by - let V : Type _ := (E →₂[(volume : Measure E)] ℝ) × (E →₂[(volume : Measure E)] E) -@@ -192,7 +188,7 @@ theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : Measur - have hη : 0 ≤ ε / 2 := le_of_lt hδ - have hbound := - L2Compactness.integral_norm_sq_translateL2_sub_le_sq_of_tsupport_subset_ball -- (E := E) (ψ := ψ) hψc hψcs hψ0 hψint (δ := ε / 2) (η := ε / 2) hη hψsupp (T x) hmod -+ (E := E) (ψ := ψ) hψc hψcs hψ0 hψint (deltaLoss := ε / 2) (η := ε / 2) hη hψsupp (T x) hmod - simpa [hxEq] using hbound - have hcomp : IsCompact (closure (T '' Metric.closedBall (0 : ↥(h1On (E := E) K hKm)) 1)) := by - have hR : 0 ≤ C := hCnonneg -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Translation.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Translation.lean -index c009eb8..f3b80d4 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Translation.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Translation.lean -@@ -1,15 +1,15 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1 --import Mathlib.Analysis.Calculus.FDeriv.Add --import Mathlib.MeasureTheory.Group.Measure --import Mathlib.MeasureTheory.Function.LpSpace.Basic --import Mathlib.Topology.Algebra.Group.Basic -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1 -+import Mathlib.Analysis.Calculus.FDeriv.Add -+import Mathlib.MeasureTheory.Group.Measure -+import Mathlib.MeasureTheory.Function.LpSpace.Basic -+import Mathlib.Topology.Algebra.Group.Basic -+ - /-! - # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation` - -@@ -47,20 +47,21 @@ omit [CompleteSpace E] in - lemma contDiff_translate {f : E → ℝ} (hf : ContDiff ℝ 1 f) (a : E) : - ContDiff ℝ 1 (translate (E := E) a f) := by - -- `x ↦ x + a` is `C^∞`; compose. -- simpa [translate] using hf.comp (contDiff_id.add contDiff_const) -+ exact hf.comp (contDiff_id.add contDiff_const) - - omit [InnerProductSpace ℝ E] [CompleteSpace E] in - lemma hasCompactSupport_translate {F : Type*} [Zero F] {f : E → F} - (hf : HasCompactSupport f) (a : E) : HasCompactSupport (translate (E := E) a f) := by -- simpa [translate] using hf.comp_homeomorph (Homeomorph.addRight a) -+ exact hf.comp_homeomorph (Homeomorph.addRight a) - - lemma grad_translate (a : E) (f : E → ℝ) (x : E) : - grad (E := E) (translate (E := E) a f) x = grad (E := E) f (x + a) := by - classical - -- `fderiv` commutes with translation, hence so does `grad`. -- simp [grad] -- -- Reduce to the standard `fderiv` translation lemma. -- simpa [translate] using (fderiv_comp_add_right (𝕜 := ℝ) (f := f) (x := x) a) -+ -- Reduce to the standard `fderiv` translation lemma, applied under the Riesz dual map. -+ have hfderiv : fderiv ℝ (translate (E := E) a f) x = fderiv ℝ f (x + a) := -+ fderiv_comp_add_right (𝕜 := ℝ) (f := f) (x := x) a -+ simp only [grad, hfderiv] - - omit [CompleteSpace E] in - lemma mem_C1c_translate {f : E → ℝ} (hf : f ∈ C1c (E := E)) (a : E) : -@@ -83,11 +84,12 @@ section Measure - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] - --local instance instMeasurableSpaceE_SobolevEuclideanTranslation : MeasurableSpace E := borel E --local instance instBorelSpaceE_SobolevEuclideanTranslation : BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_SobolevEuclideanTranslation : OpensMeasurableSpace E := by -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceTranslation : MeasurableSpace E := borel E -+local instance instBorelSpaceTranslation : BorelSpace E := ⟨rfl⟩ -+local instance instOpensMeasurableSpaceTranslation : OpensMeasurableSpace E := by - infer_instance --local instance instMeasurableAddE_SobolevEuclideanTranslation : MeasurableAdd E := by -+local instance instMeasurableAddTranslation : MeasurableAdd E := by - infer_instance - - variable (μ : Measure E) [μ.IsAddRightInvariant] -@@ -106,7 +108,7 @@ lemma translateL2_ae_eq {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] ( - (translateL2 (μ := μ) (F := F) a g : E → F) =ᵐ[μ] fun x => (g : E → F) (x + a) := by - classical - -- Reduce to `Lp.coeFn_compMeasurePreserving`. -- simpa [translateL2] using -+ exact - (MeasureTheory.Lp.coeFn_compMeasurePreserving (g := (g : MeasureTheory.Lp F (2 : ENNReal) μ)) - (hf := MeasureTheory.measurePreserving_add_right μ a)) - -@@ -125,7 +127,7 @@ lemma translateL2_toL2 (a : E) (f : ↥(C1c (E := E))) : - have hf' : - (fun x => (toL2 (μ := μ) (E := E) f : E → ℝ) (x + a)) =ᵐ[μ] fun x => f.1 (x + a) := by - -- Move the a.e. equality through a measure-preserving map. -- simpa [Function.comp, Pi.add_apply] using -+ exact - (Measure.QuasiMeasurePreserving.ae_eq_comp - (MeasureTheory.measurePreserving_add_right μ a).quasiMeasurePreserving hf) - exact (translateL2_ae_eq (μ := μ) (F := ℝ) a (toL2 (μ := μ) (E := E) f)).trans hf' -@@ -133,7 +135,7 @@ lemma translateL2_toL2 (a : E) (f : ↥(C1c (E := E))) : - (toL2 (μ := μ) (E := E) (translateC1c (E := E) a f) : E → ℝ) =ᵐ[μ] - fun x => f.1 (x + a) := by - -- `toL2` agrees a.e. with the underlying translated function. -- simpa [translateC1c, translate] using -+ exact - (memLp_of_mem_C1c (μ := μ) (E := E) (translateC1c (E := E) a f).2).coeFn_toLp - exact h₁.trans h₂.symm - -@@ -150,7 +152,7 @@ lemma translateL2_toL2Grad (a : E) (f : ↥(C1c (E := E))) : - have hf' : - (fun x => (toL2Grad (μ := μ) (E := E) f : E → E) (x + a)) =ᵐ[μ] - fun x => grad (E := E) f.1 (x + a) := by -- simpa [Function.comp, Pi.add_apply] using -+ exact - (Measure.QuasiMeasurePreserving.ae_eq_comp - (MeasureTheory.measurePreserving_add_right μ a).quasiMeasurePreserving hf) - exact -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimate.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimate.lean -index fcec373..7556a69 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimate.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimate.lean -@@ -1,15 +1,15 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1 --import Mathlib.MeasureTheory.Integral.IntervalIntegral.ContDiff --import Mathlib.Analysis.Calculus.Deriv.Comp --import Mathlib.Analysis.Calculus.Deriv.Mul --import Mathlib.Analysis.Calculus.Deriv.Add -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1 -+import Mathlib.MeasureTheory.Integral.IntervalIntegral.ContDiff -+import Mathlib.Analysis.Calculus.Deriv.Comp -+import Mathlib.Analysis.Calculus.Deriv.Mul -+import Mathlib.Analysis.Calculus.Deriv.Add -+ - /-! - # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimate` - -@@ -35,11 +35,12 @@ section - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] - --local instance instMeasurableSpaceE_SobolevEuclideanTranslationEstimate : -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceTranslationEstimate : - MeasurableSpace E := borel E --local instance instBorelSpaceE_SobolevEuclideanTranslationEstimate : -+local instance instBorelSpaceTranslationEstimate : - BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_SobolevEuclideanTranslationEstimate : -+local instance instOpensMeasurableSpaceTranslationEstimate : - OpensMeasurableSpace E := by - infer_instance - -@@ -85,10 +86,11 @@ lemma enorm_fderiv_apply_le_enorm_grad_mul (f : E → ℝ) (x a : E) : - -- Use the operator norm bound, then identify `‖fderiv‖` with `‖grad‖` via the Riesz isometry. - have h₁ : - ‖fderiv ℝ f x a‖ₑ ≤ ‖fderiv ℝ f x‖ₑ * ‖a‖ₑ := -- (ContinuousLinearMap.le_opNorm_enorm (f := fderiv ℝ f x) a) -+ (ContinuousLinearMap.le_opENorm (f := fderiv ℝ f x) a) - have h₂ : ‖grad (E := E) f x‖ₑ = ‖fderiv ℝ f x‖ₑ := by - -- `grad f x = (toDual).symm (fderiv f x)` and `toDual.symm` is an isometry. -- simpa [grad] using -+ simp only [grad] -+ exact - (LinearIsometry.enorm_map - (f := (InnerProductSpace.toDual ℝ E).symm.toLinearIsometry) - (fderiv ℝ f x)) -@@ -108,10 +110,10 @@ lemma enorm_deriv_comp_line_le (x a : E) {f : E → ℝ} (hf : ContDiff ℝ 1 f) - - lemma enorm_sub_le_enorm_mul_lintegral_grad (x a : E) {f : E → ℝ} (hf : ContDiff ℝ 1 f) : - ‖f (x + a) - f x‖ₑ ≤ -- ‖a‖ₑ * ∫⁻ t in Icc (0 : ℝ) 1, ‖grad (E := E) f (x + t • a)‖ₑ := by -+ ‖a‖ₑ * ∫⁻ t in Set.Icc (0 : ℝ) 1, ‖grad (E := E) f (x + t • a)‖ₑ := by - -- Apply FTC along the segment `t ↦ x + t • a`, then bound the derivative pointwise. - have hCont : -- ContDiffOn ℝ 1 (fun t : ℝ => f (x + t • a)) (Icc (0 : ℝ) 1) := by -+ ContDiffOn ℝ 1 (fun t : ℝ => f (x + t • a)) (Set.Icc (0 : ℝ) 1) := by - -- `t ↦ x + t • a` is `C^∞`; compose with `f`. - have hInner : ContDiff ℝ ⊤ (fun t : ℝ => x + t • a) := by - simpa [line] using -@@ -119,14 +121,14 @@ lemma enorm_sub_le_enorm_mul_lintegral_grad (x a : E) {f : E → ℝ} (hf : Cont - have hInner' : ContDiff ℝ 1 (fun t : ℝ => x + t • a) := hInner.of_le (by simp) - exact (hf.comp hInner').contDiffOn - have hFTC : -- ‖f (x + a) - f x‖ₑ ≤ ∫⁻ t in Icc (0 : ℝ) 1, ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ := by -+ ‖f (x + a) - f x‖ₑ ≤ ∫⁻ t in Set.Icc (0 : ℝ) 1, ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ := by - simpa using - (enorm_sub_le_lintegral_deriv_of_contDiffOn_Icc (f := fun t : ℝ => f (x + t • a)) - (a := (0 : ℝ)) (b := 1) hCont (by exact zero_le_one)) - refine hFTC.trans ?_ - have hDerivBound : - (fun t : ℝ => ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ) -- ≤ᵐ[Measure.restrict volume (Icc (0 : ℝ) 1)] -+ ≤ᵐ[Measure.restrict volume (Set.Icc (0 : ℝ) 1)] - fun t : ℝ => ‖a‖ₑ * ‖grad (E := E) f (x + t • a)‖ₑ := by - -- Pointwise bound holds everywhere. - refine (ae_of_all _ fun t => ?_) -@@ -135,8 +137,8 @@ lemma enorm_sub_le_enorm_mul_lintegral_grad (x a : E) {f : E → ℝ} (hf : Cont - (enorm_deriv_comp_line_le (x := x) (a := a) (f := f) hf (t := t)) - -- Pull out the constant `‖a‖ₑ`. - have : -- (∫⁻ t in Icc (0 : ℝ) 1, ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ) ≤ -- ∫⁻ t in Icc (0 : ℝ) 1, ‖a‖ₑ * ‖grad (E := E) f (x + t • a)‖ₑ := by -+ (∫⁻ t in Set.Icc (0 : ℝ) 1, ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ) ≤ -+ ∫⁻ t in Set.Icc (0 : ℝ) 1, ‖a‖ₑ * ‖grad (E := E) f (x + t • a)‖ₑ := by - exact lintegral_mono_ae hDerivBound - refine this.trans ?_ - -- Pull out the constant factor. -@@ -151,10 +153,10 @@ lemma enorm_sub_le_enorm_mul_lintegral_grad (x a : E) {f : E → ℝ} (hf : Cont - have : Continuous (fun t : ℝ => x + t • a) := by - fun_prop - exact this)).measurable.enorm -- -- Now finish: `∫⁻ t in Icc, ‖a‖ * g t = ‖a‖ * ∫⁻ t in Icc, g t`. -+ -- Now finish: `∫⁻ t in Set.Icc, ‖a‖ * g t = ‖a‖ * ∫⁻ t in Set.Icc, g t`. - exact le_of_eq <| by - simpa [mul_assoc] using -- (MeasureTheory.lintegral_const_mul (μ := volume.restrict (Icc (0 : ℝ) 1)) (r := ‖a‖ₑ) -+ (MeasureTheory.lintegral_const_mul (μ := volume.restrict (Set.Icc (0 : ℝ) 1)) (r := ‖a‖ₑ) - (f := fun t : ℝ => ‖grad (E := E) f (x + t • a)‖ₑ) hMeas) - - end -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateH1.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateH1.lean -index 6bac2f7..4e7144c 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateH1.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateH1.lean -@@ -1,12 +1,12 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateL2 --import Mathlib.Topology.Order.OrderClosed -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateL2 -+import Mathlib.Topology.Order.OrderClosed -+ - /-! - # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateH1` - -@@ -33,14 +33,15 @@ section - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] - --local instance instMeasurableSpaceE_SobolevEuclideanTranslationEstimateH1 : -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceTranslationEstimateH1 : - MeasurableSpace E := borel E --local instance instBorelSpaceE_SobolevEuclideanTranslationEstimateH1 : -+local instance instBorelSpaceTranslationEstimateH1 : - BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_SobolevEuclideanTranslationEstimateH1 : -+local instance instOpensMeasurableSpaceTranslationEstimateH1 : - OpensMeasurableSpace E := by - infer_instance --local instance instMeasurableAddE_SobolevEuclideanTranslationEstimateH1 : MeasurableAdd E := by -+local instance instMeasurableAddTranslationEstimateH1 : MeasurableAdd E := by - infer_instance - - variable (μ : Measure E) [μ.IsAddRightInvariant] [IsFiniteMeasureOnCompacts μ] [SFinite μ] -@@ -73,14 +74,14 @@ theorem norm_translateL2_sub_h1ToL2_le (a : E) (u : ↥(h1 (μ := μ) (E := E))) - have hsub : - Continuous fun v : V => - translateL2 (μ := μ) (F := ℝ) a v.1 - v.1 := by -- simpa [sub_eq_add_neg] using htr.sub hfst -- simpa using (continuous_norm.comp hsub) -+ exact htr.sub hfst -+ exact (continuous_norm.comp hsub) - have hg : - Continuous fun v : V => - ‖a‖ * ‖v.2‖ := by - have hsnd : Continuous fun v : V => v.2 := continuous_snd - have hnorm : Continuous fun v : V => ‖v.2‖ := continuous_norm.comp hsnd -- simpa [mul_assoc] using (continuous_const.mul hnorm) -+ exact (continuous_const.mul hnorm) - exact isClosed_le hf hg - have hRange : (LinearMap.range (graph (μ := μ) (E := E)) : Set V) ⊆ S := by - rintro v ⟨f, rfl⟩ -diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateL2.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateL2.lean -index 9a903af..0264ad8 100644 ---- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateL2.lean -+++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateL2.lean -@@ -1,14 +1,14 @@ --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation --import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimate --import Mathlib.MeasureTheory.Integral.MeanInequalities --import Mathlib.MeasureTheory.Measure.Prod -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation -+import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimate -+import Mathlib.MeasureTheory.Integral.MeanInequalities -+import Mathlib.MeasureTheory.Measure.Prod -+ - /-! - # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateL2` - -@@ -40,19 +40,20 @@ section - - variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] - --local instance instMeasurableSpaceE_SobolevEuclideanTranslationEstimateL2 : -+/-- Borel σ-algebra on the model space `E`. -/ -+local instance instMeasurableSpaceTranslationEstimateL2 : - MeasurableSpace E := borel E --local instance instBorelSpaceE_SobolevEuclideanTranslationEstimateL2 : -+local instance instBorelSpaceTranslationEstimateL2 : - BorelSpace E := ⟨rfl⟩ --local instance instOpensMeasurableSpaceE_SobolevEuclideanTranslationEstimateL2 : -+local instance instOpensMeasurableSpaceTranslationEstimateL2 : - OpensMeasurableSpace E := by - infer_instance --local instance instMeasurableAddE_SobolevEuclideanTranslationEstimateL2 : MeasurableAdd E := by -+local instance instMeasurableAddTranslationEstimateL2 : MeasurableAdd E := by - infer_instance - - variable (μ : Measure E) [μ.IsAddRightInvariant] [IsFiniteMeasureOnCompacts μ] [SFinite μ] - --private abbrev μI : Measure ℝ := (volume.restrict (Icc (0 : ℝ) 1)) -+private abbrev μI : Measure ℝ := (volume.restrict (Set.Icc (0 : ℝ) 1)) - - private lemma μI_univ : (μI : Measure ℝ) Set.univ = (1 : ℝ≥0∞) := by - simp [μI, Measure.restrict_apply, Real.volume_Icc] -@@ -92,7 +93,143 @@ private lemma lintegral_rpow_two_le_lintegral_rpow_two - (∫⁻ t, g t ^ (2 : ℝ) ∂(μI : Measure ℝ)) - (1 / (2 : ℝ)) (2 : ℝ)).symm)) - -+omit [IsFiniteMeasureOnCompacts μ] in - /-- `L²` translation estimate for `C¹_c` functions under a right-invariant measure. -/ -+private lemma lintegral_enorm_sub_sq_le (a : E) (f : ↥(C1c (E := E))) : -+ (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ≤ -+ ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by -+ -- Pointwise: Cauchy–Schwarz in `t`, then Tonelli in `(x,t)`. -+ have hpt : -+ ∀ x : E, -+ ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ≤ -+ ‖a‖ₑ ^ (2 : ℝ) * -+ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) := by -+ intro x -+ have h0 := enorm_sub_le_enorm_mul_lintegral_grad (E := E) (x := x) (a := a) (f := f.1) -+ (hf := f.2.1) -+ -- Square both sides and apply Cauchy–Schwarz in `t`. -+ have h1 : -+ ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ≤ -+ (‖a‖ₑ * ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := by -+ exact ENNReal.rpow_le_rpow h0 (by norm_num) -+ have hcs : -+ (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) ≤ -+ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) := by -+ refine lintegral_rpow_two_le_lintegral_rpow_two (g := fun t : ℝ => -+ ‖grad (E := E) f.1 (x + t • a)‖ₑ) ?_ -+ -- measurability from continuity of `grad`. -+ have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 -+ have hline : Continuous fun t : ℝ => x + t • a := by -+ fun_prop -+ exact (hgrad.comp hline).measurable.enorm.aemeasurable -+ -- Combine and rewrite. -+ calc -+ ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) -+ ≤ (‖a‖ₑ * ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := h1 -+ _ = ‖a‖ₑ ^ (2 : ℝ) * -+ (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ -+ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := by -+ simpa using -+ (ENNReal.mul_rpow_of_nonneg ‖a‖ₑ -+ (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ -+ ∂(μI : Measure ℝ)) -+ (show (0 : ℝ) ≤ (2 : ℝ) by norm_num)) -+ _ ≤ ‖a‖ₑ ^ (2 : ℝ) * -+ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) -+ ∂(μI : Measure ℝ) := by -+ gcongr -+ _ = ‖a‖ₑ ^ (2 : ℝ) * -+ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) -+ ∂(μI : Measure ℝ) := rfl -+ -- Integrate over `x` and apply Tonelli to swap integrals. -+ let F : E × ℝ → ℝ≥0∞ := -+ fun z => ‖grad (E := E) f.1 (z.1 + z.2 • a)‖ₑ ^ (2 : ℝ) -+ have hmeas : -+ AEMeasurable -+ F (μ.prod (μI : Measure ℝ)) := by -+ have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 -+ have hcont : Continuous fun z : E × ℝ => z.1 + z.2 • a := by -+ fun_prop -+ have hbase : Measurable fun z : E × ℝ => ‖grad (E := E) f.1 (z.1 + z.2 • a)‖ₑ := by -+ exact (hgrad.comp hcont).measurable.enorm -+ have hpow : Measurable fun r : ℝ≥0∞ => r ^ (2 : ℝ) := -+ (ENNReal.continuous_rpow_const (y := (2 : ℝ))).measurable -+ exact (hpow.comp hbase).aemeasurable -+ have hTonelli : -+ (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) = -+ ∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ) := by -+ -- Tonelli in both orders, via the product measure. -+ have hprod : -+ (∫⁻ z, F z ∂μ.prod (μI : Measure ℝ)) = -+ ∫⁻ x, ∫⁻ t, F (x, t) ∂(μI : Measure ℝ) ∂μ := -+ MeasureTheory.lintegral_prod (μ := μ) (ν := (μI : Measure ℝ)) F hmeas -+ have hprod_symm : -+ (∫⁻ z, F z ∂μ.prod (μI : Measure ℝ)) = -+ ∫⁻ t, ∫⁻ x, F (x, t) ∂μ ∂(μI : Measure ℝ) := -+ MeasureTheory.lintegral_prod_symm (μ := μ) (ν := (μI : Measure ℝ)) F hmeas -+ calc -+ (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) -+ = ∫⁻ z, F z ∂μ.prod (μI : Measure ℝ) := by -+ simpa [F] using hprod.symm -+ _ = ∫⁻ t, ∫⁻ x, F (x, t) ∂μ ∂(μI : Measure ℝ) := hprod_symm -+ _ = ∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ) := by -+ simp [F] -+ -- Now use measure-preserving translation in `x` and evaluate the `t`-integral. -+ have hShift : -+ (∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ)) = -+ ∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ) := by -+ refine MeasureTheory.lintegral_congr fun t => ?_ -+ -- Change of variables `x ↦ x + t•a`. -+ have hmeas' : Measurable fun x : E => ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) := by -+ have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 -+ have hbase : Measurable fun x : E => ‖grad (E := E) f.1 x‖ₑ := hgrad.measurable.enorm -+ have hpow : Measurable fun r : ℝ≥0∞ => r ^ (2 : ℝ) := -+ (ENNReal.continuous_rpow_const (y := (2 : ℝ))).measurable -+ exact hpow.comp hbase -+ simpa [Function.comp, add_assoc] using -+ (MeasureTheory.measurePreserving_add_right μ (t • a)).lintegral_comp (μ := μ) (ν := μ) -+ (f := fun x : E => ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ)) hmeas' -+ have hEval : -+ (∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ)) = -+ (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by -+ -- `μI` has total mass `1`. -+ simp [μI, Measure.restrict_apply, Real.volume_Icc] -+ -- Put everything together. -+ have hInt : -+ (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ≤ -+ ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by -+ calc -+ (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) -+ ≤ ∫⁻ x, ‖a‖ₑ ^ (2 : ℝ) * -+ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ := by -+ refine MeasureTheory.lintegral_mono ?_ -+ intro x -+ exact hpt x -+ _ = ‖a‖ₑ ^ (2 : ℝ) * -+ (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) := by -+ -- Pull out the constant using `lintegral_const_mul''`. -+ have hInner : -+ AEMeasurable -+ (fun x : E => -+ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ)) μ := by -+ -- Measurability of the inner integral follows -+ -- from `hmeas` via -+ -- `AEMeasurable.lintegral_prod_right'`. -+ simpa [F] using (hmeas.lintegral_prod_right' (μ := μ) (ν := (μI : Measure ℝ))) -+ simpa [mul_assoc] using -+ (MeasureTheory.lintegral_const_mul'' (μ := μ) (r := ‖a‖ₑ ^ (2 : ℝ)) -+ (f := fun x : E => -+ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ)) hInner) -+ _ = ‖a‖ₑ ^ (2 : ℝ) * -+ (∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ)) := by -+ exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hTonelli -+ _ = ‖a‖ₑ ^ (2 : ℝ) * -+ (∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ)) := by -+ exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hShift -+ _ = ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by -+ exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hEval -+ exact hInt -+ - lemma enorm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : - ‖translateL2 (μ := μ) (F := ℝ) a (toL2 (μ := μ) (E := E) f) - - toL2 (μ := μ) (E := E) f‖ₑ ≤ -@@ -112,7 +249,7 @@ lemma enorm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : - (memLp_of_mem_C1c (μ := μ) (E := E) f.2).coeFn_toLp - have hf' : - (fun x => (toL2 (μ := μ) (E := E) f : E → ℝ) (x + a)) =ᵐ[μ] fun x => f.1 (x + a) := by -- simpa [Function.comp, Pi.add_apply] using -+ exact - (Measure.QuasiMeasurePreserving.ae_eq_comp - (MeasureTheory.measurePreserving_add_right μ a).quasiMeasurePreserving hf) - exact (translateL2_ae_eq (μ := μ) (F := ℝ) a (toL2 (μ := μ) (E := E) f)).trans hf' -@@ -159,144 +296,23 @@ lemma enorm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : - ‖a‖ₑ * MeasureTheory.eLpNorm (fun x : E => grad (E := E) f.1 x) (2 : ℝ≥0∞) μ := by - -- Expand the definition of `eLpNorm` at exponent `2`. - have h2_ne0 : (2 : ℝ≥0∞) ≠ 0 := by simp -- have h2_netop : (2 : ℝ≥0∞) ≠ ∞ := by simp -- simp_rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal -- h2_ne0 h2_netop, ENNReal.toReal_ofNat] at * -+ have h2_netop : (2 : ℝ≥0∞) ≠ (⊤ : ℝ≥0∞) := by simp -+ have hf_meas : MeasureTheory.AEStronglyMeasurable (fun x : E => f.1 x) μ := -+ (memLp_of_mem_C1c (μ := μ) (E := E) f.2).aestronglyMeasurable -+ have hshift_meas : -+ MeasureTheory.AEStronglyMeasurable (fun x : E => f.1 (x + a) - f.1 x) μ := by -+ have hshift : MeasureTheory.AEStronglyMeasurable (fun x : E => f.1 (x + a)) μ := -+ hf_meas.comp_quasiMeasurePreserving -+ (MeasureTheory.measurePreserving_add_right μ a).quasiMeasurePreserving -+ exact hshift.sub hf_meas -+ have hgrad_meas : -+ MeasureTheory.AEStronglyMeasurable (fun x : E => grad (E := E) f.1 x) μ := -+ (memLp_grad_of_mem_C1c (μ := μ) (E := E) f.2).aestronglyMeasurable -+ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal h2_ne0 h2_netop hshift_meas, -+ MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal h2_ne0 h2_netop hgrad_meas, -+ ENNReal.toReal_ofNat] - -- It suffices to compare the squared integrals. -- have hsq : -- (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ≤ -- ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by -- -- Pointwise: Cauchy–Schwarz in `t`, then Tonelli in `(x,t)`. -- have hpt : -- ∀ x : E, -- ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ≤ -- ‖a‖ₑ ^ (2 : ℝ) * -- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) := by -- intro x -- have h0 := enorm_sub_le_enorm_mul_lintegral_grad (E := E) (x := x) (a := a) (f := f.1) -- (hf := f.2.1) -- -- Square both sides and apply Cauchy–Schwarz in `t`. -- have h1 : -- ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ≤ -- (‖a‖ₑ * ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := by -- exact ENNReal.rpow_le_rpow h0 (by norm_num) -- have hcs : -- (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) ≤ -- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) := by -- refine lintegral_rpow_two_le_lintegral_rpow_two (g := fun t : ℝ => -- ‖grad (E := E) f.1 (x + t • a)‖ₑ) ?_ -- -- measurability from continuity of `grad`. -- have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 -- have hline : Continuous fun t : ℝ => x + t • a := by -- fun_prop -- exact (hgrad.comp hline).measurable.enorm.aemeasurable -- -- Combine and rewrite. -- calc -- ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) -- ≤ (‖a‖ₑ * ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := h1 -- _ = ‖a‖ₑ ^ (2 : ℝ) * -- (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ -- ∂(μI : Measure ℝ)) ^ (2 : ℝ) := by -- simpa using -- (ENNReal.mul_rpow_of_nonneg ‖a‖ₑ -- (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ -- ∂(μI : Measure ℝ)) -- (show (0 : ℝ) ≤ (2 : ℝ) by norm_num)) -- _ ≤ ‖a‖ₑ ^ (2 : ℝ) * -- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) -- ∂(μI : Measure ℝ) := by -- gcongr -- _ = ‖a‖ₑ ^ (2 : ℝ) * -- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) -- ∂(μI : Measure ℝ) := rfl -- -- Integrate over `x` and apply Tonelli to swap integrals. -- let F : E × ℝ → ℝ≥0∞ := -- fun z => ‖grad (E := E) f.1 (z.1 + z.2 • a)‖ₑ ^ (2 : ℝ) -- have hmeas : -- AEMeasurable -- F (μ.prod (μI : Measure ℝ)) := by -- have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 -- have hcont : Continuous fun z : E × ℝ => z.1 + z.2 • a := by -- fun_prop -- have hbase : Measurable fun z : E × ℝ => ‖grad (E := E) f.1 (z.1 + z.2 • a)‖ₑ := by -- exact (hgrad.comp hcont).measurable.enorm -- have hpow : Measurable fun r : ℝ≥0∞ => r ^ (2 : ℝ) := -- (ENNReal.continuous_rpow_const (y := (2 : ℝ))).measurable -- simpa [F] using (hpow.comp hbase).aemeasurable -- have hTonelli : -- (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) = -- ∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ) := by -- -- Tonelli in both orders, via the product measure. -- have hprod : -- (∫⁻ z, F z ∂μ.prod (μI : Measure ℝ)) = -- ∫⁻ x, ∫⁻ t, F (x, t) ∂(μI : Measure ℝ) ∂μ := -- MeasureTheory.lintegral_prod (μ := μ) (ν := (μI : Measure ℝ)) F hmeas -- have hprod_symm : -- (∫⁻ z, F z ∂μ.prod (μI : Measure ℝ)) = -- ∫⁻ t, ∫⁻ x, F (x, t) ∂μ ∂(μI : Measure ℝ) := -- MeasureTheory.lintegral_prod_symm (μ := μ) (ν := (μI : Measure ℝ)) F hmeas -- calc -- (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) -- = ∫⁻ z, F z ∂μ.prod (μI : Measure ℝ) := by -- simpa [F] using hprod.symm -- _ = ∫⁻ t, ∫⁻ x, F (x, t) ∂μ ∂(μI : Measure ℝ) := hprod_symm -- _ = ∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ) := by -- simp [F] -- -- Now use measure-preserving translation in `x` and evaluate the `t`-integral. -- have hShift : -- (∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ)) = -- ∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ) := by -- refine MeasureTheory.lintegral_congr fun t => ?_ -- -- Change of variables `x ↦ x + t•a`. -- have hmeas' : Measurable fun x : E => ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) := by -- have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 -- have hbase : Measurable fun x : E => ‖grad (E := E) f.1 x‖ₑ := hgrad.measurable.enorm -- have hpow : Measurable fun r : ℝ≥0∞ => r ^ (2 : ℝ) := -- (ENNReal.continuous_rpow_const (y := (2 : ℝ))).measurable -- exact hpow.comp hbase -- simpa [Function.comp, add_assoc] using -- (MeasureTheory.measurePreserving_add_right μ (t • a)).lintegral_comp (μ := μ) (ν := μ) -- (f := fun x : E => ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ)) hmeas' -- have hEval : -- (∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ)) = -- (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by -- -- `μI` has total mass `1`. -- simp [μI, Measure.restrict_apply, Real.volume_Icc] -- -- Put everything together. -- have hInt : -- (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ≤ -- ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by -- calc -- (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) -- ≤ ∫⁻ x, ‖a‖ₑ ^ (2 : ℝ) * -- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ := by -- refine MeasureTheory.lintegral_mono ?_ -- intro x -- exact hpt x -- _ = ‖a‖ₑ ^ (2 : ℝ) * -- (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) := by -- -- Pull out the constant using `lintegral_const_mul''`. -- have hInner : -- AEMeasurable -- (fun x : E => -- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ)) μ := by -- -- Measurability of the inner integral follows -- -- from `hmeas` via -- -- `AEMeasurable.lintegral_prod_right'`. -- simpa [F] using (hmeas.lintegral_prod_right' (μ := μ) (ν := (μI : Measure ℝ))) -- simpa [mul_assoc] using -- (MeasureTheory.lintegral_const_mul'' (μ := μ) (r := ‖a‖ₑ ^ (2 : ℝ)) -- (f := fun x : E => -- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ)) hInner) -- _ = ‖a‖ₑ ^ (2 : ℝ) * -- (∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ)) := by -- exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hTonelli -- _ = ‖a‖ₑ ^ (2 : ℝ) * -- (∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ)) := by -- exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hShift -- _ = ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by -- exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hEval -- exact hInt -+ have hsq := lintegral_enorm_sub_sq_le (μ := μ) a f - -- Take the `1/2` power on both sides and simplify. - have hsq' : - (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ^ (1 / (2 : ℝ)) ≤ -@@ -333,12 +349,12 @@ lemma norm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : - have h := enorm_translateL2_sub_toL2_le (μ := μ) (E := E) a f - have hA_ne_top : - (‖translateL2 (μ := μ) (F := ℝ) a (toL2 (μ := μ) (E := E) f) - -- toL2 (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ ∞ := by -+ toL2 (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ (⊤ : ℝ≥0∞) := by - simp [enorm] - have hGrad_ne_top : -- (‖toL2Grad (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ ∞ := by -+ (‖toL2Grad (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ (⊤ : ℝ≥0∞) := by - simp [enorm] -- have hB_ne_top : (‖a‖ₑ * ‖toL2Grad (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ ∞ := by -+ have hB_ne_top : (‖a‖ₑ * ‖toL2Grad (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ (⊤ : ℝ≥0∞) := by - refine ENNReal.mul_ne_top ?_ hGrad_ne_top - simp [enorm] - have h' : -@@ -346,7 +362,7 @@ lemma norm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : - toL2 (μ := μ) (E := E) f‖ₑ).toReal ≤ - (‖a‖ₑ * ‖toL2Grad (μ := μ) (E := E) f‖ₑ).toReal := by - exact (ENNReal.toReal_le_toReal hA_ne_top hB_ne_top).2 h -- simpa [ENNReal.toReal_mul, toReal_enorm'] using h' -+ simpa only [ENNReal.toReal_mul, toReal_enorm] using h' - - end - -diff --git a/RellichKondrachov/MeasureTheory/Function/LpSpace/Restrict.lean b/RellichKondrachov/MeasureTheory/Function/LpSpace/Restrict.lean -index bb9c6e5..5d1561e 100644 ---- a/RellichKondrachov/MeasureTheory/Function/LpSpace/Restrict.lean -+++ b/RellichKondrachov/MeasureTheory/Function/LpSpace/Restrict.lean -@@ -1,16 +1,16 @@ --import Mathlib.MeasureTheory.Function.LpSeminorm.Basic --import Mathlib.MeasureTheory.Function.LpSpace.Basic -- - /- - Copyright (c) 2026 Adam Benenson. All rights reserved. - Released under Apache 2.0 license as described in the file LICENSE. - Authors: Adam Benenson - -/ - -+import Mathlib.MeasureTheory.Function.LpSeminorm.Basic -+import Mathlib.MeasureTheory.Function.LpSpace.Basic -+ - /-! - # `RellichKondrachov.MeasureTheory.Function.LpSpace.Restrict` - --`L^p` extension-by-zero maps for restricted measures. -+`«L»^p` extension-by-zero maps for restricted measures. - - Mathlib provides the equivalence - -@@ -42,7 +42,8 @@ variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] - variable {p : ℝ≥0∞} [Fact (1 ≤ p)] - variable {s : Set α} (hs : MeasurableSet s) - --private noncomputable def extendByZeroFun (f : Lp E p (μ.restrict s)) : Lp E p μ := -+/-- Extend an Lp function from a restricted measure by zero outside the set. -/ -+noncomputable def extendByZeroFun (f : Lp E p (μ.restrict s)) : Lp E p μ := - let hf : MemLp (fun x : α => f x) p (μ.restrict s) := Lp.memLp f - let hfi : MemLp (s.indicator fun x : α => f x) p μ := - (memLp_indicator_iff_restrict (μ := μ) (p := p) (s := s) (f := fun x : α => f x) hs).2 hf -@@ -63,7 +64,7 @@ noncomputable def extendByZeroₗ : Lp E p (μ.restrict s) →ₗ[ℝ] Lp E p μ - refine Lp.ext ?_ - have h_add_restrict : - (fun x : α => (f + g) x) =ᵐ[μ.restrict s] fun x : α => f x + g x := by -- simpa using (Lp.coeFn_add (μ := μ.restrict s) f g) -+ exact (Lp.coeFn_add (μ := μ.restrict s) f g) - have h_add_on : - ∀ᵐ x : α ∂μ, x ∈ s → (f + g) x = f x + g x := - (ae_restrict_iff' (μ := μ) (s := s) hs).1 h_add_restrict -@@ -95,8 +96,7 @@ noncomputable def extendByZeroₗ : Lp E p (μ.restrict s) →ₗ[ℝ] Lp E p μ - simp [hf, hg] - _ = (extendByZeroFun (μ := μ) (p := p) (s := s) hs f + - extendByZeroFun (μ := μ) (p := p) (s := s) hs g) x := hadd' -- · -- have hadd' : -+ · have hadd' : - extendByZeroFun (μ := μ) (p := p) (s := s) hs f x + - extendByZeroFun (μ := μ) (p := p) (s := s) hs g x = - (extendByZeroFun (μ := μ) (p := p) (s := s) hs f + -@@ -117,7 +117,7 @@ noncomputable def extendByZeroₗ : Lp E p (μ.restrict s) →ₗ[ℝ] Lp E p μ - refine Lp.ext ?_ - have h_smul_restrict : - (fun x : α => (c • f) x) =ᵐ[μ.restrict s] fun x : α => c • f x := by -- simpa using (Lp.coeFn_smul (μ := μ.restrict s) c f) -+ exact (Lp.coeFn_smul (μ := μ.restrict s) c f) - have h_smul_on : - ∀ᵐ x : α ∂μ, x ∈ s → (c • f) x = c • f x := - (ae_restrict_iff' (μ := μ) (s := s) hs).1 h_smul_restrict -@@ -141,8 +141,7 @@ noncomputable def extendByZeroₗ : Lp E p (μ.restrict s) →ₗ[ℝ] Lp E p μ - _ = c • s.indicator (fun x : α => f x) x := by simp [Set.indicator_of_mem, hx] - _ = c • extendByZeroFun (μ := μ) (p := p) (s := s) hs f x := by simp [hf] - _ = (c • extendByZeroFun (μ := μ) (p := p) (s := s) hs f) x := hsmul' -- · -- have hsmul' : -+ · have hsmul' : - c • extendByZeroFun (μ := μ) (p := p) (s := s) hs f x = - (c • extendByZeroFun (μ := μ) (p := p) (s := s) hs f) x := by - simpa [Pi.smul_apply] using hsmul.symm +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/H1.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/H1.lean +index fcec4d8..6fa9227 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/H1.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/H1.lean +@@ -1,3 +1,9 @@ ++/- ++Copyright (c) 2026 Adam Benenson. All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Adam Benenson ++-/ ++ + import Mathlib.Analysis.Calculus.ContDiff.Operations + import Mathlib.Analysis.Calculus.FDeriv.Const + import Mathlib.Analysis.InnerProductSpace.Dual +@@ -5,12 +11,6 @@ import Mathlib.MeasureTheory.Function.LpSpace.Complete + import Mathlib.MeasureTheory.Function.LpSpace.Indicator + import Mathlib.Topology.Algebra.Support + +-/- +-Copyright (c) 2026 Adam Benenson. All rights reserved. +-Released under Apache 2.0 license as described in the file LICENSE. +-Authors: Adam Benenson +--/ +- + /-! + # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1` + +@@ -55,15 +55,19 @@ section + variable + {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] + +-local instance : MeasurableSpace E := borel E +-local instance : BorelSpace E := ⟨rfl⟩ +-local instance : OpensMeasurableSpace E := by infer_instance ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceH1 : MeasurableSpace E := borel E ++local instance instBorelSpaceH1 : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceH1 : OpensMeasurableSpace E := by infer_instance + + variable (μ : Measure E) [IsFiniteMeasureOnCompacts μ] + +-private abbrev L2ℝ : Type _ := ↥(E →₂[μ] ℝ) +-private abbrev L2E : Type _ := ↥(E →₂[μ] E) +-private abbrev H1Target : Type _ := L2ℝ (μ := μ) × L2E (μ := μ) ++/-- The space of square-integrable real-valued functions. -/ ++abbrev L2ℝ : Type _ := ↥(E →₂[μ] ℝ) ++/-- The space of square-integrable vector-valued functions. -/ ++abbrev L2E : Type _ := ↥(E →₂[μ] E) ++/-- The product space containing a function and its first derivative. -/ ++abbrev H1Target : Type _ := L2ℝ (μ := μ) × L2E (μ := μ) + + /-- `C¹` real-valued functions on `E` with compact support, as a submodule of `E → ℝ`. -/ + def C1c : Submodule ℝ (E → ℝ) where +@@ -78,7 +82,7 @@ def C1c : Submodule ℝ (E → ℝ) where + intro c f hf + refine ⟨hf.1.const_smul c, ?_⟩ + -- `HasCompactSupport` is stable under pointwise scalar multiplication. +- simpa using (HasCompactSupport.smul_left (f := fun _ : E => c) hf.2) ++ exact (HasCompactSupport.smul_left (f := fun _ : E => c) hf.2) + + /-- The pointwise gradient (as an `E`-valued function), via Riesz representation. -/ + noncomputable def grad (f : E → ℝ) : E → E := +@@ -88,21 +92,21 @@ lemma continuous_grad {f : E → ℝ} (hf : ContDiff ℝ 1 f) : Continuous (grad + have hcont : Continuous (fderiv ℝ f) := hf.continuous_fderiv one_ne_zero + have : Continuous fun x => (InnerProductSpace.toDual ℝ E).symm (fderiv ℝ f x) := + (InnerProductSpace.toDual ℝ E).symm.continuous.comp hcont +- simpa [grad] using this ++ exact this + + lemma hasCompactSupport_grad {f : E → ℝ} (hf : HasCompactSupport f) : + HasCompactSupport (grad (E := E) f) := by + -- Outside the support of `f`, `fderiv` is identically `0`, hence so is `grad`. + have hf' : HasCompactSupport (fderiv ℝ f) := hf.fderiv ℝ + -- `grad` is composition with a linear map sending `0` to `0`. +- simpa [grad] using ++ exact + (HasCompactSupport.comp_left (f := fderiv ℝ f) (g := (InnerProductSpace.toDual ℝ E).symm) + hf' (by simp)) + + lemma tsupport_grad_subset (f : E → ℝ) : tsupport (grad (E := E) f) ⊆ tsupport f := by + have hcomp : + tsupport (grad (E := E) f) ⊆ tsupport (fderiv ℝ f) := by +- simpa [grad, Function.comp] using ++ exact + (tsupport_comp_subset + (g := (InnerProductSpace.toDual ℝ E).symm) (hg := by simp) + (f := fderiv ℝ f)) +@@ -165,8 +169,8 @@ private lemma toL2_smul (c : ℝ) (f : ↥(C1c (E := E))) : + /-- Linear map sending `C¹_c` functions to their `L²` classes. -/ + noncomputable def toL2Linear : ↥(C1c (E := E)) →ₗ[ℝ] L2ℝ (μ := μ) where + toFun := toL2 (μ := μ) (E := E) +- map_add' := toL2_add (μ := μ) (E := E) +- map_smul' := toL2_smul (μ := μ) (E := E) ++ map_add' := by exact toL2_add (μ := μ) (E := E) ++ map_smul' := by exact toL2_smul (μ := μ) (E := E) + + private lemma toL2Grad_add (f g : ↥(C1c (E := E))) : + toL2Grad (μ := μ) (E := E) (f + g) = +@@ -226,8 +230,8 @@ private lemma toL2Grad_smul (c : ℝ) (f : ↥(C1c (E := E))) : + /-- Linear map sending `C¹_c` functions to the `L²` class of their gradient. -/ + noncomputable def toL2GradLinear : ↥(C1c (E := E)) →ₗ[ℝ] L2E (μ := μ) where + toFun := toL2Grad (μ := μ) (E := E) +- map_add' := toL2Grad_add (μ := μ) (E := E) +- map_smul' := toL2Grad_smul (μ := μ) (E := E) ++ map_add' := by exact toL2Grad_add (μ := μ) (E := E) ++ map_smul' := by exact toL2Grad_smul (μ := μ) (E := E) + + /-- The graph map `f ↦ (f, ∇f)` into `L² × L²(E)`. -/ + noncomputable def graph : ↥(C1c (E := E)) →ₗ[ℝ] H1Target (μ := μ) := +@@ -243,7 +247,7 @@ theorem isClosed_h1 : IsClosed (h1 (μ := μ) (E := E) : Set (H1Target (μ := μ + exact Submodule.isClosed_topologicalClosure (LinearMap.range (graph (μ := μ) (E := E))) + + /-- `H¹` is complete (a Hilbert space once the ambient `L²` spaces are). -/ +-instance instCompleteSpace_h1 : CompleteSpace (↥(h1 (μ := μ) (E := E))) := by ++instance instCompleteSpaceh1 : CompleteSpace (↥(h1 (μ := μ) (E := E))) := by + classical + exact (isClosed_h1 (μ := μ) (E := E)).isComplete.completeSpace_coe + +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Approximation.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Approximation.lean +index 1ae0860..e44c3dc 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Approximation.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Approximation.lean +@@ -1,3 +1,9 @@ ++/- ++Copyright (c) 2026 Adam Benenson. All rights reserved. ++Released under Apache 2.0 license as described in the file LICENSE. ++Authors: Adam Benenson ++-/ ++ + import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation + import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Smoothing + import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap +@@ -10,12 +16,6 @@ import Mathlib.MeasureTheory.Measure.Haar.Unique + import Mathlib.MeasureTheory.Function.L2Space + import Mathlib.Probability.Moments.Variance + +-/- +-Copyright (c) 2026 Adam Benenson. All rights reserved. +-Released under Apache 2.0 license as described in the file LICENSE. +-Authors: Adam Benenson +--/ +- + /-! + # `L²` compactness criterion: approximation-by-translation bounds (Euclidean) + +@@ -44,13 +44,14 @@ section Volume + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + +-local instance : MeasurableSpace E := borel E +-local instance : BorelSpace E := ⟨rfl⟩ +-local instance : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceApproximation : MeasurableSpace E := borel E ++local instance instBorelSpaceApproximation : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceApproximation : OpensMeasurableSpace E := by + infer_instance +-local instance : MeasurableAdd E := by ++local instance instMeasurableAddApproximation : MeasurableAdd E := by + infer_instance +-local instance : MeasurableNeg E := by ++local instance instMeasurableNegApproximation : MeasurableNeg E := by + infer_instance + + variable {K : Set E} (hK : IsCompact K) (hKm : MeasurableSet K) +@@ -81,7 +82,9 @@ lemma kernelMeasure_univ (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) ( + -- Conclude using `∫ ψ = 1`. + simpa [hψint] using (hwd.trans hlin) + +-local instance instIsProbabilityMeasure_kernelMeasure ++/-- The kernel measure `kernelMeasure ψ` is a probability measure when `ψ` is a continuous, ++compactly supported, nonnegative density integrating to `1`. -/ ++lemma isProbabilityMeasure_kernelMeasure + (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) + (hψ0 : ∀ x, 0 ≤ ψ x) + (hψint : ∫ x, ψ x ∂(volume : Measure E) = 1) : +@@ -96,7 +99,7 @@ lemma integral_kernelMeasure_eq_integral_smul (hψc : Continuous ψ) (hψ0 : ∀ + (hψc.measurable.ennreal_ofReal : Measurable fun x => ENNReal.ofReal (ψ x)) + have htop : + (MeasureTheory.ae (volume : Measure E)).Eventually +- (fun x => ENNReal.ofReal (ψ x) < ∞) := ++ (fun x => ENNReal.ofReal (ψ x) < (⊤ : ℝ≥0∞)) := + Filter.Eventually.of_forall (fun _ => by simp) + have hwd := + (integral_withDensity_eq_integral_toReal_smul (μ := (volume : Measure E)) +@@ -189,7 +192,7 @@ lemma norm_sq_translateL2_sub_extendByZeroL2_eq_integral_sq (t : E) + MeasureTheory.MeasurePreserving (fun x : E => x - t) + (volume : Measure E) (volume : Measure E) := + MeasureTheory.measurePreserving_sub_right (μ := (volume : Measure E)) t +- simpa [Function.comp] using (hmp.quasiMeasurePreserving.ae_eq_comp hF_ae) ++ exact (hmp.quasiMeasurePreserving.ae_eq_comp hF_ae) + -- TranslateL2 gives `F(x - t)` a.e. + have htrans : + ((translateL2 (μ := (volume : Measure E)) (-t)) F : E → ℝ) =ᵐ[(volume : Measure E)] +@@ -221,7 +224,7 @@ lemma norm_sq_translateL2_sub_extendByZeroL2_eq_integral_sq (t : E) + ∂(volume : Measure E) = + ∫ x, (f (x - t) - f x) ^ 2 ∂(volume : Measure E) := by + refine MeasureTheory.integral_congr_ae ?_ +- simpa using hdiff.pow_const 2 ++ exact hdiff.pow_const 2 + exact h1.trans h2 + simpa [F, f] using hcalc + +@@ -242,7 +245,7 @@ private lemma kernelMeasure_le_smul_volume (hψc : Continuous ψ) (hψcs : HasCo + simpa [Real.norm_eq_abs, abs_of_nonneg (hψ0 x)] using hx' + exact ENNReal.ofReal_le_ofReal hx + -- Unfold `withDensity` and bound the density by the constant `ENNReal.ofReal C`. +- simp [kernelMeasure, MeasureTheory.withDensity_apply, hs] ++ simp only [kernelMeasure, MeasureTheory.withDensity_apply, hs] + have hle : + (∫⁻ x in s, ENNReal.ofReal (ψ x) ∂(volume : Measure E)) ≤ + ∫⁻ x in s, ENNReal.ofReal C ∂(volume : Measure E) := by +@@ -262,9 +265,9 @@ lemma smoothFun_sub_extendByZeroFun_sq_le_integral_sq + ∂kernelMeasure (E := E) ψ := by + classical + let μ : Measure E := kernelMeasure (E := E) ψ +- haveI : MeasureTheory.IsProbabilityMeasure μ := +- instIsProbabilityMeasure_kernelMeasure (E := E) (ψ := ψ) hψc hψcs hψ0 hψint +- haveI : MeasureTheory.IsFiniteMeasure μ := by infer_instance ++ have : MeasureTheory.IsProbabilityMeasure μ := ++ isProbabilityMeasure_kernelMeasure (E := E) (ψ := ψ) hψc hψcs hψ0 hψint ++ have : MeasureTheory.IsFiniteMeasure μ := by infer_instance + rcases kernelMeasure_le_smul_volume (E := E) (ψ := ψ) hψc hψcs hψ0 with ⟨c, hc_top, hμle⟩ + let f : E → ℝ := extendByZeroFun (E := E) (K := K) u + have hf_vol : MeasureTheory.MemLp f (2 : ℝ≥0∞) (volume : Measure E) := by +@@ -288,7 +291,11 @@ lemma smoothFun_sub_extendByZeroFun_sq_le_integral_sq + (volume : Measure E) (volume : Measure E) := + MeasureTheory.measurePreserving_add_right + (μ := (volume : Measure E)) x +- simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using hadd.comp hneg ++ have hcomp : ((fun y : E => y + x) ∘ fun t : E => -t) = fun t : E => x - t := by ++ funext t ++ simp [sub_eq_add_neg, add_comm] ++ have := hadd.comp hneg ++ rwa [hcomp] at this + have hf_shift_vol : + MeasureTheory.MemLp (fun t : E => f (x - t)) + (2 : ℝ≥0∞) (volume : Measure E) := +@@ -334,10 +341,10 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex + ∂kernelMeasure (E := E) ψ := by + classical + let μ : Measure E := kernelMeasure (E := E) ψ +- haveI : MeasureTheory.IsProbabilityMeasure μ := +- instIsProbabilityMeasure_kernelMeasure (E := E) (ψ := ψ) hψc hψcs hψ0 hψint +- haveI : MeasureTheory.IsFiniteMeasure μ := by infer_instance +- haveI : MeasureTheory.SFinite μ := by infer_instance ++ have : MeasureTheory.IsProbabilityMeasure μ := ++ isProbabilityMeasure_kernelMeasure (E := E) (ψ := ψ) hψc hψcs hψ0 hψint ++ have : MeasureTheory.IsFiniteMeasure μ := by infer_instance ++ have : MeasureTheory.SFinite μ := by infer_instance + let F : (E →₂[(volume : Measure E)] ℝ) := extendByZeroL2 (E := E) (K := K) hKm u + let f : E → ℝ := extendByZeroFun (E := E) (K := K) u + let S : (E →₂[(volume : Measure E)] ℝ) := smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u +@@ -361,7 +368,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex + (∫ x, ((S - F) x) ^ 2 ∂(volume : Measure E)) = + ∫ x, (smoothFun (E := E) (K := K) ψ u x - f x) ^ 2 ∂(volume : Measure E) := by + refine MeasureTheory.integral_congr_ae ?_ +- simpa using hSF_ae.pow_const 2 ++ exact hSF_ae.pow_const 2 + exact h1.trans h2 + have hLHS_int : + MeasureTheory.Integrable (fun x : E => (smoothFun (E := E) (K := K) ψ u x - f x) ^ 2) +@@ -414,7 +421,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex + MeasureTheory.Integrable (fun z : E × E => (f (z.1 - z.2)) ^ 2) + ((volume : Measure E).prod μ) := by + have := (hsub.integrable_comp hf_fst_sq_prod.aestronglyMeasurable).2 hf_fst_sq_prod +- simpa [Function.comp] using this ++ exact this + have hdom : + MeasureTheory.Integrable (fun z : E × E => (2 : ℝ) * ((f (z.1 - z.2)) ^ 2 + (f z.1) ^ 2)) + ((volume : Measure E).prod μ) := by +@@ -426,7 +433,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex + MeasureTheory.AEStronglyMeasurable f + (Measure.map Prod.fst + ((volume : Measure E).prod μ)) := by +- simpa [Measure.map_fst_prod] using hf_mem.1 ++ simpa [Measure.map_fst_prod] using hf_mem.aestronglyMeasurable + exact MeasureTheory.AEStronglyMeasurable.comp_measurable + (μ := (volume : Measure E).prod μ) (f := Prod.fst) + (g := f) hf_map measurable_fst +@@ -436,7 +443,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex + ((volume : Measure E).prod μ) := by + have := MeasureTheory.AEStronglyMeasurable.comp_measurePreserving (g := fun z : E × E => f z.1) + hf_fst_aesm hsub +- simpa [Function.comp] using this ++ exact this + have h_aesm : + MeasureTheory.AEStronglyMeasurable h ((volume : Measure E).prod μ) := by + -- Build up AE-strong measurability from the two components. +@@ -444,7 +451,7 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex + MeasureTheory.AEStronglyMeasurable (fun z : E × E => f (z.1 - z.2) - f z.1) + ((volume : Measure E).prod μ) := + hf_shift_aesm.sub hf_fst_aesm +- simpa [h] using (hsub'.pow 2) ++ exact (hsub'.pow 2) + have hint_h : MeasureTheory.Integrable h ((volume : Measure E).prod μ) := by + refine MeasureTheory.Integrable.mono (μ := (volume : Measure E).prod μ) hdom h_aesm ?_ + refine Filter.Eventually.of_forall ?_ +@@ -507,7 +514,6 @@ lemma norm_sq_smoothL2_sub_extendByZeroL2_le_integral_norm_sq_translateL2_sub_ex + -- Restore the original statement. + simpa [S, F, μ] using hmain + +- + end Volume + + end +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/ArzelaAscoli.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/ArzelaAscoli.lean +index 37fe123..ff15e73 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/ArzelaAscoli.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/ArzelaAscoli.lean +@@ -1,15 +1,15 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Compactness +-import Mathlib.Analysis.Normed.Group.Bounded +-import Mathlib.Topology.ContinuousMap.Bounded.ArzelaAscoli +-import Mathlib.MeasureTheory.Function.L2Space +-import Mathlib.MeasureTheory.Integral.Bochner.Set +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Compactness ++import Mathlib.Analysis.Normed.Group.Bounded ++import Mathlib.Topology.ContinuousMap.Bounded.ArzelaAscoli ++import Mathlib.MeasureTheory.Function.L2Space ++import Mathlib.MeasureTheory.Integral.Bochner.Set ++ + /-! + # `L²` compactness criterion: Arzelà–Ascoli for the smoothing operator (Euclidean) + +@@ -42,13 +42,14 @@ section Volume + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + +-local instance instMeasurableSpaceE_L2CompactnessArzelaAscoli : MeasurableSpace E := borel E +-local instance instBorelSpaceE_L2CompactnessArzelaAscoli : BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_L2CompactnessArzelaAscoli : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceEL2CompactnessArzelaAscoli : MeasurableSpace E := borel E ++local instance instBorelSpaceEL2CompactnessArzelaAscoli : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceEL2CompactnessArzelaAscoli : OpensMeasurableSpace E := by + infer_instance +-local instance instMeasurableAddE_L2CompactnessArzelaAscoli : MeasurableAdd E := by ++local instance instMeasurableAddEL2CompactnessArzelaAscoli : MeasurableAdd E := by + infer_instance +-local instance instMeasurableNegE_L2CompactnessArzelaAscoli : MeasurableNeg E := by ++local instance instMeasurableNegEL2CompactnessArzelaAscoli : MeasurableNeg E := by + infer_instance + + variable {K : Set E} {ψ : E → ℝ} +@@ -110,8 +111,309 @@ private lemma exists_norm_ψ_bound_on_diffSet (hK : IsCompact K) (hψc : Continu + exact ⟨hx, ht⟩ + exact hne ⟨(x : E) - t, this⟩ + ++private lemma smoothFun_image_mem_closedBall (hK : IsCompact K) ++ (hKm : MeasurableSet K) (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) {R : ℝ} ++ (hRpos : 0 < R) (Cψ : ℝ) (hCψ_nonneg : 0 ≤ Cψ) ++ (hψ_bound : ∀ x : ↥(Kψ (K := K) (ψ := ψ)), ∀ t : E, t ∈ K → ‖ψ ((x : E) - t)‖ ≤ Cψ) : ++ let mK : ℝ := ++ (MeasureTheory.measureUnivNNReal (volume.restrict K)) ^ ((2 : ℝ≥0∞).toReal⁻¹) ++ ∀ (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) (x : ↥(Kψ (K := K) (ψ := ψ))), ++ f ∈ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs '' ++ Metric.closedBall (0 : _) R) → ++ f x ∈ Metric.closedBall (0 : ℝ) (R * (mK * Cψ)) := by ++ intro mK ++ classical ++ have hR : 0 ≤ R := hRpos.le ++ have hμK : (volume : Measure E) K < (⊤ : ℝ≥0∞) := hK.measure_lt_top (μ := (volume : Measure E)) ++ have : Fact ((volume : Measure E) K < (⊤ : ℝ≥0∞)) := ⟨hμK⟩ ++ have : IsFiniteMeasure ((volume : Measure E).restrict K) := by infer_instance ++ let μ : Measure E := (volume : Measure E).restrict K ++ have hmK : 0 ≤ mK := by ++ have : 0 ≤ (MeasureTheory.measureUnivNNReal (volume.restrict K)) := by simp ++ exact Real.rpow_nonneg this _ ++ intro f x hfA ++ rcases hfA with ⟨u, hu_ball, rfl⟩ ++ have hu_norm : ‖u‖ ≤ R := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hu_ball ++ -- Build the `L²(K)` kernel element. ++ have hker : ++ MemLp (fun t : E => ψ ((x : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by ++ refine MemLp.of_bound (μ := (volume.restrict K)) ++ (hf := (hψc.aestronglyMeasurable.comp_measurable ++ (measurable_const.sub measurable_id))) Cψ ?_ ++ filter_upwards ++ [MeasureTheory.ae_restrict_mem ++ (μ := (volume : Measure E)) hKm] with t ht ++ exact hψ_bound x t ht ++ let kx : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := ++ hker.toLp (fun t : E => ψ ((x : E) - t)) ++ have hkx_norm : ‖kx‖ ≤ mK * Cψ := by ++ have h_ae : ++ ∀ᵐ t ∂(volume.restrict K), ‖(fun t : E => ψ ((x : E) - t)) t‖ ≤ Cψ := by ++ filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm] with t ht ++ exact hψ_bound x t ht ++ have := (MeasureTheory.Lp.norm_le_of_ae_bound ++ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) ++ (f := kx) (hC := hCψ_nonneg) (by ++ -- transport the bound through the `toLp` representative ++ filter_upwards [h_ae, ++ MeasureTheory.MemLp.coeFn_toLp ++ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) ++ (f := fun t : E => ψ ((x : E) - t)) ++ hker] with t ht hrep ++ simpa [kx, hrep] using ht)) ++ simpa [mK] using this ++ -- Express the smoothing value as an `L²` inner product, then apply Cauchy–Schwarz. ++ have hsmooth : ++ smoothFun (E := E) (K := K) ψ u (x : E) = ++ ∫ t, u t * kx t ∂(volume.restrict K) := by ++ have h_ae : ++ (fun t : E => u t * kx t) =ᵐ[volume.restrict K] fun t : E => u t * ψ ((x : E) - t) := by ++ filter_upwards [MeasureTheory.MemLp.coeFn_toLp ++ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) ++ (f := fun t : E => ψ ((x : E) - t)) ++ hker] with t ht ++ simp [kx, ht] ++ -- rewrite `smoothFun` as an integral on `volume.restrict K` ++ rw [smoothFun_eq_integral_restrict ++ (E := E) (K := K) (ψ := ψ) (hKm := hKm) u (x : E)] ++ exact (MeasureTheory.integral_congr_ae h_ae.symm) ++ have hsmooth' : ++ smoothFun (E := E) (K := K) ψ u (x : E) = ++ ∫ t, kx t * u t ∂(volume.restrict K) := by ++ simp [hsmooth, mul_comm] ++ have hinner : ++ smoothFun (E := E) (K := K) ψ u (x : E) = ++ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) kx := by ++ erw [MeasureTheory.L2.inner_def]; exact hsmooth' ++ have habs : ++ |smoothFun (E := E) (K := K) ψ u (x : E)| ≤ ‖u‖ * ‖kx‖ := by ++ simpa [hinner] using ++ (abs_real_inner_le_norm (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) kx) ++ have habs' : |smoothFun (E := E) (K := K) ψ u (x : E)| ≤ R * (mK * Cψ) := by ++ calc ++ |smoothFun (E := E) (K := K) ψ u (x : E)| ++ ≤ ‖u‖ * ‖kx‖ := habs ++ _ ≤ R * (mK * Cψ) := by ++ exact mul_le_mul hu_norm hkx_norm (norm_nonneg _) hR ++ have : dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) 0 ≤ R * (mK * Cψ) := by ++ simpa [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x, ++ dist_eq_norm, Real.norm_eq_abs] using habs' ++ simpa [Metric.mem_closedBall, dist_eq_norm] using this ++ + /-- Arzelà--Ascoli: smoothing maps `L²(K)` bounded sets into a precompact set + in `BCF(K + tsupport ψ)`. -/ ++private lemma uniformEquicontinuous_smoothBCF_closedBall (hK : IsCompact K) ++ (hKm : MeasurableSet K) (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) {R : ℝ} ++ (hRpos : 0 < R) (Cψ : ℝ) (hCψ_nonneg : 0 ≤ Cψ) ++ (hψ_bound : ∀ x : ↥(Kψ (K := K) (ψ := ψ)), ∀ t : E, t ∈ K → ‖ψ ((x : E) - t)‖ ≤ Cψ) : ++ let A : Set (BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) := ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs '' Metric.closedBall (0 : _) R ++ UniformEquicontinuous ((↑) : A → ↥(Kψ (K := K) (ψ := ψ)) → ℝ) := by ++ intro A ++ classical ++ have hR : 0 ≤ R := hRpos.le ++ have hR0 : R ≠ 0 := ne_of_gt hRpos ++ have hμK : (volume : Measure E) K < (⊤ : ℝ≥0∞) := hK.measure_lt_top (μ := (volume : Measure E)) ++ have : Fact ((volume : Measure E) K < (⊤ : ℝ≥0∞)) := ⟨hμK⟩ ++ have : IsFiniteMeasure ((volume : Measure E).restrict K) := by infer_instance ++ let μ : Measure E := (volume : Measure E).restrict K ++ let mK : ℝ := ++ (MeasureTheory.measureUnivNNReal (volume.restrict K)) ^ ((2 : ℝ≥0∞).toReal⁻¹) ++ have hmK : 0 ≤ mK := Real.rpow_nonneg (by simp) _ ++ let s : Set ℝ := Metric.closedBall (0 : ℝ) (R * (mK * Cψ)) ++ have in_s := ++ smoothFun_image_mem_closedBall (K := K) (ψ := ψ) hK hKm hψc hψcs ++ (R := R) hRpos Cψ hCψ_nonneg hψ_bound ++ rw [Metric.uniformEquicontinuous_iff] ++ intro ε hε ++ -- Handle the zero-measure case separately (then `mK = 0` and everything is constant). ++ by_cases hmK0 : mK = 0 ++ · refine ⟨1, by norm_num, ?_⟩ ++ intro x y _ f ++ -- With `mK = 0`, the range bound forces all values to be `0`. ++ set F : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ := ++ (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) with hF ++ have hzero : ∀ z, F z = 0 := by ++ intro z ++ have hmem : F z ∈ s := in_s (f := F) z f.property ++ have hle : dist (F z) 0 ≤ 0 := by ++ have : dist (F z) 0 ≤ R * (mK * Cψ) := by simpa [s, Metric.mem_closedBall] using hmem ++ simpa [hmK0] using this ++ exact dist_eq_zero.1 (le_antisymm hle dist_nonneg) ++ simpa [hzero x, hzero y] using hε ++ · have hRmK_ne : R * mK ≠ 0 := mul_ne_zero hR0 hmK0 ++ let ε2 : ℝ := ε / 2 ++ have hε2pos : 0 < ε2 := by ++ simpa [ε2] using half_pos hε ++ let ε' : ℝ := ε2 / (R * mK) ++ have hε'pos : 0 < ε' := ++ div_pos hε2pos (mul_pos hRpos (lt_of_le_of_ne hmK (Ne.symm hmK0))) ++ have hε'lt : R * mK * ε' = ε2 := by ++ dsimp [ε'] ++ field_simp [hRmK_ne, mul_assoc, mul_left_comm, mul_comm] ++ -- Use uniform continuity of `ψ` to get `deltaLoss`. ++ have hUC : UniformContinuous ψ := uniformContinuous_ψ (E := E) (ψ := ψ) hψc hψcs ++ rcases (Metric.uniformContinuous_iff.1 hUC) ε' hε'pos with ⟨deltaLoss, hδpos, hδ⟩ ++ refine ⟨deltaLoss, hδpos, ?_⟩ ++ intro x y hxy f ++ -- Work with the `smoothBCF` representative of `f`. ++ rcases f.property with ⟨u, hu_ball, hu_eq⟩ ++ have hu_eq' : ++ (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) = ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u := by ++ simpa using hu_eq.symm ++ have hu_norm : ‖u‖ ≤ R := by ++ simpa [Metric.mem_closedBall, dist_eq_norm] using hu_ball ++ -- Kernel elements at `x` and `y`. ++ have hkerx : ++ MemLp (fun t : E => ψ ((x : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by ++ refine MemLp.of_bound (μ := (volume.restrict K)) ++ (hf := (hψc.aestronglyMeasurable.comp_measurable ++ (measurable_const.sub measurable_id))) Cψ ?_ ++ filter_upwards ++ [MeasureTheory.ae_restrict_mem ++ (μ := (volume : Measure E)) hKm] with t ht ++ exact hψ_bound x t ht ++ have hkery : ++ MemLp (fun t : E => ψ ((y : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by ++ refine MemLp.of_bound (μ := (volume.restrict K)) ++ (hf := (hψc.aestronglyMeasurable.comp_measurable ++ (measurable_const.sub measurable_id))) Cψ ?_ ++ filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm] with t ht ++ exact hψ_bound y t ht ++ let kx : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := ++ hkerx.toLp (fun t : E => ψ ((x : E) - t)) ++ let ky : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := ++ hkery.toLp (fun t : E => ψ ((y : E) - t)) ++ -- AE bound on `‖kx - ky‖` by `ε'`. ++ have h_ae : ++ ∀ᵐ t ∂(volume.restrict K), ‖(kx - ky) t‖ ≤ ε' := by ++ filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm, ++ MeasureTheory.MemLp.coeFn_toLp (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) ++ (f := fun t : E => ψ ((x : E) - t)) hkerx, ++ MeasureTheory.MemLp.coeFn_toLp (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) ++ (f := fun t : E => ψ ((y : E) - t)) hkery, ++ (MeasureTheory.Lp.coeFn_sub (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) kx ky)] with ++ t ht hx_t hy_t hsub ++ have hxy' : dist ((x : E) - t) ((y : E) - t) < deltaLoss := by ++ rw [dist_sub_right] ++ exact hxy ++ have hψxy : dist (ψ ((x : E) - t)) (ψ ((y : E) - t)) < ε' := ++ hδ (a := (x : E) - t) (b := (y : E) - t) hxy' ++ have : ‖ψ ((x : E) - t) - ψ ((y : E) - t)‖ ≤ ε' := by ++ simpa [dist_eq_norm, sub_eq_add_neg] using le_of_lt hψxy ++ have hx' : kx t = ψ ((x : E) - t) := by simpa [kx] using hx_t ++ have hy' : ky t = ψ ((y : E) - t) := by simpa [ky] using hy_t ++ have hnorm : ‖kx t - ky t‖ ≤ ε' := by ++ simpa [hx', hy'] using this ++ have hsub' : (kx - ky) t = kx t - ky t := by ++ simpa [Pi.sub_apply] using hsub ++ simpa [hsub'.symm] using hnorm ++ have hkdiff : ‖kx - ky‖ ≤ mK * ε' := by ++ have := (MeasureTheory.Lp.norm_le_of_ae_bound (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) ++ (f := (kx - ky : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ)) (hC := le_of_lt hε'pos) h_ae) ++ simpa [mK, mul_comm, mul_left_comm, mul_assoc] using this ++ -- Bound the difference of values using Cauchy–Schwarz. ++ have hdist : ++ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) ++ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) ++ ≤ ‖u‖ * ‖kx - ky‖ := by ++ -- Express each value as an inner product. ++ have hx_val : ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x = ++ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) kx := by ++ have hsmooth : ++ smoothFun (E := E) (K := K) ψ u (x : E) = ++ ∫ t, u t * kx t ∂(volume.restrict K) := by ++ have h_ae' : ++ (fun t : E => u t * kx t) =ᵐ[volume.restrict K] ++ fun t : E => u t * ψ ((x : E) - t) := by ++ filter_upwards [MeasureTheory.MemLp.coeFn_toLp ++ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) ++ (f := fun t : E => ψ ((x : E) - t)) ++ hkerx] with t ht ++ simp [kx, ht] ++ rw [smoothFun_eq_integral_restrict ++ (E := E) (K := K) (ψ := ψ) (hKm := hKm) ++ u (x : E)] ++ exact (MeasureTheory.integral_congr_ae h_ae'.symm) ++ have hsmooth' : ++ smoothFun (E := E) (K := K) ψ u (x : E) = ++ ∫ t, kx t * u t ∂(volume.restrict K) := by ++ simp [hsmooth, mul_comm] ++ erw [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x, ++ MeasureTheory.L2.inner_def]; exact hsmooth' ++ have hy_val : ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y = ++ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) ky := by ++ have hsmooth : ++ smoothFun (E := E) (K := K) ψ u (y : E) = ++ ∫ t, u t * ky t ∂(volume.restrict K) := by ++ have h_ae' : ++ (fun t : E => u t * ky t) =ᵐ[volume.restrict K] ++ fun t : E => u t * ψ ((y : E) - t) := by ++ filter_upwards [MeasureTheory.MemLp.coeFn_toLp ++ (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) ++ (f := fun t : E => ψ ((y : E) - t)) ++ hkery] with t ht ++ simp [ky, ht] ++ rw [smoothFun_eq_integral_restrict ++ (E := E) (K := K) (ψ := ψ) (hKm := hKm) ++ u (y : E)] ++ exact (MeasureTheory.integral_congr_ae h_ae'.symm) ++ have hsmooth' : ++ smoothFun (E := E) (K := K) ψ u (y : E) = ++ ∫ t, ky t * u t ∂(volume.restrict K) := by ++ simp [hsmooth, mul_comm] ++ erw [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y, ++ MeasureTheory.L2.inner_def]; exact hsmooth' ++ have : ++ ‖smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x - ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y‖ ≤ ++ ‖u‖ * ‖kx - ky‖ := by ++ have : ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x - ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y = ++ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky) := by ++ simp [hx_val, hy_val, inner_sub_right] ++ have this' : ++ smoothFun (E := E) (K := K) ψ u (x : E) - smoothFun (E := E) (K := K) ψ u (y : E) = ++ inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky) := by ++ simpa [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs] using this ++ have hCS := ++ (abs_real_inner_le_norm (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky)) ++ simpa [this', dist_eq_norm, Real.norm_eq_abs] using hCS ++ simpa [dist_eq_norm] using this ++ have hle : ++ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) ++ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) ++ ≤ R * (mK * ε') := by ++ calc ++ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) ++ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) ++ ≤ ‖u‖ * ‖kx - ky‖ := hdist ++ _ ≤ ‖u‖ * (mK * ε') := by ++ exact mul_le_mul_of_nonneg_left hkdiff (norm_nonneg _) ++ _ ≤ R * (mK * ε') := by ++ have hmKε' : 0 ≤ mK * ε' := mul_nonneg hmK (le_of_lt hε'pos) ++ exact mul_le_mul_of_nonneg_right hu_norm hmKε' ++ have hRmkε' : R * (mK * ε') = ε2 := by ++ have : R * mK * ε' = ε2 := by ++ simpa [ε', mul_assoc] using hε'lt ++ simpa [mul_assoc] using this ++ have hle' : ++ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) ++ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) ≤ ε2 := by ++ simpa [hRmkε'] using hle ++ have hε2lt : ε2 < ε := by ++ simpa [ε2] using half_lt_self hε ++ have : ++ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) ++ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) < ε := ++ lt_of_le_of_lt hle' hε2lt ++ simpa [hu_eq'] using this ++ + theorem smoothBCF_image_closedBall_isCompact (hK : IsCompact K) (hKm : MeasurableSet K) + (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) {R : ℝ} (hR : 0 ≤ R) : + IsCompact +@@ -130,15 +432,15 @@ theorem smoothBCF_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurabl + simp [hball] + · have hRpos : 0 < R := lt_of_le_of_ne hR (Ne.symm hR0) + -- Compactness of the codomain. +- letI : CompactSpace ↥(Kψ (K := K) (ψ := ψ)) := ++ let : CompactSpace ↥(Kψ (K := K) (ψ := ψ)) := + isCompact_iff_compactSpace.1 (isCompact_Kψ (K := K) (ψ := ψ) hK hψcs) + let A : + Set (BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) := + smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs '' Metric.closedBall (0 : _) R + -- `volume.restrict K` is finite since `K` is compact. +- have hμK : (volume : Measure E) K < ∞ := hK.measure_lt_top (μ := (volume : Measure E)) +- letI : Fact ((volume : Measure E) K < ∞) := ⟨hμK⟩ +- haveI : IsFiniteMeasure (volume.restrict K) := by ++ have hμK : (volume : Measure E) K < (⊤ : ℝ≥0∞) := hK.measure_lt_top (μ := (volume : Measure E)) ++ let : Fact ((volume : Measure E) K < (⊤ : ℝ≥0∞)) := ⟨hμK⟩ ++ have : IsFiniteMeasure (volume.restrict K) := by + infer_instance + let μ : Measure E := (volume : Measure E).restrict K + let mK : ℝ := +@@ -227,211 +529,10 @@ theorem smoothBCF_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurabl + dist_eq_norm, Real.norm_eq_abs] using habs' + simpa [s, Metric.mem_closedBall, dist_eq_norm] using this + -- Equicontinuity for `A`. +- have H' : UniformEquicontinuous ((↑) : A → ↥(Kψ (K := K) (ψ := ψ)) → ℝ) := by +- rw [Metric.uniformEquicontinuous_iff] +- intro ε hε +- -- Handle the zero-measure case separately (then `mK = 0` and everything is constant). +- by_cases hmK0 : mK = 0 +- · refine ⟨1, by norm_num, ?_⟩ +- intro x y _ f +- -- With `mK = 0`, the range bound forces all values to be `0`. +- have hx0 : dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x) 0 ≤ +- R * (mK * Cψ) := by +- have : +- (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x ∈ s := +- in_s (f := (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ)) x f.property +- simpa [s, Metric.mem_closedBall] using this +- have hy0 : dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y) 0 ≤ +- R * (mK * Cψ) := by +- have : +- (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y ∈ s := +- in_s (f := (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ)) y f.property +- simpa [s, Metric.mem_closedBall] using this +- have hx0' : +- dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x) 0 = 0 := by +- have : dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x) 0 ≤ 0 := by +- simpa [hmK0] using hx0 +- exact le_antisymm this dist_nonneg +- have hy0' : +- dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y) 0 = 0 := by +- have : dist ((f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y) 0 ≤ 0 := by +- simpa [hmK0] using hy0 +- exact le_antisymm this dist_nonneg +- have hx : (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) x = 0 := +- dist_eq_zero.1 hx0' +- have hy : (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) y = 0 := +- dist_eq_zero.1 hy0' +- simpa [hx, hy] using hε +- · have hRmK_ne : R * mK ≠ 0 := mul_ne_zero hR0 hmK0 +- let ε2 : ℝ := ε / 2 +- have hε2pos : 0 < ε2 := by +- simpa [ε2] using half_pos hε +- let ε' : ℝ := ε2 / (R * mK) +- have hε'pos : 0 < ε' := +- div_pos hε2pos (mul_pos hRpos (lt_of_le_of_ne hmK (Ne.symm hmK0))) +- have hε'lt : R * mK * ε' = ε2 := by +- dsimp [ε'] +- field_simp [hRmK_ne, mul_assoc, mul_left_comm, mul_comm] +- -- Use uniform continuity of `ψ` to get `δ`. +- have hUC : UniformContinuous ψ := uniformContinuous_ψ (E := E) (ψ := ψ) hψc hψcs +- rcases (Metric.uniformContinuous_iff.1 hUC) ε' hε'pos with ⟨δ, hδpos, hδ⟩ +- refine ⟨δ, hδpos, ?_⟩ +- intro x y hxy f +- -- Work with the `smoothBCF` representative of `f`. +- rcases f.property with ⟨u, hu_ball, hu_eq⟩ +- have hu_eq' : +- (f : BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) = +- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u := by +- simpa using hu_eq.symm +- have hu_norm : ‖u‖ ≤ R := by +- simpa [Metric.mem_closedBall, dist_eq_norm] using hu_ball +- -- Kernel elements at `x` and `y`. +- have hkerx : +- MemLp (fun t : E => ψ ((x : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by +- refine MemLp.of_bound (μ := (volume.restrict K)) +- (hf := (hψc.aestronglyMeasurable.comp_measurable +- (measurable_const.sub measurable_id))) Cψ ?_ +- filter_upwards +- [MeasureTheory.ae_restrict_mem +- (μ := (volume : Measure E)) hKm] with t ht +- exact hψ_bound x t ht +- have hkery : +- MemLp (fun t : E => ψ ((y : E) - t)) (2 : ℝ≥0∞) (volume.restrict K) := by +- refine MemLp.of_bound (μ := (volume.restrict K)) +- (hf := (hψc.aestronglyMeasurable.comp_measurable +- (measurable_const.sub measurable_id))) Cψ ?_ +- filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm] with t ht +- exact hψ_bound y t ht +- let kx : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := +- hkerx.toLp (fun t : E => ψ ((x : E) - t)) +- let ky : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ := +- hkery.toLp (fun t : E => ψ ((y : E) - t)) +- -- AE bound on `‖kx - ky‖` by `ε'`. +- have h_ae : +- ∀ᵐ t ∂(volume.restrict K), ‖(kx - ky) t‖ ≤ ε' := by +- filter_upwards [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hKm, +- MeasureTheory.MemLp.coeFn_toLp (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) +- (f := fun t : E => ψ ((x : E) - t)) hkerx, +- MeasureTheory.MemLp.coeFn_toLp (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) +- (f := fun t : E => ψ ((y : E) - t)) hkery, +- (MeasureTheory.Lp.coeFn_sub (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) kx ky)] with +- t ht hx_t hy_t hsub +- have hxy' : dist ((x : E) - t) ((y : E) - t) < δ := by +- simpa [sub_eq_add_neg, add_assoc] using hxy +- have hψxy : dist (ψ ((x : E) - t)) (ψ ((y : E) - t)) < ε' := +- hδ (a := (x : E) - t) (b := (y : E) - t) hxy' +- have : ‖ψ ((x : E) - t) - ψ ((y : E) - t)‖ ≤ ε' := by +- simpa [dist_eq_norm, sub_eq_add_neg] using le_of_lt hψxy +- have hx' : kx t = ψ ((x : E) - t) := by simpa [kx] using hx_t +- have hy' : ky t = ψ ((y : E) - t) := by simpa [ky] using hy_t +- have hnorm : ‖kx t - ky t‖ ≤ ε' := by +- simpa [hx', hy'] using this +- have hsub' : (kx - ky) t = kx t - ky t := by +- simpa [Pi.sub_apply] using hsub +- simpa [hsub'.symm] using hnorm +- have hkdiff : ‖kx - ky‖ ≤ mK * ε' := by +- have := (MeasureTheory.Lp.norm_le_of_ae_bound (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) +- (f := (kx - ky : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ)) (hC := le_of_lt hε'pos) h_ae) +- simpa [mK, mul_comm, mul_left_comm, mul_assoc] using this +- -- Bound the difference of values using Cauchy–Schwarz. +- have hdist : +- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) +- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) +- ≤ ‖u‖ * ‖kx - ky‖ := by +- -- Express each value as an inner product. +- have hx_val : +- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x = +- inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) kx := by +- have hsmooth : +- smoothFun (E := E) (K := K) ψ u (x : E) = +- ∫ t, u t * kx t ∂(volume.restrict K) := by +- have h_ae' : +- (fun t : E => u t * kx t) =ᵐ[volume.restrict K] +- fun t : E => u t * ψ ((x : E) - t) := by +- filter_upwards [MeasureTheory.MemLp.coeFn_toLp +- (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) +- (f := fun t : E => ψ ((x : E) - t)) +- hkerx] with t ht +- simp [kx, ht] +- rw [smoothFun_eq_integral_restrict +- (E := E) (K := K) (ψ := ψ) (hKm := hKm) +- u (x : E)] +- exact (MeasureTheory.integral_congr_ae h_ae'.symm) +- have hsmooth' : +- smoothFun (E := E) (K := K) ψ u (x : E) = +- ∫ t, kx t * u t ∂(volume.restrict K) := by +- simp [hsmooth, mul_comm] +- erw [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x, +- MeasureTheory.L2.inner_def]; exact hsmooth' +- have hy_val : +- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y = +- inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) ky := by +- have hsmooth : +- smoothFun (E := E) (K := K) ψ u (y : E) = +- ∫ t, u t * ky t ∂(volume.restrict K) := by +- have h_ae' : +- (fun t : E => u t * ky t) =ᵐ[volume.restrict K] +- fun t : E => u t * ψ ((y : E) - t) := by +- filter_upwards [MeasureTheory.MemLp.coeFn_toLp +- (μ := (volume.restrict K)) (p := (2 : ℝ≥0∞)) +- (f := fun t : E => ψ ((y : E) - t)) +- hkery] with t ht +- simp [ky, ht] +- rw [smoothFun_eq_integral_restrict +- (E := E) (K := K) (ψ := ψ) (hKm := hKm) +- u (y : E)] +- exact (MeasureTheory.integral_congr_ae h_ae'.symm) +- have hsmooth' : +- smoothFun (E := E) (K := K) ψ u (y : E) = +- ∫ t, ky t * u t ∂(volume.restrict K) := by +- simp [hsmooth, mul_comm] +- erw [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y, +- MeasureTheory.L2.inner_def]; exact hsmooth' +- have : +- ‖smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x - +- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y‖ ≤ +- ‖u‖ * ‖kx - ky‖ := by +- have : +- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x - +- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y = +- inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky) := by +- simp [hx_val, hy_val, inner_sub_right] +- have this' : +- smoothFun (E := E) (K := K) ψ u (x : E) - smoothFun (E := E) (K := K) ψ u (y : E) = +- inner ℝ (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky) := by +- simpa [smoothBCF_apply (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs] using this +- have hCS := +- (abs_real_inner_le_norm (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μ) (kx - ky)) +- simpa [this', dist_eq_norm, Real.norm_eq_abs] using hCS +- simpa [dist_eq_norm] using this +- have hle : +- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) +- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) +- ≤ R * (mK * ε') := by +- calc +- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) +- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) +- ≤ ‖u‖ * ‖kx - ky‖ := hdist +- _ ≤ ‖u‖ * (mK * ε') := by +- exact mul_le_mul_of_nonneg_left hkdiff (norm_nonneg _) +- _ ≤ R * (mK * ε') := by +- have hmKε' : 0 ≤ mK * ε' := mul_nonneg hmK (le_of_lt hε'pos) +- exact mul_le_mul_of_nonneg_right hu_norm hmKε' +- have hRmkε' : R * (mK * ε') = ε2 := by +- have : R * mK * ε' = ε2 := by +- simpa [ε', mul_assoc] using hε'lt +- simpa [mul_assoc] using this +- have hle' : +- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) +- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) ≤ ε2 := by +- simpa [hRmkε'] using hle +- have hε2lt : ε2 < ε := by +- simpa [ε2] using half_lt_self hε +- have : +- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u x) +- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u y) < ε := +- lt_of_le_of_lt hle' hε2lt +- simpa [hu_eq'] using this ++ have H' : ++ UniformEquicontinuous ((↑) : A → ↥(Kψ (K := K) (ψ := ψ)) → ℝ) := ++ uniformEquicontinuous_smoothBCF_closedBall (K := K) (ψ := ψ) hK hKm hψc hψcs ++ (R := R) hRpos Cψ hCψ_nonneg hψ_bound + have H : Equicontinuous ((↑) : A → ↥(Kψ (K := K) (ψ := ψ)) → ℝ) := H'.equicontinuous + -- Apply Arzelà–Ascoli. + simpa [A, s] using +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Compactness.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Compactness.lean +index 00cba3a..70360de 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Compactness.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Compactness.lean +@@ -1,15 +1,15 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Smoothing +-import Mathlib.MeasureTheory.Function.LpSeminorm.CompareExp +-import Mathlib.MeasureTheory.Measure.Typeclasses.Finite +-import Mathlib.Topology.Algebra.Monoid +-import Mathlib.Topology.UniformSpace.HeineCantor +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Smoothing ++import Mathlib.MeasureTheory.Function.LpSeminorm.CompareExp ++import Mathlib.MeasureTheory.Measure.Typeclasses.Finite ++import Mathlib.Topology.Algebra.Monoid ++import Mathlib.Topology.UniformSpace.HeineCantor ++ + /-! + # `L²` compactness criterion: compact smoothing operator (Euclidean) + +@@ -44,13 +44,14 @@ section Volume + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + +-local instance instMeasurableSpaceE_L2CompactnessCompactness : MeasurableSpace E := borel E +-local instance instBorelSpaceE_L2CompactnessCompactness : BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_L2CompactnessCompactness : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceEL2CompactnessCompactness : MeasurableSpace E := borel E ++local instance instBorelSpaceEL2CompactnessCompactness : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceEL2CompactnessCompactness : OpensMeasurableSpace E := by + infer_instance +-local instance instMeasurableAddE_L2CompactnessCompactness : MeasurableAdd E := by ++local instance instMeasurableAddEL2CompactnessCompactness : MeasurableAdd E := by + infer_instance +-local instance instMeasurableNegE_L2CompactnessCompactness : MeasurableNeg E := by ++local instance instMeasurableNegEL2CompactnessCompactness : MeasurableNeg E := by + infer_instance + + variable {K : Set E} +@@ -65,14 +66,15 @@ lemma isCompact_Kψ (hK : IsCompact K) (hψcs : HasCompactSupport ψ) : + IsCompact (Kψ (K := K) (ψ := ψ)) := + IsCompact.add hK hψcs.isCompact + +-private def smoothOn (hKm : MeasurableSet K) (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) ++/-- Restrict the smoothed function to its compact domain as a continuous map. -/ ++def smoothOn (hKm : MeasurableSet K) (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) + (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume.restrict K)) : + C(↥(Kψ (K := K) (ψ := ψ)), ℝ) where + toFun x := smoothFun (E := E) (K := K) ψ u x + continuous_toFun := by + have : Continuous (smoothFun (E := E) (K := K) ψ u) := + continuous_smoothFun (E := E) (K := K) (ψ := ψ) (hKm := hKm) hψc hψcs u +- simpa using this.comp continuous_subtype_val ++ exact this.comp continuous_subtype_val + + /-- `smoothFun` packaged as a `BoundedContinuousFunction` on the compact set `K + tsupport ψ`. -/ + def smoothBCF (hK : IsCompact K) (hKm : MeasurableSet K) (hψc : Continuous ψ) +@@ -106,7 +108,7 @@ lemma uniformContinuous_ψ (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) + -- If `ψ x` is `ε`-far from `0`, then `ψ x ≠ 0`, hence `x` belongs to the support and therefore + -- to the topological support. + have hx' : ¬ dist (ψ x) 0 < ε := by +- simpa [Set.mem_compl_iff, Set.mem_setOf_eq] using hx ++ simpa [Set.mem_compl_iff, Set.mem_ofPred_eq] using hx + have hxε : ε ≤ dist (ψ x) 0 := le_of_not_gt (by simpa [gt_iff_lt] using hx') + have hx0 : ψ x ≠ 0 := by + intro hψ0 +@@ -130,10 +132,10 @@ private lemma integrable_norm_L2_restrict (hK : IsCompact K) + Integrable (fun x : E => ‖u x‖) (volume.restrict K) := by + classical + -- On a finite measure space, `L² ⊆ L¹`. +- have hμ : (volume : Measure E) K < ∞ := ++ have hμ : (volume : Measure E) K < (⊤ : ℝ≥0∞) := + (hK.measure_lt_top (μ := (volume : Measure E))) +- letI : Fact ((volume : Measure E) K < ∞) := ⟨hμ⟩ +- haveI : IsFiniteMeasure (volume.restrict K) := by ++ let : Fact ((volume : Measure E) K < (⊤ : ℝ≥0∞)) := ⟨hμ⟩ ++ have : IsFiniteMeasure (volume.restrict K) := by + infer_instance + have hu2 : MemLp (fun x : E => u x) (2 : ℝ≥0∞) (volume.restrict K) := + MeasureTheory.Lp.memLp u +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/FrechetKolmogorov.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/FrechetKolmogorov.lean +index 6af8031..35c2ec0 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/FrechetKolmogorov.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/FrechetKolmogorov.lean +@@ -1,13 +1,13 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Approximation +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Transfer +-import Mathlib.Topology.UniformSpace.Cauchy +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Approximation ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Transfer ++import Mathlib.Topology.UniformSpace.Cauchy ++ + /-! + # `L²` compactness criterion: Fréchet–Kolmogorov (Euclidean, compact support case) + +@@ -52,13 +52,14 @@ section Volume + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + +-local instance instMeasurableSpaceE_L2CompactnessFrechetKolmogorov : MeasurableSpace E := borel E +-local instance instBorelSpaceE_L2CompactnessFrechetKolmogorov : BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_L2CompactnessFrechetKolmogorov : ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceEL2CompactnessFrechetKolmogorov : MeasurableSpace E := borel E ++local instance instBorelSpaceEL2CompactnessFrechetKolmogorov : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceEL2CompactnessFrechetKolmogorov : + OpensMeasurableSpace E := by infer_instance +-local instance instMeasurableAddE_L2CompactnessFrechetKolmogorov : MeasurableAdd E := by ++local instance instMeasurableAddEL2CompactnessFrechetKolmogorov : MeasurableAdd E := by + infer_instance +-local instance instMeasurableNegE_L2CompactnessFrechetKolmogorov : MeasurableNeg E := by ++local instance instMeasurableNegEL2CompactnessFrechetKolmogorov : MeasurableNeg E := by + infer_instance + + variable {K : Set E} {ψ : E → ℝ} +@@ -125,7 +126,7 @@ theorem totallyBounded_extendByZeroL2_image_of_forall_exists_translationIntegral + rcases Set.mem_iUnion.1 hSu_cover with ⟨y, hy⟩ + rcases Set.mem_iUnion.1 hy with ⟨hyT, hyBall⟩ + have hyDist : dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) y < ε / 2 := by +- simpa [Metric.ball, Set.mem_setOf_eq] using hyBall ++ simpa [Metric.ball, Set.mem_ofPred_eq] using hyBall + have hdist_smooth_ext : + dist (extendByZeroL2 (E := E) (K := K) hKm u) + (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) ≤ ε / 2 := by +@@ -156,7 +157,7 @@ theorem totallyBounded_extendByZeroL2_image_of_forall_exists_translationIntegral + lt_of_le_of_lt htri hlt + simpa [add_halves ε] using htmp + have hxBall : extendByZeroL2 (E := E) (K := K) hKm u ∈ Metric.ball y ε := by +- simpa [Metric.ball, Set.mem_setOf_eq] using hxDist ++ simpa [Metric.ball, Set.mem_ofPred_eq] using hxDist + exact Set.mem_iUnion.2 ⟨y, Set.mem_iUnion.2 ⟨hyT, hxBall⟩⟩ + + theorem isCompact_closure_extendByZeroL2_image_of_forall_exists_translationIntegral_small +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Kernels.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Kernels.lean +index 833b243..8543986 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Kernels.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Kernels.lean +@@ -1,22 +1,22 @@ +-import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension +-import Mathlib.MeasureTheory.Integral.Bochner.Set +-import Mathlib.Topology.Algebra.Support +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension ++import Mathlib.MeasureTheory.Integral.Bochner.Set ++import Mathlib.Topology.Algebra.Support ++ + /-! + # `L²` compactness criterion: existence of small-support probability kernels (Euclidean) + + This file provides a “kernel factory” for the Euclidean Fréchet–Kolmogorov / Riesz–Kolmogorov +-criterion: for any radius `δ > 0`, produce a continuous compactly supported function `ψ : E → ℝ` ++criterion: for any radius `deltaLoss > 0`, produce a continuous compactly supported function `ψ : E → ℝ` + such that: + + - `ψ ≥ 0`, +-- `tsupport ψ ⊆ Metric.ball 0 δ`, ++- `tsupport ψ ⊆ Metric.ball 0 deltaLoss`, + - `∫ ψ = 1` (so `kernelMeasure ψ` is a probability measure). + + The construction uses mathlib’s `exists_smooth_tsupport_subset` bump-function lemma and normalizes +@@ -41,21 +41,22 @@ section Volume + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + +-local instance instMeasurableSpaceE_L2CompactnessKernels : MeasurableSpace E := borel E +-local instance instBorelSpaceE_L2CompactnessKernels : BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_L2CompactnessKernels : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceEL2CompactnessKernels : MeasurableSpace E := borel E ++local instance instBorelSpaceEL2CompactnessKernels : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceEL2CompactnessKernels : OpensMeasurableSpace E := by + infer_instance + +-/-- For any `δ > 0`, there exists a continuous compactly supported kernel `ψ` supported in +-`Metric.ball 0 δ`, with `ψ ≥ 0` and `∫ ψ = 1` (w.r.t. Lebesgue measure). -/ +-theorem exists_kernel_tsupport_subset_ball_integral_eq_one {δ : ℝ} (hδ : 0 < δ) : ++/-- For any `deltaLoss > 0`, there exists a continuous compactly supported kernel `ψ` supported in ++`Metric.ball 0 deltaLoss`, with `ψ ≥ 0` and `∫ ψ = 1` (w.r.t. Lebesgue measure). -/ ++theorem exists_kernel_tsupport_subset_ball_integral_eq_one {deltaLoss : ℝ} (hδ : 0 < deltaLoss) : + ∃ ψ : E → ℝ, Continuous ψ ∧ HasCompactSupport ψ ∧ (∀ x, 0 ≤ ψ x) ∧ +- (∫ x, ψ x ∂(volume : Measure E) = 1) ∧ tsupport ψ ⊆ Metric.ball (0 : E) δ := by ++ (∫ x, ψ x ∂(volume : Measure E) = 1) ∧ tsupport ψ ⊆ Metric.ball (0 : E) deltaLoss := by + classical +- -- Start from a smooth bump supported in `ball 0 δ` with value `1` at `0`. +- have hs : (Metric.ball (0 : E) δ) ∈ 𝓝 (0 : E) := Metric.ball_mem_nhds _ hδ ++ -- Start from a smooth bump supported in `ball 0 deltaLoss` with value `1` at `0`. ++ have hs : (Metric.ball (0 : E) deltaLoss) ∈ 𝓝 (0 : E) := Metric.ball_mem_nhds _ hδ + rcases exists_contDiff_tsupport_subset (n := ⊤) +- (E := E) (s := Metric.ball (0 : E) δ) (x := (0 : E)) hs with ++ (E := E) (s := Metric.ball (0 : E) deltaLoss) (x := (0 : E)) hs with + ⟨f, hf_tsupp, hf_cs, hf_smooth, hf_range, hf0⟩ + have hf_cont : Continuous f := hf_smooth.continuous + have hf_nonneg : ∀ x, 0 ≤ f x := by +@@ -77,9 +78,9 @@ theorem exists_kernel_tsupport_subset_ball_integral_eq_one {δ : ℝ} (hδ : 0 < + -- Normalize: `ψ = I⁻¹ • f`. + let ψ : E → ℝ := fun x => I⁻¹ * f x + have hψc : Continuous ψ := by +- simpa [ψ] using (continuous_const.mul hf_cont) ++ exact (continuous_const.mul hf_cont) + have hψcs : HasCompactSupport ψ := by +- simpa [ψ, smul_eq_mul] using ++ exact + (HasCompactSupport.smul_left (f := fun _x : E => I⁻¹) (f' := f) hf_cs) + have hψ0 : ∀ x, 0 ≤ ψ x := by + intro x +@@ -93,7 +94,7 @@ theorem exists_kernel_tsupport_subset_ball_integral_eq_one {δ : ℝ} (hδ : 0 < + simpa [ψ, I] using + (MeasureTheory.integral_const_mul (μ := (volume : Measure E)) (r := I⁻¹) (f := f)) + simp [this, hI0] +- have hψ_tsupp : tsupport ψ ⊆ Metric.ball (0 : E) δ := by ++ have hψ_tsupp : tsupport ψ ⊆ Metric.ball (0 : E) deltaLoss := by + -- Scaling does not enlarge topological support; use the bump support inclusion. + have hsub : tsupport ψ ⊆ tsupport f := by + simpa [ψ, smul_eq_mul] using (tsupport_smul_subset_right (f := fun _x : E => I⁻¹) (g := f)) +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Smoothing.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Smoothing.lean +index 3543832..8d6b0bb 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Smoothing.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Smoothing.lean +@@ -1,13 +1,13 @@ +-import RellichKondrachov.MeasureTheory.Function.LpSpace.Restrict +-import Mathlib.Analysis.Convolution +-import Mathlib.Topology.Algebra.Support +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.MeasureTheory.Function.LpSpace.Restrict ++import Mathlib.Analysis.Convolution ++import Mathlib.Topology.Algebra.Support ++ + /-! + # `L²` compactness criterion: smoothing setup (Euclidean) + +@@ -38,11 +38,12 @@ section + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] + +-local instance : MeasurableSpace E := borel E +-local instance : BorelSpace E := ⟨rfl⟩ +-local instance : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceSmoothing : MeasurableSpace E := borel E ++local instance instBorelSpaceSmoothing : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceSmoothing : OpensMeasurableSpace E := by + infer_instance +-local instance : MeasurableAdd E := by ++local instance instMeasurableAddSmoothing : MeasurableAdd E := by + infer_instance + + omit [InnerProductSpace ℝ E] [CompleteSpace E] in +@@ -68,11 +69,12 @@ section Volume + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + + -- `volume` is the canonical Haar measure on finite-dimensional real vector spaces. +-local instance : MeasurableSpace E := borel E +-local instance : BorelSpace E := ⟨rfl⟩ +-local instance : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceSmoothing1 : MeasurableSpace E := borel E ++local instance instBorelSpaceSmoothing1 : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceSmoothing1 : OpensMeasurableSpace E := by + infer_instance +-local instance : MeasurableAdd E := by ++local instance instMeasurableAddSmoothing1 : MeasurableAdd E := by + infer_instance + + variable {K : Set E} +@@ -116,7 +118,7 @@ lemma extendByZeroL2_eq_extendByZeroₗᵢ (hKm : MeasurableSet K) + (MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) + (s := K) hKm) u := by + classical +- letI : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ ++ let : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ + refine MeasureTheory.Lp.ext ?_ + have h1 : + (extendByZeroL2 (E := E) (K := K) hKm u : E → ℝ) =ᵐ[(volume : Measure E)] +@@ -126,7 +128,6 @@ lemma extendByZeroL2_eq_extendByZeroₗᵢ (hKm : MeasurableSet K) + ((MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) + (s := K) hKm) u : E → ℝ) =ᵐ[(volume : Measure E)] + extendByZeroFun (E := E) (K := K) u := by +- simp [extendByZeroFun] + exact + (MeasureTheory.Lp.extendByZeroₗᵢ_ae_eq (μ := (volume : Measure E)) (E := ℝ) + (p := (2 : ℝ≥0∞)) (s := K) hKm u) +@@ -136,7 +137,7 @@ lemma norm_extendByZeroL2 (hKm : MeasurableSet K) + (u : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume.restrict K)) : + ‖extendByZeroL2 (E := E) (K := K) hKm u‖ = ‖u‖ := by + classical +- letI : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ ++ let : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ + calc + ‖extendByZeroL2 (E := E) (K := K) hKm u‖ = + ‖(MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) +@@ -172,7 +173,7 @@ lemma continuous_smoothFun + exact hf_memLp.locallyIntegrable h12 + simpa [smoothFun] using + (hψcs.continuous_convolution_right +- (L := ContinuousLinearMap.lsmul ℝ ℝ) ++ («L» := ContinuousLinearMap.lsmul ℝ ℝ) + (μ := (volume : Measure E)) hf_loc hψc) + + lemma hasCompactSupport_smoothFun (hK : IsCompact K) (hψcs : HasCompactSupport ψ) +@@ -181,7 +182,7 @@ lemma hasCompactSupport_smoothFun (hK : IsCompact K) (hψcs : HasCompactSupport + have hf : HasCompactSupport (extendByZeroFun (K := K) u) := + hasCompactSupport_extendByZeroFun (K := K) hK u + simpa [smoothFun] using +- (hf.convolution (L := ContinuousLinearMap.lsmul ℝ ℝ) ++ (hf.convolution («L» := ContinuousLinearMap.lsmul ℝ ℝ) + (μ := (volume : Measure E)) hψcs) + + lemma support_smoothFun_subset_add_tsupport +@@ -192,7 +193,7 @@ lemma support_smoothFun_subset_add_tsupport + Function.support (smoothFun (E := E) (K := K) ψ u) ⊆ + Function.support (extendByZeroFun (E := E) (K := K) u) + Function.support ψ := by + simpa [smoothFun] using +- (support_convolution_subset (L := ContinuousLinearMap.lsmul ℝ ℝ) (μ := (volume : Measure E)) ++ (support_convolution_subset («L» := ContinuousLinearMap.lsmul ℝ ℝ) (μ := (volume : Measure E)) + (f := extendByZeroFun (E := E) (K := K) u) (g := ψ)) + have h1 : Function.support (extendByZeroFun (E := E) (K := K) u) ⊆ K := by + simp [extendByZeroFun] +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Transfer.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Transfer.lean +index 51414a8..2be859b 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Transfer.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/Transfer.lean +@@ -1,13 +1,13 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.ArzelaAscoli +-import Mathlib.MeasureTheory.Function.LpSpace.Basic +-import Mathlib.Topology.MetricSpace.Pseudo.Basic +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.ArzelaAscoli ++import Mathlib.MeasureTheory.Function.LpSpace.Basic ++import Mathlib.Topology.MetricSpace.Pseudo.Basic ++ + /-! + # `L²` compactness criterion: transfer from `BCF` compactness to `L²` (Euclidean) + +@@ -39,32 +39,217 @@ section Volume + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + +-local instance instMeasurableSpaceE_L2CompactnessTransfer : MeasurableSpace E := borel E +-local instance instBorelSpaceE_L2CompactnessTransfer : BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_L2CompactnessTransfer : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceEL2CompactnessTransfer : MeasurableSpace E := borel E ++local instance instBorelSpaceEL2CompactnessTransfer : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceEL2CompactnessTransfer : OpensMeasurableSpace E := by + infer_instance +-local instance instMeasurableAddE_L2CompactnessTransfer : MeasurableAdd E := by ++local instance instMeasurableAddEL2CompactnessTransfer : MeasurableAdd E := by + infer_instance +-local instance instMeasurableNegE_L2CompactnessTransfer : MeasurableNeg E := by ++local instance instMeasurableNegEL2CompactnessTransfer : MeasurableNeg E := by + infer_instance + + variable {K : Set E} {ψ : E → ℝ} + ++private lemma dist_smoothL2_le_mul_dist_smoothBCF (hK : IsCompact K) (hKm : MeasurableSet K) ++ (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) : ++ ∀ u v : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume.restrict K), ++ dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) ++ (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs v) ≤ ++ (MeasureTheory.measureUnivNNReal ((volume : Measure E).restrict (Kψ (K := K) (ψ := ψ)))) ^ ++ ((2 : ℝ≥0∞).toReal⁻¹) * ++ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) ++ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs v) := by ++ classical ++ let : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ ++ let s : Set E := Kψ (K := K) (ψ := ψ) ++ have hs_compact : IsCompact s := isCompact_Kψ (K := K) (ψ := ψ) hK hψcs ++ have hs : MeasurableSet s := hs_compact.measurableSet ++ have hs_lt_top : (volume : Measure E) s < (⊤ : ℝ≥0∞) := ++ hs_compact.measure_lt_top (μ := (volume : Measure E)) ++ let μs : Measure E := (volume : Measure E).restrict s ++ have : Fact ((volume : Measure E) s < (⊤ : ℝ≥0∞)) := ⟨hs_lt_top⟩ ++ have : IsFiniteMeasure μs := by ++ infer_instance ++ let mS : ℝ := (MeasureTheory.measureUnivNNReal μs) ^ ((2 : ℝ≥0∞).toReal⁻¹) ++ intro u v ++ set Su := ++ smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u ++ set Sv := ++ smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs v ++ set Bu := ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u ++ set Bv := ++ smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs v ++ have hBuBv : 0 ≤ ‖Bu - Bv‖ := norm_nonneg _ ++ -- Work on `F := Su - Sv` and restrict to the finite-measure set `s`. ++ let F : (E →₂[(volume : Measure E)] ℝ) := Su - Sv ++ let g : E → ℝ := fun x => (F : E → ℝ) x ++ have hg : MeasureTheory.MemLp g (2 : ℝ≥0∞) (volume : Measure E) := MeasureTheory.Lp.memLp F ++ have hg_restrict : MeasureTheory.MemLp g (2 : ℝ≥0∞) μs := hg.restrict s ++ let Fs : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μs := hg_restrict.toLp g ++ -- Show `Fs` is pointwise bounded by `‖Bu - Bv‖` on `μs`. ++ have hF_ae : ++ (g =ᵐ[μs] fun x : E => ++ smoothFun (E := E) (K := K) ψ u x - ++ smoothFun (E := E) (K := K) ψ v x) := by ++ have hsub : ++ (F : E → ℝ) =ᵐ[(volume : Measure E)] (Su : E → ℝ) - (Sv : E → ℝ) := by ++ simpa [F, g, Su, Sv] using ++ (MeasureTheory.Lp.coeFn_sub (μ := (volume : Measure E)) Su Sv) ++ have hu : ++ (Su : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ u := ++ smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs u ++ have hv : ++ (Sv : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ v := ++ smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs v ++ have hF : ++ (F : E → ℝ) =ᵐ[(volume : Measure E)] ++ fun x : E => ++ smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x := by ++ have h := hsub.trans (hu.sub hv) ++ filter_upwards [h] with x hx ++ simpa [Pi.sub_apply] using hx ++ exact MeasureTheory.ae_restrict_of_ae (μ := (volume : Measure E)) (s := s) hF ++ have hFs_ae : ((Fs : E → ℝ) =ᵐ[μs] g) := by ++ simpa [Fs, g] using ++ (MeasureTheory.MemLp.coeFn_toLp (μ := μs) (p := (2 : ℝ≥0∞)) (f := g) hg_restrict) ++ have hbound : ++ ∀ᵐ x ∂μs, ‖Fs x‖ ≤ ‖Bu - Bv‖ := by ++ have hpoint : ++ ∀ x : E, x ∈ s → ‖smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x‖ ≤ ++ ‖Bu - Bv‖ := by ++ intro x hx ++ let x' : ↥(Kψ (K := K) (ψ := ψ)) := ⟨x, hx⟩ ++ have hBu : Bu x' = smoothFun (E := E) (K := K) ψ u x := by ++ simp [Bu, x'] ++ have hBv : Bv x' = smoothFun (E := E) (K := K) ψ v x := by ++ simp [Bv, x'] ++ have : ‖(Bu - Bv) x'‖ ≤ ‖Bu - Bv‖ := ++ (Bu - Bv).norm_coe_le_norm x' ++ simpa [hBu, hBv] using this ++ filter_upwards ++ [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hs, ++ hFs_ae, hF_ae] with x hx hFs hF ++ have := hpoint x hx ++ -- rewrite through the AE equalities ++ simpa [hFs, hF] using this ++ have hnorm_Fs : ‖Fs‖ ≤ mS * ‖Bu - Bv‖ := by ++ have := (MeasureTheory.Lp.norm_le_of_ae_bound (μ := μs) (p := (2 : ℝ≥0∞)) ++ (f := Fs) (hC := hBuBv) hbound) ++ simpa [mS] using this ++ -- Relate the `L²` norm on `volume` to the restricted norm on `μs` using extension-by-zero. ++ have hsupport : ++ ∀ x : E, x ∉ s → ++ smoothFun (E := E) (K := K) ψ u x - ++ smoothFun (E := E) (K := K) ψ v x = 0 := by ++ intro x hx ++ have hu_supp : Function.support (smoothFun (E := E) (K := K) ψ u) ⊆ s := by ++ exact ++ (support_smoothFun_subset_add_tsupport (E := E) (K := K) (ψ := ψ) u) ++ have hv_supp : Function.support (smoothFun (E := E) (K := K) ψ v) ⊆ s := by ++ exact ++ (support_smoothFun_subset_add_tsupport (E := E) (K := K) (ψ := ψ) v) ++ have hu0 : smoothFun (E := E) (K := K) ψ u x = 0 := by ++ have : x ∉ Function.support (smoothFun (E := E) (K := K) ψ u) := fun hx' => hx (hu_supp hx') ++ simpa [Function.support] using this ++ have hv0 : smoothFun (E := E) (K := K) ψ v x = 0 := by ++ have : x ∉ Function.support (smoothFun (E := E) (K := K) ψ v) := fun hx' => hx (hv_supp hx') ++ simpa [Function.support] using this ++ simp [hu0, hv0] ++ have hF0 : ++ ∀ᵐ x ∂(volume : Measure E), x ∉ s → g x = 0 := by ++ have hF_ae_full : ++ (g =ᵐ[(volume : Measure E)] ++ fun x : E => ++ smoothFun (E := E) (K := K) ψ u x - ++ smoothFun (E := E) (K := K) ψ v x) := by ++ have hsub : ++ (F : E → ℝ) =ᵐ[(volume : Measure E)] (Su : E → ℝ) - (Sv : E → ℝ) := by ++ simpa [F, g, Su, Sv] using ++ (MeasureTheory.Lp.coeFn_sub (μ := (volume : Measure E)) Su Sv) ++ have hu : ++ (Su : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ u := ++ smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs u ++ have hv : ++ (Sv : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ v := ++ smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs v ++ have hF : ++ (F : E → ℝ) =ᵐ[(volume : Measure E)] ++ fun x : E => ++ smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x := by ++ have h := hsub.trans (hu.sub hv) ++ filter_upwards [h] with x hx ++ simpa [Pi.sub_apply] using hx ++ simpa [g] using hF ++ filter_upwards [hF_ae_full] with x hx ++ intro hxnot ++ have : smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x = 0 := ++ hsupport x hxnot ++ simpa [hx] using this ++ have hF_ind : ++ (s.indicator g =ᵐ[(volume : Measure E)] g) := by ++ filter_upwards [hF0] with x hx ++ by_cases hxmem : x ∈ s ++ · simp [g, hxmem] ++ · have : g x = 0 := hx hxmem ++ simp [g, hxmem, this] ++ -- Conclude `‖F‖ = ‖Fs‖` using `extendByZeroₗᵢ` and the indicator identity. ++ let Fext : ++ MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume : Measure E) := ++ (MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) ++ (s := s) hs) Fs ++ have hFext_ae : ++ ((Fext : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume : Measure E)) : ++ E → ℝ) =ᵐ[(volume : Measure E)] ++ s.indicator fun x : E => (Fs : E → ℝ) x := by ++ simpa [Fext] using ++ (MeasureTheory.Lp.extendByZeroₗᵢ_ae_eq ++ (μ := (volume : Measure E)) (p := (2 : ℝ≥0∞)) ++ (s := s) hs Fs) ++ have hFs_on : ++ ∀ᵐ x ∂(volume : Measure E), x ∈ s → (Fs : E → ℝ) x = g x := by ++ -- rewrite the AE equality `Fs = g` on the restricted measure as an implication on `volume` ++ have := (MeasureTheory.ae_restrict_iff' (μ := (volume : Measure E)) (s := s) hs).1 hFs_ae ++ simpa [g] using this ++ have hindicator : ++ (s.indicator (fun x : E => (Fs : E → ℝ) x) =ᵐ[(volume : Measure E)] s.indicator g) := by ++ filter_upwards [hFs_on] with x hx ++ by_cases hxmem : x ∈ s ++ · simp [hxmem, hx hxmem] ++ · simp [hxmem] ++ have hFext_ae' : ++ (Fext : E → ℝ) =ᵐ[(volume : Measure E)] g := by ++ exact hFext_ae.trans (hindicator.trans hF_ind) ++ have hFext_eq : Fext = F := by ++ refine MeasureTheory.Lp.ext ?_ ++ simpa [g, F] using hFext_ae' ++ have hnorm_F : ‖F‖ ≤ mS * ‖Bu - Bv‖ := by ++ -- use `‖F‖ = ‖Fs‖` via the isometry. ++ have hnorm_ext : ‖Fext‖ = ‖Fs‖ := by ++ simp [Fext] ++ -- `Fext = F` and `Fs` is bounded. ++ have : ‖Fext‖ ≤ mS * ‖Bu - Bv‖ := by ++ simpa [hnorm_ext] using hnorm_Fs ++ simpa [hFext_eq] using this ++ -- Convert to the `dist` statement. ++ simpa [Su, Sv, Bu, Bv, F, dist_eq_norm, mS, mul_assoc] using hnorm_F ++ + theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : MeasurableSet K) + (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) {R : ℝ} (hR : 0 ≤ R) : + IsCompact + (closure + (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs '' Metric.closedBall (0 : _) R)) := by + classical +- letI : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ ++ let : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ + let s : Set E := Kψ (K := K) (ψ := ψ) + have hs_compact : IsCompact s := isCompact_Kψ (K := K) (ψ := ψ) hK hψcs + have hs : MeasurableSet s := hs_compact.measurableSet +- have hs_lt_top : (volume : Measure E) s < ∞ := ++ have hs_lt_top : (volume : Measure E) s < (⊤ : ℝ≥0∞) := + hs_compact.measure_lt_top (μ := (volume : Measure E)) + let μs : Measure E := (volume : Measure E).restrict s +- haveI : Fact ((volume : Measure E) s < ∞) := ⟨hs_lt_top⟩ +- haveI : IsFiniteMeasure μs := by ++ have : Fact ((volume : Measure E) s < (⊤ : ℝ≥0∞)) := ⟨hs_lt_top⟩ ++ have : IsFiniteMeasure μs := by + infer_instance + let mS : ℝ := (MeasureTheory.measureUnivNNReal μs) ^ ((2 : ℝ≥0∞).toReal⁻¹) + have hmS : 0 ≤ mS := by +@@ -79,178 +264,14 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable + smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs '' U + have hA_compact : IsCompact (closure A) := + smoothBCF_image_closedBall_isCompact (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (R := R) hR +- have hdist_smoothL2_le : +- ∀ u v : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume.restrict K), +- dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) +- (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs v) ≤ +- mS * +- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) +- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs v) := by +- intro u v +- set Su := +- smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u +- set Sv := +- smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs v +- set Bu := +- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u +- set Bv := +- smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs v +- have hBuBv : 0 ≤ ‖Bu - Bv‖ := norm_nonneg _ +- -- Work on `F := Su - Sv` and restrict to the finite-measure set `s`. +- let F : (E →₂[(volume : Measure E)] ℝ) := Su - Sv +- let g : E → ℝ := fun x => (F : E → ℝ) x +- have hg : MeasureTheory.MemLp g (2 : ℝ≥0∞) (volume : Measure E) := MeasureTheory.Lp.memLp F +- have hg_restrict : MeasureTheory.MemLp g (2 : ℝ≥0∞) μs := hg.restrict s +- let Fs : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) μs := hg_restrict.toLp g +- -- Show `Fs` is pointwise bounded by `‖Bu - Bv‖` on `μs`. +- have hF_ae : +- (g =ᵐ[μs] fun x : E => +- smoothFun (E := E) (K := K) ψ u x - +- smoothFun (E := E) (K := K) ψ v x) := by +- have hsub : +- (F : E → ℝ) =ᵐ[(volume : Measure E)] (Su : E → ℝ) - (Sv : E → ℝ) := by +- simpa [F, g, Su, Sv] using +- (MeasureTheory.Lp.coeFn_sub (μ := (volume : Measure E)) Su Sv) +- have hu : +- (Su : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ u := +- smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs u +- have hv : +- (Sv : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ v := +- smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs v +- have hF : +- (F : E → ℝ) =ᵐ[(volume : Measure E)] +- fun x : E => +- smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x := by +- simpa [Pi.sub_apply] using hsub.trans (hu.sub hv) +- exact MeasureTheory.ae_restrict_of_ae (μ := (volume : Measure E)) (s := s) hF +- have hFs_ae : ((Fs : E → ℝ) =ᵐ[μs] g) := by +- simpa [Fs, g] using +- (MeasureTheory.MemLp.coeFn_toLp (μ := μs) (p := (2 : ℝ≥0∞)) (f := g) hg_restrict) +- have hbound : +- ∀ᵐ x ∂μs, ‖Fs x‖ ≤ ‖Bu - Bv‖ := by +- have hpoint : +- ∀ x : E, x ∈ s → ‖smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x‖ ≤ +- ‖Bu - Bv‖ := by +- intro x hx +- let x' : ↥(Kψ (K := K) (ψ := ψ)) := ⟨x, hx⟩ +- have hBu : Bu x' = smoothFun (E := E) (K := K) ψ u x := by +- simp [Bu, x'] +- have hBv : Bv x' = smoothFun (E := E) (K := K) ψ v x := by +- simp [Bv, x'] +- have : ‖(Bu - Bv) x'‖ ≤ ‖Bu - Bv‖ := +- (Bu - Bv).norm_coe_le_norm x' +- simpa [hBu, hBv] using this +- filter_upwards +- [MeasureTheory.ae_restrict_mem (μ := (volume : Measure E)) hs, +- hFs_ae, hF_ae] with x hx hFs hF +- have := hpoint x hx +- -- rewrite through the AE equalities +- simpa [hFs, hF] using this +- have hnorm_Fs : ‖Fs‖ ≤ mS * ‖Bu - Bv‖ := by +- have := (MeasureTheory.Lp.norm_le_of_ae_bound (μ := μs) (p := (2 : ℝ≥0∞)) +- (f := Fs) (hC := hBuBv) hbound) +- simpa [mS] using this +- -- Relate the `L²` norm on `volume` to the restricted norm on `μs` using extension-by-zero. +- have hsupport : +- ∀ x : E, x ∉ s → +- smoothFun (E := E) (K := K) ψ u x - +- smoothFun (E := E) (K := K) ψ v x = 0 := by +- intro x hx +- have hu_supp : Function.support (smoothFun (E := E) (K := K) ψ u) ⊆ s := by +- simpa [s] using +- (support_smoothFun_subset_add_tsupport (E := E) (K := K) (ψ := ψ) u) +- have hv_supp : Function.support (smoothFun (E := E) (K := K) ψ v) ⊆ s := by +- simpa [s] using +- (support_smoothFun_subset_add_tsupport (E := E) (K := K) (ψ := ψ) v) +- have hu0 : smoothFun (E := E) (K := K) ψ u x = 0 := by +- have : x ∉ Function.support (smoothFun (E := E) (K := K) ψ u) := fun hx' => hx (hu_supp hx') +- simpa [Function.support] using this +- have hv0 : smoothFun (E := E) (K := K) ψ v x = 0 := by +- have : x ∉ Function.support (smoothFun (E := E) (K := K) ψ v) := fun hx' => hx (hv_supp hx') +- simpa [Function.support] using this +- simp [hu0, hv0] +- have hF0 : +- ∀ᵐ x ∂(volume : Measure E), x ∉ s → g x = 0 := by +- have hF_ae_full : +- (g =ᵐ[(volume : Measure E)] +- fun x : E => +- smoothFun (E := E) (K := K) ψ u x - +- smoothFun (E := E) (K := K) ψ v x) := by +- have hsub : +- (F : E → ℝ) =ᵐ[(volume : Measure E)] (Su : E → ℝ) - (Sv : E → ℝ) := by +- simpa [F, g, Su, Sv] using +- (MeasureTheory.Lp.coeFn_sub (μ := (volume : Measure E)) Su Sv) +- have hu : +- (Su : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ u := +- smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs u +- have hv : +- (Sv : E → ℝ) =ᵐ[(volume : Measure E)] smoothFun (E := E) (K := K) ψ v := +- smoothL2_ae_eq (E := E) (K := K) (ψ := ψ) (hK := hK) (hKm := hKm) hψc hψcs v +- have hF : +- (F : E → ℝ) =ᵐ[(volume : Measure E)] +- fun x : E => +- smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x := by +- simpa [Pi.sub_apply] using hsub.trans (hu.sub hv) +- simpa [g] using hF +- filter_upwards [hF_ae_full] with x hx +- intro hxnot +- have : smoothFun (E := E) (K := K) ψ u x - smoothFun (E := E) (K := K) ψ v x = 0 := +- hsupport x hxnot +- simpa [hx] using this +- have hF_ind : +- (s.indicator g =ᵐ[(volume : Measure E)] g) := by +- filter_upwards [hF0] with x hx +- by_cases hxmem : x ∈ s +- · simp [g, hxmem] +- · have : g x = 0 := hx hxmem +- simp [g, hxmem, this] +- -- Conclude `‖F‖ = ‖Fs‖` using `extendByZeroₗᵢ` and the indicator identity. +- let Fext : +- MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume : Measure E) := +- (MeasureTheory.Lp.extendByZeroₗᵢ (μ := (volume : Measure E)) (E := ℝ) (p := (2 : ℝ≥0∞)) +- (s := s) hs) Fs +- have hFext_ae : +- ((Fext : MeasureTheory.Lp ℝ (2 : ℝ≥0∞) (volume : Measure E)) : +- E → ℝ) =ᵐ[(volume : Measure E)] +- s.indicator fun x : E => (Fs : E → ℝ) x := by +- simpa [Fext] using +- (MeasureTheory.Lp.extendByZeroₗᵢ_ae_eq +- (μ := (volume : Measure E)) (p := (2 : ℝ≥0∞)) +- (s := s) hs Fs) +- have hFs_on : +- ∀ᵐ x ∂(volume : Measure E), x ∈ s → (Fs : E → ℝ) x = g x := by +- -- rewrite the AE equality `Fs = g` on the restricted measure as an implication on `volume` +- have := (MeasureTheory.ae_restrict_iff' (μ := (volume : Measure E)) (s := s) hs).1 hFs_ae +- simpa [g] using this +- have hindicator : +- (s.indicator (fun x : E => (Fs : E → ℝ) x) =ᵐ[(volume : Measure E)] s.indicator g) := by +- filter_upwards [hFs_on] with x hx +- by_cases hxmem : x ∈ s +- · simp [hxmem, hx hxmem] +- · simp [hxmem] +- have hFext_ae' : +- (Fext : E → ℝ) =ᵐ[(volume : Measure E)] g := by +- exact hFext_ae.trans (hindicator.trans hF_ind) +- have hFext_eq : Fext = F := by +- refine MeasureTheory.Lp.ext ?_ +- simpa [g, F] using hFext_ae' +- have hnorm_F : ‖F‖ ≤ mS * ‖Bu - Bv‖ := by +- -- use `‖F‖ = ‖Fs‖` via the isometry. +- have hnorm_ext : ‖Fext‖ = ‖Fs‖ := by +- simp [Fext] +- -- `Fext = F` and `Fs` is bounded. +- have : ‖Fext‖ ≤ mS * ‖Bu - Bv‖ := by +- simpa [hnorm_ext] using hnorm_Fs +- simpa [hFext_eq] using this +- -- Convert to the `dist` statement. +- simpa [Su, Sv, Bu, Bv, F, dist_eq_norm, mS, mul_assoc] using hnorm_F ++ have hdist_smoothL2_le := ++ dist_smoothL2_le_mul_dist_smoothBCF (K := K) (ψ := ψ) hK hKm hψc hψcs + have hTB_B : TotallyBounded B := by + -- Use a finite `BCF` ε-net for `A` with centers in the image, then transfer to `L²`. + rw [Metric.totallyBounded_iff] + intro ε hε + by_cases hmS0 : mS = 0 +- · +- let c : (E →₂[(volume : Measure E)] ℝ) := ++ · let c : (E →₂[(volume : Measure E)] ℝ) := + smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs (0 : _) + refine ⟨{c}, by simp [c], ?_⟩ + intro w hw +@@ -260,9 +281,15 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable + have hdist0 : + dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) + c = 0 := by ++ have hmS0' : ++ (MeasureTheory.measureUnivNNReal ((volume : Measure E).restrict s) : ℝ) ^ ++ ((2 : ℝ≥0∞).toReal⁻¹) = 0 := hmS0 + have : + dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) c ≤ 0 := by +- simpa [c, hmS0] using hle ++ have hle' := hle ++ simp only [s] at hmS0' ++ rw [hmS0', zero_mul] at hle' ++ simpa [c] using hle' + exact le_antisymm this dist_nonneg + refine mem_iUnion.2 ?_ + refine ⟨c, mem_iUnion.2 ?_⟩ +@@ -270,10 +297,10 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable + -- membership in the open ball follows from `dist = 0` and `ε > 0` + simpa [Metric.mem_ball, hdist0] using hε + · have hmSpos : 0 < mS := lt_of_le_of_ne hmS (Ne.symm hmS0) +- let δ : ℝ := ε / mS +- have hδpos : 0 < δ := div_pos hε hmSpos ++ let deltaLoss : ℝ := ε / mS ++ have hδpos : 0 < deltaLoss := div_pos hε hmSpos + obtain ⟨t, htAsub, htFin, htCover⟩ := +- exists_finite_cover_balls_of_isCompact_closure (s := A) (ε := δ) hA_compact hδpos ++ exists_finite_cover_balls_of_isCompact_closure (s := A) (ε := deltaLoss) hA_compact hδpos + let tFin : Finset (BoundedContinuousFunction (↥(Kψ (K := K) (ψ := ψ))) ℝ) := + htFin.toFinset + have htFin_mem : +@@ -300,14 +327,14 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable + rcases hw with ⟨u, huU, rfl⟩ + have hBu : (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) ∈ A := by + exact ⟨u, huU, rfl⟩ +- have : smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u ∈ ⋃ x ∈ t, Metric.ball x δ := ++ have : smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u ∈ ⋃ x ∈ t, Metric.ball x deltaLoss := + htCover hBu + rcases mem_iUnion.1 this with ⟨f, hf⟩ + rcases mem_iUnion.1 hf with ⟨hf_t, hf_ball⟩ + have hf_tFin : f ∈ tFin := (htFin_mem (f := f)).2 hf_t + let f' : ι := ⟨f, hf_tFin⟩ + have hf_ball' : +- dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) f < δ := hf_ball ++ dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) f < deltaLoss := hf_ball + have hdist : + dist (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs u) + (smoothL2 (E := E) (K := K) ψ hK hKm hψc hψcs (uOf f')) < ε := by +@@ -317,17 +344,17 @@ theorem smoothL2_image_closedBall_isCompact (hK : IsCompact K) (hKm : Measurable + simpa [f'] using huOfEq f' + have hdist' : + dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) +- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < δ := by ++ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < deltaLoss := by + simpa [hf_eq] using hf_ball' + have : mS * dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) + (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < ε := by + have : mS * dist (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs u) +- (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < mS * δ := by ++ (smoothBCF (E := E) (K := K) (ψ := ψ) hK hKm hψc hψcs (uOf f')) < mS * deltaLoss := by + exact mul_lt_mul_of_pos_left hdist' hmSpos +- have hmul : mS * δ = ε := by ++ have hmul : mS * deltaLoss = ε := by + have hmS_ne : mS ≠ 0 := ne_of_gt hmSpos + calc +- mS * δ = mS * (ε / mS) := by simp [δ] ++ mS * deltaLoss = mS * (ε / mS) := by simp [deltaLoss] + _ = mS * ε / mS := (mul_div_assoc mS ε mS).symm + _ = ε := by simpa using (mul_div_cancel_left₀ ε hmS_ne) + simpa [hmul] using this +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/TranslationIntegral.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/TranslationIntegral.lean +index cdb4346..6914c2a 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/TranslationIntegral.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/L2Compactness/TranslationIntegral.lean +@@ -1,13 +1,13 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Approximation +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation +-import Mathlib.MeasureTheory.Integral.Bochner.Basic +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Approximation ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation ++import Mathlib.MeasureTheory.Integral.Bochner.Basic ++ + /-! + # `L²` compactness criterion: bounding the translation-integral by a translation modulus + +@@ -38,59 +38,60 @@ section Volume + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + +-local instance instMeasurableSpaceE_L2CompactnessTranslationIntegral : MeasurableSpace E := borel E +-local instance instBorelSpaceE_L2CompactnessTranslationIntegral : BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_L2CompactnessTranslationIntegral : ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceEL2CompactnessTranslationIntegral : MeasurableSpace E := borel E ++local instance instBorelSpaceEL2CompactnessTranslationIntegral : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceEL2CompactnessTranslationIntegral : + OpensMeasurableSpace E := by infer_instance +-local instance instMeasurableAddE_L2CompactnessTranslationIntegral : MeasurableAdd E := by ++local instance instMeasurableAddEL2CompactnessTranslationIntegral : MeasurableAdd E := by + infer_instance +-local instance instMeasurableNegE_L2CompactnessTranslationIntegral : MeasurableNeg E := by ++local instance instMeasurableNegEL2CompactnessTranslationIntegral : MeasurableNeg E := by + infer_instance + + variable {ψ : E → ℝ} + +-private lemma kernelMeasure_compl_ball_eq_zero_of_tsupport_subset {δ : ℝ} +- (hψsupp : tsupport ψ ⊆ Metric.ball (0 : E) δ) : +- kernelMeasure (E := E) ψ ((Metric.ball (0 : E) δ)ᶜ) = 0 := by ++private lemma kernelMeasure_compl_ball_eq_zero_of_tsupport_subset {deltaLoss : ℝ} ++ (hψsupp : tsupport ψ ⊆ Metric.ball (0 : E) deltaLoss) : ++ kernelMeasure (E := E) ψ ((Metric.ball (0 : E) deltaLoss)ᶜ) = 0 := by + classical +- have hψzero : ∀ x : E, x ∈ (Metric.ball (0 : E) δ)ᶜ → ψ x = 0 := by ++ have hψzero : ∀ x : E, x ∈ (Metric.ball (0 : E) deltaLoss)ᶜ → ψ x = 0 := by + intro x hx + have hx' : x ∉ tsupport ψ := by + intro hx_ts + exact hx (hψsupp hx_ts) + exact image_eq_zero_of_notMem_tsupport (f := ψ) hx' +- have hmeas : MeasurableSet ((Metric.ball (0 : E) δ)ᶜ) := +- (measurableSet_ball : MeasurableSet (Metric.ball (0 : E) δ)).compl ++ have hmeas : MeasurableSet ((Metric.ball (0 : E) deltaLoss)ᶜ) := ++ (measurableSet_ball : MeasurableSet (Metric.ball (0 : E) deltaLoss)).compl + have hEq : +- Set.EqOn (fun x : E => ENNReal.ofReal (ψ x)) 0 ((Metric.ball (0 : E) δ)ᶜ) := by ++ Set.EqOn (fun x : E => ENNReal.ofReal (ψ x)) 0 ((Metric.ball (0 : E) deltaLoss)ᶜ) := by + intro x hx + simp [hψzero x hx] + -- Expand `kernelMeasure` and note the density is identically `0` on the set. + simp [kernelMeasure, MeasureTheory.withDensity_apply, hmeas, + MeasureTheory.setLIntegral_eq_zero + (μ := (volume : Measure E)) +- (s := (Metric.ball (0 : E) δ)ᶜ) hmeas hEq] ++ (s := (Metric.ball (0 : E) deltaLoss)ᶜ) hmeas hEq] + + theorem integral_norm_sq_translateL2_sub_le_sq_of_tsupport_subset_ball + (hψc : Continuous ψ) (hψcs : HasCompactSupport ψ) (hψ0 : ∀ x, 0 ≤ ψ x) + (hψint : ∫ x, ψ x ∂(volume : Measure E) = 1) +- {δ η : ℝ} (hη : 0 ≤ η) (hψsupp : tsupport ψ ⊆ Metric.ball (0 : E) δ) ++ {deltaLoss η : ℝ} (hη : 0 ≤ η) (hψsupp : tsupport ψ ⊆ Metric.ball (0 : E) deltaLoss) + (F : (E →₂[(volume : Measure E)] ℝ)) + (hmod : +- ∀ t : E, t ∈ Metric.ball (0 : E) δ → ++ ∀ t : E, t ∈ Metric.ball (0 : E) deltaLoss → + ‖(translateL2 (μ := (volume : Measure E)) (-t)) F - F‖ ≤ η) : + ∫ t, + ‖(translateL2 (μ := (volume : Measure E)) (-t)) F - F‖ ^ 2 + ∂kernelMeasure (E := E) ψ ≤ η ^ 2 := by + classical + let μ : Measure E := kernelMeasure (E := E) ψ +- haveI : MeasureTheory.IsProbabilityMeasure μ := ++ have : MeasureTheory.IsProbabilityMeasure μ := + ⟨kernelMeasure_univ (E := E) (ψ := ψ) hψc hψcs hψ0 hψint⟩ +- have hμzero : μ ((Metric.ball (0 : E) δ)ᶜ) = 0 := by ++ have hμzero : μ ((Metric.ball (0 : E) deltaLoss)ᶜ) = 0 := by + simpa [μ] using kernelMeasure_compl_ball_eq_zero_of_tsupport_subset (E := E) (ψ := ψ) hψsupp +- have hAE_ball : (Metric.ball (0 : E) δ) ∈ MeasureTheory.ae μ := ++ have hAE_ball : (Metric.ball (0 : E) deltaLoss) ∈ MeasureTheory.ae μ := + (MeasureTheory.mem_ae_iff.2 hμzero) +- -- On `Metric.ball 0 δ`, the squared translation error is bounded by `η²`. ++ -- On `Metric.ball 0 deltaLoss`, the squared translation error is bounded by `η²`. + have hAE_bound : + ∀ᵐ t : E ∂μ, + ‖‖(translateL2 (μ := (volume : Measure E)) (-t)) F - F‖ ^ 2‖ ≤ η ^ 2 := by +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Rellich.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Rellich.lean +index 4cd9bb3..b133aa6 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Rellich.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Rellich.lean +@@ -1,19 +1,16 @@ +-import Mathlib.Analysis.Normed.Operator.Compact +-import Mathlib.MeasureTheory.Measure.Lebesgue.Basic +-import Mathlib.MeasureTheory.Function.LpSpace.Complete +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateH1 +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.FrechetKolmogorov +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Kernels +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.TranslationIntegral +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + +-set_option linter.unusedTactic false +-set_option linter.unreachableTactic false ++import Mathlib.Analysis.Normed.Operator.Compact.Basic ++import Mathlib.MeasureTheory.Measure.Lebesgue.Basic ++import Mathlib.MeasureTheory.Function.LpSpace.Complete ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateH1 ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.FrechetKolmogorov ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.Kernels ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.L2Compactness.TranslationIntegral + + /-! + # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Rellich` +@@ -59,15 +56,16 @@ section Volume + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + [CompleteSpace E] + +-local instance instMeasurableSpaceE_SobolevEuclideanRellich : MeasurableSpace E := borel E +-local instance instBorelSpaceE_SobolevEuclideanRellich : BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_SobolevEuclideanRellich : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceRellich : MeasurableSpace E := borel E ++local instance instBorelSpaceRellich : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceRellich : OpensMeasurableSpace E := by + infer_instance +-local instance instMeasurableAddE_SobolevEuclideanRellich : MeasurableAdd E := by ++local instance instMeasurableAddRellich : MeasurableAdd E := by + infer_instance +-local instance instMeasurableNegE_SobolevEuclideanRellich : MeasurableNeg E := by ++local instance instMeasurableNegRellich : MeasurableNeg E := by + infer_instance +-local instance instFactOneLeTwo_SobolevEuclideanRellich : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ ++local instance instFactOneLeTwoSobolevEuclideanRellich : Fact (1 ≤ (2 : ℝ≥0∞)) := ⟨by norm_num⟩ + + /-! ### Supported `H¹` subspace -/ + +@@ -90,7 +88,6 @@ noncomputable def h1OnToL2 (K : Set E) (hKm : MeasurableSet K) : + + /-! ### Euclidean Rellich on fixed compact support -/ + +-set_option maxHeartbeats 2000000 in + /-- Euclidean Rellich–Kondrachov compactness (Lebesgue): on a fixed compact support `K`, the + inclusion `H¹ → L²` is a compact operator. -/ + theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : MeasurableSet K) : +@@ -105,10 +102,9 @@ theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : Measur + L2Compactness.extendByZeroL2 (E := E) (K := K) hKm u ∈ + T '' Metric.closedBall (0 : ↥(h1On (E := E) K hKm)) 1} + let C : ℝ := +- (h1ToL2 (μ := (volume : Measure E)) (E := E)).opNorm ++ ‖h1ToL2 (μ := (volume : Measure E)) (E := E)‖ + have hCnonneg : 0 ≤ C := by +- dsimp [C] +- exact (h1ToL2 (μ := (volume : Measure E)) (E := E)).opNorm_nonneg ++ exact norm_nonneg (h1ToL2 (μ := (volume : Measure E)) (E := E)) + have hA_ball : + A ⊆ + Metric.closedBall +@@ -119,7 +115,7 @@ theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : Measur + have hx' : ‖(x : H1vol)‖ ≤ (1 : ℝ) := by + -- `h1On` inherits the ambient norm, so this is definitional. + change ‖x‖ ≤ (1 : ℝ) +- exact (mem_closedBall_zero_iff.mp hx) ++ simpa only [Metric.mem_closedBall,dist_zero_right x] using hx + have hTx' : ‖T x‖ ≤ C := by + have hTx : ‖T x‖ ≤ C * ‖(x : H1vol)‖ := by + have h := +@@ -150,20 +146,20 @@ theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : Measur + have hδ : 0 < ε / 2 := by linarith + rcases + L2Compactness.exists_kernel_tsupport_subset_ball_integral_eq_one +- (E := E) (δ := ε / 2) hδ with ++ (E := E) (deltaLoss := ε / 2) hδ with + ⟨ψ, hψc, hψcs, hψ0, hψint, hψsupp⟩ + refine ⟨ψ, hψc, hψcs, hψ0, hψint, ?_⟩ + intro u huA + rcases huA with ⟨x, hx, hxEq⟩ + have hxH1 : ‖(x : H1vol)‖ ≤ (1 : ℝ) := by + change ‖x‖ ≤ (1 : ℝ) +- exact (mem_closedBall_zero_iff.mp hx) ++ simpa only [Metric.mem_closedBall,dist_zero_right x] using hx + have hmod : + ∀ t : E, t ∈ Metric.ball (0 : E) (ε / 2) → + ‖(translateL2 (μ := (volume : Measure E)) (-t)) (T x) - T x‖ ≤ ε / 2 := by + intro t ht + have ht' : ‖t‖ ≤ ε / 2 := le_of_lt (by +- simpa [Metric.ball, dist_eq_norm, mem_setOf_eq] using ht) ++ simpa [Metric.ball, dist_eq_norm, mem_ofPred_eq] using ht) + have hgrad_le : + ‖h1ToL2Grad (μ := (volume : Measure E)) (E := E) (x : H1vol)‖ ≤ ‖(x : H1vol)‖ := by + let V : Type _ := (E →₂[(volume : Measure E)] ℝ) × (E →₂[(volume : Measure E)] E) +@@ -192,7 +188,7 @@ theorem isCompactOperator_h1OnToL2 {K : Set E} (_hK : IsCompact K) (hKm : Measur + have hη : 0 ≤ ε / 2 := le_of_lt hδ + have hbound := + L2Compactness.integral_norm_sq_translateL2_sub_le_sq_of_tsupport_subset_ball +- (E := E) (ψ := ψ) hψc hψcs hψ0 hψint (δ := ε / 2) (η := ε / 2) hη hψsupp (T x) hmod ++ (E := E) (ψ := ψ) hψc hψcs hψ0 hψint (deltaLoss := ε / 2) (η := ε / 2) hη hψsupp (T x) hmod + simpa [hxEq] using hbound + have hcomp : IsCompact (closure (T '' Metric.closedBall (0 : ↥(h1On (E := E) K hKm)) 1)) := by + have hR : 0 ≤ C := hCnonneg +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Translation.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Translation.lean +index c009eb8..f3b80d4 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Translation.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/Translation.lean +@@ -1,15 +1,15 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1 +-import Mathlib.Analysis.Calculus.FDeriv.Add +-import Mathlib.MeasureTheory.Group.Measure +-import Mathlib.MeasureTheory.Function.LpSpace.Basic +-import Mathlib.Topology.Algebra.Group.Basic +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1 ++import Mathlib.Analysis.Calculus.FDeriv.Add ++import Mathlib.MeasureTheory.Group.Measure ++import Mathlib.MeasureTheory.Function.LpSpace.Basic ++import Mathlib.Topology.Algebra.Group.Basic ++ + /-! + # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation` + +@@ -47,20 +47,21 @@ omit [CompleteSpace E] in + lemma contDiff_translate {f : E → ℝ} (hf : ContDiff ℝ 1 f) (a : E) : + ContDiff ℝ 1 (translate (E := E) a f) := by + -- `x ↦ x + a` is `C^∞`; compose. +- simpa [translate] using hf.comp (contDiff_id.add contDiff_const) ++ exact hf.comp (contDiff_id.add contDiff_const) + + omit [InnerProductSpace ℝ E] [CompleteSpace E] in + lemma hasCompactSupport_translate {F : Type*} [Zero F] {f : E → F} + (hf : HasCompactSupport f) (a : E) : HasCompactSupport (translate (E := E) a f) := by +- simpa [translate] using hf.comp_homeomorph (Homeomorph.addRight a) ++ exact hf.comp_homeomorph (Homeomorph.addRight a) + + lemma grad_translate (a : E) (f : E → ℝ) (x : E) : + grad (E := E) (translate (E := E) a f) x = grad (E := E) f (x + a) := by + classical + -- `fderiv` commutes with translation, hence so does `grad`. +- simp [grad] +- -- Reduce to the standard `fderiv` translation lemma. +- simpa [translate] using (fderiv_comp_add_right (𝕜 := ℝ) (f := f) (x := x) a) ++ -- Reduce to the standard `fderiv` translation lemma, applied under the Riesz dual map. ++ have hfderiv : fderiv ℝ (translate (E := E) a f) x = fderiv ℝ f (x + a) := ++ fderiv_comp_add_right (𝕜 := ℝ) (f := f) (x := x) a ++ simp only [grad, hfderiv] + + omit [CompleteSpace E] in + lemma mem_C1c_translate {f : E → ℝ} (hf : f ∈ C1c (E := E)) (a : E) : +@@ -83,11 +84,12 @@ section Measure + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] + +-local instance instMeasurableSpaceE_SobolevEuclideanTranslation : MeasurableSpace E := borel E +-local instance instBorelSpaceE_SobolevEuclideanTranslation : BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_SobolevEuclideanTranslation : OpensMeasurableSpace E := by ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceTranslation : MeasurableSpace E := borel E ++local instance instBorelSpaceTranslation : BorelSpace E := ⟨rfl⟩ ++local instance instOpensMeasurableSpaceTranslation : OpensMeasurableSpace E := by + infer_instance +-local instance instMeasurableAddE_SobolevEuclideanTranslation : MeasurableAdd E := by ++local instance instMeasurableAddTranslation : MeasurableAdd E := by + infer_instance + + variable (μ : Measure E) [μ.IsAddRightInvariant] +@@ -106,7 +108,7 @@ lemma translateL2_ae_eq {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] ( + (translateL2 (μ := μ) (F := F) a g : E → F) =ᵐ[μ] fun x => (g : E → F) (x + a) := by + classical + -- Reduce to `Lp.coeFn_compMeasurePreserving`. +- simpa [translateL2] using ++ exact + (MeasureTheory.Lp.coeFn_compMeasurePreserving (g := (g : MeasureTheory.Lp F (2 : ENNReal) μ)) + (hf := MeasureTheory.measurePreserving_add_right μ a)) + +@@ -125,7 +127,7 @@ lemma translateL2_toL2 (a : E) (f : ↥(C1c (E := E))) : + have hf' : + (fun x => (toL2 (μ := μ) (E := E) f : E → ℝ) (x + a)) =ᵐ[μ] fun x => f.1 (x + a) := by + -- Move the a.e. equality through a measure-preserving map. +- simpa [Function.comp, Pi.add_apply] using ++ exact + (Measure.QuasiMeasurePreserving.ae_eq_comp + (MeasureTheory.measurePreserving_add_right μ a).quasiMeasurePreserving hf) + exact (translateL2_ae_eq (μ := μ) (F := ℝ) a (toL2 (μ := μ) (E := E) f)).trans hf' +@@ -133,7 +135,7 @@ lemma translateL2_toL2 (a : E) (f : ↥(C1c (E := E))) : + (toL2 (μ := μ) (E := E) (translateC1c (E := E) a f) : E → ℝ) =ᵐ[μ] + fun x => f.1 (x + a) := by + -- `toL2` agrees a.e. with the underlying translated function. +- simpa [translateC1c, translate] using ++ exact + (memLp_of_mem_C1c (μ := μ) (E := E) (translateC1c (E := E) a f).2).coeFn_toLp + exact h₁.trans h₂.symm + +@@ -150,7 +152,7 @@ lemma translateL2_toL2Grad (a : E) (f : ↥(C1c (E := E))) : + have hf' : + (fun x => (toL2Grad (μ := μ) (E := E) f : E → E) (x + a)) =ᵐ[μ] + fun x => grad (E := E) f.1 (x + a) := by +- simpa [Function.comp, Pi.add_apply] using ++ exact + (Measure.QuasiMeasurePreserving.ae_eq_comp + (MeasureTheory.measurePreserving_add_right μ a).quasiMeasurePreserving hf) + exact +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimate.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimate.lean +index fcec373..7556a69 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimate.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimate.lean +@@ -1,15 +1,15 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1 +-import Mathlib.MeasureTheory.Integral.IntervalIntegral.ContDiff +-import Mathlib.Analysis.Calculus.Deriv.Comp +-import Mathlib.Analysis.Calculus.Deriv.Mul +-import Mathlib.Analysis.Calculus.Deriv.Add +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.H1 ++import Mathlib.MeasureTheory.Integral.IntervalIntegral.ContDiff ++import Mathlib.Analysis.Calculus.Deriv.Comp ++import Mathlib.Analysis.Calculus.Deriv.Mul ++import Mathlib.Analysis.Calculus.Deriv.Add ++ + /-! + # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimate` + +@@ -35,11 +35,12 @@ section + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +-local instance instMeasurableSpaceE_SobolevEuclideanTranslationEstimate : ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceTranslationEstimate : + MeasurableSpace E := borel E +-local instance instBorelSpaceE_SobolevEuclideanTranslationEstimate : ++local instance instBorelSpaceTranslationEstimate : + BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_SobolevEuclideanTranslationEstimate : ++local instance instOpensMeasurableSpaceTranslationEstimate : + OpensMeasurableSpace E := by + infer_instance + +@@ -85,10 +86,11 @@ lemma enorm_fderiv_apply_le_enorm_grad_mul (f : E → ℝ) (x a : E) : + -- Use the operator norm bound, then identify `‖fderiv‖` with `‖grad‖` via the Riesz isometry. + have h₁ : + ‖fderiv ℝ f x a‖ₑ ≤ ‖fderiv ℝ f x‖ₑ * ‖a‖ₑ := +- (ContinuousLinearMap.le_opNorm_enorm (f := fderiv ℝ f x) a) ++ (ContinuousLinearMap.le_opENorm (f := fderiv ℝ f x) a) + have h₂ : ‖grad (E := E) f x‖ₑ = ‖fderiv ℝ f x‖ₑ := by + -- `grad f x = (toDual).symm (fderiv f x)` and `toDual.symm` is an isometry. +- simpa [grad] using ++ simp only [grad] ++ exact + (LinearIsometry.enorm_map + (f := (InnerProductSpace.toDual ℝ E).symm.toLinearIsometry) + (fderiv ℝ f x)) +@@ -108,10 +110,10 @@ lemma enorm_deriv_comp_line_le (x a : E) {f : E → ℝ} (hf : ContDiff ℝ 1 f) + + lemma enorm_sub_le_enorm_mul_lintegral_grad (x a : E) {f : E → ℝ} (hf : ContDiff ℝ 1 f) : + ‖f (x + a) - f x‖ₑ ≤ +- ‖a‖ₑ * ∫⁻ t in Icc (0 : ℝ) 1, ‖grad (E := E) f (x + t • a)‖ₑ := by ++ ‖a‖ₑ * ∫⁻ t in Set.Icc (0 : ℝ) 1, ‖grad (E := E) f (x + t • a)‖ₑ := by + -- Apply FTC along the segment `t ↦ x + t • a`, then bound the derivative pointwise. + have hCont : +- ContDiffOn ℝ 1 (fun t : ℝ => f (x + t • a)) (Icc (0 : ℝ) 1) := by ++ ContDiffOn ℝ 1 (fun t : ℝ => f (x + t • a)) (Set.Icc (0 : ℝ) 1) := by + -- `t ↦ x + t • a` is `C^∞`; compose with `f`. + have hInner : ContDiff ℝ ⊤ (fun t : ℝ => x + t • a) := by + simpa [line] using +@@ -119,14 +121,14 @@ lemma enorm_sub_le_enorm_mul_lintegral_grad (x a : E) {f : E → ℝ} (hf : Cont + have hInner' : ContDiff ℝ 1 (fun t : ℝ => x + t • a) := hInner.of_le (by simp) + exact (hf.comp hInner').contDiffOn + have hFTC : +- ‖f (x + a) - f x‖ₑ ≤ ∫⁻ t in Icc (0 : ℝ) 1, ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ := by ++ ‖f (x + a) - f x‖ₑ ≤ ∫⁻ t in Set.Icc (0 : ℝ) 1, ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ := by + simpa using + (enorm_sub_le_lintegral_deriv_of_contDiffOn_Icc (f := fun t : ℝ => f (x + t • a)) + (a := (0 : ℝ)) (b := 1) hCont (by exact zero_le_one)) + refine hFTC.trans ?_ + have hDerivBound : + (fun t : ℝ => ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ) +- ≤ᵐ[Measure.restrict volume (Icc (0 : ℝ) 1)] ++ ≤ᵐ[Measure.restrict volume (Set.Icc (0 : ℝ) 1)] + fun t : ℝ => ‖a‖ₑ * ‖grad (E := E) f (x + t • a)‖ₑ := by + -- Pointwise bound holds everywhere. + refine (ae_of_all _ fun t => ?_) +@@ -135,8 +137,8 @@ lemma enorm_sub_le_enorm_mul_lintegral_grad (x a : E) {f : E → ℝ} (hf : Cont + (enorm_deriv_comp_line_le (x := x) (a := a) (f := f) hf (t := t)) + -- Pull out the constant `‖a‖ₑ`. + have : +- (∫⁻ t in Icc (0 : ℝ) 1, ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ) ≤ +- ∫⁻ t in Icc (0 : ℝ) 1, ‖a‖ₑ * ‖grad (E := E) f (x + t • a)‖ₑ := by ++ (∫⁻ t in Set.Icc (0 : ℝ) 1, ‖deriv (fun t : ℝ => f (x + t • a)) t‖ₑ) ≤ ++ ∫⁻ t in Set.Icc (0 : ℝ) 1, ‖a‖ₑ * ‖grad (E := E) f (x + t • a)‖ₑ := by + exact lintegral_mono_ae hDerivBound + refine this.trans ?_ + -- Pull out the constant factor. +@@ -151,10 +153,10 @@ lemma enorm_sub_le_enorm_mul_lintegral_grad (x a : E) {f : E → ℝ} (hf : Cont + have : Continuous (fun t : ℝ => x + t • a) := by + fun_prop + exact this)).measurable.enorm +- -- Now finish: `∫⁻ t in Icc, ‖a‖ * g t = ‖a‖ * ∫⁻ t in Icc, g t`. ++ -- Now finish: `∫⁻ t in Set.Icc, ‖a‖ * g t = ‖a‖ * ∫⁻ t in Set.Icc, g t`. + exact le_of_eq <| by + simpa [mul_assoc] using +- (MeasureTheory.lintegral_const_mul (μ := volume.restrict (Icc (0 : ℝ) 1)) (r := ‖a‖ₑ) ++ (MeasureTheory.lintegral_const_mul (μ := volume.restrict (Set.Icc (0 : ℝ) 1)) (r := ‖a‖ₑ) + (f := fun t : ℝ => ‖grad (E := E) f (x + t • a)‖ₑ) hMeas) + + end +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateH1.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateH1.lean +index 6bac2f7..4e7144c 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateH1.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateH1.lean +@@ -1,12 +1,12 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateL2 +-import Mathlib.Topology.Order.OrderClosed +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateL2 ++import Mathlib.Topology.Order.OrderClosed ++ + /-! + # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateH1` + +@@ -33,14 +33,15 @@ section + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] + +-local instance instMeasurableSpaceE_SobolevEuclideanTranslationEstimateH1 : ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceTranslationEstimateH1 : + MeasurableSpace E := borel E +-local instance instBorelSpaceE_SobolevEuclideanTranslationEstimateH1 : ++local instance instBorelSpaceTranslationEstimateH1 : + BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_SobolevEuclideanTranslationEstimateH1 : ++local instance instOpensMeasurableSpaceTranslationEstimateH1 : + OpensMeasurableSpace E := by + infer_instance +-local instance instMeasurableAddE_SobolevEuclideanTranslationEstimateH1 : MeasurableAdd E := by ++local instance instMeasurableAddTranslationEstimateH1 : MeasurableAdd E := by + infer_instance + + variable (μ : Measure E) [μ.IsAddRightInvariant] [IsFiniteMeasureOnCompacts μ] [SFinite μ] +@@ -73,14 +74,14 @@ theorem norm_translateL2_sub_h1ToL2_le (a : E) (u : ↥(h1 (μ := μ) (E := E))) + have hsub : + Continuous fun v : V => + translateL2 (μ := μ) (F := ℝ) a v.1 - v.1 := by +- simpa [sub_eq_add_neg] using htr.sub hfst +- simpa using (continuous_norm.comp hsub) ++ exact htr.sub hfst ++ exact (continuous_norm.comp hsub) + have hg : + Continuous fun v : V => + ‖a‖ * ‖v.2‖ := by + have hsnd : Continuous fun v : V => v.2 := continuous_snd + have hnorm : Continuous fun v : V => ‖v.2‖ := continuous_norm.comp hsnd +- simpa [mul_assoc] using (continuous_const.mul hnorm) ++ exact (continuous_const.mul hnorm) + exact isClosed_le hf hg + have hRange : (LinearMap.range (graph (μ := μ) (E := E)) : Set V) ⊆ S := by + rintro v ⟨f, rfl⟩ +diff --git a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateL2.lean b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateL2.lean +index 9a903af..0264ad8 100644 +--- a/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateL2.lean ++++ b/RellichKondrachov/Analysis/FunctionalSpaces/Sobolev/Euclidean/TranslationEstimateL2.lean +@@ -1,14 +1,14 @@ +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation +-import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimate +-import Mathlib.MeasureTheory.Integral.MeanInequalities +-import Mathlib.MeasureTheory.Measure.Prod +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.Translation ++import RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimate ++import Mathlib.MeasureTheory.Integral.MeanInequalities ++import Mathlib.MeasureTheory.Measure.Prod ++ + /-! + # `RellichKondrachov.Analysis.FunctionalSpaces.Sobolev.Euclidean.TranslationEstimateL2` + +@@ -40,19 +40,20 @@ section + + variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] + +-local instance instMeasurableSpaceE_SobolevEuclideanTranslationEstimateL2 : ++/-- Borel σ-algebra on the model space `E`. -/ ++local instance instMeasurableSpaceTranslationEstimateL2 : + MeasurableSpace E := borel E +-local instance instBorelSpaceE_SobolevEuclideanTranslationEstimateL2 : ++local instance instBorelSpaceTranslationEstimateL2 : + BorelSpace E := ⟨rfl⟩ +-local instance instOpensMeasurableSpaceE_SobolevEuclideanTranslationEstimateL2 : ++local instance instOpensMeasurableSpaceTranslationEstimateL2 : + OpensMeasurableSpace E := by + infer_instance +-local instance instMeasurableAddE_SobolevEuclideanTranslationEstimateL2 : MeasurableAdd E := by ++local instance instMeasurableAddTranslationEstimateL2 : MeasurableAdd E := by + infer_instance + + variable (μ : Measure E) [μ.IsAddRightInvariant] [IsFiniteMeasureOnCompacts μ] [SFinite μ] + +-private abbrev μI : Measure ℝ := (volume.restrict (Icc (0 : ℝ) 1)) ++private abbrev μI : Measure ℝ := (volume.restrict (Set.Icc (0 : ℝ) 1)) + + private lemma μI_univ : (μI : Measure ℝ) Set.univ = (1 : ℝ≥0∞) := by + simp [μI, Measure.restrict_apply, Real.volume_Icc] +@@ -92,7 +93,143 @@ private lemma lintegral_rpow_two_le_lintegral_rpow_two + (∫⁻ t, g t ^ (2 : ℝ) ∂(μI : Measure ℝ)) + (1 / (2 : ℝ)) (2 : ℝ)).symm)) + ++omit [IsFiniteMeasureOnCompacts μ] in + /-- `L²` translation estimate for `C¹_c` functions under a right-invariant measure. -/ ++private lemma lintegral_enorm_sub_sq_le (a : E) (f : ↥(C1c (E := E))) : ++ (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ≤ ++ ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by ++ -- Pointwise: Cauchy–Schwarz in `t`, then Tonelli in `(x,t)`. ++ have hpt : ++ ∀ x : E, ++ ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ≤ ++ ‖a‖ₑ ^ (2 : ℝ) * ++ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) := by ++ intro x ++ have h0 := enorm_sub_le_enorm_mul_lintegral_grad (E := E) (x := x) (a := a) (f := f.1) ++ (hf := f.2.1) ++ -- Square both sides and apply Cauchy–Schwarz in `t`. ++ have h1 : ++ ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ≤ ++ (‖a‖ₑ * ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := by ++ exact ENNReal.rpow_le_rpow h0 (by norm_num) ++ have hcs : ++ (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) ≤ ++ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) := by ++ refine lintegral_rpow_two_le_lintegral_rpow_two (g := fun t : ℝ => ++ ‖grad (E := E) f.1 (x + t • a)‖ₑ) ?_ ++ -- measurability from continuity of `grad`. ++ have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 ++ have hline : Continuous fun t : ℝ => x + t • a := by ++ fun_prop ++ exact (hgrad.comp hline).measurable.enorm.aemeasurable ++ -- Combine and rewrite. ++ calc ++ ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ++ ≤ (‖a‖ₑ * ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := h1 ++ _ = ‖a‖ₑ ^ (2 : ℝ) * ++ (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ++ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := by ++ simpa using ++ (ENNReal.mul_rpow_of_nonneg ‖a‖ₑ ++ (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ++ ∂(μI : Measure ℝ)) ++ (show (0 : ℝ) ≤ (2 : ℝ) by norm_num)) ++ _ ≤ ‖a‖ₑ ^ (2 : ℝ) * ++ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ++ ∂(μI : Measure ℝ) := by ++ gcongr ++ _ = ‖a‖ₑ ^ (2 : ℝ) * ++ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ++ ∂(μI : Measure ℝ) := rfl ++ -- Integrate over `x` and apply Tonelli to swap integrals. ++ let F : E × ℝ → ℝ≥0∞ := ++ fun z => ‖grad (E := E) f.1 (z.1 + z.2 • a)‖ₑ ^ (2 : ℝ) ++ have hmeas : ++ AEMeasurable ++ F (μ.prod (μI : Measure ℝ)) := by ++ have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 ++ have hcont : Continuous fun z : E × ℝ => z.1 + z.2 • a := by ++ fun_prop ++ have hbase : Measurable fun z : E × ℝ => ‖grad (E := E) f.1 (z.1 + z.2 • a)‖ₑ := by ++ exact (hgrad.comp hcont).measurable.enorm ++ have hpow : Measurable fun r : ℝ≥0∞ => r ^ (2 : ℝ) := ++ (ENNReal.continuous_rpow_const (y := (2 : ℝ))).measurable ++ exact (hpow.comp hbase).aemeasurable ++ have hTonelli : ++ (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) = ++ ∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ) := by ++ -- Tonelli in both orders, via the product measure. ++ have hprod : ++ (∫⁻ z, F z ∂μ.prod (μI : Measure ℝ)) = ++ ∫⁻ x, ∫⁻ t, F (x, t) ∂(μI : Measure ℝ) ∂μ := ++ MeasureTheory.lintegral_prod (μ := μ) (ν := (μI : Measure ℝ)) F hmeas ++ have hprod_symm : ++ (∫⁻ z, F z ∂μ.prod (μI : Measure ℝ)) = ++ ∫⁻ t, ∫⁻ x, F (x, t) ∂μ ∂(μI : Measure ℝ) := ++ MeasureTheory.lintegral_prod_symm (μ := μ) (ν := (μI : Measure ℝ)) F hmeas ++ calc ++ (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) ++ = ∫⁻ z, F z ∂μ.prod (μI : Measure ℝ) := by ++ simpa [F] using hprod.symm ++ _ = ∫⁻ t, ∫⁻ x, F (x, t) ∂μ ∂(μI : Measure ℝ) := hprod_symm ++ _ = ∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ) := by ++ simp [F] ++ -- Now use measure-preserving translation in `x` and evaluate the `t`-integral. ++ have hShift : ++ (∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ)) = ++ ∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ) := by ++ refine MeasureTheory.lintegral_congr fun t => ?_ ++ -- Change of variables `x ↦ x + t•a`. ++ have hmeas' : Measurable fun x : E => ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) := by ++ have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 ++ have hbase : Measurable fun x : E => ‖grad (E := E) f.1 x‖ₑ := hgrad.measurable.enorm ++ have hpow : Measurable fun r : ℝ≥0∞ => r ^ (2 : ℝ) := ++ (ENNReal.continuous_rpow_const (y := (2 : ℝ))).measurable ++ exact hpow.comp hbase ++ simpa [Function.comp, add_assoc] using ++ (MeasureTheory.measurePreserving_add_right μ (t • a)).lintegral_comp (μ := μ) (ν := μ) ++ (f := fun x : E => ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ)) hmeas' ++ have hEval : ++ (∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ)) = ++ (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by ++ -- `μI` has total mass `1`. ++ simp [μI, Measure.restrict_apply, Real.volume_Icc] ++ -- Put everything together. ++ have hInt : ++ (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ≤ ++ ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by ++ calc ++ (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ++ ≤ ∫⁻ x, ‖a‖ₑ ^ (2 : ℝ) * ++ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ := by ++ refine MeasureTheory.lintegral_mono ?_ ++ intro x ++ exact hpt x ++ _ = ‖a‖ₑ ^ (2 : ℝ) * ++ (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) := by ++ -- Pull out the constant using `lintegral_const_mul''`. ++ have hInner : ++ AEMeasurable ++ (fun x : E => ++ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ)) μ := by ++ -- Measurability of the inner integral follows ++ -- from `hmeas` via ++ -- `AEMeasurable.lintegral_prod_right'`. ++ simpa [F] using (hmeas.lintegral_prod_right' (μ := μ) (ν := (μI : Measure ℝ))) ++ simpa [mul_assoc] using ++ (MeasureTheory.lintegral_const_mul'' (μ := μ) (r := ‖a‖ₑ ^ (2 : ℝ)) ++ (f := fun x : E => ++ ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ)) hInner) ++ _ = ‖a‖ₑ ^ (2 : ℝ) * ++ (∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ)) := by ++ exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hTonelli ++ _ = ‖a‖ₑ ^ (2 : ℝ) * ++ (∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ)) := by ++ exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hShift ++ _ = ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by ++ exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hEval ++ exact hInt ++ + lemma enorm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : + ‖translateL2 (μ := μ) (F := ℝ) a (toL2 (μ := μ) (E := E) f) - + toL2 (μ := μ) (E := E) f‖ₑ ≤ +@@ -112,7 +249,7 @@ lemma enorm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : + (memLp_of_mem_C1c (μ := μ) (E := E) f.2).coeFn_toLp + have hf' : + (fun x => (toL2 (μ := μ) (E := E) f : E → ℝ) (x + a)) =ᵐ[μ] fun x => f.1 (x + a) := by +- simpa [Function.comp, Pi.add_apply] using ++ exact + (Measure.QuasiMeasurePreserving.ae_eq_comp + (MeasureTheory.measurePreserving_add_right μ a).quasiMeasurePreserving hf) + exact (translateL2_ae_eq (μ := μ) (F := ℝ) a (toL2 (μ := μ) (E := E) f)).trans hf' +@@ -159,144 +296,23 @@ lemma enorm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : + ‖a‖ₑ * MeasureTheory.eLpNorm (fun x : E => grad (E := E) f.1 x) (2 : ℝ≥0∞) μ := by + -- Expand the definition of `eLpNorm` at exponent `2`. + have h2_ne0 : (2 : ℝ≥0∞) ≠ 0 := by simp +- have h2_netop : (2 : ℝ≥0∞) ≠ ∞ := by simp +- simp_rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal +- h2_ne0 h2_netop, ENNReal.toReal_ofNat] at * ++ have h2_netop : (2 : ℝ≥0∞) ≠ (⊤ : ℝ≥0∞) := by simp ++ have hf_meas : MeasureTheory.AEStronglyMeasurable (fun x : E => f.1 x) μ := ++ (memLp_of_mem_C1c (μ := μ) (E := E) f.2).aestronglyMeasurable ++ have hshift_meas : ++ MeasureTheory.AEStronglyMeasurable (fun x : E => f.1 (x + a) - f.1 x) μ := by ++ have hshift : MeasureTheory.AEStronglyMeasurable (fun x : E => f.1 (x + a)) μ := ++ hf_meas.comp_quasiMeasurePreserving ++ (MeasureTheory.measurePreserving_add_right μ a).quasiMeasurePreserving ++ exact hshift.sub hf_meas ++ have hgrad_meas : ++ MeasureTheory.AEStronglyMeasurable (fun x : E => grad (E := E) f.1 x) μ := ++ (memLp_grad_of_mem_C1c (μ := μ) (E := E) f.2).aestronglyMeasurable ++ rw [MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal h2_ne0 h2_netop hshift_meas, ++ MeasureTheory.eLpNorm_eq_lintegral_rpow_enorm_toReal h2_ne0 h2_netop hgrad_meas, ++ ENNReal.toReal_ofNat] + -- It suffices to compare the squared integrals. +- have hsq : +- (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ≤ +- ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by +- -- Pointwise: Cauchy–Schwarz in `t`, then Tonelli in `(x,t)`. +- have hpt : +- ∀ x : E, +- ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ≤ +- ‖a‖ₑ ^ (2 : ℝ) * +- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) := by +- intro x +- have h0 := enorm_sub_le_enorm_mul_lintegral_grad (E := E) (x := x) (a := a) (f := f.1) +- (hf := f.2.1) +- -- Square both sides and apply Cauchy–Schwarz in `t`. +- have h1 : +- ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ≤ +- (‖a‖ₑ * ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := by +- exact ENNReal.rpow_le_rpow h0 (by norm_num) +- have hcs : +- (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) ≤ +- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) := by +- refine lintegral_rpow_two_le_lintegral_rpow_two (g := fun t : ℝ => +- ‖grad (E := E) f.1 (x + t • a)‖ₑ) ?_ +- -- measurability from continuity of `grad`. +- have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 +- have hline : Continuous fun t : ℝ => x + t • a := by +- fun_prop +- exact (hgrad.comp hline).measurable.enorm.aemeasurable +- -- Combine and rewrite. +- calc +- ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) +- ≤ (‖a‖ₑ * ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ∂(μI : Measure ℝ)) ^ (2 : ℝ) := h1 +- _ = ‖a‖ₑ ^ (2 : ℝ) * +- (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ +- ∂(μI : Measure ℝ)) ^ (2 : ℝ) := by +- simpa using +- (ENNReal.mul_rpow_of_nonneg ‖a‖ₑ +- (∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ +- ∂(μI : Measure ℝ)) +- (show (0 : ℝ) ≤ (2 : ℝ) by norm_num)) +- _ ≤ ‖a‖ₑ ^ (2 : ℝ) * +- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) +- ∂(μI : Measure ℝ) := by +- gcongr +- _ = ‖a‖ₑ ^ (2 : ℝ) * +- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) +- ∂(μI : Measure ℝ) := rfl +- -- Integrate over `x` and apply Tonelli to swap integrals. +- let F : E × ℝ → ℝ≥0∞ := +- fun z => ‖grad (E := E) f.1 (z.1 + z.2 • a)‖ₑ ^ (2 : ℝ) +- have hmeas : +- AEMeasurable +- F (μ.prod (μI : Measure ℝ)) := by +- have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 +- have hcont : Continuous fun z : E × ℝ => z.1 + z.2 • a := by +- fun_prop +- have hbase : Measurable fun z : E × ℝ => ‖grad (E := E) f.1 (z.1 + z.2 • a)‖ₑ := by +- exact (hgrad.comp hcont).measurable.enorm +- have hpow : Measurable fun r : ℝ≥0∞ => r ^ (2 : ℝ) := +- (ENNReal.continuous_rpow_const (y := (2 : ℝ))).measurable +- simpa [F] using (hpow.comp hbase).aemeasurable +- have hTonelli : +- (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) = +- ∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ) := by +- -- Tonelli in both orders, via the product measure. +- have hprod : +- (∫⁻ z, F z ∂μ.prod (μI : Measure ℝ)) = +- ∫⁻ x, ∫⁻ t, F (x, t) ∂(μI : Measure ℝ) ∂μ := +- MeasureTheory.lintegral_prod (μ := μ) (ν := (μI : Measure ℝ)) F hmeas +- have hprod_symm : +- (∫⁻ z, F z ∂μ.prod (μI : Measure ℝ)) = +- ∫⁻ t, ∫⁻ x, F (x, t) ∂μ ∂(μI : Measure ℝ) := +- MeasureTheory.lintegral_prod_symm (μ := μ) (ν := (μI : Measure ℝ)) F hmeas +- calc +- (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) +- = ∫⁻ z, F z ∂μ.prod (μI : Measure ℝ) := by +- simpa [F] using hprod.symm +- _ = ∫⁻ t, ∫⁻ x, F (x, t) ∂μ ∂(μI : Measure ℝ) := hprod_symm +- _ = ∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ) := by +- simp [F] +- -- Now use measure-preserving translation in `x` and evaluate the `t`-integral. +- have hShift : +- (∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ)) = +- ∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ) := by +- refine MeasureTheory.lintegral_congr fun t => ?_ +- -- Change of variables `x ↦ x + t•a`. +- have hmeas' : Measurable fun x : E => ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) := by +- have hgrad : Continuous (grad (E := E) f.1) := continuous_grad (E := E) (f := f.1) f.2.1 +- have hbase : Measurable fun x : E => ‖grad (E := E) f.1 x‖ₑ := hgrad.measurable.enorm +- have hpow : Measurable fun r : ℝ≥0∞ => r ^ (2 : ℝ) := +- (ENNReal.continuous_rpow_const (y := (2 : ℝ))).measurable +- exact hpow.comp hbase +- simpa [Function.comp, add_assoc] using +- (MeasureTheory.measurePreserving_add_right μ (t • a)).lintegral_comp (μ := μ) (ν := μ) +- (f := fun x : E => ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ)) hmeas' +- have hEval : +- (∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ)) = +- (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by +- -- `μI` has total mass `1`. +- simp [μI, Measure.restrict_apply, Real.volume_Icc] +- -- Put everything together. +- have hInt : +- (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ≤ +- ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by +- calc +- (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) +- ≤ ∫⁻ x, ‖a‖ₑ ^ (2 : ℝ) * +- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ := by +- refine MeasureTheory.lintegral_mono ?_ +- intro x +- exact hpt x +- _ = ‖a‖ₑ ^ (2 : ℝ) * +- (∫⁻ x, ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ) ∂μ) := by +- -- Pull out the constant using `lintegral_const_mul''`. +- have hInner : +- AEMeasurable +- (fun x : E => +- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ)) μ := by +- -- Measurability of the inner integral follows +- -- from `hmeas` via +- -- `AEMeasurable.lintegral_prod_right'`. +- simpa [F] using (hmeas.lintegral_prod_right' (μ := μ) (ν := (μI : Measure ℝ))) +- simpa [mul_assoc] using +- (MeasureTheory.lintegral_const_mul'' (μ := μ) (r := ‖a‖ₑ ^ (2 : ℝ)) +- (f := fun x : E => +- ∫⁻ t, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂(μI : Measure ℝ)) hInner) +- _ = ‖a‖ₑ ^ (2 : ℝ) * +- (∫⁻ t, ∫⁻ x, ‖grad (E := E) f.1 (x + t • a)‖ₑ ^ (2 : ℝ) ∂μ ∂(μI : Measure ℝ)) := by +- exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hTonelli +- _ = ‖a‖ₑ ^ (2 : ℝ) * +- (∫⁻ t, (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ∂(μI : Measure ℝ)) := by +- exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hShift +- _ = ‖a‖ₑ ^ (2 : ℝ) * (∫⁻ x, ‖grad (E := E) f.1 x‖ₑ ^ (2 : ℝ) ∂μ) := by +- exact congrArg (fun z => ‖a‖ₑ ^ (2 : ℝ) * z) hEval +- exact hInt ++ have hsq := lintegral_enorm_sub_sq_le (μ := μ) a f + -- Take the `1/2` power on both sides and simplify. + have hsq' : + (∫⁻ x, ‖f.1 (x + a) - f.1 x‖ₑ ^ (2 : ℝ) ∂μ) ^ (1 / (2 : ℝ)) ≤ +@@ -333,12 +349,12 @@ lemma norm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : + have h := enorm_translateL2_sub_toL2_le (μ := μ) (E := E) a f + have hA_ne_top : + (‖translateL2 (μ := μ) (F := ℝ) a (toL2 (μ := μ) (E := E) f) - +- toL2 (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ ∞ := by ++ toL2 (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ (⊤ : ℝ≥0∞) := by + simp [enorm] + have hGrad_ne_top : +- (‖toL2Grad (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ ∞ := by ++ (‖toL2Grad (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ (⊤ : ℝ≥0∞) := by + simp [enorm] +- have hB_ne_top : (‖a‖ₑ * ‖toL2Grad (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ ∞ := by ++ have hB_ne_top : (‖a‖ₑ * ‖toL2Grad (μ := μ) (E := E) f‖ₑ : ℝ≥0∞) ≠ (⊤ : ℝ≥0∞) := by + refine ENNReal.mul_ne_top ?_ hGrad_ne_top + simp [enorm] + have h' : +@@ -346,7 +362,7 @@ lemma norm_translateL2_sub_toL2_le (a : E) (f : ↥(C1c (E := E))) : + toL2 (μ := μ) (E := E) f‖ₑ).toReal ≤ + (‖a‖ₑ * ‖toL2Grad (μ := μ) (E := E) f‖ₑ).toReal := by + exact (ENNReal.toReal_le_toReal hA_ne_top hB_ne_top).2 h +- simpa [ENNReal.toReal_mul, toReal_enorm'] using h' ++ simpa only [ENNReal.toReal_mul, toReal_enorm] using h' + + end + +diff --git a/RellichKondrachov/MeasureTheory/Function/LpSpace/Restrict.lean b/RellichKondrachov/MeasureTheory/Function/LpSpace/Restrict.lean +index bb9c6e5..5d1561e 100644 +--- a/RellichKondrachov/MeasureTheory/Function/LpSpace/Restrict.lean ++++ b/RellichKondrachov/MeasureTheory/Function/LpSpace/Restrict.lean +@@ -1,16 +1,16 @@ +-import Mathlib.MeasureTheory.Function.LpSeminorm.Basic +-import Mathlib.MeasureTheory.Function.LpSpace.Basic +- + /- + Copyright (c) 2026 Adam Benenson. All rights reserved. + Released under Apache 2.0 license as described in the file LICENSE. + Authors: Adam Benenson + -/ + ++import Mathlib.MeasureTheory.Function.LpSeminorm.Basic ++import Mathlib.MeasureTheory.Function.LpSpace.Basic ++ + /-! + # `RellichKondrachov.MeasureTheory.Function.LpSpace.Restrict` + +-`L^p` extension-by-zero maps for restricted measures. ++`«L»^p` extension-by-zero maps for restricted measures. + + Mathlib provides the equivalence + +@@ -42,7 +42,8 @@ variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + variable {p : ℝ≥0∞} [Fact (1 ≤ p)] + variable {s : Set α} (hs : MeasurableSet s) + +-private noncomputable def extendByZeroFun (f : Lp E p (μ.restrict s)) : Lp E p μ := ++/-- Extend an Lp function from a restricted measure by zero outside the set. -/ ++noncomputable def extendByZeroFun (f : Lp E p (μ.restrict s)) : Lp E p μ := + let hf : MemLp (fun x : α => f x) p (μ.restrict s) := Lp.memLp f + let hfi : MemLp (s.indicator fun x : α => f x) p μ := + (memLp_indicator_iff_restrict (μ := μ) (p := p) (s := s) (f := fun x : α => f x) hs).2 hf +@@ -63,7 +64,7 @@ noncomputable def extendByZeroₗ : Lp E p (μ.restrict s) →ₗ[ℝ] Lp E p μ + refine Lp.ext ?_ + have h_add_restrict : + (fun x : α => (f + g) x) =ᵐ[μ.restrict s] fun x : α => f x + g x := by +- simpa using (Lp.coeFn_add (μ := μ.restrict s) f g) ++ exact (Lp.coeFn_add (μ := μ.restrict s) f g) + have h_add_on : + ∀ᵐ x : α ∂μ, x ∈ s → (f + g) x = f x + g x := + (ae_restrict_iff' (μ := μ) (s := s) hs).1 h_add_restrict +@@ -95,8 +96,7 @@ noncomputable def extendByZeroₗ : Lp E p (μ.restrict s) →ₗ[ℝ] Lp E p μ + simp [hf, hg] + _ = (extendByZeroFun (μ := μ) (p := p) (s := s) hs f + + extendByZeroFun (μ := μ) (p := p) (s := s) hs g) x := hadd' +- · +- have hadd' : ++ · have hadd' : + extendByZeroFun (μ := μ) (p := p) (s := s) hs f x + + extendByZeroFun (μ := μ) (p := p) (s := s) hs g x = + (extendByZeroFun (μ := μ) (p := p) (s := s) hs f + +@@ -117,7 +117,7 @@ noncomputable def extendByZeroₗ : Lp E p (μ.restrict s) →ₗ[ℝ] Lp E p μ + refine Lp.ext ?_ + have h_smul_restrict : + (fun x : α => (c • f) x) =ᵐ[μ.restrict s] fun x : α => c • f x := by +- simpa using (Lp.coeFn_smul (μ := μ.restrict s) c f) ++ exact (Lp.coeFn_smul (μ := μ.restrict s) c f) + have h_smul_on : + ∀ᵐ x : α ∂μ, x ∈ s → (c • f) x = c • f x := + (ae_restrict_iff' (μ := μ) (s := s) hs).1 h_smul_restrict +@@ -141,8 +141,7 @@ noncomputable def extendByZeroₗ : Lp E p (μ.restrict s) →ₗ[ℝ] Lp E p μ + _ = c • s.indicator (fun x : α => f x) x := by simp [Set.indicator_of_mem, hx] + _ = c • extendByZeroFun (μ := μ) (p := p) (s := s) hs f x := by simp [hf] + _ = (c • extendByZeroFun (μ := μ) (p := p) (s := s) hs f) x := hsmul' +- · +- have hsmul' : ++ · have hsmul' : + c • extendByZeroFun (μ := μ) (p := p) (s := s) hs f x = + (c • extendByZeroFun (μ := μ) (p := p) (s := s) hs f) x := by + simpa [Pi.smul_apply] using hsmul.symm diff --git a/lean/patches/schoenflies-lean-lean4341.patch b/lean/patches/schoenflies-lean-lean4341.patch index 96ec392010a1f4afca531fdf7afcd8a8d0d7e980..eb0f300c7f84c4f99fcc02d5835cb46b6ef296ba 100644 --- a/lean/patches/schoenflies-lean-lean4341.patch +++ b/lean/patches/schoenflies-lean-lean4341.patch @@ -1,2575 +1,2575 @@ -diff --git a/Schoenflies/Accessible.lean b/Schoenflies/Accessible.lean ---- a/Schoenflies/Accessible.lean -+++ b/Schoenflies/Accessible.lean -@@ -113,7 +113,7 @@ - have h1 : Continuous fun x : Plane => ‖x - p‖ := (continuous_id.sub continuous_const).norm - have h2 : Continuous fun x : Plane => inner ℝ v (x - p) := - continuous_const.inner (continuous_id.sub continuous_const) -- rw [accessCone, setOf_and] -+ rw [accessCone, ofPred_and] - exact (isOpen_lt h1 continuous_const).inter (isOpen_lt (h1.div_const 2) h2) - - /-- Membership in the cone in the form used by the blueprint: a unit direction `w` making an -diff --git a/Schoenflies/ArcCollars.lean b/Schoenflies/ArcCollars.lean ---- a/Schoenflies/ArcCollars.lean -+++ b/Schoenflies/ArcCollars.lean -@@ -1261,7 +1261,7 @@ - (min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖))) • (z - A.vertex (i + 1)) - - A.vertex (i + 1) = - (min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖))) • (z - A.vertex (i + 1)) := by module) -- · rw [Set.mem_setOf_eq, hsub] -+ · rw [Set.mem_ofPred_eq, hsub] - exact (smul_mem_arcCCW hδpos).2 harc - · rw [mem_ball, dist_eq_norm, hsub, norm_smul, Real.norm_eq_abs, abs_of_pos hδpos] - have h1 : min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖)) ≤ 1 := min_le_left _ _ -@@ -1286,7 +1286,7 @@ - (min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖))) • (z - A.vertex (i + 1)) - - A.vertex (i + 1) = - (min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖))) • (z - A.vertex (i + 1)) := by module) -- · rw [Set.mem_setOf_eq, hsub] -+ · rw [Set.mem_ofPred_eq, hsub] - exact (smul_mem_arcCCW hδpos).2 harc - · rw [mem_ball, dist_eq_norm, hsub, norm_smul, Real.norm_eq_abs, abs_of_pos hδpos] - have h1 : min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖)) ≤ 1 := min_le_left _ _ -diff --git a/Schoenflies/ArcComplement.lean b/Schoenflies/ArcComplement.lean ---- a/Schoenflies/ArcComplement.lean -+++ b/Schoenflies/ArcComplement.lean -@@ -154,7 +154,7 @@ - Graph.pointSet (segGraph S) segmentDrawing = ⋃ P ∈ S, P.seg := by - ext z - simp only [Graph.pointSet, mem_union, mem_iUnion, exists_prop, segGraph_vertexSet, -- mem_setOf_eq, segGraph_edgeSet, edgeArc_segmentDrawing] -+ mem_ofPred_eq, segGraph_edgeSet, edgeArc_segmentDrawing] - constructor - · rintro (⟨P, hP, hzP⟩ | ⟨P, hP, hzP⟩) - · refine ⟨P, hP, ?_⟩ -@@ -453,7 +453,7 @@ - intro z hz hz' - obtain ⟨j, hj, hj', hzj⟩ := exists_mem_frontier_of_mem_pointSet_familyChain hz - obtain ⟨k, hk, hk', hzk⟩ := exists_mem_frontier_of_mem_pointSet_familyChain hz' -- rw [Plane.frontier_closedSquare, mem_setOf_eq] at hzj hzk -+ rw [Plane.frontier_closedSquare, mem_ofPred_eq] at hzj hzk - have htri := Plane.supDist_triangle (c j) z (c k) - rw [Plane.supDist_comm (c j) z] at htri - exact absurd (hfar p q hp hq hpq j hj hj' k hk hk') (by rw [hzj, hzk] at htri; linarith) -@@ -525,7 +525,7 @@ - z ∈ Plane.closedSquare (c (p * m)) R := by - intro i hi hi' hzi - obtain ⟨j, hj, hj', hzj⟩ := exists_mem_frontier_of_mem_pointSet_familyChain hzi -- rw [Plane.frontier_closedSquare, mem_setOf_eq] at hzj -+ rw [Plane.frontier_closedSquare, mem_ofPred_eq] at hzj - have hjlo : p * m ≤ j := le_trans (Nat.mul_le_mul_right _ hi) hj - have hjhi : j ≤ p * m + m + m := by - have : i * m ≤ (p + 1) * m := Nat.mul_le_mul_right _ hi' -@@ -714,7 +714,7 @@ - (outerOnPairs_familyChain hcontain (hxfar u hmemu)) - have houtw := outer_face_familyChain hchain - (outerOnPairs_familyChain hcontain (hxfar w hmemw)) -- haveI : (Graph.chainUnion (familyChain c ((n + 1) * m) m r) 0 n).Finite := -+ have : (Graph.chainUnion (familyChain c ((n + 1) * m) m r) 0 n).Finite := - hchain.block_finite (i := 0) (m := n) (by omega) - have hdraw : Graph.IsDrawing (Graph.chainUnion (familyChain c ((n + 1) * m) m r) 0 n) - segmentDrawing := hchain.block_isDrawing (by omega) -diff --git a/Schoenflies/ArcComplementPrep.lean b/Schoenflies/ArcComplementPrep.lean ---- a/Schoenflies/ArcComplementPrep.lean -+++ b/Schoenflies/ArcComplementPrep.lean -@@ -441,7 +441,7 @@ - theorem mem_compl_closedSquare_iff (c : Plane) (r : ℝ) (x : Plane) : - x ∈ (closedSquare c r)ᶜ ↔ x - c ∈ beyondSquare r := by - rw [beyondSquare_eq_compl] -- simp only [mem_compl_iff, closedSquare, mem_setOf_eq, supDist_zero] -+ simp only [mem_compl_iff, closedSquare, mem_ofPred_eq, supDist_zero] - exact Iff.rfl - - theorem compl_closedSquare_eq_image (c : Plane) (r : ℝ) : -@@ -465,7 +465,7 @@ - (frontier (closedSquare c r))ᶜ = openSquare c r ∪ (closedSquare c r)ᶜ := by - ext z - rw [frontier_closedSquare] -- simp only [mem_compl_iff, mem_setOf_eq, mem_union, openSquare, closedSquare, not_le] -+ simp only [mem_compl_iff, mem_ofPred_eq, mem_union, openSquare, closedSquare, not_le] - constructor - · intro h - rcases lt_or_gt_of_ne h with h' | h' -diff --git a/Schoenflies/ArcMonotone.lean b/Schoenflies/ArcMonotone.lean ---- a/Schoenflies/ArcMonotone.lean -+++ b/Schoenflies/ArcMonotone.lean -@@ -86,7 +86,7 @@ - have h : ∃ s, s ∈ I ∧ f s = p := by - obtain ⟨s, hs, rfl⟩ := hp - exact ⟨s, hs, rfl⟩ -- rw [arcParam, dif_pos h] -+ rw [arcParam, dite_eq_left h] - exact h.choose_spec - - theorem arcParam_mem_I (hp : p ∈ f '' I) : arcParam f p ∈ I := (arcParam_spec hp).1 -diff --git a/Schoenflies/BoundaryAnchors.lean b/Schoenflies/BoundaryAnchors.lean ---- a/Schoenflies/BoundaryAnchors.lean -+++ b/Schoenflies/BoundaryAnchors.lean -@@ -119,7 +119,7 @@ - have harc := h.edge_isArcBetween hxy - apply Or.inr - exact Set.mem_iUnion₂.2 ⟨e, by -- rw [Graph.edgeSet_eq_setOf_exists_isLink] -+ rw [Graph.edgeSet_eq_setOfPred_exists_isLink] - exact ⟨x, y, (Graph.traceGraph_isLink D).2 - ⟨heD, hxy, heD harc.left_mem, heD harc.right_mem⟩⟩, hze⟩ - -@@ -246,7 +246,7 @@ - h.vertex_mem hlb.right_mem (hcase hlb hbnb hbC) - let K := Graph.traceGraph G drawing (inside C) - have hKle : K ≤ G := Graph.traceGraph_le _ -- letI : K.Finite := Graph.Finite.of_le hKle -+ let : K.Finite := Graph.Finite.of_le hKle - have hKpoint : Graph.pointSet K drawing = - Graph.interiorPart G drawing (inside C) := - Graph.pointSet_traceGraph_eq_interiorPart h.isDrawing (inside C) -@@ -793,7 +793,7 @@ - have hrTargetAdmissible : - r.pair.tgt.IsAdmissible modelCurve (Plane.closedSquare 0 1) := - r.pair.tgt_isAdmissible hrAdmissible.isConnected_nonboundary -- letI : r.pair.src.graph.Finite := CellStructure.Realization.finite_graph r.pair.src -+ let : r.pair.src.graph.Finite := CellStructure.Realization.finite_graph r.pair.src - have hsourceStage := hrAdmissible.isStageOn - have htargetStage : Graph.IsStageOn r.pair.tgt.graph r.pair.tgt.drawing - modelCurve (inside modelCurve) := by -diff --git a/Schoenflies/BoundaryContinuity2.lean b/Schoenflies/BoundaryContinuity2.lean ---- a/Schoenflies/BoundaryContinuity2.lean -+++ b/Schoenflies/BoundaryContinuity2.lean -@@ -494,7 +494,7 @@ - hsnot (mem_of_superset h (preimage_mono hWs)) - -- the filter of approach that stays away from `W` - set l' : Filter Plane := 𝓝[inside C] p ⊓ 𝓟 (F ⁻¹' Wᶜ) with hl' -- haveI : l'.NeBot := by -+ have : l'.NeBot := by - refine ⟨fun h => hWnot ?_⟩ - rw [hl', Filter.inf_principal_eq_bot] at h - simpa using h -@@ -521,7 +521,7 @@ - rw [le_principal_iff, mem_map] - filter_upwards [hl'in] with z hz using hF.mapsTo hz - set m : Filter Plane := 𝓝 q ⊓ map F l' with hm -- haveI : m.NeBot := hqcl -+ have : m.NeBot := hqcl - have hm1 : m ≤ 𝓝[Plane.openSquare 0 1] q := - le_inf inf_le_left (le_trans inf_le_right hmapO) - have h1 : Tendsto F' m (𝓝 (F' q)) := (hF.continuousOn_inv q hqopen).mono_left hm1 -diff --git a/Schoenflies/BoundaryCycles.lean b/Schoenflies/BoundaryCycles.lean ---- a/Schoenflies/BoundaryCycles.lean -+++ b/Schoenflies/BoundaryCycles.lean -@@ -148,7 +148,7 @@ - rw [CellStructure.pathCells, CellStructure.pathCells, - h₁.walkVertices_eq_covered hne₁, h₂.walkVertices_eq_covered hne₂] - ext σ -- simp only [Set.mem_union, Set.mem_setOf_eq, Graph.mem_coveredVertices_iff] -+ simp only [Set.mem_union, Set.mem_ofPred_eq, Graph.mem_coveredVertices_iff] - constructor - · rintro (hσ | ⟨e, he, hi⟩) - · exact Or.inl (hp.mem_iff.1 hσ) -diff --git a/Schoenflies/Bounded.lean b/Schoenflies/Bounded.lean ---- a/Schoenflies/Bounded.lean -+++ b/Schoenflies/Bounded.lean -@@ -38,7 +38,7 @@ - /-- The outside of a square is exactly the complement of the closed square. -/ - theorem beyondSquare_eq_compl (r : ℝ) : beyondSquare r = (closedSquare 0 r)ᶜ := by - ext x -- simp only [beyondSquare, closedSquare, mem_setOf_eq, mem_compl_iff, supDist_zero, supNorm, -+ simp only [beyondSquare, closedSquare, mem_ofPred_eq, mem_compl_iff, supDist_zero, supNorm, - max_le_iff, not_and_or, not_le] - - /-- A bounded set sits inside a closed square about the origin, of nonnegative radius. -/ -diff --git a/Schoenflies/CommonSubdivision.lean b/Schoenflies/CommonSubdivision.lean ---- a/Schoenflies/CommonSubdivision.lean -+++ b/Schoenflies/CommonSubdivision.lean -@@ -48,8 +48,8 @@ - let B : Graph Plane β := G.induce (V(G) \ G.component x) - have hAle : A ≤ G := G.induce_le component_subset_vertexSet - have hBle : B ≤ G := G.induce_le Set.sdiff_subset -- letI : A.Finite := Graph.Finite.of_le hAle -- letI : B.Finite := Graph.Finite.of_le hBle -+ let : A.Finite := Graph.Finite.of_le hAle -+ let : B.Finite := Graph.Finite.of_le hBle - have hAclosed : IsClosed (pointSet A drawing) := (hdraw.mono hAle).isClosed_pointSet - have hBclosed : IsClosed (pointSet B drawing) := (hdraw.mono hBle).isClosed_pointSet - have hcover : pointSet G drawing ⊆ pointSet A drawing ∪ pointSet B drawing := by -@@ -64,14 +64,14 @@ - · have hvC : v ∈ G.component x := mem_component_of_isLink huC huv - exact Or.inl (Or.inr (Set.mem_iUnion₂_of_mem - (show e ∈ E(A) by -- rw [edgeSet_eq_setOf_exists_isLink] -+ rw [edgeSet_eq_setOfPred_exists_isLink] - exact ⟨u, v, huv, huC, hvC⟩) hze)) - · have hvC : v ∉ G.component x := by - intro hvC - exact huC (mem_component_of_isLink hvC huv.symm) - exact Or.inr (Or.inr (Set.mem_iUnion₂_of_mem - (show e ∈ E(B) by -- rw [edgeSet_eq_setOf_exists_isLink] -+ rw [edgeSet_eq_setOfPred_exists_isLink] - exact ⟨u, v, huv, ⟨huv.left_mem, huC⟩, ⟨huv.right_mem, hvC⟩⟩) hze)) - have hAB : Disjoint (pointSet A drawing) (pointSet B drawing) := by - rw [Set.disjoint_left] -@@ -79,13 +79,13 @@ - rcases hzA with hzAV | hzAE <;> rcases hzB with hzBV | hzBE - · exact hzBV.2 hzAV - · obtain ⟨e, heB, hze⟩ := Set.mem_iUnion₂.1 hzBE -- rw [edgeSet_eq_setOf_exists_isLink] at heB -+ rw [edgeSet_eq_setOfPred_exists_isLink] at heB - obtain ⟨u, v, huv, huB, hvB⟩ := heB - have hzinc := hdraw.vertex_mem_edgeArc huv (component_subset_vertexSet hzAV) hze - rcases hzinc with rfl | rfl - exacts [huB.2 hzAV, hvB.2 hzAV] - · obtain ⟨e, heA, hze⟩ := Set.mem_iUnion₂.1 hzAE -- rw [edgeSet_eq_setOf_exists_isLink] at heA -+ rw [edgeSet_eq_setOfPred_exists_isLink] at heA - obtain ⟨u, v, huv, huA, hvA⟩ := heA - have hzinc := hdraw.vertex_mem_edgeArc huv hzBV.1 hze - rcases hzinc with rfl | rfl -@@ -97,7 +97,7 @@ - have hef : e ≠ f := by - intro hef - subst f -- rw [edgeSet_eq_setOf_exists_isLink] at heA hfB -+ rw [edgeSet_eq_setOfPred_exists_isLink] at heA hfB - obtain ⟨u, v, huv, huA, -⟩ := heA - obtain ⟨u', v', huv', huB, hvB⟩ := hfB - rcases huv.left_eq_or_eq huv' with h | h -@@ -105,7 +105,7 @@ - · exact hvB.2 (h ▸ huA) - obtain ⟨hzV, ⟨u, heu⟩, ⟨v, hfv⟩⟩ := - hdraw.edge_inter heG hfG hef hzeA hzfB -- rw [edgeSet_eq_setOf_exists_isLink] at heA hfB -+ rw [edgeSet_eq_setOfPred_exists_isLink] at heA hfB - obtain ⟨a, b, hab, haA, hbA⟩ := heA - obtain ⟨c, d, hcd, hcB, hdB⟩ := hfB - rcases heu.left_eq_or_eq hab with rfl | rfl <;> -@@ -135,7 +135,7 @@ - @[simp] theorem traceGraph_isLink (A : Set Plane) : - (traceGraph G drawing A).IsLink e x y ↔ - edgeArc drawing e ⊆ A ∧ G.IsLink e x y ∧ x ∈ A ∧ y ∈ A := by -- simp only [traceGraph, induce_isLink, restrict_isLink, Set.mem_setOf_eq, -+ simp only [traceGraph, induce_isLink, restrict_isLink, Set.mem_ofPred_eq, - Set.mem_inter_iff] - constructor - · rintro ⟨⟨hsub, hlink⟩, ⟨-, hxA⟩, ⟨-, hyA⟩⟩ -@@ -164,7 +164,7 @@ - rintro z (hz | hz) - · exact hz.2 - · obtain ⟨e, he, hze⟩ := Set.mem_iUnion₂.1 hz -- rw [edgeSet_eq_setOf_exists_isLink] at he -+ rw [edgeSet_eq_setOfPred_exists_isLink] at he - obtain ⟨x, y, hxy⟩ := he - exact (traceGraph_isLink A).1 hxy |>.1 hze - -@@ -185,7 +185,7 @@ - habsorb he ⟨z, ⟨hze, hzA, hzVG⟩⟩ - exact Or.inr (Set.mem_iUnion₂_of_mem - (show e ∈ E(traceGraph G drawing A) by -- rw [edgeSet_eq_setOf_exists_isLink] -+ rw [edgeSet_eq_setOfPred_exists_isLink] - obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet he - have harc := hdraw.edge_isArcBetween hxy - exact ⟨x, y, (traceGraph_isLink A).2 -@@ -302,8 +302,8 @@ - Graph.edgesCover Hdraw D = edgeArc R.drawing e := by - let K := Graph.traceGraph H Hdraw (edgeArc R.drawing e) - have hKle : K ≤ H := Graph.traceGraph_le _ -- letI : H.Finite := hH.finite -- letI : K.Finite := Graph.Finite.of_le hKle -+ let : H.Finite := hH.finite -+ let : K.Finite := Graph.Finite.of_le hKle - have hpoint : pointSet K Hdraw = edgeArc R.drawing e := - edge_trace_pointSet hH hab.edge_mem - have haH : R.pos a ∈ V(H) := hH.vertexSet_subset (by -@@ -683,8 +683,8 @@ - ∃ D : List δ, K.IsPath a D b ∧ edgesCover Kdraw D = edgeArc Gdraw e := by - let T := Graph.traceGraph K Kdraw (edgeArc Gdraw e) - have hTK : T ≤ K := Graph.traceGraph_le _ -- letI : K.Finite := h.finite -- letI : T.Finite := Graph.Finite.of_le hTK -+ let : K.Finite := h.finite -+ let : T.Finite := Graph.Finite.of_le hTK - have hpoint : pointSet T Kdraw = edgeArc Gdraw e := h.edge_trace_pointSet hab.edge_mem - have haK : a ∈ V(K) := h.vertexSet_subset hab.left_mem - have hbK : b ∈ V(K) := h.vertexSet_subset hab.right_mem -@@ -1083,7 +1083,7 @@ - have hvertex : d.realizePos R t '' V(d.outer) = - insert (R.drawing d.edge t) (R.pos '' V(S.outerGraph)) := by - rw [CellStructure.SubdivData.outer, subdivGraph_vertexSet] -- simp only [d.outer_isLink he, and_true, Set.setOf_eq_eq_singleton, -+ simp only [d.outer_isLink he, and_true, Set.ofPred_eq_eq_singleton, - Set.image_union, Set.image_singleton, d.realizePos_newVertex] - rw [Set.union_comm] - congr 1 -@@ -1326,7 +1326,7 @@ - exact (P.src.isDrawing.edge_param heR).2.2.right_mem - have htIoo : t ∈ Set.Ioo (0 : ℝ) 1 := - ⟨lt_of_le_of_ne ht.1 (Ne.symm ht0), lt_of_le_of_ne ht.2 ht1⟩ -- letI : Finite (Fin 3) := inferInstance -+ let : Finite (Fin 3) := inferInstance - obtain ⟨fresh, hfresh, havoid⟩ := - exists_injective_avoiding P.str.cells P.str.finite_cells (Fin 3) - have h01 : fresh 0 ≠ fresh 1 := fun h => by -diff --git a/Schoenflies/Concatenate.lean b/Schoenflies/Concatenate.lean ---- a/Schoenflies/Concatenate.lean -+++ b/Schoenflies/Concatenate.lean -@@ -84,11 +84,11 @@ - variable {f g : ℝ → Plane} - - theorem concatenate_of_le {t : ℝ} (ht : t ≤ 1 / 2) : concatenate f g t = f (2 * t) := -- if_pos ht -+ ite_eq_left ht - - theorem concatenate_of_not_le {t : ℝ} (ht : ¬t ≤ 1 / 2) : - concatenate f g t = g (2 * t - 1) := -- if_neg ht -+ ite_eq_right ht - - theorem concatenate_zero : concatenate f g 0 = f 0 := by - rw [concatenate_of_le (by norm_num)] -diff --git a/Schoenflies/Direction.lean b/Schoenflies/Direction.lean ---- a/Schoenflies/Direction.lean -+++ b/Schoenflies/Direction.lean -@@ -177,7 +177,7 @@ - have key : ∀ x : ℝ, 0 < r * x ↔ 0 < x := by - intro x - constructor <;> intro hx <;> nlinarith -- simp only [arcCCW, mem_setOf_eq, det_smul_left, det_smul_right, key] -+ simp only [arcCCW, mem_ofPred_eq, det_smul_left, det_smul_right, key] - - theorem dir_mem_arcCCW_iff (hd : d ≠ 0) : dir d ∈ arcCCW u w ↔ d ∈ arcCCW u w := by - obtain ⟨c, hc, hcd⟩ := dir_eq_smul hd -@@ -432,7 +432,7 @@ - by_cases h : 0 < det w u - · have : arcCCW u w = {d : Plane | 0 < det u d} ∪ {d : Plane | 0 < det d w} := by - ext d -- simp only [arcCCW, mem_setOf_eq, mem_union] -+ simp only [arcCCW, mem_ofPred_eq, mem_union] - constructor - · rintro (⟨h1, _⟩ | ⟨h2, _⟩ | ⟨_, h1⟩) <;> tauto - · rintro (hx | hx) -@@ -442,7 +442,7 @@ - exact h1.union h2 - · have : arcCCW u w = {d : Plane | 0 < det u d} ∩ {d : Plane | 0 < det d w} := by - ext d -- simp only [arcCCW, mem_setOf_eq, mem_inter_iff] -+ simp only [arcCCW, mem_ofPred_eq, mem_inter_iff] - constructor - · rintro (hx | ⟨_, hx⟩ | ⟨hx, _⟩) <;> [exact hx; exact absurd hx h; exact absurd hx h] - · exact Or.inl -diff --git a/Schoenflies/Endgame.lean b/Schoenflies/Endgame.lean ---- a/Schoenflies/Endgame.lean -+++ b/Schoenflies/Endgame.lean -@@ -112,28 +112,28 @@ - classical - refine ⟨fun z => if hz : z ∈ S then (e ⟨z, hz⟩ : Plane) else z, - fun w => if hw : w ∈ T then (e.symm ⟨w, hw⟩ : Plane) else w, -- ⟨?_, ?_, ?_, ?_, ?_, ?_⟩, fun z hz => dif_pos hz⟩ -- · exact fun z hz => by simp only [dif_pos hz]; exact (e ⟨z, hz⟩).2 -- · exact fun w hw => by simp only [dif_pos hw]; exact (e.symm ⟨w, hw⟩).2 -- · rw [continuousOn_iff_continuous_restrict] -- have heq : (S.restrict fun z => if hz : z ∈ S then (e ⟨z, hz⟩ : Plane) else z) = -+ ⟨?_, ?_, ?_, ?_, ?_, ?_⟩, fun z hz => dite_eq_left hz⟩ -+ · exact fun z hz => by simp only [dite_eq_left hz]; exact (e ⟨z, hz⟩).2 -+ · exact fun w hw => by simp only [dite_eq_left hw]; exact (e.symm ⟨w, hw⟩).2 -+ · rw [continuousOn_iff_continuous_domRestrict] -+ have heq : (S.domRestrict fun z => if hz : z ∈ S then (e ⟨z, hz⟩ : Plane) else z) = - fun z : ↥S => (e z : Plane) := by - funext z -- simp only [Set.restrict_apply, dif_pos z.2] -+ simp only [Set.domRestrict_apply, dite_eq_left z.2] - rw [heq] - exact continuous_subtype_val.comp e.continuous -- · rw [continuousOn_iff_continuous_restrict] -- have heq : (T.restrict fun w => if hw : w ∈ T then (e.symm ⟨w, hw⟩ : Plane) else w) = -+ · rw [continuousOn_iff_continuous_domRestrict] -+ have heq : (T.domRestrict fun w => if hw : w ∈ T then (e.symm ⟨w, hw⟩ : Plane) else w) = - fun w : ↥T => (e.symm w : Plane) := by - funext w -- simp only [Set.restrict_apply, dif_pos w.2] -+ simp only [Set.domRestrict_apply, dite_eq_left w.2] - rw [heq] - exact continuous_subtype_val.comp e.symm.continuous - · intro z hz -- simp only [dif_pos hz, dif_pos (e ⟨z, hz⟩).2] -+ simp only [dite_eq_left hz, dite_eq_left (e ⟨z, hz⟩).2] - exact congrArg Subtype.val (e.symm_apply_apply ⟨z, hz⟩) - · intro w hw -- simp only [dif_pos hw, dif_pos (e.symm ⟨w, hw⟩).2] -+ simp only [dite_eq_left hw, dite_eq_left (e.symm ⟨w, hw⟩).2] - exact congrArg Subtype.val (e.apply_symm_apply ⟨w, hw⟩) - - namespace IsHomeoOn -@@ -196,11 +196,11 @@ - - theorem paste_of_mem {S : Set Plane} {f₁ f₂ : Plane → Plane} {z : Plane} (hz : z ∈ S) : - paste S f₁ f₂ z = f₁ z := by -- classical exact if_pos hz -+ classical exact ite_eq_left hz - - theorem paste_of_notMem {S : Set Plane} {f₁ f₂ : Plane → Plane} {z : Plane} (hz : z ∉ S) : - paste S f₁ f₂ z = f₂ z := by -- classical exact if_neg hz -+ classical exact ite_eq_right hz - - /-! ### The square `Q` and its boundary `S` - -diff --git a/Schoenflies/FaceCyclesProof.lean b/Schoenflies/FaceCyclesProof.lean ---- a/Schoenflies/FaceCyclesProof.lean -+++ b/Schoenflies/FaceCyclesProof.lean -@@ -840,7 +840,7 @@ - (hint : ∀ y ∈ G.walkVertices a D', y ≠ a → y ≠ b → y ∉ V(B)) - (hnew : ∀ g ∈ D', g ∉ E(B)) : - HasFaceCycles (B.union (G.pathGraphOf a D')) drawing := by -- haveI : B.Finite := Finite.of_le hBG -+ have : B.Finite := Finite.of_le hBG - have hB : IsDrawing B drawing := h.mono hBG - have hne : D' ≠ [] := hpath.ne_nil hab - have hPG : G.pathGraphOf a D' ≤ G := pathGraphOf_le hpath.isWalk -diff --git a/Schoenflies/FiniteTransfer.lean b/Schoenflies/FiniteTransfer.lean ---- a/Schoenflies/FiniteTransfer.lean -+++ b/Schoenflies/FiniteTransfer.lean -@@ -735,7 +735,7 @@ - (ι : Type*) [Finite ι] : - ∃ fresh : ι → γ, Function.Injective fresh ∧ ∀ i, fresh i ∉ used := by - classical -- letI : Fintype ι := Fintype.ofFinite ι -+ let : Fintype ι := Fintype.ofFinite ι - let code : ι ↪ ℕ := (Fintype.equivFin ι).toEmbedding.trans Fin.valEmbedding - let supply : ℕ ↪ {x // x ∈ (usedᶜ : Set γ)} := - hused.infinite_compl.natEmbedding (usedᶜ : Set γ) -@@ -753,7 +753,7 @@ - ∀ x ∈ s, x ≠ a → x ≠ b → name x ∉ used := by - classical - let inner := {x : α // x ∈ s ∧ x ≠ a ∧ x ≠ b} -- letI : Finite inner := Set.finite_coe_iff.mpr (hs.subset fun x hx => hx.1) -+ let : Finite inner := Set.finite_coe_iff.mpr (hs.subset fun x hx => hx.1) - obtain ⟨fresh, hfresh, havoid⟩ := exists_injective_avoiding used hused inner - let name : α → γ := fun x => - if hxa : x = a then u else if hxb : x = b then v -@@ -1148,7 +1148,7 @@ - exact vname_fresh x hxQ (fun h => hxab (Or.inl h)) (fun h => hxab (Or.inr h)) hzCell - let edgeUsed : Set γ := T.str.cells ∪ newVertices - have hedgeUsed_fin : edgeUsed.Finite := T.str.finite_cells.union hnewVertices_fin -- letI : Finite E(Q) := Set.finite_coe_iff.mpr hQfinE -+ let : Finite E(Q) := Set.finite_coe_iff.mpr hQfinE - obtain ⟨freshEdge, freshEdge_inj, freshEdge_avoid⟩ := - exists_injective_avoiding edgeUsed hedgeUsed_fin E(Q) - let ename : γ → γ := fun e => if he : e ∈ E(Q) then freshEdge ⟨e, he⟩ else u -@@ -1383,7 +1383,7 @@ - (hsub : CommonSubdivision P H Hdraw) (hstep : EarStep P H Hdraw) : - ∃ (T : GeneratedPair S₀ srcOuter srcDom tgtOuter tgtDom) (par : γ → γ), - IsPartialTransferOf T P H Hdraw par := by -- haveI := hH.finite -+ have := hH.finite - obtain ⟨K, T₀, par₀, hK, hKH, hbase⟩ := hsub - refine hH.isTwoConnected.ear_decomposition - (motive := fun B => ∃ T par, IsPartialTransferOf T P B Hdraw par) -@@ -1549,7 +1549,7 @@ - exact fun hmem => Set.disjoint_left.1 - (P.tgt.disjoint_cell_skeletonSet P.tgt_isCellDecomposition hF) hmem - (P.tgt.pos_mem_skeletonSet hv) -- letI : (P.str.skel.map P.tgt.pos).Finite := { -+ let : (P.str.skel.map P.tgt.pos).Finite := { - finite_vertexSet := by - rw [Graph.vertexSet_map] - exact P.str.finite_vertexSet.image _ -diff --git a/Schoenflies/FiniteTransferTarget.lean b/Schoenflies/FiniteTransferTarget.lean ---- a/Schoenflies/FiniteTransferTarget.lean -+++ b/Schoenflies/FiniteTransferTarget.lean -@@ -561,7 +561,7 @@ - exact vname_fresh x hxQ (fun h => hxab (Or.inl h)) (fun h => hxab (Or.inr h)) hzCell - let edgeUsed : Set γ := T.str.cells ∪ newVertices - have hedgeUsed_fin : edgeUsed.Finite := T.str.finite_cells.union hnewVertices_fin -- letI : Finite E(Q) := Set.finite_coe_iff.mpr hQfinE -+ let : Finite E(Q) := Set.finite_coe_iff.mpr hQfinE - obtain ⟨freshEdge, freshEdge_inj, freshEdge_avoid⟩ := - exists_injective_avoiding edgeUsed hedgeUsed_fin E(Q) - let ename : γ → γ := fun e => if he : e ∈ E(Q) then freshEdge ⟨e, he⟩ else u -@@ -1128,8 +1128,8 @@ - T.str.OuterOnlyAt w.splitData.source) ∧ - (T.src.pos w.splitData.target ∈ srcOuter → - T.str.OuterOnlyAt w.splitData.target) := by -- letI : H.Finite := hH.finite -- letI : B.Finite := Graph.Finite.of_le hBH -+ let : H.Finite := hH.finite -+ let : B.Finite := Graph.Finite.of_le hBH - have hBdraw := hH.isDrawing.mono hBH - have hinside : Graph.edgesCover Hdraw D \ {a, b} ⊆ - T.tgt.cell w.splitData.face := by -@@ -1431,7 +1431,7 @@ - rw [← hGunion, Graph.pointSet_union] - change pointSet G T.src.drawing ∪ T.src.outerSet = _ - rw [T.src_isWeaklyAdmissible.outerSet_eq] -- letI : G.Finite := Graph.Finite.of_le Graph.deleteEdges_le -+ let : G.Finite := Graph.Finite.of_le Graph.deleteEdges_le - have hGdraw : G.IsDrawing T.src.drawing := T.src.isDrawing.mono Graph.deleteEdges_le - have hGpoly : ∀ e ∈ E(G), IsPolygonal (edgeArc T.src.drawing e) := by - intro e he -@@ -1441,7 +1441,7 @@ - have hFcells : T.src.cell F ∈ cells := ⟨F, hF, rfl⟩ - have hdisj : Disjoint (T.src.cell F) T.src.skeletonSet := - T.src.disjoint_cell_skeletonSet T.src_isCellDecomposition hF -- letI : O.Finite := Graph.Finite.of_le hOle -+ let : O.Finite := Graph.Finite.of_le hOle - have houterCompact : IsCompact srcOuter := by - rw [← T.src_isWeaklyAdmissible.outerSet_eq] - exact T.src.isCompact_skeletonSet.of_isClosed_subset -@@ -1794,7 +1794,7 @@ - (hsub : TargetCommonSubdivision P H Hdraw) (hstep : TargetEarStep P H Hdraw) : - ∃ (T : GeneratedPair S₀ srcOuter srcDom tgtOuter tgtDom) (par : γ → γ), - IsTargetPartialTransferOf T P H Hdraw par := by -- haveI := hH.finite -+ have := hH.finite - obtain ⟨K, T₀, par₀, hK, hKH, hbase⟩ := hsub - refine hH.isTwoConnected.ear_decomposition - (motive := fun B => ∃ T par, IsTargetPartialTransferOf T P B Hdraw par) -diff --git a/Schoenflies/FiniteTransferTargetMesh.lean b/Schoenflies/FiniteTransferTargetMesh.lean ---- a/Schoenflies/FiniteTransferTargetMesh.lean -+++ b/Schoenflies/FiniteTransferTargetMesh.lean -@@ -112,12 +112,12 @@ - · intro e he g hg heg - have hnames : freshName (⟨e, he⟩ : E(H)) = freshName ⟨g, hg⟩ := by - dsimp only [name] at heg -- rw [dif_pos he, dif_pos hg] at heg -+ rw [dite_eq_left he, dite_eq_left hg] at heg - exact heg - exact congrArg Subtype.val (hfreshName hnames) - · intro e he - dsimp only [name] -- rw [dif_pos he] -+ rw [dite_eq_left he] - exact havoid (⟨e, he⟩ : E(H)) - - /-- A finite square mesh can have all of its edges injectively renamed into any infinite cell -diff --git a/Schoenflies/FreshDenseSelection.lean b/Schoenflies/FreshDenseSelection.lean ---- a/Schoenflies/FreshDenseSelection.lean -+++ b/Schoenflies/FreshDenseSelection.lean -@@ -58,8 +58,8 @@ - have hforbiddenFinite : forbidden'.Finite := by - apply hforbidden.preimage - exact Set.injOn_of_injective Subtype.val_injective -- letI : ConnectedSpace C := Subtype.connectedSpace hC.isConnected -- letI : Nontrivial C := by -+ let : ConnectedSpace C := Subtype.connectedSpace hC.isConnected -+ let : Nontrivial C := by - obtain ⟨x, hx, y, hy, hxy⟩ := hC.exists_ne - exact ⟨⟨⟨x, hx⟩, ⟨y, hy⟩, fun h => hxy (congrArg Subtype.val h)⟩⟩ - have hcleanDense : Dense (eligible' \ forbidden') := -@@ -345,7 +345,7 @@ - StronglyAccessible (srcDom \ srcOuter) (P.homeo.invFun z)) ∧ - FreshAvoidsTargetNonouterEdges P fresh ∧ FreshDense fresh delta ∧ - FreshNet fresh delta := by -- letI : Graph.Finite P.tgt.graph := -+ let : Graph.Finite P.tgt.graph := - CellStructure.Realization.finite_graph P.tgt - have haccessibleSubset : accessibleTargetBoundary P ⊆ modelCurve := - fun _ hz => hz.1 -diff --git a/Schoenflies/GeneratedStructure.lean b/Schoenflies/GeneratedStructure.lean ---- a/Schoenflies/GeneratedStructure.lean -+++ b/Schoenflies/GeneratedStructure.lean -@@ -375,14 +375,14 @@ - - @[simp] theorem skeleton_vertexSet : V(d.skeleton) = insert d.newVertex V(S.skel) := by - ext z -- simp only [skeleton, subdivGraph_vertexSet, Set.mem_union, Set.mem_setOf_eq, -+ simp only [skeleton, subdivGraph_vertexSet, Set.mem_union, Set.mem_ofPred_eq, - Set.mem_insert_iff, d.isLink, and_true] - tauto - - @[simp] theorem skeleton_edgeSet : - E(d.skeleton) = insert d.newEdge₁ (insert d.newEdge₂ (E(S.skel) \ {d.edge})) := by - ext f -- simp only [skeleton, subdivGraph_edgeSet, Set.mem_union, Set.mem_setOf_eq, -+ simp only [skeleton, subdivGraph_edgeSet, Set.mem_union, Set.mem_ofPred_eq, - Set.mem_insert_iff, d.isLink, and_true] - tauto - -@@ -405,7 +405,7 @@ - theorem outer_edgeSet_of_mem (he : d.edge ∈ E(S.outerGraph)) : - E(d.outer) = insert d.newEdge₁ (insert d.newEdge₂ (E(S.outerGraph) \ {d.edge})) := by - ext f -- simp only [outer, subdivGraph_edgeSet, Set.mem_union, Set.mem_setOf_eq, -+ simp only [outer, subdivGraph_edgeSet, Set.mem_union, Set.mem_ofPred_eq, - Set.mem_insert_iff, d.outer_isLink he, and_true] - tauto - -@@ -1035,10 +1035,10 @@ - noncomputable def parent : γ → γ := fun σ => if σ ∈ d.newCells then d.edge else σ - - theorem parent_of_mem_newCells {σ : γ} (h : σ ∈ d.newCells) : d.parent σ = d.edge := by -- rw [parent]; exact if_pos h -+ rw [parent]; exact ite_eq_left h - - theorem parent_of_notMem_newCells {σ : γ} (h : σ ∉ d.newCells) : d.parent σ = σ := by -- rw [parent]; exact if_neg h -+ rw [parent]; exact ite_eq_right h - - theorem parent_of_mem_cells {σ : γ} (h : σ ∈ S.cells) : d.parent σ = σ := - d.parent_of_notMem_newCells (notMem_newCells_of_mem_cells h) -@@ -1361,10 +1361,10 @@ - noncomputable def parent : γ → γ := fun σ => if σ ∈ d.newCells then d.face else σ - - theorem parent_of_mem_newCells {σ : γ} (h : σ ∈ d.newCells) : d.parent σ = d.face := by -- rw [parent]; exact if_pos h -+ rw [parent]; exact ite_eq_left h - - theorem parent_of_notMem_newCells {σ : γ} (h : σ ∉ d.newCells) : d.parent σ = σ := by -- rw [parent]; exact if_neg h -+ rw [parent]; exact ite_eq_right h - - theorem parent_of_mem_cells {σ : γ} (h : σ ∈ S.cells) : d.parent σ = σ := - d.parent_of_notMem_newCells (notMem_newCells_of_mem_cells h) -@@ -1689,11 +1689,11 @@ - intro τ hτ - rw [subdivideEdge_cells] at hτ - ext z -- simp only [Set.mem_iUnion, Set.mem_setOf_eq, exists_prop] -+ simp only [Set.mem_iUnion, Set.mem_ofPred_eq, exists_prop] - rcases hτ with ⟨hτc, hτe⟩ | hτn - · -- a surviving cell: the index set gains the new cells exactly when it had `e` - rw [href.cell_eq hτc hτe, h.closure_eq hτc] -- simp only [Set.mem_iUnion, Set.mem_setOf_eq, exists_prop] -+ simp only [Set.mem_iUnion, Set.mem_ofPred_eq, exists_prop] - constructor - · rintro ⟨σ, ⟨hσc, hσsub⟩, hz⟩ - by_cases hσe : σ = d.edge -diff --git a/Schoenflies/Graph/Cycle.lean b/Schoenflies/Graph/Cycle.lean ---- a/Schoenflies/Graph/Cycle.lean -+++ b/Schoenflies/Graph/Cycle.lean -@@ -61,7 +61,7 @@ - edge lies on a cycle if and only if deleting it does not disconnect its endpoints", both - directions, with the finiteness the proof does not use dropped. The two halves are - `Graph.LiesOnCycle.deleteEdges_reaches` and `Graph.LiesOnCycle.of_deleteEdges_reaches`. --* `Graph.IsBridge`, `Graph.isBridge_iff_not_reaches` — the bridges of -+* `Graph.IsSchoenfliesBridge`, `Graph.isBridge_iff_not_reaches` — the bridges of - `lem:subdivision-ear-preserve` ("a 2-connected graph has no bridge. Indeed, if `uv` were a - bridge, the two components of `G - uv` …"), stated as the separation of the two ends. - * `Graph.IsAcyclic`, `Graph.Connected.deleteEdges_singleton` — the acyclicity underneath -@@ -281,41 +281,41 @@ - - /-! ### Bridges -/ - --/-- `G.IsBridge e` : an edge of `G` that lies on no cycle. Equivalently — and this is the -+/-- `G.IsSchoenfliesBridge e` : an edge of `G` that lies on no cycle. Equivalently — and this is the - form every use wants — an edge whose deletion separates its two ends - (`Graph.isBridge_iff_not_reaches`). -/ --def IsBridge (G : Graph α β) (e : β) : Prop := e ∈ E(G) ∧ ¬ G.LiesOnCycle e -- --theorem IsBridge.edge_mem (h : G.IsBridge e) : e ∈ E(G) := h.1 -- --theorem IsBridge.not_liesOnCycle (h : G.IsBridge e) : ¬ G.LiesOnCycle e := h.2 -+def IsSchoenfliesBridge (G : Graph α β) (e : β) : Prop := e ∈ E(G) ∧ ¬ G.LiesOnCycle e -+ -+theorem IsSchoenfliesBridge.edge_mem (h : G.IsSchoenfliesBridge e) : e ∈ E(G) := h.1 -+ -+theorem IsSchoenfliesBridge.not_liesOnCycle (h : G.IsSchoenfliesBridge e) : ¬ G.LiesOnCycle e := h.2 - - /-- **Deleting a bridge separates its ends.** -/ --theorem IsBridge.not_reaches (h : G.IsBridge e) (hl : G.IsLink e u v) : -+theorem IsSchoenfliesBridge.not_reaches (h : G.IsSchoenfliesBridge e) (hl : G.IsLink e u v) : - ¬ (G.deleteEdges {e}).Reaches u v := - fun hR ↦ h.not_liesOnCycle (LiesOnCycle.of_deleteEdges_reaches hl hR) - - /-- **An edge whose deletion separates its ends is a bridge.** -/ - theorem isBridge_of_not_reaches (hl : G.IsLink e u v) -- (h : ¬ (G.deleteEdges {e}).Reaches u v) : G.IsBridge e := -+ (h : ¬ (G.deleteEdges {e}).Reaches u v) : G.IsSchoenfliesBridge e := - ⟨hl.edge_mem, fun hc ↦ h (hc.deleteEdges_reaches hl)⟩ - - /-- **A bridge is exactly an edge whose deletion separates its ends** — the cycle criterion, - negated. -/ - theorem isBridge_iff_not_reaches (hl : G.IsLink e u v) : -- G.IsBridge e ↔ ¬ (G.deleteEdges {e}).Reaches u v := -+ G.IsSchoenfliesBridge e ↔ ¬ (G.deleteEdges {e}).Reaches u v := - ⟨fun h ↦ h.not_reaches hl, isBridge_of_not_reaches hl⟩ - - /-- A bridge is never a loop: a loop is a cycle. -/ --theorem IsBridge.not_isLoopAt (h : G.IsBridge e) (x : α) : ¬ G.IsLoopAt e x := -+theorem IsSchoenfliesBridge.not_isLoopAt (h : G.IsSchoenfliesBridge e) (x : α) : ¬ G.IsLoopAt e x := - fun hloop ↦ h.not_liesOnCycle (liesOnCycle_of_isLoopAt hloop) - - /-- **A graph is acyclic exactly when every one of its edges is a bridge.** This is the form - the tree module wants acyclicity in: "it is a tree — an edge of a cycle could be deleted" - reads backwards as "no edge can be deleted without separating its ends". -/ --theorem isAcyclic_iff_forall_isBridge : G.IsAcyclic ↔ ∀ e ∈ E(G), G.IsBridge e := -+theorem isAcyclic_iff_forall_isBridge : G.IsAcyclic ↔ ∀ e ∈ E(G), G.IsSchoenfliesBridge e := - ⟨fun h _ he ↦ ⟨he, h he⟩, fun h _ he ↦ (h _ he).not_liesOnCycle⟩ - --theorem IsAcyclic.isBridge (h : G.IsAcyclic) (he : e ∈ E(G)) : G.IsBridge e := ⟨he, h he⟩ -+theorem IsAcyclic.isBridge (h : G.IsAcyclic) (he : e ∈ E(G)) : G.IsSchoenfliesBridge e := ⟨he, h he⟩ - - end Graph -diff --git a/Schoenflies/Graph/Degree.lean b/Schoenflies/Graph/Degree.lean ---- a/Schoenflies/Graph/Degree.lean -+++ b/Schoenflies/Graph/Degree.lean -@@ -231,23 +231,23 @@ - have hl : G.IsLoopAt e u := huv - have h1 : {x | G.Inc e x} = {u} := by - ext z -- simp only [Set.mem_setOf_eq, Set.mem_singleton_iff] -+ simp only [Set.mem_ofPred_eq, Set.mem_singleton_iff] - exact ⟨fun h => (hl.eq_of_inc h).symm, fun h => h ▸ hl.inc⟩ - have h2 : {x | G.IsLoopAt e x} = {u} := by - ext z -- simp only [Set.mem_setOf_eq, Set.mem_singleton_iff] -+ simp only [Set.mem_ofPred_eq, Set.mem_singleton_iff] - exact ⟨fun h => (hl.eq_of_inc h.inc).symm, fun h => h ▸ hl⟩ - rw [h1, h2] - simp - · -- A non-loop: two distinct vertices, one end at each, and no loop anywhere. - have h1 : {x | G.Inc e x} = {u, v} := by - ext z -- simp only [Set.mem_setOf_eq, Set.mem_insert_iff, Set.mem_singleton_iff] -+ simp only [Set.mem_ofPred_eq, Set.mem_insert_iff, Set.mem_singleton_iff] - exact ⟨fun h => h.eq_or_eq_of_isLink huv, - fun h => h.elim (fun hz => hz ▸ huv.inc_left) (fun hz => hz ▸ huv.inc_right)⟩ - have h2 : {x | G.IsLoopAt e x} = ∅ := by - ext z -- simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false] -+ simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false] - intro hz - exact huv' ((hz.eq_of_inc huv.inc_left).symm.trans (hz.eq_of_inc huv.inc_right)) - rw [h1, h2, Set.ncard_pair huv'] -@@ -264,7 +264,7 @@ - rw [← Finset.card_filter p s, ← Set.ncard_coe_finset] - congr 1 - ext z -- simp only [Finset.coe_filter, Set.mem_setOf_eq] -+ simp only [Finset.coe_filter, Set.mem_ofPred_eq] - exact ⟨fun h => ⟨hsub z h, h⟩, fun h => h.2⟩ - - /-- **The handshake lemma.** The degrees of the vertices of a finite multigraph add up to -diff --git a/Schoenflies/Graph/K33Land.lean b/Schoenflies/Graph/K33Land.lean ---- a/Schoenflies/Graph/K33Land.lean -+++ b/Schoenflies/Graph/K33Land.lean -@@ -154,10 +154,10 @@ - have := ZMod.val_lt j; omega - have hw_lt : ∀ j : ZMod (n + 3), j.val < k → - w j = P.vertex (a + ((j.val : ℕ) : ZMod (m + 3))) := fun j hj => by -- rw [hwdef]; exact if_pos hj -+ rw [hwdef]; exact ite_eq_left hj - have hw_ge : ∀ j : ZMod (n + 3), ¬ j.val < k → - w j = P'.vertex (b + ((j.val - k : ℕ) : ZMod (m' + 3))) := fun j hj => by -- rw [hwdef]; exact if_neg hj -+ rw [hwdef]; exact ite_eq_right hj - have hsucc_lt : ∀ j : ZMod (n + 3), j.val < k → - w (j + 1) = P.vertex (a + ((j.val : ℕ) : ZMod (m + 3)) + 1) := by - intro j hj -diff --git a/Schoenflies/Graph/OuterFace.lean b/Schoenflies/Graph/OuterFace.lean ---- a/Schoenflies/Graph/OuterFace.lean -+++ b/Schoenflies/Graph/OuterFace.lean -@@ -90,7 +90,7 @@ - have hmem : Schoenflies.Plane.mk t 0 ∈ Schoenflies.Plane.beyondSquare r := - Or.inl (show r < |t| by rw [abs_of_nonneg ht0]; exact htr) - have hin := hs hmem -- simp only [Schoenflies.Plane.closedSquare, mem_setOf_eq, Schoenflies.Plane.supDist_zero, -+ simp only [Schoenflies.Plane.closedSquare, mem_ofPred_eq, Schoenflies.Plane.supDist_zero, - Schoenflies.Plane.supNorm, max_le_iff] at hin - have h1 : |t| ≤ s := hin.1 - rw [abs_of_nonneg ht0] at h1 -diff --git a/Schoenflies/Graph/PathGraph.lean b/Schoenflies/Graph/PathGraph.lean ---- a/Schoenflies/Graph/PathGraph.lean -+++ b/Schoenflies/Graph/PathGraph.lean -@@ -245,7 +245,7 @@ - theorem pathGraphOf_isLink : - (G.pathGraphOf u W).IsLink e x y ↔ - e ∈ W ∧ G.IsLink e x y ∧ x ∈ G.walkVertices u W ∧ y ∈ G.walkVertices u W := by -- simp only [pathGraphOf, induce_isLink, restrict_isLink, mem_setOf_eq] -+ simp only [pathGraphOf, induce_isLink, restrict_isLink, mem_ofPred_eq] - tauto - - theorem mem_vertexSet_pathGraphOf_self : u ∈ V(G.pathGraphOf u W) := mem_walkVertices_self -@@ -258,8 +258,8 @@ - walk, to know that an entry of `W` is an edge of `G` at all and that its ends are visited. -/ - theorem pathGraphOf_edgeSet (h : G.IsWalk u W v) : E(G.pathGraphOf u W) = {e | e ∈ W} := by - ext f -- rw [edgeSet_eq_setOf_exists_isLink] -- simp only [pathGraphOf_isLink, mem_setOf_eq] -+ rw [edgeSet_eq_setOfPred_exists_isLink] -+ simp only [pathGraphOf_isLink, mem_ofPred_eq] - refine ⟨fun ⟨_, _, hf, _⟩ ↦ hf, fun hf ↦ ?_⟩ - obtain ⟨a, b, hab⟩ := exists_isLink_of_mem_edgeSet (h.edge_mem hf) - exact ⟨a, b, hf, hab, mem_walkVertices_of_mem_covered ⟨f, hf, hab.inc_left⟩, -diff --git a/Schoenflies/Graph/Tree.lean b/Schoenflies/Graph/Tree.lean ---- a/Schoenflies/Graph/Tree.lean -+++ b/Schoenflies/Graph/Tree.lean -@@ -241,7 +241,7 @@ - refine h.anti deleteVerts_le ?_ fun g hg ↦ ?_ - · exact ⟨h.left_mem, hX u mem_walkVertices_self⟩ - · obtain ⟨p, q, hpq⟩ := exists_isLink_of_mem_edgeSet (h.edge_mem hg) -- simp only [edgeSet_deleteVerts, Set.mem_setOf_eq] -+ simp only [edgeSet_deleteVerts, Set.mem_ofPred_eq] - exact ⟨p, q, hpq, hX p (mem_walkVertices_of_mem_covered ⟨g, hg, hpq.inc_left⟩), - hX q (mem_walkVertices_of_mem_covered ⟨g, hg, hpq.inc_right⟩)⟩ - -@@ -249,7 +249,7 @@ - theorem edgeSet_deleteVerts_singleton (G : Graph α β) (x : α) : - E(G.deleteVerts {x}) = E(G) \ G.incidenceSet x := by - ext g -- simp only [edgeSet_deleteVerts, Set.mem_setOf_eq, Set.mem_sdiff, mem_incidenceSet, -+ simp only [edgeSet_deleteVerts, Set.mem_ofPred_eq, Set.mem_sdiff, mem_incidenceSet, - Set.mem_singleton_iff] - refine ⟨fun ⟨p, q, hpq, hp, hq⟩ ↦ ⟨hpq.edge_mem, fun hinc ↦ ?_⟩, fun ⟨hg, hninc⟩ ↦ ?_⟩ - · rcases hinc.eq_or_eq_of_isLink hpq with rfl | rfl -@@ -282,16 +282,16 @@ - induction n with - | zero => - intro G hfin hle hT -- haveI := hfin -+ have := hfin - obtain ⟨a, ha⟩ := hT.connected.nonempty - have := (Set.ncard_pos (finite_vertexSet G)).2 ⟨a, ha⟩ - omega - | succ n ih => - intro G hfin hle hT -- haveI := hfin -+ have := hfin - by_cases h2 : 2 ≤ V(G).ncard - · obtain ⟨x, hx⟩ := hT.has_leaf h2 -- haveI : (G.deleteVerts {x}).Finite := Finite.of_le deleteVerts_le -+ have : (G.deleteVerts {x}).Finite := Finite.of_le deleteVerts_le - have hT' : (G.deleteVerts {x}).IsTree := hT.delete_leaf hx h2 - have hV : V(G.deleteVerts {x}).ncard = V(G).ncard - 1 := by - rw [vertexSet_deleteVerts, Set.ncard_sdiff_singleton_of_mem hx.mem_vertexSet] -diff --git a/Schoenflies/GridAttach.lean b/Schoenflies/GridAttach.lean ---- a/Schoenflies/GridAttach.lean -+++ b/Schoenflies/GridAttach.lean -@@ -184,7 +184,7 @@ - Graph.SameLinks (pieceListGraph (subdivide pieces points)) (overlayGraph pieces points) := by - constructor - · ext v -- simp only [pieceListGraph_vertexSet, overlayGraph_vertexSet, endSet, mem_setOf_eq] -+ simp only [pieceListGraph_vertexSet, overlayGraph_vertexSet, endSet, mem_ofPred_eq] - constructor - · rintro ⟨P, hP, hv⟩ - exact ⟨orientPiece P, mem_overlayPieces.2 ⟨P, hP, rfl⟩, (orientPiece_ends P v).2 hv⟩ -@@ -346,12 +346,12 @@ - · rintro ⟨P, hP, hx⟩ - rw [List.mem_singleton] at hP - subst hP -- simp only [Graph.walkVertices, mem_insert_iff, Graph.coveredVertices, mem_setOf_eq] -+ simp only [Graph.walkVertices, mem_insert_iff, Graph.coveredVertices, mem_ofPred_eq] - rcases hx with h | h - · exact Or.inl h - · exact Or.inr ⟨(q₀, q₁), hmem, pieceListGraph_inc hmem (Or.inr h)⟩ - · intro hx -- simp only [Graph.walkVertices, mem_insert_iff, Graph.coveredVertices, mem_setOf_eq] at hx -+ simp only [Graph.walkVertices, mem_insert_iff, Graph.coveredVertices, mem_ofPred_eq] at hx - rcases hx with h | ⟨e, he, hinc⟩ - · exact ⟨(q₀, q₁), hmem, Or.inl h⟩ - · rw [List.mem_singleton] at he -diff --git a/Schoenflies/InitialPair.lean b/Schoenflies/InitialPair.lean ---- a/Schoenflies/InitialPair.lean -+++ b/Schoenflies/InitialPair.lean -@@ -154,28 +154,28 @@ - obtain ⟨h⟩ := hC.homeomorph_modelCurve - refine ⟨fun p => if hp : p ∈ C then (h ⟨p, hp⟩ : Plane) else 0, - fun q => if hq : q ∈ modelCurve then (h.symm ⟨q, hq⟩ : Plane) else 0, ?_, ?_, ?_, ?_, ?_, ?_⟩ -- · rw [continuousOn_iff_continuous_restrict] -- have : (C.restrict fun p => if hp : p ∈ C then (h ⟨p, hp⟩ : Plane) else 0) = -+ · rw [continuousOn_iff_continuous_domRestrict] -+ have : (C.domRestrict fun p => if hp : p ∈ C then (h ⟨p, hp⟩ : Plane) else 0) = - fun p : ↥C => (h p : Plane) := by -- funext p; simp [Set.restrict, p.2] -+ funext p; simp [Set.domRestrict, p.2] - rw [this] - exact continuous_subtype_val.comp h.continuous -- · rw [continuousOn_iff_continuous_restrict] -- have : (modelCurve.restrict fun q => if hq : q ∈ modelCurve then (h.symm ⟨q, hq⟩ : Plane) -+ · rw [continuousOn_iff_continuous_domRestrict] -+ have : (modelCurve.domRestrict fun q => if hq : q ∈ modelCurve then (h.symm ⟨q, hq⟩ : Plane) - else 0) = fun q : ↥modelCurve => (h.symm q : Plane) := by -- funext q; simp [Set.restrict, q.2] -+ funext q; simp [Set.domRestrict, q.2] - rw [this] - exact continuous_subtype_val.comp h.symm.continuous -- · intro p hp; simp only [dif_pos hp]; exact (h ⟨p, hp⟩).2 -- · intro q hq; simp only [dif_pos hq]; exact (h.symm ⟨q, hq⟩).2 -+ · intro p hp; simp only [dite_eq_left hp]; exact (h ⟨p, hp⟩).2 -+ · intro q hq; simp only [dite_eq_left hq]; exact (h.symm ⟨q, hq⟩).2 - · intro p hp - have hmem : (h ⟨p, hp⟩ : Plane) ∈ modelCurve := (h ⟨p, hp⟩).2 -- simp only [dif_pos hp, dif_pos hmem] -+ simp only [dite_eq_left hp, dite_eq_left hmem] - have : (⟨(h ⟨p, hp⟩ : Plane), hmem⟩ : ↥modelCurve) = h ⟨p, hp⟩ := rfl - rw [this, h.symm_apply_apply] - · intro q hq - have hmem : (h.symm ⟨q, hq⟩ : Plane) ∈ C := (h.symm ⟨q, hq⟩).2 -- simp only [dif_pos hq, dif_pos hmem] -+ simp only [dite_eq_left hq, dite_eq_left hmem] - have : (⟨(h.symm ⟨q, hq⟩ : Plane), hmem⟩ : ↥C) = h.symm ⟨q, hq⟩ := rfl - rw [this, h.apply_symm_apply] - -@@ -1444,10 +1444,10 @@ - d.cross (Function.invFunOn (tgtChord d.xa d.xb) I y) - - theorem skelMap_of_mem {x : Plane} (hx : x ∈ C) : d.skelMap x = d.u x := by -- simp only [skelMap, if_pos hx] -+ simp only [skelMap, ite_eq_left hx] - - theorem skelInv_of_mem {y : Plane} (hy : y ∈ modelCurve) : d.skelInv y = d.w y := by -- simp only [skelInv, if_pos hy] -+ simp only [skelInv, ite_eq_left hy] - - /-- **The skeleton map matches parameters on the crosscut.** -/ - theorem skelMap_cross {t : ℝ} (ht : t ∈ I) : -@@ -1458,7 +1458,7 @@ - simp [tgtChord] - · rw [d.skelMap_of_mem hmem, d.cross_one, d.u_b] - simp [tgtChord] -- · simp only [skelMap, if_neg hmem, d.injOn_cross.leftInvOn_invFunOn ht] -+ · simp only [skelMap, ite_eq_right hmem, d.injOn_cross.leftInvOn_invFunOn ht] - - theorem tgtChord_mem_modelCurve_iff {t : ℝ} (ht : t ∈ I) : - tgtChord d.xa d.xb t ∈ modelCurve ↔ t = 0 ∨ t = 1 := by -@@ -1486,7 +1486,7 @@ - simp [tgtChord] - · rw [d.skelInv_of_mem hmem, d.cross_one] - simp [tgtChord] -- · simp only [skelInv, if_neg hmem, d.injOn_tgtChord.leftInvOn_invFunOn ht] -+ · simp only [skelInv, ite_eq_right hmem, d.injOn_tgtChord.leftInvOn_invFunOn ht] - - /-! #### Continuity and inversion -/ - -diff --git a/Schoenflies/InitialPairFixed.lean b/Schoenflies/InitialPairFixed.lean ---- a/Schoenflies/InitialPairFixed.lean -+++ b/Schoenflies/InitialPairFixed.lean -@@ -307,7 +307,7 @@ - c ∈ faceCells k ↔ - c ∈ initialStructure.pathCells u (initBoundary (.face k)) := by - rw [mem_faceCells_iff] -- simp only [CellStructure.pathCells, Set.mem_union, Set.mem_setOf_eq, -+ simp only [CellStructure.pathCells, Set.mem_union, Set.mem_ofPred_eq, - Graph.mem_walkVertices_iff, Graph.mem_coveredVertices_iff] - constructor - · rintro (hc | hc) -diff --git a/Schoenflies/Inversion.lean b/Schoenflies/Inversion.lean ---- a/Schoenflies/Inversion.lean -+++ b/Schoenflies/Inversion.lean -@@ -172,8 +172,8 @@ - z.2 (mem_singleton_iff.2 (invert_eq_center_iff.1 (mem_singleton_iff.1 h)))⟩ - left_inv z := Subtype.ext (invert_invert a z) - right_inv z := Subtype.ext (invert_invert a z) -- continuous_toFun := ((continuousOn_invert a).restrict).subtype_mk _ -- continuous_invFun := ((continuousOn_invert a).restrict).subtype_mk _ -+ continuous_toFun := ((continuousOn_invert a).domRestrict).subtype_mk _ -+ continuous_invFun := ((continuousOn_invert a).domRestrict).subtype_mk _ - - /-! ### The image of a Jordan curve - -diff --git a/Schoenflies/LimitMap.lean b/Schoenflies/LimitMap.lean ---- a/Schoenflies/LimitMap.lean -+++ b/Schoenflies/LimitMap.lean -@@ -477,7 +477,7 @@ - - /-- **The characterising property of `F`.** -/ - theorem iInter_tgtStar_eq (hx : x ∈ L.dom) : ⋂ n, L.tgtStar n x = {L.F x} := by -- rw [F, dif_pos (L.exists_eq_singleton_iInter_tgtStar hx)] -+ rw [F, dite_eq_left (L.exists_eq_singleton_iInter_tgtStar hx)] - exact (L.exists_eq_singleton_iInter_tgtStar hx).choose_spec - - theorem F_mem_iInter (hx : x ∈ L.dom) : L.F x ∈ ⋂ n, L.tgtStar n x := by -@@ -863,7 +863,7 @@ - - theorem inv_spec (h : ∃ x, x ∈ L.region ∧ L.F x = y) : - L.inv y ∈ L.region ∧ L.F (L.inv y) = y := by -- rw [inv, dif_pos h] -+ rw [inv, dite_eq_left h] - exact h.choose_spec - - theorem inv_mem_region (hy : y ∈ L.region') : L.inv y ∈ L.region := -diff --git a/Schoenflies/LocallyPolygonal.lean b/Schoenflies/LocallyPolygonal.lean ---- a/Schoenflies/LocallyPolygonal.lean -+++ b/Schoenflies/LocallyPolygonal.lean -@@ -185,7 +185,7 @@ - centre in each coordinate separately. -/ - theorem mem_openSquare_iff (c : Plane) (r : ℝ) (x : Plane) : - x ∈ openSquare c r ↔ ∀ i, |x i - c i| < r := by -- simp only [openSquare, mem_setOf_eq, supDist, supNorm, sub_apply, max_lt_iff, -+ simp only [openSquare, mem_ofPred_eq, supDist, supNorm, sub_apply, max_lt_iff, - Fin.forall_fin_two] - - /-- The centre of a square of positive radius is in it. -/ -@@ -246,17 +246,17 @@ - rw [abs_lt] at hlt - cases b - · exact absurd (show x i ≤ c i - r from hmem) (by -- simp only [sideGap, cond_false] at hs; linarith [hlt.1]) -+ simp only [sideGap, Bool.cond_false] at hs; linarith [hlt.1]) - · exact absurd (show c i + r ≤ x i from hmem) (by -- simp only [sideGap, cond_true] at hs; linarith [hlt.2]) -+ simp only [sideGap, Bool.cond_true] at hs; linarith [hlt.2]) - - /-- If there is no room between `p` and a half-plane, `p` is in it. -/ - theorem mem_sideHalfPlane_of_sideGap_nonpos {c : Plane} {r : ℝ} {p : Plane} {i : Fin 2} - {b : Bool} (h : sideGap c r p i b ≤ 0) : p ∈ sideHalfPlane c r i b := by - cases b -- · simp only [sideGap, cond_false] at h -+ · simp only [sideGap, Bool.cond_false] at h - exact show p i ≤ c i - r by linarith -- · simp only [sideGap, cond_true] at h -+ · simp only [sideGap, Bool.cond_true] at h - exact show c i + r ≤ p i by linarith - - /-- Each piece the sides of one square cut a small square into is an axis-parallel rectangle — -@@ -346,7 +346,7 @@ - rintro c ⟨hcA, hcne⟩ - have : p ∉ closedSquare c (ρ c) := - Set.disjoint_left.1 (hdisj c₀ hc₀A c hcA fun h => hcne (h ▸ rfl)) hpc₀ -- simp only [closedSquare, mem_setOf_eq, not_le] at this -+ simp only [closedSquare, mem_ofPred_eq, not_le] at this - linarith - obtain ⟨s₁, hs₁, hs₁le⟩ := exists_pos_le_of_finite (hA.sdiff (t := {c₀})) - (f := fun c => supDist p c - ρ c) hfar -@@ -388,7 +388,7 @@ - have hfar : ∀ c ∈ A, 0 < supDist p c - ρ c := by - intro c hcA - have := hnear c hcA -- simp only [closedSquare, mem_setOf_eq, not_le] at this -+ simp only [closedSquare, mem_ofPred_eq, not_le] at this - linarith - obtain ⟨s, hs, hsle⟩ := exists_pos_le_of_finite hA (f := fun c => supDist p c - ρ c) hfar - refine isLocallyPolyConnAt_of_convex (isOpen_openSquare p s) -diff --git a/Schoenflies/MatchedSplit.lean b/Schoenflies/MatchedSplit.lean ---- a/Schoenflies/MatchedSplit.lean -+++ b/Schoenflies/MatchedSplit.lean -@@ -319,7 +319,7 @@ - theorem splitMap_of_mem_skeletonSet {x : Plane} (hx : x ∈ R₁.skeletonSet) : - splitMap g m x = g.toFun x := by - classical -- simp only [splitMap, if_pos hx] -+ simp only [splitMap, ite_eq_left hx] - - theorem splitMap_eqOn_skeletonSet : EqOn (splitMap g m) g.toFun R₁.skeletonSet := - fun _ hx => splitMap_of_mem_skeletonSet hx -@@ -327,12 +327,12 @@ - theorem splitInvMap_of_mem_skeletonSet {y : Plane} (hy : y ∈ R₂.skeletonSet) : - splitInvMap g m y = g.invFun y := by - classical -- simp only [splitInvMap, if_pos hy] -+ simp only [splitInvMap, ite_eq_left hy] - - theorem splitInvMap_of_notMem_skeletonSet {y : Plane} (hy : y ∉ R₂.skeletonSet) : - splitInvMap g m y = m.invFun y := by - classical -- simp only [splitInvMap, if_neg hy] -+ simp only [splitInvMap, ite_eq_right hy] - - variable (hE₁ : d.EarCrosscut R₁ earPos₁ earDraw₁) (hE₂ : d.EarCrosscut R₂ earPos₂ earDraw₂) - -@@ -345,13 +345,13 @@ - splitMap g m x = m.toFun x := by - classical - by_cases hs : x ∈ R₁.skeletonSet -- · rw [splitMap, if_pos hs] -+ · rw [splitMap, ite_eq_left hs] - have hends := hE₁.earSet_inter_skeletonSet ⟨hx, hs⟩ - simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hends - rcases hends with rfl | rfl - · rw [g.pos_apply d.source_mem_skel, m.toFun_pos_source hE₁ hE₂] - · rw [g.pos_apply d.target_mem_skel, m.toFun_pos_target hE₁ hE₂] -- · rw [splitMap, if_neg hs] -+ · rw [splitMap, ite_eq_right hs] - - theorem splitMap_eqOn_earSet : EqOn (splitMap g m) m.toFun (d.earSet earPos₁ earDraw₁) := - fun _ hx => splitMap_of_mem_earSet hE₁ hE₂ hx -@@ -362,7 +362,7 @@ - classical - intro y hy - by_cases hs : y ∈ R₂.skeletonSet -- · rw [splitInvMap, if_pos hs] -+ · rw [splitInvMap, ite_eq_left hs] - have hends := hE₂.earSet_inter_skeletonSet ⟨hy, hs⟩ - simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hends - rcases hends with rfl | rfl -@@ -370,7 +370,7 @@ - rw [h, m.invFun_pos_source hE₁ hE₂] - · have h : g.invFun (R₂.pos d.target) = R₁.pos d.target := g.symm.pos_apply d.target_mem_skel - rw [h, m.invFun_pos_target hE₁ hE₂] -- · rw [splitInvMap, if_neg hs] -+ · rw [splitInvMap, ite_eq_right hs] - - /-- **A point of the source ear off the old skeleton is carried off the old target skeleton.** - The image lies on the target ear, and the target ear meets the target skeleton only in the two -diff --git a/Schoenflies/ModelCurve.lean b/Schoenflies/ModelCurve.lean ---- a/Schoenflies/ModelCurve.lean -+++ b/Schoenflies/ModelCurve.lean -@@ -167,7 +167,7 @@ - theorem modelCurve_eq_sides : - modelCurve = (sideTop ∪ sideLeft) ∪ (sideBottom ∪ sideRight) := by - ext x -- simp only [modelCurve, mem_setOf_eq, mem_union, mem_sideTop, mem_sideLeft, mem_sideBottom, -+ simp only [modelCurve, mem_ofPred_eq, mem_union, mem_sideTop, mem_sideLeft, mem_sideBottom, - mem_sideRight, Plane.supNorm] - constructor - · intro h -@@ -373,7 +373,7 @@ - theorem modelCurve_eq_frontier : modelCurve = frontier (Plane.closedSquare 0 1) := by - rw [(Plane.isClosed_closedSquare 0 1).frontier_eq, interior_closedSquare_zero_one] - ext x -- simp only [modelCurve, mem_setOf_eq, mem_sdiff, mem_closedSquare_zero_one, -+ simp only [modelCurve, mem_ofPred_eq, mem_sdiff, mem_closedSquare_zero_one, - mem_openSquare_zero_one, not_lt] - exact ⟨fun h => ⟨h.le, h.ge⟩, fun h => le_antisymm h.1 h.2⟩ - -@@ -420,14 +420,14 @@ - ∃ h : ↥(f '' I) ≃ₜ ↥(g '' I), - ∀ (t : ℝ) (ht : t ∈ I), (h ⟨f t, mem_image_of_mem f ht⟩ : Plane) = g t := by - classical -- haveI : CompactSpace ↥I := isCompact_iff_compactSpace.mp isCompact_I -- haveI : CompactSpace ↥(f '' I) := -+ have : CompactSpace ↥I := isCompact_iff_compactSpace.mp isCompact_I -+ have : CompactSpace ↥(f '' I) := - isCompact_iff_compactSpace.mp (isCompact_I.image_of_continuousOn hf.continuousOn) - -- the two parametrizations, read as maps of subtypes - set q : ↥I → ↥(f '' I) := fun t => ⟨f t, mem_image_of_mem f t.2⟩ with hq - set q' : ↥I → ↥(g '' I) := fun t => ⟨g t, mem_image_of_mem g t.2⟩ with hq' -- have hqc : Continuous q := (hf.continuousOn.restrict).subtype_mk _ -- have hq'c : Continuous q' := (hg.continuousOn.restrict).subtype_mk _ -+ have hqc : Continuous q := (hf.continuousOn.domRestrict).subtype_mk _ -+ have hq'c : Continuous q' := (hg.continuousOn.domRestrict).subtype_mk _ - have hqs : Function.Surjective q := by - rintro ⟨z, t, ht, rfl⟩ - exact ⟨⟨t, ht⟩, rfl⟩ -diff --git a/Schoenflies/OuterChain.lean b/Schoenflies/OuterChain.lean ---- a/Schoenflies/OuterChain.lean -+++ b/Schoenflies/OuterChain.lean -@@ -309,13 +309,13 @@ - have harc : ∀ {W : List β}, (∀ g ∈ W, g ∈ D₁ ++ D₂) → - ∀ g ∈ W, g ∈ E(H.cycleGraph u e D) := by - intro W hW g hg -- rw [hcyc.cycleGraph_edgeSet, Set.mem_setOf_eq, List.mem_append] -+ rw [hcyc.cycleGraph_edgeSet, Set.mem_ofPred_eq, List.mem_append] - rcases List.mem_cons.1 (hcc.split.mem_iff.1 (hW g hg)) with rfl | h - · exact Or.inr (List.mem_singleton_self _) - · exact Or.inl h - have hnew : ∀ g ∈ R, g ∉ E(H.cycleGraph u e D) := by - intro g hg hmem -- rw [hcyc.cycleGraph_edgeSet, Set.mem_setOf_eq] at hmem -+ rw [hcyc.cycleGraph_edgeSet, Set.mem_ofPred_eq] at hmem - exact hcc.edges_new g hg hmem - have hint : ∀ y ∈ H.walkVertices a R, y ≠ a → y ≠ b → y ∉ V(H.cycleGraph u e D) := by - intro y hy hya hyb -@@ -779,7 +779,7 @@ - ¬ Bornology.IsBounded (face (chainUnion Γ 0 n) drawing x) := by - have hext := h.mem_exterior_chain hout - refine ⟨hext, fun hb => ?_⟩ -- haveI : (chainUnion Γ 0 n).Finite := h.block_finite (i := 0) (m := n) (by omega) -+ have : (chainUnion Γ 0 n).Finite := h.block_finite (i := 0) (m := n) (by omega) - exact h.not_encloses hout hdesc n 0 (by omega) - (encloses_of_isBounded_face (h.block_isDrawing (by omega)) (h.block_polygonal (by omega)) - (h.block_isTwoConnected (by omega)) hext hb) -diff --git a/Schoenflies/OverlayExtension.lean b/Schoenflies/OverlayExtension.lean ---- a/Schoenflies/OverlayExtension.lean -+++ b/Schoenflies/OverlayExtension.lean -@@ -22,7 +22,7 @@ - - namespace Schoenflies - --open Graph -+open _root_.Schoenflies.Graph - - namespace IsPlaneSubdivisionExtension - -diff --git a/Schoenflies/OverlayGraph.lean b/Schoenflies/OverlayGraph.lean ---- a/Schoenflies/OverlayGraph.lean -+++ b/Schoenflies/OverlayGraph.lean -@@ -88,12 +88,12 @@ - - theorem orientPiece_of_precedes {P : Piece} (h : Precedes P.1 P.2) : orientPiece P = P := by - classical -- exact if_pos h -+ exact ite_eq_left h - - theorem orientPiece_of_not_precedes {P : Piece} (h : ¬ Precedes P.1 P.2) : - orientPiece P = (P.2, P.1) := by - classical -- exact if_neg h -+ exact ite_eq_right h - - /-- Orienting does not move the segment. -/ - @[simp] theorem orientPiece_seg (P : Piece) : (orientPiece P).seg = P.seg := by -@@ -247,7 +247,7 @@ - rcases hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases hvw with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> simp - edge_mem_iff_exists_isLink := by - intro P -- simp only [mem_setOf_eq] -+ simp only [mem_ofPred_eq] - exact ⟨fun hP => ⟨P.1, P.2, hP, Or.inl ⟨rfl, rfl⟩⟩, fun ⟨_, _, hP, _⟩ => hP⟩ - left_mem_of_isLink := by - rintro P x y ⟨hP, h⟩ -@@ -347,7 +347,7 @@ - rw [← overlayPieces_cover pieces points] - ext z - simp only [Graph.pointSet, mem_union, mem_iUnion, exists_prop, overlayGraph_vertexSet, -- endSet, mem_setOf_eq, overlayGraph_mem_edgeSet, edgeArc_segmentDrawing, cover] -+ endSet, mem_ofPred_eq, overlayGraph_mem_edgeSet, edgeArc_segmentDrawing, cover] - constructor - · rintro (⟨P, hP, hzP⟩ | ⟨P, hP, hzP⟩) - · refine ⟨P, hP, ?_⟩ -diff --git a/Schoenflies/Parity.lean b/Schoenflies/Parity.lean ---- a/Schoenflies/Parity.lean -+++ b/Schoenflies/Parity.lean -@@ -377,19 +377,22 @@ - by_cases hD : fwd u q < fwd u (meet u a b (hgt u q)) - · by_cases h1 : hgt u a ≤ hgt u q - · by_cases h2 : hgt u q < hgt u c -- · rw [if_pos ⟨h1, h2, hD⟩, if_neg (by rintro ⟨g, -, -⟩; linarith), -- if_pos ⟨h1, by linarith, hD⟩] -+ · rw [ite_eq_left ⟨h1, h2, hD⟩, ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_left ⟨h1, by linarith, hD⟩] - · push Not at h2 - by_cases h3 : hgt u q < hgt u b -- · rw [if_neg (by rintro ⟨-, g, -⟩; linarith), if_pos ⟨h2, h3, hD⟩, -- if_pos ⟨h1, h3, hD⟩] -- · rw [if_neg (by rintro ⟨-, g, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith), -- if_neg (by rintro ⟨-, g, -⟩; linarith)] -+ · rw [ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ite_eq_left ⟨h2, h3, hD⟩, -+ ite_eq_left ⟨h1, h3, hD⟩] -+ · rw [ite_eq_right (by rintro ⟨-, g, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] - · push Not at h1 -- rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨g, -, -⟩; linarith), -- if_neg (by rintro ⟨g, -, -⟩; linarith)] -- · rw [if_neg (by rintro ⟨-, -, g⟩; exact hD g), if_neg (by rintro ⟨-, -, g⟩; exact hD g), -- if_neg (by rintro ⟨-, -, g⟩; exact hD g)] -+ rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith)] -+ · rw [ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), -+ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), -+ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g)] - - private theorem crossings_split (hab : hgt u a ≠ hgt u b) (hc : c ∈ openSegment ℝ a b) - (q : Plane) : -@@ -690,52 +693,59 @@ - (meet u a b (hgt u q + s)) (hma _ (by linarith) hB.le) - (hha _).ge (by rw [hha]; linarith) (by rw [hha]; linarith) (hha _).le - by_cases hD : fwd u q < fwd u (meet u a b (hgt u q)) -- · rw [if_pos ⟨hA, by linarith, hD⟩, if_pos ⟨by linarith, hB, e.1 hD⟩, -- if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith)] -+ · rw [ite_eq_left ⟨hA, by linarith, hD⟩, ite_eq_left ⟨by linarith, hB, e.1 hD⟩, -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] - decide -- · rw [if_neg (by rintro ⟨-, -, g⟩; exact hD g), -- if_neg (by rintro ⟨-, -, g⟩; exact hD (e.2 g)), -- if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith)] -+ · rw [ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), -+ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD (e.2 g)), -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] - · rcases lt_or_ge (hgt u q) (hgt u b) with hB2 | hB2 - · -- the sweep passes the upper end - have e := hside (meet u a b (hgt u q)) (hma _ hA hB2.le) b hbseg - (hha _).ge (by rw [hha]; linarith) (by linarith) hB - by_cases hD : fwd u q < fwd u (meet u a b (hgt u q)) -- · rw [if_pos ⟨hA, hB2, hD⟩, if_neg (by rintro ⟨-, g, -⟩; linarith), -- if_neg (by rintro ⟨g, -, -⟩; linarith), if_pos ⟨hB2, hB, e.1 hD⟩] -+ · rw [ite_eq_left ⟨hA, hB2, hD⟩, ite_eq_right (by rintro ⟨-, g, -⟩; linarith), -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ite_eq_left ⟨hB2, hB, e.1 hD⟩] - decide -- · rw [if_neg (by rintro ⟨-, -, g⟩; exact hD g), -- if_neg (by rintro ⟨-, g, -⟩; linarith), -- if_neg (by rintro ⟨g, -, -⟩; linarith), -- if_neg (by rintro ⟨-, -, g⟩; exact hD (e.2 g))] -+ · rw [ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD (e.2 g))] - · -- the edge is entirely below the sweep -- rw [if_neg (by rintro ⟨-, g, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith), -- if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨g, -, -⟩; linarith)] -+ rw [ite_eq_right (by rintro ⟨-, g, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith)] - · rcases le_or_gt (hgt u a) (hgt u q + s) with hA2 | hA2 - · rcases lt_or_ge (hgt u q + s) (hgt u b) with hB | hB - · -- the sweep passes the lower end only - have e := hside (meet u a b (hgt u q + s)) (hma _ hA2 hB.le) a haseg - (by rw [hha]; linarith) (hha _).le (by linarith) hA2 - by_cases hD : fwd u q < fwd u a -- · rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_pos ⟨hA2, hB, e.2 hD⟩, -- if_pos ⟨hA, hA2, hD⟩, if_neg (by rintro ⟨-, g, -⟩; linarith)] -+ · rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ite_eq_left ⟨hA2, hB, e.2 hD⟩, -+ ite_eq_left ⟨hA, hA2, hD⟩, ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] - decide -- · rw [if_neg (by rintro ⟨g, -, -⟩; linarith), -- if_neg (by rintro ⟨-, -, g⟩; exact hD (e.1 g)), -- if_neg (by rintro ⟨-, -, g⟩; exact hD g), -- if_neg (by rintro ⟨-, g, -⟩; linarith)] -+ · rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD (e.1 g)), -+ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] - · -- the sweep passes both ends - have e := hside a haseg b hbseg (by linarith) hA2 (by linarith) hB - by_cases hD : fwd u q < fwd u a -- · rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith), -- if_pos ⟨hA, hA2, hD⟩, if_pos ⟨by linarith, hB, e.1 hD⟩] -+ · rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), -+ ite_eq_left ⟨hA, hA2, hD⟩, ite_eq_left ⟨by linarith, hB, e.1 hD⟩] - decide -- · rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith), -- if_neg (by rintro ⟨-, -, g⟩; exact hD g), -- if_neg (by rintro ⟨-, -, g⟩; exact hD (e.2 g))] -+ · rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), -+ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD (e.2 g))] - · -- the edge is entirely above the sweep -- rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨g, -, -⟩; linarith), -- if_neg (by rintro ⟨-, g, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith)] -+ rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), -+ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] - - /-- Sweeping the base point across the ray direction, without meeting the polygon, does not - change the parity. This is where the polygon has to be closed. -/ -@@ -882,7 +892,7 @@ - refine List.sum_eq_zero ?_ - intro x hx - obtain ⟨P, hP, rfl⟩ := List.mem_map.1 hx -- refine if_neg ?_ -+ refine ite_eq_right ?_ - rintro ⟨h1, h2, h3⟩ - exact absurd (h _ (mem_cover hP (meet_mem_seg (hL P hP) h1 h2.le))) (not_lt.2 h3.le) - -@@ -999,7 +1009,7 @@ - rintro ⟨-, -, g⟩ - rw [hgp, hfp, hmeetp] at g - linarith -- rw [mark, mark, if_pos hm1, if_neg hm2, add_zero] -+ rw [mark, mark, ite_eq_left hm1, ite_eq_right hm2, add_zero] - refine ⟨by rw [hneg]; exact hcov (-t) (by linarith) habsm, hcov t (ne_of_gt ht) habsp, ?_⟩ - have hz1 : (L₁.map (fun P => mark u P (p - t • u) + mark u P (p + t • u))).sum = 0 := by - refine List.sum_eq_zero ?_ -diff --git a/Schoenflies/ParitySplitting.lean b/Schoenflies/ParitySplitting.lean ---- a/Schoenflies/ParitySplitting.lean -+++ b/Schoenflies/ParitySplitting.lean -@@ -122,7 +122,9 @@ - theorem mark_swap' (u : Plane) (P : Piece) (q : Plane) : mark u (P.2, P.1) q = mark u P q := by - obtain ⟨a, b⟩ := P - by_cases h : hgt u a = hgt u b -- · rw [mark, mark, if_neg (not_crosses_of_level h.symm q), if_neg (not_crosses_of_level h q)] -+ · rw [mark, mark, -+ ite_eq_right (not_crosses_of_level h.symm q), -+ ite_eq_right (not_crosses_of_level h q)] - · exact mark_swap h q - - /-- Reordering the edges does not change the count. -/ -diff --git a/Schoenflies/PolyArcRealize.lean b/Schoenflies/PolyArcRealize.lean ---- a/Schoenflies/PolyArcRealize.lean -+++ b/Schoenflies/PolyArcRealize.lean -@@ -122,22 +122,22 @@ - intro k l hkl - dsimp only at hkl - by_cases hk : k < N <;> by_cases hl : l < N -- · rw [if_pos hk, if_pos hl] at hkl -+ · rw [ite_eq_left hk, ite_eq_left hl] at hkl - exact hv k hk l hl hkl - · -- A listed point cannot equal a padded one: its first coordinate is too small. - exfalso -- rw [if_pos hk, if_neg hl] at hkl -+ rw [ite_eq_left hk, ite_eq_right hl] at hkl - have h1 : v k 0 = M + 1 + (l : ℝ) := by rw [hkl]; exact Plane.mk_zero _ _ - have h2 : (0 : ℝ) ≤ (l : ℝ) := Nat.cast_nonneg l - have h3 := hM k hk - linarith - · exfalso -- rw [if_neg hk, if_pos hl] at hkl -+ rw [ite_eq_right hk, ite_eq_left hl] at hkl - have h1 : v l 0 = M + 1 + (k : ℝ) := by rw [← hkl]; exact Plane.mk_zero _ _ - have h2 : (0 : ℝ) ≤ (k : ℝ) := Nat.cast_nonneg k - have h3 := hM l hl - linarith -- · rw [if_neg hk, if_neg hl] at hkl -+ · rw [ite_eq_right hk, ite_eq_right hl] at hkl - have h1 : M + 1 + (k : ℝ) = M + 1 + (l : ℝ) := by - rw [← Plane.mk_zero (M + 1 + (k : ℝ)) 0, hkl]; exact Plane.mk_zero _ _ - exact_mod_cast (by linarith : (k : ℝ) = (l : ℝ)) -@@ -156,9 +156,9 @@ - /-- The index map that skips over vertex `i + 1`. -/ - def skipIdx (i k : ℕ) : ℕ := if k ≤ i then k else k + 1 - --theorem skipIdx_of_le (h : k ≤ i) : skipIdx i k = k := if_pos h -- --theorem skipIdx_of_lt (h : i < k) : skipIdx i k = k + 1 := if_neg (by omega) -+theorem skipIdx_of_le (h : k ≤ i) : skipIdx i k = k := ite_eq_left h -+ -+theorem skipIdx_of_lt (h : i < k) : skipIdx i k = k + 1 := ite_eq_right (by omega) - - theorem skipIdx_injective (i : ℕ) : Function.Injective (skipIdx i) := by - intro k l h -@@ -572,18 +572,18 @@ - -- The linear vertex list: the ends, in the order the arc reaches them, and then `b`. - set vf : ℕ → Plane := fun k => if h : k < n then f (par TF hcard ⟨k, h⟩) else b with hvf - have hvflt : ∀ (k : ℕ) (hk : k < n), vf k = f (tp ⟨k, hk⟩) := by -- intro k hk; rw [hvf]; simp only [dif_pos hk, htp] -- have hvfn : vf n = b := by rw [hvf]; simp only [dif_neg (lt_irrefl n)] -+ intro k hk; rw [hvf]; simp only [dite_eq_left hk, htp] -+ have hvfn : vf n = b := by rw [hvf]; simp only [dite_eq_right (lt_irrefl n)] - -- `f 1 = b` is the right end of the last gap, so the list has the right successor at each step. - have hvfsucc : ∀ (k : ℕ) (hk : k < n), vf (k + 1) = f (nx ⟨k, hk⟩) := by - intro k hk - by_cases hk1 : k + 1 < n - · rw [hvflt (k + 1) hk1, htp, hnx, parNext, -- dif_pos (show (⟨k, hk⟩ : Fin n).val + 1 < n from hk1)] -+ dite_eq_left (show (⟨k, hk⟩ : Fin n).val + 1 < n from hk1)] - rfl - · have : k + 1 = n := by omega - rw [this, hvfn, hnx, parNext, -- dif_neg (show ¬ ((⟨k, hk⟩ : Fin n).val + 1 < n) from hk1), hf1] -+ dite_eq_right (show ¬ ((⟨k, hk⟩ : Fin n).val + 1 < n) from hk1), hf1] - -- The vertex list is injective on `{0, …, n}`: `f` is, and the parameters are increasing. - have hvfinj : ∀ i < n + 1, ∀ j < n + 1, vf i = vf j → i = j := by - have hkey : ∀ i < n, ∀ j < n, vf i = vf j → i = j := by -diff --git a/Schoenflies/PolyLocal.lean b/Schoenflies/PolyLocal.lean ---- a/Schoenflies/PolyLocal.lean -+++ b/Schoenflies/PolyLocal.lean -@@ -277,7 +277,7 @@ - rintro c ⟨hcQ, hcne⟩ - have : p ∉ closedSquare c (ρ c) := - Set.disjoint_left.1 (hdisj c₀ hc₀Q c hcQ fun h => hcne (h ▸ rfl)) hpc₀ -- simp only [closedSquare, mem_setOf_eq, not_le] at this -+ simp only [closedSquare, mem_ofPred_eq, not_le] at this - linarith - obtain ⟨s, hs, hsle⟩ := exists_pos_le_of_finite (hQ.sdiff (t := {c₀})) - (f := fun c => supDist p c - ρ c) hfar -@@ -298,7 +298,7 @@ - have hfar : ∀ c ∈ Q, 0 < supDist p c - ρ c := by - intro c hcQ - have := hnear c hcQ -- simp only [closedSquare, mem_setOf_eq, not_le] at this -+ simp only [closedSquare, mem_ofPred_eq, not_le] at this - linarith - obtain ⟨s, hs, hsle⟩ := exists_pos_le_of_finite hQ (f := fun c => supDist p c - ρ c) hfar - refine isLocallyPolyConnAt'_of_nbhd_subset (isOpen_openSquare p s) (mem_openSquare_self hs) -diff --git a/Schoenflies/PrePolygonArc.lean b/Schoenflies/PrePolygonArc.lean ---- a/Schoenflies/PrePolygonArc.lean -+++ b/Schoenflies/PrePolygonArc.lean -@@ -623,13 +623,13 @@ - have hlt : j.val < m + 3 := ZMod.val_lt j - have hval : (emb j).val = j.val := by - rw [emb, ZMod.val_cast_of_lt (by omega)] -- rw [insVertex, if_pos (by rw [hval]; exact hlt), hval, ZMod.natCast_rightInverse j] -+ rw [insVertex, ite_eq_left (by rw [hval]; exact hlt), hval, ZMod.natCast_rightInverse j] - - theorem val_neg_one' : (-1 : ZMod (m + 1 + 3)).val = m + 3 := by - rw [neg_one_eq_cast, ZMod.val_cast_of_lt (by omega)] - - theorem insVertex_neg_one (P : PrePolygon m) (z : Plane) : insVertex P z (-1) = z := by -- rw [insVertex, if_neg (by rw [val_neg_one' (m := m)]; omega)] -+ rw [insVertex, ite_eq_right (by rw [val_neg_one' (m := m)]; omega)] - - /-- Away from the inserted vertex the edges are unchanged. -/ - theorem insEdge_of_lt {j : ZMod (m + 3)} (h : j.val + 1 < m + 3) : -@@ -688,12 +688,12 @@ - have hi := ZMod.val_lt i - have hj := ZMod.val_lt j - by_cases hli : i.val < m + 3 <;> by_cases hlj : j.val < m + 3 -- · rw [if_pos hli, if_pos hlj] at hij -+ · rw [ite_eq_left hli, ite_eq_left hlj] at hij - exact ZMod.val_injective _ - (ClosedPolygon.natCast_inj hli hlj (P.vertex_inj hij)) -- · rw [if_pos hli, if_neg hlj] at hij -+ · rw [ite_eq_left hli, ite_eq_right hlj] at hij - exact absurd hij (hzv _) -- · rw [if_neg hli, if_pos hlj] at hij -+ · rw [ite_eq_right hli, ite_eq_left hlj] at hij - exact absurd hij.symm (hzv _) - · exact ZMod.val_injective _ (by omega) - edges_meet := by -diff --git a/Schoenflies/QuantitativeForwardStages.lean b/Schoenflies/QuantitativeForwardStages.lean ---- a/Schoenflies/QuantitativeForwardStages.lean -+++ b/Schoenflies/QuantitativeForwardStages.lean -@@ -34,8 +34,8 @@ - rw [Plane.closedSquare_eq_inter] at hclosed - have hopen := hz.2 - rw [Plane.openSquare_eq_inter] at hopen -- simp only [Set.mem_inter_iff, Set.mem_setOf_eq] at hclosed -- simp only [Set.mem_inter_iff, Set.mem_setOf_eq, not_and_or, not_lt] at hopen -+ simp only [Set.mem_inter_iff, Set.mem_ofPred_eq] at hclosed -+ simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, not_and_or, not_lt] at hopen - rcases hopen with hX | hY - · rcases hX with hleft | hright - · exact mem_cover_of_coord_eq hs hk (Nat.zero_le k) hz.1 (by -diff --git a/Schoenflies/QuantitativeRecursion.lean b/Schoenflies/QuantitativeRecursion.lean ---- a/Schoenflies/QuantitativeRecursion.lean -+++ b/Schoenflies/QuantitativeRecursion.lean -@@ -191,7 +191,7 @@ - - theorem denseQuantitativeSchedule_centresDense (hC : IsSeparating C) : - (denseQuantitativeSchedule hC).CentresDense := by -- letI : Nonempty (inside C) := hC.isConnected_inside.nonempty.to_subtype -+ let : Nonempty (inside C) := hC.isConnected_inside.nonempty.to_subtype - intro x hx δ hδ - obtain ⟨k, hk⟩ := - (TopologicalSpace.denseRange_denseSeq (inside C)).exists_dist_lt -diff --git a/Schoenflies/Realization.lean b/Schoenflies/Realization.lean ---- a/Schoenflies/Realization.lean -+++ b/Schoenflies/Realization.lean -@@ -876,7 +876,7 @@ - /-- The successor in `ZMod n`, read as a numeral below `n`. -/ - theorem zmod_val_succ {n : ℕ} (hn : 1 < n) (j : ZMod n) : - (j + 1).val = if j.val + 1 < n then j.val + 1 else 0 := by -- haveI : NeZero n := ⟨by omega⟩ -+ have : NeZero n := ⟨by omega⟩ - have h1 : (1 : ZMod n).val = 1 := by - rw [show (1 : ZMod n) = ((1 : ℕ) : ZMod n) by norm_num] - exact ZMod.val_cast_of_lt hn -@@ -1084,27 +1084,27 @@ - · exfalso - have hcond : ¬ ((⟨0, hn0⟩ : Fin n) : ℕ) + 1 < n := - fun hc => absurd (lt_of_le_of_lt (Nat.le_add_left 1 _) hc) (by omega) -- have hnx0 : nx ⟨0, hn0⟩ = 1 := by rw [hnx, parNext, dif_neg hcond] -+ have hnx0 : nx ⟨0, hn0⟩ = 1 := by rw [hnx, parNext, dite_eq_right hcond] - exact hfne ⟨0, hn0⟩ (by rw [htp0, hnx0]; exact hf.closes) - · exact hge -- haveI : NeZero n := ⟨by omega⟩ -+ have : NeZero n := ⟨by omega⟩ - -- The cyclic vertex list: the ends, in the order the loop reaches them. - set w : ZMod n → Plane := fun j => f (tp ⟨j.val, ZMod.val_lt j⟩) with hw - have hwsucc : ∀ j : ZMod n, w (j + 1) = f (nx ⟨j.val, ZMod.val_lt j⟩) := by - intro j - have hjlt := ZMod.val_lt j - by_cases hj : j.val + 1 < n -- · have hval : (j + 1).val = j.val + 1 := by rw [zmod_val_succ (by omega) j, if_pos hj] -+ · have hval : (j + 1).val = j.val + 1 := by rw [zmod_val_succ (by omega) j, ite_eq_left hj] - have hfin : (⟨(j + 1).val, ZMod.val_lt (j + 1)⟩ : Fin n) = ⟨j.val + 1, hj⟩ := - Fin.val_injective hval - simp only [hw, hfin] -- rw [hnx, parNext, dif_pos (show (⟨j.val, hjlt⟩ : Fin n).val + 1 < n from hj)] -+ rw [hnx, parNext, dite_eq_left (show (⟨j.val, hjlt⟩ : Fin n).val + 1 < n from hj)] - rfl -- · have hval : (j + 1).val = 0 := by rw [zmod_val_succ (by omega) j, if_neg hj] -+ · have hval : (j + 1).val = 0 := by rw [zmod_val_succ (by omega) j, ite_eq_right hj] - have hfin : (⟨(j + 1).val, ZMod.val_lt (j + 1)⟩ : Fin n) = ⟨0, hn0⟩ := - Fin.val_injective hval - simp only [hw, hfin] -- rw [htp0, hnx, parNext, dif_neg (show ¬ ((⟨j.val, hjlt⟩ : Fin n).val + 1 < n) from hj)] -+ rw [htp0, hnx, parNext, dite_eq_right (show ¬ ((⟨j.val, hjlt⟩ : Fin n).val + 1 < n) from hj)] - exact hf.closes - have hedgeq : ∀ j : ZMod n, - segment ℝ (w j) (w (j + 1)) = (pc ⟨j.val, ZMod.val_lt j⟩).seg := by -@@ -1141,7 +1141,7 @@ - omega - have hsucc1 : (1 : ZMod n) + 1 = 0 := by - refine ZMod.val_injective _ ?_ -- rw [zmod_val_succ (by omega) 1, hone, if_neg (by omega), ZMod.val_zero] -+ rw [zmod_val_succ (by omega) 1, hone, ite_eq_right (by omega), ZMod.val_zero] - have hw01 : w 0 ≠ w 1 := fun he => h01 (hwinj he) - obtain ⟨p, hp, hp1, hp2⟩ := PrePolygon.exists_mem_segment_ne hw01 - have hmem := hwmeet 0 1 h01 -diff --git a/Schoenflies/RealizeSplit.lean b/Schoenflies/RealizeSplit.lean ---- a/Schoenflies/RealizeSplit.lean -+++ b/Schoenflies/RealizeSplit.lean -@@ -501,11 +501,11 @@ - - theorem splitPos_of_mem_ear {z : γ} (hz : z ∈ V(d.ear)) : d.splitPos R earPos z = earPos z := by - classical -- simp only [splitPos, if_pos hz] -+ simp only [splitPos, ite_eq_left hz] - - theorem splitPos_of_notMem_ear {z : γ} (hz : z ∉ V(d.ear)) : d.splitPos R earPos z = R.pos z := by - classical -- simp only [splitPos, if_neg hz] -+ simp only [splitPos, ite_eq_right hz] - - theorem EarCrosscut.splitPos_eq (hE : d.EarCrosscut R earPos earDraw) {z : γ} - (hz : z ∈ V(S.skel)) : d.splitPos R earPos z = R.pos z := by -@@ -516,24 +516,24 @@ - theorem splitDrawing_of_mem_ear {f : γ} (hf : f ∈ E(d.ear)) : - d.splitDrawing R earDraw f = earDraw f := by - classical -- simp only [splitDrawing, if_pos hf] -+ simp only [splitDrawing, ite_eq_left hf] - - theorem splitDrawing_of_mem_skel {f : γ} (hf : f ∈ E(S.skel)) : - d.splitDrawing R earDraw f = R.drawing f := by - classical -- simp only [splitDrawing, if_neg (Set.disjoint_left.1 d.disjoint_edgeSet hf)] -+ simp only [splitDrawing, ite_eq_right (Set.disjoint_left.1 d.disjoint_edgeSet hf)] - - theorem splitCell_face₁ : d.splitCell R earPos earDraw d.face₁ = - inside (R.cellUnion d.cells₁ ∪ d.earSet earPos earDraw) := by - classical - unfold splitCell -- rw [if_pos rfl] -+ rw [ite_eq_left rfl] - - theorem splitCell_face₂ : d.splitCell R earPos earDraw d.face₂ = - inside (R.cellUnion d.cells₂ ∪ d.earSet earPos earDraw) := by - classical - unfold splitCell -- rw [if_neg (Ne.symm d.face_ne), if_pos rfl] -+ rw [ite_eq_right (Ne.symm d.face_ne), ite_eq_left rfl] - - theorem splitCell_of_mem_cells {σ : γ} (hσ : σ ∈ S.cells) : - d.splitCell R earPos earDraw σ = R.cell σ := by -@@ -546,7 +546,7 @@ - exacts [hnv d.source_mem_skel, hnv d.target_mem_skel] - have h₄ : σ ∉ E(d.ear) := fun h => d.edge_fresh h hσ - unfold splitCell -- rw [if_neg h₁, if_neg h₂, if_neg h₃, if_neg h₄] -+ rw [ite_eq_right h₁, ite_eq_right h₂, ite_eq_right h₃, ite_eq_right h₄] - - theorem EarCrosscut.splitCell_earVertex (hE : d.EarCrosscut R earPos earDraw) {z : γ} - (hz : z ∈ V(d.ear)) : d.splitCell R earPos earDraw z = {earPos z} := by -@@ -557,7 +557,9 @@ - · have h₁ : z ≠ d.face₁ := by rintro rfl; exact d.face₁_notMem_ear (Or.inl hz) - have h₂ : z ≠ d.face₂ := by rintro rfl; exact d.face₂_notMem_ear (Or.inl hz) - unfold splitCell -- rw [if_neg h₁, if_neg h₂, if_pos (show z ∈ V(d.ear) ∧ z ∉ V(S.skel) from ⟨hz, hz'⟩)] -+ rw [ite_eq_right h₁, -+ ite_eq_right h₂, -+ ite_eq_left (show z ∈ V(d.ear) ∧ z ∉ V(S.skel) from ⟨hz, hz'⟩)] - - theorem splitCell_earEdge {f : γ} (hf : f ∈ E(d.ear)) : - d.splitCell R earPos earDraw f = Graph.edgeArc earDraw f \ earPos '' V(d.ear) := by -@@ -567,7 +569,7 @@ - have h₃ : ¬ (f ∈ V(d.ear) ∧ f ∉ V(S.skel)) := fun h => - Set.disjoint_left.1 d.ear_disjoint h.1 hf - unfold splitCell -- rw [if_neg h₁, if_neg h₂, if_neg h₃, if_pos hf] -+ rw [ite_eq_right h₁, ite_eq_right h₂, ite_eq_right h₃, ite_eq_left hf] - - theorem edgeArc_splitDrawing_of_mem_skel {f : γ} (hf : f ∈ E(S.skel)) : - Graph.edgeArc (d.splitDrawing R earDraw) f = Graph.edgeArc R.drawing f := by -diff --git a/Schoenflies/RealizeSubdiv.lean b/Schoenflies/RealizeSubdiv.lean ---- a/Schoenflies/RealizeSubdiv.lean -+++ b/Schoenflies/RealizeSubdiv.lean -@@ -309,7 +309,7 @@ - R.drawing d.edge (d.rightParam R) = R.pos d.right := by - have hd := R.isDrawing.edge_param (d.edge_mem_edgeSet_graph R) - rcases (d.isLink_drawn_edge R).eq_and_eq_or_eq_and_eq hd.2.2 with ⟨h0, h1⟩ | ⟨h0, h1⟩ -- · have hL : d.leftParam R = 0 := if_pos h0.symm -+ · have hL : d.leftParam R = 0 := ite_eq_left h0.symm - refine ⟨by rw [hL]; exact h0.symm, ?_⟩ - have hR : d.rightParam R = 1 := by rw [rightParam, hL]; ring - rw [hR]; exact h1.symm -@@ -317,7 +317,7 @@ - -- endpoint values, which injectivity forbids. - have hne : ¬ (R.drawing d.edge 0 = R.pos d.left) := fun hcon => - zero_ne_one (hd.2.1 zero_mem_I one_mem_I (by rw [hcon, h0])) -- have hL : d.leftParam R = 1 := if_neg hne -+ have hL : d.leftParam R = 1 := ite_eq_right hne - refine ⟨by rw [hL]; exact h0.symm, ?_⟩ - have hR : d.rightParam R = 0 := by rw [rightParam, hL]; ring - rw [hR]; exact h1.symm -@@ -458,9 +458,10 @@ - variable {d R} - - @[simp] theorem realizePos_newVertex : d.realizePos R t d.newVertex = R.drawing d.edge t := -- if_pos rfl -- --theorem realizePos_of_ne {z : γ} (h : z ≠ d.newVertex) : d.realizePos R t z = R.pos z := if_neg h -+ ite_eq_left rfl -+ -+theorem realizePos_of_ne {z : γ} (h : z ≠ d.newVertex) : d.realizePos R t z = R.pos z := -+ ite_eq_right h - - theorem realizePos_of_mem_cells {z : γ} (h : z ∈ S.cells) : d.realizePos R t z = R.pos z := - realizePos_of_ne (d.ne_newVertex_of_mem_cells h) -@@ -469,33 +470,38 @@ - realizePos_of_mem_cells (S.mem_cells_of_mem_vertexSet h) - - @[simp] theorem realizeDrawing_newEdge₁ : -- d.realizeDrawing R t d.newEdge₁ = subarc (R.drawing d.edge) (d.leftParam R) t := if_pos rfl -+ d.realizeDrawing R t d.newEdge₁ = subarc (R.drawing d.edge) (d.leftParam R) t := ite_eq_left rfl - - @[simp] theorem realizeDrawing_newEdge₂ : - d.realizeDrawing R t d.newEdge₂ = subarc (R.drawing d.edge) t (d.rightParam R) := by -- rw [realizeDrawing, if_neg d.newEdge_ne.symm, if_pos rfl] -+ rw [realizeDrawing, ite_eq_right d.newEdge_ne.symm, ite_eq_left rfl] - - theorem realizeDrawing_of_ne {f : γ} (h₁ : f ≠ d.newEdge₁) (h₂ : f ≠ d.newEdge₂) : -- d.realizeDrawing R t f = R.drawing f := by rw [realizeDrawing, if_neg h₁, if_neg h₂] -+ d.realizeDrawing R t f = R.drawing f := by rw [realizeDrawing, ite_eq_right h₁, ite_eq_right h₂] - - theorem realizeDrawing_of_mem_cells {f : γ} (h : f ∈ S.cells) : - d.realizeDrawing R t f = R.drawing f := - realizeDrawing_of_ne (d.ne_newEdge₁_of_mem_cells h) (d.ne_newEdge₂_of_mem_cells h) - - @[simp] theorem realizeCell_newVertex : d.realizeCell R t d.newVertex = {R.drawing d.edge t} := -- if_pos rfl -+ ite_eq_left rfl - - @[simp] theorem realizeCell_newEdge₁ : d.realizeCell R t d.newEdge₁ = - R.drawing d.edge '' uIcc (d.leftParam R) t \ {R.pos d.left, R.drawing d.edge t} := by -- rw [realizeCell, if_neg d.newVertex_ne₁.symm, if_pos rfl] -+ rw [realizeCell, ite_eq_right d.newVertex_ne₁.symm, ite_eq_left rfl] - - @[simp] theorem realizeCell_newEdge₂ : d.realizeCell R t d.newEdge₂ = - R.drawing d.edge '' uIcc t (d.rightParam R) \ {R.drawing d.edge t, R.pos d.right} := by -- rw [realizeCell, if_neg d.newVertex_ne₂.symm, if_neg d.newEdge_ne.symm, if_pos rfl] -+ rw [realizeCell, -+ ite_eq_right d.newVertex_ne₂.symm, -+ ite_eq_right d.newEdge_ne.symm, -+ ite_eq_left rfl] - - theorem realizeCell_of_mem_cells {c : γ} (h : c ∈ S.cells) : d.realizeCell R t c = R.cell c := by -- rw [realizeCell, if_neg (d.ne_newVertex_of_mem_cells h), if_neg (d.ne_newEdge₁_of_mem_cells h), -- if_neg (d.ne_newEdge₂_of_mem_cells h)] -+ rw [realizeCell, -+ ite_eq_right (d.ne_newVertex_of_mem_cells h), -+ ite_eq_right (d.ne_newEdge₁_of_mem_cells h), -+ ite_eq_right (d.ne_newEdge₂_of_mem_cells h)] - - /-! ### The two half arcs -/ - -diff --git a/Schoenflies/RefinementStars.lean b/Schoenflies/RefinementStars.lean ---- a/Schoenflies/RefinementStars.lean -+++ b/Schoenflies/RefinementStars.lean -@@ -132,7 +132,7 @@ - theorem carrier_spec [Nonempty γ] (R : S.Realization) (x : Plane) - (h : ∃ σ, σ ∈ S.cells ∧ x ∈ R.cell σ) : - R.carrier x ∈ S.cells ∧ x ∈ R.cell (R.carrier x) := by -- rw [carrier, dif_pos h] -+ rw [carrier, dite_eq_left h] - exact h.choose_spec - - namespace IsCellDecomposition -diff --git a/Schoenflies/SimpleArc.lean b/Schoenflies/SimpleArc.lean ---- a/Schoenflies/SimpleArc.lean -+++ b/Schoenflies/SimpleArc.lean -@@ -146,14 +146,14 @@ - · -- A repeated vertex contributes the point `u`, which the rest of the chain already - -- holds. - subst huv -- rw [if_pos rfl, segment_same] -+ rw [ite_eq_left rfl, segment_same] - have hmem : u ∈ poly (u :: rest) := mem_poly_of_mem (List.mem_cons_self ..) - rcases ih with h | ⟨h1, h2⟩ - · exact Or.inl (by rw [h, union_eq_self_of_subset_left (singleton_subset_iff.2 hmem)]) - · refine Or.inr ⟨h1, ?_⟩ - rw [union_eq_self_of_subset_left (singleton_subset_iff.2 hmem)] - exact h2 -- · rw [if_neg huv, cover_cons] -+ · rw [ite_eq_right huv, cover_cons] - refine Or.inl ?_ - rcases ih with h | ⟨h1, h2⟩ - · rw [h]; rfl -@@ -284,7 +284,7 @@ - -- And they carry disjoint sets: a common point is a vertex incident with an edge of each. - have hdisj : ∀ z, z ∈ S → z ∈ T → False := by - intro z hzS hzT -- simp only [hS, hT, mem_iUnion, mem_setOf_eq, exists_prop] at hzS hzT -+ simp only [hS, hT, mem_iUnion, mem_ofPred_eq, exists_prop] at hzS hzT - obtain ⟨P, ⟨hP, hPr⟩, hzP⟩ := hzS - obtain ⟨Q, ⟨hQ, hQr⟩, hzQ⟩ := hzT - have hPQ : P ≠ Q := by rintro rfl; exact hQr hPr -@@ -315,7 +315,7 @@ - hsub ⟨a, ha, fun h => hdisj a haS h⟩ ⟨b, hb, fun h => hdisj b h hbT⟩ - exact (hunion z hzc).elim hzS hzT - -- `b` is a vertex on an edge of the reachable class, hence an end of it. -- simp only [hS, mem_iUnion, mem_setOf_eq, exists_prop] at hbS -+ simp only [hS, mem_iUnion, mem_ofPred_eq, exists_prop] at hbS - obtain ⟨P, ⟨hP, hPr⟩, hbP⟩ := hbS - have hbend : b = P.1 ∨ b = P.2 := - hdraw.vertex_mem_edgeArc (hlink P hP) hbV (by rwa [edgeArc_segmentDrawing]) -diff --git a/Schoenflies/SkeletonAccess.lean b/Schoenflies/SkeletonAccess.lean ---- a/Schoenflies/SkeletonAccess.lean -+++ b/Schoenflies/SkeletonAccess.lean -@@ -648,8 +648,8 @@ - frontier (Plane.openSquare c s) ⊆ Plane.closedSquare c s \ Plane.openSquare c s := by - have hsub : Plane.openSquare c s ⊆ Plane.closedSquare c s := by - intro w hw -- simp only [Plane.openSquare, mem_setOf_eq] at hw -- simp only [Plane.closedSquare, mem_setOf_eq] -+ simp only [Plane.openSquare, mem_ofPred_eq] at hw -+ simp only [Plane.closedSquare, mem_ofPred_eq] - exact hw.le - rw [(Plane.isOpen_openSquare c s).frontier_eq] - exact Set.sdiff_subset_sdiff_left -diff --git a/Schoenflies/SkeletonLocal.lean b/Schoenflies/SkeletonLocal.lean ---- a/Schoenflies/SkeletonLocal.lean -+++ b/Schoenflies/SkeletonLocal.lean -@@ -213,9 +213,9 @@ - · exact one_pos - · exact dist_pos.2 (Ne.symm h) - · intro h1 -- exact le_trans (min_le_left _ _) (le_of_eq (if_neg h1)) -+ exact le_trans (min_le_left _ _) (le_of_eq (ite_eq_right h1)) - · intro h2 -- exact le_trans (min_le_right _ _) (le_of_eq (if_neg h2)) -+ exact le_trans (min_le_right _ _) (le_of_eq (ite_eq_right h2)) - · -- A piece missing `x` is a compact set at positive distance from `x`. - obtain ⟨ρ, hρ, hd⟩ := Plane.exists_dist_pos isCompact_singleton (isCompact_segment P.1 P.2) - (Set.disjoint_singleton_left.2 hx) -@@ -453,7 +453,7 @@ - theorem IsLocalRadius.ball_diff_eq_cone (h : IsLocalRadius S x r) : - ball x r \ S = Plane.cone x {u | u ≠ 0 ∧ Plane.dir u ∉ localDirs S x} r := by - ext z -- simp only [Set.mem_sdiff, mem_ball, Plane.mem_cone_iff, mem_setOf_eq, sub_ne_zero] -+ simp only [Set.mem_sdiff, mem_ball, Plane.mem_cone_iff, mem_ofPred_eq, sub_ne_zero] - constructor - · rintro ⟨hzb, hzS⟩ - have hiff := h.2 z hzb.le -diff --git a/Schoenflies/SkeletonSectors.lean b/Schoenflies/SkeletonSectors.lean ---- a/Schoenflies/SkeletonSectors.lean -+++ b/Schoenflies/SkeletonSectors.lean -@@ -178,19 +178,19 @@ - counterclockwise from `u` to `w` exactly when `w` lies on the arc counterclockwise from `d` to - `u`. -/ - theorem mem_arcCCW_rotate : d ∈ arcCCW u w ↔ w ∈ arcCCW d u := by -- simp only [arcCCW, mem_setOf_eq] -+ simp only [arcCCW, mem_ofPred_eq] - tauto - - /-- A bounding ray is not on its own arc. -/ - theorem left_notMem_arcCCW (u w : Plane) : u ∉ arcCCW u w := by - have h : det w u = -det u w := det_comm w u -- simp only [arcCCW, mem_setOf_eq, det_self, h] -+ simp only [arcCCW, mem_ofPred_eq, det_self, h] - rintro (⟨h1, _⟩ | ⟨h1, h2⟩ | ⟨_, h2⟩) <;> linarith - - /-- The other bounding ray is not on the arc either. -/ - theorem right_notMem_arcCCW (u w : Plane) : w ∉ arcCCW u w := by - have h : det w u = -det u w := det_comm w u -- simp only [arcCCW, mem_setOf_eq, det_self, h] -+ simp only [arcCCW, mem_ofPred_eq, det_self, h] - rintro (⟨_, h2⟩ | ⟨h1, _⟩ | ⟨_, h2⟩) <;> linarith - - /-- **Asymmetry.** Transposing the first two entries of the triple negates the cyclic order: -@@ -200,7 +200,7 @@ - have e1 : det v u = -det u v := det_comm v u - have e2 : det u w = -det w u := det_comm u w - have e3 : det w v = -det v w := det_comm w v -- simp only [arcCCW, mem_setOf_eq] at h ⊢ -+ simp only [arcCCW, mem_ofPred_eq] at h ⊢ - rw [e1, e3] - rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> - rintro (⟨g1, g2⟩ | ⟨g1, g2⟩ | ⟨g1, g2⟩) <;> linarith -@@ -268,7 +268,7 @@ - transitive: if `w` comes before `v` and `v` before `d`, then `w` comes before `d`. This is what - makes a finite set of directions linearly ordered once a ray to cut at has been chosen. -/ - theorem arcCCW_trans (h₁ : w ∈ arcCCW u v) (h₂ : v ∈ arcCCW u d) : w ∈ arcCCW u d := by -- simp only [arcCCW, mem_setOf_eq] at h₁ h₂ ⊢ -+ simp only [arcCCW, mem_ofPred_eq] at h₁ h₂ ⊢ - have hv : det u v = -det v u := det_comm u v - rw [hv] at h₂ - exact trans_aux₁ (grassmann u w v d) h₁ h₂ -@@ -278,7 +278,7 @@ - counterclockwise from `w` to `d`. This is the step that turns "nothing of the finite set lies - between `u` and the extreme rays" into "nothing lies inside the sector". -/ - theorem arcCCW_trans' (h₁ : w ∈ arcCCW u v) (h₂ : v ∈ arcCCW u d) : v ∈ arcCCW w d := by -- simp only [arcCCW, mem_setOf_eq] at h₁ h₂ ⊢ -+ simp only [arcCCW, mem_ofPred_eq] at h₁ h₂ ⊢ - have hv : det u v = -det v u := det_comm u v - have hd : det d w = -det w d := det_comm d w - rw [hv] at h₂ -@@ -401,7 +401,7 @@ - ring - rw [he, mul_comm, mul_assoc] - exact mul_pos (inv_pos.2 hupos) (mul_self_pos.2 hne) -- simp only [arcCCW, mem_setOf_eq] -+ simp only [arcCCW, mem_ofPred_eq] - rw [hAB, hCB, hWV] - rcases key with h | h - · exact Or.inl h -@@ -446,7 +446,7 @@ - intro v; rw [hsm, det_smul_right, det_comm v u]; ring - have e2 : det (-u) u = 0 := by rw [hsm, det_smul_left, det_self, mul_zero] - ext v -- simp only [arcCCW, mem_setOf_eq, e1, e2] -+ simp only [arcCCW, mem_ofPred_eq, e1, e2] - constructor - · rintro (⟨h, _⟩ | ⟨_, h⟩ | ⟨h, _⟩) <;> linarith - · exact fun h => Or.inl ⟨h, h⟩ -@@ -461,7 +461,7 @@ - have hhalf : (0 : ℝ) < ρ / 2 := by linarith - refine ⟨⟨(ρ / 2) • perp u, ?_, ?_⟩, - ((convex_det_right_pos u).inter (convex_ball _ _)).isPreconnected⟩ -- · simp only [mem_setOf_eq, det_smul_right, det_perp_self, hu.norm, one_pow, mul_one] -+ · simp only [mem_ofPred_eq, det_smul_right, det_perp_self, hu.norm, one_pow, mul_one] - exact hhalf - · rw [mem_ball, dist_zero_right, norm_smul, Real.norm_eq_abs, norm_perp, hu.norm, mul_one, - abs_of_pos hhalf] -@@ -558,8 +558,8 @@ - rw [hwd, neg_neg] at hne - rw [hwd] - exact hne -- rw [harc, mem_setOf_eq, not_lt] at h -- rw [harc', mem_setOf_eq, hwd] -+ rw [harc, mem_ofPred_eq, not_lt] at h -+ rw [harc', mem_ofPred_eq, hwd] - have hdz : det d z ≠ 0 := by - intro hzero - rcases eq_dir_or_eq_neg_dir hd.ne_zero hz hzero with h1 | h1 -@@ -980,11 +980,11 @@ - (hs₂ : segment ℝ x (x + r • d₂) ⊆ edgeArc drawing e) - (hs₃ : segment ℝ x (x + r • d₃) ⊆ edgeArc drawing e) : False := by - obtain ⟨hcont, hinj, -⟩ := h.edge_param he -- haveI : CompactSpace ↥(I : Set ℝ) := isCompact_iff_compactSpace.1 isCompact_I -- set φ : ↥(I : Set ℝ) → Plane := Set.restrict I (drawing e) with hφdef -+ have : CompactSpace ↥(I : Set ℝ) := isCompact_iff_compactSpace.1 isCompact_I -+ set φ : ↥(I : Set ℝ) → Plane := Set.domRestrict I (drawing e) with hφdef - have hφi : Function.Injective φ := Set.injOn_iff_injective.1 hinj -- have hcm : IsClosedMap φ := (hcont.restrict).isClosedMap -- have hrange : Set.range φ = edgeArc drawing e := Set.range_restrict _ _ -+ have hcm : IsClosedMap φ := (hcont.domRestrict).isClosedMap -+ have hrange : Set.range φ = edgeArc drawing e := Set.range_domRestrict _ _ - -- The preimage of a radial segment is a connected set of parameters. - have hpre : ∀ dd : Plane, segment ℝ x (x + r • dd) ⊆ edgeArc drawing e → - IsPreconnected (Subtype.val '' (φ ⁻¹' segment ℝ x (x + r • dd))) := by -diff --git a/Schoenflies/SourceAttachment.lean b/Schoenflies/SourceAttachment.lean ---- a/Schoenflies/SourceAttachment.lean -+++ b/Schoenflies/SourceAttachment.lean -@@ -29,7 +29,7 @@ - - namespace Schoenflies - --open Graph -+open _root_.Schoenflies.Graph - - variable {γ : Type*} {S₀ : CellStructure γ} - {srcOuter srcDom tgtOuter tgtDom : Set Plane} -@@ -312,7 +312,7 @@ - V(Q.crosscutOverlay J p s epsilon extra) := by - intro x hx - rw [localGrid_eq, pieceListGraph_vertexSet] at hx -- simp only [endSet, Set.mem_setOf_eq] at hx -+ simp only [endSet, Set.mem_ofPred_eq] at hx - obtain ⟨R, hR, hxR⟩ := hx - change x ∈ V(overlayGraph (Q.crosscutPieces J p s epsilon) - (attachPoints (Q.crosscutPieces J p s epsilon) -@@ -630,7 +630,7 @@ - w.drawing e = - (Q.crosscutOverlay J p s epsilon extra).relabelDrawing - w.name segmentDrawing e := by -- rw [drawing, if_neg] -+ rw [drawing, ite_eq_right] - obtain ⟨R, hR, rfl⟩ := he - exact fun heOuter => w.name_fresh R hR - (P.str.mem_cells_of_mem_edgeSet (P.str.outerGraph_le.edgeSet_mono heOuter)) -@@ -1071,7 +1071,7 @@ - vertexSet_subset := by - intro x hx - rw [pieceListGraph_vertexSet] at hx -- simp only [endSet, Set.mem_setOf_eq] at hx -+ simp only [endSet, Set.mem_ofPred_eq] at hx - obtain ⟨R, hR, hxR⟩ := hx - simp only [List.mem_singleton] at hR - subst R -diff --git a/Schoenflies/SourceJoining.lean b/Schoenflies/SourceJoining.lean ---- a/Schoenflies/SourceJoining.lean -+++ b/Schoenflies/SourceJoining.lean -@@ -24,7 +24,7 @@ - - namespace Schoenflies - --open Graph -+open _root_.Schoenflies.Graph - - variable {γ : Type*} {S₀ : CellStructure γ} - {srcOuter srcDom tgtOuter tgtDom : Set Plane} -@@ -92,10 +92,10 @@ - | v :: rest => - rw [segsOf_cons_cons] - by_cases huv : u = v -- · rw [if_pos huv] -+ · rw [ite_eq_left huv] - subst u - exact ih (List.cons_ne_nil v rest) hne -- · rw [if_neg huv] -+ · rw [ite_eq_right huv] - constructor - · exact ⟨(u, v), List.mem_cons_self, Or.inl rfl⟩ - · by_cases hvlast : v = (v :: rest).getLast (List.cons_ne_nil v rest) -@@ -299,7 +299,7 @@ - u.drawing e = - (Q.joinedCrosscutOverlay J p s epsilon extra joins).relabelDrawing - u.name segmentDrawing e := by -- rw [drawing, if_neg] -+ rw [drawing, ite_eq_right] - obtain ⟨R, hR, rfl⟩ := he - exact fun heOuter => u.name_fresh R hR - (P.str.mem_cells_of_mem_edgeSet (P.str.outerGraph_le.edgeSet_mono heOuter)) -@@ -636,8 +636,8 @@ - _root_.Graph.edgesCover u.drawing D = cover joins := by - let T := _root_.Graph.traceGraph u.graph u.drawing (cover joins) - have hTle : T ≤ u.graph := _root_.Graph.traceGraph_le _ -- letI : u.graph.Finite := u.graph_finite -- letI : T.Finite := _root_.Graph.Finite.of_le hTle -+ let : u.graph.Finite := u.graph_finite -+ let : T.Finite := _root_.Graph.Finite.of_le hTle - have hpoint : _root_.Graph.pointSet T u.drawing = cover joins := - u.joinTrace_pointSet hs hJ hJgeom hwindow hjoins hjoinsOpen - have hxGraph : x ∈ V(u.graph) := u.joinEnds_subset_graph hs hJ hjoins hxEnd -diff --git a/Schoenflies/SourceOverlay.lean b/Schoenflies/SourceOverlay.lean ---- a/Schoenflies/SourceOverlay.lean -+++ b/Schoenflies/SourceOverlay.lean -@@ -314,7 +314,7 @@ - V(Q.localOverlay p s epsilon extra) := by - intro x hx - rw [localGrid_eq, pieceListGraph_vertexSet] at hx -- simp only [endSet, Set.mem_setOf_eq] at hx -+ simp only [endSet, Set.mem_ofPred_eq] at hx - obtain ⟨R, hR, hxR⟩ := hx - change x ∈ V(overlayGraph (Q.localPieces p s epsilon) - (attachPoints (Q.localPieces p s epsilon) -@@ -478,7 +478,7 @@ - have hxmono := (localGridX_strictMono (p := p) hs hk).monotone - have hymono := (localGridY_strictMono (p := p) hs hk).monotone - rw [Plane.closedSquare_eq_inter] -- simp only [Set.mem_inter_iff, Set.mem_setOf_eq, gridPt] -+ simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, gridPt] - constructor - · constructor - · calc -@@ -668,7 +668,7 @@ - theorem drawing_of_inner {e : γ} (he : e ∈ E(w.innerGraph)) : - w.drawing e = - (Q.localOverlay p s epsilon extra).relabelDrawing w.name segmentDrawing e := by -- rw [drawing, if_neg] -+ rw [drawing, ite_eq_right] - obtain ⟨R, hR, rfl⟩ := he - exact fun heOuter => w.name_fresh R hR - (P.str.mem_cells_of_mem_edgeSet (P.str.outerGraph_le.edgeSet_mono heOuter)) -diff --git a/Schoenflies/Square.lean b/Schoenflies/Square.lean ---- a/Schoenflies/Square.lean -+++ b/Schoenflies/Square.lean -@@ -116,21 +116,21 @@ - - theorem convex_coord_le (i : Fin 2) (r : ℝ) : Convex ℝ {x : Plane | x i ≤ r} := by - intro x hx y hy a b ha hb hab -- simp only [mem_setOf_eq] at * -+ simp only [mem_ofPred_eq] at * - rw [smul_add_apply] - have hr : a * r + b * r = r := by rw [← add_mul, hab, one_mul] - nlinarith [mul_le_mul_of_nonneg_left hx ha, mul_le_mul_of_nonneg_left hy hb] - - theorem convex_coord_ge (i : Fin 2) (r : ℝ) : Convex ℝ {x : Plane | r ≤ x i} := by - intro x hx y hy a b ha hb hab -- simp only [mem_setOf_eq] at * -+ simp only [mem_ofPred_eq] at * - rw [smul_add_apply] - have hr : a * r + b * r = r := by rw [← add_mul, hab, one_mul] - nlinarith [mul_le_mul_of_nonneg_left hx ha, mul_le_mul_of_nonneg_left hy hb] - - theorem convex_coord_lt (i : Fin 2) (r : ℝ) : Convex ℝ {x : Plane | x i < r} := by - intro x hx y hy a b ha hb hab -- simp only [mem_setOf_eq] at * -+ simp only [mem_ofPred_eq] at * - rw [smul_add_apply] - have hr : a * r + b * r = r := by rw [← add_mul, hab, one_mul] - rcases eq_or_lt_of_le ha with rfl | ha' -@@ -140,7 +140,7 @@ - - theorem convex_coord_gt (i : Fin 2) (r : ℝ) : Convex ℝ {x : Plane | r < x i} := by - intro x hx y hy a b ha hb hab -- simp only [mem_setOf_eq] at * -+ simp only [mem_ofPred_eq] at * - rw [smul_add_apply] - have hr : a * r + b * r = r := by rw [← add_mul, hab, one_mul] - rcases eq_or_lt_of_le ha with rfl | ha' -@@ -167,7 +167,7 @@ - ({x : Plane | c 0 - r ≤ x 0} ∩ {x : Plane | x 0 ≤ c 0 + r}) ∩ - ({x : Plane | c 1 - r ≤ x 1} ∩ {x : Plane | x 1 ≤ c 1 + r}) := by - ext x -- simp only [closedSquare, supDist, supNorm, sub_apply, mem_setOf_eq, mem_inter_iff, -+ simp only [closedSquare, supDist, supNorm, sub_apply, mem_ofPred_eq, mem_inter_iff, - max_le_iff, abs_le] - constructor - · rintro ⟨⟨h1, h2⟩, h3, h4⟩; exact ⟨⟨by linarith, by linarith⟩, by linarith, by linarith⟩ -@@ -178,7 +178,7 @@ - ({x : Plane | c 0 - r < x 0} ∩ {x : Plane | x 0 < c 0 + r}) ∩ - ({x : Plane | c 1 - r < x 1} ∩ {x : Plane | x 1 < c 1 + r}) := by - ext x -- simp only [openSquare, supDist, supNorm, sub_apply, mem_setOf_eq, mem_inter_iff, -+ simp only [openSquare, supDist, supNorm, sub_apply, mem_ofPred_eq, mem_inter_iff, - max_lt_iff, abs_lt] - constructor - · rintro ⟨⟨h1, h2⟩, h3, h4⟩; exact ⟨⟨by linarith, by linarith⟩, by linarith, by linarith⟩ -@@ -223,7 +223,7 @@ - set B : Set Plane := {x : Plane | x 1 < -r} with hB - have hcover : beyondSquare r = R ∪ T ∪ L ∪ B := by - ext x -- simp only [beyondSquare, hR, hL, hT, hB, mem_setOf_eq, mem_union, lt_abs] -+ simp only [beyondSquare, hR, hL, hT, hB, mem_ofPred_eq, mem_union, lt_abs] - constructor - · rintro (h | h) <;> rcases h with h | h - · exact Or.inl (Or.inl (Or.inl h)) -diff --git a/Schoenflies/SquareCycle.lean b/Schoenflies/SquareCycle.lean ---- a/Schoenflies/SquareCycle.lean -+++ b/Schoenflies/SquareCycle.lean -@@ -650,7 +650,7 @@ - theorem sqCoord_top (hz : z ∈ segment ℝ (sqNE c r) (sqNW c r)) : - sqCoord c r z = dist (sqNE c r) z := by - classical -- rw [sqCoord, if_pos hz] -+ rw [sqCoord, ite_eq_left hz] - - theorem sqCoord_left (hr : 0 ≤ r) (hz : z ∈ segment ℝ (sqNW c r) (sqSW c r)) : - sqCoord c r z = 2 * r + dist (sqNW c r) z := by -@@ -658,8 +658,8 @@ - by_cases htop : z ∈ segment ℝ (sqNE c r) (sqNW c r) - · -- the shared corner, where the two formulas agree - obtain rfl := eq_sqNW_of_mem_top_left hr htop hz -- rw [sqCoord, if_pos htop, dist_sqNE_sqNW c hr, dist_self, add_zero] -- · rw [sqCoord, if_neg htop, if_pos hz] -+ rw [sqCoord, ite_eq_left htop, dist_sqNE_sqNW c hr, dist_self, add_zero] -+ · rw [sqCoord, ite_eq_right htop, ite_eq_left hz] - - theorem sqCoord_bottom (hr : 0 < r) (hz : z ∈ segment ℝ (sqSW c r) (sqSE c r)) : - sqCoord c r z = 4 * r + dist (sqSW c r) z := by -@@ -667,9 +667,9 @@ - have htop : z ∉ segment ℝ (sqNE c r) (sqNW c r) := notMem_top_of_mem_bottom hr hz - by_cases hleft : z ∈ segment ℝ (sqNW c r) (sqSW c r) - · obtain rfl := eq_sqSW_of_mem_left_bottom hr.le hleft hz -- rw [sqCoord, if_neg htop, if_pos hleft, dist_sqNW_sqSW c hr.le, dist_self, add_zero] -+ rw [sqCoord, ite_eq_right htop, ite_eq_left hleft, dist_sqNW_sqSW c hr.le, dist_self, add_zero] - ring -- · rw [sqCoord, if_neg htop, if_neg hleft, if_pos hz] -+ · rw [sqCoord, ite_eq_right htop, ite_eq_right hleft, ite_eq_left hz] - - theorem sqCoord_right (hr : 0 < r) (hz : z ∈ segment ℝ (sqSE c r) (sqNE c r)) - (hne : z ≠ sqNE c r) : sqCoord c r z = 6 * r + dist (sqSE c r) z := by -@@ -679,10 +679,13 @@ - have hleft : z ∉ segment ℝ (sqNW c r) (sqSW c r) := notMem_left_of_mem_right hr hz - by_cases hbot : z ∈ segment ℝ (sqSW c r) (sqSE c r) - · obtain rfl := eq_sqSE_of_mem_bottom_right hr.le hbot hz -- rw [sqCoord, if_neg htop, if_neg hleft, if_pos hbot, dist_sqSW_sqSE c hr.le, dist_self, -+ rw [sqCoord, -+ ite_eq_right htop, -+ ite_eq_right hleft, -+ ite_eq_left hbot, dist_sqSW_sqSE c hr.le, dist_self, - add_zero] - ring -- · rw [sqCoord, if_neg htop, if_neg hleft, if_neg hbot] -+ · rw [sqCoord, ite_eq_right htop, ite_eq_right hleft, ite_eq_right hbot] - - /-! ## Part 4: the overlay edges on one side - -diff --git a/Schoenflies/SquareMesh.lean b/Schoenflies/SquareMesh.lean ---- a/Schoenflies/SquareMesh.lean -+++ b/Schoenflies/SquareMesh.lean -@@ -110,7 +110,7 @@ - ext x - simp only [ringPieces, cover_cons, cover_nil, union_empty, mem_union, Piece.seg, - mem_segment_horiz, mem_segment_vert, segment_symm_Icc hr, segment_symm_Icc' hr, -- mem_Icc, ringSet, mem_setOf_eq, Plane.supNorm] -+ mem_Icc, ringSet, mem_ofPred_eq, Plane.supNorm] - -- On each side one coordinate is pinned to `±r` and the other is confined to `[-r, r]`; - -- which of the two is pinned is the only difference between the four sides. - have hleft : ∀ u v : ℝ, |u| = r → |v| ≤ r → max |u| |v| = r := by -@@ -275,9 +275,9 @@ - ∃ R ∈ splitAt p P, R.seg ⊆ P.seg ∧ (p = R.1 ∨ p = R.2) := by - classical - by_cases hp : p ∈ P.interior -- · refine ⟨(P.1, p), by rw [splitAt, if_pos hp]; simp, ?_, Or.inr rfl⟩ -+ · refine ⟨(P.1, p), by rw [splitAt, ite_eq_left hp]; simp, ?_, Or.inr rfl⟩ - exact (convex_segment P.1 P.2).segment_subset (left_mem_segment ℝ _ _) hmem -- · refine ⟨P, by rw [splitAt, if_neg hp]; simp, subset_rfl, ?_⟩ -+ · refine ⟨P, by rw [splitAt, ite_eq_right hp]; simp, subset_rfl, ?_⟩ - by_contra hcon - push Not at hcon - exact hp (mem_openSegment_of_ne_left_right (Ne.symm hcon.1) (Ne.symm hcon.2) hmem) -@@ -289,11 +289,11 @@ - by_cases hq : q ∈ P.interior - · have hqseg : q ∈ P.seg := openSegment_subset_segment ℝ _ _ hq - rcases h with rfl | rfl -- · refine ⟨(P.1, q), by rw [splitAt, if_pos hq]; simp, ?_, Or.inl rfl⟩ -+ · refine ⟨(P.1, q), by rw [splitAt, ite_eq_left hq]; simp, ?_, Or.inl rfl⟩ - exact (convex_segment P.1 P.2).segment_subset (left_mem_segment ℝ _ _) hqseg -- · refine ⟨(q, P.2), by rw [splitAt, if_pos hq]; simp, ?_, Or.inr rfl⟩ -+ · refine ⟨(q, P.2), by rw [splitAt, ite_eq_left hq]; simp, ?_, Or.inr rfl⟩ - exact (convex_segment P.1 P.2).segment_subset hqseg (right_mem_segment ℝ _ _) -- · exact ⟨P, by rw [splitAt, if_neg hq]; simp, subset_rfl, h⟩ -+ · exact ⟨P, by rw [splitAt, ite_eq_right hq]; simp, subset_rfl, h⟩ - - theorem splitAllAt_preserves_end (q : Plane) {p : Plane} {P : Piece} {pieces : List Piece} - (h : ∃ R ∈ pieces, R.seg ⊆ P.seg ∧ (p = R.1 ∨ p = R.2)) : -diff --git a/Schoenflies/SquareMeshClosed.lean b/Schoenflies/SquareMeshClosed.lean ---- a/Schoenflies/SquareMeshClosed.lean -+++ b/Schoenflies/SquareMeshClosed.lean -@@ -216,7 +216,7 @@ - Graph.edgesCover segmentDrawing (t.1 :: t.2.2.2.2) = modelCurve := by - obtain ⟨e, u, v, x, D, h₁, h₂, h₃⟩ := squareMesh_outer_cycle hfresh δ anchors - exact ⟨(e, u, v, x, D), h₁, h₂, h₃⟩ -- have hd : outerCycleData δ fresh anchors = h.choose := dif_pos h -+ have hd : outerCycleData δ fresh anchors = h.choose := dite_eq_left h - simpa [outerCycleEdge, outerCycleStart, outerCycleEnd, outerCycleThird, outerCycleDetour, hd] - using h.choose_spec - -@@ -745,7 +745,7 @@ - ∀ Q, Q ∈ W ↔ (Q ∈ E(meshGraph N fresh anchors) ∧ Q.seg ⊆ (spokePiece N z).seg) := - meshSubdividesToPath hN hfresh anchors _ (spokePiece_mem_meshSegments hz) - (spokePiece_nondeg hN (hfresh z hz)) -- rw [spokeWalk, dif_pos h] -+ rw [spokeWalk, dite_eq_left h] - exact h.choose_spec - - theorem spokeWalk_isPath {N : ℕ} (hN : 2 ≤ N) {fresh : List Plane} -@@ -834,7 +834,7 @@ - classical - have h : ∃ P : List Piece, (ringGraph N fresh anchors r).IsPath a P b := - (ringGraph_isTwoConnected hN hfresh anchors hr).connected.exists_isPath ha hb -- rw [ringArc, dif_pos h] -+ rw [ringArc, dite_eq_left h] - exact h.choose_spec - - /-- **The ear**: down the spoke at `z`, round the inner ring, and back up the spoke at `w`. -/ -diff --git a/Schoenflies/SquareMeshConnected.lean b/Schoenflies/SquareMeshConnected.lean ---- a/Schoenflies/SquareMeshConnected.lean -+++ b/Schoenflies/SquareMeshConnected.lean -@@ -314,7 +314,7 @@ - rcases hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases hvw with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> simp - edge_mem_iff_exists_isLink := by - intro P -- simp only [Set.mem_setOf_eq] -+ simp only [Set.mem_ofPred_eq] - exact ⟨fun hP => ⟨P.1, P.2, hP, Or.inl ⟨rfl, rfl⟩⟩, fun ⟨_, _, hP, _⟩ => hP⟩ - left_mem_of_isLink := by - rintro P x y ⟨hP, h⟩ -@@ -361,7 +361,7 @@ - - theorem endSet_append (l l' : List Piece) : endSet (l ++ l') = endSet l ∪ endSet l' := by - ext v -- simp only [endSet, Set.mem_setOf_eq, Set.mem_union, List.mem_append] -+ simp only [endSet, Set.mem_ofPred_eq, Set.mem_union, List.mem_append] - constructor - · rintro ⟨P, hP | hP, h⟩ - exacts [Or.inl ⟨P, hP, h⟩, Or.inr ⟨P, hP, h⟩] -@@ -378,7 +378,7 @@ - Graph.pointSet (pieceListGraph l) segmentDrawing = cover l := by - ext z - simp only [Graph.pointSet, Set.mem_union, Set.mem_iUnion, exists_prop, pieceListGraph_vertexSet, -- endSet, Set.mem_setOf_eq, pieceListGraph_mem_edgeSet, edgeArc_segmentDrawing, cover] -+ endSet, Set.mem_ofPred_eq, pieceListGraph_mem_edgeSet, edgeArc_segmentDrawing, cover] - constructor - · rintro (⟨P, hP, hzP⟩ | ⟨P, hP, hzP⟩) - · refine ⟨P, hP, ?_⟩ -@@ -662,9 +662,9 @@ - theorem bIdy_le {m n t : ℕ} (h : t ≤ 2 * m + 2 * n) : bIdy m n t ≤ n := by - unfold bIdy; split_ifs <;> omega - --theorem bIdx_bottom {m n t : ℕ} (h : t ≤ m) : bIdx m n t = t := by unfold bIdx; exact if_pos h -- --theorem bIdy_bottom {m n t : ℕ} (h : t ≤ m) : bIdy m n t = 0 := by unfold bIdy; exact if_pos h -+theorem bIdx_bottom {m n t : ℕ} (h : t ≤ m) : bIdx m n t = t := by unfold bIdx; exact ite_eq_left h -+ -+theorem bIdy_bottom {m n t : ℕ} (h : t ≤ m) : bIdy m n t = 0 := by unfold bIdy; exact ite_eq_left h - - theorem bIdx_right {m n t : ℕ} (h₁ : m ≤ t) (h₂ : t ≤ m + n) : bIdx m n t = m := by - unfold bIdx; split_ifs <;> omega -@@ -737,25 +737,29 @@ - unfold gridBoundaryEdge gridBoundaryPt gridGraph - rcases lt_or_ge t m with h₁ | h₁ - · -- along the bottom -- rw [if_pos h₁, bIdx_bottom (by omega), bIdy_bottom (by omega), bIdx_bottom (by omega), -+ rw [ite_eq_left h₁, bIdx_bottom (by omega), bIdy_bottom (by omega), bIdx_bottom (by omega), - bIdy_bottom (by omega)] - exact pieceListGraph_isLink_self (gridHEdge_mem_gridEdges h₁ (Nat.zero_le n) hn) - rcases lt_or_ge t (m + n) with h₂ | h₂ - · -- up the right side -- rw [if_neg (by omega), if_pos h₂, bIdx_right (by omega) (by omega), -+ rw [ite_eq_right (by omega), ite_eq_left h₂, bIdx_right (by omega) (by omega), - bIdy_right (by omega) (by omega), bIdx_right (by omega) (by omega), - bIdy_right (by omega) (by omega), show t + 1 - m = (t - m) + 1 by omega] - exact pieceListGraph_isLink_self (gridVEdge_mem_gridEdges le_rfl (by omega) hm) - rcases lt_or_ge t (2 * m + n) with h₃ | h₃ - · -- back along the top, so the walk runs against the edge's own orientation -- rw [if_neg (by omega), if_neg (by omega), if_pos h₃, bIdx_top (by omega) (by omega), -+ rw [ite_eq_right (by omega), -+ ite_eq_right (by omega), -+ ite_eq_left h₃, bIdx_top (by omega) (by omega), - bIdy_top (by omega) (by omega), bIdx_top (by omega) (by omega), - bIdy_top (by omega) (by omega), show 2 * m + n - (t + 1) = 2 * m + n - 1 - t by omega, - show 2 * m + n - t = 2 * m + n - 1 - t + 1 by omega] - exact (pieceListGraph_isLink_self (gridHEdge_mem_gridEdges - (show 2 * m + n - 1 - t < m by omega) le_rfl hn)).symm - · -- down the left side, again against the edge's orientation -- rw [if_neg (by omega), if_neg (by omega), if_neg (by omega), bIdx_left (by omega) (by omega), -+ rw [ite_eq_right (by omega), -+ ite_eq_right (by omega), -+ ite_eq_right (by omega), bIdx_left (by omega) (by omega), - bIdy_left (by omega) (by omega), bIdx_left (by omega) (by omega), - bIdy_left (by omega) (by omega), - show 2 * m + 2 * n - (t + 1) = 2 * m + 2 * n - 1 - t by omega, -@@ -814,23 +818,23 @@ - - theorem gridBoundaryEdge_bottom {xc yc : ℕ → ℝ} {m n i : ℕ} (h : i < m) : - gridBoundaryEdge xc yc m n i = gridHEdge xc yc i 0 := by -- unfold gridBoundaryEdge; rw [if_pos h] -+ unfold gridBoundaryEdge; rw [ite_eq_left h] - - theorem gridBoundaryEdge_right {xc yc : ℕ → ℝ} {m n j : ℕ} (h : j < n) : - gridBoundaryEdge xc yc m n (m + j) = gridVEdge xc yc m j := by - unfold gridBoundaryEdge -- rw [if_neg (by omega), if_pos (by omega), show m + j - m = j by omega] -+ rw [ite_eq_right (by omega), ite_eq_left (by omega), show m + j - m = j by omega] - - theorem gridBoundaryEdge_top {xc yc : ℕ → ℝ} {m n i : ℕ} (hn : 1 ≤ n) (h : i < m) : - gridBoundaryEdge xc yc m n (2 * m + n - 1 - i) = gridHEdge xc yc i n := by - unfold gridBoundaryEdge -- rw [if_neg (by omega), if_neg (by omega), if_pos (by omega), -+ rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_left (by omega), - show 2 * m + n - 1 - (2 * m + n - 1 - i) = i by omega] - - theorem gridBoundaryEdge_left {xc yc : ℕ → ℝ} {m n j : ℕ} (h : j < n) : - gridBoundaryEdge xc yc m n (2 * m + 2 * n - 1 - j) = gridVEdge xc yc 0 j := by - unfold gridBoundaryEdge -- rw [if_neg (by omega), if_neg (by omega), if_neg (by omega), -+ rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_right (by omega), - show 2 * m + 2 * n - 1 - (2 * m + 2 * n - 1 - j) = j by omega] - - /-- The realisation of the cycle is the union of the boundary edges, indexed by position on -diff --git a/Schoenflies/SquareMeshFixed.lean b/Schoenflies/SquareMeshFixed.lean ---- a/Schoenflies/SquareMeshFixed.lean -+++ b/Schoenflies/SquareMeshFixed.lean -@@ -133,7 +133,7 @@ - - theorem endSet_pair (a q b : Plane) : endSet [((a, q) : Piece), (q, b)] = {a, q, b} := by - ext x -- simp only [endSet, mem_setOf_eq, List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, -+ simp only [endSet, mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, - mem_singleton_iff] - constructor - · rintro ⟨P, hP, hx⟩ -@@ -240,7 +240,7 @@ - induction l with - | nil => rfl - | cons R l ih => -- rw [splitAllAt, List.flatMap_cons, splitAt, if_neg (h R (List.mem_cons_self ..))] -+ rw [splitAllAt, List.flatMap_cons, splitAt, ite_eq_right (h R (List.mem_cons_self ..))] - rw [show l.flatMap (splitAt q) = splitAllAt q l from rfl, - ih fun S hS => h S (List.mem_cons_of_mem _ hS)] - rfl -@@ -256,22 +256,22 @@ - obtain ⟨S, hS, hRS⟩ := List.mem_flatMap.1 hR - by_cases hqS : q ∈ S.interior - · obtain rfl := huniq S hS hqS -- rw [splitAt, if_pos hqS] at hRS -+ rw [splitAt, ite_eq_left hqS] at hRS - exact Or.inr hRS -- · rw [splitAt, if_neg hqS] at hRS -+ · rw [splitAt, ite_eq_right hqS] at hRS - obtain rfl : R = S := List.mem_singleton.1 hRS - exact Or.inl ⟨hS, fun h => hqS (h ▸ hq)⟩ - · rintro (⟨hR, hRP⟩ | hR) - · have hqR : q ∉ R.interior := fun h => hRP (huniq R hR h) -- exact List.mem_flatMap.2 ⟨R, hR, by rw [splitAt, if_neg hqR]; simp⟩ -- · exact List.mem_flatMap.2 ⟨P, hP, by rw [splitAt, if_pos hq]; exact hR⟩ -+ exact List.mem_flatMap.2 ⟨R, hR, by rw [splitAt, ite_eq_right hqR]; simp⟩ -+ · exact List.mem_flatMap.2 ⟨P, hP, by rw [splitAt, ite_eq_left hq]; exact hR⟩ - - /-- The ends of a split list: the old ends and the cut point. -/ - theorem endSet_splitAllAt {l : List Piece} {P : Piece} {q : Plane} (hP : P ∈ l) - (hq : q ∈ P.interior) (huniq : ∀ S ∈ l, q ∈ S.interior → S = P) : - endSet (splitAllAt q l) = endSet l ∪ {q} := by - ext v -- simp only [endSet, mem_setOf_eq, mem_union, mem_singleton_iff] -+ simp only [endSet, mem_ofPred_eq, mem_union, mem_singleton_iff] - constructor - · rintro ⟨R, hR, hv⟩ - rcases (mem_splitAllAt_iff hP hq huniq).1 hR with ⟨hRl, -⟩ | hR2 -@@ -373,7 +373,7 @@ - (splitAt_interior_subset q' S₀ S hSS₀ hqS) - -- … and the two halves of one piece have disjoint interiors - by_cases hq'R : q' ∈ R₀.interior -- · rw [splitAt, if_pos hq'R] at hRR₀ hSS₀ -+ · rw [splitAt, ite_eq_left hq'R] at hRR₀ hSS₀ - simp only [List.mem_cons, List.not_mem_nil, or_false] at hRR₀ hSS₀ - have hnd₀ : R₀.Nondeg := hnd R₀ hR₀ - rcases hRR₀ with rfl | rfl <;> rcases hSS₀ with rfl | rfl -@@ -381,7 +381,7 @@ - · exact absurd (openSegment_halves_disjoint hnd₀ hq'R hqR hqS) not_false - · exact absurd (openSegment_halves_disjoint hnd₀ hq'R hqS hqR) not_false - · rfl -- · rw [splitAt, if_neg hq'R] at hRR₀ hSS₀ -+ · rw [splitAt, ite_eq_right hq'R] at hRR₀ hSS₀ - rw [List.mem_singleton.1 hRR₀, List.mem_singleton.1 hSS₀] - · rcases hq.2 with hnone | hend - · exact Or.inl fun R hR => by -diff --git a/Schoenflies/SquareMover.lean b/Schoenflies/SquareMover.lean ---- a/Schoenflies/SquareMover.lean -+++ b/Schoenflies/SquareMover.lean -@@ -96,10 +96,10 @@ - noncomputable def bend (r p q u : ℝ) : ℝ := - if u ≤ p then -r + (u + r) * (q + r) / (p + r) else r - (r - u) * (r - q) / (r - p) - --theorem bend_of_le (h : u ≤ p) : bend r p q u = -r + (u + r) * (q + r) / (p + r) := if_pos h -+theorem bend_of_le (h : u ≤ p) : bend r p q u = -r + (u + r) * (q + r) / (p + r) := ite_eq_left h - - theorem bend_of_gt (h : p < u) : bend r p q u = r - (r - u) * (r - q) / (r - p) := -- if_neg (not_le.2 h) -+ ite_eq_right (not_le.2 h) - - theorem bend_left (h : -r ≤ p) : bend r p q (-r) = -r := by - rw [bend_of_le h]; simp -@@ -279,7 +279,7 @@ - c i + bend r (a + k * shearWeight c r b j z) (a + (k + k') * shearWeight c r b j z) - (z i - c i) := by - simp only [shear, PiLp.add_apply, PiLp.smul_apply, PiLp.single_apply, smul_eq_mul, -- if_true, mul_one] -+ ite_true, mul_one] - ring - - theorem shear_apply_ne (h : l ≠ i) : shear c r a b k k' i j z l = z l := by -@@ -585,13 +585,13 @@ - · rintro ⟨h1, h2⟩ - exact le_antisymm h1 (not_lt.1 h2) - · intro h -- exact ⟨le_of_eq h, by rw [openSquare, mem_setOf_eq, h]; exact lt_irrefl r⟩ -+ exact ⟨le_of_eq h, by rw [openSquare, mem_ofPred_eq, h]; exact lt_irrefl r⟩ - - /-- A mover is the identity on the boundary square `S`. -/ - theorem IsSquareMover.eqOn_frontier {M N : Plane → Plane} (h : IsSquareMover c r M N) : - EqOn M id (frontier (closedSquare c r)) := by - intro z hz -- rw [frontier_closedSquare, mem_setOf_eq] at hz -+ rw [frontier_closedSquare, mem_ofPred_eq] at hz - exact h.fixes z (le_of_eq hz) hz - - /-! ### The mover as a homeomorphism -/ -@@ -603,8 +603,8 @@ - invFun z := ⟨N z, h.mapsTo_inv z.2⟩ - left_inv z := Subtype.ext (h.invOn.1 z.2) - right_inv z := Subtype.ext (h.invOn.2 z.2) -- continuous_toFun := h.continuousOn.restrict.subtype_mk _ -- continuous_invFun := h.continuousOn_inv.restrict.subtype_mk _ -+ continuous_toFun := h.continuousOn.domRestrict.subtype_mk _ -+ continuous_invFun := h.continuousOn_inv.domRestrict.subtype_mk _ - - @[simp] theorem IsSquareMover.homeomorph_apply {M N : Plane → Plane} - (h : IsSquareMover c r M N) (z : closedSquare c r) : -diff --git a/Schoenflies/Strip.lean b/Schoenflies/Strip.lean ---- a/Schoenflies/Strip.lean -+++ b/Schoenflies/Strip.lean -@@ -207,7 +207,7 @@ - have harc : arcCCW u w = {d : Plane | det w d < 0} ∪ {d : Plane | det d u < 0} := by - ext d - rw [mem_arcCCW_rev_iff h'] -- simp only [mem_union, mem_setOf_eq] -+ simp only [mem_union, mem_ofPred_eq] - have hd0 : (-ε) • (u + w) ∈ ball (0 : Plane) ρ := - hball _ (by rw [abs_of_neg (neg_neg_iff_pos.2 hε), neg_neg]) - have hA : (-ε) • (u + w) ∈ {d : Plane | det w d < 0} := by -@@ -227,7 +227,7 @@ - have harc : arcCCW u w = {d : Plane | 0 < det u d} ∩ {d : Plane | 0 < det d w} := by - ext d - rw [mem_arcCCW_iff hpos] -- simp only [mem_inter_iff, mem_setOf_eq] -+ simp only [mem_inter_iff, mem_ofPred_eq] - have hmem : ε • (u + w) ∈ arcCCW u w ∩ ball (0 : Plane) ρ := by - refine ⟨?_, hball _ (abs_of_pos hε)⟩ - rw [harc] -@@ -275,7 +275,7 @@ - module - · rintro ⟨d, ⟨hd, hb⟩, rfl⟩ - have he : v + d - v = d := by module -- refine ⟨by rw [mem_setOf_eq, he]; exact hd, ?_⟩ -+ refine ⟨by rw [mem_ofPred_eq, he]; exact hd, ?_⟩ - rw [mem_ball, dist_eq_norm, he] - rw [mem_ball, dist_zero_right] at hb - exact hb -@@ -388,7 +388,7 @@ - ({x : Plane | t₁ < coordAlong a u x} ∩ {x : Plane | coordAlong a u x < t₂}) ∩ - ({x : Plane | s₁ < coordAcross a u x} ∩ {x : Plane | coordAcross a u x < s₂}) := by - ext y -- simp only [mem_strip_iff, mem_inter_iff, mem_setOf_eq] -+ simp only [mem_strip_iff, mem_inter_iff, mem_ofPred_eq] - tauto - rw [key] - exact ((isOpen_lt continuous_const (continuous_coordAlong a u)).inter -@@ -407,7 +407,7 @@ - simp only [coordAcross, det] - simp - ring -- simp only [mem_strip_iff, mem_inter_iff, mem_setOf_eq, h1, h2] -+ simp only [mem_strip_iff, mem_inter_iff, mem_ofPred_eq, h1, h2] - constructor - · rintro ⟨a1, a2, a3, a4⟩; exact ⟨⟨by linarith, by linarith⟩, ⟨by linarith, by linarith⟩⟩ - · rintro ⟨⟨a1, a2⟩, ⟨a3, a4⟩⟩; exact ⟨by linarith, by linarith, by linarith, by linarith⟩ -diff --git a/Schoenflies/StripLocal.lean b/Schoenflies/StripLocal.lean ---- a/Schoenflies/StripLocal.lean -+++ b/Schoenflies/StripLocal.lean -@@ -288,7 +288,7 @@ - (have hδpos : 0 < min 1 (ε / (2 * ‖z - P.vertex i‖)) := lt_min one_pos (by positivity) - have hsub : P.vertex i + (min 1 (ε / (2 * ‖z - P.vertex i‖))) • (z - P.vertex i) - - P.vertex i = (min 1 (ε / (2 * ‖z - P.vertex i‖))) • (z - P.vertex i) := by module) -- · rw [Set.mem_setOf_eq, hsub] -+ · rw [Set.mem_ofPred_eq, hsub] - exact (smul_mem_arcCCW hδpos).2 harc - · rw [mem_ball, dist_eq_norm, hsub, norm_smul, Real.norm_eq_abs, abs_of_pos hδpos] - have h1 : min 1 (ε / (2 * ‖z - P.vertex i‖)) ≤ 1 := min_le_left _ _ -@@ -309,7 +309,7 @@ - (have hδpos : 0 < min 1 (ε / (2 * ‖z - P.vertex i‖)) := lt_min one_pos (by positivity) - have hsub : P.vertex i + (min 1 (ε / (2 * ‖z - P.vertex i‖))) • (z - P.vertex i) - - P.vertex i = (min 1 (ε / (2 * ‖z - P.vertex i‖))) • (z - P.vertex i) := by module) -- · rw [Set.mem_setOf_eq, hsub] -+ · rw [Set.mem_ofPred_eq, hsub] - exact (smul_mem_arcCCW hδpos).2 harc - · rw [mem_ball, dist_eq_norm, hsub, norm_smul, Real.norm_eq_abs, abs_of_pos hδpos] - have h1 : min 1 (ε / (2 * ‖z - P.vertex i‖)) ≤ 1 := min_le_left _ _ -diff --git a/Schoenflies/Subarc.lean b/Schoenflies/Subarc.lean ---- a/Schoenflies/Subarc.lean -+++ b/Schoenflies/Subarc.lean -@@ -78,7 +78,8 @@ - theorem image_reparam_I : reparam a b '' I = uIcc a b := by - have h : (fun θ : ℝ => a + θ • (b - a)) '' Icc (0 : ℝ) 1 = uIcc a b := by - rw [← segment_eq_image' ℝ a b, segment_eq_uIcc] -- simpa [reparam, smul_eq_mul] using h -+ change (fun t : ℝ => a + t * (b - a)) '' Icc (0 : ℝ) 1 = uIcc a b -+ simpa only [smul_eq_mul] using h - - theorem mapsTo_reparam : MapsTo (reparam a b) I (uIcc a b) := - mapsTo_iff_image_subset.mpr image_reparam_I.subset -diff --git a/Schoenflies/TargetOverlay.lean b/Schoenflies/TargetOverlay.lean ---- a/Schoenflies/TargetOverlay.lean -+++ b/Schoenflies/TargetOverlay.lean -@@ -84,7 +84,7 @@ - theorem exists_targetSegmentCover - (P : GeneratedPair S₀ srcOuter srcDom tgtOuter tgtDom) : - Nonempty (TargetSegmentCover P) := by -- letI : Graph.Finite P.tgt.graph := -+ let : Graph.Finite P.tgt.graph := - CellStructure.Realization.finite_graph P.tgt - have hincident : ∀ z ∈ V(P.tgt.graph), ∃ e, P.tgt.graph.Inc e z := by - intro z hz -@@ -1024,7 +1024,7 @@ - A ∈ openTargetEdgePieces P ↔ - ∃ e ∈ E(P.str.skel), e ∉ E(P.str.outerGraph) ∧ - A = edgeArc P.tgt.drawing e \ modelCurve := by -- letI : P.str.skel.Finite := -+ let : P.str.skel.Finite := - ⟨P.str.finite_vertexSet, P.str.finite_edgeSet⟩ - simp only [openTargetEdgePieces, List.mem_map, Finset.mem_toList, Finset.mem_filter, - Graph.mem_edgeFinset] -diff --git a/lakefile.toml b/lakefile.toml ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -12,7 +12,7 @@ - [[require]] - name = "mathlib" - scope = "leanprover-community" --rev = "v4.32.2" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "Schoenflies" -diff --git a/lean-toolchain b/lean-toolchain ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.2 -+leanprover/lean4:v4.34.1 -diff --git a/Schoenflies/Jordan.lean b/Schoenflies/Jordan.lean -index fef1405..ad432b8 100644 ---- a/Schoenflies/Jordan.lean -+++ b/Schoenflies/Jordan.lean -@@ -719,7 +719,7 @@ theorem not_three_components (harc : ∀ A : Set Plane, IsArc A → IsConnected - first - | exact absurd rfl hjl - | assumption -- | (rw [inter_comm]; assumption) -+ | rwa [inter_comm] - choose xx hxxΩ TT hTTarc hTTsub hTTmeet using htri - /- ### Assembling the `K(3,3)` -/ - have hTC : ∀ i j, TT i j ∩ f '' I = {f (t i j)} := by +diff --git a/Schoenflies/Accessible.lean b/Schoenflies/Accessible.lean +--- a/Schoenflies/Accessible.lean ++++ b/Schoenflies/Accessible.lean +@@ -113,7 +113,7 @@ + have h1 : Continuous fun x : Plane => ‖x - p‖ := (continuous_id.sub continuous_const).norm + have h2 : Continuous fun x : Plane => inner ℝ v (x - p) := + continuous_const.inner (continuous_id.sub continuous_const) +- rw [accessCone, setOf_and] ++ rw [accessCone, ofPred_and] + exact (isOpen_lt h1 continuous_const).inter (isOpen_lt (h1.div_const 2) h2) + + /-- Membership in the cone in the form used by the blueprint: a unit direction `w` making an +diff --git a/Schoenflies/ArcCollars.lean b/Schoenflies/ArcCollars.lean +--- a/Schoenflies/ArcCollars.lean ++++ b/Schoenflies/ArcCollars.lean +@@ -1261,7 +1261,7 @@ + (min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖))) • (z - A.vertex (i + 1)) - + A.vertex (i + 1) = + (min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖))) • (z - A.vertex (i + 1)) := by module) +- · rw [Set.mem_setOf_eq, hsub] ++ · rw [Set.mem_ofPred_eq, hsub] + exact (smul_mem_arcCCW hδpos).2 harc + · rw [mem_ball, dist_eq_norm, hsub, norm_smul, Real.norm_eq_abs, abs_of_pos hδpos] + have h1 : min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖)) ≤ 1 := min_le_left _ _ +@@ -1286,7 +1286,7 @@ + (min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖))) • (z - A.vertex (i + 1)) - + A.vertex (i + 1) = + (min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖))) • (z - A.vertex (i + 1)) := by module) +- · rw [Set.mem_setOf_eq, hsub] ++ · rw [Set.mem_ofPred_eq, hsub] + exact (smul_mem_arcCCW hδpos).2 harc + · rw [mem_ball, dist_eq_norm, hsub, norm_smul, Real.norm_eq_abs, abs_of_pos hδpos] + have h1 : min 1 (ε / (2 * ‖z - A.vertex (i + 1)‖)) ≤ 1 := min_le_left _ _ +diff --git a/Schoenflies/ArcComplement.lean b/Schoenflies/ArcComplement.lean +--- a/Schoenflies/ArcComplement.lean ++++ b/Schoenflies/ArcComplement.lean +@@ -154,7 +154,7 @@ + Graph.pointSet (segGraph S) segmentDrawing = ⋃ P ∈ S, P.seg := by + ext z + simp only [Graph.pointSet, mem_union, mem_iUnion, exists_prop, segGraph_vertexSet, +- mem_setOf_eq, segGraph_edgeSet, edgeArc_segmentDrawing] ++ mem_ofPred_eq, segGraph_edgeSet, edgeArc_segmentDrawing] + constructor + · rintro (⟨P, hP, hzP⟩ | ⟨P, hP, hzP⟩) + · refine ⟨P, hP, ?_⟩ +@@ -453,7 +453,7 @@ + intro z hz hz' + obtain ⟨j, hj, hj', hzj⟩ := exists_mem_frontier_of_mem_pointSet_familyChain hz + obtain ⟨k, hk, hk', hzk⟩ := exists_mem_frontier_of_mem_pointSet_familyChain hz' +- rw [Plane.frontier_closedSquare, mem_setOf_eq] at hzj hzk ++ rw [Plane.frontier_closedSquare, mem_ofPred_eq] at hzj hzk + have htri := Plane.supDist_triangle (c j) z (c k) + rw [Plane.supDist_comm (c j) z] at htri + exact absurd (hfar p q hp hq hpq j hj hj' k hk hk') (by rw [hzj, hzk] at htri; linarith) +@@ -525,7 +525,7 @@ + z ∈ Plane.closedSquare (c (p * m)) R := by + intro i hi hi' hzi + obtain ⟨j, hj, hj', hzj⟩ := exists_mem_frontier_of_mem_pointSet_familyChain hzi +- rw [Plane.frontier_closedSquare, mem_setOf_eq] at hzj ++ rw [Plane.frontier_closedSquare, mem_ofPred_eq] at hzj + have hjlo : p * m ≤ j := le_trans (Nat.mul_le_mul_right _ hi) hj + have hjhi : j ≤ p * m + m + m := by + have : i * m ≤ (p + 1) * m := Nat.mul_le_mul_right _ hi' +@@ -714,7 +714,7 @@ + (outerOnPairs_familyChain hcontain (hxfar u hmemu)) + have houtw := outer_face_familyChain hchain + (outerOnPairs_familyChain hcontain (hxfar w hmemw)) +- haveI : (Graph.chainUnion (familyChain c ((n + 1) * m) m r) 0 n).Finite := ++ have : (Graph.chainUnion (familyChain c ((n + 1) * m) m r) 0 n).Finite := + hchain.block_finite (i := 0) (m := n) (by omega) + have hdraw : Graph.IsDrawing (Graph.chainUnion (familyChain c ((n + 1) * m) m r) 0 n) + segmentDrawing := hchain.block_isDrawing (by omega) +diff --git a/Schoenflies/ArcComplementPrep.lean b/Schoenflies/ArcComplementPrep.lean +--- a/Schoenflies/ArcComplementPrep.lean ++++ b/Schoenflies/ArcComplementPrep.lean +@@ -441,7 +441,7 @@ + theorem mem_compl_closedSquare_iff (c : Plane) (r : ℝ) (x : Plane) : + x ∈ (closedSquare c r)ᶜ ↔ x - c ∈ beyondSquare r := by + rw [beyondSquare_eq_compl] +- simp only [mem_compl_iff, closedSquare, mem_setOf_eq, supDist_zero] ++ simp only [mem_compl_iff, closedSquare, mem_ofPred_eq, supDist_zero] + exact Iff.rfl + + theorem compl_closedSquare_eq_image (c : Plane) (r : ℝ) : +@@ -465,7 +465,7 @@ + (frontier (closedSquare c r))ᶜ = openSquare c r ∪ (closedSquare c r)ᶜ := by + ext z + rw [frontier_closedSquare] +- simp only [mem_compl_iff, mem_setOf_eq, mem_union, openSquare, closedSquare, not_le] ++ simp only [mem_compl_iff, mem_ofPred_eq, mem_union, openSquare, closedSquare, not_le] + constructor + · intro h + rcases lt_or_gt_of_ne h with h' | h' +diff --git a/Schoenflies/ArcMonotone.lean b/Schoenflies/ArcMonotone.lean +--- a/Schoenflies/ArcMonotone.lean ++++ b/Schoenflies/ArcMonotone.lean +@@ -86,7 +86,7 @@ + have h : ∃ s, s ∈ I ∧ f s = p := by + obtain ⟨s, hs, rfl⟩ := hp + exact ⟨s, hs, rfl⟩ +- rw [arcParam, dif_pos h] ++ rw [arcParam, dite_eq_left h] + exact h.choose_spec + + theorem arcParam_mem_I (hp : p ∈ f '' I) : arcParam f p ∈ I := (arcParam_spec hp).1 +diff --git a/Schoenflies/BoundaryAnchors.lean b/Schoenflies/BoundaryAnchors.lean +--- a/Schoenflies/BoundaryAnchors.lean ++++ b/Schoenflies/BoundaryAnchors.lean +@@ -119,7 +119,7 @@ + have harc := h.edge_isArcBetween hxy + apply Or.inr + exact Set.mem_iUnion₂.2 ⟨e, by +- rw [Graph.edgeSet_eq_setOf_exists_isLink] ++ rw [Graph.edgeSet_eq_setOfPred_exists_isLink] + exact ⟨x, y, (Graph.traceGraph_isLink D).2 + ⟨heD, hxy, heD harc.left_mem, heD harc.right_mem⟩⟩, hze⟩ + +@@ -246,7 +246,7 @@ + h.vertex_mem hlb.right_mem (hcase hlb hbnb hbC) + let K := Graph.traceGraph G drawing (inside C) + have hKle : K ≤ G := Graph.traceGraph_le _ +- letI : K.Finite := Graph.Finite.of_le hKle ++ let : K.Finite := Graph.Finite.of_le hKle + have hKpoint : Graph.pointSet K drawing = + Graph.interiorPart G drawing (inside C) := + Graph.pointSet_traceGraph_eq_interiorPart h.isDrawing (inside C) +@@ -793,7 +793,7 @@ + have hrTargetAdmissible : + r.pair.tgt.IsAdmissible modelCurve (Plane.closedSquare 0 1) := + r.pair.tgt_isAdmissible hrAdmissible.isConnected_nonboundary +- letI : r.pair.src.graph.Finite := CellStructure.Realization.finite_graph r.pair.src ++ let : r.pair.src.graph.Finite := CellStructure.Realization.finite_graph r.pair.src + have hsourceStage := hrAdmissible.isStageOn + have htargetStage : Graph.IsStageOn r.pair.tgt.graph r.pair.tgt.drawing + modelCurve (inside modelCurve) := by +diff --git a/Schoenflies/BoundaryContinuity2.lean b/Schoenflies/BoundaryContinuity2.lean +--- a/Schoenflies/BoundaryContinuity2.lean ++++ b/Schoenflies/BoundaryContinuity2.lean +@@ -494,7 +494,7 @@ + hsnot (mem_of_superset h (preimage_mono hWs)) + -- the filter of approach that stays away from `W` + set l' : Filter Plane := 𝓝[inside C] p ⊓ 𝓟 (F ⁻¹' Wᶜ) with hl' +- haveI : l'.NeBot := by ++ have : l'.NeBot := by + refine ⟨fun h => hWnot ?_⟩ + rw [hl', Filter.inf_principal_eq_bot] at h + simpa using h +@@ -521,7 +521,7 @@ + rw [le_principal_iff, mem_map] + filter_upwards [hl'in] with z hz using hF.mapsTo hz + set m : Filter Plane := 𝓝 q ⊓ map F l' with hm +- haveI : m.NeBot := hqcl ++ have : m.NeBot := hqcl + have hm1 : m ≤ 𝓝[Plane.openSquare 0 1] q := + le_inf inf_le_left (le_trans inf_le_right hmapO) + have h1 : Tendsto F' m (𝓝 (F' q)) := (hF.continuousOn_inv q hqopen).mono_left hm1 +diff --git a/Schoenflies/BoundaryCycles.lean b/Schoenflies/BoundaryCycles.lean +--- a/Schoenflies/BoundaryCycles.lean ++++ b/Schoenflies/BoundaryCycles.lean +@@ -148,7 +148,7 @@ + rw [CellStructure.pathCells, CellStructure.pathCells, + h₁.walkVertices_eq_covered hne₁, h₂.walkVertices_eq_covered hne₂] + ext σ +- simp only [Set.mem_union, Set.mem_setOf_eq, Graph.mem_coveredVertices_iff] ++ simp only [Set.mem_union, Set.mem_ofPred_eq, Graph.mem_coveredVertices_iff] + constructor + · rintro (hσ | ⟨e, he, hi⟩) + · exact Or.inl (hp.mem_iff.1 hσ) +diff --git a/Schoenflies/Bounded.lean b/Schoenflies/Bounded.lean +--- a/Schoenflies/Bounded.lean ++++ b/Schoenflies/Bounded.lean +@@ -38,7 +38,7 @@ + /-- The outside of a square is exactly the complement of the closed square. -/ + theorem beyondSquare_eq_compl (r : ℝ) : beyondSquare r = (closedSquare 0 r)ᶜ := by + ext x +- simp only [beyondSquare, closedSquare, mem_setOf_eq, mem_compl_iff, supDist_zero, supNorm, ++ simp only [beyondSquare, closedSquare, mem_ofPred_eq, mem_compl_iff, supDist_zero, supNorm, + max_le_iff, not_and_or, not_le] + + /-- A bounded set sits inside a closed square about the origin, of nonnegative radius. -/ +diff --git a/Schoenflies/CommonSubdivision.lean b/Schoenflies/CommonSubdivision.lean +--- a/Schoenflies/CommonSubdivision.lean ++++ b/Schoenflies/CommonSubdivision.lean +@@ -48,8 +48,8 @@ + let B : Graph Plane β := G.induce (V(G) \ G.component x) + have hAle : A ≤ G := G.induce_le component_subset_vertexSet + have hBle : B ≤ G := G.induce_le Set.sdiff_subset +- letI : A.Finite := Graph.Finite.of_le hAle +- letI : B.Finite := Graph.Finite.of_le hBle ++ let : A.Finite := Graph.Finite.of_le hAle ++ let : B.Finite := Graph.Finite.of_le hBle + have hAclosed : IsClosed (pointSet A drawing) := (hdraw.mono hAle).isClosed_pointSet + have hBclosed : IsClosed (pointSet B drawing) := (hdraw.mono hBle).isClosed_pointSet + have hcover : pointSet G drawing ⊆ pointSet A drawing ∪ pointSet B drawing := by +@@ -64,14 +64,14 @@ + · have hvC : v ∈ G.component x := mem_component_of_isLink huC huv + exact Or.inl (Or.inr (Set.mem_iUnion₂_of_mem + (show e ∈ E(A) by +- rw [edgeSet_eq_setOf_exists_isLink] ++ rw [edgeSet_eq_setOfPred_exists_isLink] + exact ⟨u, v, huv, huC, hvC⟩) hze)) + · have hvC : v ∉ G.component x := by + intro hvC + exact huC (mem_component_of_isLink hvC huv.symm) + exact Or.inr (Or.inr (Set.mem_iUnion₂_of_mem + (show e ∈ E(B) by +- rw [edgeSet_eq_setOf_exists_isLink] ++ rw [edgeSet_eq_setOfPred_exists_isLink] + exact ⟨u, v, huv, ⟨huv.left_mem, huC⟩, ⟨huv.right_mem, hvC⟩⟩) hze)) + have hAB : Disjoint (pointSet A drawing) (pointSet B drawing) := by + rw [Set.disjoint_left] +@@ -79,13 +79,13 @@ + rcases hzA with hzAV | hzAE <;> rcases hzB with hzBV | hzBE + · exact hzBV.2 hzAV + · obtain ⟨e, heB, hze⟩ := Set.mem_iUnion₂.1 hzBE +- rw [edgeSet_eq_setOf_exists_isLink] at heB ++ rw [edgeSet_eq_setOfPred_exists_isLink] at heB + obtain ⟨u, v, huv, huB, hvB⟩ := heB + have hzinc := hdraw.vertex_mem_edgeArc huv (component_subset_vertexSet hzAV) hze + rcases hzinc with rfl | rfl + exacts [huB.2 hzAV, hvB.2 hzAV] + · obtain ⟨e, heA, hze⟩ := Set.mem_iUnion₂.1 hzAE +- rw [edgeSet_eq_setOf_exists_isLink] at heA ++ rw [edgeSet_eq_setOfPred_exists_isLink] at heA + obtain ⟨u, v, huv, huA, hvA⟩ := heA + have hzinc := hdraw.vertex_mem_edgeArc huv hzBV.1 hze + rcases hzinc with rfl | rfl +@@ -97,7 +97,7 @@ + have hef : e ≠ f := by + intro hef + subst f +- rw [edgeSet_eq_setOf_exists_isLink] at heA hfB ++ rw [edgeSet_eq_setOfPred_exists_isLink] at heA hfB + obtain ⟨u, v, huv, huA, -⟩ := heA + obtain ⟨u', v', huv', huB, hvB⟩ := hfB + rcases huv.left_eq_or_eq huv' with h | h +@@ -105,7 +105,7 @@ + · exact hvB.2 (h ▸ huA) + obtain ⟨hzV, ⟨u, heu⟩, ⟨v, hfv⟩⟩ := + hdraw.edge_inter heG hfG hef hzeA hzfB +- rw [edgeSet_eq_setOf_exists_isLink] at heA hfB ++ rw [edgeSet_eq_setOfPred_exists_isLink] at heA hfB + obtain ⟨a, b, hab, haA, hbA⟩ := heA + obtain ⟨c, d, hcd, hcB, hdB⟩ := hfB + rcases heu.left_eq_or_eq hab with rfl | rfl <;> +@@ -135,7 +135,7 @@ + @[simp] theorem traceGraph_isLink (A : Set Plane) : + (traceGraph G drawing A).IsLink e x y ↔ + edgeArc drawing e ⊆ A ∧ G.IsLink e x y ∧ x ∈ A ∧ y ∈ A := by +- simp only [traceGraph, induce_isLink, restrict_isLink, Set.mem_setOf_eq, ++ simp only [traceGraph, induce_isLink, restrict_isLink, Set.mem_ofPred_eq, + Set.mem_inter_iff] + constructor + · rintro ⟨⟨hsub, hlink⟩, ⟨-, hxA⟩, ⟨-, hyA⟩⟩ +@@ -164,7 +164,7 @@ + rintro z (hz | hz) + · exact hz.2 + · obtain ⟨e, he, hze⟩ := Set.mem_iUnion₂.1 hz +- rw [edgeSet_eq_setOf_exists_isLink] at he ++ rw [edgeSet_eq_setOfPred_exists_isLink] at he + obtain ⟨x, y, hxy⟩ := he + exact (traceGraph_isLink A).1 hxy |>.1 hze + +@@ -185,7 +185,7 @@ + habsorb he ⟨z, ⟨hze, hzA, hzVG⟩⟩ + exact Or.inr (Set.mem_iUnion₂_of_mem + (show e ∈ E(traceGraph G drawing A) by +- rw [edgeSet_eq_setOf_exists_isLink] ++ rw [edgeSet_eq_setOfPred_exists_isLink] + obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet he + have harc := hdraw.edge_isArcBetween hxy + exact ⟨x, y, (traceGraph_isLink A).2 +@@ -302,8 +302,8 @@ + Graph.edgesCover Hdraw D = edgeArc R.drawing e := by + let K := Graph.traceGraph H Hdraw (edgeArc R.drawing e) + have hKle : K ≤ H := Graph.traceGraph_le _ +- letI : H.Finite := hH.finite +- letI : K.Finite := Graph.Finite.of_le hKle ++ let : H.Finite := hH.finite ++ let : K.Finite := Graph.Finite.of_le hKle + have hpoint : pointSet K Hdraw = edgeArc R.drawing e := + edge_trace_pointSet hH hab.edge_mem + have haH : R.pos a ∈ V(H) := hH.vertexSet_subset (by +@@ -683,8 +683,8 @@ + ∃ D : List δ, K.IsPath a D b ∧ edgesCover Kdraw D = edgeArc Gdraw e := by + let T := Graph.traceGraph K Kdraw (edgeArc Gdraw e) + have hTK : T ≤ K := Graph.traceGraph_le _ +- letI : K.Finite := h.finite +- letI : T.Finite := Graph.Finite.of_le hTK ++ let : K.Finite := h.finite ++ let : T.Finite := Graph.Finite.of_le hTK + have hpoint : pointSet T Kdraw = edgeArc Gdraw e := h.edge_trace_pointSet hab.edge_mem + have haK : a ∈ V(K) := h.vertexSet_subset hab.left_mem + have hbK : b ∈ V(K) := h.vertexSet_subset hab.right_mem +@@ -1083,7 +1083,7 @@ + have hvertex : d.realizePos R t '' V(d.outer) = + insert (R.drawing d.edge t) (R.pos '' V(S.outerGraph)) := by + rw [CellStructure.SubdivData.outer, subdivGraph_vertexSet] +- simp only [d.outer_isLink he, and_true, Set.setOf_eq_eq_singleton, ++ simp only [d.outer_isLink he, and_true, Set.ofPred_eq_eq_singleton, + Set.image_union, Set.image_singleton, d.realizePos_newVertex] + rw [Set.union_comm] + congr 1 +@@ -1326,7 +1326,7 @@ + exact (P.src.isDrawing.edge_param heR).2.2.right_mem + have htIoo : t ∈ Set.Ioo (0 : ℝ) 1 := + ⟨lt_of_le_of_ne ht.1 (Ne.symm ht0), lt_of_le_of_ne ht.2 ht1⟩ +- letI : Finite (Fin 3) := inferInstance ++ let : Finite (Fin 3) := inferInstance + obtain ⟨fresh, hfresh, havoid⟩ := + exists_injective_avoiding P.str.cells P.str.finite_cells (Fin 3) + have h01 : fresh 0 ≠ fresh 1 := fun h => by +diff --git a/Schoenflies/Concatenate.lean b/Schoenflies/Concatenate.lean +--- a/Schoenflies/Concatenate.lean ++++ b/Schoenflies/Concatenate.lean +@@ -84,11 +84,11 @@ + variable {f g : ℝ → Plane} + + theorem concatenate_of_le {t : ℝ} (ht : t ≤ 1 / 2) : concatenate f g t = f (2 * t) := +- if_pos ht ++ ite_eq_left ht + + theorem concatenate_of_not_le {t : ℝ} (ht : ¬t ≤ 1 / 2) : + concatenate f g t = g (2 * t - 1) := +- if_neg ht ++ ite_eq_right ht + + theorem concatenate_zero : concatenate f g 0 = f 0 := by + rw [concatenate_of_le (by norm_num)] +diff --git a/Schoenflies/Direction.lean b/Schoenflies/Direction.lean +--- a/Schoenflies/Direction.lean ++++ b/Schoenflies/Direction.lean +@@ -177,7 +177,7 @@ + have key : ∀ x : ℝ, 0 < r * x ↔ 0 < x := by + intro x + constructor <;> intro hx <;> nlinarith +- simp only [arcCCW, mem_setOf_eq, det_smul_left, det_smul_right, key] ++ simp only [arcCCW, mem_ofPred_eq, det_smul_left, det_smul_right, key] + + theorem dir_mem_arcCCW_iff (hd : d ≠ 0) : dir d ∈ arcCCW u w ↔ d ∈ arcCCW u w := by + obtain ⟨c, hc, hcd⟩ := dir_eq_smul hd +@@ -432,7 +432,7 @@ + by_cases h : 0 < det w u + · have : arcCCW u w = {d : Plane | 0 < det u d} ∪ {d : Plane | 0 < det d w} := by + ext d +- simp only [arcCCW, mem_setOf_eq, mem_union] ++ simp only [arcCCW, mem_ofPred_eq, mem_union] + constructor + · rintro (⟨h1, _⟩ | ⟨h2, _⟩ | ⟨_, h1⟩) <;> tauto + · rintro (hx | hx) +@@ -442,7 +442,7 @@ + exact h1.union h2 + · have : arcCCW u w = {d : Plane | 0 < det u d} ∩ {d : Plane | 0 < det d w} := by + ext d +- simp only [arcCCW, mem_setOf_eq, mem_inter_iff] ++ simp only [arcCCW, mem_ofPred_eq, mem_inter_iff] + constructor + · rintro (hx | ⟨_, hx⟩ | ⟨hx, _⟩) <;> [exact hx; exact absurd hx h; exact absurd hx h] + · exact Or.inl +diff --git a/Schoenflies/Endgame.lean b/Schoenflies/Endgame.lean +--- a/Schoenflies/Endgame.lean ++++ b/Schoenflies/Endgame.lean +@@ -112,28 +112,28 @@ + classical + refine ⟨fun z => if hz : z ∈ S then (e ⟨z, hz⟩ : Plane) else z, + fun w => if hw : w ∈ T then (e.symm ⟨w, hw⟩ : Plane) else w, +- ⟨?_, ?_, ?_, ?_, ?_, ?_⟩, fun z hz => dif_pos hz⟩ +- · exact fun z hz => by simp only [dif_pos hz]; exact (e ⟨z, hz⟩).2 +- · exact fun w hw => by simp only [dif_pos hw]; exact (e.symm ⟨w, hw⟩).2 +- · rw [continuousOn_iff_continuous_restrict] +- have heq : (S.restrict fun z => if hz : z ∈ S then (e ⟨z, hz⟩ : Plane) else z) = ++ ⟨?_, ?_, ?_, ?_, ?_, ?_⟩, fun z hz => dite_eq_left hz⟩ ++ · exact fun z hz => by simp only [dite_eq_left hz]; exact (e ⟨z, hz⟩).2 ++ · exact fun w hw => by simp only [dite_eq_left hw]; exact (e.symm ⟨w, hw⟩).2 ++ · rw [continuousOn_iff_continuous_domRestrict] ++ have heq : (S.domRestrict fun z => if hz : z ∈ S then (e ⟨z, hz⟩ : Plane) else z) = + fun z : ↥S => (e z : Plane) := by + funext z +- simp only [Set.restrict_apply, dif_pos z.2] ++ simp only [Set.domRestrict_apply, dite_eq_left z.2] + rw [heq] + exact continuous_subtype_val.comp e.continuous +- · rw [continuousOn_iff_continuous_restrict] +- have heq : (T.restrict fun w => if hw : w ∈ T then (e.symm ⟨w, hw⟩ : Plane) else w) = ++ · rw [continuousOn_iff_continuous_domRestrict] ++ have heq : (T.domRestrict fun w => if hw : w ∈ T then (e.symm ⟨w, hw⟩ : Plane) else w) = + fun w : ↥T => (e.symm w : Plane) := by + funext w +- simp only [Set.restrict_apply, dif_pos w.2] ++ simp only [Set.domRestrict_apply, dite_eq_left w.2] + rw [heq] + exact continuous_subtype_val.comp e.symm.continuous + · intro z hz +- simp only [dif_pos hz, dif_pos (e ⟨z, hz⟩).2] ++ simp only [dite_eq_left hz, dite_eq_left (e ⟨z, hz⟩).2] + exact congrArg Subtype.val (e.symm_apply_apply ⟨z, hz⟩) + · intro w hw +- simp only [dif_pos hw, dif_pos (e.symm ⟨w, hw⟩).2] ++ simp only [dite_eq_left hw, dite_eq_left (e.symm ⟨w, hw⟩).2] + exact congrArg Subtype.val (e.apply_symm_apply ⟨w, hw⟩) + + namespace IsHomeoOn +@@ -196,11 +196,11 @@ + + theorem paste_of_mem {S : Set Plane} {f₁ f₂ : Plane → Plane} {z : Plane} (hz : z ∈ S) : + paste S f₁ f₂ z = f₁ z := by +- classical exact if_pos hz ++ classical exact ite_eq_left hz + + theorem paste_of_notMem {S : Set Plane} {f₁ f₂ : Plane → Plane} {z : Plane} (hz : z ∉ S) : + paste S f₁ f₂ z = f₂ z := by +- classical exact if_neg hz ++ classical exact ite_eq_right hz + + /-! ### The square `Q` and its boundary `S` + +diff --git a/Schoenflies/FaceCyclesProof.lean b/Schoenflies/FaceCyclesProof.lean +--- a/Schoenflies/FaceCyclesProof.lean ++++ b/Schoenflies/FaceCyclesProof.lean +@@ -840,7 +840,7 @@ + (hint : ∀ y ∈ G.walkVertices a D', y ≠ a → y ≠ b → y ∉ V(B)) + (hnew : ∀ g ∈ D', g ∉ E(B)) : + HasFaceCycles (B.union (G.pathGraphOf a D')) drawing := by +- haveI : B.Finite := Finite.of_le hBG ++ have : B.Finite := Finite.of_le hBG + have hB : IsDrawing B drawing := h.mono hBG + have hne : D' ≠ [] := hpath.ne_nil hab + have hPG : G.pathGraphOf a D' ≤ G := pathGraphOf_le hpath.isWalk +diff --git a/Schoenflies/FiniteTransfer.lean b/Schoenflies/FiniteTransfer.lean +--- a/Schoenflies/FiniteTransfer.lean ++++ b/Schoenflies/FiniteTransfer.lean +@@ -735,7 +735,7 @@ + (ι : Type*) [Finite ι] : + ∃ fresh : ι → γ, Function.Injective fresh ∧ ∀ i, fresh i ∉ used := by + classical +- letI : Fintype ι := Fintype.ofFinite ι ++ let : Fintype ι := Fintype.ofFinite ι + let code : ι ↪ ℕ := (Fintype.equivFin ι).toEmbedding.trans Fin.valEmbedding + let supply : ℕ ↪ {x // x ∈ (usedᶜ : Set γ)} := + hused.infinite_compl.natEmbedding (usedᶜ : Set γ) +@@ -753,7 +753,7 @@ + ∀ x ∈ s, x ≠ a → x ≠ b → name x ∉ used := by + classical + let inner := {x : α // x ∈ s ∧ x ≠ a ∧ x ≠ b} +- letI : Finite inner := Set.finite_coe_iff.mpr (hs.subset fun x hx => hx.1) ++ let : Finite inner := Set.finite_coe_iff.mpr (hs.subset fun x hx => hx.1) + obtain ⟨fresh, hfresh, havoid⟩ := exists_injective_avoiding used hused inner + let name : α → γ := fun x => + if hxa : x = a then u else if hxb : x = b then v +@@ -1148,7 +1148,7 @@ + exact vname_fresh x hxQ (fun h => hxab (Or.inl h)) (fun h => hxab (Or.inr h)) hzCell + let edgeUsed : Set γ := T.str.cells ∪ newVertices + have hedgeUsed_fin : edgeUsed.Finite := T.str.finite_cells.union hnewVertices_fin +- letI : Finite E(Q) := Set.finite_coe_iff.mpr hQfinE ++ let : Finite E(Q) := Set.finite_coe_iff.mpr hQfinE + obtain ⟨freshEdge, freshEdge_inj, freshEdge_avoid⟩ := + exists_injective_avoiding edgeUsed hedgeUsed_fin E(Q) + let ename : γ → γ := fun e => if he : e ∈ E(Q) then freshEdge ⟨e, he⟩ else u +@@ -1383,7 +1383,7 @@ + (hsub : CommonSubdivision P H Hdraw) (hstep : EarStep P H Hdraw) : + ∃ (T : GeneratedPair S₀ srcOuter srcDom tgtOuter tgtDom) (par : γ → γ), + IsPartialTransferOf T P H Hdraw par := by +- haveI := hH.finite ++ have := hH.finite + obtain ⟨K, T₀, par₀, hK, hKH, hbase⟩ := hsub + refine hH.isTwoConnected.ear_decomposition + (motive := fun B => ∃ T par, IsPartialTransferOf T P B Hdraw par) +@@ -1549,7 +1549,7 @@ + exact fun hmem => Set.disjoint_left.1 + (P.tgt.disjoint_cell_skeletonSet P.tgt_isCellDecomposition hF) hmem + (P.tgt.pos_mem_skeletonSet hv) +- letI : (P.str.skel.map P.tgt.pos).Finite := { ++ let : (P.str.skel.map P.tgt.pos).Finite := { + finite_vertexSet := by + rw [Graph.vertexSet_map] + exact P.str.finite_vertexSet.image _ +diff --git a/Schoenflies/FiniteTransferTarget.lean b/Schoenflies/FiniteTransferTarget.lean +--- a/Schoenflies/FiniteTransferTarget.lean ++++ b/Schoenflies/FiniteTransferTarget.lean +@@ -561,7 +561,7 @@ + exact vname_fresh x hxQ (fun h => hxab (Or.inl h)) (fun h => hxab (Or.inr h)) hzCell + let edgeUsed : Set γ := T.str.cells ∪ newVertices + have hedgeUsed_fin : edgeUsed.Finite := T.str.finite_cells.union hnewVertices_fin +- letI : Finite E(Q) := Set.finite_coe_iff.mpr hQfinE ++ let : Finite E(Q) := Set.finite_coe_iff.mpr hQfinE + obtain ⟨freshEdge, freshEdge_inj, freshEdge_avoid⟩ := + exists_injective_avoiding edgeUsed hedgeUsed_fin E(Q) + let ename : γ → γ := fun e => if he : e ∈ E(Q) then freshEdge ⟨e, he⟩ else u +@@ -1128,8 +1128,8 @@ + T.str.OuterOnlyAt w.splitData.source) ∧ + (T.src.pos w.splitData.target ∈ srcOuter → + T.str.OuterOnlyAt w.splitData.target) := by +- letI : H.Finite := hH.finite +- letI : B.Finite := Graph.Finite.of_le hBH ++ let : H.Finite := hH.finite ++ let : B.Finite := Graph.Finite.of_le hBH + have hBdraw := hH.isDrawing.mono hBH + have hinside : Graph.edgesCover Hdraw D \ {a, b} ⊆ + T.tgt.cell w.splitData.face := by +@@ -1431,7 +1431,7 @@ + rw [← hGunion, Graph.pointSet_union] + change pointSet G T.src.drawing ∪ T.src.outerSet = _ + rw [T.src_isWeaklyAdmissible.outerSet_eq] +- letI : G.Finite := Graph.Finite.of_le Graph.deleteEdges_le ++ let : G.Finite := Graph.Finite.of_le Graph.deleteEdges_le + have hGdraw : G.IsDrawing T.src.drawing := T.src.isDrawing.mono Graph.deleteEdges_le + have hGpoly : ∀ e ∈ E(G), IsPolygonal (edgeArc T.src.drawing e) := by + intro e he +@@ -1441,7 +1441,7 @@ + have hFcells : T.src.cell F ∈ cells := ⟨F, hF, rfl⟩ + have hdisj : Disjoint (T.src.cell F) T.src.skeletonSet := + T.src.disjoint_cell_skeletonSet T.src_isCellDecomposition hF +- letI : O.Finite := Graph.Finite.of_le hOle ++ let : O.Finite := Graph.Finite.of_le hOle + have houterCompact : IsCompact srcOuter := by + rw [← T.src_isWeaklyAdmissible.outerSet_eq] + exact T.src.isCompact_skeletonSet.of_isClosed_subset +@@ -1794,7 +1794,7 @@ + (hsub : TargetCommonSubdivision P H Hdraw) (hstep : TargetEarStep P H Hdraw) : + ∃ (T : GeneratedPair S₀ srcOuter srcDom tgtOuter tgtDom) (par : γ → γ), + IsTargetPartialTransferOf T P H Hdraw par := by +- haveI := hH.finite ++ have := hH.finite + obtain ⟨K, T₀, par₀, hK, hKH, hbase⟩ := hsub + refine hH.isTwoConnected.ear_decomposition + (motive := fun B => ∃ T par, IsTargetPartialTransferOf T P B Hdraw par) +diff --git a/Schoenflies/FiniteTransferTargetMesh.lean b/Schoenflies/FiniteTransferTargetMesh.lean +--- a/Schoenflies/FiniteTransferTargetMesh.lean ++++ b/Schoenflies/FiniteTransferTargetMesh.lean +@@ -112,12 +112,12 @@ + · intro e he g hg heg + have hnames : freshName (⟨e, he⟩ : E(H)) = freshName ⟨g, hg⟩ := by + dsimp only [name] at heg +- rw [dif_pos he, dif_pos hg] at heg ++ rw [dite_eq_left he, dite_eq_left hg] at heg + exact heg + exact congrArg Subtype.val (hfreshName hnames) + · intro e he + dsimp only [name] +- rw [dif_pos he] ++ rw [dite_eq_left he] + exact havoid (⟨e, he⟩ : E(H)) + + /-- A finite square mesh can have all of its edges injectively renamed into any infinite cell +diff --git a/Schoenflies/FreshDenseSelection.lean b/Schoenflies/FreshDenseSelection.lean +--- a/Schoenflies/FreshDenseSelection.lean ++++ b/Schoenflies/FreshDenseSelection.lean +@@ -58,8 +58,8 @@ + have hforbiddenFinite : forbidden'.Finite := by + apply hforbidden.preimage + exact Set.injOn_of_injective Subtype.val_injective +- letI : ConnectedSpace C := Subtype.connectedSpace hC.isConnected +- letI : Nontrivial C := by ++ let : ConnectedSpace C := Subtype.connectedSpace hC.isConnected ++ let : Nontrivial C := by + obtain ⟨x, hx, y, hy, hxy⟩ := hC.exists_ne + exact ⟨⟨⟨x, hx⟩, ⟨y, hy⟩, fun h => hxy (congrArg Subtype.val h)⟩⟩ + have hcleanDense : Dense (eligible' \ forbidden') := +@@ -345,7 +345,7 @@ + StronglyAccessible (srcDom \ srcOuter) (P.homeo.invFun z)) ∧ + FreshAvoidsTargetNonouterEdges P fresh ∧ FreshDense fresh delta ∧ + FreshNet fresh delta := by +- letI : Graph.Finite P.tgt.graph := ++ let : Graph.Finite P.tgt.graph := + CellStructure.Realization.finite_graph P.tgt + have haccessibleSubset : accessibleTargetBoundary P ⊆ modelCurve := + fun _ hz => hz.1 +diff --git a/Schoenflies/GeneratedStructure.lean b/Schoenflies/GeneratedStructure.lean +--- a/Schoenflies/GeneratedStructure.lean ++++ b/Schoenflies/GeneratedStructure.lean +@@ -375,14 +375,14 @@ + + @[simp] theorem skeleton_vertexSet : V(d.skeleton) = insert d.newVertex V(S.skel) := by + ext z +- simp only [skeleton, subdivGraph_vertexSet, Set.mem_union, Set.mem_setOf_eq, ++ simp only [skeleton, subdivGraph_vertexSet, Set.mem_union, Set.mem_ofPred_eq, + Set.mem_insert_iff, d.isLink, and_true] + tauto + + @[simp] theorem skeleton_edgeSet : + E(d.skeleton) = insert d.newEdge₁ (insert d.newEdge₂ (E(S.skel) \ {d.edge})) := by + ext f +- simp only [skeleton, subdivGraph_edgeSet, Set.mem_union, Set.mem_setOf_eq, ++ simp only [skeleton, subdivGraph_edgeSet, Set.mem_union, Set.mem_ofPred_eq, + Set.mem_insert_iff, d.isLink, and_true] + tauto + +@@ -405,7 +405,7 @@ + theorem outer_edgeSet_of_mem (he : d.edge ∈ E(S.outerGraph)) : + E(d.outer) = insert d.newEdge₁ (insert d.newEdge₂ (E(S.outerGraph) \ {d.edge})) := by + ext f +- simp only [outer, subdivGraph_edgeSet, Set.mem_union, Set.mem_setOf_eq, ++ simp only [outer, subdivGraph_edgeSet, Set.mem_union, Set.mem_ofPred_eq, + Set.mem_insert_iff, d.outer_isLink he, and_true] + tauto + +@@ -1035,10 +1035,10 @@ + noncomputable def parent : γ → γ := fun σ => if σ ∈ d.newCells then d.edge else σ + + theorem parent_of_mem_newCells {σ : γ} (h : σ ∈ d.newCells) : d.parent σ = d.edge := by +- rw [parent]; exact if_pos h ++ rw [parent]; exact ite_eq_left h + + theorem parent_of_notMem_newCells {σ : γ} (h : σ ∉ d.newCells) : d.parent σ = σ := by +- rw [parent]; exact if_neg h ++ rw [parent]; exact ite_eq_right h + + theorem parent_of_mem_cells {σ : γ} (h : σ ∈ S.cells) : d.parent σ = σ := + d.parent_of_notMem_newCells (notMem_newCells_of_mem_cells h) +@@ -1361,10 +1361,10 @@ + noncomputable def parent : γ → γ := fun σ => if σ ∈ d.newCells then d.face else σ + + theorem parent_of_mem_newCells {σ : γ} (h : σ ∈ d.newCells) : d.parent σ = d.face := by +- rw [parent]; exact if_pos h ++ rw [parent]; exact ite_eq_left h + + theorem parent_of_notMem_newCells {σ : γ} (h : σ ∉ d.newCells) : d.parent σ = σ := by +- rw [parent]; exact if_neg h ++ rw [parent]; exact ite_eq_right h + + theorem parent_of_mem_cells {σ : γ} (h : σ ∈ S.cells) : d.parent σ = σ := + d.parent_of_notMem_newCells (notMem_newCells_of_mem_cells h) +@@ -1689,11 +1689,11 @@ + intro τ hτ + rw [subdivideEdge_cells] at hτ + ext z +- simp only [Set.mem_iUnion, Set.mem_setOf_eq, exists_prop] ++ simp only [Set.mem_iUnion, Set.mem_ofPred_eq, exists_prop] + rcases hτ with ⟨hτc, hτe⟩ | hτn + · -- a surviving cell: the index set gains the new cells exactly when it had `e` + rw [href.cell_eq hτc hτe, h.closure_eq hτc] +- simp only [Set.mem_iUnion, Set.mem_setOf_eq, exists_prop] ++ simp only [Set.mem_iUnion, Set.mem_ofPred_eq, exists_prop] + constructor + · rintro ⟨σ, ⟨hσc, hσsub⟩, hz⟩ + by_cases hσe : σ = d.edge +diff --git a/Schoenflies/Graph/Cycle.lean b/Schoenflies/Graph/Cycle.lean +--- a/Schoenflies/Graph/Cycle.lean ++++ b/Schoenflies/Graph/Cycle.lean +@@ -61,7 +61,7 @@ + edge lies on a cycle if and only if deleting it does not disconnect its endpoints", both + directions, with the finiteness the proof does not use dropped. The two halves are + `Graph.LiesOnCycle.deleteEdges_reaches` and `Graph.LiesOnCycle.of_deleteEdges_reaches`. +-* `Graph.IsBridge`, `Graph.isBridge_iff_not_reaches` — the bridges of ++* `Graph.IsSchoenfliesBridge`, `Graph.isBridge_iff_not_reaches` — the bridges of + `lem:subdivision-ear-preserve` ("a 2-connected graph has no bridge. Indeed, if `uv` were a + bridge, the two components of `G - uv` …"), stated as the separation of the two ends. + * `Graph.IsAcyclic`, `Graph.Connected.deleteEdges_singleton` — the acyclicity underneath +@@ -281,41 +281,41 @@ + + /-! ### Bridges -/ + +-/-- `G.IsBridge e` : an edge of `G` that lies on no cycle. Equivalently — and this is the ++/-- `G.IsSchoenfliesBridge e` : an edge of `G` that lies on no cycle. Equivalently — and this is the + form every use wants — an edge whose deletion separates its two ends + (`Graph.isBridge_iff_not_reaches`). -/ +-def IsBridge (G : Graph α β) (e : β) : Prop := e ∈ E(G) ∧ ¬ G.LiesOnCycle e +- +-theorem IsBridge.edge_mem (h : G.IsBridge e) : e ∈ E(G) := h.1 +- +-theorem IsBridge.not_liesOnCycle (h : G.IsBridge e) : ¬ G.LiesOnCycle e := h.2 ++def IsSchoenfliesBridge (G : Graph α β) (e : β) : Prop := e ∈ E(G) ∧ ¬ G.LiesOnCycle e ++ ++theorem IsSchoenfliesBridge.edge_mem (h : G.IsSchoenfliesBridge e) : e ∈ E(G) := h.1 ++ ++theorem IsSchoenfliesBridge.not_liesOnCycle (h : G.IsSchoenfliesBridge e) : ¬ G.LiesOnCycle e := h.2 + + /-- **Deleting a bridge separates its ends.** -/ +-theorem IsBridge.not_reaches (h : G.IsBridge e) (hl : G.IsLink e u v) : ++theorem IsSchoenfliesBridge.not_reaches (h : G.IsSchoenfliesBridge e) (hl : G.IsLink e u v) : + ¬ (G.deleteEdges {e}).Reaches u v := + fun hR ↦ h.not_liesOnCycle (LiesOnCycle.of_deleteEdges_reaches hl hR) + + /-- **An edge whose deletion separates its ends is a bridge.** -/ + theorem isBridge_of_not_reaches (hl : G.IsLink e u v) +- (h : ¬ (G.deleteEdges {e}).Reaches u v) : G.IsBridge e := ++ (h : ¬ (G.deleteEdges {e}).Reaches u v) : G.IsSchoenfliesBridge e := + ⟨hl.edge_mem, fun hc ↦ h (hc.deleteEdges_reaches hl)⟩ + + /-- **A bridge is exactly an edge whose deletion separates its ends** — the cycle criterion, + negated. -/ + theorem isBridge_iff_not_reaches (hl : G.IsLink e u v) : +- G.IsBridge e ↔ ¬ (G.deleteEdges {e}).Reaches u v := ++ G.IsSchoenfliesBridge e ↔ ¬ (G.deleteEdges {e}).Reaches u v := + ⟨fun h ↦ h.not_reaches hl, isBridge_of_not_reaches hl⟩ + + /-- A bridge is never a loop: a loop is a cycle. -/ +-theorem IsBridge.not_isLoopAt (h : G.IsBridge e) (x : α) : ¬ G.IsLoopAt e x := ++theorem IsSchoenfliesBridge.not_isLoopAt (h : G.IsSchoenfliesBridge e) (x : α) : ¬ G.IsLoopAt e x := + fun hloop ↦ h.not_liesOnCycle (liesOnCycle_of_isLoopAt hloop) + + /-- **A graph is acyclic exactly when every one of its edges is a bridge.** This is the form + the tree module wants acyclicity in: "it is a tree — an edge of a cycle could be deleted" + reads backwards as "no edge can be deleted without separating its ends". -/ +-theorem isAcyclic_iff_forall_isBridge : G.IsAcyclic ↔ ∀ e ∈ E(G), G.IsBridge e := ++theorem isAcyclic_iff_forall_isBridge : G.IsAcyclic ↔ ∀ e ∈ E(G), G.IsSchoenfliesBridge e := + ⟨fun h _ he ↦ ⟨he, h he⟩, fun h _ he ↦ (h _ he).not_liesOnCycle⟩ + +-theorem IsAcyclic.isBridge (h : G.IsAcyclic) (he : e ∈ E(G)) : G.IsBridge e := ⟨he, h he⟩ ++theorem IsAcyclic.isBridge (h : G.IsAcyclic) (he : e ∈ E(G)) : G.IsSchoenfliesBridge e := ⟨he, h he⟩ + + end Graph +diff --git a/Schoenflies/Graph/Degree.lean b/Schoenflies/Graph/Degree.lean +--- a/Schoenflies/Graph/Degree.lean ++++ b/Schoenflies/Graph/Degree.lean +@@ -231,23 +231,23 @@ + have hl : G.IsLoopAt e u := huv + have h1 : {x | G.Inc e x} = {u} := by + ext z +- simp only [Set.mem_setOf_eq, Set.mem_singleton_iff] ++ simp only [Set.mem_ofPred_eq, Set.mem_singleton_iff] + exact ⟨fun h => (hl.eq_of_inc h).symm, fun h => h ▸ hl.inc⟩ + have h2 : {x | G.IsLoopAt e x} = {u} := by + ext z +- simp only [Set.mem_setOf_eq, Set.mem_singleton_iff] ++ simp only [Set.mem_ofPred_eq, Set.mem_singleton_iff] + exact ⟨fun h => (hl.eq_of_inc h.inc).symm, fun h => h ▸ hl⟩ + rw [h1, h2] + simp + · -- A non-loop: two distinct vertices, one end at each, and no loop anywhere. + have h1 : {x | G.Inc e x} = {u, v} := by + ext z +- simp only [Set.mem_setOf_eq, Set.mem_insert_iff, Set.mem_singleton_iff] ++ simp only [Set.mem_ofPred_eq, Set.mem_insert_iff, Set.mem_singleton_iff] + exact ⟨fun h => h.eq_or_eq_of_isLink huv, + fun h => h.elim (fun hz => hz ▸ huv.inc_left) (fun hz => hz ▸ huv.inc_right)⟩ + have h2 : {x | G.IsLoopAt e x} = ∅ := by + ext z +- simp only [Set.mem_setOf_eq, Set.mem_empty_iff_false, iff_false] ++ simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false] + intro hz + exact huv' ((hz.eq_of_inc huv.inc_left).symm.trans (hz.eq_of_inc huv.inc_right)) + rw [h1, h2, Set.ncard_pair huv'] +@@ -264,7 +264,7 @@ + rw [← Finset.card_filter p s, ← Set.ncard_coe_finset] + congr 1 + ext z +- simp only [Finset.coe_filter, Set.mem_setOf_eq] ++ simp only [Finset.coe_filter, Set.mem_ofPred_eq] + exact ⟨fun h => ⟨hsub z h, h⟩, fun h => h.2⟩ + + /-- **The handshake lemma.** The degrees of the vertices of a finite multigraph add up to +diff --git a/Schoenflies/Graph/K33Land.lean b/Schoenflies/Graph/K33Land.lean +--- a/Schoenflies/Graph/K33Land.lean ++++ b/Schoenflies/Graph/K33Land.lean +@@ -154,10 +154,10 @@ + have := ZMod.val_lt j; omega + have hw_lt : ∀ j : ZMod (n + 3), j.val < k → + w j = P.vertex (a + ((j.val : ℕ) : ZMod (m + 3))) := fun j hj => by +- rw [hwdef]; exact if_pos hj ++ rw [hwdef]; exact ite_eq_left hj + have hw_ge : ∀ j : ZMod (n + 3), ¬ j.val < k → + w j = P'.vertex (b + ((j.val - k : ℕ) : ZMod (m' + 3))) := fun j hj => by +- rw [hwdef]; exact if_neg hj ++ rw [hwdef]; exact ite_eq_right hj + have hsucc_lt : ∀ j : ZMod (n + 3), j.val < k → + w (j + 1) = P.vertex (a + ((j.val : ℕ) : ZMod (m + 3)) + 1) := by + intro j hj +diff --git a/Schoenflies/Graph/OuterFace.lean b/Schoenflies/Graph/OuterFace.lean +--- a/Schoenflies/Graph/OuterFace.lean ++++ b/Schoenflies/Graph/OuterFace.lean +@@ -90,7 +90,7 @@ + have hmem : Schoenflies.Plane.mk t 0 ∈ Schoenflies.Plane.beyondSquare r := + Or.inl (show r < |t| by rw [abs_of_nonneg ht0]; exact htr) + have hin := hs hmem +- simp only [Schoenflies.Plane.closedSquare, mem_setOf_eq, Schoenflies.Plane.supDist_zero, ++ simp only [Schoenflies.Plane.closedSquare, mem_ofPred_eq, Schoenflies.Plane.supDist_zero, + Schoenflies.Plane.supNorm, max_le_iff] at hin + have h1 : |t| ≤ s := hin.1 + rw [abs_of_nonneg ht0] at h1 +diff --git a/Schoenflies/Graph/PathGraph.lean b/Schoenflies/Graph/PathGraph.lean +--- a/Schoenflies/Graph/PathGraph.lean ++++ b/Schoenflies/Graph/PathGraph.lean +@@ -245,7 +245,7 @@ + theorem pathGraphOf_isLink : + (G.pathGraphOf u W).IsLink e x y ↔ + e ∈ W ∧ G.IsLink e x y ∧ x ∈ G.walkVertices u W ∧ y ∈ G.walkVertices u W := by +- simp only [pathGraphOf, induce_isLink, restrict_isLink, mem_setOf_eq] ++ simp only [pathGraphOf, induce_isLink, restrict_isLink, mem_ofPred_eq] + tauto + + theorem mem_vertexSet_pathGraphOf_self : u ∈ V(G.pathGraphOf u W) := mem_walkVertices_self +@@ -258,8 +258,8 @@ + walk, to know that an entry of `W` is an edge of `G` at all and that its ends are visited. -/ + theorem pathGraphOf_edgeSet (h : G.IsWalk u W v) : E(G.pathGraphOf u W) = {e | e ∈ W} := by + ext f +- rw [edgeSet_eq_setOf_exists_isLink] +- simp only [pathGraphOf_isLink, mem_setOf_eq] ++ rw [edgeSet_eq_setOfPred_exists_isLink] ++ simp only [pathGraphOf_isLink, mem_ofPred_eq] + refine ⟨fun ⟨_, _, hf, _⟩ ↦ hf, fun hf ↦ ?_⟩ + obtain ⟨a, b, hab⟩ := exists_isLink_of_mem_edgeSet (h.edge_mem hf) + exact ⟨a, b, hf, hab, mem_walkVertices_of_mem_covered ⟨f, hf, hab.inc_left⟩, +diff --git a/Schoenflies/Graph/Tree.lean b/Schoenflies/Graph/Tree.lean +--- a/Schoenflies/Graph/Tree.lean ++++ b/Schoenflies/Graph/Tree.lean +@@ -241,7 +241,7 @@ + refine h.anti deleteVerts_le ?_ fun g hg ↦ ?_ + · exact ⟨h.left_mem, hX u mem_walkVertices_self⟩ + · obtain ⟨p, q, hpq⟩ := exists_isLink_of_mem_edgeSet (h.edge_mem hg) +- simp only [edgeSet_deleteVerts, Set.mem_setOf_eq] ++ simp only [edgeSet_deleteVerts, Set.mem_ofPred_eq] + exact ⟨p, q, hpq, hX p (mem_walkVertices_of_mem_covered ⟨g, hg, hpq.inc_left⟩), + hX q (mem_walkVertices_of_mem_covered ⟨g, hg, hpq.inc_right⟩)⟩ + +@@ -249,7 +249,7 @@ + theorem edgeSet_deleteVerts_singleton (G : Graph α β) (x : α) : + E(G.deleteVerts {x}) = E(G) \ G.incidenceSet x := by + ext g +- simp only [edgeSet_deleteVerts, Set.mem_setOf_eq, Set.mem_sdiff, mem_incidenceSet, ++ simp only [edgeSet_deleteVerts, Set.mem_ofPred_eq, Set.mem_sdiff, mem_incidenceSet, + Set.mem_singleton_iff] + refine ⟨fun ⟨p, q, hpq, hp, hq⟩ ↦ ⟨hpq.edge_mem, fun hinc ↦ ?_⟩, fun ⟨hg, hninc⟩ ↦ ?_⟩ + · rcases hinc.eq_or_eq_of_isLink hpq with rfl | rfl +@@ -282,16 +282,16 @@ + induction n with + | zero => + intro G hfin hle hT +- haveI := hfin ++ have := hfin + obtain ⟨a, ha⟩ := hT.connected.nonempty + have := (Set.ncard_pos (finite_vertexSet G)).2 ⟨a, ha⟩ + omega + | succ n ih => + intro G hfin hle hT +- haveI := hfin ++ have := hfin + by_cases h2 : 2 ≤ V(G).ncard + · obtain ⟨x, hx⟩ := hT.has_leaf h2 +- haveI : (G.deleteVerts {x}).Finite := Finite.of_le deleteVerts_le ++ have : (G.deleteVerts {x}).Finite := Finite.of_le deleteVerts_le + have hT' : (G.deleteVerts {x}).IsTree := hT.delete_leaf hx h2 + have hV : V(G.deleteVerts {x}).ncard = V(G).ncard - 1 := by + rw [vertexSet_deleteVerts, Set.ncard_sdiff_singleton_of_mem hx.mem_vertexSet] +diff --git a/Schoenflies/GridAttach.lean b/Schoenflies/GridAttach.lean +--- a/Schoenflies/GridAttach.lean ++++ b/Schoenflies/GridAttach.lean +@@ -184,7 +184,7 @@ + Graph.SameLinks (pieceListGraph (subdivide pieces points)) (overlayGraph pieces points) := by + constructor + · ext v +- simp only [pieceListGraph_vertexSet, overlayGraph_vertexSet, endSet, mem_setOf_eq] ++ simp only [pieceListGraph_vertexSet, overlayGraph_vertexSet, endSet, mem_ofPred_eq] + constructor + · rintro ⟨P, hP, hv⟩ + exact ⟨orientPiece P, mem_overlayPieces.2 ⟨P, hP, rfl⟩, (orientPiece_ends P v).2 hv⟩ +@@ -346,12 +346,12 @@ + · rintro ⟨P, hP, hx⟩ + rw [List.mem_singleton] at hP + subst hP +- simp only [Graph.walkVertices, mem_insert_iff, Graph.coveredVertices, mem_setOf_eq] ++ simp only [Graph.walkVertices, mem_insert_iff, Graph.coveredVertices, mem_ofPred_eq] + rcases hx with h | h + · exact Or.inl h + · exact Or.inr ⟨(q₀, q₁), hmem, pieceListGraph_inc hmem (Or.inr h)⟩ + · intro hx +- simp only [Graph.walkVertices, mem_insert_iff, Graph.coveredVertices, mem_setOf_eq] at hx ++ simp only [Graph.walkVertices, mem_insert_iff, Graph.coveredVertices, mem_ofPred_eq] at hx + rcases hx with h | ⟨e, he, hinc⟩ + · exact ⟨(q₀, q₁), hmem, Or.inl h⟩ + · rw [List.mem_singleton] at he +diff --git a/Schoenflies/InitialPair.lean b/Schoenflies/InitialPair.lean +--- a/Schoenflies/InitialPair.lean ++++ b/Schoenflies/InitialPair.lean +@@ -154,28 +154,28 @@ + obtain ⟨h⟩ := hC.homeomorph_modelCurve + refine ⟨fun p => if hp : p ∈ C then (h ⟨p, hp⟩ : Plane) else 0, + fun q => if hq : q ∈ modelCurve then (h.symm ⟨q, hq⟩ : Plane) else 0, ?_, ?_, ?_, ?_, ?_, ?_⟩ +- · rw [continuousOn_iff_continuous_restrict] +- have : (C.restrict fun p => if hp : p ∈ C then (h ⟨p, hp⟩ : Plane) else 0) = ++ · rw [continuousOn_iff_continuous_domRestrict] ++ have : (C.domRestrict fun p => if hp : p ∈ C then (h ⟨p, hp⟩ : Plane) else 0) = + fun p : ↥C => (h p : Plane) := by +- funext p; simp [Set.restrict, p.2] ++ funext p; simp [Set.domRestrict, p.2] + rw [this] + exact continuous_subtype_val.comp h.continuous +- · rw [continuousOn_iff_continuous_restrict] +- have : (modelCurve.restrict fun q => if hq : q ∈ modelCurve then (h.symm ⟨q, hq⟩ : Plane) ++ · rw [continuousOn_iff_continuous_domRestrict] ++ have : (modelCurve.domRestrict fun q => if hq : q ∈ modelCurve then (h.symm ⟨q, hq⟩ : Plane) + else 0) = fun q : ↥modelCurve => (h.symm q : Plane) := by +- funext q; simp [Set.restrict, q.2] ++ funext q; simp [Set.domRestrict, q.2] + rw [this] + exact continuous_subtype_val.comp h.symm.continuous +- · intro p hp; simp only [dif_pos hp]; exact (h ⟨p, hp⟩).2 +- · intro q hq; simp only [dif_pos hq]; exact (h.symm ⟨q, hq⟩).2 ++ · intro p hp; simp only [dite_eq_left hp]; exact (h ⟨p, hp⟩).2 ++ · intro q hq; simp only [dite_eq_left hq]; exact (h.symm ⟨q, hq⟩).2 + · intro p hp + have hmem : (h ⟨p, hp⟩ : Plane) ∈ modelCurve := (h ⟨p, hp⟩).2 +- simp only [dif_pos hp, dif_pos hmem] ++ simp only [dite_eq_left hp, dite_eq_left hmem] + have : (⟨(h ⟨p, hp⟩ : Plane), hmem⟩ : ↥modelCurve) = h ⟨p, hp⟩ := rfl + rw [this, h.symm_apply_apply] + · intro q hq + have hmem : (h.symm ⟨q, hq⟩ : Plane) ∈ C := (h.symm ⟨q, hq⟩).2 +- simp only [dif_pos hq, dif_pos hmem] ++ simp only [dite_eq_left hq, dite_eq_left hmem] + have : (⟨(h.symm ⟨q, hq⟩ : Plane), hmem⟩ : ↥C) = h.symm ⟨q, hq⟩ := rfl + rw [this, h.apply_symm_apply] + +@@ -1444,10 +1444,10 @@ + d.cross (Function.invFunOn (tgtChord d.xa d.xb) I y) + + theorem skelMap_of_mem {x : Plane} (hx : x ∈ C) : d.skelMap x = d.u x := by +- simp only [skelMap, if_pos hx] ++ simp only [skelMap, ite_eq_left hx] + + theorem skelInv_of_mem {y : Plane} (hy : y ∈ modelCurve) : d.skelInv y = d.w y := by +- simp only [skelInv, if_pos hy] ++ simp only [skelInv, ite_eq_left hy] + + /-- **The skeleton map matches parameters on the crosscut.** -/ + theorem skelMap_cross {t : ℝ} (ht : t ∈ I) : +@@ -1458,7 +1458,7 @@ + simp [tgtChord] + · rw [d.skelMap_of_mem hmem, d.cross_one, d.u_b] + simp [tgtChord] +- · simp only [skelMap, if_neg hmem, d.injOn_cross.leftInvOn_invFunOn ht] ++ · simp only [skelMap, ite_eq_right hmem, d.injOn_cross.leftInvOn_invFunOn ht] + + theorem tgtChord_mem_modelCurve_iff {t : ℝ} (ht : t ∈ I) : + tgtChord d.xa d.xb t ∈ modelCurve ↔ t = 0 ∨ t = 1 := by +@@ -1486,7 +1486,7 @@ + simp [tgtChord] + · rw [d.skelInv_of_mem hmem, d.cross_one] + simp [tgtChord] +- · simp only [skelInv, if_neg hmem, d.injOn_tgtChord.leftInvOn_invFunOn ht] ++ · simp only [skelInv, ite_eq_right hmem, d.injOn_tgtChord.leftInvOn_invFunOn ht] + + /-! #### Continuity and inversion -/ + +diff --git a/Schoenflies/InitialPairFixed.lean b/Schoenflies/InitialPairFixed.lean +--- a/Schoenflies/InitialPairFixed.lean ++++ b/Schoenflies/InitialPairFixed.lean +@@ -307,7 +307,7 @@ + c ∈ faceCells k ↔ + c ∈ initialStructure.pathCells u (initBoundary (.face k)) := by + rw [mem_faceCells_iff] +- simp only [CellStructure.pathCells, Set.mem_union, Set.mem_setOf_eq, ++ simp only [CellStructure.pathCells, Set.mem_union, Set.mem_ofPred_eq, + Graph.mem_walkVertices_iff, Graph.mem_coveredVertices_iff] + constructor + · rintro (hc | hc) +diff --git a/Schoenflies/Inversion.lean b/Schoenflies/Inversion.lean +--- a/Schoenflies/Inversion.lean ++++ b/Schoenflies/Inversion.lean +@@ -172,8 +172,8 @@ + z.2 (mem_singleton_iff.2 (invert_eq_center_iff.1 (mem_singleton_iff.1 h)))⟩ + left_inv z := Subtype.ext (invert_invert a z) + right_inv z := Subtype.ext (invert_invert a z) +- continuous_toFun := ((continuousOn_invert a).restrict).subtype_mk _ +- continuous_invFun := ((continuousOn_invert a).restrict).subtype_mk _ ++ continuous_toFun := ((continuousOn_invert a).domRestrict).subtype_mk _ ++ continuous_invFun := ((continuousOn_invert a).domRestrict).subtype_mk _ + + /-! ### The image of a Jordan curve + +diff --git a/Schoenflies/LimitMap.lean b/Schoenflies/LimitMap.lean +--- a/Schoenflies/LimitMap.lean ++++ b/Schoenflies/LimitMap.lean +@@ -477,7 +477,7 @@ + + /-- **The characterising property of `F`.** -/ + theorem iInter_tgtStar_eq (hx : x ∈ L.dom) : ⋂ n, L.tgtStar n x = {L.F x} := by +- rw [F, dif_pos (L.exists_eq_singleton_iInter_tgtStar hx)] ++ rw [F, dite_eq_left (L.exists_eq_singleton_iInter_tgtStar hx)] + exact (L.exists_eq_singleton_iInter_tgtStar hx).choose_spec + + theorem F_mem_iInter (hx : x ∈ L.dom) : L.F x ∈ ⋂ n, L.tgtStar n x := by +@@ -863,7 +863,7 @@ + + theorem inv_spec (h : ∃ x, x ∈ L.region ∧ L.F x = y) : + L.inv y ∈ L.region ∧ L.F (L.inv y) = y := by +- rw [inv, dif_pos h] ++ rw [inv, dite_eq_left h] + exact h.choose_spec + + theorem inv_mem_region (hy : y ∈ L.region') : L.inv y ∈ L.region := +diff --git a/Schoenflies/LocallyPolygonal.lean b/Schoenflies/LocallyPolygonal.lean +--- a/Schoenflies/LocallyPolygonal.lean ++++ b/Schoenflies/LocallyPolygonal.lean +@@ -185,7 +185,7 @@ + centre in each coordinate separately. -/ + theorem mem_openSquare_iff (c : Plane) (r : ℝ) (x : Plane) : + x ∈ openSquare c r ↔ ∀ i, |x i - c i| < r := by +- simp only [openSquare, mem_setOf_eq, supDist, supNorm, sub_apply, max_lt_iff, ++ simp only [openSquare, mem_ofPred_eq, supDist, supNorm, sub_apply, max_lt_iff, + Fin.forall_fin_two] + + /-- The centre of a square of positive radius is in it. -/ +@@ -246,17 +246,17 @@ + rw [abs_lt] at hlt + cases b + · exact absurd (show x i ≤ c i - r from hmem) (by +- simp only [sideGap, cond_false] at hs; linarith [hlt.1]) ++ simp only [sideGap, Bool.cond_false] at hs; linarith [hlt.1]) + · exact absurd (show c i + r ≤ x i from hmem) (by +- simp only [sideGap, cond_true] at hs; linarith [hlt.2]) ++ simp only [sideGap, Bool.cond_true] at hs; linarith [hlt.2]) + + /-- If there is no room between `p` and a half-plane, `p` is in it. -/ + theorem mem_sideHalfPlane_of_sideGap_nonpos {c : Plane} {r : ℝ} {p : Plane} {i : Fin 2} + {b : Bool} (h : sideGap c r p i b ≤ 0) : p ∈ sideHalfPlane c r i b := by + cases b +- · simp only [sideGap, cond_false] at h ++ · simp only [sideGap, Bool.cond_false] at h + exact show p i ≤ c i - r by linarith +- · simp only [sideGap, cond_true] at h ++ · simp only [sideGap, Bool.cond_true] at h + exact show c i + r ≤ p i by linarith + + /-- Each piece the sides of one square cut a small square into is an axis-parallel rectangle — +@@ -346,7 +346,7 @@ + rintro c ⟨hcA, hcne⟩ + have : p ∉ closedSquare c (ρ c) := + Set.disjoint_left.1 (hdisj c₀ hc₀A c hcA fun h => hcne (h ▸ rfl)) hpc₀ +- simp only [closedSquare, mem_setOf_eq, not_le] at this ++ simp only [closedSquare, mem_ofPred_eq, not_le] at this + linarith + obtain ⟨s₁, hs₁, hs₁le⟩ := exists_pos_le_of_finite (hA.sdiff (t := {c₀})) + (f := fun c => supDist p c - ρ c) hfar +@@ -388,7 +388,7 @@ + have hfar : ∀ c ∈ A, 0 < supDist p c - ρ c := by + intro c hcA + have := hnear c hcA +- simp only [closedSquare, mem_setOf_eq, not_le] at this ++ simp only [closedSquare, mem_ofPred_eq, not_le] at this + linarith + obtain ⟨s, hs, hsle⟩ := exists_pos_le_of_finite hA (f := fun c => supDist p c - ρ c) hfar + refine isLocallyPolyConnAt_of_convex (isOpen_openSquare p s) +diff --git a/Schoenflies/MatchedSplit.lean b/Schoenflies/MatchedSplit.lean +--- a/Schoenflies/MatchedSplit.lean ++++ b/Schoenflies/MatchedSplit.lean +@@ -319,7 +319,7 @@ + theorem splitMap_of_mem_skeletonSet {x : Plane} (hx : x ∈ R₁.skeletonSet) : + splitMap g m x = g.toFun x := by + classical +- simp only [splitMap, if_pos hx] ++ simp only [splitMap, ite_eq_left hx] + + theorem splitMap_eqOn_skeletonSet : EqOn (splitMap g m) g.toFun R₁.skeletonSet := + fun _ hx => splitMap_of_mem_skeletonSet hx +@@ -327,12 +327,12 @@ + theorem splitInvMap_of_mem_skeletonSet {y : Plane} (hy : y ∈ R₂.skeletonSet) : + splitInvMap g m y = g.invFun y := by + classical +- simp only [splitInvMap, if_pos hy] ++ simp only [splitInvMap, ite_eq_left hy] + + theorem splitInvMap_of_notMem_skeletonSet {y : Plane} (hy : y ∉ R₂.skeletonSet) : + splitInvMap g m y = m.invFun y := by + classical +- simp only [splitInvMap, if_neg hy] ++ simp only [splitInvMap, ite_eq_right hy] + + variable (hE₁ : d.EarCrosscut R₁ earPos₁ earDraw₁) (hE₂ : d.EarCrosscut R₂ earPos₂ earDraw₂) + +@@ -345,13 +345,13 @@ + splitMap g m x = m.toFun x := by + classical + by_cases hs : x ∈ R₁.skeletonSet +- · rw [splitMap, if_pos hs] ++ · rw [splitMap, ite_eq_left hs] + have hends := hE₁.earSet_inter_skeletonSet ⟨hx, hs⟩ + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hends + rcases hends with rfl | rfl + · rw [g.pos_apply d.source_mem_skel, m.toFun_pos_source hE₁ hE₂] + · rw [g.pos_apply d.target_mem_skel, m.toFun_pos_target hE₁ hE₂] +- · rw [splitMap, if_neg hs] ++ · rw [splitMap, ite_eq_right hs] + + theorem splitMap_eqOn_earSet : EqOn (splitMap g m) m.toFun (d.earSet earPos₁ earDraw₁) := + fun _ hx => splitMap_of_mem_earSet hE₁ hE₂ hx +@@ -362,7 +362,7 @@ + classical + intro y hy + by_cases hs : y ∈ R₂.skeletonSet +- · rw [splitInvMap, if_pos hs] ++ · rw [splitInvMap, ite_eq_left hs] + have hends := hE₂.earSet_inter_skeletonSet ⟨hy, hs⟩ + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hends + rcases hends with rfl | rfl +@@ -370,7 +370,7 @@ + rw [h, m.invFun_pos_source hE₁ hE₂] + · have h : g.invFun (R₂.pos d.target) = R₁.pos d.target := g.symm.pos_apply d.target_mem_skel + rw [h, m.invFun_pos_target hE₁ hE₂] +- · rw [splitInvMap, if_neg hs] ++ · rw [splitInvMap, ite_eq_right hs] + + /-- **A point of the source ear off the old skeleton is carried off the old target skeleton.** + The image lies on the target ear, and the target ear meets the target skeleton only in the two +diff --git a/Schoenflies/ModelCurve.lean b/Schoenflies/ModelCurve.lean +--- a/Schoenflies/ModelCurve.lean ++++ b/Schoenflies/ModelCurve.lean +@@ -167,7 +167,7 @@ + theorem modelCurve_eq_sides : + modelCurve = (sideTop ∪ sideLeft) ∪ (sideBottom ∪ sideRight) := by + ext x +- simp only [modelCurve, mem_setOf_eq, mem_union, mem_sideTop, mem_sideLeft, mem_sideBottom, ++ simp only [modelCurve, mem_ofPred_eq, mem_union, mem_sideTop, mem_sideLeft, mem_sideBottom, + mem_sideRight, Plane.supNorm] + constructor + · intro h +@@ -373,7 +373,7 @@ + theorem modelCurve_eq_frontier : modelCurve = frontier (Plane.closedSquare 0 1) := by + rw [(Plane.isClosed_closedSquare 0 1).frontier_eq, interior_closedSquare_zero_one] + ext x +- simp only [modelCurve, mem_setOf_eq, mem_sdiff, mem_closedSquare_zero_one, ++ simp only [modelCurve, mem_ofPred_eq, mem_sdiff, mem_closedSquare_zero_one, + mem_openSquare_zero_one, not_lt] + exact ⟨fun h => ⟨h.le, h.ge⟩, fun h => le_antisymm h.1 h.2⟩ + +@@ -420,14 +420,14 @@ + ∃ h : ↥(f '' I) ≃ₜ ↥(g '' I), + ∀ (t : ℝ) (ht : t ∈ I), (h ⟨f t, mem_image_of_mem f ht⟩ : Plane) = g t := by + classical +- haveI : CompactSpace ↥I := isCompact_iff_compactSpace.mp isCompact_I +- haveI : CompactSpace ↥(f '' I) := ++ have : CompactSpace ↥I := isCompact_iff_compactSpace.mp isCompact_I ++ have : CompactSpace ↥(f '' I) := + isCompact_iff_compactSpace.mp (isCompact_I.image_of_continuousOn hf.continuousOn) + -- the two parametrizations, read as maps of subtypes + set q : ↥I → ↥(f '' I) := fun t => ⟨f t, mem_image_of_mem f t.2⟩ with hq + set q' : ↥I → ↥(g '' I) := fun t => ⟨g t, mem_image_of_mem g t.2⟩ with hq' +- have hqc : Continuous q := (hf.continuousOn.restrict).subtype_mk _ +- have hq'c : Continuous q' := (hg.continuousOn.restrict).subtype_mk _ ++ have hqc : Continuous q := (hf.continuousOn.domRestrict).subtype_mk _ ++ have hq'c : Continuous q' := (hg.continuousOn.domRestrict).subtype_mk _ + have hqs : Function.Surjective q := by + rintro ⟨z, t, ht, rfl⟩ + exact ⟨⟨t, ht⟩, rfl⟩ +diff --git a/Schoenflies/OuterChain.lean b/Schoenflies/OuterChain.lean +--- a/Schoenflies/OuterChain.lean ++++ b/Schoenflies/OuterChain.lean +@@ -309,13 +309,13 @@ + have harc : ∀ {W : List β}, (∀ g ∈ W, g ∈ D₁ ++ D₂) → + ∀ g ∈ W, g ∈ E(H.cycleGraph u e D) := by + intro W hW g hg +- rw [hcyc.cycleGraph_edgeSet, Set.mem_setOf_eq, List.mem_append] ++ rw [hcyc.cycleGraph_edgeSet, Set.mem_ofPred_eq, List.mem_append] + rcases List.mem_cons.1 (hcc.split.mem_iff.1 (hW g hg)) with rfl | h + · exact Or.inr (List.mem_singleton_self _) + · exact Or.inl h + have hnew : ∀ g ∈ R, g ∉ E(H.cycleGraph u e D) := by + intro g hg hmem +- rw [hcyc.cycleGraph_edgeSet, Set.mem_setOf_eq] at hmem ++ rw [hcyc.cycleGraph_edgeSet, Set.mem_ofPred_eq] at hmem + exact hcc.edges_new g hg hmem + have hint : ∀ y ∈ H.walkVertices a R, y ≠ a → y ≠ b → y ∉ V(H.cycleGraph u e D) := by + intro y hy hya hyb +@@ -779,7 +779,7 @@ + ¬ Bornology.IsBounded (face (chainUnion Γ 0 n) drawing x) := by + have hext := h.mem_exterior_chain hout + refine ⟨hext, fun hb => ?_⟩ +- haveI : (chainUnion Γ 0 n).Finite := h.block_finite (i := 0) (m := n) (by omega) ++ have : (chainUnion Γ 0 n).Finite := h.block_finite (i := 0) (m := n) (by omega) + exact h.not_encloses hout hdesc n 0 (by omega) + (encloses_of_isBounded_face (h.block_isDrawing (by omega)) (h.block_polygonal (by omega)) + (h.block_isTwoConnected (by omega)) hext hb) +diff --git a/Schoenflies/OverlayExtension.lean b/Schoenflies/OverlayExtension.lean +--- a/Schoenflies/OverlayExtension.lean ++++ b/Schoenflies/OverlayExtension.lean +@@ -22,7 +22,7 @@ + + namespace Schoenflies + +-open Graph ++open _root_.Schoenflies.Graph + + namespace IsPlaneSubdivisionExtension + +diff --git a/Schoenflies/OverlayGraph.lean b/Schoenflies/OverlayGraph.lean +--- a/Schoenflies/OverlayGraph.lean ++++ b/Schoenflies/OverlayGraph.lean +@@ -88,12 +88,12 @@ + + theorem orientPiece_of_precedes {P : Piece} (h : Precedes P.1 P.2) : orientPiece P = P := by + classical +- exact if_pos h ++ exact ite_eq_left h + + theorem orientPiece_of_not_precedes {P : Piece} (h : ¬ Precedes P.1 P.2) : + orientPiece P = (P.2, P.1) := by + classical +- exact if_neg h ++ exact ite_eq_right h + + /-- Orienting does not move the segment. -/ + @[simp] theorem orientPiece_seg (P : Piece) : (orientPiece P).seg = P.seg := by +@@ -247,7 +247,7 @@ + rcases hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases hvw with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> simp + edge_mem_iff_exists_isLink := by + intro P +- simp only [mem_setOf_eq] ++ simp only [mem_ofPred_eq] + exact ⟨fun hP => ⟨P.1, P.2, hP, Or.inl ⟨rfl, rfl⟩⟩, fun ⟨_, _, hP, _⟩ => hP⟩ + left_mem_of_isLink := by + rintro P x y ⟨hP, h⟩ +@@ -347,7 +347,7 @@ + rw [← overlayPieces_cover pieces points] + ext z + simp only [Graph.pointSet, mem_union, mem_iUnion, exists_prop, overlayGraph_vertexSet, +- endSet, mem_setOf_eq, overlayGraph_mem_edgeSet, edgeArc_segmentDrawing, cover] ++ endSet, mem_ofPred_eq, overlayGraph_mem_edgeSet, edgeArc_segmentDrawing, cover] + constructor + · rintro (⟨P, hP, hzP⟩ | ⟨P, hP, hzP⟩) + · refine ⟨P, hP, ?_⟩ +diff --git a/Schoenflies/Parity.lean b/Schoenflies/Parity.lean +--- a/Schoenflies/Parity.lean ++++ b/Schoenflies/Parity.lean +@@ -377,19 +377,22 @@ + by_cases hD : fwd u q < fwd u (meet u a b (hgt u q)) + · by_cases h1 : hgt u a ≤ hgt u q + · by_cases h2 : hgt u q < hgt u c +- · rw [if_pos ⟨h1, h2, hD⟩, if_neg (by rintro ⟨g, -, -⟩; linarith), +- if_pos ⟨h1, by linarith, hD⟩] ++ · rw [ite_eq_left ⟨h1, h2, hD⟩, ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_left ⟨h1, by linarith, hD⟩] + · push Not at h2 + by_cases h3 : hgt u q < hgt u b +- · rw [if_neg (by rintro ⟨-, g, -⟩; linarith), if_pos ⟨h2, h3, hD⟩, +- if_pos ⟨h1, h3, hD⟩] +- · rw [if_neg (by rintro ⟨-, g, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith), +- if_neg (by rintro ⟨-, g, -⟩; linarith)] ++ · rw [ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ite_eq_left ⟨h2, h3, hD⟩, ++ ite_eq_left ⟨h1, h3, hD⟩] ++ · rw [ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] + · push Not at h1 +- rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨g, -, -⟩; linarith), +- if_neg (by rintro ⟨g, -, -⟩; linarith)] +- · rw [if_neg (by rintro ⟨-, -, g⟩; exact hD g), if_neg (by rintro ⟨-, -, g⟩; exact hD g), +- if_neg (by rintro ⟨-, -, g⟩; exact hD g)] ++ rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith)] ++ · rw [ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), ++ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), ++ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g)] + + private theorem crossings_split (hab : hgt u a ≠ hgt u b) (hc : c ∈ openSegment ℝ a b) + (q : Plane) : +@@ -690,52 +693,59 @@ + (meet u a b (hgt u q + s)) (hma _ (by linarith) hB.le) + (hha _).ge (by rw [hha]; linarith) (by rw [hha]; linarith) (hha _).le + by_cases hD : fwd u q < fwd u (meet u a b (hgt u q)) +- · rw [if_pos ⟨hA, by linarith, hD⟩, if_pos ⟨by linarith, hB, e.1 hD⟩, +- if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith)] ++ · rw [ite_eq_left ⟨hA, by linarith, hD⟩, ite_eq_left ⟨by linarith, hB, e.1 hD⟩, ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] + decide +- · rw [if_neg (by rintro ⟨-, -, g⟩; exact hD g), +- if_neg (by rintro ⟨-, -, g⟩; exact hD (e.2 g)), +- if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith)] ++ · rw [ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), ++ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD (e.2 g)), ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] + · rcases lt_or_ge (hgt u q) (hgt u b) with hB2 | hB2 + · -- the sweep passes the upper end + have e := hside (meet u a b (hgt u q)) (hma _ hA hB2.le) b hbseg + (hha _).ge (by rw [hha]; linarith) (by linarith) hB + by_cases hD : fwd u q < fwd u (meet u a b (hgt u q)) +- · rw [if_pos ⟨hA, hB2, hD⟩, if_neg (by rintro ⟨-, g, -⟩; linarith), +- if_neg (by rintro ⟨g, -, -⟩; linarith), if_pos ⟨hB2, hB, e.1 hD⟩] ++ · rw [ite_eq_left ⟨hA, hB2, hD⟩, ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ite_eq_left ⟨hB2, hB, e.1 hD⟩] + decide +- · rw [if_neg (by rintro ⟨-, -, g⟩; exact hD g), +- if_neg (by rintro ⟨-, g, -⟩; linarith), +- if_neg (by rintro ⟨g, -, -⟩; linarith), +- if_neg (by rintro ⟨-, -, g⟩; exact hD (e.2 g))] ++ · rw [ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD (e.2 g))] + · -- the edge is entirely below the sweep +- rw [if_neg (by rintro ⟨-, g, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith), +- if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨g, -, -⟩; linarith)] ++ rw [ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith)] + · rcases le_or_gt (hgt u a) (hgt u q + s) with hA2 | hA2 + · rcases lt_or_ge (hgt u q + s) (hgt u b) with hB | hB + · -- the sweep passes the lower end only + have e := hside (meet u a b (hgt u q + s)) (hma _ hA2 hB.le) a haseg + (by rw [hha]; linarith) (hha _).le (by linarith) hA2 + by_cases hD : fwd u q < fwd u a +- · rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_pos ⟨hA2, hB, e.2 hD⟩, +- if_pos ⟨hA, hA2, hD⟩, if_neg (by rintro ⟨-, g, -⟩; linarith)] ++ · rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ite_eq_left ⟨hA2, hB, e.2 hD⟩, ++ ite_eq_left ⟨hA, hA2, hD⟩, ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] + decide +- · rw [if_neg (by rintro ⟨g, -, -⟩; linarith), +- if_neg (by rintro ⟨-, -, g⟩; exact hD (e.1 g)), +- if_neg (by rintro ⟨-, -, g⟩; exact hD g), +- if_neg (by rintro ⟨-, g, -⟩; linarith)] ++ · rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD (e.1 g)), ++ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] + · -- the sweep passes both ends + have e := hside a haseg b hbseg (by linarith) hA2 (by linarith) hB + by_cases hD : fwd u q < fwd u a +- · rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith), +- if_pos ⟨hA, hA2, hD⟩, if_pos ⟨by linarith, hB, e.1 hD⟩] ++ · rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ++ ite_eq_left ⟨hA, hA2, hD⟩, ite_eq_left ⟨by linarith, hB, e.1 hD⟩] + decide +- · rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith), +- if_neg (by rintro ⟨-, -, g⟩; exact hD g), +- if_neg (by rintro ⟨-, -, g⟩; exact hD (e.2 g))] ++ · rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD g), ++ ite_eq_right (by rintro ⟨-, -, g⟩; exact hD (e.2 g))] + · -- the edge is entirely above the sweep +- rw [if_neg (by rintro ⟨g, -, -⟩; linarith), if_neg (by rintro ⟨g, -, -⟩; linarith), +- if_neg (by rintro ⟨-, g, -⟩; linarith), if_neg (by rintro ⟨-, g, -⟩; linarith)] ++ rw [ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨g, -, -⟩; linarith), ++ ite_eq_right (by rintro ⟨-, g, -⟩; linarith), ite_eq_right (by rintro ⟨-, g, -⟩; linarith)] + + /-- Sweeping the base point across the ray direction, without meeting the polygon, does not + change the parity. This is where the polygon has to be closed. -/ +@@ -882,7 +892,7 @@ + refine List.sum_eq_zero ?_ + intro x hx + obtain ⟨P, hP, rfl⟩ := List.mem_map.1 hx +- refine if_neg ?_ ++ refine ite_eq_right ?_ + rintro ⟨h1, h2, h3⟩ + exact absurd (h _ (mem_cover hP (meet_mem_seg (hL P hP) h1 h2.le))) (not_lt.2 h3.le) + +@@ -999,7 +1009,7 @@ + rintro ⟨-, -, g⟩ + rw [hgp, hfp, hmeetp] at g + linarith +- rw [mark, mark, if_pos hm1, if_neg hm2, add_zero] ++ rw [mark, mark, ite_eq_left hm1, ite_eq_right hm2, add_zero] + refine ⟨by rw [hneg]; exact hcov (-t) (by linarith) habsm, hcov t (ne_of_gt ht) habsp, ?_⟩ + have hz1 : (L₁.map (fun P => mark u P (p - t • u) + mark u P (p + t • u))).sum = 0 := by + refine List.sum_eq_zero ?_ +diff --git a/Schoenflies/ParitySplitting.lean b/Schoenflies/ParitySplitting.lean +--- a/Schoenflies/ParitySplitting.lean ++++ b/Schoenflies/ParitySplitting.lean +@@ -122,7 +122,9 @@ + theorem mark_swap' (u : Plane) (P : Piece) (q : Plane) : mark u (P.2, P.1) q = mark u P q := by + obtain ⟨a, b⟩ := P + by_cases h : hgt u a = hgt u b +- · rw [mark, mark, if_neg (not_crosses_of_level h.symm q), if_neg (not_crosses_of_level h q)] ++ · rw [mark, mark, ++ ite_eq_right (not_crosses_of_level h.symm q), ++ ite_eq_right (not_crosses_of_level h q)] + · exact mark_swap h q + + /-- Reordering the edges does not change the count. -/ +diff --git a/Schoenflies/PolyArcRealize.lean b/Schoenflies/PolyArcRealize.lean +--- a/Schoenflies/PolyArcRealize.lean ++++ b/Schoenflies/PolyArcRealize.lean +@@ -122,22 +122,22 @@ + intro k l hkl + dsimp only at hkl + by_cases hk : k < N <;> by_cases hl : l < N +- · rw [if_pos hk, if_pos hl] at hkl ++ · rw [ite_eq_left hk, ite_eq_left hl] at hkl + exact hv k hk l hl hkl + · -- A listed point cannot equal a padded one: its first coordinate is too small. + exfalso +- rw [if_pos hk, if_neg hl] at hkl ++ rw [ite_eq_left hk, ite_eq_right hl] at hkl + have h1 : v k 0 = M + 1 + (l : ℝ) := by rw [hkl]; exact Plane.mk_zero _ _ + have h2 : (0 : ℝ) ≤ (l : ℝ) := Nat.cast_nonneg l + have h3 := hM k hk + linarith + · exfalso +- rw [if_neg hk, if_pos hl] at hkl ++ rw [ite_eq_right hk, ite_eq_left hl] at hkl + have h1 : v l 0 = M + 1 + (k : ℝ) := by rw [← hkl]; exact Plane.mk_zero _ _ + have h2 : (0 : ℝ) ≤ (k : ℝ) := Nat.cast_nonneg k + have h3 := hM l hl + linarith +- · rw [if_neg hk, if_neg hl] at hkl ++ · rw [ite_eq_right hk, ite_eq_right hl] at hkl + have h1 : M + 1 + (k : ℝ) = M + 1 + (l : ℝ) := by + rw [← Plane.mk_zero (M + 1 + (k : ℝ)) 0, hkl]; exact Plane.mk_zero _ _ + exact_mod_cast (by linarith : (k : ℝ) = (l : ℝ)) +@@ -156,9 +156,9 @@ + /-- The index map that skips over vertex `i + 1`. -/ + def skipIdx (i k : ℕ) : ℕ := if k ≤ i then k else k + 1 + +-theorem skipIdx_of_le (h : k ≤ i) : skipIdx i k = k := if_pos h +- +-theorem skipIdx_of_lt (h : i < k) : skipIdx i k = k + 1 := if_neg (by omega) ++theorem skipIdx_of_le (h : k ≤ i) : skipIdx i k = k := ite_eq_left h ++ ++theorem skipIdx_of_lt (h : i < k) : skipIdx i k = k + 1 := ite_eq_right (by omega) + + theorem skipIdx_injective (i : ℕ) : Function.Injective (skipIdx i) := by + intro k l h +@@ -572,18 +572,18 @@ + -- The linear vertex list: the ends, in the order the arc reaches them, and then `b`. + set vf : ℕ → Plane := fun k => if h : k < n then f (par TF hcard ⟨k, h⟩) else b with hvf + have hvflt : ∀ (k : ℕ) (hk : k < n), vf k = f (tp ⟨k, hk⟩) := by +- intro k hk; rw [hvf]; simp only [dif_pos hk, htp] +- have hvfn : vf n = b := by rw [hvf]; simp only [dif_neg (lt_irrefl n)] ++ intro k hk; rw [hvf]; simp only [dite_eq_left hk, htp] ++ have hvfn : vf n = b := by rw [hvf]; simp only [dite_eq_right (lt_irrefl n)] + -- `f 1 = b` is the right end of the last gap, so the list has the right successor at each step. + have hvfsucc : ∀ (k : ℕ) (hk : k < n), vf (k + 1) = f (nx ⟨k, hk⟩) := by + intro k hk + by_cases hk1 : k + 1 < n + · rw [hvflt (k + 1) hk1, htp, hnx, parNext, +- dif_pos (show (⟨k, hk⟩ : Fin n).val + 1 < n from hk1)] ++ dite_eq_left (show (⟨k, hk⟩ : Fin n).val + 1 < n from hk1)] + rfl + · have : k + 1 = n := by omega + rw [this, hvfn, hnx, parNext, +- dif_neg (show ¬ ((⟨k, hk⟩ : Fin n).val + 1 < n) from hk1), hf1] ++ dite_eq_right (show ¬ ((⟨k, hk⟩ : Fin n).val + 1 < n) from hk1), hf1] + -- The vertex list is injective on `{0, …, n}`: `f` is, and the parameters are increasing. + have hvfinj : ∀ i < n + 1, ∀ j < n + 1, vf i = vf j → i = j := by + have hkey : ∀ i < n, ∀ j < n, vf i = vf j → i = j := by +diff --git a/Schoenflies/PolyLocal.lean b/Schoenflies/PolyLocal.lean +--- a/Schoenflies/PolyLocal.lean ++++ b/Schoenflies/PolyLocal.lean +@@ -277,7 +277,7 @@ + rintro c ⟨hcQ, hcne⟩ + have : p ∉ closedSquare c (ρ c) := + Set.disjoint_left.1 (hdisj c₀ hc₀Q c hcQ fun h => hcne (h ▸ rfl)) hpc₀ +- simp only [closedSquare, mem_setOf_eq, not_le] at this ++ simp only [closedSquare, mem_ofPred_eq, not_le] at this + linarith + obtain ⟨s, hs, hsle⟩ := exists_pos_le_of_finite (hQ.sdiff (t := {c₀})) + (f := fun c => supDist p c - ρ c) hfar +@@ -298,7 +298,7 @@ + have hfar : ∀ c ∈ Q, 0 < supDist p c - ρ c := by + intro c hcQ + have := hnear c hcQ +- simp only [closedSquare, mem_setOf_eq, not_le] at this ++ simp only [closedSquare, mem_ofPred_eq, not_le] at this + linarith + obtain ⟨s, hs, hsle⟩ := exists_pos_le_of_finite hQ (f := fun c => supDist p c - ρ c) hfar + refine isLocallyPolyConnAt'_of_nbhd_subset (isOpen_openSquare p s) (mem_openSquare_self hs) +diff --git a/Schoenflies/PrePolygonArc.lean b/Schoenflies/PrePolygonArc.lean +--- a/Schoenflies/PrePolygonArc.lean ++++ b/Schoenflies/PrePolygonArc.lean +@@ -623,13 +623,13 @@ + have hlt : j.val < m + 3 := ZMod.val_lt j + have hval : (emb j).val = j.val := by + rw [emb, ZMod.val_cast_of_lt (by omega)] +- rw [insVertex, if_pos (by rw [hval]; exact hlt), hval, ZMod.natCast_rightInverse j] ++ rw [insVertex, ite_eq_left (by rw [hval]; exact hlt), hval, ZMod.natCast_rightInverse j] + + theorem val_neg_one' : (-1 : ZMod (m + 1 + 3)).val = m + 3 := by + rw [neg_one_eq_cast, ZMod.val_cast_of_lt (by omega)] + + theorem insVertex_neg_one (P : PrePolygon m) (z : Plane) : insVertex P z (-1) = z := by +- rw [insVertex, if_neg (by rw [val_neg_one' (m := m)]; omega)] ++ rw [insVertex, ite_eq_right (by rw [val_neg_one' (m := m)]; omega)] + + /-- Away from the inserted vertex the edges are unchanged. -/ + theorem insEdge_of_lt {j : ZMod (m + 3)} (h : j.val + 1 < m + 3) : +@@ -688,12 +688,12 @@ + have hi := ZMod.val_lt i + have hj := ZMod.val_lt j + by_cases hli : i.val < m + 3 <;> by_cases hlj : j.val < m + 3 +- · rw [if_pos hli, if_pos hlj] at hij ++ · rw [ite_eq_left hli, ite_eq_left hlj] at hij + exact ZMod.val_injective _ + (ClosedPolygon.natCast_inj hli hlj (P.vertex_inj hij)) +- · rw [if_pos hli, if_neg hlj] at hij ++ · rw [ite_eq_left hli, ite_eq_right hlj] at hij + exact absurd hij (hzv _) +- · rw [if_neg hli, if_pos hlj] at hij ++ · rw [ite_eq_right hli, ite_eq_left hlj] at hij + exact absurd hij.symm (hzv _) + · exact ZMod.val_injective _ (by omega) + edges_meet := by +diff --git a/Schoenflies/QuantitativeForwardStages.lean b/Schoenflies/QuantitativeForwardStages.lean +--- a/Schoenflies/QuantitativeForwardStages.lean ++++ b/Schoenflies/QuantitativeForwardStages.lean +@@ -34,8 +34,8 @@ + rw [Plane.closedSquare_eq_inter] at hclosed + have hopen := hz.2 + rw [Plane.openSquare_eq_inter] at hopen +- simp only [Set.mem_inter_iff, Set.mem_setOf_eq] at hclosed +- simp only [Set.mem_inter_iff, Set.mem_setOf_eq, not_and_or, not_lt] at hopen ++ simp only [Set.mem_inter_iff, Set.mem_ofPred_eq] at hclosed ++ simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, not_and_or, not_lt] at hopen + rcases hopen with hX | hY + · rcases hX with hleft | hright + · exact mem_cover_of_coord_eq hs hk (Nat.zero_le k) hz.1 (by +diff --git a/Schoenflies/QuantitativeRecursion.lean b/Schoenflies/QuantitativeRecursion.lean +--- a/Schoenflies/QuantitativeRecursion.lean ++++ b/Schoenflies/QuantitativeRecursion.lean +@@ -191,7 +191,7 @@ + + theorem denseQuantitativeSchedule_centresDense (hC : IsSeparating C) : + (denseQuantitativeSchedule hC).CentresDense := by +- letI : Nonempty (inside C) := hC.isConnected_inside.nonempty.to_subtype ++ let : Nonempty (inside C) := hC.isConnected_inside.nonempty.to_subtype + intro x hx δ hδ + obtain ⟨k, hk⟩ := + (TopologicalSpace.denseRange_denseSeq (inside C)).exists_dist_lt +diff --git a/Schoenflies/Realization.lean b/Schoenflies/Realization.lean +--- a/Schoenflies/Realization.lean ++++ b/Schoenflies/Realization.lean +@@ -876,7 +876,7 @@ + /-- The successor in `ZMod n`, read as a numeral below `n`. -/ + theorem zmod_val_succ {n : ℕ} (hn : 1 < n) (j : ZMod n) : + (j + 1).val = if j.val + 1 < n then j.val + 1 else 0 := by +- haveI : NeZero n := ⟨by omega⟩ ++ have : NeZero n := ⟨by omega⟩ + have h1 : (1 : ZMod n).val = 1 := by + rw [show (1 : ZMod n) = ((1 : ℕ) : ZMod n) by norm_num] + exact ZMod.val_cast_of_lt hn +@@ -1084,27 +1084,27 @@ + · exfalso + have hcond : ¬ ((⟨0, hn0⟩ : Fin n) : ℕ) + 1 < n := + fun hc => absurd (lt_of_le_of_lt (Nat.le_add_left 1 _) hc) (by omega) +- have hnx0 : nx ⟨0, hn0⟩ = 1 := by rw [hnx, parNext, dif_neg hcond] ++ have hnx0 : nx ⟨0, hn0⟩ = 1 := by rw [hnx, parNext, dite_eq_right hcond] + exact hfne ⟨0, hn0⟩ (by rw [htp0, hnx0]; exact hf.closes) + · exact hge +- haveI : NeZero n := ⟨by omega⟩ ++ have : NeZero n := ⟨by omega⟩ + -- The cyclic vertex list: the ends, in the order the loop reaches them. + set w : ZMod n → Plane := fun j => f (tp ⟨j.val, ZMod.val_lt j⟩) with hw + have hwsucc : ∀ j : ZMod n, w (j + 1) = f (nx ⟨j.val, ZMod.val_lt j⟩) := by + intro j + have hjlt := ZMod.val_lt j + by_cases hj : j.val + 1 < n +- · have hval : (j + 1).val = j.val + 1 := by rw [zmod_val_succ (by omega) j, if_pos hj] ++ · have hval : (j + 1).val = j.val + 1 := by rw [zmod_val_succ (by omega) j, ite_eq_left hj] + have hfin : (⟨(j + 1).val, ZMod.val_lt (j + 1)⟩ : Fin n) = ⟨j.val + 1, hj⟩ := + Fin.val_injective hval + simp only [hw, hfin] +- rw [hnx, parNext, dif_pos (show (⟨j.val, hjlt⟩ : Fin n).val + 1 < n from hj)] ++ rw [hnx, parNext, dite_eq_left (show (⟨j.val, hjlt⟩ : Fin n).val + 1 < n from hj)] + rfl +- · have hval : (j + 1).val = 0 := by rw [zmod_val_succ (by omega) j, if_neg hj] ++ · have hval : (j + 1).val = 0 := by rw [zmod_val_succ (by omega) j, ite_eq_right hj] + have hfin : (⟨(j + 1).val, ZMod.val_lt (j + 1)⟩ : Fin n) = ⟨0, hn0⟩ := + Fin.val_injective hval + simp only [hw, hfin] +- rw [htp0, hnx, parNext, dif_neg (show ¬ ((⟨j.val, hjlt⟩ : Fin n).val + 1 < n) from hj)] ++ rw [htp0, hnx, parNext, dite_eq_right (show ¬ ((⟨j.val, hjlt⟩ : Fin n).val + 1 < n) from hj)] + exact hf.closes + have hedgeq : ∀ j : ZMod n, + segment ℝ (w j) (w (j + 1)) = (pc ⟨j.val, ZMod.val_lt j⟩).seg := by +@@ -1141,7 +1141,7 @@ + omega + have hsucc1 : (1 : ZMod n) + 1 = 0 := by + refine ZMod.val_injective _ ?_ +- rw [zmod_val_succ (by omega) 1, hone, if_neg (by omega), ZMod.val_zero] ++ rw [zmod_val_succ (by omega) 1, hone, ite_eq_right (by omega), ZMod.val_zero] + have hw01 : w 0 ≠ w 1 := fun he => h01 (hwinj he) + obtain ⟨p, hp, hp1, hp2⟩ := PrePolygon.exists_mem_segment_ne hw01 + have hmem := hwmeet 0 1 h01 +diff --git a/Schoenflies/RealizeSplit.lean b/Schoenflies/RealizeSplit.lean +--- a/Schoenflies/RealizeSplit.lean ++++ b/Schoenflies/RealizeSplit.lean +@@ -501,11 +501,11 @@ + + theorem splitPos_of_mem_ear {z : γ} (hz : z ∈ V(d.ear)) : d.splitPos R earPos z = earPos z := by + classical +- simp only [splitPos, if_pos hz] ++ simp only [splitPos, ite_eq_left hz] + + theorem splitPos_of_notMem_ear {z : γ} (hz : z ∉ V(d.ear)) : d.splitPos R earPos z = R.pos z := by + classical +- simp only [splitPos, if_neg hz] ++ simp only [splitPos, ite_eq_right hz] + + theorem EarCrosscut.splitPos_eq (hE : d.EarCrosscut R earPos earDraw) {z : γ} + (hz : z ∈ V(S.skel)) : d.splitPos R earPos z = R.pos z := by +@@ -516,24 +516,24 @@ + theorem splitDrawing_of_mem_ear {f : γ} (hf : f ∈ E(d.ear)) : + d.splitDrawing R earDraw f = earDraw f := by + classical +- simp only [splitDrawing, if_pos hf] ++ simp only [splitDrawing, ite_eq_left hf] + + theorem splitDrawing_of_mem_skel {f : γ} (hf : f ∈ E(S.skel)) : + d.splitDrawing R earDraw f = R.drawing f := by + classical +- simp only [splitDrawing, if_neg (Set.disjoint_left.1 d.disjoint_edgeSet hf)] ++ simp only [splitDrawing, ite_eq_right (Set.disjoint_left.1 d.disjoint_edgeSet hf)] + + theorem splitCell_face₁ : d.splitCell R earPos earDraw d.face₁ = + inside (R.cellUnion d.cells₁ ∪ d.earSet earPos earDraw) := by + classical + unfold splitCell +- rw [if_pos rfl] ++ rw [ite_eq_left rfl] + + theorem splitCell_face₂ : d.splitCell R earPos earDraw d.face₂ = + inside (R.cellUnion d.cells₂ ∪ d.earSet earPos earDraw) := by + classical + unfold splitCell +- rw [if_neg (Ne.symm d.face_ne), if_pos rfl] ++ rw [ite_eq_right (Ne.symm d.face_ne), ite_eq_left rfl] + + theorem splitCell_of_mem_cells {σ : γ} (hσ : σ ∈ S.cells) : + d.splitCell R earPos earDraw σ = R.cell σ := by +@@ -546,7 +546,7 @@ + exacts [hnv d.source_mem_skel, hnv d.target_mem_skel] + have h₄ : σ ∉ E(d.ear) := fun h => d.edge_fresh h hσ + unfold splitCell +- rw [if_neg h₁, if_neg h₂, if_neg h₃, if_neg h₄] ++ rw [ite_eq_right h₁, ite_eq_right h₂, ite_eq_right h₃, ite_eq_right h₄] + + theorem EarCrosscut.splitCell_earVertex (hE : d.EarCrosscut R earPos earDraw) {z : γ} + (hz : z ∈ V(d.ear)) : d.splitCell R earPos earDraw z = {earPos z} := by +@@ -557,7 +557,9 @@ + · have h₁ : z ≠ d.face₁ := by rintro rfl; exact d.face₁_notMem_ear (Or.inl hz) + have h₂ : z ≠ d.face₂ := by rintro rfl; exact d.face₂_notMem_ear (Or.inl hz) + unfold splitCell +- rw [if_neg h₁, if_neg h₂, if_pos (show z ∈ V(d.ear) ∧ z ∉ V(S.skel) from ⟨hz, hz'⟩)] ++ rw [ite_eq_right h₁, ++ ite_eq_right h₂, ++ ite_eq_left (show z ∈ V(d.ear) ∧ z ∉ V(S.skel) from ⟨hz, hz'⟩)] + + theorem splitCell_earEdge {f : γ} (hf : f ∈ E(d.ear)) : + d.splitCell R earPos earDraw f = Graph.edgeArc earDraw f \ earPos '' V(d.ear) := by +@@ -567,7 +569,7 @@ + have h₃ : ¬ (f ∈ V(d.ear) ∧ f ∉ V(S.skel)) := fun h => + Set.disjoint_left.1 d.ear_disjoint h.1 hf + unfold splitCell +- rw [if_neg h₁, if_neg h₂, if_neg h₃, if_pos hf] ++ rw [ite_eq_right h₁, ite_eq_right h₂, ite_eq_right h₃, ite_eq_left hf] + + theorem edgeArc_splitDrawing_of_mem_skel {f : γ} (hf : f ∈ E(S.skel)) : + Graph.edgeArc (d.splitDrawing R earDraw) f = Graph.edgeArc R.drawing f := by +diff --git a/Schoenflies/RealizeSubdiv.lean b/Schoenflies/RealizeSubdiv.lean +--- a/Schoenflies/RealizeSubdiv.lean ++++ b/Schoenflies/RealizeSubdiv.lean +@@ -309,7 +309,7 @@ + R.drawing d.edge (d.rightParam R) = R.pos d.right := by + have hd := R.isDrawing.edge_param (d.edge_mem_edgeSet_graph R) + rcases (d.isLink_drawn_edge R).eq_and_eq_or_eq_and_eq hd.2.2 with ⟨h0, h1⟩ | ⟨h0, h1⟩ +- · have hL : d.leftParam R = 0 := if_pos h0.symm ++ · have hL : d.leftParam R = 0 := ite_eq_left h0.symm + refine ⟨by rw [hL]; exact h0.symm, ?_⟩ + have hR : d.rightParam R = 1 := by rw [rightParam, hL]; ring + rw [hR]; exact h1.symm +@@ -317,7 +317,7 @@ + -- endpoint values, which injectivity forbids. + have hne : ¬ (R.drawing d.edge 0 = R.pos d.left) := fun hcon => + zero_ne_one (hd.2.1 zero_mem_I one_mem_I (by rw [hcon, h0])) +- have hL : d.leftParam R = 1 := if_neg hne ++ have hL : d.leftParam R = 1 := ite_eq_right hne + refine ⟨by rw [hL]; exact h0.symm, ?_⟩ + have hR : d.rightParam R = 0 := by rw [rightParam, hL]; ring + rw [hR]; exact h1.symm +@@ -458,9 +458,10 @@ + variable {d R} + + @[simp] theorem realizePos_newVertex : d.realizePos R t d.newVertex = R.drawing d.edge t := +- if_pos rfl +- +-theorem realizePos_of_ne {z : γ} (h : z ≠ d.newVertex) : d.realizePos R t z = R.pos z := if_neg h ++ ite_eq_left rfl ++ ++theorem realizePos_of_ne {z : γ} (h : z ≠ d.newVertex) : d.realizePos R t z = R.pos z := ++ ite_eq_right h + + theorem realizePos_of_mem_cells {z : γ} (h : z ∈ S.cells) : d.realizePos R t z = R.pos z := + realizePos_of_ne (d.ne_newVertex_of_mem_cells h) +@@ -469,33 +470,38 @@ + realizePos_of_mem_cells (S.mem_cells_of_mem_vertexSet h) + + @[simp] theorem realizeDrawing_newEdge₁ : +- d.realizeDrawing R t d.newEdge₁ = subarc (R.drawing d.edge) (d.leftParam R) t := if_pos rfl ++ d.realizeDrawing R t d.newEdge₁ = subarc (R.drawing d.edge) (d.leftParam R) t := ite_eq_left rfl + + @[simp] theorem realizeDrawing_newEdge₂ : + d.realizeDrawing R t d.newEdge₂ = subarc (R.drawing d.edge) t (d.rightParam R) := by +- rw [realizeDrawing, if_neg d.newEdge_ne.symm, if_pos rfl] ++ rw [realizeDrawing, ite_eq_right d.newEdge_ne.symm, ite_eq_left rfl] + + theorem realizeDrawing_of_ne {f : γ} (h₁ : f ≠ d.newEdge₁) (h₂ : f ≠ d.newEdge₂) : +- d.realizeDrawing R t f = R.drawing f := by rw [realizeDrawing, if_neg h₁, if_neg h₂] ++ d.realizeDrawing R t f = R.drawing f := by rw [realizeDrawing, ite_eq_right h₁, ite_eq_right h₂] + + theorem realizeDrawing_of_mem_cells {f : γ} (h : f ∈ S.cells) : + d.realizeDrawing R t f = R.drawing f := + realizeDrawing_of_ne (d.ne_newEdge₁_of_mem_cells h) (d.ne_newEdge₂_of_mem_cells h) + + @[simp] theorem realizeCell_newVertex : d.realizeCell R t d.newVertex = {R.drawing d.edge t} := +- if_pos rfl ++ ite_eq_left rfl + + @[simp] theorem realizeCell_newEdge₁ : d.realizeCell R t d.newEdge₁ = + R.drawing d.edge '' uIcc (d.leftParam R) t \ {R.pos d.left, R.drawing d.edge t} := by +- rw [realizeCell, if_neg d.newVertex_ne₁.symm, if_pos rfl] ++ rw [realizeCell, ite_eq_right d.newVertex_ne₁.symm, ite_eq_left rfl] + + @[simp] theorem realizeCell_newEdge₂ : d.realizeCell R t d.newEdge₂ = + R.drawing d.edge '' uIcc t (d.rightParam R) \ {R.drawing d.edge t, R.pos d.right} := by +- rw [realizeCell, if_neg d.newVertex_ne₂.symm, if_neg d.newEdge_ne.symm, if_pos rfl] ++ rw [realizeCell, ++ ite_eq_right d.newVertex_ne₂.symm, ++ ite_eq_right d.newEdge_ne.symm, ++ ite_eq_left rfl] + + theorem realizeCell_of_mem_cells {c : γ} (h : c ∈ S.cells) : d.realizeCell R t c = R.cell c := by +- rw [realizeCell, if_neg (d.ne_newVertex_of_mem_cells h), if_neg (d.ne_newEdge₁_of_mem_cells h), +- if_neg (d.ne_newEdge₂_of_mem_cells h)] ++ rw [realizeCell, ++ ite_eq_right (d.ne_newVertex_of_mem_cells h), ++ ite_eq_right (d.ne_newEdge₁_of_mem_cells h), ++ ite_eq_right (d.ne_newEdge₂_of_mem_cells h)] + + /-! ### The two half arcs -/ + +diff --git a/Schoenflies/RefinementStars.lean b/Schoenflies/RefinementStars.lean +--- a/Schoenflies/RefinementStars.lean ++++ b/Schoenflies/RefinementStars.lean +@@ -132,7 +132,7 @@ + theorem carrier_spec [Nonempty γ] (R : S.Realization) (x : Plane) + (h : ∃ σ, σ ∈ S.cells ∧ x ∈ R.cell σ) : + R.carrier x ∈ S.cells ∧ x ∈ R.cell (R.carrier x) := by +- rw [carrier, dif_pos h] ++ rw [carrier, dite_eq_left h] + exact h.choose_spec + + namespace IsCellDecomposition +diff --git a/Schoenflies/SimpleArc.lean b/Schoenflies/SimpleArc.lean +--- a/Schoenflies/SimpleArc.lean ++++ b/Schoenflies/SimpleArc.lean +@@ -146,14 +146,14 @@ + · -- A repeated vertex contributes the point `u`, which the rest of the chain already + -- holds. + subst huv +- rw [if_pos rfl, segment_same] ++ rw [ite_eq_left rfl, segment_same] + have hmem : u ∈ poly (u :: rest) := mem_poly_of_mem (List.mem_cons_self ..) + rcases ih with h | ⟨h1, h2⟩ + · exact Or.inl (by rw [h, union_eq_self_of_subset_left (singleton_subset_iff.2 hmem)]) + · refine Or.inr ⟨h1, ?_⟩ + rw [union_eq_self_of_subset_left (singleton_subset_iff.2 hmem)] + exact h2 +- · rw [if_neg huv, cover_cons] ++ · rw [ite_eq_right huv, cover_cons] + refine Or.inl ?_ + rcases ih with h | ⟨h1, h2⟩ + · rw [h]; rfl +@@ -284,7 +284,7 @@ + -- And they carry disjoint sets: a common point is a vertex incident with an edge of each. + have hdisj : ∀ z, z ∈ S → z ∈ T → False := by + intro z hzS hzT +- simp only [hS, hT, mem_iUnion, mem_setOf_eq, exists_prop] at hzS hzT ++ simp only [hS, hT, mem_iUnion, mem_ofPred_eq, exists_prop] at hzS hzT + obtain ⟨P, ⟨hP, hPr⟩, hzP⟩ := hzS + obtain ⟨Q, ⟨hQ, hQr⟩, hzQ⟩ := hzT + have hPQ : P ≠ Q := by rintro rfl; exact hQr hPr +@@ -315,7 +315,7 @@ + hsub ⟨a, ha, fun h => hdisj a haS h⟩ ⟨b, hb, fun h => hdisj b h hbT⟩ + exact (hunion z hzc).elim hzS hzT + -- `b` is a vertex on an edge of the reachable class, hence an end of it. +- simp only [hS, mem_iUnion, mem_setOf_eq, exists_prop] at hbS ++ simp only [hS, mem_iUnion, mem_ofPred_eq, exists_prop] at hbS + obtain ⟨P, ⟨hP, hPr⟩, hbP⟩ := hbS + have hbend : b = P.1 ∨ b = P.2 := + hdraw.vertex_mem_edgeArc (hlink P hP) hbV (by rwa [edgeArc_segmentDrawing]) +diff --git a/Schoenflies/SkeletonAccess.lean b/Schoenflies/SkeletonAccess.lean +--- a/Schoenflies/SkeletonAccess.lean ++++ b/Schoenflies/SkeletonAccess.lean +@@ -648,8 +648,8 @@ + frontier (Plane.openSquare c s) ⊆ Plane.closedSquare c s \ Plane.openSquare c s := by + have hsub : Plane.openSquare c s ⊆ Plane.closedSquare c s := by + intro w hw +- simp only [Plane.openSquare, mem_setOf_eq] at hw +- simp only [Plane.closedSquare, mem_setOf_eq] ++ simp only [Plane.openSquare, mem_ofPred_eq] at hw ++ simp only [Plane.closedSquare, mem_ofPred_eq] + exact hw.le + rw [(Plane.isOpen_openSquare c s).frontier_eq] + exact Set.sdiff_subset_sdiff_left +diff --git a/Schoenflies/SkeletonLocal.lean b/Schoenflies/SkeletonLocal.lean +--- a/Schoenflies/SkeletonLocal.lean ++++ b/Schoenflies/SkeletonLocal.lean +@@ -213,9 +213,9 @@ + · exact one_pos + · exact dist_pos.2 (Ne.symm h) + · intro h1 +- exact le_trans (min_le_left _ _) (le_of_eq (if_neg h1)) ++ exact le_trans (min_le_left _ _) (le_of_eq (ite_eq_right h1)) + · intro h2 +- exact le_trans (min_le_right _ _) (le_of_eq (if_neg h2)) ++ exact le_trans (min_le_right _ _) (le_of_eq (ite_eq_right h2)) + · -- A piece missing `x` is a compact set at positive distance from `x`. + obtain ⟨ρ, hρ, hd⟩ := Plane.exists_dist_pos isCompact_singleton (isCompact_segment P.1 P.2) + (Set.disjoint_singleton_left.2 hx) +@@ -453,7 +453,7 @@ + theorem IsLocalRadius.ball_diff_eq_cone (h : IsLocalRadius S x r) : + ball x r \ S = Plane.cone x {u | u ≠ 0 ∧ Plane.dir u ∉ localDirs S x} r := by + ext z +- simp only [Set.mem_sdiff, mem_ball, Plane.mem_cone_iff, mem_setOf_eq, sub_ne_zero] ++ simp only [Set.mem_sdiff, mem_ball, Plane.mem_cone_iff, mem_ofPred_eq, sub_ne_zero] + constructor + · rintro ⟨hzb, hzS⟩ + have hiff := h.2 z hzb.le +diff --git a/Schoenflies/SkeletonSectors.lean b/Schoenflies/SkeletonSectors.lean +--- a/Schoenflies/SkeletonSectors.lean ++++ b/Schoenflies/SkeletonSectors.lean +@@ -178,19 +178,19 @@ + counterclockwise from `u` to `w` exactly when `w` lies on the arc counterclockwise from `d` to + `u`. -/ + theorem mem_arcCCW_rotate : d ∈ arcCCW u w ↔ w ∈ arcCCW d u := by +- simp only [arcCCW, mem_setOf_eq] ++ simp only [arcCCW, mem_ofPred_eq] + tauto + + /-- A bounding ray is not on its own arc. -/ + theorem left_notMem_arcCCW (u w : Plane) : u ∉ arcCCW u w := by + have h : det w u = -det u w := det_comm w u +- simp only [arcCCW, mem_setOf_eq, det_self, h] ++ simp only [arcCCW, mem_ofPred_eq, det_self, h] + rintro (⟨h1, _⟩ | ⟨h1, h2⟩ | ⟨_, h2⟩) <;> linarith + + /-- The other bounding ray is not on the arc either. -/ + theorem right_notMem_arcCCW (u w : Plane) : w ∉ arcCCW u w := by + have h : det w u = -det u w := det_comm w u +- simp only [arcCCW, mem_setOf_eq, det_self, h] ++ simp only [arcCCW, mem_ofPred_eq, det_self, h] + rintro (⟨_, h2⟩ | ⟨h1, _⟩ | ⟨_, h2⟩) <;> linarith + + /-- **Asymmetry.** Transposing the first two entries of the triple negates the cyclic order: +@@ -200,7 +200,7 @@ + have e1 : det v u = -det u v := det_comm v u + have e2 : det u w = -det w u := det_comm u w + have e3 : det w v = -det v w := det_comm w v +- simp only [arcCCW, mem_setOf_eq] at h ⊢ ++ simp only [arcCCW, mem_ofPred_eq] at h ⊢ + rw [e1, e3] + rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> + rintro (⟨g1, g2⟩ | ⟨g1, g2⟩ | ⟨g1, g2⟩) <;> linarith +@@ -268,7 +268,7 @@ + transitive: if `w` comes before `v` and `v` before `d`, then `w` comes before `d`. This is what + makes a finite set of directions linearly ordered once a ray to cut at has been chosen. -/ + theorem arcCCW_trans (h₁ : w ∈ arcCCW u v) (h₂ : v ∈ arcCCW u d) : w ∈ arcCCW u d := by +- simp only [arcCCW, mem_setOf_eq] at h₁ h₂ ⊢ ++ simp only [arcCCW, mem_ofPred_eq] at h₁ h₂ ⊢ + have hv : det u v = -det v u := det_comm u v + rw [hv] at h₂ + exact trans_aux₁ (grassmann u w v d) h₁ h₂ +@@ -278,7 +278,7 @@ + counterclockwise from `w` to `d`. This is the step that turns "nothing of the finite set lies + between `u` and the extreme rays" into "nothing lies inside the sector". -/ + theorem arcCCW_trans' (h₁ : w ∈ arcCCW u v) (h₂ : v ∈ arcCCW u d) : v ∈ arcCCW w d := by +- simp only [arcCCW, mem_setOf_eq] at h₁ h₂ ⊢ ++ simp only [arcCCW, mem_ofPred_eq] at h₁ h₂ ⊢ + have hv : det u v = -det v u := det_comm u v + have hd : det d w = -det w d := det_comm d w + rw [hv] at h₂ +@@ -401,7 +401,7 @@ + ring + rw [he, mul_comm, mul_assoc] + exact mul_pos (inv_pos.2 hupos) (mul_self_pos.2 hne) +- simp only [arcCCW, mem_setOf_eq] ++ simp only [arcCCW, mem_ofPred_eq] + rw [hAB, hCB, hWV] + rcases key with h | h + · exact Or.inl h +@@ -446,7 +446,7 @@ + intro v; rw [hsm, det_smul_right, det_comm v u]; ring + have e2 : det (-u) u = 0 := by rw [hsm, det_smul_left, det_self, mul_zero] + ext v +- simp only [arcCCW, mem_setOf_eq, e1, e2] ++ simp only [arcCCW, mem_ofPred_eq, e1, e2] + constructor + · rintro (⟨h, _⟩ | ⟨_, h⟩ | ⟨h, _⟩) <;> linarith + · exact fun h => Or.inl ⟨h, h⟩ +@@ -461,7 +461,7 @@ + have hhalf : (0 : ℝ) < ρ / 2 := by linarith + refine ⟨⟨(ρ / 2) • perp u, ?_, ?_⟩, + ((convex_det_right_pos u).inter (convex_ball _ _)).isPreconnected⟩ +- · simp only [mem_setOf_eq, det_smul_right, det_perp_self, hu.norm, one_pow, mul_one] ++ · simp only [mem_ofPred_eq, det_smul_right, det_perp_self, hu.norm, one_pow, mul_one] + exact hhalf + · rw [mem_ball, dist_zero_right, norm_smul, Real.norm_eq_abs, norm_perp, hu.norm, mul_one, + abs_of_pos hhalf] +@@ -558,8 +558,8 @@ + rw [hwd, neg_neg] at hne + rw [hwd] + exact hne +- rw [harc, mem_setOf_eq, not_lt] at h +- rw [harc', mem_setOf_eq, hwd] ++ rw [harc, mem_ofPred_eq, not_lt] at h ++ rw [harc', mem_ofPred_eq, hwd] + have hdz : det d z ≠ 0 := by + intro hzero + rcases eq_dir_or_eq_neg_dir hd.ne_zero hz hzero with h1 | h1 +@@ -980,11 +980,11 @@ + (hs₂ : segment ℝ x (x + r • d₂) ⊆ edgeArc drawing e) + (hs₃ : segment ℝ x (x + r • d₃) ⊆ edgeArc drawing e) : False := by + obtain ⟨hcont, hinj, -⟩ := h.edge_param he +- haveI : CompactSpace ↥(I : Set ℝ) := isCompact_iff_compactSpace.1 isCompact_I +- set φ : ↥(I : Set ℝ) → Plane := Set.restrict I (drawing e) with hφdef ++ have : CompactSpace ↥(I : Set ℝ) := isCompact_iff_compactSpace.1 isCompact_I ++ set φ : ↥(I : Set ℝ) → Plane := Set.domRestrict I (drawing e) with hφdef + have hφi : Function.Injective φ := Set.injOn_iff_injective.1 hinj +- have hcm : IsClosedMap φ := (hcont.restrict).isClosedMap +- have hrange : Set.range φ = edgeArc drawing e := Set.range_restrict _ _ ++ have hcm : IsClosedMap φ := (hcont.domRestrict).isClosedMap ++ have hrange : Set.range φ = edgeArc drawing e := Set.range_domRestrict _ _ + -- The preimage of a radial segment is a connected set of parameters. + have hpre : ∀ dd : Plane, segment ℝ x (x + r • dd) ⊆ edgeArc drawing e → + IsPreconnected (Subtype.val '' (φ ⁻¹' segment ℝ x (x + r • dd))) := by +diff --git a/Schoenflies/SourceAttachment.lean b/Schoenflies/SourceAttachment.lean +--- a/Schoenflies/SourceAttachment.lean ++++ b/Schoenflies/SourceAttachment.lean +@@ -29,7 +29,7 @@ + + namespace Schoenflies + +-open Graph ++open _root_.Schoenflies.Graph + + variable {γ : Type*} {S₀ : CellStructure γ} + {srcOuter srcDom tgtOuter tgtDom : Set Plane} +@@ -312,7 +312,7 @@ + V(Q.crosscutOverlay J p s epsilon extra) := by + intro x hx + rw [localGrid_eq, pieceListGraph_vertexSet] at hx +- simp only [endSet, Set.mem_setOf_eq] at hx ++ simp only [endSet, Set.mem_ofPred_eq] at hx + obtain ⟨R, hR, hxR⟩ := hx + change x ∈ V(overlayGraph (Q.crosscutPieces J p s epsilon) + (attachPoints (Q.crosscutPieces J p s epsilon) +@@ -630,7 +630,7 @@ + w.drawing e = + (Q.crosscutOverlay J p s epsilon extra).relabelDrawing + w.name segmentDrawing e := by +- rw [drawing, if_neg] ++ rw [drawing, ite_eq_right] + obtain ⟨R, hR, rfl⟩ := he + exact fun heOuter => w.name_fresh R hR + (P.str.mem_cells_of_mem_edgeSet (P.str.outerGraph_le.edgeSet_mono heOuter)) +@@ -1071,7 +1071,7 @@ + vertexSet_subset := by + intro x hx + rw [pieceListGraph_vertexSet] at hx +- simp only [endSet, Set.mem_setOf_eq] at hx ++ simp only [endSet, Set.mem_ofPred_eq] at hx + obtain ⟨R, hR, hxR⟩ := hx + simp only [List.mem_singleton] at hR + subst R +diff --git a/Schoenflies/SourceJoining.lean b/Schoenflies/SourceJoining.lean +--- a/Schoenflies/SourceJoining.lean ++++ b/Schoenflies/SourceJoining.lean +@@ -24,7 +24,7 @@ + + namespace Schoenflies + +-open Graph ++open _root_.Schoenflies.Graph + + variable {γ : Type*} {S₀ : CellStructure γ} + {srcOuter srcDom tgtOuter tgtDom : Set Plane} +@@ -92,10 +92,10 @@ + | v :: rest => + rw [segsOf_cons_cons] + by_cases huv : u = v +- · rw [if_pos huv] ++ · rw [ite_eq_left huv] + subst u + exact ih (List.cons_ne_nil v rest) hne +- · rw [if_neg huv] ++ · rw [ite_eq_right huv] + constructor + · exact ⟨(u, v), List.mem_cons_self, Or.inl rfl⟩ + · by_cases hvlast : v = (v :: rest).getLast (List.cons_ne_nil v rest) +@@ -299,7 +299,7 @@ + u.drawing e = + (Q.joinedCrosscutOverlay J p s epsilon extra joins).relabelDrawing + u.name segmentDrawing e := by +- rw [drawing, if_neg] ++ rw [drawing, ite_eq_right] + obtain ⟨R, hR, rfl⟩ := he + exact fun heOuter => u.name_fresh R hR + (P.str.mem_cells_of_mem_edgeSet (P.str.outerGraph_le.edgeSet_mono heOuter)) +@@ -636,8 +636,8 @@ + _root_.Graph.edgesCover u.drawing D = cover joins := by + let T := _root_.Graph.traceGraph u.graph u.drawing (cover joins) + have hTle : T ≤ u.graph := _root_.Graph.traceGraph_le _ +- letI : u.graph.Finite := u.graph_finite +- letI : T.Finite := _root_.Graph.Finite.of_le hTle ++ let : u.graph.Finite := u.graph_finite ++ let : T.Finite := _root_.Graph.Finite.of_le hTle + have hpoint : _root_.Graph.pointSet T u.drawing = cover joins := + u.joinTrace_pointSet hs hJ hJgeom hwindow hjoins hjoinsOpen + have hxGraph : x ∈ V(u.graph) := u.joinEnds_subset_graph hs hJ hjoins hxEnd +diff --git a/Schoenflies/SourceOverlay.lean b/Schoenflies/SourceOverlay.lean +--- a/Schoenflies/SourceOverlay.lean ++++ b/Schoenflies/SourceOverlay.lean +@@ -314,7 +314,7 @@ + V(Q.localOverlay p s epsilon extra) := by + intro x hx + rw [localGrid_eq, pieceListGraph_vertexSet] at hx +- simp only [endSet, Set.mem_setOf_eq] at hx ++ simp only [endSet, Set.mem_ofPred_eq] at hx + obtain ⟨R, hR, hxR⟩ := hx + change x ∈ V(overlayGraph (Q.localPieces p s epsilon) + (attachPoints (Q.localPieces p s epsilon) +@@ -478,7 +478,7 @@ + have hxmono := (localGridX_strictMono (p := p) hs hk).monotone + have hymono := (localGridY_strictMono (p := p) hs hk).monotone + rw [Plane.closedSquare_eq_inter] +- simp only [Set.mem_inter_iff, Set.mem_setOf_eq, gridPt] ++ simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, gridPt] + constructor + · constructor + · calc +@@ -668,7 +668,7 @@ + theorem drawing_of_inner {e : γ} (he : e ∈ E(w.innerGraph)) : + w.drawing e = + (Q.localOverlay p s epsilon extra).relabelDrawing w.name segmentDrawing e := by +- rw [drawing, if_neg] ++ rw [drawing, ite_eq_right] + obtain ⟨R, hR, rfl⟩ := he + exact fun heOuter => w.name_fresh R hR + (P.str.mem_cells_of_mem_edgeSet (P.str.outerGraph_le.edgeSet_mono heOuter)) +diff --git a/Schoenflies/Square.lean b/Schoenflies/Square.lean +--- a/Schoenflies/Square.lean ++++ b/Schoenflies/Square.lean +@@ -116,21 +116,21 @@ + + theorem convex_coord_le (i : Fin 2) (r : ℝ) : Convex ℝ {x : Plane | x i ≤ r} := by + intro x hx y hy a b ha hb hab +- simp only [mem_setOf_eq] at * ++ simp only [mem_ofPred_eq] at * + rw [smul_add_apply] + have hr : a * r + b * r = r := by rw [← add_mul, hab, one_mul] + nlinarith [mul_le_mul_of_nonneg_left hx ha, mul_le_mul_of_nonneg_left hy hb] + + theorem convex_coord_ge (i : Fin 2) (r : ℝ) : Convex ℝ {x : Plane | r ≤ x i} := by + intro x hx y hy a b ha hb hab +- simp only [mem_setOf_eq] at * ++ simp only [mem_ofPred_eq] at * + rw [smul_add_apply] + have hr : a * r + b * r = r := by rw [← add_mul, hab, one_mul] + nlinarith [mul_le_mul_of_nonneg_left hx ha, mul_le_mul_of_nonneg_left hy hb] + + theorem convex_coord_lt (i : Fin 2) (r : ℝ) : Convex ℝ {x : Plane | x i < r} := by + intro x hx y hy a b ha hb hab +- simp only [mem_setOf_eq] at * ++ simp only [mem_ofPred_eq] at * + rw [smul_add_apply] + have hr : a * r + b * r = r := by rw [← add_mul, hab, one_mul] + rcases eq_or_lt_of_le ha with rfl | ha' +@@ -140,7 +140,7 @@ + + theorem convex_coord_gt (i : Fin 2) (r : ℝ) : Convex ℝ {x : Plane | r < x i} := by + intro x hx y hy a b ha hb hab +- simp only [mem_setOf_eq] at * ++ simp only [mem_ofPred_eq] at * + rw [smul_add_apply] + have hr : a * r + b * r = r := by rw [← add_mul, hab, one_mul] + rcases eq_or_lt_of_le ha with rfl | ha' +@@ -167,7 +167,7 @@ + ({x : Plane | c 0 - r ≤ x 0} ∩ {x : Plane | x 0 ≤ c 0 + r}) ∩ + ({x : Plane | c 1 - r ≤ x 1} ∩ {x : Plane | x 1 ≤ c 1 + r}) := by + ext x +- simp only [closedSquare, supDist, supNorm, sub_apply, mem_setOf_eq, mem_inter_iff, ++ simp only [closedSquare, supDist, supNorm, sub_apply, mem_ofPred_eq, mem_inter_iff, + max_le_iff, abs_le] + constructor + · rintro ⟨⟨h1, h2⟩, h3, h4⟩; exact ⟨⟨by linarith, by linarith⟩, by linarith, by linarith⟩ +@@ -178,7 +178,7 @@ + ({x : Plane | c 0 - r < x 0} ∩ {x : Plane | x 0 < c 0 + r}) ∩ + ({x : Plane | c 1 - r < x 1} ∩ {x : Plane | x 1 < c 1 + r}) := by + ext x +- simp only [openSquare, supDist, supNorm, sub_apply, mem_setOf_eq, mem_inter_iff, ++ simp only [openSquare, supDist, supNorm, sub_apply, mem_ofPred_eq, mem_inter_iff, + max_lt_iff, abs_lt] + constructor + · rintro ⟨⟨h1, h2⟩, h3, h4⟩; exact ⟨⟨by linarith, by linarith⟩, by linarith, by linarith⟩ +@@ -223,7 +223,7 @@ + set B : Set Plane := {x : Plane | x 1 < -r} with hB + have hcover : beyondSquare r = R ∪ T ∪ L ∪ B := by + ext x +- simp only [beyondSquare, hR, hL, hT, hB, mem_setOf_eq, mem_union, lt_abs] ++ simp only [beyondSquare, hR, hL, hT, hB, mem_ofPred_eq, mem_union, lt_abs] + constructor + · rintro (h | h) <;> rcases h with h | h + · exact Or.inl (Or.inl (Or.inl h)) +diff --git a/Schoenflies/SquareCycle.lean b/Schoenflies/SquareCycle.lean +--- a/Schoenflies/SquareCycle.lean ++++ b/Schoenflies/SquareCycle.lean +@@ -650,7 +650,7 @@ + theorem sqCoord_top (hz : z ∈ segment ℝ (sqNE c r) (sqNW c r)) : + sqCoord c r z = dist (sqNE c r) z := by + classical +- rw [sqCoord, if_pos hz] ++ rw [sqCoord, ite_eq_left hz] + + theorem sqCoord_left (hr : 0 ≤ r) (hz : z ∈ segment ℝ (sqNW c r) (sqSW c r)) : + sqCoord c r z = 2 * r + dist (sqNW c r) z := by +@@ -658,8 +658,8 @@ + by_cases htop : z ∈ segment ℝ (sqNE c r) (sqNW c r) + · -- the shared corner, where the two formulas agree + obtain rfl := eq_sqNW_of_mem_top_left hr htop hz +- rw [sqCoord, if_pos htop, dist_sqNE_sqNW c hr, dist_self, add_zero] +- · rw [sqCoord, if_neg htop, if_pos hz] ++ rw [sqCoord, ite_eq_left htop, dist_sqNE_sqNW c hr, dist_self, add_zero] ++ · rw [sqCoord, ite_eq_right htop, ite_eq_left hz] + + theorem sqCoord_bottom (hr : 0 < r) (hz : z ∈ segment ℝ (sqSW c r) (sqSE c r)) : + sqCoord c r z = 4 * r + dist (sqSW c r) z := by +@@ -667,9 +667,9 @@ + have htop : z ∉ segment ℝ (sqNE c r) (sqNW c r) := notMem_top_of_mem_bottom hr hz + by_cases hleft : z ∈ segment ℝ (sqNW c r) (sqSW c r) + · obtain rfl := eq_sqSW_of_mem_left_bottom hr.le hleft hz +- rw [sqCoord, if_neg htop, if_pos hleft, dist_sqNW_sqSW c hr.le, dist_self, add_zero] ++ rw [sqCoord, ite_eq_right htop, ite_eq_left hleft, dist_sqNW_sqSW c hr.le, dist_self, add_zero] + ring +- · rw [sqCoord, if_neg htop, if_neg hleft, if_pos hz] ++ · rw [sqCoord, ite_eq_right htop, ite_eq_right hleft, ite_eq_left hz] + + theorem sqCoord_right (hr : 0 < r) (hz : z ∈ segment ℝ (sqSE c r) (sqNE c r)) + (hne : z ≠ sqNE c r) : sqCoord c r z = 6 * r + dist (sqSE c r) z := by +@@ -679,10 +679,13 @@ + have hleft : z ∉ segment ℝ (sqNW c r) (sqSW c r) := notMem_left_of_mem_right hr hz + by_cases hbot : z ∈ segment ℝ (sqSW c r) (sqSE c r) + · obtain rfl := eq_sqSE_of_mem_bottom_right hr.le hbot hz +- rw [sqCoord, if_neg htop, if_neg hleft, if_pos hbot, dist_sqSW_sqSE c hr.le, dist_self, ++ rw [sqCoord, ++ ite_eq_right htop, ++ ite_eq_right hleft, ++ ite_eq_left hbot, dist_sqSW_sqSE c hr.le, dist_self, + add_zero] + ring +- · rw [sqCoord, if_neg htop, if_neg hleft, if_neg hbot] ++ · rw [sqCoord, ite_eq_right htop, ite_eq_right hleft, ite_eq_right hbot] + + /-! ## Part 4: the overlay edges on one side + +diff --git a/Schoenflies/SquareMesh.lean b/Schoenflies/SquareMesh.lean +--- a/Schoenflies/SquareMesh.lean ++++ b/Schoenflies/SquareMesh.lean +@@ -110,7 +110,7 @@ + ext x + simp only [ringPieces, cover_cons, cover_nil, union_empty, mem_union, Piece.seg, + mem_segment_horiz, mem_segment_vert, segment_symm_Icc hr, segment_symm_Icc' hr, +- mem_Icc, ringSet, mem_setOf_eq, Plane.supNorm] ++ mem_Icc, ringSet, mem_ofPred_eq, Plane.supNorm] + -- On each side one coordinate is pinned to `±r` and the other is confined to `[-r, r]`; + -- which of the two is pinned is the only difference between the four sides. + have hleft : ∀ u v : ℝ, |u| = r → |v| ≤ r → max |u| |v| = r := by +@@ -275,9 +275,9 @@ + ∃ R ∈ splitAt p P, R.seg ⊆ P.seg ∧ (p = R.1 ∨ p = R.2) := by + classical + by_cases hp : p ∈ P.interior +- · refine ⟨(P.1, p), by rw [splitAt, if_pos hp]; simp, ?_, Or.inr rfl⟩ ++ · refine ⟨(P.1, p), by rw [splitAt, ite_eq_left hp]; simp, ?_, Or.inr rfl⟩ + exact (convex_segment P.1 P.2).segment_subset (left_mem_segment ℝ _ _) hmem +- · refine ⟨P, by rw [splitAt, if_neg hp]; simp, subset_rfl, ?_⟩ ++ · refine ⟨P, by rw [splitAt, ite_eq_right hp]; simp, subset_rfl, ?_⟩ + by_contra hcon + push Not at hcon + exact hp (mem_openSegment_of_ne_left_right (Ne.symm hcon.1) (Ne.symm hcon.2) hmem) +@@ -289,11 +289,11 @@ + by_cases hq : q ∈ P.interior + · have hqseg : q ∈ P.seg := openSegment_subset_segment ℝ _ _ hq + rcases h with rfl | rfl +- · refine ⟨(P.1, q), by rw [splitAt, if_pos hq]; simp, ?_, Or.inl rfl⟩ ++ · refine ⟨(P.1, q), by rw [splitAt, ite_eq_left hq]; simp, ?_, Or.inl rfl⟩ + exact (convex_segment P.1 P.2).segment_subset (left_mem_segment ℝ _ _) hqseg +- · refine ⟨(q, P.2), by rw [splitAt, if_pos hq]; simp, ?_, Or.inr rfl⟩ ++ · refine ⟨(q, P.2), by rw [splitAt, ite_eq_left hq]; simp, ?_, Or.inr rfl⟩ + exact (convex_segment P.1 P.2).segment_subset hqseg (right_mem_segment ℝ _ _) +- · exact ⟨P, by rw [splitAt, if_neg hq]; simp, subset_rfl, h⟩ ++ · exact ⟨P, by rw [splitAt, ite_eq_right hq]; simp, subset_rfl, h⟩ + + theorem splitAllAt_preserves_end (q : Plane) {p : Plane} {P : Piece} {pieces : List Piece} + (h : ∃ R ∈ pieces, R.seg ⊆ P.seg ∧ (p = R.1 ∨ p = R.2)) : +diff --git a/Schoenflies/SquareMeshClosed.lean b/Schoenflies/SquareMeshClosed.lean +--- a/Schoenflies/SquareMeshClosed.lean ++++ b/Schoenflies/SquareMeshClosed.lean +@@ -216,7 +216,7 @@ + Graph.edgesCover segmentDrawing (t.1 :: t.2.2.2.2) = modelCurve := by + obtain ⟨e, u, v, x, D, h₁, h₂, h₃⟩ := squareMesh_outer_cycle hfresh δ anchors + exact ⟨(e, u, v, x, D), h₁, h₂, h₃⟩ +- have hd : outerCycleData δ fresh anchors = h.choose := dif_pos h ++ have hd : outerCycleData δ fresh anchors = h.choose := dite_eq_left h + simpa [outerCycleEdge, outerCycleStart, outerCycleEnd, outerCycleThird, outerCycleDetour, hd] + using h.choose_spec + +@@ -745,7 +745,7 @@ + ∀ Q, Q ∈ W ↔ (Q ∈ E(meshGraph N fresh anchors) ∧ Q.seg ⊆ (spokePiece N z).seg) := + meshSubdividesToPath hN hfresh anchors _ (spokePiece_mem_meshSegments hz) + (spokePiece_nondeg hN (hfresh z hz)) +- rw [spokeWalk, dif_pos h] ++ rw [spokeWalk, dite_eq_left h] + exact h.choose_spec + + theorem spokeWalk_isPath {N : ℕ} (hN : 2 ≤ N) {fresh : List Plane} +@@ -834,7 +834,7 @@ + classical + have h : ∃ P : List Piece, (ringGraph N fresh anchors r).IsPath a P b := + (ringGraph_isTwoConnected hN hfresh anchors hr).connected.exists_isPath ha hb +- rw [ringArc, dif_pos h] ++ rw [ringArc, dite_eq_left h] + exact h.choose_spec + + /-- **The ear**: down the spoke at `z`, round the inner ring, and back up the spoke at `w`. -/ +diff --git a/Schoenflies/SquareMeshConnected.lean b/Schoenflies/SquareMeshConnected.lean +--- a/Schoenflies/SquareMeshConnected.lean ++++ b/Schoenflies/SquareMeshConnected.lean +@@ -314,7 +314,7 @@ + rcases hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases hvw with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> simp + edge_mem_iff_exists_isLink := by + intro P +- simp only [Set.mem_setOf_eq] ++ simp only [Set.mem_ofPred_eq] + exact ⟨fun hP => ⟨P.1, P.2, hP, Or.inl ⟨rfl, rfl⟩⟩, fun ⟨_, _, hP, _⟩ => hP⟩ + left_mem_of_isLink := by + rintro P x y ⟨hP, h⟩ +@@ -361,7 +361,7 @@ + + theorem endSet_append (l l' : List Piece) : endSet (l ++ l') = endSet l ∪ endSet l' := by + ext v +- simp only [endSet, Set.mem_setOf_eq, Set.mem_union, List.mem_append] ++ simp only [endSet, Set.mem_ofPred_eq, Set.mem_union, List.mem_append] + constructor + · rintro ⟨P, hP | hP, h⟩ + exacts [Or.inl ⟨P, hP, h⟩, Or.inr ⟨P, hP, h⟩] +@@ -378,7 +378,7 @@ + Graph.pointSet (pieceListGraph l) segmentDrawing = cover l := by + ext z + simp only [Graph.pointSet, Set.mem_union, Set.mem_iUnion, exists_prop, pieceListGraph_vertexSet, +- endSet, Set.mem_setOf_eq, pieceListGraph_mem_edgeSet, edgeArc_segmentDrawing, cover] ++ endSet, Set.mem_ofPred_eq, pieceListGraph_mem_edgeSet, edgeArc_segmentDrawing, cover] + constructor + · rintro (⟨P, hP, hzP⟩ | ⟨P, hP, hzP⟩) + · refine ⟨P, hP, ?_⟩ +@@ -662,9 +662,9 @@ + theorem bIdy_le {m n t : ℕ} (h : t ≤ 2 * m + 2 * n) : bIdy m n t ≤ n := by + unfold bIdy; split_ifs <;> omega + +-theorem bIdx_bottom {m n t : ℕ} (h : t ≤ m) : bIdx m n t = t := by unfold bIdx; exact if_pos h +- +-theorem bIdy_bottom {m n t : ℕ} (h : t ≤ m) : bIdy m n t = 0 := by unfold bIdy; exact if_pos h ++theorem bIdx_bottom {m n t : ℕ} (h : t ≤ m) : bIdx m n t = t := by unfold bIdx; exact ite_eq_left h ++ ++theorem bIdy_bottom {m n t : ℕ} (h : t ≤ m) : bIdy m n t = 0 := by unfold bIdy; exact ite_eq_left h + + theorem bIdx_right {m n t : ℕ} (h₁ : m ≤ t) (h₂ : t ≤ m + n) : bIdx m n t = m := by + unfold bIdx; split_ifs <;> omega +@@ -737,25 +737,29 @@ + unfold gridBoundaryEdge gridBoundaryPt gridGraph + rcases lt_or_ge t m with h₁ | h₁ + · -- along the bottom +- rw [if_pos h₁, bIdx_bottom (by omega), bIdy_bottom (by omega), bIdx_bottom (by omega), ++ rw [ite_eq_left h₁, bIdx_bottom (by omega), bIdy_bottom (by omega), bIdx_bottom (by omega), + bIdy_bottom (by omega)] + exact pieceListGraph_isLink_self (gridHEdge_mem_gridEdges h₁ (Nat.zero_le n) hn) + rcases lt_or_ge t (m + n) with h₂ | h₂ + · -- up the right side +- rw [if_neg (by omega), if_pos h₂, bIdx_right (by omega) (by omega), ++ rw [ite_eq_right (by omega), ite_eq_left h₂, bIdx_right (by omega) (by omega), + bIdy_right (by omega) (by omega), bIdx_right (by omega) (by omega), + bIdy_right (by omega) (by omega), show t + 1 - m = (t - m) + 1 by omega] + exact pieceListGraph_isLink_self (gridVEdge_mem_gridEdges le_rfl (by omega) hm) + rcases lt_or_ge t (2 * m + n) with h₃ | h₃ + · -- back along the top, so the walk runs against the edge's own orientation +- rw [if_neg (by omega), if_neg (by omega), if_pos h₃, bIdx_top (by omega) (by omega), ++ rw [ite_eq_right (by omega), ++ ite_eq_right (by omega), ++ ite_eq_left h₃, bIdx_top (by omega) (by omega), + bIdy_top (by omega) (by omega), bIdx_top (by omega) (by omega), + bIdy_top (by omega) (by omega), show 2 * m + n - (t + 1) = 2 * m + n - 1 - t by omega, + show 2 * m + n - t = 2 * m + n - 1 - t + 1 by omega] + exact (pieceListGraph_isLink_self (gridHEdge_mem_gridEdges + (show 2 * m + n - 1 - t < m by omega) le_rfl hn)).symm + · -- down the left side, again against the edge's orientation +- rw [if_neg (by omega), if_neg (by omega), if_neg (by omega), bIdx_left (by omega) (by omega), ++ rw [ite_eq_right (by omega), ++ ite_eq_right (by omega), ++ ite_eq_right (by omega), bIdx_left (by omega) (by omega), + bIdy_left (by omega) (by omega), bIdx_left (by omega) (by omega), + bIdy_left (by omega) (by omega), + show 2 * m + 2 * n - (t + 1) = 2 * m + 2 * n - 1 - t by omega, +@@ -814,23 +818,23 @@ + + theorem gridBoundaryEdge_bottom {xc yc : ℕ → ℝ} {m n i : ℕ} (h : i < m) : + gridBoundaryEdge xc yc m n i = gridHEdge xc yc i 0 := by +- unfold gridBoundaryEdge; rw [if_pos h] ++ unfold gridBoundaryEdge; rw [ite_eq_left h] + + theorem gridBoundaryEdge_right {xc yc : ℕ → ℝ} {m n j : ℕ} (h : j < n) : + gridBoundaryEdge xc yc m n (m + j) = gridVEdge xc yc m j := by + unfold gridBoundaryEdge +- rw [if_neg (by omega), if_pos (by omega), show m + j - m = j by omega] ++ rw [ite_eq_right (by omega), ite_eq_left (by omega), show m + j - m = j by omega] + + theorem gridBoundaryEdge_top {xc yc : ℕ → ℝ} {m n i : ℕ} (hn : 1 ≤ n) (h : i < m) : + gridBoundaryEdge xc yc m n (2 * m + n - 1 - i) = gridHEdge xc yc i n := by + unfold gridBoundaryEdge +- rw [if_neg (by omega), if_neg (by omega), if_pos (by omega), ++ rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_left (by omega), + show 2 * m + n - 1 - (2 * m + n - 1 - i) = i by omega] + + theorem gridBoundaryEdge_left {xc yc : ℕ → ℝ} {m n j : ℕ} (h : j < n) : + gridBoundaryEdge xc yc m n (2 * m + 2 * n - 1 - j) = gridVEdge xc yc 0 j := by + unfold gridBoundaryEdge +- rw [if_neg (by omega), if_neg (by omega), if_neg (by omega), ++ rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_right (by omega), + show 2 * m + 2 * n - 1 - (2 * m + 2 * n - 1 - j) = j by omega] + + /-- The realisation of the cycle is the union of the boundary edges, indexed by position on +diff --git a/Schoenflies/SquareMeshFixed.lean b/Schoenflies/SquareMeshFixed.lean +--- a/Schoenflies/SquareMeshFixed.lean ++++ b/Schoenflies/SquareMeshFixed.lean +@@ -133,7 +133,7 @@ + + theorem endSet_pair (a q b : Plane) : endSet [((a, q) : Piece), (q, b)] = {a, q, b} := by + ext x +- simp only [endSet, mem_setOf_eq, List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, ++ simp only [endSet, mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, + mem_singleton_iff] + constructor + · rintro ⟨P, hP, hx⟩ +@@ -240,7 +240,7 @@ + induction l with + | nil => rfl + | cons R l ih => +- rw [splitAllAt, List.flatMap_cons, splitAt, if_neg (h R (List.mem_cons_self ..))] ++ rw [splitAllAt, List.flatMap_cons, splitAt, ite_eq_right (h R (List.mem_cons_self ..))] + rw [show l.flatMap (splitAt q) = splitAllAt q l from rfl, + ih fun S hS => h S (List.mem_cons_of_mem _ hS)] + rfl +@@ -256,22 +256,22 @@ + obtain ⟨S, hS, hRS⟩ := List.mem_flatMap.1 hR + by_cases hqS : q ∈ S.interior + · obtain rfl := huniq S hS hqS +- rw [splitAt, if_pos hqS] at hRS ++ rw [splitAt, ite_eq_left hqS] at hRS + exact Or.inr hRS +- · rw [splitAt, if_neg hqS] at hRS ++ · rw [splitAt, ite_eq_right hqS] at hRS + obtain rfl : R = S := List.mem_singleton.1 hRS + exact Or.inl ⟨hS, fun h => hqS (h ▸ hq)⟩ + · rintro (⟨hR, hRP⟩ | hR) + · have hqR : q ∉ R.interior := fun h => hRP (huniq R hR h) +- exact List.mem_flatMap.2 ⟨R, hR, by rw [splitAt, if_neg hqR]; simp⟩ +- · exact List.mem_flatMap.2 ⟨P, hP, by rw [splitAt, if_pos hq]; exact hR⟩ ++ exact List.mem_flatMap.2 ⟨R, hR, by rw [splitAt, ite_eq_right hqR]; simp⟩ ++ · exact List.mem_flatMap.2 ⟨P, hP, by rw [splitAt, ite_eq_left hq]; exact hR⟩ + + /-- The ends of a split list: the old ends and the cut point. -/ + theorem endSet_splitAllAt {l : List Piece} {P : Piece} {q : Plane} (hP : P ∈ l) + (hq : q ∈ P.interior) (huniq : ∀ S ∈ l, q ∈ S.interior → S = P) : + endSet (splitAllAt q l) = endSet l ∪ {q} := by + ext v +- simp only [endSet, mem_setOf_eq, mem_union, mem_singleton_iff] ++ simp only [endSet, mem_ofPred_eq, mem_union, mem_singleton_iff] + constructor + · rintro ⟨R, hR, hv⟩ + rcases (mem_splitAllAt_iff hP hq huniq).1 hR with ⟨hRl, -⟩ | hR2 +@@ -373,7 +373,7 @@ + (splitAt_interior_subset q' S₀ S hSS₀ hqS) + -- … and the two halves of one piece have disjoint interiors + by_cases hq'R : q' ∈ R₀.interior +- · rw [splitAt, if_pos hq'R] at hRR₀ hSS₀ ++ · rw [splitAt, ite_eq_left hq'R] at hRR₀ hSS₀ + simp only [List.mem_cons, List.not_mem_nil, or_false] at hRR₀ hSS₀ + have hnd₀ : R₀.Nondeg := hnd R₀ hR₀ + rcases hRR₀ with rfl | rfl <;> rcases hSS₀ with rfl | rfl +@@ -381,7 +381,7 @@ + · exact absurd (openSegment_halves_disjoint hnd₀ hq'R hqR hqS) not_false + · exact absurd (openSegment_halves_disjoint hnd₀ hq'R hqS hqR) not_false + · rfl +- · rw [splitAt, if_neg hq'R] at hRR₀ hSS₀ ++ · rw [splitAt, ite_eq_right hq'R] at hRR₀ hSS₀ + rw [List.mem_singleton.1 hRR₀, List.mem_singleton.1 hSS₀] + · rcases hq.2 with hnone | hend + · exact Or.inl fun R hR => by +diff --git a/Schoenflies/SquareMover.lean b/Schoenflies/SquareMover.lean +--- a/Schoenflies/SquareMover.lean ++++ b/Schoenflies/SquareMover.lean +@@ -96,10 +96,10 @@ + noncomputable def bend (r p q u : ℝ) : ℝ := + if u ≤ p then -r + (u + r) * (q + r) / (p + r) else r - (r - u) * (r - q) / (r - p) + +-theorem bend_of_le (h : u ≤ p) : bend r p q u = -r + (u + r) * (q + r) / (p + r) := if_pos h ++theorem bend_of_le (h : u ≤ p) : bend r p q u = -r + (u + r) * (q + r) / (p + r) := ite_eq_left h + + theorem bend_of_gt (h : p < u) : bend r p q u = r - (r - u) * (r - q) / (r - p) := +- if_neg (not_le.2 h) ++ ite_eq_right (not_le.2 h) + + theorem bend_left (h : -r ≤ p) : bend r p q (-r) = -r := by + rw [bend_of_le h]; simp +@@ -279,7 +279,7 @@ + c i + bend r (a + k * shearWeight c r b j z) (a + (k + k') * shearWeight c r b j z) + (z i - c i) := by + simp only [shear, PiLp.add_apply, PiLp.smul_apply, PiLp.single_apply, smul_eq_mul, +- if_true, mul_one] ++ ite_true, mul_one] + ring + + theorem shear_apply_ne (h : l ≠ i) : shear c r a b k k' i j z l = z l := by +@@ -585,13 +585,13 @@ + · rintro ⟨h1, h2⟩ + exact le_antisymm h1 (not_lt.1 h2) + · intro h +- exact ⟨le_of_eq h, by rw [openSquare, mem_setOf_eq, h]; exact lt_irrefl r⟩ ++ exact ⟨le_of_eq h, by rw [openSquare, mem_ofPred_eq, h]; exact lt_irrefl r⟩ + + /-- A mover is the identity on the boundary square `S`. -/ + theorem IsSquareMover.eqOn_frontier {M N : Plane → Plane} (h : IsSquareMover c r M N) : + EqOn M id (frontier (closedSquare c r)) := by + intro z hz +- rw [frontier_closedSquare, mem_setOf_eq] at hz ++ rw [frontier_closedSquare, mem_ofPred_eq] at hz + exact h.fixes z (le_of_eq hz) hz + + /-! ### The mover as a homeomorphism -/ +@@ -603,8 +603,8 @@ + invFun z := ⟨N z, h.mapsTo_inv z.2⟩ + left_inv z := Subtype.ext (h.invOn.1 z.2) + right_inv z := Subtype.ext (h.invOn.2 z.2) +- continuous_toFun := h.continuousOn.restrict.subtype_mk _ +- continuous_invFun := h.continuousOn_inv.restrict.subtype_mk _ ++ continuous_toFun := h.continuousOn.domRestrict.subtype_mk _ ++ continuous_invFun := h.continuousOn_inv.domRestrict.subtype_mk _ + + @[simp] theorem IsSquareMover.homeomorph_apply {M N : Plane → Plane} + (h : IsSquareMover c r M N) (z : closedSquare c r) : +diff --git a/Schoenflies/Strip.lean b/Schoenflies/Strip.lean +--- a/Schoenflies/Strip.lean ++++ b/Schoenflies/Strip.lean +@@ -207,7 +207,7 @@ + have harc : arcCCW u w = {d : Plane | det w d < 0} ∪ {d : Plane | det d u < 0} := by + ext d + rw [mem_arcCCW_rev_iff h'] +- simp only [mem_union, mem_setOf_eq] ++ simp only [mem_union, mem_ofPred_eq] + have hd0 : (-ε) • (u + w) ∈ ball (0 : Plane) ρ := + hball _ (by rw [abs_of_neg (neg_neg_iff_pos.2 hε), neg_neg]) + have hA : (-ε) • (u + w) ∈ {d : Plane | det w d < 0} := by +@@ -227,7 +227,7 @@ + have harc : arcCCW u w = {d : Plane | 0 < det u d} ∩ {d : Plane | 0 < det d w} := by + ext d + rw [mem_arcCCW_iff hpos] +- simp only [mem_inter_iff, mem_setOf_eq] ++ simp only [mem_inter_iff, mem_ofPred_eq] + have hmem : ε • (u + w) ∈ arcCCW u w ∩ ball (0 : Plane) ρ := by + refine ⟨?_, hball _ (abs_of_pos hε)⟩ + rw [harc] +@@ -275,7 +275,7 @@ + module + · rintro ⟨d, ⟨hd, hb⟩, rfl⟩ + have he : v + d - v = d := by module +- refine ⟨by rw [mem_setOf_eq, he]; exact hd, ?_⟩ ++ refine ⟨by rw [mem_ofPred_eq, he]; exact hd, ?_⟩ + rw [mem_ball, dist_eq_norm, he] + rw [mem_ball, dist_zero_right] at hb + exact hb +@@ -388,7 +388,7 @@ + ({x : Plane | t₁ < coordAlong a u x} ∩ {x : Plane | coordAlong a u x < t₂}) ∩ + ({x : Plane | s₁ < coordAcross a u x} ∩ {x : Plane | coordAcross a u x < s₂}) := by + ext y +- simp only [mem_strip_iff, mem_inter_iff, mem_setOf_eq] ++ simp only [mem_strip_iff, mem_inter_iff, mem_ofPred_eq] + tauto + rw [key] + exact ((isOpen_lt continuous_const (continuous_coordAlong a u)).inter +@@ -407,7 +407,7 @@ + simp only [coordAcross, det] + simp + ring +- simp only [mem_strip_iff, mem_inter_iff, mem_setOf_eq, h1, h2] ++ simp only [mem_strip_iff, mem_inter_iff, mem_ofPred_eq, h1, h2] + constructor + · rintro ⟨a1, a2, a3, a4⟩; exact ⟨⟨by linarith, by linarith⟩, ⟨by linarith, by linarith⟩⟩ + · rintro ⟨⟨a1, a2⟩, ⟨a3, a4⟩⟩; exact ⟨by linarith, by linarith, by linarith, by linarith⟩ +diff --git a/Schoenflies/StripLocal.lean b/Schoenflies/StripLocal.lean +--- a/Schoenflies/StripLocal.lean ++++ b/Schoenflies/StripLocal.lean +@@ -288,7 +288,7 @@ + (have hδpos : 0 < min 1 (ε / (2 * ‖z - P.vertex i‖)) := lt_min one_pos (by positivity) + have hsub : P.vertex i + (min 1 (ε / (2 * ‖z - P.vertex i‖))) • (z - P.vertex i) - + P.vertex i = (min 1 (ε / (2 * ‖z - P.vertex i‖))) • (z - P.vertex i) := by module) +- · rw [Set.mem_setOf_eq, hsub] ++ · rw [Set.mem_ofPred_eq, hsub] + exact (smul_mem_arcCCW hδpos).2 harc + · rw [mem_ball, dist_eq_norm, hsub, norm_smul, Real.norm_eq_abs, abs_of_pos hδpos] + have h1 : min 1 (ε / (2 * ‖z - P.vertex i‖)) ≤ 1 := min_le_left _ _ +@@ -309,7 +309,7 @@ + (have hδpos : 0 < min 1 (ε / (2 * ‖z - P.vertex i‖)) := lt_min one_pos (by positivity) + have hsub : P.vertex i + (min 1 (ε / (2 * ‖z - P.vertex i‖))) • (z - P.vertex i) - + P.vertex i = (min 1 (ε / (2 * ‖z - P.vertex i‖))) • (z - P.vertex i) := by module) +- · rw [Set.mem_setOf_eq, hsub] ++ · rw [Set.mem_ofPred_eq, hsub] + exact (smul_mem_arcCCW hδpos).2 harc + · rw [mem_ball, dist_eq_norm, hsub, norm_smul, Real.norm_eq_abs, abs_of_pos hδpos] + have h1 : min 1 (ε / (2 * ‖z - P.vertex i‖)) ≤ 1 := min_le_left _ _ +diff --git a/Schoenflies/Subarc.lean b/Schoenflies/Subarc.lean +--- a/Schoenflies/Subarc.lean ++++ b/Schoenflies/Subarc.lean +@@ -78,7 +78,8 @@ + theorem image_reparam_I : reparam a b '' I = uIcc a b := by + have h : (fun θ : ℝ => a + θ • (b - a)) '' Icc (0 : ℝ) 1 = uIcc a b := by + rw [← segment_eq_image' ℝ a b, segment_eq_uIcc] +- simpa [reparam, smul_eq_mul] using h ++ change (fun t : ℝ => a + t * (b - a)) '' Icc (0 : ℝ) 1 = uIcc a b ++ simpa only [smul_eq_mul] using h + + theorem mapsTo_reparam : MapsTo (reparam a b) I (uIcc a b) := + mapsTo_iff_image_subset.mpr image_reparam_I.subset +diff --git a/Schoenflies/TargetOverlay.lean b/Schoenflies/TargetOverlay.lean +--- a/Schoenflies/TargetOverlay.lean ++++ b/Schoenflies/TargetOverlay.lean +@@ -84,7 +84,7 @@ + theorem exists_targetSegmentCover + (P : GeneratedPair S₀ srcOuter srcDom tgtOuter tgtDom) : + Nonempty (TargetSegmentCover P) := by +- letI : Graph.Finite P.tgt.graph := ++ let : Graph.Finite P.tgt.graph := + CellStructure.Realization.finite_graph P.tgt + have hincident : ∀ z ∈ V(P.tgt.graph), ∃ e, P.tgt.graph.Inc e z := by + intro z hz +@@ -1024,7 +1024,7 @@ + A ∈ openTargetEdgePieces P ↔ + ∃ e ∈ E(P.str.skel), e ∉ E(P.str.outerGraph) ∧ + A = edgeArc P.tgt.drawing e \ modelCurve := by +- letI : P.str.skel.Finite := ++ let : P.str.skel.Finite := + ⟨P.str.finite_vertexSet, P.str.finite_edgeSet⟩ + simp only [openTargetEdgePieces, List.mem_map, Finset.mem_toList, Finset.mem_filter, + Graph.mem_edgeFinset] +diff --git a/lakefile.toml b/lakefile.toml +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -12,7 +12,7 @@ + [[require]] + name = "mathlib" + scope = "leanprover-community" +-rev = "v4.32.2" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "Schoenflies" +diff --git a/lean-toolchain b/lean-toolchain +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.2 ++leanprover/lean4:v4.34.1 +diff --git a/Schoenflies/Jordan.lean b/Schoenflies/Jordan.lean +index fef1405..ad432b8 100644 +--- a/Schoenflies/Jordan.lean ++++ b/Schoenflies/Jordan.lean +@@ -719,7 +719,7 @@ theorem not_three_components (harc : ∀ A : Set Plane, IsArc A → IsConnected + first + | exact absurd rfl hjl + | assumption +- | (rw [inter_comm]; assumption) ++ | rwa [inter_comm] + choose xx hxxΩ TT hTTarc hTTsub hTTmeet using htri + /- ### Assembling the `K(3,3)` -/ + have hTC : ∀ i j, TT i j ∩ f '' I = {f (t i j)} := by diff --git a/lean/patches/tate-curves-theta-lean4341.patch b/lean/patches/tate-curves-theta-lean4341.patch index e32c4d3cebc0669c3b24c28b88ec9c5b59b38172..02f7fb07df38bc9038c27c836460fd6d61d5ffb7 100644 --- a/lean/patches/tate-curves-theta-lean4341.patch +++ b/lean/patches/tate-curves-theta-lean4341.patch @@ -1,143 +1,143 @@ -diff --git a/lake-manifest.json b/lake-manifest.json -index 5772203cbac85733227425f851da565f55eaf8d2..d476272f0c5c68c6ea0bdb3cea5ea14f93f13c5c 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,7 +1,7 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/lana-agents/formal-schemes", -+ [{"url": "https://github.com/lana-agents/formal-schemes.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -11,21 +11,21 @@ - "inputRev": "51aa935079537bf4dc580751a6e70727fb23ca93", - "inherited": false, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/mathlib4", -+ {"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -35,7 +35,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +45,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -65,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -75,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -85,7 +85,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -95,10 +95,10 @@ - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "«tate-curves-theta»", -diff --git a/lakefile.toml b/lakefile.toml -index 9b84bd9125231e37c29c21da2a84d83e9668197e..0d2775da50050fb49d958ce5c9b01199cd8ee0fb 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,6 +4,8 @@ keywords = ["math"] - defaultTargets = ["TateCurvesTheta"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true -@@ -11,12 +13,12 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[require]] - name = "formal-schemes" --git = "https://github.com/lana-agents/formal-schemes" -+git = "https://github.com/lana-agents/formal-schemes.git" - rev = "51aa935079537bf4dc580751a6e70727fb23ca93" - - [[lean_lib]] -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/lake-manifest.json b/lake-manifest.json +index 5772203cbac85733227425f851da565f55eaf8d2..d476272f0c5c68c6ea0bdb3cea5ea14f93f13c5c 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,7 +1,7 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/lana-agents/formal-schemes", ++ [{"url": "https://github.com/lana-agents/formal-schemes.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -11,21 +11,21 @@ + "inputRev": "51aa935079537bf4dc580751a6e70727fb23ca93", + "inherited": false, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/mathlib4", ++ {"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -35,7 +35,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +45,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -65,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -75,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -85,7 +85,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -95,10 +95,10 @@ + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "«tate-curves-theta»", +diff --git a/lakefile.toml b/lakefile.toml +index 9b84bd9125231e37c29c21da2a84d83e9668197e..0d2775da50050fb49d958ce5c9b01199cd8ee0fb 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,6 +4,8 @@ keywords = ["math"] + defaultTargets = ["TateCurvesTheta"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true +@@ -11,12 +13,12 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[require]] + name = "formal-schemes" +-git = "https://github.com/lana-agents/formal-schemes" ++git = "https://github.com/lana-agents/formal-schemes.git" + rev = "51aa935079537bf4dc580751a6e70727fb23ca93" + + [[lean_lib]] +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/lean/patches/tempered-fundamental-groups-lean4341.patch b/lean/patches/tempered-fundamental-groups-lean4341.patch index 68507f9bad16237886449c8ad046bed7d191a528..4491cc15d9677e4922ad993fbd84801bf166fb15 100644 --- a/lean/patches/tempered-fundamental-groups-lean4341.patch +++ b/lean/patches/tempered-fundamental-groups-lean4341.patch @@ -1,272 +1,272 @@ -diff --git a/TemperedFundamentalGroups/Models/Projective.lean b/TemperedFundamentalGroups/Models/Projective.lean -index 0f8582d7e728987f7bf3a8c23c46c27b93aae30c..5ff142d2155f8401695f70661069691b55f445e1 100644 ---- a/TemperedFundamentalGroups/Models/Projective.lean -+++ b/TemperedFundamentalGroups/Models/Projective.lean -@@ -84,7 +84,7 @@ open MvPolynomial HomogeneousLocalization - variable {R} - - lemma isHomogeneous_fin_one {p : MvPolynomial (Fin (0 + 1)) R} {n : ℕ} (hp : p.IsHomogeneous n) : -- p = C (coeff (Finsupp.single 0 n) p) * X 0 ^ n := by -+ p = C (p.coeff (Finsupp.single 0 n)) * X 0 ^ n := by - ext d - rw [coeff_C_mul, coeff_X_pow] - by_cases hd : Finsupp.single 0 n = d -@@ -129,7 +129,7 @@ lemma bijective_fromZeroRingHom_projSpace_zero : - · obtain ⟨n, a, ha, rfl⟩ := Away.mk_surjective (homogeneousSubmodule (Fin (0 + 1)) R) - X_zero_mem_homogeneousSubmodule z - have ha' : a.IsHomogeneous n := by simpa using ha -- refine ⟨⟨C (coeff (Finsupp.single 0 n) a), isHomogeneous_C _ _⟩, ?_⟩ -+ refine ⟨⟨C (a.coeff (Finsupp.single 0 n)), isHomogeneous_C _ _⟩, ?_⟩ - apply val_injective - rw [Away.val_mk] - change Localization.mk _ 1 = _ -diff --git a/TemperedFundamentalGroups/Models/Specialization.lean b/TemperedFundamentalGroups/Models/Specialization.lean -index 00f4b73f89c33df5476307335fb0195af1b36ed5..e3dd586fa3e3eb43feb6b88c6b69f9778de9e3c3 100644 ---- a/TemperedFundamentalGroups/Models/Specialization.lean -+++ b/TemperedFundamentalGroups/Models/Specialization.lean -@@ -192,7 +192,12 @@ lemma spLift_unique [UniversallyClosed f] [IsSeparated f] (x : Spec (CommRingCat - lemma spLift_closedPoint_mem [UniversallyClosed f] (x : Spec (CommRingCat.of Ω) ⟶ X) - (hx : x ≫ f = Spec.map (CommRingCat.ofHom (valToField O))) : - (spLift (hV := hV) x hx).l (closedPoint V) ∈ specialFibre f := by -- rw [mem_specialFibre, ← Scheme.Hom.comp_apply, spLift_fac_right] -+ let ℓ : Spec (CommRingCat.of V) ⟶ X := (spLift (hV := hV) x hx).l -+ let v : Spec (CommRingCat.of V) := closedPoint V -+ have hℓ : ℓ ≫ f = Spec.map (CommRingCat.ofHom (valToVal O V hV)) := -+ spLift_fac_right x hx -+ change ℓ v ∈ specialFibre f -+ rw [mem_specialFibre, ← Scheme.Hom.comp_apply, hℓ] - exact valToVal_closedPoint O V hV - - end Specialization -@@ -228,10 +233,15 @@ lemma sp_comp {X' : Scheme.{u}} {f' : X' ⟶ Spec (CommRingCat.of O)} - (hx : x ≫ f = Spec.map (CommRingCat.ofHom (valToField O))) : - sp f' V hV (x ≫ ψ) (by rw [Category.assoc, hψ, hx]) = - specialFibreMap ψ hψ (sp f V hV x hx) := by -+ let ℓ : Spec (CommRingCat.of V) ⟶ X := (spLift (hV := hV) x hx).l -+ have hℓ_left : Spec.map (CommRingCat.ofHom (algebraMap V Ω)) ≫ ℓ = x := -+ spLift_fac_left x hx -+ have hℓ_right : ℓ ≫ f = Spec.map (CommRingCat.ofHom (valToVal O V hV)) := -+ spLift_fac_right x hx - ext -- rw [sp_eq_of_lift (x ≫ ψ) _ ((spLift (hV := hV) x hx).l ≫ ψ) -- (by rw [← Category.assoc, spLift_fac_left]) -- (by rw [Category.assoc, hψ]; exact spLift_fac_right x hx)] -+ rw [sp_eq_of_lift (x ≫ ψ) _ (ℓ ≫ ψ) -+ (by rw [← Category.assoc, hℓ_left]) -+ (by rw [Category.assoc, hψ, hℓ_right])] - rfl - - lemma coe_sp_comp {X' : Scheme.{u}} {f' : X' ⟶ Spec (CommRingCat.of O)} -@@ -268,22 +278,26 @@ lemma sp_galois [UniversallyClosed f] [IsSeparated f] (σ : Ω ≃ₐ[K] Ω) - congr 2 - ext a - simp [valToField]) = sp f V hV x hx := by -+ let ℓ : Spec (CommRingCat.of V) ⟶ X := (spLift (hV := hV) x hx).l -+ have hℓ_left : Spec.map (CommRingCat.ofHom (algebraMap V Ω)) ≫ ℓ = x := -+ spLift_fac_left x hx -+ have hℓ_right : ℓ ≫ f = Spec.map (CommRingCat.ofHom (valToVal O V hV)) := -+ spLift_fac_right x hx - ext -- rw [sp_eq_of_lift _ _ (Spec.map (CommRingCat.ofHom (restrictVal σ hσ)) ≫ -- (spLift (hV := hV) x hx).l)] -- · change (spLift (hV := hV) x hx).l _ = (spLift (hV := hV) x hx).l _ -+ rw [sp_eq_of_lift _ _ (Spec.map (CommRingCat.ofHom (restrictVal σ hσ)) ≫ ℓ)] -+ · change ℓ _ = ℓ _ - congr 1 - exact comap_closedPoint (restrictVal σ hσ) - · have e : (algebraMap V Ω).comp (restrictVal σ hσ) = (σ : Ω →+* Ω).comp (algebraMap V Ω) := by - ext; rfl - rw [← Category.assoc, ← Spec.map_comp, ← CommRingCat.ofHom_comp, e, -- CommRingCat.ofHom_comp, Spec.map_comp, Category.assoc, spLift_fac_left] -+ CommRingCat.ofHom_comp, Spec.map_comp, Category.assoc, hℓ_left] - · have e : (restrictVal σ hσ).comp (valToVal O V hV) = valToVal O V hV := by - ext a - exact σ.commutes (a : K) - rw [Category.assoc] - refine (congrArg (Spec.map (CommRingCat.ofHom (restrictVal σ hσ)) ≫ ·) -- (spLift_fac_right (hV := hV) x hx)).trans ?_ -+ hℓ_right).trans ?_ - rw [← Spec.map_comp, ← CommRingCat.ofHom_comp, e] - - end Specialization -diff --git a/TemperedFundamentalGroups/SemistableReduction/NodeNormal.lean b/TemperedFundamentalGroups/SemistableReduction/NodeNormal.lean -index 393ca04750fcc7b0bdfe5cb7426aac029e7d9ba4..0e073bd71f05f9fe197d96fdd1a68e4d573c5520 100644 ---- a/TemperedFundamentalGroups/SemistableReduction/NodeNormal.lean -+++ b/TemperedFundamentalGroups/SemistableReduction/NodeNormal.lean -@@ -74,7 +74,7 @@ lemma toLaurent_map_mem_integralLaurent (h : Polynomial O) : - lemma coeff_toLaurent_natCast (p : Polynomial K) (k : ℕ) : - (Polynomial.toLaurent p).coeff (k : ℤ) = p.coeff k := by - rw [coeff_toLaurent] -- exact Finsupp.mapDomain_apply Nat.cast_injective _ k -+ exact Finsupp.mapDomain_apply_of_injective Nat.cast_injective _ k - - lemma exists_map_eq_of_toLaurent_mem {p : Polynomial K} - (hp : Polynomial.toLaurent p ∈ integralLaurent O) : -diff --git a/lake-manifest.json b/lake-manifest.json -index e17bd4ffa0e881f9ab806a1a47c9b7cea8f8b24d..1927b94ca6e8b09e86ef5aeadc8b187ab9af7102 100644 ---- a/lake-manifest.json -+++ b/lake-manifest.json -@@ -1,17 +1,17 @@ - {"version": "1.2.0", - "packagesDir": ".lake/packages", - "packages": -- [{"url": "https://github.com/lana-agents/pi1", -+ [{"url": "https://github.com/lana-agents/pi1.git", - "type": "git", - "subDir": null, - "scope": "", -- "rev": "60129404bd759f1a3653e87c2c9e6fbb21ec995e", -+ "rev": "ca7def953193f861a462aa0831eec8f0a31ff69f", - "name": "pi1", - "manifestFile": "lake-manifest.json", -- "inputRev": "60129404bd759f1a3653e87c2c9e6fbb21ec995e", -+ "inputRev": "ca7def953193f861a462aa0831eec8f0a31ff69f", - "inherited": false, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/lana-agents/elliptic-curves", -+ {"url": "https://github.com/lana-agents/elliptic-curves.git", - "type": "git", - "subDir": null, - "scope": "", -@@ -21,21 +21,21 @@ - "inputRev": "bebec3fc9f2602e81c83e5236789572a541c85fb", - "inherited": false, - "configFile": "lakefile.toml"}, -- {"url": "https://github.com/leanprover-community/mathlib4", -+ {"url": "https://github.com/leanprover-community/mathlib4.git", - "type": "git", - "subDir": null, -- "scope": "leanprover-community", -- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", -+ "scope": "", -+ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "name": "mathlib", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", - "inherited": false, - "configFile": "lakefile.lean"}, - {"url": "https://github.com/leanprover-community/plausible", - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", -+ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", - "name": "plausible", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -45,7 +45,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", -+ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", - "name": "LeanSearchClient", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -55,7 +55,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", -+ "rev": "e928b72544873815af278d38681b31c0293588e3", - "name": "importGraph", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -65,7 +65,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", -+ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", - "name": "proofwidgets", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -75,7 +75,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", -+ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", - "name": "aesop", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -85,7 +85,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", -+ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", - "name": "Qq", - "manifestFile": "lake-manifest.json", - "inputRev": "master", -@@ -95,7 +95,7 @@ - "type": "git", - "subDir": null, - "scope": "leanprover-community", -- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", -+ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", - "name": "batteries", - "manifestFile": "lake-manifest.json", - "inputRev": "main", -@@ -105,10 +105,10 @@ - "type": "git", - "subDir": null, - "scope": "leanprover", -- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", -+ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", - "name": "Cli", - "manifestFile": "lake-manifest.json", -- "inputRev": "v4.32.0", -+ "inputRev": "v4.34.0", - "inherited": true, - "configFile": "lakefile.toml"}], - "name": "«tempered-fundamental-groups»", -diff --git a/lakefile.toml b/lakefile.toml -index 81e26b03d5eba16bfb14fdd53fd58f0907adbd16..3cfc8b854d4fa7a0b15b805fd877ec332914bc69 100644 ---- a/lakefile.toml -+++ b/lakefile.toml -@@ -4,6 +4,8 @@ keywords = ["math"] - defaultTargets = ["TemperedFundamentalGroups"] - - [leanOptions] -+# Preserve the type-unification behavior expected by the pinned upstream sources. -+backward.isDefEq.respectTransparency.types = false - pp.unicode.fun = true # pretty-prints `fun a ↦ b` - relaxedAutoImplicit = false - weak.linter.mathlibStandardSet = true -@@ -11,8 +13,8 @@ maxSynthPendingDepth = 3 - - [[require]] - name = "mathlib" --scope = "leanprover-community" --rev = "v4.32.0" -+git = "https://github.com/leanprover-community/mathlib4.git" -+rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" - - [[lean_lib]] - name = "TemperedFundamentalGroups" -@@ -21,7 +23,7 @@ name = "TemperedFundamentalGroups" - # the removed set `E[ℓ] + M` of the model orbicurves is a finite (closed) set. - [[require]] - name = "elliptic-curves" --git = "https://github.com/lana-agents/elliptic-curves" -+git = "https://github.com/lana-agents/elliptic-curves.git" - rev = "bebec3fc9f2602e81c83e5236789572a541c85fb" - - # The étale fundamental group of an affine orbifold `[Spec R / A]` (`Pi1.Orbifold.etalePi1`), its -@@ -29,5 +31,5 @@ rev = "bebec3fc9f2602e81c83e5236789572a541c85fb" - # (`Pi1.Orbifold.EtaleCode`, `SemilinearAut`, `LevelRing`), shared with the `pi1` project. - [[require]] - name = "pi1" --git = "https://github.com/lana-agents/pi1" --rev = "60129404bd759f1a3653e87c2c9e6fbb21ec995e" -+git = "https://github.com/lana-agents/pi1.git" -+rev = "ca7def953193f861a462aa0831eec8f0a31ff69f" -diff --git a/lean-toolchain b/lean-toolchain -index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 ---- a/lean-toolchain -+++ b/lean-toolchain -@@ -1 +1 @@ --leanprover/lean4:v4.32.0 -+leanprover/lean4:v4.34.1 +diff --git a/TemperedFundamentalGroups/Models/Projective.lean b/TemperedFundamentalGroups/Models/Projective.lean +index 0f8582d7e728987f7bf3a8c23c46c27b93aae30c..5ff142d2155f8401695f70661069691b55f445e1 100644 +--- a/TemperedFundamentalGroups/Models/Projective.lean ++++ b/TemperedFundamentalGroups/Models/Projective.lean +@@ -84,7 +84,7 @@ open MvPolynomial HomogeneousLocalization + variable {R} + + lemma isHomogeneous_fin_one {p : MvPolynomial (Fin (0 + 1)) R} {n : ℕ} (hp : p.IsHomogeneous n) : +- p = C (coeff (Finsupp.single 0 n) p) * X 0 ^ n := by ++ p = C (p.coeff (Finsupp.single 0 n)) * X 0 ^ n := by + ext d + rw [coeff_C_mul, coeff_X_pow] + by_cases hd : Finsupp.single 0 n = d +@@ -129,7 +129,7 @@ lemma bijective_fromZeroRingHom_projSpace_zero : + · obtain ⟨n, a, ha, rfl⟩ := Away.mk_surjective (homogeneousSubmodule (Fin (0 + 1)) R) + X_zero_mem_homogeneousSubmodule z + have ha' : a.IsHomogeneous n := by simpa using ha +- refine ⟨⟨C (coeff (Finsupp.single 0 n) a), isHomogeneous_C _ _⟩, ?_⟩ ++ refine ⟨⟨C (a.coeff (Finsupp.single 0 n)), isHomogeneous_C _ _⟩, ?_⟩ + apply val_injective + rw [Away.val_mk] + change Localization.mk _ 1 = _ +diff --git a/TemperedFundamentalGroups/Models/Specialization.lean b/TemperedFundamentalGroups/Models/Specialization.lean +index 00f4b73f89c33df5476307335fb0195af1b36ed5..e3dd586fa3e3eb43feb6b88c6b69f9778de9e3c3 100644 +--- a/TemperedFundamentalGroups/Models/Specialization.lean ++++ b/TemperedFundamentalGroups/Models/Specialization.lean +@@ -192,7 +192,12 @@ lemma spLift_unique [UniversallyClosed f] [IsSeparated f] (x : Spec (CommRingCat + lemma spLift_closedPoint_mem [UniversallyClosed f] (x : Spec (CommRingCat.of Ω) ⟶ X) + (hx : x ≫ f = Spec.map (CommRingCat.ofHom (valToField O))) : + (spLift (hV := hV) x hx).l (closedPoint V) ∈ specialFibre f := by +- rw [mem_specialFibre, ← Scheme.Hom.comp_apply, spLift_fac_right] ++ let ℓ : Spec (CommRingCat.of V) ⟶ X := (spLift (hV := hV) x hx).l ++ let v : Spec (CommRingCat.of V) := closedPoint V ++ have hℓ : ℓ ≫ f = Spec.map (CommRingCat.ofHom (valToVal O V hV)) := ++ spLift_fac_right x hx ++ change ℓ v ∈ specialFibre f ++ rw [mem_specialFibre, ← Scheme.Hom.comp_apply, hℓ] + exact valToVal_closedPoint O V hV + + end Specialization +@@ -228,10 +233,15 @@ lemma sp_comp {X' : Scheme.{u}} {f' : X' ⟶ Spec (CommRingCat.of O)} + (hx : x ≫ f = Spec.map (CommRingCat.ofHom (valToField O))) : + sp f' V hV (x ≫ ψ) (by rw [Category.assoc, hψ, hx]) = + specialFibreMap ψ hψ (sp f V hV x hx) := by ++ let ℓ : Spec (CommRingCat.of V) ⟶ X := (spLift (hV := hV) x hx).l ++ have hℓ_left : Spec.map (CommRingCat.ofHom (algebraMap V Ω)) ≫ ℓ = x := ++ spLift_fac_left x hx ++ have hℓ_right : ℓ ≫ f = Spec.map (CommRingCat.ofHom (valToVal O V hV)) := ++ spLift_fac_right x hx + ext +- rw [sp_eq_of_lift (x ≫ ψ) _ ((spLift (hV := hV) x hx).l ≫ ψ) +- (by rw [← Category.assoc, spLift_fac_left]) +- (by rw [Category.assoc, hψ]; exact spLift_fac_right x hx)] ++ rw [sp_eq_of_lift (x ≫ ψ) _ (ℓ ≫ ψ) ++ (by rw [← Category.assoc, hℓ_left]) ++ (by rw [Category.assoc, hψ, hℓ_right])] + rfl + + lemma coe_sp_comp {X' : Scheme.{u}} {f' : X' ⟶ Spec (CommRingCat.of O)} +@@ -268,22 +278,26 @@ lemma sp_galois [UniversallyClosed f] [IsSeparated f] (σ : Ω ≃ₐ[K] Ω) + congr 2 + ext a + simp [valToField]) = sp f V hV x hx := by ++ let ℓ : Spec (CommRingCat.of V) ⟶ X := (spLift (hV := hV) x hx).l ++ have hℓ_left : Spec.map (CommRingCat.ofHom (algebraMap V Ω)) ≫ ℓ = x := ++ spLift_fac_left x hx ++ have hℓ_right : ℓ ≫ f = Spec.map (CommRingCat.ofHom (valToVal O V hV)) := ++ spLift_fac_right x hx + ext +- rw [sp_eq_of_lift _ _ (Spec.map (CommRingCat.ofHom (restrictVal σ hσ)) ≫ +- (spLift (hV := hV) x hx).l)] +- · change (spLift (hV := hV) x hx).l _ = (spLift (hV := hV) x hx).l _ ++ rw [sp_eq_of_lift _ _ (Spec.map (CommRingCat.ofHom (restrictVal σ hσ)) ≫ ℓ)] ++ · change ℓ _ = ℓ _ + congr 1 + exact comap_closedPoint (restrictVal σ hσ) + · have e : (algebraMap V Ω).comp (restrictVal σ hσ) = (σ : Ω →+* Ω).comp (algebraMap V Ω) := by + ext; rfl + rw [← Category.assoc, ← Spec.map_comp, ← CommRingCat.ofHom_comp, e, +- CommRingCat.ofHom_comp, Spec.map_comp, Category.assoc, spLift_fac_left] ++ CommRingCat.ofHom_comp, Spec.map_comp, Category.assoc, hℓ_left] + · have e : (restrictVal σ hσ).comp (valToVal O V hV) = valToVal O V hV := by + ext a + exact σ.commutes (a : K) + rw [Category.assoc] + refine (congrArg (Spec.map (CommRingCat.ofHom (restrictVal σ hσ)) ≫ ·) +- (spLift_fac_right (hV := hV) x hx)).trans ?_ ++ hℓ_right).trans ?_ + rw [← Spec.map_comp, ← CommRingCat.ofHom_comp, e] + + end Specialization +diff --git a/TemperedFundamentalGroups/SemistableReduction/NodeNormal.lean b/TemperedFundamentalGroups/SemistableReduction/NodeNormal.lean +index 393ca04750fcc7b0bdfe5cb7426aac029e7d9ba4..0e073bd71f05f9fe197d96fdd1a68e4d573c5520 100644 +--- a/TemperedFundamentalGroups/SemistableReduction/NodeNormal.lean ++++ b/TemperedFundamentalGroups/SemistableReduction/NodeNormal.lean +@@ -74,7 +74,7 @@ lemma toLaurent_map_mem_integralLaurent (h : Polynomial O) : + lemma coeff_toLaurent_natCast (p : Polynomial K) (k : ℕ) : + (Polynomial.toLaurent p).coeff (k : ℤ) = p.coeff k := by + rw [coeff_toLaurent] +- exact Finsupp.mapDomain_apply Nat.cast_injective _ k ++ exact Finsupp.mapDomain_apply_of_injective Nat.cast_injective _ k + + lemma exists_map_eq_of_toLaurent_mem {p : Polynomial K} + (hp : Polynomial.toLaurent p ∈ integralLaurent O) : +diff --git a/lake-manifest.json b/lake-manifest.json +index e17bd4ffa0e881f9ab806a1a47c9b7cea8f8b24d..1927b94ca6e8b09e86ef5aeadc8b187ab9af7102 100644 +--- a/lake-manifest.json ++++ b/lake-manifest.json +@@ -1,17 +1,17 @@ + {"version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": +- [{"url": "https://github.com/lana-agents/pi1", ++ [{"url": "https://github.com/lana-agents/pi1.git", + "type": "git", + "subDir": null, + "scope": "", +- "rev": "60129404bd759f1a3653e87c2c9e6fbb21ec995e", ++ "rev": "ca7def953193f861a462aa0831eec8f0a31ff69f", + "name": "pi1", + "manifestFile": "lake-manifest.json", +- "inputRev": "60129404bd759f1a3653e87c2c9e6fbb21ec995e", ++ "inputRev": "ca7def953193f861a462aa0831eec8f0a31ff69f", + "inherited": false, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/lana-agents/elliptic-curves", ++ {"url": "https://github.com/lana-agents/elliptic-curves.git", + "type": "git", + "subDir": null, + "scope": "", +@@ -21,21 +21,21 @@ + "inputRev": "bebec3fc9f2602e81c83e5236789572a541c85fb", + "inherited": false, + "configFile": "lakefile.toml"}, +- {"url": "https://github.com/leanprover-community/mathlib4", ++ {"url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, +- "scope": "leanprover-community", +- "rev": "81a5d257c8e410db227a6665ed08f64fea08e997", ++ "scope": "", ++ "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "name": "mathlib", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "e12c1910fe855cbfc38803cd4e55543906d5fa62", ++ "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "name": "plausible", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -45,7 +45,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "c5d5b8fe6e5158def25cd28eb94e4141ad97c843", ++ "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "name": "LeanSearchClient", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -55,7 +55,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "7e9612bf0b9ee66db3cb5b9988a35afc706f5a12", ++ "rev": "e928b72544873815af278d38681b31c0293588e3", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -65,7 +65,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "6e311e2a844da9b2cc3971187df2fe0066947b93", ++ "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -75,7 +75,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "a7dbf0c63b694e47f425f3dcddbc0e178bb432d3", ++ "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -85,7 +85,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "38d591e778f100aec9762bb582f9c7f55f50e9dc", ++ "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", +@@ -95,7 +95,7 @@ + "type": "git", + "subDir": null, + "scope": "leanprover-community", +- "rev": "023ce7d62a0531e22a5331e20b587817a80d49ff", ++ "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "name": "batteries", + "manifestFile": "lake-manifest.json", + "inputRev": "main", +@@ -105,10 +105,10 @@ + "type": "git", + "subDir": null, + "scope": "leanprover", +- "rev": "88679d088c9720c27ebdf2ba4dafe17341747f94", ++ "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "name": "Cli", + "manifestFile": "lake-manifest.json", +- "inputRev": "v4.32.0", ++ "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml"}], + "name": "«tempered-fundamental-groups»", +diff --git a/lakefile.toml b/lakefile.toml +index 81e26b03d5eba16bfb14fdd53fd58f0907adbd16..3cfc8b854d4fa7a0b15b805fd877ec332914bc69 100644 +--- a/lakefile.toml ++++ b/lakefile.toml +@@ -4,6 +4,8 @@ keywords = ["math"] + defaultTargets = ["TemperedFundamentalGroups"] + + [leanOptions] ++# Preserve the type-unification behavior expected by the pinned upstream sources. ++backward.isDefEq.respectTransparency.types = false + pp.unicode.fun = true # pretty-prints `fun a ↦ b` + relaxedAutoImplicit = false + weak.linter.mathlibStandardSet = true +@@ -11,8 +13,8 @@ maxSynthPendingDepth = 3 + + [[require]] + name = "mathlib" +-scope = "leanprover-community" +-rev = "v4.32.0" ++git = "https://github.com/leanprover-community/mathlib4.git" ++rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + + [[lean_lib]] + name = "TemperedFundamentalGroups" +@@ -21,7 +23,7 @@ name = "TemperedFundamentalGroups" + # the removed set `E[ℓ] + M` of the model orbicurves is a finite (closed) set. + [[require]] + name = "elliptic-curves" +-git = "https://github.com/lana-agents/elliptic-curves" ++git = "https://github.com/lana-agents/elliptic-curves.git" + rev = "bebec3fc9f2602e81c83e5236789572a541c85fb" + + # The étale fundamental group of an affine orbifold `[Spec R / A]` (`Pi1.Orbifold.etalePi1`), its +@@ -29,5 +31,5 @@ rev = "bebec3fc9f2602e81c83e5236789572a541c85fb" + # (`Pi1.Orbifold.EtaleCode`, `SemilinearAut`, `LevelRing`), shared with the `pi1` project. + [[require]] + name = "pi1" +-git = "https://github.com/lana-agents/pi1" +-rev = "60129404bd759f1a3653e87c2c9e6fbb21ec995e" ++git = "https://github.com/lana-agents/pi1.git" ++rev = "ca7def953193f861a462aa0831eec8f0a31ff69f" +diff --git a/lean-toolchain b/lean-toolchain +index 94b9f495baff80fd9cb44aad8f4762cb3b2066fe..ba8ebf2dbaf6a668cd2a0e086186d6d569b69ff5 100644 +--- a/lean-toolchain ++++ b/lean-toolchain +@@ -1 +1 @@ +-leanprover/lean4:v4.32.0 ++leanprover/lean4:v4.34.1 diff --git a/overview.pdf b/overview.pdf index cfeefead1be6be2b9debd3aa295c52cb01f3ee37..e7b7baf4fbfff4f179dc08ed26da1238d6c7de30 100644 --- a/overview.pdf +++ b/overview.pdf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:267e1b7c860b638301690ffa8b7818b3f940419ce2d7337158182f69f20d64ac -size 324564 +oid sha256:22e174f66a102a13c615697d751e20a25796738edc04c10736b30f932fae3018 +size 324227 diff --git a/overview.tex b/overview.tex index fc40ebdcd0fb9db026a2e44bde66f2e469939fd4..8f3b8cb6d5c4f5f7f0ac216b2c6db52b4b34b2fd 100644 --- a/overview.tex +++ b/overview.tex @@ -9,7 +9,7 @@ \usepackage{fancyhdr,lastpage,xcolor,ragged2e,needspace} \definecolor{muted}{gray}{0.38} \definecolor{linkink}{HTML}{275B59} -\usepackage[unicode,colorlinks=true,linkcolor=linkink,urlcolor=linkink,pdfauthor={OpenAI},pdftitle={OpenAI Research Catalog},pdfsubject={372 result families in 722 manuscripts}]{hyperref} +\usepackage[unicode,colorlinks=true,linkcolor=linkink,urlcolor=linkink,pdfauthor={OpenAI},pdftitle={OpenAI Research Catalog},pdfsubject={372 result families in 719 manuscripts}]{hyperref} \setlength{\parindent}{0pt} \setlength{\parskip}{0pt} \setlength{\emergencystretch}{1.2em} @@ -20,7 +20,7 @@ \fancyhf{} \fancyhead[L]{\footnotesize\scshape OpenAI Research Catalog} \fancyhead[R]{\footnotesize\scshape OpenAI} -\fancyfoot[L]{\footnotesize\color{muted}372 result families\enspace\textperiodcentered\enspace722 manuscripts} +\fancyfoot[L]{\footnotesize\color{muted}372 result families\enspace\textperiodcentered\enspace719 manuscripts} \fancyfoot[R]{\footnotesize\thepage\, /\,\pageref*{LastPage}} \renewcommand{\headrulewidth}{0.3pt} \renewcommand{\footrulewidth}{0pt} @@ -46,7 +46,7 @@ \vspace{5pt} {\LARGE\bfseries OpenAI Research Catalog\par} \vspace{4pt} -{\small 372 result families in 722 manuscripts\hfill October 6, 2026\par} +{\small 372 result families in 719 manuscripts\hfill October 6, 2026\par} \vspace{7pt} {\small An overview of the \href{https://github.com/openai/math}{manuscript collection}. Results are grouped by subject; entry numbers follow the catalog order and do not indicate a ranking. PDF links follow each summary.\par} \vspace{8pt}\hrule height 0.35pt\vspace{5pt} @@ -75,17 +75,17 @@ \cataloguesection{Number theory}{1} -\resultentry{001}{Milne's rationality conjecture}{Proves Milne's rationality conjecture for abelian varieties over $\overline{\mathbb Q}$ with good reduction: specialized Hodge classes pair rationally with complementary divisor products, independently of cohomology theory. Together with result 032, every specialized Hodge class is represented by a single rational algebraic cycle simultaneously in all prime-to-$p$ and crystalline realizations, for every residue characteristic $p$.}{\href{https://github.com/openai/math/blob/main/preprints/Milnes-rationality-conjecture-for-abelian-varieties-September-23-2026/paper.pdf}{Milne's rationality conjecture for abelian varieties}} +\resultentry{001}{Milne's rationality conjecture}{Proves Milne's rationality conjecture for abelian varieties over $\overline{\mathbb Q}$ with good reduction: specialized Hodge classes pair rationally with complementary divisor products, independently of cohomology theory. Together with result 032, every specialized Hodge class is represented by a single rational algebraic cycle simultaneously in all prime-to-$p$ and crystalline realizations, for every residue characteristic $p$.}{\href{https://github.com/openai/math/blob/main/preprints/Milnes-rationality-conjecture-for-abelian-varieties-October-7-2026/paper.pdf}{Milne's rationality conjecture for abelian varieties}} -\resultentry{002}{The full Birch--Swinnerton-Dyer formula in Selmer coranks zero and one}{Proves the full Birch--Swinnerton-Dyer leading-term formula for every elliptic curve over $\mathbb Q$ whose full $q$-power Selmer group has corank zero or one for some prime $q$, including finiteness of the Tate--Shafarevich group. With result 006, this gives full BSD for a density-one set of quadratic twists of every elliptic curve over $\mathbb Q$.}{\href{https://github.com/openai/math/blob/main/preprints/Exact-Birch-Swinnerton-Dyer-Formula-from-Low-Selmer-Corank-October-3-2026/exact-bsd-low-selmer-corank.pdf}{Exact Birch–Swinnerton-Dyer Formula from Low Selmer Corank}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Selmer-converse-for-elliptic-curves-at-every-prime-September-24-2026/main.pdf}{The Selmer converse for elliptic curves at every prime}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-two-primary-Birch-Swinnerton-Dyer-formula-in-Selmer-corank-at-most-one-September-24-2026/paper.pdf}{The two-primary Birch–Swinnerton-Dyer formula in Selmer corank at most one}} +\resultentry{002}{The full Birch--Swinnerton-Dyer formula in Selmer coranks zero and one}{Proves the full Birch--Swinnerton-Dyer leading-term formula for every elliptic curve over $\mathbb Q$ whose full $q$-power Selmer group has corank zero or one for some prime $q$, including finiteness of the Tate--Shafarevich group. With result 006, this gives full BSD for a density-one set of quadratic twists of every elliptic curve over $\mathbb Q$.}{\href{https://github.com/openai/math/blob/main/preprints/Exact-Birch-Swinnerton-Dyer-Formula-from-Low-Selmer-Corank-October-7-2026/exact-bsd-low-selmer-corank.pdf}{Exact Birch–Swinnerton-Dyer Formula from Low Selmer Corank}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Selmer-converse-for-elliptic-curves-at-every-prime-October-7-2026/main.pdf}{The Selmer converse for elliptic curves at every prime}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-two-primary-Birch-Swinnerton-Dyer-formula-in-Selmer-corank-at-most-one-October-6-2026/paper.pdf}{The two-primary Birch–Swinnerton-Dyer formula in Selmer corank at most one}} \resultentry{003}{The quasi-Riemann hypothesis}{Proves that every Dirichlet $L$-function, including $\zeta(s)$, is zero-free in $\Re s>7/8$, resolving the quasi-Riemann hypothesis. The same half-plane is zero-free for every finite-order Hecke $L$-function over $\mathbb Q(\sqrt{-3})$. A companion gives a different proof of the zero-free half-plane $\Re s>11/12$.}{\href{https://github.com/openai/math/blob/main/preprints/The-Quasi-Riemann-Hypothesis-September-30-2026/paper.pdf}{The Quasi-Riemann Hypothesis: A Zero-Free Half-Plane $\Re s>7/8$}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Quasi-Riemann-Hypothesis-October-5-2026/paper2.pdf}{The Quasi-Riemann Hypothesis (alternate $11/12$ proof)}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-exclusion-of-Landau-Siegel-zeros-October-1-2026/paper.pdf}{Uniform exclusion of Landau--Siegel zeros}} -\resultentry{004}{Hilbert's tenth problem over $\mathbb Q$}{Proves that no algorithm decides whether an integer-coefficient polynomial in an arbitrary number of variables has a rational zero, resolving Hilbert's tenth problem over $\mathbb Q$ negatively.}{\href{https://github.com/openai/math/blob/main/preprints/Hilberts-tenth-problem-over-the-rational-numbers-September-24-2026/main.pdf}{Hilbert’s tenth over $\mathbb Q$}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/A-pointwise-2-converse-for-elliptic-curves-with-rational-two-torsion-September-24-2026/paper.pdf}{Pointwise 2-converse with rational two-torsion}} +\resultentry{004}{Hilbert's tenth problem over $\mathbb Q$}{Proves that no algorithm decides whether an integer-coefficient polynomial in an arbitrary number of variables has a rational zero, resolving Hilbert's tenth problem over $\mathbb Q$ negatively.}{\href{https://github.com/openai/math/blob/main/preprints/Hilberts-tenth-problem-over-the-rational-numbers-October-6-2026/main.pdf}{Hilbert’s tenth over $\mathbb Q$}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/A-pointwise-2-converse-for-elliptic-curves-with-rational-two-torsion-October-7-2026/paper.pdf}{Pointwise 2-converse with rational two-torsion}} \resultentry{005}{Irrationality of Catalan's constant}{Proves that Catalan's constant $G=\sum_{j\ge0}(-1)^j/(2j+1)^2$ is irrational.}{\href{https://github.com/openai/math/blob/main/preprints/Catalans-constant-is-irrational-September-24-2026/paper.pdf}{Catalan's constant is irrational}} -\resultentry{006}{Goldfeld's conjecture}{Proves Goldfeld's conjecture for quadratic twists of every elliptic curve over $\mathbb Q$: analytic ranks zero and one each have density $1/2$, and the mean analytic rank tends to $1/2$. Both statements order signed squarefree twist parameters by absolute value.}{\href{https://github.com/openai/math/blob/main/preprints/Goldfelds-analytic-density-conjecture-and-the-2-converse-for-elliptic-curves-September-23-2026/paper.pdf}{Analytic density and 2-converse}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-mean-analytic-rank-of-quadratic-twists-of-elliptic-curves-September-23-2026/paper.pdf}{Mean analytic rank}} +\resultentry{006}{Goldfeld's conjecture}{Proves Goldfeld's conjecture for quadratic twists of every elliptic curve over $\mathbb Q$: analytic ranks zero and one each have density $1/2$, and the mean analytic rank tends to $1/2$. Both statements order signed squarefree twist parameters by absolute value.}{\href{https://github.com/openai/math/blob/main/preprints/Goldfelds-analytic-density-conjecture-and-the-2-converse-for-elliptic-curves-October-7-2026/paper.pdf}{Analytic density and 2-converse}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-mean-analytic-rank-of-quadratic-twists-of-elliptic-curves-October-6-2026/paper.pdf}{Mean analytic rank}} \resultentry{007}{Two-point Chowla and the corrected binary Elliott conjecture}{Proves the ordinary two-point Chowla conjecture, with a bound $O(X/(\log X)^c)$ for Liouville correlation sums along fixed nonproportional affine forms, where $c>0$ is absolute. More generally, proves the binary corrected Elliott conjecture for complex multiplicative functions bounded by one when one factor is uniformly nonpretentious against each fixed Dirichlet character times $n^{it}$ for $|t|\le X$.}{\href{https://github.com/openai/math/blob/main/preprints/Ordinary-two-point-correlations-of-multiplicative-functions-September-24-2026/final.pdf}{Ordinary two-point correlations of multiplicative functions}} @@ -93,7 +93,7 @@ \resultentry{009}{Bogomolov--Pop and Milnor $K$-theoretic reconstruction}{Reconstructs function fields of transcendence degree at least two over algebraically closed constants from $K^{\mathrm M}_1/\ell$, $K^{\mathrm M}_2/\ell$, and their product. These data recover the perfect closure and constants when $\ell$ differs from the characteristic, and the original field and its named base in equal characteristic. Also proves Bogomolov--Pop reconstruction from abelian-by-central pro-$\ell$ Galois data away from the characteristic.}{\href{https://github.com/openai/math/blob/main/preprints/Reconstruction-of-Function-Fields-from-Mod-ell-Milnor-K-Theory-October-5-2026/mod-ell-bogomolov-pop.pdf}{Reconstruction of Function Fields from Mod-$\ell$ Milnor $K$-Theory}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Reconstruction-from-Milnor-K-theory-modulo-the-characteristic-October-5-2026/paper.pdf}{Reconstruction from Milnor $K$-theory modulo the characteristic}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Bogomolov-Pop-reconstruction-theorem-September-23-2026/paper.pdf}{The Bogomolov-Pop reconstruction theorem}} -\resultentry{010}{Fontaine--Mazur modularity at the prime $2$ and $2$-adic pro-modularity}{Every continuous odd absolutely irreducible two-dimensional $2$-adic representation of $G_{\mathbb Q}$ unramified outside finitely many primes occurs in a completed Hecke algebra at some odd tame level. Also proves classical modularity up to Tate twist for irreducible odd representations with these finiteness conditions that are de Rham at $2$ with distinct Hodge--Tate weights, resolving the dyadic Fontaine--Mazur case without residual restrictions.}{\href{https://github.com/openai/math/blob/main/preprints/Unrestricted-pro-modularity-at-the-prime-two-October-4-2026/two-adic-promodularity.pdf}{Unrestricted pro-modularity}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Dimension-of-the-Two-Adic-Hecke-Algebra-at-Odd-Level-October-5-2026/two-adic-hecke.pdf}{Two-adic Hecke dimension}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Fontaine-Mazur-modularity-at-the-prime-2-September-23-2026/paper.pdf}{Fontaine–Mazur modularity at the prime 2}} +\resultentry{010}{Fontaine--Mazur modularity at the prime $2$ and $2$-adic pro-modularity}{Every continuous odd absolutely irreducible two-dimensional $2$-adic representation of $G_{\mathbb Q}$ unramified outside finitely many primes occurs in a completed Hecke algebra at some odd tame level. Also proves classical modularity up to Tate twist for irreducible odd representations with these finiteness conditions that are de Rham at $2$ with distinct Hodge--Tate weights, resolving the dyadic Fontaine--Mazur case without residual restrictions.}{\href{https://github.com/openai/math/blob/main/preprints/Unrestricted-pro-modularity-at-the-prime-two-October-6-2026/two-adic-promodularity.pdf}{Unrestricted pro-modularity}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Dimension-of-the-Two-Adic-Hecke-Algebra-at-Odd-Level-October-5-2026/two-adic-hecke.pdf}{Two-adic Hecke dimension}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Fontaine-Mazur-modularity-at-the-prime-2-October-6-2026/paper.pdf}{Fontaine–Mazur modularity at the prime 2}} \resultentry{011}{The Ford--Konyagin--Luca conjecture on prime predecessors}{Proves that the normalized ordered logarithms of the prime factors of $p-1$, counted with multiplicity, converge jointly to the Poisson--Dirichlet law $\mathrm{PD}(1)$ as $p$ ranges uniformly over primes up to $x$ and $x\to\infty$. This resolves the Ford--Konyagin--Luca conjecture. It also proves that infinitely many integers $n$ have more than $n^{1-\varepsilon}$ totient preimages, for every $\varepsilon>0$.}{\href{https://github.com/openai/math/blob/main/preprints/Weighted-Dilation-Graphs-Smooth-Shifted-Primes-and-Totient-Fibers-September-24-2026/paper.pdf}{Weighted dilation graphs, smooth shifted primes and totient fibers}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Poisson-Dirichlet-Law-for-Prime-Predecessors-September-24-2026/paper.pdf}{The Poisson-Dirichlet law for prime predecessors}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Prime-Predecessors-with-an-Even-Number-of-Prime-Factors-September-17-2026/paper.pdf}{Prime Predecessors with an Even Number of Prime Factors}} @@ -111,7 +111,7 @@ \resultentry{018}{The Margulis--Platonov conjecture over global fields}{Proves the Margulis--Platonov conjecture over every global field, including function fields of characteristic two. For an absolutely almost simple simply connected algebraic group $G$ over $k$, every noncentral abstract normal subgroup of $G(k)$ is the inverse image of an open normal subgroup in the finite product of its anisotropic nonarchimedean local groups.}{\href{https://github.com/openai/math/blob/main/preprints/The-Margulis-Platonov-conjecture-over-global-function-fields-October-5-2026/margulis-platonov-global-function-fields.pdf}{The Margulis--Platonov conjecture over global function fields}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Margulis-Platonov-conjecture-over-number-fields-September-23-2026/paper.pdf}{The Margulis–Platonov conjecture over number fields}} -\resultentry{019}{The $p$-adic section conjecture}{Proves that rational points on every smooth proper geometrically connected curve of genus at least two over a finite extension of $\mathbb Q_p$ correspond bijectively to conjugacy classes of sections of its full arithmetic \'etale fundamental group. It also proves Grothendieck's section conjecture over $\mathbb Q$ for the modular curves $X_0(N)$ and $X_1(N)$ of genus at least two.}{\href{https://github.com/openai/math/blob/main/preprints/Etale-covers-with-a-prescribed-exterior-sheet-September-24-2026/main.pdf}{Prescribed exterior sheet}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-p-adic-section-conjecture-September-24-2026/main.pdf}{p-adic section conjecture}} +\resultentry{019}{The $p$-adic section conjecture}{Proves that rational points on every smooth proper geometrically connected curve of genus at least two over a finite extension of $\mathbb Q_p$ correspond bijectively to conjugacy classes of sections of its full arithmetic \'etale fundamental group. It also proves Grothendieck's section conjecture over $\mathbb Q$ for the modular curves $X_0(N)$ and $X_1(N)$ of genus at least two.}{\href{https://github.com/openai/math/blob/main/preprints/Etale-covers-with-a-prescribed-exterior-sheet-September-24-2026/main.pdf}{Prescribed exterior sheet}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-p-adic-section-conjecture-October-6-2026/main.pdf}{p-adic section conjecture}} \resultentry{020}{Squarefree quartics and power-free polynomial values}{Proves the squarefree-values conjecture for irreducible integer quartics with no fixed prime-square divisor: squarefree values on positive integers have the predicted positive Euler-product density. More generally, establishes the $(d-2)$-power-free density for irreducible integer polynomials of degrees four through eight under the necessary local condition; together with Browning's higher-degree theorem, this covers every $d\ge4$.}{\href{https://github.com/openai/math/blob/main/preprints/Squarefree-values-of-quartics-and-power-free-values-of-polynomials-September-24-2026/manuscript.pdf}{Squarefree values of quartics and power-free values of polynomials}} @@ -139,15 +139,15 @@ \cataloguesection{Algebraic and complex geometry}{3} -\resultentry{032}{The rational Hodge conjecture for CM abelian varieties and products of K3 surfaces}{Proves the rational Hodge conjecture for every complex CM abelian variety, in every dimension and codimension. Through Milne's theorems, this also gives the Tate conjecture for all abelian varieties over finite fields and the Hodge standard conjecture for abelian varieties in every characteristic. Companion results prove rational Hodge for arbitrary products of projective complex K3 surfaces and algebraicity of the Kuga--Satake correspondence for every such surface.}{\href{https://github.com/openai/math/blob/main/preprints/The-rational-Hodge-conjecture-for-CM-abelian-varieties-September-30-2026/paper.pdf}{The rational Hodge conjecture for CM abelian varieties}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-rational-Hodge-conjecture-for-products-of-K3-surfaces-October-4-2026/hodge-conjecture-products-k3.pdf}{The rational Hodge conjecture for products of K3 surfaces}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Algebraicity-of-Kuga-Satake-Correspondences-for-K3-Surfaces-October-3-2026/manuscript.pdf}{Algebraicity of Kuga–Satake Correspondences for K3 Surfaces}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Algebraic-Kuga-Satake-correspondences-and-Hodge-conjectures-on-a-K3-quadratic-locus-September-30-2026/paper.pdf}{Algebraic Kuga–Satake correspondences and Hodge conjectures on a K3 quadratic locus}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Weil-classes-and-Hodge-classes-on-abelian-powers-September-30-2026/paper.pdf}{Weil classes and Hodge classes on abelian powers}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Abelian-covers-Gale-correspondences-and-the-Hodge-conjecture-for-powers-September-30-2026/paper.pdf}{Abelian covers, Gale correspondences, and the Hodge conjecture for powers}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Algebraicity-of-Weil-classes-on-split-abelian-eightfolds-September-18-2026/paper.pdf}{Algebraicity of Weil classes on split abelian eightfolds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/A-Conditional-Reduction-for-Algebraic-Kuga-Satake-Correspondences-September-10-2026/paper.pdf}{A Conditional Reduction for Algebraic Kuga–Satake Correspondences}} +\resultentry{032}{The rational Hodge conjecture for CM abelian varieties}{Proves the rational Hodge conjecture for every complex CM abelian variety, in every dimension and codimension. Through Milne's theorems, this also gives the Tate conjecture for all abelian varieties over finite fields and the Hodge standard conjecture for abelian varieties in every characteristic.}{\href{https://github.com/openai/math/blob/main/preprints/The-rational-Hodge-conjecture-for-CM-abelian-varieties-October-6-2026/paper.pdf}{The rational Hodge conjecture for CM abelian varieties}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Algebraic-Kuga-Satake-correspondences-and-Hodge-conjectures-on-a-K3-quadratic-locus-September-30-2026/paper.pdf}{Algebraic Kuga–Satake correspondences and Hodge conjectures on a K3 quadratic locus}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Weil-classes-and-Hodge-classes-on-abelian-powers-October-6-2026/paper.pdf}{Weil classes and Hodge classes on abelian powers}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Abelian-covers-Gale-correspondences-and-the-Hodge-conjecture-for-powers-October-6-2026/paper.pdf}{Abelian covers, Gale correspondences, and the Hodge conjecture for powers}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/A-Conditional-Reduction-for-Algebraic-Kuga-Satake-Correspondences-September-10-2026/paper.pdf}{A Conditional Reduction for Algebraic Kuga–Satake Correspondences}} \resultentry{033}{Campana's orbifold Iitaka conjecture and logarithmic subadditivity}{Proves Campana's orbifold Iitaka subadditivity conjecture for smooth Fujiki-class-$\mathcal C$ manifolds with rational simple-normal-crossing boundaries. For projective fibrations $f:U\to V$ of smooth complex quasi-projective varieties with connected fibers, general fiber $F$, and $\bar\kappa(V)\ge0$, proves Popa's inequality $\bar\kappa(U)\ge\kappa(F)+\max\{\bar\kappa(V),\operatorname{Var}(f)\}$, where variation measures the whole geometric generic fiber.}{\href{https://github.com/openai/math/blob/main/preprints/Orbifold-and-logarithmic-Iitaka-subadditivity-September-26-2026/paper.pdf}{Orbifold and logarithmic subadditivity}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Logarithmic-Kodaira-dimension-and-whole-fiber-variation-September-26-2026/paper.pdf}{Whole-fiber variation}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-reverse-logarithmic-Kodaira-inequality-and-additivity-September-26-2026/paper.pdf}{Reverse inequality and additivity}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Projective-Hodge-lines-and-ordinary-Iitaka-subadditivity-September-27-2026/paper.pdf}{Projective Hodge lines}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/B-semiampleness-for-compact-log-smooth-Kahler-fibrations-September-10-2026/paper.pdf}{Kähler b-semiampleness}} -\resultentry{034}{Log abundance and effective Iitaka fibrations}{Using logarithmic Iitaka subadditivity, proves log abundance in every dimension for normal compact K\"ahler log canonical pairs with effective rational boundary: an analytically nef $\mathbb Q$-Cartier adjoint is semiample. It also proves projective log abundance over every algebraically closed field of characteristic zero and the effective Iitaka fibration conjecture for smooth projective varieties of nonnegative Kodaira dimension in that setting. A further result resolves the finite-rational-coefficient index conjecture for connected projective semi-log-canonical log Calabi--Yau pairs over such fields in each fixed dimension and for each fixed finite set of rational boundary coefficients, with a uniform index independent of the number of components.}{\href{https://github.com/openai/math/blob/main/preprints/Log-abundance-for-compact-Kahler-spaces-under-logarithmic-Iitaka-subadditivity-October-4-2026/main.pdf}{Log abundance for compact Kähler spaces}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-indices-for-semi-log-canonical-log-Calabi-Yau-pairs-October-5-2026/uniform-slc-index.pdf}{Uniform indices for semi-log-canonical log Calabi--Yau pairs}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Conditional-good-minimal-models-for-compact-Kahler-fourfolds-October-5-2026/paper.pdf}{Conditional Kähler good minimal models}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Log-abundance-in-characteristic-zero-September-24-2026/paper.pdf}{Log abundance in characteristic zero}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Minimal-metrics-and-interior-injectivity-for-nef-adjoints-September-27-2026/paper.pdf}{Minimal metrics and interior injectivity}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Fourfold-nonvanishing-by-minimal-metrics-and-moving-jets-September-27-2026/paper.pdf}{Fourfold nonvanishing}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Lifting-sections-from-the-reduced-support-of-an-adjoint-September-27-2026/paper.pdf}{Lifting sections from reduced support}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Schnell-fiber-spaces-and-good-canonical-models-September-24-2026/paper.pdf}{Schnell fiber spaces}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-log-Iitaka-fibrations-and-bounded-moduli-denominators-October-4-2026/uniform-log-iitaka.pdf}{Uniform log Iitaka fibrations}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-Pluricanonical-Iitaka-Fibrations-October-3-2026/paper.pdf}{Uniform pluricanonical Iitaka fibrations}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Relative-denominators-and-effective-systems-for-log-Calabi-Yau-fibrations-September-27-2026/paper.pdf}{Log Calabi–Yau fibrations}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Arithmetic-Stein-degree-bounds-for-log-Calabi-Yau-pairs-September-25-2026/paper.pdf}{Arithmetic Stein-degree bounds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-effective-log-Iitaka-fibrations-for-fourfolds-September-26-2026/paper.pdf}{Log Iitaka fibrations for fourfolds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Abundance-after-nonvanishing-for-compact-Kahler-fourfolds-September-27-2026/paper.pdf}{Compact Kähler fourfolds after nonvanishing}} +\resultentry{034}{Log abundance and effective Iitaka fibrations}{Using logarithmic Iitaka subadditivity, proves log abundance in every dimension for normal compact K\"ahler log canonical pairs with effective rational boundary: an analytically nef $\mathbb Q$-Cartier adjoint is semiample. It also proves projective log abundance over every algebraically closed field of characteristic zero and the effective Iitaka fibration conjecture for smooth projective varieties of nonnegative Kodaira dimension in that setting. A further result resolves the finite-rational-coefficient index conjecture for connected projective semi-log-canonical log Calabi--Yau pairs over such fields in each fixed dimension and for each fixed finite set of rational boundary coefficients, with a uniform index independent of the number of components.}{\href{https://github.com/openai/math/blob/main/preprints/Log-abundance-for-compact-Kahler-spaces-under-logarithmic-Iitaka-subadditivity-October-6-2026/main.pdf}{Log abundance for compact Kähler spaces}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-indices-for-semi-log-canonical-log-Calabi-Yau-pairs-October-5-2026/uniform-slc-index.pdf}{Uniform indices for semi-log-canonical log Calabi--Yau pairs}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Conditional-good-minimal-models-for-compact-Kahler-fourfolds-October-6-2026/paper.pdf}{Conditional Kähler good minimal models}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Log-abundance-in-characteristic-zero-September-24-2026/paper.pdf}{Log abundance in characteristic zero}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Minimal-metrics-and-interior-injectivity-for-nef-adjoints-September-27-2026/paper.pdf}{Minimal metrics and interior injectivity}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Fourfold-nonvanishing-by-minimal-metrics-and-moving-jets-September-27-2026/paper.pdf}{Fourfold nonvanishing}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Lifting-sections-from-the-reduced-support-of-an-adjoint-September-27-2026/paper.pdf}{Lifting sections from reduced support}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Schnell-fiber-spaces-and-good-canonical-models-September-24-2026/paper.pdf}{Schnell fiber spaces}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-log-Iitaka-fibrations-and-bounded-moduli-denominators-October-4-2026/uniform-log-iitaka.pdf}{Uniform log Iitaka fibrations}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-Pluricanonical-Iitaka-Fibrations-October-3-2026/paper.pdf}{Uniform pluricanonical Iitaka fibrations}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Relative-denominators-and-effective-systems-for-log-Calabi-Yau-fibrations-September-27-2026/paper.pdf}{Log Calabi–Yau fibrations}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Arithmetic-Stein-degree-bounds-for-log-Calabi-Yau-pairs-September-25-2026/paper.pdf}{Arithmetic Stein-degree bounds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-effective-log-Iitaka-fibrations-for-fourfolds-September-26-2026/paper.pdf}{Log Iitaka fibrations for fourfolds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Abundance-after-nonvanishing-for-compact-Kahler-fourfolds-September-27-2026/paper.pdf}{Compact Kähler fourfolds after nonvanishing}} \resultentry{035}{Threefold log abundance in numerical dimension one in characteristic $p>3$}{Proves log abundance for projective log canonical threefold pairs over algebraically closed fields of characteristic $p>3$ when the effective boundary is rational and the $\mathbb Q$-Cartier adjoint is nef of numerical dimension one. The adjoint is semiample, without requiring the original variety to be terminal or $\mathbb Q$-factorial.}{\href{https://github.com/openai/math/blob/main/preprints/Log-abundance-in-numerical-dimension-one-for-threefolds-in-positive-characteristic-October-5-2026/paper.pdf}{Log abundance in numerical dimension one for threefolds in positive characteristic}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Abundance-in-numerical-dimension-one-for-terminal-threefolds-in-positive-characteristic-September-24-2026/paper.pdf}{Abundance in numerical dimension one for terminal threefolds in positive characteristic}} -\resultentry{036}{Numerical semiampleness and generalized minimal models}{Proves numerical semiampleness for nef adjoints $K_X+B+M$ with $K_X+B$ pseudo-effective and $M$ nef rational, for projective klt rational pairs over algebraically closed characteristic-zero fields and smooth compact K\"ahler rational klt simple-normal-crossing pairs, using Bott--Chern cohomology in the latter case. Separately, projective generalized log canonical rational pairs over such fields admit minimal models for pseudo-effective adjoints and Mori fiber spaces otherwise, with nef b-data fixed.}{\href{https://github.com/openai/math/blob/main/preprints/Numerical-semiampleness-of-nef-adjoint-classes-on-compact-Kahler-manifolds-October-4-2026/numerical-generalized-abundance.pdf}{Compact Kähler numerical semiampleness}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Numerical-Semiampleness-of-Nef-Adjoint-Divisors-October-3-2026/paper.pdf}{Projective numerical semiampleness}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Minimal-models-and-Mori-fibre-spaces-for-generalized-log-canonical-Q-pairs-September-24-2026/paper.pdf}{Generalized log canonical Q-pairs}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Minimal-models-in-numerical-dimension-one-September-24-2026/paper.pdf}{Numerical dimension one}} +\resultentry{036}{Numerical semiampleness and generalized minimal models}{Proves numerical semiampleness for nef adjoints $K_X+B+M$ with $K_X+B$ pseudo-effective and $M$ nef rational, for projective klt rational pairs over algebraically closed characteristic-zero fields and smooth compact K\"ahler rational klt simple-normal-crossing pairs, using Bott--Chern cohomology in the latter case. Separately, projective generalized log canonical rational pairs over such fields admit minimal models for pseudo-effective adjoints and Mori fiber spaces otherwise, with nef b-data fixed.}{\href{https://github.com/openai/math/blob/main/preprints/Numerical-semiampleness-of-nef-adjoint-classes-on-compact-Kahler-manifolds-October-6-2026/numerical-generalized-abundance.pdf}{Compact Kähler numerical semiampleness}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Numerical-Semiampleness-of-Nef-Adjoint-Divisors-October-3-2026/paper.pdf}{Projective numerical semiampleness}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Minimal-models-and-Mori-fibre-spaces-for-generalized-log-canonical-Q-pairs-September-24-2026/paper.pdf}{Generalized log canonical Q-pairs}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Minimal-models-in-numerical-dimension-one-September-24-2026/paper.pdf}{Numerical dimension one}} \resultentry{037}{The sharp ordinary-double-point volume gap}{Proves the ordinary-double-point volume-gap conjecture: every singular complex algebraic klt germ of dimension $n\ge2$, with zero boundary, has normalized volume at most $2(n-1)^n$. Equality holds precisely for an analytic ordinary double point.}{\href{https://github.com/openai/math/blob/main/preprints/The-ordinary-double-point-gap-in-every-dimension-September-24-2026/paper.pdf}{Gap in every dimension}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-normalized-volume-gap-in-dimension-four-September-24-2026/paper.pdf}{Dimension-four normalized-volume gap}} @@ -185,7 +185,7 @@ \resultentry{055}{Toda's Gepner conjecture and large-volume stability}{Proves Toda's Gepner conjecture for every smooth complex quintic threefold, constructing a numerical Bridgeland stability condition with the prescribed phase shift $2/5$. Also constructs numerical Bridgeland stability conditions at every sufficiently large volume on all smooth projective complex threefolds with trivial canonical bundle, with the exact ordinary and square-root-Todd central charges.}{\href{https://github.com/openai/math/blob/main/preprints/A-Gepner-stability-condition-on-every-smooth-quintic-threefold-September-24-2026/paper.pdf}{Gepner stability on quintic threefolds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Prescribed-large-volume-charges-on-threefolds-with-trivial-canonical-bundle-September-24-2026/paper.pdf}{Prescribed large-volume charges}} -\resultentry{056}{Termination of fourfold minimal model programs}{Proves termination of every existing generalized log canonical flip sequence on globally Weil $\mathbb Q$-factorial compact K\"ahler fourfolds, with rational boundary, fixed rational analytically nef b-data, and projective small flip diagrams with the prescribed ample signs. Also proves termination of arbitrary permitted minimal model programs for projective log canonical fourfolds with rational boundary in characteristic zero.}{\href{https://github.com/openai/math/blob/main/preprints/Termination-of-generalized-log-canonical-flips-on-compact-Kahler-fourfolds-October-5-2026/termination-generalized-lc-kahler-fourfolds.pdf}{Termination of generalized log canonical flips on compact Kähler fourfolds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Termination-of-generalized-canonical-flips-on-compact-Kahler-fourfolds-October-5-2026/termination-generalized-terminal-flips-compact-kahler-fourfolds.pdf}{Termination of generalized-canonical flips on compact Kähler fourfolds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Termination-for-projective-log-canonical-fourfolds-with-rational-boundary-September-24-2026/paper.pdf}{Log canonical fourfold termination}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Finite-ordinary-minimal-model-programs-on-compact-Kahler-fourfolds-October-5-2026/paper.pdf}{Ordinary Kähler fourfold termination}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Finite-ordinary-minimal-model-programs-on-compact-Kahler-fourfolds-September-24-2026/paper.pdf}{Finite Kähler fourfold programs}} +\resultentry{056}{Termination of fourfold minimal model programs}{Proves termination of every existing generalized log canonical flip sequence on globally Weil $\mathbb Q$-factorial compact K\"ahler fourfolds, with rational boundary, fixed rational analytically nef b-data, and projective small flip diagrams with the prescribed ample signs. Also proves termination of arbitrary permitted minimal model programs for projective log canonical fourfolds with rational boundary in characteristic zero.}{\href{https://github.com/openai/math/blob/main/preprints/Termination-of-generalized-log-canonical-flips-on-compact-Kahler-fourfolds-October-7-2026/termination-generalized-lc-kahler-fourfolds.pdf}{Termination of generalized log canonical flips on compact Kähler fourfolds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Termination-of-generalized-canonical-flips-on-compact-Kahler-fourfolds-October-6-2026/termination-generalized-terminal-flips-compact-kahler-fourfolds.pdf}{Termination of generalized-canonical flips on compact Kähler fourfolds}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Termination-for-projective-log-canonical-fourfolds-with-rational-boundary-September-24-2026/paper.pdf}{Log canonical fourfold termination}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Finite-ordinary-minimal-model-programs-on-compact-Kahler-fourfolds-October-6-2026/paper.pdf}{Ordinary Kähler fourfold termination}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Finite-ordinary-minimal-model-programs-on-compact-Kahler-fourfolds-September-24-2026/paper.pdf}{Finite Kähler fourfold programs}} \resultentry{057}{Campana's abelianity conjecture and special varieties}{Proves Campana's abelianity conjecture: special compact K\"ahler manifolds have virtually abelian fundamental groups. Using this theorem, establishes the same conclusion for order-two root orbifolds of smooth projective complex fourfolds along one nonempty smooth connected divisor, when special in the stated differential-line sense. For smooth special complex quasi-projective varieties, proves that every finite-dimensional complex linear representation of the fundamental group has virtually nilpotent image of class at most two.}{\href{https://github.com/openai/math/blob/main/preprints/The-abelianity-conjecture-for-special-compact-Kahler-manifolds-September-23-2026/paper.pdf}{Special compact Kähler abelianity}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Two-step-monodromy-of-special-quasi-projective-varieties-September-24-2026/paper.pdf}{Two-step monodromy}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/A-conditional-abelianity-theorem-for-special-fourfold-pairs-with-a-half-weight-divisor-October-5-2026/main.pdf}{A conditional abelianity theorem for special fourfold pairs with a half-weight divisor}} @@ -544,9 +544,9 @@ \resultentry{231}{The free uniform spanning forest is a factor of IID}{On every infinite connected locally finite simple unweighted graph, the free uniform spanning forest is a factor of independent vertex labels, by one isomorphism-equivariant rule using no root. Translation-invariant strongly Rayleigh binary processes on every countable group, including invariant determinantal processes with Hermitian positive-contraction kernels, are also factors of IID.}{\href{https://github.com/openai/math/blob/main/preprints/The-free-uniform-spanning-forest-is-a-factor-of-IID-September-25-2026/The-free-uniform-spanning-forest-is-a-factor-of-IID-September-25-2026.pdf}{The free uniform spanning forest is a factor of IID}} -\resultentry{232}{Gaussian fields and SLE interfaces for Lipschitz heights}{Proves Gaussian free field limits on bounded smooth simply connected domains for triangular-lattice height models: uniform odd heights with increments $0,\pm2$ and two-arc boundary values $\pm1$, and zero-boundary integer Lipschitz heights weighted by fixed $x\in[1/\sqrt2,1]$. Uniform real Lipschitz heights also converge to a Gaussian field; at a tuned opposite-boundary amplitude, their interface converges to chordal $\mathrm{SLE}_4$, establishing Schramm’s real-field/interface predictions.}{\href{https://github.com/openai/math/blob/main/preprints/Gaussian-free-field-limits-of-weighted-integer-Lipschitz-heights-September-25-2026/paper.pdf}{Weighted integer heights}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Gaussian-free-field-limit-of-integer-Lipschitz-heights-with-two-arc-boundary-data-September-25-2026/paper.pdf}{Integer heights with two-arc boundary}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-real-Lipschitz-surfaces-on-the-triangular-lattice-September-25-2026/paper.pdf}{Uniform real Lipschitz surfaces}} +\resultentry{232}{Gaussian fields and SLE interfaces for Lipschitz heights}{Proves Gaussian free field limits on bounded smooth simply connected domains for triangular-lattice height models: uniform odd heights with increments $0,\pm2$ and two-arc boundary values $\pm1$, and zero-boundary integer Lipschitz heights weighted by fixed $x\in[1/\sqrt2,1]$. Uniform real Lipschitz heights also converge to a Gaussian field; at a tuned opposite-boundary amplitude, their interface converges to chordal $\mathrm{SLE}_4$, establishing Schramm’s real-field/interface predictions.}{\href{https://github.com/openai/math/blob/main/preprints/Gaussian-free-field-limits-of-weighted-integer-Lipschitz-heights-October-6-2026/paper.pdf}{Weighted integer heights}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/The-Gaussian-free-field-limit-of-integer-Lipschitz-heights-with-two-arc-boundary-data-October-6-2026/paper.pdf}{Integer heights with two-arc boundary}\enspace\textperiodcentered\enspace\href{https://github.com/openai/math/blob/main/preprints/Uniform-real-Lipschitz-surfaces-on-the-triangular-lattice-October-6-2026/paper.pdf}{Uniform real Lipschitz surfaces}} -\resultentry{233}{The joint critical Ashkin--Teller scaling limit}{Identifies the joint scaling limit of Ashkin--Teller heights and both complete current-cluster collections throughout the critical line, including the four-state Potts endpoint. In bounded Jordan domains with admissible lattice approximations and wired primal/free dual boundaries, the height converges to the predicted Gaussian free field, and the clusters to canonical recursive sets of that same field, retaining every nesting depth.}{\href{https://github.com/openai/math/blob/main/preprints/The-joint-scaling-limit-of-critical-Ashkin-Teller-currents-September-25-2026/main.pdf}{The joint scaling limit of critical Ashkin-Teller currents}} +\resultentry{233}{The joint critical Ashkin--Teller scaling limit}{Identifies the joint scaling limit of Ashkin--Teller heights and both complete current-cluster collections throughout the critical line, including the four-state Potts endpoint. In bounded Jordan domains with admissible lattice approximations and wired primal/free dual boundaries, the height converges to the predicted Gaussian free field, and the clusters to canonical recursive sets of that same field, retaining every nesting depth.}{\href{https://github.com/openai/math/blob/main/preprints/The-joint-scaling-limit-of-critical-Ashkin-Teller-currents-October-6-2026/main.pdf}{The joint scaling limit of critical Ashkin-Teller currents}} \resultentry{234}{All-temperature pressure for orthogonally invariant Ising spin glasses}{Gives an exact variational formula for the limiting pressure of orthogonally invariant Ising spin glasses at every fixed temperature, both almost surely and in expectation. The coupling matrix is a Haar-random rotation of a deterministic spectrum converging to a compactly supported law, with extreme eigenvalues converging to its support edges. The zero-field ground-state energy follows as temperature tends to zero.}{\href{https://github.com/openai/math/blob/main/preprints/All-temperature-pressure-for-orthogonally-invariant-Ising-spin-glasses-September-25-2026/paper.pdf}{All-temperature pressure for orthogonally invariant Ising spin glasses}} @@ -777,9 +777,9 @@ \resultentry{340}{A counterexample to the nearby Lagrangian conjecture}{Disproves the unrestricted nearby Lagrangian conjecture. For some sufficiently large even $N$, constructs a closed exact embedded Lagrangian in $T^*(S^9\times S^{N-1})$ that is diffeomorphic to the base but not Hamiltonian isotopic to its zero section.}{\href{https://github.com/openai/math/blob/main/preprints/A-counterexample-to-the-nearby-Lagrangian-conjecture-September-23-2026/paper.pdf}{A counterexample to the nearby Lagrangian conjecture}} -\resultentry{341}{Donaldson's hypersymplectic deformation conjecture}{Proves Donaldson's hypersymplectic deformation conjecture in a cohomology-preserving form. Every positive triple of smooth closed two-forms on a closed connected oriented four-manifold, normalized by $\int\omega_i\wedge\omega_j=\delta_{ij}$, deforms through positive closed triples to a hyperk\"ahler triple while preserving all three cohomology classes. Any positive triple can first be normalized by a constant linear change.}{\href{https://github.com/openai/math/blob/main/preprints/Deforming-hypersymplectic-four-manifolds-to-hyperkahler-triples-September-23-2026/paper.pdf}{Deforming hypersymplectic four-manifolds to hyperkähler triples}} +\resultentry{341}{Donaldson's hypersymplectic deformation conjecture}{Proves Donaldson's hypersymplectic deformation conjecture in a cohomology-preserving form. Every positive triple of smooth closed two-forms on a closed connected oriented four-manifold, normalized by $\int\omega_i\wedge\omega_j=\delta_{ij}$, deforms through positive closed triples to a hyperk\"ahler triple while preserving all three cohomology classes. Any positive triple can first be normalized by a constant linear change.}{\href{https://github.com/openai/math/blob/main/preprints/Deforming-hypersymplectic-four-manifolds-to-hyperkahler-triples-October-7-2026/paper.pdf}{Deforming hypersymplectic four-manifolds to hyperkähler triples}} -\resultentry{342}{Donaldson's tamed-to-compatible conjecture}{Proves Donaldson's tamed-to-compatible conjecture: every smooth almost complex structure on a closed four-manifold that is tamed by a symplectic form admits a compatible symplectic form. The almost complex structure stays fixed; the form's cohomology class may change.}{\href{https://github.com/openai/math/blob/main/preprints/Taming-implies-compatibility-on-four-manifolds-September-23-2026/paper.pdf}{Taming implies compatibility on four-manifolds}} +\resultentry{342}{Donaldson's tamed-to-compatible conjecture}{Proves Donaldson's tamed-to-compatible conjecture: every smooth almost complex structure on a closed four-manifold that is tamed by a symplectic form admits a compatible symplectic form. The almost complex structure stays fixed; the form's cohomology class may change.}{\href{https://github.com/openai/math/blob/main/preprints/Taming-implies-compatibility-on-four-manifolds-October-6-2026/paper.pdf}{Taming implies compatibility on four-manifolds}} \resultentry{343}{Sharp symplectic ball-packing criteria in higher dimensions}{Resolves the Siegel--Yao conjecture for arbitrary capacities in every dimension $2n\ge6$. Finitely many closed symplectic balls of capacities $R_1,\ldots,R_k$ embed disjointly into an open ball of capacity $R$ exactly when $\sum_iR_i^n